[
  {
    "path": ".build/ReleaseCleanup.ps1",
    "content": "param (\n    [string]$cleanupTargetName,\n    [string]$cleanupDirectory\n)\n\nWrite-Host \"ReleaseCleanup script started...\"\n# This script deletes/rename files according to rules in ReleaseCleanupConfiguration.xml - it is used by automated builds\n\nif(-not($cleanupTargetName)) { Throw \"You must supply a value for -cleanupTargetName - matching a target name in ReleaseCleanupConfiguration.xml\" }\nif(-not($cleanupDirectory)) { Throw \"You must supply a value for -cleanupDirectory - this is the path where cleaning will be taking place\" }\n\n$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition\n[xml]$xml = Get-Content (Join-Path $scriptPath \"ReleaseCleanupConfiguration.xml\")\n\n$targetItems = $xml.SelectNodes(\"/Configuration/Target[@name='\" + $cleanupTargetName + \"']/*/*[@path]\")\n\nForeach ($fileNode in $targetItems) {\n    $relPath = $fileNode.Attributes[\"path\"].Value\n    $fullPath = Join-Path $cleanupDirectory $relPath\n\n    if (($fileNode.Attributes[\"rename-find\"]) -and ($fileNode.Attributes[\"rename-replace\"]) ) {\n        # if rename\n        Write-Host \"Handling $fullPath for renaming\"\n\n        $findString = $fileNode.Attributes[\"rename-find\"].Value.Replace(\"\\\",\"/\")\n        $replaceString = $fileNode.Attributes[\"rename-replace\"].Value\n    \n        $matches = Get-ChildItem -Path $fullPath -Recurse\n\n        if ($matches.length -eq 0) { Write-Warning \"Pattern matched 0 files - probably you should remove it from ReleaseCleanupConfiguration.xml in repo\" }\n        \n        Foreach ($match in $matches) {\n            $name = $match.FullName.Replace(\"\\\",\"/\")\n            $newName = $name.Replace($findString.Replace(\"\\\",\"/\"), $replaceString)\n\n            #ensure dir\n            $newDirPath = Split-Path -Path $newName\n            if (-not (Test-Path($newDirPath))) { New-Item -ItemType Directory -Force -Path $newDirPath }\n            Move-Item $match -Destination $newName -Force\n        }\n    }\n    else {\n        # assume delete otherwise\n        Write-Host \"Handling $fullPath for deletion\"\n\n        if (($fileNode.Name -eq \"Directory\") -and (Test-Path $fullPath)) {\n            Remove-Item -LiteralPath $fullPath -Force -Recurse\n        } else {\n            $matches = Get-ChildItem -Path $fullPath -Recurse\n\n            if ($matches.length -eq 0) { Write-Warning \"Pattern matched 0 files - probably you should remove it from ReleaseCleanupConfiguration.xml in repo\" }\n    \n            $matches | Where-Object { Test-Path($_) } | Remove-Item -Force -Recurse\n        }\n    } \n}\n"
  },
  {
    "path": ".build/ReleaseCleanupConfiguration.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<Configuration>\n\t<Target name=\"prejavascriptcompile\">\n\t\t<CleanupOperations>\n\t\t\t<!-- operations are done in sequence -->\n\t\t\t<Directory path=\"/obj\" />\n\t\t\t<Directory path=\"/test\" />\n\t\t\t<Directory path=\"/Composite/content/dialogs/tests\" />\n\t\t\t<Directory path=\"/Composite/content/views/dev/developer/tests\" />\n\t\t\t<Directory path=\"/Composite/content/views/search\" />\n\t\t\t<Directory path=\"/Composite/extensions\" />\n\t\t\t<File path=\"/App_Data/Composite/ReleaseBuild.Composite.config.changeHistory.txt\" />\n\t\t\t<File path=\"*.bat\" />\n\t\t\t<File path=\"DebugBuild.*\" />\n\t\t\t<File path=\"*.csproj*\" />\n\t\t\t<File path=\"/bin/*.pdb\" />\n\t\t\t<File path=\"/bin/Composite.xml\" rename-find=\".xml\" rename-replace=\".xml.yolo\" />\n\t\t\t<File path=\"/bin/*.xml\" />\n\t\t\t<File path=\"/bin/Composite.xml.yolo\" rename-find=\".xml.yolo\" rename-replace=\".xml\" />\n\t\t</CleanupOperations>\n\t</Target>\n\n\t<Target name=\"postjavascriptcompile\">\n\t\t<CleanupOperations>\n\t\t\t<Directory path=\"/Composite/scripts/source\" />\n\t\t\t<Directory path=\"/Composite/applets\" />\n\t\t\t<Directory path=\"/Composite/Images/Icons/svg\" />\n\t\t\t<Directory path=\"/Composite/Styles/default\" />\n\t\t\t<Directory path=\"/bower_components\" />\n\t\t\t<Directory path=\"/jspm_packages\" />\n\t\t\t<Directory path=\"/node_modules\" />\n\t\t\t<File path=\"/bower.json\" />\n\t\t\t<File path=\"/gruntfile.js\" />\n\t\t\t<File path=\"/package.json\" />\n\t\t\t<File path=\"/jspm.config.js\" />\n\t\t\t<File path=\"/package-lock.json\" />\n\t\t\t<File path=\"/packages.config\" />\n\t\t\t<File path=\"/Composite/Styles/styles.less\" />\n\t\t\t<File path=\"/Composite/console/index.prod.html\" rename-find=\"console/index.prod.html\" rename-replace=\"console.index.prod.html\" />\n\t\t\t<Directory path=\"/Composite/console\" />\n\t\t\t<File path=\"/Composite/console.index.prod.html\" rename-find=\"console.index.prod.html\" rename-replace=\"console/index.html\" />\n\t\t\t<File path=\".*\" />\n\t\t\t<File path=\"ReleaseBuild.*\" rename-find=\"ReleaseBuild.\" rename-replace=\"\" />\n\t\t\t<File path=\"/ReleaseCleanupConfiguration.xml\" />\n\t\t</CleanupOperations>\n\t</Target>\n</Configuration>\n"
  },
  {
    "path": ".editorconfig",
    "content": "# EditorConfig is awesome: http://EditorConfig.org\r\n\r\nroot = true\r\n\r\n[*]\r\nindent_style = tab\r\ncharset = utf-8\r\ntrim_trailing_whitespace = true\r\n\r\n[*.{cs,asmx,ashx,asax}]\r\nindent_style = space\r\nindent_size = 4\r\n\r\n[*.md]\r\ntrim_trailing_whitespace = false"
  },
  {
    "path": ".github/workflows/main.yml",
    "content": "# This is a basic workflow to help you get started with Actions\n\nname: CI\n\n\n# Controls when the action will run. \non:\n issues:\n    types:\n      [opened]\n\n# A workflow run is made up of one or more jobs that can run sequentially or in parallel\njobs:\n  # This workflow contains a single job called \"build\"\n  build:\n    # The type of runner that the job will run on\n    runs-on: ubuntu-latest\n\n    # Steps represent a sequence of tasks that will be executed as part of the job\n    steps:\n      - uses: danhellem/github-actions-issue-to-work-item@master\n        env:\n          ado_token: \"2fkdmowxykpxbjdesotpjddpvzodif5rd5vdsfrpxxsgrhuwmyiq\"\n          github_token: \"df9367d03c44f7cbae7cf24cbc20766fc165d4df\"\n          ado_organization: \"orckestra001\"\n          ado_project: \"OrckestraCommerce\"\n          ado_area_path: \"OrckestraCommerce\"\n          ado_iteration_path: \"OrckestraCommerce\"\n          ado_wit: \"Issue\"\n          ado_new_state: \"New\"\n          ado_active_state: \"Active\"\n          ado_close_state: \"Closed\"\n          ado_bypassrules: true\n"
  },
  {
    "path": ".gitignore",
    "content": "\n/.vs\n/Composite/bin\n/Composite/obj\n/Composite.Workflows/bin\n/Composite.Workflows/obj\n/Website/App_Data\n/Website/App_GlobalResources\n/Website/bower_components\n/Website/bin\n/Website/obj\n/Website/Composite/InstalledPackages\n/Website/Composite/scripts/compressed\n/Website/Composite/styles/styles.*\n/Website/Composite/content/forms/InstalledPackages\n/Website/Composite/lib\n/Website/Composite/console.js\n/Website/Composite/console.js.map\n/Website/Frontend\n/Website/node_modules\n/Website/jspm_packages\n/Website/coverage\n/Website/Composite/images/sprite.svg\n/Website/Composite/console/icons.svg\n/Website/Views\n/Website/Web.config\n/Website/test/e2e/screenshots/\n\n/Website/Blog*.ashx\n/Website/Newsletter.ashx\n\n\n/Bin/Composite.dll\n/Bin/Composite.Workflows.dll\n\n/Packages/\nselenium-debug.log\n/Website/test/e2e/reports/\n\nGitCommitInfo.cs\n\n/Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/autolink/plugin.min.js\n/Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/lists/plugin.min.js\n/Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/paste/plugin.min.js\n/Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/table/plugin.min.js\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/fonts/tinymce.woff\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/fonts/tinymce.ttf\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/fonts/tinymce.svg\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/fonts/tinymce.eot\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/fonts/tinymce-small.woff\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/fonts/tinymce-small.ttf\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/fonts/tinymce-small.svg\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/fonts/tinymce-small.eot\n/Website/Composite/content/misc/editors/visualeditor/tinymce/tinymce.min.js\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/skin.min.css\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/skin.ie7.min.css\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/img/trans.gif\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/img/object.gif\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/img/loader.gif\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/img/anchor.gif\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/content.min.css\n/Website/Composite/content/misc/editors/visualeditor/tinymce/skins/lightgray/content.inline.min.css\n"
  },
  {
    "path": ".tern-project",
    "content": "{\n  \"ecmaVersion\": 6,\n  \"libs\": [],\n  \"plugins\": {}\n}"
  },
  {
    "path": "Composite/AspNet/Caching/DonutCacheEntry.cs",
    "content": "using Composite.Core.Routing.Pages;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing System.Xml.Linq;\r\n\r\nnamespace Composite.AspNet.Caching\r\n{\r\n    [Serializable]\r\n    internal class DonutCacheEntry\r\n    {\r\n        private XDocument _document;\r\n\r\n        public DonutCacheEntry()\r\n        {\r\n        }\r\n\r\n        public DonutCacheEntry(HttpContext context, XDocument document)\r\n        {\r\n            Document = new XDocument(document);\r\n\r\n            var headers = context.Response.Headers;\r\n\r\n            var headersCopy = new List<HeaderElement>(headers.Count);\r\n            foreach (var name in headers.AllKeys)\r\n            {\r\n                headersCopy.Add(new HeaderElement(name, headers[name]));\r\n            }\r\n\r\n            OutputHeaders = headersCopy;\r\n            PathInfoUsed = C1PageRoute.PathInfoUsed;\r\n        }\r\n\r\n        public XDocument Document\r\n        {\r\n            get => new XDocument(_document);\r\n            set => _document = value;\r\n        }\r\n\r\n        public bool PathInfoUsed { get; set; }\r\n\r\n        public IReadOnlyCollection<HeaderElement> OutputHeaders { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Caching/OutputCacheHelper.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Runtime.Caching;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing System.Web.Configuration;\r\nusing System.Web.Hosting;\r\nusing System.Web.UI;\r\n\r\nnamespace Composite.AspNet.Caching\r\n{\r\n    internal static class OutputCacheHelper\r\n    {\r\n        private const string CacheProfileName = \"C1Page\";\r\n        private static readonly FieldInfo CacheabilityFieldInfo;\r\n\r\n        private static readonly Dictionary<string, OutputCacheProfile> _outputCacheProfiles;\r\n\r\n        static OutputCacheHelper()\r\n        {\r\n            CacheabilityFieldInfo = typeof(HttpCachePolicy).GetField(\"_cacheability\", BindingFlags.Instance | BindingFlags.NonPublic);\r\n\r\n            var section = WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath)\r\n                                                 .GetSection(\"system.web/caching/outputCacheSettings\");\r\n\r\n            if (section is OutputCacheSettingsSection settings)\r\n            {\r\n                _outputCacheProfiles = settings.OutputCacheProfiles.OfType<OutputCacheProfile>()\r\n                                               .ToDictionary(_ => _.Name);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns <value>true</value> and sets the cache key value for the current request if\r\n        /// ASP.NET full page caching is enabled.\r\n        /// </summary>\r\n        /// <param name=\"context\"></param>\r\n        /// <param name=\"cacheKey\"></param>\r\n        /// <returns></returns>\r\n        public static bool TryGetCacheKey(HttpContext context, out string cacheKey)\r\n        {\r\n            var cacheProfile = _outputCacheProfiles[CacheProfileName];\r\n\r\n            if (!cacheProfile.Enabled || cacheProfile.Duration <= 0\r\n                || !(cacheProfile.Location == (OutputCacheLocation) (-1) /* Unspecified */\r\n                     || cacheProfile.Location == OutputCacheLocation.Any\r\n                     || cacheProfile.Location == OutputCacheLocation.Server\r\n                     || cacheProfile.Location == OutputCacheLocation.ServerAndClient))\r\n            {\r\n                cacheKey = null;\r\n                return false;\r\n            }\r\n\r\n            var request = context.Request;\r\n\r\n            var sb = new StringBuilder(1 + request.Path.Length + (request.PathInfo ?? \"\").Length );\r\n\r\n            sb.Append(request.HttpMethod[0]).Append(request.Path).Append(request.PathInfo);\r\n\r\n            if (cacheProfile.VaryByCustom != null)\r\n            {\r\n                string custom = context.ApplicationInstance.GetVaryByCustomString(context, cacheProfile.VaryByCustom);\r\n                sb.Append(\"c\").Append(custom);\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(cacheProfile.VaryByParam))\r\n            {\r\n                var filter = GetVaryByFilter(cacheProfile.VaryByParam);\r\n\r\n                AppendParameters(sb, \"Q\", request.QueryString, filter);\r\n\r\n                if (request.HttpMethod == \"POST\")\r\n                {\r\n                    AppendParameters(sb, \"F\", request.Form, filter);\r\n                }\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(cacheProfile.VaryByHeader))\r\n            {\r\n                var filter = GetVaryByFilter(cacheProfile.VaryByHeader);\r\n\r\n                AppendParameters(sb, \"H\", request.Headers, filter);\r\n            }\r\n\r\n            cacheKey = sb.ToString();\r\n            return true;\r\n        }\r\n\r\n        private static Func<string, bool> GetVaryByFilter(string varyBy)\r\n        {\r\n            if (varyBy == \"*\")\r\n            {\r\n                return parameter => true;\r\n            }\r\n\r\n            var list = varyBy.Split(';');\r\n            return parameter => list.Contains(parameter);\r\n        }\r\n\r\n\r\n        private static void AppendParameters(StringBuilder sb, string cacheKeyDelimiter, NameValueCollection collection, Func<string, bool> filter)\r\n        {\r\n            foreach (string key in collection.OfType<string>().Where(filter))\r\n            {\r\n                sb.Append(cacheKeyDelimiter).Append(key).Append(\"=\").Append(collection[key]);\r\n            }\r\n        }\r\n\r\n\r\n        public static DonutCacheEntry GetFromCache(HttpContext context, string cacheKey)\r\n        {\r\n            var provider = GetCacheProvider(context);\r\n\r\n            if (provider == null)\r\n            {\r\n                return MemoryCache.Default.Get(cacheKey) as DonutCacheEntry;\r\n            }\r\n\r\n            return provider.Get(cacheKey) as DonutCacheEntry;\r\n        }\r\n\r\n\r\n        public static void AddToCache(HttpContext context, string cacheKey, DonutCacheEntry entry)\r\n        {\r\n            var provider = GetCacheProvider(context);\r\n\r\n            if (provider == null)\r\n            {\r\n                MemoryCache.Default.Add(cacheKey, entry, new CacheItemPolicy\r\n                {\r\n                    SlidingExpiration = TimeSpan.FromSeconds(60)\r\n                });\r\n                return;\r\n            }\r\n\r\n            provider.Add(cacheKey, entry, DateTime.UtcNow.AddSeconds(60));\r\n        }\r\n\r\n\r\n        static OutputCacheProvider GetCacheProvider(HttpContext context)\r\n        {\r\n            var cacheName = context.ApplicationInstance.GetOutputCacheProviderName(context);\r\n\r\n            return cacheName != \"AspNetInternalProvider\" ? OutputCache.Providers?[cacheName] : null;\r\n        }\r\n\r\n\r\n        public static bool ResponseCacheable(HttpContext context)\r\n        {\r\n            if (context.Response.StatusCode != 200)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            var cacheability = GetPageCacheability(context);\r\n\r\n            return cacheability > HttpCacheability.NoCache;\r\n        }\r\n\r\n\r\n        private static HttpCacheability GetPageCacheability(HttpContext context)\r\n            => (HttpCacheability)CacheabilityFieldInfo.GetValue(context.Response.Cache);\r\n\r\n\r\n\r\n        public static void InitializeFullPageCaching(HttpContext context)\r\n        {\r\n            using (var page = new CacheableEmptyPage())\r\n            {\r\n                page.ProcessRequest(context);\r\n            }\r\n        }\r\n\r\n\r\n        private class CacheableEmptyPage : Page\r\n        {\r\n            protected override void FrameworkInitialize()\r\n            {\r\n                base.FrameworkInitialize();\r\n\r\n                // That's an equivalent of having <%@ OutputCache CacheProfile=\"C1Page\" %> \r\n                // on an *.aspx page\r\n\r\n                InitOutputCache(new OutputCacheParameters\r\n                {\r\n                    CacheProfile = CacheProfileName\r\n                });\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/CmsPageHttpHandler.cs",
    "content": "using System.Web;\r\nusing System.Xml.Linq;\r\nusing Composite.AspNet.Caching;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Core.WebClient.Renderings;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.AspNet\r\n{\r\n    /// <summary>\r\n    /// Renders page templates without building a Web Form's control tree.\r\n    /// Contains a custom implementation of \"donut caching\".\r\n    /// </summary>\r\n    internal class CmsPageHttpHandler: IHttpHandler\r\n    {\r\n        public void ProcessRequest(HttpContext context)\r\n        {\r\n            OutputCacheHelper.InitializeFullPageCaching(context);\r\n\r\n            using (var renderingContext = RenderingContext.InitializeFromHttpContext())\r\n            {\r\n                bool cachingEnabled = false;\r\n                string cacheKey = null;\r\n                DonutCacheEntry cacheEntry = null;\r\n\r\n                bool consoleUserLoggedIn = Composite.C1Console.Security.UserValidationFacade.IsLoggedIn();\r\n\r\n                // \"Donut caching\" is enabled for logged in users, only if profiling is enabled as well.\r\n                if (!renderingContext.CachingDisabled\r\n                    && (!consoleUserLoggedIn || renderingContext.ProfilingEnabled))\r\n                {\r\n                    cachingEnabled = OutputCacheHelper.TryGetCacheKey(context, out cacheKey);\r\n                    if (cachingEnabled)\r\n                    {\r\n                        using (Profiler.Measure(\"Cache lookup\"))\r\n                        {\r\n                            cacheEntry = OutputCacheHelper.GetFromCache(context, cacheKey);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                XDocument document;\r\n                var functionContext = PageRenderer.GetPageRenderFunctionContextContainer();\r\n\r\n                bool allFunctionsExecuted = false;\r\n                bool preventResponseCaching = false;\r\n\r\n                if (cacheEntry != null)\r\n                {\r\n                    document = cacheEntry.Document;\r\n                    foreach (var header in cacheEntry.OutputHeaders)\r\n                    {\r\n                        context.Response.Headers[header.Name] = header.Value;\r\n                    }\r\n\r\n                    if(cacheEntry.PathInfoUsed)\r\n                    {\r\n                        C1PageRoute.RegisterPathInfoUsage();\r\n                    }\r\n\r\n                    // Making sure this response will not go to the output cache\r\n                    preventResponseCaching = true;\r\n                }\r\n                else\r\n                {\r\n                    if (renderingContext.RunResponseHandlers())\r\n                    {\r\n                        return;\r\n                    }\r\n\r\n                    var renderer = PageTemplateFacade.BuildPageRenderer(renderingContext.Page.TemplateId);\r\n\r\n                    var slimRenderer = (ISlimPageRenderer) renderer;\r\n\r\n                    using (Profiler.Measure($\"{nameof(ISlimPageRenderer)}.Render\"))\r\n                    {\r\n                        document = slimRenderer.Render(renderingContext.PageContentToRender, functionContext);\r\n                    }\r\n\r\n                    allFunctionsExecuted = PageRenderer.ExecuteCacheableFunctions(document.Root, functionContext);\r\n\r\n                    if (cachingEnabled && !allFunctionsExecuted && OutputCacheHelper.ResponseCacheable(context))\r\n                    {\r\n                        preventResponseCaching = true;\r\n\r\n                        if (!functionContext.ExceptionsSuppressed)\r\n                        {\r\n                            using (Profiler.Measure(\"Adding to cache\"))\r\n                            {\r\n                                OutputCacheHelper.AddToCache(context, cacheKey, new DonutCacheEntry(context, document));\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (!allFunctionsExecuted)\r\n                {\r\n                    using (Profiler.Measure(\"Executing embedded functions\"))\r\n                    {\r\n                        PageRenderer.ExecuteEmbeddedFunctions(document.Root, functionContext);\r\n                    }\r\n                }\r\n\r\n                using (Profiler.Measure(\"Resolving page fields\"))\r\n                {\r\n                    PageRenderer.ResolvePageFields(document, renderingContext.Page);\r\n                }\r\n\r\n                string xhtml;\r\n                if (document.Root.Name == RenderingElementNames.Html)\r\n                {\r\n                    var xhtmlDocument = new XhtmlDocument(document);\r\n\r\n                    PageRenderer.ProcessXhtmlDocument(xhtmlDocument, renderingContext.Page);\r\n                    PageRenderer.ProcessDocumentHead(xhtmlDocument);\r\n\r\n                    xhtml = xhtmlDocument.ToString();\r\n                }\r\n                else\r\n                {\r\n                    xhtml = document.ToString();\r\n                }\r\n\r\n                if (renderingContext.PreRenderRedirectCheck())\r\n                {\r\n                    return;\r\n                }\r\n\r\n                xhtml = renderingContext.ConvertInternalLinks(xhtml);\r\n\r\n                if (GlobalSettingsFacade.PrettifyPublicMarkup)\r\n                {\r\n                    xhtml = renderingContext.FormatXhtml(xhtml);\r\n                }\r\n\r\n                var response = context.Response;\r\n\r\n                // Disabling ASP.NET cache if there's a logged-in user\r\n                if (consoleUserLoggedIn || preventResponseCaching)\r\n                {\r\n                    using (preventResponseCaching ? Profiler.Measure(\"CmsPageHttpHandler: Disabling HTTP caching as at least one of the functions is not cacheable\") : EmptyDisposable.Instance)\r\n                    {\r\n                        context.Response.Cache.SetCacheability(HttpCacheability.NoCache);\r\n                    }\r\n                }\r\n\r\n                // Inserting performance profiling information\r\n                if (renderingContext.ProfilingEnabled)\r\n                {\r\n                    xhtml = renderingContext.BuildProfilerReport();\r\n\r\n                    response.ContentType = \"text/xml\";\r\n                }\r\n\r\n                response.Write(xhtml);\r\n            }\r\n        }\r\n\r\n\r\n        public bool IsReusable => true;\r\n    }\r\n}"
  },
  {
    "path": "Composite/AspNet/CmsPageSiteMapNode.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.Web;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.AspNet\r\n{\r\n    /// <summary>\r\n    /// Represents an <see cref=\"IPage\"/> instance in a sitemap.\r\n    /// </summary>\r\n    public class CmsPageSiteMapNode : SiteMapNode, ICmsSiteMapNode, ISchemaOrgSiteMapNode\r\n    {\r\n        private int? _depth;\r\n\r\n        /// <inheritdoc />\r\n        public CultureInfo Culture { get; protected set; }\r\n\r\n        /// <inheritdoc />\r\n        public int? Priority { get; protected set; }\r\n\r\n        /// <summary>\r\n        /// Gets the current page.\r\n        /// </summary>\r\n        public IPage Page { get; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the depth.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The depth.\r\n        /// </value>\r\n        public int Depth\r\n        {\r\n            get\r\n            {\r\n                if (_depth == null)\r\n                {\r\n                    var depth = 0;\r\n                    var id = Page.Id;\r\n\r\n                    const int maxDepth = 1000;\r\n\r\n                    using (new DataScope(Page.DataSourceId.PublicationScope, Page.DataSourceId.LocaleScope))\r\n                    {\r\n                        while (id != Guid.Empty && depth < maxDepth)\r\n                        {\r\n                            depth++;\r\n                            id = PageManager.GetParentId(id);\r\n                        }\r\n\r\n                        if (depth == maxDepth)\r\n                        {\r\n                            throw new InvalidOperationException(\"Endless page loop\");\r\n                        }\r\n                    }\r\n\r\n                    _depth = depth;\r\n                }\r\n\r\n                return _depth.Value;\r\n            }\r\n\r\n            protected set => _depth = value;\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public DateTime LastModified { get; }\r\n\r\n        /// <inheritdoc />\r\n        public SiteMapNodeChangeFrequency? ChangeFrequency { get; protected set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the document title.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The document title.\r\n        /// </value>\r\n        public string DocumentTitle { get; }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"CmsPageSiteMapNode\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"provider\">The provider.</param>\r\n        /// <param name=\"page\">The page.</param>\r\n        public CmsPageSiteMapNode(SiteMapProvider provider, IPage page)\r\n            : base(provider, page.Id.ToString(), PageUrls.BuildUrl(page), page.MenuTitle, page.Description)\r\n        {\r\n            Page = page;\r\n            DocumentTitle = page.Title;\r\n            LastModified = page.ChangeDate;\r\n            Priority = 5;\r\n\r\n            Culture = page.DataSourceId.LocaleScope;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool Equals(CmsPageSiteMapNode obj)\r\n        {\r\n            return Key == obj.Key && Culture.Equals(obj.Culture);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override bool Equals(object obj)\r\n        {\r\n            var pageSiteMapNode = obj as CmsPageSiteMapNode;\r\n            if (pageSiteMapNode != null)\r\n            {\r\n                return Equals(pageSiteMapNode);\r\n            }\r\n\r\n            return base.Equals(obj);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override SiteMapNode Clone()\r\n        {\r\n            return new CmsPageSiteMapNode(this.Provider, Page);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override int GetHashCode()\r\n        {\r\n            return Key.GetHashCode() ^ Culture.GetHashCode();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool operator ==(CmsPageSiteMapNode a, CmsPageSiteMapNode b)\r\n        {\r\n            if (Object.ReferenceEquals(a, b))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            if ((object)a == null || (object)b == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return a.Equals(b);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool operator !=(CmsPageSiteMapNode a, CmsPageSiteMapNode b)\r\n        {\r\n            return !(a == b);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/CmsPageSiteMapProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.AspNet\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"SiteMapProvider\"/> which returns nodes returned by registered <see cref=\"ISiteMapPlugin\"/>.\r\n    /// </summary>\r\n    public class CmsPageSiteMapProvider : SiteMapProvider, ICmsSiteMapProvider\r\n    {\r\n        private static readonly SiteMapNodeCollection EmptyCollection = SiteMapNodeCollection.ReadOnly(new SiteMapNodeCollection());\r\n\r\n        private readonly List<ISiteMapPlugin> _plugins;\r\n\r\n        /// <inheritdoc />\r\n        public override SiteMapNode CurrentNode\r\n        {\r\n            get\r\n            {\r\n                var context = HttpContext.Current;\r\n                var node = ResolveSiteMapNode(context) ?? FindSiteMapNode(context);\r\n\r\n                return SecurityTrimNode(node);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override SiteMapProvider RootProvider => ParentProvider?.RootProvider ?? this;\r\n\r\n        /// <exclude />\r\n        public override SiteMapNode RootNode => SecurityTrimNode(GetRootNodeCore());\r\n\r\n        /// <inheritdoc />\r\n        public CmsPageSiteMapProvider()\r\n        {\r\n            _plugins = ServiceLocator.GetServices<ISiteMapPlugin>().ToList();\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override SiteMapNode FindSiteMapNode(HttpContext context)\r\n        {\r\n            var contextBase = new HttpContextWrapper(context);\r\n\r\n            foreach (var plugin in _plugins)\r\n            {\r\n                var node = plugin.FindSiteMapNode(this, contextBase);\r\n                if (node != null)\r\n                {\r\n                    return SecurityTrimNode(node);\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override SiteMapNode FindSiteMapNodeFromKey(string key)\r\n        {\r\n            foreach (var plugin in _plugins)\r\n            {\r\n                var node = plugin.FindSiteMapNodeFromKey(this, key);\r\n                if (node != null)\r\n                {\r\n                    return SecurityTrimNode(node);\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)\r\n        {\r\n            Verify.ArgumentNotNull(node, nameof(node));\r\n\r\n            var childNodes = _plugins.SelectMany(plugin => plugin.GetChildNodes(node)\r\n                                                           ?? Enumerable.Empty<SiteMapNode>()).ToList();\r\n\r\n            childNodes = SecurityTrimList(childNodes);\r\n\r\n            if (!childNodes.Any())\r\n            {\r\n                return EmptyCollection;\r\n            }\r\n\r\n            return new SiteMapNodeCollection(childNodes.ToArray());\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override SiteMapNode GetParentNode(SiteMapNode node)\r\n        {\r\n            Verify.ArgumentNotNull(node, nameof(node));\r\n\r\n            SiteMapNode parentNode = null;\r\n\r\n            foreach (var plugin in _plugins)\r\n            {\r\n                parentNode = plugin.GetParentNode(node);\r\n                if (parentNode != null)\r\n                {\r\n                    break;\r\n                }\r\n            }\r\n\r\n            return SecurityTrimNode(parentNode);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        protected override SiteMapNode GetRootNodeCore()\r\n        {\r\n            var siteMapContext = SiteMapContext.Current;\r\n\r\n            var rootPage = siteMapContext?.RootPage;\r\n            if (rootPage == null)\r\n            {\r\n                var homePageId = SitemapNavigator.CurrentHomePageId;\r\n                if (homePageId == Guid.Empty)\r\n                {\r\n                    var context = HttpContext.Current;\r\n                    if (context == null)\r\n                    {\r\n                        homePageId = PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault();\r\n                    }\r\n                    else\r\n                    {\r\n                        using (var data = new DataConnection())\r\n                        {\r\n                            var pageNode = data.SitemapNavigator.GetPageNodeByHostname(context.Request.Url.Host);\r\n\r\n                            homePageId = pageNode?.Id ?? Guid.Empty;\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (homePageId != Guid.Empty)\r\n                {\r\n                    rootPage = PageManager.GetPageById(homePageId);\r\n                }\r\n            }\r\n\r\n            if (rootPage == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var node = new CmsPageSiteMapNode(this, rootPage);\r\n\r\n            return SecurityTrimNode(node);\r\n        }\r\n\r\n        /// <exclude />\r\n        public ICollection<CmsPageSiteMapNode> GetRootNodes()\r\n        {\r\n            var list = new List<CmsPageSiteMapNode>();\r\n\r\n            foreach (var rootPageId in PageManager.GetChildrenIDs(Guid.Empty))\r\n            {\r\n                foreach (var culture in DataLocalizationFacade.ActiveLocalizationCultures)\r\n                {\r\n                    using (new DataScope(culture))\r\n                    {\r\n                        var page = PageManager.GetPageById(rootPageId);\r\n                        if (page != null)\r\n                        {\r\n                            list.Add(new CmsPageSiteMapNode(this, page));\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return SecurityTrimList(list);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override SiteMapNode FindSiteMapNode(string rawUrl)\r\n        {\r\n            foreach (var plugin in _plugins)\r\n            {\r\n                var node = plugin.FindSiteMapNode(this, rawUrl);\r\n                if (node != null)\r\n                {\r\n                    return SecurityTrimNode(node);\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override bool IsAccessibleToUser(HttpContext ctx, SiteMapNode node)\r\n        {\r\n            var ctxBase = new HttpContextWrapper(ctx);\r\n\r\n            return _plugins.All(plugin => plugin.IsAccessibleToUser(ctxBase, node));\r\n        }\r\n\r\n        private T SecurityTrimNode<T>(T node) where T : SiteMapNode\r\n        {\r\n            if (node == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (SecurityTrimmingEnabled)\r\n            {\r\n                var context = HttpContext.Current;\r\n                if (!node.IsAccessibleToUser(context))\r\n                {\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            return node;\r\n        }\r\n\r\n        private List<T> SecurityTrimList<T>(List<T> list) where T : SiteMapNode\r\n        {\r\n            if (list == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (SecurityTrimmingEnabled && list.Count > 0)\r\n            {\r\n                var context = HttpContext.Current;\r\n\r\n                return list.Where(child => child.IsAccessibleToUser(context)).ToList();\r\n            }\r\n\r\n            return list;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/CmsPagesSiteMapPlugin.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing Composite.Core.Extensions;\nusing Composite.Core.Routing;\nusing Composite.Core.WebClient.Renderings.Page;\nusing Composite.Data;\nusing Composite.Data.Types;\n\nnamespace Composite.AspNet\n{\n    /// <exclude />\n    public class CmsPagesSiteMapPlugin : ISiteMapPlugin\n    {\n        /// <exclude />\n        public List<SiteMapNode> GetChildNodes(SiteMapNode node)\n        {\n            var pageSiteMapNode = node as CmsPageSiteMapNode;\n            if (pageSiteMapNode != null)\n            {\n                using (new DataScope(pageSiteMapNode.Culture))\n                {\n                    var pageChildNodes = PageManager.GetChildrenIDs(pageSiteMapNode.Page.Id)\n                        .Select(PageManager.GetPageById)\n                        .Where(p => p != null)\n                        .Select(p => new CmsPageSiteMapNode(node.Provider, p))\n                        .OfType<SiteMapNode>()\n                        .ToList();\n\n                    return pageChildNodes;\n                }\n            }\n\n            return null;\n        }\n\n        /// <exclude />\n        public SiteMapNode GetParentNode(SiteMapNode node)\n        {\n            var pageSiteMapNode = node as CmsPageSiteMapNode;\n            if (pageSiteMapNode != null)\n            {\n                IPage parentPage = null;\n\n                using (new DataScope(pageSiteMapNode.Culture))\n                {\n                    var parentPageId = PageManager.GetParentId(pageSiteMapNode.Page.Id);\n                    if (parentPageId != Guid.Empty)\n                    {\n                        parentPage = PageManager.GetPageById(parentPageId);\n                    }\n                }\n\n                if (parentPage != null)\n                {\n                    return new CmsPageSiteMapNode(node.Provider, parentPage);\n                }\n\n                return node.Provider.ParentProvider?.GetParentNode(node);\n            }\n\n            return null;\n        }\n\n        /// <exclude />\n        public SiteMapNode FindSiteMapNode(SiteMapProvider provider, HttpContextBase context)\n        {\n            var key = PageRenderer.CurrentPageId.ToString();\n\n            return FindSiteMapNodeFromKey(provider, key);\n        }\n\n        /// <exclude />\n        public SiteMapNode FindSiteMapNode(SiteMapProvider provider, string rawUrl)\n        {\n            var pageUrl = PageUrls.ParseUrl(rawUrl);\n            if (pageUrl == null || !String.IsNullOrEmpty(pageUrl.PathInfo))\n            {\n                return null;\n            }\n\n            var page = pageUrl.GetPage();\n            if (page == null)\n            {\n                return null;\n            }\n\n            return new CmsPageSiteMapNode(provider, page);\n        }\n\n        /// <exclude />\n        public SiteMapNode FindSiteMapNodeFromKey(SiteMapProvider provider, string key)\n        {\n            if (Guid.TryParse(key, out var pageId))\n            {\n                var page = PageManager.GetPageById(pageId);\n                if (page != null)\n                {\n                    return new CmsPageSiteMapNode(provider, page);\n                }\n            }\n\n            return null;\n        }\n\n        /// <exclude />\n        public bool IsAccessibleToUser(HttpContextBase context, SiteMapNode node)\n        {\n            return true;\n        }\n    }\n}"
  },
  {
    "path": "Composite/AspNet/ICmsSiteMapNode.cs",
    "content": "using System.Globalization;\nusing System.Web;\n\nnamespace Composite.AspNet\n{\n    /// <summary>\n    /// Used as an extension to <see cref=\"SiteMapNode\"/> when building a ASP.NET sitemap based on cms pages.\n    /// </summary>\n    public interface ICmsSiteMapNode\n    {\n        /// <summary>\n        /// Gets the culture to which the site map node belongs.\n        /// </summary>\n        /// <value>\n        /// The culture.\n        /// </value>\n        CultureInfo Culture { get; }\n    }\n}\n"
  },
  {
    "path": "Composite/AspNet/ICmsSiteMapProvider.cs",
    "content": "using System.Collections.Generic;\n\nnamespace Composite.AspNet\n{\n    /// <summary>\r\n    /// An inteface for getting site map data required for rendering /Sitemap.xml file.\r\n    /// </summary>\n    public interface ICmsSiteMapProvider\n    {\n        /// <summary>\r\n        /// Gets the root nodes.\r\n        /// </summary>\r\n        ICollection<CmsPageSiteMapNode> GetRootNodes();\n    }\n}\n"
  },
  {
    "path": "Composite/AspNet/ISchemaOrgSiteMapNode.cs",
    "content": "using System;\nusing System.Web;\n\nnamespace Composite.AspNet\n{\n    /// <summary>\n    /// Provides infomation that is used as an addition to <see cref=\"SiteMapNode\"/> when generating sitemap xml file.\n    /// See https://www.sitemaps.org for details\n    /// </summary>\n    public interface ISchemaOrgSiteMapNode\n    {\n        /// <summary>\n        /// Gets the last modification time.\n        /// </summary>\n        /// <value>\n        /// The last modification time.\n        /// </value>\n        DateTime LastModified { get; }\n\n        /// <summary>\n        /// Gets the change frequency.\n        /// </summary>\n        /// <value>\n        /// The change frequency.\n        /// </value>\n        SiteMapNodeChangeFrequency? ChangeFrequency { get; }\n\n        /// <summary>\n        /// Gets the priority.\n        /// </summary>\n        /// <value>\n        /// The priority.\n        /// </value>\n        int? Priority { get; }\n    }\n}\n"
  },
  {
    "path": "Composite/AspNet/ISiteMapPlugin.cs",
    "content": "using System.Collections.Generic;\nusing System.Web;\n\nnamespace Composite.AspNet\n{\n    /// <summary>\n    /// Defines the contract for a plugin to interact with <see cref=\"CmsPageSiteMapProvider\" /> to provide <see cref=\"SiteMapNode\"/> and handle security trimming\n    /// </summary>\n    public interface ISiteMapPlugin\n    {\n        /// <summary>\n        /// Retrieves the child nodes of a specific <see cref=\"SiteMapNode\"/>.\n        /// </summary>\n        /// <param name=\"node\"></param>\n        /// <returns></returns>\n        List<SiteMapNode> GetChildNodes(SiteMapNode node);\n\n        /// <summary>\n        /// Retrieves the parent node of a specific <see cref=\"SiteMapNode\"/> object.\n        /// </summary>\n        /// <param name=\"node\"></param>\n        /// <returns></returns>\n        SiteMapNode GetParentNode(SiteMapNode node);\n\n        /// <summary>\n        /// Retrieves a <see cref=\"SiteMapNode\"/> object that represents a page.\n        /// </summary>\n        /// <param name=\"provider\"></param>\n        /// <param name=\"rawUrl\"></param>\n        /// <returns></returns>\n        SiteMapNode FindSiteMapNode(SiteMapProvider provider, string rawUrl);\n\n        /// <summary>\n        /// Retrieves a <see cref=\"SiteMapNode\"/> object based on <see cref=\"HttpContextBase\"/>.\n        /// </summary>\n        /// <param name=\"provider\"></param>\n        /// <param name=\"context\"></param>\n        /// <returns></returns>\n        SiteMapNode FindSiteMapNode(SiteMapProvider provider, HttpContextBase context);\n\n        /// <summary>\n        /// Retrieves a <see cref=\"SiteMapNode\"/> object based on a specified key.\n        /// </summary>\n        /// <param name=\"provider\"></param>\n        /// <param name=\"key\"></param>\n        /// <returns></returns>\n        SiteMapNode FindSiteMapNodeFromKey(SiteMapProvider provider, string key);\n\n        /// <summary>\n        /// Retrieves a Boolean value indicating whether the specified <see cref=\"SiteMapNode\"/> object can be viewed by the user in the specified context.\n        /// </summary>\n        /// <param name=\"context\"></param>\n        /// <param name=\"node\"></param>\n        /// <returns></returns>\n        bool IsAccessibleToUser(HttpContextBase context, SiteMapNode node);\n    }\n}\n"
  },
  {
    "path": "Composite/AspNet/Razor/C1HtmlHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.WebPages.Html;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.Media;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    /// <summary>\r\n    /// Extension object to be used in Razor code\r\n    /// </summary>\r\n    public class C1HtmlHelper\r\n    {\r\n        private readonly HtmlHelper _helper;\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"C1HtmlHelper\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"helper\">The helper.</param>\r\n        public C1HtmlHelper(HtmlHelper helper)\r\n        {\r\n            _helper = helper;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(IPage page)\r\n        {\r\n            return PageUrl(page.Id);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(DataReference<IPage> page)\r\n        {\r\n            return PageUrl(((Guid) page.KeyValue));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        /// <param name=\"querystring\">The querystring object.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(IPage page, object querystring)\r\n        {\r\n            return PageUrl(page.Id, querystring);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        /// <param name=\"querystring\">An object which properties' values will be passes as query string.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(IPage page, IDictionary<string, string> querystring)\r\n        {\r\n            return PageUrl(page.Id, querystring);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(string pageId, object querystring = null)\r\n        {\r\n            return PageUrl(new Guid(pageId), querystring);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(Guid pageId)\r\n        {\r\n            return PageUrl(pageId, null);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(Guid pageId, object querystring)\r\n        {\r\n            var dict = Functions.ObjectToDictionary(querystring);\r\n\r\n            return PageUrl(pageId, dict);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(string pageId, IDictionary<string, object> querystring)\r\n        {\r\n            return PageUrl(new Guid(pageId), querystring);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a URL for a specific C1 page\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageUrl(Guid pageId, IDictionary<string, object> querystring)\r\n        {\r\n            string relativeUrl = \"~/page(\" + pageId + \")\";\r\n            string absoluteUrl = VirtualPathUtility.ToAbsolute(relativeUrl);\r\n\r\n            if (querystring != null && querystring.Keys.Count > 0)\r\n            {\r\n                absoluteUrl += \"?\" + SerializeQueryString(querystring);\r\n            }\r\n\r\n            return _helper.Raw(absoluteUrl);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"mediaFile\">The media file.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(IMediaFile mediaFile)\r\n        {\r\n            return MediaUrl(mediaFile.KeyPath);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"mediaFile\">The media file.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(DataReference<IMediaFile> mediaFile) \r\n        {\r\n            return MediaUrl((string) mediaFile.KeyValue);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"mediaFile\">The media file.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(NullableDataReference<IMediaFile> mediaFile)\r\n        {\r\n            if (!mediaFile.IsSet)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return MediaUrl((string) mediaFile.KeyValue);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"image\">The image file.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(DataReference<IImageFile> image)\r\n        {\r\n            return MediaUrl((string)image.KeyValue);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"image\">The image file.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(NullableDataReference<IImageFile> image)\r\n        {\r\n            if (!image.IsSet)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return MediaUrl((string)image.KeyValue);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"image\">The image file.</param>\r\n        /// <param name=\"resizingOptions\">The resizing options.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(DataReference<IImageFile> image, ResizingOptions resizingOptions)\r\n        {\r\n            return MediaUrl((string) image.KeyValue, resizingOptions);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"image\">The image file.</param>\r\n        /// <param name=\"resizingOptions\">The resizing options.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(IImageFile image, ResizingOptions resizingOptions)\r\n        {\r\n            return MediaUrl(image.KeyPath, resizingOptions);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"mediaFile\">The media file.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(IMediaFile mediaFile, object querystring)\r\n        {\r\n            return MediaUrl(mediaFile.KeyPath, querystring);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"mediaFile\">The media file.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(IMediaFile mediaFile, IDictionary<string, string> querystring)\r\n        {\r\n            return MediaUrl(mediaFile.KeyPath, querystring);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"mediaId\">Id of a media file.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(Guid mediaId, object querystring = null)\r\n        {\r\n            return MediaUrl(mediaId.ToString(), querystring);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"mediaId\">Id of a media file.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(Guid mediaId, IDictionary<string, string> querystring)\r\n        {\r\n            return MediaUrl(mediaId.ToString(), querystring);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"keyPath\">The keyPath property of a media item.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(string keyPath, object querystring = null)\r\n        {\r\n            var dict = Functions.ObjectToDictionary(querystring);\r\n\r\n            return MediaUrl(keyPath, dict);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"keyPath\">The keyPath property of a media item.</param>\r\n        /// <param name=\"querystring\">The querystring.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(string keyPath, IDictionary<string, object> querystring)\r\n        {\r\n            string relativeUrl = \"~/media(\" + keyPath + \")\";\r\n            string absoluteUrl = VirtualPathUtility.ToAbsolute(relativeUrl);\r\n\r\n            if (querystring != null && querystring.Keys.Count > 0)\r\n            {\r\n                absoluteUrl += \"?\" + SerializeQueryString(querystring);\r\n            }\r\n\r\n            return _helper.Raw(absoluteUrl);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a media url.\r\n        /// </summary>\r\n        /// <param name=\"keyPath\">Image's KeyPath field value.</param>\r\n        /// <param name=\"resizingOptions\">The resizing options.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString MediaUrl(string keyPath, ResizingOptions resizingOptions)\r\n        {\r\n            string relativeUrl = \"~/media(\" + keyPath + \")\";\r\n            string absoluteUrl = VirtualPathUtility.ToAbsolute(relativeUrl);\r\n\r\n            string queryString = resizingOptions.ToString();\r\n\r\n            if (!string.IsNullOrEmpty(queryString))\r\n            {\r\n                absoluteUrl += \"?\" + queryString.Replace(\"&\", \"&amp;\");\r\n            }\r\n\r\n            return _helper.Raw(absoluteUrl);\r\n        }\r\n\r\n\r\n        private static string SerializeQueryString(IDictionary<string, object> querystring)\r\n        {\r\n            return String.Join(\"&amp;\",\r\n                querystring.Select(kvp => HttpUtility.UrlEncode(kvp.Key)\r\n                                          + \"=\" + HttpUtility.UrlEncode(kvp.Value.ToString())));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Renders the specified XNode.\r\n        /// </summary>\r\n        /// <param name=\"xNode\">The <see cref=\"XNode\">XNode</see>.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString Markup(XNode xNode)\r\n        {\r\n            if (xNode == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            // TODO: optimize so XNode doesn't get serialized/deserialized\r\n\r\n            return _helper.Raw(xNode.ToString());\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Includes a named Page Template Feature. Page Template Feature are managed in '~/App_Data/PageTemplateFeatures' \r\n        /// or via the C1 Console's Layout perspective. They contain html and functional snippets.\r\n        /// </summary>\r\n        /// <param name=\"featureName\">Name of the Page Template Feature to include. Names do not include an extension.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString GetPageTemplateFeature(string featureName)\r\n        {\r\n            XElement documentRoot = PageTemplateFeatureFacade.GetPageTemplateFeature(featureName).Root;\r\n\r\n            return _helper.Raw(documentRoot.ToString());\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Renders the specified XNode-s.\r\n        /// </summary>\r\n        /// <param name=\"xNodes\">The collection of <see cref=\"XNode\">XNode</see> objects.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString Markup(IEnumerable<XNode> xNodes)\r\n        {\r\n            if (xNodes == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            // TODO: optimize so XNode-s don't get serialized/deserialized\r\n\r\n            var sb = new StringBuilder();\r\n            foreach (var xNode in xNodes)\r\n            {\r\n                if (xNode == null) continue;\r\n\r\n                sb.Append(xNode.ToString());\r\n            }\r\n\r\n            return _helper.Raw(sb.ToString());\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes a C1 Function.\r\n        /// </summary>\r\n        /// <param name=\"name\">Function name.</param>\r\n        /// <returns></returns>\r\n        [Obsolete(\"Use Function method directly on the Razor page\")]\r\n        public IHtmlString Function(string name)\r\n        {\r\n            return Function(name, null);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes a C1 Function.\r\n        /// </summary>\r\n        /// <param name=\"name\">Function name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// <returns></returns>\r\n        [Obsolete(\"Use Function method directly on the Razor page\")]\r\n        public IHtmlString Function(string name, object parameters)\r\n        {\r\n            return Function(name, Functions.ObjectToDictionary(parameters));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes a C1 Function.\r\n        /// </summary>\r\n        /// <param name=\"name\">Function name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// <returns></returns>\r\n        [Obsolete(\"Use Function method directly on the Razor page\")]\r\n        public IHtmlString Function(string name, IDictionary<string, object> parameters)\r\n        {\r\n            return Function(name, parameters, new FunctionContextContainer());\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes a C1 Function.\r\n        /// </summary>\r\n        /// <param name=\"name\">Function name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// <param name=\"functionContext\">The function context container</param>\r\n        /// <returns></returns>\r\n        public IHtmlString Function(string name, IDictionary<string, object> parameters, FunctionContextContainer functionContext)\r\n        {\r\n            object result = Functions.ExecuteFunction(name, parameters, functionContext);\r\n            if (result is Control)\r\n            {\r\n                return EmbedControl(result, functionContext);\r\n            }\r\n\r\n            return ConvertFunctionResult(result);\r\n        }\r\n\r\n        private static IHtmlString EmbedControl(object result, FunctionContextContainer functionContext)\r\n        {\r\n            if (functionContext == null)\r\n            {\r\n                throw new ArgumentNullException(\"functionContext\",\r\n                                                \"Failed to insert UserControl without FunctionContextContainer\");\r\n            }\r\n\r\n            if (functionContext.XEmbedableMapper == null)\r\n            {\r\n                throw new ArgumentException(\"Failed to insert UserControl. functionContextContainer.XEmbedableMapper is null\",\r\n                                            \"functionContext\");\r\n            }\r\n\r\n            XNode resultNode;\r\n            if (!functionContext.XEmbedableMapper.TryMakeXEmbedable(functionContext, result, out resultNode))\r\n            {\r\n                throw new InvalidOperationException(\"Failed to insert control. Type: \" + result.GetType());\r\n            }\r\n\r\n            return new HtmlString(resultNode.ToString());\r\n        }\r\n\r\n        private static IHtmlString ConvertFunctionResult(object result)\r\n        {\r\n            var resultAsString = ValueTypeConverter.Convert<string>(result);\r\n            if (resultAsString != null)\r\n            {\r\n                return new HtmlString(resultAsString);\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Function doesn't return string value\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Razor/CompositeC1WebPage.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing System.Web.WebPages;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing System.Threading;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    /// <summary>\r\n    /// Defines a C1 CMS razor control\r\n    /// </summary>\r\n\tpublic abstract class CompositeC1WebPage : WebPage, IDisposable\r\n\t{\r\n\t\tprivate bool _disposed;\r\n\t\tprivate DataConnection _data;\r\n\r\n        private List<IDisposable> _childPages = new List<IDisposable>();\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"CompositeC1WebPage\"/> class.\r\n        /// </summary>\r\n        protected CompositeC1WebPage()\r\n        {\r\n            _data = new DataConnection();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a <see cref=\"DataConnection\"/> object.\r\n        /// </summary>\r\n        public DataConnection Data\r\n        {\r\n            get\r\n            {\r\n                var result = _data ?? (WebPageContext.Current?.Page as CompositeC1WebPage)?.Data;\r\n\r\n                Verify.IsNotNull(result, nameof(DataConnection) + \" instance has already been disposed\");\r\n\r\n                return result;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a <see cref=\"SitemapNavigator\"/> object.\r\n        /// </summary>\r\n        public SitemapNavigator Sitemap => Data.SitemapNavigator;\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the home page node.\r\n        /// </summary>\r\n\t\tpublic PageNode HomePageNode => Sitemap.CurrentHomePageNode;\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the current page node.\r\n        /// </summary>\r\n\t\tpublic PageNode CurrentPageNode => Sitemap.CurrentPageNode;\r\n\r\n\r\n        /// <summary>\r\n        /// Includes a named Page Template Feature. Page Template Feature are managed in '~/App_Data/PageTemplateFeatures' \r\n        /// or via the C1 Console's Layout perspective. They contain html and functional snippets.\r\n        /// </summary>\r\n        /// <param name=\"featureName\">Name of the Page Template Feature to include. Names do not include an extension.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString PageTemplateFeature(string featureName)\r\n        {\r\n            return Html.C1().GetPageTemplateFeature(featureName);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Renders the specified XNode.\r\n        /// </summary>\r\n        /// <param name=\"xNode\">The <see cref=\"XNode\">XNode</see>.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString Markup(XNode xNode)\r\n        {\r\n            return Html.C1().Markup(xNode);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets to letter ISO Language Name representing the pages language - use this like &lt;html lang=\"@Lang\" /&gt;\r\n        /// </summary>\r\n        public string Lang => Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;\r\n\r\n\r\n\t    /// <summary>\r\n        /// Gets the function context container.\r\n        /// </summary>\r\n        public FunctionContextContainer FunctionContextContainer => GetFunctionContext();\r\n\r\n\r\n\t    /// <summary>\r\n\t\t/// Executes a C1 Function.\r\n\t\t/// </summary>\r\n\t\t/// <param name=\"name\">Function name.</param>\r\n\t\t/// <returns></returns>\r\n\t\tpublic IHtmlString Function(string name)\r\n\t\t{\r\n\t\t\treturn Function(name, null);\r\n\t\t}\r\n\r\n\t\t/// <summary>\r\n\t\t/// Executes a C1 Function.\r\n\t\t/// </summary>\r\n\t\t/// <param name=\"name\">Function name.</param>\r\n\t\t/// <param name=\"parameters\">The parameters.</param>\r\n\t\t/// <returns></returns>\r\n\t\tpublic IHtmlString Function(string name, object parameters)\r\n\t\t{\r\n            return Function(name, Functions.ObjectToDictionary(parameters));\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Executes a C1 Function.\r\n        /// </summary>\r\n        /// <param name=\"name\">Function name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// /// <param name=\"functionContextContainer\">The FunctionContextContainer used to execute the function.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString Function(string name, object parameters, FunctionContextContainer functionContextContainer)\r\n\t    {\r\n\t        return Function(name, Functions.ObjectToDictionary(parameters), functionContextContainer);\r\n\t    }\r\n\r\n        /// <summary>\r\n        /// Executes a C1 Function.\r\n        /// </summary>\r\n        /// <param name=\"name\">Function name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString Function(string name, IDictionary<string, object> parameters)\r\n\t\t{\r\n            return Function(name, parameters, GetFunctionContext());\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Executes a C1 Function.\r\n        /// </summary>\r\n        /// <param name=\"name\">Function name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// <param name=\"functionContextContainer\">The FunctionContextContainer used to execute the function.</param>\r\n        /// <returns></returns>\r\n        public IHtmlString Function(string name, IDictionary<string, object> parameters, FunctionContextContainer functionContextContainer)\r\n        {\r\n            return Html.C1().Function(name, parameters, functionContextContainer);\r\n        }\r\n\r\n        private FunctionContextContainer GetFunctionContext()\r\n        {\r\n            if (!PageData.ContainsKey(RazorHelper.PageContext_FunctionContextContainer))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return PageData[RazorHelper.PageContext_FunctionContextContainer];\r\n        }\r\n\r\n\t    /// <exclude />\r\n\t    protected override void ConfigurePage(WebPageBase parentPage)\r\n\t    {\r\n\t        base.ConfigurePage(parentPage);\r\n\r\n\t        if (parentPage is CompositeC1WebPage parentC1Page)\r\n\t        {\r\n\t            if (parentC1Page._childPages == null)\r\n\t            {\r\n\t                parentC1Page._childPages = new List<IDisposable>();\r\n\t            }\r\n\r\n\t            parentC1Page._childPages.Add(this);\r\n            }\r\n\t    }\r\n\r\n\t    /// <exclude />\r\n        public override void ExecutePageHierarchy()\r\n        {\r\n            base.ExecutePageHierarchy();\r\n\r\n            _data.Dispose();\r\n            _data = null;\r\n        }\r\n\r\n        /// <exclude />\r\n\t\tpublic void Dispose()\r\n\t\t{\r\n\t\t\tDispose(true);\r\n\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n        /// <exclude />\r\n\t\tprotected virtual void Dispose(bool disposing)\r\n\t\t{\r\n            if (_disposed) return;\r\n\r\n            if (disposing)\r\n            {\r\n                (_childPages as IEnumerable<IDisposable>)?.Reverse().ForEach(c => c.Dispose());\r\n\r\n                _data?.Dispose();\r\n            }\r\n\r\n            _disposed = true;\r\n\t\t}\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~CompositeC1WebPage()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Razor/Functions.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing Composite.Functions;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    /// <summary>\r\n    /// Utility class for working with C1 functions from Razor code\r\n    /// </summary>\r\n\tpublic static class Functions\r\n\t{\r\n        /// <summary>\r\n        /// Executes the function.\r\n        /// </summary>\r\n        /// <param name=\"name\">The name.</param>\r\n\t\tpublic static object ExecuteFunction(string name)\r\n\t\t{\r\n\t\t\treturn ExecuteFunction(name, null);\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Executes the function.\r\n        /// </summary>\r\n        /// <param name=\"name\">The name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// <returns></returns>\r\n\t\tpublic static object ExecuteFunction(string name, object parameters)\r\n\t\t{\r\n\t\t\treturn ExecuteFunction(name, ObjectToDictionary(parameters));\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Executes the function.\r\n        /// </summary>\r\n        /// <param name=\"name\">The name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// <returns></returns>\r\n\t\tpublic static object ExecuteFunction(string name, IDictionary<string, object> parameters)\r\n\t\t{\r\n            return ExecuteFunction(name, parameters, new FunctionContextContainer());\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Executes the function.\r\n        /// </summary>\r\n        /// <param name=\"name\">The name.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        /// <param name=\"functionContextContainer\">The function context container</param>\r\n        /// <returns></returns>\r\n        public static object ExecuteFunction(string name, IDictionary<string, object> parameters, FunctionContextContainer functionContextContainer)\r\n        {\r\n            IFunction function;\r\n            if (!FunctionFacade.TryGetFunction(out function, name))\r\n            {\r\n                throw new InvalidOperationException(\"Failed to load function '{0}'\".FormatWith(name));\r\n            }\r\n\r\n            functionContextContainer = functionContextContainer ?? new FunctionContextContainer();\r\n\r\n            return FunctionFacade.Execute<object>(function, parameters, functionContextContainer);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds a dictionary for object properties' values.\r\n        /// </summary>\r\n        /// <param name=\"instance\">The instance.</param>\r\n        /// <returns></returns>\r\n\t\tpublic static IDictionary<string, object> ObjectToDictionary(object instance)\r\n\t\t{\r\n\t\t\tif (instance == null)\r\n\t\t\t{\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\r\n\t\t\tvar dictionary = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);\r\n\r\n\t\t\tforeach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(instance))\r\n\t\t\t{\r\n\t\t\t\tobject obj = descriptor.GetValue(instance);\r\n\r\n\t\t\t\tdictionary.Add(descriptor.Name, obj);\r\n\t\t\t}\r\n\r\n\t\t\treturn dictionary;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Razor/HtmlHelperExtensions.cs",
    "content": "﻿using System.Web.WebPages.Html;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    /// <summary>\r\n    /// Add C1 specific extension methods for Razor functions\r\n    /// </summary>\r\n\tpublic static class HtmlHelperExtensions\r\n\t{\r\n        /// <summary>\r\n        /// Exposes C1 specific functionality\r\n        /// </summary>\r\n        /// <param name=\"helper\"></param>\r\n        /// <returns></returns>\r\n\t\tpublic static C1HtmlHelper C1(this HtmlHelper helper)\r\n\t\t{\r\n\t\t\treturn new C1HtmlHelper(helper);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Razor/NoHttpRazorContext.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Web;\r\nusing System.Web.Instrumentation;\r\nusing System.Web.WebPages.Scope;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    internal class NoHttpRazorContext : HttpContextBase\r\n    {\r\n        private readonly IDictionary _items = new Hashtable();\r\n        private readonly HttpRequestBase _request = new NoHttpRazorRequest();\r\n        private readonly HttpResponseBase _response = new NoHttpRazorResponse();\r\n        private readonly PageInstrumentationService _pageInstrumentation = new PageInstrumentationService();\r\n\r\n        public override IDictionary Items => _items;\r\n\t\tpublic override HttpRequestBase Request => _request;\r\n        public override HttpResponseBase Response => _response;\r\n        public override PageInstrumentationService PageInstrumentation => _pageInstrumentation;\r\n\r\n        public override HttpServerUtilityBase Server => throw new NotSupportedException(\"Usage of 'Server' isn't supported without HttpContext. Use System.Web.HttpUtility for [html|url] [encoding|decoding]\");\r\n\r\n        public override object GetService(Type serviceType)\r\n        {\r\n            return null;\r\n        }\r\n\r\n        public NoHttpRazorContext()\r\n\t\t{\r\n\t\t\tScopeStorage.CurrentProvider = new StaticScopeStorageProvider();\r\n\t\t}\r\n    }\r\n}"
  },
  {
    "path": "Composite/AspNet/Razor/NoHttpRazorRequest.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    internal class NoHttpRazorRequest : HttpRequestBase\r\n    {\r\n        private NameValueCollection _form;\r\n        private NameValueCollection _queryString;\r\n        private NameValueCollection _headers;\r\n        private NameValueCollection _params;\r\n        private NameValueCollection _serverVariables;\r\n        private HttpCookieCollection _cookies;\r\n        private HttpBrowserCapabilitiesBase _browser;\r\n\r\n        public override string ApplicationPath => HostingEnvironment.ApplicationVirtualPath;\r\n        public override string PhysicalApplicationPath => HostingEnvironment.ApplicationPhysicalPath;\r\n\r\n        public override HttpBrowserCapabilitiesBase Browser => _browser ?? (_browser = new HttpBrowserCapabilitiesWrapper(new HttpBrowserCapabilities\r\n        {\r\n            Capabilities = new Dictionary<string, string>()\r\n        }));\r\n\r\n        public override HttpCookieCollection Cookies => _cookies ?? (_cookies = new HttpCookieCollection());\r\n        public override bool IsLocal => false;\r\n        public override NameValueCollection Form => _form ?? (_form = new NameValueCollection());\r\n        public override NameValueCollection Headers => _headers ?? (_headers = new NameValueCollection());\r\n        public override string HttpMethod => \"GET\";\r\n        public override bool IsAuthenticated => false;\r\n        public override bool IsSecureConnection => false;\r\n        public override string this[string key] => null;\r\n        public override NameValueCollection Params => _params ?? (_params = new NameValueCollection());\r\n        public override string PathInfo => null;\r\n        public override NameValueCollection QueryString => _queryString ?? (_queryString = new NameValueCollection());\r\n\r\n        public override string RequestType\r\n        {\r\n            get => HttpMethod;\r\n            set => throw new NotSupportedException();\r\n        }\r\n\r\n        public override NameValueCollection ServerVariables => _serverVariables ?? (_serverVariables = new NameValueCollection());\r\n        public override string UserAgent => \"\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Razor/NoHttpRazorResponse.cs",
    "content": "using System.Collections.Specialized;\nusing System.Web;\n\nnamespace Composite.AspNet.Razor\n{\n    internal class NoHttpRazorResponse : HttpResponseBase\n    {\n        private NameValueCollection _headers;\n        private HttpCookieCollection _cookies;\n\n        public override HttpCookieCollection Cookies => _cookies ?? (_cookies = new HttpCookieCollection());\n        public override NameValueCollection Headers => _headers ?? (_headers = new NameValueCollection());\n    }\n}\n"
  },
  {
    "path": "Composite/AspNet/Razor/RazorFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    /// <summary>\r\n    /// Base class for c1 functions based on razor \r\n    /// </summary>\r\n    public abstract class RazorFunction : CompositeC1WebPage, IParameterWidgetsProvider\r\n    {\r\n        /// <summary>\r\n        /// Gets the function description. Override this to make a custom description.\r\n        /// </summary>\r\n        /// <example>\r\n        ///public override string FunctionDescription\r\n        ///{\r\n        ///    get { return \"Will show recent Twitter activity for a given keyword.\"; }\r\n        ///}\r\n        /// </example>\r\n        public virtual string FunctionDescription => string.Empty;\r\n\r\n        /// <summary>\r\n        /// Gets the return type. By default this is XhtmlDocument (html). Override this to set another return type, like string or XElement.\r\n        /// </summary>\r\n        /// <example>\r\n        ///public override Type FunctionReturnType\r\n\t    ///{\r\n        ///    get { return typeof(string); }\r\n        ///}\r\n        /// </example>\r\n        public virtual Type FunctionReturnType => typeof (XhtmlDocument);\r\n\r\n        /// <summary>\r\n        /// Determines whether the function output can be cached.\r\n        /// </summary>\r\n        public virtual bool PreventFunctionOutputCaching => false;\r\n\r\n        /// <exclude />\r\n        public virtual IDictionary<string, WidgetFunctionProvider> GetParameterWidgets()\r\n        {\r\n            return null;\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Razor/RazorHelper.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Web;\r\n//using System.Web.Instrumentation;\r\nusing System.Web.WebPages;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\n//using Composite.Core.Extensions;\r\n//using Composite.Core.IO;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    /// <summary>\r\n    /// Exposes method to execute razor pages.\r\n    /// </summary>\r\n    public static class RazorHelper\r\n    {\r\n        internal static readonly string PageContext_FunctionContextContainer = \"C1.FunctionContextContainer\";\r\n\r\n        /// <summary>\r\n        /// Executes the razor page.\r\n        /// </summary>\r\n        /// <param name=\"virtualPath\">The virtual path.</param>\r\n        /// <param name=\"setParameters\">Delegate to set the parameters.</param>\r\n        /// <param name=\"resultType\">The type of the result.</param>\r\n        /// <param name=\"functionContextContainer\">The function context container</param>\r\n        /// <returns></returns>\r\n        public static object ExecuteRazorPage(\r\n            string virtualPath, \r\n            Action<WebPageBase> setParameters,\r\n            Type resultType,\r\n            FunctionContextContainer functionContextContainer)\r\n        {\r\n            WebPageBase webPage = null;\r\n            try\r\n            {\r\n                webPage = WebPageBase.CreateInstanceFromVirtualPath(virtualPath);\r\n\r\n                return ExecuteRazorPage(webPage, setParameters, resultType, functionContextContainer);\r\n            }\r\n            finally\r\n            {\r\n                if (webPage is IDisposable)\r\n                {\r\n                    (webPage as IDisposable).Dispose();\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes the razor page.\r\n        /// </summary>\r\n        /// <param name=\"webPage\">The web page.</param>\r\n        /// <param name=\"setParameters\">Delegate to set the parameters.</param>\r\n        /// <param name=\"resultType\">The type of the result.</param>\r\n        /// <param name=\"functionContextContainer\">The function context container</param>\r\n        /// <returns></returns>\r\n        public static object ExecuteRazorPage(\r\n            WebPageBase webPage,\r\n            Action<WebPageBase> setParameters, \r\n            Type resultType, \r\n            FunctionContextContainer functionContextContainer)\r\n        {\r\n            HttpContext currentContext = HttpContext.Current;\r\n\r\n            var startPage = StartPage.GetStartPage(webPage, \"_PageStart\", new[] { \"cshtml\" });\r\n            \r\n            // IEnumerable<PageExecutionListener> pageExecutionListeners;\r\n            HttpContextBase httpContext;\r\n\r\n            if (currentContext == null)\r\n            {\r\n                httpContext = new NoHttpRazorContext();\r\n                // pageExecutionListeners = new PageExecutionListener[0];\r\n            }\r\n            else\r\n            {\r\n                httpContext = new HttpContextWrapper(currentContext);\r\n                // pageExecutionListeners = httpContext.PageInstrumentation.ExecutionListeners;\r\n            }\r\n\r\n\r\n            var pageContext = new WebPageContext(httpContext, webPage, startPage);\r\n\r\n            if (functionContextContainer != null)\r\n            {\r\n                pageContext.PageData.Add(PageContext_FunctionContextContainer, functionContextContainer);\r\n            }\r\n\r\n\r\n            if (setParameters != null)\r\n            {\r\n\r\n                setParameters(webPage);\r\n            }\r\n                \r\n            var sb = new StringBuilder();\r\n            using (var writer = new StringWriter(sb))\r\n            {\r\n                //// PageExecutionContext enables \"Browser Link\" support\r\n                //var pageExecutionContext = new PageExecutionContext\r\n                //{\r\n                //    TextWriter = writer,\r\n                //    VirtualPath = PathUtil.Resolve(webPage.VirtualPath),\r\n                //    StartPosition = 0,\r\n                //    IsLiteral = true\r\n                //};\r\n\r\n                //pageExecutionListeners.ForEach(l => l.BeginContext(pageExecutionContext));\r\n\r\n                webPage.ExecutePageHierarchy(pageContext, writer);\r\n\r\n                //pageExecutionListeners.ForEach(l => l.EndContext(pageExecutionContext));\r\n            }\r\n\r\n            string output = sb.ToString();\r\n            \r\n\r\n\t\t\tif (resultType == typeof(XhtmlDocument))\r\n\t\t\t{\r\n\t\t\t    if (string.IsNullOrWhiteSpace(output)) return new XhtmlDocument();\r\n\r\n\t\t\t\ttry\r\n                {\r\n                    return XhtmlDocument.ParseXhtmlFragment(output);\r\n\t\t\t\t}\r\n\t\t\t\tcatch (XmlException ex)\r\n\t\t\t\t{\r\n\t\t\t\t    string[] codeLines = output.Split(new [] { Environment.NewLine, \"\\n\" }, StringSplitOptions.None);\r\n\r\n\t\t\t\t    XhtmlErrorFormatter.EmbedSourceCodeInformation(ex, codeLines, ex.LineNumber);\r\n\r\n\t\t\t\t    throw;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn ValueTypeConverter.Convert(output, resultType);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Executes the razor page.\r\n        /// </summary>\r\n        /// <typeparam name=\"ResultType\">The result type.</typeparam>\r\n        /// <param name=\"virtualPath\">The virtual path.</param>\r\n        /// <param name=\"setParameters\">Delegate to set the parameters.</param>\r\n        /// <param name=\"functionContextContainer\">The function context container.</param>\r\n        /// <returns></returns>\r\n        public static ResultType ExecuteRazorPage<ResultType>(\r\n            string virtualPath, \r\n            Action<WebPageBase> setParameters, \r\n            FunctionContextContainer functionContextContainer = null) where ResultType: class\r\n        {\r\n            return (ResultType) ExecuteRazorPage(virtualPath, setParameters, typeof(ResultType), functionContextContainer);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Razor/RazorPageTemplate.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.AspNet.Razor\r\n{\r\n    /// <summary>\r\n    /// Base class for a razor control that represends a C1 page tempalte\r\n    /// </summary>\r\n    public abstract class RazorPageTemplate : CompositeC1WebPage, IPageTemplate\r\n    {\r\n        /// <summary>\r\n        /// Override this method and set <see cref=\"RazorPageTemplate.TemplateId\"/> and <see cref=\"RazorPageTemplate.TemplateTitle\"/>.\r\n        /// </summary>\r\n        public abstract void Configure();\r\n\r\n        /// <summary>\r\n        /// Gets or sets the page template id. You should set this in your Configure() method override.\r\n        /// </summary>\r\n        public Guid TemplateId\r\n        {\r\n            get;\r\n            protected set;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the page template title. You should set this in your Configure() method override.\r\n        /// </summary>\r\n        public string TemplateTitle\r\n        {\r\n            get;\r\n            protected set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Security/FileBasedFunctionEntityToken.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security;\r\nusing Newtonsoft.Json;\r\n\r\nnamespace Composite.AspNet.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t[SecurityAncestorProvider(typeof(StandardFunctionSecurityAncestorProvider))]\r\n\tpublic class FileBasedFunctionEntityToken : EntityToken\r\n\t{\r\n\t\tprivate readonly string _id;\r\n        /// <exclude />\r\n\t\tpublic override string Id\r\n\t\t{\r\n\t\t\tget { return _id; }\r\n\t\t}\r\n\r\n        private readonly string _source;\r\n        /// <exclude />\r\n\t\tpublic override string Source\r\n\t\t{\r\n\t\t\tget { return _source; }\r\n\t\t}\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n\t\t{\r\n\t\t\tget { return String.Empty; }\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Gets the name of the function provider.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The name of the function provider.\r\n        /// </value>\r\n        [JsonIgnore]\r\n        public string FunctionProviderName\r\n        {\r\n            get { return Source; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the name of the function.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The name of the function.\r\n        /// </value>\r\n        [JsonIgnore]\r\n        public string FunctionName\r\n        {\r\n            get { return Id; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"FileBasedFunctionEntityToken\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"functionProviderName\">Name of the function provider.</param>\r\n        /// <param name=\"functionFullName\">Full name of the function.</param>\r\n\t\tpublic FileBasedFunctionEntityToken(string functionProviderName, string functionFullName)\r\n\t\t{\r\n            _source = functionProviderName;\r\n            _id = functionFullName;\r\n\t\t}\r\n\r\n        /// <exclude />\r\n\t\tpublic override string Serialize()\r\n\t\t{\r\n\t\t\treturn DoSerialize();\r\n\t\t}\r\n\r\n\r\n        /// <exclude />\r\n\t\tpublic static EntityToken Deserialize(string serializedEntityToken)\r\n\t\t{\r\n\t\t\tstring type;\r\n\t\t\tstring source;\r\n\t\t\tstring id;\r\n\r\n\t\t\tDoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n\t\t\treturn new FileBasedFunctionEntityToken(source, id);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/Security/StandardFunctionSecurityAncestorProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\n\r\nnamespace Composite.AspNet.Security\r\n{\r\n\tinternal class StandardFunctionSecurityAncestorProvider : ISecurityAncestorProvider\r\n\t{\r\n\t\tpublic IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n\t\t{\r\n\t\t\tstring fullname = entityToken.Id;\r\n\r\n\t\t\tif (fullname.Contains('.'))\r\n\t\t\t{\r\n\t\t\t\tfullname = fullname.Remove(fullname.LastIndexOf('.'));\r\n\t\t\t}\r\n\r\n\t\t\tstring id = BaseFunctionProviderElementProvider.CreateId(fullname, \"AllFunctionsElementProvider\");\r\n\r\n\t\t\tyield return new BaseFunctionFolderElementEntityToken(id);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/SiteMapContext.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Caching;\r\n\r\nnamespace Composite.AspNet\r\n{\r\n    /// <summary>\r\n    /// Allows switching context of SiteMap\r\n    /// </summary>\r\n    public class SiteMapContext: IDisposable\r\n    {\r\n        /// <summary>\r\n        /// Gets the root page.\r\n        /// </summary>\r\n        public IPage RootPage { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"SiteMapContext\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"rootPage\">The root page.</param>\r\n        public SiteMapContext(IPage rootPage)\r\n        {\r\n            RootPage = rootPage;\r\n\r\n            SiteMapStack.Push(this);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the current SiteMapContext. Can be null.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The current context.\r\n        /// </value>\r\n        public static SiteMapContext Current\r\n        {\r\n            get\r\n            {\r\n                var currentStack = SiteMapStack;\r\n\r\n                return currentStack.Any() ? currentStack.Peek() : null;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            var top = SiteMapStack.Pop();\r\n            Verify.That(object.ReferenceEquals(top, this), \"SiteMapContext weren't disposed properly\");\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~SiteMapContext()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n\r\n\r\n        private static Stack<SiteMapContext> SiteMapStack\r\n        {\r\n            get\r\n            {\r\n                return RequestLifetimeCache.GetCachedOrNew<Stack<SiteMapContext>>(\"SiteMapContext:Stack\");\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/SiteMapHandler.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Xml;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.AspNet\r\n{\r\n    /// <summary>\r\n    /// Handles requests to XML Sitemaps: */sitemap.xml\r\n    /// </summary>\r\n    public class SiteMapHandler : IHttpHandler\r\n    {\r\n        private const string SiteMapNamespace = \"http://www.sitemaps.org/schemas/sitemap/0.9\";\r\n\r\n        private Uri _requestUrl;\r\n\r\n        bool IHttpHandler.IsReusable => false;\r\n\r\n        void IHttpHandler.ProcessRequest(HttpContext context)\r\n        {\r\n            _requestUrl = context.Request.Url;\r\n\r\n            context.Response.ContentType = \"text/xml\";\r\n            context.Response.ContentEncoding = Encoding.UTF8;\r\n\r\n            var provider = SiteMap.Provider;\r\n            if (!(provider is ICmsSiteMapProvider))\r\n            {\r\n                throw new NotSupportedException(\"Configured sitemap provider is not supported\");\r\n            }\r\n\r\n            var writer = XmlWriter.Create(context.Response.OutputStream, \r\n                new XmlWriterSettings {Encoding = Encoding.UTF8, Indent = true});\r\n\r\n            writer.WriteStartDocument();\r\n\r\n            if (IsRootRequest(context.Request.RawUrl))\r\n            {\r\n                var rootNodes = ((ICmsSiteMapProvider)provider).GetRootNodes();\r\n                if (rootNodes.Count > 1)\r\n                {\r\n                    WriteSiteMapList(writer, rootNodes);\r\n                }\r\n                else\r\n                {\r\n                    var rootNode = rootNodes.FirstOrDefault();\r\n\r\n                    if (rootNode != null)\r\n                    {\r\n                        using (new DataScope(rootNode.Culture))\r\n                        {\r\n                            WriteFullSiteMap(writer, provider);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                IPage rootPage = ExtractRootPageFromSiteMapUrl(context.Request.RawUrl);\r\n\r\n                if(rootPage == null)\r\n                {\r\n                    Write404(context.Response);\r\n                    return;\r\n                }\r\n\r\n                using(new SiteMapContext(rootPage))\r\n                {\r\n                    WriteFullSiteMap(writer, provider);\r\n                }\r\n            }\r\n\r\n            writer.WriteEndDocument();\r\n\r\n            writer.Flush();\r\n        }\r\n\r\n        private IPage ExtractRootPageFromSiteMapUrl(string relativeUrl)\r\n        {\r\n            Verify.That(relativeUrl.StartsWith(UrlUtils.PublicRootPath, StringComparison.OrdinalIgnoreCase), \"Incorrect url prefix\");\r\n\r\n\r\n            string[] requestParts = relativeUrl.Substring(UrlUtils.PublicRootPath.Length)\r\n                                               .Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);\r\n            \r\n            Verify.That(requestParts.Length > 0, \"error parsing url\");\r\n            string languageCode = requestParts[0];\r\n\r\n            string urlTitle = requestParts.Length > 2 ? requestParts[1] : string.Empty;\r\n            \r\n            CultureInfo culture = GetActiveCulture(languageCode);\r\n            if(culture == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n\r\n            using(new DataScope(PublicationScope.Published, culture))\r\n            {\r\n                foreach(Guid rootPageId in PageManager.GetChildrenIDs(Guid.Empty))\r\n                {\r\n                    var page = PageManager.GetPageById(rootPageId);\r\n                    if (page == null) continue;\r\n                    \r\n                    if(string.Equals(urlTitle, page.UrlTitle, StringComparison.OrdinalIgnoreCase))\r\n                    {\r\n                        return page;\r\n                    }\r\n                }\r\n            }\r\n            return null;\r\n        }\r\n\r\n        private void Write404(HttpResponse response)\r\n        {\r\n            response.Clear();\r\n            response.StatusCode = 404;\r\n        }\r\n\r\n        private CultureInfo GetActiveCulture(string languageCode)\r\n        {\r\n            return DataLocalizationFacade.ActiveLocalizationCultures\r\n                .FirstOrDefault(culture => culture.Name.Equals(languageCode, StringComparison.OrdinalIgnoreCase));\r\n        }\r\n\r\n\r\n        private bool MatchHostname(IHostnameBinding binding)\r\n        {\r\n            var host = _requestUrl.Host;\r\n\r\n            if (binding.Hostname == host)\r\n            {\r\n                return true;\r\n            }\r\n\r\n            return binding.Aliases\r\n                          .Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)\r\n                          .Any(alias => alias == host);\r\n        }\r\n\r\n        private void WriteSiteMapList(XmlWriter writer, IEnumerable<CmsPageSiteMapNode> rootNodes)\r\n        {\r\n            writer.WriteStartElement(\"sitemapindex\", SiteMapNamespace);\r\n\r\n            List<IHostnameBinding> bindings;\r\n\r\n            using (var data = new DataConnection())\r\n            {\r\n                bindings = data.Get<IHostnameBinding>().ToList();\r\n            }\r\n\r\n            foreach (var node in rootNodes)\r\n            {\r\n                string urlTitle = null;\r\n\r\n                using(new DataScope(PublicationScope.Published, node.Culture))\r\n                {\r\n                    IPage page = PageManager.GetPageById(node.Page.Id);\r\n                    if(page != null)\r\n                    {\r\n                        urlTitle = page.UrlTitle;\r\n                    }\r\n                }\r\n\r\n                IHostnameBinding binding = FindMatchingBinding(node, bindings);\r\n\r\n                writer.WriteStartElement(\"sitemap\");\r\n\r\n                writer.WriteStartElement(\"loc\");\r\n\r\n                string hostnameUrl;\r\n\r\n                if (binding == null || MatchHostname(binding))\r\n                {\r\n                    hostnameUrl = \"{0}://{1}{2}\".FormatWith(\r\n                        _requestUrl.Scheme,\r\n                        _requestUrl.Host,\r\n                        _requestUrl.IsDefaultPort ? string.Empty : \":\" + _requestUrl.Port);\r\n                }\r\n                else\r\n                {\r\n                    hostnameUrl = $\"{(binding.EnforceHttps ? \"https\" : \"http\")}://{binding.Hostname}\";\r\n                }\r\n\r\n                writer.WriteString(hostnameUrl + \"{0}/{1}{2}/sitemap.xml\".FormatWith(\r\n                                    UrlUtils.PublicRootPath,\r\n                                    node.Culture,\r\n                                    urlTitle.IsNullOrEmpty() ? string.Empty : \"/\" + urlTitle));\r\n                writer.WriteEndElement();\r\n\r\n                writer.WriteEndElement();\r\n            }\r\n\r\n            writer.WriteEndElement();\r\n        }\r\n\r\n        private IHostnameBinding FindMatchingBinding(CmsPageSiteMapNode sitemapNode, List<IHostnameBinding> bindings)\r\n        {\r\n            Guid homePageId = Guid.Parse(sitemapNode.Key);\r\n            string cultureName = sitemapNode.Culture.Name;\r\n\r\n            var bestMatch = FindMatch(bindings, homePageId, cultureName);\r\n            if (bestMatch != null)\r\n            {\r\n                return bestMatch;\r\n            }\r\n\r\n            string defaultCulture = DataLocalizationFacade.DefaultLocalizationCulture.Name;\r\n            var secondBestMatch = FindMatch(bindings, homePageId, defaultCulture);\r\n            if (secondBestMatch != null)\r\n            {\r\n                return secondBestMatch;\r\n            }\r\n\r\n            return  bindings.OrderBy(b => b.Hostname).FirstOrDefault(h => h.HomePageId == homePageId);\r\n        }\r\n\r\n        private IHostnameBinding FindMatch(IEnumerable<IHostnameBinding> bindings, Guid homePageId, string cultureName)\r\n        {\r\n            return bindings.Where(h => h.HomePageId == homePageId && h.Culture == cultureName)\r\n                .SingleOrDefaultOrException(\"There are multiple hostname bindings refering to the same home page id '{0}' and the same culture '{1}'\",\r\n                    homePageId, cultureName);\r\n        }\r\n\r\n        private void WriteFullSiteMap(XmlWriter writer, SiteMapProvider provider)\r\n        {\r\n            writer.WriteStartElement(\"urlset\", SiteMapNamespace);\r\n\r\n            WriteElement(writer, provider.RootNode, new HashSet<string>());\r\n\r\n            writer.WriteEndElement();\r\n        }\r\n\r\n        private bool IsRootRequest(string relativeUrl)\r\n        {\r\n            return string.Equals(relativeUrl, UrlUtils.PublicRootPath + \"/sitemap.xml\", StringComparison.OrdinalIgnoreCase);\r\n        }\r\n\r\n        private void WriteElement(XmlWriter writer, SiteMapNode node, HashSet<string> alreadyVisitedNodes)\r\n        {\r\n            if (alreadyVisitedNodes.Contains(node.Key))\r\n            {\r\n                Log.LogError(nameof(SiteMapHandler), $\"Loop in sitemap nodes detected. Node key: '{node.Key}'\");\r\n                return;\r\n            }\r\n            alreadyVisitedNodes.Add(node.Key);\r\n\r\n            writer.WriteStartElement(\"url\");\r\n\r\n            writer.WriteStartElement(\"loc\");\r\n            writer.WriteString($\"{_requestUrl.Scheme}://{_requestUrl.Host}{node.Url}\");\r\n            writer.WriteEndElement();\r\n\r\n            if (node is ISchemaOrgSiteMapNode schemaOrgSiteMapNode)\r\n            {\r\n                var lastEdited = schemaOrgSiteMapNode.LastModified;\r\n                writer.WriteStartElement(\"lastmod\");\r\n                writer.WriteString(lastEdited.ToUniversalTime().ToString(\"u\").Replace(\" \", \"T\"));\r\n                writer.WriteEndElement();\r\n\r\n                var changeFrequency = schemaOrgSiteMapNode.ChangeFrequency;\r\n                if (changeFrequency.HasValue)\r\n                {\r\n                    writer.WriteStartElement(\"changefreq\");\r\n                    writer.WriteString(changeFrequency.Value.ToString().ToLowerInvariant());\r\n                    writer.WriteEndElement();\r\n                }\r\n\r\n                var priority = schemaOrgSiteMapNode.Priority;\r\n                if (priority.HasValue)\r\n                {\r\n                    if (priority > 1 && priority < 10)\r\n                    {\r\n                        writer.WriteStartElement(\"priority\");\r\n                        writer.WriteString(((decimal)priority.Value / 10).ToString(\"0.0\", CultureInfo.InvariantCulture));\r\n                        writer.WriteEndElement();\r\n                    }\r\n                }\r\n            }\r\n\r\n            writer.WriteEndElement();\r\n\r\n            foreach (SiteMapNode child in node.ChildNodes)\r\n            {\r\n                WriteElement(writer, child, alreadyVisitedNodes);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/SiteMapNodeChangeFrequency.cs",
    "content": "﻿namespace Composite.AspNet\r\n{\r\n    /// <summary>\r\n    /// ChangeFrequence of a SiteMapNode\r\n    /// </summary>\r\n    public enum SiteMapNodeChangeFrequency\r\n    {\r\n        /// <exclude />\r\n        Always = 0,\r\n        /// <exclude />\r\n        Hourly = 1,\r\n        /// <exclude />\r\n        Daily = 2,\r\n        /// <exclude />\r\n        Weekly = 3,\r\n        /// <exclude />\r\n        Monthly = 4,\r\n        /// <exclude />\r\n        Yearly = 5,\r\n        /// <exclude />\r\n        Never = 6\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/UserControlFunction.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Web.UI;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\n\r\nnamespace Composite.AspNet\r\n{\r\n    /// <summary>\r\n    /// Base class for a UserControls that represents a C1 function\r\n    /// </summary>\r\n    public abstract class UserControlFunction : UserControl, IParameterWidgetsProvider\r\n\r\n    {\r\n        /// <summary>\r\n        /// Gets the function description.\r\n        /// </summary>\r\n        public virtual string FunctionDescription\r\n        {\r\n            get { return string.Empty; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets or sets Function Context Container\r\n        /// </summary>\r\n        public FunctionContextContainer FunctionContextContainer\r\n        {\r\n            get; \r\n            set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual IDictionary<string, WidgetFunctionProvider> GetParameterWidgets()\r\n        {\r\n            return null;\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/AspNet/WebObjectActivator.cs",
    "content": "using System;\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Composite.AspNet\n{\n    internal class WebObjectActivator : IServiceProvider\n    {\n        private readonly IServiceProvider _inner;\n\n        public WebObjectActivator(IServiceProvider inner)\n        {\n            _inner = inner;\n        }\n\n        public object GetService(Type serviceType)\n        {\n            var service = _inner.GetService(serviceType);\n\n            // Multiple types from System.Web.dll have internal constructors\n            // Ignoring those types to have a better debugging experience\n            if (service == null\n                && serviceType.Assembly != typeof(System.Web.IHttpModule).Assembly)\n            {\n                try\n                {\n                    service = ActivatorUtilities.CreateInstance(_inner, serviceType);\n                }\n                catch (InvalidOperationException)\n                {\n                }\n            }\n\n            return service ?? Activator.CreateInstance(serviceType, true);\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/C1Console/Actions/ActionEventSystemFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    internal class BeforeActionEventArgs : EventArgs\r\n    {\r\n        public BeforeActionEventArgs(EntityToken entityToken, ActionToken actionToken)\r\n        {\r\n            this.EntityToken = entityToken;\r\n            this.ActionToken = actionToken;\r\n        }\r\n\r\n\r\n        public EntityToken EntityToken { get; private set; }\r\n        public ActionToken ActionToken { get; private set; }\r\n    }\r\n\r\n\r\n\r\n    internal class AfterActionEventArgs : EventArgs\r\n    {\r\n        public AfterActionEventArgs(EntityToken entityToken, ActionToken actionToken, FlowToken flowToken)\r\n        {\r\n            this.EntityToken = entityToken;\r\n            this.ActionToken = actionToken;\r\n            this.FlowToken = flowToken;\r\n        }\r\n\r\n\r\n        public EntityToken EntityToken { get; private set; }\r\n        public ActionToken ActionToken { get; private set; }\r\n        public FlowToken FlowToken { get; private set; }\r\n    }\r\n\r\n\r\n\r\n    internal static class ActionEventSystemFacade\r\n    {\r\n        internal delegate void OnBeforeActionExecutionDelegate(BeforeActionEventArgs actionEventArgs);\r\n        internal delegate void OnAfterActionExecutionDelegate(AfterActionEventArgs actionEventArgs);\r\n\r\n\r\n        private static OnBeforeActionExecutionDelegate _onBeforeActionExecutionDelegates = null;\r\n        private static OnAfterActionExecutionDelegate _onAfterActionExecutionDelegates = null;\r\n\r\n\r\n\r\n        static ActionEventSystemFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static void SubscribeToOnBeforeActionExecution(OnBeforeActionExecutionDelegate onBeforeActionExecutionDelegate)\r\n        {\r\n            Verify.ArgumentNotNull(onBeforeActionExecutionDelegate, \"onBeforeActionExecutionDelegate\");\r\n\r\n            _onBeforeActionExecutionDelegates += onBeforeActionExecutionDelegate;\r\n        }\r\n\r\n\r\n\r\n        public static void UnsubscribeToOnBeforeActionExecution(OnBeforeActionExecutionDelegate onBeforeActionExecutionDelegate)\r\n        {\r\n            Verify.ArgumentNotNull(onBeforeActionExecutionDelegate, \"onBeforeActionExecutionDelegate\");\r\n\r\n            _onBeforeActionExecutionDelegates -= onBeforeActionExecutionDelegate;\r\n        }\r\n\r\n\r\n\r\n        public static void SubscribeToOnAfterActionExecution(OnAfterActionExecutionDelegate onAfterActionExecutionDelegate)\r\n        {\r\n            Verify.ArgumentNotNull(onAfterActionExecutionDelegate, \"onAfterActionExecutionDelegate\");\r\n\r\n            _onAfterActionExecutionDelegates += onAfterActionExecutionDelegate;\r\n        }\r\n\r\n\r\n\r\n        public static void UnsubscribeToOnAfterActionExecution(OnAfterActionExecutionDelegate onAfterActionExecutionDelegate)\r\n        {\r\n            Verify.ArgumentNotNull(onAfterActionExecutionDelegate, \"onAfterActionExecutionDelegate\");\r\n\r\n            _onAfterActionExecutionDelegates -= onAfterActionExecutionDelegate;\r\n        }\r\n\r\n\r\n\r\n        internal static void FireOnBeforeActionExecution(EntityToken entityToken, ActionToken actionToken)\r\n        {\r\n            if (_onBeforeActionExecutionDelegates != null)\r\n            {\r\n                _onBeforeActionExecutionDelegates(new BeforeActionEventArgs(entityToken, actionToken));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void FireOnAfterActionExecution(EntityToken entityToken, ActionToken actionToken, FlowToken flowToken)\r\n        {\r\n            if (_onAfterActionExecutionDelegates != null)\r\n            {\r\n                _onAfterActionExecutionDelegates(new AfterActionEventArgs(entityToken, actionToken, flowToken));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _onBeforeActionExecutionDelegates = null;\r\n            _onAfterActionExecutionDelegates = null;\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/ActionExecutorAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsageAttribute(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]\r\n    public sealed class ActionExecutorAttribute : Attribute\r\n    {\r\n        private Type _actionExecutorType;\r\n\r\n\r\n        /// <exclude />\r\n        public ActionExecutorAttribute(Type actionExecutorType)\r\n        {\r\n            _actionExecutorType = actionExecutorType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type ActionExecutorType\r\n        {\r\n            get { return _actionExecutorType; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/ActionExecutorFacade.cs",
    "content": "//#warning REMARK THIS!!!\r\n//#define NO_SECURITY\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.C1Console.Actions.Foundation;\r\nusing Composite.C1Console.Actions.Workflows;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Tasks;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ActionExecutorFacade\r\n    {\r\n        /// <exclude />\r\n        public static FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            return Execute(entityToken, actionToken, flowControllerServicesContainer, null);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer, TaskManagerEvent taskManagerEvent)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n            if (actionToken == null) throw new ArgumentNullException(\"actionToken\");\r\n\r\n            AddEntityTokenToContext(entityToken);\r\n\r\n            string username = UserValidationFacade.GetUsername();\r\n#if NO_SECURITY\r\n#else\r\n            HookingFacade.EnsureInitialization();\r\n\r\n            IEnumerable<UserPermissionDefinition> userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(username);\r\n            IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(username);\r\n            SecurityResult securityResult = SecurityResolver.Resolve(UserValidationFacade.GetUserToken(), actionToken, entityToken, userPermissionDefinitions, userGroupPermissionDefinitions);\r\n            if (securityResult != SecurityResult.Allowed && !(entityToken is SecurityViolationWorkflowEntityToken))\r\n            {\r\n                return ExecuteSecurityViolation(actionToken, entityToken, flowControllerServicesContainer);\r\n            }\r\n#endif\r\n\r\n            bool ignoreLocking = actionToken.IsIgnoreEntityTokenLocking();\r\n\r\n            if (!ignoreLocking && ActionLockingFacade.IsLocked(entityToken))\r\n            {\r\n                return ExecuteEntityTokenLocked(actionToken, entityToken, flowControllerServicesContainer);\r\n            }\r\n\r\n            IActionExecutor actionExecutor = ActionExecutorCache.GetActionExecutor(actionToken);\r\n\r\n            ActionEventSystemFacade.FireOnBeforeActionExecution(entityToken, actionToken);\r\n\r\n            FlowToken flowToken;\r\n            using (TaskContainer taskContainer = TaskManagerFacade.CreateNewTasks(entityToken, actionToken, taskManagerEvent))\r\n            {\r\n                ITaskManagerFlowControllerService taskManagerService = null;\r\n                if (flowControllerServicesContainer.GetService(typeof(ITaskManagerFlowControllerService)) == null)\r\n                {\r\n                    taskManagerService = new TaskManagerFlowControllerService(taskContainer);\r\n                    flowControllerServicesContainer.AddService(taskManagerService);\r\n                }\r\n\r\n                try\r\n                {\r\n                    if (actionExecutor is IActionExecutorSerializedParameters)\r\n                    {\r\n                        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n                        string serializedActionToken = ActionTokenSerializer.Serialize(actionToken);\r\n\r\n                        flowToken = Execute(actionExecutor as IActionExecutorSerializedParameters,\r\n                            serializedEntityToken, serializedActionToken, actionToken,\r\n                            flowControllerServicesContainer);\r\n                    }\r\n                    else\r\n                    {\r\n                        flowToken = Execute(actionExecutor, entityToken, actionToken,\r\n                            flowControllerServicesContainer);\r\n                    }\r\n                }\r\n                finally\r\n                {\r\n                    if (taskManagerService != null)\r\n                    {\r\n                        flowControllerServicesContainer.RemoveService(taskManagerService);\r\n                    }\r\n                }\r\n\r\n                taskContainer.SetOnIdleTaskManagerEvent(new FlowTaskManagerEvent(flowToken));\r\n                taskContainer.UpdateTasksWithFlowToken(flowToken);\r\n\r\n                taskContainer.SaveTasks();\r\n            }\r\n\r\n            ActionEventSystemFacade.FireOnAfterActionExecution(entityToken, actionToken, flowToken);\r\n\r\n            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer\r\n                .GetService<IManagementConsoleMessageService>();\r\n            if (managementConsoleMessageService != null)\r\n            {\r\n                FlowControllerFacade.RegisterNewFlowInformation(flowToken, entityToken, actionToken,\r\n                    managementConsoleMessageService.CurrentConsoleId);\r\n            }\r\n            else\r\n            {\r\n                Log.LogWarning(nameof(ActionExecutorFacade), \"Missing ManagementConsoleMessageService, can not register the flow\");\r\n            }\r\n\r\n            return flowToken;\r\n        }\r\n\r\n        internal const string HttpContextItem_EntityToken = \"EntityToken\"; \r\n        private static void AddEntityTokenToContext(EntityToken entityToken) \r\n        { \r\n            var httpContext = HttpContext.Current; \r\n            if (httpContext == null) \r\n                return; \r\n \r\n            httpContext.Items[HttpContextItem_EntityToken] = entityToken; \r\n        } \r\n\r\n        /// <exclude />\r\n        public static FlowToken ExecuteEntityTokenLocked(ActionToken lockedActionToken, EntityToken lockedEntityToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            EntityToken entityToken = new EntityTokenLockedEntityToken(\r\n                    ActionLockingFacade.LockedBy(lockedEntityToken),\r\n                    ActionTokenSerializer.Serialize(lockedActionToken),\r\n                    EntityTokenSerializer.Serialize(lockedEntityToken)\r\n                );\r\n\r\n            WorkflowActionToken actionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Actions.Workflows.EntityTokenLockedWorkflow\"));\r\n\r\n            return Execute(entityToken, actionToken, flowControllerServicesContainer);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static FlowToken ExecuteSecurityViolation(ActionToken actionToken, EntityToken entityToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            EntityToken newEntityToken = new SecurityViolationWorkflowEntityToken();\r\n\r\n            WorkflowActionToken newActionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Actions.Workflows.SecurityViolationWorkflow\"));\r\n\r\n            return Execute(newEntityToken, newActionToken, flowControllerServicesContainer);\r\n        }\r\n\r\n\r\n\r\n        private static FlowToken Execute(IActionExecutorSerializedParameters actionExecutor, string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            FlowToken result = actionExecutor.Execute(serializedEntityToken, serializedActionToken, actionToken, flowControllerServicesContainer);\r\n\r\n            return result ?? new NullFlowToken();\r\n        }\r\n\r\n\r\n\r\n        private static FlowToken Execute(IActionExecutor actionExecutor, EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            FlowToken result = actionExecutor.Execute(entityToken, actionToken, flowControllerServicesContainer);\r\n\r\n            return result ?? new NullFlowToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/ActionLockingException.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    internal sealed class ActionLockingException : Exception\r\n\t{\r\n        public ActionLockingException(string message)\r\n            : base(message)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/ActionLockingFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.Serialization;\r\nusing System.Runtime.Serialization.Formatters.Binary;\r\nusing System.Threading;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    public static class ActionLockingFacade\r\n    {\r\n        private static readonly string LogTitle = typeof(ActionLockingFacade).Name;\r\n        private static Dictionary<string, LockingInformation> _lockingInformations = null;\r\n        private static readonly object _lock = new object();\r\n        private static readonly IFormatter _ownerIdFormatter = new BinaryFormatter();\r\n\r\n\r\n\r\n        private static void EnsureInitialization()\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_lockingInformations == null)\r\n                    {\r\n                        DoInitialize();\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"ownerId\">Should be serializable</param>\r\n        public static void AcquireLock(EntityToken entityToken, object ownerId)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                EnsureInitialization();\r\n\r\n                AddLockingInformation(entityToken, ownerId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"newOwnerId\">Should be serializable</param>\r\n        public static void ChangeLockOwner(EntityToken entityToken, object newOwnerId)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                EnsureInitialization();\r\n\r\n                UpdateLockingInformation(entityToken, newOwnerId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"ownerId\">Should be serializable</param>\r\n        public static void ReleaseLock(EntityToken entityToken, object ownerId)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                EnsureInitialization();\r\n\r\n                string lockKey = GetLockKey(entityToken);\r\n                RemoveLockingInformation(lockKey, ownerId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"ownerId\">Should be serializable</param>\r\n        public static void ReleaseAllLocks(object ownerId)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                EnsureInitialization();\r\n\r\n                List<string> lockKeys =\r\n                    (from li in _lockingInformations\r\n                     where object.Equals(li.Value.OwnerId, ownerId)\r\n                     select li.Key).ToList();\r\n\r\n                foreach (string lockKey in lockKeys)\r\n                {\r\n                    RemoveLockingInformation(lockKey, ownerId);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"entityToken\">Entity token to check if it is locked.</param>\r\n        /// <returns>True if the given entityToken is locked</returns>\r\n        public static bool IsLocked(EntityToken entityToken)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                EnsureInitialization();\r\n                string lockKey = GetLockKey(entityToken);\r\n                return _lockingInformations.ContainsKey(lockKey);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"entityToken\">Entity token to check if it is locked.</param>\r\n        /// <returns>Returns the name of the user who has locked the given entity token. Null if no one has a lock on it.</returns>\r\n        public static string LockedBy(EntityToken entityToken)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                EnsureInitialization();\r\n\r\n                string lockKey = GetLockKey(entityToken);\r\n\r\n                LockingInformation lockingInformation;\r\n                if (!_lockingInformations.TryGetValue(lockKey, out lockingInformation))\r\n                {\r\n                    return null;\r\n                }\r\n                \r\n                return lockingInformation.Username;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>    \r\n        /// </summary>\r\n        /// <exclude />\r\n        public static IDisposable Locker\r\n        {\r\n            get\r\n            {\r\n                return new LockerToken();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void ReleaseAll(string username)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                EnsureInitialization();\r\n\r\n                List<Tuple<string, object>> itemsToRemove =\r\n                    (from info in _lockingInformations\r\n                     where info.Value.Username == username\r\n                     select new Tuple<string, object>(info.Key, info.Value.OwnerId)).ToList();\r\n\r\n                foreach (var item in itemsToRemove)\r\n                {\r\n                    RemoveLockingInformation(item.Item1, item.Item2);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is a \"non-safe\" release of a lock. For safe use, use ReleaseLock\r\n        /// </summary>\r\n        /// <param name=\"entityToken\"></param>        \r\n        public static void RemoveLock(EntityToken entityToken)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                EnsureInitialization();\r\n\r\n                string lockKey = GetLockKey(entityToken);\r\n\r\n                if (_lockingInformations.ContainsKey(lockKey))\r\n                {\r\n                    RemoveLockingInformation(lockKey, _lockingInformations[lockKey].OwnerId);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void DoInitialize()\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                Log.LogVerbose(\"RGB(194, 252, 131)ActionLockingFacade\", \"----------========== Initializing EntityToken Locks ==========----------\");\r\n                int startTime = Environment.TickCount;\r\n\r\n                if (_lockingInformations == null)\r\n                {\r\n                    _lockingInformations = new Dictionary<string, LockingInformation>();\r\n\r\n                    LoadLockingInformation();\r\n                }\r\n\r\n                int endTime = Environment.TickCount;\r\n                Log.LogVerbose(\"RGB(194, 252, 131)ActionLockingFacade\", string.Format(\"----------========== Done initializing EntityToken Locks ({0} ms ) ==========----------\", endTime - startTime));\r\n            }\r\n        }\r\n\r\n\r\n        private static void LoadLockingInformation()\r\n        {\r\n            List<ILockingInformation> lockingInformations = DataFacade.GetData<ILockingInformation>().ToList();\r\n            List<Guid> lockingInformationsToDelete = new List<Guid>();\r\n\r\n            foreach (ILockingInformation lockingInformation in lockingInformations)\r\n            {\r\n                object ownerId = DeserializeOwnerId(lockingInformation.SerializedOwnerId);\r\n\r\n                LockingInformation li = new LockingInformation\r\n                {\r\n                    OwnerId = ownerId,\r\n                    Username = lockingInformation.Username\r\n                };\r\n\r\n                try \r\n                {\r\n                    _lockingInformations.Add(lockingInformation.LockKey, li);\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    // Removing broken locking information (Ex. dead data source ids) /MRJ\r\n                    lockingInformationsToDelete.Add(lockingInformation.Id);\r\n                }\r\n            }\r\n\r\n            foreach (Guid id in lockingInformationsToDelete)\r\n            {\r\n                DataFacade.Delete<ILockingInformation>(f => f.Id == id);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddLockingInformation(EntityToken entityToken, object ownerId)\r\n        {\r\n            string lockKey = GetLockKey(entityToken);\r\n\r\n            LockingInformation lockingInformation;\r\n            if (_lockingInformations.TryGetValue(lockKey, out lockingInformation))\r\n            {\r\n                if (object.Equals(lockingInformation.OwnerId, ownerId))\r\n                {\r\n                    // NO OP: The owner may acquire a lock multiple times\r\n                    return;\r\n                }\r\n\r\n                // This will only happen if an entity token subclass is not rightly implemented\r\n                throw new ActionLockingException(\"This item is used by another user, try again.\");\r\n            }\r\n            \r\n            lockingInformation = new LockingInformation\r\n                {\r\n                    Username = UserValidationFacade.GetUsername(),\r\n                    OwnerId = ownerId\r\n                };\r\n\r\n            string serializedOwnerId = SerializeOwnerId(lockingInformation.OwnerId);\r\n\r\n            ILockingInformation li = DataFacade.BuildNew<ILockingInformation>();\r\n            li.Id = Guid.NewGuid();\r\n            li.LockKey = lockKey;\r\n            li.SerializedOwnerId = serializedOwnerId;\r\n            li.Username = lockingInformation.Username;\r\n\r\n            DataFacade.AddNew<ILockingInformation>(li);\r\n            _lockingInformations.Add(lockKey, lockingInformation);\r\n        }\r\n\r\n\r\n\r\n        private static void UpdateLockingInformation(EntityToken entityToken, object newOwnerId)\r\n        {\r\n            string lockKey = GetLockKey(entityToken);\r\n\r\n            LockingInformation lockingInformation;\r\n            if (!_lockingInformations.TryGetValue(lockKey, out lockingInformation)) throw new InvalidOperationException(\"LockingInformation record missing\");\r\n\r\n            ILockingInformation lockingInformationDataItem =\r\n                DataFacade.GetData<ILockingInformation>().\r\n                Single(f => f.LockKey == lockKey);\r\n\r\n            lockingInformationDataItem.SerializedOwnerId = SerializeOwnerId(newOwnerId);\r\n            DataFacade.Update(lockingInformationDataItem);\r\n\r\n            lockingInformation.OwnerId = newOwnerId;\r\n        }\r\n\r\n\r\n\r\n        private static void RemoveLockingInformation(string lockKey, object ownerId)\r\n        {\r\n            LockingInformation lockingInformation;\r\n            if (!_lockingInformations.TryGetValue(lockKey, out lockingInformation)) return;\r\n\r\n            if (Equals(lockingInformation.OwnerId, ownerId))\r\n            {\r\n                _lockingInformations.Remove(lockKey);\r\n            }\r\n\r\n            string serializedOwnerId = SerializeOwnerId(ownerId);\r\n\r\n            ILockingInformation lockingInformationDataItem =\r\n                DataFacade.GetData<ILockingInformation>()\r\n                          .SingleOrDefault(f => f.LockKey == lockKey\r\n                                             && f.SerializedOwnerId == serializedOwnerId);\r\n\r\n            if (lockingInformationDataItem == null)\r\n            {\r\n                Log.LogWarning(LogTitle, \"Failed to find entity token lock. EntityToken: \" + lockKey);\r\n                return;\r\n            }\r\n\r\n            DataFacade.Delete(lockingInformationDataItem);\r\n        }\r\n\r\n\r\n\r\n        private static string SerializeOwnerId(object ownerId)\r\n        {\r\n            using (MemoryStream ms = new MemoryStream())\r\n            {\r\n                _ownerIdFormatter.Serialize(ms, ownerId);\r\n\r\n                byte[] bytes = ms.ToArray();\r\n\r\n                string serializedOwnerId = Convert.ToBase64String(bytes);\r\n\r\n                return serializedOwnerId;\r\n            }\r\n        }\r\n\r\n\r\n        internal static object DeserializeOwnerId(string serializedOwnerId)\r\n        {\r\n            byte[] bytes = Convert.FromBase64String(serializedOwnerId);\r\n            using (MemoryStream ms = new MemoryStream(bytes))\r\n            {\r\n                return _ownerIdFormatter.Deserialize(ms);\r\n            }\r\n        }\r\n\r\n\r\n        private sealed class LockingInformation\r\n        {\r\n            public string Username { get; set; }\r\n            public object OwnerId { get; set; }\r\n        }\r\n\r\n\r\n\r\n        private static void Lock()\r\n        {\r\n            bool success = false;\r\n            Monitor.TryEnter(_lock, TimeSpan.FromMinutes(1), ref success);\r\n\r\n            if (!success)\r\n            {\r\n                throw new InvalidOperationException(\"Failed to obtain a required resource lock. Aborting to avoid system deadlocks.\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Exit()\r\n        {\r\n            Monitor.Exit(_lock);\r\n        }\r\n\r\n\r\n        private static string GetLockKey(EntityToken entityToken)\r\n        {\r\n            string lockKey = entityToken.Serialize();\r\n\r\n            if (entityToken is DataEntityToken)\r\n            {\r\n                var dataEntityToken = entityToken as DataEntityToken;\r\n                if (dataEntityToken.DataSourceId != null && dataEntityToken.DataSourceId.LocaleScope != null)\r\n                {\r\n                    lockKey = lockKey + dataEntityToken.DataSourceId.LocaleScope.ToString();\r\n                }\r\n            }\r\n\r\n            return lockKey;\r\n        }\r\n\r\n\r\n\r\n\r\n        private sealed class LockerToken : IDisposable\r\n        {\r\n            internal LockerToken()\r\n            {\r\n                using (GlobalInitializerFacade.CoreNotLockedScope)\r\n                {\r\n                    ActionLockingFacade.Lock();\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public void Dispose()\r\n            {\r\n                ActionLockingFacade.Exit();\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~LockerToken()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/ActionResult.cs",
    "content": "namespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ActionResult\r\n    {\r\n        /// <exclude />\r\n        public ActionResultResponseType ResponseType { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum ActionResultResponseType\r\n    {\r\n        /// <exclude />\r\n        None,\r\n\r\n        /// <exclude />\r\n        OpenDocument,\r\n\r\n        /// <exclude />\r\n        OpenModalDialog\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/AddNewTreeRefresher.cs",
    "content": "using System;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class AddNewTreeRefresher\r\n    {\r\n        private readonly FlowControllerServicesContainer _flowControllerServicesContainer;\r\n        private readonly RelationshipGraph _beforeGraph;\r\n        private RelationshipGraph _afterGraph;\r\n        private bool _postRefreshMessegesCalled;\r\n\r\n\r\n        /// <exclude />\r\n        public AddNewTreeRefresher(EntityToken parentEntityToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            Verify.ArgumentNotNull(parentEntityToken, \"parentEntityToken\");\r\n            Verify.ArgumentNotNull(flowControllerServicesContainer, \"flowControllerServicesContainer\");\r\n\r\n            _beforeGraph = new RelationshipGraph(parentEntityToken, RelationshipGraphSearchOption.Both, false, false);\r\n            _flowControllerServicesContainer = flowControllerServicesContainer;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use PostRefreshMessages instead\")]\r\n        public void PostRefreshMesseges(EntityToken newChildEntityToken)\r\n        {\r\n            PostRefreshMessages(newChildEntityToken);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void PostRefreshMessages(EntityToken newChildEntityToken)\r\n        {\r\n            Verify.ArgumentNotNull(newChildEntityToken, \"newChildEntityToken\");\r\n            Verify.That(!_postRefreshMessegesCalled, \"Only one PostRefreshMessages call is allowed\");\r\n\r\n            _postRefreshMessegesCalled = true;\r\n\r\n            _afterGraph = new RelationshipGraph(newChildEntityToken, RelationshipGraphSearchOption.Both, false, false);\r\n\r\n            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            foreach (EntityToken entityToken in RefreshBeforeAfterEntityTokenFinder.FindEntityTokens(_beforeGraph, _afterGraph))\r\n            {\r\n                messageService.RefreshTreeSection(entityToken);\r\n                Log.LogVerbose(\"AddNewTreeRefresher\",\r\n                    $\"Refreshing EntityToken: Type = {entityToken.Type}, Source = {entityToken.Source}, Id = {entityToken.Id}, EntityTokenType = {entityToken.GetType()}\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/Data/ActionIdentifier.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\n\r\nnamespace Composite.C1Console.Actions.Data\r\n{\r\n    /// <summary>\r\n    /// A container for Action Types\r\n    /// </summary>\r\n    public class ActionIdentifier\r\n    {\r\n        private const string ActionIdentifierKey = \"_ActionIdentifier_\";\r\n\r\n        private readonly string _value;\r\n\r\n        private ActionIdentifier(string identifier)\r\n        {\r\n            _value = identifier;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier Edit => new ActionIdentifier(\"Edit\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier Add => new ActionIdentifier(\"Add\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier Delete => new ActionIdentifier(\"Delete\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier SendToDraft => new ActionIdentifier(\"SendToDraft\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier SendForApproval => new ActionIdentifier(\"SendForApproval\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier SendForPublication => new ActionIdentifier(\"SendForPublication\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier Publish => new ActionIdentifier(\"Publish\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier Unpublish => new ActionIdentifier(\"Unpublish\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier Undo => new ActionIdentifier(\"Undo\");\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier Duplicate => new ActionIdentifier(\"Duplicate\");\r\n\r\n        /// <exclude />\r\n        public IEnumerable<PermissionType> Permissions()\r\n        {\r\n            if (this == Add)\r\n            {\r\n                yield return PermissionType.Add;\r\n            }\r\n            if (this == Edit)\r\n            {\r\n                yield return PermissionType.Edit;\r\n            }\r\n            if (this == Delete)\r\n            {\r\n                yield return PermissionType.Delete;\r\n            }\r\n            if (this == Publish)\r\n            {\r\n                yield return PermissionType.Publish;\r\n            }\r\n            if (this == Unpublish)\r\n            {\r\n                yield return PermissionType.Publish;\r\n            }\r\n            if (this == SendForApproval)\r\n            {\r\n                yield return PermissionType.Edit;\r\n            }\r\n            if (this == SendForPublication)\r\n            {\r\n                yield return PermissionType.Approve;\r\n            }\r\n            if (this == SendToDraft)\r\n            {\r\n                yield return PermissionType.Edit;\r\n                yield return PermissionType.Approve;\r\n                yield return PermissionType.Publish;\r\n            }\r\n            if (this == Undo)\r\n            {\r\n                yield return PermissionType.Edit;\r\n            }\r\n            if (this == Duplicate)\r\n            {\r\n                yield return PermissionType.Add;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return _value.GetHashCode();\r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as ActionIdentifier);\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool Equals(ActionIdentifier obj)\r\n        {\r\n            return obj == this;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool operator ==(ActionIdentifier a1, ActionIdentifier a2)\r\n        {\r\n            return  a1?._value == a2?._value;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool operator !=(ActionIdentifier a1, ActionIdentifier a2)\r\n        {\r\n            return !(a1 == a2);\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            var stringBuilder = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(stringBuilder, ActionIdentifierKey, _value);\r\n\r\n            return stringBuilder.ToString();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static ActionIdentifier Deserialize(string serializedData)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n            if (!dic.TryGetValue(ActionIdentifierKey, out string value))\r\n            {\r\n                throw new ArgumentException($\"The serialized data does not contain '{ActionIdentifierKey}'\", nameof(serializedData));\r\n            }\r\n\r\n            string serializedType = StringConversionServices.DeserializeValueString(value);\r\n\r\n            return new ActionIdentifier(serializedType);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public override string ToString() => _value;\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Actions/Data/DataActionTokenRegisterHandler.cs",
    "content": "using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.C1Console.Actions.Data\r\n{\r\n    abstract class DataActionTokenRegisterHandler\r\n    {\r\n        public abstract ActionToken GetActionToken(IData data);\r\n\r\n        public abstract bool Check(Type type,IData data, ActionIdentifier actionIdentifier);\r\n    }\r\n\r\n    class DataActionTokenRegisterHandler<T> : DataActionTokenRegisterHandler where T : IData\r\n    {\r\n        private readonly Func<T, ActionToken> _actionTokenFunc;\r\n        private readonly ActionIdentifier _actionIdentifier;\r\n        private readonly Func<T, bool> _actionValidPredicate;\r\n\r\n        public DataActionTokenRegisterHandler(ActionIdentifier actionIdentifier, Func<T, ActionToken> dataActionToken)\r\n        {\r\n            _actionTokenFunc = dataActionToken;\r\n            _actionIdentifier = actionIdentifier;\r\n        }\r\n\r\n        public DataActionTokenRegisterHandler(ActionIdentifier actionIdentifier, Func<T, ActionToken> dataActionToken, Func<T, bool> actionValidPredicate) : this(actionIdentifier, dataActionToken)\r\n        {\r\n            _actionValidPredicate = actionValidPredicate;\r\n        }\r\n\r\n        public override ActionToken GetActionToken(IData data)\r\n        {\r\n            return _actionTokenFunc((T)data);\r\n        }\r\n\r\n        public override bool Check(Type type, IData data, ActionIdentifier actionIdentifier)\r\n        {\r\n            if (_actionIdentifier == actionIdentifier)\r\n            {\r\n                if (type == typeof(T))\r\n                {\r\n                    if (_actionValidPredicate == null || _actionValidPredicate((T) data))\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n            }\r\n            return false;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Actions/Data/DataActionTokenResolver.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.C1Console.Actions.Data\r\n{\r\n    /// <exclude />\r\n    public class DataActionTokenResolver \r\n    {\r\n        static List<DataActionTokenRegisterHandler> _defaultActions;\r\n        static List<DataActionTokenRegisterHandler> _conditionalActions;\r\n\r\n        /// <summary>\r\n        /// Use this to assign a deafult action to a certain data type\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"actionIdentifier\"></param>\r\n        /// <param name=\"dataActionToken\"></param>\r\n        public void RegisterDefault<T>(ActionIdentifier actionIdentifier, Func<T, ActionToken> dataActionToken) where T : IData\r\n        {\r\n            Verify.ArgumentNotNull(actionIdentifier, nameof(actionIdentifier));\r\n            Verify.ArgumentNotNull(dataActionToken, nameof(dataActionToken));\r\n\r\n            if (_defaultActions == null)\r\n            {\r\n                _defaultActions = new List<DataActionTokenRegisterHandler>();\r\n            }\r\n\r\n            _defaultActions.Add(new DataActionTokenRegisterHandler<T>(actionIdentifier, dataActionToken));\r\n        }\r\n        /// <summary>\r\n        /// Use this to assaign an action to a certain data type if a certain condition met\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"actionIdentifier\"></param>\r\n        /// <param name=\"actionValidPredicate\"></param>\r\n        /// <param name=\"dataActionToken\"></param>\r\n        public void RegisterConditional<T>(ActionIdentifier actionIdentifier, Func<T, bool> actionValidPredicate, Func<T, ActionToken> dataActionToken) where T : IData\r\n        {\r\n            Verify.ArgumentNotNull(actionIdentifier, nameof(actionIdentifier));\r\n            Verify.ArgumentNotNull(actionValidPredicate, nameof(actionValidPredicate));\r\n            Verify.ArgumentNotNull(dataActionToken, nameof(dataActionToken));\r\n\r\n            if (_conditionalActions == null)\r\n            {\r\n                _conditionalActions = new List<DataActionTokenRegisterHandler>();\r\n            }\r\n\r\n            _conditionalActions.Add(new DataActionTokenRegisterHandler<T>(actionIdentifier, dataActionToken, actionValidPredicate));\r\n        }\r\n\r\n        /// <exclude />\r\n        public ActionToken Resolve(IData data, ActionIdentifier actionIdentifier)\r\n        {\r\n            var interfaces = GetOrderedInterfaces(data.DataSourceId.InterfaceType);\r\n\r\n            foreach (var type in interfaces)\r\n            {\r\n                var conditionalAction = _conditionalActions?.FirstOrDefault(f => f.Check(type, data, actionIdentifier));\r\n                if (conditionalAction != null)\r\n                {\r\n                    var actionToken = conditionalAction.GetActionToken(data);\r\n                    if (actionToken == null)\r\n                    {\r\n                        throw new InvalidOperationException($\"Conditional action token is null. Type: '{type.FullName}', action type: '{conditionalAction.GetType().FullName}'\");\r\n                    }\r\n\r\n                    return actionToken;\r\n                }\r\n            }\r\n\r\n            return ResolveDefault(data, actionIdentifier);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Resolves a default action of the given type for a given data item\r\n        /// </summary>\r\n        /// <param name=\"data\">The data item</param>\r\n        /// <param name=\"actionIdentifier\">The action identifier</param>\r\n        /// <returns></returns>\r\n        public ActionToken ResolveDefault(IData data, ActionIdentifier actionIdentifier)\r\n        {\r\n            var interfaceType = data.DataSourceId.InterfaceType;\r\n\r\n            var interfaces = GetOrderedInterfaces(interfaceType);\r\n\r\n            foreach (var type in interfaces)\r\n            {\r\n                var defaultAction = _defaultActions?.LastOrDefault(f => f.Check(type, data, actionIdentifier));\r\n                if (defaultAction != null)\r\n                {\r\n                    var actionToken = defaultAction.GetActionToken(data);\r\n                    if (actionToken == null)\r\n                    {\r\n                        throw new InvalidOperationException($\"Default action token is null. Type: '{type.FullName}', default action type: '{defaultAction.GetType().FullName}'\");\r\n                    }\r\n\r\n                    return actionToken;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException($\"No default action token is found. Searched for type: '{interfaceType}', Registered types: '{string.Join(\", \",interfaces.Select(_ => _.FullName))}'\");\r\n        }\r\n\r\n        private static List<Type> GetOrderedInterfaces(Type dataType)\r\n        {\r\n            var result = new List<Type> { dataType };\r\n\r\n            result.AddRange(dataType.GetInterfaces().OrderByDescending(f => f.GetInterfaces().Length));\r\n\r\n            return result;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Actions/Data/DataActionTokenResolverFacade.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Composite.C1Console.Actions.Data\r\n{\r\n    /// <summary>\r\n    /// Use this to access the service that has DataActionTokenResolver to register your actions\r\n    /// </summary>\r\n    public static class DataActionTokenResolverFacade\r\n    {\r\n        /// <exclude />\r\n        public static ActionToken Resolve(IData data, ActionIdentifier actionIdentifier)\r\n        {\r\n            return GetDataActionTokenResolverService().Resolve(data, actionIdentifier);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static ActionToken ResolveDefault(IData data, ActionIdentifier actionIdentifier)\r\n        {\r\n            return GetDataActionTokenResolverService().ResolveDefault(data, actionIdentifier);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Use this to assign a deafult action to a certain data type\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"actionIdentifier\"></param>\r\n        /// <param name=\"dataActionToken\"></param>\r\n        public static void RegisterDefault<T>(ActionIdentifier actionIdentifier, Func<T, ActionToken> dataActionToken) where T : IData\r\n        {\r\n                GetDataActionTokenResolverService().RegisterDefault<T>(actionIdentifier, dataActionToken);\r\n        }\r\n        /// <summary>\r\n        /// Use this to assaign an action to a certain data type if a certain condition met\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"actionIdentifier\"></param>\r\n        /// <param name=\"actionValidPredicate\"></param>\r\n        /// <param name=\"dataActionToken\"></param>\r\n        public static void RegisterConditional<T>(ActionIdentifier actionIdentifier, Func<T, bool> actionValidPredicate, Func<T, ActionToken> dataActionToken) where T : IData\r\n        {\r\n            GetDataActionTokenResolverService().RegisterConditional<T>(actionIdentifier, actionValidPredicate, dataActionToken);\r\n        }\r\n\r\n        private static DataActionTokenResolver GetDataActionTokenResolverService()\r\n        {\r\n            return ServiceLocator.GetService<DataActionTokenResolver>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/Data/DataActionTokenResolverRegistry.cs",
    "content": "﻿using Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Composite.C1Console.Actions.Data\r\n{\r\n    internal static class DataActionTokenResolverRegistry\r\n    {\r\n        internal static void AddDataActionTokenResolver(this IServiceCollection serviceCollection)\r\n        {\r\n            serviceCollection.Add(ServiceDescriptor.Singleton(new DataActionTokenResolver()));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/Data/ProxyDataActionExecuter.cs",
    "content": "using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.C1Console.Actions.Data\r\n{\r\n    /// <exclude />\r\n    public class ProxyDataActionExecuter : IActionExecutorSerializedParameters\r\n    {\r\n        /// <exclude />\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            return Execute(EntityTokenSerializer.Serialize(entityToken), ActionTokenSerializer.Serialize(actionToken), actionToken, flowControllerServicesContainer);\r\n        }\r\n\r\n        /// <exclude />\r\n        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            IData data = dataEntityToken.Data;\r\n\r\n            Verify.IsNotNull(data, \"Failed to get the data from an entity token\");\r\n\r\n            var actionIdentifier = ((ProxyDataActionToken)actionToken).ActionIdentifier;\r\n            var action = DataActionTokenResolverFacade.Resolve(data, actionIdentifier);\r\n\r\n            if (action == null)\r\n            {\r\n                throw new InvalidOperationException($\"Failed to resolve action '{actionToken?.ToString() ?? \"null\"}'\");\r\n            }\r\n\r\n            return ActionExecutorFacade.Execute(dataEntityToken, action, flowControllerServicesContainer);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Actions/Data/ProxyDataActionToken.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\n\r\nnamespace Composite.C1Console.Actions.Data\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ActionExecutor(typeof(ProxyDataActionExecuter))]\r\n    public class ProxyDataActionToken : ActionToken \r\n    {\r\n        private readonly ActionIdentifier _actionIdentifier;\r\n        private readonly IEnumerable<PermissionType> _permissionTypes;\r\n        /// <exclude />\r\n        public ProxyDataActionToken( ActionIdentifier actionIdentifier)\r\n        {\r\n            _actionIdentifier = actionIdentifier;\r\n        }\r\n        /// <exclude />\r\n        public ProxyDataActionToken(ActionIdentifier actionIdentifier, IEnumerable<PermissionType> permissionTypes) : this(actionIdentifier)\r\n        {\r\n            _permissionTypes = permissionTypes;\r\n        }\r\n        /// <exclude />\r\n        public ActionIdentifier ActionIdentifier => _actionIdentifier;\r\n\r\n        /// <exclude />\r\n        public bool DoIgnoreEntityTokenLocking { get; set;}\r\n\r\n        /// <exclude />\r\n        public override bool IgnoreEntityTokenLocking => DoIgnoreEntityTokenLocking;\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PermissionType> PermissionTypes => _permissionTypes ?? _actionIdentifier.Permissions();\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder stringBuilder = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(stringBuilder, \"_ActionIdentifier_\", ActionIdentifier.Serialize());\r\n            StringConversionServices.SerializeKeyValuePair(stringBuilder, \"_PermissionTypes_\", PermissionTypes.SerializePermissionTypes());\r\n            StringConversionServices.SerializeKeyValuePair(stringBuilder, \"_DoIgnoreEntityTokenLocking_\", DoIgnoreEntityTokenLocking);\r\n\r\n            return stringBuilder.ToString();\r\n        }\r\n        /// <exclude />\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n            if (!dic.ContainsKey(\"_ActionIdentifier_\") || !dic.ContainsKey(\"_PermissionTypes_\") )\r\n            {\r\n                throw new ArgumentException($\"The {nameof(serializedData)} is not a serialized {nameof(ProxyDataActionToken)}\", nameof(serializedData));\r\n            }\r\n\r\n            string serializedType = StringConversionServices.DeserializeValueString(dic[\"_ActionIdentifier_\"]);\r\n            \r\n            string permissionTypesString = StringConversionServices.DeserializeValueString(dic[\"_PermissionTypes_\"]);\r\n\r\n            bool doIgnoreEntityTokenLocking = StringConversionServices.DeserializeValueBool(dic[\"_DoIgnoreEntityTokenLocking_\"]);\r\n\r\n            var result = new ProxyDataActionToken(ActionIdentifier.Deserialize(serializedType), permissionTypesString.DesrializePermissionTypes()) {DoIgnoreEntityTokenLocking = doIgnoreEntityTokenLocking};\r\n\r\n            return result;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Actions/DeleteTreeRefresher.cs",
    "content": "using System;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DeleteTreeRefresher\r\n    {\r\n        private readonly RelationshipGraph _beforeGraph;\r\n        private readonly FlowControllerServicesContainer _flowControllerServicesContainer;\r\n        private bool _postRefreshMessagesCalled;\r\n\r\n\r\n        /// <exclude />\r\n        public DeleteTreeRefresher(EntityToken beforeDeleteEntityToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            Verify.ArgumentNotNull(beforeDeleteEntityToken, \"beforeDeleteEntityToken\");\r\n            Verify.ArgumentNotNull(flowControllerServicesContainer, \"flowControllerServicesContainer\");\r\n\r\n            _beforeGraph = new RelationshipGraph(beforeDeleteEntityToken, RelationshipGraphSearchOption.Both);\r\n            _flowControllerServicesContainer = flowControllerServicesContainer;            \r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use PostRefreshMessages instead\")]\r\n        public void PostRefreshMesseges()\r\n        {\r\n            PostRefreshMessages(false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use PostRefreshMessages instead\")]\r\n        public void PostRefreshMesseges(bool skipBeforeDeleteEntityToken)\r\n        {\r\n            PostRefreshMessages(skipBeforeDeleteEntityToken);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void PostRefreshMessages(bool skipBeforeDeleteEntityToken = false)\r\n        {\r\n            if (_postRefreshMessagesCalled)\r\n            {\r\n                throw new InvalidOperationException(\"Only one PostRefreshMessages call is allowed\");\r\n            }\r\n\r\n            _postRefreshMessagesCalled = true;\r\n\r\n            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            foreach (EntityToken entityToken in RefreshDeleteEntityTokenFinder.FindEntityTokens(_beforeGraph, skipBeforeDeleteEntityToken))\r\n            {\r\n                messageService.RefreshTreeSection(entityToken);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/DuplicateActionToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Text.RegularExpressions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Commands.ConsoleCommandHandlers;\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>\r\n    /// Action to duplicate data\r\n    /// </summary>\r\n    [ActionExecutor(typeof(DuplicateActionExecuter))]\r\n    public sealed class DuplicateActionToken : ActionToken\r\n    {\r\n        /// <exclude />\r\n        public override IEnumerable<PermissionType> PermissionTypes => new[] { PermissionType.Add };\r\n\r\n        /// <exclude />\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new DuplicateActionToken();\r\n        }\r\n    }\r\n\r\n    internal class DuplicateActionExecuter : IActionExecutor\r\n    {\r\n        /// <exclude />\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            return Execute(EntityTokenSerializer.Serialize(entityToken), ActionTokenSerializer.Serialize(actionToken), actionToken, flowControllerServicesContainer);\r\n        }\r\n\r\n        /// <exclude />\r\n        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            var dataEntityToken = (DataEntityToken)EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            var data = dataEntityToken.Data;\r\n\r\n            Verify.IsNotNull(data, \"Failed to get the data from an entity token\");\r\n\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                var treeRefresher = new AddNewTreeRefresher(dataEntityToken,flowControllerServicesContainer);\r\n\r\n                var newData = (IData)StaticReflection.GetGenericMethodInfo(() => CloneData((IData)null))\r\n                    .MakeGenericMethod(data.DataSourceId.InterfaceType).Invoke(this, new object[] { data });\r\n\r\n                var consoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n                ConsoleCommandHelper.SelectConsoleElementWithoutPerspectiveChange(consoleId, newData.GetDataEntityToken());\r\n\r\n                treeRefresher.PostRefreshMessages(dataEntityToken);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private static readonly Func<IPage, bool> IsRootPage = f => f.GetParent() == null;\r\n\r\n        private IData CloneData<T>(T data) where T : class, IData\r\n        {\r\n            IData newdata = DataFacade.BuildNew<T>();\r\n\r\n            var dataProperties = typeof(T).GetPropertiesRecursively();\r\n\r\n            foreach (var propertyInfo in dataProperties.Where(f => f.CanWrite))\r\n            {\r\n                if (typeof(T).GetPhysicalKeyProperties().Contains(propertyInfo) && propertyInfo.PropertyType == typeof(Guid))\r\n                {\r\n                    propertyInfo.SetValue(newdata, Guid.NewGuid());\r\n                }\r\n                else\r\n                {\r\n                    propertyInfo.SetValue(newdata, propertyInfo.GetValue(data));\r\n                }\r\n\r\n            }\r\n\r\n            var page = data as IPage;\r\n            if (page != null)\r\n            {\r\n                if (IsRootPage(page))\r\n                {\r\n                    SetNewValue<T>(page, newdata, dataProperties.First(p => p.Name == nameof(IPage.Title)));\r\n                }\r\n                else if (!SetNewValue<T>(page, newdata, dataProperties.First(p => p.Name == nameof(IPage.MenuTitle))))\r\n                {\r\n                    SetNewValue<T>(page, newdata, dataProperties.First(p => p.Name == nameof(IPage.Title)));\r\n                }\r\n\r\n                SetNewValue<T>(page, newdata, dataProperties.First(p => p.Name == nameof(IPage.UrlTitle)), isUrl:true);\r\n                \r\n                PageInsertPosition.After(page.Id).CreatePageStructure(newdata as IPage, page.GetParentId());\r\n\r\n            }\r\n            else\r\n            {\r\n                var labelProperty = typeof(T).GetProperty(\r\n                    DynamicTypeReflectionFacade.GetLabelPropertyName(typeof(T)));\r\n\r\n                if (labelProperty != null && labelProperty.PropertyType == typeof(string))\r\n                {\r\n                    SetNewValue<T>(data, newdata, labelProperty);\r\n                }\r\n            }\r\n\r\n            if (newdata is IPublishControlled)\r\n            {\r\n                (newdata as IPublishControlled).PublicationStatus = GenericPublishProcessController.Draft;\r\n            }\r\n            if (newdata is ILocalizedControlled)\r\n            {\r\n                (newdata as ILocalizedControlled).SourceCultureName = UserSettings.ActiveLocaleCultureInfo.Name;\r\n            }\r\n\r\n            newdata = DataFacade.AddNew(newdata);\r\n\r\n            if (data is IPage)\r\n            {\r\n                CopyPageData(data as IPage, newdata as IPage);\r\n            }\r\n\r\n            return newdata;\r\n        }\r\n\r\n        private bool SetNewValue<T>( IData sourceData, IData newData, PropertyInfo property\r\n            ,bool isUrl=false) where T : class, IData\r\n        {\r\n            var value = isUrl? (string)property.GetValue(sourceData):\r\n                                GetStringWithoutCopyOf((string) property.GetValue(sourceData));\r\n\r\n            var storeFieldType = property.GetCustomAttributes(typeof(StoreFieldTypeAttribute),true).FirstOrDefault();\r\n            var maxLength = (storeFieldType as StoreFieldTypeAttribute)?.StoreFieldType.MaximumLength;\r\n\r\n            if (!isUrl && value.IsNullOrEmpty())\r\n                return false;\r\n            for (var count = 1;; count++)\r\n            {\r\n                var str = GenerateCopyOfName(value, count, maxLength, isUrl);\r\n                if (DataFacade.GetData<T>().Any(GetLambda<T>(property, str))) continue;\r\n                property.SetValue(newData, str);\r\n                break;\r\n            }\r\n            return true;\r\n        }\r\n\r\n        private Expression<Func<T, bool>> GetLambda<T>(PropertyInfo labelProperty, string labelValue)\r\n        {\r\n            var p = Expression.Parameter(typeof(T));\r\n            var propertry = Expression.Property(p, labelProperty.Name);\r\n            var body = Expression.Equal(propertry, Expression.Constant(labelValue));\r\n            return Expression.Lambda<Func<T, bool>>(body, p);\r\n        }\r\n\r\n        private static string GetStringWithoutCopyOf(string source)\r\n        {\r\n            Regex regexInstance = new Regex(StringResourceSystemFacade.GetString(\"Composite.Management\", \"Duplication.Text\").Replace(\"{0}\",\"\").Replace(\"{count}\", @\"(\\(.*\\))*\"));\r\n            return regexInstance.Replace(source, \"\");\r\n\r\n        }\r\n\r\n        private string GenerateCopyOfName(string source, int count, int? maxLength, bool isUrl=false )\r\n        {\r\n            if (isUrl)\r\n            {\r\n                if (!source.IsNullOrEmpty())\r\n                {\r\n                    return string.Join(\"-\", source, count.ToString());\r\n                }\r\n                var numberInString = count == 1 ? \"\" : count.ToString();\r\n                return $\"Copy{numberInString}-of\";\r\n            }\r\n\r\n            Func <int, string> copyText = i => StringResourceSystemFacade.GetString(\"Composite.Management\", \"Duplication.Text\")\r\n                                    .Replace(\"{count}\", i == 1 ? \"\" : $\"({i})\");\r\n            var result = string.Format(copyText(count), source);\r\n            return (maxLength!=null)?result.Substring(0, Math.Min(result.Length, maxLength.Value)):result;\r\n        }\r\n\r\n        internal void CopyPageData(IPage sourcePage, IPage newPage)\r\n        {\r\n            Guid sourcePageId = sourcePage.Id;\r\n            Guid newPageId = newPage.Id;\r\n            Guid sourceVersionId = sourcePage.VersionId;\r\n            Guid newVersionId = newPage.VersionId;\r\n\r\n            var newPlaceholders = new List<IPagePlaceholderContent>();\r\n            var placeholders =\r\n                DataFacade.GetData<IPagePlaceholderContent>(false)\r\n                    .Where(ph => ph.PageId == sourcePageId\r\n                                 && ph.VersionId == sourceVersionId)\r\n                    .ToList();\r\n\r\n            foreach (var placeholderContent in placeholders)\r\n            {\r\n                var newPlaceholder = DataFacade.BuildNew<IPagePlaceholderContent>();\r\n\r\n                newPlaceholder.PageId = newPageId;\r\n                newPlaceholder.PlaceHolderId = placeholderContent.PlaceHolderId;\r\n                newPlaceholder.Content = placeholderContent.Content;\r\n                newPlaceholder.VersionId = newVersionId;\r\n\r\n                newPlaceholders.Add(newPlaceholder);\r\n            }\r\n            DataFacade.AddNew<IPagePlaceholderContent>(newPlaceholders);\r\n\r\n            var sourceMetaData = sourcePage.GetMetaData().Cast<IPageMetaData>()\r\n                                    .Where(d => d.VersionId == sourceVersionId);\r\n            foreach (var metaDataItem in sourceMetaData)\r\n            {\r\n                var metaDataType = metaDataItem.DataSourceId.InterfaceType;\r\n                var typeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(metaDataType.GetImmutableTypeId());\r\n                var definition = PageMetaDataFacade.GetMetaDataDefinition(sourcePageId, metaDataItem.GetTypeTitle());\r\n\r\n                var newDataItem = (IPageMetaData)DataFacade.BuildNew(metaDataType);\r\n\r\n                var properties = metaDataType.GetPropertiesRecursively().ToDictionary(p => p.Name);\r\n                foreach (var field in typeDescriptor.Fields)\r\n                {\r\n                    var propertyInfo = properties[field.Name];\r\n                    propertyInfo.SetValue(newDataItem, propertyInfo.GetValue(metaDataItem));\r\n                }\r\n\r\n                newDataItem.VersionId = newVersionId;\r\n                newDataItem.Id = Guid.NewGuid();\r\n                newDataItem.PageId = newPageId;\r\n                newDataItem.PublicationStatus = GenericPublishProcessController.Draft;\r\n                newDataItem = (IPageMetaData)DataFacade.AddNew((IData)newDataItem);\r\n\r\n                if (definition != null)\r\n                {\r\n                    string title = newDataItem.GetTypeTitle();\r\n                    newPage.AddMetaDataDefinition(title, title, newDataItem.GetImmutableTypeId(),\r\n                        definition.MetaDataContainerId);\r\n                }\r\n            }\r\n\r\n            List<string> selectableTreeIds = TreeFacade.AllTrees.Where(\r\n                tree => tree.HasAttachmentPoints(sourcePage.GetDataEntityToken()))\r\n                .Where(tree => !tree.HasAttachmentPoints(newPage.GetDataEntityToken()))\r\n                .Select(tree => tree.TreeId).ToList();\r\n\r\n            foreach (var selectableTreeId in selectableTreeIds)\r\n            {\r\n                TreeFacade.AddPersistedAttachmentPoint(selectableTreeId, newPage.DataSourceId.InterfaceType,\r\n                 newPage.DataSourceId.GetKeyValue());\r\n            }\r\n            \r\n            foreach (var dataFolderType in sourcePage.GetDefinedFolderTypes())\r\n            {\r\n                newPage.AddFolderDefinition(dataFolderType);\r\n            }\r\n\r\n\r\n\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/FlowControllerAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    [AttributeUsageAttribute(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]\r\n    internal sealed class FlowControllerAttribute : Attribute\r\n    {\r\n        private Type _flowControllerType;\r\n\r\n\r\n        public FlowControllerAttribute(Type flowControllerType)\r\n        {\r\n            _flowControllerType = flowControllerType;\r\n        }\r\n\r\n\r\n        public Type FlowControllerType\r\n        {\r\n            get { return _flowControllerType; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/FlowControllerFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions.Foundation;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class FlowControllerFacade\r\n    {\r\n        private static readonly string LogTitle = typeof (FlowControllerFacade).Name;\r\n        private static TimeSpan? _timeout = null;\r\n        private static bool _initialized = false;\r\n        private static object _lock = new object();\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void Initialize()\r\n        {\r\n            WorkflowFacade.RunWhenInitialized(() =>\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_initialized == false)\r\n                    {\r\n                        WorkflowInstance workflowInstance = WorkflowFacade.CreateNewWorkflow(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Actions.Workflows.FlowInformationScavengerWorkflow\"));\r\n                        workflowInstance.Start();\r\n                        WorkflowFacade.RunWorkflow(workflowInstance);\r\n\r\n                        Log.LogVerbose(LogTitle, \"Flow scavenger started\");\r\n\r\n                        _initialized = true;\r\n                    }\r\n                }\r\n            });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IFlowUiDefinition GetCurrentUiDefinition(FlowToken flowToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            if (flowToken == null) throw new ArgumentNullException(\"flowToken\");\r\n\r\n            IFlowController flowExecutor = FlowControllerCache.GetFlowController(flowToken, flowControllerServicesContainer);\r\n\r\n            IFlowUiDefinition flowResult = flowExecutor.GetCurrentUiDefinition(flowToken);\r\n\r\n            if (flowResult == null)\r\n            {\r\n                flowResult = new NullFlowUiDefinition();\r\n            }\r\n\r\n            return flowResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void CancelFlow(FlowToken flowToken)\r\n        {\r\n            if (flowToken == null) throw new ArgumentNullException(\"flowToken\");\r\n\r\n            IFlowController flowExecutor = FlowControllerCache.GetFlowController(flowToken, new FlowControllerServicesContainer());\r\n\r\n            flowExecutor.CancelFlow(flowToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void CancelFlowsByConsoleId(string consoleId)\r\n        {\r\n            List<string> serializedFlowTokens =\r\n                (from f in DataFacade.GetData<IFlowInformation>()\r\n                 where f.ConsoleId == consoleId\r\n                 select f.SerializedFlowToken).ToList();\r\n\r\n            foreach (string serializedFlowToken in serializedFlowTokens)\r\n            {\r\n                FlowToken flowToken = FlowTokenSerializer.Deserialize(serializedFlowToken);\r\n\r\n                CancelFlow(flowToken);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<FlowToken> GetFlowTokensByUsername(string username)\r\n        {\r\n            List<string> serializedFlowTokens =\r\n                (from f in DataFacade.GetData<IFlowInformation>()\r\n                 where f.Username == username\r\n                 select f.SerializedFlowToken).ToList();\r\n\r\n            foreach (string serializedFlowToken in serializedFlowTokens)\r\n            {\r\n                FlowToken flowToken = FlowTokenSerializer.Deserialize(serializedFlowToken);\r\n\r\n                yield return flowToken;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetConsoleIdsByUsername(string username)\r\n        {\r\n            List<string> consoleIds =\r\n                (from f in DataFacade.GetData<IFlowInformation>()\r\n                 where f.Username == username\r\n                 select f.ConsoleId).ToList();\r\n\r\n            return consoleIds;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FlowComplete(FlowToken flowToken)\r\n        {\r\n            UnregisterFlowInformation(flowToken);\r\n        }\r\n\r\n\r\n\r\n        internal static void RegisterNewFlowInformation(FlowToken flowToken, EntityToken entityToken, ActionToken actionToken, string consoleId)\r\n        {\r\n            IFlowInformation flowInformation = DataFacade.BuildNew<IFlowInformation>();\r\n            flowInformation.Id = Guid.NewGuid();\r\n            flowInformation.Username = UserSettings.Username;\r\n            flowInformation.ConsoleId = consoleId;\r\n            flowInformation.SerializedFlowToken = FlowTokenSerializer.Serialize(flowToken);\r\n            flowInformation.SerializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n            flowInformation.SerializedActionToken = ActionTokenSerializer.Serialize(actionToken);\r\n            flowInformation.TimeStamp = DateTime.Now;\r\n\r\n            DataFacade.AddNew<IFlowInformation>(flowInformation);\r\n        }\r\n\r\n\r\n\r\n        internal static void UnregisterFlowInformation(FlowToken flowToken)\r\n        {\r\n            string serializedFlowToken = FlowTokenSerializer.Serialize(flowToken);\r\n\r\n            DataFacade.Delete<IFlowInformation>(f => f.SerializedFlowToken == serializedFlowToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void Scavenge()\r\n        {\r\n            Log.LogVerbose(LogTitle, \"Starting scavenger run\");\r\n\r\n            List<IFlowInformation> flowInformations = DataFacade.GetData<IFlowInformation>().ToList();\r\n\r\n            // NOTE: Low performance implementation\r\n            foreach (IFlowInformation flowInformation in flowInformations)\r\n            {\r\n                TimeSpan timeSpan = DateTime.Now - flowInformation.TimeStamp;\r\n                if (timeSpan > Timeout)\r\n                {\r\n                    FlowToken flowToken = null;\r\n                    string flowTokenStr;\r\n\r\n                    try\r\n                    {\r\n                        flowToken = FlowTokenSerializer.Deserialize(flowInformation.SerializedFlowToken);\r\n\r\n                        flowTokenStr = flowToken.ToString();\r\n                    }\r\n                    catch(Exception)\r\n                    {\r\n                        flowTokenStr = flowInformation.SerializedFlowToken ?? string.Empty;\r\n                        if(flowTokenStr.Length > 200)\r\n                        {\r\n                            flowTokenStr = flowTokenStr.Substring(0, 200);\r\n                        }\r\n                    }\r\n\r\n                    Log.LogVerbose(LogTitle, \"Scavenging flow started by username '{0}', flow = '{1}'\".FormatWith(flowInformation.Username, flowTokenStr));\r\n\r\n                    DataFacade.Delete<IFlowInformation>(flowInformation);\r\n\r\n                    if (flowToken != null)\r\n                    {\r\n                        FlowControllerFacade.CancelFlow(flowToken);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static TimeSpan Timeout\r\n        {\r\n            get\r\n            {\r\n                if (_timeout.HasValue == false)\r\n                {\r\n                    _timeout = GlobalSettingsFacade.WorkflowTimeout;\r\n                }\r\n\r\n                return _timeout.Value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/FlowControllerServicesContainer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FlowControllerServicesContainer\r\n    {\r\n        private readonly Dictionary<Type, List<object>> _services = new Dictionary<Type, List<object>>();\r\n\r\n\r\n        /// <exclude />\r\n        public FlowControllerServicesContainer()\r\n        { }\r\n\r\n\r\n        /// <exclude />\r\n        public FlowControllerServicesContainer(params IFlowControllerService[] services)\r\n        {\r\n            foreach (var service in services)\r\n            {\r\n                AddService(service);\r\n            }\r\n        }\r\n\r\n        // Creates a new service container and initialized it with the services from servicesContainerToClone.\r\n        /// <exclude />\r\n        public FlowControllerServicesContainer(FlowControllerServicesContainer servicesContainerToClone)\r\n        { \r\n           _services = new Dictionary<Type,List<object>>(servicesContainerToClone._services);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddService(IFlowControllerService flowControllerService)\r\n        {\r\n            Type type = flowControllerService.GetType();\r\n\r\n            foreach (Type interfaceType in type.GetInterfaces())\r\n            {\r\n                List<object> list = _services.GetOrAdd(interfaceType, () => new List<object>());\r\n\r\n                list.Add(flowControllerService);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void RemoveService(IFlowControllerService flowControllerService)\r\n        {\r\n            Type type = flowControllerService.GetType();\r\n\r\n            foreach (Type interfaceType in type.GetInterfaces())\r\n            {\r\n                if (!_services.TryGetValue(interfaceType, out var list)) throw new InvalidOperationException();\r\n\r\n                list.Remove(flowControllerService);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// <para>Returns a concrete service interface, if available. Sample service interfaces are:</para>\r\n        /// <para> - Composite.C1Console.Events.IManagementConsoleMessageService</para>\r\n        /// <para> - Composite.C1Console.Actions.IActionExecutionService</para>\r\n        /// <para> - Composite.C1Console.Forms.Flows.IFormFlowRenderingService</para>\r\n        /// <para> - Composite.C1Console.Actions.IElementInformationService</para>\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <returns></returns>\r\n        public T GetService<T>() where T : IFlowControllerService\r\n        {\r\n            return (T)GetService(typeof(T));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IFlowControllerService GetService(Type serviceType)\r\n        {\r\n            if (!_services.TryGetValue(serviceType, out var list))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (list.Count > 1)\r\n            {\r\n                throw new InvalidOperationException($\"More than one service of type '{serviceType}' was added\");\r\n            }\r\n\r\n            return (IFlowControllerService)list[0];\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/FlowHandle.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FlowHandle\r\n    {\r\n        private FlowToken _flowToken;\r\n\r\n        private string _serializedData = null;\r\n\r\n\r\n        /// <exclude />\r\n        public FlowHandle(FlowToken FlowToken)\r\n        {\r\n            _flowToken = FlowToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public FlowToken FlowToken\r\n        {\r\n            get { return _flowToken; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static FlowHandle Deserialize(string serializedFlowHandle)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedFlowHandle);\r\n\r\n            if ((dic.ContainsKey(\"_flowTokenType_\") == false) ||\r\n                (dic.ContainsKey(\"_flowToken_\") == false))\r\n            {\r\n                throw new ArgumentException(\"The serializedFlowHandle is not a serialized flow handle\", \"serializedFlowHandle\");\r\n            }\r\n\r\n            string flowTokenTypeString = StringConversionServices.DeserializeValueString(dic[\"_flowTokenType_\"]);\r\n            string flowTokenString = StringConversionServices.DeserializeValueString(dic[\"_flowToken_\"]);\r\n\r\n            Type flowTokenType = TypeManager.GetType(flowTokenTypeString);\r\n\r\n            MethodInfo methodInfo = flowTokenType.GetMethod(\"Deserialize\", BindingFlags.Public | BindingFlags.Static);\r\n            if (methodInfo == null || !(typeof(FlowToken).IsAssignableFrom(methodInfo.ReturnType)))\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"The flow token '{0}' is missing a public static Deserialize method taking a string as parameter and returning an '{1}'\", flowTokenType, typeof(FlowToken)));\r\n            }\r\n\r\n\r\n            FlowToken flowToken;\r\n            try\r\n            {\r\n                flowToken = (FlowToken)methodInfo.Invoke(null, new object[] { flowTokenString });\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"The flow token '{0}' is missing a public static Deserialize method taking a string as parameter and returning an '{1}'\", flowTokenType, typeof(FlowToken)), ex);\r\n            }\r\n\r\n            if (flowToken == null)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"public static Deserialize method taking a string as parameter and returning an '{0}' on the flow token '{1}' did not return an object\", flowTokenType, typeof(FlowToken)));\r\n            }\r\n\r\n            return new FlowHandle(flowToken);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            return ToString();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            if (_serializedData == null)\r\n            {\r\n                StringBuilder sb = new StringBuilder();\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_flowTokenType_\", TypeManager.SerializeType(_flowToken.GetType()));\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_flowToken_\", _flowToken.Serialize());\r\n\r\n                _serializedData = sb.ToString();\r\n            }\r\n\r\n            return _serializedData;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/FlowToken.cs",
    "content": "namespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class FlowToken\r\n    {\r\n        /// <exclude />\r\n        public virtual string Serialize() { return \"\"; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/FlowTokenSerializer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Security;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n\tinternal static class FlowTokenSerializer\r\n\t{\r\n        public static string Serialize(FlowToken flowToken)\r\n        {\r\n            return Serialize(flowToken, false);\r\n        }\r\n\r\n\r\n        public static string Serialize(FlowToken flowToken, bool includeHashValue)\r\n        {\r\n            if (flowToken == null) throw new ArgumentNullException(\"flowToken\");\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"flowTokenType\", TypeManager.SerializeType(flowToken.GetType()));\r\n\r\n            string serializedFlowToken = flowToken.Serialize();\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"flowToken\", serializedFlowToken);\r\n\r\n            if (includeHashValue)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"flowTokenHash\", HashSigner.GetSignedHash(serializedFlowToken).Serialize());\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        public static FlowToken Deserialize(string serialziedFlowToken)\r\n        {\r\n            return Deserialize(serialziedFlowToken, false);\r\n        }\r\n\r\n\r\n\r\n        public static FlowToken Deserialize(string serialziedFlowToken, bool includeHashValue)\r\n        {\r\n            if (string.IsNullOrEmpty(serialziedFlowToken)) throw new ArgumentNullException(\"serialziedFlowToken\");\r\n\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serialziedFlowToken);\r\n\r\n            if ((dic.ContainsKey(\"flowTokenType\") == false) ||\r\n                (dic.ContainsKey(\"flowToken\") == false) ||\r\n                ((includeHashValue) && (dic.ContainsKey(\"flowTokenHash\") == false)))\r\n            {\r\n                throw new ArgumentException(\"The serialziedFlowToken is not a serialized flowToken\", \"serialziedFlowToken\");\r\n            }\r\n\r\n            string flowTokenTypeString = StringConversionServices.DeserializeValueString(dic[\"flowTokenType\"]);\r\n            string flowTokenString = StringConversionServices.DeserializeValueString(dic[\"flowToken\"]);\r\n\r\n            if (includeHashValue)\r\n            {\r\n                string flowTokenHash = StringConversionServices.DeserializeValueString(dic[\"flowTokenHash\"]);\r\n\r\n                HashValue hashValue = HashValue.Deserialize(flowTokenHash);\r\n                if (HashSigner.ValidateSignedHash(flowTokenString, hashValue) == false)\r\n                {\r\n                    throw new SecurityException(\"Serialized flow token is tampered\");\r\n                }\r\n            }\r\n\r\n            Type flowType = TypeManager.GetType(flowTokenTypeString);\r\n\r\n            MethodInfo methodInfo = flowType.GetMethod(\"Deserialize\", BindingFlags.Public | BindingFlags.Static);\r\n            if (methodInfo == null || !(typeof(FlowToken).IsAssignableFrom(methodInfo.ReturnType)))\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"The flow token {0} is missing a public static Deserialize method taking a string as parameter and returning an {1}\", flowType, typeof(FlowToken)));\r\n            }\r\n\r\n\r\n            FlowToken flowToken;\r\n            try\r\n            {\r\n                flowToken = (FlowToken)methodInfo.Invoke(null, new object[] { flowTokenString });\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"The flow token {0} is missing a public static Deserialize method taking a string as parameter and returning an {1}\", flowType, typeof(FlowToken)), ex);\r\n            }\r\n\r\n            if (flowToken == null)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"public static Deserialize method taking a string as parameter and returning an {1} on the flow token {0} did not return an object\", flowType, typeof(FlowToken)));\r\n            }\r\n\r\n            return flowToken;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/FlowUiDefinitionBase.cs",
    "content": "\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    internal abstract class FlowUiDefinitionBase : IFlowUiDefinition\r\n    {\r\n        public abstract IFlowUiContainerType UiContainerType { get; protected set;  }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/Foundation/ActionExecutorCache.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Actions.Foundation\r\n{\r\n    internal static class ActionExecutorCache\r\n    {\r\n        private static Dictionary<Type, IActionExecutor> _actionExecutorCache = new Dictionary<Type, IActionExecutor>();\r\n\r\n        private static object _lock = new object();\r\n\r\n\r\n\r\n        static ActionExecutorCache()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlush);\r\n        }\r\n\r\n\r\n\r\n        public static IActionExecutor GetActionExecutor(ActionToken actionToken)\r\n        {\r\n            if (actionToken == null) throw new ArgumentNullException(\"actionToken\");\r\n\r\n\r\n            IActionExecutor actionExecutor;\r\n\r\n\r\n            if (_actionExecutorCache.TryGetValue(actionToken.GetType(), out actionExecutor) == false)\r\n            {\r\n                object[] attributes = actionToken.GetType().GetCustomAttributes(typeof(ActionExecutorAttribute), true);\r\n\r\n                if (attributes.Length == 0) throw new InvalidOperationException(string.Format(\"Missing {0} attribute on the flow token {1}\", typeof(ActionExecutorAttribute), actionToken.GetType()));\r\n\r\n                ActionExecutorAttribute attribute = (ActionExecutorAttribute)attributes[0];\r\n\r\n                if (attribute.ActionExecutorType == null) throw new InvalidOperationException(string.Format(\"Action executor type can not be null on the action token {0}\", actionToken.GetType()));\r\n                if (typeof(IActionExecutor).IsAssignableFrom(attribute.ActionExecutorType) == false) throw new InvalidOperationException(string.Format(\"Action executor {0} should implement the interface {1}\", attribute.ActionExecutorType, typeof(IActionExecutor)));\r\n\r\n                actionExecutor = (IActionExecutor)Activator.CreateInstance(attribute.ActionExecutorType);\r\n\r\n                _actionExecutorCache.Add(actionToken.GetType(), actionExecutor);\r\n            }\r\n\r\n\r\n            return actionExecutor;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _actionExecutorCache = new Dictionary<Type, IActionExecutor>();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlush(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/Foundation/FlowExecutorCache.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Actions.Foundation\r\n{\r\n    internal static class FlowControllerCache\r\n    {\r\n        private static readonly ConcurrentDictionary<Type, IFlowController> _flowControllerCache = new ConcurrentDictionary<Type, IFlowController>();\r\n\r\n\r\n        static FlowControllerCache()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n        public static IFlowController GetFlowController(FlowToken flowToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            Verify.ArgumentNotNull(flowToken, \"flowToken\");\r\n\r\n            Type flowTokenType = flowToken.GetType();\r\n\r\n            return _flowControllerCache.GetOrAdd(flowTokenType, type =>\r\n            {\r\n                object[] attributes = type.GetCustomAttributes(typeof(FlowControllerAttribute), true);\r\n                Verify.That(attributes.Length > 0, \"Missing '{0}' attribute on the flow token '{1}'\", typeof(FlowControllerAttribute), type);\r\n\r\n                FlowControllerAttribute attribute = (FlowControllerAttribute) attributes[0];\r\n                Verify.IsNotNull(attribute.FlowControllerType, \"Flow controller type can not be null on the action token '{0}'\", type);\r\n                Verify.That(typeof(IFlowController).IsAssignableFrom(attribute.FlowControllerType), \"Flow controller '{0}' should implement the interface '{1}'\", attribute.FlowControllerType, typeof(IFlowController));\r\n\r\n                var flowController = (IFlowController) Activator.CreateInstance(attribute.FlowControllerType);\r\n                flowController.ServicesContainer = flowControllerServicesContainer;\r\n\r\n                return flowController;\r\n            });\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _flowControllerCache.Clear();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/IActionExecutionService.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.C1Console.Tasks;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IActionExecutionService : IFlowControllerService\r\n    {\r\n        /// <exclude />\r\n        void Execute(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/IActionExecutor.cs",
    "content": "using Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IActionExecutor\r\n    {\r\n        /// <exclude />\r\n        FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/IActionExecutorSerializedParameters.cs",
    "content": "﻿using Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n\tinternal interface IActionExecutorSerializedParameters : IActionExecutor\r\n\t{\r\n        FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/IElementInformationService.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    internal interface IElementInformationService : IFlowControllerService\r\n\t{\r\n        string ProviderName { get; }\r\n        Dictionary<string, string> Piggyback { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/IFlowController.cs",
    "content": "namespace Composite.C1Console.Actions\r\n{\r\n    internal interface IFlowController\r\n    {\r\n        /// <summary>\r\n        /// Set by the the system (mediator)\r\n        /// </summary>\r\n        FlowControllerServicesContainer ServicesContainer { set; }\r\n\r\n        IFlowUiDefinition GetCurrentUiDefinition(FlowToken flowToken);\r\n        void CancelFlow(FlowToken flowToken);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/IFlowControllerService.cs",
    "content": "using Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFlowControllerService\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/IFlowUiContainerType.cs",
    "content": "﻿\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFlowUiContainerType\r\n    {\r\n        /// <exclude />\r\n        string ContainerName { get; }\r\n\r\n        /// <exclude />\r\n        ActionResultResponseType ActionResultResponseType { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/IFlowUiDefinition.cs",
    "content": "﻿\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFlowUiDefinition\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/InlineScriptActionFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.WebClient.FlowMediators;\r\nusing Composite.Core.Serialization;\r\nusing Composite.C1Console.Elements;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class InlineScriptActionFacade\r\n    {\r\n        /// <exclude />\r\n        public static string GetInlineElementActionScriptCode(EntityToken entityToken, ActionToken actionToken)\r\n        {\r\n            return GetInlineElementActionScriptCode(entityToken, actionToken, new Dictionary<string, string>());\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetInlineElementActionScriptCode(EntityToken entityToken, ActionToken actionToken, Dictionary<string, string> piggyBag)\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"EntityToken\", EntityTokenSerializer.Serialize(entityToken, false));\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"ActionToken\", ActionTokenSerializer.Serialize(actionToken, true));\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"PiggyBag\", PiggybagSerializer.Serialize(piggyBag));\r\n\r\n            string scriptAction = string.Format(@\"SystemAction.invokeInlineAction(\"\"{0}\"\");\", Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString())));\r\n\r\n            return scriptAction;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void ExecuteElementScriptAction(string serializedScriptAction, string consoleId)\r\n        {\r\n            string scriptAction = Encoding.UTF8.GetString(Convert.FromBase64String(serializedScriptAction));\r\n\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(scriptAction);\r\n\r\n            if ((dic[\"EntityToken\"] == null) || (dic[\"ActionToken\"] == null) || (dic[\"PiggyBag\"] == null)) throw new ArgumentException(\"Wrong format\", \"serializedScriptAction\");\r\n\r\n            string serializedEntityToken = StringConversionServices.DeserializeValueString(dic[\"EntityToken\"]);\r\n            string serializedActionToken = StringConversionServices.DeserializeValueString(dic[\"ActionToken\"]);\r\n            string serializedPiggyBag = StringConversionServices.DeserializeValueString(dic[\"PiggyBag\"]);\r\n\r\n            TreeServicesFacade.ExecuteElementAction(\r\n                \"DUMMY\",\r\n                serializedEntityToken,\r\n                serializedPiggyBag,\r\n                serializedActionToken,\r\n                consoleId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/MessageBoxActionToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Serialization;\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n\r\n    internal sealed class MessageBoxActionTokenActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            MessageBoxActionToken messageBoxActionToken = (MessageBoxActionToken)actionToken;\r\n\r\n            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            managementConsoleMessageService.ShowMessage(messageBoxActionToken.DialogType, messageBoxActionToken.Title, messageBoxActionToken.Message);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// To add a message box action\r\n    /// </summary>\r\n    [ActionExecutor(typeof(MessageBoxActionTokenActionExecutor))]\r\n    public sealed class MessageBoxActionToken : ActionToken\r\n    {\r\n        private readonly List<PermissionType> _permissionTypes;\r\n\r\n        /// <summary>\r\n        /// To add a message box action\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"message\"></param>\r\n        /// <param name=\"dialogType\"></param>\r\n        public MessageBoxActionToken(string title, string message, DialogType dialogType)\r\n            :this(title, message, dialogType, new List<PermissionType>() { PermissionType.Add, PermissionType.Administrate, PermissionType.Approve, PermissionType.Delete, PermissionType.Edit, PermissionType.Publish, PermissionType.Read })\r\n        {            \r\n        }\r\n\r\n        /// <exclude />\r\n        public MessageBoxActionToken(string title, string message, DialogType dialogType, List<PermissionType> permissionTypes)\r\n        {\r\n            _permissionTypes = permissionTypes;\r\n            this.Title = title;\r\n            this.Message = message;\r\n            this.DialogType = dialogType;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Title { get; private set; }\r\n        /// <exclude />\r\n        public string Message { get; private set; }\r\n        /// <exclude />\r\n        public DialogType DialogType { get; private set; }\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"Title\", this.Title);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"Message\", this.Message);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"DialogType\", this.DialogType.ToString());\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"PermissionTypes\", _permissionTypes.SerializePermissionTypes());\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n            return new MessageBoxActionToken\r\n            (\r\n                StringConversionServices.DeserializeValueString(dic[\"Title\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"Message\"]),\r\n                (DialogType)Enum.Parse(typeof(DialogType), StringConversionServices.DeserializeValueString(dic[\"DialogType\"])),\r\n                StringConversionServices.DeserializeValueString(dic[\"PermissionTypes\"]).DesrializePermissionTypes().ToList()\r\n            );\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/NullFlow.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    [FlowController(typeof(NullFlowController))]\r\n    internal class NullFlowToken : FlowToken\r\n    {\r\n        public static FlowToken Deserialize(string serialized)\r\n        {\r\n            return new NullFlowToken();\r\n        }\r\n    }\r\n\r\n    internal class NullFlowController : IFlowController\r\n    {\r\n        public FlowControllerServicesContainer ServicesContainer\r\n        {\r\n            set { }\r\n        }\r\n\r\n        public IFlowUiDefinition GetCurrentUiDefinition(FlowToken flowToken)\r\n        {\r\n            return new NullFlowUiDefinition();\r\n        }\r\n\r\n\r\n        public void CancelFlow(FlowToken flowToken)\r\n        {            \r\n        }\r\n    }\r\n\r\n    internal class NullFlowUiDefinition : FlowUiDefinitionBase\r\n    {\r\n        public NullFlowUiDefinition() \r\n        { \r\n            this.UiContainerType = StandardUiContainerTypes.Null; \r\n        }\r\n\r\n        public override IFlowUiContainerType UiContainerType { get; protected set;  }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/ParentTreeRefresher.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ParentTreeRefresher\r\n\t{\r\n        private bool _postRefreshMessagesCalled;\r\n        private readonly FlowControllerServicesContainer _flowControllerServicesContainer;\r\n\r\n\r\n        /// <exclude />\r\n        public ParentTreeRefresher(FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            Verify.ArgumentNotNull(flowControllerServicesContainer, \"flowControllerServicesContainer\");\r\n\r\n            _flowControllerServicesContainer = flowControllerServicesContainer;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use PostRefreshMessages instead\")]\r\n        public void PostRefreshMesseges(EntityToken childEntityToken)\r\n        {\r\n            PostRefreshMessages(childEntityToken);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use PostRefreshMessages instead\")]\r\n        public void PostRefreshMesseges(EntityToken childEntityToken, int parentLevel)\r\n        {\r\n            PostRefreshMessages(childEntityToken, parentLevel);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Posts refresh messages to the ancestors of the specified entityToken\r\n        /// </summary>\r\n        /// <param name=\"childEntityToken\"></param>\r\n        /// <param name=\"parentLevel\">1 means the first parent, 2 means the second, etc.</param>\r\n        public void PostRefreshMessages(EntityToken childEntityToken, int parentLevel = 1)\r\n        {\r\n            Verify.ArgumentNotNull(childEntityToken, \"childEntityToken\");\r\n\r\n            if (_postRefreshMessagesCalled)\r\n            {\r\n                throw new InvalidOperationException(\"Only one PostRefreshMessages call is allowed\");\r\n            }\r\n\r\n            _postRefreshMessagesCalled = true;\r\n\r\n            RelationshipGraph relationshipGraph = new RelationshipGraph(childEntityToken, RelationshipGraphSearchOption.Both);\r\n\r\n            var levels = relationshipGraph.Levels.Evaluate();\r\n\r\n            if (levels.Count <= parentLevel)\r\n            {\r\n                return;\r\n            }\r\n\r\n            RelationshipGraphLevel relationshipGraphLevel = levels.ElementAt(parentLevel);\r\n\r\n            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            foreach (EntityToken entityToken in relationshipGraphLevel.AllEntities)\r\n            {\r\n                messageService.RefreshTreeSection(entityToken);\r\n                Log.LogVerbose(this.GetType().Name, \"Refreshing EntityToken: Type = {0}, Source = {1}, Id = {2}, EntityTokenType = {3}\", entityToken.Type, entityToken.Source, entityToken.Id, entityToken.GetType());\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/SpecificTreeRefresher.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class SpecificTreeRefresher\r\n    {\r\n        private bool _postRefreshMessagesCalled = false;\r\n        private readonly FlowControllerServicesContainer _flowControllerServicesContainer;\r\n\r\n\r\n        /// <exclude />\r\n        public SpecificTreeRefresher(FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            Verify.ArgumentNotNull(flowControllerServicesContainer, \"flowControllerServicesContainer\");\r\n\r\n            _flowControllerServicesContainer = flowControllerServicesContainer;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use PostRefreshMessages instead\")]\r\n        public void PostRefreshMesseges(EntityToken specificEntityToken)\r\n        {\r\n            PostRefreshMessages(specificEntityToken);\r\n        }\r\n\r\n        /// <exclude />\r\n\r\n        public void PostRefreshMessages(EntityToken specificEntityToken)\r\n        {\r\n            Verify.ArgumentNotNull(specificEntityToken, \"specificEntityToken\");\r\n\r\n            if (_postRefreshMessagesCalled)\r\n            {\r\n                throw new InvalidOperationException(\"Only one PostRefreshMessages call is allowed\");\r\n            }\r\n\r\n            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            messageService.RefreshTreeSection(specificEntityToken);\r\n\r\n            Log.LogVerbose(GetType().Name, \"Refreshing EntityToken: Type = {0}, Source = {1}, Id = {2}, EntityTokenType = {3}\", specificEntityToken.Type, specificEntityToken.Source, specificEntityToken.Id, specificEntityToken.GetType());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/StandardUiContainerTypes.cs",
    "content": "﻿using Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class StandardUiContainerTypes\r\n    {\r\n        /// <exclude />\r\n        public static IFlowUiContainerType Document { get { return _document; } }\r\n\r\n        /// <exclude />\r\n        public static IFlowUiContainerType EmptyDocument { get { return _emptyDocument; } }\r\n\r\n        /// <exclude />\r\n        public static IFlowUiContainerType Wizard { get { return _wizard; } }\r\n\r\n        /// <exclude />\r\n        public static IFlowUiContainerType DataDialog { get { return _dataDialog; } }\r\n\r\n        /// <exclude />\r\n        public static IFlowUiContainerType ConfirmDialog { get { return _confirmDialog; } }\r\n\r\n        /// <exclude />\r\n        public static IFlowUiContainerType WarningDialog { get { return _warningDialog; } }\r\n\r\n        /// <exclude />\r\n        public static IFlowUiContainerType Null { get { return _null; } }\r\n\r\n\r\n        private static DocumentUiContainer _document = new DocumentUiContainer();\r\n        private static EmptyDocumentUiContainer _emptyDocument = new EmptyDocumentUiContainer();\r\n        private static WizardUiContainer _wizard = new WizardUiContainer();\r\n        private static DataDialogUiContainer _dataDialog = new DataDialogUiContainer();\r\n        private static ConfirmDialogUiContainer _confirmDialog = new ConfirmDialogUiContainer();\r\n        private static WarningDialogUiContainer _warningDialog = new WarningDialogUiContainer();\r\n        private static NullUiContainer _null = new NullUiContainer();\r\n\r\n\r\n        [SerializerHandler(typeof(StandardUiContainerTypesSerializerHandler))]\r\n        private class DocumentUiContainer : IFlowUiContainerType\r\n        {\r\n            internal DocumentUiContainer() { }\r\n            string IFlowUiContainerType.ContainerName { get { return \"Document\"; } }\r\n            ActionResultResponseType IFlowUiContainerType.ActionResultResponseType { get { return ActionResultResponseType.OpenDocument; } }\r\n        }\r\n\r\n\r\n        [SerializerHandler(typeof(StandardUiContainerTypesSerializerHandler))]\r\n        private class EmptyDocumentUiContainer : IFlowUiContainerType\r\n        {\r\n            internal EmptyDocumentUiContainer() { }\r\n            string IFlowUiContainerType.ContainerName { get { return \"EmptyDocument\"; } }\r\n            ActionResultResponseType IFlowUiContainerType.ActionResultResponseType { get { return ActionResultResponseType.OpenDocument; } }\r\n        }\r\n\r\n\r\n        [SerializerHandler(typeof(StandardUiContainerTypesSerializerHandler))]\r\n        private class WizardUiContainer : IFlowUiContainerType\r\n        {\r\n            internal WizardUiContainer() { }\r\n            string IFlowUiContainerType.ContainerName { get { return \"Wizard\"; } }\r\n            ActionResultResponseType IFlowUiContainerType.ActionResultResponseType { get { return ActionResultResponseType.OpenModalDialog; } }\r\n        }\r\n\r\n\r\n        [SerializerHandler(typeof(StandardUiContainerTypesSerializerHandler))]\r\n        private class DataDialogUiContainer : IFlowUiContainerType\r\n        {\r\n            internal DataDialogUiContainer() { }\r\n            string IFlowUiContainerType.ContainerName { get { return \"DataDialog\"; } }\r\n            ActionResultResponseType IFlowUiContainerType.ActionResultResponseType { get { return ActionResultResponseType.OpenModalDialog; } }\r\n        }\r\n\r\n\r\n        [SerializerHandler(typeof(StandardUiContainerTypesSerializerHandler))]\r\n        private class ConfirmDialogUiContainer : IFlowUiContainerType\r\n        {\r\n            internal ConfirmDialogUiContainer() { }\r\n            string IFlowUiContainerType.ContainerName { get { return \"ConfirmDialog\"; } }\r\n            ActionResultResponseType IFlowUiContainerType.ActionResultResponseType { get { return ActionResultResponseType.OpenModalDialog; } }\r\n        }\r\n\r\n\r\n        [SerializerHandler(typeof(StandardUiContainerTypesSerializerHandler))]\r\n        private class WarningDialogUiContainer : IFlowUiContainerType\r\n        {\r\n            internal WarningDialogUiContainer() { }\r\n            string IFlowUiContainerType.ContainerName { get { return \"WarningDialog\"; } }\r\n            ActionResultResponseType IFlowUiContainerType.ActionResultResponseType { get { return ActionResultResponseType.OpenModalDialog; } }\r\n        }\r\n\r\n\r\n        [SerializerHandler(typeof(StandardUiContainerTypesSerializerHandler))]\r\n        private class NullUiContainer : IFlowUiContainerType\r\n        {\r\n            internal NullUiContainer() { }\r\n            string IFlowUiContainerType.ContainerName { get { return \"Null\"; } }\r\n            ActionResultResponseType IFlowUiContainerType.ActionResultResponseType { get { return ActionResultResponseType.None; } }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/StandardUiContainerTypesSerializerHandler.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    internal sealed class StandardUiContainerTypesSerializerHandler : ISerializerHandler\r\n    {\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            IFlowUiContainerType flowUiContainerType = (IFlowUiContainerType)objectToSerialize;\r\n\r\n            if ((flowUiContainerType.ContainerName != \"Document\") &&\r\n                (flowUiContainerType.ContainerName != \"EmptyDocument\") &&\r\n                (flowUiContainerType.ContainerName != \"Wizard\") &&\r\n                (flowUiContainerType.ContainerName != \"DataDialog\") &&\r\n                (flowUiContainerType.ContainerName != \"ConfirmDialog\") &&\r\n                (flowUiContainerType.ContainerName != \"WarningDialog\") &&                \r\n                (flowUiContainerType.ContainerName != \"Null\"))\r\n            {\r\n                throw new NotSupportedException();\r\n            }\r\n\r\n\r\n            return flowUiContainerType.ContainerName;\r\n        }\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            switch (serializedObject)\r\n            {\r\n                case \"Document\": return StandardUiContainerTypes.Document;\r\n                case \"EmptyDocument\": return StandardUiContainerTypes.EmptyDocument;\r\n                case \"Wizard\": return StandardUiContainerTypes.Wizard;\r\n                case \"DataDialog\": return StandardUiContainerTypes.DataDialog;\r\n                case \"ConfirmDialog\": return StandardUiContainerTypes.ConfirmDialog;\r\n                case \"WarningDialog\": return StandardUiContainerTypes.WarningDialog;\r\n                case \"Null\": return StandardUiContainerTypes.Null;\r\n                default: throw new NotSupportedException();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/UpdateTreeRefresher.cs",
    "content": "using System;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class UpdateTreeRefresher\r\n    {\r\n        private readonly FlowControllerServicesContainer _flowControllerServicesContainer;\r\n        private readonly RelationshipGraph _beforeGraph;\r\n        private RelationshipGraph _afterGraph;\r\n        private bool _postRefreshMessagesCalled;\r\n\r\n\r\n        /// <exclude />\r\n        public UpdateTreeRefresher(EntityToken beforeUpdateEntityToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            Verify.ArgumentNotNull(beforeUpdateEntityToken, \"beforeUpdateEntityToken\");\r\n            Verify.ArgumentNotNull(flowControllerServicesContainer, \"flowControllerServicesContainer\");\r\n\r\n            _beforeGraph = new RelationshipGraph(beforeUpdateEntityToken, RelationshipGraphSearchOption.Both, false, false);\r\n            _flowControllerServicesContainer = flowControllerServicesContainer;\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use PostRefreshMessages instead\")]\r\n        public void PostRefreshMesseges(EntityToken afterUpdateEntityToken)\r\n        {\r\n            PostRefreshMessages(afterUpdateEntityToken);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void PostRefreshMessages(EntityToken afterUpdateEntityToken)\r\n        {\r\n            if (_postRefreshMessagesCalled)\r\n            {\r\n                throw new InvalidOperationException(\"Only one PostRefreshMessages call is allowed\");\r\n            }\r\n\r\n            _postRefreshMessagesCalled = true;\r\n\r\n            _afterGraph = new RelationshipGraph(afterUpdateEntityToken, RelationshipGraphSearchOption.Both, false, false);\r\n\r\n            IManagementConsoleMessageService messageService = _flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            foreach (EntityToken entityToken in RefreshBeforeAfterEntityTokenFinder.FindEntityTokens(_beforeGraph, _afterGraph))\r\n            {\r\n                messageService.RefreshTreeSection(entityToken);\r\n                Log.LogVerbose(this.GetType().Name, \"Refreshing EntityToken: Type = {0}, Source = {1}, Id = {2}, EntityTokenType = {3}\", entityToken.Type, entityToken.Source, entityToken.Id, entityToken.GetType());\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/UrlActionToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Events;\r\nusing System.Web;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\n\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    /// <summary>\r\n    /// To add a custom URL action\r\n    /// </summary>\r\n    [ActionExecutor(typeof(UrlActionTokenActionExecutor))]\r\n    public sealed class UrlActionToken : ActionToken\r\n    {\r\n        /// <summary>\r\n        /// To add a custom URL action\r\n        /// </summary>\r\n        /// <param name=\"label\"></param>\r\n        /// <param name=\"url\"></param>\r\n        /// <param name=\"permissionTypes\"></param>\r\n        public UrlActionToken(string label, string url, IEnumerable<PermissionType> permissionTypes)\r\n            : this(label, DefaultIcon, url, permissionTypes)\r\n        {\r\n        }\r\n\r\n        /// <summary>\r\n        /// To add a custom URL action\r\n        /// </summary>\r\n        /// <param name=\"label\"></param>\r\n        /// <param name=\"url\"></param>\r\n        /// <param name=\"icon\"></param>\r\n        /// <param name=\"permissionTypes\"></param>\r\n        public UrlActionToken(string label, ResourceHandle icon, string url, IEnumerable<PermissionType> permissionTypes)\r\n        {\r\n            Label = label;\r\n            Url = url;\r\n            PermissionTypes = permissionTypes;\r\n            Icon = icon;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Label { get; }\r\n\r\n        /// <exclude />\r\n        public string Url { get; }\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PermissionType> PermissionTypes { get; }\r\n\r\n        /// <exclude />\r\n        public ResourceHandle Icon { get; }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return $\"{Label}·{Url}·{PermissionTypes.SerializePermissionTypes()}·{Icon.ResourceNamespace}·{Icon.ResourceName}\";\r\n        }\r\n\r\n        private static ResourceHandle DefaultIcon => new ResourceHandle(BuildInIconProviderName.ProviderName, \"page\");\r\n\r\n\r\n        /// <exclude />\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            string[] s = serializedData.Split('·');\r\n\r\n            var icon = s.Length == 5\r\n                ? new ResourceHandle(s[3], s[4])\r\n                : DefaultIcon;\r\n\r\n            return new UrlActionToken(s[0], icon, s[1], s[2].DesrializePermissionTypes());\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class UrlActionTokenActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            UrlActionToken urlActionToken = (UrlActionToken)actionToken;\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n\r\n            string url = urlActionToken.Url;\r\n\r\n            string extendedUrl = $\"{url}{(url.Contains(\"?\") ? \"&\" : \"?\")}EntityToken={HttpUtility.UrlEncode(serializedEntityToken)}\";\r\n\r\n            if (extendedUrl.IndexOf(\"consoleId\", StringComparison.OrdinalIgnoreCase) == -1)\r\n            {\r\n                extendedUrl = $\"{extendedUrl}&consoleId={currentConsoleId}\";\r\n            }\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(\r\n                new OpenViewMessageQueueItem\r\n                {\r\n                    Url = extendedUrl,\r\n                    ViewId = Guid.NewGuid().ToString(),\r\n                    ViewType = ViewType.Main,\r\n                    Label = urlActionToken.Label,\r\n                    IconResourceHandle = urlActionToken.Icon\r\n                }, currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/VisualFlowUiDefinitionBase.cs",
    "content": "﻿\r\n\r\nnamespace Composite.C1Console.Actions\r\n{\r\n    internal abstract class VisualFlowUiDefinitionBase : FlowUiDefinitionBase\r\n    {\r\n        public virtual string ContainerLabel { get; protected set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/Workflow/EntityTokenLockedEntityToken.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.C1Console.Actions.Workflows\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    // This is a dummy token, no elements using this token exists!\r\n    public sealed class EntityTokenLockedEntityToken : EntityToken\r\n\t{\r\n        private string _lockedByUsername;\r\n        private string _serializedLockedActionToken;\r\n        private string _serializedLockedEntityToken;\r\n\r\n        private ActionToken _lockedActionToken = null;\r\n        private EntityToken _lockedEntityToken = null;\r\n\r\n\r\n        /// <exclude />\r\n        public EntityTokenLockedEntityToken(string lockedByUsername, string serializedLockedActionToken, string serializedLockedEntityToken)\r\n        {\r\n            _lockedByUsername = lockedByUsername;\r\n            _serializedLockedActionToken = serializedLockedActionToken;\r\n            _serializedLockedEntityToken = serializedLockedEntityToken;            \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public string LockedByUsername\r\n        {\r\n            get { return _lockedByUsername; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public ActionToken LockedActionToken\r\n        {\r\n            get\r\n            {\r\n                if (_lockedActionToken == null)\r\n                {\r\n                    _lockedActionToken = ActionTokenSerializer.Deserialize(_serializedLockedActionToken);\r\n                }\r\n\r\n                return _lockedActionToken;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public EntityToken LockedEntityToken\r\n        {\r\n            get\r\n            {\r\n                if (_lockedEntityToken == null)\r\n                {\r\n                    _lockedEntityToken = EntityTokenSerializer.Deserialize(_serializedLockedEntityToken);\r\n                }\r\n\r\n                return _lockedEntityToken;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return _lockedByUsername; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return _serializedLockedActionToken; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return _serializedLockedEntityToken; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new EntityTokenLockedEntityToken(type, source, id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Actions/Workflow/SecurityViolationWorkflowEntityToken.cs",
    "content": "﻿using Composite.C1Console.Security;\r\n\r\nnamespace Composite.C1Console.Actions.Workflows\r\n{\r\n    internal sealed class SecurityViolationWorkflowEntityToken : EntityToken\r\n\t{\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return \"SecurityViolationWorkflowEntityToken\"; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new SecurityViolationWorkflowEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Commands/ConsoleCommandFacade.cs",
    "content": "﻿using Composite.C1Console.Commands.Foundation.PluginFacades;\r\n\r\nnamespace Composite.C1Console.Commands\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ConsoleCommandFacade\r\n    {\r\n\r\n        /// <summary>\r\n        /// Handles a console command.\r\n        /// </summary>\r\n        /// <param name=\"consoleId\">The console Id.</param>\r\n        /// <param name=\"commandName\">The command name.</param>\r\n        /// <param name=\"commandPayload\">The command payload.</param>\r\n        public static void HandleConsoleCommand(string consoleId, string commandName, string commandPayload)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(consoleId, \"consoleId\");\r\n            Verify.ArgumentNotNullOrEmpty(commandName, \"commandName\");\r\n\r\n            if (!ConsoleCommandHandlerPluginFacade.HasConfiguration())\r\n            {\r\n                return;\r\n            }\r\n\r\n            var handler = ConsoleCommandHandlerPluginFacade.GetConsoleCommandHandler(commandName);\r\n            if (handler == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            handler.HandleConsoleCommand(consoleId, commandPayload);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Commands/Foundation/PluginFacades/ConsoleCommandHandlerPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing Composite.C1Console.Commands.Plugins.ConsoleCommandHandler.Runtime;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.C1Console.Commands.Foundation.PluginFacades\r\n{\r\n    class ConsoleCommandHandlerPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitializeResources);\r\n\r\n\r\n        static ConsoleCommandHandlerPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n        internal static IConsoleCommandHandler GetConsoleCommandHandler(string pluginName)\r\n        {\r\n            IConsoleCommandHandler plugin;\r\n\r\n            var resources = _resourceLocker.Resources;\r\n\r\n            if (!resources.ConsoleCommandHandlers.TryGetValue(pluginName, out plugin))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return plugin;\r\n        }\r\n\r\n        private static ConsoleCommandHandlerSettings GetSettings()\r\n        {\r\n            var configuration = ConfigurationServices.ConfigurationSource;\r\n\r\n            if (configuration == null) return null;\r\n\r\n            return configuration.GetSection(ConsoleCommandHandlerSettings.SectionName) as ConsoleCommandHandlerSettings;\r\n        }\r\n\r\n\r\n        public static bool HasConfiguration()\r\n        {\r\n            return GetSettings() != null;\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", ConsoleCommandHandlerSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            ConsoleCommandHandlerFactory Factory { get; set; }\r\n            public IReadOnlyDictionary<string, IConsoleCommandHandler> ConsoleCommandHandlers { get; private set; }\r\n\r\n            public static void DoInitializeResources(Resources resources)\r\n            {\r\n                var settings = GetSettings();\r\n                if (settings == null) return;\r\n\r\n                try\r\n                {\r\n                    var factory = resources.Factory = new ConsoleCommandHandlerFactory();\r\n\r\n                    resources.ConsoleCommandHandlers = settings.ConsoleCommandHandlers.ToDictionary(data => data.Name, data => factory.Create(data.Name));\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    if (!(ex is ArgumentException) && !(ex is ConfigurationErrorsException)) throw;\r\n\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Commands/IConsoleCommandHandler.cs",
    "content": "﻿using Composite.C1Console.Commands.Plugins.ConsoleCommandHandler.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.C1Console.Commands\r\n{\r\n    /// <summary>\r\n    /// Handles hash based deep links to C1 CMS console (/Composite/top.aspx#&lt;command name&gt;;&lt;command payload&gt; )\r\n    /// </summary>\r\n    [CustomFactory(typeof(ConsoleCommandHandlerCustomFactory))]\r\n    public interface IConsoleCommandHandler\r\n    {\r\n        /// <summary>\r\n        /// Executes certain actions on console load\r\n        /// </summary>\r\n        /// <param name=\"consoleId\">The console id.</param>\r\n        /// <param name=\"commandPayload\">The command payplod.</param>\r\n        void HandleConsoleCommand(string consoleId, string commandPayload);\r\n    } \r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Commands/Plugins/ConsoleCommandHandler/ConsoleCommandHandlerData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.C1Console.Commands.Plugins.ConsoleCommandHandler\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ConfigurationElementType(typeof(NonConfigurableConsoleCommandHandler))]\r\n    public class ConsoleCommandHandlerData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Commands/Plugins/ConsoleCommandHandler/NonConfigurableConsoleCommandHandler.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nnamespace Composite.C1Console.Commands.Plugins.ConsoleCommandHandler\r\n{\r\n    [Assembler(typeof(NonConfigurableConsoleCommandHandlerAssembler))]\r\n    internal sealed class NonConfigurableConsoleCommandHandler : ConsoleCommandHandlerData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableConsoleCommandHandlerAssembler : IAssembler<IConsoleCommandHandler, ConsoleCommandHandlerData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IConsoleCommandHandler Assemble(IBuilderContext context, ConsoleCommandHandlerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IConsoleCommandHandler)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Commands/Plugins/ConsoleCommandHandler/Runtime/ConsoleCommandHandlerCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.C1Console.Commands.Plugins.ConsoleCommandHandler.Runtime\r\n{\r\n    internal class ConsoleCommandHandlerCustomFactory : AssemblerBasedCustomFactory<IConsoleCommandHandler, ConsoleCommandHandlerData>\r\n    {\r\n        protected override ConsoleCommandHandlerData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            const string sectionName = ConsoleCommandHandlerSettings.SectionName;\r\n            var settings = (ConsoleCommandHandlerSettings)configurationSource.GetSection(sectionName);\r\n\r\n            if (settings == null)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", sectionName));\r\n            }\r\n\r\n            return settings.ConsoleCommandHandlers.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Commands/Plugins/ConsoleCommandHandler/Runtime/ConsoleCommandHandlerFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.C1Console.Commands.Plugins.ConsoleCommandHandler.Runtime\r\n{\r\n    internal sealed class ConsoleCommandHandlerFactory : NameTypeFactoryBase<IConsoleCommandHandler>\r\n    {\r\n        public ConsoleCommandHandlerFactory(): base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Commands/Plugins/ConsoleCommandHandler/Runtime/ConsoleCommandHandlerSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.C1Console.Commands.Plugins.ConsoleCommandHandler.Runtime\r\n{\r\n    internal class ConsoleCommandHandlerSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Commands.Plugins.ConsoleCommandHandlerConfiguration\";\r\n\r\n        private const string _elem_ConsoleCommandHandlers = \"ConsoleCommandHandlers\";\r\n        [ConfigurationProperty(_elem_ConsoleCommandHandlers)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<ConsoleCommandHandlerData> ConsoleCommandHandlers\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<ConsoleCommandHandlerData>)base[_elem_ConsoleCommandHandlers];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Drawing/FunctionPresentation.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Drawing;\r\nusing System.Drawing.Drawing2D;\r\nusing System.Drawing.Imaging;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.C1Console.Drawing\r\n{\r\n    internal static class FunctionPresentation\r\n    {\r\n        public static void GenerateFunctionBoxWithPreview(\r\n            HttpContext context, \r\n            string functionTitle, \r\n            Bitmap previewImage,\r\n            bool showEditButton, \r\n            Stream outputStream)\r\n        {\r\n            using (var header = new FunctionHeader(functionTitle, false, showEditButton))\r\n            {\r\n                var headerSize = header.HeaderSize;\r\n\r\n                Size totalSize = new Size(Math.Max(header.HeaderSize.Width, previewImage.Width), headerSize.Height + previewImage.Height);\r\n\r\n                using (var bitmap = new Bitmap(totalSize.Width, totalSize.Height))\r\n                using (var graphics = Graphics.FromImage(bitmap))\r\n                {\r\n                    header.DrawHeader(bitmap, graphics, totalSize.Width);\r\n\r\n                    Point previewImageOffset = new Point(\r\n                        (Math.Max(totalSize.Width - 10, previewImage.Width) - previewImage.Width) / 2, headerSize.Height);\r\n\r\n                    // Preview image\r\n                    graphics.DrawImage(previewImage, previewImageOffset);\r\n\r\n                    // Image outline\r\n                    using (var brush = new HatchBrush(HatchStyle.LargeCheckerBoard, Color.FromArgb(190, 190, 190), Color.Transparent))\r\n                    using (var pen = new Pen(brush))\r\n                    {\r\n                        graphics.DrawRectangle(pen, new Rectangle(previewImageOffset,\r\n                            new Size(previewImage.Width - 1, previewImage.Height - 1)));\r\n                    }\r\n\r\n                    context.Response.ContentType = \"image/png\";\r\n                    context.Response.Cache.SetExpires(DateTime.Now.AddDays(10));\r\n\r\n                    string tempFileName = Path.GetTempFileName();\r\n\r\n                    try\r\n                    {\r\n                        // Saving to a temporary file, as Image.Save() sometimes on a not seekable stream throws\r\n                        // an \"A generic error occurred in GDI+.\" exception\r\n                        bitmap.Save(tempFileName, ImageFormat.Png);\r\n\r\n                        context.Response.WriteFile(tempFileName);\r\n                        context.Response.Flush();\r\n                    }\r\n                    finally\r\n                    {\r\n                        C1File.Delete(tempFileName);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        public static void GenerateFunctionBoxWithText(\r\n            HttpContext context, \r\n            string functionTitle, \r\n            bool isWarning, \r\n            bool showEditButton,\r\n            ICollection<string> lines, \r\n            Stream outputStream)\r\n        {\r\n            using (var header = new FunctionHeader(functionTitle, isWarning, showEditButton))\r\n            {\r\n                var headerSize = header.HeaderSize;\r\n\r\n                const int minTextAreaWidth = 350;\r\n                const int leftPadding = 14, rightPadding = 10, topPadding = 12, bottomPadding = 10;\r\n\r\n                var linesTrimmed = lines.Take(20).ToList();\r\n\r\n                using (var textFont = new Font(\"Helvetica\", 9.5f, FontStyle.Regular))\r\n                {\r\n                    int lineHeight = MeasureText(\"Text\", textFont).Height;\r\n\r\n                    Size totalSize = new Size(Math.Max(headerSize.Width, minTextAreaWidth),\r\n                        headerSize.Height + topPadding + lineHeight * linesTrimmed.Count + bottomPadding);\r\n\r\n                    using (var bitmap = new Bitmap(totalSize.Width, totalSize.Height))\r\n                    using (var graphics = Graphics.FromImage(bitmap))\r\n                    {\r\n                        graphics.Clear(Color.White);\r\n\r\n                        header.DrawHeader(bitmap, graphics, totalSize.Width);\r\n\r\n                        using(var solidBrush = new SolidBrush(Color.Gray))\r\n                        for (int i = 0; i < linesTrimmed.Count; i++)\r\n                        {\r\n                            var line = linesTrimmed[i];\r\n                            int lineY = headerSize.Height + topPadding + i * lineHeight;\r\n\r\n                            int maxLineWidth = totalSize.Width - leftPadding - rightPadding;\r\n\r\n                            string croppedLine = CropLineToFitMaxWidth(line, textFont, maxLineWidth);\r\n\r\n                            graphics.DrawString(croppedLine, textFont, solidBrush, leftPadding, lineY);\r\n                        }\r\n\r\n                        // Text outline\r\n                        using (var pen = new Pen(isWarning ? Color.Red : Color.Gray))\r\n                        {\r\n                            graphics.DrawRectangle(pen, new Rectangle(0, headerSize.Height,\r\n                                totalSize.Width - 1, totalSize.Height - headerSize.Height - 1));\r\n                        }\r\n\r\n                        context.Response.ContentType = \"image/png\";\r\n                        context.Response.Cache.SetExpires(DateTime.Now.AddDays(10));\r\n\r\n                        string tempFileName = Path.GetTempFileName();\r\n\r\n                        try\r\n                        {\r\n                            // Saving to a temporary file, as Image.Save() sometimes on a not seekable stream throws\r\n                            // an \"A generic error occurred in GDI+.\" exception\r\n                            bitmap.Save(tempFileName, ImageFormat.Png);\r\n\r\n                            context.Response.WriteFile(tempFileName);\r\n                            context.Response.Flush();\r\n                        }\r\n                        finally\r\n                        {\r\n                            C1File.Delete(tempFileName);\r\n                        }\r\n                    }\r\n\r\n                }\r\n            }\r\n        }\r\n\r\n        public static Size MeasureText(string text, Font font)\r\n        {\r\n            using (var b = new Bitmap(1, 1))\r\n            using (var g = Graphics.FromImage(b))\r\n            {\r\n                SizeF sizeF = g.MeasureString(text, font);\r\n                return new Size((int)Math.Ceiling(sizeF.Width), (int)Math.Ceiling(sizeF.Height));\r\n            }\r\n        }\r\n\r\n        private static string CropLineToFitMaxWidth(string line, Font textFont, int maxLineWidth)\r\n        {\r\n            if (line.Length <= 10 || MeasureText(line, textFont).Width <= maxLineWidth) return line;\r\n\r\n            if (line.Length > 250)\r\n            {\r\n                line = line.Substring(250);\r\n            }\r\n\r\n            return CropLineToFitMaxWidth(line.Substring(0, line.Length - 5) + \"...\", textFont, maxLineWidth);\r\n        }\r\n\r\n        private static void MakeBlackTransparent(Bitmap bitmap, Rectangle rect)\r\n        {\r\n            for (int x = 0; x < rect.Width; x++)\r\n            {\r\n                for (int y = 0; y < rect.Height; y++)\r\n                {\r\n                    int totalX = rect.X + x;\r\n                    int totalY = rect.Y + y;\r\n\r\n                    var color = bitmap.GetPixel(totalX, totalY);\r\n                    if (color.R != 255 || color.G != 255 || color.B != 255)\r\n                    {\r\n                        int alpha = (color.R + color.G + color.B) / 3;\r\n\r\n                        bitmap.SetPixel(totalX, totalY, Color.FromArgb(alpha, 255, 255, 255));\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private class FunctionHeader: IDisposable\r\n        {\r\n            const int HeaderHeight = 60;\r\n            private const int TitleAndEditSpacing = 25;\r\n            private readonly int _headerWidth;\r\n            private readonly Font _titleFont;\r\n            private readonly Font _buttonFont;\r\n            private readonly string _title;\r\n            readonly string _editLabel = LocalizationFiles.Composite_Web_VisualEditor.Function_Edit;\r\n            private readonly Point _titlePosition;\r\n\r\n            private Size _titleSize;\r\n            private Size _editLabelSize;\r\n            private readonly Image _functionIcon;\r\n\r\n            private readonly bool _isWarning;\r\n            private readonly bool _showEditButton;\r\n\r\n            private static readonly string FunctionIconPath = GetIconPath(\"images/function.png\");\r\n            private static readonly string EditFunctionIconPath = GetIconPath(\"images/editfunction.png\");\r\n            private static readonly string WarningIconPath = GetIconPath(\"images/warning.png\");\r\n\r\n            private static string GetIconPath(string relativePath)\r\n            {\r\n                return HostingEnvironment.MapPath(UrlUtils.ResolveAdminUrl(relativePath));\r\n            }\r\n\r\n            private Image SafeImageFromFile(string path) \r\n            {\r\n                using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))\r\n                    {\r\n                        var img = Bitmap.FromStream(fs);\r\n                        return img;\r\n                    }\r\n            }\r\n\r\n            public FunctionHeader(string title, bool isWarning, bool showEditButton)\r\n            {\r\n                _title = title;\r\n                _showEditButton = showEditButton;\r\n\r\n                _titleFont = new Font(\"Helvetica\", 12.0f, FontStyle.Regular);\r\n                _buttonFont = new Font(\"Helvetica\", 9.0f, FontStyle.Bold);\r\n\r\n                _titleSize = MeasureText(_title, _titleFont);\r\n\r\n                _isWarning = isWarning;\r\n                _functionIcon = SafeImageFromFile(_isWarning ? WarningIconPath : FunctionIconPath);\r\n\r\n                int leftPadding = 15;\r\n                _titlePosition = new Point(leftPadding + _functionIcon.Width, (HeaderHeight - _titleSize.Height) / 2);\r\n\r\n                int editButtonSizeWithPaddings = 0;\r\n                if (showEditButton)\r\n                {\r\n                    _editLabelSize = MeasureText(_editLabel, _buttonFont);\r\n                    editButtonSizeWithPaddings = _editLabelSize.Width + 45;\r\n                }\r\n\r\n                _headerWidth = _titlePosition.X + _titleSize.Width + editButtonSizeWithPaddings + TitleAndEditSpacing;\r\n\r\n                MinimumWidth = _titlePosition.X + editButtonSizeWithPaddings;\r\n            }\r\n\r\n            public int MinimumWidth { get; private set; }\r\n\r\n            public Size HeaderSize { get { return new Size(_headerWidth, HeaderHeight); } }\r\n\r\n            public void DrawHeader(Bitmap bitmap, Graphics graphics, int bitmapWidth)\r\n            {\r\n                using (var whiteBrush = new SolidBrush(Color.White))\r\n                {\r\n                    graphics.FillRectangle(whiteBrush, 0, 0, bitmapWidth, HeaderHeight);\r\n                }\r\n\r\n                // Function icon\r\n                var functionIconRec = new Rectangle(10, (HeaderHeight - _functionIcon.Height) / 2,\r\n                                    _functionIcon.Width, _functionIcon.Height);\r\n                graphics.DrawImage(_functionIcon, functionIconRec);\r\n\r\n\r\n                // Title\r\n                using (var solidBrush = new SolidBrush(_isWarning ? Color.Red : Color.Black))\r\n                {\r\n                    graphics.DrawString(_title, _titleFont, solidBrush, _titlePosition);\r\n                }\r\n\r\n                if (!_isWarning)\r\n                {\r\n                    // Making the icon and the label transparent\r\n                    MakeBlackTransparent(bitmap, functionIconRec);\r\n\r\n                    var textSize = MeasureText(_title, _titleFont);\r\n                    var textRec = new Rectangle(_titlePosition.X, _titlePosition.Y, textSize.Width, textSize.Height);\r\n\r\n                    MakeBlackTransparent(bitmap, textRec);\r\n                }\r\n\r\n                // \"Edit\" label \r\n                if (_showEditButton)\r\n                {\r\n                    DrawTransparentEditButton(bitmap, graphics, bitmapWidth);\r\n                }\r\n            }\r\n\r\n            private void DrawTransparentEditButton(Bitmap bitmap, Graphics graphics, int bitmapWidth)\r\n            {\r\n                Point editLabelPosition = new Point(bitmapWidth - TitleAndEditSpacing - _editLabelSize.Width, (HeaderHeight - _editLabelSize.Height) / 2);\r\n\r\n                using (var whiteBrush = new SolidBrush(Color.White))\r\n                {\r\n                    graphics.FillRectangle(whiteBrush, editLabelPosition.X - 50, 0, bitmapWidth - editLabelPosition.X + 50, HeaderHeight);\r\n                }\r\n\r\n                using (var solidBrush = new SolidBrush(Color.Black))\r\n                {\r\n                    graphics.DrawString(_editLabel, _buttonFont, solidBrush, editLabelPosition);\r\n                }\r\n\r\n                int editFunctionIconY;\r\n                Size editFunctionIconSize;\r\n\r\n                const int labelRightPadding = 5;\r\n\r\n                // Edit function \"pen\" icon\r\n                using (var icon = (Bitmap)SafeImageFromFile(EditFunctionIconPath))\r\n                {\r\n                    editFunctionIconSize = icon.Size;\r\n                    editFunctionIconY = (HeaderHeight - icon.Height) / 2;\r\n\r\n                    graphics.DrawImage(icon, editLabelPosition.X - icon.Width, editFunctionIconY);\r\n\r\n                    // Mirroring 5 px of the \"pen\" icon\r\n                    for (int x = 0; x < 5; x++)\r\n                    {\r\n                        for (int y = 0; y < icon.Height; y++)\r\n                        {\r\n                            bitmap.SetPixel(editLabelPosition.X + _editLabelSize.Width + labelRightPadding + x, editFunctionIconY + y,\r\n                                icon.GetPixel(4 - x, y));\r\n                        }\r\n                    }\r\n\r\n                    var borderColor = icon.GetPixel(10, 0);\r\n\r\n                    using (var pen = new Pen(borderColor))\r\n                    {\r\n                        // Top line for edit function link\r\n                        graphics.DrawLine(pen, editLabelPosition.X, editFunctionIconY,\r\n                                               editLabelPosition.X + _editLabelSize.Width + labelRightPadding, editFunctionIconY);\r\n\r\n                        // Bottom line for edit function link\r\n                        int bottomLineY = editFunctionIconY + icon.Height - 1;\r\n                        graphics.DrawLine(pen, editLabelPosition.X, bottomLineY,\r\n                                               editLabelPosition.X + _editLabelSize.Width + labelRightPadding, bottomLineY);\r\n                    }\r\n                }\r\n\r\n                // Making the \"Edit\" button transparent\r\n                var editFuncRect = new Rectangle(editLabelPosition.X - editFunctionIconSize.Width, editFunctionIconY,\r\n                    editFunctionIconSize.Width + _editLabelSize.Width + labelRightPadding + 5, editFunctionIconSize.Height);\r\n\r\n                MakeBlackTransparent(bitmap, editFuncRect);\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                _titleFont.Dispose();\r\n                _buttonFont.Dispose();\r\n                _functionIcon.Dispose();\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~FunctionHeader()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Drawing/ImageTemplatedBoxCreator.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Drawing;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Drawing\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ImageTemplatedBoxCreator\r\n    {\r\n        private Point _topLeftResize;\r\n        private Point _bottomRightResize;\r\n        private readonly Bitmap _templateBitmap;\r\n\r\n        private TitleItem _titleItem;\r\n        private WrappedTextItem _wrappedTextItem;\r\n        private TextLinesItem _textLinesItem;\r\n        private ImageItem _topRightIconItem;\r\n        private ImageItem _image;\r\n\r\n        private int _width;\r\n        private int _height;\r\n        private Bitmap _currentBitmap;\r\n\r\n\r\n        /// <exclude />\r\n        public ImageTemplatedBoxCreator(Bitmap templateBitmap, Point topLeftResize, Point bottomRightResize)\r\n        {\r\n            _topLeftResize = topLeftResize;\r\n            _bottomRightResize = bottomRightResize;\r\n            _templateBitmap = templateBitmap;\r\n\r\n            this.LinePadding = 3;\r\n            this.SeparatorChar = ' ';\r\n            this.MaxWidth = 700;\r\n            this.MinWidth = 200;\r\n            this.MinHeight = 50;\r\n        }\r\n\r\n\r\n\r\n        #region Simple properties\r\n        /// <exclude />\r\n        public int MinWidth { get; set; }\r\n\r\n        /// <exclude />\r\n        public int MaxWidth { get; set; }\r\n\r\n        /// <exclude />\r\n        public int MinHeight { get; set; }\r\n\r\n        /// <exclude />\r\n        public int LinePadding { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public char SeparatorChar { get; set; }\r\n        #endregion\r\n\r\n\r\n        /// <exclude />\r\n        public void SetTitle(string title, Size topLeftPadding, Size bottomRightPadding, Color fontColor, string fontFamilyName, float fontSize, FontStyle fontStyle)\r\n        {\r\n            _titleItem = new TitleItem(title, topLeftPadding, bottomRightPadding, fontColor, fontFamilyName, fontSize, fontStyle);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void SetWrappedText(string text, Point topLeftPadding, Point bottomRightPadding, Color fontColor, string fontFamilyName, float fontSize, FontStyle fontStyle)\r\n        {\r\n            _textLinesItem = null;\r\n            _wrappedTextItem = new WrappedTextItem(text, topLeftPadding, bottomRightPadding, fontColor, fontFamilyName, fontSize, fontStyle);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void SetTextLines(ICollection<string> lines, Size topLeftPadding, Size bottomRightPadding, Color fontColor, string fontFamilyName, float fontSize, FontStyle fontStyle)\r\n        {\r\n            _wrappedTextItem = null;\r\n            _textLinesItem = new TextLinesItem(lines, topLeftPadding, bottomRightPadding, fontColor, fontFamilyName, fontSize, fontStyle);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetIcon(Bitmap icon, Size topLeftPadding, Size bottomRightPadding)\r\n        {\r\n            _topRightIconItem = new ImageItem(icon, topLeftPadding, bottomRightPadding);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetPreviewImage(Bitmap previewImage, Size topLeftPadding, Size bottomRightPadding)\r\n        {\r\n            _image = new ImageItem(previewImage, topLeftPadding, bottomRightPadding); \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Bitmap CreateBitmap()\r\n        {\r\n            CalculateWidthAndHeight();\r\n\r\n            _currentBitmap = new Bitmap(_templateBitmap, new Size(_width, _height));\r\n\r\n            DrawImage(_width, _height);\r\n\r\n            using (Graphics graphics = Graphics.FromImage(_currentBitmap))\r\n            {\r\n                if (_topRightIconItem != null)\r\n                {\r\n                    Point point = new Point(_width - _topRightIconItem.BottomRightPadding.Width - _topRightIconItem.Image.Width, \r\n                                            _topRightIconItem.BottomRightPadding.Height);\r\n\r\n                    graphics.DrawImage(_topRightIconItem.Image, point);\r\n                }\r\n\r\n\r\n                if (_titleItem != null)\r\n                {\r\n                    int counter = 0;\r\n\r\n                    using (var solidBrush = new SolidBrush(_titleItem.FontColor))\r\n                    foreach (string line in _titleItem.Lines)\r\n                    {\r\n                        int x = _titleItem.TopLeftPadding.Width;\r\n                        int y = _titleItem.TopLeftPadding.Height + counter * (this.LinePadding + _titleItem.LineHeight);\r\n\r\n                        graphics.DrawString(line, _titleItem.Font, solidBrush, x, y);\r\n\r\n                        counter++;\r\n                    }\r\n\r\n\r\n                    //graphics.DrawString(_titleItem.Title, _titleItem.Font, new SolidBrush(_titleItem.FontColor), _titleItem.TopLeftPadding.X, _titleItem.TopLeftPadding.Y);\r\n                }\r\n\r\n                int titleHeightWidthPadding = (_titleItem != null) ? _titleItem.HeightWidthPadding : 0;\r\n                if (_wrappedTextItem != null)\r\n                {\r\n                    int counter = 0;\r\n\r\n                    using (var solidBrush = new SolidBrush(_wrappedTextItem.FontColor))\r\n                    foreach (string line in _wrappedTextItem.Lines)\r\n                    {\r\n                        int x = _wrappedTextItem.TopLeftPadding.X;\r\n                        int y = _wrappedTextItem.TopLeftPadding.Y + counter * (this.LinePadding + _wrappedTextItem.LineHeight) + titleHeightWidthPadding;\r\n\r\n                        graphics.DrawString(line, _wrappedTextItem.Font, solidBrush, x, y);\r\n\r\n                        counter++;\r\n                    }\r\n                }\r\n                else if (_textLinesItem != null)\r\n                {\r\n                    int counter = 0;\r\n                    using (var solidBrush = new SolidBrush(_textLinesItem.FontColor))\r\n                    foreach (string line in _textLinesItem.Lines)\r\n                    {\r\n                        int x = _textLinesItem.TopLeftPadding.Width;\r\n                        int y = _textLinesItem.TopLeftPadding.Height + counter * (this.LinePadding + _textLinesItem.LineHeight) + titleHeightWidthPadding;\r\n\r\n                        graphics.DrawString(line, _textLinesItem.Font, solidBrush, x, y);\r\n\r\n                        counter++;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return _currentBitmap;\r\n        }\r\n\r\n\r\n\r\n        private void CalculateWidthAndHeight()\r\n        {\r\n            int width = MinWidth;\r\n            int height = MinHeight;\r\n\r\n            using (Graphics graphics = Graphics.FromImage(_templateBitmap))\r\n            {\r\n                int titleHeightWithPadding = 0;\r\n\r\n                if (_titleItem != null)\r\n                {\r\n                    //                    SplitLine(width - _wrappedTextItem.TopLeftPadding.X - _wrappedTextItem.BottomRightPadding.X, _wrappedTextItem.Text, _wrappedTextItem.Font, _wrappedTextItem.TopLeftPadding.Y, out textWidth, out lineHeight);\r\n\r\n                    SizeF titleSize = graphics.MeasureString(_titleItem.Title, _titleItem.Font);\r\n\r\n                    int titleWidth = (int)titleSize.Width + _titleItem.TopLeftPadding.Width + _titleItem.BottomRightPadding.Width;\r\n\r\n                    if (_topRightIconItem != null)\r\n                    {\r\n                        titleWidth += _topRightIconItem.GetBoxSize().Width;\r\n                    }\r\n\r\n                    int titleHeight;\r\n\r\n                    if (titleWidth > this.MaxWidth)\r\n                    {\r\n                        int lineHeight;\r\n                        _titleItem.Lines = SplitLine(this.MaxWidth - _titleItem.PaddingSize.Width, _titleItem.Title, _titleItem.Font, _titleItem.TopLeftPadding.Height, out titleWidth, out lineHeight);\r\n                        _titleItem.LineHeight = lineHeight;\r\n\r\n                        width = this.MaxWidth;\r\n\r\n                        titleHeight = _titleItem.Lines.Count * _titleItem.LineHeight +\r\n                                     (_titleItem.Lines.Count - 1) * this.LinePadding +\r\n                                     _titleItem.PaddingSize.Width;\r\n\r\n                        if (titleHeight > height)\r\n                        {\r\n                            height = titleHeight;\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        _titleItem.Lines = new List<string> { _titleItem.Title };\r\n                        _titleItem.LineHeight = (int)titleSize.Height;\r\n\r\n                        titleHeight = (int)titleSize.Height + _titleItem.PaddingSize.Height;\r\n\r\n                        width = titleWidth;\r\n                    }\r\n\r\n                    if (titleHeight > height)\r\n                    {\r\n                        height = titleHeight;\r\n                    }\r\n\r\n                    titleHeightWithPadding = titleHeight + this.LinePadding;\r\n                    _titleItem.HeightWidthPadding = titleHeightWithPadding;\r\n                }\r\n\r\n\r\n                if (_wrappedTextItem != null)\r\n                {\r\n                    int textWidth, lineHeight;\r\n                    _wrappedTextItem.Lines = SplitLine(width - _wrappedTextItem.TopLeftPadding.X - _wrappedTextItem.BottomRightPadding.X, _wrappedTextItem.Text, _wrappedTextItem.Font, _wrappedTextItem.TopLeftPadding.Y + titleHeightWithPadding, out textWidth, out lineHeight);\r\n                    _wrappedTextItem.LineHeight = lineHeight;\r\n\r\n                    textWidth += _wrappedTextItem.TopLeftPadding.X + _wrappedTextItem.BottomRightPadding.X;\r\n\r\n                    if (textWidth > width)\r\n                    {\r\n                        width = textWidth;\r\n                    }\r\n\r\n                    int textHeight = _wrappedTextItem.Lines.Count * _wrappedTextItem.LineHeight +\r\n                                     (_wrappedTextItem.Lines.Count - 1) * this.LinePadding +\r\n                                     _wrappedTextItem.TopLeftPadding.Y + _wrappedTextItem.BottomRightPadding.Y +\r\n                                     titleHeightWithPadding;\r\n\r\n                    if (textHeight > height)\r\n                    {\r\n                        height = textHeight;\r\n                    }\r\n                }\r\n                else if (_textLinesItem != null)\r\n                {\r\n                    foreach (string line in _textLinesItem.Lines)\r\n                    {\r\n                        SizeF lineSize = graphics.MeasureString(line, _textLinesItem.Font);\r\n\r\n                        int lineWidth = (int)lineSize.Width + _textLinesItem.TopLeftPadding.Width + _textLinesItem.BottomRightPadding.Width;\r\n\r\n                        if (lineWidth > width)\r\n                        {\r\n                            width = lineWidth;\r\n                        }\r\n\r\n                        _textLinesItem.LineHeight = (int)lineSize.Height;\r\n                    }\r\n\r\n                    int textHeight = _textLinesItem.Lines.Count * _textLinesItem.LineHeight +\r\n                                     (_textLinesItem.Lines.Count - 1) * this.LinePadding +\r\n                                     _textLinesItem.TopLeftPadding.Height + _textLinesItem.BottomRightPadding.Height;\r\n\r\n                    if (textHeight > height)\r\n                    {\r\n                        height = textHeight;\r\n                    }\r\n                }\r\n\r\n                if (_image != null)\r\n                {\r\n                    height = Math.Max(height, _image.GetBoxSize().Height);\r\n                    width = Math.Max(width, _image.GetBoxSize().Width);\r\n                }\r\n\r\n                if (_topRightIconItem != null)\r\n                {\r\n                    int iconHeight = _topRightIconItem.GetBoxSize().Height;\r\n\r\n                    if (iconHeight > height)\r\n                    {\r\n                        height = iconHeight;\r\n                    }\r\n                }\r\n            }\r\n\r\n            _width = width;\r\n            _height = height;\r\n        }\r\n\r\n\r\n\r\n        private List<string> SplitLine(int currentWidth, string text, Font font, int offsetY, out int newWidth, out int lineHeight)\r\n        {\r\n            newWidth = currentWidth;\r\n            lineHeight = 0;\r\n\r\n            List<string> lines = new List<string>();\r\n\r\n            string[] words = text.Split(this.SeparatorChar);\r\n\r\n            using (Graphics graphics = Graphics.FromImage(_templateBitmap))\r\n            {\r\n                foreach (string word in words)\r\n                {\r\n                    SizeF size = graphics.MeasureString(word, font);\r\n\r\n                    if ((int)size.Width > newWidth)\r\n                    {\r\n                        newWidth = (int)size.Width;\r\n                    }\r\n\r\n                    lineHeight = (int)size.Height;\r\n                }\r\n\r\n                int index = 0;\r\n                string currentLine = \"\";\r\n                int currentAdjustedWidth = AdjustedWidth(lines.Count + 1, newWidth, offsetY, lineHeight);\r\n                while (index < words.Length)\r\n                {\r\n                    string newLine;\r\n\r\n                    if (currentLine == \"\")\r\n                    {\r\n                        newLine = words[index];\r\n                    }\r\n                    else\r\n                    {\r\n                        newLine = string.Format(\"{0}{1}{2}\", currentLine, this.SeparatorChar, words[index]);\r\n                    }\r\n\r\n                    SizeF size = graphics.MeasureString(newLine, font);\r\n                    if ((int)size.Width < currentAdjustedWidth)\r\n                    {\r\n                        currentLine = newLine;\r\n                        index++;\r\n                    }\r\n                    else\r\n                    {\r\n                        lines.Add(currentLine);\r\n                        currentLine = \"\";\r\n                        currentAdjustedWidth = AdjustedWidth(lines.Count + 1, newWidth, offsetY, lineHeight);\r\n                    }\r\n                }\r\n\r\n                lines.Add(currentLine);\r\n            }\r\n\r\n            return lines;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public int AdjustedWidth(int currentLineNumber, int width, int offsetY, int lineHeight)\r\n        {\r\n            if (_topRightIconItem == null) return width;\r\n\r\n            int lineTop = (currentLineNumber - 1) * (lineHeight + this.LinePadding) +\r\n                          offsetY;\r\n\r\n            int lineBottom = lineTop + lineHeight;\r\n\r\n            int iconTop = _topRightIconItem.TopLeftPadding.Height;\r\n            int iconBottom = _topRightIconItem.GetBoxSize().Height;\r\n\r\n            if ((lineTop >= iconTop) && (lineBottom <= iconBottom))\r\n            {\r\n                return width - _topRightIconItem.GetBoxSize().Width;\r\n            }\r\n\r\n            return width;\r\n        }\r\n\r\n\r\n\r\n        private void DrawImage(int width, int height)\r\n        {\r\n            int topBorder = _topLeftResize.Y;\r\n            int bottomBorder = _templateBitmap.Height - _bottomRightResize.Y;\r\n            int leftBorder = _topLeftResize.X;\r\n            int rightBorder = _templateBitmap.Width - _bottomRightResize.X;\r\n\r\n            int newRightOffset = width - rightBorder;\r\n            int newBottomOffset = height - bottomBorder;\r\n\r\n\r\n            // Top left cornor\r\n            DrawCornor(leftBorder, topBorder, 0, 0, 0, 0);\r\n            // Top right cornor\r\n            DrawCornor(rightBorder, topBorder, _bottomRightResize.X, 0, newRightOffset, 0);\r\n            // Bottom left cornor\r\n            DrawCornor(leftBorder, bottomBorder, 0, _bottomRightResize.Y, 0, newBottomOffset);\r\n            // Bottom right cornor\r\n            DrawCornor(rightBorder, bottomBorder, _bottomRightResize.X, _bottomRightResize.Y, newRightOffset, newBottomOffset);\r\n\r\n\r\n            DrawHorizontalSide(width - leftBorder - rightBorder, topBorder, _topLeftResize.X, 0, leftBorder, 0);\r\n            DrawHorizontalSide(width - leftBorder - rightBorder, bottomBorder, _topLeftResize.X, _bottomRightResize.Y, leftBorder, height - bottomBorder);\r\n\r\n            DrawVerticalSide(leftBorder, height - topBorder - bottomBorder, 0, _topLeftResize.Y, 0, topBorder);\r\n            DrawVerticalSide(rightBorder, height - topBorder - bottomBorder, _bottomRightResize.X, _topLeftResize.Y, width - rightBorder, topBorder);\r\n\r\n            DrawInner(width - leftBorder - rightBorder, height - topBorder - bottomBorder, _topLeftResize.X, _topLeftResize.Y, leftBorder, topBorder);\r\n\r\n            if (_image != null)\r\n            {\r\n                using (Graphics g = Graphics.FromImage(_currentBitmap))            \r\n                {\r\n                    g.DrawImage(_image.Image, new Point(_image.TopLeftPadding));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DrawCornor(int width, int height, int originalOffsetX, int originalOffsetY, int newOffsetX, int newOffsetY)\r\n        {\r\n            for (int x = 0; x < width; ++x)\r\n            {\r\n                for (int y = 0; y < height; ++y)\r\n                {\r\n                    Color color = _templateBitmap.GetPixel(x + originalOffsetX, y + originalOffsetY);\r\n\r\n                    _currentBitmap.SetPixel(x + newOffsetX, y + newOffsetY, color);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DrawHorizontalSide(int width, int height, int originalOffsetX, int originalOffsetY, int newOffsetX, int newOffsetY)\r\n        {\r\n            for (int x = 0; x < width; ++x)\r\n            {\r\n                for (int y = 0; y < height; ++y)\r\n                {\r\n                    Color color = _templateBitmap.GetPixel(originalOffsetX, y + originalOffsetY);\r\n\r\n                    _currentBitmap.SetPixel(x + newOffsetX, y + newOffsetY, color);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DrawVerticalSide(int width, int height, int originalOffsetX, int originalOffsetY, int newOffsetX, int newOffsetY)\r\n        {\r\n            for (int x = 0; x < width; ++x)\r\n            {\r\n                for (int y = 0; y < height; ++y)\r\n                {\r\n                    Color color = _templateBitmap.GetPixel(x + originalOffsetX, originalOffsetY);\r\n\r\n                    _currentBitmap.SetPixel(x + newOffsetX, y + newOffsetY, color);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DrawInner(int width, int height, int originalOffsetX, int originalOffsetY, int newOffsetX, int newOffsetY)\r\n        {\r\n            Color color = _templateBitmap.GetPixel(originalOffsetX, originalOffsetY);\r\n\r\n            using (Graphics g = Graphics.FromImage(_currentBitmap))            \r\n            using (var solidBrush = new SolidBrush(color))\r\n            {\r\n                g.FillRectangle(solidBrush, newOffsetX, newOffsetY, width, height);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        private sealed class TitleItem : PaddedItem\r\n        {\r\n            public TitleItem(string title, Size topLeftPadding, Size bottomRightPadding, \r\n                Color fontColor, string fontFamilyName, float fontSize, FontStyle fontStyle) : base(topLeftPadding, bottomRightPadding)\r\n            {\r\n                this.Title = title;\r\n                this.FontColor = fontColor;\r\n                this.Font = new Font(fontFamilyName, fontSize, fontStyle);\r\n            }\r\n\r\n\r\n            public string Title\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public List<string> Lines\r\n            {\r\n                get;\r\n                set;\r\n            }\r\n\r\n\r\n            public int LineHeight\r\n            {\r\n                get;\r\n                set;\r\n            }\r\n\r\n\r\n            public int HeightWidthPadding\r\n            {\r\n                get;\r\n                set;\r\n            }\r\n\r\n\r\n            public Color FontColor\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public Font Font\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n            public override Size GetInnerDimentions()\r\n            {\r\n                throw new NotImplementedException();\r\n                // graphics\r\n                //return new Size(0, Lines.Count * LineHeight + (Lines.Count - 1) * this.LinePadding;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private sealed class WrappedTextItem\r\n        {\r\n            public WrappedTextItem(string text, Point topLeftPadding, Point bottomRightPadding, Color fontColor, string fontFamilyName, float fontSize, FontStyle fontStyle)\r\n            {\r\n                this.Text = text;\r\n                this.TopLeftPadding = topLeftPadding;\r\n                this.BottomRightPadding = bottomRightPadding;\r\n                this.FontColor = fontColor;\r\n                this.Font = new Font(fontFamilyName, fontSize, fontStyle);\r\n            }\r\n\r\n\r\n            public string Text\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public List<string> Lines\r\n            {\r\n                get;\r\n                set;\r\n            }\r\n\r\n\r\n            public int LineHeight\r\n            {\r\n                get;\r\n                set;\r\n            }\r\n\r\n            public Point TopLeftPadding\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public Point BottomRightPadding\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public Color FontColor\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public Font Font\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private sealed class TextLinesItem\r\n        {\r\n            public TextLinesItem(ICollection<string> lines, Size topLeftPadding, Size bottomRightPadding, Color fontColor, string fontFamilyName, float fontSize, FontStyle fontStyle)\r\n            {\r\n                this.Lines = lines;\r\n                this.TopLeftPadding = topLeftPadding;\r\n                this.BottomRightPadding = bottomRightPadding;\r\n                this.FontColor = fontColor;\r\n                this.Font = new Font(fontFamilyName, fontSize, fontStyle);\r\n            }\r\n\r\n\r\n            public ICollection<string> Lines\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public int LineHeight\r\n            {\r\n                get;\r\n                set;\r\n            }\r\n\r\n\r\n            public Size TopLeftPadding\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public Size BottomRightPadding\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public Color FontColor\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public Font Font\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n        }\r\n\r\n        private abstract class PaddedItem\r\n        {\r\n            public PaddedItem(Size topLeftPadding, Size bottomRightPadding)\r\n            {\r\n                this.TopLeftPadding = topLeftPadding;\r\n                this.BottomRightPadding = bottomRightPadding;\r\n            }\r\n            public abstract Size GetInnerDimentions();\r\n\r\n            public Size TopLeftPadding { get; private set; }\r\n\r\n            public Size BottomRightPadding { get; private set; }\r\n\r\n            public Size PaddingSize\r\n            {\r\n                get { return new Size(TopLeftPadding.Width + BottomRightPadding.Width, TopLeftPadding.Height + BottomRightPadding.Height); }\r\n            }\r\n\r\n            public Size GetBoxSize()\r\n            {\r\n                var innerDimensions = GetInnerDimentions();\r\n\r\n                return new Size(innerDimensions.Width + TopLeftPadding.Width + BottomRightPadding.Width,\r\n                                innerDimensions.Height + TopLeftPadding.Height + BottomRightPadding.Height);\r\n            }\r\n        }\r\n\r\n\r\n        private sealed class ImageItem : PaddedItem\r\n        {\r\n            public ImageItem(Bitmap icon, Size topRightPadding, Size bottomLeftPadding)\r\n                : base(topRightPadding, bottomLeftPadding)\r\n            {\r\n                this.Image = icon;\r\n            }\r\n\r\n            public Bitmap Image\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n            \r\n            public override Size GetInnerDimentions()\r\n            {\r\n                return Image.Size;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ActionCategory.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>\r\n    /// Enumeration of different types of actions. If in doupt use 'Other'.\r\n    /// </summary>\r\n    public enum ActionType\r\n    {\r\n        /// <summary>\r\n        /// The action will enable the user to edit the element.\r\n        /// </summary>\r\n        Edit,\r\n\r\n        /// <summary>\r\n        /// The action will enable the user to add a child element.\r\n        /// </summary>\r\n        Add,\r\n\r\n        /// <summary>\r\n        /// The action will enable the user to delete the element.\r\n        /// </summary>\r\n        Delete,\r\n\r\n        /// <summary>\r\n        /// The action will enable the user to get a report, manage meta dtata or other non add/edit/delete actions\r\n        /// </summary>\r\n        Other,\r\n\r\n        /// <summary>\r\n        /// The action will should only appear in debug builds, where the C1 Console is running in developer mode. Normal users are very unlikely to ever see this action.\r\n        /// </summary>\r\n        DeveloperMode\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// The priority/relevance of an action group. Use 'PrimaryHigh' if actions in this group are the most relevant actions available. Otherwise use another value to move actions down in menus. \r\n    /// </summary>\r\n    public enum ActionGroupPriority\r\n    {\r\n        /// <summary>\r\n        /// Use this when actions in the group are of the outmost importance/relevance, like 'Edit Page' og a page.\r\n        /// </summary>\r\n        PrimaryHigh = 0,\r\n\r\n        /// <summary>\r\n        /// Use this when actions in the group are primary for the element it is attached to, but not used very often.\r\n        /// </summary>\r\n        PrimaryMedium = 1,\r\n\r\n        /// <summary>\r\n        /// Use this when actions in the group are primary for the element it is attached to, but very seldom not used.\r\n        /// </summary>\r\n        PrimaryLow = 2,\r\n\r\n        /// <summary>\r\n        /// Use this when actions in the group are often used and relevant (but not primary) for the element it is attached to.\r\n        /// </summary>\r\n        TargetedAppendHigh = 10,\r\n\r\n        /// <summary>\r\n        /// Use this when actions in the group are used and relevant (but not primary) for the element it is attached to.\r\n        /// </summary>\r\n        TargetedAppendMedium = 11,\r\n\r\n        /// <summary>\r\n        /// Use this when actions in the group are seldom used and relevant (but not primary) for the element it is attached to.\r\n        /// </summary>\r\n        TargetedAppendLow = 12,\r\n\r\n        /// <summary>\r\n        /// Use this when actions in the group are attached to elements in general, without specific relevance to those elements.\r\n        /// </summary>\r\n        GeneralAppendHigh = 20,\r\n\r\n        /// <summary>\r\n        /// Use this when actions in the group are attached to elements in general, without specific relevance to those elements.\r\n        /// </summary>\r\n        GeneralAppendMedium = 21,\r\n\r\n        /// <summary>\r\n        /// Use this when actions in the group are attached to elements in general, without specific relevance to those elements.\r\n        /// </summary>\r\n        GeneralAppendLow = 22\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Actions may have a checkbox associated with them, indicating it they are turned on or not or uncheckable.\r\n    /// </summary>\r\n    public enum ActionCheckedStatus\r\n    {\r\n        /// <summary>\r\n        /// The action can not be checked/unchecked. This is typical default behaviour of an action.\r\n        /// </summary>\r\n        Uncheckable,\r\n\r\n        /// <summary>\r\n        /// The action is unchecked and can be checked.\r\n        /// </summary>\r\n        Unchecked,\r\n\r\n        /// <summary>\r\n        /// The action is checked and can be unchecked.\r\n        /// </summary>\r\n        Checked\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// Define a priority/relevance and optional named group for an action. The priority/relevance influence the position of the action in menus.\r\n    /// </summary>\r\n    public sealed class ActionGroup\r\n    {\r\n        /// <summary>\r\n        /// Initializes a new instance.\r\n        /// </summary>\r\n        /// <param name=\"priority\">the priority/relecance of the action in relation to the element it is attached to</param>\r\n        public ActionGroup(ActionGroupPriority priority)\r\n        {\r\n            if (priority!=ActionGroupPriority.PrimaryHigh)\r\n            {\r\n                throw new ArgumentException(\"Unnamed action groups must be called with the PrimaryHigh priority. They serve as a way do deliver common core tasks, like 'delete'. Specify a group name if this is not a core action.\");\r\n            }\r\n\r\n            this.Name = \"\";\r\n            this.Priority = priority;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance with a custom named group.\r\n        /// </summary>\r\n        /// <param name=\"name\">A name of your choosing. If this name is used by multiple actions they may be bundled into the same group.</param>\r\n        /// <param name=\"priority\">the priority/relecance of the action in relation to the element it is attached to</param>\r\n        public ActionGroup(string name, ActionGroupPriority priority)\r\n        {\r\n            if (string.IsNullOrEmpty(name))\r\n            {\r\n                throw new ArgumentException(\"Parameter 'name' must have a value\");\r\n            }\r\n\r\n            if (priority == ActionGroupPriority.PrimaryHigh)\r\n            {\r\n                throw new ArgumentException(\"Named action groups can not be called with the PrimaryHigh priority. They serve as a way do deliver non-core tasks, like 'search'.\");\r\n            }\r\n\r\n            this.Name = name;\r\n            this.Priority = priority;\r\n        }\r\n\r\n        /// <summary>\r\n        /// The custom name of the group. An empty string if the group is not named.\r\n        /// </summary>\r\n        public string Name { get; set; }\r\n\r\n        /// <summary>\r\n        /// Priority/relevance of the action.\r\n        /// </summary>\r\n        public ActionGroupPriority Priority { get; set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// Define the location of an action in menus. Actions can be grouped by type (add,edit,delete,other) and in primary and secondary.\r\n    /// </summary>\r\n    public sealed class ActionLocation\r\n    {\r\n        /// <summary>\r\n        /// A primary action, adding data. This will make the action show up between add and delete, next to other add actions (if any).\r\n        /// </summary>\r\n        public readonly static ActionLocation AddPrimaryActionLocation = new ActionLocation { ActionType = ActionType.Add, IsInFolder = false, IsInToolbar = true, ActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh) };\r\n\r\n        /// <summary>\r\n        /// A primary action, editing data. This will make the action show up as one of the first, next to other edit actions (if any).\r\n        /// </summary>\r\n        public readonly static ActionLocation EditPrimaryActionLocation = new ActionLocation { ActionType = ActionType.Edit, IsInFolder = false, IsInToolbar = true, ActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh) };\r\n\r\n        /// <summary>\r\n        /// A primary action, deleting data. This will make the action show up after edit and add actions, next to other delete actions (if any).\r\n        /// </summary>\r\n        public readonly static ActionLocation DeletePrimaryActionLocation = new ActionLocation { ActionType = ActionType.Delete, IsInFolder = false, IsInToolbar = true, ActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh) };\r\n\r\n        /// <summary>\r\n        /// A primary action, doing something besides from add, edit and delete. This can be a view/report actions etc. \r\n        /// </summary>\r\n        public readonly static ActionLocation OtherPrimaryActionLocation = new ActionLocation { ActionType = ActionType.Other, IsInFolder = false, IsInToolbar = true, ActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh) };\r\n\r\n        /// <exclude />\r\n        public ActionLocation()\r\n        {\r\n            this.ActionGroup = new ActionGroup(\"Common tasks\", ActionGroupPriority.GeneralAppendLow);\r\n            this.ActionType = ActionType.Other;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Where the action should be grouped. Grouping is typically based on a priority, but can be a unique named group you define. \r\n        /// If your action is a primary action for the element it is attacted to you should ensure the ActionGroupPriorty  is set to PrimaryHigh.\r\n        /// The lower priority, the lower in a menu list the action will appear.\r\n        /// </summary>\r\n        public ActionGroup ActionGroup { get; set; }\r\n        \r\n        /// <summary>\r\n        /// Declare what type of action this is: Edit, Add, Delete, Other. You may also use 'DeveloperMode' which will hide the action when the C1 Console run in normal operations mode.\r\n        /// </summary>\r\n        public ActionType ActionType { get; set; }\r\n\r\n        /// <summary>\r\n        /// Set to true if your action is important enough to be shown in the toolbar. If this is a very specialized command, consider not showing it in the toolbar.\r\n        /// </summary>\r\n        public bool IsInToolbar { get; set; }\r\n\r\n        /// <summary>\r\n        /// Not implemented at client level. Setting this to true will have no effect.\r\n        /// </summary>\r\n        public bool IsInFolder { get; set; }\r\n\r\n        /// <summary>\r\n        /// Not implemented at client level. Setting a folder name will have no effect.\r\n        /// </summary>\r\n        public string FolderName { get; set; }\r\n\r\n        /// <summary>\r\n        /// Bundle actions behind a drop down button. If multiple actions on an element share ActionBundle value, they can be compounded in the client UI.\r\n        /// </summary>\r\n        public string ActionBundle { get; set; }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ActionHandle.cs",
    "content": "using Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// A handle to an action - a unique and serializable way to identify actions.\r\n    /// </summary>\r\n    public sealed class ActionHandle\r\n    {\r\n        private readonly ActionToken _actionToken;\r\n        private string _serializedActionToken;\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance.\r\n        /// </summary>\r\n        /// <param name=\"actionToken\"></param>\r\n        public ActionHandle(ActionToken actionToken)\r\n        {\r\n            _actionToken = actionToken;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// <see cref=\"ActionToken\"/> represented by this handle.\r\n        /// </summary>\r\n        public ActionToken ActionToken => _actionToken;\r\n\r\n\r\n        private string SerializedActionToken\r\n        {\r\n            get\r\n            {\r\n                if (_serializedActionToken == null)\r\n                {\r\n                    _serializedActionToken = _actionToken.Serialize();\r\n                }\r\n\r\n                return _serializedActionToken;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj) => Equals(obj as ActionHandle);\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(ActionHandle actionHandle)\r\n        {\r\n            if (actionHandle == null) return false;\r\n\r\n            return this.SerializedActionToken == actionHandle.SerializedActionToken;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return this.SerializedActionToken.GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ActionVisualizedData.cs",
    "content": "using Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// Describe how an action should appear visually (label, icon).\r\n    /// </summary>\r\n    public sealed class ActionVisualizedData\r\n    {\r\n        /// <summary>\r\n        /// Constructs a new instance\r\n        /// </summary>\r\n        public ActionVisualizedData() \r\n        {\r\n            this.ActionCheckedStatus = ActionCheckedStatus.Uncheckable;\r\n            ActivePositions = ElementActionActivePosition.NavigatorTree;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance, cloning an existing instance.\r\n        /// </summary>\r\n        /// <param name=\"copy\"></param>\r\n        public ActionVisualizedData(ActionVisualizedData copy) \r\n        {\r\n            this.ActionLocation = copy.ActionLocation;\r\n            this.Disabled = copy.Disabled;\r\n            this.Icon = copy.Icon;\r\n            this.Label = copy.Label;\r\n            this.ToolTip = copy.ToolTip;\r\n            this.ActionCheckedStatus = copy.ActionCheckedStatus;\r\n            this.ActivePositions = copy.ActivePositions;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Controls if a check box should be shown next to the action command, and if this checkbox is checked.\r\n        /// </summary>\r\n        public ActionCheckedStatus ActionCheckedStatus { get; set; }\r\n\r\n        /// <summary>\r\n        /// Label of the action\r\n        /// </summary>\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// When disabled, the action will be shown but grayed out and cannot be invoked.\r\n        /// </summary>\r\n        public bool Disabled { get; set; }\r\n\r\n        /// <summary>\r\n        /// The action's icon\r\n        /// </summary>\r\n        public ResourceHandle Icon { get; set; }\r\n\r\n        /// <summary>\r\n        /// The action's tool tip\r\n        /// </summary>\r\n        public string ToolTip { get; set; }\r\n\r\n        /// <summary>\r\n        /// Where the action should show up, relative to other actions.\r\n        /// </summary>\r\n        public ActionLocation ActionLocation { get; set; }\r\n\r\n        /// <summary>\r\n        /// The string to be shown in a confirm dialog when executing the action for multiple elements.\r\n        /// </summary>\r\n        public DialogStrings BulkExecutionDialog { get; set; }\r\n\r\n        /// <summary>\r\n        /// Where the action should be shown - when elements are shown in a selection tree (as opposed to the normal navigation tree) some actions may be desired.\r\n        /// Default is <value>ElementActionActivePosition.NavigatorTree</value> only.\r\n        /// </summary>\r\n        public ElementActionActivePosition ActivePositions { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return Label;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/AttachingPoint.cs",
    "content": "﻿using System;\r\nusing Composite.Plugins.Elements.ElementProviders.VirtualElementProvider;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>\r\n    /// Expose ElementTokens for common C1 Console perspectives and folders\r\n    /// </summary>\r\n    public sealed class AttachingPoint\r\n    {\r\n        private const string BuildInVirtualElementProviderName = \"VirtualElementProvider\";\r\n\r\n        private static readonly AttachingPoint _rootPerspectiveAttachingPoint = VirtualElementAttachingPoint(\"ID01\");\r\n\r\n        private static readonly AttachingPoint _contentPerspectiveAttachingPoint = VirtualElementAttachingPoint(\"ContentPerspective\");\r\n        private static readonly AttachingPoint _contentPerspectiveWebsiteItemsAttachingPoint = \r\n            new AttachingPoint { EntityTokenType = typeof(GeneratedDataTypesElementProviderRootEntityToken), \r\n                                 Id = \"GlobalDataTypeFolder\", \r\n                                 Source = \"GlobalDataOnlyGeneratedDataTypesElementProvider\" };\r\n        private static readonly AttachingPoint _mediaPerspectiveAttachingPoint = VirtualElementAttachingPoint(\"MediaPerspective\");\r\n        private static readonly AttachingPoint _dataPerspectiveAttachingPoint = VirtualElementAttachingPoint(\"DatasPerspective\");\r\n        private static readonly AttachingPoint _designPerspectiveAttachingPoint = VirtualElementAttachingPoint(\"DesignPerspective\");\r\n        private static readonly AttachingPoint _functionPerspectiveAttachingPoint = VirtualElementAttachingPoint(\"FunctionsPerspective\");\r\n        private static readonly AttachingPoint _systemPerspectiveAttachingPoint = VirtualElementAttachingPoint(\"SystemPerspective\");\r\n\r\n\r\n        /// <summary>\r\n        /// Attaching point for the C1 Console Root\r\n        /// </summary>\r\n        public static AttachingPoint PerspectivesRoot { get { return _rootPerspectiveAttachingPoint; } }\r\n\r\n        /// <summary>\r\n        /// Attaching point for the C1 Console Content perspective\r\n        /// </summary>\r\n        public static AttachingPoint ContentPerspective { get { return _contentPerspectiveAttachingPoint; } }\r\n\r\n        /// <summary>\r\n        /// Attaching point for the Website Items folder in the C1 Console Content perspective\r\n        /// </summary>\r\n        public static AttachingPoint ContentPerspectiveWebsiteItems { get { return _contentPerspectiveWebsiteItemsAttachingPoint; } }\r\n\r\n        /// <summary>\r\n        /// Attaching point for the C1 Console Media perspective\r\n        /// </summary>\r\n        /// \r\n        public static AttachingPoint MediaPerspective { get { return _mediaPerspectiveAttachingPoint; } }\r\n\r\n        /// <summary>\r\n        /// Attaching point for the C1 Console Data perspective\r\n        /// </summary>\r\n        public static AttachingPoint DataPerspective { get { return _dataPerspectiveAttachingPoint; } }\r\n\r\n        /// <exclude />\r\n        public static AttachingPoint DesignPerspective { get { return _designPerspectiveAttachingPoint; } }\r\n\r\n        /// <summary>\r\n        /// Attaching point for the C1 Console Layout perspective\r\n        /// </summary>\r\n        public static AttachingPoint LayoutPerspective { get { return _designPerspectiveAttachingPoint; } }\r\n\r\n        /// <summary>\r\n        /// Attaching point for the C1 Console Function perspective\r\n        /// </summary>\r\n        public static AttachingPoint FunctionPerspective { get { return _functionPerspectiveAttachingPoint; } }\r\n\r\n        /// <summary>\r\n        /// Attaching point for the C1 Console System perspective\r\n        /// </summary>\r\n        public static AttachingPoint SystemPerspective { get { return _systemPerspectiveAttachingPoint; } }\r\n\r\n        private EntityToken _entityToken;\r\n\r\n        internal AttachingPoint(EntityToken entityToken = null)\r\n        {\r\n            _entityToken = entityToken;\r\n        }\r\n\r\n\r\n\r\n        internal AttachingPoint(AttachingPoint attachingPoint)\r\n        {\r\n            _entityToken = attachingPoint._entityToken;\r\n            EntityTokenType = attachingPoint.EntityTokenType;\r\n            Id = attachingPoint.Id;\r\n            Source = attachingPoint.Source;\r\n        }\r\n\r\n\r\n        internal Type EntityTokenType { get; set; }\r\n        internal string Id { get; set; }\r\n        internal string Source { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The <see cref=\"EntityToken\"/> for this attachment point\r\n        /// </summary>\r\n        public EntityToken EntityToken\r\n        {\r\n            get\r\n            {\r\n                if (_entityToken == null)\r\n                {                    \r\n                    if (this.EntityTokenType == typeof(VirtualElementProviderEntityToken))\r\n                    {\r\n                        _entityToken = new VirtualElementProviderEntityToken(BuildInVirtualElementProviderName, this.Id);\r\n                    }\r\n                    else if (this.EntityTokenType == typeof(GeneratedDataTypesElementProviderRootEntityToken))\r\n                    {\r\n                        _entityToken = new GeneratedDataTypesElementProviderRootEntityToken(this.Source, this.Id);\r\n                    }\r\n                    else\r\n                    {\r\n                        Verify.IsNotNull(EntityTokenType, \"EntityTokenType is null\");\r\n                        throw new InvalidOperationException(\"Invalid entity token type: \" + EntityTokenType.FullName);\r\n                    }\r\n                }\r\n\r\n                return _entityToken;\r\n            }\r\n        }\r\n\r\n        internal static AttachingPoint VirtualElementAttachingPoint(string elementId, string source = BuildInVirtualElementProviderName)\r\n        {\r\n            return new AttachingPoint\r\n            {\r\n                EntityTokenType = typeof(VirtualElementProviderEntityToken),\r\n                Id = elementId,\r\n                Source = source\r\n            };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/DialogStrings.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Serializable]\r\n    public sealed class DialogStrings\r\n    {\r\n        /// <exclude />\r\n        public string Title { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Text { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Element.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Flags]\r\n    public enum ElementExternalActionAdding\r\n    {\r\n        /// <exclude />\r\n        AllowGlobal = 1,\r\n\r\n        /// <exclude />\r\n        AllowProcessController = 2,\r\n\r\n        /// <exclude />\r\n        AllowManageUserPermissions = 4 \r\n    }\r\n\r\n\r\n\r\n    internal static class ElementExternalActionAddingExtensions\r\n    {\r\n        public static ElementExternalActionAdding Remove(this ElementExternalActionAdding currentValue, ElementExternalActionAdding valueToRemove)\r\n        {\r\n            if ((currentValue & valueToRemove) == valueToRemove)\r\n            {\r\n                currentValue = currentValue ^ valueToRemove;\r\n            }\r\n\r\n            return currentValue;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary> \r\n    /// Define a tree element to be displayed in the C1 Console tree structure\r\n    /// </summary>\r\n    [DebuggerDisplay(\"{VisualData.Label}\")]\r\n    public sealed class Element\r\n    {\r\n        private ElementHandle _elementHandle;\r\n        private List<ElementAction> _elementActions = new List<ElementAction>();\r\n        private Dictionary<string, string> _propertyBag = new Dictionary<string, string>();\r\n\r\n\r\n        private Element()\r\n        {\r\n            this.MovabilityInfo = new ElementDragAndDropInfo();\r\n            this.ElementExternalActionAdding = ElementExternalActionAdding.AllowGlobal | ElementExternalActionAdding.AllowProcessController | ElementExternalActionAdding.AllowManageUserPermissions;\r\n            this.TreeLockBehavior = TreeLockBehavior.Normal;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new <see cref=\"Element\"/> from the given <see cref=\" ElementHandle\"/>.\r\n        /// </summary>\r\n        /// <param name=\"elementHandle\"></param>\r\n        public Element(ElementHandle elementHandle)\r\n            : this()\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n\r\n            _elementHandle = elementHandle;            \r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new <see cref=\"Element\"/> from the given <see cref=\" ElementHandle\"/> and <see cref=\"ElementVisualizedData\"/>.\r\n        /// </summary>\r\n        /// <param name=\"elementHandle\"></param>\r\n        /// <param name=\"visualData\"></param>\r\n        public Element(ElementHandle elementHandle, ElementVisualizedData visualData)\r\n            : this()\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n            if (visualData == null) throw new ArgumentNullException(\"visualData\");\r\n            \r\n            _elementHandle = elementHandle;\r\n\r\n            this.VisualData = visualData;            \r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new <see cref=\"Element\"/> from the given <see cref=\" ElementHandle\"/> and <see cref=\"ElementDragAndDropInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"elementHandle\"></param>\r\n        /// <param name=\"movabilityInfo\"></param>\r\n        public Element(ElementHandle elementHandle, ElementDragAndDropInfo movabilityInfo)\r\n            : this()\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n            if (movabilityInfo == null) throw new ArgumentNullException(\"movabilityInfo\");\r\n\r\n            _elementHandle = elementHandle;\r\n            this.MovabilityInfo = movabilityInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new <see cref=\"Element\"/> from the given <see cref=\" ElementHandle\"/>, <see cref=\"ElementVisualizedData\"/> and <see cref=\"ElementDragAndDropInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"elementHandle\"></param>\r\n        /// <param name=\"visualData\"></param>\r\n        /// <param name=\"movabilityInfo\"></param>\r\n        public Element(ElementHandle elementHandle, ElementVisualizedData visualData, ElementDragAndDropInfo movabilityInfo)\r\n            : this()\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n            if (visualData == null) throw new ArgumentNullException(\"visualData\");\r\n            if (movabilityInfo == null) throw new ArgumentNullException(\"movabilityInfo\");\r\n            \r\n            _elementHandle = elementHandle;\r\n\r\n            this.VisualData = visualData;\r\n            this.MovabilityInfo = movabilityInfo;            \r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The <see cref=\"ElementHandle\"/> for this Element.\r\n        /// </summary>\r\n        public ElementHandle ElementHandle\r\n        {\r\n            get { return _elementHandle; }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The <see cref=\"ElementVisualizedData\"/> for this Element.\r\n        /// </summary>\r\n        public ElementVisualizedData VisualData { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The <see cref=\"ElementDragAndDropInfo\"/> for this Element.\r\n        /// </summary>\r\n        public ElementDragAndDropInfo MovabilityInfo { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsLocaleAware { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Custom properties to attach to this Element\r\n        /// </summary>\r\n        public Dictionary<string, string> PropertyBag\r\n        {\r\n            get { return _propertyBag; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string TagValue { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public TreeLockBehavior TreeLockBehavior { get; set; }\r\n\r\n\r\n        #region Action methods\r\n        /// <exclude />\r\n        public ElementExternalActionAdding ElementExternalActionAdding\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int ActionCount\r\n        {\r\n            get\r\n            {\r\n                return _elementActions.Count;\r\n            }\r\n\r\n        }\r\n\r\n        internal void AddWorkflowAction(string workflowType, IEnumerable<PermissionType> permissionType, ActionVisualizedData visualizedData)\r\n        {\r\n            Type type = WorkflowFacade.GetWorkflowType(workflowType);\r\n\r\n            this.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(type, permissionType)))\r\n                               {\r\n                                   VisualData = visualizedData\r\n                               });\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Add an action to the element\r\n        /// </summary>\r\n        /// <param name=\"elementAction\">The action to add</param>\r\n        public void AddAction(ElementAction elementAction)\r\n        {\r\n            Verify.ArgumentNotNull(elementAction, \"elementAction\");\r\n\r\n            if (_elementActions.Contains(elementAction) == false)\r\n            {\r\n                _elementActions.Add(elementAction);\r\n            }\r\n            else\r\n            {\r\n                LoggingService.LogWarning(\"Element\", string.Format(\"An action with the same action token type '{0}' and same serialized string '{1}' has already been added\", elementAction.ActionHandle.ActionToken.GetType(), elementAction.ActionHandle.ActionToken.Serialize()));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Add one or more actions to the element\r\n        /// </summary>\r\n        /// <param name=\"elementActions\">The actions to add</param>\r\n        public void AddAction(IEnumerable<ElementAction> elementActions)\r\n        {\r\n            Verify.ArgumentNotNull(elementActions, \"elementActions\");\r\n\r\n            foreach (ElementAction elementAction in elementActions)\r\n            {\r\n                AddAction(elementAction);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Remove an action from the element\r\n        /// </summary>\r\n        /// <param name=\"elementAction\">The action to remove</param>\r\n        public void RemoveAction(ElementAction elementAction)\r\n        {\r\n            if (elementAction == null) throw new ArgumentNullException(\"elementAction\");\r\n\r\n            _elementActions.Remove(elementAction);\r\n        }\r\n\r\n\r\n\r\n        internal void RemoveMovabilityInfo()\r\n        {\r\n            MovabilityInfo = new ElementDragAndDropInfo();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Actions declared on this element\r\n        /// </summary>\r\n        public IEnumerable<ElementAction> Actions\r\n        {\r\n            get { return _elementActions; }\r\n        }\r\n        #endregion\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as Element);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(Element element)\r\n        {\r\n            if (element == null) return false;\r\n\r\n            return element.ElementHandle.EntityToken.Equals(this.ElementHandle.EntityToken);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return this.ElementHandle.EntityToken.GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementAction.cs",
    "content": "using Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>\r\n    /// Define an action you can attach to an <see cref=\"Element\"/>.\r\n    /// </summary>\r\n    public sealed class ElementAction\r\n    {\r\n        /// <summary>\r\n        /// Constructs a new instance.\r\n        /// </summary>\r\n        /// <param name=\"actionHandle\"></param>\r\n        public ElementAction(ActionHandle actionHandle)\r\n        {\r\n            Verify.ArgumentNotNull(actionHandle, nameof(actionHandle));\r\n\r\n            ActionHandle = actionHandle;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance.\r\n        /// </summary>\r\n        /// <param name=\"actionToken\"></param>\r\n        public ElementAction(ActionToken actionToken): this(new ActionHandle(actionToken))\r\n        {\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The action handle\r\n        /// </summary>\r\n        public ActionHandle ActionHandle { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// The visual representation (label, icon) of the action\r\n        /// </summary>\r\n        public ActionVisualizedData VisualData { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string TagValue { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode() => this.ActionHandle.GetHashCode();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementActionActivePosition.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// Where an action should be shown visually. One or more may be selected.\r\n    /// </summary>\r\n    [Flags]\r\n    public enum ElementActionActivePosition\r\n    {\r\n        /// <summary>\r\n        /// Available in the C1 Consoles default navigation tree.\r\n        /// </summary>\r\n        NavigatorTree = 1,\r\n\r\n        /// <summary>\r\n        /// Available in trees used for item selection (typically shown via pop ups).\r\n        /// </summary>\r\n        SelectorTree = 2,\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementActionSecurityExtensions.cs",
    "content": "﻿//#warning REMARK THIS!!!\n//#define NO_SECURITY\nusing System;\nusing System.Collections.Generic;\nusing Composite.C1Console.Security;\nusing Composite.Core.Linq;\nusing Composite.Plugins.Elements.ElementProviders.PageElementProvider;\n\n\nnamespace Composite.C1Console.Elements\n{\n    /// <summary>\n    /// Extension methods related to security on element actions.\n    /// </summary>\n    public static class ElementActionSecurityExtensions\n    {\n        /// <summary>\n        /// Will filter actions (according to current users permissions) attached on the elements\n        /// </summary>\n        /// <param name=\"elements\">Elements to filder</param>\n        /// <returns>New sequence of elements, with actions filtered</returns>\n        public static IEnumerable<Element> FilterElementsAndActions(this IEnumerable<Element> elements)\n        {\n            Verify.ArgumentNotNull(elements, nameof(elements));\n\n#if NO_SECURITY\n                return elements;\n#else\n            UserToken userToken = UserValidationFacade.GetUserToken();\n\n            var userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username).Evaluate();\n            var userGroupPermissionDefinition = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username).Evaluate();\n\n            return elements\n                .FilterElements(userToken, userPermissionDefinitions, userGroupPermissionDefinition)\n                .FilterActions(userToken, userPermissionDefinitions, userGroupPermissionDefinition);\n#endif\n        }\n\n        internal static IEnumerable<Element> FilterElements(this IEnumerable<Element> elements)\n        {\n#if NO_SECURITY\n                return elements;\n#endif\n\n            var userToken = UserValidationFacade.GetUserToken();\n\n            var userPermissions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username).Evaluate();\n            var userGroupPermissions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username).Evaluate();\n\n            return FilterElements(elements, userToken, userPermissions, userGroupPermissions);\n        }\n\n        internal static IEnumerable<Element> FilterElements(this IEnumerable<Element> elements,\n            UserToken userToken,\n            ICollection<UserPermissionDefinition> userPermissionDefinitions,\n            ICollection<UserGroupPermissionDefinition> userGroupPermissionDefinition)\n        {\n            Verify.ArgumentNotNull(elements, nameof(elements));\n\n#if NO_SECURITY\n                return elements;\n#else\n            foreach (Element element in elements)\n            {\n                if (PermissionTypeFacade.IsSubBrachContainingPermissionTypes(userToken,\n                    element.ElementHandle.EntityToken, userPermissionDefinitions, userGroupPermissionDefinition))\n                {\n                    yield return element;\n                }\n            }\n#endif\n        }\n\n\n        internal static IEnumerable<Element> FilterActions(this IEnumerable<Element> elements)\n        {\n#if NO_SECURITY\n                return elements;\n#endif\n\r\n            var userToken = UserValidationFacade.GetUserToken();\n\n            var userPermissions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username).Evaluate();\n            var userGroupPermissions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username).Evaluate();\n\n            return FilterActions(elements, userToken, userPermissions, userGroupPermissions);\n        }\n\n\n        internal static IEnumerable<Element> FilterActions(this IEnumerable<Element> elements,\n            UserToken userToken,\n            ICollection<UserPermissionDefinition> userPermissionDefinitions,\n            ICollection<UserGroupPermissionDefinition> userGroupPermissionDefinition)\n        {\n            Verify.ArgumentNotNull(elements, nameof(elements));\n\n#if NO_SECURITY\n                return elements;\n#else\n            foreach (var element in elements)\n            {\n                var actionsToRemove = new List<ElementAction>();\n                foreach (ElementAction elementAction in element.Actions)\n                {\n                    if (SecurityResolver.Resolve(userToken, elementAction.ActionHandle.ActionToken,\n                            element.ElementHandle.EntityToken, userPermissionDefinitions,\n                            userGroupPermissionDefinition) == SecurityResult.Disallowed)\n                    {\n                        actionsToRemove.Add(elementAction);\n                    }\n                }\n\n                foreach (ElementAction elementAction in actionsToRemove)\n                {\n                    element.RemoveAction(elementAction);\n                }\n\n                // Drag & drop security\n                if (element.MovabilityInfo != null)\n                {\n                    if (SecurityResolver.Resolve(userToken, new DragAndDropActionToken(),\n                            element.ElementHandle.EntityToken, userPermissionDefinitions,\n                            userGroupPermissionDefinition) == SecurityResult.Disallowed)\n                    {\n                        element.RemoveMovabilityInfo();\n                    }\n                }\n\n                yield return element;\r\n            }\n#endif\n        }\n    }\n}"
  },
  {
    "path": "Composite/C1Console/Elements/ElementAttachingPointFacade.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.VirtualElementProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <exclude />\r\n    public static class ElementAttachingPointFacade\r\n    {\r\n        /// <exclude />\r\n        public static bool IsAttachingPoint(EntityToken entityToken, AttachingPoint attachingPoint)\r\n        {\r\n            return attachingPoint.Id == entityToken.Id\r\n                   && attachingPoint.Source == entityToken.Source\r\n                   && attachingPoint.EntityTokenType == entityToken.GetType();\r\n\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsAttachingPoint(EntityToken leftEntityToken, EntityToken rightEntityToken)\r\n        {\r\n            return leftEntityToken.GetType() == rightEntityToken.GetType()\r\n                   && leftEntityToken.Id == rightEntityToken.Id\r\n                   && leftEntityToken.Type == rightEntityToken.Type\r\n                   && leftEntityToken.Source == rightEntityToken.Source;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static AttachingPoint GetAttachingPoint(EntityToken entityToken)\r\n        {\r\n            if (entityToken is VirtualElementProviderEntityToken)\r\n            {\r\n                return AttachingPoint.VirtualElementAttachingPoint(entityToken.Id, entityToken.Source);\r\n            }\r\n\r\n            if (IsAttachingPoint(entityToken, AttachingPoint.ContentPerspectiveWebsiteItems))\r\n            {\r\n                return AttachingPoint.ContentPerspectiveWebsiteItems;\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementDataExchangeService.cs",
    "content": "﻿using System;\r\n\r\nusing Composite.C1Console.Elements.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    internal sealed class ElementDataExchangeService : IElementDataExchangeService\r\n    {\r\n        public ElementDataExchangeService(string elementProviderName)\r\n        {\r\n            this.ElementProviderName = elementProviderName;\r\n        }\r\n\r\n        private string ElementProviderName { get; set; }\r\n\r\n        public object GetData(string name)\r\n        {\r\n            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(\"name\");\r\n\r\n            return ElementFacade.GetData(new ElementProviderHandle(this.ElementProviderName), name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementDragAndDropInfo.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// Details describing how this element may be dragged or accept dragged elements\r\n    /// </summary>\r\n    public sealed class ElementDragAndDropInfo\r\n    {\r\n        private List<string> _dropHashTypeIdentifiers = null;\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance.\r\n        /// </summary>\r\n        internal ElementDragAndDropInfo()\r\n        {\r\n            this.DragType = null;\r\n            this.SupportsIndexedPosition = false;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance.\r\n        /// </summary>\r\n        /// <param name=\"movabilityType\">Declare what this element is in terms of drag and drop by declaring a <see cref=\"System.Type\"/>. \r\n        /// Element providers accepting drag and drop of this type will accept this.</param>\r\n        public ElementDragAndDropInfo(Type movabilityType)\r\n        {\r\n            this.DragType = movabilityType;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Identifies a type of element in relation to movability. Used in conjunction with the AdoptTypeAcceptList.\r\n        /// Use the MovabilitySubType to distinguish sub types.\r\n        /// </summary>\r\n        public Type DragType { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Optional. If the element provider presents data from multiple sources that can not exchange data and you \r\n        /// can not communicate a unique source using a Type alone, use this field to distinguish the source.\r\n        /// </summary>\r\n        public string DragSubType { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public bool SupportsIndexedPosition { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddDropType(Type acceptMovabilityType)\r\n        {\r\n            this.AddDropType(acceptMovabilityType, \"\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddDropType(Type acceptMovabilityType, string acceptMovabilitySubType)\r\n        {\r\n            if (_dropHashTypeIdentifiers == null) _dropHashTypeIdentifiers = new List<string>();\r\n\r\n            _dropHashTypeIdentifiers.Add(BuildHashedTypeIdentifier(acceptMovabilityType, acceptMovabilitySubType));\r\n        }\r\n\r\n\r\n\r\n        internal string GetHashedTypeIdentifier()\r\n        {\r\n            return BuildHashedTypeIdentifier(this.DragType, this.DragSubType);\r\n        }\r\n\r\n\r\n        internal List<string> GetDropHashTypeIdentifiers()\r\n        {\r\n            return _dropHashTypeIdentifiers;\r\n        }\r\n\r\n\r\n\r\n        private static string BuildHashedTypeIdentifier(Type type, string subType)\r\n        {\r\n            return string.Format(\"{0}:{1}:{2}\", type.Name, subType, type.AssemblyQualifiedName.GetHashCode());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing Composite.Core.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements.Foundation;\r\nusing Composite.C1Console.Elements.Foundation.PluginFacades;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Plugins.Elements.ElementProviders.VirtualElementProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ElementFacade\r\n    {\r\n        private static IEnumerable<EntityToken> _perspectiveEntityTokens;\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetRoots(SearchToken searchToken)\r\n        {\r\n            return GetRoots(ElementProviderRegistry.RootElementProviderName, searchToken, true, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetRoots(ElementProviderHandle elementProviderHandle, SearchToken searchToken)\r\n        {\r\n            if (elementProviderHandle == null) throw new ArgumentNullException(\"elementProviderHandle\");\r\n\r\n            return GetRoots(elementProviderHandle.ProviderName, searchToken, true, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetChildren(ElementHandle elementHandle, SearchToken searchToken)\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n\r\n            return GetChildren(elementHandle, searchToken, true, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<LabeledProperty> GetLabeledProperties(ElementHandle elementHandle)\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n\r\n            return ElementProviderPluginFacade.GetLabeledProperties(elementHandle.ProviderName, elementHandle.EntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool ContainsLocalizedData(ElementProviderHandle elementProviderHandle)\r\n        {\r\n            if (elementProviderHandle == null) throw new ArgumentNullException(\"elementProviderHandle\");\r\n\r\n            if (ElementProviderPluginFacade.IsLocaleAwareElementProvider(elementProviderHandle.ProviderName) == false) return false;\r\n\r\n            return ElementProviderPluginFacade.ContainsLocalizedData(elementProviderHandle.ProviderName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetForeignRoots(SearchToken searchToken)\r\n        {\r\n            return GetRoots(ElementProviderRegistry.RootElementProviderName, searchToken, true, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetForeignRoots(ElementProviderHandle elementProviderHandle, SearchToken searchToken)\r\n        {\r\n            if (elementProviderHandle == null) throw new ArgumentNullException(\"elementProviderHandle\");\r\n\r\n            return GetRoots(elementProviderHandle.ProviderName, searchToken, true, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetForeignChildren(ElementHandle elementHandle, SearchToken searchToken)\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n\r\n            return GetChildren(elementHandle, searchToken, true, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<LabeledProperty> GetForeignLabeledProperties(ElementHandle elementHandle)\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n\r\n            if (ElementProviderPluginFacade.IsLocaleAwareElementProvider(elementHandle.ProviderName))\r\n            {\r\n                return ElementProviderPluginFacade.GetForeignLabeledProperties(elementHandle.ProviderName, elementHandle.EntityToken);\r\n            }\r\n\r\n            return ElementProviderPluginFacade.GetLabeledProperties(elementHandle.ProviderName, elementHandle.EntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static object GetData(ElementProviderHandle elementProviderHandle, string dataName)\r\n        {\r\n            if (elementProviderHandle == null) throw new ArgumentNullException(\"elementProviderHandle\");\r\n            if (string.IsNullOrEmpty(dataName)) throw new ArgumentNullException(\"dataName\");\r\n\r\n            return ElementProviderPluginFacade.GetData(elementProviderHandle.ProviderName, dataName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool ExecuteElementDraggedAndDropped(ElementHandle draggedElementHandle, ElementHandle newParentElementHandle, int dropIndex, bool isCopy, FlowControllerServicesContainer draggedElementFlowControllerServicesContainer)\r\n        {\r\n            if (draggedElementHandle == null) throw new ArgumentNullException(\"draggedElementHandle\");\r\n            if (newParentElementHandle == null) throw new ArgumentNullException(\"newParentElementHandle\");\r\n            if (draggedElementFlowControllerServicesContainer == null) throw new ArgumentNullException(\"draggedElementFlowControllerServicesContainer\");\r\n\r\n            if (draggedElementHandle.Equals(newParentElementHandle))\r\n            {\r\n                LoggingService.LogError(\"ElementFacade\", \"ExecuteElementDraggedAndDropped on the same element is not allowed\");\r\n                return false;\r\n            }\r\n\r\n            DragAndDropType dragAndDropType = DragAndDropType.Move;\r\n            if (isCopy)\r\n            {\r\n                dragAndDropType = DragAndDropType.Copy;\r\n            }\r\n\r\n            return ElementProviderPluginFacade.OnElementDraggedAndDropped(draggedElementHandle.ProviderName, draggedElementHandle.EntityToken, newParentElementHandle.EntityToken, dropIndex, dragAndDropType, draggedElementFlowControllerServicesContainer);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static SearchToken GetNewSearchToken(ElementHandle elementHandle)\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n\r\n            SearchToken searchToken;\r\n\r\n            if (ElementProviderPluginFacade.GetNewSearchToken(elementHandle.ProviderName, elementHandle.EntityToken, out searchToken) == false)\r\n            {\r\n                return new SearchToken();\r\n            }\r\n\r\n            return searchToken;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XmlReader GetSearchFormMarkup(ElementHandle elementHandle)\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n\r\n            XmlReader formDefinition;\r\n\r\n            if (ElementProviderPluginFacade.GetSearchFormDefinition(elementHandle.ProviderName, elementHandle.EntityToken, out formDefinition) == false)\r\n            {\r\n                IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(\"/Administrative/ElementKeywordSearch.xml\");\r\n\r\n                return markupProvider.GetReader();\r\n            }\r\n\r\n            return formDefinition;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<string, object> GetSearchFormBindings(ElementHandle elementHandle)\r\n        {\r\n            if (elementHandle == null) throw new ArgumentNullException(\"elementHandle\");\r\n\r\n            Dictionary<string, object> bindings;\r\n\r\n            if (ElementProviderPluginFacade.GetSearchFormBindings(elementHandle.ProviderName, elementHandle.EntityToken, out bindings) == false)\r\n            {\r\n                return new Dictionary<string, object>();\r\n            }\r\n\r\n            return bindings;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetRootsWithNoSecurity()\r\n        {\r\n            return GetRoots(ElementProviderRegistry.RootElementProviderName, null, false, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetRootsWithNoSecurity(ElementProviderHandle elementProviderHandle, SearchToken searchToken)\r\n        {\r\n            if (elementProviderHandle == null) throw new ArgumentNullException(\"elementProviderHandle\");\r\n\r\n            return GetRoots(elementProviderHandle.ProviderName, searchToken, false, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetPerspectiveElements(bool performSecurityCheck)\r\n        {\r\n            IEnumerable<ElementHandle> rootElementHandles = GetRoots(ElementProviderRegistry.RootElementProviderName, null, performSecurityCheck, false).Select(f => f.ElementHandle);\r\n\r\n            foreach (ElementHandle rootElementHandle in rootElementHandles)\r\n            {\r\n                IEnumerable<Element> perspectiveElements = GetChildren(rootElementHandle, null, performSecurityCheck, false);\r\n\r\n                foreach (Element perspectiveElement in perspectiveElements)\r\n                {\r\n                    yield return perspectiveElement;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Element> GetPerspectiveElementsWithNoSecurity()\r\n        {\r\n            return GetPerspectiveElements(false);\r\n        }\r\n\r\n\r\n        internal static bool IsPerspectiveEntityToken(EntityToken entityToken)\r\n        {\r\n            if (!(entityToken is VirtualElementProviderEntityToken))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (_perspectiveEntityTokens == null)\r\n            {\r\n                _perspectiveEntityTokens =\r\n                    GetPerspectiveElementsWithNoSecurity().Select(e => e.ElementHandle.EntityToken).ToList();\r\n            }\r\n\r\n            return _perspectiveEntityTokens.Contains(entityToken);\r\n        }\r\n\r\n\r\n        internal static bool IsLocaleAwareElementProvider(ElementProviderHandle elementProviderHandle)\r\n        {\r\n            if (elementProviderHandle == null) throw new ArgumentNullException(\"elementProviderHandle\");\r\n\r\n            return ElementProviderPluginFacade.IsLocaleAwareElementProvider(elementProviderHandle.ProviderName);\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<Element> GetRoots(string providerName, SearchToken searchToken, bool performSecurityCheck, bool useForeign)\r\n        {\r\n            if (providerName == null) throw new ArgumentNullException(\"providerName\");\r\n            \r\n            IEnumerable<Element> roots;\r\n\r\n            try\r\n            {\r\n                if (!useForeign || !ElementProviderPluginFacade.IsLocaleAwareElementProvider(providerName))\r\n                {\r\n                    roots = ElementProviderPluginFacade.GetRoots(providerName, searchToken).ToList();\r\n                }\r\n                else\r\n                {\r\n                    roots = ElementProviderPluginFacade.GetForeignRoots(providerName, searchToken).ToList();\r\n                }\r\n            }\r\n            catch (Exception ex) when (providerName != ElementProviderRegistry.RootElementProviderName)\r\n            {\r\n                Log.LogError(nameof(ElementFacade), $\"Failed to get root elements for element provider '{providerName}'\");\r\n                Log.LogError(nameof(ElementFacade), ex);\r\n\r\n                return Enumerable.Empty<Element>();\r\n            }\r\n            \r\n\r\n            if (performSecurityCheck)\r\n            {\r\n                roots = roots.FilterElements();\r\n            }\r\n\r\n            ElementActionProviderFacade.AddActions(roots, providerName);\r\n\r\n            if (performSecurityCheck)\r\n            {\r\n                return roots.FilterActions();\r\n            }\r\n\r\n            return roots;\r\n        }\r\n\r\n\r\n        private static IEnumerable<Element> GetChildrenFromProvider(ElementHandle elementHandle, SearchToken searchToken, bool useForeign)\r\n        {\r\n            if (ElementProviderRegistry.ElementProviderNames.Contains(elementHandle.ProviderName))\r\n            {\r\n                if (!useForeign || !ElementProviderPluginFacade.IsLocaleAwareElementProvider(elementHandle.ProviderName))\r\n                {\r\n                    return ElementProviderPluginFacade.GetChildren(elementHandle.ProviderName, elementHandle.EntityToken, searchToken);\r\n                }\r\n\r\n                return ElementProviderPluginFacade.GetForeignChildren(elementHandle.ProviderName, elementHandle.EntityToken, searchToken);\r\n            }\r\n\r\n            if (ElementAttachingProviderRegistry.ElementAttachingProviderNames.Contains(elementHandle.ProviderName))\r\n            {\r\n                return ElementAttachingProviderPluginFacade.GetChildren(elementHandle.ProviderName, elementHandle.EntityToken, elementHandle.Piggyback);\r\n            }\r\n\r\n            throw new InvalidOperationException($\"No element provider named '{elementHandle.ProviderName}' found\");\r\n        }\r\n\r\n\r\n        private static IEnumerable<Element> GetChildren(ElementHandle elementHandle, SearchToken searchToken, bool performSecurityCheck, bool useForeign)\r\n        {\r\n            Verify.ArgumentNotNull(elementHandle, nameof(elementHandle));\r\n\r\n            var performanceToken = PerformanceCounterFacade.BeginElementCreation();\r\n\r\n            var children = GetChildrenFromProvider(elementHandle, searchToken, useForeign).Evaluate();\r\n\r\n            var originalChildren = children;\r\n\r\n            children = ElementAttachingProviderFacade.AttachElements(elementHandle.EntityToken, elementHandle.Piggyback, children).Evaluate();\r\n\r\n            int totalElementCount = children.Count;\r\n\r\n            if (performSecurityCheck)\r\n            {\r\n                children = children.FilterElements().Evaluate();\r\n            }\r\n\r\n            // Evaluating HasChildren for not attached elements\r\n            foreach (Element element in originalChildren)\r\n            {\r\n                if (children.Contains(element) && !element.VisualData.HasChildren)\r\n                {\r\n                    element.VisualData.HasChildren = ElementAttachingProviderFacade.HaveCustomChildElements(element.ElementHandle.EntityToken, element.ElementHandle.Piggyback);\r\n                }\r\n            }\r\n\r\n            ElementActionProviderFacade.AddActions(children, elementHandle.ProviderName);\r\n\r\n            if (performSecurityCheck)\r\n            {\r\n                children = children.FilterActions().Evaluate();\r\n            }\r\n\r\n            PerformanceCounterFacade.EndElementCreation(performanceToken, children.Count, totalElementCount);\r\n\r\n            return children;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementHandle.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// An \"identity token\" which identifies a specific element from a specific provider. \r\n    /// </summary>\r\n    public sealed class ElementHandle\r\n    {\r\n        private readonly string _providerName;\r\n        private readonly EntityToken _entityToken;\r\n        private string _serializedPiggyback = null;\r\n        Dictionary<string, string> _piggyback = null;\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new ElementHandle\r\n        /// </summary>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        public ElementHandle(string providerName, EntityToken entityToken)\r\n            : this(providerName, entityToken, (string)null)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new ElementHandle\r\n        /// </summary>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"piggyback\"></param>\r\n        public ElementHandle(string providerName, EntityToken entityToken, Dictionary<string, string> piggyback)\r\n        {\r\n            Verify.ArgumentNotNull(piggyback, \"piggyback\");\r\n\r\n            _providerName = providerName;\r\n            _entityToken = entityToken;\r\n            _piggyback = piggyback;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new ElementHandle\r\n        /// </summary>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"piggyback\"></param>\r\n        public ElementHandle(string providerName, EntityToken entityToken, string piggyback)\r\n        {\r\n            if (piggyback == null)\r\n            {\r\n                piggyback = string.Empty;\r\n            }\r\n\r\n            _providerName = providerName;\r\n            _entityToken = entityToken;\r\n\r\n            _serializedPiggyback = piggyback;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Name of provider this ElementHandle originate from\r\n        /// </summary>\r\n        public string ProviderName\r\n        {\r\n            get { return _providerName; }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The entity token of the element\r\n        /// </summary>\r\n        public EntityToken EntityToken\r\n        {\r\n            get { return _entityToken; }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Custom values appended to this ElementHandle\r\n        /// </summary>\r\n        public Dictionary<string, string> Piggyback\r\n        {\r\n            get\r\n            {\r\n                if (_piggyback == null)\r\n                {\r\n                    string serialized = _serializedPiggyback;\r\n                    Verify.IsNotNull(serialized, \"Serialized state is NULL\");\r\n\r\n                    _piggyback = PiggybagSerializer.Deserialize(_serializedPiggyback);\r\n                }\r\n\r\n                return _piggyback;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string SerializedPiggyback\r\n        {\r\n            get\r\n            {\r\n                if (_serializedPiggyback == null)\r\n                {\r\n                    _serializedPiggyback = PiggybagSerializer.Serialize(this.Piggyback);\r\n                }\r\n\r\n                return _serializedPiggyback;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as ElementHandle);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(ElementHandle elementHandle)\r\n        {\r\n            if (elementHandle == null) return false;\r\n\r\n            if ((elementHandle.EntityToken.Equals(this.EntityToken) == false) || (elementHandle.ProviderName != this.ProviderName)) return false;\r\n\r\n            if (elementHandle.Piggyback.Count != this.Piggyback.Count) return false;\r\n\r\n            foreach (KeyValuePair<string, string> kvp in elementHandle.Piggyback)\r\n            {\r\n                string value;\r\n                if (this.Piggyback.TryGetValue(kvp.Key, out value) == false) return false;\r\n\r\n                if (kvp.Value != value) return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            int hashCode = this._providerName.GetHashCode() ^ _entityToken.GetHashCode();\r\n\r\n            foreach (KeyValuePair<string, string> kvp in this.Piggyback)\r\n            {\r\n                hashCode ^= kvp.Key.GetHashCode();\r\n                hashCode ^= kvp.Value.GetHashCode();\r\n            }\r\n\r\n            return hashCode;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementHookRegistratorFacade.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Elements.Foundation;\r\nusing Composite.C1Console.Elements.Foundation.PluginFacades;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    internal static class ElementHookRegistratorFacade\r\n    {\r\n        private static readonly string LogTitle = typeof (ElementHookRegistratorFacade).Name;\r\n\r\n        public static IEnumerable<EntityTokenHook> GetHooks()\r\n        {\r\n            int tt1 = System.Environment.TickCount;\r\n\r\n            var hooks = new List<EntityTokenHook>();\r\n\r\n            foreach (string providerName in ElementProviderRegistry.ElementProviderNames)\r\n            {\r\n                if (!ElementProviderRegistry.IsProviderHookingProvider(providerName)) continue;\r\n\r\n                int t1 = System.Environment.TickCount;\r\n                hooks.AddRange(ElementProviderPluginFacade.GetHooks(providerName));\r\n                int t2 = System.Environment.TickCount;\r\n\r\n                Log.LogVerbose(LogTitle, \"Time for {0}: {1} ms\", providerName, t2 - t1);\r\n            }\r\n\r\n            int tt2 = System.Environment.TickCount;\r\n\r\n            Log.LogVerbose(LogTitle, \"Total time for: {0} ms\", tt2 - tt1);\r\n\r\n            return hooks;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementInformationService.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    internal class ElementInformationService : IElementInformationService\r\n\t{\r\n        private ElementHandle _elementHandle;\r\n\r\n\r\n        public ElementInformationService(ElementHandle elementHandle)\r\n        {\r\n            _elementHandle = elementHandle;\r\n        }\r\n\r\n\r\n\r\n        public string ProviderName\r\n        {\r\n            get \r\n            { \r\n                return _elementHandle.ProviderName; \r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<string, string> Piggyback\r\n        {\r\n            get \r\n            {\r\n                return _elementHandle.Piggyback;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderContext.cs",
    "content": "using Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>   \r\n    /// Context assigned to element providers when they are constructed. Contains a helper method for constructing a provider specific <see cref=\"ElementHandle\"/> and the configuation based name of the provider.\r\n    /// </summary>\r\n    public sealed class ElementProviderContext\r\n    {\r\n        private string _providerName;\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance of <see cref=\"ElementProviderContext\"/>\r\n        /// </summary>\r\n        /// <param name=\"providerName\">Name of the provider</param>\r\n        public ElementProviderContext(string providerName)\r\n        {\r\n            _providerName = providerName;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Created a provider instance (based on name) specific <see cref=\"ElementHandle\"/> for a given <see cref=\"EntityToken\"/>, making it possible to tie an entiry token to a specific provider instance. \r\n        /// </summary>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <returns></returns>\r\n        public ElementHandle CreateElementHandle(EntityToken entityToken)\r\n        {\r\n            return new ElementHandle(_providerName, entityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The name if the provider instance. This name typically originate from configuration. A given provider type may exist as multiple instances, but all with have a unique name.\r\n        /// </summary>\r\n        public string ProviderName\r\n        {\r\n            get { return _providerName; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHandle.cs",
    "content": "using System;\r\nusing System.Text;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ElementProviderHandle\r\n    {\r\n        private string _serializedData = null;\r\n\r\n\r\n        /// <exclude />\r\n        public ElementProviderHandle(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            this.ProviderName = providerName;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ProviderName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            return ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ElementProviderHandle Deserialize(string serializedElementHandle)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedElementHandle);\r\n\r\n            if (dic.ContainsKey(\"_providerName_\") == false)\r\n            {\r\n                throw new ArgumentException(\"The serializedElementProviderHandle is not a serialized element provider handle\", \"serializedElementProviderHandle\");\r\n            }\r\n\r\n            string providerName = StringConversionServices.DeserializeValueString(dic[\"_providerName_\"]);\r\n\r\n            return new ElementProviderHandle(providerName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            if (_serializedData == null)\r\n            {\r\n                StringBuilder sb = new StringBuilder();\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_providerName_\", ProviderName);\r\n\r\n                _serializedData = sb.ToString();\r\n            }\r\n\r\n            return _serializedData;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddAssociatedDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddAssociatedDataWorkflow\" Location=\"30; 30\" Size=\"1111; 958\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddAssociatedDataWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddAssociatedDataWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1031\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1031\" Y=\"853\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"selectTypeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"initialStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"selectTypeStateActivity\" SourceActivity=\"initialStateActivity\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"281\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"208\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"208\" Y=\"340\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"enterDataStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"enterDataStateActivity\" SourceActivity=\"initialStateActivity\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"281\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"593\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"enterDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"enterDataStateActivity\" EventHandlerName=\"enterDataEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"448\" Y=\"658\" />\r\n\t\t\t\t<ns0:Point X=\"473\" Y=\"658\" />\r\n\t\t\t\t<ns0:Point X=\"473\" Y=\"594\" />\r\n\t\t\t\t<ns0:Point X=\"658\" Y=\"594\" />\r\n\t\t\t\t<ns0:Point X=\"658\" Y=\"602\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"enterDataStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"enterDataStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"745\" Y=\"643\" />\r\n\t\t\t\t<ns0:Point X=\"768\" Y=\"643\" />\r\n\t\t\t\t<ns0:Point X=\"768\" Y=\"585\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"585\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"593\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"selectTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"selectTypeStateActivity\" EventHandlerName=\"selectTypeEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"323\" Y=\"429\" />\r\n\t\t\t\t<ns0:Point X=\"1031\" Y=\"429\" />\r\n\t\t\t\t<ns0:Point X=\"1031\" Y=\"853\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"selectTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"selectTypeStateActivity\" EventHandlerName=\"selectTypeEventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"313\" Y=\"405\" />\r\n\t\t\t\t<ns0:Point X=\"1031\" Y=\"405\" />\r\n\t\t\t\t<ns0:Point X=\"1031\" Y=\"853\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"951; 853\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initialStateActivity\" Location=\"88; 176\" Size=\"197; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 363\" Name=\"initialStateInitializationActivity\" Location=\"96; 207\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initialCodeActivity\" Location=\"221; 269\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity2\" Location=\"106; 329\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity3\" Location=\"125; 400\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"135; 462\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity4\" Location=\"298; 400\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"308; 462\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"enterDataStateActivity\" Location=\"228; 593\" Size=\"233; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"enterDataStateInitializationActivity\" Location=\"236; 624\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"enterDataCodeActivity\" Location=\"246; 686\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"enterDataEventDrivenActivity_Save\" Location=\"236; 648\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"246; 710\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"246; 770\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"556; 602\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveStateInitializationActivity\" Location=\"564; 633\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"574; 695\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"574; 755\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"selectTypeStateActivity\" Location=\"90; 340\" Size=\"237; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"selectTypeStateInitializationActivity\" Location=\"98; 371\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"selectTypeCodeActivity\" Location=\"108; 433\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"108; 493\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 302\" Name=\"selectTypeEventDrivenActivity_Next\" Location=\"98; 395\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity1\" Location=\"108; 457\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"selectTypeCodeActivity_Next\" Location=\"108; 517\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"108; 577\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"108; 637\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"selectTypeEventDrivenActivity_Cancel\" Location=\"98; 419\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"108; 481\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"108; 541\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AssociatedDataElementProviderHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    internal sealed class AssociatedDataElementProviderHelper<T> : IAuxiliarySecurityAncestorProvider\r\n        where T : class, IData\r\n    {\r\n        internal delegate void HooksChangedCallbackDelegate();\r\n\r\n        private readonly ElementProviderContext _elementProviderContext;\r\n        private EntityToken _rootEntityToken;\r\n        private bool _addVisualFunctionActions;\r\n\r\n        private ResourceHandle AddDataAssociationTypeIcon { get { return GetIconHandle(\"dataassociation-add-association\"); } }\r\n        private ResourceHandle EditDataAssociationTypeIcon { get { return GetIconHandle(\"dataassociation-edit-association\"); } }\r\n        private ResourceHandle RemoveDataAssociationTypeIcon { get { return GetIconHandle(\"dataassociation-remove-association\"); } }\r\n        public static ResourceHandle LocalizeDataTypeIcon { get { return GetIconHandle(\"generated-type-localize\"); } }\r\n        public static ResourceHandle DelocalizeDataTypeIcon { get { return GetIconHandle(\"generated-type-delocalize\"); } }\r\n        private ResourceHandle DataAssociationOpenIcon { get { return GetIconHandle(\"dataassociation-rootfolder-open\"); } }\r\n        private ResourceHandle DataAssociationClosedIcon { get { return GetIconHandle(\"dataassociation-rootfolder-closed\"); } }\r\n        private ResourceHandle InterfaceOpenIcon { get { return GetIconHandle(\"data-interface-open\"); } }\r\n        private ResourceHandle InterfaceClosedIcon { get { return GetIconHandle(\"data-interface-closed\"); } }\r\n\r\n        private ResourceHandle AddAssociatedDataIcon { get { return GetIconHandle(\"associated-data-add\"); } }\r\n        private ResourceHandle EditAssociatedDataIcon { get { return GetIconHandle(\"associated-data-edit\"); } }\r\n        private ResourceHandle DeleteAssociatedDataIcon { get { return GetIconHandle(\"associated-data-delete\"); } }\r\n        private ResourceHandle DuplicateAssociatedDataIcon { get { return GetIconHandle(\"copy\"); } }\r\n        public static ResourceHandle LocalizeDataIcon { get { return GetIconHandle(\"generated-type-data-localize\"); } }\r\n\r\n\r\n        public static readonly Dictionary<string, ResourceHandle> DataIconLookup;\r\n\r\n        internal static readonly PermissionType[] AddAssociatedTypePermissionTypes = { PermissionType.Configure, PermissionType.Administrate };\r\n        internal static readonly PermissionType[] EditAssociatedTypePermissionTypes = { PermissionType.Configure, PermissionType.Administrate };\r\n        internal static readonly PermissionType[] RemoveAssociatedTypePermissionTypes = { PermissionType.Configure, PermissionType.Administrate };\r\n        private static readonly PermissionType[] _addAssociatedDataPermissionTypes = { PermissionType.Add };\r\n        private static readonly PermissionType[] _editAssociatedDataPermissionTypes = { PermissionType.Edit };\r\n        private static readonly PermissionType[] _deleteAssociatedDataPermissionTypes = { PermissionType.Delete };\r\n        private static readonly PermissionType[] _localizeDataPermissionTypes = { PermissionType.Add };\r\n\r\n        private static readonly ActionGroup AppendedActionGroup = new ActionGroup(\"Associated data\", ActionGroupPriority.TargetedAppendMedium);\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n\r\n        private readonly DataGroupingProviderHelper.DataGroupingProviderHelper _dataGroupingProviderHelper;\r\n\r\n\r\n        static AssociatedDataElementProviderHelper()\r\n        {\r\n            DataIconLookup = new Dictionary<string, ResourceHandle>\r\n            {\r\n                {GenericPublishProcessController.Draft, DataIconFacade.DataDraftIcon},\r\n                {GenericPublishProcessController.AwaitingApproval, DataIconFacade.DataAwaitingApprovalIcon},\r\n                {GenericPublishProcessController.AwaitingPublication, DataIconFacade.DataAwaitingPublicationIcon},\r\n                {GenericPublishProcessController.Published, DataIconFacade.DataPublishedIcon}\r\n            };\r\n        }\r\n\r\n\r\n\r\n        public AssociatedDataElementProviderHelper(ElementProviderContext elementProviderContext, EntityToken rootEntityToken, bool addVisualFunctionActions)\r\n        {\r\n            _elementProviderContext = elementProviderContext ?? throw new ArgumentNullException(nameof(elementProviderContext));\r\n            _rootEntityToken = rootEntityToken ?? throw new ArgumentNullException(nameof(rootEntityToken));\r\n            _addVisualFunctionActions = addVisualFunctionActions;\r\n\r\n            _dataGroupingProviderHelper = new DataGroupingProviderHelper.DataGroupingProviderHelper(elementProviderContext)\r\n            {\r\n                OnOwnsType = type => typeof (IPageFolderData).IsAssignableFrom(type)\r\n                                    || typeof(IPageDataFolder).IsAssignableFrom(type),\r\n                OnCreateLeafElement = this.CreateElement,\r\n                OnCreateDisabledLeafElement = data => ShowForeignElement(data, false),\r\n                OnCreateGhostedLeafElement = data => ShowForeignElement(data, true),\r\n                OnGetRootParentEntityToken = this.GetParentEntityToken,\r\n                OnGetLeafsFilter = this.GetLeafsFilter,\r\n                OnGetPayload = this.GetPayload\r\n            };\r\n\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n        }\r\n\r\n        private string GetPayload(EntityToken entityToken)\r\n        {\r\n            return GetPageId(entityToken).ToString();\r\n        }\r\n\r\n        private Func<IData, bool> GetLeafsFilter(EntityToken parentEntityToken)\r\n        {\r\n            Guid pageId = GetPageId(parentEntityToken);\r\n            return data => (data as IPageRelatedData).PageId == pageId;\r\n        }\r\n\r\n        private Guid GetPageId(EntityToken entityToken)\r\n        {\r\n            if (entityToken is DataGroupingProviderHelperEntityToken dataGroupingEntityToken)\r\n            {\r\n                if(dataGroupingEntityToken.Payload.IsNullOrEmpty())\r\n                {\r\n                    return Guid.Empty;\r\n                }\r\n\r\n                return new Guid(dataGroupingEntityToken.Payload);\r\n            }\r\n\r\n            if(entityToken is AssociatedDataElementProviderHelperEntityToken pageFolderElementEntityToken)\r\n            {\r\n                return new Guid(pageFolderElementEntityToken.Id);\r\n            }\r\n\r\n            if(entityToken is DataEntityToken dataEntityToken)\r\n            {\r\n                return (dataEntityToken.Data as IPageRelatedData).PageId;\r\n            }\r\n\r\n            throw new InvalidOperationException($\"Unexpected entity token type '{entityToken.GetType().FullName}'\");\r\n        }\r\n\r\n        private EntityToken GetParentEntityToken(Type interfaceType, EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNull(entityToken, \"entityToken\");\r\n\r\n            Guid pageId = GetPageId(entityToken);\r\n\r\n            if(pageId == Guid.Empty)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new AssociatedDataElementProviderHelperEntityToken(\r\n                TypeManager.SerializeType(typeof (IPage)),\r\n                _elementProviderContext.ProviderName,\r\n                pageId.ToString(),\r\n                TypeManager.SerializeType(interfaceType));\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Call this method to add actions to the element which represents the data of type T\r\n        /// </summary>\r\n        /// <param name=\"associatedDataElement\"></param>\r\n        /// <param name=\"data\">Null is allowed</param>\r\n        public void AttachElementActions(Element associatedDataElement, T data)\r\n        {\r\n            associatedDataElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AddDataFolderExWorkflow\"), AddAssociatedTypePermissionTypes) { Payload = TypeManager.SerializeType(typeof(T)), DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddDataFolderTypeLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddDataFolderTypeToolTip\"),\r\n                    Icon = this.AddDataAssociationTypeIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = AppendedActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n\r\n            associatedDataElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AddMetaDataWorkflow\"), AddAssociatedTypePermissionTypes) { Payload = TypeManager.SerializeType(typeof(T)), DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataTypeLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataTypeToolTip\"),\r\n                    Icon = this.AddDataAssociationTypeIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = AppendedActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n\r\n            associatedDataElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.EditMetaDataWorkflow\"), EditAssociatedTypePermissionTypes) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditMetaDataTypeLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditMetaDataTypeToolTip\"),\r\n                    Icon = this.EditDataAssociationTypeIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = AppendedActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n\r\n            associatedDataElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow\"), RemoveAssociatedTypePermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.RemoveMetaDataTypeLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.RemoveMetaDataTypeToolTip\"),\r\n                    Icon = this.RemoveDataAssociationTypeIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Delete,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = AppendedActionGroup\r\n                    }\r\n                }\r\n            });\r\n            \r\n        }\r\n\r\n\r\n\r\n        public bool HasChildren(T data)\r\n        {\r\n            return PageFolderFacade.HasFolderDefinitions((IPage)data);\r\n        }\r\n\r\n\r\n\r\n        public List<Element> GetChildren(T data, EntityToken parentEntityToken)\r\n        {\r\n            var children = new List<Element>();\r\n\r\n            PropertyInfo idPropertyInfo = typeof(T).GetKeyProperties()[0];\r\n\r\n            foreach (Type type in PageFolderFacade.GetDefinedFolderTypes((IPage)data).OrderBy(t => t.Name))\r\n            {\r\n                var entityToken = new AssociatedDataElementProviderHelperEntityToken(\r\n                            TypeManager.SerializeType(typeof(T)),\r\n                            _elementProviderContext.ProviderName,\r\n                            ValueTypeConverter.Convert<string>(idPropertyInfo.GetValue(data, null)),\r\n                            TypeManager.SerializeType(type)\r\n                        );\r\n\r\n                DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n\r\n                var element = new Element(_elementProviderContext.CreateElementHandle(entityToken))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = dataTypeDescriptor.Title ?? type.Name,\r\n                        ToolTip = dataTypeDescriptor.Title ?? type.Name,\r\n                        Icon = this.InterfaceClosedIcon,\r\n                        OpenedIcon = this.InterfaceOpenIcon,\r\n                        HasChildren = true // This is sat to always true to boost performance.\r\n                    }\r\n                };\r\n\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow\"), RemoveAssociatedTypePermissionTypes)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.RemoveAssociatedTypeLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.RemoveAssociatedTypeToolTip\"),\r\n                        Icon = this.RemoveDataAssociationTypeIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Delete,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = false,\r\n                            ActionGroup = AppendedActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n                AddAddAssociatedDataAction(element, true);\r\n\r\n                children.Add(element);\r\n            }\r\n\r\n            return children;\r\n        }\r\n\r\n\r\n\r\n        public List<Element> GetChildren(AssociatedDataElementProviderHelperEntityToken entityToken, bool includeForeignFolders)\r\n        {\r\n            IData data = entityToken.GetDataList().FirstOrDefault();\r\n            Type interfaceType = TypeManager.TryGetType(entityToken.Payload);\r\n\r\n            if (data == null) return new List<Element>();\r\n            if (interfaceType == null) return new List<Element>();\r\n\r\n\r\n            return _dataGroupingProviderHelper.GetRootGroupFolders(interfaceType, entityToken, includeForeignFolders).ToList();\r\n        }\r\n\r\n\r\n        public List<Element> GetChildren(DataGroupingProviderHelperEntityToken entityToken, bool includeForeignFolders)\r\n        {\r\n            return _dataGroupingProviderHelper.GetGroupChildren(entityToken, includeForeignFolders).ToList();\r\n        }\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            var result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                var dataEntityToken = entityToken as DataEntityToken;\r\n                if (dataEntityToken.Data == null) continue;\r\n\r\n                Type interfaceType = dataEntityToken.InterfaceType;\r\n\r\n                if (!PageFolderFacade.GetAllFolderTypes().Contains(interfaceType)) continue;\r\n\r\n                IData data = dataEntityToken.Data;\r\n                IPage referencedPage = PageFolderFacade.GetReferencedPage(data);\r\n                if (referencedPage == null) continue; // TODO: check this branch\r\n\r\n                result.Add(entityToken,\r\n                    new [] \r\n                    {\r\n                        new AssociatedDataElementProviderHelperEntityToken(\r\n                        TypeManager.SerializeType(typeof(T)),\r\n                        _elementProviderContext.ProviderName,\r\n                        ValueTypeConverter.Convert<string>(referencedPage.Id),\r\n                        TypeManager.SerializeType(interfaceType))\r\n                    });\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        private Element CreateElement(IData data)\r\n        {\r\n            string label = data.GetLabel();\r\n\r\n            var element = new Element(_elementProviderContext.CreateElementHandle(data.GetDataEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = label,\r\n                    ToolTip = label,\r\n                    HasChildren = false,\r\n                    Icon = data is IPublishControlled publishedControlled\r\n                            ? DataIconLookup[publishedControlled.PublicationStatus] \r\n                            : DataIconFacade.DataPublishedIcon\r\n                }\r\n            };\r\n\r\n            AddEditAssociatedDataAction(element);\r\n            AddDeleteAssociatedDataAction(element);\r\n            AddDuplicateAssociatedDataAction(element);\r\n\r\n            if (InternalUrls.DataTypeSupported(data.DataSourceId.InterfaceType))\r\n            {\r\n                var dataReference = data.ToDataReference();\r\n\r\n                if (DataUrls.CanBuildUrlForData(dataReference))\r\n                {\r\n                    string internalUrl = InternalUrls.TryBuildInternalUrl(dataReference);\r\n                    if (internalUrl != null)\r\n                    {\r\n                        element.PropertyBag.Add(\"Uri\", internalUrl);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n        private Element ShowForeignElement(IData data, bool enabled)\r\n        {\r\n            string label = string.Format(\"{0} ({1})\", data.GetLabel(true), DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo));\r\n\r\n            EntityToken entityToken = data.GetDataEntityToken();\r\n\r\n            if (enabled)\r\n            {\r\n                var element = new Element(_elementProviderContext.CreateElementHandle(entityToken))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = label,\r\n                        ToolTip = label,\r\n                        HasChildren = false,\r\n                        Icon = DataIconFacade.DataGhostedIcon,\r\n                        IsDisabled = false\r\n                    }\r\n                };\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.LocalizeDataWorkflow\"), _localizeDataPermissionTypes) { Payload = \"Pagefolder\" }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.LocalizeData\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.LocalizeDataToolTip\"),\r\n                        Icon = GeneratedDataTypesElementProvider.LocalizeDataIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Add,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n                return element;\r\n            }\r\n            \r\n            return new Element(_elementProviderContext.CreateElementHandle(entityToken))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = label,\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.DisabledData\"),\r\n                    HasChildren = false,\r\n                    Icon = DataIconFacade.DataDisabledIcon,\r\n                    IsDisabled = true\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n        #region Action methods\r\n        private void AddAddAssociatedDataAction(Element element, bool isInToolbar)\r\n        {\r\n            element.AddWorkflowAction(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AddAssociatedDataWorkflow\", \r\n                _addAssociatedDataPermissionTypes, \r\n                new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddAssociatedDataLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddAssociatedDataToolTip\"),\r\n                    Icon = this.AddAssociatedDataIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = isInToolbar,\r\n                        ActionGroup = AppendedActionGroup\r\n                    }\r\n                });\r\n        }\r\n\r\n\r\n\r\n        private void AddEditAssociatedDataAction(Element element)\r\n        {\r\n            element.AddWorkflowAction(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.EditAssociatedDataWorkflow\", \r\n                _editAssociatedDataPermissionTypes,\r\n                new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditAssociatedDataLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditAssociatedDataToolTip\"),\r\n                    Icon = this.EditAssociatedDataIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                });\r\n        }\r\n\r\n\r\n\r\n        private void AddDeleteAssociatedDataAction(Element element)\r\n        {\r\n            element.AddWorkflowAction(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteAssociatedDataWorkflow\", \r\n                _deleteAssociatedDataPermissionTypes,\r\n                new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.DeleteAssociatedDataLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.DeleteAssociatedDataToolTip\"),\r\n                    Icon = this.DeleteAssociatedDataIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Delete,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n            });\r\n        }\r\n\r\n        private void AddDuplicateAssociatedDataAction(Element element)\r\n        {\r\n            element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Duplicate,\r\n                _addAssociatedDataPermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label =\r\n                        StringResourceSystemFacade.GetString(\"Composite.Management\",\r\n                            \"AssociatedDataElementProviderHelper.DuplicateAssociatedDataLabel\"),\r\n                    ToolTip =\r\n                        StringResourceSystemFacade.GetString(\"Composite.Management\",\r\n                            \"AssociatedDataElementProviderHelper.DuplicateAssociatedDataToolTip\"),\r\n                    Icon = this.DuplicateAssociatedDataIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AssociatedDataElementProviderHelperEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(AssociatedDataElementProviderHelperSecurityAncestorProvider))]\r\n    public sealed class AssociatedDataElementProviderHelperEntityToken : EntityToken\r\n    {\r\n        private readonly string _providerName;\r\n\r\n        private int _hashCode = 0;\r\n\r\n\r\n        /// <exclude />\r\n        [JsonConstructor]\r\n        public AssociatedDataElementProviderHelperEntityToken(string type, string providerName, string id, string payload)\r\n        {\r\n            Type = type;\r\n            _providerName = providerName;\r\n            Id = id;\r\n\r\n            this.Payload = payload;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Type { get; }\r\n\r\n\r\n        /// <exclude />\r\n        [JsonProperty(PropertyName = \"providerName\")]\r\n        public override string Source => _providerName;\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public string Payload\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type GetInterfaceType()\r\n        {\r\n            Type type = TypeManager.GetType(this.Type);\r\n\r\n            return type;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IData GetData()\r\n        {\r\n            Type type = TypeManager.GetType(this.Type);\r\n\r\n            object id = ValueTypeConverter.Convert(this.Id, type.GetKeyProperties()[0].PropertyType);\r\n\r\n            IData data = DataFacade.TryGetDataByUniqueKey(type, id);\r\n\r\n            return data;\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<IData> GetDataList()\r\n        {\r\n            Type type = TypeManager.GetType(this.Type);\r\n\r\n            object id = ValueTypeConverter.Convert(this.Id, type.GetKeyProperties()[0].PropertyType);\r\n\r\n            var datas = DataFacade.TryGetDataVersionsByUniqueKey(type, id);\r\n\r\n            return datas;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(this);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                entityToken = CompositeJsonSerializer\r\n                    .Deserialize<AssociatedDataElementProviderHelperEntityToken>(serializedEntityToken);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedEntityToken);\r\n                Log.LogVerbose(nameof(AssociatedDataElementProviderHelperEntityToken), entityToken.GetType().FullName);\r\n            }\r\n            return entityToken;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken DeserializeLegacy(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            Dictionary<string, string> dic;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id, out dic);\r\n\r\n            if (dic.ContainsKey(\"_Payload_\") == false)\r\n            {\r\n                throw new ArgumentException(\"The serializedEntityToken is not a serialized entity token\", \"serializedEntityToken\");\r\n            }\r\n\r\n            string payload = StringConversionServices.DeserializeValueString(dic[\"_Payload_\"]);\r\n\r\n            return new AssociatedDataElementProviderHelperEntityToken(type, source, id, payload);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return base.Equals(obj) \r\n                && (obj as AssociatedDataElementProviderHelperEntityToken).Payload == this.Payload;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            if (_hashCode == 0)\r\n            {\r\n                _hashCode =\r\n                    this.GetType().GetHashCode() ^\r\n                    this.Source.GetHashCode() ^\r\n                    this.Type.GetHashCode() ^\r\n                    this.Id.GetHashCode() ^\r\n                    this.Payload.GetHashCode();\r\n            }\r\n\r\n            return _hashCode;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AssociatedDataElementProviderHelperSecurityAncestorProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    internal sealed class AssociatedDataElementProviderHelperSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            var castedEntityToken = (AssociatedDataElementProviderHelperEntityToken)entityToken;\r\n\r\n            var dataItem = castedEntityToken.GetDataList().FirstOrDefault();\r\n\r\n            // Data item may not exist in current language\r\n            return dataItem != null ? new[] { dataItem.GetDataEntityToken() } : Enumerable.Empty<EntityToken>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/DataGroupingProviderHelper/DataGroupingProviderHelper.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper\r\n{\r\n    internal sealed class DataGroupingProviderHelper : IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private const int MaxElementsToShow = 1000;\r\n\r\n\r\n        private readonly ElementProviderContext _elementProviderContext;\r\n        private readonly string _undefinedLabelValue;\r\n\r\n        private static readonly MethodInfo GenericCastMethodInfo = \r\n            StaticReflection.GetGenericMethodInfo(() => DataGroupingProviderHelper.Cast<IData>(null));\r\n\r\n\r\n        public DataGroupingProviderHelper(ElementProviderContext elementProviderContext)\r\n        {\r\n            _elementProviderContext = elementProviderContext;\r\n            _undefinedLabelValue = StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"UndefinedLabelTemplate\");\r\n\r\n            this.FolderOpenIcon = GetIconHandle(\"datagroupinghelper-folder-open\");\r\n            this.FolderClosedIcon = GetIconHandle(\"datagroupinghelper-folder-closed\");\r\n\r\n            this.OnCreateLeafElement = d => new Element(_elementProviderContext.CreateElementHandle(d.GetDataEntityToken()));\r\n            this.OnGetDataScopeIdentifier = t => DataScopeIdentifier.Administrated;\r\n            this.OnAddActions = (e, p) => e;\r\n\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataGroupingProviderHelperEntityToken>(this);\r\n\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate(typeof(IData), (sender, args) =>\r\n            {\r\n                if (!OnOwnsType(args.DataType)) return;\r\n\r\n                var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(args.DataType);\r\n\r\n                IEnumerable<DataFieldDescriptor> groupingDataFieldDescriptors =\r\n                    from dfd in dataTypeDescriptor.Fields\r\n                    where dfd.GroupByPriority != 0\r\n                    orderby dfd.GroupByPriority\r\n                    select dfd;\r\n\r\n                if (groupingDataFieldDescriptors.Any())\r\n                {\r\n                    EntityTokenCacheFacade.ClearCache(args.Data.GetDataEntityToken());\r\n                }\r\n            }, false);\r\n        }\r\n\r\n\r\n        public ResourceHandle FolderOpenIcon { get; set; }\r\n        public ResourceHandle FolderClosedIcon { get; set; }\r\n\r\n        public Func<IData, Element> OnCreateLeafElement { get; set; }\r\n        public Func<IData, Element> OnCreateGhostedLeafElement { get; set; }\r\n        public Func<IData, Element> OnCreateDisabledLeafElement { get; set; }\r\n        public Func<Type, DataScopeIdentifier> OnGetDataScopeIdentifier { get; set; }\r\n        public Func<Type, bool> OnOwnsType { get; set; }\r\n        public Func<Type, EntityToken, EntityToken> OnGetRootParentEntityToken { get; set; }\r\n        public Func<Element, PropertyInfoValueCollection, Element> OnAddActions { get; set; }\r\n        public Func<EntityToken, Func<IData, bool>> OnGetLeafsFilter { get; set; } \r\n        public Func<EntityToken, string> OnGetPayload { get; set; }\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            var result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                if (entityToken is DataGroupingProviderHelperEntityToken groupingEntityToken)\r\n                {\r\n                    var parent = GetGroupingEntityTokenParent(groupingEntityToken);\r\n\r\n                    if (parent != null)\r\n                    {\r\n                        result.Add(entityToken, new [] { parent });\r\n                    }\r\n                    continue;\r\n                }\r\n\r\n\r\n                if (entityToken is DataEntityToken dataEntityToken)\r\n                {\r\n                    var parent = GetDataEntityTokenParent(dataEntityToken);\r\n                    if (parent != null)\r\n                    {\r\n                        result.Add(entityToken, new[] { parent });\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private EntityToken GetGroupingEntityTokenParent(DataGroupingProviderHelperEntityToken groupingEntityToken)\r\n        {\r\n            Type type = TypeManager.TryGetType(groupingEntityToken.Type);\r\n\r\n            if (groupingEntityToken.GroupingValues.Count == 1)\r\n            {\r\n                return OnGetRootParentEntityToken(type, groupingEntityToken);\r\n            }\r\n\r\n            var newGroupingParentEntityToken = new DataGroupingProviderHelperEntityToken(groupingEntityToken.Type)\r\n            {\r\n                Payload = this.OnGetPayload(groupingEntityToken),\r\n                GroupingValues = new Dictionary<string, object>()\r\n            };\r\n            foreach (var kvp in groupingEntityToken.GroupingValues.Take(groupingEntityToken.GroupingValues.Count - 1))\r\n            {\r\n                newGroupingParentEntityToken.GroupingValues.Add(kvp.Key, NormalizeGroupingValue(kvp.Value));\r\n            }\r\n\r\n            return newGroupingParentEntityToken;\r\n        }\r\n\r\n        private EntityToken GetDataEntityTokenParent(DataEntityToken dataEntityToken)\r\n        {\r\n            Type interfaceType = dataEntityToken.InterfaceType;\r\n            if (!OnOwnsType(interfaceType))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n\r\n            IEnumerable<DataFieldDescriptor> groupingDataFieldDescriptors =\r\n                from dfd in dataTypeDescriptor.Fields\r\n                where dfd.GroupByPriority != 0\r\n                orderby dfd.GroupByPriority\r\n                select dfd;\r\n\r\n            if (!groupingDataFieldDescriptors.Any())\r\n            {\r\n                return OnGetRootParentEntityToken(interfaceType, dataEntityToken);\r\n            }\r\n\r\n            IData data = dataEntityToken.Data;\r\n\r\n            var parentToken = new DataGroupingProviderHelperEntityToken(dataEntityToken.Type)\r\n            {\r\n                Payload = this.OnGetPayload(dataEntityToken),\r\n                GroupingValues = new Dictionary<string, object>()\r\n            };\r\n            foreach (DataFieldDescriptor dfd in groupingDataFieldDescriptors)\r\n            {\r\n                PropertyInfo propertyInfo = interfaceType.GetPropertiesRecursively().Single(f => f.Name == dfd.Name);\r\n\r\n                object value = propertyInfo.GetValue(data, null);\r\n                parentToken.GroupingValues.Add(propertyInfo.Name, NormalizeGroupingValue(value));\r\n            }\r\n\r\n            return parentToken;\r\n        }\r\n\r\n        private static object NormalizeGroupingValue(object value)\r\n        {\r\n            return (value as DateTime?)?.Date ?? value;\r\n        }\r\n\r\n\r\n        public IEnumerable<Element> GetRootGroupFolders(Type interfaceType, EntityToken parentEntityToken)\r\n        {\r\n            return GetRootGroupFolders(interfaceType, parentEntityToken, false);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRootGroupFolders(Type interfaceType, EntityToken parentEntityToken, bool includeForeignFolders)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n\r\n            IEnumerable<DataFieldDescriptor> groupingDataFieldDescriptors =\r\n                from dfd in dataTypeDescriptor.Fields\r\n                where dfd.GroupByPriority != 0\r\n                orderby dfd.GroupByPriority\r\n                select dfd;\r\n\r\n            using (new DataScope(this.OnGetDataScopeIdentifier(interfaceType)))\r\n            {\r\n                if (groupingDataFieldDescriptors.Count() != 0)\r\n                {\r\n                    ValidateGroupByPriorities(interfaceType, groupingDataFieldDescriptors);\r\n\r\n                    DataFieldDescriptor firstDataFieldDescriptor = groupingDataFieldDescriptors.First();\r\n                    PropertyInfo propertyInfo = interfaceType.GetPropertiesRecursively().Single(f => f.Name == firstDataFieldDescriptor.Name);\r\n\r\n                    List<Element> elements = GetRootGroupFolders(interfaceType, parentEntityToken, firstDataFieldDescriptor, propertyInfo).ToList();\r\n\r\n                    if (firstDataFieldDescriptor.ForeignKeyReferenceTypeName != null)\r\n                    {\r\n                        elements = (firstDataFieldDescriptor.TreeOrderingProfile.OrderDescending ?\r\n                            elements.OrderByDescending(f => f.VisualData.Label) :\r\n                            elements.OrderBy(f => f.VisualData.Label)).ToList();\r\n                    }\r\n\r\n                    if (includeForeignFolders)\r\n                    {\r\n                        using (new DataScope(UserSettings.ForeignLocaleCultureInfo))\r\n                        {\r\n                            elements.AddRange(GetRootGroupFolders(interfaceType, parentEntityToken, firstDataFieldDescriptor, propertyInfo));\r\n                        }\r\n                    }\r\n\r\n                    return elements.Distinct();\r\n                }\r\n                else\r\n                {\r\n                    Func<IData, bool> filter = null;\r\n\r\n                    if (this.OnGetLeafsFilter != null)\r\n                    {\r\n                        filter = this.OnGetLeafsFilter(parentEntityToken);\r\n                    }\r\n\r\n                    List<Element> elements = GetRootGroupFoldersFoldersLeafs(interfaceType, filter, false).ToList();\r\n\r\n                    bool listingLimitReached = elements.Count == MaxElementsToShow;\r\n\r\n                    var labelFieldDescriptor = dataTypeDescriptor.Fields.FirstOrDefault(f => f.Name == dataTypeDescriptor.LabelFieldName);\r\n                    if (labelFieldDescriptor?.ForeignKeyReferenceTypeName != null && labelFieldDescriptor.TreeOrderingProfile.OrderPriority.HasValue)\r\n                    {\r\n                        elements = (labelFieldDescriptor.TreeOrderingProfile.OrderDescending ?\r\n                            elements.OrderByDescending(f => f.VisualData.Label) :\r\n                            elements.OrderBy(f => f.VisualData.Label)).ToList();\r\n                    }\r\n\r\n                    if (!listingLimitReached && includeForeignFolders)\r\n                    {\r\n                        using (new DataScope(UserSettings.ForeignLocaleCultureInfo))\r\n                        {\r\n                            elements.AddRange(GetRootGroupFoldersFoldersLeafs(interfaceType, filter, true));\r\n                        }\r\n\r\n                        elements = elements.Distinct().Take(MaxElementsToShow).ToList();\r\n                    }\r\n\r\n                    if (elements.Count == MaxElementsToShow)\r\n                    {\r\n                        elements.Add(GetElipsisElement(parentEntityToken, MaxElementsToShow));\r\n                    }\r\n\r\n                    return elements;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetRootGroupFolders(Type interfaceType, EntityToken parentEntityToken, DataFieldDescriptor firstDataFieldDescriptor, PropertyInfo propertyInfo)\r\n        {\r\n            Func<IData, bool> filter = OnGetLeafsFilter?.Invoke(parentEntityToken);\r\n\r\n            IQueryable queryable = GetFilteredData(interfaceType, filter);\r\n\r\n            var expressionBuilder = new ExpressionBuilder(interfaceType, queryable);\r\n\r\n            IQueryable resultQueryable = expressionBuilder.\r\n                Distinct().\r\n                OrderBy(propertyInfo, true, firstDataFieldDescriptor.TreeOrderingProfile.OrderDescending).\r\n                Select(propertyInfo, true).\r\n                CreateQuery();\r\n\r\n            var propertyInfoValueCollection = new PropertyInfoValueCollection();\r\n\r\n            return CreateGroupFolderElements(interfaceType, firstDataFieldDescriptor, resultQueryable, parentEntityToken, propertyInfoValueCollection);\r\n        }\r\n\r\n        private static IQueryable Cast<T>(IQueryable<IData> queryable)\r\n        {\r\n            return queryable.Cast<T>();\r\n        }\r\n\r\n\r\n        public static IQueryable OrderData(IQueryable source, Type interfaceType)\r\n        {\r\n            var typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n\r\n            List<DataFieldDescriptor> orderFields = typeDescriptor.Fields.Where(f => f.TreeOrderingProfile.OrderPriority.HasValue).OrderBy(f => f.TreeOrderingProfile.OrderPriority).ToList();\r\n\r\n            if (orderFields.Any())\r\n            {\r\n                IOrderedQueryable ordered = source.OrderBy(interfaceType, orderFields.First().Name, orderFields.First().TreeOrderingProfile.OrderDescending);\r\n\r\n                foreach (DataFieldDescriptor field in orderFields.Skip(1))\r\n                {\r\n                    ordered = ordered.ThenBy(interfaceType, field.Name, field.TreeOrderingProfile.OrderDescending);\r\n                }\r\n\r\n                return ordered;\r\n            }\r\n            \r\n            if (!string.IsNullOrEmpty(typeDescriptor.LabelFieldName))\r\n            {\r\n                return source.OrderBy(interfaceType, typeDescriptor.LabelFieldName);\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n        private IEnumerable<Element> GetRootGroupFoldersFoldersLeafs(Type interfaceType, Func<IData, bool> filter, bool isForeign)\r\n        {\r\n            Func<IData, Element> func = isForeign ? OnCreateGhostedLeafElement : OnCreateLeafElement;\r\n\r\n            IQueryable source = DataFacade.GetData(interfaceType);\r\n\r\n            IQueryable orderedData = OrderData(source, interfaceType);\r\n\r\n            List<IData> data;\r\n\r\n            if (filter == null)\r\n            {\r\n                data = ((IQueryable<IData>) orderedData).Take(MaxElementsToShow).ToList();\r\n            }\r\n            else\r\n            {\r\n                data = ((IQueryable<IData>) orderedData).Evaluate().Where(filter).ToList();\r\n            }\r\n\r\n            foreach (IData item in data)\r\n            {\r\n                Element element = GetDataFromCorrectScope(item, func, OnCreateDisabledLeafElement, isForeign);\r\n                if (element != null)\r\n                {\r\n                    yield return element;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private Element GetElipsisElement(EntityToken parentEntityToken, int elementsShown)\r\n        {\r\n            var element =\r\n                new Element(new ElementHandle(_elementProviderContext.ProviderName, new ElipsisEntityToken(parentEntityToken)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = LocalizationFiles.Composite_Management.Website_App_LimitedElementsShown(elementsShown.ToString()),\r\n                        ToolTip = \"\",\r\n                        Icon = GetIconHandle(\"warning\"),\r\n                        OpenedIcon = null,\r\n                        HasChildren = false\r\n                    }\r\n                };\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n        public IEnumerable<Element> GetGroupChildren(DataGroupingProviderHelperEntityToken groupEntityToken)\r\n        {\r\n            return GetGroupChildren(groupEntityToken, false);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetGroupChildren(DataGroupingProviderHelperEntityToken groupEntityToken, bool includeForeignFolders)\r\n        {            \r\n            Type interfaceType = TypeManager.GetType(groupEntityToken.Type);\r\n\r\n            var propertyInfoValueCollection = new PropertyInfoValueCollection();\r\n            foreach (var kvp in groupEntityToken.GroupingValues)\r\n            {\r\n                PropertyInfo propertyInfo = interfaceType.GetPropertiesRecursively().Single(f => f.Name == kvp.Key);\r\n                propertyInfoValueCollection.AddPropertyValue(propertyInfo, kvp.Value);\r\n            }\r\n\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n\r\n            DataFieldDescriptor groupingDataFieldDescriptor =\r\n                (from dfd in dataTypeDescriptor.Fields\r\n                 where dfd.GroupByPriority == groupEntityToken.GroupingValues.Count + 1\r\n                 select dfd).SingleOrDefault();\r\n\r\n            if (groupingDataFieldDescriptor != null \r\n                && propertyInfoValueCollection.PropertyValues.Any(f => f.Key.Name == groupingDataFieldDescriptor.Name))\r\n            {\r\n                // Grouping ordering has ben changed, at the moment the best thing we can do its to return no elements\r\n                // TODO: This class and the whole attach element provider stuff should be redone\r\n                return Enumerable.Empty<Element>();\r\n            }\r\n\r\n            Func<IData, bool> filter = null;\r\n\r\n            if (this.OnGetLeafsFilter != null)\r\n            {\r\n                filter = this.OnGetLeafsFilter(groupEntityToken);\r\n            }\r\n\r\n            using (new DataScope(this.OnGetDataScopeIdentifier(interfaceType)))\r\n            {\r\n                if (groupingDataFieldDescriptor != null)\r\n                {\r\n                    PropertyInfoValueCollection propertyInfoValueCol = propertyInfoValueCollection.Clone();\r\n                    List<Element> elements = GetGroupChildrenFolders(groupEntityToken, interfaceType, filter, groupingDataFieldDescriptor, propertyInfoValueCol).ToList();\r\n\r\n                    if (groupingDataFieldDescriptor.ForeignKeyReferenceTypeName != null)\r\n                    {\r\n                        elements = (groupingDataFieldDescriptor.TreeOrderingProfile.OrderDescending ?\r\n                            elements.OrderByDescending(f => f.VisualData.Label) :\r\n                            elements.OrderBy(f => f.VisualData.Label)).ToList();\r\n                    }\r\n\r\n                    if (includeForeignFolders)\r\n                    {\r\n                        using (new DataScope(UserSettings.ForeignLocaleCultureInfo))\r\n                        {\r\n                            PropertyInfoValueCollection foreignPropertyInfoValueCol = propertyInfoValueCollection.Clone();\r\n                            elements.AddRange(GetGroupChildrenFolders(groupEntityToken, interfaceType, filter, groupingDataFieldDescriptor, foreignPropertyInfoValueCol));\r\n                        }\r\n                    }\r\n\r\n                    return elements.Distinct();\r\n                }\r\n                else\r\n                {\r\n                    PropertyInfoValueCollection propertyInfoValueCol = propertyInfoValueCollection.Clone();\r\n                    List<Element> elements = GetGroupChildrenLeafs(interfaceType, filter, propertyInfoValueCol, false).ToList();\r\n\r\n                    if (!dataTypeDescriptor.Fields.Any(f => f.TreeOrderingProfile.OrderPriority.HasValue && f.ForeignKeyReferenceTypeName == null))\r\n                    {\r\n                        var labelFieldDescriptor = dataTypeDescriptor.Fields.FirstOrDefault(f => f.Name == dataTypeDescriptor.LabelFieldName);\r\n                        if (labelFieldDescriptor?.ForeignKeyReferenceTypeName != null)\r\n                        {\r\n                            elements = (labelFieldDescriptor.TreeOrderingProfile.OrderDescending ?\r\n                                elements.OrderByDescending(f => f.VisualData.Label) :\r\n                                elements.OrderBy(f => f.VisualData.Label)).ToList();\r\n                        }\r\n                    }\r\n\r\n                    if (includeForeignFolders)\r\n                    {\r\n                        using (new DataScope(UserSettings.ForeignLocaleCultureInfo))\r\n                        {\r\n                            PropertyInfoValueCollection foreignPropertyInfoValueCol = propertyInfoValueCollection.Clone();\r\n                            elements.AddRange(GetGroupChildrenLeafs(interfaceType, filter, foreignPropertyInfoValueCol, true));\r\n                        }\r\n                    }\r\n\r\n                    return elements.Distinct();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetGroupChildrenFolders(DataGroupingProviderHelperEntityToken groupEntityToken, Type interfaceType, Func<IData, bool> filter, DataFieldDescriptor groupingDataFieldDescriptor, PropertyInfoValueCollection propertyInfoValueCollection)\r\n        {\r\n            IQueryable queryable = GetFilteredData(interfaceType, filter);\r\n            ExpressionBuilder expressionBuilder = new ExpressionBuilder(interfaceType, queryable);\r\n            PropertyInfo selectPropertyInfo = interfaceType.GetPropertiesRecursively(f => f.Name == groupingDataFieldDescriptor.Name).Single();\r\n\r\n            IQueryable resultQueryable = expressionBuilder.\r\n                Where(propertyInfoValueCollection, true).\r\n                OrderBy(selectPropertyInfo, true, groupingDataFieldDescriptor.TreeOrderingProfile.OrderDescending).\r\n                Select(selectPropertyInfo, true).\r\n                Distinct().\r\n                CreateQuery();\r\n\r\n            return CreateGroupFolderElements(interfaceType, groupingDataFieldDescriptor, resultQueryable, groupEntityToken, propertyInfoValueCollection);\r\n        }\r\n        \r\n\r\n\r\n        private IEnumerable<Element> GetGroupChildrenLeafs(Type interfaceType, Func<IData, bool> filter, PropertyInfoValueCollection propertyInfoValueCollection, bool isForeign)\r\n        {\r\n            IQueryable queryable = GetFilteredData(interfaceType, filter);\r\n            queryable = OrderData(queryable, interfaceType);\r\n\r\n            ExpressionBuilder expressionBuilder = new ExpressionBuilder(interfaceType, queryable);\r\n\r\n            IQueryable resultQueryable = expressionBuilder.\r\n                Where(propertyInfoValueCollection, true).\r\n                CreateQuery();\r\n\r\n            List<IData> datas = resultQueryable.ToDataList();\r\n\r\n            Func<IData, Element> func = OnCreateLeafElement;\r\n            if (isForeign)\r\n            {\r\n                func = OnCreateGhostedLeafElement;\r\n            }\r\n\r\n            foreach (IData data in datas)\r\n            {\r\n                Element element = GetDataFromCorrectScope(data, func, OnCreateDisabledLeafElement, isForeign);\r\n                if (element != null)\r\n                {\r\n                    yield return element;\r\n                }\r\n            }\r\n        }\r\n\r\n        private static IQueryable GetFilteredData(Type interfaceType, Func<IData, bool> filter)\r\n        {\r\n            IQueryable queryable = DataFacade.GetData(interfaceType);\r\n\r\n            if (filter == null) return queryable;\r\n\r\n            var dataQueryable = ((IQueryable<IData>) queryable).Where(filter).AsQueryable();\r\n\r\n            return GenericCastMethodInfo\r\n                   .MakeGenericMethod(interfaceType)\r\n                   .Invoke(null, new object[] { dataQueryable }) as IQueryable;\r\n        }\r\n\r\n        private static Element GetDataFromCorrectScope(IData data, Func<IData, Element> createElementFunc, Func<IData, Element> createDisabledElementFunc, bool isForeign)\r\n        {\r\n            if (isForeign)\r\n            {\r\n                if (!data.IsTranslatable())\r\n                {\r\n                    return createDisabledElementFunc(data);\r\n                }\r\n\r\n                IData translationSource = data.GetTranslationSource();\r\n                return createElementFunc(translationSource);\r\n            }\r\n            return createElementFunc(data);\r\n        }\r\n\r\n\r\n\r\n\r\n        public IEnumerable<EntityTokenHook> CreateHooks(Type interfaceType, EntityToken parentEntityToken)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> CreateGroupFolderElements(Type interfaceType, DataFieldDescriptor dataFieldDescriptor, IQueryable queryable, EntityToken parentEntityToken, PropertyInfoValueCollection propertyInfoValueCollection)\r\n        {\r\n            PropertyInfo propertyInfo = interfaceType.GetPropertiesRecursively().Single(f => f.Name == dataFieldDescriptor.Name);\r\n\r\n            foreach (object obj in queryable)\r\n            {\r\n                var entityToken = new DataGroupingProviderHelperEntityToken(TypeManager.SerializeType(interfaceType))\r\n                {\r\n                    Payload = this.OnGetPayload(parentEntityToken),\r\n                    GroupingValues = new Dictionary<string, object>()\r\n                };\r\n\r\n                foreach (var kvp in propertyInfoValueCollection.PropertyValues)\r\n                {\r\n                    entityToken.GroupingValues.Add(kvp.Key.Name, kvp.Value);\r\n                }\r\n                entityToken.GroupingValues.Add(propertyInfo.Name, obj);\r\n\r\n\r\n                var element = new Element(_elementProviderContext.CreateElementHandle(entityToken));\r\n\r\n\r\n                string label = obj?.ToString() ?? string.Format(_undefinedLabelValue, dataFieldDescriptor.Name);\r\n                if (obj is DateTime dt)\r\n                {\r\n                    label = dt.ToString(\"yyyy-MM-dd\");\r\n                }\r\n\r\n                if (obj != null && dataFieldDescriptor.ForeignKeyReferenceTypeName != null)\r\n                {\r\n                    Type refType = TypeManager.GetType(dataFieldDescriptor.ForeignKeyReferenceTypeName);\r\n\r\n                    IData data = typeof(IVersioned).IsAssignableFrom(refType)\r\n                        ? DataFacade.TryGetDataVersionsByUniqueKey(refType, obj).FirstOrDefault()\r\n                        : DataFacade.TryGetDataByUniqueKey(refType, obj);\r\n\r\n                    if (data != null)\r\n                    {\r\n                        label = data.GetLabel();\r\n                    }\r\n                }\r\n\r\n\r\n                element.VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = label,\r\n                    ToolTip = label,\r\n                    HasChildren = true,\r\n                    Icon = this.FolderClosedIcon,\r\n                    OpenedIcon = this.FolderOpenIcon\r\n                };\r\n\r\n                PropertyInfoValueCollection propertyInfoValueCollectionCopy = propertyInfoValueCollection.Clone();\r\n                propertyInfoValueCollectionCopy.AddPropertyValue(propertyInfo, obj);\r\n\r\n                yield return this.OnAddActions(element, propertyInfoValueCollectionCopy);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void ValidateGroupByPriorities(Type interfaceType, IEnumerable<DataFieldDescriptor> groupingDataFieldDescriptors)\r\n        {\r\n            int i = 1;\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in groupingDataFieldDescriptors)\r\n            {\r\n                if (dataFieldDescriptor.GroupByPriority != i)\r\n                {\r\n                    throw new InvalidOperationException($\"Group by priority not correct for the type '{interfaceType}'\");\r\n                }\r\n\r\n                i++;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/DataGroupingProviderHelper/DataGroupingProviderHelperEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    public sealed class DataGroupingProviderHelperEntityToken : EntityToken\r\n    {\r\n        private const string _magicNullValue = \"·NULL·\";\r\n        private string _type;\r\n        private string _payload;\r\n\r\n\r\n        /// <exclude />\r\n        public DataGroupingProviderHelperEntityToken(string type)\r\n        {\r\n            _type = type;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return _type; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> GroupingValues\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Payload\r\n        {\r\n            get { return _payload; }\r\n            set { _payload = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use 'Type' property instead.\")]\r\n        public string SerializedTypeName\r\n        {\r\n            get\r\n            {\r\n                return Type;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            DoSerialize(sb);\r\n\r\n            if (!_payload.IsNullOrEmpty())\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"Payload\", _payload, typeof(string));\r\n            }\r\n\r\n            foreach (var kvp in this.GroupingValues.SortByKeys())\r\n            {\r\n                if (kvp.Value != null)\r\n                {\r\n                    StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, kvp.Value, kvp.Value.GetType());\r\n                }\r\n                else\r\n                {\r\n                    StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, _magicNullValue, typeof(string));\r\n                }\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            Dictionary<string, string> dic;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id, out dic);\r\n\r\n            var entityToken = new DataGroupingProviderHelperEntityToken(type);\r\n\r\n            if (dic.ContainsKey(\"Payload\"))\r\n            {\r\n                entityToken._payload = dic[\"Payload\"];\r\n            }            \r\n\r\n            entityToken.GroupingValues = new Dictionary<string, object>();\r\n\r\n            Type dataType = TypeManager.GetType(type);\r\n\r\n            List<PropertyInfo> propertyInfos = dataType.GetPropertiesRecursively();\r\n            foreach (var kvp in dic)\r\n            {\r\n                PropertyInfo propertyInfo = propertyInfos.Where(f => f.Name == kvp.Key).SingleOrDefault();\r\n\r\n                if (propertyInfo == null) continue;\r\n\r\n                object value = null;\r\n                if (kvp.Value != _magicNullValue)\r\n                {\r\n                    value = StringConversionServices.DeserializeValue(kvp.Value, propertyInfo.PropertyType);\r\n                }\r\n\r\n\r\n                entityToken.GroupingValues.Add(kvp.Key, value);\r\n            }\r\n\r\n            return entityToken;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            int hashCode = this.Id.GetHashCode() ^ this.Type.GetHashCode() ^ this.Source.GetHashCode();\r\n\r\n            foreach (var kvp in this.GroupingValues.SortByKeys())\r\n            {\r\n                hashCode ^= kvp.Key.GetHashCode();\r\n                if (kvp.Value != null)\r\n                {\r\n                    hashCode ^= kvp.Value.GetHashCode();\r\n                }\r\n            }\r\n\r\n            return hashCode;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string OnGetExtraPrettyHtml()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            foreach (var kvp in this.GroupingValues.SortByKeys())\r\n            {\r\n                sb.Append(\"<b>\" + kvp.Key + \" = </b> \" + HttpUtility.HtmlEncode(kvp.Value) + \"<br />\");\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/DataGroupingProviderHelper/ElipsisEntityToken.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Newtonsoft.Json;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper\r\n{\r\n    [SecurityAncestorProvider(typeof(ElipsisSecurityAncestorProvider))]\r\n    internal class ElipsisEntityToken: EntityToken\r\n    {\r\n        private EntityToken _parentEntityToken;\r\n        private readonly string _serializedParentEntityToken;\r\n\r\n        public ElipsisEntityToken(EntityToken parentEntityToken)\r\n        {\r\n            _parentEntityToken = parentEntityToken;\r\n            _serializedParentEntityToken = EntityTokenSerializer.Serialize(parentEntityToken, false);\r\n        }\r\n\r\n        /// <exclude />\r\n        public ElipsisEntityToken(string serializedParentEntityToken)\r\n        {\r\n            _serializedParentEntityToken = serializedParentEntityToken;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type => _serializedParentEntityToken;\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source => \"\";\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id => \"\";\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public EntityToken ParentEntityToken\r\n        {\r\n            get\r\n            {\r\n                if (_parentEntityToken == null)\r\n                {\r\n                    _parentEntityToken = EntityTokenSerializer.Deserialize(_serializedParentEntityToken);\r\n                }\r\n\r\n                return _parentEntityToken;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public EntityToken GetParentEntityToken()\r\n        {\r\n            return this.ParentEntityToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new ElipsisEntityToken(type);\r\n        }\r\n    }\r\n\r\n    internal class ElipsisSecurityAncestorProvider: ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken is ElipsisEntityToken)\r\n            {\r\n                return new [] {(entityToken as ElipsisEntityToken).GetParentEntityToken()};\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/VisualFunctionElementProviderHelper/Foundation/RenderingFunctionNames.cs",
    "content": "﻿namespace Composite.C1Console.Elements.ElementProviderHelpers.VisualFunctionElementProviderHelper.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class RenderingFunctionNames\r\n    {\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Namespace { get; set; }\r\n\r\n        /// <exclude />\r\n        public string CompositName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementProviderHelpers/VisualFunctionElementProviderHelper/VisualFunctionElementProviderHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.VisualFunctionElementProviderHelper.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.VisualFunctionElementProviderHelper\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class VisualFunctionElementProviderHelper\r\n    {\r\n        private ResourceHandle AddRenderingFunctionIcon { get { return GetIconHandle(\"visual-function-add\"); } }\r\n        private ResourceHandle EditRenderingFunctionIcon { get { return GetIconHandle(\"visual-function-edit\"); } }\r\n        private ResourceHandle DeleteRenderingFunctionIcon { get { return GetIconHandle(\"visual-function-delete\"); } }\r\n\r\n        private static readonly ActionGroup AppendedActionGroup = new ActionGroup(\"Visual Functions\", ActionGroupPriority.TargetedAppendMedium);\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<RenderingFunctionNames> GetRenderingFunctions(Type interfaceType)\r\n        {\r\n            string serializedType = TypeManager.SerializeType(interfaceType);\r\n\r\n            var functions =\r\n                (from wrf in DataFacade.GetData<IVisualFunction>()\r\n                 where wrf.TypeManagerName == serializedType\r\n                 select new { Name = wrf.Name, Namespace = wrf.Namespace }).ToList();\r\n\r\n            IEnumerable<RenderingFunctionNames> renderingFunctins =\r\n                from fun in functions\r\n                select new RenderingFunctionNames\r\n                {\r\n                    Name = fun.Name,\r\n                    Namespace = fun.Namespace,\r\n                    CompositName = StringExtensionMethods.CreateNamespace(fun.Namespace, fun.Name, '.')\r\n                };\r\n\r\n            return renderingFunctins.OrderBy(f => f.CompositName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IVisualFunction GetVisualFunction(RenderingFunctionNames renderingFunctionNames)\r\n        {\r\n            IVisualFunction function =\r\n                (from wrf in DataFacade.GetData<IVisualFunction>()\r\n                 where wrf.Name == renderingFunctionNames.Name &&\r\n                       wrf.Namespace == renderingFunctionNames.Namespace\r\n                 select wrf).FirstOrDefault();\r\n\r\n            return function;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AttachElementActions(IEnumerable<Element> elements)\r\n        {\r\n            foreach (Element element in elements)\r\n            {\r\n                DataEntityToken dataEntityToken = element.ElementHandle.EntityToken as DataEntityToken;\r\n\r\n                if (dataEntityToken != null)\r\n                {\r\n                    element.AddAction(\r\n                        new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.VisualFunctionElementProviderHelper.AddVisualFunctionWorkflow\"))))\r\n                            {\r\n                                VisualData = new ActionVisualizedData\r\n                                {\r\n                                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProviderHelper.AddNewLabel\"),\r\n                                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProviderHelper.AddNewToolTip\"),\r\n                                    Icon = this.AddRenderingFunctionIcon,\r\n                                    Disabled = false,\r\n                                    ActionLocation = new ActionLocation\r\n                                    {\r\n                                        ActionType = ActionType.Add,\r\n                                        IsInFolder = false,\r\n                                        IsInToolbar = false,\r\n                                        ActionGroup = AppendedActionGroup\r\n                                    }\r\n                                }\r\n                            });\r\n\r\n                    if (GetRenderingFunctions(dataEntityToken.Data.DataSourceId.InterfaceType).Count() > 0)\r\n                    {\r\n                        element.AddAction(\r\n                            new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.VisualFunctionElementProviderHelper.SelectVisualFunctionWorkflow\")) { Payload = \"Edit\" }))\r\n                            {\r\n                                VisualData = new ActionVisualizedData\r\n                                {\r\n                                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProviderHelper.EditLabel\"),\r\n                                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProviderHelper.EditToolTip\"),\r\n                                    Icon = this.EditRenderingFunctionIcon,\r\n                                    Disabled = false,\r\n                                    ActionLocation = new ActionLocation\r\n                                    {\r\n                                        ActionType = ActionType.Edit,\r\n                                        IsInFolder = false,\r\n                                        IsInToolbar = false,\r\n                                        ActionGroup = AppendedActionGroup\r\n                                    }\r\n                                }\r\n                            });\r\n\r\n                        element.AddAction(\r\n                            new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.VisualFunctionElementProviderHelper.SelectVisualFunctionWorkflow\")) { Payload = \"Delete\" }))\r\n                            {\r\n                                VisualData = new ActionVisualizedData\r\n                                {\r\n                                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProviderHelper.DeleteLabel\"),\r\n                                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProviderHelper.DeleteToolTip\"),\r\n                                    Icon = this.DeleteRenderingFunctionIcon,\r\n                                    Disabled = false,\r\n                                    ActionLocation = new ActionLocation\r\n                                    {\r\n                                        ActionType = ActionType.Delete,\r\n                                        IsInFolder = false,\r\n                                        IsInToolbar = true,\r\n                                        ActionGroup = AppendedActionGroup\r\n                                    }\r\n                                }\r\n                            });\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ElementVisualizedData.cs",
    "content": "using Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// Describe an elements visual appearance\r\n    /// </summary>\r\n    public sealed class ElementVisualizedData\r\n    {\r\n        /// <summary>\r\n        /// Label to be shown in tree\r\n        /// </summary>\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// If this element has (may have) chrildren. When true navigation for opening the element will be provided.\r\n        /// </summary>\r\n        public bool HasChildren { get; set; }\r\n\r\n        /// <summary>\r\n        /// When true the element will be shown in the UI but in a grayed out way with all actions disabled\r\n        /// </summary>\r\n        public bool IsDisabled { get; set; }\r\n\r\n        /// <summary>\r\n        /// The icon of the element (when closed)\r\n        /// </summary>\r\n        public ResourceHandle Icon { get; set; }\r\n\r\n        /// <summary>\r\n        /// The icon of the element when open (when children are shown)\r\n        /// </summary>\r\n        public ResourceHandle OpenedIcon { get; set; }\r\n\r\n        /// <summary>\r\n        /// Tooltip for the element - typically shown when hovering the element\r\n        /// </summary>\r\n        public string ToolTip { get; set; }\r\n\r\n        /// <summary>\r\n        /// Having a common ElementBundle across elements will make the client bundle them up as a single node, and allow the user to select a specific element via a drop down, showing individual BundleElementName values\r\n        /// </summary>\r\n        public string ElementBundle { get; set; }\r\n\r\n        /// <summary>\r\n        /// When bundling elements this field is used to identify this specific element for selection\r\n        /// </summary>\r\n        public string BundleElementName { get; set; }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/ElementActionProviderFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements.Foundation.PluginFacades;\r\nusing Composite.C1Console.Elements.Plugins.ElementActionProvider;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n    #region ManageUserPermissions\r\n    internal sealed class ManageUserPermissionsActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n\r\n            Dictionary<string, string> viewArguments = new Dictionary<string, string>();\r\n            viewArguments.Add(\"serializedEntityToken\", serializedEntityToken);\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(new OpenHandledViewMessageQueueItem(EntityTokenSerializer.Serialize(entityToken, true), \"Composite.Management.PermissionEditor\", viewArguments), currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [ActionExecutor(typeof(ManageUserPermissionsActionExecutor))]\r\n    internal sealed class ManageUserPermissionsActionToken : ActionToken\r\n    {\r\n        private static PermissionType[] _permissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return \"ManageUserPermissions\";\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new ManageUserPermissionsActionToken();\r\n        }\r\n    }\r\n    #endregion\r\n\r\n\r\n\r\n    #region ShowGraph\r\n    internal sealed class RelationshipGraphActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n\r\n            if (actionToken.Serialize() == \"ShowGraph\")\r\n            {\r\n                string url = string.Format(\"{0}?EntityToken={1}\", UrlUtils.ResolveAdminUrl(\"content/views/relationshipgraph/Default.aspx\"), System.Web.HttpUtility.UrlEncode(serializedEntityToken));\r\n\r\n                ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = \"Show graph...\" }, currentConsoleId);\r\n            }\r\n            else if (actionToken.Serialize() == \"ShowOrientedGraph\")\r\n            {\r\n                \r\n                Guid id = Guid.NewGuid();\r\n                string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format(\"{0}.RelationshipGraph\", id));\r\n                C1File.WriteAllLines(filename, new string[] { serializedEntityToken });\r\n\r\n                string url = string.Format(\"{0}?Id={1}\", UrlUtils.ResolveAdminUrl(\"content/views/relationshipgraph/ShowRelationshipOrientedGraph.aspx\"), id);\r\n\r\n                ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = \"Show graph...\" }, currentConsoleId);\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [ActionExecutor(typeof(RelationshipGraphActionExecutor))]\r\n    internal sealed class RelationshipGraphActionToken : ActionToken\r\n    {\r\n        private static PermissionType[] _permissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n\r\n        private string _type;\r\n\r\n\r\n\r\n        public RelationshipGraphActionToken(string type)\r\n        {\r\n            _type = type;\r\n        }\r\n\r\n\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n\r\n\r\n        public override string Serialize()\r\n        {\r\n            return _type;\r\n        }\r\n\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new RelationshipGraphActionToken(serializedData);\r\n        }\r\n    }\r\n    #endregion\r\n\r\n\r\n\r\n    #region ShowElementInformation\r\n    internal sealed class ShowElementInformationActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            var elementInformationService = flowControllerServicesContainer.GetService<IElementInformationService>();\r\n\r\n            if (elementInformationService != null)\r\n            {\r\n                Dictionary<string, string> piggybag = elementInformationService.Piggyback;\r\n\r\n                foreach (var kvp in piggybag)\r\n                {\r\n                    Core.Serialization.StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, kvp.Value);\r\n                }\r\n            }\r\n\r\n            Guid id = Guid.NewGuid();\r\n            string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format(\"{0}.showinfo\", id));\r\n\r\n            C1File.WriteAllLines(filename, new string[] { serializedEntityToken, sb.ToString() });\r\n\r\n            string url = string.Format(\"{0}?PiggyBagId={1}\", UrlUtils.ResolveAdminUrl(\"content/views/showelementinformation/Default.aspx\"), id);\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = \"Show Element Information...\" }, currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [ActionExecutor(typeof(ShowElementInformationActionExecutor))]\r\n    internal sealed class ShowElementInformationActionToken : ActionToken\r\n    {\r\n        private static PermissionType[] _permissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return \"ShowElementInformation\";\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new ShowElementInformationActionToken();\r\n        }\r\n    }\r\n    #endregion\r\n\r\n\r\n\r\n\r\n    #region Search\r\n    internal sealed class SearchActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            SearchActionToken searchActionToken = (SearchActionToken)actionToken;\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n\r\n            string viewId = Guid.NewGuid().ToString();\r\n\r\n\r\n\r\n            string url = UrlUtils.ResolveAdminUrl(string.Format(\"content/dialogs/treesearch/treeSearchForm.aspx?ProviderName={0}&EntityToken={1}&ViewId={2}&ConsoleId={3}\", HttpUtility.UrlEncode(searchActionToken.ProviderName), HttpUtility.UrlEncode(serializedEntityToken), HttpUtility.UrlEncode(viewId), HttpUtility.UrlEncode(currentConsoleId)));\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(\r\n                new OpenViewMessageQueueItem\r\n                {\r\n                    Url = url,\r\n                    ViewId = viewId,\r\n                    ViewType = ViewType.ModalDialog,\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"RelationshipGraphActionExecutor.SearchElements\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"RelationshipGraphActionExecutor.SearchElementsToolTip\"),\r\n                    IconResourceHandle = CommonElementIcons.Question\r\n                }, currentConsoleId);\r\n\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [ActionExecutor(typeof(SearchActionExecutor))]\r\n    internal sealed class SearchActionToken : ActionToken\r\n    {\r\n        private const string _serializePrefix = \"Search:\";\r\n\r\n        internal SearchActionToken(string providerName)\r\n        {\r\n            this.ProviderName = providerName;\r\n        }\r\n\r\n\r\n        internal string ProviderName { get; private set; }\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { yield break; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return _serializePrefix + this.ProviderName;\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            if (serializedData.StartsWith(_serializePrefix) == false) throw new ArgumentException(\"Serialized data is not in correct format.\");\r\n            string providerName = serializedData.Remove(0, _serializePrefix.Length);\r\n            return new SearchActionToken(providerName);\r\n        }\r\n    }\r\n    #endregion\r\n\r\n\r\n\r\n\r\n    internal static class ElementActionProviderFacade\r\n    {\r\n        private static readonly ActionGroup AppendedActionGroup = new ActionGroup(\"Common tasks\", ActionGroupPriority.GeneralAppendMedium);\r\n\r\n        private static ResourceHandle ManageSecurityIcon { get { return GetIconHandle(\"security-manage-permissions\"); } }\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n\r\n        public static void AddActions(IEnumerable<Element> elements, string providerName)\r\n        {\r\n            string manageUserPermissionsOnBranchLabel = StringResourceSystemFacade.GetString(\"Composite.Management\", \"ManageUserPermissions.ManageUserPermissionsOnBranchLabel\");\r\n            string manageUserPermissionsItemLabel = StringResourceSystemFacade.GetString(\"Composite.Management\", \"ManageUserPermissions.ManageUserPermissionsOnItemLabel\");\r\n            string manageUserPermissionsToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"ManageUserPermissions.ManageUserPermissionsToolTip\");\r\n            string relationshipGraphLabel = StringResourceSystemFacade.GetString(\"Composite.Management\", \"RelationshipGraphActionExecutor.ShowGraph\");\r\n            string relationshipGraphToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"RelationshipGraphActionExecutor.ShowGraphToolTip\");\r\n            string relationshipOrientedGraphLabel = StringResourceSystemFacade.GetString(\"Composite.Management\", \"RelationshipGraphActionExecutor.ShowOrientedGraph\");\r\n            string relationshipOrientedGraphToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"RelationshipGraphActionExecutor.ShowOrientedGraphToolTip\");\r\n            string showElementInformationLabel = StringResourceSystemFacade.GetString(\"Composite.Management\", \"ShowElementInformationActionExecutor.ShowElementInformation.Label\");\r\n            string showElementInformationToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"ShowElementInformationActionExecutor.ShowElementInformation.ToolTip\");\r\n\r\n            IEnumerable<string> elementActionProviderNames = ElementActionProviderRegistry.ElementActionProviderNames;\r\n\r\n            if (elementActionProviderNames == null)\r\n            {\r\n                const string message = \"Failed to load one of the element action providers\";\r\n                Log.LogCritical(\"ElementActionProviderFacade\", message);\r\n\r\n                return;\r\n            }\r\n\r\n            foreach (Element element in elements)\r\n            {\r\n                AddBuildinActions(providerName, manageUserPermissionsOnBranchLabel, manageUserPermissionsItemLabel, manageUserPermissionsToolTip, relationshipGraphLabel, relationshipGraphToolTip, relationshipOrientedGraphLabel, relationshipOrientedGraphToolTip, showElementInformationLabel, showElementInformationToolTip, element);\r\n\r\n                if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowGlobal) == ElementExternalActionAdding.AllowGlobal)\r\n                {\r\n                    foreach (string elementActionProviderName in elementActionProviderNames)\r\n                    {\r\n                        try\r\n                        {\r\n                            IEnumerable<ElementAction> actions = ElementActionProviderPluginFacade.GetActions(elementActionProviderName, element.ElementHandle.EntityToken);\r\n\r\n                            element.AddAction(actions);\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            Log.LogCritical(\"ElementActionProviderFacade\", string.Format(\"Failed to add actions from the element action provider named '{0}'\", elementActionProviderName));\r\n                            Log.LogCritical(\"ElementActionProviderFacade\", ex);\r\n                        }\r\n                    }\r\n\r\n                    foreach (var elementActionProvider in ServiceLocator.GetServices<IElementActionProvider>())\r\n                    {\r\n                        try\r\n                        {\r\n                            var actions = elementActionProvider.GetActions(element.ElementHandle.EntityToken);\r\n\r\n                            element.AddAction(actions);\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            Log.LogCritical(nameof(ElementActionProviderFacade),\r\n                                $\"Failed to add actions from the element action provider '{elementActionProvider.GetType()}'\");\r\n                            Log.LogCritical(nameof(ElementActionProviderFacade), ex);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddBuildinActions(string providerName, string manageUserPermissionsOnBranchLabel, string manageUserPermissionsItemLabel, string manageUserPermissionsToolTip, string relationshipGraphLabel, string relationshipGraphToolTip, string relationshipOrientedGraphLabel, string relationshipOrientedGraphToolTip, string showElementInformationLabel, string showElementInformationToolTip, Element element)\r\n        {\r\n            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowGlobal) == ElementExternalActionAdding.AllowGlobal)\r\n            {\r\n                element.AddAction(new ElementAction(new ActionHandle(new RelationshipGraphActionToken(\"ShowGraph\")))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = relationshipGraphLabel,\r\n                        ToolTip = relationshipGraphToolTip,\r\n                        Icon = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Nodes,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.DeveloperMode,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = false,\r\n                            ActionGroup = AppendedActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new RelationshipGraphActionToken(\"ShowOrientedGraph\")))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = relationshipOrientedGraphLabel,\r\n                        ToolTip = relationshipOrientedGraphToolTip,\r\n                        Icon = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Nodes,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.DeveloperMode,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = false,\r\n                            ActionGroup = AppendedActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new ShowElementInformationActionToken()))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = showElementInformationLabel,\r\n                        ToolTip = showElementInformationToolTip,\r\n                        Icon = Composite.Core.ResourceSystem.Icons.CommonElementIcons.Search,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.DeveloperMode,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = false,\r\n                            ActionGroup = AppendedActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n\r\n\r\n\r\n\r\n                //element.AddAction(new ElementAction(new ActionHandle(new SearchActionToken(providerName)))\r\n                //{\r\n                //    VisualData = new ActionVisualizedData\r\n                //    {\r\n                //        Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"RelationshipGraphActionExecutor.Search\"),\r\n                //        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"RelationshipGraphActionExecutor.SearchToolTip\"),\r\n                //        Icon = Composite.Core.ResourceSystem.Icons.CommonCommandIcons.Search,\r\n                //        Disabled = false,\r\n                //        ActionLocation = new ActionLocation\r\n                //        {\r\n                //            ActionType = ActionType.Other,\r\n                //            IsInFolder = false,\r\n                //            IsInToolbar = false,\r\n                //            ActionGroup = AppendedActionGroup\r\n                //        }\r\n                //    }\r\n                //});\r\n\r\n                if (RuntimeInformation.IsDebugBuild)\r\n                {\r\n                }\r\n            }\r\n\r\n            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowManageUserPermissions) == ElementExternalActionAdding.AllowManageUserPermissions)\r\n            {\r\n                if (!element.Actions.Any(f => f.ActionHandle.ActionToken is ManageUserPermissionsActionToken)) // Fixing problem with the buggy virtual element provider\r\n                {\r\n                    element.AddAction(new ElementAction(new ActionHandle(new ManageUserPermissionsActionToken()))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = (element.VisualData.HasChildren ? manageUserPermissionsOnBranchLabel : manageUserPermissionsItemLabel),\r\n                            ToolTip = manageUserPermissionsToolTip,\r\n                            Icon = ManageSecurityIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Other,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = false,\r\n                                ActionGroup = AppendedActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n                }\r\n            }\r\n\r\n            if ((element.ElementExternalActionAdding & ElementExternalActionAdding.AllowProcessController) == ElementExternalActionAdding.AllowProcessController)\r\n            {\r\n                if (element.ElementHandle.EntityToken is DataEntityToken)\r\n                {\r\n                    DataEntityToken token = (DataEntityToken)element.ElementHandle.EntityToken;\r\n\r\n                    Type elementProviderType;\r\n                    if (ElementProviderRegistry.ElementProviderNames.Contains(providerName))\r\n                    {\r\n                        elementProviderType = ElementProviderRegistry.GetElementProviderType(providerName);\r\n                    }\r\n                    else\r\n                    {\r\n                        elementProviderType = ElementAttachingProviderRegistry.GetElementProviderType(providerName);\r\n                    }\r\n\r\n\r\n                    List<ElementAction> actions = ProcessControllerFacade.GetActions(token.Data, elementProviderType);\r\n                    foreach (ElementAction action in actions)\r\n                    {\r\n                        element.AddAction(action);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/ElementActionProviderRegistry.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n\tinternal static class ElementActionProviderRegistry\r\n\t{\r\n        private static IElementActionProviderRegistry _implementation = new ElementActionProviderRegistryImpl();\r\n\r\n\r\n        internal static IElementActionProviderRegistry Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n        static ElementActionProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> ElementActionProviderNames\r\n        {\r\n            get\r\n            {\r\n                return _implementation.ElementActionProviderNames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/ElementActionProviderRegistryImpl.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Elements.Plugins.ElementActionProvider;\r\nusing Composite.C1Console.Elements.Plugins.ElementActionProvider.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n\tinternal sealed class ElementActionProviderRegistryImpl : IElementActionProviderRegistry\r\n\t{\r\n        private ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        public IEnumerable<string> ElementActionProviderNames\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.ElementProviderNames;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static IConfigurationSource GetConfiguration()\r\n        {\r\n            IConfigurationSource source = ConfigurationServices.ConfigurationSource;\r\n\r\n            if (null == source)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"No configuration source specified\"));\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public List<string> ElementProviderNames;\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                IConfigurationSource configurationSource = GetConfiguration();\r\n\r\n                ElementActionProviderSettings settings = configurationSource.GetSection(ElementActionProviderSettings.SectionName) as ElementActionProviderSettings;\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration\", ElementActionProviderSettings.SectionName));\r\n                }\r\n\r\n                resources.ElementProviderNames = new List<string>();\r\n\r\n                foreach (ElementActionProviderData data in settings.ElementActionProviderPlugins)\r\n                {\r\n                    resources.ElementProviderNames.Add(data.Name);\r\n                }\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/ElementAttachingProviderFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Elements.Foundation.PluginFacades;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n\tinternal static class ElementAttachingProviderFacade\r\n\t{\r\n        public static bool HaveCustomChildElements(EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            foreach (string providerName in ElementAttachingProviderRegistry.ElementAttachingProviderNames)\r\n            {\r\n                bool result = ElementAttachingProviderPluginFacade.HaveCustomChildElements(providerName, parentEntityToken, piggybag);\r\n                if (result)\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Element> AttachElements(EntityToken parentEntityToken, Dictionary<string, string> piggybag, IEnumerable<Element> currentElements)\r\n        {\r\n            var topResults = new List<ElementAttachingProviderResult>();\r\n            var bottomResults = new List<ElementAttachingProviderResult>();\r\n\r\n            foreach (string providerName in ElementAttachingProviderRegistry.ElementAttachingProviderNames)\r\n            {\r\n                if (!ElementAttachingProviderPluginFacade.IsMultipleResultElementAttachingProvider(providerName))\r\n                {\r\n                    var result = ElementAttachingProviderPluginFacade.GetAlternateElementList(providerName, parentEntityToken, piggybag);\r\n\r\n                    if (result?.Elements == null) continue;\r\n\r\n                    if (result.Position == ElementAttachingProviderPosition.Top)\r\n                    {\r\n                        topResults.Add(result);\r\n                    }\r\n                    else if (result.Position == ElementAttachingProviderPosition.Bottom)\r\n                    {\r\n                        bottomResults.Add(result);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    var results = ElementAttachingProviderPluginFacade.GetAlternateElementLists(providerName, parentEntityToken, piggybag);\r\n\r\n                    if (results == null) continue;\r\n\r\n                    foreach (ElementAttachingProviderResult result in results)\r\n                    {\r\n                        if (result?.Elements == null) continue;\r\n\r\n                        if (result.Position == ElementAttachingProviderPosition.Top)\r\n                        {\r\n                            topResults.Add(result);\r\n                        }\r\n                        else if (result.Position == ElementAttachingProviderPosition.Bottom)\r\n                        {\r\n                            bottomResults.Add(result);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            Comparison<ElementAttachingProviderResult> sortMethod =\r\n                (r1, r2) => r2.PositionPriority - r1.PositionPriority;\r\n\r\n            topResults.Sort(sortMethod);\r\n            bottomResults.Sort(sortMethod);\r\n\r\n\r\n            IEnumerable<Element> topElements = null;\r\n            foreach (var result in topResults)\r\n            {\r\n                topElements = topElements.ConcatOrDefault(result.Elements);\r\n            }\r\n\r\n\r\n            IEnumerable<Element> bottomElements = null;\r\n            foreach (var result in bottomResults)\r\n            {\r\n                bottomElements = bottomElements.ConcatOrDefault(result.Elements);\r\n            }\r\n\r\n\r\n            return topElements\r\n                .ConcatOrDefault(currentElements)\r\n                .ConcatOrDefault(bottomElements);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/ElementAttachingProviderRegistry.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing System;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n\tinternal static class ElementAttachingProviderRegistry\r\n\t{\r\n        private static IElementAttachingProviderRegistry _implementation = new ElementAttachingProviderRegistryImpl();\r\n\r\n\r\n        internal static IElementAttachingProviderRegistry Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n        static ElementAttachingProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> ElementAttachingProviderNames\r\n        {\r\n            get\r\n            {\r\n                return _implementation.ElementAttachingProviderNames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static Type GetElementProviderType(string elementProviderName)\r\n        {\r\n            return _implementation.GetElementProviderType(elementProviderName);\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/ElementAttachingProviderRegistryImpl.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing System;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n\tinternal sealed class ElementAttachingProviderRegistryImpl : IElementAttachingProviderRegistry\r\n\t{\r\n        private ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        public IEnumerable<string> ElementAttachingProviderNames\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.ElementProviderNames.Keys;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Type GetElementProviderType(string elementProviderName)\r\n        {\r\n            if (string.IsNullOrEmpty(elementProviderName)) throw new ArgumentNullException(\"elementProviderName\");\r\n\r\n            Type type;\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                if (_resourceLocker.Resources.ElementProviderNames.TryGetValue(elementProviderName, out type) == false)\r\n                {\r\n                    throw new ArgumentException(string.Format(\"The element provider named '{0}' does not exist\", elementProviderName));\r\n                }\r\n\r\n                return type;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static IConfigurationSource GetConfiguration()\r\n        {\r\n            IConfigurationSource source = ConfigurationServices.ConfigurationSource;\r\n\r\n            if (null == source)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"No configuration source specified\"));\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Dictionary<string, Type> ElementProviderNames;\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                IConfigurationSource configurationSource = GetConfiguration();\r\n\r\n                ElementAttachingProviderSettings settings = configurationSource.GetSection(ElementAttachingProviderSettings.SectionName) as ElementAttachingProviderSettings;\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration\", ElementAttachingProviderSettings.SectionName));\r\n                }\r\n\r\n                resources.ElementProviderNames = new Dictionary<string, Type>();\r\n\r\n                foreach (ElementAttachingProviderData data in settings.ElementAttachingProviderPlugins)\r\n                {\r\n                    resources.ElementProviderNames.Add(data.Name, data.Type);\r\n                }\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/ElementProviderLoader.cs",
    "content": "﻿using Composite.C1Console.Elements.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n    internal static class ElementProviderLoader\r\n    {\r\n        public static void LoadAllProviders()\r\n        {\r\n            LoadAllElementProviders();\r\n            LoadAllAttachingProviders();\r\n        }\r\n\r\n\r\n        private static void LoadAllElementProviders()\r\n        {\r\n            var rootProvider = ElementProviderPluginFacade.GetElementProvider(ElementProviderRegistry.RootElementProviderName);\r\n\r\n            foreach (string name in ElementProviderRegistry.ElementProviderNames)\r\n            {\r\n                var provider = ElementProviderPluginFacade.GetElementProvider(name);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void LoadAllAttachingProviders()\r\n        {\r\n            foreach (string name in ElementAttachingProviderRegistry.ElementAttachingProviderNames)\r\n            {\r\n                var provider = ElementAttachingProviderPluginFacade.GetElementAttachingProvider(name);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/ElementProviderRegistry.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider.Runtime;\r\nusing Composite.C1Console.Events;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n    internal static class ElementProviderRegistry\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static ElementProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static string RootElementProviderName\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.RootElementProviderName;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> ElementProviderNames\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.ElementProviderNames.Keys;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static Type GetElementProviderType(string elementProviderName)\r\n        {\r\n            if (string.IsNullOrEmpty(elementProviderName)) throw new ArgumentNullException(\"elementProviderName\");\r\n\r\n            Type type;\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                if (_resourceLocker.Resources.ElementProviderNames.TryGetValue(elementProviderName, out type) == false)\r\n                {\r\n                    throw new ArgumentException(string.Format(\"The element provider named '{0}' does not exist\", elementProviderName));\r\n                }\r\n\r\n                return type;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static bool IsProviderHookingProvider(string elementProviderName)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                return _resourceLocker.Resources.HookingProviderNames.Contains(elementProviderName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IConfigurationSource GetConfiguration()\r\n        {\r\n            IConfigurationSource source = ConfigurationServices.ConfigurationSource;\r\n\r\n            if (null == source)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"No configuration source specified\"));\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public string RootElementProviderName;\r\n            public Dictionary<string, Type> ElementProviderNames;\r\n            public List<string> HookingProviderNames;\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                IConfigurationSource configurationSource = GetConfiguration();\r\n\r\n                ElementProviderSettings settings = configurationSource.GetSection(ElementProviderSettings.SectionName) as ElementProviderSettings;\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration\", ElementProviderSettings.SectionName));\r\n                }\r\n\r\n                resources.RootElementProviderName = settings.RootProviderName;\r\n\r\n\r\n                resources.ElementProviderNames = new Dictionary<string, Type>();\r\n                resources.HookingProviderNames = new List<string>();\r\n\r\n                foreach (HooklessElementProviderData data in settings.ElementProviderPlugins)\r\n                {\r\n                    resources.ElementProviderNames.Add(data.Name, data.Type);\r\n\r\n#pragma warning disable 612\r\n                    if ((data is ElementProviderData))\r\n                    {\r\n                        resources.HookingProviderNames.Add(data.Name);\r\n                    }\r\n#pragma warning restore 612\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/IElementActionProviderRegistry.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n    internal interface IElementActionProviderRegistry\r\n    {\r\n        IEnumerable<string> ElementActionProviderNames { get; }\r\n        void OnFlush();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/IElementAttachingProviderRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation\r\n{\r\n    internal interface IElementAttachingProviderRegistry\r\n    {\r\n        IEnumerable<string> ElementAttachingProviderNames { get; }\r\n        Type GetElementProviderType(string elementProviderName);\r\n        void OnFlush();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/PluginFacades/ElementActionProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Reflection;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementActionProvider;\r\nusing Composite.C1Console.Elements.Plugins.ElementActionProvider.Runtime;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation.PluginFacades\r\n{\r\n    internal static class ElementActionProviderPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n        static ElementActionProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<ElementAction> GetActions(string providerName, EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            IElementActionProvider elementActionProvider = GetElementActionProvider(providerName);\r\n\r\n            return elementActionProvider.GetActions(entityToken);\r\n        }\r\n\r\n\r\n        private static IElementActionProvider GetElementActionProvider(string providerName)\r\n        {\r\n            IElementActionProvider provider;\r\n\r\n            if (_resourceLocker.Resources.ProviderCache.TryGetValue(providerName, out provider) == false)\r\n            {\r\n                try\r\n                {\r\n                    provider = _resourceLocker.Resources.Factory.Create(providerName);\r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (_resourceLocker.Resources.ProviderCache.ContainsKey(providerName) == false)\r\n                        {\r\n                            _resourceLocker.Resources.ProviderCache.Add(providerName, provider);\r\n                        }\r\n                    }\r\n\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (TargetInvocationException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n            return provider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", ElementActionProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public ElementActionProviderFactory Factory { get; set; }\r\n            public Dictionary<string, IElementActionProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new ElementActionProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (TargetInvocationException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Dictionary<string, IElementActionProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/PluginFacades/ElementAttachingProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider.Runtime;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation.PluginFacades\r\n{\r\n    internal static class ElementAttachingProviderPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n        static ElementAttachingProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static bool HaveCustomChildElements(string providerName, EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            IElementAttachingProvider elementAttachingProvider = GetElementAttachingProvider(providerName);\r\n\r\n            bool result = elementAttachingProvider.HaveCustomChildElements(parentEntityToken, piggybag);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        public static ElementAttachingProviderResult GetAlternateElementList(string providerName, EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            IElementAttachingProvider elementAttachingProvider = GetElementAttachingProvider(providerName);\r\n\r\n            ElementAttachingProviderResult result = elementAttachingProvider.GetAlternateElementList(parentEntityToken, piggybag);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<ElementAttachingProviderResult> GetAlternateElementLists(string providerName, EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            var elementAttachingProvider = (IMultipleResultElementAttachingProvider)GetElementAttachingProvider(providerName);\r\n\r\n            IEnumerable<ElementAttachingProviderResult> result = elementAttachingProvider.GetAlternateElementLists(parentEntityToken, piggybag);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Element> GetChildren(string providerName, EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            IElementAttachingProvider elementAttachingProvider = GetElementAttachingProvider(providerName);\r\n\r\n            IEnumerable<Element> result = elementAttachingProvider.GetChildren(parentEntityToken, piggybag);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        public static bool IsMultipleResultElementAttachingProvider(string providerName)\r\n        {\r\n            return GetElementAttachingProvider(providerName) is IMultipleResultElementAttachingProvider;\r\n        }\r\n\r\n\r\n\r\n        internal static IElementAttachingProvider GetElementAttachingProvider(string providerName)\r\n        {\r\n            IElementAttachingProvider provider;\r\n\r\n            if (_resourceLocker.Resources.ProviderCache.TryGetValue(providerName, out provider) == false)\r\n            {\r\n                try\r\n                {\r\n                    provider = _resourceLocker.Resources.Factory.Create(providerName);\r\n\r\n                    provider.Context = new ElementProviderContext(providerName);\r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (_resourceLocker.Resources.ProviderCache.ContainsKey(providerName) == false)\r\n                        {\r\n                            _resourceLocker.Resources.ProviderCache.Add(providerName, provider);\r\n                        }\r\n                    }\r\n\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n            return provider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException($\"Failed to load the configuration section '{ElementAttachingProviderSettings.SectionName}' from the configuration.\", ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public ElementAttachingProviderFactory Factory { get; set; }\r\n            public Dictionary<string, IElementAttachingProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new ElementAttachingProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Dictionary<string, IElementAttachingProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Foundation/PluginFacades/ElementProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider.Runtime;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Foundation.PluginFacades\r\n{\r\n    internal static class ElementProviderPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static ElementProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Element> GetRoots(string providerName, SearchToken seachToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n\r\n            IEnumerable<Element> roots = GetElementProvider(providerName).GetRoots(seachToken);\r\n\r\n            return roots ?? Enumerable.Empty<Element>();\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Element> GetChildren(string providerName, EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNull(entityToken, nameof(entityToken));\r\n\r\n            IEnumerable<Element> children = GetElementProvider(providerName).GetChildren(entityToken, seachToken);\r\n\r\n            return children ?? Enumerable.Empty<Element>();\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<LabeledProperty> GetLabeledProperties(string providerName, EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNull(entityToken, nameof(entityToken));\r\n\r\n            ILabeledPropertiesElementProvider labledElementProvider = GetElementProvider(providerName) as ILabeledPropertiesElementProvider;\r\n            if (labledElementProvider == null) throw new ArgumentException($\"The Element Provider identified by the specified provider name does not implement {typeof(ILabeledPropertiesElementProvider)}\");\r\n\r\n            IEnumerable<LabeledProperty> properties = labledElementProvider.GetLabeledProperties(entityToken);\r\n\r\n            return properties ?? Enumerable.Empty<LabeledProperty>();\r\n        }\r\n\r\n\r\n\r\n#pragma warning disable 612\r\n        public static List<EntityTokenHook> GetHooks(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n\r\n            IElementProvider provider = GetElementProvider(providerName) as IElementProvider;\r\n            if (provider == null) throw new ArgumentException($\"The Element Provider identified by the specified provider name does not implement {typeof(IElementProvider)}\");\r\n\r\n\r\n            List<EntityTokenHook> hooks = provider.GetHooks();\r\n\r\n            return hooks ?? new List<EntityTokenHook>();\r\n        }\r\n#pragma warning restore 612\r\n\r\n\r\n\r\n        public static bool ContainsLocalizedData(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n\r\n            var provider = GetElementProvider(providerName) as ILocaleAwareElementProvider;\r\n            if (provider == null) throw new ArgumentException($\"The Element Provider identified by the specified provider name does not implement {typeof(ILocaleAwareElementProvider)}\");\r\n\r\n            return provider.ContainsLocalizedData;\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Element> GetForeignRoots(string providerName, SearchToken seachToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n\r\n            ILocaleAwareElementProvider provider = GetElementProvider(providerName) as ILocaleAwareElementProvider;\r\n            if (provider == null) throw new ArgumentException($\"The Element Provider identified by the specified provider name does not implement {typeof(ILocaleAwareElementProvider)}\");\r\n\r\n            return provider.GetForeignRoots(seachToken);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Element> GetForeignChildren(string providerName, EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNull(entityToken, nameof(entityToken));\r\n\r\n            var provider = GetElementProvider(providerName) as ILocaleAwareElementProvider;\r\n            if (provider == null) throw new ArgumentException($\"The Element Provider identified by the specified provider name does not implement {typeof(ILocaleAwareElementProvider)}\");\r\n\r\n            return provider.GetForeignChildren(entityToken, seachToken);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<LabeledProperty> GetForeignLabeledProperties(string providerName, EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n\r\n            ILocaleAwareLabeledPropertiesElementProvider provider = GetElementProvider(providerName) as ILocaleAwareLabeledPropertiesElementProvider;\r\n            if (provider == null) throw new ArgumentException($\"The Element Provider identified by the specified provider name does not implement {typeof(ILocaleAwareElementProvider)}\");\r\n\r\n            return provider.GetForeignLabeledProperties(entityToken);\r\n        }\r\n\r\n\r\n\r\n        public static object GetData(string providerName, string dataName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNullOrEmpty(dataName, nameof(dataName));\r\n\r\n            IDataExchangingElementProvider provider = GetElementProvider(providerName) as IDataExchangingElementProvider;\r\n            if (provider == null) throw new ArgumentException($\"The Element Provider identified by the specified provider name does not implement {typeof(IDataExchangingElementProvider)}\");\r\n\r\n            return provider.GetData(dataName);\r\n        }\r\n\r\n\r\n\r\n        public static bool GetNewSearchToken(string providerName, EntityToken entityToken, out SearchToken searchToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNull(entityToken, nameof(entityToken));\r\n\r\n            var provider = GetElementProvider(providerName) as ICustomSearchElementProvider;\r\n\r\n            if (provider == null)\r\n            {\r\n                searchToken = null;\r\n                return false;\r\n            }\r\n\r\n            searchToken = provider.GetNewSearchToken(entityToken);\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public static bool GetSearchFormDefinition(string providerName, EntityToken entityToken, out XmlReader formDefinition)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNull(entityToken, nameof(entityToken));\r\n\r\n            var provider = GetElementProvider(providerName) as ICustomSearchElementProvider;\r\n\r\n            if (provider == null)\r\n            {\r\n                formDefinition = null;\r\n                return false;\r\n            }\r\n\r\n            formDefinition = provider.GetSearchFormDefinition(entityToken);\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public static bool GetSearchFormBindings(string providerName, EntityToken entityToken, out Dictionary<string, object> bindings)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNull(entityToken, nameof(entityToken));\r\n\r\n            var provider = GetElementProvider(providerName) as ICustomSearchElementProvider;\r\n\r\n            if (provider == null)\r\n            {\r\n                bindings = null;\r\n                return false;\r\n            }\r\n\r\n            bindings = provider.GetSearchFormBindings(entityToken);\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public static bool OnElementDraggedAndDropped(string providerName, EntityToken draggedEntityToken, EntityToken newParentEntityToken, int dropIndex, DragAndDropType dragAndDropType, FlowControllerServicesContainer draggedElementFlowControllerServicesContainer)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNull(draggedEntityToken, nameof(draggedEntityToken));\r\n            Verify.ArgumentNotNull(newParentEntityToken, nameof(newParentEntityToken));\r\n            Verify.ArgumentNotNull(draggedElementFlowControllerServicesContainer, nameof(draggedElementFlowControllerServicesContainer));\r\n\r\n            var provider = GetElementProvider(providerName) as IDragAndDropElementProvider;\r\n            if (provider == null) throw new ArgumentException($\"The Element Provider identified byu the specified provider name does not implement {typeof(IDragAndDropElementProvider)}\");\r\n\r\n            return provider.OnElementDraggedAndDropped(draggedEntityToken, newParentEntityToken, dropIndex, dragAndDropType, draggedElementFlowControllerServicesContainer);\r\n        }\r\n\r\n\r\n\r\n        public static bool IsLocaleAwareElementProvider(string providerName)\r\n        {\r\n            var elementProvider = GetElementProvider(providerName) as ILocaleAwareElementProvider;\r\n\r\n            return elementProvider != null;\r\n        }\r\n\r\n\r\n\r\n        internal static IHooklessElementProvider GetElementProvider(string providerName)\r\n        {\r\n            IHooklessElementProvider provider;\r\n\r\n            if (!_resourceLocker.Resources.ProviderCache.TryGetValue(providerName, out provider))\r\n            {\r\n                try\r\n                {\r\n                    if (ElementProviderRegistry.IsProviderHookingProvider(providerName))\r\n                    {\r\n                        provider = _resourceLocker.Resources.Factory.Create(providerName);\r\n                    }\r\n                    else\r\n                    {\r\n                        provider = _resourceLocker.Resources.HooklessFactory.Create(providerName);\r\n                    }\r\n\r\n                    provider.Context = new ElementProviderContext(providerName);\r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (!_resourceLocker.Resources.ProviderCache.ContainsKey(providerName))\r\n                        {\r\n                            _resourceLocker.Resources.ProviderCache.Add(providerName, provider);\r\n                        }\r\n                    }\r\n\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n            return provider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException($\"Failed to load the configuration section '{ElementProviderSettings.SectionName}' from the configuration.\", ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public ElementProviderFactory Factory { get; private set; }\r\n            public HooklessElementProviderFactory HooklessFactory { get; private set; }\r\n\r\n            public Dictionary<string, IHooklessElementProvider> ProviderCache { get; private set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new ElementProviderFactory();\r\n                    resources.HooklessFactory = new HooklessElementProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Dictionary<string, IHooklessElementProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/IElementDataExchangeService.cs",
    "content": "﻿using Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    internal interface IElementDataExchangeService : IFlowControllerService\r\n    {\r\n        object GetData(string name);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/IServiceUrlToEntityTokenMapper.cs",
    "content": "﻿using Composite.C1Console.Security;\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>\r\n    /// Allows Data Scope Services to Add or Clean their parameters to or from the URL and update a entity token with their associate properties\r\n    /// </summary>\r\n    public interface IServiceUrlToEntityTokenMapper\r\n    {\r\n        /// <summary>\r\n        /// Gets a URL and Returns the url with parametres associated with an entity token, or original URL if current entity token does not support this kind of entity token.\r\n        /// </summary>\r\n        /// <param name=\"url\">The url.</param>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        /// <returns>A URL that will display the data item - this can be an \"internal\" URL which is later transformed by a IInternalUrlConverter. Intended for public consumption.</returns>\r\n        string ProcessUrl(string url, EntityToken entityToken);\r\n\r\n        /// <summary>\r\n        /// Updates an entity token according to a url.\r\n        /// </summary>\r\n        /// <param name=\"url\">The url.</param>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        /// <returns></returns>\r\n        EntityToken TryGetEntityToken(string url, ref EntityToken entityToken);\r\n\r\n        /// <summary>\r\n        /// Gets a url and cleans it up from its parameters.\r\n        /// </summary>\r\n        /// <param name=\"url\">The url.</param>\r\n        /// <returns></returns>\r\n        string CleanUrl(ref string url);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/IUrlToEntityTokenMapper.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>\r\n    /// Allows associating C1 console tree elements with a url for public consumption (TryGetURL) and for the C1 console browser (TryGetBrowserViewSettings)\r\n    /// </summary>\r\n    public interface IUrlToEntityTokenMapper\r\n    {\r\n        /// <summary>\r\n        /// Returns a url associated with an entity token, or null if current entity token does not support this kind of entity token.\r\n        /// </summary>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        /// <returns>A URL that will display the data item - this can be an \"internal\" URL which is later transformed by a IInternalUrlConverter. Intended for public consumption.</returns>\r\n        string TryGetUrl(EntityToken entityToken);\r\n\r\n        /// <summary>\r\n        /// For use in the C1 Console explorer's browser - returns url and tooling options associated with an entity token,  or null if current entity token does not support this kind of entity token.\r\n        /// </summary>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        /// <param name=\"showPublishedView\">When true (and element has draft/published content) the published version is desired</param>\r\n        /// <returns>BrowserViewSettings directing how the C1 Console Brorser should behave (what URL to show and if tooling should be available).</returns>\r\n        BrowserViewSettings TryGetBrowserViewSettings(EntityToken entityToken, bool showPublishedView);\r\n\r\n        /// <summary>\r\n        /// Returns an entity token associated with a url, or null if current <see cref=\"IUrlToEntityTokenMapper\"/> does not support this kind of entity token.\r\n        /// </summary>\r\n        /// <param name=\"url\">The url.</param>\r\n        /// <returns></returns>\r\n        EntityToken TryGetEntityToken(string url);\r\n    }\r\n\r\n    /// <summary>\r\n    /// Describes a browser view - URL and if tooling should be active.\r\n    /// </summary>\r\n    public sealed class BrowserViewSettings\r\n    {\r\n        /// <summary>\r\n        /// Constructs a new instance on the BrowserViewSettings class.\r\n        /// </summary>\r\n        public BrowserViewSettings()\r\n        {\r\n        }\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance on the BrowserViewSettings class.\r\n        /// </summary>\r\n        /// <param name=\"url\">Url to load in browser</param>\r\n        /// <param name=\"toolingOn\">True if tooling (view, SEO tools etc) should be active for URL</param>\r\n        public BrowserViewSettings(string url, bool toolingOn)\r\n        {\r\n            if (string.IsNullOrEmpty(url)) throw new ArgumentException(\"URL not set\", \"url\");\r\n\r\n            Url = url;\r\n            ToolingOn = toolingOn;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Url to load in browser\r\n        /// </summary>\r\n        public string Url { get; set; }\r\n\r\n        /// <summary>\r\n        /// True if tooling (view, SEO tools etc) should be active for URL\r\n        /// </summary>\r\n        public bool ToolingOn { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/LabeledProperty.cs",
    "content": "﻿\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class LabeledProperty\r\n\t{\r\n        /// <summary>\r\n        /// Initializes a new instance of the LabeledProperty class and sets the label to the specified name.\r\n        /// </summary>\r\n        /// <param name=\"name\"></param>\r\n        /// <param name=\"value\"></param>\r\n        public LabeledProperty(string name, string value)\r\n            : this (name, name, value )\r\n        { }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the LabeledProperty class.\r\n        /// </summary>\r\n        /// <param name=\"name\"></param>\r\n        /// <param name=\"label\"></param>\r\n        /// <param name=\"value\"></param>\r\n        public LabeledProperty(string name, string label, string value)\r\n        {\r\n            this.Name = name;\r\n            this.Label = label;\r\n            this.Value = value;\r\n        }\r\n\r\n        /// <summary>\r\n        /// The name of the property. The name is constant across cultures and is intended as an id other systems can use.\r\n        /// </summary>\r\n        public string Name { get; set; }\r\n\r\n        /// <summary>\r\n        /// The label the user should see.\r\n        /// </summary>\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// The value of the property\r\n        /// </summary>\r\n        public string Value { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/LabeledPropertyList.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    internal class LabeledPropertyList : IEnumerable<LabeledProperty>\r\n    {\r\n        private List<LabeledProperty> _list = new List<LabeledProperty>();\r\n\r\n\r\n        public void Add(string name, string value)\r\n        {\r\n            _list.Add(new LabeledProperty(name, value));\r\n        }\r\n\r\n\r\n        public void Add(string name, object value)\r\n        {\r\n            _list.Add(new LabeledProperty(name, value.ToString()));\r\n        }\r\n\r\n\r\n        public void Add(string name, string label, string value)\r\n        {\r\n            _list.Add(new LabeledProperty(name, label, value));\r\n        }\r\n\r\n        public void Add(string name, string label, object value)\r\n        {\r\n            _list.Add(new LabeledProperty(name, label, value.ToString()));\r\n        }\r\n\r\n        public IEnumerator<LabeledProperty> GetEnumerator()\r\n        {\r\n            return _list.GetEnumerator();\r\n        }\r\n\r\n        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()\r\n        {\r\n            return _list.GetEnumerator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/PiggybagSerializer.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class PiggybagSerializer\r\n\t{\r\n        /// <exclude />\r\n        public static string Serialize(Dictionary<string, string> piggybag)\r\n        {\r\n            var sb = new StringBuilder();\r\n\r\n            foreach (KeyValuePair<string, string> kvp in piggybag)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, kvp.Value);\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<string, string> Deserialize(string serializedPiggybag)\r\n        {\r\n            Dictionary<string, string> piggyback = new Dictionary<string, string>();\r\n\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedPiggybag);\r\n\r\n            foreach (var kvp in dic)\r\n            {\r\n                piggyback.Add(kvp.Key, StringConversionServices.DeserializeValueString(kvp.Value));\r\n            }\r\n\r\n            return piggyback;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementActionProvider/ElementActionProviderData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementActionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(NonConfigurableElementActionProvider))]\r\n    public class ElementActionProviderData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementActionProvider/IElementActionProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementActionProvider.Runtime;\r\nusing Composite.C1Console.Security;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementActionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [CustomFactory(typeof(ElementActionProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(ElementActionProviderDefaultNameRetriever))]\r\n\tpublic interface IElementActionProvider\r\n\t{\r\n        /// <exclude />\r\n        IEnumerable<ElementAction> GetActions(EntityToken entityToken);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementActionProvider/NonConfigurableElementActionProvider.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementActionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Assembler(typeof(NonConfigurableElementActionProviderAssembler))]\r\n    public class NonConfigurableElementActionProvider : ElementActionProviderData\r\n    {\r\n    }\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NonConfigurableElementActionProviderAssembler : IAssembler<IElementActionProvider, ElementActionProviderData>\r\n    {\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IElementActionProvider Assemble(IBuilderContext context, ElementActionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IElementActionProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementActionProvider/Runtime/ElementActionProviderCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementActionProvider.Runtime\r\n{\r\n    internal sealed class ElementActionProviderCustomFactory : AssemblerBasedCustomFactory<IElementActionProvider, ElementActionProviderData>\r\n    {\r\n        protected override ElementActionProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ElementActionProviderSettings settings = configurationSource.GetSection(ElementActionProviderSettings.SectionName) as ElementActionProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ElementActionProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.ElementActionProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementActionProvider/Runtime/ElementActionProviderDefaultNameRetriever.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementActionProvider.Runtime\r\n{\r\n    internal sealed class ElementActionProviderDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementActionProvider/Runtime/ElementActionProviderFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementActionProvider.Runtime\r\n{\r\n    internal sealed class ElementActionProviderFactory : NameTypeFactoryBase<IElementActionProvider>\r\n    {\r\n        public ElementActionProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementActionProvider/Runtime/ElementActionProviderSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementActionProvider.Runtime\r\n{\r\n    internal sealed class ElementActionProviderSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.C1Console.Elements.Plugins.ElementActionProviderConfiguration\";\r\n\r\n\r\n        private const string _elementActionProviderPluginsProperty = \"ElementActionProviderPlugins\";\r\n        [ConfigurationProperty(_elementActionProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<ElementActionProviderData> ElementActionProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<ElementActionProviderData>)base[_elementActionProviderPluginsProperty];\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementAttachingProvider/ElementAttachingProviderData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementAttachingProvider\r\n{\r\n    /// <exclude />\r\n    [ConfigurationElementType(typeof(NonConfigurableElementAttachingProvider))]\r\n    public class ElementAttachingProviderData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementAttachingProvider/IElementAttachingProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider.Runtime;\r\nusing Composite.C1Console.Security;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementAttachingProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum ElementAttachingProviderPosition\r\n    {\r\n        /// <summary>\r\n        /// At the top\r\n        /// </summary>\r\n        Top = 0,\r\n\r\n        /// <summary>\r\n        /// At the bottom\r\n        /// </summary>\r\n        Bottom = 1\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ElementAttachingProviderResult\r\n    {\r\n        /// <exclude />\r\n        public ElementAttachingProviderResult()\r\n        {\r\n            this.Position = ElementAttachingProviderPosition.Bottom;\r\n        }\r\n\r\n        /// <summary>\r\n        /// IF this is null, then the hole result is ignored\r\n        /// </summary>\r\n        public IEnumerable<Element> Elements { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public ElementAttachingProviderPosition Position { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// This is used if more than one element attaching provider is adding elements.\r\n        /// Bigger is higher.\r\n        /// </summary>\r\n        public int PositionPriority { get; set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [CustomFactory(typeof(ElementAttachingProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(ElementAttachingProviderDefaultNameRetriever))]\r\n\tpublic interface IElementAttachingProvider\r\n\t{\r\n        /// <summary>\r\n        /// The system will supply an ElementProviderContext to the provider\r\n        /// to use for creating ElementHandles\r\n        /// </summary>\r\n        ElementProviderContext Context { set; }\r\n\r\n\r\n        /// <summary>\r\n        /// This is only called when rendering root nodes. Used to switch HasChildren from false to true.\r\n        /// </summary>\r\n        /// <param name=\"parentEntityToken\"></param>\r\n        /// /// <param name=\"piggybag\"></param>\r\n        /// <returns></returns>\r\n        bool HaveCustomChildElements(EntityToken parentEntityToken, Dictionary<string, string> piggybag);\r\n\r\n\r\n        /// <summary>\r\n        /// If null is returned, the result is ignored\r\n        /// </summary>\r\n        /// <param name=\"parentEntityToken\"></param>\r\n        /// <param name=\"piggybag\"></param>\r\n        /// <returns></returns>\r\n        ElementAttachingProviderResult GetAlternateElementList(EntityToken parentEntityToken, Dictionary<string, string> piggybag);\r\n\r\n\r\n        /// <exclude />\r\n        IEnumerable<Element> GetChildren(EntityToken parentEntityToken, Dictionary<string, string> piggybag);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementAttachingProvider/IMultipleResultElementAttachingProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementAttachingProvider\r\n{\r\n\tinternal interface IMultipleResultElementAttachingProvider : IElementAttachingProvider\r\n\t{\r\n        /// <summary>\r\n        /// If null is returned, the result is ignored\r\n        /// </summary>\r\n        /// <param name=\"parentEntityToken\"></param>\r\n        /// <param name=\"piggybag\"></param>\r\n        /// <returns></returns>\r\n        IEnumerable<ElementAttachingProviderResult> GetAlternateElementLists(EntityToken parentEntityToken, Dictionary<string, string> piggybag);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementAttachingProvider/NonConfigurableElementAttachingProvider.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementAttachingProvider\r\n{\r\n    /// <exclude />\r\n    [Assembler(typeof(NonConfigurableElementAttachingProviderAssembler))]\r\n    public class NonConfigurableElementAttachingProvider : ElementAttachingProviderData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableElementAttachingProviderAssembler : IAssembler<IElementAttachingProvider, ElementAttachingProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IElementAttachingProvider Assemble(IBuilderContext context, ElementAttachingProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IElementAttachingProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementAttachingProvider/Runtime/ElementAttachingProviderCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementAttachingProvider.Runtime\r\n{\r\n    internal sealed class ElementAttachingProviderCustomFactory : AssemblerBasedCustomFactory<IElementAttachingProvider, ElementAttachingProviderData>\r\n    {\r\n        protected override ElementAttachingProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ElementAttachingProviderSettings settings = configurationSource.GetSection(ElementAttachingProviderSettings.SectionName) as ElementAttachingProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ElementAttachingProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.ElementAttachingProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementAttachingProvider/Runtime/ElementAttachingProviderDefaultNameRetriever.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementAttachingProvider.Runtime\r\n{\r\n    internal sealed class ElementAttachingProviderDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementAttachingProvider/Runtime/ElementAttachingProviderFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementAttachingProvider.Runtime\r\n{\r\n    internal sealed class ElementAttachingProviderFactory : NameTypeFactoryBase<IElementAttachingProvider>\r\n\t{\r\n        public ElementAttachingProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementAttachingProvider/Runtime/ElementAttachingProviderSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementAttachingProvider.Runtime\r\n{\r\n    internal sealed class ElementAttachingProviderSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.C1Console.Elements.Plugins.ElementAttachingProviderConfiguration\";\r\n\r\n\r\n        private const string _elementAttachingProviderPluginsProperty = \"ElementAttachingProviderPlugins\";\r\n        [ConfigurationProperty(_elementAttachingProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<ElementAttachingProviderData> ElementAttachingProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<ElementAttachingProviderData>)base[_elementAttachingProviderPluginsProperty];\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/ElementProviderData.cs",
    "content": "using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing System.ComponentModel;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    [Obsolete]\r\n    [ConfigurationElementType(typeof(NonConfigurableElementProvider))]\r\n    public class ElementProviderData : HooklessElementProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/HooklessElementProviderData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing System.ComponentModel;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(NonConfigurableHooklessElementProvider))]\r\n    public class HooklessElementProviderData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/ICustomSearchElementProvider.cs",
    "content": "using System.Xml;\r\nusing Composite.C1Console.Security;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n    internal interface ICustomSearchElementProvider : IHooklessElementProvider\r\n    {\r\n        SearchToken GetNewSearchToken(EntityToken entityToken);\r\n        XmlReader GetSearchFormDefinition(EntityToken entityToken);\r\n        Dictionary<string, object> GetSearchFormBindings(EntityToken entityToken);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/IDataExchangingElementProvider.cs",
    "content": "﻿\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n    internal interface IDataExchangingElementProvider : IHooklessElementProvider\r\n    {\r\n        object GetData(string name);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/IDragAndDropElementProvider.cs",
    "content": "using Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n    /// <summary>\r\n    /// You can implement this interface on your element provider to handle the \"drag and drop\" event.\r\n    /// </summary>\r\n    public interface IDragAndDropElementProvider : IHooklessElementProvider\r\n    {\r\n        /// <summary>\r\n        /// Invoked when an element is dropped\r\n        /// </summary>\r\n        /// <param name=\"draggedEntityToken\">The <see cref=\"EntityToken\"/> of the element being dragged</param>\r\n        /// <param name=\"newParentEntityToken\">The <see cref=\"EntityToken\"/> of the element receiving the dragged item</param>\r\n        /// <param name=\"dropIndex\">The index (position) the element was dropped</param>\r\n        /// <param name=\"dragAndDropType\">The type identifying the drang and drop action</param>\r\n        /// <param name=\"draggedElementFlowControllerServicesContainer\">handle that let you communicate to client via services (like popping a dialog)</param>\r\n        /// <returns>True is action completed as expected and tree should be updated on the client</returns>\r\n        bool OnElementDraggedAndDropped(EntityToken draggedEntityToken, EntityToken newParentEntityToken, int dropIndex, DragAndDropType dragAndDropType, FlowControllerServicesContainer draggedElementFlowControllerServicesContainer);\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Specifies the kind of action that should happen on drop\r\n    /// </summary>\r\n    public enum DragAndDropType\r\n    {\r\n        /// <summary>\r\n        /// The element is moved\r\n        /// </summary>\r\n        Move,\r\n        /// <summary>\r\n        /// The element is copied\r\n        /// </summary>\r\n        Copy\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/IElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider.Runtime;\r\nusing Composite.C1Console.Security;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Obsolete(\"Use interfaces IElementAttachingProvider and IAuxiliarySecurityAncestorProvider instead\")]\r\n    [CustomFactory(typeof(ElementProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(ElementProviderDefaultNameRetriever))]\r\n    public interface IElementProvider : IHooklessElementProvider\r\n    {\r\n        /// <summary>\r\n        /// Hooks are not affected by searches.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        List<EntityTokenHook> GetHooks();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/IHooklessElementProvider.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider.Runtime;\r\nusing Composite.C1Console.Security;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n    /// <summary>    \r\n    /// This interface is implemented by element providers - plug-ins that can decorate the C1 Console tree structure with elements.\r\n    /// </summary>\r\n    [CustomFactory(typeof(HooklessElementProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(HooklessElementProviderDefaultNameRetriever))]\r\n    public interface IHooklessElementProvider\r\n    {\r\n        /// <summary>\r\n        /// The system will supply an ElementProviderContext to the provider\r\n        /// to use for creating <see cref=\"ElementHandle\"/>-s\r\n        /// </summary>\r\n        ElementProviderContext Context { set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the provider's root elements \r\n        /// </summary>\r\n        /// <param name=\"seachToken\">\r\n        /// If this is null the provider should not do any filtering. If this is not null the provider\r\n        /// should do the appropriate filtering on its elements. \r\n        /// If the provider does not want to be a part of a search and this variable is not null,\r\n        /// the provider should return an empty list\r\n        /// </param>\r\n        /// <returns>Root elements</returns>\r\n        IEnumerable<Element> GetRoots(SearchToken seachToken);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the children of a given element\r\n        /// </summary>\r\n        /// <param name=\"entityToken\">The parent element of the elements to return</param>\r\n        /// <param name=\"seachToken\">\r\n        /// If this is <value>null</value> the provider should not do any filtering. If this is not null the provider\r\n        /// should do the appropriate filtering on its elements. \r\n        /// If the provider does not want to be a part of a search and this variable is not null,\r\n        /// the provider should return an empty list\r\n        /// </param>\r\n        /// <returns>Child elements</returns>\r\n        IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken);        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/ILabeledPropertiesElementProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n\tinternal interface ILabeledPropertiesElementProvider : IHooklessElementProvider\r\n\t{\r\n        IEnumerable<LabeledProperty> GetLabeledProperties(EntityToken entityToken);        \r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/ILocaleAwareElementProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Security;\r\n\r\n// The namespace is wrong but is left for backwards compatibility\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface ILocaleAwareElementProvider : IHooklessElementProvider\r\n    {\r\n        /// <exclude />\r\n        bool ContainsLocalizedData { get; }\r\n\r\n        /// <exclude />\r\n        IEnumerable<Element> GetForeignRoots(SearchToken searchToken);\r\n\r\n        /// <exclude />\r\n        IEnumerable<Element> GetForeignChildren(EntityToken entityToken, SearchToken searchToken);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/ILocaleAwareLabeledPropertiesElementProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n\tinternal interface ILocaleAwareLabeledPropertiesElementProvider : ILocaleAwareElementProvider\r\n\t{\r\n        IEnumerable<LabeledProperty> GetForeignLabeledProperties(EntityToken entityToken);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/NonConfigurableElementProvider.cs",
    "content": "using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing System.ComponentModel;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n#pragma warning disable 612\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    [Obsolete]\r\n    [Assembler(typeof(NonConfigurableElementProviderAssembler))]\r\n    public class NonConfigurableElementProvider : ElementProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    [Obsolete]\r\n    public sealed class NonConfigurableElementProviderAssembler : IAssembler<IElementProvider, ElementProviderData>\r\n    {\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IElementProvider Assemble(IBuilderContext context, ElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IElementProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n\r\n#pragma warning restore 612\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/NonConfigurableHooklessElementProvider.cs",
    "content": "using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableHooklessElementProviderAssembler))]\r\n    internal class NonConfigurableHooklessElementProvider : HooklessElementProviderData\r\n    {\r\n    }\r\n\r\n\r\n    internal sealed class NonConfigurableHooklessElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IHooklessElementProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/Runtime/ElementProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider.Runtime\r\n{\r\n#pragma warning disable 612\r\n\r\n    internal sealed class ElementProviderCustomFactory : AssemblerBasedCustomFactory<IElementProvider, ElementProviderData>\r\n    {\r\n        protected override ElementProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ElementProviderSettings settings = configurationSource.GetSection(ElementProviderSettings.SectionName) as ElementProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ElementProviderSettings.SectionName));\r\n            }\r\n\r\n            return (ElementProviderData)settings.ElementProviderPlugins.Get(name);\r\n        }\r\n    }\r\n\r\n#pragma warning restore 612\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/Runtime/ElementProviderDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider.Runtime\r\n{\r\n    internal sealed class ElementProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/Runtime/ElementProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider.Runtime\r\n{\r\n#pragma warning disable 612\r\n\r\n    internal sealed class ElementProviderFactory : NameTypeFactoryBase<IElementProvider>\r\n    {\r\n        public ElementProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n\r\n#pragma warning restore 612\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/Runtime/ElementProviderSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.Core.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider.Runtime\r\n{\r\n    internal sealed class ElementProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Elements.Plugins.ElementProviderConfiguration\";\r\n\r\n\r\n        private const string _rootProviderNameProperty = \"rootProviderName\";\r\n        [ConfigurationProperty(_rootProviderNameProperty, IsRequired = true)]\r\n        public string RootProviderName\r\n        {\r\n            get { return (string)base[_rootProviderNameProperty]; }\r\n            set { base[_rootProviderNameProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _elementProviderPluginsProperty = \"ElementProviderPlugins\";\r\n        [ConfigurationProperty(_elementProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<HooklessElementProviderData> ElementProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<HooklessElementProviderData>)base[_elementProviderPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/Runtime/HooklessElementProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider.Runtime\r\n{\r\n    internal sealed class HooklessElementProviderCustomFactory : AssemblerBasedCustomFactory<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        protected override HooklessElementProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ElementProviderSettings settings = configurationSource.GetSection(ElementProviderSettings.SectionName) as ElementProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ElementProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.ElementProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/Runtime/HooklessElementProviderDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider.Runtime\r\n{\r\n    internal sealed class HooklessElementProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/Plugins/ElementProvider/Runtime/HooklessElementProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.Plugins.ElementProvider.Runtime\r\n{\r\n    internal sealed class HooklessElementProviderFactory : NameTypeFactoryBase<IHooklessElementProvider>\r\n    {\r\n        public HooklessElementProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/SearchToken.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>\r\n    /// Class that describe a element provider search. Sub class this for more specific fields. As a minimum a Keyword is present.\r\n    /// </summary>\r\n    public class SearchToken\r\n    {\r\n        /// <summary>\r\n        /// Keyword to search for\r\n        /// </summary>\r\n        public string Keyword { get; set; }\r\n\r\n        /// <summary>\r\n        /// Serializes this instance\r\n        /// </summary>\r\n        /// <returns>String representation</returns>\r\n        public string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.SerializeObject(this);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Deserializes a search token\r\n        /// </summary>\r\n        /// <param name=\"serializedSearchToken\">String representation of searchtoken</param>\r\n        /// <returns>Deserialized SearchToken</returns>\r\n        public static SearchToken Deserialize( string serializedSearchToken )\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(serializedSearchToken, nameof(serializedSearchToken));\r\n\r\n            if (serializedSearchToken.StartsWith(\"{\"))\r\n            {\r\n                return CompositeJsonSerializer.Deserialize<SearchToken>(serializedSearchToken);\r\n            }\r\n\r\n            return DeserializeLegacy(serializedSearchToken);\r\n        }\r\n\r\n        private static SearchToken DeserializeLegacy(string serializedSearchToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(serializedSearchToken, nameof(serializedSearchToken));\r\n            Verify.ArgumentCondition(serializedSearchToken.IndexOf('|') > -1, nameof(serializedSearchToken), \"Malformed serializedSearchToken - must be formated like '<class name>|<serialized values>'\");\r\n\r\n            string[] parts = serializedSearchToken.Split('|');\r\n\r\n            string className = parts[0];\r\n            string serializedSearchTokenWithoutClassName = parts[1];\r\n\r\n            Type searchTokenType = TypeManager.GetType(className);\r\n\r\n            SearchToken searchToken = (SearchToken)SerializationFacade.Deserialize(searchTokenType, serializedSearchTokenWithoutClassName);\r\n\r\n            return searchToken;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal static class SeachTokenExtensionMethods\r\n    {\r\n        /// <summary>\r\n        /// This method return <value>true</value> if the <paramref name=\"searchToken\"/> is NOT null and the keyword is NOT null or empty\r\n        /// </summary>\r\n        /// <param name=\"searchToken\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsValidKeyword(this SearchToken searchToken)\r\n        {\r\n            return searchToken != null && !searchToken.Keyword.IsNullOrEmpty();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/ShowErrorElementHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    internal static class ShowErrorElementHelper\r\n    {\r\n        public static Element CreateErrorElement(string label, string toolTip, string message)\r\n        {\r\n            Element errorElement = new Element(new ElementHandle(\"DUMMYPROVIDER\", new NoSecurityEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = label,\r\n                    ToolTip = toolTip,\r\n                    Icon = ResourceHandle.BuildIconFromDefaultProvider(\"close\"),\r\n                    OpenedIcon = ResourceHandle.BuildIconFromDefaultProvider(\"close\"),\r\n                    HasChildren = false\r\n                }\r\n            };\r\n\r\n\r\n            errorElement.AddAction(new ElementAction(new ActionHandle(new MessageBoxActionToken(\r\n                label,\r\n                message,\r\n                C1Console.Events.DialogType.Error\r\n            )))\r\n            {\r\n                VisualData = new ActionVisualizedData()\r\n                {\r\n                    Label = label,\r\n                    ToolTip = toolTip,\r\n                    Icon = ResourceHandle.BuildIconFromDefaultProvider(\"close\"),\r\n                    ActionLocation = ActionLocation.OtherPrimaryActionLocation\r\n                }\r\n            });\r\n\r\n\r\n            return errorElement;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/TreeLockBehavior.cs",
    "content": "﻿namespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>\r\n    /// When client is searching through elements to find the element with the given entity token, \r\n    /// the client should disregard elements with TreeLockBehavior = None and continue searching.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic enum TreeLockBehavior\r\n\t{\r\n        /// <exclude />\r\n        None,\r\n\r\n        /// <exclude />\r\n        Normal\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Elements/UrlToEntityTokenFacade.cs",
    "content": "﻿using System.Collections.Concurrent;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.C1Console.Elements\r\n{\r\n    /// <summary>\r\n    /// Associates C1 console tree elements with a url to be used for public consumption or showing in the C1 console browser.\r\n    /// </summary>\r\n    public static class UrlToEntityTokenFacade\r\n    {\r\n        private const string LogTitle = nameof(UrlToEntityTokenFacade);\r\n\r\n        private static readonly ConcurrentBag<IUrlToEntityTokenMapper> _mappers = new ConcurrentBag<IUrlToEntityTokenMapper>();\r\n        private static readonly ConcurrentBag<IServiceUrlToEntityTokenMapper> _serviceMappers = new ConcurrentBag<IServiceUrlToEntityTokenMapper>();\r\n\r\n        /// <summary>\r\n        /// Returns a url associated with an entity token, or null if current entity token does not support this kind of entity token.\r\n        /// </summary>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        /// <returns>URL for public consumption</returns>\r\n        public static string TryGetUrl(EntityToken entityToken)\r\n        {\r\n            var theUrl = _mappers.Select(mapper => mapper.TryGetUrl(entityToken)).FirstOrDefault(url => url != null);\r\n\r\n            return ProcessUrlWithServiceMappers(theUrl, entityToken);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a url / tooling settings associated with an entity token to be used in the C1 Console browser, or null if current entity token does not support this kind of entity token.\r\n        /// </summary>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        /// <param name=\"showPublishedView\">When <value>true</value> will show a published version of the page/data item.</param>\r\n        /// <returns>URL for public consumption</returns>\r\n        public static BrowserViewSettings TryGetBrowserViewSettings(EntityToken entityToken, bool showPublishedView)\r\n        {\r\n            var theBrowserSetting = _mappers.Select(mapper => \r\n                mapper.TryGetBrowserViewSettings(entityToken, showPublishedView))\r\n                      .FirstOrDefault(settings => settings?.Url != null);\r\n\r\n            if (theBrowserSetting == null) return null;\r\n\r\n            var originalUrl = theBrowserSetting.Url;\r\n            theBrowserSetting.Url = ProcessUrlWithServiceMappers(originalUrl, entityToken);\r\n\r\n            return theBrowserSetting;\r\n        }\r\n\r\n\r\n        private static string ProcessUrlWithServiceMappers(string url, EntityToken entityToken)\r\n        {\r\n            _serviceMappers.ForEach(service =>\r\n            {\r\n                url = service.ProcessUrl(url, entityToken);\r\n            });\r\n\r\n            return url;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns an entity token associated with a url, or null if current <see cref=\"IUrlToEntityTokenMapper\"/> does not support this kind of entity token.\r\n        /// </summary>\r\n        /// <param name=\"url\">The url.</param>\r\n        /// <returns></returns>\r\n        public static EntityToken TryGetEntityToken(string url)\r\n        {\r\n            var originalUrl = url;\r\n            _serviceMappers.Select(sm => sm.CleanUrl(ref url));\r\n            var baseEntityToken = _mappers.Select(mapper => mapper.TryGetEntityToken(url)).FirstOrDefault(entityToken => entityToken != null);\r\n            _serviceMappers.Select(sm => sm.TryGetEntityToken(originalUrl, ref baseEntityToken));\r\n            return baseEntityToken;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Register an implementation of <see cref=\"IUrlToEntityTokenMapper\" />\r\n        /// </summary>\r\n        /// <param name=\"mapper\"></param>\r\n        public static void Register(IUrlToEntityTokenMapper mapper)\r\n        {\r\n            Verify.ArgumentNotNull(mapper, nameof(mapper));\r\n\r\n            if (_mappers.Count > 100)\r\n            {\r\n                Log.LogWarning(LogTitle, \"More than 100 implementations of {0}-s registered: possible memory leak. Registered type: {1}\",\r\n                    nameof(IUrlToEntityTokenMapper), mapper.GetType().FullName);\r\n                return;\r\n            }\r\n\r\n            _mappers.Add(mapper);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Register an implementation of <see cref=\"IUrlToEntityTokenMapper\" />\r\n        /// </summary>\r\n        /// <param name=\"serviceMapper\"></param>\r\n        public static void Register(IServiceUrlToEntityTokenMapper serviceMapper)\r\n        {\r\n            Verify.ArgumentNotNull(serviceMapper, nameof(serviceMapper));\r\n\r\n            if (_serviceMappers.Count > 100)\r\n            {\r\n                Log.LogWarning(LogTitle, \"More than 100 implementations of {0}-s registered: possible memory leak. Registered type: {1}\",\r\n                    nameof(IServiceUrlToEntityTokenMapper), serviceMapper.GetType().FullName);\r\n                return;\r\n            }\r\n\r\n            _serviceMappers.Add(serviceMapper);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/BindEntityTokenToViewQueueItem.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class BindEntityTokenToViewQueueItem : IConsoleMessageQueueItem\r\n\t{\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/BroadcastMessageQueueItem.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class BroadcastMessageQueueItem : IConsoleMessageQueueItem\r\n\t{\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Value { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/CloseAllViewsMessageQueueItem.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class CloseAllViewsMessageQueueItem : IConsoleMessageQueueItem    \r\n\t{\r\n        /// <exclude />\r\n        public string Reason { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/CloseViewMessageQueueItem.cs",
    "content": "using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class CloseViewMessageQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/CollapseAndRefreshConsoleMessageQueueItem.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class CollapseAndRefreshConsoleMessageQueueItem : IConsoleMessageQueueItem    \r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/ConsoleFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Runtime;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ConsoleClosedEventArgs : EventArgs\r\n    {\r\n        /// <exclude />\r\n        public ConsoleClosedEventArgs(string consoleId)\r\n        {\r\n            this.ConsoleId = consoleId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ConsoleId { get; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ConsoleFacade\r\n    {\r\n        private static readonly string LogTitle = nameof(ConsoleFacade);\r\n\r\n        /// <exclude />\r\n        public delegate void ConsoleClosedEventDelegate(ConsoleClosedEventArgs args);\r\n\r\n        private static TimeSpan? _timeout;\r\n        private static bool _initialized;\r\n        private static readonly object _lock = new object();\r\n        private static event ConsoleClosedEventDelegate _consoleClosedEvent;\r\n\r\n\r\n        /// <exclude />\r\n        public static void Initialize()\r\n        {\r\n            WorkflowFacade.RunWhenInitialized(() =>\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_initialized)\r\n                    {\r\n                        WorkflowInstance workflowInstance = WorkflowFacade.CreateNewWorkflow(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Events.Workflows.UserConsoleInformationScavengerWorkflow\"));\r\n                        workflowInstance.Start();\r\n                        WorkflowFacade.RunWorkflow(workflowInstance);\r\n\r\n                        if (RuntimeInformation.IsDebugBuild)\r\n                        {\r\n                            Log.LogVerbose(LogTitle, \"Scavenger started\");\r\n                        }\r\n                        _initialized = true;\r\n                    }\r\n                }\r\n            });\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Flush code MAY NOT do ANY kind of re-initialization. \r\n        /// </summary>\r\n        /// <param name=\"eventDelegate\"></param>\r\n        public static void SubscribeToConsoleClosedEvent(ConsoleClosedEventDelegate eventDelegate)\r\n        {\r\n            _consoleClosedEvent += eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeFromConsoleClosedEvent(ConsoleClosedEventDelegate eventDelegate)\r\n        {\r\n            _consoleClosedEvent -= eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void CloseConsole(string consoleId)\r\n        {\r\n            UnregisterConsole(UserSettings.Username, consoleId);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetConsoleIdsByUsername(string username)\r\n        {\r\n            return (from d in DataFacade.GetData<IUserConsoleInformation>()\r\n                    where d.Username == username\r\n                    select d.ConsoleId).ToList();\r\n        }\r\n\r\n\r\n\r\n        internal static void RegisterConsole(string username, string consoleId)\r\n        {\r\n            using(GlobalInitializerFacade.CoreIsInitializedScope) \r\n            lock (_lock)\r\n            {\r\n                IUserConsoleInformation userConsoleInformation =\r\n                    (from d in DataFacade.GetData<IUserConsoleInformation>()\r\n                     where d.Username == username &&\r\n                           d.ConsoleId == consoleId\r\n                     select d).FirstOrDefault();\r\n\r\n                if (userConsoleInformation == null)\r\n                {\r\n                    Log.LogVerbose(LogTitle, $\"New console registred by '{username}' id = '{consoleId}'\");\r\n\r\n                    userConsoleInformation = DataFacade.BuildNew<IUserConsoleInformation>();\r\n                    userConsoleInformation.Id = Guid.NewGuid();\r\n                    userConsoleInformation.Username = username;\r\n                    userConsoleInformation.ConsoleId = consoleId;\r\n                    userConsoleInformation.TimeStamp = DateTime.Now;\r\n                    DataFacade.AddNew<IUserConsoleInformation>(userConsoleInformation);\r\n                }\r\n                else\r\n                {\r\n                    userConsoleInformation.TimeStamp = DateTime.Now;\r\n                    DataFacade.Update(userConsoleInformation);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void UnregisterConsole(string username, string consoleId)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                List<IUserConsoleInformation> userConsoleInformations =\r\n                    (from d in DataFacade.GetData<IUserConsoleInformation>()\r\n                     where d.Username == username && d.ConsoleId == consoleId\r\n                     select d).ToList();\r\n\r\n                foreach (IUserConsoleInformation userConsoleInformation in userConsoleInformations)\r\n                {\r\n                    Log.LogVerbose(LogTitle, \"Console unregistred by '{0}' id = '{1}'\", userConsoleInformation.Username, userConsoleInformation.ConsoleId);\r\n\r\n                    DataFacade.Delete<IUserConsoleInformation>(userConsoleInformation);\r\n\r\n                    FireConsoleClosedEvent(userConsoleInformation.ConsoleId);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void Scavenge()\r\n        {\r\n            if(RuntimeInformation.IsDebugBuild)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Starting scavenger run\");\r\n            }\r\n\r\n            using(GlobalInitializerFacade.CoreIsInitializedScope) // Holding this lock in order to avoid deadlocks\r\n            lock (_lock)\r\n            {\r\n                DateTime now = DateTime.Now;\r\n                List<IUserConsoleInformation> userConsoleInformations =\r\n                    (from d in DataFacade.GetData<IUserConsoleInformation>()\r\n                     select d).ToList();\r\n\r\n                foreach (IUserConsoleInformation userConsoleInformation in userConsoleInformations)\r\n                {\r\n                    if (now - userConsoleInformation.TimeStamp > Timeout)\r\n                    {\r\n                        Log.LogWarning(LogTitle, \"The console '{0}' owned by the user '{1}' timed out, closing it\", userConsoleInformation.ConsoleId, userConsoleInformation.Username);\r\n                        DataFacade.Delete<IUserConsoleInformation>(userConsoleInformation);\r\n                        FireConsoleClosedEvent(userConsoleInformation.ConsoleId);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static TimeSpan Timeout => _timeout ?? (_timeout = GlobalSettingsFacade.ConsoleTimeout).Value;\r\n\r\n\r\n        private static void FireConsoleClosedEvent(string consoleId)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _consoleClosedEvent?.Invoke(new ConsoleClosedEventArgs(consoleId));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/ConsoleMessageQueueFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Events.Foundation;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ConsoleMessageQueueFacade\r\n    {\r\n        private static ConsoleMessageQueue _messageQeueue = new ConsoleMessageQueue(GlobalSettingsFacade.ConsoleMessageQueueItemSecondToLive);\r\n\r\n        // Dont add flush / initialize to this class. We do not want console messages to get lost.\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"consoleMessageQueueItem\"></param>\r\n        /// <param name=\"receiverConsoleId\">null or empty string is a broardcast</param>\r\n        public static void Enqueue(IConsoleMessageQueueItem consoleMessageQueueItem, string receiverConsoleId)\r\n        {\r\n            if (consoleMessageQueueItem == null) throw new ArgumentNullException(\"consoleMessageQueueItem\");\r\n\r\n            _messageQeueue.Enqueue(consoleMessageQueueItem, receiverConsoleId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<ConsoleMessageQueueElement> GetQueueElements(int currentConsoleCounter, string consoleId)\r\n        {\r\n            return _messageQeueue.GetQueueElements(currentConsoleCounter, consoleId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static int GetLatestMessageNumber(string consoleId)\r\n        {\r\n            return _messageQeueue.GetLatestMessageNumber(consoleId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static int CurrentChangeNumber\r\n        {\r\n            get\r\n            {\r\n                return _messageQeueue.CurrentQueueItemNumber;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void DoDebugSerializationToFileSystem()\r\n        {\r\n            _messageQeueue.DoDebugSerializationToFileSystem();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/DialogTypeEnum.cs",
    "content": "﻿\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum DialogType\r\n    {\r\n        /// <exclude />\r\n        Message,\r\n        \r\n        /// <exclude />\r\n        Question,\r\n        \r\n        /// <exclude />\r\n        Warning,\r\n        \r\n        /// <exclude />\r\n        Error\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/DownloadFileMessageQueueItem.cs",
    "content": "using Composite.Core.ResourceSystem;\r\nusing System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class DownloadFileMessageQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public DownloadFileMessageQueueItem(string urlToDownload)\r\n        {\r\n            this.Url = urlToDownload;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/FlushAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>\r\n    /// This attribute registres a method that can be called to make a local flush\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Class)]\r\n    public class FlushAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"methodName\">The name of the method to call when doing a local flush. Must be of type: static void() </param>\r\n        public FlushAttribute(string methodName)\r\n        {\r\n            this.MethodName = methodName;            \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string MethodName { get; private set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/Foundation/ConsoleMessageQueue.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Events.Foundation\r\n{\r\n    internal sealed class ConsoleMessageQueue\r\n    {\r\n        private const string MessageQueueFileName = \"ConsoleMessages.xml\";\r\n        private int _queueItemCounter = 1;\r\n        private readonly object _lock = new object();\r\n        private readonly TimeSpan _timeInterval;\r\n        private List<ConsoleMessageQueueElement> _elements = new List<ConsoleMessageQueueElement>();\r\n        private string MessageQueueFilePath { get; set; }\r\n        private readonly Timer _timer;\r\n\r\n\r\n        public ConsoleMessageQueue(int secondsForItemToLive)\r\n        {\r\n            string directory = PathUtil.Resolve(GlobalSettingsFacade.SerializedConsoleMessagesDirectory);\r\n            if (!C1Directory.Exists(directory)) C1Directory.CreateDirectory(directory);\r\n\r\n            MessageQueueFilePath = Path.Combine(directory, MessageQueueFileName);\r\n\r\n            _timeInterval = new TimeSpan(0, 0, secondsForItemToLive);\r\n\r\n            DeserializeMessagesFromFileSystem();\r\n\r\n            _timer = new Timer(OnWeed, null, new TimeSpan(0, 0, 0), _timeInterval);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"queueItem\"></param>\r\n        /// <param name=\"receiverConsoleId\">null or empty string is a broardcast</param>        \r\n        public void Enqueue(IConsoleMessageQueueItem queueItem, string receiverConsoleId)\r\n        {\r\n            if (queueItem == null) throw new ArgumentNullException(\"queueItem\");\r\n            if (receiverConsoleId == \"\") receiverConsoleId = null;\r\n\r\n\r\n            lock (_lock)\r\n            {\r\n                var queueElement = new ConsoleMessageQueueElement\r\n                   {\r\n                       ReceiverConsoleId = receiverConsoleId,\r\n                       QueueItemNumber = ++_queueItemCounter,\r\n                       EnqueueTime = DateTime.Now,\r\n                       QueueItem = queueItem\r\n                   };\r\n\r\n\r\n                _elements.Add(queueElement);\r\n\r\n                SerializeMessagesToFileSystem();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<ConsoleMessageQueueElement> GetQueueElements(int currentConsoleCounter, string consoleId)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (consoleId == null)\r\n                {\r\n                    return (from element in _elements\r\n                            where element.QueueItemNumber > currentConsoleCounter\r\n                            orderby element.QueueItemNumber\r\n                            select element).ToList();\r\n                }\r\n\r\n                return (from element in _elements\r\n                        where element.QueueItemNumber > currentConsoleCounter &&\r\n                             (element.ReceiverConsoleId == consoleId || element.ReceiverConsoleId == null)\r\n                        orderby element.QueueItemNumber\r\n                        select element).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public int GetLatestMessageNumber(string consoleId)\r\n        {\r\n            Verify.ArgumentNotNull(consoleId, \"consoleId\");\r\n\r\n            lock (_lock)\r\n            {\r\n                for (int i = _elements.Count - 1; i >= 0; i--)\r\n                {\r\n                    string receiverConsoleId = _elements[i].ReceiverConsoleId;\r\n                    if (receiverConsoleId == null || receiverConsoleId == consoleId)\r\n                    {\r\n                        return _elements[i].QueueItemNumber;\r\n                    }\r\n                }\r\n            }\r\n            return 0;\r\n        }\r\n\r\n\r\n\r\n        public int CurrentQueueItemNumber\r\n        {\r\n            get\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    return _queueItemCounter;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void OnWeed(object obj)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                CleanOutOldMessages(_elements);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void CleanOutOldMessages(List<ConsoleMessageQueueElement> listToClean)\r\n        {\r\n            if (listToClean == null) return;\r\n\r\n            DateTime now = DateTime.Now;\r\n\r\n            int count = listToClean.Count<ConsoleMessageQueueElement>(element => element.EnqueueTime + _timeInterval < now);\r\n\r\n            if (count > 0)\r\n            {\r\n                listToClean.RemoveRange(0, count);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void DoDebugSerializationToFileSystem()\r\n        {\r\n            SerializeMessagesToFileSystem(true);\r\n        }\r\n\r\n\r\n\r\n        private void SerializeMessagesToFileSystem(bool forDebug = false)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (_elements != null && _elements.Count > 0)\r\n                {\r\n                    IXmlSerializer xmlSerializer = GetMessageListXmlSerializer();\r\n\r\n                    XElement serializedMessages = xmlSerializer.Serialize(_elements.GetType(), _elements);\r\n\r\n                    string serializedConsoleMessagesDir = PathUtil.Resolve((forDebug ? GlobalSettingsFacade.TempDirectory : GlobalSettingsFacade.SerializedConsoleMessagesDirectory));\r\n\r\n                    string queueElementsXmlFilePath = Path.Combine(serializedConsoleMessagesDir, MessageQueueFileName);\r\n\r\n                    serializedMessages.SaveToPath(queueElementsXmlFilePath);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DeserializeMessagesFromFileSystem()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (!C1File.Exists(MessageQueueFilePath)) return;\r\n\r\n                XElement serializedMessages;\r\n\r\n                try\r\n                {\r\n                    serializedMessages = XElementUtils.Load(MessageQueueFilePath);\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                IXmlSerializer xmlSerializer = GetMessageListXmlSerializer();\r\n\r\n                _elements = xmlSerializer.Deserialize(serializedMessages) as List<ConsoleMessageQueueElement>;\r\n                if (_elements == null) _elements = new List<ConsoleMessageQueueElement>();\r\n\r\n                CleanOutOldMessages(_elements);\r\n\r\n                if (_elements.Any())\r\n                {\r\n                    _queueItemCounter = _elements.Max(f => f.QueueItemNumber);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void LogMessageQueue(IEnumerable<ConsoleMessageQueueElement> messageQueue, string title = null)\r\n        {\r\n            if (title != null) Log.LogInformation(\"ConsoleMessageQueue\", title);\r\n\r\n            foreach (ConsoleMessageQueueElement element in messageQueue)\r\n            {\r\n                Log.LogInformation(\"ConsoleMessageQueue\", string.Format(\"Message: ItemNumber: {0}, Type: {1}\", element.QueueItemNumber, element.QueueItem.GetType().Name));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IXmlSerializer GetMessageListXmlSerializer()\r\n        {\r\n            IXmlSerializer xmlSerializer = new XmlSerializer(new IValueXmlSerializer[] {\r\n                    new SystemPrimitivValueXmlSerializer(),\r\n                    new SerializerHandlerValueXmlSerializer(),\r\n                    new ConsoleMessageQueueElementListValueXmlSerializer(),\r\n                    new SystemCollectionValueXmlSerializer(),\r\n                    new SystemTypesValueXmlSerializer(),\r\n                    new SystemSerializableValueXmlSerializer()});\r\n\r\n            return xmlSerializer;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/Foundation/ConsoleMessageQueueElement.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Events.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConsoleMessageQueueElement\r\n    {\r\n        /// <exclude />\r\n        public string ReceiverConsoleId\r\n        {\r\n            get;\r\n            internal set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public int QueueItemNumber \r\n        { \r\n            get;\r\n            internal set; \r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public DateTime EnqueueTime \r\n        { \r\n            get;\r\n            internal set; \r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IConsoleMessageQueueItem QueueItem\r\n        {\r\n            get;\r\n            internal set; \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/Foundation/ConsoleMessageQueueElementListValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Serialization;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.C1Console.Events.Foundation\r\n{\r\n    internal sealed class ConsoleMessageQueueElementListValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedList)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n            if (xmlSerializer == null) throw new ArgumentNullException(\"xmlSerializer\");\r\n\r\n            serializedList = null;\r\n            if (objectToSerializeType != typeof(List<ConsoleMessageQueueElement>)) return false;\r\n\r\n            List<ConsoleMessageQueueElement> queueElements = objectToSerialize as List<ConsoleMessageQueueElement>;\r\n\r\n            serializedList = new XElement(\"ConsoleMessageQueueElements\");\r\n\r\n            if (queueElements != null)\r\n            {\r\n                foreach (ConsoleMessageQueueElement queueElement in queueElements)\r\n                {\r\n                    XElement serializedQueueItem = xmlSerializer.Serialize(queueElement.QueueItem.GetType(), queueElement.QueueItem);\r\n\r\n                    XElement serializedElement = new XElement(\"QueueElement\",\r\n                        new XAttribute(\"time\", queueElement.EnqueueTime),\r\n                        new XAttribute(\"number\", queueElement.QueueItemNumber),\r\n                        new XAttribute(\"itemtype\", queueElement.QueueItem.GetType()),\r\n                        serializedQueueItem);\r\n\r\n                    if (string.IsNullOrEmpty(queueElement.ReceiverConsoleId) == false)\r\n                    {\r\n                        serializedElement.Add(new XAttribute(\"console\", queueElement.ReceiverConsoleId));\r\n                    }\r\n\r\n                    serializedList.Add(serializedElement);\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n            if (xmlSerializer == null) throw new ArgumentNullException(\"xmlSerializer\");\r\n\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject.Name.LocalName != \"ConsoleMessageQueueElements\") return false;\r\n\r\n            List<ConsoleMessageQueueElement> queueElements = new List<ConsoleMessageQueueElement>();\r\n\r\n            foreach (XElement queueElement in serializedObject.Elements())\r\n            {\r\n                ConsoleMessageQueueElement result = new ConsoleMessageQueueElement();\r\n                result.EnqueueTime = DateTime.Parse(queueElement.Attribute(\"time\").Value);\r\n                result.QueueItemNumber = Int32.Parse(queueElement.Attribute(\"number\").Value);\r\n                if (queueElement.Attribute(\"console\") != null)\r\n                    result.ReceiverConsoleId = queueElement.Attribute(\"console\").Value;\r\n\r\n                try\r\n                {\r\n                    result.QueueItem = (IConsoleMessageQueueItem)xmlSerializer.Deserialize(queueElement.Elements().First());\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    string errorInfo = string.Format(\"Deserialization of message #{0} failed with an '{1}' exception - the message has been dropped. Details: '{2}'\", queueElement.Attribute(\"number\").Value, ex.GetType().Name, ex.Message);\r\n                    // pad queue to ensure sequence.\r\n                    LoggingService.LogWarning(\"ConsoleMessageQueue\", errorInfo);\r\n                    result.QueueItem = new LogEntryMessageQueueItem { Level = LogLevel.Error, Message = errorInfo, Sender = this.GetType() }; \r\n                }\r\n\r\n                queueElements.Add(result);\r\n            }\r\n\r\n            deserializedObject = queueElements;\r\n            return true;\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Events/GlobalEventSystemFacade.cs",
    "content": "using System;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class FlushEventArgs : EventArgs\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PostFlushEventArgs : EventArgs\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ShutDownEventArgs : EventArgs\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PrepareForShutDownEventArgs : EventArgs\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class GlobalEventSystemFacade\r\n    {\r\n        private static readonly string LogTitle = \"RGB(255, 128, 255)GlobalEventSystemFacade\";\r\n\r\n        /// <exclude />\r\n        public delegate void FlushEventDelegate(FlushEventArgs args);\r\n\r\n        /// <exclude />\r\n        public delegate void PostFlushEventDelegate(PostFlushEventArgs args);\r\n\r\n        /// <exclude />\r\n        public delegate void ShutDownEventDelegate(ShutDownEventArgs args);\r\n\r\n        /// <exclude />\r\n        public delegate void PrepareForShutDownEventDelegate(PrepareForShutDownEventArgs args);\r\n\r\n        /// <exclude />\r\n        public delegate void DesignChangeEventDelegate();\r\n\r\n        private static event FlushEventDelegate _flushEvent;\r\n        private static event PostFlushEventDelegate _postFlushEvent;\r\n        private static event ShutDownEventDelegate _shutDownEvent;\r\n        private static event PrepareForShutDownEventDelegate _prepareForShutDownEvent;\r\n\r\n\r\n        /// <summary>\r\n        /// Occurs when elements related to frontend appearance have changed. F.e. css styling changed, or function's rendering changed.\r\n        /// </summary>\r\n        public static event DesignChangeEventDelegate OnDesignChange;\r\n\r\n\r\n        /// <summary>\r\n        /// Flush code MAY NOT do ANY kind of re-initialization. \r\n        /// </summary>\r\n        /// <param name=\"eventDelegate\"></param>\r\n        public static void SubscribeToFlushEvent(FlushEventDelegate eventDelegate)\r\n        {\r\n            _flushEvent += eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToPostFlushEvent(PostFlushEventDelegate eventDelegate)\r\n        {\r\n            _postFlushEvent += eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeFromFlushEvent(FlushEventDelegate eventDelegate)\r\n        {\r\n            _flushEvent -= eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void FlushTheSystem()\r\n        {\r\n            FlushTheSystem(false);\r\n        }\r\n\r\n\r\n\r\n        internal static void FlushTheSystem(bool waitForHooksInitialization)\r\n        {\r\n            GlobalInitializerFacade.ReinitializeTheSystem(\r\n                delegate()\r\n                {\r\n                    FireFlushEvent();\r\n\r\n                \t// LoadDynamicTypesInformation();\r\n\r\n                    FirePostFlushEvent();\r\n                }, waitForHooksInitialization);\r\n        }\r\n\r\n\r\n        private static void FireFlushEvent()\r\n        {\r\n            if (_flushEvent != null)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"----------========== Firing Flush Events ==========----------\");\r\n                int startTime = Environment.TickCount;\r\n\r\n                FlushEventDelegate flushEvent = _flushEvent;\r\n\r\n                flushEvent(new FlushEventArgs());\r\n\r\n                int endTime = Environment.TickCount;\r\n                Log.LogVerbose(LogTitle, string.Format(\"----------========== Done firing Flush Events ({0} ms ) ==========----------\", endTime - startTime));\r\n            }\r\n        }\r\n\r\n\r\n        private static void FirePostFlushEvent()\r\n        {\r\n            if (_postFlushEvent != null)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"----------========== Firing Post Flush Events ==========----------\");\r\n                int startTime = Environment.TickCount;\r\n\r\n                PostFlushEventDelegate postFlushEvent = _postFlushEvent;\r\n\r\n                postFlushEvent(new PostFlushEventArgs());\r\n\r\n                int endTime = Environment.TickCount;\r\n                Log.LogVerbose(LogTitle, string.Format(\"----------========== Done firing Post Flush Events ({0} ms ) ==========----------\", endTime - startTime));\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToPrepareForShutDownEvent(PrepareForShutDownEventDelegate eventDelegate)\r\n        {\r\n            _prepareForShutDownEvent += eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToShutDownEvent(ShutDownEventDelegate eventDelegate)\r\n        {\r\n            _shutDownEvent += eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeFromPrepareForShutDownEvent(PrepareForShutDownEventDelegate eventDelegate)\r\n        {\r\n            _prepareForShutDownEvent -= eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeFromShutDownEvent(ShutDownEventDelegate eventDelegate)\r\n        {\r\n            _shutDownEvent -= eventDelegate;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void PrepareForShutDown()\r\n        {\r\n            if(_prepareForShutDownEvent != null)\r\n            {\r\n                _prepareForShutDownEvent(new PrepareForShutDownEventArgs());\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void ShutDownTheSystem()\r\n        {\r\n            GlobalInitializerFacade.UninitializeTheSystem(FireShutDownEvent);\r\n        }\r\n\r\n\r\n\r\n        private static void FireShutDownEvent()\r\n        {\r\n            if (_shutDownEvent != null)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"----------========== Firing Shut Down Events ==========----------\");\r\n                int startTime = Environment.TickCount;\r\n\r\n                ShutDownEventDelegate shutDownEvent = _shutDownEvent;\r\n\r\n                shutDownEvent(new ShutDownEventArgs());\r\n\r\n                int endTime = Environment.TickCount;\r\n                Log.LogVerbose(LogTitle, string.Format(\"----------========== Done firing Shut Down Events ({0} ms ) ==========----------\", endTime - startTime));\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void FireDesignChangeEvent()\r\n        {\r\n            var handler = OnDesignChange;\r\n\r\n            if (handler != null)\r\n            {\r\n                handler();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/IConsoleMessageQueueItem.cs",
    "content": "namespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// A message that is send to C1 console client\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IConsoleMessageQueueItem\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/IManagementConsoleMessageService.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IManagementConsoleMessageService : IFlowControllerService\r\n    {\r\n        /// <exclude />\r\n        void CloseCurrentView();\r\n\r\n        /// <exclude />\r\n        void RefreshTreeSection(EntityToken entityToken);\r\n\r\n        /// <exclude />\r\n        void ShowMessage(DialogType dialogType, string title, string message);\r\n\r\n        /// <exclude />\r\n        void ShowGlobalMessage(DialogType dialogType, string title, string message);\r\n\r\n        /// <exclude />\r\n        void ShowLogEntry(Type sender, Exception exception);\r\n\r\n        /// <exclude />\r\n        void ShowLogEntry(Type sender, LogLevel logLevel, string message);\r\n\r\n        /// <exclude />\r\n        bool HasView { get; }\r\n\r\n        /// <exclude />\r\n        bool CloseCurrentViewRequested { get; }\r\n\r\n        /// <exclude />\r\n        string CurrentConsoleId { get; }\r\n\r\n        /// <exclude />\r\n        void RebootConsole();\r\n\r\n        /// <exclude />\r\n        void CollapseAndRefresh();\r\n\r\n        /// <exclude />\r\n        void LockSystem();\r\n\r\n        /// <exclude />\r\n        void BroadcastMessage(string name, string value);\r\n\r\n        /// <exclude />\r\n        void SaveStatus(bool succeeded);\r\n\r\n        /// <exclude />\r\n        void BindEntityTokenToView(string entityToken);\r\n\r\n        /// <exclude />\r\n        void SelectElement(string entityToken);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/LockSystemConsoleMessageQueueItem.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class LockSystemConsoleMessageQueueItem : IConsoleMessageQueueItem\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/LogEntryMessageQueueItem.cs",
    "content": "using System;\r\n\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class LogEntryMessageQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public Type Sender { get; set; }\r\n\r\n        /// <exclude />\r\n        public LogLevel Level { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Message { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/ManagementConsoleMessageService.cs",
    "content": "﻿using System;\r\nusing System.Text;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    internal sealed class ManagementConsoleMessageService : IManagementConsoleMessageService\r\n    {\r\n        private bool _closeCurrentViewRequested = false;\r\n\r\n        public ManagementConsoleMessageService(string consoleId)\r\n        {\r\n            if (consoleId == null) throw new ArgumentNullException(\"consoleId\");\r\n\r\n            this.ConsoleId = consoleId;\r\n        }\r\n\r\n\r\n        public ManagementConsoleMessageService(string consoleId, string viewId)\r\n        {\r\n            if (consoleId == null) throw new ArgumentNullException(\"consoleId\");\r\n\r\n            this.ConsoleId = consoleId;\r\n            this.ViewId = viewId;\r\n        }\r\n\r\n        private string ConsoleId { get; set; }\r\n        private string ViewId { get; set; }\r\n\r\n\r\n\r\n        public bool HasView\r\n        {\r\n            get\r\n            {\r\n                return (string.IsNullOrEmpty(this.ViewId) == false);\r\n            }\r\n        }\r\n\r\n\r\n        public void CloseCurrentView()\r\n        {\r\n            if (string.IsNullOrEmpty(this.ViewId)) throw new InvalidOperationException(\"Can not close current view. No view ID has been associated with this message service\");\r\n\r\n            if (_closeCurrentViewRequested == false)\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new CloseViewMessageQueueItem { ViewId = this.ViewId }, this.ConsoleId);\r\n            }\r\n\r\n            _closeCurrentViewRequested = true;\r\n        }\r\n\r\n\r\n        public void RefreshTreeSection(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            if (GlobalSettingsFacade.BroadcastConsoleElementChanges)\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem { EntityToken = entityToken }, null);\r\n            }\r\n            else\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem { EntityToken = entityToken }, this.ConsoleId);\r\n            }\r\n        }\r\n\r\n\r\n        public void ShowLogEntry(Type sender, Exception exception)\r\n        {\r\n            StringBuilder messageBuilder = new StringBuilder();\r\n\r\n            Exception logException = exception;\r\n\r\n            string indention = \"\";\r\n\r\n            while (logException != null)\r\n            {\r\n                messageBuilder.AppendLine(String.Format(\"{0}{1} threw an exception of type {2}\", indention, logException.Source, logException.GetType()));\r\n                messageBuilder.AppendLine(indention + logException.Message);\r\n                if (logException.StackTrace != null)\r\n                {\r\n                    messageBuilder.AppendLine(indention + logException.StackTrace.Replace(\"\\n\", \"\\n\" + indention));\r\n                }\r\n\r\n                indention += \"     \";\r\n                logException = logException.InnerException;\r\n                if (logException != null) messageBuilder.AppendLine();\r\n            }\r\n\r\n            ShowLogEntry(sender, LogLevel.Fatal, messageBuilder.ToString());\r\n        }\r\n\r\n\r\n        public void ShowLogEntry(Type sender, LogLevel logLevel, string message)\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new LogEntryMessageQueueItem { Sender = sender, Level = logLevel, Message = message }, this.ConsoleId);\r\n        }\r\n\r\n\r\n        public void ShowMessage(DialogType dialogType, string title, string message)\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new MessageBoxMessageQueueItem { DialogType = dialogType, Title = title, Message = message }, this.ConsoleId);\r\n        }\r\n\r\n\r\n        public void ShowGlobalMessage(DialogType dialogType, string title, string message)\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new MessageBoxMessageQueueItem { DialogType = dialogType, Title = title, Message = message }, null);\r\n        }\r\n\r\n        public bool CloseCurrentViewRequested\r\n        {\r\n            get { return _closeCurrentViewRequested; }\r\n        }\r\n\r\n        public string CurrentConsoleId\r\n        {\r\n            get { return this.ConsoleId; }\r\n        }\r\n\r\n        public void RebootConsole()\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), this.ConsoleId);\r\n        }\r\n\r\n        public void CollapseAndRefresh()\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new CollapseAndRefreshConsoleMessageQueueItem(), this.ConsoleId);\r\n        }\r\n\r\n        public void LockSystem()\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new LockSystemConsoleMessageQueueItem(), this.ConsoleId);\r\n        }\r\n\r\n        public void BroadcastMessage(string name, string value)\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem { Name = name, Value = value }, this.ConsoleId);\r\n        }\r\n\r\n        public void SaveStatus(bool succeeded)\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new SaveStatusConsoleMessageQueueItem { ViewId = ViewId, Succeeded = succeeded }, this.ConsoleId);\r\n        }\r\n\r\n        public void BindEntityTokenToView(string entityToken)\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new BindEntityTokenToViewQueueItem { ViewId = ViewId, EntityToken = entityToken }, this.ConsoleId);\r\n        }\r\n\r\n        public void SelectElement(string entityToken)\r\n        {\r\n            ConsoleMessageQueueFacade.Enqueue(new SelectElementQueueItem { EntityToken = entityToken }, this.ConsoleId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/MessageBoxMessageQueueItem.cs",
    "content": "using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class MessageBoxMessageQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public string Title { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Message { get; set; }\r\n\r\n        /// <exclude />\r\n        public DialogType DialogType { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/OpenExternalViewQueueItem.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class OpenExternalViewQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public OpenExternalViewQueueItem(EntityToken entityToken)\r\n        {\r\n            this.EntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ToolTip { get; set; }\r\n\r\n        /// <exclude />\r\n        public ResourceHandle IconResourceHandle { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ViewType { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> UrlPostArguments { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/OpenGenericViewQueueItem.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class OpenGenericViewQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public OpenGenericViewQueueItem(EntityToken entityToken)\r\n            : this(entityToken, Guid.NewGuid().ToString())\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public OpenGenericViewQueueItem(EntityToken entityToken, string viewId)\r\n        {\r\n            this.EntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n            this.ViewId = viewId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ToolTip { get; set; }\r\n\r\n        /// <exclude />\r\n        public ResourceHandle IconResourceHandle { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> UrlPostArguments { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/OpenHandledViewMessageQueueItem.cs",
    "content": "﻿using Composite.Core.ResourceSystem;\r\nusing System.Collections.Generic;\r\nusing System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class OpenHandledViewMessageQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public OpenHandledViewMessageQueueItem(string entityToken, string handle)\r\n        {\r\n            this.EntityToken = entityToken;\r\n            this.Handle = handle;\r\n            this.Arguments = new Dictionary<string, string>();\r\n        }\r\n\r\n        /// <exclude />\r\n        public OpenHandledViewMessageQueueItem(string entityToken, string handle, Dictionary<string, string> arguments)\r\n        {\r\n            this.EntityToken = entityToken;\r\n            this.Handle = handle;\r\n            this.Arguments = arguments;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Handle { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> Arguments { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/OpenSlideViewQueueItem.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing Composite.Core.ResourceSystem;\nusing Composite.C1Console.Security;\n\nnamespace Composite.C1Console.Events\n{\n    /// <summary>\n    /// </summary>\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n    [Serializable]\n    public sealed class OpenSlideViewQueueItem : IConsoleMessageQueueItem\n    {\n        /// <exclude />\n        public string ViewId { get; set; }\n\n        /// <exclude />\n        public string EntityToken { get; set; }\n\n        /// <exclude />\n        public string Url { get; set; }\n\n    }\n}\n"
  },
  {
    "path": "Composite/C1Console/Events/OpenViewMessageQueueItem.cs",
    "content": "using Composite.Core.ResourceSystem;\r\nusing System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class OpenViewMessageQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public OpenViewMessageQueueItem()\r\n        {\r\n            this.FlowHandle = \"\";\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n        \r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FlowHandle { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> UrlPostArguments { get; set; }\r\n\r\n        /// <exclude />\r\n        public ViewType ViewType { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ToolTip { get; set; }\r\n\r\n        /// <exclude />\r\n        public ResourceHandle IconResourceHandle { get; set; }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/RebootConsoleMessageQueueItem.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class RebootConsoleMessageQueueItem : IConsoleMessageQueueItem\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/RefreshTreeMessageQueueItem.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class RefreshTreeMessageQueueItemSerializerHandler : ISerializerHandler\r\n    {\r\n        /// <exclude />\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            return EntityTokenSerializer.Serialize(((RefreshTreeMessageQueueItem)objectToSerialize).EntityToken);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            RefreshTreeMessageQueueItem result = new RefreshTreeMessageQueueItem();\r\n\r\n            result.EntityToken = EntityTokenSerializer.Deserialize(serializedObject);\r\n\r\n            return result;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Refreshed children of the elements with the specified entity token\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SerializerHandler(typeof(RefreshTreeMessageQueueItemSerializerHandler))]\r\n    public sealed class RefreshTreeMessageQueueItem : IConsoleMessageQueueItem\r\n    {\r\n        /// <exclude />\r\n        public EntityToken EntityToken { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return this.EntityToken.ToString();\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Events/SaveStatusConsoleMessageQueueItem.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class SaveStatusConsoleMessageQueueItem : IConsoleMessageQueueItem\r\n\t{\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool Succeeded { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/SelectElementQueueItem.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Events\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class SelectElementQueueItem : IConsoleMessageQueueItem\r\n\t{\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string PerspectiveElementKey { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Events/ViewType.cs",
    "content": "namespace Composite.C1Console.Events\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public enum ViewType\r\n    {\r\n        /// <exclude />\r\n        Main = 0,\r\n\r\n        /// <exclude />\r\n        ModalDialog = 1,\r\n\r\n        /// <exclude />\r\n        RightTop = 2,\r\n\r\n        /// <exclude />\r\n        RightBottom = 3,\r\n\r\n        /// <exclude />\r\n        BottomLeft = 4,\r\n\r\n        /// <exclude />\r\n        BottomRight = 5,\r\n\r\n        /// <exclude />\r\n        External = 6\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/BindablePropertyAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>\r\n    /// Defines that a property supports data binding. This attribute should only be assigned to updateable fields.\r\n    /// </summary>\r\n    /// <exclude />    \r\n    [AttributeUsage(AttributeTargets.Property,AllowMultiple=false,Inherited=true)]\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class BindablePropertyAttribute : Attribute\r\n    {\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Forms/ControlValuePropertyAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>\r\n    /// Defines the default property of a UiControl that \"inner values\" will be assigned to.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Class,AllowMultiple=false,Inherited=true)]\r\n    internal sealed class ControlValuePropertyAttribute : Attribute\r\n    {\r\n        public ControlValuePropertyAttribute(string propertyName)\r\n        {\r\n            _propertyName = propertyName;\r\n        }\r\n\r\n        private readonly string _propertyName;\r\n\r\n        public string PropertyName\r\n        {\r\n            get { return _propertyName; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreFunctions/BooleanCheckFunctionFactory.cs",
    "content": "﻿using Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreFunctions\r\n{\r\n    internal sealed class BooleanCheckFunction : IFormFunction\r\n    {\r\n        public BooleanCheckFunction()\r\n        {\r\n        }\r\n\r\n        [FormsProperty()]\r\n        public object WhenTrue { get; set; }\r\n\r\n\r\n        [FormsProperty()]\r\n        public object WhenFalse { get; set; }\r\n\r\n\r\n        [RequiredValue()]\r\n        [FormsProperty()]\r\n        public bool CheckValue { get; set; }\r\n\r\n        public object Execute()\r\n        {\r\n            if (this.CheckValue)\r\n            {\r\n                return this.WhenTrue;\r\n            }\r\n            else\r\n            {\r\n                return this.WhenFalse;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(BooleanCheckFunctionFactoryData))]\r\n    internal sealed class BooleanCheckFunctionFactory : IFormFunctionFactory\r\n    {\r\n        public IFormFunction CreateFunction()\r\n        {\r\n            return new BooleanCheckFunction();\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    internal sealed class BooleanCheckFunctionFactoryData : FunctionFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreFunctions/CompositeFunctionCall.cs",
    "content": "﻿using Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Composite.Functions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreFunctions\r\n{\r\n    [ControlValueProperty(\"Parameters\")]\r\n    internal sealed class CompositeFunctionCall : IFormFunction\r\n    {\r\n        public CompositeFunctionCall()\r\n        {\r\n        }\r\n\r\n        [FormsProperty()]\r\n        [RequiredValue()]\r\n        public string Name { get; set; }\r\n\r\n        public object Execute()\r\n        {\r\n            return FunctionFacade.Execute<object>(FunctionFacade.GetFunction(this.Name));\r\n        }\r\n\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(CompositeFunctionCallFunctionFactoryData))]\r\n    internal sealed class CompositeFunctionCallFunctionFactory : IFormFunctionFactory\r\n    {\r\n        public IFormFunction CreateFunction()\r\n        {\r\n            return new CompositeFunctionCall();\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    internal sealed class CompositeFunctionCallFunctionFactoryData : FunctionFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreFunctions/NamedValueFunctionFactory.cs",
    "content": "﻿using System.Collections;\r\nusing Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreFunctions\r\n{\r\n    [ControlValueProperty(\"Value\")]\r\n    internal sealed class NamedValue : IFormFunction\r\n    {\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public object Value { get; set; }\r\n\r\n        [RequiredValue()]\r\n        [FormsProperty()]\r\n        public string Name { get; set; }\r\n\r\n        public object Execute()\r\n        {\r\n            return new DictionaryEntry(this.Name, this.Value);\r\n        }\r\n\r\n    }\r\n\r\n    \r\n\r\n    [ConfigurationElementType(typeof(NamedValueFunctionFactoryData))]\r\n    internal sealed class NamedValueFunctionFactory : IFormFunctionFactory\r\n    {\r\n        public IFormFunction CreateFunction()\r\n        {\r\n            return new NamedValue();\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    internal sealed class NamedValueFunctionFactoryData : FunctionFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreFunctions/NullCheckFunctionFactory.cs",
    "content": "﻿using Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreFunctions\r\n{\r\n    internal sealed class NullCheck : IFormFunction\r\n    {\r\n        public NullCheck()\r\n        {\r\n        }\r\n\r\n        [FormsProperty()]\r\n        public object WhenNull { get; set; }\r\n\r\n\r\n        [FormsProperty()]\r\n        public object WhenNotNull { get; set; }\r\n\r\n        [RequiredValue()]\r\n        [FormsProperty()]\r\n        public object CheckValue { get; set; }\r\n\r\n        public object Execute()\r\n        {\r\n            if (this.CheckValue == null)\r\n            {\r\n                return this.WhenNull;\r\n            }\r\n            else\r\n            {\r\n                return this.WhenNotNull;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(NullCheckFunctionFactoryData))]\r\n    internal sealed class NullCheckFunctionFactory : IFormFunctionFactory\r\n    {\r\n        public IFormFunction CreateFunction()\r\n        {\r\n            return new NullCheck();\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    internal sealed class NullCheckFunctionFactoryData : FunctionFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreFunctions/ReplicatorFunctionFactory.cs",
    "content": "﻿using Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreFunctions\r\n{\r\n    [ControlValueProperty(\"Value\")]\r\n    internal sealed class Replicator : IFormFunction\r\n    {\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public object Value { get; set; }\r\n\r\n        public object Execute()\r\n        {\r\n            return this.Value;\r\n        }\r\n\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(ReplicatorFunctionFactoryData))]\r\n    internal sealed class ReplicatorFunctionFactory : IFormFunctionFactory\r\n    {\r\n        public IFormFunction CreateFunction()\r\n        {\r\n            return new Replicator();\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    internal sealed class ReplicatorFunctionFactoryData : FunctionFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreFunctions/StaticMethodCallFunctionFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreFunctions\r\n{\r\n    [ControlValueProperty(\"Parameters\")]\r\n    internal sealed class StaticMethodCall : IFormFunction\r\n    {\r\n        public StaticMethodCall()\r\n        {\r\n            this.Parameters = null;\r\n        }\r\n\r\n        [FormsProperty()]\r\n        public Type Type { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string Method { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public Object Parameters { \r\n            get; \r\n            set; }\r\n\r\n        public object Execute()\r\n        {\r\n            MethodInfo methodToCall;\r\n            List<object> preparedParameters = new List<object>();\r\n            object result;\r\n\r\n            try\r\n            {\r\n                methodToCall = this.Type.GetMethod(this.Method, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);\r\n\r\n                if (methodToCall == null) throw new InvalidOperationException(\"No such method found\");\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Failed to locate a static method named '{0}' on the type '{1}'\", this.Method, this.Type.FullName), ex);\r\n            }\r\n\r\n            ParameterInfo[] parameterInfos = methodToCall.GetParameters();\r\n\r\n            if (parameterInfos != null && parameterInfos.Length > 0)\r\n            {\r\n                if (this.Parameters == null)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Missing parameters for static method named '{0}' on the type '{1}'.\", this.Method, this.Type.FullName));\r\n                }\r\n\r\n                if (parameterInfos.Length > 1)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Static method named '{0}' on the type '{1}' take more than one parameter which is not supported.\", this.Method, this.Type.FullName));\r\n                }\r\n\r\n                var parameterInfo = parameterInfos.First();\r\n\r\n                object currentSuppliedParameter = this.Parameters;\r\n\r\n                if (currentSuppliedParameter == null)\r\n                {\r\n                    preparedParameters.Add(null);\r\n                }\r\n                else\r\n                {\r\n                    if (currentSuppliedParameter.GetType() == parameterInfo.ParameterType)\r\n                    {\r\n                        preparedParameters.Add(currentSuppliedParameter);\r\n                    }\r\n                    else\r\n                    {\r\n                        var converted = ValueTypeConverter.Convert(currentSuppliedParameter, parameterInfo.ParameterType);\r\n                        preparedParameters.Add(converted);\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (this.Parameters != null)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Parameters were supplied for static method named '{0}' on the type '{1}'. This method takes no parameters\", this.Method, this.Type.FullName));\r\n                }\r\n            }\r\n\r\n            try\r\n            {\r\n                result = methodToCall.Invoke(null, preparedParameters.ToArray());\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Failed while executing static method '{0}' on the type '{1}'.\", this.Method, this.Type.FullName), ex);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(StaticMethodCallFunctionFactoryData))]\r\n    internal sealed class StaticMethodCallFunctionFactory : IFormFunctionFactory\r\n    {\r\n        public IFormFunction CreateFunction()\r\n        {\r\n            return new StaticMethodCall();\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    internal sealed class StaticMethodCallFunctionFactoryData : FunctionFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/BaseSelectorUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal abstract class BaseSelectorUiControl : UiControl\r\n    {\r\n        protected BaseSelectorUiControl()\r\n        {\r\n            this.OptionsKeyField = \".\";\r\n            this.OptionsLabelField = \".\";\r\n            this.Required = true;\r\n        }\r\n\r\n        [RequiredValue]\r\n        [FormsProperty]\r\n        public IEnumerable Options { get; set; }\r\n\r\n        [FormsProperty]\r\n        public string OptionsKeyField { get; set; }\r\n\r\n        [FormsProperty]\r\n        public string OptionsLabelField { get; set; }\r\n\r\n        [FormsProperty]\r\n        public SelectorBindingType BindingType { get; set; }\r\n\r\n        [FormsProperty]\r\n        public bool Required { get; set; }\r\n\r\n        [FormsProperty]\r\n        public bool ReadOnly { get; set; }\r\n\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public EventHandler SelectedIndexChangedEventHandler { get; set; }\r\n    }\r\n\r\n\r\n    [TypeConverter(typeof(SelectorBindingTypeConverter))]\r\n    internal enum SelectorBindingType\r\n    {\r\n        BindToObject,\r\n        BindToKeyFieldValue\r\n    }\r\n\r\n\r\n    internal class SelectorBindingTypeConverter : TypeConverter\r\n    {\r\n        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)\r\n        {\r\n            return sourceType == typeof(string);\r\n        }\r\n\r\n        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)\r\n        {\r\n            string val = value as string;\r\n\r\n            switch (val.ToLowerInvariant())\r\n            {\r\n                case \"bindtoobject\":\r\n                    return SelectorBindingType.BindToObject;\r\n\r\n                case \"bindtokeyfieldvalue\":\r\n                    return SelectorBindingType.BindToKeyFieldValue;\r\n\r\n                default:\r\n                    throw new FormatException($\"{value} is not a valid Selector BindingType value - use {nameof(SelectorBindingType.BindToObject)} or {nameof(SelectorBindingType.BindToKeyFieldValue)}\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/BoolSelectorUiControl.cs",
    "content": "﻿using System;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"IsTrue\")]\r\n    internal abstract class BoolSelectorUiControl : UiControl\r\n    {\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public bool IsTrue { get; set; }\r\n\r\n\r\n        [FormsProperty]\r\n        public string TrueLabel { get; set; }\r\n\r\n\r\n        [FormsProperty]\r\n        public string FalseLabel { get; set; }\r\n\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public EventHandler SelectionChangedEventHandler { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/ButtonUiControl.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing System;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Label\")]\r\n    internal abstract class ButtonUiControl : UiControl\r\n    {\r\n        private EventHandler _eventHandler;\r\n\r\n        [FormsProperty()]\r\n        public EventHandler ClickEventHandler\r\n        {\r\n            get { return _eventHandler; }\r\n            set { _eventHandler = value; }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/ButtonUiControlFactoryData.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class ButtonUiControlFactoryData : UiControlFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/CheckBoxUiControl.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(nameof(Checked))]\r\n    internal abstract class CheckBoxUiControl : UiControl\r\n    {\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public bool Checked { get; set; }\r\n\r\n        [FormsProperty]\r\n        public string ItemLabel { get; set; }\r\n\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public EventHandler CheckedChangedEventHandler { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/CheckBoxUiControlFactoryData.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\n\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class CheckBoxUiControlFactoryData : UiControlFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/ContainerUiControl.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    /// <summary>\r\n    /// Base class for UiControl containers. \r\n    /// </summary>\r\n    [ControlValueProperty(\"UiControls\")]\r\n    internal abstract class ContainerUiControlBase : UiControl, IContainerUiControl\r\n    {\r\n        public ContainerUiControlBase()\r\n        {\r\n            this.UiControls = new List<IUiControl>();\r\n        }\r\n\r\n        /// <summary>\r\n        /// The list of contained UiControls.\r\n        /// </summary>\r\n        [FormsProperty()]\r\n        public List<IUiControl> UiControls { get; private set; }\r\n\r\n\r\n        public abstract void InitializeLazyBindedControls();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/ContainerUiControlFactoryData.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class ContainerUiControlFactoryData: UiControlFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/DataReferenceSelectorUiControl.cs",
    "content": "﻿using System.ComponentModel;\r\n\r\nusing Composite.Data;\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [DefaultBindingProperty(\"Selected\")]\r\n    internal class DataReferenceSelectorUiControl : UiControl\r\n    {\r\n        private object _selected = null;\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public object Selected \r\n        { \r\n            get\r\n            {\r\n                if (_selected == null)\r\n                    return null;\r\n\r\n                if (_selected is IDataReference)\r\n                    return _selected;\r\n\r\n                if (this.DataType==null)\r\n                    throw new InvalidOperationException(\"'DataType' property have on been initialized. Unable to convert to IDataReference\");\r\n\r\n                return DataReferenceFacade.BuildDataReference(this.DataType, _selected);\r\n            }\r\n            set\r\n            {\r\n                _selected = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [RequiredValue()]\r\n        [FormsProperty()]\r\n        public Type DataType { get; set; }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/DataReferenceTreeSelectorUiControl.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [DefaultBindingProperty(\"Selected\")]\r\n    internal class DataReferenceTreeSelectorUiControl : UiControl\r\n    {\r\n        public DataReferenceTreeSelectorUiControl()\r\n        {\r\n            Selected = null;\r\n        }\r\n\r\n        [BindableProperty(), FormsProperty()]\r\n        public string Selected { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string Handle { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string RootEntityToken { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string SearchToken { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public Type DataType { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public bool NullValueAllowed { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/DateSelectorUiControl.cs",
    "content": "﻿using System;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Date\")]\r\n    internal abstract class DateTimeSelectorUiControl : UiControl\r\n    {\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public DateTime? Date { get; set; }\r\n\r\n        [FormsProperty]\r\n        public bool ReadOnly { get; set; }\r\n\r\n        [FormsProperty]\r\n        public bool Required { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/DebugUiControl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"UiControl\")]\r\n    internal abstract class DebugUiControl : UiControl\r\n    {\r\n        private IUiControl _uiControl;\r\n        private string _tagName;\r\n        private List<BindingInformation> _bindings = new List<BindingInformation>();\r\n        private string _sourceElementXPath;\r\n\r\n\r\n        public IUiControl UiControl\r\n        {\r\n            get { return _uiControl; }\r\n            set { _uiControl = value; }\r\n        }\r\n\r\n        public string TagName\r\n        {\r\n            get { return _tagName; }\r\n            set { _tagName = value; }\r\n        }\r\n\r\n        [FormsProperty()]\r\n        public override string Label\r\n        {\r\n            get\r\n            {\r\n                return _uiControl.Label;\r\n            }\r\n            set\r\n            {\r\n                throw new InvalidOperationException( \"Debug.Label may not be assigned\" );\r\n            }\r\n        }\r\n\r\n        public List<BindingInformation> Bindings\r\n        {\r\n            get { return _bindings; }\r\n        }\r\n\r\n        public string SourceElementXPath\r\n        {\r\n            get { return _sourceElementXPath; }\r\n            set { _sourceElementXPath = value; }\r\n        }\r\n\r\n\r\n        internal class BindingInformation\r\n        {\r\n            private string _bindingObjectName;\r\n            private Type _bindingObjectType;\r\n            private string _bindingPropertyName;\r\n\r\n            public BindingInformation(string bindingObjectName, Type bindingObjectType, string bindingPropertyName)\r\n            {\r\n                _bindingObjectName = bindingObjectName;\r\n                _bindingObjectType = bindingObjectType;\r\n                _bindingPropertyName = bindingPropertyName;\r\n            }\r\n\r\n            public string BindingObjectName\r\n            {\r\n                get { return _bindingObjectName; }\r\n            }\r\n\r\n            public Type BindingObjectType\r\n            {\r\n                get { return _bindingObjectType; }\r\n            }\r\n\r\n            public string BindingPropertyName\r\n            {\r\n                get { return _bindingPropertyName; }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/DebugUiControlFactoryData.cs",
    "content": "using Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class DebugUiControlFactoryData : UiControlFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/DoubleSelectorUiControl.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class SelectorUiControl : BaseSelectorUiControl\r\n    {\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public object Selected { get; set; }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/EnumSelectorUiControl.cs",
    "content": "using System;\r\nusing Composite.C1Console.Forms.Foundation;\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Selected\")]\r\n    internal abstract class EnumSelectorUiControl : UiControl\r\n    {\r\n        private string _selected;\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public string Selected \r\n        { \r\n            get { return _selected; } \r\n            set { _selected = Enum.Parse(EnumType, value).ToString(); } \r\n        }\r\n\r\n        [RequiredValue()]\r\n        [FormsProperty()]\r\n        public Type EnumType { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/FileUploadUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    [ControlValueProperty(\"UploadedFile\")]\r\n    internal abstract class FileUploadUiControl : UiControl\r\n    {\r\n        /// <summary>\r\n        /// </summary>\r\n        [RequiredValue()]\r\n        [BindableProperty]\r\n        [FormsProperty()]\r\n        public UploadedFile UploadedFile { get; set; }\r\n    }\r\n\r\n\r\n    internal sealed class UploadedFileSerializerHandler : ISerializerHandler\r\n    {\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            if (objectToSerialize == null) throw new ArgumentNullException(\"objectToSerialize\");\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n            UploadedFile uploadedFile = (UploadedFile)objectToSerialize;\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"HasFile\", uploadedFile.HasFile);\r\n\r\n            if (uploadedFile.FileName != null)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"FileName\", uploadedFile.FileName);\r\n            }\r\n\r\n            if (uploadedFile.ContentType != null)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"ContentType\", uploadedFile.ContentType);\r\n            }\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"ContentLength\", uploadedFile.ContentLength);\r\n\r\n            if (uploadedFile.FileStream != null)\r\n            {\r\n                long position = uploadedFile.FileStream.Position;\r\n\r\n                uploadedFile.FileStream.Seek(0, SeekOrigin.Begin);\r\n                \r\n                byte[] buffer = new byte[uploadedFile.FileStream.Length];\r\n                uploadedFile.FileStream.Read(buffer, 0, (int)uploadedFile.FileStream.Length);\r\n\r\n                StringConversionServices.SerializeKeyValueArrayPair<byte>(sb, \"FileStream\", buffer);\r\n\r\n                uploadedFile.FileStream.Seek(position, SeekOrigin.Begin);\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedObject);\r\n\r\n            UploadedFile uploadedFile = new UploadedFile();\r\n\r\n            if (dic.ContainsKey(\"HasFile\") == false) throw new InvalidOperationException(\"Not correct serialized format\");\r\n            uploadedFile.HasFile = StringConversionServices.DeserializeValueBool(dic[\"HasFile\"]);\r\n\r\n            if (dic.ContainsKey(\"FileName\"))\r\n            {\r\n                uploadedFile.FileName = StringConversionServices.DeserializeValueString(dic[\"FileName\"]);\r\n            }\r\n\r\n            if (dic.ContainsKey(\"ContentType\"))\r\n            {\r\n                uploadedFile.ContentType = StringConversionServices.DeserializeValueString(dic[\"ContentType\"]);\r\n            }\r\n\r\n            if (dic.ContainsKey(\"ContentLength\") == false) throw new InvalidOperationException(\"Not correct serialized format\");\r\n            uploadedFile.ContentLength = StringConversionServices.DeserializeValueInt(dic[\"ContentLength\"]);\r\n\r\n            if (dic.ContainsKey(\"FileStream\"))\r\n            {\r\n                byte[] bytes = StringConversionServices.DeserializeValueArray<byte>(dic[\"FileStream\"]);\r\n\r\n                uploadedFile.FileStream = new MemoryStream(bytes);\r\n            }\r\n\r\n            return uploadedFile;\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SerializerHandler(typeof(UploadedFileSerializerHandler))]\r\n    public sealed class UploadedFile\r\n    {\r\n        /// <exclude />\r\n        public UploadedFile()\r\n        {\r\n            this.HasFile = false;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool HasFile { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FileName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ContentType { get; set; }\r\n\r\n        /// <exclude />\r\n        public int ContentLength { get; set; }\r\n\r\n        /// <exclude />\r\n        public Stream FileStream { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/FontIconSelectorUiControl.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.ComponentModel;\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Text\")]\r\n    internal abstract class FontIconSelectorUiControl : UiControl\r\n    {\r\n        public FontIconSelectorUiControl()\r\n        {\r\n            this.SelectedClassName = \"\";\r\n            this.Required = false;\r\n        }\r\n\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public string SelectedClassName { get; set; }\r\n\r\n        [FormsProperty]\r\n        [RequiredValue]\r\n        public object ClassNameOptions { get; set; }\r\n\r\n        [FormsProperty]\r\n        [RequiredValue]\r\n        public string StylesheetPath { get; set; }\r\n\r\n        [FormsProperty]\r\n        public string ClassNamePrefix { get; set; }\r\n\r\n        [FormsProperty]\r\n        public bool Required { get; set; }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/FunctionCallDesignerUiControl.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal abstract class FunctionCallsDesignerUiControl : UiControl\r\n    {\r\n        /// <summary>\r\n        /// </summary>\r\n        [RequiredValue]\r\n        [FormsProperty]\r\n        public abstract string SessionStateProvider { get; set; }\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        [RequiredValue]\r\n        [FormsProperty]\r\n        public abstract Guid SessionStateId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/FunctionParameterDesignerUiControl.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal abstract class FunctionParameterDesignerUiControl : UiControl\r\n    {\r\n        /// <summary>\r\n        /// </summary>\r\n        [RequiredValue]\r\n        [FormsProperty]\r\n        public abstract string SessionStateProvider { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        [RequiredValue]\r\n        [FormsProperty]\r\n        public abstract Guid SessionStateId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/HeadingUiControl.cs",
    "content": "\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Title\")]\r\n    internal abstract class HeadingUiControl : UiControl\r\n    {\r\n        [FormsProperty()]\r\n        public string Title { get; set; }\r\n\r\n\r\n        [FormsProperty()]\r\n        public string Description { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/HierarchicalSelectorUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"SelectedKeys\")]\r\n    internal abstract class HierarchicalSelectorUiControl : UiControl\r\n    {\r\n        internal HierarchicalSelectorUiControl()\r\n        {\r\n            this.AutoSelectParents = true;\r\n        }\r\n\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public IEnumerable<object> SelectedKeys { get; set; }\r\n\r\n        [FormsProperty]\r\n        public IEnumerable<SelectionTreeNode> TreeNodes { get; set; }\r\n\r\n        [FormsProperty]\r\n        public bool AutoSelectChildren { get; set; }\r\n\r\n        [FormsProperty]\r\n        public bool AutoSelectParents { get; set; }\r\n\r\n        [FormsProperty]\r\n        public bool Required { get; set; }\r\n    }\r\n\r\n    /// <exclude />\r\n    [Serializable]\r\n    public sealed class SelectionTreeNode\r\n    {\r\n        /// <exclude />\r\n        public object Key { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// Determines whether a tree element should feature a checkbox.\r\n        /// </summary>\r\n        public bool Selectable { get; set; }\r\n\r\n        /// <summary>\r\n        /// Determines whether the tree element's checkbox is readonly.\r\n        /// </summary>\r\n        public bool Readonly { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Icon { get; set; }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<SelectionTreeNode> Children { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/HierarchicalSelectorUiControlFactoryData.cs",
    "content": "﻿using Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class HierarchicalSelectorUiControlFactoryData : UiControlFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/HtmlBlobUiControl.cs",
    "content": "using Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Html\")]\r\n    internal abstract class HtmlBlobUiControl : UiControl\r\n    {\r\n        private string _html = \"\";\r\n\r\n        [FormsProperty()]\r\n        public string Html\r\n        {\r\n            get { return _html; }\r\n            set { _html = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/IContainerUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal interface IContainerUiControl : IUiControl\r\n    {\r\n        [FormsProperty()]\r\n        List<IUiControl> UiControls { get; }\r\n\r\n        void InitializeLazyBindedControls();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/ITabbedContainerUiControl.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    /// <summary>\r\n    /// Base class for UiControl tabbed containers. \r\n    /// </summary>\r\n    internal interface ITabbedContainerUiControl : IContainerUiControl\r\n    {\r\n        /// <summary>\r\n        /// Zero-based index of pre selected tab.\r\n        /// </summary>\r\n        [FormsProperty()]\r\n        int PreSelectedIndex { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/InfoTableUiControl.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.ComponentModel;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Rows\")]\r\n    internal abstract class InfoTableUiControl : UiControl\r\n    {\r\n        [FormsProperty()]\r\n        public List<string> Headers { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public List<List<string>> Rows  { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string Caption { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public bool Border { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/MultiContentXhtmlEditorUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal abstract class MultiContentXhtmlEditorUiControl : UiControl\r\n    {\r\n        [FormsProperty()]\r\n        public Dictionary<string, string> PlaceholderDefinitions { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public Dictionary<string, string> PlaceholderContainerClasses { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string DefaultPlaceholderId { get; set; }\r\n\r\n        [FormsProperty()]\r\n        [BindableProperty()]\r\n        public Dictionary<string, string> NamedXhtmlFragments { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string ClassConfigurationName { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public IEnumerable<Type> EmbedableFieldsTypes { get; set; }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/MultiSelectorUiControl.cs",
    "content": "﻿using System.Collections;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class MultiSelectorUiControl : BaseSelectorUiControl\r\n    {\r\n        public MultiSelectorUiControl() : base()\r\n        {\r\n            this.Required = false;\r\n        }\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public IEnumerable Selected { get; set; }\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public string SelectedAsString { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public bool CompactMode { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/PageReferenceSelectorUiControl.cs",
    "content": "﻿using System.ComponentModel;\r\n\r\nusing Composite.Data;\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing System;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [DefaultBindingProperty(\"Selected\")]\r\n    internal class PageReferenceSelectorUiControl : UiControl\r\n    {\r\n        private DataReference<IPage> _selected = null;\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public DataReference<IPage> Selected \r\n        { \r\n            get\r\n            {\r\n                return _selected;\r\n            }\r\n            set\r\n            {\r\n                _selected = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/QueryCallDefinitionsEditorUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class QueryCallDefinitionsEditorUiControl : UiControl\r\n    {\r\n        /// <summary>\r\n        /// List of \"Local name\" and \"Query Id\" elements\r\n        /// </summary>\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public IEnumerable<KeyValuePair<string, Guid>> Queries { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Lookup where \"Local name\" is key and value is a key value pair\r\n        /// </summary>\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public ILookup<string, KeyValuePair<string, string>> Parameters { get; set; }\r\n\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public string UserProvidedPreviewXml { get; set; }\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/SaveButtonUiControl.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing System;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Label\")]\r\n    internal abstract class SaveButtonUiControl : UiControl\r\n    {\r\n        private EventHandler _saveEventHandler;\r\n        private EventHandler _saveAndPublishEventHandler;\r\n\r\n        [FormsProperty()]\r\n        public EventHandler SaveEventHandler\r\n        {\r\n            get { return _saveEventHandler; }\r\n            set { _saveEventHandler = value; }\r\n        }\r\n\r\n\r\n        [FormsProperty()]\r\n        public EventHandler SaveAndPublishEventHandler\r\n        {\r\n            get { return _saveAndPublishEventHandler; }\r\n            set { _saveAndPublishEventHandler = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/SelectorUiControl.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class DoubleSelectorUiControl : BaseSelectorUiControl\r\n    {\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public object FirstKey { get; set; }\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public object SecondKey { get; set; }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/SelectorUiControlFactoryData.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\n\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class SelectorUiControlFactoryData : UiControlFactoryData\r\n    {\r\n        private const string _bindingTypePropertyName = \"BindingType\";\r\n        [ConfigurationProperty(_bindingTypePropertyName, DefaultValue=SelectorBindingType.BindToObject, IsRequired=true)]\r\n        [FormsProperty()]\r\n        public SelectorBindingType BindingType\r\n        {\r\n            get { return (SelectorBindingType)base[_bindingTypePropertyName]; }\r\n            set { base[_bindingTypePropertyName] = value; }\r\n        }\r\n\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/SvgIconSelectorUiControl.cs",
    "content": "﻿using Composite.C1Console.Forms.Foundation;\n\nnamespace Composite.C1Console.Forms.CoreUiControls\n{\n    [ControlValueProperty(\"Text\")]\n    internal abstract class SvgIconSelectorUiControl : UiControl\n    {\n        public SvgIconSelectorUiControl()\n        {\n            this.Selected = \"\";\n            this.Required = false;\n        }\n\n        [BindableProperty]\n        [FormsProperty]\n        public string Selected { get; set; }\n\n        [FormsProperty]\n        public string SvgSpritePath { get; set; }\n\n        [FormsProperty]\n        public bool Required { get; set; }\n    }\n\n}\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/TextEditorUiControl.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.ComponentModel;\r\n\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Text\")]\r\n    internal abstract class TextEditorUiControl : UiControl\r\n    {\r\n        public TextEditorUiControl()\r\n        {\r\n            this.Text = \"\";\r\n            this.MimeType = \"text/plain\";\r\n        }\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public string Text { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string MimeType { get; set; }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/TextInputUiControl.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.ComponentModel;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum TextBoxType\r\n    {\r\n        /// <exclude />\r\n        String = 0,\r\n\r\n        /// <exclude />\r\n        Integer = 1,\r\n\r\n        /// <exclude />\r\n        Decimal = 2,\r\n\r\n        /// <exclude />\r\n        Password = 3,\r\n\r\n        /// <exclude />\r\n        ProgrammingIdentifier = 4,\r\n        \r\n        /// <exclude />\r\n        ProgrammingNamespace = 5,\r\n\r\n        /// <exclude />\r\n        ReadOnly = 6,\r\n\r\n        /// <exclude />\r\n        Guid = 7\r\n    }\r\n\r\n\r\n\r\n    [ControlValueProperty(\"Text\")]\r\n    internal abstract class TextInputUiControl : UiControl\r\n    {\r\n        public TextInputUiControl()\r\n        {\r\n            this.Text = \"\";\r\n            this.Type = TextBoxType.String;\r\n            this.Required = false;\r\n            this.SpellCheck = true;\r\n        }\r\n\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public string Text { get; set; }\r\n\r\n\r\n        [FormsProperty]\r\n        public TextBoxType Type { get; set; }\r\n\r\n\r\n        [FormsProperty]\r\n        public bool Required { get; set; }\r\n\r\n\r\n        [FormsProperty]\r\n        public bool SpellCheck { get; set; }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/TextUiControl.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.ComponentModel;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Text\")]\r\n    internal abstract class TextUiControl : UiControl\r\n    {\r\n        private string _text = \"\";\r\n\r\n        [FormsProperty()]\r\n        public string Text\r\n        {\r\n            get { return _text; }\r\n            set { _text = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/ToolbarButtonUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal abstract class ToolbarButtonUiControl : ButtonUiControl\r\n\t{\r\n        public ToolbarButtonUiControl()\r\n        {\r\n            this.IsDisabled = false;\r\n            this.SaveBehaviour = false;\r\n        }\r\n\r\n\r\n        [FormsProperty()]\r\n        public string IconHandle { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string DisabledIconHandle { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public bool IsDisabled { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string LaunchUrl { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public bool SaveBehaviour { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/ToolbarButtonUiControlFactoryData.cs",
    "content": "﻿using Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class ToolbarButtonUiControlFactoryData : UiControlFactoryData\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/TreeSelectorUiControl.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing Composite.C1Console.Forms.Foundation;\n\nnamespace Composite.C1Console.Forms.CoreUiControls\n{\n    [ControlValueProperty(\"SelectedKeys\")]\n    internal abstract class TreeSelectorUiControl : UiControl\n    {\n        [BindableProperty]\n        [FormsProperty]\n        public string SelectedKey { get; set; }\n\n        [FormsProperty]\n        public string ElementProvider { get; set; }\n\n        [FormsProperty]\n        public string SelectableElementPropertyName { get; set; }\n\n        [FormsProperty]\n        public string SelectableElementPropertyValue { get; set; }\n\n        [FormsProperty]\n        public string SelectableElementReturnValue { get; set; }\n\n        [FormsProperty]\n        public string SerializedSearchToken { get; set; }\n\n        [FormsProperty]\n        public bool Required { get; set; }\n    }\n}\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/TypeFieldDesignerUiControl.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    /// <summary>\r\n    /// Provides editing functionality for DataFieldDescriptor elements\r\n    /// </summary>\r\n    internal abstract class TypeFieldDesignerUiControl : UiControl\r\n    {\r\n        /// <summary>\r\n        /// </summary>\r\n        [RequiredValue]\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public IEnumerable<DataFieldDescriptor> Fields { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        [RequiredValue]\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public string LabelFieldName { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// When <value>true</value>, the type selector for a key field will be disabled.\r\n        /// </summary>\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public bool KeyFieldReadOnly { get; set; }\r\n\r\n\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public string KeyFieldName { get; set; }\r\n\r\n\r\n        [FormsProperty]\r\n        public bool IsSearchable { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/TypeSelectorUiControl.cs",
    "content": "﻿using Composite.C1Console.Forms.Foundation;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Types;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [Flags]\r\n    [TypeConverter(typeof(UiControlTypeSelectorModeConverter))]\r\n    internal enum UiControlTypeSelectorMode \r\n    {\r\n        // Composite selector types\r\n        /// <summary>\r\n        /// Include interfaces in the result.\r\n        /// </summary>\r\n        InterfaceTypes = 0x01,\r\n        /// <summary>\r\n        /// Include concrete types in the result.\r\n        /// </summary>\r\n        ConcreteTypes = 0x02,\r\n        /// <summary>\r\n        /// Include primitives in the result.\r\n        /// </summary>\r\n        PrimitiveTypes = 0x04,\r\n    }\r\n\r\n    internal class UiControlTypeSelectorModeConverter : TypeConverter\r\n    {\r\n        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)\r\n        {\r\n            return sourceType == typeof(string);\r\n        }\r\n\r\n        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)\r\n        {\r\n            string val = value as string;\r\n\r\n            val = val.ToLowerInvariant();\r\n            string[] options = val.Split('|');\r\n            UiControlTypeSelectorMode mode = new UiControlTypeSelectorMode();\r\n            foreach (string opt in options)\r\n            {\r\n                string option = opt.Trim();\r\n                if (option == TypeIncludes.ConcreteTypes.ToString().ToLowerInvariant())\r\n                {\r\n                    mode = mode | UiControlTypeSelectorMode.ConcreteTypes;\r\n                }\r\n                else if (option == TypeIncludes.InterfaceTypes.ToString().ToLowerInvariant())\r\n                {\r\n                     mode = mode | UiControlTypeSelectorMode.InterfaceTypes;\r\n                }\r\n                else if (option == TypeIncludes.PrimitiveTypes.ToString().ToLowerInvariant())\r\n                {\r\n                     mode = mode | UiControlTypeSelectorMode.PrimitiveTypes;\r\n                }\r\n                else\r\n                {\r\n                    throw new FormatException(String.Format(\"{0} is not a valid TextSelector Mode value - use ConcreteTypes, InterfaceTypes, PrimitiveTypes\", value));\r\n                }\r\n            }\r\n            return mode;\r\n        }\r\n    }\r\n\r\n    [ControlValueProperty(\"SelectedType\")]\r\n    internal abstract class TypeSelectorUiControl : UiControl\r\n    {\r\n\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public Type SelectedType { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public IEnumerable<Type> TypeOptions { get; set; }\r\n        [FormsProperty()]\r\n        public Type AssignableTo { get; set; }\r\n        [FormsProperty()]\r\n        public UiControlTypeSelectorMode Mode { get; set; }\r\n\r\n        private static bool IsSet(UiControlTypeSelectorMode flags, UiControlTypeSelectorMode compareFlag)\r\n        {\r\n            return ((flags & compareFlag) == compareFlag);\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Type> EnumerateWithCompositeSelector()\r\n        {\r\n            TypeIncludes includes = new TypeIncludes();\r\n            if (IsSet(Mode, UiControlTypeSelectorMode.ConcreteTypes))\r\n            {\r\n                includes = TypeIncludes.ConcreteTypes;\r\n            }\r\n            if (IsSet(Mode, UiControlTypeSelectorMode.InterfaceTypes))\r\n            {\r\n                includes = includes | TypeIncludes.InterfaceTypes;\r\n            }\r\n            if (IsSet(Mode, UiControlTypeSelectorMode.PrimitiveTypes))\r\n            {\r\n                includes = includes | TypeIncludes.PrimitiveTypes;\r\n            }\r\n            return TypeLocator.FindTypes(includes, this.AssignableTo);\r\n        }\r\n\r\n\r\n\r\n        protected IEnumerable<Type> GetTypeOptions()\r\n        {\r\n            if (this.AssignableTo != null && this.TypeOptions != null) \r\n                throw new InvalidOperationException(\"Both TypeOptions and AssignableTo has been set. Only one may be set.\");\r\n\r\n            if (this.TypeOptions != null) \r\n                return this.TypeOptions;\r\n\r\n            if (this.AssignableTo == null)\r\n            {\r\n                throw new ArgumentNullException(\"AssignableTo\");\r\n            }\r\n\r\n            return EnumerateWithCompositeSelector();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/TypeSelectorUiControlFactoryData.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\n\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class TypeSelectorUiControlFactoryData : UiControlFactoryData\r\n    {\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/XhtmlEditorUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    [ControlValueProperty(\"Xhtml\")]\r\n    internal abstract class XhtmlEditorUiControl : UiControl\r\n    {\r\n        private string _xhtml = \"\";\r\n\r\n        [BindableProperty]\r\n        [FormsProperty]\r\n        public string Xhtml\r\n        {\r\n            get { return _xhtml; }\r\n            set { _xhtml = value; }\r\n        }\r\n\r\n        [FormsProperty]\r\n        public string ClassConfigurationName { get; set; }\r\n\r\n        [FormsProperty]\r\n        public string ContainerClasses { get; set; }\r\n\r\n        [FormsProperty]\r\n        public IEnumerable<Type> EmbedableFieldsTypes { get; set; }\r\n\r\n\r\n        [FormsProperty]\r\n        public Guid PreviewPageId { get; set; }\r\n\r\n        [FormsProperty]\r\n        public Guid PreviewTemplateId { get; set; }\r\n\r\n        [FormsProperty]\r\n        public string PreviewPlaceholder { get; set; }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/XhtmlEditorUiControlFactoryData.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class XhtmlEditorUiControlFactoryData : UiControlFactoryData\r\n    {\r\n        private const string _classConfigurationNamePropertyName = \"ClassConfigurationName\";\r\n        private const string _containerClassesPropertyName = \"ContainerClasses\";\r\n\r\n        [ConfigurationProperty(_classConfigurationNamePropertyName,IsRequired=false,DefaultValue=\"common\")]\r\n        public string ClassConfigurationName\r\n        {\r\n            get { return (string)base[_classConfigurationNamePropertyName]; }\r\n            set { base[_classConfigurationNamePropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_containerClassesPropertyName, IsRequired = false, DefaultValue = \"\")]\r\n        public string ContainerClasses\r\n        {\r\n            get { return (string)base[_containerClassesPropertyName]; }\r\n            set { base[_containerClassesPropertyName] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/CoreUiControls/XmlFunctionsDefinitionsEditorUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.CoreUiControls\r\n{\r\n    internal class XmlFunctionsDefinitionsEditorUiControl : UiControl\r\n    {\r\n        /// <summary>\r\n        /// List of \"CompositeFuntionName\" and \"Result Name\" pairs\r\n        /// </summary>\r\n        [RequiredValue()]\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public IEnumerable<KeyValuePair<string, string>> XmlFunctions { get; set; }\r\n\r\n        /// <summary>\r\n        /// Lookup where \"Local name\" is key and value is a key value pair\r\n        /// </summary>\r\n        [RequiredValue()]\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public ILookup<string, KeyValuePair<string, string>> Parameters { get; set; }\r\n\r\n        [BindableProperty()]\r\n        [FormsProperty()]\r\n        public string UserProvidedPreviewXml { get; set; }\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/DataServices/FormDefinitionFileMarkupProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.DataServices\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class FormDefinitionFileMarkupProvider : IFormMarkupProvider, ITestAutomationLocatorInformation\r\n    {\r\n        private readonly string _formPath;\r\n\r\n\r\n        /// <exclude />\r\n        public FormDefinitionFileMarkupProvider(string formPath)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(formPath, \"formPath\");\r\n\r\n            _formPath = formPath;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string TestAutomationLocator\r\n        {\r\n            get\r\n            {\r\n                return Path.GetFileNameWithoutExtension(_formPath);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public XmlReader GetReader()\r\n        {\r\n            string folderPath = Path.GetDirectoryName(_formPath).ToLowerInvariant();\r\n            string fileName = Path.GetFileName(_formPath).ToLowerInvariant();\r\n\r\n            List<IFormDefinitionFile> formFiles =\r\n                (from file in DataFacade.GetData<IFormDefinitionFile>()\r\n                 where file.FolderPath.ToLowerInvariant() == folderPath && file.FileName.ToLowerInvariant() == fileName\r\n                 select file).ToList();\r\n\r\n            if (formFiles.Count == 0) throw new InvalidOperationException(string.Format(\"No form definition with path '{0}' was found. Please use a virtual Form Path\", _formPath));\r\n            if (formFiles.Count > 1) throw new InvalidOperationException(string.Format(\"Multiple form definitions with path '{0}' was found\", _formPath));\r\n\r\n            return new XmlTextReader(formFiles[0].GetReadStream());\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Forms/DataServices/Foundation/FormBuilder.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.DataServices.Foundation\r\n{\r\n    internal static class FormBuilder\r\n    {\r\n        internal static FormTreeCompiler Build(string formPath, IFormChannelIdentifier channel, Dictionary<string, object> bindings, bool debugMode)\r\n        {\r\n            string folderPath = Path.GetDirectoryName(formPath).ToLowerInvariant();\r\n            string fileName = Path.GetFileName(formPath).ToLowerInvariant();\r\n\r\n            List<IFormDefinitionFile> formFiles =\r\n                (from file in DataFacade.GetData<IFormDefinitionFile>()\r\n                 where file.FolderPath.ToLowerInvariant() == folderPath && file.FileName.ToLowerInvariant() == fileName\r\n                 select file).ToList();\r\n\r\n            if (formFiles.Count == 0) throw new ArgumentException(string.Format(\"No form definition with path '{0}' was found. Please use a virtual Form Path\", formPath), \"formPath\");\r\n            if (formFiles.Count > 1) throw new ArgumentException(string.Format(\"Multiple  form definitions with path '{0}' was found\", formPath), \"formPath\");\r\n\r\n            FormTreeCompiler compiler = new FormTreeCompiler();\r\n\r\n            using (XmlTextReader formMarkupReader = new XmlTextReader(formFiles[0].GetReadStream()))\r\n            {\r\n                compiler.Compile(formMarkupReader, channel, bindings, debugMode);\r\n                return compiler;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/DataServices/Functions/GetDataFunctionFactory.cs",
    "content": "using System;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.DataServices.Functions\r\n{\r\n    internal sealed class GetData : IFormFunction \r\n    {\r\n        private Type _type;\r\n\r\n        [FormsProperty()]\r\n        public string TypeName\r\n        {\r\n            get { return _type.FullName; }\r\n            set { _type = Composite.Core.Types.TypeManager.GetType( value ); }\r\n        }\r\n\r\n        public object Execute()\r\n        {\r\n            return DataFacade.GetData(_type);\r\n        }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(GetDataFunctionFactoryData))]\r\n    internal sealed class GetDataFunctionFactory : IFormFunctionFactory \r\n    {\r\n        public IFormFunction CreateFunction()\r\n        {\r\n            return new GetData();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    internal sealed class GetDataFunctionFactoryData : FunctionFactoryData\r\n    {        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/DataServices/Functions/ListDataInterfacesFunctionFactory.cs",
    "content": "﻿using Composite.Data;\r\nusing Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.DataServices.Functions\r\n{\r\n    internal sealed class ListDataInterfacesFunction : IFormFunction\r\n    {\r\n        public object Execute()\r\n        {\r\n            return DataFacade.GetAllInterfaces();\r\n        }\r\n\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(ListDataInterfacesFunctionFactoryData))]\r\n    internal sealed class ListDataInterfacesFunctionFactory : IFormFunctionFactory\r\n    {\r\n        public IFormFunction CreateFunction()\r\n        {\r\n            return new ListDataInterfacesFunction();\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    internal sealed class ListDataInterfacesFunctionFactoryData : FunctionFactoryData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/DataServices/IFormDefinitionFile.cs",
    "content": "﻿using Composite.Data.Types;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.DataServices\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    public interface IFormDefinitionFile : IFile\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/DataServices/UiControls/EmbeddedForm.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\nnamespace Composite.C1Console.Forms.DataServices.UiControls\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ControlValueProperty(\"Bindings\")]\r\n    public class EmbeddedFormUiControl : UiControl\r\n    {\r\n        private FormTreeCompiler _compiler;\r\n\r\n        /// <exclude />\r\n        [RequiredValue()]\r\n        public string FormPath { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Debug { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> Bindings { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Label\r\n        {\r\n            get\r\n            {\r\n                if (base.Label != null)\r\n                {\r\n                    return base.Label;\r\n                }\r\n\r\n                return this.CompiledUiControl.Label;\r\n            }\r\n            set\r\n            {\r\n                base.Label = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public EmbeddedFormUiControl()\r\n        {\r\n            base.Label = null;\r\n            this.Bindings = new Dictionary<string, object>();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _compiler.SaveAndValidateControlProperties();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected internal IUiControl CompiledUiControl\r\n        {\r\n            get\r\n            {\r\n                if (_compiler == null)\r\n                {\r\n                    _compiler = Foundation.FormBuilder.Build(this.FormPath, this.UiControlChannel, this.Bindings, this.Debug);\r\n                }\r\n\r\n                return _compiler.UiControl;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/BindingValidationService.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    internal class BindingValidationService: IBindingValidationService\r\n    {\r\n        public BindingValidationService(Dictionary<string, Exception> validationErrors)\r\n        {\r\n            BindingErrors = validationErrors;\r\n        }\r\n\r\n        public Dictionary<string, Exception> BindingErrors\r\n        {   \r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/FormFlowEventHandlerDelegate.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public delegate void FormFlowEventHandler(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer);\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/FormFlowRenderingService.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.WebClient;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    internal class FormFlowRenderingService : IFormFlowRenderingService\r\n    {\r\n        private Dictionary<string, string> _bindingPathedMessages;\r\n\r\n        public void RerenderView()\r\n        {\r\n            this.RerenderViewRequested = true;\r\n        }\r\n\r\n        public bool RerenderViewRequested { get; private set; }\r\n\r\n\r\n        public bool HasFieldMessages\r\n        {\r\n            get { return _bindingPathedMessages != null && _bindingPathedMessages.Count > 0; }\r\n        }\r\n\r\n\r\n        public void ShowFieldMessages(Dictionary<string, string> bindingPathedMessages)\r\n        {\r\n            if (_bindingPathedMessages == null)\r\n            {\r\n                _bindingPathedMessages = new Dictionary<string, string>();\r\n            }\r\n\r\n            foreach (var msgElement in bindingPathedMessages)\r\n            {\r\n                _bindingPathedMessages.Add(msgElement.Key, msgElement.Value);\r\n            }\r\n        }\r\n\r\n\r\n        public Dictionary<string, string> BindingPathedMessages => _bindingPathedMessages;\r\n\r\n\r\n        public void ShowFieldMessage(string fieldBindingPath, string message)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(fieldBindingPath, \"fieldBindingPath\");\r\n            Verify.ArgumentNotNullOrEmpty(message, \"message\");\r\n\r\n            if (_bindingPathedMessages == null)\r\n            {\r\n                _bindingPathedMessages = new Dictionary<string, string>();\r\n            }\r\n\r\n            if (_bindingPathedMessages.ContainsKey(fieldBindingPath))\r\n            {\r\n                _bindingPathedMessages[fieldBindingPath] += \"\\n\" + message;\r\n            }\r\n            else\r\n            {\r\n                _bindingPathedMessages.Add(fieldBindingPath, message);\r\n            }\r\n        }\r\n\r\n\r\n        public void SetSaveStatus(bool succeeded)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n\r\n            (httpContext.Handler as FlowPage).SaveStepSucceeded = succeeded;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/FormFlowUiDefinition.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Xml;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    internal delegate Dictionary<string, object> DelegatedBindingsProvider();\r\n\r\n    internal delegate XmlReader DelegatedMarkupProvider();\r\n\r\n\r\n    internal class FormFlowUiDefinition : VisualFlowUiDefinitionBase\r\n    {\r\n        private Dictionary<IFormEventIdentifier, FormFlowEventHandler> _eventHandlers = new Dictionary<IFormEventIdentifier, FormFlowEventHandler>();\r\n\r\n\r\n        public FormFlowUiDefinition(IFormMarkupProvider markupProvider, IFlowUiContainerType containerType, string containerLabel, IBindingsProvider bindingsProvider, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            this.MarkupProvider = markupProvider;\r\n            this.UiContainerType = containerType;\r\n            this.ContainerLabel = containerLabel;\r\n            this.BindingsProvider = bindingsProvider;\r\n            this.BindingsValidationRules = bindingsValidationRules;\r\n        }\r\n\r\n\r\n        public FormFlowUiDefinition(IFormMarkupProvider markupProvider, IFlowUiContainerType containerType, string containerLabel, Dictionary<string, object> bindings)\r\n            : this(markupProvider, containerType, containerLabel, new PreLoadedBindingsProvider(bindings), null)\r\n        { }\r\n\r\n\r\n        public FormFlowUiDefinition(IFormMarkupProvider markupProvider, IFlowUiContainerType containerType, string containerLabel, Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n            : this(markupProvider, containerType, containerLabel, new PreLoadedBindingsProvider(bindings), bindingsValidationRules)\r\n        { }        \r\n\r\n        public FormFlowUiDefinition(XmlReader markupReader, IFlowUiContainerType containerType, string containerLabel, Dictionary<string, object> bindings)\r\n            : this(new PreLoadedMarkupProvider(markupReader), containerType, containerLabel, new PreLoadedBindingsProvider(bindings), null)\r\n        { }\r\n\r\n        public FormFlowUiDefinition(XmlReader markupReader, IFlowUiContainerType containerType, string containerLabel, Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n            : this(new PreLoadedMarkupProvider(markupReader), containerType, containerLabel, new PreLoadedBindingsProvider(bindings), bindingsValidationRules)\r\n        { }\r\n\r\n        public FormFlowUiDefinition(IFormMarkupProvider markupProvider, IFlowUiContainerType containerType, string containerLabel, DelegatedBindingsProvider delegatedBindingsProvider)\r\n            : this(markupProvider, containerType, containerLabel, new DelegateBasedBindingsProvider(delegatedBindingsProvider), null)\r\n        { }\r\n\r\n\r\n        public FormFlowUiDefinition(DelegatedMarkupProvider delegatedMarkupProvider, IFlowUiContainerType containerType, string containerLabel, DelegatedBindingsProvider delegatedBindingsProvider)\r\n            : this(new DelegateBasedMarkupProvider(delegatedMarkupProvider), containerType, containerLabel, new DelegateBasedBindingsProvider(delegatedBindingsProvider), null)\r\n        { }\r\n\r\n\r\n        public IFormMarkupProvider MarkupProvider { get; private set; }\r\n\r\n        public IFormMarkupProvider CustomToolbarItemsMarkupProvider { get; private set; }\r\n\r\n        public void SetCustomToolbarMarkupProvider(XmlReader markupReader)\r\n        {\r\n            this.CustomToolbarItemsMarkupProvider = new PreLoadedMarkupProvider(markupReader);\r\n        }\r\n\r\n        public void SetCustomToolbarMarkupProvider(IFormMarkupProvider markupProvider)\r\n        {\r\n            this.CustomToolbarItemsMarkupProvider = markupProvider;\r\n        }\r\n\r\n        public override IFlowUiContainerType UiContainerType { get; protected set; }\r\n\r\n        public IBindingsProvider BindingsProvider { get; private set; }\r\n\r\n        public Dictionary<IFormEventIdentifier, FormFlowEventHandler> EventHandlers\r\n        {\r\n            get { return _eventHandlers; }\r\n        }\r\n\r\n        public Dictionary<string, List<ClientValidationRule>> BindingsValidationRules\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        private class PreLoadedMarkupProvider : IFormMarkupProvider\r\n        {\r\n            private XmlReader _xmlReader;\r\n\r\n            public PreLoadedMarkupProvider(XmlReader xmlReader)\r\n            {\r\n                _xmlReader = xmlReader;\r\n            }\r\n\r\n            public XmlReader GetReader()\r\n            {\r\n                return _xmlReader;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private class PreLoadedBindingsProvider : IBindingsProvider\r\n        {\r\n            private Dictionary<string, object> _bindings;\r\n\r\n            public PreLoadedBindingsProvider(Dictionary<string, object> bindings)\r\n            {\r\n                _bindings = bindings;\r\n            }\r\n\r\n            public Dictionary<string, object> GetBindings()\r\n            {\r\n                return _bindings;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private class DelegateBasedBindingsProvider : IBindingsProvider\r\n        {\r\n            private DelegatedBindingsProvider _delegatedBindingsProvider;\r\n\r\n            internal DelegateBasedBindingsProvider(DelegatedBindingsProvider delegatedBindingsProvider)\r\n            {\r\n                _delegatedBindingsProvider = delegatedBindingsProvider;\r\n            }\r\n\r\n            public Dictionary<string, object> GetBindings()\r\n            {\r\n                return _delegatedBindingsProvider.Invoke();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private class DelegateBasedMarkupProvider : IFormMarkupProvider\r\n        {\r\n            private DelegatedMarkupProvider _delegatedMarkupProvider;\r\n\r\n            internal DelegateBasedMarkupProvider(DelegatedMarkupProvider delegatedMarkupProvider)\r\n            {\r\n                _delegatedMarkupProvider = delegatedMarkupProvider;\r\n            }\r\n\r\n            public XmlReader GetReader()\r\n            {\r\n                return _delegatedMarkupProvider.Invoke();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/Foundation/PluginFacades/UiContainerFactoryFactoryPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory;\r\nusing Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows.Foundation.PluginFacades\r\n{\r\n    internal static class UiContainerFactoryFactoryPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static UiContainerFactoryFactoryPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IUiContainer CreateContainer(IFormChannelIdentifier channel, IFlowUiContainerType flowUiContainerType)\r\n        {\r\n            string compositeName = string.Format(\"{0}->{1}\", channel.ChannelName, flowUiContainerType.ContainerName);\r\n\r\n            IUiContainerFactory containerFactory;\r\n\r\n            if (_resourceLocker.Resources.ContainerfactoryCache.TryGetValue(compositeName, out containerFactory) == false)\r\n            {\r\n                try\r\n                {\r\n                    containerFactory = _resourceLocker.Resources.Factory.Create(compositeName);\r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (_resourceLocker.Resources.ContainerfactoryCache.ContainsKey(compositeName) == false)\r\n                            _resourceLocker.Resources.ContainerfactoryCache.Add(compositeName, containerFactory);\r\n                    }\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n\r\n            return containerFactory.CreateContainer();\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", UiContainerFactorySettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public UiContainerFactoryFactory Factory { get; set; }\r\n            public Dictionary<string, IUiContainerFactory> ContainerfactoryCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new UiContainerFactoryFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n\r\n                resources.ContainerfactoryCache = new Dictionary<string, IUiContainerFactory>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/IBindingValidationService.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    internal interface IBindingValidationService : IFlowControllerService\r\n    {\r\n        Dictionary<string, Exception> BindingErrors { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/IBindingsProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    internal interface IBindingsProvider\r\n    {\r\n        Dictionary<string, object> GetBindings();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/IFormEventIdentifier.cs",
    "content": "﻿\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        string BindingName { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/IFormFlowRenderingService.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFormFlowRenderingService : IFlowControllerService\r\n    {\r\n        /// <exclude />\r\n        void RerenderView();\r\n\r\n        /// <exclude />\r\n        bool RerenderViewRequested { get; }\r\n\r\n        /// <exclude />\r\n        bool HasFieldMessages { get; }\r\n\r\n        /// <exclude />\r\n        void ShowFieldMessage(string fieldBindingPath, string message);\r\n\r\n        /// <exclude />\r\n        void SetSaveStatus(bool succeeded);\r\n\r\n        /// <exclude />\r\n        Dictionary<string, string> BindingPathedMessages { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/IFormMarkupProvider.cs",
    "content": "﻿using System.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFormMarkupProvider\r\n    {\r\n        /// <exclude />\r\n        XmlReader GetReader();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/IUiContainer.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    internal interface IUiContainer\r\n    {\r\n        IUiControl Render(\r\n            IUiControl innerForm,\r\n            IUiControl customToolbarItems,\r\n            IFormChannelIdentifier channel, \r\n            IDictionary<string, object> eventHandlerBindings, \r\n            string containerLabel,\r\n            string containerLabelField,\r\n            string containerTooltip,\r\n            ResourceHandle containerIcon);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/Plugins/UiContainerFactory/IUiContainerFactory.cs",
    "content": "using Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory.Runtime;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory\r\n{\r\n    [CustomFactory(typeof(UiContainerFactoryCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(UiContainerFactoryDefaultNameRetriever))]\r\n    internal interface IUiContainerFactory\r\n    {\r\n        IUiContainer CreateContainer();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/Plugins/UiContainerFactory/NonConfigurableUiContainerFactory.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory\r\n{\r\n    [Assembler(typeof(NonConfigurableUiContainerFactoryAssembler))]\r\n    internal sealed class NonConfigurableUiContainerFactory : UiContainerFactoryData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    internal sealed class NonConfigurableUiContainerFactoryAssembler : IAssembler<IUiContainerFactory, UiContainerFactoryData>\r\n    {\r\n        public IUiContainerFactory Assemble(IBuilderContext context, UiContainerFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IUiContainerFactory)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/Plugins/UiContainerFactory/Runtime/UiContainerFactoryCustomFactory.cs",
    "content": "using System;\r\nusing System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory.Runtime\r\n{\r\n    internal sealed class UiContainerFactoryCustomFactory : AssemblerBasedCustomFactory<IUiContainerFactory, UiContainerFactoryData>\r\n    {\r\n        protected override UiContainerFactoryData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            UiContainerFactorySettings settings = configurationSource.GetSection(UiContainerFactorySettings.SectionName) as UiContainerFactorySettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", UiContainerFactorySettings.SectionName));\r\n            }\r\n\r\n            int index1 = name.IndexOf(\"->\");\r\n\r\n            string channelName = name.Substring(0, index1);\r\n            string containerName = name.Substring(index1 + 2);\r\n\r\n            ChannelConfigurationElement channelElement = settings.Channels[channelName];\r\n            if (null == channelElement) throw new ConfigurationErrorsException(string.Format(\"The channel {0} is missing from the configuration\", channelName));\r\n\r\n            return channelElement.Factories.Get(containerName);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/Plugins/UiContainerFactory/Runtime/UiContainerFactoryDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory.Runtime\r\n{\r\n    internal sealed class UiContainerFactoryDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/Plugins/UiContainerFactory/Runtime/UiContainerFactoryFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory.Runtime\r\n{\r\n    internal sealed class UiContainerFactoryFactory : NameTypeFactoryBase<IUiContainerFactory>\r\n    {\r\n        public UiContainerFactoryFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/Plugins/UiContainerFactory/Runtime/UiContainerFactorySettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory.Runtime\r\n{\r\n    internal sealed class UiContainerFactorySettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Forms.Flows.Plugins.UiContainerFactoryConfiguration\";\r\n\r\n\r\n        private const string _channelsProperty = \"Channels\";\r\n        [ConfigurationProperty(_channelsProperty, IsRequired = true)]\r\n        public ChannelConfigurationElementCollection Channels\r\n        {\r\n            get\r\n            {\r\n                return (ChannelConfigurationElementCollection)base[_channelsProperty];\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class ChannelConfigurationElement : NamedConfigurationElement\r\n    {\r\n        private const string _factoriesPropertyName = \"Factories\";\r\n        [ConfigurationProperty(_factoriesPropertyName, IsRequired = true)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<UiContainerFactoryData> Factories\r\n        {\r\n            get { return (NameTypeManagerTypeConfigurationElementCollection<UiContainerFactoryData>)base[_factoriesPropertyName]; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class ChannelConfigurationElementCollection : ConfigurationElementCollection\r\n    {\r\n        public ChannelConfigurationElementCollection()\r\n            : base()\r\n        {\r\n            AddElementName = \"Channel\";\r\n        }\r\n\r\n        public void Add(ChannelConfigurationElement channelConfigurationElement)\r\n        {\r\n            BaseAdd(channelConfigurationElement);\r\n        }\r\n\r\n        new public ChannelConfigurationElement this[string Name]\r\n        {\r\n            get\r\n            {\r\n                return (ChannelConfigurationElement)BaseGet(Name);\r\n            }\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new ChannelConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            return (element as ChannelConfigurationElement).Name;\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/Plugins/UiContainerFactory/UiContainerFactoryData.cs",
    "content": "using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableUiContainerFactory))]\r\n    internal class UiContainerFactoryData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n        private const string _templateFormVirtualPathPropertyName = \"templateFormVirtualPath\";\r\n        [ConfigurationProperty(_templateFormVirtualPathPropertyName, IsRequired = true)]\r\n        public string TemplateFormVirtualPath\r\n        {\r\n            get { return (string)base[_templateFormVirtualPathPropertyName]; }\r\n            set { base[_templateFormVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/StandardEventIdentifiers.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class StandardEventIdentifiers\r\n    {\r\n        /// <exclude />\r\n        public static IFormEventIdentifier Save { get { return new SaveEvent(); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier SaveAndPublish { get { return new SaveAndPublishEvent(); } }        \r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier SaveAs { get { return new SaveAsEvent(); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier Next { get { return new NextEvent(); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier Previous { get { return new PreviousEvent(); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier Finish { get { return new FinishEvent(); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier Cancel { get { return new CancelEvent(); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier Preview { get { return new PreviewEvent(); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier CustomEvent01 { get { return new CustomEvent(1); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier CustomEvent02 { get { return new CustomEvent(2); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier CustomEvent03 { get { return new CustomEvent(3); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier CustomEvent04 { get { return new CustomEvent(4); } }\r\n\r\n        /// <exclude />\r\n        public static IFormEventIdentifier CustomEvent05 { get { return new CustomEvent(5); } }\r\n\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class SaveEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public SaveEvent() { }\r\n\r\n        /// <exclude />\r\n        public string BindingName { get { return \"SaveEventHandler\"; } }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class SaveAndPublishEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public SaveAndPublishEvent() { }\r\n\r\n        /// <exclude />\r\n        public string BindingName { get { return \"SaveAndPublishEventHandler\"; } }\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class SaveAsEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public SaveAsEvent() { }\r\n\r\n        /// <exclude />\r\n        public string BindingName { get { return \"SaveAsEventHandler\"; } }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PreviewEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public PreviewEvent() { }\r\n\r\n        /// <exclude />\r\n        public string BindingName { get { return \"PreviewEventHandler\"; } }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class NextEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public NextEvent() { }\r\n\r\n        /// <exclude />\r\n        public string BindingName { get { return \"NextEventHandler\"; } }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PreviousEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public PreviousEvent() { }\r\n\r\n        /// <exclude />\r\n        public string BindingName { get { return \"PreviousEventHandler\"; } }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class FinishEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public FinishEvent() { }\r\n\r\n        /// <exclude />\r\n        public string BindingName { get { return \"FinishEventHandler\"; } }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class CancelEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public CancelEvent() { }\r\n\r\n        /// <exclude />\r\n        public string BindingName { get { return \"CancelEventHandler\"; } }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class CustomEvent : IFormEventIdentifier\r\n    {\r\n        /// <exclude />\r\n        public CustomEvent(int eventNumber) \r\n        {\r\n            if (eventNumber < 1 || eventNumber > 5) throw new ArgumentException(\"Value must be between 1 and 5\", \"eventNumber\");\r\n            this.BindingName = string.Format(\"CustomEvent0{0}Handler\", eventNumber);\r\n        }\r\n\r\n        /// <exclude />\r\n        public string BindingName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Forms/Flows/StringBasedFormMarkupProvider.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Flows\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class StringBasedFormMarkupProvider : IFormMarkupProvider\r\n    {\r\n        private string Document { get; set; }\r\n\r\n        /// <exclude />\r\n        public StringBasedFormMarkupProvider(string document)\r\n        {\r\n            if (document == null) throw new ArgumentNullException(\"document\");\r\n\r\n            this.Document = document;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public XmlReader GetReader()\r\n        {\r\n            return new XmlTextReader(new StringReader(this.Document));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/FormCompileException.cs",
    "content": "using System;\r\n\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    internal class FormCompileException : ApplicationException\r\n    {\r\n        private readonly XmlSourceNodeInformation _xmlInformation;\r\n        private readonly XmlSourceNodeInformation _propertyXmlInformation;\r\n        private readonly XmlSourceNodeInformation _extraPropertyXmlInformation;\r\n\r\n        public FormCompileException(string message, XmlSourceNodeInformation xmlInformation)\r\n            : base(message)\r\n        {\r\n            _xmlInformation = xmlInformation;\r\n        }\r\n\r\n        public FormCompileException(string message, XmlSourceNodeInformation xmlInformation, XmlSourceNodeInformation propertyXmlInformation)\r\n            : base(message)\r\n        {\r\n            _xmlInformation = xmlInformation;\r\n            _propertyXmlInformation = propertyXmlInformation;\r\n        }\r\n\r\n        public FormCompileException(string message, CompileTreeNode treeNode, CompileTreeNode propertyTreeNode)\r\n            : this(message, treeNode.XmlSourceNodeInformation, propertyTreeNode.XmlSourceNodeInformation)\r\n        {\r\n        }\r\n\r\n        public FormCompileException(string message, XmlSourceNodeInformation xmlInformation, XmlSourceNodeInformation propertyXmlInformation, XmlSourceNodeInformation extraPropertyXmlInformation)\r\n            : base(message)\r\n        {\r\n            _xmlInformation = xmlInformation;\r\n            _propertyXmlInformation = propertyXmlInformation;\r\n            _extraPropertyXmlInformation = extraPropertyXmlInformation;\r\n        }\r\n\r\n        public FormCompileException(string message, XmlSourceNodeInformation xmlInformation, Exception inner)\r\n            : base(message, inner)\r\n        {\r\n            _xmlInformation = xmlInformation;\r\n        }\r\n\r\n        public string TagName\r\n        {\r\n            get { return _xmlInformation.TagName; }\r\n        }\r\n\r\n        public string XPath\r\n        {\r\n            get { return _xmlInformation.XPath; }\r\n        }\r\n\r\n        public override string ToString()\r\n        {\r\n            string result = Message;\r\n\r\n            if (null != _xmlInformation)\r\n            {\r\n                result = string.Format(\"{0}\\n\\nTag = {1}\\nXPath = {2}\", result, _xmlInformation.TagName, _xmlInformation.XPath);\r\n            }\r\n\r\n            if (null != _propertyXmlInformation)\r\n            {\r\n                result = string.Format(\"{0}\\n\\nProperty:\\nTag = {1}\\nXPath = {2}\", result, _propertyXmlInformation.TagName, _propertyXmlInformation.XPath);\r\n            }\r\n\r\n            if (null != _extraPropertyXmlInformation)\r\n            {\r\n                result = string.Format(\"{0}\\n\\nProperty:\\nTag = {1}\\nXPath = {2}\", result, _extraPropertyXmlInformation.TagName, _extraPropertyXmlInformation.XPath);\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/FormDefinition.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class FormDefinition\r\n    {\r\n        /// <exclude />\r\n        public FormDefinition(XmlReader formMarkup, Dictionary<string, object> bindings)\r\n        {\r\n            this.FormMarkup = formMarkup;\r\n            this.Bindings = bindings;\r\n        }\r\n\r\n        /// <exclude />\r\n        public XmlReader FormMarkup { get; private set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> Bindings { get; private set; }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Forms/FormFactoryService.cs",
    "content": "﻿using Composite.C1Console.Forms.Foundation.PluginFacades;\r\nusing Composite.C1Console.Forms.Plugins.FunctionFactory;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n\tinternal static class FormFactoryService\r\n\t{\r\n        public static IFormFunction GetFunction(string namespaceName, string name)\r\n        {\r\n            return FunctionFactoryPluginFacade.GetFunction(namespaceName, name);\r\n        }\r\n\r\n\r\n\r\n        public static IUiControl CreateControl(string channelName, string namespaceName, string name)\r\n        {\r\n            return UiControlFactoryPluginFacade.CreateControl(new ChannelIdentifier(channelName), namespaceName, name);\r\n        }\r\n\r\n\r\n\r\n        public static IUiControl CreateControl(IFormChannelIdentifier channel, string namespaceName, string name)\r\n        {\r\n            return UiControlFactoryPluginFacade.CreateControl(channel, namespaceName, name);\r\n        }\r\n\r\n\r\n\r\n        private class ChannelIdentifier : IFormChannelIdentifier\r\n        {\r\n            public ChannelIdentifier( string name )\r\n            {\r\n                this.ChannelName = name;\r\n            }\r\n\r\n            public string ChannelName { get; private set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/FormKeyTagNames.cs",
    "content": "﻿using Composite.C1Console.Forms.Foundation.FormTreeCompiler;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class FormKeyTagNames\r\n\t{\r\n        /// <exclude />\r\n        public static readonly string DefaultPropertyName = CompilerGlobals.DefaultPropertyName;\r\n\r\n        /// <exclude />\r\n        public static readonly string FormDefinition = CompilerGlobals.FormDefinition_TagName;\r\n\r\n        /// <exclude />\r\n        public static readonly string Layout = CompilerGlobals.Layout_TagName;\r\n\r\n        /// <exclude />\r\n        public static readonly string Bindings = CompilerGlobals.Bindings_TagName;\r\n\r\n        /// <exclude />\r\n        public static readonly string Binding = CompilerGlobals.Binding_TagName;\r\n\r\n        /// <exclude />\r\n        public static readonly string Bind = CompilerGlobals.Bind_TagName;\r\n\r\n        /// <exclude />\r\n        public static readonly string Read = CompilerGlobals.Read_TagName;\r\n\r\n        /// <exclude />\r\n        public static readonly string IfCondition = CompilerGlobals.IfCondition_TagName;\r\n\r\n        /// <exclude />\r\n        public static readonly string IfWhenTrue = CompilerGlobals.IfWhenTrue_TagName;\r\n\r\n        /// <exclude />\r\n        public static readonly string IfWhenFalse = CompilerGlobals.IfWhenFalse_TagName;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/FormTreeCompiler.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler;\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompilePhases;\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FormTreeCompiler\r\n    {\r\n        private CompileContext _context;\r\n        private Dictionary<string, object> _bindingObjects;\r\n\r\n        private IUiControl _uiControl;\r\n        private CompileTreeNode _rootCompilerNode;\r\n\r\n        private string _label;\r\n        private string _tooltip;\r\n        private string _iconHandle;\r\n\r\n\r\n        /// <exclude />\r\n        public void Compile(XmlReader reader, IFormChannelIdentifier channel, Dictionary<string, object> bindingObjects)\r\n        {\r\n            Compile(reader, channel, bindingObjects, false, \"\", null);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Compile(XmlReader reader, IFormChannelIdentifier channel, Dictionary<string, object> bindingObjects, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            Compile(reader, channel, bindingObjects, false, \"\", bindingsValidationRules);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Compile(XmlReader reader, IFormChannelIdentifier channel, Dictionary<string, object> bindingObjects, bool withDebug)\r\n        {\r\n            Compile(reader, channel, bindingObjects, withDebug, \"\", null);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Compile(XmlReader reader, IFormChannelIdentifier channel, Dictionary<string, object> bindingObjects, bool withDebug, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            Compile(reader, channel, bindingObjects, withDebug, \"\", bindingsValidationRules);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Compile(XmlReader reader, IFormChannelIdentifier channel, Dictionary<string, object> bindingObjects, bool withDebug, string customControlIdPrefix)\r\n        {\r\n            Compile(reader, channel, bindingObjects, withDebug, customControlIdPrefix, null);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Compile(XmlReader reader, IFormChannelIdentifier channel,\r\n                            Dictionary<string, object> bindingObjects, bool withDebug, string customControlIdPrefix,\r\n                            Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            XDocument doc = XDocument.Load(reader);\r\n            reader.Close();\r\n\r\n            Compile(doc, channel, bindingObjects, withDebug, customControlIdPrefix, bindingsValidationRules);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Compile(XDocument doc, IFormChannelIdentifier channel, Dictionary<string, object> bindingObjects, bool withDebug, string customControlIdPrefix, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            _bindingObjects = bindingObjects;\r\n\r\n            _context = new CompileContext\r\n            {\r\n                BindingObjects = bindingObjects,\r\n                BindingsValidationRules = bindingsValidationRules,\r\n                CurrentChannel = channel,\r\n                CustomControlIdPrefix = customControlIdPrefix\r\n            };\r\n\r\n            _rootCompilerNode = BuildFromXmlPhase.BuildTree(doc);\r\n\r\n            UpdateXmlInformationPhase updateInfo = new UpdateXmlInformationPhase();\r\n            updateInfo.UpdateInformation(_rootCompilerNode);\r\n\r\n            CreateProducersPhase createProducers = new CreateProducersPhase(_context);\r\n            createProducers.CreateProducers(_rootCompilerNode);\r\n\r\n            EvaluatePropertiesPhase evaluateProperties = new EvaluatePropertiesPhase(_context, withDebug);\r\n            evaluateProperties.Evaluate(_rootCompilerNode);\r\n\r\n            ExtractUiArtifactsPhase extractUiArtifacts = new ExtractUiArtifactsPhase();\r\n\r\n            extractUiArtifacts.ExtractUiArtifacts(_rootCompilerNode, out _uiControl, out _label, out _tooltip, out _iconHandle);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Saves control properties into bindings.\r\n        /// </summary>\r\n        /// <exclude />\r\n        public void SaveControlProperties()\r\n        {\r\n            SaveAndValidateControlProperties();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Saves control properties into bindings and returns validation errors.\r\n        /// </summary>\r\n        /// <exclude />\r\n        public Dictionary<string, Exception> SaveAndValidateControlProperties()\r\n        {\r\n            _uiControl.BindStateToControlProperties();\r\n\r\n            var bindingErrors = new Dictionary<string, Exception>();\r\n\r\n            foreach (CompileContext.IRebinding rd in _context.Rebindings)\r\n            {\r\n                rd.Rebind(_bindingObjects, bindingErrors);\r\n            }\r\n\r\n            return bindingErrors;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> GetBindingToClientIDMapping()\r\n        {\r\n            var result = new Dictionary<string, string>();\r\n            FormFlowUiDefinitionRenderer.ResolveBindingPathToClientIDMappings(_uiControl as IWebUiControl, result);\r\n\r\n            return result;\r\n        } \r\n\r\n        /// <exclude />\r\n        public IUiControl UiControl => _uiControl;\r\n\r\n\r\n        /// <exclude />\r\n        public string Label\r\n        {\r\n            get \r\n            {\r\n                return !string.IsNullOrEmpty(_label) ? _label : _uiControl.Label;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Tooltip => _tooltip;\r\n\r\n\r\n        /// <exclude />\r\n        public ResourceHandle Icon\r\n        {\r\n            get\r\n            {\r\n                if (string.IsNullOrEmpty(_iconHandle))\r\n                {\r\n                    return null;\r\n                }\r\n                \r\n                if (_iconHandle.IndexOf(',') == -1)\r\n                {\r\n                    return new ResourceHandle(BuildInIconProviderName.ProviderName, _iconHandle.Trim());\r\n                }\r\n                \r\n                string[] resourceParts = _iconHandle.Split(',');\r\n                if (resourceParts.Length != 2)\r\n                    throw new InvalidOperationException(\r\n                        $\"Invalid icon resource name '{_iconHandle}'. Only one comma expected.\");\r\n\r\n                return new ResourceHandle(resourceParts[0].Trim(), resourceParts[1].Trim());\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> BindingObjects => _bindingObjects;\r\n\r\n        /// <exclude />\r\n        public CompileTreeNode RootCompileTreeNode => _rootCompilerNode;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/FormsPropertyAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>\r\n    /// Defines that a property should be visuble / accessible in the forms environment.\r\n    /// </summary>\r\n    /// <exclude />    \r\n    [AttributeUsage(AttributeTargets.Property,AllowMultiple=false,Inherited=true)]\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FormsPropertyAttribute : Attribute\r\n    {\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompileContext.cs",
    "content": "using System;\r\nusing System.Reflection;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler\r\n{\r\n    internal sealed class CompileContext\r\n    {\r\n        private IFormChannelIdentifier _currentChannel;\r\n        private object _bindingsProducer = null;\r\n\r\n        private Dictionary<string, object> _bindingObjects = new Dictionary<string, object>();        \r\n        private Dictionary<string, BindingInformation> _bindingObjectsInformations = new Dictionary<string, BindingInformation>();\r\n\r\n        private Dictionary<string, List<ClientValidationRule>> _bindingsValidationRules = new Dictionary<string, List<ClientValidationRule>>();\r\n\r\n        private List<string> _registeredBindingNames = new List<string>();                \r\n        private List<string> _registeredSourceObjectBindings = new List<string>();\r\n        private Dictionary<string, List<string>> _registeredSourcePropertyBindings = new Dictionary<string,List<string>>();\r\n\r\n        private List<IRebinding> _rebindings = new List<IRebinding>();\r\n\r\n        private int _controlIdCounter = 0;\r\n        private int _debugControlIdCounter = 0;\r\n\r\n\r\n        internal bool RegistarBindingName(string bindingName)\r\n        {\r\n            if (_registeredBindingNames.Contains(bindingName)) return false;\r\n\r\n            _registeredBindingNames.Add(bindingName);\r\n            \r\n            return true;\r\n        }\r\n\r\n\r\n        internal bool RegisterUniqueSourceObjectBinding(string bindSourceName)\r\n        {\r\n            if (_registeredSourceObjectBindings.Contains(bindSourceName) == false)\r\n            {\r\n                _registeredSourceObjectBindings.Add(bindSourceName);\r\n                return  true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        internal bool IsUniqueSourceObjectBinding(string bindSourceName)\r\n        {\r\n            return _registeredSourceObjectBindings.Contains(bindSourceName);\r\n        }\r\n\r\n\r\n\r\n        internal bool RegisterUniqueSourcePropertyBinding(string bindSounceName, string bindPropertyName)\r\n        {\r\n            List<string> boundProperties;\r\n\r\n            if (_registeredSourcePropertyBindings.ContainsKey(bindSounceName))\r\n            {\r\n                boundProperties = _registeredSourcePropertyBindings[bindSounceName];\r\n                if (boundProperties.Contains(bindPropertyName)) return false;\r\n            }\r\n            else\r\n            {\r\n                boundProperties = new List<string>();\r\n                _registeredSourcePropertyBindings.Add(bindSounceName, boundProperties);\r\n            }\r\n\r\n            boundProperties.Add(bindPropertyName);\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        internal bool IsUniqueSourcePropertyBinding(string bindSounceName)\r\n        {\r\n            return _registeredSourcePropertyBindings.ContainsKey(bindSounceName);\r\n        }\r\n\r\n\r\n        internal IFormChannelIdentifier CurrentChannel\r\n        {\r\n            get { return _currentChannel; }\r\n            set { _currentChannel = value; }\r\n        }\r\n\r\n\r\n\r\n        internal object BindingsProducer\r\n        {\r\n            get { return _bindingsProducer; }\r\n            set { _bindingsProducer = value; }\r\n        }\r\n\r\n\r\n\r\n        internal object GetBindingObject(string name)\r\n        {\r\n            if (_bindingObjects == null || !_bindingObjects.ContainsKey(name)) return null;\r\n\r\n            return _bindingObjects[name];\r\n        }\r\n\r\n        internal bool BindingObjectExists(string name)\r\n        {\r\n            return _bindingObjects != null && _bindingObjects.ContainsKey(name);\r\n        }\r\n\r\n\r\n\r\n        internal void SetBindingType(string name, Type type)\r\n        {\r\n            BindingInformation bindingInformation;\r\n            if (!_bindingObjectsInformations.TryGetValue(name, out bindingInformation))\r\n            {\r\n                bindingInformation = new BindingInformation();\r\n                _bindingObjectsInformations.Add(name, bindingInformation);\r\n            }\r\n\r\n            bindingInformation.BindingType = type;\r\n        }\r\n\r\n\r\n\r\n        internal List<ClientValidationRule> GetBindingsValidationRules(string bindingName)\r\n        {\r\n            if (_bindingsValidationRules == null) return null;\r\n\r\n            List<ClientValidationRule> rules;\r\n\r\n            _bindingsValidationRules.TryGetValue(bindingName, out rules);\r\n\r\n            return rules;\r\n        }\r\n\r\n\r\n        public Dictionary<string, object> BindingObjects\r\n        {\r\n            set { _bindingObjects = value; }\r\n        }\r\n\r\n\r\n        public Dictionary<string, List<ClientValidationRule>> BindingsValidationRules\r\n        {\r\n            set { _bindingsValidationRules = value; }\r\n        }\r\n\r\n\r\n        internal List<IRebinding> Rebindings\r\n        {\r\n            get { return _rebindings; }\r\n        }\r\n\r\n\r\n\r\n        internal string GetNextControlId( string prefix )\r\n        {\r\n            return string.Format(\"{0}{1}{2}\", this.CustomControlIdPrefix, prefix, _controlIdCounter++);\r\n        }\r\n\r\n\r\n\r\n        internal string GetNextDebugControlId\r\n        {\r\n            get { return string.Format(\"UiDebugControl{0}\", _debugControlIdCounter++); }\r\n        }\r\n\r\n\r\n        internal string CustomControlIdPrefix { get; set; }\r\n\r\n\r\n        internal interface IRebinding\r\n        {\r\n            void Rebind(Dictionary<string, object> bindingObjects, Dictionary<string, Exception> conversionErrors);\r\n\r\n            string BindingObjectName { get; }\r\n            string PropertyName { get; }\r\n            Type DestinationObjectType { get; }\r\n            object SourceProducer { get; }\r\n        }\r\n\r\n\r\n        internal class ObjectRebinding : IRebinding\r\n        {\r\n            private object _sourceProducer;\r\n            private MethodInfo _sourceProducerGetProperty;\r\n            private string _bindSourceName;\r\n\r\n            private Type _destinationObjectType;\r\n\r\n            internal ObjectRebinding(object sourceProducer, MethodInfo sourceProducerGetProperty, string bindSourceName, Type destinationObjectType)\r\n            {\r\n                _sourceProducer = sourceProducer;\r\n                _sourceProducerGetProperty = sourceProducerGetProperty;   \r\n                _bindSourceName = bindSourceName;\r\n\r\n                _destinationObjectType = destinationObjectType;\r\n            }\r\n\r\n\r\n            public void Rebind(Dictionary<string, object> bindingObjects, Dictionary<string, Exception> conversionErrors)\r\n            {\r\n                IValidatingUiControl validating = _sourceProducer as IValidatingUiControl;\r\n\r\n                if (validating != null && validating.IsValid == false)\r\n                {\r\n                    conversionErrors.Add(_bindSourceName, new InvalidOperationException(validating.ValidationError));\r\n                }\r\n                else\r\n                {\r\n                    object value = _sourceProducerGetProperty.Invoke(_sourceProducer, null);\r\n\r\n                    Exception conversionError;\r\n                    bindingObjects[_bindSourceName] = ValueTypeConverter.TryConvert(value, _destinationObjectType, out conversionError);\r\n\r\n                    if (conversionError != null)\r\n                    {\r\n                        conversionErrors.Add(_bindSourceName, conversionError);\r\n                    }\r\n                }\r\n            } \r\n\r\n\r\n            public string BindingObjectName\r\n            {\r\n                get { return _bindSourceName; }\r\n            }\r\n\r\n\r\n            public string PropertyName\r\n            {\r\n                get { return null; }\r\n            }\r\n\r\n\r\n            public Type DestinationObjectType\r\n            {\r\n                get { return _destinationObjectType; }\r\n            }\r\n\r\n\r\n            public object SourceProducer\r\n            {\r\n                get { return _sourceProducer; }\r\n            }            \r\n        }\r\n\r\n\r\n        internal class PropertyRebinding : IRebinding\r\n        {\r\n            private object _sourceProducer;\r\n            private MethodInfo _sourceProducerGetProperty;\r\n            private object _destinationObject;\r\n            private MethodInfo _destinationSetProperty;\r\n            private Type _destinationSetPropertyType;\r\n\r\n            private string _bindingObjectName;\r\n            private string _propertyName;\r\n\r\n            internal PropertyRebinding(object sourceProducer, MethodInfo sourceProducerGetProperty, object destinationObject, MethodInfo destinationSetProperty, Type destinationSetPropertyType, string bindingObjectName, string propertyName)\r\n            {\r\n                _sourceProducer = sourceProducer;\r\n                _sourceProducerGetProperty = sourceProducerGetProperty;\r\n                _destinationObject = destinationObject;\r\n                _destinationSetProperty = destinationSetProperty;\r\n                _destinationSetPropertyType = destinationSetPropertyType;\r\n\r\n                _bindingObjectName = bindingObjectName;\r\n                _propertyName = propertyName;\r\n            }\r\n\r\n\r\n\r\n            public void Rebind(Dictionary<string, object> bindingObjects, Dictionary<string, Exception> conversionErrors)\r\n            {\r\n                object value = _sourceProducerGetProperty.Invoke(_sourceProducer, null);\r\n\r\n                object parm = ValueTypeConverter.Convert(value, _destinationSetPropertyType);\r\n\r\n                object[] parms = { parm };\r\n\r\n                try \r\n                {\r\n                    _destinationSetProperty.Invoke(_destinationObject, parms);\r\n                }\r\n                catch(TargetInvocationException e)\r\n                {\r\n                    throw e.InnerException;\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public string BindingObjectName\r\n            {\r\n                get { return _bindingObjectName; }\r\n            }\r\n\r\n\r\n\r\n            public string PropertyName\r\n            {\r\n                get { return _propertyName; }\r\n            }\r\n\r\n\r\n\r\n            public Type DestinationObjectType\r\n            {\r\n                get { return _destinationObject.GetType(); }\r\n            }                     \r\n\r\n\r\n\r\n            public object SourceProducer\r\n            {\r\n                get { return _sourceProducer; }\r\n            }            \r\n        }\r\n\r\n\r\n\r\n        internal class BindingInformation\r\n        {\r\n            private Type _bindingType;\r\n\r\n            public Type BindingType\r\n            {\r\n                get { return _bindingType; }\r\n                set { _bindingType = value; }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompilePhases/BuildFromXmlPhase.cs",
    "content": "using System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompilePhases\r\n{\r\n    /// <summary>\r\n    /// Converts form markup xml into tree of <see cref=\"CompileTreeNode\"/>. Translates properties\r\n    /// </summary>\r\n    internal static class BuildFromXmlPhase\r\n    {\r\n        public static CompileTreeNode BuildTree(XDocument document)\r\n        {\r\n            return BuildRec(document.Root);\r\n        }\r\n\r\n        public static ElementCompileTreeNode BuildRec(XElement element)\r\n        {\r\n            int depth = element.Ancestors().Count();\r\n\r\n            var debugInfo = new XmlSourceNodeInformation(depth, element.Name.LocalName, element.Name.LocalName, element.Name.NamespaceName);\r\n\r\n            var result = new ElementCompileTreeNode(debugInfo);\r\n            foreach (var attribute in element.Attributes())\r\n            {\r\n                if (attribute.Name.LocalName == \"xmlns\") continue;\r\n\r\n                bool isNamespaceDeclaration = attribute.Name.Namespace == \"http://www.w3.org/2000/xmlns/\";\r\n\r\n                var property = new PropertyCompileTreeNode(attribute.Name.LocalName, debugInfo, isNamespaceDeclaration);\r\n                property.Value = StringResourceSystemFacade.ParseString(attribute.Value);\r\n\r\n                result.AddNamedProperty(property);\r\n            }\r\n\r\n            foreach (var node in element.Nodes())\r\n            {\r\n                if (node is XElement)\r\n                {\r\n                    result.Children.Add(BuildRec(node as XElement));\r\n                    continue;\r\n                }\r\n\r\n                if (node is XText)\r\n                {\r\n                    string text = (node as XText).Value;\r\n\r\n                    if (string.IsNullOrWhiteSpace(text))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    var textProperty = new PropertyCompileTreeNode(CompilerGlobals.DefaultPropertyName, debugInfo);\r\n                    textProperty.Value = StringResourceSystemFacade.ParseString(text);\r\n\r\n                    result.DefaultProperties.Add(textProperty);\r\n                    continue;\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompilePhases/CreateProducersPhase.cs",
    "content": "using Composite.C1Console.Forms.Foundation.PluginFacades;\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompilePhases\r\n{\r\n    internal sealed class CreateProducersPhase\r\n    {\r\n        private CompileContext _compileContext;\r\n\r\n\r\n        public CreateProducersPhase(CompileContext compileContext)\r\n        {\r\n            _compileContext = compileContext;\r\n        }\r\n\r\n\r\n\r\n        public void CreateProducers(CompileTreeNode node)\r\n        {\r\n            if (node is ElementCompileTreeNode)\r\n            {\r\n                ElementCompileTreeNode element = node as ElementCompileTreeNode;\r\n\r\n                if ((CompilerGlobals.IsProducerTag(element)) ||\r\n                    (CompilerGlobals.IsReadTag(element)) ||\r\n                    (CompilerGlobals.IsBindTag(element)) ||\r\n                    (CompilerGlobals.IsBindingTag(element)) ||\r\n                    (CompilerGlobals.IsLayoutTag(element)))\r\n                {\r\n                    element.Producer = ProducerMediatorPluginFacade.CreateProducer(_compileContext.CurrentChannel, element.XmlSourceNodeInformation.NamespaceURI, element.XmlSourceNodeInformation.Name);\r\n\r\n                    if (element.Producer is IUiControl)\r\n                    {\r\n                        (element.Producer as IUiControl).UiControlID = _compileContext.GetNextControlId(element.XmlSourceNodeInformation.Name);\r\n                        \r\n                    }\r\n                }\r\n                else if (CompilerGlobals.IsBindingsTag(element))\r\n                {\r\n                    if (null == _compileContext.BindingsProducer)\r\n                    {\r\n                        _compileContext.BindingsProducer = ProducerMediatorPluginFacade.CreateProducer(_compileContext.CurrentChannel, element.XmlSourceNodeInformation.NamespaceURI, element.XmlSourceNodeInformation.Name);\r\n                    }\r\n\r\n                    element.Producer = _compileContext.BindingsProducer;\r\n                }\r\n            }\r\n\r\n            foreach (CompileTreeNode subNode in node.AllSubNodes) CreateProducers(subNode);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompilePhases/EvaluatePropertiesPhase.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\nusing Composite.C1Console.Forms.Foundation.PluginFacades;\r\nusing Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompilePhases\r\n{\r\n    internal sealed class EvaluatePropertiesPhase\r\n    {\r\n        private readonly CompileContext _compileContext;\r\n        private readonly bool _withDebug = false;\r\n\r\n\r\n\r\n        public EvaluatePropertiesPhase(CompileContext compileContext)\r\n        {\r\n            _compileContext = compileContext;\r\n        }\r\n\r\n\r\n\r\n        public EvaluatePropertiesPhase(CompileContext compileContext, bool withDebug)\r\n            : this(compileContext)\r\n        {\r\n            _withDebug = withDebug;\r\n        }\r\n\r\n\r\n\r\n        public CompileTreeNode Evaluate(CompileTreeNode node)\r\n        {\r\n            return Evaluate(node as ElementCompileTreeNode, null);\r\n        }\r\n\r\n\r\n\r\n        public ElementCompileTreeNode Evaluate(ElementCompileTreeNode node, List<PropertyCompileTreeNode> newProperties, string defaultOverloadPropertyName = null)\r\n        {\r\n            var replacedNodes = new Dictionary<ElementCompileTreeNode, List<PropertyCompileTreeNode>>();\r\n\r\n            bool isIfProducer = node.Producer is IfProducer;\r\n\r\n            if (!isIfProducer)\r\n            {\r\n                foreach (ElementCompileTreeNode child in node.Children)\r\n                {\r\n                    var newProps = new List<PropertyCompileTreeNode>();\r\n\r\n\r\n                    string childDefaultOverloadPropertyName = null;\r\n                    if (node.Producer != null)\r\n                    {\r\n                        ReadBindingControlValueOverload attribute = node.Producer.GetType().GetCustomAttributesRecursively<ReadBindingControlValueOverload>().SingleOrDefault();\r\n\r\n                        if (attribute != null)\r\n                        {\r\n                            childDefaultOverloadPropertyName = attribute.PropertyName;\r\n                        }\r\n                    }\r\n\r\n                    ElementCompileTreeNode resultNode = Evaluate(child, newProps, childDefaultOverloadPropertyName);\r\n\r\n                    if ((null == resultNode) || (false == child.Equals(resultNode)))\r\n                    {\r\n                        replacedNodes.Add(child, newProps);\r\n\r\n                        foreach (PropertyCompileTreeNode newProperty in newProps)\r\n                        {\r\n                            if (newProperty.Name == CompilerGlobals.DefaultPropertyName)\r\n                            {\r\n                                node.DefaultProperties.Add(newProperty);\r\n                            }\r\n                            else\r\n                            {\r\n                                node.AddNamedProperty(newProperty);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            if (!isIfProducer)\r\n            {\r\n                foreach (ElementCompileTreeNode nodeToRemove in replacedNodes.Keys)\r\n                {\r\n                    node.Children.Remove(nodeToRemove);\r\n                }\r\n            }\r\n\r\n\r\n            return EvaluateElementCompileTreeNode(node, newProperties, defaultOverloadPropertyName);\r\n        }\r\n\r\n\r\n\r\n        public ElementCompileTreeNode EvaluateElementCompileTreeNode(ElementCompileTreeNode element, List<PropertyCompileTreeNode> newProperties, string defaultOverloadPropertyName)\r\n        {\r\n            if (CompilerGlobals.IsElementEmbeddedProperty(element))\r\n            {\r\n                return HandleEmbeddedProperty(element, newProperties);\r\n            }\r\n\r\n            if (element.Producer == null) return element;\r\n\r\n            if (element.Producer is IfProducer)\r\n            {\r\n                return HandleIfProducerElement(element, newProperties);\r\n            }\r\n\r\n            return HandleProducerElement(element, newProperties, defaultOverloadPropertyName);\r\n        }\r\n\r\n\r\n\r\n        private ElementCompileTreeNode HandleEmbeddedProperty(ElementCompileTreeNode element, List<PropertyCompileTreeNode> newProperties)\r\n        {\r\n            if (element.NamedProperties.Count > 0) throw new FormCompileException(\"Attrbute not allow on embedded properties\", element.XmlSourceNodeInformation);\r\n\r\n            string producerName;\r\n            string propertyName;\r\n            CompilerGlobals.GetSplittedPropertyNameFromCompositeName(element, out producerName, out propertyName);\r\n\r\n            foreach (PropertyCompileTreeNode property in element.DefaultProperties)\r\n            {\r\n                var replacingProperty = new PropertyCompileTreeNode(propertyName, element.XmlSourceNodeInformation)\r\n                {\r\n                    Value = property.Value,\r\n                    InclosingProducerName = producerName\r\n                };\r\n\r\n                newProperties.Add(replacingProperty);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private ElementCompileTreeNode HandleIfProducerElement(ElementCompileTreeNode element, List<PropertyCompileTreeNode> newProperties)\r\n        {\r\n            ElementCompileTreeNode conditionElement = null;\r\n            ElementCompileTreeNode whenTrueElement = null;\r\n            ElementCompileTreeNode whenFalseElement = null;\r\n\r\n            foreach (ElementCompileTreeNode child in element.Children)\r\n            {\r\n                if (CompilerGlobals.IsElementIfConditionTag(child)) conditionElement = child;\r\n                if (CompilerGlobals.IsElementIfWhenTrueTag(child)) whenTrueElement = child;\r\n                if (CompilerGlobals.IsElementIfWhenFalseTag(child)) whenFalseElement = child;\r\n            }\r\n\r\n            if (conditionElement == null) throw new FormCompileException(string.Format(\"Missing condition tag ({0})\", CompilerGlobals.IfCondition_TagName), element.XmlSourceNodeInformation);\r\n            if (whenTrueElement == null) throw new FormCompileException(string.Format(\"Missing when true tag ({0})\", CompilerGlobals.IfWhenTrue_TagName), element.XmlSourceNodeInformation);\r\n\r\n\r\n            var newConditionProperties = new List<PropertyCompileTreeNode>();\r\n            Evaluate(conditionElement, newConditionProperties);\r\n            var conditionProducer = (IfConditionProducer)newConditionProperties[0].Value;\r\n\r\n\r\n            object value;\r\n            if (conditionProducer.Condition)\r\n            {\r\n                var newWhenTrueProperties = new List<PropertyCompileTreeNode>();\r\n                Evaluate(whenTrueElement, newWhenTrueProperties);\r\n\r\n                var whenTrueProducer = (IfWhenTrueProducer)newWhenTrueProperties[0].Value;\r\n\r\n                if (whenTrueProducer.Result.Count == 1)\r\n                {\r\n                    value = whenTrueProducer.Result[0];\r\n                }\r\n                else\r\n                {\r\n                    value = whenTrueProducer.Result;\r\n                }\r\n            }\r\n            else if (whenFalseElement != null)\r\n            {\r\n                var newWhenFalseProperties = new List<PropertyCompileTreeNode>();\r\n                Evaluate(whenFalseElement, newWhenFalseProperties);\r\n\r\n                var whenFalseProducer = (IfWhenFalseProducer)newWhenFalseProperties[0].Value;\r\n\r\n                if (whenFalseProducer.Result.Count == 1)\r\n                {\r\n                    value = whenFalseProducer.Result[0];\r\n                }\r\n                else\r\n                {\r\n                    value = whenFalseProducer.Result;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                return null;\r\n            }\r\n\r\n\r\n\r\n            var replacingProperty = new PropertyCompileTreeNode(CompilerGlobals.DefaultPropertyName, element.XmlSourceNodeInformation);\r\n            replacingProperty.Value = value;\r\n\r\n            newProperties.Add(replacingProperty);\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private ElementCompileTreeNode HandleProducerElement(ElementCompileTreeNode element, List<PropertyCompileTreeNode> newProperties, string defaultOverloadPropertyName)\r\n        {\r\n            PropertyAssigner.AssignPropertiesToProducer(element, _compileContext);\r\n\r\n            string replacingPropertyName = CompilerGlobals.DefaultPropertyName;\r\n            if (defaultOverloadPropertyName != null)\r\n            {\r\n                replacingPropertyName = defaultOverloadPropertyName;\r\n            }\r\n\r\n            var replacingProperty = new PropertyCompileTreeNode(replacingPropertyName, element.XmlSourceNodeInformation);\r\n            object result = ProducerMediatorPluginFacade.EvaluateProducer(element.XmlSourceNodeInformation.NamespaceURI, element.Producer);\r\n\r\n            if (result is BindingProducer)\r\n            {\r\n                var bindingProducer = (BindingProducer)result;\r\n\r\n                if (string.IsNullOrEmpty(bindingProducer.name)) throw new FormCompileException(\"A binding declaraions is missing its name attribute\", element.XmlSourceNodeInformation);\r\n\r\n                if (!_compileContext.RegistarBindingName(bindingProducer.name)) throw new FormCompileException(string.Format(\"Name binding name {0} is used twice which is not allowed\", bindingProducer.name), element.XmlSourceNodeInformation);\r\n\r\n                //if (_compileContext.GetBindingObject(bindingProducer.name) == null && !bindingProducer.optional)\r\n                //{\r\n                //    throw new FormCompileException(string.Format(\"The non optional binding {0} is missing its binding value\", bindingProducer.name), element.XmlSourceNodeInformation);\r\n                //}\r\n\r\n                Type type = TypeManager.GetType(bindingProducer.type);\r\n\r\n                _compileContext.SetBindingType(bindingProducer.name, type);\r\n            }\r\n            else if (_withDebug && result is IUiControl)\r\n            {\r\n                IUiControl uiControl = result as IUiControl;\r\n\r\n                string debugControlNamespace;\r\n                string debugControlName;\r\n                UiControlFactoryPluginFacade.GetDebugControlName(_compileContext.CurrentChannel, out debugControlNamespace, out debugControlName);\r\n\r\n                DebugUiControl debug = ProducerMediatorPluginFacade.CreateProducer(_compileContext.CurrentChannel, debugControlNamespace, debugControlName) as DebugUiControl;\r\n                debug.UiControlID = _compileContext.GetNextDebugControlId;\r\n                debug.UiControl = uiControl;\r\n                result = debug;\r\n\r\n                debug.UiControlID = uiControl.UiControlID;\r\n                debug.TagName = element.XmlSourceNodeInformation.TagName;\r\n                debug.SourceElementXPath = element.XmlSourceNodeInformation.XPath;\r\n\r\n\r\n                foreach (CompileContext.IRebinding rd in _compileContext.Rebindings)\r\n                {\r\n                    if (ReferenceEquals(uiControl, rd.SourceProducer))\r\n                    {\r\n                        debug.Bindings.Add(new DebugUiControl.BindingInformation(\r\n                            rd.BindingObjectName,\r\n                            rd.DestinationObjectType,\r\n                            rd.PropertyName));\r\n                    }\r\n                }\r\n            }\r\n\r\n            replacingProperty.Value = result;\r\n\r\n            newProperties.Add(replacingProperty);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompilePhases/ExtractUiArtifactsPhase.cs",
    "content": "using Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\nusing Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompilePhases\r\n{\r\n    internal sealed class ExtractUiArtifactsPhase\r\n    {\r\n        public void ExtractUiArtifacts(CompileTreeNode node, out IUiControl uiControl, out string label, out string tooltip, out string iconhandle )\r\n        {\r\n            foreach (PropertyCompileTreeNode n in node.DefaultProperties)\r\n            {\r\n                if (n.Value is LayoutProducer)\r\n                {\r\n                    var lp = (LayoutProducer) n.Value;\r\n                    uiControl = lp.UiControl;\r\n                    label = lp.label;\r\n                    iconhandle = lp.iconhandle;\r\n                    tooltip = lp.tooltip;\r\n\r\n                    return;\r\n                }\r\n            }\r\n\r\n            throw new FormCompileException(\"No layout defined in the source file\", node.XmlSourceNodeInformation);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompilePhases/UpdateXmlInformationPhase.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompilePhases\r\n{\r\n    internal sealed class UpdateXmlInformationPhase\r\n    {\r\n        public void UpdateInformation(CompileTreeNode startNode)\r\n        {\r\n            UpdateInformation(startNode, \"\", null);\r\n        }\r\n\r\n\r\n        private void UpdateInformation(CompileTreeNode node, string currentXPath, int? childNumber)\r\n        {\r\n            if (childNumber.HasValue)\r\n            {\r\n                currentXPath = string.Format(\"{0}/{1}[{2}]\", currentXPath, node.XmlSourceNodeInformation.TagName, childNumber.Value);\r\n            }\r\n            else\r\n            {\r\n                currentXPath = string.Format(\"{0}/{1}\", currentXPath, node.XmlSourceNodeInformation.TagName);\r\n            }\r\n\r\n            node.XmlSourceNodeInformation.XPath = currentXPath;\r\n\r\n            Dictionary<string, int> tagOccursCount = new Dictionary<string, int>();\r\n            Dictionary<string, int> xPathCounter = new Dictionary<string, int>();\r\n\r\n            foreach (CompileTreeNode child in node.Children)\r\n            {\r\n                if (false == tagOccursCount.ContainsKey(child.XmlSourceNodeInformation.Name)) tagOccursCount.Add(child.XmlSourceNodeInformation.Name, 0);\r\n\r\n                tagOccursCount[child.XmlSourceNodeInformation.Name]++;\r\n            }\r\n\r\n            foreach (CompileTreeNode child in node.Children)\r\n            {\r\n                if (tagOccursCount[child.XmlSourceNodeInformation.Name] > 1)\r\n                {\r\n                    if (false == xPathCounter.ContainsKey(child.XmlSourceNodeInformation.Name)) xPathCounter.Add(child.XmlSourceNodeInformation.Name, 1);\r\n\r\n                    UpdateInformation(child, currentXPath, xPathCounter[child.XmlSourceNodeInformation.Name]++);\r\n                }\r\n                else\r\n                {\r\n                    UpdateInformation(child, currentXPath, null);\r\n                }\r\n            }\r\n\r\n            foreach (PropertyCompileTreeNode nameProperty in node.AllNamedProperties)\r\n            {\r\n                nameProperty.XmlSourceNodeInformation.NamespaceURI = node.XmlSourceNodeInformation.NamespaceURI;\r\n\r\n                UpdateInformation(nameProperty, currentXPath, null);\r\n            }\r\n\r\n            if (node.DefaultProperties.Count == 1)\r\n            {\r\n                node.DefaultProperties[0].XmlSourceNodeInformation.NamespaceURI = node.XmlSourceNodeInformation.NamespaceURI;\r\n\r\n                UpdateInformation(node.DefaultProperties[0], currentXPath, null);\r\n            }\r\n            else if (node.DefaultProperties.Count > 1)\r\n            {\r\n                int counter = 1;\r\n                foreach (CompileTreeNode defaultProperty in node.DefaultProperties)\r\n                {\r\n                    defaultProperty.XmlSourceNodeInformation.NamespaceURI = node.XmlSourceNodeInformation.NamespaceURI;\r\n\r\n                    UpdateInformation(defaultProperty, currentXPath, counter++);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompileTreeNodes/CompileTreeNode.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"Name {_xmlSourceNodeInformation.Name}\")]\r\n    public class CompileTreeNode\r\n    {\r\n        private static int _compilerIdCounter = 0;\r\n        private int _compilerId;\r\n        private XmlSourceNodeInformation _xmlSourceNodeInformation;\r\n        private List<ElementCompileTreeNode> _childNodes = new List<ElementCompileTreeNode>();\r\n        private List<PropertyCompileTreeNode> _defaultProperties = new List<PropertyCompileTreeNode>();\r\n        private Dictionary<string, List<PropertyCompileTreeNode>> _namedProperties = new Dictionary<string, List<PropertyCompileTreeNode>>();\r\n\r\n        /// <exclude />\r\n        public CompileTreeNode(XmlSourceNodeInformation xmlSourceNodeInformation)\r\n        {\r\n            _compilerId = _compilerIdCounter++;\r\n\r\n            _xmlSourceNodeInformation = xmlSourceNodeInformation;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public XmlSourceNodeInformation XmlSourceNodeInformation\r\n        {\r\n            get { return _xmlSourceNodeInformation; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<ElementCompileTreeNode> Children\r\n        {\r\n            get { return _childNodes; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<PropertyCompileTreeNode> DefaultProperties\r\n        {\r\n            get { return _defaultProperties; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, List<PropertyCompileTreeNode>> NamedProperties\r\n        {\r\n            get { return _namedProperties; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddNamedProperty(PropertyCompileTreeNode property)\r\n        {\r\n            AddNamedProperty(property.Name, property);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddNamedProperty(string name, PropertyCompileTreeNode property)\r\n        {\r\n            if (false == _namedProperties.ContainsKey(name))\r\n            {\r\n                _namedProperties.Add(name, new List<PropertyCompileTreeNode>());\r\n            }\r\n\r\n            _namedProperties[name].Add(property);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<PropertyCompileTreeNode> AllNamedProperties\r\n        {\r\n            get\r\n            {\r\n                foreach (List<PropertyCompileTreeNode> namedProperties in NamedProperties.Values)\r\n                {\r\n                    foreach (PropertyCompileTreeNode namedProperty in namedProperties) yield return namedProperty;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<CompileTreeNode> AllSubNodes\r\n        {\r\n            get\r\n            {\r\n                foreach (CompileTreeNode child in Children) yield return child;\r\n\r\n                foreach (List<PropertyCompileTreeNode> namedProperties in NamedProperties.Values)\r\n                {\r\n                    foreach (CompileTreeNode namedProperty in namedProperties) yield return namedProperty;\r\n                }\r\n\r\n                foreach (CompileTreeNode defaultProperty in DefaultProperties) yield return defaultProperty;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int CompilerId\r\n        {\r\n            get { return _compilerId; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return _compilerId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            if (null == obj) return false;\r\n\r\n            CompileTreeNode node = obj as CompileTreeNode;\r\n            if (null == node) return false;\r\n\r\n            return node._compilerId == _compilerId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(CompileTreeNode node)\r\n        {\r\n            if (null == node) return false;\r\n\r\n            return node._compilerId == _compilerId;\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompileTreeNodes/ElementCompileTreeNode.cs",
    "content": "using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ElementCompileTreeNode : CompileTreeNode\r\n    {\r\n        private object _producer = null;\r\n        private Dictionary<int, List<PropertyCompileTreeNode>> _addedProperties = new Dictionary<int, List<PropertyCompileTreeNode>>();\r\n\r\n        /// <exclude />\r\n        public ElementCompileTreeNode(XmlSourceNodeInformation sourceInformation)\r\n            : base(sourceInformation)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public object Producer\r\n        {\r\n            get { return _producer; }\r\n            set { _producer = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public Dictionary<int, List<PropertyCompileTreeNode>> AddedProperties\r\n        {\r\n            get { return _addedProperties; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompileTreeNodes/PropertyCompileTreeNode.cs",
    "content": "using System.Diagnostics;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [DebuggerDisplay(\"PropertyCompileTreeNode: {Name} = {Value}\")]\r\n    public sealed class PropertyCompileTreeNode : CompileTreeNode\r\n    {\r\n        private string _name = \"\";        \r\n        private object _value = null;\r\n        private string _inclosingProducerName = \"\";\r\n\r\n        /// <exclude />\r\n        public PropertyCompileTreeNode(string name, XmlSourceNodeInformation sourceInformation, bool isNamespaceDeclaration = false)\r\n            : base(sourceInformation)\r\n        {\r\n            _name = name;\r\n            IsNamespaceDeclaration = isNamespaceDeclaration;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Name\r\n        {\r\n            get { return _name; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsNamespaceDeclaration\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public object Value\r\n        {\r\n            get { return _value; }\r\n            set { _value = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string InclosingProducerName\r\n        {\r\n            get { return _inclosingProducerName; }\r\n            set { _inclosingProducerName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<ClientValidationRule> ClientValidationRules\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompileTreeNodes/XmlSourceNodeInformation.cs",
    "content": "namespace Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class XmlSourceNodeInformation\r\n    {\r\n        private int _depth;\r\n        private string _name;\r\n        private string _tagName;\r\n        private string _namespaceURI;\r\n        private string _xPath;\r\n\r\n        /// <exclude />\r\n        public XmlSourceNodeInformation(int depth, string name, string tagName, string namespaceURI)\r\n        {\r\n            _depth = depth;\r\n            _name = name;\r\n            _tagName = tagName;\r\n            _namespaceURI = namespaceURI;\r\n            _xPath = \"\";\r\n        }\r\n\r\n        /// <exclude />\r\n        public int Depth\r\n        {\r\n            get { return _depth; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Name\r\n        {\r\n            get { return _name; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string TagName\r\n        {\r\n            get { return _tagName; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string NamespaceURI\r\n        {\r\n            get { return _namespaceURI; }\r\n            set { _namespaceURI = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string XPath\r\n        {\r\n            get { return _xPath; }\r\n            set { _xPath = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/CompilerGlobals.cs",
    "content": "using Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler\r\n{\r\n    internal sealed class CompilerGlobals\r\n    {\r\n        public static readonly string DefaultPropertyName = \":default:\";\r\n        public static readonly string FormDefinition_TagName = \"formdefinition\";\r\n        public static readonly string Layout_TagName = \"layout\";\r\n        public static readonly string Bindings_TagName = \"bindings\";\r\n        public static readonly string Binding_TagName = \"binding\";\r\n        public static readonly string Bind_TagName = \"bind\";\r\n        public static readonly string Read_TagName = \"read\";\r\n        public static readonly string IfCondition_TagName = \"ifCondition\";\r\n        public static readonly string IfWhenTrue_TagName = \"ifWhenTrue\";\r\n        public static readonly string IfWhenFalse_TagName = \"ifWhenFalse\";\r\n        public static readonly string RootNamespaceURI = \"http://www.composite.net/ns/management/bindingforms/1.0\";\r\n\r\n\r\n        public static bool IsProducerTag(CompileTreeNode node)\r\n        {\r\n            ElementCompileTreeNode element = node as ElementCompileTreeNode;\r\n\r\n            if (null == element) return false;\r\n\r\n            if (IsElementEmbeddedProperty(element)) return false;\r\n            if (IsReadTag(element)) return false;\r\n            if (IsBindTag(element)) return false;\r\n            if (IsBindingTag(element)) return false;            \r\n            if (IsBindingsTag(element)) return false;\r\n            if (IsLayoutTag(element)) return false;\r\n            if (IsFormDefinitionTag(element)) return false;\r\n\r\n            return true;\r\n        }\r\n\r\n        public static bool IsElementEmbeddedProperty(ElementCompileTreeNode element)\r\n        {\r\n            return element.XmlSourceNodeInformation.Name.Contains(\".\");\r\n        }\r\n\r\n        public static bool IsReadTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == Read_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static bool IsBindTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == Bind_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static bool IsBindingTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == Binding_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static bool IsBindingsTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == Bindings_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static bool IsLayoutTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == Layout_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static bool IsFormDefinitionTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == FormDefinition_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static bool IsElementIfConditionTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == IfCondition_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static bool IsElementIfWhenTrueTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == IfWhenTrue_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static bool IsElementIfWhenFalseTag(ElementCompileTreeNode element)\r\n        {\r\n            return (element.XmlSourceNodeInformation.Name == IfWhenFalse_TagName) && (element.XmlSourceNodeInformation.NamespaceURI == RootNamespaceURI);\r\n        }\r\n\r\n        public static void GetSplittedPropertyNameFromCompositeName(CompileTreeNode node, out string producerName, out string propertyName)\r\n        {\r\n            string[] split = node.XmlSourceNodeInformation.Name.Split('.');\r\n            if (2 != split.Length) throw new FormCompileException(\"Wrong tag format\", node.XmlSourceNodeInformation);\r\n\r\n            producerName = split[0];\r\n            propertyName = split[1];\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/FormTreeCompiler/PropertyAssigner.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompileTreeNodes;\r\nusing Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Validation;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Forms;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.FormTreeCompiler\r\n{\r\n    internal sealed class PropertyAssigner\r\n    {\r\n        public static void AssignPropertiesToProducer(ElementCompileTreeNode element, CompileContext compileContext)\r\n        {\r\n            List<string> requiredPropertyNames;\r\n\r\n            if (element.Producer != null)\r\n            {\r\n                Type producerType = element.Producer.GetType();\r\n\r\n                requiredPropertyNames =\r\n                    (from prop in producerType.GetProperties()\r\n                     where prop.GetCustomAttributes(typeof(RequiredValueAttribute), true).Length > 0\r\n                     select prop.Name).ToList();\r\n            }\r\n            else\r\n            {\r\n                requiredPropertyNames = new List<string>();\r\n            }\r\n\r\n            foreach (PropertyCompileTreeNode namedProperty in element.AllNamedProperties)\r\n            {\r\n                SetPropertyOnProducer(element, namedProperty.Name, namedProperty, compileContext);\r\n                requiredPropertyNames.Remove(namedProperty.Name);\r\n            }\r\n\r\n            foreach (PropertyCompileTreeNode property in element.DefaultProperties)\r\n            {\r\n                string propertyName = GetDefaultPropertyNameOnProducer(element);\r\n                SetPropertyOnProducer(element, propertyName, property, compileContext);\r\n                requiredPropertyNames.Remove(propertyName);\r\n            }\r\n\r\n            if (requiredPropertyNames.Count > 0)\r\n            {\r\n                throw new FormCompileException(string.Format(\"The property named {0} on tag {1} requires a value but have not been assigned a value\", requiredPropertyNames[0], element.XmlSourceNodeInformation.TagName), element.XmlSourceNodeInformation);\r\n            }\r\n        }\r\n\r\n\r\n        private static void SetPropertyOnProducer(ElementCompileTreeNode element, string propertyName, PropertyCompileTreeNode property, CompileContext compileContext)\r\n        {\r\n            SetPropertyOnProducer2(element, propertyName, property, compileContext);\r\n\r\n            IUiControl uiControl = element.Producer as IUiControl;\r\n            if (uiControl != null && property.ClientValidationRules != null)\r\n            {\r\n                if (uiControl.ClientValidationRules != null && uiControl.ClientValidationRules.Count > 0)\r\n                {\r\n                    uiControl.ClientValidationRules.AddRange(property.ClientValidationRules);\r\n                }\r\n                else\r\n                {\r\n                    uiControl.ClientValidationRules = property.ClientValidationRules;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static void SetPropertyOnProducer2(ElementCompileTreeNode element, string propertyName, PropertyCompileTreeNode property, CompileContext compileContext)\r\n        {\r\n            if (property.Value is BaseFunctionRuntimeTreeNode && !(element.Producer is FunctionParameterProducer))\r\n            {\r\n                property.Value = ((BaseFunctionRuntimeTreeNode)property.Value).GetValue();\r\n            }\r\n\r\n            if (property.InclosingProducerName != \"\" &&\r\n                element.XmlSourceNodeInformation.Name != property.InclosingProducerName)\r\n            {\r\n                throw new FormCompileException(string.Format(\"The inclosing tag does not match the embedded property tag name {0}\", propertyName), element, property);\r\n            }\r\n\r\n            Type producerType = element.Producer.GetType();\r\n\r\n            PropertyInfo propertyInfo = producerType.GetProperty(propertyName);\r\n            if (propertyInfo == null)\r\n            {\r\n                if (property.IsNamespaceDeclaration) return; // Ignore it\r\n\r\n                throw new FormCompileException(string.Format(\"The producer {0} does not have property named {1}\", producerType, propertyName), element, property);\r\n            }\r\n\r\n            MethodInfo getMethodInfo = propertyInfo.GetGetMethod();\r\n            if (null == getMethodInfo) throw new FormCompileException(string.Format(\"The producer {0} does not have a public get for the property named {1}\", producerType, propertyName), element, property);\r\n\r\n            bool isReadOrBindProduced = property.Value is BindProducer || property.Value is ReadProducer;\r\n\r\n            if (!isReadOrBindProduced && typeof(IDictionary).IsAssignableFrom(getMethodInfo.ReturnType))\r\n            {\r\n                if (property.Value == null) throw new FormCompileException(string.Format(\"Can not assign null to {0} dictionary\", propertyName), element, property);\r\n                IDictionary dictionary = getMethodInfo.Invoke(element.Producer, null) as IDictionary;\r\n\r\n                if (dictionary == null) throw new InvalidOperationException(string.Format(\"Property '{0}' on '{1}' has not been initialized.\", propertyName, producerType));\r\n\r\n                MethodInfo dictionaryAddMethodInfo = dictionary.GetType().GetMethod(\"Add\");\r\n                ParameterInfo[] dictionaryAddParmInfo = dictionaryAddMethodInfo.GetParameters();\r\n\r\n                Type valueType = property.Value.GetType();\r\n\r\n                if (property.Value is IDictionary)\r\n                {\r\n                    IDictionary values = (IDictionary)property.Value;\r\n                    IDictionaryEnumerator dictionaryEnumerator = values.GetEnumerator();\r\n                    while (dictionaryEnumerator.MoveNext())\r\n                    {\r\n                        dictionary.Add(dictionaryEnumerator.Key, dictionaryEnumerator.Value);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    if (property.Value is DictionaryEntry)\r\n                    {\r\n                        var dictionaryEntry = (DictionaryEntry)property.Value;\r\n                        dictionary.Add(dictionaryEntry.Key, dictionaryEntry.Value);\r\n                    }\r\n                    else\r\n                    {\r\n                        PropertyInfo valueKeyProperty = valueType.GetProperty(\"Key\");\r\n                        PropertyInfo valueValueProperty = valueType.GetProperty(\"Value\");\r\n                        if (valueKeyProperty == null || valueValueProperty == null) throw new FormCompileException(string.Format(\"The type {0} can not be assigned to the The parameter type {0} for the method 'Add' on the return type of the property {1} does not match the value type {2}\", dictionaryAddParmInfo[0].ParameterType.ToString(), propertyName, property.Value.GetType()), element, property);\r\n\r\n                        object dictionaryEntryKey = valueKeyProperty.GetGetMethod().Invoke(property.Value, null);\r\n                        object dictionaryEntryValue = valueValueProperty.GetGetMethod().Invoke(property.Value, null);\r\n                        dictionary.Add(dictionaryEntryKey, dictionaryEntryValue);\r\n                    }\r\n\r\n                }\r\n                return;\r\n            }\r\n            \r\n            if (!isReadOrBindProduced  && typeof(IList).IsAssignableFrom(getMethodInfo.ReturnType))\r\n            {\r\n                IList list = getMethodInfo.Invoke(element.Producer, null) as IList;\r\n\r\n                if (list == null) throw new InvalidOperationException(string.Format(\"Property '{0}' (an IList) on '{1}' has not been initialized.\", propertyName, producerType));\r\n\r\n                MethodInfo listAddMethodInfo = list.GetType().GetMethod(\"Add\");\r\n                ParameterInfo[] listAddParmInfo = listAddMethodInfo.GetParameters();\r\n\r\n\r\n                if (property.Value is IList)\r\n                {\r\n                    IList values = (IList)property.Value;\r\n                    foreach (object value in values)\r\n                    {\r\n                        if (!listAddParmInfo[0].ParameterType.IsInstanceOfType(value))\r\n                        {\r\n                            throw new FormCompileException(string.Format(\r\n                                \"The parameter type {0} for the method 'Add' on the return type of the property {1} does not match the value type {2}\",\r\n                                listAddParmInfo[0].ParameterType, propertyName, property.Value.GetType()),\r\n                                element, property);\r\n                        }\r\n\r\n\r\n                        list.Add(value);\r\n                    }\r\n                    return;\r\n                }\r\n\r\n                if (property.Value != null)\r\n                {\r\n                    if (!listAddParmInfo[0].ParameterType.IsInstanceOfType(property.Value))\r\n                    {\r\n                        throw new FormCompileException(string.Format(\r\n                            \"The parameter type {0} for the method 'Add' on the return type of the property {1} does not match the value type {2}\",\r\n                            listAddParmInfo[0].ParameterType, propertyName, property.Value.GetType()),\r\n                            element, property);\r\n                    }\r\n\r\n                    list.Add(property.Value);\r\n                }\r\n\r\n                return;\r\n            }\r\n\r\n            // Binding values for function parameters\r\n            if (property.Value is ReadProducer && typeof(IList<BaseRuntimeTreeNode>).IsAssignableFrom(getMethodInfo.ReturnType))\r\n            {\r\n                IList list = getMethodInfo.Invoke(element.Producer, null) as IList;\r\n\r\n                object bindingObject;\r\n                \r\n\r\n                string source = (property.Value as ReadProducer).source;\r\n\r\n                if (source.Contains(\".\"))\r\n                {\r\n                    string[] parts = source.Split('.');\r\n\r\n                    ResolvePropertyBinding(element, property, compileContext, parts[0], parts.Skip(1).ToArray(), out bindingObject);\r\n                }\r\n                else\r\n                {\r\n                    Type bindingType;\r\n\r\n                    ResolveBindingObject(element, property, compileContext, source, out bindingObject, out bindingType);\r\n                }\r\n\r\n                list.Add(new ConstantObjectParameterRuntimeTreeNode(\"BindedValue\", bindingObject));\r\n\r\n                return;\r\n            }\r\n\r\n            CheckForMultiblePropertyAdds(element, propertyName, property);\r\n\r\n            MethodInfo setMethodInfo = propertyInfo.GetSetMethod();\r\n            if (null == setMethodInfo) throw new FormCompileException(string.Format(\"The producer {0} does not have a public set for the property named {1}\", producerType, propertyName), element, property);\r\n\r\n            object parm;\r\n            if (null != property.Value)\r\n            {\r\n                if (property.Value is BindProducer)\r\n                {\r\n                    object[] attributes = propertyInfo.GetCustomAttributes(typeof(BindablePropertyAttribute), true);\r\n                    if (attributes.Length == 0) throw new FormCompileException(string.Format(\"The property {0} on the producer {1}, does not have a bind attribute specified\", propertyName, producerType), element, property);\r\n\r\n                    BindProducer bind = (BindProducer)property.Value;\r\n                    string source = bind.source;\r\n\r\n                    EvaluteBinding(element, source, property, compileContext, getMethodInfo, true);\r\n                }\r\n                else if (property.Value is ReadProducer)\r\n                {\r\n                    ReadProducer bind = (ReadProducer)property.Value;\r\n                    string source = bind.source;\r\n\r\n                    EvaluteBinding(element, source, property, compileContext, getMethodInfo, false);\r\n                }\r\n            }\r\n\r\n\r\n            if (property.Value != null && getMethodInfo.ReturnType.IsInstanceOfType(property.Value))\r\n            {\r\n                if (typeof(IEnumerable).IsAssignableFrom(getMethodInfo.ReturnType) && getMethodInfo.ReturnType != typeof(string) && property.Value is string && ((string)property.Value).Length > 0)\r\n                {\r\n                    // common err in form: specify a string, where a binding was expected. Problem with IEnumerable: string is converted to char array - hardly the expected result\r\n                    // this is not a critical, but helpful, check\r\n                    throw new InvalidOperationException(string.Format(\"Unable to cast {0} value '{1}' to type '{2}'\", property.Value.GetType().FullName, property.Value, getMethodInfo.ReturnType.FullName));\r\n                }\r\n\r\n                parm = property.Value;\r\n            }\r\n            else if (property.Value is BaseRuntimeTreeNode)\r\n            {\r\n                if (!(element.Producer is IFunctionProducer))\r\n                {\r\n                    // Handles C1 function in forms markup\r\n                    BaseRuntimeTreeNode baseRuntimeTreeNode = property.Value as BaseRuntimeTreeNode;\r\n\r\n                    object value = baseRuntimeTreeNode.GetValue();\r\n\r\n                    parm = value;\r\n                }\r\n                else\r\n                {\r\n                    parm = property.Value;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                parm = ValueTypeConverter.Convert(property.Value, getMethodInfo.ReturnType);\r\n            }\r\n\r\n            if (element.Producer is LayoutProducer && propertyName == \"UiControl\")\r\n            {\r\n                LayoutProducer layoutProducer = (LayoutProducer)element.Producer;\r\n\r\n                if (layoutProducer.UiControl != null) throw new FormCompileException(string.Format(\"Only one ui control is allow at the top level of the layout.\"), element, property);\r\n            }\r\n\r\n            object[] parms = { parm };\r\n            setMethodInfo.Invoke(element.Producer, parms);\r\n        }\r\n\r\n\r\n\r\n        private static void CheckForMultiblePropertyAdds(ElementCompileTreeNode element, string propertyName, PropertyCompileTreeNode property)\r\n        {\r\n            if (element.AddedProperties.ContainsKey(element.CompilerId))\r\n            {\r\n                XmlSourceNodeInformation foundNode = null;\r\n                PropertyCompileTreeNode node = element.AddedProperties[element.CompilerId].Find(delegate(PropertyCompileTreeNode pctn)\r\n                {\r\n                    if (pctn.Name == propertyName)\r\n                    {\r\n                        foundNode = pctn.XmlSourceNodeInformation;\r\n                        return true;\r\n                    }\r\n                    return false;\r\n                });\r\n\r\n                if (null != node) throw new FormCompileException(string.Format(\"Duplicate '{0}' attributes is not allowed\", propertyName), element.XmlSourceNodeInformation, property.XmlSourceNodeInformation, foundNode);\r\n            }\r\n            else\r\n            {\r\n                element.AddedProperties.Add(element.CompilerId, new List<PropertyCompileTreeNode>());\r\n            }\r\n            element.AddedProperties[element.CompilerId].Add(property);\r\n        }\r\n\r\n\r\n\r\n        private static void EvaluteBinding(ElementCompileTreeNode element, string source, PropertyCompileTreeNode property, CompileContext compileContext, MethodInfo sourceGetMethodInfo, bool makeBinding)\r\n        {\r\n            if (source.Contains(\".\"))\r\n            {\r\n                string[] parts = source.Split('.');\r\n\r\n                EvalutePropertyBinding(element, property, compileContext, sourceGetMethodInfo, parts[0], parts.Skip(1).ToArray(), makeBinding);\r\n            }\r\n            else\r\n            {\r\n                EvaluteObjectBinding(element, property, compileContext, sourceGetMethodInfo, source, makeBinding);\r\n            }\r\n\r\n            IUiControl uiControl; \r\n            if (makeBinding && (uiControl = element.Producer as IUiControl) != null)\r\n            {\r\n                if (uiControl.SourceBindingPaths == null)\r\n                {\r\n                    uiControl.SourceBindingPaths = new List<string>();\r\n                }\r\n\r\n                uiControl.SourceBindingPaths.Add(source);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void EvaluteObjectBinding(ElementCompileTreeNode element, PropertyCompileTreeNode property, CompileContext compileContext, MethodInfo sourceGetMethodInfo, string bindSourceName, bool makeBinding)\r\n        {\r\n            if (makeBinding)\r\n            {\r\n                if (compileContext.IsUniqueSourcePropertyBinding(bindSourceName)) throw new FormCompileException(string.Format(\"{0} binds to {1} which is already property bound. Object bindings to a source object which is property bound is not allowed.\", element.XmlSourceNodeInformation.XPath, bindSourceName), element, property);\r\n\r\n                if (!compileContext.RegisterUniqueSourceObjectBinding(bindSourceName)) throw new FormCompileException(string.Format(\"{0} binds to {1} which is already bound. Multiple bindings to the same source object.\", element.XmlSourceNodeInformation.XPath, bindSourceName), element, property);\r\n            }\r\n\r\n            object bindingObject;\r\n            Type bindType;\r\n\r\n            ResolveBindingObject(element, property, compileContext, bindSourceName, out bindingObject, out bindType);\r\n\r\n            if (makeBinding)\r\n            {\r\n                compileContext.Rebindings.Add(new CompileContext.ObjectRebinding(\r\n                        element.Producer,\r\n                        sourceGetMethodInfo,\r\n                        bindSourceName,\r\n                        bindType)\r\n                    );\r\n            }\r\n\r\n            property.Value = bindingObject;\r\n            property.ClientValidationRules = compileContext.GetBindingsValidationRules(bindSourceName);\r\n        }\r\n\r\n\r\n        private static void ResolveBindingObject(ElementCompileTreeNode element, PropertyCompileTreeNode property, CompileContext compileContext, string bindSourceName,\r\n            out object bindingObject, out Type bindType)\r\n        {\r\n            var bindingProducer = (BindingsProducer) compileContext.BindingsProducer;\r\n            if (bindingProducer == null)\r\n            {\r\n                throw new FormCompileException($\"Failed to resolve binding object {bindSourceName} - the binding producer is null\", element, property);\r\n            }\r\n\r\n            string typeName = bindingProducer.GetTypeNameByName(bindSourceName);\r\n            if (typeName == null)\r\n            {\r\n                throw new FormCompileException($\"{element.XmlSourceNodeInformation.XPath} binds to an undeclared binding name '{bindSourceName}'. All binding names must be declared in /cms:formdefinition/cms:bindings\", element, property);\r\n            }\r\n\r\n            bindType = TypeManager.TryGetType(typeName);\r\n            if (bindType == null)\r\n            {\r\n                throw new FormCompileException($\"The form binding '{bindSourceName}' is declared as an unknown type '{typeName}'\", element, property);\r\n            }\r\n\r\n            bool? optional = bindingProducer.GetOptionalValueByName(bindSourceName);\r\n            bindingObject = compileContext.GetBindingObject(bindSourceName);\r\n\r\n            if (!optional.Value && !compileContext.BindingObjectExists(bindSourceName))\r\n            {\r\n                throw new FormCompileException($\"The binding object named '{bindSourceName}' not found in the input dictionary\", element, property);\r\n            }\r\n\r\n            if (bindingObject != null)\r\n            {\r\n                Type bindingObjectType = bindingObject.GetType();\r\n                if (!bindType.IsAssignableOrLazyFrom(bindingObjectType))\r\n                {\r\n                    throw new FormCompileException($\"The binding object named '{bindSourceName}' from the input dictionary is not of expected type '{bindType.FullName}', but '{bindingObjectType.FullName}'\", element, property);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void ResolvePropertyBinding(\r\n            ElementCompileTreeNode element, PropertyCompileTreeNode property, CompileContext compileContext,\r\n            string bindSourceName, string[] propertyPath,\r\n            out object value \r\n            )\r\n        {\r\n            Type type;\r\n            object propertyOwner;\r\n            string propertyName;\r\n            MethodInfo getMethodInfo, setMethodInfo;\r\n\r\n            ResolvePropertyBinding(element, property, compileContext, bindSourceName, propertyPath, out value, \r\n                out type, out propertyOwner, out propertyName, out getMethodInfo, out setMethodInfo);\r\n        }\r\n\r\n\r\n        private static void ResolvePropertyBinding(\r\n            ElementCompileTreeNode element, PropertyCompileTreeNode property, CompileContext compileContext, string bindSourceName, string[] propertyPath,\r\n                out object value, out Type type, out object propertyOwner, out string propertyName, out MethodInfo getMethodInfo, out MethodInfo setMethodInfo\r\n            )\r\n        {\r\n            string typeName = ((BindingsProducer)compileContext.BindingsProducer).GetTypeNameByName(bindSourceName);\r\n            if (typeName == null)\r\n            {\r\n                throw new FormCompileException(string.Format(\"{1} binds to an undeclared binding name '{0}'. All binding names must be declared in /cms:formdefinition/cms:bindings\", bindSourceName, element.XmlSourceNodeInformation.XPath), element, property);\r\n            }\r\n\r\n            Type bindType = TypeManager.TryGetType(typeName);\r\n            if (bindType == null)\r\n            {\r\n                throw new FormCompileException(string.Format(\"The form binding '{0}' is declared as an unknown type '{1}'\", bindSourceName, typeName), element, property);\r\n            }\r\n\r\n            object bindingObject = compileContext.GetBindingObject(bindSourceName);\r\n            if (bindingObject == null)\r\n            {\r\n                throw new FormCompileException(string.Format(\"The binding object named '{0}' not found in the input dictionary\", bindSourceName), element, property);\r\n            }\r\n\r\n            Type bindingObjectType = bindingObject.GetType();\r\n            if (!bindType.IsAssignableFrom(bindingObjectType)) throw new FormCompileException(string.Format(\"The binding object named '{0}' from the input dictionary is not of expected type '{1}', but '{2}'\", bindSourceName, bindType.FullName, bindingObjectType.FullName), element, property);\r\n\r\n\r\n            propertyName = null;\r\n            getMethodInfo = setMethodInfo = null;\r\n            type = bindType;\r\n            propertyOwner = value = bindingObject;\r\n\r\n            for (int i = 0; i < propertyPath.Length; ++i)\r\n            {\r\n                string name = propertyName = propertyPath[i];\r\n\r\n                PropertyInfo propertyInfo = type.GetPropertiesRecursively(x => x.Name == name).FirstOrDefault();\r\n\r\n                if (propertyInfo == null)\r\n                {\r\n                    throw new FormCompileException(string.Format(\"The type {0} does not have a property named {1}\", type, propertyName), element, property);\r\n                }\r\n\r\n                getMethodInfo = propertyInfo.GetGetMethod();\r\n                if (getMethodInfo == null)\r\n                {\r\n                    throw new FormCompileException(string.Format(\"The type {0} does not have a get property named {1}\", type, propertyName), element, property);\r\n                }\r\n\r\n                setMethodInfo = propertyInfo.GetSetMethod();\r\n\r\n                propertyOwner = value;\r\n\r\n                type = getMethodInfo.ReturnType;\r\n                value = getMethodInfo.Invoke(propertyOwner, null);\r\n            }\r\n        }\r\n\r\n\r\n        private static void EvalutePropertyBinding(ElementCompileTreeNode element, PropertyCompileTreeNode property, CompileContext compileContext, MethodInfo sourceGetMethodInfo, string bindSourceName, string[] propertyPath, bool makeBinding)\r\n        {\r\n            if (makeBinding)\r\n            {\r\n                bool? optional = ((BindingsProducer)compileContext.BindingsProducer).GetOptionalValueByName(bindSourceName);\r\n                if (!optional.HasValue) throw new FormCompileException(string.Format(\"{1} binds to an undeclared binding name '{0}'. All binding names must be declared in /cms:formdefinition/cms:bindings\", bindSourceName, element.XmlSourceNodeInformation.XPath), element, property);\r\n                if (optional.Value) throw new FormCompileException(string.Format(\"Property binding to the optional object named '{0}' is not allowed\", bindSourceName), element, property);\r\n\r\n                if (compileContext.IsUniqueSourceObjectBinding(bindSourceName)) throw new FormCompileException(string.Format(\"{0} binds to {1} which is already object bound. Property bindings to a source object which is object bound is not allowed.\", element.XmlSourceNodeInformation.XPath, bindSourceName), element, property);\r\n\r\n                var uniquePropertyName = new StringBuilder();\r\n                for (int i = 0; i < propertyPath.Length; ++i)\r\n                {\r\n                    uniquePropertyName.Append(propertyPath[i]);\r\n                }\r\n                if (!compileContext.RegisterUniqueSourcePropertyBinding(bindSourceName, uniquePropertyName.ToString())) throw new FormCompileException(string.Format(\"{0} binds to {1} which is already bound. Multiple bindings to the same source object property is not allowed.\", element.XmlSourceNodeInformation.XPath, uniquePropertyName), element, property);\r\n            }\r\n\r\n\r\n            object value, propertyOwner;\r\n            MethodInfo getMethodInfo, setMethodInfo;\r\n            string propertyName;\r\n            Type type;\r\n            ResolvePropertyBinding(element, property, compileContext, bindSourceName, propertyPath, \r\n                                   out value, out type, out propertyOwner, out propertyName, out getMethodInfo, out setMethodInfo);\r\n\r\n            if (makeBinding)\r\n            {\r\n                if (setMethodInfo == null) throw new FormCompileException(string.Format(\"The type {0} does not have a set property named {1}\", type, propertyName), element, property);\r\n\r\n                compileContext.Rebindings.Add(new CompileContext.PropertyRebinding(\r\n                    element.Producer,\r\n                    sourceGetMethodInfo,\r\n                    propertyOwner,\r\n                    setMethodInfo,\r\n                    getMethodInfo.ReturnType,\r\n                    bindSourceName,\r\n                    propertyName));\r\n            }\r\n\r\n            property.Value = value;\r\n\r\n            IUiControl uiControl = element.Producer as IUiControl;\r\n\r\n            if (uiControl != null)\r\n            {\r\n                uiControl.ClientValidationRules = ClientValidationRuleFacade.GetClientValidationRules(propertyOwner, propertyName);\r\n            }\r\n        }\r\n\r\n\r\n        //private static void SetDefaultPropertyOnProducer(ElementCompileTreeNode element, PropertyCompileTreeNode property, CompileContext compileContext)\r\n        //{\r\n        //    string propertyName = GetDefaultPropertyNameOnProducer(element);\r\n\r\n        //    SetPropertyOnProducer(element, propertyName, property, compileContext);\r\n        //}\r\n\r\n\r\n\r\n        private static string GetDefaultPropertyNameOnProducer(ElementCompileTreeNode element)\r\n        {\r\n            Type producerType = element.Producer.GetType();\r\n\r\n            ControlValuePropertyAttribute cvpa = Attribute.GetCustomAttribute(producerType, typeof(ControlValuePropertyAttribute)) as ControlValuePropertyAttribute;\r\n            if (null == cvpa) throw new FormCompileException(string.Format(\"The producer {0} does not have a default property specified\", producerType.ToString()), element.XmlSourceNodeInformation);\r\n\r\n            return cvpa.PropertyName;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/PluginFacades/FunctionFactoryPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Composite.C1Console.Forms.Plugins.FunctionFactory.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.PluginFacades\r\n{\r\n    internal static class FunctionFactoryPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static FunctionFactoryPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IFormFunction GetFunction(string namespaceName, string name)\r\n        {\r\n            string compositeName = string.Format(\"{0}->{1}\", namespaceName, name);\r\n\r\n            if (false == _resourceLocker.Resources.FactoryCache.ContainsKey(compositeName))\r\n            {\r\n                try\r\n                {\r\n                    IFormFunctionFactory formFunctionFactory = _resourceLocker.Resources.Factory.Create(compositeName);\r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (_resourceLocker.Resources.FactoryCache.ContainsKey(compositeName) == false)\r\n                        {\r\n                            _resourceLocker.Resources.FactoryCache.Add(compositeName, formFunctionFactory);\r\n                        }\r\n                    }\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n\r\n                return _resourceLocker.Resources.FactoryCache[compositeName].CreateFunction();\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", FunctionFactorySettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public FunctionFactoryFactory Factory { get; set; }\r\n            public Dictionary<string, IFormFunctionFactory> FactoryCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new FunctionFactoryFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n\r\n                resources.FactoryCache = new Dictionary<string, IFormFunctionFactory>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/PluginFacades/ProducerMediatorPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.Plugins.ProducerMediator;\r\nusing Composite.C1Console.Forms.Plugins.ProducerMediator.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.PluginFacades\r\n{\r\n    internal static class ProducerMediatorPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static ProducerMediatorPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        public static object CreateProducer(IFormChannelIdentifier channel, string namespaceName, string name)\r\n        {\r\n                return GetProducerMediator(namespaceName).CreateProducer(channel, namespaceName, name);\r\n        }\r\n\r\n\r\n        public static object EvaluateProducer(string namespaceName, object producer)\r\n        {\r\n                return GetProducerMediator(namespaceName).EvaluateProducer(producer);\r\n        }\r\n\r\n\r\n        private static IProducerMediator GetProducerMediator(string namespaceName)\r\n        {\r\n            if (false == _resourceLocker.Resources.ProducerMediators.ContainsKey(namespaceName))\r\n            {\r\n                try\r\n                {\r\n                    IProducerMediator producerMediator = _resourceLocker.Resources.Factory.Create(namespaceName);\r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (_resourceLocker.Resources.ProducerMediators.ContainsKey(namespaceName) == false)\r\n                            _resourceLocker.Resources.ProducerMediators.Add(namespaceName, producerMediator);\r\n                    }\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n            return _resourceLocker.Resources.ProducerMediators[namespaceName];\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", ProducerMediatorSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public ProducerMediatorFactory Factory { get; set; }\r\n            public Dictionary<string, IProducerMediator> ProducerMediators { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new ProducerMediatorFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProducerMediators = new Dictionary<string, IProducerMediator>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/PluginFacades/UiControlFactoryPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation.PluginFacades\r\n{\r\n    internal static class UiControlFactoryPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static UiControlFactoryPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        public static IUiControl CreateControl(IFormChannelIdentifier channel, string namespaceName, string name)\r\n        {\r\n            string compositeName = string.Format(\"{0}->{1}->{2}\", channel.ChannelName, namespaceName, name);\r\n\r\n            if (false == _resourceLocker.Resources.FactoryCache.ContainsKey(compositeName))\r\n            {\r\n                try\r\n                {\r\n                    IUiControlFactory uiControlFactory = _resourceLocker.Resources.Factory.Create(compositeName);                    \r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (_resourceLocker.Resources.FactoryCache.ContainsKey(compositeName) == false)\r\n                        {\r\n                            _resourceLocker.Resources.FactoryCache.Add(compositeName, uiControlFactory);\r\n                        }\r\n                    }\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleControlConfigurationError(ex, compositeName);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleControlConfigurationError(ex, compositeName);\r\n                }\r\n            }\r\n\r\n\r\n            IUiControlFactory factory = _resourceLocker.Resources.FactoryCache[compositeName];\r\n            IUiControl control = factory.CreateControl();\r\n            control.UiControlChannel = channel;\r\n            return control;\r\n        }\r\n\r\n\r\n        public static void GetDebugControlName(IFormChannelIdentifier channel, out string debugControlNamespace, out string debugControlName)\r\n        {\r\n            if (null == ConfigurationServices.ConfigurationSource)\r\n            {\r\n                throw new ConfigurationErrorsException(\"Missing configuration\");\r\n            }\r\n\r\n\r\n            UiControlFactorySettings settings = ConfigurationServices.ConfigurationSource.GetSection(UiControlFactorySettings.SectionName) as UiControlFactorySettings;\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", UiControlFactorySettings.SectionName));\r\n            }\r\n\r\n\r\n            try\r\n            {\r\n                debugControlNamespace = settings.Channels[channel.ChannelName].DebugControlNamespace;\r\n                debugControlName = settings.Channels[channel.ChannelName].DebugControlName;\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The channel {0} is missing from the configuration\", channel.ChannelName), e);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", UiControlFactorySettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private static void HandleControlConfigurationError(Exception ex, string controlCompositeName)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration for IUiControlFactory '{0}'.\", controlCompositeName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public UiControlFactoryFactory Factory { get; set; }\r\n            public Dictionary<string, IUiControlFactory> FactoryCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new UiControlFactoryFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.FactoryCache = new Dictionary<string, IUiControlFactory>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Foundation/UiControl.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class UiControl : IUiControl\r\n    {\r\n        private string _label = \"\";\r\n        private string _help = \"\";\r\n\r\n\r\n        /// <exclude />\r\n        public UiControl()\r\n        {\r\n            this.SourceBindingPaths = new List<string>();\r\n        }\r\n\r\n        /// <summary>\r\n        /// The unique and permanent ID of the UiControl instance.\r\n        /// </summary>\r\n        public string UiControlID { get; set; }\r\n\r\n        /// <summary>\r\n        /// The channel name of the UiControl instance.\r\n        /// </summary>\r\n        public IFormChannelIdentifier UiControlChannel { get; set; }\r\n\r\n        /// <summary>\r\n        /// The label of the UiControl. Containers may use this value when applying layout to a list of UiControls.\r\n        /// </summary>\r\n        [FormsProperty()]\r\n        public virtual string Label\r\n        {\r\n            get { return _label; }\r\n            set { _label = value; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Short context sensitive help relevant to the control.\r\n        /// </summary>\r\n        [FormsProperty()]\r\n        public virtual string Help\r\n        {\r\n            get { return _help; }\r\n            set { _help = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<ClientValidationRule> ClientValidationRules\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <summary>\r\n        /// When invoked, UiControl Properies that expose bindable data must be updated to reflect user induced state.\r\n        /// I.e. the Text property of a TextBox UiControl should be assigned the Text property of it's inner control, so\r\n        /// the Composite.C1Console.Forms Manager can access the users input. \r\n        /// </summary>\r\n        public virtual void BindStateToControlProperties()\r\n        { }\r\n\r\n\r\n        /// <summary>\r\n        /// A (short) message to the user relating to this control, typically information about missing or \r\n        /// bad input.\r\n        /// </summary>\r\n        public List<string> SourceBindingPaths { get; set; }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/IFormChannelIdentifier.cs",
    "content": "﻿\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFormChannelIdentifier\r\n    {\r\n        /// <exclude />\r\n        string ChannelName { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/ITestAutomationLocatorInformation.cs",
    "content": "﻿namespace Composite.C1Console.Forms\n{\n    /// <exclude />\n    public interface ITestAutomationLocatorInformation\n    {\n        /// <exclude />\n        string TestAutomationLocator { get; }\n    }\n}\n"
  },
  {
    "path": "Composite/C1Console/Forms/IUiControl.cs",
    "content": "using Composite.Data.Validation.ClientValidationRules;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IUiControl\r\n    {\r\n        /// <summary>\r\n        /// UiControls are automatically assigned a unique and permanent UiControlID by the Composite.C1Console.Forms Manager. \r\n        /// Use the UiControlID to uniquely identify a UiControl instance between build ups.\r\n        /// </summary>\r\n        string UiControlID { get; set; }\r\n\r\n        /// <summary>\r\n        /// UiControls are automatically assigned the name of the channel they are executed within. \r\n        /// You can use the channel name when compiling embedded forms.\r\n        /// </summary>\r\n        IFormChannelIdentifier UiControlChannel { get; set; }\r\n\r\n        /// <summary>\r\n        /// UiControl labels are used by most containers to label the control.\r\n        /// </summary>\r\n        string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// UiControl help strings are used by most containers to add context sensitive help to the control.\r\n        /// </summary>\r\n        string Help { get; set; }\r\n\r\n        /// <summary>\r\n        /// UiControls can use these validation rules to perform client side validaion\r\n        /// </summary>\r\n        List<ClientValidationRule> ClientValidationRules { get; set; }\r\n\r\n        /// <summary>\r\n        /// When invoked, UiControl Properies that expose bindable data must be updated to reflect user induced state.\r\n        /// I.e. the Text property of a TextBox UiControl should be assigned the Text property of it's inner control, so\r\n        /// the Composite.C1Console.Forms Manager can access the users input. \r\n        /// </summary>\r\n        void BindStateToControlProperties();\r\n\r\n        /// <summary>\r\n        /// The \"path to the source\" that is bound to this control - i.e. the value written in the \"source\" property in the form markup.\r\n        /// </summary>\r\n        List<string> SourceBindingPaths { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/IValidatingUiControl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>\r\n    /// UiControls can be in a situation where user input can not be converted to the type the control is binding to. \r\n    /// Rather than throwing an exception, the control can declare that is is in an invalid state and give a message. \r\n    /// This allow the core to abort saving etc. \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public interface IValidatingUiControl : IUiControl\r\n    {\r\n        /// <summary>\r\n        /// This field declare is your control is in a valid state. \r\n        /// If this returns true, actions like Save and Preview will be canceled.\r\n        /// </summary>\r\n        bool IsValid { get; }\r\n\r\n        /// <summary>\r\n        /// When in an invalid state this field is expected to describe the reason for this invalid state. The text is intended\r\n        /// for the end-user and should explain what they did wrong, like \"Date format is invalid, use 'yyyy-mm-dd'\".\r\n        /// </summary>\r\n        string ValidationError { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/FunctionFactory/FunctionFactoryData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.FunctionFactory\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(NonConfigurableFunctionFactory))]\r\n    public class FunctionFactoryData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/FunctionFactory/IFormFunction.cs",
    "content": "namespace Composite.C1Console.Forms.Plugins.FunctionFactory\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFormFunction\r\n    {\r\n        /// <exclude />\r\n        object Execute();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/FunctionFactory/IFunctionFactory.cs",
    "content": "using Composite.C1Console.Forms.Plugins.FunctionFactory.Runtime;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.FunctionFactory\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [CustomFactory(typeof(FunctionFactoryCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(FunctionFactoryDefaultNameRetriever))]\r\n    public interface IFormFunctionFactory\r\n    {\r\n        /// <exclude />\r\n        IFormFunction CreateFunction();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/FunctionFactory/NonConfigurableFunctionFactory.cs",
    "content": "using Microsoft.Practices.ObjectBuilder;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.FunctionFactory\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Assembler(typeof(NonConfigurableFunctionFactoryAssembler))]\r\n    public sealed class NonConfigurableFunctionFactory : FunctionFactoryData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    internal sealed class NonConfigurableFunctionFactoryAssembler : IAssembler<IFormFunctionFactory, FunctionFactoryData>\r\n    {\r\n        public IFormFunctionFactory Assemble(IBuilderContext context, FunctionFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IFormFunctionFactory)Activator.CreateInstance(objectConfiguration.Type);            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/FunctionFactory/Runtime/FunctionFactoryCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.FunctionFactory.Runtime\r\n{\r\n    internal sealed class FunctionFactoryCustomFactory : AssemblerBasedCustomFactory<IFormFunctionFactory, FunctionFactoryData>\r\n    {\r\n        protected override FunctionFactoryData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            FunctionFactorySettings settings = configurationSource.GetSection(FunctionFactorySettings.SectionName) as FunctionFactorySettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", FunctionFactorySettings.SectionName));\r\n            }\r\n\r\n            int index = name.IndexOf(\"->\");\r\n\r\n            string namespaceName = name.Substring(0, index);\r\n            string tag = name.Substring(index + 2);\r\n\r\n\r\n            NamespaceConfigurationElement namespaceElement = settings.Namespaces[namespaceName];\r\n            if (null == namespaceElement) throw new ConfigurationErrorsException(string.Format(\"The namespace {0} is missing from the configuration\", namespaceName));\r\n\r\n            return namespaceElement.Factories.Get(tag);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/FunctionFactory/Runtime/FunctionFactoryDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.FunctionFactory.Runtime\r\n{\r\n    internal sealed class FunctionFactoryDefaultNameRetriever : IConfigurationNameMapper \r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/FunctionFactory/Runtime/FunctionFactoryFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.FunctionFactory.Runtime\r\n{\r\n    internal sealed class FunctionFactoryFactory : NameTypeFactoryBase<IFormFunctionFactory>\r\n    {\r\n        public FunctionFactoryFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/FunctionFactory/Runtime/FunctionFactorySettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.FunctionFactory.Runtime\r\n{\r\n    internal sealed class FunctionFactorySettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Forms.Plugins.FunctionFactoryConfiguration\";\r\n\r\n        private const string _namespacesProperty = \"Namespaces\";\r\n        [ConfigurationProperty(_namespacesProperty, IsRequired = true)]\r\n        public NamespaceConfigurationElementCollection Namespaces\r\n        {\r\n            get\r\n            {\r\n                return (NamespaceConfigurationElementCollection)base[_namespacesProperty];\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class NamespaceConfigurationElement : NamedConfigurationElement\r\n    {       \r\n        private const string _factoriesPropertyName = \"Factories\";\r\n        [ConfigurationProperty(_factoriesPropertyName, IsRequired=true)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<FunctionFactoryData> Factories\r\n        {\r\n            get { return (NameTypeManagerTypeConfigurationElementCollection<FunctionFactoryData>)base[_factoriesPropertyName]; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class NamespaceConfigurationElementCollection : ConfigurationElementCollection\r\n    {\r\n        public NamespaceConfigurationElementCollection()\r\n        {\r\n            AddElementName = \"Namespace\";\r\n        }\r\n\r\n        public void Add(NamespaceConfigurationElement element)\r\n        {\r\n            BaseAdd(element);\r\n        }\r\n\r\n        new public NamespaceConfigurationElement this[string Name]\r\n        {\r\n            get\r\n            {\r\n                return (NamespaceConfigurationElement)BaseGet(Name);\r\n            }\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new NamespaceConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            return (element as NamespaceConfigurationElement).Name;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/ProducerMediator/IProducerMediator.cs",
    "content": "using Composite.C1Console.Forms.Plugins.ProducerMediator.Runtime;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.ProducerMediator\r\n{\r\n    [CustomFactory(typeof(ProducerMediatorCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(ProducerMediatorDefaultNameRetriever))]\r\n    internal interface IProducerMediator\r\n    {\r\n        object CreateProducer(IFormChannelIdentifier channel, string namespaceName, string name);\r\n        object EvaluateProducer(object producer);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/ProducerMediator/NonConfigurableProducerMediator.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.ProducerMediator\r\n{\r\n    [Assembler(typeof(NonConfigurableProducerMediatorAssembler))]\r\n    internal sealed class NonConfigurableProducerMediator : ProducerMediatorData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableProducerMediatorAssembler : IAssembler<IProducerMediator, ProducerMediatorData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IProducerMediator Assemble(IBuilderContext context, ProducerMediatorData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IProducerMediator)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/ProducerMediator/ProducerMediatorData.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.ProducerMediator\r\n{\r\n    internal class ProducerMediatorData : NameTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/ProducerMediator/Runtime/ProducerMediatorCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.ProducerMediator.Runtime\r\n{\r\n    internal sealed class ProducerMediatorCustomFactory : AssemblerBasedCustomFactory<IProducerMediator, ProducerMediatorData>\r\n    {\r\n        protected override ProducerMediatorData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ProducerMediatorSettings settings = configurationSource.GetSection(ProducerMediatorSettings.SectionName) as ProducerMediatorSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ProducerMediatorSettings.SectionName));\r\n            }\r\n\r\n            return settings.Mediators.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/ProducerMediator/Runtime/ProducerMediatorDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.ProducerMediator.Runtime\r\n{\r\n    internal sealed class ProducerMediatorDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/ProducerMediator/Runtime/ProducerMediatorFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.ProducerMediator.Runtime\r\n{\r\n    internal sealed class ProducerMediatorFactory : NameTypeFactoryBase<IProducerMediator>\r\n    {\r\n        public ProducerMediatorFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/ProducerMediator/Runtime/ProducerMediatorSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.ProducerMediator.Runtime\r\n{\r\n    internal sealed class ProducerMediatorSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Forms.Plugins.ProducerMediatorConfiguration\";\r\n\r\n        private const string _mediatorsPropertyName = \"Mediators\";\r\n        [ConfigurationProperty(_mediatorsPropertyName)]\r\n        public NameTypeConfigurationElementCollection<ProducerMediatorData, ProducerMediatorData> Mediators\r\n        {\r\n            get { return (NameTypeConfigurationElementCollection<ProducerMediatorData, ProducerMediatorData>)base[_mediatorsPropertyName]; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/UiControlFactory/IUiControlFactory.cs",
    "content": "using Composite.C1Console.Forms.Plugins.UiControlFactory.Runtime;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.UiControlFactory\r\n{\r\n    [CustomFactory(typeof(UiControlFactoryCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(UiControlFactoryDefaultNameRetriever))]\r\n    internal interface IUiControlFactory\r\n    {\r\n        IUiControl CreateControl();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/UiControlFactory/NonConfigurableUiControlFactoryAssembler.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.UiControlFactory\r\n{\r\n    internal sealed class NonConfigurableUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IUiControlFactory)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/UiControlFactory/Runtime/UiControlFactoryCustomFactory.cs",
    "content": "using System;\r\nusing System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.UiControlFactory.Runtime\r\n{\r\n    internal sealed class UiControlFactoryCustomFactory : AssemblerBasedCustomFactory<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        protected override UiControlFactoryData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            UiControlFactorySettings settings = configurationSource.GetSection(UiControlFactorySettings.SectionName) as UiControlFactorySettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", UiControlFactorySettings.SectionName));\r\n            }\r\n\r\n            int index1 = name.IndexOf(\"->\");\r\n            int index2 = name.IndexOf(\"->\", index1 + 1);\r\n\r\n            string channelName = name.Substring(0, index1);\r\n            string namespaceName = name.Substring(index1 + 2, index2 - index1 - 2);\r\n            string tag = name.Substring(index2 + 2);\r\n\r\n            ChannelConfigurationElement channelElement = settings.Channels[channelName];\r\n            if (null == channelElement) throw new ConfigurationErrorsException(string.Format(\"The channel {0} is missing from the configuration\", channelName));\r\n\r\n            NamespaceConfigurationElement namespaceElement = channelElement.Namespaces[namespaceName];\r\n            if (null == namespaceElement) throw new ConfigurationErrorsException(string.Format(\"The namespace {0} is missing from the configuration of channel {1}\", namespaceName, channelName));\r\n\r\n            return namespaceElement.Factories.Get(tag);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/UiControlFactory/Runtime/UiControlFactoryDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.UiControlFactory.Runtime\r\n{\r\n    internal sealed class UiControlFactoryDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/UiControlFactory/Runtime/UiControlFactoryFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.UiControlFactory.Runtime\r\n{\r\n    internal sealed class UiControlFactoryFactory : NameTypeFactoryBase<IUiControlFactory>\r\n    {\r\n        public UiControlFactoryFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/UiControlFactory/Runtime/UiControlFactorySettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.UiControlFactory.Runtime\r\n{\r\n    internal sealed class UiControlFactorySettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Forms.Plugins.UiControlFactoryConfiguration\";\r\n\r\n\r\n        private const string _channelsProperty = \"Channels\";\r\n        [ConfigurationProperty(_channelsProperty, IsRequired = true)]\r\n        public ChannelConfigurationElementCollection Channels\r\n        {\r\n            get\r\n            {\r\n                return (ChannelConfigurationElementCollection)base[_channelsProperty];\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class NamespaceConfigurationElement : NamedConfigurationElement\r\n    {\r\n        private const string _factoriesPropertyName = \"Factories\";\r\n        [ConfigurationProperty(_factoriesPropertyName, IsRequired = true)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<UiControlFactoryData> Factories\r\n        {\r\n            get { return (NameTypeManagerTypeConfigurationElementCollection<UiControlFactoryData>)base[_factoriesPropertyName]; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class NamespaceConfigurationElementCollection : ConfigurationElementCollection\r\n    {\r\n        public NamespaceConfigurationElementCollection()\r\n            : base()\r\n        {\r\n            AddElementName = \"Namespace\";\r\n        }\r\n\r\n        public void Add(NamedConfigurationElement element)\r\n        {\r\n            BaseAdd(element);\r\n        }\r\n\r\n        new public NamespaceConfigurationElement this[string Name]\r\n        {\r\n            get\r\n            {\r\n                return (NamespaceConfigurationElement)BaseGet(Name);\r\n            }\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new NamespaceConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            return (element as NamespaceConfigurationElement).Name;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class ChannelConfigurationElement : NamedConfigurationElement\r\n    {\r\n        private const string _debugControlNamespacePropertyName = \"debugControlNamespace\";\r\n        [ConfigurationProperty(_debugControlNamespacePropertyName, IsRequired = true)]\r\n        public string DebugControlNamespace\r\n        {\r\n            get { return (string)base[_debugControlNamespacePropertyName]; }\r\n            set { base[_debugControlNamespacePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _debugControlNamePropertyName = \"debugControlName\";\r\n        [ConfigurationProperty(_debugControlNamePropertyName, IsRequired = true)]\r\n        public string DebugControlName\r\n        {\r\n            get { return (string)base[_debugControlNamePropertyName]; }\r\n            set { base[_debugControlNamePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _namespacesProperty = \"Namespaces\";\r\n        [ConfigurationProperty(_namespacesProperty, IsRequired = true)]\r\n        public NamespaceConfigurationElementCollection Namespaces\r\n        {\r\n            get\r\n            {\r\n                return (NamespaceConfigurationElementCollection)base[_namespacesProperty];\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class ChannelConfigurationElementCollection : ConfigurationElementCollection\r\n    {\r\n        public ChannelConfigurationElementCollection()\r\n            : base()\r\n        {\r\n            AddElementName = \"Channel\";\r\n        }\r\n\r\n        public void Add(ChannelConfigurationElement channelConfigurationElement)\r\n        {\r\n            BaseAdd(channelConfigurationElement);\r\n        }\r\n\r\n        new public ChannelConfigurationElement this[string Name]\r\n        {\r\n            get\r\n            {\r\n                return (ChannelConfigurationElement)BaseGet(Name);\r\n            }\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new ChannelConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            return (element as ChannelConfigurationElement).Name;\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/Plugins/UiControlFactory/UiControlFactoryData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.Plugins.UiControlFactory\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableUiControlFactoryAssembler))]\r\n    internal class UiControlFactoryData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/ReadBindingControlValueOverload.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>\r\n    /// If the \"inner value\" is a bindings read, then this defines an property that will be assigned to.\r\n    /// This is an overload/special case handling of <see cref=\"ControlValuePropertyAttribute\"/>\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class ReadBindingControlValueOverload : Attribute\r\n    {\r\n        public ReadBindingControlValueOverload(string propertyName)\r\n        {\r\n            this.PropertyName = propertyName;\r\n        }\r\n\r\n        public string PropertyName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/RequiredValueAttribute.cs",
    "content": "using System;\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <exclude />\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple=false, Inherited=true)]\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class RequiredValueAttribute : Attribute\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/SchemaBuilder.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Forms\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class SchemaInfo\r\n    {\r\n        /// <exclude />\r\n        public enum FormSchemaType\r\n\t    {\r\n            /// <exclude />\r\n            Uicontrols = 0,\r\n\r\n            /// <exclude />\r\n            Functions = 1\r\n\t    }\r\n\r\n        internal SchemaInfo(IFormChannelIdentifier channelIdentifier, XNamespace namespaceObj, XDocument schema)\r\n        {\r\n            this.ChannelIdentifier = channelIdentifier;\r\n            this.Namespace = namespaceObj;\r\n            this.Schema = schema;\r\n            this.SchemaType = FormSchemaType.Uicontrols;\r\n        }\r\n\r\n        internal SchemaInfo(XNamespace namespaceObj, XDocument schema)\r\n        {\r\n            this.Namespace = namespaceObj;\r\n            this.Schema = schema;\r\n            this.SchemaType = FormSchemaType.Functions;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IFormChannelIdentifier ChannelIdentifier { get; private set; }\r\n\r\n        /// <exclude />\r\n        public XNamespace Namespace { get; private set; }\r\n\r\n        /// <exclude />\r\n        public XDocument Schema { get; private set; }\r\n\r\n        /// <exclude />\r\n        public FormSchemaType SchemaType { get; private set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class SchemaBuilder\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<SchemaInfo> GenerateAllDynamicSchemas()\r\n        {\r\n            List<SchemaInfo> generatedSchemas = new List<SchemaInfo>();\r\n\r\n            ElementInformationExtractor worker = new ElementInformationExtractor(ConfigurationServices.FileConfigurationSourcePath);\r\n\r\n            var channels = from c in worker.GetUiControlDescriptors()\r\n                           group c by c.ChannelName into g\r\n                           select g;\r\n\r\n            foreach (var channel in channels)\r\n            {\r\n                var xmlnss = from c in channel\r\n                             group c by c.NamespaceName into g\r\n                             select g;\r\n                foreach (var xmlns in xmlnss)\r\n                {\r\n                    XDocument schema = worker.GetXsd( xmlns, xmlns.Key);\r\n\r\n                    generatedSchemas.Add(new SchemaInfo(new ChannelIdentifier(channel.Key), xmlns.Key, schema));\r\n                }\r\n            }\r\n\r\n\r\n            var namespaceBasedFunctionLookup = \r\n                from c in worker.GetFunctionDescriptors()\r\n                group c by c.NamespaceName into g\r\n                select g;\r\n\r\n            foreach (var xmlns in namespaceBasedFunctionLookup)\r\n            {\r\n                XDocument schema = worker.GetXsd(xmlns, xmlns.Key);\r\n\r\n                generatedSchemas.Add(new SchemaInfo(xmlns.Key, schema));\r\n            }\r\n\r\n            return generatedSchemas;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XDocument GenerateUiControlSchema(IFormChannelIdentifier channelIdentifier, XNamespace controlNamespace)\r\n        {\r\n            Dictionary<XNamespace, XDocument> schemas = new Dictionary<XNamespace, XDocument>();\r\n\r\n            ElementInformationExtractor worker = new ElementInformationExtractor(ConfigurationServices.FileConfigurationSourcePath);\r\n\r\n            var elementDescriptors =\r\n                from descriptor in worker.GetUiControlDescriptors()\r\n                where descriptor.ChannelName == channelIdentifier.ChannelName && descriptor.NamespaceName == controlNamespace\r\n                select descriptor;\r\n\r\n            return worker.GetXsd(elementDescriptors, controlNamespace);\r\n        }\r\n\r\n        private class ChannelIdentifier : IFormChannelIdentifier\r\n        {\r\n            public ChannelIdentifier(string name)\r\n            {\r\n                this.ChannelName = name;\r\n            }\r\n\r\n            public string ChannelName { get; private set; }\r\n        }\r\n\r\n\r\n        private class ElementInformationExtractor\r\n        {\r\n            private string configurationFilePath;\r\n            private List<string> UiContolNs;\r\n            private List<string> FunctionNs;\r\n            private XDocument configDoc;\r\n            public string OutputDir { get; set; }\r\n\r\n            internal IEnumerable<ElementDescriptor> GetUiControlDescriptors()\r\n            {\r\n\r\n\r\n                var uiControlConfigRoot = configDoc.Descendants(\"Composite.C1Console.Forms.Plugins.UiControlFactoryConfiguration\").Single();\r\n\r\n                var controlInfos = from controlElement in uiControlConfigRoot.Descendants(\"add\")\r\n                                   select new\r\n                                   {\r\n                                       Name = controlElement.Attribute(\"name\").Value,\r\n                                       NamespaceName = controlElement.Parent.Parent.Attribute(\"name\").Value,\r\n                                       ChannelName = controlElement.Parent.Parent.Parent.Parent.Attribute(\"name\").Value\r\n                                   };\r\n\r\n                return\r\n                    from controlInfo in controlInfos\r\n                    select new ElementDescriptor\r\n                    {\r\n                        ChannelName = controlInfo.ChannelName,\r\n                        NamespaceName = controlInfo.NamespaceName,\r\n                        Name = controlInfo.Name,\r\n                        ElementType = Composite.C1Console.Forms.FormFactoryService.CreateControl(controlInfo.ChannelName, controlInfo.NamespaceName, controlInfo.Name).GetType()\r\n                    };\r\n\r\n            }\r\n\r\n            public ElementInformationExtractor(string configurationFilePath)\r\n            {\r\n                this.configurationFilePath = configurationFilePath;\r\n                configDoc = XDocumentUtils.Load(configurationFilePath);\r\n\r\n                //Quick code for nameSpaces\r\n                UiContolNs = (from c in GetUiControlDescriptors()\r\n                              group c by c.NamespaceName into g\r\n                              select g.Key).ToList();\r\n                FunctionNs = (from c in GetFunctionDescriptors()\r\n                              group c by c.NamespaceName into g\r\n                              select g.Key).ToList();\r\n            }\r\n\r\n            private XElement GetXsdSequence(PropertyInfo property, XNamespace xsd, XNamespace targetNamespace)\r\n            {\r\n\r\n                var isContainer = typeof(List<Composite.C1Console.Forms.IUiControl>) == property.PropertyType\r\n                                || typeof(System.Object) == property.PropertyType;\r\n                return new XElement(xsd + \"sequence\",\r\n                            (property.PropertyType.GetInterface(\"IList\") != null)\r\n                            ? new XAttribute(\"maxOccurs\", \"unbounded\")\r\n                            : new XAttribute(\"maxOccurs\", \"1\"),\r\n                            new XAttribute(\"minOccurs\", \"0\"),\r\n                            new XElement(xsd + \"choice\",\r\n                    // if Element is bindable\r\n                                ((property.GetCustomAttributes(typeof(Composite.C1Console.Forms.BindablePropertyAttribute), true)).Count() > 0) ?\r\n\r\n                                new XElement(xsd + \"element\",\r\n                                   new XAttribute(\"ref\", \"cms:bind\")\r\n                                ) : null,\r\n                                new XElement(xsd + \"element\",\r\n                                   new XAttribute(\"ref\", \"cms:read\")\r\n                                ),\r\n\r\n                                //UiControls\r\n                                isContainer ?\r\n                                new XElement(xsd + \"group\",\r\n                                    new XAttribute(\"ref\", \"ElementList\")\r\n                                ) : null,\r\n\r\n                                //Other UiControls\r\n                                isContainer ?\r\n                                from ns in UiContolNs\r\n                                where ns != targetNamespace.NamespaceName\r\n                                select new XElement(xsd + \"any\",\r\n                                   new XAttribute(\"namespace\", ns)\r\n                                )\r\n                                : null,\r\n\r\n                                //Functions\r\n                                from ns in FunctionNs\r\n                                where ns != targetNamespace.NamespaceName\r\n                                select new XElement(xsd + \"any\",\r\n                                   new XAttribute(\"namespace\", ns)\r\n                                )\r\n\r\n\r\n                            )\r\n               );\r\n\r\n\r\n\r\n            }\r\n\r\n            private XElement GetXsdContolValue(ElementDescriptor element, XNamespace xsd, XNamespace targetNamespace)\r\n            {\r\n                try\r\n                {\r\n                    ControlValuePropertyAttribute controlValue = (ControlValuePropertyAttribute)(element.ElementType.GetCustomAttributes(typeof(ControlValuePropertyAttribute), true).First());\r\n                    return GetXsdSequence(element.ElementType.GetProperty(controlValue.PropertyName), xsd, targetNamespace);\r\n                }\r\n                catch (Exception)\r\n                {\r\n\r\n                }\r\n                return null;\r\n\r\n            }\r\n\r\n            private XAttribute GetXsdAttributeType(PropertyInfo property)\r\n            {\r\n\r\n\r\n                if (property.PropertyType == typeof(int))\r\n                {\r\n                    return new XAttribute(\"type\", \"xsd:int\");\r\n                }\r\n                if (property.PropertyType == typeof(Boolean))\r\n                {\r\n                    return new XAttribute(\"type\", \"xsd:boolean\");\r\n                }\r\n                return new XAttribute(\"type\", \"xsd:string\");\r\n            }\r\n\r\n\r\n            /// <summary>\r\n            /// Generate XSD file by  List of ElementDescriptor\r\n            /// </summary>\r\n            /// <param name=\"xmlns\">List of ElementDescriptor </param>\r\n            /// <param name=\"targetNamespace\">Namespace</param>\r\n            /// <returns>XSD File</returns>\r\n            public XDocument GetXsd(IEnumerable<ElementDescriptor> xmlns, XNamespace targetNamespace/*, List<string> functionNss*/)\r\n            {\r\n                XNamespace xsd = \"http://www.w3.org/2001/XMLSchema\";\r\n\r\n                var controlsList = from element in xmlns\r\n                                   select new XElement(xsd + \"element\",\r\n                                       new XAttribute(\"name\", element.Name),\r\n                                       new XAttribute(\"type\", element.Name)\r\n                                   );\r\n                XDocument doc = new XDocument(\r\n\r\n                    new XDeclaration(\"1.0\", \"utf-8\", \"yes\"),\r\n\r\n                    new XElement(xsd + \"schema\",\r\n                        new XAttribute(XNamespace.Xmlns + \"xsd\", xsd.NamespaceName),\r\n                        new XAttribute(XNamespace.Xmlns + \"cms\", \"http://www.composite.net/ns/management/bindingforms/1.0\"),\r\n                        new XAttribute(\"targetNamespace\", targetNamespace.NamespaceName),\r\n                        new XAttribute(\"xmlns\", targetNamespace.NamespaceName),\r\n                        new XAttribute(\"elementFormDefault\", \"qualified\"),\r\n                        new XElement(xsd + \"import\",\r\n                            new XAttribute(\"namespace\", \"http://www.w3.org/XML/1998/namespace\")//,\r\n                            //new XAttribute(\"schemaLocation\", \"xml.xsd\")\r\n                        ),\r\n                        new XElement(xsd + \"import\",\r\n                            new XAttribute(\"namespace\", \"http://www.composite.net/ns/management/bindingforms/1.0\"),\r\n                            new XAttribute(\"schemaLocation\", \"bindingforms10.xsd\")\r\n                        ),\r\n                        controlsList,\r\n\r\n                        new XElement(xsd + \"group\",\r\n                            new XAttribute(\"name\", \"ElementList\"),\r\n                            new XElement(xsd + \"sequence\",\r\n                                new XElement(xsd + \"choice\",\r\n                                    new XAttribute(\"minOccurs\", \"0\"),\r\n                                    controlsList\r\n\r\n                                )\r\n                            )\r\n\r\n                        ),\r\n\r\n\r\n                        from element in xmlns\r\n                        select new XElement(\r\n                             xsd + \"complexType\",\r\n                             new XAttribute(\"name\", element.Name),\r\n                             new XAttribute(\"mixed\", \"true\"),\r\n                             new XElement(xsd + \"sequence\",\r\n                                 new XAttribute(\"maxOccurs\", \"unbounded\"),\r\n                                 new XAttribute(\"minOccurs\", \"0\"),\r\n                                 (element.ElementType.GetProperties().Where( f=> f.GetCustomAttributes(typeof(FormsPropertyAttribute), true).Any()).Any()) ?\r\n                                     new XElement(xsd + \"choice\",\r\n                                        from property in element.ElementType.GetProperties()\r\n                                        where property.CanWrite && property.GetCustomAttributes(typeof(FormsPropertyAttribute), true).Any()\r\n                                        select new XElement(xsd + \"element\",\r\n                                            new XAttribute(\"name\", element.Name + \".\" + property.Name),\r\n                                            new XElement(xsd + \"complexType\",\r\n                                                new XAttribute(\"mixed\", \"true\"),\r\n                                                GetXsdSequence(property, xsd, targetNamespace)\r\n                                            )\r\n\r\n                                        ),\r\n                                        GetXsdContolValue(element, xsd, targetNamespace)\r\n\r\n\r\n                                ) : null\r\n\r\n                             ),\r\n\r\n                             from property in element.ElementType.GetProperties()\r\n                             where property.CanWrite && property.GetCustomAttributes(typeof(FormsPropertyAttribute), true).Any()\r\n                             && property.PropertyType.GetInterface(\"IList\") == null\r\n                             select new XElement(xsd + \"attribute\",\r\n                                 new XAttribute(\"name\", property.Name),\r\n                                 GetXsdAttributeType(property),\r\n                                 new XAttribute(\"use\", \"optional\")\r\n\r\n                             )\r\n\r\n                        )\r\n\r\n\r\n\r\n                    )\r\n                );\r\n\r\n\r\n                return doc;\r\n\r\n\r\n            }\r\n\r\n\r\n\r\n\r\n            /// <summary>\r\n            /// For all channels and namespaces of elements generate XSD file\r\n            /// </summary>\r\n            /// \r\n            public void GenerateUiControls()\r\n            {\r\n                var channels = from c in GetUiControlDescriptors()\r\n                               group c by c.ChannelName into g\r\n                               select g;\r\n                foreach (var channel in channels)\r\n                {\r\n                    int countChannels = 0;\r\n                    var xmlnss = from c in channel\r\n                                 group c by c.NamespaceName into g\r\n                                 select g;\r\n                    foreach (var xmlns in xmlnss)\r\n                    {\r\n                        XDocument uicontrols = GetXsd(\r\n                        xmlns,\r\n                        xmlns.Key\r\n                        );\r\n                        uicontrols.SaveToFile(OutputDir + channel.Key + ((countChannels++ > 0) ? \".\" + countChannels : \"\") + \".xsd\");\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n\r\n            /// <summary>\r\n            /// For all namespaces of functions generate XSD file\r\n            /// </summary>\r\n            /// \r\n            public void GenerateFunctions()\r\n            {\r\n\r\n                var xmlnss = from c in GetFunctionDescriptors().ToList()\r\n                             group c by c.NamespaceName into g\r\n                             select g;\r\n                int countChannels = 0;\r\n                foreach (var xmlns in xmlnss)\r\n                {\r\n                    XDocument uicontrols = GetXsd(\r\n                    xmlns,\r\n                    xmlns.Key\r\n\r\n                    );\r\n\r\n                    uicontrols.SaveToFile(OutputDir + \"Plugins.Function\" + ((countChannels++ > 0) ? \".\" + countChannels : \"\") + \".xsd\");\r\n                }\r\n            }\r\n\r\n\r\n\r\n            internal IEnumerable<ElementDescriptor> GetFunctionDescriptors()\r\n            {\r\n                var uiControlConfigRoot = configDoc.Descendants(\"Composite.C1Console.Forms.Plugins.FunctionFactoryConfiguration\").Single();\r\n\r\n                var functionInfos = from functionlElement in uiControlConfigRoot.Descendants(\"add\")\r\n                                    select new\r\n                                    {\r\n                                        Name = functionlElement.Attribute(\"name\").Value,\r\n                                        NamespaceName = functionlElement.Parent.Parent.Attribute(\"name\").Value,\r\n                                    };\r\n\r\n                return\r\n                    from functionInfo in functionInfos\r\n                    select new ElementDescriptor\r\n                    {\r\n                        NamespaceName = functionInfo.NamespaceName,\r\n                        Name = functionInfo.Name,\r\n                        ElementType = Composite.C1Console.Forms.FormFactoryService.GetFunction(functionInfo.NamespaceName, functionInfo.Name).GetType()\r\n                    };\r\n\r\n            }\r\n        }\r\n\r\n        internal class ElementDescriptor\r\n        {\r\n            public string ChannelName { get; set; }\r\n            public string NamespaceName { get; set; }\r\n            public string Name { get; set; }\r\n            public Type ElementType { get; set; }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducerMediator.cs",
    "content": "using System;\r\nusing Composite.C1Console.Forms.Plugins.ProducerMediator;\r\nusing Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.StandardProducerMediators\r\n{\r\n    [ConfigurationElementType(typeof(BuildinProducerMediatorData))]\r\n    internal sealed class BuildinProducerMediator : IProducerMediator\r\n    {\r\n        public object CreateProducer(IFormChannelIdentifier channel, string namespaceName, string name)\r\n        {\r\n            switch (name)\r\n            {\r\n                case \"if\":\r\n                    return new IfProducer();\r\n\r\n                case \"ifCondition\":\r\n                    return new IfConditionProducer();\r\n\r\n                case \"ifWhenTrue\":\r\n                    return new IfWhenTrueProducer();\r\n\r\n                case \"ifWhenFalse\":\r\n                    return new IfWhenFalseProducer();\r\n\r\n                case \"read\":\r\n                    return new ReadProducer();\r\n\r\n                case \"bind\":\r\n                    return new BindProducer();\r\n\r\n                case \"binding\":\r\n                    return new BindingProducer();\r\n\r\n                case \"bindings\":\r\n                    return new BindingsProducer();\r\n\r\n                case \"layout\":\r\n                    return new LayoutProducer();\r\n\r\n                case \"evalfunc\":\r\n                    return new EvalFuncProducer();\r\n            }\r\n\r\n            throw new NotImplementedException(string.Format(\"Unknown buildin producer type {0}\", name));\r\n        }\r\n\r\n        public object EvaluateProducer(object producer)\r\n        {\r\n            if ( false == (producer is IBuildinProducer))\r\n            {\r\n                throw new ArgumentException(string.Format(\"The parameter type {0} did not match the expected type {1}\", producer.GetType().ToString(), typeof(IBuildinProducer).ToString()), \"producer\");\r\n            }\r\n\r\n            return producer;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableProducerMediatorAssembler))]\r\n    internal sealed class BuildinProducerMediatorData : ProducerMediatorData\r\n    {        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/BindProducer.cs",
    "content": "namespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    internal sealed class BindProducer : IBuildinProducer\r\n    {\r\n        private string _source;\r\n\r\n        internal BindProducer() { }\r\n\r\n        public string source\r\n        {\r\n            get { return _source; }\r\n            set { _source = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/BindingProducer.cs",
    "content": "namespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    internal sealed class BindingProducer : IBuildinProducer\r\n    {\r\n        private string _type;\r\n        private string _name;\r\n        private bool _optional = false;\r\n\r\n        internal BindingProducer() { }\r\n\r\n        public string type\r\n        {\r\n            get { return _type; }\r\n            set { _type = value; }\r\n        }\r\n\r\n        public string name\r\n        {\r\n            get { return _name; }\r\n            set { _name = value; }\r\n        }\r\n\r\n        public bool optional\r\n        {\r\n            get { return _optional; }\r\n            set { _optional = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/BindingsProducer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    [ControlValueProperty(\"bindings\")]\r\n    internal sealed class BindingsProducer : IBuildinProducer\r\n    {\r\n        private List<BindingProducer> _bindings = new List<BindingProducer>();\r\n\r\n        internal BindingsProducer() { }\r\n\r\n        public List<BindingProducer> bindings\r\n        {\r\n            get { return _bindings; }\r\n            set { _bindings = value; }\r\n        }\r\n\r\n        public string GetTypeNameByName(string name)\r\n        {\r\n            return _bindings.FirstOrDefault(bp => bp.name == name)?.type;\r\n        }\r\n\r\n        public bool? GetOptionalValueByName(string name)\r\n        {\r\n            return _bindings.FirstOrDefault(bp => bp.name == name)?.optional;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/EvalFuncProducer.cs",
    "content": "﻿using System.Xml.Linq;\r\nusing Composite.Functions;\r\nusing Composite.Core.Xml;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    [ControlValueProperty(\"Markup\")]\r\n    internal sealed class EvalFuncProducer : IBuildinProducer\r\n\t{\r\n        public XElement Markup { get; set; }\r\n\r\n        public override string ToString()\r\n        {\r\n            BaseRuntimeTreeNode baseRuntimeTreeNode = FunctionTreeBuilder.Build(this.Markup);\r\n\r\n            XDocument result = (XDocument)baseRuntimeTreeNode.GetValue();\r\n\r\n            XhtmlDocument xhtmlDocument = result as XhtmlDocument;\r\n            if (xhtmlDocument != null)\r\n            {\r\n                StringBuilder sb = new StringBuilder();\r\n                \r\n                foreach (XElement element in xhtmlDocument.Body.Elements())\r\n                {\r\n                    sb.AppendLine(element.ToString());\r\n                }\r\n\r\n                return sb.ToString();\r\n            }\r\n\r\n            return result.ToString();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/IBuildinProducer.cs",
    "content": "namespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    internal interface IBuildinProducer\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/IfConditionProducer.cs",
    "content": "namespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    [ControlValueProperty(\"Condition\")]\r\n    internal sealed class IfConditionProducer : IBuildinProducer\r\n    {\r\n        private bool _condition;\r\n\r\n        internal IfConditionProducer() { }\r\n\r\n        public bool Condition\r\n        {\r\n            get { return _condition; }\r\n            set { _condition = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/IfProducer.cs",
    "content": "namespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    internal sealed class IfProducer : IBuildinProducer\r\n    {\r\n        internal IfProducer() { }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/IfWhenFalseProducer.cs",
    "content": "using System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    [ControlValueProperty(\"Result\")]\r\n    internal sealed class IfWhenFalseProducer : IBuildinProducer\r\n    {\r\n        private List<object> _result = new List<object>();\r\n\r\n        internal IfWhenFalseProducer() { }\r\n\r\n        public List<object> Result\r\n        {\r\n            get { return _result; }\r\n            set { _result = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/IfWhenTrueProducer.cs",
    "content": "using System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    [ControlValueProperty(\"Result\")]\r\n    internal sealed class IfWhenTrueProducer : IBuildinProducer\r\n    {\r\n        private List<object> _result = new List<object>();\r\n\r\n        internal IfWhenTrueProducer() { }\r\n\r\n        public List<object> Result\r\n        {\r\n            get { return _result; }\r\n            set { _result = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/LayoutProducer.cs",
    "content": "namespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    [ControlValueProperty(nameof(UiControl))]\r\n    internal sealed class LayoutProducer : IBuildinProducer\r\n    {\r\n        public IUiControl UiControl { get; set; }\r\n\r\n        public string label { get; set; }\r\n\r\n        public string tooltip { get; set; }\r\n\r\n        public string iconhandle { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/BuildinProducers/ReadProducer.cs",
    "content": "namespace Composite.C1Console.Forms.StandardProducerMediators.BuildinProducers\r\n{\r\n    internal sealed class ReadProducer : IBuildinProducer\r\n    {\r\n        private string _source;\r\n\r\n        internal ReadProducer() { }\r\n\r\n        public string source\r\n        {\r\n            get { return _source; }\r\n            set { _source = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/FunctionProducerMediator.cs",
    "content": "using System;\r\nusing Composite.C1Console.Forms.Foundation.PluginFacades;\r\nusing Composite.C1Console.Forms.Plugins.FunctionFactory;\r\nusing Composite.C1Console.Forms.Plugins.ProducerMediator;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.StandardProducerMediators\r\n{\r\n    [ConfigurationElementType(typeof(FunctionProducerMediatorData))]\r\n    internal sealed class FunctionProducerMediator : IProducerMediator\r\n    {\r\n        public object CreateProducer(IFormChannelIdentifier channel, string namespaceName, string name)\r\n        {\r\n            return FunctionFactoryPluginFacade.GetFunction(namespaceName, name);\r\n        }\r\n\r\n\r\n        public object EvaluateProducer(object producer)\r\n        {\r\n            if (false == (producer is IFormFunction))\r\n            {\r\n                throw new ArgumentException(string.Format(\"The parameter type {0} did not match the expected type {1}\", producer.GetType().ToString(), typeof(IFormFunction).ToString()), \"producer\");\r\n            }\r\n\r\n                return (producer as IFormFunction).Execute();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableProducerMediatorAssembler))]\r\n    internal sealed class FunctionProducerMediatorData : ProducerMediatorData\r\n    {        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/StandardProducerMediators/UiControlProducerMediator.cs",
    "content": "using System;\r\nusing Composite.C1Console.Forms.Foundation.PluginFacades;\r\nusing Composite.C1Console.Forms.Plugins.ProducerMediator;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.StandardProducerMediators\r\n{\r\n    [ConfigurationElementType(typeof(UiControlProducerMediatorData))]\r\n    internal sealed class UiControlProducerMediator : IProducerMediator\r\n    {\r\n        public object CreateProducer(IFormChannelIdentifier channel, string namespaceName, string name)\r\n        {\r\n            return UiControlFactoryPluginFacade.CreateControl(channel, namespaceName, name);\r\n        }\r\n\r\n        public object EvaluateProducer(object producer)\r\n        {\r\n            if (false == (producer is IUiControl))\r\n            {\r\n                throw new ArgumentException(string.Format(\"The parameter type {0} did not match the expected type {1}\", producer.GetType().ToString(), typeof(IUiControl).ToString()), \"producer\");\r\n            }\r\n\r\n            return producer;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableProducerMediatorAssembler))]\r\n    internal sealed class UiControlProducerMediatorData : ProducerMediatorData\r\n    {        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/WebChannel/IClickableTabPanelControl.cs",
    "content": "﻿using System.Web.UI;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.WebChannel\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IClickableTabPanelControl\r\n    {\r\n        /// <exclude />\r\n        string CustomTabId { get; }\r\n\r\n        /// <exclude />\r\n        Control EventControl { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/WebChannel/IWebUiContainer.cs",
    "content": "﻿using Composite.C1Console.Forms.Flows;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.Forms.WebChannel\r\n{\r\n\tinternal interface IWebUiContainer : IUiContainer\r\n\t{\r\n        void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/WebChannel/IWebUiControl.cs",
    "content": "using System.Web.UI;\r\n\r\n\r\nnamespace Composite.C1Console.Forms.WebChannel\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IWebUiControl : IUiControl\r\n    {\r\n        /// <exclude />\r\n        Control BuildWebControl();\r\n\r\n        /// <exclude />\r\n        void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        string ClientName { get; }\r\n\r\n        /// <exclude />\r\n        bool IsFullWidthControl { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/WebChannel/WebManagementChannel.cs",
    "content": "﻿\r\nnamespace Composite.C1Console.Forms.WebChannel\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class WebManagementChannel : IFormChannelIdentifier\r\n    {\r\n        private static IFormChannelIdentifier _instance = new WebManagementChannel();\r\n\r\n        /// <exclude />\r\n        public static IFormChannelIdentifier Identifier { get { return _instance; } }\r\n\r\n        private WebManagementChannel() { }\r\n\r\n        /// <exclude />\r\n        public string ChannelName { get { return \"AspNet.Management\"; } }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            throw new System.Exception(\"Treated as string here!\");\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Forms/WebChannel/WebStandardsChannel.cs",
    "content": "﻿\r\nnamespace Composite.C1Console.Forms.WebChannel\r\n{\r\n    internal class WebStandardsChannel : IFormChannelIdentifier\r\n    {\r\n        private static IFormChannelIdentifier _instance = new WebStandardsChannel();\r\n\r\n        public static IFormChannelIdentifier Identifier { get { return _instance; } }\r\n\r\n        private WebStandardsChannel() { }\r\n\r\n        public string ChannelName { get { return \"AspNet.WebStandards\"; } }\r\n\r\n        public override string ToString()\r\n        {\r\n            throw new System.Exception(\"Treated as string here!\");\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Forms/WebChannel/WebUiHelpers.cs",
    "content": "//using System.Web.UI;\r\n//using System.Web.UI.WebControls;\r\n//using Composite.Core.WebClient.UiControlLib;\r\n\r\n\r\n//namespace Composite.C1Console.Forms.WebChannel\r\n//{\r\n//    internal sealed class WebUiHelpers\r\n//    {\r\n//        public static Control WrapInUpdatePanel( Control content, bool childrenAsUpdateTriggers )\r\n//        {\r\n\r\n//            BindingUpdatePanel updatePanel = new BindingUpdatePanel();\r\n//            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;\r\n//            updatePanel.ChildrenAsTriggers = childrenAsUpdateTriggers; \r\n//            updatePanel.ID = content.ID + \"UpdatePanel\";\r\n\r\n//            updatePanel.ContentTemplateContainer.Controls.Add( content );\r\n\r\n//            return updatePanel;\r\n//        }\r\n//    }\r\n//}\r\n"
  },
  {
    "path": "Composite/C1Console/RichContent/Components/Component.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\n\r\nnamespace Composite.C1Console.RichContent.Components\r\n{\r\n    /// <summary>\r\n    /// Describes component structure\r\n    /// </summary>\r\n    public class Component\r\n    {\r\n        /// <summary>\r\n        /// Component's unique id\r\n        /// </summary>\r\n        public virtual Guid Id { get; set; }\r\n\r\n        /// <summary>\r\n        /// Component's Title\r\n        /// </summary>\r\n        public virtual string Title { get; set; }\r\n\r\n        /// <summary>\r\n        /// Component's Description\r\n        /// </summary>\r\n        public virtual string Description { get; set; }\r\n\r\n        /// <summary>\r\n        /// Component's Tags which would be categorized with\r\n        /// </summary>\r\n        public virtual IEnumerable<string> GroupingTags { get; set; }\r\n\r\n        /// <summary>\r\n        /// Container classes in which this component can appear\r\n        /// </summary>\r\n        public virtual IEnumerable<string> ContainerClasses { get; set; }\r\n\r\n        /// <summary>\r\n        /// Container classes in which this component should not appear\r\n        /// </summary>\r\n        public virtual IEnumerable<string> AntiTags { get; set; }\r\n\r\n        /// <summary>\r\n        /// Image or Icon that should be used for component\r\n        /// </summary>\r\n        public virtual ComponentImage ComponentImage { get; set; }\r\n\r\n        /// <summary>\r\n        /// Component's definition\r\n        /// </summary>\r\n        public virtual string ComponentDefinition { get; set; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Image or Icon that should be used for component\r\n    /// </summary>\r\n    public class ComponentImage\r\n    {\r\n        /// <summary>\r\n        /// Icon name\r\n        /// </summary>\r\n        public string IconName;\r\n\r\n        /// <summary>\r\n        /// Image uri\r\n        /// </summary>\r\n        public string CustomImageUri;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/RichContent/Components/ComponentChangeNotifier.cs",
    "content": "﻿using Composite.Core.Application;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.RichContent.Components\r\n{\r\n    [ApplicationStartup()]\r\n    internal class ComponentChangeNotifierRegistrator\r\n    {\r\n        public void ConfigureServices(IServiceCollection serviceCollection)\r\n        {\r\n            serviceCollection.AddSingleton(typeof(ComponentChangeNotifier));\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Component change structure\r\n    /// </summary>\r\n    public class ComponentChange\r\n    {\r\n        /// <summary>\r\n        /// Provider's Id, e.g. provider's class name\r\n        /// </summary>\r\n        public string ProviderId { get; set; }\r\n\r\n    }\r\n\r\n    /// <summary>\r\n    /// This class manages change notifiers subscribed in component providers\r\n    /// </summary>\r\n    public class ComponentChangeNotifier : IObservable<ComponentChange>\r\n    {\r\n        /// <exclude />\r\n        public ComponentChangeNotifier()\r\n        {\r\n            _observers = new List<IObserver<ComponentChange>>();\r\n        }\r\n\r\n        private readonly List<IObserver<ComponentChange>> _observers;\r\n\r\n        /// <summary>\r\n        /// Use this method to subscribe an observer\r\n        /// </summary>\r\n        /// <param name=\"observer\"></param>\r\n        public IDisposable Subscribe(IObserver<ComponentChange> observer)\r\n        {\r\n            if (!_observers.Contains(observer))\r\n                _observers.Add(observer);\r\n            return new Unsubscriber(_observers, observer);\r\n        }\r\n\r\n\r\n        private class Unsubscriber : IDisposable\r\n        {\r\n            private readonly List<IObserver<ComponentChange>> _observers;\r\n            private readonly IObserver<ComponentChange> _observer;\r\n\r\n            public Unsubscriber(List<IObserver<ComponentChange>> observers, IObserver<ComponentChange> observer)\r\n            {\r\n                this._observers = observers;\r\n                this._observer = observer;\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                if (_observer != null && _observers.Contains(_observer))\r\n                    _observers.Remove(_observer);\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~Unsubscriber()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n\r\n            /// <summary>\r\n            /// Notify a change in the provider\r\n            /// </summary>\r\n            /// <param name=\"providerId\"></param>\r\n            public void ProviderChange(string providerId)\r\n        {\r\n            var change = new ComponentChange { ProviderId = providerId };\r\n            foreach (var observer in _observers)\r\n            {\r\n                observer.OnNext(change);\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/RichContent/Components/ComponentManager.cs",
    "content": "﻿using Composite.Core;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Logging;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace Composite.C1Console.RichContent.Components\r\n{\r\n    [ApplicationStartup()]\r\n    internal class ComponentManagerRegistrator\r\n    {\r\n        public void ConfigureServices(IServiceCollection serviceCollection)\r\n        {\r\n            serviceCollection.AddSingleton(typeof(ComponentManager));\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Get this class through the <see cref=\"Composite.Core.ServiceLocator\"/>. Describes components registered. \r\n    /// </summary>\r\n    public class ComponentManager : IObserver<ComponentChange>\r\n    {\r\n        /// <summary>\r\n        /// Instanciates a new instance of the ComponentManager. This class aggregate Components delivered from providers\r\n        /// implementing <see cref=\"IComponentProvider\"/> and registered with <see cref=\"ServiceLocator\"/>.\r\n        /// Get this class from <see cref=\"ServiceLocator\"/>.\r\n        /// </summary>\r\n        /// <param name=\"providers\">Providers the ComponentManager should read from.</param>\r\n        /// <param name=\"changeNotifier\">Service to signal changes in providers</param>\r\n        /// <param name=\"log\">Service to write to log</param>\r\n        public ComponentManager(IEnumerable<IComponentProvider> providers, ComponentChangeNotifier changeNotifier, ILog log)\r\n        {\r\n            _log = log;\r\n            _providers = providers.ToList();\r\n            _notifierUnsubscriber = changeNotifier.Subscribe(this);\r\n\r\n            _log.LogVerbose(nameof(ComponentManager), \"Registering {0} IComponentProvider instances: {1}\", _providers.Count, string.Join(\",\", _providers.Select(f => f.ProviderId)));\r\n        }\r\n\r\n        private readonly ILog _log;\r\n        private readonly List<IComponentProvider> _providers;\r\n        private IDisposable _notifierUnsubscriber;\r\n        private List<Component> _componentCache;\r\n\r\n        /// <summary>\r\n        /// Returns all known Components\r\n        /// </summary>\r\n        /// <returns>Components</returns>\r\n        public IEnumerable<Component> GetComponents()\r\n        {\r\n            var components = _componentCache;\r\n            if (components == null)\r\n            {\r\n                components = _providers.SelectMany(p => p.GetComponents()).ToList();\r\n                _componentCache = components;\r\n            }\r\n            return components;\r\n        }\r\n\r\n\r\n\r\n        #region Change notifications\r\n        void IObserver<ComponentChange>.OnCompleted()\r\n        {\r\n            _log.LogWarning(nameof(ComponentManager), \"Unexpected ComponentChange OnCompleted called\");\r\n        }\r\n\r\n        void IObserver<ComponentChange>.OnError(Exception error)\r\n        {\r\n            _log.LogError(nameof(ComponentManager), error);\r\n        }\r\n\r\n        void IObserver<ComponentChange>.OnNext(ComponentChange value)\r\n        {\r\n            _componentCache = null;\r\n        }\r\n        #endregion\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/RichContent/Components/IComponentProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.RichContent.Components\r\n{\r\n    /// <summary>\r\n    /// Component provider interface\r\n    /// </summary>\r\n    public interface IComponentProvider\r\n    {\r\n        /// <summary>\r\n        /// Unique id for this provider. Use this id to signal Component changes via <see cref=\"ComponentChangeNotifier\"/>.\r\n        /// </summary>\r\n        string ProviderId { get; }\r\n\r\n        /// <summary>\r\n        /// Return Component items known by the implemented provider. \r\n        /// The ComponentManager will only call this once and then cache components for the duration of the process lifetime.\r\n        /// If your list of components change, use the <see cref=\"ComponentChangeNotifier\"/> service and signal changes \r\n        /// via <see cref=\"ComponentChangeNotifier.ProviderChange(string)\"/>.\r\n        /// </summary>\r\n        /// <returns>One or more Component insances</returns>\r\n        IEnumerable<Component> GetComponents();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/RichContent/ContainerClasses/AntonymContainerClassManager.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.C1Console.RichContent.ContainerClasses\r\n{\r\n    internal static class AntonymContainerClassManager\r\n    {\r\n        private static readonly Dictionary<string, string> AntonymDictionaryFromConfig = AntonymContainerClassLoader();\r\n\r\n        private const string AntonymClassConfigurationsRelativePath = \"~/App_Data/Composite/Configuration/AntonymClassDefinitions.xml\";\r\n\r\n        private static Dictionary<string,string> AntonymContainerClassLoader()\r\n        {\r\n            XDocument document = null;\r\n\r\n            try\r\n            {\r\n                document = XDocumentUtils.Load(PathUtil.Resolve(AntonymClassConfigurationsRelativePath));\r\n            }\r\n            catch (XmlException exception)\r\n            {\r\n                Log.LogWarning(nameof(AntonymContainerClassManager),$\"error in parsing config file: {exception}\");\r\n                return new Dictionary<string, string>();\r\n            }\r\n            \r\n\r\n            return (from element in document.Root?.Elements()\r\n                              select new { Name = element.GetAttributeValue(\"name\"), Value = element.GetAttributeValue(\"antonym\") })\r\n                .ToDictionary(o => o.Name, o => o.Value);\r\n        }\r\n\r\n        public static string GetAntonym(string str)\r\n        {\r\n            return AntonymDictionaryFromConfig.ContainsKey(str) ? AntonymDictionaryFromConfig[str] : \"\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/RichContent/ContainerClasses/ContainerClassManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.C1Console.RichContent.ContainerClasses\r\n{\r\n    /// <summary>\r\n    /// Services for working with Container Classes - a concept that allow you to attach styling to visual editors and filter Components\r\n    /// </summary>\r\n    public static class ContainerClassManager\r\n    {\r\n        /// <summary>\r\n        /// Returns Container Classes defined for a Page Type Placeholder.\r\n        /// </summary>\r\n        /// <param name=\"pageTypeId\">Page Type to query</param>\r\n        /// <param name=\"placeholderId\">Placeholder to query</param>\r\n        /// <returns>List of container class names</returns>\r\n        public static IEnumerable<string> GetPageTypeContainerClasses(Guid pageTypeId, string placeholderId)\r\n        {\r\n            using (DataConnection connection = new DataConnection())\r\n            {\r\n                var containerClasses = connection.Get<IPageTypeDefaultPageContent>().Where(f => f.PageTypeId == pageTypeId && f.PlaceHolderId == placeholderId).Select(f => f.ContainerClasses).FirstOrDefault();\r\n\r\n                return ParseToList(containerClasses);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Given a string containing zero or more class names seperated by space/and or commas, this function returned a list of trimmed class names.\r\n        /// </summary>\r\n        /// <param name=\"containerClasses\">String with one or more class names</param>\r\n        /// <returns>strings, one for each class </returns>\r\n        public static IEnumerable<string> ParseToList(string containerClasses)\r\n        {\r\n            if (!string.IsNullOrEmpty(containerClasses))\r\n            {\r\n                var classList = containerClasses.Replace(\" \", \",\").Split(',').Where(s => !string.IsNullOrWhiteSpace(s));\r\n                foreach (string containerClass in classList)\r\n                {\r\n                    yield return containerClass;\r\n                }\r\n            }\r\n\r\n            yield break;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Ensure that a user provided string with 0 or more container class names is on the format \"class1,class2,class3\"\r\n        /// </summary>\r\n        /// <param name=\"containerClasses\">User provided string</param>\r\n        /// <returns>Structurally dependant string - each class seperated with a comma</returns>\r\n        public static string NormalizeClassNamesString(string containerClasses)\r\n        {\r\n            return string.Join(\",\", ParseToList(containerClasses));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Merge two IList based class lists into one.\r\n        /// </summary>\r\n        /// <param name=\"originalClassList\">Original list of classes. Some classes may be dropped from this list, if updated list has anantonyms</param>\r\n        /// <param name=\"updatedClassList\">Extra classes to add. These classes will have precedence.</param>\r\n        /// <returns></returns>\r\n        public static IList<string> MergeContainerClasses(IEnumerable<string> originalClassList, IEnumerable<string> updatedClassList)\r\n        {\r\n            return updatedClassList.Union(originalClassList ?? Enumerable.Empty<string>(), new EqualOrAntonymComparer()).ToList();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Merge two IList based class lists into one.\r\n        /// </summary>\r\n        /// <param name=\"originalClassList\">Original list of classes. Some classes may be dropped from this list, if updated list has anantonyms</param>\r\n        /// <param name=\"updatedClassList\">Extra classes to add. These classes will have precedence.</param>\r\n        /// <returns></returns>\r\n        public static string MergeContainerClasses(string originalClassList, string updatedClassList)\r\n        {\r\n            return string.Join(\",\", MergeContainerClasses(ParseToList(originalClassList),ParseToList(updatedClassList)));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/RichContent/ContainerClasses/EqualOrAntonymComparer.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.RichContent.ContainerClasses\r\n{\r\n    internal class EqualOrAntonymComparer : IEqualityComparer<string>\r\n    {\r\n        public bool Equals(string x, string y)\r\n        {\r\n            return x.Equals(AntonymContainerClassManager.GetAntonym(y)) || x.Equals(y);\r\n        }\r\n\r\n        public int GetHashCode(string obj)\r\n        {\r\n            return obj.GetHashCode() ^ AntonymContainerClassManager.GetAntonym(obj).GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/ActionToken.cs",
    "content": "using System.Collections.Generic;\r\nusing System;\r\nusing Composite.Core.Types;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class ActionToken\r\n    {\r\n        /// <exclude />\r\n        public abstract IEnumerable<PermissionType> PermissionTypes { get; }\r\n\r\n        /// <exclude />\r\n        public virtual string Serialize() { return \"\"; }\r\n\r\n        /// <exclude />\r\n        public virtual bool IgnoreEntityTokenLocking { get { return false; } }\r\n    }\r\n\r\n\r\n\r\n    internal static class ActionTokenExtensionMethods\r\n    {\r\n        public static bool IsIgnoreEntityTokenLocking(this ActionToken actionToken)\r\n        {\r\n            if (actionToken == null) throw new ArgumentNullException(nameof(actionToken));\r\n            \r\n            return actionToken.IgnoreEntityTokenLocking;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/ActionTokenSerializer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Security;\r\nusing System.Text;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ActionTokenSerializer\r\n    {\r\n        /// <exclude />\r\n        public static string Serialize(ActionToken actionToken)\r\n        {\r\n            return Serialize(actionToken, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string Serialize(ActionToken actionToken, bool includeHashValue)\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"actionTokenType\", TypeManager.SerializeType(actionToken.GetType()));\r\n\r\n            string serializedActionToken = actionToken.Serialize();\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"actionToken\", serializedActionToken);\r\n\r\n            if (includeHashValue)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"actionTokenHash\", HashSigner.GetSignedHash(serializedActionToken).Serialize());\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ActionToken Deserialize(string serialziedActionToken)\r\n        {\r\n            return Deserialize(serialziedActionToken, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ActionToken Deserialize(string serialziedActionToken, bool includeHashValue)\r\n        {\r\n            if (string.IsNullOrEmpty(serialziedActionToken)) throw new ArgumentNullException(\"serialziedActionToken\");\r\n\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serialziedActionToken);\r\n\r\n            if ((dic.ContainsKey(\"actionTokenType\") == false) ||\r\n                (dic.ContainsKey(\"actionToken\") == false) ||\r\n                ((includeHashValue) && (dic.ContainsKey(\"actionTokenHash\") == false)))\r\n            {\r\n                throw new ArgumentException(\"Failed to deserialize the value. It has to be serialized with ActionTokenSerializer class.\", \"serialziedActionToken\");\r\n            }\r\n\r\n            string actionTokenTypeString = StringConversionServices.DeserializeValueString(dic[\"actionTokenType\"]);\r\n            string actionTokenString = StringConversionServices.DeserializeValueString(dic[\"actionToken\"]);\r\n\r\n            if (includeHashValue)\r\n            {\r\n                string actionTokenHash = StringConversionServices.DeserializeValueString(dic[\"actionTokenHash\"]);\r\n\r\n                HashValue hashValue = HashValue.Deserialize(actionTokenHash);\r\n                if (HashSigner.ValidateSignedHash(actionTokenString, hashValue) == false)\r\n                {\r\n                    throw new SecurityException(\"Serialized action token is tampered\");\r\n                }\r\n            }\r\n\r\n            Type actionType = TypeManager.GetType(actionTokenTypeString);\r\n\r\n            MethodInfo methodInfo = actionType.GetMethod(\"Deserialize\", BindingFlags.Public | BindingFlags.Static);\r\n            if (methodInfo == null || !(typeof(ActionToken).IsAssignableFrom(methodInfo.ReturnType)))\r\n            {\r\n                Log.LogWarning(\"ActionTokenSerializer\", string.Format(\"The action token {0} is missing a public static Deserialize method taking a string as parameter and returning an {1}\", actionType, typeof(ActionToken)));\r\n                throw new InvalidOperationException(string.Format(\"The action token {0} is missing a public static Deserialize method taking a string as parameter and returning an {1}\", actionType, typeof(ActionToken)));\r\n            }\r\n\r\n\r\n            ActionToken actionToken;\r\n            try\r\n            {\r\n                actionToken = (ActionToken)methodInfo.Invoke(null, new object[] { actionTokenString });\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogWarning(\"ActionTokenSerializer\", string.Format(\"The action token {0} is missing a public static Deserialize method taking a string as parameter and returning an {1}\", actionType, typeof(ActionToken)));\r\n                Log.LogWarning(\"ActionTokenSerializer\", ex);\r\n\r\n                throw new InvalidOperationException(string.Format(\"The action token {0} is missing a public static Deserialize method taking a string as parameter and returning an {1}\", actionType, typeof(ActionToken)), ex);\r\n            }\r\n\r\n            if (actionToken == null)\r\n            {\r\n                Log.LogWarning(\"ActionTokenSerializer\", string.Format(\"public static Deserialize method taking a string as parameter and returning an {1} on the action token {0} did not return an object\", actionType, typeof(ActionToken)));\r\n\r\n                throw new InvalidOperationException(string.Format(\"public static Deserialize method taking a string as parameter and returning an {1} on the action token {0} did not return an object\", actionType, typeof(ActionToken)));\r\n            }\r\n\r\n            return actionToken;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static T Deserialize<T>(string serialziedActionToken)\r\n            where T : ActionToken\r\n        {\r\n            return (T)Deserialize(serialziedActionToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/AdministratorAutoCreator.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>\r\n    /// Can create \"the first user\" on a newly installed system. This class only works if\r\n    ///  - no other users has been created before\r\n    ///  - the global configuration contains a \"auto create administrator\" user name\r\n    ///  - the provided user name matches the user name from the global configuration\r\n    ///  - the provided password validates as a non-weak password\r\n    ///  - the used login provider supports adding users\r\n    ///  - the used permission provider supports adding permission types\r\n    /// </summary>\r\n\tinternal static class AdministratorAutoCreator\r\n\t{\r\n        public static bool CanBeAutoCreated(string userName)\r\n        {\r\n            string defaultAdminUserName = GlobalSettingsFacade.AutoCreatedAdministratorUserName;\r\n\r\n            return !string.IsNullOrEmpty(defaultAdminUserName)\r\n                   && userName == defaultAdminUserName\r\n                   && !LoginProviderPluginFacade.UsersExists;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Used for \"first time\" login on systems configured for this. A way to create the first user. This only works on systems\r\n        /// with no users and with a valid \"auto create admin username\" specified by the global settings.\r\n        /// </summary>\r\n        /// <param name=\"userName\">The user name - must match GlobalSettingsProvider.AutoCreatedAdministratorUserName</param>\r\n        /// <param name=\"password\">A password that meets a minimum requirement.</param>\r\n        /// <param name=\"email\">THe users email.</param>\r\n        /// <param name=\"validateAutoCreateUserName\">When true only the username specified in Composite.config as auto createable (usually 'admin') is allowed. Set to false to use a different user name.</param>\r\n        /// <returns>true if the user was auto created. Otherwise false.</returns>\r\n        public static void AutoCreateAdministrator(string userName, string password, string email, bool validateAutoCreateUserName = true)\r\n        {\r\n            if (validateAutoCreateUserName && !CanBeAutoCreated(userName))\r\n            {\r\n                throw new InvalidOperationException(\"Unable to auto create account. Either the user name is not eligble for auto creation or other users exists in the system. This feature only works for a specific user name and when no users exists.\");\r\n            }\r\n\r\n            if (!LoginProviderPluginFacade.CanAddNewUser)\r\n            {\r\n                throw new InvalidOperationException(\"Unable to auto create account. The current login provider does not support adding users\");\r\n            }\r\n\r\n            if (!PermissionTypeFacade.CanAlterDefinitions)\r\n            {\r\n                throw new InvalidOperationException(\"Unable to auto create account. The current permission defintion provider does not support changes\");\r\n            }\r\n\r\n            //PasswordValidator validator = new PasswordValidator();\r\n            //ValidationResults validationResults = validator.Validate(password);\r\n            //if (validationResults.IsValid == false)\r\n            //{\r\n            //    throw new InvalidOperationException(\"Unable to auto create account. The specified password is not strong enough.\");\r\n            //}\r\n\r\n            \r\n            // All seems bo be ok green light go for auto creating the user.\r\n            string group = StringResourceSystemFacade.GetString(\"Composite.C1Console.Users\", \"AdministratorAutoCreator.DefaultGroupName\");\r\n\r\n            LoginProviderPluginFacade.FormAddNewUser(userName, password, group, email);\r\n            Log.LogVerbose(\"AdministratorAutoCreator\", String.Format(\"Auto Created Administrator with user name '{0}'.\", userName), LoggingService.Category.Audit);\r\n\r\n            IUser user = DataFacade.GetData<IUser>().Where(f => f.Username == userName).SingleOrDefault();\r\n            IUserGroup userGroup = DataFacade.GetData<IUserGroup>().Where(f => f.Name == \"Administrator\").SingleOrDefault();\r\n            if (user != null && userGroup != null)\r\n            {\r\n                IUserUserGroupRelation userUserGroupRelation = DataFacade.BuildNew<IUserUserGroupRelation>();\r\n                userUserGroupRelation.UserId = user.Id;\r\n                userUserGroupRelation.UserGroupId = userGroup.Id;\r\n                DataFacade.AddNew<IUserUserGroupRelation>(userUserGroupRelation);\r\n            }\r\n            else\r\n            {\r\n                foreach (Element appRootElement in ElementFacade.GetRootsWithNoSecurity())\r\n                {\r\n                    string serializedEntityToken = EntityTokenSerializer.Serialize(appRootElement.ElementHandle.EntityToken);\r\n                    LoggingService.LogVerbose(\"AdministratorAutoCreator\", String.Format(\"Adding '{0}' on element '{1}' ('{2}').\", userName, appRootElement.VisualData.Label ?? \"(no label)\", serializedEntityToken), LoggingService.Category.Audit);\r\n\r\n                    UserPermissionDefinition userPermissionDefinition = new ConstructorBasedUserPermissionDefinition(userName, PermissionTypeFacade.GrantingPermissionTypes, serializedEntityToken);\r\n                    PermissionTypeFacade.SetUserPermissionDefinition(userPermissionDefinition);\r\n                }\r\n\r\n                Log.LogVerbose(\"AdministratorAutoCreator\", string.Format(\"Activating all known perspectives for user '{0}'\", userName));\r\n                IEnumerable<EntityToken> perspectiveEntityTokens = ElementFacade.GetPerspectiveElementsWithNoSecurity().Select(f => f.ElementHandle.EntityToken);\r\n                UserPerspectiveFacade.SetEntityTokens(userName, perspectiveEntityTokens);\r\n            }\r\n\r\n            foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n            {\r\n                UserSettings.AddActiveLocaleCultureInfo(userName, cultureInfo);\r\n\r\n                if (Core.Localization.LocalizationFacade.IsDefaultLocale(cultureInfo))                        \r\n                {\r\n                    UserSettings.SetCurrentActiveLocaleCultureInfo(userName, cultureInfo);                            \r\n                    UserSettings.SetForeignLocaleCultureInfo(userName, cultureInfo);\r\n                }\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/AuxiliarySecurityAncestorFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class AuxiliarySecurityAncestorFacade\r\n\t{\r\n        private static IAuxiliarySecurityAncestorFacade _implementation = new AuxiliarySecurityAncestorFacadeImpl();\r\n\r\n\r\n        static AuxiliarySecurityAncestorFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => _implementation.Flush());\r\n        }\r\n\r\n\r\n        internal static IAuxiliarySecurityAncestorFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            return _implementation.GetParents(entityToken);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// Providers will get flushed on flushes\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"auxiliarySecurityAncestorProvider\"></param>\r\n        public static void AddAuxiliaryAncestorProvider<T>(IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider) \r\n            where T : EntityToken\r\n        {\r\n            AddAuxiliaryAncestorProvider(typeof(T), auxiliarySecurityAncestorProvider);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"auxiliarySecurityAncestorProvider\"></param>\r\n        /// <param name=\"flushPersistent\"></param>\r\n        public static void AddAuxiliaryAncestorProvider<T>(IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider, bool flushPersistent)\r\n            where T : EntityToken\r\n        {\r\n            AddAuxiliaryAncestorProvider(typeof(T), auxiliarySecurityAncestorProvider, flushPersistent);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Providers will get flushed on flushes\r\n        /// </summary>\r\n        /// <param name=\"entityTokenType\"></param>\r\n        /// <param name=\"auxiliarySecurityAncestorProvider\"></param>\r\n        public static void AddAuxiliaryAncestorProvider(Type entityTokenType, IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider)\r\n        {\r\n            _implementation.AddAuxiliaryAncestorProvider(entityTokenType, auxiliarySecurityAncestorProvider, false);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Providers will get flushed on flushes\r\n        /// </summary>\r\n        /// <param name=\"entityTokenType\"></param>\r\n        /// <param name=\"auxiliarySecurityAncestorProvider\"></param>\r\n        /// <param name=\"flushPersistent\"></param>\r\n        public static void AddAuxiliaryAncestorProvider(Type entityTokenType, IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider, bool flushPersistent)\r\n        {\r\n            _implementation.AddAuxiliaryAncestorProvider(entityTokenType, auxiliarySecurityAncestorProvider, flushPersistent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IAuxiliarySecurityAncestorProvider> GetAuxiliaryAncestorProviders(Type entityTokenType)\r\n        {\r\n            return _implementation.GetAuxiliaryAncestorProviders(entityTokenType);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/AuxiliarySecurityAncestorFacadeImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal sealed class AuxiliarySecurityAncestorFacadeImpl : IAuxiliarySecurityAncestorFacade\r\n    {\r\n        private Dictionary<Type, List<IAuxiliarySecurityAncestorProvider>> _auxiliarySecurityAncestorProviders = new Dictionary<Type, List<IAuxiliarySecurityAncestorProvider>>();\r\n        private Dictionary<Type, List<IAuxiliarySecurityAncestorProvider>> _flushPersistentAuxiliarySecurityAncestorProviders = new Dictionary<Type, List<IAuxiliarySecurityAncestorProvider>>();\r\n\r\n\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNull(entityToken, nameof(entityToken));\r\n\r\n\r\n            List<IAuxiliarySecurityAncestorProvider> auxiliarySecurityAncestorProviders;\r\n            List<IAuxiliarySecurityAncestorProvider> flushPersistentAuxiliarySecurityAncestorProviders;\r\n\r\n            _auxiliarySecurityAncestorProviders.TryGetValue(entityToken.GetType(), out auxiliarySecurityAncestorProviders);\r\n            _flushPersistentAuxiliarySecurityAncestorProviders.TryGetValue(entityToken.GetType(), out flushPersistentAuxiliarySecurityAncestorProviders);\r\n\r\n            IEnumerable<IAuxiliarySecurityAncestorProvider> resultSecurityAncestorProviders = auxiliarySecurityAncestorProviders.ConcatOrDefault(flushPersistentAuxiliarySecurityAncestorProviders);\r\n\r\n            if (resultSecurityAncestorProviders == null) return null;\r\n\r\n\r\n            IEnumerable<EntityToken> totalResult = null;\r\n            foreach (IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider in resultSecurityAncestorProviders)\r\n            {\r\n                var result = auxiliarySecurityAncestorProvider.GetParents(new [] { entityToken });\r\n\r\n                if (result.Count > 0)\r\n                {\r\n                    totalResult = totalResult.ConcatOrDefault(result.Values.First());\r\n                }\r\n            }\r\n\r\n            return totalResult;\r\n        }\r\n\r\n\r\n\r\n        public void AddAuxiliaryAncestorProvider(Type entityTokenType, IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider, bool flushPersistent)\r\n        {\r\n            var providers = !flushPersistent \r\n                ? _auxiliarySecurityAncestorProviders \r\n                : _flushPersistentAuxiliarySecurityAncestorProviders;\r\n\r\n            List<IAuxiliarySecurityAncestorProvider> auxiliarySecurityAncestorProviders;\r\n\r\n            if (!providers.TryGetValue(entityTokenType, out auxiliarySecurityAncestorProviders))\r\n            {\r\n                auxiliarySecurityAncestorProviders = new List<IAuxiliarySecurityAncestorProvider>();\r\n                providers.Add(entityTokenType, auxiliarySecurityAncestorProviders);\r\n            }\r\n\r\n            if (auxiliarySecurityAncestorProviders.Contains(auxiliarySecurityAncestorProvider))\r\n            {\r\n                throw new ArgumentException(\"The given provider has already been added with the given entity token\", nameof(auxiliarySecurityAncestorProvider));\r\n            }\r\n\r\n            auxiliarySecurityAncestorProviders.Add(auxiliarySecurityAncestorProvider);\r\n        }\r\n\r\n\r\n\r\n        public void RemoveAuxiliaryAncestorProvider(Type entityTokenType, IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider)\r\n        {\r\n            List<IAuxiliarySecurityAncestorProvider> auxiliarySecurityAncestorProviders;\r\n\r\n            if (_auxiliarySecurityAncestorProviders.TryGetValue(entityTokenType, out auxiliarySecurityAncestorProviders))\r\n            {\r\n                auxiliarySecurityAncestorProviders.Remove(auxiliarySecurityAncestorProvider);\r\n            }\r\n\r\n            if (_flushPersistentAuxiliarySecurityAncestorProviders.TryGetValue(entityTokenType, out auxiliarySecurityAncestorProviders))\r\n            {\r\n                auxiliarySecurityAncestorProviders.Remove(auxiliarySecurityAncestorProvider);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<IAuxiliarySecurityAncestorProvider> GetAuxiliaryAncestorProviders(Type entityTokenType)\r\n        {\r\n            List<IAuxiliarySecurityAncestorProvider> auxiliarySecurityAncestorProviders;\r\n\r\n            if (_auxiliarySecurityAncestorProviders.TryGetValue(entityTokenType, out auxiliarySecurityAncestorProviders))\r\n            {\r\n                foreach (IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider in auxiliarySecurityAncestorProviders)\r\n                {\r\n                    yield return auxiliarySecurityAncestorProvider;\r\n                }\r\n            }\r\n\r\n\r\n            if (_flushPersistentAuxiliarySecurityAncestorProviders.TryGetValue(entityTokenType, out auxiliarySecurityAncestorProviders))\r\n            {\r\n                foreach (IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider in auxiliarySecurityAncestorProviders)\r\n                {\r\n                    yield return auxiliarySecurityAncestorProvider;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _auxiliarySecurityAncestorProviders = new Dictionary<Type, List<IAuxiliarySecurityAncestorProvider>>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/AuxiliarySecurityAncestorProviderAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    [AttributeUsageAttribute(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]\r\n    internal sealed class AuxiliarySecurityAncestorProviderAttribute : Attribute\r\n    {\r\n        private Type _auxiliarySecurityAncestorProviderType;\r\n\r\n\r\n        public AuxiliarySecurityAncestorProviderAttribute(Type auxiliarySecurityAncestorProviderType)\r\n        {\r\n            _auxiliarySecurityAncestorProviderType = auxiliarySecurityAncestorProviderType;\r\n        }\r\n\r\n\r\n        public Type AuxiliarySecurityAncestorProviderType\r\n        {\r\n            get { return _auxiliarySecurityAncestorProviderType; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/BuildinPlugins/BuildinLoginSessionStore/BuildinLoginSessionStore.cs",
    "content": "﻿using System.Net;\r\nusing Composite.C1Console.Security.Plugins.LoginSessionStore;\r\n\r\n\r\nnamespace Composite.C1Console.Security.BuildinPlugins.BuildinLoginSessionStore\r\n{\r\n    internal class BuildinLoginSessionStore : ILoginSessionStore\r\n\t{\r\n        public static string Username { get { return \"testUser\"; } }\r\n\r\n        string _username = Username;\r\n\r\n        public bool CanPersistAcrossSessions\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n        public void StoreUsername(string username, bool persistAcrossSessions)\r\n        {\r\n            _username = username;\r\n        }\r\n\r\n        public void FlushUsername()\r\n        {\r\n            _username = Username;\r\n        }\r\n\r\n        public string StoredUsername\r\n        {\r\n            get { return _username; }\r\n        }\r\n\r\n        public IPAddress UserIpAddress\r\n        {\r\n            get { return IPAddress.Loopback; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/BuildinPlugins/BuildinUserPermissionDefinitionProvider/BuildinUserRoleDefinitionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Security.BuildinPlugins.BuildinUserPermissionDefinitionProvider\r\n{\r\n    internal sealed class BuildinUserPermissionDefinitionProvider : IUserPermissionDefinitionProvider\r\n\t{\r\n        private List<UserPermissionDefinition> _userPermissionDefinitions = new List<UserPermissionDefinition>();\r\n\r\n\r\n        public IEnumerable<UserPermissionDefinition> AllUserPermissionDefinitions\r\n        {\r\n            get { return _userPermissionDefinitions; }\r\n        \r\n        \r\n        }\r\n\r\n        public bool CanAlterDefinitions\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n\r\n\r\n        public void SetUserPermissionDefinition(UserPermissionDefinition userPermissionDefinition)\r\n        {\r\n            _userPermissionDefinitions.Add(userPermissionDefinition);\r\n        }\r\n\r\n\r\n\r\n        public void RemoveUserPermissionDefinition(UserToken userToken, string serializedEntityToken)\r\n        {\r\n            _userPermissionDefinitions = new List<UserPermissionDefinition>();\r\n        }\r\n\r\n        #region IUserPermissionDefinitionProvider Members\r\n\r\n\r\n        public IEnumerable<UserPermissionDefinition> GetPermissionsByUser(string userName)\r\n        {\r\n            return from urd in AllUserPermissionDefinitions\r\n                   where urd.Username == userName\r\n                   select urd;\r\n        }\r\n\r\n        #endregion\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Compatibility/LegacySerializedEntityTokenUpgrader.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Xml.Linq;\nusing Composite.Core.Application;\nusing Composite.Core.Configuration;\nusing Composite.Core.IO;\nusing Composite.Core.Logging;\nusing Composite.Data;\nusing Composite.Data.DynamicTypes;\n\nnamespace Composite.C1Console.Security.Compatibility\n{\n    /// <summary>\n    /// Will auto upgrade serialized entity tokens and data ids, stored in c1 data. Needed because serialization has changed.  \n    /// </summary>\n    [ApplicationStartup(AbortStartupOnException = false)]\n    public static class LegacySerializedEntityTokenUpgrader\n    {\n        const string LogTitle = nameof(LegacySerializedEntityTokenUpgrader);\n        const string _configFilename = \"LegacySerializedEntityTokenUpgrader.config\";\n        static readonly XName _docRoot = \"UpgradeSettings\";\n        private static ILog _log;\n\n        private const int MaxErrorMessagesPerType = 1000;\n\n        /// <summary>\n        /// See class description - this allow us to run on startup\n        /// </summary>\n        /// <param name=\"log\"></param>\n        public static void OnInitialized(ILog log)\n        {\n            if (ShouldRun)\n            {\n                _log = log;\n                try\n                {\n                    Run();\n                }\n                catch (Exception ex)\n                {\n                    _log.LogError(LogTitle, ex);\n\n                    throw;\n                }\n            }\n\n        }\n\n        private static void Run()\n        {\n            UpgradeStoredData();\n\n            var config = GetConfigElement();\n\n            config.SetAttributeValue(\"last-run\", DateTime.Now);\n            config.SetAttributeValue(\"completed\", true);\n\n            config.Save(ConfigFilePath);\n        }\n\n        private static bool ShouldRun\n        {\n            get\n            {\n                var _xConfig = GetConfigElement();\n                return true == (bool)_xConfig.Attribute(\"enabled\") &&\n                       (false == (bool)_xConfig.Attribute(\"completed\") ||\n                        true == (bool)_xConfig.Attribute(\"force\") ||\n                        (DateTime)_xConfig.Attribute(\"last-run\") - (DateTime)_xConfig.Attribute(\"inception\") < TimeSpan.FromMinutes(5));\n            }\n        }\n\n\n        private static string ConfigFilePath\n        {\n            get\n            {\n                var configDir = PathUtil.Resolve(GlobalSettingsFacade.ConfigurationDirectory);\n                var configFilePath = Path.Combine(configDir, _configFilename);\n\n                return configFilePath;\n            }\n        }\n\n        private static XElement GetConfigElement()\n        {\n            XDocument config = null;\n\n            if (File.Exists(ConfigFilePath))\n            {\n                config = XDocument.Load(ConfigFilePath);\n            }\n            else\n            {\n                config = new XDocument(\n                    new XElement(_docRoot,\n                        new XAttribute(\"inception\", DateTime.Now),\n                        new XAttribute(\"force\", false),\n                        new XAttribute(\"completed\", false),\n                        new XAttribute(\"enabled\", true)));\n            }\n\n            return config.Root;\n        }\n\n\n        private static void UpgradeStoredData()\n        {\n            const string _ET = \"EntityToken\";\n            const string _DSI = \"DataSourceId\";\n\n            List<string> magicPropertyNames = new List<string> { _ET, _DSI };\n            Func<DataFieldDescriptor, bool> isSerializedFieldFunc = g => magicPropertyNames.Any(s => g.Name.Contains(s));\n            var descriptors = DataMetaDataFacade.AllDataTypeDescriptors.Where(f => f.Fields.Any(isSerializedFieldFunc));\n\n            foreach (var descriptor in descriptors)\n            {\n                Type dataType = descriptor.GetInterfaceType();\n\n                if (dataType == null)\n                {\n                    continue;\n                }\n\n                var propertiesToUpdate = new List<PropertyInfo>();\n                foreach (var tokenField in descriptor.Fields.Where(isSerializedFieldFunc))\n                {\n                    var tokenProperty = dataType.GetProperty(tokenField.Name);\n                    propertiesToUpdate.Add(tokenProperty);\n                }\n\n                using (new DataConnection(PublicationScope.Unpublished))\n                {\n                    var allRows = DataFacade.GetData(dataType).ToDataList();\n\n                    var toUpdate = new List<IData>();\n\n                    int errors = 0, updated = 0;\n\n                    foreach (var rowItem in allRows)\n                    {\n                        bool rowChange = false;\n\n                        foreach (var tokenProperty in propertiesToUpdate)\n                        {\n                            string token = tokenProperty.GetValue(rowItem) as string;\n\n                            try\n                            {\n                                string tokenReserialized;\n\n                                if (tokenProperty.Name.Contains(_ET))\n                                {\n                                    var entityToken = EntityTokenSerializer.Deserialize(token);\n                                    tokenReserialized = EntityTokenSerializer.Serialize(entityToken);\n                                }\n                                else if (tokenProperty.Name.Contains(_DSI))\n                                {\n                                    token = EnsureValidDataSourceId(token);\n                                    var dataSourceId = DataSourceId.Deserialize(token);\n                                    tokenReserialized = dataSourceId.Serialize();\n                                }\n                                else\n                                {\n                                    throw new InvalidOperationException(\"This line should not be reachable\");\n                                }\n\n                                if (tokenReserialized != token)\n                                {\n                                    tokenProperty.SetValue(rowItem, tokenReserialized);\n                                    rowChange = true;\n                                }\n                            }\n                            catch (Exception ex)\n                            {\n                                errors++;\n                                if (errors <= MaxErrorMessagesPerType)\n                                {\n                                    _log.LogError(LogTitle, $\"Failed to upgrade old token '{token}' from data type '{dataType.FullName}' as EntityToken.\\n{ex}\");\n                                }\n                            }\n                        }\n\n                        if (rowChange)\n                        {\n                            updated++;\n                            toUpdate.Add(rowItem);\n\n                            if (toUpdate.Count >= 1000)\n                            {\n                                DataFacade.Update(toUpdate, true, false, false);\n                                toUpdate.Clear();\n                            }\n                        }\n                    }\n\n                    if (toUpdate.Count > 0)\n                    {\n                        DataFacade.Update(toUpdate, true, false, false);\n                        toUpdate.Clear();\n                    }\n\n                    _log.LogInformation(LogTitle, $\"Finished updating serialized tokens for data type '{dataType.FullName}'. Rows: {allRows.Count}, Updated: {updated}, Errors: {errors}\");\n                }\n            }\n        }\n\n        private static string EnsureValidDataSourceId(string token)\n        {\n            try\n            {\n                // fixing specific data inconsistency, where old serialized data id's for versioned data do not reflect versionid property added in a later version\n                if (token.Contains(\"Composite_Data_Types_IPagePlaceholderContentDataId\") && !token.Contains(\"VersionId\"))\n                {\n                    var pageId = Guid.Parse(token.Substring(19, 36));\n                    token = token.Replace(\"'_dataIdType_\", String.Format(\",\\\\ VersionId=\\\\'{0}\\\\''_dataIdType_\", pageId));\n                }\n            }\n            catch (Exception)\n            {\n                // if we have an issue, caller will act\n            }\n\n            return token;\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/C1Console/Security/ConstructorBasedUserGroupPermissionDefinition.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConstructorBasedUserGroupPermissionDefinition : UserGroupPermissionDefinition\r\n    {\r\n        private Guid _userGroupId;\r\n        private IEnumerable<PermissionType> _permissionTypes;\r\n        private string _serializedEntityToken;\r\n\r\n        /// <exclude />\r\n        public ConstructorBasedUserGroupPermissionDefinition(Guid userGroupId, IEnumerable<PermissionType> permissionTypes, string serializedEntityToken)\r\n        {\r\n            _userGroupId = userGroupId;\r\n            _permissionTypes = permissionTypes;\r\n            _serializedEntityToken = serializedEntityToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override Guid UserGroupId\r\n        {\r\n            get { return _userGroupId; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string SerializedEntityToken\r\n        {\r\n            get { return _serializedEntityToken; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/ConstructorBasedUserPermissionDefinition.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConstructorBasedUserPermissionDefinition : UserPermissionDefinition\r\n    {\r\n        private string _username;\r\n        private IEnumerable<PermissionType> _permissionTypes;\r\n        private string _serializedEntityToken;\r\n\r\n        /// <exclude />\r\n        public ConstructorBasedUserPermissionDefinition(string username, IEnumerable<PermissionType> permissionTypes, string serializedEntityToken)\r\n        {\r\n            _username = username;\r\n            _permissionTypes = permissionTypes;\r\n            _serializedEntityToken = serializedEntityToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Username\r\n        {\r\n            get { return _username; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string SerializedEntityToken\r\n        {\r\n            get { return _serializedEntityToken; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Cryptography/Cryptographer.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.InteropServices;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Cryptography\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class Cryptographer\r\n\t{\r\n        private static string _secretKey;\r\n        private static Encoding _encoding = Encoding.Unicode;\r\n\r\n        static Cryptographer()\r\n        {\r\n            _secretKey = \"u\u001b?Ccr?\u000f\";\r\n            GCHandle gch = GCHandle.Alloc(_secretKey, GCHandleType.Pinned);\r\n            \r\n            //ZeroMemory(gch.AddrOfPinnedObject(), _secretKey.Length * 2);\r\n            //gch.Free();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string Encrypt(this string data)\r\n        {\r\n            byte[] byteData = _encoding.GetBytes(data);\r\n            byte[] encrypted = Cryptographer.EncryptBytes(byteData);\r\n            return Convert.ToBase64String(encrypted);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string Decrypt(this string data)\r\n        {\r\n            byte[] byteData = _encoding.GetBytes(data);\r\n            byte[] decrypted = Cryptographer.DecryptBytes(Convert.FromBase64String(data));\r\n            return _encoding.GetString(decrypted);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static byte[] EncryptBytes(byte[] toEncrypt)\r\n        {\r\n            DESCryptoServiceProvider DES = new DESCryptoServiceProvider();\r\n            DES.Key = ASCIIEncoding.ASCII.GetBytes(_secretKey);\r\n            DES.IV = ASCIIEncoding.ASCII.GetBytes(_secretKey);\r\n            ICryptoTransform desencrypt = DES.CreateEncryptor();\r\n\r\n            byte[] result;\r\n            using (MemoryStream ms = new MemoryStream())\r\n            {\r\n                using (CryptoStream cryptostream = new CryptoStream(ms, desencrypt, CryptoStreamMode.Write))\r\n                {\r\n                    cryptostream.Write(toEncrypt, 0, toEncrypt.Length);\r\n                    cryptostream.Close();\r\n                }\r\n                result = ms.ToArray();\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static byte[] DecryptBytes(byte[] toDecrypt)\r\n        {\r\n            DESCryptoServiceProvider DES = new DESCryptoServiceProvider();\r\n            DES.Key = ASCIIEncoding.ASCII.GetBytes(_secretKey);\r\n            DES.IV = ASCIIEncoding.ASCII.GetBytes(_secretKey);\r\n            ICryptoTransform desdecrypt = DES.CreateDecryptor();\r\n\r\n            byte[] result;\r\n            using (MemoryStream memoryWriteStream = new MemoryStream())\r\n            {\r\n                memoryWriteStream.Write(toDecrypt, 0, toDecrypt.Length);\r\n                memoryWriteStream.Position = 0;\r\n\r\n                using (CryptoStream cryptostreamDecr = new CryptoStream(memoryWriteStream, desdecrypt, CryptoStreamMode.Read))\r\n                {\r\n                    using (Stream memoryReadStream = new MemoryStream())\r\n                    {\r\n                        int size = 2048;\r\n                        byte[] data = new byte[2048];\r\n                        while (true)\r\n                        {\r\n                            size = cryptostreamDecr.Read(data, 0, data.Length);\r\n                            if (size > 0)\r\n                            {\r\n                                memoryReadStream.Write(data, 0, size);\r\n                            }\r\n                            else\r\n                            {\r\n                                break;\r\n                            }\r\n                        }\r\n\r\n                        result = new byte[memoryReadStream.Length];\r\n                        memoryReadStream.Position = 0;\r\n                        memoryReadStream.Read(result, 0, (int)memoryReadStream.Length);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/DataHookMapper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal sealed class DataHookMapper<T>\r\n        where T : class, IData\r\n    {\r\n        private EntityTokenHook _currentEntityTokenHook;\r\n\r\n        private EntityToken ParentEntityToken { get; set; }\r\n\r\n        public DataHookMapper(EntityToken parentEntityToken)\r\n        {\r\n            if (parentEntityToken == null) throw new ArgumentNullException(\"parentEntityToken\");\r\n\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd<T>(OnDataAddedOrDeleted, false);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<T>(OnDataAddedOrDeleted, false);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<T>(OnStoreChanged, false);\r\n\r\n            this.ParentEntityToken = parentEntityToken;\r\n        }\r\n\r\n\r\n\r\n        public EntityTokenHook CurrentEntityTokenHook\r\n        {\r\n            get\r\n            {\r\n                if (_currentEntityTokenHook == null)\r\n                {\r\n                    UpdateCurrentEntityTokenHook();\r\n                }\r\n\r\n                return _currentEntityTokenHook;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void UpdateCurrentEntityTokenHook()\r\n        {\r\n            EntityTokenHook entityTokenHook = new EntityTokenHook(this.ParentEntityToken);\r\n\r\n            List<T> datas = DataFacade.GetData<T>().ToList();\r\n            foreach (T data in datas)\r\n            {\r\n                entityTokenHook.AddHookie(data.GetDataEntityToken());\r\n            }\r\n\r\n            _currentEntityTokenHook = entityTokenHook;\r\n        }\r\n\r\n\r\n        private void OnStoreChanged(object sender, StoreEventArgs dataEventArgs)\r\n        {\r\n            if (!dataEventArgs.DataEventsFired)\r\n            {\r\n                HookingFacade.RemoveHook(this.CurrentEntityTokenHook);\r\n                UpdateCurrentEntityTokenHook();\r\n                HookingFacade.AddHook(this.CurrentEntityTokenHook);\r\n            }\r\n        }      \r\n\r\n        private void OnDataAddedOrDeleted(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            HookingFacade.RemoveHook(this.CurrentEntityTokenHook);\r\n\r\n            UpdateCurrentEntityTokenHook();\r\n\r\n            HookingFacade.AddHook(this.CurrentEntityTokenHook);\r\n        }      \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/DataSecurityAncestorProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal sealed class DataSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n\r\n            if (dataEntityToken == null) throw new ArgumentException(string.Format(\"The type of the entityToken should be of type {0}\", typeof(DataEntityToken)), \"entityToken\");\r\n\r\n            IData data = dataEntityToken.Data;\r\n            if(data == null) return null; // A piece of data may be deleted to this point\r\n\r\n            using (new DataScope(data.DataSourceId.DataScopeIdentifier, data.DataSourceId.LocaleScope))\r\n            {\r\n                IData parent = DataAncestorFacade.GetParent(dataEntityToken.Data);\r\n                if (parent == null)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                return new List<EntityToken> { parent.GetDataEntityToken() };                \r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/EntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Text;\r\nusing Composite.Core.Serialization;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal class EntityTokenSerializerHandler : ISerializerHandler\r\n    {\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            return EntityTokenSerializer.Serialize((EntityToken)objectToSerialize);\r\n        }\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            return EntityTokenSerializer.Deserialize(serializedObject);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// EntityToken is used through out C1 CMS to describe artifacts that can have security settings. Also see <see cref=\"Composite.Data.DataEntityToken\"/>.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// When subclassing this class and adding properties that have an impact when identity (equality)\r\n    /// of the subclass, remember to overload Equal and GetHashCode!\r\n    /// </remarks>\r\n    [DebuggerDisplay(\"Type = {Type}, Source = {Source}, Id = {Id}\")]\r\n    [SerializerHandler(typeof(EntityTokenSerializerHandler))]\r\n    public abstract class EntityToken\r\n    {\r\n        private bool _entityTokenUniquenessValidated;\r\n\r\n        /// <summary>\r\n        /// A string that forms one third of the unique key for the entity being represented. Being the 'type' part of the globally unique key 'type/source/id', \r\n        /// this value should be unique for your code and not clash with 'type' strings used in other code modules.\r\n        /// </summary>\r\n        public abstract string Type { get; }\r\n\r\n        /// <summary>\r\n        /// A string that forms one third of the unique key for the entity being represented. Being the 'source' part of the globally unique key 'type/source/id', \r\n        /// this value should be unique the source (like a file name or sql connection) when whence the entity come. This field is only important if enteties of \r\n        /// this type can come from different sources.\r\n        /// </summary>\r\n        public abstract string Source { get; }\r\n\r\n        /// <summary>\r\n        /// A string that forms one third of the unique key for the entity being represented. Being the 'id' part of the globally unique key 'type/source/id', \r\n        /// this value should identify a specific entity of the given 'type' from the given 'source'.\r\n        /// </summary>\r\n        public abstract string Id { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// The state of the EntityToken. Invalid entity tokens will be automatically removed from the system.\r\n        /// </summary>\r\n        /// <returns>The state of the EntityToken.</returns>\r\n        public virtual bool IsValid() => true;\r\n\r\n\r\n        /// <summary>\r\n        /// Serialize the EntityToken\r\n        /// </summary>\r\n        /// <returns>a string representation of the entity token</returns>\r\n        public abstract string Serialize();\r\n\r\n        /// <exclude />\r\n        protected void DoSerialize(StringBuilder stringBuilder)\r\n        {\r\n            StringConversionServices.SerializeKeyValuePair(stringBuilder, \"_EntityToken_Type_\", Type);\r\n            StringConversionServices.SerializeKeyValuePair(stringBuilder, \"_EntityToken_Source_\", Source);\r\n            StringConversionServices.SerializeKeyValuePair(stringBuilder, \"_EntityToken_Id_\", Id);\r\n        }\r\n\r\n        /// <exclude />\r\n        protected string DoSerialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(\r\n                new Dictionary<string, string>() {{nameof(Type), Type},\r\n                    { nameof(Source), Source}, {nameof(Id), Id}});\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected static void DoDeserialize(string serializedEntityToken, out string type, out string source, out string id)\r\n        {\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id, \r\n                          out Dictionary<string, string> _);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected static void DoDeserialize(string serializedEntityToken, out string type, out string source, out string id, out Dictionary<string, string> dictionary)\r\n        {\r\n            if (!CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                DoDeserializeLegacy(serializedEntityToken, out type, out source, out id, out dictionary);\r\n                return;\r\n            }\r\n\r\n            var properties = CompositeJsonSerializer.Deserialize<Dictionary<string, string>>(serializedEntityToken);\r\n\r\n            if (!properties.TryGetValue(nameof(Type), out type)\r\n                || !properties.TryGetValue(nameof(Source), out source)\r\n                || !properties.TryGetValue(nameof(Id), out id))\r\n            {\r\n                throw new ArgumentException(\"Is not a serialized entity token\", nameof(serializedEntityToken));\r\n            }\r\n\r\n            properties.Remove(nameof(Type));\r\n            properties.Remove(nameof(Source));\r\n            properties.Remove(nameof(Id));\r\n\r\n            dictionary = properties;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        private static void DoDeserializeLegacy(string serializedEntityToken, out string type, out string source, out string id, out Dictionary<string, string> dic)\r\n        {\r\n            dic = StringConversionServices.ParseKeyValueCollection(serializedEntityToken);\r\n            \r\n            if (!dic.TryGetValue(\"_EntityToken_Type_\", out string serializedType) ||\r\n                !dic.TryGetValue(\"_EntityToken_Source_\", out string serializedSource) ||\r\n                !dic.TryGetValue(\"_EntityToken_Id_\", out string serializedId))\r\n            {\r\n                throw new ArgumentException(\"Is not a serialized entity token\", nameof(serializedEntityToken));\r\n            }\r\n\r\n            type = StringConversionServices.DeserializeValueString(serializedType);\r\n            source = StringConversionServices.DeserializeValueString(serializedSource);\r\n            id = StringConversionServices.DeserializeValueString(serializedId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected int HashCode { get; set; }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public virtual string GetPrettyHtml(Dictionary<string, string> piggybag)\r\n        {\r\n            var entityTokenHtmlPrettyfier = new EntityTokenHtmlPrettyfier(this, piggybag);\r\n\r\n            OnGetPrettyHtml(entityTokenHtmlPrettyfier);\r\n\r\n            return entityTokenHtmlPrettyfier.GetResult();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public virtual string OnGetTypePrettyHtml() => this.Type;\r\n\r\n        /// <exclude />\r\n        public virtual string OnGetSourcePrettyHtml() => this.Source;\r\n\r\n        /// <exclude />\r\n        public virtual string OnGetIdPrettyHtml() => this.Id;\r\n\r\n        /// <exclude />\r\n        public virtual string OnGetExtraPrettyHtml() => null;\r\n\r\n\r\n        /// <exclude />\r\n        public virtual void OnGetPrettyHtml(EntityTokenHtmlPrettyfier entityTokenHtmlPrettyfier) { }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return obj is EntityToken entityToken\r\n                   && entityToken.GetVersionHashCode() == GetVersionHashCode()\r\n                   && entityToken.VersionId == this.VersionId \r\n                   && EqualsWithVersionIgnore(entityToken);\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool EqualsWithVersionIgnore(object obj)\r\n        {\r\n            var entityToken = obj as EntityToken;\r\n\r\n            if (entityToken == null) return false;\r\n\r\n            ValidateEntityToken();\r\n\r\n            return entityToken.GetHashCode() == GetHashCode() &&\r\n                   entityToken.Id == this.Id &&\r\n                   entityToken.Type == this.Type &&\r\n                   entityToken.Source == this.Source &&\r\n                   entityToken.GetType() == this.GetType();\r\n        }\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public virtual string VersionId { get; } = \"\";\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(EntityToken entityToken)\r\n        {\r\n            return Equals(entityToken as object);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            if (this.HashCode == 0)\r\n            {\r\n                ValidateEntityToken();\r\n                this.HashCode = this.Type.GetHashCode() ^ this.Source.GetHashCode() ^ this.Id.GetHashCode();\r\n            }\r\n\r\n            return this.HashCode;\r\n        }\r\n\r\n        /// <exclude />\r\n        public int GetVersionHashCode()\r\n        {\r\n            if (this.VersionHashCode == 0)\r\n            {\r\n                this.VersionHashCode = this.VersionId.GetHashCode();\r\n            }\r\n\r\n            return this.VersionHashCode;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected int VersionHashCode { get; set; }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return $\"Source = {this.Source}, Type = {this.Type}, Id = {this.Id}\";\r\n        }\r\n\r\n\r\n\r\n        private void ValidateEntityToken()\r\n        {\r\n            if (_entityTokenUniquenessValidated) return;\r\n\r\n            _entityTokenUniquenessValidated = true;\r\n\r\n            if (string.IsNullOrEmpty(this.Type) &&\r\n                string.IsNullOrEmpty(this.Source) &&\r\n                string.IsNullOrEmpty(this.Id))\r\n            {\r\n                ThrowNotUniqueException();\r\n            }\r\n        }\r\n\r\n        private void ThrowNotUniqueException()\r\n        {\r\n            throw new InvalidOperationException($\"EntityTokens should be unique for the given element. The properties Type, Source and Id may not all be empty string. This is not the case for this type {GetType()}\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/EntityTokenCacheFacade.cs",
    "content": "﻿//#define DISABLE_ENTITYTOKEN_CACHE\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Concurrent;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Users;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class EntityTokenCacheFacade\r\n    {\r\n        private sealed class CacheKey\r\n        {\r\n            public string Username { get; set; }\r\n            public EntityToken EntityToken { get; set; }\r\n            public CultureInfo Locale { get; set; }\r\n\r\n\r\n            public override bool Equals(object obj)\r\n            {\r\n                return Equals(obj as CacheKey);\r\n            }\r\n\r\n\r\n            public bool Equals(CacheKey cacheKey)\r\n            {\r\n                if (cacheKey == null) return false;\r\n\r\n                return\r\n                    cacheKey.Username.Equals(this.Username) &&\r\n                    cacheKey.EntityToken.Equals(this.EntityToken) &&\r\n                    cacheKey.Locale.Equals(this.Locale);\r\n            }\r\n\r\n\r\n            public override int GetHashCode()\r\n            {\r\n                return this.Username.GetHashCode() ^ this.EntityToken.GetHashCode() ^ this.Locale.GetHashCode();\r\n            }\r\n        }\r\n\r\n\r\n        private static ConcurrentDictionary<CacheKey, CacheEntry> _nativeCache = new ConcurrentDictionary<CacheKey, CacheEntry>();\r\n        private static ConcurrentDictionary<CacheKey, CacheEntry> _hookingCache = new ConcurrentDictionary<CacheKey, CacheEntry>();\r\n\r\n        private static bool Enabled { get; set; }\r\n        private static int MaxSize { get; set; }\r\n\r\n\r\n\r\n        private const int DefaultSize = 50000;\r\n\r\n\r\n        static EntityTokenCacheFacade()\r\n        {\r\n            CachingSettings cachingSettings = GlobalSettingsFacade.GetNamedCaching(\"Entity token parents\");\r\n            Enabled = cachingSettings.Enabled;\r\n            MaxSize = cachingSettings.GetSize(DefaultSize);\r\n\r\n#if DISABLE_ENTITYTOKEN_CACHE\r\n            Enabled = false;\r\n#endif\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AddNativeCache(EntityToken entityToken, IEnumerable<EntityToken> parentEntityTokens)\r\n        {\r\n            if (!Enabled || !UserValidationFacade.IsLoggedIn()) return;\r\n\r\n            CacheEntry cacheEntry = new CacheEntry(entityToken)\r\n            {\r\n                ParentEntityTokens = parentEntityTokens.EvaluateOrNull(),\r\n                Timestamp = DateTime.Now\r\n            };\r\n\r\n            CacheKey cacheKey = new CacheKey { Username = ResolveUsername(), EntityToken = entityToken, Locale = Data.LocalizationScopeManager.CurrentLocalizationScope };\r\n\r\n            _nativeCache.TryAdd(cacheKey, cacheEntry);\r\n\r\n            if (_nativeCache.Count > MaxSize)\r\n            {\r\n                _nativeCache = new ConcurrentDictionary<CacheKey, CacheEntry>();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AddHookingCache(EntityToken entityToken, IEnumerable<EntityToken> parentEntityTokens)\r\n        {\r\n            if (!Enabled || !UserValidationFacade.IsLoggedIn()) return;\r\n\r\n            CacheEntry cacheEntry = new CacheEntry(entityToken)\r\n            {\r\n                ParentEntityTokens = parentEntityTokens.EvaluateOrNull(),\r\n                Timestamp = DateTime.Now\r\n            };\r\n\r\n            CacheKey cacheKey = new CacheKey { Username = ResolveUsername(), EntityToken = entityToken, Locale = Data.LocalizationScopeManager.CurrentLocalizationScope };\r\n\r\n            _hookingCache.TryAdd(cacheKey, cacheEntry);\r\n\r\n            if (_hookingCache.Count > MaxSize)\r\n            {\r\n                _hookingCache = new ConcurrentDictionary<CacheKey, CacheEntry>();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool GetCachedNativeParents(EntityToken entityToken, out IEnumerable<EntityToken> parentEntityTokens)\r\n        {\r\n            if (!Enabled)\r\n            {\r\n                parentEntityTokens = null;\r\n                return false;\r\n            }\r\n\r\n            string userName = UserValidationFacade.IsLoggedIn() ? ResolveUsername() : null;\r\n\r\n            return GetCachedNativeParents(entityToken, out parentEntityTokens, userName);\r\n        }\r\n\r\n\r\n\r\n        internal static bool GetCachedNativeParents(EntityToken entityToken, out IEnumerable<EntityToken> parentEntityTokens, string userName)\r\n        {\r\n            if (!Enabled || userName == null)\r\n            {\r\n                parentEntityTokens = null;\r\n                return false;\r\n            }\r\n\r\n            CacheKey cacheKey = new CacheKey { Username = userName, EntityToken = entityToken, Locale = Data.LocalizationScopeManager.CurrentLocalizationScope };\r\n\r\n            CacheEntry cacheEntry;\r\n            if (_nativeCache.TryGetValue(cacheKey, out cacheEntry))\r\n            {\r\n                PerformanceCounterFacade.EntityTokenParentCacheHitIncrement();\r\n                parentEntityTokens = cacheEntry.ParentEntityTokens;\r\n                return true;\r\n            }\r\n            \r\n            PerformanceCounterFacade.EntityTokenParentCacheMissIncrement();\r\n            parentEntityTokens = null;\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool GetCachedHookingParents(EntityToken entityToken, out IEnumerable<EntityToken> parentEntityTokens)\r\n        {\r\n            if (!Enabled)\r\n            {\r\n                parentEntityTokens = null;\r\n                return false;\r\n            }\r\n\r\n            string userName = UserValidationFacade.IsLoggedIn() ? ResolveUsername() : null;\r\n\r\n            return GetCachedHookingParents(entityToken, out parentEntityTokens, userName);\r\n        }\r\n\r\n\r\n\r\n        internal static bool GetCachedHookingParents(EntityToken entityToken, out IEnumerable<EntityToken> parentEntityTokens, string userName)\r\n        {\r\n            if (!Enabled || userName == null)\r\n            {\r\n                parentEntityTokens = null;\r\n                return false;\r\n            }\r\n\r\n            CacheKey cacheKey = new CacheKey { Username = userName, EntityToken = entityToken, Locale = Data.LocalizationScopeManager.CurrentLocalizationScope };\r\n\r\n            CacheEntry cacheEntry;\r\n            if (_hookingCache.TryGetValue(cacheKey, out cacheEntry))\r\n            {\r\n                PerformanceCounterFacade.EntityTokenParentCacheHitIncrement();\r\n                parentEntityTokens = cacheEntry.ParentEntityTokens;\r\n                return true;\r\n            }\r\n            \r\n            PerformanceCounterFacade.EntityTokenParentCacheMissIncrement();\r\n            parentEntityTokens = null;\r\n            return false;\r\n            \r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ClearCache(EntityToken entityToken)\r\n        {\r\n            if (!Enabled)\r\n            {\r\n                return;\r\n            }\r\n\r\n            string userName = UserValidationFacade.IsLoggedIn() ? ResolveUsername() : null;\r\n\r\n            ClearCache(entityToken, userName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ClearCache(EntityToken entityToken, string userName)\r\n        {\r\n            if (!Enabled || userName == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var cacheKey = new CacheKey { Username = userName, EntityToken = entityToken, Locale = Data.LocalizationScopeManager.CurrentLocalizationScope };\r\n\r\n            CacheEntry nativeCacheEntry;\r\n            _nativeCache.TryRemove(cacheKey, out nativeCacheEntry);\r\n\r\n            CacheEntry hookingCacheEntry;\r\n            _hookingCache.TryRemove(cacheKey, out hookingCacheEntry);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ClearCache()\r\n        {\r\n            _nativeCache = new ConcurrentDictionary<CacheKey, CacheEntry>();\r\n            _hookingCache = new ConcurrentDictionary<CacheKey, CacheEntry>();\r\n        }\r\n\r\n\r\n\r\n        private static string ResolveUsername()\r\n        {\r\n            return UserSettings.Username;\r\n        }\r\n\r\n\r\n        private sealed class CacheEntry\r\n        {\r\n            public CacheEntry(EntityToken entityToken)\r\n            {\r\n                this.EntityToken = entityToken;\r\n            }\r\n\r\n\r\n            public EntityToken EntityToken { get; private set; }\r\n            public DateTime Timestamp { get; set; }\r\n            public IEnumerable<EntityToken> ParentEntityTokens { get; set; }\r\n\r\n\r\n\r\n\r\n            public override int GetHashCode()\r\n            {\r\n                return this.EntityToken.GetHashCode();\r\n            }\r\n\r\n\r\n\r\n            public override bool Equals(object obj)\r\n            {\r\n                bool result = Equals(obj as CacheEntry);\r\n\r\n                return result;\r\n            }\r\n\r\n\r\n            public bool Equals(CacheEntry obj)\r\n            {\r\n                if (obj == null) return false;\r\n\r\n                bool result = this.EntityToken.Equals(obj.EntityToken);\r\n\r\n                return result;\r\n            }\r\n\r\n\r\n            public override string ToString()\r\n            {\r\n                return this.EntityToken.ToString();\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Security/EntityTokenHook.cs",
    "content": "using System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"Hooker = {Hooker}\")]\r\n\tpublic sealed class EntityTokenHook\r\n\t{\r\n        private List<EntityToken> _hooks = new List<EntityToken>();\r\n\r\n\r\n        /// <exclude />\r\n        public EntityTokenHook(EntityToken hooker)\r\n        {\r\n            Verify.ArgumentNotNull(hooker, \"hooker\");\r\n\r\n            this.Hooker = hooker;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public EntityToken Hooker\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<EntityToken> Hookies\r\n        {\r\n            get\r\n            {\r\n                return _hooks;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddHookie(EntityToken hook)\r\n        {\r\n            Verify.ArgumentNotNull(hook, \"hook\");\r\n\r\n            _hooks.Add(hook);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddHookies(IEnumerable<EntityToken> hooks)\r\n        {\r\n            Verify.ArgumentNotNull(hooks, \"hooks\");\r\n\r\n            IEnumerable<EntityToken> resolvedHooks = hooks.Evaluate();\r\n\r\n            Verify.ArgumentCondition(!resolvedHooks.Contains(null), \"hooks\", \"The collection contains one or more null values\");\r\n\r\n            _hooks.AddRange(resolvedHooks);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/EntityTokenHtmlPrettyfier.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class EntityTokenHtmlPrettyfier\r\n    {\r\n        private Dictionary<string, Action<string, object, EntityTokenHtmlPrettyfierHelper>> _customProperties = new Dictionary<string, Action<string, object, EntityTokenHtmlPrettyfierHelper>>();\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> PiggyBag { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public EntityTokenHtmlPrettyfier(EntityToken entityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            this.EntityToken = entityToken;\r\n            this.PiggyBag = piggybag;\r\n        }\r\n\r\n\r\n        private static string Strong(string text)\r\n        {\r\n            return \"<b>\" + HttpUtility.HtmlEncode(text) + \"</b>\";\r\n        }\r\n\r\n        internal static string GetTypeHtml(Type type)\r\n        {\r\n            return GetTypeHtml(type.FullName); \r\n        }\r\n\r\n        internal static string GetTypeHtml(string fullTypeName)\r\n        {\r\n            int dotIndex = fullTypeName.LastIndexOf(\".\", StringComparison.Ordinal);\r\n\r\n            if (dotIndex <= 0)\r\n            {\r\n                return fullTypeName;\r\n            }\r\n            \r\n            return \"<span style=\\\"color: #A0A0A0\\\">\" + fullTypeName.Substring(0, dotIndex + 1) + \"</span>\" + fullTypeName.Substring(dotIndex + 1);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Action<EntityToken, EntityTokenHtmlPrettyfierHelper> DefaultOnWriteEntityTokenType = \r\n            (token, helper) => helper.AddFullRow(new [] { Strong(\"EntityToken\"), GetTypeHtml( token.GetType() ) });\r\n\r\n        /// <exclude />\r\n        public static Action<EntityToken, EntityTokenHtmlPrettyfierHelper> DefaultOnWriteType = \r\n            (token, helper) => helper.AddFullRow(new [] { Strong(\"Type\"), GetTypeHtml( token.Type )});\r\n\r\n        /// <exclude />\r\n        public static Action<EntityToken, EntityTokenHtmlPrettyfierHelper> DefaultOnWriteSource = \r\n            (token, helper) => helper.AddFullRow(new [] { Strong(\"Source\"), token.Source });\r\n\r\n        /// <exclude />\r\n        public static Action<EntityToken, EntityTokenHtmlPrettyfierHelper> DefaultOnWriteId = \r\n            (token, helper) => helper.AddFullRow(new [] { Strong(\"Id\"), token.Id });\r\n\r\n        /// <exclude />\r\n        public static Action<string, object, EntityTokenHtmlPrettyfierHelper> DefaultOnWriteCustomProperty = \r\n            (name, value, helper) => helper.AddFullRow(new [] { Strong(name), value.ToString() });\r\n\r\n        /// <exclude />\r\n        public static Action<string, string, EntityTokenHtmlPrettyfierHelper> DefaultOnPiggyBagEntry = \r\n            (key, value, helper) => {\r\n                string valueStr = value;\r\n\r\n                if (key.StartsWith(\"ParentEntityToken\"))\r\n                {\r\n                    EntityToken et = EntityTokenSerializer.Deserialize(value);\r\n                    valueStr = string.Format(\"Type = {0}\", GetTypeHtml( et.GetType() ));\r\n                }\r\n\r\n                helper.AddFullRow(new[] { \"<b>\" + key + \"</b>\", valueStr });\r\n            };\r\n\r\n        /// <exclude />\r\n        public static Action<SecurityAncestorProviderAttribute, EntityTokenHtmlPrettyfierHelper> DefaultOnWriteSecurityAncestorProvider =\r\n            (attribute, helper) => helper.AddFullRow(new[] { \"<b>Type</b>\", GetTypeHtml(attribute.GetType()) });\r\n\r\n        /// <exclude />\r\n        public static Action<IAuxiliarySecurityAncestorProvider, EntityTokenHtmlPrettyfierHelper> DefaultOnWriteAuxiliarySecurityAncestorProvider =\r\n            (provider, helper) => helper.AddFullRow(new[] { \"<b>Type</b>\", GetTypeHtml(provider.GetType()) });\r\n\r\n        /// <exclude />\r\n        public Action<EntityToken, EntityTokenHtmlPrettyfierHelper> OnWriteEntityTokenType = DefaultOnWriteEntityTokenType;\r\n\r\n        /// <exclude />\r\n        public Action<EntityToken, EntityTokenHtmlPrettyfierHelper> OnWriteType = DefaultOnWriteType;\r\n\r\n        /// <exclude />\r\n        public Action<EntityToken, EntityTokenHtmlPrettyfierHelper> OnWriteSource = DefaultOnWriteSource;\r\n\r\n        /// <exclude />\r\n        public Action<EntityToken, EntityTokenHtmlPrettyfierHelper> OnWriteId = DefaultOnWriteId;\r\n\r\n        /// <exclude />\r\n        public static Action<string, object, EntityTokenHtmlPrettyfierHelper> OnWriteCustomProperty = DefaultOnWriteCustomProperty;\r\n\r\n        /// <exclude />\r\n        public Action<string, string, EntityTokenHtmlPrettyfierHelper> OnPiggyBagEntry = DefaultOnPiggyBagEntry;\r\n\r\n        /// <exclude />\r\n        public Action<SecurityAncestorProviderAttribute, EntityTokenHtmlPrettyfierHelper> OnWriteSecurityAncestorProvider = DefaultOnWriteSecurityAncestorProvider;\r\n\r\n        /// <exclude />\r\n        public Action<IAuxiliarySecurityAncestorProvider, EntityTokenHtmlPrettyfierHelper> OnWriteAuxiliarySecurityAncestorProvider = DefaultOnWriteAuxiliarySecurityAncestorProvider;\r\n\r\n\r\n        /// <exclude />\r\n        public void AddCustomSimpleProperty(string propertyName)\r\n        {\r\n            _customProperties.Add(propertyName, DefaultOnWriteCustomProperty);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddCustomProperty(string propertyName, Action<string, object, EntityTokenHtmlPrettyfierHelper> onWriteAction)\r\n        {\r\n            _customProperties.Add(propertyName, onWriteAction);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string GetResult()\r\n        {\r\n            EntityTokenHtmlPrettyfierHelper helper = new EntityTokenHtmlPrettyfierHelper();\r\n\r\n            helper.StartTable();\r\n            helper.AddHeading(\"<b>Basic Information</b>\");\r\n            OnWriteEntityTokenType(this.EntityToken, helper);\r\n            OnWriteType(this.EntityToken, helper);\r\n            OnWriteSource(this.EntityToken, helper);\r\n            OnWriteId(this.EntityToken, helper);\r\n\r\n            var extraInfo = EntityToken.OnGetExtraPrettyHtml();\r\n            if (!extraInfo.IsNullOrEmpty())\r\n            {\r\n                helper.AddFullRow(new[] { \"<b>Extra</b>\", extraInfo });\r\n            }\r\n\r\n            helper.AddHeading(\"<b>Custom Properties</b>\");\r\n            foreach (var kvp in _customProperties)\r\n            {\r\n                PropertyInfo propertyInfo = this.EntityToken.GetType().GetPropertiesRecursively().Single(f => f.Name == kvp.Key);\r\n                kvp.Value(kvp.Key, propertyInfo.GetValue(this.EntityToken, null), helper);\r\n            }\r\n\r\n\r\n            helper.AddHeading(\"<b>Piggybag</b>\");\r\n            foreach (var kvp in this.PiggyBag)\r\n            {\r\n                OnPiggyBagEntry(kvp.Key, kvp.Value, helper);\r\n            }\r\n\r\n            helper.AddHeading(\"<b>SecurityAncestorProvider</b>\");\r\n            SecurityAncestorProviderAttribute attribute = this.EntityToken.GetType().GetCustomAttributesRecursively<SecurityAncestorProviderAttribute>().SingleOrDefault();\r\n            OnWriteSecurityAncestorProvider(attribute, helper);\r\n\r\n\r\n            helper.AddHeading(\"<b>AuxiliarySecurityAncestorProviders</b>\");\r\n            foreach (IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider in AuxiliarySecurityAncestorFacade.GetAuxiliaryAncestorProviders(this.EntityToken.GetType()))\r\n            {\r\n                OnWriteAuxiliarySecurityAncestorProvider(auxiliarySecurityAncestorProvider, helper);\r\n            }\r\n\r\n            helper.EndTable();\r\n\r\n            return helper.GetResult();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/EntityTokenHtmlPrettyfierHelper.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class EntityTokenHtmlPrettyfierHelper\r\n    {\r\n        private StringBuilder _stringBuilder = new StringBuilder();\r\n\r\n\r\n        /// <exclude />\r\n        public void StartTable()\r\n        {\r\n            _stringBuilder.AppendLine(@\"<table style=\"\"empty-cells: show; padding: 10px; margin: 10px; border-collapse: collapse; border: 1px solid black;\"\">\");\r\n        }\r\n\r\n        /// <exclude />\r\n        public void EndTable()\r\n        {\r\n            _stringBuilder.AppendLine(@\"</table>\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void StartRow()\r\n        {\r\n            _stringBuilder.AppendLine(@\"<tr style=\"\"padding: 0px; margin: 0px; border: 1px solid black;\"\">\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void EndRow()\r\n        {\r\n            _stringBuilder.AppendLine(@\"</tr>\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddCell(string value)\r\n        {\r\n            AddCell(value, 1);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddCell(string value, int colspan, string backgroundColor = \"#ffffff\")\r\n        {\r\n            _stringBuilder.AppendLine(string.Format(@\"<td colspan=\"\"{0}\"\" style=\"\"background-color: {1}; vertical-align: top; border: 1px solid black; padding: 2px; margin: 0px;\"\">{2}</td>\", colspan, backgroundColor, value));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddFullRow(IEnumerable<string> values)\r\n        {\r\n            StartRow();\r\n\r\n            foreach (string value in values)\r\n            {\r\n                AddCell(value);\r\n            }\r\n\r\n            EndRow();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddHeading(string value)\r\n        {\r\n            StartRow();\r\n\r\n            _stringBuilder.AppendLine(string.Format(@\"<td colspan=\"\"2\"\" style=\"\"vertical-align: top; border: 1px solid black; padding: 6px; margin: 0px; font-size: 110%\"\">{0}</td>\", value));\r\n\r\n            EndRow();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string GetResult()\r\n        {\r\n            return _stringBuilder.ToString();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/EntityTokenSerializer.cs",
    "content": "using System;\r\nusing System.Reflection;\r\nusing System.Security;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.Core;\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class EntityTokenSerializer\r\n    {\r\n        /// <exclude />\r\n        public static string Serialize(EntityToken entityToken)\r\n        {\r\n            return Serialize(entityToken, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string Serialize(EntityToken entityToken, bool includeHashValue)\r\n        {\r\n            Verify.ArgumentNotNull(entityToken, \"entityToken\");\r\n\r\n            return CompositeJsonSerializer.Serialize(entityToken, includeHashValue);\r\n        }\r\n\r\n        \r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return Deserialize(serializedEntityToken, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken, bool includeHashValue)\r\n        {\r\n            if (string.IsNullOrEmpty(serializedEntityToken)) throw new ArgumentNullException(nameof(serializedEntityToken));\r\n\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                entityToken =\r\n                    CompositeJsonSerializer\r\n                        .Deserialize<EntityToken>(serializedEntityToken,\r\n                            includeHashValue);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedEntityToken, includeHashValue);\r\n                Log.LogVerbose(nameof(EntityTokenSerializer), entityToken.GetType().FullName);\r\n            }\r\n\r\n            if (entityToken == null)\r\n            {\r\n                throw new EntityTokenSerializerException($\"Deserialization function returned null value. EntityToken: '{serializedEntityToken}'\");\r\n            }\r\n\r\n            return entityToken;\r\n            \r\n            \r\n        }\r\n\r\n        private static EntityToken DeserializeLegacy(string serializedEntityToken, bool includeHashValue)\r\n        {\r\n            var dic = StringConversionServices.ParseKeyValueCollection(serializedEntityToken);\r\n\r\n            if (!dic.ContainsKey(\"entityTokenType\") ||\r\n                !dic.ContainsKey(\"entityToken\") ||\r\n                (includeHashValue && !dic.ContainsKey(\"entityTokenHash\")))\r\n            {\r\n                throw new ArgumentException(\"Failed to deserialize the value. Is has to be serialized with EntityTokenSerializer.\", nameof(serializedEntityToken));\r\n            }\r\n\r\n            string entityTokenTypeString = StringConversionServices.DeserializeValueString(dic[\"entityTokenType\"]);\r\n            string entityTokenString = StringConversionServices.DeserializeValueString(dic[\"entityToken\"]);\r\n\r\n            if (includeHashValue)\r\n            {\r\n                string entityTokenHash = StringConversionServices.DeserializeValueString(dic[\"entityTokenHash\"]);\r\n\r\n                HashValue hashValue = HashValue.Deserialize(entityTokenHash);\r\n                if (!HashSigner.ValidateSignedHash(entityTokenString, hashValue))\r\n                {\r\n                    throw new SecurityException(\"Serialized entity token is tampered\");\r\n                }\r\n            }\r\n\r\n            Type entityType = TypeManager.GetType(entityTokenTypeString);\r\n\r\n            MethodInfo methodInfo = entityType.GetMethod(\"Deserialize\", BindingFlags.Public | BindingFlags.Static);\r\n            if (methodInfo == null || !(typeof(EntityToken).IsAssignableFrom(methodInfo.ReturnType)))\r\n            {\r\n                throw new InvalidOperationException($\"The entity token {entityType} is missing a public static Deserialize method taking a string as parameter and returning an {typeof(EntityToken)}\");\r\n            }\r\n\r\n            EntityToken entityToken;\r\n            try\r\n            {\r\n                entityToken = (EntityToken)methodInfo.Invoke(null, new object[] { entityTokenString });\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new EntityTokenSerializerException($\"Failed to deserialize entity token '{serializedEntityToken}'\", ex);\r\n            }\r\n\r\n            if (entityToken == null)\r\n            {\r\n                throw new EntityTokenSerializerException($\"Deserialization function returned null value. EntityToken: '{serializedEntityToken}'\");\r\n            }\r\n\r\n            return entityToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static T Deserialize<T>(string serializedEntityToken)\r\n            where T : EntityToken\r\n        {\r\n            return (T)Deserialize(serializedEntityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/EntityTokenSerializerException.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal class EntityTokenSerializerException : Exception\r\n    {\r\n        public EntityTokenSerializerException(string message) : base(message)\r\n        {\r\n        }\r\n\r\n        public EntityTokenSerializerException(string message, Exception innerException) : base( message, innerException)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/HookRegistratorRegistry.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security.Plugins.HookRegistrator;\r\nusing Composite.C1Console.Security.Plugins.HookRegistrator.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation\r\n{\r\n    internal static class HookRegistratorRegistry\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitializeResources);\r\n\r\n        static HookRegistratorRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> HookRegistratorPluginNames\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.HookRegistratorPluginNames;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static bool HasConfiguration()\r\n        {\r\n            var configSource = ConfigurationServices.ConfigurationSource;\r\n\r\n            return configSource != null && configSource.GetSection(HookRegistratorSettings.SectionName) != null;\r\n        }\r\n\r\n\r\n\r\n        private static IConfigurationSource GetConfiguration()\r\n        {\r\n            IConfigurationSource source = ConfigurationServices.ConfigurationSource;\r\n\r\n            if (null == source)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"No configuration source specified\"));\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public List<string> HookRegistratorPluginNames { get; set; }\r\n\r\n            public static void DoInitializeResources(Resources resources)\r\n            {\r\n                if (HasConfiguration())\r\n                {\r\n                    resources.HookRegistratorPluginNames = new List<string>();\r\n\r\n                    IConfigurationSource configurationSource = GetConfiguration();\r\n\r\n                    var settings = configurationSource.GetSection(HookRegistratorSettings.SectionName) as HookRegistratorSettings;\r\n\r\n                    if (settings == null)\r\n                    {\r\n                        throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration\", HookRegistratorSettings.SectionName));\r\n                    }\r\n\r\n                    foreach (HookRegistratorData data in settings.HookRegistratorPlugins)\r\n                    {\r\n                        resources.HookRegistratorPluginNames.Add(data.Name);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    resources.HookRegistratorPluginNames = new List<string>();\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/PermissionTypeFacadeCaching.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Caching;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation\r\n{\r\n\tinternal static class PermissionTypeFacadeCaching\r\n\t{\r\n        private static readonly string CurrentPermissionTypeCachingKey = \"PermissionTypeFacadeCaching_CurrentPermissionTypeCachingKey\";\r\n        private static readonly string InheritedPermissionsTypeCachingKey = \"PermissionTypeFacadeCaching_InheritedPermissionsTypeCachingKey\";\r\n        private static readonly string UserPermissionTypeCachingKey = \"PermissionTypeFacadeCaching_UserPermissionTypeCachingKey\";\r\n        private static readonly string UserGroupPermissionTypeCachingKey = \"UserGroupPermissionTypeCachingKey_UserPermissionTypeCachingKey\";\r\n\r\n\r\n        public static IReadOnlyCollection<PermissionType> GetCurrentPermissionTypes(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            return GetFromCache(userToken, entityToken, CurrentPermissionTypeCachingKey);\r\n        }\r\n\r\n\r\n\r\n        public static void SetCurrentPermissionTypes(UserToken userToken, EntityToken entityToken, IReadOnlyCollection<PermissionType> permissionTypes)\r\n        {\r\n            SetToCache(userToken, entityToken, permissionTypes, CurrentPermissionTypeCachingKey);\r\n        }\r\n\r\n\r\n\r\n        public static IReadOnlyCollection<PermissionType> GetInheritedPermissionsTypes(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            return GetFromCache(userToken, entityToken, InheritedPermissionsTypeCachingKey);\r\n        }\r\n\r\n\r\n\r\n        public static void SetInheritedPermissionsTypes(UserToken userToken, EntityToken entityToken, IReadOnlyCollection<PermissionType> permissionTypes)\r\n        {\r\n            SetToCache(userToken, entityToken, permissionTypes, InheritedPermissionsTypeCachingKey);\r\n        }\r\n\r\n\r\n\r\n        public static IReadOnlyCollection<PermissionType> GetUserPermissionTypes(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            return GetFromCache(userToken, entityToken, UserPermissionTypeCachingKey);\r\n        }\r\n\r\n\r\n\r\n        public static void SetUserPermissionTypes(UserToken userToken, EntityToken entityToken, IReadOnlyCollection<PermissionType> permissionTypes)\r\n        {\r\n            SetToCache(userToken, entityToken, permissionTypes, UserPermissionTypeCachingKey);\r\n        }\r\n\r\n\r\n\r\n        public static IReadOnlyCollection<PermissionType> GetUserGroupPermissionTypes(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            return GetFromCache(userToken, entityToken, UserGroupPermissionTypeCachingKey);\r\n        }\r\n\r\n\r\n\r\n        public static void SetUserGroupPermissionTypes(UserToken userToken, EntityToken entityToken, IReadOnlyCollection<PermissionType> permissionTypes)\r\n        {\r\n            SetToCache(userToken, entityToken, permissionTypes, UserGroupPermissionTypeCachingKey);\r\n        }\r\n\r\n\r\n\r\n        public static bool CachingWorking\r\n        {\r\n            get\r\n            {\r\n                return RequestLifetimeCache.HasKey(UserPermissionTypeCachingKey) && RequestLifetimeCache.HasKey(UserGroupPermissionTypeCachingKey);\r\n            }\r\n        }\r\n\r\n\r\n        private static void SetToCache(UserToken userToken, EntityToken entityToken, IReadOnlyCollection<PermissionType> permissionTypes, object cachingKey)\r\n        {\r\n            // Using RequestLifetimeCache and there for no thread locking /MRJ\r\n\r\n            Dictionary<UserToken, Dictionary<EntityToken, IReadOnlyCollection<PermissionType>>> permissionTypeCache;\r\n\r\n            if (RequestLifetimeCache.HasKey(cachingKey))\r\n            {\r\n                permissionTypeCache = RequestLifetimeCache.TryGet<Dictionary<UserToken, Dictionary<EntityToken, IReadOnlyCollection<PermissionType>>>>(cachingKey);\r\n            }\r\n            else\r\n            {\r\n                permissionTypeCache = new Dictionary<UserToken, Dictionary<EntityToken, IReadOnlyCollection<PermissionType>>>();\r\n\r\n                RequestLifetimeCache.Add(cachingKey, permissionTypeCache);\r\n            }\r\n\r\n            Dictionary<EntityToken, IReadOnlyCollection<PermissionType>> entityTokenPermissionTypes;\r\n            if (!permissionTypeCache.TryGetValue(userToken, out entityTokenPermissionTypes))\r\n            {\r\n                entityTokenPermissionTypes = new Dictionary<EntityToken, IReadOnlyCollection<PermissionType>>();\r\n                permissionTypeCache.Add(userToken, entityTokenPermissionTypes);\r\n            }\r\n\r\n            if (!entityTokenPermissionTypes.ContainsKey(entityToken))\r\n            {\r\n                entityTokenPermissionTypes.Add(entityToken, permissionTypes);\r\n            }\r\n            else\r\n            {\r\n                entityTokenPermissionTypes[entityToken] = entityTokenPermissionTypes[entityToken].Concat(permissionTypes).Distinct().ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IReadOnlyCollection<PermissionType> GetFromCache(UserToken userToken, EntityToken entityToken, object cachingKey)\r\n        {\r\n            var permissionTypeCache = RequestLifetimeCache.TryGet<Dictionary<UserToken, Dictionary<EntityToken, IReadOnlyCollection<PermissionType>>>>(cachingKey);\r\n\r\n            if (permissionTypeCache == null || !permissionTypeCache.TryGetValue(userToken, out var entityTokenPermissionTypes))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            entityTokenPermissionTypes.TryGetValue(entityToken, out var permissionTypes);\r\n\r\n            return permissionTypes;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/PluginFacades/HookRegistratorPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security.Plugins.HookRegistrator;\r\nusing Composite.C1Console.Security.Plugins.HookRegistrator.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation.PluginFacades\r\n{\r\n    internal static class HookRegistratorPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        private static object _lock = new object();\r\n\r\n\r\n        static HookRegistratorPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<EntityTokenHook> GetHooks(string pluginName)\r\n        {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    return GetHookRegistratorProvider(pluginName).GetHooks();\r\n                }\r\n        }\r\n\r\n\r\n\r\n        private static IHookRegistrator GetHookRegistratorProvider(string pluginName)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                IHookRegistrator hookRegistrator;\r\n\r\n                if (_resourceLocker.Resources.HookRegistratorCache.TryGetValue(pluginName, out hookRegistrator) == false)\r\n                {\r\n                    try\r\n                    {\r\n                        hookRegistrator = _resourceLocker.Resources.Factory.Create(pluginName);\r\n\r\n                        _resourceLocker.Resources.HookRegistratorCache.Add(pluginName, hookRegistrator);\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n\r\n                return hookRegistrator;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw ex;\r\n\r\n            /*            ConfigurationErrorsException newEx = new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", LoginProviderSettings.SectionName), ex);\r\n                        if (ExceptionService.HandleException(newEx, Policy.Plugin) == HandleResult.Rethrow)\r\n                        {\r\n                            throw newEx;\r\n                        }*/\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public HookRegistratorFactory Factory { get; set; }\r\n            public Dictionary<string, IHookRegistrator> HookRegistratorCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new HookRegistratorFactory();\r\n                    resources.HookRegistratorCache = new Dictionary<string, IHookRegistrator>();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/PluginFacades/LoginProviderPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation.PluginFacades\r\n{\r\n    internal class LoginProviderPluginFacade\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitializeResources);\r\n\r\n\r\n\r\n        static LoginProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> AllUsernames\r\n        {\r\n            get\r\n            {\r\n                return _resourceLocker.Resources.Plugin.AllUsernames;\r\n            }\r\n        }\r\n\r\n\r\n        public static bool CanSetUserPassword\r\n        {\r\n            get\r\n            {\r\n                return _resourceLocker.Resources.Plugin.CanSetUserPassword;\r\n            }\r\n        }\r\n\r\n\r\n        public static bool CanAddNewUser\r\n        {\r\n            get\r\n            {\r\n                return _resourceLocker.Resources.Plugin.CanAddNewUser;\r\n            }\r\n        }\r\n\r\n\r\n        public static bool UsersExists\r\n        {\r\n            get\r\n            {\r\n                return _resourceLocker.Resources.Plugin.UsersExists;\r\n            }\r\n        }\r\n\r\n\r\n        public static LoginResult FormValidateUser(string userName, string password)\r\n        {\r\n            var validator = _resourceLocker.Resources.Plugin as IFormLoginProvider;\r\n\r\n            return validator.Validate(userName, password);\r\n        }\r\n\r\n\r\n        public static void FormSetUserPassword(string userName, string password)\r\n        {\r\n            var validator = _resourceLocker.Resources.Plugin as IFormLoginProvider;\r\n\r\n            validator.SetUserPassword(userName, password);\r\n        }\r\n\r\n\r\n        public static void FormAddNewUser(string userName, string password, string group, string email)\r\n        {\r\n            var validator = _resourceLocker.Resources.Plugin as IFormLoginProvider;\r\n\r\n            Verify.That(validator.CanAddNewUser, \"Login provider does not support adding users\");\r\n\r\n            validator.AddNewUser(userName, password, group, email);\r\n        }\r\n\r\n\r\n        public static bool WindowsValidateUser(string userName, string domainName)\r\n        {\r\n            var validator = _resourceLocker.Resources.Plugin as IWindowsLoginProvider;\r\n\r\n            return validator.Validate(userName, domainName);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a Type object containing the type of the current plugin\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static bool CheckType<T>()\r\n        {\r\n            return _resourceLocker.Resources.Plugin is T;\r\n        }\r\n\r\n\r\n\r\n        public static Type GetValidationPluginType()\r\n        {\r\n            return _resourceLocker.Resources.Plugin.GetType();\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", LoginProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public LoginProviderFactory Factory { get; set; }\r\n            public ILoginProvider Plugin { get; set; }\r\n\r\n            public static void DoInitializeResources(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new LoginProviderFactory();\r\n                    resources.Plugin = resources.Factory.CreateDefault();                    \r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/PluginFacades/LoginSessionStorePluginFacade.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Net;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security.BuildinPlugins.BuildinLoginSessionStore;\r\nusing Composite.C1Console.Security.Plugins.LoginSessionStore;\r\nusing Composite.C1Console.Security.Plugins.LoginSessionStore.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation.PluginFacades\r\n{\r\n    internal class LoginSessionStorePluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitializeResources);\r\n\r\n\r\n\r\n        static LoginSessionStorePluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static bool HasConfiguration()\r\n        {\r\n            return ConfigurationServices.ConfigurationSource?.GetSection(LoginSessionStoreSettings.SectionName) != null;\r\n        }\r\n\r\n\r\n\r\n        public static bool CanPersistAcrossSessions\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.Provider.CanPersistAcrossSessions;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static void StoreUsername(string userName, bool persistAcrossSessions)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                _resourceLocker.Resources.Provider.StoreUsername(userName, persistAcrossSessions);\r\n            }\r\n        }\r\n\r\n\r\n        public static string Logout()\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                var provider = _resourceLocker.Resources.Provider;\r\n\r\n                provider.FlushUsername();\r\n\r\n                return (provider as ILoginSessionStoreRedirectedLogout)?.LogoutUrl;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string StoredUsername => _resourceLocker.Resources.Provider.StoredUsername;\r\n\r\n\r\n        public static IPAddress UserIpAddress\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.Provider.UserIpAddress;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException($\"Failed to load the configuration section '{LoginSessionStoreSettings.SectionName}' from the configuration.\", ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            private LoginSessionStoreFactory Factory { get; set; }\r\n            public ILoginSessionStore Provider { get; private set; }\r\n\r\n            public static void DoInitializeResources(Resources resources)\r\n            {\r\n                if (LoginSessionStorePluginFacade.HasConfiguration())\r\n                {\r\n                    try\r\n                    {\r\n                        resources.Factory = new LoginSessionStoreFactory();\r\n                        resources.Provider = resources.Factory.CreateDefault();\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n                else if (RuntimeInformation.IsUnittest)\r\n                {\r\n                    // This is a fallback for unittests\r\n                    resources.Provider = new BuildinLoginSessionStore();\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/PluginFacades/PasswordRulePluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security.Plugins.PasswordPolicy;\r\nusing Composite.C1Console.Security.Plugins.PasswordPolicy.Runtime;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation.PluginFacades\r\n{\r\n    internal static class PasswordRulePluginFacade\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitializeResources);\r\n\r\n\r\n        static PasswordRulePluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n        /// <summary>\r\n        /// Validates the password against the rules defined in the configuration.\r\n        /// </summary>\r\n        /// <param name=\"user\"></param>\r\n        /// <param name=\"password\"></param>\r\n        /// <param name=\"validationMessages\"></param>\r\n        /// <returns></returns>\r\n        public static bool ValidatePassword(IUser user, string password, out IList<string> validationMessages)\r\n        {\r\n            bool isValid = true;\r\n            validationMessages = new List<string>();\r\n\r\n            foreach (var rule in _resourceLocker.Resources.PasswordRules)\r\n            {\r\n                if (!rule.ValidatePassword(user, password))\r\n                {\r\n                    isValid = false;\r\n                    validationMessages.Add(rule.GetRuleDescription());\r\n                }\r\n            }\r\n\r\n            return isValid;\r\n        }\r\n\r\n        public static int PasswordExpirationTimeInDays\r\n        {\r\n            get\r\n            {\r\n                var settings = GetSettings();\r\n                return settings?.PasswordExpirationTimeInDays ?? 0;\r\n            }\r\n        }\r\n\r\n        public static int PasswordHistoryLength\r\n        {\r\n            get\r\n            {\r\n                var settings = GetSettings();\r\n                return settings?.PasswordHistoryLength ?? 0;\r\n            }\r\n        }\r\n        \r\n        private static PasswordPolicySettings GetSettings()\r\n        {\r\n            var configuration = ConfigurationServices.ConfigurationSource;\r\n\r\n            return configuration?.GetSection(PasswordPolicySettings.SectionName) as PasswordPolicySettings;\r\n        }\r\n\r\n\r\n        public static bool HasConfiguration()\r\n        {\r\n            return GetSettings() != null;\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException($\"Failed to load the configuration section '{PasswordPolicySettings.SectionName}' from the configuration.\", ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            PasswordRuleFactory Factory { get; set; }\r\n            public IReadOnlyCollection<IPasswordRule> PasswordRules { get; private set; }\r\n\r\n            public static void DoInitializeResources(Resources resources)\r\n            {\r\n                var settings = GetSettings();\r\n                if (settings == null)\r\n                {\r\n                    Log.LogWarning(nameof(PasswordRulePluginFacade), $\"Composite.config is missing '{PasswordPolicySettings.SectionName}' section\");\r\n                    resources.PasswordRules = new IPasswordRule[0];\r\n                    return;\r\n                }\r\n\r\n                try\r\n                {\r\n                    var factory = resources.Factory = new PasswordRuleFactory();\r\n                    var rules = settings.PasswordRules.Select(passwordRuleData => factory.Create(passwordRuleData.Name)).ToList();\r\n\r\n                    resources.PasswordRules = rules;\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    if (!(ex is ArgumentException) && !(ex is ConfigurationErrorsException)) throw;\r\n\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/PluginFacades/UserGroupDefinitionProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider;\r\nusing Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider.Runtime;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation.PluginFacades\r\n{\r\n    internal static class UserGroupPermissionDefinitionProviderPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitializeResources);\r\n\r\n\r\n\r\n        static UserGroupPermissionDefinitionProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        \r\n        public static IEnumerable<UserGroupPermissionDefinition> AllUserGroupPermissionDefinitions\r\n        {\r\n            get\r\n            {\r\n                    return _resourceLocker.Resources.Plugin.AllUserGroupPermissionDefinitions;\r\n            }\r\n        }\r\n\r\n\r\n        \r\n        public static bool CanAlterDefinitions\r\n        {\r\n            get\r\n            {\r\n                    return _resourceLocker.Resources.Plugin.CanAlterDefinitions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<UserGroupPermissionDefinition> GetPermissionsByUserGroup(Guid userGroupId)\r\n        {\r\n                return _resourceLocker.Resources.Plugin.GetPermissionsByUserGroup(userGroupId);\r\n        }\r\n\r\n\r\n        \r\n        public static void SetUserGroupPermissionDefinition(UserGroupPermissionDefinition userGroupPermissionDefinition)\r\n        {\r\n            Verify.ArgumentNotNull(userGroupPermissionDefinition, \"userGroupPermissionDefinition\");\r\n            Verify.ArgumentCondition(!userGroupPermissionDefinition.SerializedEntityToken.IsNullOrEmpty(), \"userGroupPermissionDefinition\", \"SerializedEntityToken is empty\");\r\n            Verify.ArgumentCondition(userGroupPermissionDefinition.UserGroupId != Guid.Empty, \"userGroupPermissionDefinition\", \"Is Guid.Empty\");\r\n\r\n             _resourceLocker.Resources.Plugin.SetUserGroupPermissionDefinition(userGroupPermissionDefinition);\r\n        }\r\n\r\n\r\n\r\n        public static void RemoveUserGroupPermissionDefinition(Guid userGroupID, string serializedEntityToken)\r\n        {\r\n            if (userGroupID == Guid.Empty) throw new ArgumentNullException(\"userGroupID\");\r\n            if (string.IsNullOrEmpty(serializedEntityToken)) throw new ArgumentNullException(\"serializedEntityToken\");\r\n\r\n            _resourceLocker.Resources.Plugin.RemoveUserGroupPermissionDefinition(userGroupID, serializedEntityToken);\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", UserGroupPermissionDefinitionProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public UserGroupPermissionDefinitionProviderFactory Factory { get; set; }\r\n            public IUserGroupPermissionDefinitionProvider Plugin { get; set; }\r\n\r\n            public static void DoInitializeResources(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new UserGroupPermissionDefinitionProviderFactory();\r\n                    resources.Plugin = resources.Factory.CreateDefault();\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/PluginFacades/UserRoleDefinitionProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security.BuildinPlugins.BuildinUserPermissionDefinitionProvider;\r\nusing Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider;\r\nusing Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation.PluginFacades\r\n{\r\n    internal static class UserPermissionDefinitionProviderPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitializeResources);\r\n\r\n\r\n\r\n        static UserPermissionDefinitionProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static bool HasConfiguration()\r\n        {\r\n            return (ConfigurationServices.ConfigurationSource != null) &&\r\n                   (ConfigurationServices.ConfigurationSource.GetSection(UserPermissionDefinitionProviderSettings.SectionName) != null);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<UserPermissionDefinition> AllUserPermissionDefinitions\r\n        {\r\n            get\r\n            {\r\n                return _resourceLocker.Resources.Plugin.AllUserPermissionDefinitions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static bool CanAlterDefinitions\r\n        {\r\n            get\r\n            {\r\n                return _resourceLocker.Resources.Plugin.CanAlterDefinitions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void SetUserPermissionDefinition(UserPermissionDefinition userPermissionDefinition)\r\n        {\r\n            if (userPermissionDefinition == null) throw new ArgumentNullException(\"userPermissionDefinition\");\r\n            if (string.IsNullOrEmpty(userPermissionDefinition.SerializedEntityToken)) throw new ArgumentNullException(\"userPermissionDefinition\");\r\n            if (string.IsNullOrEmpty(userPermissionDefinition.Username)) throw new ArgumentNullException(\"userPermissionDefinition\");\r\n\r\n            _resourceLocker.Resources.Plugin.SetUserPermissionDefinition(userPermissionDefinition);\r\n        }\r\n\r\n\r\n\r\n        public static void RemoveUserPermissionDefinition(UserToken userToken, string serializedEntityToken)\r\n        {\r\n            if (userToken == null) throw new ArgumentNullException(\"userToken\");\r\n            if (string.IsNullOrEmpty(serializedEntityToken)) throw new ArgumentNullException(\"serializedEntityToken\");\r\n\r\n            _resourceLocker.Resources.Plugin.RemoveUserPermissionDefinition(userToken, serializedEntityToken);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<UserPermissionDefinition> GetPermissionsByUser(string userName)\r\n        {\r\n            return _resourceLocker.Resources.Plugin.GetPermissionsByUser(userName);\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", UserPermissionDefinitionProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public UserPermissionDefinitionProviderFactory Factory { get; set; }\r\n            public IUserPermissionDefinitionProvider Plugin { get; set; }\r\n\r\n            public static void DoInitializeResources(Resources resources)\r\n            {\r\n                if (HasConfiguration())\r\n                {\r\n                    try\r\n                    {\r\n                        resources.Factory = new UserPermissionDefinitionProviderFactory();\r\n                        resources.Plugin = resources.Factory.CreateDefault();\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    resources.Plugin = new BuildinUserPermissionDefinitionProvider();\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/RelationshipGraphLevelEnumerable.cs",
    "content": "using System.Collections;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation\r\n{\r\n    internal sealed class RelationshipGraphLevelEnumerable : IEnumerable<RelationshipGraphLevel>\r\n    {\r\n        private RelationshipGraph _relationshipGraph;\r\n\r\n        internal RelationshipGraphLevelEnumerable(RelationshipGraph relationshipGraph)\r\n        {\r\n            _relationshipGraph = relationshipGraph;\r\n        }\r\n\r\n\r\n        public IEnumerator<RelationshipGraphLevel> GetEnumerator()\r\n        {\r\n            return new RelationshipGraphLevelEnumerator(_relationshipGraph);\r\n        }\r\n\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            return new RelationshipGraphLevelEnumerator(_relationshipGraph);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/RelationshipGraphLevelEnumerator.cs",
    "content": "﻿using System.Collections;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation\r\n{\r\n    internal sealed class RelationshipGraphLevelEnumerator : IEnumerator<RelationshipGraphLevel>\r\n    {\r\n        private RelationshipGraph _relationshipGraph;\r\n        private RelationshipGraphLevel _currentLevel = null;\r\n\r\n        internal RelationshipGraphLevelEnumerator(RelationshipGraph relationshipGraph)\r\n        {\r\n            _relationshipGraph = relationshipGraph;\r\n        }\r\n\r\n        public RelationshipGraphLevel Current\r\n        {\r\n            get { return _currentLevel; }\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n#if LeakCheck\r\n            System.GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = System.Environment.StackTrace;\r\n        /// <exclude />\r\n        ~RelationshipGraphLevelEnumerator()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n\r\n        object IEnumerator.Current\r\n        {\r\n            get { return _currentLevel; }\r\n        }\r\n\r\n        public bool MoveNext()\r\n        {\r\n            int levelNumber;\r\n\r\n            if (_currentLevel == null)\r\n            {\r\n                levelNumber = 0;\r\n            }\r\n            else\r\n            {\r\n                levelNumber = _currentLevel.Level + 1;\r\n            }\r\n\r\n            RelationshipGraphLevel newLevel = _relationshipGraph.GetLevel(levelNumber);\r\n            if (newLevel == null) return false;\r\n\r\n            _currentLevel = newLevel;\r\n\r\n            return true;\r\n        }\r\n\r\n        public void Reset()\r\n        {\r\n            _currentLevel = null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/SecurityAncestorFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Foundation\r\n{\r\n    internal static class SecurityAncestorFacade\r\n    {\r\n        public static IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            ISecurityAncestorProvider provider = SecurityAncestorProviderCache.GetSecurityAncestorProvider(entityToken);\r\n\r\n            IEnumerable<EntityToken> result = provider.GetParents(entityToken);\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Foundation/SecurityAncestorProviderCache.cs",
    "content": "using System;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.Security.Foundation\r\n{\r\n    internal static class SecurityAncestorProviderCache\r\n    {\r\n        private static Hashtable<Type, ISecurityAncestorProvider> _securityAncestorProviderCache = new Hashtable<Type, ISecurityAncestorProvider>();\r\n        private static object _lock = new object();\r\n\r\n\r\n        static SecurityAncestorProviderCache()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlush);\r\n        }\r\n\r\n\r\n        public static ISecurityAncestorProvider GetSecurityAncestorProvider(EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNull(entityToken, \"entityToken\");\r\n\r\n            ISecurityAncestorProvider securityAncestorProvider;\r\n\r\n            Type entityTokenType = entityToken.GetType();\r\n\r\n            if (_securityAncestorProviderCache.TryGetValue(entityTokenType, out securityAncestorProvider) == false)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_securityAncestorProviderCache.TryGetValue(entityTokenType, out securityAncestorProvider) == false)\r\n                    {\r\n                        object[] attributes = entityTokenType.GetCustomAttributes(typeof(SecurityAncestorProviderAttribute), true);\r\n\r\n                        Verify.That(attributes.Length > 0, \"Missing {0} attribute on the entity token {1}\", typeof(SecurityAncestorProviderAttribute), entityTokenType);\r\n\r\n                        var attribute = (SecurityAncestorProviderAttribute)attributes[0];\r\n\r\n                        Verify.IsNotNull(attribute.SecurityAncestorProviderType, \"Security ancestor provider type can not be null on the entity token {0}\", entityTokenType);\r\n                        Verify.That(typeof(ISecurityAncestorProvider).IsAssignableFrom(attribute.SecurityAncestorProviderType), \"Security ancestor provider '{0}' should implement the interface '{1}'\", attribute.SecurityAncestorProviderType, typeof(ISecurityAncestorProvider));\r\n\r\n                        securityAncestorProvider = (ISecurityAncestorProvider)Activator.CreateInstance(attribute.SecurityAncestorProviderType);\r\n\r\n                        _securityAncestorProviderCache.Add(entityTokenType, securityAncestorProvider);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            return securityAncestorProvider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _securityAncestorProviderCache = new Hashtable<Type, ISecurityAncestorProvider>();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlush(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/HashSigner.cs",
    "content": "﻿namespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class HashSigner\r\n\t{\r\n        private const int _privateKey = 180226750;\r\n\r\n        /// <exclude />\r\n        public static HashValue GetSignedHash(string content)\r\n        {\r\n            int hashCode = content.GetHashCode();\r\n\r\n            return new HashValue(hashCode ^ _privateKey); \r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool ValidateSignedHash(string content, HashValue hashValue)\r\n        {\r\n            HashValue newHashValue = GetSignedHash(content);\r\n\r\n            return newHashValue.Equals(hashValue);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/HashValue.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class HashValue\r\n\t{\r\n        private int _value;\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public HashValue(int value)\r\n        {\r\n            _value = value;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            return _value.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static HashValue Deserialize(string serializedHashValue)\r\n        {            \r\n            int value;\r\n\r\n            if (int.TryParse(serializedHashValue, out value) == false)\r\n            {\r\n                throw new ArgumentException(\"The string is not a valid serialized hash value\");\r\n            }\r\n\r\n            return new HashValue(value);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as HashValue);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(HashValue hashValue)\r\n        {\r\n            if (hashValue == null) return false;\r\n\r\n            return _value == hashValue._value;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return _value.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return _value.GetHashCode();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/HookingFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public delegate void DirtyHooksCallbackDelegate();\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public static class HookingFacade\r\n    {\r\n        /// <exclude />\r\n        public delegate void NewElementProviderRootEntitiesDelegate(HookingFacadeEventArgs hookingFacadeEventArgs);\r\n\r\n\r\n        private static IHookingFacade _hookingFacade = new HookingFacadeImpl();\r\n\r\n\r\n\r\n        static HookingFacade()\r\n        {\r\n\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void EnsureInitialization()\r\n        {\r\n            _hookingFacade.EnsureInitialization();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<EntityToken> GetHookies(EntityToken hooker)\r\n        {\r\n            try\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _hookingFacade.GetHookies(hooker);\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(\"HookingFacade\", ex);\r\n\r\n                GlobalInitializerFacade.FatalResetTheSystem();\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<EntityToken> GetParentHookers()\r\n        {\r\n            try\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _hookingFacade.GetParentHookers();\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(\"HookingFacade\", ex);\r\n\r\n                GlobalInitializerFacade.FatalResetTheSystem();\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<EntityToken> GetParentToChildHooks(EntityToken parentEntityToken)\r\n        {\r\n            try\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _hookingFacade.GetParentToChildHooks(parentEntityToken);\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(\"HookingFacade\", ex);\r\n\r\n                GlobalInitializerFacade.FatalResetTheSystem();\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveHook(EntityTokenHook entityTokenHook)\r\n        {\r\n            RemoveHooks(new [] { entityTokenHook});\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveHooks(IEnumerable<EntityTokenHook> entityTokenHooks)\r\n        {\r\n            try\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    _hookingFacade.RemoveHooks(entityTokenHooks);\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(\"HookingFacade\", ex);\r\n\r\n                GlobalInitializerFacade.FatalResetTheSystem();\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AddHook(EntityTokenHook entityTokenHook)\r\n        {\r\n            AddHooks(new[] {entityTokenHook});\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AddHooks(IEnumerable<EntityTokenHook> entityTokenHooks)\r\n        {\r\n            try\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    _hookingFacade.AddHooks(entityTokenHooks);\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(\"HookingFacade\", ex);\r\n\r\n                GlobalInitializerFacade.FatalResetTheSystem();\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Use this method to register a callback method that will be called when fully updated hooks are needed.\r\n        /// </summary>\r\n        /// <param name=\"id\">\r\n        /// The id of the callback method. This ensures that only one callback is registered\r\n        /// for each id.\r\n        /// </param>\r\n        /// <param name=\"dirtyHooksCallbackDelegate\"></param>\r\n        /// <exclude />\r\n        public static void RegisterDirtyCallback(string id, DirtyHooksCallbackDelegate dirtyHooksCallbackDelegate)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                _hookingFacade.RegisterDirtyCallback(id, dirtyHooksCallbackDelegate);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToNewElementProviderRootEntitiesEvent(NewElementProviderRootEntitiesDelegate newElementProviderRootEntitiesDelegate)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                _hookingFacade.SubscribeToNewElementProviderRootEntitiesEvent(newElementProviderRootEntitiesDelegate);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeFromNewElementProviderRootEntitiesEvent(NewElementProviderRootEntitiesDelegate newElementProviderRootEntitiesDelegate)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                _hookingFacade.UnsubscribeFromNewElementProviderRootEntitiesEvent(newElementProviderRootEntitiesDelegate);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireNewElementProviderRootEntitiesEvent(string providerName)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                _hookingFacade.FireNewElementProviderRootEntitiesEvent(providerName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _hookingFacade.Flush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/HookingFacadeEventArgs.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public sealed class HookingFacadeEventArgs : EventArgs\r\n    {\r\n        /// <exclude />\r\n        public HookingFacadeEventArgs(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            this.ProviderName = providerName;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ProviderName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/HookingFacadeImpl.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System;\r\nusing System.Linq;\r\nusing System.Web.Hosting;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.C1Console.Security.Foundation;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\nusing Composite.Data;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal sealed class HookingFacadeImpl : IHookingFacade\r\n    {\r\n        private event HookingFacade.NewElementProviderRootEntitiesDelegate _newElementProviderRootEntitiesEvent;\r\n\r\n        private EvaluatedHooks _evaluatedHooks;\r\n        private DateTime _lastFlushDateTime = DateTime.MinValue;\r\n\r\n        private bool _isInitializing;\r\n        private Dictionary<string, DirtyHooksCallbackDelegate> _dirtyHooksCallbackDelegates = new Dictionary<string, DirtyHooksCallbackDelegate>();\r\n\r\n        private readonly object _lock = new object();\r\n\r\n        private readonly object _changesQueueSyncRoot = new object();\r\n        private readonly List<Pair<bool, EntityTokenHook>> _changesQueue = new List<Pair<bool, EntityTokenHook>>();\r\n\r\n\r\n        private class EvaluatedHooks\r\n        {\r\n            public Dictionary<EntityToken, List<EntityToken>> ParentToChild = new Dictionary<EntityToken, List<EntityToken>>();\r\n            public Dictionary<EntityToken, List<EntityToken>> ChildToParent = new Dictionary<EntityToken, List<EntityToken>>();\r\n        }\r\n\r\n\r\n        public void EnsureInitialization()\r\n        {\r\n            GetEvaluatedHooks();\r\n        }\r\n\r\n\r\n        private EvaluatedHooks GetEvaluatedHooks()\r\n        {\r\n            var evaluatedHooks = _evaluatedHooks;\r\n            if (evaluatedHooks != null) return evaluatedHooks;\r\n\r\n            lock (_lock)\r\n            {\r\n                evaluatedHooks = _evaluatedHooks;\r\n                if (evaluatedHooks != null) return evaluatedHooks;\r\n\r\n                Verify.IsFalse(_isInitializing, \"Calling to HookingFacade while it's initializing is not allowed\");\r\n                _isInitializing = true;\r\n\r\n                DateTime calculationTime = DateTime.Now;\r\n\r\n                try\r\n                {\r\n                    ClearChangesQueue();\r\n                    evaluatedHooks = DoInitializeFromRegistrator();\r\n\r\n\r\n                    var dirtyHooksCallbackDelegates = _dirtyHooksCallbackDelegates;\r\n                    if (dirtyHooksCallbackDelegates.Count > 0)\r\n                    {\r\n                        var delegates = new Dictionary<string, DirtyHooksCallbackDelegate>(dirtyHooksCallbackDelegates);\r\n                        _dirtyHooksCallbackDelegates = new Dictionary<string, DirtyHooksCallbackDelegate>();\r\n\r\n                        foreach (DirtyHooksCallbackDelegate dirtyHooksCallbackDelegate in delegates.Values)\r\n                        {\r\n                            try\r\n                            {\r\n                                dirtyHooksCallbackDelegate();\r\n                            }\r\n                            catch (Exception ex)\r\n                            {\r\n                                Log.LogError(\"HookingFacade\", ex);\r\n                            }\r\n                        }\r\n                    }\r\n\r\n                    ApplyQueuedChanges(evaluatedHooks);\r\n\r\n                    if (calculationTime > _lastFlushDateTime)\r\n                    {\r\n                        _evaluatedHooks = evaluatedHooks;\r\n                    }\r\n\r\n                    return evaluatedHooks;\r\n                }\r\n                finally\r\n                {\r\n                    _isInitializing = false;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public IEnumerable<EntityToken> GetHookies(EntityToken hook)\r\n        {\r\n            Verify.ArgumentNotNull(hook, \"hook\");\r\n            var evaluatedHooks = GetEvaluatedHooks();\r\n\r\n            List<EntityToken> hooks;\r\n            return evaluatedHooks.ChildToParent.TryGetValue(hook, out hooks) ? hooks : null;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<EntityToken> GetParentHookers()\r\n        {\r\n            var evaluatedHooks = GetEvaluatedHooks();\r\n\r\n            return evaluatedHooks.ParentToChild.Keys;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<EntityToken> GetParentToChildHooks(EntityToken parentEntityToken)\r\n        {\r\n            Verify.ArgumentNotNull(parentEntityToken, \"parentEntityToken\");\r\n\r\n            var evaluatedHooks = GetEvaluatedHooks();\r\n\r\n            List<EntityToken> hooks;\r\n            return evaluatedHooks.ParentToChild.TryGetValue(parentEntityToken, out hooks) ? hooks : null;\r\n        }\r\n\r\n\r\n\r\n        private void RemoveHookInternal(EvaluatedHooks hooks, EntityTokenHook entityTokenHook)\r\n        {\r\n            Verify.ArgumentNotNull(entityTokenHook, \"entityTokenHook\");\r\n\r\n            if (hooks.ParentToChild.ContainsKey(entityTokenHook.Hooker))\r\n            {\r\n                List<EntityToken> hookies = hooks.ParentToChild[entityTokenHook.Hooker];\r\n\r\n                foreach (EntityToken hookie in hookies)\r\n                {\r\n                    hooks.ChildToParent[hookie].Remove(entityTokenHook.Hooker);\r\n\r\n                    if (hooks.ChildToParent[hookie].Count == 0)\r\n                    {\r\n                        hooks.ChildToParent.Remove(hookie);\r\n                    }\r\n                }\r\n\r\n                hooks.ParentToChild.Remove(entityTokenHook.Hooker);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void RemoveHooks(IEnumerable<EntityTokenHook> entityTokenHooks)\r\n        {\r\n            Verify.ArgumentNotNull(entityTokenHooks, \"entityTokenHooks\");\r\n\r\n            lock (_changesQueueSyncRoot)\r\n            {\r\n                _changesQueue.AddRange(entityTokenHooks.Select(hook => new Pair<bool, EntityTokenHook>(false, hook)));\r\n            }\r\n        }\r\n\r\n\r\n        private void AddHookInternal(EvaluatedHooks hooks, EntityTokenHook entityTokenHook)\r\n        {\r\n            Verify.ArgumentNotNull(entityTokenHook, \"entityTokenHook\");\r\n\r\n            List<EntityToken> hookies;\r\n            if (!hooks.ParentToChild.TryGetValue(entityTokenHook.Hooker, out hookies))\r\n            {\r\n                hooks.ParentToChild.Add(entityTokenHook.Hooker, entityTokenHook.Hookies.ToList());\r\n            }\r\n            else\r\n            {\r\n                foreach (var entityToken in entityTokenHook.Hookies)\r\n                {\r\n                    if (!hookies.Contains(entityToken))\r\n                    {\r\n                        hookies.Add(entityToken);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            foreach (EntityToken hookie in entityTokenHook.Hookies)\r\n            {\r\n                List<EntityToken> hookers;\r\n\r\n                if (!hooks.ChildToParent.TryGetValue(hookie, out hookers))\r\n                {\r\n                    hookers = new List<EntityToken>();\r\n\r\n                    hooks.ChildToParent.Add(hookie, hookers);\r\n                }\r\n                else if (hookers.Contains(entityTokenHook.Hooker))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                hookers.Add(entityTokenHook.Hooker);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void AddHooks(IEnumerable<EntityTokenHook> entityTokenHooks)\r\n        {\r\n            Verify.ArgumentNotNull(entityTokenHooks, \"entityTokenHooks\");\r\n\r\n            lock (_changesQueueSyncRoot)\r\n            {\r\n                _changesQueue.AddRange(entityTokenHooks.Select(hook => new Pair<bool, EntityTokenHook>(true, hook)));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void RegisterDirtyCallback(string id, DirtyHooksCallbackDelegate dirtyHooksCallbackDelegate)\r\n        {\r\n            Verify.ArgumentNotNull(dirtyHooksCallbackDelegate, \"dirtyHooksCallbackDelegate\");\r\n\r\n            lock (_lock)\r\n            {\r\n                if (!_dirtyHooksCallbackDelegates.ContainsKey(id))\r\n                {\r\n                    _dirtyHooksCallbackDelegates.Add(id, dirtyHooksCallbackDelegate);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void SubscribeToNewElementProviderRootEntitiesEvent(HookingFacade.NewElementProviderRootEntitiesDelegate newElementProviderRootEntitiesDelegate)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _newElementProviderRootEntitiesEvent += newElementProviderRootEntitiesDelegate;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void UnsubscribeFromNewElementProviderRootEntitiesEvent(HookingFacade.NewElementProviderRootEntitiesDelegate newElementProviderRootEntitiesDelegate)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _newElementProviderRootEntitiesEvent -= newElementProviderRootEntitiesDelegate;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireNewElementProviderRootEntitiesEvent(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            lock (_lock)\r\n            {\r\n                EnsureInitialization();\r\n\r\n                HookingFacade.NewElementProviderRootEntitiesDelegate del = _newElementProviderRootEntitiesEvent;\r\n\r\n                if (del != null)\r\n                {\r\n                    del(new HookingFacadeEventArgs(providerName));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _lastFlushDateTime = DateTime.Now;\r\n            _evaluatedHooks = null;\r\n            _dirtyHooksCallbackDelegates = new Dictionary<string, DirtyHooksCallbackDelegate>();\r\n        }\r\n\r\n\r\n\r\n        private EvaluatedHooks DoInitializeFromRegistrator()\r\n        {\r\n            var result = new EvaluatedHooks();\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                if (HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                {\r\n                    return result;\r\n                }\r\n\r\n                using(new LogExecutionTime(\"RGB(194, 252, 131)HookingFacade\", \"Initializing Entity Hooks\"))\r\n                using (new DataScope(DataScopeIdentifier.Administrated))\r\n                {\r\n                    Verify.That(GlobalInitializerFacade.SystemCoreInitialized, \"Expected system core to be initialized\");\r\n\r\n\r\n                    foreach (string name in HookRegistratorRegistry.HookRegistratorPluginNames)\r\n                    {\r\n                        var entityTokenHooks = HookRegistratorPluginFacade.GetHooks(name);\r\n                        \r\n                        foreach (EntityTokenHook entityTokenHook in entityTokenHooks)\r\n                        {\r\n                            List<EntityToken> hookies = result.ParentToChild.GetOrAdd(entityTokenHook.Hooker, () => new List<EntityToken>());\r\n\r\n                            hookies.AddRange(entityTokenHook.Hookies);\r\n                        }\r\n                    }\r\n\r\n                    foreach (KeyValuePair<EntityToken, List<EntityToken>> kvp in result.ParentToChild)\r\n                    {\r\n                        foreach (EntityToken hookie in kvp.Value)\r\n                        {\r\n                            List<EntityToken> hookers = result.ChildToParent.GetOrAdd(hookie, () => new List<EntityToken>());\r\n\r\n                            hookers.Add(kvp.Key);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private void ClearChangesQueue()\r\n        {\r\n            lock (_changesQueueSyncRoot)\r\n            {\r\n                _changesQueue.Clear();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ApplyQueuedChanges(EvaluatedHooks evaluatedHooks)\r\n        {\r\n            lock (_changesQueueSyncRoot)\r\n            {\r\n                foreach (Pair<bool, EntityTokenHook> change in _changesQueue)\r\n                {\r\n                    if (change.First)\r\n                    {\r\n                        AddHookInternal(evaluatedHooks, change.Second);\r\n                    }\r\n                    else\r\n                    {\r\n                        RemoveHookInternal(evaluatedHooks, change.Second);\r\n                    }\r\n                }\r\n\r\n                _changesQueue.Clear();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/IAuxiliarySecurityAncestorFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal interface IAuxiliarySecurityAncestorFacade\r\n    {\r\n        IEnumerable<EntityToken> GetParents(EntityToken entityToken);\r\n\r\n        void AddAuxiliaryAncestorProvider(Type entityTokenType, IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider, bool flushPersistent);\r\n        void RemoveAuxiliaryAncestorProvider(Type entityTokenType, IAuxiliarySecurityAncestorProvider auxiliarySecurityAncestorProvider);\r\n        IEnumerable<IAuxiliarySecurityAncestorProvider> GetAuxiliaryAncestorProviders(Type entityTokenType);\r\n\r\n        void Flush();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/IAuxiliarySecurityAncestorProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// To add a see <see cref=\"Composite.C1Console.Security.AuxiliarySecurityAncestorFacade\"/>.\r\n    /// Typically added from a element provider\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IAuxiliarySecurityAncestorProvider\r\n    {\r\n        /// <summary>\r\n        /// If the entityToken do not have any parents, this method should return an entry in the dictionary with a IEnumerable\r\n        /// with zero elements.\r\n        /// </summary>\r\n        /// <param name=\"entityTokens\"></param>\r\n        /// <returns>\r\n        /// A dictionary with where child entity token is key and the value of this key\r\n        /// is enumerable of the parent entity tokens - possibly empty</returns>\r\n        Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/IHookingFacade.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n\tinternal interface IHookingFacade\r\n\t{\r\n        void EnsureInitialization();\r\n        \r\n        IEnumerable<EntityToken> GetHookies(EntityToken hooker);\r\n        IEnumerable<EntityToken> GetParentHookers();\r\n        IEnumerable<EntityToken> GetParentToChildHooks(EntityToken parentEntityToken);\r\n\r\n        void RemoveHooks(IEnumerable<EntityTokenHook> entityTokenHooks);\r\n        void AddHooks(IEnumerable<EntityTokenHook> entityTokenHooks);\r\n\r\n        void RegisterDirtyCallback(string id, DirtyHooksCallbackDelegate dirtyHooksCallbackDelegate);\r\n\r\n        void SubscribeToNewElementProviderRootEntitiesEvent(HookingFacade.NewElementProviderRootEntitiesDelegate newElementProviderRootEntitiesDelegate);\r\n        void UnsubscribeFromNewElementProviderRootEntitiesEvent(HookingFacade.NewElementProviderRootEntitiesDelegate newElementProviderRootEntitiesDelegate);\r\n        void FireNewElementProviderRootEntitiesEvent(string providerName);\r\n        \r\n        void Flush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/ISecurityAncestorProvider.cs",
    "content": "using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface ISecurityAncestorProvider\r\n    {\r\n        /// <summary>\r\n        /// If the entityToken does not exists, this method should return null.\r\n        /// If the entityToken do not have any parents, this method should return an IEnumerable\r\n        /// with zero elements.\r\n        /// </summary>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <returns></returns>\r\n        IEnumerable<EntityToken> GetParents(EntityToken entityToken);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/LoginResult.cs",
    "content": "﻿namespace Composite.C1Console.Security\r\n{\r\n    /// <summary>\r\n    /// Describing the result of a login validation\r\n    /// </summary>\r\n    public enum LoginResult\r\n    {\r\n        /// <summary>\r\n        /// Success\r\n        /// </summary>\r\n        Success = 0,\r\n\r\n        /// <summary>\r\n        /// Incorrect password\r\n        /// </summary>\r\n        IncorrectPassword = 1,\r\n\r\n        /// <summary>\r\n        /// User does not exist\r\n        /// </summary>\r\n        UserDoesNotExist = 2,\r\n\r\n        /// <summary>\r\n        /// Login policy violated\r\n        /// </summary>\r\n        PolicyViolated = 3,\r\n\r\n        /// <summary>\r\n        /// User is locked after maximum login attempts\r\n        /// </summary>\r\n        UserLockedAfterMaxLoginAttempts = 4,\r\n\r\n        /// <summary>\r\n        /// User is locked by administrator\r\n        /// </summary>\r\n        UserLockedByAdministrator = 5,\r\n\r\n        /// <summary>\r\n        /// User's password has to be updated.\r\n        /// </summary>\r\n        PasswordUpdateRequired = 6\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/NoSecurityEntityToken.cs",
    "content": "﻿using Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>\r\n    /// This will alway be shown and allow all actions on it.\r\n    /// It is not possible for the user to set any permissions on it.\r\n    /// Use with care!!\r\n    /// </summary>\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    internal sealed class NoSecurityEntityToken : EntityToken\r\n    {\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return \"NoSecurityEntityToken\"; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializeedEntityToken)\r\n        {\r\n            return new NoSecurityEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/ParentsFacade.cs",
    "content": "using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal static class ParentsFacade\r\n    {\r\n        public static List<EntityToken> GetAllParents(EntityToken entityToken)\r\n        {\r\n            return GetAllParents(entityToken, 1);\r\n        }\r\n\r\n\r\n\r\n        public static List<EntityToken> GetAllParents(EntityToken entityToken, int levelCount)\r\n        {\r\n            RelationshipGraph graph = new RelationshipGraph(entityToken, RelationshipGraphSearchOption.Both, true);\r\n\r\n            List<EntityToken> tokens = new List<EntityToken>();\r\n\r\n            int currentLevel = 0;\r\n            foreach (RelationshipGraphLevel level in graph.Levels)\r\n            {\r\n                if (currentLevel > levelCount)\r\n                {\r\n                    break;\r\n                }\r\n                else if ((currentLevel > 0) && (currentLevel <= levelCount))\r\n                {\r\n                    tokens.AddRange(level.AllEntities);\r\n                }\r\n                    \r\n                currentLevel++;\r\n            }\r\n\r\n            return tokens;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/PasswordPolicyFacade.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>\r\n    /// Facade for calling password rule plugings.\r\n    /// </summary>\r\n    public static class PasswordPolicyFacade\r\n    {\r\n        /// <summary>\r\n        /// Returns password expiration time in days. <value>0</value> will be returned if no expiration set.\r\n        /// </summary>\r\n        public static int PasswordExpirationTimeInDays\r\n        {\r\n            get { return PasswordRulePluginFacade.PasswordExpirationTimeInDays; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        public static int PasswordHistoryLength\r\n        {\r\n            get { return PasswordRulePluginFacade.PasswordHistoryLength; }\r\n        }\r\n        \r\n\r\n        /// <summary>\r\n        /// Validates the password against the rules defined in the configuration.\r\n        /// </summary>\r\n        /// <param name=\"user\">The user information.</param>\r\n        /// <param name=\"password\">The new password that has to be validated.</param>\r\n        /// <param name=\"validationMessages\">The list of password rules that password did not satisfy.</param>\r\n        /// <returns></returns>\r\n        public static bool ValidatePassword(IUser user, string password, out IList<string> validationMessages)\r\n        {\r\n            return PasswordRulePluginFacade.ValidatePassword(user, password, out validationMessages);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/PermissionDescriptor.cs",
    "content": "using System.Diagnostics;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"PermissionType = {PermissionType}\")]\r\n\tpublic sealed class PermissionDescriptor\r\n\t{\r\n        /// <exclude />\r\n        public PermissionDescriptor(PermissionType permissionType)\r\n        {\r\n            this.PermissionType = permissionType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PermissionType PermissionType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Label\r\n        {\r\n            get\r\n            {\r\n                return StringResourceSystemFacade.GetString(\"Composite.Permissions\", string.Format(\"{0}Label\", this.PermissionType));\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/PermissionType.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// Permission types that can be attached to actions in the C1 Console\r\n    /// </summary>\r\n    public enum PermissionType\r\n    {\r\n        /// <summary>\r\n        /// User may read/view the element\r\n        /// </summary>\r\n        Read = 0,\r\n\r\n        /// <summary>\r\n        /// User may edit the element\r\n        /// </summary>\r\n        Edit = 1,\r\n\r\n        /// <summary>\r\n        /// User may add items below this element\r\n        /// </summary>\r\n        Add = 2,\r\n\r\n        /// <summary>\r\n        /// User may delete the element\r\n        /// </summary>\r\n        Delete = 3,\r\n\r\n        /// <summary>\r\n        /// User may approve the element as part of a workflow\r\n        /// </summary>\r\n        Approve = 4,\r\n\r\n        /// <summary>\r\n        /// User may publish the element as part of a workflow\r\n        /// </summary>\r\n        Publish = 5,\r\n\r\n        /// <summary>\r\n        /// User may do administrative tasks on the element\r\n        /// </summary>\r\n        Administrate = 6,\r\n\r\n        /// <exclude />\r\n        ClearPermissions = 7,\r\n\r\n        /// <summary>\r\n        /// User may do configuration tasks on the element - super user actions.\r\n        /// </summary>\r\n        Configure = 8\r\n    }\r\n\r\n\r\n\r\n    internal static class PermissionTypePredefined\r\n    {\r\n        public static readonly IEnumerable<PermissionType> Add = new PermissionType[] { PermissionType.Add };\r\n        public static readonly IEnumerable<PermissionType> Delete = new PermissionType[] { PermissionType.Delete };\r\n        public static readonly IEnumerable<PermissionType> Edit = new PermissionType[] { PermissionType.Edit };\r\n    }\r\n\r\n\r\n\r\n    internal static class PermissionTypeExtensionMethods\r\n    {\r\n        public static IEnumerable<PermissionType> FromListOfStrings(this IEnumerable<string> permissionTypeNames)\r\n        {\r\n            if (permissionTypeNames == null) throw new ArgumentNullException(\"permissionTypeNames\");\r\n\r\n            foreach (string permissionTypeName in permissionTypeNames)\r\n            {\r\n                PermissionType permissionType = (PermissionType)Enum.Parse(typeof(PermissionType), permissionTypeName);\r\n\r\n                yield return permissionType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string SerializePermissionTypes(this IEnumerable<PermissionType> permissionTypes)\r\n        {\r\n            if (permissionTypes == null) throw new ArgumentNullException(\"permissionType\");\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n            bool first = true;\r\n            foreach (PermissionType permissionType in permissionTypes)\r\n            {\r\n                if (first == false) sb.Append(\"\");\r\n                else first = false;\r\n\r\n                sb.Append(permissionType.ToString());\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n\r\n        public static IEnumerable<PermissionType> DesrializePermissionTypes(this string serializedPermissionTypes)\r\n        {\r\n            if (serializedPermissionTypes == null) throw new ArgumentNullException(\"serializedPermissionTypes\");\r\n\r\n            string[] split = serializedPermissionTypes.Split(new[] { '' }, StringSplitOptions.RemoveEmptyEntries);\r\n\r\n            foreach (string s in split)\r\n            {\r\n                yield return (PermissionType)Enum.Parse(typeof(PermissionType), s);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/PermissionTypeFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\nusing Composite.C1Console.Security.Foundation;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PermissionTypeFacade\r\n    {\r\n        private static readonly IReadOnlyCollection<PermissionType> EmptyPermissionTypeCollection = new PermissionType[0];\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionType> GetLocallyDefinedUserPermissionTypes(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNull(userToken, \"userToken\");\r\n            Verify.ArgumentNotNull(entityToken, \"entityToken\");\r\n\r\n            IEnumerable<UserPermissionDefinition> userPermissionDefinitions = GetUserPermissionDefinitions(userToken.Username);\r\n\r\n            var result = new List<PermissionType>();\r\n\r\n            foreach (UserPermissionDefinition userPermissionDefinition in userPermissionDefinitions)\r\n            {\r\n                if (userPermissionDefinition.EntityToken.EqualsWithVersionIgnore(entityToken))\r\n                {\r\n                    result.AddRange(userPermissionDefinition.PermissionTypes);\r\n                }\r\n            }\r\n\r\n            return result.Distinct();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionType> GetLocallyDefinedUserGroupPermissionTypes(Guid userGroupId, EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNull(userGroupId, \"userGroupId\");\r\n            Verify.ArgumentNotNull(entityToken, \"entityToken\");\r\n\r\n            IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions = GetUserGroupPermissionDefinitions(userGroupId);\r\n\r\n            var result = new List<PermissionType>();\r\n\r\n            foreach (UserGroupPermissionDefinition userGroupPermissionDefinition in userGroupPermissionDefinitions)\r\n            {\r\n                if (userGroupPermissionDefinition.EntityToken.EqualsWithVersionIgnore(entityToken))\r\n                {\r\n                    result.AddRange(userGroupPermissionDefinition.PermissionTypes);\r\n                }\r\n            }\r\n\r\n            return result.Distinct();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionType> GetLocallyDefinedUserGroupPermissionTypes(string username, EntityToken entityToken)\r\n        {\r\n            var userGroupIds = UserGroupFacade.GetUserGroupIds(username);\r\n\r\n            IEnumerable<PermissionType> permissionTypes = new List<PermissionType>();\r\n            foreach (Guid userGroupId in userGroupIds)\r\n            {\r\n                IEnumerable<PermissionType> localPermissionTypes = GetLocallyDefinedUserGroupPermissionTypes(userGroupId, entityToken);\r\n                permissionTypes = permissionTypes.Concat(localPermissionTypes);\r\n            }\r\n\r\n            return permissionTypes.Distinct();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This returns a merged result of user permissions and user group permissions\r\n        /// </summary>\r\n        /// <param name=\"userToken\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"userPermissionDefinitions\"></param>\r\n        /// <param name=\"userGroupPermissionDefinitions\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<PermissionType> GetCurrentPermissionTypes(UserToken userToken, EntityToken entityToken, IEnumerable<UserPermissionDefinition> userPermissionDefinitions, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions)\r\n        {\r\n            Verify.ArgumentNotNull(userToken, \"userToken\");\r\n            Verify.ArgumentNotNull(entityToken, \"entityToken\");\r\n\r\n            IReadOnlyCollection<PermissionType> resultPermissionTypes = PermissionTypeFacadeCaching.GetCurrentPermissionTypes(userToken, entityToken);\r\n            if (resultPermissionTypes != null)\r\n            {\r\n                return resultPermissionTypes;\r\n            }\r\n\r\n            IReadOnlyCollection<PermissionType> userPermissionTypes = PermissionTypeFacadeCaching.GetUserPermissionTypes(userToken, entityToken);\r\n            if (userPermissionTypes == null)\r\n            {\r\n                userPermissionTypes = RecursiveUpdateCurrentUserPermissionTypes(userToken, entityToken, userPermissionDefinitions, new HashSet<EntityTokenPair>());\r\n\r\n                PermissionTypeFacadeCaching.SetUserPermissionTypes(userToken, entityToken, userPermissionTypes);\r\n            }\r\n\r\n            IReadOnlyCollection<PermissionType> userGroupPermissionTypes = PermissionTypeFacadeCaching.GetUserGroupPermissionTypes(userToken, entityToken);\r\n            if (userGroupPermissionTypes == null)\r\n            {\r\n                userGroupPermissionTypes = RecursiveUpdateCurrentUserGroupPermissionTypes(userToken, entityToken, userGroupPermissionDefinitions, new HashSet<EntityTokenPair>());\r\n\r\n                PermissionTypeFacadeCaching.SetUserGroupPermissionTypes(userToken, entityToken, userGroupPermissionTypes);\r\n            }\r\n\r\n            resultPermissionTypes = new List<PermissionType>(userPermissionTypes.Concat(userGroupPermissionTypes).Distinct());\r\n\r\n            if (resultPermissionTypes.Contains(PermissionType.ClearPermissions))\r\n            {\r\n                resultPermissionTypes = EmptyPermissionTypeCollection;\r\n            }\r\n\r\n            PermissionTypeFacadeCaching.SetCurrentPermissionTypes(userToken, entityToken, resultPermissionTypes);\r\n\r\n            return resultPermissionTypes;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This returns a merged result of user permissions and user group permissions\r\n        /// </summary>\r\n        /// <param name=\"userToken\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<PermissionType> GetInheritedPermissionsTypes(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            return GetInheritedPermissionsTypes(userToken, entityToken, null);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This returns a merged result of user permissions and user group permissions\r\n        /// </summary>\r\n        /// <param name=\"userToken\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"presetUserGroupPermissions\">\r\n        /// This is used for simulating that local defined user group permissions has been set\r\n        /// </param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<PermissionType> GetInheritedPermissionsTypes(UserToken userToken, EntityToken entityToken, Dictionary<Guid, IEnumerable<PermissionType>> presetUserGroupPermissions)\r\n        {\r\n            if (userToken == null) throw new ArgumentNullException(\"userToken\");\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            var cachedValue = PermissionTypeFacadeCaching.GetInheritedPermissionsTypes(userToken, entityToken);\r\n            if (cachedValue != null)\r\n            {\r\n                return cachedValue;\r\n            }\r\n\r\n            if (presetUserGroupPermissions == null || presetUserGroupPermissions.Count == 0)\r\n            {\r\n                ICollection<PermissionType> localDefinedUserGroupPermissionTypes = GetLocallyDefinedUserGroupPermissionTypes(userToken.Username, entityToken).Evaluate();\r\n                if (localDefinedUserGroupPermissionTypes.Count > 0)\r\n                {\r\n                    PermissionTypeFacadeCaching.SetInheritedPermissionsTypes(userToken, entityToken, localDefinedUserGroupPermissionTypes.ToList());\r\n                    return localDefinedUserGroupPermissionTypes;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                var userGroupIds = UserGroupFacade.GetUserGroupIds(userToken.Username);\r\n\r\n                var localDefinedUserGroupPermissionTypes = new List<PermissionType>();\r\n                foreach (Guid userGroupId in userGroupIds)\r\n                {\r\n                    IEnumerable<PermissionType> groupPermissionTypes;\r\n                    if (presetUserGroupPermissions.TryGetValue(userGroupId, out groupPermissionTypes))\r\n                    {\r\n                        localDefinedUserGroupPermissionTypes.AddRange(groupPermissionTypes);\r\n                    }\r\n                }\r\n\r\n                if (localDefinedUserGroupPermissionTypes.Contains(PermissionType.ClearPermissions))\r\n                {\r\n                    return new PermissionType[0];\r\n                }\r\n                \r\n                return localDefinedUserGroupPermissionTypes.Distinct();\r\n            }\r\n\r\n            ICollection<UserPermissionDefinition> userPermissionDefinitions = GetUserPermissionDefinitions(userToken.Username).Evaluate();\r\n            ICollection<UserGroupPermissionDefinition> userGroupPermissionDefinitions = GetUserGroupPermissionDefinitions(userToken.Username).Evaluate();\r\n\r\n            List<EntityToken> parentEntityTokens = ParentsFacade.GetAllParents(entityToken);\r\n            foreach (EntityToken parentEntityToken in parentEntityTokens)\r\n            {\r\n                RecursiveUpdateCurrentUserPermissionTypes(userToken, parentEntityToken, userPermissionDefinitions, new HashSet<EntityTokenPair>());\r\n                RecursiveUpdateCurrentUserGroupPermissionTypes(userToken, parentEntityToken, userGroupPermissionDefinitions, new HashSet<EntityTokenPair>());\r\n            }\r\n\r\n\r\n            if (!PermissionTypeFacadeCaching.CachingWorking)\r\n            {\r\n                throw new InvalidOperationException(\"RequestLifetimeCache is not operational\");\r\n            }\r\n\r\n\r\n            var permissionTypes = Enumerable.Empty<PermissionType>();\r\n            foreach (EntityToken parentEntityToken in parentEntityTokens)\r\n            {\r\n                IEnumerable<PermissionType> parentUserPermissionTypes = PermissionTypeFacadeCaching.GetUserPermissionTypes(userToken, parentEntityToken);\r\n                if (parentUserPermissionTypes != null)\r\n                {\r\n                    permissionTypes = permissionTypes.Concat(parentUserPermissionTypes);\r\n                }\r\n\r\n                IEnumerable<PermissionType> parentUserGroupPermissionTypes = PermissionTypeFacadeCaching.GetUserGroupPermissionTypes(userToken, parentEntityToken);\r\n                if (parentUserGroupPermissionTypes != null)\r\n                {\r\n                    permissionTypes = permissionTypes.Concat(parentUserGroupPermissionTypes);\r\n                }\r\n            }\r\n\r\n            var distinctPermissionTypes = permissionTypes.Distinct().ToList();\r\n\r\n            PermissionTypeFacadeCaching.SetInheritedPermissionsTypes(userToken, entityToken, distinctPermissionTypes);\r\n\r\n            return distinctPermissionTypes;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This uses a merged result of user permissions and user group permissions\r\n        /// </summary>\r\n        /// <param name=\"userToken\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"userPermissionDefinitions\"></param>\r\n        /// <param name=\"userGroupPermissionDefinitions\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsSubBrachContainingPermissionTypes(UserToken userToken, EntityToken entityToken, IEnumerable<UserPermissionDefinition> userPermissionDefinitions, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions)\r\n        {\r\n            Verify.ArgumentNotNull(userToken, \"userToken\");\r\n            Verify.ArgumentNotNull(entityToken, \"entityToken\");\r\n\r\n            IEnumerable<PermissionType> permissionTypes = GetCurrentPermissionTypes(userToken, entityToken, userPermissionDefinitions, userGroupPermissionDefinitions);\r\n\r\n            if (permissionTypes.Any())\r\n            {\r\n                return true;\r\n            }\r\n\r\n            // User permissions\r\n            foreach (UserPermissionDefinition userPermissionDefinition in userPermissionDefinitions)\r\n            {\r\n                if (!userPermissionDefinition.PermissionTypes.Contains(PermissionType.ClearPermissions))\r\n                {\r\n                    var graph = new RelationshipGraph(userPermissionDefinition.EntityToken, RelationshipGraphSearchOption.Both, true);\r\n\r\n                    if (graph.Levels.Any(level => level.AllEntities.Contains(entityToken)))\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n            }\r\n\r\n            // User group permissions\r\n            foreach (UserGroupPermissionDefinition userGroupPermissionDefinition in userGroupPermissionDefinitions)\r\n            {\r\n                if (!userGroupPermissionDefinition.PermissionTypes.Contains(PermissionType.ClearPermissions))\r\n                {\r\n                    var graph = new RelationshipGraph(userGroupPermissionDefinition.EntityToken, RelationshipGraphSearchOption.Both, true);\r\n\r\n                    if (graph.Levels.Any(level => level.AllEntities.Contains(entityToken)))\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionType> GetInheritedGroupPermissionsTypes(Guid userGroupId, EntityToken entityToken)\r\n        {\r\n            var userGroupPermissionDefinitions = GetUserGroupPermissionDefinitions(userGroupId);\r\n\r\n            List<EntityToken> parentEntityTokens = ParentsFacade.GetAllParents(entityToken);\r\n\r\n            var permissionTypes = new List<PermissionType>();\r\n            foreach (EntityToken parentEntityToken in parentEntityTokens)\r\n            {\r\n                permissionTypes.AddRange(GetInheritedGroupPermissionsTypesRecursivly(parentEntityToken, userGroupPermissionDefinitions));\r\n            }\r\n\r\n            return permissionTypes.Distinct();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<UserPermissionDefinition> GetUserPermissionDefinitions(string username)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(username, \"username\");\r\n\r\n            IEnumerable<UserPermissionDefinition> userPermissionDefinitions = UserPermissionDefinitionProviderPluginFacade.GetPermissionsByUser(username);\r\n\r\n            var result = new List<UserPermissionDefinition>();\r\n            foreach (UserPermissionDefinition userPermissionDefinition in userPermissionDefinitions)\r\n            {\r\n                EntityToken entityToken = userPermissionDefinition.EntityToken;\r\n                if (entityToken == null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                if (!entityToken.IsValid())\r\n                {\r\n                    if (UserPermissionDefinitionProviderPluginFacade.CanAlterDefinitions)\r\n                    {\r\n                        Log.LogWarning(\"PermissionTypeFacade\", \"System removing invalid permission setting for user '{0}' because the data entity token could not be validated. Token was '{1}'.\", username, userPermissionDefinition.SerializedEntityToken);\r\n                        UserPermissionDefinitionProviderPluginFacade.RemoveUserPermissionDefinition(new UserToken(username), userPermissionDefinition.SerializedEntityToken);\r\n                    }\r\n                    continue;\r\n                }\r\n                \r\n                result.Add(userPermissionDefinition);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<UserGroupPermissionDefinition> GetUserGroupPermissionDefinitions(string username)\r\n        {\r\n            var userGroupIds = UserGroupFacade.GetUserGroupIds(username);\r\n\r\n            foreach (Guid userGroupId in userGroupIds)\r\n            {\r\n                foreach (UserGroupPermissionDefinition userGroupPermissionDefinition in GetUserGroupPermissionDefinitions(userGroupId))\r\n                {\r\n                    yield return userGroupPermissionDefinition;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<UserGroupPermissionDefinition> GetUserGroupPermissionDefinitions(Guid userGroupId)\r\n        {\r\n            if (userGroupId == Guid.Empty) throw new ArgumentException(\"Guid value is empty\", \"userGroupId\");\r\n\r\n            IEnumerable<UserGroupPermissionDefinition> userPermissionDefinitions = UserGroupPermissionDefinitionProviderPluginFacade.GetPermissionsByUserGroup(userGroupId);\r\n\r\n            var result = new List<UserGroupPermissionDefinition>();\r\n            foreach (UserGroupPermissionDefinition userPermissionDefinition in userPermissionDefinitions)\r\n            {\r\n                var entityToken = userPermissionDefinition.EntityToken;\r\n                if (entityToken == null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                if (!entityToken.IsValid())\r\n                {\r\n                    if (UserPermissionDefinitionProviderPluginFacade.CanAlterDefinitions)\r\n                    {\r\n                        Log.LogWarning(\"PermissionTypeFacade\", \"System removing invalid permission setting for user group '{0}' because the data entity token could not be validated. Token was '{1}'.\", userGroupId, userPermissionDefinition.SerializedEntityToken);\r\n                        UserGroupPermissionDefinitionProviderPluginFacade.RemoveUserGroupPermissionDefinition(userGroupId, userPermissionDefinition.SerializedEntityToken);\r\n                    }\r\n                    continue;\r\n                }\r\n                \r\n                result.Add(userPermissionDefinition);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool CanAlterDefinitions\r\n        {\r\n            get\r\n            {\r\n                return UserPermissionDefinitionProviderPluginFacade.CanAlterDefinitions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetUserPermissionDefinition(UserPermissionDefinition userPermissionDefinition)\r\n        {\r\n            if (userPermissionDefinition == null) throw new ArgumentNullException(\"userPermissionDefinition\");\r\n\r\n            if (userPermissionDefinition.EntityToken is NoSecurityEntityToken) return;\r\n\r\n            if (userPermissionDefinition.PermissionTypes.Contains(PermissionType.ClearPermissions) &&\r\n                userPermissionDefinition.PermissionTypes.Count() > 1)\r\n            {\r\n                throw new ArgumentException(string.Format(\"The permission type '{0}' may not be used with other permission types\", PermissionType.ClearPermissions));\r\n            }\r\n\r\n            if (!UserPermissionDefinitionProviderPluginFacade.CanAlterDefinitions) throw new InvalidOperationException(\"The user permission definition provider does not support altering user permission defintions\");\r\n\r\n            EntityTokenCacheFacade.ClearCache();\r\n\r\n            UserPermissionDefinitionProviderPluginFacade.SetUserPermissionDefinition(userPermissionDefinition);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveUserPermissionDefinition(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            if (userToken == null) throw new ArgumentNullException(\"userToken\");\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            if (entityToken is NoSecurityEntityToken) return;\r\n\r\n            if (!UserPermissionDefinitionProviderPluginFacade.CanAlterDefinitions) throw new InvalidOperationException(\"The user permission definition provider does not support altering user permission defintions\");\r\n\r\n            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n\r\n            EntityTokenCacheFacade.ClearCache();\r\n\r\n            UserPermissionDefinitionProviderPluginFacade.RemoveUserPermissionDefinition(userToken, serializedEntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetUserGroupPermissionDefinition(UserGroupPermissionDefinition userGroupPermissionDefinition)\r\n        {\r\n            Verify.ArgumentNotNull(userGroupPermissionDefinition, \"userGroupPermissionDefinition\");\r\n\r\n            if (userGroupPermissionDefinition.EntityToken is NoSecurityEntityToken) return;\r\n\r\n            if (userGroupPermissionDefinition.PermissionTypes.Contains(PermissionType.ClearPermissions) &&\r\n                (userGroupPermissionDefinition.PermissionTypes.Count() > 1))\r\n            {\r\n                throw new ArgumentException(string.Format(\"The permission type '{0}' may not be used with other permission types\", PermissionType.ClearPermissions));\r\n            }\r\n\r\n            Verify.That(UserPermissionDefinitionProviderPluginFacade.CanAlterDefinitions, \"The user permission definition provider does not support altering user permission defintions\");\r\n\r\n            EntityTokenCacheFacade.ClearCache();\r\n\r\n            UserGroupPermissionDefinitionProviderPluginFacade.SetUserGroupPermissionDefinition(userGroupPermissionDefinition);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveUserPermissionDefinition(Guid userGroupId, EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            if (entityToken is NoSecurityEntityToken) return;\r\n\r\n            if (!UserPermissionDefinitionProviderPluginFacade.CanAlterDefinitions) throw new InvalidOperationException(\"The user permission definition provider does not support altering user permission defintions\");\r\n\r\n            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n\r\n            EntityTokenCacheFacade.ClearCache();\r\n\r\n            UserGroupPermissionDefinitionProviderPluginFacade.RemoveUserGroupPermissionDefinition(userGroupId, serializedEntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionType> AllPermissionTypes\r\n        {\r\n            get\r\n            {\r\n                foreach (PermissionType permissionType in GrantingPermissionTypes)\r\n                {\r\n                    yield return permissionType;\r\n                }\r\n\r\n                yield return PermissionType.ClearPermissions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionType> GrantingPermissionTypes\r\n        {\r\n            get\r\n            {\r\n                yield return PermissionType.Read;\r\n                yield return PermissionType.Add;\r\n                yield return PermissionType.Edit;\r\n                yield return PermissionType.Delete;\r\n                yield return PermissionType.Approve;\r\n                yield return PermissionType.Publish;\r\n                yield return PermissionType.Configure;\r\n                yield return PermissionType.Administrate;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionDescriptor> AllPermissionDescriptors => \r\n            AllPermissionTypes.Select(p => new PermissionDescriptor(p));\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionDescriptor> GrantingPermissionDescriptors => \r\n            GrantingPermissionTypes.Select(pt => new PermissionDescriptor(pt));\r\n\r\n\r\n\r\n        private static IReadOnlyCollection<PermissionType> RecursiveUpdateCurrentUserPermissionTypes(UserToken userToken, EntityToken entityToken, IEnumerable<UserPermissionDefinition> userPermissionDefinitions, HashSet<EntityTokenPair> alreadyProcessedTokens)\r\n        {\r\n            var cached = PermissionTypeFacadeCaching.GetUserPermissionTypes(userToken, entityToken);\r\n            if (cached != null)\r\n            {\r\n                return cached;\r\n            }\r\n\r\n            UserPermissionDefinition userPermissionDefinition = userPermissionDefinitions\r\n                .Where(f => entityToken.EqualsWithVersionIgnore(f.EntityToken)).SingleOrDefaultOrException(\"More then one UserPermissionDefinition for the same entity token\");\r\n\r\n            var thisPermissionTypes = new List<PermissionType>();\r\n            if (userPermissionDefinition != null)\r\n            {\r\n                thisPermissionTypes.AddRange(userPermissionDefinition.PermissionTypes);\r\n            }\r\n\r\n\r\n            if (thisPermissionTypes.Count > 0)\r\n            {\r\n                thisPermissionTypes = thisPermissionTypes.Distinct().ToList();\r\n\r\n                if (thisPermissionTypes.Contains(PermissionType.ClearPermissions))\r\n                {\r\n                    thisPermissionTypes = new List<PermissionType>();\r\n                }\r\n\r\n                PermissionTypeFacadeCaching.SetUserPermissionTypes(userToken, entityToken, thisPermissionTypes);\r\n\r\n                // Local defined permission overrules all other permissions\r\n                return thisPermissionTypes;\r\n            }\r\n\r\n            // Call resursively on all parents\r\n            var parentEntityTokens = ParentsFacade.GetAllParents(entityToken);\r\n\r\n            var parentsPermissionTypes = Enumerable.Empty<PermissionType>();\r\n            foreach (var parentEntityToken in parentEntityTokens)\r\n            {\r\n                var pair = new EntityTokenPair(entityToken, parentEntityToken);\r\n                if (alreadyProcessedTokens.Contains(pair)) continue;\r\n                \r\n                alreadyProcessedTokens.Add(pair);\r\n\r\n                var thisParentPermissionTypes = RecursiveUpdateCurrentUserPermissionTypes(userToken, parentEntityToken, userPermissionDefinitions, alreadyProcessedTokens);\r\n                var filteredPermissions = FilterParentPermissions(userToken, parentEntityToken, thisParentPermissionTypes);\r\n\r\n                parentsPermissionTypes = parentsPermissionTypes.Concat(filteredPermissions);\r\n            }\r\n\r\n            List<PermissionType> permissionTypes = parentsPermissionTypes.Distinct().ToList();\r\n\r\n            PermissionTypeFacadeCaching.SetUserPermissionTypes(userToken, entityToken, permissionTypes);\r\n\r\n            return permissionTypes;\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        private static IReadOnlyCollection<PermissionType> RecursiveUpdateCurrentUserGroupPermissionTypes(UserToken userToken, EntityToken entityToken, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions, HashSet<EntityTokenPair> alreadyProcessedTokens)\r\n        {\r\n            var cached = PermissionTypeFacadeCaching.GetUserGroupPermissionTypes(userToken, entityToken);\r\n            if (cached != null)\r\n            {\r\n                return cached;\r\n            }\r\n\r\n            var selectedUserGroupPermissionDefinitions = userGroupPermissionDefinitions.Where(f => entityToken.EqualsWithVersionIgnore(f.EntityToken));\r\n\r\n            var thisPermissionTypes = new List<PermissionType>();\r\n            foreach (var userGroupPermissionDefinition in selectedUserGroupPermissionDefinitions)\r\n            {\r\n                List<PermissionType> groupPermissionTypes = userGroupPermissionDefinition.PermissionTypes.ToList();\r\n\r\n                thisPermissionTypes.AddRange(groupPermissionTypes);\r\n            }\r\n\r\n            if (thisPermissionTypes.Count > 0)\r\n            {\r\n                thisPermissionTypes = thisPermissionTypes.Distinct().ToList();\r\n\r\n                if (thisPermissionTypes.Contains(PermissionType.ClearPermissions))\r\n                {\r\n                    thisPermissionTypes = new List<PermissionType>();\r\n                }\r\n\r\n                PermissionTypeFacadeCaching.SetUserGroupPermissionTypes(userToken, entityToken, thisPermissionTypes);\r\n\r\n                // Local defined permission overrules all other permissions\r\n                return thisPermissionTypes;\r\n            }\r\n\r\n            // Call resursively on all parents\r\n            List<EntityToken> parentEntityTokens = ParentsFacade.GetAllParents(entityToken);\r\n\r\n            var parentsPermissionTypes = Enumerable.Empty<PermissionType>();\r\n            foreach (EntityToken parentEntityToken in parentEntityTokens)\r\n            {\r\n                var pair = new EntityTokenPair(entityToken, parentEntityToken);\r\n                if (alreadyProcessedTokens.Contains(pair)) continue;\r\n\r\n                alreadyProcessedTokens.Add(pair);\r\n\r\n                var thisParentPermissionTypes = RecursiveUpdateCurrentUserGroupPermissionTypes(userToken, parentEntityToken, userGroupPermissionDefinitions, alreadyProcessedTokens);\r\n                var filteredPermissionTypes = FilterParentPermissions(userToken, entityToken, thisParentPermissionTypes);\r\n\r\n                parentsPermissionTypes = parentsPermissionTypes.Concat(filteredPermissionTypes);\r\n            }\r\n\r\n            List<PermissionType> permissionTypes = parentsPermissionTypes.Distinct().ToList();\r\n\r\n            PermissionTypeFacadeCaching.SetUserGroupPermissionTypes(userToken, entityToken, permissionTypes);\r\n\r\n            return permissionTypes;\r\n        }\r\n\r\n        private static IEnumerable<PermissionType> FilterParentPermissions(\r\n            UserToken userToken, EntityToken entityToken, IReadOnlyCollection<PermissionType> permissions)\r\n        {\r\n            if (!permissions.Any()\r\n                || !ElementFacade.IsPerspectiveEntityToken(entityToken))\r\n            {\r\n                return permissions;\r\n            }\r\n\r\n            bool perspectiveVisible = UserPerspectiveFacade.PerspectiveVisible(userToken.Username, entityToken);\r\n\r\n            if (perspectiveVisible) return permissions;\r\n\r\n            return GlobalSettingsFacade.InheritGlobalReadPermissionOnHiddenPerspectives\r\n                ? permissions.Where(p => p == PermissionType.Read)\r\n                : Enumerable.Empty<PermissionType>();\r\n        }\r\n\r\n\r\n        private static IEnumerable<PermissionType> GetInheritedGroupPermissionsTypesRecursivly(EntityToken entityToken, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions, List<EntityToken> visitedParents = null)\r\n        {\r\n            var selectedUserGroupPermissionDefinition = userGroupPermissionDefinitions.SingleOrDefault(f => entityToken.EqualsWithVersionIgnore(f.EntityToken));\r\n            if (selectedUserGroupPermissionDefinition != null)\r\n            {\r\n                if (selectedUserGroupPermissionDefinition.PermissionTypes.Contains(PermissionType.ClearPermissions) == false)\r\n                {\r\n                    foreach (PermissionType permissionType in selectedUserGroupPermissionDefinition.PermissionTypes)\r\n                    {\r\n                        yield return permissionType;\r\n                    }\r\n                }\r\n\r\n                yield break;\r\n            }\r\n\r\n            List<EntityToken> parentEntityTokens = ParentsFacade.GetAllParents(entityToken);           \r\n\r\n            if (visitedParents == null)\r\n            {\r\n                visitedParents = new List<EntityToken>();\r\n            }\r\n\r\n            var parentsPermissionTypes = Enumerable.Empty<PermissionType>();\r\n            foreach (EntityToken parentEntityToken in parentEntityTokens)\r\n            {\r\n                if (visitedParents.Contains(parentEntityToken)) continue;\r\n                visitedParents.Add(parentEntityToken);\r\n\r\n                IEnumerable<PermissionType> result = GetInheritedGroupPermissionsTypesRecursivly(parentEntityToken, userGroupPermissionDefinitions, visitedParents).ToList();\r\n\r\n                parentsPermissionTypes = parentsPermissionTypes.Concat(result);\r\n            }\r\n\r\n            foreach (PermissionType permissionType in parentsPermissionTypes.Distinct())\r\n            {\r\n                yield return permissionType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        private sealed class EntityTokenPair\r\n        {\r\n            public EntityTokenPair(EntityToken firstEntityToken, EntityToken secondEntityToken)\r\n            {\r\n                this.FirstEntityToken = firstEntityToken;\r\n                this.SecondEntityToken = secondEntityToken;\r\n            }\r\n\r\n\r\n            public EntityToken FirstEntityToken { get; }\r\n            public EntityToken SecondEntityToken { get; }\r\n\r\n\r\n            public override int GetHashCode()\r\n            {\r\n                return this.FirstEntityToken.GetHashCode() ^ this.SecondEntityToken.GetHashCode();\r\n            }\r\n\r\n\r\n            public bool Equals(EntityTokenPair entityTokenPair)\r\n            {\r\n                if (entityTokenPair == null) return false;\r\n\r\n                return this.FirstEntityToken.EqualsWithVersionIgnore(entityTokenPair.FirstEntityToken) &&\r\n                       this.SecondEntityToken.EqualsWithVersionIgnore(entityTokenPair.SecondEntityToken);\r\n            }\r\n\r\n\r\n            public override bool Equals(object obj)\r\n            {\r\n                return Equals(obj as EntityTokenPair);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/PermissionsFacade.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>\r\n    /// This class can be use to get allowed permissions for current user or given UserToken and an EntityToken.\r\n    /// </summary>\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    public static class PermissionsFacade\r\n    {\r\n        /// <summary>\r\n        /// This method will return all allowed permission for the current logged in user given the <paramref name=\"entityToken\"/>.\r\n        /// </summary>\r\n        /// <param name=\"entityToken\">EntityToken to get permissions for.</param>\r\n        /// <returns>Allowed permission types</returns>\r\n        public static IEnumerable<PermissionType> GetPermissionsForCurrentUser(EntityToken entityToken)\r\n        {\r\n            UserToken userToken = UserValidationFacade.GetUserToken();\r\n\r\n            return GetPermissions(userToken, entityToken);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This method will return all allowed permission for the given <paramref name=\"userToken\"/> and given the <paramref name=\"entityToken\"/>.\r\n        /// </summary>\r\n        /// <param name=\"userToken\">UserToken to get permissions for.</param>\r\n        /// <param name=\"entityToken\">EntityToken to get permissions for.</param>\r\n        /// <returns>Allowed permission types</returns>\r\n        public static IEnumerable<PermissionType> GetPermissions(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            IEnumerable<UserPermissionDefinition> userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username);\r\n            IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username);\r\n\r\n            IEnumerable<PermissionType> permissions = PermissionTypeFacade.GetCurrentPermissionTypes(userToken, entityToken, userPermissionDefinitions, userGroupPermissionDefinitions).Evaluate();\r\n\r\n            return permissions;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method returns true if the given username <paramref name=\"username\"/> has admin rights on the root element.\r\n        /// This is normal way of creating a administrator in C1.\r\n        /// </summary>\r\n        /// <param name=\"username\">Username to test</param>\r\n        /// <returns>True if the given username has admin rights on the root element.</returns>\r\n        public static bool IsAdministrator(string username)\r\n        {\r\n            UserToken userToken = new UserToken(username);\r\n\r\n            EntityToken rootEntityToken = ElementFacade.GetRootsWithNoSecurity().First().ElementHandle.EntityToken;\r\n\r\n            IEnumerable<PermissionType> permissions = GetPermissions(userToken, rootEntityToken);\r\n\r\n            return permissions.Contains(PermissionType.Administrate);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/HookRegistrator/HookRegistratorData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.HookRegistrator\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableHookRegistrator))]\r\n\tinternal class HookRegistratorData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/HookRegistrator/IHookRegistrator.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Security.Plugins.HookRegistrator.Runtime;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.HookRegistrator\r\n{\r\n    [CustomFactory(typeof(HookRegistratorCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(HookRegistratorDefaultNameRetriever))]\r\n\tinternal interface IHookRegistrator\r\n\t{\r\n        IEnumerable<EntityTokenHook> GetHooks();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/HookRegistrator/NonConfigurableHookRegistrator.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.HookRegistrator\r\n{\r\n    [Assembler(typeof(NonConfigurableHookRegistratorAssembler))]\r\n    internal sealed class NonConfigurableHookRegistrator : HookRegistratorData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableHookRegistratorAssembler : IAssembler<IHookRegistrator, HookRegistratorData>\r\n\t{\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IHookRegistrator Assemble(IBuilderContext context, HookRegistratorData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IHookRegistrator)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/HookRegistrator/Runtime/HookRegistratorCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.HookRegistrator.Runtime\r\n{\r\n    internal sealed class HookRegistratorCustomFactory : AssemblerBasedCustomFactory<IHookRegistrator, HookRegistratorData>\r\n    {\r\n        protected override HookRegistratorData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            HookRegistratorSettings settings = configurationSource.GetSection(HookRegistratorSettings.SectionName) as HookRegistratorSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", HookRegistratorSettings.SectionName));\r\n            }\r\n\r\n            return settings.HookRegistratorPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/HookRegistrator/Runtime/HookRegistratorDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.HookRegistrator.Runtime\r\n{\r\n    internal sealed class HookRegistratorDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/HookRegistrator/Runtime/HookRegistratorFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.HookRegistrator.Runtime\r\n{\r\n    internal sealed class HookRegistratorFactory : NameTypeFactoryBase<IHookRegistrator>\r\n    {\r\n        public HookRegistratorFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/HookRegistrator/Runtime/HookRegistratorSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.Core.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.HookRegistrator.Runtime\r\n{\r\n    internal sealed class HookRegistratorSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Security.Plugins.HookRegistratorConfiguration\";\r\n\r\n\r\n        private const string _hookRegistratorPluginsProperty = \"HookRegistratorPlugins\";\r\n        [ConfigurationProperty(_hookRegistratorPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<HookRegistratorData> HookRegistratorPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<HookRegistratorData>)base[_hookRegistratorPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/IFormLoginProvider.cs",
    "content": "\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginProvider\r\n{\r\n    /// <summary>\r\n    /// Interface for form login providers - providers able to validate logins (username/password) and manage basic login information. \r\n    /// The provider is as a minimum expected to provide Validate( username, password ), UsersExists { get; } and AllUsernames { get; }. \r\n    /// If the provider support adding new users and changing a users password, this is declared via CanAddNewUser and CanSetUserPassword.\r\n    /// </summary>\r\n    public interface IFormLoginProvider : ILoginProvider\r\n    {\r\n        /// <summary>\r\n        /// Validate a login (username and password combination)\r\n        /// </summary>\r\n        /// <param name=\"username\">User name to validate</param>\r\n        /// <param name=\"password\">Password to validate</param>\r\n        /// <returns>Emun describing the result of the validation</returns>\r\n        LoginResult Validate(string username, string password);\r\n\r\n        /// <summary>\r\n        /// Updates a user password\r\n        /// </summary>\r\n        /// <param name=\"username\">Name of user to update password for</param>\r\n        /// <param name=\"password\">Desired password</param>\r\n        void SetUserPassword(string username, string password);\r\n\r\n        /// <summary>\r\n        /// Create a new login\r\n        /// </summary>\r\n        /// <param name=\"username\">Name of user to update password for</param>\r\n        /// <param name=\"password\">Desired password</param>\r\n        /// <param name=\"group\">Name of group (simple container) for user</param>\r\n        /// <param name=\"email\">User email address</param>\r\n        void AddNewUser(string username, string password, string group, string email);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/ILoginProvider.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginProvider\r\n{\r\n    /// <summary>\r\n    /// Base interface for login providers.\r\n    /// </summary>\r\n    [CustomFactory(typeof(LoginProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(LoginProviderDefaultNameRetriever))]\r\n    public interface ILoginProvider\r\n    {\r\n        /// <summary>\r\n        /// Enumerates all known user names\r\n        /// </summary>\r\n        IEnumerable<string> AllUsernames { get; }\r\n\r\n        /// <summary>\r\n        /// When true the provider is capable of changing a users password\r\n        /// </summary>\r\n        bool CanSetUserPassword { get; }\r\n\r\n        /// <summary>\r\n        /// When true the provider is capable of creating new users\r\n        /// </summary>\r\n        bool CanAddNewUser { get; }\r\n\r\n        /// <summary>\r\n        /// When true users exists in the system, i.e. AllUsernames.Any()\r\n        /// </summary>\r\n        bool UsersExists { get; }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/IWindowsLoginProvider.cs",
    "content": "namespace Composite.C1Console.Security.Plugins.LoginProvider\r\n{\r\n    internal interface IWindowsLoginProvider : ILoginProvider\r\n    {\r\n        bool Validate(string username, string domainName);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/LoginProviderData.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginProvider\r\n{\r\n    /// <summary>\r\n    /// Base class for login provider configuration. Inherit from this class to declare the configuration a custom provider.\r\n    /// </summary>\r\n    public class LoginProviderData : NameTypeConfigurationElement\r\n    {\r\n        /// <exclude />\r\n        public LoginProviderData() : base(\"Unnamed\", typeof(ILoginProvider)) { }\r\n\r\n        /// <exclude />\r\n        public LoginProviderData(string name, Type type) : base(name, type) { }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/NonConfigurableLoginProvider.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginProvider\r\n{\r\n    /// <summary>\r\n    /// Default login provider configuration, you can use this if you require no custom configuration fields.\r\n    /// </summary>\r\n    [Assembler(typeof(NonConfigurableLoginProviderAssembler))]\r\n    public class NonConfigurableLoginProvider : LoginProviderData\r\n    {\r\n    }\r\n\r\n    /// <summary>\r\n    /// Assembles login providers based on type only, i.e. without anhy custom configuration. \r\n    /// If your provider require custom configuration you should also make your own assembler and configuration classes.\r\n    /// </summary>\r\n    public sealed class NonConfigurableLoginProviderAssembler : IAssembler<ILoginProvider, LoginProviderData>\r\n    {\r\n        /// <exclude />\r\n        public ILoginProvider Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, LoginProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            if (null == objectConfiguration) throw new ArgumentNullException(\"objectConfiguration\");\r\n\r\n            return (ILoginProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/Runtime/LoginProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.C1Console.Security.Plugins.LoginProvider;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginProvider.Runtime\r\n{\r\n    internal class LoginProviderCustomFactory : AssemblerBasedCustomFactory<ILoginProvider, LoginProviderData>\r\n    {\r\n        protected override LoginProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            LoginProviderSettings settings = (LoginProviderSettings)configurationSource.GetSection(LoginProviderSettings.SectionName);\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", LoginProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.LoginProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/Runtime/LoginProviderDefaultNameRetriever.cs",
    "content": "using System;\r\nusing System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginProvider.Runtime\r\n{\r\n    internal class LoginProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            if (null == configSource) throw new ArgumentNullException(\"configSource\");\r\n\r\n            if (null != name)\r\n            {\r\n                return name;\r\n            }\r\n            \r\n            var settings = configSource.GetSection(LoginProviderSettings.SectionName) as LoginProviderSettings;\r\n                \r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"Could not load configuration section {0}\", LoginProviderSettings.SectionName));\r\n            }\r\n                \r\n            return settings.DefaultLoginProviderPlugin;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/Runtime/LoginProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginProvider.Runtime\r\n{\r\n    internal class LoginProviderFactory : NameTypeFactoryBase<ILoginProvider>\r\n    {        \r\n        public LoginProviderFactory()            \r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginProvider/Runtime/LoginProviderSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginProvider.Runtime\r\n{\r\n    internal class LoginProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Security.Plugins.LoginProviderConfiguration\";\r\n\r\n        private const string _loginProvidersProperty = \"LoginProviderPlugins\";               \r\n        [ConfigurationProperty(_loginProvidersProperty, IsRequired = true)]\r\n        public NameTypeConfigurationElementCollection<LoginProviderData, LoginProviderData> LoginProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeConfigurationElementCollection<LoginProviderData, LoginProviderData>)base[_loginProvidersProperty];\r\n            }\r\n        }\r\n\r\n        private const string _defaultLoginProviderPluginProperty = \"defaultLoginProviderPlugin\";\r\n        [ConfigurationProperty(_defaultLoginProviderPluginProperty, IsRequired = true)]\r\n        public string DefaultLoginProviderPlugin\r\n        {\r\n            get { return (string)base[_defaultLoginProviderPluginProperty]; }\r\n            set { base[_defaultLoginProviderPluginProperty] = value; }\r\n        }\r\n\r\n        private const string _maxLoginAttempts = \"maxLoginAttempts\";\r\n        [ConfigurationProperty(_maxLoginAttempts, IsRequired = false, DefaultValue = int.MaxValue)]\r\n        public int MaxLoginAttempts\r\n        {\r\n            get { return (int)base[_maxLoginAttempts]; }\r\n            set { base[_maxLoginAttempts] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/ILoginSessionStore.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nusing Composite.C1Console.Security.Plugins.LoginSessionStore.Runtime;\r\nusing System.Net;\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginSessionStore\r\n{\r\n    /// <exclude />\r\n    [CustomFactory(typeof(LoginSessionStoreCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(LoginSessionStoreDefaultNameRetriever))]\r\n    public interface ILoginSessionStore\r\n    {   \r\n        /// <exclude />\r\n        bool CanPersistAcrossSessions { get; }\r\n\r\n        /// <exclude />\r\n        void StoreUsername(string username, bool persistAcrossSessions);\r\n\r\n        /// <exclude />\r\n        string StoredUsername { get; }\r\n\r\n        /// <exclude />\r\n        void FlushUsername();\r\n\r\n        /// <exclude />\r\n        IPAddress UserIpAddress { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/ILoginSessionStoreRedirectedLogout.cs",
    "content": "namespace Composite.C1Console.Security.Plugins.LoginSessionStore\r\n{\r\n    /// <summary>\r\n    /// Allows specifying a logout URL.\r\n    /// </summary>\r\n    public interface ILoginSessionStoreRedirectedLogout\r\n    {\r\n        /// <exclude />\r\n        string LogoutUrl { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/INoneConfigurationBasedLoginSessionStore.cs",
    "content": "﻿namespace Composite.C1Console.Security.Plugins.LoginSessionStore\r\n{\r\n    internal interface INoneConfigurationBasedLoginSessionStore : ILoginSessionStore\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/LoginSessionStoreData.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginSessionStore\r\n{\r\n    /// <exclude />\r\n    public class LoginSessionStoreData : NameTypeConfigurationElement\r\n    {\r\n        /// <exclude />\r\n        public LoginSessionStoreData() : base(\"Unnamed\", typeof(ILoginSessionStore)) { }\r\n\r\n        /// <exclude />\r\n        public LoginSessionStoreData(string name, Type type) : base(name, type) { }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/NonConfigurableLoginSessionStore.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginSessionStore\r\n{\r\n    /// <exclude />\r\n    [Assembler(typeof(NonConfigurableSessionDataProviderAssembler))]\r\n    public sealed class NonConfigurableLoginSessionStore : LoginSessionStoreData\r\n    {\r\n    }\r\n\r\n    /// <exclude />\r\n    public sealed class NonConfigurableSessionDataProviderAssembler : IAssembler<ILoginSessionStore, LoginSessionStoreData>\r\n    {\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public ILoginSessionStore Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, LoginSessionStoreData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (ILoginSessionStore)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n\r\n}"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/Runtime/LoginSessionStoreCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.C1Console.Security.Plugins.LoginSessionStore;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginSessionStore.Runtime\r\n{\r\n    internal class LoginSessionStoreCustomFactory : AssemblerBasedCustomFactory<ILoginSessionStore, LoginSessionStoreData>\r\n    {\r\n        protected override LoginSessionStoreData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            LoginSessionStoreSettings settings = (LoginSessionStoreSettings)configurationSource.GetSection(LoginSessionStoreSettings.SectionName);\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", LoginSessionStoreSettings.SectionName));\r\n            }\r\n\r\n            return settings.LoginSessionStores.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/Runtime/LoginSessionStoreDefaultNameRetriever.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginSessionStore.Runtime\r\n{\r\n    internal class LoginSessionStoreDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            if (null == configSource) throw new ArgumentNullException(\"configSource\");\r\n\r\n            if (null != name)\r\n            {\r\n                return name;\r\n            }\r\n            else\r\n            {\r\n                LoginSessionStoreSettings settings = configSource.GetSection(LoginSessionStoreSettings.SectionName) as LoginSessionStoreSettings;\r\n\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Could not load configuration section {0}\", LoginSessionStoreSettings.SectionName));\r\n                }\r\n\r\n                return settings.DefaultLoginSessionStore;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/Runtime/LoginSessionStoreFactory.cs",
    "content": "using System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginSessionStore.Runtime\r\n{\r\n    internal class LoginSessionStoreFactory : NameTypeFactoryBase<ILoginSessionStore>\r\n    {\r\n        public LoginSessionStoreFactory()            \r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\r\n        public new ILoginSessionStore CreateDefault()\r\n        {\r\n            if (ServiceLocator.HasService(typeof(INoneConfigurationBasedLoginSessionStore)))\r\n            {\r\n                var loginSessionstores = ServiceLocator.GetServices<INoneConfigurationBasedLoginSessionStore>().Union(new[] { base.CreateDefault() });\r\n\r\n                return new LoginSessionStoreResolver(loginSessionstores);\r\n            }\r\n\r\n            return new LoginSessionStoreResolver(new[] { base.CreateDefault() });\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/Runtime/LoginSessionStoreResolver.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginSessionStore.Runtime\r\n{\r\n    internal class LoginSessionStoreResolver : ILoginSessionStore, ILoginSessionStoreRedirectedLogout\r\n    {\r\n        private readonly IEnumerable<ILoginSessionStore> _loginSessionStores;\r\n\r\n        public LoginSessionStoreResolver(IEnumerable<ILoginSessionStore> loginSessionStores)\r\n        {\r\n            _loginSessionStores = loginSessionStores;\r\n        }\r\n\r\n        private ILoginSessionStore PreferredLoginSessionStore()\r\n        {\r\n            return _loginSessionStores.FirstOrDefault(f => f.StoredUsername != null);\r\n        }\r\n\r\n        public bool CanPersistAcrossSessions => Convert.ToBoolean(\r\n            PreferredLoginSessionStore()?.CanPersistAcrossSessions);\r\n\r\n        public void StoreUsername(string username, bool persistAcrossSessions)\r\n        {\r\n            _loginSessionStores.ForEach(f => f.StoreUsername(username, persistAcrossSessions));\r\n        }\r\n\r\n        public string StoredUsername => PreferredLoginSessionStore()?.StoredUsername;\r\n\r\n        public void FlushUsername()\r\n        {\r\n            _loginSessionStores.ForEach(f => f.FlushUsername());\r\n        }\r\n\r\n        public IPAddress UserIpAddress => PreferredLoginSessionStore()?.UserIpAddress;\r\n\r\n        public string LogoutUrl => _loginSessionStores\r\n            .OfType<ILoginSessionStoreRedirectedLogout>()\r\n            .Select(_ => _.LogoutUrl)\r\n            .FirstOrDefault(url => !string.IsNullOrEmpty(url));\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/LoginSessionStore/Runtime/LoginSessionStoreSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nusing Composite.C1Console.Security.Plugins.LoginSessionStore;\r\n\r\nnamespace Composite.C1Console.Security.Plugins.LoginSessionStore.Runtime\r\n{\r\n    internal class LoginSessionStoreSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Security.Plugins.LoginSessionStoreConfiguration\";\r\n\r\n        private const string _sessionDataProvidersProperty = \"LoginSessionStore\";        \r\n        [ConfigurationProperty(_sessionDataProvidersProperty, IsRequired = true)]\r\n        public NameTypeConfigurationElementCollection<LoginSessionStoreData, LoginSessionStoreData> LoginSessionStores\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeConfigurationElementCollection<LoginSessionStoreData, LoginSessionStoreData>)base[_sessionDataProvidersProperty];\r\n            }\r\n        }\r\n\r\n        private const string _defaultProviderProperty = \"defaultProvider\";\r\n        [ConfigurationProperty(_defaultProviderProperty, IsRequired = true)]\r\n        public string DefaultLoginSessionStore\r\n        {\r\n            get{ return (string)base[_defaultProviderProperty];}\r\n            set { base[_defaultProviderProperty] = value; }\r\n        }                \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/PasswordPolicy/IPasswordRule.cs",
    "content": "﻿using Composite.C1Console.Security.Plugins.PasswordPolicy.Runtime;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.C1Console.Security.Plugins.PasswordPolicy\r\n{\r\n    /// <summary>\r\n    /// Represents a password validaiton rule.\r\n    /// </summary>\r\n    [CustomFactory(typeof(PasswordRuleCustomFactory))]\r\n    public interface IPasswordRule\r\n    {\r\n        /// <summary>\r\n        /// Checks if the password satisfies the rule.\r\n        /// </summary>\r\n        /// <param name=\"user\">The user.</param>\r\n        /// <param name=\"password\">A password string.</param>\r\n        /// <returns><value>true</value> is password matches the rule, otherwise - <value>false</value></returns>\r\n        bool ValidatePassword(IUser user, string password);\r\n\r\n        /// <summary>\r\n        /// Returns rule description to be shown in UI if password didn't pass the validation.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        string GetRuleDescription();\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/PasswordPolicy/NonConfigurablePasswordRule.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.PasswordPolicy\r\n{\r\n    /// <exclude />\r\n    [Assembler(typeof(NonConfigurablePasswordRuleAssembler))]\r\n    public sealed class NonConfigurablePasswordRule : PasswordRuleData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurablePasswordRuleAssembler : IAssembler<IPasswordRule, PasswordRuleData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IPasswordRule Assemble(IBuilderContext context, PasswordRuleData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IPasswordRule)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/PasswordPolicy/PasswordRuleData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.PasswordPolicy\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(NonConfigurablePasswordRule))]\r\n    public class PasswordRuleData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/PasswordPolicy/Runtime/PasswordPolicySettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.C1Console.Security.Plugins.PasswordPolicy.Runtime\r\n{\r\n    internal class PasswordPolicySettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Security.Plugins.PasswordPolicy\";\r\n\r\n        /// <summary>\r\n        /// Password expiraton time in days. After password expires, the user will be asked to\r\n        /// </summary>\r\n        private const string _attr_passwordExpirationTimeInDays = \"passwordExpirationTimeInDays\";\r\n        [ConfigurationProperty(_attr_passwordExpirationTimeInDays, IsRequired = false, DefaultValue = 0)]\r\n        public int PasswordExpirationTimeInDays\r\n        {\r\n            get { return (int)base[_attr_passwordExpirationTimeInDays]; }\r\n            set { base[_attr_passwordExpirationTimeInDays] = value; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Number of old passwords to be preserved for every user.\r\n        /// </summary>\r\n        private const string _attr_passwordHistoryLength = \"passwordHistoryLength\";\r\n        [ConfigurationProperty(_attr_passwordHistoryLength, IsRequired = false, DefaultValue = 0)]\r\n        public int PasswordHistoryLength\r\n        {\r\n            get { return (int)base[_attr_passwordHistoryLength]; }\r\n            set { base[_attr_passwordHistoryLength] = value; }\r\n        }\r\n\r\n        \r\n\r\n        private const string _elem_PasswordRules = \"PasswordRules\";\r\n        [ConfigurationProperty(_elem_PasswordRules)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<PasswordRuleData> PasswordRules\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<PasswordRuleData>) base[_elem_PasswordRules];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/PasswordPolicy/Runtime/PasswordRuleCustomFactory.cs",
    "content": "using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.PasswordPolicy.Runtime\r\n{\r\n    internal class PasswordRuleCustomFactory : AssemblerBasedCustomFactory<IPasswordRule, PasswordRuleData>\r\n    {\r\n        protected override PasswordRuleData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            const string sectionName = PasswordPolicySettings.SectionName;\r\n            var settings = (PasswordPolicySettings)configurationSource.GetSection(sectionName);\r\n\r\n            if (settings == null)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", sectionName));\r\n            }\r\n\r\n            return settings.PasswordRules.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/PasswordPolicy/Runtime/PasswordRuleFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.PasswordPolicy.Runtime\r\n{\r\n    internal sealed class PasswordRuleFactory : NameTypeFactoryBase<IPasswordRule>\r\n    {\r\n        public PasswordRuleFactory() : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserGroupPermissionDefinitionProvider/IUserGroupPermissionDefinitionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider\r\n{\r\n    [CustomFactory(typeof(UserGroupPermissionDefinitionProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(UserGroupPermissionDefinitionProviderDefaultNameRetriever))]\r\n\tinternal interface IUserGroupPermissionDefinitionProvider\r\n\t{\r\n        IEnumerable<UserGroupPermissionDefinition> AllUserGroupPermissionDefinitions { get; }\r\n        bool CanAlterDefinitions { get; }\r\n\r\n        IEnumerable<UserGroupPermissionDefinition> GetPermissionsByUserGroup(Guid userGroupId);\r\n        void SetUserGroupPermissionDefinition(UserGroupPermissionDefinition userGroupPermissionDefinition);\r\n        void RemoveUserGroupPermissionDefinition(Guid userGroupId, string serializedEntityToken);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserGroupPermissionDefinitionProvider/NonConfigurableUserGroupPermissionDefinitionProvider.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableUserGroupPermissionDefinitionProviderAssembler))]\r\n    internal sealed class NonConfigurableUserGroupPermissionDefinitionProvider : UserGroupPermissionDefinitionProviderData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableUserGroupPermissionDefinitionProviderAssembler : IAssembler<IUserGroupPermissionDefinitionProvider, UserGroupPermissionDefinitionProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IUserGroupPermissionDefinitionProvider Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, UserGroupPermissionDefinitionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IUserGroupPermissionDefinitionProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserGroupPermissionDefinitionProvider/Runtime/UserGroupPermissionDefinitionProviderCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider.Runtime\r\n{\r\n    internal class UserGroupPermissionDefinitionProviderCustomFactory : AssemblerBasedCustomFactory<IUserGroupPermissionDefinitionProvider, UserGroupPermissionDefinitionProviderData>\r\n\t{\r\n        protected override UserGroupPermissionDefinitionProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            UserGroupPermissionDefinitionProviderSettings settings = (UserGroupPermissionDefinitionProviderSettings)configurationSource.GetSection(UserGroupPermissionDefinitionProviderSettings.SectionName);\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", UserGroupPermissionDefinitionProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.UserGroupPermissionDefinitionProvidersPlugins.Get(name);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserGroupPermissionDefinitionProvider/Runtime/UserGroupPermissionDefinitionProviderDefaultNameRetriever.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider.Runtime\r\n{\r\n    internal class UserGroupPermissionDefinitionProviderDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            if (null == configSource) throw new ArgumentNullException(\"configSource\");\r\n\r\n            if (null != name)\r\n            {\r\n                return name;\r\n            }\r\n            else\r\n            {\r\n                UserGroupPermissionDefinitionProviderSettings settings = configSource.GetSection(UserGroupPermissionDefinitionProviderSettings.SectionName) as UserGroupPermissionDefinitionProviderSettings;\r\n\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Could not load configuration section {0}\", UserGroupPermissionDefinitionProviderSettings.SectionName));\r\n                }\r\n\r\n                return settings.DefaultUserGroupPermissionDefinitionProvider;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserGroupPermissionDefinitionProvider/Runtime/UserGroupPermissionDefinitionProviderFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider.Runtime\r\n{\r\n    internal class UserGroupPermissionDefinitionProviderFactory : NameTypeFactoryBase<IUserGroupPermissionDefinitionProvider>\r\n    {\r\n        public UserGroupPermissionDefinitionProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserGroupPermissionDefinitionProvider/Runtime/UserGroupPermissionDefinitionProviderSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider.Runtime\r\n{\r\n    internal class UserGroupPermissionDefinitionProviderSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProviderConfiguration\";\r\n\r\n        private const string _userGroupPermissionDefinitionProviderPluginsPropertyName = \"UserGroupPermissionDefinitionProviderPlugins\";\r\n        [ConfigurationProperty(_userGroupPermissionDefinitionProviderPluginsPropertyName, IsRequired = true)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<UserGroupPermissionDefinitionProviderData> UserGroupPermissionDefinitionProvidersPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<UserGroupPermissionDefinitionProviderData>)base[_userGroupPermissionDefinitionProviderPluginsPropertyName];\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private const string _defaultProviderProperty = \"defaultProvider\";\r\n        [ConfigurationProperty(_defaultProviderProperty, IsRequired = true)]\r\n        public string DefaultUserGroupPermissionDefinitionProvider\r\n        {\r\n            get { return (string)base[_defaultProviderProperty]; }\r\n            set { base[_defaultProviderProperty] = value; }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserGroupPermissionDefinitionProvider/UserGroupPermissionDefinitionProviderData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableUserGroupPermissionDefinitionProvider))]\r\n    internal class UserGroupPermissionDefinitionProviderData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserPermissionDefinitionProvider/IUserPermissionDefinitionProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider\r\n{\r\n    [CustomFactory(typeof(UserPermissionDefinitionProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(UserPermissionDefinitionProviderDefaultNameRetriever))]\r\n\tinternal interface IUserPermissionDefinitionProvider\r\n\t{\r\n        IEnumerable<UserPermissionDefinition> AllUserPermissionDefinitions { get; }\r\n        bool CanAlterDefinitions { get; }\r\n\r\n        IEnumerable<UserPermissionDefinition> GetPermissionsByUser(string userName);\r\n        void SetUserPermissionDefinition(UserPermissionDefinition userPermissionDefinition);\r\n        void RemoveUserPermissionDefinition(UserToken userToken, string serializedEntityToken);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserPermissionDefinitionProvider/NonConfigurableUserPermissionDefinitionProvider.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableUserPermissionDefinitionProviderAssembler))]\r\n    internal sealed class NonConfigurableUserPermissionDefinitionProvider : UserPermissionDefinitionProviderData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableUserPermissionDefinitionProviderAssembler : IAssembler<IUserPermissionDefinitionProvider, UserPermissionDefinitionProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IUserPermissionDefinitionProvider Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, UserPermissionDefinitionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IUserPermissionDefinitionProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserPermissionDefinitionProvider/Runtime/UserPermissionDefinitionProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider.Runtime\r\n{\r\n    internal class UserPermissionDefinitionProviderCustomFactory : AssemblerBasedCustomFactory<IUserPermissionDefinitionProvider, UserPermissionDefinitionProviderData>\r\n    {\r\n        protected override UserPermissionDefinitionProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            UserPermissionDefinitionProviderSettings settings = (UserPermissionDefinitionProviderSettings)configurationSource.GetSection(UserPermissionDefinitionProviderSettings.SectionName);\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", UserPermissionDefinitionProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.UserPermissionDefinitionProvidersPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserPermissionDefinitionProvider/Runtime/UserPermissionDefinitionProviderDefaultNameRetriever.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider.Runtime\r\n{\r\n    internal class UserPermissionDefinitionProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            if (null == configSource) throw new ArgumentNullException(\"configSource\");\r\n\r\n            if (null != name)\r\n            {\r\n                return name;\r\n            }\r\n            else\r\n            {\r\n                UserPermissionDefinitionProviderSettings settings = configSource.GetSection(UserPermissionDefinitionProviderSettings.SectionName) as UserPermissionDefinitionProviderSettings;\r\n\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Could not load configuration section {0}\", UserPermissionDefinitionProviderSettings.SectionName));\r\n                }\r\n\r\n                return settings.DefaultUserPermissionDefinitionProvider;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserPermissionDefinitionProvider/Runtime/UserPermissionDefinitionProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider.Runtime\r\n{\r\n    internal class UserPermissionDefinitionProviderFactory : NameTypeFactoryBase<IUserPermissionDefinitionProvider>\r\n    {\r\n        public UserPermissionDefinitionProviderFactory()            \r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserPermissionDefinitionProvider/Runtime/UserPermissionDefinitionProviderSettings.cs",
    "content": "using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider.Runtime\r\n{\r\n    internal class UserPermissionDefinitionProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Security.Plugins.UserPermissionDefinitionProviderConfiguration\";\r\n\r\n        private const string _userPermissionDefinitionProviderPluginsPropertyName = \"UserPermissionDefinitionProviderPlugins\";\r\n        [ConfigurationProperty(_userPermissionDefinitionProviderPluginsPropertyName, IsRequired = true)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<UserPermissionDefinitionProviderData> UserPermissionDefinitionProvidersPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<UserPermissionDefinitionProviderData>)base[_userPermissionDefinitionProviderPluginsPropertyName];\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private const string _defaultProviderProperty = \"defaultProvider\";\r\n        [ConfigurationProperty(_defaultProviderProperty, IsRequired = true)]\r\n        public string DefaultUserPermissionDefinitionProvider\r\n        {\r\n            get { return (string)base[_defaultProviderProperty]; }\r\n            set { base[_defaultProviderProperty] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/Plugins/UserPermissionDefinitionProvider/UserPermissionDefinitionProviderData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableUserPermissionDefinitionProvider))]\r\n    internal class UserPermissionDefinitionProviderData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/RefreshBeforeAfterEntityTokenFinder.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal static class RefreshBeforeAfterEntityTokenFinder\r\n    {\r\n        public static IEnumerable<EntityToken> FindEntityTokens(RelationshipGraph beforeGraph, RelationshipGraph afterGraph)\r\n        {\r\n            Verify.ArgumentNotNull(beforeGraph, \"beforeGraph\");\r\n            Verify.ArgumentNotNull(afterGraph, \"afterGraph\");\r\n\r\n            var nodes = new List<RelationshipGraphNode>();\r\n\r\n            FindNodes(beforeGraph, afterGraph, nodes);\r\n            FindNodes(afterGraph, beforeGraph, nodes);\r\n\r\n            if (nodes.Count > 1)\r\n            {\r\n                nodes = nodes.Where(n => n.ParentNodes.Any()).ToList(); // Ignoring root node\r\n                nodes = FilterNodes(nodes); \r\n            }\r\n\r\n            foreach (RelationshipGraphNode node in nodes)\r\n            {\r\n                foreach (RelationshipGraphNode parentNode in node.ParentNodes)\r\n                {\r\n                    yield return parentNode.EntityToken;\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void FindNodes(RelationshipGraph leftGraph, RelationshipGraph rightGraph, List<RelationshipGraphNode> foundNodes)\r\n        {\r\n            foreach (RelationshipGraphNode leftNode in leftGraph.TopNodes)\r\n            {\r\n                RelationshipGraphNode currentNode = null;\r\n\r\n                foreach (RelationshipGraphNode rightNode in rightGraph.TopNodes)\r\n                {\r\n                    RelationshipGraphNode foundNode = FindNode(leftNode, rightNode, null);\r\n\r\n                    if (foundNode != null)\r\n                    {\r\n                        if (currentNode == null || currentNode.Level > foundNode.Level)\r\n                        {\r\n                            currentNode = foundNode;\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (currentNode != null)\r\n                {\r\n                    if (foundNodes.Find(node => node.EntityToken.Equals(currentNode.EntityToken)) == null)\r\n                    {\r\n                        foundNodes.Add(currentNode);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static RelationshipGraphNode FindNode(RelationshipGraphNode leftNode, RelationshipGraphNode rightNode, RelationshipGraphNode lastLeftNode)\r\n        {\r\n            // Searched for the first node in \"leftNode\" chain which isn't present in \"rightNode\" chain\r\n            // leftNode  -> A -> B -> C -> D -> ....\r\n            // rightNode -> A -> B -> C -> E -> ....\r\n            // Result: D;\r\n\r\n            // leftNode  -> A -> B -> C -> D\r\n            // rightNode -> A -> B -> C -> D -> ....\r\n            // Result: D;\r\n\r\n            // leftNode  -> A -> B -> C -> D -> ....\r\n            // rightNode -> A -> B -> C -> D \r\n            // Result: D;\r\n\r\n            // leftNode  -> A -> B -> C -> D\r\n            // rightNode -> A -> B -> C -> D \r\n            // Result: D;\r\n\r\n            if (!leftNode.EntityToken.Equals(rightNode.EntityToken))\r\n            {\r\n                return lastLeftNode; \r\n            }\r\n            \r\n            if (leftNode.ChildNode != null && rightNode.ChildNode != null)\r\n            {\r\n                return FindNode(leftNode.ChildNode, rightNode.ChildNode, leftNode);\r\n            }\r\n\r\n            return leftNode;\r\n        }\r\n\r\n\r\n\r\n        private static List<RelationshipGraphNode> FilterNodes(ICollection<RelationshipGraphNode> nodesToFilter)\r\n        {\r\n            var resultNodes = new List<RelationshipGraphNode>();\r\n\r\n            foreach (RelationshipGraphNode nodeToFilter in nodesToFilter)\r\n            {\r\n                bool anyParentsInTheList =\r\n                    nodesToFilter.Any(node => !node.EntityToken.Equals(nodeToFilter.EntityToken)\r\n                                              && IsParent(nodeToFilter, node));\r\n\r\n                if (!anyParentsInTheList)\r\n                {\r\n                    resultNodes.Add(nodeToFilter);\r\n                }\r\n            }\r\n\r\n            return resultNodes;\r\n        }\r\n\r\n\r\n\r\n        private static bool IsParent(RelationshipGraphNode possibleChildNode, RelationshipGraphNode possibleParentNode)\r\n        {\r\n            foreach (RelationshipGraphNode parentNode in possibleChildNode.ParentNodes)\r\n            {\r\n                if (parentNode.EntityToken.Equals(possibleParentNode.EntityToken) \r\n                    || IsParent(parentNode, possibleParentNode))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/RefreshDeleteEntityTokenFinder.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Security.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal static class RefreshDeleteEntityTokenFinder\r\n    {\r\n        public static IEnumerable<EntityToken> FindEntityTokens(RelationshipGraph beforeGraph)\r\n        {\r\n            return FindEntityTokens(beforeGraph, false);\r\n        }\r\n\r\n\r\n        public static IEnumerable<EntityToken> FindEntityTokens(RelationshipGraph beforeGraph, bool skipBottemNodes)\r\n        {\r\n            if (beforeGraph == null) throw new ArgumentNullException(\"beforeGraph\");\r\n\r\n            List<EntityToken> foundEntityTokens = new List<EntityToken>();\r\n\r\n            foreach (RelationshipGraphNode node in beforeGraph.BottomNodes)\r\n            {\r\n                if (skipBottemNodes)\r\n                {\r\n                    foreach (RelationshipGraphNode parentNode in node.ParentNodes)\r\n                    {\r\n                        FindExistingParents(parentNode, foundEntityTokens);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    FindExistingParents(node, foundEntityTokens);\r\n                }\r\n            }\r\n\r\n            return foundEntityTokens;\r\n        }\r\n\r\n\r\n\r\n        private static void FindExistingParents(RelationshipGraphNode node, List<EntityToken> foundEntityTokens)\r\n        {\r\n            if ((SecurityAncestorFacade.GetParents(node.EntityToken) != null) ||\r\n                (HookingFacade.GetHookies(node.EntityToken) != null))\r\n            {\r\n                if (foundEntityTokens.Find(et => et.GetHashCode() == node.EntityToken.GetHashCode()) == null)\r\n                {\r\n                    foundEntityTokens.Add(node.EntityToken);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                foreach (RelationshipGraphNode parentNode in node.ParentNodes)\r\n                {\r\n                    FindExistingParents(parentNode, foundEntityTokens);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/RelationshipGraph.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core.Extensions;\r\nusing Composite.C1Console.Security.Foundation;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class RelationshipOrientedGraphNodeExtensions\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<IEnumerable<EntityToken>> GetAllPaths(this RelationshipOrientedGraphNode node)\r\n        {\r\n            List<List<EntityToken>> allPaths = new List<List<EntityToken>>();\r\n            List<EntityToken> path = new List<EntityToken> { node.EntityToken };\r\n            allPaths.Add(path);\r\n\r\n            GetAllPathsImpl(node, path, allPaths, new List<RelationshipOrientedGraphNode>());\r\n\r\n            return allPaths;\r\n        }\r\n\r\n\r\n\r\n\r\n        private static void GetAllPathsImpl(RelationshipOrientedGraphNode node, List<EntityToken> currentPath, List<List<EntityToken>> allPaths, List<RelationshipOrientedGraphNode> processedNodes)\r\n        {\r\n            processedNodes.Add(node);\r\n\r\n            int count = node.Parents.Count();\r\n\r\n            if (count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (count == 1)\r\n            {\r\n                RelationshipOrientedGraphNode parentNode = node.Parents.Single();\r\n                if (!processedNodes.Contains(parentNode))\r\n                {\r\n                    currentPath.Add(parentNode.EntityToken);\r\n\r\n                    GetAllPathsImpl(parentNode, currentPath, allPaths, processedNodes);\r\n                }\r\n                return;\r\n            }\r\n            \r\n            allPaths.Remove(currentPath);\r\n            foreach (RelationshipOrientedGraphNode parentNode in node.Parents)\r\n            {\r\n                if (!processedNodes.Contains(parentNode))\r\n                {\r\n                    var newCurrentPath = new List<EntityToken>(currentPath);\r\n                    allPaths.Add(newCurrentPath);\r\n                    newCurrentPath.Add(parentNode.EntityToken);\r\n\r\n                    GetAllPathsImpl(parentNode, newCurrentPath, allPaths, new List<RelationshipOrientedGraphNode>(processedNodes));\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"EntityToken = {EntityToken}\")]\r\n    public sealed class RelationshipOrientedGraphNode\r\n    {\r\n        private List<RelationshipOrientedGraphNode> _parentNodes;\r\n        private Action<RelationshipOrientedGraphNode> _expandAction;\r\n\r\n\r\n        /// <exclude />\r\n        public RelationshipOrientedGraphNode(EntityToken entityToken, Action<RelationshipOrientedGraphNode> expandAction)\r\n        {\r\n            this.EntityToken = entityToken;\r\n            _expandAction = expandAction;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken { get; private set; }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<RelationshipOrientedGraphNode> Parents\r\n        {\r\n            get\r\n            {\r\n                Expand();\r\n\r\n                foreach (RelationshipOrientedGraphNode parentNode in _parentNodes)\r\n                {\r\n                    yield return parentNode;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal void Expand()\r\n        {\r\n            if (_parentNodes != null) return;\r\n\r\n            _parentNodes = new List<RelationshipOrientedGraphNode>();\r\n\r\n            _expandAction(this);\r\n        }\r\n\r\n\r\n\r\n        internal void AddParant(RelationshipOrientedGraphNode parentNode)\r\n        {\r\n            if (_parentNodes.Contains(parentNode) == false)\r\n            {\r\n                _parentNodes.Add(parentNode);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return this.EntityToken.GetHashCode();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as RelationshipOrientedGraphNode);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(RelationshipOrientedGraphNode node)\r\n        {\r\n            if (node == null) return false;\r\n\r\n            return node.EntityToken.Equals(this.EntityToken);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class RelationshipOrientedGraph\r\n    {\r\n        private List<RelationshipOrientedGraphNode> _nodes = new List<RelationshipOrientedGraphNode>();\r\n\r\n\r\n        /// <exclude />\r\n        public RelationshipOrientedGraph(EntityToken sourceEntityToken)\r\n        {\r\n            RelationshipOrientedGraphNode node = CreateNewNode(sourceEntityToken);\r\n\r\n            _nodes.Add(node);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public RelationshipOrientedGraphNode Root\r\n        {\r\n            get\r\n            {\r\n                return _nodes[0];\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void Expand(RelationshipOrientedGraphNode node)\r\n        {\r\n            IEnumerable<EntityToken> nativeParentEntityTokens = SecurityAncestorFacade.GetParents(node.EntityToken);\r\n            if (nativeParentEntityTokens != null)\r\n            {\r\n                nativeParentEntityTokens.ForEach(f => AddEntityToken(node, f));\r\n            }\r\n\r\n\r\n            IEnumerable<EntityToken> auxiliaryParentEntityTokens = AuxiliarySecurityAncestorFacade.GetParents(node.EntityToken);\r\n            if (auxiliaryParentEntityTokens != null)\r\n            {\r\n                auxiliaryParentEntityTokens.ForEach(f => AddEntityToken(node, f));\r\n            }\r\n\r\n\r\n            IEnumerable<EntityToken> hookingParentEntityTokens = HookingFacade.GetHookies(node.EntityToken);\r\n            if (hookingParentEntityTokens != null)\r\n            {\r\n                hookingParentEntityTokens.ForEach(f => AddEntityToken(node, f));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AddEntityToken(RelationshipOrientedGraphNode node, EntityToken parentEntityToken)\r\n        {\r\n            RelationshipOrientedGraphNode existingParentNode =\r\n                (from n in _nodes\r\n                 where n.EntityToken.Equals(parentEntityToken)\r\n                 select n).SingleOrDefault();\r\n\r\n            if (existingParentNode != null)\r\n            {\r\n                node.AddParant(existingParentNode);\r\n            }\r\n            else\r\n            {\r\n                RelationshipOrientedGraphNode parentNode = CreateNewNode(parentEntityToken);\r\n                _nodes.Add(parentNode);\r\n\r\n                node.AddParant(parentNode);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private RelationshipOrientedGraphNode CreateNewNode(EntityToken entityToken)\r\n        {\r\n            return new RelationshipOrientedGraphNode(entityToken, Expand);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum RelationshipGraphSearchOption\r\n    {\r\n        /// <summary>\r\n        /// Parent items get from <see cref=\"ISecurityAncestorProvider\"/>\r\n        /// </summary>\r\n        Native = 0,\r\n\r\n        /// <summary>\r\n        /// Parent items get from <see cref=\"IAuxiliarySecurityAncestorProvider\"/> and <see cref=\"HookingFacade\"/>\r\n        /// </summary>\r\n        Hooked = 1,\r\n\r\n        /// <exclude />\r\n        Both = 2\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class RelationshipGraph\r\n    {\r\n        private readonly RelationshipGraphSearchOption _searchOption;\r\n        private readonly Dictionary<int, List<RelationshipGraphNode>> _levels = new Dictionary<int, List<RelationshipGraphNode>>();\r\n        private readonly HashSet<EntityToken> _visitedEntityTokens = new HashSet<EntityToken>();\r\n        private readonly bool _excludeReoccuringNodes;\r\n\r\n        private bool _moreLevelsToExpend;\r\n\r\n        /// <exclude />\r\n        public RelationshipGraph(EntityToken sourceEntityToken, RelationshipGraphSearchOption searchOption)\r\n            : this(sourceEntityToken, searchOption, false, true)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public RelationshipGraph(EntityToken sourceEntityToken, RelationshipGraphSearchOption searchOption, bool lazyEvaluation)\r\n            : this(sourceEntityToken, searchOption, lazyEvaluation, true)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public RelationshipGraph(EntityToken sourceEntityToken, RelationshipGraphSearchOption searchOption, bool lazyEvaluation, bool excludeReoccuringNodes)\r\n        {\r\n            _excludeReoccuringNodes = excludeReoccuringNodes;\r\n\r\n            Verify.ArgumentNotNull(sourceEntityToken, \"sourceEntityToken\");\r\n\r\n            _searchOption = searchOption;\r\n\r\n            RelationshipGraphNode node = new RelationshipGraphNode(sourceEntityToken, 0, RelationshipGraphNodeType.Entity);\r\n            _levels.Add(0, new List<RelationshipGraphNode> { node });\r\n\r\n            string userName = UserValidationFacade.IsLoggedIn() ? UserSettings.Username : null;\r\n\r\n            ExpandNextLevel(userName);\r\n\r\n            if (lazyEvaluation == false)\r\n            {\r\n                while (_moreLevelsToExpend)\r\n                {\r\n                    ExpandNextLevel(userName);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<RelationshipGraphLevel> Levels\r\n        {\r\n            get\r\n            {\r\n                return new RelationshipGraphLevelEnumerable(this);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<RelationshipGraphNode> TopNodes\r\n        {\r\n            get\r\n            {\r\n                Verify.That(!_excludeReoccuringNodes, \"It is necessary to set 'excludeReoccuringNodes' to 'false' to enable TopNodes calculation.\");\r\n\r\n                foreach (List<RelationshipGraphNode> nodes in _levels.Values)\r\n                {\r\n                    foreach (RelationshipGraphNode node in nodes)\r\n                    {\r\n                        if (node.ParentNodes.Count == 0)\r\n                        {\r\n                            yield return node;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<RelationshipGraphNode> BottomNodes\r\n        {\r\n            get\r\n            {\r\n                foreach (List<RelationshipGraphNode> nodes in _levels.Values)\r\n                {\r\n                    foreach (RelationshipGraphNode node in nodes)\r\n                    {\r\n                        if (node.ChildNode == null)\r\n                        {\r\n                            yield return node;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            var sb = new StringBuilder();\r\n\r\n            foreach (RelationshipGraphLevel level in this.Levels)\r\n            {\r\n                sb.AppendLine(\"Level: \" + level.Level);\r\n                foreach (EntityToken entityToken in level.Entities)\r\n                {\r\n                    sb.AppendLine($\"Native: Type = {entityToken.Type} Source = {entityToken.Source} Id = {entityToken.Id}\");\r\n                }\r\n\r\n                foreach (EntityToken entityToken in level.HookedEntities)\r\n                {\r\n                    sb.AppendLine($\"Hooked: Type = {entityToken.Type} Source = {entityToken.Source} Id = {entityToken.Id}\");\r\n                }\r\n\r\n                sb.AppendLine(\"---------\");\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n        internal int LevelCount => _levels.Count;\r\n\r\n\r\n        internal RelationshipGraphLevel GetLevel(int level)\r\n        {\r\n            string userName = UserValidationFacade.IsLoggedIn() ? UserSettings.Username : null;\r\n\r\n            while (_levels.Count - 1 < level && _moreLevelsToExpend)\r\n            {\r\n                ExpandNextLevel(userName);\r\n            }\r\n\r\n            if (_levels.Count - 1 < level)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new RelationshipGraphLevel(level, _levels[level]);\r\n        }\r\n\r\n\r\n\r\n        private void ExpandNextLevel(string userName)\r\n        {\r\n            int levelNumber = _levels.Count - 1;\r\n\r\n            if (levelNumber > 1000)\r\n            {\r\n                throw new InvalidOperationException( $\"The entity token '{_levels[0][0].EntityToken}' has more than 1000 levels of parents, this might be an infinite loop\");\r\n            }\r\n\r\n            _moreLevelsToExpend = false;\r\n\r\n            List<RelationshipGraphNode> nodes = _levels[levelNumber];\r\n\r\n            if (nodes.Count > 1000)\r\n            {\r\n                throw new InvalidOperationException($\"The entity token '{_levels[0][0].EntityToken}' has more than 1000 nodes at the level {levelNumber}, this might be an infinite loop\");\r\n            }\r\n\r\n\r\n            foreach (RelationshipGraphNode node in nodes)\r\n            {\r\n                if (_searchOption == RelationshipGraphSearchOption.Native || _searchOption == RelationshipGraphSearchOption.Both)\r\n                {\r\n                    IEnumerable<EntityToken> parentEntityTokens;\r\n                    if (!EntityTokenCacheFacade.GetCachedNativeParents(node.EntityToken, out parentEntityTokens, userName))\r\n                    {\r\n                        parentEntityTokens = SecurityAncestorFacade.GetParents(node.EntityToken)?.Evaluate();\r\n\r\n                        EntityTokenCacheFacade.AddNativeCache(node.EntityToken, parentEntityTokens);\r\n                    }\r\n\r\n                    if (parentEntityTokens != null)\r\n                    {\r\n                        AddNewParentEntityTokens(node, parentEntityTokens, RelationshipGraphNodeType.Entity, levelNumber);\r\n                    }\r\n                }\r\n\r\n                if (_searchOption == RelationshipGraphSearchOption.Hooked || _searchOption == RelationshipGraphSearchOption.Both)\r\n                {\r\n                    IEnumerable<EntityToken> parentEntityTokens;\r\n\r\n                    if (!EntityTokenCacheFacade.GetCachedHookingParents(node.EntityToken, out parentEntityTokens, userName))\r\n                    {\r\n                        IEnumerable<EntityToken> auxiliaryParentEntityTokens = AuxiliarySecurityAncestorFacade.GetParents(node.EntityToken);\r\n                        IEnumerable<EntityToken> hookingParentEntityTokens = HookingFacade.GetHookies(node.EntityToken);\r\n\r\n                        parentEntityTokens = auxiliaryParentEntityTokens.ConcatOrDefault(hookingParentEntityTokens)?.Evaluate();\r\n\r\n                        EntityTokenCacheFacade.AddHookingCache(node.EntityToken, parentEntityTokens);\r\n                    }\r\n\r\n                    if (parentEntityTokens != null)\r\n                    {\r\n                        AddNewParentEntityTokens(node, parentEntityTokens, RelationshipGraphNodeType.Hooking, levelNumber);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AddNewParentEntityTokens(RelationshipGraphNode childNode, IEnumerable<EntityToken> parents, RelationshipGraphNodeType nodeType, int levelNumber)\r\n        {\r\n            int newLevelNumber = levelNumber + 1;\r\n\r\n            List<RelationshipGraphNode> levelNodes;\r\n            if (!_levels.TryGetValue(newLevelNumber, out levelNodes))\r\n            {\r\n                levelNodes = new List<RelationshipGraphNode>();\r\n                _levels.Add(newLevelNumber, levelNodes);\r\n            }\r\n\r\n\r\n            foreach (EntityToken parent in parents)\r\n            {\r\n                if(parent == null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                if (_visitedEntityTokens.Contains(parent))\r\n                {\r\n                    if (_excludeReoccuringNodes)\r\n                    {\r\n                        continue; // We have already visited this entity token, no new information here\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    _visitedEntityTokens.Add(parent);\r\n                }\r\n                \r\n            \r\n                var parentNode = new RelationshipGraphNode(parent, newLevelNumber, nodeType);\r\n\r\n                levelNodes.Add(parentNode);\r\n\r\n                childNode.ParentNodes.Add(parentNode);\r\n                parentNode.ChildNode = childNode;\r\n\r\n                _moreLevelsToExpend = true;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/RelationshipGraphLevel.cs",
    "content": "using System.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class RelationshipGraphLevel\r\n    {\r\n        private List<RelationshipGraphNode> _relationshipGraphNodes;\r\n\r\n        internal RelationshipGraphLevel(int level, List<RelationshipGraphNode> relationshipGraphNodes)\r\n        {\r\n            this.Level = level;\r\n            this._relationshipGraphNodes = relationshipGraphNodes;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int Level\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<EntityToken> Entities\r\n        {\r\n            get\r\n            {\r\n                return\r\n                    from node in _relationshipGraphNodes\r\n                    where node.NodeType == RelationshipGraphNodeType.Entity\r\n                    select node.EntityToken;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<EntityToken> HookedEntities\r\n        {\r\n            get\r\n            {\r\n                return\r\n                 from node in _relationshipGraphNodes\r\n                 where node.NodeType == RelationshipGraphNodeType.Hooking\r\n                 select node.EntityToken;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<EntityToken> AllEntities\r\n        {\r\n            get\r\n            {\r\n                return\r\n                  from node in _relationshipGraphNodes\r\n                  select node.EntityToken;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/RelationshipGraphNode.cs",
    "content": "using System.Diagnostics;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum RelationshipGraphNodeType\r\n    {\r\n        /// <exclude />\r\n        Entity = 0,\r\n        /// <exclude />\r\n\r\n        Hooking = 1\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"Level = {Level}, Type = {NodeType}, EntityToken = {EntityToken}\")]\r\n    public sealed class RelationshipGraphNode\r\n    {\r\n        internal RelationshipGraphNode(EntityToken entityToken, int level, RelationshipGraphNodeType relationshipGraphNodeType)\r\n        {\r\n            this.EntityToken = entityToken;\r\n            this.Level = level;\r\n            this.NodeType = relationshipGraphNodeType;\r\n            this.ChildNode = null;\r\n            this.ParentNodes = new List<RelationshipGraphNode>();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int Level\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public RelationshipGraphNodeType NodeType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public List<RelationshipGraphNode> ParentNodes\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public RelationshipGraphNode ChildNode\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/SecurityAncestorProviderAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsageAttribute(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]\r\n    public sealed class SecurityAncestorProviderAttribute : Attribute\r\n    {\r\n        private readonly Type _securityAncestorProviderType;\r\n\r\n\r\n        /// <exclude />\r\n        public SecurityAncestorProviderAttribute(Type securityAncestorProviderType)\r\n        {\r\n            _securityAncestorProviderType = securityAncestorProviderType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type SecurityAncestorProviderType\r\n        {\r\n            get { return _securityAncestorProviderType; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/SecurityAncestorProviders/NoAncestorSecurityAncestorProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security.SecurityAncestorProviders\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NoAncestorSecurityAncestorProvider : ISecurityAncestorProvider\r\n\t{\r\n        /// <exclude />\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            return new EntityToken[] { };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/SecurityResolver.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class SecurityResolver\r\n    {\r\n        /// <exclude />\r\n        public static SecurityResult Resolve(UserToken userToken, ActionToken actionToken, EntityToken entityToken, IEnumerable<UserPermissionDefinition> userPermissionDefinitions, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinition)\r\n        {\r\n            if (userToken == null) throw new ArgumentNullException(\"userToken\");\r\n            if (actionToken == null) throw new ArgumentNullException(\"actionToken\");\r\n\r\n            return Resolve(userToken, actionToken.PermissionTypes, entityToken, userPermissionDefinitions, userGroupPermissionDefinition);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static SecurityResult Resolve(UserToken userToken, IEnumerable<PermissionType> requiredPermissions, EntityToken entityToken, IEnumerable<UserPermissionDefinition> userPermissionDefinitions, IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinition)\r\n        {\r\n            if (userToken == null) throw new ArgumentNullException(\"userToken\");\r\n            if (requiredPermissions == null) throw new ArgumentNullException(\"requiredPermissions\");\r\n\r\n            if ((entityToken is NoSecurityEntityToken)) return SecurityResult.Allowed;\r\n\r\n            requiredPermissions = requiredPermissions.Evaluate();\r\n\r\n            if (!requiredPermissions.Any())\r\n            {\r\n                return SecurityResult.Allowed;\r\n            }\r\n\r\n            IEnumerable<PermissionType> currentPermissionTypes = PermissionTypeFacade.GetCurrentPermissionTypes(userToken, entityToken, userPermissionDefinitions, userGroupPermissionDefinition);\r\n\r\n            if (!currentPermissionTypes.Any())\r\n            {\r\n                return SecurityResult.Disallowed;\r\n            }\r\n\r\n            // At least one of the permissions should be allowed\r\n            foreach (PermissionType permissionType in currentPermissionTypes)\r\n            {\r\n                if (requiredPermissions.Contains(permissionType))\r\n                {\r\n                    return SecurityResult.Allowed;\r\n                }\r\n            }\r\n\r\n            return SecurityResult.Disallowed;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static SecurityResult Resolve(SecurityToken securityToken)\r\n        {\r\n            if (securityToken == null) throw new ArgumentNullException(\"securityToken\");\r\n\r\n            IEnumerable<UserPermissionDefinition> userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(securityToken.UserToken.Username);\r\n            IEnumerable<UserGroupPermissionDefinition> userGroupPermissionDefinition = PermissionTypeFacade.GetUserGroupPermissionDefinitions(securityToken.UserToken.Username);\r\n\r\n            return Resolve(securityToken.UserToken, securityToken.ActionToken, securityToken.EntityToken, userPermissionDefinitions, userGroupPermissionDefinition);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/SecurityResult.cs",
    "content": "namespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum SecurityResult\r\n    {\r\n        /// <exclude />\r\n        Disallowed,\r\n\r\n        /// <exclude />\r\n        Allowed,\r\n\r\n        /// <exclude />\r\n        Unspecified\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/SecurityToken.cs",
    "content": "namespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class SecurityToken\r\n    {\r\n        private EntityToken _entityToken;\r\n        private ActionToken _actionToken;\r\n        private UserToken _userToken;\r\n\r\n\r\n        /// <exclude />\r\n        public SecurityToken(EntityToken entityToken, ActionToken actionToken, UserToken userToken)\r\n        {\r\n            _entityToken = entityToken;\r\n            _actionToken = actionToken;\r\n            _userToken = userToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken\r\n        {\r\n            get { return _entityToken; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ActionToken ActionToken\r\n        {\r\n            get { return _actionToken; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public UserToken UserToken\r\n        {\r\n            get { return _userToken; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/UserGroupFacade.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>\r\n    /// Provides a cached lookup to user group ids related to a user\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class UserGroupFacade\r\n\t{\r\n        private static readonly ConcurrentDictionary<string, List<Guid>> _cache = new ConcurrentDictionary<string, List<Guid>>();\r\n\r\n\r\n        static UserGroupFacade()\r\n        {\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IUser>(OnDataChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IUserGroup>(OnDataChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IUserUserGroupRelation>(OnDataChanged, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IReadOnlyCollection<Guid> GetUserGroupIds(string username)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(username, nameof(username));\r\n\r\n            return _cache.GetOrAdd(username, name =>\r\n            {\r\n                IUser user = DataFacade.GetData<IUser>()\r\n                    .Where(f => string.Compare(f.Username, name, StringComparison.InvariantCultureIgnoreCase) == 0)\r\n                    .SingleOrDefaultOrException(\"Multiple data records for the same user name '{0}'\", name);\r\n\r\n                Verify.IsNotNull(user, \"Failed to find user by name '{0}'\", name);\r\n\r\n                return \r\n                    (from ur in DataFacade.GetData<IUserUserGroupRelation>()\r\n                     where ur.UserId == user.Id\r\n                     select ur.UserGroupId).ToList();\r\n            });\r\n        }\r\n\r\n        /// <exclude />\r\n\r\n        public static IEnumerable<CultureInfo> GetUserGroupActiveCultures(string username)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(username, nameof(username));\r\n\r\n            return\r\n                from ugal in DataFacade.GetData<IUserGroupActiveLocale>()\r\n                join uugr in DataFacade.GetData<IUserUserGroupRelation>() on ugal.UserGroupId equals uugr.UserGroupId\r\n                join user in DataFacade.GetData<IUser>() on uugr.UserId equals user.Id\r\n                where user.Username == username\r\n                select CultureInfo.CreateSpecificCulture(ugal.CultureName);\r\n        }\r\n\r\n\r\n        private static void OnDataChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            _cache.Clear();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/UserGroupPermissionDefinition.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic abstract class UserGroupPermissionDefinition\r\n\t{\r\n        private EntityToken _entityToken;\r\n        private bool _entityTokenInitialized;\r\n\r\n        /// <exclude />\r\n        public abstract Guid UserGroupId { get; }\r\n\r\n        /// <exclude />\r\n        public abstract IEnumerable<PermissionType> PermissionTypes { get; }\r\n\r\n        /// <exclude />\r\n        public abstract string SerializedEntityToken { get; }\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken\r\n        {\r\n            get\r\n            {\r\n                if (!_entityTokenInitialized)\r\n                {\r\n                    try\r\n                    {\r\n                        _entityToken = EntityTokenSerializer.Deserialize(this.SerializedEntityToken, false);\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogWarning(\"UserPermissionDefinition\", \"Failed to deserialize an entity token: '{0}'\", SerializedEntityToken);\r\n                        Log.LogWarning(\"UserPermissionDefinition\", ex);\r\n                    }\r\n                    finally\r\n                    {\r\n                        _entityTokenInitialized = true;\r\n                    }\r\n                }\r\n\r\n                return _entityToken;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/UserGroupPerspectiveFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class UserGroupPerspectiveFacade\r\n\t{\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetSerializedEntityTokens(string username)\r\n        {\r\n            foreach (Guid userGroupId in UserGroupFacade.GetUserGroupIds(username))\r\n            {\r\n                foreach (string serializedEntityToken in GetSerializedEntityTokens(userGroupId))\r\n                {\r\n                    yield return serializedEntityToken;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetSerializedEntityTokens(Guid userGroupId)\r\n        {\r\n            return\r\n                (from activePerspective in DataFacade.GetData<IUserGroupActivePerspective>()\r\n                 where activePerspective.UserGroupId == userGroupId\r\n                 select activePerspective.SerializedEntityToken).ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<EntityToken> GetEntityTokens(Guid userGroupId)\r\n        {\r\n            return GetSerializedEntityTokens(userGroupId).Select(EntityTokenSerializer.Deserialize);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<EntityToken> GetEntityTokens(string username)\r\n        {\r\n            return GetSerializedEntityTokens(username).Select(EntityTokenSerializer.Deserialize);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetEntityTokens(Guid userGroupId, IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            SetSerializedEntityTokens(userGroupId, entityTokens.Select(EntityTokenSerializer.Serialize));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetSerializedEntityTokens(Guid userGroupId, IEnumerable<string> serializedEntityTokens)\r\n        {\r\n            DataFacade.Delete<IUserGroupActivePerspective>(f => f.UserGroupId == userGroupId);\r\n\r\n            foreach (string serializedEntityToken in serializedEntityTokens)\r\n            {\r\n                var activePerspective = DataFacade.BuildNew<IUserGroupActivePerspective>();\r\n\r\n                activePerspective.Id = Guid.NewGuid();\r\n                activePerspective.UserGroupId = userGroupId;\r\n                activePerspective.SerializedEntityToken = serializedEntityToken;\r\n                \r\n                DataFacade.AddNew(activePerspective);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void DeleteAll(Guid userGroupId)\r\n        {\r\n            DataFacade.Delete<IUserGroupActivePerspective>(f => f.UserGroupId == userGroupId);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/UserLockoutReason.cs",
    "content": "﻿namespace Composite.C1Console.Security\r\n{\r\n    /// <summary>\r\n    /// Describing the user lockout reason\r\n    /// </summary>\r\n    internal enum UserLockoutReason\r\n    {\r\n        /// <summary>\r\n        /// Undefined\r\n        /// </summary>\r\n        Undefined = 0,\r\n        /// <summary>\r\n        /// User has been locked by administrator\r\n        /// </summary>\r\n        LockedByAdministrator = 1,\r\n        /// <summary>\r\n        /// There were too many login attempts\r\n        /// </summary>\r\n        TooManyFailedLoginAttempts = 2,\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/UserPermissionDefinition.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic abstract class UserPermissionDefinition\r\n\t{\r\n        private EntityToken _entityToken;\r\n        private bool _entityTokenInitialized;\r\n\r\n        /// <exclude />\r\n        public abstract string Username { get; }\r\n\r\n        /// <exclude />\r\n        public abstract IEnumerable<PermissionType> PermissionTypes { get; }\r\n\r\n        /// <exclude />\r\n        public abstract string SerializedEntityToken { get; }\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken\r\n        {\r\n            get\r\n            {\r\n                if (!_entityTokenInitialized)\r\n                {\r\n                    try\r\n                    {\r\n                        _entityToken = EntityTokenSerializer.Deserialize(this.SerializedEntityToken, false);\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogWarning(\"UserPermissionDefinition\", \"Failed to deserialize an entity token: '{0}'\", SerializedEntityToken);\r\n                        Log.LogWarning(\"UserPermissionDefinition\", ex);\r\n                    }\r\n                    finally\r\n                    {\r\n                        _entityTokenInitialized = true;\r\n                    }\r\n                }\r\n\r\n                return _entityToken;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/UserPerspectiveFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class UserPerspectiveFacade\r\n\t{\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetSerializedEntityTokens(string username)\r\n        {\r\n            return\r\n                from activePerspective in DataFacade.GetData<IUserActivePerspective>()\r\n                where activePerspective.Username == username\r\n                select activePerspective.SerializedEntityToken;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<EntityToken> GetEntityTokens(string username )\r\n        {\r\n            return GetSerializedEntityTokens(username).Select(EntityTokenSerializer.Deserialize);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetEntityTokens(string username, IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            SetSerializedEntityTokens(username, entityTokens.Select(EntityTokenSerializer.Serialize));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetSerializedEntityTokens(string username, IEnumerable<string> serializedEntityTokens)\r\n        {\r\n            DataFacade.Delete<IUserActivePerspective>(f => f.Username == username);\r\n\r\n            foreach (string serializedEntityToken in serializedEntityTokens)\r\n            {\r\n                var activePerspective = DataFacade.BuildNew<IUserActivePerspective>();\r\n\r\n                activePerspective.Username = username;\r\n                activePerspective.SerializedEntityToken = serializedEntityToken;\r\n                activePerspective.Id = Guid.NewGuid();\r\n\r\n                DataFacade.AddNew(activePerspective);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void DeleteAll(string username)\r\n        {\r\n            DataFacade.Delete<IUserActivePerspective>(f => f.Username == username);\r\n        }\r\n\r\n\r\n\t    internal static bool PerspectiveVisible(string username, EntityToken perspectiveEntityToken)\r\n\t    {\r\n            Verify.ArgumentNotNull(username, nameof(username));\r\n            Verify.ArgumentNotNull(perspectiveEntityToken, nameof(perspectiveEntityToken));\r\n\r\n            return GetEntityTokens(username).Contains(perspectiveEntityToken)\r\n\t               || UserGroupPerspectiveFacade.GetEntityTokens(username).Contains(perspectiveEntityToken);\r\n\t    }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/UserToken.cs",
    "content": "namespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class UserToken\r\n    {\r\n        /// <exclude />\r\n        public UserToken(string username)\r\n        {\r\n            this.Username = username;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Username\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return obj != null && obj is UserToken && (obj as UserToken).Username == Username;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return Username.GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Security/UserValidationFacade.cs",
    "content": "using System;\r\nusing System.Web;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class UserValidationFacade\r\n    {\r\n        private static readonly object _lock = new object();\r\n\r\n\r\n        /// <exclude />\r\n        public enum ValidationType \r\n        {\r\n            /// <exclude />\r\n            None = 0,\r\n\r\n            /// <exclude />\r\n            Form = 1,\r\n\r\n            /// <exclude />\r\n            Windows = 2\r\n        };\r\n\r\n\r\n        private static readonly Dictionary<LoginResult, string> LoginResultDescriptions = new Dictionary<LoginResult, string>\r\n        {\r\n            {LoginResult.IncorrectPassword, \"Incorrect password.\"},\r\n            {LoginResult.UserDoesNotExist, \"User does not exist.\"},\r\n            {LoginResult.PolicyViolated, \"Login policy violated.\"},\r\n            {LoginResult.UserLockedByAdministrator, \"User is locked by an administrator.\"},\r\n            {LoginResult.UserLockedAfterMaxLoginAttempts, \"User locked after reaching maximum login attempts.\"}\r\n        };\r\n\r\n\r\n        /// <exclude />\r\n        public static ValidationType GetValidationType()\r\n        {\r\n            if (LoginProviderPluginFacade.CheckType<IFormLoginProvider>())\r\n            {\r\n                return ValidationType.Form;\r\n            }\r\n            if (LoginProviderPluginFacade.CheckType<IWindowsLoginProvider>())\r\n            {\r\n                return ValidationType.Windows;\r\n            }\r\n\r\n            throw new InvalidOperationException($\"Validation plugin '{LoginProviderPluginFacade.GetValidationPluginType()}' does not implement a known validation interface\");\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> AllUsernames => LoginProviderPluginFacade.AllUsernames;\r\n\r\n\r\n        /// <exclude />\r\n        public static bool CanSetUserPassword => LoginProviderPluginFacade.CanSetUserPassword;\r\n\r\n\r\n        /// <summary>\r\n        /// Validates and persists a form based login. If no users exist and the user name matches the default administrator user, that user will be created.\r\n        /// </summary>\r\n        /// <param name=\"userName\"></param>\r\n        /// <param name=\"password\"></param>\r\n        /// <returns>True if the user was validated</returns>\r\n        public static LoginResult FormValidateUser(string userName, string password)\r\n        {\r\n            LoginResult loginResult = LoginProviderPluginFacade.FormValidateUser(userName, password);\r\n\r\n            if (loginResult == LoginResult.UserDoesNotExist && AdministratorAutoCreator.CanBeAutoCreated(userName))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    loginResult = LoginProviderPluginFacade.FormValidateUser(userName, password);\r\n\r\n                    if (loginResult == LoginResult.UserDoesNotExist && AdministratorAutoCreator.CanBeAutoCreated(userName))\r\n                    {\r\n                        AdministratorAutoCreator.AutoCreateAdministrator(userName, password, \"\");\r\n\r\n                        loginResult = LoginProviderPluginFacade.FormValidateUser(userName, password);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (loginResult == LoginResult.Success)\r\n            {\r\n                LoggingService.LogVerbose(\"UserValidation\", $\"The user: [{userName}], has been validated and accepted. {GetIpInformation()}\", LoggingService.Category.Audit);\r\n                PersistUsernameInSessionDataProvider(userName);\r\n            }\r\n            else if (LoginResultDescriptions.ContainsKey(loginResult))\r\n            {\r\n                LogLoginFailed(userName, LoginResultDescriptions[loginResult]);\r\n            }\r\n\r\n            return loginResult;\r\n        }\r\n\r\n        private static void LogLoginFailed(string userName, string message)\r\n        {\r\n            LoggingService.LogWarning(\"UserValidation\", \r\n                                      $\"Login as [{userName}] failed. {message} {GetIpInformation()}\",\r\n                                      LoggingService.Category.Audit);\r\n        }\r\n\r\n\r\n        private static string GetIpInformation()\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if(httpContext == null)\r\n            {\r\n                return string.Empty;\r\n            }\r\n\r\n            string ipaddress = httpContext.Request.ServerVariables[\"HTTP_X_FORWARDED_FOR\"];\r\n                  \r\n            if (String.IsNullOrWhiteSpace(ipaddress))\r\n            {\r\n                ipaddress = httpContext.Request.ServerVariables[\"REMOTE_ADDR\"]; \r\n            }\r\n\r\n            if (String.IsNullOrWhiteSpace(ipaddress))\r\n            {\r\n                return string.Empty;\r\n            }\r\n\r\n            return \"IP address: \" + ipaddress;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool FormValidateUserWithoutLogin(string userName, string password)\r\n        {\r\n            return LoginProviderPluginFacade.FormValidateUser(userName, password) == LoginResult.Success;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FormSetUserPassword(string userName, string password)\r\n        {\r\n            LoginProviderPluginFacade.FormSetUserPassword(userName, password);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Validates and persists a windows based login. Actual Windows username / password validation should precede this call.\r\n        /// </summary>\r\n        /// <param name=\"userName\"></param>\r\n        /// <param name=\"domainName\"></param>\r\n        /// <returns>True if the user was validated</returns>\r\n        public static bool WindowsValidateUser(string userName, string domainName)\r\n        {\r\n            bool userIsValidated = LoginProviderPluginFacade.WindowsValidateUser(userName, domainName);\r\n\r\n\r\n            if (userIsValidated)\r\n            {\r\n                PersistUsernameInSessionDataProvider(userName);\r\n            }\r\n\r\n            return userIsValidated;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Flushes the username from the login session.\r\n        /// </summary>\r\n        [Obsolete(\"Use Logout() instead.\")]\r\n        public static void FlushUsername() => Logout();\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Flushes the username from the login session (if applicable) and returns a logout URL.\r\n        /// </summary>\r\n        public static string Logout() => LoginSessionStorePluginFacade.Logout();\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsLoggedIn() => !string.IsNullOrEmpty(LoginSessionStorePluginFacade.StoredUsername);\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static UserToken GetUserToken()\r\n        {\r\n            var userName = LoginSessionStorePluginFacade.StoredUsername;\r\n            Verify.That(!string.IsNullOrEmpty(userName), \"No user has been logged in\");\r\n\r\n            return new UserToken(userName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetUsername()\r\n        {\r\n            var userName = LoginSessionStorePluginFacade.StoredUsername;\r\n            Verify.That(!string.IsNullOrEmpty(userName), \"No user has been logged in\");\r\n\r\n            return userName;\r\n        }\r\n\r\n\r\n\r\n        private static void PersistUsernameInSessionDataProvider(string userName)\r\n        {\r\n            LoginSessionStorePluginFacade.StoreUsername(userName, false);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Security/Utilities.cs",
    "content": "using System;\r\n\r\nnamespace Composite.C1Console.Security\r\n{\r\n    internal static class Utilities\r\n    {\r\n        public static void ParseUserLoginString(string windowsAuthenticatedFullName, out string userName, out string domainName)\r\n        {\r\n            ParseUserLoginString(windowsAuthenticatedFullName, out userName, out domainName, true);\r\n        }\r\n\r\n\r\n        public static bool TryParseUserLoginString(string windowsAuthenticatedFullName, out string userName, out string domainName)\r\n        {\r\n            return ParseUserLoginString(windowsAuthenticatedFullName, out userName, out domainName, false);\r\n        }\r\n\r\n\r\n        private static bool ParseUserLoginString(string windowsAuthenticatedFullName, out string userName, out string domainName, bool throwException)\r\n        {\r\n            // Format: [domain]\\[username] or [username]\r\n            if (string.IsNullOrEmpty(windowsAuthenticatedFullName))\r\n            {\r\n                userName = null;\r\n                domainName = null;\r\n                return HandleError(\"Authenticated user name can not be null or empty\", \"windowsAuthenticatedFullName\", throwException);\r\n            }\r\n\r\n            if (windowsAuthenticatedFullName.IndexOf(@\"\\\") == -1)\r\n            {\r\n                domainName = \"\";\r\n                userName = windowsAuthenticatedFullName;\r\n            }\r\n            else\r\n            {\r\n                char[] userLoginSeparator = { '\\\\' };\r\n                string[] userLoginParts = windowsAuthenticatedFullName.Split(userLoginSeparator);\r\n\r\n                if (2 == userLoginParts.Length && string.IsNullOrEmpty(userLoginParts[0]) == false && string.IsNullOrEmpty(userLoginParts[1]) == false)\r\n                {\r\n                    domainName = userLoginParts[0];\r\n                    userName = userLoginParts[1];\r\n                }\r\n                else\r\n                {\r\n                    userName = null;\r\n                    domainName = null;\r\n                    return HandleError(\"Unexpected user login format\", \"windowsAuthenticatedFullName\", throwException);\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n        private static bool HandleError(string message, string paramName, bool throwException)\r\n        {\r\n            if (throwException)\r\n            {\r\n                throw new ArgumentException(message, paramName);\r\n            }\r\n\r\n            return false;\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/BaseTaskManager.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Tasks\r\n{\r\n    internal class BaseTaskManager : ITaskManager\r\n    {\r\n        public virtual bool OnCreated(string taskId, TaskManagerEvent taskManagerEvent) { return true; }\r\n        public virtual void OnCompleted(string taskId, TaskManagerEvent taskManagerEvent) { }\r\n\r\n        public virtual void OnRun(string taskId, TaskManagerEvent taskManagerEvent) { }\r\n        public virtual void OnStatus(string taskId, TaskManagerEvent taskManagerEvent) { }\r\n        public virtual void OnIdle(string taskId, TaskManagerEvent taskManagerEvent) { }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/ITaskManager.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Tasks\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class TaskManagerEvent\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class FlowTaskManagerEvent : TaskManagerEvent\r\n    {\r\n        /// <exclude />\r\n        public FlowTaskManagerEvent(FlowToken flowToken)\r\n        {\r\n            this.FlowToken = flowToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public FlowToken FlowToken { get; private set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface ITaskManager\r\n\t{\r\n\r\n        /// <summary>\r\n        /// This is called when the tast is created for the first time.\r\n        /// If this method returns false, the task will not get started and\r\n        /// no more events on the task mananger will get called.\r\n        /// </summary>\r\n        /// <param name=\"taskId\"></param>\r\n        /// <param name=\"taskManagerEvent\"></param>\r\n        /// <returns></returns>\r\n        bool OnCreated(string taskId, TaskManagerEvent taskManagerEvent);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is called just before an action/flow is started\r\n        /// </summary>\r\n        /// <param name=\"taskId\"></param>\r\n        /// <param name=\"taskManagerEvent\"></param>\r\n        void OnRun(string taskId, TaskManagerEvent taskManagerEvent);\r\n\r\n\r\n        /// <summary>\r\n        /// This this will always be called after OnRun and before OnIdle.\r\n        /// It may not be called, and it might also be called more than once.\r\n        /// Check the <paramref name=\"taskManagerEvent\"/> for more information on the call\r\n        /// </summary>\r\n        /// <param name=\"taskId\"></param>\r\n        /// <param name=\"taskManagerEvent\"></param>\r\n        void OnStatus(string taskId, TaskManagerEvent taskManagerEvent);\r\n\r\n\r\n        /// <summary>\r\n        /// This is called after an action/flow has gone idle\r\n        /// </summary>\r\n        /// <param name=\"taskId\"></param>\r\n        /// <param name=\"taskManagerEvent\"></param>\r\n        void OnIdle(string taskId, TaskManagerEvent taskManagerEvent);\r\n\r\n\r\n        /// <summary>\r\n        /// This is called when the task is compleated.\r\n        /// </summary>\r\n        void OnCompleted(string taskId, TaskManagerEvent taskManagerEvent);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/ITaskManagerFacade.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Tasks\r\n{\r\n\tinternal interface ITaskManagerFacade\r\n\t{\r\n        void AttachTaskCreator(Func<EntityToken, ActionToken, Task> taskCreator);\r\n        TaskContainer CreateNewTasks(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent);\r\n        TaskContainer RuntTasks(FlowToken flowToken, TaskManagerEvent taskManagerEvent);\r\n        void CompleteTasks(FlowToken flowToken);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/ITaskManagerFlowControllerService.cs",
    "content": "﻿using Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Tasks\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface ITaskManagerFlowControllerService : IFlowControllerService\r\n\t{\r\n        /// <exclude />\r\n        void OnStatus(TaskManagerEvent taskManagerEvent);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/Task.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Tasks\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class Task\r\n    {\r\n        /// <exclude />\r\n        public Task(string id, Type taskManagerType)\r\n        {\r\n            VerifyTaskManagerType(taskManagerType);\r\n\r\n            this.Id = id;\r\n            this.TaskManagerType = taskManagerType;\r\n            this.StartTime = DateTime.Now;\r\n\r\n            this.TaskManager = (ITaskManager)Activator.CreateInstance(taskManagerType);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Id { get; private set; }\r\n\r\n        /// <exclude />\r\n        public Type TaskManagerType { get; private set; }\r\n\r\n        /// <exclude />\r\n        public DateTime StartTime { get; internal set; }\r\n\r\n        internal ITaskManager TaskManager { get; set; }\r\n        internal string FlowToken { get; set; }\r\n\r\n\r\n        private static void VerifyTaskManagerType(Type taskManagerType)\r\n        {\r\n            if (taskManagerType == null) throw new ArgumentNullException(\"taskManagerType\");\r\n            if (typeof(ITaskManager).IsAssignableFrom(taskManagerType) == false) throw new ArgumentException(\"The type taskManagerType is not assigneble from the type: \" + typeof(ITaskManager).FullName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/TaskContainer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Core;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Tasks\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class TaskContainer : IDisposable\r\n    {\r\n        private static readonly string LogTitle = typeof (TaskContainer).Name;\r\n\r\n        private readonly List<Task> _tasks;\r\n        private bool _disposed;\r\n\r\n\r\n\r\n        internal TaskContainer(List<Task> tasks, TaskManagerEvent taskManagerEvent)\r\n        {\r\n            _tasks = tasks;\r\n\r\n            foreach (Task task in _tasks)\r\n            {\r\n                task.TaskManager.OnRun(task.Id, taskManagerEvent);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateTasksWithFlowToken(FlowToken flowToken)\r\n        {\r\n            foreach (Task task in _tasks)\r\n            {\r\n                task.FlowToken = flowToken.Serialize();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void OnStatus(TaskManagerEvent taskManagerEvent)\r\n        {\r\n            foreach (Task task in _tasks)\r\n            {\r\n                task.TaskManager.OnStatus(task.Id, taskManagerEvent);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void SetOnIdleTaskManagerEvent(TaskManagerEvent taskManagerEvent)\r\n        {\r\n            _onIdleTaskManagerEvent = taskManagerEvent;\r\n        }\r\n\r\n\r\n        private TaskManagerEvent _onIdleTaskManagerEvent;\r\n\r\n\r\n        /// <summary>\r\n        /// Saves tasks to database\r\n        /// </summary>\r\n        public void SaveTasks()\r\n        {\r\n            foreach (Task task in _tasks)\r\n            {\r\n                try\r\n                {\r\n                    ITaskItem taskItem = DataFacade.BuildNew<ITaskItem>();\r\n                    taskItem.Id = Guid.NewGuid();\r\n                    taskItem.TaskId = task.Id;\r\n                    taskItem.TaskManagerType = TypeManager.SerializeType(task.TaskManagerType);\r\n                    taskItem.SerializedFlowToken = task.FlowToken;\r\n                    taskItem.StartTime = task.StartTime;\r\n\r\n                    DataFacade.AddNew<ITaskItem>(taskItem);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, \"Error while attempt to persist a task\");\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n\r\n        /// <exclude />\r\n        ~TaskContainer()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Dispose(bool disposing)\r\n        {\r\n            if (disposing && !_disposed)\r\n            {\r\n                _disposed = true;\r\n\r\n                foreach (Task task in _tasks)\r\n                {\r\n                    task.TaskManager.OnIdle(task.Id, _onIdleTaskManagerEvent);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/TaskManagerFacade.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Tasks\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class TaskManagerFacade\r\n    {\r\n        private static ITaskManagerFacade _implementation;\r\n        private static readonly object _syncRoot = new object();\r\n\r\n        internal static ITaskManagerFacade Implementation\r\n        {\r\n            get\r\n            {\r\n                // Avoiding initialization in a static constructor so sql timeouts won't cause the type initialization exception\r\n                var implementation = _implementation;\r\n                if(implementation == null)\r\n                {\r\n                    lock(_syncRoot)\r\n                    {\r\n                        implementation = _implementation;\r\n                        if(implementation == null)\r\n                        {\r\n                            _implementation = implementation = new TaskManagerFacadeImpl();\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return implementation;\r\n            } \r\n            set\r\n            {\r\n                _implementation = value;\r\n            }\r\n        }       \r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AttachTaskCreator(Func<EntityToken, ActionToken, Task> taskCreator)\r\n        {\r\n            Implementation.AttachTaskCreator(taskCreator);\r\n        }\r\n\r\n\r\n\r\n        internal static TaskContainer CreateNewTasks(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)\r\n        {\r\n            return Implementation.CreateNewTasks(entityToken, actionToken, taskManagerEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static TaskContainer RuntTasks(FlowToken flowToken, TaskManagerEvent taskManagerEvent)\r\n        {\r\n            return Implementation.RuntTasks(flowToken, taskManagerEvent);\r\n        }\r\n\r\n\r\n\r\n        internal static void CompleteTasks(FlowToken flowToken)\r\n        {\r\n            Implementation.CompleteTasks(flowToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/TaskManagerFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Tasks\r\n{\r\n    internal class TaskManagerFacadeImpl : ITaskManagerFacade\r\n    {\r\n        private readonly List<Func<EntityToken, ActionToken, Task>> _taskCreators = new List<Func<EntityToken, ActionToken, Task>>();\r\n        private readonly List<Task> _tasks = new List<Task>();\r\n\r\n        private readonly object _lock = new object();\r\n\r\n\r\n        public TaskManagerFacadeImpl()\r\n        {\r\n            LoadTasks();\r\n        }\r\n\r\n\r\n\r\n        public void AttachTaskCreator(Func<EntityToken, ActionToken, Task> taskCreator)\r\n        {\r\n            _taskCreators.Add(taskCreator);\r\n        }\r\n\r\n\r\n\r\n        public TaskContainer CreateNewTasks(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)\r\n        {\r\n            List<Task> newTasks = new List<Task>();\r\n\r\n            lock (_lock)\r\n            {\r\n                foreach (Func<EntityToken, ActionToken, Task> taskCreator in _taskCreators)\r\n                {\r\n                    try\r\n                    {\r\n                        Task task = taskCreator(entityToken, actionToken);\r\n                        if (task == null) continue;\r\n\r\n                        bool result = task.TaskManager.OnCreated(task.Id, taskManagerEvent);\r\n                        if (result == false) continue;\r\n\r\n                        _tasks.Add(task);\r\n                        newTasks.Add(task);\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(\"TaskManagerFacade\", \"Starting new task failed with following exception\");\r\n                        Log.LogError(\"TaskManagerFacade\", ex);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return new TaskContainer(newTasks, null);\r\n        }\r\n\r\n        public TaskContainer RuntTasks(FlowToken flowToken, TaskManagerEvent taskManagerEvent)\r\n        {\r\n            string serializedFlowToken = flowToken.Serialize();\r\n\r\n            List<Task> tasks;\r\n            lock (_lock)\r\n            {\r\n                tasks = _tasks.Where(f => f.FlowToken == serializedFlowToken).ToList();\r\n            }\r\n\r\n            return new TaskContainer(tasks, taskManagerEvent);\r\n        }\r\n\r\n\r\n\r\n        public void CompleteTasks(FlowToken flowToken)\r\n        {\r\n            string serializedFlowToken = flowToken.Serialize();\r\n\r\n            lock (_lock)\r\n            {\r\n                List<Task> tasks = _tasks.Where(f => f.FlowToken == serializedFlowToken).ToList();\r\n                foreach (Task task in tasks)\r\n                {\r\n                    task.TaskManager.OnCompleted(task.Id, null);\r\n                    _tasks.Remove(task);\r\n\r\n                    DataFacade.Delete<ITaskItem>(f => f.TaskId == task.Id);\r\n                }\r\n            }\r\n        }\r\n     \r\n\r\n        /// <summary>\r\n        /// Loads task persisted in database\r\n        /// </summary>\r\n        private void LoadTasks()\r\n        {\r\n            using (ThreadDataManager.EnsureInitialize())\r\n            {\r\n                IEnumerable<ITaskItem> taskItems = DataFacade.GetData<ITaskItem>().Evaluate();\r\n\r\n                var toDelete = new List<ITaskItem>();\r\n\r\n                foreach (ITaskItem taskItem in taskItems)\r\n                {\r\n                    Type type = TypeManager.TryGetType(taskItem.TaskManagerType);\r\n                    if (type == null)\r\n                    {\r\n                        Log.LogWarning(nameof(TaskManagerFacade),\r\n                            $\"Removing task item with id '{taskItem.TaskId}'. The Task Manager Type '{taskItem.TaskManagerType}' can not be found.\");\r\n\r\n                        toDelete.Add(taskItem);\r\n\r\n                        if (toDelete.Count >= 100)\r\n                        {\r\n                            DataFacade.Delete<ITaskItem>(toDelete);\r\n                            toDelete.Clear();\r\n                        }\r\n                        continue;\r\n                    }\r\n\r\n                    Task task = new Task(taskItem.TaskId, type)\r\n                    {\r\n                        StartTime = taskItem.StartTime,\r\n                        FlowToken = taskItem.SerializedFlowToken\r\n                    };\r\n\r\n                    _tasks.Add(task);\r\n                }\r\n\r\n                if (toDelete.Count > 0)\r\n                {\r\n                    DataFacade.Delete<ITaskItem>(toDelete);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Tasks/TaskManagerFlowControllerService.cs",
    "content": "﻿namespace Composite.C1Console.Tasks\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class TaskManagerFlowControllerService : ITaskManagerFlowControllerService\r\n\t{\r\n        private TaskContainer TaskContainer { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public TaskManagerFlowControllerService(TaskContainer taskContainer)\r\n        {\r\n            Verify.IsNotNull(taskContainer, \"taskContainer\");\r\n\r\n            this.TaskContainer = taskContainer;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void OnStatus(TaskManagerEvent taskManagerEvent)\r\n        {\r\n            this.TaskContainer.OnStatus(taskManagerEvent);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/ActionNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic abstract class ActionNode\r\n\t{\r\n        private static string TreeIdSerializedKeyName = \"_TreeId_\";\r\n        private static string ActionNodeIdSerializedKeyName = \"_ActionNodeId_\";\r\n\r\n\r\n        /// <exclude />\r\n        public string XPath { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public int Id { get; internal set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }                                   // Requried\r\n\r\n        /// <exclude />\r\n        public string ToolTip { get; set; }                                 // Defaults to Label\r\n\r\n        /// <exclude />\r\n        public ResourceHandle Icon { get; internal set; }                   // Requried\r\n\r\n        /// <exclude />\r\n        public ActionLocation Location { get; internal set; }               // Optional\r\n\r\n        /// <exclude />\r\n        public List<PermissionType> PermissionTypes { get; internal set; }  // Optional\r\n\r\n        /// <exclude />\r\n        public TreeNode OwnerNode { get; internal set; }\r\n\r\n        // Cached values\r\n        private DynamicValuesHelper LabelDynamicValuesHelper { get; set; }\r\n        private DynamicValuesHelper ToolTipDynamicValuesHelper { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected abstract void OnAddAction(Action<ElementAction> actionAdder, EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext);\r\n\r\n        /// <exclude />\r\n        protected virtual void OnInitialize() { }\r\n\r\n\r\n        /// <exclude />\r\n        protected ActionVisualizedData CreateActionVisualizedData(DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            return new ActionVisualizedData\r\n            {\r\n                Label = this.LabelDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext),\r\n                ToolTip = this.ToolTipDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext),\r\n                Icon = this.Icon,\r\n                Disabled = false,\r\n                ActionLocation = this.Location\r\n            };\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Use this method to do initializing and validation\r\n        /// </summary>\r\n        internal void Initialize() \r\n        {\r\n            this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);\r\n            this.LabelDynamicValuesHelper.Initialize(this);\r\n\r\n            this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);\r\n            this.ToolTipDynamicValuesHelper.Initialize(this);\r\n\r\n            OnInitialize();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            var piggybag = dynamicContext.Piggybag;\r\n            if (!entityToken.Equals(dynamicContext.CurrentEntityToken))\r\n            {\r\n                piggybag = piggybag.PreparePiggybag(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken);\r\n            }\r\n\r\n            var replaceContext = new DynamicValuesHelperReplaceContext(entityToken, piggybag);\r\n\r\n            OnAddAction(actionAdder, entityToken, dynamicContext, replaceContext);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            var sb = new StringBuilder();\r\n            Serialize(sb);\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void Serialize(StringBuilder sb)\r\n        {\r\n            StringConversionServices.SerializeKeyValuePair(sb, TreeIdSerializedKeyName, this.OwnerNode.Tree.TreeId);\r\n            StringConversionServices.SerializeKeyValuePair(sb, ActionNodeIdSerializedKeyName, this.Id);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ActionNode Deserialize(string serializedString)\r\n        {\r\n            Dictionary<string, string> serializedValueCollection = StringConversionServices.ParseKeyValueCollection(serializedString);\r\n\r\n            return Deserialize(serializedValueCollection);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ActionNode Deserialize(Dictionary<string, string> serializedValueCollection, bool removeEntiresFromCollection = false)\r\n        {\r\n            string treeId = StringConversionServices.DeserializeValueString(serializedValueCollection[TreeIdSerializedKeyName]);\r\n            int actionNodeId = StringConversionServices.DeserializeValueInt(serializedValueCollection[ActionNodeIdSerializedKeyName]);\r\n\r\n            if (removeEntiresFromCollection)\r\n            {\r\n                serializedValueCollection.Remove(TreeIdSerializedKeyName);\r\n                serializedValueCollection.Remove(ActionNodeIdSerializedKeyName);\r\n            }\r\n\r\n            Tree tree = TreeFacade.GetTree(treeId);\r\n\r\n            return tree?.GetActionNode(actionNodeId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void AddValidationError(ValidationError validationError)\r\n        {\r\n            this.OwnerNode.Tree.BuildResult.AddValidationError(validationError);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void AddValidationError(string stringName, params object[] args)\r\n        {\r\n            this.OwnerNode.Tree.BuildResult.AddValidationError(ValidationError.Create(this.XPath, stringName, args));\r\n        }\r\n\r\n\r\n        internal string LoadAndValidateCustomFormMarkupPath(string customFormMarkupPath)\r\n        {\r\n            string path;\r\n\r\n            try\r\n            {\r\n                path = PathUtil.Resolve(customFormMarkupPath);\r\n                if (!C1File.Exists(path))\r\n                {\r\n                    AddValidationError(\"TreeValidationError.CustomFormMarkup.MissingFile\", path);\r\n                    return customFormMarkupPath;\r\n                }\r\n            }\r\n            catch\r\n            {\r\n                AddValidationError(\"TreeValidationError.CustomFormMarkup.BadMarkupPath\", customFormMarkupPath);\r\n                return customFormMarkupPath;\r\n            }\r\n\r\n\r\n            try\r\n            {\r\n                XDocument.Load(path);\r\n            }\r\n            catch(Exception ex)\r\n            {\r\n                Log.LogError(nameof(ActionNode), $\"Failed to load xml file '{path}'\");\r\n                Log.LogError(nameof(ActionNode), ex);\r\n\r\n                AddValidationError(\"TreeValidationError.CustomFormMarkup.InvalidXml\", customFormMarkupPath);\r\n            }\r\n\r\n            return path;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/AttributeDynamicValuesHelper.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class AttributeDynamicValuesHelper\r\n    {\r\n        private readonly Dictionary<string, DynamicValuesHelper> _dynamicValuesHelpers = new Dictionary<string, DynamicValuesHelper>();\r\n\r\n        /// <exclude />\r\n        public XElement Element { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public AttributeDynamicValuesHelper(XElement element)\r\n        {\r\n            this.Element = element;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement ReplaceValues(DynamicValuesHelperReplaceContext context)\r\n        {\r\n            XElement result = new XElement(this.Element);\r\n\r\n            foreach (XAttribute attribute in GetAttributes(result))\r\n            {\r\n                DynamicValuesHelper dynamicValuesHelper = _dynamicValuesHelpers[GetKeyValue(attribute)];\r\n\r\n                string newValue = dynamicValuesHelper.ReplaceValues(context);\r\n\r\n                attribute.SetValue(newValue);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void Initialize(TreeNode ownerTreeNode)\r\n        {\r\n            foreach (XAttribute attribute in GetAttributes(this.Element))\r\n            {\r\n                string key = GetKeyValue(attribute);\r\n                if (_dynamicValuesHelpers.ContainsKey(key)) continue;\r\n\r\n                DynamicValuesHelper dynamicValuesHelper = new DynamicValuesHelper(attribute.Value);\r\n                dynamicValuesHelper.Initialize(ownerTreeNode);\r\n\r\n                _dynamicValuesHelpers.Add(key, dynamicValuesHelper);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<XAttribute> GetAttributes(XElement element)\r\n        {\r\n            return element.DescendantsAndSelf().Attributes();\r\n        }\r\n\r\n\r\n\r\n        private static string GetKeyValue(XAttribute attribute)\r\n        {\r\n            return attribute.Name + \"·\" + attribute.Value;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/BuildResult.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>  \r\n    /// Contains information about tree validation errors\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class BuildResult\r\n\t{\r\n        private readonly List<ValidationError> _validationErrors = new List<ValidationError>();\r\n\r\n\r\n        /// <exclude />\r\n        public void AddValidationError(ValidationError validationError)\r\n        {\r\n            Verify.IsNotNull(validationError, \"validationError\");\r\n\r\n            _validationErrors.Add(validationError);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<ValidationError> ValidationErrors \r\n        {\r\n            get { return _validationErrors; }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/ConfirmActionNode.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConfirmActionNode : ActionNode\r\n    {\r\n        /// <exclude />\r\n        public string ConfirmTitle { get; internal set; }                           // Requried\r\n\r\n        /// <exclude />\r\n        public string ConfirmMessage { get; internal set; }                         // Requried\r\n\r\n        /// <exclude />\r\n        public XElement FunctionMarkup { get; internal set; }                       // Requried\r\n\r\n        /// <exclude />\r\n        public bool RefreshTree { get; internal set; }                              // Optional\r\n\r\n\r\n        // Cached values\r\n        /// <exclude />\r\n        public DynamicValuesHelper ConfirmTitleDynamicValuesHelper { get; set; }\r\n\r\n        /// <exclude />\r\n        public DynamicValuesHelper ConfirmMessageDynamicValuesHelper { get; set; }\r\n\r\n        /// <exclude />\r\n        public AttributeDynamicValuesHelper FunctionMarkupDynamicValuesHelper { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            WorkflowActionToken actionToken = new WorkflowActionToken(\r\n                WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.ConfirmActionWorkflow\"),\r\n                this.PermissionTypes)\r\n            {\r\n                Payload = this.Serialize(),\r\n                ExtraPayload = PiggybagSerializer.Serialize(dynamicContext.Piggybag.PreparePiggybag(this.OwnerNode, dynamicContext.CurrentEntityToken)),\r\n                DoIgnoreEntityTokenLocking = true\r\n            };\r\n\r\n\r\n            actionAdder(new ElementAction(new ActionHandle(actionToken))\r\n            {\r\n                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n            });\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnInitialize()\r\n        {\r\n            try\r\n            {\r\n                FunctionTreeBuilder.Build(this.FunctionMarkup);\r\n            }\r\n            catch\r\n            {\r\n                AddValidationError(\"TreeValidationError.Common.WrongFunctionMarkup\");\r\n                return;\r\n            }\r\n\r\n\r\n            this.FunctionMarkupDynamicValuesHelper = new AttributeDynamicValuesHelper(this.FunctionMarkup);\r\n            this.FunctionMarkupDynamicValuesHelper.Initialize(this.OwnerNode);\r\n\r\n            this.ConfirmTitleDynamicValuesHelper = new DynamicValuesHelper(this.ConfirmTitle);\r\n            this.ConfirmTitleDynamicValuesHelper.Initialize(this.OwnerNode);\r\n\r\n            this.ConfirmMessageDynamicValuesHelper = new DynamicValuesHelper(this.ConfirmMessage);\r\n            this.ConfirmMessageDynamicValuesHelper.Initialize(this.OwnerNode);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/CustomUrlActionNode.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.WebClient;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal enum CustomUrlActionNodeViewType\r\n    {\r\n        GenericView = 0,\r\n        PageBrowser = 1,\r\n        FileDownload = 2,\r\n        DocumentView = 3,\r\n        ExternalView = 4\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class CustomUrlActionNode : ActionNode\r\n    {        \r\n        public string Url { get; internal set; }                                    // Requried        \r\n        public CustomUrlActionNodeViewType ViewType { get; internal set; }          // Optional\r\n        public string ViewLabel { get; internal set; }                              // Optional\r\n        public string ViewToolTip { get; internal set; }                            // Optional\r\n        public ResourceHandle ViewIcon { get; internal set; }                       // Optional\r\n        public bool External { get; internal set; }                                 // Optional\r\n        public Dictionary<string, string> PostParameters { get; internal set; }     // Optional\r\n\r\n        // Cached values\r\n        private DynamicValuesHelper UrlDynamicValuesHelper { get; set; }\r\n        private DynamicValuesHelper ViewLabelDynamicValuesHelper { get; set; }\r\n        private DynamicValuesHelper ViewToolTipDynamicValuesHelper { get; set; }\r\n\r\n\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            string url = this.UrlDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext);\r\n\r\n            this.External = url.Contains(\"//\");\r\n\r\n            if(!External)\r\n            {\r\n                url = UrlUtils.ResolvePublicUrl(url);\r\n            }\r\n\r\n            CustomUrlActionNodeActionToken actionToken = new CustomUrlActionNodeActionToken(\r\n                url,\r\n                this.External,\r\n                (this.External ? \"externalview\" : \"documentview\"),\r\n                this.ViewLabelDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext),\r\n                this.ViewToolTipDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext),\r\n                this.Serialize(),\r\n                this.PermissionTypes);\r\n\r\n            ElementAction elementAction = new ElementAction(new ActionHandle(actionToken))\r\n            {\r\n                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n            };\r\n\r\n            actionAdder(elementAction);\r\n        }\r\n\r\n\r\n\r\n        protected override void OnInitialize()\r\n        {\r\n            this.UrlDynamicValuesHelper = new DynamicValuesHelper(this.Url);\r\n            this.UrlDynamicValuesHelper.Initialize(this.OwnerNode);\r\n            this.UrlDynamicValuesHelper.UseUrlEncode = true;\r\n\r\n            this.ViewLabelDynamicValuesHelper = new DynamicValuesHelper(this.ViewLabel);\r\n            this.ViewLabelDynamicValuesHelper.Initialize(this.OwnerNode);\r\n\r\n            this.ViewToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ViewToolTip);\r\n            this.ViewToolTipDynamicValuesHelper.Initialize(this.OwnerNode);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class CustomUrlActionNodeActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            CustomUrlActionNodeActionToken customUrlActionNodeActionToken = (CustomUrlActionNodeActionToken)actionToken;\r\n\r\n            CustomUrlActionNode customUrlActionNode = (CustomUrlActionNode)ActionNode.Deserialize(customUrlActionNodeActionToken.SerializedActionNode);\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            switch (customUrlActionNode.ViewType)\r\n            {\r\n                case CustomUrlActionNodeViewType.DocumentView:\r\n                    {\r\n                        string viewId = Guid.NewGuid().ToString();\r\n                        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);\r\n\r\n                        OpenViewMessageQueueItem openViewMessageQueueItem = new OpenViewMessageQueueItem()\r\n                        {\r\n                            ViewId = viewId,\r\n                            EntityToken = serializedEntityToken,\r\n                            Label = customUrlActionNodeActionToken.ViewLabel,\r\n                            ToolTip = customUrlActionNodeActionToken.ViewToolTip,\r\n                            IconResourceHandle = customUrlActionNode.ViewIcon,\r\n                            Url = customUrlActionNodeActionToken.Url,\r\n                            UrlPostArguments = customUrlActionNode.PostParameters\r\n                        };\r\n                        ConsoleMessageQueueFacade.Enqueue(openViewMessageQueueItem, currentConsoleId);\r\n\r\n                        BindEntityTokenToViewQueueItem bindEntityTokenToViewQueueItem = new BindEntityTokenToViewQueueItem()\r\n                        {\r\n                            ViewId = viewId,\r\n                            EntityToken = serializedEntityToken\r\n                        };\r\n                        ConsoleMessageQueueFacade.Enqueue(bindEntityTokenToViewQueueItem, currentConsoleId);\r\n                    }\r\n                    break;\r\n\r\n                case CustomUrlActionNodeViewType.ExternalView:\r\n                    {\r\n                        string viewId = Guid.NewGuid().ToString();\r\n                        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);\r\n\r\n                        OpenExternalViewQueueItem openExternalViewQueueItem = new OpenExternalViewQueueItem(entityToken)\r\n                        {\r\n                            ViewId = viewId,\r\n                            EntityToken = serializedEntityToken,\r\n                            Label = customUrlActionNodeActionToken.ViewLabel,\r\n                            ToolTip = customUrlActionNodeActionToken.ViewToolTip,\r\n                            IconResourceHandle = customUrlActionNode.ViewIcon,\r\n                            Url = customUrlActionNodeActionToken.Url,\r\n                            ViewType = customUrlActionNodeActionToken.ViewType,\r\n                            UrlPostArguments = customUrlActionNode.PostParameters\r\n                        };\r\n                        ConsoleMessageQueueFacade.Enqueue(openExternalViewQueueItem, currentConsoleId);\r\n\r\n                        BindEntityTokenToViewQueueItem bindEntityTokenToViewQueueItem = new BindEntityTokenToViewQueueItem()\r\n                        {\r\n                            ViewId = viewId,\r\n                            EntityToken = serializedEntityToken\r\n                        };\r\n                        ConsoleMessageQueueFacade.Enqueue(bindEntityTokenToViewQueueItem, currentConsoleId);\r\n                    }\r\n                    break;\r\n\r\n                case CustomUrlActionNodeViewType.GenericView:\r\n                    {\r\n                        string viewId = Guid.NewGuid().ToString();\r\n                        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);\r\n\r\n                        OpenGenericViewQueueItem openGenericViewQueueItem = new OpenGenericViewQueueItem(entityToken)\r\n                        {\r\n                            ViewId = viewId,\r\n                            EntityToken = serializedEntityToken,\r\n                            Label = customUrlActionNodeActionToken.ViewLabel,\r\n                            ToolTip = customUrlActionNodeActionToken.ViewToolTip,\r\n                            IconResourceHandle = customUrlActionNode.ViewIcon,\r\n                            Url = customUrlActionNodeActionToken.Url,\r\n                            UrlPostArguments = customUrlActionNode.PostParameters\r\n                        };\r\n                        ConsoleMessageQueueFacade.Enqueue(openGenericViewQueueItem, currentConsoleId);\r\n\r\n                        BindEntityTokenToViewQueueItem bindEntityTokenToViewQueueItem = new BindEntityTokenToViewQueueItem()\r\n                        {\r\n                            ViewId = viewId,\r\n                            EntityToken = serializedEntityToken\r\n                        };\r\n                        ConsoleMessageQueueFacade.Enqueue(bindEntityTokenToViewQueueItem, currentConsoleId);\r\n                    }\r\n                    break;\r\n\r\n\r\n                case CustomUrlActionNodeViewType.PageBrowser:\r\n                    Dictionary<string, string> arguments = new Dictionary<string, string>();\r\n                    arguments.Add(\"URL\", customUrlActionNodeActionToken.Url);\r\n\r\n                    OpenHandledViewMessageQueueItem openHandledViewMessageQueueItem = new OpenHandledViewMessageQueueItem(\r\n                        EntityTokenSerializer.Serialize(entityToken, true), \r\n                        \"Composite.Management.Browser\", \r\n                        arguments\r\n                    );\r\n\r\n                    ConsoleMessageQueueFacade.Enqueue(openHandledViewMessageQueueItem, currentConsoleId);                    \r\n                    break;\r\n\r\n\r\n                case CustomUrlActionNodeViewType.FileDownload:\r\n                    DownloadFileMessageQueueItem downloadFileMessageQueueItem = new DownloadFileMessageQueueItem(customUrlActionNodeActionToken.Url);\r\n\r\n                    ConsoleMessageQueueFacade.Enqueue(downloadFileMessageQueueItem, currentConsoleId);                    \r\n                    break;\r\n            }\r\n\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [ActionExecutor(typeof(CustomUrlActionNodeActionExecutor))]\r\n    internal sealed class CustomUrlActionNodeActionToken : ActionToken\r\n    {\r\n        private List<PermissionType> _permissionTypes;\r\n\r\n\r\n        public CustomUrlActionNodeActionToken(string url, bool external, string viewtype, string viewLabel, string viewToolTip, string serializedActionNode, List<PermissionType> permissionTypes)\r\n        {\r\n            this.Url = url;\r\n            this.Extenal = external;\r\n            this.ViewType = viewtype;\r\n            this.ViewLabel = viewLabel;\r\n            this.ViewToolTip = viewToolTip;\r\n            _permissionTypes = permissionTypes;\r\n            this.SerializedActionNode = serializedActionNode;\r\n        }\r\n\r\n\r\n        public string Url { get; private set; }\r\n        public bool Extenal { get; private set; }\r\n        public string ViewLabel { get; private set; }\r\n        public string ViewToolTip { get; private set; }\r\n        public string ViewType { get; private set; }\r\n        public string SerializedActionNode { get; private set; }\r\n\r\n\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"Url\", this.Url);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"External\", this.Extenal.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"ViewType\", this.ViewType);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"ViewLabel\", this.ViewLabel);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"ViewToolTip\", this.ViewToolTip);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"SerializedActionNode\", this.SerializedActionNode);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"PermissionTypes\", _permissionTypes.SerializePermissionTypes());\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);            \r\n\r\n            return new CustomUrlActionNodeActionToken\r\n            (\r\n                StringConversionServices.DeserializeValueString(dic[\"Url\"]),\r\n                StringConversionServices.DeserializeValueBool(dic[\"External\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"ViewType\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"ViewLabel\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"ViewToolTip\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"SerializedActionNode\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"PermissionTypes\"]).DesrializePermissionTypes().ToList()\r\n            );\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/DataElementsTreeNode.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class DataElementsTreeNode : DataFilteringTreeNode\r\n    {\r\n        /// <exclude />\r\n        public Type InterfaceType { get; internal set; }        // Requried        \r\n\r\n        /// <exclude />\r\n        public string Label { get; internal set; }              // Optional\r\n\r\n        /// <exclude />\r\n        public string ToolTip { get; internal set; }            // Optional\r\n\r\n        /// <exclude />\r\n        public ResourceHandle Icon { get; internal set; }       // Defaults to C1 standard data icons\r\n\r\n        /// <exclude />\r\n        public ResourceHandle OpenedIcon { get; internal set; } // Defaults to C1 standard data icons or Icon if it is setted\r\n\r\n        /// <exclude />\r\n        public LeafDisplayMode Display { get; internal set; }   // Optional\r\n\r\n        /// <exclude />\r\n        public bool ShowForeignItems { get; internal set; }     // Optional\r\n\r\n        /// <exclude />\r\n        public string BrowserUrl { get; internal set; }     // Optional\r\n\r\n        /// <exclude />\r\n        public string BrowserImage { get; internal set; }     // Optional\r\n\r\n        // Cached values\r\n        private Dictionary<Type, ParentFilterHelper> ParentFilteringHelpers { get; set; }\r\n\r\n        // Cached values\r\n        private PropertyInfo KeyPropertyInfo { get; set; }\r\n\r\n        // Cached values\r\n        private ParentIdFilterNode JoinParentIdFilterNode { get; set; }\r\n        private DataElementsTreeNode JoinDataElementsTreeNode { get; set; }\r\n        private PropertyInfo JoinInnerKeyReferencePropertyInfo { get; set; }\r\n\r\n        private DynamicValuesHelper LabelDynamicValuesHelper { get; set; }\r\n        private DynamicValuesHelper ToolTipDynamicValuesHelper { get; set; }\r\n        private DynamicValuesHelper BrowserUrlDynamicValuesHelper { get; set; }\r\n        private DynamicValuesHelper BrowserImageDynamicValuesHelper { get; set; }\r\n\r\n\r\n        private static readonly ResourceHandle LocalizeDataTypeIcon = ResourceHandle.BuildIconFromDefaultProvider(\"tree-localize-data\");\r\n        private static readonly PermissionType[] LocalizeDataPermissionTypes = new PermissionType[] { PermissionType.Add };\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            IEnumerable<IData> dataset = GetDataset(dynamicContext, false).DataItems;\r\n\r\n            return dataset.Select(f => (EntityToken)f.GetDataEntityToken()).Evaluate();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override AncestorResult GetParentEntityToken(EntityToken ownEntityToken, Type parentInterfaceOfInterest, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            if (this.ParentFilteringHelpers == null)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Failed to find parent, are you missing a parent filter for the type '{0}'\", this.InterfaceType));\r\n            }\r\n\r\n            ParentFilterHelper helper;\r\n            if (this.ParentFilteringHelpers.TryGetValue(parentInterfaceOfInterest, out helper) == false)\r\n            {\r\n                // We cant find the interface of interest directly, so we will give 'some' parent entity token\r\n                // by using 'one' of our own parent id filters\r\n\r\n                helper = this.ParentFilteringHelpers.First().Value;\r\n            }\r\n\r\n            DataEntityToken dataEntityToken = (DataEntityToken)ownEntityToken;\r\n            IData data = dataEntityToken.Data;\r\n\r\n            Verify.ArgumentCondition(data != null, \"ownEntityToken\", \"Failed to get data\");\r\n\r\n            object parentFieldValue = helper.ParentReferencedPropertyInfo.GetValue(data, null);\r\n\r\n            ParameterExpression parameterExpression = Expression.Parameter(helper.ParentIdFilterNode.ParentFilterType, \"data\");\r\n\r\n            Expression expression = Expression.Equal(\r\n                ExpressionHelper.CreatePropertyExpression(helper.ParentRefereePropertyName, parameterExpression),\r\n                Expression.Constant(parentFieldValue, helper.ParentReferencedPropertyInfo.PropertyType)\r\n            );\r\n\r\n            Expression whereExpression = ExpressionHelper.CreateWhereExpression(\r\n                DataFacade.GetData(helper.ParentIdFilterNode.ParentFilterType).Expression,\r\n                parameterExpression, expression\r\n            );\r\n\r\n            IData parentDataItem = ExpressionHelper.GetCastedObjects<IData>(helper.ParentIdFilterNode.ParentFilterType, whereExpression)\r\n                                   .FirstOrDefault();\r\n\r\n            Verify.IsNotNull(parentDataItem, \"Failed to get parent data item. Check if there's a broken parent reference.\");\r\n            \r\n            DataEntityToken parentEntityToken = parentDataItem.GetDataEntityToken();\r\n\r\n            TreeNode parentTreeNode = this.ParentNode;\r\n            var dataElementsTreeNode = parentTreeNode as DataElementsTreeNode;\r\n\r\n            while (dataElementsTreeNode == null ||\r\n                   dataElementsTreeNode.InterfaceType != parentEntityToken.InterfaceType)\r\n            {\r\n                parentTreeNode = parentTreeNode.ParentNode;\r\n            }\r\n\r\n            return new AncestorResult(parentTreeNode, parentEntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<Element> OnGetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            bool localizationEnabled = this.ShowForeignItems && !UserSettings.ActiveLocaleCultureInfo.Equals(UserSettings.ForeignLocaleCultureInfo);\r\n            \r\n            NodeDataSet dataset = GetDataset(dynamicContext);\r\n\r\n            var itemKeys = new List<object>();\r\n            IEnumerable<IData> dataItems;\r\n            IEnumerable<object> keysJoinedByParentFilters = dataset.JoinedKeys;\r\n\r\n            if (localizationEnabled && UserSettings.ForeignLocaleCultureInfo != null)\r\n            {\r\n                NodeDataSet foreignDataset;\r\n                using (new DataScope(UserSettings.ForeignLocaleCultureInfo))\r\n                {\r\n                    foreignDataset = GetDataset(dynamicContext);\r\n                }\r\n\r\n                ParameterExpression parameterExpression = Expression.Parameter(this.InterfaceType, \"data\");\r\n\r\n                IEnumerable combinedData = dataset.DataItems.Concat(foreignDataset.DataItems).ToCastedDataEnumerable(this.InterfaceType);\r\n\r\n                Expression orderByExpression = this.CreateOrderByExpression(combinedData.AsQueryable().Expression, parameterExpression);\r\n\r\n                dataItems = combinedData.AsQueryable().Provider.CreateQuery<IData>(orderByExpression);\r\n\r\n                foreach (IData data in dataset.DataItems)\r\n                {\r\n                    Verify.IsNotNull(data, \"Fetching data for data interface '{0}' with expression '{1}' yielded an null element\".FormatWith(this.InterfaceType, orderByExpression));\r\n\r\n                    object keyValue = this.KeyPropertyInfo.GetValue(data, null);\r\n                    itemKeys.Add(keyValue);\r\n                }\r\n\r\n                keysJoinedByParentFilters = keysJoinedByParentFilters.ConcatOrDefault(foreignDataset.JoinedKeys);\r\n            }\r\n            else\r\n            {\r\n                dataItems = dataset.DataItems;\r\n                itemKeys = new List<object>();\r\n            }\r\n\r\n\r\n            var replaceContext = new DynamicValuesHelperReplaceContext(parentEntityToken, dynamicContext.Piggybag);\r\n\r\n            var elements = new List<Element>();\r\n\r\n            foreach (IData data in dataItems)\r\n            {\r\n                Verify.IsNotNull(data, \"Fetching data for data interface '{0}' yielded an null element\".FormatWith(this.InterfaceType));\r\n\r\n                var element = BuildElement(data, replaceContext, dynamicContext, localizationEnabled, itemKeys, ref keysJoinedByParentFilters, parentEntityToken);\r\n                if(element == null) continue;\r\n\r\n                elements.Add(element);\r\n            }\r\n\r\n            if (!this.OrderByNodes.Any())\r\n            {\r\n                return elements.OrderBy(f => f.VisualData.Label);\r\n            }\r\n\r\n            return elements;\r\n        }\r\n\r\n\r\n        private Element BuildElement(IData data, \r\n            DynamicValuesHelperReplaceContext replaceContext,\r\n            TreeNodeDynamicContext dynamicContext,\r\n            bool localizationEnabled,\r\n            List<object> itemKeys,\r\n            ref IEnumerable<object> keysJoinedByParentFilters,\r\n            EntityToken parentEntityToken\r\n            )\r\n        {\r\n            replaceContext.CurrentDataItem = data;\r\n            \r\n            object keyValue = this.KeyPropertyInfo.GetValue(data, null);\r\n\r\n            bool itemLocalizationEnabledAndForeign = localizationEnabled && !data.DataSourceId.LocaleScope.Equals(UserSettings.ActiveLocaleCultureInfo);\r\n\r\n            if (itemLocalizationEnabledAndForeign && itemKeys.Contains(keyValue)) return null;\r\n\r\n            var currentEntityToken = data.GetDataEntityToken();\r\n\r\n            var element = new Element(new ElementHandle\r\n            (\r\n                dynamicContext.ElementProviderName,\r\n                currentEntityToken,\r\n                dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken)\r\n            ));\r\n\r\n            if (parentEntityToken is TreePerspectiveEntityToken)\r\n            {\r\n                element.ElementHandle.Piggyback[StringConstants.PiggybagTreeId] = Tree.TreeId;\r\n            }\r\n\r\n            bool hasChildren;\r\n            bool isDisabled = false;\r\n            ResourceHandle icon, openedIcon;\r\n\r\n            if (itemLocalizationEnabledAndForeign)\r\n            {\r\n                hasChildren = false;\r\n                isDisabled = !data.IsTranslatable();\r\n\r\n                if (this.Icon != null)\r\n                {\r\n                    icon = this.Icon;\r\n                    openedIcon = this.OpenedIcon;\r\n                }\r\n                else\r\n                {\r\n                    icon = data.GetForeignIcon();\r\n                    openedIcon = icon;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (this.Display != LeafDisplayMode.Auto)\r\n                {\r\n                    hasChildren = ChildNodes.Any();\r\n                }\r\n                else\r\n                {\r\n                    hasChildren = ChildNodes.OfType<SimpleElementTreeNode>().Any();\r\n\r\n                    if (!hasChildren)\r\n                    {\r\n                        if (keysJoinedByParentFilters != null)\r\n                        {\r\n                            keysJoinedByParentFilters = keysJoinedByParentFilters.Evaluate();\r\n\r\n                            hasChildren = keysJoinedByParentFilters.Contains(keyValue);\r\n                        }\r\n                    }\r\n\r\n                    // Checking children filtered by FunctionFilters\r\n                    if (!hasChildren)\r\n                    {\r\n                        foreach (var childNode in this.ChildNodes.OfType<DataElementsTreeNode>()\r\n                            .Where(n => n.FilterNodes.OfType<FunctionFilterNode>().Any()))\r\n                        {\r\n                            var newDynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down)\r\n                            {\r\n                                ElementProviderName = dynamicContext.ElementProviderName,\r\n                                Piggybag = dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken),\r\n                                CurrentEntityToken = currentEntityToken\r\n                            };\r\n\r\n                            if (childNode.GetDataset(newDynamicContext, false).DataItems.Any())\r\n                            {\r\n                                hasChildren = true;\r\n                                break;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (this.Icon != null)\r\n                {\r\n                    icon = this.Icon;\r\n                    openedIcon = this.OpenedIcon;\r\n                }\r\n                else\r\n                {\r\n                    openedIcon = icon = data.GetIcon();\r\n                }\r\n            }\r\n\r\n            string label = this.Label.IsNullOrEmpty()\r\n                            ? data.GetLabel()\r\n                            : this.LabelDynamicValuesHelper.ReplaceValues(replaceContext);\r\n\r\n            string toolTip = this.ToolTip.IsNullOrEmpty()\r\n                            ? label\r\n                            : this.ToolTipDynamicValuesHelper.ReplaceValues(replaceContext);\r\n\r\n            if (itemLocalizationEnabledAndForeign)\r\n            {\r\n                label = string.Format(\"{0} ({1})\", label, DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo));\r\n\r\n                if (!data.IsTranslatable())\r\n                {\r\n                    toolTip = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"LocalizeDataWorkflow.DisabledData\");\r\n                }\r\n                else\r\n                {\r\n                    toolTip = string.Format(\"{0} ({1})\", toolTip, DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo));\r\n                }\r\n            }\r\n\r\n            element.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = label,\r\n                ToolTip = toolTip,\r\n                HasChildren = hasChildren,\r\n                Icon = icon,\r\n                OpenedIcon = openedIcon,\r\n                IsDisabled = isDisabled\r\n            };\r\n\r\n\r\n            if (InternalUrls.DataTypeSupported(data.DataSourceId.InterfaceType))\r\n            {\r\n                var dataReference = data.ToDataReference();\r\n\r\n                if (DataUrls.CanBuildUrlForData(dataReference))\r\n                {\r\n                    string internalUrl = InternalUrls.TryBuildInternalUrl(dataReference);\r\n\r\n                    if (internalUrl != null)\r\n                    {\r\n                        element.PropertyBag.Add(\"Uri\", internalUrl);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (this.BrowserUrl != null)\r\n            {\r\n                var url = this.BrowserUrlDynamicValuesHelper.ReplaceValues(replaceContext);\r\n\r\n                if (!url.Contains(\"//\"))\r\n                {\r\n                    url = Core.WebClient.UrlUtils.ResolvePublicUrl(url);\r\n                }\r\n\r\n                element.PropertyBag.Add(\"BrowserUrl\", url);\r\n                element.PropertyBag.Add(\"BrowserToolingOn\", \"false\");\r\n            }\r\n\r\n\r\n            if (this.BrowserImage != null)\r\n            {\r\n                var url = this.BrowserImageDynamicValuesHelper.ReplaceValues(replaceContext);\r\n\r\n                if (!url.Contains(\"//\"))\r\n                {\r\n                    url = Core.WebClient.UrlUtils.ResolvePublicUrl(url);\r\n                }\r\n\r\n                element.PropertyBag.Add(\"ListViewImage\", url);\r\n\r\n                if (this.BrowserUrl == null)\r\n                {\r\n                    element.PropertyBag.Add(\"DetailViewImage\", url);\r\n                }\r\n            }\r\n\r\n\r\n            if (itemLocalizationEnabledAndForeign)\r\n            {\r\n                var actionToken = new WorkflowActionToken(\r\n                    WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.LocalizeDataWorkflow\"),\r\n                    LocalizeDataPermissionTypes);\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(actionToken))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"LocalizeDataWorkflow.LocalizeDataLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"LocalizeDataWorkflow.LocalizeDataToolTip\"),\r\n                        Icon = LocalizeDataTypeIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = ActionLocation.OtherPrimaryActionLocation\r\n                    }\r\n                });\r\n            }\r\n\r\n            return element;\r\n        }\r\n             \r\n\r\n        /// <exclude />\r\n        protected override void OnInitialize()\r\n        {\r\n            if (!typeof(IData).IsAssignableFrom(this.InterfaceType))\r\n            {\r\n                AddValidationError(\"TreeValidationError.Common.NotImplementingIData\", this.InterfaceType, typeof(IData));\r\n                return;\r\n            }\r\n\r\n            IEnumerable<Type> siblingInterfaceTypes = this.ParentNode.ChildNodes.Where(f => f.GetType() == typeof(DataElementsTreeNode)).Select(f => ((DataElementsTreeNode)f).InterfaceType).ToList();\r\n            if (siblingInterfaceTypes.Count() != siblingInterfaceTypes.Distinct().Count())\r\n            {\r\n                AddValidationError(\"TreeValidationError.DataElementsTreeNode.SameInterfaceUsedTwice\", this.InterfaceType);\r\n                return;\r\n            }\r\n\r\n\r\n            this.KeyPropertyInfo = this.CurrentDataInterfaceType.GetKeyProperties()[0];\r\n\r\n\r\n            foreach (ParentIdFilterNode parentIdFilterNode in this.FilterNodes.OfType<ParentIdFilterNode>())\r\n            {\r\n                if (this.ParentFilteringHelpers == null) this.ParentFilteringHelpers = new Dictionary<Type, ParentFilterHelper>();\r\n\r\n                if (this.ParentFilteringHelpers.ContainsKey(parentIdFilterNode.ParentFilterType))\r\n                {\r\n                    AddValidationError(\"TreeValidationError.DataElementsTreeNode.SameParentFilterInterfaceUsedTwice\", parentIdFilterNode.ParentFilterType);\r\n                    return;\r\n                }\r\n\r\n                var helper = new ParentFilterHelper\r\n                {\r\n                    ParentIdFilterNode = parentIdFilterNode,\r\n                    ParentReferencedPropertyInfo = this.InterfaceType.GetPropertiesRecursively().Single(f => f.Name == parentIdFilterNode.ReferenceFieldName),\r\n                    ParentRefereePropertyName = parentIdFilterNode.ParentFilterType.GetKeyProperties()[0].Name\r\n                };\r\n\r\n                this.ParentFilteringHelpers.Add(parentIdFilterNode.ParentFilterType, helper);\r\n            }\r\n\r\n\r\n\r\n            this.JoinParentIdFilterNode = null;\r\n            this.JoinDataElementsTreeNode = null;\r\n            foreach (TreeNode descendantTreeNode in this.DescendantsBreadthFirst())\r\n            {\r\n                var dataElementTreeNode = descendantTreeNode as DataElementsTreeNode;\r\n                if (dataElementTreeNode == null) continue;\r\n\r\n                ParentIdFilterNode parentIdFilterNode = dataElementTreeNode.FilterNodes.OfType<ParentIdFilterNode>()\r\n                                                        .FirstOrDefault(f => f.ParentFilterType == this.InterfaceType);\r\n\r\n                if (parentIdFilterNode != null)\r\n                {\r\n                    if (this.JoinParentIdFilterNode == null)\r\n                    {\r\n                        this.JoinParentIdFilterNode = parentIdFilterNode;\r\n                        this.JoinDataElementsTreeNode = dataElementTreeNode;\r\n                        this.JoinInnerKeyReferencePropertyInfo = this.JoinDataElementsTreeNode.CurrentDataInterfaceType.GetAllProperties().Single(f => f.Name == this.JoinParentIdFilterNode.ReferenceFieldName);\r\n                    }\r\n                    else if (this.Display != LeafDisplayMode.Lazy)\r\n                    {\r\n                        AddValidationError(\"TreeValidationError.DataElementsTreeNode.MoreThanOnParentFilterIsPointingToMe\", this.InterfaceType);\r\n                        return;\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (this.Label != null)\r\n            {\r\n                this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);\r\n                this.LabelDynamicValuesHelper.Initialize(this);\r\n            }\r\n\r\n            if (this.ToolTip != null)\r\n            {\r\n                this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);\r\n                this.ToolTipDynamicValuesHelper.Initialize(this);\r\n            }\r\n\r\n            if (!typeof(ILocalizedControlled).IsAssignableFrom(this.InterfaceType))\r\n            {\r\n                this.ShowForeignItems = false;\r\n            }\r\n\r\n            if (this.BrowserUrl != null)\r\n            {\r\n                this.BrowserUrlDynamicValuesHelper = new DynamicValuesHelper(this.BrowserUrl);\r\n                this.BrowserUrlDynamicValuesHelper.Initialize(this);\r\n            }\r\n\r\n            if (this.BrowserImage != null)\r\n            {\r\n                this.BrowserImageDynamicValuesHelper = new DynamicValuesHelper(this.BrowserImage);\r\n                this.BrowserImageDynamicValuesHelper.Initialize(this);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal override Type CurrentDataInterfaceType\r\n        {\r\n            get { return this.InterfaceType; }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Data related to a tree node\r\n        /// </summary>\r\n        private class NodeDataSet\r\n        {\r\n            public IEnumerable<IData> DataItems;\r\n            public IEnumerable<object> JoinedKeys;\r\n        }\r\n\r\n\r\n        private NodeDataSet GetDataset(TreeNodeDynamicContext dynamicContext, bool returnJoinedTableKeys = true)\r\n        {\r\n            List<object> innerKeys = null;\r\n\r\n            Expression expression;\r\n\r\n            if (this.Display == LeafDisplayMode.Compact && this.JoinDataElementsTreeNode != null)\r\n            {\r\n                expression = CreateJoinExpression(dynamicContext);\r\n            }\r\n            else if (this.Display == LeafDisplayMode.Auto && this.JoinDataElementsTreeNode != null)\r\n            {\r\n                expression = CreateSimpleExpression(dynamicContext);\r\n\r\n                if (returnJoinedTableKeys)\r\n                {\r\n                    //MRJ: Multiple Parent Filter: Not a real problem here as we just make a request for every filter\r\n                    Expression innerExpression = CreateInnerExpression(dynamicContext, this.JoinParentIdFilterNode, this.JoinDataElementsTreeNode, false);\r\n\r\n                    if (dynamicContext.Direction == TreeNodeDynamicContextDirection.Down)\r\n                    {\r\n                        innerExpression.DebugLogExpression(\"DataElementTreeNode\", label: \"Parent ids with children expression:\");\r\n                    }\r\n\r\n                    innerKeys = DataFacade.GetData(this.JoinDataElementsTreeNode.CurrentDataInterfaceType).Provider\r\n                        .CreateQuery(innerExpression)\r\n                        .ToEnumerableOfObjects()\r\n                        .ToList();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                expression = CreateSimpleExpression(dynamicContext);\r\n            }\r\n\r\n            if (dynamicContext.Direction == TreeNodeDynamicContextDirection.Down) expression.DebugLogExpression(\"DataElementTreeNode\");\r\n\r\n            return new NodeDataSet\r\n                       {\r\n                           DataItems = ExpressionHelper.GetCastedObjects<IData>(this.InterfaceType, expression),\r\n                           JoinedKeys = innerKeys\r\n                       };\r\n        }\r\n\r\n\r\n\r\n        private Expression CreateSimpleExpression(TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            ParameterExpression parameterExpression = Expression.Parameter(this.InterfaceType, \"data\");\r\n\r\n            Expression filterExpression = CreateAccumulatedFilterExpression(parameterExpression, this.InterfaceType, dynamicContext);\r\n\r\n            Expression whereExpression = ExpressionHelper.CreateWhereExpression(DataFacade.GetData(this.InterfaceType).Expression, parameterExpression, filterExpression);\r\n\r\n            Expression resultExpression = whereExpression;\r\n            bool isFirst = true;\r\n            foreach (OrderByNode orderByNode in this.OrderByNodes)\r\n            {\r\n                resultExpression = orderByNode.CreateOrderByExpression(resultExpression, parameterExpression, isFirst);\r\n                isFirst = false;\r\n            }\r\n\r\n            return resultExpression;\r\n        }\r\n\r\n\r\n\r\n        private Expression CreateJoinExpression(TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            //MRJ: Multiple Parent Filter: Here we have to make either multiple calls or create a multiple inner join, kinda hard\r\n            // Create inner expression tree\r\n            Expression innerDistinctExpression = CreateInnerExpression(dynamicContext, this.JoinParentIdFilterNode, this.JoinDataElementsTreeNode);\r\n\r\n\r\n            // Create outer expression tree\r\n            ParameterExpression outerParameterExpression = Expression.Parameter(this.InterfaceType, \"outerData\");\r\n\r\n            Expression outerFilterExpression = CreateAccumulatedFilterExpression(outerParameterExpression, this.InterfaceType, dynamicContext);\r\n\r\n            Expression outerWhereExpression = ExpressionHelper.CreateWhereExpression(DataFacade.GetData(this.InterfaceType).Expression, outerParameterExpression, outerFilterExpression);\r\n\r\n            Expression outerResultExpression = outerWhereExpression;\r\n            bool isFirst = true;\r\n            foreach (OrderByNode orderByNode in this.OrderByNodes)\r\n            {\r\n                outerResultExpression = orderByNode.CreateOrderByExpression(outerResultExpression, outerParameterExpression, isFirst);\r\n                isFirst = false;\r\n            }\r\n\r\n\r\n            // Create join lambda expressions            \r\n            PropertyInfo outerKeyPropertyInfo = this.KeyPropertyInfo;\r\n            LambdaExpression outerKeySelectorExpression = Expression.Lambda(Expression.Property(outerParameterExpression, outerKeyPropertyInfo), outerParameterExpression);\r\n\r\n            ParameterExpression innerKeySelectorParameterExpression = Expression.Parameter(this.JoinInnerKeyReferencePropertyInfo.PropertyType, \"innerKeyParam\");\r\n            LambdaExpression innerKeySelectorExpression = Expression.Lambda(innerKeySelectorParameterExpression, innerKeySelectorParameterExpression);\r\n\r\n            ParameterExpression parameterExpression1 = Expression.Parameter(this.InterfaceType, \"param1\");\r\n            ParameterExpression parameterExpression2 = Expression.Parameter(outerKeyPropertyInfo.PropertyType, \"param2\");\r\n            LambdaExpression resultSelector = Expression.Lambda(parameterExpression1, parameterExpression1, parameterExpression2);\r\n\r\n            Expression joinExpression = ExpressionHelper.CreateJoinExpression(outerResultExpression, innerDistinctExpression, outerKeySelectorExpression, innerKeySelectorExpression, resultSelector);\r\n\r\n            return joinExpression;\r\n        }\r\n\r\n\r\n\r\n        private static Expression CreateInnerExpression(TreeNodeDynamicContext dynamicContext, ParentIdFilterNode parentIdFilterNode, DataElementsTreeNode dataElementsTreeNode, bool includeJoin = true)\r\n        {\r\n            Type interfaceType = dataElementsTreeNode.CurrentDataInterfaceType;\r\n\r\n            ParameterExpression parameterExpression = Expression.Parameter(interfaceType, \"innerData\");\r\n\r\n            List<int> filtersToSkip = new List<int>() { parentIdFilterNode.Id };\r\n            foreach (ParentIdFilterNode childParentIdFilterNode in dataElementsTreeNode.FilterNodes.OfType<ParentIdFilterNode>().Where(f => f.Id != parentIdFilterNode.Id))\r\n            {\r\n                if (childParentIdFilterNode.ParentFilterTypeTreeNode.IsAncestor(parentIdFilterNode.ParentFilterTypeTreeNode))\r\n                {\r\n                    filtersToSkip.Add(childParentIdFilterNode.Id);\r\n                }\r\n            }\r\n\r\n            Expression filterExpression = dataElementsTreeNode.CreateAccumulatedFilterExpression(parameterExpression, interfaceType, dynamicContext, filtersToSkip);\r\n\r\n            Expression whereExpression = ExpressionHelper.CreateWhereExpression(DataFacade.GetData(interfaceType).Expression, parameterExpression, filterExpression);\r\n\r\n\r\n            if ((includeJoin) && (dataElementsTreeNode.JoinDataElementsTreeNode != null))\r\n            {\r\n                //MRJ: Multiple Parent Filter: Recursive call, so we would have to make multiple recursive calls\r\n                Expression innerInnerExpression = CreateInnerExpression(dynamicContext, dataElementsTreeNode.JoinParentIdFilterNode, dataElementsTreeNode.JoinDataElementsTreeNode);\r\n\r\n                // Create join lambda expressions\r\n                PropertyInfo outerKeyPropertyInfo = dataElementsTreeNode.KeyPropertyInfo;\r\n                LambdaExpression outerKeySelectorExpression = Expression.Lambda(Expression.Property(parameterExpression, outerKeyPropertyInfo), parameterExpression);\r\n\r\n                Type innerKeyType = TypeHelpers.FindElementType(innerInnerExpression);\r\n                ParameterExpression innerKeySelectorParameterExpression = Expression.Parameter(innerKeyType, \"innerKeyParam\");\r\n                LambdaExpression innerKeySelectorExpression = Expression.Lambda(innerKeySelectorParameterExpression, innerKeySelectorParameterExpression);\r\n\r\n                ParameterExpression parameterExpression1 = Expression.Parameter(dataElementsTreeNode.CurrentDataInterfaceType, \"param1\");\r\n                ParameterExpression parameterExpression2 = Expression.Parameter(outerKeyPropertyInfo.PropertyType, \"param2\");\r\n                LambdaExpression resultSelector = Expression.Lambda(parameterExpression1, parameterExpression1, parameterExpression2);\r\n\r\n                Expression joinExpression = ExpressionHelper.CreateJoinExpression(\r\n                    whereExpression,\r\n                    innerInnerExpression,\r\n                    outerKeySelectorExpression,\r\n                    innerKeySelectorExpression,\r\n                    resultSelector);\r\n\r\n                whereExpression = joinExpression;\r\n            }\r\n\r\n\r\n            Expression selectExpression = ExpressionHelper.CreateSelectExpression(whereExpression, ExpressionHelper.CreatePropertyExpression(parentIdFilterNode.ReferenceFieldName, parameterExpression), parameterExpression);\r\n\r\n            Expression distinctExpression = ExpressionHelper.CreateDistinctExpression(selectExpression);\r\n\r\n            return distinctExpression;\r\n        }\r\n\r\n\r\n\r\n        private IData GetParentDataItem(Type parentType, EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            if (dynamicContext.CustomData.ContainsKey(\"ParentData\"))\r\n            {\r\n                return (IData)dynamicContext.CustomData[\"ParentData\"];\r\n            }\r\n\r\n            IData parentDataItem = null;\r\n            if (parentEntityToken is DataEntityToken)\r\n            {\r\n                DataEntityToken dataEntityToken = parentEntityToken as DataEntityToken;\r\n                Type type = dataEntityToken.InterfaceType;\r\n                if (type == parentType)\r\n                {\r\n                    return dataEntityToken.Data;\r\n                }\r\n            }\r\n\r\n            if (parentDataItem == null)\r\n            {\r\n                foreach (EntityToken entityToken in dynamicContext.Piggybag.GetParentEntityTokens())\r\n                {\r\n                    DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n\r\n                    if (dataEntityToken == null) continue;\r\n\r\n                    Type type = dataEntityToken.InterfaceType;\r\n                    if (type != parentType) continue;\r\n\r\n                    return dataEntityToken.Data;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return string.Format(\"DataElementsTreeNode, Id = {0}, DataType = {1}, Display = {2}, {3}\", this.Id, this.InterfaceType, this.Display, this.ParentString());\r\n        }\r\n\r\n\r\n\r\n        private sealed class ParentFilterHelper\r\n        {\r\n            public ParentIdFilterNode ParentIdFilterNode { get; set; }\r\n            public PropertyInfo ParentReferencedPropertyInfo { get; set; }\r\n            public string ParentRefereePropertyName { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/DataFieldValueHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text.RegularExpressions;\r\nusing System.Web;\r\nusing Composite.Data;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal sealed class DataFieldValueHelper\r\n    {\r\n        private const string PreFix = \"${C1:Data:\";\r\n        private static Regex TemplateRegex = new Regex(@\"\\$\\{(?<string>[^\\}]+)}\", RegexOptions.Compiled);\r\n\r\n        private List<DataFieldValueHelperEntry> _entries = new List<DataFieldValueHelperEntry>();\r\n\r\n        public string Template { get; private set; }\r\n\r\n\r\n\r\n        public DataFieldValueHelper(string template)\r\n        {\r\n            this.Template = template;\r\n        }\r\n\r\n\r\n\r\n        public static bool ContainsDataField(string value)\r\n        {\r\n            return value.Contains(PreFix);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> InterfaceTypes\r\n        {\r\n            get { return _entries.Select(e => e.InterfaceType);}\r\n        }\r\n\r\n\r\n\r\n        public string ReplaceValues(string currentValue, PiggybagDataFinder piggybagDataFinder, IData currentDataItem = null, bool useUrlEncode = false)\r\n        {\r\n            string result = currentValue;\r\n\r\n            foreach (DataFieldValueHelperEntry entry in _entries)\r\n            {\r\n                IData data = piggybagDataFinder.GetData(entry.InterfaceType, currentDataItem);\r\n\r\n                object value;\r\n                if (entry.IsReference == false)\r\n                {\r\n                    value = entry.PropertyInfo.GetValue(data, null);\r\n\r\n                    if (value == null)\r\n                    {\r\n                        value = \"(NULL)\";\r\n                    }\r\n                    else if (entry.PropertyInfo.PropertyType == typeof(DateTime))\r\n                    {\r\n                        value = ((DateTime)value).ToString(entry.Format ?? \"yyyy MM dd\");\r\n                    }\r\n                    else if (entry.PropertyInfo.PropertyType == typeof(Decimal))\r\n                    {\r\n                        value = ((Decimal)value).ToString(entry.Format ?? \"G\");\r\n                    }\r\n                    else if (entry.PropertyInfo.PropertyType == typeof(int))\r\n                    {\r\n                        value = ((int)value).ToString(entry.Format ?? \"G\");\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    IData referencedData = data.GetReferenced(entry.PropertyInfo.Name);\r\n\r\n                    value = referencedData.GetLabel();\r\n                }\r\n\r\n                string stringValue = value.ToString();\r\n\r\n                if (useUrlEncode)\r\n                {\r\n                    stringValue = HttpUtility.UrlEncode(stringValue);\r\n                }\r\n\r\n                result = result.Replace(entry.Match, stringValue);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"ownerTreeNode\">This is only used to add validation errors</param>\r\n        public void Initialize(TreeNode ownerTreeNode)\r\n        {\r\n            foreach (Match match in TemplateRegex.Matches(this.Template))\r\n            {\r\n                if (match.Value.StartsWith(PreFix) == false) continue;\r\n\r\n                string value = match.Groups[\"string\"].Value;\r\n                string[] values = value.Split(':');\r\n                if (values.Length != 4 && values.Length != 5)\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.DataFieldValueHelper.WrongFormat\", \r\n                        match.Value, \r\n                        string.Format(@\"{0}[InterfaceType]:[FieldName]}}\", PreFix),\r\n                        string.Format(@\"{0}[InterfaceType]:[FieldName]:[Format]}}\", PreFix));\r\n                    return;\r\n                }\r\n\r\n\r\n                string typeName = values[2];\r\n                Type interfaceType = TypeManager.TryGetType(typeName);\r\n                if (interfaceType == null)\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Common.UnknownInterfaceType\", typeName);\r\n                    return;\r\n                }\r\n\r\n                if (typeof(IData).IsAssignableFrom(interfaceType) == false)\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Common.NotImplementingIData\", interfaceType, typeof(IData));\r\n                    return;\r\n                }\r\n\r\n\r\n                string fieldName = values[3];\r\n                PropertyInfo propertyInfo = interfaceType.GetPropertiesRecursively(f => f.Name == fieldName).SingleOrDefault();\r\n                if (propertyInfo == null)\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Common.MissingProperty\", interfaceType, fieldName);\r\n                    return;\r\n                }\r\n\r\n                bool possibleAttachmentPointsExist = ownerTreeNode.Tree.PossibleAttachmentPoints.OfType<IDataItemAttachmentPoint>().Any(f => f.InterfaceType == interfaceType);\r\n                bool attachmentPointsExist = ownerTreeNode.Tree.AttachmentPoints.OfType<IDataItemAttachmentPoint>().Any(f => f.InterfaceType == interfaceType);\r\n                if (!possibleAttachmentPointsExist \r\n                    && !attachmentPointsExist \r\n                    && !ownerTreeNode.SelfAndParentsHasInterface(interfaceType))\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.DataFieldValueHelper.InterfaceNotInParentTree\", interfaceType);\r\n                    return;\r\n                }\r\n\r\n                string format = (values.Length == 5 ? values[4] : null);\r\n\r\n                bool isReferencingProperty = DataReferenceFacade.GetForeignKeyProperties(interfaceType).Any(f => f.SourcePropertyInfo.Equals(propertyInfo));\r\n\r\n                DataFieldValueHelperEntry entry = new DataFieldValueHelperEntry(\r\n                    match.Value,\r\n                    interfaceType,\r\n                    propertyInfo,\r\n                    format,\r\n                    isReferencingProperty\r\n                );\r\n\r\n                if (_entries.Contains(entry) == false)\r\n                {\r\n                    _entries.Add(entry);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        private sealed class DataFieldValueHelperEntry\r\n        {\r\n            public DataFieldValueHelperEntry(string match, Type interfaceType, PropertyInfo propertyInfo, string format, bool isReference)\r\n            {\r\n                this.Match = match;\r\n                this.InterfaceType = interfaceType;\r\n                this.PropertyInfo = propertyInfo;\r\n                this.Format = format;\r\n                this.IsReference = isReference;\r\n            }\r\n\r\n\r\n            public string Match { get; private set; }\r\n            public Type InterfaceType { get; private set; }\r\n            public PropertyInfo PropertyInfo { get; private set; }\r\n            public string Format { get; private set; }\r\n            public bool IsReference { get; private set; }\r\n\r\n\r\n            public override bool Equals(object obj)\r\n            {\r\n                return Equals(obj as DataFieldValueHelperEntry);\r\n            }\r\n\r\n\r\n            public bool Equals(DataFieldValueHelperEntry entry)\r\n            {\r\n                return entry != null && object.Equals(this.Match, entry.Match);\r\n            }\r\n\r\n\r\n            public override int GetHashCode()\r\n            {\r\n                return this.Match.GetHashCode();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/DataFilteringTreeNode.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary> \r\n    /// Tree node that shows filtered data items, or items generated from them (f.e. data grouping elements)   \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class DataFilteringTreeNode : TreeNode\r\n    {\r\n        internal abstract Type CurrentDataInterfaceType { get; }\r\n\r\n        /// <summary>\r\n        /// Depending on dynamicContext's Direction creates either filter expression for finding child elements or\r\n        /// a filter expression to find current element based on children elements\r\n        /// </summary>\r\n        /// <param name=\"parameterExpression\">The parameter expression.</param>\r\n        /// <param name=\"dynamicContext\">The dynamic context.</param>\r\n        /// <param name=\"filtersToSkip\">The filters to skip.</param>\r\n        /// <returns></returns>\r\n        internal virtual Expression CreateFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext, IList<int> filtersToSkip = null)\r\n        {\r\n            Expression expression = null;\r\n\r\n            var filterNodes = dynamicContext.Direction == TreeNodeDynamicContextDirection.Down\r\n                                  ? this.FilterNodes\r\n                                  : dynamicContext.CurrentTreeNode.FilterNodes;\r\n\r\n            foreach (FilterNode filterNode in filterNodes)\r\n            {\r\n                if (filtersToSkip != null && filtersToSkip.Contains(filterNode.Id)) continue;\r\n\r\n                Expression filterExpression;\r\n                if (dynamicContext.Direction == TreeNodeDynamicContextDirection.Down)\r\n                {\r\n                    filterExpression = filterNode.CreateDownwardsFilterExpression(parameterExpression, dynamicContext);\r\n                }\r\n                else\r\n                {\r\n                    filterExpression = filterNode.CreateUpwardsFilterExpression(parameterExpression, dynamicContext);\r\n                }\r\n\r\n                if (filterExpression == null) continue;\r\n\r\n                expression = expression.NestedAnd(filterExpression);\r\n            }\r\n\r\n            return expression;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates the accumulated filter expression from current tree definition node, and all the nearest ancestor DataFolderElement-s that\r\n        /// are related to the same data type.\r\n        /// </summary>\r\n        /// <param name=\"parameterExpression\">The parameter expression.</param>\r\n        /// <param name=\"affectedInterfaceType\">Type of the affected interface.</param>\r\n        /// <param name=\"dynamicContext\">The dynamic context.</param>\r\n        /// <param name=\"filtersToSkip\">The filters to skip.</param>\r\n        /// <returns></returns>\r\n        internal Expression CreateAccumulatedFilterExpression(ParameterExpression parameterExpression, Type affectedInterfaceType, TreeNodeDynamicContext dynamicContext, IList<int> filtersToSkip = null)\r\n        {\r\n            TreeNode treeNode = this;            \r\n\r\n            Expression currentExpression = null;            \r\n\r\n            while (treeNode != null)\r\n            {\r\n                DataFilteringTreeNode dataFilteringTreeNode = treeNode as DataFilteringTreeNode;\r\n\r\n                if (dataFilteringTreeNode != null \r\n                    && (dataFilteringTreeNode == this || dataFilteringTreeNode is DataFolderElementsTreeNode) \r\n                    && (dataFilteringTreeNode.CurrentDataInterfaceType == affectedInterfaceType))\r\n                {\r\n                    Expression filterExpression = dataFilteringTreeNode.CreateFilterExpression(parameterExpression, dynamicContext, filtersToSkip);\r\n\r\n                    if (filterExpression != null)\r\n                    {\r\n                        currentExpression = currentExpression.NestedAnd(filterExpression);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    break;\r\n                }\r\n\r\n                treeNode = treeNode.ParentNode;\r\n            }\r\n\r\n            //currentExpression.DebugLogExpression(\"DataFileringTreeNode\", \"Accumulated Filter Expression\");\r\n\r\n            return currentExpression;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates the OrderBy expression.\r\n        /// </summary>\r\n        /// <param name=\"sourceExpression\">The source expression.</param>\r\n        /// <param name=\"parameterExpression\">The parameter expression.</param>\r\n        /// <returns></returns>\r\n        /// <exclude />\r\n        protected Expression CreateOrderByExpression(Expression sourceExpression, ParameterExpression parameterExpression)\r\n        {\r\n            Expression resultExpression = sourceExpression;\r\n\r\n            bool isFirst = true;\r\n            foreach (OrderByNode orderByNode in this.OrderByNodes)\r\n            {\r\n                resultExpression = orderByNode.CreateOrderByExpression(resultExpression, parameterExpression, isFirst);\r\n                isFirst = false;\r\n            }\r\n\r\n            return resultExpression;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/DataFolderElementsTreeNode.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.C1Console.Trees.Foundation.FolderRanges;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class DataFolderElementsTreeNode : DataFilteringTreeNode\r\n    {\r\n        private readonly MethodInfo StringStartsWithMethodInfo = typeof(string).GetMethods().First(f => f.Name == nameof(string.StartsWith));\r\n        private readonly MethodInfo StringSubstringMethodInfo = typeof(string).GetMethods().Where(f => f.Name == nameof(string.Substring)).Skip(1).First();\r\n        private readonly MethodInfo ToUpperCompareMethodInfo = typeof(string).GetMethods().First(f => f.Name == nameof(string.ToUpper));\r\n\r\n        /// <exclude />\r\n        public Type InterfaceType { get; internal set; }            // Required\r\n\r\n        /// <exclude />\r\n        public ResourceHandle Icon { get; internal set; }           // Defaults to 'folder-disabled'\r\n\r\n        /// <exclude />\r\n        public string FieldName { get; internal set; }              // Required\r\n\r\n        /// <exclude />\r\n        public string DateFormat { get; internal set; }             // Optional\r\n\r\n        /// <exclude />\r\n        public string Range { get; internal set; }                  // Optional\r\n\r\n        /// <exclude />\r\n        public bool FirstLetterOnly { get; internal set; }          // Optional\r\n\r\n        /// <exclude />\r\n        public SortDirection SortDirection { get; internal set; }       // Optional\r\n\r\n        /// <exclude />\r\n        public LeafDisplayMode Display { get; internal set; }       // Optional\r\n\r\n        /// <exclude />\r\n        public bool ShowForeignItems { get; internal set; }         // Optional\r\n\r\n\r\n        // Cached values        \r\n        private PropertyInfo KeyPropertyInfo { get; set; }\r\n        private string GroupingValuesFieldName { get; set; }\r\n        private string SerializedInterfaceType { get; set; }\r\n        private PropertyInfo PropertyInfo { get; set; }\r\n        private DateTimeFormater DateTimeFormater { get; set; }\r\n        private IFolderRanges FolderRanges { get; set; }\r\n        private List<DataFolderElementsTreeNode> AllGroupingNodes { get; set; }\r\n        private ConstructorInfo AllGroupingsTupleConstructor { get; set; }\r\n        private MethodInfo FolderIndexListAddMethodInfo { get; set; }\r\n        private MethodInfo FolderIndexListClearMethodInfo { get; set; }\r\n\r\n        private object FolderIndexListObject { get; set; }\r\n        private IQueryable FolderIndexListQueryable { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// <value>True</value> if parent element is not a <see cref=\"DataFolderElementsTreeNode\"/>\r\n        /// </summary>\r\n        private bool IsTopFolderParent { get; set; }\r\n        private DataElementsTreeNode ChildGeneratingDataElementsTreeNode { get; set; }\r\n        private ParentIdFilterNode ChildGeneratingParentIdFilterNode { get; set; }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            IEnumerable<object> labels = GetCurrentAndLocalizableObjects<object>(dynamicContext, true);\r\n\r\n            Type childGeneratingDataElementsReferenceType = null;\r\n            object childGeneratingDataElementsReferenceValue = null;\r\n\r\n            DataEntityToken dataEntityToken = childEntityToken as DataEntityToken;\r\n            var treeDataFieldGroupingElementEntityToken = childEntityToken as TreeDataFieldGroupingElementEntityToken;\r\n            if (dataEntityToken != null)\r\n            {\r\n                if (this.ChildGeneratingParentIdFilterNode != null)\r\n                {\r\n                    childGeneratingDataElementsReferenceType = this.ChildGeneratingParentIdFilterNode.ParentFilterType;\r\n                    childGeneratingDataElementsReferenceValue = this.ChildGeneratingParentIdFilterNode.ReferencePropertyInfo.GetValue(dataEntityToken.Data, null);\r\n                }\r\n            }\r\n            else if (treeDataFieldGroupingElementEntityToken != null)\r\n            {\r\n                childGeneratingDataElementsReferenceType = treeDataFieldGroupingElementEntityToken.ChildGeneratingDataElementsReferenceType;\r\n                childGeneratingDataElementsReferenceValue = treeDataFieldGroupingElementEntityToken.ChildGeneratingDataElementsReferenceValue;\r\n            }\r\n\r\n\r\n            foreach (object label in labels)\r\n            {\r\n                var tupleIndexer = new TupleIndexer(label);\r\n\r\n                var entityToken = new TreeDataFieldGroupingElementEntityToken(this.Id, this.Tree.TreeId, TypeManager.SerializeType(this.InterfaceType))\r\n                {\r\n                    GroupingValues = new Dictionary<string, object>()\r\n                };\r\n\r\n                int index = 1;\r\n                foreach (DataFolderElementsTreeNode dataFolderElementsTreeNode in this.AllGroupingNodes)\r\n                {\r\n                    if (dataFolderElementsTreeNode.FolderRanges == null)\r\n                    {\r\n                        object fieldValue = tupleIndexer.GetAtIndex(index++);\r\n                        fieldValue = ConvertFieldValue(dataFolderElementsTreeNode, fieldValue);\r\n                        entityToken.GroupingValues.Add(dataFolderElementsTreeNode.GroupingValuesFieldName, fieldValue);\r\n                    }\r\n                    else\r\n                    {\r\n                        int fieldValue = (int)tupleIndexer.GetAtIndex(index++);\r\n                        entityToken.FolderRangeValues.Add(dataFolderElementsTreeNode.FieldName, fieldValue);\r\n                    }\r\n                }\r\n\r\n                entityToken.ChildGeneratingDataElementsReferenceType = childGeneratingDataElementsReferenceType;\r\n                entityToken.ChildGeneratingDataElementsReferenceValue = childGeneratingDataElementsReferenceValue;\r\n\r\n                yield return entityToken;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal override Type CurrentDataInterfaceType => this.InterfaceType;\r\n\r\n\r\n        /// <exclude />\r\n        public override AncestorResult GetParentEntityToken(EntityToken childEntityToken, Type parentInterfaceOfInterest, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            if (this.ParentNode is DataFolderElementsTreeNode)\r\n            {\r\n                var childGroupingElementEntityToken = childEntityToken as TreeDataFieldGroupingElementEntityToken;\r\n\r\n                if (childGroupingElementEntityToken != null)\r\n                {\r\n                    var newGroupingElementEntityToken = new TreeDataFieldGroupingElementEntityToken(\r\n                        this.ParentNode.Id,\r\n                        this.Tree.TreeId,\r\n                        this.SerializedInterfaceType)\r\n                    {\r\n                        GroupingValues =\r\n                            new Dictionary<string, object>(childGroupingElementEntityToken.GroupingValues),\r\n                        FolderRangeValues =\r\n                            new Dictionary<string, int>(childGroupingElementEntityToken.FolderRangeValues)\r\n                    };\r\n\r\n                    newGroupingElementEntityToken.GroupingValues.Remove(this.GroupingValuesFieldName);\r\n\r\n                    return new AncestorResult(this.ParentNode, newGroupingElementEntityToken);\r\n                }\r\n            }            \r\n\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<Element> OnGetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            Type referenceType = null;\r\n            object referenceValue = null;\r\n\r\n            if (this.ChildGeneratingParentIdFilterNode != null)\r\n            {\r\n                if (this.IsTopFolderParent)\r\n                {\r\n                    var dataEntityToken = dynamicContext.Piggybag\r\n                        .GetParentEntityTokens(parentEntityToken)\r\n                        .OfType<DataEntityToken>()\r\n                        .FirstOrDefault(f => f.InterfaceType == ChildGeneratingParentIdFilterNode.ParentFilterType);\r\n                    \r\n                    if (dataEntityToken != null)\r\n                    {\r\n                        var data = dataEntityToken.Data;\r\n                        if (data == null) return Enumerable.Empty<Element>();\r\n\r\n                        referenceType = this.ChildGeneratingParentIdFilterNode.KeyPropertyInfo.DeclaringType;\r\n                        referenceValue = this.ChildGeneratingParentIdFilterNode.KeyPropertyInfo.GetValue(data, null);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    var treeDataFieldGroupingElementEntityToken = parentEntityToken as TreeDataFieldGroupingElementEntityToken;\r\n\r\n                    referenceType = treeDataFieldGroupingElementEntityToken.ChildGeneratingDataElementsReferenceType;\r\n                    referenceValue = treeDataFieldGroupingElementEntityToken.ChildGeneratingDataElementsReferenceValue;\r\n                }\r\n            }\r\n\r\n\r\n            if (this.FolderRanges != null)\r\n            {\r\n                return CreateFolderRangeElements(parentEntityToken, referenceType, referenceValue, dynamicContext);\r\n            }\r\n\r\n            IEnumerable<object> objects = GetCurrentAndLocalizableObjects<object>(dynamicContext);\r\n\r\n            if (this.FirstLetterOnly)\r\n            {\r\n                return CreateFirstLetterOnlyElements(parentEntityToken, referenceType, referenceValue, dynamicContext, objects);\r\n            }\r\n\r\n            return CreateSimpleElements(parentEntityToken, referenceType, referenceValue, dynamicContext, objects);\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> CreateSimpleElements(EntityToken parentEntityToken, Type referenceType, object referenceValue, TreeNodeDynamicContext dynamicContext, IEnumerable<object> objects)\r\n        {\r\n            bool shouldBeSortedByLabel;\r\n            Func<object, string> labelFunc = GetLabelFunction(out shouldBeSortedByLabel);\r\n\r\n            if (shouldBeSortedByLabel)\r\n            {\r\n                objects = objects.Evaluate();\r\n            }\r\n\r\n            var objectsAndLabels = objects.Select(o => new { Object = o, Label = labelFunc(o)});\r\n\r\n            if (shouldBeSortedByLabel)\r\n            {\r\n                objectsAndLabels = this.SortDirection == SortDirection.Ascending\r\n                    ? objectsAndLabels.OrderBy(a => a.Label)\r\n                    : objectsAndLabels.OrderByDescending(a => a.Label);\r\n            }\r\n\r\n            foreach (var pair in objectsAndLabels)\r\n            {\r\n                yield return CreateElement(\r\n                    parentEntityToken,\r\n                    referenceType,\r\n                    referenceValue,\r\n                    dynamicContext,\r\n                    pair.Label,\r\n                    f => f.GroupingValues.Add(this.GroupingValuesFieldName, ConvertGroupingValue(pair.Object))\r\n                );\r\n            }\r\n        }\r\n\r\n        private object ConvertGroupingValue(object value)\r\n        {\r\n            return this.DateTimeFormater.IsDateTimeGroupingValue(value) \r\n                ? this.DateTimeFormater.Serialize(value) \r\n                : value;\r\n        }\r\n\r\n        private Func<object, string> GetLabelFunction(out bool shouldBeSortedByLabel)\r\n        {\r\n            if (this.PropertyInfo.PropertyType == typeof(DateTime))\r\n            {\r\n                shouldBeSortedByLabel = false;\r\n                return f => this.DateTimeFormater.FormatLabel(f);\r\n            }\r\n            \r\n            var referenceProperties = DataAttributeFacade.GetDataReferenceProperties(PropertyInfo.DeclaringType);\r\n            var referenceInfo = referenceProperties.FirstOrDefault(p => p.SourcePropertyName == this.PropertyInfo.Name);\r\n\r\n            if (referenceInfo == null)\r\n            {\r\n                shouldBeSortedByLabel = false;\r\n                return f => (f ?? \"(NULL)\").ToString();\r\n            }\r\n\r\n            shouldBeSortedByLabel = true;\r\n\r\n            return key =>\r\n            {\r\n                if (key == null) return \"(NULL)\";\r\n\r\n                IData reference = DataFacade.TryGetDataVersionsByUniqueKey(referenceInfo.TargetType, key).FirstOrDefault();\r\n                return reference?.GetLabel() ?? key.ToString();\r\n            };\r\n        }\r\n\r\n        private IEnumerable<Element> CreateFolderRangeElements(EntityToken parentEntityToken, Type referenceType, object referenceValue, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            var indexes = Enumerable.Empty<int>();\r\n\r\n            if (this.Display != LeafDisplayMode.Lazy)\r\n            {\r\n                indexes = GetCurrentAndLocalizableObjects<int>(dynamicContext);\r\n            }\r\n\r\n\r\n            foreach (IFolderRange folderRange in this.FolderRanges.Ranges)\r\n            {\r\n                bool contained = indexes.Contains(folderRange.Index);\r\n                if (this.Display == LeafDisplayMode.Compact && !contained) continue;\r\n\r\n                Element element = CreateElement(\r\n                    parentEntityToken,\r\n                    referenceType,\r\n                    referenceValue,\r\n                    dynamicContext,\r\n                    folderRange.Label,\r\n                    f =>\r\n                    {\r\n                        f.FolderRangeValues.Add(this.FieldName, folderRange.Index);\r\n                    }\r\n                );\r\n\r\n                if (this.Display == LeafDisplayMode.Auto)\r\n                {\r\n                    element.VisualData.HasChildren = contained;\r\n                }\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> CreateFirstLetterOnlyElements(EntityToken parentEntityToken, Type referenceType, object referenceValue, TreeNodeDynamicContext dynamicContext, IEnumerable<object> objects)\r\n        {\r\n            foreach (string label in objects.OfType<string>())\r\n            {\r\n                yield return CreateElement(\r\n                    parentEntityToken,\r\n                    referenceType,\r\n                    referenceValue, \r\n                    dynamicContext,\r\n                    label,\r\n                    f => f.GroupingValues.Add(this.GroupingValuesFieldName, label)\r\n                );\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Element CreateElement(EntityToken parentEntityToken, Type referenceType, object referenceValue, TreeNodeDynamicContext dynamicContext, string label, Action<TreeDataFieldGroupingElementEntityToken> entityTokenAction)\r\n        {\r\n            var entityToken = new TreeDataFieldGroupingElementEntityToken(this.Id.ToString(), this.Tree.TreeId, this.SerializedInterfaceType)\r\n            {\r\n                GroupingValues = new Dictionary<string, object>(dynamicContext.FieldGroupingValues),\r\n                FolderRangeValues = new Dictionary<string, int>(dynamicContext.FieldFolderRangeValues),\r\n                ChildGeneratingDataElementsReferenceType = referenceType,\r\n                ChildGeneratingDataElementsReferenceValue = referenceValue\r\n            };\r\n\r\n            entityTokenAction(entityToken);\r\n\r\n            var element = new Element(new ElementHandle(\r\n                dynamicContext.ElementProviderName,\r\n                entityToken,\r\n                dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken)\r\n            ))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = label,\r\n                    ToolTip = label,\r\n                    HasChildren = true,\r\n                    Icon = this.Icon,\r\n                    OpenedIcon = this.Icon\r\n                }\r\n            };\r\n\r\n            element.ElementExternalActionAdding = element.ElementExternalActionAdding.Remove(ElementExternalActionAdding.AllowManageUserPermissions);\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        private Expression CreateSelectBodyExpression(ParameterExpression parameterExpression, Expression fieldExpression, out List<LambdaExpression> orderByExpressions)\r\n        {\r\n            orderByExpressions = null;\r\n\r\n            if (this.FolderRanges != null)\r\n            {\r\n                return this.FolderRanges.CreateContainsListSelectBodyExpression(fieldExpression, parameterExpression);\r\n            }\r\n            \r\n            if (this.PropertyInfo.PropertyType == typeof(DateTime))\r\n            {\r\n                var parameters = new List<Expression>();\r\n                if (this.DateTimeFormater.HasYear) parameters.Add(Expression.Property(fieldExpression, DateTimeFormater.DateTime_Year));\r\n                if (this.DateTimeFormater.HasMonth) parameters.Add(Expression.Property(fieldExpression, DateTimeFormater.DateTime_Month));\r\n                if (this.DateTimeFormater.HasDay) parameters.Add(Expression.Property(fieldExpression, DateTimeFormater.DateTime_Day));\r\n                if (this.DateTimeFormater.HasHour) parameters.Add(Expression.Property(fieldExpression, DateTimeFormater.DateTime_Hour));\r\n                if (this.DateTimeFormater.HasMinute) parameters.Add(Expression.Property(fieldExpression, DateTimeFormater.DateTime_Minute));\r\n                if (this.DateTimeFormater.HasSecond) parameters.Add(Expression.Property(fieldExpression, DateTimeFormater.DateTime_Second));\r\n\r\n                var members = this.DateTimeFormater.GetTupleMembers();\r\n                Expression expression = Expression.New(this.DateTimeFormater.GetTupleConstructor(), parameters, members);\r\n\r\n                if (parameters.Any())\r\n                {\r\n                    orderByExpressions = new List<LambdaExpression>();\r\n\r\n                    // Ordering my date parts. Needed for LINQ2SQL to produce a correct query\r\n                    for (int i = 0; i < parameters.Count; i++)\r\n                    {\r\n                        var newParameter = Expression.Parameter(expression.Type);\r\n\r\n                        var newTypeProperty = Expression.Property(newParameter, members[i]);\r\n\r\n                        var keySelector = Expression.Lambda(newTypeProperty, newParameter);\r\n\r\n                        orderByExpressions.Add(keySelector);\r\n                    }\r\n                }\r\n                \r\n                return expression;\r\n            }\r\n            \r\n            if (this.FirstLetterOnly)\r\n            {\r\n                Expression expression = Expression.Condition(\r\n                    Expression.And(\r\n                        Expression.NotEqual(\r\n                            fieldExpression,\r\n                            Expression.Constant(null)\r\n                        ),\r\n                        Expression.NotEqual(\r\n                            fieldExpression,\r\n                            Expression.Constant(\"\")\r\n                        )\r\n                    ),\r\n                    Expression.Call(\r\n                        Expression.Call(\r\n                            fieldExpression,\r\n                            this.StringSubstringMethodInfo,\r\n                            Expression.Constant(0),\r\n                            Expression.Constant(1)\r\n                        ),\r\n                        this.ToUpperCompareMethodInfo\r\n                    ),\r\n                    fieldExpression,\r\n                    typeof(string)\r\n                );\r\n\r\n                return expression;\r\n            }\r\n            \r\n            return fieldExpression;\r\n        }\r\n\r\n\r\n\r\n        private Expression GetObjectsExpression(TreeNodeDynamicContext dynamicContext, bool includeAllGroupingFields = false)\r\n        {\r\n            ParameterExpression parameterExpression = Expression.Parameter(this.InterfaceType, \"data\");\r\n\r\n            Expression filterExpression = CreateAccumulatedFilterExpression(parameterExpression, this.InterfaceType, dynamicContext);\r\n\r\n            Expression whereExpression = ExpressionHelper.CreateWhereExpression(DataFacade.GetData(this.InterfaceType).Expression, parameterExpression, filterExpression);\r\n\r\n            Expression fieldExpression = ExpressionHelper.CreatePropertyExpression(this.InterfaceType, this.PropertyInfo.DeclaringType, this.FieldName, parameterExpression);\r\n\r\n            var keySelector = Expression.Lambda(fieldExpression, parameterExpression);\r\n            Expression orderByExpression = this.SortDirection == SortDirection.Ascending\r\n                ? ExpressionHelper.CreateOrderByExpression(whereExpression, keySelector)\r\n                : ExpressionHelper.CreateOrderByDescendingExpression(whereExpression, keySelector);\r\n\r\n            Expression selectBodyExpression;\r\n\r\n            List<LambdaExpression> orderByExpressions = null;\r\n\r\n            if (!includeAllGroupingFields)\r\n            {\r\n                selectBodyExpression = CreateSelectBodyExpression(parameterExpression, fieldExpression, out orderByExpressions);\r\n            }\r\n            else\r\n            {\r\n                List<Expression> bodyExpressions = new List<Expression>();\r\n                foreach (DataFolderElementsTreeNode dataFolderElementsTreeNode in this.AllGroupingNodes)\r\n                {\r\n                    List<LambdaExpression> innerOrderByExpressions;\r\n\r\n                    Expression groupFieldExpression = ExpressionHelper.CreatePropertyExpression(dataFolderElementsTreeNode.InterfaceType, dataFolderElementsTreeNode.PropertyInfo.DeclaringType, dataFolderElementsTreeNode.FieldName, parameterExpression);\r\n                    Expression bodyExpression = dataFolderElementsTreeNode.CreateSelectBodyExpression(parameterExpression, groupFieldExpression, out innerOrderByExpressions);\r\n\r\n                    bodyExpressions.Add(bodyExpression);\r\n                }\r\n\r\n                selectBodyExpression = Expression.New(this.AllGroupingsTupleConstructor, bodyExpressions);\r\n\r\n                // TODO: proper processing of innerOrderByExpressions\r\n            }\r\n\r\n            Expression selectExpression = ExpressionHelper.CreateSelectExpression(\r\n                    orderByExpression,\r\n                    selectBodyExpression,\r\n                    parameterExpression);\r\n\r\n            Expression distinctExpression = ExpressionHelper.CreateDistinctExpression(selectExpression);\r\n\r\n\r\n            // Sorting after calling \"DISTINCT\" to fix LINQ2SQL issue. No need to sort while resolving security\r\n            if (orderByExpressions != null && dynamicContext.Direction == TreeNodeDynamicContextDirection.Down)\r\n            {\r\n                distinctExpression = ApplyOrder(distinctExpression, orderByExpressions);\r\n            }\r\n\r\n            return distinctExpression;\r\n        }\r\n\r\n\r\n        private Expression ApplyOrder(Expression expression, List<LambdaExpression> fieldSelectors)\r\n        {\r\n            for (int i = 0; i < fieldSelectors.Count; i++)\r\n            {\r\n                if (i == 0)\r\n                {\r\n                    expression = this.SortDirection == SortDirection.Ascending\r\n                        ? ExpressionHelper.CreateOrderByExpression(expression, fieldSelectors[i])\r\n                        : ExpressionHelper.CreateOrderByDescendingExpression(expression,fieldSelectors[i]);\r\n                }\r\n                else\r\n                {\r\n                    expression = this.SortDirection == SortDirection.Ascending\r\n                        ? ExpressionHelper.ThenByExpression(expression, fieldSelectors[i])\r\n                        : ExpressionHelper.ThenByDescendingExpression(expression, fieldSelectors[i]);\r\n                }\r\n            }\r\n\r\n            return expression;\r\n        }\r\n\r\n        private List<T> GetObjects<T>(TreeNodeDynamicContext dynamicContext, bool includeAllGroupingFields = false)\r\n        {\r\n            var expression = GetObjectsExpression(dynamicContext, includeAllGroupingFields);\r\n\r\n            return ExpressionHelper.GetCastedObjects<T>(this.InterfaceType, expression);\r\n        }\r\n\r\n\r\n        private IEnumerable<T> GetCurrentAndLocalizableObjects<T>(TreeNodeDynamicContext dynamicContext, bool includeAllGroupingFields = false)\r\n        {\r\n            IEnumerable<T> objects = GetObjects<T>(dynamicContext, includeAllGroupingFields);\r\n\r\n            if (!this.LocalizationEnabled) return objects;\r\n\r\n            using (new DataScope(UserSettings.ForeignLocaleCultureInfo))\r\n            {\r\n                var foreignObjects = GetObjects<T>(dynamicContext, includeAllGroupingFields);\r\n                return objects.Concat(foreignObjects).Distinct();\r\n            }\r\n        }\r\n\r\n\r\n        private bool UseChildGeneratingFilterExpression => IsTopFolderParent && Display != LeafDisplayMode.Lazy;\r\n\r\n\r\n        internal override Expression CreateFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext, IList<int> filtersToSkip = null)\r\n        {\r\n            var dataEntityToken = dynamicContext.CurrentEntityToken as DataEntityToken;\r\n            var treeSimpleElementEntityToken = dynamicContext.CurrentEntityToken as TreeSimpleElementEntityToken;\r\n\r\n            Expression fieldExpression = ExpressionHelper.CreatePropertyExpression(this.InterfaceType, this.PropertyInfo.DeclaringType, this.FieldName, parameterExpression);\r\n\r\n            object value;\r\n\r\n            Func<Expression> resultFilterExpressionFactory = () => \r\n                this.UseChildGeneratingFilterExpression\r\n                ? this.ChildGeneratingDataElementsTreeNode.CreateFilterExpression(parameterExpression, dynamicContext)\r\n                : null;\r\n\r\n\r\n            if (this.FolderRanges == null)\r\n            {\r\n                if (dynamicContext.FieldGroupingValues.ContainsKey(this.GroupingValuesFieldName))\r\n                {\r\n                    value = dynamicContext.FieldGroupingValues[this.GroupingValuesFieldName];\r\n                }\r\n                else if (dataEntityToken != null)\r\n                {\r\n                    if (CreateFilterExpression_GetValueFromDataEntityToken(dataEntityToken, out value) == false)\r\n                    {\r\n                        return resultFilterExpressionFactory();\r\n                    }\r\n                }\r\n                else if (treeSimpleElementEntityToken != null \r\n                         && treeSimpleElementEntityToken.ParentEntityToken is DataEntityToken)\r\n                {\r\n                    var parentDataEntityToken = treeSimpleElementEntityToken.ParentEntityToken as DataEntityToken;\r\n\r\n                    if (CreateFilterExpression_GetValueFromDataEntityToken(parentDataEntityToken, out value) == false)\r\n                    {\r\n                        return resultFilterExpressionFactory();\r\n                    }\r\n                }\r\n                else if (dynamicContext.Direction == TreeNodeDynamicContextDirection.Down)\r\n                {\r\n                    // We shall not create filter for our self when unfolding \r\n\r\n                    return resultFilterExpressionFactory();\r\n                }\r\n                else if (dynamicContext.Direction == TreeNodeDynamicContextDirection.Up)\r\n                {\r\n                    // At this point we are going upwards, building the filter and one or \r\n                    // more of the parent elements has not been opened, so we are not able to \r\n                    // create a filter. \r\n                    // This will happen if a parent filter is below us\r\n                    return null;\r\n                }\r\n                else\r\n                {\r\n                    // This will only happen if we are searching up and are given another entity token that\r\n                    // TreeDataFieldGroupingElementEntityToken and DataEntityToken or TreeSimpleElementEntityToken \r\n                    throw new NotImplementedException($\"Unsupported child entity token type '{dynamicContext.CurrentEntityToken.GetType()}'\");\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (dynamicContext.FieldFolderRangeValues.ContainsKey(this.FieldName))\r\n                {\r\n                    value = dynamicContext.FieldFolderRangeValues[this.FieldName];\r\n                }\r\n                else if (dataEntityToken != null)\r\n                {\r\n                    if (CreateFilterExpression_GetFolderIndexFromDataEntityToken(dataEntityToken, parameterExpression, fieldExpression, out value) == false)\r\n                    {\r\n                        return resultFilterExpressionFactory();\r\n                    }\r\n                }\r\n                else if (treeSimpleElementEntityToken != null \r\n                        && treeSimpleElementEntityToken.ParentEntityToken is DataEntityToken)\r\n                {\r\n                    DataEntityToken parentDataEntityToken = treeSimpleElementEntityToken.ParentEntityToken as DataEntityToken;\r\n\r\n                    if (CreateFilterExpression_GetFolderIndexFromDataEntityToken(parentDataEntityToken, parameterExpression, fieldExpression, out value) == false)\r\n                    {\r\n                        return resultFilterExpressionFactory();\r\n                    }\r\n                }\r\n                else if (dynamicContext.Direction == TreeNodeDynamicContextDirection.Down)\r\n                {\r\n                    // We shall not create filter for our self when unfolding \r\n                    return resultFilterExpressionFactory();\r\n                }\r\n                else if (dynamicContext.Direction == TreeNodeDynamicContextDirection.Up)\r\n                {\r\n                    // At this point we are going upwards, building the filter and one or \r\n                    // more of the parent elements has not been opened, so we are not able to \r\n                    // create a filter. \r\n                    // This will happen if a parent filter is below us\r\n                    return null;\r\n                }\r\n                else\r\n                {\r\n                    // This will only happen if we are searching up and are given another entity token that\r\n                    // TreeDataFieldGroupingElementEntityToken and DataEntityToken or TreeSimpleElementEntityToken \r\n                    throw new NotImplementedException($\"Unsupported child entity token type '{dynamicContext.CurrentEntityToken.GetType()}'\");\r\n                }\r\n            }\r\n\r\n            Expression filterExpression;\r\n            if (this.FolderRanges != null)\r\n            {\r\n                int folderRangeIndex = (int)value;\r\n\r\n                filterExpression = CreateFolderRangeFilterExpression(folderRangeIndex, fieldExpression);\r\n            }\r\n            else if (this.FirstLetterOnly)\r\n            {\r\n                filterExpression = CreateFirstLetterOnlyFilterExpression(value, fieldExpression);\r\n            }\r\n            else\r\n            {\r\n                filterExpression = CreateSimpleFilterExpression(value, fieldExpression);\r\n            }\r\n\r\n            if (dynamicContext.Direction == TreeNodeDynamicContextDirection.Down)\r\n            {\r\n                if (this.UseChildGeneratingFilterExpression)\r\n                {\r\n                    Expression childFilerExpression = this.ChildGeneratingDataElementsTreeNode.CreateFilterExpression(parameterExpression, dynamicContext);\r\n\r\n                    filterExpression = filterExpression.NestedAnd(childFilerExpression);\r\n                }\r\n            }\r\n            \r\n            return filterExpression;\r\n        }\r\n\r\n\r\n\r\n        private bool CreateFilterExpression_GetValueFromDataEntityToken(DataEntityToken dataEntityToken, out object value)\r\n        {\r\n            if (dataEntityToken.InterfaceType != this.InterfaceType)\r\n            {\r\n                // If we don't have the grouping/folderrange value from entity token and don't have the \r\n                // right data item to get the value, we are not able to create a filter.\r\n                value = null;\r\n                return false;\r\n            }\r\n\r\n            IData data = dataEntityToken.Data;\r\n\r\n            value = this.PropertyInfo.GetValue(data, null);\r\n            value = ConvertFieldValue(this, value);\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private bool CreateFilterExpression_GetFolderIndexFromDataEntityToken(DataEntityToken dataEntityToken, ParameterExpression parameterExpression, Expression fieldExpression, out object value)\r\n        {\r\n            if (dataEntityToken.InterfaceType != this.InterfaceType)\r\n            {\r\n                // If we don't have the foler range value from entity token and don't have the \r\n                // right data item to get the value, we are not able to create a filter.\r\n                value = null;\r\n                return false;\r\n            }\r\n\r\n            this.FolderIndexListClearMethodInfo.Invoke(this.FolderIndexListObject, null);\r\n            this.FolderIndexListAddMethodInfo.Invoke(this.FolderIndexListObject, new object[] { dataEntityToken.Data });\r\n\r\n            Expression selectBodyExpression = this.FolderRanges.CreateContainsListSelectBodyExpression(fieldExpression, parameterExpression);\r\n\r\n            Expression selectExpression = ExpressionHelper.CreateSelectExpression(this.FolderIndexListQueryable.Expression, selectBodyExpression, parameterExpression);\r\n\r\n            value = this.FolderIndexListQueryable.Provider.CreateQuery(selectExpression).ToEnumerableOfObjects().Single();\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private Expression CreateSimpleFilterExpression(object value, Expression fieldExpression)\r\n        {\r\n            Type propertyType = this.PropertyInfo.PropertyType;\r\n            if (propertyType == typeof (DateTime) || propertyType == typeof (DateTime?))\r\n            {\r\n                return CreateFilterByDateTimeExpression(value, fieldExpression);\r\n            }\r\n\r\n            if (value != null && !propertyType.IsInstanceOfType(value))\r\n            {\r\n                Exception ex;\r\n                value = ValueTypeConverter.TryConvert(value, propertyType, out ex);\r\n                if (ex != null)\r\n                {\r\n                    throw new InvalidOperationException($\"Failed to convent a filtering value to type '{propertyType}'\");\r\n                }\r\n            }\r\n\r\n            return Expression.Equal(fieldExpression, Expression.Constant(value, propertyType));\r\n        }\r\n\r\n        private Expression CreateFilterByDateTimeExpression(object value, Expression fieldExpression)\r\n        {\r\n            DateTime dateTime = DateTimeFormater.Deserialize(value.ToString());\r\n\r\n            if (this.DateFormat == null)\r\n            {\r\n                return Expression.Equal(fieldExpression, Expression.Constant(dateTime));\r\n            }\r\n\r\n\r\n            Expression currentExpression = null;\r\n\r\n            if (this.DateTimeFormater.HasYear) currentExpression = AddEqualsExpression(fieldExpression, currentExpression, DateTimeFormater.DateTime_Year, dateTime.Year);\r\n            if (this.DateTimeFormater.HasMonth) currentExpression = AddEqualsExpression(fieldExpression, currentExpression, DateTimeFormater.DateTime_Month, dateTime.Month);\r\n            if (this.DateTimeFormater.HasDay) currentExpression = AddEqualsExpression(fieldExpression, currentExpression, DateTimeFormater.DateTime_Day, dateTime.Day);\r\n            if (this.DateTimeFormater.HasHour) currentExpression = AddEqualsExpression(fieldExpression, currentExpression, DateTimeFormater.DateTime_Hour, dateTime.Hour);\r\n            if (this.DateTimeFormater.HasMinute) currentExpression = AddEqualsExpression(fieldExpression, currentExpression, DateTimeFormater.DateTime_Minute, dateTime.Minute);\r\n            if (this.DateTimeFormater.HasSecond) currentExpression = AddEqualsExpression(fieldExpression, currentExpression, DateTimeFormater.DateTime_Second, dateTime.Second);\r\n\r\n            return currentExpression;\r\n        }\r\n\r\n\r\n\r\n        private Expression CreateFolderRangeFilterExpression(int folderRangeIndex, Expression fieldExpression)\r\n        {\r\n            Expression filterExpression = this.FolderRanges.CreateFilterExpression(folderRangeIndex, fieldExpression);\r\n\r\n            return filterExpression;\r\n        }\r\n\r\n\r\n\r\n        private Expression CreateFirstLetterOnlyFilterExpression(object value, Expression fieldExpression)\r\n        {\r\n            string castedValue = (string)value;\r\n\r\n            if (castedValue == \"\")\r\n            {\r\n                return Expression.Equal(fieldExpression, Expression.Constant(\"\"));\r\n            }\r\n\r\n            return Expression.Condition(\r\n                    Expression.NotEqual(\r\n                        fieldExpression,\r\n                        Expression.Constant(null)\r\n                        ),\r\n                    Expression.Call(\r\n                        Expression.Call(\r\n                            fieldExpression,\r\n                            this.ToUpperCompareMethodInfo\r\n                            ),\r\n                        this.StringStartsWithMethodInfo,\r\n                        Expression.Constant(castedValue.ToUpperInvariant())\r\n                        ),\r\n                    Expression.Constant(false)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private Expression AddEqualsExpression(Expression fieldExpression, Expression currentExpression, PropertyInfo propertyInfo, int value)\r\n        {\r\n            return currentExpression.NestedAnd(\r\n                    Expression.Equal(\r\n                        Expression.Property(fieldExpression, propertyInfo),\r\n                        Expression.Constant(value)\r\n                    )\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private static object ConvertFieldValue(DataFolderElementsTreeNode dataFolderElementsTreeNode, object fieldValue)\r\n        {\r\n            if (dataFolderElementsTreeNode.FirstLetterOnly)\r\n            {\r\n                string stringFieldValue = (string)fieldValue;\r\n\r\n                return stringFieldValue.IsNullOrEmpty() ? \"\" : stringFieldValue.Substring(0, 1);\r\n            }\r\n\r\n            if (dataFolderElementsTreeNode.DateFormat != null)\r\n            {\r\n                if (fieldValue is DateTime)\r\n                {\r\n                    return dataFolderElementsTreeNode.DateTimeFormater.SerializeDateTime((DateTime)fieldValue);\r\n                }\r\n                \r\n                dataFolderElementsTreeNode.DateTimeFormater.GetDateTime(fieldValue);\r\n                return dataFolderElementsTreeNode.DateTimeFormater.Serialize(fieldValue);\r\n            }\r\n\r\n            return fieldValue;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnInitialize()\r\n        {\r\n            var parentNode = this.ParentNode as DataFolderElementsTreeNode;\r\n\r\n            if (this.InterfaceType == null)\r\n            {\r\n                if (parentNode == null)\r\n                {\r\n                    AddValidationError(\"TreeValidationError.DataFolderElements.MissingInterfaceType\");\r\n                    return;\r\n                }\r\n\r\n                this.InterfaceType = parentNode.InterfaceType;\r\n            }\r\n            else\r\n            {\r\n                if (!typeof(IData).IsAssignableFrom(this.InterfaceType))\r\n                {\r\n                    AddValidationError(\"TreeValidationError.Common.NotImplementingIData\", this.InterfaceType, typeof(IData));\r\n                    return;\r\n                }\r\n\r\n                if (parentNode != null && parentNode.InterfaceType != this.InterfaceType)\r\n                {\r\n                    AddValidationError(\"TreeValidationError.DataFolderElements.WrongInterfaceType\", this.InterfaceType, parentNode.InterfaceType);\r\n                    return;\r\n                }\r\n            }\r\n\r\n\r\n            this.PropertyInfo = this.InterfaceType.GetPropertiesRecursively().SingleOrDefault(f => f.Name == this.FieldName);\r\n            if (this.PropertyInfo == null)\r\n            {\r\n                AddValidationError(\"TreeValidationError.Common.MissingProperty\", this.InterfaceType, this.FieldName);\r\n                return;\r\n            }\r\n\r\n\r\n            \r\n            if (this.DateFormat != null && this.PropertyInfo.PropertyType != typeof(DateTime))\r\n            {\r\n                AddValidationError(\"TreeValidationError.DataFolderElements.DateFormetNotAllowed\", this.FieldName, typeof(DateTime), this.PropertyInfo.PropertyType);\r\n            }\r\n\r\n            if (this.PropertyInfo.PropertyType == typeof(DateTime) && this.DateFormat == null)\r\n            {\r\n                AddValidationError(\"TreeValidationError.DataFolderElements.DateFormetIsMissing\", this.FieldName);\r\n                return;\r\n            }\r\n\r\n\r\n            this.DateTimeFormater = new DateTimeFormater(this.DateFormat);\r\n\r\n\r\n            if (!string.IsNullOrEmpty(this.Range) && this.FirstLetterOnly)\r\n            {\r\n                AddValidationError(\"TreeValidationError.DataFolderElements.RangesAndFirstLetterOnlyNotAllowed\");\r\n            }\r\n\r\n            if (this.FirstLetterOnly && this.PropertyInfo.PropertyType != typeof(string))\r\n            {\r\n                AddValidationError(\"TreeValidationError.DataFolderElements.WrongFirstLetterOnlyPropertyType\", this.FieldName, typeof(string), this.PropertyInfo.PropertyType);\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(this.Range))\r\n            {\r\n                this.FolderRanges = FolderRangesCreator.Create(this, this.Range, this.FieldName, this.PropertyInfo.PropertyType);\r\n            }\r\n\r\n            if (this.ChildNodes.OfType<DataElementsTreeNode>().Any(f => f.InterfaceType != this.InterfaceType))\r\n            {\r\n                AddValidationError(\"TreeValidationError.DataFolderElements.WrongDateChildInterfaceType\", this.InterfaceType);\r\n            }\r\n\r\n            this.SerializedInterfaceType = TypeManager.SerializeType(this.InterfaceType);\r\n\r\n\r\n            \r\n            this.AllGroupingNodes = new List<DataFolderElementsTreeNode>();\r\n\r\n            var usedPropertyNames = new List<string>();\r\n            var fieldTypes = new List<Type>();\r\n            DataFolderElementsTreeNode treeNode = this;\r\n            int dataFolderElementCount = 0;\r\n\r\n            while (treeNode != null)\r\n            {\r\n                dataFolderElementCount++;\r\n                if (treeNode.InterfaceType != this.InterfaceType)\r\n                {\r\n                    AddValidationError(\"TreeValidationError.DataFolderElements.InterfaceTypeSwitchNotAllowed\", treeNode.InterfaceType, this.InterfaceType);\r\n                    break;\r\n                }\r\n\r\n                if (treeNode.PropertyInfo.PropertyType != typeof(DateTime))\r\n                {\r\n                    if (usedPropertyNames.Contains(treeNode.FieldName))\r\n                    {\r\n                        AddValidationError(\"TreeValidationError.DataFolderElements.SameFieldUsedTwice\", treeNode.FieldName);\r\n                        break;\r\n                    }\r\n                    \r\n                    usedPropertyNames.Add(treeNode.FieldName);\r\n                }\r\n\r\n                this.AllGroupingNodes.Add(treeNode);\r\n\r\n                if (treeNode.FolderRanges != null)\r\n                {\r\n                    fieldTypes.Add(typeof(int));\r\n                }\r\n                else if (treeNode.PropertyInfo.PropertyType == typeof(DateTime))\r\n                {\r\n                    fieldTypes.Add(treeNode.DateTimeFormater.GetTupleConstructor().DeclaringType);\r\n                }\r\n                else\r\n                {\r\n                    fieldTypes.Add(treeNode.PropertyInfo.PropertyType);\r\n                }\r\n\r\n                treeNode = treeNode.ParentNode as DataFolderElementsTreeNode;\r\n            }\r\n\r\n            Type type = GetTupleType(this.AllGroupingNodes.Count);\r\n            type = type.MakeGenericType(fieldTypes.ToArray());\r\n\r\n            this.AllGroupingsTupleConstructor = type.GetConstructors().Single();\r\n\r\n\r\n            Type listType = typeof(List<>).MakeGenericType(this.InterfaceType);\r\n            this.FolderIndexListAddMethodInfo = listType.GetMethods().Single(f => f.Name == \"Add\");\r\n            this.FolderIndexListClearMethodInfo = listType.GetMethods().Single(f => f.Name == \"Clear\");\r\n\r\n            this.FolderIndexListObject = Activator.CreateInstance(listType);\r\n            this.FolderIndexListQueryable = ((IEnumerable)this.FolderIndexListObject).AsQueryable();\r\n\r\n\r\n            if (this.FieldName == null)\r\n            {\r\n                this.GroupingValuesFieldName = this.FieldName;\r\n            }\r\n            else\r\n            {\r\n                this.GroupingValuesFieldName = $\"■{this.FieldName}_{dataFolderElementCount}\";\r\n            }\r\n\r\n          \r\n            this.IsTopFolderParent = (this.ParentNode is DataFolderElementsTreeNode) == false;\r\n            this.ChildGeneratingDataElementsTreeNode = this.DescendantsBreadthFirst().OfType<DataElementsTreeNode>().First();\r\n            IEnumerable<ParentIdFilterNode> parentIdFilterNodes = this.ChildGeneratingDataElementsTreeNode.FilterNodes.OfType<ParentIdFilterNode>();\r\n            if (parentIdFilterNodes.Count() <= 1)\r\n            {\r\n                this.ChildGeneratingParentIdFilterNode = this.ChildGeneratingDataElementsTreeNode.FilterNodes.OfType<ParentIdFilterNode>().SingleOrDefault();\r\n            }\r\n            else\r\n            {\r\n                AddValidationError(\"TreeValidationError.DataFolderElements.TooManyParentIdFilters\", treeNode.FieldName);\r\n            }\r\n\r\n            this.KeyPropertyInfo = this.InterfaceType.GetKeyProperties()[0];\r\n\r\n            if (!typeof(ILocalizedControlled).IsAssignableFrom(this.InterfaceType))\r\n            {\r\n                this.ShowForeignItems = false;\r\n            }\r\n        }\r\n\r\n\r\n        private bool LocalizationEnabled => \r\n            ShowForeignItems\r\n            && UserValidationFacade.IsLoggedIn()\r\n            && UserSettings.ForeignLocaleCultureInfo != null\r\n            && !UserSettings.ActiveLocaleCultureInfo.Equals(UserSettings.ForeignLocaleCultureInfo);\r\n\r\n\r\n        private static Type GetTupleType(int filedCount)\r\n        {\r\n            switch (filedCount)\r\n            {\r\n                case 1:\r\n                    return TupleType1;\r\n\r\n                case 2:\r\n                    return TupleType2;\r\n\r\n                case 3:\r\n                    return TupleType3;\r\n\r\n                case 4:\r\n                    return TupleType4;\r\n\r\n                case 5:\r\n                    return TupleType5;\r\n\r\n                case 6:\r\n                    return TupleType6;\r\n\r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n        }\r\n        private static readonly Type TupleType1 = typeof(Tuple<>);\r\n        private static readonly Type TupleType2 = typeof(Tuple<,>);\r\n        private static readonly Type TupleType3 = typeof(Tuple<,,>);\r\n        private static readonly Type TupleType4 = typeof(Tuple<,,,>);\r\n        private static readonly Type TupleType5 = typeof(Tuple<,,,,>);\r\n        private static readonly Type TupleType6 = typeof(Tuple<,,,,,>);\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return $\"DataFolderElementsTreeNode, Id = {this.Id}, DataType = {this.InterfaceType}, FieldName = {this.FieldName}, {this.ParentString()}\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/DynamicValuesHelper.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DynamicValuesHelperReplaceContext\r\n    {\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"DynamicValuesHelperReplaceContext\"/> class.\r\n        /// </summary>\r\n        public DynamicValuesHelperReplaceContext()\r\n        {\r\n        }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"DynamicValuesHelperReplaceContext\"/> class.\r\n        /// </summary>\r\n        public DynamicValuesHelperReplaceContext(EntityToken currentEntityToken, Dictionary<string, string> piggyback)\r\n        {\r\n            piggyback = piggyback ?? new Dictionary<string, string>();\r\n\r\n            this.CurrentEntityToken = currentEntityToken;\r\n            this.PiggybagDataFinder = new PiggybagDataFinder(piggyback, currentEntityToken);\r\n\r\n            if (currentEntityToken is DataEntityToken)\r\n            {\r\n                this.CurrentDataItem = (currentEntityToken as DataEntityToken).Data;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the piggybag data finder.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The piggybag data finder.\r\n        /// </value>\r\n        /// <exclude />\r\n        public PiggybagDataFinder PiggybagDataFinder { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the current data item.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The current data item.\r\n        /// </value>\r\n        /// <exclude />\r\n        public IData CurrentDataItem { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the current entity token.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The current entity token.\r\n        /// </value>\r\n        /// <exclude />\r\n        public EntityToken CurrentEntityToken { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DynamicValuesHelper\r\n    {\r\n        const string CurrentEntityTokenMask = \"${C1:EntityToken}\";\r\n\r\n        private DataFieldValueHelper DataFieldValueHelper { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Template { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n\r\n        public DynamicValuesHelper(string template)\r\n        {\r\n            this.Template = template;\r\n\r\n            this.DataFieldValueHelper = null;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool UseUrlEncode { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string ReplaceValues(DynamicValuesHelperReplaceContext context)\r\n        {\r\n            string currentValue = this.Template;\r\n\r\n            if (this.DataFieldValueHelper != null)\r\n            {\r\n                currentValue = this.DataFieldValueHelper.ReplaceValues(currentValue, context.PiggybagDataFinder, context.CurrentDataItem, this.UseUrlEncode);\r\n            }\r\n\r\n            if (currentValue.Contains(CurrentEntityTokenMask))\r\n            {\r\n                string serializedEntityToken = context.CurrentEntityToken != null\r\n                                                   ? EntityTokenSerializer.Serialize(context.CurrentEntityToken)\r\n                                                   : \"(null)\";\r\n\r\n                if (this.UseUrlEncode)\r\n                {\r\n                    serializedEntityToken = HttpUtility.UrlEncode(serializedEntityToken);\r\n                }\r\n\r\n                currentValue = currentValue.Replace(CurrentEntityTokenMask, serializedEntityToken);\r\n            }\r\n            \r\n\r\n            return StringResourceSystemFacade.ParseString(currentValue);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"ownerTreeNode\">This is only used to add validation errors</param>\r\n        public void Initialize(TreeNode ownerTreeNode)\r\n        {\r\n            Initialize_DataFieldValueHelper(ownerTreeNode);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Initialize(ActionNode ownerActionNode)\r\n        {\r\n            Initialize(ownerActionNode.OwnerNode);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"ownerTreeNode\">This is only used to add validation errors</param>\r\n        private void Initialize_DataFieldValueHelper(TreeNode ownerTreeNode)\r\n        {\r\n            if (DataFieldValueHelper.ContainsDataField(this.Template) == false) return;\r\n\r\n            this.DataFieldValueHelper = new DataFieldValueHelper(this.Template);\r\n            this.DataFieldValueHelper.Initialize(ownerTreeNode);\r\n        }\r\n    }\t\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/FieldFilterNode.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal enum FieldFilterNodeOperator\r\n    {\r\n        Equal = 0,\r\n        Inequal = 1,\r\n        Lesser = 2,\r\n        Greater = 3,\r\n        LesserEqual = 4,\r\n        GreaterEqual = 5\r\n    }\r\n\r\n\r\n\r\n    internal class FieldFilterNode : FilterNode\r\n\t{\r\n        private PropertyInfo PropertyInfo { get; set; }\r\n        private object ConvertedValue { get; set ;}\r\n\r\n        public string FieldName { get; internal set; }                  // Required\r\n        public string FieldValue { get; internal set; }                 // Required\r\n        public FieldFilterNodeOperator Operator { get; internal set; }  // Optional\r\n\r\n\r\n\r\n        public override Expression CreateDownwardsFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            return CreateFilterExpression(parameterExpression, dynamicContext);            \r\n        }\r\n\r\n\r\n\r\n        public override Expression CreateUpwardsFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            return CreateFilterExpression(parameterExpression, dynamicContext);\r\n        }\r\n\r\n\r\n\r\n        internal override void Initialize()\r\n        {\r\n            this.PropertyInfo = this.OwnerNode.InterfaceType.GetPropertiesRecursively().Where(f => f.Name == this.FieldName).SingleOrDefault();\r\n\r\n            if (this.PropertyInfo == null)\r\n            {\r\n                AddValidationError(\"TreeValidationError.Common.MissingProperty\", this.OwnerNode.InterfaceType, this.FieldName);\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                this.ConvertedValue = ValueTypeConverter.Convert(this.FieldValue, this.PropertyInfo.PropertyType);\r\n            }\r\n            catch\r\n            {\r\n                AddValidationError(\"TreeValidationError.FieldFilter.ValueCouldNotBeConverted\", this.FieldValue, this.PropertyInfo.PropertyType);\r\n            }\r\n\r\n            if ((this.PropertyInfo.PropertyType == typeof(string)) || (this.PropertyInfo.PropertyType == typeof(Guid)))\r\n            {\r\n                if ((this.Operator != FieldFilterNodeOperator.Equal) && (this.Operator != FieldFilterNodeOperator.Inequal))\r\n                {\r\n                    AddValidationError(\"TreeValidationError.FieldFilter.OperatorNotSupportedForType\", this.Operator, this.PropertyInfo.PropertyType);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Expression CreateFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext)\r\n        {            \r\n            object value = ValueTypeConverter.Convert(this.FieldValue, this.PropertyInfo.PropertyType);\r\n\r\n            Expression valueExpression = Expression.Constant(value, this.PropertyInfo.PropertyType);\r\n\r\n            Expression expression;\r\n            switch (this.Operator)\r\n            {\r\n                case FieldFilterNodeOperator.Equal:\r\n                    expression = Expression.Equal(ExpressionHelper.CreatePropertyExpression(this.FieldName, parameterExpression), valueExpression);\r\n                    break;\r\n\r\n                case FieldFilterNodeOperator.Inequal:\r\n                    expression = Expression.NotEqual(ExpressionHelper.CreatePropertyExpression(this.FieldName, parameterExpression), valueExpression);\r\n                    break;\r\n\r\n                case FieldFilterNodeOperator.Greater:\r\n                    expression = Expression.GreaterThan(ExpressionHelper.CreatePropertyExpression(this.FieldName, parameterExpression), valueExpression);\r\n                    break;\r\n\r\n                case FieldFilterNodeOperator.GreaterEqual:\r\n                    expression = Expression.GreaterThanOrEqual(ExpressionHelper.CreatePropertyExpression(this.FieldName, parameterExpression), valueExpression);\r\n                    break;\r\n\r\n                case FieldFilterNodeOperator.Lesser:\r\n                    expression = Expression.LessThan(ExpressionHelper.CreatePropertyExpression(this.FieldName, parameterExpression), valueExpression);\r\n                    break;\r\n\r\n                case FieldFilterNodeOperator.LesserEqual:\r\n                    expression = Expression.LessThanOrEqual(ExpressionHelper.CreatePropertyExpression(this.FieldName, parameterExpression), valueExpression);\r\n                    break;\r\n\r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n            \r\n\r\n            return expression;\r\n        }\r\n        \r\n\r\n\r\n        public override string ToString()\r\n        {\r\n            return string.Format(\"FieldFilterNode, FieldName = {0}, FieldValue = {1}\", this.FieldName, this.FieldValue);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/FieldOrderByNode.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal sealed class FieldOrderByNode : OrderByNode\r\n    {\r\n        private PropertyInfo PropertyInfo { get; set; }\r\n\r\n\r\n        public string FieldName { get; internal set; } // Required\r\n        public string Direction { get; internal set; } // Optional\r\n\r\n\r\n        public override Expression CreateOrderByExpression(Expression sourceExpression, ParameterExpression parameterExpression, bool first)\r\n        {\r\n            Expression fieldExpression = ExpressionHelper.CreatePropertyExpression(this.OwnerNode.InterfaceType, this.PropertyInfo.DeclaringType, this.FieldName, parameterExpression);\r\n\r\n            LambdaExpression lambdaExpression = Expression.Lambda(fieldExpression, parameterExpression);\r\n\r\n            if (first)\r\n            {\r\n                return this.Direction == \"ascending\"\r\n                    ? ExpressionCreator.OrderBy(sourceExpression, lambdaExpression)\r\n                    : ExpressionCreator.OrderByDescending(sourceExpression, lambdaExpression);\r\n            }\r\n\r\n            return this.Direction == \"ascending\"\r\n                    ? ExpressionCreator.ThenBy(sourceExpression, lambdaExpression)\r\n                    : ExpressionCreator.ThenByDescending(sourceExpression, lambdaExpression);\r\n        }\r\n\r\n\r\n\r\n        internal override void Initialize()\r\n        {\r\n            if ((this.Direction != \"ascending\") && (this.Direction != \"descending\"))\r\n            {\r\n                AddValidationError(\"TreeValidationError.FieldOrderBy.UnknownDirection\", this.Direction);\r\n            }\r\n\r\n            this.PropertyInfo = this.OwnerNode.InterfaceType.GetPropertiesRecursively().SingleOrDefault(f => f.Name == this.FieldName);\r\n\r\n            if (this.PropertyInfo == null)\r\n            {\r\n                AddValidationError(\"TreeValidationError.FieldOrderBy.UnknownField\", this.OwnerNode.InterfaceType, this.FieldName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override string ToString()\r\n        {\r\n            return string.Format(\"OrderByNode, FieldName = {0}, Direction = {1}\", this.FieldName, this.Direction);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/FilterNode.cs",
    "content": "﻿using System.Linq.Expressions;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class FilterNode\r\n    {\r\n        /// <exclude />\r\n        public string XPath { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public int Id { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public DataElementsTreeNode OwnerNode { get; internal set; }\r\n\r\n\r\n        /// <summary>\r\n        /// This is used when finding data to create elements from (elements going down)\r\n        /// </summary>\r\n        /// <param name=\"parameterExpression\"></param>\r\n        /// <param name=\"dynamicContext\"></param>\r\n        /// <returns></returns>\r\n        public virtual Expression CreateDownwardsFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext) { return null; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is used when finding data to create entity tokens (security going up)\r\n        /// </summary>\r\n        /// <param name=\"parameterExpression\"></param>\r\n        /// <param name=\"dynamicContext\"></param>\r\n        /// <returns></returns>\r\n        public virtual Expression CreateUpwardsFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext) { return null; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Use this method to do initializing and validation\r\n        /// </summary>\r\n        internal virtual void Initialize() { }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void SetOwnerNode(TreeNode treeNode)\r\n        {\r\n            this.OwnerNode = (DataElementsTreeNode)treeNode;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void AddValidationError(ValidationError validationError)\r\n        {\r\n            this.OwnerNode.Tree.BuildResult.AddValidationError(validationError);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void AddValidationError(string stringName, params object[] args)\r\n        {\r\n            this.OwnerNode.Tree.BuildResult.AddValidationError(ValidationError.Create(this.XPath, stringName, args));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/ActionNodeCreatorFactory.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal static class ActionNodeCreatorFactory\r\n    {\r\n        private static readonly string DefaultAddDataResourceName = \"generated-type-data-add\";\r\n        private static readonly string DefaultEditDataResourceName = \"generated-type-data-edit\";\r\n        private static readonly string DefaultDeleteDataResourceName = \"generated-type-data-delete\";\r\n        private static readonly string DefaultDuplicateDataResourceName = \"generated-type-data-duplicate\";\r\n        private static readonly string DefaultReportFunctionResourceName = \"reportfunctionaction-defaulticon\";\r\n        private static readonly string DefaultMessageBoxResourceName = \"messageboxaction-defaulticon\";\r\n        private static readonly string DefaultCustomUrlResourceName = \"customurlaction-defaulticon\";\r\n        private static readonly string DefaultConfirmResourceName = \"confirmaction-defaulticon\";\r\n        private static readonly string DefaultWorkflowResourceName = \"workflowaction-defaulticon\";\r\n\r\n\r\n        private static readonly List<PermissionType> DefaultAddPermissionTypes = new List<PermissionType> { PermissionType.Add };\r\n        private static readonly List<PermissionType> DefaultEditPermissionTypes = new List<PermissionType> { PermissionType.Edit };\r\n        private static readonly List<PermissionType> DefaultDeletePermissionTypes = new List<PermissionType> { PermissionType.Delete };\r\n        private static readonly List<PermissionType> DefaultDuplicatePermissionTypes = new List<PermissionType> { PermissionType.Add };\r\n\r\n\r\n        public static ActionNode CreateActionNode(XElement element, Tree tree)\r\n        {\r\n            if (element.Name == TreeMarkupConstants.Namespace + \"AddDataAction\")\r\n            {\r\n                GenericAddDataActionNode actionNode = new GenericAddDataActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultAddDataResourceName, StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"GenericAddDataAction.DefaultLabel\"), ActionLocation.AddPrimaryActionLocation, DefaultAddPermissionTypes);\r\n\r\n                XAttribute typeAttribute = element.Attribute(\"Type\");\r\n                XAttribute customFormMarkupAttribute = element.Attribute(\"CustomFormMarkupPath\");\r\n\r\n                if (typeAttribute == null)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"Type\");\r\n                }\r\n                else\r\n                {\r\n                    actionNode.InterfaceType = TypeManager.TryGetType(typeAttribute.Value);\r\n                    if (actionNode.InterfaceType == null) tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.UnknownInterfaceType\", typeAttribute.Value);\r\n                }\r\n\r\n                actionNode.CustomFormMarkupPath = customFormMarkupAttribute.GetValueOrDefault(null);\r\n\r\n                return actionNode;\r\n            }\r\n            else if (element.Name == TreeMarkupConstants.Namespace + \"EditDataAction\")\r\n            {\r\n                GenericEditDataActionNode actionNode = new GenericEditDataActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultEditDataResourceName, StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"GenericEditDataAction.DefaultLabel\"), ActionLocation.EditPrimaryActionLocation, DefaultEditPermissionTypes);\r\n\r\n                XAttribute customFormMarkupAttribute = element.Attribute(\"CustomFormMarkupPath\");\r\n\r\n                actionNode.CustomFormMarkupPath = customFormMarkupAttribute.GetValueOrDefault(null);\r\n\r\n                return actionNode;\r\n            }\r\n            else if (element.Name == TreeMarkupConstants.Namespace + \"DeleteDataAction\")\r\n            {\r\n                GenericDeleteDataActionNode actionNode = new GenericDeleteDataActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultDeleteDataResourceName, StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"GenericDeleteDataAction.DefaultLabel\"), ActionLocation.DeletePrimaryActionLocation, DefaultDeletePermissionTypes);\r\n\r\n                return actionNode;\r\n            }\r\n            else if (element.Name == TreeMarkupConstants.Namespace + \"DuplicateDataAction\")\r\n            {\r\n                GenericDuplicateDataActionNode actionNode = new GenericDuplicateDataActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultDuplicateDataResourceName, StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"GenericDuplicateDataAction.DefaultLabel\"), ActionLocation.OtherPrimaryActionLocation, DefaultDuplicatePermissionTypes);\r\n\r\n                return actionNode;\r\n            }\r\n            else if (element.Name == TreeMarkupConstants.Namespace + \"ReportFunctionAction\")\r\n            {\r\n                ReportFunctionActionNode actionNode = new ReportFunctionActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultReportFunctionResourceName);\r\n\r\n                XAttribute documentLabelAttribute = element.Attribute(\"DocumentLabel\");\r\n                XAttribute documentIconAttribute = element.Attribute(\"DocumentIcon\");\r\n\r\n                XElement functionMarkupElement = element.Element((XNamespace)FunctionTreeConfigurationNames.NamespaceName + FunctionTreeConfigurationNames.FunctionTagName);\r\n                if (functionMarkupElement == null) tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingFunctionMarkup\");\r\n                actionNode.FunctionMarkup = functionMarkupElement;\r\n\r\n                actionNode.DocumentLabel = documentLabelAttribute.GetValueOrDefault(actionNode.Label);\r\n                if (documentIconAttribute != null)\r\n                {\r\n                    actionNode.DocumentIcon = FactoryHelper.GetIcon(documentIconAttribute.Value);\r\n                }\r\n                else\r\n                {\r\n                    actionNode.DocumentIcon = actionNode.Icon;\r\n                }\r\n\r\n                return actionNode;\r\n            }\r\n            else if (element.Name == TreeMarkupConstants.Namespace + \"MessageBoxAction\")\r\n            {\r\n                MessageBoxActionNode actionNode = new MessageBoxActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultMessageBoxResourceName);\r\n\r\n                XAttribute messageBoxTitleAttribute = element.Attribute(\"MessageBoxTitle\");\r\n                XAttribute messageBoxMessageAttribute = element.Attribute(\"MessageBoxMessage\");\r\n\r\n                if (messageBoxTitleAttribute == null)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"MessageBoxTitle\");\r\n                }\r\n                else\r\n                {\r\n                    actionNode.Title = messageBoxTitleAttribute.Value;\r\n                }\r\n\r\n                if (messageBoxMessageAttribute == null)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"MessageBoxMessage\");\r\n                }\r\n                else\r\n                {\r\n                    actionNode.Message = messageBoxMessageAttribute.Value;\r\n                }\r\n\r\n                XAttribute dialogTypeAttribute = element.Attribute(\"MessageDialogType\");\r\n                string dialogTypeValue = dialogTypeAttribute.GetValueOrDefault(\"message\");\r\n                switch (dialogTypeValue)\r\n                {\r\n                    case \"message\": \r\n                        actionNode.DialogType = DialogType.Message;\r\n                        break;\r\n\r\n                    case \"question\":\r\n                        actionNode.DialogType = DialogType.Question;\r\n                        break;\r\n\r\n                    case \"warning\":\r\n                        actionNode.DialogType = DialogType.Warning;\r\n                        break;\r\n\r\n                    case \"error\":\r\n                        actionNode.DialogType = DialogType.Error;\r\n                        break;\r\n\r\n                    default:\r\n                        tree.AddValidationError(element.GetXPath(), \"TreeValidationError.MessageBoxAction.UnknownDialogType\", dialogTypeValue);\r\n                        break;\r\n                }\r\n\r\n                return actionNode;\r\n            }\r\n            else if (element.Name == TreeMarkupConstants.Namespace + \"CustomUrlAction\")\r\n            {\r\n                CustomUrlActionNode actionNode = new CustomUrlActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultCustomUrlResourceName);\r\n\r\n                XAttribute urlAttribute = element.Attribute(\"Url\");\r\n                XAttribute viewLabelAttribute = element.Attribute(\"ViewLabel\");\r\n                XAttribute viewToolTipAttribute = element.Attribute(\"ViewToolTip\");\r\n                XAttribute viewIconAttribute = element.Attribute(\"ViewIcon\");\r\n\r\n                IEnumerable<XElement> postParameterElements = element.Elements(TreeMarkupConstants.Namespace + \"PostParameters\");\r\n                XElement postParametersElement = null;\r\n                if (postParameterElements.Count() == 1)\r\n                {\r\n                    postParametersElement = element.Element(TreeMarkupConstants.Namespace + \"PostParameters\");\r\n                }\r\n                else if (postParameterElements.Count() > 1)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.CustomUrlAction.TooManyPostParameterElements\", \"PostParameters\");\r\n                }\r\n\r\n                if (urlAttribute == null)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"Url\");\r\n                }\r\n                else\r\n                {\r\n                    actionNode.Url = urlAttribute.Value;\r\n                }\r\n\r\n                actionNode.ViewLabel = viewLabelAttribute.GetValueOrDefault(actionNode.Label);\r\n                actionNode.ViewToolTip = viewToolTipAttribute.GetValueOrDefault(actionNode.ToolTip);\r\n                actionNode.ViewIcon = FactoryHelper.GetIcon(viewIconAttribute.GetValueOrDefault(DefaultCustomUrlResourceName));\r\n\r\n                bool urlIsAbsolute = actionNode.Url != null && actionNode.Url.Contains(\"://\");\r\n\r\n                XAttribute viewTypeAttribute = element.Attribute(\"ViewType\");\r\n                string viewTypeValue = viewTypeAttribute.GetValueOrDefault(urlIsAbsolute ? \"externalview\" : \"documentview\");\r\n                switch (viewTypeValue)\r\n                {\r\n                    case \"externalview\":\r\n                        actionNode.ViewType = CustomUrlActionNodeViewType.ExternalView;\r\n                        break;\r\n\r\n                    case \"genericview\":\r\n                        actionNode.ViewType = CustomUrlActionNodeViewType.GenericView;\r\n                        break;\r\n\r\n                    case \"pagebrowser\":\r\n                        actionNode.ViewType = CustomUrlActionNodeViewType.PageBrowser;\r\n                        break;\r\n\r\n                    case \"filedownload\":\r\n                        actionNode.ViewType = CustomUrlActionNodeViewType.FileDownload;\r\n                        break;\r\n\r\n                    case \"documentview\":\r\n                        actionNode.ViewType = CustomUrlActionNodeViewType.DocumentView;\r\n                        break;\r\n\r\n                    default:\r\n                        tree.AddValidationError(element.GetXPath(), \"TreeValidationError.CustomUrlAction.UnknownViewType\", viewTypeValue);\r\n                        break;\r\n                }\r\n\r\n                actionNode.PostParameters = new Dictionary<string, string>();\r\n                if (postParametersElement != null)\r\n                {\r\n                    foreach (XElement parameterElement in postParametersElement.Elements(TreeMarkupConstants.Namespace + \"Parameter\"))\r\n                    {\r\n                        XAttribute keyAttribute = parameterElement.Attribute(\"Key\");\r\n                        XAttribute valueAttribute = parameterElement.Attribute(\"Value\");\r\n\r\n                        if (keyAttribute == null)\r\n                        {\r\n                            tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"Key\");\r\n                            continue;\r\n                        }\r\n                        else if (string.IsNullOrWhiteSpace(keyAttribute.Value))\r\n                        {\r\n                            tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.WrongAttributeValue\", \"Key\");\r\n                            continue;                            \r\n                        }\r\n\r\n                        if (valueAttribute == null)\r\n                        {\r\n                            tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"Value\");\r\n                            continue;\r\n                        }\r\n\r\n                        actionNode.PostParameters.Add(keyAttribute.Value, valueAttribute.Value);\r\n                    }\r\n                }\r\n\r\n                return actionNode;\r\n            }\r\n            else if (element.Name == TreeMarkupConstants.Namespace + \"ConfirmAction\")\r\n            {\r\n                ConfirmActionNode actionNode = new ConfirmActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultConfirmResourceName);\r\n\r\n                XAttribute confirmTitleAttribute = element.Attribute(\"ConfirmTitle\");\r\n                XAttribute confirmMessageAttribute = element.Attribute(\"ConfirmMessage\");\r\n\r\n                if (confirmTitleAttribute == null)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"ConfirmTitle\");\r\n                }\r\n                else\r\n                {\r\n                    actionNode.ConfirmTitle = confirmTitleAttribute.Value;\r\n                }\r\n\r\n                if (confirmMessageAttribute == null)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"ConfirmMessage\");\r\n                }\r\n                else\r\n                {\r\n                    actionNode.ConfirmMessage = confirmMessageAttribute.Value;\r\n                }\r\n\r\n                XElement functionMarkupElement = element.Element((XNamespace)FunctionTreeConfigurationNames.NamespaceName + FunctionTreeConfigurationNames.FunctionTagName);\r\n                if (functionMarkupElement == null) tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingFunctionMarkup\");\r\n                actionNode.FunctionMarkup = functionMarkupElement;\r\n\r\n                XAttribute refreshTreeAttribute = element.Attribute(\"RefreshTree\");\r\n                string refreshTreeAttributeValue = refreshTreeAttribute.GetValueOrDefault(\"false\").ToLowerInvariant();\r\n                if (refreshTreeAttributeValue == \"true\")\r\n                {\r\n                    actionNode.RefreshTree = true;\r\n                }\r\n                else\r\n                {\r\n                    actionNode.RefreshTree = false;\r\n                }                \r\n\r\n                return actionNode;\r\n            }\r\n            else if (element.Name == TreeMarkupConstants.Namespace + \"WorkflowAction\")\r\n            {\r\n                WorkflowActionNode actionNode = new WorkflowActionNode();\r\n                InitializeWithCommonValue(element, tree, actionNode, DefaultWorkflowResourceName);\r\n\r\n                XAttribute workflowTypeAttribute = element.Attribute(\"WorkflowType\");                \r\n\r\n                if (workflowTypeAttribute == null)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"ConfirmTitle\");\r\n                }\r\n                else\r\n                {\r\n                    actionNode.WorkflowType = TypeManager.TryGetType(workflowTypeAttribute.Value);\r\n                    if (actionNode.WorkflowType == null) tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.UnknownInterfaceType\", workflowTypeAttribute.Value);\r\n                }\r\n                \r\n                return actionNode;\r\n            }\r\n            else\r\n            {\r\n                tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.UnknownElement\", element.Name);\r\n\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void InitializeWithCommonValue(XElement element, Tree tree, ActionNode actionNode, string defaultIconName, string defaultLabelName = null, ActionLocation defaultActionLocation = null, List<PermissionType> defaultPermissionTypes = null)\r\n        {\r\n            XAttribute labelAttribute = element.Attribute(\"Label\");\r\n            XAttribute toolTipAttribute = element.Attribute(\"ToolTip\");\r\n            XAttribute iconAttribute = element.Attribute(\"Icon\");\r\n\r\n            if ((defaultLabelName == null) && (labelAttribute == null)) tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"Label\");\r\n\r\n            actionNode.XPath = element.GetXPath();\r\n            actionNode.Id = tree.BuildProcessContext.ActionIdCounter++;\r\n            actionNode.Label = labelAttribute.GetValueOrDefault(defaultLabelName);\r\n            actionNode.ToolTip = toolTipAttribute.GetValueOrDefault(actionNode.Label);\r\n            actionNode.Icon = FactoryHelper.GetIcon(iconAttribute.GetValueOrDefault(defaultIconName));\r\n            actionNode.Location = GetActionLocation(element, tree, defaultActionLocation);\r\n            if (defaultPermissionTypes != null)\r\n            {\r\n                actionNode.PermissionTypes = defaultPermissionTypes;\r\n            }\r\n            else\r\n            {\r\n                actionNode.PermissionTypes = GetPermissionTypes(element, tree);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static List<PermissionType> GetPermissionTypes(XElement element, Tree tree, List<PermissionType> defaultPermissionTypes = null)\r\n        {\r\n            XAttribute permissionTypesAttribute = element.Attribute(\"PermissionTypes\");\r\n            if ((permissionTypesAttribute == null) && (defaultPermissionTypes != null)) return defaultPermissionTypes;\r\n\r\n            string permissionTypesString = permissionTypesAttribute.GetValueOrDefault(\"read\");\r\n\r\n            string[] permissionTypesStrings = permissionTypesString.Split(',');\r\n\r\n            var permissionTypes = new List<PermissionType>();\r\n            foreach (string permission in permissionTypesStrings)\r\n            {                \r\n                PermissionType permissionType;\r\n                if (Enum.TryParse<PermissionType>(permission.Trim(), true, out permissionType) == false)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.WrongPermissionValue\", permission.Trim());\r\n                    \r\n                    continue;\r\n                }\r\n\r\n                permissionTypes.Add(permissionType);\r\n            }\r\n\r\n            return permissionTypes;\r\n        }\r\n\r\n\r\n\r\n        public static ActionLocation GetActionLocation(XElement element, Tree tree, ActionLocation defaultActionLocation = null)\r\n        {\r\n            XAttribute locationAttribute = element.Attribute(\"Location\");\r\n\r\n            if (locationAttribute == null) return ActionLocation.OtherPrimaryActionLocation;\r\n\r\n            switch (locationAttribute.Value)\r\n            {\r\n                case \"Add\":\r\n                    return ActionLocation.AddPrimaryActionLocation;\r\n\r\n                case \"Edit\":\r\n                    return ActionLocation.EditPrimaryActionLocation;\r\n\r\n                case \"Delete\":\r\n                    return ActionLocation.DeletePrimaryActionLocation;\r\n\r\n                case \"Other\":\r\n                    return ActionLocation.OtherPrimaryActionLocation;\r\n\r\n                default:\r\n                    if (defaultActionLocation != null) return defaultActionLocation;\r\n\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.WrongLocationValue\", locationAttribute.Value);\r\n\r\n                    return ActionLocation.OtherPrimaryActionLocation;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/BaseAttachmentPoint.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class BaseAttachmentPoint : IAttachmentPoint\r\n    {\r\n        /// <exclude />\r\n        public abstract bool IsAttachmentPoint(EntityToken parentEntityToken);\r\n\r\n        /// <exclude />\r\n        public ElementAttachingProviderPosition Position { get; set; }\r\n\r\n        /// <exclude />\r\n        public abstract IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext);\r\n\r\n        /// <exclude />\r\n        public abstract void Log(string title, string indention = \"\");\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/BasePossibleAttachmentPoint.cs",
    "content": "﻿using Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    internal abstract class BasePossibleAttachmentPoint : IPossibleAttachmentPoint\r\n    {\r\n        public abstract bool IsPossibleAttachmentPoint(EntityToken parentEntityToken);\r\n\r\n        public ElementAttachingProviderPosition Position { get; set; }\r\n\r\n        public abstract void Log(string title, string indention = \"\");\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/CustomAttachmentPoint.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    internal sealed class CustomAttachmentPoint : BaseAttachmentPoint\r\n    {\r\n        private readonly EntityToken _parentEntityToken;\r\n\r\n\r\n        public CustomAttachmentPoint(EntityToken parentEntityToken)\r\n        {\r\n            _parentEntityToken = parentEntityToken;\r\n            this.Position = ElementAttachingProviderPosition.Top;\r\n        }\r\n\r\n\r\n        public CustomAttachmentPoint(EntityToken parentEntityToken, ElementAttachingProviderPosition position)\r\n            :this(parentEntityToken)\r\n        {\r\n            this.Position = position;\r\n        }\r\n\r\n\r\n        public override bool IsAttachmentPoint(EntityToken parentEntityToken)\r\n        {\r\n            return parentEntityToken.Equals(_parentEntityToken);\r\n        }\r\n\r\n\r\n\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            yield return _parentEntityToken;\r\n        }\r\n\r\n\r\n\r\n        public override void Log(string title, string indention = \"\")\r\n        {\r\n            Composite.Core.Log.LogVerbose(title, \"{0}Custom: Position = {1}, EntityTokenType = {2}, EntityToken = {3}\", \r\n                indention, this.Position, _parentEntityToken.GetType(), _parentEntityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/DataItemAttachmentPoint.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    internal class DataItemAttachmentPoint : BaseAttachmentPoint, IDataItemAttachmentPoint\r\n    {\r\n        public Type InterfaceType { get; set; }\r\n\r\n\r\n        public override bool IsAttachmentPoint(EntityToken parentEntityToken)\r\n        {\r\n            DataEntityToken dataEntityToken = parentEntityToken as DataEntityToken;\r\n            if (dataEntityToken == null) return false;\r\n\r\n            if (dataEntityToken.InterfaceType != this.InterfaceType) return false;\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            throw new NotImplementedException(\"This is prevented by validation\");\r\n            //if (typeof(ILocalizedControlled).IsAssignableFrom(this.InterfaceType))\r\n            //{\r\n            //    foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n            //    {\r\n            //        using (new DataScope(cultureInfo))\r\n            //        {\r\n            //            EntityToken entityToken = GetEntityTokensImpl();\r\n            //            if (entityToken != null)\r\n            //            {\r\n            //                yield return entityToken;\r\n            //            }\r\n            //        }\r\n            //    }\r\n            //}\r\n            //else\r\n            //{\r\n            //    yield return GetEntityTokensImpl();\r\n            //}            \r\n        }\r\n\r\n\r\n\r\n        private EntityToken GetEntityTokensImpl()\r\n        {\r\n            // Any data item will work, but if security is set on the first item, it will rule them alll......is this good?\r\n            // This is no problem for Simple elements, but huge problem for data elements and data folder elements.\r\n            // Should this be disallowed???\r\n            IData data = DataFacade.GetData(this.InterfaceType).ToDataEnumerable().FirstOrDefault();\r\n            if (data == null) return null;\r\n\r\n            return data.GetDataEntityToken();\r\n        }\r\n\r\n\r\n\r\n        public override void Log(string title, string indention)\r\n        {\r\n            LoggingService.LogVerbose(title, string.Format(\"{0}DataType: Position = {1}, Type = {2}\", indention, this.Position, this.InterfaceType));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/DataItemPossibleAttachmentPoint.cs",
    "content": "﻿using System;\r\nusing Composite.Data;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    internal sealed class DataItemPossibleAttachmentPoint : BasePossibleAttachmentPoint, IDataItemAttachmentPoint\r\n    {\r\n        public Type InterfaceType { get; set; }\r\n\r\n\r\n        public override bool IsPossibleAttachmentPoint(EntityToken parentEntityToken)\r\n        {\r\n            DataEntityToken dataEntityToken = parentEntityToken as DataEntityToken;\r\n            if (dataEntityToken == null) return false;\r\n\r\n            if (dataEntityToken.InterfaceType != this.InterfaceType) return false;\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n        public override void Log(string title, string indention = \"\")\r\n        {\r\n            LoggingService.LogVerbose(title, string.Format(\"{0}DataType: Position = {1}, InterfaceType = {2}\", indention, this.Position, this.InterfaceType));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/DynamicDataItemAttachmentPoint.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data.ProcessControlled;\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    /// <summary>\r\n    /// This class is used when the user adds trees dynamicly\r\n    /// Used as a dual with Composite.Data.Types.IDataItemTreeAttachmentPoint\r\n    /// </summary>    \r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [DebuggerDisplay(\"DynamicDataItemAttachmentPoint. Type = '{InterfaceType}', Key = '{KeyValue}'\")]\r\n    public sealed class DynamicDataItemAttachmentPoint : BaseAttachmentPoint, IDataItemAttachmentPoint\r\n    {\r\n        /// <exclude />\r\n        public Type InterfaceType { get; set; }\r\n\r\n        /// <exclude />\r\n        public object KeyValue { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool IsAttachmentPoint(EntityToken parentEntityToken)\r\n        {\r\n            DataEntityToken dataEntityToken = parentEntityToken as DataEntityToken;\r\n            if (dataEntityToken == null) return false;\r\n\r\n            if (dataEntityToken.InterfaceType != this.InterfaceType) return false;\r\n\r\n            // The data item has not been localized, so down attach the tree.\r\n            if (dataEntityToken.DataSourceId.LocaleScope.Equals(LocalizationScopeManager.CurrentLocalizationScope) == false) return false;\r\n\r\n            object keyValue = dataEntityToken.DataSourceId.GetKeyValue();\r\n\r\n            return object.Equals(keyValue, this.KeyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            if (typeof(ILocalizedControlled).IsAssignableFrom(this.InterfaceType))\r\n            {\r\n                foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n                {\r\n                    using (new DataScope(cultureInfo))\r\n                    {\r\n                        EntityToken entityToken = GetEntityTokensImpl();\r\n                        if (entityToken != null)\r\n                        {\r\n                            yield return entityToken;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                yield return GetEntityTokensImpl();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private EntityToken GetEntityTokensImpl()\r\n        {\r\n            IData data = DataFacade.TryGetDataVersionsByUniqueKey(this.InterfaceType, KeyValue).FirstOrDefault();\r\n            return data == null ? null : data.GetDataEntityToken();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void Log(string title, string indention = \"\")\r\n        {\r\n            Core.Log.LogVerbose(title, string.Format(\"{0}DynamicDataType: Position = {1}, Type = {2}, KeyValue = {3}\", indention, this.Position, this.InterfaceType, this.KeyValue));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/IAttachmentPoint.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IBaseAttachmentPoint\r\n    {\r\n        /// <exclude />\r\n        ElementAttachingProviderPosition Position { get; set; }\r\n\r\n        /// <exclude />\r\n        void Log(string title, string indention = \"\");\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IAttachmentPoint : IBaseAttachmentPoint\r\n    {\r\n        /// <exclude />\r\n        bool IsAttachmentPoint(EntityToken parentEntityToken);\r\n\r\n        /// <exclude />\r\n        IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/IDataItemAttachmentPoint.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IDataItemAttachmentPoint : IBaseAttachmentPoint\r\n    {\r\n        /// <exclude />\r\n        Type InterfaceType { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/INamedAttachmentPoint.cs",
    "content": "﻿using Composite.C1Console.Elements;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    internal interface INamedAttachmentPoint : IBaseAttachmentPoint\r\n    {\r\n        AttachingPoint AttachingPoint { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/IPossibleAttachmentPoint.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    internal interface IPossibleAttachmentPoint : IBaseAttachmentPoint\r\n    {\r\n        bool IsPossibleAttachmentPoint(EntityToken parentEntityToken);        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/AttachmentPoints/NamedAttachmentPoint.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.AttachmentPoints\r\n{\r\n    internal sealed class NamedAttachmentPoint : BaseAttachmentPoint, INamedAttachmentPoint\r\n    {\r\n        public AttachingPoint AttachingPoint { get; set; }\r\n\r\n\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext) \r\n        { \r\n            yield return this.AttachingPoint.EntityToken; \r\n        }\r\n\r\n\r\n        public override bool IsAttachmentPoint(EntityToken parentEntityToken)\r\n        {\r\n            return ElementAttachingPointFacade.IsAttachingPoint(parentEntityToken, this.AttachingPoint);\r\n        }\r\n\r\n\r\n        public override void Log(string title, string indention = \"\")\r\n        {\r\n            LoggingService.LogVerbose(title, string.Format(\"{0}Named: Position = {1}, Id = {2}, EntityTokenType = {3}, EntityToken = {4}\", indention, this.Position, this.AttachingPoint.Id, this.AttachingPoint.EntityTokenType, this.AttachingPoint.EntityToken));\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class EntityTokenAttachmentPoint : BaseAttachmentPoint\r\n    {\r\n        public EntityToken EntityToken { get; set; }\r\n\r\n\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            yield return this.EntityToken;\r\n        }\r\n\r\n\r\n        public override bool IsAttachmentPoint(EntityToken parentEntityToken)\r\n        {\r\n            return ElementAttachingPointFacade.IsAttachingPoint(parentEntityToken, this.EntityToken);\r\n        }\r\n\r\n\r\n        public override void Log(string title, string indention = \"\")\r\n        {\r\n            LoggingService.LogVerbose(title, string.Format(\"{0}EntityToken: Position = {1}, EntityToken = {2}\", indention, this.Position, this.EntityToken));\r\n        }\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/BuildProcessContext.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal sealed class BuildProcessContext\r\n    {\r\n        private int _nodeIdCounter;\r\n        private List<string> _usedIds = new List<string>();\r\n\r\n        public BuildProcessContext()\r\n        {\r\n            _nodeIdCounter = 0;\r\n            this.ActionIdCounter = 0;\r\n            this.FilterIdCounter = 0;\r\n        }\r\n\r\n        \r\n        public int ActionIdCounter;\r\n        public int FilterIdCounter;\r\n\r\n\r\n\r\n        public string CreateNewNodeId()\r\n        {\r\n            return string.Format(\"NodeAutoId_{0}\", _nodeIdCounter++);\r\n        }\r\n\r\n\r\n\r\n\r\n        public bool AlreadyUsed(string id)\r\n        {\r\n            return _usedIds.Contains(id);\r\n        }\r\n\r\n\r\n\r\n        public void AddUsedId(string id)\r\n        {\r\n            _usedIds.Add(id);\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<Type, List<TreeNode>> DataInteraceToTreeNodes = new Dictionary<Type, List<TreeNode>>();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/DateTimeFormater.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal sealed class DateTimeFormater\r\n    {\r\n        private readonly string _format;\r\n        private int _fieldCount;\r\n\r\n        private readonly string _yearFormat;\r\n        private readonly string _monthFormat;\r\n        private readonly string _dayFormat;\r\n        private readonly string _hourFormat;\r\n        private readonly string _minuteFormat;\r\n        private readonly string _secondFormat;\r\n\r\n        private static readonly IList<ConstructorInfo> Tuples_Constructors;\r\n        private static readonly IList<MethodInfo[]> Tuples_Members;\r\n\r\n        static DateTimeFormater()\r\n        {\r\n            var tupleTypes = new[]\r\n                {\r\n                    typeof (Tuple<int>),\r\n                    typeof (Tuple<int, int>),\r\n                    typeof (Tuple<int, int, int>),\r\n                    typeof (Tuple<int, int, int, int>),\r\n                    typeof (Tuple<int, int, int, int, int>),\r\n                    typeof (Tuple<int, int, int, int, int, int>)\r\n                };\r\n\r\n            Tuples_Constructors = new List<ConstructorInfo>();\r\n            Tuples_Members = new List<MethodInfo[]>();\r\n            for (int i = 0; i < tupleTypes.Length; i++)\r\n            {\r\n                var type = tupleTypes[i];\r\n\r\n                Tuples_Constructors.Add(type.GetConstructors().Single());\r\n                Tuples_Members.Add(type.GetProperties().Select(p => p.GetGetMethod()).ToArray());\r\n            }\r\n        }\r\n\r\n\r\n        public bool IsDateTimeGroupingValue(object value)\r\n        {\r\n            if (value == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            var type = value.GetType();\r\n            return type.FullName.StartsWith(typeof(Tuple).FullName) \r\n                && type.IsGenericType\r\n                && type.GetGenericArguments().All(a => a == typeof(int));\r\n        }\r\n\r\n\r\n        public DateTimeFormater(string format)\r\n        {\r\n            _format = format;\r\n\r\n            if (_format != null)\r\n            {\r\n                // The ordering yyyy, yyy, yy, y is important here. So for the others.\r\n                SetFormat(\"yyyy\", ref _yearFormat);\r\n                SetFormat(\"yyy\", ref _yearFormat);\r\n                SetFormat(\"yy\", ref _yearFormat);\r\n                SetFormat(\"y\", ref _yearFormat);\r\n\r\n                SetFormat(\"MMMM\", ref _monthFormat);\r\n                SetFormat(\"MMM\", ref _monthFormat);\r\n                SetFormat(\"MM\", ref _monthFormat);\r\n                SetFormat(\"M\", ref _monthFormat);\r\n\r\n                SetFormat(\"dddd\", ref _dayFormat);\r\n                SetFormat(\"ddd\", ref _dayFormat);\r\n                SetFormat(\"dd\", ref _dayFormat);\r\n                SetFormat(\"d\", ref _dayFormat);\r\n\r\n                SetFormat(\"hh\", ref _hourFormat);\r\n                SetFormat(\"h\", ref _hourFormat);\r\n\r\n                SetFormat(\"HH\", ref _hourFormat);\r\n                SetFormat(\"H\", ref _hourFormat);\r\n\r\n                SetFormat(\"mm\", ref _minuteFormat);\r\n                SetFormat(\"m\", ref _minuteFormat);\r\n\r\n                SetFormat(\"ss\", ref _secondFormat);\r\n                SetFormat(\"s\", ref _secondFormat);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string FormatLabel(object dateTimeValue)\r\n        {\r\n            DateTime dateTime = GetDateTime(dateTimeValue);\r\n\r\n            return dateTime.ToString(_format);\r\n        }\r\n\r\n\r\n\r\n        public string Serialize(object value)\r\n        {\r\n            if (!this.IsFormated)\r\n            {\r\n                TypeConverter typeConverter = TypeDescriptor.GetConverter(typeof(DateTime));\r\n                return typeConverter.ConvertToString(value);\r\n            }\r\n\r\n            string serializedValue = \"·\";\r\n\r\n            TupleIndexer tupleIndexer = new TupleIndexer(value);\r\n            int counter = 1;\r\n\r\n            if (this.HasYear)\r\n            {\r\n                serializedValue += tupleIndexer[counter++];\r\n            }\r\n            serializedValue += \",\";\r\n\r\n\r\n            if (this.HasMonth)\r\n            {\r\n                serializedValue += tupleIndexer[counter++];\r\n            }\r\n            serializedValue += \",\";\r\n\r\n\r\n            if (this.HasDay)\r\n            {\r\n                serializedValue += tupleIndexer[counter++];\r\n            }\r\n            serializedValue += \",\";\r\n\r\n\r\n            if (this.HasHour)\r\n            {\r\n                serializedValue += tupleIndexer[counter++];\r\n            }\r\n            serializedValue += \",\";\r\n\r\n\r\n            if (this.HasMinute)\r\n            {\r\n                serializedValue += tupleIndexer[counter++];\r\n            }\r\n            serializedValue += \",\";\r\n\r\n\r\n            if (this.HasSecond)\r\n            {\r\n                serializedValue += tupleIndexer[counter++];\r\n            }            \r\n\r\n\r\n            return serializedValue;\r\n        }\r\n\r\n\r\n        \r\n        public string SerializeDateTime(DateTime value)\r\n        {\r\n            string serializedValue = \"·\";\r\n\r\n            if (this.HasYear) serializedValue += value.Year.ToString();\r\n            serializedValue += \",\";\r\n\r\n            if (this.HasMonth) serializedValue += value.Month.ToString();\r\n            serializedValue += \",\";\r\n\r\n            if (this.HasDay) serializedValue += value.Day.ToString();\r\n            serializedValue += \",\";\r\n\r\n            if (this.HasHour) serializedValue += value.Hour.ToString();\r\n            serializedValue += \",\";\r\n\r\n            if (this.HasMinute) serializedValue += value.Millisecond.ToString();\r\n            serializedValue += \",\";\r\n\r\n            if (this.HasSecond) serializedValue += value.Second.ToString();\r\n\r\n            return serializedValue;\r\n        }\r\n\r\n\r\n\r\n        public static DateTime Deserialize(string serializedValue, DateTime? currentTime = null)\r\n        {\r\n            if (serializedValue.StartsWith(\"·\"))\r\n            {\r\n                serializedValue = serializedValue.Remove(1, 0);\r\n            }\r\n            else\r\n            {\r\n                TypeConverter typeConverter = TypeDescriptor.GetConverter(typeof(DateTime));\r\n                return (DateTime)typeConverter.ConvertFromString(serializedValue);\r\n            }\r\n\r\n            string[] values = serializedValue.Remove(0, 1).Split(',');\r\n            if (values.Length != 6) throw new InvalidOperationException(\"DateTimeFormat is of wrong format\");\r\n\r\n            int year = 2000, month = 1, day = 1, hour = 0, minute = 0, second = 0;\r\n            if (currentTime.HasValue)\r\n            {\r\n                year = currentTime.Value.Year;\r\n                month = currentTime.Value.Month;\r\n                day = currentTime.Value.Day;\r\n                hour = currentTime.Value.Hour;\r\n                minute = currentTime.Value.Minute;\r\n                second = currentTime.Value.Second;\r\n            }\r\n\r\n\r\n            if (values[0] != \"\") year = int.Parse(values[0]);\r\n            if (values[1] != \"\") month = int.Parse(values[1]);\r\n            if (values[2] != \"\") day = int.Parse(values[2]);\r\n            if (values[3] != \"\") hour = int.Parse(values[3]);\r\n            if (values[4] != \"\") minute = int.Parse(values[4]);\r\n            if (values[5] != \"\") second = int.Parse(values[5]);\r\n\r\n            return new DateTime(year, month, day, hour, minute, second);\r\n        }\r\n\r\n\r\n\r\n        public DateTime GetDateTime(object value)\r\n        {\r\n            if (this.IsFormated == false)\r\n            {\r\n                return (DateTime)value;\r\n            }\r\n\r\n            int year = 2000, month = 1, day = 1, hour = 0, minute = 0, second = 0;\r\n\r\n            TupleIndexer tupleIndexer = new TupleIndexer(value);\r\n            int counter = 1;\r\n\r\n            if (this.HasYear) year = tupleIndexer[counter++];\r\n            if (this.HasMonth) month = tupleIndexer[counter++];\r\n            if (this.HasDay) day = tupleIndexer[counter++];\r\n            if (this.HasHour) hour = tupleIndexer[counter++];\r\n            if (this.HasMinute) minute = tupleIndexer[counter++];\r\n            if (this.HasSecond) second = tupleIndexer[counter++];\r\n\r\n            return new DateTime(year, month, day, hour, minute, second);\r\n        }\r\n\r\n\r\n\r\n        public ConstructorInfo GetTupleConstructor()\r\n        {\r\n            ValidateFieldsCount();\r\n\r\n            return Tuples_Constructors[_fieldCount - 1];\r\n        }\r\n\r\n        public MethodInfo[] GetTupleMembers()\r\n        {\r\n            ValidateFieldsCount();\r\n\r\n            return Tuples_Members[_fieldCount - 1];\r\n        }\r\n\r\n\r\n        //public ConstructorInfo GetAnonymousTypeConstructor()\r\n        //{\r\n        //    ValidateFieldsCount();\r\n\r\n        //    return AnonymousTypes_Constructors[_fieldCount - 1];\r\n        //}\r\n\r\n        //public MethodInfo[] GetAnonymousTypeMembers()\r\n        //{\r\n        //    ValidateFieldsCount();\r\n\r\n        //    return AnonymousTypes_Members[_fieldCount - 1];\r\n        //}\r\n\r\n        private void ValidateFieldsCount()\r\n        {\r\n            Verify.That(_fieldCount > 0, \"Amount of fields should be positive\");\r\n            Verify.That(_fieldCount < Tuples_Constructors.Count, \"To many fields specified: {0}\", _fieldCount);\r\n        }\r\n\r\n        public bool IsFormated => _format != null;\r\n\r\n\r\n        public bool HasYear => _yearFormat != null;\r\n\r\n\r\n        public bool HasMonth => _monthFormat != null;\r\n\r\n\r\n        public bool HasDay => _dayFormat != null;\r\n\r\n\r\n        public bool HasHour => _hourFormat != null;\r\n\r\n\r\n        public bool HasMinute => _minuteFormat != null;\r\n\r\n\r\n        public bool HasSecond => _secondFormat != null;\r\n\r\n\r\n        private void SetFormat(string pattern, ref string format)\r\n        {\r\n            if (_format.Contains(pattern) && format == null)\r\n            {\r\n                format = pattern;\r\n                _fieldCount++;\r\n            }\r\n        }\r\n\r\n        public static PropertyInfo DateTime_Year = typeof(DateTime).GetProperty(nameof(DateTime.Year));\r\n        public static PropertyInfo DateTime_Month = typeof(DateTime).GetProperty(nameof(DateTime.Month));\r\n        public static PropertyInfo DateTime_Day = typeof(DateTime).GetProperty(nameof(DateTime.Day));\r\n        public static PropertyInfo DateTime_Hour = typeof(DateTime).GetProperty(nameof(DateTime.Hour));\r\n        public static PropertyInfo DateTime_Minute = typeof(DateTime).GetProperty(nameof(DateTime.Minute));\r\n        public static PropertyInfo DateTime_Second = typeof(DateTime).GetProperty(nameof(DateTime.Second));\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FactoryHelper.cs",
    "content": "﻿using System;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal static class FactoryHelper\r\n    {\r\n        internal static ResourceHandle GetIcon(string name)\r\n        {\r\n            if (name.Contains(\",\") == false)\r\n            {\r\n                return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n            }\r\n\r\n            throw new NotImplementedException();\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FilterNodeCreatorFactory.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n\tinternal static class FilterNodeCreatorFactory\r\n\t{\r\n        public static FilterNode CreateFilterNode(XElement filterElement, Tree tree)\r\n        {\r\n            if (filterElement.Name == TreeMarkupConstants.Namespace + \"ParentIdFilter\")\r\n            {\r\n                XAttribute parentTypeAttribute = filterElement.Attribute(\"ParentType\");\r\n                XAttribute referenceFieldNameAttribute = filterElement.Attribute(\"ReferenceFieldName\");\r\n\r\n                if (parentTypeAttribute == null)\r\n                {\r\n                    tree.AddValidationError(filterElement.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"ParentType\");\r\n                    return null;\r\n                }\r\n\r\n                if (referenceFieldNameAttribute == null)\r\n                {\r\n                    tree.AddValidationError(filterElement.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"ReferenceFieldName\");\r\n                    return null;\r\n                }                \r\n                \r\n\r\n                Type parentInterfaceType = TypeManager.TryGetType(parentTypeAttribute.Value);\r\n                if (parentInterfaceType == null)\r\n                {\r\n                    tree.AddValidationError(filterElement.GetXPath(), \"TreeValidationError.Common.UnknownInterfaceType\", parentTypeAttribute.Value);\r\n                    return null;\r\n                }\r\n\r\n                return new ParentIdFilterNode\r\n                {\r\n                    XPath = filterElement.GetXPath(),\r\n                    Id = tree.BuildProcessContext.FilterIdCounter++,\r\n                    ParentFilterType = parentInterfaceType,\r\n                    ReferenceFieldName = referenceFieldNameAttribute.Value\r\n                };\r\n            }\r\n\r\n            if (filterElement.Name == TreeMarkupConstants.Namespace + \"FieldFilter\")\r\n            {\r\n                XAttribute fieldNameAttribute = filterElement.Attribute(\"FieldName\");\r\n                XAttribute fieldValueAttribute = filterElement.Attribute(\"FieldValue\");\r\n                XAttribute operatorValueAttribute = filterElement.Attribute(\"Operator\");\r\n\r\n                if (fieldNameAttribute == null)\r\n                {\r\n                    tree.AddValidationError(filterElement.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"FieldName\");\r\n                    return null;\r\n                }\r\n\r\n                if (fieldValueAttribute == null)\r\n                {\r\n                    tree.AddValidationError(filterElement.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"FieldValue\");\r\n                    return null;\r\n                }\r\n\r\n                FieldFilterNodeOperator filterOperator;\r\n                string operatorValue = operatorValueAttribute.GetValueOrDefault(\"equal\");\r\n                switch (operatorValue)\r\n                {\r\n                    case \"equal\":\r\n                        filterOperator = FieldFilterNodeOperator.Equal;\r\n                        break;\r\n\r\n                    case \"inequal\":\r\n                        filterOperator = FieldFilterNodeOperator.Inequal;\r\n                        break;\r\n\r\n                    case \"lesser\":\r\n                        filterOperator = FieldFilterNodeOperator.Lesser;\r\n                        break;\r\n\r\n                    case \"greater\":\r\n                        filterOperator = FieldFilterNodeOperator.Greater;\r\n                        break;\r\n\r\n                    case \"lesserequal\":\r\n                        filterOperator = FieldFilterNodeOperator.LesserEqual;\r\n                        break;\r\n\r\n                    case \"greaterequal\":\r\n                        filterOperator = FieldFilterNodeOperator.GreaterEqual;\r\n                        break;\r\n\r\n                    default:                        \r\n                        tree.AddValidationError(filterElement.GetXPath(), \"TreeValidationError.FieldFilter.UnknownOperatorName\", operatorValue);\r\n                        return null;\r\n                }\r\n\r\n                return new FieldFilterNode\r\n                {\r\n                    XPath = filterElement.GetXPath(),\r\n                    Id = tree.BuildProcessContext.FilterIdCounter++,\r\n                    FieldName = fieldNameAttribute.Value,\r\n                    FieldValue = fieldValueAttribute.Value,\r\n                    Operator = filterOperator\r\n                };\r\n            }\r\n\r\n            if (filterElement.Name == TreeMarkupConstants.Namespace + \"FunctionFilter\")\r\n            {\r\n                XElement functionMarkupElement = filterElement.Element((XNamespace)FunctionTreeConfigurationNames.NamespaceName + FunctionTreeConfigurationNames.FunctionTagName);\r\n\r\n                if (functionMarkupElement == null)\r\n                {\r\n                    tree.AddValidationError(filterElement.GetXPath(), \"TreeValidationError.FunctionFilter.MissingFunctionMarkup\");\r\n                    return null;\r\n                }\r\n\r\n                return new FunctionFilterNode()\r\n                {\r\n                    XPath = filterElement.GetXPath(),\r\n                    Id = tree.BuildProcessContext.FilterIdCounter++,\r\n                    FunctionMarkup = functionMarkupElement\r\n                };\r\n            }\r\n\r\n            throw new NotImplementedException(\"ValidationError\");\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/BaseFolderRanges.cs",
    "content": "﻿using System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    internal abstract class BaseFolderRanges : IFolderRanges\r\n    {\r\n        private List<IFolderRange> _folderRanges = new List<IFolderRange>();\r\n\r\n\r\n\r\n        public void AddFolderRange(IFolderRange folderRange)\r\n        {\r\n            _folderRanges.Add(folderRange);\r\n        }\r\n\r\n\r\n\r\n        public abstract Expression CreateContainsListSelectBodyExpression(Expression fieldExpression, ParameterExpression parameterExpression);\r\n\r\n\r\n        public abstract Expression CreateFilterExpression(int folderRangeIndex, Expression fieldExpression);\r\n\r\n\r\n\r\n        public IEnumerable<IFolderRange> Ranges\r\n        {\r\n            get\r\n            {\r\n                foreach (IFolderRange folderRange in _folderRanges)\r\n                {\r\n                    yield return folderRange;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected IFolderRange GetFolderRange(int index)\r\n        {\r\n            return _folderRanges.Where(f => f.Index == index).Single();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/FolderRangesCreator.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    internal static class FolderRangesCreator\r\n    {\r\n        public static IFolderRanges Create(TreeNode ownerTreeNode, string rangeString, string fieldName, Type propertyType)\r\n        {\r\n            string[] rangesSplit = rangeString.Split(',');\r\n\r\n            bool includeWildCard = false;\r\n            List<string> rangeStrings = new List<string>();\r\n            foreach (string rangeSplit in rangesSplit)\r\n            {\r\n                string range = rangeSplit.Trim();\r\n\r\n                if (range != \"*\")\r\n                {\r\n                    rangeStrings.Add(range);\r\n                }\r\n                else\r\n                {\r\n                    includeWildCard = true;\r\n                }\r\n            }\r\n            \r\n\r\n            if (rangeStrings.Count == 0)\r\n            {\r\n                ownerTreeNode.AddValidationError(\"TreeValidationError.Range.WrongFormat\");\r\n                return null;\r\n            }\r\n\r\n            List<Tuple<string, string>> ranges = new List<Tuple<string, string>>();\r\n            if (rangeStrings.Count == 1)\r\n            {\r\n                Tuple<string, string> range = ValidateRange(rangeStrings[0], allowMinOpenEnded: true, allowMaxOpenEnded: true);\r\n                if (range == null)\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Range.WrongFormat\");\r\n                    return null;\r\n                }\r\n\r\n                ranges.Add(range);\r\n            }\r\n            else if (rangeStrings.Count > 1)\r\n            {\r\n                string firstString = rangeStrings[0];\r\n                string lastString = rangeStrings[rangeStrings.Count - 1];\r\n\r\n                Tuple<string, string> firstRange = ValidateRange(firstString, allowMinOpenEnded: true);\r\n                Tuple<string, string> lastRange = ValidateRange(lastString, allowMaxOpenEnded: true);\r\n                if ((firstRange == null) || (lastRange == null))\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Range.WrongFormat\");\r\n                    return null;\r\n                }\r\n\r\n                ranges.Add(firstRange);\r\n                \r\n                for (int i = 1; i <= rangeStrings.Count - 2; i++)\r\n                {\r\n                    Tuple<string, string> range = ValidateRange(rangeStrings[i]);\r\n                    if (range == null)\r\n                    {\r\n                        ownerTreeNode.AddValidationError(\"TreeValidationError.Range.WrongFormat\");\r\n                        return null;\r\n                    }\r\n\r\n                    ranges.Add(range);\r\n                }\r\n\r\n                ranges.Add(lastRange);\r\n            }\r\n\r\n\r\n            if (propertyType == typeof(int))\r\n            {\r\n                return FolderRangesFactory.CreateIntFolderRangeIterator(ownerTreeNode, ranges, includeWildCard);\r\n            }\r\n            else if (propertyType == typeof(string))\r\n            {\r\n                return FolderRangesFactory.CreateStringFolderRanges(ownerTreeNode, ranges, includeWildCard);\r\n            }\r\n            else\r\n            {\r\n                ownerTreeNode.AddValidationError(\"TreeValidationError.Range.UnsupportedType\", fieldName, propertyType);\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n        private static Tuple<string, string> ValidateRange(string range, bool allowMinOpenEnded = false, bool allowMaxOpenEnded = false)\r\n        {\r\n            string[] str = range.Split('>');\r\n\r\n            if (str.Length != 2) return null;\r\n\r\n            if ((str[0] == \"\") && (str[1] == \"\")) return null;\r\n\r\n            if ((str[0] == \"\") && (allowMinOpenEnded == false)) return null;\r\n            if ((str[1] == \"\") && (allowMaxOpenEnded == false)) return null;\r\n\r\n            return new Tuple<string, string>(str[0], str[1]);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/FolderRangesFactory.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    internal static class FolderRangesFactory\r\n    {\r\n        public static IFolderRanges CreateIntFolderRangeIterator(TreeNode ownerTreeNode, List<Tuple<string, string>> ranges, bool includeWildCard)\r\n        {\r\n            IntFolderRanges folderRanges = new IntFolderRanges();\r\n\r\n            int counter = 0;\r\n            int? lastMaxValue = null;\r\n            foreach (Tuple<string, string> range in ranges)\r\n            {\r\n                int minValue = 0;\r\n                int maxValue = 0;\r\n                bool isMinOpenEnded = range.Item1 == \"\";\r\n                bool isMaxOpenEnded = range.Item2 == \"\";\r\n\r\n                if ((range.Item1 != \"\") && (int.TryParse(range.Item1, out minValue) == false))\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Range.WrongFormat\");\r\n                    return null;\r\n                }\r\n\r\n                if ((range.Item2 != \"\") && (int.TryParse(range.Item2, out maxValue) == false))\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Range.WrongFormat\");\r\n                    return null;\r\n                }\r\n\r\n                if ((isMinOpenEnded == false) && (isMaxOpenEnded == false) && (minValue >= maxValue))\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Range.MinMaxError\", minValue, maxValue);                    \r\n                    return null;\r\n                }\r\n                \r\n                if (lastMaxValue.HasValue == false)\r\n                {\r\n                    lastMaxValue = maxValue;\r\n                }\r\n                else if (lastMaxValue.Value >= minValue)\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Range.NextRangeError\");\r\n                }\r\n\r\n\r\n                IntFolderRange folderRange = new IntFolderRange(\r\n                    counter++,\r\n                    minValue,\r\n                    maxValue,\r\n                    isMinOpenEnded,\r\n                    isMaxOpenEnded\r\n                );\r\n\r\n                folderRanges.AddFolderRange(folderRange);\r\n            }\r\n\r\n            if (includeWildCard)\r\n            {\r\n                IntFolderRange folderRange = new IntFolderRange(\r\n                    -1,\r\n                    0,\r\n                    0,\r\n                    false,\r\n                    false\r\n                );\r\n\r\n                folderRanges.AddFolderRange(folderRange);\r\n            }            \r\n\r\n            return folderRanges;\r\n        }\r\n\r\n\r\n        public static IFolderRanges CreateStringFolderRanges(TreeNode ownerTreeNode, List<Tuple<string, string>> ranges, bool includeWildCard)\r\n        {\r\n            StringFolderRanges folderRanges = new StringFolderRanges();\r\n\r\n            int counter = 0;\r\n            string lastMaxValue = null;\r\n            foreach (Tuple<string, string> range in ranges)\r\n            {\r\n                string minValue = \"\";\r\n                string maxValue = \"\";\r\n                bool isMinOpenEnded = range.Item1 == \"\";\r\n                bool isMaxOpenEnded = range.Item2 == \"\";\r\n\r\n                if (range.Item1 != \"\")\r\n                {\r\n                    if (range.Item1.Length != 1)\r\n                    {\r\n                        ownerTreeNode.AddValidationError(\"TreeValidationError.Range.WrongFormat\");\r\n                        return null;\r\n                    }\r\n                    else\r\n                    {                        \r\n                        minValue = range.Item1;\r\n                    }\r\n                }\r\n\r\n                if (range.Item2 != \"\")\r\n                {\r\n                    if (range.Item2.Length != 1)\r\n                    {\r\n                        ownerTreeNode.AddValidationError(\"TreeValidationError.Range.WrongFormat\");\r\n                        return null;\r\n                    }\r\n                    else\r\n                    {                        \r\n                        maxValue = range.Item2;\r\n                    }\r\n                }\r\n\r\n\r\n                if ((isMinOpenEnded == false) && (isMaxOpenEnded == false) && (string.Compare(minValue, maxValue) >= 0))\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Range.MinMaxError\", minValue, maxValue);\r\n                    return null;\r\n                }\r\n\r\n                if (lastMaxValue == null)\r\n                {\r\n                    lastMaxValue = maxValue;\r\n                }\r\n                else if (string.Compare(lastMaxValue, minValue) >= 0)\r\n                {\r\n                    ownerTreeNode.AddValidationError(\"TreeValidationError.Range.NextRangeError\");\r\n                }\r\n\r\n\r\n                StringFolderRange folderRange = new StringFolderRange(\r\n                    counter++,\r\n                    minValue,\r\n                    maxValue,\r\n                    isMinOpenEnded,\r\n                    isMaxOpenEnded\r\n                );\r\n\r\n                folderRanges.AddFolderRange(folderRange);\r\n            }\r\n\r\n            if (includeWildCard)\r\n            {\r\n                StringFolderRange folderRange = new StringFolderRange(\r\n                    -1,\r\n                    \"\",\r\n                    \"\",\r\n                    false,\r\n                    false\r\n                );\r\n\r\n                folderRanges.AddFolderRange(folderRange);\r\n            }\r\n\r\n            return folderRanges;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/IFolderRange.cs",
    "content": "﻿using System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    internal interface IFolderRange\r\n    {\r\n        /// <summary>\r\n        /// Indexed from 0 and up, -1 is wildcard/other\r\n        /// </summary>\r\n        int Index { get; }\r\n\r\n        object MinValue { get; }\r\n        object MaxValue { get; }\r\n\r\n        bool IsMinOpenEnded { get; }\r\n        bool IsMaxOpenEnded { get; }\r\n\r\n        string Label { get; }\r\n\r\n        object DefaultValue { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/IFolderRanges.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    internal interface IFolderRanges\r\n    {\r\n        /// <summary>\r\n        /// This is called by DataFolderElementsTreeNode when finding folders\r\n        /// </summary>\r\n        /// <param name=\"fieldExpression\"></param>\r\n        /// <param name=\"parameterExpression\"></param>\r\n        /// <returns>\r\n        /// This should return an expression that gives a list of bools foreach folder range\r\n        /// whether folder range is containing data or not.\r\n        /// </returns>\r\n        Expression CreateContainsListSelectBodyExpression(Expression fieldExpression, ParameterExpression parameterExpression);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is called by DataFolderElementsTreeNode when finding children to a folder element\r\n        /// </summary>\r\n        /// <returns>\r\n        /// This should return an expression that filters so that only children of the given folder\r\n        /// element is return.\r\n        /// </returns>\r\n        Expression CreateFilterExpression(int folderRangeIndex, Expression fieldExpression);\r\n\r\n\r\n\r\n        IEnumerable<IFolderRange> Ranges { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/IntFolderRange.cs",
    "content": "﻿using System.Diagnostics;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    [DebuggerDisplay(\"{Index} : ({MinValue}-{MaxValue}) : {Label}\")]\r\n    internal sealed class IntFolderRange : IFolderRange\r\n    {\r\n        private int _index;\r\n        private int _minValue;\r\n        private int _maxValue;\r\n        private bool _isMinOpenEnded;\r\n        private bool _isMaxOpenEnded;\r\n\r\n\r\n\r\n        public IntFolderRange(int index, int minValue, int maxValue, bool isMinOpenEnded, bool isMaxOpenEnded)\r\n        {\r\n            _index = index;\r\n            _minValue = minValue;\r\n            _maxValue = maxValue;\r\n            _isMinOpenEnded = isMinOpenEnded;\r\n            _isMaxOpenEnded = isMaxOpenEnded;\r\n        }\r\n\r\n\r\n\r\n        public int Index\r\n        {\r\n            get { return _index; }\r\n        }\r\n\r\n\r\n\r\n        public object MinValue\r\n        {\r\n            get { return _minValue; }\r\n        }\r\n\r\n\r\n\r\n        public object MaxValue\r\n        {\r\n            get { return _maxValue; }\r\n        }\r\n\r\n\r\n\r\n        public bool IsMinOpenEnded\r\n        {\r\n            get { return _isMinOpenEnded; }\r\n        }\r\n\r\n\r\n\r\n        public bool IsMaxOpenEnded\r\n        {\r\n            get { return _isMaxOpenEnded; }\r\n        }\r\n\r\n\r\n\r\n        public string Label\r\n        {\r\n            get\r\n            {\r\n                if (this.Index == -1)\r\n                {\r\n                    return StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeRanges.IntRange.Other\");\r\n                }\r\n                else if (this.IsMinOpenEnded)\r\n                {\r\n                    return string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeRanges.IntRange.MinOpenEnded\"), this.MaxValue);\r\n                }\r\n                else if (this.IsMaxOpenEnded)\r\n                {\r\n                    return string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeRanges.IntRange.MaxOpenEnded\"), this.MinValue);\r\n                }\r\n                else\r\n                {\r\n                    return string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeRanges.IntRange.Closed\"), this.MinValue, this.MaxValue);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public object DefaultValue\r\n        {\r\n            get\r\n            {\r\n                return 0;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/IntFolderRanges.cs",
    "content": "﻿using System.Linq;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    internal sealed class IntFolderRanges : BaseFolderRanges\r\n    {\r\n        public override Expression CreateContainsListSelectBodyExpression(Expression fieldExpression, ParameterExpression parameterExpression)\r\n        {\r\n            Expression currentExpression = null;\r\n\r\n            foreach (IFolderRange folderRange in this.Ranges)\r\n            {\r\n                int minValue = (int)folderRange.MinValue;\r\n                int maxValue = (int)folderRange.MaxValue;\r\n\r\n\r\n                if (currentExpression == null)\r\n                {\r\n                    currentExpression = Expression.Constant(-1);\r\n                }\r\n\r\n                Expression minExpression = Expression.GreaterThanOrEqual(\r\n                    fieldExpression,\r\n                    Expression.Constant(minValue)\r\n                );\r\n\r\n                Expression maxExpression = Expression.LessThanOrEqual(\r\n                    fieldExpression,\r\n                    Expression.Constant(maxValue)\r\n                );\r\n\r\n                if (folderRange.IsMinOpenEnded)\r\n                {\r\n                    currentExpression = Expression.Condition(\r\n                        maxExpression,\r\n                        Expression.Constant(folderRange.Index),\r\n                        currentExpression\r\n                    );\r\n                }\r\n                else if (folderRange.IsMaxOpenEnded)\r\n                {\r\n                    currentExpression = Expression.Condition(\r\n                        minExpression,\r\n                        Expression.Constant(folderRange.Index),\r\n                        currentExpression\r\n                    );\r\n                }\r\n                else\r\n                {\r\n                    currentExpression = Expression.Condition(\r\n                        Expression.AndAlso(\r\n                            minExpression,\r\n                            maxExpression\r\n                        ),\r\n                        Expression.Constant(folderRange.Index),\r\n                        currentExpression\r\n                    );\r\n                }\r\n            }\r\n\r\n            return currentExpression;\r\n        }\r\n\r\n\r\n\r\n        public override Expression CreateFilterExpression(int folderRangeIndex, Expression fieldExpression)\r\n        {\r\n            if (folderRangeIndex != -1)\r\n            {\r\n                IFolderRange folderRange = this.GetFolderRange(folderRangeIndex);\r\n\r\n                int minValue = (int)folderRange.MinValue;\r\n                int maxValue = (int)folderRange.MaxValue;\r\n\r\n                Expression minExpression = Expression.GreaterThanOrEqual(\r\n                    fieldExpression,\r\n                    Expression.Constant(minValue)\r\n                );\r\n\r\n                Expression maxExpression = Expression.LessThanOrEqual(\r\n                    fieldExpression,\r\n                    Expression.Constant(maxValue)\r\n                );\r\n\r\n                Expression expression;\r\n                if (folderRange.IsMinOpenEnded)\r\n                {\r\n                    expression = maxExpression;\r\n                }\r\n                else if (folderRange.IsMaxOpenEnded)\r\n                {\r\n                    expression = minExpression;\r\n                }\r\n                else\r\n                {\r\n                    expression = Expression.And(minExpression, maxExpression);\r\n                }\r\n\r\n                return expression;\r\n            }\r\n            else\r\n            {\r\n                Expression currentExpression = null;\r\n                foreach (IFolderRange folderRange in this.Ranges.Where(f => f.Index != -1))\r\n                {\r\n                    int minValue = (int)folderRange.MinValue;\r\n                    int maxValue = (int)folderRange.MaxValue;\r\n\r\n                    Expression minExpression = Expression.GreaterThanOrEqual(\r\n                        fieldExpression,\r\n                        Expression.Constant(minValue)\r\n                    );\r\n\r\n                    Expression maxExpression = Expression.LessThanOrEqual(\r\n                        fieldExpression,\r\n                        Expression.Constant(maxValue)\r\n                    );\r\n\r\n                    if (folderRange.IsMinOpenEnded)\r\n                    {\r\n                        currentExpression = currentExpression.NestedAnd(Expression.Not(maxExpression));\r\n                    }\r\n                    else if (folderRange.IsMaxOpenEnded)\r\n                    {\r\n                        currentExpression = currentExpression.NestedAnd(Expression.Not(minExpression));\r\n                    }\r\n                    else\r\n                    {\r\n                        currentExpression = currentExpression.NestedAnd(\r\n                            Expression.Not(\r\n                                Expression.And(\r\n                                    minExpression,\r\n                                    maxExpression\r\n                                )\r\n                            )\r\n                        );\r\n                    }\r\n                }\r\n\r\n                return currentExpression;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/StringFolderRange.cs",
    "content": "﻿using System.Diagnostics;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    [DebuggerDisplay(\"{Index} : ({MinValue}-{MaxValue}) : {Label}\")]\r\n    internal sealed class StringFolderRange : IFolderRange\r\n    {\r\n        private int _index;\r\n        private string _minValue;\r\n        private string _maxValue;\r\n        private bool _isMinOpenEnded;\r\n        private bool _isMaxOpenEnded;\r\n\r\n\r\n        public StringFolderRange(int index, string minValue, string maxValue, bool isMinOpenEnded, bool isMaxOpenEnded)\r\n        {\r\n            _index = index;\r\n            _minValue = minValue;\r\n            _maxValue = maxValue;\r\n            _isMinOpenEnded = isMinOpenEnded;\r\n            _isMaxOpenEnded = isMaxOpenEnded;\r\n        }\r\n\r\n\r\n\r\n        public int Index\r\n        {\r\n            get { return _index; }\r\n        }\r\n\r\n\r\n\r\n        public object MinValue\r\n        {\r\n            get { return _minValue; }\r\n        }\r\n\r\n\r\n\r\n        public object MaxValue\r\n        {\r\n            get { return _maxValue; }\r\n        }\r\n\r\n\r\n\r\n        public bool IsMinOpenEnded\r\n        {\r\n            get { return _isMinOpenEnded; }\r\n        }\r\n\r\n\r\n\r\n        public bool IsMaxOpenEnded\r\n        {\r\n            get { return _isMaxOpenEnded; }\r\n        }\r\n\r\n\r\n\r\n        public string Label\r\n        {\r\n            get\r\n            {\r\n                if (this.Index == -1)\r\n                {\r\n                    return StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeRanges.StringRange.Other\");\r\n                }\r\n                else if (this.IsMinOpenEnded)\r\n                {\r\n                    return string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeRanges.StringRange.MinOpenEnded\"), this.MaxValue);\r\n                }\r\n                else if (this.IsMaxOpenEnded)\r\n                {\r\n                    return string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeRanges.StringRange.MaxOpenEnded\"), this.MinValue);\r\n                }\r\n                else \r\n                {\r\n                    return string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeRanges.StringRange.Closed\"), this.MinValue, this.MaxValue);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public object DefaultValue\r\n        {\r\n            get\r\n            {\r\n                return \"\";\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/FolderRanges/StringFolderRanges.cs",
    "content": "﻿using System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation.FolderRanges\r\n{\r\n    internal sealed class StringFolderRanges : BaseFolderRanges\r\n    {\r\n        private readonly MethodInfo StringCompare_MethodInfo = typeof(string).GetMethods().First(f => f.Name == \"Compare\");\r\n        private readonly MethodInfo StringToUpper_MethodInfo = typeof(string).GetMethods().First(f => f.Name == \"ToUpper\");\r\n        private readonly MethodInfo StringStartsWith_MethodInfo = typeof(string).GetMethods().First(f => f.Name == \"StartsWith\");\r\n\r\n\r\n        public override Expression CreateContainsListSelectBodyExpression(Expression fieldExpression, ParameterExpression parameterExpression)\r\n        {\r\n            Expression currentExpression = null;\r\n\r\n            foreach (IFolderRange folderRange in this.Ranges)\r\n            {\r\n                string minValue = GetMinValue(folderRange);\r\n                string maxValue = GetMaxValue(folderRange);\r\n\r\n                if (currentExpression == null)\r\n                {\r\n                    currentExpression = Expression.Constant(-1);\r\n                }\r\n\r\n                var fieldToUpper = Expression.Call(fieldExpression, this.StringToUpper_MethodInfo);\r\n\r\n                currentExpression = Expression.Condition(\r\n                    Expression.AndAlso(\r\n                        Expression.NotEqual(\r\n                            fieldExpression,\r\n                            Expression.Constant(null, typeof(string))\r\n                        ),\r\n                        Expression.AndAlso(\r\n                            Expression.GreaterThanOrEqual(\r\n                                Expression.Call(\r\n                                    this.StringCompare_MethodInfo,\r\n                                    fieldToUpper,\r\n                                    Expression.Constant(minValue.ToUpperInvariant())\r\n                                ),\r\n                                Expression.Constant(0)\r\n                            ),\r\n                            Expression.OrElse(\r\n                                Expression.LessThanOrEqual(\r\n                                    Expression.Call(\r\n                                        this.StringCompare_MethodInfo,\r\n                                        fieldToUpper,\r\n                                        Expression.Constant(maxValue.ToUpperInvariant())\r\n                                    ),\r\n                                    Expression.Constant(0)\r\n                                ),\r\n                                Expression.Call(fieldToUpper, StringStartsWith_MethodInfo, Expression.Constant(maxValue.ToUpperInvariant()))\r\n                            )\r\n                            \r\n                        )\r\n                    ),\r\n                    Expression.Constant(folderRange.Index),\r\n                    currentExpression\r\n                );\r\n            }\r\n\r\n            return currentExpression;\r\n        }\r\n\r\n\r\n\r\n        public override Expression CreateFilterExpression(int folderRangeIndex, Expression fieldExpression)\r\n        {\r\n            if (folderRangeIndex != -1)\r\n            {\r\n                IFolderRange folderRange = this.GetFolderRange(folderRangeIndex);\r\n\r\n                return CreateFolderRangeExpression(folderRange, fieldExpression);\r\n            }\r\n            \r\n            Expression currentExpression = null;\r\n            foreach (IFolderRange folderRange in this.Ranges.Where(f => f.Index != -1))\r\n            {\r\n                Expression expression = CreateFolderRangeExpression(folderRange, fieldExpression);\r\n\r\n                expression = Expression.Not(expression);\r\n\r\n                currentExpression = currentExpression.NestedAnd(expression);\r\n            }\r\n\r\n            return currentExpression;\r\n        }\r\n\r\n\r\n\r\n        private Expression CreateFolderRangeExpression(IFolderRange folderRange, Expression fieldExpression)\r\n        {\r\n            string minValue = GetMinValue(folderRange);\r\n            string maxValue = GetMaxValue(folderRange);\r\n\r\n            var fieldToUpper = Expression.Call(fieldExpression, this.StringToUpper_MethodInfo);\r\n\r\n            Expression expression = Expression.AndAlso(\r\n                Expression.NotEqual(\r\n                    fieldExpression,\r\n                    Expression.Constant(null, typeof(string))\r\n                ),\r\n                Expression.AndAlso(\r\n                    Expression.GreaterThanOrEqual(\r\n                        Expression.Call(\r\n                            this.StringCompare_MethodInfo,\r\n                            fieldToUpper,\r\n                            Expression.Constant(minValue.ToUpperInvariant())\r\n                        ),\r\n                        Expression.Constant(0)\r\n                    ),\r\n\r\n                    Expression.OrElse(\r\n                        Expression.LessThanOrEqual(\r\n                            Expression.Call(\r\n                                this.StringCompare_MethodInfo,\r\n                                fieldToUpper,\r\n                                Expression.Constant(maxValue.ToUpperInvariant())\r\n                            ),\r\n                            Expression.Constant(0)\r\n                        ),\r\n\r\n                        Expression.Call(fieldToUpper, StringStartsWith_MethodInfo, Expression.Constant(maxValue.ToUpperInvariant()))\r\n                    )\r\n                    \r\n                )\r\n            );\r\n\r\n            return expression;\r\n        }\r\n\r\n\r\n\r\n        private static string GetMinValue(IFolderRange folderRange)\r\n        {\r\n            if (folderRange.IsMinOpenEnded)\r\n            {\r\n                return \"\" + (char.MinValue + 1) + (char.MinValue + 1) + (char.MinValue + 1);\r\n            }\r\n\r\n            return (string) folderRange.MinValue;\r\n        }\r\n\r\n\r\n        private static string GetMaxValue(IFolderRange folderRange)\r\n        {\r\n            if (folderRange.IsMaxOpenEnded)\r\n            {\r\n                return \"\" + char.MaxValue + char.MaxValue + char.MaxValue;\r\n            }\r\n\r\n            return (string) folderRange.MaxValue;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/OrderByNodeCreatorFactory.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal static class OrderByNodeCreatorFactory\r\n    {\r\n        public static OrderByNode CreateOrderByNode(XElement element, Tree tree)\r\n        {\r\n            if (element.Name == TreeMarkupConstants.Namespace + \"Field\")\r\n            {\r\n                XAttribute nameAttribute = element.Attribute(\"FieldName\");\r\n                XAttribute directionAttribute = element.Attribute(\"Direction\");\r\n\r\n                if (nameAttribute == null)\r\n                {\r\n                    tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"FieldName\");\r\n                    return null;\r\n                }\r\n\r\n                return new FieldOrderByNode\r\n                {\r\n                    XPath = element.GetXPath(),\r\n                    FieldName = nameAttribute.Value,                    \r\n                    Direction = directionAttribute.GetValueOrDefault(\"ascending\")\r\n                };\r\n            }\r\n            else\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"OrderBy node {0} not supported\", element.Name));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/StringConstants.cs",
    "content": "﻿\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal static class StringConstants\r\n    {\r\n        public const string RootNodeId = \"RootTreeNode\";\r\n        public const string PiggybagTreeId = \"TreeId\";\r\n        public const string PiggybagSharedTreeId = \"SharedTreeId_\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/TreeBuilder.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Schema;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal static class TreeBuilder\r\n    {\r\n        public static Tree BuildTree(string treeId, XDocument document)\r\n        {            \r\n            Tree tree = new Tree(treeId);\r\n            tree.BuildProcessContext = new BuildProcessContext();\r\n            tree.BuildResult = new BuildResult();\r\n\r\n            if (ValidateMarkup(tree, document) == false) return tree;\r\n\r\n            try\r\n            {\r\n                BuildAutoAttachmentPoints(tree, document);\r\n                BuildAllowedAttachmentPoints(tree, document);\r\n\r\n                XElement elementRootElement = document.Descendants(TreeMarkupConstants.Namespace + \"ElementRoot\").Single();\r\n                tree.RootTreeNode = BuildInnerTree(elementRootElement, null, tree);\r\n\r\n                if ((tree.AttachmentPoints.OfType<DataItemAttachmentPoint>().Any()) &&\r\n                    (tree.RootTreeNode.ChildNodes.Any()))\r\n                {\r\n                    // Only simple tree nodes allowed if data item attaching is done\r\n                    tree.AddValidationError(\"\", \"TreeValidationError.DataAttachments.NoElementsAllowed\");\r\n                }\r\n\r\n                if (tree.BuildResult.ValidationErrors.Count() == 0)\r\n                {\r\n                    tree.RootTreeNode.Initialize();\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                tree.AddValidationError(\"\", \"TreeValidationError.Common.UnknownException\", ex.Message);\r\n            }\r\n\r\n            return tree;\r\n        }\r\n\r\n\r\n\r\n        private static bool ValidateMarkup(Tree tree, XDocument document)\r\n        {\r\n            try\r\n            {\r\n                if (document.Root == null)\r\n                {\r\n                    tree.AddValidationError(\"\", \"TreeValidationError.Markup.NoRootElement\");\r\n                    return false;\r\n                }\r\n\r\n                bool schemaValidationResult = true;\r\n                Action<object, ValidationEventArgs> onValidationError = (obj, args) =>\r\n                {\r\n                    tree.AddValidationError(\"\", \"TreeValidationError.Markup.SchemaError\", args.Message, args.Exception.LineNumber, args.Exception.LinePosition);\r\n                    schemaValidationResult = false;\r\n                };\r\n\r\n                XDocument schemaDocument = XDocumentUtils.Load(Path.Combine(PathUtil.Resolve(\"~/Composite/schemas/Trees\"), \"Tree.xsd\"));\r\n                IEnumerable<XElement> elements = schemaDocument.Descendants((XNamespace)\"http://www.w3.org/2001/XMLSchema\" + \"import\").ToList();\r\n                foreach (XElement element in elements)\r\n                {\r\n                    element.Remove();\r\n                }\r\n\r\n                XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();\r\n                xmlReaderSettings.ValidationType = ValidationType.Schema;\r\n                using (XmlReader schemaReader = schemaDocument.CreateReader())\r\n                {\r\n                    xmlReaderSettings.Schemas.Add(null, schemaReader);\r\n                }\r\n                xmlReaderSettings.Schemas.AddFromPath(null, Path.Combine(PathUtil.Resolve(\"~/Composite/schemas/Functions\"), \"Function.xsd\"));\r\n                //xmlReaderSettings.Schemas.AddFromPath(null, Path.Combine(PathUtil.Resolve(\"~/Composite/schemas/Trees\"), \"Tree.xsd\"));                \r\n                xmlReaderSettings.ValidationEventHandler += new ValidationEventHandler(onValidationError);\r\n                xmlReaderSettings.ValidationFlags = XmlSchemaValidationFlags.ProcessSchemaLocation | XmlSchemaValidationFlags.ReportValidationWarnings;\r\n                XmlReader xmlReader = XmlReader.Create(new StringReader(document.ToString()), xmlReaderSettings);\r\n\r\n                while (xmlReader.Read()) ;\r\n\r\n                if (schemaValidationResult == false)\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                tree.AddValidationError(\"\", \"TreeValidationError.Common.UnknownException\", ex.Message);\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private static void BuildAutoAttachmentPoints(Tree tree, XDocument document)\r\n        {            \r\n            XElement element = document.Root.Elements(TreeMarkupConstants.Namespace + \"ElementStructure.AutoAttachments\").SingleOrDefault();\r\n            if (element == null) return;\r\n\r\n            IEnumerable<INamedAttachmentPoint> namedAttachmentPoints = BuildNamedAttachmentPoints(tree, element, () => new NamedAttachmentPoint());\r\n            tree.AttachmentPoints.AddRange(namedAttachmentPoints.Cast<IAttachmentPoint>());\r\n\r\n            IEnumerable<IDataItemAttachmentPoint> dataItemAttachmentPoint = BuildDataItemPoints(tree, element, () => new DataItemAttachmentPoint());\r\n            tree.AttachmentPoints.AddRange(dataItemAttachmentPoint.Cast<IAttachmentPoint>());\r\n        }\r\n\r\n\r\n\r\n        private static void BuildAllowedAttachmentPoints(Tree tree, XDocument document)\r\n        {\r\n            XElement element = document.Root.Elements(TreeMarkupConstants.Namespace + \"ElementStructure.AllowedAttachments\").SingleOrDefault();\r\n            if (element == null) return;\r\n\r\n            XAttribute applicationNameAttribute = element.Attribute(\"ApplicationName\");\r\n            if (applicationNameAttribute != null)\r\n            {\r\n                tree.AllowedAttachmentApplicationName = applicationNameAttribute.Value;\r\n            }\r\n            else\r\n            {\r\n                tree.AddValidationError(element.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"ApplicationName\");\r\n                return;\r\n            }\r\n\r\n            //This is just illustrating the generic way of handling these things. Please leave this commet /MRJ\r\n            //IEnumerable<INamedAttachmentPoint> namedAttachmentPoints = BuildNamedAttachmentPoints(tree, element, () => new NamedPossibleAttachmentPoint());\r\n            //tree.PossibleAttachmentPoints.AddRange(namedAttachmentPoints.Cast<IPossibleAttachmentPoint>());\r\n\r\n            IEnumerable<IDataItemAttachmentPoint> namedAttachmentPoints = BuildDataItemPoints(tree, element, () => new DataItemPossibleAttachmentPoint());\r\n            tree.PossibleAttachmentPoints.AddRange(namedAttachmentPoints.Cast<IPossibleAttachmentPoint>());\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<INamedAttachmentPoint> BuildNamedAttachmentPoints(Tree tree, XElement containerElement, Func<INamedAttachmentPoint> namedAttachmentPointFactory)\r\n        {\r\n            IEnumerable<XElement> namedElements = containerElement.Elements(TreeMarkupConstants.Namespace + \"NamedParent\");\r\n\r\n            foreach (XElement namedElement in namedElements)\r\n            {\r\n                XAttribute nameAttribute = namedElement.Attribute(\"Name\");\r\n\r\n                if (nameAttribute == null)\r\n                {\r\n                    tree.AddValidationError(namedElement.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"Name\");\r\n                    yield break;\r\n                }\r\n\r\n                AttachingPoint attachingPoint;\r\n                switch (nameAttribute.Value)\r\n                {\r\n                    case \"PerspectivesRoot\":\r\n                        attachingPoint = AttachingPoint.PerspectivesRoot;\r\n                        break;\r\n\r\n                    case \"Content\":\r\n                        attachingPoint = AttachingPoint.ContentPerspective;\r\n                        break;\r\n\r\n                    case \"Content.WebsiteItems\":\r\n                        attachingPoint = AttachingPoint.ContentPerspectiveWebsiteItems;\r\n                        break;\r\n\r\n                    case \"Data\":\r\n                        attachingPoint = AttachingPoint.DataPerspective;\r\n                        break;\r\n\r\n                    case \"Layout\":\r\n                        attachingPoint = AttachingPoint.DesignPerspective;\r\n                        break;\r\n\r\n                    case \"Media\":\r\n                        attachingPoint = AttachingPoint.MediaPerspective;\r\n                        break;\r\n\r\n                    case \"Function\":\r\n                        attachingPoint = AttachingPoint.FunctionPerspective;\r\n                        break;\r\n\r\n                    case \"System\":\r\n                        attachingPoint = AttachingPoint.SystemPerspective;\r\n                        break;\r\n                    case null:\r\n                    case \"\":\r\n                        tree.AddValidationError(nameAttribute.GetXPath(), \"TreeValidationError.AutoAttachments.UnknownAttachmentPoint\", nameAttribute.Value);\r\n                        attachingPoint = null;\r\n                        break;\r\n                    default:\r\n                        attachingPoint = AttachingPoint.VirtualElementAttachingPoint(nameAttribute.Value);\r\n                        break;\r\n                }\r\n\r\n                if (attachingPoint == null) yield break;\r\n\r\n                INamedAttachmentPoint namedAttachmentPoint = namedAttachmentPointFactory();\r\n                namedAttachmentPoint.AttachingPoint = attachingPoint;\r\n                namedAttachmentPoint.Position = GetPosition(tree, namedElement);\r\n\r\n                yield return namedAttachmentPoint;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<IDataItemAttachmentPoint> BuildDataItemPoints(Tree tree, XElement containerElement, Func<IDataItemAttachmentPoint> dataItemAttachmentPointFactory)\r\n        {\r\n            IEnumerable<XElement> dataTypeElements = containerElement.Elements(TreeMarkupConstants.Namespace + \"DataType\");\r\n\r\n            foreach (XElement dataTypeElement in dataTypeElements)\r\n            {\r\n                XAttribute typeAttribute = dataTypeElement.Attribute(\"Type\");\r\n                XAttribute positionAttribute = dataTypeElement.Attribute(\"Position\");\r\n\r\n                if (typeAttribute == null)\r\n                {\r\n                    tree.AddValidationError(dataTypeElement.GetXPath(), \"TreeValidationError.Common.MissingAttribute\", \"Type\");\r\n                    continue;\r\n                }\r\n\r\n                Type interfaceType = TypeManager.TryGetType(typeAttribute.Value);\r\n                if (interfaceType == null)\r\n                {\r\n                    tree.AddValidationError(dataTypeElement.GetXPath(), \"TreeValidationError.Common.UnknownInterfaceType\", typeAttribute.Value);\r\n                    continue;\r\n                }\r\n\r\n                IDataItemAttachmentPoint dataItemAttachmentPoint = dataItemAttachmentPointFactory();\r\n                dataItemAttachmentPoint.InterfaceType = interfaceType;\r\n                dataItemAttachmentPoint.Position = GetPosition(tree, dataTypeElement);\r\n\r\n                yield return dataItemAttachmentPoint;\r\n            }\r\n        }\r\n       \r\n\r\n\r\n        private static ElementAttachingProviderPosition GetPosition(Tree tree, XElement namedElement)\r\n        {\r\n            XAttribute positionAttribute = namedElement.Attribute(\"Position\");\r\n\r\n            string position = positionAttribute.GetValueOrDefault(\"Top\");\r\n            switch (position)\r\n            {\r\n                case \"Top\":\r\n                    return ElementAttachingProviderPosition.Top;\r\n\r\n                case \"Bottom\":\r\n                    return ElementAttachingProviderPosition.Bottom;\r\n\r\n                default:\r\n                    tree.AddValidationError(positionAttribute.GetXPath(), \"TreeValidationError.AutoAttachments.UnknownAttachmentPosition\", position);\r\n                    return ElementAttachingProviderPosition.Top;;\r\n            }\r\n        }\r\n\r\n    \r\n\r\n        private static TreeNode BuildInnerTree(XElement element, TreeNode parentNode, Tree tree)\r\n        {\r\n            TreeNode treeNode = TreeNodeCreatorFactory.CreateTreeNode(element, tree);\r\n            if (treeNode == null) return null;\r\n\r\n\r\n            // Actions\r\n            XElement actionsElement = element.Element(TreeMarkupConstants.Namespace + \"Actions\");\r\n            if (actionsElement != null)\r\n            {\r\n                foreach (XElement actionElement in actionsElement.Elements())\r\n                {\r\n                    ActionNode actionNode = ActionNodeCreatorFactory.CreateActionNode(actionElement, tree);\r\n\r\n                    if (actionNode != null)\r\n                    {\r\n                        treeNode.AddActionNode(actionNode);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            // OrderBys\r\n            XElement orderBysElement = element.Element(TreeMarkupConstants.Namespace + \"OrderBy\");\r\n            if (orderBysElement != null)\r\n            {\r\n                foreach (XElement orderByElement in orderBysElement.Elements())\r\n                {\r\n                    OrderByNode orderByNode = OrderByNodeCreatorFactory.CreateOrderByNode(orderByElement, tree);\r\n\r\n                    if (orderByNode != null)\r\n                    {\r\n                        treeNode.AddOrderByNode(orderByNode);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            // Filters\r\n            XElement filtersElement = element.Element(TreeMarkupConstants.Namespace + \"Filters\");\r\n            if (filtersElement != null)\r\n            {\r\n                foreach (XElement filterElement in filtersElement.Elements())\r\n                {\r\n                    FilterNode filterNode = FilterNodeCreatorFactory.CreateFilterNode(filterElement, tree);\r\n\r\n                    if (filterNode != null)\r\n                    {\r\n                        treeNode.AddFilterNode(filterNode);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n\r\n            if (parentNode != null)\r\n            {\r\n                parentNode.AddChildTreeNode(treeNode);\r\n            }\r\n            \r\n\r\n\r\n            // Children\r\n            XElement childrenElement = element.Element(TreeMarkupConstants.Namespace + \"Children\");\r\n            if (childrenElement != null)\r\n            {\r\n                foreach (XElement childElement in childrenElement.Elements())\r\n                {\r\n                    BuildInnerTree(childElement, treeNode, tree);\r\n                }\r\n            }\r\n\r\n\r\n            treeNode.InitializeActions();\r\n            treeNode.InitializeOrderByes();\r\n            treeNode.InitializeFilters();           \r\n\r\n            return treeNode;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/TreeException.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n\tinternal class TreeException : Exception\r\n\t{\r\n        public static TreeException CreateException(string stringName, params object[] args)\r\n        {\r\n            string resourceString = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", stringName);\r\n\r\n            string message = string.Format(resourceString, args);\r\n\r\n            return new TreeException(message);\r\n        }\r\n\r\n\r\n        public TreeException(string message)\r\n            : base(message)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/TreeNodeCreatorFactory.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal static class TreeNodeCreatorFactory\r\n    {\r\n        private static readonly string DefaultFolderResourceName = \"folder\";\r\n        private static readonly string DefaultOpenedFolderResourceName = \"folder-open\";\r\n        private static readonly string DefaultDataGroupingFolderResourceName = \"folder\";\r\n\r\n        \r\n        public static TreeNode CreateTreeNode(XElement element, Tree tree)\r\n        {\r\n            if (element.Name == TreeMarkupConstants.Namespace + \"ElementRoot\")\r\n            {\r\n                return BuildRootTreeNode(element, tree);\r\n            }\r\n\r\n            if (element.Name == TreeMarkupConstants.Namespace + \"Element\")\r\n            {\r\n                return BuildSimpleElementTreeNode(element, tree);\r\n            }\r\n\r\n            if (element.Name == TreeMarkupConstants.Namespace + \"FunctionElementGenerator\")\r\n            {\r\n                return BuildFunctionElementGeneratorTreeNode(element, tree);\r\n            }\r\n\r\n            if (element.Name == TreeMarkupConstants.Namespace + \"DataElements\")\r\n            {\r\n                return BuildDataElementsTreeNode(element, tree);\r\n            }\r\n\r\n            if (element.Name == TreeMarkupConstants.Namespace + \"DataFolderElements\")\r\n            {\r\n                return BuildDataFolderElementsTreeNode(element, tree);\r\n            }\r\n            \r\n            tree.AddValidationError(element, \"TreeValidationError.Common.UnknownElement\", element.Name);\r\n            return null;\r\n        }\r\n\r\n\r\n        private static TreeNode BuildDataFolderElementsTreeNode(XElement element, Tree tree)\r\n        {\r\n            XAttribute typeAttribute = element.Attribute(\"Type\");\r\n            XAttribute fieldGroupingNameAttribute = element.Attribute(\"FieldGroupingName\");\r\n            XAttribute dateFormatAttribute = element.Attribute(\"DateFormat\");\r\n            XAttribute iconAttribute = element.Attribute(\"Icon\");\r\n            XAttribute rangeAttribute = element.Attribute(\"Range\");\r\n            XAttribute firstLetterOnlyAttribute = element.Attribute(\"FirstLetterOnly\");\r\n            XAttribute showForeignItemsAttribute = element.Attribute(\"ShowForeignItems\");\r\n            XAttribute leafDisplayAttribute = element.Attribute(\"Display\");\r\n            XAttribute sortDirectionAttribute = element.Attribute(\"SortDirection\");\r\n\r\n\r\n            if (fieldGroupingNameAttribute == null)\r\n            {\r\n                tree.AddValidationError(element, \"TreeValidationError.Common.MissingAttribute\", \"FieldGroupingName\");\r\n                return null;\r\n            }\r\n\r\n            Type interfaceType = null;\r\n            if (typeAttribute != null)\r\n            {\r\n                interfaceType = TypeManager.TryGetType(typeAttribute.Value);\r\n                if (interfaceType == null)\r\n                {\r\n                    tree.AddValidationError(element, \"TreeValidationError.Common.UnknownInterfaceType\", typeAttribute.Value);\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            bool firstLetterOnly = false;\r\n            if (firstLetterOnlyAttribute != null)\r\n            {\r\n                if (!firstLetterOnlyAttribute.TryGetBoolValue(out firstLetterOnly))\r\n                {\r\n                    tree.AddValidationError(element, \"TreeValidationError.Common.WrongAttributeValue\", \"FirstLetterOnly\");\r\n                }\r\n            }\r\n\r\n            LeafDisplayMode leafDisplay = LeafDisplayModeHelper.ParseDisplayMode(leafDisplayAttribute, tree);\r\n            SortDirection sortDirection = ParseSortDirection(sortDirectionAttribute, tree);\r\n\r\n            return new DataFolderElementsTreeNode\r\n                {\r\n                    Tree = tree,\r\n                    Id = tree.BuildProcessContext.CreateNewNodeId(),\r\n                    InterfaceType = interfaceType,\r\n                    Icon = FactoryHelper.GetIcon(iconAttribute.GetValueOrDefault(DefaultDataGroupingFolderResourceName)),\r\n                    FieldName = fieldGroupingNameAttribute.Value,\r\n                    DateFormat = dateFormatAttribute.GetValueOrDefault(null),\r\n                    Range = rangeAttribute.GetValueOrDefault(null),\r\n                    FirstLetterOnly = firstLetterOnly,\r\n                    ShowForeignItems = showForeignItemsAttribute.GetValueOrDefault(\"true\").ToLowerInvariant() == \"true\",\r\n                    Display = leafDisplay,\r\n                    SortDirection = sortDirection\r\n                };\r\n        }\r\n\r\n        public static SortDirection ParseSortDirection(XAttribute attribute, Tree tree)\r\n        {\r\n            if (attribute != null)\r\n            {\r\n                SortDirection parsedValue;\r\n\r\n                if (Enum.TryParse(attribute.Value, out parsedValue))\r\n                {\r\n                    return parsedValue;\r\n                }\r\n\r\n                tree.AddValidationError(attribute, \"TreeValidationError.Common.WrongAttributeValue\", attribute.Value);\r\n            }\r\n\r\n            return SortDirection.Ascending;\r\n        }\r\n\r\n        private static TreeNode BuildDataElementsTreeNode(XElement element, Tree tree)\r\n        {\r\n            XAttribute typeAttribute = element.Attribute(\"Type\");\r\n            XAttribute labelAttribute = element.Attribute(\"Label\");\r\n            XAttribute toolTipAttribute = element.Attribute(\"ToolTip\");\r\n            XAttribute iconAttribute = element.Attribute(\"Icon\");\r\n            XAttribute openedIconAttribute = element.Attribute(\"OpenedIcon\");\r\n            XAttribute showForeignItemsAttribute = element.Attribute(\"ShowForeignItems\");\r\n            XAttribute leafDisplayAttribute = element.Attribute(\"Display\");\r\n            XAttribute browserUrlAttribute = element.Attribute(\"BrowserUrl\");\r\n            XAttribute browserImagelAttribute = element.Attribute(\"BrowserImage\");\r\n\r\n            if (typeAttribute == null)\r\n            {\r\n                tree.AddValidationError(element, \"TreeValidationError.Common.MissingAttribute\", \"Type\");\r\n                return null;\r\n            }\r\n\r\n            Type interfaceType = TypeManager.TryGetType(typeAttribute.Value);\r\n            if (interfaceType == null)\r\n            {\r\n                tree.AddValidationError(element, \"TreeValidationError.Common.UnknownInterfaceType\",\r\n                                        typeAttribute.Value);\r\n                return null;\r\n            }\r\n\r\n\r\n            LeafDisplayMode leafDisplay = LeafDisplayModeHelper.ParseDisplayMode(leafDisplayAttribute, tree);\r\n\r\n\r\n            ResourceHandle icon = null;\r\n            if (iconAttribute != null) icon = FactoryHelper.GetIcon(iconAttribute.Value);\r\n\r\n            ResourceHandle openedIcon = null;\r\n            if (icon != null && openedIconAttribute == null) openedIcon = icon;\r\n            else if (openedIconAttribute != null) openedIcon = FactoryHelper.GetIcon(openedIconAttribute.Value);\r\n\r\n            var dataElementsTreeNode = new DataElementsTreeNode\r\n                {\r\n                    Tree = tree,\r\n                    Id = tree.BuildProcessContext.CreateNewNodeId(),\r\n                    InterfaceType = interfaceType,\r\n                    Label = labelAttribute.GetValueOrDefault(null),\r\n                    ToolTip = toolTipAttribute.GetValueOrDefault(null),\r\n                    Icon = icon,\r\n                    OpenedIcon = openedIcon,\r\n                    ShowForeignItems = showForeignItemsAttribute.GetValueOrDefault(\"true\").ToLowerInvariant() == \"true\",\r\n                    Display = leafDisplay,\r\n                    BrowserUrl = browserUrlAttribute.GetValueOrDefault(null),\r\n                    BrowserImage = browserImagelAttribute.GetValueOrDefault(null),\r\n            };\r\n\r\n            List<TreeNode> treeNodes;\r\n            if (tree.BuildProcessContext.DataInteraceToTreeNodes.TryGetValue(interfaceType, out treeNodes) == false)\r\n            {\r\n                treeNodes = new List<TreeNode>();\r\n                tree.BuildProcessContext.DataInteraceToTreeNodes.Add(interfaceType, treeNodes);\r\n            }\r\n\r\n            treeNodes.Add(dataElementsTreeNode);\r\n\r\n            return dataElementsTreeNode;\r\n        }\r\n\r\n        private static TreeNode BuildFunctionElementGeneratorTreeNode(XElement element, Tree tree)\r\n        {\r\n            XAttribute labelAttribute = element.Attribute(\"Label\");\r\n            XAttribute toolTipAttribute = element.Attribute(\"ToolTip\");\r\n            XAttribute iconAttribute = element.Attribute(\"Icon\");\r\n\r\n            XElement functionMarkupContainerElement = element.Element(TreeMarkupConstants.Namespace + \"FunctionMarkup\");\r\n            if (functionMarkupContainerElement == null)\r\n            {\r\n                //MRJ: DSLTree: FunctionElementGeneratorTreeNode: Validation error\r\n            }\r\n\r\n            XElement functionMarkupElement = functionMarkupContainerElement.Element((XNamespace) FunctionTreeConfigurationNames.NamespaceName +\r\n                                                       FunctionTreeConfigurationNames.FunctionTagName);\r\n            if (functionMarkupElement == null)\r\n            {\r\n                //MRJ: DSLTree: FunctionElementGeneratorTreeNode: Validation error\r\n            }\r\n\r\n\r\n            if (labelAttribute == null)\r\n            {\r\n                tree.AddValidationError(element, \"TreeValidationError.Common.MissingAttribute\", \"Label\");\r\n                return null;\r\n            }\r\n\r\n            return new FunctionElementGeneratorTreeNode\r\n                {\r\n                    Tree = tree,\r\n                    Id = tree.BuildProcessContext.CreateNewNodeId(),\r\n                    FunctionMarkup = functionMarkupElement,\r\n                    Label = labelAttribute.Value,\r\n                    ToolTip = toolTipAttribute.GetValueOrDefault(labelAttribute.Value),\r\n                    Icon = FactoryHelper.GetIcon(iconAttribute.GetValueOrDefault(DefaultFolderResourceName))\r\n                };\r\n        }\r\n\r\n        private static TreeNode BuildSimpleElementTreeNode(XElement element, Tree tree)\r\n        {\r\n            XAttribute idAttribute = element.Attribute(\"Id\");\r\n            XAttribute labelAttribute = element.Attribute(\"Label\");\r\n            XAttribute toolTipAttribute = element.Attribute(\"ToolTip\");\r\n            XAttribute iconAttribute = element.Attribute(\"Icon\");\r\n            XAttribute openedIconAttribute = element.Attribute(\"OpenedIcon\");\r\n            XAttribute browserUrlAttribute = element.Attribute(\"BrowserUrl\");\r\n            XAttribute browserImageAttribute = element.Attribute(\"BrowserImage\");\r\n\r\n            if (idAttribute == null)\r\n            {\r\n                tree.AddValidationError(element, \"TreeValidationError.Common.MissingAttribute\", \"Id\");\r\n                return null;\r\n            }\r\n\r\n            if (idAttribute.Value == \"\" || idAttribute.Value == \"RootTreeNode\" || idAttribute.Value.StartsWith(\"NodeAutoId_\"))\r\n            {\r\n                tree.AddValidationError(idAttribute, \"TreeValidationError.SimpleElement.WrongIdValue\");\r\n            }\r\n            else if (tree.BuildProcessContext.AlreadyUsed(idAttribute.Value))\r\n            {\r\n                tree.AddValidationError(idAttribute, \"TreeValidationError.SimpleElement.AlreadyUsedId\", idAttribute.Value);\r\n            }\r\n            else\r\n            {\r\n                tree.BuildProcessContext.AddUsedId(idAttribute.Value);\r\n            }\r\n\r\n\r\n            if (labelAttribute == null)\r\n            {\r\n                tree.AddValidationError(element, \"TreeValidationError.Common.MissingAttribute\", \"Label\");\r\n                return null;\r\n            }\r\n\r\n            ResourceHandle icon = FactoryHelper.GetIcon(iconAttribute.GetValueOrDefault(DefaultFolderResourceName));\r\n            ResourceHandle openedIcon =\r\n                FactoryHelper.GetIcon(openedIconAttribute.GetValueOrDefault(DefaultOpenedFolderResourceName));\r\n            if (iconAttribute != null && openedIconAttribute == null)\r\n            {\r\n                openedIcon = icon;\r\n            }\r\n\r\n            return new SimpleElementTreeNode\r\n                {\r\n                    Tree = tree,\r\n                    Id = idAttribute.Value,\r\n                    Label = labelAttribute.Value,\r\n                    ToolTip = toolTipAttribute.GetValueOrDefault(labelAttribute.Value),\r\n                    Icon = icon,\r\n                    OpenIcon = openedIcon,\r\n                    BrowserUrl = browserUrlAttribute.GetValueOrDefault(null),\r\n                    BrowserImage = browserImageAttribute.GetValueOrDefault(null)\r\n            };\r\n        }\r\n\r\n        private static TreeNode BuildRootTreeNode(XElement element, Tree tree)\r\n        {\r\n            XAttribute shareRootElementByIdAttribute = element.Attribute(\"ShareRootElementById\");\r\n            if (shareRootElementByIdAttribute != null)\r\n            {\r\n                tree.ShareRootElementById = (bool) shareRootElementByIdAttribute;\r\n\r\n                if (tree.ShareRootElementById)\r\n                {\r\n                    int count = tree.AttachmentPoints.OfType<NamedAttachmentPoint>().Count();\r\n                    if (count != 1 || tree.AttachmentPoints.Count > count)\r\n                    {\r\n                        tree.AddValidationError(shareRootElementByIdAttribute, \"TreeValidationError.ElementRoot.ShareRootElementByIdNotAllowed\");\r\n                    }\r\n                }\r\n            }\r\n\r\n            return new RootTreeNode\r\n                {\r\n                    Tree = tree,\r\n                    Id = tree.BuildProcessContext.CreateNewNodeId()\r\n                };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/TreePerspectiveEntityToken.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    /// <exclude />\r\n    [SecurityAncestorProvider(typeof(Composite.C1Console.Security.SecurityAncestorProviders.NoAncestorSecurityAncestorProvider))]\r\n    public class TreePerspectiveEntityToken : EntityToken\r\n    {\r\n        /// <exclude />\r\n        [JsonConstructor]\r\n        public TreePerspectiveEntityToken(string id)\r\n        {\r\n            Id = id;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id { get; }\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public override string Type => \"C1Trees\";\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public override string Source => \"C1Trees\";\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize() => CompositeJsonSerializer.Serialize(this);\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                entityToken = CompositeJsonSerializer.Deserialize<TreePerspectiveEntityToken>(serializedEntityToken);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedEntityToken);\r\n                Log.LogVerbose(nameof(TreePerspectiveEntityToken), entityToken.GetType().FullName);\r\n            }\r\n            return entityToken;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken DeserializeLegacy(string serializedEntityToken)\r\n        {\r\n            return new TreePerspectiveEntityToken(serializedEntityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Foundation/TupleIndexer.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Foundation\r\n{\r\n    internal sealed class TupleIndexer\r\n    {\r\n        private dynamic _tuple;\r\n\r\n        public TupleIndexer(dynamic tuple)\r\n        {\r\n            _tuple = tuple;\r\n        }\r\n\r\n\r\n        public int this[int index]\r\n        {\r\n            get\r\n            {\r\n                if (index == 1) return (int)_tuple.Item1;\r\n                else if (index == 2) return (int)_tuple.Item2;\r\n                else if (index == 3) return (int)_tuple.Item3;\r\n                else if (index == 4) return (int)_tuple.Item4;\r\n                else if (index == 5) return (int)_tuple.Item5;\r\n                else if (index == 6) return (int)_tuple.Item6;\r\n                else if (index == 7) return (int)_tuple.Item7;\r\n                else if (index == 8) return (int)_tuple.Item8;\r\n                else throw new IndexOutOfRangeException();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public object GetAtIndex(int index)\r\n        {\r\n            if (index == 1) return _tuple.Item1;\r\n            else if (index == 2) return _tuple.Item2;\r\n            else if (index == 3) return _tuple.Item3;\r\n            else if (index == 4) return _tuple.Item4;\r\n            else if (index == 5) return _tuple.Item5;\r\n            else if (index == 6) return _tuple.Item6;\r\n            else if (index == 7) return _tuple.Item7;\r\n            else if (index == 8) return _tuple.Item8;\r\n            else throw new IndexOutOfRangeException();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/FunctionElementGeneratorTreeNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{    \r\n    internal sealed class FunctionElementGeneratorTreeNode : TreeNode\r\n    {\r\n        public XElement FunctionMarkup { get; internal set; }   // Requried\r\n        public string Label { get; internal set; }              // Requried\r\n        public string ToolTip { get; internal set; }            // Defaults to Label\r\n        public ResourceHandle Icon { get; internal set; }       // Defaults to 'folder'\r\n        \r\n\r\n        // Cached\r\n        private BaseRuntimeTreeNode _functionNode;\r\n\r\n\r\n        private IEnumerable<KeyValuePair<string, string>> GetFunctionResult()\r\n        {\r\n            return _functionNode.GetValue<IEnumerable<KeyValuePair<string, string>>>(); \r\n        }\r\n\r\n\r\n\r\n\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            IEntityTokenContainingParentEntityToken containingParentEnitytToken = childEntityToken as IEntityTokenContainingParentEntityToken;\r\n            if (containingParentEnitytToken != null)\r\n            {\r\n                childEntityToken = containingParentEnitytToken.GetParentEntityToken();\r\n            }\r\n\r\n\r\n            foreach (EntityToken entityToken in this.ParentNode.GetEntityTokens(childEntityToken, dynamicContext))\r\n            {                \r\n                foreach (var kvp in GetFunctionResult())\r\n                {\r\n                    yield return new TreeFunctionElementGeneratorEntityToken(this.Id, this.Tree.TreeId, EntityTokenSerializer.Serialize(entityToken), kvp.Key);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override AncestorResult GetParentEntityToken(EntityToken ownEntityToken, Type parentInterfaceOfInterest, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            return new AncestorResult(this.ParentNode, ((TreeFunctionElementGeneratorEntityToken)ownEntityToken).ParentEntityToken);\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<Element> OnGetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            foreach (var kvp in GetFunctionResult())\r\n            {\r\n                Element element = new Element(new ElementHandle(\r\n                    dynamicContext.ElementProviderName,\r\n                    new TreeFunctionElementGeneratorEntityToken(this.Id.ToString(), this.Tree.TreeId, EntityTokenSerializer.Serialize(parentEntityToken), kvp.Key),\r\n                    dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken)\r\n                ));\r\n\r\n                element.VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = kvp.Value,\r\n                    ToolTip = kvp.Value,\r\n                    HasChildren = ChildNodes.Count() > 0,\r\n                    Icon = Core.ResourceSystem.ResourceHandle.BuildIconFromDefaultProvider(\"folder\"),\r\n                    OpenedIcon = Core.ResourceSystem.ResourceHandle.BuildIconFromDefaultProvider(\"folder\")\r\n                };\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected override void OnInitialize()\r\n        {\r\n            //MRJ: DSLTree: FunctionElementGeneratorTreeNode: More validaion here\r\n            //MRJ: DSLTree: FunctionElementGeneratorTreeNode: What kind of return type should the function have?\r\n            _functionNode = FunctionTreeBuilder.Build(this.FunctionMarkup);\r\n        }\r\n\r\n\r\n        public override string ToString()\r\n        {\r\n\r\n            return string.Format(\"FunctionElementGeneratorTreeNode, Id = {0}, Label = {1}\", this.Id, this.Label);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/FunctionFilterNode.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Functions;\r\nusing Composite.Core;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal sealed class FunctionFilterNode : FilterNode\r\n    {\r\n        public XElement FunctionMarkup { get; set; } // Required\r\n\r\n\r\n        private AttributeDynamicValuesHelper FunctionMarkupDynamicValuesHelper { get; set; }\r\n\r\n\r\n        public override Expression CreateDownwardsFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            var replaceContext = new DynamicValuesHelperReplaceContext(dynamicContext.CurrentEntityToken, dynamicContext.Piggybag);\r\n\r\n            XElement markup = this.FunctionMarkupDynamicValuesHelper.ReplaceValues(replaceContext);\r\n\r\n            BaseRuntimeTreeNode baseRuntimeTreeNode = FunctionTreeBuilder.Build(markup);\r\n            LambdaExpression expression = GetLambdaExpression(baseRuntimeTreeNode);\r\n\r\n            if (expression.Parameters.Count != 1)\r\n            {\r\n                throw new InvalidOperationException(\"Only 1 parameter lamdas supported when calling function: \" + markup);\r\n            }\r\n\r\n\r\n            ParameterChangerExpressionVisitor expressionVisitor = new ParameterChangerExpressionVisitor(expression.Parameters.Single(), parameterExpression);\r\n\r\n            Expression resultExpression = expressionVisitor.Visit(expression.Body);\r\n\r\n            return resultExpression;\r\n        }        \r\n\r\n\r\n\r\n        public override Expression CreateUpwardsFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            DataEntityToken currentEntityToken = dynamicContext.CurrentEntityToken as DataEntityToken;\r\n            IData filteredDataItem = null;\r\n\r\n            Func<IData, bool> upwardsFilter = dataItem =>\r\n            {\r\n                var ancestorEntityToken = dataItem.GetDataEntityToken();\r\n\r\n                var replaceContext = new DynamicValuesHelperReplaceContext\r\n                {\r\n                    CurrentDataItem = dataItem,\r\n                    CurrentEntityToken = ancestorEntityToken,\r\n                    PiggybagDataFinder = new PiggybagDataFinder(dynamicContext.Piggybag, ancestorEntityToken)\r\n                };\r\n\r\n                XElement markup = this.FunctionMarkupDynamicValuesHelper.ReplaceValues(replaceContext);\r\n\r\n                BaseRuntimeTreeNode baseRuntimeTreeNode = FunctionTreeBuilder.Build(markup);\r\n                LambdaExpression expression = GetLambdaExpression(baseRuntimeTreeNode);\r\n\r\n                if (expression.Parameters.Count != 1)\r\n                {\r\n                    throw new InvalidOperationException(\"Only 1 parameter lamdas supported when calling function: \" + markup);\r\n                }\r\n\r\n                Delegate compiledExpression = expression.Compile();\r\n\r\n                if (filteredDataItem == null)\r\n                {\r\n                    filteredDataItem = currentEntityToken.Data;\r\n                }\r\n\r\n                return (bool)compiledExpression.DynamicInvoke(filteredDataItem);\r\n            };\r\n\r\n            \r\n            return upwardsFilter.Target != null \r\n                ? Expression.Call(Expression.Constant(upwardsFilter.Target), upwardsFilter.Method, parameterExpression)\r\n                : Expression.Call(upwardsFilter.Method, parameterExpression);\r\n\r\n        }\r\n\r\n\r\n        internal override void Initialize()\r\n        {\r\n            try\r\n            {\r\n                FunctionTreeBuilder.Build(this.FunctionMarkup);\r\n            }\r\n            catch \r\n            {\r\n                AddValidationError(\"TreeValidationError.FunctionFilter.WrongFunctionMarkup\");\r\n                return;\r\n            }\r\n                       \r\n\r\n            this.FunctionMarkupDynamicValuesHelper = new AttributeDynamicValuesHelper(this.FunctionMarkup);\r\n            this.FunctionMarkupDynamicValuesHelper.Initialize(this.OwnerNode);\r\n        }\r\n\r\n\r\n\r\n        private LambdaExpression GetLambdaExpression(BaseRuntimeTreeNode baseRuntimeTreeNode)\r\n        {\r\n            LambdaExpression expression = (LambdaExpression)baseRuntimeTreeNode.GetValue();\r\n\r\n            if (expression == null)\r\n            {\r\n                string message = string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeValidationError.FunctionFilter.WrongReturnValue\"), string.Format(\"Expression<Func<{0}, bool>>\", this.OwnerNode.InterfaceType));\r\n\r\n                Log.LogError(\"TreeFacade\", message);\r\n                Log.LogError(\"TreeFacade\", \"In tree \" + this.OwnerNode.Tree.TreeId + \" in function \" + this.XPath);\r\n\r\n                throw new InvalidOperationException(message);\r\n            }\r\n\r\n\r\n            if (expression.ReturnType != typeof(bool))\r\n            {\r\n                string message = string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeValidationError.FunctionFilter.WrongFunctionReturnType\"), expression.ReturnType, typeof(bool));\r\n                \r\n                Log.LogError(\"TreeFacade\", message);\r\n                Log.LogError(\"TreeFacade\", \"In tree \" + this.OwnerNode.Tree.TreeId + \" in function \" + this.XPath);\r\n                \r\n                throw new InvalidOperationException(message);\r\n            }\r\n\r\n            if (expression.Parameters.Count() != 1)\r\n            {\r\n                string message = string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeValidationError.FunctionFilter.WrongFunctionParameterCount\"), expression.Parameters.Count());\r\n                \r\n                Log.LogError(\"TreeFacade\", message);\r\n                Log.LogError(\"TreeFacade\", \"In tree \" + this.OwnerNode.Tree.TreeId + \" in function \" + this.XPath);\r\n\r\n                throw new InvalidOperationException(message);\r\n            }\r\n\r\n            ParameterExpression parameterExpression = expression.Parameters.Single();\r\n            if (this.OwnerNode.InterfaceType.IsAssignableFrom(parameterExpression.Type) == false)\r\n            {\r\n                string message = string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeValidationError.FunctionFilter.WrongFunctionParameterType\"), parameterExpression.Type, this.OwnerNode.InterfaceType);\r\n                \r\n                Log.LogError(\"TreeFacade\", message);\r\n                Log.LogError(\"TreeFacade\", \"In tree \" + this.OwnerNode.Tree.TreeId + \" in function \" + this.XPath);\r\n\r\n                throw new InvalidOperationException(message);\r\n            }\r\n\r\n            return expression;\r\n        }\r\n\r\n\r\n\r\n        private sealed class ParameterChangerExpressionVisitor : ExpressionVisitor\r\n        {\r\n            private readonly ParameterExpression _parameterExpressionToChange;\r\n            private readonly ParameterExpression _newParameterExpression;\r\n\r\n\r\n            public ParameterChangerExpressionVisitor(ParameterExpression parameterExpressionToChange, ParameterExpression newParameterExpression)\r\n            {\r\n                _parameterExpressionToChange = parameterExpressionToChange;\r\n                _newParameterExpression = newParameterExpression;\r\n            }\r\n\r\n\r\n            protected override Expression VisitParameter(ParameterExpression node)\r\n            {\r\n                if (node == _parameterExpressionToChange)\r\n                    return _newParameterExpression;\r\n                    \r\n                return node;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/GenericAddDataActionNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class GenericAddDataActionNode : ActionNode\r\n    {\r\n        /// <exclude />\r\n        public Type InterfaceType { get; internal set; }            // Requried\r\n\r\n        /// <exclude />\r\n        public string CustomFormMarkupPath { get; internal set; }   // Optional\r\n\r\n\r\n        // Cached\r\n        private List<ParentIdEntry> ParentIdEntries { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            var payload = new StringBuilder();\r\n            this.Serialize(payload);\r\n\r\n            if (this.ParentIdEntries.Count > 0)\r\n            {\r\n                List<EntityToken> entityTokens = dynamicContext.Piggybag.GetParentEntityTokens().ToList();\r\n                entityTokens.Reverse(); \r\n\r\n                entityTokens.Add(dynamicContext.CurrentEntityToken);\r\n                entityTokens.Add(entityToken);\r\n\r\n                entityTokens.Reverse();\r\n\r\n                foreach (ParentIdEntry parentIdEntry in this.ParentIdEntries)\r\n                {\r\n                    DataEntityToken dataEntityToken = entityTokens.FindDataEntityToken(parentIdEntry.TargetInterface);\r\n                    if (dataEntityToken == null) continue;\r\n\r\n                    IData data = dataEntityToken.Data;\r\n\r\n                    object keyValue = parentIdEntry.TargetPropertyInfo.GetValue(data, null);\r\n\r\n                    StringConversionServices.SerializeKeyValuePair(payload, parentIdEntry.SourcePropertyName, keyValue);\r\n                }\r\n            }\r\n\r\n            StringConversionServices.SerializeKeyValuePair(payload, \"_InterfaceType_\", InterfaceType);\r\n            StringConversionServices.SerializeKeyValuePair(payload, \"_IconResourceName_\", Icon.ResourceName);\r\n\r\n            if (!String.IsNullOrEmpty(CustomFormMarkupPath))\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(payload, \"_CustomFormMarkupPath_\", CustomFormMarkupPath);\r\n            }\r\n\r\n            actionAdder(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.GenericAddDataWorkflow\"), this.PermissionTypes)\r\n            {\r\n                Payload = payload.ToString(),\r\n                DoIgnoreEntityTokenLocking = true,\r\n                ExtraPayload = PiggybagSerializer.Serialize(dynamicContext.Piggybag.PreparePiggybag(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken))\r\n            }))\r\n            {\r\n                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n            });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnInitialize()\r\n        {\r\n            if (this.InterfaceType != null && !typeof(IData).IsAssignableFrom(this.InterfaceType))\r\n            {\r\n                AddValidationError(\"TreeValidationError.Common.NotImplementingIData\", this.InterfaceType, typeof(IData));\r\n            }\r\n\r\n            this.ParentIdEntries = new List<ParentIdEntry>();\r\n\r\n            IEnumerable<TreeNode> treeNodes = this.OwnerNode.Descendants(true).ToList();\r\n            foreach (TreeNode treeNode in treeNodes)\r\n            {\r\n                DataFilteringTreeNode dataFilteringTreeNode = treeNode as DataFilteringTreeNode;\r\n\r\n                if (dataFilteringTreeNode == null) continue;\r\n\r\n                IEnumerable<ParentIdFilterNode> parentIdFilterNodes = dataFilteringTreeNode.FilterNodes.OfType<ParentIdFilterNode>().Evaluate();\r\n                if (!parentIdFilterNodes.Any()) continue;\r\n\r\n                foreach (ParentIdFilterNode parentIdFilterNode in parentIdFilterNodes)\r\n                {\r\n                    Type interfaceType = parentIdFilterNode.ParentFilterType;\r\n\r\n                    IEnumerable<ForeignPropertyInfo> foreignPropertyInfos = DataReferenceFacade.GetForeignKeyProperties(this.InterfaceType, interfaceType);\r\n\r\n                    foreach (ForeignPropertyInfo foreignPropertyInfo in foreignPropertyInfos)\r\n                    {\r\n                        var parentIdEntry = new ParentIdEntry(\r\n                            interfaceType,\r\n                            foreignPropertyInfo.TargetKeyPropertyInfo,\r\n                            foreignPropertyInfo.SourcePropertyName\r\n                        );\r\n\r\n                        if (!this.ParentIdEntries.Contains(parentIdEntry))\r\n                        {\r\n                            this.ParentIdEntries.Add(parentIdEntry);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(this.CustomFormMarkupPath))\r\n            {\r\n                this.CustomFormMarkupPath = LoadAndValidateCustomFormMarkupPath(CustomFormMarkupPath);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return $\"GenericAddDataActionNode, InterfaceType = {this.InterfaceType}, Label = {this.Label}\";\r\n        }\r\n\r\n\r\n\r\n        [DebuggerDisplay(\"{SourcePropertyName} -> {TargetInterface}\")]\r\n        private sealed class ParentIdEntry\r\n        {\r\n            public ParentIdEntry(Type targetInterface, PropertyInfo targetPropertyInfo, string sourcePropertyName)\r\n            {\r\n                TargetInterface = targetInterface;\r\n                TargetPropertyInfo = targetPropertyInfo;\r\n                SourcePropertyName = sourcePropertyName;\r\n            } \r\n\r\n            public Type TargetInterface { get; }\r\n            public PropertyInfo TargetPropertyInfo { get; }\r\n            public string SourcePropertyName { get; }\r\n\r\n            public override bool Equals(object obj)\r\n            {\r\n                return Equals(obj as ParentIdEntry);\r\n            }\r\n\r\n            private bool Equals(ParentIdEntry parentIdEntry)\r\n            {\r\n                if (parentIdEntry == null) return false;\r\n\r\n                return\r\n                    parentIdEntry.TargetInterface == this.TargetInterface &&\r\n                    parentIdEntry.TargetPropertyInfo == this.TargetPropertyInfo &&\r\n                    parentIdEntry.SourcePropertyName == this.SourcePropertyName;\r\n            }\r\n\r\n            public override int GetHashCode()\r\n            {\r\n                return this.TargetInterface.GetHashCode() ^ this.TargetPropertyInfo.GetHashCode() ^ this.SourcePropertyName.GetHashCode();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/GenericDeleteDataActionNode.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n\tinternal sealed class GenericDeleteDataActionNode : ActionNode\r\n\t{\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            actionAdder(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Delete,this.PermissionTypes)))\r\n            {\r\n                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n            });\r\n        }\r\n\r\n\r\n\r\n        protected override void OnInitialize()\r\n        {\r\n            if ((this.OwnerNode is DataElementsTreeNode) == false)\r\n            {\r\n                AddValidationError(\"TreeValidationError.GenericDeleteDataAction.OwnerIsNotDataNode\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override string ToString()\r\n        {\r\n            return string.Format(\"GenericDeleteDataActionNode, Label = {0}\", this.Label);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/GenericDuplicateDataActionNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class GenericDuplicateDataActionNode : ActionNode\r\n    {\r\n        /// <exclude />\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            Icon = new ResourceHandle(BuildInIconProviderName.ProviderName, \"copy\");\r\n\r\n            actionAdder(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Duplicate,this.PermissionTypes)))\r\n            {\r\n                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n            });\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return $\"GenericDuplicateDataActionNode, Label = {this.Label}\";\r\n        }\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/GenericEditDataActionNode.cs",
    "content": "﻿using System;\r\nusing System.Text;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class GenericEditDataActionNode : ActionNode\r\n    {\r\n        /// <exclude />\r\n        public string CustomFormMarkupPath { get; internal set; }   // Optional\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            var payload = new StringBuilder();\r\n            this.Serialize(payload);\r\n\r\n            StringConversionServices.SerializeKeyValuePair(payload, \"_IconResourceName_\", Icon.ResourceName);\r\n\r\n            if (!String.IsNullOrEmpty(CustomFormMarkupPath))\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(payload, \"_CustomFormMarkupPath_\", CustomFormMarkupPath);\r\n\r\n                actionAdder(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.GenericEditDataWorkflow\"), this.PermissionTypes)\r\n                            {\r\n                                Payload = payload.ToString()\r\n                            }))\r\n                    {\r\n                        VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n                    });\r\n            }\r\n            else\r\n            {\r\n                actionAdder(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Edit, this.PermissionTypes)))\r\n                {\r\n                    VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n                });\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnInitialize()\r\n        {\r\n            if (!(this.OwnerNode is DataElementsTreeNode))\r\n            {\r\n                AddValidationError(\"TreeValidationError.GenericEditDataAction.OwnerIsNotDataNode\");\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(this.CustomFormMarkupPath))\r\n            {\r\n                this.CustomFormMarkupPath = LoadAndValidateCustomFormMarkupPath(CustomFormMarkupPath);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return $\"GenericEditDataActionNode, Label = {this.Label}\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/IEntityTokenContainingParentEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal interface IEntityTokenContainingParentEntityToken\r\n    {\r\n        EntityToken GetParentEntityToken();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/ITreeFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal interface ITreeFacade\r\n    {\r\n        void Initialize();\r\n        Tree GetTree(string treeId);\r\n        IEnumerable<Tree> AllTrees { get; }\r\n        bool HasAttachmentPoints(EntityToken parentEntityToken);\r\n        bool HasPossibleAttachmentPoints(EntityToken parentEntityToken);\r\n        IEnumerable<Tree> GetTreesByEntityToken(EntityToken parentEntityToken);\r\n        bool AddPersistedAttachmentPoint(string treeId, Type interfaceType, object keyValue, ElementAttachingProviderPosition position = ElementAttachingProviderPosition.Top);\r\n        bool RemovePersistedAttachmentPoint(string treeId, Type interfaceType, object keyValue);\r\n        bool AddCustomAttachmentPoint(string treeId, EntityToken entityToken, ElementAttachingProviderPosition position = ElementAttachingProviderPosition.Top);\r\n        Tree LoadTreeFromDom(string treeId, XDocument document);\r\n\r\n        void OnFlush();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/LeafDisplayMode.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// Defines the way an element is shown depending on presense of the child elements\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum LeafDisplayMode\r\n    {\r\n        /// <summary>\r\n        /// Only shows the elements that has child elements; hides all the elements without child elements.\r\n        /// </summary>\r\n        Compact = 0,\r\n\r\n        /// <summary>\r\n        /// Element is always shown, as well as the the \"+\" sign even when element doesn't have any child items. Default value, has the best performance\r\n        /// </summary>\r\n        Lazy = 1,\r\n\r\n        /// <summary>\r\n        /// Element is always shown, the \"+\" sign is shown only if there're child elements.\r\n        /// </summary>\r\n        Auto = 2\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class LeafDisplayModeHelper\r\n    {\r\n        /// <exclude />\r\n        public static LeafDisplayMode ParseDisplayMode(XAttribute attribute, Tree tree)\r\n        {\r\n            if (attribute != null)\r\n            {\r\n                LeafDisplayMode parsedValue;\r\n\r\n                if (Enum.TryParse(attribute.Value, out parsedValue))\r\n                {\r\n                    return parsedValue;\r\n                }\r\n\r\n                tree.AddValidationError(attribute.GetXPath(), \"TreeValidationError.Common.WrongAttributeValue\", attribute.Value);\r\n            }\r\n\r\n            return LeafDisplayMode.Lazy;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Trees/MessageBoxActionNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal class MessageBoxActionNode : ActionNode\r\n    {\r\n        public string Title { get; set; }                                   // Required\r\n        public string Message { get; set; }                                 // Required\r\n        public DialogType DialogType { get; set; }                          // Optional        \r\n\r\n        // Cached values\r\n        private DynamicValuesHelper TitleDynamicValuesHelper { get; set; }\r\n        private DynamicValuesHelper MessageDynamicValuesHelper { get; set; }\r\n\r\n\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            ActionToken actionToken = new MessageBoxActionNodeActionToken(\r\n                this.TitleDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext),\r\n                this.MessageDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext),\r\n                this.Serialize(), \r\n                this.PermissionTypes\r\n                );\r\n\r\n            ElementAction elementAction = new ElementAction(new ActionHandle(actionToken))\r\n            {\r\n                VisualData = this.CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n            };\r\n\r\n            elementAction.VisualData.ActionLocation = this.Location;\r\n\r\n            actionAdder(elementAction);\r\n        }\r\n\r\n\r\n\r\n        protected override void OnInitialize()\r\n        {\r\n            this.TitleDynamicValuesHelper = new DynamicValuesHelper(this.Title);\r\n            this.TitleDynamicValuesHelper.Initialize(this.OwnerNode);\r\n\r\n            this.MessageDynamicValuesHelper = new DynamicValuesHelper(this.Message);\r\n            this.MessageDynamicValuesHelper.Initialize(this.OwnerNode);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class MessageBoxActionNodeActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            MessageBoxActionNodeActionToken messageBoxActionNodeActionToken = (MessageBoxActionNodeActionToken)actionToken;\r\n\r\n            MessageBoxActionNode messageBoxActionNode = (MessageBoxActionNode)ActionNode.Deserialize(messageBoxActionNodeActionToken.SerializedActionNode);            \r\n\r\n            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            managementConsoleMessageService.ShowMessage(\r\n                messageBoxActionNode.DialogType, \r\n                messageBoxActionNodeActionToken.Title, \r\n                messageBoxActionNodeActionToken.Message);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [ActionExecutor(typeof(MessageBoxActionNodeActionExecutor))]\r\n    internal sealed class MessageBoxActionNodeActionToken : ActionToken\r\n    {\r\n        private List<PermissionType> _permissionTypes;\r\n\r\n\r\n        public MessageBoxActionNodeActionToken(string title, string message, string serializedActionNode, List<PermissionType> permissionTypes)\r\n        {\r\n            this.Title = title;\r\n            this.Message = message;\r\n            _permissionTypes = permissionTypes;\r\n            this.SerializedActionNode = serializedActionNode;\r\n        }\r\n\r\n        public string Title { get; private set; }\r\n        public string Message { get; private set; }\r\n        public string SerializedActionNode { get; private set; }        \r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"Title\", this.Title);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"Message\", this.Message);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"SerializedActionNode\", this.SerializedActionNode);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"PermissionTypes\", _permissionTypes.SerializePermissionTypes());            \r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n            return new MessageBoxActionNodeActionToken\r\n            (\r\n                StringConversionServices.DeserializeValueString(dic[\"Title\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"Message\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"SerializedActionNode\"]),\r\n                StringConversionServices.DeserializeValueString(dic[\"PermissionTypes\"]).DesrializePermissionTypes().ToList()\r\n            );\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/OrderByNode.cs",
    "content": "﻿using System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class OrderByNode\r\n    {\r\n        /// <exclude />\r\n        public string XPath { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public DataElementsTreeNode OwnerNode { get; internal set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates OrderBy expression.\r\n        /// </summary>\r\n        /// <param name=\"sourceExpression\">The source expression.</param>\r\n        /// <param name=\"parameterExpression\">The parameter expression.</param>\r\n        /// <param name=\"first\">Implementations of this class should use this parameter to distinguish between OrderBy and ThenBy</param>\r\n        /// <returns></returns>\r\n        public abstract Expression CreateOrderByExpression(Expression sourceExpression, ParameterExpression parameterExpression, bool first);\r\n\r\n\r\n        /// <summary>\r\n        /// Use this method to do initializing and validation\r\n        /// </summary>\r\n        internal virtual void Initialize() { }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void SetOwnerNode(TreeNode treeNode)\r\n        {\r\n            this.OwnerNode = (DataElementsTreeNode)treeNode;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void AddValidationError(string stringName, params object[] args)\r\n        {\r\n            this.OwnerNode.Tree.BuildResult.AddValidationError(ValidationError.Create(this.XPath, stringName, args));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/ParentIdFilterNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Data;\r\nusing Composite.Core.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal class ParentIdFilterNode : FilterNode\r\n    {\r\n        public Type ParentFilterType { get; internal set; }     // Required\r\n        public string ReferenceFieldName { get; internal set; } // Required\r\n\r\n\r\n        public DataElementsTreeNode ParentFilterTypeTreeNode { get; internal set; }\r\n\r\n\r\n        internal PropertyInfo KeyPropertyInfo { get; set; }\r\n        internal PropertyInfo ReferencePropertyInfo { get; set; }\r\n\r\n\r\n        public override Expression CreateDownwardsFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            IData parentDataItem = GetParentDataItem(this.ParentFilterType, dynamicContext.CurrentEntityToken, dynamicContext);\r\n            if (parentDataItem == null) return null;\r\n\r\n            object parentFieldValue = this.KeyPropertyInfo.GetValue(parentDataItem, null);\r\n\r\n            Expression expression = Expression.Equal(ExpressionHelper.CreatePropertyExpression(this.ReferenceFieldName, parameterExpression), Expression.Constant(parentFieldValue, this.ReferencePropertyInfo.PropertyType));\r\n\r\n            if (ReferencePropertyInfo.PropertyType.IsGenericType && ReferencePropertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n            {\r\n                PropertyInfo propertyInfo = ReferencePropertyInfo.PropertyType.GetProperty(\"HasValue\");\r\n\r\n                Expression hasValueExpression = Expression.Property(Expression.Property(parameterExpression, this.ReferenceFieldName), propertyInfo);\r\n\r\n                expression = Expression.AndAlso(hasValueExpression, expression);\r\n            }\r\n\r\n            return expression;\r\n        }\r\n\r\n\r\n\r\n        private bool IsInParentTree(TreeNode treeNode)\r\n        {\r\n            TreeNode searchTreeNode = treeNode.ParentNode;\r\n            while (searchTreeNode != null)\r\n            {\r\n                var node = searchTreeNode as DataElementsTreeNode;\r\n                if (node != null)\r\n                {\r\n                    if (node.InterfaceType == this.OwnerNode.InterfaceType)\r\n                    {\r\n                        // Found in parent tree.\r\n                        return true;\r\n                    }\r\n\r\n                    searchTreeNode = searchTreeNode.ParentNode;\r\n                }\r\n                else\r\n                {\r\n                    searchTreeNode = searchTreeNode.ParentNode;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method finds the callers tree node own entity token by searching up/down using filters.\r\n        /// In some cases this can be expensive.\r\n        /// </summary>\r\n        /// <param name=\"treeNode\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"dynamicContext\"></param>\r\n        /// <returns></returns>\r\n        private EntityToken FindOwnEntityToken(TreeNode treeNode, EntityToken entityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            DataElementsTreeNode dataElementsTreeNode = treeNode as DataElementsTreeNode;\r\n            if (dataElementsTreeNode != null)\r\n            {\r\n                if (dataElementsTreeNode.InterfaceType == this.OwnerNode.InterfaceType) // We found it :)\r\n                {\r\n                    return entityToken;\r\n                }\r\n            }\r\n\r\n\r\n            TreeDataFieldGroupingElementEntityToken dataFieldGroupingElementEntityToken = entityToken as TreeDataFieldGroupingElementEntityToken;\r\n            if (dataFieldGroupingElementEntityToken != null) // Search 'downwards'\r\n            {\r\n\r\n                ParameterExpression parameterExpression = Expression.Parameter(this.OwnerNode.InterfaceType, \"data\");\r\n\r\n                DataKeyPropertyCollection dataKeyPropertyCollection = new DataKeyPropertyCollection();\r\n                dataKeyPropertyCollection.AddKeyProperty(\"Id\", dataFieldGroupingElementEntityToken.ChildGeneratingDataElementsReferenceValue);\r\n\r\n                Type dataType = dataFieldGroupingElementEntityToken.ChildGeneratingDataElementsReferenceType;\r\n\r\n                IData parentData = DataFacade.GetDataByUniqueKey(dataType, dataKeyPropertyCollection);\r\n\r\n                TreeNodeDynamicContext dummyContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down);\r\n                dummyContext.CustomData.Add(\"ParentData\", parentData);\r\n\r\n                IData resultData;\r\n                if (this.OwnerNode.InterfaceType == TypeManager.GetType(dataFieldGroupingElementEntityToken.Type))\r\n                {\r\n                    Expression filterExpression = this.CreateDownwardsFilterExpression(parameterExpression, dummyContext);\r\n\r\n                    Expression whereExpression = ExpressionHelper.CreateWhereExpression(DataFacade.GetData(this.OwnerNode.InterfaceType).Expression, parameterExpression, filterExpression);\r\n\r\n                    resultData = (IData)DataFacade.GetData(this.OwnerNode.InterfaceType).Provider.CreateQuery(whereExpression).ToEnumerableOfObjects().First();\r\n                }\r\n                else\r\n                {\r\n                    resultData = parentData;\r\n                }\r\n\r\n                return resultData.GetDataEntityToken();\r\n            }\r\n\r\n\r\n            AncestorResult ancestorResult = treeNode.GetParentEntityToken(entityToken, this.ParentFilterType, dynamicContext);\r\n\r\n            if ((this.OwnerNode.Id == ancestorResult.TreeNode.Id) || (this.OwnerNode.IsDescendant(ancestorResult.TreeNode))) // Search upwards\r\n            {\r\n                return FindOwnEntityToken(ancestorResult.TreeNode, ancestorResult.EntityToken, dynamicContext);\r\n            }\r\n\r\n\r\n            // Search 'downwards' by using the parent datas key value to get \r\n            DataElementsTreeNode parentDataElementsTreeNode = (DataElementsTreeNode)ancestorResult.TreeNode;\r\n            if (this.ParentFilterType == parentDataElementsTreeNode.InterfaceType)\r\n            {\r\n                DataEntityToken dataEntityToken = (DataEntityToken)ancestorResult.EntityToken;\r\n\r\n                ParameterExpression parameterExpression = Expression.Parameter(this.OwnerNode.InterfaceType, \"data\");\r\n\r\n                TreeNodeDynamicContext dummyContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down);\r\n                dummyContext.CustomData.Add(\"ParentData\", dataEntityToken.Data);\r\n\r\n                Expression filterExpression = this.CreateDownwardsFilterExpression(parameterExpression, dummyContext);\r\n\r\n                Expression whereExpression = ExpressionHelper.CreateWhereExpression(DataFacade.GetData(this.OwnerNode.InterfaceType).Expression, parameterExpression, filterExpression);\r\n\r\n                IData resultData = (IData)DataFacade.GetData(this.OwnerNode.InterfaceType).Provider.CreateQuery(whereExpression).ToEnumerableOfObjects().First();\r\n\r\n                return resultData.GetDataEntityToken();\r\n            }\r\n\r\n\r\n            throw new InvalidOperationException(\"Missing parent id filtering or try to simplify the parent id filterings (Unable to find own entity token)\");\r\n        }\r\n\r\n\r\n\r\n\r\n        internal object FindParentKeyValue(TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            if ((dynamicContext.CurrentEntityToken is DataEntityToken))\r\n            {\r\n                DataEntityToken currentDataEntityToken = dynamicContext.CurrentEntityToken as DataEntityToken;\r\n                if (currentDataEntityToken.InterfaceType == this.ParentFilterType)\r\n                {\r\n                    return this.KeyPropertyInfo.GetValue(currentDataEntityToken.Data, null);\r\n                }\r\n            }\r\n\r\n            EntityToken ownFilterEntityToken = FindOwnEntityToken(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken, dynamicContext);\r\n\r\n            DataEntityToken dataEntityToken = (DataEntityToken)ownFilterEntityToken;\r\n\r\n            IData data = dataEntityToken.Data;\r\n\r\n            object parentFieldValue = this.ReferencePropertyInfo.GetValue(data, null);\r\n\r\n            return parentFieldValue;\r\n        }\r\n\r\n\r\n\r\n        public override Expression CreateUpwardsFilterExpression(ParameterExpression parameterExpression, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            // To create a upwards filter, we need the parent key value to filter on our own reference value (by constant)\r\n            // To do this we need the parent entity token or our own entity token\r\n            object parentFieldValue = FindParentKeyValue(dynamicContext);\r\n\r\n            var constantType = this.ReferencePropertyInfo.PropertyType;\r\n            if (constantType.IsGenericType && constantType.GetGenericTypeDefinition() == typeof (Nullable<>))\r\n            {\r\n                constantType = constantType.GetGenericArguments()[0];\r\n            }\r\n\r\n            return Expression.Equal(ExpressionHelper.CreatePropertyExpression(this.KeyPropertyInfo.Name, parameterExpression), \r\n                                    Expression.Constant(parentFieldValue, constantType)); \r\n        }\r\n\r\n\r\n\r\n        internal override void Initialize()\r\n        {\r\n            foreach (TreeNode treeNode in this.OwnerNode.Ancestors(true))\r\n            {\r\n                DataElementsTreeNode dataElementsTreeNode = treeNode as DataElementsTreeNode;\r\n\r\n                if (dataElementsTreeNode != null && dataElementsTreeNode.InterfaceType == this.ParentFilterType)\r\n                {\r\n                    this.ParentFilterTypeTreeNode = dataElementsTreeNode;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            bool dataItemAttachmentPointExists =\r\n                this.OwnerNode.Tree.AttachmentPoints.OfType<IDataItemAttachmentPoint>().Any(f => f.InterfaceType == this.ParentFilterType)\r\n                || this.OwnerNode.Tree.PossibleAttachmentPoints.OfType<IDataItemAttachmentPoint>().Any(f => f.InterfaceType == this.ParentFilterType);\r\n\r\n            if (this.ParentFilterTypeTreeNode != null || dataItemAttachmentPointExists)\r\n            {\r\n                this.KeyPropertyInfo = this.ParentFilterType.GetKeyProperties()[0];\r\n            }\r\n\r\n            if (this.KeyPropertyInfo == null)\r\n            {\r\n                AddValidationError(\"TreeValidationError.ParentIdFilterNode.TypeIsNotInParentTree\", this.ParentFilterType);\r\n            }\r\n\r\n            this.ReferencePropertyInfo = this.OwnerNode.InterfaceType.GetPropertiesRecursively().SingleOrDefault(f => f.Name == this.ReferenceFieldName);\r\n\r\n            if (this.ReferencePropertyInfo == null)\r\n            {\r\n                AddValidationError(\"TreeValidationError.Common.MissingProperty\", this.OwnerNode.InterfaceType, this.ReferenceFieldName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override string ToString()\r\n        {\r\n            if (this.ParentFilterTypeTreeNode != null)\r\n            {\r\n                return string.Format(\"ParentIdFilterNode, ParentFilterType = {0}, ReferenceFieldName = {1}, ParentFilterTreeNodeId = {2}\", this.ParentFilterType, this.ReferenceFieldName, this.ParentFilterTypeTreeNode.Id);\r\n            }\r\n            \r\n            return string.Format(\"ParentIdFilterNode, ParentFilterType = {0}, ReferenceFieldName = {1}\", this.ParentFilterType, this.ReferenceFieldName);\r\n        }\r\n\r\n\r\n\r\n        private object Find(TreeNode currentTreeNode, EntityToken currentEntityToken)\r\n        {\r\n            if (this.OwnerNode.IsAncestor(currentTreeNode)) // Is parent\r\n            {\r\n                return currentTreeNode;\r\n            }\r\n\r\n            if (this.OwnerNode.Id != currentTreeNode.Id) // Is child\r\n            {\r\n                IEnumerable<ParentIdFilterNode> parentIdFilterNodes = currentTreeNode.FilterNodes.OfType<ParentIdFilterNode>();\r\n\r\n                foreach (ParentIdFilterNode parentIdFilterNode in parentIdFilterNodes)\r\n                {\r\n                    Find(parentIdFilterNode.ParentFilterTypeTreeNode, null);\r\n                }\r\n            }\r\n\r\n            foreach (TreeNode childTreeNode in this.OwnerNode.ChildNodes)\r\n            {\r\n                object res = Find(childTreeNode, null);\r\n                if (res != null)\r\n                {\r\n                    return res;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private IData GetParentDataItem(Type parentType, EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            if (dynamicContext.CustomData.ContainsKey(\"ParentData\"))\r\n            {\r\n                return (IData)dynamicContext.CustomData[\"ParentData\"];\r\n            }\r\n\r\n            IData parentDataItem = null;\r\n            if (parentEntityToken is DataEntityToken)\r\n            {\r\n                DataEntityToken dataEntityToken = parentEntityToken as DataEntityToken;\r\n                Type type = dataEntityToken.InterfaceType;\r\n                if (type == parentType)\r\n                {\r\n                    return dataEntityToken.Data;\r\n                }\r\n            }\r\n\r\n            if (parentDataItem == null)\r\n            {\r\n                foreach (EntityToken entityToken in dynamicContext.Piggybag.GetParentEntityTokens())\r\n                {\r\n                    DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n\r\n                    if (dataEntityToken == null) continue;\r\n\r\n                    Type type = dataEntityToken.InterfaceType;\r\n                    if (type != parentType) continue;\r\n\r\n                    return dataEntityToken.Data;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/PiggybagDataFinder.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PiggybagDataFinder\r\n    {\r\n        private List<EntityToken> _parentEntityTokens;\r\n\r\n        private readonly Dictionary<string, string> _piggybag;\r\n        private readonly EntityToken _currentEntityToken;\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public PiggybagDataFinder(Dictionary<string, string> piggybag, EntityToken currentEntityToken)\r\n        {\r\n            _piggybag = piggybag;\r\n            _currentEntityToken = currentEntityToken;\r\n        }\r\n\r\n\r\n         \r\n        /// <exclude />\r\n        public Dictionary<string, string> Piggybag\r\n        {\r\n            get\r\n            {\r\n                return _piggybag;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IData GetData(Type interfaceType, IData currentData = null)\r\n        {\r\n            if ((currentData != null) && (currentData.DataSourceId.InterfaceType == interfaceType)) return currentData;\r\n\r\n            DataEntityToken dataEntityToken = GetDataEntityToken(interfaceType);\r\n\r\n            return dataEntityToken.Data;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IData TryGetData(Type interfaceType, IData currentData = null)\r\n        {\r\n            if ((currentData != null) && (currentData.DataSourceId.InterfaceType == interfaceType)) return currentData;\r\n\r\n            DataEntityToken dataEntityToken = TryGetDataEntityToken(interfaceType);            \r\n            if (dataEntityToken == null) return null;\r\n\r\n            return dataEntityToken.Data;\r\n        }\r\n\r\n\r\n\r\n\r\n        private DataEntityToken GetDataEntityToken(Type interfaceType)\r\n        {\r\n            DataEntityToken dataEntityToken = TryGetDataEntityToken(interfaceType);\r\n\r\n            if ((dataEntityToken == null) || (dataEntityToken.InterfaceType != interfaceType)) throw new InvalidOperationException(\"Could not find data entity token that match the given interface type\");            \r\n\r\n            return dataEntityToken;\r\n        }\r\n\r\n\r\n\r\n        private DataEntityToken TryGetDataEntityToken(Type interfaceType)\r\n        {\r\n            DataEntityToken dataEntityToken = _currentEntityToken as DataEntityToken;\r\n            if ((dataEntityToken == null) || (dataEntityToken.InterfaceType != interfaceType))\r\n            {\r\n                dataEntityToken = this.ParentEntityTokens.FindDataEntityToken(interfaceType);\r\n            }            \r\n\r\n            return dataEntityToken;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<EntityToken> ParentEntityTokens\r\n        {\r\n            get\r\n            {\r\n                if (_parentEntityTokens == null)\r\n                {\r\n                    _parentEntityTokens = _piggybag.GetParentEntityTokens().ToList();\r\n                }\r\n\r\n                return _parentEntityTokens;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/PiggybagExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PiggybagExtensionMethods\r\n    {\r\n        private const string ParentEntityTokenPiggybagString = \"ParentEntityToken\";\r\n        private const string ParentNodeIdPiggybagString = \"ParentId\";\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetParentIdFromPiggybag(this Dictionary<string, string> piggybag)\r\n        {\r\n            return GetParentIdFromPiggybag(piggybag, 1);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetParentIdFromPiggybag(this Dictionary<string, string> piggybag, int generation)\r\n        {\r\n            return piggybag[string.Format(\"{0}{1}\", ParentNodeIdPiggybagString, generation)];\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<string, string> PreparePiggybag(this Dictionary<string, string> piggybag, TreeNode parentNode, EntityToken parentEntityToken)\r\n        {\r\n            var newPiggybag = new Dictionary<string, string>();\r\n\r\n            foreach (KeyValuePair<string, string> kvp in piggybag)\r\n            {\r\n                if (kvp.Key.StartsWith(ParentEntityTokenPiggybagString))\r\n                {\r\n                    int generation = int.Parse(kvp.Key.Substring(ParentEntityTokenPiggybagString.Length));\r\n\r\n                    generation += 1;\r\n\r\n                    newPiggybag.Add(string.Format(\"{0}{1}\", ParentEntityTokenPiggybagString, generation), kvp.Value);\r\n                }\r\n                else if (kvp.Key.StartsWith(ParentNodeIdPiggybagString))\r\n                {\r\n                    int generation = int.Parse(kvp.Key.Substring(ParentNodeIdPiggybagString.Length));\r\n\r\n                    generation += 1;\r\n\r\n                    newPiggybag.Add(string.Format(\"{0}{1}\", ParentNodeIdPiggybagString, generation), kvp.Value);\r\n                }\r\n                else\r\n                {\r\n                    newPiggybag.Add(kvp.Key, kvp.Value);\r\n                }\r\n            }\r\n\r\n            newPiggybag.Add(string.Format(\"{0}1\", ParentEntityTokenPiggybagString), EntityTokenSerializer.Serialize(parentEntityToken));\r\n            newPiggybag.Add(string.Format(\"{0}1\", ParentNodeIdPiggybagString), parentNode.Id.ToString());\r\n\r\n            return newPiggybag;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetPiggybaggedEntityToken(this Dictionary<string, string> piggybag, out EntityToken entityToken)\r\n        {\r\n            return TryGetPiggybaggedEntityToken(piggybag, 1, out entityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetPiggybaggedEntityToken(this Dictionary<string, string> piggybag, int generation, out EntityToken entityToken)\r\n        {\r\n            string key = $\"{ParentEntityTokenPiggybagString}{generation}\";\r\n\r\n            string serializedEntityToken;\r\n            if (!piggybag.TryGetValue(key, out serializedEntityToken))\r\n            {\r\n                entityToken = null;\r\n                return false;\r\n            }\r\n\r\n            entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<EntityToken> GetParentEntityTokens(this Dictionary<string, string> piggybag, EntityToken entityTokenToInclude = null)\r\n        {\r\n            if (entityTokenToInclude != null)\r\n            {\r\n                yield return entityTokenToInclude;\r\n            }\r\n\r\n            int generation = 1;\r\n\r\n            string serializedEntityToken;\r\n            while (piggybag.TryGetValue($\"{ParentEntityTokenPiggybagString}{generation}\", out serializedEntityToken))\r\n            {\r\n                yield return EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n                generation++;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static DataEntityToken FindDataEntityToken(this IEnumerable<EntityToken> entityTokens, Type interfaceType)\r\n        {\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n                if (dataEntityToken == null) continue;\r\n\r\n                if (dataEntityToken.InterfaceType == interfaceType)\r\n                {\r\n                    return dataEntityToken;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/ReportFunctionActionNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Functions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class ReportFunctionActionNode : ActionNode\r\n\t{\r\n        /// <exclude />\r\n        public XElement FunctionMarkup { get; set; }                            // Required\r\n        \r\n        /// <exclude />\r\n        public string DocumentLabel { get; set; }                               // Optional, defaults to Label\r\n\r\n        /// <exclude />\r\n        public ResourceHandle DocumentIcon { get; set; }                        // Optional, defaults to Icon\r\n\r\n\r\n        /// <exclude />\r\n        public AttributeDynamicValuesHelper FunctionMarkupDynamicValuesHelper { get; private set; }\r\n\r\n        /// <exclude />\r\n        public DynamicValuesHelper DocumentLabelDynamicValueHelper { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            StringBuilder payload = new StringBuilder();\r\n            StringConversionServices.SerializeKeyValuePair(payload, \"TreeId\", this.OwnerNode.Tree.TreeId);\r\n            StringConversionServices.SerializeKeyValuePair(payload, \"ActionId\", this.Id);\r\n\r\n            WorkflowActionToken actionToken = new WorkflowActionToken(\r\n                WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.ReportFunctionActionWorkflow\"), \r\n                this.PermissionTypes)                \r\n            {\r\n                Payload = this.Serialize(),\r\n                ExtraPayload = PiggybagSerializer.Serialize(dynamicContext.Piggybag.PreparePiggybag(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken)),\r\n                DoIgnoreEntityTokenLocking = true\r\n            };\r\n            \r\n\r\n            actionAdder(new ElementAction(new ActionHandle(actionToken))\r\n            {\r\n                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n            });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnInitialize()\r\n        {\r\n            try\r\n            {\r\n                FunctionTreeBuilder.Build(this.FunctionMarkup);\r\n            }\r\n            catch\r\n            {\r\n                AddValidationError(\"TreeValidationError.Common.WrongFunctionMarkup\");\r\n                return;\r\n            }            \r\n\r\n            this.FunctionMarkupDynamicValuesHelper = new AttributeDynamicValuesHelper(this.FunctionMarkup);\r\n            this.FunctionMarkupDynamicValuesHelper.Initialize(this.OwnerNode);\r\n\r\n            this.DocumentLabelDynamicValueHelper = new DynamicValuesHelper(this.DocumentLabel);\r\n            this.DocumentLabelDynamicValueHelper.Initialize(this.OwnerNode);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return string.Format(\"ReportFunctionActionNode, Label = {0}\", this.Label);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/RootTreeNode.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>\r\n    /// This node is a virtual node represending the element that the tree is attached under.\r\n    /// </summary>    \r\n    internal class RootTreeNode : TreeNode\r\n    {\r\n        public RootTreeNode()\r\n        {\r\n            this.Id = StringConstants.RootNodeId;\r\n        }\r\n\r\n        private class AncestorMatch\r\n        {\r\n            public Type InterfaceType;\r\n            public object KeyValue;\r\n        }\r\n\r\n\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            TreeSimpleElementEntityToken treeSimpleElementEntityToken = childEntityToken as TreeSimpleElementEntityToken;\r\n            if (treeSimpleElementEntityToken != null)\r\n            {\r\n                yield return treeSimpleElementEntityToken.ParentEntityToken;\r\n            }\r\n            else\r\n            {\r\n                AncestorMatch ancestorFromFilter = GetAncestorFromParentFilter(dynamicContext);\r\n\r\n                foreach (IAttachmentPoint attachmentPoint in this.Tree.AttachmentPoints)\r\n                {\r\n                    if(attachmentPoint is DynamicDataItemAttachmentPoint \r\n                        && ancestorFromFilter != null)\r\n                    {\r\n                        var dynamicAttachmentPoint = attachmentPoint as DynamicDataItemAttachmentPoint;\r\n\r\n                        if (ancestorFromFilter.InterfaceType == dynamicAttachmentPoint.InterfaceType)\r\n                        {\r\n                            if (dynamicAttachmentPoint.KeyValue.Equals(ancestorFromFilter.KeyValue))\r\n                            {\r\n                                foreach (var e in dynamicAttachmentPoint.GetEntityTokens(null, null)) {\r\n                                    yield return e;\r\n                                }\r\n                            }\r\n                            continue;\r\n                        }\r\n                    }\r\n\r\n                    foreach (EntityToken entityToken in attachmentPoint.GetEntityTokens(childEntityToken, dynamicContext))\r\n                    {\r\n                        yield return entityToken;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private AncestorMatch GetAncestorFromParentFilter(TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            var treeNode = dynamicContext.CurrentTreeNode;\r\n            if (treeNode is DataElementsTreeNode)\r\n            {\r\n                var parentIdFilter = treeNode.FilterNodes.OfType<ParentIdFilterNode>().FirstOrDefault();\r\n                if (parentIdFilter == null) return null;\r\n\r\n                Type ancestorType = parentIdFilter.ParentFilterType;\r\n                object key = parentIdFilter.FindParentKeyValue(dynamicContext);\r\n\r\n                return key == null ? null : new AncestorMatch { InterfaceType = ancestorType, KeyValue = key};\r\n            }\r\n\r\n            if (treeNode is DataFolderElementsTreeNode\r\n                && dynamicContext.CurrentEntityToken is TreeDataFieldGroupingElementEntityToken groupEntityToken\r\n                && groupEntityToken.ChildGeneratingDataElementsReferenceValue != null)\r\n            {\r\n                return new AncestorMatch\r\n                {\r\n                    InterfaceType = groupEntityToken.ChildGeneratingDataElementsReferenceType,\r\n                    KeyValue = groupEntityToken.ChildGeneratingDataElementsReferenceValue\r\n                };\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        public override AncestorResult GetParentEntityToken(EntityToken childEntityToken, Type parentInterfaceOfInterest, TreeNodeDynamicContext dynamicContext)\r\n        {            \r\n            throw new NotImplementedException(\"Should never get called\");            \r\n        }\r\n\r\n\r\n        protected override IEnumerable<Element> OnGetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            foreach (TreeNode childTreeNode in this.ChildNodes)\r\n            {\r\n                foreach (Element element in childTreeNode.GetElements(parentEntityToken, dynamicContext))\r\n                {                    \r\n                    element.ElementHandle.Piggyback[StringConstants.PiggybagTreeId] = this.Tree.TreeId;\r\n                    \r\n                    yield return element;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override string ToString()\r\n        {\r\n            return \"RootTreeNode, Id = \" + this.Id;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/SimpleElementTreeNode.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{    \r\n    internal class SimpleElementTreeNode : TreeNode\r\n    {\r\n        public string Label { get; internal set; }              // Requried\r\n        public string ToolTip { get; internal set; }            // Defaults to Label\r\n        public ResourceHandle Icon { get; internal set; }       // Defaults to 'folder'\r\n        public ResourceHandle OpenIcon { get; internal set; }   // Defaults to 'open-folder' or if Icon is set, then, Icon\r\n        public string BrowserUrl { get; internal set; }         // Defaults to no URL, what will be shows in console browser on focus\r\n        public string BrowserImage { get; internal set; }         // Defaults to no (image) URL, what will be shows in console browser on focus / lists\r\n\r\n        // Cached values\r\n        internal DynamicValuesHelper LabelDynamicValuesHelper { get; set; }\r\n        internal DynamicValuesHelper ToolTipDynamicValuesHelper { get; set; }\r\n\r\n\r\n        public override IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            var possibleCurrentEntityToken = childEntityToken is TreeSimpleElementEntityToken seEntityToken\r\n                ? seEntityToken.ParentEntityToken \r\n                : childEntityToken;\r\n\r\n            foreach (EntityToken entityToken in this.ParentNode.GetEntityTokens(possibleCurrentEntityToken, dynamicContext))\r\n            {\r\n                yield return new TreeSimpleElementEntityToken(this.Id, this.Tree.TreeId, EntityTokenSerializer.Serialize(entityToken));\r\n            }\r\n        }\r\n\r\n\r\n        internal override IEnumerable<EntityToken> FilterParentGeneretedEntityTokens(EntityToken selfEntityToken, IEnumerable<EntityToken> parentGeneretedEntityTokens, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            // Check below ensures that the parent EntityToken actually present in a tree and not been filtered out\r\n\r\n            var treeSimpleElementEntityToken = (TreeSimpleElementEntityToken) selfEntityToken;\r\n            var parentEntityToken = treeSimpleElementEntityToken.ParentEntityToken;\r\n            foreach (EntityToken entityToken in parentGeneretedEntityTokens)\r\n            {\r\n                if (parentEntityToken.Equals(entityToken))\r\n                {\r\n                    return new[] { parentEntityToken };\r\n                }\r\n\r\n                var castedEntityToken = entityToken as TreeSimpleElementEntityToken;\r\n                if (castedEntityToken != null &&\r\n                    parentEntityToken.Equals(castedEntityToken.ParentEntityToken))\r\n                {\r\n                    return new [] { parentEntityToken };\r\n                }\r\n            }\r\n\r\n            return Array.Empty<EntityToken>();\r\n        }\r\n\r\n\r\n        public override AncestorResult GetParentEntityToken(EntityToken ownEntityToken, Type parentInterfaceOfInterest, TreeNodeDynamicContext dynamicContext)\r\n        {            \r\n            return new AncestorResult(this.ParentNode, ((TreeSimpleElementEntityToken)ownEntityToken).ParentEntityToken);\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<Element> OnGetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            var entityToken = new TreeSimpleElementEntityToken(\r\n                this.Id, \r\n                this.Tree.TreeId, \r\n                EntityTokenSerializer.Serialize(parentEntityToken));\r\n\r\n            var element = new Element(new ElementHandle(\r\n                dynamicContext.ElementProviderName,\r\n                entityToken,\r\n                dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken)\r\n                ));\r\n\r\n\r\n            if (this.BrowserUrl != null)\r\n            {\r\n                var url = this.BrowserUrl;\r\n\r\n                if (!url.Contains(\"//\"))\r\n                {\r\n                    url = Core.WebClient.UrlUtils.ResolvePublicUrl(url);\r\n                }\r\n\r\n                element.PropertyBag.Add(\"BrowserUrl\", url);\r\n                element.PropertyBag.Add(\"BrowserToolingOn\", \"false\");\r\n            }\r\n\r\n\r\n            if (this.BrowserImage != null)\r\n            {\r\n                var url = this.BrowserImage;\r\n\r\n                if (!url.Contains(\"//\"))\r\n                {\r\n                    url = Core.WebClient.UrlUtils.ResolvePublicUrl(url);\r\n                }\r\n\r\n                element.PropertyBag.Add(\"ListViewImage\", url);\r\n\r\n                if (this.BrowserUrl == null)\r\n                {\r\n                    element.PropertyBag.Add(\"DetailViewImage\", url);\r\n                }\r\n            }\r\n\r\n\r\n            if (parentEntityToken is TreePerspectiveEntityToken)\r\n            {\r\n                element.ElementHandle.Piggyback[StringConstants.PiggybagTreeId] = Tree.TreeId;\r\n            }\r\n\r\n            var replaceContext = new DynamicValuesHelperReplaceContext(parentEntityToken, dynamicContext.Piggybag);\r\n\r\n            element.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = this.LabelDynamicValuesHelper.ReplaceValues(replaceContext),\r\n                ToolTip = this.ToolTipDynamicValuesHelper.ReplaceValues(replaceContext),\r\n                HasChildren = ChildNodes.Any(),\r\n                Icon = this.Icon,\r\n                OpenedIcon = this.OpenIcon\r\n            };\r\n\r\n            yield return element;\r\n        }\r\n\r\n\r\n        protected override void OnInitialize()\r\n        {\r\n            this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);\r\n            this.LabelDynamicValuesHelper.Initialize(this);\r\n\r\n            this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);\r\n            this.ToolTipDynamicValuesHelper.Initialize(this);\r\n        }\r\n\r\n\r\n        public override string ToString() => $\"SimpleElementTreeNode, Id = {Id}, Label = {Label}\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/SortDirection.cs",
    "content": "﻿namespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>\r\n    /// Specifies how to sort tree elements\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum SortDirection\r\n    {\r\n        /// <summary>\r\n        /// Sort from smallest to largest. For example, A to Z.\r\n        /// </summary>\r\n        Ascending = 0,\r\n        /// <summary>\r\n        /// Sort from largest to smallest. For example, Z to A.\r\n        /// </summary>\r\n        Descending = 1\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/Tree.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\nusing Composite.Core;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// Result of parsing tree definition xml file\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [DebuggerDisplay(\"{TreeId}\")]\r\n    public sealed class Tree\r\n    {\r\n        private static readonly string LogTitle = \"TreeFacade\";\r\n\r\n        /// <exclude />\r\n        public string TreeId { get; private set; }\r\n\r\n        /// <exclude />\r\n        public string AllowedAttachmentApplicationName { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public TreeNode RootTreeNode { get; internal set; }\r\n\r\n\r\n        internal BuildProcessContext BuildProcessContext { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets information about validation erros.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The build result.\r\n        /// </value>\r\n        /// <exclude/>\r\n        public BuildResult BuildResult { get; set; }\r\n\r\n\r\n        // These are used to attach this tree at current/existing places\r\n        internal List<IAttachmentPoint> AttachmentPoints { get; private set; }\r\n        // These are used to determin if a tree CAN be attached to a given place\r\n        internal List<IPossibleAttachmentPoint> PossibleAttachmentPoints { get; private set; }\r\n\r\n\r\n        internal bool ShareRootElementById { get; set; }\r\n\r\n        /// <exclude />\r\n        public Tree(string treeId)\r\n        {\r\n            this.TreeId = treeId;\r\n            this.AttachmentPoints = new List<IAttachmentPoint>();\r\n            this.PossibleAttachmentPoints = new List<IPossibleAttachmentPoint>();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public TreeNode GetTreeNode(string id)\r\n        {\r\n            return FindTreeNode(id, this.RootTreeNode);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ActionNode GetActionNode(int id)\r\n        {\r\n            return FindActionNode(id, this.RootTreeNode);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool HasAttachmentPoints(EntityToken parentEntityToken)\r\n        {\r\n            return this.AttachmentPoints.Any(f => f.IsAttachmentPoint(parentEntityToken));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool HasPossibleAttachmentPoints(EntityToken parentEntityToken)\r\n        {\r\n            return this.PossibleAttachmentPoints.Any(f => f.IsPossibleAttachmentPoint(parentEntityToken));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<IAttachmentPoint> GetAttachmentPoints(EntityToken parentEntityToken)\r\n        {\r\n            return this.AttachmentPoints.Where(f => f.IsAttachmentPoint(parentEntityToken));\r\n        }\r\n\r\n\r\n\r\n        internal void ClearAttachmentPoints<T>()\r\n            where T : IAttachmentPoint\r\n        {\r\n            this.AttachmentPoints = this.AttachmentPoints.Where(f => f.GetType() != typeof(T)).ToList();\r\n        }\r\n\r\n\r\n        internal void AddValidationError(XObject @object, string stringName, params object[] args)\r\n        {\r\n            AddValidationError(@object.GetXPath(), stringName, args);\r\n        }\r\n\r\n\r\n        internal void AddValidationError(string xPath, string stringName, params object[] args)\r\n        {\r\n            this.BuildResult.AddValidationError(ValidationError.Create(xPath, stringName, args));\r\n        }\r\n\r\n\r\n\r\n        private TreeNode FindTreeNode(string id, TreeNode treeNode)\r\n        {\r\n            if (treeNode.Id == id) return treeNode;\r\n\r\n            foreach (TreeNode childTreeNode in treeNode.ChildNodes)\r\n            {\r\n                TreeNode resultTreeNode = FindTreeNode(id, childTreeNode);\r\n                if (resultTreeNode != null)\r\n                {\r\n                    return resultTreeNode;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private ActionNode FindActionNode(int id, TreeNode treeNode)\r\n        {\r\n            ActionNode actionNode = treeNode.ActionNodes.SingleOrDefault(f => f.Id == id);\r\n            if (actionNode != null) return actionNode;\r\n\r\n\r\n            foreach (TreeNode childTreeNode in treeNode.ChildNodes)\r\n            {\r\n                ActionNode resultActionNode = FindActionNode(id, childTreeNode);\r\n                if (resultActionNode != null)\r\n                {\r\n                    return resultActionNode;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void LogTree()\r\n        {\r\n            Log.LogVerbose(LogTitle, string.Format(\"{0} - Tree informations:\", this.TreeId));\r\n\r\n            Log.LogVerbose(LogTitle, \"Attachment points:\");\r\n            AttachmentPoints.ForEach(a => a.Log(LogTitle, indention: \"  \"));\r\n\r\n            Log.LogVerbose(LogTitle, \"Possible attachment points:\");\r\n            PossibleAttachmentPoints.ForEach(a => a.Log(LogTitle, indention: \"  \"));\r\n\r\n            Log.LogVerbose(LogTitle, \"Tree nodes:\");\r\n            this.RootTreeNode.LogTree(1);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeAuxiliaryAncestorProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal sealed class TreeAuxiliaryAncestorProvider : IAuxiliarySecurityAncestorProvider\r\n    {\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            var result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                var dynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Up)\r\n                {\r\n                    CurrentEntityToken = entityToken\r\n                };\r\n\r\n\r\n                if (entityToken is TreeSimpleElementEntityToken\r\n                    || entityToken is TreeFunctionElementGeneratorEntityToken)\r\n                {\r\n                    var parentEntityTokenSource = entityToken as IEntityTokenContainingParentEntityToken;\r\n\r\n                    try\r\n                    {\r\n                        result.Add(entityToken, new[] { parentEntityTokenSource.GetParentEntityToken() });\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        string treeId;\r\n\r\n                        if (entityToken is TreeSimpleElementEntityToken simpleElementEntityToken)\r\n                        {\r\n                            treeId = simpleElementEntityToken.TreeNodeId;\r\n                        }\r\n                        else if (entityToken is TreeFunctionElementGeneratorEntityToken functionGenEntityToken)\r\n                        {\r\n                            treeId = functionGenEntityToken.TreeNodeId;\r\n                        }\r\n                        else\r\n                        {\r\n                            throw new InvalidOperationException(\"This code should not be reachable.\");\r\n                        }\r\n\r\n                        Log.LogError(\"TreeFacade\", $\"The tree '{treeId}' failed to return parent entity tokens and are ignored\");\r\n                        Log.LogError(\"TreeFacade\", ex);\r\n                    }\r\n                }\r\n                else if (entityToken is TreeDataFieldGroupingElementEntityToken dataFieldGroupingEntityToken)\r\n                {\r\n                    string treeId = entityToken.Source;\r\n\r\n                    try\r\n                    {\r\n                        Tree tree = TreeFacade.GetTree(treeId);\r\n\r\n                        string treeNodeId = dataFieldGroupingEntityToken.TreeNodeId;\r\n                        TreeNode treeNode = tree.GetTreeNode(treeNodeId);\r\n\r\n                        dynamicContext.FieldGroupingValues = dataFieldGroupingEntityToken.GroupingValues;\r\n                        dynamicContext.FieldFolderRangeValues = dataFieldGroupingEntityToken.FolderRangeValues;\r\n                        dynamicContext.CurrentTreeNode = treeNode;\r\n\r\n                        result.Add(entityToken, treeNode.ParentNode.GetEntityTokens(entityToken, dynamicContext));\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(\"TreeFacade\", $\"The tree '{treeId}' failed to return parent entity tokens and are ignored\");\r\n                        Log.LogError(\"TreeFacade\", ex);\r\n                    }\r\n                }\r\n                else if (entityToken is DataEntityToken dataEntityToken)\r\n                {\r\n                    Type interfaceType = dataEntityToken.InterfaceType;\r\n\r\n                    foreach (Tree tree in TreeFacade.AllTrees)\r\n                    {\r\n                        List<TreeNode> treeNodes;\r\n                        if (!tree.BuildProcessContext.DataInteraceToTreeNodes.TryGetValue(interfaceType, out treeNodes)) continue;\r\n                        \r\n                        IEnumerable<EntityToken> concatList = null;\r\n\r\n                        foreach (TreeNode treeNode in treeNodes)\r\n                        {\r\n                            try\r\n                            {\r\n                                dynamicContext.CurrentTreeNode = treeNode;\r\n\r\n                                concatList = concatList.ConcatOrDefault(treeNode.ParentNode.GetEntityTokens(entityToken, dynamicContext));\r\n                            }\r\n                            catch (Exception ex)\r\n                            {\r\n                                Log.LogError(\"TreeFacade\", $\"The tree '{treeNode.Tree.TreeId}' failed to return parent entity tokens and are ignored\");\r\n                                Log.LogError(\"TreeFacade\", ex);\r\n                            }\r\n                        }\r\n\r\n                        if (concatList != null)\r\n                        {\r\n                            // Filtering the current element to avoid loops while resolving security\r\n                            concatList = concatList.Where(e => !entityToken.Equals(e));\r\n\r\n                            IEnumerable<EntityToken> existingList;\r\n                            if (result.TryGetValue(entityToken, out existingList))\r\n                            {\r\n                                result[entityToken] = existingList.Concat(concatList);\r\n                            }\r\n                            else\r\n                            {\r\n                                result.Add(entityToken, concatList);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n                else if (entityToken is TreePerspectiveEntityToken)\r\n                {\r\n                    result.Add(entityToken, new[] { TreeSharedRootsFacade.SharedRootFolders[entityToken.Id].AttachmentPoint.AttachingPoint.EntityToken });\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeDataFieldGroupingElementEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Trees.Foundation;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    public sealed class TreeDataFieldGroupingElementEntityToken : EntityToken\r\n    {\r\n        private const string _magicNullValue = \"·NULL·\";\r\n\r\n        private string _treeNodeId;\r\n        private string _treeId;\r\n        private string _type;\r\n\r\n        private Dictionary<string, object> _groupingValues = null;\r\n        private Dictionary<string, int> _folderRangeValues = null;\r\n        private Dictionary<string, string> _deserializeDictionary; // Used for lazy deserializing grouping values\r\n\r\n        private int _hashCode = 0;\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public TreeDataFieldGroupingElementEntityToken(string treeNodeId, string treeId, string dataType)\r\n        {\r\n            _treeNodeId = treeNodeId;\r\n            _treeId = treeId;\r\n            _type = dataType;\r\n            _deserializeDictionary = new Dictionary<string, string>();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public TreeDataFieldGroupingElementEntityToken(string treeNodeId, string treeId, string dataType, Dictionary<string, string> deserializeDictionary)\r\n            : this(treeNodeId, treeId, dataType)\r\n        {\r\n            _deserializeDictionary = deserializeDictionary;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Contains the interface type (serialized)\r\n        /// </summary>\r\n        public override string Type\r\n        {\r\n            get { return _type; }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Contains the Id of the tree\r\n        /// </summary>\r\n        public override string Source\r\n        {\r\n            get { return _treeId; }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Contains the Id of the owner tree node\r\n        /// </summary>\r\n        public override string Id\r\n        {\r\n            get { return _treeNodeId; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string TreeNodeId\r\n        {\r\n            get\r\n            {\r\n                return this.Id;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> GroupingValues\r\n        {\r\n            get\r\n            {\r\n                if (_groupingValues == null)\r\n                {\r\n                    _groupingValues = new Dictionary<string, object>();\r\n\r\n                    Type dataType = TypeManager.GetType(this.Type);\r\n\r\n                    List<PropertyInfo> propertyInfos = dataType.GetPropertiesRecursively();\r\n                    foreach (var kvp in _deserializeDictionary)\r\n                    {\r\n                        string propertyName = kvp.Key;\r\n                        if (propertyName.StartsWith(\"■\"))\r\n                        {\r\n                            propertyName = propertyName.Substring(1).Substring(0, propertyName.IndexOf(\"_\", System.StringComparison.Ordinal) - 1);\r\n                        }\r\n\r\n                        PropertyInfo propertyInfo = propertyInfos.SingleOrDefault(f => f.Name == propertyName);\r\n                        if (propertyInfo == null) continue;\r\n\r\n                        object value = null;\r\n\r\n                        if (kvp.Value != _magicNullValue)\r\n                        {\r\n                            if (propertyInfo.PropertyType == typeof(DateTime))\r\n                            {\r\n                                value = StringConversionServices.DeserializeValue(kvp.Value, typeof(string));\r\n                            }\r\n                            else\r\n                            {\r\n                                value = StringConversionServices.DeserializeValue(kvp.Value, propertyInfo.PropertyType);\r\n                            }\r\n                        }\r\n\r\n                        _groupingValues.Add(kvp.Key, value);\r\n                    }\r\n                }\r\n\r\n                return _groupingValues;\r\n            }\r\n            set\r\n            {\r\n                _groupingValues = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> DeserializedGroupingValues\r\n        {\r\n            get\r\n            {\r\n                Dictionary<string, object> result = new Dictionary<string, object>();\r\n\r\n                Type dataType = TypeManager.GetType(this.Type);\r\n                List<PropertyInfo> propertyInfos = dataType.GetPropertiesRecursively();\r\n\r\n                foreach (var kvp in this.GroupingValues)\r\n                {\r\n                    string propertyName = kvp.Key;\r\n                    if (propertyName.StartsWith(\"■\"))\r\n                    {\r\n                        propertyName = propertyName.Substring(1).Substring(0, propertyName.IndexOf(\"_\", System.StringComparison.Ordinal) - 1);\r\n                    }\r\n\r\n                    object value = kvp.Value;\r\n\r\n                    PropertyInfo propertyInfo = propertyInfos.SingleOrDefault(f => f.Name == propertyName);\r\n                    if (propertyInfo.PropertyType == typeof(DateTime))\r\n                    {\r\n                        if (result.ContainsKey(propertyName))\r\n                        {\r\n                            value = DateTimeFormater.Deserialize((string)value, (DateTime)result[propertyName]);\r\n                            result[propertyName] = value;\r\n                        }\r\n                        else\r\n                        {\r\n                            value = DateTimeFormater.Deserialize((string)value);\r\n                            result.Add(propertyName, value);\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        result.Add(propertyName, value);\r\n                    }\r\n\r\n                }\r\n\r\n                return result;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, int> FolderRangeValues\r\n        {\r\n            get\r\n            {\r\n                if (_folderRangeValues == null)\r\n                {\r\n                    _folderRangeValues = new Dictionary<string, int>();\r\n\r\n                    foreach (var kvp in _deserializeDictionary)\r\n                    {\r\n                        if (kvp.Key.StartsWith(\"·\") == false) continue;\r\n\r\n                        int value = (int)StringConversionServices.DeserializeValue(kvp.Value, typeof(int));\r\n\r\n                        _folderRangeValues.Add(kvp.Key.Substring(1), value);\r\n                    }\r\n                }\r\n\r\n                return _folderRangeValues;\r\n            }\r\n            set\r\n            {\r\n                _folderRangeValues = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type ChildGeneratingDataElementsReferenceType { get; set; }\r\n\r\n        /// <exclude />\r\n        public object ChildGeneratingDataElementsReferenceValue { get; set; }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            if (_hashCode != 0)\r\n            {\r\n                return _hashCode;\r\n            }\r\n\r\n            int hashCode = base.GetHashCode();\r\n\r\n            if (this.GroupingValues != null)\r\n            {\r\n                foreach (var kvp in this.GroupingValues/*.SortByKeys()*/)\r\n                {\r\n                    hashCode ^= kvp.Key.GetHashCode();\r\n                    if (kvp.Value != null)\r\n                    {\r\n                        hashCode ^= kvp.Value.GetHashCode();\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (this.FolderRangeValues != null)\r\n            {\r\n                foreach (var kvp in this.FolderRangeValues/*.SortByKeys()*/)\r\n                {\r\n                    hashCode ^= kvp.Key.GetHashCode();\r\n                    hashCode ^= kvp.Value.GetHashCode();\r\n                }\r\n            }\r\n\r\n            if (this.ChildGeneratingDataElementsReferenceType != null)\r\n            {\r\n                hashCode ^= ChildGeneratingDataElementsReferenceType.GetHashCode();\r\n            }\r\n\r\n            if (this.ChildGeneratingDataElementsReferenceValue != null)\r\n            {\r\n                hashCode ^= ChildGeneratingDataElementsReferenceValue.GetHashCode();\r\n            }\r\n\r\n            return _hashCode = hashCode;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            DoSerialize(sb);\r\n\r\n            foreach (var kvp in this.GroupingValues.SortByKeys())\r\n            {\r\n                if (kvp.Value != null)\r\n                {\r\n                    StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, kvp.Value, kvp.Value.GetType());\r\n                }\r\n                else\r\n                {\r\n                    StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, _magicNullValue, typeof(string));\r\n                }\r\n            }\r\n\r\n\r\n            foreach (var kvp in this.FolderRangeValues.SortByKeys())\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"·\" + kvp.Key, kvp.Value, kvp.Value.GetType());\r\n            }\r\n\r\n            if (this.ChildGeneratingDataElementsReferenceType != null)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_ReferenceType_\", TypeManager.SerializeType(this.ChildGeneratingDataElementsReferenceType));\r\n            }\r\n\r\n            if (this.ChildGeneratingDataElementsReferenceValue != null)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_ReferenceValueType_\", this.ChildGeneratingDataElementsReferenceValue.GetType());\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_ReferenceValue_\", this.ChildGeneratingDataElementsReferenceValue, this.ChildGeneratingDataElementsReferenceValue.GetType());\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            Dictionary<string, string> dic;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id, out dic);\r\n\r\n            TreeDataFieldGroupingElementEntityToken entityToken = new TreeDataFieldGroupingElementEntityToken(id, source, type, dic);\r\n\r\n            if (dic.ContainsKey(\"_ReferenceType_\"))\r\n            {\r\n                string typeString = StringConversionServices.DeserializeValueString(dic[\"_ReferenceType_\"]);\r\n\r\n                entityToken.ChildGeneratingDataElementsReferenceType = TypeManager.GetType(typeString);\r\n            }\r\n\r\n            if (dic.ContainsKey(\"_ReferenceValueType_\"))\r\n            {\r\n                Type referenceValueType = StringConversionServices.DeserializeValueType(dic[\"_ReferenceValueType_\"]);\r\n                entityToken.ChildGeneratingDataElementsReferenceValue = StringConversionServices.DeserializeValue(dic[\"_ReferenceValue_\"], referenceValueType);\r\n            }\r\n\r\n            return entityToken;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string OnGetExtraPrettyHtml()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            foreach (var kvp in this.GroupingValues.SortByKeys())\r\n            {\r\n                sb.Append(\"<b>\" + kvp.Key + \" = </b> \" + kvp.Value.ToString() + \"<br />\");\r\n            }\r\n\r\n            foreach (var kvp in this.FolderRangeValues.SortByKeys())\r\n            {\r\n                sb.Append(\"<b>\" + kvp.Key + \" = </b> \" + kvp.Value.ToString() + \"<br />\");\r\n            }\r\n\r\n            if (this.ChildGeneratingDataElementsReferenceValue != null)\r\n            {\r\n                sb.Append(\"<b>\" + \"ChildGenRef\" + \" = </b> \" + this.ChildGeneratingDataElementsReferenceValue.ToString() + \"<br />\");\r\n            }\r\n            else\r\n            {\r\n                sb.Append(\"<b>\" + \"ChildGenRef\" + \" = </b> \" + \"(null)\" + \"<br />\");\r\n            }\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void OnGetPrettyHtml(EntityTokenHtmlPrettyfier prettyfier)\r\n        {\r\n            prettyfier.AddCustomProperty(\"GroupingValues\", (name, value, helper) =>\r\n            {\r\n                Dictionary<string, object> dic = (Dictionary<string, object>)value;\r\n\r\n                StringBuilder sb = new StringBuilder();\r\n                foreach (var kvp in dic)\r\n                {\r\n                    sb.Append(\"<b>\" + kvp.Key + \":</b> \" + kvp.Value.ToString() + \"<br />\");\r\n                }\r\n\r\n                helper.AddFullRow(new string[] { \"<b>\" + name + \"</b>\", sb.ToString() });\r\n            });\r\n\r\n\r\n            prettyfier.AddCustomProperty(\"FolderRangeValues\", (name, value, helper) =>\r\n            {\r\n                Dictionary<string, int> dic = (Dictionary<string, int>)value;\r\n\r\n                StringBuilder sb = new StringBuilder();\r\n                foreach (var kvp in dic)\r\n                {\r\n                    sb.Append(\"<b>\" + kvp.Key + \":</b> \" + kvp.Value.ToString() + \"<br />\");\r\n                }\r\n\r\n                helper.AddFullRow(new [] { \"<b>\" + name + \"</b>\", sb.ToString() });\r\n            });\r\n\r\n            prettyfier.AddCustomProperty(\"ChildGeneratingDataElementsReferenceType\", (name, value, helper) =>\r\n            {\r\n                helper.AddFullRow(new[] { \"<b>\" + name + \"</b>\", EntityTokenHtmlPrettyfier.GetTypeHtml((value ?? \"(null)\").ToString()) });\r\n            });\r\n\r\n            prettyfier.AddCustomProperty(\"ChildGeneratingDataElementsReferenceValue\", (name, value, helper) =>\r\n            {\r\n                helper.AddFullRow(new [] { \"<b>\" + name + \"</b>\", (value ?? \"(null)\").ToString() });\r\n            });\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeElementActionProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementActionProvider;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableElementActionProvider))]\r\n    internal sealed class TreeElementActionProvider : IElementActionProvider\r\n    {\r\n        private static readonly ResourceHandle AddApplicationIcon = ResourceHandle.BuildIconFromDefaultProvider(\"tree-add-application\");\r\n        private static readonly ResourceHandle RemoveApplicationIcon = ResourceHandle.BuildIconFromDefaultProvider(\"tree-remove-application\");\r\n\r\n        private static readonly ActionGroup ApplicationsActionGroup = new ActionGroup(\"Applications\", ActionGroupPriority.TargetedAppendMedium);\r\n\r\n        private static readonly List<PermissionType> AddPermissionTypes = new List<PermissionType> { PermissionType.Administrate, PermissionType.Configure };\r\n        private static readonly List<PermissionType> RemovePermissionTypes = new List<PermissionType> { PermissionType.Administrate, PermissionType.Configure };\r\n\r\n\r\n        public IEnumerable<ElementAction> GetActions(EntityToken entityToken)\r\n        {\r\n            if (TreeFacade.HasPossibleAttachmentPoints(entityToken))\r\n            {\r\n                yield return new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.AddApplicationWorkflow\"), AddPermissionTypes) { DoIgnoreEntityTokenLocking = true }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"AddApplicationWorkflow.AddApplication.Label\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"AddApplicationWorkflow.AddApplication.ToolTip\"),\r\n                        Icon = AddApplicationIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Other,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = false,\r\n                            ActionGroup = ApplicationsActionGroup\r\n                        }\r\n                    }\r\n                };\r\n\r\n\r\n                yield return new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.RemoveApplicationWorkflow\"), RemovePermissionTypes) { DoIgnoreEntityTokenLocking = true }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"RemoveApplicationWorkflow.RemoveApplication.Label\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"RemoveApplicationWorkflow.RemoveApplication.ToolTip\"),\r\n                        Icon = RemoveApplicationIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Other,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = false,\r\n                            ActionGroup = ApplicationsActionGroup\r\n                        }\r\n                    }\r\n                };\r\n            }\r\n\r\n\r\n            List<ElementAction> elementActions = new List<ElementAction>();\r\n            foreach (Tree tree in TreeFacade.GetTreesByEntityToken(entityToken))\r\n            {\r\n                TreeNodeDynamicContext dynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down)\r\n                {\r\n                    CurrentTreeNode = tree.RootTreeNode,\r\n                    CurrentEntityToken = entityToken,\r\n                    Piggybag = new Dictionary<string, string>()\r\n                };\r\n\r\n                foreach (ActionNode actionNode in tree.RootTreeNode.ActionNodes)\r\n                {\r\n                    actionNode.AddAction(f => elementActions.Add(f), entityToken, dynamicContext);\r\n                }\r\n            }\r\n\r\n\r\n            foreach (ElementAction elementAction in elementActions)\r\n            {\r\n                yield return elementAction;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeElementAttachingProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableElementAttachingProvider))]\r\n    internal class TreeElementAttachingProvider : IMultipleResultElementAttachingProvider\r\n    {\r\n        public ElementProviderContext Context\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        public bool HaveCustomChildElements(EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            TreeSharedRootsFacade.Initialize(Context.ProviderName);\r\n\r\n            foreach (Tree tree in TreeFacade.GetTreesByEntityToken(parentEntityToken))\r\n            {\r\n                if (tree.RootTreeNode.ChildNodes.Any()) return true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        public ElementAttachingProviderResult GetAlternateElementList(EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            throw new NotImplementedException(\"Will never get called\");\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<ElementAttachingProviderResult> GetAlternateElementLists(EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            TreeSharedRootsFacade.Initialize(Context.ProviderName);\r\n\r\n            IEnumerable<Tree> trees = TreeFacade.GetTreesByEntityToken(parentEntityToken);\r\n\r\n            foreach (Tree tree in trees)\r\n            {\r\n                foreach (IAttachmentPoint attachmentPoint in tree.GetAttachmentPoints(parentEntityToken))\r\n                {\r\n                    TreeNodeDynamicContext dynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down)\r\n                    {\r\n                        ElementProviderName = this.Context.ProviderName,\r\n                        Piggybag = piggybag,\r\n                        CurrentEntityToken = parentEntityToken,\r\n                        CurrentTreeNode = tree.RootTreeNode,\r\n                        IsRoot = true\r\n                    };\r\n\r\n                    ElementAttachingProviderResult result = null;\r\n                    try\r\n                    {\r\n                        result = new ElementAttachingProviderResult()\r\n                        {\r\n                            Elements = tree.RootTreeNode.GetElements(parentEntityToken, dynamicContext).Evaluate(),\r\n                            Position = attachmentPoint.Position,\r\n                            PositionPriority = 0\r\n                        };\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        LoggingService.LogError(\"TreeFacade\", string.Format(\"Getting elements from the tree '{0}' failed\", tree.TreeId));\r\n                        LoggingService.LogError(\"TreeFacade\", ex);\r\n\r\n                        Element errorElement = ShowErrorElementHelper.CreateErrorElement(\r\n                            StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"KeyFacade.ErrorTreeNode.Label\"),\r\n                            tree.TreeId,\r\n                            ex.Message);\r\n\r\n                        result = new ElementAttachingProviderResult()\r\n                        {\r\n                            Elements = new List<Element>() { errorElement },\r\n                            Position = attachmentPoint.Position,\r\n                            PositionPriority = 0\r\n                        };\r\n                    }\r\n\r\n                    yield return result;\r\n                }\r\n            }\r\n\r\n            foreach (CustomTreePerspectiveInfo info in TreeSharedRootsFacade.SharedRootFolders.Values)\r\n            {\r\n                if (info.AttachmentPoint.IsAttachmentPoint(parentEntityToken))\r\n                {\r\n                    Element element = new Element(new ElementHandle(info.Element.ElementHandle.ProviderName, info.Element.ElementHandle.EntityToken))\r\n                    {\r\n                        VisualData = info.Element.VisualData\r\n                    };\r\n                        \r\n                    int counter = 0;\r\n                    foreach (Tree tree in info.Trees)\r\n                    {\r\n                        string key = StringConstants.PiggybagSharedTreeId + (counter++);\r\n                        element.ElementHandle.Piggyback[key] = tree.TreeId;\r\n                    }\r\n\r\n                    ElementAttachingProviderResult result = new ElementAttachingProviderResult\r\n                    {                        \r\n                        Elements = new [] { info.Element },\r\n                        Position = info.AttachmentPoint.Position,\r\n                        PositionPriority = 10000\r\n                    };\r\n\r\n                    yield return result;\r\n                }\r\n            }           \r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            TreeSharedRootsFacade.Initialize(Context.ProviderName);\r\n\r\n            List<Tree> trees;\r\n            if (parentEntityToken is TreePerspectiveEntityToken)\r\n            {\r\n                if (TreeSharedRootsFacade.SharedRootFolders.ContainsKey(parentEntityToken.Id))\r\n                    trees = TreeSharedRootsFacade.SharedRootFolders[parentEntityToken.Id].Trees;\r\n                else \r\n                    trees = new List<Tree>();\r\n            }\r\n            else\r\n            {\r\n                if (piggybag.ContainsKey(StringConstants.PiggybagTreeId))\r\n                {\r\n                    string treeId = piggybag.Where(f => f.Key == StringConstants.PiggybagTreeId).SingleOrDefault().Value;\r\n                    Tree tree = TreeFacade.GetTree(treeId);\r\n                    if (tree == null) return new Element[] { };\r\n                    trees = new List<Tree> { tree };\r\n                }\r\n                else\r\n                {\r\n                    trees = new List<Tree>();\r\n\r\n                    int counter = 0;\r\n                    while (true)\r\n                    {\r\n                        string key = StringConstants.PiggybagSharedTreeId + (counter++);\r\n                        if (!piggybag.ContainsKey(key)) break;\r\n\r\n                        string treeId = piggybag[key];\r\n                        Tree tree = TreeFacade.GetTree(treeId);\r\n                        if (tree != null) trees.Add(tree);\r\n                    }\r\n                }\r\n            }\r\n\r\n            IEnumerable<Element> result = new List<Element>();\r\n\r\n            foreach (Tree tree in trees)\r\n            {\r\n                TreeNodeDynamicContext dynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down)\r\n                {\r\n                    ElementProviderName = this.Context.ProviderName,\r\n                    Piggybag = piggybag,\r\n                    CurrentEntityToken = parentEntityToken\r\n                };\r\n\r\n                try\r\n                {\r\n                    if (parentEntityToken is TreePerspectiveEntityToken)\r\n                    {\r\n                        TreeNode treeNode = tree.RootTreeNode;\r\n\r\n                        dynamicContext.CurrentTreeNode = treeNode;\r\n\r\n                        IEnumerable<Element> elements = treeNode.ChildNodes.GetElements(parentEntityToken, dynamicContext);\r\n                        result = result.ConcatOrDefault(elements);\r\n                    }\r\n                    else if (parentEntityToken is TreeSimpleElementEntityToken)\r\n                    {\r\n                        TreeNode treeNode = tree.GetTreeNode(parentEntityToken.Id);\r\n                        if (treeNode == null) throw new InvalidOperationException(\"Tree is out of sync\");\r\n\r\n                        dynamicContext.CurrentTreeNode = treeNode;\r\n\r\n                        IEnumerable<Element> elements = treeNode.ChildNodes.GetElements(parentEntityToken, dynamicContext);\r\n                        result = result.ConcatOrDefault(elements);\r\n                    }\r\n                    else if (parentEntityToken is TreeFunctionElementGeneratorEntityToken)\r\n                    {\r\n                        TreeNode treeNode = tree.GetTreeNode(parentEntityToken.Id);\r\n                        if (treeNode == null) throw new InvalidOperationException(\"Tree is out of sync\");\r\n\r\n                        dynamicContext.CurrentTreeNode = treeNode;\r\n\r\n                        IEnumerable<Element> elements = treeNode.ChildNodes.GetElements(parentEntityToken, dynamicContext);\r\n                        result = result.ConcatOrDefault(elements);\r\n                    }\r\n                    else if (parentEntityToken is TreeDataFieldGroupingElementEntityToken)\r\n                    {\r\n                        TreeDataFieldGroupingElementEntityToken castedParentEntityToken = parentEntityToken as TreeDataFieldGroupingElementEntityToken;\r\n                        TreeNode treeNode = tree.GetTreeNode(parentEntityToken.Id);\r\n                        if (treeNode == null) throw new InvalidOperationException(\"Tree is out of sync\");\r\n\r\n                        dynamicContext.CurrentTreeNode = treeNode;\r\n                        dynamicContext.FieldGroupingValues = castedParentEntityToken.GroupingValues;\r\n                        dynamicContext.FieldFolderRangeValues = castedParentEntityToken.FolderRangeValues;\r\n\r\n                        IEnumerable<Element> elements = treeNode.ChildNodes.GetElements(parentEntityToken, dynamicContext);\r\n                        result = result.ConcatOrDefault(elements);\r\n                    }\r\n                    else if (parentEntityToken is DataEntityToken)\r\n                    {\r\n                        DataEntityToken dataEntityToken = parentEntityToken as DataEntityToken;\r\n\r\n                        Type interfaceType = dataEntityToken.InterfaceType;\r\n\r\n                        List<TreeNode> treeNodes;\r\n                        if (tree.BuildProcessContext.DataInteraceToTreeNodes.TryGetValue(interfaceType, out treeNodes) == false)\r\n                        {\r\n                            throw new InvalidOperationException();\r\n                        }\r\n\r\n                        string parentNodeId = piggybag.GetParentIdFromPiggybag();\r\n\r\n                        TreeNode treeNode = treeNodes.Where(f => f.ParentNode.Id == parentNodeId).SingleOrDefault();\r\n                        if (treeNode == null) throw new InvalidOperationException(\"Tree is out of sync\");\r\n\r\n                        dynamicContext.CurrentTreeNode = treeNode;\r\n\r\n                        IEnumerable<Element> elements = treeNode.ChildNodes.GetElements(parentEntityToken, dynamicContext);\r\n                        result = result.ConcatOrDefault(elements);\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new NotImplementedException(\"Unhandled entityt token type\");\r\n                    }\r\n\r\n\r\n                    result = result.Evaluate();\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    LoggingService.LogError(\"TreeFacade\", string.Format(\"Getting elements from the three '{0}' failed\", tree.TreeId));\r\n                    LoggingService.LogError(\"TreeFacade\", ex);\r\n\r\n                    Element errorElement = ShowErrorElementHelper.CreateErrorElement(\r\n                        StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"KeyFacade.ErrorTreeNode.Label\"),\r\n                        tree.TreeId,\r\n                        ex.Message);\r\n\r\n                    return new Element[] { errorElement };\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Instrumentation;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class TreeFacade\r\n    {\r\n        private static readonly string LogTitle = \"TreeFacade\";\r\n\r\n        private static readonly ITreeFacade _implementation = new TreeFacadeImpl();\r\n        private static readonly object _lock = new object();\r\n        private static bool _initialized;\r\n\r\n\r\n        static TreeFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToPostFlushEvent(OnPostFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        private static void EnsureInitialized()\r\n        {\r\n            if (_initialized) return;\r\n\r\n            lock (_lock)\r\n            {\r\n                if (_initialized) return;\r\n\r\n                using (new LogExecutionTime(LogTitle, \"Initializing tree system\"))\r\n                {\r\n                    _implementation.Initialize();\r\n                    _initialized = true;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a tree given the id of the tree or null if no tree exist with the given id\r\n        /// </summary>\r\n        /// <param name=\"treeId\"></param>\r\n        /// <returns></returns>\r\n        public static Tree GetTree(string treeId)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            return _implementation.GetTree(treeId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Tree> AllTrees\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialized();\r\n\r\n                return _implementation.AllTrees;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool HasAttachmentPoints(EntityToken parentEntityToken)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            return _implementation.HasAttachmentPoints(parentEntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool HasPossibleAttachmentPoints(EntityToken parentEntityToken)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            return _implementation.HasPossibleAttachmentPoints(parentEntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Tree> GetTreesByEntityToken(EntityToken parentEntityToken)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            return _implementation.GetTreesByEntityToken(parentEntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a attachment point that is persisted by the system and is loaded on every restart\r\n        /// </summary>\r\n        /// <param name=\"treeId\"></param>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"keyValue\"></param>\r\n        /// <param name=\"position\"></param>\r\n        /// <returns></returns>\r\n        public static bool AddPersistedAttachmentPoint(string treeId, Type interfaceType, object keyValue, ElementAttachingProviderPosition position = ElementAttachingProviderPosition.Top)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            return _implementation.AddPersistedAttachmentPoint(treeId, interfaceType, keyValue, position);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool RemovePersistedAttachmentPoint(string treeId, Type interfaceType, object keyValue)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            return _implementation.RemovePersistedAttachmentPoint(treeId, interfaceType, keyValue);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This will add a attachment point until the system flushes.\r\n        /// This can be used by element provider implementors to attach trees to their exising trees.\r\n        /// </summary>\r\n        /// <param name=\"treeId\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"position\"></param>\r\n        public static bool AddCustomAttachmentPoint(string treeId, EntityToken entityToken, ElementAttachingProviderPosition position = ElementAttachingProviderPosition.Top)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            return _implementation.AddCustomAttachmentPoint(treeId, entityToken, position);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Loads a tree from an <see cref=\"XDocument\"/>\r\n        /// </summary>>\r\n        /// <exclude />\r\n        public static Tree LoadTreeFromDom(string treeId, XDocument document)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            return _implementation.LoadTreeFromDom(treeId, document);\r\n        }\r\n\r\n\r\n\r\n        private static void OnPostFlushEvent(PostFlushEventArgs args)\r\n        {\r\n            EnsureInitialized();\r\n\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Web.Hosting;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Xsl;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Elements.ElementProviders.DeveloperApplicationProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    [FlushAttribute(\"ReloadAllTrees\")]\r\n    internal sealed class TreeFacadeImpl : ITreeFacade\r\n    {\r\n        private static readonly string LogTitle = \"TreeFacade\";\r\n\r\n        private const string XslFilename = \"Tree.xsl\";\r\n\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize, false);\r\n        private static readonly object _reloadAttachmentPointsSyncRoot = new object();\r\n\r\n\r\n        public void Initialize()\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                var resources = _resourceLocker.Resources;\r\n\r\n                if (!GlobalInitializerFacade.IsReinitializingTheSystem)\r\n                {\r\n                    DataEvents<IDataItemTreeAttachmentPoint>.OnAfterAdd += OnUpdateTreeAttachmentPoints;\r\n                    DataEvents<IDataItemTreeAttachmentPoint>.OnDeleted += OnUpdateTreeAttachmentPoints;\r\n                    DataEvents<IDataItemTreeAttachmentPoint>.OnStoreChanged += OnTreeAttachmentPointsStoreChange;\r\n\r\n                    GeneratedTypesFacade.SubscribeToUpdateTypeEvent(OnDataTypeChanged);\r\n\r\n                    var treeAuxiliaryAncestorProvider = new TreeAuxiliaryAncestorProvider();\r\n                    var entityTokenTypes = new[]\r\n                    {\r\n                        typeof (TreeSimpleElementEntityToken),\r\n                        typeof (TreeFunctionElementGeneratorEntityToken),\r\n                        typeof (TreeDataFieldGroupingElementEntityToken),\r\n                        typeof (DataEntityToken),\r\n                        typeof (TreePerspectiveEntityToken)\r\n                    };\r\n\r\n                    entityTokenTypes.ForEach(type => AuxiliarySecurityAncestorFacade\r\n                            .AddAuxiliaryAncestorProvider(type, treeAuxiliaryAncestorProvider, true));\r\n\r\n                    resources.PersistentAttachmentPoints = new Dictionary<string, List<IAttachmentPoint>>();\r\n\r\n                    LoadAllTrees();\r\n                    InitializeTreeAttachmentPoints();\r\n                    TreeSharedRootsFacade.Clear();\r\n\r\n                    var fileWatcher = new C1FileSystemWatcher(TreeDefinitionsFolder, \"*.xml\");\r\n                    fileWatcher.Created += OnReloadTrees;\r\n                    fileWatcher.Deleted += OnReloadTrees;\r\n                    fileWatcher.Changed += OnReloadTrees;\r\n                    fileWatcher.Renamed += OnReloadTrees;\r\n                    fileWatcher.EnableRaisingEvents = true;\r\n\r\n                    resources.FileSystemWatcher = fileWatcher;\r\n\r\n                    resources.RootEntityToken = ElementFacade.GetRootsWithNoSecurity().First().ElementHandle.EntityToken;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Tree GetTree(string treeId)\r\n        {\r\n            Tree tree;\r\n\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                _resourceLocker.Resources.Trees.TryGetValue(treeId, out tree);\r\n            }\r\n\r\n            return tree;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Tree> AllTrees\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.Trees.Values.Evaluate();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool HasAttachmentPoints(EntityToken parentEntityToken)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                return _resourceLocker.Resources.Trees.Any(f => f.Value.HasAttachmentPoints(parentEntityToken));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool HasPossibleAttachmentPoints(EntityToken parentEntityToken)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                return _resourceLocker.Resources.Trees.Any(f => f.Value.HasPossibleAttachmentPoints(parentEntityToken));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Tree> GetTreesByEntityToken(EntityToken parentEntityToken)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                return _resourceLocker.Resources.Trees.Values.Where(tree => tree.HasAttachmentPoints(parentEntityToken));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetElementsByTreeId(string treeId, EntityToken parentEntityToken, Dictionary<string, string> piggybag)\r\n        {\r\n            Tree tree = GetTree(treeId);\r\n            if (tree == null) return new Element[] { };\r\n\r\n            var dynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down)\r\n            {\r\n                Piggybag = piggybag,\r\n                CurrentEntityToken = parentEntityToken,\r\n                CurrentTreeNode = tree.RootTreeNode\r\n            };\r\n\r\n            return tree.RootTreeNode.GetElements(parentEntityToken, dynamicContext);\r\n        }\r\n\r\n\r\n\r\n        public Tree LoadTreeFromDom(string treeId, XDocument document)\r\n        {\r\n            string xslFilename = Path.Combine(TreeDefinitionsFolder, XslFilename);\r\n\r\n            var fileInfo = new C1FileInfo(xslFilename);\r\n\r\n            // The default xslt transformation does no changes and it's xsl file has size of 358 bytes, skipping this file saves up to 0.5 second on site startup\r\n            if (fileInfo.Exists && fileInfo.Length != 358)\r\n            {\r\n                try\r\n                {\r\n                    var newDocument = new XDocument();\r\n                    using (XmlWriter xmlWriter = newDocument.CreateWriter())\r\n                    {\r\n                        var xslTransform = new XslCompiledTransform();\r\n\r\n                        xslTransform.LoadFromPath(xslFilename);\r\n\r\n                        xslTransform.Transform(document.CreateReader(), xmlWriter);\r\n                    }\r\n\r\n                    document = newDocument;\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogCritical(\"TreeFacade\", \"Failed to apply xslt on the tree {0} with the following exception\", treeId);\r\n                    Log.LogCritical(\"TreeFacade\", ex);\r\n                }\r\n            }\r\n\r\n            return Load(treeId, document);\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                _resourceLocker.Resources.PersistentAttachmentPoints = new Dictionary<string, List<IAttachmentPoint>>();\r\n                Initialize();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void OnDataTypeChanged(EventArgs eventArgs)\r\n        {\r\n            OnReloadTrees(null, null);\r\n        }\r\n\r\n\r\n\r\n        private void OnReloadTrees(object sender, FileSystemEventArgs e)\r\n        {\r\n            if (HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n            {\r\n                return;\r\n            }\r\n\r\n            Thread.CurrentThread.CurrentCulture = UserSettings.CultureInfo;\r\n\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                TimeSpan timeSpan = DateTime.Now - _resourceLocker.Resources.LastFileChange;\r\n                if (timeSpan.TotalMilliseconds > 100)\r\n                {\r\n                    _resourceLocker.Resources.LastFileChange = DateTime.Now;\r\n                    ReloadAllTrees();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void LoadAllTrees()\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                _resourceLocker.Resources.Trees = new Dictionary<string, Tree>();\r\n\r\n                Log.LogVerbose(LogTitle, \"Loading all tree definitions from {0}\", TreeDefinitionsFolder);\r\n\r\n                foreach (string filename in C1Directory.GetFiles(TreeDefinitionsFolder, \"*.xml\"))\r\n                {\r\n                    string treeId = Path.GetFileName(filename);\r\n\r\n                    try\r\n                    {\r\n                        Log.LogVerbose(LogTitle, \"Loading tree from file: \" + filename);\r\n\r\n                        int t1 = Environment.TickCount;\r\n\r\n                        Tree tree = LoadTreeFromFile(treeId);\r\n\r\n                        if (tree.BuildResult.ValidationErrors.Any())\r\n                        {\r\n                            Log.LogError(LogTitle, \"Tree {0} was not loaded due to the following validation errors\", treeId);\r\n\r\n                            foreach (ValidationError validationError in tree.BuildResult.ValidationErrors)\r\n                            {\r\n                                if (string.IsNullOrEmpty(validationError.XPath))\r\n                                {\r\n                                    Log.LogError(\"TreeFacade\", $\"{validationError.Message} in {filename}\");\r\n                                }\r\n                                else\r\n                                {\r\n                                    Log.LogError(\"TreeFacade\", $\"{validationError.Message} at {validationError.XPath} in {filename}\");\r\n                                }\r\n                            }\r\n                        }\r\n                        else\r\n                        {\r\n                            _resourceLocker.Resources.Trees.Add(treeId, tree);\r\n                        }\r\n\r\n                        int msElapsed = Environment.TickCount - t1;\r\n\r\n                        if (msElapsed > 20)\r\n                        {\r\n                            Log.LogVerbose(\"TreeFacade\", \"Time spend on loading the tree: \" + msElapsed + \"ms, file: \" + filename);\r\n                        }\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(\"TreeFacade: Failed to load the tree \" + treeId, ex);\r\n\r\n                        //Tree errorTree = CreateErrorTree(treeId, ex.Message);\r\n                        //if (_resourceLocker.Resources.Trees.ContainsKey(errorTree.TreeId) == false)\r\n                        //{\r\n                        //    _resourceLocker.Resources.Trees.Add(errorTree.TreeId, errorTree);\r\n                        //}\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Tree CreateErrorTree(string treeId, string errorMessage)\r\n        {\r\n            var tree = new Tree(\"ERRORTREE:\" + treeId)\r\n            {\r\n                BuildProcessContext = new BuildProcessContext(),\r\n                BuildResult = new BuildResult()\r\n            };\r\n\r\n            tree.AttachmentPoints.Add(\r\n                new EntityTokenAttachmentPoint\r\n                {\r\n                    EntityToken = new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeDefinitionId, treeId),\r\n                    Position = ElementAttachingProviderPosition.Top\r\n                }\r\n            );\r\n\r\n            tree.RootTreeNode = new RootTreeNode()\r\n            {\r\n                Id = \"ERRORTREEROOT\",\r\n                Tree = tree\r\n            };\r\n\r\n            var simpleElementTreeNode = new SimpleElementTreeNode()\r\n            {\r\n                Label = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"KeyFacade.ErrorTreeNode.Label\"),\r\n                Id = \"ERROR\",\r\n                ToolTip = errorMessage,\r\n                Icon = ResourceHandle.BuildIconFromDefaultProvider(\"close\"),\r\n                Tree = tree\r\n            };\r\n\r\n            var messageBoxActionNode = new MessageBoxActionNode\r\n            {\r\n                Id = 1,\r\n                OwnerNode = simpleElementTreeNode,\r\n                Label = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"KeyFacade.ErrorTreeNode.ShowMessage.Label\"),\r\n                ToolTip = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"KeyFacade.ErrorTreeNode.ShowMessage.ToolTip\"),\r\n                Icon = ResourceHandle.BuildIconFromDefaultProvider(\"log-showlog\"),\r\n                Title = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"KeyFacade.ErrorTreeNode.ShowMessage.Title\"),\r\n                Message = errorMessage,\r\n                DialogType = DialogType.Error,\r\n                PermissionTypes = new List<PermissionType> { PermissionType.Administrate }\r\n            };\r\n\r\n            simpleElementTreeNode.AddActionNode(messageBoxActionNode);\r\n\r\n            tree.RootTreeNode.AddChildTreeNode(simpleElementTreeNode);\r\n\r\n            return tree;\r\n        }\r\n\r\n\r\n\r\n        private Tree LoadTreeFromFile(string treeId)\r\n        {\r\n            string filename = Path.Combine(TreeDefinitionsFolder, treeId);\r\n\r\n            for (int i = 0; i < 10; i++)\r\n            {\r\n                try\r\n                {\r\n                    XDocument document = XDocumentUtils.Load(filename);\r\n                    return LoadTreeFromDom(treeId, document);\r\n                }\r\n                catch (IOException)\r\n                {\r\n                    Thread.Sleep(100);\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Could not load tree \" + treeId);\r\n        }\r\n\r\n\r\n\r\n        private void ReloadAllTrees()\r\n        {\r\n            using (ThreadDataManager.EnsureInitialize())\r\n            {\r\n                LoadAllTrees();\r\n\r\n                InitializeTreeAttachmentPoints();\r\n\r\n                TreeSharedRootsFacade.Clear();\r\n\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    var refreshTreeMessageQueueItem = new RefreshTreeMessageQueueItem\r\n                    {\r\n                        EntityToken = _resourceLocker.Resources.RootEntityToken\r\n                    };\r\n\r\n                    ConsoleMessageQueueFacade.Enqueue(refreshTreeMessageQueueItem, null);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Tree Load(string treeId, XDocument document)\r\n        {\r\n            Tree tree = TreeBuilder.BuildTree(treeId, document);\r\n\r\n            //if (tree.BuildResult.ValidationErrors.Count() == 0)\r\n            //{\r\n            //    tree.LogTree();\r\n            //}\r\n\r\n            return tree;\r\n        }\r\n\r\n\r\n        private void OnTreeAttachmentPointsStoreChange(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                InitializeTreeAttachmentPoints();\r\n            }\r\n        }\r\n\r\n\r\n        private void OnUpdateTreeAttachmentPoints(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            InitializeTreeAttachmentPoints();\r\n        }\r\n\r\n\r\n\r\n        #region Attachment points\r\n\r\n\r\n        public bool AddPersistedAttachmentPoint(string treeId, Type interfaceType, object keyValue, ElementAttachingProviderPosition position = ElementAttachingProviderPosition.Top)\r\n        {\r\n            var attachmentPoint = DataFacade.BuildNew<IDataItemTreeAttachmentPoint>();\r\n            attachmentPoint.Id = Guid.NewGuid();\r\n            attachmentPoint.TreeId = treeId;\r\n            attachmentPoint.Position = position.ToString();\r\n            attachmentPoint.InterfaceType = TypeManager.SerializeType(interfaceType);\r\n            attachmentPoint.KeyValue = ValueTypeConverter.Convert<string>(keyValue);\r\n\r\n            bool added = false;\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                bool exist =\r\n                    (from d in DataFacade.GetData<IDataItemTreeAttachmentPoint>()\r\n                     where d.InterfaceType == attachmentPoint.InterfaceType && d.KeyValue == attachmentPoint.KeyValue && d.TreeId == treeId\r\n                     select d).Any();\r\n\r\n                if (!exist)\r\n                {\r\n                    DataFacade.AddNew<IDataItemTreeAttachmentPoint>(attachmentPoint);\r\n                    added = true;\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            return added;\r\n        }\r\n\r\n\r\n\r\n        public bool RemovePersistedAttachmentPoint(string treeId, Type interfaceType, object keyValue)\r\n        {\r\n            string serializedInterfaceType = TypeManager.SerializeType(interfaceType);\r\n            string serializedKeyValue = ValueTypeConverter.Convert<string>(keyValue);\r\n\r\n            bool removed = false;\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IEnumerable<IDataItemTreeAttachmentPoint> dataItemTreeAttachmentPoints =\r\n                    (from d in DataFacade.GetData<IDataItemTreeAttachmentPoint>()\r\n                     where d.InterfaceType == serializedInterfaceType && d.KeyValue == serializedKeyValue && d.TreeId == treeId\r\n                     select d).Evaluate();\r\n\r\n                if (dataItemTreeAttachmentPoints.Any())\r\n                {\r\n                    DataFacade.Delete<IDataItemTreeAttachmentPoint>(dataItemTreeAttachmentPoints);\r\n                    removed = true;\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            return removed;\r\n        }\r\n\r\n        /// <summary>\r\n        /// This will add a attachment point until the system flushes.\r\n        /// This can be used by element provider implementors to attach trees to their existing trees.\r\n        /// </summary>\r\n        /// <param name=\"treeId\"></param>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <param name=\"position\"></param>\r\n        public bool AddCustomAttachmentPoint(string treeId, EntityToken entityToken, ElementAttachingProviderPosition position = ElementAttachingProviderPosition.Top)\r\n        {\r\n            Tree tree = GetTree(treeId);\r\n            if (tree == null) return false;\r\n\r\n            var customAttachmentPoint = new CustomAttachmentPoint(entityToken, position);\r\n            tree.AttachmentPoints.Add(customAttachmentPoint);\r\n\r\n            List<IAttachmentPoint> attachmentPoints;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.PersistentAttachmentPoints.TryGetValue(treeId, out attachmentPoints) == false)\r\n                {\r\n                    attachmentPoints = new List<IAttachmentPoint>();\r\n                    _resourceLocker.Resources.PersistentAttachmentPoints.Add(treeId, attachmentPoints);\r\n                }\r\n            }\r\n\r\n            attachmentPoints.Add(customAttachmentPoint);\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private void ClearAttachmentPoints<T>()\r\n            where T : IAttachmentPoint\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                foreach (Tree tree in _resourceLocker.Resources.Trees.Values)\r\n                {\r\n                    tree.ClearAttachmentPoints<T>();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void InitializeTreeAttachmentPoints()\r\n        {\r\n            lock (_reloadAttachmentPointsSyncRoot)\r\n            {\r\n                ClearAttachmentPoints<DynamicDataItemAttachmentPoint>();\r\n\r\n                IEnumerable<IDataItemTreeAttachmentPoint> attachmentPoints = DataFacade.GetData<IDataItemTreeAttachmentPoint>().Evaluate();\r\n\r\n                foreach (IDataItemTreeAttachmentPoint attachmentPoint in attachmentPoints)\r\n                {\r\n                    Tree tree = GetTree(attachmentPoint.TreeId);\r\n                    if (tree == null)\r\n                    {\r\n                        string treePath = Path.Combine(TreeDefinitionsFolder, attachmentPoint.TreeId);\r\n                        if (!C1File.Exists(treePath)) // This ensures that invalid, but existing trees does not remove these attachment points\r\n                        {\r\n                            if (DataFacade.WillDeleteSucceed(attachmentPoint))\r\n                            {\r\n                                Log.LogWarning(\"TreeFacade\", \"A data item attachment points is referring a non existing tree '{0}' and is deleted\", attachmentPoint.TreeId);\r\n\r\n                                // Preventing events so this method won't call itself recursively\r\n                                DataFacade.Delete(attachmentPoint, true, CascadeDeleteType.Allow);\r\n                            }\r\n                        }\r\n\r\n                        continue;\r\n                    }\r\n\r\n                    Type interfaceType = TypeManager.GetType(attachmentPoint.InterfaceType);\r\n                    object keyValue = ValueTypeConverter.Convert(attachmentPoint.KeyValue, interfaceType.GetKeyProperties()[0].PropertyType);\r\n\r\n                    var position = (ElementAttachingProviderPosition)Enum.Parse(typeof(ElementAttachingProviderPosition), attachmentPoint.Position);\r\n\r\n                    var dataItemTreeAttachmentPoint = new DynamicDataItemAttachmentPoint\r\n                    {\r\n                        InterfaceType = interfaceType,\r\n                        KeyValue = keyValue,\r\n                        Position = position\r\n                    };\r\n\r\n                    // Log.LogVerbose(\"TreeFacade\", string.Format(\"Tree with id '{0}' is dynamically attached to the data type '{1}' with key value of '{2}'\", attachmentPoint.TreeId, interfaceType, keyValue));\r\n\r\n                    tree.AttachmentPoints.Add(dataItemTreeAttachmentPoint);\r\n\r\n                    DataEventSystemFacade.SubscribeToDataDeleted(interfaceType, OnDataItemDeleted, false);\r\n                }\r\n\r\n\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    foreach (var kvp in _resourceLocker.Resources.PersistentAttachmentPoints)\r\n                    {\r\n                        Tree tree = GetTree(kvp.Key);\r\n                        if (tree == null) continue;\r\n\r\n                        tree.AttachmentPoints.AddRange(kvp.Value);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnDataItemDeleted(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            Type interfaceType = dataEventArgs.Data.DataSourceId.InterfaceType;\r\n\r\n            if (typeof(IPublishControlled).IsAssignableFrom(interfaceType) &&\r\n                !dataEventArgs.Data.DataSourceId.DataScopeIdentifier.Equals(DataScopeIdentifier.Administrated))\r\n            {\r\n                return; // Only remove attachment point if its the admin version of a publishable data item that have been delete\r\n            }\r\n\r\n            if (typeof(ILocalizedControlled).IsAssignableFrom(interfaceType) &&\r\n                DataFacade.ExistsInAnyLocale(interfaceType, dataEventArgs.Data.DataSourceId.LocaleScope))\r\n            {\r\n                return; // Data exists in other locales, so do not remove this attachment point\r\n            }\r\n\r\n            if (typeof(IVersioned).IsAssignableFrom(interfaceType) && interfaceType.GetKeyProperties().Count == 1)\r\n            {\r\n                var key = dataEventArgs.Data.GetUniqueKey();\r\n                var versions = DataFacade.TryGetDataVersionsByUniqueKey(interfaceType, key).ToList();\r\n\r\n                if (versions.Count > 0)\r\n                {\r\n                    return; // Do not delete the attachment point if the data is versioned\r\n                            // and not all of the versions of the element are deleted.\r\n                }\r\n            }\r\n\r\n            PropertyInfo propertyInfo = interfaceType.GetKeyProperties()[0];\r\n            string keyValue = ValueTypeConverter.Convert<string>(propertyInfo.GetValue(dataEventArgs.Data, null));\r\n\r\n            var serializedInterfaceType = TypeManager.SerializeType(interfaceType);\r\n\r\n            var attachmentPoints = \r\n                DataFacade.GetData<IDataItemTreeAttachmentPoint>()\r\n                          .Where(ap => ap.KeyValue == keyValue\r\n                                 && ap.InterfaceType == serializedInterfaceType);\r\n\r\n            DataFacade.Delete<IDataItemTreeAttachmentPoint>(attachmentPoints);\r\n        }\r\n\r\n        private static string TreeDefinitionsFolder\r\n        {\r\n            get { return PathUtil.Resolve(GlobalSettingsFacade.TreeDefinitionsDirectory); }\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Dictionary<string, Tree> Trees { get; set; }\r\n            public Dictionary<string, List<IAttachmentPoint>> PersistentAttachmentPoints { get; set; }\r\n            public C1FileSystemWatcher FileSystemWatcher { get; set; }\r\n            public DateTime LastFileChange { get; set; }\r\n            public EntityToken RootEntityToken { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.Trees = new Dictionary<string, Tree>();\r\n                resources.PersistentAttachmentPoints = new Dictionary<string, List<IAttachmentPoint>>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeFunctionElementGeneratorEntityToken.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\nusing Composite.Core;\r\nusing Composite.Core.Serialization;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    internal sealed class TreeFunctionElementGeneratorEntityToken : EntityToken, IEntityTokenContainingParentEntityToken\r\n    {\r\n        private EntityToken _parentEntityToken;\r\n        private readonly string _treeNodeId;\r\n        private readonly string _treeId;\r\n        private readonly string _serializedParentEntityToken;\r\n\r\n\r\n        public TreeFunctionElementGeneratorEntityToken(string treeNodeId, string treeId, string serializedParentEntityToken, string elementId)\r\n        {\r\n            _treeNodeId = treeNodeId;\r\n            _treeId = treeId;\r\n            _serializedParentEntityToken = serializedParentEntityToken;\r\n            this.ElementId = elementId;\r\n        }\r\n\r\n        [JsonConstructor]\r\n        private TreeFunctionElementGeneratorEntityToken(string id, string source, EntityToken parentEntityToken, string elementId)\r\n        {\r\n            _treeNodeId = id;\r\n            _treeId = source;\r\n            _parentEntityToken = parentEntityToken;\r\n            this.ElementId = elementId;\r\n        }\r\n\r\n        public override string Type => _serializedParentEntityToken;\r\n\r\n\r\n        public override string Source => _treeId;\r\n\r\n\r\n        public override string Id => _treeNodeId;\r\n\r\n\r\n        public string ElementId\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        public string TreeNodeId => this.Id;\r\n\r\n\r\n        [JsonIgnore]\r\n        public EntityToken ParentEntityToken\r\n        {\r\n            get\r\n            {\r\n                if (_parentEntityToken == null)\r\n                {\r\n                    _parentEntityToken = EntityTokenSerializer.Deserialize(this.Type);\r\n                }\r\n\r\n                return _parentEntityToken;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public EntityToken GetParentEntityToken()\r\n        {\r\n            return this.ParentEntityToken;\r\n        }\r\n\r\n\r\n\r\n        public override string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(this);\r\n        }\r\n\r\n\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                entityToken = CompositeJsonSerializer.Deserialize<TreeFunctionElementGeneratorEntityToken>(serializedEntityToken);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedEntityToken);\r\n                Log.LogVerbose(nameof(TreeFunctionElementGeneratorEntityToken), entityToken.GetType().FullName);\r\n            }\r\n            return entityToken;\r\n        }\r\n\r\n\r\n\r\n        public static EntityToken DeserializeLegacy(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            Dictionary<string, string> dic;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id, out dic);\r\n\r\n            string elementId = StringConversionServices.DeserializeValueString(dic[\"ElementId\"]);\r\n\r\n            return new TreeFunctionElementGeneratorEntityToken(id, source, type, elementId);\r\n        }\r\n\r\n        public override int GetHashCode()\r\n        {\r\n            return base.GetHashCode() ^ this.ElementId.GetHashCode();\r\n        }\r\n\r\n\r\n\r\n        public override bool Equals(object obj)\r\n        {\r\n            return base.Equals(obj)\r\n                && (obj as TreeFunctionElementGeneratorEntityToken).ElementId == this.ElementId;\r\n        }\r\n\r\n\r\n\r\n        public override void OnGetPrettyHtml(EntityTokenHtmlPrettyfier prettyfier)\r\n        {\r\n            EntityToken parentEntityToken = this.ParentEntityToken;\r\n\r\n            prettyfier.OnWriteType = (token, helper) => helper.AddFullRow(new string[] { \"<b>Type</b>\", string.Format(\"<b>ParentEntityToken:</b><br /><b>Type:</b> {0}<br /><b>Source:</b> {1}<br /><b>Id:</b>{2}<br />\", parentEntityToken.Type, parentEntityToken.Source, parentEntityToken.Id) });\r\n        }\r\n\r\n\r\n\r\n        public override string OnGetTypePrettyHtml()\r\n        {\r\n            EntityToken parentEntityToken = this.ParentEntityToken;\r\n\r\n            string type;\r\n            IEntityTokenContainingParentEntityToken containingParentEnitytToken = parentEntityToken as IEntityTokenContainingParentEntityToken;\r\n            if (containingParentEnitytToken != null)\r\n            {\r\n                type = string.Format(@\"<div style=\"\"border: 1px solid blue;\"\">{0}</div>\", parentEntityToken.OnGetTypePrettyHtml());\r\n            }\r\n            else\r\n            {\r\n                type = parentEntityToken.Type;\r\n            }\r\n\r\n            return string.Format(\"<b>ParentEntityToken:</b><br /><b>Type:</b> {0}<br /><b>Source:</b> {1}<br /><b>Id:</b>{2}<br />\", type, parentEntityToken.Source, parentEntityToken.Id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeMarkupConstants.cs",
    "content": "﻿using System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n\tinternal static class TreeMarkupConstants\r\n\t{\r\n        public static string NamespaceString = \"http://www.composite.net/ns/management/trees/treemarkup/1.0\";\r\n        public static XNamespace Namespace = (XNamespace)NamespaceString;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// Information about the ancestor node withing the same tree\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class AncestorResult\r\n    {\r\n        /// <exclude />\r\n        public AncestorResult(TreeNode treeNode, EntityToken entityToken)\r\n        {\r\n            this.TreeNode = treeNode;\r\n            this.EntityToken = entityToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public TreeNode TreeNode { get; private set; }\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken { get; private set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Represents a node in tree definition\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class TreeNode\r\n    {\r\n        /// <exclude />\r\n        protected List<TreeNode> _childNodes = new List<TreeNode>();\r\n\r\n        /// <exclude />\r\n        protected List<ActionNode> _actionNodes = new List<ActionNode>();\r\n\r\n        /// <exclude />\r\n        protected List<OrderByNode> _orderByNodes = new List<OrderByNode>();\r\n\r\n        /// <exclude />\r\n        protected List<FilterNode> _filterNodes = new List<FilterNode>();\r\n\r\n\r\n        /// <exclude />\r\n        public string XPath { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string Id { get; internal set; }\r\n\r\n\r\n        /// <exclude />\r\n        public Tree Tree { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public TreeNode ParentNode { get; internal set; }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<TreeNode> ChildNodes { get { return _childNodes; } }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<ActionNode> ActionNodes { get { return _actionNodes; } }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<OrderByNode> OrderByNodes { get { return _orderByNodes; } }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<FilterNode> FilterNodes { get { return _filterNodes; } }\r\n\r\n        /// <summary>\r\n        /// This is call when this nodes entity tokens are needed to climb up the tree.\r\n        /// If this tree nodes elements dont have any children, then this method will not be called.\r\n        /// </summary>\r\n        /// <param name=\"childEntityToken\">The child entity token.</param>\r\n        /// <param name=\"dynamicContext\">The dynamic context.</param>\r\n        /// <returns></returns>\r\n        public abstract IEnumerable<EntityToken> GetEntityTokens(EntityToken childEntityToken, TreeNodeDynamicContext dynamicContext);\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is called when a node has genereted its own entity tokens (by a child) and the child\r\n        /// needs to filter these entity token\r\n        /// </summary>\r\n        /// <param name=\"selfEntityToken\">The self entity token.</param>\r\n        /// <param name=\"parentGeneretedEntityTokens\">The parent genereted entity tokens.</param>\r\n        /// <param name=\"dynamicContext\">The dynamic context.</param>\r\n        /// <returns></returns>\r\n        internal virtual IEnumerable<EntityToken> FilterParentGeneretedEntityTokens(EntityToken selfEntityToken, IEnumerable<EntityToken> parentGeneretedEntityTokens, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            return parentGeneretedEntityTokens;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is called to, in the end, find a parent data entity token, so that the data item behind it can be used \r\n        /// by the start caller (ParentIdFilterNode) to get its own data item for creating an upward filter.\r\n        /// \r\n        /// If more than one parent exists, the first one is enough\r\n        /// \r\n        /// We are only looking for a data entity token, so 'jumping over' other\r\n        /// parents is allowed.\r\n        /// </summary>\r\n        /// <param name=\"ownEntityToken\"></param>\r\n        /// <param name=\"parentInterfaceOfInterest\">\r\n        /// We are searching for a data entity token of interface type state in this parameter\r\n        /// </param>\r\n        /// <param name=\"dynamicContext\"></param>\r\n        /// <returns></returns>\r\n        public abstract AncestorResult GetParentEntityToken(EntityToken ownEntityToken, Type parentInterfaceOfInterest, TreeNodeDynamicContext dynamicContext);\r\n\r\n\r\n        /// <summary>\r\n        /// This is called when this nodes elements are needed to create next sub level of tree elements.\r\n        /// </summary>\r\n        /// <param name=\"parentEntityToken\"></param>\r\n        /// <param name=\"dynamicContext\"></param>\r\n        /// <returns></returns>\r\n        protected abstract IEnumerable<Element> OnGetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext);\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Element> GetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            IEnumerable<Element> elements = OnGetElements(parentEntityToken, dynamicContext);\r\n\r\n            var localizeDataWorkflow = WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.LocalizeDataWorkflow\");\r\n\r\n            foreach (Element element in elements)\r\n            {\r\n                bool isForeignLocaleDataItem = element.Actions\r\n                        .Any(x => x.ActionHandle.ActionToken is WorkflowActionToken \r\n                        && ((WorkflowActionToken)x.ActionHandle.ActionToken).WorkflowType == localizeDataWorkflow);\r\n\r\n                if (!isForeignLocaleDataItem)\r\n                {\r\n                    foreach (ActionNode actionNode in this.ActionNodes)\r\n                    {\r\n                        actionNode.AddAction(element.AddAction, element.ElementHandle.EntityToken, dynamicContext);\r\n                    }\r\n                }\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is called after the build of the tree is finished\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        protected virtual void OnInitialize() { }\r\n\r\n\r\n        /// <exclude />\r\n        public void Initialize() \r\n        {\r\n            this.OnInitialize();\r\n\r\n            foreach (TreeNode treeNode in this.ChildNodes)\r\n            {\r\n                treeNode.Initialize();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal void AddValidationError(string stringName, params object[] args)\r\n        {\r\n            this.Tree.AddValidationError(this.XPath, stringName, args);\r\n        }\r\n\r\n\r\n\r\n        internal TreeNode AddChildTreeNode(TreeNode treeNode)\r\n        {\r\n            treeNode.ParentNode = this;\r\n            _childNodes.Add(treeNode);\r\n\r\n            return this;\r\n        }\r\n\r\n\r\n\r\n        internal void RemoveChildTreeNode(TreeNode treeNode)\r\n        {\r\n            _childNodes.Remove(treeNode);\r\n        }\r\n\r\n\r\n\r\n        internal void AddActionNode(ActionNode actionNode)\r\n        {\r\n            actionNode.OwnerNode = this;\r\n            _actionNodes.Add(actionNode);\r\n\r\n        }\r\n\r\n\r\n\r\n        internal void AddOrderByNode(OrderByNode orderByNode)\r\n        {\r\n            orderByNode.SetOwnerNode(this);\r\n            _orderByNodes.Add(orderByNode);\r\n        }\r\n\r\n\r\n\r\n        internal void AddFilterNode(FilterNode filterNode)\r\n        {\r\n            filterNode.SetOwnerNode(this);\r\n            _filterNodes.Add(filterNode);            \r\n        }\r\n\r\n\r\n\r\n        internal bool IsAncestor(TreeNode treeNode)\r\n        {\r\n            TreeNode ancestorNode = this.ParentNode;\r\n\r\n            while (ancestorNode != null)\r\n            {\r\n                if (ancestorNode.Id == treeNode.Id) return true;\r\n\r\n                ancestorNode = ancestorNode.ParentNode;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        internal bool IsDescendant(TreeNode treeNode)\r\n        {\r\n            return this.ChildNodes.Any(childNode => childNode.Id == treeNode.Id || childNode.IsDescendant(treeNode));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected string ParentString()\r\n        {\r\n            return \"ParentId = \" + ((ParentNode != null) ? ParentNode.Id : \"-1\");\r\n        }\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeNodeDynamicContext.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing Composite.C1Console.Security;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum TreeNodeDynamicContextDirection\r\n    {\r\n        /// <exclude />\r\n        Down, // Creating elements\r\n\r\n        /// <exclude />\r\n        Up // Getting ancestor entity tokens\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [DebuggerDisplay(\"TreeNodeDynamicContext. Direction: {Direction}\")]\r\n    public sealed class TreeNodeDynamicContext\r\n    {\r\n        private Dictionary<string, object> _fieldGroupingValues;\r\n        private Dictionary<string, int> _fieldFolderRangeValues;\r\n\r\n\r\n        /// <exclude />\r\n        public TreeNodeDynamicContext(TreeNodeDynamicContextDirection treeNodeDynamicContextDirection)\r\n        {\r\n            this.Direction = treeNodeDynamicContextDirection;\r\n            this.CustomData = new Dictionary<string, object>();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ElementProviderName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public TreeNodeDynamicContextDirection Direction { get; internal set; }\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> FieldGroupingValues\r\n        {\r\n            get\r\n            {\r\n                if (_fieldGroupingValues == null)\r\n                {\r\n                    _fieldGroupingValues = new Dictionary<string, object>();\r\n                }\r\n\r\n                return _fieldGroupingValues;\r\n            }\r\n            set\r\n            {\r\n                _fieldGroupingValues = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, int> FieldFolderRangeValues\r\n        {\r\n            get\r\n            {\r\n                if (_fieldFolderRangeValues == null)\r\n                {\r\n                    _fieldFolderRangeValues = new Dictionary<string, int>();\r\n                }\r\n\r\n                return _fieldFolderRangeValues;\r\n            }\r\n            set\r\n            {\r\n                _fieldFolderRangeValues = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> Piggybag { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public EntityToken CurrentEntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public TreeNode CurrentTreeNode { get; set; }\r\n\r\n\r\n        internal Dictionary<string, object> CustomData { get; set; }\r\n\r\n\r\n        internal bool IsRoot { get; set; }\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeNodeExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal static class TreeNodeExtensions\r\n    {\r\n        public static IEnumerable<T> OfType<T>(this IEnumerable<FilterNode> filterNodes)\r\n            where T : FilterNode\r\n        {\r\n            return filterNodes.Where(f => f.GetType() == typeof(T)).Cast<T>();\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Element> GetElements(this IEnumerable<TreeNode> treeNodes, EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)\r\n        {\r\n            IEnumerable<Element> elements = null;\r\n            foreach (TreeNode treeNode in treeNodes)\r\n            {\r\n                if (elements == null)\r\n                {\r\n                    elements = treeNode.GetElements(parentEntityToken, dynamicContext);\r\n                }\r\n                else\r\n                {\r\n                    elements = elements.Concat(treeNode.GetElements(parentEntityToken, dynamicContext));\r\n                }\r\n            }\r\n\r\n            if (elements == null)\r\n            {\r\n                elements = new List<Element>();\r\n            }\r\n\r\n            return elements;\r\n        }\r\n\r\n\r\n\r\n        public static bool SelfAndParentsHasInterface(this TreeNode treeNode, Type interfaceType)\r\n        {\r\n            DataFilteringTreeNode dataFilteringTreeNode = null;\r\n            while (treeNode != null)\r\n            {\r\n                dataFilteringTreeNode = treeNode as DataFilteringTreeNode;\r\n                if (dataFilteringTreeNode != null) break;\r\n\r\n                treeNode = treeNode.ParentNode;\r\n            }\r\n\r\n            if (dataFilteringTreeNode == null) return false;\r\n\r\n            if (dataFilteringTreeNode.CurrentDataInterfaceType == interfaceType) return true;\r\n\r\n            return treeNode.ParentNode.SelfAndParentsHasInterface(interfaceType);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<TreeNode> AncestorsAndSelf(this TreeNode treeNode)\r\n        {\r\n            return Ancestors(treeNode, true);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<TreeNode> Ancestors(this TreeNode treeNode, bool includeSelf = false)\r\n        {\r\n            if (includeSelf)\r\n            {\r\n                yield return treeNode;\r\n            }\r\n\r\n            TreeNode parentTreeNode = treeNode.ParentNode;\r\n\r\n            while (parentTreeNode != null)\r\n            {\r\n                yield return parentTreeNode;\r\n\r\n                parentTreeNode = parentTreeNode.ParentNode;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<TreeNode> Descendants(this TreeNode treeNode, bool includeSelf = false)\r\n        {\r\n            if (includeSelf) yield return treeNode;\r\n\r\n            foreach (TreeNode childTreeNode in treeNode.ChildNodes)\r\n            {\r\n                foreach (TreeNode node in childTreeNode.DescendantsImpl())\r\n                {\r\n                    yield return node;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static IEnumerable<TreeNode> DescendantsImpl(this TreeNode treeNode)\r\n        {\r\n            yield return treeNode;\r\n\r\n            foreach (TreeNode childTreeNode in treeNode.ChildNodes)\r\n            {                \r\n                foreach (TreeNode node in childTreeNode.DescendantsImpl())\r\n                {\r\n                    yield return node;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static IEnumerable<TreeNode> DescendantsBreadthFirst(this TreeNode treeNode, bool includeSelf = false)\r\n        {\r\n            Queue<TreeNode> notVisistedTreeNodes = new Queue<TreeNode>();\r\n\r\n            if (includeSelf)\r\n            {\r\n                notVisistedTreeNodes.Enqueue(treeNode);\r\n            }\r\n            else\r\n            {\r\n                foreach (TreeNode childTreeNode in treeNode.ChildNodes)\r\n                {\r\n                    notVisistedTreeNodes.Enqueue(childTreeNode);\r\n                }\r\n            }\r\n\r\n            while (notVisistedTreeNodes.Count > 0)\r\n            {\r\n                TreeNode tn = notVisistedTreeNodes.Dequeue();\r\n\r\n                foreach (TreeNode ctn in tn.ChildNodes)\r\n                {\r\n                    notVisistedTreeNodes.Enqueue(ctn);\r\n                }\r\n\r\n                yield return tn;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void LogTree(this TreeNode treeNodes, int level = 0)\r\n        {\r\n            LogTree(new TreeNode[] { treeNodes }, level);\r\n        }\r\n\r\n\r\n\r\n        public static void LogTree(this IEnumerable<TreeNode> treeNodes)\r\n        {\r\n            LogTree(treeNodes, 0);\r\n        }\r\n\r\n\r\n\r\n        public static void LogTree(this IEnumerable<TreeNode> treeNodes, int level)\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            for (int i = 0; i < level; i++)\r\n            {\r\n                sb.Append(\"  \");\r\n            }\r\n\r\n            //sb.Append(\r\n            foreach (TreeNode treeNode in treeNodes)\r\n            {\r\n\r\n                LoggingService.LogVerbose(\"TreeFacade\", string.Format(\"{0}{1}\", sb, treeNode.ToString()));\r\n                sb.Append(\" \");\r\n                LogFilter(treeNode.FilterNodes, sb.ToString());\r\n                LogOrderBy(treeNode.OrderByNodes, sb.ToString());\r\n                LogActions(treeNode.ActionNodes, sb.ToString());\r\n                LogTree(treeNode.ChildNodes, level + 1);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void LogFilter(IEnumerable<FilterNode> filterNodes, string spacer)\r\n        {\r\n            foreach (FilterNode filterNode in filterNodes)\r\n            {\r\n                LoggingService.LogVerbose(\"TreeFacade\", string.Format(\"{0}* {1}\", spacer, filterNode.ToString()));\r\n            }\r\n        }\r\n        \r\n        \r\n        \r\n        private static void LogOrderBy(IEnumerable<OrderByNode> orderByNodes, string spacer)\r\n        {\r\n            foreach (OrderByNode orderByNode in orderByNodes)\r\n            {\r\n                LoggingService.LogVerbose(\"TreeFacade\", string.Format(\"{0}¤ {1}\", spacer, orderByNode.ToString()));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void LogActions(IEnumerable<ActionNode> actionNodes, string spacer)\r\n        {\r\n            foreach (ActionNode actionNode in actionNodes)\r\n            {\r\n                LoggingService.LogVerbose(\"TreeFacade\", string.Format(\"{0}# {1}\", spacer, actionNode.ToString()));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void InitializeActions(this TreeNode treeNode)\r\n        {\r\n            foreach (ActionNode actionNode in treeNode.ActionNodes)\r\n            {\r\n                actionNode.Initialize();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void InitializeOrderByes(this TreeNode treeNode)\r\n        {\r\n            foreach (OrderByNode orderByNode in treeNode.OrderByNodes)\r\n            {\r\n                orderByNode.Initialize();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void InitializeFilters(this TreeNode treeNode)\r\n        {\r\n            foreach (FilterNode filterNode in treeNode.FilterNodes)\r\n            {\r\n                filterNode.Initialize();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeSharedRootsFacade.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Foundation;\r\nusing Composite.C1Console.Elements.Foundation.PluginFacades;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees.Foundation;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal class CustomTreePerspectiveInfo\r\n    {\r\n        public NamedAttachmentPoint AttachmentPoint { get; set; }\r\n        public Element Element { get; set; }\r\n        public List<Tree> Trees { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal static class TreeSharedRootsFacade\r\n    {\r\n        private static volatile IReadOnlyDictionary<string, CustomTreePerspectiveInfo> _sharedRootFolders;\r\n        private static string _elementAttachingProviderName;\r\n        private static readonly object _lock = new object();\r\n\r\n        public static IReadOnlyDictionary<string, CustomTreePerspectiveInfo> SharedRootFolders => GetSharedRootsInt(null);\r\n        \r\n\r\n        public static void Initialize(string elementAttachingProviderName = null)\r\n        {\r\n            GetSharedRootsInt(elementAttachingProviderName);\r\n        }\r\n\r\n        private static IReadOnlyDictionary<string, CustomTreePerspectiveInfo> GetSharedRootsInt(string elementAttachingProviderName)\r\n        {\r\n            var result = _sharedRootFolders;\r\n            if (result != null) return result;\r\n\r\n            lock (_lock)\r\n            {\r\n                result = _sharedRootFolders;\r\n                if (result != null) return result;\r\n\r\n                if (_elementAttachingProviderName == null)\r\n                {\r\n                    _elementAttachingProviderName = elementAttachingProviderName ?? GetElementAttachingProviderName();\r\n                }\r\n\r\n                result = GetSharedRoots(_elementAttachingProviderName);\r\n                _sharedRootFolders = result;\r\n\r\n                return result;\r\n            }\r\n        }\r\n\r\n\r\n        private static string GetElementAttachingProviderName()\r\n        {\r\n            foreach (string providerName in ElementAttachingProviderRegistry.ElementAttachingProviderNames)\r\n            {\r\n                var provider = ElementAttachingProviderPluginFacade.GetElementAttachingProvider(providerName);\r\n                if (provider is TreeElementAttachingProvider)\r\n                {\r\n                    return  providerName;\r\n                }\r\n            }\r\n            return null;\r\n        }\r\n\r\n\r\n        public static void Clear()\r\n        {\r\n            _sharedRootFolders = null;\r\n        }\r\n\r\n\r\n\r\n        private static IReadOnlyDictionary<string, CustomTreePerspectiveInfo> GetSharedRoots(string elementAttachingProviderName)\r\n        {\r\n            var sharedRootFolders = new Dictionary<string, CustomTreePerspectiveInfo>();\r\n\r\n            foreach (var tree in TreeFacade.AllTrees)\r\n            {\r\n                if (!tree.ShareRootElementById) continue;\r\n\r\n                IEnumerable<NamedAttachmentPoint> namedAttachmentPoints =\r\n                    tree.AttachmentPoints.\r\n                    OfType<NamedAttachmentPoint>();\r\n\r\n                if (namedAttachmentPoints.Count() != 1) continue;\r\n\r\n                if (tree.RootTreeNode.ChildNodes.Count() != 1) continue;\r\n\r\n                SimpleElementTreeNode childTreeNode = tree.RootTreeNode.ChildNodes.Single() as SimpleElementTreeNode;\r\n\r\n                if (childTreeNode == null) continue;\r\n\r\n                NamedAttachmentPoint namedAttachmentPoint = namedAttachmentPoints.Single();\r\n\r\n\r\n                EntityToken perspectiveEntityToken;\r\n                if (!sharedRootFolders.ContainsKey(childTreeNode.Id))\r\n                {\r\n                    perspectiveEntityToken = new TreePerspectiveEntityToken(childTreeNode.Id);\r\n\r\n                    var dynamicValuesHelperReplaceContext = new DynamicValuesHelperReplaceContext(\r\n                        namedAttachmentPoint.AttachingPoint.EntityToken, \r\n                        null);\r\n\r\n                    // MRJ: Collection actions\r\n                    Element element = new Element(new ElementHandle(elementAttachingProviderName, perspectiveEntityToken))\r\n                    {\r\n                        VisualData = new ElementVisualizedData\r\n                        {\r\n                            Label = childTreeNode.LabelDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext),\r\n                            ToolTip = childTreeNode.ToolTipDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext),\r\n                            HasChildren = true,\r\n                            Icon = childTreeNode.Icon,\r\n                            OpenedIcon = childTreeNode.OpenIcon\r\n                        }\r\n                    };\r\n\r\n                    sharedRootFolders.Add(childTreeNode.Id, new CustomTreePerspectiveInfo\r\n                    {\r\n                        AttachmentPoint = new NamedAttachmentPoint\r\n                        {\r\n                            AttachingPoint = new AttachingPoint(namedAttachmentPoint.AttachingPoint),\r\n                            Position = namedAttachmentPoint.Position\r\n                        },\r\n                        Element = element,\r\n                        Trees = new List<Tree> { tree }\r\n                    });\r\n                }\r\n                else\r\n                {\r\n                    perspectiveEntityToken = sharedRootFolders[childTreeNode.Id].Element.ElementHandle.EntityToken;\r\n                    sharedRootFolders[childTreeNode.Id].Trees.Add(tree);\r\n                }\r\n\r\n                namedAttachmentPoint.AttachingPoint = new AttachingPoint(perspectiveEntityToken);\r\n                tree.RootTreeNode = childTreeNode;\r\n            }\r\n            \r\n            return sharedRootFolders;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/TreeSimpleElementEntityToken.cs",
    "content": "﻿using System.Diagnostics;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\nusing Composite.Core.Serialization;\r\nusing Newtonsoft.Json;\r\nusing Composite.Core;\r\nusing Newtonsoft.Json.Linq;\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    [DebuggerDisplay(\"Id = {Id}, TreeId = {Source}, ParentEntityToken = {Type}\")]\r\n    public sealed class TreeSimpleElementEntityToken : EntityToken, IEntityTokenContainingParentEntityToken\r\n    {\r\n        private EntityToken _parentEntityToken;\r\n        private readonly string _treeNodeId;\r\n        private readonly string _treeId;\r\n        private readonly string _serializedParentEntityToken;\r\n\r\n        /// <exclude />\r\n        public TreeSimpleElementEntityToken(string treeNodeId, string treeId, string serializedParentEntityToken)\r\n        {\r\n            _treeNodeId = treeNodeId;\r\n            _treeId = treeId;\r\n            _serializedParentEntityToken = serializedParentEntityToken;\r\n        }\r\n\r\n        [JsonConstructor]\r\n        private TreeSimpleElementEntityToken(string treeNodeId, string treeId, JRaw parentEntityToken, string serializedParentEntityToken)\r\n        {\r\n            _treeNodeId = treeNodeId;\r\n            _treeId = treeId;\r\n            _serializedParentEntityToken = parentEntityToken?.Value.ToString() ?? serializedParentEntityToken;\r\n        }\r\n\r\n        /// <exclude />\r\n        [JsonProperty(PropertyName = \"serializedParentEntityToken\")]\r\n        public override string Type => _serializedParentEntityToken;\r\n\r\n        /// <exclude />\r\n        public bool ShouldSerializeType()\r\n        {\r\n            return !CompositeJsonSerializer.IsJsonSerialized(_serializedParentEntityToken);\r\n        }\r\n\r\n        [JsonProperty(PropertyName = \"parentEntityToken\")]\r\n        private JRaw rawSerializedParentEntityToken => new JRaw(_serializedParentEntityToken);\r\n\r\n        /// <exclude />\r\n        public bool ShouldSerializerawSerializedParentEntityToken()\r\n        {\r\n            return CompositeJsonSerializer.IsJsonSerialized(_serializedParentEntityToken);\r\n        }\r\n\r\n        /// <exclude />\r\n        [JsonProperty(PropertyName = \"treeId\")]\r\n        public override string Source => _treeId;\r\n\r\n\r\n        /// <exclude />\r\n        [JsonProperty(PropertyName = \"treeNodeId\")]\r\n        public override string Id => _treeNodeId;\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public string TreeNodeId => this.Id;\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public string SerializedParentEntityToken => _serializedParentEntityToken;\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public EntityToken ParentEntityToken\r\n        {\r\n            get\r\n            {\r\n                if (_parentEntityToken == null)\r\n                {\r\n                    _parentEntityToken = EntityTokenSerializer.Deserialize(_serializedParentEntityToken);\r\n                }\r\n\r\n                return _parentEntityToken;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public EntityToken GetParentEntityToken()\r\n        {\r\n            return this.ParentEntityToken;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(this);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                entityToken =\r\n                    CompositeJsonSerializer.Deserialize<TreeSimpleElementEntityToken>(serializedEntityToken);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedEntityToken);\r\n                Log.LogVerbose(nameof(TreeSimpleElementEntityToken), entityToken.GetType().FullName);\r\n            }\r\n            return entityToken;\r\n\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken DeserializeLegacy(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new TreeSimpleElementEntityToken(id, source, type);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override void OnGetPrettyHtml(EntityTokenHtmlPrettyfier prettyfier)\r\n        {\r\n            EntityToken parentEntityToken = this.ParentEntityToken;\r\n\r\n            prettyfier.OnWriteType = (token, helper) => helper.AddFullRow(new string[] { \"<b>Type</b>\", string.Format(\"<b>ParentEntityToken:</b><br /><b>Type:</b> {0}<br /><b>Source:</b> {1}<br /><b>Id:</b>{2}<br />\", parentEntityToken.Type, parentEntityToken.Source, parentEntityToken.Id) });\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string OnGetTypePrettyHtml()\r\n        {\r\n            EntityToken parentEntityToken = this.ParentEntityToken;\r\n\r\n            string type;\r\n            if ((parentEntityToken is TreeSimpleElementEntityToken))\r\n            {\r\n                type = string.Format(@\"<div style=\"\"border: 1px solid blue;\"\">{0}</div>\", parentEntityToken.OnGetTypePrettyHtml());\r\n            }\r\n            else\r\n            {\r\n                type = parentEntityToken.Type;\r\n            }\r\n\r\n            return string.Format(\"<b>ParentEntityToken:</b><br /><b>Type:</b> {0}<br /><b>Source:</b> {1}<br /><b>Id:</b>{2}<br />\", type, parentEntityToken.Source, parentEntityToken.Id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/ValidationError.cs",
    "content": "﻿using Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ValidationError\r\n    {\r\n        /// <exclude />\r\n        public static ValidationError Create(string xPath, string stringName, params object[] args)\r\n        {\r\n            string resourceString;\r\n\r\n            try \r\n            {\r\n                resourceString = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", stringName);\r\n            }\r\n            catch\r\n            {\r\n                resourceString = string.Format(\"STRING RESOURCE NAMED '{0}' NOT FOUND\", stringName);\r\n            }\r\n\r\n            return new ValidationError(xPath, string.Format(resourceString, args));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ValidationError(string xPath, string message)\r\n        {\r\n            this.XPath = xPath;\r\n            this.Message = message;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string XPath { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Message { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Trees/WorkflowActionNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Trees\r\n{\r\n    internal sealed class WorkflowActionNode : ActionNode\r\n    {\r\n        public Type WorkflowType { get; internal set; }     // Requried\r\n\r\n\r\n        protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)\r\n        {\r\n            WorkflowActionToken actionToken = new WorkflowActionToken(\r\n                WorkflowFacade.GetWorkflowType(TypeManager.SerializeType(this.WorkflowType)),\r\n                this.PermissionTypes)\r\n            {\r\n                Payload = this.Serialize(),\r\n                ExtraPayload = PiggybagSerializer.Serialize(dynamicContext.Piggybag.PreparePiggybag(dynamicContext.CurrentTreeNode, dynamicContext.CurrentEntityToken)),\r\n                DoIgnoreEntityTokenLocking = true\r\n            };\r\n\r\n\r\n            actionAdder(new ElementAction(new ActionHandle(actionToken))\r\n            {\r\n                VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)\r\n            });\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Users/IUserSettingsFacade.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Net;\r\n\r\n\r\nnamespace Composite.C1Console.Users\r\n{\r\n    internal interface IUserSettingsFacade\r\n    {\r\n        string Username { get; }\r\n        CultureInfo CultureInfo { get; set; }\r\n        CultureInfo C1ConsoleUiLanguage { get; set; }\r\n\r\n        CultureInfo GetUserCultureInfo(string username);\r\n        void SetUserCultureInfo(string username, CultureInfo cultureInfo);\r\n\r\n        CultureInfo GetUserC1ConsoleUiLanguage(string username);\r\n        void SetUserC1ConsoleUiLanguage(string username, CultureInfo cultureInfo);\r\n\r\n        CultureInfo GetCurrentActiveLocaleCultureInfo(string username);\r\n        void SetCurrentActiveLocaleCultureInfo(string username, CultureInfo cultureInfo);\r\n        void AddActiveLocaleCultureInfo(string username, CultureInfo cultureInfo);\r\n        void RemoveActiveLocaleCultureInfo(string username, CultureInfo cultureInfo);\r\n        IEnumerable<CultureInfo> GetActiveLocaleCultureInfos(string username);\r\n\r\n        CultureInfo GetForeignLocaleCultureInfo(string username);\r\n        void SetForeignLocaleCultureInfo(string username, CultureInfo cultureInfo);\r\n\r\n        string LastSpecifiedNamespace { get; set;}\r\n        IPAddress UserIPAddress { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Users/UserSettings.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Caching;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Users\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class UserSettings\r\n    {\r\n        private static IUserSettingsFacade _implementation = new UserSettingsImpl();\r\n\r\n        internal static IUserSettingsFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n        /// <exclude />\r\n        public static string Username\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Username;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// A language to which C1 console UI is translated to.\r\n        /// </summary>\r\n        public static CultureInfo C1ConsoleUiLanguage\r\n        {\r\n            get\r\n            {\r\n                return _implementation.C1ConsoleUiLanguage;\r\n            }\r\n            set\r\n            {\r\n                _implementation.C1ConsoleUiLanguage = value;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Culture used in console UI for date/number formatting.\r\n        /// </summary>\r\n        public static CultureInfo CultureInfo\r\n        {\r\n            get\r\n            {\r\n                return _implementation.CultureInfo;\r\n            }\r\n            set\r\n            {\r\n                _implementation.CultureInfo = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo GetUserCultureInfo(string username)\r\n        {\r\n            return _implementation.GetUserCultureInfo(username);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo GetUserC1ConsoleUiLanguage(string username)\r\n        {\r\n            return _implementation.GetUserC1ConsoleUiLanguage(username);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetUserCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            _implementation.SetUserCultureInfo(username, cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetUserC1ConsoleUiLanguage(string username, CultureInfo cultureInfo)\r\n        {\r\n            _implementation.SetUserC1ConsoleUiLanguage(username, cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// This is an overload for GetCurrentActiveLocaleCultureInfo(string username)\r\n        /// using the current username.\r\n        /// </summary>\r\n        public static CultureInfo ActiveLocaleCultureInfo\r\n        {\r\n            get\r\n            {\r\n                return GetCurrentActiveLocaleCultureInfo(UserSettings.Username);\r\n            }\r\n            set\r\n            {\r\n                SetCurrentActiveLocaleCultureInfo(UserSettings.Username, value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo GetCurrentActiveLocaleCultureInfo(string username)\r\n        {\r\n            var key = \"CurrentActiveCulture\" + username;\r\n            if (RequestLifetimeCache.HasKey(key)) return RequestLifetimeCache.TryGet<CultureInfo>(key);\r\n\r\n            var cultureInfo = _implementation.GetCurrentActiveLocaleCultureInfo(username);\r\n            var allowedCultures = GetActiveLocaleCultureInfos(username, true);\r\n\r\n            if( !allowedCultures.Contains(cultureInfo)) cultureInfo = allowedCultures.FirstOrDefault();\r\n\r\n            if (cultureInfo != null && !RequestLifetimeCache.HasKey(key)) RequestLifetimeCache.Add(key, cultureInfo);\r\n\r\n            return cultureInfo ?? CultureInfo.InvariantCulture;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetCurrentActiveLocaleCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            _implementation.SetCurrentActiveLocaleCultureInfo(username, cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// This is an overload for GetForeignLocaleCultureInfo(string username)\r\n        /// using the current username.\r\n        /// </summary>\r\n        public static CultureInfo ForeignLocaleCultureInfo\r\n        {\r\n            get\r\n            {\r\n                return GetForeignLocaleCultureInfo(UserSettings.Username);\r\n            }\r\n            set\r\n            {\r\n                SetForeignLocaleCultureInfo(UserSettings.Username, value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo GetForeignLocaleCultureInfo(string username)\r\n        {\r\n            return _implementation.GetForeignLocaleCultureInfo(username);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetForeignLocaleCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            _implementation.SetForeignLocaleCultureInfo(username, cultureInfo);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void AddActiveLocaleCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            _implementation.AddActiveLocaleCultureInfo(username, cultureInfo);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveActiveLocaleCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            _implementation.RemoveActiveLocaleCultureInfo(username, cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// This is an overload for GetActiveLocaleCultureInfos(string username, includeGroupAssignedCultures = true)\r\n        /// using the current username.\r\n        /// </summary>\r\n        public static IEnumerable<CultureInfo> ActiveLocaleCultureInfos\r\n        {\r\n            get\r\n            {\r\n                return GetActiveLocaleCultureInfos(UserSettings.Username, true);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<CultureInfo> GetActiveLocaleCultureInfos(string username, bool includeGroupAssignedCultures = true)\r\n        {\r\n            return includeGroupAssignedCultures ?\r\n                _implementation.GetActiveLocaleCultureInfos(username).Union(UserGroupFacade.GetUserGroupActiveCultures(username)) :\r\n                _implementation.GetActiveLocaleCultureInfos(username);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string LastSpecifiedNamespace\r\n        {\r\n            get\r\n            {\r\n                return _implementation.LastSpecifiedNamespace;\r\n            }\r\n            set\r\n            {\r\n                _implementation.LastSpecifiedNamespace = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IPAddress UserIPAddress\r\n        {\r\n            get\r\n            {\r\n                return _implementation.UserIPAddress;\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Users/UserSettingsImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing Composite.Core.Caching;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.C1Console.Users\r\n{\r\n    internal class UserSettingsImpl : IUserSettingsFacade\r\n    {\r\n        private static readonly object _lock = new object();\r\n\r\n        private static readonly Cache<string, IUserSettings> _userSettingsCache = new Cache<string, IUserSettings>(\"User settings\", 100);\r\n\r\n        static UserSettingsImpl()\r\n        {\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd<IUserSettings>(OnUserSettingsChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IUserSettings>(OnUserSettingsChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<IUserSettings>(OnUserSettingsChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IUserSettings>(OnUserStoreChanged, true);\r\n        }\r\n\r\n\r\n\r\n        private static void OnUserStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    _userSettingsCache.Clear();\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void OnUserSettingsChanged(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            IUserSettings settings = dataEventArgs.Data as IUserSettings;\r\n            if(settings != null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    _userSettingsCache.Remove(settings.Username);\r\n                }\r\n            }\r\n        }\r\n\r\n        public string Username\r\n        {\r\n            get\r\n            {\r\n                return UserValidationFacade.GetUsername();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public CultureInfo CultureInfo\r\n        {\r\n            get\r\n            {\r\n                if (UserProfileDataAvailable)\r\n                {\r\n                    return CultureInfo.CreateSpecificCulture(GetSettings(UserSettings.Username, true).CultureName);\r\n                }\r\n                return GlobalSettingsFacade.DefaultCultureInfo;\r\n            }\r\n            set\r\n            {\r\n                IUserSettings settings = GetSettings(UserSettings.Username, false);\r\n                settings.CultureName = value.ToString();\r\n                DataFacade.Update(settings);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public CultureInfo C1ConsoleUiLanguage\r\n        {\r\n            get\r\n            {\r\n                if (UserProfileDataAvailable)\r\n                {\r\n                    return CultureInfo.CreateSpecificCulture(GetSettings(UserSettings.Username, true).C1ConsoleUiLanguage);\r\n                }\r\n                return GlobalSettingsFacade.DefaultCultureInfo;\r\n            }\r\n            set\r\n            {\r\n                IUserSettings settings = GetSettings(UserSettings.Username, false);\r\n                settings.C1ConsoleUiLanguage = value.ToString();\r\n                DataFacade.Update(settings);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public CultureInfo GetUserCultureInfo(string username)\r\n        {\r\n            IUserSettings settings = GetSettings(username, true);\r\n            return CultureInfo.CreateSpecificCulture(settings.CultureName);\r\n        }\r\n\r\n\r\n\r\n        public void SetUserCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            IUserSettings settings = GetSettings(username, false);           \r\n            settings.CultureName = cultureInfo.Name;\r\n            DataFacade.Update(settings);\r\n        }\r\n\r\n\r\n\r\n        public CultureInfo GetUserC1ConsoleUiLanguage(string username)\r\n        {\r\n            IUserSettings settings = GetSettings(username, true);\r\n            return CultureInfo.CreateSpecificCulture(settings.C1ConsoleUiLanguage);\r\n        }\r\n\r\n\r\n\r\n        public void SetUserC1ConsoleUiLanguage(string username, CultureInfo cultureInfo)\r\n        {\r\n            IUserSettings settings = GetSettings(username, false);\r\n            settings.C1ConsoleUiLanguage = cultureInfo.Name;\r\n            DataFacade.Update(settings);\r\n        }\r\n\r\n\r\n\r\n        public CultureInfo GetCurrentActiveLocaleCultureInfo(string username)\r\n        {\r\n            IUserSettings settings = GetSettings(username, true);\r\n            if (settings.CurrentActiveLocaleCultureName != null)\r\n            {\r\n                return CultureInfo.CreateSpecificCulture(settings.CurrentActiveLocaleCultureName);                \r\n            }\r\n            return DataLocalizationFacade.DefaultLocalizationCulture;\r\n        }\r\n\r\n\r\n\r\n        public void SetCurrentActiveLocaleCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            IUserSettings settings = GetSettings(username, false);\r\n            settings.CurrentActiveLocaleCultureName = cultureInfo.Name;\r\n            DataFacade.Update(settings);\r\n        }\r\n\r\n\r\n\r\n        public CultureInfo GetForeignLocaleCultureInfo(string username)\r\n        {\r\n            IUserSettings settings = GetSettings(username, true);\r\n            if (settings.ForeignLocaleCultureName != null)\r\n            {\r\n                return CultureInfo.CreateSpecificCulture(settings.ForeignLocaleCultureName);\r\n            }\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        public void SetForeignLocaleCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            IUserSettings settings = GetSettings(username, false);\r\n            if (cultureInfo != null)\r\n            {\r\n                settings.ForeignLocaleCultureName = cultureInfo.Name;\r\n            }\r\n            else\r\n            {\r\n                settings.ForeignLocaleCultureName = null;\r\n            }\r\n            DataFacade.Update(settings);\r\n        }\r\n\r\n\r\n\r\n        public void AddActiveLocaleCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            bool exists =\r\n                (from ual in DataFacade.GetData<IUserActiveLocale>()\r\n                 where ual.Username == username &&\r\n                       ual.CultureName == cultureInfo.Name\r\n                 select ual).Any();\r\n\r\n            if (exists) return;\r\n\r\n            GetSettings(username, true); // Ensure that we have usersettings \r\n\r\n            var userActiveLocale = DataFacade.BuildNew<IUserActiveLocale>();\r\n            userActiveLocale.Id = Guid.NewGuid();\r\n            userActiveLocale.Username = username;\r\n            userActiveLocale.CultureName = cultureInfo.Name;\r\n            DataFacade.AddNew<IUserActiveLocale>(userActiveLocale);\r\n        }\r\n\r\n\r\n\r\n        public void RemoveActiveLocaleCultureInfo(string username, CultureInfo cultureInfo)\r\n        {\r\n            Guid id =\r\n                (from ual in DataFacade.GetData<IUserActiveLocale>()\r\n                 where ual.Username == username &&\r\n                       ual.CultureName == cultureInfo.Name\r\n                 select ual.Id).SingleOrDefault();\r\n\r\n            if (id != Guid.Empty)\r\n            {\r\n                IUserSettings userSettings = DataFacade.GetData<IUserSettings>().SingleOrDefault(f => f.Username == username);\r\n                if (userSettings != null)\r\n                {\r\n                    if (userSettings.CurrentActiveLocaleCultureName == cultureInfo.Name)\r\n                    {\r\n                        userSettings.CurrentActiveLocaleCultureName = null;\r\n                        DataFacade.Update(userSettings);\r\n                    }\r\n                }\r\n\r\n                DataFacade.Delete<IUserActiveLocale>(f => f.Id == id);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<CultureInfo> GetActiveLocaleCultureInfos(string username)\r\n        {\r\n            IEnumerable<string> cultureInfoNames =\r\n                (from ual in DataFacade.GetData<IUserActiveLocale>()\r\n                 where ual.Username == username                        \r\n                 select ual.CultureName);\r\n\r\n            foreach (string cultureInfoName in cultureInfoNames)\r\n            {\r\n                yield return CultureInfo.CreateSpecificCulture(cultureInfoName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string LastSpecifiedNamespace\r\n        {\r\n            get \r\n            {\r\n                return UserProfileDataAvailable ? GetDeveloperSettings().LastSpecifiedNamespace : \"\";\r\n            }\r\n            set\r\n            {\r\n                IUserDeveloperSettings settings = GetDeveloperSettings();\r\n                settings.LastSpecifiedNamespace = value;\r\n                DataFacade.Update(settings);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IPAddress UserIPAddress\r\n        {\r\n            get\r\n            {\r\n                return LoginSessionStorePluginFacade.UserIpAddress;\r\n            }\r\n        }              \r\n\r\n\r\n\r\n        private bool UserProfileDataAvailable\r\n        {\r\n            get\r\n            {\r\n                return\r\n                    GlobalInitializerFacade.SystemCoreInitialized &&\r\n                    UserValidationFacade.IsLoggedIn();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IUserSettings GetSettings(string username, bool readonlyUsage)\r\n        {\r\n            // \"Readonly\" values are cached\r\n            if(readonlyUsage)\r\n            {\r\n                IUserSettings cachedValue = _userSettingsCache.Get(username);\r\n\r\n                if (cachedValue != null)\r\n                {\r\n                    return cachedValue;\r\n                }\r\n            }\r\n            \r\n            IUserSettings settings;\r\n\r\n            lock (_lock)\r\n            {\r\n                settings = DataFacade.GetData<IUserSettings>(f => f.Username == username, false).FirstOrDefault() ??\r\n                    CreateUserSettings(username);\r\n\r\n                if(readonlyUsage)\r\n                {\r\n                    _userSettingsCache.Add(username, settings);\r\n                }\r\n            }\r\n\r\n            return settings;\r\n        }\r\n\r\n\r\n\r\n        private IUserDeveloperSettings GetDeveloperSettings()\r\n        {\r\n            if (RequestLifetimeCache.HasKey(typeof(IUserDeveloperSettings)))\r\n            {\r\n                return RequestLifetimeCache.TryGet<IUserDeveloperSettings>(typeof(IUserDeveloperSettings));\r\n            }\r\n\r\n            IUserDeveloperSettings settings = DataFacade.GetData<IUserDeveloperSettings>(f => f.Username == UserSettings.Username).FirstOrDefault();\r\n\r\n            if (settings == null)\r\n            {\r\n                settings = CreateUserDeveloperSettings();\r\n            }\r\n\r\n            RequestLifetimeCache.Add(typeof(IUserDeveloperSettings), settings);\r\n\r\n            return settings;\r\n        }\r\n\r\n\r\n\r\n        private IUserSettings CreateUserSettings(string username)\r\n        {\r\n            var settings = DataFacade.BuildNew<IUserSettings>();\r\n\r\n            settings.Username = username;\r\n            settings.CultureName = GlobalSettingsFacade.DefaultCultureName;\r\n            settings.C1ConsoleUiLanguage = GlobalSettingsFacade.DefaultCultureName;\r\n\r\n            return DataFacade.AddNew<IUserSettings>(settings);\r\n        }\r\n\r\n\r\n\r\n        private IUserDeveloperSettings CreateUserDeveloperSettings()\r\n        {\r\n            var settings = DataFacade.BuildNew<IUserDeveloperSettings>();\r\n\r\n            settings.Username = Username;\r\n            settings.LastSpecifiedNamespace = \"\";\r\n\r\n            return DataFacade.AddNew<IUserDeveloperSettings>(settings);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Users/UserSettingsMock.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.C1Console.Users\r\n{\r\n\tinternal class UserSettingsMock: IUserSettingsFacade\r\n\t{\r\n        #region IUserSettingsFacade Members\r\n\r\n        public string Username\r\n        {\r\n            get { return UserValidationFacade.GetUsername(); }\r\n        }\r\n\r\n        public System.Globalization.CultureInfo CultureInfo\r\n        {\r\n            get\r\n            {\r\n                return GlobalSettingsFacade.DefaultCultureInfo;\r\n            }\r\n            set\r\n            {\r\n            }\r\n        }\r\n\r\n        public System.Globalization.CultureInfo C1ConsoleUiLanguage\r\n        {\r\n            get\r\n            {\r\n                return GlobalSettingsFacade.DefaultCultureInfo;\r\n            }\r\n            set\r\n            {\r\n            }\r\n        }\r\n\r\n        public System.Globalization.CultureInfo GetUserCultureInfo(string username)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public void SetUserCultureInfo(string username, System.Globalization.CultureInfo cultureInfo)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public System.Globalization.CultureInfo GetCurrentActiveLocaleCultureInfo(string username)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public void SetCurrentActiveLocaleCultureInfo(string username, System.Globalization.CultureInfo cultureInfo)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public void AddActiveLocaleCultureInfo(string username, System.Globalization.CultureInfo cultureInfo)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public void RemoveActiveLocaleCultureInfo(string username, System.Globalization.CultureInfo cultureInfo)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public IEnumerable<System.Globalization.CultureInfo> GetActiveLocaleCultureInfos(string username)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public System.Globalization.CultureInfo GetForeignLocaleCultureInfo(string username)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public void SetForeignLocaleCultureInfo(string username, System.Globalization.CultureInfo cultureInfo)\r\n        {\r\n        }\r\n\r\n        public string LastSpecifiedNamespace\r\n        {\r\n            get\r\n            {\r\n                return string.Empty;\r\n            }\r\n            set\r\n            {\r\n            }\r\n        }\r\n\r\n        public System.Net.IPAddress UserIPAddress\r\n        {\r\n            get { throw new NotImplementedException(); }\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n        public System.Globalization.CultureInfo GetUserC1ConsoleUiLanguage(string username)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public void SetUserC1ConsoleUiLanguage(string username, System.Globalization.CultureInfo cultureInfo)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/CancelHandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class CancelHandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public CancelHandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public CancelHandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"Cancel\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/ChildWorkflowDoneHandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class ChildWorkflowDoneHandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public ChildWorkflowDoneHandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ChildWorkflowDoneHandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"ChildWorkflowDone\";\r\n\r\n            this.Invoked += new EventHandler<ExternalDataEventArgs>(OnEventInvoked);\r\n        }\r\n\r\n\r\n        private void OnEventInvoked(object sender, ExternalDataEventArgs e)\r\n        {\r\n            FormEventArgs args = (FormEventArgs)e;\r\n\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            formsWorkflow.ChildWorkflowResult = args.WorkflowResult;\r\n\r\n            base.OnInvoked(e);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/CloseCurrentViewActivity.cs",
    "content": "using System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class CloseCurrentViewActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public CloseCurrentViewActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public CloseCurrentViewActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            if (container != null)\r\n            {\r\n                IManagementConsoleMessageService service = container.GetService<IManagementConsoleMessageService>();\r\n\r\n                if (service != null)\r\n                {\r\n                    service.CloseCurrentView();\r\n                }\r\n            }\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/ConditionalSetStateActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConditionalSetStateActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ConditionProperty = DependencyProperty.Register(\"Condition\", typeof(ActivityCondition), typeof(ConditionalSetStateActivity), new PropertyMetadata(DependencyPropertyOptions.Metadata));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty TrueTargetStateNameProperty = DependencyProperty.Register(\"TrueTargetStateName\", typeof(string), typeof(ConditionalSetStateActivity), new PropertyMetadata(\"\", DependencyPropertyOptions.Metadata, new Attribute[] { new ValidationOptionAttribute(ValidationOption.Optional) }));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty FalseTargetStateNameProperty = DependencyProperty.Register(\"FalseTargetStateName\", typeof(string), typeof(ConditionalSetStateActivity), new PropertyMetadata(\"\", DependencyPropertyOptions.Metadata, new Attribute[] { new ValidationOptionAttribute(ValidationOption.Optional) }));\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ConditionalSetStateActivity()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ConditionalSetStateActivity(string name) \r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            StateMachineWorkflowInstance instance = WorkflowFacade.GetStateMachineWorkflowInstance(this.WorkflowInstanceId);\r\n\r\n            bool result = Condition.Evaluate(this, executionContext);\r\n\r\n            SetStateEventArgs args;\r\n            if (result)\r\n            {\r\n                args = new SetStateEventArgs(this.TrueTargetStateName);\r\n            }\r\n            else\r\n            {\r\n                args = new SetStateEventArgs(this.FalseTargetStateName);\r\n            }\r\n\r\n          //  instance.EnqueueItemOnIdle(\"SetStateQueue\", args, null, null);\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(true)]\r\n        public ActivityCondition Condition\r\n        {\r\n            get { return (base.GetValue(ConditionProperty) as ActivityCondition); }\r\n            set { base.SetValue(ConditionProperty, value); }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [DefaultValue((string)null)]\r\n        public string TrueTargetStateName\r\n        {\r\n            get { return (base.GetValue(TrueTargetStateNameProperty) as string); }\r\n            set { base.SetValue(TrueTargetStateNameProperty, value); }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [DefaultValue((string)null)]\r\n        public string FalseTargetStateName\r\n        {\r\n            get { return (base.GetValue(FalseTargetStateNameProperty) as string); }\r\n            set { base.SetValue(FalseTargetStateNameProperty, value); }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/ConfirmDialogFormActivity.cs",
    "content": "using System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConfirmDialogFormActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ContainerLabelProperty = DependencyProperty.Register(\"ContainerLabel\", typeof(string), typeof(ConfirmDialogFormActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty FormDefinitionFileNameProperty = DependencyProperty.Register(\"FormDefinitionFileName\", typeof(string), typeof(ConfirmDialogFormActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public ConfirmDialogFormActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ConfirmDialogFormActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ContainerLabel\r\n        {\r\n            get { return (string)GetValue(ContainerLabelProperty); }\r\n            set { SetValue(ContainerLabelProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FormDefinitionFileName\r\n        {\r\n            get { return (string)GetValue(FormDefinitionFileNameProperty); }\r\n            set { SetValue(FormDefinitionFileNameProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(this.FormDefinitionFileName);\r\n\r\n            ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n            IFormsWorkflowActivityService service = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService;\r\n\r\n            service.DeliverFormData(\r\n                    WorkflowEnvironment.WorkflowInstanceId,\r\n                    this.ContainerLabel,\r\n                    StandardUiContainerTypes.ConfirmDialog,\r\n                    markupProvider,\r\n                    formsWorkflow.Bindings,\r\n                    formsWorkflow.BindingsValidationRules\r\n                );\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/CustomEvent01HandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class CustomEvent01HandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public CustomEvent01HandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public CustomEvent01HandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"CustomEvent01\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/CustomEvent02HandleExternalEventActivity.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class CustomEvent02HandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public CustomEvent02HandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public CustomEvent02HandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"CustomEvent02\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/CustomEvent03HandleExternalEventActivity.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class CustomEvent03HandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public CustomEvent03HandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public CustomEvent03HandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"CustomEvent03\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/CustomEvent04HandleExternalEventActivity.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class CustomEvent04HandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public CustomEvent04HandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public CustomEvent04HandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"CustomEvent04\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/CustomEvent05HandleExternalEventActivity.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class CustomEvent05HandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public CustomEvent05HandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public CustomEvent05HandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"CustomEvent05\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/DataDialogFormActivity.cs",
    "content": "using System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataDialogFormActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ContainerLabelProperty = DependencyProperty.Register(\"ContainerLabel\", typeof(string), typeof(DataDialogFormActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty FormDefinitionFileNameProperty = DependencyProperty.Register(\"FormDefinitionFileName\", typeof(string), typeof(DataDialogFormActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public DataDialogFormActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public DataDialogFormActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ContainerLabel\r\n        {\r\n            get { return (string)GetValue(ContainerLabelProperty); }\r\n            set { SetValue(ContainerLabelProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FormDefinitionFileName\r\n        {\r\n            get { return (string)GetValue(FormDefinitionFileNameProperty); }\r\n            set { SetValue(FormDefinitionFileNameProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(this.FormDefinitionFileName);\r\n\r\n            ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n            IFormsWorkflowActivityService service = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService;\r\n\r\n            service.DeliverFormData(\r\n                    WorkflowEnvironment.WorkflowInstanceId,\r\n                    this.ContainerLabel,\r\n                    StandardUiContainerTypes.DataDialog,\r\n                    markupProvider,\r\n                    formsWorkflow.Bindings,\r\n                    formsWorkflow.BindingsValidationRules\r\n                );\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/DocumentFormActivity.cs",
    "content": "using System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DocumentFormActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ContainerLabelProperty = DependencyProperty.Register(\"ContainerLabel\", typeof(string), typeof(DocumentFormActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty FormDefinitionFileNameProperty = DependencyProperty.Register(\"FormDefinitionFileName\", typeof(string), typeof(DocumentFormActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty CustomToolbarDefinitionFileNameProperty = DependencyProperty.Register(\"CustomToolbarDefinitionFileName\", typeof(string), typeof(DocumentFormActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public DocumentFormActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public DocumentFormActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ContainerLabel\r\n        {\r\n            get { return (string)GetValue(ContainerLabelProperty); }\r\n            set { SetValue(ContainerLabelProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FormDefinitionFileName\r\n        {\r\n            get { return (string)GetValue(FormDefinitionFileNameProperty); }\r\n            set { SetValue(FormDefinitionFileNameProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string CustomToolbarDefinitionFileName\r\n        {\r\n            get { return (string)GetValue(CustomToolbarDefinitionFileNameProperty); }\r\n            set { SetValue(CustomToolbarDefinitionFileNameProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(this.FormDefinitionFileName);\r\n\r\n            ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n            IFormsWorkflowActivityService service = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService;\r\n\r\n            service.DeliverFormData(\r\n                    WorkflowEnvironment.WorkflowInstanceId,\r\n                    this.ContainerLabel,\r\n                    StandardUiContainerTypes.Document,\r\n                    markupProvider,\r\n                    formsWorkflow.Bindings,\r\n                    formsWorkflow.BindingsValidationRules\r\n                );\r\n\r\n            if (string.IsNullOrEmpty(this.CustomToolbarDefinitionFileName) == false)\r\n            {\r\n                IFormMarkupProvider customToolbarMarkupProvider = new FormDefinitionFileMarkupProvider(this.CustomToolbarDefinitionFileName);\r\n                service.DeliverCustomToolbarDefinition(WorkflowEnvironment.WorkflowInstanceId, customToolbarMarkupProvider);\r\n            }\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/EmptyDocumentFormActivity.cs",
    "content": "using System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class EmptyDocumentFormActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ContainerLabelProperty = DependencyProperty.Register(\"ContainerLabel\", typeof(string), typeof(EmptyDocumentFormActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty FormDefinitionFileNameProperty = DependencyProperty.Register(\"FormDefinitionFileName\", typeof(string), typeof(EmptyDocumentFormActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public EmptyDocumentFormActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public EmptyDocumentFormActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ContainerLabel\r\n        {\r\n            get { return (string)GetValue(ContainerLabelProperty); }\r\n            set { SetValue(ContainerLabelProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FormDefinitionFileName\r\n        {\r\n            get { return (string)GetValue(FormDefinitionFileNameProperty); }\r\n            set { SetValue(FormDefinitionFileNameProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(this.FormDefinitionFileName);\r\n\r\n            ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n            IFormsWorkflowActivityService service = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService;\r\n\r\n            service.DeliverFormData(\r\n                    WorkflowEnvironment.WorkflowInstanceId,\r\n                    this.ContainerLabel,\r\n                    StandardUiContainerTypes.EmptyDocument,\r\n                    markupProvider,\r\n                    formsWorkflow.Bindings,\r\n                    formsWorkflow.BindingsValidationRules\r\n                );            \r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/ExecuteChildWorkflowActivity.cs",
    "content": "using System;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ExecuteChildWorkflowActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ChildWorkflowTypeProperty = DependencyProperty.Register(\"ChildWorkflowType\", typeof(Type), typeof(ExecuteChildWorkflowActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ChildWorkflowPayloadProperty = DependencyProperty.Register(\"ChildWorkflowPayload\", typeof(string), typeof(ExecuteChildWorkflowActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public ExecuteChildWorkflowActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ExecuteChildWorkflowActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Type ChildWorkflowType\r\n        {\r\n            get { return (Type)GetValue(ChildWorkflowTypeProperty); }\r\n            set { SetValue(ChildWorkflowTypeProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ChildWorkflowPayload\r\n        {\r\n            get { return (string)GetValue(ChildWorkflowPayloadProperty); }\r\n            set { SetValue(ChildWorkflowPayloadProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n\r\n            IActionExecutionService actionExecutionService = flowControllerServicesContainer.GetService<IActionExecutionService>();\r\n\r\n            WorkflowActionToken workflowActionToken = new WorkflowActionToken(this.ChildWorkflowType) {\r\n                    Payload = this.ChildWorkflowPayload,\r\n                    ParentWorkflowInstanceId = formsWorkflow.InstanceId\r\n                };\r\n\r\n            actionExecutionService.Execute(formsWorkflow.EntityToken, workflowActionToken, null);\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/FinishHandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class FinishHandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public FinishHandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public FinishHandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"Finish\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/FormsWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Drawing;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Tasks;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow.Activities.Foundation;\r\nusing Composite.C1Console.Trees;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ToolboxItem(false)]\r\n    [ToolboxBitmap(typeof(StateMachineWorkflowActivity), \"Resources.StateMachineWorkflowActivity.png\")]\r\n    [ActivityValidator(typeof(StateActivityValidator))]\r\n    public class FormsWorkflow : StateMachineWorkflowActivity\r\n    {\r\n        private string _stringEntityToken;\r\n        private string _stringActionToken;\r\n        private Guid _parentWorkflowInstanceId;\r\n        private string _workflowResult;\r\n        private string _childWorkflowResult;\r\n\r\n\r\n        [NonSerialized]\r\n        private EntityToken _entityToken;\r\n\r\n        [NonSerialized]\r\n        private ActionToken _actionToken;\r\n\r\n        [NonSerialized]\r\n        private WorkflowActionToken _workflowActionToken;\r\n\r\n        [NonSerialized]\r\n        private Dictionary<string, object> _bindings = new Dictionary<string, object>();\r\n\r\n        private Guid _instanceId;\r\n\r\n        [NonSerialized]\r\n        private EventHandler<WorkflowEventArgs> _onWorkflowIdledEventHandler;\r\n\r\n\r\n        /// <exclude />\r\n        public FormsWorkflow()\r\n        {\r\n            this.BindingsValidationRules = new Dictionary<string, List<ClientValidationRule>>();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected void InitializeExtensions()\r\n        {\r\n            CanModifyActivities = true;\r\n\r\n            foreach (var extension in FormsWorkflowExtensions.GetExtensions())\r\n            {\r\n                extension.Initialize(this);\r\n            }\r\n\r\n            CanModifyActivities = false;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void Initialize(IServiceProvider provider)\r\n        {\r\n            _onWorkflowIdledEventHandler = OnWorkflowIdled;\r\n\r\n            if (!this.DesignMode)\r\n            {\r\n                WorkflowFacade.WorkflowRuntime.WorkflowIdled += _onWorkflowIdledEventHandler;\r\n            }\r\n\r\n            base.Initialize(provider);\r\n\r\n            if (!BindingExist(EntityTokenKey))\r\n            {\r\n                Bindings.Add(EntityTokenKey, EntityToken);\r\n            }\r\n        }\r\n\r\n        internal static readonly string EntityTokenKey = typeof(FormsWorkflow).FullName + \":EntityToken\";\r\n\r\n\r\n        /// <exclude />\r\n        protected override void Uninitialize(IServiceProvider provider)\r\n        {\r\n            if (!this.DesignMode)\r\n            {\r\n                WorkflowFacade.WorkflowRuntime.WorkflowIdled -= _onWorkflowIdledEventHandler;\r\n            }\r\n\r\n            if (this.ParentWorkflowInstanceId != Guid.Empty)\r\n            {\r\n                WorkflowFacade.FireChildWorkflowDoneEvent(this.ParentWorkflowInstanceId, this.WorkflowResult);\r\n            }\r\n\r\n            base.Uninitialize(provider);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string SerializedEntityToken\r\n        {\r\n            get { return _stringEntityToken; }\r\n            set { _stringEntityToken = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string SerializedActionToken\r\n        {\r\n            get { return _stringActionToken; }\r\n            set { _stringActionToken = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public Guid ParentWorkflowInstanceId\r\n        {\r\n            get { return _parentWorkflowInstanceId; }\r\n            set { _parentWorkflowInstanceId = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Use this property to set the result of the workflow\r\n        /// </summary>\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string WorkflowResult\r\n        {\r\n            get { return _workflowResult; }\r\n            set { _workflowResult = value; }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This holds the result of a chlid workflow\r\n        /// </summary>\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string ChildWorkflowResult\r\n        {\r\n            get { return _childWorkflowResult; }\r\n            set { _childWorkflowResult = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public EntityToken EntityToken\r\n        {\r\n            get\r\n            {\r\n                if (_entityToken == null && this.SerializedEntityToken != null)\r\n                {\r\n                    _entityToken = EntityTokenSerializer.Deserialize(this.SerializedEntityToken);\r\n                }\r\n\r\n                return _entityToken;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public ActionToken ActionToken\r\n        {\r\n            get\r\n            {\r\n                if (_actionToken == null && this.SerializedActionToken != null)\r\n                {\r\n                    _actionToken = ActionTokenSerializer.Deserialize(this.SerializedActionToken);\r\n                }\r\n\r\n                return _actionToken;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public Dictionary<string, object> Bindings\r\n        {\r\n            get\r\n            {\r\n                if (_bindings == null)\r\n                {\r\n                    // Workflows with WorkflowPersistingType.Never does not get their bindings persisted.\r\n                    if (!FormsWorkflowBindingCache.Bindings.TryGetValue(_instanceId, out _bindings))\r\n                    {\r\n                        _bindings = new Dictionary<string, object>();\r\n                    }\r\n                }\r\n\r\n                return _bindings;\r\n            }\r\n            set\r\n            {\r\n                _bindings = value;\r\n\r\n                FormsWorkflowBindingCache.Bindings[_instanceId] = _bindings;\r\n            }\r\n        }\r\n\r\n\r\n        internal Dictionary<string, Exception> GetBindingErrors()\r\n        {\r\n            Guid workflowId = WorkflowEnvironment.WorkflowInstanceId;;\r\n\r\n            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(workflowId);\r\n            var bindingValidationService = container.GetService<IBindingValidationService>();\r\n\r\n            if (bindingValidationService == null)\r\n            {\r\n                return new Dictionary<string, Exception>();\r\n            }\r\n\r\n            return bindingValidationService.BindingErrors;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public Dictionary<string, List<ClientValidationRule>> BindingsValidationRules { get; set; }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public T GetBinding<T>(string name)\r\n        {\r\n            object obj;\r\n            if (!Bindings.TryGetValue(name, out obj))\r\n            {\r\n                throw new InvalidOperationException($\"The binding named '{name}' was not found\");\r\n            }\r\n\r\n            return (T)obj;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool TryGetBinding<T>(string name, out T binding)\r\n        {\r\n            object obj;\r\n            if (this.Bindings.TryGetValue(name, out obj))\r\n            {\r\n                binding = (T)obj;\r\n                return true;\r\n            }\r\n\r\n            binding = default(T);\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateBinding(string name, object value)\r\n        {\r\n            this.Bindings[name] = value;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateBindings(Dictionary<string, object> bindings)\r\n        {\r\n            foreach (var kvp in bindings)\r\n            {\r\n                this.Bindings[kvp.Key] = kvp.Value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool BindingExist(string name)\r\n        {\r\n            return this.Bindings.ContainsKey(name);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public T GetDataItemFromEntityToken<T>()\r\n            where T : IData\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            return (T)dataEntityToken.Data;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Payload\r\n        {\r\n            get\r\n            {\r\n                if (_workflowActionToken == null)\r\n                {\r\n                    _workflowActionToken = this.ActionToken as WorkflowActionToken;\r\n                }\r\n\r\n                return _workflowActionToken?.Payload;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ExtraPayload\r\n        {\r\n            get\r\n            {\r\n                if (_workflowActionToken == null)\r\n                {\r\n                    _workflowActionToken = this.ActionToken as WorkflowActionToken;\r\n                }\r\n\r\n                return _workflowActionToken?.ExtraPayload;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal Guid InstanceId => _instanceId;\r\n\r\n\r\n        private static FlowControllerServicesContainer GetFlowControllerServicesContainer()\r\n        {\r\n            return WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n        }\r\n\r\n        /// <exclude />\r\n        protected void ReportException(Exception ex)\r\n        {\r\n            Verify.ArgumentNotNull(ex, nameof(ex));\r\n\r\n            this.ShowMessage(DialogType.Error, \"An unfortunate error occurred\", $\"Sorry, but an error has occurred, preventing the opperation from completing as expected. The error has been documented in details so a technican may follow up on this issue.\\n\\nThe error message is: {ex.Message}\");\r\n\r\n            Log.LogCritical(this.GetType().Name, ex);\r\n\r\n            var container = GetFlowControllerServicesContainer();\r\n            IManagementConsoleMessageService service = container.GetService<IManagementConsoleMessageService>();\r\n            service.ShowLogEntry(this.GetType(), ex);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void LogMessage(LogLevel logLevel, string message)\r\n        {\r\n            var container = GetFlowControllerServicesContainer();\r\n            IManagementConsoleMessageService service = container.GetService<IManagementConsoleMessageService>();\r\n            service.ShowLogEntry(this.GetType(), logLevel, message);\r\n\r\n            switch (logLevel)\r\n            {\r\n                case LogLevel.Info:\r\n                case LogLevel.Debug:\r\n                case LogLevel.Fine:\r\n                    LoggingService.LogVerbose(this.GetType().Name, message);\r\n                    break;\r\n                case LogLevel.Warning:\r\n                    LoggingService.LogWarning(this.GetType().Name, message);\r\n                    break;\r\n                case LogLevel.Error:\r\n                    LoggingService.LogError(this.GetType().Name, message);\r\n                    break;\r\n                case LogLevel.Fatal:\r\n                    LoggingService.LogCritical(this.GetType().Name, message);\r\n                    break;\r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void ShowMessage(DialogType dialogType, string title, string message)\r\n        {\r\n            var container = GetFlowControllerServicesContainer();\r\n\r\n            IManagementConsoleMessageService service = container.GetService<IManagementConsoleMessageService>();\r\n\r\n            string localizedTitle = StringResourceSystemFacade.ParseString(title);\r\n            string localizedMessage = StringResourceSystemFacade.ParseString(message);\r\n\r\n            service.ShowMessage(\r\n                    dialogType,\r\n                    localizedTitle,\r\n                    localizedMessage\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void SelectElement(EntityToken entityToken)\r\n        {\r\n            var container = GetFlowControllerServicesContainer();\r\n\r\n            IManagementConsoleMessageService service = container.GetService<IManagementConsoleMessageService>();\r\n            \r\n            service.SelectElement(EntityTokenSerializer.Serialize(entityToken, true));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void RebootConsole()\r\n        {\r\n            var container = GetFlowControllerServicesContainer();\r\n\r\n            IManagementConsoleMessageService service = container.GetService<IManagementConsoleMessageService>();\r\n\r\n            service.RebootConsole();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void ShowFieldMessage(string fieldBindingPath, string message)\r\n        {\r\n            var flowControllerServicesContainer = GetFlowControllerServicesContainer();\r\n\r\n            var formFlowRenderingService = flowControllerServicesContainer.GetService<IFormFlowRenderingService>();\r\n\r\n            formFlowRenderingService.ShowFieldMessage(fieldBindingPath, StringResourceSystemFacade.ParseString(message));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void SetSaveStatus(bool succeeded)\r\n        {\r\n            SetSaveStatus(succeeded, (string)null);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void SetSaveStatus(bool succeeded, IData data)\r\n        {\r\n            SetSaveStatus(succeeded, data.GetDataEntityToken());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void SetSaveStatus(bool succeeded, EntityToken entityToken)\r\n        {\r\n            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);\r\n            SetSaveStatus(succeeded, serializedEntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void SetSaveStatus(bool succeeded, string serializedEntityToken)\r\n        {\r\n            var saveWorklowTaskManagerEvent = new SaveWorklowTaskManagerEvent\r\n            (\r\n                new WorkflowFlowToken(this.InstanceId),\r\n                this.WorkflowInstanceId,\r\n                succeeded\r\n            );\r\n\r\n            var container = GetFlowControllerServicesContainer();\r\n            var service = container.GetService<ITaskManagerFlowControllerService>();\r\n            service.OnStatus(saveWorklowTaskManagerEvent);\r\n\r\n            var flowRenderingService = container.GetService<IFormFlowRenderingService>();\r\n            flowRenderingService?.SetSaveStatus(succeeded);\r\n\r\n\r\n            var managementConsoleMessageService = container.GetService<IManagementConsoleMessageService>();\r\n            managementConsoleMessageService.SaveStatus(succeeded); // TO BE REMOVED\r\n\r\n            if (serializedEntityToken != null)\r\n            {\r\n                managementConsoleMessageService = container.GetService<IManagementConsoleMessageService>();\r\n                managementConsoleMessageService.BindEntityTokenToView(serializedEntityToken);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void CloseCurrentView()\r\n        {\r\n            var flowControllerServicesContainer = GetFlowControllerServicesContainer();\r\n\r\n            var managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            if (!managementConsoleMessageService.CloseCurrentViewRequested)\r\n            {\r\n                managementConsoleMessageService.CloseCurrentView();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void LockTheSystem()\r\n        {\r\n            var flowControllerServicesContainer = GetFlowControllerServicesContainer();\r\n\r\n            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            managementConsoleMessageService.LockSystem();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void RerenderView()\r\n        {\r\n            var flowControllerServicesContainer = GetFlowControllerServicesContainer();\r\n            IFormFlowRenderingService formFlowRenderingService = flowControllerServicesContainer.GetService<IFormFlowRenderingService>();\r\n            formFlowRenderingService.RerenderView();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void CollapseAndRefresh()\r\n        {\r\n            var container = GetFlowControllerServicesContainer();\r\n            var service = container.GetService<IManagementConsoleMessageService>();\r\n            service.CollapseAndRefresh();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected string GetCurrentConsoleId()\r\n        {\r\n            var flowControllerServicesContainer = GetFlowControllerServicesContainer();\r\n\r\n            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            return managementConsoleMessageService.CurrentConsoleId;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected IEnumerable<string> GetConsoleIdsOpenedByCurrentUser()\r\n        {\r\n            return GetConsoleIdsOpenedByUser(UserSettings.Username);\r\n        }\r\n\r\n        /// <exclude />\r\n        protected IEnumerable<string> GetConsoleIdsOpenedByUser(string username)\r\n        {\r\n            if (UserSettings.Username == username)\r\n            {\r\n                string currentConsoleId = GetCurrentConsoleId();\r\n                return ConsoleFacade.GetConsoleIdsByUsername(username).Union(new[] { currentConsoleId });\r\n            }\r\n            else\r\n            {\r\n                return ConsoleFacade.GetConsoleIdsByUsername(username);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void ExecuteAction(EntityToken entityToken, ActionToken actionToken)\r\n        {\r\n            var flowControllerServicesContainer = GetFlowControllerServicesContainer();\r\n\r\n            IActionExecutionService actionExecutionService = flowControllerServicesContainer.GetService<IActionExecutionService>();\r\n\r\n            var taskManagerEvent = new WorkflowCreationTaskManagerEvent(_instanceId);\r\n            actionExecutionService.Execute(entityToken, actionToken, taskManagerEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void ExecuteWorklow(EntityToken entityToken, Type workflowType)\r\n        {\r\n            ExecuteAction(entityToken, new WorkflowActionToken(workflowType));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void DeliverFormData(string containerLabel, IFlowUiContainerType containerType, string formDefinition, Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            OnDeliverFormData(bindings, bindingsValidationRules);\r\n\r\n            ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n\r\n            IFormsWorkflowActivityService formsWorkflowActivityService = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService;\r\n\r\n            formsWorkflowActivityService.DeliverFormData(WorkflowEnvironment.WorkflowInstanceId, containerLabel, containerType, formDefinition, bindings, bindingsValidationRules);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void DeliverFormData(string containerLabel, IFlowUiContainerType containerType, IFormMarkupProvider formMarkupProvider, Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            OnDeliverFormData(bindings, bindingsValidationRules);\r\n\r\n            var externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n\r\n            var formsWorkflowActivityService = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService;\r\n\r\n            formsWorkflowActivityService.DeliverFormData(WorkflowEnvironment.WorkflowInstanceId, containerLabel, containerType, formMarkupProvider, bindings, bindingsValidationRules);\r\n        }\r\n\r\n\r\n\r\n        private void OnDeliverFormData(Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            var parameters = new OnDeliverFormDataParameters\r\n            {\r\n                Bindings = bindings,\r\n                BindingsValidationRules = bindingsValidationRules\r\n            };\r\n\r\n            foreach (var extension in FormsWorkflowExtensions.GetExtensions())\r\n            {\r\n                extension.OnDeliverFormData(this, parameters);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds the cms:layout elements Form Definition to the UI toolbar. \r\n        /// </summary>\r\n        /// <param name=\"customToolbarDefinition\">String containing a valid Form Definition markup document</param>\r\n        public void SetCustomToolbarDefinition(string customToolbarDefinition)\r\n        {\r\n            SetCustomToolbarDefinition(new StringBasedFormMarkupProvider(customToolbarDefinition));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds the cms:layout elements Form Definition to the UI toolbar. \r\n        /// </summary>\r\n        /// <param name=\"customToolbarMarkupProvider\">Markup provider that can deliver a valid Form Definition markup document</param>\r\n        protected void SetCustomToolbarDefinition(IFormMarkupProvider customToolbarMarkupProvider)\r\n        {\r\n            var externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n            var fwas = externalDataExchangeService.GetService<IFormsWorkflowActivityService>();\r\n            fwas.DeliverCustomToolbarDefinition(WorkflowEnvironment.WorkflowInstanceId, customToolbarMarkupProvider);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a custom toolbar item.\r\n        /// </summary>\r\n        /// <param name=\"itemId\">The item id.</param>\r\n        /// <param name=\"markup\">The markup.</param>\r\n        /// <param name=\"priority\">The priority - is used for sorting multiple toolbar items.</param>\r\n        public void AddCustomToolbarItem(string itemId, XDocument markup, ActionGroupPriority priority)\r\n        {\r\n            var externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n            var fwas = externalDataExchangeService.GetService<IFormsWorkflowActivityService>();\r\n\r\n            Verify.That(WorkflowInstanceId == WorkflowEnvironment.WorkflowInstanceId, \"Unexpected workflow id!\");\r\n            fwas.AddCustomToolbarItem(WorkflowInstanceId, itemId, markup, priority);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected AddNewTreeRefresher CreateAddNewTreeRefresher(EntityToken parentEntityToken)\r\n        {\r\n            return new AddNewTreeRefresher(parentEntityToken, WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected UpdateTreeRefresher CreateUpdateTreeRefresher(EntityToken beforeUpdateEntityToken)\r\n        {\r\n            return new UpdateTreeRefresher(beforeUpdateEntityToken, WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected DeleteTreeRefresher CreateDeleteTreeRefresher(EntityToken beforeDeleteEntityToken)\r\n        {\r\n            return new DeleteTreeRefresher(beforeDeleteEntityToken, WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected ParentTreeRefresher CreateParentTreeRefresher()\r\n        {\r\n            return new ParentTreeRefresher(WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected SpecificTreeRefresher CreateSpecificTreeRefresher()\r\n        {\r\n            return new SpecificTreeRefresher(WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void RefreshEntityToken(EntityToken entityToken)\r\n        {\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(entityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void RefreshCurrentEntityToken()\r\n        {\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void RefreshParentEntityToken()\r\n        {\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void RefreshRootEntityToken()\r\n        {\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(ElementFacade.GetRootsWithNoSecurity().First().ElementHandle.EntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void AcquireLock(EntityToken entityToken)\r\n        {\r\n            ActionLockingFacade.AcquireLock(entityToken, this.WorkflowInstanceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public DynamicValuesHelperReplaceContext CreateDynamicValuesHelperReplaceContext()\r\n        {\r\n            return CreateDynamicValuesHelperReplaceContext(this.ExtraPayload);\r\n        }\r\n\r\n\r\n\r\n        internal DynamicValuesHelperReplaceContext CreateDynamicValuesHelperReplaceContext(string serializedPiggybag)\r\n        {\r\n            Dictionary<string, string> piggybag = PiggybagSerializer.Deserialize(serializedPiggybag);\r\n\r\n            return CreateDynamicValuesHelperReplaceContext(piggybag);\r\n        }\r\n\r\n\r\n\r\n        internal DynamicValuesHelperReplaceContext CreateDynamicValuesHelperReplaceContext(Dictionary<string, string> piggybag)\r\n        {\r\n            return new DynamicValuesHelperReplaceContext(this.EntityToken, piggybag);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            _instanceId = WorkflowEnvironment.WorkflowInstanceId;\r\n\r\n            ActivityExecutionStatus activityExecutionStatus = base.Execute(executionContext);\r\n\r\n            return activityExecutionStatus;\r\n        }\r\n\r\n\r\n\r\n        private void OnWorkflowIdled(object sender, WorkflowEventArgs e)\r\n        {\r\n            if (e.WorkflowInstance.InstanceId == _instanceId)\r\n            {\r\n                FormsWorkflowBindingCache.Bindings[_instanceId] = this.Bindings;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Shows validation messages for fields that weren't binded correctly. \r\n        /// </summary>\r\n        /// <returns>True if all the bindings were processed correctly</returns>\r\n        protected bool ValidateBindings()\r\n        {\r\n            Dictionary<string, Exception> bindingErrors = GetBindingErrors();\r\n            if (bindingErrors.Count == 0)\r\n            {\r\n                return true;\r\n            }\r\n\r\n            foreach (var pair in bindingErrors)\r\n            {\r\n                ShowFieldMessage(pair.Key, pair.Value.Message);\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Binds form values to a data item and sends messages to client to display validation messages. \r\n        /// </summary>\r\n        /// <param name=\"helper\">Form binding helper</param>\r\n        /// <param name=\"data\">An IData instance</param>\r\n        /// <returns>True, if there were no binding/validation errors</returns>\r\n        protected bool BindAndValidate(DataTypeDescriptorFormsHelper helper, IData data)\r\n        {\r\n            Dictionary<string, string> errorMessages = helper.BindingsToObject(this.Bindings, data);\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate(data.DataSourceId.InterfaceType, data);\r\n\r\n            bool isValid = true;\r\n\r\n            if (!validationResults.IsValid)\r\n            {\r\n                foreach (ValidationResult result in validationResults)\r\n                {\r\n                    if (!result.Key.IsNullOrEmpty())\r\n                    {\r\n                        this.ShowFieldMessage(result.Key, result.Message);\r\n                    }\r\n                    else\r\n                    {\r\n                        this.ShowMessage(DialogType.Error, \"Validation error\", result.Message);\r\n                    }\r\n\r\n                    isValid = false;\r\n                }\r\n            }\r\n\r\n            // Checking that required strings are not empty\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(data.DataSourceId.InterfaceType);\r\n            \r\n            foreach (var fieldName in dataTypeDescriptor.Fields\r\n                                                        .Where(f => !f.IsNullable \r\n                                                                && f.InstanceType == typeof (string)\r\n                                                                && !(f.Inherited && f.Name == \"FieldName\")) // Skipping validation for inherited IPageMetaData.FieldName\r\n                                                        .Select(f => f.Name))\r\n            {\r\n                string bindingName = (helper.BindingNamesPrefix ?? \"\").Replace('.', '_') + fieldName;\r\n                if(validationResults.Any(r => r.Key == bindingName)) continue;\r\n\r\n                object fieldValue = this.Bindings[bindingName];\r\n                if (fieldValue is string \r\n                    && (fieldValue as string) == string.Empty\r\n                    && !helper.BindingIsOptional(bindingName))\r\n                {\r\n                    this.ShowFieldMessage(bindingName, LocalizationFiles.Composite_Management.Validation_RequiredField);\r\n\r\n                    isValid = false;\r\n                }\r\n            }\r\n            \r\n\r\n            if (errorMessages != null)\r\n            {\r\n                isValid = false;\r\n\r\n                foreach (var kvp in errorMessages)\r\n                {\r\n                    this.ShowFieldMessage(kvp.Key, kvp.Value);\r\n                }\r\n            }\r\n\r\n            return isValid;\r\n        }\r\n    }\r\n\r\n    internal static class ExternalDataExchangeServiceExtensions\r\n    {\r\n        public static T GetService<T>(this ExternalDataExchangeService serviceContainer) where T : class\r\n        {\r\n            return serviceContainer.GetService(typeof (T)) as T;\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/Foundation/FormsWorkflowBindingCache.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities.Foundation\r\n{\r\n\tinternal static class FormsWorkflowBindingCache\r\n\t{\r\n        public static ConcurrentDictionary<Guid, Dictionary<string, object>> Bindings \r\n            = new ConcurrentDictionary<Guid, Dictionary<string, object>>();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/NextHandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class NextHandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public NextHandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public NextHandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"Next\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/PreviewHandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class PreviewHandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public PreviewHandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PreviewHandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"Preview\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/PreviousHandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class PreviousHandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public PreviousHandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PreviousHandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"Previous\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/RerenderViewActivity.cs",
    "content": "using System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class RerenderViewActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public RerenderViewActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public RerenderViewActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                        \r\n            IFormFlowRenderingService formFlowRenderingService = flowControllerServicesContainer.GetService<IFormFlowRenderingService>();\r\n            \r\n            formFlowRenderingService.RerenderView();\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/SaveAndPublishHandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class SaveAndPublishHandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public SaveAndPublishHandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public SaveAndPublishHandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"SaveAndPublish\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/SaveHandleExternalEventActivity.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\n\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DefaultEvent(\"Invoked\")]\r\n    [ActivityValidator(typeof(HandleExternalEventActivityValidator))]\r\n    public sealed class SaveHandleExternalEventActivity : HandleExternalEventActivity\r\n    {\r\n        /// <exclude />\r\n        public SaveHandleExternalEventActivity()\r\n            : base()\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public SaveHandleExternalEventActivity(string name)\r\n            : base(name)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override string EventName\r\n        {\r\n            get { return base.EventName; }\r\n            set { base.EventName = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Browsable(false)]\r\n        public override Type InterfaceType\r\n        {\r\n            get { return base.InterfaceType; }\r\n            set { base.InterfaceType = value; }\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            this.InterfaceType = typeof(IFormsWorkflowEventService);\r\n            this.EventName = \"Save\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/ShowConsoleMessageBoxActivity.cs",
    "content": "using System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ShowConsoleMessageBoxActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(\"Title\", typeof(string), typeof(ShowConsoleMessageBoxActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(\"Message\", typeof(string), typeof(ShowConsoleMessageBoxActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty DialogTypeProperty = DependencyProperty.Register(\"DialogType\", typeof(DialogType), typeof(ShowConsoleMessageBoxActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public ShowConsoleMessageBoxActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ShowConsoleMessageBoxActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public DialogType DialogType\r\n        {\r\n            get { return (DialogType)GetValue(DialogTypeProperty); }\r\n            set { SetValue(DialogTypeProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Title\r\n        {\r\n            get { return (string)GetValue(TitleProperty); }\r\n            set { SetValue(TitleProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Message\r\n        {\r\n            get { return (string)GetValue(MessageProperty); }\r\n            set { SetValue(MessageProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n\r\n            IManagementConsoleMessageService service = container.GetService<IManagementConsoleMessageService>();\r\n\r\n            service.ShowMessage(this.DialogType, StringResourceSystemFacade.ParseString(this.Title), StringResourceSystemFacade.ParseString(this.Message));\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/ShowFieldMessageActivity.cs",
    "content": "using System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ShowFieldMessageActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty FieldBindingPathProperty = DependencyProperty.Register(\"FieldBindingPath\", typeof(string), typeof(ShowFieldMessageActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(\"Message\", typeof(string), typeof(ShowFieldMessageActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public ShowFieldMessageActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ShowFieldMessageActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FieldBindingPath\r\n        {\r\n            get { return (string)GetValue(FieldBindingPathProperty); }\r\n            set { SetValue(FieldBindingPathProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Message\r\n        {\r\n            get { return (string)GetValue(MessageProperty); }\r\n            set { SetValue(MessageProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n\r\n            IFormFlowRenderingService service = container.GetService<IFormFlowRenderingService>();\r\n\r\n            service.ShowFieldMessage( this.FieldBindingPath, this.Message);\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/WarningDialogFormActivity.cs",
    "content": "using System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class WarningDialogFormActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ContainerLabelProperty = DependencyProperty.Register(\"ContainerLabel\", typeof(string), typeof(WarningDialogFormActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty FormDefinitionFileNameProperty = DependencyProperty.Register(\"FormDefinitionFileName\", typeof(string), typeof(WarningDialogFormActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public WarningDialogFormActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public WarningDialogFormActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ContainerLabel\r\n        {\r\n            get { return (string)GetValue(ContainerLabelProperty); }\r\n            set { SetValue(ContainerLabelProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FormDefinitionFileName\r\n        {\r\n            get { return (string)GetValue(FormDefinitionFileNameProperty); }\r\n            set { SetValue(FormDefinitionFileNameProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(this.FormDefinitionFileName);\r\n\r\n            ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n            IFormsWorkflowActivityService service = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService;\r\n\r\n            service.DeliverFormData(\r\n                    WorkflowEnvironment.WorkflowInstanceId,\r\n                    this.ContainerLabel,\r\n                    StandardUiContainerTypes.WarningDialog,\r\n                    markupProvider,\r\n                    formsWorkflow.Bindings,\r\n                    formsWorkflow.BindingsValidationRules\r\n                );\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Activities/WizardFormActivity.cs",
    "content": "using System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Activities\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class WizardFormActivity : Activity\r\n    {\r\n        /// <exclude />\r\n        public static readonly DependencyProperty ContainerLabelProperty = DependencyProperty.Register(\"ContainerLabel\", typeof(string), typeof(WizardFormActivity));\r\n\r\n        /// <exclude />\r\n        public static readonly DependencyProperty FormDefinitionFileNameProperty = DependencyProperty.Register(\"FormDefinitionFileName\", typeof(string), typeof(WizardFormActivity));\r\n\r\n\r\n        /// <exclude />\r\n        public WizardFormActivity()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public WizardFormActivity(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ContainerLabel\r\n        {\r\n            get { return (string)GetValue(ContainerLabelProperty); }\r\n            set { SetValue(ContainerLabelProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FormDefinitionFileName\r\n        {\r\n            get { return (string)GetValue(FormDefinitionFileNameProperty); }\r\n            set { SetValue(FormDefinitionFileNameProperty, value); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)\r\n        {\r\n            FormsWorkflow formsWorkflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(this.FormDefinitionFileName);\r\n\r\n            ExternalDataExchangeService externalDataExchangeService = WorkflowFacade.WorkflowRuntime.GetService<ExternalDataExchangeService>();\r\n            IFormsWorkflowActivityService service = externalDataExchangeService.GetService(typeof(IFormsWorkflowActivityService)) as IFormsWorkflowActivityService;\r\n\r\n            service.DeliverFormData(\r\n                    WorkflowEnvironment.WorkflowInstanceId,\r\n                    this.ContainerLabel,\r\n                    StandardUiContainerTypes.Wizard,\r\n                    markupProvider,\r\n                    formsWorkflow.Bindings,\r\n                    formsWorkflow.BindingsValidationRules\r\n                );\r\n\r\n            return ActivityExecutionStatus.Closed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/ActivityExtensionMethods.cs",
    "content": "using System.Workflow.ComponentModel;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ActivityExtensionMethods\r\n    {\r\n        /// <exclude />\r\n        public static Activity GetRoot(this Activity activity)\r\n        {\r\n            if (activity.Parent == null)\r\n            {\r\n                return activity;\r\n            }\r\n            else\r\n            {\r\n                return GetRoot(activity.Parent);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static T GetRoot<T>(this Activity activity)\r\n            where T : Activity\r\n        {\r\n            return (T)GetRoot(activity);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/AllowPersistingWorkflowAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum WorkflowPersistingType\r\n    {\r\n        /// <summary>\r\n        /// Never persisted\r\n        /// </summary>\r\n        Never, \r\n\r\n        /// <summary>\r\n        /// Workflow with this type of persistence will be unloaded after entering \"Idle\" state\r\n        /// </summary>\r\n        Idle, \r\n     \r\n        /// <summary>\r\n        /// Workflow will be unloaded and serialized while shutting down\r\n        /// </summary>\r\n        Shutdown\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]\r\n    public sealed class AllowPersistingWorkflowAttribute : Attribute\r\n    {\r\n        /// <exclude />\r\n        public AllowPersistingWorkflowAttribute(WorkflowPersistingType workflowPersistingType)\r\n        {\r\n            this.WorkflowPersistingType = workflowPersistingType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public WorkflowPersistingType WorkflowPersistingType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/EntityTokenLockAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>\r\n    /// If this attribute is specified on a workflow, then the EntityToken will be locked\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]\r\n    public sealed class EntityTokenLockAttribute : Attribute\r\n    {\r\n        /// <exclude />\r\n        public EntityTokenLockAttribute()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/FilePersistenceService.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.Serialization;\r\nusing System.Runtime.Serialization.Formatters.Binary;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.Runtime.Hosting;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    internal class FileWorkflowPersistenceService : WorkflowPersistenceService\r\n    {\r\n        private static readonly string LogTitle = \"Workflow File Persisting Service\";\r\n        private readonly string _baseDirectory;\r\n        private Guid[] _abortedWorkflows;\r\n        private readonly object _syncRoot = new object();\r\n\r\n        private C1FileSystemWatcher _fileWatcher;\r\n\r\n        private static readonly ConcurrentDictionary<Guid, byte> _createdWorkflows = new ConcurrentDictionary<Guid, byte>();\r\n\r\n        public FileWorkflowPersistenceService(string baseDirectory)\r\n        {\r\n            _baseDirectory = baseDirectory;\r\n            this.PersistAll = false;\r\n        }\r\n\r\n        public bool PersistAll { get; set; }\r\n\r\n        public IEnumerable<Guid> GetAbortedWorkflows()\r\n        {\r\n            return _abortedWorkflows ?? new Guid[0];\r\n        }\r\n\r\n        public IEnumerable<Guid> GetPersistedWorkflows()\r\n        {\r\n            foreach (string filePath in C1Directory.GetFiles(_baseDirectory, \"*.bin\"))\r\n            {\r\n                Guid workflowId;\r\n                if (TryParseWorkflowId(filePath, out workflowId))\r\n                {\r\n                    yield return workflowId;\r\n                }\r\n            }\r\n        }\r\n\r\n        private bool TryParseWorkflowId(string filePath, out Guid workflowId)\r\n        {\r\n            string guidString = Path.GetFileNameWithoutExtension(filePath);\r\n            return Guid.TryParse(guidString ?? \"\", out workflowId);\r\n        }\r\n\r\n        public void ListenToDynamicallyAddedWorkflows(Action<Guid> onWorkflowFileAdded)\r\n        {\r\n            Verify.IsNull(_fileWatcher, \"The method has already been invoked\");\r\n\r\n            Action<string> handleWorkflowAdded = name =>\r\n            {\r\n                try\r\n                {\r\n                    Guid workflowId;\r\n                    if (TryParseWorkflowId(name, out workflowId) \r\n                        && !_createdWorkflows.ContainsKey(workflowId))\r\n                    {\r\n                        onWorkflowFileAdded(workflowId);\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            };\r\n\r\n            var fileWatcher = new C1FileSystemWatcher(_baseDirectory, \"*.bin\")\r\n            {\r\n                IncludeSubdirectories = false\r\n            };\r\n\r\n            fileWatcher.Created += (sender, args) => handleWorkflowAdded(args.Name);\r\n            fileWatcher.Renamed += (sender, args) => handleWorkflowAdded(args.Name);\r\n\r\n            fileWatcher.EnableRaisingEvents = true;\r\n            _fileWatcher = fileWatcher;\r\n        }\r\n\r\n\r\n        public bool RemovePersistedWorkflow(Guid instanceId)\r\n        {\r\n            string filename = GetFileName(instanceId);\r\n\r\n            if (C1File.Exists(filename))\r\n            {\r\n                try\r\n                {\r\n                    C1File.Delete(filename);\r\n\r\n                    Log.LogVerbose(LogTitle, $\"Workflow persisted state deleted. Id = {instanceId}\");\r\n                }\r\n                catch\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            byte _;\r\n            _createdWorkflows.TryRemove(instanceId, out _);\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        protected override Activity LoadCompletedContextActivity(Guid scopeId, Activity outerActivity)\r\n        {\r\n            object obj = DeserializeActivity(outerActivity, scopeId);\r\n            return (Activity)obj;\r\n        }\r\n\r\n\r\n\r\n        protected override Activity LoadWorkflowInstanceState(Guid instanceId)\r\n        {\r\n            string filename = GetFileName(instanceId);\r\n            bool deleteFile = false;\r\n\r\n            if (C1File.Exists(filename))\r\n            {\r\n                try\r\n                {\r\n                    object obj = DeserializeActivity(null, instanceId);\r\n                    return (Activity)obj;\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    LoggingService.LogCritical(LogTitle, ex);\r\n                    deleteFile = true;\r\n                }\r\n            }\r\n\r\n            if (deleteFile)\r\n            {\r\n                Log.LogWarning(LogTitle, $\"Failed to load workflow with id '{filename}'. Deleting file.\");\r\n                C1File.Delete(filename);\r\n\r\n                MarkWorkflowAsAborted(instanceId);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        protected override void SaveCompletedContextActivity(Activity activity)\r\n        {\r\n            SaveWorkflowInstanceState(activity);\r\n        }\r\n\r\n\r\n\r\n        protected override void SaveWorkflowInstanceState(Activity rootActivity, bool unlock)\r\n        {\r\n            SaveWorkflowInstanceState(rootActivity);\r\n        }\r\n\r\n\r\n        protected override bool UnloadOnIdle(Activity activity)\r\n        {\r\n            var persistingType = GetPersistingType(activity);\r\n\r\n            if (persistingType == WorkflowPersistingType.Shutdown)\r\n            {\r\n                SaveWorkflowInstanceState(activity);\r\n            }\r\n\r\n            return persistingType == WorkflowPersistingType.Idle;\r\n        }\r\n\r\n\r\n        private void SaveWorkflowInstanceState(Activity activity)\r\n        {\r\n            Guid workflowId = (Guid)activity.GetValue(Activity.ActivityContextGuidProperty);\r\n            SerializeActivity(activity, workflowId);\r\n        }\r\n\r\n\r\n        protected override void UnlockWorkflowInstanceState(Activity rootActivity)\r\n        {\r\n            //empty\r\n        }\r\n\r\n        private bool ActivityIsSerializable(Activity activity)\r\n        {\r\n            return PersistAll || GetPersistingType(activity) != WorkflowPersistingType.Never;\r\n        }\r\n\r\n        private WorkflowPersistingType GetPersistingType(Activity activity)\r\n        {\r\n            List<AllowPersistingWorkflowAttribute> attributes = activity.GetType().GetCustomAttributesRecursively<AllowPersistingWorkflowAttribute>().ToList();\r\n\r\n            if (attributes.Count == 0) return WorkflowPersistingType.Never;\r\n\r\n            return attributes[0].WorkflowPersistingType;\r\n        }\r\n\r\n        private void SerializeActivity(Activity rootActivity, Guid id)\r\n        {\r\n            if (!ActivityIsSerializable(rootActivity))\r\n            {\r\n                Log.LogVerbose(LogTitle,\r\n                    $\"The workflow does not support persiting. Id = {id}, Type = {rootActivity.GetType()}\");\r\n                return;\r\n            }\r\n\r\n            string filename = GetFileName(id);\r\n\r\n            IFormatter formatter = new BinaryFormatter();\r\n            formatter.SurrogateSelector = ActivitySurrogateSelector.Default;\r\n\r\n            _createdWorkflows[id] = 0;\r\n\r\n            using (var stream = new C1FileStream(filename, FileMode.OpenOrCreate))\r\n            {\r\n                try\r\n                {\r\n                    rootActivity.Save(stream, formatter);\r\n                    stream.Close();\r\n                }\r\n                catch (SerializationException ex)\r\n                {\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n\r\n            // Log.LogVerbose(LogTitle, $\"Workflow persisted. Id = {id}, Type = {rootActivity.GetType()}\");\r\n        }\r\n\r\n\r\n\r\n        private object DeserializeActivity(Activity rootActivity, Guid id)\r\n        {\r\n            string filename = GetFileName(id);\r\n            object result;\r\n\r\n            var formatter = new BinaryFormatter\r\n            {\r\n                SurrogateSelector = ActivitySurrogateSelector.Default\r\n            };\r\n\r\n            using (var stream = new C1FileStream(filename, FileMode.Open))\r\n            {\r\n                result = Activity.Load(stream, rootActivity, formatter);\r\n            }\r\n\r\n            // Log.LogVerbose(LogTitle, $\"Workflow loaded. Id = {id}, Type = {result.GetType()}\");\r\n\r\n            return result;\r\n        }\r\n\r\n        private void MarkWorkflowAsAborted(Guid id)\r\n        {\r\n            lock (_syncRoot)\r\n            {\r\n                _abortedWorkflows = (_abortedWorkflows ?? Array.Empty<Guid>())\r\n                                    .Concat(new [] {id}).ToArray();\r\n            }\r\n        }\r\n\r\n        private string GetFileName(Guid id)\r\n        {\r\n            return Path.Combine(this._baseDirectory, $\"{id}.bin\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/FormsEventArgs.cs",
    "content": "using System;\r\nusing System.Workflow.Activities;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class FormEventArgs : ExternalDataEventArgs\r\n    {\r\n        private string _workflowResult;\r\n\r\n        [NonSerialized]\r\n        private Dictionary<string, object> _bindings;\r\n\r\n        /// <exclude />\r\n        public FormEventArgs(Guid instanceId, string workflowResult)\r\n            : this(instanceId, workflowResult, null)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public FormEventArgs(Guid instanceId, Dictionary<string, object> bindings)\r\n            : this(instanceId, null, bindings)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public FormEventArgs(Guid instanceId, string workflowResult, Dictionary<string, object> bindings)\r\n            : base(instanceId)\r\n        {\r\n            _workflowResult = workflowResult;\r\n            _bindings = bindings;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string WorkflowResult\r\n        {\r\n            get { return _workflowResult; }\r\n            set { _workflowResult = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> Bindings\r\n        {\r\n            get { return _bindings; }\r\n            set { _bindings = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/FormsWorkflowExtensions.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <exclude />\r\n    public static class FormsWorkflowExtensions\r\n    {\r\n        private static readonly List<IFormsWorkflowExtension> _extensions = new List<IFormsWorkflowExtension>();\r\n\r\n        /// <exclude />\r\n        public static void Register(IFormsWorkflowExtension extension) => _extensions.Add(extension);\r\n\r\n        internal static ICollection<IFormsWorkflowExtension> GetExtensions() => _extensions;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/FormData.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.Functions;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.Threading;\r\nusing System.Globalization;\r\nusing Composite.C1Console.Elements;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FormData\r\n    {\r\n        /// <exclude />\r\n        public string ContainerLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormDefinition { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<Tuple<string, XDocument, ActionGroupPriority>> CustomToolbarItems { get; set; }\r\n\r\n        /// <exclude />\r\n        public IFormMarkupProvider FormMarkupProvider { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> Bindings { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, List<ClientValidationRule>> BindingsValidationRules { get; set; }\r\n\r\n        /// <exclude />\r\n        public IFlowUiContainerType ContainerType { get; set; }\r\n\r\n        /// <exclude />\r\n        public Type EventHandleFilterType { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<string> ExcludedEvents { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public XElement Serialize()\r\n        {\r\n            using (new ThreadCultureScope(CultureInfo.InvariantCulture))\r\n            {\r\n                IXmlSerializer xmlSerializer = new XmlSerializer(new IValueXmlSerializer[] {\r\n                new SystemPrimitivValueXmlSerializer(),\r\n                new SystemCollectionValueXmlSerializer(),\r\n                new SystemTypesValueXmlSerializer(),\r\n                new CompositeCollectionValueXmlSerializer(),\r\n                new DataFieldDescriptorValueXmlSerializer(),\r\n                new DataTypeDescriptorValueXmlSerializer(),\r\n                new NamedFunctionCallValueXmlSerializer(),\r\n                new SerializerHandlerValueXmlSerializer(),\r\n                new SystemSerializableValueXmlSerializer() });\r\n\r\n\r\n                XElement containerLabelElement = new XElement(\"ContainerLabel\");\r\n                if (this.ContainerLabel != null)\r\n                {\r\n                    containerLabelElement.Add(new XAttribute(\"value\", this.ContainerLabel));\r\n                }\r\n\r\n\r\n                XElement formDefinitionElement = new XElement(\"FormDefinition\");\r\n                if (this.FormDefinition != null)\r\n                {\r\n                    formDefinitionElement.Add(new XAttribute(\"value\", this.FormDefinition));\r\n                }\r\n                else\r\n                {\r\n                    using (XmlReader xmlReader = this.FormMarkupProvider.GetReader())\r\n                    {\r\n                        xmlReader.MoveToContent();\r\n                        XElement element = (XElement)XDocument.ReadFrom(xmlReader);\r\n                        XDocument document = new XDocument(element);\r\n                        string content = document.GetDocumentAsString();\r\n                        formDefinitionElement.Add(new XAttribute(\"value\", content));\r\n                    }\r\n                }\r\n\r\n                XElement customToolBarItems = null;\r\n                if (CustomToolbarItems != null && CustomToolbarItems.Count > 0)\r\n                {\r\n                    customToolBarItems = new XElement(nameof(CustomToolbarItems),\r\n                        CustomToolbarItems.Select(tuple => new XElement(\"item\",\r\n                        new XAttribute(\"id\", tuple.Item1.ToString()),\r\n                        new XAttribute(\"markup\", tuple.Item2.ToString()),\r\n                        new XAttribute(\"priority\", (int)tuple.Item3)))\r\n                        .OfType<object>()\r\n                        .ToArray());\r\n                }\r\n\r\n                XElement containerTypeElement = xmlSerializer.Serialize(typeof(IFlowUiContainerType), this.ContainerType);\r\n\r\n\r\n                Dictionary<string, object> selectedBindings =\r\n                    (from kvp in this.Bindings\r\n                     where (kvp.Value != null &&\r\n                            kvp.Value.GetType() != typeof(System.EventHandler)) ||\r\n                            kvp.Value == null\r\n                     select kvp).ToDictionary(f => f.Key, f => f.Value);\r\n                XElement bindingsElement = xmlSerializer.Serialize(typeof(Dictionary<string, object>), selectedBindings);\r\n\r\n                XElement bindingsValidationRulesElement = xmlSerializer.Serialize(typeof(Dictionary<string, List<ClientValidationRule>>), this.BindingsValidationRules);\r\n\r\n                XElement excludedEventsElement = xmlSerializer.Serialize(typeof(List<string>), ExcludedEvents);\r\n\r\n                var formDataElement = new XElement(\"FormData\",\r\n                    containerLabelElement,\r\n                    formDefinitionElement,\r\n                    customToolBarItems,\r\n                    new XElement(\"ContainerType\", containerTypeElement),\r\n                    new XElement(\"Bindings\", bindingsElement),\r\n                    new XElement(\"BindingsValidationRules\", bindingsValidationRulesElement)\r\n                );\r\n\r\n                if (excludedEventsElement != null)\r\n                {\r\n                    formDataElement.Add(new XElement(\"ExcludedEvents\", excludedEventsElement));\r\n                }\r\n\r\n                if (this.EventHandleFilterType != null)\r\n                {\r\n                    formDataElement.Add(new XElement(\"EventHandleFilterType\", new XAttribute(\"type\", TypeManager.SerializeType(this.EventHandleFilterType))));\r\n                }\r\n\r\n                return formDataElement;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static FormData Deserialize(XElement serializedData)\r\n        {\r\n            using (new ThreadCultureScope(CultureInfo.InvariantCulture))\r\n            {\r\n                IXmlSerializer xmlSerializer = new XmlSerializer(new IValueXmlSerializer[] {\r\n                new SystemPrimitivValueXmlSerializer(),\r\n                new SystemCollectionValueXmlSerializer(),\r\n                new SystemTypesValueXmlSerializer(),\r\n                new CompositeCollectionValueXmlSerializer(),\r\n                new DataFieldDescriptorValueXmlSerializer(),\r\n                new DataTypeDescriptorValueXmlSerializer(),\r\n                new NamedFunctionCallValueXmlSerializer(),\r\n                new SerializerHandlerValueXmlSerializer(),\r\n                new SystemSerializableValueXmlSerializer()});\r\n\r\n\r\n                FormData formData = new FormData();\r\n\r\n                XElement containerLabelElement = serializedData.Elements(\"ContainerLabel\").Single();\r\n                XAttribute containerLabelValueAttribute = containerLabelElement.Attribute(\"value\");\r\n                if (containerLabelValueAttribute != null)\r\n                {\r\n                    formData.ContainerLabel = containerLabelValueAttribute.Value;\r\n                }\r\n\r\n                XElement formDefinitionElement = serializedData.Elements(\"FormDefinition\").Single();\r\n                XAttribute formDefinitionValueAttribute = formDefinitionElement.Attribute(\"value\");\r\n                if (formDefinitionValueAttribute != null)\r\n                {\r\n                    formData.FormDefinition = formDefinitionValueAttribute.Value;\r\n                    formData.FormMarkupProvider = new StringBasedFormMarkupProvider(formDefinitionValueAttribute.Value);\r\n                }\r\n\r\n                formData.CustomToolbarItems = new List<Tuple<string, XDocument, ActionGroupPriority>>();\r\n\r\n                var customToolbarItemsElement = serializedData.Elements(nameof(CustomToolbarItems)).FirstOrDefault();\r\n                if (customToolbarItemsElement != null)\r\n                {\r\n                    formData.CustomToolbarItems.AddRange(\r\n                        customToolbarItemsElement.Elements().Select(element =>\r\n                            new Tuple<string, XDocument, ActionGroupPriority>(\r\n                                (string)element.Attribute(\"id\"),\r\n                                XDocument.Parse((string) element.Attribute(\"markup\")),\r\n                                (ActionGroupPriority) ((int)element.Attribute(\"priority\")))));\r\n                }\r\n\r\n\r\n                XElement containerTypeElement = serializedData.Elements(\"ContainerType\").Single();\r\n                object containerType = xmlSerializer.Deserialize(containerTypeElement.Elements().Single());\r\n                formData.ContainerType = (IFlowUiContainerType)containerType;\r\n\r\n                XElement bindingsElement = serializedData.Elements(\"Bindings\").Single();\r\n                object bindings = xmlSerializer.Deserialize(bindingsElement.Elements().Single());\r\n                formData.Bindings = (Dictionary<string, object>)bindings;\r\n\r\n                XElement bindingsValidationRulesElement = serializedData.Elements(\"BindingsValidationRules\").Single();\r\n                object bindingsValidationRules = xmlSerializer.Deserialize(bindingsValidationRulesElement.Elements().Single());\r\n                formData.BindingsValidationRules = (Dictionary<string, List<ClientValidationRule>>)bindingsValidationRules;\r\n\r\n                XElement eventHandleFilterTypeElement = serializedData.Elements(\"EventHandleFilterType\").SingleOrDefault();\r\n                if (eventHandleFilterTypeElement != null)\r\n                {\r\n                    Type eventHandleFilterType = TypeManager.GetType(eventHandleFilterTypeElement.Attribute(\"type\").Value);\r\n                    formData.EventHandleFilterType = eventHandleFilterType;\r\n                }\r\n\r\n                XElement excludedEventsElement = serializedData.Elements(\"ExcludedEvents\").SingleOrDefault();\r\n                if (excludedEventsElement != null)\r\n                {\r\n                    object excludedEvents = xmlSerializer.Deserialize(excludedEventsElement.Elements().Single());\r\n                    formData.ExcludedEvents = (List<string>)excludedEvents;\r\n                }\r\n\r\n                return formData;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/FormsWorkflowActivityService.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation\r\n{\r\n    internal sealed class FormsWorkflowActivityService : IFormsWorkflowActivityService\r\n    {\r\n        public void DeliverFormData(Guid instanceId, string containerLabel, IFlowUiContainerType containerType, string formDefinition, Dictionary<string, object> bindings)\r\n        {\r\n            var formData = GetOrAddFormData(instanceId);\r\n\r\n            formData.ContainerLabel = containerLabel;\r\n            formData.ContainerType = containerType;\r\n            formData.FormDefinition = formDefinition;\r\n            formData.FormMarkupProvider = null;\r\n            formData.Bindings = bindings;\r\n        }\r\n\r\n\r\n\r\n        public void DeliverFormData(Guid instanceId, string containerLabel, IFlowUiContainerType containerType, IFormMarkupProvider formMarkupProvider, Dictionary<string, object> bindings)\r\n        {\r\n            var formData = GetOrAddFormData(instanceId);\r\n\r\n            formData.ContainerLabel = containerLabel;\r\n            formData.ContainerType = containerType;\r\n            formData.FormDefinition = null;\r\n            formData.FormMarkupProvider = formMarkupProvider;\r\n            formData.Bindings = bindings;\r\n        }\r\n\r\n\r\n\r\n        public void DeliverFormData(Guid instanceId, string containerLabel, IFlowUiContainerType containerType, string formDefinition, Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            var formData = GetOrAddFormData(instanceId);\r\n\r\n            formData.ContainerLabel = containerLabel;\r\n            formData.ContainerType = containerType;\r\n            formData.FormDefinition = formDefinition;\r\n            formData.FormMarkupProvider = null;\r\n            formData.Bindings = bindings;\r\n            formData.BindingsValidationRules = bindingsValidationRules;\r\n        }\r\n\r\n\r\n\r\n        public void DeliverFormData(Guid instanceId, string containerLabel, IFlowUiContainerType containerType, IFormMarkupProvider formMarkupProvider, Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)\r\n        {\r\n            var formData = GetOrAddFormData(instanceId);\r\n\r\n            formData.ContainerLabel = containerLabel;\r\n            formData.ContainerType = containerType;\r\n            formData.FormDefinition = null;\r\n            formData.FormMarkupProvider = formMarkupProvider;\r\n            formData.Bindings = bindings;\r\n            formData.BindingsValidationRules = bindingsValidationRules;\r\n        }\r\n\r\n\r\n        public void AddCustomToolbarItem(Guid instanceId, string itemId, XDocument markup, ActionGroupPriority priority)\r\n        {\r\n            Verify.ArgumentNotNull(itemId, nameof(itemId));\r\n            Verify.ArgumentNotNull(markup, nameof(markup));\r\n\r\n            var formData = GetOrAddFormData(instanceId);\r\n\r\n            if (formData.CustomToolbarItems == null)\r\n            {\r\n                formData.CustomToolbarItems = new List<Tuple<string, XDocument, ActionGroupPriority>>();\r\n            }\r\n            else\r\n            {\r\n                var existingItem = formData.CustomToolbarItems.FirstOrDefault(i => i.Item1 == itemId);\r\n                if (existingItem != null)\r\n                {\r\n                    formData.CustomToolbarItems.Remove(existingItem);\r\n                }\r\n            }\r\n            \r\n            formData.CustomToolbarItems.Add(new Tuple<string, XDocument, ActionGroupPriority>(\r\n                itemId, markup, priority));\r\n        }\r\n\r\n        public FlowControllerServicesContainer GetFlowServicesContainer(Guid instanceId)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public void DeliverCustomToolbarDefinition(Guid instanceId, string customToolbarDefinition)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(customToolbarDefinition, nameof(customToolbarDefinition));\r\n\r\n            AddCustomToolbarItem(instanceId, \"default\", \r\n                XDocument.Parse(customToolbarDefinition), ActionGroupPriority.TargetedAppendMedium);\r\n        }\r\n\r\n        public void DeliverCustomToolbarDefinition(Guid instanceId, IFormMarkupProvider customToolbarMarkupProvider)\r\n        {\r\n            Verify.ArgumentNotNull(customToolbarMarkupProvider, nameof(customToolbarMarkupProvider));\r\n\r\n            var doc = XDocument.Load(customToolbarMarkupProvider.GetReader());\r\n\r\n            AddCustomToolbarItem(instanceId, \"default\", doc, ActionGroupPriority.TargetedAppendMedium);\r\n        }\r\n\r\n\r\n        private FormData GetOrAddFormData(Guid instanceId)\r\n        {\r\n            FormData formData;\r\n\r\n            if (!WorkflowFacade.TryGetFormData(instanceId, out formData))\r\n            {\r\n                formData = new FormData();\r\n                WorkflowFacade.AddFormData(instanceId, formData);\r\n            }\r\n\r\n            return formData;\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/FormsWorkflowEventService.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation\r\n{\r\n    internal sealed class FormsWorkflowEventService : IFormsWorkflowEventService\r\n    {\r\n        public event EventHandler<FormEventArgs> Save;\r\n        public event EventHandler<FormEventArgs> SaveAndPublish;\r\n        public event EventHandler<FormEventArgs> Next;\r\n        public event EventHandler<FormEventArgs> Previous;\r\n        public event EventHandler<FormEventArgs> Finish;\r\n        public event EventHandler<FormEventArgs> Cancel;\r\n\r\n        public event EventHandler<FormEventArgs> Preview;\r\n\r\n        public event EventHandler<FormEventArgs> CustomEvent01;\r\n        public event EventHandler<FormEventArgs> CustomEvent02;\r\n        public event EventHandler<FormEventArgs> CustomEvent03;\r\n        public event EventHandler<FormEventArgs> CustomEvent04;\r\n        public event EventHandler<FormEventArgs> CustomEvent05;\r\n\r\n        public event EventHandler<FormEventArgs> ChildWorkflowDone;\r\n\r\n\r\n\r\n        public void FireSaveEvent(FormEventArgs formEventArgs)\r\n        {\r\n            if (Save != null)\r\n            {\r\n                EventHandler<FormEventArgs> save = Save;\r\n                save(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n        public void FireSaveAndPublishEvent(FormEventArgs formEventArgs)\r\n        {\r\n            if (SaveAndPublish != null)\r\n            {\r\n                EventHandler<FormEventArgs> saveAndPublish = SaveAndPublish;\r\n                saveAndPublish(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n        public void FireNextEvent(FormEventArgs formEventArgs)\r\n        {\r\n            if (Next != null)\r\n            {\r\n                EventHandler<FormEventArgs> next = Next;\r\n                next(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FirePreviousEvent(FormEventArgs formEventArgs)\r\n        {\r\n            if (Previous != null)\r\n            {\r\n                EventHandler<FormEventArgs> previous = Previous;\r\n                previous(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireFinishEvent(FormEventArgs formEventArgs)\r\n        {\r\n            if (Finish != null)\r\n            {\r\n                EventHandler<FormEventArgs> finish = Finish;\r\n                finish(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireCancelEvent(FormEventArgs formEventArgs)\r\n        {\r\n            if (Cancel != null)\r\n            {\r\n                EventHandler<FormEventArgs> cancel = Cancel;\r\n                cancel(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FirePreviewEvent(FormEventArgs formEventArgs)\r\n        {\r\n            if (Preview != null)\r\n            {\r\n                EventHandler<FormEventArgs> preview = Preview;\r\n                preview(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireCustomEvent01(FormEventArgs formEventArgs)\r\n        {\r\n            EventHandler<FormEventArgs> customEvent = CustomEvent01;\r\n\r\n            if (customEvent != null)\r\n            {\r\n                customEvent(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireCustomEvent02(FormEventArgs formEventArgs)\r\n        {\r\n            EventHandler<FormEventArgs> customEvent = CustomEvent02;\r\n\r\n            if (customEvent != null)\r\n            {\r\n                customEvent(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireCustomEvent03(FormEventArgs formEventArgs)\r\n        {\r\n            EventHandler<FormEventArgs> customEvent = CustomEvent03;\r\n\r\n            if (customEvent != null)\r\n            {\r\n                customEvent(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireCustomEvent04(FormEventArgs formEventArgs)\r\n        {\r\n            EventHandler<FormEventArgs> customEvent = CustomEvent04;\r\n\r\n            if (customEvent != null)\r\n            {\r\n                customEvent(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireCustomEvent05(FormEventArgs formEventArgs)\r\n        {\r\n            EventHandler<FormEventArgs> customEvent = CustomEvent05;\r\n\r\n            if (customEvent != null)\r\n            {\r\n                customEvent(null, formEventArgs);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireChildWorkflowDoneEvent(FormEventArgs formEventArgs)\r\n        {\r\n            if (ChildWorkflowDone != null)\r\n            {\r\n                EventHandler<FormEventArgs> childWorkflowDone = ChildWorkflowDone;\r\n                childWorkflowDone(null, formEventArgs);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/IWorkflowRuntimeProviderRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation\r\n{\r\n\tinternal interface IWorkflowRuntimeProviderRegistry\r\n\t{\r\n        string DefaultWorkflowRuntimeProviderName { get; }\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/PluginFacades/IWorkflowRuntimeProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Workflow.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation.PluginFacades\r\n{\r\n\tinternal interface IWorkflowRuntimeProviderPluginFacade\r\n\t{\r\n        bool HasConfiguration { get; }\r\n        WorkflowRuntime GetWorkflowRuntime(string providerName);\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/PluginFacades/WorkflowRuntimeProviderPluginFacade.cs",
    "content": "using System.Workflow.Runtime;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation.PluginFacades\r\n{\r\n    internal static class WorkflowRuntimeProviderPluginFacade\r\n    {\r\n        private static IWorkflowRuntimeProviderPluginFacade _implementation = new WorkflowRuntimeProviderPluginFacadeImpl();\r\n\r\n\r\n        internal static IWorkflowRuntimeProviderPluginFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        static WorkflowRuntimeProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        public static bool HasConfiguration\r\n        {\r\n            get\r\n            {\r\n                return _implementation.HasConfiguration;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static WorkflowRuntime GetWorkflowRuntime(string providerName)\r\n        {\r\n            return _implementation.GetWorkflowRuntime(providerName);\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/PluginFacades/WorkflowRuntimeProviderPluginFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Workflow.Runtime;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider;\r\nusing Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider.Runtime;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation.PluginFacades\r\n{\r\n    internal class WorkflowRuntimeProviderPluginFacadeImpl : IWorkflowRuntimeProviderPluginFacade\r\n    {\r\n        private ResourceLocker<Resources> _resources;\r\n\r\n\r\n\r\n        public WorkflowRuntimeProviderPluginFacadeImpl()\r\n        {\r\n            _resources = new ResourceLocker<Resources>(new Resources { Owner = this }, Resources.Initialize);\r\n        }\r\n\r\n\r\n\r\n        public bool HasConfiguration\r\n        {\r\n            get\r\n            {\r\n                return (ConfigurationServices.ConfigurationSource != null) &&\r\n                       (ConfigurationServices.ConfigurationSource.GetSection(WorkflowRuntimeProviderSettings.SectionName) != null);\r\n            }\r\n        }\r\n\r\n\r\n        public WorkflowRuntime GetWorkflowRuntime(string providerName)\r\n        {\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n\r\n            using (_resources.Locker)\r\n            {\r\n                WorkflowRuntime workflowRuntime = GetWorkflowRuntimeProvider(providerName).GetWorkflowRuntime();\r\n\r\n                if (workflowRuntime == null) throw new InvalidOperationException(string.Format(\"The workflow runtime provider '{0}' returned null\", providerName));\r\n\r\n                return workflowRuntime;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _resources.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private IWorkflowRuntimeProvider GetWorkflowRuntimeProvider(string providerName)\r\n        {\r\n            using (_resources.Locker)\r\n            {\r\n                IWorkflowRuntimeProvider provider;\r\n\r\n                if (_resources.Resources.ProviderCache.TryGetValue(providerName, out provider) == false)\r\n                {\r\n                    try\r\n                    {\r\n                        provider = _resources.Resources.Factory.Create(providerName);\r\n\r\n                        _resources.Resources.ProviderCache.Add(providerName, provider);\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n\r\n                return provider;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void HandleConfigurationError(Exception ex)\r\n        {\r\n            OnFlush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", WorkflowRuntimeProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public WorkflowRuntimeProviderFactory Factory { get; set; }\r\n            public Dictionary<string, IWorkflowRuntimeProvider> ProviderCache { get; set; }\r\n            public WorkflowRuntimeProviderPluginFacadeImpl Owner { get; set; }\r\n\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new WorkflowRuntimeProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    resources.Owner.HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    resources.Owner.HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Dictionary<string, IWorkflowRuntimeProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/WorkflowRuntimeProviderRegistry.cs",
    "content": "using Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation\r\n{\r\n    internal static class WorkflowRuntimeProviderRegistry\r\n    {\r\n        private static IWorkflowRuntimeProviderRegistry _implementation = new WorkflowRuntimeProviderRegistryImpl();\r\n\r\n\r\n        internal static IWorkflowRuntimeProviderRegistry Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        static WorkflowRuntimeProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static string DefaultWorkflowRuntimeProviderName\r\n        {\r\n            get\r\n            {\r\n                return _implementation.DefaultWorkflowRuntimeProviderName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Workflow/Foundation/WorkflowRuntimeProviderRegistryImpl.cs",
    "content": "using System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Foundation\r\n{\r\n    internal class WorkflowRuntimeProviderRegistryImpl : IWorkflowRuntimeProviderRegistry\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        public string DefaultWorkflowRuntimeProviderName\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    return _resourceLocker.Resources.DefaultWorkflowRuntimeProviderName;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static IConfigurationSource GetConfiguration()\r\n        {\r\n            IConfigurationSource source = ConfigurationServices.ConfigurationSource;\r\n\r\n            if (null == source)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"No configuration source specified\"));\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n\r\n        \r\n\r\n\r\n\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public string DefaultWorkflowRuntimeProviderName { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                IConfigurationSource configurationSource = GetConfiguration();\r\n\r\n                WorkflowRuntimeProviderSettings settings = configurationSource.GetSection(WorkflowRuntimeProviderSettings.SectionName) as WorkflowRuntimeProviderSettings;\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration\", WorkflowRuntimeProviderSettings.SectionName));\r\n                }\r\n\r\n                resources.DefaultWorkflowRuntimeProviderName = settings.DefaultProviderName;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/IEventHandleFilter.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Forms.Flows;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IEventHandleFilter\r\n    {\r\n        /// <exclude />\r\n        void Filter(Dictionary<IFormEventIdentifier, FormFlowEventHandler> eventHandlers);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/IFormsWorkflowActivityService.cs",
    "content": "using System;\r\nusing System.Workflow.Activities;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    [ExternalDataExchange]\r\n    internal interface IFormsWorkflowActivityService\r\n    {\r\n        void DeliverFormData(Guid instanceId, string containerLabel, IFlowUiContainerType containerType, string formMarkup, Dictionary<string, object> bindings);\r\n        void DeliverFormData(Guid instanceId, string containerLabel, IFlowUiContainerType containerType, IFormMarkupProvider formMarkupProvider, Dictionary<string, object> bindings);\r\n        void DeliverFormData(Guid instanceId, string containerLabel, IFlowUiContainerType containerType, string formMarkup, Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules);\r\n        void DeliverFormData(Guid instanceId, string containerLabel, IFlowUiContainerType containerType, IFormMarkupProvider formMarkupProvider, Dictionary<string, object> bindings, Dictionary<string, List<ClientValidationRule>> bindingsValidationRules);\r\n\r\n        void DeliverCustomToolbarDefinition(Guid instanceId, string customToolbarMarkup);\r\n        void DeliverCustomToolbarDefinition(Guid instanceId, IFormMarkupProvider customToolbarMarkupProvider);\r\n\r\n        void AddCustomToolbarItem(Guid instanceId, string itemId, XDocument markup, ActionGroupPriority priority);\r\n\r\n        FlowControllerServicesContainer GetFlowServicesContainer(Guid instanceId);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/IFormsWorkflowEventService.cs",
    "content": "using System;\r\nusing System.Workflow.Activities;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ExternalDataExchange()]\r\n    public interface IFormsWorkflowEventService\r\n    {\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> Save;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> SaveAndPublish;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> Next;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> Previous;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> Finish;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> Cancel;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> Preview;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> CustomEvent01;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> CustomEvent02;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> CustomEvent03;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> CustomEvent04;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> CustomEvent05;\r\n\r\n        /// <exclude />\r\n        event EventHandler<FormEventArgs> ChildWorkflowDone;\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/IFormsWorkflowExtension.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <exclude />\r\n    public class OnDeliverFormDataParameters\r\n    {\r\n        /// <exclude />\r\n        public Dictionary<string, object> Bindings { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, List<ClientValidationRule>> BindingsValidationRules { get; set; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// An interface for forms workflow extensions\r\n    /// </summary>\r\n    public interface IFormsWorkflowExtension\r\n    {\r\n        /// <summary>\r\n        /// In implementation custom workflow activities can be added.\r\n        /// </summary>\r\n        /// <param name=\"workflow\">The workflow instance.</param>\r\n        void Initialize(FormsWorkflow workflow);\r\n\r\n        /// <summary>\r\n        /// Handles form data delivery event\r\n        /// </summary>\r\n        /// <param name=\"workflow\">The workflow instance.</param>\r\n        /// <param name=\"parameters\">The parameters.</param>\r\n        void OnDeliverFormData(FormsWorkflow workflow, OnDeliverFormDataParameters parameters);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/IWorkflowFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Threading;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow.Foundation;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n\tinternal interface IWorkflowFacade\r\n\t{\r\n        void EnsureInitialization();\r\n        WorkflowRuntime WorkflowRuntime { get; }\r\n\r\n        void RunWhenInitialized(Action action);\r\n\r\n\r\n        #region Workflow methods\r\n        WorkflowInstance CreateNewWorkflow(Type workflowType);\r\n        WorkflowInstance CreateNewWorkflow(Type workflowType, Dictionary<string, object> arguments);\r\n        WorkflowFlowToken StartNewWorkflow(Type workflowType, FlowControllerServicesContainer flowControllerServicesContainer, EntityToken entityToken, ActionToken actionToken);\r\n        WorkflowInstance GetWorkflow(Guid instanceId);\r\n        StateMachineWorkflowInstance GetStateMachineWorkflowInstance(Guid instanceId);\r\n        void RunWorkflow(Guid instanceId);\r\n        void RunWorkflow(WorkflowInstance workflowInstance);\r\n        void AbortWorkflow(Guid instanceId);\r\n        void AcquireLock(Guid instanceId, EntityToken entityToken);\r\n        #endregion\r\n\r\n\r\n        #region FlowControllerServices methods\r\n        void SetFlowControllerServicesContainer(Guid instanceId, FlowControllerServicesContainer flowControllerServicesContainer);\r\n        FlowControllerServicesContainer GetFlowControllerServicesContainer(Guid instanceId);\r\n        void RemoveFlowControllerServicesContainer(Guid instanceId);\r\n        #endregion\r\n\r\n\r\n        #region Workflow status methods\r\n        bool WorkflowExists(Guid instanceId);\r\n        Semaphore WaitForIdleStatus(Guid instanceId);\r\n        #endregion\r\n\r\n\r\n        #region Form workflow methods\r\n        void SetEventHandlerFilter(Guid instanceId, Type eventHandlerFilterType);\r\n        IEventHandleFilter GetEventHandleFilter(Guid instanceId);\r\n        IEnumerable<string> GetCurrentFormEvents(Guid instanceId);\r\n        IEnumerable<string> GetCurrentFormEvents(WorkflowInstance workflowInstance);\r\n        void FireSaveEvent(Guid instanceId, Dictionary<string, object> bindings);\r\n        void FireSaveAndPublishEvent(Guid instanceId, Dictionary<string, object> bindings);\r\n        void FireNextEvent(Guid instanceId, Dictionary<string, object> bindings);\r\n        void FirePreviousEvent(Guid instanceId, Dictionary<string, object> bindings);\r\n        void FireFinishEvent(Guid instanceId, Dictionary<string, object> bindings);\r\n        void FireCancelEvent(Guid instanceId, Dictionary<string, object> bindings);\r\n        void FirePreviewEvent(Guid instanceId, Dictionary<string, object> bindings);\r\n        void FireCustomEvent(int eventNumber, Guid instanceId, Dictionary<string, object> bindings);\r\n        void FireChildWorkflowDoneEvent(Guid parentInstanceId, string workflowResult);\r\n        #endregion\r\n\r\n\r\n        #region FormData methods\r\n        void AddFormData(Guid instanceId, FormData formData);\r\n        bool TryGetFormData(Guid instanceId, out FormData formData);\r\n        FormData GetFormData(Guid instanceId, bool allowCreationIfNotExisting);\r\n        #endregion\r\n\r\n\r\n        void Flush();\r\n        void ShutDown();\r\n        void ConsoleClosed(ConsoleClosedEventArgs args);\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Plugins/WorkflowRuntimeProvider/IWorkflowRuntimeProvider.cs",
    "content": "using System.Workflow.Runtime;\r\n\r\nusing Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider.Runtime;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider\r\n{\r\n    [CustomFactory(typeof(WorkflowRuntimeProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(WorkflowRuntimeProviderDefaultNameRetriever))]\r\n    internal interface IWorkflowRuntimeProvider\r\n    {\r\n        WorkflowRuntime GetWorkflowRuntime();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Plugins/WorkflowRuntimeProvider/NonConfigurableWorkflowRuntimeProvider.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableWorkflowRuntimeProviderAssembler))]\r\n    internal class NonConfigurableWorkflowRuntimeProvider : WorkflowRuntimeProviderData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableWorkflowRuntimeProviderAssembler : IAssembler<IWorkflowRuntimeProvider, WorkflowRuntimeProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IWorkflowRuntimeProvider Assemble(IBuilderContext context, WorkflowRuntimeProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IWorkflowRuntimeProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Plugins/WorkflowRuntimeProvider/Runtime/WorkflowRuntimeProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider.Runtime\r\n{\r\n    internal sealed class WorkflowRuntimeProviderCustomFactory : AssemblerBasedCustomFactory<IWorkflowRuntimeProvider, WorkflowRuntimeProviderData>\r\n    {\r\n        protected override WorkflowRuntimeProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            WorkflowRuntimeProviderSettings settings = configurationSource.GetSection(WorkflowRuntimeProviderSettings.SectionName) as WorkflowRuntimeProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", WorkflowRuntimeProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.WorkflowRuntimeProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Plugins/WorkflowRuntimeProvider/Runtime/WorkflowRuntimeProviderDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider.Runtime\r\n{\r\n    internal sealed class WorkflowRuntimeProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Plugins/WorkflowRuntimeProvider/Runtime/WorkflowRuntimeProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider.Runtime\r\n{\r\n    internal sealed class WorkflowRuntimeProviderFactory : NameTypeFactoryBase<IWorkflowRuntimeProvider>\r\n    {\r\n        public WorkflowRuntimeProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Plugins/WorkflowRuntimeProvider/Runtime/WorkflowRuntimeProviderSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.Core.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider.Runtime\r\n{\r\n    internal sealed class WorkflowRuntimeProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProviderConfiguration\";\r\n\r\n\r\n        private const string _defaultProviderNameProperty = \"defaultProviderName\";\r\n        [ConfigurationProperty(_defaultProviderNameProperty, IsRequired = true)]\r\n        public string DefaultProviderName\r\n        {\r\n            get { return (string)base[_defaultProviderNameProperty]; }\r\n            set { base[_defaultProviderNameProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _workflowRuntimeProviderPluginsProperty = \"WorkflowRuntimeProviderPlugins\";\r\n        [ConfigurationProperty(_workflowRuntimeProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<WorkflowRuntimeProviderData> WorkflowRuntimeProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<WorkflowRuntimeProviderData>)base[_workflowRuntimeProviderPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/Plugins/WorkflowRuntimeProvider/WorkflowRuntimeProviderData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableWorkflowRuntimeProvider))]\r\n    internal class WorkflowRuntimeProviderData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/StateMachineWorkflowInstanceExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n\tinternal static class StateMachineWorkflowInstanceExtensionMethods\r\n\t{\r\n        public static IEnumerable<string> GetCurrentEventNames(this StateMachineWorkflowInstance stateMachineWorkflowInstance, Type eventServiceType)\r\n        {\r\n            if (stateMachineWorkflowInstance == null) throw new ArgumentNullException(\"stateMachineWorkflowInstance\");\r\n            if (eventServiceType == null) throw new ArgumentNullException(\"eventServiceType\");\r\n\r\n            Verify.IsNotNull(stateMachineWorkflowInstance.CurrentState, \"The workflow has already been canceled.\");\r\n\r\n            foreach (Activity currentStateActivity in stateMachineWorkflowInstance.CurrentState.Activities)\r\n            {\r\n                if (currentStateActivity.Enabled == false) continue;\r\n                if ((currentStateActivity is EventDrivenActivity) == false) continue;\r\n\r\n                HandleExternalEventActivity handleExternalEventActivity = ((EventDrivenActivity)currentStateActivity).EventActivity as HandleExternalEventActivity;\r\n                if (handleExternalEventActivity == null) continue;\r\n                if (handleExternalEventActivity.Enabled == false) continue;\r\n                if (handleExternalEventActivity.InterfaceType != eventServiceType) continue;\r\n\r\n                yield return handleExternalEventActivity.EventName;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/WorkflowActionExecutor.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    internal sealed class WorkflowActionExecutor : IActionExecutorSerializedParameters\r\n    {\r\n        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            WorkflowActionToken workflowActionToken = (WorkflowActionToken)actionToken;\r\n\r\n            WorkflowInstance workflowInstance = WorkflowFacade.CreateNewWorkflow(\r\n                    workflowActionToken.WorkflowType,\r\n                    new Dictionary<string, object> { \r\n                            { \"SerializedEntityToken\", serializedEntityToken },\r\n                            { \"SerializedActionToken\", serializedActionToken },\r\n                            { \"ParentWorkflowInstanceId\", workflowActionToken.ParentWorkflowInstanceId }\r\n                        }\r\n                );\r\n\r\n            workflowInstance.Start();\r\n\r\n            WorkflowFacade.SetFlowControllerServicesContainer(workflowInstance.InstanceId, flowControllerServicesContainer);\r\n            WorkflowFacade.RunWorkflow(workflowInstance);\r\n\r\n            WorkflowFacade.SetEventHandlerFilter(workflowInstance.InstanceId, workflowActionToken.EventHandleFilterType);\r\n\r\n            return new WorkflowFlowToken(workflowInstance.InstanceId);\r\n        }\r\n\r\n\r\n\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            return Execute(EntityTokenSerializer.Serialize(entityToken), ActionTokenSerializer.Serialize(actionToken), actionToken, flowControllerServicesContainer);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/WorkflowActionToken.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing static Composite.Core.Serialization.StringConversionServices;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ActionExecutor(typeof(WorkflowActionExecutor))]\r\n    public class WorkflowActionToken : ActionToken\r\n    {\r\n        /// <exclude />\r\n        public WorkflowActionToken(Type workflowType)\r\n            : this(workflowType, null)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public WorkflowActionToken(Type workflowType, IEnumerable<PermissionType> permissionType)\r\n        {\r\n            Verify.ArgumentNotNull(workflowType, nameof(workflowType));\r\n\r\n            PermissionTypes = permissionType ?? Enumerable.Empty<PermissionType>();\r\n\r\n            this.WorkflowType = workflowType;\r\n            this.ParentWorkflowInstanceId = Guid.Empty;\r\n            this.Payload = \"\";\r\n            this.ExtraPayload = \"\";\r\n            this.EventHandleFilterType = null;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type WorkflowType { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public Guid ParentWorkflowInstanceId\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        // User defined data to the workflow\r\n        /// <exclude />\r\n        public string Payload\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        // User defined data to the workflow\r\n        /// <exclude />\r\n        public string ExtraPayload\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool DoIgnoreEntityTokenLocking\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type EventHandleFilterType\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool IgnoreEntityTokenLocking => this.DoIgnoreEntityTokenLocking;\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PermissionType> PermissionTypes { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            var stringBuilder = new StringBuilder();\r\n\r\n            SerializeKeyValuePair(stringBuilder, \"_WorkflowType_\", TypeManager.SerializeType(this.WorkflowType));\r\n            SerializeKeyValuePair(stringBuilder, \"_Payload_\", this.Payload);\r\n            SerializeKeyValuePair(stringBuilder, \"_ExtraPayload_\", this.ExtraPayload);\r\n            SerializeKeyValuePair(stringBuilder, \"_Ignore_\", this.DoIgnoreEntityTokenLocking);\r\n            SerializeKeyValuePair(stringBuilder, \"_PermissionTypes_\", this.PermissionTypes.SerializePermissionTypes());\r\n            if (this.EventHandleFilterType != null)\r\n            {\r\n                string serializedType = TypeManager.SerializeType(this.EventHandleFilterType);\r\n                SerializeKeyValuePair(stringBuilder, \"_EventHandleFilterType_\", serializedType);\r\n            }\r\n\r\n            return stringBuilder.ToString();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static ActionToken Deserialize(string serializedWorkflowActionToken)\r\n        {\r\n            Dictionary<string, string> dic = ParseKeyValueCollection(serializedWorkflowActionToken);\r\n\r\n            if (!dic.ContainsKey(\"_WorkflowType_\")\r\n                || !dic.ContainsKey(\"_Payload_\") \r\n                || !dic.ContainsKey(\"_ExtraPayload_\") \r\n                || !dic.ContainsKey(\"_Ignore_\") \r\n                || !dic.ContainsKey(\"_PermissionTypes_\"))\r\n            {\r\n                throw new ArgumentException(\"The serializedWorkflowActionToken is not a serialized WorkflowActionToken\", nameof(serializedWorkflowActionToken));\r\n            }\r\n\r\n            string serializedType = DeserializeValueString(dic[\"_WorkflowType_\"]);\r\n            Type type = TypeManager.GetType(serializedType);\r\n\r\n            string permissionTypesString = DeserializeValueString(dic[\"_PermissionTypes_\"]);\r\n\r\n            var workflowActionToken = new WorkflowActionToken(type, permissionTypesString.DesrializePermissionTypes());\r\n\r\n            string payload = DeserializeValueString(dic[\"_Payload_\"]);\r\n            workflowActionToken.Payload = payload;\r\n\r\n            string extraPayload = DeserializeValueString(dic[\"_ExtraPayload_\"]);\r\n            workflowActionToken.ExtraPayload = extraPayload;\r\n\r\n            bool ignoreEntityTokenLocking = DeserializeValueBool(dic[\"_Ignore_\"]);\r\n            workflowActionToken.DoIgnoreEntityTokenLocking = ignoreEntityTokenLocking;\r\n\r\n            if (dic.ContainsKey(\"_EventHandleFilterType_\"))\r\n            {\r\n                string serializedFilterType = DeserializeValueString(dic[\"_EventHandleFilterType_\"]);\r\n                workflowActionToken.EventHandleFilterType = TypeManager.GetType(serializedFilterType);\r\n            }\r\n\r\n            return workflowActionToken;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/C1Console/Workflow/WorkflowFacade.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Threading;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow.Foundation;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class WorkflowFacade\r\n    {\r\n        private static IWorkflowFacade _workflowFacade = new WorkflowFacadeImpl();\r\n\r\n        private static readonly ConcurrentDictionary<string, Type> _workflowTypeLookupCache = new ConcurrentDictionary<string, Type>();\r\n\r\n\r\n        static WorkflowFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n            GlobalEventSystemFacade.SubscribeToShutDownEvent(OnShutDownEvent);\r\n            ConsoleFacade.SubscribeToConsoleClosedEvent(OnConsoleClosedEvent);\r\n        }\r\n\r\n\r\n\r\n        internal static IWorkflowFacade Implementation { get { return _workflowFacade; } set { _workflowFacade = value; } }\r\n\r\n\r\n        /// <exclude />\r\n        public static void EnsureInitialization()\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                _workflowFacade.EnsureInitialization();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WorkflowRuntime WorkflowRuntime\r\n        {\r\n            get\r\n            {\r\n                return _workflowFacade.WorkflowRuntime;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Type GetWorkflowType(string typeName)\r\n        {\r\n            Type type = _workflowTypeLookupCache.GetOrAdd(typeName, GetWorkflowTypeInternal);\r\n\r\n            Verify.IsNotNull(type, \"Could not find the workflow type: {0}\", typeName);\r\n\r\n            return type;\r\n        }\r\n\r\n        private static Type GetWorkflowTypeInternal(string typeName)\r\n        {\r\n            Type type = TypeManager.TryGetType(typeName);\r\n            if (type == null && !typeName.Contains(\",\"))\r\n            {\r\n                string fullname = typeName + \", Composite.Workflows\";\r\n\r\n                type = TypeManager.TryGetType(fullname);\r\n            }\r\n\r\n            return type;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Runs the when initialized.\r\n        /// </summary>\r\n        /// <param name=\"action\">The action.</param>\r\n        public static void RunWhenInitialized(Action action)\r\n        {\r\n            _workflowFacade.RunWhenInitialized(action);\r\n        }\r\n\r\n\r\n\r\n        #region Workflow methods\r\n        /// <exclude />\r\n        public static WorkflowInstance CreateNewWorkflow(Type workflowType)\r\n        {\r\n            return _workflowFacade.CreateNewWorkflow(workflowType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WorkflowInstance CreateNewWorkflow(Type workflowType, Dictionary<string, object> arguments)\r\n        {\r\n            return _workflowFacade.CreateNewWorkflow(workflowType, arguments);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WorkflowFlowToken StartNewWorkflow(Type workflowType, FlowControllerServicesContainer flowControllerServicesContainer, EntityToken entityToken, ActionToken actionToken)\r\n        {\r\n            return _workflowFacade.StartNewWorkflow(workflowType, flowControllerServicesContainer, entityToken, actionToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WorkflowInstance GetWorkflow(Guid instanceId)\r\n        {\r\n           return _workflowFacade.GetWorkflow(instanceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static StateMachineWorkflowInstance GetStateMachineWorkflowInstance(Guid instanceId)\r\n        {\r\n           return _workflowFacade.GetStateMachineWorkflowInstance(instanceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RunWorkflow(Guid instanceId)\r\n        {\r\n           _workflowFacade.RunWorkflow(instanceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RunWorkflow(WorkflowInstance workflowInstance)\r\n        {\r\n           _workflowFacade.RunWorkflow(workflowInstance);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AbortWorkflow(Guid instanceId)\r\n        {\r\n          _workflowFacade.AbortWorkflow(instanceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AcquireLock(Guid instanceId, EntityToken entityToken)\r\n        {\r\n           _workflowFacade.AcquireLock(instanceId, entityToken);\r\n        }        \r\n        #endregion\r\n\r\n\r\n\r\n        #region FlowControllerServices methods\r\n        /// <exclude />\r\n        public static void SetFlowControllerServicesContainer(Guid instanceId, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            _workflowFacade.SetFlowControllerServicesContainer(instanceId, flowControllerServicesContainer);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static FlowControllerServicesContainer GetFlowControllerServicesContainer(Guid instanceId)\r\n        {\r\n            return _workflowFacade.GetFlowControllerServicesContainer(instanceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        private static void RemoveFlowControllerServicesContainer(Guid instanceId)\r\n        {\r\n            _workflowFacade.RemoveFlowControllerServicesContainer(instanceId);\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        #region Workflow status methods\r\n        /// <exclude />\r\n        public static bool WorkflowExists(Guid instanceId)\r\n        {\r\n           return _workflowFacade.WorkflowExists(instanceId);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This method returns a semaphore that will be signaled when the workflow instance becomes idle.\r\n        /// Or null if the workflow instance is idle at the calling moment.\r\n        /// </summary>\r\n        /// <param name=\"instanceId\"></param>\r\n        /// <returns></returns>\r\n        public static Semaphore WaitForIdleStatus(Guid instanceId)\r\n        {\r\n           return _workflowFacade.WaitForIdleStatus(instanceId);\r\n        }        \r\n        #endregion\r\n\r\n\r\n\r\n        #region Form workflow methods\r\n        /// <exclude />\r\n        public static void SetEventHandlerFilter(Guid instanceId, Type eventHandlerFilterType)\r\n        {\r\n            _workflowFacade.SetEventHandlerFilter(instanceId, eventHandlerFilterType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEventHandleFilter GetEventHandleFilter(Guid instanceId)\r\n        {\r\n            return _workflowFacade.GetEventHandleFilter(instanceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetCurrentFormEvents(Guid instanceId)\r\n        {\r\n            return _workflowFacade.GetCurrentFormEvents(instanceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetCurrentFormEvents(WorkflowInstance workflowInstance)\r\n        {\r\n            return _workflowFacade.GetCurrentFormEvents(workflowInstance);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireSaveEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            _workflowFacade.FireSaveEvent(instanceId, bindings);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireSaveAndPublishEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            _workflowFacade.FireSaveAndPublishEvent(instanceId, bindings);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireNextEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            _workflowFacade.FireNextEvent(instanceId, bindings);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FirePreviousEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            _workflowFacade.FirePreviousEvent(instanceId, bindings);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireFinishEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            _workflowFacade.FireFinishEvent(instanceId, bindings);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireCancelEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            _workflowFacade.FireCancelEvent(instanceId, bindings);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FirePreviewEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            _workflowFacade.FirePreviewEvent(instanceId, bindings);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireCustomEvent(int customEventNumber, Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            if (customEventNumber < 1 || customEventNumber > 5) throw new ArgumentException(\"Number must be between 1 and 5\", \"customEventNumber\");\r\n\r\n            _workflowFacade.FireCustomEvent(customEventNumber, instanceId, bindings);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireChildWorkflowDoneEvent(Guid parentInstanceId, string workflowResult)\r\n        {\r\n            _workflowFacade.FireChildWorkflowDoneEvent(parentInstanceId, workflowResult);\r\n\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        #region FormData methods\r\n        internal static void AddFormData(Guid instanceId, FormData formData)\r\n        {\r\n            _workflowFacade.AddFormData(instanceId, formData);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetFormData(Guid instanceId, out FormData formData)\r\n        {\r\n            return _workflowFacade.TryGetFormData(instanceId, out formData);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static FormData GetFormData(Guid instanceId, bool allowCreationIfNotExisting = false)\r\n        {\r\n            return _workflowFacade.GetFormData(instanceId, allowCreationIfNotExisting);\r\n        }        \r\n        #endregion\r\n\r\n\r\n\r\n        \r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _workflowFacade.Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void OnShutDownEvent(ShutDownEventArgs args)\r\n        {\r\n            _workflowFacade.ShutDown();\r\n        }\r\n\r\n\r\n\r\n        private static void OnConsoleClosedEvent(ConsoleClosedEventArgs args)\r\n        {\r\n            _workflowFacade.ConsoleClosed(args);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/WorkflowFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Web.Hosting;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Runtime.Hosting;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Tasks;\r\nusing Composite.C1Console.Workflow.Activities.Foundation;\r\nusing Composite.C1Console.Workflow.Foundation;\r\nusing Composite.C1Console.Workflow.Foundation.PluginFacades;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    internal sealed class WorkflowFacadeImpl : IWorkflowFacade\r\n    {\r\n        private static readonly string LogTitle = \"WorkflowFacade\";\r\n        private static readonly string LogTitleColored = \"RGB(194, 252, 131)\" + LogTitle;\r\n\r\n        private static readonly TimeSpan OldFileExistenceTimeout = TimeSpan.FromDays(30.0);\r\n\r\n        private Thread _initializeThread;\r\n        private readonly object _initializeThreadLock = new object();\r\n        private bool _isShutDown;\r\n        private WorkflowRuntime _workflowRuntime;\r\n        private readonly List<Action> _actionToRunWhenInitialized = new List<Action>();\r\n\r\n        private ExternalDataExchangeService _externalDataExchangeService;\r\n        private FormsWorkflowEventService _formsWorkflowEventService;\r\n        private ManualWorkflowSchedulerService _manualWorkflowSchedulerService;\r\n        private FileWorkflowPersistenceService _fileWorkflowPersistenceService;\r\n\r\n        private readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.InitializeResources);\r\n\r\n        private readonly Dictionary<Type, bool> _hasEntityTokenLockAttributeCache = new Dictionary<Type, bool>();\r\n\r\n\r\n        public WorkflowFacadeImpl()\r\n        {\r\n            string serializedWorkflowsDirectory = PathUtil.Resolve(GlobalSettingsFacade.SerializedWorkflowsDirectory);\r\n            string parentDirectory = Path.GetDirectoryName(serializedWorkflowsDirectory);\r\n            string lockFileDirectory = Path.Combine(parentDirectory, \"LockFiles\");\r\n\r\n            if (!C1Directory.Exists(lockFileDirectory)) C1Directory.CreateDirectory(lockFileDirectory);\r\n        }\r\n\r\n\r\n        public void EnsureInitialization()\r\n        {\r\n            if (_initializeThread != null) return;\r\n\r\n            lock (_initializeThreadLock)\r\n            {\r\n                if (_initializeThread != null) return;\r\n                \r\n                ThreadStart threadStart = () =>\r\n                    {\r\n                        using(ThreadDataManager.EnsureInitialize()) \r\n                        {\r\n                            int startTime = Environment.TickCount;\r\n                            while (_workflowRuntime == null && !_isShutDown && startTime + 30000 > Environment.TickCount)\r\n                            {\r\n                                Thread.Sleep(100);\r\n                            }\r\n\r\n                            if (_workflowRuntime != null)\r\n                            {\r\n                                Log.LogVerbose(LogTitleColored, \"Already initialized, skipping delayed initialization\");\r\n                                return;\r\n                            }\r\n\r\n                            if (_isShutDown || HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                            {\r\n                                Log.LogVerbose(LogTitleColored, \"System is shutting down, skipping delayed initialization\");\r\n                                return;\r\n                            }\r\n\r\n                            int endTime = Environment.TickCount;\r\n\r\n                            try\r\n                            {\r\n                                using (_resourceLocker.Locker)\r\n                                {\r\n                                    DoInitialize(endTime - startTime);\r\n                                }\r\n                            }\r\n                            catch (Exception ex)\r\n                            {\r\n                                if (_isShutDown || HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                                {\r\n                                    Log.LogVerbose(LogTitleColored, \"Delayed initialization has failed, but the exception is ignored as the website is shutting down\");\r\n                                    return;\r\n                                }\r\n\r\n                                Log.LogCritical(LogTitle, ex);\r\n                            }\r\n                        }\r\n                    };\r\n\r\n                _initializeThread = new Thread(threadStart);\r\n                _initializeThread.Start();\r\n                \r\n            }\r\n        }\r\n\r\n\r\n        public WorkflowRuntime WorkflowRuntime\r\n        {\r\n            get\r\n            {\r\n                DoInitialize(0);\r\n\r\n                return _workflowRuntime;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void RunWhenInitialized(Action action)\r\n        {\r\n            _actionToRunWhenInitialized.Add(action);\r\n        }\r\n\r\n\r\n\r\n        #region Workflow methods\r\n        public WorkflowInstance CreateNewWorkflow(Type workflowType)\r\n        {\r\n            GlobalInitializerFacade.EnsureSystemIsInitialized();\r\n            DoInitialize(0);\r\n\r\n            try\r\n            {\r\n                WorkflowInstance workflowInstance = _workflowRuntime.CreateWorkflow(workflowType);\r\n\r\n                SetWorkflowPersistingType(workflowType, workflowInstance.InstanceId);\r\n\r\n                return workflowInstance;\r\n            }\r\n            catch (WorkflowValidationFailedException exp)\r\n            {\r\n                StringBuilder errors = new StringBuilder();\r\n                foreach (ValidationError error in exp.Errors)\r\n                {\r\n                    errors.AppendLine(error.ToString());\r\n                }\r\n                Log.LogError(LogTitle, errors.ToString());\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public WorkflowInstance CreateNewWorkflow(Type workflowType, Dictionary<string, object> arguments)\r\n        {\r\n            GlobalInitializerFacade.EnsureSystemIsInitialized();\r\n            DoInitialize(0);\r\n\r\n            try\r\n            {\r\n                WorkflowInstance workflowInstance = _workflowRuntime.CreateWorkflow(workflowType, arguments);\r\n\r\n                SetWorkflowPersistingType(workflowType, workflowInstance.InstanceId);\r\n\r\n                if (arguments.TryGetValue(\"SerializedEntityToken\", out var serializedEntityToken)\r\n                    && arguments.TryGetValue(\"SerializedActionToken\", out var serializedActionToken))\r\n                {\r\n                    ActionToken actionToken = ActionTokenSerializer.Deserialize((string)serializedActionToken);\r\n\r\n                    if (!actionToken.IgnoreEntityTokenLocking)\r\n                    {\r\n                        AcquireLockIfNeeded(workflowType, workflowInstance.InstanceId, (string)serializedEntityToken);\r\n                    }\r\n                }\r\n\r\n                return workflowInstance;\r\n            }\r\n            catch (WorkflowValidationFailedException exp)\r\n            {\r\n                var errors = new StringBuilder();\r\n                foreach (ValidationError error in exp.Errors)\r\n                {\r\n                    errors.AppendLine(error.ToString());\r\n                }\r\n\r\n                Log.LogError(LogTitle, errors.ToString());\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public WorkflowFlowToken StartNewWorkflow(Type workflowType, FlowControllerServicesContainer flowControllerServicesContainer, EntityToken entityToken, ActionToken actionToken)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            Dictionary<string, object> arguments = new Dictionary<string, object> { { \"EntityToken\", entityToken }, { \"ActionToken\", actionToken } };\r\n\r\n            try\r\n            {\r\n                WorkflowInstance workflowInstance = _workflowRuntime.CreateWorkflow(workflowType, arguments);\r\n\r\n                SetWorkflowPersistingType(workflowType, workflowInstance.InstanceId);\r\n                AcquireLockIfNeeded(workflowType, workflowInstance.InstanceId, entityToken);\r\n\r\n                workflowInstance.Start();\r\n\r\n                SetFlowControllerServicesContainer(workflowInstance.InstanceId, flowControllerServicesContainer);\r\n\r\n                RunWorkflow(workflowInstance);\r\n\r\n                return new WorkflowFlowToken(workflowInstance.InstanceId);\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                Log.LogCritical(LogTitle, e);\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public WorkflowInstance GetWorkflow(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            return _workflowRuntime.GetWorkflow(instanceId);\r\n        }\r\n\r\n\r\n\r\n        public StateMachineWorkflowInstance GetStateMachineWorkflowInstance(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            return new StateMachineWorkflowInstance(_workflowRuntime, instanceId);\r\n        }\r\n\r\n\r\n\r\n        public void RunWorkflow(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            SetWorkflowInstanceStatus(instanceId, WorkflowInstanceStatus.Running, false);\r\n\r\n            _manualWorkflowSchedulerService.RunWorkflow(instanceId);\r\n\r\n            if (_resourceLocker.Resources.ExceptionFromWorkflow.TryRemove(Thread.CurrentThread.ManagedThreadId, out var exception))\r\n            {\r\n                throw new InvalidOperationException(\"Error executing workflow \" + instanceId, exception);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void RunWorkflow(WorkflowInstance workflowInstance)\r\n        {\r\n            RunWorkflow(workflowInstance.InstanceId);\r\n        }\r\n\r\n\r\n        public void AbortWorkflow(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (AbortedWorkflows.Contains(instanceId)) return;\r\n                AbortedWorkflows.Add(instanceId);\r\n\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    var workflowInstance = WorkflowRuntime.GetWorkflow(instanceId);\r\n\r\n                    workflowInstance.Abort();\r\n                    \r\n                    if (_resourceLocker.Resources.ExceptionFromWorkflow.TryRemove(Thread.CurrentThread.ManagedThreadId, out var exception))\r\n                    {\r\n                        throw exception;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void SetWorkflowPersistingType(Type workflowType, Guid instanceId)\r\n        {\r\n            List<AllowPersistingWorkflowAttribute> attributes = workflowType.GetCustomAttributesRecursively<AllowPersistingWorkflowAttribute>().ToList();\r\n\r\n            Verify.That(attributes.Count <= 1, $\"More than one attribute of type '{nameof(AllowPersistingWorkflowAttribute)}' found\");\r\n\r\n            var persistenceType = attributes.Count == 1 ? attributes[0].WorkflowPersistingType : WorkflowPersistingType.Never;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                _resourceLocker.Resources.WorkflowPersistingTypeDictionary.Add(instanceId, persistenceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void RemovePersistingType(Guid instanceId)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                _resourceLocker.Resources.WorkflowPersistingTypeDictionary.Remove(instanceId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AcquireLockIfNeeded(Type workflowType, Guid instanceId, string serializedEntityToken)\r\n        {\r\n            if (HasEntityTokenLockAttribute(workflowType))\r\n            {\r\n                EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n                AcquireLock(instanceId, entityToken);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AcquireLockIfNeeded(Type workflowType, Guid instanceId, EntityToken entityToken)\r\n        {\r\n            if (HasEntityTokenLockAttribute(workflowType))\r\n            {\r\n                AcquireLock(instanceId, entityToken);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void AcquireLock(Guid instanceId, EntityToken entityToken)\r\n        {\r\n            Verify.That(!ActionLockingFacade.IsLocked(entityToken), \"The entityToken is already locked\");\r\n\r\n            ActionLockingFacade.AcquireLock(entityToken, instanceId);\r\n        }\r\n\r\n\r\n\r\n        private void ReleaseAllLocks(Guid instanceId)\r\n        {\r\n            ActionLockingFacade.ReleaseAllLocks(instanceId);\r\n        }\r\n\r\n\r\n\r\n        private bool HasEntityTokenLockAttribute(Type workflowType)\r\n        {\r\n            return _hasEntityTokenLockAttributeCache.GetOrAdd(workflowType,\r\n                type => type.GetCustomAttributesRecursively<EntityTokenLockAttribute>().Any());\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        #region FlowControllerServices methods\r\n        public void SetFlowControllerServicesContainer(Guid instanceId, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                _resourceLocker.Resources.FlowControllerServicesContainers[instanceId] = flowControllerServicesContainer;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public FlowControllerServicesContainer GetFlowControllerServicesContainer(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            FlowControllerServicesContainer flowControllerServicesContainer;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                _resourceLocker.Resources.FlowControllerServicesContainers.TryGetValue(instanceId, out flowControllerServicesContainer);\r\n            }\r\n\r\n            return flowControllerServicesContainer;\r\n        }\r\n\r\n\r\n\r\n        public void RemoveFlowControllerServicesContainer(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                _resourceLocker.Resources.FlowControllerServicesContainers.Remove(instanceId);\r\n            }\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        #region Workflow status methods\r\n        public bool WorkflowExists(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                return _resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Semaphore WaitForIdleStatus(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                WorkflowInstanceStatus workflowInstanceStatus;\r\n                if (!_resourceLocker.Resources.WorkflowStatusDictionary.TryGetValue(instanceId, out workflowInstanceStatus))\r\n                {\r\n                    throw new InvalidOperationException($\"The workflow with the id '{instanceId}' is unknown\");\r\n                }\r\n\r\n                if (workflowInstanceStatus == WorkflowInstanceStatus.Idle)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                _resourceLocker.Resources.WorkflowIdleWaitSemaphores.Remove(instanceId);\r\n\r\n                Semaphore semaphore = new Semaphore(0, 1);\r\n                _resourceLocker.Resources.WorkflowIdleWaitSemaphores.Add(instanceId, semaphore);\r\n                return semaphore;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void SetWorkflowInstanceStatus(Guid instanceId, WorkflowInstanceStatus workflowInstanceStatus, bool newlyCreateOrLoaded)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                var resources = _resourceLocker.Resources;\r\n\r\n                Action releaseIdleWaitSemaphore = () =>\r\n                {\r\n                    if (resources.WorkflowIdleWaitSemaphores.TryGetValue(instanceId, out var semaphore))\r\n                    {\r\n                        semaphore.Release();\r\n                        resources.WorkflowIdleWaitSemaphores.Remove(instanceId);\r\n                    }\r\n                };\r\n\r\n                switch (workflowInstanceStatus)\r\n                {\r\n                    case WorkflowInstanceStatus.Idle:\r\n                        releaseIdleWaitSemaphore();\r\n\r\n                        resources.WorkflowStatusDictionary[instanceId] = WorkflowInstanceStatus.Idle;\r\n\r\n                        PersistFormData(instanceId);\r\n\r\n                        break;\r\n\r\n                    case WorkflowInstanceStatus.Running:\r\n                        resources.WorkflowStatusDictionary[instanceId] = WorkflowInstanceStatus.Running;\r\n                        break;\r\n\r\n                    case WorkflowInstanceStatus.Terminated:\r\n                        releaseIdleWaitSemaphore();\r\n                        resources.WorkflowStatusDictionary.Remove(instanceId);\r\n                        break;\r\n                    default:\r\n                        throw new InvalidOperationException(\"This line should not be reachable.\");\r\n                }\r\n            }\r\n\r\n            string identity = UserValidationFacade.IsLoggedIn() ? UserValidationFacade.GetUsername() : \"(system process)\";\r\n            Log.LogVerbose(LogTitle, $\"Workflow instance status changed to {workflowInstanceStatus}. Id = {instanceId}, User = {identity}\");\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        #region Form workflow methods\r\n        public void SetEventHandlerFilter(Guid instanceId, Type eventHandlerFilterType)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            if (eventHandlerFilterType != null)\r\n            {\r\n                Verify.That(typeof(IEventHandleFilter).IsAssignableFrom(eventHandlerFilterType), \"The argument eventHandlerFilterType does dot implement the interface '{0}'\", typeof(IEventHandleFilter));\r\n\r\n                FormData formData = GetFormData(instanceId);\r\n                if (formData != null)\r\n                {\r\n                    formData.EventHandleFilterType = eventHandlerFilterType;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEventHandleFilter GetEventHandleFilter(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            FormData formData = GetFormData(instanceId);\r\n\r\n            if (formData == null || formData.EventHandleFilterType == null) return null;\r\n\r\n            IEventHandleFilter eventHandleFilter;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (!_resourceLocker.Resources.EventHandleFilters.TryGetValue(formData.EventHandleFilterType, out eventHandleFilter))\r\n                {\r\n                    eventHandleFilter = (IEventHandleFilter)Activator.CreateInstance(formData.EventHandleFilterType);\r\n                    _resourceLocker.Resources.EventHandleFilters.Add(formData.EventHandleFilterType, eventHandleFilter);\r\n                }\r\n            }\r\n\r\n            return eventHandleFilter;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> GetCurrentFormEvents(Guid instanceId)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            IEnumerable<string> eventNames = new StateMachineWorkflowInstance(WorkflowFacade.WorkflowRuntime, instanceId).GetCurrentEventNames(typeof(IFormsWorkflowEventService));\r\n\r\n            return eventNames;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> GetCurrentFormEvents(WorkflowInstance workflowInstance)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            return GetCurrentFormEvents(workflowInstance.InstanceId);\r\n        }\r\n\r\n\r\n\r\n        public void FireSaveEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    _formsWorkflowEventService.FireSaveEvent(new FormEventArgs(instanceId, bindings));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireSaveAndPublishEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    _formsWorkflowEventService.FireSaveAndPublishEvent(new FormEventArgs(instanceId, bindings));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireNextEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    _formsWorkflowEventService.FireNextEvent(new FormEventArgs(instanceId, bindings));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FirePreviousEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    _formsWorkflowEventService.FirePreviousEvent(new FormEventArgs(instanceId, bindings));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireFinishEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    _formsWorkflowEventService.FireFinishEvent(new FormEventArgs(instanceId, bindings));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireCancelEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    _formsWorkflowEventService.FireCancelEvent(new FormEventArgs(instanceId, bindings));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FirePreviewEvent(Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    _formsWorkflowEventService.FirePreviewEvent(new FormEventArgs(instanceId, bindings));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireCustomEvent(int customEventNumber, Guid instanceId, Dictionary<string, object> bindings)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            if (customEventNumber < 1 || customEventNumber > 5) throw new ArgumentException(\"Number must be between 1 and 5\", nameof(customEventNumber));\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(instanceId))\r\n                {\r\n                    switch (customEventNumber)\r\n                    {\r\n                        case 01:\r\n                            _formsWorkflowEventService.FireCustomEvent01(new FormEventArgs(instanceId, bindings));\r\n                            break;\r\n                        case 02:\r\n                            _formsWorkflowEventService.FireCustomEvent02(new FormEventArgs(instanceId, bindings));\r\n                            break;\r\n                        case 03:\r\n                            _formsWorkflowEventService.FireCustomEvent03(new FormEventArgs(instanceId, bindings));\r\n                            break;\r\n                        case 04:\r\n                            _formsWorkflowEventService.FireCustomEvent04(new FormEventArgs(instanceId, bindings));\r\n                            break;\r\n                        case 05:\r\n                            _formsWorkflowEventService.FireCustomEvent05(new FormEventArgs(instanceId, bindings));\r\n                            break;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void FireChildWorkflowDoneEvent(Guid parentInstanceId, string workflowResult)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.WorkflowStatusDictionary.ContainsKey(parentInstanceId))\r\n                {\r\n                    _formsWorkflowEventService.FireChildWorkflowDoneEvent(new FormEventArgs(parentInstanceId, workflowResult));\r\n                }\r\n            }\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        #region FormData methods\r\n        public void AddFormData(Guid instanceId, FormData formData)\r\n        {\r\n            if (!_resourceLocker.Resources.FormData.TryAdd(instanceId, formData))\r\n            {\r\n                throw new ArgumentException($\"Form data for instance ID '{instanceId}' has already been added\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool TryGetFormData(Guid instanceId, out FormData formData)\r\n        {\r\n            return _resourceLocker.Resources.FormData.TryGetValue(instanceId, out formData);\r\n        }\r\n\r\n\r\n\r\n        public FormData GetFormData(Guid instanceId, bool allowCreationIfNotExisting = false)\r\n        {\r\n            var allFormData = _resourceLocker.Resources.FormData;\r\n\r\n            if (allowCreationIfNotExisting)\r\n            {\r\n                return allFormData.GetOrAdd(instanceId, key => new FormData());\r\n            }\r\n\r\n            return allFormData.TryGetValue(instanceId, out var formData) ? formData : null;\r\n        }\r\n\r\n\r\n\r\n        private void RemoveIfExistFormData(Guid instanceId)\r\n        {\r\n            _resourceLocker.Resources.FormData.TryRemove(instanceId, out _);\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _workflowRuntime = null;\r\n            _externalDataExchangeService = null;\r\n            _manualWorkflowSchedulerService = null;\r\n            _fileWorkflowPersistenceService = null;\r\n            _formsWorkflowEventService = null;\r\n\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        public void ShutDown()\r\n        {\r\n            _isShutDown = true;\r\n\r\n            Log.LogVerbose(LogTitleColored, \"----------========== Finalizing Workflows ==========----------\");\r\n            int startTime = Environment.TickCount;\r\n\r\n            while (_workflowRuntime == null && Environment.TickCount - startTime < 5000)\r\n                Thread.Sleep(10);\r\n\r\n            if (_workflowRuntime != null)\r\n            {\r\n                // system shut down - close all console bound resources\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                    {\r\n                        PersistFormData();\r\n\r\n                        UnloadWorkflowsSilent();\r\n\r\n                        RemoveNotPersistableWorkflowsState();\r\n                    }\r\n                }\r\n            }\r\n\r\n            _workflowRuntime = null;\r\n\r\n            int endTime = Environment.TickCount;\r\n            Log.LogVerbose(LogTitleColored, \"----------========== Done finalizing Workflows ({0} ms ) ==========----------\", endTime - startTime);\r\n        }\r\n\r\n\r\n\r\n        public void ConsoleClosed(ConsoleClosedEventArgs args)\r\n        {\r\n            DoInitialize(0);\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                List<Guid> workflowsToCancel =\r\n                    (from kp in _resourceLocker.Resources.FlowControllerServicesContainers\r\n                     where ConsoleIdEquals(kp.Value, args.ConsoleId)\r\n                     select kp.Key).ToList();\r\n\r\n                foreach (Guid instanceId in workflowsToCancel)\r\n                {\r\n                    try\r\n                    {\r\n                        AbortWorkflow(instanceId);\r\n                    }\r\n                    catch(Exception ex)\r\n                    {\r\n                        Log.LogError(LogTitle, \"Error aborting workflow \" + instanceId);\r\n                        Log.LogError(LogTitle, ex);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DoInitialize(int delayedTime)\r\n        {\r\n            if (_workflowRuntime != null) return;\r\n            \r\n            using (GlobalInitializerFacade.CoreNotLockedScope)\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_workflowRuntime != null) return;\r\n\r\n                Log.LogVerbose(LogTitleColored, \"----------========== Initializing Workflows (Delayed: {0}) ==========----------\", delayedTime);\r\n                int startTime = Environment.TickCount;\r\n\r\n                _resourceLocker.ResetInitialization();\r\n\r\n                _workflowRuntime = InitializeWorkflowRuntime();\r\n\r\n                InitializeFormsWorkflowRuntime();\r\n\r\n                if (!_workflowRuntime.IsStarted)\r\n                {\r\n                    _workflowRuntime.StartRuntime();\r\n                }\r\n\r\n                DeleteOldWorkflows();\r\n\r\n\r\n                _fileWorkflowPersistenceService.ListenToDynamicallyAddedWorkflows(OnNewWorkflowFileAdded);\r\n                LoadPersistedWorkflows();\r\n                LoadPersistedFormData();\r\n\r\n                int endTime = Environment.TickCount;\r\n                Log.LogVerbose(LogTitleColored, \"----------========== Done initializing Workflows ({0} ms ) ==========----------\", endTime - startTime);\r\n\r\n                foreach (Action action in _actionToRunWhenInitialized)\r\n                {\r\n                    action();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private WorkflowRuntime InitializeWorkflowRuntime()\r\n        {\r\n            WorkflowRuntime workflowRuntime;\r\n\r\n            if (WorkflowRuntimeProviderPluginFacade.HasConfiguration)\r\n            {\r\n                string providerName = WorkflowRuntimeProviderRegistry.DefaultWorkflowRuntimeProviderName;\r\n\r\n                workflowRuntime = WorkflowRuntimeProviderPluginFacade.GetWorkflowRuntime(providerName);\r\n            }\r\n            else\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Using default workflow runtime\");\r\n                workflowRuntime = new WorkflowRuntime();\r\n            }\r\n\r\n\r\n            _manualWorkflowSchedulerService = new ManualWorkflowSchedulerService(true);\r\n            workflowRuntime.AddService(_manualWorkflowSchedulerService);\r\n\r\n            _fileWorkflowPersistenceService = new FileWorkflowPersistenceService(SerializedWorkflowsDirectory);\r\n            workflowRuntime.AddService(_fileWorkflowPersistenceService);\r\n\r\n            _externalDataExchangeService = new ExternalDataExchangeService();\r\n            workflowRuntime.AddService(_externalDataExchangeService);\r\n\r\n\r\n            AddWorkflowLoggingEvents(workflowRuntime);\r\n\r\n\r\n            workflowRuntime.WorkflowCompleted += (sender, args) =>\r\n            {\r\n                using (ThreadDataManager.EnsureInitialize())\r\n                {\r\n                    OnWorkflowInstanceTerminatedCleanup(args.WorkflowInstance.InstanceId);\r\n                }\r\n            };\r\n\r\n\r\n\r\n            workflowRuntime.WorkflowAborted += (sender, args) =>\r\n            {\r\n                using (ThreadDataManager.EnsureInitialize())\r\n                {\r\n                    OnWorkflowInstanceTerminatedCleanup(args.WorkflowInstance.InstanceId);\r\n                }\r\n            };\r\n\r\n\r\n\r\n            workflowRuntime.WorkflowTerminated += (sender, args) =>\r\n            {\r\n                using (ThreadDataManager.EnsureInitialize())\r\n                {\r\n                    OnWorkflowInstanceTerminatedCleanup(args.WorkflowInstance.InstanceId);\r\n                }\r\n\r\n                _resourceLocker.Resources.ExceptionFromWorkflow[Thread.CurrentThread.ManagedThreadId] = args.Exception;\r\n            };\r\n\r\n\r\n\r\n            workflowRuntime.WorkflowCreated += (sender, args) =>\r\n                SetWorkflowInstanceStatus(args.WorkflowInstance.InstanceId, WorkflowInstanceStatus.Idle, true);\r\n\r\n            workflowRuntime.WorkflowIdled += (sender, args) =>\r\n                SetWorkflowInstanceStatus(args.WorkflowInstance.InstanceId, WorkflowInstanceStatus.Idle, false);\r\n\r\n            workflowRuntime.WorkflowLoaded += (sender, args) => \r\n                SetWorkflowInstanceStatus(args.WorkflowInstance.InstanceId, WorkflowInstanceStatus.Idle, true);\r\n\r\n            return workflowRuntime;\r\n        }\r\n\r\n\r\n\r\n        private void OnWorkflowInstanceTerminatedCleanup(Guid instanceId)\r\n        {\r\n            AbortedWorkflows.Remove(instanceId);\r\n\r\n            WorkflowFlowToken flowToken = new WorkflowFlowToken(instanceId);\r\n\r\n            TaskManagerFacade.CompleteTasks(flowToken);\r\n\r\n            ReleaseAllLocks(instanceId);\r\n\r\n            SetWorkflowInstanceStatus(instanceId, WorkflowInstanceStatus.Terminated, false);\r\n\r\n            RemoveFlowControllerServicesContainer(instanceId);\r\n\r\n            RemoveIfExistFormData(instanceId);\r\n\r\n            RemovePersistingType(instanceId);\r\n\r\n            DeletePersistedWorkflow(instanceId);\r\n\r\n            DeletePersistedFormData(instanceId);\r\n\r\n            using (ThreadDataManager.EnsureInitialize())\r\n            {\r\n                FlowControllerFacade.FlowComplete(new WorkflowFlowToken(instanceId));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void InitializeFormsWorkflowRuntime()\r\n        {\r\n            _formsWorkflowEventService = new FormsWorkflowEventService();\r\n            _externalDataExchangeService.AddService(_formsWorkflowEventService);\r\n\r\n\r\n            IFormsWorkflowActivityService formsWorkflowActivityService = new FormsWorkflowActivityService();\r\n            _externalDataExchangeService.AddService(formsWorkflowActivityService);\r\n        }\r\n\r\n\r\n\r\n        [DebuggerHidden]\r\n        private void LogWorkflowChange(string change, WorkflowEventArgs args, bool logUserName, bool workflowDefinitionAvailable, bool error)\r\n        {\r\n            WorkflowInstance instance = null;\r\n\r\n            string activityTypeName = null;\r\n\r\n            try\r\n            {\r\n                instance = args.WorkflowInstance;\r\n            }\r\n            catch \r\n            {\r\n                // Silent\r\n            }\r\n\r\n            if (workflowDefinitionAvailable && instance != null)\r\n            {\r\n                try\r\n                {\r\n                    activityTypeName = instance.GetWorkflowDefinition().GetType().FullName;\r\n                }\r\n                catch\r\n                {\r\n                    // Silent\r\n                }\r\n            }\r\n\r\n            var message = new StringBuilder(\"Workflow \").Append(change);\r\n\r\n            if (activityTypeName != null)\r\n            {\r\n                message.Append(\", Activity = \" + activityTypeName);\r\n            }\r\n\r\n            if (instance != null)\r\n            {\r\n                message.Append(\", Id = \" + instance.InstanceId);\r\n            }\r\n\r\n            if (logUserName)\r\n            {\r\n                string identity = UserValidationFacade.IsLoggedIn() ? UserValidationFacade.GetUsername() : \"(system process)\";\r\n                message.Append(\", User = \" + identity);\r\n            }\r\n\r\n            if (!error)\r\n            {\r\n                Log.LogVerbose(LogTitle, message.ToString());\r\n            }\r\n            else\r\n            {\r\n                Log.LogError(LogTitle, message.ToString());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AddWorkflowLoggingEvents(WorkflowRuntime workflowRuntime)\r\n        {\r\n\r\n            workflowRuntime.WorkflowCreated += (sender, args) => LogWorkflowChange(\"created\", args, true, true, false);\r\n            workflowRuntime.WorkflowLoaded += (sender, args) => LogWorkflowChange(\"loaded\", args, true, true, false);\r\n            workflowRuntime.WorkflowPersisted += (sender, args) => LogWorkflowChange(\"persisted\", args, false, false, false);\r\n            workflowRuntime.WorkflowAborted += (sender, args) => LogWorkflowChange(\"aborted\", args, false, false, true);\r\n\r\n            workflowRuntime.WorkflowTerminated += (sender, args) =>\r\n            {\r\n                Log.LogError(LogTitle, \"Workflow terminated - Id = {0}, Exception:\",\r\n                                args.WorkflowInstance.InstanceId);\r\n                Log.LogError(LogTitle, args.Exception);\r\n            };\r\n        }\r\n\r\n\r\n\r\n        private void LoadPersistedWorkflows()\r\n        {\r\n            foreach (Guid instanceId in _fileWorkflowPersistenceService.GetPersistedWorkflows())\r\n            {\r\n                LoadPersistedWorkflow(instanceId);\r\n            }\r\n        }\r\n\r\n\r\n        private void LoadPersistedWorkflow(Guid instanceId)\r\n        {\r\n            WorkflowInstanceStatus status;\r\n            if (!_resourceLocker.Resources.WorkflowStatusDictionary.TryGetValue(instanceId, out status)\r\n                || status != WorkflowInstanceStatus.Running)\r\n            {\r\n                // This will make the runtime load the persisted workflow\r\n                WorkflowInstance workflowInstance = null;\r\n                try\r\n                {\r\n                    workflowInstance = WorkflowRuntime.GetWorkflow(instanceId);\r\n                }\r\n                catch (InvalidOperationException)\r\n                {\r\n                    _fileWorkflowPersistenceService.RemovePersistedWorkflow(instanceId);\r\n                }\r\n\r\n                if (workflowInstance != null\r\n                    && !_resourceLocker.Resources.WorkflowPersistingTypeDictionary.ContainsKey(instanceId))\r\n                {\r\n                    Type workflowType = workflowInstance.GetWorkflowDefinition().GetType();\r\n                    SetWorkflowPersistingType(workflowType, instanceId);\r\n                }\r\n            }\r\n        } \r\n\r\n\r\n        private void LoadPersistedFormData()\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                foreach (string filename in C1Directory.GetFiles(SerializedWorkflowsDirectory, \"*.xml\"))\r\n                {\r\n                    TryLoadPersistedFormData(filename);\r\n                }\r\n            }\r\n        }\r\n\r\n        private void TryLoadPersistedFormData(string filename)\r\n        {\r\n            string guidString = Path.GetFileNameWithoutExtension(filename);\r\n\r\n            Guid id;\r\n            if (!Guid.TryParse(guidString ?? \"\", out id)) return;\r\n\r\n            try\r\n            {\r\n                var doc = XDocumentUtils.Load(filename);\r\n                var formData = FormData.Deserialize(doc.Root);\r\n\r\n                if (!_resourceLocker.Resources.FormData.ContainsKey(id))\r\n                {\r\n                    _resourceLocker.Resources.FormData.TryAdd(id, formData);\r\n\r\n                    FormsWorkflowBindingCache.Bindings.TryAdd(id, formData.Bindings);\r\n                }\r\n            }\r\n            catch (DataSerilizationException ex)\r\n            {\r\n                Log.LogWarning(LogTitle, $\"The workflow {id} contained one or more bindings where data was deleted or data type changed\");\r\n                Log.LogWarning(LogTitle, ex);\r\n\r\n                //AbortWorkflow(id);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(LogTitle, $\"Could not deserialize form data for the workflow {id}\");\r\n                Log.LogCritical(LogTitle, ex);\r\n                AbortWorkflow(id);\r\n            }\r\n        }\r\n\r\n        private void OnNewWorkflowFileAdded(Guid instanceId)\r\n        {\r\n            Thread.Sleep(100);\r\n\r\n            if (HostingEnvironment.ApplicationHost.ShutdownInitiated()) return;\r\n            Log.LogInformation(LogTitle, \"New workflow detected: \" + instanceId);\r\n\r\n            using (ThreadDataManager.EnsureInitialize())\r\n            {\r\n                LoadPersistedWorkflow(instanceId);\r\n\r\n                string formDataFilename = GetFormDataFileName(instanceId);\r\n                if (C1File.Exists(formDataFilename))\r\n                {\r\n                    TryLoadPersistedFormData(formDataFilename);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private void RemoveNotPersistableWorkflowsState()\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                IEnumerable<Guid> instanceIds =\r\n                    from kvp in _resourceLocker.Resources.WorkflowPersistingTypeDictionary\r\n                    where kvp.Value == WorkflowPersistingType.Never\r\n                    select kvp.Key;\r\n\r\n                foreach (Guid instanceId in instanceIds)\r\n                {\r\n                    _fileWorkflowPersistenceService.RemovePersistedWorkflow(instanceId);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void UnloadWorkflowsSilent()\r\n        {\r\n            _fileWorkflowPersistenceService.PersistAll = true;\r\n\r\n            var abortedWorkflows = new HashSet<Guid>(_fileWorkflowPersistenceService.GetAbortedWorkflows());\r\n\r\n            foreach (Guid instanceId in _resourceLocker.Resources.WorkflowStatusDictionary.Keys.ToList())\r\n            {\r\n                if (abortedWorkflows.Contains(instanceId))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                UnloadSilent(instanceId);\r\n            }\r\n\r\n            _fileWorkflowPersistenceService.PersistAll = false;\r\n        }\r\n\r\n\r\n\r\n        [DebuggerHidden]\r\n        private void UnloadSilent(Guid instanceId)\r\n        {\r\n            try\r\n            {\r\n                WorkflowInstance workflowInstance = WorkflowRuntime.GetWorkflow(instanceId);\r\n                workflowInstance.Unload();\r\n            }\r\n            catch (Exception)\r\n            {\r\n                // Ignore, the workflow is already dead\r\n            }\r\n        }\r\n\r\n\r\n        static readonly HashSet<Guid> AbortedWorkflows = new HashSet<Guid>();\r\n\r\n        private void PersistFormData(Guid instanceId)\r\n        {\r\n            var resources = _resourceLocker.Resources;\r\n\r\n            bool shouldPersist = resources.WorkflowPersistingTypeDictionary.TryGetValue(instanceId, out var persistanceType)\r\n                                 && persistanceType != WorkflowPersistingType.Never;\r\n\r\n            if (!shouldPersist\r\n                || !resources.FormData.TryGetValue(instanceId, out FormData formData)\r\n                || formData == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            PersistFormData(instanceId, formData);\r\n        }\r\n\r\n\r\n\r\n        private void PersistFormData()\r\n        {\r\n            var resources = _resourceLocker.Resources;\r\n\r\n            List<Guid> instanceIds =\r\n                (from kvp in resources.WorkflowPersistingTypeDictionary\r\n                 where kvp.Value != WorkflowPersistingType.Never\r\n                 select kvp.Key).ToList();\r\n\r\n            // Copying collection since it may be modified why execution of forech-statement\r\n            var formDataSetToBePersisted = resources.FormData.Where(f => instanceIds.Contains(f.Key)).ToList();\r\n\r\n            foreach (var kvp in formDataSetToBePersisted)\r\n            {\r\n                PersistFormData(kvp.Key, kvp.Value);\r\n            }\r\n        }\r\n\r\n\r\n        private void PersistFormData(Guid instanceId, FormData formData)\r\n        {\r\n            try\r\n            {\r\n                XElement element = formData.Serialize();\r\n\r\n                string filename = GetFormDataFileName(instanceId);\r\n\r\n                XDocument doc = new XDocument(element);\r\n                doc.SaveToFile(filename);\r\n\r\n                Log.LogVerbose(LogTitle, \"FormData persisted for workflow id = \" + instanceId);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                // Stop trying serializing this workflow\r\n                AbortWorkflow(instanceId);\r\n\r\n                Log.LogCritical(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n\r\n        private void DeletePersistedWorkflow(Guid instanceId)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                _fileWorkflowPersistenceService.RemovePersistedWorkflow(instanceId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DeletePersistedFormData(Guid instanceId)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                string filename = GetFormDataFileName(instanceId);\r\n\r\n                if (C1File.Exists(filename))\r\n                {\r\n                    C1File.Delete(filename);\r\n\r\n                    Log.LogVerbose(LogTitle, $\"Persisted FormData deleted for workflow id = {instanceId}\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private string GetFormDataFileName(Guid instanceId)\r\n        {\r\n            return Path.Combine(SerializedWorkflowsDirectory, $\"{instanceId}.xml\");\r\n        }\r\n\r\n\r\n        private void DeleteOldWorkflows()\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                foreach (string filename in C1Directory.GetFiles(SerializedWorkflowsDirectory))\r\n                {\r\n                    DateTime creationTime = C1File.GetLastWriteTime(filename);\r\n\r\n                    if (DateTime.Now.Subtract(creationTime) > OldFileExistenceTimeout)\r\n                    {\r\n                        Guid instanceId = new Guid(Path.GetFileNameWithoutExtension(filename));\r\n\r\n                        if (Path.GetExtension(filename) == \"bin\")\r\n                        {\r\n                            try\r\n                            {\r\n                                WorkflowRuntime.GetWorkflow(instanceId);\r\n                                AbortWorkflow(instanceId);\r\n                            }\r\n                            catch (Exception)\r\n                            {\r\n                            }\r\n                        }\r\n\r\n                        C1File.Delete(filename);\r\n\r\n                        Log.LogVerbose(LogTitle, $\"Old workflow instance file deleted {filename}\");\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static string SerializedWorkflowsDirectory\r\n        {\r\n            get\r\n            {\r\n                string directory = PathUtil.Resolve(GlobalSettingsFacade.SerializedWorkflowsDirectory);\r\n                if (!C1Directory.Exists(directory))\r\n                {\r\n                    C1Directory.CreateDirectory(directory);\r\n                }\r\n\r\n                return directory;\r\n            }\r\n        }\r\n\r\n\r\n        private static bool ConsoleIdEquals(FlowControllerServicesContainer flowControllerServicesContainer, string consoleId)\r\n        {\r\n            var managementConsoleMessageService = flowControllerServicesContainer?.GetService<IManagementConsoleMessageService>();\r\n\r\n            if (managementConsoleMessageService == null) return false;\r\n\r\n            return managementConsoleMessageService.CurrentConsoleId == consoleId;\r\n        }\r\n\r\n\r\n\r\n        private enum WorkflowInstanceStatus\r\n        {\r\n            Idle = 0,\r\n            Running = 1,\r\n            Terminated = 2\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Resources()\r\n            {\r\n                this.WorkflowStatusDictionary = new Dictionary<Guid, WorkflowInstanceStatus>();\r\n                this.FormData = new ConcurrentDictionary<Guid, FormData>();\r\n                this.FlowControllerServicesContainers = new Dictionary<Guid, FlowControllerServicesContainer>();\r\n                this.WorkflowPersistingTypeDictionary = new Dictionary<Guid, WorkflowPersistingType>();\r\n                this.EventHandleFilters = new Dictionary<Type, IEventHandleFilter>();\r\n            }\r\n\r\n            public Dictionary<Guid, WorkflowInstanceStatus> WorkflowStatusDictionary { get; }\r\n            public ConcurrentDictionary<Guid, FormData> FormData { get; }\r\n            public Dictionary<Guid, FlowControllerServicesContainer> FlowControllerServicesContainers { get; }\r\n\r\n            public Dictionary<Guid, WorkflowPersistingType> WorkflowPersistingTypeDictionary { get; }\r\n\r\n            public Dictionary<Guid, Semaphore> WorkflowIdleWaitSemaphores { get; private set; }\r\n            public ConcurrentDictionary<int, Exception> ExceptionFromWorkflow { get; private set; }\r\n\r\n            public Dictionary<Type, IEventHandleFilter> EventHandleFilters { get; }\r\n\r\n            public static void InitializeResources(Resources resources)\r\n            {\r\n                IEnumerable<Guid> instanceIds =\r\n                    (from kvp in resources.WorkflowPersistingTypeDictionary\r\n                     where kvp.Value == WorkflowPersistingType.Never\r\n                     select kvp.Key).ToList();\r\n\r\n                foreach (Guid instanceId in instanceIds)\r\n                {\r\n                    resources.WorkflowStatusDictionary.Remove(instanceId);\r\n\t\t\t\t\tresources.FormData.TryRemove(instanceId, out _);\r\n                    resources.FlowControllerServicesContainers.Remove(instanceId);\r\n                    resources.WorkflowPersistingTypeDictionary.Remove(instanceId);\r\n                }\r\n\r\n                resources.WorkflowIdleWaitSemaphores = new Dictionary<Guid, Semaphore>();\r\n                resources.ExceptionFromWorkflow = new ConcurrentDictionary<int, Exception>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/WorkflowFlowController.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Tasks;\r\nusing Composite.C1Console.Workflow.Foundation;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    internal sealed class WorkflowFlowController : IFlowController\r\n    {\r\n        private static readonly string LogTitle = nameof (WorkflowFlowController);\r\n\r\n        public FlowControllerServicesContainer ServicesContainer { set; private get; }\r\n\r\n\r\n        public IFlowUiDefinition GetCurrentUiDefinition(FlowToken flowToken)\r\n        {\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            if (!WorkflowFacade.WorkflowExists(workflowFlowToken.WorkflowInstanceId))\r\n            {\r\n                Log.LogVerbose(LogTitle, \"The workflow with Id = {0} does not exists\", workflowFlowToken.WorkflowInstanceId);\r\n                return null;\r\n            }\r\n\r\n\r\n            using (GlobalInitializerFacade.CoreNotLockedScope)\r\n            {\r\n                Semaphore semaphore = WorkflowFacade.WaitForIdleStatus(workflowFlowToken.WorkflowInstanceId);\r\n                if (semaphore != null)\r\n                {\r\n                    Log.LogVerbose(LogTitle, \"The workflow with Id = {0} is running, waiting until its done.\", workflowFlowToken.WorkflowInstanceId);\r\n\r\n                    semaphore.WaitOne(TimeSpan.FromSeconds(10), true);\r\n\r\n                    Log.LogVerbose(LogTitle, \"Done waiting on the workflow with Id = {0}.\", workflowFlowToken.WorkflowInstanceId);\r\n                }\r\n            }\r\n\r\n\r\n            FormData formFunction = WorkflowFacade.GetFormData(workflowFlowToken.WorkflowInstanceId);\r\n            if (formFunction == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            FormFlowUiDefinition formFlowUiDefinition;\r\n            if (formFunction.FormDefinition != null)\r\n            {\r\n                formFlowUiDefinition = new FormFlowUiDefinition(\r\n                           ToXmlReader(formFunction.FormDefinition),\r\n                           formFunction.ContainerType,\r\n                           formFunction.ContainerLabel,\r\n                           formFunction.Bindings,\r\n                           formFunction.BindingsValidationRules\r\n                    );\r\n            }\r\n            else if (formFunction.FormMarkupProvider != null)\r\n            {\r\n                formFlowUiDefinition = new FormFlowUiDefinition(\r\n                           formFunction.FormMarkupProvider,\r\n                           formFunction.ContainerType,\r\n                           formFunction.ContainerLabel,\r\n                           formFunction.Bindings,\r\n                           formFunction.BindingsValidationRules\r\n                    );\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n            var markup = GetCustomToolbarMarkup(formFunction);\r\n            if (markup != null)\r\n            {\r\n                formFlowUiDefinition.SetCustomToolbarMarkupProvider(markup);\r\n            }\r\n\r\n            AddEventHandles(formFlowUiDefinition, workflowFlowToken.WorkflowInstanceId);\r\n\r\n            return formFlowUiDefinition;\r\n        }\r\n\r\n\r\n        private XmlReader GetCustomToolbarMarkup(FormData formData)\r\n        {\r\n            if (formData.CustomToolbarItems == null || formData.CustomToolbarItems.Count == 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var parts = formData.CustomToolbarItems\r\n                .OrderBy(t => t.Item3)\r\n                .Select(t => t.Item2)\r\n                .ToList();\r\n\r\n            if (parts.Count == 1) return ToXmlReader(parts[0]);\r\n\r\n            var templateDocument = XDocument.Parse(@\"<?xml version=\"\"1.0\"\" encoding=\"\"utf-8\"\"?>\r\n<cms:formdefinition xmlns=\"\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\"\" xmlns:internal=\"\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\"\" xmlns:f=\"\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\"\" xmlns:cms=\"\"http://www.composite.net/ns/management/bindingforms/1.0\"\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <PlaceHolder>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>\");\r\n\r\n            XElement bindings = GetBindingsElement(templateDocument);\r\n            XElement layout = GetLayoutOrPlaceholderElement(templateDocument);\r\n\r\n            foreach (var part in parts)\r\n            {\r\n                bindings.Add(GetBindingsElement(part).Elements());\r\n                layout.Add(GetLayoutOrPlaceholderElement(part).Elements());\r\n            }\r\n\r\n            return ToXmlReader(templateDocument);\r\n        }\r\n\r\n        private XElement GetBindingsElement(XDocument templateDocument)\r\n        {\r\n            return templateDocument.Descendants().FirstOrDefault(d => d.Name.LocalName == \"bindings\");\r\n        }\r\n\r\n        private XElement GetLayoutOrPlaceholderElement(XDocument doc)\r\n        {\r\n            var layoutElement = doc.Descendants().FirstOrDefault(d => d.Name.LocalName == \"layout\");\r\n            Verify.IsNotNull(layoutElement, \"Failed to find 'layout' element\");\r\n            var firstElement = layoutElement.Elements().FirstOrDefault();\r\n            if (firstElement != null && firstElement.Name.LocalName == \"PlaceHolder\")\r\n            {\r\n                return firstElement;\r\n            }\r\n\r\n            return layoutElement;\r\n        }\r\n\r\n        private XmlReader ToXmlReader(XDocument document) => ToXmlReader(document.ToString());\r\n\r\n        private XmlReader ToXmlReader(string str) => new XmlTextReader(new StringReader(str));\r\n\r\n\r\n        public void CancelFlow(FlowToken flowToken)\r\n        {\r\n            OnCancel(flowToken, null, null);\r\n        }\r\n\r\n\r\n\r\n        private static void AddEventHandles(FormFlowUiDefinition formFlowUiDefinition, Guid instanceId)\r\n        {\r\n            IEnumerable<string> eventNames = WorkflowFacade.GetCurrentFormEvents(instanceId);\r\n\r\n            FormData formData = WorkflowFacade.GetFormData(instanceId);\r\n\r\n            foreach (string eventName in eventNames)\r\n            {\r\n                if (formData?.ExcludedEvents != null && formData.ExcludedEvents.Contains(eventName)) continue;\r\n\r\n                switch (eventName)\r\n                {\r\n                    case \"Save\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.Save, OnSave);\r\n                        break;\r\n\r\n                    case \"SaveAndPublish\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.SaveAndPublish, OnSaveAndPublish);\r\n                        break;\r\n\r\n                    case \"Next\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.Next, OnNext);\r\n                        break;\r\n\r\n                    case \"Previous\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.Previous, OnPrevious);\r\n                        break;\r\n\r\n                    case \"Finish\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.Finish, OnFinish);\r\n                        break;\r\n\r\n                    case \"Cancel\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.Cancel, OnCancel);\r\n                        break;\r\n\r\n                    case \"Preview\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.Preview, OnPreview);\r\n                        break;\r\n\r\n                    case \"CustomEvent01\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.CustomEvent01, OnCustomEvent01);\r\n                        break;\r\n\r\n                    case \"CustomEvent02\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.CustomEvent02, OnCustomEvent02);\r\n                        break;\r\n\r\n                    case \"CustomEvent03\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.CustomEvent03, OnCustomEvent03);\r\n                        break;\r\n\r\n                    case \"CustomEvent04\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.CustomEvent04, OnCustomEvent04);\r\n                        break;\r\n\r\n                    case \"CustomEvent05\":\r\n                        formFlowUiDefinition.EventHandlers.Add(StandardEventIdentifiers.CustomEvent05, OnCustomEvent05);\r\n                        break;\r\n                }\r\n            }\r\n\r\n            IEventHandleFilter eventHandlerFilter = WorkflowFacade.GetEventHandleFilter(instanceId);\r\n            eventHandlerFilter?.Filter(formFlowUiDefinition.EventHandlers);\r\n        }\r\n\r\n\r\n\r\n        private static void OnSave(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            using (TaskContainer taskContainer = TaskManagerFacade.RuntTasks(flowToken, new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId) { EventName = \"Save\" }))\r\n            {\r\n                TaskManagerFlowControllerService taskManagerFlowControllerService = new TaskManagerFlowControllerService(taskContainer);\r\n                serviceContainer.AddService(taskManagerFlowControllerService);\r\n\r\n                WorkflowFacade.FireSaveEvent(workflowFlowToken.WorkflowInstanceId, bindings);\r\n                WorkflowFacade.SetFlowControllerServicesContainer(workflowFlowToken.WorkflowInstanceId, serviceContainer);\r\n                WorkflowFacade.RunWorkflow(workflowFlowToken.WorkflowInstanceId);\r\n                taskContainer.SetOnIdleTaskManagerEvent(new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId));\r\n\r\n                serviceContainer.RemoveService(taskManagerFlowControllerService);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnSaveAndPublish(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            using (TaskContainer taskContainer = TaskManagerFacade.RuntTasks(flowToken, new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId) { EventName = \"Save\" }))\r\n            {\r\n                TaskManagerFlowControllerService taskManagerFlowControllerService = new TaskManagerFlowControllerService(taskContainer);\r\n                serviceContainer.AddService(taskManagerFlowControllerService);\r\n\r\n                WorkflowFacade.FireSaveAndPublishEvent(workflowFlowToken.WorkflowInstanceId, bindings);\r\n                WorkflowFacade.SetFlowControllerServicesContainer(workflowFlowToken.WorkflowInstanceId, serviceContainer);\r\n                WorkflowFacade.RunWorkflow(workflowFlowToken.WorkflowInstanceId);\r\n                taskContainer.SetOnIdleTaskManagerEvent(new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId));\r\n\r\n                serviceContainer.RemoveService(taskManagerFlowControllerService);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnNext(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            using (TaskContainer taskContainer = TaskManagerFacade.RuntTasks(flowToken, new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId) { EventName = \"Next\" }))\r\n            {\r\n                WorkflowFacade.FireNextEvent(workflowFlowToken.WorkflowInstanceId, bindings);\r\n                WorkflowFacade.SetFlowControllerServicesContainer(workflowFlowToken.WorkflowInstanceId, serviceContainer);\r\n                WorkflowFacade.RunWorkflow(workflowFlowToken.WorkflowInstanceId);\r\n                taskContainer.SetOnIdleTaskManagerEvent(new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId));\r\n            }\r\n\r\n            IFormFlowRenderingService formServices = serviceContainer.GetService<IFormFlowRenderingService>();\r\n\r\n            if (!formServices.HasFieldMessages)\r\n            {\r\n                serviceContainer.GetService<IFormFlowRenderingService>().RerenderView();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnPrevious(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            using (TaskContainer taskContainer = TaskManagerFacade.RuntTasks(flowToken, new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId) { EventName = \"Previous\" }))\r\n            {\r\n                WorkflowFacade.FirePreviousEvent(workflowFlowToken.WorkflowInstanceId, bindings);\r\n                WorkflowFacade.SetFlowControllerServicesContainer(workflowFlowToken.WorkflowInstanceId, serviceContainer);\r\n                WorkflowFacade.RunWorkflow(workflowFlowToken.WorkflowInstanceId);\r\n                taskContainer.SetOnIdleTaskManagerEvent(new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId));\r\n            }\r\n\r\n            serviceContainer.GetService<IFormFlowRenderingService>().RerenderView();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFinish(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            using (TaskContainer taskContainer = TaskManagerFacade.RuntTasks(flowToken, new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId) { EventName = \"Finish\" }))\r\n            {\r\n                TaskManagerFlowControllerService taskManagerFlowControllerService = new TaskManagerFlowControllerService(taskContainer);\r\n                serviceContainer.AddService(taskManagerFlowControllerService);\r\n\r\n                WorkflowFacade.FireFinishEvent(workflowFlowToken.WorkflowInstanceId, bindings);\r\n                WorkflowFacade.SetFlowControllerServicesContainer(workflowFlowToken.WorkflowInstanceId, serviceContainer);\r\n                WorkflowFacade.RunWorkflow(workflowFlowToken.WorkflowInstanceId);\r\n                taskContainer.SetOnIdleTaskManagerEvent(new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId));\r\n            }\r\n\r\n\r\n            IFormFlowRenderingService formServices = serviceContainer.GetService<IFormFlowRenderingService>();\r\n\r\n            if (!formServices.HasFieldMessages)\r\n            {\r\n                serviceContainer.GetService<IFormFlowRenderingService>().RerenderView();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnCancel(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            if (WorkflowFacade.WorkflowExists(workflowFlowToken.WorkflowInstanceId))\r\n            {\r\n                using (TaskManagerFacade.RuntTasks(flowToken, new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId) { EventName = \"Cancel\" }))\r\n                {\r\n                    WorkflowFacade.FireCancelEvent(workflowFlowToken.WorkflowInstanceId, bindings);\r\n                    WorkflowFacade.SetFlowControllerServicesContainer(workflowFlowToken.WorkflowInstanceId, serviceContainer);\r\n                    WorkflowFacade.RunWorkflow(workflowFlowToken.WorkflowInstanceId);                    \r\n                }\r\n            }\r\n            else\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Cancel event suppressed because the workflow was terminated ({0})\", workflowFlowToken.WorkflowInstanceId);\r\n            }\r\n\r\n            serviceContainer?.GetService<IFormFlowRenderingService>().RerenderView();\r\n        }\r\n\r\n\r\n\r\n        private static void OnPreview(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            using (TaskContainer taskContainer = TaskManagerFacade.RuntTasks(flowToken, new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId) { EventName = \"Preview\" }))\r\n            {\r\n                WorkflowFacade.FirePreviewEvent(workflowFlowToken.WorkflowInstanceId, bindings);\r\n                WorkflowFacade.SetFlowControllerServicesContainer(workflowFlowToken.WorkflowInstanceId, serviceContainer);\r\n                WorkflowFacade.RunWorkflow(workflowFlowToken.WorkflowInstanceId);\r\n                taskContainer.SetOnIdleTaskManagerEvent(new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnCustomEvent01(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            OnCustomEvent(1, flowToken, bindings, serviceContainer);\r\n        }\r\n\r\n\r\n\r\n        private static void OnCustomEvent02(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            OnCustomEvent(2, flowToken, bindings, serviceContainer);\r\n        }\r\n\r\n\r\n\r\n        private static void OnCustomEvent03(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            OnCustomEvent(3, flowToken, bindings, serviceContainer);\r\n        }\r\n\r\n\r\n\r\n        private static void OnCustomEvent04(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            OnCustomEvent(4, flowToken, bindings, serviceContainer);\r\n        }\r\n\r\n\r\n\r\n        private static void OnCustomEvent05(FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            OnCustomEvent(5, flowToken, bindings, serviceContainer);\r\n        }\r\n\r\n\r\n\r\n        private static void OnCustomEvent(int customEventNumber, FlowToken flowToken, Dictionary<string, object> bindings, FlowControllerServicesContainer serviceContainer)\r\n        {\r\n            if (customEventNumber < 1 || customEventNumber > 5) throw new ArgumentException(\"Number must be between 1 and 5\", nameof(customEventNumber));\r\n\r\n            WorkflowFlowToken workflowFlowToken = (WorkflowFlowToken)flowToken;\r\n\r\n            using (TaskContainer taskContainer = TaskManagerFacade.RuntTasks(flowToken, new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId) { EventName = \"CustomEvent0\" + customEventNumber }))\r\n            {\r\n                WorkflowFacade.FireCustomEvent(customEventNumber, workflowFlowToken.WorkflowInstanceId, bindings);\r\n                WorkflowFacade.SetFlowControllerServicesContainer(workflowFlowToken.WorkflowInstanceId, serviceContainer);\r\n                WorkflowFacade.RunWorkflow(workflowFlowToken.WorkflowInstanceId);\r\n                taskContainer.SetOnIdleTaskManagerEvent(new WorkflowTaskManagerEvent(flowToken, workflowFlowToken.WorkflowInstanceId));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/WorkflowFlowToken.cs",
    "content": "using System;\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [FlowController(typeof(WorkflowFlowController))]\r\n    public sealed class WorkflowFlowToken : FlowToken\r\n    {\r\n        private Guid _workflowInstanceId;\r\n\r\n\r\n        /// <exclude />\r\n        public WorkflowFlowToken(Guid workflowInstanceId)\r\n        {\r\n            _workflowInstanceId = workflowInstanceId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Guid WorkflowInstanceId\r\n        {\r\n            get { return _workflowInstanceId; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return _workflowInstanceId.ToString();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static FlowToken Deserialize(string serializedFlowToken)\r\n        {\r\n            return new WorkflowFlowToken(new Guid(serializedFlowToken));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/C1Console/Workflow/WorkflowTaskManagerEvent.cs",
    "content": "﻿using Composite.C1Console.Tasks;\r\nusing System;\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.C1Console.Workflow\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class WorkflowTaskManagerEvent : FlowTaskManagerEvent\r\n    {\r\n        /// <exclude />\r\n        public WorkflowTaskManagerEvent(FlowToken flowToken, Guid workflowInstanceId)\r\n            : base(flowToken)\r\n        {\r\n            this.WorkflowInstanceId = workflowInstanceId;\r\n            this.EventName = \"\";\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string EventName { get; set ;}\r\n\r\n\r\n        /// <exclude />\r\n        public Guid WorkflowInstanceId { get; private set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class WorkflowCreationTaskManagerEvent : TaskManagerEvent\r\n    {\r\n        /// <exclude />\r\n        public WorkflowCreationTaskManagerEvent(Guid parentWorkflowInstanceId)\r\n        {\r\n            this.ParentWorkflowInstanceId = parentWorkflowInstanceId;\r\n        }\r\n\r\n        /// <exclude />\r\n        public Guid ParentWorkflowInstanceId { get; private set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class SaveWorklowTaskManagerEvent : WorkflowTaskManagerEvent\r\n    {\r\n        /// <exclude />\r\n        public SaveWorklowTaskManagerEvent(FlowToken flowToken, Guid workflowInstanceId, bool succeeded)\r\n            : base(flowToken, workflowInstanceId)\r\n        {\r\n            this.Succeeded = succeeded;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Succeeded { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return string.Format(\"WorkflowInstanceId: {0}, SaveStaus: {1}\", this.WorkflowInstanceId, this.Succeeded);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Composite.FxCop",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<FxCopProject Version=\"1.36\" Name=\"My FxCop Project\">\r\n <ProjectOptions>\r\n  <SharedProject>True</SharedProject>\r\n  <Stylesheet Apply=\"False\">c:\\program files\\microsoft fxcop 1.36\\Xml\\FxCopReport.xsl</Stylesheet>\r\n  <SaveMessages>\r\n   <Project Status=\"None\" NewOnly=\"False\" />\r\n   <Report Status=\"Active\" NewOnly=\"False\" />\r\n  </SaveMessages>\r\n  <ProjectFile Compress=\"True\" DefaultTargetCheck=\"True\" DefaultRuleCheck=\"True\" SaveByRuleGroup=\"\" Deterministic=\"True\" />\r\n  <EnableMultithreadedLoad>True</EnableMultithreadedLoad>\r\n  <EnableMultithreadedAnalysis>True</EnableMultithreadedAnalysis>\r\n  <SourceLookup>True</SourceLookup>\r\n  <AnalysisExceptionsThreshold>10</AnalysisExceptionsThreshold>\r\n  <RuleExceptionsThreshold>1</RuleExceptionsThreshold>\r\n  <Spelling Locale=\"en-US\" />\r\n  <OverrideRuleVisibilities>False</OverrideRuleVisibilities>\r\n  <CustomDictionaries SearchFxCopDir=\"True\" SearchUserProfile=\"True\" SearchProjectDir=\"True\" />\r\n  <SearchGlobalAssemblyCache>False</SearchGlobalAssemblyCache>\r\n  <DeadlockDetectionTimeout>120</DeadlockDetectionTimeout>\r\n  <IgnoreGeneratedCode>False</IgnoreGeneratedCode>\r\n </ProjectOptions>\r\n <Targets>\r\n  <AssemblyReferenceDirectories>\r\n    <Directory>C:/Windows/Microsoft.NET/Framework/v2.0.50727/</Directory>\r\n  </AssemblyReferenceDirectories>\r\n  <Target Name=\"$(ProjectDir)/bin/Debug/Composite.dll\" Analyze=\"True\" AnalyzeAllChildren=\"False\">\r\n   <Modules AnalyzeAllChildren=\"False\">\r\n    <Module Name=\"composite.dll\" Analyze=\"False\" AnalyzeAllChildren=\"False\">\r\n     <Namespaces AnalyzeAllChildren=\"False\">\r\n      <Namespace Name=\"Composite.Core\" Analyze=\"False\" AnalyzeAllChildren=\"False\">\r\n       <Types AnalyzeAllChildren=\"False\">\r\n        <Type Name=\"Log\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n       </Types>\r\n      </Namespace>\r\n      <Namespace Name=\"Composite.Core.Implementation\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n      <Namespace Name=\"Composite.Data\" Analyze=\"False\" AnalyzeAllChildren=\"False\">\r\n       <Types AnalyzeAllChildren=\"False\">\r\n        <Type Name=\"DataConnection\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n        <Type Name=\"DataEventArgs\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n        <Type Name=\"DataEventHandler\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n        <Type Name=\"DataEvents`1\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n        <Type Name=\"PageNode\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n        <Type Name=\"PublicationScope\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n        <Type Name=\"SitemapNavigator\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n        <Type Name=\"SitemapScope\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n       </Types>\r\n      </Namespace>\r\n      <Namespace Name=\"Composite.Data.Types\" Analyze=\"False\" AnalyzeAllChildren=\"False\">\r\n       <Types AnalyzeAllChildren=\"False\">\r\n        <Type Name=\"IPage\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n       </Types>\r\n      </Namespace>\r\n      <Namespace Name=\"Composite.Functions\" Analyze=\"False\" AnalyzeAllChildren=\"False\">\r\n       <Types AnalyzeAllChildren=\"False\">\r\n        <Type Name=\"FunctionParameterDescriptionAttribute\" Analyze=\"True\" AnalyzeAllChildren=\"True\" />\r\n       </Types>\r\n      </Namespace>\r\n     </Namespaces>\r\n     <Resources AnalyzeAllChildren=\"True\" />\r\n    </Module>\r\n   </Modules>\r\n  </Target>\r\n </Targets>\r\n <Rules>\r\n  <RuleFiles>\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\DesignRules.dll\" Enabled=\"True\" AllRulesEnabled=\"False\">\r\n    <Rule Name=\"AbstractTypesShouldNotHaveConstructors\" Enabled=\"True\" />\r\n    <Rule Name=\"AssembliesShouldHaveValidStrongNames\" Enabled=\"True\" />\r\n    <Rule Name=\"AvoidEmptyInterfaces\" Enabled=\"True\" />\r\n    <Rule Name=\"AvoidExcessiveParametersOnGenericTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"AvoidNamespacesWithFewTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"AvoidOutParameters\" Enabled=\"True\" />\r\n    <Rule Name=\"CollectionsShouldImplementGenericInterface\" Enabled=\"True\" />\r\n    <Rule Name=\"ConsiderPassingBaseTypesAsParameters\" Enabled=\"True\" />\r\n    <Rule Name=\"DeclareEventHandlersCorrectly\" Enabled=\"True\" />\r\n    <Rule Name=\"DeclareTypesInNamespaces\" Enabled=\"True\" />\r\n    <Rule Name=\"DefaultParametersShouldNotBeUsed\" Enabled=\"True\" />\r\n    <Rule Name=\"DefineAccessorsForAttributeArguments\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotCatchGeneralExceptionTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotDeclareProtectedMembersInSealedTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotDeclareStaticMembersOnGenericTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotDeclareVirtualMembersInSealedTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotDeclareVisibleInstanceFields\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotExposeGenericLists\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotHideBaseClassMethods\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotNestGenericTypesInMemberSignatures\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotOverloadOperatorEqualsOnReferenceTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotPassTypesByReference\" Enabled=\"True\" />\r\n    <Rule Name=\"DoNotRaiseExceptionsInUnexpectedLocations\" Enabled=\"True\" />\r\n    <Rule Name=\"EnumeratorsShouldBeStronglyTyped\" Enabled=\"True\" />\r\n    <Rule Name=\"EnumsShouldHaveZeroValue\" Enabled=\"True\" />\r\n    <Rule Name=\"EnumStorageShouldBeInt32\" Enabled=\"True\" />\r\n    <Rule Name=\"ExceptionsShouldBePublic\" Enabled=\"True\" />\r\n    <Rule Name=\"ICollectionImplementationsHaveStronglyTypedMembers\" Enabled=\"True\" />\r\n    <Rule Name=\"ImplementIDisposableCorrectly\" Enabled=\"True\" />\r\n    <Rule Name=\"ImplementStandardExceptionConstructors\" Enabled=\"True\" />\r\n    <Rule Name=\"IndexersShouldNotBeMultidimensional\" Enabled=\"True\" />\r\n    <Rule Name=\"InterfaceMethodsShouldBeCallableByChildTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"ListsAreStronglyTyped\" Enabled=\"True\" />\r\n    <Rule Name=\"MarkAssembliesWithAssemblyVersion\" Enabled=\"True\" />\r\n    <Rule Name=\"MarkAssembliesWithClsCompliant\" Enabled=\"True\" />\r\n    <Rule Name=\"MarkAssembliesWithComVisible\" Enabled=\"True\" />\r\n    <Rule Name=\"MarkAttributesWithAttributeUsage\" Enabled=\"True\" />\r\n    <Rule Name=\"MarkEnumsWithFlags\" Enabled=\"True\" />\r\n    <Rule Name=\"MembersShouldNotExposeCertainConcreteTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"MovePInvokesToNativeMethodsClass\" Enabled=\"True\" />\r\n    <Rule Name=\"NestedTypesShouldNotBeVisible\" Enabled=\"True\" />\r\n    <Rule Name=\"OverloadOperatorEqualsOnOverloadingAddAndSubtract\" Enabled=\"True\" />\r\n    <Rule Name=\"OverrideMethodsOnComparableTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"PropertiesShouldNotBeWriteOnly\" Enabled=\"True\" />\r\n    <Rule Name=\"ProvideObsoleteAttributeMessage\" Enabled=\"True\" />\r\n    <Rule Name=\"ReplaceRepetitiveArgumentsWithParamsArray\" Enabled=\"True\" />\r\n    <Rule Name=\"StaticHolderTypesShouldBeSealed\" Enabled=\"True\" />\r\n    <Rule Name=\"StaticHolderTypesShouldNotHaveConstructors\" Enabled=\"True\" />\r\n    <Rule Name=\"StringUriOverloadsCallSystemUriOverloads\" Enabled=\"True\" />\r\n    <Rule Name=\"TypesShouldNotExtendCertainBaseTypes\" Enabled=\"True\" />\r\n    <Rule Name=\"TypesThatOwnDisposableFieldsShouldBeDisposable\" Enabled=\"True\" />\r\n    <Rule Name=\"TypesThatOwnNativeResourcesShouldBeDisposable\" Enabled=\"True\" />\r\n    <Rule Name=\"UriParametersShouldNotBeStrings\" Enabled=\"True\" />\r\n    <Rule Name=\"UriPropertiesShouldNotBeStrings\" Enabled=\"True\" />\r\n    <Rule Name=\"UriReturnValuesShouldNotBeStrings\" Enabled=\"True\" />\r\n    <Rule Name=\"UseEventsWhereAppropriate\" Enabled=\"True\" />\r\n    <Rule Name=\"UseGenericEventHandlerInstances\" Enabled=\"True\" />\r\n    <Rule Name=\"UseGenericsWhereAppropriate\" Enabled=\"True\" />\r\n    <Rule Name=\"UseIntegralOrStringArgumentForIndexers\" Enabled=\"True\" />\r\n    <Rule Name=\"UsePropertiesWhereAppropriate\" Enabled=\"True\" />\r\n   </RuleFile>\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\GlobalizationRules.dll\" Enabled=\"True\" AllRulesEnabled=\"True\" />\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\InteroperabilityRules.dll\" Enabled=\"True\" AllRulesEnabled=\"True\" />\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\MobilityRules.dll\" Enabled=\"True\" AllRulesEnabled=\"True\" />\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\NamingRules.dll\" Enabled=\"True\" AllRulesEnabled=\"True\" />\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\PerformanceRules.dll\" Enabled=\"True\" AllRulesEnabled=\"True\" />\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\PortabilityRules.dll\" Enabled=\"True\" AllRulesEnabled=\"True\" />\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\SecurityRules.dll\" Enabled=\"True\" AllRulesEnabled=\"True\" />\r\n   <RuleFile Name=\"$(FxCopDir)\\Rules\\UsageRules.dll\" Enabled=\"True\" AllRulesEnabled=\"True\" />\r\n  </RuleFiles>\r\n  <Groups />\r\n  <Settings />\r\n </Rules>\r\n <FxCopReport Version=\"1.36\" />\r\n</FxCopProject>\r\n"
  },
  {
    "path": "Composite/Composite.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\r\n    <ProductVersion>9.0.30729</ProductVersion>\r\n    <SchemaVersion>2.0</SchemaVersion>\r\n    <ProjectGuid>{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}</ProjectGuid>\r\n    <OutputType>Library</OutputType>\r\n    <RootNamespace>Composite</RootNamespace>\r\n    <AssemblyName>Composite</AssemblyName>\r\n    <ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\r\n    <WarningLevel>4</WarningLevel>\r\n    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>\r\n    <SccProjectName>SAK</SccProjectName>\r\n    <SccLocalPath>SAK</SccLocalPath>\r\n    <SccAuxPath>SAK</SccAuxPath>\r\n    <SccProvider>SAK</SccProvider>\r\n    <FileUpgradeFlags>\r\n    </FileUpgradeFlags>\r\n    <OldToolsVersion>3.5</OldToolsVersion>\r\n    <UpgradeBackupLocation />\r\n    <IsWebBootstrapper>false</IsWebBootstrapper>\r\n    <PublishUrl>publish\\</PublishUrl>\r\n    <Install>true</Install>\r\n    <InstallFrom>Disk</InstallFrom>\r\n    <UpdateEnabled>false</UpdateEnabled>\r\n    <UpdateMode>Foreground</UpdateMode>\r\n    <UpdateInterval>7</UpdateInterval>\r\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\r\n    <UpdatePeriodically>false</UpdatePeriodically>\r\n    <UpdateRequired>false</UpdateRequired>\r\n    <MapFileExtensions>true</MapFileExtensions>\r\n    <ApplicationRevision>0</ApplicationRevision>\r\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\r\n    <UseApplicationTrust>false</UseApplicationTrust>\r\n    <BootstrapperEnabled>true</BootstrapperEnabled>\r\n    <TargetFrameworkProfile />\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>false</Optimize>\r\n    <OutputPath>bin\\Debug\\</OutputPath>\r\n    <DefineConstants>TRACE;DEBUG</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <CodeAnalysisRules>\r\n    </CodeAnalysisRules>\r\n    <RunCodeAnalysis>false</RunCodeAnalysis>\r\n    <DocumentationFile>bin\\Debug\\Composite.xml</DocumentationFile>\r\n    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>\r\n    <NoWarn>618</NoWarn>\r\n    <Prefer32Bit>false</Prefer32Bit>\r\n    <LangVersion>7</LangVersion>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\r\n    <DebugType>pdbonly</DebugType>\r\n    <Optimize>true</Optimize>\r\n    <OutputPath>bin\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <CodeAnalysisRules>\r\n    </CodeAnalysisRules>\r\n    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>\r\n    <DocumentationFile>bin\\Release\\Composite.XML</DocumentationFile>\r\n    <Prefer32Bit>false</Prefer32Bit>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Castle.Core.4.2.1\\lib\\net45\\Castle.Core.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.CSharp\" />\r\n    <Reference Include=\"Microsoft.Extensions.DependencyInjection, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.Extensions.DependencyInjection.1.1.0\\lib\\netstandard1.1\\Microsoft.Extensions.DependencyInjection.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.Extensions.DependencyInjection.Abstractions.1.1.0\\lib\\netstandard1.0\\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Common, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Common.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Logging.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Validation, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Validation.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.ObjectBuilder, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.ObjectBuilder.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Newtonsoft.Json.6.0.5\\lib\\net45\\Newtonsoft.Json.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Collections.Immutable.1.3.1\\lib\\portable-net45+win8+wp8+wpa81\\System.Collections.Immutable.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.configuration\" />\r\n    <Reference Include=\"System.Configuration.Install\" />\r\n    <Reference Include=\"System.Core\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Data\" />\r\n    <Reference Include=\"System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Diagnostics.DiagnosticSource.4.3.0\\lib\\net46\\System.Diagnostics.DiagnosticSource.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Drawing\" />\r\n    <Reference Include=\"System.EnterpriseServices\" />\r\n    <Reference Include=\"System.IO.Compression\" />\r\n    <Reference Include=\"System.Management\" />\r\n    <Reference Include=\"System.Net\" />\r\n    <Reference Include=\"System.Reactive.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Reactive.Core.3.0.0\\lib\\net46\\System.Reactive.Core.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Reactive.Interfaces, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Reactive.Interfaces.3.0.0\\lib\\net45\\System.Reactive.Interfaces.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Reactive.Linq, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Reactive.Linq.3.0.0\\lib\\net46\\System.Reactive.Linq.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Reactive.PlatformServices, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Reactive.PlatformServices.3.0.0\\lib\\net46\\System.Reactive.PlatformServices.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Reactive.Windows.Threading, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Reactive.Windows.Threading.3.0.0\\lib\\net45\\System.Reactive.Windows.Threading.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Runtime.Caching\" />\r\n    <Reference Include=\"System.Runtime.Serialization\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Security\" />\r\n    <Reference Include=\"System.ServiceModel.Activation\" />\r\n    <Reference Include=\"System.ServiceModel.Web\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Threading.Tasks.Dataflow, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Threading.Tasks.Dataflow.4.7.0\\lib\\portable-net45+win8+wpa81\\System.Threading.Tasks.Dataflow.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"System.Transactions\" />\r\n    <Reference Include=\"System.ValueTuple\">\r\n      <HintPath>..\\packages\\System.ValueTuple.4.4.0\\lib\\net47\\System.ValueTuple.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.Extensions\" />\r\n    <Reference Include=\"System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.Razor.3.2.3\\lib\\net45\\System.Web.Razor.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.Services\">\r\n      <Private>False</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.3.2.3\\lib\\net45\\System.Web.WebPages.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.3.2.3\\lib\\net45\\System.Web.WebPages.Razor.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Workflow.Activities\" />\r\n    <Reference Include=\"System.Workflow.ComponentModel\" />\r\n    <Reference Include=\"System.Workflow.Runtime\" />\r\n    <Reference Include=\"System.WorkflowServices\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.ServiceModel\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Data.Linq\" />\r\n    <Reference Include=\"System.Web\">\r\n      <Private>False</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.XML\" />\r\n    <Reference Include=\"System.Xml.Linq\" />\r\n    <Reference Include=\"TidyNet\">\r\n      <HintPath>..\\bin\\TidyNet.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"WampSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\WampSharp.18.3.1\\lib\\net45\\WampSharp.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"WampSharp.AspNet.WebSockets.Server, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\WampSharp.AspNet.WebSockets.Server.18.3.1\\lib\\net45\\WampSharp.AspNet.WebSockets.Server.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"WampSharp.NewtonsoftJson, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\WampSharp.NewtonsoftJson.18.3.1\\lib\\net45\\WampSharp.NewtonsoftJson.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"WampSharp.WebSockets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\WampSharp.WebSockets.18.3.1\\lib\\net45\\WampSharp.WebSockets.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"WindowsBase\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"AspNet\\WebObjectActivator.cs\" />\r\n    <Compile Include=\"AspNet\\CmsPagesSiteMapPlugin.cs\" />\r\n    <Compile Include=\"AspNet\\CmsPageSiteMapProvider.cs\" />\r\n    <Compile Include=\"AspNet\\ICmsSiteMapNode.cs\" />\r\n    <Compile Include=\"AspNet\\ICmsSiteMapProvider.cs\" />\r\n    <Compile Include=\"AspNet\\ISchemaOrgSiteMapNode.cs\" />\r\n    <Compile Include=\"AspNet\\ISiteMapPlugin.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\NoHttpRazorResponse.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\RazorFunction.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\RazorHelper.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\RazorPageTemplate.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\CompositeC1WebPage.cs\" />\r\n    <Compile Include=\"AspNet\\CmsPageSiteMapNode.cs\" />\r\n    <Compile Include=\"AspNet\\SiteMapContext.cs\" />\r\n    <Compile Include=\"AspNet\\SiteMapHandler.cs\" />\r\n    <Compile Include=\"AspNet\\SiteMapNodeChangeFrequency.cs\" />\r\n    <Compile Include=\"AspNet\\UserControlFunction.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Actions\\Data\\ActionIdentifier.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Data\\DataActionTokenRegisterHandler.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Data\\DataActionTokenResolver.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Data\\DataActionTokenResolverFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Data\\DataActionTokenResolverRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\DuplicateActionToken.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\TreeSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\RichContent\\Components\\Component.cs\" />\r\n    <Compile Include=\"C1Console\\RichContent\\Components\\ComponentChangeNotifier.cs\" />\r\n    <Compile Include=\"C1Console\\RichContent\\Components\\ComponentManager.cs\" />\r\n    <Compile Include=\"C1Console\\RichContent\\Components\\IComponentProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\ITestAutomationLocatorInformation.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\DialogStrings.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Compatibility\\LegacySerializedEntityTokenUpgrader.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\ILoginSessionStoreRedirectedLogout.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\INoneConfigurationBasedLoginSessionStore.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\Runtime\\LoginSessionStoreResolver.cs\" />\r\n    <Compile Include=\"C1Console\\RichContent\\ContainerClasses\\AntonymContainerClassManager.cs\" />\r\n    <Compile Include=\"C1Console\\RichContent\\ContainerClasses\\ContainerClassManager.cs\" />\r\n    <Compile Include=\"C1Console\\RichContent\\ContainerClasses\\EqualOrAntonymComparer.cs\" />\r\n    <Compile Include=\"Core\\EmptyDisposable.cs\" />\r\n    <Compile Include=\"Core\\HashingHelper.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\StatelessDataConnectionImplementation.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\DisposableResourceTracer.cs\" />\r\n    <Compile Include=\"AspNet\\Caching\\DonutCacheEntry.cs\" />\r\n    <Compile Include=\"AspNet\\Caching\\OutputCacheHelper.cs\" />\r\n    <Compile Include=\"AspNet\\CmsPageHttpHandler.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\CompositeJsonSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\CompositeSerializationBinder.cs\" />\r\n    <Compile Include=\"Core\\Types\\CSharpCodeProviderFactory.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Media\\DefaultImageFileFormatProvider.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Media\\IImageFileFormatProvider.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Media\\ImageFormatProviders.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\PageStructureRpc.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\PagePreviewContext.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\IPageContentFilter.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\INonCachebleRequestHostnameMapper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\WampRouteWrapper.cs\" />\r\n    <Compile Include=\"Data\\Caching\\CachedTable.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserGroupActiveLocale.cs\" />\r\n    <Compile Include=\"Data\\Types\\VersionedDataHelperContract.cs\" />\r\n    <Compile Include=\"Functions\\IDynamicFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\PageSearchToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\UrlToEntityToken\\WebsiteFileUrlToEntityTokenMapper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\UrlToEntityToken\\MediaUrlToEntityTokenMapper.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedTreelSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\CodeBasedFunctionProvider\\CodeBasedFunctionEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\CodeBasedFunctionProvider\\CodeBasedFunctionProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\CodeBasedFunctionProvider\\CodeBasedFunctionRegistry.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\CodeBasedFunctionProvider\\CodeBasedFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\DataReference\\HomePageSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\DataReference\\PageReferenceSelectorWidgetFunctionBase.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\TreeSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\HierarchicalSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\SystemDiagnosticsTrace\\SystemDiagnosticsTraceBridge.cs\" />\r\n    <Compile Include=\"Properties\\GitCommitInfo.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\DataFieldProcessors\\DateTimeDataFieldProcessor.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\DataFieldProcessors\\FileNameDataFieldProcessor.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\DataFieldProcessors\\MediaTagsDataFieldProcessor.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\DataFieldProcessors\\MimeTypeDataFieldProcessor.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\DataFieldProcessors\\PublicationStatusDataFieldProcessor.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\DocumentFieldNames.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\EntityTokenSecurityHelper.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\IDocumentFieldProvider.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\ISearchDocumentBuilderExtension.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\IDataFieldProcessorProvider.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\SearchDocumentBuilder.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\DefaultDataFieldProcessor.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\IDataFieldProcessor.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\XhtmlCrawlingHelper.cs\" />\r\n    <Compile Include=\"Search\\DocumentField.cs\" />\r\n    <Compile Include=\"Search\\Crawling\\DataTypeSearchReflectionHelper.cs\" />\r\n    <Compile Include=\"Search\\DocumentSources\\BuiltInTypesDocumentSourceProvider.cs\" />\r\n    <Compile Include=\"Search\\DocumentSources\\DataChangesIndexNotifier.cs\" />\r\n    <Compile Include=\"Search\\DocumentSources\\DataTypeDocumentSource.cs\" />\r\n    <Compile Include=\"Search\\DocumentSources\\DataTypesDocumentSourceProvider.cs\" />\r\n    <Compile Include=\"Search\\DocumentSources\\IndexUpdateActionContainer.cs\" />\r\n    <Compile Include=\"Search\\DocumentSources\\MediaLibraryDocumentSource.cs\" />\r\n    <Compile Include=\"Search\\DocumentSources\\CmsPageDocumentSource.cs\" />\r\n    <Compile Include=\"Search\\IDocumentSourceListener.cs\" />\r\n    <Compile Include=\"Search\\ISearchIndexUpdater.cs\" />\r\n    <Compile Include=\"Search\\ISearchDocumentSource.cs\" />\r\n    <Compile Include=\"Search\\ISearchDocumentSourceProvider.cs\" />\r\n    <Compile Include=\"Search\\ISearchProvider.cs\" />\r\n    <Compile Include=\"Search\\SearchDocument.cs\" />\r\n    <Compile Include=\"Search\\SearchFacade.cs\" />\r\n    <Compile Include=\"Search\\SearchQuery.cs\" />\r\n    <Compile Include=\"Search\\SearchResult.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\GenericDuplicateDataActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\IServiceUrlToEntityTokenMapper.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\OpenSlideViewQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\FormsWorkflowExtensions.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\IFormsWorkflowExtension.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\DateTimeExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\IMailer.cs\" />\r\n    <Compile Include=\"Core\\SmtpMailer.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\PhantomJs\\PhantomServer.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\PhantomJs\\RenderingResult.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\PhantomJs\\RenderingResultStatus.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\PhantomJs\\RenderPreviewRequest.cs\" />\r\n    <Compile Include=\"Core\\Logging\\ILog.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\OpenSlideViewParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\IRpcService.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\IWampEventHandler.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\UserNameBasedAuthenticationFactory.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\UserNameBasedAuthorizer.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\UserNameBasedCookieAuthenticationFactory.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\UserNameBasedCookieAuthenticator.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\WampLogger.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\WampRouter.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\WampRouterFacade.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WampRouter\\WampRouterResolverRegistry.cs\" />\r\n    <Compile Include=\"Data\\DataScopeServicesFacade.cs\" />\r\n    <Compile Include=\"Data\\DataServiceScopeManager.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\SearchProfile.cs\" />\r\n    <Compile Include=\"Data\\SearchableTypeAttribute.cs\" />\r\n    <Compile Include=\"Data\\SearchableFieldAttribute.cs\" />\r\n    <Compile Include=\"Data\\Types\\IVersioned.cs\" />\r\n    <Compile Include=\"Data\\Types\\PageInsertPosition.cs\" />\r\n    <Compile Include=\"Data\\ICreationHistory.cs\" />\r\n    <Compile Include=\"Data\\VersionKeyPropertyName.cs\" />\r\n    <Compile Include=\"Plugins\\Components\\ComponentProviderSettings.cs\" />\r\n    <Compile Include=\"Plugins\\Components\\ComponentsEndpoint\\ComponentsEndpoint.cs\" />\r\n    <Compile Include=\"Plugins\\Components\\ComponentsEndpoint\\ComponentsResponseMessage.cs\" />\r\n    <Compile Include=\"Plugins\\Components\\ComponentTags\\TagManager.cs\" />\r\n    <Compile Include=\"Plugins\\Components\\FileBasedComponentProvider\\FileBasedComponentProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\PageAddActionExecuter.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\PageAddActionToken.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Data\\ProxyDataActionExecuter.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Data\\ProxyDataActionToken.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ProcessControllers\\GenericPublishProcessController\\GenericPublishProcessDynamicActionTokens.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\GeneratedDataTypesElementDynamicActionTokens.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\PageElementDynamicActionTokens.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\IUrlToEntityTokenMapper.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\UrlToEntityTokenFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Commands\\ConsoleCommandFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Commands\\Foundation\\PluginFacades\\ConsoleCommandHandlerPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Commands\\IConsoleCommandHandler.cs\" />\r\n    <Compile Include=\"C1Console\\Commands\\Plugins\\ConsoleCommandHandler\\ConsoleCommandHandlerData.cs\" />\r\n    <Compile Include=\"C1Console\\Commands\\Plugins\\ConsoleCommandHandler\\NonConfigurableConsoleCommandHandler.cs\" />\r\n    <Compile Include=\"C1Console\\Commands\\Plugins\\ConsoleCommandHandler\\Runtime\\ConsoleCommandHandlerCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Commands\\Plugins\\ConsoleCommandHandler\\Runtime\\ConsoleCommandHandlerFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Commands\\Plugins\\ConsoleCommandHandler\\Runtime\\ConsoleCommandHandlerSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Drawing\\FunctionPresentation.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\DataGroupingProviderHelper\\ElipsisEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\SvgIconSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\FontIconSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\HierarchicalSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\HierarchicalSelectorUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\PluginFacades\\PasswordRulePluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\PasswordPolicyFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\PasswordPolicy\\IPasswordRule.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\PasswordPolicy\\PasswordRuleData.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\PasswordPolicy\\NonConfigurablePasswordRule.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\PasswordPolicy\\Runtime\\PasswordRuleCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\PasswordPolicy\\Runtime\\PasswordRuleFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\PasswordPolicy\\Runtime\\PasswordPolicySettings.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\UserLockoutReason.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\SortDirection.cs\" />\r\n    <Compile Include=\"Core\\ServiceLocator.cs\" />\r\n    <Compile Include=\"Core\\Application\\Job.cs\" />\r\n    <Compile Include=\"Core\\Caching\\FileRelatedDataCache.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\StackTraceExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\LogExecutionTime.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\FileModifyPackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\FileModifyPackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\DllPackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\DllPackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\ISharedCodePageTemplateProvider.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\SharedFile.cs\" />\r\n    <Compile Include=\"Core\\Parallelization\\AsyncLock.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\IIconResourceSystemFacade.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\LocalizationFiles.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DesignTime>True</DesignTime>\r\n      <DependentUpon>LocalizationFiles.tt</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\ILocalizationProvider.cs\" />\r\n    <Compile Include=\"Core\\Routing\\AttributeBasedRoutingHelper.cs\" />\r\n    <Compile Include=\"Core\\Routing\\DataReferenceRelativeRouteToPredicateMapper.cs\" />\r\n    <Compile Include=\"Core\\Routing\\DataUrlCollisionException.cs\" />\r\n    <Compile Include=\"Core\\Routing\\DataUrls.cs\">\r\n      <SubType>Code</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Core\\Routing\\DefaultRelativeRouteToPredicateMapper.cs\" />\r\n    <Compile Include=\"Core\\Routing\\IRelativeRouteToPredicateMapper.cs\" />\r\n    <Compile Include=\"Core\\Routing\\IInternalUrlProvider.cs\" />\r\n    <Compile Include=\"Core\\Routing\\IDataUrlMapper.cs\">\r\n      <SubType>Code</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Core\\Routing\\IInternalUrlConverter.cs\" />\r\n    <Compile Include=\"Core\\Routing\\IMediaUrlProvider.cs\" />\r\n    <Compile Include=\"Core\\Routing\\InternalUrls.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ClientBrowserViewSettings.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataUrlProfile.cs\" />\r\n    <Compile Include=\"Data\\InternalUrlAttribute.cs\" />\r\n    <Compile Include=\"Data\\PageRenderingHistory.cs\" />\r\n    <Compile Include=\"Data\\RouteDateSegmentAttribute.cs\" />\r\n    <Compile Include=\"Data\\RouteSegmentAttribute.cs\" />\r\n    <Compile Include=\"Functions\\AttributeBasedRoutedDataUrlMapper.cs\" />\r\n    <Compile Include=\"Functions\\IRoutedDataUrlMapper.cs\" />\r\n    <Compile Include=\"Functions\\PathInfoRoutedDataUrlMapper.cs\" />\r\n    <Compile Include=\"Functions\\RoutedData.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Pages\\SeoFriendlyRedirectHttpHandler.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Pages\\SeoFriendlyRedirectRouteHandler.cs\" />\r\n    <Compile Include=\"Core\\Threading\\ThreadCultureScope.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\BrowserRender.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\BuildManagerHelper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Captcha\\CaptchaConfiguration.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\FunctionPreview.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\RenderingReason.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\TemplatePreviewRouteHandler.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FunctionBoxRouteHandler.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FunctionCallEditor\\FunctionMarkupHelper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Media\\ImageSizeReader.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Presentation\\ViewServices.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Template\\PageTemplateFeatureFacade.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\ScriptLoader.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WysiwygEditor\\PageTemplatePreview.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\StyleLoader.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XmlSerializationHelper.cs\" />\r\n    <Compile Include=\"Data\\DefaultFieldRandomStringValueAttribute.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\Configuration\\XmlConfigurationExtensionMethods.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataFieldTreeOrderingProfile.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataTypeIndex.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\Foundation\\DynamicTypesCustomFormFacade.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\ParseDefinitionFileException.cs\" />\r\n    <Compile Include=\"Data\\FormRenderingProfileAttribute.cs\" />\r\n    <Compile Include=\"Data\\IndexAttribute.cs\" />\r\n    <Compile Include=\"Data\\IndexDirection.cs\" />\r\n    <Compile Include=\"Data\\TreeOrderingProfileAttribute.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\ProcessControllerSettings.cs\" />\r\n    <Compile Include=\"Data\\StoreEventHandler.cs\" />\r\n    <Compile Include=\"Data\\StoreEventArgs.cs\" />\r\n    <Compile Include=\"Data\\Types\\ICustomFunctionCallEditorMapping.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPublishSchedule.cs\" />\r\n    <Compile Include=\"Data\\Types\\ISchedule.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUnpublishSchedule.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserFormLogin.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserPasswordHistory.cs\" />\r\n    <Compile Include=\"Data\\PublishScheduling\\PublishScheduleHelper.cs\" />\r\n    <Compile Include=\"Data\\Types\\TypeVersionAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\DecimalRangeValidatorAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\NullDateTimeRangeValidatorAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\NullDecimalRangeValidatorAttribute.cs\" />\r\n    <Compile Include=\"Functions\\FunctionParameterIgnoreAttribute.cs\" />\r\n    <Compile Include=\"Functions\\DynamicMethodHelper.cs\" />\r\n    <Compile Include=\"Functions\\FunctionCallEditorManager.cs\" />\r\n    <Compile Include=\"Functions\\FunctionCallEditorSettings.cs\" />\r\n    <Compile Include=\"Plugins\\Commands\\ConsoleCommandHandlers\\BrowseUrl.cs\" />\r\n    <Compile Include=\"Plugins\\Commands\\ConsoleCommandHandlers\\ConsoleCommandHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Commands\\ConsoleCommandHandlers\\FocusElement.cs\" />\r\n    <Compile Include=\"Plugins\\Commands\\ConsoleCommandHandlers\\FocusData.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\PlaceholderVirtualElement.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedHierarchicalSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedSvgIconSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\FileBasedFunctionProvider\\IParameterWidgetsProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Utils\\ConsoleIconSelectorWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Utils\\SvgIconSelectorWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\FileLogTraceListener\\CircullarList.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\FileLogTraceListener\\LogReaderHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\InternalUrlConverters\\DataInternalUrlConverter.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\InternalUrlProviders\\DataInternalUrlProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\MediaUrlProviders\\DefaultMediaUrlProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\DataContextAssembler.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\VirtualImageFileProvider\\VirtualImageFileQueryable.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\VirtualImageFileProvider\\VirtualImageFileQueryableVisitor.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\Foundation\\FileRecord.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\Foundation\\XmlDataProviderDocumentWriter.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\PageTemplateFeatureElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\PageTemplateFeatureEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\SharedCodeFileEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\SharedCodeFolderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionElementProvider\\RazorFunctionElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionElementProvider\\UserControlFunctionElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\AttachProviderVirtualElement.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\SimpleVirtualElement.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\VirtualElementConfigurationElement.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\UrlToEntityToken\\ServerLogUrlToEntityTokenMapper.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedFontIconSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\FileBasedFunctionProvider\\FileBasedFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\FileBasedFunctionProvider\\FileBasedFunctionProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\FileBasedFunctionProvider\\FunctionBasedFunctionProviderHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\FileBasedFunctionProvider\\FunctionParameter.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\FileBasedFunctionProvider\\NotLoadedFileBasedFunction.cs\" />\r\n    <Compile Include=\"Core\\IO\\ReparsePointUtils.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\RazorFunctionProvider\\RazorBasedFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\RazorFunctionProvider\\RazorFunctionProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\RazorFunctionProvider\\RazorFunctionProviderAssembler.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\RazorFunctionProvider\\RazorFunctionProviderData.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\Functions.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\C1HtmlHelper.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\HtmlHelperExtensions.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\NoHttpRazorContext.cs\" />\r\n    <Compile Include=\"AspNet\\Razor\\NoHttpRazorRequest.cs\" />\r\n    <Compile Include=\"AspNet\\Security\\FileBasedFunctionEntityToken.cs\" />\r\n    <Compile Include=\"AspNet\\Security\\StandardFunctionSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\ActionEventSystemFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\ActionLockingException.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\ActionLockingFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\AddNewTreeRefresher.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\FlowTokenSerializer.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\ElementProviderLoader.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\OpenExternalViewQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\SaveButtonUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\BindingValidationService.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\IBindingValidationService.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\IElementInformationService.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\MessageBoxActionToken.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\InlineScriptActionFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\UrlActionToken.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementActionActivePosition.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\SelectElementQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\DoubleSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\IValidatingUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\ReadBindingControlValueOverload.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\LoginResult.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\PermissionsFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\TreePerspectiveEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeSharedRootsFacade.cs\" />\r\n    <Compile Include=\"Core\\Application\\GlobalFileLocker.cs\" />\r\n    <Compile Include=\"Core\\Application\\SystemGlobalSemaphore.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\AppCodeTypeNotFoundConfigurationException.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\C1Configuration.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Configuration.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\FileConfigurationSource.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\FileConfigurationSourceImplementation.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\PageUrlDataExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1ConfigurationImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1DirectoryImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1DirectoryInfoImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1FileImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1FileInfoImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1FileStreamImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1FileSystemWatcherImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1StreamReaderImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\C1StreamWriterImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\DataConnectionBase.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\DataConnectionImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\DataEventsImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\ImplementationFactory.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\LogImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\PackageLicenseHelperImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\PackageUtilsImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\PageDataConnectionImplementation.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\SitemapNavigatorImplementation.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1Directory.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1DirectoryInfo.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1File.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1FileInfo.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1FileStream.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1FileSystemInfo.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1FileSystemWatcher.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1StreamReader.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1StreamWriter.cs\" />\r\n    <Compile Include=\"Core\\IO\\C1WaitForChangedResult.cs\" />\r\n    <Compile Include=\"Core\\IO\\Foundation\\PluginFacades\\IOProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\IO\\IOFacade.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1Configuration.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1Directory.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1DirectoryInfo.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1File.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1FileInfo.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1FileStream.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1FileSystemWatcher.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1StreamReader.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IC1StreamWriter.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IIOProvider.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\IOProviderData.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\NonConfigurableIOProvider.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\Runtime\\IOProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\Runtime\\IOProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\Runtime\\IOProviderFactory.cs\" />\r\n    <Compile Include=\"Core\\IO\\Plugins\\IOProvider\\Runtime\\IOProviderSettings.cs\" />\r\n    <Compile Include=\"Core\\IO\\StreamUtils.cs\" />\r\n    <Compile Include=\"Core\\Log.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\LicenseDefinitionManager.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\LicenseDefinitionUtils.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\LicenseServerFacade.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageAssemblyHandler.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\PackageFragmentValidationExtension.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\PackageLicenseFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\PackageLicenseFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\XmlFileMergePackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\XmlFileMergePackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageLicenseDefinition.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageLicenseHelper.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageUtils.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\WebServiceClient\\LicenseDefinitionServiceSoapClient.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Measurement.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Profiler.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\ProfilerReport.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Foundation\\IPageTemplateProviderRegistry.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Foundation\\PageTemplateProviderRegistry.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Foundation\\PageTemplateProviderRegistryImpl.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Foundation\\PluginFacade\\PageTemplateProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\IPageRenderer.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\IPageTemplateProvider.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\IPageTemplate.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\PageContentToRender.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\PageTemplateDescriptor.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\PageTemplateEntityToken.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\PageTemplateFacade.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\PlaceholderAttribute.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\PlaceholderDescriptor.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Plugins\\NonConfigurablePageTemplateProvider.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Plugins\\PageTemplateProviderData.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Plugins\\Runtime\\PageTemplateProviderSettings.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Plugins\\Runtime\\PageTemplateProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Plugins\\Runtime\\PageTemplateProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\Plugins\\Runtime\\PageTemplateProviderFactory.cs\" />\r\n    <Compile Include=\"Core\\PageTemplates\\TemplateDefinitionHelper.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Foundation\\PluginFacades\\PageUrlProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\Routing\\HostnameBindingsFacade.cs\" />\r\n    <Compile Include=\"Core\\Routing\\MediaUrlData.cs\" />\r\n    <Compile Include=\"Core\\Routing\\MediaUrls.cs\" />\r\n    <Compile Include=\"Core\\Routing\\PageNotFoundRoute.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\UrlFormatters\\IUrlFormatter.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\UrlFormatters\\Runtime\\NonConfigurableUrlFormatter.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\UrlFormatters\\Runtime\\UrlFormatterCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\UrlFormatters\\Runtime\\UrlFormatterData.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\UrlFormatters\\Runtime\\UrlFormatterFactory.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Foundation\\PluginFacades\\UrlFormattersPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\Routing\\UrlKind.cs\" />\r\n    <Compile Include=\"Core\\Routing\\PageUrlData.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\PageUrlsProviders\\Runtime\\PageUrlProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\PageUrlsProviders\\Runtime\\PageUrlProviderFactory.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\PageUrlsProviders\\IPageUrlBuilder.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\PageUrlsProviders\\IPageUrlProvider.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\PageUrlsProviders\\PageUrlSet.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\PageUrlsProviders\\Runtime\\NonConfigurablePageUrlProvider.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\Runtime\\UrlsConfiguration.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Plugins\\PageUrlsProviders\\Runtime\\PageUrlProviderData.cs\" />\r\n    <Compile Include=\"Core\\Routing\\PageUrls.cs\" />\r\n    <Compile Include=\"Core\\Routing\\UrlSpace.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\CodeGeneration\\PropertySerializerManager.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\PrettyPrinter.cs\" />\r\n    <Compile Include=\"Core\\Sql\\SqlConnectionManager.cs\" />\r\n    <Compile Include=\"Core\\Threading\\TwoPhaseFileLock.cs\" />\r\n    <Compile Include=\"Core\\Types\\AssemblyLocationExtensions.cs\" />\r\n    <Compile Include=\"Core\\Types\\CodeCompatibilityChecker.cs\" />\r\n    <Compile Include=\"Core\\Types\\CodeGenerationBuilder.cs\" />\r\n    <Compile Include=\"Core\\Types\\CodeGenerationCommon.cs\" />\r\n    <Compile Include=\"Core\\Types\\CodeGenerationManager.cs\" />\r\n    <Compile Include=\"Core\\Types\\ICodeProvider.cs\" />\r\n    <Compile Include=\"Core\\Types\\StaticReflection.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\ApplicationLevelEventHandlers.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\HttpModules\\Utf8StringTransformationStream.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Media\\ResizingAction.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Media\\ImageResizer.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Media\\ResizingOptions.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Data\\XhtmlRenderingEncodingEnum.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\PagePreviewBuilder.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Pages\\C1PageRoute.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Pages\\C1PageRouteHander.cs\" />\r\n    <Compile Include=\"Core\\Routing\\Routes.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\RenderingContext.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\OpenExternalViewParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\SelectElementParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\DocumentDirtyEvent.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XhtmlErrorFormatter.cs\" />\r\n    <Compile Include=\"Core\\Xml\\UriResolver.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XDocumentUtils.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XElementUtils.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XhtmlWriter.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XmlDocumentUtil.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XmlReaderUtils.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XmlSchemaSetUtils.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XmlWriterUtils.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XslCompiledTransformUtils.cs\" />\r\n    <Compile Include=\"Data\\DataEventArgs.cs\" />\r\n    <Compile Include=\"Data\\DataEventHandler.cs\" />\r\n    <Compile Include=\"Data\\DataEvents.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataTypeValidationRegistry.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataTypeValidator.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\UpdateDataTypeDescriptor.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\CodeGeneration\\DataWrapperClassCodeProvider.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\CodeGeneration\\DataWrapperCodeGenerator.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\CodeGeneration\\EmptyDataClassCodeProvider.cs\" />\r\n    <Compile Include=\"Data\\GeneratedTypes\\InterfaceCodeGenerator.cs\" />\r\n    <Compile Include=\"Data\\GeneratedTypes\\InterfaceCodeManager.cs\" />\r\n    <Compile Include=\"Data\\GeneratedTypes\\InterfaceCodeProvider.cs\" />\r\n    <Compile Include=\"Data\\DataTypeTypesManager.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\EmptyDataClassTypeManager.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\IFileSystemDataProvider.cs\" />\r\n    <Compile Include=\"Data\\SitemapNavigator.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\UserGroupUserAdderFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\UserGroupUserAdderFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Ajax\\AjaxResponseHttpModule.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Ajax\\AjaxStream.cs\" />\r\n    <Compile Include=\"Core\\Application\\ApplicationOfflineCheckHttpModule.cs\" />\r\n    <Compile Include=\"Core\\Application\\ApplicationStartupFacade.cs\" />\r\n    <Compile Include=\"Core\\Application\\Foundation\\ApplicationStartupHandlerRegistry.cs\" />\r\n    <Compile Include=\"Core\\Application\\Foundation\\ApplicationStartupHandlerRegistryImpl.cs\" />\r\n    <Compile Include=\"Core\\Application\\Foundation\\IApplicationStartupHandlerRegistry.cs\" />\r\n    <Compile Include=\"Core\\Application\\Foundation\\PluginFacades\\ApplicationStartupHandlerPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationStartupHandler\\ApplicationStartupHandlerData.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationStartupHandler\\IApplicationStartupHandler.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationStartupHandler\\NonConfigurableApplicationStartupHandler.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationStartupHandler\\Runtime\\ApplicationStartupHandlerCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationStartupHandler\\Runtime\\ApplicationStartupHandlerDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationStartupHandler\\Runtime\\ApplicationStartupHandlerFactory.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationStartupHandler\\Runtime\\ApplicationStartupHandlerSettings.cs\" />\r\n    <Compile Include=\"Core\\Application\\ShutdownGuard.cs\" />\r\n    <Compile Include=\"Core\\Caching\\CacheManager.cs\" />\r\n    <Compile Include=\"Core\\Caching\\CacheSettings.cs\" />\r\n    <Compile Include=\"Core\\Caching\\CachePriority.cs\" />\r\n    <Compile Include=\"Core\\Caching\\CacheStatistic.cs\" />\r\n    <Compile Include=\"Core\\Caching\\CacheType.cs\" />\r\n    <Compile Include=\"Core\\Caching\\Design\\LightweightCache.cs\" />\r\n    <Compile Include=\"Core\\Caching\\Design\\MixedCache.cs\" />\r\n    <Compile Include=\"Core\\Caching\\ICache.cs\" />\r\n    <Compile Include=\"Core\\Collections\\Generic\\Hashset.cs\" />\r\n    <Compile Include=\"Core\\Collections\\Generic\\Hashtable.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\SystemSetupFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\DownloadFileMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\BindEntityTokenToViewQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\OpenGenericViewQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\SaveStatusConsoleMessageQueueItem.cs\" />\r\n    <Compile Include=\"Data\\Caching\\Cache.cs\" />\r\n    <Compile Include=\"Data\\Caching\\WeakRefCache.cs\" />\r\n    <Compile Include=\"Data\\Caching\\TableVersion.cs\" />\r\n    <Compile Include=\"Data\\DataConnection.cs\" />\r\n    <Compile Include=\"Data\\DataIconFacade.cs\" />\r\n    <Compile Include=\"Data\\DataIdKeyFacade.cs\" />\r\n    <Compile Include=\"Data\\DataIdKeyFacadeImpl.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\TypeUpdateVersionException.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataWrappingFacade.cs\" />\r\n    <Compile Include=\"Data\\GlobalDataTypeFacade.cs\" />\r\n    <Compile Include=\"Data\\IDataIdKeyFacade.cs\" />\r\n    <Compile Include=\"Data\\PageDataConnection.cs\" />\r\n    <Compile Include=\"Data\\PageFolderFacade.cs\" />\r\n    <Compile Include=\"Data\\PageMetaDataFacade.cs\" />\r\n    <Compile Include=\"Data\\PageNode.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\ISupportCaching.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\Streams\\FileChangeNotificator.cs\" />\r\n    <Compile Include=\"Data\\DataInterceptor.cs\" />\r\n    <Compile Include=\"Data\\NewInstanceDefaultFieldValueAttribute.cs\" />\r\n    <Compile Include=\"Data\\IChangeHistory.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ILocalizeProcessController.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ProcessControllers\\GenericLocalizeProcessController\\GenericLocalizeProcessController.cs\" />\r\n    <Compile Include=\"Data\\PublicationScope.cs\" />\r\n    <Compile Include=\"Data\\SitemapScope.cs\" />\r\n    <Compile Include=\"Data\\Streams\\CachedMemoryStream.cs\" />\r\n    <Compile Include=\"Data\\Streams\\FileStreamManagerAttribute.cs\" />\r\n    <Compile Include=\"Data\\Streams\\FileStreamManagerLocator.cs\" />\r\n    <Compile Include=\"Data\\Streams\\IFileStreamManager.cs\" />\r\n    <Compile Include=\"Data\\IPageData.cs\" />\r\n    <Compile Include=\"Data\\IPageFolderData.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUrlConfiguration.cs\" />\r\n    <Compile Include=\"Data\\Types\\IHostnameBinding.cs\" />\r\n    <Compile Include=\"Data\\Types\\IInlineFunctionAssemblyReference.cs\" />\r\n    <Compile Include=\"Data\\Types\\IInlineFunction.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageFolderDefinition.cs\" />\r\n    <Compile Include=\"Data\\IPageMetaData.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageMetaDataDefinition.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageTypeMetaDataTypeLink.cs\" />\r\n    <Compile Include=\"Data\\Types\\IDataItemTreeAttachmentPoint.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageType.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageTypeDateFolderTypeLink.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageTypeDefaultPageContent.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageTypePageTemplateRestriction.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageTypeParentRestriction.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageTypeTreeLink.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserGroupActivePerspective.cs\" />\r\n    <Compile Include=\"Data\\Types\\ISearchEngineOptimizationKeyword.cs\" />\r\n    <Compile Include=\"Data\\Types\\ITaskItem.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserGroup.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserGroupPermissionDefinition.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserGroupPermissionDefinitionPermissionType.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserUserGroupRelation.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\AttachingPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementAttachingPointFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementInformationService.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\ElementAttachingProviderFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\ElementAttachingProviderRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\IElementAttachingProviderRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\ElementAttachingProviderRegistryImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\ElementActionProviderRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\ElementActionProviderRegistryImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\IElementActionProviderRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\PluginFacades\\ElementActionProviderPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\PluginFacades\\ElementAttachingProviderPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\PiggybagSerializer.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementActionProvider\\ElementActionProviderData.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementActionProvider\\IElementActionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementActionProvider\\NonConfigurableElementActionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementActionProvider\\Runtime\\ElementActionProviderCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementActionProvider\\Runtime\\ElementActionProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementActionProvider\\Runtime\\ElementActionProviderFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementActionProvider\\Runtime\\ElementActionProviderSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\SpecificTreeRefresher.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\DeleteTreeRefresher.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\ParentTreeRefresher.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\IActionExecutorSerializedParameters.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\StandardUiContainerTypesSerializerHandler.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\UpdateTreeRefresher.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\VisualFlowUiDefinitionBase.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Workflow\\EntityTokenLockedEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Workflow\\SecurityViolationWorkflowEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementAttachingProvider\\ElementAttachingProviderData.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementAttachingProvider\\IElementAttachingProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementAttachingProvider\\IMultipleResultElementAttachingProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementAttachingProvider\\NonConfigurableElementAttachingProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementAttachingProvider\\Runtime\\ElementAttachingProviderCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementAttachingProvider\\Runtime\\ElementAttachingProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementAttachingProvider\\Runtime\\ElementAttachingProviderFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementAttachingProvider\\Runtime\\ElementAttachingProviderSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\HooklessElementProviderData.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\ILabeledPropertiesElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\ILocaleAwareLabeledPropertiesElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\NonConfigurableHooklessElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\IHooklessElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\Runtime\\HooklessElementProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\Runtime\\HooklessElementProviderCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\Runtime\\HooklessElementProviderFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ShowErrorElementHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\TreeLockBehavior.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\FlushAttribute.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\DictionaryExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\ExpressionExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\HttpContextExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\IApplicationHostExtensionMethods.cs\">\r\n      <SubType>Code</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Core\\Extensions\\IQueryableExtensionMethods.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\DataReferenceTreeSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\PageReferenceSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\HtmlBlobUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\MultiContentXhtmlEditorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\EvalFuncProducer.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\LazyFunctionProviedPropertyAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\LazyFunctionProviedPropertyValidator.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\NullIntegerRangeValidatorAttribute.cs\" />\r\n    <Compile Include=\"Functions\\FunctionAttribute.cs\" />\r\n    <Compile Include=\"Functions\\FunctionParameterAttribute.cs\" />\r\n    <Compile Include=\"Functions\\Forms\\FunctionParameterElementProducer.cs\" />\r\n    <Compile Include=\"Functions\\Forms\\FunctionProducerMediator.cs\" />\r\n    <Compile Include=\"Functions\\Forms\\FunctionParameterProducer.cs\" />\r\n    <Compile Include=\"Functions\\Forms\\FunctionProducer.cs\" />\r\n    <Compile Include=\"Functions\\Forms\\IFunctionProducer.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\PluginFacades\\XslExtensionsProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\XslExtensionsProviderRegistry.cs\" />\r\n    <Compile Include=\"Functions\\ICompoundFunction.cs\" />\r\n    <Compile Include=\"Functions\\IFunctionInitializationInfo.cs\" />\r\n    <Compile Include=\"Functions\\Inline\\InlineFunctionCreateMethodErrorHandler.cs\" />\r\n    <Compile Include=\"Functions\\Inline\\NotLoadedInlineFunction.cs\" />\r\n    <Compile Include=\"Functions\\Inline\\StringInlineFunctionCreateMethodErrorHandler.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\XslExtensionsProvider\\Runtime\\XslExtensionsProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\XslExtensionsProvider\\XslExtensionsProviderData.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\XslExtensionsProvider\\Runtime\\XslExtensionsProviderFactory.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\XslExtensionsProvider\\IXslExtensionsProvider.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\XslExtensionsProvider\\Runtime\\XslExtensionsProviderSettings.cs\" />\r\n    <Compile Include=\"Functions\\StandardFunctionSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Functions\\StandardFunctions.cs\" />\r\n    <Compile Include=\"Functions\\XslExtensionsManager.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\BuildinPlugins\\GlobalSettingsProvider\\BuildinCacheSettings.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\BuildinPlugins\\GlobalSettingsProvider\\BuildinCachingSettings.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\ICachingSettings.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\InstallationInformationFacade.cs\" />\r\n    <Compile Include=\"Core\\Implementation\\ImplementationContainer.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Foundation\\IPerformanceCounterProviderRegistry.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Foundation\\PerformanceCounterProviderRegistry.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Foundation\\PerformanceCounterProviderRegistryImpl.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Foundation\\PluginFacades\\PerformanceCounterProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\IPerformanceCounterFacade.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\PerformanceCounterFacade.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\PerformanceCounterFacadeImpl.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Plugin\\IPerformanceCounterProvider.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\IPerformanceCounterToken.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Plugin\\NonConfigurablePerformanceCounterProvider.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Plugin\\PerformanceCounterProviderData.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Plugin\\Runtime\\PerformanceCounterProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Plugin\\Runtime\\PerformanceCounterProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Plugin\\Runtime\\PerformanceCounterProviderFactory.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Plugin\\Runtime\\PerformanceCounterProviderSettings.cs\" />\r\n    <Compile Include=\"Core\\Linq\\ExpressionExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Linq\\ExpressionVisitors\\CacheKeyBuilderExpressionVisitor.cs\" />\r\n    <Compile Include=\"Core\\Localization\\LocalizationFacade.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\LocalePackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\LocalePackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\PackageVersionBumperFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\PackageVersionBumperFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Data\\PageManager.cs\" />\r\n    <Compile Include=\"Data\\PageUrl.cs\" />\r\n    <Compile Include=\"Core\\Parallelization\\IndexEnumerator.cs\" />\r\n    <Compile Include=\"Core\\Logging\\LogManager.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\FileXslTransformationPackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\FileXslTransformationPackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\Parallelization\\Foundation\\IParallelizationProviderRegistry.cs\" />\r\n    <Compile Include=\"Core\\Parallelization\\Foundation\\ParallelizationProviderRegistry.cs\" />\r\n    <Compile Include=\"Core\\Parallelization\\Foundation\\ParallelizationProviderRegistryImpl.cs\" />\r\n    <Compile Include=\"Core\\Parallelization\\ParallelFacade.cs\" />\r\n    <Compile Include=\"Core\\Parallelization\\Plugins\\Runtime\\ParallelizationProviderSettings.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Data\\KeyTemplatedXhtmlRendererAttribute.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Foundation\\IRenderingResponseHandlerRegistry.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Foundation\\PluginFacades\\RenderingResponseHandlerPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Foundation\\RenderingResponseHandlerRegistry.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Foundation\\RenderingResponseHandlerRegistryImpl.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\IRenderingResponseHandlerFacade.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\EntityBaseClassGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\EntityClassesFieldNames.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\SqlDataProviderCodeBuilder.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\SqlDataProviderCodeProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\SqlProviderCodeGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Foundation\\NamesCreator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Foundation\\RequireTransactionScope.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Foundation\\SqlDataTypeStoreTable.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Foundation\\SqlDataTypeStoreTableKey.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\SqlDataProvider_Stores.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\SqlDataTypeStoreDataScope.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\CodeGeneration\\XmlDataProviderCodeProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\CodeGeneration\\XmlProviderCodeGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\CodeGeneration\\XmlDataProviderCodeBuilder.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\Foundation\\NamesCreator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\XmlDataProvider_CRUD.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\XmlDataProvider_Stores.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\XmlDataTypeStore.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\XmlDataTypeStoreDataScope.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\XmlDataTypeStoreCreator.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\FunctionInfoActionExecutor.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\FunctionInfoActionToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\StandardFunctionAuxiliarySecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallLocalPackageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallLocalPackageWorkflow.designer.cs\">\r\n      <DependentUpon>InstallLocalPackageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallRemotePackageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallRemotePackageWorkflow.designer.cs\">\r\n      <DependentUpon>InstallRemotePackageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedSaveButtonUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedDoubleSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\MethodBasedFunctionProvider\\NotLoadedMethodBasedFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Html\\Template\\MetaDescriptionValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Html\\Template\\HtmlTitleValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Dictionary\\EnumerableToDictionary.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Dictionary\\XElementsToDictionaryFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Html\\Template\\PageTemplateFeatureFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\PathInfoGuidFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\PathInfoIntFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\RegisterPathInfoUsageFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\PathInfoFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\UserControlFunctionProvider\\UserControlBasedFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\UserControlFunctionProvider\\UserControlFunctionProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\UserControlFunctionProvider\\UserControlFunctionProviderAssembler.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\UserControlFunctionProvider\\UserControlFunctionProviderData.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\FontIconSelectorWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\UrlComboBoxWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Utils\\FormMarkupWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\FileLogTraceListener\\CurrentFileReader.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\FileLogTraceListener\\LogFileInfo.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\FileLogTraceListener\\LogFileReader.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\FileLogTraceListener\\PlainFileReader.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Common\\CachedTemplateInformation.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Common\\TemplateParsingHelper.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\CompilationHelper.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Rendering\\DescriptionMetaTag.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Functions\\LazyParameterRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Rendering\\PageTemplateFeature.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\MasterPageBase.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\MasterPagePageTemplate.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Functions\\Function.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Functions\\Markup.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Functions\\Param.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Functions\\ParamCollection.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Functions\\ParamObjectConverter.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Functions\\ParamTagControlBuilder.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Functions\\StringToObjectConverter.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Rendering\\Description.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Rendering\\Render.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\Controls\\Rendering\\Title.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\MasterPagePageTemplateDescriptor.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\MasterPageRenderingInfo.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\MasterPagePageRenderer.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\MasterPagePageTemplateProvider.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\MasterPagePageTemplateProviderData.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\MasterPages\\SharedMasterPage.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Razor\\RazorPageRenderer.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Razor\\RazorPageTemplateDescriptor.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Razor\\RazorPageTemplateProvider.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Razor\\RazorPageTemplateProviderAssembler.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Razor\\RazorPageTemplateProviderData.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Razor\\SharedRazorFile.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\Razor\\TemplateRenderingInfo.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\XmlPageTemplates\\XmlPageTemplateProviderData.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\XmlPageTemplates\\XmlPageRenderer.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\XmlPageTemplates\\XmlPageTemplateDescriptor.cs\" />\r\n    <Compile Include=\"Plugins\\PageTemplates\\XmlPageTemplates\\XmlPageTemplateProvider.cs\" />\r\n    <Compile Include=\"Plugins\\ResourceSystem\\AggregationLocalizationProvider\\AggregationLocalizationProvider.cs\" />\r\n    <Compile Include=\"Plugins\\ResourceSystem\\XmlLocalizationProvider\\XmlLocalizationProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\Hostnames\\FormFunctions.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\InternalUrlConverters\\MediaInternalUrlConverter.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\InternalUrlConverters\\PageInternalUrlConverter.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\Pages\\PageUrlBuilder.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Plugins\\RenderingResponseHandler\\IDataRenderingResponseHandler.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Plugins\\RenderingResponseHandler\\IRenderingResponseHandler.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Plugins\\RenderingResponseHandler\\NonConfigurableHookRegistrator.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Plugins\\RenderingResponseHandler\\RenderingResponseHandlerData.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\RenderingResponseHandlerResult.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Plugins\\RenderingResponseHandler\\Runtime\\RenderingResponseHandlerCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Plugins\\RenderingResponseHandler\\Runtime\\RenderingResponseHandlerFactory.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Plugins\\RenderingResponseHandler\\Runtime\\RenderingResponseHandlerDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Plugins\\RenderingResponseHandler\\Runtime\\RenderingResponseHandlerSettings.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\RenderingResponseHandlerFacade.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\RenderingResponseHandlerFacadeImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\AuxiliarySecurityAncestorFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\AuxiliarySecurityAncestorFacadeImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\ConstructorBasedUserGroupPermissionDefinition.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\AuxiliarySecurityAncestorProviderAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\EntityTokenCacheFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\EntityTokenHtmlPrettyfier.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\EntityTokenHtmlPrettyfierHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\EntityTokenSerializerException.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\PermissionTypeFacadeCaching.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\PluginFacades\\UserGroupDefinitionProviderPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\IAuxiliarySecurityAncestorFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\IAuxiliarySecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\NoSecurityEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserGroupPermissionDefinitionProvider\\IUserGroupPermissionDefinitionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserGroupPermissionDefinitionProvider\\NonConfigurableUserGroupPermissionDefinitionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserGroupPermissionDefinitionProvider\\Runtime\\UserGroupPermissionDefinitionProviderCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserGroupPermissionDefinitionProvider\\Runtime\\UserGroupPermissionDefinitionProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserGroupPermissionDefinitionProvider\\Runtime\\UserGroupPermissionDefinitionProviderFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserGroupPermissionDefinitionProvider\\Runtime\\UserGroupPermissionDefinitionProviderSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserGroupPermissionDefinitionProvider\\UserGroupPermissionDefinitionProviderData.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\UserGroupFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\UserGroupPermissionDefinition.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\UserGroupPerspectiveFacade.cs\" />\r\n    <Compile Include=\"Functions\\Inline\\InlineFunctionHelper.cs\" />\r\n    <Compile Include=\"Functions\\Inline\\InlineFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Application\\ApplicationStartupHandlers\\AttributeBasedApplicationStartupHandler\\AttributeBasedApplicationStartupHandler.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\DataContextBase.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\DataContextClassGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\DataIdClassGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\EntityClassGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\EntityCodeGeneratorHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\IEntity.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\ISqlDataContext.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\ISqlDataProviderHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\SqlDataContextHelperClass.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\CodeGeneration\\SqlDataProviderHelperGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\SqlDataTypeStoresContainer.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\SqlDataTypeStore.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Foundation\\DynamicTypesCommon.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Foundation\\InterfaceConfigurationManipulator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Foundation\\SqlDataProviderStoreManipulator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Foundation\\SqlLoggerTextWriter.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\SqlDataProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Sql\\ISqlTableInformation.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Sql\\ISqlTableInformationStore.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Sql\\SqlColumnInformation.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Sql\\SqlTableInformation.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Sql\\SqlTableInformationStore.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MSSqlServerDataProvider\\Sql\\SqlTableInformationStoreImpl.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\CodeGeneration\\DataProviderHelperBase.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\Foundation\\TransactionRollbackHandler.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\Foundation\\ValidationHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\IGeneratedTypeWhiteList.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\DeveloperApplicationProvider\\DeveloperApplicationProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\DeveloperApplicationProvider\\DeveloperApplicationProviderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\UserGroupsFormsHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\UserGroupElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\UserGroupElementProviderRootEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\Base\\UserControlBase.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedDataReferenceTreeSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedPageReferenceSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedHtmlBlobUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedMultiContentXhtmlEditorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\AddDataInstance.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\DeleteDataInstance.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\DataInstanceHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\UpdateDataInstance.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Guid\\NewGuid.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Html\\Template\\CommonMetaTagsFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Html\\Template\\LangAttributeFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Response\\SetServerPageCacheDuration.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Server\\ApplicationPath.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\DataReference\\NullablePageReferenceSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\DataReference\\PageReferenceSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\AttributeDynamicValuesHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\ConfirmActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\CustomUrlActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\BaseAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\BasePossibleAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\CustomAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\DataItemAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\DynamicDataItemAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\DataItemPossibleAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\BaseFolderRanges.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\IFolderRanges.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\IntFolderRanges.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\StringFolderRange.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\StringFolderRanges.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\IDataItemAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\INamedAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\IPossibleAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\NamedAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\StringConstants.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\FunctionElementGeneratorTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\IEntityTokenContainingParentEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\ITreeFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\LeafDisplayMode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\FieldOrderByNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\DateTimeFormater.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FactoryHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\FolderRangesCreator.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\IFolderRange.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\IntFolderRange.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FolderRanges\\FolderRangesFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\OrderByNodeCreatorFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\TreeException.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\TupleIndexer.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\FunctionFilterNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\MessageBoxActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\OrderByNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\PiggybagDataFinder.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\AttachmentPoints\\IAttachmentPoint.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeElementActionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeFunctionElementGeneratorEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeMarkupConstants.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\WorkflowActionNode.cs\" />\r\n    <Compile Include=\"Core\\Types\\AssemblyExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\UrlBuilder.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Captcha\\Captcha.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\SelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\XslExtensionsProviders\\CaptchaXslExtension.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Captcha\\Encryption.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Captcha\\ImageCreator.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Constant\\XhtmlDocumentFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\GetXmlCachePriority.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Media\\MediaFolderFilterFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\GetNullableDataReference.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Mail\\SendMailFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Pages\\GetForeignPageInfoFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Caching\\PageObjectCacheFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\GuidInCommaSeparatedListPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\StringInCommaSeparatedListPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\StringInListPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableDateTimeLessThanPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableDateTimeGreaterThanPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableDecimalNoValuePredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableDecimalEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableDateTimeNoValuePredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableDateTimeEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableBoolNoValuePredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableBoolEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\StringNoValuePredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableIntegerNoValuePredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableIntegerEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableGuidNoValuePredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\NullableGuidEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\String\\Format.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Response\\RedirectFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Xml\\LoadXhtmlFileFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\MediaFolderSelectorWidget.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\SelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\XhtmlDocument\\VisualXhtmlEditorWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\XslExtensionsProviders\\ConfigBasedXslExtensionsProvider\\ConfigBasedXslExtensionsProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\XslExtensionsProviders\\StandardExtension.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\XslExtensionsProviders\\ConfigBasedXslExtensionsProvider\\ConfigBasedXslExtensionsProviderData.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\DataReference\\GetOptionsCommon.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\DataReference\\NullableDataReferenceSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\DataIdMultiSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Instrumentation\\PerformanceCounterProviders\\NoPerformanceCounterProvider\\NoPerformanceCounterProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Instrumentation\\PerformanceCounterProviders\\WindowsPerformanceCounterProvider\\PerformanceCounterInstaller.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Instrumentation\\PerformanceCounterProviders\\WindowsPerformanceCounterProvider\\PerformanceNames.cs\" />\r\n    <Compile Include=\"Plugins\\Instrumentation\\PerformanceCounterProviders\\WindowsPerformanceCounterProvider\\WindowsPerformanceCounterProvider.cs\">\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1Configuration.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1Directory.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1DirectoryInfo.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1File.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1FileInfo.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1FileStream.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1FileSystemWatcher.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1StreamReader.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalC1StreamWriter.cs\" />\r\n    <Compile Include=\"Plugins\\IO\\IOProviders\\LocalIOProvider\\LocalIOProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\FileLogTraceListener\\FileLogger.cs\" />\r\n    <Compile Include=\"Core\\Logging\\LogEntry.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\FileLogTraceListener\\FileLogTraceListener.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\Pages\\DefaultPageUrlProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\UrlFormatters\\StringReplaceUrlFormatter.cs\" />\r\n    <Compile Include=\"Plugins\\Routing\\UrlFormatters\\ToLowerCaseUrlFormatter.cs\" />\r\n    <Compile Include=\"Plugins\\Search\\Endpoint\\ConsoleSearchPageStructure.cs\" />\r\n    <Compile Include=\"Plugins\\Search\\Endpoint\\ConsoleSearchQuery.cs\" />\r\n    <Compile Include=\"Plugins\\Search\\Endpoint\\ConsoleSearchResult.cs\" />\r\n    <Compile Include=\"Plugins\\Search\\Endpoint\\ConsoleSearchRpcService.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\LoginProviderPlugins\\DataBasedFormLoginProvider\\UserFormLoginManager.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\LoginSessionStores\\WampContextBasedLoginSessionStore\\WampContextBasedBasedLoginSessionStore.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\PasswordRules\\DifferentCharacterGroups\\DifferentCharacterGroupsPasswordRule.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\PasswordRules\\DoNotUseUserName\\DoNotUseUserNamePasswordRule.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\PasswordRules\\EnforcePasswordHistory\\EnforcePasswordHistoryPasswordRule.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\PasswordRules\\MinimumLength\\MinimumLengthPasswordRule.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\UserGroupPermissionDefinitionProvider\\DataBasedUserGroupPermissionDefinitionProvider\\DataBasedUserGroupPermissionDefinitionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\BaseTaskManager.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\ITaskManager.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\ITaskManagerFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\ITaskManagerFlowControllerService.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\Task.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\TaskContainer.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\TaskManagerFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\TaskManagerFacadeImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Tasks\\TaskManagerFlowControllerService.cs\" />\r\n    <Compile Include=\"Core\\Threading\\ThreadDataManagerData.cs\" />\r\n    <Compile Include=\"Core\\Threading\\ThreadDataManager.cs\" />\r\n    <Compile Include=\"Core\\Threading\\ThreadManager.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\ActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\BuildResult.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\DataFieldValueHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\DynamicValuesHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\GenericDeleteDataActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\DataElementsTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\DataFilteringTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\DataFolderElementsTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\FieldFilterNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\FilterNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\ActionNodeCreatorFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\BuildProcessContext.cs\" />\r\n    <Compile Include=\"Core\\Linq\\ExpressionHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\FilterNodeCreatorFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\TreeBuilder.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Foundation\\TreeNodeCreatorFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\GenericAddDataActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\GenericEditDataActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\ParentIdFilterNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\PiggybagExtensionMethods.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\ReportFunctionActionNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\RootTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\SimpleElementTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeAuxiliaryAncestorProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeDataFieldGroupingElementEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\Tree.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeElementAttachingProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeFacadeImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeNodeDynamicContext.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeNodeExtensionMethods.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\TreeSimpleElementEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Trees\\ValidationError.cs\" />\r\n    <Compile Include=\"Core\\Types\\AssemblyFacade.cs\" />\r\n    <Compile Include=\"Core\\Types\\CodeGenerationHelper.cs\" />\r\n    <Compile Include=\"Core\\Types\\CompatibilityCheckResult.cs\" />\r\n    <Compile Include=\"C1Console\\Users\\UserSettingsMock.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\StringSizeValidatorAttribute.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\UrlToEntityToken\\DataUrlToEntityTokenMapper.cs\" />\r\n    <Compile Include=\"Properties\\SharedAssemblyInfo.cs\" />\r\n    <Compile Include=\"Verify.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\BroadcastMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\CollapseAndRefreshConsoleMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\CloseAllViewsMessageQueueItem.cs\" />\r\n    <Compile Include=\"Data\\DataIdSerializer.cs\" />\r\n    <Compile Include=\"Data\\DataLocalizationFacade.cs\" />\r\n    <Compile Include=\"Data\\DataPropertyValueCollection.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\Debug\\DynamicTempTypeCreator.cs\" />\r\n    <Compile Include=\"Data\\GroupByPriorityAttribute.cs\" />\r\n    <Compile Include=\"Data\\Hierarchy\\DataAncestorProviders\\PageDataAncestorProvider.cs\" />\r\n    <Compile Include=\"Data\\DataLocalizationFacadeImpl.cs\" />\r\n    <Compile Include=\"Data\\IDataLocalizationFacade.cs\" />\r\n    <Compile Include=\"Data\\LocalizationScopeManager.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\ILocalizedDataProvider.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ILocalizedControlled.cs\" />\r\n    <Compile Include=\"Data\\Types\\IFlowInformation.cs\" />\r\n    <Compile Include=\"Data\\Types\\ISystemActiveLocale.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageStructure.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserActiveLocale.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserConsoleInformation.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\DataGroupingProviderHelper\\DataGroupingProviderHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\DataGroupingProviderHelper\\DataGroupingProviderHelperEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\ILocaleAwareElementProvider.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\IEnumerableExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\MethodInfoExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Linq\\PropertyInfoValueCollectioncs.cs\" />\r\n    <Compile Include=\"Core\\Localization\\LocalizationParser.cs\" />\r\n    <Compile Include=\"Core\\Localization\\LocalizationXmlConstants.cs\" />\r\n    <Compile Include=\"Core\\Linq\\ExpressionBuilder.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageDescription.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\ConfigurationTransformationPackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\ConfigurationTransformationPackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageInstallerUninstallerFactory.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageManagerInstallProcess.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageManagerUninstallProcess.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageServerFacade.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageServerFacadeImpl.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageServerFacadeLocalMock.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageSystemServices.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageInformation.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\Foundation\\PackageManagerInstallProcessSerializerHandler.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\Foundation\\PackageManagerUninstallProcessSerializerHandler.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\Foundation\\PackageServerFacadeImplCache.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\Foundation\\InstalledPackageInformationSerializerHandler.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\Foundation\\SystemLockingType.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\Foundation\\VersionStringHelper.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\Foundation\\XmlHelper.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\IPackageInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\IPackageInstallerUninstallerFactory.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\IPackageServerFacade.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\IPackageUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\InstalledPackageInformation.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\WebServiceClient\\Reference.cs\" />\r\n    <Compile Include=\"Core\\Application\\ApplicationOnlineHandlerFacade.cs\" />\r\n    <Compile Include=\"Core\\Application\\ApplicationOnlineHandlerFacadeImpl.cs\" />\r\n    <Compile Include=\"Core\\Application\\Foundation\\PluginFacades\\ApplicationOnlineHandlerPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\Application\\IApplicationOnlineHandlerFacade.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationOnlineHandler\\ApplicationOnlineHandlerData.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationOnlineHandler\\IApplicationOnlineHandler.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationOnlineHandler\\NonConfigurableApplicationOnlineHandler.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationOnlineHandler\\Runtime\\ApplicationOnlineHandlerCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationOnlineHandler\\Runtime\\ApplicationOnlineHandlerDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationOnlineHandler\\Runtime\\ApplicationOnlineHandlerFactory.cs\" />\r\n    <Compile Include=\"Core\\Application\\Plugins\\ApplicationOnlineHandler\\Runtime\\ApplicationOnlineHandlerSettings.cs\" />\r\n    <Compile Include=\"Core\\Application\\TempDirectoryFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\Foundation\\ConsoleMessageQueueElementListValueXmlSerializer.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\LockSystemConsoleMessageQueueItem.cs\" />\r\n    <Compile Include=\"Data\\DataFacade.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataInterfaceAutoUpdater.cs\" />\r\n    <Compile Include=\"Data\\DataKeyPropertyCollection.cs\" />\r\n    <Compile Include=\"Data\\DataKeyPropertyCollectionExtensionMethods.cs\" />\r\n    <Compile Include=\"Data\\DataSerializerHandler.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataTypeDescriptorValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataFieldDescriptorValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DynamicTypeManager.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\IDynamicTypeManager.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataStoreExistenceVerifierImpl.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataProviderRegistryImpl.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\IDataProviderRegistry.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\IDataStoreExistenceVerifier.cs\" />\r\n    <Compile Include=\"Data\\GeneratedTypes\\GeneratedTypesFacadeImpl.cs\" />\r\n    <Compile Include=\"Data\\GeneratedTypes\\IGeneratedTypesFacade.cs\" />\r\n    <Compile Include=\"Data\\IDataFacade.cs\" />\r\n    <Compile Include=\"Data\\Types\\Foundation\\ExceptingSerializerHandler.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPackageServerSource.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\ByteArrayExtensionMethods.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\BindablePropertyAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\ControlValuePropertyAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreFunctions\\BooleanCheckFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreFunctions\\CompositeFunctionCall.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreFunctions\\NamedValueFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreFunctions\\NullCheckFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreFunctions\\ReplicatorFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreFunctions\\StaticMethodCallFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\BaseSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\BoolSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\ButtonUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\ButtonUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\CheckBoxUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\CheckBoxUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\ContainerUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\ContainerUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\InfoTableUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\DataReferenceSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\DateSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\DebugUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\DebugUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\EnumSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\FileUploadUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\FunctionCallDesignerUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\FunctionParameterDesignerUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\HeadingUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\IContainerUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\ITabbedContainerUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\MultiSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\QueryCallDefinitionsEditorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\SelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\SelectorUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\TextEditorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\TextInputUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\TextUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\ToolbarButtonUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\ToolbarButtonUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\TypeFieldDesignerUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\TypeSelectorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\TypeSelectorUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\XhtmlEditorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\XhtmlEditorUiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\CoreUiControls\\XmlFunctionsDefinitionsEditorUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\DataServices\\FormDefinitionFileMarkupProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\DataServices\\Foundation\\FormBuilder.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\DataServices\\Functions\\GetDataFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\DataServices\\Functions\\ListDataInterfacesFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\DataServices\\IFormDefinitionFile.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\DataServices\\UiControls\\EmbeddedForm.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\FormFlowEventHandlerDelegate.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\FormFlowRenderingService.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\FormFlowUiDefinition.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\Foundation\\PluginFacades\\UiContainerFactoryFactoryPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\IBindingsProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\IFormEventIdentifier.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\IFormFlowRenderingService.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\IFormMarkupProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\IUiContainer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\Plugins\\UiContainerFactory\\IUiContainerFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\Plugins\\UiContainerFactory\\NonConfigurableUiContainerFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\Plugins\\UiContainerFactory\\Runtime\\UiContainerFactoryCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\Plugins\\UiContainerFactory\\Runtime\\UiContainerFactoryDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\Plugins\\UiContainerFactory\\Runtime\\UiContainerFactoryFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\Plugins\\UiContainerFactory\\Runtime\\UiContainerFactorySettings.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\Plugins\\UiContainerFactory\\UiContainerFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\StandardEventIdentifiers.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\FormCompileException.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\FormDefinition.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\FormFactoryService.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\FormKeyTagNames.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\FormsPropertyAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\FormTreeCompiler.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompileContext.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompilePhases\\BuildFromXmlPhase.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompilePhases\\CreateProducersPhase.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompilePhases\\EvaluatePropertiesPhase.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompilePhases\\ExtractUiArtifactsPhase.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompilePhases\\UpdateXmlInformationPhase.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompilerGlobals.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompileTreeNodes\\CompileTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompileTreeNodes\\ElementCompileTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompileTreeNodes\\PropertyCompileTreeNode.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\CompileTreeNodes\\XmlSourceNodeInformation.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\FormTreeCompiler\\PropertyAssigner.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\PluginFacades\\FunctionFactoryPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\PluginFacades\\ProducerMediatorPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\PluginFacades\\UiControlFactoryPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Foundation\\UiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\IFormChannelIdentifier.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\IUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\FunctionFactory\\FunctionFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\FunctionFactory\\IFormFunction.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\FunctionFactory\\IFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\FunctionFactory\\NonConfigurableFunctionFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\FunctionFactory\\Runtime\\FunctionFactoryCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\FunctionFactory\\Runtime\\FunctionFactoryDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\FunctionFactory\\Runtime\\FunctionFactoryFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\FunctionFactory\\Runtime\\FunctionFactorySettings.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\ProducerMediator\\IProducerMediator.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\ProducerMediator\\NonConfigurableProducerMediator.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\ProducerMediator\\ProducerMediatorData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\ProducerMediator\\Runtime\\ProducerMediatorCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\ProducerMediator\\Runtime\\ProducerMediatorDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\ProducerMediator\\Runtime\\ProducerMediatorFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\ProducerMediator\\Runtime\\ProducerMediatorSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\UiControlFactory\\IUiControlFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\UiControlFactory\\NonConfigurableUiControlFactoryAssembler.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\UiControlFactory\\Runtime\\UiControlFactoryCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\UiControlFactory\\Runtime\\UiControlFactoryDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\UiControlFactory\\Runtime\\UiControlFactoryFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\UiControlFactory\\Runtime\\UiControlFactorySettings.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Plugins\\UiControlFactory\\UiControlFactoryData.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\RequiredValueAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\SchemaBuilder.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducerMediator.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\BindingProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\BindingsProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\BindProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\IBuildinProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\IfConditionProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\IfProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\IfWhenFalseProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\IfWhenTrueProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\LayoutProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\BuildinProducers\\ReadProducer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\FunctionProducerMediator.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\StandardProducerMediators\\UiControlProducerMediator.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\Flows\\StringBasedFormMarkupProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\WebChannel\\IClickableTabPanelControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\WebChannel\\IWebUiContainer.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\WebChannel\\IWebUiControl.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\WebChannel\\WebManagementChannel.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\WebChannel\\WebStandardsChannel.cs\" />\r\n    <Compile Include=\"C1Console\\Forms\\WebChannel\\WebUiHelpers.cs\" />\r\n    <Compile Include=\"Core\\Application\\AppDomainLocker.cs\" />\r\n    <Compile Include=\"Functions\\BaseRuntimeTreeNodeValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\IMetaFunctionProviderRegistry.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\MetaFunctionProviderRegistry.cs\" />\r\n    <Compile Include=\"Functions\\NamedFunctionCallValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\GlobalSettingsFacadeImpl.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\IGlobalSettingsFacade.cs\" />\r\n    <Compile Include=\"Core\\IO\\FileUtils.cs\" />\r\n    <Compile Include=\"Core\\IO\\Zip\\IZipFileSystem.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\CultureExtrator.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\IconResourceSystemFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\DataHookMapper.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\CompositeCollectionValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\ISerializerHandlerFacade.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\ISerializerHandler.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\IValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\IXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\PropertySerializerHandler.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SerializerHandlerAttribute.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SerializerHandlerFacade.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SerializerHandlerFacadeImpl.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SerializerHandlerValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SystemCollectionValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SystemPrimitivValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SystemSerializableValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SystemTypesValueXmlSerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\XmlSerializer.cs\" />\r\n    <Compile Include=\"Plugins\\Application\\ApplicationOnlineHandlers\\AspNetApplicationOnlineHandler\\AspNetApplicationOnlineHandler.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\DocumentFunctionsActionToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\AllFunctionsProviderActionExecutor.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\ViewUnpublishedItemsActionToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\LocalizationElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\LocalizationElementProviderRootEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderRootEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderInstalledPackageFolderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderInstalledPackageGroupFolderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderInstalledPackageItemEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderPackageSourcesFolderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderPackageSourcesItemEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderAvailablePackagesFolderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderAvailablePackagesGroupFolderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\PackageElementProviderAvailablePackagesItemEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\ClearServerCacheActionExecutor.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\ClearServerCacheActionToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\WorkflowHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\ViewUnpublishedItemsActionToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\ActiveLocalesFormsHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedInfoTableUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedToolbarButtonUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\ParseStringToObject.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\String\\JoinTwo.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\MediaFileSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Type\\DataTypeSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\ResourceSystem\\PropertyResourceProvider\\PropertyResourceProvider.cs\" />\r\n    <Compile Include=\"Core\\Types\\Foundation\\PluginFacades\\ITypeManagerTypeHandlerPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\Types\\Foundation\\PluginFacades\\TypeManagerTypeHandlerPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\Types\\ITypeManager.cs\" />\r\n    <Compile Include=\"Core\\Types\\TypeManager.cs\" />\r\n    <Compile Include=\"C1Console\\Users\\UserSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Users\\IUserSettingsFacade.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ClientValidationRuleSerializerHandler.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ClientValidationRuleFacade.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Foundation\\ClientValidationRuleTranslatorRegistry.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Foundation\\IClientValidationRuleTranslatorRegistry.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Foundation\\PluginFacades\\ClientValidationRuleTranslatorPluginFacade.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Foundation\\PluginFacades\\IClientValidationRuleTranslatorPluginFacade.cs\" />\r\n    <Compile Include=\"Data\\Validation\\IClientValidationRuleFacade.cs\" />\r\n    <Compile Include=\"Data\\Validation\\IValidationFacade.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ValidationFacade.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\GuidNotEmptyValidator.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\GuidNotEmptyAttribute.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\ConsoleInfo.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\ControlCompilerService.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\CookieHandler.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\ErrorServices.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowMediators\\ActionExecutionMediator.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowMediators\\ActionExecutionService.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowMediators\\FormFlowRendering\\FormFlowRenderingService.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowMediators\\FormFlowRendering\\FormFlowUiDefinitionRenderer.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowMediators\\FormFlowRendering\\IFormFlowWebRenderingService.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowMediators\\TreeServicesFacade.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowMediators\\ViewTransitionHelper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowMediators\\WebFlowUiMediator.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FlowPage.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Core\\WebClient\\FunctionCallEditor\\FunctionCallEditorStateSimple.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FunctionCallEditor\\IFunctionCallEditorState.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FunctionCallEditor\\TreeHelper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\FunctionUiHelper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\HttpModules\\AdministrativeAuthorizationHttpModule.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\HttpModules\\AdministrativeCultureSetterHttpModule.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\HttpModules\\AdministrativeDataScopeSetterHttpModule.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\HttpModules\\AdministrativeResponseFilterHttpModule.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\MediaUrlHelper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\PageUrlHelper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Presentation\\CssRequestHandler.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Presentation\\OutputTransformationManager.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\ScriptHandler.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\ActionTypeEnum.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\BindEntityTokenToViewParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\BroadcastMessageParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\CloseAllViewsParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\CloseViewParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\ConsoleAction.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\ConsoleMessageServiceFacade.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\DialogTypeEnum.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\DownloadFileParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\GetMessagesResult.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\LogEntryParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\LogLevelEnum.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\MessageBoxParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\OpenGenericViewParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\OpenViewDefinitionParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\OpenViewParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\RefreshTreeParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\SaveStatusParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\ConsoleMessageService\\ViewTypeEnum.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\LocalizationServiceObjects\\ClientLocale.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\LocalizationServiceObjects\\ClientLocales.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\LocalizationServiceObjects\\PageLocale.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\SecurityServiceObjets\\EntityPermissionDetails.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\SecurityServiceObjets\\UserPermissions.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ClientAction.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ClientActionCategory.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ClientElement.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ClientElementChangeDescriptor.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ClientLabeledProperty.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ClientProviderNameEntityTokenClientElementsTriple.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ClientProviderNameEntityTokenPair.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ExtensionMethods\\ElementActionExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\ExtensionMethods\\ElementExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\RefreshChildrenInfo.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\TreeServiceObjects\\RefreshChildrenParams.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Services\\WysiwygEditor\\MarkupTransformationServices.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Setup\\SetupServiceFacade.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Setup\\WebServiceClient\\Reference.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\StandardPlugins\\SessionStateProviders\\DefaultSessionStateProvider\\DefaultSessionStateProvider.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\StandardPlugins\\SessionStateProviders\\DefaultSessionStateProvider\\ISessionStateEntry.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\StandardPlugins\\SessionStateProviders\\DefaultSessionStateProvider\\SerializationUtil.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\StandardPlugins\\SessionStateProviders\\DefaultSessionStateProvider\\XmlSerializationWrapper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\State\\ISessionStateProvider.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\State\\Runtime\\SessionStateProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\State\\Runtime\\SessionStateProviderFactory.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\State\\Runtime\\SessionStateProviderSettings.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\State\\StateManager.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\BindingUpdatePanel.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\CheckBox.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\ClickButton.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\ComboBox.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\DataInput.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\Feedback.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\FieldMessage.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\Foundation\\BaseControl.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\Foundation\\ClientAttributes.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\Generic.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\HtmlEncodedPlaceHolder.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\PostBackDialog.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\Selector.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\TextArea.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\TextBox.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\ToolbarButton.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UiControlLib\\TreeNode.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UrlString.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Logging\\WFC\\ILogService.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Logging\\WFC\\LogEntry.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Logging\\WFC\\LogService.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\XhtmlPage.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Core\\WebClient\\XsltServices.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\ConditionalSetStateActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\EmptyDocumentFormActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\WarningDialogFormActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\RerenderViewActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\CustomEvent01HandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\CustomEvent02HandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\CustomEvent03HandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\CustomEvent04HandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\CustomEvent05HandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\IWorkflowRuntimeProviderRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\PluginFacades\\IWorkflowRuntimeProviderPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\PluginFacades\\WorkflowRuntimeProviderPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\WorkflowRuntimeProviderRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\IEventHandleFilter.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\WorkflowTaskManagerEvent.cs\" />\r\n    <Compile Include=\"Core\\Xml\\LimitedDepthXmlWriter.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XAttributeUtils.cs\" />\r\n    <Compile Include=\"Core\\IO\\Zip\\ZipFileSystem.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\Foundation\\PackageSystemSettings.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\IPackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\IPackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\BasePackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\BasePackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\DataTypePackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\DataTypePackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\DataPackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\DataPackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\DynamicDataTypePackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\DynamicDataTypePackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\FilePackageFragmentInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentInstallers\\FilePackageFragmentUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentValidationResult.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageFragmentValidationResultType.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageInstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageInstallerContext.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageManager.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageUninstaller.cs\" />\r\n    <Compile Include=\"Core\\PackageSystem\\PackageUninstallerContext.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Data\\DataXhtmlRenderingServices.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Data\\IDataXhtmlRenderer.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Data\\XhtmlRendererProviderAttribute.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Data\\XhtmlRenderingTypeEnum.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\HashSigner.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\HashValue.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\HookingFacadeEventArgs.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\HookingFacadeImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\IHookingFacade.cs\" />\r\n    <Compile Include=\"Core\\Caching\\RequestLifetimeCache.cs\" />\r\n    <Compile Include=\"Core\\Collections\\Generic\\DictionaryExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Collections\\Generic\\ResourceLocker.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\ConsoleFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\RebootConsoleMessageQueueItem.cs\" />\r\n    <Compile Include=\"Data\\IDataWrapper.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\Foundation\\DynamicTypesAlternateFormFacade.cs\" />\r\n    <Compile Include=\"Data\\FieldPositionAttribute.cs\" />\r\n    <Compile Include=\"Data\\DataProviderCopier.cs\" />\r\n    <Compile Include=\"Data\\GeneratedTypes\\GeneratedTypesHelper.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ActionRoleProviderAttribute.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ActionIconResourceHandleAttribute.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\IPublishControlledAuxiliary.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\IActionRoleProvider.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ProcessControllerAttributesFacade.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ProcessControllers\\DummyProcessControllers\\PublishDummyProcessController.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\PublishControlledAuxiliaryAttribute.cs\" />\r\n    <Compile Include=\"Data\\ProcessControllerTypeAttribute.cs\" />\r\n    <Compile Include=\"Data\\TitleAttribute.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataAssociationDescriptor.cs\" />\r\n    <Compile Include=\"Data\\PageMetaDataDescription.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataStoreExistenceVerifier.cs\" />\r\n    <Compile Include=\"Data\\Types\\IDynamicTypeFormDefinitionFile.cs\" />\r\n    <Compile Include=\"Data\\Types\\ILockingInformation.cs\" />\r\n    <Compile Include=\"Data\\Types\\Foundation\\PagePublishControlledAuxiliary.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPagePlaceholderContent.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageUnpublishSchedule.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserActivePerspective.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserDeveloperSettings.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserPermissionDefinitionPermissionType.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserSettings.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPagePublishSchedule.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUserPermissionDefinition.cs\" />\r\n    <Compile Include=\"Data\\NotReferenceable.cs\" />\r\n    <Compile Include=\"Data\\Types\\ExtensionMethods\\IMediaFileFolderExtensions.cs\" />\r\n    <Compile Include=\"Data\\Types\\ExtensionMethods\\IMediaFileExtensions.cs\" />\r\n    <Compile Include=\"Data\\Types\\ICompositionContainer.cs\" />\r\n    <Compile Include=\"Data\\Types\\IUser.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPageTemplateFile.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\VisualFunctionElementProviderHelper\\Foundation\\RenderingFunctionNames.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\VisualFunctionElementProviderHelper\\VisualFunctionElementProviderHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementActionSecurityExtensions.cs\" />\r\n    <Compile Include=\"Functions\\IDowncastableFunction.cs\" />\r\n    <Compile Include=\"Core\\Logging\\DebugLoggingScope.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\PageAssociationScopeEnum.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\RenderingElementNames.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Template\\TemplateInfo.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Template\\TemplatePlaceholdersInfo.cs\" />\r\n    <Compile Include=\"RuntimeInformation.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\AdministratorAutoCreator.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\BuildinPlugins\\BuildinLoginSessionStore\\BuildinLoginSessionStore.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\BuildinPlugins\\BuildinUserPermissionDefinitionProvider\\BuildinUserRoleDefinitionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\ConstructorBasedUserPermissionDefinition.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\PluginFacades\\UserRoleDefinitionProviderPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\ParentsFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\PermissionDescriptor.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\PermissionType.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserPermissionDefinitionProvider\\IUserPermissionDefinitionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserPermissionDefinitionProvider\\NonConfigurableUserPermissionDefinitionProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserPermissionDefinitionProvider\\Runtime\\UserPermissionDefinitionProviderCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserPermissionDefinitionProvider\\Runtime\\UserPermissionDefinitionProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserPermissionDefinitionProvider\\Runtime\\UserPermissionDefinitionProviderFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserPermissionDefinitionProvider\\Runtime\\UserPermissionDefinitionProviderSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\UserPerspectiveFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\UserPermissionDefinition.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\UserPermissionDefinitionProvider\\UserPermissionDefinitionProviderData.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\PermissionTypeFacade.cs\" />\r\n    <Compile Include=\"Functions\\BaseFunctionRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\XmlDataTypeStoresContainer.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ActionTokenProviderAttribute.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ProcessControllers\\GenericPublishProcessController\\GenericPublishProcessControllerActionType.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\IActionTokenProvider.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\IgnoreActionAttribute.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\MethodBasedFunctionAttribute.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\LocalOrdering\\DisplayLocalOrderingActionExecutor.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\LocalOrdering\\DisplayLocalOrderingActionToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\PageElementProviderActionTokenProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\ActivePerspectiveFormsHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\GlobalPermissionsFormsHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\UserElementProviderGroupEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\UserElementProviderGroupEntityTokenSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Data\\Types\\IFolderWhiteList.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\WebsiteEntity.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\WebsiteFileElementProviderRootEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\WebsiteFile.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\WebsiteFileElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\WebsiteFileEntityTokenSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\WebsiteFileSearchToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\WebsiteFolder.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\WebsiteFileElementProviderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\CustomUiControls\\TemplatedPageContentEditorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiContainerFactories\\Base\\BaseTemplatedUiContainerFactory.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiContainerFactories\\Base\\ITemplatedUiContainerFactoryData.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\Base\\BaseTemplatedUiControlFactory.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\Base\\ITemplatedUiControlFactoryData.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\UserControlBasedUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedDateTimeSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedBoolSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedHeadingUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\IDynamicTypeFunctionProvider.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\IDynamicTypeWidgetFunctionProvider.cs\" />\r\n    <Compile Include=\"GlobalInitializerFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\ActionTokenSerializer.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\UserElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\UserElementProviderEntityToken.cs\" />\r\n    <Compile Include=\"Functions\\FunctionParameterDescriptionAttribute.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Foundation\\DowncastableStandardFunctionBase.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Foundation\\StandardFunctionBase.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\AspNet\\LoadUserControlFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Constant\\GuidFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\GetDataReference.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\Filter\\CompoundFilter.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\Filter\\DataReferenceFilter.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\Filter\\Foundation\\ListPropertyNamesHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Pages\\GetPageIdFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\BoolEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\StringEndsWithPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\GuidEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\DecimalEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\DecimalGreaterThanPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\DecimalLessThanPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\IntegerEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\IntegerGreaterThanPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\IntegerLessThanPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\DateTimeEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\DateTimeGreaterThanPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\DateTimeLessThanPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\StringEqualsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\StringStartsWithPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Globalization\\AllCultures.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Globalization\\CurrentCulture.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\Filter\\ActivePageReferenceFilter.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\Filter\\FieldPredicatesFilter.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\GetInputParameterFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Integer\\IntSum.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Pages\\SitemapFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Predicates\\StringContainsPredicateFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Foundation\\StandardFunctionParameterProfile.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\String\\Join.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\String\\Split.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Validation\\DecimalPrecisionValidationFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Validation\\PasswordValidationFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\IDataGenerated\\GetXml.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\FormPostBoolValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\FormPostDecimalValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\FormPostGuidValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\FormPostIntegerValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\FormPostValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\FormPostXmlFormattedDateTimeValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\QueryStringXmlFormattedDateTimeValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\QueryStringBoolValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\QueryStringGuidValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\QueryStringDecimalValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\QueryStringIntegerValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Xslt\\Extensions\\GlobalizationXsltExtensionsFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Xslt\\Extensions\\DateFormattingXsltExtensionsFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Xslt\\Extensions\\MarkupParserXsltExtensionsFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Bool\\BoolSelectorWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\DataReference\\DataReferenceSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Date\\DateTimeSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\VisualXhtmlEditorWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\LoginProviderPlugins\\DataBasedFormLoginProvider\\DataBasedFormLoginProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\UserPermissionDefinitionProvider\\ConfigBasedUserPermissionDefinitionProvider\\ConfigBasedUserPermissionDefinitionProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\UserPermissionDefinitionProvider\\DataBaseUserPermissionDefinitionProvider\\DataBaseUserPermissionDefinitionProvider.cs\" />\r\n    <Compile Include=\"Core\\Types\\Foundation\\AssemblyFilenameCollection.cs\" />\r\n    <Compile Include=\"Core\\Types\\Foundation\\CompileUnitBaseTypeProber.cs\" />\r\n    <Compile Include=\"Core\\Types\\DynamicBuildManagerTypeCache.cs\" />\r\n    <Compile Include=\"Core\\Collections\\Generic\\ReadOnlyDictionary.cs\" />\r\n    <Compile Include=\"Core\\Collections\\Generic\\ReadOnlyList.cs\" />\r\n    <Compile Include=\"Core\\Collections\\INamespaceTreeBuilderLeafInfo.cs\" />\r\n    <Compile Include=\"Core\\Collections\\NamespaceTreeBuilder.cs\" />\r\n    <Compile Include=\"Core\\Collections\\NamespaceTreeBuilderFolder.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\OpenHandledViewMessageQueueItem.cs\" />\r\n    <Compile Include=\"Data\\AutoUpdatebleAttribute.cs\" />\r\n    <Compile Include=\"Data\\CachingAttribute.cs\" />\r\n    <Compile Include=\"Data\\Caching\\CachingEnumerator.cs\" />\r\n    <Compile Include=\"Data\\Caching\\CachingQueryable.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\CodeGeneration\\DataWrapperGenerator.cs\" />\r\n    <Compile Include=\"Data\\Caching\\DataCachingFacade.cs\" />\r\n    <Compile Include=\"Data\\Caching\\Foundation\\CachingQueryableCache.cs\" />\r\n    <Compile Include=\"Data\\Caching\\Foundation\\ChangeSourceExpressionVisitor.cs\" />\r\n    <Compile Include=\"Data\\Caching\\ICachingQueryable.cs\" />\r\n    <Compile Include=\"Data\\CodeGeneratedAttribute.cs\" />\r\n    <Compile Include=\"Data\\DataAssociationAttribute.cs\" />\r\n    <Compile Include=\"Data\\DataAttributeFacade.cs\" />\r\n    <Compile Include=\"Data\\ForeignKeyAttribute.cs\" />\r\n    <Compile Include=\"Data\\DataReferenceFacade.cs\" />\r\n    <Compile Include=\"Data\\ForeignPropertyInfo.cs\" />\r\n    <Compile Include=\"Data\\DataScope.cs\" />\r\n    <Compile Include=\"Data\\DataScopeAttribute.cs\" />\r\n    <Compile Include=\"Data\\DataScopeIdentifier.cs\" />\r\n    <Compile Include=\"Data\\DataScopeManager.cs\" />\r\n    <Compile Include=\"Data\\DefaultFieldValueAttribute.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataTypeDescriptorFormsHelper.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DynamicTypeMarkupServices.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\Foundation\\DynamicTypeReflectionFacade.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\CodeGeneratedAttribute.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataFieldFormRenderingProfile.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataAssociationRegistry.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataExpressionBuilder.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataReferenceRegistry.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\ProcessControllerRegistry.cs\" />\r\n    <Compile Include=\"Data\\IDataIdExtensions.cs\" />\r\n    <Compile Include=\"Data\\LabelPropertyNameAttribute.cs\" />\r\n    <Compile Include=\"Data\\RelevantToUserTypeAttribute.cs\" />\r\n    <Compile Include=\"Data\\UserTypeEnum.cs\" />\r\n    <Compile Include=\"Data\\DataMetaDataFacade.cs\" />\r\n    <Compile Include=\"Data\\GeneratedTypes\\GeneratedTypesFacade.cs\" />\r\n    <Compile Include=\"Data\\IDataExtensions.cs\" />\r\n    <Compile Include=\"Data\\IDataReference.cs\" />\r\n    <Compile Include=\"Data\\DataReference.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\IGeneratedTypesDataProvider.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\Streams\\TransactionFileSystemFileStreamManager.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\IProcessControlled.cs\">\r\n      <SubType>Code</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Data\\ProcessControlled\\IProcessController.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\IPublishControlled.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\IPublishProcessController.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ProcessControllerFacade.cs\" />\r\n    <Compile Include=\"Data\\StoreSortOrderAttribute.cs\" />\r\n    <Compile Include=\"Data\\Types\\IImageFile.cs\" />\r\n    <Compile Include=\"Data\\Types\\StoreIdFilter\\Foundation\\IStoreIdFilterQueryable.cs\" />\r\n    <Compile Include=\"Data\\Types\\StoreIdFilter\\Foundation\\StoreIdFilterQueryableCache.cs\" />\r\n    <Compile Include=\"Data\\Types\\StoreIdFilter\\Foundation\\StoreIdFilterQueryableExpressionVisitor.cs\" />\r\n    <Compile Include=\"Data\\Types\\StoreIdFilter\\Foundation\\StoreIdFilterQueryableChangeSourceExpressionVisitor.cs\" />\r\n    <Compile Include=\"Data\\Types\\StoreIdFilter\\StoreIdFilterQueryable.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\ElementActionProviderFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementDragAndDropInfo.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\LabeledProperty.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\LabeledPropertyList.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\ICustomSearchElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\IDragAndDropElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\SearchToken.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\StreamExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Extensions\\StringExtensionMethods.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedTextEditorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedTypeFieldDesignerUiControlFactory.cs.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedNamedFunctionCallsDesignerUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedFunctionParameterDesignerUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedDataReferenceSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Functions\\Foundation\\FunctionContainer.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\MetaFunctionContainer.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\WidgetFunctionContainer.cs\" />\r\n    <Compile Include=\"Functions\\IFunctionResultToXEmbedableMapper.cs\" />\r\n    <Compile Include=\"Data\\Types\\IParameter.cs\" />\r\n    <Compile Include=\"Functions\\ManagedParameters\\ManagedParameterDefinition.cs\" />\r\n    <Compile Include=\"Functions\\ManagedParameters\\ManagedParameterManager.cs\" />\r\n    <Compile Include=\"Functions\\NamedFunctionCall.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\FunctionNotifier.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\WidgetFunctionNotifier.cs\" />\r\n    <Compile Include=\"Data\\Types\\IMediaFile.cs\" />\r\n    <Compile Include=\"Data\\Types\\IMediaFileFolder.cs\" />\r\n    <Compile Include=\"Data\\Types\\IMediaFileStore.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedFileUploadUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Core\\Xml\\XhtmlDocument.cs\" />\r\n    <Compile Include=\"Functions\\XElementParameterRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\Foundation\\NoopTimerProfiler.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\TimerProfiler.cs\" />\r\n    <Compile Include=\"Core\\Instrumentation\\TimerProfilerFacade.cs\" />\r\n    <Compile Include=\"Core\\IO\\MimeTypeInfo.cs\" />\r\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\r\n    <AppDesigner Include=\"Properties\\\" />\r\n    <Compile Include=\"C1Console\\Actions\\ActionExecutorAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\ActionExecutorFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\ActionResult.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\FlowControllerAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\FlowControllerFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\FlowControllerServicesContainer.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\FlowHandle.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\FlowToken.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\FlowUiDefinitionBase.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Foundation\\ActionExecutorCache.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\Foundation\\FlowExecutorCache.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\IActionExecutionService.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\IActionExecutor.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\IFlowController.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\IFlowControllerService.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\IFlowUiContainerType.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\IFlowUiDefinition.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\NullFlow.cs\" />\r\n    <Compile Include=\"C1Console\\Actions\\StandardUiContainerTypes.cs\" />\r\n    <Compile Include=\"Core\\Collections\\Generic\\CastEnumerable.cs\" />\r\n    <Compile Include=\"Core\\Collections\\Generic\\CastEnumerator.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\CloseViewMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\ConsoleMessageQueueFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\DialogTypeEnum.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\Foundation\\ConsoleMessageQueue.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\Foundation\\ConsoleMessageQueueElement.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\IConsoleMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\IManagementConsoleMessageService.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\LogEntryMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\ManagementConsoleMessageService.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\MessageBoxMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\OpenViewMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\RefreshTreeMessageQueueItem.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\ViewType.cs\" />\r\n    <Compile Include=\"Data\\BuildNewHandlerAttribute.cs\" />\r\n    <Compile Include=\"Data\\DataEntityToken.cs\" />\r\n    <Compile Include=\"Data\\DataEntityTokenExtensions.cs\" />\r\n    <Compile Include=\"Data\\DataEventSystemFacade.cs\" />\r\n    <Compile Include=\"Data\\DataFacadeImpl.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataProviderRegistry.cs\" />\r\n    <Compile Include=\"Data\\DataSourceId.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataFieldDescriptor.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataFieldDescriptorCollection.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataFieldIdEqualityComparer.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataFieldNameCollection.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataTypeChangeDescriptor.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DataTypeDescriptor.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DefaultValue.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\DynamicTypeManagerImpl.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\Foundation\\ReflectionBasedDataTypeDescriptorBuilder.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\NameValidation.cs\" />\r\n    <Compile Include=\"Data\\DynamicTypes\\StoreFieldType.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\CodeGeneration\\EmptyDataClassBase.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\CodeGeneration\\EmptyDataClassCodeGenerator.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataFacadeReflectionCache.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataFacadeQueryableExpressionVisitor.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataFacadeQueryableGathererExpressionVisitor.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\IDataFacadeQueryable.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\PluginFacades\\DataProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\SelectMethodInfoCache.cs\" />\r\n    <Compile Include=\"Data\\Hierarchy\\DataAncestorProviders\\NoAncestorDataAncestorProvider.cs\" />\r\n    <Compile Include=\"Data\\IBuildNewHandler.cs\" />\r\n    <Compile Include=\"Data\\IData.cs\" />\r\n    <Compile Include=\"Data\\IDataId.cs\" />\r\n    <Compile Include=\"Data\\ImmutableFieldIdAttribute.cs\" />\r\n    <Compile Include=\"Data\\ImmutableTypeIdAttribute.cs\" />\r\n    <Compile Include=\"Data\\KeyPropertyNameAttribute.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\Streams\\FileSystemFileBase.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\Streams\\FileSystemFileStreamManager.cs\" />\r\n    <Compile Include=\"Data\\Types\\IFileBuildNewHandler.cs\" />\r\n    <Compile Include=\"C1Console\\Drawing\\ImageTemplatedBoxCreator.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementHookRegistratorFacade.cs\" />\r\n    <Compile Include=\"Functions\\ConstantObjectParameterRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Functions\\ConstantParameterRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Functions\\ConstantValueProvider.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\FunctionTreeConfigurationNames.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\MetaFunctionProviderRegistryImpl.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\PluginFacades\\FunctionProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\PluginFacades\\FunctionWrapper.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\PluginFacades\\WidgetFunctionProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Functions\\Foundation\\PluginFacades\\WidgetFunctionWrapper.cs\" />\r\n    <Compile Include=\"Functions\\FunctionContextContainer.cs\" />\r\n    <Compile Include=\"Functions\\FunctionEventSystemFacade.cs\" />\r\n    <Compile Include=\"Functions\\FunctionFacade.cs\" />\r\n    <Compile Include=\"Functions\\FunctionParameterRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Functions\\FunctionRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Functions\\FunctionTreeBuilder.cs\" />\r\n    <Compile Include=\"Functions\\FunctionValueProvider.cs\" />\r\n    <Compile Include=\"Functions\\HelpDefinition.cs\" />\r\n    <Compile Include=\"Functions\\IFunction.cs\" />\r\n    <Compile Include=\"Functions\\IMetaFunction.cs\" />\r\n    <Compile Include=\"Functions\\IMetaFunctionExtensionMethods.cs\" />\r\n    <Compile Include=\"Functions\\BaseRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Functions\\BaseValueProvider.cs\" />\r\n    <Compile Include=\"Functions\\IWidgetFunction.cs\" />\r\n    <Compile Include=\"Functions\\NoValueValueProvider.cs\" />\r\n    <Compile Include=\"Functions\\ParameterList.cs\" />\r\n    <Compile Include=\"Functions\\ParameterProfile.cs\" />\r\n    <Compile Include=\"Functions\\BaseParameterRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\FunctionProviderData.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\IFunctionProvider.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\NonConfigurableFunctionProvider.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\Runtime\\FunctionProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\Runtime\\FunctionProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\Runtime\\FunctionProviderFactory.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\FunctionProvider\\Runtime\\FunctionProviderSettings.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\Runtime\\WidgetFunctionProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\Runtime\\WidgetFunctionProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\Runtime\\WidgetFunctionProviderFactory.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\Runtime\\WidgetFunctionProviderSettings.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\WidgetFunctionProviderData.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\IWidgetFunctionProvider.cs\" />\r\n    <Compile Include=\"Functions\\Plugins\\WidgetFunctionProvider\\NonConfigurableWidgetFunctionProvider.cs\" />\r\n    <Compile Include=\"Functions\\StandardWidgetFunctions.cs\" />\r\n    <Compile Include=\"Functions\\WidgetFunctionProvider.cs\" />\r\n    <Compile Include=\"Functions\\WidgetFunctionRuntimeTreeNode.cs\" />\r\n    <Compile Include=\"Core\\IO\\DirectoryUtils.cs\" />\r\n    <Compile Include=\"Core\\Linq\\TypeExtensions.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\PageStructureInfo.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\RequestInterceptorHttpModule.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\XEmbeddedControlMapper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\IXElementToControlMapper.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\XElementToAspNetExtensions.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Foundation\\PluginFacades\\ResourceProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Foundation\\ResourceProviderRegistry.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Icons\\BuildInIconProviderName.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\IResourceProvider.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\IStringResourceProvider.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\NonConfigurableResourceProvider.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\ResourceProviderData.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\Runtime\\ResourceProviderFactory.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\Runtime\\ResourceProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\Runtime\\ResourceProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Plugins\\ResourceProvider\\Runtime\\ResourceProviderSettings.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\StringResourceSystemFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\ActionToken.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Cryptography\\Cryptographer.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\EntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\EntityTokenSerializer.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\HookRegistratorRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\PluginFacades\\HookRegistratorPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\PluginFacades\\LoginProviderPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\RelationshipGraphLevelEnumerable.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\RelationshipGraphLevelEnumerator.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\SecurityAncestorFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\SecurityAncestorProviderCache.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\EntityTokenHook.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\HookingFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\ISecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\HookRegistrator\\HookRegistratorData.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\HookRegistrator\\IHookRegistrator.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\HookRegistrator\\NonConfigurableHookRegistrator.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\HookRegistrator\\Runtime\\HookRegistratorCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\HookRegistrator\\Runtime\\HookRegistratorDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\HookRegistrator\\Runtime\\HookRegistratorFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\HookRegistrator\\Runtime\\HookRegistratorSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\IFormLoginProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\ILoginProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\IWindowsLoginProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\LoginProviderData.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\NonConfigurableLoginProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\Runtime\\LoginProviderCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\Runtime\\LoginProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\Runtime\\LoginProviderFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginProvider\\Runtime\\LoginProviderSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\ILoginSessionStore.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\NonConfigurableLoginSessionStore.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\Runtime\\LoginSessionStoreCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\Runtime\\LoginSessionStoreDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\Runtime\\LoginSessionStoreFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\Runtime\\LoginSessionStoreSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Plugins\\LoginSessionStore\\LoginSessionStoreData.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Foundation\\PluginFacades\\LoginSessionStorePluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\RefreshBeforeAfterEntityTokenFinder.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\RefreshDeleteEntityTokenFinder.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\RelationshipGraph.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\RelationshipGraphLevel.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\RelationshipGraphNode.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\SecurityAncestorProviderAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\SecurityAncestorProviders\\NoAncestorSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\SecurityResolver.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\SecurityResult.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\SecurityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\UserToken.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\UserValidationFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\Utilities.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\FileSystemMediaFileProvider\\FileSystemMediaFile.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\FileSystemMediaFileProvider\\FileSystemMediaFileFolder.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\FileSystemMediaFileProvider\\FileSystemMediaFileProvider.cs\" />\r\n    <Compile Include=\"Data\\Types\\IMediaFileData.cs\" />\r\n    <Compile Include=\"Data\\Types\\IMediaFolderData.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MediaFileProvider\\MediaFile.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MediaFileProvider\\MediaFileFolder.cs\" />\r\n    <Compile Include=\"Data\\Types\\MediaFileDataAncesorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\VirtualImageFileProvider\\VirtualImageFile.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\VirtualImageFileProvider\\VirtualImageFileProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\Foundation\\InterfaceConfigurationManipulator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\Foundation\\XmlDataProviderStoreManipulator.cs\" />\r\n    <Compile Include=\"Data\\ProcessControlled\\ProcessControllers\\GenericPublishProcessController\\GenericPublishProcessController.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AssociatedDataElementProviderHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AssociatedDataElementProviderHelperEntityToken.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AssociatedDataElementProviderHelperSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\VisualFunctionProviderElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\GeneratedDataTypesElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\GeneratedDataTypesElementProviderRootEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\GeneratedDataTypesElementProviderSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\GeneratedDataTypesElementProviderTypeEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\MediaFileProviderElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\MediaFileProviderEntityTokenSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\MediaFileSearchToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\MediaRootFolderProviderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\BaseFunctionProviderElementProvider\\IFunctionTreeBuilderLeafInfo.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\WorkflowMediaFile.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\ZipMediaFileExtractor.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\PageElementProviderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\AllFunctionsElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\FlowUiQueryMarkupHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\XsltBasedFunctionProviderElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Compare\\AreEqualFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Compare\\IsLessThanFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Configuration\\AppSettingsValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Constant\\BooleanFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Constant\\DateTimeFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Constant\\DecimalFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Constant\\IntegerFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Constant\\StringFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Date\\AddDaysFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Date\\NowFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Foundation\\EntityTokenFactory.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Pages\\SitemapXmlFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Validation\\NotNullValidationFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Validation\\IntegerRangeValidationFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Validation\\RegexValidationFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\StandardFunctionProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\StandardFunctionProviderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Utils\\Validation\\StringLengthValidationFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Server\\ApplicationVariableFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Client\\BrowserStringFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Client\\BrowserTypeFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\CookieValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Client\\BrowserVersionFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Client\\BrowserPlatformFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Client\\IsMobileDeviceFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Client\\EcmaScriptVersionFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Client\\IsCrawlerFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\QueryStringValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Server\\ServerVariableFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Request\\SessionVariableFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Response\\SetCookieValueFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Web\\Response\\SetSessionVariableFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Xml\\LoadFileFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\StandardFunctionProvider\\Xml\\LoadUrlFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\MediaFileProvider\\MediaFileProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\SqlFunctionProviderElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\SqlFunctionProviderEntityTokenSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\SqlFunctionProviderFolderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\SqlFunctionProviderRootEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\MethodBasedFunctionProvider\\MethodBasedFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\SqlFunctionProvider\\SqlFunction.cs\" />\r\n    <Compile Include=\"Data\\Types\\ISqlConnection.cs\" />\r\n    <Compile Include=\"Data\\Types\\ISqlFunctionInfo.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\SqlFunctionProvider\\SqlFunctionProvider.cs\" />\r\n    <Compile Include=\"Data\\Types\\IVisualFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\VisualFunctionProvider\\RenderingHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\VisualFunctionProvider\\VisualFunctionProvider.cs\" />\r\n    <Compile Include=\"Data\\Types\\INamedFunctionCall.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\XsltBasedFunctionProvider\\RenderHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Bool\\CheckBoxWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Decimal\\DecimalTextBoxWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Foundation\\CompositeWidgetFunctionBase.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\BaseFunctionProviderElementProvider\\BaseFunctionFolderElementEntityTokenSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\BaseFunctionProviderElementProvider\\BaseFunctionFolderElementEntityTokenExtensions.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\VirtualElementProviderSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\BaseFunctionProviderElementProvider\\BaseFunctionProviderElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\BaseFunctionProviderElementProvider\\BaseFunctionFolderElementEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\MethodBasedFunctionProviderElementProvider.cs\" />\r\n    <Compile Include=\"Data\\Types\\IMethodBasedFunctionInfo.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\MethodBasedFunctionProvider\\MethodBasedDefaultValueAttribute.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\MethodBasedFunctionProvider\\MethodBasedFunctionProvider.cs\" />\r\n    <Compile Include=\"Data\\Types\\IXsltFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\FunctionProviders\\XsltBasedFunctionProvider\\XsltBasedFunctionProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Date\\DateSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Foundation\\EntityTokenFactory.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Foundation\\FormFunctionMarkupBuilder.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Guid\\GuidTextBoxWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\ImageSelectorWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\Integer\\IntegerTextBoxWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\StandardWidgetFunctionProviderEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\StandardWidgetFunctionProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\TextAreaWidgetFunction.cs\" />\r\n    <Compile Include=\"Plugins\\Functions\\WidgetFunctionProviders\\StandardWidgetFunctionProvider\\String\\TextBoxWidgetFuntion.cs\" />\r\n    <Compile Include=\"Plugins\\GlobalSettings\\GlobalSettingsProviders\\ConfigBasedGlobalSettingsProvider.cs\" />\r\n    <Compile Include=\"Data\\Foundation\\DataFacadeQueryable.cs\" />\r\n    <Compile Include=\"Data\\StoreFieldTypeAttribute.cs\" />\r\n    <Compile Include=\"Data\\PhysicalStoreFieldType.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\DataInterfaceValidator.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\DataProviderConfigurationServices.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\DataProviderContext.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\DataProviderData.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\IDataProvider.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\IDynamicDataProvider.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\IWritableDataProvider.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\NonConfigurableDataProvider.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\Runtime\\DataProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\Runtime\\DataProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\Runtime\\DataProviderFactory.cs\" />\r\n    <Compile Include=\"Data\\Plugins\\DataProvider\\Runtime\\DataProviderSettings.cs\" />\r\n    <Compile Include=\"Data\\Types\\IFile.cs\" />\r\n    <Compile Include=\"Data\\Types\\ExtensionMethods\\IFileExtensions.cs\" />\r\n    <Compile Include=\"Data\\Types\\IFileServices.cs\" />\r\n    <Compile Include=\"Data\\Types\\IPage.cs\" />\r\n    <Compile Include=\"Data\\Types\\IXmlPageTemplate.cs\" />\r\n    <Compile Include=\"Data\\Types\\PageServices.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementAction.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ActionCategory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ActionHandle.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ActionVisualizedData.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Element.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementDataExchangeService.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementHandle.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderContext.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHandle.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\ElementVisualizedData.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\ElementProviderRegistry.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Foundation\\PluginFacades\\ElementProviderPluginFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\IElementDataExchangeService.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\ElementProviderData.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\IDataExchangingElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\IElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\NonConfigurableElementProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\Runtime\\ElementProviderCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\Runtime\\ElementProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\Runtime\\ElementProviderFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Elements\\Plugins\\ElementProvider\\Runtime\\ElementProviderSettings.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\Foundation\\UserControlUtils.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiContainerFactories\\TemplatedUiContainer.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiContainerFactories\\TemplatedUiContainerBase.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiContainerFactories\\TemplatedUiContainerFactory.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedButtonUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedCheckBoxUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedContainerUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedEnumSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedPreviewTabPanelUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedQueryCallDefinitionsEditorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedSelectorUiControlFactory.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedTextInputUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedTextUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedTypeSelectorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\TemplatedXhtmlEditorUiControlFactory.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\WebDebugUiControlFactory.cs\" />\r\n    <Compile Include=\"Plugins\\Forms\\WebChannel\\UiControlFactories\\WebEmbeddedFormUiControlFactory.cs\" />\r\n    <Compile Include=\"Data\\Hierarchy\\DataAncestorFacade.cs\" />\r\n    <Compile Include=\"Data\\Hierarchy\\DataAncestorProviderAttribute.cs\" />\r\n    <Compile Include=\"Data\\Hierarchy\\DataAncestorProviders\\PropertyDataAncestorProvider.cs\" />\r\n    <Compile Include=\"Data\\Hierarchy\\Foundation\\DataAncestorProviderCache.cs\" />\r\n    <Compile Include=\"Data\\Hierarchy\\IDataAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\PageElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\PageTemplateElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\PageTemplateRootEntityToken.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\BaseElementConfigurationElement.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\BaseElementNode.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\FolderElementConfigurationElement.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\FolderElementNode.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\ProviderHookingElementConfigurationElement.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\ProviderHookingElementNode.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\VirtualElementProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VirtualElementProvider\\VirtualElementProviderEntityToken.cs\" />\r\n    <Compile Include=\"Core\\Linq\\ExpressionCreator.cs\" />\r\n    <Compile Include=\"Core\\Linq\\ExpressionExtractor.cs\" />\r\n    <Compile Include=\"Core\\Linq\\ExpressionVisitors\\FindFirstParameterExpressionVisitor.cs\" />\r\n    <Compile Include=\"Core\\Linq\\Extensions.cs\" />\r\n    <Compile Include=\"Core\\Linq\\TypeHelpers.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\Renderings\\Page\\PageRenderer.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\IconResourceSystemFacadeImpl.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Icons\\CommonCommandIcons.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\Icons\\CommonElementIcons.cs\" />\r\n    <Compile Include=\"Core\\ResourceSystem\\ResourceHandle.cs\" />\r\n    <Compile Include=\"C1Console\\Security\\DataSecurityAncestorProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\Common\\PropertyNameMappingConfigurationElement.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\Common\\PropertyNameMappingConfigurationElementCollection.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\FileSystemDataProvider\\FileSystemDataProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\FileSystemDataProvider\\Foundation\\FileSystemFile.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\FileSystemDataProvider\\Foundation\\FileSystemFileDataId.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\FileSystemDataProvider\\Foundation\\FileSystemFileGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\CodeGeneration\\GeneretedClassesMethodCache.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\CodeGeneration\\DataIdClassGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\CodeGeneration\\DataProviderHelperClassGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\CodeGeneration\\DataWrapperClassGenerator.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\Foundation\\XmlDataProviderDocumentCache.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\IXElementWrapper.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\IXmlDataProviderHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Data\\DataProviders\\XmlDataProvider\\XmlDataProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Logging\\LogTraceListeners\\ManagementConsoleLogTracer\\ManagementConsoleLogTracer.cs\" />\r\n    <Compile Include=\"Plugins\\ResourceSystem\\XmlStringResourceProvider\\XmlStringResourceProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\HookRegistrators\\ElementHookRegistrator\\ElementHookRegistrator.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\LoginProviderPlugins\\ConfigBasedFormLoginProvider\\ConfigBasedFormLoginProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\LoginProviderPlugins\\ValidateAllWindowsLoginProvider\\ValidateAllWindowsLoginProvider.cs\" />\r\n    <Compile Include=\"Plugins\\Security\\LoginSessionStores\\HttpContextBasedLoginSessionStore\\HttpContextBasedLoginSessionStore.cs\" />\r\n    <Compile Include=\"Plugins\\Validation\\ClientValidationRuleTranslators\\StandardClientValidationRuleTranslator\\StandardClientValidationRuleTranslator.cs\" />\r\n    <Compile Include=\"Plugins\\Workflow\\WorkflowRuntimeProviders\\StandardWorkflowRuntimeProvider\\StandardWorkflowRuntimeProvider.cs\" />\r\n    <Compile Include=\"Data\\Types\\IXsltFile.cs\" />\r\n    <Compile Include=\"Data\\Transactions\\TransactionsFacade.cs\" />\r\n    <Compile Include=\"Core\\Types\\DataReferenceLabelPair.cs\" />\r\n    <Compile Include=\"Core\\Types\\ExtendedNullable.cs\" />\r\n    <Compile Include=\"Core\\Types\\GenericComparer.cs\" />\r\n    <Compile Include=\"Core\\Types\\KeyValuePair.cs\" />\r\n    <Compile Include=\"Core\\Types\\NameTypePair.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\ConfigurationServices.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\NameTypeManagerTypeConfigurationElement.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\NameTypeManagerTypeConfigurationElementCollection.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\SimpleNameTypeConfigurationElement.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\SimpleNameTypeConfigurationElementCollection.cs\" />\r\n    <Compile Include=\"C1Console\\Events\\GlobalEventSystemFacade.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\BuildinPlugins\\GlobalSettingsProvider\\BuildinGlobalSettingsProvider.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\GlobalSettingsFacade.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Plugins\\GlobalSettingsProvider\\GlobalSettingsProviderData.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Foundation\\PluginFacades\\GlobalSettingsProviderPluginFacade.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Plugins\\GlobalSettingsProvider\\IGlobalSettingsProvider.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Plugins\\GlobalSettingsProvider\\NonConfigurableGlobalSettingsProvider.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Plugins\\GlobalSettingsProvider\\Runtime\\GlobalSettingsProviderCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Plugins\\GlobalSettingsProvider\\Runtime\\GlobalSettingsProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Plugins\\GlobalSettingsProvider\\Runtime\\GlobalSettingsProviderFactory.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\Plugins\\GlobalSettingsProvider\\Runtime\\GlobalSettingsProviderSettings.cs\" />\r\n    <Compile Include=\"Core\\IO\\PathUtil.cs\" />\r\n    <Compile Include=\"Core\\Logging\\LoggingService.cs\" />\r\n    <Compile Include=\"Core\\Logging\\LogLevel.cs\" />\r\n    <Compile Include=\"Core\\Logging\\NullLogTraceListener.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\CodeGeneration\\Foundation\\ISerializer.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\CodeGeneration\\PropertySerializerTypeCodeGenerator.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\SerializationFacade.cs\" />\r\n    <Compile Include=\"Core\\Serialization\\StringConversionServices.cs\" />\r\n    <Compile Include=\"Plugins\\Types\\TypeManagerTypeHandler\\DynamicBuildManagerTypeManagerTypeHandler\\DynamicBuildManagerTypeManagerTypeHandler.cs\" />\r\n    <Compile Include=\"Plugins\\Types\\TypeManagerTypeHandler\\SystemTypeManagerTypeHandler\\SystemTypeManagerTypeHandler.cs\" />\r\n    <Compile Include=\"Core\\Configuration\\TypeManagerTypeNameConverter.cs\" />\r\n    <Compile Include=\"Core\\Types\\BuildinPlugins\\BuildinTypeManagerTypeHandler\\BuildinTypeManagerTypeHandler.cs\" />\r\n    <Compile Include=\"Core\\Types\\Pair.cs\" />\r\n    <Compile Include=\"Core\\Types\\Plugins\\TypeManagerTypeHandler\\ITypeManagerTypeHandler.cs\" />\r\n    <Compile Include=\"Core\\Types\\Plugins\\TypeManagerTypeHandler\\NonConfigurableTypeManagerTypeHandler.cs\" />\r\n    <Compile Include=\"Core\\Types\\Plugins\\TypeManagerTypeHandler\\Runtime\\TypeManagerTypeHandlerCustomFactory.cs\" />\r\n    <Compile Include=\"Core\\Types\\Plugins\\TypeManagerTypeHandler\\Runtime\\TypeManagerTypeHandlerDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Core\\Types\\Plugins\\TypeManagerTypeHandler\\Runtime\\TypeManagerTypeHandlerFactory.cs\" />\r\n    <Compile Include=\"Core\\Types\\Plugins\\TypeManagerTypeHandler\\Runtime\\TypeManagerTypeHandlerSettings.cs\" />\r\n    <Compile Include=\"Core\\Types\\Plugins\\TypeManagerTypeHandler\\TypeManagerTypeHandlerData.cs\" />\r\n    <Compile Include=\"Core\\Types\\Foundation\\PluginFacades\\TypeManagerTypeHandlerPluginFacadeImpl.cs\" />\r\n    <Compile Include=\"Core\\Types\\PrimitiveTypes.cs\" />\r\n    <Compile Include=\"Core\\Types\\TypeExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Types\\TypeLocator.cs\" />\r\n    <Compile Include=\"Core\\Types\\TypeManagerImpl.cs\" />\r\n    <Compile Include=\"Core\\Types\\ValueTypeConverter.cs\" />\r\n    <Compile Include=\"Core\\Types\\ValueTypeConverterHelperAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Users\\UserSettingsImpl.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ClientValidationRuleFacadeImpl.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ClientValidationRules\\ClientValidationRule.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ClientValidationRules\\NotNullClientValidationRule.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ClientValidationRules\\RegexClientValidationRule.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ClientValidationRules\\StringLengthClientValidationRule.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ConstructorBasedPropertyValidatorBuilder.cs\" />\r\n    <Compile Include=\"Data\\Validation\\DataValidationResult.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Foundation\\ClientValidationRuleTranslatorRegistryImpl.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Foundation\\PluginFacades\\ClientValidationRuleTranslatorPluginFacadeImpl.cs\" />\r\n    <Compile Include=\"Data\\Validation\\IPropertyValidatorBuilder.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Plugins\\ClientValidationRuleTranslator\\ClientValidationRuleTranslatorData.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Plugins\\ClientValidationRuleTranslator\\IClientValidationRuleTranslator.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Plugins\\ClientValidationRuleTranslator\\NonConfigurableClientValidationRuleTranslator.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Plugins\\ClientValidationRuleTranslator\\Runtime\\ClientValidationRuleTranslatorCustomFactory.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Plugins\\ClientValidationRuleTranslator\\Runtime\\ClientValidationRuleTranslatorDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Plugins\\ClientValidationRuleTranslator\\Runtime\\ClientValidationRuleTranslatorFactory.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Plugins\\ClientValidationRuleTranslator\\Runtime\\ClientValidationRuleTranslatorSettings.cs\" />\r\n    <Compile Include=\"Data\\Validation\\PropertyValidatorBuilder.cs\" />\r\n    <Compile Include=\"Data\\Validation\\ValidationFacadeImpl.cs\" />\r\n    <Compile Include=\"Data\\Validation\\DataValidationResults.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\DecimalPrecisionValidator.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\DecimalPrecisionValidatorAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\NullStringLengthValidator.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\NullStringLengthValidatorAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\PasswordValidator.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\PasswordValidatorAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\IntegerRangeValidatorAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\RegexValidatorAttribute.cs\" />\r\n    <Compile Include=\"Data\\Validation\\Validators\\StringLengthValidatorAttribute.cs\" />\r\n    <Compile Include=\"Core\\WebClient\\UrlUtils.cs\" />\r\n    <Compile Include=\"Plugins\\Types\\TypeManagerTypeHandler\\AspNetBuildManagerTypeManagerTypeHandler\\AspNetBuildManagerTypeManagerTypeHandler.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\CancelHandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\CloseCurrentViewActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\ChildWorkflowDoneHandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\ExecuteChildWorkflowActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\DataDialogFormActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\ConfirmDialogFormActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\Foundation\\FormsWorkflowBindingCache.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\ShowFieldMessageActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\ShowConsoleMessageBoxActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\DocumentFormActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\FinishHandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\FormsWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\NextHandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\PreviewHandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\PreviousHandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\SaveHandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\SaveAndPublishHandleExternalEventActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\Activities\\WizardFormActivity.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Workflow\\ActivityExtensionMethods.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\AllowPersistingWorkflowAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\EntityTokenLockAttribute.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\FilePersistenceService.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\FormsEventArgs.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\FormData.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\FormsWorkflowActivityService.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\FormsWorkflowEventService.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\PluginFacades\\WorkflowRuntimeProviderPluginFacadeImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Foundation\\WorkflowRuntimeProviderRegistryImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\IFormsWorkflowActivityService.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\IFormsWorkflowEventService.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\IWorkflowFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Plugins\\WorkflowRuntimeProvider\\IWorkflowRuntimeProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Plugins\\WorkflowRuntimeProvider\\NonConfigurableWorkflowRuntimeProvider.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Plugins\\WorkflowRuntimeProvider\\Runtime\\WorkflowRuntimeProviderCustomFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Plugins\\WorkflowRuntimeProvider\\Runtime\\WorkflowRuntimeProviderDefaultNameRetriever.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Plugins\\WorkflowRuntimeProvider\\Runtime\\WorkflowRuntimeProviderFactory.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Plugins\\WorkflowRuntimeProvider\\Runtime\\WorkflowRuntimeProviderSettings.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\Plugins\\WorkflowRuntimeProvider\\WorkflowRuntimeProviderData.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\StateMachineWorkflowInstanceExtensionMethods.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\WorkflowActionExecutor.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\WorkflowActionToken.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\WorkflowFacade.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\WorkflowFacadeImpl.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\WorkflowFlowController.cs\" />\r\n    <Compile Include=\"C1Console\\Workflow\\WorkflowFlowToken.cs\" />\r\n    <Compile Include=\"Core\\Xml\\Namespaces.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XhtmlPrettifier.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XmlUtils.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XNodeExtensionMethods.cs\" />\r\n    <Compile Include=\"Core\\Xml\\XsltExtensionDefinition.cs\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Service Include=\"{3259AA49-8AA1-44D3-9025-A0B520596A8C}\" />\r\n    <Service Include=\"{508349B6-6B84-4DF5-91F0-309BEEBAD82D}\" />\r\n    <Service Include=\"{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"Core\\ResourceSystem\\LocalizationFiles.tt\">\r\n      <Generator>TextTemplatingFileGenerator</Generator>\r\n      <LastGenOutput>LocalizationFiles.cs</LastGenOutput>\r\n    </None>\r\n    <None Include=\"packages.config\">\r\n      <SubType>Designer</SubType>\r\n    </None>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Content Include=\"Data\\Types\\ExtensionMethods\\Use_parent_namespace.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Folder Include=\"Core\\Cloud\\\" />\r\n    <Folder Include=\"Core\\Logging\\WCF\\\" />\r\n    <Folder Include=\"Core\\Routing\\Plugins\\InternalUrls\\\" />\r\n    <Folder Include=\"Functions\\ManagedParameters\\Types\\\" />\r\n    <Folder Include=\"Functions\\Types\\\" />\r\n    <Folder Include=\"Plugins\\Elements\\Design\\\" />\r\n    <Folder Include=\"Plugins\\Functions\\FunctionProviders\\XsltBasedFunctionProvider\\XsltExtensions\\\" />\r\n    <Folder Include=\"Plugins\\Routing\\PageUrlProviders\\\" />\r\n    <Folder Include=\"Plugins\\WebClient\\SessionStateProviders\\DefaultSessionStateProvider\\\" />\r\n    <Folder Include=\"Plugins\\WebClient\\WebRequestHandlers\\LoginWebRequestHandler\\Resources\\\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Client.3.5\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5.SP1\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5 SP1</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.VisualBasic.PowerPacks.10.0\">\r\n      <Visible>False</Visible>\r\n      <ProductName>Microsoft Visual Basic PowerPacks 10.0</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Windows.Installer.3.1\">\r\n      <Visible>False</Visible>\r\n      <ProductName>Windows Installer 3.1</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n  </ItemGroup>\r\n  <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />\r\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r\n       Other similar extension points exist, see Microsoft.Common.targets.\r\n  <Import Project=\"$(MSBuildExtensionsPath)\\Microsoft\\Windows Workflow Foundation\\v3.5\\Workflow.Targets\" />\r\n  <Target Name=\"AfterBuild\">\r\n  </Target>\r\n  -->\r\n  <Target Name=\"BeforeBuild\">\r\n    <PropertyGroup>\r\n      <GitBranchFile>$(ProjectDir)git_branch.txt</GitBranchFile>\r\n      <GitCommitHashFile>$(ProjectDir)git_commithash.txt</GitCommitHashFile>\r\n    </PropertyGroup>\r\n    <Exec Condition=\"Exists('$(SolutionDir)\\.git')\" Command=\"git -C $(ProjectDir) rev-parse --abbrev-ref HEAD&gt; &quot;$(GitBranchFile)&quot;\" />\r\n    <Exec Condition=\"Exists('$(SolutionDir)\\.git')\" Command=\"git -C $(ProjectDir) rev-parse HEAD&gt; &quot;$(GitCommitHashFile)&quot;\" />\r\n    <Exec Condition=\"!Exists('$(SolutionDir)\\.git')\" Command=\"@echo unknown branch &gt; &quot;$(GitBranchFile)&quot;\" />\r\n    <Exec Condition=\"!Exists('$(SolutionDir)\\.git')\" Command=\"@echo unknown commit &gt; &quot;$(GitCommitHashFile)&quot;\" />\r\n    <PropertyGroup>\r\n      <GitBranch>$([System.IO.File]::ReadAllText(\"$(GitBranchFile)\").Trim())</GitBranch>\r\n      <GitCommitHash>$([System.IO.File]::ReadAllText(\"$(GitCommitHashFile)\").Trim())</GitCommitHash>\r\n      <AssemblyInformationalVersionAttribute>[assembly: System.Reflection.AssemblyInformationalVersion(\"$(GitBranch). Commit Hash: $(GitCommitHash)\")]</AssemblyInformationalVersionAttribute>\r\n    </PropertyGroup>\r\n    <WriteLinesToFile File=\"Properties\\GitCommitInfo.cs\" Lines=\"$(AssemblyInformationalVersionAttribute)\" Overwrite=\"true\">\r\n    </WriteLinesToFile>\r\n    <Exec Command=\"del &quot;$(GitBranchFile)&quot;\" />\r\n    <Exec Command=\"del &quot;$(GitCommitHashFile)&quot;\" />\r\n  </Target>\r\n  <PropertyGroup>\r\n    <PostBuildEvent>copy \"$(TargetPath)\" \"$(ProjectDir)..\\bin\\\"\r\ncopy \"$(TargetPath)\" \"$(ProjectDir)..\\Website\\bin\\\"</PostBuildEvent>\r\n  </PropertyGroup>\r\n</Project>"
  },
  {
    "path": "Composite/Composite.csproj.vspscc",
    "content": "﻿\"\"\r\n{\r\n\"FILE_VERSION\" = \"9237\"\r\n\"ENLISTMENT_CHOICE\" = \"NEVER\"\r\n\"PROJECT_FILE_RELATIVE_PATH\" = \"\"\r\n\"NUMBER_OF_EXCLUDED_FILES\" = \"0\"\r\n\"ORIGINAL_PROJECT_FILE_PATH\" = \"\"\r\n\"NUMBER_OF_NESTED_PROJECTS\" = \"0\"\r\n\"SOURCE_CONTROL_SETTINGS_PROVIDER\" = \"PROVIDER\"\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/AppDomainLocker.cs",
    "content": "﻿using System;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    /// <summary>\r\n    /// This class provides system wide locking throughout all app domains for the given C1 installation. \r\n    /// It does lock lock between C1 installations if more than one runs on the same machine.\r\n    /// </summary>\r\n    internal static class AppDomainLocker\r\n    {\r\n        private static readonly SystemGlobalSemaphore _semaphore = new SystemGlobalSemaphore(EventWaitHandleId);\r\n        private static int _numberOfLocksAcquired;\r\n        private static readonly object _numberOfLocksAcquiredLock = new object();\r\n\r\n\r\n        private const string _verboseLogEntryTitle = \"RGB(205, 92, 92)AppDomainLocker\";\r\n        private const string _warningLogEntryTitle = \"AppDomainLocker\";\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns an IDisposalbe and requires the lock. Disposing the IDisposable releases the lock.\r\n        /// </summary>\r\n        /// <param name=\"verbose\">If this is true, verbose logging is done. Default is false</param>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (AppDomainLocker.NewLock)\r\n        /// {\r\n        ///     /* This code will only run in one app domain at any time */\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        public static IDisposable NewLock(bool verbose = false)\r\n        {\r\n            return new DisposableLock(verbose);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the calling app domain has the lock.\r\n        /// </summary>\r\n        public static bool CurrentAppDomainHasLock => IsCurrentAppDomainLockingAppDomain();\r\n\r\n\r\n        /// <summary>\r\n        /// Acquires a system wide lock accross all app domains for the current C1 installation. \r\n        /// This call be called multiple times from the same thread.\r\n        /// To release the lock, call <see cref=\"ReleaseLock\"/>\r\n        /// </summary>\r\n        /// <param name=\"timeout\">Acquire lock timeout in milliseconds.</param>\r\n        /// <param name=\"verbose\">If this is false, no logging will be done.</param>\r\n        /// <returns>True if the lock was acquired.</returns>\r\n        public static bool AcquireLock(int timeout = 30000, bool verbose = true)\r\n        {\r\n            if (RuntimeInformation.AppDomainLockingDisabled) return true;\r\n\r\n\r\n            var appDomainId = AppDomain.CurrentDomain.Id;\r\n            var processId = Process.GetCurrentProcess().Id;\r\n\r\n            lock (_numberOfLocksAcquiredLock)\r\n            {\r\n                if (!IsCurrentAppDomainLockingAppDomain())\r\n                {\r\n                    if (verbose) Log.LogVerbose(_verboseLogEntryTitle,\r\n                        $\"The AppDomain '{appDomainId}', Process '{processId}': Are going to acquire the system wide lock with the key '{_semaphore.Id}'...\");\r\n\r\n                    bool entered = _semaphore.Enter(timeout);\r\n                    \r\n                    if (!entered)\r\n                    {\r\n                        string message = $\"The AppDomain '{appDomainId}', Process '{processId}': Failed to acquire the system wide lock with the key '{_semaphore.Id}' within the timeout period of {timeout} ms!!!\";\r\n                        Log.LogWarning(_warningLogEntryTitle, message);\r\n                        //throw new WaitHandleCannotBeOpenedException(message);\r\n                        return false;\r\n                    }\r\n\r\n\r\n                    if (verbose) Log.LogVerbose(_verboseLogEntryTitle,\r\n                        $\"The AppDomain '{appDomainId}', Process '{processId}': Acquired the system wide lock with the key '{_semaphore.Id}'!\");\r\n                }\r\n                else\r\n                {\r\n                    if (verbose) Log.LogVerbose(_verboseLogEntryTitle,\r\n                        $\"The AppDomain '{appDomainId}', Process '{processId}': Acquiring the lock that it is already holding the system wide lock with the key '{_semaphore.Id}' (Number of inner locks {_numberOfLocksAcquired + 1})\");\r\n                }\r\n\r\n                _numberOfLocksAcquired++;\r\n\r\n                return true;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Releases the acquired system wide lock. \r\n        /// If the same thread has acquired the lock more than once, only the last call to this method\r\n        /// from that thread will release the lock.         \r\n        /// </summary>\r\n        /// <param name=\"verbose\"></param>\r\n        /// <param name=\"forceRelease\">If this is true, the lock will be released regardless if the current app domain has it or not.</param>\r\n        /// <returns>If the lock was released</returns>\r\n        public static bool ReleaseLock(bool verbose = true, bool forceRelease = false)\r\n        {\r\n            if (RuntimeInformation.AppDomainLockingDisabled) return true;\r\n\r\n            var appDomainId = AppDomain.CurrentDomain.Id;\r\n            var processId = Process.GetCurrentProcess().Id;\r\n\r\n            lock (_numberOfLocksAcquiredLock)\r\n            {\r\n                if (!forceRelease && IsAllReleased())\r\n                {\r\n                    Log.LogWarning(_warningLogEntryTitle,\r\n                        $\"The AppDomain '{appDomainId}', Process '{processId}': Is trying to release a system wide lock with the key '{_semaphore.Id}' that it does not hold! Release ignored!\");\r\n                    return true;\r\n                }\r\n\r\n                if (forceRelease || IsLastReleaseForLockHoldingAppDomain())\r\n                {\r\n                    if (verbose) Log.LogVerbose(_verboseLogEntryTitle,\r\n                        $\"The AppDomain '{appDomainId}', Process '{processId}': Are going to release the system wide lock with the key '{_semaphore.Id}' (force: {forceRelease})...\");\r\n\r\n                    try\r\n                    {\r\n                        _semaphore.Leave();\r\n                    }\r\n                    catch(Exception)\r\n                    {\r\n                        return false;\r\n                    }\r\n\r\n                    if (verbose) Log.LogVerbose(_verboseLogEntryTitle,\r\n                        $\"The AppDomain '{appDomainId}', Process '{processId}': Released the system wide lock with the key '{_semaphore.Id}' (force: {forceRelease})...\");\r\n                }\r\n                else\r\n                {\r\n                    if (verbose) Log.LogVerbose(_verboseLogEntryTitle,\r\n                        $\"The AppDomain '{appDomainId}', Process '{processId}': Releasing a lock it has aqruired more than once with the key '{_semaphore.Id}'. Lock not released. (Number of inner locks {_numberOfLocksAcquired - 1})\");\r\n                }\r\n\r\n                if (!forceRelease) _numberOfLocksAcquired--;\r\n\r\n                return true;\r\n            }\r\n        }\r\n        \r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Used to name the EventWaitHandle, making it a system wide EventWaitHandle\r\n        /// </summary>\r\n        private static string EventWaitHandleId => RuntimeInformation.UniqueInstanceName;\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the current thread is the thread holding the lock\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        private static bool IsCurrentAppDomainLockingAppDomain() => _numberOfLocksAcquired > 0;\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if there will be no more releases for the lock holding thread.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        private static bool IsLastReleaseForLockHoldingAppDomain() => _numberOfLocksAcquired == 1;\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if all locks have been released.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        private static bool IsAllReleased() => _numberOfLocksAcquired == 0;\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Used for implementing the disposable pattern for <see cref=\"AppDomainLocker\"/>\r\n        /// </summary>\r\n        private class DisposableLock : IDisposable\r\n        {\r\n            private bool _disposed;\r\n            private readonly bool _verbose;\r\n\r\n            public DisposableLock(bool verbose = true)\r\n            {\r\n                _verbose = verbose;\r\n                AppDomainLocker.AcquireLock(verbose: _verbose);\r\n            }\r\n\r\n\r\n            public void Dispose()\r\n            {\r\n                Dispose(true);\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n\r\n\r\n            void Dispose(bool disposing)\r\n            {\r\n                if (!disposing || _disposed) return;\r\n\r\n                _disposed = true;\r\n\r\n                AppDomainLocker.ReleaseLock(verbose: _verbose);\r\n            }\r\n\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            ~DisposableLock()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n                Dispose(false);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/ApplicationOfflineCheckHttpModule.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n\tinternal class ApplicationOfflineCheckHttpModule: IHttpModule\r\n\t{\r\n\t    private static bool _isOffline;\r\n        private static string _responceHtml;\r\n\r\n        public void Init(HttpApplication context)\r\n        {\r\n            context.BeginRequest += HttpApplication_BeginRequest;\r\n        }\r\n\r\n        protected virtual void HttpApplication_BeginRequest(object sender, EventArgs e)\r\n        {\r\n            var context = ((HttpApplication)sender).Context;\r\n\r\n            if (!IsOffline ||\r\n                context.Request.FilePath.EndsWith(\"/Composite/services/LogService/LogService.svc\", StringComparison.OrdinalIgnoreCase))\r\n            {\r\n                return;\r\n            }\r\n\r\n            context.Response.Clear();\r\n            context.Response.Write(_responceHtml);\r\n            context.Response.StatusCode = 480; /* Temporary unavailable*/\r\n            context.Response.Flush();\r\n\r\n            context.ApplicationInstance.CompleteRequest();\r\n        }\r\n\r\n\t    public static bool IsOffline\r\n\t    {\r\n\t        get\r\n\t        {\r\n\t            return _isOffline;\r\n\t        }\r\n            set\r\n            {\r\n                _isOffline = value;\r\n                if(!_isOffline)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                string filePath = FilePath;\r\n                Verify.That(!filePath.IsNullOrEmpty(), \"Path to 'app_offline.html' has not been set\");\r\n                try\r\n                {\r\n                    _responceHtml = C1File.ReadAllText(filePath);\r\n                }\r\n                catch(Exception e)\r\n                {\r\n                    _responceHtml = string.Empty;\r\n                    Core.Logging.LoggingService.LogWarning(\"Failed to load file '{0}'\".FormatWith(filePath), e);\r\n                }\r\n            }\r\n\r\n\t    }\r\n\r\n        public static string FilePath { get; set; }\r\n\r\n        public void Dispose()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/ApplicationOnlineHandlerFacade.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ApplicationOnlineHandlerFacade\r\n    {\r\n        private static IApplicationOnlineHandlerFacade _applicationOnlineHandlerFacade = new ApplicationOnlineHandlerFacadeImpl();\r\n\r\n\r\n        internal static IApplicationOnlineHandlerFacade Implementation { get { return _applicationOnlineHandlerFacade; } set { _applicationOnlineHandlerFacade = value; } }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Turns application offline\r\n        /// </summary>\r\n        /// <param name=\"softTurnOff\">\r\n        /// Setting softTurnOff to true will only make the application offline to the client, but \r\n        /// not actually turning off the application. Setting this to false will turn off the \r\n        /// application.\r\n        /// </param>\r\n        public static void TurnApplicationOffline(bool softTurnOff)\r\n        {\r\n            _applicationOnlineHandlerFacade.TurnApplicationOffline(softTurnOff, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void TurnApplicationOffline(bool softTurnOff, bool recompileCompositeGenerated)\r\n        {\r\n            _applicationOnlineHandlerFacade.TurnApplicationOffline(softTurnOff, recompileCompositeGenerated);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool CanPutApplicationOffline(bool softTurnOff, out string errorMessage)\r\n        {\r\n            return _applicationOnlineHandlerFacade.CanPutApplicationOffline(softTurnOff, out errorMessage);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void TurnApplicationOnline()\r\n        {\r\n            _applicationOnlineHandlerFacade.TurnApplicationOnline();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IDisposable TurnOffScope(bool softTurnOff)\r\n        {\r\n            TurnApplicationOffline(softTurnOff);\r\n            return new TurnOffToken();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsApplicationOnline\r\n        {\r\n            get\r\n            {\r\n                return _applicationOnlineHandlerFacade.IsApplicationOnline;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private sealed class TurnOffToken : IDisposable\r\n        {\r\n            public void Dispose()\r\n            {\r\n                ApplicationOnlineHandlerFacade.TurnApplicationOnline();\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~TurnOffToken()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/ApplicationOnlineHandlerFacadeImpl.cs",
    "content": "﻿using System;\r\nusing System.Threading;\r\nusing System.Web.Hosting;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Application.Foundation.PluginFacades;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    internal class ApplicationOnlineHandlerFacadeImpl : IApplicationOnlineHandlerFacade\r\n    {\r\n        private static readonly string LogTitle = typeof (ApplicationOnlineHandlerFacadeImpl).Name;\r\n\r\n        private bool _isApplicationOnline = true;\r\n        private bool _wasLastTurnOffSoft = false;\r\n        private bool _recompileCompositeGenerated;\r\n        private ShutdownGuard _shutdownGuard;\r\n\r\n\r\n        public void TurnApplicationOffline(bool softTurnOff, bool recompileCompositeGenerated)\r\n        {\r\n            Verify.IsTrue(this.IsApplicationOnline, \"The application is already offline\");\r\n\r\n            Log.LogVerbose(\"ApplicationOnlineHandlerFacade\", string.Format(\"Turning off the application ({0})\", softTurnOff ? \"Soft\" : \"Hard\"));\r\n\r\n\r\n            _recompileCompositeGenerated = recompileCompositeGenerated;\r\n\r\n            _shutdownGuard = new ShutdownGuard();\r\n\r\n            try\r\n            {\r\n                if (softTurnOff == false)\r\n                {\r\n                    ApplicationOnlineHandlerPluginFacade.TurnApplicationOffline();\r\n                    Verify.IsFalse(ApplicationOnlineHandlerPluginFacade.IsApplicationOnline(), \"Plugin failed to turn the application offline\");\r\n                }\r\n                else\r\n                {\r\n                    ConsoleMessageQueueFacade.Enqueue(new LockSystemConsoleMessageQueueItem(), \"\");\r\n                }\r\n            }\r\n            catch(Exception)\r\n            {\r\n                _shutdownGuard.Dispose();\r\n                _shutdownGuard = null;\r\n\r\n                throw;\r\n            }\r\n\r\n            _isApplicationOnline = false;\r\n            _wasLastTurnOffSoft = softTurnOff;\r\n        }\r\n\r\n\r\n\r\n        public void TurnApplicationOnline()\r\n        {\r\n            Verify.IsFalse(this.IsApplicationOnline, \"The application is already online\");\r\n\r\n            Log.LogVerbose(\"ApplicationOnlineHandlerFacade\", \"Turning on the application\");\r\n\r\n            if (_recompileCompositeGenerated)\r\n            {\r\n                try\r\n                {\r\n                    CodeGenerationManager.GenerateCompositeGeneratedAssembly();\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, \"Failed to recompile Composite.Generated.dll\");\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }            \r\n\r\n            try\r\n            {\r\n                if (_wasLastTurnOffSoft == false)\r\n                {\r\n                    ApplicationOnlineHandlerPluginFacade.TurnApplicationOnline();\r\n                    Verify.IsTrue(ApplicationOnlineHandlerPluginFacade.IsApplicationOnline(), \"Plugin failed to turn the application online\");\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                // Adding a sleep, so delayed notification from FileWatcher will not kill a newly spawned AppDomain\r\n                Thread.Sleep(250);\r\n\r\n                _shutdownGuard.Dispose();\r\n                _shutdownGuard = null;\r\n\r\n                if (HostingEnvironment.IsHosted)\r\n                {\r\n                    HostingEnvironment.InitiateShutdown();\r\n                }\r\n            }\r\n\r\n            _isApplicationOnline = true;\r\n        }\r\n\r\n\r\n\r\n        public bool IsApplicationOnline\r\n        {\r\n            get\r\n            {\r\n                return _isApplicationOnline;\r\n            }\r\n        }\r\n\r\n\r\n        public bool CanPutApplicationOffline(bool softTurnOff, out string errorMessage)\r\n        {\r\n            if(softTurnOff)\r\n            {\r\n                errorMessage = null;\r\n                return true;\r\n            }\r\n\r\n            return ApplicationOnlineHandlerPluginFacade.CanPutApplicationOffline(out errorMessage);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/ApplicationStartupFacade.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Application.Foundation;\r\nusing Composite.Core.Application.Foundation.PluginFacades;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class ApplicationStartupFacade\r\n\t{\r\n        /// <exclude />\r\n        public static void FireConfigureServices(IServiceCollection serviceCollection)\r\n        {\r\n            foreach (string hanlderName in ApplicationStartupHandlerRegistry.ApplicationStartupHandlerNames)\r\n            {\r\n                ApplicationStartupHandlerPluginFacade.ConfigureServices(hanlderName, serviceCollection);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireBeforeSystemInitialize(IServiceProvider serviceProvider)\r\n        {\r\n            foreach (string hanlderName in ApplicationStartupHandlerRegistry.ApplicationStartupHandlerNames)\r\n            {\r\n                ApplicationStartupHandlerPluginFacade.OnBeforeInitialize(hanlderName, serviceProvider);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void FireSystemInitialized(IServiceProvider serviceProvider)\r\n        {\r\n            foreach (string hanlderName in ApplicationStartupHandlerRegistry.ApplicationStartupHandlerNames)\r\n            {\r\n                ApplicationStartupHandlerPluginFacade.OnInitialized(hanlderName, serviceProvider);\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Foundation/ApplicationStartupHandlerRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.Application.Foundation\r\n{\r\n\tinternal static class ApplicationStartupHandlerRegistry\r\n\t{\r\n        private static IApplicationStartupHandlerRegistry _applicationStartupHandlerRegistry = new ApplicationStartupHandlerRegistryImpl();\r\n\r\n\r\n        static ApplicationStartupHandlerRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        internal static IApplicationStartupHandlerRegistry Implementation { get { return _applicationStartupHandlerRegistry; } set { _applicationStartupHandlerRegistry = value; } }\r\n\r\n\r\n\r\n        public static IEnumerable<string> ApplicationStartupHandlerNames\r\n        {\r\n            get\r\n            {\r\n                return _applicationStartupHandlerRegistry.ApplicationStartupHandlerNames;\r\n            }\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _applicationStartupHandlerRegistry.Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Foundation/ApplicationStartupHandlerRegistryImpl.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.Application.Plugins.ApplicationStartupHandler;\r\nusing Composite.Core.Application.Plugins.ApplicationStartupHandler.Runtime;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Application.Foundation\r\n{\r\n    internal sealed class ApplicationStartupHandlerRegistryImpl : IApplicationStartupHandlerRegistry\r\n    {\r\n        private static List<string> _handlerNames = null;\r\n        private static object _lock = new object();\r\n\r\n        public IEnumerable<string> ApplicationStartupHandlerNames\r\n        {\r\n            get\r\n            {\r\n                Initialize();\r\n\r\n                foreach (string name in _handlerNames)\r\n                {\r\n                    yield return name;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            if (_handlerNames == null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_handlerNames == null)\r\n                    {\r\n                        _handlerNames = new List<string>();\r\n\r\n                        ApplicationStartupHandlerSettings applicationStartupHandlerSettings = ConfigurationServices.ConfigurationSource.GetSection(ApplicationStartupHandlerSettings.SectionName) as ApplicationStartupHandlerSettings;\r\n                        foreach (ApplicationStartupHandlerData applicationStartupHandlerData in applicationStartupHandlerSettings.ApplicationStartupHandlerPlugins)\r\n                        {\r\n                            _handlerNames.Add(applicationStartupHandlerData.Name);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _handlerNames = null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Foundation/IApplicationStartupHandlerRegistry.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Application.Foundation\r\n{\r\n\tinternal interface IApplicationStartupHandlerRegistry\r\n\t{\r\n        IEnumerable<string> ApplicationStartupHandlerNames { get; }\r\n        void Flush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Foundation/PluginFacades/ApplicationOnlineHandlerPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Composite.Core.Application.Plugins.ApplicationOnlineHandler;\r\nusing Composite.Core.Application.Plugins.ApplicationOnlineHandler.Runtime;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.Application.Foundation.PluginFacades\r\n{\r\n    internal static class ApplicationOnlineHandlerPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static ApplicationOnlineHandlerPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static void TurnApplicationOffline()\r\n        {\r\n            IApplicationOnlineHandler applicationOnlineHandler = GetApplicationOnlineHandler();\r\n\r\n            applicationOnlineHandler.TurnApplicationOffline();\r\n        }\r\n\r\n\r\n\r\n        public static void TurnApplicationOnline()\r\n        {\r\n            IApplicationOnlineHandler applicationOnlineHandler = GetApplicationOnlineHandler();\r\n\r\n            applicationOnlineHandler.TurnApplicationOnline();\r\n        }\r\n\r\n\r\n\r\n        public static bool IsApplicationOnline()\r\n        {\r\n            IApplicationOnlineHandler applicationOnlineHandler = GetApplicationOnlineHandler();\r\n\r\n            return applicationOnlineHandler.IsApplicationOnline();\r\n        }\r\n\r\n\r\n\r\n        public static bool CanPutApplicationOffline(out string errorMessage)\r\n        {\r\n            return GetApplicationOnlineHandler().CanPutApplicationOffline(out errorMessage);\r\n        }\r\n\r\n\r\n\r\n        private static IApplicationOnlineHandler GetApplicationOnlineHandler()\r\n        {\r\n            IApplicationOnlineHandler handler = null;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.HandlerCache == null)\r\n                {\r\n                    try\r\n                    {\r\n                        handler = _resourceLocker.Resources.Factory.CreateDefault();\r\n\r\n                        _resourceLocker.Resources.HandlerCache = handler;\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    handler = _resourceLocker.Resources.HandlerCache;\r\n                }\r\n            }\r\n\r\n            return handler;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", ApplicationOnlineHandlerSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public ApplicationOnlineHandlerFactory Factory { get; set; }\r\n            public IApplicationOnlineHandler HandlerCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new ApplicationOnlineHandlerFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.HandlerCache = null;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Foundation/PluginFacades/ApplicationStartupHandlerPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Application.Plugins.ApplicationOnlineHandler.Runtime;\r\nusing Composite.Core.Application.Plugins.ApplicationStartupHandler;\r\nusing Composite.Core.Application.Plugins.ApplicationStartupHandler.Runtime;\r\nusing Composite.Core.Collections.Generic;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\n\r\nnamespace Composite.Core.Application.Foundation.PluginFacades\r\n{\r\n    internal static class ApplicationStartupHandlerPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n        public static void ConfigureServices(string handlerName, IServiceCollection serviceCollection)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(handlerName, nameof(handlerName));\r\n            Verify.ArgumentNotNull(serviceCollection, nameof(serviceCollection));\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                IApplicationStartupHandler provider = GetApplicationStartupHandler(handlerName);\r\n\r\n                provider.ConfigureServices(serviceCollection);\r\n            }\r\n        }\r\n\r\n\r\n        public static void OnBeforeInitialize(string handlerName, IServiceProvider serviceProvider)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(handlerName, nameof(handlerName));\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                IApplicationStartupHandler provider = GetApplicationStartupHandler(handlerName);\r\n\r\n                provider.OnBeforeInitialize(serviceProvider);\r\n            }\r\n        }\r\n\r\n        public static void OnInitialized(string handlerName, IServiceProvider serviceProvider)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(handlerName, nameof(handlerName));\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                IApplicationStartupHandler provider = GetApplicationStartupHandler(handlerName);\r\n\r\n                provider.OnInitialized(serviceProvider);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IApplicationStartupHandler GetApplicationStartupHandler(string handlerName)\r\n        {\r\n            IApplicationStartupHandler applicationStartupHandler;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.ProviderCache.TryGetValue(handlerName, out applicationStartupHandler) == false)\r\n                {\r\n                    try\r\n                    {\r\n                        applicationStartupHandler = _resourceLocker.Resources.Factory.Create(handlerName);\r\n\r\n                        _resourceLocker.Resources.ProviderCache.Add(handlerName, applicationStartupHandler);\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return applicationStartupHandler;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", ApplicationOnlineHandlerSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public ApplicationStartupHandlerFactory Factory { get; set; }\r\n            public Dictionary<string, IApplicationStartupHandler> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new ApplicationStartupHandlerFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Dictionary<string, IApplicationStartupHandler>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/GlobalFileLocker.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.IO;\r\nusing System.Threading;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    /// <summary>\r\n    /// This class enables cross app domain/process locking using a file.\r\n    /// </summary>\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    internal class GlobalFileLocker\r\n    {\r\n        private string Id { get; set; }\r\n        private string GlobalLockFileName { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"id\">The id is used as part of a filename, so it should only contain file name valid chars.</param>\r\n        /// <param name=\"folderPath\">Default is temp directory.</param>\r\n        public GlobalFileLocker(string id, string folderPath = null)\r\n        {\r\n            LockTimeOut = 5;\r\n\r\n            if (folderPath == null)\r\n            {\r\n                folderPath = PathUtil.Resolve(GlobalSettingsFacade.TempDirectory);\r\n            }\r\n\r\n            Id = id;\r\n            GlobalLockFileName = Path.Combine(folderPath, id + \".lock\");\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Time out in seconds. Default is 5 secounds.\r\n        /// </summary>\r\n        public int LockTimeOut { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public IDisposable Lock\r\n        {\r\n            get\r\n            {\r\n                return new DisposableLock(this);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Consider using the <see cref=\"Lock\"/> for better code safty\r\n        /// </summary>\r\n        /// <param name=\"retryCount\"></param>\r\n        /// <param name=\"thrownOnFail\"></param>\r\n        /// <returns></returns>\r\n        public bool AquireLock(int retryCount = 50, bool thrownOnFail = false)\r\n        {\r\n            for (int i = 0; i < retryCount; i++)\r\n            {\r\n                bool lockObtained = TryAquireLock();\r\n                if (lockObtained) return true;\r\n                Thread.Sleep(0); // Context switch\r\n            }\r\n\r\n            string message = string.Format(\"Failed to obtain global file lock with id '{0}'\", Id);\r\n            Log.LogWarning(\"GlobalFileLocker\", message);\r\n\r\n            if (thrownOnFail) throw new InvalidOperationException(message);\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Consider using the <see cref=\"Lock\"/> for better code safty\r\n        /// </summary>\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void ReleaseLock()\r\n        {\r\n            if (File.Exists(GlobalLockFileName))\r\n            {\r\n                try\r\n                {\r\n                    File.Delete(GlobalLockFileName);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw new InvalidOperationException(\"Two or more threads tried to release at the same time. Check AquireLock and ReleaseLock usage.\", ex);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        private bool TryAquireLock()\r\n        {\r\n            double existingLockFileAgeSeconds =\r\n                File.Exists(GlobalLockFileName) ?\r\n                (DateTime.Now - File.GetLastWriteTime(GlobalLockFileName)).TotalSeconds :\r\n                -1; // Does not exist\r\n\r\n            if (existingLockFileAgeSeconds > LockTimeOut)\r\n            {\r\n                File.Delete(GlobalLockFileName);\r\n            }\r\n\r\n            string tmpFileName = GlobalLockFileName + \".\" + Path.GetRandomFileName();\r\n            File.WriteAllText(tmpFileName, \"LOCK\");\r\n\r\n            try\r\n            {\r\n                // Assumption: This is a system wide atomar action. If one already has the lock, the Move will fail.\r\n                File.Move(tmpFileName, GlobalLockFileName);\r\n                return true;\r\n            }\r\n            catch (IOException)\r\n            {\r\n                File.Delete(tmpFileName);\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Used for implementing the disposable pattern for <see cref=\"GlobalFileLocker\"/>\r\n        /// </summary>\r\n        private class DisposableLock : IDisposable\r\n        {\r\n            private bool disposed = false;\r\n            private GlobalFileLocker _globalFileLocker;\r\n\r\n\r\n            public DisposableLock(GlobalFileLocker globalFileLocker)\r\n            {\r\n                _globalFileLocker = globalFileLocker;\r\n                _globalFileLocker.AquireLock(thrownOnFail: true);\r\n            }\r\n\r\n\r\n            public void Dispose()\r\n            {\r\n                Dispose(true);\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n\r\n\r\n            protected virtual void Dispose(bool disposing)\r\n            {\r\n                if (!disposing || disposed) return;\r\n\r\n                disposed = true;\r\n\r\n                _globalFileLocker.ReleaseLock();\r\n            }\r\n\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            ~DisposableLock()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n                Dispose(false);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/IApplicationOnlineHandlerFacade.cs",
    "content": "﻿namespace Composite.Core.Application\r\n{\r\n\tinternal interface IApplicationOnlineHandlerFacade\r\n\t{\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"softTurnOff\">\r\n        /// Setting softTurnOff to true will only make the application offline to the client, but \r\n        /// not actually turning off the application. Setting this to false will turn off the \r\n        /// application.\r\n        /// </param>\r\n        /// <param name=\"recompileCompositeGenerated\">\r\n        /// Settings this to true will result in a recompilation of assemblies at startup\r\n        /// </param>\r\n        void TurnApplicationOffline(bool softTurnOff, bool recompileCompositeGenerated);\r\n\r\n        void TurnApplicationOnline();\r\n\r\n        bool IsApplicationOnline { get; }\r\n\r\n\t    bool CanPutApplicationOffline(bool softTurnOff, out string errorMessage);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Job.cs",
    "content": "﻿using System;\r\nusing System.Runtime.InteropServices;\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    enum JobObjectInfoType\r\n    {\r\n        AssociateCompletionPortInformation = 7,\r\n        BasicLimitInformation = 2,\r\n        BasicUIRestrictions = 4,\r\n        EndOfJobTimeInformation = 6,\r\n        ExtendedLimitInformation = 9,\r\n        SecurityLimitInformation = 5,\r\n        GroupInformation = 11\r\n    }\r\n\r\n    [StructLayout(LayoutKind.Sequential)]\r\n    struct SECURITY_ATTRIBUTES\r\n    {\r\n        public UInt32 nLength;\r\n        public IntPtr lpSecurityDescriptor;\r\n        public Int32 bInheritHandle;\r\n    }\r\n\r\n    [StructLayout(LayoutKind.Sequential)]\r\n    struct JOBOBJECT_BASIC_LIMIT_INFORMATION\r\n    {\r\n        public Int64 PerProcessUserTimeLimit;\r\n        public Int64 PerJobUserTimeLimit;\r\n        public UInt32 LimitFlags;\r\n        public UIntPtr MinimumWorkingSetSize;\r\n        public UIntPtr MaximumWorkingSetSize;\r\n        public UInt32 ActiveProcessLimit;\r\n        public UIntPtr Affinity;\r\n        public UInt32 PriorityClass;\r\n        public UInt32 SchedulingClass;\r\n    }\r\n\r\n    [StructLayout(LayoutKind.Sequential)]\r\n    struct IO_COUNTERS\r\n    {\r\n        public UInt64 ReadOperationCount;\r\n        public UInt64 WriteOperationCount;\r\n        public UInt64 OtherOperationCount;\r\n        public UInt64 ReadTransferCount;\r\n        public UInt64 WriteTransferCount;\r\n        public UInt64 OtherTransferCount;\r\n    }\r\n\r\n    [StructLayout(LayoutKind.Sequential)]\r\n    struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION\r\n    {\r\n        public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;\r\n        public IO_COUNTERS IoInfo;\r\n        public UIntPtr ProcessMemoryLimit;\r\n        public UIntPtr JobMemoryLimit;\r\n        public UIntPtr PeakProcessMemoryUsed;\r\n        public UIntPtr PeakJobMemoryUsed;\r\n    }\r\n\r\n    /// <summary>\r\n    /// An utility class for registering child processes that ensures that they will be killed if the current process crashes.\r\n    /// </summary>\r\n    internal class Job: IDisposable\r\n    {\r\n        [DllImport(\"kernel32.dll\", CharSet = CharSet.Unicode)]\r\n        static extern IntPtr CreateJobObject(IntPtr a, string lpName);\r\n\r\n        [DllImport(\"kernel32.dll\", SetLastError = true)]\r\n        static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoType infoType, IntPtr lpJobObjectInfo, uint cbJobObjectInfoLength);\r\n\r\n        [DllImport(\"kernel32.dll\", SetLastError = true)]\r\n        static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);\r\n\r\n        [DllImport(\"kernel32.dll\", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]\r\n        static extern bool CloseHandle(IntPtr handle);\r\n \r\n        private IntPtr m_handle;\r\n        private bool m_disposed = false;\r\n\r\n        public Job()\r\n        {\r\n            m_handle = CreateJobObject(IntPtr.Zero, null);\r\n\r\n            var info = new JOBOBJECT_BASIC_LIMIT_INFORMATION { LimitFlags = 0x2000 };\r\n\r\n            var extendedInfo = new JOBOBJECT_EXTENDED_LIMIT_INFORMATION { BasicLimitInformation = info };\r\n\r\n            int length = Marshal.SizeOf(typeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION));\r\n            IntPtr extendedInfoPtr = Marshal.AllocHGlobal(length);\r\n            Marshal.StructureToPtr(extendedInfo, extendedInfoPtr, false);\r\n\r\n            bool success = SetInformationJobObject(m_handle, JobObjectInfoType.ExtendedLimitInformation, extendedInfoPtr, (uint) length);\r\n            if (!success)\r\n            {\r\n                Log.LogError(typeof(Job).FullName, \"SetInformationJobObject returned error code \" + Marshal.GetLastWin32Error());\r\n            }\r\n        }\r\n\r\n        #region IDisposable Members\r\n\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~Job()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n        #endregion\r\n\r\n        private void Dispose(bool disposing)\r\n        {\r\n            if (m_disposed)\r\n                return;\r\n\r\n            if (disposing) { }\r\n\r\n            Close();\r\n            m_disposed = true;\r\n        }\r\n\r\n        public void Close()\r\n        {\r\n            CloseHandle(m_handle);\r\n            m_handle = IntPtr.Zero;\r\n        }\r\n\r\n        public bool AddProcess(IntPtr handle)\r\n        {\r\n            return AssignProcessToJobObject(m_handle, handle);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationOnlineHandler/ApplicationOnlineHandlerData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationOnlineHandler\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableApplicationOnlineHandler))]\r\n    internal class ApplicationOnlineHandlerData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationOnlineHandler/IApplicationOnlineHandler.cs",
    "content": "﻿using Composite.Core.Application.Plugins.ApplicationOnlineHandler.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationOnlineHandler\r\n{\r\n    [CustomFactory(typeof(ApplicationOnlineHandlerCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(ApplicationOnlineHandlerDefaultNameRetriever))]\r\n\tinternal interface IApplicationOnlineHandler\r\n\t{\r\n        void TurnApplicationOffline();\r\n        void TurnApplicationOnline();\r\n        bool IsApplicationOnline();\r\n        bool CanPutApplicationOffline(out string errorMessage);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationOnlineHandler/NonConfigurableApplicationOnlineHandler.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationOnlineHandler\r\n{\r\n    [Assembler(typeof(NonConfigurableApplicationOnlineHandlerAssembler))]\r\n    internal class NonConfigurableApplicationOnlineHandler : ApplicationOnlineHandlerData\r\n\t{\r\n\t}\r\n\r\n    internal sealed class NonConfigurableApplicationOnlineHandlerAssembler : IAssembler<IApplicationOnlineHandler, ApplicationOnlineHandlerData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IApplicationOnlineHandler Assemble(IBuilderContext context, ApplicationOnlineHandlerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IApplicationOnlineHandler)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationOnlineHandler/Runtime/ApplicationOnlineHandlerCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationOnlineHandler.Runtime\r\n{\r\n    internal sealed class ApplicationOnlineHandlerCustomFactory : AssemblerBasedCustomFactory<IApplicationOnlineHandler, ApplicationOnlineHandlerData>\r\n\t{\r\n        protected override ApplicationOnlineHandlerData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ApplicationOnlineHandlerSettings settings = configurationSource.GetSection(ApplicationOnlineHandlerSettings.SectionName) as ApplicationOnlineHandlerSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ApplicationOnlineHandlerSettings.SectionName));\r\n            }\r\n\r\n            return settings.ApplicationOnlineHandlerPlugins.Get(name);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationOnlineHandler/Runtime/ApplicationOnlineHandlerDefaultNameRetriever.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationOnlineHandler.Runtime\r\n{\r\n    internal sealed class ApplicationOnlineHandlerDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            if (null == configSource) throw new ArgumentNullException(\"configSource\");\r\n\r\n            if (null != name)\r\n            {\r\n                return name;\r\n            }\r\n            else\r\n            {\r\n                ApplicationOnlineHandlerSettings settings = configSource.GetSection(ApplicationOnlineHandlerSettings.SectionName) as ApplicationOnlineHandlerSettings;\r\n\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Could not load configuration section {0}\", ApplicationOnlineHandlerSettings.SectionName));\r\n                }\r\n\r\n                return settings.DefaultApplicationOnlineHandler;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationOnlineHandler/Runtime/ApplicationOnlineHandlerFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationOnlineHandler.Runtime\r\n{\r\n    internal sealed class ApplicationOnlineHandlerFactory : NameTypeFactoryBase<IApplicationOnlineHandler>\r\n\t{\r\n        public ApplicationOnlineHandlerFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationOnlineHandler/Runtime/ApplicationOnlineHandlerSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationOnlineHandler.Runtime\r\n{\r\n    internal sealed class ApplicationOnlineHandlerSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.Core.Application.Plugins.ApplicationOnlineHandlerConfiguration\";\r\n\r\n\r\n        private const string _defaultApplicationOnlineHandlerProviderProperty = \"defaultApplicationOnlineHandler\";\r\n        [ConfigurationProperty(_defaultApplicationOnlineHandlerProviderProperty, IsRequired = true)]\r\n        public string DefaultApplicationOnlineHandler\r\n        {\r\n            get { return (string)base[_defaultApplicationOnlineHandlerProviderProperty]; }\r\n            set { base[_defaultApplicationOnlineHandlerProviderProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _applicationOnlineHandlerPluginsProperty = \"ApplicationOnlineHandlerPlugins\";\r\n        [ConfigurationProperty(_applicationOnlineHandlerPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<ApplicationOnlineHandlerData> ApplicationOnlineHandlerPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<ApplicationOnlineHandlerData>)base[_applicationOnlineHandlerPluginsProperty];\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationStartupHandler/ApplicationStartupHandlerData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationStartupHandler\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableApplicationStartupHandler))]\r\n    internal class ApplicationStartupHandlerData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationStartupHandler/IApplicationStartupHandler.cs",
    "content": "﻿using System;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Composite.Core.Application.Plugins.ApplicationStartupHandler.Runtime;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationStartupHandler\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [CustomFactory(typeof(ApplicationStartupHandlerCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(ApplicationStartupHandlerDefaultNameRetriever))]\r\n\tpublic interface IApplicationStartupHandler\r\n\t{\r\n        /// <summary>\r\n        /// This handler will be called before Composite initialization. The data layer cannot be used here.\r\n        /// </summary>\r\n        void ConfigureServices(IServiceCollection serviceCollection);\r\n\r\n        /// <summary>\r\n        /// This handler will be called before Composite initialization. The data layer cannot be used here.\r\n        /// </summary>\r\n        void OnBeforeInitialize(IServiceProvider serviceProvider);\r\n\r\n        /// <summary>\r\n        /// This handler will be called after initialization of Composite core.\r\n        /// </summary>\r\n        void OnInitialized(IServiceProvider serviceProvider);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationStartupHandler/NonConfigurableApplicationStartupHandler.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationStartupHandler\r\n{\r\n    [Assembler(typeof(NonConfigurableApplicationStartupHandlerAssembler))]\r\n    internal sealed class NonConfigurableApplicationStartupHandler : ApplicationStartupHandlerData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableApplicationStartupHandlerAssembler : IAssembler<IApplicationStartupHandler, ApplicationStartupHandlerData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IApplicationStartupHandler Assemble(IBuilderContext context, ApplicationStartupHandlerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IApplicationStartupHandler)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationStartupHandler/Runtime/ApplicationStartupHandlerCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationStartupHandler.Runtime\r\n{\r\n    internal sealed class ApplicationStartupHandlerCustomFactory : AssemblerBasedCustomFactory<IApplicationStartupHandler, ApplicationStartupHandlerData>\r\n\t{\r\n        protected override ApplicationStartupHandlerData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ApplicationStartupHandlerSettings settings = configurationSource.GetSection(ApplicationStartupHandlerSettings.SectionName) as ApplicationStartupHandlerSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ApplicationStartupHandlerSettings.SectionName));\r\n            }\r\n\r\n            return settings.ApplicationStartupHandlerPlugins.Get(name);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationStartupHandler/Runtime/ApplicationStartupHandlerDefaultNameRetriever.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationStartupHandler.Runtime\r\n{\r\n    internal sealed class ApplicationStartupHandlerDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationStartupHandler/Runtime/ApplicationStartupHandlerFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationStartupHandler.Runtime\r\n{\r\n    internal sealed class ApplicationStartupHandlerFactory : NameTypeFactoryBase<IApplicationStartupHandler>\r\n\t{\r\n        public ApplicationStartupHandlerFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/Plugins/ApplicationStartupHandler/Runtime/ApplicationStartupHandlerSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Application.Plugins.ApplicationStartupHandler.Runtime\r\n{\r\n    internal sealed class ApplicationStartupHandlerSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.Core.Application.Plugins.ApplicationStartupHandlerConfiguration\";\r\n\r\n\r\n\r\n        private const string _applicationStartupPluginPluginsProperty = \"ApplicationStartupHandlerPlugins\";\r\n        [ConfigurationProperty(_applicationStartupPluginPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<ApplicationStartupHandlerData> ApplicationStartupHandlerPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<ApplicationStartupHandlerData>)base[_applicationStartupPluginPluginsProperty];\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/ShutdownGuard.cs",
    "content": "﻿using System;\r\nusing System.Reflection;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    /// <summary>\r\n    /// Postpones raising of shutdown event for ASP.NET\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ShutdownGuard : IDisposable\r\n    {\r\n        private readonly HttpRuntime _runtime;\r\n        private readonly FieldInfo _shutdownWebEventRaised_FieldInfo;\r\n\r\n        private readonly HostingEnvironment _hostingEnvironment;\r\n        private readonly FieldInfo _shutdownInitiated_FieldInfo;\r\n\r\n        //private readonly object _fileChangesManager;\r\n        //private readonly FieldInfo _callbackFieldInfo;\r\n        //private readonly FieldInfo _isFCNDisabledFieldInfo;\r\n        //private readonly object _savedCallbackValue;\r\n\r\n\r\n        /// <exclude />\r\n        public ShutdownGuard()\r\n        {\r\n            if (!HostingEnvironment.IsHosted)\r\n            {\r\n                return;\r\n            }\r\n\r\n            const BindingFlags getStaticFieldValue = BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField;\r\n            _runtime = (HttpRuntime)typeof(HttpRuntime).InvokeMember(\"_theRuntime\", getStaticFieldValue, null, null, null);\r\n            _hostingEnvironment = (HostingEnvironment)typeof(HostingEnvironment).InvokeMember(\"_theHostingEnvironment\", getStaticFieldValue, null, null, null);\r\n\r\n\r\n            const BindingFlags privateField = BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField;\r\n            _shutdownWebEventRaised_FieldInfo = typeof(HttpRuntime).GetField(\"_shutdownWebEventRaised\", privateField);\r\n\r\n            // In .NET 3.5 the field is called \"_shutdownInitated\"\r\n            //    .NET 4.0 the field is called \"_shutdownInitiated\"\r\n            _shutdownInitiated_FieldInfo = typeof(HostingEnvironment).GetField(\"_shutdownInitiated\", privateField)\r\n                                        ?? typeof(HostingEnvironment).GetField(\"_shutdownInitated\",  privateField);\r\n\r\n            // Simulating situation, when all events to unload current AppDomain were already raised.\r\n            _shutdownWebEventRaised_FieldInfo.SetValue(_runtime, true);\r\n            _shutdownInitiated_FieldInfo.SetValue(_hostingEnvironment, true);\r\n\r\n\r\n\r\n            //_fileChangesManager = runtime.GetType().GetField(\"_fcm\", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField).GetValue(runtime);\r\n\r\n            //_callbackFieldInfo = _fileChangesManager.GetType().GetField(\"_callbackRenameOrCriticaldirChange\",\r\n            //                                                                    BindingFlags.NonPublic |\r\n            //                                                                    BindingFlags.Instance |\r\n            //                                                                    BindingFlags.GetField);\r\n\r\n            //_isFCNDisabledFieldInfo = _fileChangesManager.GetType().GetField(\"_FCNMode\",\r\n            //                                                                    BindingFlags.NonPublic |\r\n            //                                                                    BindingFlags.Instance |\r\n            //                                                                    BindingFlags.GetField);\r\n\r\n            //_savedCallbackValue = _callbackFieldInfo.GetValue(_fileChangesManager);\r\n            //_callbackFieldInfo.SetValue(_fileChangesManager, null);\r\n\r\n            //// Turning off file change notifications. http://support.microsoft.com/kb/911272\r\n            //_isFCNDisabledFieldInfo.SetValue(_fileChangesManager, (Int32)1);\r\n\r\n\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n            if (!HostingEnvironment.IsHosted)\r\n            {\r\n                return;\r\n            }\r\n\r\n            _shutdownWebEventRaised_FieldInfo.SetValue(_runtime, false);\r\n            _shutdownInitiated_FieldInfo.SetValue(_hostingEnvironment, false);\r\n\r\n            //_callbackFieldInfo.SetValue(_fileChangesManager, _savedCallbackValue);\r\n            //_isFCNDisabledFieldInfo.SetValue(_fileChangesManager, (Int32)0);\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~ShutdownGuard()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/SystemGlobalSemaphore.cs",
    "content": "﻿using System;\r\nusing System.Threading;\r\nusing System.ComponentModel;\r\n\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    /// <summary>\r\n    /// This is a OS system wide named semaphore.\r\n    /// </summary>\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal class SystemGlobalSemaphore\r\n    {\r\n        private readonly string _id;\r\n        private readonly Semaphore _eventWaitHandle;\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"id\">The system wide id of the semaphore</param>\r\n        public SystemGlobalSemaphore(string id)\r\n        {\r\n            _id = id;\r\n            if (!_id.StartsWith(@\"Global\\\", StringComparison.InvariantCultureIgnoreCase))\r\n            {\r\n                _id = @\"Global\\\" + _id;\r\n            }\r\n\r\n            _eventWaitHandle = new Semaphore(1, 1, _id);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Enter the semaphore. Blocking. Returns false if entering the semaphore failed due to timeout.\r\n        /// </summary>\r\n        /// <param name=\"timeout\">Timeout in milliseconds</param>\r\n        /// <param name=\"throwOnTimeout\">If this is true, the method will throw an excepion on timeout</param>\r\n        /// <returns>True if entering successed. False if entering timed out.</returns>\r\n        public bool Enter(int timeout, bool throwOnTimeout = false)\r\n        {\r\n            bool entered = _eventWaitHandle.WaitOne(timeout);\r\n\r\n            if (!entered && throwOnTimeout) throw new TimeoutException(\r\n                $\"Failed to obtain the system global semaphore with id '{_id}'\");\r\n\r\n            return entered;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Leave the semaphore.\r\n        /// </summary>\r\n        public void Leave()\r\n        {\r\n            _eventWaitHandle.Release();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The used id used for naming the semaphore.\r\n        /// </summary>\r\n        public string Id => _id;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Application/TempDirectoryFacade.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient;\r\n\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class TempDirectoryFacade\r\n    {\r\n        private static TimeSpan TemporaryFileExpirationTimeSpan = TimeSpan.FromHours(24.0);\r\n\r\n        /// <exclude />\r\n        public static string CreateTempDirectory()\r\n        {\r\n            string directory = Path.Combine(TempDirectoryPath, UrlUtils.CompressGuid(Guid.NewGuid()));\r\n\r\n            C1Directory.CreateDirectory(directory);\r\n\r\n            return directory;\r\n        }\r\n\r\n\r\n        internal static string GetTempFileName(string extension)\r\n        {\r\n            return Path.Combine(TempDirectoryPath, UrlUtils.CompressGuid(Guid.NewGuid()).Substring(0, 8)) + (extension ?? \"\");\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void OnApplicationStart()\r\n        {\r\n            string tempDirectoryName = TempDirectoryPath;\r\n\r\n            if (!C1Directory.Exists(tempDirectoryName))\r\n            {\r\n                C1Directory.CreateDirectory(tempDirectoryName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void OnApplicationEnd()\r\n        {\r\n            // Deleting everything that is older than 24 hours\r\n            string tempDirectoryName = TempDirectoryPath;\r\n\r\n            if (!C1Directory.Exists(tempDirectoryName))\r\n            {\r\n                return;\r\n            }\r\n\r\n            \r\n\r\n            foreach (string filename in C1Directory.GetFiles(tempDirectoryName))\r\n            {\r\n                try\r\n                {\r\n                    if (DateTime.Now > C1File.GetLastWriteTime(filename) + TemporaryFileExpirationTimeSpan)\r\n                    {\r\n                        C1File.Delete(filename);\r\n                    }\r\n                }\r\n                catch \r\n                {\r\n                }\r\n            }\r\n\r\n            foreach (string directoryPath in C1Directory.GetDirectories(tempDirectoryName))\r\n            {\r\n                try\r\n                {\r\n                    if (DateTime.Now > C1Directory.GetCreationTime(directoryPath) + TemporaryFileExpirationTimeSpan)\r\n                    {\r\n                        C1Directory.Delete(directoryPath, true);\r\n                    }\r\n                }\r\n                catch \r\n                {\r\n                }\r\n            }\r\n        }\r\n\r\n        internal static string TempDirectoryPath\r\n        {\r\n            get { return PathUtil.Resolve(GlobalSettingsFacade.TempDirectory); }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/CacheManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Caching.Design;\r\n\r\nnamespace Composite.Core.Caching\r\n{\r\n    internal static class CacheManager\r\n    {\r\n        private static readonly Dictionary<string, ICache> _cacheCollection = new Dictionary<string, ICache>();\r\n\r\n        /// <summary>\r\n        /// Builds a cache instance from a configuration file.\r\n        /// </summary>\r\n        /// <typeparam name=\"TKey\">Key type.</typeparam>\r\n        /// <typeparam name=\"TValue\">Value type.</typeparam>\r\n        /// <param name=\"name\">The name of the cache.</param>\r\n        public static ICache<TKey, TValue> Get<TKey, TValue>(string name) where TValue : class\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        public static ICache<TKey, TValue> Get<TKey, TValue>(string name, CacheSettings cacheOptions) where TValue : class\r\n        {\r\n            name = name ?? string.Empty;\r\n            bool isNamed = name != string.Empty;\r\n\r\n            lock(_cacheCollection)\r\n            {\r\n                if(isNamed)\r\n                {\r\n                    if (_cacheCollection.ContainsKey(name))\r\n                    {\r\n                        return (ICache<TKey, TValue>)_cacheCollection[name];\r\n                    }\r\n                }\r\n\r\n                ICache<TKey, TValue> result;\r\n                switch (cacheOptions.CacheType)\r\n                {\r\n                    case CacheType.Lightweight:\r\n                        result = new LightweightCache<TKey, TValue>(name, cacheOptions);\r\n                        break;\r\n                    case CacheType.Mixed:\r\n                        Verify.That(typeof(TKey) == typeof(string), \"In mixed cache the key can only bee of type 'System.String'\");\r\n                        result = new MixedCache<TValue>(name, cacheOptions) as ICache<TKey, TValue>;\r\n                        break;\r\n                    case CacheType.Undefined:\r\n                        throw new InvalidOperationException(\"Cache type is undefined\");\r\n                    default:\r\n                        throw new NotImplementedException();\r\n                }\r\n\r\n                Verify.That(result != null, \"Failed to create a cache\");\r\n\r\n                _cacheCollection.Add(name != string.Empty ? name : \"unnamed cache\", result);\r\n\r\n                return result;\r\n            }\r\n        }\r\n\r\n        public static ICache[] GetAll()\r\n        {\r\n            lock(_cacheCollection)\r\n            {\r\n                ICollection<ICache> values = _cacheCollection.Values;\r\n\r\n                ICache[] result = new ICache[values.Count];\r\n                values.CopyTo(result, 0);\r\n                return result;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/CachePriority.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.Core.Caching\r\n{\r\n    internal enum CachePriority\r\n    {\r\n        Undefined = 0,\r\n        WeakReference = 1,\r\n        Low = 2,\r\n        Default = 3,\r\n        High = 4,\r\n        NeverExpires = 5\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/CacheSettings.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Caching\r\n{\r\n    internal sealed class CacheSettings\r\n    {\r\n        public CacheType CacheType { get; private set; }\r\n        public CachePriority DefaultPriority { get; private set; }\r\n\r\n        public int Size { get; set; }                             // Has sense only for lightweight/mixed cache\r\n        public TimeSpan SlidingExpritationPeriod { get; set; }    // Has sense for AspNet/Mixed cache\r\n\r\n        public CacheSettings(CacheType cacheType)\r\n        {\r\n            CacheType = cacheType;\r\n            SlidingExpritationPeriod = TimeSpan.Zero;\r\n            DefaultPriority = CachePriority.Default;\r\n            Size = -1; // Unlimited\r\n        }\r\n\r\n        public static CacheSettings AspNet\r\n        {\r\n            get { return new CacheSettings(CacheType.AspNet); }\r\n        }\r\n\r\n        public static CacheSettings Mixed\r\n        {\r\n            get { return new CacheSettings(CacheType.Mixed); }\r\n        }\r\n\r\n        public static CacheSettings WeakReferenceBased(int size)\r\n        {\r\n            return new CacheSettings(CacheType.Mixed) {Size = size, DefaultPriority = CachePriority.WeakReference};\r\n        }\r\n\r\n        public CacheSettings LightWeight(int size)\r\n        {\r\n            return new CacheSettings(CacheType.Lightweight) { Size = size };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/CacheStatistic.cs",
    "content": "﻿namespace Composite.Core.Caching\r\n{\r\n    internal abstract class CacheStatistic\r\n    {\r\n        public virtual string CacheName { get { return string.Empty; } }\r\n        public virtual int Size { get { return -1; } }\r\n        public virtual int Elements { get { return -1; } }\r\n        public virtual int AmountOfFlushes { get { return -1; } }\r\n        public virtual int Hits { get { return -1; } }\r\n        public virtual int Misses { get { return -1; } }\r\n        public virtual long ApproximatedMemoryUsage { get { return -1; } }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/CacheType.cs",
    "content": "﻿namespace Composite.Core.Caching\r\n{\r\n    internal enum CacheType\r\n    {\r\n        Undefined = 0,\r\n        /// <summary>\r\n        /// For \"lightweight\" objects\r\n        /// </summary>\r\n        Lightweight = 1, \r\n        /// <summary>\r\n        /// Standard ASP .NET cache\r\n        /// </summary>\r\n        AspNet = 2,      \r\n        /// <summary>\r\n        /// For \"heavy\" objects - based on weak references + asp.net caching\r\n        /// </summary>\r\n        Mixed = 3,       \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/Design/LightweightCache.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Caching.Design\r\n{\r\n    internal class LightweightCache<TKey, TValue> : ICache<TKey, TValue> where TValue : class\r\n    {\r\n        protected readonly Data.Caching.Cache<TKey, TValue> _innerCache;\r\n\r\n        public LightweightCache(string name, CacheSettings cacheOptions)\r\n        {\r\n            _innerCache = new Data.Caching.Cache<TKey, TValue>(name, cacheOptions.Size);\r\n        }\r\n\r\n        public TValue Get(TKey key)\r\n        {\r\n            return _innerCache.Get(key);\r\n        }\r\n\r\n        public bool TryGet(TKey key, out TValue value)\r\n        {\r\n            value = _innerCache.Get(key);\r\n            return value != null;\r\n        }\r\n\r\n        public void Add(TKey key, TValue value)\r\n        {\r\n            _innerCache.Add(key, value);\r\n        }\r\n\r\n        public void Add(TKey key, TValue value, CachePriority cachePriority)\r\n        {\r\n            Add(key, value);\r\n        }\r\n\r\n        public void Remove(TKey key)\r\n        {\r\n            _innerCache.Remove(key);\r\n        }\r\n\r\n        public void Clear()\r\n        {\r\n            _innerCache.Clear();\r\n        }\r\n\r\n        public string Name\r\n        {\r\n            get { return _innerCache.Name; }\r\n        }\r\n\r\n        public CacheStatistic GetStatistic()\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/Design/MixedCache.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing Composite.Data.Caching;\r\n\r\nnamespace Composite.Core.Caching.Design\r\n{\r\n    internal class MixedCache<TValue> : ICache<string, TValue> where TValue : class\r\n    {\r\n        private readonly WeakRefCache<string, TValue> _weakReferenceCache;\r\n        private readonly CachePriority _defaultPriority;\r\n        private readonly TimeSpan _slidingExpirationTime;\r\n        private readonly bool _useAspNetCacheByDefault;\r\n\r\n        private string _aspNetCachePrefix;\r\n\r\n        public MixedCache(string name, CacheSettings settings)\r\n        {\r\n            _weakReferenceCache = new WeakRefCache<string, TValue>(name, settings.Size);\r\n            _defaultPriority = settings.DefaultPriority;\r\n            _slidingExpirationTime = settings.SlidingExpritationPeriod;\r\n\r\n            _aspNetCachePrefix = \"MixedCache\" + Name;\r\n\r\n            _useAspNetCacheByDefault = _defaultPriority != CachePriority.WeakReference\r\n                                    && _defaultPriority != CachePriority.Undefined;\r\n        }\r\n\r\n        public TValue Get(string key)\r\n        {\r\n            TValue value = _weakReferenceCache.Get(key);\r\n\r\n            // \"Pinping\" asp.net cache\r\n            if(value != null)\r\n            {\r\n                var aspNetCachedValue = HttpRuntime.Cache.Get(GetAspNetKey(key)) as TValue;\r\n                if(_useAspNetCacheByDefault && aspNetCachedValue == null)\r\n                {\r\n                    // Putting resurrected item back to ASP .NET cache as a \"Low\" priority\r\n                    HttpRuntime.Cache.Add(key, value, null, DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Low, null);\r\n                }\r\n            }\r\n\r\n            return value;\r\n        }\r\n\r\n        public bool TryGet(string key, out TValue value)\r\n        {\r\n            value = Get(key);\r\n            return value != null;\r\n        }\r\n\r\n        public void Add(string key, TValue value)\r\n        {\r\n            Add(key, value, _defaultPriority);\r\n        }\r\n\r\n        public void Add(string key, TValue value, CachePriority cachePriority)\r\n        {\r\n            _weakReferenceCache.Add(key, value);\r\n\r\n            if(cachePriority == CachePriority.WeakReference \r\n                || cachePriority == CachePriority.Undefined)\r\n            {\r\n                return;\r\n            }\r\n\r\n            CacheItemPriority aspNetCachePriority;\r\n\r\n            switch (cachePriority)\r\n            {\r\n                case CachePriority.Low:\r\n                    aspNetCachePriority = CacheItemPriority.Low;\r\n                    break;\r\n                case CachePriority.High:\r\n                    aspNetCachePriority = CacheItemPriority.High;\r\n                    break;\r\n                case CachePriority.NeverExpires:\r\n                    aspNetCachePriority = CacheItemPriority.NotRemovable;\r\n                    break;\r\n                default:\r\n                    aspNetCachePriority = CacheItemPriority.Default;\r\n                    break;\r\n            }\r\n\r\n\r\n            string aspNetKey = GetAspNetKey(key);\r\n\r\n            HttpRuntime.Cache.Add(aspNetKey,\r\n                                  value,\r\n                                  null,\r\n                                  DateTime.MaxValue, \r\n                                  _slidingExpirationTime,\r\n                                  aspNetCachePriority,\r\n                                  null);\r\n        }\r\n\r\n        private string GetAspNetKey(string key)\r\n        {\r\n            return _aspNetCachePrefix + key;\r\n        }\r\n\r\n        public void Remove(string key)\r\n        {\r\n            _weakReferenceCache.Remove(key);\r\n            HttpRuntime.Cache.Remove(GetAspNetKey(key));\r\n        }\r\n\r\n        public void Clear()\r\n        {\r\n            _weakReferenceCache.Clear();\r\n        }\r\n\r\n        public string Name\r\n        {\r\n            get { return _weakReferenceCache.Name; }\r\n        }\r\n\r\n        public CacheStatistic GetStatistic()\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/FileRelatedDataCache.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\n\r\nnamespace Composite.Core.Caching\r\n{\r\n    /// <summary>\r\n    /// Caching for the data, related to specific files. Canche invalidated when LastWriteTime property of the file changes\r\n    /// </summary>\r\n    /// <typeparam name=\"CachedData\">Type of the cached data</typeparam>\r\n    internal class FileRelatedDataCache<CachedData> where CachedData: class\r\n    {\r\n        private static readonly string LogTitle = typeof(FileRelatedDataCache<>).Name;\r\n\r\n        private readonly string _cachefolder;\r\n        private readonly string _cacheName;\r\n        private readonly Action<CachedData, string> _serializer;\r\n        private readonly Func<string, CachedData> _deserializer;\r\n\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"FileRelatedDataCache{T}\" /> class.\r\n        /// </summary>\r\n        /// <param name=\"cacheDirectoryName\">Name of the folder to which cached files will be put.</param>\r\n        /// <param name=\"cacheName\">Name of the cache, used in the naming of cached files.</param>\r\n        /// <param name=\"toFileSerializer\">To file serializer.</param>\r\n        /// <param name=\"fromFileDeserializer\">From file deserializer.</param>\r\n        public FileRelatedDataCache(string cacheDirectoryName, string cacheName, Action<CachedData, string> toFileSerializer, Func<string, CachedData> fromFileDeserializer)\r\n        {\r\n            _cacheName = cacheName;\r\n            _serializer = toFileSerializer;\r\n            _deserializer = fromFileDeserializer;\r\n\r\n            string path = PathUtil.Resolve(GlobalSettingsFacade.CacheDirectory);\r\n\r\n            if (!string.IsNullOrEmpty(cacheDirectoryName))\r\n            {\r\n                path = Path.Combine(path, cacheDirectoryName);\r\n            }\r\n\r\n            _cachefolder = path;\r\n\r\n            if (!C1Directory.Exists(_cachefolder))\r\n            {\r\n                C1Directory.CreateDirectory(_cachefolder);\r\n            }\r\n        }\r\n\r\n        public void Add(string key, string relatedFile, CachedData cachedData) \r\n        {\r\n            Add(key, GetLastModifiedUtc(relatedFile), cachedData);\r\n        }\r\n\r\n        public void Add(string key, IEnumerable<string> relatedFiles, CachedData cachedData)\r\n        {\r\n            Add(key, GetLastModifiedUtc(relatedFiles), cachedData);\r\n        }\r\n\r\n        private void Add(string key, DateTime lastModifiedUtc, CachedData cachedData)\r\n        {\r\n            string cacheFilePath = GetCacheFilePath(key);\r\n\r\n            try\r\n            {\r\n                _serializer(cachedData, cacheFilePath);\r\n                C1File.SetCreationTimeUtc(cacheFilePath, lastModifiedUtc);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogWarning(LogTitle, \"Failed to add data to cache '{0}'. Key: '{1}'\", _cacheName, key);\r\n                Log.LogWarning(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n        public bool Get(string key, string relatedFile, out CachedData cachedData)\r\n        {\r\n            return Get(key, new[] { relatedFile }, out cachedData);\r\n        }\r\n\r\n        public bool Get(string key, string[] relatedFiles, out CachedData cachedData)\r\n        {\r\n            return Get(key, GetLastModifiedUtc(relatedFiles), out cachedData);\r\n        }\r\n\r\n        private static DateTime GetLastModifiedUtc(string filePath)\r\n        {\r\n            return C1File.GetLastWriteTimeUtc(filePath);\r\n        }\r\n\r\n        private static DateTime GetLastModifiedUtc(IEnumerable<string> relatedFiles)\r\n        {\r\n            DateTime maxLastModifiedUtc = DateTime.MinValue;\r\n\r\n            foreach (var filePath in relatedFiles)\r\n            {\r\n                if (!string.IsNullOrWhiteSpace(filePath) && C1File.Exists(filePath))\r\n                {\r\n                    DateTime lastModifiedUtc = C1File.GetLastWriteTimeUtc(filePath);\r\n                    if (lastModifiedUtc > maxLastModifiedUtc)\r\n                    {\r\n                        maxLastModifiedUtc = lastModifiedUtc;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return maxLastModifiedUtc;\r\n        }\r\n\r\n        private bool Get(string key, DateTime lastModifiedUtc, out CachedData cachedData)\r\n        {\r\n            string cacheFileName = GetCacheFilePath(key);\r\n\r\n            try\r\n            {\r\n                if (!C1File.Exists(cacheFileName) || C1File.GetCreationTimeUtc(cacheFileName) != lastModifiedUtc)\r\n                {\r\n                    cachedData = null;\r\n                    return false;\r\n                }\r\n\r\n                cachedData = _deserializer(cacheFileName);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogWarning(LogTitle, $\"Failed to load cached data. Cache '{key}', file: '{cacheFileName}'\");\r\n                Log.LogWarning(LogTitle, ex);\r\n\r\n                cachedData = null;\r\n                return false;\r\n            }\r\n            return true;\r\n        }\r\n\r\n        private string GetCacheFilePath(string key)\r\n        {\r\n            string nameHash = key.GetHashCode().ToString(CultureInfo.InvariantCulture);\r\n\r\n            return Path.Combine(_cachefolder, _cacheName + nameHash);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/ICache.cs",
    "content": "﻿namespace Composite.Core.Caching\r\n{\r\n    internal interface ICache\r\n    {\r\n        string Name { get; }\r\n        CacheStatistic GetStatistic();\r\n    }\r\n\r\n    internal interface ICache<TKey, TValue> : ICache where TValue : class\r\n    {\r\n        TValue Get(TKey key);\r\n        bool TryGet(TKey key, out TValue value);\r\n\r\n        void Add(TKey key, TValue value);\r\n        void Add(TKey key, TValue value, CachePriority cachePriority);\r\n\r\n        void Remove(TKey key);\r\n        void Clear();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Caching/RequestLifetimeCache.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing System.Runtime.Remoting.Messaging;\r\n\r\n\r\nnamespace Composite.Core.Caching\r\n{\r\n    // See http://piers7.blogspot.dk/2005/11/threadstatic-callcontext-and_02.html for details on HttpContext.Items vs. CallContext vs. ThreadStatic\r\n    /// <summary>\r\n    /// Cache for storing objects with a longevity limited to a single request. \r\n    /// Objects cached here are subject to garbage collection at some point after the request has completed.\r\n    /// Uses HttpContext.Items when available, otherwise <see cref=\"System.Runtime.Remoting.Messaging.CallContext\" />.\r\n    /// </summary>\r\n    public static class RequestLifetimeCache\r\n    {\r\n        /// <summary>\r\n        /// Add an item to the cache.\r\n        /// </summary>\r\n        /// <param name=\"key\">Key for item. Used when retrieving/clearing item later.</param>\r\n        /// <param name=\"value\">The item to store.</param>\r\n        public static void Add(object key, object value)\r\n        {\r\n            Verify.ArgumentNotNull(key, \"key\");\r\n\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if (httpContext != null)\r\n            {\r\n                httpContext.Items.Add(key, value);\r\n            }\r\n            else\r\n            {\r\n                FallbackCache.Add(key, value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Checks if the cache has the provided key.\r\n        /// </summary>\r\n        /// <param name=\"key\">Key for item</param>\r\n        /// <returns>True when item exist in cache. Otherwise false.</returns>\r\n        public static bool HasKey(object key)\r\n        {\r\n            Verify.ArgumentNotNull(key, \"key\");\r\n\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if (httpContext != null)\r\n            {\r\n                return httpContext.Items.Contains(key);\r\n            }\r\n\r\n            return FallbackCache.ContainsKey(key);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns cached item based on the provided key or null if item is not known.\r\n        /// </summary>\r\n        /// <param name=\"key\">Key for item</param>\r\n        /// <returns>Cached item or null if not found.</returns>\r\n        public static object TryGet(object key)\r\n        {\r\n            Verify.ArgumentNotNull(key, \"key\");\r\n\r\n            var context = HttpContext.Current;\r\n\r\n            if (context != null)\r\n            {\r\n                return context.Items[key];\r\n            }\r\n\r\n            return (FallbackCache.ContainsKey(key) ? FallbackCache[key] : null);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns cached item based on the provided key or null if item is not known.\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"key\">Key for item</param>\r\n        /// <returns>Cached item or null if not found.</returns>\r\n        public static T TryGet<T>(object key)\r\n        {\r\n            Verify.ArgumentNotNull(key, \"key\");\r\n\r\n            object result = TryGet(key);\r\n\r\n            if (result != null)\r\n            {\r\n                return (T)result;\r\n            }\r\n\r\n            return default(T);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns cached item based on the provided key or a new instance which gets added to the cache using the key. \r\n        /// The returned item is guaranteed to exist in the cache.\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"key\">Key for item</param>\r\n        /// <returns>Cached item or a new instance if not found.</returns>\r\n        internal static T GetCachedOrNew<T>(object key) where T : new()\r\n        {\r\n            Verify.ArgumentNotNull(key, \"key\");\r\n\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if (httpContext != null) {\r\n\r\n                if (!httpContext.Items.Contains(key))\r\n                {\r\n                    lock (httpContext.Items)\r\n                    {\r\n                        if (!httpContext.Items.Contains(key))\r\n                        {\r\n                            T result = new T();\r\n\r\n                            httpContext.Items.Add(key, result);\r\n                            return result;\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return (T)httpContext.Items[key];\r\n            } \r\n\r\n\r\n            // FallbackCache is thread specific so no need to have a critical section\r\n            var fallbackCache = FallbackCache;\r\n            if (!fallbackCache.ContainsKey(key))\r\n            {\r\n                T result = new T();\r\n                fallbackCache.Add(key, result);\r\n\r\n                return result;\r\n            }\r\n\r\n            return (T)fallbackCache[key];\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Remove a named item from the cache.\r\n        /// </summary>\r\n        /// <param name=\"key\">Key for item to remove</param>\r\n        public static void Remove(object key)\r\n        {\r\n            Verify.ArgumentNotNull(key, \"key\");\r\n\r\n            var context = HttpContext.Current;\r\n\r\n            if (context != null)\r\n            {\r\n                context.Items.Remove(key);\r\n            }\r\n            else\r\n            {\r\n                FallbackCache.Remove(key);\r\n            }\r\n        }\r\n\r\n\r\n        private static Dictionary<object, object> FallbackCache\r\n        {\r\n            get\r\n            {\r\n                Dictionary<object, object> fallback = CallContext.GetData(\"RequestLifetimeCache:Fallback\") as Dictionary<object, object>;\r\n\r\n                if (fallback==null)\r\n                {\r\n                    fallback = new Dictionary<object, object>();\r\n                    CallContext.SetData(\"RequestLifetimeCache:Fallback\", fallback);\r\n                }\r\n\r\n                return fallback;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Should no longer be used\", true)]\r\n        public static void ClearAll()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/Generic/CastEnumerable.cs",
    "content": "using System.Collections;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Collections.Generic\r\n{\r\n    internal sealed class CastEnumerable<T> : IEnumerable<T>\r\n    {\r\n        IEnumerable _enumerable;\r\n\r\n        public CastEnumerable(IEnumerable enumerable)\r\n        {           \r\n            _enumerable = enumerable;\r\n        }\r\n\r\n\r\n        IEnumerator<T> IEnumerable<T>.GetEnumerator()\r\n        {\r\n            return new CastEnumerator<T>(_enumerable.GetEnumerator());\r\n        }\r\n\r\n\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            return new CastEnumerator<T>(_enumerable.GetEnumerator());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/Generic/CastEnumerator.cs",
    "content": "﻿using System.Collections;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Core.Collections.Generic\r\n{\r\n    internal sealed class CastEnumerator<T> : IEnumerator<T>\r\n    {\r\n        IEnumerator _enumerator;\r\n\r\n        public CastEnumerator(IEnumerator enumerator)\r\n        {            \r\n            _enumerator = enumerator;\r\n        }\r\n\r\n        public T Current\r\n        {\r\n            get\r\n            {\r\n                return (T)_enumerator.Current;\r\n            }\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n            _enumerator = null;\r\n#if LeakCheck\r\n            System.GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = System.Environment.StackTrace;\r\n        /// <exclude />\r\n        ~CastEnumerator()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n        object IEnumerator.Current\r\n        {\r\n            get\r\n            {\r\n                return _enumerator.Current;\r\n            }\r\n        }\r\n\r\n        public bool MoveNext()\r\n        {\r\n            return _enumerator.MoveNext();\r\n        }\r\n\r\n        public void Reset()\r\n        {\r\n            _enumerator.Reset();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/Generic/DictionaryExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Collections.Generic\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class DictionaryExtensionMethods\r\n\t{\r\n        /// <exclude />\r\n        public static void AddDictionary<TKey, TValue>(this Dictionary<TKey, TValue> targetDictionary, Dictionary<TKey, TValue> sourceDictionary)\r\n        {\r\n            if (targetDictionary == null) throw new ArgumentNullException(\"targetDictionary\");\r\n            if (sourceDictionary == null) throw new ArgumentNullException(\"sourceDictionary\");\r\n\r\n            foreach (KeyValuePair<TKey, TValue> kvp in sourceDictionary)\r\n            {\r\n                targetDictionary.Add(kvp.Key, kvp.Value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static TValue EnsureValue<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, Func<TValue> createValue)\r\n        {\r\n            // TODO: Syncronization logic here???\r\n            TValue value;\r\n            if (dictionary.TryGetValue(key, out value) == false)\r\n            {\r\n                value = createValue();\r\n                dictionary.Add(key, value);\r\n            }\r\n\r\n            return value;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static TValue EnsureValue<TKey, TValue>(this Hashtable<TKey, TValue> dictionary, TKey key, Func<TValue> createValue)\r\n        {\r\n            TValue value;\r\n            if (!dictionary.TryGetValue(key, out value))\r\n            {\r\n                lock(dictionary)\r\n                {\r\n                    if (!dictionary.TryGetValue(key, out value))\r\n                    {\r\n\r\n                        value = createValue();\r\n                        dictionary.Add(key, value);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return value;\r\n        }\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/Generic/Hashset.cs",
    "content": "﻿using System.Collections;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Collections.Generic\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class Hashset<T>\r\n\t{\r\n        private readonly Hashtable _table = new Hashtable();\r\n\r\n        /// <exclude />\r\n        public Hashset()\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public Hashset(IEnumerable<T> enumerable)\r\n        {\r\n            foreach (T element in enumerable)\r\n\t        {\r\n\t            Add(element);\r\n\t        }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool Contains(T key)\r\n        {\r\n            return _table.ContainsKey(key);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Add(T key)\r\n        {\r\n           _table.Add(key, string.Empty);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Remove(T key)\r\n        {\r\n           _table.Remove(key);\r\n        }\r\n\r\n        /// <exclude />\r\n\t    public ICollection<T> GetKeys()\r\n\t    {\r\n            var result = new List<T>();\r\n\r\n            foreach(object key in _table.Keys)\r\n            {\r\n                result.Add((T)key);\r\n            }\r\n            return result;\r\n\t    }\r\n\t}\r\n}"
  },
  {
    "path": "Composite/Core/Collections/Generic/Hashtable.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Collections.Generic\r\n{\r\n    /// <summary>    \r\n    /// Alternative to the standard Dictinary class. Allows simultaneous read operations from many threads, and add/remove/update from a single thread.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class Hashtable<TKey, TValue>//: Hashtable\r\n\t{\r\n\t    private readonly Hashtable _table;\r\n\r\n        private static readonly object NullValue = new object(); // A value which represents \"null\" value\r\n\t    private static readonly bool IsValueType = typeof (TValue).IsValueType;\r\n\r\n        /// <exclude />\r\n        public Hashtable()\r\n        {\r\n            _table = new Hashtable();\r\n        }\r\n\r\n        /// <exclude />\r\n        public Hashtable(int capacity)\r\n        {\r\n            _table = new Hashtable(capacity);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Add(TKey key, TValue value) \r\n        {\r\n            if (!IsValueType && (value == null))\r\n            {\r\n                _table.Add(key, NullValue);\r\n            }\r\n            else\r\n            {\r\n                _table.Add(key, value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n\t    public TValue this[TKey key]\r\n\t    {\r\n            get\r\n            {\r\n                object result = _table[key];\r\n                if(result == null || result == NullValue)\r\n                {\r\n                    return default(TValue);\r\n                }\r\n                return (TValue)result;\r\n            }\r\n            set\r\n            {\r\n                _table[key] = value;\r\n            }\r\n\t    }\r\n\r\n\r\n        /// <exclude />\r\n        public bool TryGetValue(TKey key, out TValue value)\r\n        {\r\n            object result = _table[key];\r\n            if(result == null)\r\n            {\r\n                value = default(TValue);\r\n                return false;\r\n            }\r\n\r\n            if(result == NullValue)\r\n            {\r\n                value = default(TValue);\r\n                return true;\r\n            }\r\n\r\n            value = (TValue)result;\r\n            return true;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Thread safe way to \"get or add\" a value, unlike ConcurrentDictionary, valueFactory won't be called twice for the same key.\r\n        /// </summary>\r\n        /// <param name=\"key\"></param>\r\n        /// <param name=\"valueFactory\"></param>\r\n        /// <returns></returns>\r\n        public TValue GetOrAddSync(TKey key, Func<TKey, TValue> valueFactory)\r\n        {\r\n            TValue result;\r\n\r\n            if (!TryGetValue(key, out result))\r\n            {\r\n                lock (this)\r\n                {\r\n                    if (!TryGetValue(key, out result))\r\n                    {\r\n                        result = valueFactory(key);\r\n\r\n                        Add(key, result);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool ContainsKey(TKey key)\r\n        {\r\n            return _table.ContainsKey(key);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Remove(TKey key)\r\n        {\r\n            _table.Remove(key);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Clear()\r\n        {\r\n            _table.Clear();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Any()\r\n        {\r\n            return _table.Count > 0;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Getting the case collection. This operation is not thread safe.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public ICollection<TKey> GetKeys()\r\n        {\r\n            var result = new List<TKey>(_table.Count);\r\n\r\n            foreach(object key in _table.Keys)\r\n            {\r\n                result.Add((TKey)key);\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ICollection<TValue> GetValues()\r\n        {\r\n            var result = new List<TValue>(_table.Count);\r\n\r\n            foreach (object value in _table.Values)\r\n            {\r\n                result.Add((TValue)value);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <exclude />\r\n\t    public int Count\r\n\t    {\r\n            get { return _table.Count; }\r\n\t    }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/Generic/ReadOnlyDictionary.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Collections.Generic\r\n{\r\n    internal sealed class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>\r\n    {\r\n        Dictionary<TKey, TValue> _dictionary;\r\n\r\n        public ReadOnlyDictionary(Dictionary<TKey, TValue> dictionary)\r\n        {\r\n            if (dictionary == null) throw new ArgumentNullException(\"dictionary\");\r\n\r\n            _dictionary = dictionary;\r\n        }\r\n\r\n        public void Add(TKey key, TValue value)\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyDictionary\");\r\n        }\r\n\r\n        public bool ContainsKey(TKey key)\r\n        {\r\n            return _dictionary.ContainsKey(key);\r\n        }\r\n\r\n        public ICollection<TKey> Keys\r\n        {\r\n            get { return _dictionary.Keys; }\r\n        }\r\n\r\n        public bool Remove(TKey key)\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyDictionary\");\r\n        }\r\n\r\n        public bool TryGetValue(TKey key, out TValue value)\r\n        {\r\n            return _dictionary.TryGetValue(key, out value);\r\n        }\r\n\r\n        public ICollection<TValue> Values\r\n        {\r\n            get { return _dictionary.Values; }\r\n        }\r\n\r\n        public TValue this[TKey key]\r\n        {\r\n            get\r\n            {\r\n                return _dictionary[key];\r\n            }\r\n            set\r\n            {\r\n                throw new InvalidOperationException(\"This is not allowed on a ReadOnlyDictionary\");\r\n            }\r\n        }\r\n\r\n        public void Add(KeyValuePair<TKey, TValue> item)\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyDictionary\");\r\n        }\r\n\r\n        public void Clear()\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyDictionary\");\r\n        }\r\n\r\n        public bool Contains(KeyValuePair<TKey, TValue> item)\r\n        {\r\n            return ((IDictionary)_dictionary).Contains(item);\r\n        }\r\n\r\n        public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)\r\n        {\r\n\r\n            ((IDictionary<TKey, TValue>)_dictionary).CopyTo(array, arrayIndex);\r\n        }\r\n\r\n        public int Count\r\n        {\r\n            get { return _dictionary.Count; }\r\n        }\r\n\r\n        public bool IsReadOnly\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n        public bool Remove(KeyValuePair<TKey, TValue> item)\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyDictionary\");\r\n        }\r\n\r\n        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()\r\n        {\r\n            return _dictionary.GetEnumerator();\r\n        }\r\n\r\n        IEnumerator System.Collections.IEnumerable.GetEnumerator()\r\n        {\r\n            return ((IEnumerable)_dictionary).GetEnumerator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/Generic/ReadOnlyList.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Collections.Generic\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Obsolete(\"Use standard System.Collections.ObjectModel.ReadOnlyCollection<T>\")]\r\n    public sealed class ReadOnlyList<T> : IList<T>\r\n    {\r\n        private List<T> _list;\r\n\r\n\r\n        /// <exclude />\r\n        public ReadOnlyList(List<T> list)\r\n        {\r\n            if (list == null) throw new ArgumentNullException(\"list\");\r\n\r\n            _list = list;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int IndexOf(T item)\r\n        {\r\n            return _list.IndexOf(item);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Insert(int index, T item)\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyList\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void RemoveAt(int index)\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyList\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public T this[int index]\r\n        {\r\n            get\r\n            {\r\n                return _list[index];\r\n            }\r\n            set\r\n            {\r\n                throw new InvalidOperationException(\"This is not allowed on a ReadOnlyList\");\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Add(T item)\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyList\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Clear()\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyList\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Contains(T item)\r\n        {\r\n            return _list.Contains(item);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void CopyTo(T[] array, int arrayIndex)\r\n        {\r\n            _list.CopyTo(array, arrayIndex);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int Count\r\n        {\r\n            get { return _list.Count; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsReadOnly\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Remove(T item)\r\n        {\r\n            throw new InvalidOperationException(\"This is not allowed on a ReadOnlyList\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerator<T> GetEnumerator()\r\n        {\r\n            return _list.GetEnumerator();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            return ((IEnumerable)_list).GetEnumerator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/Generic/ResourceLocker.cs",
    "content": "using System;\r\nusing System.Threading;\r\n\r\n\r\nnamespace Composite.Core.Collections.Generic\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ResourceLocker<T>\r\n        where T : class\r\n    {\r\n        /// <exclude />\r\n        public delegate void InitializerDelegate(T resources);\r\n\r\n        private readonly T _resources;\r\n        private readonly InitializerDelegate _initializerDelegate;\r\n        private readonly bool _requireCoreReaderLock;\r\n\r\n        private bool _initialized;\r\n        private bool _initializing;\r\n        private Exception _initializationException;\r\n        \r\n        private readonly object _lock = new object();\r\n\r\n\r\n        /// <exclude />\r\n        public ResourceLocker(T resources, InitializerDelegate initializerDelegate, bool requireCoreReaderLock)\r\n        {\r\n            _resources = resources;\r\n            _initializerDelegate = initializerDelegate;\r\n            _requireCoreReaderLock = requireCoreReaderLock;\r\n        }\r\n\r\n        /// <exclude />\r\n        public ResourceLocker(T resources, InitializerDelegate initializerDelegate): this(resources, initializerDelegate, true)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public T Resources\r\n        {\r\n            get\r\n            {\r\n                if (!_initialized)\r\n                {\r\n                    Initialize();\r\n                }\r\n\r\n                if (_initializationException != null)\r\n                {\r\n                    throw new InvalidOperationException(\"Error initializing resources\", _initializationException);\r\n                }\r\n\r\n                return _resources;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsInitialized => _initialized;\r\n\r\n\r\n        /// <exclude />\r\n        public void Initialize()\r\n        {\r\n            if (_initialized)\r\n            \treturn;\r\n\r\n\r\n            IDisposable globalReaderLock = null;\r\n\r\n            try\r\n            {\r\n                if(_requireCoreReaderLock)\r\n                {\r\n                    globalReaderLock = GlobalInitializerFacade.CoreNotLockedScope;\r\n                }\r\n                \r\n                lock (_lock)\r\n\t\t\t\t{\r\n\t\t\t\t\tVerify.IsFalse(_initializing, \"Initialize is already being executed on this thread! Please examine the stack!\");\r\n\r\n\t\t\t\t\tif (_initialized)\r\n\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t_initializing = true;\r\n                    _initializationException = null;\r\n\r\n\t\t\t\t    try\r\n\t\t\t\t    {\r\n\t\t\t\t        _initializerDelegate(_resources);\r\n\t\t\t\t    }\r\n\t\t\t\t    catch (Exception exception)\r\n\t\t\t\t    {\r\n\t\t\t\t        _initializationException = exception;\r\n\t\t\t\t        throw;\r\n\t\t\t\t    }\r\n\t\t\t\t\tfinally\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t_initialized = true;\r\n\t\t\t\t\t\t_initializing = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n            }\r\n            finally\r\n            {\r\n                globalReaderLock?.Dispose();\r\n            }\r\n\t\t}\r\n\r\n\r\n        /// <exclude />\r\n        public IDisposable Locker => new ResourceLockerToken(this);\r\n\r\n\r\n        /// <exclude />\r\n        public IDisposable ReadLocker => new ResourceLockerToken(this);\r\n\r\n\r\n        /// <exclude />\r\n        public void ResetInitialization()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _initialized = false;\r\n            }\r\n        }\r\n\r\n\r\n        private void TryEnterLock(int timeoutInMilliseconds, ref bool success)\r\n        {\r\n            Monitor.TryEnter(_lock, timeoutInMilliseconds, ref success);\r\n        }\r\n\r\n\r\n        private void Exit()\r\n        {\r\n            Monitor.Exit(_lock);\r\n        }\r\n\r\n\r\n        private sealed class ResourceLockerToken : IDisposable\r\n        {\r\n            private readonly ResourceLocker<T> _resourceLocker;\r\n\r\n            internal ResourceLockerToken(ResourceLocker<T> resourceLocker)\r\n            {\r\n                _resourceLocker = resourceLocker ?? throw new ArgumentNullException(nameof(resourceLocker));\r\n\r\n                int tires = 120;\r\n\r\n                bool success = false;\r\n                while (!success && tires-- > 0)\r\n                {\r\n                    IDisposable coreLock = null;\r\n\r\n                    try\r\n                    {\r\n                        if (_resourceLocker._requireCoreReaderLock)\r\n                        {\r\n                            coreLock = GlobalInitializerFacade.CoreNotLockedScope;\r\n                        }\r\n\r\n                        _resourceLocker.TryEnterLock(500, ref success);\r\n                    }\r\n                    finally\r\n                    {\r\n                        coreLock?.Dispose();\r\n                    }\r\n\r\n                    if (!success)\r\n                    {\r\n                        Thread.Sleep(1);\r\n                    }\r\n                }\r\n\r\n                if (!success)\r\n                {\r\n                    throw new TimeoutException(\"Failed to obtain a required resource lock. Aborting to avoid system deadlocks.\");\r\n                }\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                _resourceLocker.Exit();\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~ResourceLockerToken()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/INamespaceTreeBuilderLeafInfo.cs",
    "content": "namespace Composite.Core.Collections\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface INamespaceTreeBuilderLeafInfo\r\n    {\r\n        /// <exclude />\r\n        string Name { get; }\r\n\r\n        /// <exclude />\r\n        string Namespace { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/NamespaceTreeBuilder.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Core.Collections\r\n{\r\n    internal sealed class NamespaceTreeBuilder\r\n    {\r\n        private NamespaceTreeBuilderFolder _rootFolder;\r\n        private char _namespaceSeparator;\r\n\r\n\r\n        public NamespaceTreeBuilder(IEnumerable<INamespaceTreeBuilderLeafInfo> namespaceTreeBuilderInfos)\r\n            : this(namespaceTreeBuilderInfos, '.')\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public NamespaceTreeBuilder(IEnumerable<INamespaceTreeBuilderLeafInfo> namespaceTreeBuilderInfos, char namespaceSeparator)\r\n        {\r\n            if (namespaceTreeBuilderInfos == null) throw new ArgumentNullException(\"namespaceTreeBuilderInfos\");\r\n            _namespaceSeparator = namespaceSeparator;\r\n\r\n            _rootFolder = new NamespaceTreeBuilderFolder(\"\", \"\");\r\n\r\n            foreach (INamespaceTreeBuilderLeafInfo namespaceTreeBuilderInfo in namespaceTreeBuilderInfos)\r\n            {\r\n                NamespaceTreeBuilderFolder folderNode = GetOrCreateFolder(namespaceTreeBuilderInfo.Namespace);\r\n\r\n                folderNode.Leafs.Add(namespaceTreeBuilderInfo);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public NamespaceTreeBuilderFolder RootFolder\r\n        {\r\n            get { return _rootFolder; }\r\n        }\r\n\r\n\r\n\r\n        public NamespaceTreeBuilderFolder GetFolder(string namespaceName)\r\n        {\r\n            if (namespaceName == null) throw new ArgumentNullException(\"namespaceName\");\r\n            if (namespaceName.IsCorrectNamespace(_namespaceSeparator) == false) throw new ArgumentException(string.Format(\"The namespace '{0}' is not correctly formattet\", namespaceName));\r\n\r\n            NamespaceTreeBuilderFolder currentNode = _rootFolder;\r\n            string[] namespaceComponents = namespaceName.Split(_namespaceSeparator);\r\n            foreach (string namespaceComponent in namespaceComponents.Where(s => s != \"\"))\r\n            {\r\n                currentNode = currentNode.SubFolders.Where(n => n.Name == namespaceComponent).FirstOrDefault();\r\n\r\n                if (currentNode == null)\r\n                {\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            return currentNode;\r\n        }\r\n\r\n\r\n\r\n        public NamespaceTreeBuilderFolder FindFolder(Func<NamespaceTreeBuilderFolder, bool> predicate)\r\n        {\r\n            return FindFolder(_rootFolder, predicate);\r\n        }\r\n\r\n\r\n\r\n        private NamespaceTreeBuilderFolder FindFolder(NamespaceTreeBuilderFolder currentFolder, Func<NamespaceTreeBuilderFolder, bool> predicate)\r\n        {\r\n            if (predicate(currentFolder)) return currentFolder;\r\n\r\n            foreach (NamespaceTreeBuilderFolder subFolder in currentFolder.SubFolders)\r\n            {\r\n                NamespaceTreeBuilderFolder foundFolder = FindFolder(subFolder, predicate);\r\n\r\n                if (foundFolder != null)\r\n                {\r\n                    return foundFolder;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private NamespaceTreeBuilderFolder GetOrCreateFolder(string namespaceName)\r\n        {\r\n            if (namespaceName.IsCorrectNamespace(_namespaceSeparator) == false) throw new ArgumentException(string.Format(\"The namespace '{0}' is not correctly formattet\", namespaceName != null ? namespaceName : \"(null)\"));\r\n\r\n            string[] namespaceComponents = namespaceName.Split(_namespaceSeparator);\r\n\r\n            if ((namespaceComponents.Length == 1) && (namespaceComponents[0] == \"\"))\r\n            {\r\n                return _rootFolder;\r\n            }\r\n\r\n            NamespaceTreeBuilderFolder currentNode = _rootFolder;\r\n            string currentNamespace = \"\";\r\n\r\n            foreach (string namespaceComponent in namespaceComponents)\r\n            {\r\n                NamespaceTreeBuilderFolder node = currentNode.SubFolders.Where(n => n.Name == namespaceComponent).FirstOrDefault();\r\n\r\n                if (node == null)\r\n                {\r\n                    node = new NamespaceTreeBuilderFolder(namespaceComponent, currentNamespace);\r\n                    currentNode.SubFolders.Add(node);\r\n                }\r\n\r\n                if (currentNamespace == \"\")\r\n                {\r\n                    currentNamespace = namespaceComponent;\r\n                }\r\n                else\r\n                {\r\n                    currentNamespace = string.Format(\"{0}{1}{2}\", currentNamespace, _namespaceSeparator, namespaceComponent);\r\n                }\r\n\r\n                currentNode = node;\r\n            }\r\n\r\n            return currentNode;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Collections/NamespaceTreeBuilderFolder.cs",
    "content": "using System.Diagnostics;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Collections\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"Name = {Name}, Namespace = {Namespace}\")]\r\n    public sealed class NamespaceTreeBuilderFolder\r\n    {\r\n        internal NamespaceTreeBuilderFolder(string name, string namespaceName)\r\n        {\r\n            this.Name = name;\r\n            this.Namespace = namespaceName;\r\n            this.Leafs = new List<INamespaceTreeBuilderLeafInfo>();\r\n            this.SubFolders = new List<NamespaceTreeBuilderFolder>();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Name\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Namespace\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<INamespaceTreeBuilderLeafInfo> Leafs\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<NamespaceTreeBuilderFolder> SubFolders\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/AppCodeTypeNotFoundConfigurationException.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    internal class AppCodeTypeNotFoundConfigurationException : Exception\r\n    // Does not inherit ConfigurationErrorsException/ConfigurationException since that would lead to loosing exception type \r\n    // during rethow by System.Configuration classes\r\n    {\r\n        public AppCodeTypeNotFoundConfigurationException(string message)\r\n            : base(message)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/BuildinPlugins/GlobalSettingsProvider/BuildinCacheSettings.cs",
    "content": "﻿namespace Composite.Core.Configuration.BuildinPlugins.GlobalSettingsProvider\r\n{\r\n\tinternal class BuildinCacheSettings: ICacheSettings\r\n\t{\r\n        public BuildinCacheSettings(string name, bool enabled, int size)\r\n        {\r\n            Name = name;\r\n            Enabled = enabled;\r\n            Size = size;\r\n        }\r\n\r\n        public string Name\r\n        {\r\n            get; set; \r\n        }\r\n\r\n        public bool Enabled\r\n        {\r\n            get;\r\n            set; \r\n        }\r\n\r\n        public int Size\r\n        {\r\n            get;\r\n            set; \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/BuildinPlugins/GlobalSettingsProvider/BuildinCachingSettings.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.Core.Configuration.BuildinPlugins.GlobalSettingsProvider\r\n{\r\n\tinternal class BuildinCachingSettings: ICachingSettings\r\n\t{\r\n\t    private bool _enabled;\r\n        private IEnumerable<ICacheSettings> _cacheSettingsCollection = new ICacheSettings[0];\r\n\r\n        public bool Enabled\r\n        {\r\n            get { return _enabled; }\r\n            set { _enabled = value; }\r\n        }\r\n\r\n        public IEnumerable<ICacheSettings> Caches\r\n        {\r\n            get { return _cacheSettingsCollection; }\r\n            set { _cacheSettingsCollection = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/BuildinPlugins/GlobalSettingsProvider/BuildinGlobalSettingsProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Threading;\r\nusing Composite.Core.Configuration.Plugins.GlobalSettingsProvider;\r\n\r\n\r\nnamespace Composite.Core.Configuration.BuildinPlugins.GlobalSettingsProvider\r\n{\r\n    internal sealed class BuildinGlobalSettingsProvider : IGlobalSettingsProvider\r\n    {\r\n        private string _applicationName = \"C1 CMS\";\r\n        private string _applicationShortName = \"C1\";\r\n        private string _brandedVersionAssemblySource = \"Composite\";\r\n        private string _configurationDirectory = \"~\";\r\n        private string _generatedAssembliesDirectory = \"~/GeneratedAssemblies\";\r\n        private string _serializedWorkflowsDirectory = \"~\";\r\n        private string _appCodeDirectory = \"App_Code\";\r\n        private string _binDirectory = \"~\";\r\n        private string _tempDirectory = \"~/Temp\";\r\n        private string _cacheDirectory = \"~/Cache/Startup\";\r\n        private string _packageDirectory = \"~/Packages\";\r\n        private string _autoPackageInstallDirectory = \"~/AutoInstallPackages\";\r\n        private string _treeDefinitionsDirectory = \"~/TreeDefinitions\";\r\n        private string _pageTemplateFeaturesDirectory = \"~/PageTemplateFeaturesDirectory\";\r\n        private string _dataMetaDataDirectory = \"~/DataMetaData\";\r\n        private string _inlineCSharpFunctionDirectory = \"~/InlineCSharpFunctions\";\r\n        private string _packageLicenseDirectory = \"~/PackageLicenses\";\r\n        private readonly ICachingSettings _cachingSettings = new BuildinCachingSettings();\r\n        private readonly List<string> _nonProbableAssemblyNames = new List<string>();\r\n        private readonly int _consoleMessageQueueSecondToLive = (int) TimeSpan.FromMinutes(10).TotalSeconds;\r\n        private bool _enableDataTypesAutoUpdate = false;\r\n        private bool _broadcastConsoleElementChanges = true;\r\n        private bool _prettifyPublicMarkup = true;\r\n        private bool _prettifyRenderFunctionExceptions = true;\r\n        private bool _functionPreviewEnabled = false;\r\n        private TimeZoneInfo _timezone = TimeZoneInfo.Local;\r\n\r\n        public string ApplicationName => _applicationName;\r\n\r\n        public string ApplicationShortName => _applicationShortName;\r\n\r\n        public string BrandedVersionAssemblySource => _brandedVersionAssemblySource;\r\n\r\n\r\n        public string DefaultCultureName => Thread.CurrentThread.CurrentCulture.Name;\r\n\r\n\r\n        public string ConfigurationDirectory\r\n        {\r\n            get\r\n            {\r\n                return string.Format(\"{0}/{1}\", _configurationDirectory, Guid.NewGuid());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string GeneratedAssembliesDirectory => _generatedAssembliesDirectory;\r\n\r\n\r\n        public string SerializedWorkflowsDirectory\r\n        {\r\n            get\r\n            {\r\n                return string.Format(\"{0}/{1}\", _serializedWorkflowsDirectory, Guid.NewGuid());\r\n\r\n            }\r\n        }\r\n\r\n\r\n        public string AppCodeDirectory => _appCodeDirectory;\r\n\r\n\r\n        public string BinDirectory => _binDirectory;\r\n\r\n\r\n        public string TempDirectory => _tempDirectory;\r\n\r\n\r\n        public string CacheDirectory => _cacheDirectory;\r\n\r\n\r\n        public string PackageDirectory => _packageDirectory;\r\n\r\n\r\n        public string AutoPackageInstallDirectory => _autoPackageInstallDirectory;\r\n\r\n\r\n        public string TreeDefinitionsDirectory => _treeDefinitionsDirectory;\r\n\r\n\r\n        public string PageTemplateFeaturesDirectory => _pageTemplateFeaturesDirectory;\r\n\r\n\r\n        public string DataMetaDataDirectory => _dataMetaDataDirectory;\r\n\r\n\r\n        public string InlineCSharpFunctionDirectory => _inlineCSharpFunctionDirectory;\r\n\r\n\r\n        public string PackageLicenseDirectory => _packageLicenseDirectory;\r\n\r\n\r\n        public IEnumerable<string> NonProbableAssemblyNames => _nonProbableAssemblyNames;\r\n\r\n\r\n        public int ConsoleMessageQueueItemSecondToLive => _consoleMessageQueueSecondToLive;\r\n\r\n\r\n        public bool EnableDataTypesAutoUpdate => _enableDataTypesAutoUpdate;\r\n\r\n\r\n        public bool BroadcastConsoleElementChanges => _broadcastConsoleElementChanges;\r\n\r\n\r\n        public string AutoCreatedAdministratorUserName => null;\r\n\r\n\r\n        public string SerializedConsoleMessagesDirectory => $\"{_serializedWorkflowsDirectory}/{Guid.NewGuid()}\";\r\n\r\n\r\n        public string WorkflowTimeout => \"7.00:00:00\";\r\n\r\n\r\n        public string ConsoleTimeout => \"00:01:00\";\r\n\r\n        public bool OnlyTranslateWhenApproved => false;\r\n\r\n        public bool AllowChildPagesTranslationWithoutParent => false;\r\n\r\n        public ICachingSettings Caching => _cachingSettings;\r\n\r\n        public int ImageQuality => 80;\r\n\r\n        public bool PrettifyPublicMarkup => _prettifyPublicMarkup;\r\n\r\n        public bool PrettifyRenderFunctionExceptions => _prettifyRenderFunctionExceptions;\r\n\r\n        public bool FunctionPreviewEnabled => _functionPreviewEnabled;\r\n\r\n        public TimeZoneInfo TimeZone => _timezone;\r\n\r\n        public bool InheritGlobalReadPermissionOnHiddenPerspectives => false;\r\n\r\n        public bool OmitAspNetWebFormsSupport => false;\r\n\r\n        public bool ProtectResizedImagesWithHash => false;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/C1Configuration.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.Configuration.Configuration. Using this implementation instead \r\n    /// of System.Configuration.Configuration, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.Configuration.Configuration for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1Configuration\"/>.\r\n    /// </summary>\r\n    public class C1Configuration : ImplementationContainer<C1ConfigurationImplementation>\r\n    {\r\n        /// <summary>\r\n        /// Creates a C1Configuration\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to configuration file.</param>\r\n        public C1Configuration(string path)\r\n            : base(() => ImplementationFactory.CurrentFactory.CreateC1Configuration(path))\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the path to the configuration file.\r\n        /// </summary>\r\n        public string FilePath\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.FilePath;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the configuration file exists.\r\n        /// </summary>\r\n        public bool HasFile\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.HasFile;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the app setttings section.\r\n        /// </summary>\r\n        public AppSettingsSection AppSettings\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.AppSettings;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the connection string section.\r\n        /// </summary>\r\n        public ConnectionStringsSection ConnectionStrings\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.ConnectionStrings;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the configuration sections.\r\n        /// </summary>\r\n        public ConfigurationSectionCollection Sections\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.Sections;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the configuration section group.\r\n        /// </summary>\r\n        public ConfigurationSectionGroup RootSectionGroup\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.RootSectionGroup;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the configuration slection groups.\r\n        /// </summary>\r\n        public ConfigurationSectionGroupCollection SectionGroups\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.SectionGroups;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a named configuration section.\r\n        /// </summary>\r\n        /// <param name=\"sectionName\">Name of section to get.</param>\r\n        /// <returns>Returns the configuration section.</returns>\r\n        public ConfigurationSection GetSection(string sectionName)\r\n        {\r\n            return this.Implementation.GetSection(sectionName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a named configuration section group.\r\n        /// </summary>\r\n        /// <param name=\"sectionGroupName\">Name of configuration section group to get.</param>\r\n        /// <returns>Returns the configuration section group.</returns>\r\n        public ConfigurationSectionGroup GetSectionGroup(string sectionGroupName)\r\n        {\r\n            return this.Implementation.GetSectionGroup(sectionGroupName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration.\r\n        /// </summary>\r\n        public void Save()\r\n        {\r\n            this.Implementation.Save();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration.\r\n        /// </summary>\r\n        /// <param name=\"saveMode\">Save mode to use when saving the configuration.</param>\r\n        public void Save(ConfigurationSaveMode saveMode)\r\n        {\r\n            this.Implementation.Save(saveMode);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration.\r\n        /// </summary>\r\n        /// <param name=\"saveMode\">Save mode to use when saving the configuration.</param>\r\n        /// <param name=\"forceSaveAll\">Saves all sections, even non touched.</param>\r\n        public void Save(ConfigurationSaveMode saveMode, bool forceSaveAll)\r\n        {\r\n            this.Implementation.Save(saveMode, forceSaveAll);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration to a new file.\r\n        /// </summary>\r\n        /// <param name=\"filename\">Path to new configuration filename.</param>\r\n        public void SaveAs(string filename)\r\n        {\r\n            this.Implementation.SaveAs(filename);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration to a new file.\r\n        /// </summary>\r\n        /// <param name=\"filename\">Path to new configuration filename.</param>\r\n        /// <param name=\"saveMode\">Save mode to use when saving the configuration.</param>\r\n        public void SaveAs(string filename, ConfigurationSaveMode saveMode)\r\n        {\r\n            this.Implementation.SaveAs(filename, saveMode);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration to a new file.\r\n        /// </summary>\r\n        /// <param name=\"filename\">Path to new configuration filename.</param>\r\n        /// <param name=\"saveMode\">Save mode to use when saving the configuration.</param>\r\n        /// <param name=\"forceSaveAll\">Saves all sections, even non touched.</param>\r\n        public void SaveAs(string filename, ConfigurationSaveMode saveMode, bool forceSaveAll)\r\n        {\r\n            this.Implementation.SaveAs(filename, saveMode, forceSaveAll);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Configuration.cs",
    "content": "﻿using System.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n   /* /// <summary>\r\n    /// This should be a part of the I/O layer\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class C1Configuration\r\n    {\r\n        System.Configuration.Configuration _configuration;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationManagerClass:DoNotUseConfigurationManagerClass\", Justification = \"The implementation may use it\")]\r\n        public static C1Configuration Load(string path)\r\n        {            \r\n            ExeConfigurationFileMap map = new ExeConfigurationFileMap();\r\n            map.ExeConfigFilename = path;\r\n            System.Configuration.Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);            \r\n\r\n            return new C1Configuration(configuration);\r\n        }\r\n\r\n\r\n\r\n        protected C1Configuration(System.Configuration.Configuration configuration)\r\n        {\r\n            _configuration = configuration;\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n        public ConfigurationSectionCollection Sections\r\n        {\r\n            get\r\n            {\r\n                return _configuration.Sections;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n        public ConfigurationSection GetSection(string sectionName)\r\n        {\r\n            return _configuration.GetSection(sectionName);\r\n        }\r\n\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n        public void Save()\r\n        {\r\n            _configuration.Save();\r\n        }\r\n    }*/\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/ConfigurationServices.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Xsl;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing System.IO;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class ConfigurationServices\r\n    {\r\n        private static IConfigurationSource _configurationSource = null;\r\n        private static string _fileConfigurationSourcePath;\r\n\r\n        private static readonly object _lock = new object();\r\n\r\n\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"The configuration is needed to boot the IO layer, so we cant use it here\")]\r\n        static ConfigurationServices()\r\n        {\r\n            if (RuntimeInformation.IsUnittest)\r\n            {\r\n                _configurationSource = ConfigurationSourceFactory.Create();\r\n                return;\r\n            }\r\n\r\n            _fileConfigurationSourcePath = GetFileConfigurationSourcePath();\r\n\r\n            Verify.IsNotNull(_fileConfigurationSourcePath, \"Configuration file is not defined\");\r\n\r\n            FileAttributes fileAttributes = File.GetAttributes(_fileConfigurationSourcePath);\r\n            if ((fileAttributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)\r\n            {\r\n                fileAttributes ^= FileAttributes.ReadOnly;\r\n                File.SetAttributes(_fileConfigurationSourcePath, fileAttributes);\r\n            }\r\n\r\n            _configurationSource = new FileConfigurationSource(_fileConfigurationSourcePath);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IConfigurationSource ConfigurationSource\r\n        {\r\n            get\r\n            {\r\n                return _configurationSource;\r\n            }\r\n            set\r\n            {\r\n                // Unit test code only!\r\n                // if (RuntimeInformation.IsUnittest == false) throw new InvalidOperationException(\"Intented for unit testing only\");\r\n\r\n                lock (_lock)\r\n                {\r\n                    _configurationSource = value;\r\n                    string fileConfigurationSourcePath = null;\r\n\r\n                    if (_configurationSource != null)\r\n                    {\r\n                        fileConfigurationSourcePath = GetFileConfigurationSourcePath();\r\n                    }\r\n\r\n                    if (fileConfigurationSourcePath != null)\r\n                    {\r\n                        FileUtils.RemoveReadOnly(fileConfigurationSourcePath);\r\n                    }\r\n\r\n                    // GlobalEventSystemFacade.FlushTheSystem();\r\n\r\n                    _fileConfigurationSourcePath = fileConfigurationSourcePath;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static string FileConfigurationSourcePath\r\n        {\r\n            get\r\n            {\r\n                if ((_configurationSource != null) && (_fileConfigurationSourcePath == null))\r\n                {\r\n                    throw new InvalidOperationException(\"Unable to locate the ConfigurationSourceSection\");\r\n                }\r\n                return _fileConfigurationSourcePath;\r\n            }\r\n            set\r\n            {\r\n                if (Composite.RuntimeInformation.IsUnittest == false) throw new InvalidOperationException(\"FileConfigurationSourcePath set is for unit testing only.\");\r\n\r\n                _fileConfigurationSourcePath = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SaveConfigurationSection(string sectionName, ConfigurationSection configurationSection)\r\n        {\r\n            using (GlobalInitializerFacade.CoreLockScope)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    string tempFilePath = ConfigurationServices.TempRandomConfigFilePath;\r\n                    C1File.Copy(FileConfigurationSourcePath, tempFilePath);\r\n                    FileConfigurationParameter configurationParameter = new FileConfigurationParameter(tempFilePath);\r\n                    ConfigurationServices.ConfigurationSource.Add(configurationParameter, sectionName, configurationSection);\r\n                    // Kill monitoring of file changes:\r\n                    //                    FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);\r\n                    C1File.Copy(tempFilePath, ConfigurationServices.FileConfigurationSourcePath, true);\r\n                    DeleteTempConfigurationFile(tempFilePath);\r\n\r\n                    _configurationSource = new FileConfigurationSource(ConfigurationServices.FileConfigurationSourcePath);\r\n                    // Kill monitoring of file changes:\r\n                    //                    FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Transforms the current configuration file based on the supplied XSLT document. The resulting \r\n        /// configuration document is validated and no errors are tollerated. Configurationerrors are handled\r\n        /// as exceptions.\r\n        /// </summary>\r\n        /// <param name=\"xsltDocument\">XSLT document to apply to the configuration document</param>\r\n        /// <param name=\"simulationOnly\">When true the configuration transformation will only be validated, not executed. When false, the configuration change will be persisted.</param>\r\n        public static void TransformConfiguration(XDocument xsltDocument, bool simulationOnly)\r\n        {\r\n            using (GlobalInitializerFacade.CoreLockScope)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    XslCompiledTransform transformer = new XslCompiledTransform();\r\n                    XDocument resultDocument = new XDocument();\r\n\r\n                    using (XmlReader reader = xsltDocument.CreateReader())\r\n                    {\r\n                        transformer.Load(reader);\r\n                    }\r\n\r\n                    using (XmlWriter writer = resultDocument.CreateWriter())\r\n                    {\r\n                        transformer.Transform(ConfigurationServices.FileConfigurationSourcePath, writer);\r\n                    }\r\n\r\n                    ValidateConfigurationFile(resultDocument);\r\n\r\n                    if (simulationOnly == false)\r\n                    {\r\n                        // Kill monitoring of file changes:\r\n                        //                        FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);\r\n                        resultDocument.SaveToFile(ConfigurationServices.FileConfigurationSourcePath);\r\n                        _configurationSource = new FileConfigurationSource(ConfigurationServices.FileConfigurationSourcePath);\r\n                        // Kill monitoring of file changes:\r\n                        //                        FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void TransformConfiguration(Func<XDocument, bool> transformer)\r\n        {\r\n            using (GlobalInitializerFacade.CoreLockScope)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    XDocument document = XDocumentUtils.Load(ConfigurationServices.FileConfigurationSourcePath);\r\n\r\n                    if (transformer(document))\r\n                    {\r\n                        ValidateConfigurationFile(document);\r\n\r\n                        // Kill monitoring of file changes:\r\n                        //                        FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);\r\n                        document.SaveToFile(ConfigurationServices.FileConfigurationSourcePath);\r\n                        _configurationSource = new FileConfigurationSource(ConfigurationServices.FileConfigurationSourcePath);\r\n                        // Kill monitoring of file changes:\r\n                        //                        FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);\r\n\r\n                        GlobalEventSystemFacade.ShutDownTheSystem();\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void ValidateConfigurationFile(XDocument resultDocument)\r\n        {\r\n            string tempValidationFilePath = TempRandomConfigFilePath;\r\n\r\n            resultDocument.SaveToFile(tempValidationFilePath);\r\n\r\n            try\r\n            {\r\n                IConfigurationSource testConfigSource = new FileConfigurationSource(tempValidationFilePath);\r\n\r\n                foreach (XElement sectionElement in resultDocument.Root.Element(\"configSections\").Elements())\r\n                {\r\n                    if (sectionElement.Attribute(\"name\") != null)\r\n                    {\r\n                        string sectionName = sectionElement.Attribute(\"name\").Value;\r\n\r\n                        try\r\n                        {\r\n                            testConfigSource.GetSection(sectionName);\r\n                        }\r\n                        catch (ConfigurationErrorsException exception)\r\n                        {\r\n                            if(exception.InnerException != null &&\r\n                               exception.InnerException is AppCodeTypeNotFoundConfigurationException)\r\n                            {\r\n                                // App_Code classes aren't compiled during package installation, therefore related exceptions are ignored\r\n                            }\r\n                            else\r\n                            {\r\n                                throw;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n                DeleteTempConfigurationFile(tempValidationFilePath);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                DeleteTempConfigurationFile(tempValidationFilePath);\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n        private static string TempRandomConfigFilePath\r\n        {\r\n            get\r\n            {\r\n                return string.Format(\"{0}.test.{1}.xml\", ConfigurationServices.FileConfigurationSourcePath, Guid.NewGuid());\r\n            }\r\n        }\r\n\r\n\r\n        private static void DeleteTempConfigurationFile(string tempValidationFilePath)\r\n        {\r\n            try\r\n            {\r\n                //                FileConfigurationSource.ResetImplementation(tempValidationFilePath, false); //turn file monitoring off\r\n                C1File.Delete(tempValidationFilePath);\r\n            }\r\n            catch (Exception) { }\r\n        }\r\n\r\n\r\n\r\n        private static string GetFileConfigurationSourcePath()\r\n        {\r\n            // Not using the web.config in order not to make solution depend on specific version of Microsoft Enterprice Library\r\n\r\n            return PathUtil.Resolve(\"~/App_Data/Composite/Composite.config\");\r\n            \r\n\r\n            //lock (_lock)\r\n            //{\r\n            //    ConfigurationSourceSection configurationSourceSection = GetActiveConfigurationSourceSection();\r\n\r\n            //    if (configurationSourceSection != null)\r\n            //    {\r\n            //        string systemSourceName = configurationSourceSection.SelectedSource;\r\n            //        ConfigurationSourceElement objectConfiguration = configurationSourceSection.Sources.Get(systemSourceName);\r\n\r\n            //        if (objectConfiguration != null)\r\n            //        {\r\n            //            FileConfigurationSourceElement fileConfigurationInfo = objectConfiguration as FileConfigurationSourceElement;\r\n            //            if (fileConfigurationInfo == null) throw new InvalidOperationException(\"Expected EntLib configuration source configuration to be of type \" + typeof(FileConfigurationSourceElement).Name);\r\n            //            string relativePath = fileConfigurationInfo.FilePath;\r\n            //            string tildePath = (Path.IsPathRooted(relativePath) ? \"~\" + relativePath : \"~/\" + relativePath);\r\n\r\n            //            return PathUtil.Resolve(tildePath);\r\n            //        }\r\n            //    }\r\n\r\n            //    return null;\r\n            //}\r\n        }\r\n\r\n\r\n\r\n        //private static ConfigurationSourceSection GetActiveConfigurationSourceSection()\r\n        //{\r\n        //    ConfigurationSourceSection configurationSourceSection = ConfigurationSourceSection.GetConfigurationSourceSection();\r\n\r\n        //    if (configurationSourceSection == null && ConfigurationSource != null)\r\n        //    {\r\n        //        configurationSourceSection = (ConfigurationSourceSection)ConfigurationSource.GetSection(ConfigurationSourceSection.SectionName);\r\n        //    }\r\n\r\n        //    return configurationSourceSection;\r\n        //}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/FileConfigurationSource.cs",
    "content": "﻿//===============================================================================\r\n// Microsoft patterns & practices Enterprise Library\r\n// Core\r\n//===============================================================================\r\n// Copyright © Microsoft Corporation.  All rights reserved.\r\n// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY\r\n// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT\r\n// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\r\n// FITNESS FOR A PARTICULAR PURPOSE.\r\n//===============================================================================\r\n\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>\r\n    /// This should be a part of the I/O layer\r\n    /// </summary>\r\n    internal class FileConfigurationSource : Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IProtectedConfigurationSource\r\n\t{\r\n\t\tprivate static Dictionary<string, FileConfigurationSourceImplementation> implementationByFilepath = new Dictionary<string, FileConfigurationSourceImplementation>(StringComparer.OrdinalIgnoreCase);\r\n\t\tprivate string configurationFilepath;\r\n\t\tprivate static object lockObject = new object();\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"The configuration is needed to boot the IO layer, so we cant use it here\")]\r\n\t\tpublic FileConfigurationSource(string configurationFilepath)\r\n        {\r\n            if (string.IsNullOrEmpty(configurationFilepath)) throw new ArgumentNullException(\"configurationFilepath\");\r\n\t\t\tthis.configurationFilepath = RootConfigurationFilePath(configurationFilepath);\r\n\r\n            if (!File.Exists(this.configurationFilepath)) throw new FileNotFoundException(\"File not found\", this.configurationFilepath);\r\n\t\t\tEnsureImplementation(this.configurationFilepath);\r\n\t\t}\r\n\r\n\t\t\r\n\r\n\t\t\r\n\t\tpublic System.Configuration.ConfigurationSection GetSection(string sectionName)\r\n\t\t{\r\n\t\t\treturn implementationByFilepath[configurationFilepath].GetSection(sectionName);\r\n\t\t}\r\n\r\n\t\t\r\n\r\n\r\n        public void AddSectionChangeHandler(string sectionName, Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationChangedEventHandler handler)\r\n\t\t{\r\n\t\t\timplementationByFilepath[configurationFilepath].AddSectionChangeHandler(sectionName, handler);\r\n\t\t}\r\n\r\n\t\t\r\n\r\n\r\n        public void RemoveSectionChangeHandler(string sectionName, Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationChangedEventHandler handler)\r\n\t\t{\r\n\t\t\timplementationByFilepath[configurationFilepath].RemoveSectionChangeHandler(sectionName, handler);\r\n\t\t}\r\n\r\n\t\t\r\n\r\n\r\n\t\tpublic void Save(string fileName, string section, System.Configuration.ConfigurationSection configurationSection)\r\n\t\t{\r\n            ValidateArgumentsAndFileExists(fileName, section, configurationSection);\r\n\r\n            InternalSave(fileName, section, configurationSection, string.Empty);\r\n\t\t}\r\n\r\n     \r\n\r\n        public void Save(string fileName, string section, System.Configuration.ConfigurationSection configurationSection, string protectionProvider)\r\n        {\r\n            ValidateArgumentsAndFileExists(fileName, section, configurationSection);\r\n            if (string.IsNullOrEmpty(protectionProvider)) throw new ArgumentNullException(\"protectionProvider\");\r\n\r\n            InternalSave(fileName, section, configurationSection, protectionProvider);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationManagerClass:DoNotUseConfigurationManagerClass\", Justification = \"The implementation may use it\")]\r\n        private void InternalSave(string fileName, string section, System.Configuration.ConfigurationSection configurationSection, string protectionProvider)\r\n        {\r\n            System.Configuration.ExeConfigurationFileMap fileMap = new System.Configuration.ExeConfigurationFileMap();\r\n            fileMap.ExeConfigFilename = fileName;\r\n            System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(fileMap, System.Configuration.ConfigurationUserLevel.None);\r\n            if (typeof(System.Configuration.ConnectionStringsSection) == configurationSection.GetType())\r\n            {\r\n                config.Sections.Remove(section);\r\n                UpdateConnectionStrings(section, configurationSection, config, protectionProvider);\r\n            }\r\n            else if (typeof(System.Configuration.AppSettingsSection) == configurationSection.GetType())\r\n            {\r\n                UpdateApplicationSettings(section, configurationSection, config, protectionProvider);\r\n            }\r\n            else\r\n            {\r\n                config.Sections.Remove(section);\r\n                config.Sections.Add(section, configurationSection);\r\n                ProtectConfigurationSection(configurationSection, protectionProvider);\r\n            }\r\n\r\n            config.Save();\r\n\r\n            UpdateImplementation(fileName);\r\n        }\r\n\r\n\r\n\r\n        private static void ProtectConfigurationSection(System.Configuration.ConfigurationSection configurationSection, string protectionProvider)\r\n        {\r\n            if (!string.IsNullOrEmpty(protectionProvider))\r\n            {\r\n                if(configurationSection.SectionInformation.ProtectionProvider == null\r\n                    || configurationSection.SectionInformation.ProtectionProvider.Name != protectionProvider)\r\n                {\r\n                    configurationSection.SectionInformation.ProtectSection(protectionProvider);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if(configurationSection.SectionInformation.ProtectionProvider != null)\r\n                {\r\n                    configurationSection.SectionInformation.UnprotectSection();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n        private void UpdateApplicationSettings(string section, System.Configuration.ConfigurationSection configurationSection, System.Configuration.Configuration config, string protectionProvider)\r\n        {\r\n            System.Configuration.AppSettingsSection current = config.AppSettings;\r\n            if (current == null)\r\n            {\r\n                config.Sections.Add(section, configurationSection);\r\n                ProtectConfigurationSection(configurationSection, protectionProvider);\r\n            }\r\n            else\r\n            {\r\n                System.Configuration.AppSettingsSection newApplicationSettings = configurationSection as System.Configuration.AppSettingsSection;\r\n                if (current.File != newApplicationSettings.File)\r\n                {\r\n                    current.File = newApplicationSettings.File;\r\n                }\r\n\r\n                List<string> newKeys = new List<string>(newApplicationSettings.Settings.AllKeys);\r\n                List<string> currentKeys = new List<string>(current.Settings.AllKeys);\r\n\r\n                foreach (string keyInCurrent in currentKeys)\r\n                {\r\n                    if (!newKeys.Contains(keyInCurrent))\r\n                    {\r\n                        current.Settings.Remove(keyInCurrent);\r\n                    }\r\n                }\r\n\r\n                foreach (string newKey in newKeys)\r\n                {\r\n                    if (!currentKeys.Contains(newKey))\r\n                    {\r\n                        current.Settings.Add(newKey, newApplicationSettings.Settings[newKey].Value);\r\n                    }\r\n                    else\r\n                    {\r\n                        if (current.Settings[newKey].Value != newApplicationSettings.Settings[newKey].Value)\r\n                        {\r\n                            current.Settings[newKey].Value = newApplicationSettings.Settings[newKey].Value;\r\n                        }\r\n                    }\r\n                }\r\n                ProtectConfigurationSection(current, protectionProvider);\r\n            }\r\n\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n\t\tprivate void UpdateConnectionStrings(string section, System.Configuration.ConfigurationSection configurationSection, System.Configuration.Configuration config, string protectionProvider)\r\n\t\t{\r\n\t\t\tSystem.Configuration.ConnectionStringsSection current = config.ConnectionStrings;\r\n\t\t\tif (current == null)\r\n\t\t\t{\r\n\t\t\t\tconfig.Sections.Add(section, configurationSection);\r\n                ProtectConfigurationSection(configurationSection, protectionProvider);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSystem.Configuration.ConnectionStringsSection newConnectionStrings = (System.Configuration.ConnectionStringsSection)configurationSection;\r\n\t\t\t\tforeach (System.Configuration.ConnectionStringSettings connectionString in newConnectionStrings.ConnectionStrings)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (current.ConnectionStrings[connectionString.Name] == null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcurrent.ConnectionStrings.Add(connectionString);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n                ProtectConfigurationSection(current, protectionProvider);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationManagerClass:DoNotUseConfigurationManagerClass\", Justification = \"The implementation may use it\")]\r\n\t\tpublic void Remove(string fileName, string section)\r\n        {\r\n            if (string.IsNullOrEmpty(fileName)) throw new ArgumentNullException(\"fileName\");\r\n            if (string.IsNullOrEmpty(section)) throw new ArgumentNullException(\"section\");\r\n\r\n\t\t\tSystem.Configuration.ExeConfigurationFileMap fileMap = new System.Configuration.ExeConfigurationFileMap();\r\n\t\t\tfileMap.ExeConfigFilename = fileName;\r\n\t\t\tSystem.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(fileMap, System.Configuration.ConfigurationUserLevel.None);\r\n\t\t\tif (config.Sections.Get(section) != null)\r\n\t\t\t{\r\n\t\t\t\tconfig.Sections.Remove(section);\r\n\t\t\t\tconfig.Save();\r\n\t\t\t\tUpdateImplementation(fileName);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t\r\n\r\n\r\n        public void Add(Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationParameter saveParameter, string sectionName, System.Configuration.ConfigurationSection configurationSection)\r\n\t\t{\r\n            Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationParameter parameter = saveParameter as Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationParameter;\r\n            if (null == parameter) throw new ArgumentNullException(\"saveParameter\");\r\n\r\n\t\t\tSave(parameter.FileName, sectionName, configurationSection);\r\n\t\t}\r\n\r\n\r\n      \r\n\r\n        public void Add(Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationParameter saveParameter, string sectionName, System.Configuration.ConfigurationSection configurationSection, string protectionProviderName)\r\n        {\r\n            Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationParameter parameter = saveParameter as Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationParameter;\r\n            if (null == parameter) throw new ArgumentNullException(\"saveParameter\");\r\n\r\n            Save(parameter.FileName, sectionName, configurationSection, protectionProviderName);\r\n            \r\n        }\r\n\r\n\t\r\n\r\n\r\n\t\tpublic void Remove(Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationParameter removeParameter, string sectionName)\r\n\t\t{\r\n            Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationParameter parameter = removeParameter as Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationParameter;\r\n            if (null == parameter) throw new ArgumentNullException(\"saveParameter\");\r\n\r\n\t\t\tRemove(parameter.FileName, sectionName);\r\n\t\t}\r\n        \r\n\r\n\r\n\t\tpublic static void ResetImplementation(string configurationFilepath, bool refreshing)\r\n\t\t{\r\n\t\t\tstring rootedConfigurationFilepath = RootConfigurationFilePath(configurationFilepath);\r\n\t\t\tFileConfigurationSourceImplementation currentImplementation = null;\r\n\t\t\timplementationByFilepath.TryGetValue(rootedConfigurationFilepath, out currentImplementation);\r\n\t\t\timplementationByFilepath[rootedConfigurationFilepath] = new FileConfigurationSourceImplementation(rootedConfigurationFilepath, refreshing);\r\n\r\n\t\t\tif (currentImplementation != null)\r\n\t\t\t{\r\n\t\t\t\tcurrentImplementation.Dispose();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\r\n        internal Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation Implementation\r\n\t\t{\r\n\t\t\tget { return implementationByFilepath[configurationFilepath]; }\r\n\t\t}\r\n\r\n\r\n\r\n        internal static Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation GetImplementation(string configurationFilepath)\r\n\t\t{\r\n\t\t\tstring rootedConfigurationFilepath = RootConfigurationFilePath(configurationFilepath);\r\n\t\t\tEnsureImplementation(rootedConfigurationFilepath);\r\n\t\t\treturn implementationByFilepath[rootedConfigurationFilepath];\r\n\t\t}\r\n\r\n\r\n\r\n\t\tprivate static void ValidateArgumentsAndFileExists(string fileName, string section, System.Configuration.ConfigurationSection configurationSection)\r\n        {\r\n            if (string.IsNullOrEmpty(fileName)) throw new ArgumentNullException(\"fileName\");\r\n            if (string.IsNullOrEmpty(section)) throw new ArgumentNullException(\"section\");\r\n            if (null == configurationSection) throw new ArgumentNullException(\"configurationSection\");\r\n\r\n\t\t\tif (!C1File.Exists(fileName)) throw new FileNotFoundException(string.Format(\"\", \"Resources.ExceptionConfigurationFileNotFound\", section), fileName);\r\n\t\t}\r\n\r\n\r\n\r\n\t\tprivate static string RootConfigurationFilePath(string configurationFile)\r\n\t\t{\r\n\t\t\tstring rootedConfigurationFile = (string)configurationFile.Clone();\r\n\t\t\tif (!Path.IsPathRooted(rootedConfigurationFile))\r\n\t\t\t{\r\n\t\t\t\trootedConfigurationFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, rootedConfigurationFile);\r\n\t\t\t}\r\n\t\t\treturn rootedConfigurationFile;\r\n\t\t}\r\n\r\n\r\n\r\n\t\tprivate static void EnsureImplementation(string rootedConfigurationFile)\r\n\t\t{\r\n\t\t\tif (!implementationByFilepath.ContainsKey(rootedConfigurationFile))\r\n\t\t\t{\r\n\t\t\t\tlock (lockObject)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!implementationByFilepath.ContainsKey(rootedConfigurationFile))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFileConfigurationSourceImplementation implementation = new FileConfigurationSourceImplementation(rootedConfigurationFile);\r\n\t\t\t\t\t\timplementationByFilepath.Add(rootedConfigurationFile, implementation);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\r\n\t\tprivate static void UpdateImplementation(string fileName)\r\n\t\t{\r\n\t\t\tFileConfigurationSourceImplementation implementation;\r\n\t\t\timplementationByFilepath.TryGetValue(fileName, out implementation);\r\n\t\t\tif (implementation != null)\r\n\t\t\t{\r\n\t\t\t\timplementation.UpdateCache();\r\n\t\t\t}\r\n\t\t}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/FileConfigurationSourceImplementation.cs",
    "content": "//===============================================================================\r\n// Microsoft patterns & practices Enterprise Library\r\n// Core\r\n//===============================================================================\r\n// Copyright © Microsoft Corporation.  All rights reserved.\r\n// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY\r\n// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT\r\n// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\r\n// FITNESS FOR A PARTICULAR PURPOSE.\r\n//===============================================================================\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>\r\n    /// This should be a part of the I/O layer\r\n    /// </summary>\r\n    internal class FileConfigurationSourceImplementation : Microsoft.Practices.EnterpriseLibrary.Common.Configuration.BaseFileConfigurationSourceImplementation\r\n    {\r\n        private string configurationFilepath;\r\n        private System.Configuration.ExeConfigurationFileMap fileMap;\r\n        private System.Configuration.Configuration cachedConfiguration;\r\n        private object cachedConfigurationLock = new object();\r\n\r\n\r\n\r\n        public FileConfigurationSourceImplementation(string configurationFilepath)\r\n            : this(configurationFilepath, true)\r\n        {\r\n        }\r\n\r\n       \r\n\r\n        public FileConfigurationSourceImplementation(string configurationFilepath, bool refresh)\r\n            : base(configurationFilepath, refresh)\r\n        {\r\n            this.configurationFilepath = configurationFilepath;\r\n            this.fileMap = new System.Configuration.ExeConfigurationFileMap();\r\n            fileMap.ExeConfigFilename = configurationFilepath;\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n        public override System.Configuration.ConfigurationSection GetSection(string sectionName)\r\n        {\r\n            System.Configuration.Configuration configuration = GetConfiguration();\r\n            System.Configuration.ConfigurationSection configurationSection;\r\n\r\n            try\r\n            {\r\n                configurationSection = configuration.GetSection(sectionName) as System.Configuration.ConfigurationSection;\r\n            }\r\n            catch\r\n            {\r\n                // retry once\r\n                UpdateCache();\r\n                configuration = GetConfiguration();\r\n                configurationSection = configuration.GetSection(sectionName) as System.Configuration.ConfigurationSection;\r\n            }\r\n\r\n            SetConfigurationWatchers(sectionName, configurationSection);\r\n\r\n            return configurationSection;\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"The implementation may use it\")]\r\n        protected override void RefreshAndValidateSections(IDictionary<string, string> localSectionsToRefresh, IDictionary<string, string> externalSectionsToRefresh, out ICollection<string> sectionsToNotify, out IDictionary<string, string> sectionsWithChangedConfigSource)\r\n        {\r\n            UpdateCache();\r\n\r\n            sectionsToNotify = new List<string>();\r\n            sectionsWithChangedConfigSource = new Dictionary<string, string>();\r\n\r\n            // refresh local sections and determine what to do.\r\n            foreach (KeyValuePair<string, string> sectionMapping in localSectionsToRefresh)\r\n            {\r\n                System.Configuration.ConfigurationSection section = cachedConfiguration.GetSection(sectionMapping.Key) as System.Configuration.ConfigurationSection;\r\n                string refreshedConfigSource = section != null ? section.SectionInformation.ConfigSource : NullConfigSource;\r\n                if (!sectionMapping.Value.Equals(refreshedConfigSource))\r\n                {\r\n                    sectionsWithChangedConfigSource.Add(sectionMapping.Key, refreshedConfigSource);\r\n                }\r\n\r\n                // notify anyway, since it might have been updated.\r\n                sectionsToNotify.Add(sectionMapping.Key);\r\n            }\r\n\r\n            // refresh external sections and determine what to do.\r\n            foreach (KeyValuePair<string, string> sectionMapping in externalSectionsToRefresh)\r\n            {\r\n                System.Configuration.ConfigurationSection section = cachedConfiguration.GetSection(sectionMapping.Key) as System.Configuration.ConfigurationSection;\r\n                string refreshedConfigSource = section != null ? section.SectionInformation.ConfigSource : NullConfigSource;\r\n                if (!sectionMapping.Value.Equals(refreshedConfigSource))\r\n                {\r\n                    sectionsWithChangedConfigSource.Add(sectionMapping.Key, refreshedConfigSource);\r\n\r\n                    // notify only if che config source changed\r\n                    sectionsToNotify.Add(sectionMapping.Key);\r\n                }\r\n            }\r\n        }\r\n\r\n        \r\n\r\n        protected override void RefreshExternalSections(string[] sectionsToRefresh)\r\n        {\r\n            UpdateCache();\r\n        }\r\n\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationManagerClass:DoNotUseConfigurationManagerClass\", Justification = \"The implementation may use it\")]\r\n        private System.Configuration.Configuration GetConfiguration()\r\n        {\r\n            if (cachedConfiguration == null)\r\n            {\r\n                lock (cachedConfigurationLock)\r\n                {\r\n                    if (cachedConfiguration == null)\r\n                    {\r\n                        cachedConfiguration = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(fileMap, System.Configuration.ConfigurationUserLevel.None);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return cachedConfiguration;\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationManagerClass:DoNotUseConfigurationManagerClass\", Justification = \"The implementation may use it\")]\r\n        internal void UpdateCache()\r\n        {\r\n            System.Configuration.Configuration newConfiguration\r\n                = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(fileMap, System.Configuration.ConfigurationUserLevel.None);\r\n            lock (cachedConfigurationLock)\r\n            {\r\n                cachedConfiguration = newConfiguration;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Foundation/PluginFacades/GlobalSettingsProviderPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Configuration.BuildinPlugins.GlobalSettingsProvider;\r\nusing Composite.Core.Configuration.Plugins.GlobalSettingsProvider;\r\nusing Composite.Core.Configuration.Plugins.GlobalSettingsProvider.Runtime;\r\n\r\n\r\nnamespace Composite.Core.Configuration.Foundation.PluginFacades\r\n{\r\n    internal sealed class GlobalSettingsProviderPluginFacade\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = \r\n            new ResourceLocker<Resources>(new Resources(), Resources.Initialize, false);\r\n\r\n        static GlobalSettingsProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static string ApplicationName\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.ApplicationName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string ApplicationShortName\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.ApplicationShortName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string BrandedVersionAssemblySource\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.BrandedVersionAssemblySource);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string AutoCreatedAdministratorUserName\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.AutoCreatedAdministratorUserName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string DefaultCultureName\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.DefaultCultureName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string ConfigurationDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.ConfigurationDirectory);\r\n            }\r\n        }\r\n\r\n\r\n        public static string GeneratedAssembliesDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.GeneratedAssembliesDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string SerializedWorkflowsDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.SerializedWorkflowsDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string SerializedConsoleMessagesDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.SerializedConsoleMessagesDirectory);\r\n            }\r\n        }\r\n\r\n\r\n        public static string AppCodeDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.AppCodeDirectory);\r\n            }\r\n        }\r\n\r\n\r\n        public static string BinDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.BinDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string TempDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.TempDirectory);\r\n            }\r\n        }\r\n        \r\n\r\n        public static string CacheDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.CacheDirectory);\r\n            }\r\n        }\r\n\r\n\r\n        public static string PackageDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.PackageDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string AutoPackageInstallDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.AutoPackageInstallDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string TreeDefinitionsDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.TreeDefinitionsDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string PageTemplateFeaturesDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.PageTemplateFeaturesDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string DataMetaDataDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.DataMetaDataDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string InlineCSharpFunctionDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.InlineCSharpFunctionDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string PackageLicenseDirectory\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.PackageLicenseDirectory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> NonProbableAssemblyNames\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.NonProbableAssemblyNames);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static int ConsoleMessageQueueItemSecondToLive\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.ConsoleMessageQueueItemSecondToLive);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static bool EnableDataTypesAutoUpdate\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.EnableDataTypesAutoUpdate);\r\n            }\r\n        }\r\n\r\n\r\n        public static bool BroadcastConsoleElementChanges\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.BroadcastConsoleElementChanges);\r\n            }\r\n        }\r\n\r\n        public static bool OnlyTranslateWhenApproved\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.OnlyTranslateWhenApproved);\r\n            }\r\n        }\r\n\r\n\r\n        public static bool AllowChildPagesTranslationWithoutParent\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.AllowChildPagesTranslationWithoutParent);\r\n            }\r\n        }\r\n\r\n\r\n        public static string WorkflowTimeout\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.WorkflowTimeout);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string ConsoleTimeout\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.ConsoleTimeout);\r\n            }\r\n        }\r\n\r\n        public static ICachingSettings Caching\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.Caching);\r\n            }\r\n        }\r\n\r\n\r\n        public static int ImageQuality\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.ImageQuality);\r\n            }\r\n        }\r\n\r\n\r\n        public static bool PrettifyPublicMarkup\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.PrettifyPublicMarkup);\r\n            }\r\n        }\r\n\r\n\r\n        public static bool PrettifyRenderFunctionExceptions\r\n        {\r\n            get\r\n            {\r\n                return UseReaderLock(provider => provider.PrettifyRenderFunctionExceptions);\r\n            }\r\n        }\r\n\r\n\r\n        public static bool FunctionPreviewEnabled => UseReaderLock(p => p.FunctionPreviewEnabled);\r\n\r\n        public static TimeZoneInfo TimeZone => UseReaderLock(p => p.TimeZone);\r\n\r\n        public static bool InheritGlobalReadPermissionOnHiddenPerspectives =>\r\n            UseReaderLock(p => p.InheritGlobalReadPermissionOnHiddenPerspectives);\r\n\r\n        public static bool OmitAspNetWebFormsSupport => UseReaderLock(p => p.OmitAspNetWebFormsSupport);\r\n\r\n        public static bool ProtectResizedImagesWithHash => UseReaderLock(p => p.ProtectResizedImagesWithHash);\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException($\"Failed to load the configuration section '{GlobalSettingsProviderSettings.SectionName}' from the configuration.\", ex);\r\n        }\r\n\r\n        private delegate T ExecuteDelegate<T>(IGlobalSettingsProvider provider);\r\n        private static T UseReaderLock<T>(ExecuteDelegate<T> function)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                return function(_resourceLocker.Resources.Provider);\r\n            }\r\n        }\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public GlobalSettingsProviderFactory Factory { get; set; }\r\n            public IGlobalSettingsProvider Provider { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                var configSource = ConfigurationServices.ConfigurationSource;\r\n\r\n                if (RuntimeInformation.IsUnittest\r\n                    && configSource?.GetSection(GlobalSettingsProviderSettings.SectionName) == null)\r\n                {\r\n                    resources.Provider = new BuildinGlobalSettingsProvider();\r\n                }\r\n                else\r\n                {\r\n                    try\r\n                    {\r\n                        resources.Factory = new GlobalSettingsProviderFactory();\r\n                        resources.Provider = resources.Factory.CreateDefault();\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/GlobalSettingsFacade.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Plugins.PageTemplates.Razor;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class CachingSettings\r\n    {\r\n        /// <exclude />\r\n        public const int DefaultCacheSize = -1;\r\n\r\n        /// <exclude />\r\n        public const int NoCacheSize = 0;\r\n\r\n\r\n        internal CachingSettings(bool enabled, int size)\r\n        {\r\n            this.Enabled = enabled;\r\n            this.Size = size;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Enabled { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// One of three values:\r\n        /// NoCacheSize: The caller should use not use caching\r\n        /// DefaultCacheSize: The caller should use its own default size\r\n        /// All other values (> 0): The caller should use this size\r\n        /// See <see cref=\"GetSize\"/>\r\n        /// </summary>\r\n        public int Size { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the configured size or if the configured size is default size, then it uses\r\n        /// the <paramref name=\"defaultSize\"/> value.\r\n        /// </summary>\r\n        /// <param name=\"defaultSize\"></param>\r\n        /// <returns></returns>\r\n        public int GetSize(int defaultSize)\r\n        {\r\n            if (this.Size == DefaultCacheSize) return defaultSize;\r\n\r\n            return this.Size;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class GlobalSettingsFacade\r\n    {\r\n        private static IGlobalSettingsFacade _globalSettingsFacade = new GlobalSettingsFacadeImpl();\r\n\r\n\r\n        internal static IGlobalSettingsFacade Implementation\r\n        {\r\n            get => _globalSettingsFacade;\r\n            set => _globalSettingsFacade = value;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The name of the application to be displayed in the UI.\r\n        /// </summary>\r\n        public static string ApplicationName => _globalSettingsFacade.ApplicationName;\r\n\r\n        /// <summary>\r\n        /// The short name of the application to be displayed in the UI.\r\n        /// </summary>\r\n        public static string ApplicationShortName => _globalSettingsFacade.ApplicationShortName;\r\n\r\n        /// <summary>\r\n        /// Name of an assembly file, which version should displayed as a product version in UI.\r\n        /// </summary>\r\n        public static string BrandedVersionAssemblySource => _globalSettingsFacade.BrandedVersionAssemblySource;\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo DefaultCultureInfo => _globalSettingsFacade.DefaultCultureInfo;\r\n\r\n\r\n        /// <exclude />\r\n        public static string DefaultCultureName => _globalSettingsFacade.DefaultCultureName;\r\n\r\n\r\n        /// <exclude />\r\n        public static string ConfigurationDirectory => _globalSettingsFacade.ConfigurationDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string GeneratedAssembliesDirectory => _globalSettingsFacade.GeneratedAssembliesDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string SerializedWorkflowsDirectory => _globalSettingsFacade.SerializedWorkflowsDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string SerializedConsoleMessagesDirectory => _globalSettingsFacade.SerializedConsoleMessagesDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string AppCodeDirectory => _globalSettingsFacade.AppCodeDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string BinDirectory => _globalSettingsFacade.BinDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string TempDirectory => _globalSettingsFacade.TempDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string CacheDirectory => _globalSettingsFacade.CacheDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string PackageDirectory => _globalSettingsFacade.PackageDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string AutoPackageInstallDirectory => _globalSettingsFacade.AutoPackageInstallDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string TreeDefinitionsDirectory => _globalSettingsFacade.TreeDefinitionsDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string PageTemplateFeaturesDirectory => _globalSettingsFacade.PageTemplateFeaturesDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string DataMetaDataDirectory => _globalSettingsFacade.DataMetaDataDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string InlineCSharpFunctionDirectory => _globalSettingsFacade.InlineCSharpFunctionDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static string PackageLicenseDirectory => _globalSettingsFacade.PackageLicenseDirectory;\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> NonProbableAssemblyNames => _globalSettingsFacade.NonProbableAssemblyNames;\r\n\r\n\r\n        /// <exclude />\r\n        public static void AddNonProbableAssemblyName(string assemblyNamePatern)\r\n        {\r\n            _globalSettingsFacade.AddNonProbableAssemblyName(assemblyNamePatern);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveNonProbableAssemblyName(string assemblyNamePatern)\r\n        {\r\n            _globalSettingsFacade.RemoveNonProbableAssemblyName(assemblyNamePatern);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static int ConsoleMessageQueueItemSecondToLive => _globalSettingsFacade.ConsoleMessageQueueItemSecondToLive;\r\n\r\n\r\n        /// <exclude />\r\n        public static bool EnableDataTypesAutoUpdate => _globalSettingsFacade.EnableDataTypesAutoUpdate;\r\n\r\n\r\n        /// <exclude />\r\n        public static bool BroadcastConsoleElementChanges => _globalSettingsFacade.BroadcastConsoleElementChanges;\r\n\r\n\r\n        /// <exclude />\r\n        public static string AutoCreatedAdministratorUserName => _globalSettingsFacade.AutoCreatedAdministratorUserName;\r\n\r\n\r\n        /// <exclude />\r\n        public static TimeSpan WorkflowTimeout => _globalSettingsFacade.WorkflowTimeout;\r\n\r\n\r\n        /// <exclude />\r\n        public static TimeSpan ConsoleTimeout => _globalSettingsFacade.ConsoleTimeout;\r\n\r\n\r\n        /// <exclude />\r\n        public static TimeSpan DefaultReaderLockWaitTimeout => TimeSpan.FromMinutes(5);\r\n\r\n\r\n        /// <exclude />\r\n        public static TimeSpan DefaultWriterLockWaitTimeout => TimeSpan.FromMinutes(5);\r\n\r\n\r\n        /// <exclude />\r\n        public static ICachingSettings Caching => _globalSettingsFacade.Caching;\r\n\r\n\r\n        /// <exclude />\r\n        public static int ImageQuality => _globalSettingsFacade.ImageQuality;\r\n\r\n        /// <summary>\r\n        /// When <value>true</value> only pages that are published or awaiting publication can be translated in console.\r\n        /// </summary>\r\n        public static bool OnlyTranslateWhenApproved => _globalSettingsFacade.OnlyTranslateWhenApproved;\r\n\r\n        /// <summary>\r\n        /// When <value>true</value> child pages can be translated without translated parent page.\r\n        /// </summary>\r\n        public static bool AllowChildPagesTranslationWithoutParent => _globalSettingsFacade.AllowChildPagesTranslationWithoutParent;\r\n\r\n        /// <summary>\r\n        /// The maximum number of characters the path to the application root (like 'C:\\InetPub\\MySite') can contain.\r\n        /// C1 CMS create files below this path, some of which have very long paths - if the root path is long enough the combined length\r\n        /// can exceed a limitation in Microsoft Windows - see http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#paths\r\n        /// </summary>\r\n        public static int MaximumRootPathLength => 90;\r\n\r\n        /// <summary>\r\n        /// When <value>true</value> the output XHTML markup  will be formatted. \r\n        /// </summary>\r\n        public static bool PrettifyPublicMarkup => _globalSettingsFacade.PrettifyPublicMarkup;\r\n\r\n        /// <summary>\r\n        /// When true exceptions thrown by C1 Functions during a page rendering will be prettified - ensuring the rest of the page render okay.\r\n        /// For unauthenticated requests this will become \"error\", while authenticated users get error info.\r\n        /// </summary>\r\n        public static bool PrettifyRenderFunctionExceptions => _globalSettingsFacade.PrettifyRenderFunctionExceptions;\r\n\r\n        /// <exclude />\r\n        public static bool FunctionPreviewEnabled => _globalSettingsFacade.FunctionPreviewEnabled;\r\n\r\n        /// <exclude />\r\n        public static TimeZoneInfo TimeZone => _globalSettingsFacade.TimeZone;\r\n\r\n        /// <exclude />\r\n        public static bool InheritGlobalReadPermissionOnHiddenPerspectives\r\n            => _globalSettingsFacade.InheritGlobalReadPermissionOnHiddenPerspectives;\r\n\r\n        /// <summary>\r\n        /// When <value>true</value>, a page request handler that doesn't support UserControl functions will be used.\r\n        /// Applicable for <see cref=\"IPageTemplateProvider\" />-s, that return renderer-s implementing <see cref=\"ISlimPageRenderer\"/> interface\r\n        /// (f.e. <see cref=\"RazorPageTemplateProvider\"/>).\r\n        /// </summary>\r\n        public static bool OmitAspNetWebFormsSupport => _globalSettingsFacade.OmitAspNetWebFormsSupport;\r\n\r\n        /// <summary>\r\n        /// When <value>true</value>, image URLs with resizing options will have a hash appended to ensure that the URLs are generated by the website.\r\n        /// </summary>\r\n        public static bool ProtectResizedImagesWithHash => _globalSettingsFacade.ProtectResizedImagesWithHash;\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static CachingSettings GetNamedCaching(string name)\r\n        {\r\n            ICacheSettings cacheSettings = Caching.Caches.FirstOrDefault(f => f.Name == name);\r\n\r\n            bool enabled = Caching.Enabled;\r\n            int size = CachingSettings.DefaultCacheSize;\r\n            if (enabled && cacheSettings != null)\r\n            {\r\n                enabled = cacheSettings.Enabled && cacheSettings.Size != CachingSettings.NoCacheSize;\r\n                size = cacheSettings.Size;\r\n            }\r\n\r\n            var cachingSettings = new CachingSettings(enabled, size);\r\n\r\n            return cachingSettings;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Configuration/GlobalSettingsFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.Configuration.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    internal sealed class GlobalSettingsFacadeImpl : IGlobalSettingsFacade\r\n    {\r\n        private readonly List<string> _addedNonProbableAssemblyNames = new List<string>();\r\n        private readonly object _lock = new object();\r\n\r\n\r\n        public string ApplicationName => GlobalSettingsProviderPluginFacade.ApplicationName;\r\n\r\n        public string ApplicationShortName => GlobalSettingsProviderPluginFacade.ApplicationShortName;\r\n\r\n        public string BrandedVersionAssemblySource => GlobalSettingsProviderPluginFacade.BrandedVersionAssemblySource;\r\n\r\n\r\n        public CultureInfo DefaultCultureInfo\r\n        {\r\n            get\r\n            {\r\n                string defaultCultureName = GlobalSettingsProviderPluginFacade.DefaultCultureName;\r\n\r\n                return CultureInfo.CreateSpecificCulture(defaultCultureName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string DefaultCultureName\r\n        {\r\n            get\r\n            {\r\n                string defaultCultureName = GlobalSettingsProviderPluginFacade.DefaultCultureName;\r\n\r\n                var defaultCulture = CultureInfo.CreateSpecificCulture(defaultCultureName);\r\n\r\n                return defaultCulture.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string ConfigurationDirectory => GlobalSettingsProviderPluginFacade.ConfigurationDirectory;\r\n\r\n\r\n        public string GeneratedAssembliesDirectory => GlobalSettingsProviderPluginFacade.GeneratedAssembliesDirectory;\r\n\r\n\r\n        public string SerializedWorkflowsDirectory => GlobalSettingsProviderPluginFacade.SerializedWorkflowsDirectory;\r\n\r\n\r\n        public string SerializedConsoleMessagesDirectory => GlobalSettingsProviderPluginFacade.SerializedConsoleMessagesDirectory;\r\n\r\n\r\n        public string AppCodeDirectory => GlobalSettingsProviderPluginFacade.AppCodeDirectory;\r\n\r\n\r\n        public string BinDirectory => GlobalSettingsProviderPluginFacade.BinDirectory;\r\n\r\n\r\n        public string TempDirectory => GlobalSettingsProviderPluginFacade.TempDirectory;\r\n\r\n\r\n        public string CacheDirectory => GlobalSettingsProviderPluginFacade.CacheDirectory;\r\n\r\n\r\n        public string PackageDirectory => GlobalSettingsProviderPluginFacade.PackageDirectory;\r\n\r\n\r\n        public string AutoPackageInstallDirectory => GlobalSettingsProviderPluginFacade.AutoPackageInstallDirectory;\r\n\r\n\r\n        public string TreeDefinitionsDirectory => GlobalSettingsProviderPluginFacade.TreeDefinitionsDirectory;\r\n\r\n\r\n        public string PageTemplateFeaturesDirectory => GlobalSettingsProviderPluginFacade.PageTemplateFeaturesDirectory;\r\n\r\n\r\n        public string DataMetaDataDirectory => GlobalSettingsProviderPluginFacade.DataMetaDataDirectory;\r\n\r\n\r\n        public string InlineCSharpFunctionDirectory => GlobalSettingsProviderPluginFacade.InlineCSharpFunctionDirectory;\r\n\r\n\r\n        public string PackageLicenseDirectory => GlobalSettingsProviderPluginFacade.PackageLicenseDirectory;\r\n\r\n\r\n        public IEnumerable<string> NonProbableAssemblyNames\r\n        {\r\n            get\r\n            {\r\n                foreach (string nonProbableAssemblyName in GlobalSettingsProviderPluginFacade.NonProbableAssemblyNames)\r\n                {\r\n                    yield return nonProbableAssemblyName;\r\n                }\r\n                lock (_lock)\r\n                {\r\n                    foreach (string nonProbableAssemblyName in _addedNonProbableAssemblyNames)\r\n                    {\r\n                        yield return nonProbableAssemblyName;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public void AddNonProbableAssemblyName(string assemblyNamePatern)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _addedNonProbableAssemblyNames.Add(assemblyNamePatern);\r\n            }\r\n        }\r\n\r\n\r\n        public void RemoveNonProbableAssemblyName(string assemblyNamePatern)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (!_addedNonProbableAssemblyNames.Contains(assemblyNamePatern))\r\n                {\r\n                    throw new InvalidOperationException(\"The assembly name pattern has not been added\");\r\n                }\r\n                _addedNonProbableAssemblyNames.Remove(assemblyNamePatern);\r\n            }\r\n        }\r\n\r\n\r\n        public int ConsoleMessageQueueItemSecondToLive => GlobalSettingsProviderPluginFacade.ConsoleMessageQueueItemSecondToLive;\r\n\r\n\r\n        public bool EnableDataTypesAutoUpdate => GlobalSettingsProviderPluginFacade.EnableDataTypesAutoUpdate;\r\n\r\n\r\n        public bool BroadcastConsoleElementChanges => GlobalSettingsProviderPluginFacade.BroadcastConsoleElementChanges;\r\n\r\n\r\n        public string AutoCreatedAdministratorUserName => GlobalSettingsProviderPluginFacade.AutoCreatedAdministratorUserName;\r\n\r\n\r\n        public TimeSpan WorkflowTimeout => TimeSpan.Parse(GlobalSettingsProviderPluginFacade.WorkflowTimeout);\r\n\r\n\r\n        public TimeSpan ConsoleTimeout => TimeSpan.Parse(GlobalSettingsProviderPluginFacade.ConsoleTimeout);\r\n\r\n        public bool OnlyTranslateWhenApproved => GlobalSettingsProviderPluginFacade.OnlyTranslateWhenApproved;\r\n\r\n        public bool AllowChildPagesTranslationWithoutParent => GlobalSettingsProviderPluginFacade.AllowChildPagesTranslationWithoutParent;\r\n\r\n        public ICachingSettings Caching => GlobalSettingsProviderPluginFacade.Caching;\r\n\r\n\r\n        public int ImageQuality => GlobalSettingsProviderPluginFacade.ImageQuality;\r\n\r\n        public bool PrettifyPublicMarkup => GlobalSettingsProviderPluginFacade.PrettifyPublicMarkup;\r\n\r\n        public bool PrettifyRenderFunctionExceptions => GlobalSettingsProviderPluginFacade.PrettifyRenderFunctionExceptions;\r\n\r\n        public bool FunctionPreviewEnabled => GlobalSettingsProviderPluginFacade.FunctionPreviewEnabled;\r\n\r\n        public TimeZoneInfo TimeZone => GlobalSettingsProviderPluginFacade.TimeZone;\r\n\r\n        public bool InheritGlobalReadPermissionOnHiddenPerspectives =>\r\n            GlobalSettingsProviderPluginFacade.InheritGlobalReadPermissionOnHiddenPerspectives;\r\n\r\n        public bool OmitAspNetWebFormsSupport => GlobalSettingsProviderPluginFacade.OmitAspNetWebFormsSupport;\r\n\r\n        public bool ProtectResizedImagesWithHash => GlobalSettingsProviderPluginFacade.ProtectResizedImagesWithHash;\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Configuration/ICachingSettings.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface ICachingSettings\r\n\t{\r\n        /// <exclude />\r\n        bool Enabled { get; }\r\n\r\n        /// <exclude />\r\n        IEnumerable<ICacheSettings> Caches { get; }\r\n\t}\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface ICacheSettings\r\n    {\r\n        /// <exclude />\r\n        string Name { get; }\r\n\r\n        /// <exclude />\r\n        bool Enabled { get; }\r\n\r\n        /// <exclude />\r\n        int Size { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/IGlobalSettingsFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    internal interface IGlobalSettingsFacade\r\n    {\r\n        string ApplicationName { get; }\r\n        string ApplicationShortName { get; }\r\n        string BrandedVersionAssemblySource { get; }\r\n        CultureInfo DefaultCultureInfo { get; }\r\n        string DefaultCultureName { get; }\r\n        string ConfigurationDirectory { get; }\r\n        string GeneratedAssembliesDirectory { get; }\r\n        string SerializedWorkflowsDirectory { get; }\r\n        string SerializedConsoleMessagesDirectory { get; }\r\n        string BinDirectory { get; }\r\n        string AppCodeDirectory { get; }\r\n        string TempDirectory { get; }\r\n        string CacheDirectory { get; }\r\n        string PackageDirectory { get; }\r\n        string AutoPackageInstallDirectory { get; }\r\n        string TreeDefinitionsDirectory { get; }\r\n        string PageTemplateFeaturesDirectory { get; }\r\n        string DataMetaDataDirectory { get; }\r\n        string InlineCSharpFunctionDirectory { get; }\r\n        string PackageLicenseDirectory { get; }\r\n        IEnumerable<string> NonProbableAssemblyNames { get; }\r\n        void AddNonProbableAssemblyName(string assemblyNamePatern);\r\n        void RemoveNonProbableAssemblyName(string assemblyNamePatern);\r\n        int ConsoleMessageQueueItemSecondToLive { get; }\r\n        bool EnableDataTypesAutoUpdate { get; }\r\n        bool BroadcastConsoleElementChanges { get; }\r\n        string AutoCreatedAdministratorUserName { get; }\r\n        TimeSpan WorkflowTimeout { get; }\r\n        TimeSpan ConsoleTimeout { get; }\r\n        bool OnlyTranslateWhenApproved { get; }\r\n        bool AllowChildPagesTranslationWithoutParent { get; }\r\n        ICachingSettings Caching { get; }\r\n        int ImageQuality { get; }\r\n        bool PrettifyPublicMarkup { get; }\r\n        bool PrettifyRenderFunctionExceptions { get; }\r\n        bool FunctionPreviewEnabled { get; }\r\n        TimeZoneInfo TimeZone { get; }\r\n        bool InheritGlobalReadPermissionOnHiddenPerspectives { get; }\r\n        bool OmitAspNetWebFormsSupport { get; }\r\n        bool ProtectResizedImagesWithHash { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/InstallationInformationFacade.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class InstallationInformationFacade\r\n    {\r\n        private static Guid _installationId;\r\n\r\n        static InstallationInformationFacade()\r\n        {\r\n            string filepath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.ConfigurationDirectory), \"InstallationInformation.xml\");\r\n\r\n            if (C1File.Exists(filepath))\r\n            {\r\n                XDocument doc = XDocumentUtils.Load(filepath);\r\n\r\n                XAttribute idAttribute = doc.Root.Attribute(\"installationId\");\r\n\r\n                _installationId = (Guid)idAttribute;\r\n            }\r\n            else\r\n            {\r\n                InitializeNewFile(filepath);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Guid InstallationId\r\n        {\r\n            get \r\n            {\r\n                return _installationId;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void InitializeNewFile(string filepath)\r\n        {\r\n            _installationId = Guid.NewGuid();\r\n\r\n            string directory = Path.GetDirectoryName(filepath);\r\n            if (C1Directory.Exists(directory) == false)\r\n            {\r\n                C1Directory.CreateDirectory(directory);\r\n            }\r\n\r\n            XDocument doc = new XDocument(\r\n                        new XElement(\"InstallationInformation\",\r\n                            new XAttribute(\"installationId\", _installationId)\r\n                        )\r\n                    );\r\n\r\n            doc.SaveToFile(filepath);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/NameTypeManagerTypeConfigurationElement.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.ComponentModel;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>\r\n    /// Represents a <see cref=\"ConfigurationElement\"/> that has a name and type known to <see cref=\"Composite.Core.Types.TypeManager\"/>.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class NameTypeManagerTypeConfigurationElement : NamedConfigurationElement, IObjectWithNameAndType\r\n    {\r\n        private const string _typePropertyName = \"type\";\r\n\r\n        /// <summary>\r\n        /// Gets or sets the <see cref=\"Type\"/> the element is the configuration for.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The <see cref=\"Type\"/> the element is the configuration for.\r\n        /// </value>\r\n        [ConfigurationProperty(_typePropertyName, IsRequired = true)]\r\n        [TypeConverter(typeof(TypeManagerTypeNameConverter))]\r\n        public Type Type\r\n        {\r\n            get\r\n            {\r\n                return (Type)this[_typePropertyName];\r\n            }\r\n            set\r\n            {\r\n                this[_typePropertyName] = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/NameTypeManagerTypeConfigurationElementCollection.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Xml;\r\nusing Composite.Core.Extensions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NameTypeManagerTypeConfigurationElementCollection<T> : PolymorphicConfigurationElementCollection<T>\r\n        where T : NameTypeManagerTypeConfigurationElement, new()\r\n    {\r\n        private const string typeAttribute = \"type\";\r\n\r\n        /// <summary>\r\n        /// Get the configuration object for each <see cref=\"NameTypeConfigurationElement\"/> object in the collection.\r\n        /// </summary>\r\n        /// <param name=\"reader\">The <see cref=\"XmlReader\"/> that is deserializing the element.</param>\r\n        protected override Type RetrieveConfigurationElementType(XmlReader reader)\r\n        {\r\n            Type configurationElementType = null;\r\n            if (reader.AttributeCount > 0)\r\n            {\r\n                // expect the first attribute to be the name\r\n                for (bool go = reader.MoveToFirstAttribute(); go; go = reader.MoveToNextAttribute())\r\n                {\r\n                    if (typeAttribute.Equals(reader.Name))\r\n                    {\r\n                        string typeReference = reader.Value;\r\n\r\n                        Type providerType = Type.GetType(typeReference);\r\n                        if (providerType == null)\r\n                        {\r\n                            Log.LogCritical(\"Configuration\", \"Could not resolve type '{0}' \", typeReference);\r\n\r\n                            throw GetExceptionOnTypeNotFound(typeReference);\r\n                        }\r\n\r\n                        Attribute attribute = Attribute.GetCustomAttribute(providerType, typeof(ConfigurationElementTypeAttribute));\r\n                        if (attribute == null)\r\n                        {\r\n                            Type dataElementType = typeof(T);\r\n                            attribute = Attribute.GetCustomAttribute(dataElementType, typeof(ConfigurationElementTypeAttribute));\r\n                        }\r\n\r\n\r\n                        if (attribute == null)\r\n                        {\r\n                            throw new ConfigurationErrorsException(string.Format(\"The type {0} does not contain the ConfigurationElementTypeAttribute.\", providerType.Name));\r\n                        }\r\n\r\n                        configurationElementType = ((ConfigurationElementTypeAttribute)attribute).ConfigurationType;\r\n\r\n                        break;\r\n                    }\r\n                }\r\n\r\n                if (configurationElementType == null)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"The type attribute does not exist on the element {0}.\", reader.Name));\r\n                }\r\n\r\n                // cover the traces ;)\r\n                reader.MoveToElement();\r\n            }\r\n            return configurationElementType;\r\n        }\r\n\r\n        static Exception GetExceptionOnTypeNotFound(string typeReference)\r\n        {\r\n            string trimmedTypeReference = typeReference.Trim();\r\n\r\n            if(trimmedTypeReference.Length > 0)\r\n            {\r\n                int commaOffset = typeReference.IndexOf(',');\r\n\r\n                if(commaOffset < 0)\r\n                {\r\n                    return new ConfigurationErrorsException(\"Type '{0}' could not be resolved. Assembly name is not specified, \" +\r\n                        \"if type is defined in '/App_Code' folder, specify type reference as '{0},App_Code'\".FormatWith(typeReference));\r\n                }\r\n\r\n                string assemblyInfo = trimmedTypeReference.Substring(commaOffset + 1);\r\n                if(assemblyInfo.ToLowerInvariant().Contains(\"app_code\"))\r\n                {\r\n                    return new AppCodeTypeNotFoundConfigurationException(\"Type '{0}' could not be resolved\".FormatWith(typeReference));\r\n                }\r\n            }\r\n\r\n            return new ConfigurationErrorsException(\"Type '{0}' could not be resolved\".FormatWith(typeReference));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Plugins/GlobalSettingsProvider/GlobalSettingsProviderData.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Configuration.Plugins.GlobalSettingsProvider\r\n{\r\n    internal class GlobalSettingsProviderData : NameTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Plugins/GlobalSettingsProvider/IGlobalSettingsProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Configuration.Plugins.GlobalSettingsProvider.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Configuration.Plugins.GlobalSettingsProvider\r\n{\r\n    [CustomFactory(typeof(GlobalSettingsProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(GlobalSettingsProviderDefaultNameRetriever))]\r\n    internal interface IGlobalSettingsProvider\r\n    {        \r\n        string ApplicationName { get; }\r\n\r\n        string ApplicationShortName { get; }\r\n\r\n        string BrandedVersionAssemblySource { get; }\r\n\r\n        string DefaultCultureName { get; }\r\n\r\n        string ConfigurationDirectory { get; }\r\n\r\n        string GeneratedAssembliesDirectory { get; }\r\n\r\n        string SerializedWorkflowsDirectory { get; }\r\n\r\n        string SerializedConsoleMessagesDirectory { get; }\r\n\r\n        string AppCodeDirectory { get; }\r\n\r\n        string BinDirectory { get; }\r\n\r\n        string TempDirectory { get; }\r\n\r\n        string CacheDirectory { get; }\r\n\r\n        string PackageDirectory { get; }\r\n\r\n        string AutoPackageInstallDirectory { get; }\r\n\r\n        string TreeDefinitionsDirectory { get; }\r\n\r\n        string PageTemplateFeaturesDirectory { get; }\r\n\r\n        string DataMetaDataDirectory { get; }\r\n\r\n        string InlineCSharpFunctionDirectory { get; }\r\n\r\n        string PackageLicenseDirectory { get; }\r\n\r\n        /// <summary>\r\n        /// List of assembly names to exclude from type probing. Use \"*\" as wildcard, like. \"System.*\"\r\n        /// </summary>\r\n        IEnumerable<string> NonProbableAssemblyNames { get; }\r\n\r\n        int ConsoleMessageQueueItemSecondToLive { get; }\r\n\r\n        bool EnableDataTypesAutoUpdate { get; }\r\n\r\n        bool BroadcastConsoleElementChanges { get; }\r\n\r\n        /// <summary>\r\n        /// If specified, the system will accept this user with any password on a clean system, that has a writeable login provider\r\n        /// The user will then be created.\r\n        /// </summary>\r\n        string AutoCreatedAdministratorUserName { get; }\r\n\r\n        string WorkflowTimeout { get; }\r\n\r\n        string ConsoleTimeout { get; }\r\n\r\n        /// <summary>\r\n        /// When <value>true</value> only pages that are published or awaiting publication can be translated in console.\r\n        /// </summary>\r\n        bool OnlyTranslateWhenApproved { get;  }\r\n\r\n        /// <summary>\r\n        /// Allow child pages to be translated without translated parent page\r\n        /// </summary>\r\n        bool AllowChildPagesTranslationWithoutParent { get; }\r\n\r\n        ICachingSettings Caching { get; }\r\n\r\n        int ImageQuality { get; }\r\n\r\n        bool PrettifyPublicMarkup { get; }\r\n\r\n        bool PrettifyRenderFunctionExceptions { get; }\r\n\r\n        bool FunctionPreviewEnabled { get; }\r\n\r\n        TimeZoneInfo TimeZone { get; }\r\n\r\n        bool InheritGlobalReadPermissionOnHiddenPerspectives { get; }\r\n\r\n        bool OmitAspNetWebFormsSupport { get; }\r\n\r\n        bool ProtectResizedImagesWithHash { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Plugins/GlobalSettingsProvider/NonConfigurableGlobalSettingsProvider.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Configuration.Plugins.GlobalSettingsProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableGlobalSettingsProviderAssembler))]\r\n    internal sealed class NonConfigurableGlobalSettingsProvider : GlobalSettingsProviderData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableGlobalSettingsProviderAssembler : IAssembler<IGlobalSettingsProvider, GlobalSettingsProviderData>\r\n    {\r\n        public IGlobalSettingsProvider Assemble(IBuilderContext context, GlobalSettingsProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IGlobalSettingsProvider)Activator.CreateInstance(objectConfiguration.Type);            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Plugins/GlobalSettingsProvider/Runtime/GlobalSettingsProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Configuration.Plugins.GlobalSettingsProvider.Runtime\r\n{\r\n    internal sealed class GlobalSettingsProviderCustomFactory : AssemblerBasedCustomFactory<IGlobalSettingsProvider, GlobalSettingsProviderData>\r\n    {\r\n        protected override GlobalSettingsProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            GlobalSettingsProviderSettings settings = configurationSource.GetSection(GlobalSettingsProviderSettings.SectionName) as GlobalSettingsProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", GlobalSettingsProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.GlobalSettingsProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Plugins/GlobalSettingsProvider/Runtime/GlobalSettingsProviderDefaultNameRetriever.cs",
    "content": "using System;\r\nusing System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Configuration.Plugins.GlobalSettingsProvider.Runtime\r\n{\r\n    internal sealed class GlobalSettingsProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            if (null == configSource) throw new ArgumentNullException(\"configSource\");\r\n\r\n            if (null != name)\r\n            {\r\n                return name;\r\n            }\r\n            else\r\n            {\r\n                GlobalSettingsProviderSettings settings = configSource.GetSection(GlobalSettingsProviderSettings.SectionName) as GlobalSettingsProviderSettings;\r\n\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Could not load configuration section {0}\", GlobalSettingsProviderSettings.SectionName));\r\n                }\r\n\r\n                return settings.DefaultGlobalSettingsProvider;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Plugins/GlobalSettingsProvider/Runtime/GlobalSettingsProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Configuration.Plugins.GlobalSettingsProvider.Runtime\r\n{\r\n    internal sealed class GlobalSettingsProviderFactory : NameTypeFactoryBase<IGlobalSettingsProvider>\r\n    {\r\n        public GlobalSettingsProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/Plugins/GlobalSettingsProvider/Runtime/GlobalSettingsProviderSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Configuration.Plugins.GlobalSettingsProvider.Runtime\r\n{\r\n    internal sealed class GlobalSettingsProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Core.Configuration.Plugins.GlobalSettingsProviderConfiguration\";\r\n\r\n        private const string _defaultGlobalSettingsProviderProperty = \"defaultGlobalSettingsProvider\";\r\n        [ConfigurationProperty(_defaultGlobalSettingsProviderProperty, IsRequired = true)]\r\n        public string DefaultGlobalSettingsProvider\r\n        {\r\n            get { return (string)base[_defaultGlobalSettingsProviderProperty]; }\r\n            set { base[_defaultGlobalSettingsProviderProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _globalSettingsProviderPluginsProperty = \"GlobalSettingsProviderPlugins\";\r\n        [ConfigurationProperty(_globalSettingsProviderPluginsProperty, IsRequired = true)]\r\n        public NameTypeConfigurationElementCollection<GlobalSettingsProviderData, GlobalSettingsProviderData> GlobalSettingsProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeConfigurationElementCollection<GlobalSettingsProviderData, GlobalSettingsProviderData>)base[_globalSettingsProviderPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/SimpleNameTypeConfigurationElement.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.ComponentModel;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class SimpleNameTypeConfigurationElement : ConfigurationElement\r\n    {\r\n        private const string _namePropertyName = \"name\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_namePropertyName, IsRequired=true)]\r\n        public string Name\r\n        {\r\n            get { return (string)base[_namePropertyName]; }\r\n            set { base[_namePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _typePropertyName = \"type\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_typePropertyName, IsRequired=true)]\r\n        [TypeConverter(typeof(AssemblyQualifiedTypeNameConverter))]\t\t\r\n        public Type Type\r\n        {\r\n            get { return (Type)base[_typePropertyName]; }\r\n            set { base[_typePropertyName] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/SimpleNameTypeConfigurationElementCollection.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class SimpleNameTypeConfigurationElementCollection : ConfigurationElementCollection, IEnumerable<SimpleNameTypeConfigurationElement>\r\n    {\r\n        /// <exclude />\r\n        public void Add(string name, Type type)\r\n        {\r\n            var element = new SimpleNameTypeConfigurationElement();\r\n            element.Name = name;\r\n            element.Type = type;\r\n\r\n            BaseAdd(element);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {            \r\n            return new SimpleNameTypeConfigurationElement();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            return (element as SimpleNameTypeConfigurationElement).Name;\r\n        }\r\n\r\n        IEnumerator<SimpleNameTypeConfigurationElement> IEnumerable<SimpleNameTypeConfigurationElement>.GetEnumerator()\r\n        {\r\n            return this.OfType<SimpleNameTypeConfigurationElement>().GetEnumerator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/SystemSetupFacade.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n    /// <summary>\r\n    /// This class may not depended on the system being initialized. \r\n    /// Any call to the class will never result in the system being initialized\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class SystemSetupFacade\r\n    {\r\n        private static readonly object _lock = new object();\r\n        private static bool? _isSystemFirstTimeInitialized;\r\n\r\n        /// <exclude />\r\n        static SystemSetupFacade()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsSystemFirstTimeInitialized\r\n        {\r\n            get\r\n            {\r\n                if (_isSystemFirstTimeInitialized == null)\r\n                {\r\n                    try\r\n                    {\r\n                        _isSystemFirstTimeInitialized = C1File.Exists(SystemInitializedFilePath);\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        _isSystemFirstTimeInitialized = false;\r\n                    }\r\n                }\r\n\r\n                return _isSystemFirstTimeInitialized.Value;\r\n            }\r\n            set\r\n            {\r\n                Verify.IsTrue(value, \"Only 'true' value is expected\");\r\n\r\n                lock (_lock)\r\n                {\r\n                    if (!C1File.Exists(SystemInitializedFilePath))\r\n                    {\r\n                        string directory = Path.GetDirectoryName(SystemInitializedFilePath);\r\n                        C1Directory.CreateDirectory(directory);\r\n\r\n                        var doc = new XDocument(\r\n                            new XElement(\"Root\", new XAttribute(\"Status\", true))\r\n                        );\r\n\r\n                        doc.SaveToFile(SystemInitializedFilePath);\r\n                    }\r\n\r\n                    _isSystemFirstTimeInitialized = true;\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool SetupIsRunning { get; set; }\r\n\r\n        private static string SystemInitializedFilePath\r\n        {\r\n            get\r\n            {\r\n                return PathUtil.Resolve(\"~/App_Data/Composite/Configuration/SystemInitialized.xml\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method is used to record the very first time the system is started.\r\n        /// Ths time can later be used to several things like finding files that have been written to etc.\r\n        /// </summary>\r\n        public static void SetFirstTimeStart()\r\n        {\r\n            if (!C1File.Exists(FirstTimeStartFilePath))\r\n            {\r\n                string directory = Path.GetDirectoryName(FirstTimeStartFilePath);\r\n                if (!C1Directory.Exists(directory))\r\n                {\r\n                    C1Directory.CreateDirectory(directory);\r\n                }\r\n\r\n                var doc = new XDocument(new XElement(\"Root\", new XAttribute(\"time\", DateTime.Now)));\r\n\r\n                doc.SaveToFile(FirstTimeStartFilePath);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the time the system was startet the very first time\r\n        /// </summary>\r\n        /// <returns>The very first time the system has been started</returns>        \r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is intended\")]\r\n        public static DateTime GetFirstTimeStart()\r\n        {\r\n            Verify.That(File.Exists(FirstTimeStartFilePath), \"File '{0}' is missing\", FirstTimeStartFilePath);\r\n\r\n            var doc = XDocumentUtils.Load(FirstTimeStartFilePath);\r\n\r\n            return (DateTime)doc.Element(\"Root\").Attribute(\"time\");\r\n        }\r\n\r\n\r\n\r\n        private static string FirstTimeStartFilePath\r\n        {\r\n            get\r\n            {\r\n                return PathUtil.Resolve(\"~/App_Data/Composite/Configuration/FirstTimeStart.xml\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Configuration/TypeManagerTypeNameConverter.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Properties;\r\n\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Core.Configuration\r\n{\r\n\t/// <summary>\r\n\t/// Represents a configuration converter that converts a string to <see cref=\"Type\"/> using the Composite Type Manager.\r\n\t/// </summary>\r\n\tinternal class TypeManagerTypeNameConverter : ConfigurationConverterBase\r\n\t{\r\n\t\t/// <summary>\r\n\t\t/// Returns the name for the passed in Type.\r\n\t\t/// </summary>\r\n\t\t/// <param name=\"context\">The container representing this System.ComponentModel.TypeDescriptor.</param>\r\n\t\t/// <param name=\"culture\">Culture info for assembly</param>\r\n\t\t/// <param name=\"value\">Value to convert.</param>\r\n\t\t/// <param name=\"destinationType\">Type to convert to.</param>\r\n\t\t/// <returns>Assembly Qualified Name as a string</returns>\r\n\t\tpublic override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)\r\n\t\t{\r\n\t\t\tType typeValue = value as Type;\r\n\t\t\tif (typeValue == null)\r\n\t\t\t{\r\n\t\t\t\tthrow new ArgumentException(\"Can not convert type\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (typeValue != null) return (typeValue).AssemblyQualifiedName;\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\t/// <summary>\r\n\t\t/// Returns a type based on the name passed in as data.\r\n\t\t/// </summary>\r\n\t\t/// <param name=\"context\">The container representing this System.ComponentModel.TypeDescriptor.</param>\r\n\t\t/// <param name=\"culture\">Culture info for assembly.</param>\r\n\t\t/// <param name=\"value\">Data to convert.</param>\r\n\t\t/// <returns>Type of the data</returns>\r\n\t\tpublic override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)\r\n\t\t{\r\n\t\t\tstring stringValue = (string)value;\r\n\t\t\tType result = TypeManager.GetType(stringValue);\r\n\t\t\tif (result == null)\r\n\t\t\t{\r\n\t\t\t\tthrow new ArgumentException(string.Format(\"Type \\\"{0}\\\" not found.\", stringValue));\r\n\t\t\t}\r\n\r\n\t\t\treturn result;\r\n\t\t}\t\t\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/EmptyDisposable.cs",
    "content": "using System;\r\n\r\nnamespace Composite.Core\r\n{\r\n    internal class EmptyDisposable : IDisposable\r\n    {\r\n        public static readonly EmptyDisposable Instance = new EmptyDisposable();\r\n\r\n        public void Dispose()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/ByteArrayExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n\tinternal static class ByteArrayExtensionMethods\r\n\t{\r\n        public static IEnumerable<byte[]> Split(this byte[] bytes, byte splitByte)\r\n        {\r\n            int lastIndex = 0;\r\n\r\n            int index = IndexOf(bytes, splitByte, lastIndex);\r\n            while (index != -1)\r\n            {\r\n                int size = index - lastIndex;\r\n                byte[] subBytes = new byte[size];\r\n\r\n                Array.Copy(bytes, lastIndex, subBytes, 0, size);\r\n\r\n                lastIndex = index + 1;\r\n                index = IndexOf(bytes, splitByte, lastIndex);\r\n\r\n                yield return subBytes;\r\n            }\r\n\r\n            if (lastIndex < bytes.Length)\r\n            {\r\n                int size = bytes.Length - lastIndex;\r\n                byte[] subBytes = new byte[size];\r\n\r\n                Array.Copy(bytes, lastIndex, subBytes, 0, size);\r\n\r\n                yield return subBytes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static int IndexOf(this byte[] bytes, byte byteToFind)\r\n        {\r\n            return IndexOf(bytes, byteToFind, 0);\r\n        }\r\n\r\n\r\n\r\n        public static int IndexOf(this byte[] bytes, byte byteToFind, int startIndex)\r\n        {\r\n            if (bytes == null) throw new ArgumentNullException(\"bytes\");\r\n            if (startIndex > bytes.Length) throw new ArgumentNullException(\"startIndex exceeds the length of the bytes\");\r\n\r\n            for (int i = startIndex; i < bytes.Length; i++)\r\n            {\r\n                if (bytes[i] == byteToFind) return i;\r\n            }\r\n\r\n            return -1;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/DateTimeExtensionMethods.cs",
    "content": "﻿using System;\nusing Composite.Core.Configuration;\nusing Composite.Core.ResourceSystem;\n\n\nnamespace Composite.Core.Extensions\n{\n    /// <summary>\n    /// </summary>\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n    public static class DateTimeExtensionMethods\n    {\n\n        /// <exclude />\n        private static string TimeZoneAbbreviatedName()\n        {\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.TimezoneAbbreviations\",\n                \"TimezoneAbbreviations.\" + GlobalSettingsFacade.TimeZone.Id);\n        }\n\n\n        /// <exclude />\n        public static string ToTimeZoneDateTimeString(this DateTime? dateTime)\n        {\n            return dateTime?.ToTimeZoneDateTimeString();\n        }\n\n        /// <exclude />\n        public static string ToTimeZoneDateTimeString(this DateTime dateTime)\n        {\n\n            var convertedToShow = dateTime.ToTimeZone();\n\n            return\n                $\"{convertedToShow.ToShortDateString()} {convertedToShow.ToShortTimeString()} {TimeZoneAbbreviatedName()}\";\n        }\n\n        /// <exclude />\n        public static string ToTimeZoneDateString(this DateTime? dateTime)\n        {\n            return dateTime?.ToTimeZoneDateString();\n        }\n\n        /// <exclude />\n        public static string ToTimeZoneDateString(this DateTime dateTime)\n        {\n            var convertedToShow = dateTime.ToTimeZone();\n\n            return convertedToShow.ToShortDateString();\n        }\n\n        /// <exclude />\n        public static DateTime FromTimeZoneToUtc(this DateTime dateTime)\n        {\n            return TimeZoneInfo.ConvertTime(dateTime, GlobalSettingsFacade.TimeZone, TimeZoneInfo.Utc);\n        }\n\n        /// <exclude />\n        public static DateTime ToTimeZone(this DateTime dateTime)\n        {\n            return TimeZoneInfo.ConvertTime(dateTime, GlobalSettingsFacade.TimeZone);\n        }\n\n        /// <exclude />\n        public static bool TryParseInTimeZone(string s, out DateTime result)\n        {\n            return DateTime.TryParse(s.Replace(TimeZoneAbbreviatedName(), \"\"), out result);\n        }\n\n    }\n}\n"
  },
  {
    "path": "Composite/Core/Extensions/DictionaryExtensionMethods.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    internal static class DictionaryExtensionMethods\r\n    {\r\n        public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TValue> createValue)\r\n        {\r\n            if (dictionary is ConcurrentDictionary<TKey, TValue> concurrentDictionary)\r\n            {\r\n                return concurrentDictionary.GetOrAdd(key, k => createValue());\r\n            }\r\n\r\n            TValue value;\r\n            if (dictionary.TryGetValue(key, out value))\r\n            {\r\n                return value;\r\n            }\r\n\r\n            lock (dictionary)\r\n            {\r\n                if (dictionary.TryGetValue(key, out value))\r\n                {\r\n                    return value;\r\n                }\r\n\r\n                value = createValue();\r\n                dictionary.Add(key, value);\r\n            }\r\n\r\n            return value;\r\n        }\r\n\r\n        public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TKey, TValue> createValue)\r\n        {\r\n            if (dictionary is ConcurrentDictionary<TKey, TValue> concurrentDictionary)\r\n            {\r\n                return concurrentDictionary.GetOrAdd(key, createValue);\r\n            }\r\n\r\n            TValue value;\r\n            if (dictionary.TryGetValue(key, out value))\r\n            {\r\n                return value;\r\n            }\r\n\r\n            lock (dictionary)\r\n            {\r\n                if (dictionary.TryGetValue(key, out value))\r\n                {\r\n                    return value;\r\n                }\r\n\r\n                value = createValue(key);\r\n                dictionary.Add(key, value);\r\n            }\r\n\r\n            return value;\r\n        }\r\n\r\n        public static List<KeyValuePair<string, TValue>> SortByKeys<TValue>(this Dictionary<string, TValue> dictionary)\r\n        {\r\n            var result = dictionary.ToList();\r\n\r\n            result.Sort((a, b) => string.CompareOrdinal(a.Key, b.Key));\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/ExpressionExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    internal static class ExpressionExtensionMethods\r\n    {\r\n        public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> expression1,\r\n                                                            Expression<Func<T, bool>> expression2)\r\n        {\r\n            var invokedExpression = Expression.Invoke(expression2, expression1.Parameters.Cast<Expression>());\r\n            return Expression.Lambda<Func<T, bool>>\r\n                  (Expression.Or(expression1.Body, invokedExpression), expression1.Parameters);\r\n        }\r\n\r\n\r\n\r\n        public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> expression1,\r\n                                                            Expression<Func<T, bool>> expression2)\r\n        {\r\n            var invokedExpression = Expression.Invoke(expression2, expression1.Parameters.Cast<Expression>());\r\n            return Expression.Lambda<Func<T, bool>>\r\n                  (Expression.And(expression1.Body, invokedExpression), expression1.Parameters);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/HttpContextExtensionMethods.cs",
    "content": "﻿using System.Reflection;\r\nusing System.Web;\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    /// <exclude />\r\n    public static class HttpContextExtensionMethods\r\n    {\r\n        private static readonly FieldInfo HideRequestResponseFieldInfo = typeof(HttpContext).GetField(\"HideRequestResponse\", BindingFlags.Instance | BindingFlags.NonPublic);\r\n\r\n        /// <exclude />\r\n        public static bool RequestIsAvaliable(this HttpContext httpContext)\r\n        {\r\n            return !(bool) HideRequestResponseFieldInfo.GetValue(httpContext);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/IApplicationHostExtensionMethods.cs",
    "content": "using System;\r\nusing System.Reflection;\r\nusing System.Web.Hosting;\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IApplicationHostExtensionMethods\r\n    {\r\n        static readonly PropertyInfo _shutdownInitiatedPropertyInfo = typeof(HostingEnvironment).GetProperty(\"ShutdownInitiated\", BindingFlags.NonPublic | BindingFlags.Static);\r\n\r\n        private static bool _processExit;\r\n\r\n        static IApplicationHostExtensionMethods()\r\n        {\r\n            AppDomain.CurrentDomain.ProcessExit += (s, a) => _processExit = true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool ShutdownInitiated(this IApplicationHost host)\r\n        {\r\n            if (!HostingEnvironment.IsHosted)\r\n            {\r\n                return _processExit;\r\n            }\r\n\r\n            return (bool)_shutdownInitiatedPropertyInfo.GetValue(null, null);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/IEnumerableExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n\tinternal static class IEnumerableExtensionMethods\r\n\t{\r\n        public static List<TTarget> ToList<TSource, TTarget>(this IEnumerable<TSource> source, Func<TSource, TTarget> objectCreator)\r\n        {\r\n            if (source == null) throw new ArgumentNullException(\"source\");\r\n\r\n            List<TTarget> targetList = new List<TTarget>();\r\n            foreach (TSource sourceElement in source)\r\n            {\r\n                TTarget target = objectCreator(sourceElement);\r\n                targetList.Add(target);\r\n            }\r\n\r\n            return targetList;\r\n        }\r\n\r\n        public static void ForEach<TSource>(this IEnumerable<TSource> source, Action<TSource> action)\r\n        {\r\n            foreach (TSource element in source)\r\n            {\r\n                action(element);\r\n            }\r\n        }\r\n\r\n\t    public static IEnumerable<T> ConcatOrDefault<T>(this IEnumerable<T> enumerable, IEnumerable<T> enumerableToAppend)\r\n\t    {\r\n\t        if (enumerable == null) return enumerableToAppend;\r\n\t        if (enumerableToAppend == null) return enumerable;\r\n\r\n\t        return enumerable.Concat(enumerableToAppend);\r\n\t    }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/IQueryableExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Foundation;\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class IQueryableExtensionMethods\r\n\t{\r\n\t    private static readonly MethodInfo _miQueryableAny =\r\n\t        (from methodInfo in typeof (Queryable).GetMethods(BindingFlags.Static | BindingFlags.Public)\r\n\t         where methodInfo.Name == \"Any\" && methodInfo.GetParameters().Length == 1\r\n\t         select methodInfo).First();\r\n\r\n\r\n        /// <exclude />\r\n        public static IQueryable<T> Random<T>(this IQueryable<T> source) where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(source, \"source\");\r\n\r\n            return source.OrderBy(element => Guid.NewGuid());\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IQueryable<T> TakeRandom<T>(this IQueryable<T> source, int elementsToTake) where T : class, IData\r\n        {\r\n            return source.Random().Take(elementsToTake);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsEnumerableQuery<T>(this IQueryable<T> query)\r\n        {\r\n            if(query == null) return false;\r\n\r\n            if(query is DataFacadeQueryable<T>)\r\n            {\r\n                return (query as DataFacadeQueryable<T>).IsEnumerableQuery;\r\n            }\r\n\r\n            return query is CachingQueryable<T> || query is EnumerableQuery<T>;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool Any(this IQueryable queryable)\r\n        {\r\n            var type = queryable.GetType();\r\n            if(type.IsGenericType)\r\n            {\r\n                var genericArguments = type.GetGenericArguments();\r\n\r\n                if(genericArguments.Length == 1)\r\n                {\r\n                    var queryType = typeof (IQueryable<>).MakeGenericType(genericArguments);\r\n                    if(queryType.IsAssignableFrom(type))\r\n                    {\r\n                        MethodInfo genericAnyMethod = _miQueryableAny.MakeGenericMethod(genericArguments);\r\n                        return (bool)genericAnyMethod.Invoke(null, new object[] { queryable });\r\n                    }\r\n                }\r\n            }\r\n            \r\n            foreach(object element in queryable)\r\n            {\r\n                return true;\r\n            }\r\n            return false;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable OrderBy(this IQueryable source, Type dataType, string property)\r\n        {\r\n            return ApplyOrder(source, dataType, property, \"OrderBy\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable OrderBy(this IQueryable source, Type dataType, string property, bool descending)\r\n        {\r\n            string methodName = descending ? \"OrderByDescending\" : \"OrderBy\";\r\n\r\n            return ApplyOrder(source, dataType, property, methodName);\r\n            \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable OrderByDescending(this IQueryable source, Type dataType, string property)\r\n        {\r\n            return ApplyOrder(source, dataType, property, \"OrderByDescending\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable ThenBy(this IOrderedQueryable source, Type dataType, string property)\r\n        {\r\n            return ApplyOrder(source, dataType, property, \"ThenBy\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable ThenBy(this IOrderedQueryable source, Type dataType, string property, bool descending)\r\n        {\r\n            string methodName = descending ? \"ThenByDescending\" : \"ThenBy\";\r\n\r\n            return ApplyOrder(source, dataType, property, methodName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable ThenByDescending(this IOrderedQueryable source, Type dataType, string property)\r\n        {\r\n            return ApplyOrder(source, dataType, property, \"ThenByDescending\");\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property)\r\n        {\r\n            return ApplyOrder<T>(source, property, \"OrderBy\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable<T> OrderByDescending<T>(this IQueryable<T> source, string property)\r\n        {\r\n            return ApplyOrder<T>(source, property, \"OrderByDescending\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable<T> ThenBy<T>(this IOrderedQueryable<T> source, string property)\r\n        {\r\n            return ApplyOrder<T>(source, property, \"ThenBy\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IOrderedQueryable<T> ThenByDescending<T>(this IOrderedQueryable<T> source, string property)\r\n        {\r\n            return ApplyOrder<T>(source, property, \"ThenByDescending\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        private static IOrderedQueryable<T> ApplyOrder<T>(IQueryable<T> source, string property, string methodName)\r\n        {\r\n            return (IOrderedQueryable<T>)ApplyOrder(source, typeof(T), property, methodName);\r\n        }\r\n\r\n\r\n        private static IOrderedQueryable ApplyOrder(IQueryable source, Type type, string property, string methodName)\r\n        {\r\n            Verify.IsNotNull(property, \"property cannot be null\");\r\n            Verify.IsNotNull(type, \"type cannot be null\");\r\n\r\n            string[] props = property.Split('.');\r\n            Type parameterType = type;\r\n            ParameterExpression arg = Expression.Parameter(parameterType, \"x\");\r\n            Expression expr = arg;\r\n            foreach (string prop in props)\r\n            {\r\n                // use reflection (not ComponentModel) to mirror LINQ\r\n                PropertyInfo pi = parameterType.GetPropertiesRecursively(f=>f.Name == prop).FirstOrDefault();\r\n                Verify.IsNotNull(pi, \"Could not find property '{0}' on type '{1}'\", property, type);\r\n                expr = Expression.Property(expr, pi);\r\n                parameterType = pi.PropertyType;\r\n            }\r\n            Type delegateType = typeof(Func<,>).MakeGenericType(type, parameterType);\r\n            LambdaExpression lambda = Expression.Lambda(delegateType, expr, arg);\r\n\r\n            object result = typeof(Queryable).GetMethods().Single(\r\n                    method => method.Name == methodName\r\n                            && method.IsGenericMethodDefinition\r\n                            && method.GetGenericArguments().Length == 2\r\n                            && method.GetParameters().Length == 2)\r\n                    .MakeGenericMethod(type, parameterType)\r\n                    .Invoke(null, new object[] { source, lambda });\r\n            return (IOrderedQueryable)result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/MethodInfoExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Reflection;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    internal static class MethodInfoExtensionMethods\r\n    {\r\n        public static string ToExceptionString(this MethodInfo methodInfo)\r\n        {\r\n            if (methodInfo == null) throw new ArgumentNullException(\"methodInfo\");\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n            sb.Append(methodInfo.DeclaringType.FullName);\r\n            sb.Append(\".\");\r\n            sb.Append(methodInfo.Name);\r\n\r\n            Type[] genericArguments = methodInfo.GetGenericArguments();\r\n            if (genericArguments.Length > 0)\r\n            {\r\n                sb.Append(\"[\");\r\n                bool firstGenericParameter = true;\r\n                foreach (Type type in genericArguments)\r\n                {\r\n                    if (firstGenericParameter == false)\r\n                    {\r\n                        sb.Append(\", \");\r\n                    }\r\n                    else\r\n                    {\r\n                        firstGenericParameter = false;\r\n                    }\r\n\r\n                    sb.Append(type.Name);\r\n                }\r\n                sb.Append(\"]\");\r\n            }\r\n\r\n            sb.Append(\"(\");\r\n\r\n            bool firstParameter = true;\r\n            foreach (ParameterInfo parameterInfo in methodInfo.GetParameters())\r\n            {\r\n                if (firstParameter == false)\r\n                {\r\n                    sb.Append(\", \");\r\n                }\r\n                else\r\n                {\r\n                    firstParameter = false;\r\n                }\r\n\r\n                sb.Append(parameterInfo.ParameterType.Name);\r\n                sb.Append(\" \");\r\n                sb.Append(parameterInfo.Name);\r\n            }\r\n\r\n            sb.Append(\")\");\r\n\r\n            return sb.ToString();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/PageUrlDataExtensionMethods.cs",
    "content": "using Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PageUrlDataExtensionMethods\r\n    {\r\n        /// <exclude />\r\n        public static IPage GetPage(this PageUrlData pageUrlData)\r\n        {\r\n            Verify.ArgumentNotNull(pageUrlData, nameof(pageUrlData));\r\n\r\n            using (new DataScope(pageUrlData.PublicationScope, pageUrlData.LocalizationScope))\r\n            {\r\n                if (pageUrlData.VersionId != null)\r\n                {\r\n                    return PageManager.GetPageById(pageUrlData.PageId, pageUrlData.VersionId.Value);\r\n                }\r\n\r\n                return PageManager.GetPageById(pageUrlData.PageId);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/StackTraceExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n\tinternal static class StackTraceExtensionMethods\r\n\t{\r\n        public static IEnumerable<StackFrame> AsEnumerable(this StackTrace stackTrace)\r\n        {\r\n            if (stackTrace == null) throw new ArgumentNullException(\"stackTrace\");\r\n\r\n            for (int i = 0; i < stackTrace.FrameCount; i++)\r\n            {\r\n                yield return stackTrace.GetFrame(i);\r\n            }\r\n        }\r\n\r\n\r\n        public static IQueryable<StackFrame> AsQueryable(this StackTrace stackTrace)\r\n        {\r\n            if (stackTrace == null) throw new ArgumentNullException(\"stackTrace\");\r\n\r\n            return stackTrace.AsEnumerable().AsQueryable();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/StreamExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\n\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    internal static class StreamExtensionMethods\r\n    {\r\n        public static void CopyTo(this Stream stream, Stream toStream)\r\n        {\r\n            int offset = 0;\r\n            int remaining = (int)stream.Length;\r\n            const int chunkSize = 8192;\r\n            \r\n            byte[] data = new byte[chunkSize];\r\n            while (remaining > 0)\r\n            {\r\n                int toRead = Math.Min(chunkSize, remaining);\r\n                int read = stream.Read(data, 0, toRead);\r\n                \r\n                if (read <= 0) throw new EndOfStreamException(String.Format(\"End of stream reached with {0} bytes left to read\", remaining));\r\n                \r\n                toStream.Write(data, 0, read);\r\n                \r\n                remaining -= read;\r\n                \r\n                offset += read;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Extensions/StringExtensionMethods.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Text;\r\nusing JetBrains.Annotations;\r\n\r\n\r\nnamespace Composite.Core.Extensions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class StringExtensionMethods\r\n    {\r\n        /// <exclude />\r\n        [StringFormatMethod(\"format\")]\r\n        public static string FormatWith(this string format, params object[] args)\r\n        {\r\n            Verify.ArgumentNotNull(format, \"format\");\r\n\r\n            return string.Format(CultureInfo.InvariantCulture, format, args);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsNullOrEmpty(this string str)\r\n        {\r\n            return string.IsNullOrEmpty(str);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool StartsWith(this string str, string value, bool ignoreCase)\r\n        {\r\n            return str.StartsWith(value, ignoreCase, CultureInfo.InvariantCulture);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool EndsWith(this string str, string value, bool ignoreCase)\r\n        {\r\n            return str.EndsWith(value, ignoreCase, CultureInfo.InvariantCulture);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsCorrectNamespace(this string s, char separator)\r\n        {\r\n            if (s == null) return false;\r\n            if (s == \"\") return true;\r\n\r\n            string[] splits = s.Split(separator);\r\n\r\n            foreach (string split in splits)\r\n            {\r\n                if (split == \"\") return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string CreateNamespace(string namespaceName, string name, char separator)\r\n        {\r\n            if (string.IsNullOrEmpty(namespaceName))\r\n            {\r\n                return name;\r\n            }\r\n            return string.Format(\"{0}{1}{2}\", namespaceName, separator, name);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Default separator is '.'\r\n        /// </summary>\r\n        /// <param name=\"namespaceName\"></param>\r\n        /// <param name=\"name\"></param>\r\n        /// <returns></returns>\r\n        public static string CreateNamespace(string namespaceName, string name)\r\n        {\r\n            return CreateNamespace(namespaceName, name, '.');\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetNameFromNamespace(this string s)\r\n        {\r\n            int index = s.LastIndexOf(\".\", StringComparison.Ordinal);\r\n            if (index < 0)\r\n            {\r\n                return s;\r\n            }\r\n            return s.Substring(index + 1);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetNamespace(this string s)\r\n        {\r\n            int index = s.LastIndexOf(\".\", StringComparison.Ordinal);\r\n            if (index <= 0)\r\n            {\r\n                return string.Empty;\r\n            }\r\n\r\n            string result = s.Substring(0, index);\r\n            if (result.EndsWith(\".\"))\r\n            {\r\n                result = result.Substring(0, result.Length);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsCorrectFolderName(this string s, char separator)\r\n        {\r\n            if (s == null) return false;\r\n            if (s == \"/\") return true;\r\n            if (!s.StartsWith(\"/\")) return false;\r\n            if (s.Length > 1 && s.EndsWith(\"/\")) return false;\r\n\r\n            string[] splits = s.Split(separator);\r\n\r\n            for (int i = 1; i < splits.Length; i++)\r\n            {\r\n                if (splits[i] == \"\") return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsDirectChildOf(this string s, string possibleParentPath, char separator)\r\n        {\r\n            if (possibleParentPath.Length > s.Length)\r\n            {\r\n                return false;\r\n            }\r\n            if (s == possibleParentPath)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (!s.StartsWith(possibleParentPath))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (possibleParentPath == separator.ToString())\r\n            {\r\n                string remaining = s.Remove(0, possibleParentPath.Length);\r\n                if (!remaining.Contains(separator.ToString()))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            if (s[possibleParentPath.Length] == '/')\r\n            {\r\n                string remaining = s.Remove(0, possibleParentPath.Length + 1);\r\n                if (!remaining.Contains(separator.ToString()))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsParentOf(this string s, string possibleChild, char separator)\r\n        {\r\n            return possibleChild.IsDirectChildOf(s, separator);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetFolderName(this string s, char separator)\r\n        {\r\n            if (s.Length == 1 && s[0] == separator)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (!s.Contains(separator.ToString()))\r\n            {\r\n                return \"/\";\r\n            }\r\n\r\n            string[] foldernames = s.Split(separator);\r\n\r\n            if (foldernames[foldernames.Length - 1] == \"\")\r\n            {\r\n                if (foldernames.Length >= 2)\r\n                {\r\n                    return foldernames[foldernames.Length - 2];\r\n                }\r\n                \r\n                throw new System.NotImplementedException();\r\n            }\r\n            \r\n            return foldernames[foldernames.Length - 1];\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetNameWithoutExtension(this string s)\r\n        {\r\n            string name = Path.GetFileName(s);\r\n            if (Path.HasExtension(name))\r\n            {\r\n                int lastIndex = name.LastIndexOf('.');\r\n                return name.Remove(lastIndex);\r\n            }\r\n            return name;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetDirectory(this string s, char separator)\r\n        {\r\n            Verify.ArgumentNotNull(s, \"s\");\r\n\r\n            int lastIndex = s.LastIndexOf(separator);\r\n            if (lastIndex > 0)\r\n            {\r\n                return s.Remove(lastIndex);\r\n            }\r\n\r\n            if (lastIndex == 0 && s.Length > 1)\r\n            {\r\n                return \"/\";\r\n            }\r\n            if (lastIndex == 0 && s.Length == 1)\r\n            {\r\n                return \"\";\r\n            }\r\n\r\n            if (s.IndexOf(separator) == -1)\r\n            {\r\n                return \"\";\r\n            }\r\n\r\n            return s;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Combines URL paths using / as seperator\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"otherPath\"></param>\r\n        /// <param name=\"separator\"></param>\r\n        /// <returns></returns>\r\n        public static string Combine(this string path, string otherPath, char separator)\r\n        {\r\n            Verify.ArgumentNotNull(path, \"path\");\r\n            Verify.ArgumentNotNull(otherPath, \"otherPath\");\r\n\r\n            string childPath = otherPath;\r\n            if (otherPath.StartsWith(\"/\"))\r\n            {\r\n                childPath = otherPath.Substring(1, otherPath.Length - 1);\r\n            }\r\n            if (childPath.EndsWith(\"/\"))\r\n            {\r\n                childPath = otherPath.Substring(0, otherPath.Length - 1);\r\n            }\r\n\r\n            if (path.Length == 1 && path[0] == separator)\r\n            {\r\n                return path + childPath;\r\n            }\r\n\r\n            if (otherPath == \"/\" || otherPath == string.Empty)\r\n            {\r\n                return path;\r\n            }\r\n\r\n            return path + \"/\" + childPath;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Replaces old value with new value using the specified string comparison method for searching for the oldValue.\r\n        /// </summary>\r\n        /// <param name=\"str\">The string.</param>\r\n        /// <param name=\"oldValue\">The old subsvalue.</param>\r\n        /// <param name=\"newValue\">The new value.</param>\r\n        /// <param name=\"comparison\">The comparison.</param>\r\n        /// <returns></returns>\r\n        public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison)\r\n        {\r\n            int index = str.IndexOf(oldValue, comparison);\r\n\r\n            if (index == -1)\r\n            {\r\n                return str;\r\n            }\r\n\r\n            int previousIndex = 0;\r\n            var sb = new StringBuilder();\r\n\r\n            while (index != -1)\r\n            {\r\n                sb.Append(str, previousIndex, index - previousIndex);\r\n                sb.Append(newValue);\r\n                index += oldValue.Length;\r\n\r\n                previousIndex = index;\r\n                index = str.IndexOf(oldValue, index, comparison);\r\n            }\r\n            sb.Append(str, previousIndex, str.Length - previousIndex);\r\n\r\n            return sb.ToString();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/HashingHelper.cs",
    "content": "using System;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\n\r\nnamespace Composite.Core\r\n{\r\n    internal static class HashingHelper\r\n    {\r\n        [ThreadStatic]\r\n        private static MD5 _md5;\r\n\r\n        /// <summary>\r\n        /// Gets a cached instance of an MD5 algorithm\r\n        /// </summary>\r\n        private static MD5 MD5\r\n        {\r\n            get\r\n            {\r\n                var value = _md5;\r\n                if (value == null)\r\n                {\r\n                    _md5 = value = MD5.Create();\r\n                }\r\n\r\n                return value;\r\n            }\r\n        }\r\n\r\n        public static Guid ComputeMD5Hash(string str, Encoding textEncoding)\r\n        {\r\n            var bytes = textEncoding.GetBytes(str);\r\n            var hash = MD5.ComputeHash(bytes);\r\n            return new Guid(hash);\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IMailer.cs",
    "content": "﻿using System.Net.Mail;\nusing System.Threading.Tasks;\n\nnamespace Composite.Core\n{\n    /// <summary>\n    /// A contract for sending email messages.\n    /// </summary>\n    public interface IMailer\n    {\n        /// <summary>\n        /// Sends the specified <see cref=\"MailMessage\" />\n        /// </summary>\n        /// <param name=\"message\">The message to send</param>\n        void Send(MailMessage message);\n\n        /// <summary>\n        /// Sends the specified <see cref=\"MailMessage\" /> an asynchronous operation.\n        /// </summary>\n        /// <param name=\"message\">The message to send</param>\n        /// <returns>The task object representing the asynchronous operation.</returns>\n        Task SendAsync(MailMessage message);\n    }\n}\n"
  },
  {
    "path": "Composite/Core/IO/C1Directory.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.Directory. Using this implementation instead \r\n    /// of System.IO.Directory, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.Directory for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1Directory\"/>.\r\n    /// </summary>\r\n    public static class C1Directory\r\n    {\r\n        /// <summary>\r\n        /// Creates a directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to create.</param>\r\n        /// <returns>Returns a C1DirectoryInfo to the specified path.</returns>\r\n        public static C1DirectoryInfo CreateDirectory(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.CreateDirectory(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Moves a file or directory from the given source path to the given destination path.\r\n        /// </summary>\r\n        /// <param name=\"sourceDirName\">Path of file or directory to move.</param>\r\n        /// <param name=\"destDirName\">Target path of file or directory to be moved to.</param>\r\n        public static void Move(string sourceDirName, string destDirName)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1Directory.Move(sourceDirName, destDirName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes an empty directory on the given path.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of empty directory to delete.</param>\r\n        public static void Delete(string path)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1Directory.Delete(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the directory and if specified subdirectories and file on the given path.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory to delete.</param>\r\n        /// <param name=\"recursive\">Include subdirectories and files.</param>\r\n        public static void Delete(string path, bool recursive)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1Directory.Delete(path, recursive);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Determines if the directory in the given path exists or not.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to test.</param>\r\n        /// <returns></returns>\r\n        public static bool Exists(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.Exists(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the current directory.\r\n        /// </summary>\r\n        /// <returns>The current directory.</returns>\r\n        public static string GetCurrentDirectory()\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetCurrentDirectory();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the current directory\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to new current directory.</param>\r\n        public static void SetCurrentDirectory(string path)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1Directory.SetCurrentDirectory(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the parent of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory to get parent of.</param>\r\n        /// <returns>The parent of the given directory.</returns>\r\n        public static C1DirectoryInfo GetParent(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetParent(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns volume and/or root information of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory to get root information of.</param>\r\n        /// <returns>Volume and/or root information.</returns>\r\n        public static string GetDirectoryRoot(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetDirectoryRoot(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the subdirectories of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to get subdirectories.</param>\r\n        /// <returns>Subdirectories of the given directory.</returns>\r\n        public static string[] GetDirectories(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetDirectories(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the subdirectories of the given directory with the given search pattern.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to get subdirectories.</param>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <returns>Subdirectories of the given directory with the given search parrern.</returns>\r\n        public static string[] GetDirectories(string path, string searchPattern)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetDirectories(path, searchPattern);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the subdirectories of the given directory with the given search pattern and options.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to get subdirectories.</param>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <param name=\"searchOption\">Search options to use.</param>\r\n        /// <returns>Subdirectories of the given directory with the given search parrern and options.</returns>\r\n        public static string[] GetDirectories(string path, string searchPattern, SearchOption searchOption)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetDirectories(path, searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the files in the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory go get files from.</param>\r\n        /// <returns>Files in the given directory.</returns>\r\n        public static string[] GetFiles(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetFiles(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the files in the given directory with the given search pattern.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory go get files from.</param>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <returns>Files in the given directory with the given search pattern.</returns>\r\n        public static string[] GetFiles(string path, string searchPattern)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetFiles(path, searchPattern);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the files in the given directory with the given search pattern and options.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory go get files from.</param>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <param name=\"searchOption\">Search options to use.</param>\r\n        /// <returns>Files in the given directory with the given search pattern and options.</returns>\r\n        public static string[] GetFiles(string path, string searchPattern, SearchOption searchOption)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetFiles(path, searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the creation date and time of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory.</param>\r\n        /// <returns>Creation date and time of the given directory.</returns>\r\n        public static DateTime GetCreationTime(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetCreationTime(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the creation date and utc time of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory.</param>\r\n        /// <returns>Creation date and time of the given directory.</returns>\r\n        public static DateTime GetCreationTimeUtc(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1Directory.GetCreationTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateDirectories(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateDirectories(string path, string searchPattern)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateDirectories(string path, string searchPattern, SearchOption searchOption)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateFiles(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateFiles(string path, string searchPattern)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateFiles(string path, string searchPattern, SearchOption searchOption)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateFileSystemEntries(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern, SearchOption searchOption)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static string[] GetFileSystemEntries(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static string[] GetFileSystemEntries(string path, string searchPattern)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static string[] GetFileSystemEntries(string path, string searchPattern, SearchOption searchOption)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static DirectorySecurity GetAccessControl(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static DirectorySecurity GetAccessControl(string path, AccessControlSections includeSections)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public static void SetAccessControl(string path, DirectorySecurity directorySecurity)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the creation date and time for the specified file or directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">The file or directory for which to set the creation date and time information. </param>\r\n        /// <param name=\"creationTime\">An object that contains the value to set for the creation date and time of path. This value is expressed in local time. </param>\r\n        public static void SetCreationTime(string path, DateTime creationTime)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1Directory.SetCreationTime(path, creationTime);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file or directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">The file or directory for which to set the creation date and time information.</param>\r\n        /// <param name=\"creationTimeUtc\">An object that contains the value to set for the creation date and time of path. This value is expressed in UTC time.</param>\r\n        public static void SetCreationTimeUtc(string path, DateTime creationTimeUtc)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1Directory.SetCreationTimeUtc(path, creationTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        //public static string[] GetLogicalDrives()\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static DateTime GetLastAccessTime(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static void SetLastAccessTime(string path, DateTime lastAccessTime)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static DateTime GetLastAccessTimeUtc(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static DateTime GetLastWriteTime(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static void SetLastWriteTime(string path, DateTime lastWriteTime)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static DateTime GetLastWriteTimeUtc(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1DirectoryInfo.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n\r\n\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.DirectoryInfo. Using this implementation instead \r\n    /// of System.IO.DirectoryInfo, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.DirectoryInfo for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1DirectoryInfo\"/>. \r\n    /// </summary>\r\n    public class C1DirectoryInfo : C1FileSystemInfo\r\n    {\r\n        private ImplementationContainer<C1DirectoryInfoImplementation> _implementation;\r\n\r\n\r\n        /// <summary>\r\n        /// Creates and initialize a new C1DirectoryInfo.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to use.</param>\r\n        public C1DirectoryInfo(string path)\r\n        {\r\n            _implementation = new ImplementationContainer<C1DirectoryInfoImplementation>(() => ImplementationFactory.CurrentFactory.CreateC1DirectoryInfo(path));\r\n            _implementation.CreateImplementation();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The name of the directory.\r\n        /// </summary>\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Full path of the directory.\r\n        /// </summary>\r\n        public override string FullName\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.FullName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The extension of the directory.\r\n        /// </summary>\r\n        public override string Extension\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Extension;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Tells if the directory exists or not.\r\n        /// </summary>\r\n        public override bool Exists\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Exists;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The root directory of the directory.\r\n        /// </summary>\r\n        public C1DirectoryInfo Root\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Root;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The parent directory of the directory.\r\n        /// </summary>\r\n        public C1DirectoryInfo Parent\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Parent;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// File attributes of the directory.\r\n        /// </summary>\r\n        public override FileAttributes Attributes\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Attributes;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.Attributes = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the subdirectories of the directory.\r\n        /// </summary>\r\n        /// <returns>Subdirectories of the directory.</returns>\r\n        public C1DirectoryInfo[] GetDirectories()\r\n        {\r\n            return _implementation.Implementation.GetDirectories();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the subdirectores of the directory given the search pattern.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <returns>Subdirectories of the directory.</returns>\r\n        public C1DirectoryInfo[] GetDirectories(string searchPattern)\r\n        {\r\n            return _implementation.Implementation.GetDirectories(searchPattern);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the subdirectores of the directory given the search pattern and options.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\">The search pattern to use.</param>\r\n        /// <param name=\"searchOption\">The search options to use.</param>\r\n        /// <returns>Subdirectories of the directory.</returns>\r\n        public C1DirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchOption)\r\n        {\r\n            return _implementation.Implementation.GetDirectories(searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the files in the directory.\r\n        /// </summary>\r\n        /// <returns>Files in the directory.</returns>\r\n        public C1FileInfo[] GetFiles()\r\n        {\r\n            return _implementation.Implementation.GetFiles();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the files in the directory given the search pattern.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\">The search pattern to use.</param>\r\n        /// <returns>Files in the directory given the search pattern.</returns>\r\n        public C1FileInfo[] GetFiles(string searchPattern)\r\n        {\r\n            return _implementation.Implementation.GetFiles(searchPattern);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the files in the directory given the search pattern and options.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\">The search pattern to use.</param>\r\n        /// <param name=\"searchOption\">The search options to use.</param>\r\n        /// <returns>Files in the directory given the search pattern and options.</returns>\r\n        public C1FileInfo[] GetFiles(string searchPattern, SearchOption searchOption)\r\n        {\r\n            return _implementation.Implementation.GetFiles(searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates the directory.\r\n        /// </summary>\r\n        public void Create()\r\n        {\r\n            _implementation.Implementation.Create();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a subdirectory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to create.</param>\r\n        /// <returns></returns>\r\n        public C1DirectoryInfo CreateSubdirectory(string path)\r\n        {\r\n            return _implementation.Implementation.CreateSubdirectory(path);\r\n        }\r\n              \r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Moves the directory to the given path.\r\n        /// </summary>\r\n        /// <param name=\"destDirName\">Destination directory name.</param>\r\n        public void MoveTo(string destDirName)\r\n        {\r\n            _implementation.Implementation.MoveTo(destDirName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the directory if empty.\r\n        /// </summary>\r\n        public override void Delete()\r\n        {\r\n            _implementation.Implementation.Delete();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the directory, files and subdirectories if specified.\r\n        /// </summary>\r\n        /// <param name=\"recursive\">If true, a recursive delete will be performced.</param>\r\n        public void Delete(bool recursive)\r\n        {\r\n            _implementation.Implementation.Delete(recursive);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The creation time of the directory.\r\n        /// </summary>\r\n        public override DateTime CreationTime\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.CreationTime;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.CreationTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The creation utc time of the directory.\r\n        /// </summary>\r\n        public override DateTime CreationTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.CreationTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.CreationTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Last access time of the directory.\r\n        /// </summary>\r\n        public override DateTime LastAccessTime\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.LastAccessTime;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.LastAccessTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Last access utc time of the directory.\r\n        /// </summary>\r\n        public override DateTime LastAccessTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.LastAccessTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.LastAccessTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Last write time of the directory.\r\n        /// </summary>\r\n        public override DateTime LastWriteTime\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.LastWriteTime;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.LastWriteTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Last write utc time of the directory.\r\n        /// </summary>\r\n        public override DateTime LastWriteTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.LastWriteTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.LastWriteTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public override void GetObjectData(SerializationInfo info, StreamingContext context)\r\n        {\r\n            _implementation.Implementation.GetObjectData(info, context);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public override void Refresh()\r\n        {\r\n            _implementation.Implementation.Refresh();\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        // public C1DirectoryInfo CreateSubdirectory(string path, DirectorySecurity directorySecurity);\r\n        // public FileSystemInfo[] GetFileSystemInfos();\r\n        // public FileSystemInfo[] GetFileSystemInfos(string searchPattern);\r\n        // public void Create(DirectorySecurity directorySecurity);\r\n        // public DirectorySecurity GetAccessControl(AccessControlSections includeSections);\r\n        // public void SetAccessControl(DirectorySecurity directorySecurity);\r\n        // public DirectorySecurity GetAccessControl();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1File.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.File. Using this implementation instead \r\n    /// of System.IO.File, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.File for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1File\"/>. \r\n    /// </summary>\r\n    public static class C1File\r\n    {\r\n        /// <summary>\r\n        /// Determins if the given file exists or not.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to the file.</param>\r\n        /// <returns>Returns true if the file exists, false if not.</returns>\r\n        public static bool Exists(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.Exists(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is not a port of the System.IO.File. This method can be used to 'touch' an\r\n        /// existing file. This is a way of telling the C1 IO system that the file has been \r\n        /// touched and C1 uses this to handle other than standard Windows deployments, like\r\n        /// Windows Azure.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to touch.</param>\r\n        public static void Touch(string path)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.Touch(path);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Copies a file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Source path of file to copy.</param>\r\n        /// <param name=\"destFileName\">Target path of the file to be copied to.</param>\r\n        public static void Copy(string sourceFileName, string destFileName)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.Copy(sourceFileName, destFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Copies a file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Source path of file to copy.</param>\r\n        /// <param name=\"destFileName\">Target path of the file to be copied to.</param>\r\n        /// <param name=\"overwrite\">If this is true and the target path exists, it will be overwritten without any exceptions.</param>\r\n        public static void Copy(string sourceFileName, string destFileName, bool overwrite)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.Copy(sourceFileName, destFileName, overwrite);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Moves a file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Path of file to move.</param>\r\n        /// <param name=\"destFileName\">Destination path to move the file to.</param>\r\n        public static void Move(string sourceFileName, string destFileName)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.Move(sourceFileName, destFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Replace a file with another file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Path to source file.</param>\r\n        /// <param name=\"destinationFileName\">Path to file to replace.</param>\r\n        /// <param name=\"destinationBackupFileName\"></param>\r\n        public static void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.Replace(sourceFileName, destinationFileName, destinationBackupFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Replace a file with another file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Path to source file.</param>\r\n        /// <param name=\"destinationFileName\">Path to file to replace.</param>\r\n        /// <param name=\"destinationBackupFileName\"></param>\r\n        /// <param name=\"ignoreMetadataErrors\"></param>\r\n        public static void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.Replace(sourceFileName, destinationFileName, destinationBackupFileName, ignoreMetadataErrors);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the given file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to delete.</param>\r\n        public static void Delete(string path)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.Delete(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file and returns a file stream to it <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to create.</param>\r\n        /// <returns>Returns the newly created <see cref=\"C1FileStream\"/> stream.</returns>\r\n        public static C1FileStream Create(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.Create(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file and returns a file stream to it <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to create.</param>\r\n        /// <param name=\"bufferSize\">Buffer size of returned stream.</param>\r\n        /// <returns>Returns the newly created <see cref=\"C1FileStream\"/> stream.</returns>\r\n        public static C1FileStream Create(string path, int bufferSize)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.Create(path, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file and returns a file stream to it <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to create.</param>\r\n        /// <param name=\"bufferSize\">Buffer size of returned stream.</param>\r\n        /// <param name=\"options\">File options of returned stream.</param>\r\n        /// <returns>Returns the newly created <see cref=\"C1FileStream\"/> stream.</returns>\r\n        public static C1FileStream Create(string path, int bufferSize, FileOptions options)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.Create(path, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file and returns a stream writer to it <see cref=\"C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to create.</param>\r\n        /// <returns>Returns the newly created <see cref=\"C1StreamWriter\"/>.</returns>\r\n        public static C1StreamWriter CreateText(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.CreateText(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a <see cref=\"C1StreamWriter\"/> for appending.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <returns>Returns the newly opned <see cref=\"C1StreamWriter\"/>.</returns>\r\n        public static C1StreamWriter AppendText(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.AppendText(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Appends content to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <param name=\"contents\">Content to append to file.</param>        \r\n        public static void AppendAllText(string path, string contents)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.AppendAllText(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Appends content to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <param name=\"contents\">Content to append to file.</param>        \r\n        /// <param name=\"encoding\">Encoding to use when appending.</param>\r\n        public static void AppendAllText(string path, string contents, Encoding encoding)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.AppendAllText(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Appends content to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <param name=\"contents\">Content to append to file.</param>\r\n        public static void AppendAllLines(string path, IEnumerable<string> contents)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.AppendAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Appends content to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <param name=\"contents\">Content to append to file.</param>        \r\n        /// <param name=\"encoding\">Encoding to use when appending.</param>\r\n        public static void AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.AppendAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        public static C1FileStream Open(string path, FileMode mode)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.Open(path, mode);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        public static C1FileStream Open(string path, FileMode mode, FileAccess access)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.Open(path, mode, access);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <param name=\"share\">File share to use.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        public static C1FileStream Open(string path, FileMode mode, FileAccess access, FileShare share)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.Open(path, mode, access, share);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file for reading.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        public static C1FileStream OpenRead(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.OpenRead(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1StreamReader\"/>.</returns>\r\n        public static C1StreamReader OpenText(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.OpenText(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file for writing.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        public static C1FileStream OpenWrite(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.OpenWrite(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read all bytes from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <returns>Returns read bytes.</returns>\r\n        public static byte[] ReadAllBytes(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.ReadAllBytes(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read all lines from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <returns>Returns read lines.</returns>\r\n        public static string[] ReadAllLines(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.ReadAllLines(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read all lines from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <param name=\"encoding\">Encoding to use when reading.</param>\r\n        /// <returns>Returns read lines.</returns>\r\n        public static string[] ReadAllLines(string path, Encoding encoding)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.ReadAllLines(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read all text from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <returns>The content of the file.</returns>\r\n        public static string ReadAllText(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.ReadAllText(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read all text from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <param name=\"encoding\">Encoding to use when reading.</param>\r\n        /// <returns>The content of the file.</returns>\r\n        public static string ReadAllText(string path, Encoding encoding)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.ReadAllText(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read all lines from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <returns>Returns all read lines.</returns>\r\n        public static IEnumerable<string> ReadLines(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.ReadLines(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read all lines from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <param name=\"encoding\">Encoding to use when reading.</param>\r\n        /// <returns>Returns all read lines.</returns>\r\n        public static IEnumerable<string> ReadLines(string path, Encoding encoding)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.ReadLines(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes bytes to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"bytes\">Bytes to write.</param>\r\n        public static void WriteAllBytes(string path, byte[] bytes)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.WriteAllBytes(path, bytes);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes lines to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Lines to write.</param>\r\n        public static void WriteAllLines(string path, IEnumerable<string> contents)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.WriteAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes lines to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Lines to write.</param>\r\n        public static void WriteAllLines(string path, string[] contents)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.WriteAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes lines to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Lines to write.</param>\r\n        /// <param name=\"encoding\">Encoding to use when writing.</param>\r\n        public static void WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.WriteAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes lines to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Lines to write.</param>\r\n        /// <param name=\"encoding\">Encoding to use when writing.</param>\r\n        public static void WriteAllLines(string path, string[] contents, Encoding encoding)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.WriteAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes text to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Text to write.</param>\r\n        public static void WriteAllText(string path, string contents)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.WriteAllText(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes text to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Text to write.</param>\r\n        /// <param name=\"encoding\">Encoding to use when writing.</param>\r\n        public static void WriteAllText(string path, string contents, Encoding encoding)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.WriteAllText(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the file attributes.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to get attributes from.</param>\r\n        /// <returns>Returns the file attributes. See System.IO.FileAttributes</returns>\r\n        public static FileAttributes GetAttributes(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.GetAttributes(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the file attributes.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to set attributes on.</param>\r\n        /// <param name=\"fileAttributes\">File attributes to set.</param>\r\n        public static void SetAttributes(string path, FileAttributes fileAttributes)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.SetAttributes(path, fileAttributes);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the creation time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the creation time of the given file.</returns>\r\n        public static DateTime GetCreationTime(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.GetCreationTime(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the creation utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the creation utc time of the given file.</returns>\r\n        public static DateTime GetCreationTimeUtc(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.GetCreationTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the creation time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"creationTime\">New creation time.</param>\r\n        public static void SetCreationTime(string path, DateTime creationTime)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.SetCreationTime(path, creationTime);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the creation utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"creationTimeUtc\">New creation utc time.</param>\r\n        public static void SetCreationTimeUtc(string path, DateTime creationTimeUtc)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.SetCreationTimeUtc(path, creationTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the last access time.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the last access time of the file.</returns>\r\n        public static DateTime GetLastAccessTime(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.GetLastAccessTime(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the last access utc time.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the last access utc time of the file.</returns>\r\n        public static DateTime GetLastAccessTimeUtc(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.GetLastAccessTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the last access time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"lastAccessTime\">New last access time.</param>\r\n        public static void SetLastAccessTime(string path, DateTime lastAccessTime)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.SetLastAccessTime(path, lastAccessTime);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the last access utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"lastAccessTimeUtc\">New last access utc time.</param>\r\n        public static void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.SetLastAccessTimeUtc(path, lastAccessTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Get last write time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the last write time of the file.</returns>\r\n        public static DateTime GetLastWriteTime(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.GetLastWriteTime(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Get last write utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the last write utc time of the file.</returns>\r\n        public static DateTime GetLastWriteTimeUtc(string path)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessC1File.GetLastWriteTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the last write time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"lastWriteTime\">New last write time.</param>\r\n        public static void SetLastWriteTime(string path, DateTime lastWriteTime)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.SetLastWriteTime(path, lastWriteTime);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the last write utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"lastWriteTimeUtc\">New last write utc time.</param>\r\n        public static void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessC1File.SetLastWriteTimeUtc(path, lastWriteTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        //public static FileStream Create(string path, int bufferSize, System.IO.FileOptions options, System.Security.AccessControl.FileSecurity fileSecurity)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n\r\n        //public static void Encrypt(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static void Decrypt(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static System.Security.AccessControl.FileSecurity GetAccessControl(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static System.Security.AccessControl.FileSecurity GetAccessControl(string path, System.Security.AccessControl.AccessControlSections includeSections)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public static void SetAccessControl(string path, System.Security.AccessControl.FileSecurity fileSecurity)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1FileInfo.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.FileInfo. Using this implementation instead \r\n    /// of System.IO.FileInfo, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.FileInfo for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileInfo\"/>. \r\n    /// </summary>\r\n    public class C1FileInfo : C1FileSystemInfo\r\n    {\r\n        private ImplementationContainer<C1FileInfoImplementation> _implementation;\r\n\r\n        /// <summary>\r\n        /// Creates a C1FileInfo.\r\n        /// </summary>\r\n        /// <param name=\"fileName\">Path to file.</param>\r\n        public C1FileInfo(string fileName)\r\n        {\r\n            _implementation = new ImplementationContainer<C1FileInfoImplementation>(() => ImplementationFactory.CurrentFactory.CreateC1FileInfo(fileName));\r\n            _implementation.CreateImplementation();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the directory name of the file.\r\n        /// </summary>\r\n        public string DirectoryName\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.DirectoryName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a <see cref=\"C1DirectoryInfo\"/> of the file.\r\n        /// </summary>\r\n        public C1DirectoryInfo Directory\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Directory;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the name of the file.\r\n        /// </summary>\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the full path and name of the file.\r\n        /// </summary>\r\n        public override string FullName\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.FullName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the file exists. Otherwise false.\r\n        /// </summary>\r\n        public override bool Exists\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Exists;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the extension of the file.\r\n        /// </summary>\r\n        public override string Extension\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Extension;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if and only if the file is read only.\r\n        /// </summary>\r\n        public bool IsReadOnly\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.IsReadOnly;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the size of the file in bytes.\r\n        /// </summary>\r\n        public long Length\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Length;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the file attributes on the file.\r\n        /// </summary>\r\n        public override FileAttributes Attributes\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Attributes;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.Attributes = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/>.</returns>\r\n        public C1FileStream Create()\r\n        {\r\n            return _implementation.Implementation.Create();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1StreamWriter\"/>.</returns>\r\n        public C1StreamWriter CreateText()\r\n        {\r\n            return _implementation.Implementation.CreateText();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1StreamWriter\"/> for appending.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1StreamWriter\"/> for appending.</returns>\r\n        public C1StreamWriter AppendText()\r\n        {\r\n            return _implementation.Implementation.AppendText();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/>.</returns>\r\n        public C1FileStream Open(FileMode mode)\r\n        {\r\n            return _implementation.Implementation.Open(mode);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/>.</returns>\r\n        public C1FileStream Open(FileMode mode, FileAccess access)\r\n        {\r\n            return _implementation.Implementation.Open(mode, access);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <param name=\"share\">File share to use.</param>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/>.</returns>\r\n        public C1FileStream Open(FileMode mode, FileAccess access, FileShare share)\r\n        {\r\n            return _implementation.Implementation.Open(mode, access, share);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/> for reading.</returns>\r\n        public C1FileStream OpenRead()\r\n        {\r\n            return _implementation.Implementation.OpenRead();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1StreamReader\"/>.</returns>\r\n        public C1StreamReader OpenText()\r\n        {\r\n            return _implementation.Implementation.OpenText();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/> for writing.</returns>\r\n        public C1FileStream OpenWrite()\r\n        {\r\n            return _implementation.Implementation.OpenWrite();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Copies the file to the given path.\r\n        /// </summary>\r\n        /// <param name=\"destFileName\">Destination path.</param>\r\n        /// <returns>A new <see cref=\"C1FileInfo\"/> for the destination file.</returns>\r\n        public C1FileInfo CopyTo(string destFileName)\r\n        {\r\n            return _implementation.Implementation.CopyTo(destFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Copies the file to the given path and overwrites any existing file if specified.\r\n        /// </summary>\r\n        /// <param name=\"destFileName\">Destination path.</param>\r\n        /// <param name=\"overwrite\">If true, any existing file will be overwritten.</param>\r\n        /// <returns>A new <see cref=\"C1FileInfo\"/> for the destination file.</returns>\r\n        public C1FileInfo CopyTo(string destFileName, bool overwrite)\r\n        {\r\n            return _implementation.Implementation.CopyTo(destFileName, overwrite);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Moves the file to the given path.\r\n        /// </summary>\r\n        /// <param name=\"destFileName\">Destination path.</param>\r\n        public void MoveTo(string destFileName)\r\n        {\r\n            _implementation.Implementation.MoveTo(destFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Replaces the given file with this one.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\">Destination path to file to replace.</param>\r\n        /// <param name=\"destinationBackupFileName\">Path to backup file.</param>\r\n        /// <returns>A new <see cref=\"C1FileInfo\"/> for the destination file.</returns>\r\n        public C1FileInfo Replace(string destinationFileName, string destinationBackupFileName)\r\n        {\r\n            return _implementation.Implementation.Replace(destinationFileName, destinationBackupFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Replaces the given file with this one.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\">Destination path to file to replace.</param>\r\n        /// <param name=\"destinationBackupFileName\">Path to backup file.</param>\r\n        /// <param name=\"ignoreMetadataErrors\"></param>\r\n        /// <returns>A new <see cref=\"C1FileInfo\"/> for the destination file.</returns>\r\n        public C1FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)\r\n        {\r\n            return _implementation.Implementation.Replace(destinationFileName, destinationBackupFileName, ignoreMetadataErrors);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the file.\r\n        /// </summary>\r\n        public override void Delete()\r\n        {\r\n            _implementation.Implementation.Delete();\r\n        }        \r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the creation time of the file.\r\n        /// </summary>\r\n        public override DateTime CreationTime\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.CreationTime;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.CreationTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the creation utc time of the file.\r\n        /// </summary>\r\n        public override DateTime CreationTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.CreationTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.CreationTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last access time of the file.\r\n        /// </summary>\r\n        public override DateTime LastAccessTime\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.LastAccessTime;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.LastAccessTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last access utc time of the file.\r\n        /// </summary>\r\n        public override DateTime LastAccessTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.LastAccessTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.LastAccessTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last write time of the file.\r\n        /// </summary>\r\n        public override DateTime LastWriteTime\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.LastWriteTime;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.LastWriteTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last write utc time of the file.\r\n        /// </summary>\r\n        public override DateTime LastWriteTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.LastWriteTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.LastWriteTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public override void Refresh()\r\n        {\r\n            _implementation.Implementation.Refresh();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"info\"></param>\r\n        /// <param name=\"context\"></param>\r\n        public override void GetObjectData(SerializationInfo info, StreamingContext context)\r\n        {\r\n            _implementation.Implementation.GetObjectData(info, context);\r\n        }\r\n\r\n\r\n        //public FileSecurity GetAccessControl();\r\n        //public FileSecurity GetAccessControl(AccessControlSections includeSections);\r\n        //public void SetAccessControl(FileSecurity fileSecurity);\r\n\r\n        //public void Decrypt();        \r\n        //public void Encrypt();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1FileStream.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.FileStream. Using this implementation instead \r\n    /// of System.IO.FileStream, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.FileStream for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileStream\"/>. \r\n    /// </summary>\r\n    public class C1FileStream : Stream\r\n    {\r\n        private bool _disposed;\r\n        private readonly ImplementationContainer<C1FileStreamImplementation> _implementation;\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new C1FileStream.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        public C1FileStream(string path, FileMode mode)\r\n            : this(path, mode, (mode == FileMode.Append) ? FileAccess.Write : FileAccess.ReadWrite, FileShare.Read, 4096, FileOptions.None)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new C1FileStream.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        public C1FileStream(string path, FileMode mode, FileAccess access)\r\n            : this(path, mode, access, FileShare.Read, 4096, FileOptions.None)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new C1FileStream.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <param name=\"share\">File share to use.</param>\r\n        public C1FileStream(string path, FileMode mode, FileAccess access, FileShare share)\r\n            : this(path, mode, access, share, 4096, FileOptions.None)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new C1FileStream.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <param name=\"share\">File share to use.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use.</param>\r\n        public C1FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize)\r\n            : this(path, mode, access, share, bufferSize, FileOptions.None)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new C1FileStream.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <param name=\"share\">File share to use.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use.</param>\r\n        /// <param name=\"options\">File options to use.</param>\r\n        public C1FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)\r\n        {\r\n            _implementation = new ImplementationContainer<C1FileStreamImplementation>(() => ImplementationFactory.CurrentFactory.CreateC1FileStream(path, mode, access, share, bufferSize, options));\r\n            _implementation.CreateImplementation();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Name of the file.\r\n        /// </summary>\r\n        public string Name => _implementation.Implementation.Name;\r\n\r\n\r\n        /// <summary>\r\n        /// Size of the file in bytes.\r\n        /// </summary>\r\n        public override long Length => _implementation.Implementation.Length;\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the length of the file in bytes.\r\n        /// </summary>\r\n        /// <param name=\"value\">New length of file stream.</param>\r\n        public override void SetLength(long value)\r\n        {\r\n            _implementation.Implementation.SetLength(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the current read/write position in the file stream.\r\n        /// </summary>\r\n        public override long Position\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Position;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.Position = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a block of bytes from the file stream.\r\n        /// </summary>\r\n        /// <param name=\"array\">Target buffer of read bytes.</param>\r\n        /// <param name=\"offset\">Offset in the buffer to put read bytes.</param>\r\n        /// <param name=\"count\">Number of bytes to read.</param>\r\n        /// <returns>Number of bytes read.</returns>\r\n        public override int Read(byte[] array, int offset, int count)\r\n        {\r\n            return _implementation.Implementation.Read(array, offset, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a byte form the file stream.\r\n        /// </summary>\r\n        /// <returns>The read byte value.</returns>\r\n        public override int ReadByte()\r\n        {\r\n            return _implementation.Implementation.ReadByte();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a block of bytes to the file stream.\r\n        /// </summary>\r\n        /// <param name=\"array\">Bytes to write to the file.</param>\r\n        /// <param name=\"offset\">Offset in buffer to write from.</param>\r\n        /// <param name=\"count\">Number of bytes to write.</param>\r\n        public override void Write(byte[] array, int offset, int count)\r\n        {\r\n            _implementation.Implementation.Write(array, offset, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a byte to the file stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Byte value to write.</param>\r\n        public override void WriteByte(byte value)\r\n        {\r\n            _implementation.Implementation.WriteByte(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Seeks to a position in the file stream.\r\n        /// </summary>\r\n        /// <param name=\"offset\">Offset to seek.</param>\r\n        /// <param name=\"origin\">Origin to seek from.</param>\r\n        /// <returns>The new position in the stream.</returns>\r\n        public override long Seek(long offset, SeekOrigin origin)\r\n        {\r\n            return _implementation.Implementation.Seek(offset, origin);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if its possible to read from the stream.\r\n        /// </summary>\r\n        public override bool CanRead => _implementation.Implementation.CanRead;\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if its possible to seek in the stream.\r\n        /// </summary>\r\n        public override bool CanSeek => _implementation.Implementation.CanSeek;\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if its possible to write to the stream.\r\n        /// </summary>\r\n        public override bool CanWrite => _implementation.Implementation.CanWrite;\r\n\r\n\r\n        /// <summary>\r\n        /// Flushes the buffered bytes to the file.\r\n        /// </summary>\r\n        public override void Flush()\r\n        {\r\n            _implementation.Implementation.Flush();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Flushes the buffered bytes to the file.\r\n        /// </summary>\r\n        /// <param name=\"flushToDisk\"></param>\r\n        public virtual void Flush(bool flushToDisk)\r\n        {\r\n            _implementation.Implementation.Flush(flushToDisk);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Disposes the file stream.\r\n        /// </summary>\r\n        /// <param name=\"disposing\"></param>\r\n        protected override void Dispose(bool disposing)\r\n        {\r\n            if (disposing && !_disposed)\r\n            {\r\n                _disposed = true;\r\n                _implementation.DisposeImplementation();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1FileSystemInfo.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.FileSystemInfo. Using this implementation instead \r\n    /// of System.IO.FileSystemInfo, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.FileSystemInfo for more documentation on the methods of this class.\r\n    /// </summary>\r\n    public abstract class C1FileSystemInfo\r\n    {\r\n        /// <summary>\r\n        /// Full path name.\r\n        /// </summary>\r\n        public abstract string FullName { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Extension.\r\n        /// </summary>\r\n        public abstract string Extension { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the file system item exitst.\r\n        /// </summary>\r\n        public abstract bool Exists { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// File attributes of the file system item.\r\n        /// </summary>\r\n        public abstract FileAttributes Attributes { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the file system item.\r\n        /// </summary>\r\n        public abstract void Delete();\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the creation time of the file system item.\r\n        /// </summary>\r\n        public abstract DateTime CreationTime { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the creation utc time of the file system item.\r\n        /// </summary>\r\n        public abstract DateTime CreationTimeUtc { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last access time of the file system item.\r\n        /// </summary>\r\n        public abstract DateTime LastAccessTime { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last access utc time of the file system item.\r\n        /// </summary>\r\n        public abstract DateTime LastAccessTimeUtc { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last write time of the file system item.\r\n        /// </summary>\r\n        public abstract DateTime LastWriteTime { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last write utc time of the file system item.\r\n        /// </summary>\r\n        public abstract DateTime LastWriteTimeUtc { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public abstract void GetObjectData(SerializationInfo info, StreamingContext context);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public abstract void Refresh();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1FileSystemWatcher.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.FileSystemWatcher. Using this implementation instead \r\n    /// of System.IO.FileSystemWatcher, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.FileSystemWatcher for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileStream\"/>.\r\n    /// </summary>\r\n    public class C1FileSystemWatcher : ImplementationContainer<C1FileSystemWatcherImplementation>, IDisposable\r\n    {\r\n        /// <summary>\r\n        /// Creates a new file system watcher given the path.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to watch.</param>\r\n        public C1FileSystemWatcher(string path)\r\n            : this(path, null)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file system watcher given the path.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to watch.</param>\r\n        /// <param name=\"filter\">Filter to use.</param>\r\n        public C1FileSystemWatcher(string path, string filter)\r\n            : base(() => ImplementationFactory.CurrentFactory.CreateC1FileSystemWatcher(path, filter))\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets if events should be raised or not.\r\n        /// </summary>\r\n        public bool EnableRaisingEvents\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.EnableRaisingEvents;\r\n            }\r\n            set\r\n            {\r\n                this.Implementation.EnableRaisingEvents = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Path to watch.\r\n        /// </summary>\r\n        public string Path\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.Path;\r\n            }\r\n            set\r\n            {\r\n                this.Implementation.Path = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Filter to use.\r\n        /// </summary>\r\n        public string Filter\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.Filter;\r\n            }\r\n            set\r\n            {\r\n                this.Implementation.Filter = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets of subdirectories should also be watched.\r\n        /// </summary>\r\n        public bool IncludeSubdirectories\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.IncludeSubdirectories;\r\n            }\r\n            set\r\n            {\r\n                this.Implementation.IncludeSubdirectories = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the size of an internal buffer.\r\n        /// </summary>\r\n        public int InternalBufferSize\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.InternalBufferSize;\r\n            }\r\n            set\r\n            {\r\n                this.Implementation.InternalBufferSize = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when new items are created.\r\n        /// </summary>\r\n        public event FileSystemEventHandler Created\r\n        {\r\n            add\r\n            {\r\n                this.Implementation.Created += value;\r\n            }\r\n            remove\r\n            {\r\n                this.Implementation.Created -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when new items changed.\r\n        /// </summary>\r\n        public event FileSystemEventHandler Changed\r\n        {\r\n            add\r\n            {\r\n                this.Implementation.Changed += value;\r\n            }\r\n            remove\r\n            {\r\n                this.Implementation.Changed -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when new items are renamed.\r\n        /// </summary>\r\n        public event RenamedEventHandler Renamed\r\n        {\r\n            add\r\n            {\r\n                this.Implementation.Renamed += value;\r\n            }\r\n            remove\r\n            {\r\n                this.Implementation.Renamed -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when new items are deleted.\r\n        /// </summary>\r\n        public event FileSystemEventHandler Deleted\r\n        {\r\n            add\r\n            {\r\n                this.Implementation.Deleted += value;\r\n            }\r\n            remove\r\n            {\r\n                this.Implementation.Deleted -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when an error occur.\r\n        /// </summary>\r\n        public event ErrorEventHandler Error\r\n        {\r\n            add\r\n            {\r\n                this.Implementation.Error += value;\r\n            }\r\n            remove\r\n            {\r\n                this.Implementation.Error -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the notify filter.\r\n        /// </summary>\r\n        public NotifyFilters NotifyFilter\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.NotifyFilter;\r\n            }\r\n            set\r\n            {\r\n                this.Implementation.NotifyFilter = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Begins the initialization.\r\n        /// </summary>\r\n        public void BeginInit()\r\n        {\r\n            Log.LogInformation(\"C1FileSystemWatcher\", \"BeginInit starting\");\r\n            this.Implementation.BeginInit();\r\n            Log.LogInformation(\"C1FileSystemWatcher\", \"BeginInit done\");\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Ends the initialization.\r\n        /// </summary>\r\n        public void EndInit()\r\n        {\r\n            this.Implementation.EndInit();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"changeType\"></param>\r\n        /// <returns></returns>\r\n        public C1WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType)\r\n        {\r\n            return this.Implementation.WaitForChanged(changeType);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"changeType\"></param>\r\n        /// <param name=\"timeout\"></param>\r\n        /// <returns></returns>\r\n        public C1WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout)\r\n        {\r\n            return this.Implementation.WaitForChanged(changeType, timeout);\r\n        }\r\n\r\n        void IDisposable.Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <summary>\r\n        /// Destructor.\r\n        /// </summary>\r\n        ~C1FileSystemWatcher()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n        /// <summary>\r\n        /// Disposes the stream.\r\n        /// </summary>\r\n        /// <param name=\"disposing\">True if the stream is disposing.</param>\r\n        protected void Dispose(bool disposing)\r\n        {\r\n            if (disposing)\r\n            {\r\n                DisposeImplementation();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1StreamReader.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.InteropServices;\r\nusing System.Text;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.StreamReader. Using this implementation instead \r\n    /// of System.IO.StreamReader, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.StreamReader for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamReader\"/>.\r\n    /// </summary>\r\n    public class C1StreamReader : TextReader, IDisposable\r\n    {\r\n        private ImplementationContainer<C1StreamReaderImplementation> _implementation;\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        public C1StreamReader(string path)\r\n            : this(path, Encoding.UTF8, true, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\">If true, the encoding will be deteced by the content of the file.</param>\r\n        public C1StreamReader(string path, bool detectEncodingFromByteOrderMarks)\r\n            : this(path, Encoding.UTF8, detectEncodingFromByteOrderMarks, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to the file.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        public C1StreamReader(string path, Encoding encoding)\r\n            : this(path, encoding, true, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to the file.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\">If true, the encoding will be deteced by the content of the file.</param>\r\n        public C1StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks)\r\n            : this(path, encoding, detectEncodingFromByteOrderMarks, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to the file.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\">If true, the encoding will be deteced by the content of the file.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use.</param>\r\n        public C1StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            _implementation = new ImplementationContainer<C1StreamReaderImplementation>(() => ImplementationFactory.CurrentFactory.CreateC1StreamReader(path, encoding, detectEncodingFromByteOrderMarks, bufferSize));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to ream from.</param>\r\n        public C1StreamReader(Stream stream)\r\n            : this(stream, Encoding.UTF8, true, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to ream from.</param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\">If true, the encoding will be deteced by the content of the file.</param>\r\n        public C1StreamReader(Stream stream, bool detectEncodingFromByteOrderMarks)\r\n            : this(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to ream from.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        public C1StreamReader(Stream stream, Encoding encoding)\r\n            : this(stream, encoding, true, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to ream from.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\">If true, the encoding will be deteced by the content of the file.</param>\r\n        public C1StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks)\r\n            : this(stream, encoding, detectEncodingFromByteOrderMarks, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamReader.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to ream from.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\">If true, the encoding will be deteced by the content of the file.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use.</param>\r\n        public C1StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            _implementation = new ImplementationContainer<C1StreamReaderImplementation>(() => ImplementationFactory.CurrentFactory.CreateC1StreamReader(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a byte from the stream.\r\n        /// </summary>\r\n        /// <returns>Returns the read byte.</returns>\r\n        public override int Read()\r\n        {\r\n            return _implementation.Implementation.Read();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a block from the file.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Buffer to read into.</param>\r\n        /// <param name=\"index\">Index in buffer to start storing bytes.</param>\r\n        /// <param name=\"count\">Number of bytes to read.</param>\r\n        /// <returns>Returns the number read bytes.</returns>\r\n        public override int Read(char[] buffer, int index, int count)\r\n        {\r\n            return _implementation.Implementation.Read(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read a line from the file.\r\n        /// </summary>\r\n        /// <returns>Returns the read line.</returns>\r\n        public override string ReadLine()\r\n        {\r\n            return _implementation.Implementation.ReadLine();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Read all the content of the file into a strng.\r\n        /// </summary>\r\n        /// <returns>The content of the file.</returns>\r\n        public override string ReadToEnd()\r\n        {\r\n            return _implementation.Implementation.ReadToEnd();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a block from the file.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Buffer to store read chars.</param>\r\n        /// <param name=\"index\">Index in buffer to start storing chars.</param>\r\n        /// <param name=\"count\">Number of chars to read.</param>\r\n        /// <returns>Returns the number of read chars.</returns>\r\n        public override int ReadBlock(char[] buffer, int index, int count)\r\n        {\r\n            return _implementation.Implementation.ReadBlock(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Peeks the current byte.\r\n        /// </summary>\r\n        /// <returns>The current byte.</returns>\r\n        public override int Peek()\r\n        {\r\n            return _implementation.Implementation.Peek();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the stream is at the end of stream.\r\n        /// </summary>\r\n        public bool EndOfStream\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.EndOfStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Closes the stream.\r\n        /// </summary>\r\n        public override void Close()\r\n        {\r\n            _implementation.Implementation.Close();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the base stream.\r\n        /// </summary>\r\n        public virtual Stream BaseStream\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.BaseStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the current encoding of the stream.\r\n        /// </summary>\r\n        public virtual Encoding CurrentEncoding\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.CurrentEncoding;\r\n            }\r\n        }\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <summary>\r\n        /// Destructor.\r\n        /// </summary>\r\n        ~C1StreamReader()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n\r\n        /// <summary>\r\n        /// Disposes the stream.\r\n        /// </summary>\r\n        /// <param name=\"disposing\">Ttrue if the stream is disposing.</param>\r\n        protected override void Dispose(bool disposing)\r\n        {\r\n            if (disposing)\r\n            {\r\n                _implementation.DisposeImplementation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        //public void DiscardBufferedData()\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1StreamWriter.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.StreamWriter. Using this implementation instead \r\n    /// of System.IO.StreamWriter, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.StreamWriter for more documentation on the methods of this class.\r\n    /// See <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamWriter\"/>.\r\n    /// </summary>\r\n    public class C1StreamWriter : TextWriter, IDisposable\r\n    {\r\n        private ImplementationContainer<C1StreamWriterImplementation> _implementation;\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamWriter.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        public C1StreamWriter(string path)\r\n            : this(path, false, Encoding.UTF8, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamWriter.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"append\">If this is true, any writing will be appended to the file.</param>\r\n        public C1StreamWriter(string path, bool append)\r\n            : this(path, append, Encoding.UTF8, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamWriter.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"append\">If this is true, any writing will be appended to the file.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        public C1StreamWriter(string path, bool append, Encoding encoding)\r\n            : this(path, append, encoding, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamWriter.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"append\">If this is true, any writing will be appended to the file.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use.</param>\r\n        public C1StreamWriter(string path, bool append, Encoding encoding, int bufferSize)\r\n        {\r\n            _implementation = new ImplementationContainer<C1StreamWriterImplementation>(() => ImplementationFactory.CurrentFactory.CreateC1StreamWriter(path, append, encoding, bufferSize));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamWriter.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to use.</param>\r\n        public C1StreamWriter(Stream stream)\r\n            : this(stream, Encoding.UTF8, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamWriter.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to use.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        public C1StreamWriter(Stream stream, Encoding encoding)\r\n            : this(stream, encoding, 1024)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a C1StreamWriter.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to use.</param>\r\n        /// <param name=\"encoding\">Encoding to use.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use.</param>\r\n        public C1StreamWriter(Stream stream, Encoding encoding, int bufferSize)\r\n        {\r\n            _implementation = new ImplementationContainer<C1StreamWriterImplementation>(() => ImplementationFactory.CurrentFactory.CreateC1StreamWriter(stream, encoding, bufferSize));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">String to write.</param>\r\n        public override void Write(string value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a formatted string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        public override void Write(string format, object arg0)\r\n        {\r\n            _implementation.Implementation.Write(format, arg0);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a formatted string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        /// <param name=\"arg1\">String format argument.</param>\r\n        public override void Write(string format, object arg0, object arg1)\r\n        {\r\n            _implementation.Implementation.Write(format, arg0, arg1);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a formatted string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        /// <param name=\"arg1\">String format argument.</param>\r\n        /// <param name=\"arg2\">String format argument.</param>\r\n        public override void Write(string format, object arg0, object arg1, object arg2)\r\n        {\r\n            _implementation.Implementation.Write(format, arg0, arg1, arg2);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a formatted string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg\">String format arguments.</param>\r\n        public override void Write(string format, params object[] arg)\r\n        {\r\n            _implementation.Implementation.Write(format, arg);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">The char value to write.</param>\r\n        public override void Write(char value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char array to the stream.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Char array to write.</param>\r\n        public override void Write(char[] buffer)\r\n        {\r\n            _implementation.Implementation.Write(buffer);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char array to the stream.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Char array to write.</param>\r\n        /// <param name=\"index\">Start index in the buffer to start writing from.</param>\r\n        /// <param name=\"count\">Number of chars to write.</param>\r\n        public override void Write(char[] buffer, int index, int count)\r\n        {\r\n            _implementation.Implementation.Write(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a boolean to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Boolean value to write.</param>\r\n        public override void Write(bool value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an integer to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Integer value to write.</param>\r\n        public override void Write(int value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an unsigned integer to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Unsigned integer value to write</param>\r\n        public override void Write(uint value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a long to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Long value to write.</param>\r\n        public override void Write(long value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an unsigned long to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Unsigned long value to write.</param>\r\n        public override void Write(ulong value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a float to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Float value to write.</param>\r\n        public override void Write(float value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a double to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Double value to write.</param>\r\n        public override void Write(double value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a decimal to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Decimal value to write.</param>\r\n        public override void Write(decimal value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Write an object to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Object value to write.</param>\r\n        public override void Write(object value)\r\n        {\r\n            _implementation.Implementation.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a line break to the stream.\r\n        /// </summary>\r\n        public override void WriteLine()\r\n        {\r\n            _implementation.Implementation.WriteLine();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">String value to write.</param>\r\n        public override void WriteLine(string value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        public override void WriteLine(string format, object arg0)\r\n        {\r\n            _implementation.Implementation.WriteLine(format, arg0);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        /// <param name=\"arg1\">String format argument.</param>\r\n        public override void WriteLine(string format, object arg0, object arg1)\r\n        {\r\n            _implementation.Implementation.WriteLine(format, arg0, arg1);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        /// <param name=\"arg1\">String format argument.</param>\r\n        /// <param name=\"arg2\">String format argument.</param>\r\n        public override void WriteLine(string format, object arg0, object arg1, object arg2)\r\n        {\r\n            _implementation.Implementation.WriteLine(format, arg0, arg1, arg2);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg\">String format arguments.</param>\r\n        public override void WriteLine(string format, params object[] arg)\r\n        {\r\n            _implementation.Implementation.WriteLine(format, arg);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Char value to write.</param>\r\n        public override void WriteLine(char value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char array with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Char array to write.</param>\r\n        public override void WriteLine(char[] buffer)\r\n        {\r\n            _implementation.Implementation.WriteLine(buffer);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char array with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Char array to write.</param>\r\n        /// <param name=\"index\">Index in the char array to start writing from.</param>\r\n        /// <param name=\"count\">Number of chars to write.</param>\r\n        public override void WriteLine(char[] buffer, int index, int count)\r\n        {\r\n            _implementation.Implementation.WriteLine(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a bool with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Bool value to write.</param>\r\n        public override void WriteLine(bool value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an integer with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Integer value to write.</param>\r\n        public override void WriteLine(int value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an unsigned integer with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Unsigned integer to write.</param>\r\n        public override void WriteLine(uint value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a long with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Long value to write.</param>\r\n        public override void WriteLine(long value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an unsigned long with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Unsigned long value to write.</param>\r\n        public override void WriteLine(ulong value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a float with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Float value to write.</param>\r\n        public override void WriteLine(float value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a double with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Double value to write.</param>\r\n        public override void WriteLine(double value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a decimal with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Decimal value to write.</param>\r\n        public override void WriteLine(decimal value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an object with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Object value to write.</param>\r\n        public override void WriteLine(object value)\r\n        {\r\n            _implementation.Implementation.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the line break value.\r\n        /// </summary>\r\n        public override string NewLine\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.NewLine;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.NewLine = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the format provider used.\r\n        /// </summary>\r\n        public override IFormatProvider FormatProvider\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.FormatProvider;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Flushes the stream.\r\n        /// </summary>\r\n        public override void Flush()\r\n        {\r\n            _implementation.Implementation.Flush();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets whether the stream is auto flushed or not\r\n        /// </summary>\r\n        public virtual bool AutoFlush\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.AutoFlush;\r\n            }\r\n            set\r\n            {\r\n                _implementation.Implementation.AutoFlush = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Closes the stream.\r\n        /// </summary>\r\n        public override void Close()\r\n        {\r\n            _implementation.Implementation.Close();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The base streawm.\r\n        /// </summary>\r\n        public virtual Stream BaseStream\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.BaseStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the encoding used.\r\n        /// </summary>\r\n        public override Encoding Encoding\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Implementation.Encoding;\r\n            }\r\n        }\r\n\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <summary>\r\n        /// Desctructor.\r\n        /// </summary>\r\n        ~C1StreamWriter()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n        /// <summary>\r\n        /// Disposes the stream.\r\n        /// </summary>\r\n        /// <param name=\"disposing\">True if the stream is disposing.</param>\r\n        protected override void Dispose(bool disposing)\r\n        {\r\n            if (disposing)\r\n            {\r\n                _implementation.DisposeImplementation();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/C1WaitForChangedResult.cs",
    "content": "﻿using System.IO;\r\nusing System.Runtime.InteropServices;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// This class is a almost one to one version of System.IO.WaitForChangedResult. Using this implementation instead \r\n    /// of System.IO.WaitForChangedResult, will ensure that your code will work both on Standard Windows deployment \r\n    /// and Windows Azure deployment.\r\n    /// See System.IO.WaitForChangedResult for more documentation on the methods of this class.\r\n    /// Used by <see cref=\"C1FileSystemWatcher\"/>\r\n    /// </summary>\r\n    [StructLayout(LayoutKind.Sequential)]\r\n    public struct C1WaitForChangedResult\r\n    {\r\n        /// <summary>\r\n        /// Gets or sets the name of the changed file system item.\r\n        /// </summary>\r\n        public string Name { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the old name of the changed file system item.\r\n        /// </summary>\r\n        public string OldName { get; set; }\r\n\r\n        \r\n        /// <summary>\r\n        /// Gets or sets the type of the change.\r\n        /// </summary>\r\n        public WatcherChangeTypes ChangeType { get; set; }\r\n\r\n        \r\n        /// <summary>\r\n        /// Gets or sets whether the operation timed out.\r\n        /// </summary>\r\n        public bool TimedOut { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/DirectoryUtils.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.Core.Logging;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DirectoryUtils\r\n    {\r\n        /// <summary>\r\n        /// Ensures that the directories in the path exists and if they dont they will be created\r\n        /// </summary>\r\n        public static void EnsurePath(string filePath)\r\n        {\r\n            string directory = Path.GetDirectoryName(filePath);\r\n\r\n            EnsureDirectoryExists(directory);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Ensures that the directory exists \r\n        /// </summary>\r\n        public static void EnsureDirectoryExists(string directory)\r\n        {\r\n            string[] directories = directory.Split(Path.DirectorySeparatorChar);\r\n\r\n            if (directories.Length == 2) return;\r\n\r\n            string currentPath = string.Format(\"{0}{1}\", directories[0], Path.DirectorySeparatorChar);\r\n\r\n            for (int i = 1; i < directories.Length; ++i)\r\n            {\r\n                currentPath = string.Format(\"{0}{1}{2}\", currentPath, directories[i], Path.DirectorySeparatorChar);\r\n\r\n                if (currentPath.StartsWith(PathUtil.BaseDirectory, StringComparison.InvariantCultureIgnoreCase)) // don't touch dirs outside our own folder!\r\n                {\r\n                    if (C1Directory.Exists(currentPath) == false)\r\n                    {\r\n                        C1Directory.CreateDirectory(currentPath);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Delete a file. If the deleteEmptyDirectoresRecursively is true all empty directories\r\n        /// from buttom up are also deleted.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"deleteEmptyDirectoresRecursively\"></param>\r\n        public static void DeleteFile(string path, bool deleteEmptyDirectoresRecursively)\r\n        {\r\n            LoggingService.LogVerbose(\"DirectoryUtil\", string.Format(\"Deleting file '{0}'\", path));\r\n            C1File.Delete(path);\r\n\r\n            if (deleteEmptyDirectoresRecursively)\r\n            {\r\n                string directory = Path.GetDirectoryName(path);\r\n\r\n                string[] directories = directory.Split(Path.DirectorySeparatorChar);\r\n\r\n                for (int i = directories.Length; i > 1; --i)\r\n                {\r\n                    StringBuilder stringBuilder = new StringBuilder();\r\n\r\n                    for (int j = 0; j < i; ++j)\r\n                    {\r\n                        stringBuilder.Append(directories[j]);\r\n                        stringBuilder.Append(Path.DirectorySeparatorChar);\r\n                    }\r\n\r\n                    string currentPath = stringBuilder.ToString();\r\n                    if (C1Directory.GetFiles(currentPath).Length == 0)\r\n                    {\r\n                        LoggingService.LogVerbose(\"DirectoryUtil\", string.Format(\"Deleting directory '{0}'\", currentPath));\r\n                        C1Directory.Delete(currentPath);\r\n                    }\r\n                    else\r\n                    {\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes all files recursively leaving all sub directories.\r\n        /// </summary>\r\n        /// <param name=\"directoryPath\"></param>\r\n        public static void DeleteFilesRecursively(string directoryPath)\r\n        {\r\n            foreach (string file in C1Directory.GetFiles(directoryPath))\r\n            {\r\n                C1File.Delete(file);\r\n            }\r\n\r\n            foreach (string directory in C1Directory.GetDirectories(directoryPath))\r\n            {\r\n                DeleteFilesRecursively(directory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveReadOnlyRecursively(string directoryPath)\r\n        {\r\n            foreach (string file in C1Directory.GetFiles(directoryPath))\r\n            {\r\n                FileUtils.RemoveReadOnly(file);\r\n            }\r\n\r\n\r\n            foreach (string directory in C1Directory.GetDirectories(directoryPath))\r\n            {\r\n                RemoveReadOnlyRecursively(directory);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetFilesRecursively(string path)\r\n        {\r\n            foreach (string filePath in Directory.GetFiles(path))\r\n            {\r\n                yield return filePath;\r\n            }\r\n\r\n            foreach (string subPath in Directory.GetDirectories(path))\r\n            {\r\n                foreach (string filePath in GetFilesRecursively(subPath))\r\n                {\r\n                    yield return filePath;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/FileUtils.cs",
    "content": "﻿using System.IO;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class FileUtils\r\n    {\r\n        /// <exclude />\r\n        public static bool RemoveReadOnly(string filePath)\r\n        {\r\n            if (C1File.Exists(filePath) == false) return false;\r\n\r\n            FileAttributes fileAttributes = C1File.GetAttributes(filePath);\r\n\r\n            if ((fileAttributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)\r\n            {\r\n                fileAttributes ^= FileAttributes.ReadOnly;\r\n                C1File.SetAttributes(filePath, fileAttributes);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void Delete(string filePath)\r\n        {\r\n            if (C1File.Exists(filePath))\r\n            {\r\n                RemoveReadOnly(filePath);\r\n                C1File.Delete(filePath);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Foundation/PluginFacades/IOProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\nusing Composite.Core.IO.Plugins.IOProvider.Runtime;\r\nusing Composite.Plugins.IO.IOProviders.LocalIOProvider;\r\n\r\n\r\nnamespace Composite.Core.IO.Foundation.PluginFacades\r\n{\r\n    internal static class IOProviderPluginFacade\r\n    {\r\n        private static IOProviderFactory _factory;\r\n        private static IIOProvider _ioProvider;\r\n        private static readonly object _lock = new object();\r\n\r\n\r\n        static IOProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IC1Directory C1Directory\r\n        {\r\n            get\r\n            {\r\n                IIOProvider ioProvider = GetIOProvider();\r\n\r\n                return ioProvider.C1Directory;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IC1File C1File\r\n        {\r\n            get\r\n            {\r\n                IIOProvider ioProvider = GetIOProvider();\r\n\r\n                return ioProvider.C1File;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IC1FileInfo CreateFileInfo(string path)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateFileInfo(path);\r\n        }\r\n\r\n\r\n\r\n        public static IC1DirectoryInfo CreateDirectoryInfo(string path)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateDirectoryInfo(path);\r\n        }\r\n\r\n\r\n\r\n        public static IC1FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateFileStream(path, mode, access, share, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        public static IC1FileSystemWatcher CreateFileSystemWatcher(string path, string filter)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateFileSystemWatcher(path, filter);\r\n        }\r\n\r\n\r\n\r\n        public static IC1StreamReader CreateStreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateStreamReader(path, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public static IC1StreamReader CreateStreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateStreamReader(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public static IC1StreamWriter CreateStreamWriter(string path, bool append, Encoding encoding, int bufferSize)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateStreamWriter(path, append, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public static IC1StreamWriter CreateStreamWriter(Stream stream, Encoding encoding, int bufferSize)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateStreamWriter(stream, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public static IC1Configuration CreateConfiguration(string path)\r\n        {\r\n            IIOProvider ioProvider = GetIOProvider();\r\n\r\n            return ioProvider.CreateConfiguration(path);\r\n        }\r\n\r\n\r\n\r\n        private static IIOProvider GetIOProvider()\r\n        {\r\n            if (_ioProvider == null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (RuntimeInformation.IsUnittest)\r\n                    {\r\n                        return _ioProvider = new LocalIOProvider();\r\n                    }\r\n\r\n                    if (_ioProvider == null)\r\n                    {\r\n                        try\r\n                        {\r\n                            _factory = new IOProviderFactory();\r\n                            _ioProvider = _factory.CreateDefault();\r\n                        }\r\n                        catch (ArgumentException ex)\r\n                        {\r\n                            HandleConfigurationError(ex);\r\n                        }\r\n                        catch (ConfigurationErrorsException ex)\r\n                        {\r\n                            HandleConfigurationError(ex);\r\n                        }\r\n\r\n                    }\r\n                }\r\n            }\r\n\r\n            return _ioProvider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _factory = null;\r\n            _ioProvider = null;\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", IOProviderSettings.SectionName), ex);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/IOFacade.cs",
    "content": "﻿using System.IO;\r\nusing System.Text;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\nusing Composite.Plugins.IO.IOProviders.LocalIOProvider;\r\nusing Composite.Core.IO.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    internal static class IOFacade\r\n    {\r\n        public static IC1Directory C1Directory\r\n        {\r\n            get\r\n            {\r\n                return IOProviderPluginFacade.C1Directory;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IC1File C1File\r\n        {\r\n            get\r\n            {\r\n                return IOProviderPluginFacade.C1File;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IC1FileInfo CreateC1FileInfo(string path)\r\n        {\r\n            return IOProviderPluginFacade.CreateFileInfo(path);\r\n        }\r\n\r\n\r\n\r\n        public static IC1DirectoryInfo CreateC1DirectoryInfo(string path)\r\n        {\r\n            return IOProviderPluginFacade.CreateDirectoryInfo(path);\r\n        }\r\n\r\n\r\n\r\n        public static IC1FileStream CreateC1FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)\r\n        {\r\n            return IOProviderPluginFacade.CreateFileStream(path, mode, access, share, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        public static IC1FileSystemWatcher CreateC1FileSystemWatcher(string path, string filter)\r\n        {\r\n            return IOProviderPluginFacade.CreateFileSystemWatcher(path, filter);\r\n        }\r\n\r\n\r\n\r\n        public static IC1StreamReader CreateC1StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            return IOProviderPluginFacade.CreateStreamReader(path, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public static IC1StreamReader CreateC1StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            return IOProviderPluginFacade.CreateStreamReader(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public static IC1StreamWriter CreateC1StreamWriter(string path, bool append, Encoding encoding, int bufferSize)\r\n        {\r\n            return IOProviderPluginFacade.CreateStreamWriter(path, append, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public static IC1StreamWriter CreateC1StreamWriter(Stream stream, Encoding encoding, int bufferSize)\r\n        {\r\n            return IOProviderPluginFacade.CreateStreamWriter(stream, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public static IC1Configuration CreateC1Configuration(string path)\r\n        {\r\n            return IOProviderPluginFacade.CreateConfiguration(path);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/MimeTypeInfo.cs",
    "content": "using System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.Web;\r\nusing System.Web.Configuration;\r\nusing System.Web.Hosting;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class MimeTypeInfo\r\n    {\r\n        private static readonly string LogTitle = typeof (MimeTypeInfo).Name;\r\n\r\n        private static readonly IDictionary<string, string> _toCanonical = new Dictionary<string, string>();\r\n        private static readonly IDictionary<string, string> _extensionToCanonical = new Dictionary<string, string>();\r\n        private static readonly IDictionary<string, string> _mimeTypeToResourceName = new Dictionary<string, string>();\r\n        private static readonly IDictionary<string, string> _mimeTypeToExtension = new Dictionary<string, string>();\r\n        private static readonly ConcurrentDictionary<string, bool> _iisServeableExtensions = new ConcurrentDictionary<string, bool>();\r\n\r\n        private static List<string> _textMimeTypes =\r\n            new List<string> { MimeTypeInfo.Css, MimeTypeInfo.Js, MimeTypeInfo.Json, MimeTypeInfo.Xml, MimeTypeInfo.Text, MimeTypeInfo.Html, MimeTypeInfo.Sass,\r\n                               MimeTypeInfo.Ascx, MimeTypeInfo.Ashx, MimeTypeInfo.Asmx, MimeTypeInfo.Aspx, MimeTypeInfo.Asax, MimeTypeInfo.CSharp, \r\n                               MimeTypeInfo.Resx, MimeTypeInfo.MasterPage, MimeTypeInfo.CsHtml, MimeTypeInfo.Svg };\r\n\r\n        // file types we don't expect IIS to block\r\n        private static readonly HashSet<string> _iisServeableTypes = new HashSet<string>();\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string Default => \"application/octet-stream\";\r\n\r\n        /// <exclude />\r\n        public static string Jpeg => \"image/jpeg\";\r\n\r\n        /// <exclude />\r\n        public static string Gif => \"image/gif\";\r\n\r\n        /// <exclude />\r\n        public static string Bmp => \"image/bmp\";\r\n\r\n        /// <exclude />\r\n        public static string Png => \"image/png\";\r\n\r\n        /// <exclude />\r\n        public static string Tiff => \"image/tiff\";\r\n\r\n        /// <exclude />\r\n        public static string Css => \"text/css\";\r\n\r\n        /// <exclude />\r\n        public static string Sass => \"text/x-sass\";\r\n\r\n        /// <exclude />\r\n        public static string Js => \"text/js\";\r\n\r\n        /// <exclude />\r\n        public static string Json => \"application/json\";\r\n\r\n        /// <exclude />\r\n        public static string Xml => \"text/xml\";\r\n\r\n        /// <exclude />\r\n        public static string Text => \"text/plain\";\r\n\r\n        /// <exclude />\r\n        public static string Html => \"text/html\";\r\n\r\n        /// <exclude />\r\n        public static string Flash => \"application/x-shockwave-flash\";\r\n\r\n        /// <exclude />\r\n        public static string QuickTime => \"video/quicktime\";\r\n\r\n        /// <exclude />\r\n        public static string Pdf = \"application/pdf\";\r\n\r\n        /// <exclude />\r\n        public static string Wmv => \"video/x-ms-wmv\";\r\n\r\n        /// <exclude />\r\n        public static string Asf => \"video/x-ms-asf\";\r\n\r\n        /// <exclude />\r\n        public static string Avi => \"video/x-msvideo\";\r\n\r\n        /// <exclude />\r\n        public static string Flv => \"video/x-flv\";\r\n\r\n        /// <exclude />\r\n        public static string Director => \"application/x-director\";\r\n\r\n        /// <exclude />\r\n        public static string CSharp => \"text/x-csharp\";\r\n\r\n        /// <exclude />\r\n        public static string CsHtml => \"application/x-cshtml\";\r\n\r\n        /// <exclude />\r\n        public static string Svg => \"image/svg+xml\";\r\n\r\n        /// <exclude />\r\n        public static string Ascx => \"application/x-ascx\";\r\n\r\n        /// <exclude />\r\n        public static string Aspx => \"application/x-aspx\";\r\n\r\n        /// <exclude />\r\n        public static string Asax => \"application/x-asax\";\r\n\r\n        /// <exclude />\r\n        public static string Ashx => \"application/x-ashx\";\r\n\r\n        /// <exclude />\r\n        public static string Asmx => \"application/x-asmx\";\r\n\r\n        /// <exclude />\r\n        public static string Resx => \"application/x-resx\";\r\n\r\n        /// <exclude />\r\n        public static string MasterPage => \"application/x-master-page\";\r\n\r\n\r\n        /// <exclude />\r\n        static MimeTypeInfo()\r\n        {\r\n            LoadExtensionMappingsFromWebConfig();\r\n\r\n            // Image formats\r\n            _toCanonical.Add(\"image/pjpg\", Jpeg);\r\n            _toCanonical.Add(\"image/pjpeg\", Jpeg);\r\n            _toCanonical.Add(\"image/jpg\", Jpeg);\r\n            RegisterMimeType(MimeTypeInfo.Jpeg, new [] {\"jpg\", \"jpe\", \"jpeg\"}, \"mimetype-jpeg\", true);\r\n\r\n            RegisterMimeType(MimeTypeInfo.Gif, \"gif\", \"mimetype-gif\", true);\r\n            RegisterMimeType(MimeTypeInfo.Bmp, \"bmp\", \"mimetype-bmp\", true);\r\n\r\n            _toCanonical.Add(\"image/x-png\", Png);\r\n            RegisterMimeType(MimeTypeInfo.Png, \"png\", \"mimetype-png\", true);\r\n\r\n            RegisterMimeType(MimeTypeInfo.Svg, \"svg\", \"mimetype-svg\", true);\r\n\r\n            _toCanonical.Add(\"image/tif\", MimeTypeInfo.Tiff);\r\n            RegisterMimeType(MimeTypeInfo.Tiff, \"tif\", \"mimetype-tiff\", true);\r\n\r\n            // Web\r\n            RegisterMimeType(MimeTypeInfo.Css, new[] { \"css\", \"less\" }, \"mimetype-css\", true);\r\n            RegisterMimeType(MimeTypeInfo.Sass, new[] { \"scss\" }, \"mimetype-css\", true);\r\n            RegisterMimeType(MimeTypeInfo.Resx, \"resx\", \"mimetype-resx\");\r\n\r\n            _toCanonical.Add(\"application/x-javascript\", MimeTypeInfo.Js);\r\n            RegisterMimeType(MimeTypeInfo.Js, \"js\", \"mimetype-js\", true);\r\n\r\n            RegisterMimeType(MimeTypeInfo.Json, new[] { \"json\" }, \"mimetype-js\");\r\n            RegisterMimeType(MimeTypeInfo.Html, new[] { \"htm\", \"html\", \"xhtml\" }, \"mimetype-html\", true);\r\n\r\n            // Audio/Video\r\n            RegisterMimeType(\"audio/x-wav\", \"wav\", null, true);\r\n            RegisterMimeType(\"audio/x-pn-realaudio\", new[] { \"ram\", \"rm\" }, \"mimetype-ram\", true);\r\n            RegisterMimeType(\"audio/mpeg\", \"mp3\", \"mimetype-mp3\", true);\r\n            RegisterMimeType(\"video/mpeg\", new[] { \"mpeg\", \"mpg\" }, \"mimetype-mpeg\", true);\r\n            RegisterMimeType(MimeTypeInfo.Flv, \"flv\", null, true);\r\n            RegisterMimeType(MimeTypeInfo.Asf, \"asf\", \"mimetype-asf\", true);\r\n            RegisterMimeType(MimeTypeInfo.Avi, \"avi\", \"mimetype-movie\", true);\r\n            RegisterMimeType(MimeTypeInfo.Wmv, \"wmv\", \"mimetype-wmv\", true);\r\n\r\n            // Applications\r\n            RegisterMimeType(\"application/postscript\", \"eps\", \"mimetype-pps\", true);\r\n            RegisterMimeType(\"application/msaccess\", \"mdb\", \"mimetype-mdb\", true);\r\n            RegisterMimeType(Pdf, \"pdf\", \"mimetype-pdf\", true);\r\n            RegisterMimeType(\"application/vnd.ms-powerpoint\", \"ppt\", \"mimetype-ppt\", true);\r\n            RegisterMimeType(\"application/vnd.openxmlformats-officedocument.presentationml.presentation\", \"pptx\", \"mimetype-ppt\", true);\r\n            RegisterMimeType(\"application/msword\", \"doc\", \"mimetype-doc\", true);\r\n            RegisterMimeType(\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\", \"docx\", \"mimetype-doc\", true);\r\n            RegisterMimeType(\"application/rtf\", \"rtf\", \"mimetype-rtf\", true);\r\n            RegisterMimeType(\"application/vnd.visio\", \"vsd\", \"mimetype-vsd\", true);\r\n            RegisterMimeType(\"application/x-font-woff\", \"woff\");\r\n            RegisterMimeType(\"application/vnd.ms-excel\", \"xls\", \"mimetype-xls\", true);\r\n            RegisterMimeType(\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\", \"xlsx\", \"mimetype-xls\", true);\r\n\r\n            RegisterMimeType(MimeTypeInfo.QuickTime, \"mov\", \"mimetype-mov\", true);\r\n            RegisterMimeType(MimeTypeInfo.Flash, \"swf\", \"mimetype-swf\", true);\r\n            RegisterMimeType(MimeTypeInfo.Director, new[] { \"dcr\", \"dir\" }, \"mimetype-dir\");\r\n\r\n            RegisterMimeType(\"text/xml\", new[] { \"xml\", \"config\", \"xsl\", \"xslt\" }, \"mimetype-xml\");\r\n\r\n            const string mimeTypeZip = \"application/zip\";\r\n            _toCanonical.Add(\"application/x-zip-compressed\", mimeTypeZip);\r\n            RegisterMimeType(mimeTypeZip, \"zip\", \"mimetype-zip\", true);\r\n\r\n            \r\n            _toCanonical.Add(\"text/txt\", \"text/plain\");\r\n            _toCanonical.Add(\"text/text\", \"text/plain\");\r\n            RegisterMimeType(\"text/plain\", \"txt\", \"mimetype-txt\", true);\r\n\r\n\r\n            // .Cs and asp.net files\r\n            RegisterMimeType(MimeTypeInfo.Ascx, \"ascx\", \"mimetype-ascx\");\r\n            RegisterMimeType(MimeTypeInfo.Aspx, \"aspx\", \"mimetype-aspx\");\r\n            RegisterMimeType(MimeTypeInfo.Asax, \"asax\", \"mimetype-asax\");\r\n            RegisterMimeType(MimeTypeInfo.Ashx, \"ashx\");\r\n            RegisterMimeType(MimeTypeInfo.Asmx, \"asmx\");\r\n            RegisterMimeType(MimeTypeInfo.MasterPage, \"master\");\r\n\r\n            RegisterMimeType(MimeTypeInfo.CSharp, \"cs\");\r\n            RegisterMimeType(MimeTypeInfo.CsHtml, \"cshtml\", \"mimetype-cshtml\");\r\n\r\n            \r\n            \r\n            AddExtensionMapping(\"mp4\", \"video/mp4\");\r\n            AddExtensionMapping(\"ogg\", \"audio/ogg\");\r\n            AddExtensionMapping(\"ogv\", \"video/ogg\");\r\n            AddExtensionMapping(\"webm\", \"video/webm\");\r\n            AddExtensionMapping(\"svg\", \"image/svg+xml\");\r\n            AddExtensionMapping(\"svgz\", \"image/svg+xml\");\r\n            AddExtensionMapping(\"flv4\", \"video/mp4\");\r\n            AddExtensionMapping(\"eot\", \"application/vnd.ms-fontobject\");\r\n        }\r\n\r\n        private static void RegisterMimeType(string canonicalMimeTypeName, string extension, string resourceName = null, bool iisServable = false)\r\n        {\r\n            RegisterMimeType(canonicalMimeTypeName, new [] { extension }, resourceName, iisServable);\r\n        }\r\n\r\n        private static void RegisterMimeType(string canonicalMimeTypeName, string[] extensions, string resourceName, bool iisServable = false)\r\n        {\r\n            _toCanonical.Add(canonicalMimeTypeName, canonicalMimeTypeName);\r\n\r\n            foreach(string extension in extensions)\r\n            {\r\n                AddExtensionMapping(extension, canonicalMimeTypeName);\r\n            }\r\n\r\n            if(resourceName != null)\r\n            {\r\n                _mimeTypeToResourceName.Add(canonicalMimeTypeName, resourceName);\r\n            }\r\n\r\n            if (iisServable)\r\n            {\r\n                _iisServeableTypes.Add(canonicalMimeTypeName);\r\n            }\r\n        }\r\n\r\n        private static bool AddExtensionMapping(string extension, string mimeType)\r\n        {\r\n            _mimeTypeToExtension[mimeType] = extension;\r\n\r\n            if (!_extensionToCanonical.ContainsKey(extension))\r\n            {\r\n                _extensionToCanonical.Add(extension, mimeType);\r\n                return true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\")]\r\n        private static void LoadExtensionMappingsFromWebConfig()\r\n\t    {\r\n            ConfigurationSection config;\r\n            try\r\n            {\r\n                config = WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath).GetSection(\"system.webServer\");\r\n            }\r\n            catch\r\n\t        {\r\n                // Silent\r\n                return;\r\n\t        }\r\n\r\n            var configRawXml = config?.SectionInformation.GetRawXml();\r\n            if (configRawXml == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            XElement webServerConfig = XElement.Parse(configRawXml);\r\n            XElement staticContentConfig = webServerConfig.Element(\"staticContent\");\r\n            if(staticContentConfig == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            foreach(XElement mimeMapping in staticContentConfig.Elements(\"mimeMap\"))\r\n            {\r\n                string extension = mimeMapping.Attribute(\"fileExtension\").Value.ToLowerInvariant();\r\n                string mimeType = mimeMapping.Attribute(\"mimeType\").Value;\r\n\r\n                if(extension.StartsWith(\".\"))\r\n                {\r\n                    extension = extension.Substring(1);\r\n                }\r\n\r\n                if (!AddExtensionMapping(extension, mimeType))\r\n                {\r\n                    Log.LogWarning(typeof(MimeTypeInfo).Name, \"MimeType for extension '{0}' has already been defined\", extension);\r\n                }\r\n                else\r\n\t            {\r\n                    _iisServeableTypes.Add(mimeType);\r\n\t            }\r\n            }\r\n\t    }\r\n\r\n        /// <exclude />\r\n        public static string GetCanonical(string mimeType)\r\n        {\r\n            if (string.IsNullOrEmpty(mimeType))\r\n            {\r\n                return MimeTypeInfo.Default;\r\n            }\r\n\r\n            mimeType = mimeType.ToLowerInvariant();\r\n\r\n            if (_toCanonical.ContainsKey(mimeType))\r\n            {\r\n                return _toCanonical[mimeType];\r\n            }\r\n\r\n            return mimeType;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle GetResourceHandleFromMimeType(string mimeType)\r\n        {\r\n            if (mimeType != null && _mimeTypeToResourceName.ContainsKey(mimeType))\r\n            {\r\n                return GetIconHandle(_mimeTypeToResourceName[mimeType]);\r\n            }\r\n            return GetIconHandle(\"mimetype-unknown\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetExtensionFromMimeType(string mimeType)\r\n        {\r\n            return _mimeTypeToExtension.TryGetValue(mimeType, out string extension) ? extension : null;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetCanonicalFromExtension(string extension)\r\n        {\r\n            if (extension == null)\r\n            {\r\n                return MimeTypeInfo.Default;\r\n            }\r\n\r\n            extension = extension.ToLowerInvariant();\r\n\r\n            if (extension.StartsWith(\".\"))\r\n            {\r\n                extension = extension.Substring(1);\r\n            }\r\n\r\n            string mimeType;\r\n            if (_extensionToCanonical.TryGetValue(extension, out mimeType))\r\n            {\r\n                return mimeType;\r\n            }\r\n\r\n            string fileName = \"filename.\" + extension;\r\n            return MimeMapping.GetMimeMapping(fileName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetMimeType(UploadedFile uploadedFile)\r\n        {\r\n            string fileName = System.IO.Path.GetFileName(uploadedFile.FileName);\r\n\r\n            string mimeTypeFromExtension = GetCanonicalFromExtension(System.IO.Path.GetExtension(fileName));\r\n            if (mimeTypeFromExtension != MimeTypeInfo.Default)\r\n            {\r\n                Log.LogInformation(LogTitle, $\"Uploading file '{fileName}'. MIME type from extension: '{mimeTypeFromExtension}'\");\r\n\r\n                return mimeTypeFromExtension;\r\n            }\r\n            \r\n            string mimeTypeFromBrowser = GetCanonical(uploadedFile.ContentType);\r\n\r\n            // Default MIME type for Chrome is \"application/xml\"\r\n            // Default MIME type for IE is \"text/plain\"\r\n            // for the rest it is \"application/octet-stream\"\r\n            if (mimeTypeFromBrowser != \"application/xml\"\r\n                && mimeTypeFromBrowser != \"text/plain\")\r\n            {\r\n                Log.LogInformation(LogTitle, $\"Uploading file '{fileName}'. \" +\r\n                    $\"Browser provided MIME type: '{uploadedFile.ContentType}'. \" +\r\n                    $\"Canonical MIME type: '{mimeTypeFromBrowser}'\");\r\n\r\n                return mimeTypeFromBrowser;\r\n            }\r\n\r\n            Log.LogInformation(LogTitle, $\"Uploading file '{fileName}'. Applying default MIME type '{Default}'\");\r\n\r\n            return MimeTypeInfo.Default;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicates whether a file of a specific MIME type can be edited with a text editor\r\n        /// </summary>\r\n        /// <param name=\"mimeType\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsTextFile(string mimeType)\r\n        {\r\n            string canonicalMimeType = GetCanonical(mimeType);\r\n\r\n            return canonicalMimeType.StartsWith(\"text\") || _textMimeTypes.Contains(canonicalMimeType);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether a file of a given mime type can be previewed by browser in an iframe.\r\n        /// </summary>\r\n        /// <param name=\"mimeType\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsBrowserPreviewableFile(string mimeType)\r\n        {\r\n            return mimeType == Pdf\r\n                   || mimeType == Html\r\n                   || mimeType == Text;\r\n        }\r\n\r\n        internal static string TryGetLocalizedName(string mimeType)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"MimeTypes\", mimeType, false);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether a file of a specific extension is expected to be allowed by IIS\r\n        /// </summary>\r\n        /// <param name=\"extension\">The extension.</param>\r\n        /// <returns>\r\n        ///   <c>true</c> if the extension is 'IIS serveable'; otherwise, <c>false</c>.\r\n        /// </returns>\r\n        internal static bool IsIisServeable(string extension)\r\n        {\r\n            extension = extension.ToLowerInvariant();\r\n\r\n            if (extension.StartsWith(\".\"))\r\n            {\r\n                extension = extension.Substring(1);\r\n            }\r\n\r\n            return _iisServeableExtensions.GetOrAdd(extension, ext =>\r\n            {\r\n                string mimeType = GetCanonicalFromExtension(extension);\r\n                return _iisServeableTypes.Contains(mimeType);\r\n            });\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/PathUtil.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Security.AccessControl;\r\nusing System.Security.Principal;\r\nusing System.Text;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public static class PathUtil\r\n    {\r\n        private static readonly string _appBasePath;\r\n\r\n        /// <exclude />\r\n        static PathUtil()\r\n        {\r\n            if (HostingEnvironment.IsHosted)\r\n            {\r\n                _appBasePath = HostingEnvironment.ApplicationPhysicalPath;\r\n            }\r\n            else\r\n            {\r\n                _appBasePath = AppDomain.CurrentDomain.BaseDirectory;\r\n            }\r\n        }\r\n\r\n        \r\n        /// <summary>\r\n        /// Root directory of website \r\n        /// </summary>\r\n        /// <exclude />\r\n        public static string BaseDirectory\r\n        {\r\n            get\r\n            {\r\n                return _appBasePath;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Resolves a (tilde based) partial path to a full file system path. \r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public static string Resolve(string path)\r\n        {\r\n            if (String.IsNullOrEmpty(path)) throw new ArgumentNullException(\"path\");\r\n            if (path.StartsWith(\"~\"))\r\n            {\r\n                if (path == \"~\")\r\n                {\r\n                    return BaseDirectory;\r\n                }\r\n\r\n                string tildeLessPath = path.Remove(0, 1);\r\n                if (Path.IsPathRooted(tildeLessPath) == false) throw new ArgumentException(\"Tilde based paths must start with tilde (~) and then a directory separator , like ~/folder/file.txt\", \"path\");\r\n\r\n                string appRootRelativePath = tildeLessPath.Remove(0, 1);\r\n                if (Path.IsPathRooted(appRootRelativePath)) throw new ArgumentException(\"Invalid path\", \"path\");\r\n\r\n                appRootRelativePath = appRootRelativePath.Replace( '/', '\\\\' );\r\n\r\n                return Path.Combine(_appBasePath, appRootRelativePath);\r\n            }\r\n\r\n            if (Path.IsPathRooted(path) == false) throw new ArgumentException(\"Relative paths must start with tilde (~), like ~/folder/file.txt\", \"path\");\r\n\r\n            return path.Replace('/', '\\\\');\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string CleanFileName(string s)\r\n        {\r\n            return CleanFileName(s, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string CleanFileName(string s, bool allowUnicodeLetters)\r\n        {\r\n            var sb = new StringBuilder();\r\n\r\n            foreach (var c in s)\r\n            {\r\n                if (\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -_.1234567890\".IndexOf(c) > -1\r\n                    || (allowUnicodeLetters && Char.IsLetter(c)))\r\n                {\r\n                    sb.Append(c);\r\n                }\r\n            }\r\n\r\n            return sb.Length > 0 ? sb.ToString() : null;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetWebsitePath(string path)\r\n        {\r\n            string s = path.Remove(0, BaseDirectory.Length);\r\n            s = s.Replace('\\\\', '/');\r\n            if (s.StartsWith(\"'/'\") == false)\r\n            {\r\n                s = \"/\" + s;\r\n            }\r\n\r\n            return s;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether current Windows user has the NTFS write permission to a file or a folder\r\n        /// </summary>\r\n        /// <param name=\"fileOrDirectoryPath\">Path to a file or a folder</param>\r\n        /// <returns></returns>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public static bool WritePermissionGranted(string fileOrDirectoryPath)\r\n        {\r\n            try\r\n            {\r\n                AuthorizationRuleCollection rules;\r\n\r\n                if (C1File.Exists(fileOrDirectoryPath))\r\n                {\r\n                    FileSystemSecurity security = File.GetAccessControl(fileOrDirectoryPath);\r\n\r\n                    rules = security.GetAccessRules(true, true, typeof(NTAccount));\r\n                }\r\n                else if (C1Directory.Exists(fileOrDirectoryPath))\r\n                {\r\n                    DirectorySecurity security = Directory.GetAccessControl(fileOrDirectoryPath);\r\n\r\n                    rules = security.GetAccessRules(true, true, typeof(NTAccount));\r\n                }\r\n                else\r\n                {\r\n                    throw new FileNotFoundException(\"File or directory '{0}' does not exist\".FormatWith(fileOrDirectoryPath));\r\n                }\r\n\r\n                var currentuser = new WindowsPrincipal(WindowsIdentity.GetCurrent());\r\n                bool result = false;\r\n                foreach (FileSystemAccessRule rule in rules)\r\n                {\r\n                    if ((rule.FileSystemRights & (FileSystemRights.WriteData | FileSystemRights.Write)) == 0)\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    if (rule.IdentityReference.Value.StartsWith(\"S-1-\"))\r\n                    {\r\n                        var sid = new SecurityIdentifier(rule.IdentityReference.Value);\r\n                        if (!currentuser.IsInRole(sid))\r\n                        {\r\n                            continue;\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        if (!currentuser.IsInRole(rule.IdentityReference.Value))\r\n                        {\r\n                            continue;\r\n                        }\r\n                    }\r\n\r\n                    if (rule.AccessControlType == AccessControlType.Deny)\r\n                        return false;\r\n                    if (rule.AccessControlType == AccessControlType.Allow)\r\n                        result = true;\r\n                }\r\n                return result;\r\n            }\r\n            catch\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1Configuration.cs",
    "content": "﻿using System.Configuration;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n    /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/> for more information.\r\n    public interface IC1Configuration\r\n    {\r\n        /// <summary>\r\n        /// Gets the path to the configuration file.\r\n        /// </summary>\r\n        string FilePath { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the configuration file exists.\r\n        /// </summary>\r\n        bool HasFile { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the app setttings section.\r\n        /// </summary>\r\n        AppSettingsSection AppSettings { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the connection string section.\r\n        /// </summary>\r\n        ConnectionStringsSection ConnectionStrings { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the configuration sections.\r\n        /// </summary>\r\n        ConfigurationSectionCollection Sections { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the configuration section group.\r\n        /// </summary>\r\n        ConfigurationSectionGroup RootSectionGroup { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the configuration slection groups.\r\n        /// </summary>\r\n        ConfigurationSectionGroupCollection SectionGroups { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a named configuration section.\r\n        /// </summary>\r\n        /// <param name=\"sectionName\">Name of section to get.</param>\r\n        /// <returns>Returns the configuration section.</returns>\r\n        ConfigurationSection GetSection(string sectionName);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a named configuration section group.\r\n        /// </summary>\r\n        /// <param name=\"sectionGroupName\">Name of configuration section group to get.</param>\r\n        /// <returns>Returns the configuration section group.</returns>\r\n        ConfigurationSectionGroup GetSectionGroup(string sectionGroupName);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration.\r\n        /// </summary>\r\n        void Save();\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration.\r\n        /// </summary>\r\n        /// <param name=\"saveMode\">Save mode to use when saving the configuration.</param>\r\n        void Save(ConfigurationSaveMode saveMode);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration.\r\n        /// </summary>\r\n        /// <param name=\"saveMode\">Save mode to use when saving the configuration.</param>\r\n        /// <param name=\"forceSaveAll\">Saves all sections, even non touched.</param>\r\n        void Save(ConfigurationSaveMode saveMode, bool forceSaveAll);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration to a new file.\r\n        /// </summary>\r\n        /// <param name=\"filename\">Path to new configuration filename.</param>\r\n        void SaveAs(string filename);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration to a new file.\r\n        /// </summary>\r\n        /// <param name=\"filename\">Path to new configuration filename.</param>\r\n        /// <param name=\"saveMode\">Save mode to use when saving the configuration.</param>\r\n        void SaveAs(string filename, ConfigurationSaveMode saveMode);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Saves the configuration to a new file.\r\n        /// </summary>\r\n        /// <param name=\"filename\">Path to new configuration filename.</param>\r\n        /// <param name=\"saveMode\">Save mode to use when saving the configuration.</param>\r\n        /// <param name=\"forceSaveAll\">Saves all sections, even non touched.</param>\r\n        void SaveAs(string filename, ConfigurationSaveMode saveMode, bool forceSaveAll);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1Directory.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n    /// See <see cref=\"Composite.Core.IO.C1Directory\"/> for more information.\r\n    /// </summary>\r\n    public interface IC1Directory\r\n    {\r\n        /// <summary>\r\n        /// Creates a directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to create.</param>\r\n        /// <returns>Returns a C1DirectoryInfo to the specified path.</returns>\r\n        C1DirectoryInfo CreateDirectory(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes an empty directory on the given path.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of empty directory to delete.</param>\r\n        void Delete(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the directory and if specified subdirectories and file on the given path.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory to delete.</param>\r\n        /// <param name=\"recursive\">Include subdirectories and files.</param>\r\n        void Delete(string path, bool recursive);\r\n\r\n\r\n        /// <summary>\r\n        /// Moves a file or directory from the given source path to the given destination path.\r\n        /// </summary>\r\n        /// <param name=\"sourceDirName\">Path of file or directory to move.</param>\r\n        /// <param name=\"destDirName\">Target path of file or directory to be moved to.</param>\r\n        void Move(string sourceDirName, string destDirName);\r\n\r\n\r\n        /// <summary>\r\n        /// Determines if the directory in the given path exists or not.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to test.</param>\r\n        /// <returns></returns>\r\n        bool Exists(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the current directory.\r\n        /// </summary>\r\n        /// <returns>The current directory.</returns>\r\n        string GetCurrentDirectory();\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the current directory\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to new current directory.</param>\r\n        void SetCurrentDirectory(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the parent of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory to get parent of.</param>\r\n        /// <returns>The parent of the given directory.</returns>\r\n        C1DirectoryInfo GetParent(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns volume and/or root information of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory to get root information of.</param>\r\n        /// <returns>Volume and/or root information.</returns>\r\n        string GetDirectoryRoot(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the subdirectories of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to get subdirectories.</param>\r\n        /// <returns>Subdirectories of the given directory.</returns>\r\n        string[] GetDirectories(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the subdirectories of the given directory with the given search pattern.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to get subdirectories.</param>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <returns>Subdirectories of the given directory with the given search parrern.</returns>\r\n        string[] GetDirectories(string path, string searchPattern);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the subdirectories of the given directory with the given search pattern and options.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to get subdirectories.</param>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <param name=\"searchOption\">Search options to use.</param>\r\n        /// <returns>Subdirectories of the given directory with the given search parrern and options.</returns>\r\n        string[] GetDirectories(string path, string searchPattern, SearchOption searchOption);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the files in the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory go get files from.</param>\r\n        /// <returns>Files in the given directory.</returns>\r\n        string[] GetFiles(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the files in the given directory with the given search pattern.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory go get files from.</param>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <returns>Files in the given directory with the given search pattern.</returns>\r\n        string[] GetFiles(string path, string searchPattern);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the files in the given directory with the given search pattern and options.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory go get files from.</param>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <param name=\"searchOption\">Search options to use.</param>\r\n        /// <returns>Files in the given directory with the given search pattern and options.</returns>\r\n        string[] GetFiles(string path, string searchPattern, SearchOption searchOption);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the creation date and time of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory.</param>\r\n        /// <returns>Creation date and time of the given directory.</returns>\r\n        DateTime GetCreationTime(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the creation date and utc time of the given directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of directory.</param>\r\n        /// <returns>Creation date and time of the given directory.</returns>\r\n        DateTime GetCreationTimeUtc(string path);\r\n\r\n        /// <summary>\r\n        /// Sets the creation date and time for the specified file or directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">The file or directory for which to set the creation date and time information. </param>\r\n        /// <param name=\"creationTime\">An object that contains the value to set for the creation date and time of path. This value is expressed in local time. </param>\r\n        void SetCreationTime(string path, DateTime creationTime);\r\n\r\n        /// <summary>\r\n        /// Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file or directory.\r\n        /// </summary>\r\n        /// <param name=\"path\">The file or directory for which to set the creation date and time information.</param>\r\n        /// <param name=\"creationTimeUtc\">An object that contains the value to set for the creation date and time of path. This value is expressed in UTC time.</param>\r\n        void SetCreationTimeUtc(string path, DateTime creationTimeUtc);\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1DirectoryInfo.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n    /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/> for more information.\r\n    /// </summary>\r\n    public interface IC1DirectoryInfo\r\n    {\r\n        /// <summary>\r\n        /// The name of the directory.\r\n        /// </summary>\r\n        string Name { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Full path of the directory.\r\n        /// </summary>\r\n        string FullName { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The extension of the directory.\r\n        /// </summary>\r\n        string Extension { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Tells if the directory exists or not.\r\n        /// </summary>\r\n        bool Exists { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The root directory of the directory.\r\n        /// </summary>\r\n        C1DirectoryInfo Root { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The parent directory of the directory.\r\n        /// </summary>\r\n        C1DirectoryInfo Parent { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// File attributes of the directory.\r\n        /// </summary>\r\n        FileAttributes Attributes { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the subdirectories of the directory.\r\n        /// </summary>\r\n        /// <returns>Subdirectories of the directory.</returns>\r\n        C1DirectoryInfo[] GetDirectories();\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the subdirectores of the directory given the search pattern.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\">Search pattern to use.</param>\r\n        /// <returns>Subdirectories of the directory.</returns>\r\n        C1DirectoryInfo[] GetDirectories(string searchPattern);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the subdirectores of the directory given the search pattern and options.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\">The search pattern to use.</param>\r\n        /// <param name=\"searchOption\">The search options to use.</param>\r\n        /// <returns>Subdirectories of the directory.</returns>\r\n        C1DirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchOption);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the files in the directory.\r\n        /// </summary>\r\n        /// <returns>Files in the directory.</returns>\r\n        C1FileInfo[] GetFiles();\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the files in the directory given the search pattern.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\">The search pattern to use.</param>\r\n        /// <returns>Files in the directory given the search pattern.</returns>\r\n        C1FileInfo[] GetFiles(string searchPattern);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the files in the directory given the search pattern and options.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\">The search pattern to use.</param>\r\n        /// <param name=\"searchOption\">The search options to use.</param>\r\n        /// <returns>Files in the directory given the search pattern and options.</returns>\r\n        C1FileInfo[] GetFiles(string searchPattern, SearchOption searchOption);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates the directory.\r\n        /// </summary>\r\n        void Create();\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a subdirectory.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to create.</param>\r\n        /// <returns></returns>\r\n        C1DirectoryInfo CreateSubdirectory(string path);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Moves the directory to the given path.\r\n        /// </summary>\r\n        /// <param name=\"destDirName\">Destination directory name.</param>\r\n        void MoveTo(string destDirName);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the directory if empty.\r\n        /// </summary>\r\n        void Delete();\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the directory, files and subdirectories if specified.\r\n        /// </summary>\r\n        /// <param name=\"recursive\">If true, a recursive delete will be performced.</param>\r\n        void Delete(bool recursive);        \r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The creation time of the directory.\r\n        /// </summary>\r\n        DateTime CreationTime { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The creation utc time of the directory.\r\n        /// </summary>\r\n        DateTime CreationTimeUtc { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Last access time of the directory.\r\n        /// </summary>\r\n        DateTime LastAccessTime { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Last access utc time of the directory.\r\n        /// </summary>\r\n        DateTime LastAccessTimeUtc { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Last write time of the directory.\r\n        /// </summary>\r\n        DateTime LastWriteTime { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Last write utc time of the directory.\r\n        /// </summary>\r\n        DateTime LastWriteTimeUtc { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        void GetObjectData(SerializationInfo info, StreamingContext context);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        void Refresh();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1File.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.IO.C1File\"/>.\r\n    /// See <see cref=\"Composite.Core.IO.C1File\"/> for more information.\r\n    /// </summary>\r\n    public interface IC1File\r\n    {\r\n        /// <summary>\r\n        /// Determins if the given file exists or not.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to the file.</param>\r\n        /// <returns>Returns true if the file exists, false if not.</returns>\r\n        bool Exists(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// This is not a port of the System.IO.File. This method can be used to 'touch' an\r\n        /// existing file. This is a way of telling the C1 IO system that the file has been \r\n        /// touched and C1 uses this to handle other than standard Windows deployments, like\r\n        /// Windows Azure.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to touch.</param>\r\n        void Touch(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Copies a file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Source path of file to copy.</param>\r\n        /// <param name=\"destFileName\">Target path of the file to be copied to.</param>\r\n        void Copy(string sourceFileName, string destFileName);\r\n\r\n\r\n        /// <summary>\r\n        /// Copies a file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Source path of file to copy.</param>\r\n        /// <param name=\"destFileName\">Target path of the file to be copied to.</param>\r\n        /// <param name=\"overwrite\">If this is true and the target path exists, it will be overwritten without any exceptions.</param>\r\n        void Copy(string sourceFileName, string destFileName, bool overwrite);\r\n\r\n\r\n        /// <summary>\r\n        /// Moves a file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Path of file to move.</param>\r\n        /// <param name=\"destFileName\">Destination path to move the file to.</param>\r\n        void Move(string sourceFileName, string destFileName);\r\n\r\n\r\n        /// <summary>\r\n        /// Replace a file with another file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Path to source file.</param>\r\n        /// <param name=\"destinationFileName\">Path to file to replace.</param>\r\n        /// <param name=\"destinationBackupFileName\"></param>\r\n        void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName);\r\n\r\n\r\n        /// <summary>\r\n        /// Replace a file with another file.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\">Path to source file.</param>\r\n        /// <param name=\"destinationFileName\">Path to file to replace.</param>\r\n        /// <param name=\"destinationBackupFileName\"></param>\r\n        /// <param name=\"ignoreMetadataErrors\"></param>\r\n        void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors);\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the given file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to delete.</param>\r\n        void Delete(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file and returns a file stream to it <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to create.</param>\r\n        /// <returns>Returns the newly created <see cref=\"C1FileStream\"/> stream.</returns>\r\n        C1FileStream Create(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file and returns a file stream to it <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to create.</param>\r\n        /// <param name=\"bufferSize\">Buffer size of returned stream.</param>\r\n        /// <returns>Returns the newly created <see cref=\"C1FileStream\"/> stream.</returns>\r\n        C1FileStream Create(string path, int bufferSize);\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file and returns a file stream to it <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to create.</param>\r\n        /// <param name=\"bufferSize\">Buffer size of returned stream.</param>\r\n        /// <param name=\"options\">File options of returned stream.</param>\r\n        /// <returns>Returns the newly created <see cref=\"C1FileStream\"/> stream.</returns>\r\n        C1FileStream Create(string path, int bufferSize, FileOptions options);\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new file and returns a stream writer to it <see cref=\"C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to create.</param>\r\n        /// <returns>Returns the newly created <see cref=\"C1StreamWriter\"/>.</returns>\r\n        C1StreamWriter CreateText(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a <see cref=\"C1StreamWriter\"/> for appending.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <returns>Returns the newly opned <see cref=\"C1StreamWriter\"/>.</returns>\r\n        C1StreamWriter AppendText(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Appends content to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <param name=\"contents\">Content to append to file.</param>        \r\n        void AppendAllText(string path, string contents);\r\n\r\n\r\n        /// <summary>\r\n        /// Appends content to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <param name=\"contents\">Content to append to file.</param>        \r\n        /// <param name=\"encoding\">Encoding to use when appending.</param>\r\n        void AppendAllText(string path, string contents, Encoding encoding);\r\n\r\n\r\n        /// <summary>\r\n        /// Appends content to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <param name=\"contents\">Content to append to file.</param>\r\n        void AppendAllLines(string path, IEnumerable<string> contents);\r\n\r\n\r\n        /// <summary>\r\n        /// Appends content to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to append to.</param>\r\n        /// <param name=\"contents\">Content to append to file.</param>        \r\n        /// <param name=\"encoding\">Encoding to use when appending.</param>\r\n        void AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding);\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream Open(string path, FileMode mode);\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream Open(string path, FileMode mode, FileAccess access);\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <param name=\"share\">File share to use.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream Open(string path, FileMode mode, FileAccess access, FileShare share);\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file for reading.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream OpenRead(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1StreamReader\"/>.</returns>\r\n        C1StreamReader OpenText(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Opens a file for writing.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to open.</param>\r\n        /// <returns>Returns the newly opened <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream OpenWrite(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Read all bytes from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <returns>Returns read bytes.</returns>\r\n        byte[] ReadAllBytes(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Read all lines from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <returns>Returns read lines.</returns>\r\n        string[] ReadAllLines(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Read all lines from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <param name=\"encoding\">Encoding to use when reading.</param>\r\n        /// <returns>Returns read lines.</returns>\r\n        string[] ReadAllLines(string path, Encoding encoding);\r\n\r\n\r\n        /// <summary>\r\n        /// Read all text from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <returns>The content of the file.</returns>\r\n        string ReadAllText(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Read all text from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <param name=\"encoding\">Encoding to use when reading.</param>\r\n        /// <returns>The content of the file.</returns>\r\n        string ReadAllText(string path, Encoding encoding);\r\n\r\n\r\n        /// <summary>\r\n        /// Read all lines from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <returns>Returns all read lines.</returns>\r\n        IEnumerable<string> ReadLines(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Read all lines from a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <param name=\"encoding\">Encoding to use when reading.</param>\r\n        /// <returns>Returns all read lines.</returns>\r\n        IEnumerable<string> ReadLines(string path, Encoding encoding);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes bytes to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"bytes\">Bytes to write.</param>\r\n        void WriteAllBytes(string path, byte[] bytes);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes lines to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Lines to write.</param>\r\n        void WriteAllLines(string path, IEnumerable<string> contents);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes lines to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Lines to write.</param>\r\n        /// <param name=\"encoding\">Encoding to use when writing.</param>\r\n        void WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes lines to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Lines to write.</param>\r\n        void WriteAllLines(string path, string[] contents);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes lines to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Lines to write.</param>\r\n        /// <param name=\"encoding\">Encoding to use when writing.</param>\r\n        void WriteAllLines(string path, string[] contents, Encoding encoding);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes text to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Text to write.</param>\r\n        void WriteAllText(string path, string contents);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes text to a file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to write to.</param>\r\n        /// <param name=\"contents\">Text to write.</param>\r\n        /// <param name=\"encoding\">Encoding to use when writing.</param>\r\n        void WriteAllText(string path, string contents, Encoding encoding);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the file attributes.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to get attributes from.</param>\r\n        /// <returns>Returns the file attributes. See System.IO.FileAttributes</returns>\r\n        FileAttributes GetAttributes(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the file attributes.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to set attributes on.</param>\r\n        /// <param name=\"fileAttributes\">File attributes to set.</param>\r\n        void SetAttributes(string path, FileAttributes fileAttributes);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the creation time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the creation time of the given file.</returns>\r\n        DateTime GetCreationTime(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the creation utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the creation utc time of the given file.</returns>\r\n        DateTime GetCreationTimeUtc(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the creation time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"creationTime\">New creation time.</param>\r\n        void SetCreationTime(string path, DateTime creationTime);\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the creation utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"creationTimeUtc\">New creation utc time.</param>\r\n        void SetCreationTimeUtc(string path, DateTime creationTimeUtc);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the last access time.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the last access time of the file.</returns>\r\n        DateTime GetLastAccessTime(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the last access utc time.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the last access utc time of the file.</returns>\r\n        DateTime GetLastAccessTimeUtc(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the last access time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"lastAccessTime\">New last access time.</param>\r\n        void SetLastAccessTime(string path, DateTime lastAccessTime);\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the last access utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"lastAccessTimeUtc\">New last access utc time.</param>\r\n        void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc);\r\n\r\n\r\n        /// <summary>\r\n        /// Get last write time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the last write time of the file.</returns>\r\n        DateTime GetLastWriteTime(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Get last write utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <returns>Returns the last write utc time of the file.</returns>\r\n        DateTime GetLastWriteTimeUtc(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the last write time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"lastWriteTime\">New last write time.</param>\r\n        void SetLastWriteTime(string path, DateTime lastWriteTime);\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the last write utc time of the file.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"lastWriteTimeUtc\">New last write utc time.</param>\r\n        void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1FileInfo.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n    /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/> for more information.\r\n    /// </summary>\r\n    public interface IC1FileInfo\r\n    {\r\n        /// <summary>\r\n        /// Returns the directory name of the file.\r\n        /// </summary>\r\n        string DirectoryName { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a <see cref=\"C1DirectoryInfo\"/> of the file.\r\n        /// </summary>\r\n        C1DirectoryInfo Directory { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the name of the file.\r\n        /// </summary>\r\n        string Name { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the full path and name of the file.\r\n        /// </summary>\r\n        string FullName { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the file exists. Otherwise false.\r\n        /// </summary>\r\n        bool Exists { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the extension of the file.\r\n        /// </summary>\r\n        string Extension { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if and only if the file is read only.\r\n        /// </summary>\r\n        bool IsReadOnly { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the size of the file in bytes.\r\n        /// </summary>\r\n        long Length { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the file attributes on the file.\r\n        /// </summary>\r\n        FileAttributes Attributes { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream Create();\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1StreamWriter\"/>.</returns>\r\n        C1StreamWriter CreateText();\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1StreamWriter\"/> for appending.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1StreamWriter\"/> for appending.</returns>\r\n        C1StreamWriter AppendText();\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream Open(FileMode mode);\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream Open(FileMode mode, FileAccess access);\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <param name=\"share\">File share to use.</param>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/>.</returns>\r\n        C1FileStream Open(FileMode mode, FileAccess access, FileShare share);\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/> for reading.</returns>\r\n        C1FileStream OpenRead();\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1StreamReader\"/>.</returns>\r\n        C1StreamReader OpenText();\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a file stream <see cref=\"C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <returns>Returns a newly created <see cref=\"C1FileStream\"/> for writing.</returns>\r\n        C1FileStream OpenWrite();\r\n\r\n\r\n        /// <summary>\r\n        /// Copies the file to the given path.\r\n        /// </summary>\r\n        /// <param name=\"destFileName\">Destination path.</param>\r\n        /// <returns>A new <see cref=\"C1FileInfo\"/> for the destination file.</returns>\r\n        C1FileInfo CopyTo(string destFileName);\r\n\r\n\r\n        /// <summary>\r\n        /// Copies the file to the given path and overwrites any existing file if specified.\r\n        /// </summary>\r\n        /// <param name=\"destFileName\">Destination path.</param>\r\n        /// <param name=\"overwrite\">If true, any existing file will be overwritten.</param>\r\n        /// <returns>A new <see cref=\"C1FileInfo\"/> for the destination file.</returns>\r\n        C1FileInfo CopyTo(string destFileName, bool overwrite);\r\n\r\n\r\n        /// <summary>\r\n        /// Moves the file to the given path.\r\n        /// </summary>\r\n        /// <param name=\"destFileName\">Destination path.</param>\r\n        void MoveTo(string destFileName);\r\n\r\n\r\n        /// <summary>\r\n        /// Replaces the given file with this one.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\">Destination path to file to replace.</param>\r\n        /// <param name=\"destinationBackupFileName\">Path to backup file.</param>\r\n        /// <returns>A new <see cref=\"C1FileInfo\"/> for the destination file.</returns>\r\n        C1FileInfo Replace(string destinationFileName, string destinationBackupFileName);\r\n\r\n\r\n        /// <summary>\r\n        /// Replaces the given file with this one.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\">Destination path to file to replace.</param>\r\n        /// <param name=\"destinationBackupFileName\">Path to backup file.</param>\r\n        /// <param name=\"ignoreMetadataErrors\"></param>\r\n        /// <returns>A new <see cref=\"C1FileInfo\"/> for the destination file.</returns>\r\n        C1FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors);\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the file.\r\n        /// </summary>\r\n        void Delete();\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the creation time of the file.\r\n        /// </summary>\r\n        DateTime CreationTime { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the creation utc time of the file.\r\n        /// </summary>\r\n        DateTime CreationTimeUtc { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last access time of the file.\r\n        /// </summary>\r\n        DateTime LastAccessTime { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last access utc time of the file.\r\n        /// </summary>\r\n        DateTime LastAccessTimeUtc { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last write time of the file.\r\n        /// </summary>\r\n        DateTime LastWriteTime { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the last write utc time of the file.\r\n        /// </summary>\r\n        DateTime LastWriteTimeUtc { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        void Refresh();\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"info\"></param>\r\n        /// <param name=\"context\"></param>\r\n        void GetObjectData(SerializationInfo info, StreamingContext context);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1FileStream.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n    /// See <see cref=\"Composite.Core.IO.C1FileStream\"/> for more information.\r\n    /// </summary>\r\n    public interface IC1FileStream : IDisposable\r\n    {\r\n        /// <summary>\r\n        /// Name of the file.\r\n        /// </summary>\r\n        string Name { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Size of the file in bytes.\r\n        /// </summary>\r\n        long Length { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the length of the file in bytes.\r\n        /// </summary>\r\n        /// <param name=\"value\">New length of file stream.</param>\r\n        void SetLength(long value);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the current read/write position in the file stream.\r\n        /// </summary>\r\n        long Position { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a block of bytes from the file stream.\r\n        /// </summary>\r\n        /// <param name=\"array\">Target buffer of read bytes.</param>\r\n        /// <param name=\"offset\">Offset in the buffer to put read bytes.</param>\r\n        /// <param name=\"count\">Number of bytes to read.</param>\r\n        /// <returns>Number of bytes read.</returns>\r\n        int Read(byte[] array, int offset, int count);\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a byte form the file stream.\r\n        /// </summary>\r\n        /// <returns>The read byte value.</returns>\r\n        int ReadByte();\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a block of bytes to the file stream.\r\n        /// </summary>\r\n        /// <param name=\"array\">Bytes to write to the file.</param>\r\n        /// <param name=\"offset\">Offset in buffer to write from.</param>\r\n        /// <param name=\"count\">Number of bytes to write.</param>\r\n        void Write(byte[] array, int offset, int count);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a byte to the file stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Byte value to write.</param>\r\n        void WriteByte(byte value);\r\n\r\n\r\n        /// <summary>\r\n        /// Seeks to a position in the file stream.\r\n        /// </summary>\r\n        /// <param name=\"offset\">Offset to seek.</param>\r\n        /// <param name=\"origin\">Origin to seek from.</param>\r\n        /// <returns>The new position in the stream.</returns>\r\n        long Seek(long offset, SeekOrigin origin);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if its possible to read from the stream.\r\n        /// </summary>\r\n        bool CanRead { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if its possible to seek in the stream.\r\n        /// </summary>\r\n        bool CanSeek { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if its possible to write to the stream.\r\n        /// </summary>\r\n        bool CanWrite { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Flushes the buffered bytes to the file.\r\n        /// </summary>\r\n        void Flush();\r\n\r\n\r\n        /// <summary>\r\n        /// Flushes the buffered bytes to the file.\r\n        /// </summary>\r\n        /// <param name=\"flushToDisk\"></param>\r\n        void Flush(bool flushToDisk);\r\n\r\n\r\n        /// <summary>\r\n        /// Closes the file stream.\r\n        /// </summary>\r\n        void Close();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1FileSystemWatcher.cs",
    "content": "﻿using System.IO;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n    /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/> for more information.\r\n    /// </summary>\r\n    public interface IC1FileSystemWatcher\r\n    {\r\n        /// <summary>\r\n        /// Gets or sets if events should be raised or not.\r\n        /// </summary>\r\n        bool EnableRaisingEvents { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Path to watch.\r\n        /// </summary>\r\n        string Path { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Filter to use.\r\n        /// </summary>\r\n        string Filter { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets of subdirectories should also be watched.\r\n        /// </summary>\r\n        bool IncludeSubdirectories { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the size of an internal buffer.\r\n        /// </summary>\r\n        int InternalBufferSize { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when new items are created.\r\n        /// </summary>\r\n        event FileSystemEventHandler Created;\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when new items changed.\r\n        /// </summary>\r\n        event FileSystemEventHandler Changed;\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when new items are renamed.\r\n        /// </summary>\r\n        event RenamedEventHandler Renamed;\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when new items are deleted.\r\n        /// </summary>\r\n        event FileSystemEventHandler Deleted;\r\n\r\n\r\n        /// <summary>\r\n        /// Adds or removes an event handler when an error occure.\r\n        /// </summary>\r\n        event ErrorEventHandler Error;\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the notify filter.\r\n        /// </summary>        \r\n        NotifyFilters NotifyFilter { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Begins the initialization.\r\n        /// </summary>\r\n        void BeginInit();\r\n\r\n\r\n        /// <summary>\r\n        /// Ends the initialization.\r\n        /// </summary>\r\n        void EndInit();\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"changeType\"></param>\r\n        /// <returns></returns>\r\n        C1WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType);\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"changeType\"></param>\r\n        /// <param name=\"timeout\"></param>\r\n        /// <returns></returns>\r\n        C1WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1StreamReader.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n    /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/> for more information.\r\n    /// </summary>\r\n    public interface IC1StreamReader : IDisposable\r\n    {\r\n        /// <summary>\r\n        /// Reads a byte from the stream.\r\n        /// </summary>\r\n        /// <returns>Returns the read byte.</returns>\r\n        int Read();\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a block from the file.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Buffer to read into.</param>\r\n        /// <param name=\"index\">Index in buffer to start storing bytes.</param>\r\n        /// <param name=\"count\">Number of bytes to read.</param>\r\n        /// <returns>Returns the number read bytes.</returns>\r\n        int Read(char[] buffer, int index, int count);\r\n\r\n\r\n        /// <summary>\r\n        /// Read a line from the file.\r\n        /// </summary>\r\n        /// <returns>Returns the read line.</returns>\r\n        string ReadLine();\r\n\r\n\r\n        /// <summary>\r\n        /// Read all the content of the file into a strng.\r\n        /// </summary>\r\n        /// <returns>The content of the file.</returns>\r\n        string ReadToEnd();\r\n\r\n\r\n        /// <summary>\r\n        /// Reads a block from the file.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Buffer to store read chars.</param>\r\n        /// <param name=\"index\">Index in buffer to start storing chars.</param>\r\n        /// <param name=\"count\">Number of chars to read.</param>\r\n        /// <returns>Returns the number of read chars.</returns>\r\n        int ReadBlock(char[] buffer, int index, int count);\r\n\r\n\r\n        /// <summary>\r\n        /// Peeks the current byte.\r\n        /// </summary>\r\n        /// <returns>The current byte.</returns>\r\n        int Peek();\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the stream is at the end of stream.\r\n        /// </summary>\r\n        bool EndOfStream { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Closes the stream.\r\n        /// </summary>\r\n        void Close();\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the base stream.\r\n        /// </summary>\r\n        Stream BaseStream { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the current encoding of the stream.\r\n        /// </summary>\r\n        Encoding CurrentEncoding { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IC1StreamWriter.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implementations of this interface is used by C1 through <see cref=\"IIOProvider\"/> \r\n    /// to provide the behavior of <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n    /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/> for more information.\r\n    /// </summary>\r\n    public interface IC1StreamWriter : IDisposable\r\n    {\r\n        /// <summary>\r\n        /// Writes a string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">String to write.</param>\r\n        void Write(string value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a formatted string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg\">String format arguments.</param>\r\n        void Write(string format, params object[] arg);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a formatted string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        void Write(string format, object arg0);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a formatted string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        /// <param name=\"arg1\">String format argument.</param>\r\n        void Write(string format, object arg0, object arg1);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a formatted string to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        /// <param name=\"arg1\">String format argument.</param>\r\n        /// <param name=\"arg2\">String format argument.</param>\r\n        void Write(string format, object arg0, object arg1, object arg2);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">The char value to write.</param>\r\n        void Write(char value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char array to the stream.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Char array to write.</param>\r\n        void Write(char[] buffer);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char array to the stream.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Char array to write.</param>\r\n        /// <param name=\"index\">Start index in the buffer to start writing from.</param>\r\n        /// <param name=\"count\">Number of chars to write.</param>\r\n        void Write(char[] buffer, int index, int count);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a boolean to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Boolean value to write.</param>\r\n        void Write(bool value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an integer to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Integer value to write.</param>\r\n        void Write(int value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an unsigned integer to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Unsigned integer value to write</param>\r\n        void Write(uint value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a long to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Long value to write.</param>\r\n        void Write(long value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an unsigned long to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Unsigned long value to write.</param>\r\n        void Write(ulong value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a float to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Float value to write.</param>\r\n        void Write(float value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a double to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Double value to write.</param>\r\n        void Write(double value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a decimal to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Decimal value to write.</param>\r\n        void Write(decimal value);\r\n\r\n\r\n        /// <summary>\r\n        /// Write an object to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Object value to write.</param>\r\n        void Write(object value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a line break to the stream.\r\n        /// </summary>\r\n        void WriteLine();\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">String value to write.</param>\r\n        void WriteLine(string value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        void WriteLine(string format, object arg0);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        /// <param name=\"arg1\">String format argument.</param>\r\n        void WriteLine(string format, object arg0, object arg1);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg0\">String format argument.</param>\r\n        /// <param name=\"arg1\">String format argument.</param>\r\n        /// <param name=\"arg2\">String format argument.</param>\r\n        void WriteLine(string format, object arg0, object arg1, object arg2);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a string with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"format\">String with formatting to write.</param>\r\n        /// <param name=\"arg\">String format arguments.</param>\r\n        void WriteLine(string format, params object[] arg);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Char value to write.</param>\r\n        void WriteLine(char value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char array with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Char array to write.</param>\r\n        void WriteLine(char[] buffer);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a char array with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"buffer\">Char array to write.</param>\r\n        /// <param name=\"index\">Index in the char array to start writing from.</param>\r\n        /// <param name=\"count\">Number of chars to write.</param>\r\n        void WriteLine(char[] buffer, int index, int count);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a bool with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Bool value to write.</param>\r\n        void WriteLine(bool value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an integer with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Integer value to write.</param>\r\n        void WriteLine(int value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an unsigned integer with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Unsigned integer to write.</param>\r\n        void WriteLine(uint value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a long with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Long value to write.</param>\r\n        void WriteLine(long value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an unsigned long with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Unsigned long value to write.</param>\r\n        void WriteLine(ulong value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a float with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Float value to write.</param>\r\n        void WriteLine(float value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a double with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Double value to write.</param>\r\n        void WriteLine(double value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes a decimal with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Decimal value to write.</param>\r\n        void WriteLine(decimal value);\r\n\r\n\r\n        /// <summary>\r\n        /// Writes an object with a line break to the stream.\r\n        /// </summary>\r\n        /// <param name=\"value\">Object value to write.</param>\r\n        void WriteLine(object value);\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the line break value.\r\n        /// </summary>\r\n        string NewLine { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the format provider used.\r\n        /// </summary>\r\n        IFormatProvider FormatProvider { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets whether the stream is auto flushed or not\r\n        /// </summary>\r\n        bool AutoFlush { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Flushes the stream.\r\n        /// </summary>\r\n        void Flush();\r\n\r\n\r\n        /// <summary>\r\n        /// Closes the stream.\r\n        /// </summary>\r\n        void Close();\r\n\r\n\r\n        /// <summary>\r\n        /// The base streawm.\r\n        /// </summary>\r\n        Stream BaseStream { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the encoding used.\r\n        /// </summary>\r\n        Encoding Encoding { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IIOProvider.cs",
    "content": "﻿using System.IO;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Composite.Core.IO.Plugins.IOProvider.Runtime;\r\n\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Implement this interface to overwrite the default behavior of IO in C1.\r\n    /// This provides implementations of the following classes:\r\n    /// <see cref=\"Composite.Core.IO.C1Directory\"/>\r\n    /// <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>\r\n    /// <see cref=\"Composite.Core.IO.C1File\"/>\r\n    /// <see cref=\"Composite.Core.IO.C1FileInfo\"/>\r\n    /// <see cref=\"Composite.Core.IO.C1FileStream\"/>\r\n    /// <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>\r\n    /// <see cref=\"Composite.Core.IO.C1StreamReader\"/>\r\n    /// <see cref=\"Composite.Core.IO.C1StreamWriter\"/>\r\n    /// <see cref=\"Composite.Core.Configuration.C1Configuration\"/>\r\n    /// <example>\r\n    /// Here is an minimal implementaion example:\r\n    /// <code>\r\n    /// [ConfigurationElementType(typeof(NonConfigurableIOProvider))]\r\n    /// internal class LocalIOProvider : IIOProvider\r\n    /// {\r\n    ///     /* Implementation goes here */\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    /// </summary>\r\n    [CustomFactory(typeof(IOProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(IOProviderDefaultNameRetriever))]\r\n    public interface IIOProvider\r\n    {\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1Directory\"/>.\r\n        /// </summary>\r\n        IC1Directory C1Directory { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1File\"/>.\r\n        /// </summary>\r\n        IC1File C1File { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"fileName\">Path to file to use.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileInfo\"/>.</returns>\r\n        IC1FileInfo CreateFileInfo(string fileName);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to directory to use.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1DirectoryInfo\"/>.</returns>\r\n        IC1DirectoryInfo CreateDirectoryInfo(string path);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file.</param>\r\n        /// <param name=\"mode\">File mode to use.</param>\r\n        /// <param name=\"access\">File access to use.</param>\r\n        /// <param name=\"share\">File share to use.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use.</param>\r\n        /// <param name=\"options\">File options to use.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileStream\"/>.</returns>\r\n        IC1FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file or directory to watch.</param>\r\n        /// <param name=\"filter\">Filter to use.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1FileSystemWatcher\"/>.</returns>\r\n        IC1FileSystemWatcher CreateFileSystemWatcher(string path, string filter);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file to read from.</param>\r\n        /// <param name=\"encoding\">Encoding to use when reading.</param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\">If true, encoding will be detected from the file stream.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use when reading.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamReader\"/>.</returns>\r\n        IC1StreamReader CreateStreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to read from.</param>\r\n        /// <param name=\"encoding\">Encoding to use when reading.</param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\">If true, encoding will be detected from the file stream.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use when reading.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamReader\"/>.</returns>\r\n        IC1StreamReader CreateStreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of file to write to.</param>\r\n        /// <param name=\"append\">If true, writte data will be appended to the end of the file.</param>\r\n        /// <param name=\"encoding\">Encoding to use when writing.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use when writing.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamWriter\"/>.</returns>\r\n        IC1StreamWriter CreateStreamWriter(string path, bool append, Encoding encoding, int bufferSize);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"stream\">Stream to write to.</param>\r\n        /// <param name=\"encoding\">Encoding to use when writing.</param>\r\n        /// <param name=\"bufferSize\">Buffer size to use when writing.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1StreamWriter\"/>.</returns>\r\n        IC1StreamWriter CreateStreamWriter(Stream stream, Encoding encoding, int bufferSize);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\">Path of configuration file.</param>\r\n        /// <returns>Returns a custom implementation of <see cref=\"Composite.Core.IO.Plugins.IOProvider.IC1Configuration\"/>.</returns>\r\n        IC1Configuration CreateConfiguration(string path);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/IOProviderData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>\r\n    /// Use this to make custom configuration of an <see cref=\"IIOProvider\"/> implementation.\r\n    /// </summary>\r\n    [ConfigurationElementType(typeof(NonConfigurableIOProvider))]\r\n    public class IOProviderData: NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/NonConfigurableIOProvider.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider\r\n{\r\n    /// <summary>    \r\n    /// This is a default non configurable version of <see cref=\"IOProviderData\"/>\r\n    /// </summary>\r\n    [Assembler(typeof(NonConfigurableIOProviderAssembler))]\r\n    public class NonConfigurableIOProvider : IOProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// This is a default non configurable assembler version of <see cref=\"IOProviderData\"/>\r\n    /// </summary>\r\n    public sealed class NonConfigurableIOProviderAssembler : IAssembler<IIOProvider, IOProviderData>\r\n    {\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IIOProvider Assemble(IBuilderContext context, IOProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IIOProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/Runtime/IOProviderCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider.Runtime\r\n{\r\n    internal sealed class IOProviderCustomFactory : AssemblerBasedCustomFactory<IIOProvider, IOProviderData>\r\n    {\r\n        protected override IOProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            IOProviderSettings settings = configurationSource.GetSection(IOProviderSettings.SectionName) as IOProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", IOProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.IOProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/Runtime/IOProviderDefaultNameRetriever.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider.Runtime\r\n{\r\n    internal sealed class IOProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            if (null == configSource) throw new ArgumentNullException(\"configSource\");\r\n\r\n            if (null != name)\r\n            {\r\n                return name;\r\n            }\r\n            else\r\n            {\r\n                IOProviderSettings settings = configSource.GetSection(IOProviderSettings.SectionName) as IOProviderSettings;\r\n\r\n                if (null == settings)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Could not load configuration section {0}\", IOProviderSettings.SectionName));\r\n                }\r\n\r\n                return settings.DefaultIOProvider;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/Runtime/IOProviderFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider.Runtime\r\n{\r\n    internal sealed class IOProviderFactory: NameTypeFactoryBase<IIOProvider>\r\n\t{\r\n        public IOProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Plugins/IOProvider/Runtime/IOProviderSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.IO.Plugins.IOProvider.Runtime\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class IOProviderSettings : SerializableConfigurationSection\r\n    {\r\n        /// <exclude />\r\n        public const string SectionName = \"Composite.Core.IO.Plugins.IOProviderConfiguration\";\r\n\r\n        \r\n        private const string _defaultIOProviderProviderProperty = \"defaultIOProvider\";\r\n        /// <summary>\r\n        /// </summary>\r\n        [ConfigurationProperty(_defaultIOProviderProviderProperty, IsRequired = true)]        \r\n        public string DefaultIOProvider\r\n        {\r\n            get { return (string)base[_defaultIOProviderProviderProperty]; }\r\n            set { base[_defaultIOProviderProviderProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _ioProviderPluginsProperty = \"IOProviderPlugins\";\r\n        /// <summary>\r\n        /// </summary>\r\n        [ConfigurationProperty(_ioProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<IOProviderData> IOProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<IOProviderData>)base[_ioProviderPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/ReparsePointUtils.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Runtime.InteropServices;\r\nusing System.Text;\r\nusing Microsoft.Win32.SafeHandles;\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    internal static class ReparsePointUtils\r\n    {\r\n        public static bool DirectoryIsReparsePoint(string directoryPath)\r\n        {\r\n            return (new C1DirectoryInfo(directoryPath).Attributes & FileAttributes.ReparsePoint) > 0;\r\n        }\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        public static string GetDirectoryReparsePointTarget(string directoryPath)\r\n        {\r\n            var dirInfo = new DirectoryInfo(directoryPath);\r\n\r\n            return GetSymbolicLinkTarget(dirInfo);\r\n        }\r\n\r\n        private const int CREATION_DISPOSITION_OPEN_EXISTING = 3;\r\n\r\n        private const int FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;\r\n\r\n        // http://msdn.microsoft.com/en-us/library/aa364962%28VS.85%29.aspx\r\n        [DllImport(\"kernel32.dll\", EntryPoint = \"GetFinalPathNameByHandleW\", CharSet = CharSet.Unicode, SetLastError = true)]\r\n        private static extern int GetFinalPathNameByHandle(IntPtr handle, [In, Out] StringBuilder path, int bufLen, int flags);\r\n\r\n        // http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx\r\n        [DllImport(\"kernel32.dll\", EntryPoint = \"CreateFileW\", CharSet = CharSet.Unicode, SetLastError = true)]\r\n        private static extern SafeFileHandle CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode,\r\n        IntPtr SecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile);\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        private static string GetSymbolicLinkTarget(DirectoryInfo symlink)\r\n        {\r\n            SafeFileHandle directoryHandle = CreateFile(symlink.FullName, 0, 2, System.IntPtr.Zero, CREATION_DISPOSITION_OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, System.IntPtr.Zero);\r\n            if (directoryHandle.IsInvalid)\r\n                throw new Win32Exception(Marshal.GetLastWin32Error());\r\n\r\n            var path = new StringBuilder(512);\r\n            int size = GetFinalPathNameByHandle(directoryHandle.DangerousGetHandle(), path, path.Capacity, 0);\r\n            if (size < 0)\r\n                throw new Win32Exception(Marshal.GetLastWin32Error());\r\n            // The remarks section of GetFinalPathNameByHandle mentions the return being prefixed with \"\\\\?\\\"\r\n            // More information about \"\\\\?\\\" here -> http://msdn.microsoft.com/en-us/library/aa365247(v=VS.85).aspx\r\n            if (path[0] == '\\\\' && path[1] == '\\\\' && path[2] == '?' && path[3] == '\\\\')\r\n            {\r\n                return path.ToString().Substring(4); \r\n            }\r\n\r\n            return path.ToString();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/StreamUtils.cs",
    "content": "﻿using System.IO;\r\n\r\n\r\nnamespace Composite.Core.IO\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class StreamUtils\r\n    {\r\n        /// <exclude />\r\n        public static void CopyStream(Stream input, Stream output)\r\n        {\r\n            byte[] buffer = new byte[8192];\r\n\r\n            while (true)\r\n            {\r\n                int read = input.Read(buffer, 0, buffer.Length);\r\n\r\n                if (read <= 0) return;\r\n\r\n                output.Write(buffer, 0, read);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Zip/IZipFileSystem.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.IO;\r\n\r\n\r\nnamespace Composite.Core.IO.Zip\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IZipFileSystem\r\n\t{\r\n        /// <exclude />\r\n        bool ContainsFile(string filePath);\r\n\r\n        /// <exclude />\r\n        bool ContainsDirectory(string directoryName);\r\n\r\n        /// <exclude />\r\n        IEnumerable<string> GetFilenames();\r\n\r\n        /// <exclude />\r\n        IEnumerable<string> GetFilenames(string directoryName);\r\n\r\n        /// <exclude />\r\n        IEnumerable<string> GetDirectoryNames();\r\n\r\n        /// <exclude />\r\n        Stream GetFileStream(string filename);\r\n\r\n        /// <exclude />\r\n        void WriteFileToDisk(string filename, string targetFilename);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/IO/Zip/ZipFileSystem.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.IO.Compression;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Core.IO.Zip\r\n{\r\n    internal sealed class ZipFileSystem : IZipFileSystem\r\n    {\r\n        private const int CopyBufferSize = 4096;\r\n\r\n        private readonly HashSet<string> _entryNames = new HashSet<string>();\r\n        private readonly Dictionary<string, string> _denormalizedEntryNames = new Dictionary<string, string>();\r\n\r\n        private string ZipFilename { get; }\r\n\r\n        private static string NormalizePathDelimiters(string path) => path.Replace('\\\\', '/');\r\n\r\n        public ZipFileSystem(string zipFilename)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(zipFilename, \"zipFilename\");\r\n\r\n            ZipFilename = zipFilename;\r\n\r\n            Initialize();\r\n        }\r\n\r\n\r\n\r\n        public bool ContainsFile(string filename)\r\n        {\r\n            filename = NormalizePathDelimiters(filename);\r\n\r\n            return GetFilenames().Any(f => f.Equals(filename, StringComparison.OrdinalIgnoreCase));\r\n        }\r\n\r\n\r\n\r\n        public bool ContainsDirectory(string directoryName)\r\n        {\r\n            directoryName = NormalizePathDelimiters(directoryName);\r\n\r\n            return GetDirectoryNames().Any(f => f.Equals(directoryName, StringComparison.OrdinalIgnoreCase));\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> GetFilenames()\r\n        {\r\n            foreach (var filename in _entryNames.Where(s => !s.EndsWith(\"/\")))\r\n            {\r\n                yield return $\"~/{filename}\";\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> GetFilenames(string directoryName)\r\n        {\r\n            directoryName = NormalizePathDelimiters(directoryName);\r\n\r\n            foreach (var filename in GetFilenames())\r\n            {\r\n                if (filename.StartsWith(directoryName))\r\n                {\r\n                    yield return filename;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> GetDirectoryNames()\r\n        {\r\n            foreach (string directoryName in _entryNames.Where(e => e.EndsWith(\"/\")))\r\n            {\r\n                yield return $\"~/{directoryName}\";\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        ///\r\n        /// </summary>\r\n        /// <param name=\"filename\">\r\n        /// Format:\r\n        ///     ~\\Filename.txt\r\n        ///     ~\\Directory1\\Directory2\\Filename.txt\r\n        ///     ~/Filename.txt\r\n        ///     ~/Directory1/Directory2/Filename.txt\r\n        /// </param>\r\n        /// <returns></returns>\r\n        public Stream GetFileStream(string filename)\r\n        {\r\n            var parstedFilename = ParseFilename(filename);\r\n\r\n            if (!_entryNames.Contains(parstedFilename))\r\n            {\r\n                string note = \"\";\r\n\r\n                var entryWithAnotherCasing = _entryNames\r\n                    .FirstOrDefault(en => en.Equals(parstedFilename, StringComparison.InvariantCultureIgnoreCase));\r\n\r\n                if (entryWithAnotherCasing != null)\r\n                {\r\n                    note =  $\" There's another entry with different casing '{entryWithAnotherCasing}'.\";\r\n                }\r\n\r\n                throw new ArgumentException($\"The file '{filename}' does not exist in the zip.\" + note);\r\n            }\r\n\r\n            var zipArchive = new ZipArchive(C1File.Open(ZipFilename, FileMode.Open, FileAccess.Read));\r\n\r\n\r\n            var normalizedEntryPath = NormalizePathDelimiters(filename.Substring(2));\r\n\r\n            if(!_denormalizedEntryNames.TryGetValue(normalizedEntryPath, out string entryPath))\r\n            {\r\n                throw new InvalidOperationException($\"Entry '{normalizedEntryPath}' not found\");\r\n            }\r\n\r\n            var entry = zipArchive.GetEntry(entryPath);\r\n            if (entry == null)\r\n            {\r\n                zipArchive.Dispose();\r\n\r\n                throw new InvalidOperationException($\"Failed to extract entry '{entryPath}' from zip archive\");\r\n            }\r\n            \r\n            return new StreamWrapper(entry.Open(), () => zipArchive.Dispose());\r\n        }\r\n\r\n        /// <summary>\r\n        ///\r\n        /// </summary>\r\n        /// <param name=\"filename\">\r\n        /// Format:\r\n        ///     ~\\Filename.txt\r\n        ///     ~\\Directory1\\Directory2\\Filename.txt\r\n        ///     ~/Filename.txt\r\n        ///     ~/Directory1/Directory2/Filename.txt\r\n        /// </param>\r\n        /// <param name=\"targetFilename\">\r\n        /// </param>\r\n        /// <returns></returns>\r\n        public void WriteFileToDisk(string filename, string targetFilename)\r\n        {\r\n            using (var stream = GetFileStream(filename))\r\n            {\r\n                using (var fileStream = new C1FileStream(targetFilename, FileMode.Create, FileAccess.Write))\r\n                {\r\n                    var buffer = new byte[CopyBufferSize];\r\n\r\n                    int readBytes;\r\n                    while ((readBytes = stream.Read(buffer, 0, CopyBufferSize)) > 0)\r\n                    {\r\n                        fileStream.Write(buffer, 0, readBytes);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            using (var fileStream = C1File.Open(ZipFilename, FileMode.Open, FileAccess.Read))\r\n            {\r\n                using (var zipArchive = new ZipArchive(fileStream))\r\n                {\r\n                    foreach (var entry in zipArchive.Entries)\r\n                    {\r\n                        var normalizedEntryPath = NormalizePathDelimiters(entry.FullName);\r\n                        _denormalizedEntryNames[normalizedEntryPath] = entry.FullName;\r\n\r\n                        _entryNames.Add(normalizedEntryPath);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static string ParseFilename(string filename)\r\n        {\r\n            if (!filename.StartsWith(\"~\"))\r\n            {\r\n                throw new ArgumentException(\"filename should start with a '~/' or '~\\\\'\");\r\n            }\r\n\r\n            filename = NormalizePathDelimiters(filename.Substring(1));\r\n\r\n            if (!filename.StartsWith(\"/\"))\r\n            {\r\n                throw new ArgumentException(\"filename should start with a '~/' or '~\\\\'\");\r\n            }\r\n\r\n            return filename.Substring(1);\r\n        }\r\n\r\n        private class StreamWrapper : Stream, IDisposable\r\n        {\r\n            private readonly Stream _innerStream;\r\n            private readonly Action _disposeAction;\r\n\r\n            public StreamWrapper(Stream innerStream, Action disposeAction)\r\n            {\r\n                _innerStream = innerStream;\r\n                _disposeAction = disposeAction;\r\n            }\r\n\r\n\r\n            public override void Flush()\r\n            {\r\n                _innerStream.Flush();\r\n            }\r\n\r\n            public override long Seek(long offset, SeekOrigin origin)\r\n            {\r\n                return _innerStream.Seek(offset, origin);\r\n            }\r\n\r\n            public override void SetLength(long value)\r\n            {\r\n                _innerStream.SetLength(value);\r\n            }\r\n\r\n            public override int Read(byte[] buffer, int offset, int count)\r\n            {\r\n                return _innerStream.Read(buffer, offset, count);\r\n            }\r\n\r\n            public override void Write(byte[] buffer, int offset, int count)\r\n            {\r\n                _innerStream.Write(buffer, offset, count);\r\n            }\r\n\r\n            public override bool CanRead => _innerStream.CanRead;\r\n            public override bool CanSeek => _innerStream.CanSeek;\r\n            public override bool CanWrite => _innerStream.CanWrite;\r\n            public override long Length => _innerStream.Length;\r\n\r\n            public override long Position\r\n            {\r\n                get {  return _innerStream.Position; }\r\n                set { _innerStream.Position = value; }\r\n            } \r\n\r\n\r\n            void IDisposable.Dispose()\r\n            {\r\n                _innerStream.Dispose();\r\n\r\n                _disposeAction();\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~StreamWrapper()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1ConfigurationImplementation.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n    /// </summary>\r\n    public class C1ConfigurationImplementation\r\n    {\r\n        private IC1Configuration _configuration;\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public C1ConfigurationImplementation(string path)\r\n        {\r\n\r\n            _configuration = IOFacade.CreateC1Configuration(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        public virtual string FilePath\r\n        {\r\n            get\r\n            {\r\n                return _configuration.FilePath;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        public virtual bool HasFile\r\n        {\r\n            get\r\n            {\r\n                return _configuration.HasFile;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        public virtual AppSettingsSection AppSettings\r\n        {\r\n            get\r\n            {\r\n                return _configuration.AppSettings;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        public virtual ConnectionStringsSection ConnectionStrings\r\n        {\r\n            get\r\n            {\r\n                return _configuration.ConnectionStrings;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        public virtual ConfigurationSectionCollection Sections\r\n        {\r\n            get\r\n            {\r\n                return _configuration.Sections;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        public virtual ConfigurationSectionGroup RootSectionGroup\r\n        {\r\n            get\r\n            {\r\n                return _configuration.RootSectionGroup;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        public virtual ConfigurationSectionGroupCollection SectionGroups\r\n        {\r\n            get\r\n            {\r\n                return _configuration.SectionGroups;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"sectionName\"></param>\r\n        /// <returns></returns>\r\n        public virtual ConfigurationSection GetSection(string sectionName)\r\n        {\r\n            return _configuration.GetSection(sectionName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"sectionGroupName\"></param>\r\n        /// <returns></returns>\r\n        public virtual ConfigurationSectionGroup GetSectionGroup(string sectionGroupName)\r\n        {\r\n            return _configuration.GetSectionGroup(sectionGroupName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        public virtual void Save()\r\n        {\r\n            _configuration.Save();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"saveMode\"></param>\r\n        public virtual void Save(ConfigurationSaveMode saveMode)\r\n        {\r\n            _configuration.Save(saveMode);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"saveMode\"></param>\r\n        /// <param name=\"forceSaveAll\"></param>\r\n        public virtual void Save(ConfigurationSaveMode saveMode, bool forceSaveAll)\r\n        {\r\n            _configuration.Save(saveMode, forceSaveAll);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"fileName\"></param>\r\n        public virtual void SaveAs(string fileName)\r\n        {\r\n            _configuration.SaveAs(fileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"fileName\"></param>\r\n        /// <param name=\"saveMode\"></param>\r\n        public virtual void SaveAs(string fileName, ConfigurationSaveMode saveMode)\r\n        {\r\n            _configuration.SaveAs(fileName, saveMode);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.Configuration.C1Configuration\"/>.\r\n        /// </summary>\r\n        /// <param name=\"fileName\"></param>\r\n        /// <param name=\"saveMode\"></param>\r\n        /// <param name=\"forceSaveAll\"></param>\r\n        public virtual void SaveAs(string fileName, ConfigurationSaveMode saveMode, bool forceSaveAll)\r\n        {\r\n            _configuration.SaveAs(fileName, saveMode, forceSaveAll);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1DirectoryImplementation.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n    /// </summary>\r\n    public class C1DirectoryImplementation\r\n    {\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1DirectoryInfo CreateDirectory(string path)\r\n        {\r\n            return IOFacade.C1Directory.CreateDirectory(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"sourceDirName\"></param>\r\n        /// <param name=\"destinationDirName\"></param>        \r\n        public virtual void Move(string sourceDirName, string destinationDirName)\r\n        {\r\n            IOFacade.C1Directory.Move(sourceDirName, destinationDirName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        public virtual void Delete(string path)\r\n        {\r\n            IOFacade.C1Directory.Delete(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"recursive\"></param>\r\n        public virtual void Delete(string path, bool recursive)\r\n        {\r\n            IOFacade.C1Directory.Delete(path, recursive);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual bool Exists(string path)\r\n        {\r\n            return IOFacade.C1Directory.Exists(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1024:UsePropertiesWhereAppropriate\")]\r\n        public virtual string GetCurrentDirectory()\r\n        {\r\n            return IOFacade.C1Directory.GetCurrentDirectory();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        public virtual void SetCurrentDirectory(string path)\r\n        {\r\n            IOFacade.C1Directory.SetCurrentDirectory(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1DirectoryInfo GetParent(string path)\r\n        {\r\n            return IOFacade.C1Directory.GetParent(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual string GetDirectoryRoot(string path)\r\n        {\r\n            return IOFacade.C1Directory.GetDirectoryRoot(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual string[] GetDirectories(string path)\r\n        {\r\n            return IOFacade.C1Directory.GetDirectories(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"searchPattern\"></param>\r\n        /// <returns></returns>\r\n        public virtual string[] GetDirectories(string path, string searchPattern)\r\n        {\r\n            return IOFacade.C1Directory.GetDirectories(path, searchPattern);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"searchPattern\"></param>\r\n        /// <param name=\"searchOption\"></param>\r\n        /// <returns></returns>\r\n        public virtual string[] GetDirectories(string path, string searchPattern, SearchOption searchOption)\r\n        {\r\n            return IOFacade.C1Directory.GetDirectories(path, searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual string[] GetFiles(string path)\r\n        {\r\n            return IOFacade.C1Directory.GetFiles(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"searchPattern\"></param>\r\n        /// <returns></returns>\r\n        public virtual string[] GetFiles(string path, string searchPattern)\r\n        {\r\n            return IOFacade.C1Directory.GetFiles(path, searchPattern);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"searchPattern\"></param>\r\n        /// <param name=\"searchOption\"></param>\r\n        /// <returns></returns>\r\n        public virtual string[] GetFiles(string path, string searchPattern, SearchOption searchOption)\r\n        {\r\n            return IOFacade.C1Directory.GetFiles(path, searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual DateTime GetCreationTime(string path)\r\n        {\r\n            return IOFacade.C1Directory.GetCreationTime(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1Directory\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual DateTime GetCreationTimeUtc(string path)\r\n        {\r\n            return IOFacade.C1Directory.GetCreationTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateDirectories(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateDirectories(string path, string searchPattern)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateDirectories(string path, string searchPattern, SearchOption searchOption)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateFiles(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateFiles(string path, string searchPattern)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateFiles(string path, string searchPattern, SearchOption searchOption)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateFileSystemEntries(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern, SearchOption searchOption)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual string[] GetFileSystemEntries(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual string[] GetFileSystemEntries(string path, string searchPattern)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual string[] GetFileSystemEntries(string path, string searchPattern, SearchOption searchOption)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual DirectorySecurity GetAccessControl(string path)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual DirectorySecurity GetAccessControl(string path, AccessControlSections includeSections)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n\r\n        //public virtual void SetAccessControl(string path, DirectorySecurity directorySecurity)\r\n        //{\r\n        //    throw new NotImplementedException();\r\n        //}\r\n\r\n\r\n        /// <exclude />\r\n        public virtual void SetCreationTime(string path, DateTime creationTime)\r\n        {\r\n            IOFacade.C1Directory.SetCreationTime(path, creationTime);\r\n            \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public virtual void SetCreationTimeUtc(string path, DateTime creationTimeUtc)\r\n        {\r\n            IOFacade.C1Directory.SetCreationTimeUtc(path, creationTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        //public virtual string[] GetLogicalDrives()\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual DateTime GetLastAccessTime(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void SetLastAccessTime(string path, DateTime lastAccessTime)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual DateTime GetLastAccessTimeUtc(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual DateTime GetLastWriteTime(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void SetLastWriteTime(string path, DateTime lastWriteTime)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual DateTime GetLastWriteTimeUtc(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1DirectoryInfoImplementation.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n    /// </summary>\r\n    public class C1DirectoryInfoImplementation\r\n    {\r\n        private IC1DirectoryInfo _directoryInfo;\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        public C1DirectoryInfoImplementation(string path)\r\n        {\r\n            _directoryInfo = IOFacade.CreateC1DirectoryInfo(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public string FullName\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.FullName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public string Extension\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Extension;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public bool Exists\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Exists;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public C1DirectoryInfo Root\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Root;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public C1DirectoryInfo Parent\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Parent;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public FileAttributes Attributes\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Attributes;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.Attributes = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public C1DirectoryInfo[] GetDirectories()\r\n        {\r\n            return _directoryInfo.GetDirectories();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\"></param>\r\n        /// <returns></returns>\r\n        public C1DirectoryInfo[] GetDirectories(string searchPattern)\r\n        {\r\n            return _directoryInfo.GetDirectories(searchPattern);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\"></param>\r\n        /// <param name=\"searchOption\"></param>\r\n        /// <returns></returns>\r\n        public C1DirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchOption)\r\n        {\r\n            return _directoryInfo.GetDirectories(searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public C1FileInfo[] GetFiles()\r\n        {\r\n            return _directoryInfo.GetFiles();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\"></param>\r\n        /// <returns></returns>\r\n        public C1FileInfo[] GetFiles(string searchPattern)\r\n        {\r\n            return _directoryInfo.GetFiles(searchPattern);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"searchPattern\"></param>\r\n        /// <param name=\"searchOption\"></param>\r\n        /// <returns></returns>\r\n        public C1FileInfo[] GetFiles(string searchPattern, SearchOption searchOption)\r\n        {\r\n            return _directoryInfo.GetFiles(searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public void Create()\r\n        {\r\n            _directoryInfo.Create();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public C1DirectoryInfo CreateSubdirectory(string path)\r\n        {\r\n            return _directoryInfo.CreateSubdirectory(path);\r\n        }      \r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"destinationDirName\"></param>\r\n        public void MoveTo(string destinationDirName)\r\n        {\r\n            _directoryInfo.MoveTo(destinationDirName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public void Delete()\r\n        {\r\n            _directoryInfo.Delete();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"recursive\"></param>\r\n        public void Delete(bool recursive)\r\n        {\r\n            _directoryInfo.Delete(recursive);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public DateTime CreationTime\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.CreationTime;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.CreationTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public DateTime CreationTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.CreationTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.CreationTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public DateTime LastAccessTime \r\n            {\r\n            get\r\n            {\r\n                return _directoryInfo.LastAccessTime;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.LastAccessTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public DateTime LastAccessTimeUtc \r\n            {\r\n            get\r\n            {\r\n                return _directoryInfo.LastAccessTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.LastAccessTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public DateTime LastWriteTime \r\n            {\r\n            get\r\n            {\r\n                return _directoryInfo.LastWriteTime;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.LastWriteTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public DateTime LastWriteTimeUtc \r\n            {\r\n            get\r\n            {\r\n                return _directoryInfo.LastWriteTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.LastWriteTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public void GetObjectData(SerializationInfo info, StreamingContext context)\r\n        {\r\n            _directoryInfo.GetObjectData(info, context);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1DirectoryInfo\"/>.\r\n        /// </summary>\r\n        public void Refresh()\r\n        {\r\n            _directoryInfo.Refresh();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1FileImplementation.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.IO.C1File\"/>.\r\n    /// </summary>\r\n    public class C1FileImplementation\r\n    {\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual bool Exists(string path)\r\n        {\r\n            return IOFacade.C1File.Exists(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        public virtual void Touch(string path)\r\n        {\r\n            IOFacade.C1File.Touch(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\"></param>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        public virtual void Copy(string sourceFileName, string destinationFileName)\r\n        {\r\n            IOFacade.C1File.Copy(sourceFileName, destinationFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\"></param>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        /// <param name=\"overwrite\"></param>\r\n        public virtual void Copy(string sourceFileName, string destinationFileName, bool overwrite)\r\n        {\r\n            IOFacade.C1File.Copy(sourceFileName, destinationFileName, overwrite);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\"></param>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        public virtual void Move(string sourceFileName, string destinationFileName)\r\n        {\r\n            IOFacade.C1File.Move(sourceFileName, destinationFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\"></param>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        /// <param name=\"destinationBackupFileName\"></param>\r\n        public virtual void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName)\r\n        {\r\n            IOFacade.C1File.Replace(sourceFileName, destinationFileName, destinationBackupFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"sourceFileName\"></param>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        /// <param name=\"destinationBackupFileName\"></param>\r\n        /// <param name=\"ignoreMetadataErrors\"></param>\r\n        public virtual void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)\r\n        {\r\n            IOFacade.C1File.Replace(sourceFileName, destinationBackupFileName, destinationBackupFileName, ignoreMetadataErrors);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        public virtual void Delete(string path)\r\n        {\r\n            IOFacade.C1File.Delete(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStream Create(string path)\r\n        {\r\n            return IOFacade.C1File.Create(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStream Create(string path, int bufferSize)\r\n        {\r\n            return IOFacade.C1File.Create(path, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        /// <param name=\"options\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStream Create(string path, int bufferSize, FileOptions options)\r\n        {\r\n            return IOFacade.C1File.Create(path, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1StreamWriter CreateText(string path)\r\n        {\r\n            return IOFacade.C1File.CreateText(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1StreamWriter AppendText(string path)\r\n        {\r\n            return IOFacade.C1File.AppendText(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        public virtual void AppendAllText(string path, string contents)\r\n        {\r\n            IOFacade.C1File.AppendAllText(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        public virtual void AppendAllText(string path, string contents, Encoding encoding)\r\n        {\r\n            IOFacade.C1File.AppendAllText(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        public virtual void AppendAllLines(string path, IEnumerable<string> contents)\r\n        {\r\n            IOFacade.C1File.AppendAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        public virtual void AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding)\r\n        {\r\n            IOFacade.C1File.AppendAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"mode\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStream Open(string path, FileMode mode)\r\n        {\r\n            return IOFacade.C1File.Open(path, mode);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"mode\"></param>\r\n        /// <param name=\"access\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStream Open(string path, FileMode mode, FileAccess access)\r\n        {\r\n            return IOFacade.C1File.Open(path, mode, access);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"mode\"></param>\r\n        /// <param name=\"access\"></param>\r\n        /// <param name=\"share\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStream Open(string path, FileMode mode, FileAccess access, FileShare share)\r\n        {\r\n            return IOFacade.C1File.Open(path, mode, access, share);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStream OpenRead(string path)\r\n        {\r\n            return IOFacade.C1File.OpenRead(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1StreamReader OpenText(string path)\r\n        {\r\n            return IOFacade.C1File.OpenText(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStream OpenWrite(string path)\r\n        {\r\n            return IOFacade.C1File.OpenWrite(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual byte[] ReadAllBytes(string path)\r\n        {\r\n            return IOFacade.C1File.ReadAllBytes(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual string[] ReadAllLines(string path)\r\n        {\r\n            return IOFacade.C1File.ReadAllLines(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <returns></returns>\r\n        public virtual string[] ReadAllLines(string path, Encoding encoding)\r\n        {\r\n            return IOFacade.C1File.ReadAllLines(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual string ReadAllText(string path)\r\n        {\r\n            return IOFacade.C1File.ReadAllText(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <returns></returns>\r\n        public virtual string ReadAllText(string path, Encoding encoding)\r\n        {\r\n            return IOFacade.C1File.ReadAllText(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual IEnumerable<string> ReadLines(string path)\r\n        {\r\n            return IOFacade.C1File.ReadLines(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <returns></returns>\r\n        public virtual IEnumerable<string> ReadLines(string path, Encoding encoding)\r\n        {\r\n            return IOFacade.C1File.ReadLines(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"bytes\"></param>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1720:IdentifiersShouldNotContainTypeNames\", MessageId = \"bytes\")]\r\n        public virtual void WriteAllBytes(string path, byte[] bytes)\r\n        {\r\n            IOFacade.C1File.WriteAllBytes(path, bytes);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        public virtual void WriteAllLines(string path, IEnumerable<string> contents)\r\n        {\r\n            IOFacade.C1File.WriteAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        public virtual void WriteAllLines(string path, string[] contents)\r\n        {\r\n            IOFacade.C1File.WriteAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        public virtual void WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding)\r\n        {\r\n            IOFacade.C1File.WriteAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        public virtual void WriteAllLines(string path, string[] contents, Encoding encoding)\r\n        {\r\n            IOFacade.C1File.WriteAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        public virtual void WriteAllText(string path, string contents)\r\n        {\r\n            IOFacade.C1File.WriteAllText(path, contents);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"contents\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        public virtual void WriteAllText(string path, string contents, Encoding encoding)\r\n        {\r\n            IOFacade.C1File.WriteAllText(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual FileAttributes GetAttributes(string path)\r\n        {\r\n            return IOFacade.C1File.GetAttributes(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"fileAttributes\"></param>\r\n        public virtual void SetAttributes(string path, FileAttributes fileAttributes)\r\n        {\r\n            IOFacade.C1File.SetAttributes(path, fileAttributes);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual DateTime GetCreationTime(string path)\r\n        {\r\n            return IOFacade.C1File.GetCreationTime(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual DateTime GetCreationTimeUtc(string path)\r\n        {\r\n            return IOFacade.C1File.GetCreationTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"creationTime\"></param>\r\n        public virtual void SetCreationTime(string path, DateTime creationTime)\r\n        {\r\n            IOFacade.C1File.SetCreationTime(path, creationTime);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"creationTimeUtc\"></param>\r\n        public virtual void SetCreationTimeUtc(string path, DateTime creationTimeUtc)\r\n        {\r\n            IOFacade.C1File.SetCreationTimeUtc(path, creationTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual DateTime GetLastAccessTime(string path)\r\n        {\r\n            return IOFacade.C1File.GetLastAccessTime(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual DateTime GetLastAccessTimeUtc(string path)\r\n        {\r\n            return IOFacade.C1File.GetLastAccessTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"lastAccessTime\"></param>\r\n        public virtual void SetLastAccessTime(string path, DateTime lastAccessTime)\r\n        {\r\n            IOFacade.C1File.SetLastAccessTime(path, lastAccessTime);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"lastAccessTimeUtc\"></param>\r\n        public virtual void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)\r\n        {\r\n            IOFacade.C1File.SetLastAccessTimeUtc(path, lastAccessTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual DateTime GetLastWriteTime(string path)\r\n        {\r\n            return IOFacade.C1File.GetLastWriteTime(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual DateTime GetLastWriteTimeUtc(string path)\r\n        {\r\n            return IOFacade.C1File.GetLastWriteTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"lastWriteTime\"></param>\r\n        public virtual void SetLastWriteTime(string path, DateTime lastWriteTime)\r\n        {\r\n            IOFacade.C1File.SetLastWriteTime(path, lastWriteTime);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1File\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"lastWriteTimeUtc\"></param>\r\n        public virtual void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)\r\n        {\r\n            IOFacade.C1File.SetLastWriteTimeUtc(path, lastWriteTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        //public virtual FileStream Create(string path, int bufferSize, System.IO.FileOptions options, System.Security.AccessControl.FileSecurity fileSecurity)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n\r\n        //public virtual void Encrypt(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void Decrypt(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual System.Security.AccessControl.FileSecurity GetAccessControl(string path)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual System.Security.AccessControl.FileSecurity GetAccessControl(string path, System.Security.AccessControl.AccessControlSections includeSections)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void SetAccessControl(string path, System.Security.AccessControl.FileSecurity fileSecurity)\r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1FileInfoImplementation.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n    /// </summary>\r\n    public class C1FileInfoImplementation\r\n    {\r\n        private IC1FileInfo _fileInfo;\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        public C1FileInfoImplementation(string path)\r\n        {\r\n            _fileInfo = IOFacade.CreateC1FileInfo(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public string DirectoryName\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.DirectoryName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public C1DirectoryInfo Directory\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Directory;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public string FullName\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.FullName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public bool Exists\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Exists;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public string Extension\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Extension;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public bool IsReadOnly\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.IsReadOnly;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.IsReadOnly = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public long Length\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Length;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public FileAttributes Attributes\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Attributes;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.Attributes = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public C1FileStream Create()\r\n        {\r\n            return _fileInfo.Create();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public C1StreamWriter CreateText()\r\n        {\r\n            return _fileInfo.CreateText();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public C1StreamWriter AppendText()\r\n        {\r\n            return _fileInfo.AppendText();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\"></param>\r\n        /// <returns></returns>\r\n        public C1FileStream Open(FileMode mode)\r\n        {\r\n            return _fileInfo.Open(mode);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\"></param>\r\n        /// <param name=\"access\"></param>\r\n        /// <returns></returns>\r\n        public C1FileStream Open(FileMode mode, FileAccess access)\r\n        {\r\n            return _fileInfo.Open(mode, access);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"mode\"></param>\r\n        /// <param name=\"access\"></param>\r\n        /// <param name=\"share\"></param>\r\n        /// <returns></returns>\r\n        public C1FileStream Open(FileMode mode, FileAccess access, FileShare share)\r\n        {\r\n            return _fileInfo.Open(mode, access, share);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public C1FileStream OpenRead()\r\n        {\r\n            return _fileInfo.OpenRead();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public C1StreamReader OpenText()\r\n        {\r\n            return _fileInfo.OpenText();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public C1FileStream OpenWrite()\r\n        {\r\n            return _fileInfo.OpenWrite();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        /// <returns></returns>\r\n        public C1FileInfo CopyTo(string destinationFileName)\r\n        {\r\n            return _fileInfo.CopyTo(destinationFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        /// <param name=\"overwrite\"></param>\r\n        /// <returns></returns>\r\n        public C1FileInfo CopyTo(string destinationFileName, bool overwrite)\r\n        {\r\n            return _fileInfo.CopyTo(destinationFileName, overwrite);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        public void MoveTo(string destinationFileName)\r\n        {\r\n            _fileInfo.MoveTo(destinationFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        /// <param name=\"destinationBackupFileName\"></param>\r\n        /// <returns></returns>\r\n        public C1FileInfo Replace(string destinationFileName, string destinationBackupFileName)\r\n        {\r\n            return _fileInfo.Replace(destinationFileName, destinationBackupFileName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"destinationFileName\"></param>\r\n        /// <param name=\"destinationBackupFileName\"></param>\r\n        /// <param name=\"ignoreMetadataErrors\"></param>\r\n        /// <returns></returns>\r\n        public C1FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)\r\n        {\r\n            return _fileInfo.Replace(destinationFileName, destinationBackupFileName, ignoreMetadataErrors);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public void Delete()\r\n        {\r\n            _fileInfo.Delete();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public void Refresh()\r\n        {\r\n            _fileInfo.Refresh();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        /// <param name=\"info\"></param>\r\n        /// <param name=\"context\"></param>\r\n        public void GetObjectData(SerializationInfo info, StreamingContext context)\r\n        {\r\n            _fileInfo.GetObjectData(info, context);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public DateTime CreationTime\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.CreationTime;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.CreationTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public DateTime CreationTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.CreationTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.CreationTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public DateTime LastAccessTime\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.LastAccessTime;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.LastAccessTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public DateTime LastAccessTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.LastAccessTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.LastAccessTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public DateTime LastWriteTime\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.LastWriteTime;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.LastWriteTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileInfo\"/>.\r\n        /// </summary>\r\n        public DateTime LastWriteTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.LastWriteTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.LastWriteTimeUtc = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1FileStreamImplementation.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.InteropServices;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n    /// </summary>\r\n    public class C1FileStreamImplementation : IDisposable\r\n    {\r\n        private IC1FileStream _fileStream;\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"mode\"></param>\r\n        /// <param name=\"access\"></param>\r\n        /// <param name=\"share\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        /// <param name=\"options\"></param>\r\n        public C1FileStreamImplementation(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)\r\n        {\r\n            _fileStream = IOFacade.CreateC1FileStream(path, mode, access, share, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        public virtual string Name\r\n        {\r\n            get\r\n            {\r\n                return _fileStream.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        public virtual long Length\r\n        {\r\n            get\r\n            {\r\n                return _fileStream.Length;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void SetLength(long value)\r\n        {\r\n            _fileStream.SetLength(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        public virtual long Position\r\n        {\r\n            get\r\n            {\r\n                return _fileStream.Position;\r\n            }\r\n            set\r\n            {\r\n                _fileStream.Position = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"array\"></param>\r\n        /// <param name=\"offset\"></param>\r\n        /// <param name=\"count\"></param>\r\n        /// <returns></returns>\r\n        public virtual int Read(byte[] array, int offset, int count)\r\n        {\r\n            return _fileStream.Read(array, offset, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public virtual int ReadByte()\r\n        {\r\n            return _fileStream.ReadByte();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"array\"></param>\r\n        /// <param name=\"offset\"></param>\r\n        /// <param name=\"count\"></param>\r\n        public virtual void Write(byte[] array, int offset, int count)\r\n        {\r\n            _fileStream.Write(array, offset, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteByte(byte value)\r\n        {\r\n            _fileStream.WriteByte(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"offset\"></param>\r\n        /// <param name=\"origin\"></param>\r\n        /// <returns></returns>\r\n        public virtual long Seek(long offset, SeekOrigin origin)\r\n        {\r\n            return _fileStream.Seek(offset, origin);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        public virtual bool CanRead\r\n        {\r\n            get\r\n            {\r\n                return _fileStream.CanRead;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        public virtual bool CanSeek\r\n        {\r\n            get\r\n            {\r\n                return _fileStream.CanSeek;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        public virtual bool CanWrite\r\n        {\r\n            get\r\n            {\r\n                return _fileStream.CanWrite;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        public virtual void Flush()\r\n        {\r\n            _fileStream.Flush();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        /// <param name=\"flushToDisk\"></param>\r\n        public virtual void Flush(bool flushToDisk)\r\n        {\r\n            _fileStream.Flush(flushToDisk);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileStream\"/>.\r\n        /// </summary>\r\n        public virtual void Close()\r\n        {\r\n            _fileStream.Close();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~C1FileStreamImplementation()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected virtual void Dispose(bool disposing)\r\n        {\r\n            if (disposing)\r\n            {\r\n                _fileStream.Dispose();\r\n            }\r\n        }\r\n\r\n        //public virtual bool IsAsync \r\n        //{ \r\n        //    get \r\n        //    { \r\n        //        throw new NotImplementedException(); \r\n        //    } \r\n        //}\r\n\r\n\r\n\r\n        ////[Obsolete(\"This property has been deprecated.  Please use FileStream's SafeFileHandle property instead.  http://go.microsoft.com/fwlink/?linkid=14202\")]\r\n        //public virtual IntPtr Handle \r\n        //{ \r\n        //    get \r\n        //    { \r\n        //        throw new NotImplementedException(); \r\n        //    } \r\n        //}\r\n\r\n\r\n\r\n        //public virtual FileSecurity GetAccessControl() \r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void SetAccessControl(FileSecurity fileSecurity) \r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void Lock(long position, long length) \r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n\r\n\r\n\r\n        //public virtual void Unlock(long position, long length) \r\n        //{ \r\n        //    throw new NotImplementedException(); \r\n        //}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1FileSystemWatcherImplementation.cs",
    "content": "﻿using System.IO;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n    /// </summary>\r\n    public class C1FileSystemWatcherImplementation\r\n    {\r\n        private readonly IC1FileSystemWatcher _fileSystemWatcher;\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"filter\"></param>\r\n        public C1FileSystemWatcherImplementation(string path, string filter)\r\n        {\r\n            _fileSystemWatcher = IOFacade.CreateC1FileSystemWatcher(path, filter);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual bool EnableRaisingEvents\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.EnableRaisingEvents;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.EnableRaisingEvents = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual string Path\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.Path;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.Path = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual string Filter\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.Filter;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.Filter = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual bool IncludeSubdirectories\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.IncludeSubdirectories;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.IncludeSubdirectories = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual int InternalBufferSize\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.InternalBufferSize;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.InternalBufferSize = value;\r\n            }\r\n        }\r\n        \r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual event FileSystemEventHandler Created\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Created += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Created -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual event FileSystemEventHandler Changed\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Changed += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Changed -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual event RenamedEventHandler Renamed\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Renamed += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Renamed -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual event FileSystemEventHandler Deleted\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Deleted += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Deleted -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1716:IdentifiersShouldNotMatchKeywords\", MessageId = \"Error\")]\r\n        public virtual event ErrorEventHandler Error\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Error += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Error -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual NotifyFilters NotifyFilter\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.NotifyFilter;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.NotifyFilter = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual void BeginInit()\r\n        {\r\n            _fileSystemWatcher.BeginInit();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        public virtual void EndInit()\r\n        {\r\n            _fileSystemWatcher.EndInit();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        /// <param name=\"changeType\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType)\r\n        {\r\n            return _fileSystemWatcher.WaitForChanged(changeType);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1FileSystemWatcher\"/>.\r\n        /// </summary>\r\n        /// <param name=\"changeType\"></param>\r\n        /// <param name=\"timeout\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout)\r\n        {\r\n            return _fileSystemWatcher.WaitForChanged(changeType, timeout);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1StreamReaderImplementation.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.InteropServices;\r\nusing System.Text;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n    /// </summary>\r\n    public class C1StreamReaderImplementation : IDisposable\r\n    {\r\n        private IC1StreamReader _streamReader;\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        public C1StreamReaderImplementation(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            _streamReader = IOFacade.CreateC1StreamReader(path, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <param name=\"stream\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        public C1StreamReaderImplementation(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            _streamReader = IOFacade.CreateC1StreamReader(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public virtual int Read()\r\n        {\r\n            return _streamReader.Read();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <param name=\"buffer\"></param>\r\n        /// <param name=\"index\"></param>\r\n        /// <param name=\"count\"></param>\r\n        /// <returns></returns>\r\n        public virtual int Read(char[] buffer, int index, int count)\r\n        {\r\n            return _streamReader.Read(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public virtual string ReadLine()\r\n        {\r\n            return _streamReader.ReadLine();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public virtual string ReadToEnd()\r\n        {\r\n            return _streamReader.ReadToEnd();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <param name=\"buffer\"></param>\r\n        /// <param name=\"index\"></param>\r\n        /// <param name=\"count\"></param>\r\n        /// <returns></returns>\r\n        public virtual int ReadBlock(char[] buffer, int index, int count)\r\n        {\r\n            return _streamReader.ReadBlock(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public virtual int Peek()\r\n        {\r\n            return _streamReader.Peek();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        public virtual bool EndOfStream\r\n        {\r\n            get\r\n            {\r\n                return _streamReader.EndOfStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        public virtual void Close()\r\n        {\r\n            _streamReader.Close();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        public virtual Stream BaseStream\r\n        {\r\n            get\r\n            {\r\n                return _streamReader.BaseStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        public virtual Encoding CurrentEncoding\r\n        {\r\n            get\r\n            {\r\n                return _streamReader.CurrentEncoding;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~C1StreamReaderImplementation()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamReader\"/>.\r\n        /// </summary>\r\n        /// <param name=\"disposing\"></param>\r\n        protected virtual void Dispose(bool disposing)\r\n        {\r\n            if (disposing)\r\n            {\r\n                _streamReader.Dispose();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/C1StreamWriterImplementation.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation of <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n    /// </summary>\r\n    public class C1StreamWriterImplementation : IDisposable\r\n    {\r\n        private IC1StreamWriter _streamWriter;\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"append\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        public C1StreamWriterImplementation(string path, bool append, Encoding encoding, int bufferSize)\r\n        {\r\n            _streamWriter = IOFacade.CreateC1StreamWriter(path, append, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"stream\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        public C1StreamWriterImplementation(Stream stream, Encoding encoding, int bufferSize)\r\n        {\r\n            _streamWriter = IOFacade.CreateC1StreamWriter(stream, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(string value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"format\"></param>\r\n        /// <param name=\"arg0\"></param>\r\n        public virtual void Write(string format, object arg0)\r\n        {\r\n            _streamWriter.Write(format, arg0);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"format\"></param>\r\n        /// <param name=\"arg0\"></param>\r\n        /// <param name=\"arg1\"></param>\r\n        public virtual void Write(string format, object arg0, object arg1)\r\n        {\r\n            _streamWriter.Write(format, arg0, arg1);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"format\"></param>\r\n        /// <param name=\"arg0\"></param>\r\n        /// <param name=\"arg1\"></param>\r\n        /// <param name=\"arg2\"></param>\r\n        public virtual void Write(string format, object arg0, object arg1, object arg2)\r\n        {\r\n            _streamWriter.Write(format, arg0, arg1, arg2);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"format\"></param>\r\n        /// <param name=\"arg\"></param>\r\n        public virtual void Write(string format, params object[] arg)\r\n        {\r\n            _streamWriter.Write(format, arg);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(char value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"buffer\"></param>\r\n        public virtual void Write(char[] buffer)\r\n        {\r\n            _streamWriter.Write(buffer);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"buffer\"></param>\r\n        /// <param name=\"index\"></param>\r\n        /// <param name=\"count\"></param>\r\n        public virtual void Write(char[] buffer, int index, int count)\r\n        {\r\n            _streamWriter.Write(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(bool value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(int value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(uint value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(long value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(ulong value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(float value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(double value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(decimal value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void Write(object value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public virtual void WriteLine()\r\n        {\r\n            _streamWriter.WriteLine();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(string value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"format\"></param>\r\n        /// <param name=\"arg0\"></param>\r\n        public virtual void WriteLine(string format, object arg0)\r\n        {\r\n            _streamWriter.WriteLine(format, arg0);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"format\"></param>\r\n        /// <param name=\"arg0\"></param>\r\n        /// <param name=\"arg1\"></param>\r\n        public virtual void WriteLine(string format, object arg0, object arg1)\r\n        {\r\n            _streamWriter.WriteLine(format, arg0, arg1);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"format\"></param>\r\n        /// <param name=\"arg0\"></param>\r\n        /// <param name=\"arg1\"></param>\r\n        /// <param name=\"arg2\"></param>\r\n        public virtual void WriteLine(string format, object arg0, object arg1, object arg2)\r\n        {\r\n            _streamWriter.WriteLine(format, arg0, arg1, arg2);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"format\"></param>\r\n        /// <param name=\"arg\"></param>\r\n        public virtual void WriteLine(string format, params object[] arg)\r\n        {\r\n            _streamWriter.WriteLine(format, arg);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(char value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"buffer\"></param>\r\n        public virtual void WriteLine(char[] buffer)\r\n        {\r\n            _streamWriter.WriteLine(buffer);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"buffer\"></param>\r\n        /// <param name=\"index\"></param>\r\n        /// <param name=\"count\"></param>\r\n        public virtual void WriteLine(char[] buffer, int index, int count)\r\n        {\r\n            _streamWriter.WriteLine(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(bool value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(int value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(uint value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(long value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(ulong value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(float value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(double value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(decimal value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"value\"></param>\r\n        public virtual void WriteLine(object value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public virtual string NewLine\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.NewLine;\r\n            }\r\n            set\r\n            {\r\n                _streamWriter.NewLine = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public virtual IFormatProvider FormatProvider\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.FormatProvider;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public virtual void Flush()\r\n        {\r\n            _streamWriter.Flush();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public virtual bool AutoFlush\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.AutoFlush;\r\n            }\r\n            set\r\n            {\r\n                _streamWriter.AutoFlush = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public virtual void Close()\r\n        {\r\n            _streamWriter.Close();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public virtual Stream BaseStream\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.BaseStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public virtual Encoding Encoding\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.Encoding;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~C1StreamWriterImplementation()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Core.IO.C1StreamWriter\"/>.\r\n        /// </summary>\r\n        /// <param name=\"disposing\"></param>\r\n        protected virtual void Dispose(bool disposing)\r\n        {\r\n            if (disposing)\r\n            {\r\n                _streamWriter.Dispose();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/DataConnectionBase.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Documentation pending\r\n    /// </summary>\r\n    public class DataConnectionBase\r\n    {\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        protected void InitializeScope()\r\n        {\r\n            this.PublicationScope = Data.PublicationScope.Unpublished;\r\n            this.DataScopeIdentifier = DataScopeIdentifier.Administrated;\r\n            this.Locale = null;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"scope\"></param>\r\n        /// <param name=\"locale\"></param>\r\n        protected void InitializeScope(PublicationScope scope, CultureInfo locale)\r\n        {\r\n            this.PublicationScope = scope;\r\n            SetDataScopeIdentifier(scope);\r\n            this.Locale = locale;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        protected PublicationScope PublicationScope { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        protected DataScopeIdentifier DataScopeIdentifier { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        protected CultureInfo Locale { get; private set; }\r\n\r\n\r\n        private void SetDataScopeIdentifier(PublicationScope scope)\r\n        {\r\n            switch (scope)\r\n            {\r\n                case PublicationScope.Published:\r\n                    this.DataScopeIdentifier = DataScopeIdentifier.Public;\r\n                    break;\r\n\r\n                case PublicationScope.Unpublished:\r\n                    this.DataScopeIdentifier = DataScopeIdentifier.Administrated;\r\n                    break;\r\n\r\n                default:\r\n                    throw new ArgumentException(\"PublicationScope {0} not supported\".FormatWith(scope), \"scope\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/DataConnectionImplementation.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.Threading;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Documentation pending\r\n    /// </summary>\r\n    public class DataConnectionImplementation : DataConnectionBase, IDisposable\r\n    {\r\n        private IDisposable _threadDataManager;\r\n        private readonly IDisposable _serviceScope;\r\n        private readonly DataScope _dataScope;\r\n\r\n        internal DataScope DataScope => _dataScope;\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"scope\"></param>\r\n        /// <param name=\"locale\"></param>\r\n        public DataConnectionImplementation(PublicationScope scope, CultureInfo locale)\r\n        {\r\n            InitializeThreadData();\r\n            InitializeScope(scope, locale);\r\n\r\n            _dataScope = new DataScope(this.DataScopeIdentifier, locale);\r\n\r\n            _serviceScope = ServiceLocator.EnsureThreadDataServiceScope();\r\n        }\r\n\r\n        private void InitializeThreadData()\r\n        {\r\n            _threadDataManager = ThreadDataManager.EnsureInitialize();\r\n    }\r\n\r\n    /// <summary>\r\n    /// Documentation pending\r\n    /// </summary>\r\n    /// <typeparam name=\"TData\"></typeparam>\r\n    /// <returns></returns>\r\n    [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1716:IdentifiersShouldNotMatchKeywords\", MessageId = \"Get\", Justification = \"This is what we want\")]\r\n        public virtual IQueryable<TData> Get<TData>()\r\n            where TData : class, IData\r\n        {\r\n        //    using (new DataScope(this.DataScopeIdentifier, this.Locale))\r\n            {\r\n                return DataFacade.GetData<TData>();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <typeparam name=\"TData\"></typeparam>\r\n        /// <param name=\"item\"></param>\r\n        /// <returns></returns>\r\n        public virtual TData Add<TData>(TData item)\r\n            where TData : class, IData\r\n        {\r\n         //   using (new DataScope(this.DataScopeIdentifier, this.Locale))\r\n            {\r\n                return DataFacade.AddNew<TData>(item);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <typeparam name=\"TData\"></typeparam>\r\n        /// <param name=\"items\"></param>\r\n        /// <returns></returns>\r\n        public virtual IList<TData> Add<TData>(IEnumerable<TData> items)\r\n            where TData : class, IData\r\n        {\r\n         //   using (new DataScope(this.DataScopeIdentifier, this.Locale))\r\n            {\r\n                return DataFacade.AddNew<TData>(items);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <typeparam name=\"TData\"></typeparam>\r\n        /// <param name=\"item\"></param>\r\n        public virtual void Update<TData>(TData item)\r\n            where TData : class, IData\r\n        {\r\n         //   using (new DataScope(this.DataScopeIdentifier, this.Locale))\r\n            {\r\n                DataFacade.Update(item);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <typeparam name=\"TData\"></typeparam>\r\n        /// <param name=\"items\"></param>\r\n        public virtual void Update<TData>(IEnumerable<TData> items)\r\n            where TData : class, IData\r\n        {\r\n         //   using (new DataScope(this.DataScopeIdentifier, this.Locale))\r\n            {\r\n                DataFacade.Update(items);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <typeparam name=\"TData\"></typeparam>\r\n        /// <param name=\"item\"></param>\r\n        public virtual void Delete<TData>(TData item)\r\n            where TData : class, IData\r\n        {\r\n          //  using (new DataScope(this.DataScopeIdentifier, this.Locale))\r\n            {\r\n                DataFacade.Delete<TData>(item);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <typeparam name=\"TData\"></typeparam>\r\n        /// <param name=\"items\"></param>\r\n        public virtual void Delete<TData>(IEnumerable<TData> items)\r\n            where TData : class, IData\r\n        {\r\n          //  using (new DataScope(this.DataScopeIdentifier, this.Locale))\r\n            {\r\n                DataFacade.Delete<TData>(items);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual PublicationScope CurrentPublicationScope => this.PublicationScope;\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual CultureInfo CurrentLocale => this.Locale;\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n/// <exclude />\r\n        ~DataConnectionImplementation()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"disposing\"></param>\r\n        protected virtual void Dispose(bool disposing)\r\n        {\r\n            if (disposing)\r\n            {\r\n                _serviceScope?.Dispose();\r\n\r\n                _dataScope.Dispose();\r\n\r\n                _threadDataManager.Dispose();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/DataEventsImplementation.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\n\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation pending\r\n    /// </summary>\r\n    /// <typeparam name=\"TData\"></typeparam>\r\n    public class DataEventsImplementation<TData>\r\n        where TData : class, IData\r\n    {\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        public virtual event DataEventHandler OnBeforeAdd \r\n        { \r\n            add \r\n            {\r\n                DataEventSystemFacade.SubscribeToDataBeforeAdd<TData>(value, true);\r\n            } \r\n            remove \r\n            {\r\n                DataEventSystemFacade.UnsubscribeToDataBeforeAdd(typeof(TData), value);\r\n            } \r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        public virtual event DataEventHandler OnAfterAdd\r\n        {\r\n            add\r\n            {\r\n                DataEventSystemFacade.SubscribeToDataAfterAdd<TData>(value, true);\r\n            }\r\n            remove\r\n            {\r\n                DataEventSystemFacade.UnsubscribeToDataAfterAdd(typeof(TData), value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        public virtual event DataEventHandler OnBeforeUpdate\r\n        {\r\n            add\r\n            {\r\n                DataEventSystemFacade.SubscribeToDataBeforeUpdate<TData>(value, true);\r\n            }\r\n            remove\r\n            {\r\n                DataEventSystemFacade.UnsubscribeToDataBeforeUpdate(typeof(TData), value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        public virtual event DataEventHandler OnAfterUpdate\r\n        {\r\n            add\r\n            {\r\n                DataEventSystemFacade.SubscribeToDataAfterUpdate<TData>(value, true);\r\n            }\r\n            remove\r\n            {\r\n                DataEventSystemFacade.UnsubscribeToDataAfterUpdate(typeof(TData), value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        public virtual event DataEventHandler OnDeleted\r\n        {\r\n            add\r\n            {\r\n                DataEventSystemFacade.SubscribeToDataDeleted<TData>(value, true);\r\n            }\r\n            remove\r\n            {\r\n                DataEventSystemFacade.UnsubscribeToDataDeleted(typeof(TData), value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        public virtual event StoreEventHandler OnStoreChanged\r\n        {\r\n            add\r\n            {\r\n                DataEventSystemFacade.SubscribeToStoreChanged<TData>(value, true);\r\n            }\r\n            remove\r\n            {\r\n                DataEventSystemFacade.UnsubscribeToStoreChanged(typeof(TData), value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        public virtual event DataEventHandler OnNew\r\n        {\r\n            add\r\n            {\r\n                DataEventSystemFacade.SubscribeToDataAfterBuildNew<TData>(value, true);\r\n            }\r\n            remove\r\n            {\r\n                DataEventSystemFacade.UnsubscribeToDataAfterBuildNew(typeof(TData), value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        public virtual void FireExternalStoreChangeEvent(PublicationScope publicationScope, CultureInfo locale)\r\n        {\r\n            DataEventSystemFacade.FireExternalStoreChangedEvent(typeof(TData), publicationScope, locale);\r\n        }\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/ImplementationContainer.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <typeparam name=\"T\"></typeparam>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ImplementationContainer<T>\r\n        where T : class\r\n    {\r\n        private T _implementation;\r\n        private bool _disposed;\r\n        private readonly Func<T> _create;\r\n\r\n\r\n\r\n        internal ImplementationContainer(Func<T> create)\r\n        {\r\n            _create = create;\r\n        }\r\n\r\n        \r\n\r\n\r\n        internal T Implementation\r\n        {\r\n            get\r\n            {\r\n                if (_implementation == null)\r\n                {\r\n                    CreateImplementation();\r\n                }\r\n\r\n                return _implementation;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal void CreateImplementation()\r\n        {\r\n            if (_disposed) throw new InvalidOperationException(\"Already disposed\");\r\n\r\n            _implementation = _create();\r\n        }\r\n\r\n\r\n\r\n        internal void DisposeImplementation()\r\n        {\r\n            _disposed = true;\r\n\r\n            (_implementation as IDisposable)?.Dispose();\r\n\r\n            _implementation = null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/ImplementationFactory.cs",
    "content": "﻿using System.Globalization;\r\nusing Composite.Data;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System;\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Documentation pending\r\n    /// </summary>\r\n    public class ImplementationFactory\r\n    {\r\n        static ImplementationFactory()\r\n        {\r\n            CurrentFactory = new ImplementationFactory();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Use this to change the current factory;\r\n        /// </summary>\r\n        public static ImplementationFactory CurrentFactory { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual LogImplementation StatelessLog\r\n        {\r\n            get\r\n            {\r\n                return new LogImplementation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual StatelessDataConnectionImplementation StatelessDataConnection \r\n            => new StatelessDataConnectionImplementation();\r\n\r\n        internal object ResolveService(Type t)\r\n        {\r\n            return DataServiceScopeManager.GetService(t);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"scope\"></param>\r\n        /// <param name=\"locale\"></param>\r\n        /// <returns></returns>\r\n        public virtual DataConnectionImplementation CreateDataConnection(PublicationScope? scope, CultureInfo locale)\r\n        {\r\n            PublicationScope scopeToUse = ResolvePublicationScope(scope);\r\n            CultureInfo localeToUse = ResolveLocale(locale);\r\n\r\n            return new DataConnectionImplementation(scopeToUse, localeToUse);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <returns></returns>\r\n        public virtual DataEventsImplementation<T> CreateStatelessDataEvents<T>()\r\n            where T : class, IData\r\n        {\r\n            return new DataEventsImplementation<T>();\r\n        }\r\n\r\n\r\n\r\n        //public virtual PageDataConnectionImplementation StatelessPageDataConnection\r\n        //{\r\n        //    get\r\n        //    {\r\n        //        return new PageDataConnectionImplementation();\r\n        //    }\r\n        //}\r\n\r\n\r\n\r\n        //public virtual PageDataConnectionImplementation CreatePageDataConnection(PublicationScope? scope, CultureInfo locale)\r\n        //{\r\n        //    PublicationScope scopeToUse = ResolvePublicationScope(scope);\r\n        //    CultureInfo localeToUse = ResolveLocale(locale);\r\n\r\n        //    return new PageDataConnectionImplementation(scopeToUse, localeToUse);\r\n        //}\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\")]\r\n        public virtual SitemapNavigatorImplementation StatelessSitemapNavigator\r\n        {\r\n            get\r\n            {\r\n                return new SitemapNavigatorImplementation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"connection\"></param>\r\n        /// <returns></returns>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\")]\r\n        public virtual SitemapNavigatorImplementation CreateSitemapNavigator(DataConnection connection)\r\n        {\r\n            return new SitemapNavigatorImplementation(connection);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"scope\"></param>\r\n        /// <returns></returns>\r\n        public virtual PublicationScope ResolvePublicationScope(PublicationScope? scope)\r\n        {\r\n            PublicationScope scopeToUse = PublicationScope.Published;\r\n            if (scope.HasValue)\r\n            {\r\n                scopeToUse = scope.Value;\r\n            }\r\n            else\r\n            {\r\n                if (DataScopeManager.CurrentDataScope.Equals(DataScopeIdentifier.Administrated))\r\n                {\r\n                    scopeToUse = PublicationScope.Unpublished;\r\n                }\r\n                else if (DataScopeManager.CurrentDataScope.Equals(DataScopeIdentifier.Public))\r\n                {\r\n                    scopeToUse = PublicationScope.Published;\r\n                }\r\n            }\r\n\r\n            return scopeToUse;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"locale\"></param>\r\n        /// <returns></returns>\r\n        public virtual CultureInfo ResolveLocale(CultureInfo locale)\r\n        {\r\n\r\n            CultureInfo localeToUse = locale ?? LocalizationScopeManager.CurrentLocalizationScope;\r\n\r\n            if (localeToUse == null || localeToUse.Equals(CultureInfo.InvariantCulture))\r\n            {\r\n                localeToUse = DataLocalizationFacade.DefaultLocalizationCulture;\r\n            }\r\n\r\n            return localeToUse;\r\n        }\r\n\r\n\r\n        #region IO\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual C1DirectoryImplementation StatelessC1Directory\r\n        {\r\n            get\r\n            {\r\n                return new C1DirectoryImplementation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual C1FileImplementation StatelessC1File\r\n        {\r\n            get\r\n            {\r\n                return new C1FileImplementation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileInfoImplementation CreateC1FileInfo(string path)\r\n        {\r\n            return new C1FileInfoImplementation(path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1DirectoryInfoImplementation CreateC1DirectoryInfo(string path)\r\n        {\r\n            return new C1DirectoryInfoImplementation(path);\r\n        }\r\n        \r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"mode\"></param>\r\n        /// <param name=\"access\"></param>\r\n        /// <param name=\"share\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        /// <param name=\"options\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileStreamImplementation CreateC1FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)\r\n        {\r\n            return new C1FileStreamImplementation(path, mode, access, share, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"filter\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1FileSystemWatcherImplementation CreateC1FileSystemWatcher(string path, string filter)\r\n        {\r\n            return new C1FileSystemWatcherImplementation(path, filter);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1StreamReaderImplementation CreateC1StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            return new C1StreamReaderImplementation(path, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"stream\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <param name=\"detectEncodingFromByteOrderMarks\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1StreamReaderImplementation CreateC1StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            return new C1StreamReaderImplementation(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <param name=\"append\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1StreamWriterImplementation CreateC1StreamWriter(string path, bool append, Encoding encoding, int bufferSize)\r\n        {\r\n            return new C1StreamWriterImplementation(path, append, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"stream\"></param>\r\n        /// <param name=\"encoding\"></param>\r\n        /// <param name=\"bufferSize\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1StreamWriterImplementation CreateC1StreamWriter(Stream stream, Encoding encoding, int bufferSize)\r\n        {\r\n            return new C1StreamWriterImplementation(stream, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public virtual C1ConfigurationImplementation CreateC1Configuration(string path)\r\n        {\r\n            return new C1ConfigurationImplementation(path);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual PackageLicenseHelperImplementation StatelessPackageLicenseHelper\r\n        {\r\n            get\r\n            {\r\n                return new PackageLicenseHelperImplementation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1704:IdentifiersShouldBeSpelledCorrectly\", MessageId = \"Utils\")]\r\n        public virtual PackageUtilsImplementation StatelessPackageUtils\r\n        {\r\n            get\r\n            {\r\n                return new PackageUtilsImplementation();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/LogImplementation.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing Composite.Core.Logging;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Implementation pending\r\n    /// </summary>\r\n    public class LogImplementation : ILog\r\n    {\r\n        /// <summary>\r\n        /// Stateless constructor. This is used when implementations of static methods needs to be called        \r\n        /// </summary>\r\n        public LogImplementation()\r\n        {\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"message\"></param>\r\n        public virtual void LogInformation(string title, string message)\r\n        {\r\n            LoggingService.LogInformation(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"messageFormat\"></param>\r\n        /// <param name=\"args\"></param>\r\n        public virtual void LogInformation(string title, string messageFormat, params object[] args) \r\n        {\r\n            LoggingService.LogInformation(title, string.Format(CultureInfo.InvariantCulture, messageFormat, args));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"message\"></param>\r\n        public virtual void LogVerbose(string title, string message)\r\n        {\r\n            LoggingService.LogVerbose(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"messageFormat\"></param>\r\n        /// <param name=\"args\"></param>\r\n        public virtual void LogVerbose(string title, string messageFormat, params object[] args) \r\n        {\r\n            LoggingService.LogVerbose(title, string.Format(CultureInfo.InvariantCulture, messageFormat, args));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"message\"></param>\r\n        public virtual void LogWarning(string title, string message)\r\n        {\r\n            LoggingService.LogWarning(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"messageFormat\"></param>\r\n        /// <param name=\"args\"></param>\r\n        public virtual void LogWarning(string title, string messageFormat, params object[] args) \r\n        {\r\n            LogWarning(title, string.Format(CultureInfo.InvariantCulture, messageFormat, args));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"exception\"></param>\r\n        public virtual void LogWarning(string title, Exception exception) \r\n        {\r\n            LoggingService.LogWarning(title, exception);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"message\"></param>\r\n        public virtual void LogError(string title, string message)\r\n        {\r\n            LoggingService.LogError(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"messageFormat\"></param>\r\n        /// <param name=\"args\"></param>\r\n        public virtual void LogError(string title, string messageFormat, params object[] args) \r\n        {\r\n            LogError(title, string.Format(CultureInfo.InvariantCulture, messageFormat, args));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"exception\"></param>\r\n        public virtual void LogError(string title, Exception exception) \r\n        {\r\n            LoggingService.LogError(title, exception);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"message\"></param>\r\n        public virtual void LogCritical(string title, string message)\r\n        {\r\n            LoggingService.LogCritical(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"messageFormat\"></param>\r\n        /// <param name=\"args\"></param>\r\n        public virtual void LogCritical(string title, string messageFormat, params object[] args) \r\n        {\r\n            LoggingService.LogCritical(title, string.Format(CultureInfo.InvariantCulture, messageFormat, args));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Implementation pending\r\n        /// </summary>\r\n        /// <param name=\"title\"></param>\r\n        /// <param name=\"exception\"></param>\r\n        public virtual void LogCritical(string title, Exception exception) \r\n        {\r\n            LoggingService.LogCritical(title, exception);\r\n        }        \r\n    }\r\n\r\n    /// <summary>\r\n    /// IServiceCollection extensions\r\n    /// </summary>\r\n    public static class ServiceCollectionExtensions\r\n    {\r\n        /// <summary>\r\n        /// Registers logging service\r\n        /// </summary>\r\n        /// <param name=\"serviceCollection\">Collection onto register service</param>\r\n        public static void AddLogging(this IServiceCollection serviceCollection)\r\n        {\r\n            serviceCollection.AddSingleton(typeof(ILog), typeof(LogImplementation));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/PackageLicenseHelperImplementation.cs",
    "content": "﻿using System;\r\nusing System.Security.Cryptography;\r\nusing Composite.Core.PackageSystem;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// This is the default implementation of PackageLicenseHelper <see cref=\"Composite.Core.PackageSystem.PackageLicenseHelper\"/>\r\n    /// </summary>\r\n    public class PackageLicenseHelperImplementation\r\n    {\r\n        /// <summary>\r\n        /// <see cref=\"Composite.Core.PackageSystem.PackageLicenseHelper\"/>\r\n        /// </summary>\r\n        /// <param name=\"productId\"></param>\r\n        /// <returns></returns>\r\n        public virtual PackageLicenseDefinition GetLicenseDefinition(Guid productId)\r\n        {\r\n            return LicenseDefinitionManager.GetLicenseDefinition(productId);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// <see cref=\"Composite.Core.PackageSystem.PackageLicenseHelper\"/>\r\n        /// </summary>\r\n        /// <param name=\"licenseDefinition\"></param>\r\n        public virtual void StoreLicenseDefinition(PackageLicenseDefinition licenseDefinition)\r\n        {\r\n            LicenseDefinitionManager.StoreLicenseDefinition(licenseDefinition);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// <see cref=\"Composite.Core.PackageSystem.PackageLicenseHelper\"/>\r\n        /// </summary>\r\n        /// <param name=\"productId\"></param>\r\n        public virtual void RemoveLicenseDefinition(Guid productId)\r\n        {\r\n            LicenseDefinitionManager.RemoveLicenseDefintion(productId);\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// <see cref=\"Composite.Core.PackageSystem.PackageLicenseHelper\"/>\r\n        /// </summary>\r\n        /// <param name=\"publicKeyXml\"></param>\r\n        /// <returns></returns>\r\n        public virtual object CreateSignatureHashAlgorithm(string publicKeyXml)\r\n        {\r\n            return LicenseDefinitionUtils.CreateSignatureHashAlgorithm(publicKeyXml);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// <see cref=\"Composite.Core.PackageSystem.PackageLicenseHelper\"/>\r\n        /// </summary>\r\n        /// <param name=\"licenseKey\"></param>\r\n        /// <returns></returns>\r\n        public virtual byte[] GetLicenseKeyBytes(string licenseKey)\r\n        {\r\n            return LicenseDefinitionUtils.GetLicenseKeyBytes(licenseKey);\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// <see cref=\"Composite.Core.PackageSystem.PackageLicenseHelper\"/>\r\n        /// </summary>\r\n        /// <param name=\"signatureString\"></param>\r\n        /// <returns></returns>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1720:IdentifiersShouldNotContainTypeNames\", MessageId = \"string\", Justification = \"We want to call it signatureString\")]\r\n        public virtual byte[] CreateSignatureBytes(string signatureString)\r\n        {\r\n            return LicenseDefinitionUtils.CreateSignatureBytes(signatureString);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/PackageUtilsImplementation.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Plugins.Elements.ElementProviders.PackageElementProvider;\r\nusing Composite.Core.PackageSystem;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// This is the default implementaion for PackageUtils <see cref=\"Composite.Core.PackageSystem.PackageUtils\"/>\r\n    /// </summary>\r\n    [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1704:IdentifiersShouldBeSpelledCorrectly\", MessageId = \"Utils\")]\r\n    public class PackageUtilsImplementation\r\n    {\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"packageId\"></param>\r\n        /// <param name=\"groupName\"></param>\r\n        /// <returns></returns>\r\n        public virtual PackageElementProviderInstalledPackageItemEntityToken GetInstalledPackageEntityToken(Guid packageId, string groupName)\r\n        {\r\n            PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = new PackageElementProviderAvailablePackagesItemEntityToken(packageId.ToString(), groupName);\r\n            InstalledPackageInformation installedPackage = PackageManager.GetInstalledPackages().FirstOrDefault(f => f.Id == castedEntityToken.PackageId);\r\n            PackageElementProviderInstalledPackageItemEntityToken installedPackageEntityToken = new PackageElementProviderInstalledPackageItemEntityToken(\r\n                installedPackage.Id,\r\n                installedPackage.GroupName,\r\n                installedPackage.IsLocalInstalled,\r\n                installedPackage.CanBeUninstalled);\r\n\r\n            return installedPackageEntityToken;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/PageDataConnectionImplementation.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PageDataConnectionImplementation : DataConnectionBase, IDisposable\r\n    {\r\n        /// <exclude />\r\n        public PageDataConnectionImplementation()\r\n        {\r\n            InitializeScope();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public PageDataConnectionImplementation(PublicationScope scope, CultureInfo locale)\r\n        {\r\n            InitializeScope(scope, locale);\r\n        }\r\n\r\n\r\n\r\n     /*   public TData GetPageMetaData<TData>(string fieldName)\r\n            where TData : IPageMetaData\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        public TData GetPageMetaData<TData>(string fieldName, Guid pageId)\r\n            where TData : IPageMetaData\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<TData> GetPageMetaData<TData>(string fieldName, SitemapScope scope)\r\n            where TData : IPageMetaData\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<TData> GetPageMetaData<TData>(string fieldName, SitemapScope scope, Guid pageId)\r\n            where TData : IPageMetaData\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<TData> GetPageData<TData>()\r\n            where TData : IPageData\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<TData> GetPageData<TData>(SitemapScope scope)\r\n            where TData : IPageData\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<TData> GetPageData<TData>(SitemapScope scope, Guid sourcePageId)\r\n            where TData : IPageData\r\n        {\r\n            throw new NotImplementedException();\r\n        }*/\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~PageDataConnectionImplementation()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n\r\n        /// <exclude />\r\n        protected virtual void Dispose(bool disposing)\r\n        {\r\n            if (disposing)\r\n            {\r\n                // Dispose stuff\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/SitemapNavigatorImplementation.cs",
    "content": "﻿using System;\r\nusing System.Collections.ObjectModel;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\n\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Documentation pending\r\n    /// </summary>\r\n    [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\", Justification = \"We have decided to use Sitemap, not SiteMap\")]\r\n    public class SitemapNavigatorImplementation\r\n    {\r\n        private readonly Lazy<List<XElement>> _sitemap;\r\n        private readonly DataConnection _connection;\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Stateless constructor. This is used when implementations of static methods needs to be called\r\n        /// Used when CurrentPageId and CurrentHomePageId are called\r\n        /// </summary>\r\n        public SitemapNavigatorImplementation()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"connection\"></param>\r\n        public SitemapNavigatorImplementation(DataConnection connection)\r\n        {\r\n            _sitemap = new Lazy<List<XElement>>(() =>\r\n            {\r\n                using (new DataScope(connection.CurrentPublicationScope, connection.CurrentLocale))\r\n                {\r\n                    return PageStructureInfo.GetSiteMap().ToList();\r\n                }\r\n            });\r\n            \r\n            _connection = connection;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"id\"></param>\r\n        /// <returns></returns>\r\n        public virtual PageNode GetPageNodeById(Guid id)\r\n        {\r\n            var page = PageManager.GetPageById(id);\r\n\r\n            if (page == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new PageNode(page, this);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"HomePage\")]\r\n        public virtual IEnumerable<PageNode> HomePageNodes\r\n        {\r\n            get\r\n            {\r\n                return HomePageIds.Select(GetPageNodeById).Where(p => p != null);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"HomePage\")]\r\n        public virtual IEnumerable<Guid> HomePageIds\r\n        {\r\n            get\r\n            {\r\n                return PageManager.GetChildrenIDs(Guid.Empty);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual PageNode CurrentPageNode\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_sitemap, \"Missing sitemap. This class may have invalid state due to wrong construction.\");\r\n\r\n                return this.GetPageNodeById(PageRenderer.CurrentPageId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        /// <param name=\"hostname\"></param>\r\n        /// <returns></returns>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Hostname\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"hostname\")]\r\n        public virtual PageNode GetPageNodeByHostname(string hostname)\r\n        {\r\n            Guid pageId = Guid.Empty;\r\n            hostname = hostname.ToUpperInvariant();\r\n\r\n            // Getting the longest not-empty hostname that matches the right part of the current hostname\r\n            List<IHostnameBinding> hostNameMatches =\r\n                (from binding in _connection.Get<IHostnameBinding>() as IEnumerable<IHostnameBinding>\r\n                 where !binding.Hostname.IsNullOrEmpty()\r\n                       && hostname.EndsWith(binding.Hostname.ToUpperInvariant(), StringComparison.Ordinal)\r\n                 orderby binding.Hostname.Length descending\r\n                 select binding).Take(1).ToList();\r\n\r\n            if (hostNameMatches.Count > 0)\r\n            {\r\n                pageId = hostNameMatches[0].HomePageId;\r\n            }\r\n\r\n            if (pageId == Guid.Empty)\r\n            {\r\n                pageId = HomePageIds.FirstOrDefault();\r\n            }\r\n\r\n            return GetPageNodeById(pageId);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"HomePage\")]    \r\n        public virtual PageNode CurrentHomePageNode\r\n        {\r\n            get\r\n            {\r\n                var homePageId = CurrentHomePageId;\r\n                if (homePageId == Guid.Empty)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                return GetPageNodeById(homePageId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemaps\")]\r\n        public virtual ReadOnlyCollection<XElement> AllSitemapsXml\r\n        {\r\n            get\r\n            {\r\n                return _sitemap.Value.AsReadOnly();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\")]\r\n        public virtual XElement SitemapXml\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_sitemap, \"Missing sitemap. This class may have invalid state due to wrong construction.\");\r\n                Verify.That(this.CurrentPageId != Guid.Empty, \"No current page Id could be located\");\r\n\r\n                XElement pageElement = this.GetElementByPageId(this.CurrentPageId);\r\n\r\n                while (pageElement.Parent!=null)\r\n                {\r\n                    pageElement = pageElement.Parent;\r\n                }\r\n\r\n                return pageElement;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Documentation pending\r\n        /// </summary>\r\n        public virtual Guid CurrentPageId\r\n        {\r\n            get\r\n            {\r\n                return PageRenderer.CurrentPageId;\r\n            }\r\n        }\r\n\r\n\r\n        \r\n        /// <summary>        \r\n        /// Documentation pending\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"HomePage\")]\r\n        public virtual Guid CurrentHomePageId\r\n        {\r\n            get\r\n            {\r\n                Guid pageId = this.CurrentPageId;\r\n\r\n                while (true)\r\n                {\r\n                    Guid parentId = PageManager.GetParentId(pageId);\r\n                    if (parentId == Guid.Empty)\r\n                    {\r\n                        return pageId;\r\n                    }\r\n                    pageId = parentId;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        internal XElement GetElementByPageId(Guid id)\r\n        {\r\n            string idString = id.ToString();\r\n\r\n            XAttribute matchAttribute = _sitemap.Value.DescendantsAndSelf(PageStructureInfo.ElementNames.Page)\r\n                                                      .Attributes(PageStructureInfo.AttributeNames.Id)\r\n                                                      .FirstOrDefault(f => f.Value == idString);\r\n\r\n            return matchAttribute != null ? matchAttribute.Parent : null ;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Implementation/StatelessDataConnectionImplementation.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Core.Implementation\r\n{\r\n    /// <summary>\r\n    /// Base class for the implementation of the static methods on the <see cref=\"DataConnection \"/> class.\r\n    /// </summary>\r\n    public class StatelessDataConnectionImplementation\r\n    {\r\n        /// <summary>\r\n        /// Creates a new data object of the given type.\r\n        /// </summary>\r\n        /// <typeparam name=\"TData\">The data type.</typeparam>\r\n        /// <returns></returns>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1716:IdentifiersShouldNotMatchKeywords\", MessageId = \"New\", Justification = \"This is what we want\")]\r\n        public virtual TData New<TData>()\r\n            where TData : class, IData\r\n        {\r\n            return DataFacade.BuildNew<TData>();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// All locales added to C1.\r\n        /// </summary>\r\n        public virtual IEnumerable<CultureInfo> AllLocales => \r\n            DataLocalizationFacade.ActiveLocalizationCultures;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/DisposableResourceTracer.cs",
    "content": "﻿using Composite.C1Console.Events;\nusing Composite.Core.IO;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml.Linq;\n\nnamespace Composite.Core.Instrumentation\n{\n#if LeakCheck\n    /// <summary>\n    /// This class only provide functionality if the conditional compilation symbol #LeakCheck is defined. \n    /// See the <see cref=\"RegisterFinalizerExecution(string)\"/> method for how to feed this class data.\n    /// When appPool shuts down a xml file with stack traces and count will be written to the root. This file indicate areas where (tooled) IDisposable classes were not\n    /// disposed as expected.\n    /// </summary>\n    public static class DisposableResourceTracer\n    {\n        private static Dictionary<string, int> stacks = new Dictionary<string, int>();\n        private static object _lock = new object();\n        private static object _dumpLock = new object();\n        private static bool dumpAlways = false;\n        private const string _redundant = @\"   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)\n   at System.Environment.get_StackTrace()\n\";\n\n\n        /// <exclude />\n        public static readonly DateTime TraceStart = DateTime.Now;\n\n        static DisposableResourceTracer()\n        {\n            GlobalEventSystemFacade.SubscribeToShutDownEvent(OnShutDownEvent);\n        }\n\n        private static void OnShutDownEvent(ShutDownEventArgs args)\n        {\n            dumpAlways = true;\n            DumpStacks();\n        }\n\n        /// Register a stack trace - expected usage if for this to be called from IDisposable finalizers, indicating they did not dispose as expected from user code.\n        /// <example>\n        /// #if LeakCheck\n        ///     private string stack = Environment.StackTrace;\n        ///     ~MyDisposableClass()\n        ///     {\n        ///         Composite.Core.Instrumentation.DisposableResourceTracer.Register(stack);\n        ///     }\n        /// #endif\n        /// </example>\n        /// You should ensure finalizer is not called, when Dispose() execute as expected. Put the following inside your Dispose() method:\n        /// <example>\n        /// #if LeakCheck\n        ///     GC.SuppressFinalize(this);\n        /// #endif\n        /// </example>\n        public static void RegisterFinalizerExecution(string stack)\n        {\n            lock (_lock)\n            {\n                string topStack = GetMinimalStackTop(stack);\n                int count = 0;\n                if (stacks.TryGetValue(topStack, out count))\n                {\n                    stacks[topStack] = count + 1;\n                }\n                else\n                {\n                    stacks.Add(topStack, 1);\n                }\n            }\n\n            if (dumpAlways) DumpStacks();\n        }\n\n        private static void DumpStacks()\n        {\n            string rootDir = PathUtil.Resolve(\"~/\");\n            string fileName = String.Format(\"DisposableResourceTrace_{0}.xml\", TraceStart.ToString(\"yyyy_MM_dd_HH_mm_ss\"));\n            string fullPath = Path.Combine(rootDir, fileName);\n\n            var stacks = GetStacks();\n\n            var ordered = stacks.OrderByDescending(f => f.Value);\n\n            XElement dumpDoc = new XElement(\"DisposableResourceTrace\"\n                , new XAttribute(\"start\", TraceStart)\n                , new XAttribute(\"end\", DateTime.Now)\n                , new XAttribute(\"seconds\", (DateTime.Now - TraceStart).TotalSeconds)\n                );\n            dumpDoc.Add(\n                ordered.Select(f => new XElement(\"Trace\", new XAttribute(\"count\", f.Value), f.Key))\n                );\n\n            lock (_dumpLock)\n            {\n                dumpDoc.Save(fullPath);\n            }\n        }\n\n        private static string GetMinimalStackTop(string stack)\n        {\n            string[] stackLines = stack.Replace(_redundant,\"\").Split(new string[] { Environment.NewLine }, StringSplitOptions.None);\n\n            bool foundCaller = false;\n            int lineNum = 1;\n\n            StringBuilder sb = new StringBuilder(stackLines[0]+\"\\n\");\n\n            while(!foundCaller && lineNum < stackLines.Length)\n            {\n                string line = stackLines[lineNum];\n                sb.AppendLine(line);\n                foundCaller = line.TrimStart().StartsWith(\"at Composite.\") && !line.Contains(\"..ctor\") && !line.Contains(\".get_\") && !line.Contains(\".Threading.\");\n                lineNum++;\n            }\n\n            return sb.ToString();\n        }\n\n        /// <summary>\n        /// Returns the currently registered stacks - since stacks are typically only registered when GC Generation 2 heap is cleaned - and this happens rarely - the result here is not guaranteed to be complete...\n        /// </summary>\n        /// <returns></returns>\n        public static Dictionary<string, int> GetStacks()\n        {\n            lock (_lock)\n            {\n                return new Dictionary<string, int>(stacks);\n            }\n        }\n    }\n#endif\n}\n\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Foundation/IPerformanceCounterProviderRegistry.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Core.Instrumentation.Foundation\r\n{\r\n\tinternal interface IPerformanceCounterProviderRegistry\r\n\t{\r\n        string DefaultPerformanceCounterProviderName { get; }\r\n        void Flush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Foundation/NoopTimerProfiler.cs",
    "content": "﻿namespace Composite.Core.Instrumentation.Foundation\r\n{\r\n    internal sealed class NoopTimerProfiler : TimerProfiler\r\n\t{\r\n        public static NoopTimerProfiler Instance { get; } = new NoopTimerProfiler();\r\n\r\n        public override void Dispose()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Foundation/PerformanceCounterProviderRegistry.cs",
    "content": "﻿using Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Foundation\r\n{\r\n\tinternal static class PerformanceCounterProviderRegistry\r\n\t{\r\n    private static IPerformanceCounterProviderRegistry _implementation = new PerformanceCounterProviderRegistryImpl();\r\n\r\n\r\n        internal static IPerformanceCounterProviderRegistry Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        static PerformanceCounterProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static string DefaultPerformanceCounterProviderName\r\n        {\r\n            get\r\n            {\r\n                return _implementation.DefaultPerformanceCounterProviderName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _implementation.Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Foundation/PerformanceCounterProviderRegistryImpl.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Composite.Core.Instrumentation.Plugin.Runtime;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Foundation\r\n{\r\n    internal sealed class PerformanceCounterProviderRegistryImpl : IPerformanceCounterProviderRegistry\r\n\t{\r\n        private string _defaultPerformanceCounterProviderName = null;\r\n\r\n\r\n        public string DefaultPerformanceCounterProviderName\r\n        {\r\n            get\r\n            {\r\n                if (_defaultPerformanceCounterProviderName == null)\r\n                {\r\n                    PerformanceCounterProviderSettings parallelizationProviderSettings = ConfigurationServices.ConfigurationSource.GetSection(PerformanceCounterProviderSettings.SectionName) as PerformanceCounterProviderSettings;\r\n\r\n                    _defaultPerformanceCounterProviderName = parallelizationProviderSettings.DefaultPerformanceCounterProviderName;\r\n                }\r\n\r\n                return _defaultPerformanceCounterProviderName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _defaultPerformanceCounterProviderName = null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Foundation/PluginFacades/PerformanceCounterProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Instrumentation.Plugin;\r\nusing Composite.Core.Instrumentation.Plugin.Runtime;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Foundation.PluginFacades\r\n{\r\n    internal static class PerformanceCounterProviderPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static PerformanceCounterProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static void SystemStartupIncrement(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    provider.SystemStartupIncrement();\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public static IPerformanceCounterToken BeginElementCreation(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    return provider.BeginElementCreation();\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public static void EndElementCreation(string providerName, IPerformanceCounterToken performanceToken, int resultElementCount, int totalElementCount)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    provider.EndElementCreation(performanceToken, resultElementCount, totalElementCount);\r\n                }\r\n        }\r\n\r\n        \r\n\r\n        public static IPerformanceCounterToken BeginAspNetControlCompile(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    return provider.BeginAspNetControlCompile();\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public static void EndAspNetControlCompile(string providerName, IPerformanceCounterToken performanceToken, int controlsCompiledCount)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    provider.EndAspNetControlCompile(performanceToken, controlsCompiledCount);\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public static IPerformanceCounterToken BeginPageHookCreation(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    return provider.BeginPageHookCreation();\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public static void EndPageHookCreation(string providerName, IPerformanceCounterToken performanceToken, int controlsCompiledCount)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    provider.EndPageHookCreation(performanceToken, controlsCompiledCount);\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public static void EntityTokenParentCacheHitIncrement(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    provider.EntityTokenParentCacheHitIncrement();\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public static void EntityTokenParentCacheMissIncrement(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IPerformanceCounterProvider provider = GetPerformanceCounterProvider(providerName);\r\n\r\n                    provider.EntityTokenParentCacheMissIncrement();\r\n                }\r\n        }\r\n\r\n        \r\n        \r\n        private static IPerformanceCounterProvider GetPerformanceCounterProvider(string providerName)\r\n        {\r\n            IPerformanceCounterProvider provider;\r\n\r\n            if (_resourceLocker.Resources.ProviderCache.TryGetValue(providerName, out provider) == false)\r\n            {\r\n                try\r\n                {\r\n                    provider = _resourceLocker.Resources.Factory.Create(providerName);\r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (_resourceLocker.Resources.ProviderCache.ContainsKey(providerName) == false)\r\n                        {\r\n                            _resourceLocker.Resources.ProviderCache.Add(providerName, provider);\r\n                        }\r\n                    }\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n            return provider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", PerformanceCounterProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public PerformanceCounterProviderFactory Factory { get; set; }\r\n            public Dictionary<string, IPerformanceCounterProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new PerformanceCounterProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Dictionary<string, IPerformanceCounterProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/IPerformanceCounterFacade.cs",
    "content": "﻿using Composite.Core.Instrumentation.Plugin;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n\tinternal interface IPerformanceCounterFacade\r\n\t{\r\n        void SystemStartupIncrement();\r\n\r\n        IPerformanceCounterToken BeginElementCreation();\r\n        void EndElementCreation(IPerformanceCounterToken performanceToken, int resultElementCount, int totalElementCount);\r\n\r\n        IPerformanceCounterToken BeginAspNetControlCompile();\r\n        void EndAspNetControlCompile(IPerformanceCounterToken performanceToken, int controlsCompiledCount);\r\n\r\n        IPerformanceCounterToken BeginPageHookCreation();\r\n        void EndPageHookCreation(IPerformanceCounterToken performanceToken, int controlsCompiledCount);\r\n\r\n        void EntityTokenParentCacheHitIncrement();\r\n        void EntityTokenParentCacheMissIncrement();\r\n\r\n        void Flush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/IPerformanceCounterToken.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IPerformanceCounterToken : IDisposable\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/LogExecutionTime.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n    /// <summary>\r\n    /// Logs execution time of the nested code\r\n    /// </summary>\r\n    internal class LogExecutionTime : IDisposable\r\n    {\r\n        private readonly string _message;\r\n        private readonly int _startTime;\r\n        private readonly string _logTitle;\r\n\r\n        public LogExecutionTime(string logTitle, string message)\r\n        {\r\n            _logTitle = logTitle;\r\n            _message = message;\r\n            _startTime = Environment.TickCount;\r\n            Log.LogVerbose(_logTitle, \"Starting: \" + _message);\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n            int executionTime = Environment.TickCount - _startTime;\r\n            Log.LogVerbose(_logTitle, \"Finished: \" + _message + \" ({0} ms)\".FormatWith(executionTime));\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~LogExecutionTime()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Measurement.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Measurement\r\n    {\r\n        private List<Measurement> _nodes;\r\n        private List<Measurement> _parallelNodes;\r\n\r\n        /// <exclude />\r\n        public Measurement(string name)\r\n        {\r\n            Name = name;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Total execution time in microseconds (10^-6)\r\n        /// </summary>\r\n        public long TotalTime;\r\n\r\n        /// <exclude />\r\n        public long MemoryUsage;\r\n\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public Func<EntityToken> EntityTokenFactory  { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<Measurement> Nodes \r\n        { \r\n            get\r\n            {\r\n                if(_nodes == null)\r\n                {\r\n                    _nodes = new List<Measurement>();\r\n                }\r\n\r\n                return _nodes;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public object SyncRoot { get { return this; } }\r\n\r\n        /// <exclude />\r\n        public List<Measurement> ParallelNodes\r\n        {\r\n            get\r\n            {\r\n                if (_parallelNodes == null)\r\n                {\r\n                    _parallelNodes = new List<Measurement>();\r\n                }\r\n\r\n                return _parallelNodes;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Instrumentation/PerformanceCounterFacade.cs",
    "content": "﻿using Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class PerformanceCounterFacade\r\n\t{\r\n        private static IPerformanceCounterFacade _implementation = new PerformanceCounterFacadeImpl();\r\n\r\n\r\n        internal static IPerformanceCounterFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n        \r\n\r\n\r\n        static PerformanceCounterFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SystemStartupIncrement()\r\n        {\r\n            _implementation.SystemStartupIncrement();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IPerformanceCounterToken BeginElementCreation()\r\n        {\r\n            return _implementation.BeginElementCreation();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"performanceToken\">The token returned by BeginElementCreation</param>\r\n        /// <param name=\"resultElementCount\">Element count after security filtering</param>\r\n        /// <param name=\"totalElementCount\">Element count before security filtering</param>\r\n        public static void EndElementCreation(IPerformanceCounterToken performanceToken, int resultElementCount, int totalElementCount)\r\n        {\r\n            _implementation.EndElementCreation(performanceToken, resultElementCount, totalElementCount);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IPerformanceCounterToken BeginAspNetControlCompile()\r\n        {\r\n            return _implementation.BeginAspNetControlCompile();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void EndAspNetControlCompile(IPerformanceCounterToken performanceToken, int controlsCompiledCount)\r\n        {\r\n            _implementation.EndAspNetControlCompile(performanceToken, controlsCompiledCount);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IPerformanceCounterToken BeginPageHookCreation()\r\n        {\r\n            return _implementation.BeginPageHookCreation();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void EndPageHookCreation(IPerformanceCounterToken performanceToken, int controlsCompiledCount)\r\n        {\r\n            _implementation.EndPageHookCreation(performanceToken, controlsCompiledCount);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void EntityTokenParentCacheHitIncrement()\r\n        {\r\n            _implementation.EntityTokenParentCacheHitIncrement();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void EntityTokenParentCacheMissIncrement()\r\n        {\r\n            _implementation.EntityTokenParentCacheMissIncrement();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.Flush();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/PerformanceCounterFacadeImpl.cs",
    "content": "﻿using Composite.Core.Instrumentation.Foundation;\r\nusing Composite.Core.Instrumentation.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n\tinternal sealed class PerformanceCounterFacadeImpl : IPerformanceCounterFacade\r\n\t{\r\n        public void SystemStartupIncrement()\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            PerformanceCounterProviderPluginFacade.SystemStartupIncrement(providerName);\r\n        }\r\n\r\n\r\n\r\n        public IPerformanceCounterToken BeginElementCreation()\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            return PerformanceCounterProviderPluginFacade.BeginElementCreation(providerName);\r\n        }\r\n\r\n\r\n\r\n        public void EndElementCreation(IPerformanceCounterToken performanceToken, int resultElementCount, int totalElementCount)\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            PerformanceCounterProviderPluginFacade.EndElementCreation(providerName, performanceToken, resultElementCount, totalElementCount);\r\n        }\r\n\r\n\r\n\r\n        public IPerformanceCounterToken BeginAspNetControlCompile()\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            return PerformanceCounterProviderPluginFacade.BeginAspNetControlCompile(providerName);\r\n        }\r\n\r\n\r\n\r\n        public void EndAspNetControlCompile(IPerformanceCounterToken performanceToken, int controlsCompiledCount)\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            PerformanceCounterProviderPluginFacade.EndAspNetControlCompile(providerName, performanceToken, controlsCompiledCount);\r\n        }\r\n\r\n\r\n\r\n        public IPerformanceCounterToken BeginPageHookCreation()\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            return PerformanceCounterProviderPluginFacade.BeginPageHookCreation(providerName);\r\n        }\r\n\r\n\r\n\r\n        public void EndPageHookCreation(IPerformanceCounterToken performanceToken, int controlsCompiledCount)\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            PerformanceCounterProviderPluginFacade.EndPageHookCreation(providerName, performanceToken, controlsCompiledCount);\r\n        }\r\n\r\n\r\n\r\n        public void EntityTokenParentCacheHitIncrement()\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            PerformanceCounterProviderPluginFacade.EntityTokenParentCacheHitIncrement(providerName);\r\n        }\r\n\r\n\r\n\r\n        public void EntityTokenParentCacheMissIncrement()\r\n        {\r\n            string providerName = PerformanceCounterProviderRegistry.DefaultPerformanceCounterProviderName;\r\n\r\n            PerformanceCounterProviderPluginFacade.EntityTokenParentCacheMissIncrement(providerName);\r\n        }\r\n\r\n\r\n        public void Flush()\r\n        {            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Plugin/IPerformanceCounterProvider.cs",
    "content": "﻿using Composite.Core.Instrumentation.Plugin.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Plugin\r\n{\r\n    [CustomFactory(typeof(PerformanceCounterProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(PerformanceCounterProviderDefaultNameRetriever))]\r\n\tinternal interface IPerformanceCounterProvider\r\n\t{\r\n        void SystemStartupIncrement();\r\n\r\n        IPerformanceCounterToken BeginElementCreation();\r\n        void EndElementCreation(IPerformanceCounterToken performanceToken, int resultElementCount, int totalElementCount);\r\n\r\n        IPerformanceCounterToken BeginAspNetControlCompile();\r\n        void EndAspNetControlCompile(IPerformanceCounterToken performanceToken, int controlsCompiledCount);\r\n\r\n        IPerformanceCounterToken BeginPageHookCreation();\r\n        void EndPageHookCreation(IPerformanceCounterToken performanceToken, int pageCount);\r\n\r\n        void EntityTokenParentCacheHitIncrement();\r\n        void EntityTokenParentCacheMissIncrement();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Plugin/NonConfigurablePerformanceCounterProvider.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Plugin\r\n{\r\n    [Assembler(typeof(NonConfigurablePerformanceCounterProviderAssembler))]\r\n    internal class NonConfigurablePerformanceCounterProvider : PerformanceCounterProviderData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurablePerformanceCounterProviderAssembler : IAssembler<IPerformanceCounterProvider, PerformanceCounterProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IPerformanceCounterProvider Assemble(IBuilderContext context, PerformanceCounterProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IPerformanceCounterProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Plugin/PerformanceCounterProviderData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Plugin\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurablePerformanceCounterProvider))]\r\n    internal class PerformanceCounterProviderData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Plugin/Runtime/PerformanceCounterProviderCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Plugin.Runtime\r\n{\r\n    internal sealed class PerformanceCounterProviderCustomFactory : AssemblerBasedCustomFactory<IPerformanceCounterProvider, PerformanceCounterProviderData>\r\n\t{\r\n        protected override PerformanceCounterProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            PerformanceCounterProviderSettings settings = configurationSource.GetSection(PerformanceCounterProviderSettings.SectionName) as PerformanceCounterProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", PerformanceCounterProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.PerformanceCounterProviderPlugins.Get(name);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Plugin/Runtime/PerformanceCounterProviderDefaultNameRetriever.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Plugin.Runtime\r\n{\r\n    internal sealed class PerformanceCounterProviderDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Plugin/Runtime/PerformanceCounterProviderFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Plugin.Runtime\r\n{\r\n    internal sealed class PerformanceCounterProviderFactory : NameTypeFactoryBase<IPerformanceCounterProvider>\r\n\t{\r\n        public PerformanceCounterProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Plugin/Runtime/PerformanceCounterProviderSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation.Plugin.Runtime\r\n{\r\n\tinternal sealed class PerformanceCounterProviderSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.Core.Instrumentation.Plugin.Runtime.PerformanceCounterProviderConfiguration\";\r\n\r\n\r\n        private const string _defaultPerformanceCounterProviderNameProperty = \"defaultPerformanceCounterProviderName\";\r\n        [ConfigurationProperty(_defaultPerformanceCounterProviderNameProperty, IsRequired = true)]\r\n        public string DefaultPerformanceCounterProviderName\r\n        {\r\n            get { return (string)base[_defaultPerformanceCounterProviderNameProperty]; }\r\n            set { base[_defaultPerformanceCounterProviderNameProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _performanceCounterProviderPluginsProperty = \"PerformanceCounterProviderPlugins\";\r\n        [ConfigurationProperty(_performanceCounterProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<PerformanceCounterProviderData> PerformanceCounterProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<PerformanceCounterProviderData>)base[_performanceCounterProviderPluginsProperty];\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/Profiler.cs",
    "content": "#define ProfileMemory\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Threading;\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class Profiler\r\n    {\r\n        private static readonly string ProfilerKey = typeof (Profiler).FullName;\r\n        // private static readonly IEnumerable<Measurement> EmptyReport = new Measurement[0];\r\n\r\n\r\n        /// <exclude />\r\n        public static void BeginProfiling()\r\n        {\r\n            if (Disabled) return;\r\n\r\n            ThreadDataManagerData threadData = ThreadDataManager.Current;\r\n\r\n            Verify.That(!threadData.HasValue(ProfilerKey), \"Profiler has already been initialized\");\r\n\r\n            var stack = new Stack<Measurement>();\r\n            stack.Push(new Measurement(\"Root\") { MemoryUsage = GC.GetTotalMemory(true) });\r\n            threadData.SetValue(ProfilerKey,  stack);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Measurement EndProfiling()\r\n        {\r\n            var threadData = ThreadDataManager.GetCurrentNotNull();\r\n\r\n            var stack = threadData[ProfilerKey] as Stack<Measurement>;\r\n\r\n            Verify.That(stack.Count == 1, \"Performance node stack should have exactly one (the root) node\");\r\n\r\n            threadData.SetValue(ProfilerKey, null);\r\n\r\n            var measurement = stack.Pop();\r\n\r\n            measurement.MemoryUsage = GC.GetTotalMemory(false) - measurement.MemoryUsage;\r\n\r\n            return measurement;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IDisposable Measure(string name)\r\n        {\r\n            return Measure(name, null);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IDisposable Measure(string name, Func<EntityToken> entityTokenFactory)\r\n        {\r\n            if (Disabled) return EmptyDisposable.Instance;\r\n\r\n            Measurement currentNode;\r\n            Stack<Measurement> stack;\r\n            bool isInParallel;\r\n\r\n            if (!GetCurrentNode(out currentNode, out stack, out isInParallel))\r\n            {\r\n                return EmptyDisposable.Instance;\r\n            }\r\n\r\n            Stack<Measurement> newNodeStack;\r\n\r\n            if (isInParallel)\r\n            {\r\n                ThreadDataManagerData currentThreadData = ThreadDataManager.Current;\r\n\r\n                if (currentThreadData.HasValue(currentThreadData))\r\n                {\r\n                    newNodeStack = currentThreadData[ProfilerKey] as Stack<Measurement>;\r\n                }\r\n                else\r\n                {\r\n                    newNodeStack = new Stack<Measurement>();\r\n                    currentThreadData.SetValue(ProfilerKey, newNodeStack);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                newNodeStack = stack;\r\n            }\r\n\r\n            return new InfoCollector(currentNode, name, isInParallel, newNodeStack, entityTokenFactory);\r\n        }\r\n\r\n        private static bool GetCurrentNode(\r\n            out Measurement parentNode, \r\n            out Stack<Measurement> stack,\r\n            out bool isInParallel)\r\n        {\r\n            if (Disabled)\r\n            {\r\n                parentNode = null;\r\n                stack = null;\r\n                isInParallel = false;\r\n                return false;\r\n            }\r\n\r\n            ThreadDataManagerData currentThreadData = ThreadDataManager.Current;\r\n            ThreadDataManagerData threadData = currentThreadData;\r\n\r\n            isInParallel = false;\r\n            while (threadData != null)\r\n            {\r\n                if (threadData.HasValue(ProfilerKey))\r\n                {\r\n                    stack = threadData[ProfilerKey] as Stack<Measurement>;\r\n\r\n                    if (stack.Count > 0)\r\n                    {\r\n                        parentNode = stack.Peek();\r\n\r\n                        return true;\r\n                    }\r\n                }\r\n\r\n                // Going to parent thread\r\n                threadData = threadData.Parent;\r\n                isInParallel = true;\r\n            }\r\n\r\n            stack = null;\r\n            parentNode = null;\r\n            return false;\r\n        }\r\n\r\n        private class InfoCollector : IDisposable\r\n        {\r\n            private readonly Measurement _node;\r\n            private readonly Stopwatch _stopwatch;\r\n            private readonly Stack<Measurement> _stack;\r\n\r\n            public InfoCollector(Measurement parentNode, string name, bool isInParallel, Stack<Measurement> stack, Func<EntityToken> entityTokenFactory)\r\n            {\r\n                _stack = stack;\r\n\r\n                _node = new Measurement(name)\r\n                {\r\n                    EntityTokenFactory = entityTokenFactory,\r\n#if ProfileMemory\r\n                    MemoryUsage = GC.GetTotalMemory(false)\r\n#endif\r\n                };\r\n\r\n\r\n\r\n\r\n                if (isInParallel)\r\n                {\r\n                    lock (parentNode.SyncRoot)\r\n                    {\r\n                        parentNode.ParallelNodes.Add(_node);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    parentNode.Nodes.Add(_node);\r\n                }\r\n\r\n                stack.Push(_node);\r\n                \r\n                _stopwatch = Stopwatch.StartNew();\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                _stopwatch.Stop();\r\n\r\n                _node.TotalTime = (_stopwatch.ElapsedTicks*1000000) / Stopwatch.Frequency;\r\n\r\n#if ProfileMemory\r\n                _node.MemoryUsage = GC.GetTotalMemory(false) - _node.MemoryUsage;\r\n#endif\r\n\r\n                _stack.Pop();\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~InfoCollector()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n\r\n        internal static void AddSubMeasurement(Measurement measurement)\r\n        {\r\n            Verify.ArgumentNotNull(measurement, \"measurement\");\r\n\r\n            Measurement currentNode;\r\n            Stack<Measurement> stack;\r\n            bool isInParallel;\r\n\r\n            if (!GetCurrentNode(out currentNode, out stack, out isInParallel))\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (isInParallel)\r\n            {\r\n                lock (currentNode.SyncRoot)\r\n                {\r\n                    currentNode.ParallelNodes.Add(measurement);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                currentNode.Nodes.Add(measurement);\r\n            }\r\n        }\r\n\r\n        private static bool Disabled => false;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/ProfilerReport.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.WebClient;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ProfilerReport\r\n    {\r\n        private static readonly string ProfilerXslPath = UrlUtils.AdminRootPath + \"/Transformations/page_profiler.xslt\";\r\n\r\n        /// <exclude />\r\n        public static string BuildReport(Measurement measurement, string url)\r\n        {\r\n            string xmlHeader = $@\"<?xml version=\"\"1.0\"\"?>\r\n                             <?xml-stylesheet type=\"\"text/xsl\"\" href=\"\"{ProfilerXslPath}\"\"?>\";\r\n\r\n            XElement reportXml = ProfilerReport.BuildReportXml(measurement);\r\n\r\n            reportXml.Add(new XAttribute(\"url\", url),\r\n                new XAttribute(\"consoleUrl\", UrlUtils.AdminRootPath));\r\n\r\n            return xmlHeader + reportXml;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static XElement BuildReportXml(Measurement measurement)\r\n        {\r\n            int index = 0;\r\n\r\n            var result = new XElement(\"Measurements\", new XAttribute(\"MemoryUsageKb\", measurement.MemoryUsage / 1024));\r\n\r\n            foreach (var node in measurement.Nodes)\r\n            {\r\n                result.Add(BuildReportXmlRec(node, node.TotalTime, node.TotalTime, false, index.ToString()));\r\n                index++;\r\n            }\r\n\r\n            foreach (var node in measurement.ParallelNodes)\r\n            {\r\n                result.Add(BuildReportXmlRec(node, node.TotalTime, node.TotalTime, true, index.ToString()));\r\n                index++;\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static XElement BuildReportXmlRec(Measurement measurement, /* int level,*/ long totalTime, long parentTime, bool parallel, string id)\r\n        {\r\n            long persentTotal = (measurement.TotalTime * 100) / totalTime;\r\n\r\n            long ownTime = measurement.TotalTime - measurement.Nodes.Select(childNode => childNode.TotalTime).Sum();\r\n\r\n            var entityToken = measurement.EntityTokenFactory?.Invoke();\r\n            string serializedEntityToken = entityToken != null\r\n                ? EntityTokenSerializer.Serialize(entityToken, true)\r\n                : null;\r\n\r\n            var result = new XElement(\"Measurement\",\r\n                                      new XAttribute(\"_id\", id),\r\n                                      new XAttribute(\"title\", measurement.Name),\r\n                                      new XAttribute(\"totalTime\", measurement.TotalTime),\r\n                                      new XAttribute(\"ownTime\", ownTime),\r\n                                      new XAttribute(\"persentFromTotal\", persentTotal),\r\n                                      new XAttribute(\"parallel\", parallel.ToString().ToLowerInvariant()));\r\n\r\n            if (serializedEntityToken != null)\r\n            {\r\n                result.Add(new XAttribute(\"entityToken\", serializedEntityToken));\r\n            }\r\n\r\n            if (measurement.MemoryUsage != 0)\r\n            {\r\n                result.Add(new XAttribute(\"memoryUsageKb\", measurement.MemoryUsage / 1024));\r\n            }\r\n\r\n            int index = 0;\r\n            foreach (var childNode in measurement.Nodes)  // .OrderByDescending(c => c.TotalTime)\r\n            {\r\n                result.Add(BuildReportXmlRec(childNode, totalTime, measurement.TotalTime, false, (id + \"|\" + index)));\r\n                index++;\r\n            }\r\n\r\n            foreach (var childNode in measurement.ParallelNodes) // .OrderByDescending(c => c.TotalTime)\r\n            {\r\n                result.Add(BuildReportXmlRec(childNode, totalTime, measurement.TotalTime, true, (id + \"|\" + index)));\r\n                index++;\r\n            }  \r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/TimerProfiler.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class TimerProfiler : IDisposable\r\n    {\r\n        internal TimerProfiler()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public abstract void Dispose();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Instrumentation/TimerProfilerFacade.cs",
    "content": "﻿//#define PROFILE_MODE\r\nusing Composite.Core.Instrumentation.Foundation;\r\n\r\n\r\nnamespace Composite.Core.Instrumentation\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class TimerProfilerFacade\r\n    {\r\n        /// <exclude />\r\n        public static TimerProfiler CreateTimerProfiler()\r\n        {\r\n#if PROFILE_MODE\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                return new XmlTimerProfiler();\r\n            }\r\n#endif\r\n            return NoopTimerProfiler.Instance;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static TimerProfiler CreateTimerProfiler(string message)\r\n        {\r\n#if PROFILE_MODE\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                return new XmlTimerProfiler(message);\r\n            }\r\n#endif\r\n            return NoopTimerProfiler.Instance;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Linq/ExpressionBuilder.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    internal class ExpressionBuilder\r\n    {\r\n        private Type _currentQueryableType;\r\n        private readonly IQueryable _sourceQueryable;\r\n        private Expression _currentExpression;\r\n\r\n        private static readonly PropertyInfo _dateDateTimePropertyInfo = typeof(DateTime).GetProperty(\"Date\");\r\n\r\n\r\n        public ExpressionBuilder(Type queryableType, IQueryable sourceQueryable)\r\n        {\r\n\r\n            _sourceQueryable = sourceQueryable;\r\n            _currentExpression = _sourceQueryable.Expression;\r\n            _currentQueryableType = queryableType;\r\n        }\r\n\r\n\r\n        public Type QueryableType { get; private set; }\r\n\r\n\r\n\r\n        public ExpressionBuilder Where(PropertyInfoValueCollection propertyInfoValueCollection)\r\n        {\r\n            return Where(propertyInfoValueCollection, false);\r\n        }\r\n\r\n\r\n\r\n        public ExpressionBuilder Where(PropertyInfoValueCollection propertyInfoValueCollection, bool useInnerDateTimeDate)\r\n        {\r\n            ParameterExpression parameterExpression = Expression.Parameter(_currentQueryableType, \"w\");\r\n\r\n            Expression currentExpression = null;\r\n            foreach (var kvp in propertyInfoValueCollection.PropertyValues)\r\n            {\r\n                Expression left = LambdaExpression.Property(parameterExpression, kvp.Key);                \r\n                Expression right = Expression.Constant(kvp.Value, kvp.Key.PropertyType);\r\n\r\n                if (useInnerDateTimeDate && kvp.Key.PropertyType == typeof(DateTime))\r\n                {\r\n                    left = InnerDateTimeDateExpression(left);\r\n                    right = InnerDateTimeDateExpression(right);\r\n                }\r\n\r\n                Expression filter = Expression.Equal(left, right);\r\n\r\n                if (currentExpression == null)\r\n                {\r\n                    currentExpression = filter;\r\n                }\r\n                else\r\n                {\r\n                    currentExpression = Expression.And(currentExpression, filter);\r\n                }\r\n            }\r\n\r\n            LambdaExpression lambdaExpression = Expression.Lambda(currentExpression, parameterExpression);\r\n\r\n            MethodCallExpression methodCallExpression = Expression.Call\r\n            (\r\n                typeof(Queryable),\r\n                \"Where\",\r\n                new Type[] { _currentQueryableType, },\r\n                _currentExpression,\r\n                Expression.Quote(lambdaExpression)\r\n            );\r\n\r\n            _currentExpression = methodCallExpression;\r\n\r\n            return this;\r\n        }\r\n\r\n\r\n\r\n        public ExpressionBuilder OrderBy(PropertyInfo orderByPropertyInfo, bool useInnerDateTimeDate, bool orderDescending)\r\n        {\r\n            ParameterExpression parameter = Expression.Parameter(_currentQueryableType, \"o\");\r\n\r\n            Expression expression = Expression.Property(parameter, orderByPropertyInfo);\r\n            if ((useInnerDateTimeDate) && (orderByPropertyInfo.PropertyType == typeof(DateTime)))\r\n            {\r\n                expression = InnerDateTimeDateExpression(expression);\r\n            }\r\n\r\n\r\n            LambdaExpression lambdaExpression = Expression.Lambda(expression, parameter);\r\n\r\n            MethodCallExpression methodCallExpression = Expression.Call\r\n            (\r\n                typeof(Queryable),\r\n                (orderDescending ? \"OrderByDescending\" : \"OrderBy\"),\r\n                new Type[] { _currentQueryableType, orderByPropertyInfo.PropertyType },\r\n                _currentExpression,\r\n                Expression.Quote(lambdaExpression)\r\n            );\r\n\r\n            _currentExpression = methodCallExpression;\r\n\r\n            return this;\r\n        }\r\n\r\n\r\n\r\n        public ExpressionBuilder Select(PropertyInfo selectPropertyInfo)\r\n        {\r\n            return Select(selectPropertyInfo, false);\r\n        }\r\n\r\n\r\n\r\n        public ExpressionBuilder Select(PropertyInfo selectPropertyInfo, bool useInnerDateTimeDate)\r\n        {\r\n            ParameterExpression parameter = Expression.Parameter(_currentQueryableType, \"s\");\r\n\r\n            Expression expression = Expression.Property(parameter, selectPropertyInfo);\r\n            if (useInnerDateTimeDate && selectPropertyInfo.PropertyType == typeof(DateTime))\r\n            {\r\n                expression = InnerDateTimeDateExpression(expression);\r\n            }\r\n\r\n            LambdaExpression lambdaExpression = Expression.Lambda(expression, parameter);\r\n\r\n            MethodCallExpression methodCallExpression = Expression.Call\r\n            (\r\n                typeof(Queryable),\r\n                \"Select\",\r\n                new Type[] { _currentQueryableType, selectPropertyInfo.PropertyType },\r\n                _currentExpression,\r\n                Expression.Quote(lambdaExpression)\r\n            );\r\n\r\n            _currentExpression = methodCallExpression;\r\n            _currentQueryableType = selectPropertyInfo.PropertyType;\r\n\r\n            return this;\r\n        }\r\n\r\n\r\n\r\n        public ExpressionBuilder Distinct()\r\n        {\r\n            MethodCallExpression methodCallExpression = Expression.Call\r\n                (\r\n                    typeof(Queryable),\r\n                    \"Distinct\",\r\n                    new Type[] { _currentQueryableType },\r\n                    _currentExpression\r\n                );\r\n\r\n            _currentExpression = methodCallExpression;\r\n\r\n            return this;\r\n        }\r\n\r\n\r\n\r\n        public IQueryable CreateQuery()\r\n        {\r\n            return _sourceQueryable.Provider.CreateQuery(_currentExpression);\r\n        }\r\n\r\n\r\n\r\n        private Expression InnerDateTimeDateExpression(Expression expression)\r\n        {\r\n            return Expression.Property(expression, _dateDateTimePropertyInfo);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/ExpressionCreator.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ExpressionCreator\r\n    {\r\n        /// <exclude />\r\n        public static Expression Select(Expression source, LambdaExpression selector)\r\n        {\r\n            Type type = TypeHelpers.FindElementType(source);\r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable), \r\n                    \"Select\",\r\n                    new Type[] { type, selector.Body.Type },\r\n                    source,\r\n                    Expression.Quote(selector)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Expression Where(Expression source, LambdaExpression predicate)\r\n        {\r\n            Type type = TypeHelpers.FindElementType(source);\r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable),\r\n                    \"Where\",\r\n                    new Type[] { type },\r\n                    source,\r\n                    Expression.Quote(predicate)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Expression Count(Expression source, LambdaExpression predicate)\r\n        {\r\n            Type type = TypeHelpers.FindElementType(source);\r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable),\r\n                    \"Count\",\r\n                    new Type[] { type },\r\n                    source,\r\n                    Expression.Quote(predicate)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Expression Distinct(Expression source)\r\n        {\r\n            Type type = TypeHelpers.FindElementType(source);\r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable),\r\n                    \"Distinct\",\r\n                    new Type[] { type },\r\n                    source\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Expression OrderBy(Expression source, LambdaExpression keySelector)\r\n        {\r\n            Type type = TypeHelpers.FindElementType(source);\r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable),\r\n                    \"OrderBy\",\r\n                    new Type[] { type, keySelector.Body.Type },\r\n                    source,\r\n                    keySelector\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Expression OrderByDescending(Expression source, LambdaExpression keySelector)\r\n        {\r\n            Type type = TypeHelpers.FindElementType(source);            \r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable),\r\n                    \"OrderByDescending\",\r\n                    new Type[] { type, keySelector.Body.Type },\r\n                    source,\r\n                    keySelector\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Expression ThenBy(Expression source, LambdaExpression keySelector)\r\n        {\r\n            Type type = TypeHelpers.FindElementType(source);\r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable),\r\n                    \"ThenBy\",\r\n                    new Type[] { type, keySelector.Body.Type },\r\n                    source,\r\n                    keySelector\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Expression ThenByDescending(Expression source, LambdaExpression keySelector)\r\n        {\r\n            Type type = TypeHelpers.FindElementType(source);\r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable),\r\n                    \"ThenByDescending\",\r\n                    new Type[] { type, keySelector.Body.Type },\r\n                    source,\r\n                    keySelector\r\n                );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Expression Join(Expression outerSource, Expression innerSource, LambdaExpression outerKeySelector, LambdaExpression innerKeySelector, LambdaExpression resultSelector)\r\n        {\r\n            Type outerType = TypeHelpers.FindElementType(outerSource);\r\n            Type innerType = TypeHelpers.FindElementType(innerSource);\r\n            Type keyType = outerKeySelector.Body.Type;\r\n            Type resultType = resultSelector.ReturnType;\r\n\r\n            // public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(\r\n            //      IEnumerable<TOuter> outer, \r\n            //      IEnumerable<TInner> inner, \r\n            //      Func<TOuter, TKey> outerKeySelector, \r\n            //      Func<TInner, TKey> innerKeySelector, \r\n            //      Func<TOuter, TInner, TResult> resultSelector);\r\n\r\n            Type outerFullType = typeof(IEnumerable<>).MakeGenericType(outerType);\r\n            Type innerFullType = typeof(IEnumerable<>).MakeGenericType(innerType);\r\n            Type outerKeySelectorFullType = typeof(Func<,>).MakeGenericType(outerType, keyType);\r\n            Type innerKeySelectorFullType = typeof(Func<,>).MakeGenericType(innerType, keyType);\r\n            Type resultSelectorFullType = typeof(Func<,,>).MakeGenericType(outerType, innerType, resultType);\r\n\r\n#if DEBUG\r\n\r\n            var b1 = outerFullType.IsAssignableFrom(outerSource.Type);\r\n            var b2 = innerFullType.IsAssignableFrom(innerSource.Type);\r\n            var b3 = outerKeySelector.Type == outerKeySelectorFullType;\r\n            var b4 = innerKeySelector.Type == innerKeySelectorFullType;\r\n            var b5 = resultSelector.Type == resultSelectorFullType;\r\n#endif\r\n\r\n            return Expression.Call(\r\n                    typeof(Queryable),\r\n                    \"Join\",\r\n                    new Type[] { outerType, innerType, keyType, resultType },\r\n                    outerSource,\r\n                    innerSource,\r\n                    Expression.Quote(outerKeySelector),\r\n                    Expression.Quote(innerKeySelector),\r\n                    Expression.Quote(resultSelector)\r\n                );\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/ExpressionExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.Linq.ExpressionVisitors;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    internal static class ExpressionExtensionMethods\r\n    {\r\n        public static Expression NestedAnd(this Expression leftExpression, Expression rightExpression)\r\n        {\r\n            if ((leftExpression == null) && (rightExpression == null)) throw new ArgumentNullException(\"rightExpression\");\r\n\r\n            if (leftExpression == null) return rightExpression;\r\n            if (rightExpression == null) return leftExpression;            \r\n\r\n            return Expression.And(leftExpression, rightExpression);\r\n        }\r\n\r\n\r\n\r\n        public static Expression NestedOr(this Expression leftExpression, Expression rightExpression)\r\n        {\r\n            if ((leftExpression == null) && (rightExpression == null)) throw new ArgumentNullException(\"rightExpression\");\r\n\r\n            if (leftExpression == null) return rightExpression;\r\n            if (rightExpression == null) return leftExpression;\r\n\r\n            return Expression.Or(leftExpression, rightExpression);\r\n        }\r\n\r\n\r\n\r\n        public static void DebugLogExpression(this Expression expression, string title, string label = \"Expression\")\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                if (expression != null)\r\n                {\r\n                    Core.Logging.LoggingService.LogVerbose(title, label + \" = \" + expression.ToString());\r\n                }\r\n                else\r\n                {\r\n                    Core.Logging.LoggingService.LogVerbose(title, label + \" =  null\");\r\n                }\r\n            }\r\n        }\r\n\r\n        public static string BuildCacheKey(this Expression expression)\r\n        {\r\n            try\r\n            {\r\n                return CacheKeyBuilderExpressionVisitor.ExpressionToString(expression);\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                var exeptionToLog = new InvalidOperationException(\"Failed while building a cache key for expression \" + expression, e);\r\n                LoggingService.LogError(typeof(ExpressionExtensionMethods).FullName, exeptionToLog);\r\n\r\n                return null;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/ExpressionExtractor.cs",
    "content": "﻿using System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    internal static class ExpressionExtractor\r\n    {\r\n        public static LambdaExpression GetLambdaExpression(Expression expression)\r\n        {\r\n            if ((expression is LambdaExpression))\r\n            {\r\n                return (LambdaExpression)expression;\r\n            }\r\n\r\n            if ((expression is UnaryExpression))\r\n            {\r\n                return GetLambdaExpression(((UnaryExpression)expression).Operand);\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/ExpressionHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    internal static class ExpressionHelper\r\n    {\r\n        public static List<T> GetCastedObjects<T>(Type interfaceType, Expression sourceExpression)\r\n        {\r\n            return DataFacade.GetData(interfaceType).Provider\r\n                             .CreateQuery(sourceExpression)\r\n                             .Cast<T>().ToList();\r\n        }\r\n\r\n\r\n\r\n        public static Expression CreatePropertyExpression(string fieldName, Expression parameterExpression)\r\n        {\r\n            Type interfaceType = parameterExpression.Type;\r\n\r\n            if (interfaceType.GetProperties().Any(f => f.Name == fieldName))\r\n            {\r\n                return Expression.Property(parameterExpression, fieldName);\r\n            }\r\n\r\n\r\n            foreach (Type superInterfaceType in interfaceType.GetInterfaces())\r\n            {\r\n                if (superInterfaceType.GetProperties().Any(f => f.Name == fieldName))\r\n                {\r\n                    return Expression.Property(Expression.Convert(parameterExpression, superInterfaceType), fieldName);\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException($\"The interface '{parameterExpression.Type}' or any of its superinterfaces does not contain a field named '{fieldName}'\");\r\n        }\r\n\r\n\r\n\r\n        public static Expression CreatePropertyExpression(Type currentInterfaceType, Type actualPropertyDeclaringType, string fieldName, ParameterExpression parameterExpression)\r\n        {\r\n            Expression fieldParameterExpression = GetPropertyParameterExpression(currentInterfaceType, actualPropertyDeclaringType, parameterExpression);\r\n\r\n            Expression expression = CreatePropertyExpression(fieldName, fieldParameterExpression);\r\n\r\n            return expression;\r\n        }\r\n\r\n\r\n\r\n        public static Expression GetPropertyParameterExpression(Type currentInterfaceType, Type actualPropertyDeclaringType, ParameterExpression parameterExpression)\r\n        {\r\n            if (currentInterfaceType == actualPropertyDeclaringType) return parameterExpression;\r\n\r\n            return Expression.Convert(parameterExpression, actualPropertyDeclaringType);\r\n        }\r\n\r\n\r\n\r\n        public static Expression CreateWhereExpression(Expression sourceExpression, ParameterExpression parameterExpression, Expression filterExpression)\r\n        {\r\n            if (filterExpression == null) return sourceExpression;\r\n\r\n            LambdaExpression whereLambdaExpression = Expression.Lambda(filterExpression, parameterExpression);\r\n            Expression whereExpression = ExpressionCreator.Where(sourceExpression, whereLambdaExpression);\r\n\r\n            return whereExpression;\r\n        }\r\n\r\n\r\n\r\n        public static Expression CreateSelectExpression(Expression sourceExpression, Expression bodyExpression, ParameterExpression parameterExpression)\r\n        {\r\n            LambdaExpression selectLambdaExpression = Expression.Lambda(bodyExpression, parameterExpression);\r\n\r\n            Expression selectExpression = ExpressionCreator.Select(sourceExpression, selectLambdaExpression);\r\n\r\n            return selectExpression;\r\n        }\r\n\r\n\r\n\r\n        public static Expression CreateDistinctExpression(Expression sourceExpression)\r\n        {\r\n            Expression distinctExpression = ExpressionCreator.Distinct(sourceExpression);\r\n\r\n            return distinctExpression;\r\n        }\r\n\r\n\r\n\r\n        public static Expression CreateOrderByExpression(Expression sourceExpression, LambdaExpression keySelector)\r\n        {\r\n            Expression orderByExpression = ExpressionCreator.OrderBy(sourceExpression, keySelector);\r\n\r\n            return orderByExpression;\r\n        }\r\n\r\n\r\n        public static Expression CreateOrderByDescendingExpression(Expression sourceExpression, LambdaExpression keySelector)\r\n        {\r\n            return ExpressionCreator.OrderByDescending(sourceExpression, keySelector);\r\n        }\r\n\r\n\r\n        public static Expression ThenByExpression(Expression sourceExpression, LambdaExpression keySelector)\r\n        {\r\n            return ExpressionCreator.ThenBy(sourceExpression, keySelector);\r\n        }\r\n\r\n\r\n        public static Expression ThenByDescendingExpression(Expression sourceExpression, LambdaExpression keySelector)\r\n        {\r\n            return ExpressionCreator.ThenByDescending(sourceExpression, keySelector);\r\n        }\r\n\r\n\r\n        public static Expression CreateJoinExpression(Expression outerSource, Expression innerSource, LambdaExpression outerKeySelector, LambdaExpression innerKeySelector, LambdaExpression resultSelector)\r\n        {\r\n            Expression joinExpression = ExpressionCreator.Join(outerSource, innerSource, outerKeySelector, innerKeySelector, resultSelector);\r\n\r\n            return joinExpression;\r\n        }\r\n\r\n\t    public static Expression CreatePropertyPredicate(ParameterExpression parameterExpression, IEnumerable<Tuple<PropertyInfo, object>> propertiesWithValues)\r\n\t    {\r\n            Expression currentExpression = null;\r\n            foreach (var kvp in propertiesWithValues)\r\n            {\r\n                PropertyInfo propertyInfo = kvp.Item1;\r\n                object value = kvp.Item2;\r\n\r\n                var left = Expression.Property(parameterExpression, propertyInfo);\r\n                var right = Expression.Constant(value);\r\n\r\n                var filter = Expression.Equal(left, right);\r\n\r\n                currentExpression = currentExpression == null ? filter : Expression.And(currentExpression, filter);\r\n            }\r\n\r\n            return currentExpression;\r\n\t    }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/ExpressionVisitors/CacheKeyBuilderExpressionVisitor.cs",
    "content": "﻿using System;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Core.Linq.ExpressionVisitors\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class CacheKeyBuilderExpressionVisitor : ExpressionVisitor\r\n    {\r\n        private static readonly MethodInfo ConstantWrapperMethod =\r\n            StaticReflection.GetGenericMethodInfo(() => CacheKeyBuilderExpressionVisitor.A<object>(string.Empty));\r\n\r\n        /// <exclude />\r\n        public interface ICacheKeyProvider\r\n        {\r\n            /// <exclude />\r\n            string GetCacheKey();\r\n        }\r\n\r\n        private static readonly object[] EmptyObjectArray = new object[0];\r\n\r\n        private bool _cacheKeyCanBeCreated = true;\r\n\r\n\r\n        /// <exclude />\r\n        protected CacheKeyBuilderExpressionVisitor()\r\n        {\r\n        }\r\n\r\n        internal static string ExpressionToString(Expression expression)\r\n        {\r\n            CacheKeyBuilderExpressionVisitor builder = new CacheKeyBuilderExpressionVisitor();\r\n            Expression cachableExpression = builder.Visit(expression);\r\n\r\n            return (builder._cacheKeyCanBeCreated ? cachableExpression : expression).ToString();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override Expression Visit(Expression node)\r\n        {\r\n            // Don't do anything if the expression is considered as not appropriate\r\n            if (!_cacheKeyCanBeCreated)\r\n            {\r\n                return node;\r\n            }\r\n\r\n            return base.Visit(node);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Expression VisitMember(MemberExpression node)\r\n        {\r\n            // Replacing output like \"value(SomeNamespace.Filters+<>c__DisplayClassa).SomeField\" with its actual value\r\n            if(node.Expression is ConstantExpression \r\n                && node.Member is FieldInfo)\r\n            {\r\n                object obj = (node.Expression as ConstantExpression).Value;\r\n                object value = (node.Member as FieldInfo).GetValue(obj);\r\n\r\n                if(IsSimpleType(node.Type))\r\n                {\r\n                    return Expression.Constant(value);\r\n                }\r\n\r\n                if (value != null && value is ICacheKeyProvider)\r\n                {\r\n                    return Out((value as ICacheKeyProvider).GetCacheKey(), node.Type);\r\n                }\r\n            }\r\n\r\n            // Replacing output like \"value(SomeNamespace.Filters+<>c__DisplayClassa).SomeField.SomeOtherField\" with its actual value\r\n            if(node.Expression is MemberExpression\r\n                && node.Member is PropertyInfo\r\n                && IsSimpleType(node.Type))\r\n            {\r\n                MemberExpression innerExpression = node.Expression as MemberExpression;\r\n\r\n                if (innerExpression.Expression is ConstantExpression\r\n                    && innerExpression.Member is FieldInfo)\r\n                {\r\n                    object obj = (innerExpression.Expression as ConstantExpression).Value;\r\n                    object containerValue = (innerExpression.Member as FieldInfo).GetValue(obj);\r\n                    object value = (node.Member as PropertyInfo).GetValue(containerValue, EmptyObjectArray);\r\n\r\n                    return Expression.Constant(value);\r\n                }\r\n            }\r\n\r\n            // Replacing RageRenderer.CurrentPageId with its actual value\r\n            if (node.Expression == null\r\n                && node.Member.DeclaringType == typeof(PageRenderer)\r\n                && node.Member.Name == \"CurrentPageId\")\r\n            {\r\n                return Expression.Constant(PageRenderer.CurrentPageId);\r\n            }\r\n\r\n            return base.VisitMember(node);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Expression VisitConstant(ConstantExpression node)\r\n        {\r\n            if(node.Value != null && !IsSimpleType(node.Type))\r\n            {\r\n                _cacheKeyCanBeCreated = false;\r\n                return node;\r\n            }\r\n\r\n            return base.VisitConstant(node);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return _cacheKeyCanBeCreated ? base.ToString() : null;\r\n        }\r\n\r\n        private static bool IsSimpleType(Type type)\r\n        {\r\n            if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n            {\r\n                type = type.GetGenericArguments()[0];\r\n            }\r\n\r\n            return type == typeof(Guid) || type == typeof(string) || type == typeof(bool)\r\n                   || type == typeof(DateTime) || type == typeof(byte)\r\n                   || type == typeof(Int32) || type == typeof(Int64)\r\n                   || type == typeof(Double);\r\n        }\r\n\r\n        /// <summary>  \r\n        /// Used for creating cache keys for LINQ expressions, it has a short name to keep the keys short  \r\n        /// </summary>\r\n        private static T A<T>(string cacheKeyPart)\r\n        {\r\n            throw new InvalidOperationException(\"This method is not supposed to be called, used only for building a cache key via ExpressionStringBuilder\");\r\n        }\r\n\r\n        private static Expression Out(string value, Type type)\r\n        {\r\n            // TODO: check whether it has sense to cache MakeGenericMethod call\r\n            var methodInfo = ConstantWrapperMethod.MakeGenericMethod(type);\r\n            return Expression.Call(methodInfo, Expression.Constant(value));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/ExpressionVisitors/FindFirstParameterExpressionVisitor.cs",
    "content": "using System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.Core.Linq.ExpressionVisitors\r\n{\r\n    internal sealed class FindFirstParameterExpressionVisitor : ExpressionVisitor\r\n    {\r\n        private ParameterExpression _foundParameter = null;\r\n\r\n\r\n        public ParameterExpression FoundParameter\r\n        {\r\n            get { return _foundParameter; }\r\n        }\r\n\r\n\r\n        protected override Expression VisitParameter(ParameterExpression p)\r\n        {\r\n            if (null == _foundParameter)\r\n            {\r\n                _foundParameter = p;\r\n            }\r\n\r\n            return p;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/Extensions.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing JetBrains.Annotations;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DictionaryExtensions\r\n    {\r\n        /// <exclude />\r\n        public static int GetContentHashCode(this IDictionary dictionary)\r\n        {\r\n            int hash = 0;\r\n\r\n            foreach (DictionaryEntry entry in dictionary)\r\n            {\r\n                hash = hash ^ entry.Key.GetHashCode() ^ entry.Value.GetHashCode();\r\n            }\r\n\r\n            return hash;\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IEnumerableExtensions\r\n    {\r\n        /// <summary>\r\n        /// Returns an evaluated collection. It allows avoiding of multiple calculations for the same enumerator.\r\n        /// </summary>\r\n        /// <typeparam name=\"T\">Element type.</typeparam>\r\n        /// <param name=\"enumerable\">Enumerable object to be evaluated.</param>\r\n        /// <returns>Evaluated collection.</returns>\r\n        public static ICollection<T> Evaluate<T>(this IEnumerable<T> enumerable)\r\n        {\r\n            Verify.ArgumentNotNull(enumerable, nameof(enumerable));\r\n\r\n            if (enumerable is T[] array)\r\n            {\r\n                return array;\r\n            }\r\n\r\n            if (enumerable is ICollection<T> collection)\r\n            {\r\n                return collection;\r\n            }\r\n\r\n            return new List<T>(enumerable);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<T> EvaluateOrNull<T>(this IEnumerable<T> enumerable)\r\n        {\r\n            if (enumerable == null) return null;\r\n\r\n            if (enumerable is T[] || enumerable is List<T>)\r\n            {\r\n                return enumerable;\r\n            }\r\n            return new List<T>(enumerable);\r\n        }    \r\n\r\n        /// <summary>\r\n        /// Extends standard IQueryable<typeparamref name=\"T\"/>.Single method, allows specifying exception text.\r\n        /// </summary>\r\n        /// <param name=\"query\"></param>\r\n        /// <param name=\"exceptionOnEmpty\">Exception format for not a single row found</param>\r\n        /// <param name=\"exceptionOnMultipleResults\">Exception format for multiple rows found</param>\r\n        /// <param name=\"formatArgs\"></param>\r\n        /// <returns></returns>\r\n        [StringFormatMethod(\"formatArgs\")]\r\n        public static T SingleOrException<T>(this IQueryable<T> query, string exceptionOnEmpty, string exceptionOnMultipleResults, params object[] formatArgs) \r\n        {\r\n            var result = query.ToList();\r\n\r\n            if (result.Count == 0) throw new InvalidOperationException(string.Format(exceptionOnEmpty, formatArgs));\r\n            \r\n            if (result.Count == 1) return result[0];\r\n\r\n            throw new InvalidOperationException(string.Format(exceptionOnMultipleResults, formatArgs));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Extends standard IQueryable<typeparamref name=\"T\"/>.Single method, allows specifying exception text.\r\n        /// </summary>\r\n        /// <param name=\"query\"></param>\r\n        /// <param name=\"exceptionOnEmpty\">Exception format for not a single row found</param>\r\n        /// <param name=\"exceptionOnMultipleResults\">Exception format for multiple rows found</param>\r\n        /// <param name=\"formatArgs\"></param>\r\n        /// <returns></returns>\r\n        [StringFormatMethod(\"formatArgs\")]\r\n        public static T SingleOrException<T>(this IEnumerable<T> query, string exceptionOnEmpty, string exceptionOnMultipleResults, params object[] formatArgs)\r\n        {\r\n            var result = query.ToList();\r\n\r\n            if (result.Count == 0) throw new InvalidOperationException(string.Format(exceptionOnEmpty, formatArgs));\r\n\r\n            if (result.Count == 1) return result[0];\r\n\r\n            throw new InvalidOperationException(string.Format(exceptionOnMultipleResults, formatArgs));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Extends standard IQueryable<typeparamref name=\"T\"/>.Single method, allows specifying exception text.\r\n        /// </summary>\r\n        /// <param name=\"query\"></param>\r\n        /// <param name=\"exceptionOnMultipleResults\">Exception format for multiple rows found</param>\r\n        /// <param name=\"formatArgs\">Format arguments</param>\r\n        /// <returns></returns>\r\n        [StringFormatMethod(\"exceptionOnMultipleResults\")]\r\n        public static T SingleOrDefaultOrException<T>(this IEnumerable<T> query, string exceptionOnMultipleResults, params object[] formatArgs)\r\n        {\r\n            var result = query.ToList();\r\n\r\n            if (result.Count == 0) return default(T);\r\n\r\n            if (result.Count == 1) return result[0];\r\n\r\n            throw new InvalidOperationException(string.Format(exceptionOnMultipleResults, formatArgs));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Extends standard IEnumerable<typeparamref name=\"T\"/>.First() method, allows specifying exception text.\r\n        /// </summary>\r\n        /// <param name=\"query\"></param>\r\n        /// <param name=\"exceptionOnEmpty\">Exception format for not a single row found</param>\r\n        /// <param name=\"formatArgs\">Format arguments</param>\r\n        /// <returns></returns>\r\n        [StringFormatMethod(\"formatArgs\")]\r\n        public static T FirstOrException<T>(this IEnumerable<T> query, string exceptionOnEmpty, params object[] formatArgs) where T : class\r\n        {\r\n            var result = query.FirstOrDefault();\r\n\r\n            if (result == null) throw new InvalidOperationException(string.Format(exceptionOnEmpty, formatArgs));\r\n\r\n            return result;\r\n        }\r\n\r\n        internal static IEnumerable<T> ExcludeDuplicateKeys<T, TKey>(this IEnumerable<T> sequence, Func<T, TKey> getKeyFunc)\r\n        {\r\n            var keys = new HashSet<TKey>();\r\n\r\n            foreach (var el in sequence)\r\n            {\r\n                TKey key = getKeyFunc(el);\r\n\r\n                if (keys.Contains(key)) continue;\r\n\r\n                keys.Add(key);\r\n\r\n                yield return el;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ListExtensions\r\n    {\r\n        /// <exclude />\r\n        public static List<U> ToList<T, U>(this IEnumerable<T> source, Func<T, U> convertor)\r\n        {\r\n            return source.Select(convertor).ToList();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static List<object> ToListOfObjects(this IEnumerable enumerable)\r\n        {\r\n            return enumerable.Cast<object>().ToList();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<object> ToEnumerableOfObjects(this IEnumerable enumerable)\r\n        {\r\n            return enumerable.Cast<object>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/PropertyInfoValueCollectioncs.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    internal sealed class PropertyInfoValueCollection\r\n    {\r\n        private Dictionary<PropertyInfo, object> _propertyValues = new Dictionary<PropertyInfo, object>();\r\n\r\n\r\n        public void AddPropertyValue(PropertyInfo propertyInfo, object value)\r\n        {\r\n            if (propertyInfo == null) throw new ArgumentNullException(\"propertyInfo\");\r\n            // allow null values\r\n\r\n            if (_propertyValues.ContainsKey(propertyInfo)) throw new ArgumentException(string.Format(\"The property name '{0}' has already been added\", propertyInfo.Name));\r\n\r\n            _propertyValues.Add(propertyInfo, value);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<KeyValuePair<PropertyInfo, object>> PropertyValues\r\n        {\r\n            get\r\n            {\r\n                foreach (KeyValuePair<PropertyInfo, object> kvp in _propertyValues)\r\n                {\r\n                    yield return kvp;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public PropertyInfoValueCollection Clone()\r\n        {\r\n            PropertyInfoValueCollection propertyInfoValueCollection = new PropertyInfoValueCollection();\r\n\r\n            foreach (var kvp in this.PropertyValues)\r\n            {\r\n                propertyInfoValueCollection.AddPropertyValue(kvp.Key, kvp.Value);\r\n            }\r\n\r\n            return propertyInfoValueCollection;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/TypeExtensions.cs",
    "content": "using System;\r\nusing System.Runtime.CompilerServices;\r\nusing Composite.Core.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    internal static class TypeExtensions\r\n    {\r\n        private static readonly Hashtable<string, bool?> _typeIsCompiledCache = new Hashtable<string, bool?>();\r\n\r\n        public static bool IsCompilerGeneratedType(this Type type)\r\n        {\r\n            string key = type.FullName + type.Assembly.FullName;\r\n\r\n            bool? result = _typeIsCompiledCache[key];\r\n\r\n            if(result != null)\r\n            {\r\n                return (bool)result;\r\n            }\r\n\r\n            lock(_typeIsCompiledCache)\r\n            {\r\n                result = _typeIsCompiledCache[key];\r\n                if (result != null) return (bool) result;\r\n\r\n                result = type.GetCustomAttributes(typeof (CompilerGeneratedAttribute), true).Length > 0;\r\n\r\n                _typeIsCompiledCache.Add(key, result);\r\n\r\n                return (bool)result;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Linq/TypeHelpers.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Linq\r\n{\r\n    internal static class TypeHelpers\r\n    {        \r\n        public static Type FindElementType(Expression expression)\r\n        {\r\n            Type elementType = expression.Type;\r\n            if (!elementType.IsGenericType)\r\n            {\r\n                return null;\r\n            }\r\n            \r\n            Type defintion = elementType.GetGenericTypeDefinition();\r\n\r\n            if ((typeof (IQueryable<>) == defintion) ||\r\n                (typeof (IEnumerable<>) == defintion))\r\n            {\r\n                return elementType.GetGenericArguments()[0];\r\n            }\r\n            \r\n            Type[] interfaces = elementType.GetInterfaces();\r\n\r\n            foreach (Type interf in interfaces)\r\n            {\r\n                Type def = interf;\r\n                if (interf.IsGenericType)\r\n                {\r\n                    def = interf.GetGenericTypeDefinition();\r\n                }\r\n\r\n                if ((typeof (IQueryable<>) == def) ||\r\n                    (typeof (IEnumerable<>) == def))\r\n                {\r\n                    return elementType.GetGenericArguments()[0];\r\n                }\r\n            }\r\n\r\n            throw new NotImplementedException(\"Expression type could not be found\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Localization/LocalizationFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Transactions;\r\nusing Composite.C1Console.Users;\r\n\r\n\r\nnamespace Composite.Core.Localization\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class LocalizationFacade\r\n    {\r\n        /// <summary>\r\n        /// Returns true if the given locale is already installed\r\n        /// </summary>\r\n        /// <param name=\"cultureName\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsLocaleInstalled(string cultureName)\r\n        {\r\n            return IsLocaleInstalled(CultureInfo.CreateSpecificCulture(cultureName));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given locale is already installed\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsLocaleInstalled(CultureInfo cultureInfo)\r\n        {\r\n            return DataFacade.GetData<ISystemActiveLocale>().Any(f => f.CultureName == cultureInfo.Name);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given url mapping name has already been used\r\n        /// </summary>\r\n        /// <param name=\"urlMappingName\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsUrlMappingNameInUse(string urlMappingName)\r\n        {\r\n            return DataLocalizationFacade.UrlMappingNames.Contains(urlMappingName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given url mapping name has already been used\r\n        /// </summary>\r\n        /// <param name=\"cultureInfoToExclude\">This locale is disregarding when checking if url mapping is already used. \r\n        /// This is usefull when renaming the url mapping name for a given locale</param>\r\n        /// <param name=\"urlMappingName\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsUrlMappingNameInUse(CultureInfo cultureInfoToExclude, string urlMappingName)\r\n        {\r\n            return IsUrlMappingNameInUse(cultureInfoToExclude.Name, urlMappingName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given url mapping name has already been used\r\n        /// </summary>\r\n        /// <param name=\"cultureNameToExclude\">This locale is disregarding when checking if url mapping is already used. \r\n        /// This is usefull when renaming the url mapping name for a given locale</param>\r\n        /// <param name=\"urlMappingName\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsUrlMappingNameInUse(string cultureNameToExclude, string urlMappingName)\r\n        {\r\n            return DataFacade.GetData<ISystemActiveLocale>()\r\n                             .Any(f => f.CultureName != cultureNameToExclude && f.UrlMappingName == urlMappingName);\r\n        }     \r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a locale to the system. Throws exception if the given locale has already been installed or\r\n        /// if the given url mapping name has already been used. If the given locale is the first, its set \r\n        /// to be the default locale.\r\n        /// </summary>\r\n        /// <param name=\"cultureName\"></param>\r\n        /// <param name=\"urlMappingName\"></param>\r\n        /// <param name=\"addAccessToAllUsers\"></param>\r\n        public static void AddLocale(string cultureName, string urlMappingName, bool addAccessToAllUsers = true)\r\n        {\r\n            AddLocale(CultureInfo.CreateSpecificCulture(cultureName), urlMappingName, addAccessToAllUsers);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Use this method to rename the url mapping name of a given installed locale. Throws exception if\r\n        /// the given locale is not installed or if the given url mapping name is already used.\r\n        /// </summary>\r\n        /// <param name=\"cultureName\"></param>\r\n        /// <param name=\"newUrlMappingName\"></param>\r\n        public static void RenameUrlMappingNameForLocale(string cultureName, string newUrlMappingName)\r\n        {\r\n            Verify.That(IsLocaleInstalled(cultureName), \"The locale '{0}' is not installed and the url mapping name can not be renamed\", cultureName);\r\n            Verify.That(!IsUrlMappingNameInUse(cultureName, newUrlMappingName), \"The url mapping '{0}' is already used\", newUrlMappingName);\r\n\r\n            ISystemActiveLocale systemActiveLocale = DataFacade.GetData<ISystemActiveLocale>().Single(f => f.CultureName == cultureName);            \r\n            systemActiveLocale.UrlMappingName = newUrlMappingName;\r\n            DataFacade.Update(systemActiveLocale);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a locale to the system. Throws exception if the given locale has already been installed or\r\n        /// if the given url mapping name has already been used. If the given locale is the first, its set \r\n        /// to be the default locale.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        /// <param name=\"urlMappingName\"></param>\r\n        /// <param name=\"addAccessToAllUsers\"></param>\r\n        /// <param name=\"makeFlush\"></param>\r\n        public static void AddLocale(CultureInfo cultureInfo, string urlMappingName, bool addAccessToAllUsers = true, bool makeFlush = true)\r\n        {\r\n            AddLocale(cultureInfo, urlMappingName, addAccessToAllUsers, makeFlush, false);\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a locale to the system. Throws exception if the given locale has already been installed or\r\n        /// if the given url mapping name has already been used. If the given locale is the first, its set \r\n        /// to be the default locale.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        /// <param name=\"urlMappingName\"></param>\r\n        /// <param name=\"addAccessToAllUsers\"></param>\r\n        /// <param name=\"makeFlush\"></param>\r\n        /// <param name=\"isDefault\"></param>\r\n        internal static void AddLocale(CultureInfo cultureInfo, string urlMappingName, bool addAccessToAllUsers, bool makeFlush, bool isDefault)\r\n        {\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                Verify.That(!IsLocaleInstalled(cultureInfo), \"The locale '{0}' has already been added to the system\", cultureInfo);\r\n                Verify.That(!IsUrlMappingNameInUse(urlMappingName), \"The url mapping name '{0}' has already been used in the system\", urlMappingName);\r\n\r\n                if (!DataLocalizationFacade.ActiveLocalizationCultures.Any())\r\n                {\r\n                    addAccessToAllUsers = true;\r\n                }\r\n\r\n                var systemActiveLocale = DataFacade.BuildNew<ISystemActiveLocale>();\r\n                systemActiveLocale.Id = Guid.NewGuid();\r\n                systemActiveLocale.CultureName = cultureInfo.Name;\r\n                systemActiveLocale.UrlMappingName = urlMappingName;\r\n                systemActiveLocale.IsDefault = isDefault;\r\n                DataFacade.AddNew(systemActiveLocale);\r\n\r\n                if (addAccessToAllUsers)\r\n                {\r\n                    List<string> usernames =\r\n                        (from u in DataFacade.GetData<IUser>()\r\n                         select u.Username).ToList();\r\n\r\n                    foreach (string username in usernames)\r\n                    {\r\n                        UserSettings.AddActiveLocaleCultureInfo(username, cultureInfo);\r\n\r\n                        if (UserSettings.GetCurrentActiveLocaleCultureInfo(username) == null)\r\n                        {\r\n                            UserSettings.SetCurrentActiveLocaleCultureInfo(username, cultureInfo);\r\n                            UserSettings.SetForeignLocaleCultureInfo(username, cultureInfo);\r\n                        }\r\n                    }\r\n\r\n                    List<Guid> usergroupids =\r\n                        (from u in DataFacade.GetData<IUserGroup>()\r\n                         select u.Id).ToList();\r\n\r\n                    foreach (Guid usergroupid in usergroupids)\r\n                    {\r\n                        var groupLang = DataFacade.BuildNew<IUserGroupActiveLocale>();\r\n                        groupLang.Id = Guid.NewGuid();\r\n                        groupLang.CultureName = cultureInfo.ToString();\r\n                        groupLang.UserGroupId = usergroupid;\r\n                        DataFacade.AddNew(groupLang);\r\n                    }\r\n                }\r\n\r\n                if (DataLocalizationFacade.DefaultLocalizationCulture == null)\r\n                {\r\n                    DataLocalizationFacade.DefaultLocalizationCulture = cultureInfo;\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            DynamicTypeManager.AddLocale(cultureInfo);\r\n\r\n            if (makeFlush)\r\n            {\r\n                C1Console.Events.GlobalEventSystemFacade.FlushTheSystem(false);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Sets the given locale as default locale. Returns true if setted, false if the given locale is already the default locale.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        /// <returns></returns>\r\n        public static bool SetDefaultLocale(CultureInfo cultureInfo)\r\n        {\r\n            Verify.That(IsLocaleInstalled(cultureInfo), \"The locale '{0}' is not installed and can not be set as default\", cultureInfo);\r\n            \r\n            if (!IsDefaultLocale(cultureInfo))\r\n            {\r\n                DataLocalizationFacade.DefaultLocalizationCulture = cultureInfo;\r\n                return true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given locale is default. Default locales can not be removed.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsDefaultLocale(CultureInfo cultureInfo)\r\n        {\r\n            return IsDefaultLocale(cultureInfo.Name);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given locale is default. Default locales can not be removed.\r\n        /// </summary>\r\n        /// <param name=\"cultureName\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsDefaultLocale(string cultureName)\r\n        {\r\n            return DataLocalizationFacade.DefaultLocalizationCulture != null && cultureName == DataLocalizationFacade.DefaultLocalizationCulture.Name;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if only one installed locale is left. The last locale can not be removed.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static bool IsLastLocale()\r\n        {\r\n            return DataFacade.GetData<ISystemActiveLocale>().Count() == 1;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if any types is localized.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static bool IsTypesUsingLocalization()\r\n        {\r\n            return DataFacade.GetAllInterfaces().Any(DataLocalizationFacade.IsLocalized);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given locale is the only active locale for any user. \r\n        /// If this is the case, the locale can not be removed\r\n        /// </summary>\r\n        /// <param name=\"cultureName\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsOnlyActiveLocaleForSomeUsers(string cultureName)\r\n        {\r\n            return IsOnlyActiveLocaleForSomeUsers(CultureInfo.CreateSpecificCulture(cultureName));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given locale is the only active locale for any user. \r\n        /// If this is the case, the locale can not be removed\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsOnlyActiveLocaleForSomeUsers(CultureInfo cultureInfo)\r\n        {\r\n            List<string> usernames =\r\n                (from u in DataFacade.GetData<IUser>()\r\n                 select u.Username).ToList();\r\n\r\n            foreach (string username in usernames)\r\n            {\r\n                List<CultureInfo> activeLocales = UserSettings.GetActiveLocaleCultureInfos(username).ToList();\r\n\r\n                if (activeLocales.Count == 1 && activeLocales[0].Equals(cultureInfo))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Removes the given locale, all data is lost\r\n        /// </summary>\r\n        /// <param name=\"cultureName\"></param>\r\n        public static void RemoveLocale(string cultureName)\r\n        {\r\n            RemoveLocale(CultureInfo.CreateSpecificCulture(cultureName));\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Removes the given locale, all data is lost\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        /// <param name=\"makeFlush\"></param>\r\n        public static void RemoveLocale(CultureInfo cultureInfo, bool makeFlush = true)\r\n        {\r\n            Verify.That(!IsDefaultLocale(cultureInfo), \"The locale '{0}' is the default locale and can not be removed\", cultureInfo);\r\n            Verify.That(!IsOnlyActiveLocaleForSomeUsers(cultureInfo), \"The locale '{0}' is the only locale for some user(s) and can not be removed\", cultureInfo);\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                string cultureName = cultureInfo.Name;\r\n\r\n                var systemActiveLocale = DataFacade.GetData<ISystemActiveLocale>().SingleOrDefault(f => f.CultureName == cultureName);\r\n\r\n                Verify.IsNotNull(systemActiveLocale, \"The locale '{0}' has not beed added and can not be removed\", cultureInfo);\r\n\r\n                List<string> usernames =\r\n                    (from u in DataFacade.GetData<IUser>()\r\n                     select u.Username).ToList();\r\n\r\n                foreach (string username in usernames)\r\n                {\r\n                    if (cultureInfo.Equals(UserSettings.GetCurrentActiveLocaleCultureInfo(username)))\r\n                    {\r\n                        CultureInfo fallbackCultureInfo = UserSettings.GetActiveLocaleCultureInfos(username).First(f => !f.Equals(cultureInfo));\r\n\r\n                        UserSettings.SetCurrentActiveLocaleCultureInfo(username, fallbackCultureInfo);\r\n                    }\r\n\r\n                    if (cultureInfo.Equals(UserSettings.GetForeignLocaleCultureInfo(username)))\r\n                    {\r\n                        UserSettings.SetForeignLocaleCultureInfo(username, null);\r\n                    }\r\n\r\n                    UserSettings.RemoveActiveLocaleCultureInfo(username, cultureInfo);\r\n                }\r\n\r\n                DataFacade.Delete<ISystemActiveLocale>(systemActiveLocale);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            DynamicTypeManager.RemoveLocale(cultureInfo);\r\n\r\n            if (makeFlush)\r\n            {\r\n                C1Console.Events.GlobalEventSystemFacade.FlushTheSystem(false);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Localization/LocalizationParser.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Text.RegularExpressions;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Core.Localization\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class LocalizationParser\r\n    {\r\n        private static readonly Regex _attributRegex = new Regex(@\"\\$\\((?<type>[^:]+):(?<id>[^\\)]+)\\)\");\r\n\r\n\r\n        /// <exclude />\r\n        public static void Parse(XContainer container)\r\n        {\r\n            IEnumerable<XElement> elements = container.Descendants().ToList();\r\n\r\n            foreach (XElement element in elements)\r\n            {\r\n                if (element.Name.Namespace == LocalizationXmlConstants.XmlNamespace)\r\n                {\r\n                    if (element.Name.LocalName == \"string\")\r\n                    {\r\n                        HandleStringElement(element);\r\n                    }\r\n                    else if (element.Name.LocalName == \"switch\")\r\n                    {\r\n                        HandleSwitchElement(element);\r\n                    }\r\n                }\r\n\r\n                IEnumerable<XAttribute> attributes = element.Attributes().ToList();\r\n                foreach (XAttribute attribute in attributes)\r\n                {\r\n                    Match match = _attributRegex.Match(attribute.Value);\r\n                    if (match.Success && match.Groups[\"type\"].Value == \"lang\") \r\n                    {\r\n                        string newValue = StringResourceSystemFacade.ParseString($\"${{{match.Groups[\"id\"].Value}}}\");\r\n                        attribute.SetValue(newValue);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void HandleStringElement(XElement element)\r\n        {\r\n            XAttribute attribute = element.Attribute(\"key\");\r\n            if (attribute == null) throw new InvalidOperationException($\"Missing attibute named 'key' at {element}\");\r\n\r\n            string newValue = StringResourceSystemFacade.ParseString($\"${{{attribute.Value}}}\");\r\n\r\n            element.ReplaceWith(newValue);\r\n        }\r\n\r\n\r\n\r\n        private static void HandleSwitchElement(XElement element)\r\n        {\r\n            XElement defaultElement = element.Element((XNamespace)LocalizationXmlConstants.XmlNamespace + \"default\");\r\n            Verify.IsNotNull(defaultElement, \"Missing element named 'default' at {0}\", element);\r\n\r\n\r\n            XElement newValueParent = defaultElement;\r\n\r\n            CultureInfo currentCultureInfo = LocalizationScopeManager.CurrentLocalizationScope;\r\n            foreach (XElement whenElement in element.Elements((XNamespace)LocalizationXmlConstants.XmlNamespace + \"when\"))\r\n            {\r\n                XAttribute cultureAttribute = whenElement.Attribute(\"culture\");\r\n                Verify.IsNotNull(cultureAttribute, \"Missing attriubte named 'culture' at {0}\", whenElement);\r\n\r\n                CultureInfo cultureInfo = new CultureInfo(cultureAttribute.Value);\r\n                if (cultureInfo.Equals(currentCultureInfo))\r\n                {\r\n                    newValueParent = whenElement;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            element.ReplaceWith(newValueParent.Nodes());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Localization/LocalizationXmlConstants.cs",
    "content": "﻿using Composite.Core.Xml;\r\n\r\nnamespace Composite.Core.Localization\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class LocalizationXmlConstants\r\n    {\r\n        /// <exclude />\r\n        public static string XmlNamespace { get { return Namespaces.Localization10.ToString(); } }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Log.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing Composite.Core.Implementation;\r\nusing JetBrains.Annotations;\r\n\r\n\r\nnamespace Composite.Core\r\n{\r\n    /// <summary>\r\n    /// Provide write access to the C1 CMS log. Note that 'verbose' messages are typically only shown in run-time log viewers.\r\n    /// </summary>\r\n    public static class Log\r\n    {\r\n        /// <summary>\r\n        /// Logs a 'information' message to the C1 CMS log.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"message\">Message to log</param>\r\n        public static void LogInformation(string title, string message)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogInformation(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'information' message to the C1 CMS log.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"messageFormat\">Message to log in a String.Format() style using {0} etc.</param>\r\n        /// <param name=\"args\">Arguments to put into the message</param>\r\n        [StringFormatMethod(\"messageFormat\")]\r\n        public static void LogInformation(string title, string messageFormat, params object[] args)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogInformation(title, messageFormat, args);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'verbose' message to the C1 CMS log. Verbose messages are typically only shown in developer log viewers.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"message\">Message to log</param>\r\n        public static void LogVerbose(string title, string message)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogVerbose(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'verbose' message to the C1 CMS log.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"messageFormat\">Message to log in a String.Format() style using {0} etc.</param>\r\n        /// <param name=\"args\">Arguments to put into the message</param>\r\n        [StringFormatMethod(\"messageFormat\")]\r\n        public static void LogVerbose(string title, string messageFormat, params object[] args)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogVerbose(title, string.Format(CultureInfo.InvariantCulture, messageFormat, args));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'warning' message to the C1 CMS log. \r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"message\">Message to log</param>\r\n        public static void LogWarning(string title, string message)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogWarning(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'warning' message to the C1 CMS log.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"messageFormat\">Message to log in a String.Format() style using {0} etc.</param>\r\n        /// <param name=\"args\">Arguments to put into the message</param>\r\n        [StringFormatMethod(\"messageFormat\")]\r\n        public static void LogWarning(string title, string messageFormat, params object[] args)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogWarning(title, messageFormat, args);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'verbose' message to the C1 CMS log. \r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"exception\">Exception to log</param>\r\n        public static void LogWarning(string title, Exception exception)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogWarning(title, exception);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'error' message to the C1 CMS log. \r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"message\">Message to log</param>\r\n        public static void LogError(string title, string message)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogError(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'error' message to the C1 CMS log.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"messageFormat\">Message to log in a String.Format() style using {0} etc.</param>\r\n        /// <param name=\"args\">Arguments to put into the message</param>\r\n        [StringFormatMethod(\"messageFormat\")]\r\n        public static void LogError(string title, string messageFormat, params object[] args)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogError(title, messageFormat, args);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'error' message to the C1 CMS log. \r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"exception\">Exception to log</param>\r\n        public static void LogError(string title, Exception exception)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogError(title, exception);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'critical' message to the C1 CMS log. You should only use 'critical' when a major system failure occur.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"message\">Message to log</param>\r\n        public static void LogCritical(string title, string message)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogCritical(title, message);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'critical' message to the C1 CMS log. You should only use 'critical' when a major system failure occur.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"messageFormat\">Message to log in a String.Format() style using {0} etc.</param>\r\n        /// <param name=\"args\">Arguments to put into the message</param>\r\n        [StringFormatMethod(\"messageFormat\")]\r\n        public static void LogCritical(string title, string messageFormat, params object[] args)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogCritical(title, messageFormat, args);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Logs a 'critical' message to the C1 CMS log. You should only use 'critical' when a major system failure occur.\r\n        /// </summary>\r\n        /// <param name=\"title\">Title of log message</param>\r\n        /// <param name=\"exception\">Exception to log</param>\r\n        public static void LogCritical(string title, Exception exception)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessLog.LogCritical(title, exception);\r\n        }    \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Logging/DebugLoggingScope.cs",
    "content": "using System;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Core.Logging\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class DebugLoggingScope : IDisposable\r\n\t{\r\n        /// <exclude />\r\n        public static IDisposable CompletionTime( Type callingType, string actionInfo )\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                return new DebugLoggingScope(callingType.Name, actionInfo, false, TimeSpan.MinValue);\r\n            }\r\n\r\n            return EmptyDisposable.Instance;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IDisposable CompletionTime(Type callingType, string actionInfo, TimeSpan loggingThreshold)\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                return new DebugLoggingScope(callingType.Name, actionInfo, false, loggingThreshold);\r\n            }\r\n\r\n            return EmptyDisposable.Instance;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IDisposable MethodInfoScope\r\n        {\r\n            get\r\n            {\r\n                if (RuntimeInformation.IsDebugBuild)\r\n                {\r\n                    var stackTrace = new StackTrace();\r\n                    var method = stackTrace.GetFrame(1).GetMethod();\r\n                    string scopeName = $\"{method.DeclaringType.Name}.{method.Name}\";\r\n\r\n                    return new DebugLoggingScope(scopeName, \"Method\", true, TimeSpan.MinValue);\r\n                }\r\n\r\n                return EmptyDisposable.Instance;\r\n            }\r\n        }\r\n\r\n\r\n        private readonly int _startTickCount;\r\n        private readonly string _scopeName;\r\n        private readonly string _actionInfo;\r\n        private readonly TimeSpan _threshold;\r\n\r\n        private DebugLoggingScope(string scopeName, string actionInfo, bool logStart, TimeSpan threshold)\r\n        {\r\n            _startTickCount = Environment.TickCount;\r\n            _scopeName = scopeName;\r\n            _actionInfo = actionInfo;\r\n            _threshold = threshold;\r\n\r\n            if (logStart)\r\n            {\r\n                Log.LogVerbose(_scopeName, $\"Starting {_actionInfo}\");\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            int endTickCount = Environment.TickCount;\r\n            var totalMilliseconds = endTickCount - _startTickCount;\r\n            if (totalMilliseconds >= _threshold.TotalMilliseconds)\r\n            {\r\n                Log.LogVerbose(_scopeName, $\"Finished {_actionInfo} ({totalMilliseconds} ms)\");\r\n            }\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~DebugLoggingScope()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Logging/ILog.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Logging\r\n{\r\n    /// <summary>\r\n    /// Provide access to write to the log\r\n    /// </summary>\r\n    public interface ILog\r\n    {\r\n        /// <summary>\r\n        /// LogCritical\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"message\">message</param>\r\n        void LogCritical(string title, string message);\r\n\r\n        /// <summary>\r\n        /// LogCritical\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"exception\">exception</param>\r\n        void LogCritical(string title, Exception exception);\r\n\r\n        /// <summary>\r\n        /// LogCritical\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"messageFormat\">messageFormat</param>\r\n        /// <param name=\"args\">args</param>\r\n        void LogCritical(string title, string messageFormat, params object[] args);\r\n\r\n        /// <summary>\r\n        /// LogError\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"message\">message</param>\r\n        void LogError(string title, string message);\r\n\r\n        /// <summary>\r\n        /// LogError\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"exception\">exception</param>\r\n        void LogError(string title, Exception exception);\r\n\r\n        /// <summary>\r\n        /// LogError\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"messageFormat\">messageFormat</param>\r\n        /// <param name=\"args\">args</param>\r\n        void LogError(string title, string messageFormat, params object[] args);\r\n\r\n        /// <summary>\r\n        /// LogInformation\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"message\">message</param>\r\n        void LogInformation(string title, string message);\r\n\r\n        /// <summary>\r\n        /// LogInformation\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"messageFormat\">messageFormat</param>\r\n        /// <param name=\"args\">args</param>\r\n        void LogInformation(string title, string messageFormat, params object[] args);\r\n\r\n        /// <summary>\r\n        /// LogVerbose\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"message\">message</param>\r\n        void LogVerbose(string title, string message);\r\n\r\n        /// <summary>\r\n        /// LogVerbose\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"messageFormat\">messageFormat</param>\r\n        /// <param name=\"args\">args</param>\r\n        void LogVerbose(string title, string messageFormat, params object[] args);\r\n\r\n        /// <summary>\r\n        /// LogWarning\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"message\">message</param>\r\n        void LogWarning(string title, string message);\r\n\r\n        /// <summary>\r\n        /// LogWarning\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"exception\">exception</param>\r\n        void LogWarning(string title, Exception exception);\r\n\r\n        /// <summary>\r\n        /// LogWarning\r\n        /// </summary>\r\n        /// <param name=\"title\">title</param>\r\n        /// <param name=\"messageFormat\">messageFormat</param>\r\n        /// <param name=\"args\">args</param>\r\n        void LogWarning(string title, string messageFormat, params object[] args);\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Logging/LogEntry.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.Runtime.Serialization;\r\nusing System.Text;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Core.Logging\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class LogEntry\r\n    {\r\n        const char NonBreakingSpace = (char)160;\r\n        private static readonly string DateTimeFormat = \"yyyyMMdd\" + NonBreakingSpace + \"HH:mm:ss.ffff\";\r\n\r\n        /// <exclude />\r\n        public DateTime TimeStamp { get; set; }\r\n\r\n        /// <exclude />\r\n        public int ApplicationDomainId { get; set; }\r\n\r\n        /// <exclude />\r\n        public int ThreadId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Severity { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Title { get; set; }\r\n\r\n        /// <exclude />\r\n        public string DisplayOptions { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Message { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            int applicationDomainId = AppDomain.CurrentDomain.Id;\r\n            int threadId = System.Threading.Thread.CurrentThread.ManagedThreadId;\r\n\r\n            var sb = new StringBuilder();\r\n            sb.Append(TimeStamp.ToString(DateTimeFormat)); // It has one NonBreakingSpace inside\r\n            sb.Append(NonBreakingSpace).Append(applicationDomainId);\r\n            sb.Append(NonBreakingSpace).Append(threadId < 10 ? \" \" : string.Empty).Append(threadId);\r\n            sb.Append(NonBreakingSpace).Append(Severity);\r\n            sb.Append(NonBreakingSpace).Append(Title);\r\n            sb.Append(NonBreakingSpace).Append(DisplayOptions);\r\n            sb.Append(NonBreakingSpace).Append(Message/*.Replace(\"\\n\", @\"\\n\")*/);\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [DebuggerStepThrough]\r\n        public static LogEntry Parse(string serializedLogEntry)\r\n        {\r\n            Verify.ArgumentNotNull(serializedLogEntry, \"serializedLogEntry\");\r\n            if(serializedLogEntry.IndexOf((char)65533) == -1\r\n                && serializedLogEntry.IndexOf((char)160) == -1)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string[] parts = serializedLogEntry.Split((char)65533);\r\n\r\n            if(parts.Length != 8)\r\n            {\r\n                parts = serializedLogEntry.Split((char)160);\r\n            }\r\n\r\n            if(parts.Length != 8)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var result = new LogEntry();\r\n\r\n            try\r\n            {\r\n                string date = parts[0] + parts[1];\r\n\r\n                DateTime timeStamp;\r\n\r\n                if (!DateTime.TryParseExact(date, \"yyyyMMddHH:mm:ss.ffff\", \r\n                                            CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.None, \r\n                                            out timeStamp))\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                result.TimeStamp = timeStamp;\r\n\r\n                result.ApplicationDomainId = int.Parse(parts[2]);\r\n                result.ThreadId = int.Parse(parts[3]);\r\n                result.Severity = parts[4];\r\n                result.Title = parts[5];\r\n                result.DisplayOptions = parts[6];\r\n                result.Message = parts[7];\r\n            }\r\n            catch(Exception)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Logging/LogLevel.cs",
    "content": "namespace Composite.Core.Logging\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum LogLevel\r\n    {\r\n        /// <exclude />\r\n        Info,\r\n\r\n        /// <exclude />\r\n        Debug,\r\n\r\n        /// <exclude />\r\n        Fine,\r\n\r\n        /// <exclude />\r\n        Warning,\r\n\r\n        /// <exclude />\r\n        Error,\r\n\r\n        /// <exclude />\r\n        Fatal\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Logging/LogManager.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener;\r\n\r\nnamespace Composite.Core.Logging\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class LogManager\r\n    {\r\n        private static readonly string VerboseSeverity = \"Verbose\";\r\n        private static readonly TimeSpan LockedFileAwaitingPeriod = TimeSpan.FromSeconds(15);\r\n        private static readonly DateTime _startTime = DateTime.Now;\r\n\r\n        /// <exclude />\r\n        public static int LogLinesRequestLimit = 5000;\r\n\r\n        private static int MaxLogEntriesToParse = 50000;\r\n\r\n        private static LogFileReader[] _logFiles;\r\n        private static readonly object _syncRoot = new object();\r\n\r\n        /// <exclude />\r\n        static LogManager()\r\n        {\r\n            FileLogger.OnReset += () => _logFiles = null;\r\n        }\r\n\r\n        private static FileLogger FileLogger => FileLogTraceListener.LoggerInstance;\r\n\r\n        private static LogFileReader[] LogFiles\r\n        {\r\n            get\r\n            {\r\n                var result = _logFiles;\r\n                if (result == null || result.Length == 0)\r\n                {\r\n                    lock (_syncRoot)\r\n                    {\r\n                        result = _logFiles;\r\n                        if (result == null || result.Length == 0)\r\n                        {\r\n                            _logFiles = result = FileLogger?.GetLogFiles() ?? new LogFileReader[0];\r\n                        }\r\n                    }\r\n                }\r\n                return result;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool DeleteLogFile(DateTime date)\r\n        {\r\n            date = date.Date;\r\n\r\n            var filesToDelete = FileLogger.GetLogFiles().Where(file => file.Date.Date == date).ToArray();\r\n\r\n            bool updated = false;\r\n            foreach (var file in filesToDelete)\r\n            {\r\n                updated |= file.Delete();\r\n            }\r\n\r\n            if (updated)\r\n            {\r\n                lock (_syncRoot)\r\n                {\r\n                    _logFiles = null;\r\n                }\r\n            }\r\n\r\n            return updated;\r\n        }\r\n\r\n        internal static void Flush()\r\n        {\r\n            FileLogger?.Flush(true);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static DateTime GetLastStartupTime()\r\n        {\r\n            return FileLogger.StartupTime;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static DateTime[] GetLoggingDates()\r\n        {\r\n            return LogFiles.Select(entry => entry.Date).Distinct().OrderBy(date => date).ToArray();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static int GetLogEntriesCount(DateTime timeFrom, DateTime timeTo, bool includeVerbose)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static int GetLogEntriesCountByDate(DateTime date, bool includeVerbose)\r\n        {\r\n            date = date.Date;\r\n\r\n            return LogFiles.Where(logFile => logFile.Date == date).Sum(logFile => logFile.EntriesCount);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static LogEntry[] GetLogEntries(DateTime timeFrom, DateTime timeTo, bool includeVerbose, int maximumAmount)\r\n        {\r\n            if (maximumAmount == 0)\r\n            {\r\n                maximumAmount = LogLinesRequestLimit;\r\n            }\r\n\r\n            Verify.That(maximumAmount > 0 && maximumAmount <= LogLinesRequestLimit, \"Maximum amount should be in range [1..{0}]\", LogLinesRequestLimit);\r\n\r\n            var files = LogFiles.Where(logFile => logFile.Date >= timeFrom.Date && logFile.Date <= timeTo.Date);\r\n\r\n            var result = new List<LogEntry>();\r\n\r\n            lock (_syncRoot)\r\n            {\r\n                foreach (var logFile in files)\r\n                {\r\n                    try\r\n                    {\r\n                        if (!logFile.Open())\r\n                        {\r\n                            if (DateTime.Now - _startTime < LockedFileAwaitingPeriod)\r\n                            {\r\n                                // Waiting for some time until all log files are released\r\n                                // This ensures that LogViewer will get all the logs from previous, currently being shutdown AppDomain(s)\r\n                                return Array.Empty<LogEntry>();\r\n                            }\r\n\r\n                            continue;\r\n                        }\r\n\r\n                        int entriesRead = 0;\r\n                        int entriesParsed = 0;\r\n                        foreach (var entry in logFile.GetLogEntries(timeFrom, timeTo))\r\n                        {\r\n                            entriesParsed++;\r\n\r\n                            if (entriesParsed >= MaxLogEntriesToParse)\r\n                            {\r\n                                result.Add(new LogEntry\r\n                                {\r\n                                    ApplicationDomainId = AppDomain.CurrentDomain.Id,\r\n                                    ThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId,\r\n                                    TimeStamp = DateTime.Now,\r\n                                    Title = nameof(LogManager),\r\n                                    Message = $\"Maximum amount of parsed log entries reached ({MaxLogEntriesToParse}).\"\r\n                                });\r\n                                break;\r\n                            }\r\n\r\n                            if (entry.TimeStamp >= timeFrom && entry.TimeStamp <= timeTo)\r\n                            {\r\n                                if (!includeVerbose && entry.Severity == VerboseSeverity)\r\n                                {\r\n                                    continue;\r\n                                }\r\n\r\n                                result.Add(entry);\r\n\r\n                                entriesRead++;\r\n                                if (entriesRead == maximumAmount) break;\r\n                            }\r\n                        }\r\n                    }\r\n                    finally\r\n                    {\r\n                        logFile.Close();\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result.OrderBy(entry => entry.TimeStamp).Take(maximumAmount).ToArray();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Logging/LoggingService.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Reflection;\r\nusing System.Runtime.InteropServices;\r\nusing System.Threading;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Microsoft.Practices.EnterpriseLibrary.Logging;\r\nusing Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;\r\n\r\nnamespace Composite.Core.Logging\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class LoggingService\r\n    {\r\n        /// <exclude />\r\n        [Flags]\r\n        public enum Category\r\n        {\r\n            /// <exclude />\r\n            General = 0x1,\r\n\r\n            /// <exclude />\r\n            Audit = 0x2,\r\n        }\r\n\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n        private static readonly string BeginOfInnerExceptionMarker;\r\n        private static readonly string EndOfInnerExceptionMarker;\r\n        private static readonly MethodInfo ExceptionToStringInternal_MethodInfo;\r\n\r\n        /// <exclude />\r\n        static LoggingService()\r\n        {\r\n            MethodInfo getRuntimeResourceStringMethodInfo = typeof(Environment)\r\n                .GetMethod(\"GetRuntimeResourceString\", BindingFlags.NonPublic | BindingFlags.Static, null, new[] { typeof(string) }, null);\r\n\r\n            // NOTE: \"Magic\" strings, shouldn't be modified\r\n            BeginOfInnerExceptionMarker = \"---> \";\r\n            EndOfInnerExceptionMarker = Environment.NewLine + \"   \" +\r\n                (string)getRuntimeResourceStringMethodInfo.Invoke(null, new object[] { \"Exception_EndOfInnerExceptionStack\" });\r\n\r\n            ExceptionToStringInternal_MethodInfo = typeof(Exception).GetMethod(\"ToString\", BindingFlags.Instance | BindingFlags.NonPublic);\r\n\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlush);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void LogEntry(string title, string message, Category category, System.Diagnostics.TraceEventType severity, int priority, int eventid)\r\n        {\r\n            LogEntry(title, message, null, category, severity, priority, eventid);\r\n        }\r\n\r\n        /// <exclude />\r\n        static private void LogEntry(string title, string message, Exception exc, Category category, System.Diagnostics.TraceEventType severity)\r\n        {\r\n            LogEntry(title, message, exc, category, severity, -1, 0);\r\n        }\r\n\r\n        static private void LogEntry(string title, string message, Exception exc, Category category, System.Diagnostics.TraceEventType severity, int priority, int eventid)\r\n        {\r\n            var entry = new Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry\r\n            {\r\n                Title = $\"({AppDomain.CurrentDomain.Id} - {Thread.CurrentThread.ManagedThreadId}) {title}\",\r\n                Message = message,\r\n                Severity = severity,\r\n                Priority = priority,\r\n                EventId = eventid\r\n            };\r\n\r\n            if ((category & Category.General) != 0)\r\n            {\r\n                entry.Categories.Add(nameof(Category.General));\r\n            }\r\n\r\n            if ((category & Category.Audit) != 0)\r\n            {\r\n                entry.Categories.Add(nameof(Category.Audit));\r\n            }\r\n\r\n            if (exc != null)\r\n            {\r\n                entry.ExtendedProperties.Add(\"Exception\", exc);\r\n            }\r\n\r\n            _resourceLocker.Resources.Writer.Write(entry);\r\n        }\r\n\r\n        /// <exclude />\r\n        static public void LogEntry(string title, string message, Category category, System.Diagnostics.TraceEventType severity, int priority)\r\n        {\r\n            LogEntry(title, message, category, severity, priority, 0);\r\n        }\r\n\r\n        /// <exclude />\r\n        static public void LogEntry(string title, string message, Category category, System.Diagnostics.TraceEventType severity)\r\n        {\r\n            LogEntry(title, message, category, severity, -1, 0);\r\n        }\r\n\r\n        /// <exclude />\r\n        static public void LogError(string title, string message)\r\n        {\r\n            LogEntry(title, message, Category.General, System.Diagnostics.TraceEventType.Error);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogError(string title, string message, Category category)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Error);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogError(string title, string message, Category category, int priority)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Error, priority);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogError(string title, string message, Category category, int priority, int eventid)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Error, priority, eventid);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogError(string title, Exception e)\r\n        {\r\n            LogEntry(title, PrettyExceptionCallStack(e), e, Category.General, System.Diagnostics.TraceEventType.Error);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogCritical(string title, string message)\r\n        {\r\n            LogEntry(title, message, Category.General, System.Diagnostics.TraceEventType.Critical);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogCritical(string title, string message, Category category)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Critical);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogCritical(string title, string message, Category category, int priority)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Critical, priority);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogCritical(string title, string message, Category category, int priority, int eventid)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Critical, priority, eventid);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogCritical(string title, Exception e)\r\n        {\r\n            LogEntry(title, PrettyExceptionCallStack(e), e, Category.General, System.Diagnostics.TraceEventType.Critical);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogInformation(string title, string message)\r\n        {\r\n            LogEntry(title, message, Category.General, System.Diagnostics.TraceEventType.Information);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogVerbose(string title, string message)\r\n        {\r\n            LogEntry(title, message, Category.General, System.Diagnostics.TraceEventType.Verbose);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogVerbose(string title, string message, Category category)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Verbose);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogVerbose(string title, string message, Category category, int priority)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Verbose, priority);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogVerbose(string title, string message, Category category, int priority, int eventid)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Verbose, priority, eventid);\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogWarning(string title, string message)\r\n        {\r\n            LogEntry(title, message, Category.General, System.Diagnostics.TraceEventType.Warning);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogWarning(string title, string message, Category category)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Warning);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogWarning(string title, string message, Category category, int priority)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Warning, priority);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogWarning(string title, string message, Category category, int priority, int eventid)\r\n        {\r\n            LogEntry(title, message, category, System.Diagnostics.TraceEventType.Warning, priority, eventid);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        static public void LogWarning(string title, Exception e)\r\n        {\r\n            LogEntry(title, PrettyExceptionCallStack(e), e, Category.General, System.Diagnostics.TraceEventType.Warning);\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n        private static void OnFlush(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n        static string PrettyExceptionCallStack(Exception ex)\r\n        {\r\n            if (ex == null) return \"[exception is null]\";\r\n\r\n            string serializedException = ex.ToString();\r\n            if (ex.InnerException != null && ExcludeInnerExceptionInformation(ex, serializedException, out var cleanException))\r\n            {\r\n                return PrettyExceptionCallStack(ex.InnerException) + Environment.NewLine + cleanException;\r\n            }\r\n\r\n            var loaderException = ex as ReflectionTypeLoadException;\r\n            if (loaderException?.LoaderExceptions != null)\r\n            {\r\n                foreach (var innerEx in loaderException.LoaderExceptions)\r\n                {\r\n                    serializedException += Environment.NewLine + PrettyExceptionCallStack(innerEx);\r\n                }\r\n            }\r\n\r\n            return serializedException;\r\n        }\r\n\r\n\r\n        private static bool ExcludeInnerExceptionInformation(Exception exception, string serializedException, out string clearedSerializedException)\r\n        {\r\n            string innerExceptionText = exception is ExternalException\r\n                ? BeginOfInnerExceptionMarker + InnerExceptionToString(exception.InnerException)\r\n                : BeginOfInnerExceptionMarker + InnerExceptionToString(exception.InnerException) + EndOfInnerExceptionMarker;\r\n\r\n            int offset = serializedException.IndexOf(innerExceptionText, StringComparison.InvariantCulture);\r\n            if (offset < 0)\r\n            {\r\n                clearedSerializedException = null;\r\n                return false;\r\n            }\r\n\r\n            clearedSerializedException = serializedException.Substring(0, offset) + serializedException.Substring(offset + innerExceptionText.Length);\r\n            return true;\r\n        }\r\n\r\n        private static string InnerExceptionToString(Exception exception)\r\n        {\r\n            return (string)ExceptionToStringInternal_MethodInfo.Invoke(exception, new object[] { true, true });\r\n        }\r\n\r\n        private sealed class Resources\r\n        {\r\n            public LogWriterFactory Factory { get; set; }\r\n            public LogWriter Writer { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                LoggingSettings section = null;\r\n                if (ConfigurationServices.ConfigurationSource != null)\r\n                {\r\n                    section = ConfigurationServices.ConfigurationSource.GetSection(LoggingSettings.SectionName) as LoggingSettings; ;\r\n                }\r\n\r\n                if (section != null)\r\n                {\r\n                    resources.Factory = new LogWriterFactory(ConfigurationServices.ConfigurationSource);\r\n                    resources.Writer = resources.Factory.Create();\r\n                }\r\n                else\r\n                {\r\n                    string path = Path.Combine(PathUtil.BaseDirectory, $\"logging{Guid.NewGuid()}.config\");\r\n\r\n                    using (C1StreamWriter writer = new C1StreamWriter(path))\r\n                    {\r\n                        Type type = typeof(LoggingService).Assembly\r\n                            .GetType(\"Composite.Plugins.Logging.LogTraceListeners.TcpLogTraceListener.TcpLogTraceListener\", false);\r\n\r\n                        if ((type != null) && (RuntimeInformation.IsUnittest == false))\r\n                        {\r\n                            #region config file\r\n                            writer.WriteLine(@\"<?xml version=\"\"1.0\"\" encoding=\"\"utf-8\"\"?>\r\n  <configuration>\r\n  <configSections>\r\n    <section name=\"\"loggingConfiguration\"\" type=\"\"Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0\"\" />\r\n  </configSections>\r\n  <loggingConfiguration name=\"\"Logging Application Block\"\" tracingEnabled=\"\"true\"\"\r\n    defaultCategory=\"\"General\"\" logWarningsWhenNoCategoriesMatch=\"\"true\"\">\r\n    <listeners>\r\n        <add listenerDataType=\"\"Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0\"\"\r\n            traceOutputOptions=\"\"None\"\" type=\"\"Composite.Plugins.Logging.LogTraceListeners.TcpLogTraceListener.TcpLogTraceListener, Composite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\"\"\r\n            name=\"\"Tcp Custom Trace Listener\"\" initializeData=\"\"\"\" formatter=\"\"Text Formatter\"\" />\r\n      </listeners>\r\n    <formatters>\r\n     <add template=\"\"Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title: {title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}\"\"\r\n        type=\"\"Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0\"\"\r\n        name=\"\"Text Formatter\"\" />\r\n     </formatters>\r\n    <categorySources>\r\n      <add switchValue=\"\"All\"\" name=\"\"General\"\" />\r\n    </categorySources>\r\n    <specialSources>\r\n      <allEvents switchValue=\"\"All\"\" name=\"\"All Events\"\">\r\n        <listeners>\r\n          <add name=\"\"Tcp Custom Trace Listener\"\" />\r\n        </listeners>\r\n      </allEvents>\r\n      <notProcessed switchValue=\"\"All\"\" name=\"\"Unprocessed Category\"\" />\r\n      <errors switchValue=\"\"All\"\" name=\"\"Logging Errors &amp; Warnings\"\" />\r\n    </specialSources>\r\n  </loggingConfiguration>\r\n</configuration>\");\r\n                            #endregion\r\n                        }\r\n                        else\r\n                        {\r\n                            #region config file\r\n                            writer.WriteLine(@\"<?xml version=\"\"1.0\"\" encoding=\"\"utf-8\"\"?>\r\n  <configuration>\r\n  <configSections>\r\n    <section name=\"\"loggingConfiguration\"\" type=\"\"Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0\"\" />\r\n  </configSections>s\r\n  <loggingConfiguration name=\"\"Logging Application Block\"\" tracingEnabled=\"\"true\"\"\r\n    defaultCategory=\"\"General\"\" logWarningsWhenNoCategoriesMatch=\"\"true\"\">\r\n    <listeners>\r\n      <add listenerDataType=\"\"Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0\"\"\r\n        traceOutputOptions=\"\"None\"\" type=\"\"Composite.Core.Logging.NullLogTraceListener, Composite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\"\"\r\n        name=\"\"NullLogTraceListener\"\" initializeData=\"\"\"\" formatter=\"\"Text Formatter\"\" />\r\n    </listeners>\r\n    <formatters>\r\n      <add template=\"\"Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}\"\"\r\n        type=\"\"Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0\"\"\r\n        name=\"\"Text Formatter\"\" />\r\n    </formatters>\r\n    <categorySources>\r\n      <add switchValue=\"\"All\"\" name=\"\"General\"\" />\r\n    </categorySources>\r\n    <specialSources>\r\n      <allEvents switchValue=\"\"All\"\" name=\"\"All Events\"\">\r\n        <listeners>\r\n          <add name=\"\"NullLogTraceListener\"\" />\r\n        </listeners>\r\n      </allEvents>\r\n      <notProcessed switchValue=\"\"All\"\" name=\"\"Unprocessed Category\"\" />\r\n      <errors switchValue=\"\"All\"\" name=\"\"Logging Errors &amp; Warnings\"\" />\r\n    </specialSources>\r\n  </loggingConfiguration>\r\n</configuration>\");\r\n                            #endregion\r\n                        }\r\n                    }\r\n\r\n                    resources.Factory = new LogWriterFactory(new FileConfigurationSource(path));\r\n                    resources.Writer = resources.Factory.Create();\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Logging/NullLogTraceListener.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;\r\n\r\n\r\nnamespace Composite.Core.Logging\r\n{\r\n    /// <summary>\r\n    /// This is used when the Composite.Mocks.Plugins.Logging.LogTraceListeners.WinFormTraceListener.WinFormTraceListener\r\n    /// is not available to the system.\r\n    /// </summary>\r\n    internal sealed class NullLogTraceListener : CustomTraceListener\r\n    {\r\n        public override void Write(string message)\r\n        {\r\n        }\r\n\r\n        public override void WriteLine(string message)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/Foundation/InstalledPackageInformationSerializerHandler.cs",
    "content": "﻿using Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.Foundation\r\n{\r\n    internal sealed class InstalledPackageInformationSerializerHandler : ISerializerHandler\r\n    {\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            return \"\";\r\n        }\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            return new InstalledPackageInformation();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/Foundation/PackageManagerInstallProcessSerializerHandler.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.Foundation\r\n{\r\n    /// <summary>\r\n    /// This class is only for pleasing the workflow system. \r\n    /// </summary>\r\n    internal sealed class PackageManagerInstallProcessSerializerHandler : ISerializerHandler\r\n    {\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            return \"\";\r\n        }\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            return new PackageManagerInstallProcess(new List<PackageFragmentValidationResult>(), null);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/Foundation/PackageManagerUninstallProcessSerializerHandler.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.Foundation\r\n{\r\n    /// <summary>\r\n    /// This class is only for pleasing the workflow system. \r\n    /// </summary>\r\n    internal sealed class PackageManagerUninstallProcessSerializerHandler : ISerializerHandler\r\n    {\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            return \"\";\r\n        }\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            return new PackageManagerUninstallProcess(new List<PackageFragmentValidationResult>());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/Foundation/PackageServerFacadeImplCache.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Globalization;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.Foundation\r\n{\r\n\tinternal class PackageServerFacadeImplCache\r\n\t{\r\n        private TimeSpan _cacheLiveTime;\r\n\r\n        private DateTime _packageDescriptionsCacheTimestamp = DateTime.MinValue;\r\n        private Dictionary<string, Dictionary<Guid, Dictionary<CultureInfo, List<PackageDescription>>>> _packageDescriptionsCache = new Dictionary<string, Dictionary<Guid, Dictionary<CultureInfo, List<PackageDescription>>>>();\r\n\r\n\r\n        public PackageServerFacadeImplCache()\r\n        {\r\n            _cacheLiveTime = TimeSpan.FromMinutes(30);\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                _cacheLiveTime = TimeSpan.FromSeconds(30);\r\n            }\r\n        }\r\n\r\n\r\n        public List<PackageDescription> GetCachedPackageDescription(string packageServerUrl, Guid installationId, CultureInfo userCulture)\r\n        {\r\n            if ((_packageDescriptionsCacheTimestamp + _cacheLiveTime) < DateTime.Now)\r\n            {\r\n                LoggingService.LogVerbose(\"PackageServerFacadeCache\", \"PackageDescription cache miss\");\r\n                return null;\r\n            }\r\n\r\n            Dictionary<Guid, Dictionary<CultureInfo, List<PackageDescription>>> dic1;\r\n            if (_packageDescriptionsCache.TryGetValue(packageServerUrl, out dic1) == false)\r\n            {\r\n                dic1 = new Dictionary<Guid, Dictionary<CultureInfo, List<PackageDescription>>>();\r\n                _packageDescriptionsCache.Add(packageServerUrl, dic1);\r\n            }\r\n\r\n            Dictionary<CultureInfo, List<PackageDescription>> dic2;\r\n            if (dic1.TryGetValue(installationId, out dic2) == false)\r\n            {\r\n                dic2 = new Dictionary<CultureInfo, List<PackageDescription>>();\r\n                dic1.Add(installationId, dic2);\r\n            }\r\n\r\n            if (dic2.ContainsKey(userCulture) == false)\r\n            {\r\n                LoggingService.LogVerbose(\"PackageServerFacadeCache\", \"PackageDescription cache miss\");\r\n                return null;\r\n            }\r\n\r\n            LoggingService.LogVerbose(\"PackageServerFacadeCache\", \"PackageDescription returned from cache\");\r\n            return dic2[userCulture];\r\n        }\r\n\r\n\r\n\r\n        public void AddCachedPackageDescription(string packageServerUrl, Guid installationId, CultureInfo userCulture, List<PackageDescription> packageDescription)\r\n        {\r\n            LoggingService.LogVerbose(\"PackageServerFacadeCache\", \"PackageDescription added to cache\");\r\n\r\n            Dictionary<Guid, Dictionary<CultureInfo, List<PackageDescription>>> dic1;\r\n            if (_packageDescriptionsCache.TryGetValue(packageServerUrl, out dic1) == false)\r\n            {\r\n                dic1 = new Dictionary<Guid, Dictionary<CultureInfo, List<PackageDescription>>>();\r\n                _packageDescriptionsCache.Add(packageServerUrl, dic1);\r\n            }\r\n\r\n            Dictionary<CultureInfo, List<PackageDescription>> dic2;\r\n            if (dic1.TryGetValue(installationId, out dic2) == false)\r\n            {\r\n                dic2 = new Dictionary<CultureInfo, List<PackageDescription>>();\r\n                dic1.Add(installationId, dic2);\r\n            }\r\n\r\n            dic2[userCulture] = packageDescription;\r\n            _packageDescriptionsCacheTimestamp = DateTime.Now;\r\n        }\r\n\r\n\r\n\r\n        public void Clear()\r\n        {\r\n            _packageDescriptionsCache = new Dictionary<string, Dictionary<Guid, Dictionary<CultureInfo, List<PackageDescription>>>>();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/Foundation/PackageSystemSettings.cs",
    "content": "﻿namespace Composite.Core.PackageSystem.Foundation\r\n{\r\n\tinternal static class PackageSystemSettings\r\n\t{\r\n        public static string InstallFilename { get { return \"install.xml\"; } }\r\n        public static string UninstallFilename { get { return \"uninstall.xml\"; } }\r\n        public static string InstalledFilename { get { return \"installed\"; } }\r\n        public static string ZipFilename { get { return \"package.zip\"; } }\r\n\r\n        public static string BinariesDirectoryName { get { return \"Binaries\"; } }\r\n\r\n\r\n        public static string XmlNamespace { get { return \"http://www.composite.net/ns/management/packageinstaller/1.0\"; } }\r\n\r\n        public static string PackageInstallerElementName { get { return \"PackageInstaller\"; } }\r\n        public static string PackageRequirementsElementName { get { return \"PackageRequirements\"; } }\r\n        public static string PackageFragmentInstallerBinariesElementName { get { return \"PackageFragmentInstallerBinaries\"; } }\r\n        \r\n        public static string PackageFragmentInstallerBinariesAddElementName { get { return \"Add\"; } }\r\n        public static string PackageFragmentInstallersElementName { get { return \"PackageFragmentInstallers\"; } }\r\n        public static string PackageFragmentUninstallersElementName { get { return \"PackageFragmentUninstallers\"; } }\r\n        public static string PackageFragmentInstallersAddElementName { get { return \"Add\"; } }\r\n        public static string PackageFragmentUninstallersAddElementName { get { return \"Add\"; } }\r\n        public static string PackageInformationElementName { get { return \"PackageInformation\"; } }\r\n\r\n        public static string MinimumCompositeVersionAttributeName { get { return \"minimumCompositeVersion\"; } }\r\n        public static string MaximumCompositeVersionAttributeName { get { return \"maximumCompositeVersion\"; } }\r\n\r\n        public static string PathAttributeName { get { return \"path\"; } }\r\n        public static string InstallerTypeAttributeName { get { return \"installerType\"; } }\r\n        public static string UninstallerTypeAttributeName { get { return \"uninstallerType\"; } }\r\n\r\n        public static string IdAttributeName { get { return \"id\"; } }\r\n        public static string NameAttributeName { get { return \"name\"; } }\r\n        public static string GroupNameAttributeName { get { return \"groupName\"; } }\r\n        public static string AuthorAttributeName { get { return \"author\"; } }\r\n        public static string WebsiteAttributeName { get { return \"website\"; } }\r\n        public static string VersionAttributeName { get { return \"version\"; } }\r\n        public static string CanBeUninstalledAttributeName { get { return \"canBeUninstalled\"; } }\r\n        public static string SystemLockingAttributeName { get { return \"systemLocking\"; } }\r\n        public static string FlushOnCompletionAttributeName { get { return \"flushOnCompletion\"; } }\r\n        public static string ReloadConsoleOnCompletionAttributeName { get { return \"reloadConsoleOnCompletion\"; } }\r\n        \r\n\r\n\r\n        #region \"info.xml\" xml stuff\r\n\r\n        public static string PackageInformationFilename { get { return \"info.xml\"; } }\r\n\r\n\r\n        public static string PackageInfoElementName { get { return \"PackageInfo\"; } }\r\n        public static string PackageInfo_NameAttributeName { get { return \"name\"; } }\r\n        public static string PackageInfo_GroupNameAttributeName { get { return \"groupName\"; } }\r\n        public static string PackageInfo_VersionAttributeName { get { return \"version\"; } }\r\n        public static string PackageInfo_AuthorAttributeName { get { return \"author\"; } }\r\n        public static string PackageInfo_WebsiteAttributeName { get { return \"website\"; } }\r\n        public static string PackageInfo_DescriptionAttributeName { get { return \"description\"; } }\r\n        public static string PackageInfo_InstallDateAttributeName { get { return \"installDate\"; } }\r\n        public static string PackageInfo_InstalledByAttributeName { get { return \"installedBy\"; } }\r\n        public static string PackageInfo_IsLocalInstalledAttributeName { get { return \"isLocalInstalled\"; } }\r\n        public static string PackageInfo_CanBeUninstalledAttributeName { get { return \"canBeUninstalled\"; } }\r\n        public static string PackageInfo_FlushOnCompletionAttributeName { get { return \"flushOnCompletion\"; } }\r\n        public static string PackageInfo_ReloadConsoleOnCompletionAttributeName { get { return \"reloadConsoleOnCompletion\"; } }\r\n        public static string PackageInfo_SystemLockingAttributeName { get { return \"systemLocking\"; } }\r\n        public static string PackageInfo_PackageServerAddressAttributeName { get { return \"packageServerAddress\"; } }\r\n\r\n        #endregion\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/Foundation/SystemLockingType.cs",
    "content": "﻿using System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum SystemLockingType\r\n    {\r\n        /// <exclude />\r\n        None,\r\n\r\n        /// <exclude />\r\n        Soft,\r\n\r\n        /// <exclude />\r\n        Hard\r\n    }\r\n\r\n\r\n    internal static class SystemLockingTypeExtensionMethods\r\n    {\r\n        public static bool TryDeserialize(this XAttribute attribute, out SystemLockingType systemLockingType)\r\n        {\r\n            systemLockingType = SystemLockingType.Hard;\r\n\r\n            if (attribute == null) return true;\r\n\r\n            if (attribute.Value == \"soft\") systemLockingType = SystemLockingType.Soft;\r\n            else if (attribute.Value == \"hard\") systemLockingType = SystemLockingType.Hard;\r\n            else if (attribute.Value == \"none\") systemLockingType = SystemLockingType.None;\r\n            else return false;\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public static string Serialize(this SystemLockingType systemLockingType)\r\n        {\r\n            return systemLockingType.ToString().ToLowerInvariant();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/Foundation/VersionStringHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\n\r\nnamespace Composite.Core.PackageSystem.Foundation\r\n{\r\n\tinternal static class VersionStringHelper\r\n\t{\r\n        public static bool ValidateVersion(string version, out string newVersion)\r\n        {\r\n            Regex shotVersionRegex = new Regex(@\"[0-9]+\");\r\n            Match shotVersionMatch = shotVersionRegex.Match(version);\r\n            if ((shotVersionMatch.Success) && (shotVersionMatch.Value == version))\r\n            {\r\n                newVersion = string.Format(\"{0}.0.0.0\", version);\r\n                return true;\r\n            }\r\n\r\n            Regex versionRegex = new Regex(@\"[0-9]+\\.[0-9]+\\.*[0-9]*\\.*[0-9]*\");\r\n            Match versionMatch = versionRegex.Match(version);\r\n            if ((versionMatch.Success) && (versionMatch.Groups[0].Value.Length == version.Length))\r\n            {\r\n                newVersion = version;\r\n                return true;\r\n            }\r\n\r\n            newVersion = null;\r\n            return false;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/Foundation/XmlHelper.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Zip;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.Foundation\r\n{\r\n\tinternal static class XmlHelper\r\n\t{\r\n        public static PackageFragmentValidationResult LoadInstallXml(string zipFilename, out XElement installElement)\r\n        {\r\n            installElement = null;\r\n\r\n            ZipFileSystem zipFileSystem = null;\r\n            try\r\n            {\r\n                zipFileSystem = new ZipFileSystem(zipFilename);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex);\r\n            }\r\n\r\n            string filename = string.Format(\"~/{0}\", PackageSystemSettings.InstallFilename);\r\n            if (zipFileSystem.ContainsFile(filename) == false)\r\n            {\r\n                return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(\"Installation file '{0}' is missing from the zip file\", filename));\r\n            }\r\n\r\n            try\r\n            {\r\n                using (var stream = zipFileSystem.GetFileStream(filename))\r\n                using (var streamReader = new C1StreamReader(stream))\r\n                {\r\n                    string fileContent = streamReader.ReadToEnd();\r\n                    installElement = XElement.Parse(fileContent);\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/IPackageFragmentInstaller.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal interface IPackageFragmentInstaller\r\n    {\r\n        void Initialize(PackageInstallerContext packageInstallerContext, IEnumerable<XElement> configuration, XElement configurationParent);\r\n        IEnumerable<PackageFragmentValidationResult> Validate();\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <returns>\r\n        /// Returns uninstall information\r\n        /// </returns>\r\n        IEnumerable<XElement> Install();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/IPackageFragmentUninstaller.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal interface IPackageFragmentUninstaller\r\n    {\r\n        void Initialize(PackageUninstallerContext packageUninstallerContext, IEnumerable<XElement> configuration, XElement configurationParent);\r\n        IEnumerable<PackageFragmentValidationResult> Validate();\r\n        void Uninstall();\r\n        bool ValidateFirst { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/IPackageInstaller.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.PackageSystem.Foundation;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n\tinternal interface IPackageInstaller\r\n\t{\r\n        bool CanBeUninstalled { get; }\r\n        bool FlushOnCompletion { get; }\r\n        bool ReloadConsoleOnCompletion { get; }\r\n        IEnumerable<PackageFragmentValidationResult> Validate();\r\n        PackageFragmentValidationResult Install(SystemLockingType systemLockingType);        \r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/IPackageInstallerUninstallerFactory.cs",
    "content": "﻿namespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IPackageInstallerUninstallerFactory\r\n    {\r\n        /// <exclude />\r\n        IPackageUninstaller CreateUninstaller(string zipFilename, string uninstallFilename, string packageInstallationDirectory, string tempDirectory, bool flushOnCompletion, bool reloadConsoleOnCompletion, bool useTransaction, PackageInformation packageInformation);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/IPackageServerFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal interface IPackageServerFacade\r\n    {\r\n        ServerUrlValidationResult ValidateServerUrl(string packageServerUrl);\r\n        IEnumerable<PackageDescription> GetPackageDescriptions(string packageServerUrl, Guid installationId, CultureInfo userCulture);\r\n        string GetEulaText(string packageServerUrl, Guid eulaId, CultureInfo userCulture);\r\n        Stream GetInstallFileStream(string packageFileDownloadUrl);\r\n\r\n        void RegisterPackageInstallationCompletion(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp);\r\n        void RegisterPackageInstallationFailure(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp, string exceptionString);\r\n\r\n        void RegisterPackageUninstall(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp);\r\n\r\n        void ClearCache();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/IPackageUninstaller.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.PackageSystem.Foundation;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IPackageUninstaller\r\n    {\r\n        /// <exclude />\r\n        bool FlushOnCompletion { get; }\r\n\r\n        /// <exclude />\r\n        bool ReloadConsoleOnCompletion { get; }\r\n\r\n        /// <exclude />\r\n        IEnumerable<PackageFragmentValidationResult> Validate();\r\n\r\n        /// <exclude />\r\n        PackageFragmentValidationResult Uninstall(SystemLockingType systemLockingType);        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/InstalledPackageInformation.cs",
    "content": "﻿using System;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SerializerHandler(typeof(InstalledPackageInformationSerializerHandler))]\r\n    public sealed class InstalledPackageInformation\r\n    {\r\n        /// <exclude />\r\n        public Guid Id { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string Name { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string GroupName { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string Version { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string Author { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string Website { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string Description { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public DateTime InstallDate { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string InstalledBy { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public bool IsLocalInstalled { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public bool CanBeUninstalled { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public bool FlushOnCompletion { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public bool ReloadConsoleOnCompletion { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public SystemLockingType SystemLockingType { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public string PackageServerAddress { get; internal set; }\r\n\r\n        /// <exclude />\r\n        internal string PackageInstallPath { get; set; }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/LicenseDefinitionManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal static class LicenseDefinitionManager\r\n    {\r\n        private const string LicenseFileExtension = \".license\";\r\n        private static readonly string LogTitle = typeof (LicenseDefinitionManager).Name;\r\n\r\n        private static readonly string _packageLicenseDirectory;\r\n        private static readonly int _maximumProductNameLength;\r\n\r\n        static LicenseDefinitionManager()\r\n        {\r\n            _packageLicenseDirectory = PathUtil.Resolve(GlobalSettingsFacade.PackageLicenseDirectory);\r\n\r\n            if (!C1Directory.Exists(_packageLicenseDirectory))\r\n            {\r\n                C1Directory.CreateDirectory(_packageLicenseDirectory);\r\n            }\r\n\r\n            _maximumProductNameLength = 255 - (GlobalSettingsFacade.MaximumRootPathLength + (GlobalSettingsFacade.PackageLicenseDirectory.Length - 1) + LicenseFileExtension.Length);\r\n        }\r\n\r\n\r\n        \r\n        public static PackageLicenseDefinition GetLicenseDefinition(Guid productId)\r\n        {\r\n            return GetLicenseDefinitions(productId).OrderByDescending(l => l.Expires).FirstOrDefault();\r\n        }\r\n\r\n\r\n        public static PackageLicenseDefinition[] GetLicenseDefinitions(Guid productId)\r\n        {\r\n            var result = new List<PackageLicenseDefinition>();\r\n\r\n            foreach (var file in C1Directory.GetFiles(_packageLicenseDirectory, \"*\" + LicenseFileExtension, SearchOption.TopDirectoryOnly))\r\n            {\r\n                var license = TryLoadLicenseFile(file);\r\n\r\n                if (license != null && license.ProductId == productId)\r\n                {\r\n                    result.Add(license);\r\n                }\r\n            }\r\n\r\n            string obsoloteFilename = GetObsoleteLicenseFilename(productId);\r\n            if (C1File.Exists(obsoloteFilename))\r\n            {\r\n                var license = TryLoadLicenseFile(obsoloteFilename);\r\n\r\n                if (license != null)\r\n                {\r\n                    if (license.ProductId == productId)\r\n                    {\r\n                        result.Add(license);\r\n                    }\r\n                    else\r\n                    {\r\n                        Log.LogError(LogTitle, \"The license for the product '{0}' does not match the product in the license file '{1}'\", productId, license.ProductId);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result.ToArray();\r\n        }\r\n\r\n        \r\n        public static void StoreLicenseDefinition(PackageLicenseDefinition licenseDefinition)\r\n        {\r\n            XDocument doc = new XDocument(\r\n                new XElement(\"License\",\r\n                    new XElement(\"Name\", licenseDefinition.ProductName),\r\n                    new XElement(\"InstallationId\", licenseDefinition.InstallationId),\r\n                    new XElement(\"ProductId\", licenseDefinition.ProductId),\r\n                    new XElement(\"Permanent\", licenseDefinition.Permanent),                                        \r\n                    new XElement(\"Expires\", licenseDefinition.Expires),\r\n                    new XElement(\"LicenseKey\", licenseDefinition.LicenseKey),\r\n                    new XElement(\"PurchaseUrl\", licenseDefinition.PurchaseUrl)\r\n                )\r\n            );\r\n\r\n            string filename = GetLicenseFilename(licenseDefinition);\r\n\r\n            licenseDefinition.LicenseFileName = filename;\r\n\r\n            doc.SaveToFile(filename);\r\n        }\r\n\r\n\r\n        private static PackageLicenseDefinition TryLoadLicenseFile(string filePath)\r\n        {\r\n            XDocument doc = XDocumentUtils.Load(filePath);\r\n\r\n            var licenseDefinition = new PackageLicenseDefinition\r\n            {\r\n                ProductName = doc.Descendants(\"Name\").Single().Value,\r\n                InstallationId = (Guid)doc.Descendants(\"InstallationId\").Single(),\r\n                ProductId = (Guid)doc.Descendants(\"ProductId\").Single(),\r\n                Permanent = (bool)doc.Descendants(\"Permanent\").Single(),\r\n                Expires = (DateTime?)doc.Descendants(\"Expires\").SingleOrDefault() ?? DateTime.MaxValue,\r\n                LicenseKey = doc.Descendants(\"LicenseKey\").Single().Value,\r\n                PurchaseUrl = doc.Descendants(\"PurchaseUrl\").SingleOrDefault()?.Value ?? \"\",\r\n                LicenseFileName = filePath\r\n            };\r\n\r\n            if (licenseDefinition.InstallationId != InstallationInformationFacade.InstallationId)\r\n            {\r\n                Log.LogError(LogTitle, $\"The license for the product '{licenseDefinition.ProductId}' ({licenseDefinition.ProductName}) does not match the current installation\");\r\n                return null;\r\n            }\r\n\r\n            return licenseDefinition;\r\n        }\r\n\r\n        public static void RemoveLicenseDefintion(Guid productId)\r\n        {\r\n            foreach (var license in GetLicenseDefinitions(productId))\r\n            {\r\n                FileUtils.Delete(license.LicenseFileName);\r\n            }\r\n        }\r\n\r\n\r\n        private static string GetLicenseFilename(PackageLicenseDefinition packageLicenseDefinition)\r\n        {\r\n            string productName = packageLicenseDefinition.ProductName;\r\n\r\n            if (productName.Length > _maximumProductNameLength)\r\n            {\r\n                productName = productName.Substring(productName.Length - _maximumProductNameLength);\r\n            }\r\n\r\n            return Path.Combine(_packageLicenseDirectory, productName + LicenseFileExtension);\r\n        }\r\n\r\n\r\n        private static string GetObsoleteLicenseFilename(Guid productId)\r\n        {\r\n            return Path.Combine(_packageLicenseDirectory, $\"{productId}.xml\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/LicenseDefinitionUtils.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing System.Text;\r\nusing System.Security.Cryptography;\r\n\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    internal static class LicenseDefinitionUtils\r\n    {       \r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"publicKeyXml\"></param>\r\n        /// <returns></returns>\r\n        public static object CreateSignatureHashAlgorithm(string publicKeyXml)\r\n        {\r\n            return SHA256.Create();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"licenseKey\"></param>\r\n        /// <returns></returns>\r\n        public static byte[] GetLicenseKeyBytes(string licenseKey)\r\n        {\r\n            return Convert.FromBase64String(licenseKey);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"signatureString\"></param>\r\n        /// <returns></returns>\r\n        public static byte[] CreateSignatureBytes(string signatureString)\r\n        {\r\n            UTF8Encoding encoding = new UTF8Encoding();\r\n            byte[] signature = encoding.GetBytes(signatureString);\r\n\r\n            return signature;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/LicenseServerFacade.cs",
    "content": "﻿using System;\r\nusing System.ServiceModel;\r\nusing Composite.Core.PackageSystem.WebServiceClient;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    internal static class LicenseServerFacade\r\n    {\r\n        public static string ValidateTrialLicenseDefinitionRequest(Guid installationId, Guid productId, string publicKeyXml)\r\n        {\r\n            var client = CreateClient();\r\n\r\n            return client.ValidateTrialLicenseDefinitionRequest(installationId, productId, publicKeyXml);\r\n        }\r\n\r\n\r\n\r\n        public static LicenseDefinitionDescriptor GetTrialLicenseDefinition(Guid installationId, Guid productId, string publicKeyXml)\r\n        {\r\n            var client = CreateClient();\r\n\r\n            return client.GetTrialLicenseDefinition(installationId, productId, publicKeyXml);\r\n        }\r\n        \r\n\r\n        \r\n        private static string LicenseServerUrl\r\n            => \"https://package.composite.net/PackageLicense/LicenseDefinitionService.asmx\";\r\n\r\n\r\n        private static LicenseDefinitionServiceSoapClient CreateClient()\r\n        {\r\n            var timeout = TimeSpan.FromMinutes(RuntimeInformation.IsDebugBuild ? 2 : 1);\r\n\r\n            var basicHttpBinding = new BasicHttpBinding\r\n            {\r\n                CloseTimeout = timeout,\r\n                OpenTimeout = timeout,\r\n                ReceiveTimeout = timeout,\r\n                SendTimeout = timeout\r\n            };\r\n\r\n            if (LicenseServerUrl.StartsWith(\"https\", StringComparison.OrdinalIgnoreCase))\r\n            {\r\n                basicHttpBinding.Security.Mode = BasicHttpSecurityMode.Transport;\r\n            }\r\n            basicHttpBinding.MaxReceivedMessageSize = int.MaxValue;\r\n\r\n            return new LicenseDefinitionServiceSoapClient(basicHttpBinding, new EndpointAddress(LicenseServerUrl));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageAssemblyHandler.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Types.Foundation;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal static class PackageAssemblyHandler\r\n    {\r\n        private static bool _initialized;\r\n        private static readonly object _lock = new object();\r\n        private static AssemblyFilenameCollection _loadedAssemblyFilenames = new AssemblyFilenameCollection();\r\n        private static List<Assembly> _inMemoryAssemblies = new List<Assembly>();\r\n\r\n        public static void Initialize()\r\n        {\r\n            if (_initialized) return;\r\n\r\n            lock (_lock)\r\n            {\r\n                if (_initialized) return;\r\n\r\n                GlobalEventSystemFacade.SubscribeToFlushEvent(args => ClearAssemblyList());\r\n\r\n                AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;\r\n                AppDomain.CurrentDomain.AssemblyLoad += OnAssemblyLoad;\r\n\r\n                _initialized = true;\r\n            }\r\n        }\r\n\r\n        private static void OnAssemblyLoad(object sender, AssemblyLoadEventArgs args)\r\n        {\r\n            var asm = args.LoadedAssembly;\r\n            if (!asm.IsDynamic)\r\n            {\r\n                Log.LogVerbose(nameof(PackageAssemblyHandler), $\"Assembly loaded: {asm.Location}\");\r\n            }\r\n        }\r\n\r\n\r\n        public static void AddAssembly(string assemblyFilePath)\r\n        {\r\n            Initialize();\r\n\r\n            lock (_lock)\r\n            {\r\n                _loadedAssemblyFilenames.Add(assemblyFilePath);\r\n            }\r\n        }\r\n\r\n\r\n        public static Assembly TryGetAlreadyLoadedAssembly(string assemblyFileName)\r\n        {\r\n            string assemblyName = AssemblyFilenameCollection.GetAssemblyName(assemblyFileName);\r\n\r\n            lock (_lock)\r\n            {\r\n                return _inMemoryAssemblies.FirstOrDefault(asm => asm.GetName().Name == assemblyName);\r\n            }\r\n        }\r\n\r\n\r\n        private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)\r\n        {\r\n            string filename = args.Name;\r\n\r\n            string fn = filename;\r\n            if (fn.Contains(\",\"))\r\n            {\r\n                fn = fn.Remove(fn.IndexOf(',')).Trim();\r\n            }\r\n\r\n            if (_loadedAssemblyFilenames.ContainsAssemblyName(fn))\r\n            {\r\n                filename = _loadedAssemblyFilenames.GetFilenameByAssemblyName(fn);\r\n            }\r\n\r\n            Assembly assembly = null;\r\n            if (filename.Contains(@\":\\\"))\r\n            {\r\n                try\r\n                {\r\n                    assembly = Assembly.LoadFrom(filename);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(nameof(PackageAssemblyHandler), ex);\r\n                }\r\n\r\n                lock (_lock)\r\n                {\r\n                    _inMemoryAssemblies.Add(assembly);\r\n                }\r\n            }\r\n\r\n            return assembly;\r\n        }\r\n\r\n\r\n        public static void ClearAssemblyList()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _loadedAssemblyFilenames = new AssemblyFilenameCollection();\r\n                _inMemoryAssemblies = new List<Assembly>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageDescription.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Serialization;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SerializerHandler(typeof(PropertySerializerHandler))]\r\n\tpublic sealed class PackageDescription\r\n\t{\r\n        /// <exclude />\r\n        public string PackageFileDownloadUrl { get; set; }\r\n\r\n        /// <exclude />\r\n        public string PackageVersion { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Description { get; set; }\r\n\r\n        /// <exclude />\r\n        public Guid EulaId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string GroupName { get; set; }\r\n\r\n        /// <exclude />\r\n        public Guid Id { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool InstallationRequireLicenseFileUpdate { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsFree { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsTrial { get; set; }\r\n\r\n        /// <exclude />\r\n        public Guid LicenseRuleId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string MaxCompositeVersionSupported { get; set; }\r\n\r\n        /// <exclude />\r\n        public string MinCompositeVersionSupported { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public decimal PriceAmmount { get; set; }\r\n\r\n        /// <exclude />\r\n        public string PriceCurrency { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ReadMoreUrl { get; set; }\r\n\r\n        /// <exclude />\r\n        public string TechicalDetails { get; set; }\r\n\r\n        /// <exclude />\r\n        public int TrialPeriodDays { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool UpgradeAgreementMandatory { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Vendor { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ConsoleBrowserUrl { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<Subscription> AvailableInSubscriptions { get; set; }\r\n    }\r\n\r\n\r\n    /// <exclude />\r\n    public sealed class Subscription\r\n    {\r\n        /// <exclude />\r\n        public Guid Id { get; set; }\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n        /// <exclude />\r\n        public string DetailsUrl { get; set; }\r\n        /// <exclude />\r\n        public bool Purchasable { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/BasePackageFragmentInstaller.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class BasePackageFragmentInstaller : IPackageFragmentInstaller\r\n\t{\r\n        /// <exclude />\r\n        public void Initialize(PackageInstallerContext packageInstallerContext, IEnumerable<XElement> configuration, XElement configurationParent)\r\n        {\r\n            Verify.ArgumentNotNull(packageInstallerContext, \"packageInstallerContext\");\r\n            Verify.ArgumentNotNull(configuration, \"configuration\");\r\n            Verify.ArgumentNotNull(configurationParent, \"configurationParent\");\r\n\r\n            this.InstallerContext = packageInstallerContext;\r\n            this.Configuration = configuration;\r\n            this.ConfigurationParent = configurationParent;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public abstract IEnumerable<PackageFragmentValidationResult> Validate();\r\n\r\n        /// <exclude />\r\n        public abstract IEnumerable<XElement> Install();\r\n\r\n        /// <exclude />\r\n        protected PackageInstallerContext InstallerContext { get; private set; }\r\n\r\n        /// <exclude />\r\n        protected IEnumerable<XElement> Configuration { get; set; }\r\n\r\n        /// <exclude />\r\n        protected XElement ConfigurationParent { get; set; }\r\n\r\n\r\n        internal static string GetResourceString(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Core.PackageSystem.PackageFragmentInstallers\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/BasePackageFragmentUninstaller.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing System;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class BasePackageFragmentUninstaller : IPackageFragmentUninstaller\r\n\t{\r\n        /// <exclude />\r\n        public void Initialize(PackageUninstallerContext packageUninstallerContext, IEnumerable<XElement> configuration, XElement configurationParent)\r\n        {\r\n            Verify.ArgumentNotNull(packageUninstallerContext, \"packageUninstallerContext\");\r\n            Verify.ArgumentNotNull(configuration, \"configuration\");\r\n            Verify.ArgumentNotNull(configurationParent, \"configurationParent\");\r\n            \r\n\r\n            this.UninstallerContext = packageUninstallerContext;\r\n            this.Configuration = configuration;\r\n            this.ConfigurationParent = configurationParent;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public abstract IEnumerable<PackageFragmentValidationResult> Validate();\r\n\r\n        /// <exclude />\r\n        public abstract void Uninstall();\r\n\r\n        /// <exclude />\r\n        protected IEnumerable<XElement> Configuration { get; set; }\r\n\r\n        /// <exclude />\r\n        protected XElement ConfigurationParent { get; set; }\r\n\r\n        /// <exclude />\r\n        public virtual bool ValidateFirst { get { return false; } }\r\n\r\n        /// <exclude />\r\n        protected PackageUninstallerContext UninstallerContext { get; private set; }\r\n\r\n        internal static string GetResourceString(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Core.PackageSystem.PackageFragmentInstallers\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/ConfigurationTransformationPackageFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Zip;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConfigurationTransformationPackageFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private const string _installElementName = \"Install\";\r\n        private const string _uninstallElementName = \"Uninstall\";\r\n        private const string _xsltFilePathAttributeName = \"xsltFilePath\";\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            List<PackageFragmentValidationResult> validationResults = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count() > 2)\r\n            {\r\n                validationResults.AddFatal(\r\n                    GetResourceString(\"ConfigurationTransformationPackageFragmentInstaller.ExpectedExactlyTwoElements\")\r\n                    .FormatWith(_installElementName, _uninstallElementName));\r\n            }\r\n\r\n            ValidateXslt(\r\n                validationResults,\r\n                () => this.InstallElement,\r\n                _installElementName,\r\n                () => this.InstallElement.Attribute(_xsltFilePathAttributeName),\r\n                () => this.InstallXsltFilePath,\r\n                this.InstallerContext.ZipFileSystem,\r\n                true);\r\n\r\n            if (validationResults.Count == 0 \r\n                && this.InstallerContext.PackageInformation.CanBeUninstalled)\r\n            {\r\n\r\n                ValidateXslt(\r\n                    validationResults,\r\n                    () => this.UninstallElement,\r\n                    _uninstallElementName,\r\n                    () => this.UninstallElement.Attribute(_xsltFilePathAttributeName),\r\n                    () => this.UninstallXsltFilePath,\r\n                    this.InstallerContext.ZipFileSystem,\r\n                    false);\r\n\r\n            }\r\n\r\n            return validationResults;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            using (Stream xsltFileStream = this.InstallerContext.ZipFileSystem.GetFileStream(this.InstallXsltFilePath))\r\n            {\r\n                using (TextReader xsltTextReader = new StreamReader(xsltFileStream))\r\n                {\r\n                    XDocument xslt = XDocument.Load(xsltTextReader);\r\n\r\n                    ConfigurationServices.TransformConfiguration(xslt, false);\r\n                }\r\n            }\r\n\r\n            if (this.InstallerContext.PackageInformation.CanBeUninstalled)\r\n            {\r\n                yield return this.UninstallElement;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void ValidateXslt(List<PackageFragmentValidationResult> validationResults, Func<XElement> elementProvider, string elementName, Func<XAttribute> xsltPathAttributeProvider, Func<string> xsltFilePathProvider, IZipFileSystem zipFileSystem, bool validateResultingConfigurationFile)\r\n        {\r\n            if (elementProvider() == null)\r\n            {\r\n                validationResults.AddFatal(\r\n                    GetResourceString(\"ConfigurationTransformationPackageFragmentInstaller.MissingElement\")\r\n                    .FormatWith(elementName));\r\n                return;\r\n            }\r\n\r\n            string xslFilePath = xsltFilePathProvider();\r\n\r\n            if (xslFilePath == null)\r\n            {\r\n                validationResults.AddFatal(\r\n                    GetResourceString(\"ConfigurationTransformationPackageFragmentInstaller.MissingAttribute\")\r\n                    .FormatWith(_xsltFilePathAttributeName), elementProvider());\r\n                return;\r\n            }\r\n\r\n            if (zipFileSystem.ContainsFile(xslFilePath) == false)\r\n            {\r\n                validationResults.AddFatal(\r\n                    GetResourceString(\"ConfigurationTransformationPackageFragmentInstaller.PathDoesNotExist\")\r\n                    .FormatWith(xslFilePath), xsltPathAttributeProvider());\r\n                return;\r\n            }\r\n\r\n            if(!PathUtil.WritePermissionGranted(ConfigurationServices.FileConfigurationSourcePath))\r\n            {\r\n                validationResults.AddFatal(\r\n                    GetResourceString(\"NotEnoughNtfsPermissions\")\r\n                    .FormatWith(ConfigurationServices.FileConfigurationSourcePath));\r\n                return;\r\n            }\r\n\r\n            using (Stream xsltFileStream = zipFileSystem.GetFileStream(xslFilePath))\r\n            {\r\n                using (TextReader xsltTextReader = new C1StreamReader(xsltFileStream))\r\n                {\r\n                    XDocument xslt = null;\r\n\r\n                    try\r\n                    {\r\n                        xslt = XDocument.Load(xsltTextReader);\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        validationResults.AddFatal(\r\n                            GetResourceString(\"ConfigurationTransformationPackageFragmentInstaller.UnableToParsXslt\")\r\n                            .FormatWith(xslFilePath, ex.Message), xsltPathAttributeProvider());\r\n                    }\r\n\r\n                    if (xslt != null && validateResultingConfigurationFile)\r\n                    {\r\n                        try\r\n                        {\r\n                            ConfigurationServices.TransformConfiguration(xslt, true);\r\n                        }\r\n                        //catch (ConfigurationException ex)\r\n                        //{\r\n                        //    validationResults.AddFatal(\r\n                        //        GetResourceString(\"ConfigurationTransformationPackageFragmentInstaller.XsltWillGeneratedInvalid\")\r\n                        //        .FormatWith(xsltFilePathProvider(), ex.Message), xsltPathAttributeProvider());\r\n                        //}\r\n                        catch (Exception ex)\r\n                        {\r\n                            validationResults.AddFatal(\r\n                                GetResourceString(\"ConfigurationTransformationPackageFragmentInstaller.XsltWillGeneratedInvalid\")\r\n                                .FormatWith(xslFilePath, ex.Message), xsltPathAttributeProvider());\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n     \r\n\r\n\r\n        private XElement InstallElement { get { return this.Configuration.FirstOrDefault(f => f.Name == _installElementName); } }\r\n        private XElement UninstallElement { get { return this.Configuration.FirstOrDefault(f => f.Name == _uninstallElementName); } }\r\n\r\n        private string InstallXsltFilePath\r\n        {\r\n            get\r\n            {\r\n                return InstallElement.GetAttributeValue(_xsltFilePathAttributeName);\r\n            }\r\n        }\r\n\r\n\r\n        private string UninstallXsltFilePath\r\n        {\r\n            get\r\n            {\r\n                return this.UninstallElement.GetAttributeValue(_xsltFilePathAttributeName);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/ConfigurationTransformationPackageFragmentUninstaller.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConfigurationTransformationPackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n\t{\r\n        private const string _uninstallElementName = \"Uninstall\";\r\n        private const string _xsltFilePathAttributeName = \"xsltFilePath\";\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            List<PackageFragmentValidationResult> validationResults = new List<PackageFragmentValidationResult>();\r\n\r\n            ConfigurationTransformationPackageFragmentInstaller.ValidateXslt(\r\n                validationResults,\r\n                () => this.UninstallElement,\r\n                _uninstallElementName,\r\n                () => this.UninstallElement.Attribute(_xsltFilePathAttributeName),\r\n                () => this.UninstallXsltFilePath,\r\n                this.UninstallerContext.ZipFileSystem,\r\n                true);\r\n\r\n            return validationResults;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            using (Stream xsltFileStream = this.UninstallerContext.ZipFileSystem.GetFileStream(this.UninstallXsltFilePath))\r\n            {\r\n                using (TextReader xsltTextReader = new C1StreamReader(xsltFileStream))\r\n                {\r\n                    XDocument xslt = XDocument.Load(xsltTextReader);\r\n\r\n                    ConfigurationServices.TransformConfiguration(xslt, false);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private XElement UninstallElement { get { return this.Configuration.FirstOrDefault(f => f.Name == _uninstallElementName); } }\r\n\r\n        private string UninstallXsltFilePath\r\n        {\r\n            get\r\n            {\r\n                return this.UninstallElement.GetAttributeValue(_xsltFilePathAttributeName);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/DataPackageFragmentInstaller.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Types;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataPackageFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private static readonly string LogTitle = nameof(DataPackageFragmentInstaller);\r\n\r\n        private List<DataType> _dataTypes;\r\n        private List<PackageFragmentValidationResult> _validationResult;\r\n\r\n        private Dictionary<Type, TypeKeyInstallationData> _dataKeysToBeInstalled;\r\n        private Dictionary<Guid, TypeKeyInstallationData> _dataKeysToBeInstalledByTypeId;\r\n\r\n        private Dictionary<Type, HashSet<KeyValuePair<string, object>>> _missingDataReferences;\r\n\r\n        private static readonly Dictionary<Guid, Guid> _pageVersionIds = new Dictionary<Guid, Guid>();\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            _validationResult = new List<PackageFragmentValidationResult>();\r\n            _dataKeysToBeInstalled = new Dictionary<Type, TypeKeyInstallationData>();\r\n            _dataKeysToBeInstalledByTypeId = new Dictionary<Guid, TypeKeyInstallationData>();\r\n            _missingDataReferences = new Dictionary<Type, HashSet<KeyValuePair<string, object>>>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Types\") > 1)\r\n            {\r\n                _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_OnlyOneElement);\r\n                return _validationResult;\r\n            }\r\n\r\n            _dataTypes = new List<DataType>();\r\n\r\n            ValidateAndLoadConfiguration();\r\n\r\n            foreach (DataType dataType in _dataTypes)\r\n            {\r\n                dataType.InterfaceType = TypeManager.TryGetType(dataType.InterfaceTypeName);\r\n\r\n\r\n                if (dataType.IsDynamicAdded || this.InstallerContext.IsDataTypePending(dataType.InterfaceTypeName))\r\n                {\r\n                    ValidateDynamicAddedType(dataType);\r\n                }\r\n                else\r\n                {\r\n                    ValidateNonDynamicAddedType(dataType);\r\n                }\r\n            }\r\n\r\n            if (_validationResult.Count > 0)\r\n            {\r\n                _dataTypes = null;\r\n            }\r\n\r\n            return _validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            Verify.IsNotNull(_dataTypes, \"DataPackageFragmentInstaller has not been validated\");\r\n\r\n            List<XElement> typeElements = new List<XElement>();\r\n            foreach (DataType dataType in _dataTypes)\r\n            {\r\n                Log.LogVerbose(LogTitle, $\"Installing data for the type '{dataType.InterfaceType}'\");\r\n\r\n                if (dataType.IsDynamicAdded || dataType.InterfaceType == null)\r\n                {\r\n                    dataType.InterfaceType = this.InstallerContext.IsDataTypePending(dataType.InterfaceTypeName)\r\n                        ? this.InstallerContext.GetPendingDataType(dataType.InterfaceTypeName)\r\n                        : TypeManager.GetType(dataType.InterfaceTypeName);\r\n\r\n                    Verify.IsNotNull(dataType.InterfaceType, \"Failed to get interface type by name: '{0}'\", dataType.InterfaceTypeName);\r\n                }\r\n\r\n                XElement typeElement = new XElement(\"Type\",\r\n                    new XAttribute(\"type\", TypeManager.SerializeType(dataType.InterfaceType)),\r\n                    new XAttribute(\"dataScopeIdentifier\", dataType.DataScopeIdentifier));\r\n\r\n\r\n                using (new DataScope(dataType.DataScopeIdentifier))\r\n                {\r\n                    if (dataType.AddToAllLocales)\r\n                    {\r\n                        foreach (CultureInfo locale in DataLocalizationFacade.ActiveLocalizationCultures)\r\n                        {\r\n                            using (new DataScope(locale))\r\n                            {\r\n                                XElement element = AddData(dataType, locale);\r\n                                typeElement.Add(element);\r\n                            }\r\n                        }\r\n                    }\r\n                    else if (dataType.AddToCurrentLocale)\r\n                    {\r\n                        var currentLocale = DataLocalizationFacade.DefaultLocalizationCulture;\r\n                        if (UserValidationFacade.IsLoggedIn())\r\n                        {\r\n                            currentLocale = UserSettings.ActiveLocaleCultureInfo;\r\n                        }\r\n\r\n                        using (new DataScope(currentLocale))\r\n                        {\r\n                            XElement element = AddData(dataType, currentLocale);\r\n                            typeElement.Add(element);\r\n                        }\r\n                    }\r\n                    else if (dataType.Locale != null)\r\n                    {\r\n                        if (DataLocalizationFacade.ActiveLocalizationCultures.Contains(dataType.Locale))\r\n                        {\r\n                            using (new DataScope(dataType.Locale))\r\n                            {\r\n                                XElement element = AddData(dataType, dataType.Locale);\r\n                                typeElement.Add(element);\r\n                            }\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        var locale = UserValidationFacade.IsLoggedIn()\r\n                            ? UserSettings.ActiveLocaleCultureInfo\r\n                            : DataLocalizationFacade.DefaultLocalizationCulture;\r\n                        \r\n                        using (new DataScope(locale))\r\n                        {\r\n                            XElement element = AddData(dataType, null);\r\n                            typeElement.Add(element);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                typeElements.Add(typeElement);\r\n            }\r\n\r\n            yield return new XElement(\"Types\", typeElements);\r\n        }\r\n\r\n\r\n        private static Type GetInstalledVersionOfPendingType(Type interfaceType, IData data)\r\n        {\r\n            return data.GetType().GetInterfaces().FirstOrDefault(i => i.FullName == interfaceType.FullName);\r\n        }\r\n\r\n\r\n        private XElement AddData(DataType dataType, CultureInfo cultureInfo)\r\n        {\r\n            XElement datasElement = new XElement(\"Datas\");\r\n\r\n            if (cultureInfo != null)\r\n            {\r\n                datasElement.Add(new XAttribute(\"locale\", cultureInfo.Name));\r\n            }\r\n\r\n            foreach (XElement addElement in dataType.Dataset)\r\n            {\r\n                var interfaceType = dataType.InterfaceType;\r\n\r\n                IData data = DataFacade.BuildNew(interfaceType);\r\n\r\n                if (!dataType.InterfaceType.IsInstanceOfType(data))\r\n                {\r\n                    dataType.InterfaceType = GetInstalledVersionOfPendingType(interfaceType, data);\r\n                }\r\n\r\n\r\n                var dataKey = PopulateAndReturnKeyPropertyValues(dataType, data, addElement);\r\n\r\n                if (dataType.AllowOverwrite || dataType.OnlyUpdate)\r\n                {\r\n                    List<IData> existingDataList = DataFacade.TryGetDataByLookupKeys(interfaceType, dataKey).ToList();\r\n                    if (existingDataList.Count > 1) throw new InvalidOperationException(\"Got more than 1 existing data element when querying on key properties for \" + addElement.ToString());\r\n\r\n                    IData existingData = existingDataList.FirstOrDefault();\r\n\r\n                    if (existingData != null)\r\n                    {\r\n                        PopulateAndReturnKeyPropertyValues(dataType, existingData, addElement);\r\n                        DataFacade.Update(existingData, false, true, false);\r\n\r\n                        continue;\r\n                    }\r\n\r\n                    if (dataType.OnlyUpdate)\r\n                    {\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                if (data is ILocalizedControlled localizedControlled)\r\n                {\r\n                    localizedControlled.SourceCultureName = LocalizationScopeManager.MapByType(interfaceType).Name;\r\n                }\r\n\r\n                if (data is IVersioned versionedData)\r\n                {\r\n                    UpdateVersionId(versionedData);\r\n                }\r\n\r\n                DataFacade.AddNew(data, false, true, false); // Ignore validation, this should have been done in the validation face\r\n\r\n                XElement keysElement = new XElement(\"Keys\");\r\n\r\n                foreach (PropertyInfo propertyInfo in data.GetKeyProperties())\r\n                {\r\n                    string keyName = propertyInfo.Name;\r\n                    object keyValue = propertyInfo.GetValue(data, null);\r\n\r\n                    XElement keyElement = new XElement(\"Key\",\r\n                        new XAttribute(\"name\", keyName),\r\n                        new XAttribute(\"value\", keyValue));\r\n\r\n                    keysElement.Add(keyElement);\r\n                }\r\n\r\n                datasElement.Add(keysElement);\r\n            }\r\n\r\n            return datasElement;\r\n        }\r\n\r\n\r\n        private void UpdateVersionId(IVersioned data)\r\n        {\r\n            if (data.VersionId != Guid.Empty)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (data is IPage page)\r\n            {\r\n                if (_pageVersionIds.TryGetValue(page.Id, out Guid versionId))\r\n                {\r\n                    page.VersionId = versionId;\r\n                }\r\n                else\r\n                {\r\n                    page.VersionId = Guid.NewGuid();\r\n                    _pageVersionIds[page.Id] = page.VersionId;\r\n                }\r\n            }\r\n\r\n            else if (data is IPagePlaceholderContent pagePlaceholderContent)\r\n            {\r\n                if (_pageVersionIds.TryGetValue(pagePlaceholderContent.PageId, out Guid versionId))\r\n                {\r\n                    data.VersionId = versionId;\r\n                }\r\n            }\r\n            else if (data is IPageData pageData)\r\n            {\r\n                if (_pageVersionIds.TryGetValue(pageData.PageId, out Guid versionId))\r\n                {\r\n                    data.VersionId = versionId;\r\n                }\r\n            }\r\n        }\r\n\r\n        \r\n        private static DataPropertyValueCollection PopulateAndReturnKeyPropertyValues(DataType dataType, IData dataToPopulate, XElement addElement)\r\n        {\r\n            var dataKeyPropertyCollection = new DataPropertyValueCollection();\r\n\r\n            var properties = GetDataTypeProperties(dataType.InterfaceType);\r\n\r\n            var keyPropertyNames = dataType.InterfaceType.GetKeyPropertyNames();\r\n            var versionKeyPropertyNames = dataType.InterfaceType.GetVersionKeyPropertyNames();\r\n\r\n            foreach (XAttribute attribute in addElement.Attributes())\r\n            {\r\n                string fieldName = attribute.Name.LocalName;\r\n                if (IsObsoleteField(dataType, fieldName))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                PropertyInfo propertyInfo = properties[fieldName];\r\n\r\n                object fieldValue = ValueTypeConverter.Convert(attribute.Value, propertyInfo.PropertyType);\r\n                propertyInfo.SetValue(dataToPopulate, fieldValue, null);\r\n\r\n                if (keyPropertyNames.Contains(fieldName) || versionKeyPropertyNames.Contains(fieldName))\r\n                {\r\n                    dataKeyPropertyCollection.AddKeyProperty(propertyInfo, fieldValue);\r\n                }\r\n            }\r\n\r\n            return dataKeyPropertyCollection;\r\n        } \r\n\r\n        private void ValidateAndLoadConfiguration()\r\n        {\r\n            XElement typesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Types\");\r\n            if (typesElement == null)\r\n            {\r\n                _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.MissingElement\"));\r\n            }\r\n\r\n            if (typesElement == null) return;\r\n\r\n            foreach (XElement typeElement in typesElement.Elements(\"Type\"))\r\n            {\r\n                var typeAttribute = typeElement.Attribute(\"type\");\r\n                if (typeAttribute == null)\r\n                {\r\n                    _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_MissingAttribute(\"type\"), typeElement);\r\n                    continue;\r\n                }\r\n\r\n                XAttribute allowOverwriteAttribute = typeElement.Attribute(\"allowOverwrite\");\r\n                XAttribute onlyUpdateAttribute = typeElement.Attribute(\"onlyUpdate\");\r\n\r\n                bool allowOverwrite = allowOverwriteAttribute != null && (bool)allowOverwriteAttribute;\r\n                bool onlyUpdate = onlyUpdateAttribute != null && (bool)onlyUpdateAttribute;\r\n\r\n                string interfaceTypeName = typeAttribute.Value;\r\n\r\n                interfaceTypeName = TypeManager.FixLegasyTypeName(interfaceTypeName);\r\n\r\n                foreach (XElement dataElement in typeElement.Elements(\"Data\"))\r\n                {\r\n                    XAttribute dataScopeIdentifierAttribute = dataElement.Attribute(\"dataScopeIdentifier\");\r\n                    if (dataScopeIdentifierAttribute == null)\r\n                    {\r\n                        _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_MissingAttribute(\"dataScopeIdentifier\"), typeElement);\r\n                        continue;\r\n                    }\r\n\r\n                    DataScopeIdentifier dataScopeIdentifier;\r\n                    try\r\n                    {\r\n                        dataScopeIdentifier = DataScopeIdentifier.Deserialize(dataScopeIdentifierAttribute.Value);\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.WrongDataScopeIdentifier\").FormatWith(dataScopeIdentifierAttribute.Value), dataScopeIdentifierAttribute);\r\n                        continue;\r\n                    }\r\n\r\n\r\n\r\n                    CultureInfo locale = null; // null => do not use localization\r\n                    bool allLocales = false;\r\n                    bool currentLocale = false;\r\n                    XAttribute localeAttribute = dataElement.Attribute(\"locale\");\r\n                    if (localeAttribute != null)\r\n                    {\r\n                        if (localeAttribute.Value == \"*\")\r\n                        {\r\n                            allLocales = true;\r\n                        }\r\n                        else if (localeAttribute.Value == \"?\")\r\n                        {\r\n                            currentLocale = true;\r\n                        }\r\n                        else\r\n                        {\r\n                            try\r\n                            {\r\n                                locale = CultureInfo.CreateSpecificCulture(localeAttribute.Value);\r\n                            }\r\n                            catch (Exception)\r\n                            {\r\n                                _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.WrongLocale\").FormatWith(localeAttribute.Value), localeAttribute);\r\n                                continue;\r\n                            }\r\n                        }\r\n                    }\r\n\r\n\r\n                    XAttribute dataFilenameAttribute = dataElement.Attribute(\"dataFilename\");\r\n                    if (dataFilenameAttribute == null)\r\n                    {\r\n                        _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_MissingAttribute(\"dataFilename\"), typeElement);\r\n                        continue;\r\n                    }\r\n\r\n\r\n                    if (!this.InstallerContext.ZipFileSystem.ContainsFile(dataFilenameAttribute.Value))\r\n                    {\r\n                        _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.MissingFile\").FormatWith(dataFilenameAttribute.Value), dataFilenameAttribute);\r\n                        continue;\r\n                    }\r\n\r\n\r\n                    XDocument doc;\r\n                    try\r\n                    {\r\n                        using (var stream = this.InstallerContext.ZipFileSystem.GetFileStream(dataFilenameAttribute.Value))\r\n                        using (var reader = new C1StreamReader(stream))\r\n                        {\r\n                            doc = XDocument.Load(reader);\r\n                        }\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        _validationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex));\r\n                        continue;\r\n                    }\r\n\r\n\r\n                    XAttribute isDynamicAddedAttribute = typeElement.Attribute(\"isDynamicAdded\");\r\n\r\n                    bool isDynamicAdded = isDynamicAddedAttribute != null && (bool)isDynamicAddedAttribute;\r\n\r\n                    var dataType = new DataType\r\n                    {\r\n                        InterfaceTypeName = interfaceTypeName,\r\n                        DataScopeIdentifier = dataScopeIdentifier,\r\n                        Locale = locale,\r\n                        AddToAllLocales = allLocales,\r\n                        AddToCurrentLocale = currentLocale,\r\n                        IsDynamicAdded = isDynamicAdded,\r\n                        AllowOverwrite = allowOverwrite,\r\n                        OnlyUpdate = onlyUpdate,\r\n                        Dataset = doc.Root.Elements(\"Add\")\r\n                    };\r\n\r\n                    _dataTypes.Add(dataType);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Core.PackageSystem.PackageFragmentInstallers\", stringId);\r\n        }\r\n\r\n        private void ValidateNonDynamicAddedType(DataType dataType)\r\n        {\r\n            if (dataType.InterfaceType == null)\r\n            {\r\n                _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.TypeNotConfigured\").FormatWith(dataType.InterfaceTypeName));\r\n                return;\r\n            }\r\n            \r\n\r\n            if (!typeof(IData).IsAssignableFrom(dataType.InterfaceType))\r\n            {\r\n                _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.TypeNotInheriting\").FormatWith(dataType.InterfaceType, typeof(IData)));\r\n                return;\r\n            }\r\n\r\n            bool dataTypeLocalized = DataLocalizationFacade.IsLocalized(dataType.InterfaceType);\r\n            if (!ValidateTargetLocaleInfo(dataType, dataTypeLocalized))\r\n            {\r\n                return;\r\n            }\r\n\r\n            int itemsAlreadyPresentInDatabase = 0;\r\n\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.BuildNewDataTypeDescriptor(dataType.InterfaceType);\r\n\r\n\r\n            bool isVersionedDataType = typeof (IVersioned).IsAssignableFrom(dataType.InterfaceType);\r\n\r\n            var requiredPropertyNames = \r\n                (from dfd in dataTypeDescriptor.Fields\r\n                where !dfd.IsNullable && !(isVersionedDataType && dfd.Name == nameof(IVersioned.VersionId)) // Compatibility fix\r\n                select dfd.Name).ToList();\r\n\r\n            var nonRequiredPropertyNames = dataTypeDescriptor.Fields.Select(f => f.Name)\r\n                                            .Except(requiredPropertyNames).ToList();\r\n\r\n\r\n            foreach (XElement addElement in dataType.Dataset)\r\n            {\r\n                var dataKeyPropertyCollection = new DataKeyPropertyCollection();\r\n\r\n                bool propertyValidationPassed = true;\r\n                var assignedPropertyNames = new List<string>();\r\n                var fieldValues = new Dictionary<string, object>();\r\n\r\n                var properties = GetDataTypeProperties(dataType.InterfaceType);\r\n\r\n                foreach (XAttribute attribute in addElement.Attributes())\r\n                {\r\n                    string fieldName = attribute.Name.LocalName;\r\n\r\n                    PropertyInfo propertyInfo;\r\n                    if (!properties.TryGetValue(fieldName, out propertyInfo))\r\n                    {\r\n                        // A compatibility fix\r\n                        if (IsObsoleteField(dataType, fieldName))\r\n                        {\r\n                            continue;\r\n                        }\r\n\r\n                        _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.MissingProperty\").FormatWith(dataType.InterfaceType, fieldName));\r\n                        propertyValidationPassed = false;\r\n                        continue;\r\n                    }\r\n\r\n                    if (!propertyInfo.CanWrite)\r\n                    {\r\n                        _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.MissingWritableProperty\").FormatWith(dataType.InterfaceType, fieldName));\r\n                        propertyValidationPassed = false;\r\n                        continue;\r\n                    }\r\n\r\n                    object fieldValue;\r\n                    try\r\n                    {\r\n                        fieldValue = ValueTypeConverter.Convert(attribute.Value, propertyInfo.PropertyType);\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.ConversionFailed\").FormatWith(attribute.Value, propertyInfo.PropertyType));\r\n                        propertyValidationPassed = false;\r\n                        continue;\r\n                    }\r\n\r\n                    if (dataType.InterfaceType.GetKeyPropertyNames().Contains(fieldName))\r\n                    {\r\n                        dataKeyPropertyCollection.AddKeyProperty(fieldName, fieldValue);\r\n                    }\r\n\r\n                    assignedPropertyNames.Add(fieldName);\r\n                    fieldValues.Add(fieldName, fieldValue);\r\n                }\r\n\r\n                if (!propertyValidationPassed)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n\r\n                var notAssignedRequiredProperties = requiredPropertyNames.Except(assignedPropertyNames.Except(nonRequiredPropertyNames)).ToArray();\r\n                if (notAssignedRequiredProperties.Any())\r\n                {\r\n                    bool missingValues = false;\r\n                    foreach (string propertyName in notAssignedRequiredProperties)\r\n                    {\r\n                        PropertyInfo propertyInfo = dataType.InterfaceType.GetPropertiesRecursively().Single(f => f.Name == propertyName);\r\n\r\n                        if (propertyInfo.CanWrite)\r\n                        {\r\n                            var defaultValueAttribute = propertyInfo.GetCustomAttributesRecursively<NewInstanceDefaultFieldValueAttribute>().SingleOrDefault();\r\n                            if (defaultValueAttribute == null || !defaultValueAttribute.HasValue)\r\n                            {\r\n                                _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.MissingPropertyVaule\").FormatWith(propertyName, dataType.InterfaceType));\r\n                                missingValues = true;\r\n                            }\r\n                        }\r\n                    }\r\n                    if (missingValues) continue;\r\n                }\r\n\r\n\r\n                // Validating keys already present    \r\n                if (!dataType.AllowOverwrite && !dataType.OnlyUpdate)\r\n                {\r\n                    bool dataLocaleExists = \r\n                        !DataLocalizationFacade.IsLocalized(dataType.InterfaceType)\r\n                        || (!dataType.AddToAllLocales && !dataType.AddToCurrentLocale)\r\n                        || (dataType.Locale != null && !this.InstallerContext.IsLocalePending(dataType.Locale));\r\n\r\n                    if(dataLocaleExists)\r\n                    {\r\n                        using (new DataScope(dataType.DataScopeIdentifier, dataType.Locale))\r\n                        {\r\n                            IData data = DataFacade.TryGetDataByUniqueKey(dataType.InterfaceType, dataKeyPropertyCollection);\r\n\r\n                            if (data != null)\r\n                            {\r\n                                itemsAlreadyPresentInDatabase++;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n\r\n                RegisterKeyToBeAdded(dataType, null, dataKeyPropertyCollection);\r\n\r\n                // Checking foreign key references\r\n                foreach (var foreignKeyProperty in DataAttributeFacade.GetDataReferenceProperties(dataType.InterfaceType))\r\n                {\r\n                    if(!fieldValues.ContainsKey(foreignKeyProperty.SourcePropertyName)) continue;\r\n\r\n                    object propertyValue = fieldValues[foreignKeyProperty.SourcePropertyName];\r\n                    \r\n                    if (propertyValue == null || propertyValue.Equals(foreignKeyProperty.NullReferenceValue))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    CheckForBrokenReference(dataType, foreignKeyProperty.TargetType, foreignKeyProperty.TargetKeyPropertyName, propertyValue);\r\n                }\r\n            }\r\n\r\n            if(itemsAlreadyPresentInDatabase > 0)\r\n            {\r\n                _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.DataExists\").FormatWith(dataType.InterfaceType, itemsAlreadyPresentInDatabase));\r\n            }\r\n        }\r\n\r\n        private void CheckForBrokenReference(DataType refereeType, Type type, string propertyName, object propertyValue)\r\n        {\r\n            Type referredType;\r\n            string keyPropertyName;\r\n            object referenceKey;\r\n\r\n            MapReference(type, propertyName, propertyValue, out referredType, out keyPropertyName, out referenceKey);\r\n\r\n            // Checking key in the keys to be installed\r\n            var keyValuePair = new KeyValuePair<string, object>(keyPropertyName, referenceKey);\r\n\r\n            if (_missingDataReferences.TryGetValue(referredType, out var refs) && refs.Contains(keyValuePair))\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (_dataKeysToBeInstalled.TryGetValue(referredType, out var keys)\r\n                && keys.KeyRegistered(refereeType, keyValuePair))\r\n            {   \r\n                return;\r\n            }\r\n\r\n            var typeId = referredType.GetImmutableTypeId();\r\n            if (_dataKeysToBeInstalledByTypeId.TryGetValue(typeId, out var dynamicTypeKeys)\r\n                && dynamicTypeKeys.KeyRegistered(refereeType, keyValuePair))\r\n            {\r\n                return;\r\n            }\r\n\r\n            using (GetDataScopeFromDataTypeElement(refereeType))\r\n            {\r\n                if (DataFacade.TryGetDataByUniqueKey(type, propertyValue) == null)\r\n                {\r\n                    _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_ReferencedDataMissing(\r\n                        type.FullName, propertyName, propertyValue));\r\n\r\n                    var missingReferences = _missingDataReferences.GetOrAdd(referredType,\r\n                        () => new HashSet<KeyValuePair<string, object>>());\r\n\r\n                    missingReferences.Add(keyValuePair);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static bool IsObsoleteField(DataType dataType, string fieldName)\r\n        {\r\n            return typeof(ILocalizedControlled).IsAssignableFrom(dataType.InterfaceType) && fieldName == \"CultureName\";\r\n        }\r\n\r\n\r\n        private static Dictionary<string, PropertyInfo> GetDataTypeProperties(Type type)\r\n        {\r\n            return type.GetPropertiesRecursively().Where(property => !IsObsoleteProperty(property)).ToDictionary(prop => prop.Name);\r\n        }\r\n\r\n        private static bool IsObsoleteProperty(PropertyInfo propertyInfo)\r\n        {\r\n            return propertyInfo.Name == nameof(IPageData.PageId) && propertyInfo.DeclaringType == typeof(IPageData);\r\n        }\r\n\r\n        private static bool IsObsoleteField(DataTypeDescriptor dataTypeDescriptor, string fieldName)\r\n        {\r\n            return dataTypeDescriptor.SuperInterfaces.Any(type => type == typeof(ILocalizedControlled)) \r\n                    && fieldName == \"CultureName\";\r\n        }\r\n\r\n        private static void MapReference(Type type, string propertyName, object key, out Type referenceType, out string keyPropertyName, out object referenceKey)\r\n        {\r\n            if ((type == typeof(IImageFile) || type == typeof(IMediaFile))\r\n                && ((string)key).StartsWith(\"MediaArchive:\")\r\n                && propertyName == nameof(IMediaFile.KeyPath))\r\n            {\r\n                referenceType = typeof(IMediaFileData);\r\n                referenceKey = new Guid(((string)key).Substring(\"MediaArchive:\".Length));\r\n                keyPropertyName = nameof(IMediaFileData.Id);\r\n                return;\r\n            }\r\n\r\n            referenceType = type;\r\n            keyPropertyName = propertyName;\r\n            referenceKey = key;\r\n        }\r\n\r\n\r\n\r\n        private DataScope GetDataScopeFromDataTypeElement(DataType dataType)\r\n        {\r\n            CultureInfo locale = dataType.Locale ?? LocalizationScopeManager.CurrentLocalizationScope;\r\n            \r\n            return new DataScope(dataType.DataScopeIdentifier, locale);\r\n        }\r\n\r\n\r\n\r\n        private void RegisterKeyToBeAdded(DataType dataType, DataTypeDescriptor dataTypeDescriptor, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            if (dataKeyPropertyCollection.Count != 1) return;\r\n\r\n            TypeKeyInstallationData typeKeyInstallationData;\r\n\r\n            if (dataType.InterfaceType != null)\r\n            {\r\n                // Static types\r\n                typeKeyInstallationData = _dataKeysToBeInstalled.GetOrAdd(dataType.InterfaceType,\r\n                    () => new TypeKeyInstallationData(dataType.InterfaceType));\r\n            }\r\n            else\r\n            {\r\n                // Dynamic types\r\n                typeKeyInstallationData = _dataKeysToBeInstalledByTypeId.GetOrAdd(dataTypeDescriptor.DataTypeId,\r\n                    () => new TypeKeyInstallationData(dataTypeDescriptor));\r\n            }\r\n\r\n            var keyValuePair = dataKeyPropertyCollection.KeyProperties.First();\r\n\r\n            typeKeyInstallationData.RegisterKeyUsage(dataType, keyValuePair);\r\n        }\r\n\r\n\r\n        private void ValidateDynamicAddedType(DataType dataType)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = this.InstallerContext.GetPendingDataTypeDescriptor(dataType.InterfaceTypeName);\r\n\r\n            if (dataTypeDescriptor == null)\r\n            {\r\n                _validationResult.AddFatal(GetText(\"DataPackageFragmentInstaller.MissingTypeDescriptor\").FormatWith(dataType.InterfaceTypeName));\r\n                return;\r\n            }\r\n\r\n            bool dataTypeLocalized = dataTypeDescriptor.SuperInterfaces.Contains(typeof (ILocalizedControlled));\r\n\r\n            if (!ValidateTargetLocaleInfo(dataType, dataTypeLocalized))\r\n            {\r\n                return;\r\n            }\r\n\r\n            foreach (XElement addElement in dataType.Dataset)\r\n            {\r\n                var dataKeyPropertyCollection = new DataKeyPropertyCollection();\r\n                bool propertyValidationPassed = true;\r\n                var fieldValues = new Dictionary<string, object>();\r\n\r\n                foreach (XAttribute attribute in addElement.Attributes())\r\n                {\r\n                    string fieldName = attribute.Name.LocalName;\r\n\r\n                    // A compatibility fix\r\n                    if (IsObsoleteField(dataTypeDescriptor, fieldName))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    DataFieldDescriptor dataFieldDescriptor = dataTypeDescriptor.Fields[fieldName];\r\n\r\n                    if (dataFieldDescriptor == null)\r\n                    {\r\n                        _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_MissingProperty(dataTypeDescriptor, fieldName));\r\n                        propertyValidationPassed = false;\r\n                        continue;\r\n                    }\r\n\r\n                    object fieldValue;\r\n                    try\r\n                    {\r\n                        fieldValue = ValueTypeConverter.Convert(attribute.Value, dataFieldDescriptor.InstanceType);\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_ConversionFailed(attribute.Value, dataFieldDescriptor.InstanceType));\r\n                        propertyValidationPassed = false;\r\n                        continue;\r\n                    }\r\n\r\n                    if (dataTypeDescriptor.KeyPropertyNames.Contains(fieldName))\r\n                    {\r\n                        dataKeyPropertyCollection.AddKeyProperty(fieldName, fieldValue);\r\n                    }\r\n\r\n                    fieldValues.Add(fieldName, fieldValue);\r\n                }\r\n\r\n                if (!propertyValidationPassed)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                if (!dataType.AllowOverwrite && !dataType.OnlyUpdate)\r\n                {\r\n                    // TODO: implement check if the same key has already been added\r\n                }\r\n\r\n                RegisterKeyToBeAdded(dataType, dataTypeDescriptor, dataKeyPropertyCollection);\r\n\r\n                // Checking foreign key references\r\n                foreach (var referenceField in dataTypeDescriptor.Fields.Where(f => f.ForeignKeyReferenceTypeName != null))\r\n                {\r\n                    if (!fieldValues.TryGetValue(referenceField.Name, out object propertyValue) \r\n                        || propertyValue == null\r\n                        || (propertyValue is Guid guid && guid == Guid.Empty) \r\n                        || (propertyValue is string str && str == \"\"))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    string referredTypeName = referenceField.ForeignKeyReferenceTypeName;\r\n                    var referredType = TypeManager.TryGetType(referredTypeName);\r\n                    if (referredType == null)\r\n                    {\r\n                        // TODO: implement reference check for dynamic types as well\r\n                        continue;\r\n                    }\r\n\r\n                    string targetKeyPropertyName = referredType.GetKeyPropertyNames().SingleOrDefault();\r\n\r\n                    CheckForBrokenReference(dataType, referredType, targetKeyPropertyName, propertyValue);\r\n                }\r\n            }\r\n        }\r\n\r\n        private bool ValidateTargetLocaleInfo(DataType dataType, bool dataTypeLocalized)\r\n        {\r\n            bool localeInfoSpecified = dataType.Locale != null || dataType.AddToAllLocales || dataType.AddToCurrentLocale;\r\n\r\n            if (dataTypeLocalized && !localeInfoSpecified)\r\n            {\r\n                _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_TypeLocalizedWithoutLocale(dataType.InterfaceType));\r\n                return false;\r\n            }\r\n            \r\n            if (!dataTypeLocalized && localeInfoSpecified)\r\n            {\r\n                _validationResult.AddFatal(Texts.DataPackageFragmentInstaller_TypeNonLocalizedWithLocale(dataType.InterfaceType));\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        [DebuggerDisplay(\"{InterfaceTypeName}\")]\r\n        private sealed class DataType\r\n        {\r\n            public string InterfaceTypeName { get; set; }\r\n            public Type InterfaceType { get; set; }\r\n            public DataScopeIdentifier DataScopeIdentifier { get; set; }\r\n            public CultureInfo Locale { get; set; }\r\n            public bool AddToAllLocales { get; set; }\r\n            public bool AddToCurrentLocale { get; set; }\r\n            public bool IsDynamicAdded { get; set; }\r\n            public bool OnlyUpdate { get; set; }\r\n            public bool AllowOverwrite { get; set; }\r\n            public IEnumerable<XElement> Dataset { get; set; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Information about data keys to be installed for a given data type\r\n        /// </summary>\r\n        [DebuggerDisplay(\"TypeKeyInstallationData {_typeName} . DataScopes: {_dataScopes.Count}\")]\r\n        private class TypeKeyInstallationData\r\n        {\r\n            private const string AllLocalesKey = \"all\";\r\n\r\n            private readonly bool _isLocalized;\r\n            private readonly bool _isPublishable;\r\n            private readonly string _typeName;\r\n\r\n            private readonly Dictionary<string, HashSet<KeyValuePair<string, object>>> _dataScopes = new Dictionary<string, HashSet<KeyValuePair<string, object>>>();\r\n\r\n            public TypeKeyInstallationData(Type type)\r\n            {\r\n                _isLocalized = DataLocalizationFacade.IsLocalized(type);\r\n                _isPublishable = typeof(IPublishControlled).IsAssignableFrom(type);\r\n                _typeName = type.FullName;\r\n            }\r\n\r\n            public TypeKeyInstallationData(DataTypeDescriptor typeDescriptor)\r\n            {\r\n                _isLocalized = typeDescriptor.SuperInterfaces.Contains(typeof(ILocalizedControlled));\r\n                _isPublishable = typeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled));\r\n                _typeName = typeDescriptor.Name;\r\n            }\r\n\r\n            public void RegisterKeyUsage(DataType dataType, KeyValuePair<string, object> keyValuePair)\r\n            {\r\n                var dataScopeIdentifier = dataType.DataScopeIdentifier;\r\n\r\n                if (!_isLocalized)\r\n                {\r\n                    RegisterKeyUsage(dataType, \"\", dataScopeIdentifier, keyValuePair);\r\n                    return;\r\n                }\r\n\r\n                if (dataType.AddToCurrentLocale)\r\n                {\r\n                    RegisterKeyUsage(dataType, LocalizationScopeManager.CurrentLocalizationScope.Name, dataScopeIdentifier, keyValuePair);\r\n                    return;\r\n                }\r\n\r\n                if (dataType.Locale != null)\r\n                {\r\n                    RegisterKeyUsage(dataType, dataType.Locale.Name, dataScopeIdentifier, keyValuePair);\r\n                    return;\r\n                }\r\n\r\n                if (dataType.AddToAllLocales)\r\n                {\r\n                    RegisterKeyUsage(dataType, AllLocalesKey, dataScopeIdentifier, keyValuePair);\r\n                    return;\r\n                }\r\n\r\n                throw new InvalidOperationException(\"Type is localized but no localization info specified\");\r\n            }\r\n\r\n            private void RegisterKeyUsage(DataType dataType, string localeName, DataScopeIdentifier publicationScope, KeyValuePair<string, object> keyValuePair)\r\n            {\r\n                string dataScopeKey = GetDataScopeKey(publicationScope, localeName);\r\n\r\n                var hashset = _dataScopes.GetOrAdd(dataScopeKey, () => new HashSet<KeyValuePair<string, object>>());\r\n\r\n                Verify.That(!hashset.Contains(keyValuePair), \"Item with the same key present twice. Data type: '{0}', field '{1}', value '{2}'\",\r\n                    dataType.InterfaceTypeName ?? dataType.InterfaceTypeName ?? \"null\", keyValuePair.Key, keyValuePair.Value ?? \"null\");\r\n\r\n                hashset.Add(keyValuePair);\r\n            }\r\n\r\n            public bool KeyRegistered(DataType refereeDataType, KeyValuePair<string, object> keyValuePair)\r\n            {\r\n                var dataScopeIdentifier = refereeDataType.DataScopeIdentifier;\r\n\r\n                if (!_isLocalized)\r\n                {\r\n                    return KeyRegistered(dataScopeIdentifier, \"\", keyValuePair);\r\n                }\r\n\r\n                if (KeyRegistered(refereeDataType.DataScopeIdentifier, AllLocalesKey, keyValuePair))\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                if (refereeDataType.Locale != null)\r\n                {\r\n                    return KeyRegistered(refereeDataType.DataScopeIdentifier, refereeDataType.Locale.Name, keyValuePair);\r\n                }\r\n\r\n                var currentLocale = LocalizationScopeManager.CurrentLocalizationScope;\r\n\r\n                if (refereeDataType.AddToCurrentLocale)\r\n                {\r\n                    return KeyRegistered(refereeDataType.DataScopeIdentifier, currentLocale.Name, keyValuePair);\r\n                }\r\n\r\n                if (DataLocalizationFacade.ActiveLocalizationCultures.Count() == 1\r\n                    && KeyRegistered(refereeDataType.DataScopeIdentifier, currentLocale.Name, keyValuePair))\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                return false;\r\n            }\r\n\r\n            private bool KeyRegistered(DataScopeIdentifier publicationScope, string languageName, KeyValuePair<string, object> keyValuePair)\r\n            {\r\n                HashSet<KeyValuePair<string, object>> hashset;\r\n\r\n                if (languageName != AllLocalesKey && _isLocalized)\r\n                {\r\n                    hashset = GetDataset(publicationScope, languageName);\r\n                    if (hashset != null && hashset.Contains(keyValuePair))\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n\r\n                hashset = GetDataset(publicationScope, AllLocalesKey);\r\n                return hashset != null && hashset.Contains(keyValuePair);\r\n            }\r\n\r\n            private HashSet<KeyValuePair<string, object>> GetDataset(DataScopeIdentifier publicationScope, string localizationScope)\r\n            {\r\n                string key = GetDataScopeKey(publicationScope, localizationScope);\r\n\r\n                return _dataScopes.ContainsKey(key) ? _dataScopes[key] : null;\r\n            }\r\n\r\n            private string GetDataScopeKey(DataScopeIdentifier publicationScope, string languageName)\r\n            {\r\n                string publicationScopeKey = _isPublishable ? publicationScope.Name : string.Empty;\r\n                string languageScopeKey = _isLocalized ? languageName : string.Empty;\r\n\r\n                return publicationScopeKey + languageScopeKey;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/DataPackageFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataPackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        private List<DataType> _dataToDelete;\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Types\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.DataPackageFragmentUninstaller_OnlyOneElement);\r\n                return validationResult;\r\n            }\r\n\r\n            _dataToDelete = new List<DataType>();\r\n\r\n            XElement typesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Types\");\r\n\r\n            if (typesElement == null)\r\n            {\r\n                return validationResult;\r\n            }\r\n\r\n            foreach (XElement typeElement in typesElement.Elements(\"Type\").Reverse())\r\n            {\r\n                XAttribute typeAttribute = typeElement.Attribute(\"type\");\r\n                XAttribute dataScopeIdentifierAttribute = typeElement.Attribute(\"dataScopeIdentifier\");\r\n\r\n                if (typeAttribute == null) \r\n                {\r\n                    validationResult.AddFatal(Texts.DataPackageFragmentUninstaller_MissingAttribute(\"type\"), typeElement); \r\n                    continue; \r\n                }\r\n\r\n                if (dataScopeIdentifierAttribute == null) \r\n                {\r\n                    validationResult.AddFatal(Texts.DataPackageFragmentUninstaller_MissingAttribute(\"dataScopeIdentifier\"), typeElement); \r\n                    continue; \r\n                }\r\n\r\n                Type type = TypeManager.TryGetType(typeAttribute.Value);\r\n                if (type == null) continue;\r\n\r\n                if (!DataFacade.GetAllInterfaces().Contains(type)) continue;\r\n\r\n\r\n                DataScopeIdentifier dataScopeIdentifier;\r\n                try\r\n                {\r\n                    dataScopeIdentifier = DataScopeIdentifier.Deserialize(dataScopeIdentifierAttribute.Value);\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    validationResult.AddFatal(\"Wrong DataScopeIdentifier ({0}) name in the configuration\".FormatWith(dataScopeIdentifierAttribute.Value), dataScopeIdentifierAttribute);\r\n                    continue;\r\n                }\r\n\r\n\r\n                foreach (XElement datasElement in typeElement.Elements(\"Datas\").Reverse())\r\n                {\r\n                    CultureInfo locale = null;\r\n\r\n                    XAttribute localeAttribute = datasElement.Attribute(\"locale\");\r\n                    if (localeAttribute != null)\r\n                    {\r\n                        locale = CultureInfo.CreateSpecificCulture(localeAttribute.Value);\r\n                    }\r\n\r\n                    foreach (XElement keysElement in datasElement.Elements(\"Keys\").Reverse())\r\n                    {\r\n                        bool allKeyPropertiesValidated = true;\r\n                        var dataKeyPropertyCollection = new DataKeyPropertyCollection();\r\n\r\n                        foreach (XElement keyElement in keysElement.Elements(\"Key\"))\r\n                        {\r\n                            XAttribute keyNameAttribute = keyElement.Attribute(\"name\");\r\n                            XAttribute keyValueAttribute = keyElement.Attribute(\"value\");\r\n\r\n\r\n                            if (keyNameAttribute == null || keyValueAttribute == null)\r\n                            {\r\n                                if (keyNameAttribute == null) validationResult.AddFatal(GetText(\"DataPackageFragmentUninstaller.MissingAttribute\").FormatWith(\"name\"), keyElement);\r\n                                if (keyValueAttribute == null) validationResult.AddFatal(GetText(\"DataPackageFragmentUninstaller.MissingAttribute\").FormatWith(\"value\"), keyElement);\r\n\r\n                                allKeyPropertiesValidated = false;\r\n                                continue;\r\n                            }\r\n                                \r\n                            string keyName = keyNameAttribute.Value;\r\n                            PropertyInfo keyPropertyInfo = type.GetPropertiesRecursively().SingleOrDefault(f => f.Name == keyName);\r\n                            if (keyPropertyInfo == null)\r\n                            {\r\n                                validationResult.AddFatal(GetText(\"DataPackageFragmentUninstaller.MissingKeyProperty\").FormatWith(type, keyName));\r\n                                allKeyPropertiesValidated = false;\r\n                            }\r\n                            else\r\n                            {\r\n                                try\r\n                                {\r\n                                    object keyValue = ValueTypeConverter.Convert(keyValueAttribute.Value, keyPropertyInfo.PropertyType);\r\n                                    dataKeyPropertyCollection.AddKeyProperty(keyName, keyValue);\r\n                                }\r\n                                catch (Exception)\r\n                                {\r\n                                    allKeyPropertiesValidated = false;\r\n                                    validationResult.AddFatal(GetText(\"DataPackageFragmentUninstaller.DataPackageFragmentUninstaller\").FormatWith(keyValueAttribute.Value, keyPropertyInfo.PropertyType));\r\n                                }\r\n                            }\r\n                        }\r\n\r\n                        if (allKeyPropertiesValidated)\r\n                        {\r\n                            IData data;\r\n                            using (new DataScope(dataScopeIdentifier, locale))\r\n                            {\r\n                                data = DataFacade.TryGetDataByUniqueKey(type, dataKeyPropertyCollection);\r\n                            }\r\n\r\n                            if (data != null)\r\n                            {\r\n                                CheckForPotentialBrokenReferences(data, validationResult, type, dataScopeIdentifier, locale, dataKeyPropertyCollection);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            \r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _dataToDelete = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n        private void CheckForPotentialBrokenReferences(IData data, List<PackageFragmentValidationResult> validationResult, \r\n            Type type, DataScopeIdentifier dataScopeIdentifier, CultureInfo locale, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            var pagesReferencingPageTypes = new HashSet<string>();\r\n            var dataReferencingDataToBeUninstalled = new HashSet<string>();\r\n\r\n            List<IData> referees = data.GetReferees();\r\n\r\n            bool addToDelete = true;\r\n            foreach (IData referee in referees)\r\n            {\r\n                if (this.UninstallerContext.IsPendingForDeletionData(referee))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                addToDelete = false;\r\n\r\n                if (referee is IPage && data is IPageType)\r\n                {\r\n                    string pathToPage;\r\n\r\n                    using (new DataScope(referee.DataSourceId.PublicationScope, referee.DataSourceId.LocaleScope))\r\n                    {\r\n                        pathToPage = GetPathToPage(referee as IPage);\r\n                    }\r\n\r\n                    if (!pagesReferencingPageTypes.Contains(pathToPage))\r\n                    {\r\n                        validationResult.AddFatal(Texts.DataPackageFragmentUninstaller_PageTypeIsReferenced(\r\n                            data.GetLabel(), pathToPage));\r\n                        pagesReferencingPageTypes.Add(pathToPage);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    var refereeType = referee.DataSourceId.InterfaceType;\r\n\r\n                    string label = referee.GetLabel();\r\n                    string key = label + refereeType.FullName;\r\n\r\n                    if (!dataReferencingDataToBeUninstalled.Contains(key))\r\n                    {\r\n                        validationResult.AddFatal(Texts.DataPackageFragmentUninstaller_DataIsReferenced(\r\n                            data.GetLabel(),\r\n                            type.FullName,\r\n                            label,\r\n                            refereeType.FullName));\r\n\r\n                        dataReferencingDataToBeUninstalled.Add(key);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (addToDelete)\r\n            {\r\n                AddDataToDelete(type, dataScopeIdentifier, locale, dataKeyPropertyCollection);\r\n            }\r\n        }\r\n\r\n        private static string GetPathToPage(IPage page)\r\n        {\r\n            var parentPageId = PageManager.GetParentId(page.Id);\r\n\r\n            if (parentPageId != Guid.Empty)\r\n            {\r\n                var parentPage = PageManager.GetPageById(parentPageId);\r\n\r\n                if (parentPage != null)\r\n                {\r\n                    return GetPathToPage(parentPage) + \"/\" + page.Title;\r\n                }\r\n            }\r\n\r\n            return page.Title;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            Verify.IsNotNull(_dataToDelete, \"DataPackageFragmentUninstaller has not been validated\");\r\n\r\n            foreach (DataType dataType in _dataToDelete)\r\n            {\r\n                using (new DataScope(dataType.DataScopeIdentifier, dataType.Locale))\r\n                {\r\n                    Log.LogVerbose(\"DataPackageFragmentUninstaller\", \"Uninstalling data for the type '{0}'\", dataType.InterfaceType);\r\n\r\n                    foreach (DataKeyPropertyCollection dataKeyPropertyCollection in dataType.DataKeys)\r\n                    {\r\n                        IData data = DataFacade.TryGetDataByUniqueKey(dataType.InterfaceType, dataKeyPropertyCollection);\r\n                        if (data == null)\r\n                        {\r\n                            continue;\r\n                        }\r\n\r\n                        using (ProcessControllerFacade.NoProcessControllers)\r\n                        {\r\n                            DataFacade.Delete(data, CascadeDeleteType.Disable);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AddDataToDelete(Type interfaceType, DataScopeIdentifier dataScopeIdentifier, CultureInfo locale, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            DataType dataType = _dataToDelete.SingleOrDefault(dt => \r\n                        dt.InterfaceType == interfaceType\r\n                        && dt.DataScopeIdentifier.Equals(dataScopeIdentifier) &&\r\n                        ((dt.Locale == null && locale == null) || (dt.Locale != null && dt.Locale.Equals(locale))));\r\n\r\n            if (dataType == null)\r\n            {\r\n                dataType = new DataType { InterfaceType = interfaceType, DataScopeIdentifier = dataScopeIdentifier, Locale = locale };\r\n                _dataToDelete.Add(dataType);\r\n            }\r\n\r\n            dataType.DataKeys.Add(dataKeyPropertyCollection);\r\n            this.UninstallerContext.AddPendingForDeletionData(interfaceType, dataScopeIdentifier, locale, dataKeyPropertyCollection);\r\n        }\r\n\r\n\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return GetResourceString(stringId);\r\n        }\r\n\r\n\r\n        private sealed class DataType\r\n        {\r\n            public DataType()\r\n            {\r\n                this.DataKeys = new List<DataKeyPropertyCollection>();\r\n            }\r\n\r\n            public Type InterfaceType { get; set; }\r\n            public DataScopeIdentifier DataScopeIdentifier { get; set; }\r\n            public CultureInfo Locale { get; set; }\r\n            public List<DataKeyPropertyCollection> DataKeys { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/DataTypePackageFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary> \r\n    /// Creates data stores for static data types. Can be used in combination with <see cref=\"DataPackageFragmentInstaller\"/> to install content.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataTypePackageFragmentInstaller : BasePackageFragmentInstaller\r\n\t{\r\n        private List<DataTypeDescriptor> _typesToInstall = null;\r\n        private static readonly string LogTitle = typeof (DataTypePackageFragmentInstaller).FullName;\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var  validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Types\") > 1)\r\n            {\r\n                validationResult.AddFatal(GetText(\"DataTypePackageFragmentInstaller.OnlyOneElement\"));\r\n                return validationResult;\r\n            }\r\n\r\n            XElement typesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Types\");\r\n            if (typesElement == null)\r\n            {\r\n                validationResult.AddFatal(GetText(\"DataTypePackageFragmentInstaller.MissingElement\"));\r\n                return validationResult;\r\n            }\r\n\r\n            _typesToInstall = new List<DataTypeDescriptor>();\r\n\r\n            foreach (XElement typeElement in typesElement.Elements(\"Type\"))\r\n            {\r\n                XAttribute nameAttribute = typeElement.Attribute(\"name\");\r\n                if (nameAttribute == null)\r\n                {\r\n                    validationResult.AddFatal(GetText(\"DataTypePackageFragmentInstaller.MissingAttribute\").FormatWith(\"name\"), typeElement);\r\n                    continue;\r\n                }\r\n\r\n                Type type = TypeManager.TryGetType(nameAttribute.Value);\r\n                if (type == null)\r\n                {\r\n                    validationResult.AddFatal(GetText(\"DataTypePackageFragmentInstaller.TypeNotConfigured\").FormatWith(nameAttribute.Value));\r\n                }\r\n                else if (!typeof(IData).IsAssignableFrom(type))\r\n                {\r\n                    validationResult.AddFatal(GetText(\"DataTypePackageFragmentInstaller.TypeNotInheriting\").FormatWith(type, typeof(IData)));\r\n                }\r\n                else if (DataFacade.GetAllKnownInterfaces().Contains(type))\r\n                {\r\n                    validationResult.AddFatal(GetText(\"DataTypePackageFragmentInstaller.TypeExists\").FormatWith(type));\r\n                }\r\n                else\r\n                {\r\n                    DataTypeDescriptor dataTypeDescriptor = null;\r\n                    try\r\n                    {\r\n                        dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n                        dataTypeDescriptor.Validate();\r\n                    }\r\n                    catch(Exception ex)\r\n                    {\r\n                        validationResult.AddFatal(GetText(\"DataTypePackageFragmentInstaller.InterfaceCodeError\").FormatWith(type));\r\n                        validationResult.AddFatal(ex);\r\n\r\n                        Log.LogError(LogTitle, ex);\r\n                    }\r\n\r\n                    if (dataTypeDescriptor != null)\r\n                    {\r\n                        _typesToInstall.Add(dataTypeDescriptor);\r\n                        this.InstallerContext.AddPendingDataType(type);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _typesToInstall = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            Verify.IsNotNull(_typesToInstall, \"DataTypePackageFragmentInstaller has not been validated\");\r\n\r\n            string typeNames = string.Join(\", \", _typesToInstall.Select(t => t.GetFullInterfaceName()));\r\n            Log.LogVerbose(this.GetType().Name, \"Installing types: '{0}'\", typeNames);\r\n\r\n\r\n            DynamicTypeManager.CreateStores(_typesToInstall, false);\r\n\r\n            var typeElements = new List<XElement>();\r\n            foreach (var dataTypeDescriptor in _typesToInstall)\r\n            {\r\n                var typeElement = new XElement(\"Type\", new XAttribute(\"typeId\", dataTypeDescriptor.DataTypeId));\r\n                typeElements.Add(typeElement);\r\n            }\r\n\r\n            GlobalEventSystemFacade.FlushTheSystem(true);\r\n\r\n            yield return new XElement(\"Types\", typeElements);\r\n        }\r\n\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return GetResourceString(stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/DataTypePackageFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataTypePackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        private List<DataTypeDescriptor> _dataTypeDescriptorsToDelete;\r\n        private List<PackageFragmentValidationResult> _validationResult;\r\n\r\n\r\n        /// <exclude />\r\n        public override bool ValidateFirst { get { return true; } }\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {            \r\n            _validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Types\") > 1)\r\n            {\r\n                _validationResult.AddFatal(GetText(\"DataTypePackageFragmentUninstaller.OnlyOneElement\"));\r\n                return _validationResult;\r\n            }\r\n\r\n            XElement typesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Types\");\r\n\r\n            _dataTypeDescriptorsToDelete = new List<DataTypeDescriptor>();\r\n\r\n            if (typesElement != null)\r\n            {\r\n                foreach (XElement typeElement in typesElement.Elements(\"Type\").Reverse())\r\n                {\r\n                    XAttribute typeIdAttribute = typeElement.Attribute(\"typeId\");\r\n                    if (typeIdAttribute == null)\r\n                    {\r\n                        _validationResult.AddFatal(GetText(\"DataTypePackageFragmentUninstaller.MissingAttribute\").FormatWith(\"typeId\"));\r\n                        continue;\r\n                    }\r\n\r\n                    Guid typeId;\r\n                    if (!typeIdAttribute.TryGetGuidValue(out typeId))\r\n                    {\r\n                        _validationResult.AddFatal(GetText(\"DataTypePackageFragmentUninstaller.WrongAttributeFormat\"), typeIdAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeId);\r\n                    if (dataTypeDescriptor == null)\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    _dataTypeDescriptorsToDelete.Add(dataTypeDescriptor);\r\n\r\n                    Type intefaceType = dataTypeDescriptor.GetInterfaceType();\r\n\r\n                    var foreignRefereeTypes = DataReferenceFacade.GetRefereeTypes(intefaceType)\r\n                        .Where(f => !_dataTypeDescriptorsToDelete.Any(g => g.GetInterfaceType() == f));\r\n\r\n                    foreach (Type foreignRefereeType in foreignRefereeTypes)\r\n                    {\r\n                        _validationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, \r\n                            string.Format(\"Data type '{0}' has references to type '{1}' about to be uninstalled. References must be removed before the package can be uninstalled.\", \r\n                                foreignRefereeType, dataTypeDescriptor.TypeManagerTypeName), typeIdAttribute));\r\n                    }\r\n\r\n                    UninstallerContext.AddPendingForDeletionDataType(intefaceType);\r\n                }\r\n            }\r\n\r\n            if (_validationResult.Count > 0)\r\n            {\r\n                _dataTypeDescriptorsToDelete = null;\r\n            }\r\n\r\n            return _validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            Verify.IsNotNull(_dataTypeDescriptorsToDelete, \"DataTypePackageFragmentUninstaller has not been validated\");\r\n\r\n            bool flushTheSystem = false;\r\n            foreach (DataTypeDescriptor dataTypeDescriptor in _dataTypeDescriptorsToDelete)\r\n            {\r\n                Log.LogVerbose(this.GetType().Name, \"Uninstalling the type '{0}'\", dataTypeDescriptor);\r\n                \r\n                GeneratedTypesFacade.DeleteType(dataTypeDescriptor, false);\r\n                flushTheSystem = true;\r\n            }            \r\n\r\n            if (flushTheSystem)\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem(true);\r\n            }\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return GetResourceString(stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/DllPackageFragmentInstaller.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary> \r\n    /// Installs a dll file. If there's already a dll with the same name, will override it only if the installed version is newer,\r\n    /// also will add/update and assembly binding for the dll in web.config to ensure that the system will run.\r\n    /// The specified dll files will not be uninstalled automatically to avoid potential website crash.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class DllPackageFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private List<FileToCopy> _filesToCopy;\r\n\r\n        private static readonly string LogTitle = nameof(DllPackageFragmentInstaller);\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Files\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.FilePackageFragmentInstaller_OnlyOneFilesElement,\r\n                    this.ConfigurationParent);\r\n                return validationResult;\r\n            }\r\n\r\n            XElement filesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Files\");\r\n\r\n            _filesToCopy = new List<FileToCopy>();\r\n\r\n            if (filesElement != null)\r\n            {\r\n                foreach (XElement fileElement in filesElement.Elements(\"File\"))\r\n                {\r\n                    XAttribute sourceFilenameAttribute = fileElement.Attribute(\"sourceFilename\");\r\n                    XAttribute targetFilenameAttribute = fileElement.Attribute(\"targetFilename\");\r\n\r\n                    if (sourceFilenameAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(\r\n                            Texts.FilePackageFragmentInstaller_MissingAttribute(\"sourceFilename\"), fileElement);\r\n                        continue;\r\n                    }\r\n\r\n                    if (targetFilenameAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(\r\n                            Texts.FilePackageFragmentInstaller_MissingAttribute(\"targetFilename\"), fileElement);\r\n                        continue;\r\n                    }\r\n\r\n                    XAttribute allowOverwriteAttribute = fileElement.Attribute(\"allowOverwrite\");\r\n                    XAttribute assemblyLoadAttribute = fileElement.Attribute(\"assemblyLoad\");\r\n                    XAttribute onlyUpdateAttribute = fileElement.Attribute(\"onlyUpdate\");\r\n                    XAttribute addAssemblyBindingAttribute = fileElement.Attribute(\"addAssemblyBinding\");\r\n\r\n\r\n                    bool allowOverwrite = false;\r\n                    if (!ParseBoolAttribute(allowOverwriteAttribute, validationResult, ref allowOverwrite))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    bool loadAssembly = false;\r\n                    if (!ParseBoolAttribute(assemblyLoadAttribute, validationResult, ref loadAssembly))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    bool onlyUpdate = false;\r\n                    if (!ParseBoolAttribute(onlyUpdateAttribute, validationResult, ref onlyUpdate))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    bool addAssemblyBinding = false;\r\n                    if (!ParseBoolAttribute(addAssemblyBindingAttribute, validationResult, ref addAssemblyBinding))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    string sourceFilename = sourceFilenameAttribute.Value;\r\n                    if (!this.InstallerContext.ZipFileSystem.ContainsFile(sourceFilename))\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingFile(sourceFilename),\r\n                            sourceFilenameAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    if (loadAssembly && onlyUpdate)\r\n                    {\r\n                        validationResult.AddFatal(\r\n                            Texts.FilePackageFragmentInstaller_OnlyUpdateNotAllowedWithLoadAssemlby, onlyUpdateAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    string targetFilename = PathUtil.Resolve(targetFilenameAttribute.Value);\r\n                    if (C1File.Exists(targetFilename))\r\n                    {\r\n                        if (!allowOverwrite && !onlyUpdate)\r\n                        {\r\n                            validationResult.AddFatal(Texts.FilePackageFragmentInstaller_FileExists(targetFilename),\r\n                                targetFilenameAttribute);\r\n                            continue;\r\n                        }\r\n\r\n                        if (((C1File.GetAttributes(targetFilename) & FileAttributes.ReadOnly) > 0) && !allowOverwrite)\r\n                        {\r\n                            validationResult.AddFatal(Texts.FilePackageFragmentInstaller_FileReadOnly(targetFilename),\r\n                                targetFilenameAttribute);\r\n                            continue;\r\n                        }\r\n                    }\r\n                    else if (onlyUpdate)\r\n                    {\r\n                        Log.LogVerbose(LogTitle, \"Skipping updating of the file '{0}' because it does not exist\",\r\n                            targetFilename);\r\n                        continue; // Target file does not, so skip this\r\n                    }\r\n\r\n                    var fileToCopy = new FileToCopy\r\n                    {\r\n                        SourceFilename = sourceFilename,\r\n                        TargetRelativeFilePath = targetFilenameAttribute.Value,\r\n                        TargetFilePath = targetFilename,\r\n                        Overwrite = allowOverwrite || onlyUpdate,\r\n                        AddAssemblyBinding = addAssemblyBinding\r\n                    };\r\n\r\n                    _filesToCopy.Add(fileToCopy);\r\n\r\n                    if (loadAssembly)\r\n                    {\r\n                        string tempFilename = Path.Combine(this.InstallerContext.TempDirectory,\r\n                            Path.GetFileName(targetFilename));\r\n\r\n                        this.InstallerContext.ZipFileSystem.WriteFileToDisk(sourceFilename, tempFilename);\r\n\r\n                        PackageAssemblyHandler.AddAssembly(tempFilename);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _filesToCopy = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n        private static bool ParseBoolAttribute(XAttribute attribute,\r\n            List<PackageFragmentValidationResult> validationResult,\r\n            ref bool resultValue)\r\n        {\r\n            if (attribute == null) return true;\r\n\r\n            if (!attribute.TryGetBoolValue(out resultValue))\r\n            {\r\n                validationResult.AddFatal(Texts.FilePackageFragmentInstaller_WrongAttributeBoolFormat, attribute);\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            Verify.IsNotNull(_filesToCopy, \"{0} has not been validated\", this.GetType().Name);\r\n\r\n            var asmBindingsToAdd = new List<AssemblyName>();\r\n\r\n\r\n            var fileElements = new List<XElement>();\r\n            foreach (FileToCopy fileToCopy in _filesToCopy)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Installing the file '{0}' to the target filename '{1}'\",\r\n                    fileToCopy.SourceFilename, fileToCopy.TargetFilePath);\r\n\r\n                // Extracting the dll file so version can be checked\r\n                string tempFileName = Path.Combine(InstallerContext.TempDirectory, Path.GetRandomFileName());\r\n                this.InstallerContext.ZipFileSystem.WriteFileToDisk(fileToCopy.SourceFilename, tempFileName);\r\n\r\n                // Checking for dll version here:\r\n                var sourceAssemblyName = GetAssemblyNameWithErrorText(tempFileName, () => $\"Source file name: '{fileToCopy.SourceFilename}'\");\r\n\r\n                var sourceAssemblyVersion = sourceAssemblyName.Version;\r\n                var sourceFileVersion = GetDllFileVersion(tempFileName);\r\n\r\n                string targetDirectory = Path.GetDirectoryName(fileToCopy.TargetFilePath);\r\n                if (!Directory.Exists(targetDirectory))\r\n                {\r\n                    Directory.CreateDirectory(targetDirectory);\r\n                }\r\n\r\n                string backupFileName = null;\r\n\r\n                bool addAssemblyBinding = fileToCopy.AddAssemblyBinding;\r\n\r\n                if (C1File.Exists(fileToCopy.TargetFilePath) && fileToCopy.Overwrite)\r\n                {\r\n                    var existingAssemblyName = GetAssemblyNameWithErrorText(fileToCopy.TargetFilePath, () => $\"TargetFilePath: '{fileToCopy.TargetFilePath}' \");\r\n                    var existingAssemblyVersion = existingAssemblyName.Version;\r\n                    var existingFileVersion = GetDllFileVersion(fileToCopy.TargetFilePath);\r\n\r\n                    if (existingAssemblyVersion == sourceAssemblyVersion\r\n                        && existingFileVersion >= sourceFileVersion)\r\n                    {\r\n                        Log.LogInformation(LogTitle,\r\n                            \"Skipping installation for file '{0}' version '{1}'. An assembly with the same version already exists.\",\r\n                            fileToCopy.TargetRelativeFilePath, sourceAssemblyVersion);\r\n                        continue;\r\n                    }\r\n\r\n                    if (existingAssemblyVersion > sourceAssemblyVersion)\r\n                    {\r\n                        Log.LogInformation(LogTitle,\r\n                            \"Skipping installation for file '{0}' version '{1}', as a file with a newer version '{2}' already exists.\",\r\n                            fileToCopy.TargetRelativeFilePath, sourceAssemblyVersion, existingAssemblyVersion);\r\n                        continue;\r\n                    }\r\n\r\n                    addAssemblyBinding = existingAssemblyVersion < sourceAssemblyVersion;\r\n\r\n                    if ((C1File.GetAttributes(fileToCopy.TargetFilePath) & FileAttributes.ReadOnly) > 0)\r\n                    {\r\n                        FileUtils.RemoveReadOnly(fileToCopy.TargetFilePath);\r\n                    }\r\n\r\n                    if (InstallerContext.PackageInformation.CanBeUninstalled)\r\n                    {\r\n                        backupFileName = GetBackupFileName(fileToCopy.TargetFilePath);\r\n\r\n                        string backupFilesFolder = this.InstallerContext.PackageDirectory + \"\\\\FileBackup\";\r\n\r\n                        C1Directory.CreateDirectory(backupFilesFolder);\r\n\r\n                        C1File.Copy(fileToCopy.TargetFilePath, backupFilesFolder + \"\\\\\" + backupFileName);\r\n                    }\r\n\r\n                    Log.LogInformation(LogTitle, \"Overwriting existing file '{0}' version '{2}', new version is '{1}'\",\r\n                        fileToCopy.TargetRelativeFilePath, sourceFileVersion, existingFileVersion);\r\n                }\r\n\r\n                if (addAssemblyBinding)\r\n                {\r\n                    asmBindingsToAdd.Add(sourceAssemblyName);\r\n                }\r\n\r\n                File.Delete(fileToCopy.TargetFilePath);\r\n                File.Move(tempFileName, fileToCopy.TargetFilePath);\r\n\r\n                var fileElement = new XElement(\"File\",\r\n                    new XAttribute(\"filename\", fileToCopy.TargetRelativeFilePath),\r\n                    new XAttribute(\"version\", sourceFileVersion));\r\n\r\n                if (backupFileName != null)\r\n                {\r\n                    fileElement.Add(new XAttribute(\"backupFile\", backupFileName));\r\n                }\r\n\r\n                fileElements.Add(fileElement);\r\n            }\r\n\r\n            UpdateBindingRedirects(asmBindingsToAdd);\r\n\r\n            yield return new XElement(\"Files\", fileElements);\r\n        }\r\n\r\n        private AssemblyName GetAssemblyNameWithErrorText(string filePath, Func<string> getErrorText)\r\n        {\r\n            try\r\n            {\r\n                return AssemblyName.GetAssemblyName(filePath);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException(\"Failed to read AssemblyName from a DLL. \" + getErrorText(), ex);\r\n            }\r\n        }\r\n\r\n        private Version GetDllFileVersion(string dllFilePath)\r\n        {\r\n            var fileVersionInfo = FileVersionInfo.GetVersionInfo(dllFilePath);\r\n            return new Version(\r\n                fileVersionInfo.FileMajorPart,\r\n                fileVersionInfo.FileMinorPart,\r\n                fileVersionInfo.FileBuildPart,\r\n                fileVersionInfo.FilePrivatePart);\r\n        }\r\n\r\n        private void UpdateBindingRedirects(IEnumerable<AssemblyName> assemblyNames)\r\n        {\r\n            string webConfigPath = PathUtil.Resolve(\"~/web.config\");\r\n\r\n            var webConfig = XDocument.Load(webConfigPath);\r\n\r\n            var assemblyBindingConfig = new AssemblyBindingConfiguration(webConfig);\r\n\r\n            foreach (var assemblyName in assemblyNames)\r\n            {\r\n                assemblyBindingConfig.AddRedirectsForAssembly(assemblyName);\r\n            }\r\n\r\n            assemblyBindingConfig.SaveIfChanged(webConfigPath);\r\n        }\r\n\r\n        private string GetBackupFileName(string targetFilePath)\r\n        {\r\n            string fileName = Path.GetFileName(targetFilePath);\r\n            string directory = targetFilePath.Substring(0, targetFilePath.Length - fileName.Length);\r\n\r\n\r\n            return directory.GetHashCode() + \"_\" + fileName;\r\n        }\r\n\r\n\r\n        private sealed class FileToCopy\r\n        {\r\n            public string SourceFilename { get; set; }\r\n            public string TargetRelativeFilePath { get; set; }\r\n            public string TargetFilePath { get; set; }\r\n            public bool AddAssemblyBinding { get; set; }\r\n            public bool Overwrite { get; set; }\r\n        }\r\n\r\n\r\n\r\n        private class AssemblyBindingConfiguration\r\n        {\r\n            private static readonly XNamespace AssemblyBindingXNamespace = \"urn:schemas-microsoft-com:asm.v1\";\r\n\r\n            private readonly XDocument _document;\r\n            private readonly XElement _assemblyBindingElement;\r\n            private bool _changed;\r\n\r\n            public AssemblyBindingConfiguration(XDocument configFile)\r\n            {\r\n                _document = configFile;\r\n\r\n                var root = configFile.Root;\r\n                var runtimeElement = root.Element(\"runtime\");\r\n\r\n                if (runtimeElement == null)\r\n                {\r\n                    root.Add(runtimeElement = new XElement(\"runtime\"));\r\n                }\r\n\r\n                var assemblyBindingXname = AssemblyBindingXNamespace + \"assemblyBinding\";\r\n                var assemblyBindingElement = runtimeElement.Element(assemblyBindingXname);\r\n\r\n                if (assemblyBindingElement == null)\r\n                {\r\n                    runtimeElement.Add(assemblyBindingElement = XElement.Parse(@\"<assemblyBinding xmlns=\"\"urn:schemas-microsoft-com:asm.v1\"\" />\"));\r\n                }\r\n\r\n                _assemblyBindingElement = assemblyBindingElement;\r\n            }\r\n\r\n            private DependantAssembly[] GetDependantAssemblies()\r\n            {\r\n                return\r\n                    _assemblyBindingElement.Elements(AssemblyBindingXNamespace + \"dependentAssembly\")\r\n                        .Select(e => new DependantAssembly(e))\r\n                        .ToArray();\r\n            }\r\n\r\n            public void AddRedirectsForAssembly(AssemblyName assemblyName)\r\n            {\r\n                var version = assemblyName.Version;\r\n                string newTargetVersionStr = assemblyName.Version.ToString();\r\n\r\n                var existingBinding = GetDependantAssemblies().FirstOrDefault(a => a.Name == assemblyName.Name);\r\n\r\n                if (existingBinding != null)\r\n                {\r\n                    var oldRedirectToStr = existingBinding.NewVersion;\r\n                    if (oldRedirectToStr == null)\r\n                    {\r\n                        return;\r\n                    }\r\n\r\n                    var oldRedirectToVersion = new Version(existingBinding.NewVersion);\r\n                    if (oldRedirectToVersion == version)\r\n                    {\r\n                        return;\r\n                    }\r\n\r\n                    existingBinding.OldVersion = \"0.0.0.0-\" + newTargetVersionStr;\r\n                    existingBinding.NewVersion = newTargetVersionStr;\r\n\r\n                    _changed = true;\r\n                    return;\r\n                }\r\n\r\n                string publicKeyToken = GetPublicKeyToken(assemblyName);\r\n\r\n                if (publicKeyToken != null)\r\n                {\r\n                    _assemblyBindingElement.Add(XElement.Parse(string.Format(@\"\r\n                    <assemblyBinding xmlns=\"\"urn:schemas-microsoft-com:asm.v1\"\">\r\n                     <dependentAssembly>\r\n                        <assemblyIdentity name=\"\"{0}\"\" publicKeyToken=\"\"{1}\"\" culture=\"\"neutral\"\"/>\r\n                        <!-- This binding redirect was added by C1 CMS package installer -->\r\n                        <bindingRedirect oldVersion=\"\"0.0.0.0-{2}\"\" newVersion=\"\"{2}\"\" />\r\n                     </dependentAssembly>\r\n                    </assemblyBinding>\", assemblyName.Name, publicKeyToken, newTargetVersionStr)).Elements().Single());\r\n\r\n                    _changed = true;\r\n                }\r\n            }\r\n\r\n            private string GetPublicKeyToken(AssemblyName assemblyName)\r\n            {\r\n                byte[] publicKeyTokenBytes = assemblyName.GetPublicKeyToken();\r\n\r\n                return publicKeyTokenBytes == null || publicKeyTokenBytes.Length == 0\r\n                    ? \"null\"\r\n                    : string.Join(\"\", publicKeyTokenBytes.Select(b => $\"{b:x2}\"));\r\n            }\r\n\r\n            public void SaveIfChanged(string fileName)\r\n            {\r\n                if (!_changed) return;\r\n\r\n                _document.Save(fileName);\r\n                _changed = false;\r\n            }\r\n\r\n            internal class DependantAssembly\r\n            {\r\n                private readonly XElement _assemblyIdentity;\r\n                private readonly XElement _bindingRedirect;\r\n\r\n                public DependantAssembly(XElement innerElement)\r\n                {\r\n                    XElement innerElement1 = innerElement;\r\n                    _assemblyIdentity = innerElement1.Element(AssemblyBindingXNamespace + \"assemblyIdentity\");\r\n                    _bindingRedirect = innerElement1.Element(AssemblyBindingXNamespace + \"bindingRedirect\");\r\n                }\r\n\r\n                public string Name\r\n                {\r\n                    get\r\n                    {\r\n                        return _assemblyIdentity != null ? (string)_assemblyIdentity.Attribute(\"name\") : null;\r\n                    }\r\n                }\r\n\r\n                public string NewVersion\r\n                {\r\n                    get\r\n                    {\r\n                        return _bindingRedirect != null ? (string)_bindingRedirect.Attribute(\"newVersion\") : null;\r\n                    }\r\n                    set\r\n                    {\r\n                        _bindingRedirect.SetAttributeValue(\"newVersion\", value);\r\n                    }\r\n                }\r\n\r\n                public string OldVersion\r\n                {\r\n                    get\r\n                    {\r\n                        return _bindingRedirect != null ? (string)_bindingRedirect.Attribute(\"oldVersion\") : null;\r\n                    }\r\n                    set\r\n                    {\r\n                        _bindingRedirect.SetAttributeValue(\"oldVersion\", value);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/DllPackageFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DllPackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        private string LogTitle { get { return this.GetType().Name;  }}\r\n\r\n        private List<string> _filesToDelete;\r\n        private List<FileToCopy> _filesToCopy;\r\n\r\n\r\n        private class FileToCopy\r\n        {\r\n            public string BackupFilePath;\r\n            public string FilePath;\r\n            public string RelativeFilePath;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Files\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.FilePackageFragmentUninstaller_OnlyOneFilesElement, ConfigurationParent);\r\n                return validationResult;\r\n            }\r\n\r\n            XElement filesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Files\");\r\n            \r\n\r\n            _filesToDelete = new List<string>();\r\n            _filesToCopy = new List<FileToCopy>();\r\n\r\n            if (filesElement != null)\r\n            {\r\n                foreach (XElement fileElement in filesElement.Elements(\"File\").Reverse())\r\n                {\r\n                    XAttribute filenameAttribute = fileElement.Attribute(\"filename\");\r\n                    if (filenameAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingAttribute(\"filename\"), fileElement);\r\n                        continue;\r\n                    }\r\n\r\n                    string relativeFilePath = filenameAttribute.Value;\r\n\r\n                    string filePath = PathUtil.Resolve(relativeFilePath);\r\n\r\n                    string backupFile = (string) fileElement.Attribute(\"backupFile\");\r\n\r\n                    if (backupFile != null)\r\n                    {\r\n                        var backupFilePath = Path.Combine(UninstallerContext.PackageDirectory, \"FileBackup\", backupFile);\r\n                        if (!C1File.Exists(backupFilePath))\r\n                        {\r\n                            validationResult.AddFatal(\"Missing backup file '{0}'\".FormatWith(backupFilePath), fileElement);\r\n                            continue;\r\n                        }\r\n\r\n                        _filesToCopy.Add(new FileToCopy\r\n                        {\r\n                            BackupFilePath = backupFilePath,\r\n                            FilePath = filePath,\r\n                            RelativeFilePath = relativeFilePath\r\n                        });\r\n                    }\r\n                    else\r\n                    {\r\n                        _filesToDelete.Add(filePath);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _filesToDelete = null;\r\n                _filesToCopy = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            Verify.IsNotNull(_filesToDelete as object ?? _filesToCopy, \"{0} has not been validated\", this.GetType().Name);\r\n\r\n            foreach (string filename in _filesToDelete)\r\n            {\r\n                Log.LogInformation(LogTitle, \"Not uninstalling file '{0}' to avoid potential compilation errors\", filename);\r\n\r\n                // Log.LogVerbose(LogTitle, \"Uninstalling the file '{0}'\", filename);\r\n\r\n                // FileUtils.Delete(filename);\r\n            }\r\n\r\n            foreach (var fileToCopy in _filesToCopy)\r\n            {\r\n                Log.LogInformation(LogTitle, \"Not restoring the original version of '{0}' file to avoid potential compilation errors\", fileToCopy.RelativeFilePath);\r\n\r\n                // Log.LogVerbose(LogTitle, \"Restoring file from a backup copy'{0}'\", fileToCopy.FilePath);\r\n\r\n                //if ((C1File.GetAttributes(targetFile) & FileAttributes.ReadOnly) > 0)\r\n                //{\r\n                //    FileUtils.RemoveReadOnly(targetFile);\r\n                //}\r\n\r\n                //C1File.Copy(fileToCopy.BackupFilePath, targetFile, true);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/DynamicDataTypePackageFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DynamicDataTypePackageFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private static readonly string LogTitle = typeof (DynamicDataTypePackageFragmentInstaller).Name;\r\n\r\n        private List<DataTypeDescriptor> _dataTypeDescriptors = null;\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            var foreignKeyReferences = new List<string>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Types\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.DynamicDataTypePackageFragmentInstaller_OnlyOneElement);\r\n                return validationResult;\r\n            }\r\n\r\n            XElement typesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Types\");\r\n            if (typesElement == null)\r\n            {\r\n                validationResult.AddFatal(Texts.DynamicDataTypePackageFragmentInstaller_MissingElement);\r\n                return validationResult;\r\n            }\r\n\r\n            _dataTypeDescriptors = new List<DataTypeDescriptor>();\r\n\r\n            foreach (XElement typeElement in typesElement.Elements(\"Type\"))\r\n            {\r\n                XElement serializedDataTypeDescriptor;\r\n\r\n                XAttribute fileAttribute = typeElement.Attribute(\"dataTypeDescriptorFile\");\r\n                if (fileAttribute != null)\r\n                {\r\n                    string relativeFilePath = (string)fileAttribute;\r\n\r\n                    string markup;\r\n\r\n                    using (var stream = this.InstallerContext.ZipFileSystem.GetFileStream(relativeFilePath))\r\n                    using (var reader = new StreamReader(stream))\r\n                    {\r\n                        markup = reader.ReadToEnd();\r\n                    }\r\n\r\n                    serializedDataTypeDescriptor = XElement.Parse(markup);\r\n                }\r\n                else\r\n                {\r\n                    var dataTypeDescriptorAttribute = typeElement.Attribute(\"dataTypeDescriptor\");\r\n                    if (dataTypeDescriptorAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.DataTypePackageFragmentInstaller_MissingAttribute(\"dataTypeDescriptor\"), typeElement);\r\n                        continue;\r\n                    }\r\n\r\n                    try\r\n                    {\r\n                        serializedDataTypeDescriptor = XElement.Parse(dataTypeDescriptorAttribute.Value);\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        validationResult.AddFatal(Texts.DynamicDataTypePackageFragmentInstaller_DataTypeDescriptorParseError, dataTypeDescriptorAttribute);\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                DataTypeDescriptor dataTypeDescriptor;\r\n                try\r\n                {\r\n                    bool inheritedFieldsIncluded = serializedDataTypeDescriptor.Descendants().Any(e => e.Attributes(\"inherited\").Any(a => (string) a == \"true\"));\r\n\r\n                    dataTypeDescriptor = DataTypeDescriptor.FromXml(serializedDataTypeDescriptor, inheritedFieldsIncluded);\r\n                }\r\n                catch (Exception e)\r\n                {\r\n                    validationResult.AddFatal(Texts.DynamicDataTypePackageFragmentInstaller_DataTypeDescriptorDeserializeError(e.Message));\r\n                    continue;\r\n                }\r\n\r\n                Type type = TypeManager.TryGetType(dataTypeDescriptor.TypeManagerTypeName);\r\n                if (type != null && DataFacade.GetAllKnownInterfaces().Contains(type))\r\n                {\r\n                    validationResult.AddFatal(Texts.DynamicDataTypePackageFragmentInstaller_TypeExists(type));\r\n                }\r\n\r\n                if (dataTypeDescriptor.SuperInterfaces.Any(f=>f.Name==nameof(IVersioned)))\r\n                {\r\n                    if (dataTypeDescriptor.Fields.All(f => f.Name != nameof(IVersioned.VersionId)))\r\n                    {\r\n                        dataTypeDescriptor.Fields.Add(new DataFieldDescriptor(Guid.NewGuid(), nameof(IVersioned.VersionId),StoreFieldType.Guid, typeof(Guid),true ));\r\n                    }\r\n                }\r\n            \r\n                foreach (var field in dataTypeDescriptor.Fields)\r\n                {\r\n                    if(!field.ForeignKeyReferenceTypeName.IsNullOrEmpty())\r\n                    {\r\n                        foreignKeyReferences.Add(field.ForeignKeyReferenceTypeName);\r\n                    }\r\n                }\r\n\r\n                _dataTypeDescriptors.Add(dataTypeDescriptor);\r\n                this.InstallerContext.AddPendingDataTypeDescritpor(dataTypeDescriptor.TypeManagerTypeName, dataTypeDescriptor);\r\n            }\r\n\r\n            foreach(string foreignKeyTypeName in foreignKeyReferences)\r\n            {\r\n                if(!TypeManager.HasTypeWithName(foreignKeyTypeName) \r\n                    && !_dataTypeDescriptors.Any(descriptor => descriptor.TypeManagerTypeName == foreignKeyTypeName))\r\n                {\r\n                    validationResult.AddFatal(Texts.DynamicDataTypePackageFragmentInstaller_MissingReferencedType(foreignKeyTypeName));\r\n                }\r\n            }\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _dataTypeDescriptors = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            if (_dataTypeDescriptors == null) throw new InvalidOperationException(LogTitle + \" has not been validated\");\r\n\r\n            string typeNames = string.Join(\", \", _dataTypeDescriptors.Select(d => d.GetFullInterfaceName()));\r\n\r\n            Log.LogVerbose(this.GetType().Name, $\"Installing types: '{typeNames}'\");\r\n\r\n            GeneratedTypesFacade.GenerateNewTypes(_dataTypeDescriptors, true);\r\n\r\n            var typeElements = _dataTypeDescriptors.Select(d => new XElement(\"Type\", new XAttribute(\"typeId\", d.DataTypeId)));\r\n\r\n            yield return new XElement(\"Types\", typeElements);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/DynamicDataTypePackageFragmentUninstaller.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DynamicDataTypePackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        private List<DataTypeDescriptor> _dataTypeDescriptorsToDelete;\r\n        private List<PackageFragmentValidationResult> _validationResult;\r\n\r\n        /// <exclude />\r\n        public override bool ValidateFirst { get { return true; } }\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            _validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Types\") > 1)\r\n            {\r\n                _validationResult.AddFatal(GetText(\"DynamicDataTypePackageFragmentUninstaller.OnlyOneElement\"));\r\n                return _validationResult;\r\n            }\r\n\r\n            XElement typesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Types\");\r\n\r\n            _dataTypeDescriptorsToDelete = new List<DataTypeDescriptor>();\r\n\r\n            if (typesElement != null)\r\n            {\r\n                foreach (XElement typeElement in typesElement.Elements(\"Type\").Reverse())\r\n                {\r\n                    XAttribute typeIdAttribute = typeElement.Attribute(\"typeId\");\r\n                    if (typeIdAttribute == null)\r\n                    {\r\n                        _validationResult.AddFatal(GetText(\"DynamicDataTypePackageFragmentUninstaller.MissingAttribute\").FormatWith(\"typeId\"), typeElement);\r\n                        continue;\r\n                    }\r\n\r\n                    Guid typeId;\r\n                    if (!typeIdAttribute.TryGetGuidValue(out typeId))\r\n                    {\r\n                        _validationResult.AddFatal(GetText(\"DynamicDataTypePackageFragmentUninstaller.WrongAttributeFormat\"), typeIdAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeId);\r\n                    if (dataTypeDescriptor == null)\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    _dataTypeDescriptorsToDelete.Add(dataTypeDescriptor);\r\n\r\n                    Type interfaceType = dataTypeDescriptor.GetInterfaceType();\r\n                    var foreignRefereeTypes = DataReferenceFacade.GetRefereeTypes(interfaceType).Where(f => !_dataTypeDescriptorsToDelete.Any(g => g.GetInterfaceType() == f));\r\n                    foreach (Type foreignRefereeType in foreignRefereeTypes)\r\n                    {\r\n                        // TODO: localize\r\n                        _validationResult.AddFatal(string.Format(\"Data type '{0}' has references to type '{1}' about to be uninstalled. References must be removed before the package can be uninstalled.\", foreignRefereeType, dataTypeDescriptor.TypeManagerTypeName), \r\n                                                    typeIdAttribute);\r\n                    }\r\n\r\n                    UninstallerContext.AddPendingForDeletionDataType(interfaceType);\r\n                }\r\n            }\r\n\r\n            if (_validationResult.Count > 0)\r\n            {\r\n                _dataTypeDescriptorsToDelete = null;\r\n            }\r\n\r\n            return _validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            Verify.IsNotNull(_dataTypeDescriptorsToDelete, \"DynamicDataTypePackageFragmentUninstaller has not been validated\");\r\n\r\n            bool flushTheSystem = false;\r\n            foreach (DataTypeDescriptor dataTypeDescriptor in _dataTypeDescriptorsToDelete)\r\n            {\r\n                Log.LogVerbose(this.GetType().Name, \"Uninstalling the type '{0}'\", dataTypeDescriptor);\r\n\r\n                GeneratedTypesFacade.DeleteType(dataTypeDescriptor, false);\r\n                flushTheSystem = true;\r\n            }\r\n\r\n            if (flushTheSystem)\r\n            {\r\n                CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);\r\n            }\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return GetResourceString(stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/FileModifyPackageFragmentInstaller.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>Package installer for appending content to text files.</summary>\r\n    /// <exclude />\r\n    /// <example>\r\n    ///&lt;mi:Add installerType=&quot;Composite.Core.PackageSystem.PackageFragmentInstallers.FileModifyPackageFragmentInstaller, Composite&quot; \r\n\t///          uninstallerType=&quot;Composite.Core.PackageSystem.PackageFragmentInstallers.FileModifyPackageFragmentUninstaller, Composite&quot;&gt;\r\n\t/// &lt;AppendText path=&quot;~/sdfdsfds.css&quot; whenNotExist=&quot;create&quot;&gt;  &lt;!-- whenNotExist=&quot;fail,create,ignore&quot; --&gt;\r\n\t///     Line 1\r\n\t///     Line 2 \r\n\t///     Line 3\r\n\t///     &lt;/AppendText&gt;\r\n    ///&lt;/mi:Add&gt;\r\n    /// </example>\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class FileModifyPackageFragmentInstaller : BasePackageFragmentInstaller\r\n\t{\r\n        private enum ActionOnMissingFile\r\n        {\r\n            Fail = 0,\r\n            Create = 1,\r\n            Ignore = 2\r\n        }\r\n\r\n        internal static readonly string AppendText_ElementName = \"AppendText\";\r\n\r\n        internal static readonly string TargetXml_AttributeName = \"path\";\r\n        internal static readonly string WhenNotExist_AttributeName = \"whenNotExist\";\r\n\r\n        private List<ContentToAdd> _contentToAdd;\r\n\r\n        /// <exclude/>\r\n\t\tpublic override IEnumerable<PackageFragmentValidationResult> Validate()\r\n\t\t{\r\n\t\t\tvar validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            _contentToAdd = new List<ContentToAdd>();\r\n\r\n            foreach (var element in this.Configuration)\r\n            {\r\n                if (element.Name != AppendText_ElementName)\r\n                {\r\n                    validationResult.AddFatal(Texts.PackageFragmentInstaller_IncorrectElement(element.Name.LocalName, AppendText_ElementName), element);\r\n                    continue;\r\n                }\r\n\r\n                var pathAttr = element.Attribute(TargetXml_AttributeName);\r\n                if (pathAttr == null)\r\n                {\r\n                    validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(TargetXml_AttributeName), element);\r\n                    continue;\r\n                }\r\n\r\n                string path = (string)pathAttr;\r\n\r\n                var actionOnMissingFile = ActionOnMissingFile.Fail;\r\n\r\n                var whenNotExistsAttr = element.Attribute(WhenNotExist_AttributeName);\r\n                if (whenNotExistsAttr != null)\r\n                {\r\n                    actionOnMissingFile = (ActionOnMissingFile) Enum.Parse(typeof (ActionOnMissingFile), whenNotExistsAttr.Value, true);\r\n                }\r\n\r\n                string filePath = PathUtil.Resolve(path);\r\n                if (!C1File.Exists(filePath))\r\n                {\r\n                    if (actionOnMissingFile == ActionOnMissingFile.Fail)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FileModifyPackageFragmentInstaller_FileDoesNotExist(filePath), pathAttr);\r\n                        continue;\r\n                    }\r\n\r\n                    if (actionOnMissingFile == ActionOnMissingFile.Ignore)\r\n                    {\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                _contentToAdd.Add(new ContentToAdd\r\n                {\r\n                    Path = filePath,\r\n                    Content = element.Value\r\n                });\r\n            }\r\n\r\n           \r\n            if (validationResult.Any())\r\n            {\r\n                _contentToAdd = null;\r\n            }\r\n            \r\n\t\t\treturn validationResult;\r\n\t\t}\r\n\r\n        /// <exclude/>\r\n\t\tpublic override IEnumerable<XElement> Install()\r\n\t\t{\r\n            Verify.IsNotNull(_contentToAdd, \"FileModifyPackageFragmentInstaller has not been validated\");\r\n\r\n            foreach (ContentToAdd content in _contentToAdd)\r\n            {\r\n                if (C1File.Exists(content.Path))\r\n                {\r\n                    using (C1StreamWriter sw = C1File.AppendText(content.Path))\r\n                    {\r\n                        sw.Write(content.Content);\r\n                        sw.Close();\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    C1File.WriteAllText(content.Path, content.Content);\r\n                }\r\n            }\r\n\t\t\treturn new[] {  this.Configuration.FirstOrDefault() };\r\n\t\t}\r\n\r\n        internal sealed class ContentToAdd\r\n\t\t{\r\n            public string Path { get; set; }\r\n\t\t\tpublic string Content { get; set; }\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/FileModifyPackageFragmentUninstaller.cs",
    "content": "using System.Collections.Generic;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class FileModifyPackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n\t{\r\n       /// <exclude />\r\n\t\tpublic override IEnumerable<PackageFragmentValidationResult> Validate()\r\n\t\t{\r\n            return new List<PackageFragmentValidationResult>();\r\n\t\t}\r\n\r\n        /// <exclude />\r\n\t\tpublic override void Uninstall()\r\n\t\t{\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/FilePackageFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing System.Reflection;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class FilePackageFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private List<FileToCopy> _filesToCopy;\r\n        private List<string> _directoriesToDelete;\r\n\r\n        private static readonly string LogTitle = typeof(FilePackageFragmentInstaller).Name;\r\n\r\n        private static readonly string[] DllsNotToLoad = \r\n        {\r\n            \"System.\", \"Microsoft.\",  \"Antlr3.\", \"WebGrease\", \"Composite.Web.BundlingAndMinification\"\r\n        };\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Files\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.FilePackageFragmentInstaller_OnlyOneFilesElement, this.ConfigurationParent);\r\n                return validationResult;\r\n            }\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Directories\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.FilePackageFragmentInstaller_OnlyOneDirectoriesElement, this.ConfigurationParent);\r\n                return validationResult;\r\n            }\r\n\r\n            XElement filesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Files\");\r\n            XElement directoriesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Directories\");\r\n\r\n            _filesToCopy = new List<FileToCopy>();\r\n            _directoriesToDelete = new List<string>();\r\n\r\n            if (filesElement != null)\r\n            {\r\n                foreach (XElement fileElement in filesElement.Elements(\"File\"))\r\n                {\r\n                    XAttribute sourceFilenameAttribute = fileElement.Attribute(\"sourceFilename\");\r\n                    XAttribute targetFilenameAttribute = fileElement.Attribute(\"targetFilename\");\r\n\r\n                    if (sourceFilenameAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingAttribute(\"sourceFilename\"), fileElement); \r\n                        continue;\r\n                    }\r\n\r\n                    if (targetFilenameAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingAttribute(\"targetFilename\"), fileElement); \r\n                        continue;\r\n                    }\r\n\r\n                    XAttribute allowOverwriteAttribute = fileElement.Attribute(\"allowOverwrite\");\r\n                    XAttribute assemblyLoadAttribute = fileElement.Attribute(\"assemblyLoad\");\r\n                    XAttribute deleteTargetDirectoryAttribute = fileElement.Attribute(\"deleteTargetDirectory\");\r\n                    XAttribute onlyUpdateAttribute = fileElement.Attribute(\"onlyUpdate\");\r\n                    XAttribute onlyAddAttribute = fileElement.Attribute(\"onlyAdd\");\r\n\r\n                    if (deleteTargetDirectoryAttribute != null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_DeleteTargetDirectoryNotAllowed, fileElement);\r\n                        continue;\r\n                    }\r\n\r\n                    bool allowOverwrite = false;\r\n                    if (!ParseBoolAttribute(allowOverwriteAttribute, validationResult, ref allowOverwrite))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    bool loadAssembly = false;\r\n                    if (!ParseBoolAttribute(assemblyLoadAttribute, validationResult, ref loadAssembly))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    bool onlyUpdate = false;\r\n                    if (!ParseBoolAttribute(onlyUpdateAttribute, validationResult, ref onlyUpdate))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    bool onlyAdd = false;\r\n                    if (!ParseBoolAttribute(onlyAddAttribute, validationResult, ref onlyAdd))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    string sourceFilename = sourceFilenameAttribute.Value;\r\n                    if (!this.InstallerContext.ZipFileSystem.ContainsFile(sourceFilename))\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingFile(sourceFilename), sourceFilenameAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    if (loadAssembly && onlyUpdate)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_OnlyUpdateNotAllowedWithLoadAssemlby, onlyUpdateAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    if (onlyAdd && onlyUpdate)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_OnlyUpdateAndOnlyAddNotAllowed, onlyUpdateAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    if (onlyAdd && allowOverwrite)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_OnlyAddAndAllowOverwriteNotAllowed, onlyAddAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    string targetFilename = PathUtil.Resolve(targetFilenameAttribute.Value);\r\n                    if (C1File.Exists(targetFilename))\r\n                    {\r\n                        if (onlyAdd)\r\n                        {\r\n                            Log.LogVerbose(LogTitle, \"Skipping adding of the file '{0}' because it already exist and is marked 'onlyAdd'\", targetFilename);\r\n                            continue; // Target file does not, so skip this\r\n                        }\r\n\r\n                        if (!allowOverwrite && !onlyUpdate)\r\n                        {\r\n                            validationResult.AddFatal(Texts.FilePackageFragmentInstaller_FileExists(targetFilename), targetFilenameAttribute);\r\n                            continue;\r\n                        }\r\n\r\n                        if (((C1File.GetAttributes(targetFilename) & FileAttributes.ReadOnly) > 0) && !allowOverwrite)\r\n                        {\r\n                            validationResult.AddFatal(Texts.FilePackageFragmentInstaller_FileReadOnly(targetFilename), targetFilenameAttribute);\r\n                            continue;\r\n                        }\r\n                    }\r\n                    else if (onlyUpdate)\r\n                    {\r\n                        Log.LogVerbose(LogTitle, \"Skipping updating of the file '{0}' because it does not exist\", targetFilename);\r\n                        continue; // Target file does not, so skip this\r\n                    }\r\n\r\n                    var fileToCopy = new FileToCopy\r\n                    {\r\n                        SourceFilename = sourceFilename,\r\n                        TargetRelativeFilePath = targetFilenameAttribute.Value,\r\n                        TargetFilePath = targetFilename,\r\n                        Overwrite = allowOverwrite || onlyUpdate\r\n                    };\r\n\r\n                    _filesToCopy.Add(fileToCopy);\r\n\r\n                    if (loadAssembly)\r\n                    {\r\n                        string tempFilename = Path.Combine(this.InstallerContext.TempDirectory, Path.GetFileName(targetFilename));\r\n\r\n                        this.InstallerContext.ZipFileSystem.WriteFileToDisk(sourceFilename, tempFilename);\r\n\r\n                        PackageAssemblyHandler.AddAssembly(tempFilename);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (directoriesElement != null)\r\n            {\r\n                foreach (XElement directoryElement in directoriesElement.Elements(\"Directory\"))\r\n                {\r\n                    XAttribute sourceDirectoryAttribute = directoryElement.Attribute(\"sourceDirectory\");\r\n                    XAttribute targetDirectoryAttribute = directoryElement.Attribute(\"targetDirectory\");\r\n\r\n                    if (sourceDirectoryAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingAttribute(\"sourceDirectory\"), directoryElement); \r\n                        continue;\r\n                    }\r\n\r\n                    if (targetDirectoryAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingAttribute(\"targetDirectory\"), directoryElement); \r\n                        continue;\r\n                    }\r\n\r\n\r\n                    XAttribute allowOverwriteAttribute = directoryElement.Attribute(\"allowOverwrite\");\r\n                    XAttribute assemblyLoadAttribute = directoryElement.Attribute(\"assemblyLoad\");\r\n                    XAttribute deleteTargetDirectoryAttribute = directoryElement.Attribute(\"deleteTargetDirectory\");\r\n                    XAttribute onlyUpdateAttribute = directoryElement.Attribute(\"onlyUpdate\");\r\n\r\n                    if (assemblyLoadAttribute != null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_AssemblyLoadNotAllowed, directoryElement);\r\n                        continue;\r\n                    }\r\n\r\n                    if (onlyUpdateAttribute != null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_OnlyUpdateNotAllowed, directoryElement);\r\n                        continue;\r\n                    }\r\n\r\n\r\n                    bool allowOverwrite = false;\r\n                    if (!ParseBoolAttribute(allowOverwriteAttribute, validationResult, ref allowOverwrite))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    bool deleteTargetDirectory = false;\r\n                    if (!ParseBoolAttribute(deleteTargetDirectoryAttribute, validationResult, ref deleteTargetDirectory))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    string sourceDirectory = sourceDirectoryAttribute.Value;\r\n                    if (!this.InstallerContext.ZipFileSystem.ContainsDirectory(sourceDirectory))\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingDirectory(sourceDirectory), sourceDirectoryAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    string targetDirectory = PathUtil.Resolve(targetDirectoryAttribute.Value);\r\n\r\n                    if (deleteTargetDirectory)\r\n                    {\r\n                        if (C1Directory.Exists(targetDirectory))\r\n                        {\r\n                            _directoriesToDelete.Add(targetDirectory);\r\n                        }\r\n                    }\r\n\r\n                    foreach (string sourceFilename in this.InstallerContext.ZipFileSystem.GetFilenames(sourceDirectory))\r\n                    {\r\n                        string resolvedSourceFilename = sourceFilename.Remove(0, sourceDirectory.Length);\r\n                        if (resolvedSourceFilename.StartsWith(\"/\"))\r\n                        {\r\n                            resolvedSourceFilename = resolvedSourceFilename.Remove(0, 1);\r\n                        }\r\n\r\n                        string targetFilename = Path.Combine(targetDirectory, resolvedSourceFilename);\r\n\r\n                        if (C1File.Exists(targetFilename) && !deleteTargetDirectory && !allowOverwrite)\r\n                        {\r\n                            validationResult.AddFatal(Texts.FilePackageFragmentInstaller_FileExists(targetFilename), targetDirectoryAttribute);\r\n                            continue;\r\n                        }\r\n\r\n                        var fileToCopy = new FileToCopy\r\n                        {\r\n                            SourceFilename = sourceFilename,\r\n                            TargetRelativeFilePath = Path.Combine(targetDirectoryAttribute.Value, resolvedSourceFilename),\r\n                            TargetFilePath = targetFilename,\r\n                            Overwrite = allowOverwrite\r\n                        };\r\n                        _filesToCopy.Add(fileToCopy);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _filesToCopy = null;\r\n                _directoriesToDelete = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n        private static bool ParseBoolAttribute(XAttribute attribute, List<PackageFragmentValidationResult> validationResult,\r\n                                               ref bool resultValue)\r\n        {\r\n            if (attribute == null) return true;\r\n            \r\n            if (!attribute.TryGetBoolValue(out resultValue))\r\n            {\r\n                validationResult.AddFatal(Texts.FilePackageFragmentInstaller_WrongAttributeBoolFormat, attribute);\r\n                return false;\r\n            }\r\n            \r\n            return true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            Verify.IsNotNull(_filesToCopy, \"{0} has not been validated\", this.GetType().Name);\r\n\r\n            foreach (string directoryToDelete in _directoriesToDelete)\r\n            {\r\n                Directory.Delete(directoryToDelete, true);\r\n            }\r\n\r\n            var fileElements = new List<XElement>();\r\n            foreach (FileToCopy fileToCopy in _filesToCopy)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Installing the file '{0}' to the target filename '{1}'\", fileToCopy.SourceFilename, fileToCopy.TargetFilePath);\r\n\r\n                string targetDirectory = Path.GetDirectoryName(fileToCopy.TargetFilePath);\r\n                if (!Directory.Exists(targetDirectory))\r\n                {\r\n                    Directory.CreateDirectory(targetDirectory);\r\n                }\r\n\r\n                string backupFileName = null;\r\n\r\n                if (C1File.Exists(fileToCopy.TargetFilePath) && fileToCopy.Overwrite)\r\n                {\r\n                    if ((C1File.GetAttributes(fileToCopy.TargetFilePath) & FileAttributes.ReadOnly) > 0)\r\n                    {\r\n                        FileUtils.RemoveReadOnly(fileToCopy.TargetFilePath);\r\n                    }\r\n\r\n                    if (InstallerContext.PackageInformation.CanBeUninstalled)\r\n                    {\r\n                        backupFileName = GetBackupFileName(fileToCopy.TargetFilePath);\r\n\r\n                        string backupFilesFolder = this.InstallerContext.PackageDirectory + \"\\\\FileBackup\";\r\n\r\n                        C1Directory.CreateDirectory(backupFilesFolder);\r\n\r\n                        C1File.Copy(fileToCopy.TargetFilePath, backupFilesFolder + \"\\\\\" + backupFileName);\r\n                    }\r\n                }\r\n\r\n                this.InstallerContext.ZipFileSystem.WriteFileToDisk(fileToCopy.SourceFilename, fileToCopy.TargetFilePath);\r\n\r\n                // Searching for static IData interfaces\r\n                string targetFilePath = fileToCopy.TargetFilePath;\r\n\r\n                if (targetFilePath.StartsWith(Path.Combine(PathUtil.BaseDirectory, \"Bin\"), StringComparison.InvariantCultureIgnoreCase)\r\n                    && targetFilePath.EndsWith(\".dll\", StringComparison.InvariantCultureIgnoreCase))\r\n                {\r\n                    LoadDataTypesFromDll(targetFilePath);\r\n                }\r\n\r\n                var fileElement = new XElement(\"File\", new XAttribute(\"filename\", fileToCopy.TargetRelativeFilePath));\r\n\r\n                if (backupFileName != null)\r\n                {\r\n                    fileElement.Add(new XAttribute(\"backupFile\", backupFileName));\r\n                }\r\n\r\n                fileElements.Add(fileElement);\r\n            }\r\n\r\n            yield return new XElement(\"Files\", fileElements);\r\n        }\r\n\r\n        private void LoadDataTypesFromDll(string filePath)\r\n        {\r\n            string fileName = Path.GetFileName(filePath);\r\n\r\n            if (DllsNotToLoad.Any(fileName.StartsWith)) return;\r\n\r\n            var assembly = PackageAssemblyHandler.TryGetAlreadyLoadedAssembly(filePath);\r\n\r\n            if(assembly == null)\r\n            {\r\n                try\r\n                {\r\n                    assembly = Assembly.LoadFrom(filePath);\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    return;\r\n                }\r\n            }\r\n\r\n            DataTypeTypesManager.AddNewAssembly(assembly, false);\r\n        }\r\n\r\n        private string GetBackupFileName(string targetFilePath)\r\n        {\r\n            string fileName = Path.GetFileName(targetFilePath);\r\n            string directory = targetFilePath.Substring(0, targetFilePath.Length - fileName.Length);\r\n\r\n\r\n            return directory.GetHashCode() + \"_\" + fileName;\r\n        }\r\n\r\n\r\n        private sealed class FileToCopy\r\n        {\r\n            public string SourceFilename { get; set; }\r\n            public string TargetRelativeFilePath { get; set; }\r\n            public string TargetFilePath { get; set; }\r\n            public bool Overwrite { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/FilePackageFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FilePackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        private string LogTitle { get { return this.GetType().Name; } }\r\n\r\n        private List<string> _filesToDelete;\r\n        private List<Tuple<string, string>> _filesToCopy;\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Files\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.FilePackageFragmentUninstaller_OnlyOneFilesElement, ConfigurationParent);\r\n                return validationResult;\r\n            }\r\n\r\n            XElement filesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Files\");\r\n            \r\n\r\n            _filesToDelete = new List<string>();\r\n            _filesToCopy = new List<Tuple<string, string>>();\r\n\r\n            //  NOTE: Packages, that were installed on version earlier than C1 1.2 SP3 have absolute file path references, f.e.:\r\n            //  <File filename=\"C:\\inetpub\\docs\\Frontend\\Composite\\Forms\\Renderer\\CaptchaImageCreator.ashx\" />\r\n            //  <File filename=\"C:\\inetpub\\docs\\Frontend\\Composite\\Forms\\Renderer\\Controls/FormsRender.ascx\" />\r\n            //  <File filename=\"C:\\inetpub\\docs\\Frontend\\Composite\\Forms\\Renderer\\Controls/FormsRender.ascx.cs\" />\r\n            List<string> absoluteReferences = new List<string>();\r\n\r\n            if (filesElement != null)\r\n            {\r\n                foreach (XElement fileElement in filesElement.Elements(\"File\").Reverse())\r\n                {\r\n                    XAttribute filenameAttribute = fileElement.Attribute(\"filename\");\r\n                    if (filenameAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_MissingAttribute(\"filename\"), fileElement);\r\n                        continue;\r\n                    }\r\n\r\n                    string filePath = filenameAttribute.Value;\r\n                    if (filePath.Contains(\":\\\\\"))\r\n                    {\r\n                        absoluteReferences.Add(filePath);\r\n                        continue;\r\n                    }\r\n                    \r\n                    filePath = PathUtil.Resolve(filePath);\r\n\r\n                    string backupFile = (string) fileElement.Attribute(\"backupFile\");\r\n\r\n                    if (backupFile != null)\r\n                    {\r\n                        var backupFilePath = Path.Combine(UninstallerContext.PackageDirectory, \"FileBackup\", backupFile);\r\n                        if (!C1File.Exists(backupFilePath))\r\n                        {\r\n                            validationResult.AddFatal(\"Missing backup file '{0}'\".FormatWith(backupFilePath), fileElement);\r\n                            continue;\r\n                        }\r\n\r\n                        _filesToCopy.Add(new Tuple<string, string>(backupFilePath, filePath));\r\n                    }\r\n                    else\r\n                    {\r\n                        _filesToDelete.Add(filePath);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if(absoluteReferences.Count > 0)\r\n            {\r\n                // Trying to resolve what was the old absolute path.\r\n                // To do that the longest common beginning is calculated\r\n\r\n                string longestCommonBegining;\r\n\r\n                string firstPath = absoluteReferences[0];\r\n\r\n                if (absoluteReferences.Count == 1)\r\n                {\r\n                    longestCommonBegining = firstPath;\r\n                }\r\n                else\r\n                {\r\n                    int shortestPathLength = absoluteReferences.Min(path => path.Length);\r\n\r\n                    int commonStartLength = 0;\r\n                    for (; commonStartLength < shortestPathLength; commonStartLength++)\r\n                    {\r\n                        bool match = true;\r\n                        char symbol = firstPath[commonStartLength];\r\n                        for (int i = 1; i < absoluteReferences.Count; i++)\r\n                        {\r\n                            if (absoluteReferences[i][commonStartLength] != symbol)\r\n                            {\r\n                                match = false;\r\n                                break;\r\n                            }\r\n                        }\r\n                        if (!match) break;\r\n                    }\r\n\r\n                    longestCommonBegining = firstPath.Substring(0, commonStartLength);\r\n                }\r\n\r\n                longestCommonBegining = longestCommonBegining.Replace('/', '\\\\');\r\n\r\n                if(!longestCommonBegining.EndsWith(\"\\\\\"))\r\n                {\r\n                    longestCommonBegining = longestCommonBegining.Substring(0, longestCommonBegining.LastIndexOf(\"\\\\\", StringComparison.Ordinal) + 1);\r\n                }\r\n\r\n                string newRoot = PathUtil.BaseDirectory;\r\n                if(!newRoot.EndsWith(\"\\\\\"))\r\n                {\r\n                    newRoot += \"\\\\\";\r\n                }\r\n\r\n                // If the site hasn't been moved to another folder, just using the pathes\r\n                if (longestCommonBegining.StartsWith(newRoot, StringComparison.OrdinalIgnoreCase))\r\n                {\r\n                    _filesToDelete.AddRange(absoluteReferences);\r\n                }\r\n                else\r\n                {\r\n                    // If the longest common path looks like C:\\inetpub\\docs\\Frontend\\Composite\\\r\n                    // than we will the following pathes as site roots:\r\n                    //\r\n                    // C:\\inetpub\\docs\\Frontend\\Composite\\\r\n                    // C:\\inetpub\\docs\\Frontend\\\r\n                    // C:\\inetpub\\docs\\\r\n                    // C:\\inetpub\\\r\n                    // C:\\\r\n\r\n                    string oldRoot = longestCommonBegining;\r\n\r\n                    bool fileExists = false;\r\n                    while(!string.IsNullOrEmpty(oldRoot))\r\n                    {\r\n                        for(int i=0; i < absoluteReferences.Count; i++)\r\n                        {\r\n                            if(C1File.Exists(ReplaceFolder(absoluteReferences[0], oldRoot, newRoot)))\r\n                            {\r\n                                fileExists = true;\r\n                                break;\r\n                            }\r\n                        }\r\n                        if(fileExists) break;\r\n\r\n                        oldRoot = ReducePath(oldRoot);\r\n                    }\r\n\r\n                    if(!fileExists)\r\n                    {\r\n                        // Showing a message if we don't have a match\r\n                        validationResult.AddFatal(Texts.FilePackageFragmentInstaller_WrongBasePath);\r\n                    }\r\n                    else\r\n                    {\r\n                        _filesToDelete.AddRange(absoluteReferences.Select(path => ReplaceFolder(path, oldRoot, newRoot)));\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _filesToDelete = null;\r\n                _filesToCopy = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n\r\n        private static string ReplaceFolder(string filePath, string oldFolderPath, string newFolderPath)\r\n        {\r\n            return newFolderPath + filePath.Substring(oldFolderPath.Length);\r\n        }\r\n\r\n\r\n\r\n        private static string ReducePath(string path) \r\n        {\r\n            // C:\\A\\B\\ -> C:\\A\\\r\n            int offset = path.LastIndexOf('\\\\', path.Length - 2);\r\n            if(offset < 0) return null;\r\n            return path.Substring(0, offset + 1);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            Verify.IsNotNull(_filesToDelete as object ?? _filesToCopy, \"{0} has not been validated\", this.GetType().Name);\r\n\r\n            foreach (string filename in _filesToDelete)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Uninstalling the file '{0}'\", filename);\r\n\r\n                FileUtils.Delete(filename);\r\n            }\r\n\r\n            foreach (var fileToCopy in _filesToCopy)\r\n            {\r\n                string targetFile = fileToCopy.Item2;\r\n\r\n                Log.LogVerbose(LogTitle, \"Restoring file from a backup copy'{0}'\", targetFile);\r\n\r\n                if ((C1File.GetAttributes(targetFile) & FileAttributes.ReadOnly) > 0)\r\n                {\r\n                    FileUtils.RemoveReadOnly(targetFile);\r\n                }\r\n\r\n                C1File.Copy(fileToCopy.Item1, targetFile, true);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/FileXslTransformationPackageFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Xsl;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class FileXslTransformationPackageFragmentInstaller : BasePackageFragmentInstaller\r\n\t{\r\n        private static readonly string LogTitle = \"XsltPackageFragmentInstaller\";\r\n\r\n        internal static readonly string TargetXmlAttributeName = \"pathXml\";\r\n        internal static readonly string InputXmlAttributeName = \"inputXml\";\r\n        internal static readonly string OutputXmlAttributeName = \"outputXml\";\r\n\r\n        internal static readonly string TargetXslAttributeName = \"pathXsl\";\r\n        internal static readonly string InstallXslAttributeName = \"installXsl\";\r\n        internal static readonly string UninstallXslAttributeName = \"uninstallXsl\";\r\n\r\n        internal static readonly string SkipIfNotExistAttributeName = \"skipIfNotExist\";\r\n        internal static readonly string OverrideReadOnlyAttributeName = \"overrideReadOnly\";\r\n\r\n\t\tprivate List<XslTransformation> _xslTransformations;\r\n\r\n\r\n        /// <exclude />\r\n\t\tpublic override IEnumerable<PackageFragmentValidationResult> Validate()\r\n\t\t{\r\n            _xslTransformations = new List<XslTransformation>();\r\n\t\t\tvar validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            var filesElement = this.ConfigurationParent.GetSingleConfigurationElement(\"XslFiles\", validationResult, false);\r\n            if (filesElement == null)\r\n            {\r\n                return validationResult;\r\n            }\r\n\r\n            foreach (XElement fileElement in filesElement.GetConfigurationElements(\"XslFile\", validationResult))\r\n            {\r\n                XAttribute pathXMLAttribute = fileElement.Attribute(TargetXmlAttributeName);\r\n                XAttribute inputXMLAttribute = fileElement.Attribute(InputXmlAttributeName);\r\n                XAttribute outputXMLAttribute = fileElement.Attribute(OutputXmlAttributeName);\r\n\r\n                XAttribute pathXSLAttribute = fileElement.Attribute(TargetXslAttributeName);\r\n                XAttribute installXSLAttribute = fileElement.Attribute(InstallXslAttributeName);\r\n                XAttribute uninstallXSLAttribute = fileElement.Attribute(UninstallXslAttributeName);\r\n                XAttribute overrideReadOnlyAttribute = fileElement.Attribute(OverrideReadOnlyAttributeName);\r\n\r\n                XAttribute skipIfNotExistAttribute = fileElement.Attribute(SkipIfNotExistAttributeName);\r\n                bool skipIfNotExist = skipIfNotExistAttribute != null && skipIfNotExistAttribute.Value.ToLower() == \"true\";\r\n\r\n                if (pathXSLAttribute == null && installXSLAttribute == null)\r\n                {\r\n                    validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(TargetXmlAttributeName), fileElement);\r\n                    continue;\r\n                }\r\n\r\n                if (outputXMLAttribute != null && uninstallXSLAttribute != null)\r\n                {\r\n                    validationResult.AddFatal(\"Xsl installer does not suppurt simultaneous usage of attributes '{0}' and '{1}'\"\r\n                                                .FormatWith(OutputXmlAttributeName, UninstallXslAttributeName), fileElement);\r\n                    continue;\r\n                }\r\n\r\n                string xslFilePath = (pathXSLAttribute ?? installXSLAttribute).Value;\r\n\r\n\r\n                XslTransformation xslFile;\r\n                if (inputXMLAttribute != null)\r\n                {\r\n                    if (outputXMLAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(\"outputFilename\"), fileElement);\r\n                        continue;\r\n                    }\r\n\r\n                    xslFile = new XslTransformation\r\n                                    {\r\n                                        XslPath = xslFilePath,\r\n                                        InputXmlPath = inputXMLAttribute.Value,\r\n                                        OutputXmlPath = outputXMLAttribute.Value\r\n                                    };\r\n                }\r\n                else\r\n                {\r\n                    if (pathXMLAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(TargetXmlAttributeName), fileElement);\r\n                        continue;\r\n                    }\r\n\r\n                    string pathToXmlFile = pathXMLAttribute.Value;\r\n\r\n                    xslFile = new XslTransformation\r\n                                    {\r\n                                        XslPath = xslFilePath,\r\n                                        // UninstallXslPath = uninstallXSLAttribute != null ? uninstallXSLAttribute.Value : null,\r\n                                        InputXmlPath = pathToXmlFile,\r\n                                        OutputXmlPath = pathToXmlFile\r\n                                    };\r\n                }\r\n\r\n                if (!C1File.Exists(PathUtil.Resolve(xslFile.InputXmlPath)))\r\n                {\r\n                    if (skipIfNotExist) continue;\r\n\r\n                    validationResult.AddFatal(Texts.FileXslTransformationPackageFragmentInstaller_FileNotFound(xslFile.InputXmlPath), fileElement);\r\n                    continue;\r\n                }\r\n\r\n                string outputXmlFullPath = PathUtil.Resolve(xslFile.OutputXmlPath);\r\n                if (C1File.Exists(outputXmlFullPath) && (C1File.GetAttributes(outputXmlFullPath) & FileAttributes.ReadOnly) > 0)\r\n                {\r\n                    if (overrideReadOnlyAttribute == null || overrideReadOnlyAttribute.Value != \"true\")\r\n                    {\r\n                        validationResult.AddFatal(Texts.FileXslTransformationPackageFragmentInstaller_FileReadOnly(xslFile.OutputXmlPath), fileElement);\r\n                        continue;\r\n                    }\r\n                        \r\n                    FileUtils.RemoveReadOnly(outputXmlFullPath);\r\n                    Log.LogWarning(LogTitle, Texts.FileXslTransformationPackageFragmentInstaller_FileReadOnlyOverride(xslFile.OutputXmlPath));\r\n                }\r\n\r\n                if (!PathUtil.WritePermissionGranted(outputXmlFullPath))\r\n                {\r\n                    validationResult.AddFatal(Texts.NotEnoughNtfsPermissions(xslFile.OutputXmlPath), fileElement);\r\n                    continue;\r\n                }\r\n\r\n                _xslTransformations.Add(xslFile);\r\n            }\r\n\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _xslTransformations = null;\r\n            }\r\n            \r\n\r\n\t\t\treturn validationResult;\r\n\t\t}\r\n\r\n\r\n\r\n        /// <exclude />\r\n\t\tpublic override IEnumerable<XElement> Install()\r\n\t\t{\r\n            if (_xslTransformations == null) throw new InvalidOperationException(\"FileXslTransformationPackageFragmentInstaller has not been validated\");\r\n\r\n\t\t\tStream stream;\r\n\t\t\tforeach (XslTransformation xslfile in _xslTransformations)\r\n\t\t\t{\r\n\t\t\t\tstring messageFormat = xslfile.InputXmlPath == xslfile.OutputXmlPath ?\r\n\t\t\t\t\t\"Performing XSL-transformation. xml-file: '{1}'; xsl-file: '{0}'\"\r\n\t\t\t\t\t: \"Performing XSL-transformation. xsl-file: '{0}'; input xml file: '{1}'; output xml file: '{2}'\";\r\n\r\n                Log.LogVerbose(LogTitle, string.Format(messageFormat, xslfile.XslPath, xslfile.InputXmlPath, xslfile.OutputXmlPath));\r\n\r\n                string inputXml = PathUtil.Resolve(xslfile.InputXmlPath);\r\n                string outputXml = PathUtil.Resolve(xslfile.OutputXmlPath);\r\n\r\n                using (stream = this.InstallerContext.ZipFileSystem.GetFileStream(xslfile.XslPath))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar xslt = new XslCompiledTransform();\r\n\t\t\t\t\tusing (XmlReader xslReader = XmlReader.Create(stream))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\txslt.Load(xslReader);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar resultDocument = new XDocument();\r\n\t\t\t\t\tusing (XmlWriter writer = resultDocument.CreateWriter())\r\n\t\t\t\t\t{\r\n                        xslt.Transform(inputXml, writer);\r\n\t\t\t\t\t}\r\n\r\n                    resultDocument.SaveToFile(outputXml);\r\n\r\n                    Log.LogVerbose(LogTitle, resultDocument.ToString());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn new[] {  this.Configuration.FirstOrDefault() };\r\n\t\t}\r\n\r\n\r\n        private sealed class XslTransformation\r\n\t\t{\r\n            public string XslPath { get; set; }\r\n\t\t\tpublic string InputXmlPath { get; set; }\r\n\t\t\tpublic string OutputXmlPath { get; set; }\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/FileXslTransformationPackageFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Xsl;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\nusing Installer = Composite.Core.PackageSystem.PackageFragmentInstallers.FileXslTransformationPackageFragmentInstaller;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class FileXslTransformationPackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n\t{\r\n        private List<XslTransformation> _xsls;\r\n\r\n        /// <exclude />\r\n\t\tpublic override IEnumerable<PackageFragmentValidationResult> Validate()\r\n\t\t{\r\n            _xsls = new List<XslTransformation>();\r\n\t\t\tvar validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            var filesElement = this.ConfigurationParent.GetSingleConfigurationElement(\"XslFiles\", validationResult, false);\r\n            if (filesElement == null)\r\n            {\r\n                return validationResult;\r\n            }\r\n\r\n            foreach (XElement fileElement in filesElement.Elements(\"XslFile\"))\r\n            {\r\n                XAttribute pathXMLAttribute = fileElement.Attribute(Installer.TargetXmlAttributeName);\r\n                XAttribute pathXSLAttribute = fileElement.Attribute(Installer.UninstallXslAttributeName);\r\n\r\n                if (pathXMLAttribute == null)\r\n                {\r\n                    validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(Installer.TargetXmlAttributeName), fileElement);\r\n                    continue;\r\n                }\r\n\r\n                if (pathXSLAttribute == null)\r\n                {\r\n                    //if there isn no uninstall xsl\r\n                    continue;\r\n                }\r\n\r\n                string inputPathXMLAttributeValue = PathUtil.Resolve(pathXMLAttribute.Value);\r\n                string inpuPathXSLAttributeValue = pathXSLAttribute.Value;\r\n\r\n                _xsls.Add(new XslTransformation\r\n                {\r\n                    pathXml = inputPathXMLAttributeValue,\r\n                    pathXsl = inpuPathXSLAttributeValue\r\n                });\r\n            }\r\n            \r\n\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _xsls = null;\r\n            }\r\n\r\n\t\t\treturn validationResult;\r\n\t\t}\r\n\r\n\r\n        /// <exclude />\r\n\t\tpublic override void Uninstall()\r\n\t\t{\r\n            if (_xsls == null) throw new InvalidOperationException(\"FileXslTransformationPackageFragmentUninstaller has not been validated\");\r\n\r\n\t\t\tStream stream;\r\n            foreach (XslTransformation xslfile in _xsls)\r\n\t\t\t{\r\n                Log.LogVerbose(\"XsltPackageFragmentInstaller\",\r\n                    string.Format(\"Performing XSL-transformation. xml-file: '{0}'; xsl-file: '{1}'\", xslfile.pathXml, xslfile.pathXsl));\r\n\r\n\t\t\t    string xmlFilePath = PathUtil.Resolve(xslfile.pathXml);\r\n\r\n                using (stream = this.UninstallerContext.ZipFileSystem.GetFileStream(xslfile.pathXsl))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar xslt = new XslCompiledTransform();\r\n\t\t\t\t\tusing (XmlReader xslReader = XmlReader.Create(stream))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\txslt.Load(xslReader);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar resultDocument = new XDocument();\r\n\t\t\t\t\tusing (XmlWriter writer = resultDocument.CreateWriter())\r\n\t\t\t\t\t{\r\n                        xslt.Transform(xmlFilePath, writer);\r\n\t\t\t\t\t}\r\n\r\n                    resultDocument.SaveToFile(xmlFilePath);\r\n\r\n\t\t\t\t\tLog.LogVerbose(\"XsltTransformationResult\", resultDocument.ToString());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n        private sealed class XslTransformation\r\n        {\r\n            public string pathXml { get; set; }\r\n            public string pathXsl { get; set; }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/LocalePackageFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// Adds a content language to console. \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class LocalePackageFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private static readonly string LogTitle = typeof (LocalePackageFragmentInstaller).Name;\r\n\r\n        List<Tuple<CultureInfo, string, bool>> _localesToInstall;\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Locales\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.PackageFragmentInstaller_OnlyOneElementAllowed(\"Locales\"));\r\n                return validationResult;\r\n            }\r\n\r\n            XElement areasElement = this.Configuration.SingleOrDefault(f => f.Name == \"Locales\");\r\n\r\n            _localesToInstall = new List<Tuple<CultureInfo, string, bool>>();\r\n\r\n            if (areasElement != null)\r\n            {\r\n                foreach (XElement localeElement in areasElement.Elements(\"Locale\"))\r\n                {\r\n                    XAttribute nameAttribute = localeElement.Attribute(\"name\");\r\n                    XAttribute urlMappingNameAttribute = localeElement.Attribute(\"urlMappingName\");\r\n                    XAttribute defaultAttribute = localeElement.Attribute(\"default\");\r\n\r\n                    if (nameAttribute == null)\r\n                    {\r\n                        // Missing attribute\r\n                        validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(\"name\"), localeElement);\r\n                        continue;\r\n                    }\r\n\r\n                    CultureInfo cultureInfo;\r\n                    try\r\n                    {\r\n                        cultureInfo = CultureInfo.CreateSpecificCulture(nameAttribute.Value);\r\n                    }\r\n                    catch\r\n                    {\r\n                        // Name error\r\n                        validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(\"name\"), nameAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    if (LocalizationFacade.IsLocaleInstalled(cultureInfo))\r\n                    {\r\n                        continue; // Skip it, it is installed\r\n                    }\r\n\r\n                    if (_localesToInstall.Any(f => f.Item1.Equals(cultureInfo)))\r\n                    {\r\n                        // Already installed or going to be installed\r\n                        validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(\"name\"), nameAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    string urlMappingName = cultureInfo.Name;\r\n                    if (urlMappingNameAttribute != null)\r\n                    {\r\n                        urlMappingName = urlMappingNameAttribute.Value;\r\n                    }\r\n\r\n                    if (LocalizationFacade.IsUrlMappingNameInUse(urlMappingName) || _localesToInstall.Any(f => f.Item2 == urlMappingName))\r\n                    {\r\n                        // Url mapping name already used or going to be used\r\n                        validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(\"urlMappingName\"), urlMappingNameAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    bool isDefault = false;\r\n                    if (defaultAttribute != null)\r\n                    {\r\n                        if (!defaultAttribute.TryGetBoolValue(out isDefault))\r\n                        {\r\n                            // Wrong attribute value\r\n                            validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(\"default\"), defaultAttribute);\r\n                            continue;\r\n                        }\r\n                    }\r\n\r\n                    if (isDefault && _localesToInstall.Any(f => f.Item3))\r\n                    {\r\n                        // More than one is specified as default\r\n                        validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingAttribute(\"default\"), defaultAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    _localesToInstall.Add(new Tuple<CultureInfo, string, bool>(cultureInfo, urlMappingName, isDefault));\r\n\r\n                    this.InstallerContext.AddPendingLocale(cultureInfo);\r\n                }\r\n            }\r\n\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _localesToInstall = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            Verify.IsNotNull(_localesToInstall, typeof(LocalePackageFragmentInstaller).Name + \" has not been validated\");\r\n\r\n            XAttribute oldDefaultAttribute = null;\r\n            if (DataLocalizationFacade.DefaultLocalizationCulture != null)\r\n            {\r\n                oldDefaultAttribute = new XAttribute(\"oldDefault\", DataLocalizationFacade.DefaultLocalizationCulture.Name);\r\n            }\r\n            \r\n            var localeElements = new List<XElement>();\r\n\r\n            foreach (Tuple<CultureInfo, string, bool> tuple in _localesToInstall)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Adding the locale '{0}'\", tuple.Item1);\r\n\r\n                LocalizationFacade.AddLocale(tuple.Item1, tuple.Item2, true, false);\r\n\r\n                if (tuple.Item3)\r\n                {\r\n                    Log.LogVerbose(LogTitle, \"Setting new default locale to '{0}'\", tuple.Item1);\r\n\r\n                    LocalizationFacade.SetDefaultLocale(tuple.Item1);\r\n                }\r\n\r\n                localeElements.Add(new XElement(\"Locale\", new XAttribute(\"name\", tuple.Item1.Name)));\r\n            }\r\n\r\n            var element = new XElement(\"Locales\", localeElements);\r\n            \r\n            if (oldDefaultAttribute != null)\r\n            {\r\n                element.Add(oldDefaultAttribute);\r\n            }\r\n            \r\n            yield return element;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/LocalePackageFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing System.Globalization;\r\nusing Composite.Core.Localization;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class LocalePackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        private List<CultureInfo> _culturesToUninstall = null;\r\n        private CultureInfo _oldDefaultCultureInfo = null;\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            List<PackageFragmentValidationResult> validationResults = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"Locales\") > 1)\r\n            {\r\n                validationResults.AddFatal(GetText(\"VirtualElementProviderNodePackageFragmentUninstaller.OnlyOneElement\"));\r\n                return validationResults;\r\n            }\r\n\r\n            XElement localesElement = this.Configuration.SingleOrDefault(f => f.Name == \"Locales\");\r\n\r\n            _culturesToUninstall = new List<CultureInfo>();\r\n\r\n            if (localesElement != null)\r\n            {\r\n                XAttribute oldDefaultAttribute = localesElement.Attribute(\"oldDefault\");\r\n                if (oldDefaultAttribute != null)\r\n                {\r\n                    _oldDefaultCultureInfo = CultureInfo.CreateSpecificCulture(oldDefaultAttribute.Value);\r\n                }\r\n\r\n                foreach (XElement localeElement in localesElement.Elements(\"Locale\").Reverse())\r\n                {\r\n                    CultureInfo locale = CultureInfo.CreateSpecificCulture(localeElement.Attribute(\"name\").Value);\r\n\r\n                    if ((_oldDefaultCultureInfo == null) && (LocalizationFacade.IsDefaultLocale(locale)))\r\n                    {\r\n                        // Locale is default -> not possible to unintall\r\n                        validationResults.AddFatal(GetText(\"VirtualElementProviderNodePackageFragmentUninstaller.OnlyOneElement\"));\r\n                        continue;\r\n                    }\r\n\r\n                    if (LocalizationFacade.IsOnlyActiveLocaleForSomeUsers(locale))\r\n                    {\r\n                        // only active for the a user\r\n                        validationResults.AddFatal(GetText(\"VirtualElementProviderNodePackageFragmentUninstaller.OnlyOneElement\"));\r\n                        continue;\r\n                    }\r\n\r\n                    if (LocalizationFacade.IsLocaleInstalled(locale))\r\n                    {\r\n                        _culturesToUninstall.Add(locale);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            if (validationResults.Count > 0)\r\n            {\r\n                _culturesToUninstall = null;\r\n                _oldDefaultCultureInfo = null;\r\n            }\r\n\r\n            return validationResults;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            if (_oldDefaultCultureInfo != null)\r\n            {\r\n                Log.LogVerbose(\"LocalePackageFragmentUninstaller\", string.Format(\"Restoring default locale to '{0}'\", _oldDefaultCultureInfo));\r\n\r\n                LocalizationFacade.SetDefaultLocale(_oldDefaultCultureInfo);\r\n            }\r\n\r\n\r\n            foreach (CultureInfo locale in _culturesToUninstall.Reverse<CultureInfo>())\r\n            {\r\n                Log.LogVerbose(\"LocalePackageFragmentUninstaller\", string.Format(\"Removing the locale '{0}'\", locale));\r\n\r\n                LocalizationFacade.RemoveLocale(locale, false);\r\n            }\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return GetResourceString(stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/PackageFragmentValidationExtension.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <exclude />\r\n    public static class PackageFragmentValidationExtension\r\n    {\r\n        internal static void AddFatal(this IList<PackageFragmentValidationResult> validationResults, Exception exception)\r\n        {\r\n            validationResults.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, exception));\r\n        }\r\n\r\n        internal static void AddFatal(this IList<PackageFragmentValidationResult> validationResults, string message)\r\n        {\r\n            validationResults.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, message));\r\n        }\r\n\r\n        internal static void AddFatal(this IList<PackageFragmentValidationResult> validationResults, string message, XObject configurationObject)\r\n        {\r\n            validationResults.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, message, configurationObject));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a single configuration element. Elements other than the specified one will cause validation errors.\r\n        /// </summary>\r\n        internal static XElement GetSingleConfigurationElement(this XElement configurationElement,  string elementName, IList<PackageFragmentValidationResult> validationResult, bool required)\r\n        {\r\n            XElement result = null;\r\n\r\n            foreach (var element in configurationElement.Elements())\r\n            {\r\n                if (element.Name.LocalName != elementName)\r\n                {\r\n                    validationResult.AddFatal(Texts.PackageFragmentInstaller_IncorrectElement(element.Name.LocalName, elementName), element);\r\n                    continue;\r\n                }\r\n                 \r\n                if (result != null)\r\n                {\r\n                    validationResult.AddFatal(Texts.PackageFragmentInstaller_OnlyOneElementAllowed(elementName));\r\n                    return null;\r\n                }\r\n\r\n                result = element;\r\n            }\r\n\r\n            if (required && result == null)\r\n            {\r\n                validationResult.AddFatal(Texts.PackageFragmentInstaller_MissingElement(elementName));\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a child configuration elements. Elements with names other than the specified one will cause validation errors.\r\n        /// </summary>\r\n        internal static IEnumerable<XElement> GetConfigurationElements(this XElement configurationElement, string elementName, IList<PackageFragmentValidationResult> validationResult)\r\n        {\r\n            var result = new List<XElement>();\r\n\r\n            foreach (var element in configurationElement.Elements())\r\n            {\r\n                if (element.Name.LocalName != elementName)\r\n                {\r\n                    validationResult.AddFatal(Texts.PackageFragmentInstaller_IncorrectElement(element.Name.LocalName, elementName), element);\r\n                    continue;\r\n                }\r\n\r\n                result.Add(element);\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/PackageLicenseFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.PackageSystem.WebServiceClient;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>\r\n    /// Used for commercial packages distributed by Composite. \r\n    /// Checks if a valid license file is present, if not, requests a trial license from Composite server.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PackageLicenseFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private string _publicKeyXml;\r\n        private bool _licenseFileExists;\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            Guid packageId = this.InstallerContext.PackageInformation.Id;\r\n            if(LicenseDefinitionManager.GetLicenseDefinition(packageId) != null)\r\n            {\r\n                _licenseFileExists = true;\r\n                return validationResult;\r\n            }\r\n\r\n            XElement publicKeyElement = this.Configuration.SingleOrDefault(f => f.Name == \"RSAKeyValue\");\r\n            if (publicKeyElement == null)\r\n            {\r\n                validationResult.AddFatal(GetResourceString(\"PackageLicenseFragmentInstaller.MissingPublicKeyElement\"));\r\n                return validationResult;\r\n            }\r\n\r\n            _publicKeyXml = publicKeyElement.ToString();\r\n\r\n            string validated = LicenseServerFacade.ValidateTrialLicenseDefinitionRequest(InstallationInformationFacade.InstallationId, packageId, _publicKeyXml);\r\n\r\n            if (validated != \"OK\")\r\n            {\r\n                validationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, validated));\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            if(_licenseFileExists)\r\n            {\r\n                return new XElement[0];\r\n            }\r\n\r\n            LicenseDefinitionDescriptor descriptor = LicenseServerFacade.GetTrialLicenseDefinition(InstallationInformationFacade.InstallationId, this.InstallerContext.PackageInformation.Id, _publicKeyXml);\r\n\r\n            var definition = new PackageLicenseDefinition\r\n            {\r\n                ProductName = this.InstallerContext.PackageInformation.Name,\r\n                InstallationId = descriptor.InstallationId,\r\n                ProductId = descriptor.ProductId,                \r\n                LicenseFileName = \"\",\r\n                Permanent = descriptor.Permanent,                                \r\n                Expires = descriptor.Expires,\r\n                LicenseKey = descriptor.LicenseKey,\r\n                PurchaseUrl = descriptor.PurchaseUrl\r\n            };\r\n\r\n            LicenseDefinitionManager.StoreLicenseDefinition(definition);\r\n\r\n            return new XElement[] { };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/PackageLicenseFragmentUninstaller.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PackageLicenseFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            return new PackageFragmentValidationResult[] { };\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            PackageLicenseDefinition licenseDefinition = LicenseDefinitionManager.GetLicenseDefinition(this.UninstallerContext.PackageInformation.Id);\r\n            \r\n            if ((licenseDefinition != null) && (licenseDefinition.Permanent == false))\r\n            {\r\n                LicenseDefinitionManager.RemoveLicenseDefintion(this.UninstallerContext.PackageInformation.Id);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/PackageVersionBumperFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.Xml;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>\r\n    /// Updates the version number for an already installed package.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PackageVersionBumperFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private Dictionary<Guid, string> _packagesToBumb;\r\n\r\n        private Dictionary<Guid, string> _installedPackages;\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"PackageVersions\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_OnlyOneElement, this.ConfigurationParent);\r\n                return validationResult;\r\n            }            \r\n\r\n            XElement packageVersionsElement = this.Configuration.SingleOrDefault(f => f.Name == \"PackageVersions\");\r\n\r\n            _packagesToBumb = new Dictionary<Guid, string>();\r\n\r\n            if (packageVersionsElement != null)\r\n            {\r\n                foreach (XElement packageVersionElement in packageVersionsElement.Elements(\"PackageVersion\"))\r\n                {\r\n                    XAttribute packageIdAttribute = packageVersionElement.Attribute(\"packageId\");\r\n                    XAttribute newVersionAttribute = packageVersionElement.Attribute(\"newVersion\");\r\n\r\n                    if (packageIdAttribute == null) \r\n                    { \r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_MissingAttribute(\"packageId\"), packageVersionElement);\r\n                        continue; \r\n                    }\r\n                    if (newVersionAttribute == null) \r\n                    { \r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_MissingAttribute(\"newVersion\"), packageVersionElement); \r\n                        continue; \r\n                    }\r\n\r\n                    Guid packageId;\r\n                    if (!packageIdAttribute.TryGetGuidValue(out packageId))\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_WrongAttributeGuidFormat, packageIdAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    if (_packagesToBumb.ContainsKey(packageId))\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_PackageIdDuplicate(packageId), packageIdAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    Version version;\r\n                    try\r\n                    {\r\n                        version = new Version(newVersionAttribute.Value);\r\n                    }\r\n                    catch\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_WrongAttributeVersionFormat, newVersionAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    _packagesToBumb.Add(packageId, version.ToString());\r\n                }\r\n            }\r\n\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _packagesToBumb = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            Verify.IsNotNull(_packagesToBumb, this.GetType().Name + \" has not been validated\");\r\n\r\n            var installedElements = new List<XElement>();\r\n            foreach (var kvp in _packagesToBumb)\r\n            {\r\n                if (this.InstalledPackages.ContainsKey(kvp.Key))\r\n                {\r\n                    XDocument doc = XDocumentUtils.Load(this.InstalledPackages[kvp.Key]);\r\n\r\n                    XElement element = doc.Root;\r\n                    if (element == null) continue;\r\n\r\n                    XAttribute attribute = element.Attribute(PackageSystemSettings.VersionAttributeName);\r\n                    if (attribute == null) continue;\r\n\r\n                    installedElements.Add(\r\n                        new XElement(\"PackageVersion\",\r\n                            new XAttribute(\"packageId\", kvp.Key),\r\n                            new XAttribute(\"oldVersion\", attribute.Value))\r\n                    );\r\n\r\n                    attribute.Value = kvp.Value;\r\n\r\n                    doc.SaveToFile(this.InstalledPackages[kvp.Key]);\r\n                }\r\n            }\r\n\r\n            yield return new XElement(\"PackageVersions\", installedElements);\r\n        }\r\n\r\n\r\n\r\n        private Dictionary<Guid, string> InstalledPackages\r\n        {\r\n            get { return _installedPackages ?? (_installedPackages = GetInstalledPackages()); }\r\n        }\r\n\r\n        internal static Dictionary<Guid, string> GetInstalledPackages()\r\n        {\r\n            var result = new Dictionary<Guid, string>();\r\n\r\n            string baseDirectory = PathUtil.Resolve(GlobalSettingsFacade.PackageDirectory);\r\n\r\n            if (!C1Directory.Exists(baseDirectory)) return result;\r\n\r\n            string[] packageDirectories = C1Directory.GetDirectories(baseDirectory);\r\n            foreach (string packageDirecoty in packageDirectories)\r\n            {\r\n                if (C1File.Exists(Path.Combine(packageDirecoty, PackageSystemSettings.InstalledFilename)))\r\n                {\r\n                    string filename = Path.Combine(packageDirecoty, PackageSystemSettings.PackageInformationFilename);\r\n\r\n                    if (C1File.Exists(filename))\r\n                    {\r\n                        string path = packageDirecoty.Remove(0, baseDirectory.Length);\r\n                        if (path.StartsWith(\"\\\\\"))\r\n                        {\r\n                            path = path.Remove(0, 1);\r\n                        }\r\n\r\n                        Guid id = new Guid(path);\r\n\r\n                        result.Add(id, filename);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return GetResourceString(stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/PackageVersionBumperFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.Xml;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    class PackageVersionBumperFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        private Dictionary<Guid, string> _packageToRestore;\r\n\r\n        private Dictionary<Guid, string> _installedPackages;\r\n\r\n\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            var validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (this.Configuration.Count(f => f.Name == \"PackageVersions\") > 1)\r\n            {\r\n                validationResult.AddFatal(Texts.PackageVersionBumperFragmentInstaller_OnlyOneElement);\r\n                \r\n                return validationResult;\r\n            }\r\n\r\n            XElement packageVersionsElement = this.Configuration.SingleOrDefault(f => f.Name == \"PackageVersions\");\r\n\r\n            _packageToRestore = new Dictionary<Guid, string>();\r\n\r\n            if (packageVersionsElement != null)\r\n            {\r\n                foreach (XElement packageVersionElement in packageVersionsElement.Elements(\"PackageVersion\"))\r\n                {\r\n                    XAttribute packageIdAttribute = packageVersionElement.Attribute(\"packageId\");\r\n                    XAttribute oldVersionAttribute = packageVersionElement.Attribute(\"oldVersion\");\r\n\r\n                    if (packageIdAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_MissingAttribute(\"packageId\"), packageVersionElement); \r\n                        continue;\r\n                    }\r\n                    if (oldVersionAttribute == null)\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_MissingAttribute(\"newVersion\"), packageVersionElement); \r\n                        continue;\r\n                    }\r\n\r\n                    Guid packageId;\r\n                    if (!packageIdAttribute.TryGetGuidValue(out packageId))\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_WrongAttributeGuidFormat, packageIdAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    if (_packageToRestore.ContainsKey(packageId))\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_PackageIdDuplicate(packageId), packageIdAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    Version version;\r\n                    try\r\n                    {\r\n                        version = new Version(oldVersionAttribute.Value);\r\n                    }\r\n                    catch\r\n                    {\r\n                        validationResult.AddFatal(Texts.PackageVersionBumperFragmentUninstaller_WrongAttributeVersionFormat, oldVersionAttribute);\r\n                        continue;\r\n                    }\r\n\r\n                    _packageToRestore.Add(packageId, version.ToString());\r\n                }\r\n            }\r\n\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                _packageToRestore = null;\r\n                _installedPackages = null;\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n\r\n        public override void Uninstall()\r\n        {\r\n            foreach (var kvp in _packageToRestore.Reverse())\r\n            {\r\n                if (this.InstalledPackages.ContainsKey(kvp.Key))\r\n                {\r\n                    XDocument doc = XDocumentUtils.Load(this.InstalledPackages[kvp.Key]);\r\n\r\n                    XElement element = doc.Root;\r\n                    if (element == null) continue;\r\n\r\n                    XAttribute attribute = element.Attribute(PackageSystemSettings.VersionAttributeName);\r\n                    if (attribute == null) continue;                   \r\n\r\n                    attribute.Value = kvp.Value;\r\n\r\n                    doc.SaveToFile(this.InstalledPackages[kvp.Key]);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private Dictionary<Guid, string> InstalledPackages\r\n        {\r\n            get \r\n            {\r\n                return _installedPackages ?? (_installedPackages = PackageVersionBumperFragmentInstaller.GetInstalledPackages());\r\n            }\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return GetResourceString(stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/UserGroupUserAdderFragmentInstaller.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// Adds all the users to the specified user group. Assign language permissions to those groups. Used in starter site packages.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class UserGroupUserAdderFragmentInstaller : BasePackageFragmentInstaller\r\n    {\r\n        private readonly List<string> _names = new List<string>();\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            XElement usergroupNamesElement = this.Configuration.FirstOrDefault(f => f.Name == \"UsergroupNames\");\r\n            if (usergroupNamesElement == null) yield break;\r\n\r\n            foreach (XElement usergroupNameElement in usergroupNamesElement.Elements(\"UsergroupName\"))\r\n            {\r\n                XAttribute nameAttribute = usergroupNameElement.Attribute(\"Name\");\r\n                if (nameAttribute == null) continue;\r\n\r\n                _names.Add(nameAttribute.Value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<XElement> Install()\r\n        {\r\n            foreach (string usergroupName in _names)\r\n            {\r\n                IUserGroup userGroup = DataFacade.GetData<IUserGroup>().SingleOrDefault(f => f.Name == usergroupName);\r\n                if (userGroup == null) continue;\r\n\r\n                IEnumerable<IUser> users = DataFacade.GetData<IUser>().Evaluate();\r\n\r\n                foreach (IUser user in users)\r\n                {\r\n                    var userUserGroupRelation = DataFacade.BuildNew<IUserUserGroupRelation>();\r\n                    userUserGroupRelation.UserId = user.Id;\r\n                    userUserGroupRelation.UserGroupId = userGroup.Id;\r\n                    DataFacade.AddNew<IUserUserGroupRelation>(userUserGroupRelation);\r\n                }\r\n\r\n                foreach (var cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n                {\r\n                    var userGroupActiveLocale = DataFacade.BuildNew<IUserGroupActiveLocale>();\r\n                    userGroupActiveLocale.UserGroupId = userGroup.Id;\r\n                    userGroupActiveLocale.CultureName = cultureInfo.Name;\r\n                    DataFacade.AddNew<IUserGroupActiveLocale>(userGroupActiveLocale);\r\n                }\r\n            }\r\n\r\n            yield break;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/UserGroupUserAdderFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class UserGroupUserAdderFragmentUninstaller : BasePackageFragmentUninstaller\r\n    {\r\n        /// <exclude />\r\n        public override IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        /// <exclude />\r\n        public override void Uninstall()\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/XmlFileMergePackageFragmentInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n\t/// <summary>\r\n    /// Merges 2 xml files. New child elements and new attibutes are imported to the source. Conflicts are ignored (not merged).\r\n    /// Used for applying changes to config files.\r\n\t/// </summary>\r\n\t/// <exclude />\r\n\t[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n\tpublic class XmlFileMergePackageFragmentInstaller : BasePackageFragmentInstaller\r\n\t{\r\n\r\n\t\tinternal static readonly string mergeContainerElementName = \"XmlFileMerges\";\r\n\t\tinternal static readonly string mergeElementName = \"XmlFileMerge\";\r\n\t\tinternal static readonly string changeDefFileAttributeName = \"changeDefinitionPath\";\r\n\t\tinternal static readonly string targetFileAttributeName = \"targetFilePath\";\r\n\r\n\r\n\t\tprivate sealed class XmlFileMerge\r\n\t\t{\r\n\t\t\tpublic string ChangeFilePath { get; set; }\r\n\t\t\tpublic string TargetPath { get; set; }\r\n\t\t}\r\n\r\n\t\tprivate IList<XmlFileMerge> _xmlFileMerges;\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override IEnumerable<XElement> Install()\r\n\t\t{\r\n            Verify.IsNotNull(_xmlFileMerges, \"XmlFileMergePackageFragmentInstaller has not been validated\");\r\n\r\n\t\t\tforeach (XmlFileMerge xmlFileMerge in _xmlFileMerges)\r\n\t\t\t{\r\n\t\t\t\tstring targetXmlFile = PathUtil.Resolve(xmlFileMerge.TargetPath);\r\n\r\n\t\t\t\tusing (Stream stream = this.InstallerContext.ZipFileSystem.GetFileStream(xmlFileMerge.ChangeFilePath))\r\n\t\t\t\t{\r\n\t\t\t\t\tXElement source = XElement.Load(stream);\r\n\t\t\t\t\tXDocument target = XDocumentUtils.Load(targetXmlFile);\r\n\r\n\t\t\t\t\ttarget.Root.ImportSubtree(source);\r\n\t\t\t\t\ttarget.SaveToFile(targetXmlFile);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn new[] { this.Configuration.FirstOrDefault() };\r\n\t\t}\r\n\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override IEnumerable<PackageFragmentValidationResult> Validate()\r\n\t\t{\r\n\t\t\tvar validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n\t\t\tif (Configuration.Count(f => f.Name == XmlFileMergePackageFragmentInstaller.mergeContainerElementName) > 1)\r\n\t\t\t{\r\n\t\t\t\tvalidationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, \"OnlyOneFilesElement\"));\r\n\r\n\t\t\t\treturn validationResult;\r\n\t\t\t}\r\n\r\n\t\t\tIEnumerable<XElement> filesElement = this.Configuration.Where(f => f.Name == XmlFileMergePackageFragmentInstaller.mergeContainerElementName);\r\n\r\n\t\t\t_xmlFileMerges = new List<XmlFileMerge>();\r\n\r\n\t\t\tforeach (XElement fileElement in filesElement.Elements(mergeElementName))\r\n\t\t\t{\r\n\t\t\t    XAttribute sourceAttribute;\r\n\t\t\t    XAttribute targetAttribute;\r\n\r\n                if(!GetAttributeNotNull(fileElement, XmlFileMergePackageFragmentInstaller.changeDefFileAttributeName, validationResult, out sourceAttribute)\r\n                   || !GetAttributeNotNull(fileElement, XmlFileMergePackageFragmentInstaller.targetFileAttributeName, validationResult, out targetAttribute))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar xmlFileMerge = new XmlFileMerge\r\n\t\t\t\t{\r\n\t\t\t\t\tChangeFilePath = sourceAttribute.Value,\r\n\t\t\t\t\tTargetPath = targetAttribute.Value\r\n\t\t\t\t};\r\n\r\n\r\n\t\t\t    string filePath = PathUtil.Resolve(xmlFileMerge.TargetPath);\r\n                if (!C1File.Exists(filePath))\r\n\t\t\t\t{\r\n                    validationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, \"File '{0}' not found\".FormatWith(filePath), fileElement));\r\n\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_xmlFileMerges.Add(xmlFileMerge);\r\n\t\t\t}\r\n\r\n\t\t\tif (validationResult.Count > 0)\r\n\t\t\t{\r\n\t\t\t\t_xmlFileMerges = null;\r\n\t\t\t}\r\n\r\n\t\t\treturn validationResult;\r\n\t\t}\r\n\r\n        private static bool GetAttributeNotNull(XElement element, string attributeName, List<PackageFragmentValidationResult> validationSummary, out XAttribute attribute)\r\n        {\r\n            attribute = element.Attribute(attributeName);\r\n\r\n            if (attribute != null) return true;\r\n\r\n            validationSummary.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, \r\n                \"MissingAttribute '{0}'. XPath: '{1}' \".FormatWith(attributeName, element.GetXPath())));\r\n\r\n            return false;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentInstallers/XmlFileMergePackageFragmentUninstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Core.PackageSystem.PackageFragmentInstallers\r\n{\r\n\t/// <summary>\r\n\t/// </summary>\r\n\t/// <exclude />\r\n\t[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n\tpublic class XmlFileMergePackageFragmentUninstaller : BasePackageFragmentUninstaller\r\n\t{\r\n\t\tprivate sealed class XmlFileMerge\r\n\t\t{\r\n\t\t\tpublic string ChangeFilePath { get; set; }\r\n\t\t\tpublic string TargetPath { get; set; }\r\n\t\t}\r\n\r\n\t\tprivate IList<XmlFileMerge> _xmlFileMerges;\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void Uninstall()\r\n\t\t{\r\n\t\t\tif (_xmlFileMerges == null) throw new InvalidOperationException(\"XmlFileMergePackageFragmentUninstaller has not been validated\");\r\n\r\n\t\t\tforeach (XmlFileMerge xmlFileMerge in _xmlFileMerges)\r\n\t\t\t{\r\n\t\t\t\tstring targetXml = PathUtil.Resolve(xmlFileMerge.TargetPath);\r\n\r\n\t\t\t\tusing (Stream stream = this.UninstallerContext.ZipFileSystem.GetFileStream(xmlFileMerge.ChangeFilePath))\r\n\t\t\t\t{\r\n\t\t\t\t\tXElement source = XElement.Load(stream);\r\n\t\t\t\t\tXDocument target = XDocumentUtils.Load(targetXml);\r\n\r\n\t\t\t\t\ttarget.Root.RemoveMatches(source);\r\n\t\t\t\t\ttarget.SaveToFile(targetXml);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override IEnumerable<PackageFragmentValidationResult> Validate()\r\n\t\t{\r\n\t\t\tList<PackageFragmentValidationResult> validationResult = new List<PackageFragmentValidationResult>();\r\n\r\n\t\t\tif (Configuration.Count(f => f.Name == XmlFileMergePackageFragmentInstaller.mergeContainerElementName) > 1)\r\n\t\t\t{\r\n\t\t\t\tvalidationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, \"OnlyOneFilesElement\"));\r\n\r\n\t\t\t\treturn validationResult;\r\n\t\t\t}\r\n\r\n\t\t\tIEnumerable<XElement> filesElement = this.Configuration.Where(f => f.Name == XmlFileMergePackageFragmentInstaller.mergeContainerElementName);\r\n\r\n\t\t\t_xmlFileMerges = new List<XmlFileMerge>();\r\n\r\n\t\t\tforeach (var fileElement in filesElement.Elements(XmlFileMergePackageFragmentInstaller.mergeElementName))\r\n\t\t\t{\r\n\t\t\t\tXAttribute changePathAttribute = fileElement.Attribute(XmlFileMergePackageFragmentInstaller.changeDefFileAttributeName);\r\n\t\t\t\tXAttribute targetAttribute = fileElement.Attribute(XmlFileMergePackageFragmentInstaller.targetFileAttributeName);\r\n\r\n\t\t\t\tif (changePathAttribute == null || targetAttribute == null)\r\n\t\t\t\t{\r\n\t\t\t\t\tvalidationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, \"MissingAttribute\", fileElement));\r\n\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tXmlFileMerge xmlFileMerge = new XmlFileMerge\r\n\t\t\t\t{\r\n\t\t\t\t\tChangeFilePath = changePathAttribute.Value,\r\n\t\t\t\t\tTargetPath = targetAttribute.Value\r\n\t\t\t\t};\r\n\r\n\t\t\t\tif (!C1File.Exists(PathUtil.Resolve(xmlFileMerge.TargetPath)))\r\n\t\t\t\t{\r\n\t\t\t\t\tvalidationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, \"FileNotFound\", fileElement));\r\n\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_xmlFileMerges.Add(xmlFileMerge);\r\n\t\t\t}\r\n\r\n\t\t\tif (validationResult.Count > 0)\r\n\t\t\t{\r\n\t\t\t\t_xmlFileMerges = null;\r\n\t\t\t}\r\n\r\n\t\t\treturn validationResult;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentValidationResult.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"ValidationResult = {ValidationResult}, Message = {Message}\")]\r\n\tpublic sealed class PackageFragmentValidationResult\r\n\t{\r\n        /// <exclude />\r\n        public PackageFragmentValidationResult(PackageFragmentValidationResultType validationResult, Exception exception)\r\n        {\r\n            Verify.ArgumentNotNull(exception, \"exception\");\r\n\r\n            if (exception is TargetInvocationException)\r\n            {\r\n                exception = exception.InnerException;\r\n            }\r\n\r\n            this.ValidationResult = validationResult;\r\n            this.Message = exception.Message;\r\n            this.Exception = exception;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public PackageFragmentValidationResult(PackageFragmentValidationResultType validationResult, string message)\r\n            : this(validationResult, message, null)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public PackageFragmentValidationResult(PackageFragmentValidationResultType validationResult, string message, XObject configurationObject)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(message, \"message\");\r\n\r\n            this.ValidationResult = validationResult;\r\n            this.Message = message;\r\n\r\n            if (configurationObject != null)\r\n            {\r\n                this.XPath = configurationObject.GetXPath();\r\n            }\r\n\r\n            this.Message = message;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PackageFragmentValidationResultType ValidationResult { get; private set; }\r\n\r\n        /// <exclude />\r\n        public string Message { get; private set; }\r\n\r\n        /// <exclude />\r\n        public Exception Exception { get; private set; }\r\n\r\n        /// <exclude />\r\n        public string XPath { get; private set; }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<PackageFragmentValidationResult> InnerResult { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageFragmentValidationResultType.cs",
    "content": "﻿namespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic enum PackageFragmentValidationResultType\r\n\t{\r\n        /// <exclude />\r\n        Fatal \r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageInformation.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core.PackageSystem.Foundation;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PackageInformation\r\n    {\r\n        /// <exclude />\r\n        public Guid Id { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public string GroupName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Author { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Website { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Description { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Version { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool CanBeUninstalled { get; set; }\r\n\r\n        /// <exclude />\r\n        public SystemLockingType SystemLockingType { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool FlushOnCompletion { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool ReloadConsoleOnCompletion { get; set; }\r\n\r\n        /// <exclude />\r\n        public Version MaxCompositeVersionSupported { get; set; }\r\n\r\n        /// <exclude />\r\n        public Version MinCompositeVersionSupported { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Zip;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.PackageSystem.PackageFragmentInstallers;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.Transactions;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PackageInstaller : IPackageInstaller\r\n    {\r\n        private static readonly string LogTitle = \"PackageInstaller\";\r\n\r\n        private bool _isInitialized = false;\r\n        private PackageInstallerContext _packageInstallerContex;\r\n        // IPackageFragmentInstaller -> uninstall type, null is allowed\r\n        private Dictionary<IPackageFragmentInstaller, Type> _packageFramentInstallers = new Dictionary<IPackageFragmentInstaller, Type>();\r\n\r\n        private IPackageInstallerUninstallerFactory PackageInstallerUninstallerFactory { get; set; }\r\n        private string ZipFilename { get; set; }\r\n        private string PackageInstallDirectory { get; set; }\r\n        private string TempDirectory { get; set; }\r\n        private PackageInformation PackageInformation { get; set; }\r\n\r\n        /// <exclude />\r\n        internal static event Action OnPackageInstallation;\r\n\r\n\r\n        /// <exclude />\r\n        public PackageInstaller(IPackageInstallerUninstallerFactory packageInstallerUninstallerFactory, string zipFilename, string packageInstallDirectory, string tempDirectory, PackageInformation packageInformation)\r\n        {\r\n            if (packageInstallerUninstallerFactory == null) throw new ArgumentNullException(\"packageInstallerUninstallerFactory\");\r\n            if (string.IsNullOrEmpty(zipFilename)) throw new ArgumentNullException(\"zipFilename\");\r\n            if (string.IsNullOrEmpty(packageInstallDirectory)) throw new ArgumentNullException(\"packageInstallDirectory\");\r\n            if (string.IsNullOrEmpty(tempDirectory)) throw new ArgumentNullException(\"tempDirectory\");\r\n            if (packageInformation == null) throw new ArgumentNullException(\"packageInformation\");\r\n\r\n            this.PackageInstallerUninstallerFactory = packageInstallerUninstallerFactory;\r\n            this.ZipFilename = zipFilename;\r\n            this.PackageInstallDirectory = packageInstallDirectory;\r\n            this.TempDirectory = tempDirectory;\r\n            this.PackageInformation = packageInformation;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool CanBeUninstalled { get { return this.PackageInformation.CanBeUninstalled; } }\r\n\r\n        /// <exclude />\r\n        public bool FlushOnCompletion { get { return this.PackageInformation.FlushOnCompletion; } }\r\n\r\n        /// <exclude />\r\n        public bool ReloadConsoleOnCompletion { get { return this.PackageInformation.ReloadConsoleOnCompletion; } }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            List<PackageFragmentValidationResult> validationResult = Initialize().ToList();\r\n            if (validationResult.Count > 0)\r\n            {\r\n                return validationResult;\r\n            }\r\n\r\n            foreach (IPackageFragmentInstaller packageFragmentInstaller in _packageFramentInstallers.Keys)\r\n            {\r\n                List<PackageFragmentValidationResult> result = null;\r\n                try\r\n                {\r\n                    result = packageFragmentInstaller.Validate().ToList();\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    validationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex));\r\n                }\r\n\r\n                if (result != null)\r\n                {\r\n                    validationResult.AddRange(result);\r\n                }\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public PackageFragmentValidationResult Install(SystemLockingType systemLockingType)\r\n        {\r\n            try\r\n            {\r\n                using (GlobalInitializerFacade.CoreLockScope)\r\n                {\r\n                    var onPackageInstallation = OnPackageInstallation;\r\n                    if (onPackageInstallation != null)\r\n                    {\r\n                        onPackageInstallation();\r\n                    }\r\n\r\n                    if (systemLockingType == SystemLockingType.None \r\n                        || !ApplicationOnlineHandlerFacade.IsApplicationOnline\r\n                        || SystemSetupFacade.SetupIsRunning)\r\n                    {\r\n                        return DoInstall();\r\n                    }\r\n\r\n                    bool isSoftSystemLocking = systemLockingType == SystemLockingType.Soft;\r\n\r\n                    string errorMessage;\r\n                    if(!ApplicationOnlineHandlerFacade.CanPutApplicationOffline(isSoftSystemLocking, out errorMessage))\r\n                    {\r\n                        return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, errorMessage);\r\n                    }\r\n\r\n                    using (ApplicationOnlineHandlerFacade.TurnOffScope(isSoftSystemLocking))\r\n                    {\r\n                        return DoInstall();\r\n                    }\r\n                    \r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private PackageFragmentValidationResult DoInstall()\r\n        {\r\n            using (var transactionScope = TransactionsFacade.Create(true, TimeSpan.FromMinutes(30.0)))\r\n            {\r\n                string uninstallFilename = Path.Combine(this.PackageInstallDirectory,\r\n                                                        PackageSystemSettings.UninstallFilename);\r\n\r\n                Exception installException = null;\r\n                XElement uninstallElements =\r\n                    new XElement(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace,\r\n                                                   PackageSystemSettings.PackageFragmentUninstallersElementName));\r\n                try\r\n                {\r\n                    foreach (var kvp in _packageFramentInstallers)\r\n                    {\r\n                        List<XElement> uninstallInformation = kvp.Key.Install().ToList();\r\n\r\n                        if (this.CanBeUninstalled)\r\n                        {\r\n                            XElement uninstallElement =\r\n                                new XElement(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace,\r\n                                                               PackageSystemSettings.\r\n                                                                   PackageFragmentUninstallersAddElementName));\r\n                            uninstallElement.Add(new XAttribute(PackageSystemSettings.UninstallerTypeAttributeName,\r\n                                                                TypeManager.SerializeType(kvp.Value)));\r\n                            uninstallElement.Add(uninstallInformation);\r\n\r\n                            uninstallElements.Add(uninstallElement);\r\n                        }\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    installException = ex;\r\n                    LoggingService.LogError(\"Package installation failed\", ex);\r\n                }\r\n                finally\r\n                {\r\n                    if (this.CanBeUninstalled)\r\n                    {\r\n                        XDocument doc =\r\n                            new XDocument(\r\n                                new XElement(\r\n                                    XmlUtils.GetXName(PackageSystemSettings.XmlNamespace,\r\n                                                      PackageSystemSettings.PackageInstallerElementName),\r\n                                    uninstallElements));\r\n                        doc.SaveToFile(uninstallFilename);\r\n                    }\r\n                }\r\n\r\n\r\n                if (installException != null)\r\n                {\r\n                    if (this.CanBeUninstalled)\r\n                    {\r\n                        IPackageUninstaller packageUninstaller =\r\n                            this.PackageInstallerUninstallerFactory.CreateUninstaller(\r\n                                this.ZipFilename, uninstallFilename,\r\n                                this.PackageInstallDirectory,\r\n                                TempDirectoryFacade.\r\n                                CreateTempDirectory(),\r\n                                this.FlushOnCompletion,\r\n                                this.ReloadConsoleOnCompletion,\r\n                                false, \r\n                                this.PackageInformation);\r\n\r\n                        List<PackageFragmentValidationResult> validationResult = null;\r\n                        try\r\n                        {\r\n                            validationResult = packageUninstaller.Validate().ToList();\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex);\r\n                        }\r\n\r\n\r\n                        if (validationResult.Count == 0)\r\n                        {\r\n                            try\r\n                            {\r\n                                packageUninstaller.Uninstall(SystemLockingType.None);\r\n                            }\r\n                            catch (Exception ex)\r\n                            {\r\n                                return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex);\r\n                            }\r\n                        }\r\n                        else\r\n                        {\r\n                            LoggingService.LogError(LogTitle, \"Failed to perform installation rollback.\");\r\n                            foreach(var valResult in validationResult)\r\n                            {\r\n                                if(valResult.Exception != null)\r\n                                {\r\n                                    LoggingService.LogError(LogTitle, new InvalidOperationException(valResult.Message ?? string.Empty, valResult.Exception));\r\n                                }\r\n                                else\r\n                                {\r\n                                    LoggingService.LogWarning(LogTitle,  valResult.Message);\r\n                                }\r\n                            }\r\n\r\n                            return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal,\r\n                                                                       \"Could not perform installation rollback. The details are in the log.\")\r\n                                       {InnerResult = validationResult};\r\n                        }\r\n                    }\r\n\r\n                    return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal,\r\n                                                               installException);\r\n                }\r\n                transactionScope.Complete();\r\n            }\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<PackageFragmentValidationResult> Initialize()\r\n        {\r\n            if (_isInitialized) throw new InvalidOperationException(\"Initialize() may only be called once\");\r\n            _isInitialized = true;\r\n\r\n            Exception exception = null;\r\n            try\r\n            {\r\n                _packageInstallerContex = new PackageInstallerContext(new ZipFileSystem(this.ZipFilename), this.PackageInstallDirectory, this.TempDirectory, this.PackageInformation);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                exception = ex;\r\n            }\r\n            if (exception != null) return new [] { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, exception) };\r\n\r\n            PackageAssemblyHandler.ClearAssemblyList();\r\n\r\n            XElement installElement;\r\n            PackageFragmentValidationResult packageFragmentValidationResult = XmlHelper.LoadInstallXml(this.ZipFilename, out installElement);\r\n            if (packageFragmentValidationResult != null) return new [] { packageFragmentValidationResult };\r\n\r\n            XElement packageFragmentInstallerBinariesElement = installElement.Element(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageFragmentInstallerBinariesElementName));\r\n            if (packageFragmentInstallerBinariesElement != null)\r\n            {\r\n                List<PackageFragmentValidationResult> result1 = LoadPackageFragmentInstallerBinaries(packageFragmentInstallerBinariesElement).ToList();\r\n                if (result1.Count > 0) return result1;\r\n            }\r\n\r\n            XElement packageFragmentInstallersElement = installElement.Element(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageFragmentInstallersElementName));\r\n            if (packageFragmentInstallersElement == null) return new [] { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(\"The {0} file is wrongly formatted\", PackageSystemSettings.InstallFilename)) };\r\n\r\n            var result2 = LoadPackageFragmentInstallers(packageFragmentInstallersElement);\r\n            if (result2.Count > 0) return result2;\r\n\r\n            return new PackageFragmentValidationResult[] { };\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<PackageFragmentValidationResult> LoadPackageFragmentInstallerBinaries(XElement packageFragmentInstallerBinariesElement)\r\n        {\r\n            var binaryElements = packageFragmentInstallerBinariesElement.Elements(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace,\r\n                                        PackageSystemSettings.PackageFragmentInstallerBinariesAddElementName)).ToList();\r\n\r\n            if (!binaryElements.Any())\r\n            {\r\n                return new PackageFragmentValidationResult[0];\r\n            }\r\n\r\n            string binariesDirectory = Path.Combine(this.PackageInstallDirectory, PackageSystemSettings.BinariesDirectoryName);\r\n\r\n            if (!C1Directory.Exists(binariesDirectory))\r\n            {\r\n                C1Directory.CreateDirectory(binariesDirectory);\r\n            }\r\n\r\n            var result = new List<PackageFragmentValidationResult>();\r\n\r\n            foreach (XElement element in binaryElements)\r\n            {\r\n                XAttribute pathAttribute = element.Attribute(PackageSystemSettings.PathAttributeName);\r\n\r\n                string sourceFilename = pathAttribute.Value;\r\n                string targetFilename = Path.Combine(binariesDirectory, Path.GetFileName(sourceFilename));\r\n\r\n                ZipFileSystem zipFileSystem = new ZipFileSystem(this.ZipFilename);\r\n                if (!zipFileSystem.ContainsFile(sourceFilename))\r\n                {\r\n                    result.AddFatal($\"The file '{sourceFilename}' is missing from the zip file\");\r\n                    continue;\r\n                }\r\n\r\n                // Extracting dll to package temp folder\r\n                if (C1File.Exists(targetFilename))\r\n                {\r\n                    bool success = false;\r\n                    try\r\n                    {\r\n                        FileUtils.Delete(targetFilename);\r\n                        success = true;\r\n                    }\r\n                    catch(UnauthorizedAccessException) {}\r\n\r\n                    if(!success)\r\n                    {\r\n                        result.AddFatal($\"Access denied to file '{targetFilename}'\");\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                zipFileSystem.WriteFileToDisk(sourceFilename, targetFilename);\r\n\r\n                string newTargetFilename = Path.Combine(this.TempDirectory, Path.GetFileName(targetFilename));\r\n                C1File.Copy(targetFilename, newTargetFilename);\r\n\r\n                Log.LogVerbose(\"PackageInstaller\", \"Loading package uninstaller fragment assembly '{0}'\", newTargetFilename);\r\n\r\n                PackageAssemblyHandler.AddAssembly(newTargetFilename);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private IList<PackageFragmentValidationResult> LoadPackageFragmentInstallers(XElement packageFragmentInstallersElement)\r\n        {\r\n            var result = new List<PackageFragmentValidationResult>();\r\n\r\n            XName packageInstallerXName = XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageFragmentInstallersAddElementName);\r\n            foreach (XElement element in packageFragmentInstallersElement.Elements(packageInstallerXName))\r\n            {\r\n                XAttribute installerTypeAttribute = element.Attribute(PackageSystemSettings.InstallerTypeAttributeName);\r\n                if (installerTypeAttribute == null)\r\n                {\r\n                    result.AddFatal($\"Missing attribute '{PackageSystemSettings.InstallerTypeAttributeName}'\", element);\r\n                    continue;\r\n                }\r\n\r\n                Type installerType = TypeManager.TryGetType(installerTypeAttribute.Value);\r\n                if (installerType == null)\r\n                {\r\n                    result.AddFatal($\"Could not find install fragment type '{installerTypeAttribute.Value}'\", installerTypeAttribute);\r\n                    continue;\r\n                }\r\n\r\n                IPackageFragmentInstaller packageFragmentInstaller;\r\n                try\r\n                {\r\n                    packageFragmentInstaller = Activator.CreateInstance(installerType) as IPackageFragmentInstaller;                    \r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    result.AddFatal(ex);\r\n                    continue;\r\n                }\r\n\r\n                if (packageFragmentInstaller == null)\r\n                {\r\n                    result.AddFatal($\"The type '{installerTypeAttribute.Value}' does not implement {typeof (IPackageFragmentInstaller)}\", installerTypeAttribute); \r\n                    continue;\r\n                }\r\n\r\n                Type uninstallerType = null;\r\n                if (this.CanBeUninstalled)\r\n                {\r\n                    XAttribute uninstallerTypeAttribute = element.Attribute(PackageSystemSettings.UninstallerTypeAttributeName);\r\n                    if (uninstallerTypeAttribute == null)\r\n                    {\r\n                        result.AddFatal($\"Missing attribute '{PackageSystemSettings.UninstallerTypeAttributeName}'\", element); \r\n                        continue;\r\n                    }\r\n\r\n                    uninstallerType = TypeManager.TryGetType(uninstallerTypeAttribute.Value);\r\n                    if (uninstallerType == null)\r\n                    {\r\n                        result.AddFatal($\"Could not find uninstall fragment type '{uninstallerTypeAttribute.Value}'\", uninstallerTypeAttribute); \r\n                        continue; \r\n                    }\r\n\r\n                    IPackageFragmentUninstaller packageFragmentUninstaller;\r\n                    try\r\n                    {\r\n                        packageFragmentUninstaller = Activator.CreateInstance(uninstallerType) as IPackageFragmentUninstaller;                        \r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        result.AddFatal(ex);\r\n                        continue;\r\n                    }\r\n\r\n                    if (packageFragmentUninstaller == null)\r\n                    {\r\n                        result.AddFatal($\"The type '{uninstallerTypeAttribute.Value}' does not implement {typeof (IPackageFragmentUninstaller)}\", uninstallerTypeAttribute); \r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                try\r\n                {\r\n                    packageFragmentInstaller.Initialize(_packageInstallerContex, element.Descendants(), element);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    result.AddFatal(ex);\r\n                    continue;\r\n                }\r\n\r\n                _packageFramentInstallers.Add(packageFragmentInstaller, uninstallerType);\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageInstallerContext.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Core.IO.Zip;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PackageInstallerContext\r\n    {\r\n        private readonly Dictionary<string, DataTypeDescriptor> _pendingDataTypeDescriptors = new Dictionary<string, DataTypeDescriptor>();\r\n        private readonly List<Type> _pendingDataTypes = new List<Type>();\r\n        private readonly List<CultureInfo> _pendingLocales = new List<CultureInfo>();\r\n\r\n\r\n        internal PackageInstallerContext(IZipFileSystem zipFileSystem, string packageDirectory, string tempDirectory, PackageInformation packageInformation)\r\n        {\r\n            Verify.ArgumentNotNull(zipFileSystem, \"zipFileSystem\");\r\n            Verify.ArgumentNotNullOrEmpty(tempDirectory, \"tempDirectory\");\r\n            Verify.ArgumentNotNull(packageInformation, \"packageInformation\");\r\n\r\n            this.ZipFileSystem = zipFileSystem;\r\n            this.PackageDirectory = packageDirectory;\r\n            this.TempDirectory = tempDirectory;\r\n            this.PackageInformation = packageInformation;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IZipFileSystem ZipFileSystem { get; private set; }\r\n\r\n        /// <exclude />\r\n        public string PackageDirectory { get; private set; }\r\n        \r\n        /// <exclude />\r\n        public string TempDirectory { get; private set; }\r\n\r\n        /// <exclude />\r\n        public PackageInformation PackageInformation { get; private set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Use this method to register data type descriptors that have been validated and will be \r\n        /// intstalled.\r\n        /// </summary>\r\n        /// <param name=\"interfaceName\"></param>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        public void AddPendingDataTypeDescritpor(string interfaceName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(interfaceName, \"interfaceName\");\r\n            Verify.ArgumentNotNull(dataTypeDescriptor, \"dataTypeDescriptor\");\r\n\r\n            _pendingDataTypeDescriptors.Add(interfaceName, dataTypeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method returns data type descriptors for dynamic types this is pending \r\n        /// installation (Has passed validaion).\r\n        /// </summary>\r\n        /// <param name=\"interfaceName\"></param>\r\n        /// <returns></returns>\r\n        public DataTypeDescriptor GetPendingDataTypeDescriptor(string interfaceName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(interfaceName, \"interfaceName\");\r\n            \r\n\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n\r\n            if (_pendingDataTypeDescriptors.TryGetValue(interfaceName, out dataTypeDescriptor))\r\n            {\r\n                return dataTypeDescriptor;\r\n            }\r\n\r\n            Type interfaceType = _pendingDataTypes.FirstOrDefault(type => type.FullName == interfaceName);\r\n            if (interfaceType == null) return null;\r\n\r\n            return DynamicTypeManager.BuildNewDataTypeDescriptor(interfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddPendingDataType(Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            if (_pendingDataTypes.Contains(interfaceType) == false)\r\n            {\r\n                _pendingDataTypes.Add(interfaceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsDataTypePending(Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            return _pendingDataTypes.Contains(interfaceType);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsDataTypePending(string typeName)\r\n        {\r\n            Verify.ArgumentNotNull(typeName, \"typeName\");\r\n\r\n            return _pendingDataTypes.Any(type => type.FullName == typeName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type GetPendingDataType(string typeName)\r\n        {\r\n            return _pendingDataTypes.FirstOrDefault(type => type.FullName == typeName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddPendingLocale(CultureInfo locale)\r\n        {\r\n            Verify.ArgumentNotNull(locale, \"locale\");\r\n\r\n            _pendingLocales.Add(locale);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsLocalePending(CultureInfo locale)\r\n        {\r\n            Verify.ArgumentNotNull(locale, \"locale\");\r\n\r\n            return _pendingLocales.Contains(locale);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageInstallerUninstallerFactory.cs",
    "content": "﻿using Composite.Core.PackageSystem.Foundation;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal sealed class PackageInstallerUninstallerFactory : IPackageInstallerUninstallerFactory\r\n    {\r\n        public IPackageUninstaller CreateUninstaller(string zipFilename, string uninstallFilename, string packageInstallationDirectory, string tempDirectory, bool flushOnCompletion, bool reloadConsoleOnCompletion, bool useTransaction, PackageInformation packageInformation)\r\n        {\r\n            return new PackageUninstaller(zipFilename, uninstallFilename, packageInstallationDirectory, tempDirectory, flushOnCompletion, reloadConsoleOnCompletion, useTransaction, packageInformation);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageLicenseDefinition.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>\r\n    /// A package license key definition\r\n    /// </summary>\r\n    public class PackageLicenseDefinition\r\n    {\r\n        /// <summary>\r\n        /// The name of the package.\r\n        /// </summary>\r\n        public string ProductName { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The local path of the license file. A serialized version of this class.\r\n        /// </summary>\r\n        public string LicenseFileName { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// False if the license is a trail license. True if its a permanent license.\r\n        /// </summary>\r\n        public bool Permanent { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The id of the C1 installation where the package was installed.\r\n        /// </summary>\r\n        public Guid InstallationId { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The id of the pacakge.\r\n        /// </summary>\r\n        public Guid ProductId { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// A RSA signed license key. This is used to verify that the license file has not been tampered with.\r\n        /// </summary>\r\n        public string LicenseKey { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Url to where to buy a license for the pacakge.\r\n        /// </summary>\r\n        public string PurchaseUrl { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// If its a trail license this property contains the date when the pacakge experies in UTC.\r\n        /// </summary>\r\n        public DateTime Expires { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The <see cref=\"LicenseKey\"/> serizlied to byte array.\r\n        /// </summary>\r\n        public byte[] LicenseKeyBytes\r\n        {\r\n            get\r\n            {\r\n                return ImplementationFactory.CurrentFactory.StatelessPackageLicenseHelper.GetLicenseKeyBytes(this.LicenseKey);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageLicenseHelper.cs",
    "content": "﻿using System;\r\nusing System.Security.Cryptography;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>\r\n    /// This class contains methods for handling package licenses\r\n    /// <example>\r\n    /// Here is an example of how a pacakge could validat if there is a valid license installed for the pacakge.\r\n    /// This code should be compiled into the pacakge itself to prevent spoofing.\r\n    /// <code>                \r\n    /// Guid productId = ...; // A package should have this compiled into its assembly.\r\n    /// string publicKeyXml = ...; // A package should have this compiled into its assembly.\r\n    /// \r\n    /// PackageLicenseDefinition licenseDefinition = PackageLicenseHelper.GetLicenseDefinition(productId);\r\n    /// Guid installationId = licenseDefinition.InstallationId; \r\n    /// bool isPermanent = licenseDefinition.Permanent;\r\n    /// DateTime expiresTime = licenseDefinition.Expires;\r\n    /// \r\n    /// byte[] signedSignature = licenseDefinition.LicenseKeyBytes;\r\n    /// \r\n    /// // Create the signature string\r\n    /// string signatureString;\r\n    /// if (isPermanent)\r\n    /// {\r\n    ///     signatureString = string.Format(\"{0}#{1}#{2}\", installationId, productId, isPermanent);\r\n    /// }\r\n    /// else\r\n    /// {\r\n    ///     signatureString = string.Format(\"{0}#{1}#{2}#{3}\", installationId, productId, isPermanent, new XAttribute(\"date\", expiresTime).Value);\r\n    /// }\r\n    /// byte[] signature = PackageLicenseHelper.CreateSignatureBytes(signatureString);\r\n    /// \r\n    /// // Create the provider to verify the signature string\r\n    /// RSACryptoServiceProvider provider = new RSACryptoServiceProvider();\r\n    /// provider.FromXmlString(publicKeyXml);\r\n    /// \r\n    /// object hashAlgorithm = PackageLicenseHelper.CreateSignatureHashAlgorithm(publicKeyXml);\r\n    /// \r\n    /// // isValidKey tells if the package license xml file has been tampered with\r\n    /// bool isValidKey = provider.VerifyData(signature, hashAlgorithm, signedSignature);\r\n    /// \r\n    /// // isExpried tells if a trail license is expired, false if its a permanent license\r\n    /// bool isExpired = !isPermanent &lt; expiresTime &lt; DateTime.Now;\r\n    /// \r\n    /// // isLicenseValid is a combination of isValidKey and isExpired and is only true if the package license xml file has not been tampered with and the license is not expired\r\n    /// bool isLicenseValid = isValidKey &amp; !isExpired;\r\n    /// </code>\r\n    /// </example>\r\n    /// </summary>\r\n    public static class PackageLicenseHelper\r\n    {\r\n        /// <summary>\r\n        /// This method returns a license defintion for the given pacakge id\r\n        /// </summary>        \r\n        /// <param name=\"productId\">The package id to locate licende definition for.</param>\r\n        /// <returns>The data for the license definition found. Null if no license is found.</returns>\r\n        public static PackageLicenseDefinition GetLicenseDefinition(Guid productId)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessPackageLicenseHelper.GetLicenseDefinition(productId);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Stores the given license defintion.\r\n        /// </summary>\r\n        /// <param name=\"licenseDefinition\">The license definition to store</param>\r\n        public static void StoreLicenseDefinition(PackageLicenseDefinition licenseDefinition)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessPackageLicenseHelper.StoreLicenseDefinition(licenseDefinition);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Removes a license definition given the pacakge id\r\n        /// </summary>\r\n        /// <param name=\"productId\">Package id to which the license definition is to be removed</param>\r\n        public static void RemoveLicenseDefintion(Guid productId)\r\n        {\r\n            ImplementationFactory.CurrentFactory.StatelessPackageLicenseHelper.RemoveLicenseDefinition(productId);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method returns a hash algorithm that can be used when validateting a package license definition. \r\n        /// </summary>\r\n        /// <param name=\"publicKeyXml\">This is the public key to the private key used by the pacakge server to generate the license key</param>\r\n        /// <returns>A hash algorithm object</returns>\r\n        public static object CreateSignatureHashAlgorithm(string publicKeyXml)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessPackageLicenseHelper.CreateSignatureHashAlgorithm(publicKeyXml);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method returns a byte representation of the <paramref name=\"signatureString\"/>.\r\n        /// Here is an example of how to create an signature string:\r\n        /// <example>\r\n        /// <code>\r\n        /// string signatureString;\r\n        /// if (isPermanent)\r\n        /// {\r\n        ///     signatureString = string.Format(\"{0}#{1}#{2}\", installationId, productId, isPermanent);\r\n        /// }\r\n        /// else\r\n        /// {\r\n        ///     signatureString = string.Format(\"{0}#{1}#{2}#{3}\", installationId, productId, isPermanent, new XAttribute(\"date\", expiresTime).Value);\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// </summary>\r\n        /// <param name=\"signatureString\">A signature string</param>\r\n        /// <returns></returns>\r\n        public static byte[] CreateSignatureBytes(string signatureString)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessPackageLicenseHelper.CreateSignatureBytes(signatureString);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Core_PackageSystem_PackageFragmentInstallers;\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PackageManager\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<InstalledPackageInformation> GetInstalledPackages()\r\n        {\r\n            string baseDirectory = PathUtil.Resolve(GlobalSettingsFacade.PackageDirectory);\r\n\r\n            if (!C1Directory.Exists(baseDirectory)) yield break;\r\n\r\n            string[] packageDirectories = C1Directory.GetDirectories(baseDirectory);\r\n            foreach (string packageDirectory in packageDirectories)\r\n            {\r\n                if (C1File.Exists(Path.Combine(packageDirectory, PackageSystemSettings.InstalledFilename)))\r\n                {\r\n                    string filename = Path.Combine(packageDirectory, PackageSystemSettings.PackageInformationFilename);\r\n\r\n                    if (C1File.Exists(filename))\r\n                    {\r\n                        XDocument doc = XDocumentUtils.Load(filename);\r\n\r\n                        XElement packageInfoElement = doc.Root;\r\n                        if (packageInfoElement.Name != XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageInfoElementName)) throw new InvalidOperationException(string.Format(\"{0} is wrongly formattet\", filename));\r\n\r\n                        XAttribute nameAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_NameAttributeName);\r\n                        XAttribute groupNameAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_GroupNameAttributeName);\r\n                        XAttribute versionAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_VersionAttributeName);\r\n                        XAttribute authorAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_AuthorAttributeName);\r\n                        XAttribute websiteAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_WebsiteAttributeName);\r\n                        XAttribute descriptionAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_DescriptionAttributeName);\r\n                        XAttribute installDateAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_InstallDateAttributeName);\r\n                        XAttribute installedByAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_InstalledByAttributeName);\r\n                        XAttribute isLocalInstalledAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_IsLocalInstalledAttributeName);\r\n                        XAttribute canBeUninstalledAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_CanBeUninstalledAttributeName);\r\n                        XAttribute flushOnCompletionAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_FlushOnCompletionAttributeName);\r\n                        XAttribute reloadConsoleOnCompletionAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_ReloadConsoleOnCompletionAttributeName);\r\n                        XAttribute systemLockingAttribute = GetAttributeNotNull(filename, packageInfoElement, PackageSystemSettings.PackageInfo_SystemLockingAttributeName);\r\n\r\n                        XAttribute packageServerAddressAttribute = packageInfoElement.Attribute(PackageSystemSettings.PackageInfo_PackageServerAddressAttributeName);\r\n\r\n\r\n                        SystemLockingType systemLockingType;\r\n                        if (systemLockingAttribute.TryDeserialize(out systemLockingType) == false) throw new InvalidOperationException(\"The systemLocking attibute value is wrong\");\r\n\r\n                        string path = packageDirectory.Remove(0, baseDirectory.Length);\r\n                        if (path.StartsWith(\"\\\\\"))\r\n                        {\r\n                            path = path.Remove(0, 1);\r\n                        }\r\n\r\n                        Guid packageId;\r\n                        if (!Guid.TryParse(path, out packageId))\r\n                        {\r\n                            continue;\r\n                        }\r\n\r\n                        yield return new InstalledPackageInformation\r\n                        {\r\n                            Id = packageId,\r\n                            Name = nameAttribute.Value,\r\n                            GroupName = groupNameAttribute.Value,\r\n                            Version = versionAttribute.Value,\r\n                            Author = authorAttribute.Value,\r\n                            Website = websiteAttribute.Value,\r\n                            Description = descriptionAttribute.Value,\r\n                            InstallDate = (DateTime)installDateAttribute,\r\n                            InstalledBy = installedByAttribute.Value,\r\n                            IsLocalInstalled = (bool)isLocalInstalledAttribute,\r\n                            CanBeUninstalled = (bool)canBeUninstalledAttribute,\r\n                            FlushOnCompletion = (bool)flushOnCompletionAttribute,\r\n                            ReloadConsoleOnCompletion = (bool)reloadConsoleOnCompletionAttribute,\r\n                            SystemLockingType = systemLockingType,\r\n                            PackageServerAddress = packageServerAddressAttribute?.Value,\r\n                            PackageInstallPath = packageDirectory\r\n                        };\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new InvalidOperationException($\"'{filename}' does not exist\");\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    // Make this cleanup in an other way, it works correctly if it is done between validation and installation.\r\n                    //LoggingService.LogVerbose(\"PackageManager\", string.Format(\"Uncomlete installed add on found ('{0}'), deleting it\", Path.GetFileName(packageDirecoty)));\r\n                    //try\r\n                    //{\r\n                    //    Directory.Delete(packageDirecoty, true);\r\n                    //}\r\n                    //catch (Exception)\r\n                    //{\r\n                    //}\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static XAttribute GetAttributeNotNull(string fileName, XElement packageInfoElement, string attributeName)\r\n        {\r\n            XAttribute attribute = packageInfoElement.Attribute(attributeName);\r\n            Verify.IsNotNull(attribute, \"File: '{0}', failed to find '{1}' attribute.\", fileName, attributeName);\r\n\r\n            return attribute;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsInstalled(Guid packageId)\r\n        {\r\n            InstalledPackageInformation installedPackageInformation =\r\n                        (from ao in GetInstalledPackages()\r\n                         where ao.Id == packageId\r\n                         select ao).SingleOrDefault();\r\n\r\n            return installedPackageInformation != null;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetCurrentVersion(Guid packageId)\r\n        {\r\n            string currentVersion =\r\n                        (from ao in GetInstalledPackages()\r\n                         where ao.Id == packageId\r\n                         select ao.Version).SingleOrDefault();\r\n\r\n            return currentVersion;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static PackageManagerInstallProcess Install(Stream zipFileStream, bool isLocalInstall)\r\n        {\r\n            if (isLocalInstall == false) throw new ArgumentException(\"Non local install needs a packageServerAddress\");\r\n\r\n            return Install(zipFileStream, isLocalInstall, null);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static PackageManagerInstallProcess Install(Stream zipFileStream, bool isLocalInstall, string packageServerAddress)\r\n        {\r\n            if (!isLocalInstall && string.IsNullOrEmpty(packageServerAddress)) throw new ArgumentException(\"Non local install needs a packageServerAddress\");\r\n\r\n            string zipFilename = null;\r\n\r\n            try\r\n            {\r\n                PackageFragmentValidationResult packageFragmentValidationResult = SaveZipFile(zipFileStream, out zipFilename);\r\n                if (packageFragmentValidationResult != null) return new PackageManagerInstallProcess(new List<PackageFragmentValidationResult> { packageFragmentValidationResult }, null);\r\n\r\n                XElement installContent;\r\n                packageFragmentValidationResult = XmlHelper.LoadInstallXml(zipFilename, out installContent);\r\n                if (packageFragmentValidationResult != null) return new PackageManagerInstallProcess(new List<PackageFragmentValidationResult> { packageFragmentValidationResult }, zipFilename);\r\n\r\n                PackageInformation packageInformation;\r\n                packageFragmentValidationResult = ValidatePackageInformation(installContent, out packageInformation);\r\n                if (packageFragmentValidationResult != null) return new PackageManagerInstallProcess(new List<PackageFragmentValidationResult> { packageFragmentValidationResult }, zipFilename);\r\n\r\n                if (RuntimeInformation.ProductVersion < packageInformation.MinCompositeVersionSupported\r\n                    || RuntimeInformation.ProductVersion > packageInformation.MaxCompositeVersionSupported)\r\n                {\r\n                    return new PackageManagerInstallProcess(new List<PackageFragmentValidationResult>\r\n                    {\r\n                        new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal,\r\n                            Texts.PackageManager_CompositeVersionMisMatch(\r\n                                RuntimeInformation.ProductVersion, \r\n                                packageInformation.MinCompositeVersionSupported,\r\n                                packageInformation.MaxCompositeVersionSupported)) }, zipFilename);\r\n                }\r\n\r\n                bool updatingInstalledPackage = false;\r\n                if (IsInstalled(packageInformation.Id))\r\n                {\r\n                    string currentVersionString = GetCurrentVersion(packageInformation.Id);\r\n\r\n                    Version currentVersion = new Version(currentVersionString);\r\n                    Version newVersion = new Version(packageInformation.Version);\r\n\r\n                    if (newVersion <= currentVersion)\r\n                    {\r\n                        string validationError = newVersion == currentVersion \r\n                                    ? Texts.PackageManager_PackageAlreadyInstalled \r\n                                    : Texts.PackageManager_NewerVersionInstalled;\r\n\r\n                        return new PackageManagerInstallProcess(\r\n                            new List<PackageFragmentValidationResult>\r\n                                {\r\n                                    new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, validationError)\r\n                                }, zipFilename);\r\n                    }\r\n\r\n                    updatingInstalledPackage = true;\r\n                }\r\n\r\n                string originalInstallDirectory = null;\r\n                string packageInstallDirectory = CreatePackageDirectoryName(packageInformation);\r\n\r\n                if (updatingInstalledPackage)\r\n                {\r\n                    originalInstallDirectory = packageInstallDirectory;\r\n                    packageInstallDirectory += \"-\" + packageInformation.Version;\r\n                }\r\n\r\n                C1Directory.CreateDirectory(packageInstallDirectory);\r\n\r\n                string packageZipFilename = Path.Combine(packageInstallDirectory, Path.GetFileName(zipFilename));\r\n                C1File.Copy(zipFilename, packageZipFilename, true);\r\n\r\n                string username = \"Composite\";\r\n                if (UserValidationFacade.IsLoggedIn())\r\n                {\r\n                    username = UserValidationFacade.GetUsername();\r\n                }\r\n\r\n                var doc = new XDocument();\r\n                XElement packageInfoElement = new XElement(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageInfoElementName));\r\n                doc.Add(packageInfoElement);\r\n                packageInfoElement.Add(\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_NameAttributeName, packageInformation.Name),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_GroupNameAttributeName, packageInformation.GroupName),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_VersionAttributeName, packageInformation.Version),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_AuthorAttributeName, packageInformation.Author),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_WebsiteAttributeName, packageInformation.Website),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_DescriptionAttributeName, packageInformation.Description),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_InstallDateAttributeName, DateTime.Now),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_InstalledByAttributeName, username),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_IsLocalInstalledAttributeName, isLocalInstall),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_CanBeUninstalledAttributeName, packageInformation.CanBeUninstalled),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_FlushOnCompletionAttributeName, packageInformation.FlushOnCompletion),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_ReloadConsoleOnCompletionAttributeName, packageInformation.ReloadConsoleOnCompletion),\r\n                    new XAttribute(PackageSystemSettings.PackageInfo_SystemLockingAttributeName, packageInformation.SystemLockingType.Serialize()));\r\n\r\n                if (!string.IsNullOrEmpty(packageServerAddress))\r\n                {\r\n                    packageInfoElement.Add(new XAttribute(PackageSystemSettings.PackageInfo_PackageServerAddressAttributeName, packageServerAddress));\r\n                }\r\n\r\n                string infoFilename = Path.Combine(packageInstallDirectory, PackageSystemSettings.PackageInformationFilename);\r\n                doc.SaveToFile(infoFilename);\r\n\r\n                var packageInstaller = new PackageInstaller(new PackageInstallerUninstallerFactory(), packageZipFilename, packageInstallDirectory, TempDirectoryFacade.CreateTempDirectory(), packageInformation);\r\n\r\n                return new PackageManagerInstallProcess(\r\n                    packageInstaller, \r\n                    packageInformation.SystemLockingType, \r\n                    zipFilename, \r\n                    packageInstallDirectory, \r\n                    packageInformation.Name,\r\n                    packageInformation.Version,\r\n                    packageInformation.Id,\r\n                    originalInstallDirectory);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new PackageManagerInstallProcess(new List<PackageFragmentValidationResult>\r\n                {\r\n                    new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex)\r\n                }, zipFilename);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static PackageManagerUninstallProcess Uninstall(Guid id)\r\n        {\r\n            try\r\n            {\r\n                string absolutePath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PackageDirectory), id.ToString());\r\n\r\n                InstalledPackageInformation installedPackageInformation =\r\n                    (from package in GetInstalledPackages()\r\n                     where package.Id == id\r\n                     select package).SingleOrDefault();\r\n\r\n                if (installedPackageInformation == null) return new PackageManagerUninstallProcess(new List<PackageFragmentValidationResult> { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingPackageDirectory\"), absolutePath)) });\r\n\r\n                Log.LogVerbose(\"PackageManager\", \"Uninstalling package: {0}, Id = {1}\", installedPackageInformation.Name, installedPackageInformation.Id);\r\n\r\n                if (installedPackageInformation.CanBeUninstalled == false) return new PackageManagerUninstallProcess(new List<PackageFragmentValidationResult> { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, GetText(\"PackageManager.Uninstallable\")) });\r\n\r\n                string zipFilePath = Path.Combine(absolutePath, PackageSystemSettings.ZipFilename);\r\n                if (C1File.Exists(zipFilePath) == false) return new PackageManagerUninstallProcess(new List<PackageFragmentValidationResult> { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingZipFile\"), zipFilePath)) });\r\n\r\n                string uninstallFilePath = Path.Combine(absolutePath, PackageSystemSettings.UninstallFilename);\r\n                if (C1File.Exists(uninstallFilePath) == false) return new PackageManagerUninstallProcess(new List<PackageFragmentValidationResult> { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingUninstallFile\"), uninstallFilePath)) });\r\n\r\n                PackageInformation packageInformation = new PackageInformation\r\n                {\r\n                    Id = installedPackageInformation.Id,\r\n                    Name = installedPackageInformation.Name,\r\n                    GroupName = installedPackageInformation.GroupName,\r\n                    Author = installedPackageInformation.Author,\r\n                    Website = installedPackageInformation.Website,\r\n                    Description = installedPackageInformation.Description,\r\n                    Version = installedPackageInformation.Version,\r\n                    CanBeUninstalled = installedPackageInformation.CanBeUninstalled,\r\n                    SystemLockingType = installedPackageInformation.SystemLockingType,\r\n                    FlushOnCompletion = installedPackageInformation.FlushOnCompletion,\r\n                    ReloadConsoleOnCompletion = installedPackageInformation.ReloadConsoleOnCompletion,\r\n                };\r\n\r\n\r\n                PackageUninstaller packageUninstaller = new PackageUninstaller(zipFilePath, uninstallFilePath, absolutePath, TempDirectoryFacade.CreateTempDirectory(), installedPackageInformation.FlushOnCompletion, installedPackageInformation.ReloadConsoleOnCompletion, true, packageInformation);\r\n\r\n                PackageManagerUninstallProcess packageManagerUninstallProcess = new PackageManagerUninstallProcess(packageUninstaller, absolutePath, installedPackageInformation.SystemLockingType);\r\n                return packageManagerUninstallProcess;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new PackageManagerUninstallProcess(new List<PackageFragmentValidationResult> { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex) });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static PackageFragmentValidationResult ValidatePackageInformation(XElement installContent, out PackageInformation packageInformation)\r\n        {\r\n            packageInformation = null;\r\n\r\n            XElement packageInformationElement = installContent.Element(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageInformationElementName));\r\n            if (packageInformationElement == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingElement\"), PackageSystemSettings.PackageInformationElementName), installContent);\r\n\r\n            XAttribute idAttribute = packageInformationElement.Attribute(PackageSystemSettings.IdAttributeName);\r\n            XAttribute nameAttribute = packageInformationElement.Attribute(PackageSystemSettings.NameAttributeName);\r\n            XAttribute groupNameAttribute = packageInformationElement.Attribute(PackageSystemSettings.GroupNameAttributeName);\r\n            XAttribute authorAttribute = packageInformationElement.Attribute(PackageSystemSettings.AuthorAttributeName);\r\n            XAttribute websiteAttribute = packageInformationElement.Attribute(PackageSystemSettings.WebsiteAttributeName);\r\n            XAttribute versionAttribute = packageInformationElement.Attribute(PackageSystemSettings.VersionAttributeName);\r\n            XAttribute canBeUninstalledAttribute = packageInformationElement.Attribute(PackageSystemSettings.CanBeUninstalledAttributeName);\r\n            XAttribute systemLockingAttribute = packageInformationElement.Attribute(PackageSystemSettings.SystemLockingAttributeName);\r\n            XAttribute flushOnCompletionAttribute = packageInformationElement.Attribute(PackageSystemSettings.FlushOnCompletionAttributeName);\r\n            XAttribute reloadConsoleOnCompletionAttribute = packageInformationElement.Attribute(PackageSystemSettings.ReloadConsoleOnCompletionAttributeName);\r\n\r\n            if (idAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.IdAttributeName), packageInformationElement);\r\n            if (nameAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.NameAttributeName), packageInformationElement);\r\n            if (groupNameAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.GroupNameAttributeName), packageInformationElement);\r\n            if (authorAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.AuthorAttributeName), packageInformationElement);\r\n            if (websiteAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.WebsiteAttributeName), packageInformationElement);\r\n            if (versionAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.VersionAttributeName), packageInformationElement);\r\n            if (canBeUninstalledAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.CanBeUninstalledAttributeName), packageInformationElement);\r\n            if (systemLockingAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.SystemLockingAttributeName), packageInformationElement);\r\n\r\n            if (string.IsNullOrEmpty(nameAttribute.Value)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.NameAttributeName), nameAttribute);\r\n            if (string.IsNullOrEmpty(groupNameAttribute.Value)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.GroupNameAttributeName), groupNameAttribute);\r\n            if (string.IsNullOrEmpty(authorAttribute.Value)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.AuthorAttributeName), authorAttribute);\r\n            if (string.IsNullOrEmpty(websiteAttribute.Value)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.WebsiteAttributeName), websiteAttribute);\r\n            if (string.IsNullOrEmpty(versionAttribute.Value)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.VersionAttributeName), versionAttribute);\r\n            if (string.IsNullOrEmpty(packageInformationElement.Value)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidElementValue\"), PackageSystemSettings.PackageInformationElementName), packageInformationElement);\r\n\r\n            Guid id;\r\n            if (idAttribute.TryGetGuidValue(out id) == false) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.IdAttributeName), idAttribute);\r\n\r\n\r\n            string newVersion;\r\n\r\n            if (VersionStringHelper.ValidateVersion(versionAttribute.Value, out newVersion)) versionAttribute.Value = newVersion;\r\n            else return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.VersionAttributeName), versionAttribute);\r\n\r\n            bool canBeUninstalled;\r\n            if (canBeUninstalledAttribute.TryGetBoolValue(out canBeUninstalled) == false) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.CanBeUninstalledAttributeName), canBeUninstalledAttribute);\r\n\r\n            SystemLockingType systemLockingType;\r\n            if (systemLockingAttribute.TryDeserialize(out systemLockingType) == false) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.SystemLockingAttributeName), systemLockingAttribute);\r\n\r\n            bool flushOnCompletion = false;\r\n            if ((flushOnCompletionAttribute != null) && (flushOnCompletionAttribute.TryGetBoolValue(out flushOnCompletion) == false)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.FlushOnCompletionAttributeName), flushOnCompletionAttribute);\r\n\r\n            bool reloadConsoleOnCompletion = false;\r\n            if ((reloadConsoleOnCompletionAttribute != null) && (reloadConsoleOnCompletionAttribute.TryGetBoolValue(out reloadConsoleOnCompletion) == false)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.ReloadConsoleOnCompletionAttributeName), reloadConsoleOnCompletionAttribute);\r\n\r\n\r\n            XElement packageRequirementsElement = installContent.Element(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageRequirementsElementName));\r\n            if (packageRequirementsElement == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingElement\"), PackageSystemSettings.PackageRequirementsElementName), installContent);\r\n\r\n            XAttribute minimumCompositeVersionAttribute = packageRequirementsElement.Attribute(PackageSystemSettings.MinimumCompositeVersionAttributeName);\r\n            XAttribute maximumCompositeVersionAttribute = packageRequirementsElement.Attribute(PackageSystemSettings.MaximumCompositeVersionAttributeName);\r\n\r\n            if (minimumCompositeVersionAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.MinimumCompositeVersionAttributeName), packageRequirementsElement);\r\n            if (maximumCompositeVersionAttribute == null) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.MissingAttribute\"), PackageSystemSettings.MaximumCompositeVersionAttributeName), packageRequirementsElement);\r\n\r\n            if (string.IsNullOrEmpty(minimumCompositeVersionAttribute.Value)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.MinimumCompositeVersionAttributeName), minimumCompositeVersionAttribute);\r\n            if (string.IsNullOrEmpty(maximumCompositeVersionAttribute.Value)) return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.MaximumCompositeVersionAttributeName), maximumCompositeVersionAttribute);\r\n\r\n            if (VersionStringHelper.ValidateVersion(minimumCompositeVersionAttribute.Value, out newVersion)) minimumCompositeVersionAttribute.Value = newVersion;\r\n            else return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.VersionAttributeName), minimumCompositeVersionAttribute);\r\n\r\n            if (VersionStringHelper.ValidateVersion(maximumCompositeVersionAttribute.Value, out newVersion)) maximumCompositeVersionAttribute.Value = newVersion;\r\n            else return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(GetText(\"PackageManager.InvalidAttributeValue\"), PackageSystemSettings.VersionAttributeName), maximumCompositeVersionAttribute);\r\n\r\n\r\n            packageInformation = new PackageInformation\r\n            {\r\n                Id = id,\r\n                Name = nameAttribute.Value,\r\n                GroupName = groupNameAttribute.Value,\r\n                Author = authorAttribute.Value,\r\n                Website = websiteAttribute.Value,\r\n                Version = versionAttribute.Value,\r\n                CanBeUninstalled = canBeUninstalled,\r\n                SystemLockingType = systemLockingType,\r\n                Description = packageInformationElement.Value,\r\n                FlushOnCompletion = flushOnCompletion,\r\n                ReloadConsoleOnCompletion = reloadConsoleOnCompletion,\r\n                MinCompositeVersionSupported = new Version(minimumCompositeVersionAttribute.Value),\r\n                MaxCompositeVersionSupported = new Version(maximumCompositeVersionAttribute.Value)\r\n            };\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private static PackageFragmentValidationResult SaveZipFile(Stream zipFileStream, out string zipFilename)\r\n        {\r\n            zipFilename = null;\r\n\r\n            try\r\n            {\r\n                zipFilename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PackageDirectory), PackageSystemSettings.ZipFilename);\r\n\r\n                if (C1File.Exists(zipFilename))\r\n                {\r\n                    C1File.Delete(zipFilename);\r\n                }\r\n\r\n                if (C1Directory.Exists(Path.GetDirectoryName(zipFilename)) == false)\r\n                {\r\n                    C1Directory.CreateDirectory(Path.GetDirectoryName(zipFilename));\r\n                }\r\n\r\n                using (Stream readStream = zipFileStream)\r\n                {\r\n                    using (C1FileStream fileStream = new C1FileStream(zipFilename, FileMode.Create))\r\n                    {\r\n                        byte[] buffer = new byte[4096];\r\n\r\n                        int readBytes;\r\n                        while ((readBytes = readStream.Read(buffer, 0, 4096)) > 0)\r\n                        {\r\n                            fileStream.Write(buffer, 0, readBytes);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return null;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex);\r\n            }\r\n        }\r\n\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Core.PackageSystem.PackageFragmentInstallers\", stringId);\r\n        }\r\n\r\n        private static string CreatePackageDirectoryName(PackageInformation packageInformation)\r\n        {\r\n            string directoryName = $\"{packageInformation.Id}\";\r\n\r\n            return Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PackageDirectory), directoryName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageManagerInstallProcess.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.Serialization;\r\nusing System.ComponentModel;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Application;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    [SerializerHandler(typeof(PackageManagerInstallProcess))]\r\n    public sealed class PackageManagerInstallProcess : ISerializerHandler\r\n    {\r\n        private static readonly string LogTitle = typeof(PackageManagerInstallProcess).Name;\r\n\r\n        private readonly IPackageInstaller _packageInstaller;\r\n        private readonly SystemLockingType _systemLockingType;\r\n        private readonly string _zipFilename;\r\n        private readonly string _packageInstallDirectory;\r\n        private readonly string _packageName;\r\n        private readonly string _packageVersion;\r\n        private readonly Guid _packageId;\r\n        private readonly string _originalPackageInstallDirectory;\r\n        private readonly List<PackageFragmentValidationResult> _preInstallValidationResult;\r\n        private List<PackageFragmentValidationResult> _validationResult;\r\n        private List<PackageFragmentValidationResult> _installationResult;\r\n        \r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            var processToSerialize = objectToSerialize as PackageManagerInstallProcess;\r\n\r\n            var sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"ZipFileName\", processToSerialize._zipFilename);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"PackageInstallDirectory\", processToSerialize._packageInstallDirectory);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"HasBeenValidated\", processToSerialize._validationResult != null);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"OriginalPackageInstallDirectory\", processToSerialize._originalPackageInstallDirectory);\r\n            \r\n            \r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedObject);\r\n\r\n            string zipFilename = StringConversionServices.DeserializeValueString(dic[\"ZipFileName\"]);\r\n            string packageInstallDirectory = StringConversionServices.DeserializeValueString(dic[\"PackageInstallDirectory\"]);\r\n            bool hasBeenValidated = StringConversionServices.DeserializeValueBool(dic[\"HasBeenValidated\"]);\r\n\r\n            string originalPackageInstallDirectory = null;\r\n            string serializedValue;\r\n\r\n            if (dic.TryGetValue(\"OriginalPackageInstallDirectory\", out serializedValue))\r\n            {\r\n                originalPackageInstallDirectory = StringConversionServices.DeserializeValueString(serializedValue);\r\n            }\r\n            \r\n            if (C1File.Exists(zipFilename))\r\n            {\r\n                XElement installContent;\r\n                XmlHelper.LoadInstallXml(zipFilename, out installContent);\r\n\r\n                PackageInformation packageInformation;\r\n                PackageManager.ValidatePackageInformation(installContent, out packageInformation);\r\n\r\n                string packageZipFilename = Path.Combine(packageInstallDirectory, Path.GetFileName(zipFilename));\r\n                C1File.Copy(zipFilename, packageZipFilename, true);\r\n\r\n                var packageInstaller = new PackageInstaller(new PackageInstallerUninstallerFactory(), packageZipFilename, packageInstallDirectory, TempDirectoryFacade.CreateTempDirectory(), packageInformation);\r\n\r\n                var packageManagerInstallProcess = new PackageManagerInstallProcess(\r\n                    packageInstaller, \r\n                    packageInformation.SystemLockingType, \r\n                    zipFilename, \r\n                    packageInstallDirectory, \r\n                    packageInformation.Name, \r\n                    packageInformation.Version,\r\n                    packageInformation.Id,\r\n                    originalPackageInstallDirectory);\r\n\r\n                if (hasBeenValidated)\r\n                {\r\n                    packageManagerInstallProcess.Validate();\r\n                }\r\n\r\n                return packageManagerInstallProcess;\r\n            }\r\n\r\n            return new PackageManagerInstallProcess(new List<PackageFragmentValidationResult>(), null);;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PackageManagerInstallProcess()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        internal PackageManagerInstallProcess(List<PackageFragmentValidationResult> preInstallValidationResult, string zipFilename)\r\n        {\r\n            Verify.ArgumentNotNull(preInstallValidationResult, \"preInstallValidationResult\");\r\n\r\n            _preInstallValidationResult = preInstallValidationResult;\r\n            _zipFilename = zipFilename;\r\n        }\r\n\r\n\r\n\r\n        internal PackageManagerInstallProcess(\r\n            IPackageInstaller packageInstaller, \r\n            SystemLockingType systemLockingType, \r\n            string zipFilename, \r\n            string packageInstallDirectory, \r\n            string packageName,\r\n            string packageVersion, \r\n            Guid packageId,\r\n            string originalPackageInstallDirectory)\r\n        {\r\n            Verify.ArgumentNotNull(packageInstaller, \"packageInstaller\");\r\n            Verify.ArgumentNotNullOrEmpty(packageInstallDirectory, \"packageInstallDirectory\");\r\n\r\n            _packageInstaller = packageInstaller;\r\n            _systemLockingType = systemLockingType;\r\n            _zipFilename = zipFilename;\r\n            _packageInstallDirectory = packageInstallDirectory;\r\n            _packageName = packageName;\r\n            _packageVersion = packageVersion;\r\n            _packageId = packageId;\r\n            _originalPackageInstallDirectory = originalPackageInstallDirectory;\r\n\r\n            _preInstallValidationResult = new List<PackageFragmentValidationResult>();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool CanBeUninstalled\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_packageInstaller, \"Pre installation did not validate\");\r\n\r\n                return _packageInstaller.CanBeUninstalled;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool FlushOnCompletion\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_packageInstaller, \"Pre installation did not validate\");\r\n\r\n                return _packageInstaller.FlushOnCompletion;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool ReloadConsoleOnCompletion\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_packageInstaller, \"Pre installation did not validate\");\r\n\r\n                return _packageInstaller.ReloadConsoleOnCompletion;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<PackageFragmentValidationResult> PreInstallValidationResult\r\n        {\r\n            get\r\n            {\r\n                return _preInstallValidationResult;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public List<PackageFragmentValidationResult> Validate()\r\n        {\r\n            Verify.IsNotNull(_packageInstaller, \"Pre installation did not validate\");\r\n            Verify.IsNull(_validationResult, \"Validate() may only be called once\");\r\n\r\n            _validationResult = _packageInstaller.Validate().ToList();\r\n\r\n            if (_validationResult.Count > 0)\r\n            {\r\n                _validationResult.AddRange(FinalizeProcess(false));\r\n            }\r\n\r\n            return _validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public List<PackageFragmentValidationResult> Install()\r\n        {\r\n            Verify.IsNotNull(_packageInstaller, \"Pre installation did not validate\");\r\n            Verify.IsNotNull(_validationResult, \"Call validation first\");\r\n            if (_validationResult.Count > 0) throw new InvalidOperationException(\"Installation did not validate\");\r\n            Verify.IsNull(_installationResult, \"Install may only be called once\");\r\n\r\n            var userName = UserValidationFacade.IsLoggedIn() ? UserValidationFacade.GetUsername() : \"<system>\";\r\n\r\n            Log.LogInformation(LogTitle, $\"Installing package: {_packageName}, Version: {_packageVersion}, Id = {_packageId}; User name: '{userName}'\");\r\n\r\n            PackageFragmentValidationResult result = _packageInstaller.Install(_systemLockingType);\r\n\r\n            _installationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (result != null)\r\n            {\r\n                _installationResult.Add(result);\r\n            }\r\n\r\n            _installationResult.AddRange(FinalizeProcess(true));\r\n\r\n            return _installationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void CancelInstallation()\r\n        {\r\n            if (_zipFilename != null && C1File.Exists(_zipFilename))\r\n            {\r\n                C1File.Delete(_zipFilename);\r\n            }\r\n\r\n            if (C1Directory.Exists(_packageInstallDirectory))\r\n            {\r\n                C1Directory.Delete(_packageInstallDirectory, true);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private ICollection<PackageFragmentValidationResult> FinalizeProcess(bool install)\r\n        {\r\n            try        \r\n            {\r\n                if (_zipFilename != null && C1File.Exists(_zipFilename))\r\n                {\r\n                    C1File.Delete(_zipFilename);\r\n                }\r\n\r\n                Func<IList<PackageFragmentValidationResult>, bool> isNotEmpty = list => list != null && list.Count > 0;\r\n\r\n                bool installationFailed = isNotEmpty(_preInstallValidationResult) \r\n                                          || isNotEmpty(_validationResult) \r\n                                          || isNotEmpty(_installationResult);\r\n\r\n                if (installationFailed && C1Directory.Exists(_packageInstallDirectory))\r\n                {\r\n                    C1Directory.Delete(_packageInstallDirectory, true);\r\n                }\r\n\r\n                if(!installationFailed && install)\r\n                {\r\n                    Log.LogInformation(LogTitle, \"Package successfully installed\");\r\n\r\n                    C1File.WriteAllText(Path.Combine(_packageInstallDirectory, PackageSystemSettings.InstalledFilename), \"\");\r\n\r\n                    // Moving package files to a proper location, if an newer version of an already installed package is installed\r\n                    if (_originalPackageInstallDirectory != null)\r\n                    {\r\n                        C1Directory.Delete(_originalPackageInstallDirectory, true);\r\n\r\n                        C1Directory.Move(_packageInstallDirectory, _originalPackageInstallDirectory);\r\n                    }\r\n                }\r\n\r\n                return new PackageFragmentValidationResult[0];\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new [] { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex) };\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageManagerUninstallProcess.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SerializerHandler(typeof(PackageManagerUninstallProcessSerializerHandler))]\r\n    public sealed class PackageManagerUninstallProcess\r\n    {\r\n        private static readonly string LogTitle = typeof (PackageManagerUninstallProcess).Name;\r\n\r\n        private readonly IPackageUninstaller _packageUninstaller;\r\n        private readonly string _packageInstallDirectory;\r\n        private readonly SystemLockingType _systemLockingType;\r\n        private readonly List<PackageFragmentValidationResult> _preUninstallValidationResult;\r\n        private List<PackageFragmentValidationResult> _validationResult;\r\n        private List<PackageFragmentValidationResult> _uninstallationResult;\r\n\r\n\r\n        internal PackageManagerUninstallProcess(List<PackageFragmentValidationResult> preUninstallValidationResult)\r\n        {\r\n            if (preUninstallValidationResult == null) throw new ArgumentNullException(\"preUninstallValidationResult\");\r\n\r\n            _preUninstallValidationResult = preUninstallValidationResult;\r\n        }\r\n\r\n\r\n        internal PackageManagerUninstallProcess(IPackageUninstaller packageUninstaller, string packageInstallDirectory, SystemLockingType systemLockingType)\r\n        {\r\n            if (packageUninstaller == null) throw new ArgumentNullException(\"packageUninstaller\");\r\n            if (string.IsNullOrEmpty(packageInstallDirectory)) throw new ArgumentNullException(\"packageInstallDirectory\");\r\n\r\n            _packageUninstaller = packageUninstaller;\r\n            _packageInstallDirectory = packageInstallDirectory;\r\n            _systemLockingType = systemLockingType;\r\n\r\n            _preUninstallValidationResult = new List<PackageFragmentValidationResult>();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool FlushOnCompletion\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_packageUninstaller, \"Pre un-installation did not validate\");\r\n\r\n                return _packageUninstaller.FlushOnCompletion;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool ReloadConsoleOnCompletion\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_packageUninstaller, \"Pre un-installation did not validate\");\r\n\r\n                return _packageUninstaller.ReloadConsoleOnCompletion;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public List<PackageFragmentValidationResult> PreUninstallValidationResult\r\n        {\r\n            get\r\n            {\r\n                return _preUninstallValidationResult;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public List<PackageFragmentValidationResult> Validate()\r\n        {\r\n            Verify.IsNotNull(_packageUninstaller, \"Pre un-installation did not validate\");\r\n            if (_validationResult != null) throw new InvalidOperationException(\"Validate may only be called once\");\r\n\r\n            _validationResult = _packageUninstaller.Validate().ToList();\r\n\r\n            return _validationResult;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public List<PackageFragmentValidationResult> Uninstall()\r\n        {\r\n            Verify.IsNotNull(_packageUninstaller, \"Pre un-installation did not validate\");\r\n            if (_validationResult == null) throw new InvalidOperationException(\"Call validation first\");\r\n            if (_validationResult.Count > 0) throw new InvalidOperationException(\"Installation did not validate\");\r\n            if (_uninstallationResult != null) throw new InvalidOperationException(\"Install may only be called onece\");\r\n\r\n            PackageFragmentValidationResult result = _packageUninstaller.Uninstall(_systemLockingType);\r\n\r\n            _uninstallationResult = new List<PackageFragmentValidationResult>();\r\n\r\n            if (result != null)\r\n            {\r\n                _uninstallationResult.Add( result );\r\n            }\r\n            else\r\n            {\r\n                _uninstallationResult.AddRange( FinalizeProcess() );\r\n            }\r\n\r\n            return _uninstallationResult;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<PackageFragmentValidationResult> FinalizeProcess()\r\n        {\r\n            try\r\n            {\r\n                if (_packageInstallDirectory != null\r\n                    && (_preUninstallValidationResult == null || _preUninstallValidationResult.Count == 0) \r\n                    && (_validationResult == null || _validationResult.Count == 0) \r\n                    && (_uninstallationResult == null || _uninstallationResult.Count == 0))\r\n                {\r\n                    if (C1Directory.Exists(_packageInstallDirectory))\r\n                    {\r\n                        C1Directory.Delete(_packageInstallDirectory, true);\r\n                    }\r\n\r\n                    Log.LogInformation(LogTitle, \"Package successfully uninstalled\");\r\n                }\r\n\r\n                return new List<PackageFragmentValidationResult>();\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new List<PackageFragmentValidationResult> { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex) };\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageServerFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum ServerUrlValidationResult\r\n    {\r\n        /// <exclude />\r\n        Http = 0,\r\n\r\n        /// <exclude />\r\n        Https = 1,\r\n\r\n        /// <exclude />\r\n        Invalid = 2\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PackageServerFacade \r\n\t{\r\n        private static IPackageServerFacade _packageServerFacade;\r\n\r\n\r\n        /// <exclude />\r\n        static PackageServerFacade()\r\n        {\r\n            string testFilePath = Path.Combine(PathUtil.Resolve(PathUtil.BaseDirectory), \"App_Data/Composite/PackageDescriptions.xml\");\r\n            if (C1File.Exists(testFilePath))\r\n            {\r\n                _packageServerFacade = new PackageServerFacadeLocalMock(testFilePath);\r\n            }\r\n            else\r\n            {\r\n                _packageServerFacade = new PackageServerFacadeImpl();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static IPackageServerFacade Implementation { get { return _packageServerFacade; } set { _packageServerFacade = value; } }\r\n\r\n        /// <summary>\r\n        /// Connects to the server using either https or http and \r\n        /// checks to see if it supports the needed services\r\n        /// </summary>\r\n        /// <param name=\"packageServerUrl\">\r\n        /// Cleaned url (ex: www.composite.net)\r\n        /// </param>\r\n        /// <returns>\r\n        /// </returns>\r\n        public static ServerUrlValidationResult ValidateServerUrl(string packageServerUrl)\r\n        {\r\n            return _packageServerFacade.ValidateServerUrl(packageServerUrl);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Given a cleaned url, returns a series of PackageDescriptions \r\n        /// </summary>\r\n        /// <param name=\"packageServerUrl\">\r\n        /// Cleaned url (ex: www.composite.net)\r\n        /// </param>\r\n        /// <param name=\"installationId\"></param>\r\n        /// <param name=\"userCulture\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<PackageDescription> GetPackageDescriptions(string packageServerUrl, Guid installationId, CultureInfo userCulture)\r\n        {\r\n            return _packageServerFacade.GetPackageDescriptions(packageServerUrl, installationId, userCulture);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IEnumerable<PackageDescription> GetAllPackageDescriptions(Guid installationId, CultureInfo userCulture)\r\n        {\r\n            List<IPackageServerSource> packageServerSources = DataFacade.GetData<IPackageServerSource>().ToList();\r\n\r\n            foreach (IPackageServerSource packageServerSource in packageServerSources)\r\n            {\r\n                foreach (PackageDescription packageDescription in GetPackageDescriptions(packageServerSource.Url, installationId, userCulture))\r\n                {\r\n                    yield return packageDescription;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetEulaText(string packageServerUrl, Guid eulaId, CultureInfo userCulture)\r\n        {\r\n            return _packageServerFacade.GetEulaText(packageServerUrl, eulaId, userCulture);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Stream GetInstallFileStream(string packageFileDownloadUrl)\r\n        {\r\n            return _packageServerFacade.GetInstallFileStream(packageFileDownloadUrl);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RegisterPackageInstallationCompletion(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp)\r\n        {\r\n            _packageServerFacade.RegisterPackageInstallationCompletion(packageServerUrl, installationId, packageId, localUserName, localUserIp);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RegisterPackageInstallationFailure(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp, string exceptionString)\r\n        {\r\n            _packageServerFacade.RegisterPackageInstallationFailure(packageServerUrl, installationId, packageId, localUserName, localUserIp, exceptionString);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RegisterPackageUninstall(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp)\r\n        {\r\n            _packageServerFacade.RegisterPackageUninstall(packageServerUrl, installationId, packageId, localUserName, localUserIp);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ClearServerCache()\r\n        {\r\n            _packageServerFacade.ClearCache();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageServerFacadeImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.ServiceModel;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.PackageSystem.WebServiceClient;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal sealed class PackageServerFacadeImpl : IPackageServerFacade\r\n    {\r\n        const string LogTitle = nameof(PackageServerFacade);\r\n\r\n        private readonly PackageServerFacadeImplCache _packageServerFacadeImplCache = new PackageServerFacadeImplCache();\r\n\r\n\r\n        public ServerUrlValidationResult ValidateServerUrl(string packageServerUrl)\r\n        {\r\n            try\r\n            {\r\n                var basicHttpBinding = new BasicHttpBinding\r\n                {\r\n                    MaxReceivedMessageSize = int.MaxValue,\r\n                    Security = {Mode = BasicHttpSecurityMode.Transport}\r\n                };\r\n\r\n                var client = new PackagesSoapClient(basicHttpBinding, new EndpointAddress($\"https://{packageServerUrl}\"));\r\n\r\n                client.IsOperational();\r\n                return ServerUrlValidationResult.Https;\r\n            }\r\n            catch (Exception)\r\n            {\r\n            }\r\n\r\n            try\r\n            {\r\n                var basicHttpBinding = new BasicHttpBinding { MaxReceivedMessageSize = int.MaxValue };\r\n                var client = new PackagesSoapClient(basicHttpBinding, new EndpointAddress($\"http://{packageServerUrl}\"));\r\n\r\n                client.IsOperational();\r\n                return ServerUrlValidationResult.Http;\r\n            }\r\n            catch (Exception)\r\n            {\r\n            }\r\n\r\n            return ServerUrlValidationResult.Invalid;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<PackageDescription> GetPackageDescriptions(string packageServerUrl, Guid installationId, CultureInfo userCulture)\r\n        {\r\n            List<PackageDescription> packageDescriptions = _packageServerFacadeImplCache.GetCachedPackageDescription(packageServerUrl, installationId, userCulture);\r\n            if (packageDescriptions != null) return packageDescriptions;\r\n\r\n            PackageDescriptor[] packageDescriptors = null;\r\n            try\r\n            {\r\n                PackagesSoapClient client = CreateClient(packageServerUrl);\r\n\r\n                packageDescriptors = client.GetPackageList(installationId, userCulture.ToString());\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, ex);\r\n            }\r\n\r\n            packageDescriptions = new List<PackageDescription>();\r\n            if (packageDescriptors != null)\r\n            {\r\n                foreach (var packageDescriptor in packageDescriptors)\r\n                {\r\n                    if (ValidatePackageDescriptor(packageDescriptor))\r\n                    {\r\n                        var subscriptionList = new List<Subscription>();\r\n                        if (packageDescriptor.Subscriptions !=null)\r\n                        {\r\n                            subscriptionList = packageDescriptor.Subscriptions.Select(\r\n                                f => new Subscription\r\n                                {\r\n                                    Id = f.Id,\r\n                                    Name = f.Name,\r\n                                    DetailsUrl = f.DetailsUrl,\r\n                                    Purchasable = f.Purchasable\r\n                                }).ToList();\r\n                        }\r\n\r\n                        packageDescriptions.Add(new PackageDescription\r\n                        {\r\n                            PackageFileDownloadUrl = packageDescriptor.PackageFileDownloadUrl,\r\n                            PackageVersion = packageDescriptor.PackageVersion,\r\n                            Description = packageDescriptor.Description,\r\n                            EulaId = packageDescriptor.EulaId,\r\n                            GroupName = packageDescriptor.GroupName,\r\n                            Id = packageDescriptor.Id,\r\n                            InstallationRequireLicenseFileUpdate = packageDescriptor.InstallationRequireLicenseFileUpdate,\r\n                            IsFree = packageDescriptor.IsFree,\r\n                            IsTrial = packageDescriptor.IsTrial,\r\n                            LicenseRuleId = packageDescriptor.LicenseId,\r\n                            MaxCompositeVersionSupported = packageDescriptor.MaxCompositeVersionSupported,\r\n                            MinCompositeVersionSupported = packageDescriptor.MinCompositeVersionSupported,\r\n                            Name = packageDescriptor.Name,\r\n                            PriceAmmount = packageDescriptor.PriceAmmount,\r\n                            PriceCurrency = packageDescriptor.PriceCurrency,\r\n                            ReadMoreUrl = packageDescriptor.ReadMoreUrl,\r\n                            TechicalDetails = packageDescriptor.TechicalDetails,\r\n                            TrialPeriodDays = packageDescriptor.TrialPeriodDays ?? 0,\r\n                            UpgradeAgreementMandatory = packageDescriptor.UpgradeAgreementMandatory,\r\n                            Vendor = packageDescriptor.Author,\r\n                            ConsoleBrowserUrl = packageDescriptor.ConsoleBrowserUrl,\r\n                            AvailableInSubscriptions = subscriptionList\r\n                        });\r\n                    }\r\n                }\r\n\r\n                _packageServerFacadeImplCache.AddCachedPackageDescription(packageServerUrl, installationId, userCulture, packageDescriptions);\r\n            }            \r\n\r\n            return packageDescriptions;\r\n        }\r\n\r\n\r\n\r\n        public string GetEulaText(string packageServerUrl, Guid eulaId, CultureInfo userCulture)\r\n        {\r\n            PackagesSoapClient client = CreateClient(packageServerUrl);\r\n\r\n            return client.GetEulaText(eulaId, userCulture.ToString());\r\n        }\r\n\r\n\r\n\r\n        public Stream GetInstallFileStream(string packageFileDownloadUrl)\r\n        {\r\n            Log.LogVerbose(LogTitle, $\"Downloading file: {packageFileDownloadUrl}\");\r\n\r\n            var client = new System.Net.WebClient();\r\n            return client.OpenRead(packageFileDownloadUrl);\r\n        }\r\n\r\n\r\n\r\n        public void RegisterPackageInstallationCompletion(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp)\r\n        {\r\n            PackagesSoapClient client = CreateClient(packageServerUrl);\r\n\r\n            client.RegisterPackageInstallationCompletion(installationId, packageId, localUserName, localUserIp);\r\n        }\r\n\r\n\r\n\r\n        public void RegisterPackageInstallationFailure(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp, string exceptionString)\r\n        {\r\n            PackagesSoapClient client = CreateClient(packageServerUrl);\r\n\r\n            client.RegisterPackageInstallationFailure(installationId, packageId, localUserName, localUserIp, exceptionString);\r\n        }\r\n\r\n\r\n\r\n        public void RegisterPackageUninstall(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp)\r\n        {\r\n            PackagesSoapClient client = CreateClient(packageServerUrl);\r\n\r\n            client.RegisterPackageUninstall(installationId, packageId, localUserName, localUserIp);\r\n        }\r\n\r\n\r\n\r\n        public void ClearCache()\r\n        {\r\n            _packageServerFacadeImplCache.Clear();\r\n        }\r\n\r\n\r\n\r\n        private bool ValidatePackageDescriptor(PackageDescriptor packageDescriptor)\r\n        {\r\n            string newVersion;\r\n            if (!VersionStringHelper.ValidateVersion(packageDescriptor.PackageVersion, out newVersion))\r\n            {\r\n                Log.LogWarning(LogTitle,\r\n                    $\"The package '{packageDescriptor.Name}' ({packageDescriptor.Id}) did not validate and is skipped\");\r\n                return false;\r\n            }\r\n\r\n            packageDescriptor.PackageVersion = newVersion;\r\n\r\n            if (!VersionStringHelper.ValidateVersion(packageDescriptor.MinCompositeVersionSupported, out newVersion))\r\n            {\r\n                Log.LogWarning(LogTitle,\r\n                    $\"The package '{packageDescriptor.Name}' ({packageDescriptor.Id}) did not validate and is skipped\");\r\n                return false;\r\n            }\r\n\r\n            packageDescriptor.MinCompositeVersionSupported = newVersion;\r\n\r\n            if (!VersionStringHelper.ValidateVersion(packageDescriptor.MaxCompositeVersionSupported, out newVersion))\r\n            {\r\n                Log.LogWarning(LogTitle,\r\n                    $\"The package '{packageDescriptor.Name}' ({packageDescriptor.Id}) did not validate and is skipped\");\r\n                return false;\r\n            }\r\n\r\n            packageDescriptor.MaxCompositeVersionSupported = newVersion;\r\n\r\n            return true;\r\n        }\r\n      \r\n\r\n\r\n        private PackagesSoapClient CreateClient(string packageServerUrl)\r\n        {\r\n            var timeout = TimeSpan.FromMinutes(RuntimeInformation.IsDebugBuild ? 2 : 1);\r\n\r\n            var basicHttpBinding = new BasicHttpBinding\r\n            {\r\n                CloseTimeout = timeout,\r\n                OpenTimeout = timeout,\r\n                ReceiveTimeout = timeout,\r\n                SendTimeout = timeout\r\n            };\r\n\r\n            if (packageServerUrl.StartsWith(\"https\"))\r\n            {\r\n                basicHttpBinding.Security.Mode = BasicHttpSecurityMode.Transport;\r\n            }\r\n\r\n            basicHttpBinding.MaxReceivedMessageSize = int.MaxValue;\r\n            \r\n            return new PackagesSoapClient(basicHttpBinding, new EndpointAddress(packageServerUrl));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageServerFacadeLocalMock.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.IO.Compression;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal sealed class PackageServerFacadeLocalMock : IPackageServerFacade\r\n    {\r\n        private sealed class ExtraInfo\r\n        {\r\n            public bool CanBeUninstalled { get; set; }\r\n            public SystemLockingType SystemLockingType { get; set; }\r\n            public bool FlushOnCompletion { get; set; }\r\n            public bool ReloadConsoleOnCompletion { get; set; }\r\n        }\r\n\r\n\r\n        private string _configFilePath;\r\n        private Dictionary<string, List<KeyValuePair<PackageDescription, ExtraInfo>>> _packageDescriptions = null;\r\n        private Dictionary<string, Dictionary<Guid, string>> _eulaTexts = null;\r\n\r\n\r\n        internal PackageServerFacadeLocalMock(string configFilePath)\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlush);\r\n            _configFilePath = configFilePath;\r\n        }\r\n\r\n\r\n\r\n        public ServerUrlValidationResult ValidateServerUrl(string packageServerUrl)\r\n        {\r\n            if (packageServerUrl.ToLowerInvariant().EndsWith(\"dk\")) return ServerUrlValidationResult.Http;\r\n            if (packageServerUrl.ToLowerInvariant().EndsWith(\"net\")) return ServerUrlValidationResult.Https;\r\n            if (packageServerUrl.ToLowerInvariant().EndsWith(\"xxx\")) return ServerUrlValidationResult.Invalid;\r\n\r\n            return ServerUrlValidationResult.Http;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<PackageDescription> GetPackageDescriptions(string packageServerUrl, Guid installationId, CultureInfo userCulture)\r\n        {\r\n            Initialize();\r\n\r\n            packageServerUrl = packageServerUrl.ToLowerInvariant();\r\n\r\n            if (_packageDescriptions.ContainsKey(packageServerUrl))\r\n            {\r\n                return _packageDescriptions[packageServerUrl].Select(f => f.Key);\r\n            }\r\n            else\r\n            {\r\n                return new List<PackageDescription>();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string GetEulaText(string packageServerUrl, Guid eulaId, CultureInfo userCulture)\r\n        {\r\n            Initialize();\r\n\r\n            packageServerUrl = packageServerUrl.ToLowerInvariant();\r\n\r\n            if ((_eulaTexts.ContainsKey(packageServerUrl)) &&\r\n                (_eulaTexts[packageServerUrl].ContainsKey(eulaId)))\r\n            {\r\n                return _eulaTexts[packageServerUrl][eulaId];\r\n            }\r\n            else\r\n            {\r\n                return \"SERVER NOT FOUND\";\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Stream GetInstallFileStream(string packageFileDownloadUrl)\r\n        {\r\n            Initialize();\r\n\r\n            PackageDescription packageDescription = null;\r\n            ExtraInfo extraInfo = null;\r\n            foreach (List<KeyValuePair<PackageDescription, ExtraInfo>> packageDescriptions in _packageDescriptions.Values)\r\n            {\r\n                KeyValuePair<PackageDescription, ExtraInfo>? q =\r\n                    (from desc in packageDescriptions\r\n                     where desc.Key.PackageFileDownloadUrl == packageFileDownloadUrl\r\n                     select desc).FirstOrDefault();\r\n\r\n                if (q != null)\r\n                {\r\n                    packageDescription = q.Value.Key;\r\n                    extraInfo = q.Value.Value;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            XElement rootElement =\r\n                new XElement(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageInstallerElementName),\r\n                    new XElement(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageRequirementsElementName),\r\n                        new XAttribute(PackageSystemSettings.MinimumCompositeVersionAttributeName, packageDescription.MinCompositeVersionSupported),\r\n                        new XAttribute(PackageSystemSettings.MaximumCompositeVersionAttributeName, packageDescription.MaxCompositeVersionSupported)\r\n                    ),\r\n                    new XElement(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageInformationElementName),\r\n                        new XAttribute(PackageSystemSettings.IdAttributeName, packageDescription.Id),\r\n                        new XAttribute(PackageSystemSettings.NameAttributeName, packageDescription.Name),\r\n                        new XAttribute(PackageSystemSettings.GroupNameAttributeName, packageDescription.GroupName),\r\n                        new XAttribute(PackageSystemSettings.AuthorAttributeName, packageDescription.Vendor),\r\n                        new XAttribute(PackageSystemSettings.WebsiteAttributeName, packageDescription.ReadMoreUrl),\r\n                        new XAttribute(PackageSystemSettings.VersionAttributeName, packageDescription.PackageVersion),\r\n                        new XAttribute(PackageSystemSettings.CanBeUninstalledAttributeName, extraInfo.CanBeUninstalled),\r\n                        new XAttribute(PackageSystemSettings.SystemLockingAttributeName, extraInfo.SystemLockingType.Serialize()),\r\n                        new XAttribute(PackageSystemSettings.FlushOnCompletionAttributeName, extraInfo.FlushOnCompletion),\r\n                        new XAttribute(PackageSystemSettings.ReloadConsoleOnCompletionAttributeName, extraInfo.ReloadConsoleOnCompletion),\r\n                        packageDescription.Description\r\n                    ),\r\n                    new XElement(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageFragmentInstallersElementName))\r\n                );\r\n\r\n            XDocument doc = new XDocument(rootElement);\r\n            string content = doc.GetDocumentAsString();\r\n\r\n            UTF8Encoding encoding = new UTF8Encoding();\r\n            byte[] buffer = encoding.GetBytes(content);\r\n\r\n            var outputStream = new MemoryStream();\r\n\r\n            var zipArchive = new ZipArchive(outputStream);\r\n\r\n            var zipEntry = zipArchive.CreateEntry(\"install.xml\");\r\n            using (var stream = zipEntry.Open())\r\n            {\r\n                stream.Write(buffer, 0, buffer.Length);\r\n            }\r\n\r\n            zipEntry.LastWriteTime = DateTimeOffset.Now;\r\n\r\n            outputStream.Seek(0, SeekOrigin.Begin);\r\n\r\n            return outputStream;\r\n        }\r\n\r\n\r\n\r\n        public void RegisterPackageInstallationCompletion(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp)\r\n        {\r\n            LoggingService.LogVerbose(\"PackageServerFacadeLocalMock\", string.Format(\"RegisterPackageInstallationCompletion: installationId = {0}, packageId = {1}, localUserName = {2}, localUserIp = {3}\", installationId, packageId, localUserName, localUserIp));\r\n        }\r\n\r\n\r\n\r\n        public void RegisterPackageInstallationFailure(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp, string exceptionString)\r\n        {\r\n            LoggingService.LogVerbose(\"PackageServerFacadeLocalMock\", string.Format(\"RegisterPackageInstallationFailure: installationId = {0}, packageId = {1}, localUserName = {2}, localUserIp = {3}, error = {4}\", installationId, packageId, localUserName, localUserIp, exceptionString));\r\n        }\r\n\r\n\r\n\r\n        public void RegisterPackageUninstall(string packageServerUrl, Guid installationId, Guid packageId, string localUserName, string localUserIp)\r\n        {\r\n            LoggingService.LogVerbose(\"PackageServerFacadeLocalMock\", string.Format(\"RegisterPackageUninstall: installationId = {0}, packageId = {1}, localUserName = {2}, localUserIp = {3}\", installationId, packageId, localUserName, localUserIp));\r\n        }\r\n\r\n\r\n\r\n        public void ClearCache()\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            if (_packageDescriptions == null)\r\n            {\r\n                LoadXml();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void LoadXml()\r\n        {\r\n            _packageDescriptions = new Dictionary<string, List<KeyValuePair<PackageDescription, ExtraInfo>>>();\r\n            _eulaTexts = new Dictionary<string, Dictionary<Guid, string>>();\r\n\r\n            XDocument doc = XDocumentUtils.Load(_configFilePath);\r\n\r\n            foreach (XElement element in doc.Root.Elements(\"Source\"))\r\n            {\r\n                XAttribute urlAttribute = element.Attribute(\"url\");\r\n\r\n                List<KeyValuePair<PackageDescription, ExtraInfo>> packageDescriptions = new List<KeyValuePair<PackageDescription, ExtraInfo>>();\r\n                foreach (XElement packageElement in element.Elements(\"PackageDescription\"))\r\n                {\r\n                    PackageDescription packageDescription = new PackageDescription();\r\n\r\n                    packageDescription.PackageVersion = packageElement.Attribute(\"packageVersion\").Value;\r\n                    packageDescription.PackageFileDownloadUrl = packageElement.Attribute(\"packageFileDownloadUrl\").Value;\r\n                    packageDescription.Description = packageElement.Attribute(\"description\").Value;\r\n                    packageDescription.EulaId = (Guid)packageElement.Attribute(\"eulaId\");\r\n                    packageDescription.GroupName = packageElement.Attribute(\"groupName\").Value;\r\n                    packageDescription.Id = (Guid)packageElement.Attribute(\"id\");\r\n                    packageDescription.InstallationRequireLicenseFileUpdate = (bool)packageElement.Attribute(\"installationRequireLicenseFileUpdate\");\r\n                    packageDescription.IsFree = (bool)packageElement.Attribute(\"isFree\");\r\n                    packageDescription.IsTrial = (bool)packageElement.Attribute(\"isTrial\");\r\n                    packageDescription.LicenseRuleId = (Guid)packageElement.Attribute(\"licenseRuleId\");\r\n                    packageDescription.MaxCompositeVersionSupported = packageElement.Attribute(\"maxCompositeVersionSupported\").Value;\r\n                    packageDescription.MinCompositeVersionSupported = packageElement.Attribute(\"minCompositeVersionSupported\").Value;\r\n                    packageDescription.Name = packageElement.Attribute(\"name\").Value;\r\n                    packageDescription.PriceAmmount = (decimal)packageElement.Attribute(\"priceAmmount\");\r\n                    packageDescription.PriceCurrency = packageElement.Attribute(\"priceCurrency\").Value;\r\n                    packageDescription.ReadMoreUrl = packageElement.Attribute(\"readMoreUrl\").Value;\r\n                    packageDescription.TechicalDetails = packageElement.Attribute(\"techicalDetails\").Value;\r\n                    packageDescription.TrialPeriodDays = (int)packageElement.Attribute(\"trialPeriodDays\");\r\n                    packageDescription.UpgradeAgreementMandatory = (bool)packageElement.Attribute(\"upgradeAgreementMandatory\");\r\n                    packageDescription.Vendor = packageElement.Attribute(\"vendor\").Value;\r\n                    ExtraInfo extraInfo = new ExtraInfo();\r\n\r\n                    if (packageElement.Attribute(\"canBeUninstalled\") != null) extraInfo.CanBeUninstalled = (bool)packageElement.Attribute(\"canBeUninstalled\");\r\n                    if (packageElement.Attribute(\"flushOnCompletion\") != null) extraInfo.FlushOnCompletion = (bool)packageElement.Attribute(\"flushOnCompletion\");\r\n                    if (packageElement.Attribute(\"reloadConsoleOnCompletion\") != null) extraInfo.ReloadConsoleOnCompletion = (bool)packageElement.Attribute(\"reloadConsoleOnCompletion\");\r\n\r\n                    if (packageElement.Attribute(\"systemLocking\") != null)\r\n                    {\r\n                        SystemLockingType systemLockingType;\r\n                        packageElement.Attribute(\"systemLocking\").TryDeserialize(out systemLockingType);\r\n                        extraInfo.SystemLockingType = systemLockingType;\r\n                    }\r\n\r\n                    packageDescriptions.Add(new KeyValuePair<PackageDescription, ExtraInfo>(packageDescription, extraInfo));\r\n                }\r\n\r\n                _packageDescriptions.Add(element.Attribute(\"url\").Value.ToLowerInvariant(), packageDescriptions);\r\n\r\n\r\n                Dictionary<Guid, string> eulaTexts = new Dictionary<Guid, string>();\r\n                foreach (XElement eulaTextElement in element.Elements(\"EulaText\"))\r\n                {\r\n                    eulaTexts.Add(\r\n                        (Guid)eulaTextElement.Attribute(\"id\"),\r\n                        eulaTextElement.Value\r\n                        );\r\n                }\r\n                _eulaTexts.Add(element.Attribute(\"url\").Value.ToLowerInvariant(), eulaTexts);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void OnFlush(FlushEventArgs args)\r\n        {\r\n            _packageDescriptions = null;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageSystemServices.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.C1Console.Users;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PackageSystemServices\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<PackageDescription> GetAllAvailablePackages()\r\n        {\r\n            return PackageServerFacade.GetAllPackageDescriptions(InstallationInformationFacade.InstallationId, UserSettings.CultureInfo);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PackageDescription> GetFilteredAllAvailablePackages()\r\n        {\r\n            List<InstalledPackageInformation> installedPackageInformation = PackageManager.GetInstalledPackages().ToList();\r\n\r\n            IEnumerable<PackageDescription> descriptions =\r\n                 from description in PackageServerFacade.GetAllPackageDescriptions(InstallationInformationFacade.InstallationId, UserSettings.CultureInfo)\r\n                 where installedPackageInformation.All(f => f.Id != description.Id)\r\n                 select description;\r\n\r\n            Dictionary<Guid, List<PackageDescription>> packageDescriptions = new Dictionary<Guid,List<PackageDescription>>();\r\n            foreach (PackageDescription packageDescription in descriptions)\r\n            {\r\n                if ((new Version(packageDescription.MinCompositeVersionSupported) <= RuntimeInformation.ProductVersion) &&\r\n                    (new Version(packageDescription.MaxCompositeVersionSupported) >= RuntimeInformation.ProductVersion))\r\n                {\r\n                    List<PackageDescription> decs;\r\n                    if (!packageDescriptions.TryGetValue(packageDescription.Id, out decs))\r\n                    {\r\n                        decs = new List<PackageDescription>();\r\n                        packageDescriptions.Add(packageDescription.Id, decs);\r\n                    }\r\n\r\n                    decs.Add(packageDescription);\r\n                }\r\n            }\r\n\r\n            foreach (var kvp in packageDescriptions)\r\n            {\r\n                if (kvp.Value.Count > 1)\r\n                {\r\n                    kvp.Value.Sort(delegate(PackageDescription x, PackageDescription y)\r\n                    {\r\n                        Version xVersion = new Version(x.PackageVersion);\r\n                        Version yVersion = new Version(y.PackageVersion);\r\n                        return xVersion.CompareTo(yVersion);\r\n                    });\r\n                }\r\n\r\n                yield return kvp.Value.Last();\r\n            }            \r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetPackageSourceNameByPackageId(Guid id, Guid installationId, CultureInfo userCulture)\r\n        {\r\n            List<IPackageServerSource> packageServerSources = DataFacade.GetData<IPackageServerSource>().ToList();\r\n\r\n            foreach (IPackageServerSource packageServerSource in packageServerSources)\r\n            {\r\n                PackageDescription foundPackageDescription = \r\n                    (from package in PackageServerFacade.GetPackageDescriptions(packageServerSource.Url, installationId, userCulture)\r\n                     where package.Id == id\r\n                     select package).FirstOrDefault();\r\n\r\n                if (foundPackageDescription != null)\r\n                {\r\n                    return packageServerSource.Url;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Source not found\");\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetEulaText(PackageDescription packageDescription)\r\n        {\r\n            string packageSource = PackageSystemServices.GetPackageSourceNameByPackageId(packageDescription.Id, InstallationInformationFacade.InstallationId, UserSettings.CultureInfo);\r\n\r\n            string text = PackageServerFacade.GetEulaText(packageSource, packageDescription.EulaId, UserSettings.CultureInfo);\r\n\r\n            return text;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static PackageInformation GetPackageInformationFromZipfile(string zipFilename)\r\n        {\r\n            XElement installContent;\r\n            PackageFragmentValidationResult packageFragmentValidationResult = XmlHelper.LoadInstallXml(zipFilename, out installContent);\r\n            if (packageFragmentValidationResult != null) throw new InvalidOperationException(packageFragmentValidationResult.Message);\r\n\r\n            PackageInformation packageInformation;\r\n            packageFragmentValidationResult = PackageManager.ValidatePackageInformation(installContent, out packageInformation);\r\n            if (packageFragmentValidationResult != null) throw new InvalidOperationException(packageFragmentValidationResult.Message);\r\n\r\n            return packageInformation;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageUninstaller.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Zip;\r\nusing Composite.Core.PackageSystem.Foundation;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.Transactions;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    internal sealed class PackageUninstaller : IPackageUninstaller\r\n    {\r\n        public static readonly string LogTitle = typeof (PackageUninstaller).Name;\r\n        private bool _isInitialized;\r\n        private readonly List<IPackageFragmentUninstaller> _packageFramentUninstallers = new List<IPackageFragmentUninstaller>();\r\n\r\n        private string ZipFilename { get; set; }\r\n        private string UninstallFilename { get; set; }\r\n        private string PackageInstallationDirectory { get; set; }\r\n        private string TempDirectory { get; set; }\r\n        private bool UseTransaction { get; set; }\r\n        private PackageInformation PackageInformation { get; set; }\r\n\r\n\r\n\r\n        public PackageUninstaller(string zipFilename, string uninstallFilename, string packageInstallationDirectory, string tempDirectory, bool flushOnCompletion, bool reloadConsoleOnCompletion, bool useTransaction, PackageInformation packageInformation)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(zipFilename, \"zipFilename\");\r\n            Verify.ArgumentNotNullOrEmpty(uninstallFilename, \"uninstallFilename\");\r\n            Verify.ArgumentNotNullOrEmpty(packageInstallationDirectory, \"packageInstallationDirectory\");\r\n            Verify.ArgumentNotNullOrEmpty(tempDirectory, \"tempDirectory\");\r\n\r\n            this.ZipFilename = zipFilename;\r\n            this.UninstallFilename = uninstallFilename;\r\n            this.PackageInstallationDirectory = packageInstallationDirectory;\r\n            this.TempDirectory = tempDirectory;\r\n            this.FlushOnCompletion = flushOnCompletion;\r\n            this.ReloadConsoleOnCompletion = reloadConsoleOnCompletion;\r\n            this.UseTransaction = useTransaction;\r\n            this.PackageInformation = packageInformation;\r\n        }\r\n\r\n\r\n        public bool FlushOnCompletion { get; set; }\r\n        public bool ReloadConsoleOnCompletion { get; set; }\r\n\r\n\r\n        public IEnumerable<PackageFragmentValidationResult> Validate()\r\n        {\r\n            List<PackageFragmentValidationResult> validationResult = Initialize().ToList();\r\n            if (validationResult.Count > 0)\r\n            {\r\n                return validationResult;\r\n            }\r\n\r\n            foreach (var packageFragmentUninstaller in _packageFramentUninstallers.OrderByDescending(p => p.ValidateFirst))\r\n            {\r\n                try\r\n                {\r\n                    validationResult.AddRange(packageFragmentUninstaller.Validate());\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    validationResult.Add(new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex));\r\n                }\r\n            }\r\n\r\n            return validationResult;\r\n        }\r\n        \r\n\r\n\r\n\r\n        public PackageFragmentValidationResult Uninstall(SystemLockingType systemLockingType)\r\n        {\r\n            try\r\n            {\r\n                if (systemLockingType == SystemLockingType.None)\r\n                {\r\n                    if (this.UseTransaction)\r\n                    {\r\n                        DoUninstall();\r\n                    }\r\n                    else\r\n                    {\r\n                        DoUninstallWithoutTransaction();\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    bool isSoftSystemLocking = (systemLockingType == SystemLockingType.Soft);\r\n\r\n                    string errorMessage;\r\n                    if (!ApplicationOnlineHandlerFacade.CanPutApplicationOffline(isSoftSystemLocking, out errorMessage))\r\n                    {\r\n                        return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, errorMessage);\r\n                    }\r\n\r\n                    using (ApplicationOnlineHandlerFacade.TurnOffScope(isSoftSystemLocking))\r\n                    {\r\n                        if (this.UseTransaction)\r\n                        {\r\n                            DoUninstall();\r\n                        }\r\n                        else\r\n                        {\r\n                            DoUninstallWithoutTransaction();\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, ex);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private void DoUninstall()\r\n        {\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DoUninstallWithoutTransaction();\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DoUninstallWithoutTransaction()\r\n        {\r\n            var userName = UserValidationFacade.IsLoggedIn() ? UserValidationFacade.GetUsername() : \"<system>\";\r\n            Log.LogInformation(LogTitle, $\"Uninstalling package '{PackageInformation.Name}', Id = {PackageInformation.Id}. User name: '{userName}'\");\r\n\r\n            try\r\n            {\r\n                foreach (IPackageFragmentUninstaller packageFragmentUninstaller in _packageFramentUninstallers)\r\n                {\r\n                    packageFragmentUninstaller.Uninstall();\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, ex);\r\n                throw;\r\n            }\r\n\r\n            Log.LogInformation(LogTitle, \"Package uninstalled successfully.\");\r\n        }\r\n\r\n\r\n        private IEnumerable<PackageFragmentValidationResult> Initialize()\r\n        {\r\n            if (_isInitialized) throw new InvalidOperationException(\"Initialize may only be called once\");\r\n            _isInitialized = true;\r\n\r\n            List<PackageFragmentValidationResult> result1 = LoadPackageFragmentInstallerBinaries().ToList();\r\n            if (result1.Count > 0) return result1;\r\n\r\n            XElement uninstallElement = null;\r\n            Exception exception = null;\r\n            try\r\n            {\r\n                uninstallElement = LoadXml();\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                exception = ex;\r\n            }\r\n            if (exception != null)\r\n            {\r\n                return new[] { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, exception) };\r\n            }\r\n\r\n            XElement packageFragmentUninstallersElement = uninstallElement.Element(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageFragmentUninstallersElementName));\r\n            if (packageFragmentUninstallersElement == null)\r\n            {\r\n                return new[] { new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(\"The '{0}' file is wrongly formatted\", this.UninstallFilename)) };\r\n            }\r\n            \r\n            List<PackageFragmentValidationResult> result2 = LoadPackageFramentUninstallers(packageFragmentUninstallersElement).ToList();\r\n            if (result2.Any()) return result2;\r\n\r\n            _packageFramentUninstallers.Reverse();\r\n\r\n            return new PackageFragmentValidationResult[] { };\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<PackageFragmentValidationResult> LoadPackageFragmentInstallerBinaries()\r\n        {\r\n            string binariesDirectory = Path.Combine(this.PackageInstallationDirectory, PackageSystemSettings.BinariesDirectoryName);\r\n\r\n            if (!C1Directory.Exists(binariesDirectory))\r\n            {\r\n                yield break;\r\n            }\r\n\r\n            foreach (string filename in C1Directory.GetFiles(binariesDirectory))\r\n            {\r\n                string newFilename = Path.Combine(this.TempDirectory, Path.GetFileName(filename));\r\n                C1File.Copy(filename, newFilename);\r\n\r\n                Log.LogVerbose(\"PackageUninstaller\", \"Loading package uninstaller fragment assembly '{0}'\", newFilename);\r\n\r\n                Exception exception = null;\r\n                try\r\n                {\r\n                    PackageAssemblyHandler.AddAssembly(newFilename);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    exception = ex;\r\n                }\r\n\r\n                if (exception != null)\r\n                {\r\n                    yield return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, exception);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<PackageFragmentValidationResult> LoadPackageFramentUninstallers(XElement packageFragmentInstallersElement)\r\n        {\r\n            PackageUninstallerContext packageUninstallerContext = null;\r\n\r\n            Exception exception = null;\r\n            try\r\n            {\r\n                string packageDirectory = Path.GetDirectoryName(ZipFilename);\r\n\r\n                packageUninstallerContext = new PackageUninstallerContext(new ZipFileSystem(this.ZipFilename), packageDirectory, this.PackageInformation);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                exception = ex;                \r\n            }\r\n\r\n            if (exception != null)\r\n            {\r\n                yield return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, exception);\r\n                yield break;\r\n            }\r\n\r\n            \r\n            foreach (XElement element in packageFragmentInstallersElement.Elements(XmlUtils.GetXName(PackageSystemSettings.XmlNamespace, PackageSystemSettings.PackageFragmentUninstallersAddElementName)))\r\n            {\r\n                XAttribute uninstallerTypeAttribute = element.Attribute(PackageSystemSettings.UninstallerTypeAttributeName);\r\n                if (uninstallerTypeAttribute == null) { yield return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(\"Missing attribute '{0}'\", PackageSystemSettings.UninstallerTypeAttributeName), element); continue; }\r\n\r\n                Type uninstallerType = TypeManager.TryGetType(uninstallerTypeAttribute.Value);\r\n                if (uninstallerType == null) { yield return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(\"Could not find uninstall fragment type '{0}'\", uninstallerTypeAttribute.Value), uninstallerTypeAttribute); continue; }\r\n\r\n                exception = null;\r\n                IPackageFragmentUninstaller packageFragmentUninstaller = null;\r\n                try\r\n                {\r\n                    packageFragmentUninstaller = Activator.CreateInstance(uninstallerType) as IPackageFragmentUninstaller;\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    exception = ex;\r\n                }\r\n                if (exception != null)\r\n                {\r\n                    yield return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, exception);\r\n                    continue;\r\n                }\r\n                if (packageFragmentUninstaller == null) { yield return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, string.Format(\"The type '{0}' does not implement {1}\", uninstallerTypeAttribute.Value, typeof(IPackageFragmentUninstaller)), uninstallerTypeAttribute); continue; }\r\n\r\n                try\r\n                {\r\n                    packageFragmentUninstaller.Initialize(packageUninstallerContext, element.Descendants(), element);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    exception = ex;\r\n                }\r\n                if (exception != null)\r\n                {\r\n                    yield return new PackageFragmentValidationResult(PackageFragmentValidationResultType.Fatal, exception);\r\n                    continue;\r\n                }\r\n\r\n                _packageFramentUninstallers.Add(packageFragmentUninstaller);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private XElement LoadXml()\r\n        {\r\n            XDocument doc = XDocumentUtils.Load(this.UninstallFilename);\r\n\r\n            return doc.Root;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageUninstallerContext.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Core.IO.Zip;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PackageUninstallerContext\r\n    {\r\n        private readonly Dictionary<Type, Dictionary<DataScopeIdentifier, Dictionary<CultureInfo, List<DataKeyPropertyCollection>>>> _dataPendingForDeletion \r\n            = new Dictionary<Type, Dictionary<DataScopeIdentifier, Dictionary<CultureInfo, List<DataKeyPropertyCollection>>>>();\r\n\r\n\r\n        private readonly HashSet<Type> _typesToBeDeleted = new HashSet<Type>();\r\n\r\n        internal PackageUninstallerContext(IZipFileSystem zipFileSystem, string packageDirectory, PackageInformation packageInformation)\r\n        {\r\n            Verify.ArgumentNotNull(zipFileSystem, \"zipFileSystem\");\r\n\r\n            this.ZipFileSystem = zipFileSystem;\r\n            this.PackageDirectory = packageDirectory;\r\n            this.PackageInformation = packageInformation;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IZipFileSystem ZipFileSystem { get; private set; }\r\n\r\n        /// <exclude />\r\n        public string PackageDirectory { get; private set; }\r\n\r\n        /// <exclude />\r\n        public PackageInformation PackageInformation { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddPendingForDeletionData(Type interfaceType, DataScopeIdentifier dataScopeIdentifier, CultureInfo locale, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n            Verify.ArgumentNotNull(dataScopeIdentifier, \"dataScopeIdentifier\");\r\n            Verify.ArgumentNotNull(dataKeyPropertyCollection, \"dataKeyPropertyCollection\");\r\n\r\n            List<DataKeyPropertyCollection> dataKeyPropertyCollections = GetDataKeyPropertyCollection(interfaceType, dataScopeIdentifier, locale);\r\n\r\n            if (dataKeyPropertyCollections.Contains(dataKeyPropertyCollection))\r\n            {\r\n                throw new ArgumentException(string.Format(\"The data item of type '{0}' with the key '{1}' has already been added\", interfaceType, dataKeyPropertyCollection));\r\n            }\r\n\r\n            dataKeyPropertyCollections.Add(dataKeyPropertyCollection);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsPendingForDeletionData(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            if (_typesToBeDeleted.Contains(data.DataSourceId.InterfaceType))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            DataKeyPropertyCollection dataKeyPropertyCollection = data.CreateDataKeyPropertyCollection();\r\n\r\n            return IsPendingForDeletionData(data.DataSourceId.InterfaceType, data.DataSourceId.DataScopeIdentifier, data.DataSourceId.LocaleScope, dataKeyPropertyCollection);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsPendingForDeletionData(Type interfaceType, DataScopeIdentifier dataScopeIdentifier, CultureInfo locale, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n            Verify.ArgumentNotNull(dataScopeIdentifier, \"dataScopeIdentifier\");\r\n            Verify.ArgumentNotNull(dataKeyPropertyCollection, \"dataKeyPropertyCollection\");\r\n\r\n            List<DataKeyPropertyCollection> dataKeyPropertyCollections = GetDataKeyPropertyCollection(interfaceType, dataScopeIdentifier, locale);\r\n\r\n            return dataKeyPropertyCollections.Contains(dataKeyPropertyCollection);\r\n        }\r\n\r\n\r\n\r\n        private List<DataKeyPropertyCollection> GetDataKeyPropertyCollection(Type interfaceType, DataScopeIdentifier dataScopeIdentifier, CultureInfo locale)\r\n        {\r\n            if (locale == null)\r\n            {\r\n                locale = CultureInfo.InvariantCulture;\r\n            }\r\n\r\n            return _dataPendingForDeletion\r\n                .GetOrAdd(interfaceType, () => new Dictionary<DataScopeIdentifier, Dictionary<CultureInfo, List<DataKeyPropertyCollection>>>())\r\n                .GetOrAdd(dataScopeIdentifier, () => new Dictionary<CultureInfo, List<DataKeyPropertyCollection>>())\r\n                .GetOrAdd(locale, () => new List<DataKeyPropertyCollection>());\r\n        }\r\n\r\n        internal void AddPendingForDeletionDataType(Type intefaceType)\r\n        {\r\n            _typesToBeDeleted.Add(intefaceType);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/PackageUtils.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Implementation;\r\nusing Composite.Plugins.Elements.ElementProviders.PackageElementProvider;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem\r\n{\r\n    /// <summary>\r\n    /// This class contains helper methods for handling packages\r\n    /// </summary>\r\n    public static class PackageUtils\r\n    {\r\n        /// <summary>\r\n        /// This method returns an entity token for a install package in the C1 console.\r\n        /// </summary>\r\n        /// <param name=\"packageId\">The id of the package.</param>\r\n        /// <param name=\"groupName\">The group name of the package.</param>\r\n        /// <returns>Returns an entity token for a installed package.</returns>\r\n        public static PackageElementProviderInstalledPackageItemEntityToken GetInstalledPackageEntityToken(Guid packageId, string groupName)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessPackageUtils.GetInstalledPackageEntityToken(packageId, groupName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/WebServiceClient/LicenseDefinitionServiceSoapClient.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:4.0.30319.1\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace Composite.Core.PackageSystem.WebServiceClient\r\n{\r\n    using System.Runtime.Serialization;\r\n    using System;\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Runtime.Serialization\", \"4.0.0.0\")]\r\n    [System.Runtime.Serialization.DataContractAttribute(Name = \"LicenseDefinitionDescriptor\", Namespace = \"http://www.composite.net/ns/managemen\")]\r\n    [System.SerializableAttribute()]\r\n    public partial class LicenseDefinitionDescriptor : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged\r\n    {\r\n\r\n        [System.NonSerializedAttribute()]\r\n        private System.Runtime.Serialization.ExtensionDataObject extensionDataField;\r\n\r\n        private System.Guid InstallationIdField;\r\n\r\n        private System.Guid ProductIdField;\r\n\r\n        private bool PermanentField;\r\n\r\n        private System.DateTime ExpiresField;        \r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string LicenseKeyField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string PurchaseUrlField;\r\n\r\n\r\n        /// <exclude />\r\n        [global::System.ComponentModel.BrowsableAttribute(false)]\r\n        public System.Runtime.Serialization.ExtensionDataObject ExtensionData\r\n        {\r\n            get\r\n            {\r\n                return this.extensionDataField;\r\n            }\r\n            set\r\n            {\r\n                this.extensionDataField = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true)]\r\n        public System.Guid InstallationId\r\n        {\r\n            get\r\n            {\r\n                return this.InstallationIdField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.InstallationIdField.Equals(value) != true))\r\n                {\r\n                    this.InstallationIdField = value;\r\n                    this.RaisePropertyChanged(\"InstallationId\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true)]\r\n        public System.Guid ProductId\r\n        {\r\n            get\r\n            {\r\n                return this.ProductIdField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.ProductIdField.Equals(value) != true))\r\n                {\r\n                    this.ProductIdField = value;\r\n                    this.RaisePropertyChanged(\"ProductId\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 2)]\r\n        public bool Permanent\r\n        {\r\n            get\r\n            {\r\n                return this.PermanentField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.PermanentField.Equals(value) != true))\r\n                {\r\n                    this.PermanentField = value;\r\n                    this.RaisePropertyChanged(\"Permanent\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 3)]\r\n        public System.DateTime Expires\r\n        {\r\n            get\r\n            {\r\n                return this.ExpiresField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.ExpiresField.Equals(value) != true))\r\n                {\r\n                    this.ExpiresField = value;\r\n                    this.RaisePropertyChanged(\"Expires\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 4)]\r\n        public string LicenseKey\r\n        {\r\n            get\r\n            {\r\n                return this.LicenseKeyField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.LicenseKeyField, value) != true))\r\n                {\r\n                    this.LicenseKeyField = value;\r\n                    this.RaisePropertyChanged(\"LicenseKey\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 5)]\r\n        public string PurchaseUrl\r\n        {\r\n            get\r\n            {\r\n                return this.PurchaseUrlField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.PurchaseUrlField, value) != true))\r\n                {\r\n                    this.PurchaseUrlField = value;\r\n                    this.RaisePropertyChanged(\"PurchaseUrl\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;\r\n\r\n\r\n        /// <exclude />\r\n        protected void RaisePropertyChanged(string propertyName)\r\n        {\r\n            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;\r\n            if ((propertyChanged != null))\r\n            {\r\n                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ServiceModel.ServiceContractAttribute(Namespace = \"http://www.composite.net/ns/managemen\", ConfigurationName = \"Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionServiceSoap\")]\r\n    public interface LicenseDefinitionServiceSoap\r\n    {\r\n\r\n        // CODEGEN: Generating message contract since element name publicKeyXml from namespace http://www.composite.net/ns/managemen is not marked nillable\r\n        /// <exclude />\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://www.composite.net/ns/managemen/ValidateTrialLicenseDefinitionRequest\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestResponse ValidateTrialLicenseDefinitionRequest(Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name publicKeyXml from namespace http://www.composite.net/ns/managemen is not marked nillable\r\n        /// <exclude />\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://www.composite.net/ns/managemen/GetTrialLicenseDefinition\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionResponse GetTrialLicenseDefinition(Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionRequest request);\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class ValidateTrialLicenseDefinitionRequestRequest\r\n    {\r\n        /// <exclude />\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"ValidateTrialLicenseDefinitionRequest\", Namespace = \"http://www.composite.net/ns/managemen\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestRequestBody Body;\r\n\r\n\r\n        /// <exclude />\r\n        public ValidateTrialLicenseDefinitionRequestRequest()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ValidateTrialLicenseDefinitionRequestRequest(Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/managemen\")]\r\n    public partial class ValidateTrialLicenseDefinitionRequestRequestBody\r\n    {\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid installationId;\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 1)]\r\n        public System.Guid productId;\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string publicKeyXml;\r\n\r\n\r\n        /// <exclude />\r\n        public ValidateTrialLicenseDefinitionRequestRequestBody()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ValidateTrialLicenseDefinitionRequestRequestBody(System.Guid installationId, System.Guid productId, string publicKeyXml)\r\n        {\r\n            this.installationId = installationId;\r\n            this.productId = productId;\r\n            this.publicKeyXml = publicKeyXml;\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class ValidateTrialLicenseDefinitionRequestResponse\r\n    {\r\n        /// <exclude />\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"ValidateTrialLicenseDefinitionRequestResponse\", Namespace = \"http://www.composite.net/ns/managemen\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestResponseBody Body;\r\n\r\n\r\n        /// <exclude />\r\n        public ValidateTrialLicenseDefinitionRequestResponse()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ValidateTrialLicenseDefinitionRequestResponse(Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/managemen\")]\r\n    public partial class ValidateTrialLicenseDefinitionRequestResponseBody\r\n    {\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public string ValidateTrialLicenseDefinitionRequestResult;\r\n\r\n\r\n        /// <exclude />\r\n        public ValidateTrialLicenseDefinitionRequestResponseBody()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public ValidateTrialLicenseDefinitionRequestResponseBody(string ValidateTrialLicenseDefinitionRequestResult)\r\n        {\r\n            this.ValidateTrialLicenseDefinitionRequestResult = ValidateTrialLicenseDefinitionRequestResult;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class GetTrialLicenseDefinitionRequest\r\n    {\r\n        /// <exclude />\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetTrialLicenseDefinition\", Namespace = \"http://www.composite.net/ns/managemen\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionRequestBody Body;\r\n\r\n\r\n        /// <exclude />\r\n        public GetTrialLicenseDefinitionRequest()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public GetTrialLicenseDefinitionRequest(Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/managemen\")]\r\n    public partial class GetTrialLicenseDefinitionRequestBody\r\n    {\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid installationId;\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 1)]\r\n        public System.Guid productId;\r\n\r\n\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string publicKeyXml;\r\n\r\n\r\n        /// <exclude />\r\n        public GetTrialLicenseDefinitionRequestBody()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public GetTrialLicenseDefinitionRequestBody(System.Guid installationId, System.Guid productId, string publicKeyXml)\r\n        {\r\n            this.installationId = installationId;\r\n            this.productId = productId;\r\n            this.publicKeyXml = publicKeyXml;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class GetTrialLicenseDefinitionResponse\r\n    {\r\n        /// <exclude />\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetTrialLicenseDefinitionResponse\", Namespace = \"http://www.composite.net/ns/managemen\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionResponseBody Body;\r\n\r\n\r\n        /// <exclude />\r\n        public GetTrialLicenseDefinitionResponse()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public GetTrialLicenseDefinitionResponse(Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/managemen\")]\r\n    public partial class GetTrialLicenseDefinitionResponseBody\r\n    {\r\n        /// <exclude />\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionDescriptor GetTrialLicenseDefinitionResult;\r\n\r\n\r\n        /// <exclude />\r\n        public GetTrialLicenseDefinitionResponseBody()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public GetTrialLicenseDefinitionResponseBody(Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionDescriptor GetTrialLicenseDefinitionResult)\r\n        {\r\n            this.GetTrialLicenseDefinitionResult = GetTrialLicenseDefinitionResult;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    public interface LicenseDefinitionServiceSoapChannel : Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionServiceSoap, System.ServiceModel.IClientChannel\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    public partial class LicenseDefinitionServiceSoapClient : System.ServiceModel.ClientBase<Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionServiceSoap>, Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionServiceSoap\r\n    {\r\n        /// <exclude />\r\n        public LicenseDefinitionServiceSoapClient()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public LicenseDefinitionServiceSoapClient(string endpointConfigurationName) :\r\n            base(endpointConfigurationName)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public LicenseDefinitionServiceSoapClient(string endpointConfigurationName, string remoteAddress) :\r\n            base(endpointConfigurationName, remoteAddress)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public LicenseDefinitionServiceSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :\r\n            base(endpointConfigurationName, remoteAddress)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public LicenseDefinitionServiceSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :\r\n            base(binding, remoteAddress)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestResponse Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionServiceSoap.ValidateTrialLicenseDefinitionRequest(Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestRequest request)\r\n        {\r\n            return base.Channel.ValidateTrialLicenseDefinitionRequest(request);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ValidateTrialLicenseDefinitionRequest(System.Guid installationId, System.Guid productId, string publicKeyXml)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestRequestBody();\r\n            inValue.Body.installationId = installationId;\r\n            inValue.Body.productId = productId;\r\n            inValue.Body.publicKeyXml = publicKeyXml;\r\n            Composite.Core.PackageSystem.WebServiceClient.ValidateTrialLicenseDefinitionRequestResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionServiceSoap)(this)).ValidateTrialLicenseDefinitionRequest(inValue);\r\n            return retVal.Body.ValidateTrialLicenseDefinitionRequestResult;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionResponse Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionServiceSoap.GetTrialLicenseDefinition(Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionRequest request)\r\n        {\r\n            return base.Channel.GetTrialLicenseDefinition(request);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionDescriptor GetTrialLicenseDefinition(System.Guid installationId, System.Guid productId, string publicKeyXml)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionRequestBody();\r\n            inValue.Body.installationId = installationId;\r\n            inValue.Body.productId = productId;\r\n            inValue.Body.publicKeyXml = publicKeyXml;\r\n            Composite.Core.PackageSystem.WebServiceClient.GetTrialLicenseDefinitionResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.LicenseDefinitionServiceSoap)(this)).GetTrialLicenseDefinition(inValue);\r\n            return retVal.Body.GetTrialLicenseDefinitionResult;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PackageSystem/WebServiceClient/Reference.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:4.0.30319.42000\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n#pragma warning disable 1591\r\nnamespace Composite.Core.PackageSystem.WebServiceClient\r\n{\r\n    using System.Runtime.Serialization;\r\n    using System;\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Runtime.Serialization\", \"4.0.0.0\")]\r\n    [System.Runtime.Serialization.DataContractAttribute(Name = \"PackageDescriptor\", Namespace = \"http://package.composite.net/package.asmx\")]\r\n    [System.SerializableAttribute()]\r\n    public partial class PackageDescriptor : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged\r\n    {\r\n\r\n        [System.NonSerializedAttribute()]\r\n        private System.Runtime.Serialization.ExtensionDataObject extensionDataField;\r\n\r\n        private System.Guid IdField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string GroupNameField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string NameField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string PackageVersionField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string AuthorField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string DescriptionField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string TechicalDetailsField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string ConsoleBrowserUrlField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string ReadMoreUrlField;\r\n\r\n        private bool IsTrialField;\r\n\r\n        private System.Nullable<int> TrialPeriodDaysField;\r\n\r\n        private bool IsFreeField;\r\n\r\n        private bool InstallationRequireLicenseFileUpdateField;\r\n\r\n        private decimal PriceAmmountField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string PriceCurrencyField;\r\n\r\n        private bool UpgradeAgreementMandatoryField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string MinCompositeVersionSupportedField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string MaxCompositeVersionSupportedField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private Composite.Core.PackageSystem.WebServiceClient.PackageReference[] RequiredPackagesField;\r\n\r\n        private System.Guid EulaIdField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string PackageFileDownloadUrlField;\r\n\r\n        private System.Guid LicenseIdField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string CultureField;\r\n\r\n        private System.Guid UserIdField;\r\n\r\n        private bool OnlineField;\r\n\r\n        private bool SubscriptionOnlyField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private Composite.Core.PackageSystem.WebServiceClient.SubscriptionDescriptor[] SubscriptionsField;\r\n\r\n        [global::System.ComponentModel.BrowsableAttribute(false)]\r\n        public System.Runtime.Serialization.ExtensionDataObject ExtensionData\r\n        {\r\n            get\r\n            {\r\n                return this.extensionDataField;\r\n            }\r\n            set\r\n            {\r\n                this.extensionDataField = value;\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true)]\r\n        public System.Guid Id\r\n        {\r\n            get\r\n            {\r\n                return this.IdField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.IdField.Equals(value) != true))\r\n                {\r\n                    this.IdField = value;\r\n                    this.RaisePropertyChanged(\"Id\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)]\r\n        public string GroupName\r\n        {\r\n            get\r\n            {\r\n                return this.GroupNameField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.GroupNameField, value) != true))\r\n                {\r\n                    this.GroupNameField = value;\r\n                    this.RaisePropertyChanged(\"GroupName\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return this.NameField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.NameField, value) != true))\r\n                {\r\n                    this.NameField = value;\r\n                    this.RaisePropertyChanged(\"Name\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 3)]\r\n        public string PackageVersion\r\n        {\r\n            get\r\n            {\r\n                return this.PackageVersionField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.PackageVersionField, value) != true))\r\n                {\r\n                    this.PackageVersionField = value;\r\n                    this.RaisePropertyChanged(\"PackageVersion\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 4)]\r\n        public string Author\r\n        {\r\n            get\r\n            {\r\n                return this.AuthorField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.AuthorField, value) != true))\r\n                {\r\n                    this.AuthorField = value;\r\n                    this.RaisePropertyChanged(\"Author\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 5)]\r\n        public string Description\r\n        {\r\n            get\r\n            {\r\n                return this.DescriptionField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.DescriptionField, value) != true))\r\n                {\r\n                    this.DescriptionField = value;\r\n                    this.RaisePropertyChanged(\"Description\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 6)]\r\n        public string TechicalDetails\r\n        {\r\n            get\r\n            {\r\n                return this.TechicalDetailsField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.TechicalDetailsField, value) != true))\r\n                {\r\n                    this.TechicalDetailsField = value;\r\n                    this.RaisePropertyChanged(\"TechicalDetails\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 7)]\r\n        public string ConsoleBrowserUrl\r\n        {\r\n            get\r\n            {\r\n                return this.ConsoleBrowserUrlField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.ConsoleBrowserUrlField, value) != true))\r\n                {\r\n                    this.ConsoleBrowserUrlField = value;\r\n                    this.RaisePropertyChanged(\"ConsoleBrowserUrl\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 8)]\r\n        public string ReadMoreUrl\r\n        {\r\n            get\r\n            {\r\n                return this.ReadMoreUrlField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.ReadMoreUrlField, value) != true))\r\n                {\r\n                    this.ReadMoreUrlField = value;\r\n                    this.RaisePropertyChanged(\"ReadMoreUrl\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 9)]\r\n        public bool IsTrial\r\n        {\r\n            get\r\n            {\r\n                return this.IsTrialField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.IsTrialField.Equals(value) != true))\r\n                {\r\n                    this.IsTrialField = value;\r\n                    this.RaisePropertyChanged(\"IsTrial\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 10)]\r\n        public System.Nullable<int> TrialPeriodDays\r\n        {\r\n            get\r\n            {\r\n                return this.TrialPeriodDaysField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.TrialPeriodDaysField.Equals(value) != true))\r\n                {\r\n                    this.TrialPeriodDaysField = value;\r\n                    this.RaisePropertyChanged(\"TrialPeriodDays\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 11)]\r\n        public bool IsFree\r\n        {\r\n            get\r\n            {\r\n                return this.IsFreeField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.IsFreeField.Equals(value) != true))\r\n                {\r\n                    this.IsFreeField = value;\r\n                    this.RaisePropertyChanged(\"IsFree\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 12)]\r\n        public bool InstallationRequireLicenseFileUpdate\r\n        {\r\n            get\r\n            {\r\n                return this.InstallationRequireLicenseFileUpdateField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.InstallationRequireLicenseFileUpdateField.Equals(value) != true))\r\n                {\r\n                    this.InstallationRequireLicenseFileUpdateField = value;\r\n                    this.RaisePropertyChanged(\"InstallationRequireLicenseFileUpdate\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 13)]\r\n        public decimal PriceAmmount\r\n        {\r\n            get\r\n            {\r\n                return this.PriceAmmountField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.PriceAmmountField.Equals(value) != true))\r\n                {\r\n                    this.PriceAmmountField = value;\r\n                    this.RaisePropertyChanged(\"PriceAmmount\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 14)]\r\n        public string PriceCurrency\r\n        {\r\n            get\r\n            {\r\n                return this.PriceCurrencyField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.PriceCurrencyField, value) != true))\r\n                {\r\n                    this.PriceCurrencyField = value;\r\n                    this.RaisePropertyChanged(\"PriceCurrency\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 15)]\r\n        public bool UpgradeAgreementMandatory\r\n        {\r\n            get\r\n            {\r\n                return this.UpgradeAgreementMandatoryField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.UpgradeAgreementMandatoryField.Equals(value) != true))\r\n                {\r\n                    this.UpgradeAgreementMandatoryField = value;\r\n                    this.RaisePropertyChanged(\"UpgradeAgreementMandatory\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 16)]\r\n        public string MinCompositeVersionSupported\r\n        {\r\n            get\r\n            {\r\n                return this.MinCompositeVersionSupportedField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.MinCompositeVersionSupportedField, value) != true))\r\n                {\r\n                    this.MinCompositeVersionSupportedField = value;\r\n                    this.RaisePropertyChanged(\"MinCompositeVersionSupported\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 17)]\r\n        public string MaxCompositeVersionSupported\r\n        {\r\n            get\r\n            {\r\n                return this.MaxCompositeVersionSupportedField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.MaxCompositeVersionSupportedField, value) != true))\r\n                {\r\n                    this.MaxCompositeVersionSupportedField = value;\r\n                    this.RaisePropertyChanged(\"MaxCompositeVersionSupported\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 18)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.PackageReference[] RequiredPackages\r\n        {\r\n            get\r\n            {\r\n                return this.RequiredPackagesField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.RequiredPackagesField, value) != true))\r\n                {\r\n                    this.RequiredPackagesField = value;\r\n                    this.RaisePropertyChanged(\"RequiredPackages\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 19)]\r\n        public System.Guid EulaId\r\n        {\r\n            get\r\n            {\r\n                return this.EulaIdField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.EulaIdField.Equals(value) != true))\r\n                {\r\n                    this.EulaIdField = value;\r\n                    this.RaisePropertyChanged(\"EulaId\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 20)]\r\n        public string PackageFileDownloadUrl\r\n        {\r\n            get\r\n            {\r\n                return this.PackageFileDownloadUrlField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.PackageFileDownloadUrlField, value) != true))\r\n                {\r\n                    this.PackageFileDownloadUrlField = value;\r\n                    this.RaisePropertyChanged(\"PackageFileDownloadUrl\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 21)]\r\n        public System.Guid LicenseId\r\n        {\r\n            get\r\n            {\r\n                return this.LicenseIdField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.LicenseIdField.Equals(value) != true))\r\n                {\r\n                    this.LicenseIdField = value;\r\n                    this.RaisePropertyChanged(\"LicenseId\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 22)]\r\n        public string Culture\r\n        {\r\n            get\r\n            {\r\n                return this.CultureField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.CultureField, value) != true))\r\n                {\r\n                    this.CultureField = value;\r\n                    this.RaisePropertyChanged(\"Culture\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 23)]\r\n        public System.Guid UserId\r\n        {\r\n            get\r\n            {\r\n                return this.UserIdField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.UserIdField.Equals(value) != true))\r\n                {\r\n                    this.UserIdField = value;\r\n                    this.RaisePropertyChanged(\"UserId\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 24)]\r\n        public bool Online\r\n        {\r\n            get\r\n            {\r\n                return this.OnlineField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.OnlineField.Equals(value) != true))\r\n                {\r\n                    this.OnlineField = value;\r\n                    this.RaisePropertyChanged(\"Online\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 25)]\r\n        public bool SubscriptionOnly\r\n        {\r\n            get\r\n            {\r\n                return this.SubscriptionOnlyField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.SubscriptionOnlyField.Equals(value) != true))\r\n                {\r\n                    this.SubscriptionOnlyField = value;\r\n                    this.RaisePropertyChanged(\"SubscriptionOnly\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 26)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.SubscriptionDescriptor[] Subscriptions\r\n        {\r\n            get\r\n            {\r\n                return this.SubscriptionsField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.SubscriptionsField, value) != true))\r\n                {\r\n                    this.SubscriptionsField = value;\r\n                    this.RaisePropertyChanged(\"Subscriptions\");\r\n                }\r\n            }\r\n        }\r\n\r\n        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;\r\n\r\n        protected void RaisePropertyChanged(string propertyName)\r\n        {\r\n            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;\r\n            if ((propertyChanged != null))\r\n            {\r\n                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));\r\n            }\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Runtime.Serialization\", \"4.0.0.0\")]\r\n    [System.Runtime.Serialization.DataContractAttribute(Name = \"PackageReference\", Namespace = \"http://package.composite.net/package.asmx\")]\r\n    [System.SerializableAttribute()]\r\n    public partial class PackageReference : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged\r\n    {\r\n\r\n        [System.NonSerializedAttribute()]\r\n        private System.Runtime.Serialization.ExtensionDataObject extensionDataField;\r\n\r\n        private System.Guid IdField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string NameField;\r\n\r\n        [global::System.ComponentModel.BrowsableAttribute(false)]\r\n        public System.Runtime.Serialization.ExtensionDataObject ExtensionData\r\n        {\r\n            get\r\n            {\r\n                return this.extensionDataField;\r\n            }\r\n            set\r\n            {\r\n                this.extensionDataField = value;\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true)]\r\n        public System.Guid Id\r\n        {\r\n            get\r\n            {\r\n                return this.IdField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.IdField.Equals(value) != true))\r\n                {\r\n                    this.IdField = value;\r\n                    this.RaisePropertyChanged(\"Id\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false)]\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return this.NameField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.NameField, value) != true))\r\n                {\r\n                    this.NameField = value;\r\n                    this.RaisePropertyChanged(\"Name\");\r\n                }\r\n            }\r\n        }\r\n\r\n        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;\r\n\r\n        protected void RaisePropertyChanged(string propertyName)\r\n        {\r\n            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;\r\n            if ((propertyChanged != null))\r\n            {\r\n                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));\r\n            }\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Runtime.Serialization\", \"4.0.0.0\")]\r\n    [System.Runtime.Serialization.DataContractAttribute(Name = \"SubscriptionDescriptor\", Namespace = \"http://package.composite.net/package.asmx\")]\r\n    [System.SerializableAttribute()]\r\n    public partial class SubscriptionDescriptor : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged\r\n    {\r\n\r\n        [System.NonSerializedAttribute()]\r\n        private System.Runtime.Serialization.ExtensionDataObject extensionDataField;\r\n\r\n        private System.Guid IdField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string NameField;\r\n\r\n        [System.Runtime.Serialization.OptionalFieldAttribute()]\r\n        private string DetailsUrlField;\r\n\r\n        private bool PurchasableField;\r\n\r\n        [global::System.ComponentModel.BrowsableAttribute(false)]\r\n        public System.Runtime.Serialization.ExtensionDataObject ExtensionData\r\n        {\r\n            get\r\n            {\r\n                return this.extensionDataField;\r\n            }\r\n            set\r\n            {\r\n                this.extensionDataField = value;\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true)]\r\n        public System.Guid Id\r\n        {\r\n            get\r\n            {\r\n                return this.IdField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.IdField.Equals(value) != true))\r\n                {\r\n                    this.IdField = value;\r\n                    this.RaisePropertyChanged(\"Id\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false)]\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return this.NameField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.NameField, value) != true))\r\n                {\r\n                    this.NameField = value;\r\n                    this.RaisePropertyChanged(\"Name\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string DetailsUrl\r\n        {\r\n            get\r\n            {\r\n                return this.DetailsUrlField;\r\n            }\r\n            set\r\n            {\r\n                if ((object.ReferenceEquals(this.DetailsUrlField, value) != true))\r\n                {\r\n                    this.DetailsUrlField = value;\r\n                    this.RaisePropertyChanged(\"DetailsUrl\");\r\n                }\r\n            }\r\n        }\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 3)]\r\n        public bool Purchasable\r\n        {\r\n            get\r\n            {\r\n                return this.PurchasableField;\r\n            }\r\n            set\r\n            {\r\n                if ((this.PurchasableField.Equals(value) != true))\r\n                {\r\n                    this.PurchasableField = value;\r\n                    this.RaisePropertyChanged(\"Purchasable\");\r\n                }\r\n            }\r\n        }\r\n\r\n        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;\r\n\r\n        protected void RaisePropertyChanged(string propertyName)\r\n        {\r\n            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;\r\n            if ((propertyChanged != null))\r\n            {\r\n                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));\r\n            }\r\n        }\r\n    }\r\n\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ServiceModel.ServiceContractAttribute(Namespace = \"http://package.composite.net/package.asmx\", ConfigurationName = \"Core.PackageSystem.WebServiceClient.PackagesSoap\")]\r\n    public interface PackagesSoap\r\n    {\r\n\r\n        // CODEGEN: Generating message contract since element name Culture from namespace http://package.composite.net/package.asmx is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/GetPackageList\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.GetPackageListResponse GetPackageList(Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequest request);\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/GetPackageList\", ReplyAction = \"*\")]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.GetPackageListResponse> GetPackageListAsync(Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequest request);\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/IsOperational\", ReplyAction = \"*\")]\r\n        bool IsOperational();\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/IsOperational\", ReplyAction = \"*\")]\r\n        System.Threading.Tasks.Task<bool> IsOperationalAsync();\r\n\r\n        // CODEGEN: Generating message contract since element name userCulture from namespace http://package.composite.net/package.asmx is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/GetEulaText\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.GetEulaTextResponse GetEulaText(Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequest request);\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/GetEulaText\", ReplyAction = \"*\")]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.GetEulaTextResponse> GetEulaTextAsync(Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name localUserName from namespace http://package.composite.net/package.asmx is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/RegisterPackageUninstall\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallResponse RegisterPackageUninstall(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequest request);\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/RegisterPackageUninstall\", ReplyAction = \"*\")]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallResponse> RegisterPackageUninstallAsync(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name packageName from namespace http://package.composite.net/package.asmx is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/PackageActivity\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.PackageActivityResponse PackageActivity(Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequest request);\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/PackageActivity\", ReplyAction = \"*\")]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.PackageActivityResponse> PackageActivityAsync(Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name localUserName from namespace http://package.composite.net/package.asmx is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/RequestLicenseUpdate\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateResponse RequestLicenseUpdate(Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequest request);\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/RequestLicenseUpdate\", ReplyAction = \"*\")]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateResponse> RequestLicenseUpdateAsync(Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name LocalUserName from namespace http://package.composite.net/package.asmx is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/RegisterPackageInstallationCompletion\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionResponse RegisterPackageInstallationCompletion(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequest request);\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/RegisterPackageInstallationCompletion\", ReplyAction = \"*\")]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionResponse> RegisterPackageInstallationCompletionAsync(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name LocalUserName from namespace http://package.composite.net/package.asmx is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/RegisterPackageInstallationFailure\", ReplyAction = \"*\")]\r\n        Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureResponse RegisterPackageInstallationFailure(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequest request);\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://package.composite.net/package.asmx/RegisterPackageInstallationFailure\", ReplyAction = \"*\")]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureResponse> RegisterPackageInstallationFailureAsync(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequest request);\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class GetPackageListRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetPackageList\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequestBody Body;\r\n\r\n        public GetPackageListRequest()\r\n        {\r\n        }\r\n\r\n        public GetPackageListRequest(Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class GetPackageListRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid InstallationId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)]\r\n        public string Culture;\r\n\r\n        public GetPackageListRequestBody()\r\n        {\r\n        }\r\n\r\n        public GetPackageListRequestBody(System.Guid InstallationId, string Culture)\r\n        {\r\n            this.InstallationId = InstallationId;\r\n            this.Culture = Culture;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class GetPackageListResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetPackageListResponse\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.GetPackageListResponseBody Body;\r\n\r\n        public GetPackageListResponse()\r\n        {\r\n        }\r\n\r\n        public GetPackageListResponse(Composite.Core.PackageSystem.WebServiceClient.GetPackageListResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class GetPackageListResponseBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.PackageDescriptor[] GetPackageListResult;\r\n\r\n        public GetPackageListResponseBody()\r\n        {\r\n        }\r\n\r\n        public GetPackageListResponseBody(Composite.Core.PackageSystem.WebServiceClient.PackageDescriptor[] GetPackageListResult)\r\n        {\r\n            this.GetPackageListResult = GetPackageListResult;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class GetEulaTextRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetEulaText\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequestBody Body;\r\n\r\n        public GetEulaTextRequest()\r\n        {\r\n        }\r\n\r\n        public GetEulaTextRequest(Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class GetEulaTextRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid eulaId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)]\r\n        public string userCulture;\r\n\r\n        public GetEulaTextRequestBody()\r\n        {\r\n        }\r\n\r\n        public GetEulaTextRequestBody(System.Guid eulaId, string userCulture)\r\n        {\r\n            this.eulaId = eulaId;\r\n            this.userCulture = userCulture;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class GetEulaTextResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetEulaTextResponse\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.GetEulaTextResponseBody Body;\r\n\r\n        public GetEulaTextResponse()\r\n        {\r\n        }\r\n\r\n        public GetEulaTextResponse(Composite.Core.PackageSystem.WebServiceClient.GetEulaTextResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class GetEulaTextResponseBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public string GetEulaTextResult;\r\n\r\n        public GetEulaTextResponseBody()\r\n        {\r\n        }\r\n\r\n        public GetEulaTextResponseBody(string GetEulaTextResult)\r\n        {\r\n            this.GetEulaTextResult = GetEulaTextResult;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class RegisterPackageUninstallRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RegisterPackageUninstall\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequestBody Body;\r\n\r\n        public RegisterPackageUninstallRequest()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageUninstallRequest(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class RegisterPackageUninstallRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid InstallationId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 1)]\r\n        public System.Guid PackageId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string localUserName;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 3)]\r\n        public string localUserIp;\r\n\r\n        public RegisterPackageUninstallRequestBody()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageUninstallRequestBody(System.Guid InstallationId, System.Guid PackageId, string localUserName, string localUserIp)\r\n        {\r\n            this.InstallationId = InstallationId;\r\n            this.PackageId = PackageId;\r\n            this.localUserName = localUserName;\r\n            this.localUserIp = localUserIp;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class RegisterPackageUninstallResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RegisterPackageUninstallResponse\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallResponseBody Body;\r\n\r\n        public RegisterPackageUninstallResponse()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageUninstallResponse(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute()]\r\n    public partial class RegisterPackageUninstallResponseBody\r\n    {\r\n\r\n        public RegisterPackageUninstallResponseBody()\r\n        {\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class PackageActivityRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"PackageActivity\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequestBody Body;\r\n\r\n        public PackageActivityRequest()\r\n        {\r\n        }\r\n\r\n        public PackageActivityRequest(Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class PackageActivityRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid installationId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 1)]\r\n        public System.Guid packageId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string packageName;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 3)]\r\n        public string ip;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 4)]\r\n        public int status;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 5)]\r\n        public string exception;\r\n\r\n        public PackageActivityRequestBody()\r\n        {\r\n        }\r\n\r\n        public PackageActivityRequestBody(System.Guid installationId, System.Guid packageId, string packageName, string ip, int status, string exception)\r\n        {\r\n            this.installationId = installationId;\r\n            this.packageId = packageId;\r\n            this.packageName = packageName;\r\n            this.ip = ip;\r\n            this.status = status;\r\n            this.exception = exception;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class PackageActivityResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"PackageActivityResponse\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.PackageActivityResponseBody Body;\r\n\r\n        public PackageActivityResponse()\r\n        {\r\n        }\r\n\r\n        public PackageActivityResponse(Composite.Core.PackageSystem.WebServiceClient.PackageActivityResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute()]\r\n    public partial class PackageActivityResponseBody\r\n    {\r\n\r\n        public PackageActivityResponseBody()\r\n        {\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class RequestLicenseUpdateRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RequestLicenseUpdate\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequestBody Body;\r\n\r\n        public RequestLicenseUpdateRequest()\r\n        {\r\n        }\r\n\r\n        public RequestLicenseUpdateRequest(Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class RequestLicenseUpdateRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid InstallationId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 1)]\r\n        public System.Guid PackageId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string localUserName;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 3)]\r\n        public string localUserIp;\r\n\r\n        public RequestLicenseUpdateRequestBody()\r\n        {\r\n        }\r\n\r\n        public RequestLicenseUpdateRequestBody(System.Guid InstallationId, System.Guid PackageId, string localUserName, string localUserIp)\r\n        {\r\n            this.InstallationId = InstallationId;\r\n            this.PackageId = PackageId;\r\n            this.localUserName = localUserName;\r\n            this.localUserIp = localUserIp;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class RequestLicenseUpdateResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RequestLicenseUpdateResponse\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateResponseBody Body;\r\n\r\n        public RequestLicenseUpdateResponse()\r\n        {\r\n        }\r\n\r\n        public RequestLicenseUpdateResponse(Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class RequestLicenseUpdateResponseBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public bool RequestLicenseUpdateResult;\r\n\r\n        public RequestLicenseUpdateResponseBody()\r\n        {\r\n        }\r\n\r\n        public RequestLicenseUpdateResponseBody(bool RequestLicenseUpdateResult)\r\n        {\r\n            this.RequestLicenseUpdateResult = RequestLicenseUpdateResult;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class RegisterPackageInstallationCompletionRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RegisterPackageInstallationCompletion\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequestBody Body;\r\n\r\n        public RegisterPackageInstallationCompletionRequest()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageInstallationCompletionRequest(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class RegisterPackageInstallationCompletionRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid InstallationId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 1)]\r\n        public System.Guid PackageId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string LocalUserName;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 3)]\r\n        public string localUserIp;\r\n\r\n        public RegisterPackageInstallationCompletionRequestBody()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageInstallationCompletionRequestBody(System.Guid InstallationId, System.Guid PackageId, string LocalUserName, string localUserIp)\r\n        {\r\n            this.InstallationId = InstallationId;\r\n            this.PackageId = PackageId;\r\n            this.LocalUserName = LocalUserName;\r\n            this.localUserIp = localUserIp;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class RegisterPackageInstallationCompletionResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RegisterPackageInstallationCompletionResponse\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionResponseBody Body;\r\n\r\n        public RegisterPackageInstallationCompletionResponse()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageInstallationCompletionResponse(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute()]\r\n    public partial class RegisterPackageInstallationCompletionResponseBody\r\n    {\r\n\r\n        public RegisterPackageInstallationCompletionResponseBody()\r\n        {\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class RegisterPackageInstallationFailureRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RegisterPackageInstallationFailure\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequestBody Body;\r\n\r\n        public RegisterPackageInstallationFailureRequest()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageInstallationFailureRequest(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://package.composite.net/package.asmx\")]\r\n    public partial class RegisterPackageInstallationFailureRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public System.Guid InstallationId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 1)]\r\n        public System.Guid PackageId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string LocalUserName;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 3)]\r\n        public string localUserIp;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 4)]\r\n        public string exceptionString;\r\n\r\n        public RegisterPackageInstallationFailureRequestBody()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageInstallationFailureRequestBody(System.Guid InstallationId, System.Guid PackageId, string LocalUserName, string localUserIp, string exceptionString)\r\n        {\r\n            this.InstallationId = InstallationId;\r\n            this.PackageId = PackageId;\r\n            this.LocalUserName = LocalUserName;\r\n            this.localUserIp = localUserIp;\r\n            this.exceptionString = exceptionString;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    public partial class RegisterPackageInstallationFailureResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RegisterPackageInstallationFailureResponse\", Namespace = \"http://package.composite.net/package.asmx\", Order = 0)]\r\n        public Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureResponseBody Body;\r\n\r\n        public RegisterPackageInstallationFailureResponse()\r\n        {\r\n        }\r\n\r\n        public RegisterPackageInstallationFailureResponse(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute()]\r\n    public partial class RegisterPackageInstallationFailureResponseBody\r\n    {\r\n\r\n        public RegisterPackageInstallationFailureResponseBody()\r\n        {\r\n        }\r\n    }\r\n\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    public interface PackagesSoapChannel : Composite.Core.PackageSystem.WebServiceClient.PackagesSoap, System.ServiceModel.IClientChannel\r\n    {\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    public partial class PackagesSoapClient : System.ServiceModel.ClientBase<Composite.Core.PackageSystem.WebServiceClient.PackagesSoap>, Composite.Core.PackageSystem.WebServiceClient.PackagesSoap\r\n    {\r\n\r\n        public PackagesSoapClient()\r\n        {\r\n        }\r\n\r\n        public PackagesSoapClient(string endpointConfigurationName) :\r\n                base(endpointConfigurationName)\r\n        {\r\n        }\r\n\r\n        public PackagesSoapClient(string endpointConfigurationName, string remoteAddress) :\r\n                base(endpointConfigurationName, remoteAddress)\r\n        {\r\n        }\r\n\r\n        public PackagesSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :\r\n                base(endpointConfigurationName, remoteAddress)\r\n        {\r\n        }\r\n\r\n        public PackagesSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :\r\n                base(binding, remoteAddress)\r\n        {\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.GetPackageListResponse Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.GetPackageList(Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequest request)\r\n        {\r\n            return base.Channel.GetPackageList(request);\r\n        }\r\n\r\n        public Composite.Core.PackageSystem.WebServiceClient.PackageDescriptor[] GetPackageList(System.Guid InstallationId, string Culture)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.Culture = Culture;\r\n            Composite.Core.PackageSystem.WebServiceClient.GetPackageListResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).GetPackageList(inValue);\r\n            return retVal.Body.GetPackageListResult;\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.GetPackageListResponse> Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.GetPackageListAsync(Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequest request)\r\n        {\r\n            return base.Channel.GetPackageListAsync(request);\r\n        }\r\n\r\n        public System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.GetPackageListResponse> GetPackageListAsync(System.Guid InstallationId, string Culture)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.GetPackageListRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.Culture = Culture;\r\n            return ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).GetPackageListAsync(inValue);\r\n        }\r\n\r\n        public bool IsOperational()\r\n        {\r\n            return base.Channel.IsOperational();\r\n        }\r\n\r\n        public System.Threading.Tasks.Task<bool> IsOperationalAsync()\r\n        {\r\n            return base.Channel.IsOperationalAsync();\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.GetEulaTextResponse Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.GetEulaText(Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequest request)\r\n        {\r\n            return base.Channel.GetEulaText(request);\r\n        }\r\n\r\n        public string GetEulaText(System.Guid eulaId, string userCulture)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequestBody();\r\n            inValue.Body.eulaId = eulaId;\r\n            inValue.Body.userCulture = userCulture;\r\n            Composite.Core.PackageSystem.WebServiceClient.GetEulaTextResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).GetEulaText(inValue);\r\n            return retVal.Body.GetEulaTextResult;\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.GetEulaTextResponse> Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.GetEulaTextAsync(Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequest request)\r\n        {\r\n            return base.Channel.GetEulaTextAsync(request);\r\n        }\r\n\r\n        public System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.GetEulaTextResponse> GetEulaTextAsync(System.Guid eulaId, string userCulture)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.GetEulaTextRequestBody();\r\n            inValue.Body.eulaId = eulaId;\r\n            inValue.Body.userCulture = userCulture;\r\n            return ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).GetEulaTextAsync(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallResponse Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.RegisterPackageUninstall(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequest request)\r\n        {\r\n            return base.Channel.RegisterPackageUninstall(request);\r\n        }\r\n\r\n        public void RegisterPackageUninstall(System.Guid InstallationId, System.Guid PackageId, string localUserName, string localUserIp)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.PackageId = PackageId;\r\n            inValue.Body.localUserName = localUserName;\r\n            inValue.Body.localUserIp = localUserIp;\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).RegisterPackageUninstall(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallResponse> Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.RegisterPackageUninstallAsync(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequest request)\r\n        {\r\n            return base.Channel.RegisterPackageUninstallAsync(request);\r\n        }\r\n\r\n        public System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallResponse> RegisterPackageUninstallAsync(System.Guid InstallationId, System.Guid PackageId, string localUserName, string localUserIp)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageUninstallRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.PackageId = PackageId;\r\n            inValue.Body.localUserName = localUserName;\r\n            inValue.Body.localUserIp = localUserIp;\r\n            return ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).RegisterPackageUninstallAsync(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.PackageActivityResponse Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.PackageActivity(Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequest request)\r\n        {\r\n            return base.Channel.PackageActivity(request);\r\n        }\r\n\r\n        public void PackageActivity(System.Guid installationId, System.Guid packageId, string packageName, string ip, int status, string exception)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequestBody();\r\n            inValue.Body.installationId = installationId;\r\n            inValue.Body.packageId = packageId;\r\n            inValue.Body.packageName = packageName;\r\n            inValue.Body.ip = ip;\r\n            inValue.Body.status = status;\r\n            inValue.Body.exception = exception;\r\n            Composite.Core.PackageSystem.WebServiceClient.PackageActivityResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).PackageActivity(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.PackageActivityResponse> Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.PackageActivityAsync(Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequest request)\r\n        {\r\n            return base.Channel.PackageActivityAsync(request);\r\n        }\r\n\r\n        public System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.PackageActivityResponse> PackageActivityAsync(System.Guid installationId, System.Guid packageId, string packageName, string ip, int status, string exception)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.PackageActivityRequestBody();\r\n            inValue.Body.installationId = installationId;\r\n            inValue.Body.packageId = packageId;\r\n            inValue.Body.packageName = packageName;\r\n            inValue.Body.ip = ip;\r\n            inValue.Body.status = status;\r\n            inValue.Body.exception = exception;\r\n            return ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).PackageActivityAsync(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateResponse Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.RequestLicenseUpdate(Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequest request)\r\n        {\r\n            return base.Channel.RequestLicenseUpdate(request);\r\n        }\r\n\r\n        public bool RequestLicenseUpdate(System.Guid InstallationId, System.Guid PackageId, string localUserName, string localUserIp)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.PackageId = PackageId;\r\n            inValue.Body.localUserName = localUserName;\r\n            inValue.Body.localUserIp = localUserIp;\r\n            Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).RequestLicenseUpdate(inValue);\r\n            return retVal.Body.RequestLicenseUpdateResult;\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateResponse> Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.RequestLicenseUpdateAsync(Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequest request)\r\n        {\r\n            return base.Channel.RequestLicenseUpdateAsync(request);\r\n        }\r\n\r\n        public System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateResponse> RequestLicenseUpdateAsync(System.Guid InstallationId, System.Guid PackageId, string localUserName, string localUserIp)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.RequestLicenseUpdateRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.PackageId = PackageId;\r\n            inValue.Body.localUserName = localUserName;\r\n            inValue.Body.localUserIp = localUserIp;\r\n            return ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).RequestLicenseUpdateAsync(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionResponse Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.RegisterPackageInstallationCompletion(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequest request)\r\n        {\r\n            return base.Channel.RegisterPackageInstallationCompletion(request);\r\n        }\r\n\r\n        public void RegisterPackageInstallationCompletion(System.Guid InstallationId, System.Guid PackageId, string LocalUserName, string localUserIp)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.PackageId = PackageId;\r\n            inValue.Body.LocalUserName = LocalUserName;\r\n            inValue.Body.localUserIp = localUserIp;\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).RegisterPackageInstallationCompletion(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionResponse> Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.RegisterPackageInstallationCompletionAsync(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequest request)\r\n        {\r\n            return base.Channel.RegisterPackageInstallationCompletionAsync(request);\r\n        }\r\n\r\n        public System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionResponse> RegisterPackageInstallationCompletionAsync(System.Guid InstallationId, System.Guid PackageId, string LocalUserName, string localUserIp)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationCompletionRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.PackageId = PackageId;\r\n            inValue.Body.LocalUserName = LocalUserName;\r\n            inValue.Body.localUserIp = localUserIp;\r\n            return ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).RegisterPackageInstallationCompletionAsync(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureResponse Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.RegisterPackageInstallationFailure(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequest request)\r\n        {\r\n            return base.Channel.RegisterPackageInstallationFailure(request);\r\n        }\r\n\r\n        public void RegisterPackageInstallationFailure(System.Guid InstallationId, System.Guid PackageId, string LocalUserName, string localUserIp, string exceptionString)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.PackageId = PackageId;\r\n            inValue.Body.LocalUserName = LocalUserName;\r\n            inValue.Body.localUserIp = localUserIp;\r\n            inValue.Body.exceptionString = exceptionString;\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureResponse retVal = ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).RegisterPackageInstallationFailure(inValue);\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureResponse> Composite.Core.PackageSystem.WebServiceClient.PackagesSoap.RegisterPackageInstallationFailureAsync(Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequest request)\r\n        {\r\n            return base.Channel.RegisterPackageInstallationFailureAsync(request);\r\n        }\r\n\r\n        public System.Threading.Tasks.Task<Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureResponse> RegisterPackageInstallationFailureAsync(System.Guid InstallationId, System.Guid PackageId, string LocalUserName, string localUserIp, string exceptionString)\r\n        {\r\n            Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequest inValue = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequest();\r\n            inValue.Body = new Composite.Core.PackageSystem.WebServiceClient.RegisterPackageInstallationFailureRequestBody();\r\n            inValue.Body.InstallationId = InstallationId;\r\n            inValue.Body.PackageId = PackageId;\r\n            inValue.Body.LocalUserName = LocalUserName;\r\n            inValue.Body.localUserIp = localUserIp;\r\n            inValue.Body.exceptionString = exceptionString;\r\n            return ((Composite.Core.PackageSystem.WebServiceClient.PackagesSoap)(this)).RegisterPackageInstallationFailureAsync(inValue);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Foundation/IPageTemplateProviderRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Core.PageTemplates.Foundation\r\n{\r\n    internal interface IPageTemplateProviderRegistry\r\n    {\r\n        void Flush();\r\n        void FlushTemplates();\r\n\r\n        IEnumerable<string> ProviderNames { get; }\r\n        IEnumerable<PageTemplateDescriptor> PageTemplates { get; }\r\n\r\n        IPageTemplateProvider GetProviderByTemplateId(Guid pageTemplateId);\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Foundation/PageTemplateProviderRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\n\r\nnamespace Composite.Core.PageTemplates.Foundation\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PageTemplateProviderRegistry\r\n    {\r\n        private static readonly IPageTemplateProviderRegistry _registry = new PageTemplateProviderRegistryImpl();\r\n\r\n        static PageTemplateProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => _registry.Flush());\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> ProviderNames\r\n        {\r\n            get { return _registry.ProviderNames; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PageTemplateDescriptor> PageTemplates\r\n        {\r\n            get { return _registry.PageTemplates; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IPageTemplateProvider GetProviderByTemplateId(Guid pageTemplateId)\r\n        {\r\n            return _registry.GetProviderByTemplateId(pageTemplateId);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Flushes list of registered page templates\r\n        /// </summary>\r\n        public static void FlushTemplates()\r\n        {\r\n            _registry.FlushTemplates();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Foundation/PageTemplateProviderRegistryImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.PageTemplates.Plugins.Runtime;\r\nusing Composite.Core.PageTemplates.Foundation.PluginFacade;\r\n\r\nnamespace Composite.Core.PageTemplates.Foundation\r\n{\r\n    internal class PageTemplateProviderRegistryImpl : IPageTemplateProviderRegistry\r\n    {\r\n        private readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitialize);\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n        public void FlushTemplates()\r\n        {\r\n            var resources = _resourceLocker.Resources;\r\n\r\n            foreach (var providerName in resources.ProviderNames)\r\n            {\r\n                var provider = PageTemplateProviderPluginFacade.GetProvider(providerName);\r\n                provider.FlushTemplates();\r\n            }\r\n\r\n            resources.ResetTemplatesCache();\r\n        }\r\n\r\n        public IEnumerable<string> ProviderNames\r\n        {\r\n            get\r\n            {\r\n                return _resourceLocker.Resources.ProviderNames;\r\n            }\r\n        }\r\n\r\n        private static IEnumerable<string> GetProviderNames()\r\n        {\r\n            var settings = ConfigurationServices.ConfigurationSource.GetSection(PageTemplateProviderSettings.SectionName)\r\n                               as PageTemplateProviderSettings;\r\n\r\n            return settings.PageTemplateProviders.Select(provider => provider.Name).ToList();\r\n        }\r\n\r\n\r\n        public IEnumerable<PageTemplateDescriptor> PageTemplates\r\n        {\r\n            get \r\n            {\r\n                return _resourceLocker.Resources.Templates.PageTemplates;\r\n            }\r\n        }\r\n\r\n        public IPageTemplateProvider GetProviderByTemplateId(Guid pageTemplateId)\r\n        {\r\n            return _resourceLocker.Resources.Templates.ProviderByTemplate[pageTemplateId];\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public IEnumerable<string> ProviderNames { get; private set; }\r\n            private volatile TemplatesCache _state;\r\n\r\n            public TemplatesCache Templates\r\n            {\r\n                get { \r\n                    var state = _state;\r\n                    if (state != null) return state;\r\n\r\n                    lock(this)\r\n                    {\r\n                        state = _state ?? InitializePageTemplatesCache();\r\n\r\n                        _state = state;\r\n                    }\r\n\r\n                    return state;\r\n                }\r\n            }\r\n\r\n            public class TemplatesCache\r\n            {\r\n                public IEnumerable<PageTemplateDescriptor> PageTemplates { get; set; }\r\n                public Hashtable<Guid, IPageTemplateProvider> ProviderByTemplate { get; set; }\r\n            }\r\n\r\n            public void ResetTemplatesCache()\r\n            {\r\n                _state = null;\r\n            }\r\n\r\n            private TemplatesCache InitializePageTemplatesCache()\r\n            {\r\n                var pageTemplates = new List<PageTemplateDescriptor>();\r\n                var providerByTemplate = new Hashtable<Guid, IPageTemplateProvider>();\r\n\r\n                foreach (string providerName in this.ProviderNames)\r\n                {\r\n                    var provider = PageTemplateProviderPluginFacade.GetProvider(providerName);\r\n                    var templates = provider.GetPageTemplates().ToList();\r\n\r\n                    pageTemplates.AddRange(templates);\r\n\r\n                    foreach (var template in templates)\r\n                    {\r\n                        Verify.That(!providerByTemplate.ContainsKey(template.Id),\r\n                                    \"There are muliple layouts with the same ID: '{0}'\", template.Id);\r\n\r\n                        providerByTemplate.Add(template.Id, provider);\r\n                    }\r\n                }\r\n\r\n                return new TemplatesCache { PageTemplates = pageTemplates, ProviderByTemplate = providerByTemplate };\r\n            }\r\n\r\n            public static void DoInitialize(Resources resources)\r\n            {\r\n                resources.ProviderNames = GetProviderNames();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Foundation/PluginFacade/PageTemplateProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.PageTemplates.Plugins.Runtime;\r\nusing Composite.C1Console.Events;\r\n\r\nnamespace Composite.Core.PageTemplates.Foundation.PluginFacade\r\n{\r\n    internal static class PageTemplateProviderPluginFacade\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n        static PageTemplateProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n        public static IPageTemplateProvider GetProvider(string providerName) {\r\n            var resources  = _resourceLocker;\r\n\r\n            IPageTemplateProvider result = resources.Resources.ProviderCache[providerName];\r\n\r\n            if (result == null)\r\n            {\r\n                using (resources.Locker)\r\n                {\r\n                    result = resources.Resources.ProviderCache[providerName];\r\n                    if (result == null)\r\n                    {\r\n                        result = resources.Resources.Factory.Create(providerName);\r\n                        resources.Resources.ProviderCache.Add(providerName, result);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        internal static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            const string sectionName = PageTemplateProviderSettings.SectionName;\r\n\r\n            throw new ConfigurationErrorsException(\r\n                \"Failed to load the configuration section '{0}' from the configuration.\".FormatWith(sectionName), \r\n                ex);\r\n        }      \r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public PageTemplateProviderFactory Factory { get; set; }\r\n            public Hashtable<string, IPageTemplateProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new PageTemplateProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Hashtable<string, IPageTemplateProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/IPageRenderer.cs",
    "content": "using System.Xml.Linq;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// This class is responsible for rendering the provided job onto the provided ASP.NET Web Forms page. \r\n    /// The AttachToPage method is called at page construction  and is expected to hook on to asp.net page events (like PreInit) to drive the rendering. \r\n    /// </summary>\r\n    public interface IPageRenderer\r\n    {\r\n        /// <summary>\r\n        /// Attaches rendering code to an instance of <c cref=\"System.Web.UI.Page\"></c>.\r\n        /// </summary>\r\n        /// <param name=\"renderTarget\">The render target.</param>\r\n        /// <param name=\"contentToRender\">The render job.</param>\r\n        void AttachToPage(System.Web.UI.Page renderTarget, PageContentToRender contentToRender);\r\n    }\r\n\r\n    /// <summary>\r\n    /// A page renderer that does not rely of request being handled by ASP.NET Web Forms\r\n    /// and does not support UserControl functions\r\n    /// </summary>\r\n    public interface ISlimPageRenderer : IPageRenderer\r\n    {\r\n        /// <summary>\r\n        /// Rendering the content into an <c cref=\"XDocument\" />.\r\n        /// </summary>\r\n        /// <param name=\"contentToRender\">The render job.</param>\r\n        /// <param name=\"functionContextContainer\">The function context container.</param>\r\n        XDocument Render(PageContentToRender contentToRender, \r\n                         FunctionContextContainer functionContextContainer);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/IPageTemplate.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Basic interface for classes that represent a page template\r\n    /// </summary>\r\n    public interface IPageTemplate\r\n    {\r\n        /// <summary>\r\n        /// Gets the template id.\r\n        /// </summary>\r\n        Guid TemplateId { get; }\r\n\r\n        /// <summary>\r\n        /// Gets the template title.\r\n        /// </summary>\r\n        string TemplateTitle { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/IPageTemplateProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.PageTemplates.Plugins.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Defines page template provider\r\n    /// </summary>\r\n    [CustomFactory(typeof(PageTemplateProviderCustomFactory))]\r\n    public interface IPageTemplateProvider\r\n    {\r\n        /// <summary>\r\n        /// Gets the page template descriptors.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        IEnumerable<PageTemplateDescriptor> GetPageTemplates();\r\n\r\n        /// <summary>\r\n        /// Factory that give C1 CMS a IPageLayouter capable of rendering a C1 CMS page with the specified layout ID.\r\n        /// The factory will be called for each individual page rendering \r\n        /// </summary>\r\n        /// <returns></returns>\r\n        IPageRenderer BuildPageRenderer(Guid templateId);\r\n\r\n        /// <summary>\r\n        /// Adds element actions on \"Page templates\" element\r\n        /// </summary>\r\n        IEnumerable<ElementAction> GetRootActions();\r\n\r\n        /// <summary>\r\n        /// Forces provider to reload all the page templates next time they are requested.\r\n        /// </summary>\r\n        void FlushTemplates();\r\n\r\n        /// <summary>\r\n        /// Provider's label that is shown when adding a new page template\r\n        /// </summary>\r\n        string AddNewTemplateLabel { get;  }\r\n\r\n        /// <summary>\r\n        /// Workflow for adding a new page template\r\n        /// </summary>\r\n        Type AddNewTemplateWorkflow { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/ISharedCodePageTemplateProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Represents a page template provider with shared code files\r\n    /// </summary>\r\n    public interface ISharedCodePageTemplateProvider: IPageTemplateProvider\r\n    {\r\n        /// <summary>\r\n        /// Gets the list of shared files, those files will be shown in a \"Shared code\" folder under \"Layout/Page Templates\"\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        IEnumerable<SharedFile> GetSharedFiles();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/PageContentToRender.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Describe the page and content desired to be rendered.\r\n    /// </summary>\r\n    public class PageContentToRender\r\n    {\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"PageContentToRender\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        /// <param name=\"contents\">The contents.</param>\r\n        /// <param name=\"isPreview\">if set to <c>true</c> the page should be rendered in preview mode.</param>\r\n        public PageContentToRender(IPage page, IEnumerable<IPagePlaceholderContent> contents, bool isPreview)\r\n        {\r\n            this.Page = page;\r\n            this.Contents = contents;\r\n            this.IsPreview = isPreview;\r\n        }\r\n\r\n        /// <summary>\r\n        /// The page to be rendered \r\n        /// </summary>\r\n        public IPage Page { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Determines whether page is rendered in a preview mode\r\n        /// </summary>\r\n        public bool IsPreview { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Page placeholders' content\r\n        /// </summary>\r\n        public IEnumerable<IPagePlaceholderContent> Contents { get; private set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/PageTemplateDescriptor.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Describes a page layout to the C1 CMS core so it may set up editing UI\r\n    /// </summary>\r\n    public class PageTemplateDescriptor\r\n    {\r\n        /// <summary>\r\n        /// Used to identify page layouts. The value has to be unique for each page template.\r\n        /// </summary>\r\n        public Guid Id { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the title.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The title.\r\n        /// </value>\r\n        /// \r\n        public string Title { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the placeholder descriptions.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The placeholder descriptions.\r\n        /// </value>\r\n        public virtual IEnumerable<PlaceholderDescriptor> PlaceholderDescriptions { get; set; }\r\n\r\n        /// <summary>\r\n        /// The default is the placeholder to focus/use when users edit a page or a layout is used in ad hoc renderings.\r\n        /// </summary>\r\n        public virtual string DefaultPlaceholderId { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets an exception that occurred during loading the template.\r\n        /// </summary>\r\n        public virtual Exception LoadingException { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets a value indicating whether page template is loaded correctly.\r\n        /// Not valid templates should not be used in data as they can not be used in rendering and their IDs may not be valid.\r\n        /// </summary>\r\n        /// <value>\r\n        ///   <c>true</c> if template is loaded; otherwise, <c>false</c>.\r\n        /// </value>\r\n        public virtual bool IsValid\r\n        {\r\n            get { return LoadingException == null; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the entity token.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public virtual EntityToken GetEntityToken()\r\n        {\r\n            return new PageTemplateEntityToken(Id);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Appends actions to a visual element.\r\n        /// </summary>\r\n        public virtual IEnumerable<ElementAction> GetActions()\r\n        {\r\n            return new ElementAction[0];\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/PageTemplateEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider;\r\nusing Newtonsoft.Json;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n\r\n    /// <summary>\r\n    /// Entity token of a page template\r\n    /// </summary>\r\n    [SecurityAncestorProvider(typeof(PageTemplateEntityTokenSecurityAncestorProvider))]\r\n    public sealed class PageTemplateEntityToken : EntityToken\r\n    {\r\n        private readonly string _id;\r\n\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"PageTemplateEntityToken\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"templateId\">The template id.</param>\r\n        public PageTemplateEntityToken(Guid templateId)\r\n        {\r\n            _id = templateId.ToString();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the template id.\r\n        /// </summary>\r\n        [JsonIgnore]\r\n        public Guid TemplateId\r\n        {\r\n            get { return new Guid(_id); }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            string type, source, id;\r\n\r\n            EntityToken.DoDeserialize(serializedData, out type, out source, out id);\r\n\r\n            return new PageTemplateEntityToken(new Guid(id));\r\n        }\r\n    }\r\n\r\n    internal sealed class PageTemplateEntityTokenSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            return new [] { new PageTemplateRootEntityToken() };\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/PageTemplates/PageTemplateFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.PageTemplates.Foundation.PluginFacade;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Facade for accessing page templates\r\n    /// </summary>\r\n    public static class PageTemplateFacade\r\n    {\r\n        /// <summary>\r\n        /// Gets the page templates.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static IEnumerable<PageTemplateDescriptor> GetPageTemplates()\r\n        {\r\n            var result = new List<PageTemplateDescriptor>();\r\n\r\n            foreach (string providerName in PageTemplateProviderRegistry.ProviderNames)\r\n            {\r\n                var provider = PageTemplateProviderPluginFacade.GetProvider(providerName);\r\n\r\n                var templates = provider.GetPageTemplates();\r\n\r\n                result.AddRange(templates);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the shared files.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static IEnumerable<SharedFile> GetSharedFiles()\r\n        {\r\n            var result = new List<SharedFile>();\r\n\r\n            foreach (string providerName in PageTemplateProviderRegistry.ProviderNames)\r\n            {\r\n                var provider = PageTemplateProviderPluginFacade.GetProvider(providerName);\r\n\r\n                if(provider is ISharedCodePageTemplateProvider)\r\n                {\r\n                    var sharedFiles = (provider as ISharedCodePageTemplateProvider).GetSharedFiles();\r\n                    result.AddRange(sharedFiles);\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds the page renderer.\r\n        /// </summary>\r\n        /// <param name=\"pageTemplateId\">The page template id.</param>\r\n        /// <returns></returns>\r\n        public static IPageRenderer BuildPageRenderer(Guid pageTemplateId)\r\n        {\r\n            var provider = PageTemplateProviderRegistry.GetProviderByTemplateId(pageTemplateId);\r\n\r\n            Verify.IsNotNull(provider, \"Failed to get page template with id '{0}'. The template may contain errors preventing it to compile. Check the C1 CMS log for possible compilation errors.\", pageTemplateId);\r\n\r\n            return provider.BuildPageRenderer(pageTemplateId);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the page template.\r\n        /// </summary>\r\n        /// <param name=\"pageTemplateId\">The page template id.</param>\r\n        /// <returns></returns>\r\n        public static PageTemplateDescriptor GetPageTemplate(Guid pageTemplateId)\r\n        {\r\n            var provider = PageTemplateProviderRegistry.GetProviderByTemplateId(pageTemplateId);\r\n\r\n            if(provider == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return provider.GetPageTemplates().FirstOrDefault(t => t.Id == pageTemplateId);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns <c>true</c> is there's at least one valid page template.\r\n        /// </summary>\r\n        public static bool ValidTemplateExists\r\n        {\r\n            get\r\n            {\r\n                return GetPageTemplates().Any(template => template.IsValid);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the providers.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        internal static IEnumerable<KeyValuePair<string, IPageTemplateProvider>> GetProviders()\r\n        {\r\n            foreach (string providerName in PageTemplateProviderRegistry.ProviderNames)\r\n            {\r\n                var provider = PageTemplateProviderPluginFacade.GetProvider(providerName);\r\n\r\n                yield return new KeyValuePair<string, IPageTemplateProvider>(providerName, provider);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/PlaceholderAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Defines a placeholder property\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]\r\n    public class PlaceholderAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Placeholder's ID. If this parameter is not set, the property name will be the ID\r\n        /// </summary>\r\n        public string Id { get; set; }\r\n\r\n        /// <summary>\r\n        /// Placeholder's label. Is used f.e. in EditPageWorkflow\r\n        /// </summary>\r\n        public string Title { get; set; }\r\n\r\n        /// <summary>\r\n        /// A comma seperated list of container class names. These class names are used to filter Component options in editors and to style the editing area.\r\n        /// </summary>\r\n        public string ContainerClasses { get; set; }\r\n\r\n        /// <summary>\r\n        /// Determines whether current placeholder is the default placeholder\r\n        /// </summary>\r\n        public bool IsDefault { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/PlaceholderDescriptor.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Describe a placeholder on a page template.\r\n    /// </summary>\r\n    public class PlaceholderDescriptor\r\n    {\r\n        /// <summary>\r\n        /// Used to identify a layout placeholder. This has to be unique only within a page template.\r\n        /// </summary>\r\n        public string Id { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the title.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The title.\r\n        /// </value>\r\n        public string Title { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// List of container class names. Used to clasify the placeholder to attach css classes to editor and to filter components\r\n        /// </summary>\r\n        public IList<string> ContainerClasses { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Plugins/NonConfigurablePageTemplateProvider.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nnamespace Composite.Core.PageTemplates.Plugins\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Assembler(typeof(NonConfigurablePageTemplateProviderAssembler))]\r\n    public class NonConfigurablePageTemplateProvider : PageTemplateProviderData\r\n    {\r\n    }\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class NonConfigurablePageTemplateProviderAssembler : IAssembler<IPageTemplateProvider, PageTemplateProviderData>\r\n    {\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IPageTemplateProvider Assemble(IBuilderContext context, PageTemplateProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IPageTemplateProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Plugins/PageTemplateProviderData.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Core.PageTemplates.Plugins\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PageTemplateProviderData : NameTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Plugins/Runtime/PageTemplateProviderCustomFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Core.PageTemplates.Plugins.Runtime\r\n{\r\n    internal sealed class PageTemplateProviderCustomFactory : AssemblerBasedCustomFactory<IPageTemplateProvider, PageTemplateProviderData>\r\n    {\r\n        protected override PageTemplateProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            string sectionName = PageTemplateProviderSettings.SectionName;\r\n\r\n            PageTemplateProviderSettings settings = configurationSource.GetSection(sectionName) as PageTemplateProviderSettings;\r\n\r\n            if (settings == null)\r\n            {\r\n                throw new ConfigurationErrorsException(\"The configuration section '{0}' was not found in the configuration\".FormatWith(sectionName));\r\n            }\r\n\r\n            return settings.PageTemplateProviders.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Plugins/Runtime/PageTemplateProviderDefaultNameRetriever.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Core.PageTemplates.Plugins.Runtime\r\n{\r\n    internal sealed class PageTemplateProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Plugins/Runtime/PageTemplateProviderFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.Core.PageTemplates.Plugins.Runtime\r\n{\r\n    internal class PageTemplateProviderFactory:  NameTypeFactoryBase<IPageTemplateProvider>\r\n    {\r\n        public PageTemplateProviderFactory()            \r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/Plugins/Runtime/PageTemplateProviderSettings.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing System.Configuration;\r\n\r\nnamespace Composite.Core.PageTemplates.Plugins.Runtime\r\n{\r\n    internal class PageTemplateProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Core.PageTemplates.Plugins.PageTemplateProviderConfiguration\";\r\n\r\n        private const string _pageTemplateProvidersProperty = \"PageTemplateProviders\";\r\n        [ConfigurationProperty(_pageTemplateProvidersProperty, IsRequired = true)]\r\n        public NameTypeConfigurationElementCollection<PageTemplateProviderData, PageTemplateProviderData> PageTemplateProviders\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeConfigurationElementCollection<PageTemplateProviderData, PageTemplateProviderData>)base[_pageTemplateProvidersProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/SharedFile.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Contains information about a code file shared between page template.\r\n    /// </summary>\r\n    public class SharedFile\r\n    {\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"SharedFile\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"relativeFilePath\">The relative file path.</param>\r\n        public SharedFile(string relativeFilePath)\r\n        {\r\n            RelativeFilePath = relativeFilePath;\r\n            DefaultEditAction = true;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Full path to the code file.\r\n        /// </summary>\r\n        public string RelativeFilePath { get; set; }\r\n\r\n        /// <summary>\r\n        /// Indicating whether the default edit action should be shown.\r\n        /// </summary>\r\n        public bool DefaultEditAction { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the custom element actions.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public virtual IEnumerable<ElementAction> GetActions()\r\n        {\r\n            return new ElementAction[0];\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/PageTemplates/TemplateDefinitionHelper.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.RichContent.ContainerClasses;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Core.PageTemplates\r\n{\r\n    /// <summary>\r\n    /// Helper class for working with page template definitions based on <see cref=\"IPageTemplate\"/>\r\n    /// </summary>\r\n    public static class TemplateDefinitionHelper\r\n    {\r\n        /// <summary>\r\n        /// Builds a page template descriptor. Extracts template's properties and content placeholder properties.\r\n        /// </summary>\r\n        /// <param name=\"templateDefinition\">The template definition.</param>\r\n        /// <param name=\"descriptorConstructor\">The descriptor constructor.</param>\r\n        /// <param name=\"placeholderProperties\">The placeholder properties.</param>\r\n        /// <returns></returns>\r\n        public static DescriptorType BuildPageTemplateDescriptor<DescriptorType>(IPageTemplate templateDefinition,\r\n                                           Func<DescriptorType> descriptorConstructor,\r\n                                           out IDictionary<string, PropertyInfo> placeholderProperties)\r\n            where DescriptorType : PageTemplateDescriptor\r\n        {\r\n            Verify.ArgumentNotNull(templateDefinition, \"templateDefinition\");\r\n            Verify.ArgumentNotNull(descriptorConstructor, \"descriptorConstructor\");\r\n\r\n            DescriptorType pageTemplate = descriptorConstructor();\r\n            Verify.ArgumentCondition(pageTemplate != null, \"descriptorConstructor\", \"Not null object expected\");\r\n\r\n            if (templateDefinition.TemplateId == null || templateDefinition.TemplateId == Guid.Empty)\r\n            {\r\n                throw new InvalidOperationException(\"TemplateId has not been correctly defined\");\r\n            }\r\n\r\n            pageTemplate.Id = templateDefinition.TemplateId;\r\n            pageTemplate.Title = templateDefinition.TemplateTitle;\r\n\r\n            string defaultPlaceholderId = null;\r\n\r\n            var placeholders = new List<PlaceholderDescriptor>();\r\n            placeholderProperties = new Dictionary<string, PropertyInfo>();\r\n\r\n            var type = templateDefinition.GetType();\r\n\r\n            while (type.GetInterfaces().Contains(typeof(IPageTemplate)))\r\n            {\r\n                foreach (var property in type.GetProperties())\r\n                {\r\n                    if(property.ReflectedType != property.DeclaringType) continue;\r\n\r\n                    var placeholderAttributes = property.GetCustomAttributes(typeof(PlaceholderAttribute), true);\r\n                    if (placeholderAttributes.Length == 0) continue;\r\n\r\n                    Verify.That(placeholderAttributes.Length == 1, $\"Multiple '{typeof(PlaceholderAttribute)}' attributes defined on property '{property.Name}'\");\r\n\r\n                    var placeholderAttribute = (PlaceholderAttribute)placeholderAttributes[0];\r\n\r\n                    string placeholderId = placeholderAttribute.Id ?? property.Name;\r\n                    string placeholderLabel = placeholderAttribute.Title ?? property.Name;\r\n\r\n                    if (placeholderProperties.ContainsKey(placeholderId))\r\n                    {\r\n                        throw new InvalidOperationException(\"Placeholder '{0}' defined multiple times\".FormatWith(placeholderId));\r\n                    }\r\n\r\n                    var containerClasses = ContainerClassManager.ParseToList(placeholderAttribute.ContainerClasses).ToList();\r\n\r\n                    placeholderProperties.Add(placeholderId, property);\r\n                    placeholders.Add(new PlaceholderDescriptor { Id = placeholderId, Title = placeholderLabel, ContainerClasses = containerClasses });\r\n                    \r\n\r\n                    if (placeholderAttribute.IsDefault)\r\n                    {\r\n                        Verify.IsNull(defaultPlaceholderId, \"More than one placeholder is marked as default\");\r\n\r\n                        defaultPlaceholderId = placeholderId;\r\n                    }\r\n                }\r\n\r\n                type = type.BaseType;\r\n            }\r\n\r\n            if (defaultPlaceholderId == null && placeholders.Any())\r\n            {\r\n                defaultPlaceholderId = placeholders.First().Id;\r\n            }\r\n\r\n            pageTemplate.DefaultPlaceholderId = defaultPlaceholderId;\r\n            pageTemplate.PlaceholderDescriptions = placeholders;\r\n\r\n            return pageTemplate;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Binds placeholders' content to the related properties on a template definition\r\n        /// </summary>\r\n        /// <param name=\"template\">The template.</param>\r\n        /// <param name=\"pageContentToRender\">The page rendering job.</param>\r\n        /// <param name=\"placeholderProperties\">The placeholder properties.</param>\r\n        /// <param name=\"functionContextContainer\">The function context container, if not null, nested functions fill be evaluated.</param>\r\n        public static void BindPlaceholders(IPageTemplate template, \r\n                                     PageContentToRender pageContentToRender,\r\n                                     IDictionary<string, PropertyInfo> placeholderProperties,\r\n                                     FunctionContextContainer functionContextContainer)\r\n        {\r\n            Verify.ArgumentNotNull(template, \"template\");\r\n            Verify.ArgumentNotNull(pageContentToRender, \"pageContentToRender\");\r\n            Verify.ArgumentNotNull(placeholderProperties, \"placeholderProperties\");\r\n\r\n            foreach (var placeholderContent in pageContentToRender.Contents)\r\n            {\r\n                string placeholderId = placeholderContent.PlaceHolderId;\r\n\r\n                if (!placeholderProperties.ContainsKey(placeholderId)) continue;\r\n\r\n                XhtmlDocument placeholderXhtml = PageRenderer.ParsePlaceholderContent(placeholderContent);\r\n\r\n                if (functionContextContainer != null)\r\n                {\r\n                    bool allFunctionsExecuted;\r\n\r\n                    using (Profiler.Measure($\"Evaluating placeholder '{placeholderId}'\"))\r\n                    {\r\n                        allFunctionsExecuted = PageRenderer.ExecuteCacheableFunctions(placeholderXhtml.Root, functionContextContainer);\r\n                    }\r\n\r\n                    if (allFunctionsExecuted)\r\n                    {\r\n                        using (Profiler.Measure(\"Normalizing XHTML document\"))\r\n                        {\r\n                            PageRenderer.NormalizeXhtmlDocument(placeholderXhtml);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                PageRenderer.ResolveRelativePaths(placeholderXhtml);\r\n\r\n                PropertyInfo property = placeholderProperties[placeholderId];\r\n\r\n                if (!property.ReflectedType.IsInstanceOfType(template))\r\n                {\r\n                    string propertyName = property.Name;\r\n                    property = template.GetType().GetProperty(property.Name);\r\n                    Verify.IsNotNull(property, \"Failed to find placeholder property '{0}'\", propertyName);\r\n                }\r\n\r\n                property.SetValue(template, placeholderXhtml);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Parallelization/AsyncLock.cs",
    "content": "﻿using System;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace Composite.Core.Parallelization\r\n{\r\n    internal sealed class AsyncLock\r\n    {\r\n        private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);\r\n        private readonly Task<IDisposable> _releaser;\r\n\r\n        public AsyncLock()\r\n        {\r\n            _releaser = Task.FromResult((IDisposable)new Releaser(this));\r\n        }\r\n\r\n        public Task<IDisposable> LockAsync()\r\n        {\r\n            var wait = _semaphore.WaitAsync();\r\n            return wait.IsCompleted ?\r\n                        _releaser :\r\n                        wait.ContinueWith((_, state) => (IDisposable)state, \r\n                            _releaser.Result, CancellationToken.None,\r\n                            TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);\r\n        }\r\n\r\n        public IDisposable Lock()\r\n        {\r\n            _semaphore.Wait();\r\n\r\n            return new Releaser(this);\r\n        }\r\n\r\n        public bool Wait(int millisecondsTimeout)\r\n        {\r\n            return _semaphore.Wait(millisecondsTimeout);\r\n        }\r\n\r\n        public Task<bool> WaitAsync(int millisecondsTimeout)\r\n        {\r\n            return _semaphore.WaitAsync(millisecondsTimeout);\r\n        }\r\n\r\n        public void Release()\r\n        {\r\n            _semaphore.Release();\r\n        }\r\n\r\n        private sealed class Releaser : IDisposable\r\n        {\r\n            private readonly AsyncLock _toRelease;\r\n\r\n            internal Releaser(AsyncLock toRelease)\r\n            {\r\n                _toRelease = toRelease;\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                _toRelease.Release();\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~Releaser()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Parallelization/Foundation/IParallelizationProviderRegistry.cs",
    "content": "﻿namespace Composite.Core.Parallelization.Foundation\r\n{\r\n\tinternal interface IParallelizationProviderRegistry\r\n\t{\r\n        string[] DisabledParallelizationPoints { get; }\r\n        //string DefaultParallelizationProviderName { get; }\r\n        bool Enabled { get; }\r\n        void Flush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Parallelization/Foundation/ParallelizationProviderRegistry.cs",
    "content": "﻿using Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.Parallelization.Foundation\r\n{\r\n\tinternal static class ParallelizationProviderRegistry\r\n\t{\r\n        private static IParallelizationProviderRegistry _implementation = new ParallelizationProviderRegistryImpl();\r\n\r\n\r\n        internal static IParallelizationProviderRegistry Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        static ParallelizationProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        public static bool Enabled\r\n        {\r\n            get\r\n            {\r\n                return _implementation.Enabled;\r\n            }\r\n        }\r\n\r\n\r\n        public static string[] DisabledParallelizationPoints\r\n        {\r\n            get\r\n            {\r\n                return _implementation.DisabledParallelizationPoints;\r\n            }\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _implementation.Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Parallelization/Foundation/ParallelizationProviderRegistryImpl.cs",
    "content": "﻿using System.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Parallelization.Plugins.Runtime;\r\n\r\n\r\nnamespace Composite.Core.Parallelization.Foundation\r\n{\r\n    internal sealed class ParallelizationProviderRegistryImpl : IParallelizationProviderRegistry\r\n\t{\r\n        // private string _defaultParallelizationProviderName = null;\r\n        private string[] _disabledParallelizationPoints = null;\r\n\r\n        private bool? _enabled = null;\r\n\r\n\r\n        //public string DefaultParallelizationProviderName\r\n        //{\r\n        //    get \r\n        //    {\r\n        //        if (_defaultParallelizationProviderName == null)                   \r\n        //        {\r\n        //            ParallelizationProviderSettings parallelizationProviderSettings = ConfigurationServices.ConfigurationSource.GetSection(ParallelizationProviderSettings.SectionName) as ParallelizationProviderSettings;\r\n\r\n        //            _defaultParallelizationProviderName = parallelizationProviderSettings.DefaultParallelizationProviderName;\r\n        //        }\r\n\r\n        //        return _defaultParallelizationProviderName;\r\n        //    }\r\n        //}\r\n\r\n        public string[] DisabledParallelizationPoints\r\n        {\r\n            get\r\n            {\r\n                if (_disabledParallelizationPoints == null)\r\n                {\r\n                    var parallelizationProviderSettings = ConfigurationServices.ConfigurationSource.GetSection(ParallelizationProviderSettings.SectionName) as ParallelizationProviderSettings;\r\n                    if (parallelizationProviderSettings != null \r\n                        && parallelizationProviderSettings.Parallelization != null)\r\n                    {\r\n                        var parConfigNode = parallelizationProviderSettings.Parallelization;\r\n\r\n                        _disabledParallelizationPoints = (from ParallelizationSettingsElement configElement in parConfigNode\r\n                                                          where !configElement.Enabled\r\n                                                          select configElement.Name).ToArray();\r\n                    }\r\n                    else\r\n                    {\r\n                        _disabledParallelizationPoints = new string[0];\r\n                    }\r\n                }\r\n                return _disabledParallelizationPoints;\r\n            }\r\n        }\r\n\r\n        public bool Enabled\r\n        {\r\n            get\r\n            {\r\n                bool? enabled = _enabled;\r\n                if (enabled == null)\r\n                {\r\n                    var parallelizationProviderSettings = ConfigurationServices.ConfigurationSource.GetSection(ParallelizationProviderSettings.SectionName) as ParallelizationProviderSettings;\r\n                    if(parallelizationProviderSettings == null)\r\n                    {\r\n                        enabled = false;\r\n                    }\r\n                    else\r\n                    {\r\n                        enabled = parallelizationProviderSettings.Parallelization.Enabled;\r\n                    }\r\n                    _enabled = enabled;\r\n                }\r\n                return (bool)enabled;\r\n            }\r\n        }\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _enabled = null;\r\n            _disabledParallelizationPoints = null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Parallelization/IndexEnumerator.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Core.Parallelization\r\n{\r\n    [Obsolete(\"To be removed.\")]\r\n    internal class IndexEnumerator: IEnumerable<int>\r\n    {\r\n        private readonly int _elementsCount;\r\n\r\n        public IndexEnumerator(int elementsCount)\r\n        {\r\n            _elementsCount = elementsCount;\r\n        }\r\n\r\n        public IEnumerator<int> GetEnumerator()\r\n        {\r\n            for(int i = 0; i < _elementsCount; i++)\r\n            {\r\n                yield return i;\r\n            }\r\n        }\r\n\r\n        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()\r\n        {\r\n            for (int i = 0; i < _elementsCount; i++)\r\n            {\r\n                yield return i;\r\n            }\r\n        }\r\n\r\n        public int Count\r\n        {\r\n            get { return _elementsCount; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Parallelization/ParallelFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Security.Principal;\r\nusing System.Threading;\r\nusing System.Web;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Data;\r\nusing Composite.Core.Parallelization.Foundation;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Extensions;\r\nusing System.Threading.Tasks;\r\n\r\n\r\nnamespace Composite.Core.Parallelization\r\n{\r\n    /// <summary>\r\n    /// Allows running tasks in parallel while passing C1 data context to created tasks\r\n    /// </summary>\r\n\tpublic static class ParallelFacade\r\n\t{\r\n        private static readonly FieldInfo HttpContext_ItemsFieldInfo = typeof(HttpContext).GetField(\"_items\", BindingFlags.NonPublic | BindingFlags.Instance);\r\n\r\n        private static bool ParralelizationPointEnabled(string parallelizationPointName)\r\n        {\r\n            return !ParallelizationProviderRegistry.DisabledParallelizationPoints.Any(name => name == parallelizationPointName);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes a for (For in Visual Basic) loop in which iterations may run in parallel.\r\n        /// </summary>\r\n        /// <param name=\"fromInclusive\">The start index, inclusive.</param>\r\n        /// <param name=\"toExclusive\">The end index, exclusive.</param>\r\n        /// <param name=\"body\">The delegate that is invoked once per iteration.</param>\r\n        public static void For(int fromInclusive, int toExclusive, Action<int> body)\r\n        {\r\n            For(null, fromInclusive, toExclusive, body);\r\n        }\r\n\r\n        internal static void For(string parallelizationPointName, int fromInclusive, int toExclusive, Action<int> body)\r\n        {\r\n            int count = toExclusive - fromInclusive;\r\n\r\n            if(count <= 0) return;\r\n\r\n            if(count == 1)\r\n            {\r\n                body(fromInclusive);\r\n                return;\r\n            }\r\n\r\n            if (ParallelizationProviderRegistry.Enabled \r\n                && (parallelizationPointName.IsNullOrEmpty() || ParralelizationPointEnabled(parallelizationPointName)))\r\n            {\r\n                EnsureHttpContextItemsCollectionIsThreadSafe();\r\n\r\n                using (Profiler.Measure(GetPerformanceMeasureTitle(parallelizationPointName)))\r\n                {\r\n                    ThreadDataManagerData parentData = ThreadDataManager.Current;\r\n\r\n                    var threadWrapper = new ThreadWrapper<int>(body, parentData);\r\n\r\n                    PromoteThreadAbortException(() =>\r\n                    {\r\n                        Parallel.For(fromInclusive, toExclusive, threadWrapper.WrapperAction);\r\n                    });\r\n                }\r\n            }\r\n            else\r\n            {\r\n                for (int i=fromInclusive; i < toExclusive; i++)\r\n                {\r\n                    body(i);\r\n                }\r\n            }\r\n        }\r\n\r\n        internal static void ForEach<TSource>(string parallelizationPointName, IEnumerable<TSource> source, Action<TSource> body)\r\n        {\r\n            Verify.ArgumentNotNull(source, \"source\");\r\n\r\n            if (source is TSource[])\r\n            {\r\n                int elementsCount = (source as TSource[]).Length;\r\n                if (elementsCount == 0) return;\r\n                if (elementsCount == 1)\r\n                {\r\n                    body((source as TSource[])[0]);\r\n                    return;\r\n                }\r\n            } else if(source is ICollection<TSource>)\r\n            {\r\n                int elementsCount = (source as ICollection<TSource>).Count;\r\n                if (elementsCount == 0) return;\r\n                if(elementsCount == 1)\r\n                {\r\n                    body((source as ICollection<TSource>).First());\r\n                    return;\r\n                }\r\n            }\r\n\r\n            if (ParallelizationProviderRegistry.Enabled  \r\n                && (string.IsNullOrEmpty(parallelizationPointName) || ParralelizationPointEnabled(parallelizationPointName)))\r\n            {\r\n                EnsureHttpContextItemsCollectionIsThreadSafe();\r\n\r\n                using (Profiler.Measure(GetPerformanceMeasureTitle(parallelizationPointName)))\r\n                {\r\n                    ThreadDataManagerData parentData = ThreadDataManager.Current;\r\n\r\n                    var threadWrapper = new ThreadWrapper<TSource>(body, parentData);\r\n\r\n                    PromoteThreadAbortException(() =>\r\n                    {\r\n                        Parallel.ForEach(source, threadWrapper.WrapperAction);\r\n                    });\r\n                }\r\n            }\r\n            else\r\n            {\r\n                foreach (var s in source)\r\n                {\r\n                    body(s);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static void EnsureHttpContextItemsCollectionIsThreadSafe()\r\n        {\r\n            var context = HttpContext.Current;\r\n            if (context == null) return;\r\n\r\n            var items = context.Items;\r\n\r\n            if(items is Hashtable && items.GetType() == typeof(Hashtable))\r\n            {\r\n                object synchronizedCollection = Hashtable.Synchronized((Hashtable) items);\r\n\r\n                HttpContext_ItemsFieldInfo?.SetValue(context, synchronizedCollection);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes a foreach (For Each in Visual Basic) operation on an IEnumerable in which iterations may run in parallel.\r\n        /// </summary>\r\n        /// <typeparam name=\"TSource\">The type of the data in the source.</typeparam>\r\n        /// <param name=\"source\">An enumerable data source.</param>\r\n        /// <param name=\"body\">The delegate that is invoked once per iteration.</param>\r\n        public static void ForEach<TSource>(IEnumerable<TSource> source, Action<TSource> body)\r\n        {\r\n            ForEach(null, source, body);\r\n        }\r\n\r\n        private sealed class ThreadWrapper<TSource>\r\n        {\r\n            private readonly Action<TSource> _body;\r\n            private readonly ThreadDataManagerData _parentData;\r\n            private readonly CultureInfo _parentThreadLocale;\r\n            private readonly DataScopeIdentifier _parentThreadDataScope;\r\n            private readonly HttpContext _parentThreadHttpContext;\r\n            private readonly IPrincipal _parentThreadPrincipal;\r\n\r\n            private readonly CultureInfo _parentThreadCulture;\r\n            private readonly CultureInfo _parentThreadUiCulture;\r\n\r\n            public ThreadWrapper(Action<TSource> body, ThreadDataManagerData parentData)\r\n            {\r\n                _body = body;\r\n                _parentData = parentData;\r\n\r\n                _parentThreadLocale = LocalizationScopeManager.CurrentLocalizationScope;\r\n                _parentThreadDataScope = DataScopeManager.CurrentDataScope;\r\n                _parentThreadHttpContext = HttpContext.Current;\r\n                _parentThreadPrincipal = Thread.CurrentPrincipal;\r\n\r\n                var currentThread = System.Threading.Thread.CurrentThread;\r\n\r\n                _parentThreadCulture = currentThread.CurrentCulture;\r\n                _parentThreadUiCulture = currentThread.CurrentUICulture;\r\n            }\r\n\r\n            public void WrapperAction(TSource source)\r\n            {\r\n                var originalHttpContext = HttpContext.Current;\r\n\r\n                bool dataScopePushed = false;\r\n                bool languageScopePushed = false;\r\n\r\n                var currentThread = System.Threading.Thread.CurrentThread;\r\n\r\n                CultureInfo originalCulture = currentThread.CurrentCulture;\r\n                CultureInfo originalUiCulture = currentThread.CurrentUICulture;\r\n                var originalPrincipal = Thread.CurrentPrincipal;\r\n                \r\n                using (ThreadDataManager.Initialize(_parentData))\r\n                {\r\n                    try\r\n                    {\r\n                        DataScopeManager.EnterThreadLocal();\r\n\r\n                        if (DataScopeManager.CurrentDataScope != _parentThreadDataScope)\r\n                        {\r\n                            DataScopeManager.PushDataScope(_parentThreadDataScope);\r\n                            dataScopePushed = true;\r\n                        }\r\n\r\n                        LocalizationScopeManager.EnterThreadLocal();\r\n\r\n                        if (LocalizationScopeManager.CurrentLocalizationScope != _parentThreadLocale)\r\n                        {\r\n                            LocalizationScopeManager.PushLocalizationScope(_parentThreadLocale);\r\n                            languageScopePushed = true;\r\n                        }\r\n\r\n                        DataServiceScopeManager.EnterThreadLocal();\r\n\r\n                        HttpContext.Current = _parentThreadHttpContext;\r\n\r\n                        currentThread.CurrentCulture = _parentThreadCulture;\r\n                        currentThread.CurrentUICulture = _parentThreadUiCulture;\r\n                        Thread.CurrentPrincipal = _parentThreadPrincipal;\r\n\r\n                        try\r\n                        {\r\n                            _body(source);\r\n                        }\r\n                        catch(ThreadAbortException threadAbort)\r\n                        {\r\n                            object state = threadAbort.ExceptionState;\r\n                        \r\n                            if(state != null)\r\n                            {\r\n                                Thread.ResetAbort();\r\n\r\n                                // Throwing another exception because Thread.ResetAbort clears ThreadAbortException.ExceptionState\r\n                                throw new RethrowableThreadAbortException(state);\r\n                            }\r\n                        }\r\n\r\n                    }\r\n                    finally\r\n                    {\r\n                        currentThread.CurrentCulture = originalCulture;\r\n                        currentThread.CurrentUICulture = originalUiCulture;\r\n                        Thread.CurrentPrincipal = originalPrincipal;\r\n\r\n                        HttpContext.Current = originalHttpContext;\r\n\r\n                        if (dataScopePushed)\r\n                        {\r\n                            DataScopeManager.PopDataScope();\r\n                        }\r\n                        if (languageScopePushed)\r\n                        {\r\n                            LocalizationScopeManager.PopLocalizationScope();\r\n                        }\r\n\r\n                        DataScopeManager.ExitThreadLocal();\r\n                        LocalizationScopeManager.ExitThreadLocal();\r\n                        DataServiceScopeManager.ExitThreadLocal();\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void PromoteThreadAbortException(ThreadStart action)\r\n        {\r\n            try\r\n            {\r\n                action();\r\n            }\r\n            catch (AggregateException aggregateException)\r\n            {\r\n                var evaluatedListOfExceptions = aggregateException.Flatten().InnerExceptions.ToList();\r\n\r\n                foreach (var innerException in evaluatedListOfExceptions)\r\n                {\r\n                    var threadAbort = innerException as RethrowableThreadAbortException;\r\n\r\n                    if (threadAbort != null)\r\n                    {\r\n                        // ToString will mark aggregateException as handled, so TPL will not tear down the whole application\r\n                        aggregateException.ToString();\r\n\r\n                        threadAbort.Rethrow();\r\n                    }\r\n                }\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n        private class RethrowableThreadAbortException : Exception\r\n        {\r\n            private object _exceptionState { get; set; }\r\n\r\n            public RethrowableThreadAbortException(object exceptionState)\r\n            {\r\n                _exceptionState = exceptionState;\r\n            }\r\n\r\n            public void Rethrow()\r\n            {\r\n                Thread.CurrentThread.Abort(_exceptionState);\r\n            }\r\n        }\r\n\r\n        private static string GetPerformanceMeasureTitle(string parallelizationPointName)\r\n        {\r\n            return (parallelizationPointName ?? \"<unnamed node>\") + \" [parallelization point]\";\r\n        }\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Parallelization/Plugins/Runtime/ParallelizationProviderSettings.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Parallelization.Plugins.Runtime\r\n{\r\n    internal sealed class ParallelizationProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Core.Parallelization.Plugins.ParallelizationProviderConfiguration\";\r\n\r\n        private const string _parallelizationElementName = \"Parallelization\";\r\n        [ConfigurationProperty(_parallelizationElementName)]\r\n        public ParallelizationConfigurationElement Parallelization\r\n        {\r\n            get { return (ParallelizationConfigurationElement)base[_parallelizationElementName]; }\r\n            set { base[_parallelizationElementName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class ParallelizationConfigurationElement : ConfigurationElementCollection\r\n    {\r\n        private const string _enabledPropertyName = \"enabled\";\r\n        [ConfigurationProperty(_enabledPropertyName, DefaultValue = \"true\")]\r\n        public bool Enabled\r\n        {\r\n            get { return (bool)base[_enabledPropertyName]; }\r\n            set { base[_enabledPropertyName] = value; }\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new ParallelizationSettingsElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            var parallelPointSettings = (ParallelizationSettingsElement)element;\r\n            return parallelPointSettings.Name;\r\n        }\r\n    }\r\n\r\n    internal sealed class ParallelizationSettingsElement : ConfigurationElement\r\n    {\r\n        private const string _namePropertyName = \"name\";\r\n        [ConfigurationProperty(_namePropertyName)]\r\n        public string Name\r\n        {\r\n            get { return (string)base[_namePropertyName]; }\r\n            set { base[_namePropertyName] = value; }\r\n        }\r\n\r\n        private const string _enabledPropertyName = \"enabled\";\r\n        [ConfigurationProperty(_enabledPropertyName, DefaultValue = \"true\")]\r\n        public bool Enabled\r\n        {\r\n            get { return (bool)base[_enabledPropertyName]; }\r\n            set { base[_enabledPropertyName] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Foundation/PluginFacades/ResourceProviderPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem.Plugins.ResourceProvider;\r\nusing Composite.Core.ResourceSystem.Plugins.ResourceProvider.Runtime;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Foundation.PluginFacades\r\n{\r\n    internal static class ResourceProviderPluginFacade\r\n    {\r\n        const string ApplicationNameReference = \"{applicationname}\";\r\n\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize, false);\r\n\r\n        static ResourceProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n        #region ILocalizationProvider methods\r\n\r\n        private static IEnumerable<ILocalizationProvider> GetLocalizationProviders()\r\n        {\r\n            foreach (string localizationProviderName in ResourceProviderRegistry.LocalizationProviderNames)\r\n            {\r\n                yield return GetResourceProvider<ILocalizationProvider>(localizationProviderName);\r\n            }\r\n        }\r\n\r\n        public static bool LocalizationSectionDefined(string section)\r\n        {\r\n            return GetLocalizationProviders().Any(p => p.GetSections().Contains(section));\r\n        }\r\n\r\n\r\n        public static IEnumerable<string> GetLocalizationSectionNames()\r\n        {\r\n            return GetLocalizationProviders().SelectMany(p => p.GetSections()).Distinct().ToList();\r\n        } \r\n\r\n        \r\n        public static string GetStringValue(string section, string stringId)\r\n        {\r\n            return GetStringValue(section, stringId, Thread.CurrentThread.CurrentUICulture);\r\n        }\r\n\r\n\r\n        public static string GetStringValue(string section, string stringId, CultureInfo cultureInfo)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(section, \"section\");\r\n            Verify.ArgumentNotNullOrEmpty(stringId, \"stringId\");\r\n\r\n            foreach(var provider in GetLocalizationProviders())\r\n            {\r\n                var result = provider.GetString(section, stringId, cultureInfo);\r\n                if(result != null)\r\n                {\r\n                    return ReplaceReferences(result);\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        private static string ReplaceReferences(string localizedString)\r\n        {\r\n            if (localizedString == null) return null;\r\n\r\n            if (localizedString.IndexOf(ApplicationNameReference, 0, StringComparison.Ordinal) > -1)\r\n            {\r\n                localizedString = localizedString.Replace(ApplicationNameReference, GlobalSettingsFacade.ApplicationName);\r\n            }\r\n\r\n            return localizedString;\r\n        }\r\n\r\n\r\n        public static IEnumerable<CultureInfo> GetSupportedStringCultures()\r\n        {\r\n            List<CultureInfo> cultures = new List<CultureInfo>();\r\n\r\n            foreach (string providerName in ResourceProviderRegistry.LocalizationProviderNames)\r\n            {\r\n                ILocalizationProvider provider = GetResourceProvider<ILocalizationProvider>(providerName);\r\n\r\n                cultures.AddRange(provider.GetSupportedCultures());\r\n            }\r\n\r\n            return cultures.Distinct();\r\n        }\r\n\r\n\r\n\r\n        public static IDictionary<string, string> GetAllStrings(string section)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(section, \"section\");\r\n\r\n            var currentCulture = Thread.CurrentThread.CurrentUICulture;\r\n\r\n            IDictionary<string, string> result = null;\r\n\r\n            foreach (var localizationProvider in GetLocalizationProviders())\r\n            {\r\n                var strings = localizationProvider.GetAllStrings(section, currentCulture);\r\n                if (strings == null) continue;\r\n\r\n                result = result ?? new Dictionary<string, string>();\r\n                foreach(var kvp in strings)\r\n                {\r\n                    if(!result.ContainsKey(kvp.Key))\r\n                    {\r\n                        result.Add(kvp.Key, ReplaceReferences(kvp.Value));\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        public static Type GetProviderType(string providerName)\r\n        {\r\n            IResourceProvider resourceProvider = GetResourceProvider(providerName);\r\n\r\n            return resourceProvider.GetType();\r\n        }\r\n\r\n\r\n\r\n        private static T GetResourceProvider<T>(string providerName)\r\n            where T : class, IResourceProvider\r\n        {\r\n            T provider = GetResourceProvider(providerName) as T;\r\n\r\n            Verify.IsNotNull(provider, \"The Resource Provider identified by the specified provider name ('{0}') does not implement the interface {1}\"\r\n                                       .FormatWith(providerName, typeof(T)));\r\n\r\n            return provider;\r\n        }\r\n\r\n\r\n\r\n        private static IResourceProvider GetResourceProvider(string providerName)\r\n        {\r\n            IResourceProvider provider;\r\n\r\n            if (_resourceLocker.Resources.ProviderCache.TryGetValue(providerName, out provider) == false)\r\n            {\r\n                try\r\n                {\r\n                    provider = _resourceLocker.Resources.Factory.Create(providerName);\r\n\r\n                    using (_resourceLocker.Locker)\r\n                    {\r\n                        if (_resourceLocker.Resources.ProviderCache.ContainsKey(providerName) == false)\r\n                            _resourceLocker.Resources.ProviderCache.Add(providerName, provider);\r\n                    }\r\n\r\n                }\r\n                catch (ArgumentException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n            return provider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", ResourceProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public ResourceProviderFactory Factory { get; set; }\r\n            public Dictionary<string, IResourceProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new ResourceProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Dictionary<string, IResourceProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Foundation/ResourceProviderRegistry.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem.Foundation.PluginFacades;\r\nusing Composite.Core.ResourceSystem.Plugins.ResourceProvider;\r\nusing Composite.Core.ResourceSystem.Plugins.ResourceProvider.Runtime;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Plugins.ResourceSystem.AggregationLocalizationProvider;\r\n\r\nnamespace Composite.Core.ResourceSystem.Foundation\r\n{\r\n    internal static class ResourceProviderRegistry\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize, false);\r\n        private static readonly string LogTitle = typeof (ResourceProviderRegistry).Name;\r\n\r\n\r\n        static ResourceProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(a => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> StringResourceProviderNames\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.StringResourceProviders;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static IEnumerable<string> LocalizationProviderNames\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.LocalizationProviders;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public List<string> StringResourceProviders;\r\n            public List<string> LocalizationProviders;\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.StringResourceProviders = new List<string>();\r\n                resources.LocalizationProviders = new List<string>();\r\n\r\n                var configurationSource = ConfigurationServices.ConfigurationSource;\r\n                if (configurationSource == null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                var section = configurationSource.GetSection(ResourceProviderSettings.SectionName);\r\n                if (section == null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                var configuration = (ResourceProviderSettings)section;\r\n\r\n                foreach (ResourceProviderData data in configuration.ResourceProviderPlugins)\r\n                {\r\n                    Type type = ResourceProviderPluginFacade.GetProviderType(data.Name);\r\n\r\n                    if (typeof(IStringResourceProvider).IsAssignableFrom(type))\r\n                    {\r\n                        Log.LogVerbose(LogTitle, (\"String resource provider '{0}' definition ignored.\" +\r\n                                                  \"\\nEither remove it from Composite.config, or move the provider definition under a provider of type '{1}' \")\r\n                                                  .FormatWith(data.Name, typeof(AggregationLocalizationProvider).FullName));\r\n\r\n                        resources.StringResourceProviders.Add(data.Name);\r\n                    }\r\n                    else if (typeof(ILocalizationProvider).IsAssignableFrom(type))\r\n                    {\r\n                        resources.LocalizationProviders.Add(data.Name);\r\n                    }\r\n                    else \r\n                    {\r\n                        throw new NotSupportedException(string.Format(\"Unknown resource provider type '{0}'\", type));\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/IIconResourceSystemFacade.cs",
    "content": "﻿namespace Composite.Core.ResourceSystem\r\n{\r\n    internal interface IIconResourceSystemFacade\r\n    {\r\n        ResourceHandle GetResourceHandle(string iconName);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/IconResourceSystemFacade.cs",
    "content": "﻿namespace Composite.Core.ResourceSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IconResourceSystemFacade\r\n    {\r\n        private static IIconResourceSystemFacade _iconResourceSystemFacade = new IconResourceSystemFacadeImpl();\r\n\r\n        internal static IIconResourceSystemFacade Implementation { get { return _iconResourceSystemFacade; } set { _iconResourceSystemFacade = value; } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle GetResourceHandle(string iconName)\r\n        {\r\n            return _iconResourceSystemFacade.GetResourceHandle(iconName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/IconResourceSystemFacadeImpl.cs",
    "content": "using Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem\r\n{\r\n    internal class IconResourceSystemFacadeImpl : IIconResourceSystemFacade\r\n    {\r\n        public ResourceHandle GetResourceHandle(string iconName)\r\n        {\r\n            if (string.IsNullOrEmpty(iconName)) return null;\r\n\r\n            if (!iconName.IsCorrectNamespace('.'))\r\n            {\r\n                Log.LogWarning(\"IconResourceSystemFacade\", \"The namespace '{0}' is not correct.\", iconName);\r\n                return null;\r\n            }\r\n\r\n            string resourceName = iconName.GetNameFromNamespace();\r\n            string namespaceName = iconName.GetNamespace();\r\n\r\n            return new ResourceHandle(namespaceName, resourceName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Icons/BuildInIconProviderName.cs",
    "content": "namespace Composite.Core.ResourceSystem.Icons\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class BuildInIconProviderName\r\n\t{\r\n        /// <exclude />\r\n        public const string ProviderName = \"Composite.Icons\";\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Icons/CommonCommandIcons.cs",
    "content": "namespace Composite.Core.ResourceSystem.Icons\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class CommonCommandIcons\r\n    {\r\n        /// <exclude />\r\n        public static ResourceHandle AddNew { get { return GetIconHandle(\"generic-add\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Edit { get { return GetIconHandle(\"generic-edit\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Refresh { get { return GetIconHandle(\"generic-refresh\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Delete { get { return GetIconHandle(\"generic-delete\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Search { get { return GetIconHandle(\"generic-search\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle SetSecurity { get { return GetIconHandle(\"generic-set-security\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle ShowHistory { get { return GetIconHandle(\"generic-show-history\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle ShowReport { get { return GetIconHandle(\"generic-show-report\"); } }\r\n\r\n\r\n        //private static ResourceHandle GetIconHandle()\r\n        //{\r\n        //    return new ResourceHandle(BuildInIconProviderName.ProviderName, \"unknown\");\r\n        //}\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Icons/CommonElementIcons.cs",
    "content": "\r\nnamespace Composite.Core.ResourceSystem.Icons\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class CommonElementIcons\r\n    {\r\n        /// <exclude />\r\n        public static ResourceHandle Advanced { get { return GetIconHandle(\"advanced\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Clock { get { return GetIconHandle(\"clock\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Cancel { get { return GetIconHandle(\"cancel\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle CancelDisabled { get { return GetIconHandle(\"cancel-disabled\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Close { get { return GetIconHandle(\"close\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Data { get { return GetIconHandle(\"data\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle DataAwaitingApproval { get { return GetIconHandle(\"data-awaiting-approval\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle DataAwaitingPublication { get { return GetIconHandle(\"data-awaiting-publication\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle DataDraft { get { return GetIconHandle(\"data-draft\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle DataPublished { get { return GetIconHandle(\"data-published\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle DeletedItems { get { return GetIconHandle(\"deleteditems\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Earth { get { return GetIconHandle(\"earth\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Error { get { return GetIconHandle(\"error\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Folder { get { return GetIconHandle(\"folder\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle FolderOpen { get { return GetIconHandle(\"folder-open\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle FolderDisabled { get { return GetIconHandle(\"folder-disabled\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeApplicationMsWord { get { return GetIconHandle(\"mimetype-doc\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeApplicationPdf { get { return GetIconHandle(\"mimetype-pdf\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeApplicationRtf { get { return GetIconHandle(\"mimetype-rtf\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeApplicationVndMsExcel { get { return GetIconHandle(\"mimetype-xsl\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeApplicationVndMsPowerpoint { get { return GetIconHandle(\"mimetype-ppt\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeApplicationZip { get { return GetIconHandle(\"mimetype-zip\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeImageBmp { get { return GetIconHandle(\"mimetype-bmp\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeImageGif { get { return GetIconHandle(\"mimetype-gif\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeImageJpeg { get { return GetIconHandle(\"mimetype-jpg\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeImagePng { get { return GetIconHandle(\"mimetype-png\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeTextPlain { get { return GetIconHandle(\"mimetype-txt\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle MimeTextXml { get { return GetIconHandle(\"mimetype-xml\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Nodes { get { return GetIconHandle(\"nodes\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Options { get { return GetIconHandle( \"options\" ); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Page { get { return GetIconHandle(\"page\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Popup { get { return GetIconHandle(\"popup\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Search { get { return GetIconHandle(\"generic-search\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Report { get { return GetIconHandle(\"report\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Template { get { return GetIconHandle(\"template\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Tools { get { return GetIconHandle(\"tools\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle User { get { return GetIconHandle(\"user\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle UserDisabled { get { return GetIconHandle(\"user-disabled\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle UserGroup { get { return GetIconHandle(\"user-group\"); } }\r\n        /// <exclude />\r\n        public static ResourceHandle Question { get { return GetIconHandle(\"question\"); } }\r\n\r\n\r\n        private static ResourceHandle GetIconHandle()\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, \"unknown\");\r\n        }\r\n\r\n        \r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/LocalizationFiles.cs",
    "content": "\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.Core.ResourceSystem\r\n{\r\n\t/// <summary>    \r\n\t/// Class generated from localization files  \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class LocalizationFiles\r\n\t{\r\n\t\t\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_C1Console_SecurityViolation {\r\n///<summary>&quot;Security violation&quot;</summary> \r\npublic static string LayoutLabel=>T(\"LayoutLabel\");\r\n///<summary>&quot;Not allowed&quot;</summary> \r\npublic static string Title=>T(\"Title\");\r\n///<summary>&quot;You do not have permission to execute the action. Contact your administrator for more information.&quot;</summary> \r\npublic static string Description=>T(\"Description\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.C1Console.SecurityViolation\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_C1Console_Trees {\r\n///<summary>&quot;Error in tree&quot;</summary> \r\npublic static string KeyFacade_ErrorTreeNode_Label=>T(\"KeyFacade.ErrorTreeNode.Label\");\r\n///<summary>&quot;Show Message&quot;</summary> \r\npublic static string KeyFacade_ErrorTreeNode_ShowMessage_Label=>T(\"KeyFacade.ErrorTreeNode.ShowMessage.Label\");\r\n///<summary>&quot;Show Error Message&quot;</summary> \r\npublic static string KeyFacade_ErrorTreeNode_ShowMessage_ToolTip=>T(\"KeyFacade.ErrorTreeNode.ShowMessage.ToolTip\");\r\n///<summary>&quot;Error message&quot;</summary> \r\npublic static string KeyFacade_ErrorTreeNode_ShowMessage_Title=>T(\"KeyFacade.ErrorTreeNode.ShowMessage.Title\");\r\n///<summary>&quot;Unknown exception happened: &apos;{0}&apos;&quot;</summary> \r\npublic static string TreeValidationError_Common_UnknownException_Template=>T(\"TreeValidationError.Common.UnknownException\");\r\n///<summary>&quot;Unknown exception happened: &apos;{0}&apos;&quot;</summary> \r\npublic static string TreeValidationError_Common_UnknownException(object parameter0)=>string.Format(T(\"TreeValidationError.Common.UnknownException\"), parameter0);\r\n///<summary>&quot;Unknown element &apos;{0}&apos;&quot;</summary> \r\npublic static string TreeValidationError_Common_UnknownElement_Template=>T(\"TreeValidationError.Common.UnknownElement\");\r\n///<summary>&quot;Unknown element &apos;{0}&apos;&quot;</summary> \r\npublic static string TreeValidationError_Common_UnknownElement(object parameter0)=>string.Format(T(\"TreeValidationError.Common.UnknownElement\"), parameter0);\r\n///<summary>&quot;The required attribute &apos;{0}&apos; is missing&quot;</summary> \r\npublic static string TreeValidationError_Common_MissingAttribute_Template=>T(\"TreeValidationError.Common.MissingAttribute\");\r\n///<summary>&quot;The required attribute &apos;{0}&apos; is missing&quot;</summary> \r\npublic static string TreeValidationError_Common_MissingAttribute(object parameter0)=>string.Format(T(\"TreeValidationError.Common.MissingAttribute\"), parameter0);\r\n///<summary>&quot;The attribute &apos;{0}&apos; has a value that is not allowed&quot;</summary> \r\npublic static string TreeValidationError_Common_WrongAttributeValue_Template=>T(\"TreeValidationError.Common.WrongAttributeValue\");\r\n///<summary>&quot;The attribute &apos;{0}&apos; has a value that is not allowed&quot;</summary> \r\npublic static string TreeValidationError_Common_WrongAttributeValue(object parameter0)=>string.Format(T(\"TreeValidationError.Common.WrongAttributeValue\"), parameter0);\r\n///<summary>&quot;The type &apos;{0}&apos; does not contain a property named &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_Common_MissingProperty_Template=>T(\"TreeValidationError.Common.MissingProperty\");\r\n///<summary>&quot;The type &apos;{0}&apos; does not contain a property named &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_Common_MissingProperty(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.Common.MissingProperty\"), parameter0,parameter1);\r\n///<summary>&quot;The type &apos;{0}&apos; could not be found&quot;</summary> \r\npublic static string TreeValidationError_Common_UnknownInterfaceType_Template=>T(\"TreeValidationError.Common.UnknownInterfaceType\");\r\n///<summary>&quot;The type &apos;{0}&apos; could not be found&quot;</summary> \r\npublic static string TreeValidationError_Common_UnknownInterfaceType(object parameter0)=>string.Format(T(\"TreeValidationError.Common.UnknownInterfaceType\"), parameter0);\r\n///<summary>&quot;The type &apos;{0}&apos; does not implement the interface &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_Common_NotImplementingIData_Template=>T(\"TreeValidationError.Common.NotImplementingIData\");\r\n///<summary>&quot;The type &apos;{0}&apos; does not implement the interface &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_Common_NotImplementingIData(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.Common.NotImplementingIData\"), parameter0,parameter1);\r\n///<summary>&quot;The value &apos;{0}&apos; is not allowed as a permission type value&quot;</summary> \r\npublic static string TreeValidationError_Common_WrongPermissionValue_Template=>T(\"TreeValidationError.Common.WrongPermissionValue\");\r\n///<summary>&quot;The value &apos;{0}&apos; is not allowed as a permission type value&quot;</summary> \r\npublic static string TreeValidationError_Common_WrongPermissionValue(object parameter0)=>string.Format(T(\"TreeValidationError.Common.WrongPermissionValue\"), parameter0);\r\n///<summary>&quot;The value &apos;{0}&apos; is not allowed as a location value&quot;</summary> \r\npublic static string TreeValidationError_Common_WrongLocationValue_Template=>T(\"TreeValidationError.Common.WrongLocationValue\");\r\n///<summary>&quot;The value &apos;{0}&apos; is not allowed as a location value&quot;</summary> \r\npublic static string TreeValidationError_Common_WrongLocationValue(object parameter0)=>string.Format(T(\"TreeValidationError.Common.WrongLocationValue\"), parameter0);\r\n///<summary>&quot;No function markup provided as a child element&quot;</summary> \r\npublic static string TreeValidationError_Common_MissingFunctionMarkup=>T(\"TreeValidationError.Common.MissingFunctionMarkup\");\r\n///<summary>&quot;The function could not be created for the provided function markup&quot;</summary> \r\npublic static string TreeValidationError_Common_WrongFunctionMarkup=>T(\"TreeValidationError.Common.WrongFunctionMarkup\");\r\n///<summary>&quot;Missing root element in tree markup&quot;</summary> \r\npublic static string TreeValidationError_Markup_NoRootElement=>T(\"TreeValidationError.Markup.NoRootElement\");\r\n///<summary>&quot;Syntax error: {0} at line {1} position {2}&quot;</summary> \r\npublic static string TreeValidationError_Markup_SchemaError_Template=>T(\"TreeValidationError.Markup.SchemaError\");\r\n///<summary>&quot;Syntax error: {0} at line {1} position {2}&quot;</summary> \r\npublic static string TreeValidationError_Markup_SchemaError(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"TreeValidationError.Markup.SchemaError\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;The attachment point &apos;{0}&apos; is unknown&quot;</summary> \r\npublic static string TreeValidationError_AutoAttachments_UnknownAttachmentPoint_Template=>T(\"TreeValidationError.AutoAttachments.UnknownAttachmentPoint\");\r\n///<summary>&quot;The attachment point &apos;{0}&apos; is unknown&quot;</summary> \r\npublic static string TreeValidationError_AutoAttachments_UnknownAttachmentPoint(object parameter0)=>string.Format(T(\"TreeValidationError.AutoAttachments.UnknownAttachmentPoint\"), parameter0);\r\n///<summary>&quot;The attachment position &apos;{0}&apos; is unknown&quot;</summary> \r\npublic static string TreeValidationError_AutoAttachments_UnknownAttachmentPosition_Template=>T(\"TreeValidationError.AutoAttachments.UnknownAttachmentPosition\");\r\n///<summary>&quot;The attachment position &apos;{0}&apos; is unknown&quot;</summary> \r\npublic static string TreeValidationError_AutoAttachments_UnknownAttachmentPosition(object parameter0)=>string.Format(T(\"TreeValidationError.AutoAttachments.UnknownAttachmentPosition\"), parameter0);\r\n///<summary>&quot;No elements are allowed in trees that are used with data attached trees&quot;</summary> \r\npublic static string TreeValidationError_DataAttachments_NoElementsAllowed=>T(\"TreeValidationError.DataAttachments.NoElementsAllowed\");\r\n///<summary>&quot;ShareRootElementById is only allowed if the tree has a single named attachment point&quot;</summary> \r\npublic static string TreeValidationError_ElementRoot_ShareRootElementByIdNotAllowed=>T(\"TreeValidationError.ElementRoot.ShareRootElementByIdNotAllowed\");\r\n///<summary>&quot;The value of the Id is not allowed. The Id should be non-empty, not start with NodeAutoId_ and not be RootTreeNode&quot;</summary> \r\npublic static string TreeValidationError_SimpleElement_WrongIdValue=>T(\"TreeValidationError.SimpleElement.WrongIdValue\");\r\n///<summary>&quot;The id value &apos;{0}&apos; has already been used in this tree&quot;</summary> \r\npublic static string TreeValidationError_SimpleElement_AlreadyUsedId_Template=>T(\"TreeValidationError.SimpleElement.AlreadyUsedId\");\r\n///<summary>&quot;The id value &apos;{0}&apos; has already been used in this tree&quot;</summary> \r\npublic static string TreeValidationError_SimpleElement_AlreadyUsedId(object parameter0)=>string.Format(T(\"TreeValidationError.SimpleElement.AlreadyUsedId\"), parameter0);\r\n///<summary>&quot;The data interface &apos;{0}&apos; is used more than once as a child under the same parent element and this is not allowed&quot;</summary> \r\npublic static string TreeValidationError_DataElementsTreeNode_SameInterfaceUsedTwice_Template=>T(\"TreeValidationError.DataElementsTreeNode.SameInterfaceUsedTwice\");\r\n///<summary>&quot;The data interface &apos;{0}&apos; is used more than once as a child under the same parent element and this is not allowed&quot;</summary> \r\npublic static string TreeValidationError_DataElementsTreeNode_SameInterfaceUsedTwice(object parameter0)=>string.Format(T(\"TreeValidationError.DataElementsTreeNode.SameInterfaceUsedTwice\"), parameter0);\r\n///<summary>&quot;The same interface &apos;{0}&apos; is used as parent type as parent filter and this is not allowed&quot;</summary> \r\npublic static string TreeValidationError_DataElementsTreeNode_SameParentFilterInterfaceUsedTwice_Template=>T(\"TreeValidationError.DataElementsTreeNode.SameParentFilterInterfaceUsedTwice\");\r\n///<summary>&quot;The same interface &apos;{0}&apos; is used as parent type as parent filter and this is not allowed&quot;</summary> \r\npublic static string TreeValidationError_DataElementsTreeNode_SameParentFilterInterfaceUsedTwice(object parameter0)=>string.Format(T(\"TreeValidationError.DataElementsTreeNode.SameParentFilterInterfaceUsedTwice\"), parameter0);\r\n///<summary>&quot;More than one parent filter is pointing to the interface &apos;{0}&apos;. Change the Display value to Lazy&quot;</summary> \r\npublic static string TreeValidationError_DataElementsTreeNode_MoreThanOnParentFilterIsPointingToMe_Template=>T(\"TreeValidationError.DataElementsTreeNode.MoreThanOnParentFilterIsPointingToMe\");\r\n///<summary>&quot;More than one parent filter is pointing to the interface &apos;{0}&apos;. Change the Display value to Lazy&quot;</summary> \r\npublic static string TreeValidationError_DataElementsTreeNode_MoreThanOnParentFilterIsPointingToMe(object parameter0)=>string.Format(T(\"TreeValidationError.DataElementsTreeNode.MoreThanOnParentFilterIsPointingToMe\"), parameter0);\r\n///<summary>&quot;Type attribute is missing&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_MissingInterfaceType=>T(\"TreeValidationError.DataFolderElements.MissingInterfaceType\");\r\n///<summary>&quot;The interface type &apos;{0}&apos; does not match the parent elements interface type &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_WrongInterfaceType_Template=>T(\"TreeValidationError.DataFolderElements.WrongInterfaceType\");\r\n///<summary>&quot;The interface type &apos;{0}&apos; does not match the parent elements interface type &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_WrongInterfaceType(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.DataFolderElements.WrongInterfaceType\"), parameter0,parameter1);\r\n///<summary>&quot;DateFormat attribute requires that the property &apos;{0}&apos; should be of type &apos;{1}&apos; but is type &apos;{2}&apos;&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_DateFormetNotAllowed_Template=>T(\"TreeValidationError.DataFolderElements.DateFormetNotAllowed\");\r\n///<summary>&quot;DateFormat attribute requires that the property &apos;{0}&apos; should be of type &apos;{1}&apos; but is type &apos;{2}&apos;&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_DateFormetNotAllowed(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"TreeValidationError.DataFolderElements.DateFormetNotAllowed\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;The property &apos;{0}&apos; is of type Date and this requires the DateFormat attribute to be present&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_DateFormetIsMissing_Template=>T(\"TreeValidationError.DataFolderElements.DateFormetIsMissing\");\r\n///<summary>&quot;The property &apos;{0}&apos; is of type Date and this requires the DateFormat attribute to be present&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_DateFormetIsMissing(object parameter0)=>string.Format(T(\"TreeValidationError.DataFolderElements.DateFormetIsMissing\"), parameter0);\r\n///<summary>&quot;Ranges and first-letter-only not allowed at the same time&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_RangesAndFirstLetterOnlyNotAllowed=>T(\"TreeValidationError.DataFolderElements.RangesAndFirstLetterOnlyNotAllowed\");\r\n///<summary>&quot;First-letter-only requires that the property &apos;{0}&apos; should be of type &apos;{1}&apos; but is type &apos;{2}&apos;&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_WrongFirstLetterOnlyPropertyType_Template=>T(\"TreeValidationError.DataFolderElements.WrongFirstLetterOnlyPropertyType\");\r\n///<summary>&quot;First-letter-only requires that the property &apos;{0}&apos; should be of type &apos;{1}&apos; but is type &apos;{2}&apos;&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_WrongFirstLetterOnlyPropertyType(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"TreeValidationError.DataFolderElements.WrongFirstLetterOnlyPropertyType\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;Only data child elements with the same interface type as the folder grouping (&apos;{0}&apos;) are allowed&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_WrongDateChildInterfaceType_Template=>T(\"TreeValidationError.DataFolderElements.WrongDateChildInterfaceType\");\r\n///<summary>&quot;Only data child elements with the same interface type as the folder grouping (&apos;{0}&apos;) are allowed&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_WrongDateChildInterfaceType(object parameter0)=>string.Format(T(\"TreeValidationError.DataFolderElements.WrongDateChildInterfaceType\"), parameter0);\r\n///<summary>&quot;Switching from the interface type &apos;{0}&apos; to a different interface type &apos;{1}&apos; is not allowed in the same folder grouping group&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_InterfaceTypeSwitchNotAllowed_Template=>T(\"TreeValidationError.DataFolderElements.InterfaceTypeSwitchNotAllowed\");\r\n///<summary>&quot;Switching from the interface type &apos;{0}&apos; to a different interface type &apos;{1}&apos; is not allowed in the same folder grouping group&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_InterfaceTypeSwitchNotAllowed(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.DataFolderElements.InterfaceTypeSwitchNotAllowed\"), parameter0,parameter1);\r\n///<summary>&quot;Using the field name &apos;{0}&apos; twice in the same grouping tree is not allowed&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_SameFieldUsedTwice_Template=>T(\"TreeValidationError.DataFolderElements.SameFieldUsedTwice\");\r\n///<summary>&quot;Using the field name &apos;{0}&apos; twice in the same grouping tree is not allowed&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_SameFieldUsedTwice(object parameter0)=>string.Format(T(\"TreeValidationError.DataFolderElements.SameFieldUsedTwice\"), parameter0);\r\n///<summary>&quot;Maximum one parent id filter node can be used on data elements used in groupings&quot;</summary> \r\npublic static string TreeValidationError_DataFolderElements_TooManyParentIdFilters=>T(\"TreeValidationError.DataFolderElements.TooManyParentIdFilters\");\r\n///<summary>&quot;The type &apos;{0}&apos; is not in the parent tree of this node or specified as an attachment points type&quot;</summary> \r\npublic static string TreeValidationError_ParentIdFilterNode_TypeIsNotInParentTree_Template=>T(\"TreeValidationError.ParentIdFilterNode.TypeIsNotInParentTree\");\r\n///<summary>&quot;The type &apos;{0}&apos; is not in the parent tree of this node or specified as an attachment points type&quot;</summary> \r\npublic static string TreeValidationError_ParentIdFilterNode_TypeIsNotInParentTree(object parameter0)=>string.Format(T(\"TreeValidationError.ParentIdFilterNode.TypeIsNotInParentTree\"), parameter0);\r\n///<summary>&quot;The operator &apos;{0}&apos; is unknown or not supported&quot;</summary> \r\npublic static string TreeValidationError_FieldFilter_UnknownOperatorName_Template=>T(\"TreeValidationError.FieldFilter.UnknownOperatorName\");\r\n///<summary>&quot;The operator &apos;{0}&apos; is unknown or not supported&quot;</summary> \r\npublic static string TreeValidationError_FieldFilter_UnknownOperatorName(object parameter0)=>string.Format(T(\"TreeValidationError.FieldFilter.UnknownOperatorName\"), parameter0);\r\n///<summary>&quot;The string value &apos;{0}&apos; could not be converted to the type &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_FieldFilter_ValueCouldNotBeConverted_Template=>T(\"TreeValidationError.FieldFilter.ValueCouldNotBeConverted\");\r\n///<summary>&quot;The string value &apos;{0}&apos; could not be converted to the type &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_FieldFilter_ValueCouldNotBeConverted(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.FieldFilter.ValueCouldNotBeConverted\"), parameter0,parameter1);\r\n///<summary>&quot;The operator &apos;{0}&apos; is not supported for the type &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_FieldFilter_OperatorNotSupportedForType_Template=>T(\"TreeValidationError.FieldFilter.OperatorNotSupportedForType\");\r\n///<summary>&quot;The operator &apos;{0}&apos; is not supported for the type &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_FieldFilter_OperatorNotSupportedForType(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.FieldFilter.OperatorNotSupportedForType\"), parameter0,parameter1);\r\n///<summary>&quot;Function markup is missing&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_MissingFunctionMarkup=>T(\"TreeValidationError.FunctionFilter.MissingFunctionMarkup\");\r\n///<summary>&quot;The function could not be created for the provided function markup&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongFunctionMarkup=>T(\"TreeValidationError.FunctionFilter.WrongFunctionMarkup\");\r\n///<summary>&quot;The function does not return value of the type &apos;{0}&apos;&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongReturnValue_Template=>T(\"TreeValidationError.FunctionFilter.WrongReturnValue\");\r\n///<summary>&quot;The function does not return value of the type &apos;{0}&apos;&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongReturnValue(object parameter0)=>string.Format(T(\"TreeValidationError.FunctionFilter.WrongReturnValue\"), parameter0);\r\n///<summary>&quot;The return type of the expression returned by the function is &apos;{0}&apos;, &apos;{1}&apos; was expected&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongFunctionReturnType_Template=>T(\"TreeValidationError.FunctionFilter.WrongFunctionReturnType\");\r\n///<summary>&quot;The return type of the expression returned by the function is &apos;{0}&apos;, &apos;{1}&apos; was expected&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongFunctionReturnType(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.FunctionFilter.WrongFunctionReturnType\"), parameter0,parameter1);\r\n///<summary>&quot;The parameter count of expression returned by the function is &apos;{0}&apos;, 1 was expected&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongFunctionParameterCount_Template=>T(\"TreeValidationError.FunctionFilter.WrongFunctionParameterCount\");\r\n///<summary>&quot;The parameter count of expression returned by the function is &apos;{0}&apos;, 1 was expected&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongFunctionParameterCount(object parameter0)=>string.Format(T(\"TreeValidationError.FunctionFilter.WrongFunctionParameterCount\"), parameter0);\r\n///<summary>&quot;The expressions parameter type returned by the function is &apos;{0}&apos;, &apos;{1}&apos; was expected&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongFunctionParameterType_Template=>T(\"TreeValidationError.FunctionFilter.WrongFunctionParameterType\");\r\n///<summary>&quot;The expressions parameter type returned by the function is &apos;{0}&apos;, &apos;{1}&apos; was expected&quot;</summary> \r\npublic static string TreeValidationError_FunctionFilter_WrongFunctionParameterType(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.FunctionFilter.WrongFunctionParameterType\"), parameter0,parameter1);\r\n///<summary>&quot;The file &apos;{0}&apos; does not exist&quot;</summary> \r\npublic static string TreeValidationError_CustomFormMarkup_MissingFile_Template=>T(\"TreeValidationError.CustomFormMarkup.MissingFile\");\r\n///<summary>&quot;The file &apos;{0}&apos; does not exist&quot;</summary> \r\npublic static string TreeValidationError_CustomFormMarkup_MissingFile(object parameter0)=>string.Format(T(\"TreeValidationError.CustomFormMarkup.MissingFile\"), parameter0);\r\n///<summary>&quot;The custom markup path &apos;{0}&apos; is wrongly formatted. Use ~/Dir1/Dir2/File.xml&quot;</summary> \r\npublic static string TreeValidationError_CustomFormMarkup_BadMarkupPath_Template=>T(\"TreeValidationError.CustomFormMarkup.BadMarkupPath\");\r\n///<summary>&quot;The custom markup path &apos;{0}&apos; is wrongly formatted. Use ~/Dir1/Dir2/File.xml&quot;</summary> \r\npublic static string TreeValidationError_CustomFormMarkup_BadMarkupPath(object parameter0)=>string.Format(T(\"TreeValidationError.CustomFormMarkup.BadMarkupPath\"), parameter0);\r\n///<summary>&quot;The file &apos;{0}&apos; does not contain valid XML markup.&quot;</summary> \r\npublic static string TreeValidationError_CustomFormMarkup_InvalidXml_Template=>T(\"TreeValidationError.CustomFormMarkup.InvalidXml\");\r\n///<summary>&quot;The file &apos;{0}&apos; does not contain valid XML markup.&quot;</summary> \r\npublic static string TreeValidationError_CustomFormMarkup_InvalidXml(object parameter0)=>string.Format(T(\"TreeValidationError.CustomFormMarkup.InvalidXml\"), parameter0);\r\n///<summary>&quot;The function does not return value of the type &apos;{0}&apos;&quot;</summary> \r\npublic static string TreeValidationError_ReportFunctionAction_WrongReturnValue_Template=>T(\"TreeValidationError.ReportFunctionAction.WrongReturnValue\");\r\n///<summary>&quot;The function does not return value of the type &apos;{0}&apos;&quot;</summary> \r\npublic static string TreeValidationError_ReportFunctionAction_WrongReturnValue(object parameter0)=>string.Format(T(\"TreeValidationError.ReportFunctionAction.WrongReturnValue\"), parameter0);\r\n///<summary>&quot;The edit data action only applies to elements that produce data elements&quot;</summary> \r\npublic static string TreeValidationError_GenericEditDataAction_OwnerIsNotDataNode=>T(\"TreeValidationError.GenericEditDataAction.OwnerIsNotDataNode\");\r\n///<summary>&quot;The delete data action only applies to elements that produce data elements&quot;</summary> \r\npublic static string TreeValidationError_GenericDeleteDataAction_OwnerIsNotDataNode=>T(\"TreeValidationError.GenericDeleteDataAction.OwnerIsNotDataNode\");\r\n///<summary>&quot;The dialog type &apos;{0}&apos; is not supported&quot;</summary> \r\npublic static string TreeValidationError_MessageBoxAction_UnknownDialogType_Template=>T(\"TreeValidationError.MessageBoxAction.UnknownDialogType\");\r\n///<summary>&quot;The dialog type &apos;{0}&apos; is not supported&quot;</summary> \r\npublic static string TreeValidationError_MessageBoxAction_UnknownDialogType(object parameter0)=>string.Format(T(\"TreeValidationError.MessageBoxAction.UnknownDialogType\"), parameter0);\r\n///<summary>&quot;Too many &apos;{0}&apos; elements, only one is allowed&quot;</summary> \r\npublic static string TreeValidationError_CustomUrlAction_TooManyPostParameterElements_Template=>T(\"TreeValidationError.CustomUrlAction.TooManyPostParameterElements\");\r\n///<summary>&quot;Too many &apos;{0}&apos; elements, only one is allowed&quot;</summary> \r\npublic static string TreeValidationError_CustomUrlAction_TooManyPostParameterElements(object parameter0)=>string.Format(T(\"TreeValidationError.CustomUrlAction.TooManyPostParameterElements\"), parameter0);\r\n///<summary>&quot;The view type &apos;{0}&apos; is not supported&quot;</summary> \r\npublic static string TreeValidationError_CustomUrlAction_UnknownViewType_Template=>T(\"TreeValidationError.CustomUrlAction.UnknownViewType\");\r\n///<summary>&quot;The view type &apos;{0}&apos; is not supported&quot;</summary> \r\npublic static string TreeValidationError_CustomUrlAction_UnknownViewType(object parameter0)=>string.Format(T(\"TreeValidationError.CustomUrlAction.UnknownViewType\"), parameter0);\r\n///<summary>&quot;The direction value &apos;{0}&apos; is wrong, should be either &apos;ascending&apos; or &apos;descending&apos;&quot;</summary> \r\npublic static string TreeValidationError_FieldOrderBy_UnknownDirection_Template=>T(\"TreeValidationError.FieldOrderBy.UnknownDirection\");\r\n///<summary>&quot;The direction value &apos;{0}&apos; is wrong, should be either &apos;ascending&apos; or &apos;descending&apos;&quot;</summary> \r\npublic static string TreeValidationError_FieldOrderBy_UnknownDirection(object parameter0)=>string.Format(T(\"TreeValidationError.FieldOrderBy.UnknownDirection\"), parameter0);\r\n///<summary>&quot;The type &apos;{0}&apos; does not contain a field named &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_FieldOrderBy_UnknownField_Template=>T(\"TreeValidationError.FieldOrderBy.UnknownField\");\r\n///<summary>&quot;The type &apos;{0}&apos; does not contain a field named &apos;{1}&apos;&quot;</summary> \r\npublic static string TreeValidationError_FieldOrderBy_UnknownField(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.FieldOrderBy.UnknownField\"), parameter0,parameter1);\r\n///<summary>&quot;&apos;{0}&apos; is in wrong format, use the format {1} for raw values or {2} for formatted values. For format options, see the .ToString() oprions for the field type, ex &apos;yyyy MMM&apos; for DateTime&quot;</summary> \r\npublic static string TreeValidationError_DataFieldValueHelper_WrongFormat_Template=>T(\"TreeValidationError.DataFieldValueHelper.WrongFormat\");\r\n///<summary>&quot;&apos;{0}&apos; is in wrong format, use the format {1} for raw values or {2} for formatted values. For format options, see the .ToString() oprions for the field type, ex &apos;yyyy MMM&apos; for DateTime&quot;</summary> \r\npublic static string TreeValidationError_DataFieldValueHelper_WrongFormat(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"TreeValidationError.DataFieldValueHelper.WrongFormat\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;The interface &apos;{0}&apos; is not contained in the current element or any of its parents&quot;</summary> \r\npublic static string TreeValidationError_DataFieldValueHelper_InterfaceNotInParentTree_Template=>T(\"TreeValidationError.DataFieldValueHelper.InterfaceNotInParentTree\");\r\n///<summary>&quot;The interface &apos;{0}&apos; is not contained in the current element or any of its parents&quot;</summary> \r\npublic static string TreeValidationError_DataFieldValueHelper_InterfaceNotInParentTree(object parameter0)=>string.Format(T(\"TreeValidationError.DataFieldValueHelper.InterfaceNotInParentTree\"), parameter0);\r\n///<summary>&quot;The range value is wrongly formatted&quot;</summary> \r\npublic static string TreeValidationError_Range_WrongFormat=>T(\"TreeValidationError.Range.WrongFormat\");\r\n///<summary>&quot;The property &apos;{0}&apos; is of type &apos;{1}&apos; which does not support ranges&quot;</summary> \r\npublic static string TreeValidationError_Range_UnsupportedType_Template=>T(\"TreeValidationError.Range.UnsupportedType\");\r\n///<summary>&quot;The property &apos;{0}&apos; is of type &apos;{1}&apos; which does not support ranges&quot;</summary> \r\npublic static string TreeValidationError_Range_UnsupportedType(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.Range.UnsupportedType\"), parameter0,parameter1);\r\n///<summary>&quot;The value first value ({0}) in a range should be lesser than second value ({1})&quot;</summary> \r\npublic static string TreeValidationError_Range_MinMaxError_Template=>T(\"TreeValidationError.Range.MinMaxError\");\r\n///<summary>&quot;The value first value ({0}) in a range should be lesser than second value ({1})&quot;</summary> \r\npublic static string TreeValidationError_Range_MinMaxError(object parameter0,object parameter1)=>string.Format(T(\"TreeValidationError.Range.MinMaxError\"), parameter0,parameter1);\r\n///<summary>&quot;The max value of a range should be less than the min value of the succeeding range&quot;</summary> \r\npublic static string TreeValidationError_Range_NextRangeError=>T(\"TreeValidationError.Range.NextRangeError\");\r\n///<summary>&quot;From {0} to {1}&quot;</summary> \r\npublic static string TreeRanges_IntRange_Closed_Template=>T(\"TreeRanges.IntRange.Closed\");\r\n///<summary>&quot;From {0} to {1}&quot;</summary> \r\npublic static string TreeRanges_IntRange_Closed(object parameter0,object parameter1)=>string.Format(T(\"TreeRanges.IntRange.Closed\"), parameter0,parameter1);\r\n///<summary>&quot;{0} or less&quot;</summary> \r\npublic static string TreeRanges_IntRange_MinOpenEnded_Template=>T(\"TreeRanges.IntRange.MinOpenEnded\");\r\n///<summary>&quot;{0} or less&quot;</summary> \r\npublic static string TreeRanges_IntRange_MinOpenEnded(object parameter0)=>string.Format(T(\"TreeRanges.IntRange.MinOpenEnded\"), parameter0);\r\n///<summary>&quot;{0} or more&quot;</summary> \r\npublic static string TreeRanges_IntRange_MaxOpenEnded_Template=>T(\"TreeRanges.IntRange.MaxOpenEnded\");\r\n///<summary>&quot;{0} or more&quot;</summary> \r\npublic static string TreeRanges_IntRange_MaxOpenEnded(object parameter0)=>string.Format(T(\"TreeRanges.IntRange.MaxOpenEnded\"), parameter0);\r\n///<summary>&quot;Other&quot;</summary> \r\npublic static string TreeRanges_IntRange_Other=>T(\"TreeRanges.IntRange.Other\");\r\n///<summary>&quot;From {0} to {1}&quot;</summary> \r\npublic static string TreeRanges_StringRange_Closed_Template=>T(\"TreeRanges.StringRange.Closed\");\r\n///<summary>&quot;From {0} to {1}&quot;</summary> \r\npublic static string TreeRanges_StringRange_Closed(object parameter0,object parameter1)=>string.Format(T(\"TreeRanges.StringRange.Closed\"), parameter0,parameter1);\r\n///<summary>&quot;{0} and before&quot;</summary> \r\npublic static string TreeRanges_StringRange_MinOpenEnded_Template=>T(\"TreeRanges.StringRange.MinOpenEnded\");\r\n///<summary>&quot;{0} and before&quot;</summary> \r\npublic static string TreeRanges_StringRange_MinOpenEnded(object parameter0)=>string.Format(T(\"TreeRanges.StringRange.MinOpenEnded\"), parameter0);\r\n///<summary>&quot;{0} and after&quot;</summary> \r\npublic static string TreeRanges_StringRange_MaxOpenEnded_Template=>T(\"TreeRanges.StringRange.MaxOpenEnded\");\r\n///<summary>&quot;{0} and after&quot;</summary> \r\npublic static string TreeRanges_StringRange_MaxOpenEnded(object parameter0)=>string.Format(T(\"TreeRanges.StringRange.MaxOpenEnded\"), parameter0);\r\n///<summary>&quot;Other&quot;</summary> \r\npublic static string TreeRanges_StringRange_Other=>T(\"TreeRanges.StringRange.Other\");\r\n///<summary>&quot;Add&quot;</summary> \r\npublic static string GenericAddDataAction_DefaultLabel=>T(\"GenericAddDataAction.DefaultLabel\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string GenericEditDataAction_DefaultLabel=>T(\"GenericEditDataAction.DefaultLabel\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string GenericDeleteDataAction_DefaultLabel=>T(\"GenericDeleteDataAction.DefaultLabel\");\r\n///<summary>&quot;Duplicate&quot;</summary> \r\npublic static string GenericDuplicateDataAction_DefaultLabel=>T(\"GenericDuplicateDataAction.DefaultLabel\");\r\n///<summary>&quot;Cascade delete error&quot;</summary> \r\npublic static string TreeGenericDelete_CascadeDeleteErrorTitle=>T(\"TreeGenericDelete.CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string TreeGenericDelete_CascadeDeleteErrorMessage=>T(\"TreeGenericDelete.CascadeDeleteErrorMessage\");\r\n///<summary>&quot;Delete Data?&quot;</summary> \r\npublic static string TreeGenericDeleteConfirm_LabelFieldGroup=>T(\"TreeGenericDeleteConfirm.LabelFieldGroup\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string TreeGenericDeleteConfirm_Text=>T(\"TreeGenericDeleteConfirm.Text\");\r\n///<summary>&quot;Delete data?&quot;</summary> \r\npublic static string TreeGenericDeleteConfirmDeletingRelatedData_LabelFieldGroup=>T(\"TreeGenericDeleteConfirmDeletingRelatedData.LabelFieldGroup\");\r\n///<summary>&quot;There is some referenced data that will also be deleted, do you want to continue?&quot;</summary> \r\npublic static string TreeGenericDeleteConfirmDeletingRelatedData_ConfirmationText=>T(\"TreeGenericDeleteConfirmDeletingRelatedData.ConfirmationText\");\r\n///<summary>&quot;Add&quot;</summary> \r\npublic static string TreeAddTreeDefinitionWorkflow_AddNew_Label=>T(\"TreeAddTreeDefinitionWorkflow.AddNew.Label\");\r\n///<summary>&quot;Add new tree definition&quot;</summary> \r\npublic static string TreeAddTreeDefinitionWorkflow_AddNew_ToolTip=>T(\"TreeAddTreeDefinitionWorkflow.AddNew.ToolTip\");\r\n///<summary>&quot;Add new tree definition&quot;</summary> \r\npublic static string TreeAddTreeDefinition_Layout_Label=>T(\"TreeAddTreeDefinition.Layout.Label\");\r\n///<summary>&quot;Add new tree definition&quot;</summary> \r\npublic static string TreeAddTreeDefinition_FieldGroup_Label=>T(\"TreeAddTreeDefinition.FieldGroup.Label\");\r\n///<summary>&quot;Definition name&quot;</summary> \r\npublic static string TreeAddTreeDefinition_NameTextBox_Label=>T(\"TreeAddTreeDefinition.NameTextBox.Label\");\r\n///<summary>&quot;Definition name&quot;</summary> \r\npublic static string TreeAddTreeDefinition_NameTextBox_Help=>T(\"TreeAddTreeDefinition.NameTextBox.Help\");\r\n///<summary>&quot;Template&quot;</summary> \r\npublic static string TreeAddTreeDefinition_TemplateSelector_Label=>T(\"TreeAddTreeDefinition.TemplateSelector.Label\");\r\n///<summary>&quot;Select a template to start with&quot;</summary> \r\npublic static string TreeAddTreeDefinition_TemplateSelector_Help=>T(\"TreeAddTreeDefinition.TemplateSelector.Help\");\r\n///<summary>&quot;Position&quot;</summary> \r\npublic static string TreeAddTreeDefinition_PositionSelector_Label=>T(\"TreeAddTreeDefinition.PositionSelector.Label\");\r\n///<summary>&quot;Position&quot;</summary> \r\npublic static string TreeAddTreeDefinition_PositionSelector_Help=>T(\"TreeAddTreeDefinition.PositionSelector.Help\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string TreeDeleteTreeDefinitionWorkflow_Delete_Label=>T(\"TreeDeleteTreeDefinitionWorkflow.Delete.Label\");\r\n///<summary>&quot;Delete tree definition&quot;</summary> \r\npublic static string TreeDeleteTreeDefinitionWorkflow_Delete_ToolTip=>T(\"TreeDeleteTreeDefinitionWorkflow.Delete.ToolTip\");\r\n///<summary>&quot;Delete tree definition&quot;</summary> \r\npublic static string TreeDeleteTreeDefinition_Layout_Label=>T(\"TreeDeleteTreeDefinition.Layout.Label\");\r\n///<summary>&quot;Delete selected tree definition&quot;</summary> \r\npublic static string TreeDeleteTreeDefinition_Title=>T(\"TreeDeleteTreeDefinition.Title\");\r\n///<summary>&quot;Delete selected tree definition?&quot;</summary> \r\npublic static string TreeDeleteTreeDefinition_Description=>T(\"TreeDeleteTreeDefinition.Description\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string TreeDeleteTreeDefinitionWorkflow_Edit_Label=>T(\"TreeDeleteTreeDefinitionWorkflow.Edit.Label\");\r\n///<summary>&quot;Edit tree definition&quot;</summary> \r\npublic static string TreeDeleteTreeDefinitionWorkflow_Edit_ToolTip=>T(\"TreeDeleteTreeDefinitionWorkflow.Edit.ToolTip\");\r\n///<summary>&quot;Add Application&quot;</summary> \r\npublic static string AddApplicationWorkflow_AddApplication_Label=>T(\"AddApplicationWorkflow.AddApplication.Label\");\r\n///<summary>&quot;Add new application&quot;</summary> \r\npublic static string AddApplicationWorkflow_AddApplication_ToolTip=>T(\"AddApplicationWorkflow.AddApplication.ToolTip\");\r\n///<summary>&quot;Add application&quot;</summary> \r\npublic static string AddApplication_Layout_Label=>T(\"AddApplication.Layout.Label\");\r\n///<summary>&quot;Select application&quot;</summary> \r\npublic static string AddApplication_FieldGroup_Label=>T(\"AddApplication.FieldGroup.Label\");\r\n///<summary>&quot;Application&quot;</summary> \r\npublic static string AddApplication_TreeIdSelector_Label=>T(\"AddApplication.TreeIdSelector.Label\");\r\n///<summary>&quot;Select the application that you wish to add&quot;</summary> \r\npublic static string AddApplication_TreeIdSelector_Help=>T(\"AddApplication.TreeIdSelector.Help\");\r\n///<summary>&quot;Position&quot;</summary> \r\npublic static string AddApplication_PositionSelector_Label=>T(\"AddApplication.PositionSelector.Label\");\r\n///<summary>&quot;The position to insert this application&quot;</summary> \r\npublic static string AddApplication_PositionSelector_Help=>T(\"AddApplication.PositionSelector.Help\");\r\n///<summary>&quot;No applications&quot;</summary> \r\npublic static string AddApplication_NoTrees_Title=>T(\"AddApplication.NoTrees.Title\");\r\n///<summary>&quot;You have added all available applications&quot;</summary> \r\npublic static string AddApplication_NoTrees_Message=>T(\"AddApplication.NoTrees.Message\");\r\n///<summary>&quot;Remove Application&quot;</summary> \r\npublic static string RemoveApplicationWorkflow_RemoveApplication_Label=>T(\"RemoveApplicationWorkflow.RemoveApplication.Label\");\r\n///<summary>&quot;Remove existing application&quot;</summary> \r\npublic static string RemoveApplicationWorkflow_RemoveApplication_ToolTip=>T(\"RemoveApplicationWorkflow.RemoveApplication.ToolTip\");\r\n///<summary>&quot;Remove application&quot;</summary> \r\npublic static string RemoveApplication_Layout_Label=>T(\"RemoveApplication.Layout.Label\");\r\n///<summary>&quot;Remove application&quot;</summary> \r\npublic static string RemoveApplication_FieldGroup_Label=>T(\"RemoveApplication.FieldGroup.Label\");\r\n///<summary>&quot;Application&quot;</summary> \r\npublic static string RemoveApplication_TreeIdSelector_Label=>T(\"RemoveApplication.TreeIdSelector.Label\");\r\n///<summary>&quot;Select the application that you wish to remove&quot;</summary> \r\npublic static string RemoveApplication_TreeIdSelector_Help=>T(\"RemoveApplication.TreeIdSelector.Help\");\r\n///<summary>&quot;No applications&quot;</summary> \r\npublic static string RemoveApplication_NoTrees_Title=>T(\"RemoveApplication.NoTrees.Title\");\r\n///<summary>&quot;You have removed all available applications&quot;</summary> \r\npublic static string RemoveApplication_NoTrees_Message=>T(\"RemoveApplication.NoTrees.Message\");\r\n///<summary>&quot;Translate data&quot;</summary> \r\npublic static string LocalizeDataWorkflow_LocalizeDataLabel=>T(\"LocalizeDataWorkflow.LocalizeDataLabel\");\r\n///<summary>&quot;Translate data&quot;</summary> \r\npublic static string LocalizeDataWorkflow_LocalizeDataToolTip=>T(\"LocalizeDataWorkflow.LocalizeDataToolTip\");\r\n///<summary>&quot;Not yet approved or published&quot;</summary> \r\npublic static string LocalizeDataWorkflow_DisabledData=>T(\"LocalizeDataWorkflow.DisabledData\");\r\n///<summary>&quot;Failed to translate data&quot;</summary> \r\npublic static string LocalizeData_ShowError_Layout_Label=>T(\"LocalizeData.ShowError.Layout.Label\");\r\n///<summary>&quot;Translation errors&quot;</summary> \r\npublic static string LocalizeData_ShowError_InfoTable_Caption=>T(\"LocalizeData.ShowError.InfoTable.Caption\");\r\n///<summary>&quot;The following fields has a reference to a data type. You should translate these data items before you can translate this data item&quot;</summary> \r\npublic static string LocalizeData_ShowError_Description=>T(\"LocalizeData.ShowError.Description\");\r\n///<summary>&quot;The field &apos;{0}&apos; is referencing data of type &apos;{1}&apos; with the label &apos;{2}&apos;&quot;</summary> \r\npublic static string LocalizeData_ShowError_FieldErrorFormat_Template=>T(\"LocalizeData.ShowError.FieldErrorFormat\");\r\n///<summary>&quot;The field &apos;{0}&apos; is referencing data of type &apos;{1}&apos; with the label &apos;{2}&apos;&quot;</summary> \r\npublic static string LocalizeData_ShowError_FieldErrorFormat(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"LocalizeData.ShowError.FieldErrorFormat\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;This data has already been translated. The translated version belongs to a different group.&quot;</summary> \r\npublic static string LocalizeData_ShowError_AlreadyTranslated=>T(\"LocalizeData.ShowError.AlreadyTranslated\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_C1Console_Users {\r\n///<summary>&quot;Change Password...&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_ElementActionLabel=>T(\"ChangeOwnPasswordWorkflow.ElementActionLabel\");\r\n///<summary>&quot;Change your password&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_ElementActionToolTip=>T(\"ChangeOwnPasswordWorkflow.ElementActionToolTip\");\r\n///<summary>&quot;Change Password&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_Label=>T(\"ChangeOwnPasswordWorkflow.Dialog.Label\");\r\n///<summary>&quot;Existing password&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_ExistingPassword_Label=>T(\"ChangeOwnPasswordWorkflow.Dialog.ExistingPassword.Label\");\r\n///<summary>&quot;For security reasons you must present your existing password before you can continue.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_ExistingPassword_Help=>T(\"ChangeOwnPasswordWorkflow.Dialog.ExistingPassword.Help\");\r\n///<summary>&quot;New password&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_NewPassword_Label=>T(\"ChangeOwnPasswordWorkflow.Dialog.NewPassword.Label\");\r\n///<summary>&quot;The password specified in this field must match the confirmation below.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_NewPassword_Help=>T(\"ChangeOwnPasswordWorkflow.Dialog.NewPassword.Help\");\r\n///<summary>&quot;Confirm new password&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_NewPasswordConfirmed_Label=>T(\"ChangeOwnPasswordWorkflow.Dialog.NewPasswordConfirmed.Label\");\r\n///<summary>&quot;The password specified in this field must match the one specified above.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_NewPasswordConfirmed_Help=>T(\"ChangeOwnPasswordWorkflow.Dialog.NewPasswordConfirmed.Help\");\r\n///<summary>&quot;The specified password is incorrect.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_Validation_IncorrectPassword=>T(\"ChangeOwnPasswordWorkflow.Dialog.Validation.IncorrectPassword\");\r\n///<summary>&quot;The new passwords you typed do not match.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_Validation_NewPasswordFieldsNotMatch=>T(\"ChangeOwnPasswordWorkflow.Dialog.Validation.NewPasswordFieldsNotMatch\");\r\n///<summary>&quot;The old and the new passwords are the same.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_Validation_PasswordsAreTheSame=>T(\"ChangeOwnPasswordWorkflow.Dialog.Validation.PasswordsAreTheSame\");\r\n///<summary>&quot;The new password may not be an empty string.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_Validation_NewPasswordIsEmpty=>T(\"ChangeOwnPasswordWorkflow.Dialog.Validation.NewPasswordIsEmpty\");\r\n///<summary>&quot;The new password must be at least {0} characters long.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_Validation_NewPasswordTooShort_Template=>T(\"ChangeOwnPasswordWorkflow.Dialog.Validation.NewPasswordTooShort\");\r\n///<summary>&quot;The new password must be at least {0} characters long.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_Dialog_Validation_NewPasswordTooShort(object parameter0)=>string.Format(T(\"ChangeOwnPasswordWorkflow.Dialog.Validation.NewPasswordTooShort\"), parameter0);\r\n///<summary>&quot;Password change isn&apos;t supported.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_NotSupportedErrorLabel=>T(\"ChangeOwnPasswordWorkflow.NotSupportedErrorLabel\");\r\n///<summary>&quot;Password change isn&apos;t supported in current configuration.&quot;</summary> \r\npublic static string ChangeOwnPasswordWorkflow_NotSupportedErrorText=>T(\"ChangeOwnPasswordWorkflow.NotSupportedErrorText\");\r\n///<summary>&quot;Profile Settings...&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_ElementActionLabel=>T(\"ChangeOwnCultureWorkflow.ElementActionLabel\");\r\n///<summary>&quot;Set the C1 Console language and formatting of numbers, times and dates&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_ElementActionToolTip=>T(\"ChangeOwnCultureWorkflow.ElementActionToolTip\");\r\n///<summary>&quot;Profile Settings&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_Dialog_Label=>T(\"ChangeOwnCultureWorkflow.Dialog.Label\");\r\n///<summary>&quot;Display Preferences&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_Dialog_CultureSelector_Label=>T(\"ChangeOwnCultureWorkflow.Dialog.CultureSelector.Label\");\r\n///<summary>&quot;Display for time, date, and number formats within the console&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_Dialog_CultureSelector_Help=>T(\"ChangeOwnCultureWorkflow.Dialog.CultureSelector.Help\");\r\n///<summary>&quot;Console Language Preferences&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_Dialog_C1ConsoleLanguageSelector_Label=>T(\"ChangeOwnCultureWorkflow.Dialog.C1ConsoleLanguageSelector.Label\");\r\n///<summary>&quot;Language displayed within your console for labels, help texts, dialogs, etc. The available options are limited to language packages installed. See Composite.Localization packages for more language options.&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_Dialog_C1ConsoleLanguageSelector_Help=>T(\"ChangeOwnCultureWorkflow.Dialog.C1ConsoleLanguageSelector.Help\");\r\n///<summary>&quot;Change application language&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_Dialog_Confirm_Title=>T(\"ChangeOwnCultureWorkflow.Dialog.Confirm.Title\");\r\n///<summary>&quot;Are your sure you wish to change the settings? The application will restart and all your unsaved changes will be lost.&quot;</summary> \r\npublic static string ChangeOwnCultureWorkflow_Dialog_Confirm_Text=>T(\"ChangeOwnCultureWorkflow.Dialog.Confirm.Text\");\r\n///<summary>&quot;Administrators&quot;</summary> \r\npublic static string AdministratorAutoCreator_DefaultGroupName=>T(\"AdministratorAutoCreator.DefaultGroupName\");\r\n///<summary>&quot;Translation...&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_ActionLabel=>T(\"ChangeForeignLocaleWorkflow.ActionLabel\");\r\n///<summary>&quot;Change source language&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_ActionToolTip=>T(\"ChangeForeignLocaleWorkflow.ActionToolTip\");\r\n///<summary>&quot;None&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_NoForeignLocaleLabel=>T(\"ChangeForeignLocaleWorkflow.NoForeignLocaleLabel\");\r\n///<summary>&quot;Translation&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_Dialog_Label=>T(\"ChangeForeignLocaleWorkflow.Dialog.Label\");\r\n///<summary>&quot;Select language to translate from&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_FieldGroup_Label=>T(\"ChangeForeignLocaleWorkflow.FieldGroup.Label\");\r\n///<summary>&quot;Multiple languages not installed&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_NoOrOneActiveLocales_Title=>T(\"ChangeForeignLocaleWorkflow.NoOrOneActiveLocales.Title\");\r\n///<summary>&quot;Two or more languages must be installed in order to support translations. Administrators can add more languages in the &apos;System&apos; perspective.&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_NoOrOneActiveLocales_Description=>T(\"ChangeForeignLocaleWorkflow.NoOrOneActiveLocales.Description\");\r\n///<summary>&quot;From-language&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_ForeignCultureSelector_Label=>T(\"ChangeForeignLocaleWorkflow.ForeignCultureSelector.Label\");\r\n///<summary>&quot;Pages written in the from-language will be indicated by globe icons in the Content tree. The associated &quot;Translate Page&quot; action imports the page into the current working language.&quot;</summary> \r\npublic static string ChangeForeignLocaleWorkflow_ForeignCultureSelector_Help=>T(\"ChangeForeignLocaleWorkflow.ForeignCultureSelector.Help\");\r\n///<summary>&quot;The active language has been changed&quot;</summary> \r\npublic static string ChangeOwnActiveLocaleWorkflow_CloseAllViews_Message=>T(\"ChangeOwnActiveLocaleWorkflow.CloseAllViews.Message\");\r\n///<summary>&quot;Password should be at least {0} characters long.&quot;</summary> \r\npublic static string PasswordRules_MinimumLength_Template=>T(\"PasswordRules.MinimumLength\");\r\n///<summary>&quot;Password should be at least {0} characters long.&quot;</summary> \r\npublic static string PasswordRules_MinimumLength(object parameter0)=>string.Format(T(\"PasswordRules.MinimumLength\"), parameter0);\r\n///<summary>&quot;Password should not match any of the previously used {0} passwords.&quot;</summary> \r\npublic static string PasswordRules_EnforcePasswordHistory_Template=>T(\"PasswordRules.EnforcePasswordHistory\");\r\n///<summary>&quot;Password should not match any of the previously used {0} passwords.&quot;</summary> \r\npublic static string PasswordRules_EnforcePasswordHistory(object parameter0)=>string.Format(T(\"PasswordRules.EnforcePasswordHistory\"), parameter0);\r\n///<summary>&quot;Password should contain 3/4 of the following items: uppercase letters, lowercase letters, numbers, symbols.&quot;</summary> \r\npublic static string PasswordRules_DifferentCharacterGroups=>T(\"PasswordRules.DifferentCharacterGroups\");\r\n///<summary>&quot;Password should not be based on a user name.&quot;</summary> \r\npublic static string PasswordRules_DoNotUseUserName=>T(\"PasswordRules.DoNotUseUserName\");\r\n///<summary>&quot;Confirmation password mismatch&quot;</summary> \r\npublic static string ChangePasswordForm_ConfirmationPasswordMimatch=>T(\"ChangePasswordForm.ConfirmationPasswordMimatch\");\r\n///<summary>&quot;Username&quot;</summary> \r\npublic static string ChangePasswordForm_Username=>T(\"ChangePasswordForm.Username\");\r\n///<summary>&quot;Old Password&quot;</summary> \r\npublic static string ChangePasswordForm_OldPassword=>T(\"ChangePasswordForm.OldPassword\");\r\n///<summary>&quot;New Password&quot;</summary> \r\npublic static string ChangePasswordForm_NewPassword=>T(\"ChangePasswordForm.NewPassword\");\r\n///<summary>&quot;Confirm Password&quot;</summary> \r\npublic static string ChangePasswordForm_ConfirmPassword=>T(\"ChangePasswordForm.ConfirmPassword\");\r\n///<summary>&quot;Change Password&quot;</summary> \r\npublic static string ChangePasswordForm_ChangePasswordButton=>T(\"ChangePasswordForm.ChangePasswordButton\");\r\n///<summary>&quot;Password is older than {0} days. Please change your password.&quot;</summary> \r\npublic static string ChangePasswordForm_PasswordExpiredMessage_Template=>T(\"ChangePasswordForm.PasswordExpiredMessage\");\r\n///<summary>&quot;Password is older than {0} days. Please change your password.&quot;</summary> \r\npublic static string ChangePasswordForm_PasswordExpiredMessage(object parameter0)=>string.Format(T(\"ChangePasswordForm.PasswordExpiredMessage\"), parameter0);\r\n///<summary>&quot;The old password is incorrect.&quot;</summary> \r\npublic static string ChangePasswordForm_IncorrectOldPassword=>T(\"ChangePasswordForm.IncorrectOldPassword\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.C1Console.Users\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Core_PackageSystem_PackageFragmentInstallers {\r\n///<summary>&quot;The package composite version requirements does not match the current composite version &apos;{0}&apos;. Expected version range [{1} - {2}]&quot;</summary> \r\npublic static string PackageManager_CompositeVersionMisMatch_Template=>T(\"PackageManager.CompositeVersionMisMatch\");\r\n///<summary>&quot;The package composite version requirements does not match the current composite version &apos;{0}&apos;. Expected version range [{1} - {2}]&quot;</summary> \r\npublic static string PackageManager_CompositeVersionMisMatch(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"PackageManager.CompositeVersionMisMatch\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;Package is already installed&quot;</summary> \r\npublic static string PackageManager_PackageAlreadyInstalled=>T(\"PackageManager.PackageAlreadyInstalled\");\r\n///<summary>&quot;A newer version of the package is already installed&quot;</summary> \r\npublic static string PackageManager_NewerVersionInstalled=>T(\"PackageManager.NewerVersionInstalled\");\r\n///<summary>&quot;Could not locate the package directory path &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageManager_MissingPackageDirectory_Template=>T(\"PackageManager.MissingPackageDirectory\");\r\n///<summary>&quot;Could not locate the package directory path &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageManager_MissingPackageDirectory(object parameter0)=>string.Format(T(\"PackageManager.MissingPackageDirectory\"), parameter0);\r\n///<summary>&quot;The package is marked as non uninstallable&quot;</summary> \r\npublic static string PackageManager_Uninstallable=>T(\"PackageManager.Uninstallable\");\r\n///<summary>&quot;Could not locate the package zip file path &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageManager_MissingZipFile_Template=>T(\"PackageManager.MissingZipFile\");\r\n///<summary>&quot;Could not locate the package zip file path &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageManager_MissingZipFile(object parameter0)=>string.Format(T(\"PackageManager.MissingZipFile\"), parameter0);\r\n///<summary>&quot;Could not locate the package uninstall file path &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageManager_MissingUninstallFile_Template=>T(\"PackageManager.MissingUninstallFile\");\r\n///<summary>&quot;Could not locate the package uninstall file path &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageManager_MissingUninstallFile(object parameter0)=>string.Format(T(\"PackageManager.MissingUninstallFile\"), parameter0);\r\n///<summary>&quot;Missing &apos;{0}&apos; element.&quot;</summary> \r\npublic static string PackageManager_MissingElement_Template=>T(\"PackageManager.MissingElement\");\r\n///<summary>&quot;Missing &apos;{0}&apos; element.&quot;</summary> \r\npublic static string PackageManager_MissingElement(object parameter0)=>string.Format(T(\"PackageManager.MissingElement\"), parameter0);\r\n///<summary>&quot;Missing &apos;{0}&apos; attribute.&quot;</summary> \r\npublic static string PackageManager_MissingAttribute_Template=>T(\"PackageManager.MissingAttribute\");\r\n///<summary>&quot;Missing &apos;{0}&apos; attribute.&quot;</summary> \r\npublic static string PackageManager_MissingAttribute(object parameter0)=>string.Format(T(\"PackageManager.MissingAttribute\"), parameter0);\r\n///<summary>&quot;&apos;{0}&apos; attribute value is not a valid value.&quot;</summary> \r\npublic static string PackageManager_InvalidAttributeValue_Template=>T(\"PackageManager.InvalidAttributeValue\");\r\n///<summary>&quot;&apos;{0}&apos; attribute value is not a valid value.&quot;</summary> \r\npublic static string PackageManager_InvalidAttributeValue(object parameter0)=>string.Format(T(\"PackageManager.InvalidAttributeValue\"), parameter0);\r\n///<summary>&quot;&apos;{0}&apos; element value is not a valid value&quot;</summary> \r\npublic static string PackageManager_InvalidElementValue_Template=>T(\"PackageManager.InvalidElementValue\");\r\n///<summary>&quot;&apos;{0}&apos; element value is not a valid value&quot;</summary> \r\npublic static string PackageManager_InvalidElementValue(object parameter0)=>string.Format(T(\"PackageManager.InvalidElementValue\"), parameter0);\r\n///<summary>&quot;Expected exactly two elements, &apos;{0}&apos; and &apos;{1}&apos;&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_ExpectedExactlyTwoElements_Template=>T(\"ConfigurationTransformationPackageFragmentInstaller.ExpectedExactlyTwoElements\");\r\n///<summary>&quot;Expected exactly two elements, &apos;{0}&apos; and &apos;{1}&apos;&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_ExpectedExactlyTwoElements(object parameter0,object parameter1)=>string.Format(T(\"ConfigurationTransformationPackageFragmentInstaller.ExpectedExactlyTwoElements\"), parameter0,parameter1);\r\n///<summary>&quot;Missing &apos;{0}&apos; element.&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_MissingElement_Template=>T(\"ConfigurationTransformationPackageFragmentInstaller.MissingElement\");\r\n///<summary>&quot;Missing &apos;{0}&apos; element.&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_MissingElement(object parameter0)=>string.Format(T(\"ConfigurationTransformationPackageFragmentInstaller.MissingElement\"), parameter0);\r\n///<summary>&quot;Missing &apos;{0}&apos; attribute.&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_MissingAttribute_Template=>T(\"ConfigurationTransformationPackageFragmentInstaller.MissingAttribute\");\r\n///<summary>&quot;Missing &apos;{0}&apos; attribute.&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_MissingAttribute(object parameter0)=>string.Format(T(\"ConfigurationTransformationPackageFragmentInstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;The path &apos;{0}&apos; does not exist in the ZIP.&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_PathDoesNotExist_Template=>T(\"ConfigurationTransformationPackageFragmentInstaller.PathDoesNotExist\");\r\n///<summary>&quot;The path &apos;{0}&apos; does not exist in the ZIP.&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_PathDoesNotExist(object parameter0)=>string.Format(T(\"ConfigurationTransformationPackageFragmentInstaller.PathDoesNotExist\"), parameter0);\r\n///<summary>&quot;Unable to parse ZIP&apos;ed XSLT file &apos;{0}&apos;. {1}&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_UnableToParsXslt_Template=>T(\"ConfigurationTransformationPackageFragmentInstaller.UnableToParsXslt\");\r\n///<summary>&quot;Unable to parse ZIP&apos;ed XSLT file &apos;{0}&apos;. {1}&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_UnableToParsXslt(object parameter0,object parameter1)=>string.Format(T(\"ConfigurationTransformationPackageFragmentInstaller.UnableToParsXslt\"), parameter0,parameter1);\r\n///<summary>&quot;The XSLT file &apos;{0}&apos; will generate an invalid Configuration file. {1}&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_XsltWillGeneratedInvalid_Template=>T(\"ConfigurationTransformationPackageFragmentInstaller.XsltWillGeneratedInvalid\");\r\n///<summary>&quot;The XSLT file &apos;{0}&apos; will generate an invalid Configuration file. {1}&quot;</summary> \r\npublic static string ConfigurationTransformationPackageFragmentInstaller_XsltWillGeneratedInvalid(object parameter0,object parameter1)=>string.Format(T(\"ConfigurationTransformationPackageFragmentInstaller.XsltWillGeneratedInvalid\"), parameter0,parameter1);\r\n///<summary>&quot;Only one &apos;Types&apos; element allowed&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_OnlyOneElement=>T(\"DataPackageFragmentInstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing &apos;Types&apos; element&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingElement=>T(\"DataPackageFragmentInstaller.MissingElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingAttribute_Template=>T(\"DataPackageFragmentInstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingAttribute(object parameter0)=>string.Format(T(\"DataPackageFragmentInstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;Wrong DataScopeIdentifier ({0}) name in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_WrongDataScopeIdentifier_Template=>T(\"DataPackageFragmentInstaller.WrongDataScopeIdentifier\");\r\n///<summary>&quot;Wrong DataScopeIdentifier ({0}) name in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_WrongDataScopeIdentifier(object parameter0)=>string.Format(T(\"DataPackageFragmentInstaller.WrongDataScopeIdentifier\"), parameter0);\r\n///<summary>&quot;Wrong culture ({0}) name in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_WrongLocale_Template=>T(\"DataPackageFragmentInstaller.WrongLocale\");\r\n///<summary>&quot;Wrong culture ({0}) name in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_WrongLocale(object parameter0)=>string.Format(T(\"DataPackageFragmentInstaller.WrongLocale\"), parameter0);\r\n///<summary>&quot;Missing file &apos;{0}&apos; in the package zip&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingFile_Template=>T(\"DataPackageFragmentInstaller.MissingFile\");\r\n///<summary>&quot;Missing file &apos;{0}&apos; in the package zip&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingFile(object parameter0)=>string.Format(T(\"DataPackageFragmentInstaller.MissingFile\"), parameter0);\r\n///<summary>&quot;The data interface type &apos;{0}&apos; has not been configured in the system&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_TypeNotConfigured_Template=>T(\"DataPackageFragmentInstaller.TypeNotConfigured\");\r\n///<summary>&quot;The data interface type &apos;{0}&apos; has not been configured in the system&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_TypeNotConfigured(object parameter0)=>string.Format(T(\"DataPackageFragmentInstaller.TypeNotConfigured\"), parameter0);\r\n///<summary>&quot;The data interface type &apos;{0}&apos; does not inherit the interface &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_TypeNotInheriting_Template=>T(\"DataPackageFragmentInstaller.TypeNotInheriting\");\r\n///<summary>&quot;The data interface type &apos;{0}&apos; does not inherit the interface &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_TypeNotInheriting(object parameter0,object parameter1)=>string.Format(T(\"DataPackageFragmentInstaller.TypeNotInheriting\"), parameter0,parameter1);\r\n///<summary>&quot;The data interface type &apos;{0}&apos; does not have a property named &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingProperty_Template=>T(\"DataPackageFragmentInstaller.MissingProperty\");\r\n///<summary>&quot;The data interface type &apos;{0}&apos; does not have a property named &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingProperty(object parameter0,object parameter1)=>string.Format(T(\"DataPackageFragmentInstaller.MissingProperty\"), parameter0,parameter1);\r\n///<summary>&quot;The data interface type &apos;{0}&apos; does not have a writable property named &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingWritableProperty_Template=>T(\"DataPackageFragmentInstaller.MissingWritableProperty\");\r\n///<summary>&quot;The data interface type &apos;{0}&apos; does not have a writable property named &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingWritableProperty(object parameter0,object parameter1)=>string.Format(T(\"DataPackageFragmentInstaller.MissingWritableProperty\"), parameter0,parameter1);\r\n///<summary>&quot;Could not convert the value &apos;{0}&apos; to the type &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_ConversionFailed_Template=>T(\"DataPackageFragmentInstaller.ConversionFailed\");\r\n///<summary>&quot;Could not convert the value &apos;{0}&apos; to the type &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_ConversionFailed(object parameter0,object parameter1)=>string.Format(T(\"DataPackageFragmentInstaller.ConversionFailed\"), parameter0,parameter1);\r\n///<summary>&quot;The property &apos;{0}&apos; on the interface &apos;{1}&apos; is missing a value.&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingPropertyVaule_Template=>T(\"DataPackageFragmentInstaller.MissingPropertyVaule\");\r\n///<summary>&quot;The property &apos;{0}&apos; on the interface &apos;{1}&apos; is missing a value.&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingPropertyVaule(object parameter0,object parameter1)=>string.Format(T(\"DataPackageFragmentInstaller.MissingPropertyVaule\"), parameter0,parameter1);\r\n///<summary>&quot;Data type &apos;{0}&apos;: {1} record(s) already installed&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_DataExists_Template=>T(\"DataPackageFragmentInstaller.DataExists\");\r\n///<summary>&quot;Data type &apos;{0}&apos;: {1} record(s) already installed&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_DataExists(object parameter0,object parameter1)=>string.Format(T(\"DataPackageFragmentInstaller.DataExists\"), parameter0,parameter1);\r\n///<summary>&quot;Missing data type descriptor for the type {0}&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingTypeDescriptor_Template=>T(\"DataPackageFragmentInstaller.MissingTypeDescriptor\");\r\n///<summary>&quot;Missing data type descriptor for the type {0}&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_MissingTypeDescriptor(object parameter0)=>string.Format(T(\"DataPackageFragmentInstaller.MissingTypeDescriptor\"), parameter0);\r\n///<summary>&quot;The data type &apos;{0}&apos; is not localized but a locale is specified in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_TypeNonLocalizedWithLocale_Template=>T(\"DataPackageFragmentInstaller.TypeNonLocalizedWithLocale\");\r\n///<summary>&quot;The data type &apos;{0}&apos; is not localized but a locale is specified in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_TypeNonLocalizedWithLocale(object parameter0)=>string.Format(T(\"DataPackageFragmentInstaller.TypeNonLocalizedWithLocale\"), parameter0);\r\n///<summary>&quot;The data type &apos;{0}&apos; is localized but no locale is specified in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_TypeLocalizedWithoutLocale_Template=>T(\"DataPackageFragmentInstaller.TypeLocalizedWithoutLocale\");\r\n///<summary>&quot;The data type &apos;{0}&apos; is localized but no locale is specified in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_TypeLocalizedWithoutLocale(object parameter0)=>string.Format(T(\"DataPackageFragmentInstaller.TypeLocalizedWithoutLocale\"), parameter0);\r\n///<summary>&quot;Referenced data missing. Type: {0}, {1}: &apos;{2}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_ReferencedDataMissing_Template=>T(\"DataPackageFragmentInstaller.ReferencedDataMissing\");\r\n///<summary>&quot;Referenced data missing. Type: {0}, {1}: &apos;{2}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentInstaller_ReferencedDataMissing(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"DataPackageFragmentInstaller.ReferencedDataMissing\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;Only one &apos;Types&apos; element allowed&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_OnlyOneElement=>T(\"DataPackageFragmentUninstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_MissingAttribute_Template=>T(\"DataPackageFragmentUninstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_MissingAttribute(object parameter0)=>string.Format(T(\"DataPackageFragmentUninstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;The data type &apos;{0}&apos; does not contain a key property named &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_MissingKeyProperty_Template=>T(\"DataPackageFragmentUninstaller.MissingKeyProperty\");\r\n///<summary>&quot;The data type &apos;{0}&apos; does not contain a key property named &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_MissingKeyProperty(object parameter0,object parameter1)=>string.Format(T(\"DataPackageFragmentUninstaller.MissingKeyProperty\"), parameter0,parameter1);\r\n///<summary>&quot;Data item &apos;{0}&apos; of type {1} is referenced from a data item &apos;{2}&apos; of type &apos;{3}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_DataIsReferenced_Template=>T(\"DataPackageFragmentUninstaller.DataIsReferenced\");\r\n///<summary>&quot;Data item &apos;{0}&apos; of type {1} is referenced from a data item &apos;{2}&apos; of type &apos;{3}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_DataIsReferenced(object parameter0,object parameter1,object parameter2,object parameter3)=>string.Format(T(\"DataPackageFragmentUninstaller.DataIsReferenced\"), parameter0,parameter1,parameter2,parameter3);\r\n///<summary>&quot;Page type &apos;{0}&apos; is referenced by page &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_PageTypeIsReferenced_Template=>T(\"DataPackageFragmentUninstaller.PageTypeIsReferenced\");\r\n///<summary>&quot;Page type &apos;{0}&apos; is referenced by page &apos;{1}&apos;&quot;</summary> \r\npublic static string DataPackageFragmentUninstaller_PageTypeIsReferenced(object parameter0,object parameter1)=>string.Format(T(\"DataPackageFragmentUninstaller.PageTypeIsReferenced\"), parameter0,parameter1);\r\n///<summary>&quot;Only one &apos;Types&apos; element allowed&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_OnlyOneElement=>T(\"DataTypePackageFragmentInstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing &apos;Types&apos; element&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_MissingElement=>T(\"DataTypePackageFragmentInstaller.MissingElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_MissingAttribute_Template=>T(\"DataTypePackageFragmentInstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_MissingAttribute(object parameter0)=>string.Format(T(\"DataTypePackageFragmentInstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;The data interface type &apos;{0}&apos; has not been configured in the system&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_TypeNotConfigured_Template=>T(\"DataTypePackageFragmentInstaller.TypeNotConfigured\");\r\n///<summary>&quot;The data interface type &apos;{0}&apos; has not been configured in the system&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_TypeNotConfigured(object parameter0)=>string.Format(T(\"DataTypePackageFragmentInstaller.TypeNotConfigured\"), parameter0);\r\n///<summary>&quot;The data interface type &apos;{0}&apos; does not inherit the interface &apos;{1}&apos;&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_TypeNotInheriting_Template=>T(\"DataTypePackageFragmentInstaller.TypeNotInheriting\");\r\n///<summary>&quot;The data interface type &apos;{0}&apos; does not inherit the interface &apos;{1}&apos;&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_TypeNotInheriting(object parameter0,object parameter1)=>string.Format(T(\"DataTypePackageFragmentInstaller.TypeNotInheriting\"), parameter0,parameter1);\r\n///<summary>&quot;The interface type &apos;{0}&apos; is already exists in the system&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_TypeExists_Template=>T(\"DataTypePackageFragmentInstaller.TypeExists\");\r\n///<summary>&quot;The interface type &apos;{0}&apos; is already exists in the system&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_TypeExists(object parameter0)=>string.Format(T(\"DataTypePackageFragmentInstaller.TypeExists\"), parameter0);\r\n///<summary>&quot;Failed to build a data type descriptor for interface &apos;{0}&apos;&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_InterfaceCodeError_Template=>T(\"DataTypePackageFragmentInstaller.InterfaceCodeError\");\r\n///<summary>&quot;Failed to build a data type descriptor for interface &apos;{0}&apos;&quot;</summary> \r\npublic static string DataTypePackageFragmentInstaller_InterfaceCodeError(object parameter0)=>string.Format(T(\"DataTypePackageFragmentInstaller.InterfaceCodeError\"), parameter0);\r\n///<summary>&quot;Only one &apos;Types&apos; element allowed&quot;</summary> \r\npublic static string DataTypePackageFragmentUninstaller_OnlyOneElement=>T(\"DataTypePackageFragmentUninstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DataTypePackageFragmentUninstaller_MissingAttribute_Template=>T(\"DataTypePackageFragmentUninstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DataTypePackageFragmentUninstaller_MissingAttribute(object parameter0)=>string.Format(T(\"DataTypePackageFragmentUninstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;Wrong attribute format in the configuration&quot;</summary> \r\npublic static string DataTypePackageFragmentUninstaller_WrongAttributeFormat=>T(\"DataTypePackageFragmentUninstaller.WrongAttributeFormat\");\r\n///<summary>&quot;Only one &apos;Types&apos; element allowed&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_OnlyOneElement=>T(\"DynamicDataTypePackageFragmentInstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing &apos;Types&apos; element&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_MissingElement=>T(\"DynamicDataTypePackageFragmentInstaller.MissingElement\");\r\n///<summary>&quot;Error xml parsing the dataTypeDescriptor attribute&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_DataTypeDescriptorParseError=>T(\"DynamicDataTypePackageFragmentInstaller.DataTypeDescriptorParseError\");\r\n///<summary>&quot;Error while deserializing a DataType. Error text: {0}.&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_DataTypeDescriptorDeserializeError_Template=>T(\"DynamicDataTypePackageFragmentInstaller.DataTypeDescriptorDeserializeError\");\r\n///<summary>&quot;Error while deserializing a DataType. Error text: {0}.&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_DataTypeDescriptorDeserializeError(object parameter0)=>string.Format(T(\"DynamicDataTypePackageFragmentInstaller.DataTypeDescriptorDeserializeError\"), parameter0);\r\n///<summary>&quot;Cannot find a referenced type &apos;{0}&apos;.&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_MissingReferencedType_Template=>T(\"DynamicDataTypePackageFragmentInstaller.MissingReferencedType\");\r\n///<summary>&quot;Cannot find a referenced type &apos;{0}&apos;.&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_MissingReferencedType(object parameter0)=>string.Format(T(\"DynamicDataTypePackageFragmentInstaller.MissingReferencedType\"), parameter0);\r\n///<summary>&quot;The interface type &apos;{0}&apos; is already exists in the system&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_TypeExists_Template=>T(\"DynamicDataTypePackageFragmentInstaller.TypeExists\");\r\n///<summary>&quot;The interface type &apos;{0}&apos; is already exists in the system&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentInstaller_TypeExists(object parameter0)=>string.Format(T(\"DynamicDataTypePackageFragmentInstaller.TypeExists\"), parameter0);\r\n///<summary>&quot;Only one &apos;Types&apos; element allowed&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentUninstaller_OnlyOneElement=>T(\"DynamicDataTypePackageFragmentUninstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentUninstaller_MissingAttribute_Template=>T(\"DynamicDataTypePackageFragmentUninstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentUninstaller_MissingAttribute(object parameter0)=>string.Format(T(\"DynamicDataTypePackageFragmentUninstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;Wrong attribute format in the configuration&quot;</summary> \r\npublic static string DynamicDataTypePackageFragmentUninstaller_WrongAttributeFormat=>T(\"DynamicDataTypePackageFragmentUninstaller.WrongAttributeFormat\");\r\n///<summary>&quot;Only one &apos;Files&apos; element allowed&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_OnlyOneFilesElement=>T(\"FilePackageFragmentInstaller.OnlyOneFilesElement\");\r\n///<summary>&quot;Only one &apos;Directories&apos; element allowed&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_OnlyOneDirectoriesElement=>T(\"FilePackageFragmentInstaller.OnlyOneDirectoriesElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_MissingAttribute_Template=>T(\"FilePackageFragmentInstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_MissingAttribute(object parameter0)=>string.Format(T(\"FilePackageFragmentInstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;The &apos;deleteTargetDirectory&apos; attribute can only be applied to directories, not files&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_DeleteTargetDirectoryNotAllowed=>T(\"FilePackageFragmentInstaller.DeleteTargetDirectoryNotAllowed\");\r\n///<summary>&quot;Wrong attribute value format, bool value expected&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_WrongAttributeBoolFormat=>T(\"FilePackageFragmentInstaller.WrongAttributeBoolFormat\");\r\n///<summary>&quot;The install zip-file does not contain the file &apos;{0}&apos;&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_MissingFile_Template=>T(\"FilePackageFragmentInstaller.MissingFile\");\r\n///<summary>&quot;The install zip-file does not contain the file &apos;{0}&apos;&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_MissingFile(object parameter0)=>string.Format(T(\"FilePackageFragmentInstaller.MissingFile\"), parameter0);\r\n///<summary>&quot;The file &apos;{0}&apos; already exists&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_FileExists_Template=>T(\"FilePackageFragmentInstaller.FileExists\");\r\n///<summary>&quot;The file &apos;{0}&apos; already exists&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_FileExists(object parameter0)=>string.Format(T(\"FilePackageFragmentInstaller.FileExists\"), parameter0);\r\n///<summary>&quot;File &apos;{0}&apos; marked as &apos;Read Only&apos; and therefore cannot be overwritten.&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_FileReadOnly_Template=>T(\"FilePackageFragmentInstaller.FileReadOnly\");\r\n///<summary>&quot;File &apos;{0}&apos; marked as &apos;Read Only&apos; and therefore cannot be overwritten.&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_FileReadOnly(object parameter0)=>string.Format(T(\"FilePackageFragmentInstaller.FileReadOnly\"), parameter0);\r\n///<summary>&quot;The &apos;assemblyLoad&apos; attribute can only be applied to files, not directories&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_AssemblyLoadNotAllowed=>T(\"FilePackageFragmentInstaller.AssemblyLoadNotAllowed\");\r\n///<summary>&quot;The &apos;onlyUpdate&apos; attribute can only be applied to files, not directories&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_OnlyUpdateNotAllowed=>T(\"FilePackageFragmentInstaller.OnlyUpdateNotAllowed\");\r\n///<summary>&quot;The &apos;onlyUpdate&apos; attribute is not allowed in combination with the &apos;loadAssembly&apos; attribute&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_OnlyUpdateNotAllowedWithLoadAssemlby=>T(\"FilePackageFragmentInstaller.OnlyUpdateNotAllowedWithLoadAssemlby\");\r\n///<summary>&quot;The &apos;onlyUpdate&apos; and &apos;onlyAdd&apos; attributes are now allowed on the same element&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_OnlyUpdateAndOnlyAddNotAllowed=>T(\"FilePackageFragmentInstaller.OnlyUpdateAndOnlyAddNotAllowed\");\r\n///<summary>&quot;The &apos;onlyAdd&apos; and &apos;allowOverwrite&apos; attributes are now allowed on the same element&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_OnlyAddAndAllowOverwriteNotAllowed=>T(\"FilePackageFragmentInstaller.OnlyAddAndAllowOverwriteNotAllowed\");\r\n///<summary>&quot;The install zip-file does not contain the directory &apos;{0}&apos;&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_MissingDirectory_Template=>T(\"FilePackageFragmentInstaller.MissingDirectory\");\r\n///<summary>&quot;The install zip-file does not contain the directory &apos;{0}&apos;&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_MissingDirectory(object parameter0)=>string.Format(T(\"FilePackageFragmentInstaller.MissingDirectory\"), parameter0);\r\n///<summary>&quot;Uninstall.xml contains file pathes, binded to the original website location, and therefore the package cannot be uninstalled safely.&quot;</summary> \r\npublic static string FilePackageFragmentInstaller_WrongBasePath=>T(\"FilePackageFragmentInstaller.WrongBasePath\");\r\n///<summary>&quot;Only one &apos;Files&apos; element allowed&quot;</summary> \r\npublic static string FilePackageFragmentUninstaller_OnlyOneFilesElement=>T(\"FilePackageFragmentUninstaller.OnlyOneFilesElement\");\r\n///<summary>&quot;Only one &apos;Areas&apos; element allowed&quot;</summary> \r\npublic static string VirtualElementProviderNodePackageFragmentInstaller_OnlyOneElement=>T(\"VirtualElementProviderNodePackageFragmentInstaller.OnlyOneElement\");\r\n///<summary>&quot;Could not find the type &apos;{0}&apos;&quot;</summary> \r\npublic static string VirtualElementProviderNodePackageFragmentInstaller_MissingType_Template=>T(\"VirtualElementProviderNodePackageFragmentInstaller.MissingType\");\r\n///<summary>&quot;Could not find the type &apos;{0}&apos;&quot;</summary> \r\npublic static string VirtualElementProviderNodePackageFragmentInstaller_MissingType(object parameter0)=>string.Format(T(\"VirtualElementProviderNodePackageFragmentInstaller.MissingType\"), parameter0);\r\n///<summary>&quot;Could not find the icon &apos;{0}&apos;&quot;</summary> \r\npublic static string VirtualElementProviderNodePackageFragmentInstaller_MissingIcon_Template=>T(\"VirtualElementProviderNodePackageFragmentInstaller.MissingIcon\");\r\n///<summary>&quot;Could not find the icon &apos;{0}&apos;&quot;</summary> \r\npublic static string VirtualElementProviderNodePackageFragmentInstaller_MissingIcon(object parameter0)=>string.Format(T(\"VirtualElementProviderNodePackageFragmentInstaller.MissingIcon\"), parameter0);\r\n///<summary>&quot;Only one &apos;Areas&apos; element allowed&quot;</summary> \r\npublic static string VirtualElementProviderNodePackageFragmentUninstaller_OnlyOneElement=>T(\"VirtualElementProviderNodePackageFragmentUninstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string VirtualElementProviderNodePackageFragmentUninstaller_MissingAttribute_Template=>T(\"VirtualElementProviderNodePackageFragmentUninstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string VirtualElementProviderNodePackageFragmentUninstaller_MissingAttribute(object parameter0)=>string.Format(T(\"VirtualElementProviderNodePackageFragmentUninstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;File &apos;{0}&apos; not found&quot;</summary> \r\npublic static string FileXslTransformationPackageFragmentInstaller_FileNotFound_Template=>T(\"FileXslTransformationPackageFragmentInstaller.FileNotFound\");\r\n///<summary>&quot;File &apos;{0}&apos; not found&quot;</summary> \r\npublic static string FileXslTransformationPackageFragmentInstaller_FileNotFound(object parameter0)=>string.Format(T(\"FileXslTransformationPackageFragmentInstaller.FileNotFound\"), parameter0);\r\n///<summary>&quot;File &apos;{0}&apos; marked as &apos;Read Only&apos; and therefore cannot be overwritten.&quot;</summary> \r\npublic static string FileXslTransformationPackageFragmentInstaller_FileReadOnly_Template=>T(\"FileXslTransformationPackageFragmentInstaller.FileReadOnly\");\r\n///<summary>&quot;File &apos;{0}&apos; marked as &apos;Read Only&apos; and therefore cannot be overwritten.&quot;</summary> \r\npublic static string FileXslTransformationPackageFragmentInstaller_FileReadOnly(object parameter0)=>string.Format(T(\"FileXslTransformationPackageFragmentInstaller.FileReadOnly\"), parameter0);\r\n///<summary>&quot;File &apos;{0}&apos; was marked as &apos;Read Only&apos;. This file attribute was explicitly removed and the file was updated normally.&quot;</summary> \r\npublic static string FileXslTransformationPackageFragmentInstaller_FileReadOnlyOverride_Template=>T(\"FileXslTransformationPackageFragmentInstaller.FileReadOnlyOverride\");\r\n///<summary>&quot;File &apos;{0}&apos; was marked as &apos;Read Only&apos;. This file attribute was explicitly removed and the file was updated normally.&quot;</summary> \r\npublic static string FileXslTransformationPackageFragmentInstaller_FileReadOnlyOverride(object parameter0)=>string.Format(T(\"FileXslTransformationPackageFragmentInstaller.FileReadOnlyOverride\"), parameter0);\r\n///<summary>&quot;Only one &apos;PackageVersions&apos; element allowed&quot;</summary> \r\npublic static string PackageVersionBumperFragmentInstaller_OnlyOneElement=>T(\"PackageVersionBumperFragmentInstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string PackageVersionBumperFragmentInstaller_MissingAttribute_Template=>T(\"PackageVersionBumperFragmentInstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string PackageVersionBumperFragmentInstaller_MissingAttribute(object parameter0)=>string.Format(T(\"PackageVersionBumperFragmentInstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;Wrong attribute value format, Guid value expected&quot;</summary> \r\npublic static string PackageVersionBumperFragmentInstaller_WrongAttributeGuidFormat=>T(\"PackageVersionBumperFragmentInstaller.WrongAttributeGuidFormat\");\r\n///<summary>&quot;The package id duplicate: &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageVersionBumperFragmentInstaller_PackageIdDuplicate_Template=>T(\"PackageVersionBumperFragmentInstaller.PackageIdDuplicate\");\r\n///<summary>&quot;The package id duplicate: &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageVersionBumperFragmentInstaller_PackageIdDuplicate(object parameter0)=>string.Format(T(\"PackageVersionBumperFragmentInstaller.PackageIdDuplicate\"), parameter0);\r\n///<summary>&quot;Wrong attribute value format, Version value expected (x.y.z)&quot;</summary> \r\npublic static string PackageVersionBumperFragmentInstaller_WrongAttributeVersionFormat=>T(\"PackageVersionBumperFragmentInstaller.WrongAttributeVersionFormat\");\r\n///<summary>&quot;Only one &apos;PackageVersions&apos; element allowed&quot;</summary> \r\npublic static string PackageVersionBumperFragmentUninstaller_OnlyOneElement=>T(\"PackageVersionBumperFragmentUninstaller.OnlyOneElement\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string PackageVersionBumperFragmentUninstaller_MissingAttribute_Template=>T(\"PackageVersionBumperFragmentUninstaller.MissingAttribute\");\r\n///<summary>&quot;Missing {0} attribute in the configuration&quot;</summary> \r\npublic static string PackageVersionBumperFragmentUninstaller_MissingAttribute(object parameter0)=>string.Format(T(\"PackageVersionBumperFragmentUninstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;Wrong attribute value format, Guid value expected&quot;</summary> \r\npublic static string PackageVersionBumperFragmentUninstaller_WrongAttributeGuidFormat=>T(\"PackageVersionBumperFragmentUninstaller.WrongAttributeGuidFormat\");\r\n///<summary>&quot;The package id duplicate: &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageVersionBumperFragmentUninstaller_PackageIdDuplicate_Template=>T(\"PackageVersionBumperFragmentUninstaller.PackageIdDuplicate\");\r\n///<summary>&quot;The package id duplicate: &apos;{0}&apos;&quot;</summary> \r\npublic static string PackageVersionBumperFragmentUninstaller_PackageIdDuplicate(object parameter0)=>string.Format(T(\"PackageVersionBumperFragmentUninstaller.PackageIdDuplicate\"), parameter0);\r\n///<summary>&quot;Wrong attribute value format, Version value expected (x.y.z)&quot;</summary> \r\npublic static string PackageVersionBumperFragmentUninstaller_WrongAttributeVersionFormat=>T(\"PackageVersionBumperFragmentUninstaller.WrongAttributeVersionFormat\");\r\n///<summary>&quot;A public RSA key is missing in the package configuration&quot;</summary> \r\npublic static string PackageLicenseFragmentInstaller_MissingPublicKeyElement=>T(\"PackageLicenseFragmentInstaller.MissingPublicKeyElement\");\r\n///<summary>&quot;File &apos;{0}&apos; does not exist.&quot;</summary> \r\npublic static string FileModifyPackageFragmentInstaller_FileDoesNotExist_Template=>T(\"FileModifyPackageFragmentInstaller.FileDoesNotExist\");\r\n///<summary>&quot;File &apos;{0}&apos; does not exist.&quot;</summary> \r\npublic static string FileModifyPackageFragmentInstaller_FileDoesNotExist(object parameter0)=>string.Format(T(\"FileModifyPackageFragmentInstaller.FileDoesNotExist\"), parameter0);\r\n///<summary>&quot;Invalid license key&quot;</summary> \r\npublic static string License_InvalidKeyTitle=>T(\"License.InvalidKeyTitle\");\r\n///<summary>&quot;The license key is invalid. You need to obtain a valid license key.&quot;</summary> \r\npublic static string License_InvalidKeyMessage=>T(\"License.InvalidKeyMessage\");\r\n///<summary>&quot;Trial period has expired&quot;</summary> \r\npublic static string License_ExpiredTitle=>T(\"License.ExpiredTitle\");\r\n///<summary>&quot;The trial period of the package has expired. You need to obtain a valid license.&quot;</summary> \r\npublic static string License_ExpiredMessage=>T(\"License.ExpiredMessage\");\r\n///<summary>&quot;Failed to get license information. ProductId: {0}&quot;</summary> \r\npublic static string License_Failed_Template=>T(\"License.Failed\");\r\n///<summary>&quot;Failed to get license information. ProductId: {0}&quot;</summary> \r\npublic static string License_Failed(object parameter0)=>string.Format(T(\"License.Failed\"), parameter0);\r\n///<summary>&quot;The Windows user under which this C1 instance is running does not have write permission to file or folder &apos;{0}&apos;.&quot;</summary> \r\npublic static string NotEnoughNtfsPermissions_Template=>T(\"NotEnoughNtfsPermissions\");\r\n///<summary>&quot;The Windows user under which this C1 instance is running does not have write permission to file or folder &apos;{0}&apos;.&quot;</summary> \r\npublic static string NotEnoughNtfsPermissions(object parameter0)=>string.Format(T(\"NotEnoughNtfsPermissions\"), parameter0);\r\n///<summary>&quot;Only one &apos;{0}&apos; element allowed&quot;</summary> \r\npublic static string PackageFragmentInstaller_OnlyOneElementAllowed_Template=>T(\"PackageFragmentInstaller.OnlyOneElementAllowed\");\r\n///<summary>&quot;Only one &apos;{0}&apos; element allowed&quot;</summary> \r\npublic static string PackageFragmentInstaller_OnlyOneElementAllowed(object parameter0)=>string.Format(T(\"PackageFragmentInstaller.OnlyOneElementAllowed\"), parameter0);\r\n///<summary>&quot;Unexpected element name &apos;{0}&apos;, only allowed element name is &apos;{1}&apos;&quot;</summary> \r\npublic static string PackageFragmentInstaller_IncorrectElement_Template=>T(\"PackageFragmentInstaller.IncorrectElement\");\r\n///<summary>&quot;Unexpected element name &apos;{0}&apos;, only allowed element name is &apos;{1}&apos;&quot;</summary> \r\npublic static string PackageFragmentInstaller_IncorrectElement(object parameter0,object parameter1)=>string.Format(T(\"PackageFragmentInstaller.IncorrectElement\"), parameter0,parameter1);\r\n///<summary>&quot;Missing &apos;{0}&apos; attribute.&quot;</summary> \r\npublic static string PackageFragmentInstaller_MissingAttribute_Template=>T(\"PackageFragmentInstaller.MissingAttribute\");\r\n///<summary>&quot;Missing &apos;{0}&apos; attribute.&quot;</summary> \r\npublic static string PackageFragmentInstaller_MissingAttribute(object parameter0)=>string.Format(T(\"PackageFragmentInstaller.MissingAttribute\"), parameter0);\r\n///<summary>&quot;Missing element &apos;{0}&apos;.&quot;</summary> \r\npublic static string PackageFragmentInstaller_MissingElement_Template=>T(\"PackageFragmentInstaller.MissingElement\");\r\n///<summary>&quot;Missing element &apos;{0}&apos;.&quot;</summary> \r\npublic static string PackageFragmentInstaller_MissingElement(object parameter0)=>string.Format(T(\"PackageFragmentInstaller.MissingElement\"), parameter0);\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Core.PackageSystem.PackageFragmentInstallers\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Cultures {\r\n///<summary>&quot;Afrikaans, South Africa&quot;</summary> \r\npublic static string af_ZA=>T(\"af-ZA\");\r\n///<summary>&quot;Albanian, Albania&quot;</summary> \r\npublic static string sq_AL=>T(\"sq-AL\");\r\n///<summary>&quot;Arabic, Algeria&quot;</summary> \r\npublic static string ar_DZ=>T(\"ar-DZ\");\r\n///<summary>&quot;Arabic, Bahrain&quot;</summary> \r\npublic static string ar_BH=>T(\"ar-BH\");\r\n///<summary>&quot;Arabic, Egypt&quot;</summary> \r\npublic static string ar_EG=>T(\"ar-EG\");\r\n///<summary>&quot;Arabic, Iraq&quot;</summary> \r\npublic static string ar_IQ=>T(\"ar-IQ\");\r\n///<summary>&quot;Arabic, Jordan&quot;</summary> \r\npublic static string ar_JO=>T(\"ar-JO\");\r\n///<summary>&quot;Arabic, Kuwait&quot;</summary> \r\npublic static string ar_KW=>T(\"ar-KW\");\r\n///<summary>&quot;Arabic, Lebanon&quot;</summary> \r\npublic static string ar_LB=>T(\"ar-LB\");\r\n///<summary>&quot;Arabic, Libya&quot;</summary> \r\npublic static string ar_LY=>T(\"ar-LY\");\r\n///<summary>&quot;Arabic, Morocco&quot;</summary> \r\npublic static string ar_MA=>T(\"ar-MA\");\r\n///<summary>&quot;Arabic, Oman&quot;</summary> \r\npublic static string ar_OM=>T(\"ar-OM\");\r\n///<summary>&quot;Arabic, Qatar&quot;</summary> \r\npublic static string ar_QA=>T(\"ar-QA\");\r\n///<summary>&quot;Arabic, Saudi Arabia&quot;</summary> \r\npublic static string ar_SA=>T(\"ar-SA\");\r\n///<summary>&quot;Arabic, Syria&quot;</summary> \r\npublic static string ar_SY=>T(\"ar-SY\");\r\n///<summary>&quot;Arabic, Tunisia&quot;</summary> \r\npublic static string ar_TN=>T(\"ar-TN\");\r\n///<summary>&quot;Arabic, U.A.E.&quot;</summary> \r\npublic static string ar_AE=>T(\"ar-AE\");\r\n///<summary>&quot;Arabic, Yemen&quot;</summary> \r\npublic static string ar_YE=>T(\"ar-YE\");\r\n///<summary>&quot;Armenian, Armenia&quot;</summary> \r\npublic static string hy_AM=>T(\"hy-AM\");\r\n///<summary>&quot;Azeri, Cyrillic Azerbaijan&quot;</summary> \r\npublic static string az_Cyrl_AZ=>T(\"az-Cyrl-AZ\");\r\n///<summary>&quot;Azeri, Latin Azerbaijan&quot;</summary> \r\npublic static string az_Latn_AZ=>T(\"az-Latn-AZ\");\r\n///<summary>&quot;Basque, Basque&quot;</summary> \r\npublic static string eu_ES=>T(\"eu-ES\");\r\n///<summary>&quot;Belarusian, Belarus&quot;</summary> \r\npublic static string be_BY=>T(\"be-BY\");\r\n///<summary>&quot;Bosnian, Bosnia and Herzegovina&quot;</summary> \r\npublic static string bs_Latn_BA=>T(\"bs-Latn-BA\");\r\n///<summary>&quot;Bosnian (Cyrillic) (Bosnia and Herzegovina)&quot;</summary> \r\npublic static string bs_Cyrl_BA=>T(\"bs-Cyrl-BA\");\r\n///<summary>&quot;Bulgarian, Bulgaria&quot;</summary> \r\npublic static string bg_BG=>T(\"bg-BG\");\r\n///<summary>&quot;Catalan, Catalan&quot;</summary> \r\npublic static string ca_ES=>T(\"ca-ES\");\r\n///<summary>&quot;Chinese, Hong Kong S.A.R.&quot;</summary> \r\npublic static string zh_HK=>T(\"zh-HK\");\r\n///<summary>&quot;Chinese, Macao S.A.R.&quot;</summary> \r\npublic static string zh_MO=>T(\"zh-MO\");\r\n///<summary>&quot;Chinese, People&apos;s Republic of China&quot;</summary> \r\npublic static string zh_CN=>T(\"zh-CN\");\r\n///<summary>&quot;Chinese, Singapore&quot;</summary> \r\npublic static string zh_SG=>T(\"zh-SG\");\r\n///<summary>&quot;Chinese, Taiwan&quot;</summary> \r\npublic static string zh_TW=>T(\"zh-TW\");\r\n///<summary>&quot;Croatian, Bosnia and Herzegovina&quot;</summary> \r\npublic static string hr_BA=>T(\"hr-BA\");\r\n///<summary>&quot;Croatian, Croatia&quot;</summary> \r\npublic static string hr_HR=>T(\"hr-HR\");\r\n///<summary>&quot;Czech, Czech Republic&quot;</summary> \r\npublic static string cs_CZ=>T(\"cs-CZ\");\r\n///<summary>&quot;Danish&quot;</summary> \r\npublic static string da_DK=>T(\"da-DK\");\r\n///<summary>&quot;Divehi, Maldives&quot;</summary> \r\npublic static string dv_MV=>T(\"dv-MV\");\r\n///<summary>&quot;Dutch, Belgium&quot;</summary> \r\npublic static string nl_BE=>T(\"nl-BE\");\r\n///<summary>&quot;Dutch&quot;</summary> \r\npublic static string nl_NL=>T(\"nl-NL\");\r\n///<summary>&quot;English, Australia&quot;</summary> \r\npublic static string en_AU=>T(\"en-AU\");\r\n///<summary>&quot;English, Belize&quot;</summary> \r\npublic static string en_BZ=>T(\"en-BZ\");\r\n///<summary>&quot;English, Canada&quot;</summary> \r\npublic static string en_CA=>T(\"en-CA\");\r\n///<summary>&quot;English, Caribbean&quot;</summary> \r\npublic static string en_029=>T(\"en-029\");\r\n///<summary>&quot;English, Ireland&quot;</summary> \r\npublic static string en_IE=>T(\"en-IE\");\r\n///<summary>&quot;English, Jamaica&quot;</summary> \r\npublic static string en_JM=>T(\"en-JM\");\r\n///<summary>&quot;English, New Zealand&quot;</summary> \r\npublic static string en_NZ=>T(\"en-NZ\");\r\n///<summary>&quot;English, Republic of the Philippines&quot;</summary> \r\npublic static string en_PH=>T(\"en-PH\");\r\n///<summary>&quot;English, South Africa&quot;</summary> \r\npublic static string en_ZA=>T(\"en-ZA\");\r\n///<summary>&quot;English, Trinidad and Tobago&quot;</summary> \r\npublic static string en_TT=>T(\"en-TT\");\r\n///<summary>&quot;English, UK&quot;</summary> \r\npublic static string en_GB=>T(\"en-GB\");\r\n///<summary>&quot;English, US&quot;</summary> \r\npublic static string en_US=>T(\"en-US\");\r\n///<summary>&quot;English, Zimbabwe&quot;</summary> \r\npublic static string en_ZW=>T(\"en-ZW\");\r\n///<summary>&quot;Estonian, Estonia&quot;</summary> \r\npublic static string et_EE=>T(\"et-EE\");\r\n///<summary>&quot;Faroese, Faroe Islands&quot;</summary> \r\npublic static string fo_FO=>T(\"fo-FO\");\r\n///<summary>&quot;Filipino, Philippines&quot;</summary> \r\npublic static string fil_PH=>T(\"fil-PH\");\r\n///<summary>&quot;Finnish&quot;</summary> \r\npublic static string fi_FI=>T(\"fi-FI\");\r\n///<summary>&quot;French, Belgium&quot;</summary> \r\npublic static string fr_BE=>T(\"fr-BE\");\r\n///<summary>&quot;French, Canada&quot;</summary> \r\npublic static string fr_CA=>T(\"fr-CA\");\r\n///<summary>&quot;French&quot;</summary> \r\npublic static string fr_FR=>T(\"fr-FR\");\r\n///<summary>&quot;French, Luxembourg&quot;</summary> \r\npublic static string fr_LU=>T(\"fr-LU\");\r\n///<summary>&quot;French, Principality of Monaco&quot;</summary> \r\npublic static string fr_MC=>T(\"fr-MC\");\r\n///<summary>&quot;French, Switzerland&quot;</summary> \r\npublic static string fr_CH=>T(\"fr-CH\");\r\n///<summary>&quot;Frisian, Netherlands&quot;</summary> \r\npublic static string fy_NL=>T(\"fy-NL\");\r\n///<summary>&quot;Gaelic, United Kingdom&quot;</summary> \r\npublic static string gd_GB=>T(\"gd-GB\");\r\n///<summary>&quot;Galician, Galician&quot;</summary> \r\npublic static string gl_ES=>T(\"gl-ES\");\r\n///<summary>&quot;Georgian, Georgia&quot;</summary> \r\npublic static string ka_GE=>T(\"ka-GE\");\r\n///<summary>&quot;German, Austria&quot;</summary> \r\npublic static string de_AT=>T(\"de-AT\");\r\n///<summary>&quot;German&quot;</summary> \r\npublic static string de_DE=>T(\"de-DE\");\r\n///<summary>&quot;German, Liechtenstein&quot;</summary> \r\npublic static string de_LI=>T(\"de-LI\");\r\n///<summary>&quot;German, Luxembourg&quot;</summary> \r\npublic static string de_LU=>T(\"de-LU\");\r\n///<summary>&quot;German, Switzerland&quot;</summary> \r\npublic static string de_CH=>T(\"de-CH\");\r\n///<summary>&quot;Greek, Greece&quot;</summary> \r\npublic static string el_GR=>T(\"el-GR\");\r\n///<summary>&quot;Greenlandic&quot;</summary> \r\npublic static string kl_GL=>T(\"kl-GL\");\r\n///<summary>&quot;Gujarati, India&quot;</summary> \r\npublic static string gu_IN=>T(\"gu-IN\");\r\n///<summary>&quot;Hebrew, Israel&quot;</summary> \r\npublic static string he_IL=>T(\"he-IL\");\r\n///<summary>&quot;Hindi, India&quot;</summary> \r\npublic static string hi_IN=>T(\"hi-IN\");\r\n///<summary>&quot;Hungarian, Hungary&quot;</summary> \r\npublic static string hu_HU=>T(\"hu-HU\");\r\n///<summary>&quot;Icelandic, Iceland&quot;</summary> \r\npublic static string is_IS=>T(\"is-IS\");\r\n///<summary>&quot;Indonesian, Indonesia&quot;</summary> \r\npublic static string id_ID=>T(\"id-ID\");\r\n///<summary>&quot;Inuktitut (Latin) (Canada)&quot;</summary> \r\npublic static string iu_Latn_CA=>T(\"iu-Latn-CA\");\r\n///<summary>&quot;Irish, Ireland&quot;</summary> \r\npublic static string ga_IE=>T(\"ga-IE\");\r\n///<summary>&quot;Italian&quot;</summary> \r\npublic static string it_IT=>T(\"it-IT\");\r\n///<summary>&quot;Italian, Switzerland&quot;</summary> \r\npublic static string it_CH=>T(\"it-CH\");\r\n///<summary>&quot;Japanese, Japan&quot;</summary> \r\npublic static string ja_JP=>T(\"ja-JP\");\r\n///<summary>&quot;Kannada, India&quot;</summary> \r\npublic static string kn_IN=>T(\"kn-IN\");\r\n///<summary>&quot;Kazakh, Kazakhstan&quot;</summary> \r\npublic static string kk_KZ=>T(\"kk-KZ\");\r\n///<summary>&quot;Kiswahili, Kenya&quot;</summary> \r\npublic static string sw_KE=>T(\"sw-KE\");\r\n///<summary>&quot;Konkani, India&quot;</summary> \r\npublic static string kok_IN=>T(\"kok-IN\");\r\n///<summary>&quot;Korean, Korea&quot;</summary> \r\npublic static string ko_KR=>T(\"ko-KR\");\r\n///<summary>&quot;Kyrgyz, Kyrgyzstan&quot;</summary> \r\npublic static string ky_KG=>T(\"ky-KG\");\r\n///<summary>&quot;Latvian, Latvia&quot;</summary> \r\npublic static string lv_LV=>T(\"lv-LV\");\r\n///<summary>&quot;Lithuanian, Lithuania&quot;</summary> \r\npublic static string lt_LT=>T(\"lt-LT\");\r\n///<summary>&quot;Luxembourgish, Luxembourg&quot;</summary> \r\npublic static string lb_LU=>T(\"lb-LU\");\r\n///<summary>&quot;Macedonian, Former Yugoslav Republic of Macedonia&quot;</summary> \r\npublic static string mk_MK=>T(\"mk-MK\");\r\n///<summary>&quot;Malay, Brunei Darussalam&quot;</summary> \r\npublic static string ms_BN=>T(\"ms-BN\");\r\n///<summary>&quot;Malay, Malaysia&quot;</summary> \r\npublic static string ms_MY=>T(\"ms-MY\");\r\n///<summary>&quot;Maltese, Malta&quot;</summary> \r\npublic static string mt_MT=>T(\"mt-MT\");\r\n///<summary>&quot;Maori, New Zealand&quot;</summary> \r\npublic static string mi_NZ=>T(\"mi-NZ\");\r\n///<summary>&quot;Mapudungun, Chile&quot;</summary> \r\npublic static string arn_CL=>T(\"arn-CL\");\r\n///<summary>&quot;Marathi, India&quot;</summary> \r\npublic static string mr_IN=>T(\"mr-IN\");\r\n///<summary>&quot;Mohawk, Canada&quot;</summary> \r\npublic static string moh_CA=>T(\"moh-CA\");\r\n///<summary>&quot;Mongolian, Cyrillic Mongolia&quot;</summary> \r\npublic static string mn_MN=>T(\"mn-MN\");\r\n///<summary>&quot;Norwegian Bokmål&quot;</summary> \r\npublic static string nb_NO=>T(\"nb-NO\");\r\n///<summary>&quot;Norwegian Nynorsk, Norway&quot;</summary> \r\npublic static string nn_NO=>T(\"nn-NO\");\r\n///<summary>&quot;Persian, Iran&quot;</summary> \r\npublic static string fa_IR=>T(\"fa-IR\");\r\n///<summary>&quot;Polish, Poland&quot;</summary> \r\npublic static string pl_PL=>T(\"pl-PL\");\r\n///<summary>&quot;Portuguese, Brazil&quot;</summary> \r\npublic static string pt_BR=>T(\"pt-BR\");\r\n///<summary>&quot;Portuguese, Portugal&quot;</summary> \r\npublic static string pt_PT=>T(\"pt-PT\");\r\n///<summary>&quot;Punjabi, India&quot;</summary> \r\npublic static string pa_IN=>T(\"pa-IN\");\r\n///<summary>&quot;Quechua, Bolivia&quot;</summary> \r\npublic static string quz_BO=>T(\"quz-BO\");\r\n///<summary>&quot;Quechua, Ecuador&quot;</summary> \r\npublic static string quz_EC=>T(\"quz-EC\");\r\n///<summary>&quot;Quechua, Peru&quot;</summary> \r\npublic static string quz_PE=>T(\"quz-PE\");\r\n///<summary>&quot;Romanian, Romania&quot;</summary> \r\npublic static string ro_RO=>T(\"ro-RO\");\r\n///<summary>&quot;Romansh, Switzerland&quot;</summary> \r\npublic static string rm_CH=>T(\"rm-CH\");\r\n///<summary>&quot;Russian, Russia&quot;</summary> \r\npublic static string ru_RU=>T(\"ru-RU\");\r\n///<summary>&quot;Sami (Inari) (Finland)&quot;</summary> \r\npublic static string smn_FI=>T(\"smn-FI\");\r\n///<summary>&quot;Sami (Lule) (Norway)&quot;</summary> \r\npublic static string smj_NO=>T(\"smj-NO\");\r\n///<summary>&quot;Sami (Lule) (Sweden)&quot;</summary> \r\npublic static string smj_SE=>T(\"smj-SE\");\r\n///<summary>&quot;Sami (Northern) (Finland)&quot;</summary> \r\npublic static string se_FI=>T(\"se-FI\");\r\n///<summary>&quot;Sami (Northern) (Norway)&quot;</summary> \r\npublic static string se_NO=>T(\"se-NO\");\r\n///<summary>&quot;Sami&quot;</summary> \r\npublic static string se_SE=>T(\"se-SE\");\r\n///<summary>&quot;Sami (Skolt) (Finland)&quot;</summary> \r\npublic static string sms_FI=>T(\"sms-FI\");\r\n///<summary>&quot;Sami (Southern) (Norway)&quot;</summary> \r\npublic static string sma_NO=>T(\"sma-NO\");\r\n///<summary>&quot;Sami (Southern) (Sweden)&quot;</summary> \r\npublic static string sma_SE=>T(\"sma-SE\");\r\n///<summary>&quot;Sanskrit, India&quot;</summary> \r\npublic static string sa_IN=>T(\"sa-IN\");\r\n///<summary>&quot;Serbian, Cyrillic (Bosnia and Herzegovina)&quot;</summary> \r\npublic static string sr_Cyrl_BA=>T(\"sr-Cyrl-BA\");\r\n///<summary>&quot;Serbian, Cyrillic (Montenegro)&quot;</summary> \r\npublic static string sr_Cyrl_ME=>T(\"sr-Cyrl-ME\");\r\n///<summary>&quot;Serbian, Cyrillic (Serbia and Montenegro - former)&quot;</summary> \r\npublic static string sr_Cyrl_CS=>T(\"sr-Cyrl-CS\");\r\n///<summary>&quot;Serbian, Cyrillic (Serbia)&quot;</summary> \r\npublic static string sr_Cyrl_RS=>T(\"sr-Cyrl-RS\");\r\n///<summary>&quot;Serbian, Latin (Bosnia and Herzegovina)&quot;</summary> \r\npublic static string sr_Latn_BA=>T(\"sr-Latn-BA\");\r\n///<summary>&quot;Serbian, Latin (Montenegro)&quot;</summary> \r\npublic static string sr_Latn_ME=>T(\"sr-Latn-ME\");\r\n///<summary>&quot;Serbian, Latin (Serbia and Montenegro - former)&quot;</summary> \r\npublic static string sr_Latn_CS=>T(\"sr-Latn-CS\");\r\n///<summary>&quot;Serbian, Latin (Serbia)&quot;</summary> \r\npublic static string sr_Latn_RS=>T(\"sr-Latn-RS\");\r\n///<summary>&quot;Sesotho sa Leboa, South Africa&quot;</summary> \r\npublic static string ns_ZA=>T(\"ns-ZA\");\r\n///<summary>&quot;Setswana, South Africa&quot;</summary> \r\npublic static string tn_ZA=>T(\"tn-ZA\");\r\n///<summary>&quot;Slovak, Slovakia&quot;</summary> \r\npublic static string sk_SK=>T(\"sk-SK\");\r\n///<summary>&quot;Slovenian, Slovenia&quot;</summary> \r\npublic static string sl_SI=>T(\"sl-SI\");\r\n///<summary>&quot;Spanish, Argentina&quot;</summary> \r\npublic static string es_AR=>T(\"es-AR\");\r\n///<summary>&quot;Spanish, Bolivia&quot;</summary> \r\npublic static string es_BO=>T(\"es-BO\");\r\n///<summary>&quot;Spanish, Chile&quot;</summary> \r\npublic static string es_CL=>T(\"es-CL\");\r\n///<summary>&quot;Spanish, Colombia&quot;</summary> \r\npublic static string es_CO=>T(\"es-CO\");\r\n///<summary>&quot;Spanish, Costa Rica&quot;</summary> \r\npublic static string es_CR=>T(\"es-CR\");\r\n///<summary>&quot;Spanish, Dominican Republic&quot;</summary> \r\npublic static string es_DO=>T(\"es-DO\");\r\n///<summary>&quot;Spanish, Ecuador&quot;</summary> \r\npublic static string es_EC=>T(\"es-EC\");\r\n///<summary>&quot;Spanish, El Salvador&quot;</summary> \r\npublic static string es_SV=>T(\"es-SV\");\r\n///<summary>&quot;Spanish, Guatemala&quot;</summary> \r\npublic static string es_GT=>T(\"es-GT\");\r\n///<summary>&quot;Spanish, Honduras&quot;</summary> \r\npublic static string es_HN=>T(\"es-HN\");\r\n///<summary>&quot;Spanish, Mexico&quot;</summary> \r\npublic static string es_MX=>T(\"es-MX\");\r\n///<summary>&quot;Spanish, Nicaragua&quot;</summary> \r\npublic static string es_NI=>T(\"es-NI\");\r\n///<summary>&quot;Spanish, Panama&quot;</summary> \r\npublic static string es_PA=>T(\"es-PA\");\r\n///<summary>&quot;Spanish, Paraguay&quot;</summary> \r\npublic static string es_PY=>T(\"es-PY\");\r\n///<summary>&quot;Spanish, Peru&quot;</summary> \r\npublic static string es_PE=>T(\"es-PE\");\r\n///<summary>&quot;Spanish, Puerto Rico&quot;</summary> \r\npublic static string es_PR=>T(\"es-PR\");\r\n///<summary>&quot;Spanish&quot;</summary> \r\npublic static string es_ES=>T(\"es-ES\");\r\n///<summary>&quot;Spanish, Uruguay&quot;</summary> \r\npublic static string es_UY=>T(\"es-UY\");\r\n///<summary>&quot;Spanish, Venezuela&quot;</summary> \r\npublic static string es_VE=>T(\"es-VE\");\r\n///<summary>&quot;Swedish, Finland&quot;</summary> \r\npublic static string sv_FI=>T(\"sv-FI\");\r\n///<summary>&quot;Swedish&quot;</summary> \r\npublic static string sv_SE=>T(\"sv-SE\");\r\n///<summary>&quot;Syriac, Syria&quot;</summary> \r\npublic static string syr_SY=>T(\"syr-SY\");\r\n///<summary>&quot;Tamil, India&quot;</summary> \r\npublic static string ta_IN=>T(\"ta-IN\");\r\n///<summary>&quot;Tatar, Russia&quot;</summary> \r\npublic static string tt_RU=>T(\"tt-RU\");\r\n///<summary>&quot;Telugu, India&quot;</summary> \r\npublic static string te_IN=>T(\"te-IN\");\r\n///<summary>&quot;Thai, Thailand&quot;</summary> \r\npublic static string th_TH=>T(\"th-TH\");\r\n///<summary>&quot;Turkish, Turkey&quot;</summary> \r\npublic static string tr_TR=>T(\"tr-TR\");\r\n///<summary>&quot;Ukrainian, Ukraine&quot;</summary> \r\npublic static string uk_UA=>T(\"uk-UA\");\r\n///<summary>&quot;Urdu, Islamic Republic of Pakistan&quot;</summary> \r\npublic static string ur_PK=>T(\"ur-PK\");\r\n///<summary>&quot;Uzbek, Cyrillic Uzbekistan&quot;</summary> \r\npublic static string uz_Cyrl_UZ=>T(\"uz-Cyrl-UZ\");\r\n///<summary>&quot;Uzbek, Latin Uzbekistan&quot;</summary> \r\npublic static string uz_Latn_UZ=>T(\"uz-Latn-UZ\");\r\n///<summary>&quot;Vietnamese, Vietnam&quot;</summary> \r\npublic static string vi_VN=>T(\"vi-VN\");\r\n///<summary>&quot;Welsh, United Kingdom&quot;</summary> \r\npublic static string cy_GB=>T(\"cy-GB\");\r\n///<summary>&quot;Xhosa, South Africa&quot;</summary> \r\npublic static string xh_ZA=>T(\"xh-ZA\");\r\n///<summary>&quot;Zulu, South Africa&quot;</summary> \r\npublic static string zu_ZA=>T(\"zu-ZA\");\r\n///<summary>&quot;Alsatian, France&quot;</summary> \r\npublic static string gsw_FR=>T(\"gsw-FR\");\r\n///<summary>&quot;Amharic, Ethiopia&quot;</summary> \r\npublic static string am_ET=>T(\"am-ET\");\r\n///<summary>&quot;Assamese, India&quot;</summary> \r\npublic static string as_IN=>T(\"as-IN\");\r\n///<summary>&quot;Bashkir, Russia&quot;</summary> \r\npublic static string ba_RU=>T(\"ba-RU\");\r\n///<summary>&quot;Bengali, Bangladesh&quot;</summary> \r\npublic static string bn_BD=>T(\"bn-BD\");\r\n///<summary>&quot;Bengali, India&quot;</summary> \r\npublic static string bn_IN=>T(\"bn-IN\");\r\n///<summary>&quot;Breton, France&quot;</summary> \r\npublic static string br_FR=>T(\"br-FR\");\r\n///<summary>&quot;Corsican, France&quot;</summary> \r\npublic static string co_FR=>T(\"co-FR\");\r\n///<summary>&quot;Dari, Afghanistan&quot;</summary> \r\npublic static string prs_AF=>T(\"prs-AF\");\r\n///<summary>&quot;English, India&quot;</summary> \r\npublic static string en_IN=>T(\"en-IN\");\r\n///<summary>&quot;English, Malaysia&quot;</summary> \r\npublic static string en_MY=>T(\"en-MY\");\r\n///<summary>&quot;English, Singapore&quot;</summary> \r\npublic static string en_SG=>T(\"en-SG\");\r\n///<summary>&quot;Hausa (Latin) (Nigeria)&quot;</summary> \r\npublic static string ha_Latn_NG=>T(\"ha-Latn-NG\");\r\n///<summary>&quot;Igbo, Nigeria&quot;</summary> \r\npublic static string ig_NG=>T(\"ig-NG\");\r\n///<summary>&quot;Inuktitut, Canada&quot;</summary> \r\npublic static string iu_Cans_CA=>T(\"iu-Cans-CA\");\r\n///<summary>&quot;Khmer, Cambodia&quot;</summary> \r\npublic static string km_KH=>T(\"km-KH\");\r\n///<summary>&quot;K&apos;iche, Guatemala&quot;</summary> \r\npublic static string qut_GT=>T(\"qut-GT\");\r\n///<summary>&quot;Kinyarwanda, Rwanda&quot;</summary> \r\npublic static string rw_RW=>T(\"rw-RW\");\r\n///<summary>&quot;Lao, Lao P.D.R.&quot;</summary> \r\npublic static string lo_LA=>T(\"lo-LA\");\r\n///<summary>&quot;Lower Sorbian, Germany&quot;</summary> \r\npublic static string dsb_DE=>T(\"dsb-DE\");\r\n///<summary>&quot;Malayalam, India&quot;</summary> \r\npublic static string ml_IN=>T(\"ml-IN\");\r\n///<summary>&quot;Mongolian (Traditional Mongolian) (People&apos;s Republic of China)&quot;</summary> \r\npublic static string mn_Mong_CN=>T(\"mn-Mong-CN\");\r\n///<summary>&quot;Nepali, Nepal&quot;</summary> \r\npublic static string ne_NP=>T(\"ne-NP\");\r\n///<summary>&quot;Occitan, France&quot;</summary> \r\npublic static string oc_FR=>T(\"oc-FR\");\r\n///<summary>&quot;Oriya, India&quot;</summary> \r\npublic static string or_IN=>T(\"or-IN\");\r\n///<summary>&quot;Pashto, Afghanistan&quot;</summary> \r\npublic static string ps_AF=>T(\"ps-AF\");\r\n///<summary>&quot;Sesotho sa Leboa, South Africa&quot;</summary> \r\npublic static string nso_ZA=>T(\"nso-ZA\");\r\n///<summary>&quot;Sinhala, Sri Lanka&quot;</summary> \r\npublic static string si_LK=>T(\"si-LK\");\r\n///<summary>&quot;Spanish, United States&quot;</summary> \r\npublic static string es_US=>T(\"es-US\");\r\n///<summary>&quot;Tajik (Cyrillic) (Tajikistan)&quot;</summary> \r\npublic static string tg_Cyrl_TJ=>T(\"tg-Cyrl-TJ\");\r\n///<summary>&quot;Tamazight (Latin) (Algeria)&quot;</summary> \r\npublic static string tzm_Latn_DZ=>T(\"tzm-Latn-DZ\");\r\n///<summary>&quot;Tibetan, People&apos;s Republic of China&quot;</summary> \r\npublic static string bo_CN=>T(\"bo-CN\");\r\n///<summary>&quot;Turkmen, Turkmenistan&quot;</summary> \r\npublic static string tk_TM=>T(\"tk-TM\");\r\n///<summary>&quot;Uighur, People&apos;s Republic of China&quot;</summary> \r\npublic static string ug_CN=>T(\"ug-CN\");\r\n///<summary>&quot;Upper Sorbian, Germany&quot;</summary> \r\npublic static string hsb_DE=>T(\"hsb-DE\");\r\n///<summary>&quot;Wolof, Senegal&quot;</summary> \r\npublic static string wo_SN=>T(\"wo-SN\");\r\n///<summary>&quot;Yakut, Russia&quot;</summary> \r\npublic static string sah_RU=>T(\"sah-RU\");\r\n///<summary>&quot;Yi, People&apos;s Republic of China&quot;</summary> \r\npublic static string ii_CN=>T(\"ii-CN\");\r\n///<summary>&quot;Yoruba, Nigeria&quot;</summary> \r\npublic static string yo_NG=>T(\"yo-NG\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Cultures\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_EntityTokenLocked {\r\n///<summary>&quot;This item is currently being edited&quot;</summary> \r\npublic static string LayoutLabel=>T(\"LayoutLabel\");\r\n///<summary>&quot;Information&quot;</summary> \r\npublic static string LockedByUsername_FieldGroupLabel=>T(\"LockedByUsername.FieldGroupLabel\");\r\n///<summary>&quot;The item is edited by:&quot;</summary> \r\npublic static string LockedByUsername_Label=>T(\"LockedByUsername.Label\");\r\n///<summary>&quot;Another user is editing this item. Press OK to proceed or cancel to abort.&quot;</summary> \r\npublic static string LockedByUsername_Help=>T(\"LockedByUsername.Help\");\r\n///<summary>&quot;You are editing this item in another tab - continue?&quot;</summary> \r\npublic static string SameUserHeading_Title=>T(\"SameUserHeading.Title\");\r\n///<summary>&quot;Press OK to proceed opening the item or Cancel to abort.&quot;</summary> \r\npublic static string SameUserHeading_Description=>T(\"SameUserHeading.Description\");\r\n///<summary>&quot;Another user is editing this item - continue?&quot;</summary> \r\npublic static string AnotherUserHeading_Title=>T(\"AnotherUserHeading.Title\");\r\n///<summary>&quot;If the item is changed simultaneously by multiple users changes may get lost. Press OK to proceed or cancel to abort.&quot;</summary> \r\npublic static string AnotherUserHeading_Description=>T(\"AnotherUserHeading.Description\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.EntityTokenLocked\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_GeneratedTypes {\r\n///<summary>&quot;One or more types are referencing this type. Renaming is not possible&quot;</summary> \r\npublic static string TypesAreReferencing=>T(\"TypesAreReferencing\");\r\n///<summary>&quot;The type name &apos;{0}&apos; appears in the namespace &apos;{1}&apos; - this is not allowed&quot;</summary> \r\npublic static string TypeNameInNamespace_Template=>T(\"TypeNameInNamespace\");\r\n///<summary>&quot;The type name &apos;{0}&apos; appears in the namespace &apos;{1}&apos; - this is not allowed&quot;</summary> \r\npublic static string TypeNameInNamespace(object parameter0,object parameter1)=>string.Format(T(\"TypeNameInNamespace\"), parameter0,parameter1);\r\n///<summary>&quot;A type with the same name already exists&quot;</summary> \r\npublic static string TypesNameClash=>T(\"TypesNameClash\");\r\n///<summary>&quot;No fields added&quot;</summary> \r\npublic static string MissingFields=>T(\"MissingFields\");\r\n///<summary>&quot;The type name &apos;{0}&apos; is not a valid identifier.&quot;</summary> \r\npublic static string TypeNameIsInvalidIdentifier_Template=>T(\"TypeNameIsInvalidIdentifier\");\r\n///<summary>&quot;The type name &apos;{0}&apos; is not a valid identifier.&quot;</summary> \r\npublic static string TypeNameIsInvalidIdentifier(object parameter0)=>string.Format(T(\"TypeNameIsInvalidIdentifier\"), parameter0);\r\n///<summary>&quot;The field name &apos;{0}&apos; can not be used&quot;</summary> \r\npublic static string FieldNameCannotBeUsed_Template=>T(\"FieldNameCannotBeUsed\");\r\n///<summary>&quot;The field name &apos;{0}&apos; can not be used&quot;</summary> \r\npublic static string FieldNameCannotBeUsed(object parameter0)=>string.Format(T(\"FieldNameCannotBeUsed\"), parameter0);\r\n///<summary>&quot;The specified &apos;Type namespace&apos; is already in use as a &apos;Type name&apos; (namespace + name). Consider changing the name of &apos;{0}&apos; to &apos;{0}.Item&apos;.&quot;</summary> \r\npublic static string NameSpaceIsTypeTypeName_Template=>T(\"NameSpaceIsTypeTypeName\");\r\n///<summary>&quot;The specified &apos;Type namespace&apos; is already in use as a &apos;Type name&apos; (namespace + name). Consider changing the name of &apos;{0}&apos; to &apos;{0}.Item&apos;.&quot;</summary> \r\npublic static string NameSpaceIsTypeTypeName(object parameter0)=>string.Format(T(\"NameSpaceIsTypeTypeName\"), parameter0);\r\n///<summary>&quot;Type name belongs to a reserved namespace.&quot;</summary> \r\npublic static string NamespaceIsReserved=>T(\"NamespaceIsReserved\");\r\n///<summary>&quot;Cannot add a data type since it will cause some compilation errors.&quot;</summary> \r\npublic static string CompileErrorWhileAddingType=>T(\"CompileErrorWhileAddingType\");\r\n///<summary>&quot;Cannot change a data type since it will cause some compilation errors.&quot;</summary> \r\npublic static string CompileErrorWhileChangingType=>T(\"CompileErrorWhileChangingType\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.GeneratedTypes\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Management {\r\n///<summary>&quot;Edit Permissions&quot;</summary> \r\npublic static string ManageUserPermissions_ManageUserPermissionsOnBranchLabel=>T(\"ManageUserPermissions.ManageUserPermissionsOnBranchLabel\");\r\n///<summary>&quot;Edit Permissions&quot;</summary> \r\npublic static string ManageUserPermissions_ManageUserPermissionsOnItemLabel=>T(\"ManageUserPermissions.ManageUserPermissionsOnItemLabel\");\r\n///<summary>&quot;User Permission Settings&quot;</summary> \r\npublic static string ManageUserPermissions_ManageGlobalUserPermissionsLabel=>T(\"ManageUserPermissions.ManageGlobalUserPermissionsLabel\");\r\n///<summary>&quot;Manage user permissions&quot;</summary> \r\npublic static string ManageUserPermissions_ManageUserPermissionsToolTip=>T(\"ManageUserPermissions.ManageUserPermissionsToolTip\");\r\n///<summary>&quot;Metadata&quot;</summary> \r\npublic static string DataCompositionVisabilityFacade_DefaultContainerLabel=>T(\"DataCompositionVisabilityFacade.DefaultContainerLabel\");\r\n///<summary>&quot;Delete User?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteUserStep1_LabelFieldGroup=>T(\"Website.Forms.Administrative.DeleteUserStep1.LabelFieldGroup\");\r\n///<summary>&quot;Delete the selected user?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteUserStep1_Text=>T(\"Website.Forms.Administrative.DeleteUserStep1.Text\");\r\n///<summary>&quot;Cascade delete error&quot;</summary> \r\npublic static string DeleteUserWorkflow_CascadeDeleteErrorTitle=>T(\"DeleteUserWorkflow.CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string DeleteUserWorkflow_CascadeDeleteErrorMessage=>T(\"DeleteUserWorkflow.CascadeDeleteErrorMessage\");\r\n///<summary>&quot;Cannot delete a user&quot;</summary> \r\npublic static string DeleteUserWorkflow_DeleteSelfTitle=>T(\"DeleteUserWorkflow.DeleteSelfTitle\");\r\n///<summary>&quot;You can not delete an account you logged in as.&quot;</summary> \r\npublic static string DeleteUserWorkflow_DeleteSelfErrorMessage=>T(\"DeleteUserWorkflow.DeleteSelfErrorMessage\");\r\n///<summary>&quot;Select Function&quot;</summary> \r\npublic static string Website_Function_SelectDialog_Title=>T(\"Website.Function.SelectDialog.Title\");\r\n///<summary>&quot;Select Widget&quot;</summary> \r\npublic static string Website_Widget_SelectDialog_Title=>T(\"Website.Widget.SelectDialog.Title\");\r\n///<summary>&quot;Select Page or File&quot;</summary> \r\npublic static string Website_ContentLink_SelectDialog_Title=>T(\"Website.ContentLink.SelectDialog.Title\");\r\n///<summary>&quot;Select Page&quot;</summary> \r\npublic static string Website_Page_SelectDialog_Title=>T(\"Website.Page.SelectDialog.Title\");\r\n///<summary>&quot;Select Frontend File&quot;</summary> \r\npublic static string Website_FrontendFile_SelectDialog_Title=>T(\"Website.FrontendFile.SelectDialog.Title\");\r\n///<summary>&quot;Select Media&quot;</summary> \r\npublic static string Website_Media_SelectDialog_Title=>T(\"Website.Media.SelectDialog.Title\");\r\n///<summary>&quot;Select Image&quot;</summary> \r\npublic static string Website_Image_SelectDialog_Title=>T(\"Website.Image.SelectDialog.Title\");\r\n///<summary>&quot;Select Folder&quot;</summary> \r\npublic static string Website_Folder_SelectDialog_Title=>T(\"Website.Folder.SelectDialog.Title\");\r\n///<summary>&quot;Draft&quot;</summary> \r\npublic static string PublishingStatus_draft=>T(\"PublishingStatus.draft\");\r\n///<summary>&quot;Awaiting Approval&quot;</summary> \r\npublic static string PublishingStatus_awaitingApproval=>T(\"PublishingStatus.awaitingApproval\");\r\n///<summary>&quot;Awaiting Publication&quot;</summary> \r\npublic static string PublishingStatus_awaitingPublication=>T(\"PublishingStatus.awaitingPublication\");\r\n///<summary>&quot;Published&quot;</summary> \r\npublic static string PublishingStatus_published=>T(\"PublishingStatus.published\");\r\n///<summary>&quot;General settings&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_LabelFieldGroup=>T(\"Website.Forms.Administrative.EditUserStep1.LabelFieldGroup\");\r\n///<summary>&quot;User name&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_UserNameLabel=>T(\"Website.Forms.Administrative.EditUserStep1.UserNameLabel\");\r\n///<summary>&quot;User names can not be changed. This is a &apos;read only&apos; field.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_UserNameHelp=>T(\"Website.Forms.Administrative.EditUserStep1.UserNameHelp\");\r\n///<summary>&quot;Password&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_PasswordLabel=>T(\"Website.Forms.Administrative.EditUserStep1.PasswordLabel\");\r\n///<summary>&quot;The password has to be more than 6 characters long.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_PasswordHelp=>T(\"Website.Forms.Administrative.EditUserStep1.PasswordHelp\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_NameLabel=>T(\"Website.Forms.Administrative.EditUserStep1.NameLabel\");\r\n///<summary>&quot;The full name of the person using this account.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_NameHelp=>T(\"Website.Forms.Administrative.EditUserStep1.NameHelp\");\r\n///<summary>&quot;Email&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_EmailLabel=>T(\"Website.Forms.Administrative.EditUserStep1.EmailLabel\");\r\n///<summary>&quot;The e-mail address of the user (optional).&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_EmailHelp=>T(\"Website.Forms.Administrative.EditUserStep1.EmailHelp\");\r\n///<summary>&quot;Folder&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_GroupLabel=>T(\"Website.Forms.Administrative.EditUserStep1.GroupLabel\");\r\n///<summary>&quot;If you enter a folder name that does not already exist a new folder will be created.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_GroupHelp=>T(\"Website.Forms.Administrative.EditUserStep1.GroupHelp\");\r\n///<summary>&quot;C1 Console Localization&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_LabelLocalizationFieldGroup=>T(\"Website.Forms.Administrative.EditUserStep1.LabelLocalizationFieldGroup\");\r\n///<summary>&quot;Display Preferences&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_CultureLabel=>T(\"Website.Forms.Administrative.EditUserStep1.CultureLabel\");\r\n///<summary>&quot;Display for time, date, and number formats within the console&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_CultureHelp=>T(\"Website.Forms.Administrative.EditUserStep1.CultureHelp\");\r\n///<summary>&quot;Console Language Preferences&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_C1ConsoleLanguageLabel=>T(\"Website.Forms.Administrative.EditUserStep1.C1ConsoleLanguageLabel\");\r\n///<summary>&quot;Language displayed within your console for labels, help texts, dialogs, etc. The available options are limited to language packages installed. See Composite.Localization packages for more language options.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_C1ConsoleLanguageHelp=>T(\"Website.Forms.Administrative.EditUserStep1.C1ConsoleLanguageHelp\");\r\n///<summary>&quot;Perspectives&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActivePerspectiveFieldLabel=>T(\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveFieldLabel\");\r\n///<summary>&quot;Visible perspectives&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActivePerspectiveMultiSelectLabel=>T(\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveMultiSelectLabel\");\r\n///<summary>&quot;Select which perspectives should be visible when the user starts the C1 Console.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActivePerspectiveMultiSelectHelp=>T(\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveMultiSelectHelp\");\r\n///<summary>&quot;Global permissions&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_GlobalPermissionsFieldLabel=>T(\"Website.Forms.Administrative.EditUserStep1.GlobalPermissionsFieldLabel\");\r\n///<summary>&quot;Global permissions&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_GlobalPermissionsMultiSelectLabel=>T(\"Website.Forms.Administrative.EditUserStep1.GlobalPermissionsMultiSelectLabel\");\r\n///<summary>&quot;The Administrate permission grants the user access to manage user permissions and execute other administrative tasks. The Configure permission grants access to super user tasks.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_GlobalPermissionsMultiSelectHelp=>T(\"Website.Forms.Administrative.EditUserStep1.GlobalPermissionsMultiSelectHelp\");\r\n///<summary>&quot;The removal of your own administrative permission has been ignored. You still have administrative privileges.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_GlobalPermissions_IgnoredOwnAdministrativeRemoval=>T(\"Website.Forms.Administrative.EditUserStep1.GlobalPermissions.IgnoredOwnAdministrativeRemoval\");\r\n///<summary>&quot;Data language access&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActiveLocalesFieldLabel=>T(\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesFieldLabel\");\r\n///<summary>&quot;Data Languages&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActiveLocalesMultiSelectLabel=>T(\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesMultiSelectLabel\");\r\n///<summary>&quot;User has access to manage data in the selected languages.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActiveLocalesMultiSelectHelp=>T(\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesMultiSelectHelp\");\r\n///<summary>&quot;Active content language&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActiveLocaleLabel=>T(\"Website.Forms.Administrative.EditUserStep1.ActiveLocaleLabel\");\r\n///<summary>&quot;The content language this user will edit.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActiveLocaleHelp=>T(\"Website.Forms.Administrative.EditUserStep1.ActiveLocaleHelp\");\r\n///<summary>&quot;The selected language is not checked in the data language section.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_ActiveLocaleNotChecked=>T(\"Website.Forms.Administrative.EditUserStep1.ActiveLocaleNotChecked\");\r\n///<summary>&quot;You must select at least one active language.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_NoActiveLocaleSelected=>T(\"Website.Forms.Administrative.EditUserStep1.NoActiveLocaleSelected\");\r\n///<summary>&quot;General&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_GenerelTabLabel=>T(\"Website.Forms.Administrative.EditUserStep1.GenerelTabLabel\");\r\n///<summary>&quot;Permissions&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_PermissionsTabLabel=>T(\"Website.Forms.Administrative.EditUserStep1.PermissionsTabLabel\");\r\n///<summary>&quot;Perspectives&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_PerspectivesTabLabel=>T(\"Website.Forms.Administrative.EditUserStep1.PerspectivesTabLabel\");\r\n///<summary>&quot;User Groups&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_UserGroupsFieldLabel=>T(\"Website.Forms.Administrative.EditUserStep1.UserGroupsFieldLabel\");\r\n///<summary>&quot;Select the user groups that the selected user should be a member of.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_UserGroupsMultiSelectHelp=>T(\"Website.Forms.Administrative.EditUserStep1.UserGroupsMultiSelectHelp\");\r\n///<summary>&quot;Is Locked&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_IsLockedLabel=>T(\"Website.Forms.Administrative.EditUserStep1.IsLockedLabel\");\r\n///<summary>&quot;User can not log in&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_IsLockedItemLabel=>T(\"Website.Forms.Administrative.EditUserStep1.IsLockedItemLabel\");\r\n///<summary>&quot;When checked the user will be forbidden from logging in.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditUserStep1_IsLockedHelp=>T(\"Website.Forms.Administrative.EditUserStep1.IsLockedHelp\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string EditUserWorkflow_EditErrorTitle=>T(\"EditUserWorkflow.EditErrorTitle\");\r\n///<summary>&quot;You can not delete your own access rights to &apos;System&apos; perspective.&quot;</summary> \r\npublic static string EditUserWorkflow_EditOwnAccessToSystemPerspective=>T(\"EditUserWorkflow.EditOwnAccessToSystemPerspective\");\r\n///<summary>&quot;You can not lock your own account.&quot;</summary> \r\npublic static string EditUserWorkflow_LockingOwnUserAccount=>T(\"EditUserWorkflow.LockingOwnUserAccount\");\r\n///<summary>&quot;Users&quot;</summary> \r\npublic static string UserElementProvider_RootLabel=>T(\"UserElementProvider.RootLabel\");\r\n///<summary>&quot;Users&quot;</summary> \r\npublic static string UserElementProvider_RootToolTip=>T(\"UserElementProvider.RootToolTip\");\r\n///<summary>&quot;Add User&quot;</summary> \r\npublic static string UserElementProvider_AddUserLabel=>T(\"UserElementProvider.AddUserLabel\");\r\n///<summary>&quot;Add new user&quot;</summary> \r\npublic static string UserElementProvider_AddUserToolTip=>T(\"UserElementProvider.AddUserToolTip\");\r\n///<summary>&quot;Edit User&quot;</summary> \r\npublic static string UserElementProvider_EditUserLabel=>T(\"UserElementProvider.EditUserLabel\");\r\n///<summary>&quot;Edit selected user&quot;</summary> \r\npublic static string UserElementProvider_EditUserToolTip=>T(\"UserElementProvider.EditUserToolTip\");\r\n///<summary>&quot;Delete User&quot;</summary> \r\npublic static string UserElementProvider_DeleteUserLabel=>T(\"UserElementProvider.DeleteUserLabel\");\r\n///<summary>&quot;Delete the selected user&quot;</summary> \r\npublic static string UserElementProvider_DeleteUserToolTip=>T(\"UserElementProvider.DeleteUserToolTip\");\r\n///<summary>&quot;Warning&quot;</summary> \r\npublic static string UserElementProvider_ChangeOtherActiveLocaleTitle=>T(\"UserElementProvider.ChangeOtherActiveLocaleTitle\");\r\n///<summary>&quot;You have change the active language for a user that is currently logged on. The users console will be reloaded and data might be lost.&quot;</summary> \r\npublic static string UserElementProvider_ChangeOtherActiveLocaleMessage=>T(\"UserElementProvider.ChangeOtherActiveLocaleMessage\");\r\n///<summary>&quot;Cleanup Required&quot;</summary> \r\npublic static string UserElementProvider_ChangeOtherActiveLocaleDialogTitle=>T(\"UserElementProvider.ChangeOtherActiveLocaleDialogTitle\");\r\n///<summary>&quot;This requires a stage cleanup. Active editors will be saved and closed.&quot;</summary> \r\npublic static string UserElementProvider_ChangeOtherActiveLocaleDialogText=>T(\"UserElementProvider.ChangeOtherActiveLocaleDialogText\");\r\n///<summary>&quot;A user with the same name already exists&quot;</summary> \r\npublic static string AddNewUserWorkflow_UsernameDuplicateError=>T(\"AddNewUserWorkflow.UsernameDuplicateError\");\r\n///<summary>&quot;Add New User&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_LabelFieldGroup=>T(\"Website.Forms.Administrative.AddNewUserStep1.LabelFieldGroup\");\r\n///<summary>&quot;User name&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_UserNameLabel=>T(\"Website.Forms.Administrative.AddNewUserStep1.UserNameLabel\");\r\n///<summary>&quot;When you have created a new user the username cannot be changed.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_UserNameHelp=>T(\"Website.Forms.Administrative.AddNewUserStep1.UserNameHelp\");\r\n///<summary>&quot;Password&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_PasswordLabel=>T(\"Website.Forms.Administrative.AddNewUserStep1.PasswordLabel\");\r\n///<summary>&quot;The password has to be more than 6 characters long.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_PasswordHelp=>T(\"Website.Forms.Administrative.AddNewUserStep1.PasswordHelp\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_NameLabel=>T(\"Website.Forms.Administrative.AddNewUserStep1.NameLabel\");\r\n///<summary>&quot;The full name of the person using this account.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_NameHelp=>T(\"Website.Forms.Administrative.AddNewUserStep1.NameHelp\");\r\n///<summary>&quot;Email address&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_EmailLabel=>T(\"Website.Forms.Administrative.AddNewUserStep1.EmailLabel\");\r\n///<summary>&quot;The e-mail address of the user (optional).&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_EmailHelp=>T(\"Website.Forms.Administrative.AddNewUserStep1.EmailHelp\");\r\n///<summary>&quot;Folder&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_GroupLabel=>T(\"Website.Forms.Administrative.AddNewUserStep1.GroupLabel\");\r\n///<summary>&quot;If you enter a folder name that does not already exist a new folder will be created.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_GroupHelp=>T(\"Website.Forms.Administrative.AddNewUserStep1.GroupHelp\");\r\n///<summary>&quot;Display Preferences&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_CultureLabel=>T(\"Website.Forms.Administrative.AddNewUserStep1.CultureLabel\");\r\n///<summary>&quot;Display for time, date, and number formats within the console&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_CultureHelp=>T(\"Website.Forms.Administrative.AddNewUserStep1.CultureHelp\");\r\n///<summary>&quot;Console Language Preferences&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_C1ConsoleLanguageLabel=>T(\"Website.Forms.Administrative.AddNewUserStep1.C1ConsoleLanguageLabel\");\r\n///<summary>&quot;Language displayed within your console for labels, help texts, dialogs, etc. The available options are limited to language packages installed. See Composite.Localization packages for more language options.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewUserStep1_C1ConsoleLanguageHelp=>T(\"Website.Forms.Administrative.AddNewUserStep1.C1ConsoleLanguageHelp\");\r\n///<summary>&quot;A language is required&quot;</summary> \r\npublic static string UserElementProvider_MissingActiveLanguageTitle=>T(\"UserElementProvider.MissingActiveLanguageTitle\");\r\n///<summary>&quot;To create a user a language is required, but no languages have been added yet. You can add one under the System perspective.&quot;</summary> \r\npublic static string UserElementProvider_MissingActiveLanguageMessage=>T(\"UserElementProvider.MissingActiveLanguageMessage\");\r\n///<summary>&quot;User with the same login already exist&quot;</summary> \r\npublic static string UserElementProvider_UserLoginIsAlreadyUsed=>T(\"UserElementProvider.UserLoginIsAlreadyUsed\");\r\n///<summary>&quot;Add Datafolder&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderTypeLabel=>T(\"AssociatedDataElementProviderHelper.AddDataFolderTypeLabel\");\r\n///<summary>&quot;Add Datafolder&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderTypeToolTip=>T(\"AssociatedDataElementProviderHelper.AddDataFolderTypeToolTip\");\r\n///<summary>&quot;Add Data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddAssociatedDataLabel=>T(\"AssociatedDataElementProviderHelper.AddAssociatedDataLabel\");\r\n///<summary>&quot;Add data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddAssociatedDataToolTip=>T(\"AssociatedDataElementProviderHelper.AddAssociatedDataToolTip\");\r\n///<summary>&quot;Edit Data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditAssociatedDataLabel=>T(\"AssociatedDataElementProviderHelper.EditAssociatedDataLabel\");\r\n///<summary>&quot;Edit data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditAssociatedDataToolTip=>T(\"AssociatedDataElementProviderHelper.EditAssociatedDataToolTip\");\r\n///<summary>&quot;Delete Data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteAssociatedDataLabel=>T(\"AssociatedDataElementProviderHelper.DeleteAssociatedDataLabel\");\r\n///<summary>&quot;Delete data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteAssociatedDataToolTip=>T(\"AssociatedDataElementProviderHelper.DeleteAssociatedDataToolTip\");\r\n///<summary>&quot;Duplicate Data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DuplicateAssociatedDataLabel=>T(\"AssociatedDataElementProviderHelper.DuplicateAssociatedDataLabel\");\r\n///<summary>&quot;Duplicate data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DuplicateAssociatedDataToolTip=>T(\"AssociatedDataElementProviderHelper.DuplicateAssociatedDataToolTip\");\r\n///<summary>&quot;Localize&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_LocalizeData=>T(\"AssociatedDataElementProviderHelper.LocalizeData\");\r\n///<summary>&quot;Localize data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_LocalizeDataToolTip=>T(\"AssociatedDataElementProviderHelper.LocalizeDataToolTip\");\r\n///<summary>&quot;Not yet approved or published&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DisabledData=>T(\"AssociatedDataElementProviderHelper.DisabledData\");\r\n///<summary>&quot;Add Datafolder&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExSelectType_FieldLabel=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExSelectType.FieldLabel\");\r\n///<summary>&quot;Datafolder type&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExSelectType_SelectorLabel=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExSelectType.SelectorLabel\");\r\n///<summary>&quot;Create new datatype or use an existing datatype (if present).&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExSelectType_SelectorHelp=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExSelectType.SelectorHelp\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_LabelNewType=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelNewType\");\r\n///<summary>&quot;Type name&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_LabelTypeName=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeName\");\r\n///<summary>&quot;The technical name of the data type (ex. Product). This is used to identify this type in code and should not be changed once used externally.&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_HelpTypeName=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeName\");\r\n///<summary>&quot;Type namespace&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_LabelTypeNamespace=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeNamespace\");\r\n///<summary>&quot;The namespace (module / category name) of the type. This is used to identify this type in code and should not be changed.&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_HelpTypeNamespace=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeNamespace\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_LabelTypeTitle=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeTitle\");\r\n///<summary>&quot;Use this entry to specify a user friendly name. You can change this field as you like.&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_HelpTypeTitle=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeTitle\");\r\n///<summary>&quot;Fields&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_LabelFields=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelFields\");\r\n///<summary>&quot;Services&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_ServicesLabel=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.ServicesLabel\");\r\n///<summary>&quot;Has publishing&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_HasPublishing=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HasPublishing\");\r\n///<summary>&quot;Has localization&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_HasLocalization=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HasLocalization\");\r\n///<summary>&quot;No page datafolders exists&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExWorkflow_NoTypesTitle=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoTypesTitle\");\r\n///<summary>&quot;No page datafolders have been created yet. You can create a page datafolder in the &apos;Data&apos; perspective.&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExWorkflow_NoTypesMessage=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoTypesMessage\");\r\n///<summary>&quot;No Unused Page Datafolders Exist&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExWorkflow_NoUnusedTypesTitle=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoUnusedTypesTitle\");\r\n///<summary>&quot;All available page datafolders have been added already. To create a new page datafolder go to the &apos;Data&apos; perspective.&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExWorkflow_NoUnusedTypesMessage=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoUnusedTypesMessage\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderExCreateNewType_ErrorTitle=>T(\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.ErrorTitle\");\r\n///<summary>&quot;Select existing data folder type to add&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderSelectType_FieldLabel=>T(\"AssociatedDataElementProviderHelper.AddDataFolderSelectType.FieldLabel\");\r\n///<summary>&quot;Existing data folder types&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderSelectType_SelectorLabel=>T(\"AssociatedDataElementProviderHelper.AddDataFolderSelectType.SelectorLabel\");\r\n///<summary>&quot;Select existing data folder type to add&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddDataFolderSelectType_SelectorHelp=>T(\"AssociatedDataElementProviderHelper.AddDataFolderSelectType.SelectorHelp\");\r\n///<summary>&quot;Remove Metadata Field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_RemoveMetaDataTypeLabel=>T(\"AssociatedDataElementProviderHelper.RemoveMetaDataTypeLabel\");\r\n///<summary>&quot;Remove metadata field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_RemoveMetaDataTypeToolTip=>T(\"AssociatedDataElementProviderHelper.RemoveMetaDataTypeToolTip\");\r\n///<summary>&quot;Remove Datafolder from Page&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteDataFolderWorkflow_LabelFieldGroup=>T(\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.LabelFieldGroup\");\r\n///<summary>&quot;Data cleanup&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteDataFolderWorkflow_FieldGroupLabel=>T(\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.FieldGroupLabel\");\r\n///<summary>&quot;Delete data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteDataFolderWorkflow_DeleteFolderDataLabel=>T(\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataLabel\");\r\n///<summary>&quot;Yes, delete folder data&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteDataFolderWorkflow_DeleteFolderDataCheckBoxLabel=>T(\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataCheckBoxLabel\");\r\n///<summary>&quot;If you want data in this folder to stay in the database, you should uncheck this option.&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteDataFolderWorkflow_DeleteFolderDataHelp=>T(\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataHelp\");\r\n///<summary>&quot;Add Metadata Field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataSelectType_LayoutLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataSelectType.LayoutLabel\");\r\n///<summary>&quot;Add Metadata Field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataTypeLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataTypeLabel\");\r\n///<summary>&quot;Add metadata field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataTypeToolTip=>T(\"AssociatedDataElementProviderHelper.AddMetaDataTypeToolTip\");\r\n///<summary>&quot;Select existing metadata type to add&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataSelectType_FieldLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataSelectType.FieldLabel\");\r\n///<summary>&quot;Existing metadata types&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataSelectType_SelectorLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataSelectType.SelectorLabel\");\r\n///<summary>&quot;Select existing metadata type to add&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataSelectType_SelectorHelp=>T(\"AssociatedDataElementProviderHelper.AddMetaDataSelectType.SelectorHelp\");\r\n///<summary>&quot;No page metadata types exists&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_NoTypesTitle=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.NoTypesTitle\");\r\n///<summary>&quot;No page metatypes have been created yet. You can create a Page metatype in the &apos;Data&apos; perspective.&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_NoTypesMessage=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.NoTypesMessage\");\r\n///<summary>&quot;Metadata field group naming&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_NamingFieldLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.NamingFieldLabel\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_FieldGroupNameLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupNameLabel\");\r\n///<summary>&quot;Enter a unique name identifying this metadata field group&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_FieldGroupNameHelp=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupNameHelp\");\r\n///<summary>&quot;Label&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_FieldGroupLabelLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupLabelLabel\");\r\n///<summary>&quot;Enter a user friendly label for this metadata field group&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_FieldGroupLabelHelp=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupLabelHelp\");\r\n///<summary>&quot;Metadata field group visibility&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_VisabilityFieldLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.VisabilityFieldLabel\");\r\n///<summary>&quot;Tab&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_ContainerSelectorLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.ContainerSelectorLabel\");\r\n///<summary>&quot;Select the tab for which this metadata should exists&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_ContainerSelectorHelp=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.ContainerSelectorHelp\");\r\n///<summary>&quot;Start display from&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_StartDisplaySelectorLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.StartDisplaySelectorLabel\");\r\n///<summary>&quot;Start display from&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_StartDisplaySelectorHelp=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.StartDisplaySelectorHelp\");\r\n///<summary>&quot;Inherit display&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_InheritDisplaySelectorLabel=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.InheritDisplaySelectorLabel\");\r\n///<summary>&quot;Inherit display&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataCreateFieldGroup_InheritDisplaySelectorHelp=>T(\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.InheritDisplaySelectorHelp\");\r\n///<summary>&quot;The metadata field group has no items in scope&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_NoItems_Title=>T(\"AssociatedDataElementProviderHelper.NoItems.Title\");\r\n///<summary>&quot;There are currently no items within the specified display range. Press Previous to change the display range or Finish to create the metadata field group.&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_NoItems_Description=>T(\"AssociatedDataElementProviderHelper.NoItems.Description\");\r\n///<summary>&quot;This item&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_StartDisplayOption0=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption0\");\r\n///<summary>&quot;Children&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_StartDisplayOption1=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption1\");\r\n///<summary>&quot;2nd generation descendants&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_StartDisplayOption2=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption2\");\r\n///<summary>&quot;3rd generation descendants&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_StartDisplayOption3=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption3\");\r\n///<summary>&quot;4th generation descendants&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_StartDisplayOption4=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption4\");\r\n///<summary>&quot;5th generation descendants&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_StartDisplayOption5=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption5\");\r\n///<summary>&quot;Do not inherit&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_InheritDisplayOption0=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption0\");\r\n///<summary>&quot;Inherit 1 generation&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_InheritDisplayOption1=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption1\");\r\n///<summary>&quot;Inherit 2 generations&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_InheritDisplayOption2=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption2\");\r\n///<summary>&quot;Inherit 3 generations&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_InheritDisplayOption3=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption3\");\r\n///<summary>&quot;Always inherit&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_InheritDisplayOption4=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption4\");\r\n///<summary>&quot;The field group name is in use&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_AddMetaDataWorkflow_FieldGroupNameNotValid=>T(\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.FieldGroupNameNotValid\");\r\n///<summary>&quot;Remove Metadata Field Group&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteMetaDataSelectType_LayoutLabel=>T(\"AssociatedDataElementProviderHelper.DeleteMetaDataSelectType.LayoutLabel\");\r\n///<summary>&quot;Select a metadata field group to remove&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteMetaDataSelectFieldGroupName_FieldLabel=>T(\"AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.FieldLabel\");\r\n///<summary>&quot;Field group&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteMetaDataSelectFieldGroupName_SelectorLabel=>T(\"AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.SelectorLabel\");\r\n///<summary>&quot;Select a metadata field group to remove&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteMetaDataSelectFieldGroupName_SelectorHelp=>T(\"AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.SelectorHelp\");\r\n///<summary>&quot;Edit Metadata Field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataTypeLabel=>T(\"AssociatedDataElementProviderHelper.EditMetaDataTypeLabel\");\r\n///<summary>&quot;Edit metadata field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataTypeToolTip=>T(\"AssociatedDataElementProviderHelper.EditMetaDataTypeToolTip\");\r\n///<summary>&quot;Edit Page Metadata Field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_Layout_Label=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.Layout.Label\");\r\n///<summary>&quot;Page metadata field settings&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_FieldGroup_Label=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.FieldGroup.Label\");\r\n///<summary>&quot;Label&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_LabelTextBox_Label=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.LabelTextBox.Label\");\r\n///<summary>&quot;The label of the metadata field. Used when editing pages&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_LabelTextBox_Help=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.LabelTextBox.Help\");\r\n///<summary>&quot;Tab&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_MetaDataContainerSelector_Label=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerSelector.Label\");\r\n///<summary>&quot;Select the tab for which this metadata should exists&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_MetaDataContainerSelector_Help=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerSelector.Help\");\r\n///<summary>&quot;Start display from&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_StartDisplaySelectorLabel=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.StartDisplaySelectorLabel\");\r\n///<summary>&quot;Start display from&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_StartDisplaySelectorHelp=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.StartDisplaySelectorHelp\");\r\n///<summary>&quot;Inherit display&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_InheritDisplaySelectorLabel=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.InheritDisplaySelectorLabel\");\r\n///<summary>&quot;Inherit display&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_InheritDisplaySelectorHelp=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.InheritDisplaySelectorHelp\");\r\n///<summary>&quot;Metadata field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_MetaDataDefinitionSelector_Label=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataDefinitionSelector.Label\");\r\n///<summary>&quot;Select the metadata field to edit&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_MetaDataDefinitionSelector_Help=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataDefinitionSelector.Help\");\r\n///<summary>&quot;No Metadata Fields to Edit&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_NoMetaDataDefinitionsExists_Title=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoMetaDataDefinitionsExists.Title\");\r\n///<summary>&quot;There is no metadata fields defined on this item to edit&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_NoMetaDataDefinitionsExists_Message=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoMetaDataDefinitionsExists.Message\");\r\n///<summary>&quot;The metadata type is used another place with same name but different label&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_MetaDataFieldNameAlreadyUsed=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataFieldNameAlreadyUsed\");\r\n///<summary>&quot;There exists one or more definitions with the same name, container change is not allowed&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_MetaDataContainerChangeNotAllowed=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerChangeNotAllowed\");\r\n///<summary>&quot;Press finish to save&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_NoDefaultValuesNeeded_Title=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoDefaultValuesNeeded.Title\");\r\n///<summary>&quot;All required information has been gathered. Press Finish to update the metadata field&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_EditMetaDataWorkflow_NoDefaultValuesNeeded_Description=>T(\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoDefaultValuesNeeded.Description\");\r\n///<summary>&quot;No Metadata Fields to Remove&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteMetaDataWorkflow_NoDefinedTypesExists_Title=>T(\"AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow.NoDefinedTypesExists.Title\");\r\n///<summary>&quot;There is no metadata fields defined on this item to remove&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_DeleteMetaDataWorkflow_NoDefinedTypesExists_Message=>T(\"AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow.NoDefinedTypesExists.Message\");\r\n///<summary>&quot;Cascade delete error&quot;</summary> \r\npublic static string DeleteAssociatedDataWorkflow_CascadeDeleteErrorTitle=>T(\"DeleteAssociatedDataWorkflow.CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string DeleteAssociatedDataWorkflow_CascadeDeleteErrorMessage=>T(\"DeleteAssociatedDataWorkflow.CascadeDeleteErrorMessage\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_LabelNewType=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelNewType\");\r\n///<summary>&quot;Type name&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_LabelTypeName=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeName\");\r\n///<summary>&quot;The name of the new type that you are creating (ex. product)&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_HelpTypeName=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeName\");\r\n///<summary>&quot;Type namespace&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_LabelTypeNamespace=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeNamespace\");\r\n///<summary>&quot;The name of the module, category or namespace that you are creating&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_HelpTypeNamespace=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeNamespace\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_LabelTypeTitle=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeTitle\");\r\n///<summary>&quot;Use this entry to specify a user friendly name&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_HelpTypeTitle=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeTitle\");\r\n///<summary>&quot;Fields&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_LabelFields=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelFields\");\r\n///<summary>&quot;Services&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_ServicesLabel=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.ServicesLabel\");\r\n///<summary>&quot;Has versioning&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_HasVersioning=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HasVersioning\");\r\n///<summary>&quot;Has publishing&quot;</summary> \r\npublic static string Website_Forms_Administrative_CreateNewAssociatedTypeStep1_HasPublishing=>T(\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HasPublishing\");\r\n///<summary>&quot;Delete Data?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteAssociatedTypeDataStep1_FieldGroupLabel=>T(\"Website.Forms.Administrative.DeleteAssociatedTypeDataStep1.FieldGroupLabel\");\r\n///<summary>&quot;Delete data?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteAssociatedTypeDataStep1_Text=>T(\"Website.Forms.Administrative.DeleteAssociatedTypeDataStep1.Text\");\r\n///<summary>&quot;Add page data&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedDataWorkflow_FieldGroupLabel=>T(\"Website.Forms.Administrative.AddAssociatedDataWorkflow.FieldGroupLabel\");\r\n///<summary>&quot;Select a datatype to add&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedDataWorkflow_TypeSelectorLabel=>T(\"Website.Forms.Administrative.AddAssociatedDataWorkflow.TypeSelectorLabel\");\r\n///<summary>&quot;Select one of the existing types to add data to&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedDataWorkflow_TypeSelectorHelp=>T(\"Website.Forms.Administrative.AddAssociatedDataWorkflow.TypeSelectorHelp\");\r\n///<summary>&quot;Add page datatype&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeWorkflow_FieldGroupLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel\");\r\n///<summary>&quot;Select type to add&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeAddExisting_TypeSelectorLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeAddExisting.TypeSelectorLabel\");\r\n///<summary>&quot;Select one of the existing types in the system&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeAddExisting_TypeSelectorHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeAddExisting.TypeSelectorHelp\");\r\n///<summary>&quot;Select a foreign key&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeAddExistingSelectForeignKey_KeySelectorLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeAddExistingSelectForeignKey.KeySelectorLabel\");\r\n///<summary>&quot;Select one of the fields from the type to use as foreign key&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeAddExistingSelectForeignKey_KeySelectorHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeAddExistingSelectForeignKey.KeySelectorHelp\");\r\n///<summary>&quot;Add a&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeAddingTypeSelection_KeySelectorLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeAddingTypeSelection.KeySelectorLabel\");\r\n///<summary>&quot;Creating a new type or using an existing type&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeAddingTypeSelection_KeySelectorHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeAddingTypeSelection.KeySelectorHelp\");\r\n///<summary>&quot;Select type:&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeAssociationTypeSelection_KeySelectorLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeAssociationTypeSelection.KeySelectorLabel\");\r\n///<summary>&quot;Regular data is a new type that are created under a page. Metadata is a new field that are created on a page&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeAssociationTypeSelection_KeySelectorHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeAssociationTypeSelection.KeySelectorHelp\");\r\n///<summary>&quot;Rule name&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeCompositionScopeSelection_ScopeRuleNameLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleNameLabel\");\r\n///<summary>&quot;Rule name are saved with the metadata and are a part of the metadata key. The name must be unique.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeCompositionScopeSelection_ScopeRuleNameHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleNameHelp\");\r\n///<summary>&quot;Rule label&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeCompositionScopeSelection_ScopeRuleLabelLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleLabelLabel\");\r\n///<summary>&quot;Rule label is used as a user friendly name for the instance. Can be localized&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeCompositionScopeSelection_ScopeRuleHelpHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleHelpHelp\");\r\n///<summary>&quot;Select composition container&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeCompositionScopeSelection_ContainerKeySelectorLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ContainerKeySelectorLabel\");\r\n///<summary>&quot;Select container for the new rule.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeCompositionScopeSelection_ContainerKeySelectorHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ContainerKeySelectorHelp\");\r\n///<summary>&quot;Select composition scope&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeCompositionScopeSelection_ScopeKeySelectorLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeKeySelectorLabel\");\r\n///<summary>&quot;Select the scope for the new composition&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeCompositionScopeSelection_ScopeKeySelectorHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeKeySelectorHelp\");\r\n///<summary>&quot;Levels&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeLevelsScopeSelection_LevelsLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeLevelsScopeSelection.LevelsLabel\");\r\n///<summary>&quot;The depth of sub pages in which the composition will be visible&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeLevelsScopeSelection_LevelsHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeLevelsScopeSelection.LevelsHelp\");\r\n///<summary>&quot;Confirm new datatype:&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_AssociationTypeLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AssociationTypeLabel\");\r\n///<summary>&quot;Metadata is a new field that are created on a page&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_AssociationTypeHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AssociationTypeHelp\");\r\n///<summary>&quot;Composition scope rule name&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_CompositionScopeRuleNameLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleNameLabel\");\r\n///<summary>&quot;Rule name are saved with the metadata and are a part of the metadata key. The name must be unique.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_CompositionScopeRuleNameHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleNameHelp\");\r\n///<summary>&quot;Composition scope rule label&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_CompositionScopeRuleLabelLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleLabelLabel\");\r\n///<summary>&quot;Rule label is used as a user friendly name for the instance. Can be localized&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_CompositionScopeRuleHelpHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleHelpHelp\");\r\n///<summary>&quot;Composition scope&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_CompositionScopeLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeLabel\");\r\n///<summary>&quot;This is the scope in which the new composition will be visible when editing pages&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_CompositionScopeHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeHelp\");\r\n///<summary>&quot;Adding type&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_AddingTypeLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AddingTypeLabel\");\r\n///<summary>&quot;Create a new type or use an existing type&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_AddingTypeHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AddingTypeHelp\");\r\n///<summary>&quot;Existing type name&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_ExistingTypeNameLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ExistingTypeNameLabel\");\r\n///<summary>&quot;The name of the selected existing type in the system to use&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_ExistingTypeNameHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ExistingTypeNameHelp\");\r\n///<summary>&quot;Foreign key field name&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_ForeignKeyFieldNameLabel=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ForeignKeyFieldNameLabel\");\r\n///<summary>&quot;The name of the field of the existing type to use as a foreign key &quot;</summary> \r\npublic static string Website_Forms_Administrative_AddAssociatedTypeFinalInfo_ForeignKeyFieldNameHelp=>T(\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ForeignKeyFieldNameHelp\");\r\n///<summary>&quot;Remove Datafolder&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_RemoveAssociatedTypeLabel=>T(\"AssociatedDataElementProviderHelper.RemoveAssociatedTypeLabel\");\r\n///<summary>&quot;Remove datafolder&quot;</summary> \r\npublic static string AssociatedDataElementProviderHelper_RemoveAssociatedTypeToolTip=>T(\"AssociatedDataElementProviderHelper.RemoveAssociatedTypeToolTip\");\r\n///<summary>&quot;Remove page datatype&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedType_FieldGroupLabel=>T(\"Website.Forms.Administrative.RemoveAssociatedType.FieldGroupLabel\");\r\n///<summary>&quot;Remove page datatype&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedTypeFinalInfo_AssociationTypeLabel=>T(\"Website.Forms.Administrative.RemoveAssociatedTypeFinalInfo.AssociationTypeLabel\");\r\n///<summary>&quot;Composition scope rule name&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedTypeFinalInfo_CompositionScopeRuleNameLabel=>T(\"Website.Forms.Administrative.RemoveAssociatedTypeFinalInfo.CompositionScopeRuleNameLabel\");\r\n///<summary>&quot;Select a rule&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedTypeSelectRuleName_KeySelectorLabel=>T(\"Website.Forms.Administrative.RemoveAssociatedTypeSelectRuleName.KeySelectorLabel\");\r\n///<summary>&quot;The name of the rule to remove&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedTypeSelectRuleName_KeySelectorHelp=>T(\"Website.Forms.Administrative.RemoveAssociatedTypeSelectRuleName.KeySelectorHelp\");\r\n///<summary>&quot;Select page datatype&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedTypeSelectAssociationType_KeySelectorLabel=>T(\"Website.Forms.Administrative.RemoveAssociatedTypeSelectAssociationType.KeySelectorLabel\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedTypeSelectAssociationType_KeySelectorHelp=>T(\"Website.Forms.Administrative.RemoveAssociatedTypeSelectAssociationType.KeySelectorHelp\");\r\n///<summary>&quot;Select datatype&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedTypeSelectType_TypeSelectorLabel=>T(\"Website.Forms.Administrative.RemoveAssociatedTypeSelectType.TypeSelectorLabel\");\r\n///<summary>&quot;Select one of the existing types&quot;</summary> \r\npublic static string Website_Forms_Administrative_RemoveAssociatedTypeSelectType_TypeSelectorHelp=>T(\"Website.Forms.Administrative.RemoveAssociatedTypeSelectType.TypeSelectorHelp\");\r\n///<summary>&quot;Virtual root&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_ID01=>T(\"VirtualElementProviderElementProvider.ID01\");\r\n///<summary>&quot;Users and Permissions&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_PermissionsPerspective=>T(\"VirtualElementProviderElementProvider.PermissionsPerspective\");\r\n///<summary>&quot;Users&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_UserPerspective=>T(\"VirtualElementProviderElementProvider.UserPerspective\");\r\n///<summary>&quot;Developer Apps&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_DeveloperApplicationPerspective=>T(\"VirtualElementProviderElementProvider.DeveloperApplicationPerspective\");\r\n///<summary>&quot;User Groups&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_UserGroupPerspective=>T(\"VirtualElementProviderElementProvider.UserGroupPerspective\");\r\n///<summary>&quot;System&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_SystemPerspective=>T(\"VirtualElementProviderElementProvider.SystemPerspective\");\r\n///<summary>&quot;Content&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_ContentPerspective=>T(\"VirtualElementProviderElementProvider.ContentPerspective\");\r\n///<summary>&quot;Data&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_DatasPerspective=>T(\"VirtualElementProviderElementProvider.DatasPerspective\");\r\n///<summary>&quot;Layout&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_DesignPerspective=>T(\"VirtualElementProviderElementProvider.DesignPerspective\");\r\n///<summary>&quot;Functions&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_FunctionsPerspective=>T(\"VirtualElementProviderElementProvider.FunctionsPerspective\");\r\n///<summary>&quot;All Media Files&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_MediaFilePerspective=>T(\"VirtualElementProviderElementProvider.MediaFilePerspective\");\r\n///<summary>&quot;Media&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_MediaPerspective=>T(\"VirtualElementProviderElementProvider.MediaPerspective\");\r\n///<summary>&quot;All Functions&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_ReadOnlyFunctionPerspective=>T(\"VirtualElementProviderElementProvider.ReadOnlyFunctionPerspective\");\r\n///<summary>&quot;All Widget Functions&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_ReadOnlyWidgetFunctionPerspective=>T(\"VirtualElementProviderElementProvider.ReadOnlyWidgetFunctionPerspective\");\r\n///<summary>&quot;SQL Functions&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_SqlFunctionPerspective=>T(\"VirtualElementProviderElementProvider.SqlFunctionPerspective\");\r\n///<summary>&quot;Xslt Based Functions&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_XsltBasedFunctionPerspective=>T(\"VirtualElementProviderElementProvider.XsltBasedFunctionPerspective\");\r\n///<summary>&quot;Broadcast Message&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_SendMessageLabel=>T(\"VirtualElementProviderElementProvider.RootActions.SendMessageLabel\");\r\n///<summary>&quot;Send a message to all running consoles&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_SendMessageTooltip=>T(\"VirtualElementProviderElementProvider.RootActions.SendMessageTooltip\");\r\n///<summary>&quot;Time Zone Settings&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_SetTimezoneLabel=>T(\"VirtualElementProviderElementProvider.RootActions.SetTimezoneLabel\");\r\n///<summary>&quot;Time zone to be displayed for all users within the console&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_SetTimezoneTooltip=>T(\"VirtualElementProviderElementProvider.RootActions.SetTimezoneTooltip\");\r\n///<summary>&quot;Global Settings&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_GlobalSetting=>T(\"VirtualElementProviderElementProvider.RootActions.GlobalSetting\");\r\n///<summary>&quot;Rebuild search index&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_RebuildSearchIndexLabel=>T(\"VirtualElementProviderElementProvider.RootActions.RebuildSearchIndexLabel\");\r\n///<summary>&quot;Initiate search index rebuilding&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_RebuildSearchIndexTooltip=>T(\"VirtualElementProviderElementProvider.RootActions.RebuildSearchIndexTooltip\");\r\n///<summary>&quot;Restart server&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_RestartApplicationLabel=>T(\"VirtualElementProviderElementProvider.RootActions.RestartApplicationLabel\");\r\n///<summary>&quot;Restart the server&quot;</summary> \r\npublic static string VirtualElementProviderElementProvider_RootActions_RestartApplicationTooltip=>T(\"VirtualElementProviderElementProvider.RootActions.RestartApplicationTooltip\");\r\n///<summary>&quot;Broadcast Message to All {applicationname} Consoles&quot;</summary> \r\npublic static string SendMessageToConsolesWorkflow_Layout_Label=>T(\"SendMessageToConsolesWorkflow.Layout.Label\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string SendMessageToConsolesWorkflow_TitleTextBox_Label=>T(\"SendMessageToConsolesWorkflow.TitleTextBox.Label\");\r\n///<summary>&quot;Dialog title of broadcast message&quot;</summary> \r\npublic static string SendMessageToConsolesWorkflow_TitleTextBox_Help=>T(\"SendMessageToConsolesWorkflow.TitleTextBox.Help\");\r\n///<summary>&quot;Message&quot;</summary> \r\npublic static string SendMessageToConsolesWorkflow_MessageTextArea_Label=>T(\"SendMessageToConsolesWorkflow.MessageTextArea.Label\");\r\n///<summary>&quot;The message to broadcast&quot;</summary> \r\npublic static string SendMessageToConsolesWorkflow_MessageTextArea_Help=>T(\"SendMessageToConsolesWorkflow.MessageTextArea.Help\");\r\n///<summary>&quot;Time Zone Updated&quot;</summary> \r\npublic static string SendMessageToConsolesWorkflow_SuccessMessage_TimezoneChangedTitle=>T(\"SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedTitle\");\r\n///<summary>&quot;Time zone has been successfully updated&quot;</summary> \r\npublic static string SendMessageToConsolesWorkflow_SuccessMessage_TimezoneChangedMessage=>T(\"SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedMessage\");\r\n///<summary>&quot;Set Time Zone Display&quot;</summary> \r\npublic static string SetTimezoneWorkflow_Layout_Label=>T(\"SetTimezoneWorkflow.Layout.Label\");\r\n///<summary>&quot;Select Time Zone&quot;</summary> \r\npublic static string SetTimezoneWorkflow_TitleTextBox_Label=>T(\"SetTimezoneWorkflow.TitleTextBox.Label\");\r\n///<summary>&quot;Time zone to be displayed for all users within the console. The console will restart once time zone updated. Any unsaved changes will be lost.&quot;</summary> \r\npublic static string SetTimezoneWorkflow_TitleTextBox_Help=>T(\"SetTimezoneWorkflow.TitleTextBox.Help\");\r\n///<summary>&quot;Time zone update requires a console restart. Any unsaved changes will be lost.&quot;</summary> \r\npublic static string SetTimezoneWorkflow_WarningText_Text=>T(\"SetTimezoneWorkflow.WarningText.Text\");\r\n///<summary>&quot;Login&quot;</summary> \r\npublic static string LoginWebRequestHandler_Login=>T(\"LoginWebRequestHandler.Login\");\r\n///<summary>&quot;Login to {0}&quot;</summary> \r\npublic static string LoginWebRequestHandler_Header_Template=>T(\"LoginWebRequestHandler.Header\");\r\n///<summary>&quot;Login to {0}&quot;</summary> \r\npublic static string LoginWebRequestHandler_Header(object parameter0)=>string.Format(T(\"LoginWebRequestHandler.Header\"), parameter0);\r\n///<summary>&quot;Incorrect user name or password&quot;</summary> \r\npublic static string LoginWebRequestHandler_LoginFailed=>T(\"LoginWebRequestHandler.LoginFailed\");\r\n///<summary>&quot;Password&quot;</summary> \r\npublic static string LoginWebRequestHandler_Password=>T(\"LoginWebRequestHandler.Password\");\r\n///<summary>&quot;Username&quot;</summary> \r\npublic static string LoginWebRequestHandler_Username=>T(\"LoginWebRequestHandler.Username\");\r\n///<summary>&quot;Log in as another user.&quot;</summary> \r\npublic static string LoginWebRequestHandler_LogInAsOtherUser=>T(\"LoginWebRequestHandler.LogInAsOtherUser\");\r\n///<summary>&quot;Wrong username or password.&quot;</summary> \r\npublic static string LoginWebRequestHandler_WrongUserNameOrPassword=>T(\"LoginWebRequestHandler.WrongUserNameOrPassword\");\r\n///<summary>&quot;The supplied Windows login, {0}\\{1} is not registered in the user database. You must use a different login.&quot;</summary> \r\npublic static string LoginWebRequestHandler_UserNameNotRegistered_Template=>T(\"LoginWebRequestHandler.UserNameNotRegistered\");\r\n///<summary>&quot;The supplied Windows login, {0}\\{1} is not registered in the user database. You must use a different login.&quot;</summary> \r\npublic static string LoginWebRequestHandler_UserNameNotRegistered(object parameter0,object parameter1)=>string.Format(T(\"LoginWebRequestHandler.UserNameNotRegistered\"), parameter0,parameter1);\r\n///<summary>&quot;The type {0} is not an interface.&quot;</summary> \r\npublic static string DataInterfaceValidator_TypeNotAnInterface_Template=>T(\"DataInterfaceValidator.TypeNotAnInterface\");\r\n///<summary>&quot;The type {0} is not an interface.&quot;</summary> \r\npublic static string DataInterfaceValidator_TypeNotAnInterface(object parameter0)=>string.Format(T(\"DataInterfaceValidator.TypeNotAnInterface\"), parameter0);\r\n///<summary>&quot;The interface type {0} does not implement the interface {1}.&quot;</summary> \r\npublic static string DataInterfaceValidator_TypeDoesNotImplementInterface_Template=>T(\"DataInterfaceValidator.TypeDoesNotImplementInterface\");\r\n///<summary>&quot;The interface type {0} does not implement the interface {1}.&quot;</summary> \r\npublic static string DataInterfaceValidator_TypeDoesNotImplementInterface(object parameter0,object parameter1)=>string.Format(T(\"DataInterfaceValidator.TypeDoesNotImplementInterface\"), parameter0,parameter1);\r\n///<summary>&quot;The property {0} on the interface type {1} is not a accepted type.&quot;</summary> \r\npublic static string DataInterfaceValidator_NotAcceptedType_Template=>T(\"DataInterfaceValidator.NotAcceptedType\");\r\n///<summary>&quot;The property {0} on the interface type {1} is not a accepted type.&quot;</summary> \r\npublic static string DataInterfaceValidator_NotAcceptedType(object parameter0,object parameter1)=>string.Format(T(\"DataInterfaceValidator.NotAcceptedType\"), parameter0,parameter1);\r\n///<summary>&quot;The interface {0} is not a valid IData interface.&quot;</summary> \r\npublic static string DataInterfaceValidator_NotValidIDataInterface_Template=>T(\"DataInterfaceValidator.NotValidIDataInterface\");\r\n///<summary>&quot;The interface {0} is not a valid IData interface.&quot;</summary> \r\npublic static string DataInterfaceValidator_NotValidIDataInterface(object parameter0)=>string.Format(T(\"DataInterfaceValidator.NotValidIDataInterface\"), parameter0);\r\n///<summary>&quot;Cascade delete error&quot;</summary> \r\npublic static string DeleteMediaFileWorkflow_CascadeDeleteErrorTitle=>T(\"DeleteMediaFileWorkflow.CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string DeleteMediaFileWorkflow_CascadeDeleteErrorMessage=>T(\"DeleteMediaFileWorkflow.CascadeDeleteErrorMessage\");\r\n///<summary>&quot;Cascade delete error&quot;</summary> \r\npublic static string DeleteMediaFolderWorkflow_CascadeDeleteErrorTitle=>T(\"DeleteMediaFolderWorkflow.CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string DeleteMediaFolderWorkflow_CascadeDeleteErrorMessage=>T(\"DeleteMediaFolderWorkflow.CascadeDeleteErrorMessage\");\r\n///<summary>&quot;Add folders and files to the media archive&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_RootToolTip=>T(\"MediaFileProviderElementProvider.RootToolTip\");\r\n///<summary>&quot;Add Folder&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_AddMediaFolder=>T(\"MediaFileProviderElementProvider.AddMediaFolder\");\r\n///<summary>&quot;Add new media folder&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_AddMediaFolderToolTip=>T(\"MediaFileProviderElementProvider.AddMediaFolderToolTip\");\r\n///<summary>&quot;Upload File&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_AddMediaFile=>T(\"MediaFileProviderElementProvider.AddMediaFile\");\r\n///<summary>&quot;Add new media file&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_AddMediaFileToolTip=>T(\"MediaFileProviderElementProvider.AddMediaFileToolTip\");\r\n///<summary>&quot;Delete File&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_DeleteMediaFile=>T(\"MediaFileProviderElementProvider.DeleteMediaFile\");\r\n///<summary>&quot;Delete the selected media file&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_DeleteMediaFileToolTip=>T(\"MediaFileProviderElementProvider.DeleteMediaFileToolTip\");\r\n///<summary>&quot;Delete Folder&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_DeleteMediaFolder=>T(\"MediaFileProviderElementProvider.DeleteMediaFolder\");\r\n///<summary>&quot;Delete the media folder and all items under it.&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_DeleteMediaFolderToolTip=>T(\"MediaFileProviderElementProvider.DeleteMediaFolderToolTip\");\r\n///<summary>&quot;Download&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_Download=>T(\"MediaFileProviderElementProvider.Download\");\r\n///<summary>&quot;Download file&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_DownloadToolTip=>T(\"MediaFileProviderElementProvider.DownloadToolTip\");\r\n///<summary>&quot;File Properties&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_EditMediaFile=>T(\"MediaFileProviderElementProvider.EditMediaFile\");\r\n///<summary>&quot;Rename the selected media file&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_EditMediaFileToolTip=>T(\"MediaFileProviderElementProvider.EditMediaFileToolTip\");\r\n///<summary>&quot;Edit text&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_EditMediaFileTextContent=>T(\"MediaFileProviderElementProvider.EditMediaFileTextContent\");\r\n///<summary>&quot;Edit text content&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_EditMediaFileTextContentToolTip=>T(\"MediaFileProviderElementProvider.EditMediaFileTextContentToolTip\");\r\n///<summary>&quot;Image Editor&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_EditImage=>T(\"MediaFileProviderElementProvider.EditImage\");\r\n///<summary>&quot;Open the selected media file in the image editor&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_EditImageToolTip=>T(\"MediaFileProviderElementProvider.EditImageToolTip\");\r\n///<summary>&quot;Folder Properties&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_EditMediaFolder=>T(\"MediaFileProviderElementProvider.EditMediaFolder\");\r\n///<summary>&quot;Edit media folder properties&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_EditMediaFolderToolTip=>T(\"MediaFileProviderElementProvider.EditMediaFolderToolTip\");\r\n///<summary>&quot;Replace File&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_ChangeMediaFile=>T(\"MediaFileProviderElementProvider.ChangeMediaFile\");\r\n///<summary>&quot;Replace the selected with another media file&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_ChangeMediaFileToolTip=>T(\"MediaFileProviderElementProvider.ChangeMediaFileToolTip\");\r\n///<summary>&quot;Upload Multiple&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_UploadZipFile=>T(\"MediaFileProviderElementProvider.UploadZipFile\");\r\n///<summary>&quot;Upload Zip file&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_UploadZipFileToolTip=>T(\"MediaFileProviderElementProvider.UploadZipFileToolTip\");\r\n///<summary>&quot;Media Item&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_MediaFileItemToolTip=>T(\"MediaFileProviderElementProvider.MediaFileItemToolTip\");\r\n///<summary>&quot;Organize folders and files&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_OrganizedFilesAndFoldersToolTip=>T(\"MediaFileProviderElementProvider.OrganizedFilesAndFoldersToolTip\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_ErrorMessageTitle=>T(\"MediaFileProviderElementProvider.ErrorMessageTitle\");\r\n///<summary>&quot;File &apos;{0}&apos; already exists in folder &apos;{1}&apos;&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_FileAlreadyExistsMessage_Template=>T(\"MediaFileProviderElementProvider.FileAlreadyExistsMessage\");\r\n///<summary>&quot;File &apos;{0}&apos; already exists in folder &apos;{1}&apos;&quot;</summary> \r\npublic static string MediaFileProviderElementProvider_FileAlreadyExistsMessage(object parameter0,object parameter1)=>string.Format(T(\"MediaFileProviderElementProvider.FileAlreadyExistsMessage\"), parameter0,parameter1);\r\n///<summary>&quot;Failure&quot;</summary> \r\npublic static string UploadNewMediaFileWorkflow_UploadFailure=>T(\"UploadNewMediaFileWorkflow.UploadFailure\");\r\n///<summary>&quot;The uploaded file must be of the same type as the original. The file you uploaded is of a different type.&quot;</summary> \r\npublic static string UploadNewMediaFileWorkflow_UploadFailureMessage=>T(\"UploadNewMediaFileWorkflow.UploadFailureMessage\");\r\n///<summary>&quot;Show Graph&quot;</summary> \r\npublic static string RelationshipGraphActionExecutor_ShowGraph=>T(\"RelationshipGraphActionExecutor.ShowGraph\");\r\n///<summary>&quot;Show relationship graph&quot;</summary> \r\npublic static string RelationshipGraphActionExecutor_ShowGraphToolTip=>T(\"RelationshipGraphActionExecutor.ShowGraphToolTip\");\r\n///<summary>&quot;Show Oriented Graph&quot;</summary> \r\npublic static string RelationshipGraphActionExecutor_ShowOrientedGraph=>T(\"RelationshipGraphActionExecutor.ShowOrientedGraph\");\r\n///<summary>&quot;Show Oriented Relationship graph&quot;</summary> \r\npublic static string RelationshipGraphActionExecutor_ShowOrientedGraphToolTip=>T(\"RelationshipGraphActionExecutor.ShowOrientedGraphToolTip\");\r\n///<summary>&quot;Show Element Information&quot;</summary> \r\npublic static string ShowElementInformationActionExecutor_ShowElementInformation_Label=>T(\"ShowElementInformationActionExecutor.ShowElementInformation.Label\");\r\n///<summary>&quot;Show Element Information&quot;</summary> \r\npublic static string ShowElementInformationActionExecutor_ShowElementInformation_ToolTip=>T(\"ShowElementInformationActionExecutor.ShowElementInformation.ToolTip\");\r\n///<summary>&quot;Search elements&quot;</summary> \r\npublic static string RelationshipGraphActionExecutor_Search=>T(\"RelationshipGraphActionExecutor.Search\");\r\n///<summary>&quot;Search for elements&quot;</summary> \r\npublic static string RelationshipGraphActionExecutor_SearchToolTip=>T(\"RelationshipGraphActionExecutor.SearchToolTip\");\r\n///<summary>&quot;Search elements&quot;</summary> \r\npublic static string RelationshipGraphActionExecutor_SearchElements=>T(\"RelationshipGraphActionExecutor.SearchElements\");\r\n///<summary>&quot;Search for elements&quot;</summary> \r\npublic static string RelationshipGraphActionExecutor_SearchElementsToolTip=>T(\"RelationshipGraphActionExecutor.SearchElementsToolTip\");\r\n///<summary>&quot;Version No.&quot;</summary> \r\npublic static string Website_General_LabelVersionNumber=>T(\"Website.General.LabelVersionNumber\");\r\n///<summary>&quot;Restart?&quot;</summary> \r\npublic static string Website_Application_DialogReload_Title=>T(\"Website.Application.DialogReload.Title\");\r\n///<summary>&quot;Restart {applicationname}? All unsaved changes will be lost.&quot;</summary> \r\npublic static string Website_Application_DialogReload_Text=>T(\"Website.Application.DialogReload.Text\");\r\n///<summary>&quot;Save Resource?&quot;</summary> \r\npublic static string WebSite_Application_DialogSaveResource_Title=>T(\"WebSite.Application.DialogSaveResource.Title\");\r\n///<summary>&quot;&quot;${resourcename}&quot; has been modified. Save changes?&quot;</summary> \r\npublic static string WebSite_Application_DialogSaveResource_Text=>T(\"WebSite.Application.DialogSaveResource.Text\");\r\n///<summary>&quot;Save Resources?&quot;</summary> \r\npublic static string Website_Dialogs_SaveAll_LabelSaveResources=>T(\"Website.Dialogs.SaveAll.LabelSaveResources\");\r\n///<summary>&quot;Unsaved resources&quot;</summary> \r\npublic static string Website_Dialogs_SaveAll_LabelUnsavedResources=>T(\"Website.Dialogs.SaveAll.LabelUnsavedResources\");\r\n///<summary>&quot;Yes&quot;</summary> \r\npublic static string Website_Dialogs_LabelYes=>T(\"Website.Dialogs.LabelYes\");\r\n///<summary>&quot;No&quot;</summary> \r\npublic static string Website_Dialogs_LabelNo=>T(\"Website.Dialogs.LabelNo\");\r\n///<summary>&quot;OK&quot;</summary> \r\npublic static string Website_Dialogs_LabelAccept=>T(\"Website.Dialogs.LabelAccept\");\r\n///<summary>&quot;Cancel&quot;</summary> \r\npublic static string Website_Dialogs_LabelCancel=>T(\"Website.Dialogs.LabelCancel\");\r\n///<summary>&quot;More Info&quot;</summary> \r\npublic static string Website_Dialogs_LabelDisclosure=>T(\"Website.Dialogs.LabelDisclosure\");\r\n///<summary>&quot;About {applicationname}&quot;</summary> \r\npublic static string Website_Dialogs_About_Title=>T(\"Website.Dialogs.About.Title\");\r\n///<summary>&quot;Credits&quot;</summary> \r\npublic static string Website_Dialogs_About_LabelCredits=>T(\"Website.Dialogs.About.LabelCredits\");\r\n///<summary>&quot;Back&quot;</summary> \r\npublic static string Website_Dialogs_About_LabelBack=>T(\"Website.Dialogs.About.LabelBack\");\r\n///<summary>&quot;Credits&quot;</summary> \r\npublic static string Website_Dialogs_About_LabelCredits2=>T(\"Website.Dialogs.About.LabelCredits2\");\r\n///<summary>&quot;No access&quot;</summary> \r\npublic static string Website_Dialogs_NoAccessTitle=>T(\"Website.Dialogs.NoAccessTitle\");\r\n///<summary>&quot;You have not been granted access rights to the system. Please contact your administrator.&quot;</summary> \r\npublic static string Website_Dialogs_NoAccessText=>T(\"Website.Dialogs.NoAccessText\");\r\n///<summary>&quot;Unit&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_Unit=>T(\"Website.Dialogs.ImageEditor.ScaleImage.Unit\");\r\n///<summary>&quot;Width&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_Width=>T(\"Website.Dialogs.ImageEditor.ScaleImage.Width\");\r\n///<summary>&quot;Height&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_Height=>T(\"Website.Dialogs.ImageEditor.ScaleImage.Height\");\r\n///<summary>&quot;Scale Image&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_LabelScaleImage=>T(\"Website.Dialogs.ImageEditor.ScaleImage.LabelScaleImage\");\r\n///<summary>&quot;Dimensions&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_LabelDimensions=>T(\"Website.Dialogs.ImageEditor.ScaleImage.LabelDimensions\");\r\n///<summary>&quot;Image Size&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_LabelImageSize=>T(\"Website.Dialogs.ImageEditor.ScaleImage.LabelImageSize\");\r\n///<summary>&quot;Fixed Ratio&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_LabelFixedRatio=>T(\"Website.Dialogs.ImageEditor.ScaleImage.LabelFixedRatio\");\r\n///<summary>&quot;Free Resize&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_LabelFreeResize=>T(\"Website.Dialogs.ImageEditor.ScaleImage.LabelFreeResize\");\r\n///<summary>&quot;Pixels&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_LabelPixels=>T(\"Website.Dialogs.ImageEditor.ScaleImage.LabelPixels\");\r\n///<summary>&quot;Percent&quot;</summary> \r\npublic static string Website_Dialogs_ImageEditor_ScaleImage_LabelPercent=>T(\"Website.Dialogs.ImageEditor.ScaleImage.LabelPercent\");\r\n///<summary>&quot;Login screen&quot;</summary> \r\npublic static string Website_Dialogs_Options_LoginScreen=>T(\"Website.Dialogs.Options.LoginScreen\");\r\n///<summary>&quot;Options&quot;</summary> \r\npublic static string Website_Dialogs_Options_LabelOptions=>T(\"Website.Dialogs.Options.LabelOptions\");\r\n///<summary>&quot;General&quot;</summary> \r\npublic static string Website_Dialogs_Options_LabelGeneral=>T(\"Website.Dialogs.Options.LabelGeneral\");\r\n///<summary>&quot;Advanced&quot;</summary> \r\npublic static string Website_Dialogs_Options_LabelAdvanced=>T(\"Website.Dialogs.Options.LabelAdvanced\");\r\n///<summary>&quot;Login Preferences&quot;</summary> \r\npublic static string Website_Dialogs_Options_LabelLoginPreferences=>T(\"Website.Dialogs.Options.LabelLoginPreferences\");\r\n///<summary>&quot;Fake login screen&quot;</summary> \r\npublic static string Website_Dialogs_Options_LabelFakeLoginScreen=>T(\"Website.Dialogs.Options.LabelFakeLoginScreen\");\r\n///<summary>&quot;No login screen&quot;</summary> \r\npublic static string Website_Dialogs_Options_LabelNoLoginScreen=>T(\"Website.Dialogs.Options.LabelNoLoginScreen\");\r\n///<summary>&quot;Error in web service method &quot;</summary> \r\npublic static string Website_Dialogs_WebServices_Error=>T(\"Website.Dialogs.WebServices.Error\");\r\n///<summary>&quot;Web Service Error&quot;</summary> \r\npublic static string Website_Dialogs_WebServices_LabelWebServiceError=>T(\"Website.Dialogs.WebServices.LabelWebServiceError\");\r\n///<summary>&quot;Insert Where?&quot;</summary> \r\npublic static string Website_Dialogs_SystemTree_DetailedPaste_Title=>T(\"Website.Dialogs.SystemTree.DetailedPaste.Title\");\r\n///<summary>&quot;Position&quot;</summary> \r\npublic static string Website_Dialogs_SystemTree_DetailedPaste_LabelPosition=>T(\"Website.Dialogs.SystemTree.DetailedPaste.LabelPosition\");\r\n///<summary>&quot;Insert before&quot;</summary> \r\npublic static string Website_Dialogs_SystemTree_DetailedPaste_LabelInsertBefore=>T(\"Website.Dialogs.SystemTree.DetailedPaste.LabelInsertBefore\");\r\n///<summary>&quot;Insert after&quot;</summary> \r\npublic static string Website_Dialogs_SystemTree_DetailedPaste_LabelInsertAfter=>T(\"Website.Dialogs.SystemTree.DetailedPaste.LabelInsertAfter\");\r\n///<summary>&quot;Basic view&quot;</summary> \r\npublic static string Website_Dialogs_EditFunction_BasicView=>T(\"Website.Dialogs.EditFunction.BasicView\");\r\n///<summary>&quot;Advanced view&quot;</summary> \r\npublic static string Website_Dialogs_EditFunction_AdvancedView=>T(\"Website.Dialogs.EditFunction.AdvancedView\");\r\n///<summary>&quot;This function has no parameters&quot;</summary> \r\npublic static string Website_Dialogs_EditFunction_BasicView_NoParameters=>T(\"Website.Dialogs.EditFunction.BasicView.NoParameters\");\r\n///<summary>&quot;Edit image&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelTitle=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelTitle\");\r\n///<summary>&quot;File&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelFile=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFile\");\r\n///<summary>&quot;Save&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelSave=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelSave\");\r\n///<summary>&quot;Save As...&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelSaveAs=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelSaveAs\");\r\n///<summary>&quot;Revert&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelRevert=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRevert\");\r\n///<summary>&quot;View&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelView=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelView\");\r\n///<summary>&quot;Zoom&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelZoom=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoom\");\r\n///<summary>&quot;Zoom In&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelZoomIn=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoomIn\");\r\n///<summary>&quot;Zoom Out&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelZoomOut=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoomOut\");\r\n///<summary>&quot;800%&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_Label800=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label800\");\r\n///<summary>&quot;400%&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_Label400=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label400\");\r\n///<summary>&quot;200%&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_Label200=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label200\");\r\n///<summary>&quot;100%&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_Label100=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label100\");\r\n///<summary>&quot;50%&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_Label50=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label50\");\r\n///<summary>&quot;25%&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_Label25=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label25\");\r\n///<summary>&quot;12%&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_Label12=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label12\");\r\n///<summary>&quot;Image&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelImage=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelImage\");\r\n///<summary>&quot;Transform&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelTransform=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelTransform\");\r\n///<summary>&quot;Flip Horizontally&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelFlipHorizontal=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFlipHorizontal\");\r\n///<summary>&quot;Flip Vertically&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelFlipVertical=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFlipVertical\");\r\n///<summary>&quot;Rotate 90 Degrees CW&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelRotate90CW=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate90CW\");\r\n///<summary>&quot;Rotate 90 Degrees CCW&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelRotate90CCW=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate90CCW\");\r\n///<summary>&quot;Rotate 180 Degrees&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelRotate180=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate180\");\r\n///<summary>&quot;Scale Image...&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelScale=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelScale\");\r\n///<summary>&quot;Crop Image&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_LabelCrop=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelCrop\");\r\n///<summary>&quot;Select&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_ToolBox_ToolTipSelect=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBox.ToolTipSelect\");\r\n///<summary>&quot;Zoom&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_ToolBox_ToolTipZoom=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBox.ToolTipZoom\");\r\n///<summary>&quot;Save&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_ToolBar_LabelSave=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelSave\");\r\n///<summary>&quot;Scale image&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_ToolBar_LabelScale=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelScale\");\r\n///<summary>&quot;Crop image&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_ToolBar_LabelCrop=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelCrop\");\r\n///<summary>&quot;Undo&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_ToolBar_LabelUndo=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelUndo\");\r\n///<summary>&quot;Redo&quot;</summary> \r\npublic static string Website_Content_Views_Editors_ImageEditor_ImageEditor_ToolBar_LabelRedo=>T(\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelRedo\");\r\n///<summary>&quot;Permissions&quot;</summary> \r\npublic static string Website_Content_Views_Editors_PermissionEditor_LabelTitle=>T(\"Website.Content.Views.Editors.PermissionEditor.LabelTitle\");\r\n///<summary>&quot;Users&quot;</summary> \r\npublic static string Website_Content_Views_Editors_PermissionEditor_LabelTabUsers=>T(\"Website.Content.Views.Editors.PermissionEditor.LabelTabUsers\");\r\n///<summary>&quot;User Groups&quot;</summary> \r\npublic static string Website_Content_Views_Editors_PermissionEditor_LabelTabUserGroups=>T(\"Website.Content.Views.Editors.PermissionEditor.LabelTabUserGroups\");\r\n///<summary>&quot;Save&quot;</summary> \r\npublic static string Website_Content_Views_Editors_PermissionEditor_LabelButtonSave=>T(\"Website.Content.Views.Editors.PermissionEditor.LabelButtonSave\");\r\n///<summary>&quot;Go back one page&quot;</summary> \r\npublic static string Website_Content_Views_Help_ToolTipBack=>T(\"Website.Content.Views.Help.ToolTipBack\");\r\n///<summary>&quot;Go forward one page&quot;</summary> \r\npublic static string Website_Content_Views_Help_ToolTipForward=>T(\"Website.Content.Views.Help.ToolTipForward\");\r\n///<summary>&quot;Refresh page&quot;</summary> \r\npublic static string Website_Content_Views_Help_ToolTipRefresh=>T(\"Website.Content.Views.Help.ToolTipRefresh\");\r\n///<summary>&quot;Contents&quot;</summary> \r\npublic static string Website_Content_Views_Help_LabelContents=>T(\"Website.Content.Views.Help.LabelContents\");\r\n///<summary>&quot;Help contents&quot;</summary> \r\npublic static string Website_Content_Views_Help_ToolTipContents=>T(\"Website.Content.Views.Help.ToolTipContents\");\r\n///<summary>&quot;Collapse All&quot;</summary> \r\npublic static string Website_Content_Views_SystemView_ToolTipCollapseAll=>T(\"Website.Content.Views.SystemView.ToolTipCollapseAll\");\r\n///<summary>&quot;Link with Editor&quot;</summary> \r\npublic static string Website_Content_Views_SystemView_ToolTipLinkWithEditor=>T(\"Website.Content.Views.SystemView.ToolTipLinkWithEditor\");\r\n///<summary>&quot;New Search...&quot;</summary> \r\npublic static string Website_Content_Views_Search_Search_LabelNewSearch=>T(\"Website.Content.Views.Search.Search.LabelNewSearch\");\r\n///<summary>&quot;Formatted&quot;</summary> \r\npublic static string Website_Content_Views_ViewSource_LabelFormatted=>T(\"Website.Content.Views.ViewSource.LabelFormatted\");\r\n///<summary>&quot;Raw&quot;</summary> \r\npublic static string Website_Content_Views_ViewSource_LabelRaw=>T(\"Website.Content.Views.ViewSource.LabelRaw\");\r\n///<summary>&quot;Server Log&quot;</summary> \r\npublic static string ServerLog_Element_Label=>T(\"ServerLog.Element.Label\");\r\n///<summary>&quot;The server log contain security and system health related messages.&quot;</summary> \r\npublic static string ServerLog_Element_Tooltip=>T(\"ServerLog.Element.Tooltip\");\r\n///<summary>&quot;View Server Log&quot;</summary> \r\npublic static string ServerLog_Element_View_Label=>T(\"ServerLog.Element.View.Label\");\r\n///<summary>&quot;View recent server events&quot;</summary> \r\npublic static string ServerLog_Element_View_Tooltip=>T(\"ServerLog.Element.View.Tooltip\");\r\n///<summary>&quot;Server Log&quot;</summary> \r\npublic static string ServerLog_LabelTitle=>T(\"ServerLog.LabelTitle\");\r\n///<summary>&quot;Delete old&quot;</summary> \r\npublic static string ServerLog_LabelButtonDeleteOld=>T(\"ServerLog.LabelButtonDeleteOld\");\r\n///<summary>&quot;Refresh&quot;</summary> \r\npublic static string ServerLog_LabelButtonRefresh=>T(\"ServerLog.LabelButtonRefresh\");\r\n///<summary>&quot;No log data available...&quot;</summary> \r\npublic static string ServerLog_EmptyLabel=>T(\"ServerLog.EmptyLabel\");\r\n///<summary>&quot;Only the {0} most recent log entries are shown. Open the log for more entries.&quot;</summary> \r\npublic static string ServerLog_LogEntriesRemovedBrowserViewLabel_Template=>T(\"ServerLog.LogEntriesRemovedBrowserViewLabel\");\r\n///<summary>&quot;Only the {0} most recent log entries are shown. Open the log for more entries.&quot;</summary> \r\npublic static string ServerLog_LogEntriesRemovedBrowserViewLabel(object parameter0)=>string.Format(T(\"ServerLog.LogEntriesRemovedBrowserViewLabel\"), parameter0);\r\n///<summary>&quot;Only the {0} most recent log entries are shown. {1} entries exists for the current search. Either narrow the search or use the log viewer tool from http://docs.composite.net/Configuration/Logging for full log access.&quot;</summary> \r\npublic static string ServerLog_LogEntriesRemovedLabel_Template=>T(\"ServerLog.LogEntriesRemovedLabel\");\r\n///<summary>&quot;Only the {0} most recent log entries are shown. {1} entries exists for the current search. Either narrow the search or use the log viewer tool from http://docs.composite.net/Configuration/Logging for full log access.&quot;</summary> \r\npublic static string ServerLog_LogEntriesRemovedLabel(object parameter0,object parameter1)=>string.Format(T(\"ServerLog.LogEntriesRemovedLabel\"), parameter0,parameter1);\r\n///<summary>&quot;Date&quot;</summary> \r\npublic static string ServerLog_LogEntry_DateLabel=>T(\"ServerLog.LogEntry.DateLabel\");\r\n///<summary>&quot;Message&quot;</summary> \r\npublic static string ServerLog_LogEntry_MessageLabel=>T(\"ServerLog.LogEntry.MessageLabel\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string ServerLog_LogEntry_TitleLabel=>T(\"ServerLog.LogEntry.TitleLabel\");\r\n///<summary>&quot;EventType&quot;</summary> \r\npublic static string ServerLog_LogEntry_EventTypeLabel=>T(\"ServerLog.LogEntry.EventTypeLabel\");\r\n///<summary>&quot;Verbose&quot;</summary> \r\npublic static string ServerLog_Severity_Verbose=>T(\"ServerLog.Severity.Verbose\");\r\n///<summary>&quot;Information&quot;</summary> \r\npublic static string ServerLog_Severity_Information=>T(\"ServerLog.Severity.Information\");\r\n///<summary>&quot;Warning&quot;</summary> \r\npublic static string ServerLog_Severity_Warning=>T(\"ServerLog.Severity.Warning\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string ServerLog_Severity_Error=>T(\"ServerLog.Severity.Error\");\r\n///<summary>&quot;Critical&quot;</summary> \r\npublic static string ServerLog_Severity_Critical=>T(\"ServerLog.Severity.Critical\");\r\n///<summary>&quot;Refresh&quot;</summary> \r\npublic static string FunctionDocumentation_LabelButtonRefresh=>T(\"FunctionDocumentation.LabelButtonRefresh\");\r\n///<summary>&quot;Print&quot;</summary> \r\npublic static string FunctionDocumentation_LabelButtonPrint=>T(\"FunctionDocumentation.LabelButtonPrint\");\r\n///<summary>&quot;Execution Ended&quot;</summary> \r\npublic static string Website_FlowUICompleted_ExecutionEndedTitle=>T(\"Website.FlowUICompleted.ExecutionEndedTitle\");\r\n///<summary>&quot;The action executed in this window has ended.&quot;</summary> \r\npublic static string Website_FlowUICompleted_ExecutionEndedMessage=>T(\"Website.FlowUICompleted.ExecutionEndedMessage\");\r\n///<summary>&quot;Server Error&quot;</summary> \r\npublic static string Website_ServerError_ServerErrorTitle=>T(\"Website.ServerError.ServerErrorTitle\");\r\n///<summary>&quot;An unfortunate error has occurred.&quot;</summary> \r\npublic static string Website_ServerError_ServerErrorMessage=>T(\"Website.ServerError.ServerErrorMessage\");\r\n///<summary>&quot;Details&quot;</summary> \r\npublic static string Website_ServerError_ServerErrorDetails=>T(\"Website.ServerError.ServerErrorDetails\");\r\n///<summary>&quot;License Violation&quot;</summary> \r\npublic static string Website_LicenseViolation_LicenseViolationTitle=>T(\"Website.LicenseViolation.LicenseViolationTitle\");\r\n///<summary>&quot;The requested action is in violates with your current license.&quot;</summary> \r\npublic static string Website_LicenseViolation_LicenseViolationMessage=>T(\"Website.LicenseViolation.LicenseViolationMessage\");\r\n///<summary>&quot;Flash options&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelFlashOptions=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelFlashOptions\");\r\n///<summary>&quot;High&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelHigh=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelHigh\");\r\n///<summary>&quot;Low&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelLow=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelLow\");\r\n///<summary>&quot;Autohigh&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelAutohigh=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutohigh\");\r\n///<summary>&quot;Autolow&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelAutolow=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutolow\");\r\n///<summary>&quot;Best&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelBest=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelBest\");\r\n///<summary>&quot;Window&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelWindow=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelWindow\");\r\n///<summary>&quot;Opaque&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelOpaque=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelOpaque\");\r\n///<summary>&quot;Transparent&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelTransparent=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelTransparent\");\r\n///<summary>&quot;Showall&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelShowall=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelShowall\");\r\n///<summary>&quot;Noborder&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelNoborder=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelNoborder\");\r\n///<summary>&quot;Exactfit&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelExactfit=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelExactfit\");\r\n///<summary>&quot;Auto play&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelAutoPlay=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutoPlay\");\r\n///<summary>&quot;Loop&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelLoop=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelLoop\");\r\n///<summary>&quot;Show menu&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelShowMenu=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelShowMenu\");\r\n///<summary>&quot;SWLiveConnect&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaFlashOptions_LabelSWLiveConnect=>T(\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelSWLiveConnect\");\r\n///<summary>&quot;Quicktime options&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelQuickTimeOptions=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelQuickTimeOptions\");\r\n///<summary>&quot;Loop&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelLoop=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelLoop\");\r\n///<summary>&quot;Cache&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelCache=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelCache\");\r\n///<summary>&quot;No correction&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelNoCorrection=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelNoCorrection\");\r\n///<summary>&quot;Kiosk mode&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelKioskMode=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelKioskMode\");\r\n///<summary>&quot;Play every frame&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelPlayEveryFrame=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelPlayEveryFrame\");\r\n///<summary>&quot;Auto play&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelAutoPlay=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelAutoPlay\");\r\n///<summary>&quot;Controller&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelController=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelController\");\r\n///<summary>&quot;Enable Javascript&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelEnableJavaScript=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelEnableJavaScript\");\r\n///<summary>&quot;AutoHREF&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelAutoHRef=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelAutoHRef\");\r\n///<summary>&quot;Target cache&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaQuickTimeOptions_LabelTargetCache=>T(\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelTargetCache\");\r\n///<summary>&quot;Shockwave options&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelShockWaveOptions=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShockWaveOptions\");\r\n///<summary>&quot;High&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelHigh=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelHigh\");\r\n///<summary>&quot;Low&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelLow=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelLow\");\r\n///<summary>&quot;Autohigh&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelAutoHigh=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoHigh\");\r\n///<summary>&quot;Autolow&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelAutoLow=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoLow\");\r\n///<summary>&quot;Best&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelBest=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelBest\");\r\n///<summary>&quot;Window&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelWindow=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelWindow\");\r\n///<summary>&quot;Opaque&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelOpaque=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelOpaque\");\r\n///<summary>&quot;Transparent&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelTransparent=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelTransparent\");\r\n///<summary>&quot;Showall&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelShowAll=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShowAll\");\r\n///<summary>&quot;Noborder&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelNoBorder=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelNoBorder\");\r\n///<summary>&quot;Exactfit&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelExactFit=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelExactFit\");\r\n///<summary>&quot;Auto play&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelAutoPlay=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoPlay\");\r\n///<summary>&quot;Loop&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelLoop=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelLoop\");\r\n///<summary>&quot;Show menu&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelShowMenu=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShowMenu\");\r\n///<summary>&quot;SWLiveConnect&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaShockWaveOptions_LabelSWLiveConnect=>T(\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelSWLiveConnect\");\r\n///<summary>&quot;Quicktime options&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelQuickTimeOptions=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelQuickTimeOptions\");\r\n///<summary>&quot;Auto Start&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelAutoStart=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelAutoStart\");\r\n///<summary>&quot;Show menu&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelShowMenu=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelShowMenu\");\r\n///<summary>&quot;Invoke URLs&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelInvokeURLs=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelInvokeURLs\");\r\n///<summary>&quot;Stretch to fit&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelStretchToFit=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelStretchToFit\");\r\n///<summary>&quot;Enabled&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelEnabled=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelEnabled\");\r\n///<summary>&quot;Fullscreen&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelFullScreen=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelFullScreen\");\r\n///<summary>&quot;Mute&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelMute=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelMute\");\r\n///<summary>&quot;Windowless video&quot;</summary> \r\npublic static string Website_Templates_WysiwygEditorPlugins_MediaWinMediaOptions_LabelWindowLessVideo=>T(\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelWindowLessVideo\");\r\n///<summary>&quot;Save&quot;</summary> \r\npublic static string Website_App_LabelSave=>T(\"Website.App.LabelSave\");\r\n///<summary>&quot;Save and Publish&quot;</summary> \r\npublic static string Website_App_LabelSaveAndPublish=>T(\"Website.App.LabelSaveAndPublish\");\r\n///<summary>&quot;Close Tab&quot;</summary> \r\npublic static string Website_App_LabelCloseTab=>T(\"Website.App.LabelCloseTab\");\r\n///<summary>&quot;Close Others&quot;</summary> \r\npublic static string Website_App_LabelCloseOthers=>T(\"Website.App.LabelCloseOthers\");\r\n///<summary>&quot;Refresh View&quot;</summary> \r\npublic static string Website_App_LabelRefreshView=>T(\"Website.App.LabelRefreshView\");\r\n///<summary>&quot;Make Dirty&quot;</summary> \r\npublic static string Website_App_LabelMakeDirty=>T(\"Website.App.LabelMakeDirty\");\r\n///<summary>&quot;View Source&quot;</summary> \r\npublic static string Website_App_LabelViewSource=>T(\"Website.App.LabelViewSource\");\r\n///<summary>&quot;View Generated&quot;</summary> \r\npublic static string Website_App_LabelViewGenerated=>T(\"Website.App.LabelViewGenerated\");\r\n///<summary>&quot;View Serialized&quot;</summary> \r\npublic static string Website_App_LabelViewSerialized=>T(\"Website.App.LabelViewSerialized\");\r\n///<summary>&quot;Close&quot;</summary> \r\npublic static string Website_App_LabelClose=>T(\"Website.App.LabelClose\");\r\n///<summary>&quot;File&quot;</summary> \r\npublic static string Website_App_LabelFile=>T(\"Website.App.LabelFile\");\r\n///<summary>&quot;Close&quot;</summary> \r\npublic static string Website_App_LabelFileClose=>T(\"Website.App.LabelFileClose\");\r\n///<summary>&quot;Close All&quot;</summary> \r\npublic static string Website_App_LabelFileCloseAll=>T(\"Website.App.LabelFileCloseAll\");\r\n///<summary>&quot;Save All...&quot;</summary> \r\npublic static string Website_App_LabelFileSaveAll=>T(\"Website.App.LabelFileSaveAll\");\r\n///<summary>&quot;Sign out&quot;</summary> \r\npublic static string Website_App_LabelFileExit=>T(\"Website.App.LabelFileExit\");\r\n///<summary>&quot;View&quot;</summary> \r\npublic static string Website_App_LabelView=>T(\"Website.App.LabelView\");\r\n///<summary>&quot;Composite Start&quot;</summary> \r\npublic static string Website_App_LabelViewCompositeStart=>T(\"Website.App.LabelViewCompositeStart\");\r\n///<summary>&quot;System Log&quot;</summary> \r\npublic static string Website_App_LabelSystemLog=>T(\"Website.App.LabelSystemLog\");\r\n///<summary>&quot;Developer Panel&quot;</summary> \r\npublic static string Website_App_LabelDeveloperPanel=>T(\"Website.App.LabelDeveloperPanel\");\r\n///<summary>&quot;Tools&quot;</summary> \r\npublic static string Website_App_LabelTools=>T(\"Website.App.LabelTools\");\r\n///<summary>&quot;Help&quot;</summary> \r\npublic static string Website_App_LabelHelp=>T(\"Website.App.LabelHelp\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string Website_App_LabelSettings=>T(\"Website.App.LabelSettings\");\r\n///<summary>&quot;Help Contents&quot;</summary> \r\npublic static string Website_App_LabelHelpContents=>T(\"Website.App.LabelHelpContents\");\r\n///<summary>&quot;Provide Feedback...&quot;</summary> \r\npublic static string Website_App_LabelFeedback=>T(\"Website.App.LabelFeedback\");\r\n///<summary>&quot;About {applicationname}&quot;</summary> \r\npublic static string Website_App_LabelAbout=>T(\"Website.App.LabelAbout\");\r\n///<summary>&quot;Cut&quot;</summary> \r\npublic static string Website_App_LabelCut=>T(\"Website.App.LabelCut\");\r\n///<summary>&quot;Copy&quot;</summary> \r\npublic static string Website_App_LabelCopy=>T(\"Website.App.LabelCopy\");\r\n///<summary>&quot;Paste&quot;</summary> \r\npublic static string Website_App_LabelPaste=>T(\"Website.App.LabelPaste\");\r\n///<summary>&quot;Refresh&quot;</summary> \r\npublic static string Website_App_LabelRefresh=>T(\"Website.App.LabelRefresh\");\r\n///<summary>&quot;Only first {0} elements are shown in the tree.&quot;</summary> \r\npublic static string Website_App_LimitedElementsShown_Template=>T(\"Website.App.LimitedElementsShown\");\r\n///<summary>&quot;Only first {0} elements are shown in the tree.&quot;</summary> \r\npublic static string Website_App_LimitedElementsShown(object parameter0)=>string.Format(T(\"Website.App.LimitedElementsShown\"), parameter0);\r\n///<summary>&quot;Loading...&quot;</summary> \r\npublic static string Website_App_LabelLoading=>T(\"Website.App.LabelLoading\");\r\n///<summary>&quot;Loaded&quot;</summary> \r\npublic static string Website_App_LabelLoaded=>T(\"Website.App.LabelLoaded\");\r\n///<summary>&quot;Saved&quot;</summary> \r\npublic static string Website_App_LabelSaved=>T(\"Website.App.LabelSaved\");\r\n///<summary>&quot;Minimize&quot;</summary> \r\npublic static string Website_App_ToolTipMinimize=>T(\"Website.App.ToolTipMinimize\");\r\n///<summary>&quot;Maximize&quot;</summary> \r\npublic static string Website_App_ToolTipMaximize=>T(\"Website.App.ToolTipMaximize\");\r\n///<summary>&quot;Restore&quot;</summary> \r\npublic static string Website_App_ToolTipUnMaximize=>T(\"Website.App.ToolTipUnMaximize\");\r\n///<summary>&quot;Restore&quot;</summary> \r\npublic static string Website_App_ToolTipUnMinimize=>T(\"Website.App.ToolTipUnMinimize\");\r\n///<summary>&quot;Close&quot;</summary> \r\npublic static string Website_App_ToolTipClose=>T(\"Website.App.ToolTipClose\");\r\n///<summary>&quot;Opening {0}...&quot;</summary> \r\npublic static string Website_App_StatusBar_Opening_Template=>T(\"Website.App.StatusBar.Opening\");\r\n///<summary>&quot;Opening {0}...&quot;</summary> \r\npublic static string Website_App_StatusBar_Opening(object parameter0)=>string.Format(T(\"Website.App.StatusBar.Opening\"), parameter0);\r\n///<summary>&quot;Refreshing {0}...&quot;</summary> \r\npublic static string Website_App_StatusBar_Refreshing_Template=>T(\"Website.App.StatusBar.Refreshing\");\r\n///<summary>&quot;Refreshing {0}...&quot;</summary> \r\npublic static string Website_App_StatusBar_Refreshing(object parameter0)=>string.Format(T(\"Website.App.StatusBar.Refreshing\"), parameter0);\r\n///<summary>&quot;Loading {0}...&quot;</summary> \r\npublic static string Website_App_StatusBar_Loading_Template=>T(\"Website.App.StatusBar.Loading\");\r\n///<summary>&quot;Loading {0}...&quot;</summary> \r\npublic static string Website_App_StatusBar_Loading(object parameter0)=>string.Format(T(\"Website.App.StatusBar.Loading\"), parameter0);\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string Website_App_StatusBar_Error=>T(\"Website.App.StatusBar.Error\");\r\n///<summary>&quot;Warning&quot;</summary> \r\npublic static string Website_App_StatusBar_Warn=>T(\"Website.App.StatusBar.Warn\");\r\n///<summary>&quot;Working...&quot;</summary> \r\npublic static string Website_App_StatusBar_Busy=>T(\"Website.App.StatusBar.Busy\");\r\n///<summary>&quot;Ready!&quot;</summary> \r\npublic static string Website_App_StatusBar_Ready=>T(\"Website.App.StatusBar.Ready\");\r\n///<summary>&quot;Error in&quot;</summary> \r\npublic static string Website_App_StatusBar_ErrorInField=>T(\"Website.App.StatusBar.ErrorInField\");\r\n///<summary>&quot;Add New Media File&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_Layout_Label=>T(\"Website.Forms.Administrative.AddNewMediaFile.Layout.Label\");\r\n///<summary>&quot;Filename&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_FileUpload_Label=>T(\"Website.Forms.Administrative.AddNewMediaFile.FileUpload.Label\");\r\n///<summary>&quot;Select the file to upload&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_FileUpload_Help=>T(\"Website.Forms.Administrative.AddNewMediaFile.FileUpload.Help\");\r\n///<summary>&quot;Allow overwrite&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_OverwriteCheckBox_Label=>T(\"Website.Forms.Administrative.AddNewMediaFile.OverwriteCheckBox.Label\");\r\n///<summary>&quot;Replace existing file&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_OverwriteCheckBox_Help=>T(\"Website.Forms.Administrative.AddNewMediaFile.OverwriteCheckBox.Help\");\r\n///<summary>&quot;Filename&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_FilenameTextBox_Label=>T(\"Website.Forms.Administrative.AddNewMediaFile.FilenameTextBox.Label\");\r\n///<summary>&quot;The name of the file in the media library&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_FilenameTextBox_Help=>T(\"Website.Forms.Administrative.AddNewMediaFile.FilenameTextBox.Help\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_TitleTextBox_Label=>T(\"Website.Forms.Administrative.AddNewMediaFile.TitleTextBox.Label\");\r\n///<summary>&quot;Use this field for an image title&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_TitleTextBox_Help=>T(\"Website.Forms.Administrative.AddNewMediaFile.TitleTextBox.Help\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_DescriptionTextBox_Label=>T(\"Website.Forms.Administrative.AddNewMediaFile.DescriptionTextBox.Label\");\r\n///<summary>&quot;Use this field for a short description of the image&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_DescriptionTextBox_Help=>T(\"Website.Forms.Administrative.AddNewMediaFile.DescriptionTextBox.Help\");\r\n///<summary>&quot;Please select a file to upload&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_MissingUploadedFile_Message=>T(\"Website.Forms.Administrative.AddNewMediaFile.MissingUploadedFile.Message\");\r\n///<summary>&quot;A file with the same name exists. Check allow overwrite or change the filename&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_FileExists_Message=>T(\"Website.Forms.Administrative.AddNewMediaFile.FileExists.Message\");\r\n///<summary>&quot;The total length of the filename (folder and filename) is too long&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_TotalFilenameToLong_Message=>T(\"Website.Forms.Administrative.AddNewMediaFile.TotalFilenameToLong.Message\");\r\n///<summary>&quot;Add tags to your media item seperated by a comma (,)&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_TagsTextBox_Help=>T(\"Website.Forms.Administrative.AddNewMediaFile.TagsTextBox.Help\");\r\n///<summary>&quot;Tags&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFile_TagsTextBox_Label=>T(\"Website.Forms.Administrative.AddNewMediaFile.TagsTextBox.Label\");\r\n///<summary>&quot;Add New Media Folder&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_Label_AddNewMediaFolder=>T(\"Website.Forms.Administrative.AddNewMediaFolder.Label.AddNewMediaFolder\");\r\n///<summary>&quot;Folder Name&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_LabelFolderName=>T(\"Website.Forms.Administrative.AddNewMediaFolder.LabelFolderName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_HelpFolderName=>T(\"Website.Forms.Administrative.AddNewMediaFolder.HelpFolderName\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_LabelTitle=>T(\"Website.Forms.Administrative.AddNewMediaFolder.LabelTitle\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_HelpTitle=>T(\"Website.Forms.Administrative.AddNewMediaFolder.HelpTitle\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_LabelDescription=>T(\"Website.Forms.Administrative.AddNewMediaFolder.LabelDescription\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_HelpDescription=>T(\"Website.Forms.Administrative.AddNewMediaFolder.HelpDescription\");\r\n///<summary>&quot;The folder already exists&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_FolderNameAlreadyUsed=>T(\"Website.Forms.Administrative.AddNewMediaFolder.FolderNameAlreadyUsed\");\r\n///<summary>&quot;The total length of the folder name is too long&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_FolderNameTooLong=>T(\"Website.Forms.Administrative.AddNewMediaFolder.FolderNameTooLong\");\r\n///<summary>&quot;The folder name can not only be &apos;/&apos; or &apos;\\&apos;&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddNewMediaFolder_FolderNotOnlySlash=>T(\"Website.Forms.Administrative.AddNewMediaFolder.FolderNotOnlySlash\");\r\n///<summary>&quot;Upload Multiple Files via a Zip File&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_LabelDialog=>T(\"Website.Forms.Administrative.AddZipMediaFile.LabelDialog\");\r\n///<summary>&quot;Zip file&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_LabelFile=>T(\"Website.Forms.Administrative.AddZipMediaFile.LabelFile\");\r\n///<summary>&quot;Create a Zip file (right click local folder and select Send to -&gt; Compressed folder) and select it using the Browse button&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_HelpFile=>T(\"Website.Forms.Administrative.AddZipMediaFile.HelpFile\");\r\n///<summary>&quot;Create folders&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_LabelRecreateStructure=>T(\"Website.Forms.Administrative.AddZipMediaFile.LabelRecreateStructure\");\r\n///<summary>&quot;Selecting this option will copy the exact folder structure from your Zip file&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_HelpRecreateStructure=>T(\"Website.Forms.Administrative.AddZipMediaFile.HelpRecreateStructure\");\r\n///<summary>&quot;Extract folders from Zip file&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_LabelRecreateStructureCheckBox=>T(\"Website.Forms.Administrative.AddZipMediaFile.LabelRecreateStructureCheckBox\");\r\n///<summary>&quot;Overwrite existing&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_LabelOverwriteExsisting=>T(\"Website.Forms.Administrative.AddZipMediaFile.LabelOverwriteExsisting\");\r\n///<summary>&quot;Selecting this option will overwrite existing files in the media archive with matching file names&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_HelpOverwriteExsisting=>T(\"Website.Forms.Administrative.AddZipMediaFile.HelpOverwriteExsisting\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_Error_Title=>T(\"Website.Forms.Administrative.AddZipMediaFile.Error.Title\");\r\n///<summary>&quot;Overwrite existing files&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_LabelOverwriteExsistingCheckBox=>T(\"Website.Forms.Administrative.AddZipMediaFile.LabelOverwriteExsistingCheckBox\");\r\n///<summary>&quot;Please select a file to upload&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_MissingUploadedFile_Message=>T(\"Website.Forms.Administrative.AddZipMediaFile.MissingUploadedFile.Message\");\r\n///<summary>&quot;Please use the normal upload command to upload .docx files&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_CannotUploadDocxFile=>T(\"Website.Forms.Administrative.AddZipMediaFile.CannotUploadDocxFile\");\r\n///<summary>&quot;The selected file was not a correct zip file&quot;</summary> \r\npublic static string Website_Forms_Administrative_AddZipMediaFile_WrongUploadedFile_Message=>T(\"Website.Forms.Administrative.AddZipMediaFile.WrongUploadedFile.Message\");\r\n///<summary>&quot;Function search&quot;</summary> \r\npublic static string Website_Forms_Administrative_AllFunctionsElementProviderSearchForm_LabelFunctionSearch=>T(\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelFunctionSearch\");\r\n///<summary>&quot;Keyword&quot;</summary> \r\npublic static string Website_Forms_Administrative_AllFunctionsElementProviderSearchForm_LabelKeyword=>T(\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelKeyword\");\r\n///<summary>&quot;Write a keyword to search for.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AllFunctionsElementProviderSearchForm_LabelKeywordHelp=>T(\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelKeywordHelp\");\r\n///<summary>&quot;Return type&quot;</summary> \r\npublic static string Website_Forms_Administrative_AllFunctionsElementProviderSearchForm_LabelReturnType=>T(\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelReturnType\");\r\n///<summary>&quot;Select a return type to search for.&quot;</summary> \r\npublic static string Website_Forms_Administrative_AllFunctionsElementProviderSearchForm_LabelReturnTypeHelp=>T(\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelReturnTypeHelp\");\r\n///<summary>&quot;Delete This File?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteMediaFile_LabelFieldGroup=>T(\"Website.Forms.Administrative.DeleteMediaFile.LabelFieldGroup\");\r\n///<summary>&quot;Delete this file?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteMediaFile_Text=>T(\"Website.Forms.Administrative.DeleteMediaFile.Text\");\r\n///<summary>&quot;Deleting a file&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteMediaFile_DeleteDataConfirmationHeader=>T(\"Website.Forms.Administrative.DeleteMediaFile.DeleteDataConfirmationHeader\");\r\n///<summary>&quot;There is some referenced data that will also be deleted, do you want to continue?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteMediaFile_DeleteDataConfirmationText=>T(\"Website.Forms.Administrative.DeleteMediaFile.DeleteDataConfirmationText\");\r\n///<summary>&quot;Delete This Folder?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteMediaFolder_LabelFieldGroup=>T(\"Website.Forms.Administrative.DeleteMediaFolder.LabelFieldGroup\");\r\n///<summary>&quot;Delete this folder?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteMediaFolder_Text=>T(\"Website.Forms.Administrative.DeleteMediaFolder.Text\");\r\n///<summary>&quot;This folder contains one or more files or subfolders. Deleting this folder will also delete all sub files and folders. Delete this folder?&quot;</summary> \r\npublic static string Website_Forms_Administrative_DeleteMediaFolder_HasChildringText=>T(\"Website.Forms.Administrative.DeleteMediaFolder.HasChildringText\");\r\n///<summary>&quot;Media Properties&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_LabelFieldGroup=>T(\"Website.Forms.Administrative.EditMediaFile.LabelFieldGroup\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_LabelTitle=>T(\"Website.Forms.Administrative.EditMediaFile.LabelTitle\");\r\n///<summary>&quot;A human friendly short text describing the content of the media file&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_HelpTitle=>T(\"Website.Forms.Administrative.EditMediaFile.HelpTitle\");\r\n///<summary>&quot;File Name&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_LabelFileName=>T(\"Website.Forms.Administrative.EditMediaFile.LabelFileName\");\r\n///<summary>&quot;The file name to use when the media file is downloaded.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_HelpFileName=>T(\"Website.Forms.Administrative.EditMediaFile.HelpFileName\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_LabelDescription=>T(\"Website.Forms.Administrative.EditMediaFile.LabelDescription\");\r\n///<summary>&quot;A description of the media file content&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_HelpDescription=>T(\"Website.Forms.Administrative.EditMediaFile.HelpDescription\");\r\n///<summary>&quot;Tags&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_LabelTags=>T(\"Website.Forms.Administrative.EditMediaFile.LabelTags\");\r\n///<summary>&quot;Provide tags for the media file content (Delimited by commas (,))&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_HelpTags=>T(\"Website.Forms.Administrative.EditMediaFile.HelpTags\");\r\n///<summary>&quot;URL&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_LabelMediaURL=>T(\"Website.Forms.Administrative.EditMediaFile.LabelMediaURL\");\r\n///<summary>&quot;This is the URL for your media File&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_HelpMediaURL=>T(\"Website.Forms.Administrative.EditMediaFile.HelpMediaURL\");\r\n///<summary>&quot;The total length of the filename (folder and filename) is too long&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_TotalFilenameToLong_Message=>T(\"Website.Forms.Administrative.EditMediaFile.TotalFilenameToLong.Message\");\r\n///<summary>&quot;A file with the same name already exists in this folder.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFile_FileExists_Message=>T(\"Website.Forms.Administrative.EditMediaFile.FileExists.Message\");\r\n///<summary>&quot;Folder Properties&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFolder_LabelFieldGroup=>T(\"Website.Forms.Administrative.EditMediaFolder.LabelFieldGroup\");\r\n///<summary>&quot;Folder Name&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFolder_LabelFolderName=>T(\"Website.Forms.Administrative.EditMediaFolder.LabelFolderName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFolder_HelpFolderName=>T(\"Website.Forms.Administrative.EditMediaFolder.HelpFolderName\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFolder_LabelTitle=>T(\"Website.Forms.Administrative.EditMediaFolder.LabelTitle\");\r\n///<summary>&quot;Use this field for a folder title&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFolder_HelpTitle=>T(\"Website.Forms.Administrative.EditMediaFolder.HelpTitle\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFolder_LabelDescription=>T(\"Website.Forms.Administrative.EditMediaFolder.LabelDescription\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFolder_HelpDescription=>T(\"Website.Forms.Administrative.EditMediaFolder.HelpDescription\");\r\n///<summary>&quot;The folder contains a file where the total length of the filename and the new folder name is too long&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditMediaFolder_TotalFilenameToLong_Message=>T(\"Website.Forms.Administrative.EditMediaFolder.TotalFilenameToLong.Message\");\r\n///<summary>&quot;Saved, but not published&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditPage_PublishDatePreventPublishTitle=>T(\"Website.Forms.Administrative.EditPage.PublishDatePreventPublishTitle\");\r\n///<summary>&quot;Your page has been saved, but not published since you have a future publish date set on the &apos;Settings&apos; tab.&quot;</summary> \r\npublic static string Website_Forms_Administrative_EditPage_PublishDatePreventPublish=>T(\"Website.Forms.Administrative.EditPage.PublishDatePreventPublish\");\r\n///<summary>&quot;Search&quot;</summary> \r\npublic static string Website_Forms_Administrative_ElementKeywordSearch_LabelFieldGroup=>T(\"Website.Forms.Administrative.ElementKeywordSearch.LabelFieldGroup\");\r\n///<summary>&quot;Keyword&quot;</summary> \r\npublic static string Website_Forms_Administrative_ElementKeywordSearch_LabelKeyword=>T(\"Website.Forms.Administrative.ElementKeywordSearch.LabelKeyword\");\r\n///<summary>&quot;Write a keyword to search for.&quot;</summary> \r\npublic static string Website_Forms_Administrative_ElementKeywordSearch_LabelSearchKeyword=>T(\"Website.Forms.Administrative.ElementKeywordSearch.LabelSearchKeyword\");\r\n///<summary>&quot;Upload New Media File&quot;</summary> \r\npublic static string Website_Forms_Administrative_UploadMediaFile_LabelFieldGroup=>T(\"Website.Forms.Administrative.UploadMediaFile.LabelFieldGroup\");\r\n///<summary>&quot;File name:&quot;</summary> \r\npublic static string Website_Forms_Administrative_UploadMediaFile_LabelFile=>T(\"Website.Forms.Administrative.UploadMediaFile.LabelFile\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Website_Forms_Administrative_UploadMediaFile_HelpFile=>T(\"Website.Forms.Administrative.UploadMediaFile.HelpFile\");\r\n///<summary>&quot;File missing or empty&quot;</summary> \r\npublic static string Website_Forms_Administrative_UploadMediaFile_EmptyFileErrorTitle=>T(\"Website.Forms.Administrative.UploadMediaFile.EmptyFileErrorTitle\");\r\n///<summary>&quot;No file data was received. Please use the browse button and ensure that the selected file is not empty.&quot;</summary> \r\npublic static string Website_Forms_Administrative_UploadMediaFile_EmptyFileErrorMessage=>T(\"Website.Forms.Administrative.UploadMediaFile.EmptyFileErrorMessage\");\r\n///<summary>&quot;Upload New Media File to Existing File&quot;</summary> \r\npublic static string Website_Forms_Administrative_UploadNewMediaFile_LabelFieldGroup=>T(\"Website.Forms.Administrative.UploadNewMediaFile.LabelFieldGroup\");\r\n///<summary>&quot;File name:&quot;</summary> \r\npublic static string Website_Forms_Administrative_UploadNewMediaFile_LabelFile=>T(\"Website.Forms.Administrative.UploadNewMediaFile.LabelFile\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Website_Forms_Administrative_UploadNewMediaFile_HelpFile=>T(\"Website.Forms.Administrative.UploadNewMediaFile.HelpFile\");\r\n///<summary>&quot;Save&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_Document_LabelSave=>T(\"Website.Forms.Administrative.AdministrativeTemplates.Document.LabelSave\");\r\n///<summary>&quot;Save As...&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_Document_LabelSaveAs=>T(\"Website.Forms.Administrative.AdministrativeTemplates.Document.LabelSaveAs\");\r\n///<summary>&quot;Previous&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_Wizard_LabelPrevious=>T(\"Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelPrevious\");\r\n///<summary>&quot;Next&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_Wizard_LabelNext=>T(\"Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelNext\");\r\n///<summary>&quot;Finish&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_Wizard_LabelFinish=>T(\"Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelFinish\");\r\n///<summary>&quot;Cancel&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_Wizard_LabelCancel=>T(\"Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelCancel\");\r\n///<summary>&quot;OK&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_DataDialog_LabelOk=>T(\"Website.Forms.Administrative.AdministrativeTemplates.DataDialog.LabelOk\");\r\n///<summary>&quot;Cancel&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_DataDialog_LabelCancel=>T(\"Website.Forms.Administrative.AdministrativeTemplates.DataDialog.LabelCancel\");\r\n///<summary>&quot;OK&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_ConfirmDialog_LabelOk=>T(\"Website.Forms.Administrative.AdministrativeTemplates.ConfirmDialog.LabelOk\");\r\n///<summary>&quot;Cancel&quot;</summary> \r\npublic static string Website_Forms_Administrative_AdministrativeTemplates_ConfirmDialog_LabelCancel=>T(\"Website.Forms.Administrative.AdministrativeTemplates.ConfirmDialog.LabelCancel\");\r\n///<summary>&quot;Input&quot;</summary> \r\npublic static string Website_Misc_SourceCodeViewer_LabelInput=>T(\"Website.Misc.SourceCodeViewer.LabelInput\");\r\n///<summary>&quot;Output&quot;</summary> \r\npublic static string Website_Misc_SourceCodeViewer_LabelOutput=>T(\"Website.Misc.SourceCodeViewer.LabelOutput\");\r\n///<summary>&quot;Not allowed.&quot;</summary> \r\npublic static string Website_Misc_Trees_DialogTitle_PasteNotAllowed=>T(\"Website.Misc.Trees.DialogTitle.PasteNotAllowed\");\r\n///<summary>&quot;Paste not allowed in this context.&quot;</summary> \r\npublic static string Website_Misc_Trees_DialogText_PasteNotAllowed=>T(\"Website.Misc.Trees.DialogText.PasteNotAllowed\");\r\n///<summary>&quot;Not allowed&quot;</summary> \r\npublic static string Website_Misc_Trees_DialogTitle_PasteTypeNotAllowed=>T(\"Website.Misc.Trees.DialogTitle.PasteTypeNotAllowed\");\r\n///<summary>&quot;Folder won&apos;t accept document type.&quot;</summary> \r\npublic static string Website_Misc_Trees_DialogText_PasteTypeNotAllowed=>T(\"Website.Misc.Trees.DialogText.PasteTypeNotAllowed\");\r\n///<summary>&quot;Edit Selections&quot;</summary> \r\npublic static string Website_Misc_MultiSelector_LabelEditSelections=>T(\"Website.Misc.MultiSelector.LabelEditSelections\");\r\n///<summary>&quot;More&quot;</summary> \r\npublic static string Website_Misc_Toolbar_LabelShowMoreActions=>T(\"Website.Misc.Toolbar.LabelShowMoreActions\");\r\n///<summary>&quot;Version information&quot;</summary> \r\npublic static string GenericVersionProcessController_Version=>T(\"GenericVersionProcessController.Version\");\r\n///<summary>&quot;Show version information&quot;</summary> \r\npublic static string GenericVersionProcessController_VersionToolTip=>T(\"GenericVersionProcessController.VersionToolTip\");\r\n///<summary>&quot;Select a value&quot;</summary> \r\npublic static string AspNetUiControl_Selector_SelectValueLabel=>T(\"AspNetUiControl.Selector.SelectValueLabel\");\r\n///<summary>&quot;&lt; broken reference &gt;...&quot;</summary> \r\npublic static string AspNetUiControl_Selector_BrokenReference=>T(\"AspNetUiControl.Selector.BrokenReference\");\r\n///<summary>&quot;(no selection)&quot;</summary> \r\npublic static string AspNetUiControl_Selector_NoSelection=>T(\"AspNetUiControl.Selector.NoSelection\");\r\n///<summary>&quot;No matches for &apos;{0}&apos;&quot;</summary> \r\npublic static string AspNetUiControl_Selector_NoMatchesFor_Template=>T(\"AspNetUiControl.Selector.NoMatchesFor\");\r\n///<summary>&quot;No matches for &apos;{0}&apos;&quot;</summary> \r\npublic static string AspNetUiControl_Selector_NoMatchesFor(object parameter0)=>string.Format(T(\"AspNetUiControl.Selector.NoMatchesFor\"), parameter0);\r\n///<summary>&quot;This field contains a broken reference&quot;</summary> \r\npublic static string Validation_BrokenReference=>T(\"Validation.BrokenReference\");\r\n///<summary>&quot;This field is required.&quot;</summary> \r\npublic static string Validation_RequiredField=>T(\"Validation.RequiredField\");\r\n///<summary>&quot;Only {0} digit(s) after decimal point allowed&quot;</summary> \r\npublic static string Validation_Decimal_SymbolsAfterPointAllowed_Template=>T(\"Validation.Decimal.SymbolsAfterPointAllowed\");\r\n///<summary>&quot;Only {0} digit(s) after decimal point allowed&quot;</summary> \r\npublic static string Validation_Decimal_SymbolsAfterPointAllowed(object parameter0)=>string.Format(T(\"Validation.Decimal.SymbolsAfterPointAllowed\"), parameter0);\r\n///<summary>&quot;Only {0} digit(s) before decimal point allowed&quot;</summary> \r\npublic static string Validation_Decimal_SymbolsBeforePointAllowed_Template=>T(\"Validation.Decimal.SymbolsBeforePointAllowed\");\r\n///<summary>&quot;Only {0} digit(s) before decimal point allowed&quot;</summary> \r\npublic static string Validation_Decimal_SymbolsBeforePointAllowed(object parameter0)=>string.Format(T(\"Validation.Decimal.SymbolsBeforePointAllowed\"), parameter0);\r\n///<summary>&quot;Invalid date string: &apos;{0}&apos;. Use the format &apos;{1}&apos;.&quot;</summary> \r\npublic static string Validation_DateTime_InvalidDateFormat_Template=>T(\"Validation.DateTime.InvalidDateFormat\");\r\n///<summary>&quot;Invalid date string: &apos;{0}&apos;. Use the format &apos;{1}&apos;.&quot;</summary> \r\npublic static string Validation_DateTime_InvalidDateFormat(object parameter0,object parameter1)=>string.Format(T(\"Validation.DateTime.InvalidDateFormat\"), parameter0,parameter1);\r\n///<summary>&quot;The specified value is either too big or too small. The acceptable range is from -2,147,483,648 to 2,147,483,647&quot;</summary> \r\npublic static string Validation_Int32_Overflow=>T(\"Validation.Int32.Overflow\");\r\n///<summary>&quot;Required&quot;</summary> \r\npublic static string Validation_Required=>T(\"Validation.Required\");\r\n///<summary>&quot;Numbers only&quot;</summary> \r\npublic static string Validation_InvalidField_Number=>T(\"Validation.InvalidField.Number\");\r\n///<summary>&quot;Integers only&quot;</summary> \r\npublic static string Validation_InvalidField_Integer=>T(\"Validation.InvalidField.Integer\");\r\n///<summary>&quot;Invalid identifier&quot;</summary> \r\npublic static string Validation_InvalidField_ProgrammingIdentifier=>T(\"Validation.InvalidField.ProgrammingIdentifier\");\r\n///<summary>&quot;Invalid namespace&quot;</summary> \r\npublic static string Validation_InvalidField_ProgrammingNamespace=>T(\"Validation.InvalidField.ProgrammingNamespace\");\r\n///<summary>&quot;Invalid URL&quot;</summary> \r\npublic static string Validation_InvalidField_Url=>T(\"Validation.InvalidField.Url\");\r\n///<summary>&quot;Invalid notation&quot;</summary> \r\npublic static string Validation_InvalidField_Currency=>T(\"Validation.InvalidField.Currency\");\r\n///<summary>&quot;Invalid e-mail&quot;</summary> \r\npublic static string Validation_InvalidField_Email=>T(\"Validation.InvalidField.Email\");\r\n///<summary>&quot;Invalid GUID&quot;</summary> \r\npublic static string Validation_InvalidField_Guid=>T(\"Validation.InvalidField.Guid\");\r\n///<summary>&quot;{0} characters minimum&quot;</summary> \r\npublic static string Validation_StringLength_Min_Template=>T(\"Validation.StringLength.Min\");\r\n///<summary>&quot;{0} characters minimum&quot;</summary> \r\npublic static string Validation_StringLength_Min(object parameter0)=>string.Format(T(\"Validation.StringLength.Min\"), parameter0);\r\n///<summary>&quot;{0} characters maximum&quot;</summary> \r\npublic static string Validation_StringLength_Max_Template=>T(\"Validation.StringLength.Max\");\r\n///<summary>&quot;{0} characters maximum&quot;</summary> \r\npublic static string Validation_StringLength_Max(object parameter0)=>string.Format(T(\"Validation.StringLength.Max\"), parameter0);\r\n///<summary>&quot;Page Browser&quot;</summary> \r\npublic static string Browser_Label=>T(\"Browser.Label\");\r\n///<summary>&quot;Browse unpublished pages&quot;</summary> \r\npublic static string Browser_ToolTip=>T(\"Browser.ToolTip\");\r\n///<summary>&quot;Copy{count} of {0}&quot;</summary> \r\npublic static string Duplication_Text_Template=>T(\"Duplication.Text\");\r\n///<summary>&quot;Copy{count} of {0}&quot;</summary> \r\npublic static string Duplication_Text(object parameter0)=>string.Format(T(\"Duplication.Text\"), parameter0);\r\n///<summary>&quot;Original&quot;</summary> \r\npublic static string DefaultVersionName=>T(\"DefaultVersionName\");\r\n///<summary>&quot;{0} selected&quot;</summary> \r\npublic static string Selector_Count_Template=>T(\"Selector.Count\");\r\n///<summary>&quot;{0} selected&quot;</summary> \r\npublic static string Selector_Count(object parameter0)=>string.Format(T(\"Selector.Count\"), parameter0);\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Management\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_NameValidation {\r\n///<summary>&quot;Name can not be an empty string&quot;</summary> \r\npublic static string EmptyName=>T(\"EmptyName\");\r\n///<summary>&quot;Namespace can not be an empty string&quot;</summary> \r\npublic static string EmptyNamespace=>T(\"EmptyNamespace\");\r\n///<summary>&quot;Namespace can not contain the same name part multiple times&quot;</summary> \r\npublic static string DuplicateElementNamespace=>T(\"DuplicateElementNamespace\");\r\n///<summary>&quot;The name &apos;{0}&apos; is not a valid identifier&quot;</summary> \r\npublic static string InvalidIdentifier_Template=>T(\"InvalidIdentifier\");\r\n///<summary>&quot;The name &apos;{0}&apos; is not a valid identifier&quot;</summary> \r\npublic static string InvalidIdentifier(object parameter0)=>string.Format(T(\"InvalidIdentifier\"), parameter0);\r\n///<summary>&quot;The name &apos;{0}&apos; is not a valid identifier. Identifiers may not start with digits.&quot;</summary> \r\npublic static string InvalidIdentifierDigit_Template=>T(\"InvalidIdentifierDigit\");\r\n///<summary>&quot;The name &apos;{0}&apos; is not a valid identifier. Identifiers may not start with digits.&quot;</summary> \r\npublic static string InvalidIdentifierDigit(object parameter0)=>string.Format(T(\"InvalidIdentifierDigit\"), parameter0);\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.NameValidation\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Permissions {\r\n///<summary>&quot;Read&quot;</summary> \r\npublic static string ReadLabel=>T(\"ReadLabel\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string EditLabel=>T(\"EditLabel\");\r\n///<summary>&quot;Add&quot;</summary> \r\npublic static string AddLabel=>T(\"AddLabel\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteLabel=>T(\"DeleteLabel\");\r\n///<summary>&quot;Approve&quot;</summary> \r\npublic static string ApproveLabel=>T(\"ApproveLabel\");\r\n///<summary>&quot;Publish&quot;</summary> \r\npublic static string PublishLabel=>T(\"PublishLabel\");\r\n///<summary>&quot;Configure&quot;</summary> \r\npublic static string ConfigureLabel=>T(\"ConfigureLabel\");\r\n///<summary>&quot;Administrate&quot;</summary> \r\npublic static string AdministrateLabel=>T(\"AdministrateLabel\");\r\n///<summary>&quot;ClearPermissions&quot;</summary> \r\npublic static string ClearPermissionsLabel=>T(\"ClearPermissionsLabel\");\r\n///<summary>&quot;This operation would remove your administrative permissions from this entity. You can not remove your own administrative permissions.&quot;</summary> \r\npublic static string AdminLockoutMessage=>T(\"AdminLockoutMessage\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Permissions\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_AllFunctionsElementProvider {\r\n///<summary>&quot;All Functions&quot;</summary> \r\npublic static string Plugins_AllFunctionsElementProvider_FunctionRootFolderLabel=>T(\"Plugins.AllFunctionsElementProvider.FunctionRootFolderLabel\");\r\n///<summary>&quot;All functions&quot;</summary> \r\npublic static string Plugins_AllFunctionsElementProvider_FunctionRootFolderToolTip=>T(\"Plugins.AllFunctionsElementProvider.FunctionRootFolderToolTip\");\r\n///<summary>&quot;All Widget Functions&quot;</summary> \r\npublic static string Plugins_AllFunctionsElementProvider_WidgetFunctionRootFolderLabel=>T(\"Plugins.AllFunctionsElementProvider.WidgetFunctionRootFolderLabel\");\r\n///<summary>&quot;All widget functions&quot;</summary> \r\npublic static string Plugins_AllFunctionsElementProvider_WidgetFunctionRootFolderToolTip=>T(\"Plugins.AllFunctionsElementProvider.WidgetFunctionRootFolderToolTip\");\r\n///<summary>&quot;Generate Documentation&quot;</summary> \r\npublic static string AllFunctionsElementProvider_GenerateDocumentation=>T(\"AllFunctionsElementProvider.GenerateDocumentation\");\r\n///<summary>&quot;Generate documentation for all functions below this folder&quot;</summary> \r\npublic static string AllFunctionsElementProvider_GenerateDocumentationTooltip=>T(\"AllFunctionsElementProvider.GenerateDocumentationTooltip\");\r\n///<summary>&quot;Information&quot;</summary> \r\npublic static string AllFunctionsElementProvider_ViewFunctionInformation=>T(\"AllFunctionsElementProvider.ViewFunctionInformation\");\r\n///<summary>&quot;View function information&quot;</summary> \r\npublic static string AllFunctionsElementProvider_ViewFunctionInformationTooltip=>T(\"AllFunctionsElementProvider.ViewFunctionInformationTooltip\");\r\n///<summary>&quot;Test: {0}&quot;</summary> \r\npublic static string FunctionTesterWorkflow_Layout_Label_Template=>T(\"FunctionTesterWorkflow.Layout.Label\");\r\n///<summary>&quot;Test: {0}&quot;</summary> \r\npublic static string FunctionTesterWorkflow_Layout_Label(object parameter0)=>string.Format(T(\"FunctionTesterWorkflow.Layout.Label\"), parameter0);\r\n///<summary>&quot;Functions&quot;</summary> \r\npublic static string FunctionTesterWorkflow_FunctionCalls_Label=>T(\"FunctionTesterWorkflow.FunctionCalls.Label\");\r\n///<summary>&quot;Results&quot;</summary> \r\npublic static string FunctionTesterWorkflow_Preview_Label=>T(\"FunctionTesterWorkflow.Preview.Label\");\r\n///<summary>&quot;Runtime&quot;</summary> \r\npublic static string FunctionTesterWorkflow_Runtime_FieldGroup_Label=>T(\"FunctionTesterWorkflow.Runtime.FieldGroup.Label\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string FunctionTesterWorkflow_DebugFieldGroup_Label=>T(\"FunctionTesterWorkflow.DebugFieldGroup.Label\");\r\n///<summary>&quot;Page&quot;</summary> \r\npublic static string FunctionTesterWorkflow_DebugPage_Label=>T(\"FunctionTesterWorkflow.DebugPage.Label\");\r\n///<summary>&quot;When executing the function, this page is used as current page&quot;</summary> \r\npublic static string FunctionTesterWorkflow_DebugPage_Help=>T(\"FunctionTesterWorkflow.DebugPage.Help\");\r\n///<summary>&quot;Data scope&quot;</summary> \r\npublic static string FunctionTesterWorkflow_DebugPageDataScope_Label=>T(\"FunctionTesterWorkflow.DebugPageDataScope.Label\");\r\n///<summary>&quot;When executing the function, this is used as current data scope&quot;</summary> \r\npublic static string FunctionTesterWorkflow_DebugPageDataScope_Help=>T(\"FunctionTesterWorkflow.DebugPageDataScope.Help\");\r\n///<summary>&quot;Language&quot;</summary> \r\npublic static string FunctionTesterWorkflow_DebugActiveLocale_Label=>T(\"FunctionTesterWorkflow.DebugActiveLocale.Label\");\r\n///<summary>&quot;When executing the function, this is used as the current language&quot;</summary> \r\npublic static string FunctionTesterWorkflow_DebugActiveLocale_Help=>T(\"FunctionTesterWorkflow.DebugActiveLocale.Help\");\r\n///<summary>&quot;Administrative&quot;</summary> \r\npublic static string FunctionTesterWorkflow_AdminitrativeScope_Label=>T(\"FunctionTesterWorkflow.AdminitrativeScope.Label\");\r\n///<summary>&quot;Public&quot;</summary> \r\npublic static string FunctionTesterWorkflow_PublicScope_Label=>T(\"FunctionTesterWorkflow.PublicScope.Label\");\r\n///<summary>&quot;Test Function&quot;</summary> \r\npublic static string AllFunctionsElementProvider_FunctionTester_Label=>T(\"AllFunctionsElementProvider.FunctionTester.Label\");\r\n///<summary>&quot;Test function&quot;</summary> \r\npublic static string AllFunctionsElementProvider_FunctionTester_ToolTip=>T(\"AllFunctionsElementProvider.FunctionTester.ToolTip\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_Components {\r\n///<summary>&quot;E-Commerce&quot;</summary> \r\npublic static string Tags_Ecommerce=>T(\"Tags.Ecommerce\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.Components\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_GeneratedDataTypesElementProvider {\r\n///<summary>&quot;Global Datatypes&quot;</summary> \r\npublic static string GlobalDataFolderLabel=>T(\"GlobalDataFolderLabel\");\r\n///<summary>&quot;Global datatypes&quot;</summary> \r\npublic static string GlobalDataFolderToolTip=>T(\"GlobalDataFolderToolTip\");\r\n///<summary>&quot;Website Items&quot;</summary> \r\npublic static string GlobalDataFolderLabel_OnlyGlobalData=>T(\"GlobalDataFolderLabel_OnlyGlobalData\");\r\n///<summary>&quot;Website Items (Data)&quot;</summary> \r\npublic static string GlobalDataFolderToolTip_OnlyGlobalData=>T(\"GlobalDataFolderToolTip_OnlyGlobalData\");\r\n///<summary>&quot;Page Datafolders&quot;</summary> \r\npublic static string PageDataFolderDataFolderLabel=>T(\"PageDataFolderDataFolderLabel\");\r\n///<summary>&quot;Page datafolders&quot;</summary> \r\npublic static string PageDataFolderDataFolderToolTip=>T(\"PageDataFolderDataFolderToolTip\");\r\n///<summary>&quot;Page Metatypes&quot;</summary> \r\npublic static string PageMetaDataFolderLabel=>T(\"PageMetaDataFolderLabel\");\r\n///<summary>&quot;Page metatypes&quot;</summary> \r\npublic static string PageMetaDataFolderToolTip=>T(\"PageMetaDataFolderToolTip\");\r\n///<summary>&quot;Add Datatype&quot;</summary> \r\npublic static string Add=>T(\"Add\");\r\n///<summary>&quot;Add new global datatype&quot;</summary> \r\npublic static string AddToolTip=>T(\"AddToolTip\");\r\n///<summary>&quot;List Unpublished Content&quot;</summary> \r\npublic static string ViewUnpublishedItems=>T(\"ViewUnpublishedItems\");\r\n///<summary>&quot;Get an overview of data that haven&apos;t been published yet&quot;</summary> \r\npublic static string ViewUnpublishedItemsToolTip=>T(\"ViewUnpublishedItemsToolTip\");\r\n///<summary>&quot;Unpublished data&quot;</summary> \r\npublic static string ViewUnpublishedItems_document_title=>T(\"ViewUnpublishedItems-document-title\");\r\n///<summary>&quot;The list below display data items which are currently being edited or are ready to be approved / published.&quot;</summary> \r\npublic static string ViewUnpublishedItems_document_description=>T(\"ViewUnpublishedItems-document-description\");\r\n///<summary>&quot;No unpublished data.&quot;</summary> \r\npublic static string ViewUnpublishedItems_document_empty_label=>T(\"ViewUnpublishedItems-document-empty-label\");\r\n///<summary>&quot;Add Datafolder&quot;</summary> \r\npublic static string AddDataFolder=>T(\"AddDataFolder\");\r\n///<summary>&quot;Add new datafolder&quot;</summary> \r\npublic static string AddDataFolderToolTip=>T(\"AddDataFolderToolTip\");\r\n///<summary>&quot;Add Metatype&quot;</summary> \r\npublic static string AddMetaDataLabel=>T(\"AddMetaDataLabel\");\r\n///<summary>&quot;Add metatype&quot;</summary> \r\npublic static string AddMetaDataToolTip=>T(\"AddMetaDataToolTip\");\r\n///<summary>&quot;Edit Datatype&quot;</summary> \r\npublic static string Edit=>T(\"Edit\");\r\n///<summary>&quot;Edit selected datatype&quot;</summary> \r\npublic static string EditToolTip=>T(\"EditToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string EditDataFolderTypeLabel=>T(\"EditDataFolderTypeLabel\");\r\n///<summary>&quot;Edit selected datafolder&quot;</summary> \r\npublic static string EditDataFolderTypeToolTip=>T(\"EditDataFolderTypeToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string EditMetaDataTypeLabel=>T(\"EditMetaDataTypeLabel\");\r\n///<summary>&quot;Edit selected metadata&quot;</summary> \r\npublic static string EditMetaDataTypeToolTip=>T(\"EditMetaDataTypeToolTip\");\r\n///<summary>&quot;Delete Datatype&quot;</summary> \r\npublic static string Delete=>T(\"Delete\");\r\n///<summary>&quot;Delete selected datatype&quot;</summary> \r\npublic static string DeleteToolTip=>T(\"DeleteToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteDataFolderTypeLabel=>T(\"DeleteDataFolderTypeLabel\");\r\n///<summary>&quot;Delete selected datafolder&quot;</summary> \r\npublic static string DeleteDataFolderTypeToolTip=>T(\"DeleteDataFolderTypeToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteMetaDataTypeLabel=>T(\"DeleteMetaDataTypeLabel\");\r\n///<summary>&quot;Delete selected metadata&quot;</summary> \r\npublic static string DeleteMetaDataTypeToolTip=>T(\"DeleteMetaDataTypeToolTip\");\r\n///<summary>&quot;Edit Form Markup&quot;</summary> \r\npublic static string EditFormMarkup=>T(\"EditFormMarkup\");\r\n///<summary>&quot;Modify the layout of the data form using markup&quot;</summary> \r\npublic static string EditFormMarkupToolTip=>T(\"EditFormMarkupToolTip\");\r\n///<summary>&quot;Enable Localization&quot;</summary> \r\npublic static string EnableLocalization=>T(\"EnableLocalization\");\r\n///<summary>&quot;Enable localization&quot;</summary> \r\npublic static string EnableLocalizationToolTip=>T(\"EnableLocalizationToolTip\");\r\n///<summary>&quot;Disable Localization&quot;</summary> \r\npublic static string DisableLocalization=>T(\"DisableLocalization\");\r\n///<summary>&quot;Disable localization&quot;</summary> \r\npublic static string DisableLocalizationToolTip=>T(\"DisableLocalizationToolTip\");\r\n///<summary>&quot;Not yet approved or published&quot;</summary> \r\npublic static string DisabledData=>T(\"DisabledData\");\r\n///<summary>&quot;(undefined [{0}])&quot;</summary> \r\npublic static string UndefinedLabelTemplate_Template=>T(\"UndefinedLabelTemplate\");\r\n///<summary>&quot;(undefined [{0}])&quot;</summary> \r\npublic static string UndefinedLabelTemplate(object parameter0)=>string.Format(T(\"UndefinedLabelTemplate\"), parameter0);\r\n///<summary>&quot;(undefined)&quot;</summary> \r\npublic static string UndefinedDataLavelTemplate=>T(\"UndefinedDataLavelTemplate\");\r\n///<summary>&quot;Show in Content perspective&quot;</summary> \r\npublic static string ShowInContent=>T(\"ShowInContent\");\r\n///<summary>&quot;Show in Content perspective&quot;</summary> \r\npublic static string ShowInContentToolTip=>T(\"ShowInContentToolTip\");\r\n///<summary>&quot;Add Data&quot;</summary> \r\npublic static string AddData=>T(\"AddData\");\r\n///<summary>&quot;Add new data&quot;</summary> \r\npublic static string AddDataToolTip=>T(\"AddDataToolTip\");\r\n///<summary>&quot;Edit Data&quot;</summary> \r\npublic static string EditData=>T(\"EditData\");\r\n///<summary>&quot;Edit selected data&quot;</summary> \r\npublic static string EditDataToolTip=>T(\"EditDataToolTip\");\r\n///<summary>&quot;Delete Data&quot;</summary> \r\npublic static string DeleteData=>T(\"DeleteData\");\r\n///<summary>&quot;Delete selected data&quot;</summary> \r\npublic static string DeleteDataToolTip=>T(\"DeleteDataToolTip\");\r\n///<summary>&quot;Duplicate Data&quot;</summary> \r\npublic static string DuplicateData=>T(\"DuplicateData\");\r\n///<summary>&quot;Duplicate selected data&quot;</summary> \r\npublic static string DuplicateDataToolTip=>T(\"DuplicateDataToolTip\");\r\n///<summary>&quot;Translate Data&quot;</summary> \r\npublic static string LocalizeData=>T(\"LocalizeData\");\r\n///<summary>&quot;Translate selected data&quot;</summary> \r\npublic static string LocalizeDataToolTip=>T(\"LocalizeDataToolTip\");\r\n///<summary>&quot;Publication settings&quot;</summary> \r\npublic static string PublicationSettings_FieldGroupLabel=>T(\"PublicationSettings.FieldGroupLabel\");\r\n///<summary>&quot;Status&quot;</summary> \r\npublic static string PublicationStatus_Label=>T(\"PublicationStatus.Label\");\r\n///<summary>&quot;Send the data to another publication status.&quot;</summary> \r\npublic static string PublicationStatus_Help=>T(\"PublicationStatus.Help\");\r\n///<summary>&quot;Publish date&quot;</summary> \r\npublic static string PublishDate_Label=>T(\"PublishDate.Label\");\r\n///<summary>&quot;Specify at which date and time you want the data to be published automatically.&quot;</summary> \r\npublic static string PublishDate_Help=>T(\"PublishDate.Help\");\r\n///<summary>&quot;Date Created&quot;</summary> \r\npublic static string DateCreated_Label=>T(\"DateCreated.Label\");\r\n///<summary>&quot;Date Modified&quot;</summary> \r\npublic static string DateModified_Label=>T(\"DateModified.Label\");\r\n///<summary>&quot;Author&quot;</summary> \r\npublic static string CreatedBy_Label=>T(\"CreatedBy.Label\");\r\n///<summary>&quot;Author&quot;</summary> \r\npublic static string ChangedBy_Label=>T(\"ChangedBy.Label\");\r\n///<summary>&quot;Unpublish date&quot;</summary> \r\npublic static string UnpublishDate_Label=>T(\"UnpublishDate.Label\");\r\n///<summary>&quot;Specify at which date and time you want the data to be unpublished automatically.&quot;</summary> \r\npublic static string UnpublishDate_Help=>T(\"UnpublishDate.Help\");\r\n///<summary>&quot;New Datatype&quot;</summary> \r\npublic static string AddNewInterfaceTypeStep1_DocumentTitle=>T(\"AddNewInterfaceTypeStep1.DocumentTitle\");\r\n///<summary>&quot;New Page Metatype&quot;</summary> \r\npublic static string AddNewCompositionTypeWorkflow_DocumentTitle=>T(\"AddNewCompositionTypeWorkflow.DocumentTitle\");\r\n///<summary>&quot;New Page Datafolder&quot;</summary> \r\npublic static string AddNewAggregationTypeWorkflow_DocumentTitle=>T(\"AddNewAggregationTypeWorkflow.DocumentTitle\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string EditorCommon_SettingsTab=>T(\"EditorCommon.SettingsTab\");\r\n///<summary>&quot;Type title&quot;</summary> \r\npublic static string EditorCommon_LabelTitleGroup=>T(\"EditorCommon.LabelTitleGroup\");\r\n///<summary>&quot;Programmatic naming and services&quot;</summary> \r\npublic static string EditorCommon_LabelProgrammaticNamingAndServices=>T(\"EditorCommon.LabelProgrammaticNamingAndServices\");\r\n///<summary>&quot;Programmatic naming&quot;</summary> \r\npublic static string EditorCommon_LabelProgrammaticNaming=>T(\"EditorCommon.LabelProgrammaticNaming\");\r\n///<summary>&quot;Type name&quot;</summary> \r\npublic static string EditorCommon_LabelTypeName=>T(\"EditorCommon.LabelTypeName\");\r\n///<summary>&quot;The technical name of the data type (ex. Product). This is used to identify this type in code and should not be changed once used externally.&quot;</summary> \r\npublic static string EditorCommon_HelpTypeName=>T(\"EditorCommon.HelpTypeName\");\r\n///<summary>&quot;Type namespace&quot;</summary> \r\npublic static string EditorCommon_LabelTypeNamespace=>T(\"EditorCommon.LabelTypeNamespace\");\r\n///<summary>&quot;The namespace (module / category name) of the type. This is used to identify this type in code and should not be changed once used externally.&quot;</summary> \r\npublic static string EditorCommon_HelpTypeNamespace=>T(\"EditorCommon.HelpTypeNamespace\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string EditorCommon_LabelTitle=>T(\"EditorCommon.LabelTitle\");\r\n///<summary>&quot;Use this entry to specify a user friendly name. This name is used in most UI.&quot;</summary> \r\npublic static string EditorCommon_HelpTitle=>T(\"EditorCommon.HelpTitle\");\r\n///<summary>&quot;Fields&quot;</summary> \r\npublic static string EditorCommon_LabelFields=>T(\"EditorCommon.LabelFields\");\r\n///<summary>&quot;Key field type&quot;</summary> \r\npublic static string EditorCommon_KeyFieldTypeLabel=>T(\"EditorCommon.KeyFieldTypeLabel\");\r\n///<summary>&quot;The type of the primary key. Use the default &apos;Guid&apos; type for optimal performance and &apos;RandomString&apos; for shorter data urls.&quot;</summary> \r\npublic static string EditorCommon_KeyFieldTypeHelp=>T(\"EditorCommon.KeyFieldTypeHelp\");\r\n///<summary>&quot;Guid&quot;</summary> \r\npublic static string EditorCommon_KeyFieldType_Guid=>T(\"EditorCommon.KeyFieldType.Guid\");\r\n///<summary>&quot;Random String, 4 characters long&quot;</summary> \r\npublic static string EditorCommon_KeyFieldType_RandomString4=>T(\"EditorCommon.KeyFieldType.RandomString4\");\r\n///<summary>&quot;Random String, 8 characters long&quot;</summary> \r\npublic static string EditorCommon_KeyFieldType_RandomString8=>T(\"EditorCommon.KeyFieldType.RandomString8\");\r\n///<summary>&quot;Services&quot;</summary> \r\npublic static string EditorCommon_ServicesLabel=>T(\"EditorCommon.ServicesLabel\");\r\n///<summary>&quot;Short URL name&quot;</summary> \r\npublic static string EditorCommon_InternalUrlPrefixLabel=>T(\"EditorCommon.InternalUrlPrefixLabel\");\r\n///<summary>&quot;When specified, allows data items of the current type to be referenced in content. The internal links will have format &apos;~/{ShortURLName}({id})&apos;, f.e. &apos;~/product(aIkH34F)&quot;</summary> \r\npublic static string EditorCommon_InternalUrlPrefixHelp=>T(\"EditorCommon.InternalUrlPrefixHelp\");\r\n///<summary>&quot;Has caching&quot;</summary> \r\npublic static string EditorCommon_HasCaching=>T(\"EditorCommon.HasCaching\");\r\n///<summary>&quot;Is searchable&quot;</summary> \r\npublic static string EditorCommon_IsSearchable=>T(\"EditorCommon.IsSearchable\");\r\n///<summary>&quot;Has publishing&quot;</summary> \r\npublic static string EditorCommon_HasPublishing=>T(\"EditorCommon.HasPublishing\");\r\n///<summary>&quot;Is localizable data&quot;</summary> \r\npublic static string EditorCommon_HasLocalization=>T(\"EditorCommon.HasLocalization\");\r\n///<summary>&quot;Delete Data?&quot;</summary> \r\npublic static string DeleteGeneratedDataStep1_LabelFieldGroup=>T(\"DeleteGeneratedDataStep1.LabelFieldGroup\");\r\n///<summary>&quot;Delete data?&quot;</summary> \r\npublic static string DeleteGeneratedDataStep1_Text=>T(\"DeleteGeneratedDataStep1.Text\");\r\n///<summary>&quot;There is some referenced data that will also be deleted, do you want to continue?&quot;</summary> \r\npublic static string DeleteDataConfirmationText=>T(\"DeleteDataConfirmationText\");\r\n///<summary>&quot;Delete Datatype&quot;</summary> \r\npublic static string DeleteGeneratedInterfaceStep1_LabelFieldGroup=>T(\"DeleteGeneratedInterfaceStep1.LabelFieldGroup\");\r\n///<summary>&quot;Delete the datatype&quot;</summary> \r\npublic static string DeleteGeneratedInterfaceStep1_Text=>T(\"DeleteGeneratedInterfaceStep1.Text\");\r\n///<summary>&quot;Cascade delete error&quot;</summary> \r\npublic static string CascadeDeleteErrorTitle=>T(\"CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string CascadeDeleteErrorMessage=>T(\"CascadeDeleteErrorMessage\");\r\n///<summary>&quot;Delete Datatype&quot;</summary> \r\npublic static string DeleteAggregationTypeWorkflow_LabelFieldGroup=>T(\"DeleteAggregationTypeWorkflow.LabelFieldGroup\");\r\n///<summary>&quot;Delete the datatype&quot;</summary> \r\npublic static string DeleteAggregationTypeWorkflow_Text=>T(\"DeleteAggregationTypeWorkflow.Text\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string DeleteAggregationTypeWorkflow_ErrorTitle=>T(\"DeleteAggregationTypeWorkflow.ErrorTitle\");\r\n///<summary>&quot;Cannot delete type &apos;{0}&apos; since it is used by a page type.&quot;</summary> \r\npublic static string DeleteAggregationTypeWorkflow_IsUsedByPageType_Template=>T(\"DeleteAggregationTypeWorkflow.IsUsedByPageType\");\r\n///<summary>&quot;Cannot delete type &apos;{0}&apos; since it is used by a page type.&quot;</summary> \r\npublic static string DeleteAggregationTypeWorkflow_IsUsedByPageType(object parameter0)=>string.Format(T(\"DeleteAggregationTypeWorkflow.IsUsedByPageType\"), parameter0);\r\n///<summary>&quot;Delete Datatype&quot;</summary> \r\npublic static string DeleteCompositionTypeWorkflow_LabelFieldGroup=>T(\"DeleteCompositionTypeWorkflow.LabelFieldGroup\");\r\n///<summary>&quot;Delete the datatype&quot;</summary> \r\npublic static string DeleteCompositionTypeWorkflow_Text=>T(\"DeleteCompositionTypeWorkflow.Text\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string DeleteCompositionTypeWorkflow_ErrorTitle=>T(\"DeleteCompositionTypeWorkflow.ErrorTitle\");\r\n///<summary>&quot;Cannot delete type &apos;{0}&apos; since there&apos;re types that referenced to it.&quot;</summary> \r\npublic static string DeleteCompositionTypeWorkflow_TypeIsReferenced_Template=>T(\"DeleteCompositionTypeWorkflow.TypeIsReferenced\");\r\n///<summary>&quot;Cannot delete type &apos;{0}&apos; since there&apos;re types that referenced to it.&quot;</summary> \r\npublic static string DeleteCompositionTypeWorkflow_TypeIsReferenced(object parameter0)=>string.Format(T(\"DeleteCompositionTypeWorkflow.TypeIsReferenced\"), parameter0);\r\n///<summary>&quot;Cannot delete type &apos;{0}&apos; since it is used by a page type.&quot;</summary> \r\npublic static string DeleteCompositionTypeWorkflow_IsUsedByPageType_Template=>T(\"DeleteCompositionTypeWorkflow.IsUsedByPageType\");\r\n///<summary>&quot;Cannot delete type &apos;{0}&apos; since it is used by a page type.&quot;</summary> \r\npublic static string DeleteCompositionTypeWorkflow_IsUsedByPageType(object parameter0)=>string.Format(T(\"DeleteCompositionTypeWorkflow.IsUsedByPageType\"), parameter0);\r\n///<summary>&quot;To Xml&quot;</summary> \r\npublic static string ToXmlLabel=>T(\"ToXmlLabel\");\r\n///<summary>&quot;To Xml&quot;</summary> \r\npublic static string ToXmlToolTip=>T(\"ToXmlToolTip\");\r\n///<summary>&quot;Enable Localization&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Dialog_Label=>T(\"EnableTypeLocalizationWorkflow.Dialog.Label\");\r\n///<summary>&quot;Enable localization&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Step1_FieldGroup_Label=>T(\"EnableTypeLocalizationWorkflow.Step1.FieldGroup.Label\");\r\n///<summary>&quot;Move existing data to ...&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Step1_CultureSelector_Label=>T(\"EnableTypeLocalizationWorkflow.Step1.CultureSelector.Label\");\r\n///<summary>&quot;When you enable &apos;localization&apos; on a data type, all data must belong to a language. Select the language existing data should now be moved to.&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Step1_CultureSelector_Help=>T(\"EnableTypeLocalizationWorkflow.Step1.CultureSelector.Help\");\r\n///<summary>&quot;Confirmation&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Step2_Title=>T(\"EnableTypeLocalizationWorkflow.Step2.Title\");\r\n///<summary>&quot;Data type will be localized and data copied to selected locale. Click Finish to continue.&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Step2_Description=>T(\"EnableTypeLocalizationWorkflow.Step2.Description\");\r\n///<summary>&quot;Warning&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Step3_Title=>T(\"EnableTypeLocalizationWorkflow.Step3.Title\");\r\n///<summary>&quot;There&apos;s some datatypes which have references to the type. While localizing the data will be copied to all languages in order to prevent appearing of broken references.&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Step3_Description=>T(\"EnableTypeLocalizationWorkflow.Step3.Description\");\r\n///<summary>&quot;Missing active locales&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Abort_Title=>T(\"EnableTypeLocalizationWorkflow.Abort.Title\");\r\n///<summary>&quot;There are no added active locales. Add at least one before localization this datatype.&quot;</summary> \r\npublic static string EnableTypeLocalizationWorkflow_Abort_Description=>T(\"EnableTypeLocalizationWorkflow.Abort.Description\");\r\n///<summary>&quot;Disable Localization&quot;</summary> \r\npublic static string DisableTypeLocalizationWorkflow_Dialog_Label=>T(\"DisableTypeLocalizationWorkflow.Dialog.Label\");\r\n///<summary>&quot;Disable localization&quot;</summary> \r\npublic static string DisableTypeLocalizationWorkflow_Step1_FieldGroup_Label=>T(\"DisableTypeLocalizationWorkflow.Step1.FieldGroup.Label\");\r\n///<summary>&quot;Keep data from ...&quot;</summary> \r\npublic static string DisableTypeLocalizationWorkflow_Step1_CultureSelector_Label=>T(\"DisableTypeLocalizationWorkflow.Step1.CultureSelector.Label\");\r\n///<summary>&quot;When localization is disabled on a datatype only one translation can be kept. Data from other languages will be lost.&quot;</summary> \r\npublic static string DisableTypeLocalizationWorkflow_Step1_CultureSelector_Help=>T(\"DisableTypeLocalizationWorkflow.Step1.CultureSelector.Help\");\r\n///<summary>&quot;Confirmation&quot;</summary> \r\npublic static string DisableTypeLocalizationWorkflow_Step2_Title=>T(\"DisableTypeLocalizationWorkflow.Step2.Title\");\r\n///<summary>&quot;All data from other locales than the one selected will be lost. Click Finish to continue.&quot;</summary> \r\npublic static string DisableTypeLocalizationWorkflow_Step2_Description=>T(\"DisableTypeLocalizationWorkflow.Step2.Description\");\r\n///<summary>&quot;Failed to translate data&quot;</summary> \r\npublic static string LocalizeDataWorkflow_ShowError_LayoutLabel=>T(\"LocalizeDataWorkflow.ShowError.LayoutLabel\");\r\n///<summary>&quot;Translation errors&quot;</summary> \r\npublic static string LocalizeDataWorkflow_ShowError_InfoTableCaption=>T(\"LocalizeDataWorkflow.ShowError.InfoTableCaption\");\r\n///<summary>&quot;This data has already been translated. The translated version belongs to a different group.&quot;</summary> \r\npublic static string LocalizeDataWorkflow_ShowError_AlreadyTranslated=>T(\"LocalizeDataWorkflow.ShowError.AlreadyTranslated\");\r\n///<summary>&quot;The following fields has a reference to a data type. You should translate these data items before you can translate this data item&quot;</summary> \r\npublic static string LocalizeDataWorkflow_ShowError_Description=>T(\"LocalizeDataWorkflow.ShowError.Description\");\r\n///<summary>&quot;The field &apos;{0}&apos; is referencing data of type &apos;{1}&apos; with the label &apos;{2}&apos;&quot;</summary> \r\npublic static string LocalizeDataWorkflow_ShowError_FieldErrorFormat_Template=>T(\"LocalizeDataWorkflow.ShowError.FieldErrorFormat\");\r\n///<summary>&quot;The field &apos;{0}&apos; is referencing data of type &apos;{1}&apos; with the label &apos;{2}&apos;&quot;</summary> \r\npublic static string LocalizeDataWorkflow_ShowError_FieldErrorFormat(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"LocalizeDataWorkflow.ShowError.FieldErrorFormat\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string AddNewInterfaceTypeStep1_ErrorTitle=>T(\"AddNewInterfaceTypeStep1.ErrorTitle\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string EditInterfaceTypeStep1_ErrorTitle=>T(\"EditInterfaceTypeStep1.ErrorTitle\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string AddNewCompositionTypeWorkflow_ErrorTitle=>T(\"AddNewCompositionTypeWorkflow.ErrorTitle\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string EditCompositionTypeWorkflow_ErrorTitle=>T(\"EditCompositionTypeWorkflow.ErrorTitle\");\r\n///<summary>&quot;XML Result&quot;</summary> \r\npublic static string DataTypeDescriptorToXmlLabel=>T(\"DataTypeDescriptorToXmlLabel\");\r\n///<summary>&quot;This type has custom form markup&quot;</summary> \r\npublic static string FormMarkupInfo_Dialog_Label=>T(\"FormMarkupInfo.Dialog.Label\");\r\n///<summary>&quot;Your field changes will not affect the form for editing data. Do &apos;{0}&apos; to change the form or delete the file &apos;{1}&apos;.&quot;</summary> \r\npublic static string FormMarkupInfo_Message_Template=>T(\"FormMarkupInfo.Message\");\r\n///<summary>&quot;Your field changes will not affect the form for editing data. Do &apos;{0}&apos; to change the form or delete the file &apos;{1}&apos;.&quot;</summary> \r\npublic static string FormMarkupInfo_Message(object parameter0,object parameter1)=>string.Format(T(\"FormMarkupInfo.Message\"), parameter0,parameter1);\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_GenericPublishProcessController {\r\n///<summary>&quot;Send to Draft&quot;</summary> \r\npublic static string SendToDraft=>T(\"SendToDraft\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string SendToDraftToolTip=>T(\"SendToDraftToolTip\");\r\n///<summary>&quot;Publish&quot;</summary> \r\npublic static string Publish=>T(\"Publish\");\r\n///<summary>&quot;Publish to site&quot;</summary> \r\npublic static string PublishToolTip=>T(\"PublishToolTip\");\r\n///<summary>&quot;Unpublish&quot;</summary> \r\npublic static string Unpublish=>T(\"Unpublish\");\r\n///<summary>&quot;Set to draft status and remove the published version&quot;</summary> \r\npublic static string UnpublishToolTip=>T(\"UnpublishToolTip\");\r\n///<summary>&quot;Send for Approval&quot;</summary> \r\npublic static string SendForApproval=>T(\"SendForApproval\");\r\n///<summary>&quot;Send for approval&quot;</summary> \r\npublic static string SendForApprovalToolTip=>T(\"SendForApprovalToolTip\");\r\n///<summary>&quot;Send for Publication&quot;</summary> \r\npublic static string SendForPublication=>T(\"SendForPublication\");\r\n///<summary>&quot;Send for publication&quot;</summary> \r\npublic static string SendForPublicationToolTip=>T(\"SendForPublicationToolTip\");\r\n///<summary>&quot;Undo Changes&quot;</summary> \r\npublic static string UndoPublishedChanges=>T(\"UndoPublishedChanges\");\r\n///<summary>&quot;Undo unpublished changes&quot;</summary> \r\npublic static string UndoPublishedChangesToolTip=>T(\"UndoPublishedChangesToolTip\");\r\n///<summary>&quot;Action Not Possible&quot;</summary> \r\npublic static string ValidationErrorTitle=>T(\"ValidationErrorTitle\");\r\n///<summary>&quot;The data did not validate with the following errors:&quot;</summary> \r\npublic static string ValidationErrorMessage=>T(\"ValidationErrorMessage\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_LocalizationElementProvider {\r\n///<summary>&quot;Languages&quot;</summary> \r\npublic static string ElementProvider_RootFolderLabel=>T(\"ElementProvider.RootFolderLabel\");\r\n///<summary>&quot;Explore and manage installed languages&quot;</summary> \r\npublic static string ElementProvider_RootFolderToolTip=>T(\"ElementProvider.RootFolderToolTip\");\r\n///<summary>&quot;Default&quot;</summary> \r\npublic static string ElementProvider_DefaultLabel=>T(\"ElementProvider.DefaultLabel\");\r\n///<summary>&quot;No Languages Available&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_NoMoreLocalesTitle=>T(\"AddSystemLocaleWorkflow.NoMoreLocalesTitle\");\r\n///<summary>&quot;You have installed all possible languages.&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_NoMoreLocalesMessage=>T(\"AddSystemLocaleWorkflow.NoMoreLocalesMessage\");\r\n///<summary>&quot;Add Language&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_AddElementActionLabel=>T(\"AddSystemLocaleWorkflow.AddElementActionLabel\");\r\n///<summary>&quot;Add new language&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_AddElementActionToolTip=>T(\"AddSystemLocaleWorkflow.AddElementActionToolTip\");\r\n///<summary>&quot;Add Language&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_Dialog_Label=>T(\"AddSystemLocaleWorkflow.Dialog.Label\");\r\n///<summary>&quot;Languages&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_CultureSelector_Label=>T(\"AddSystemLocaleWorkflow.CultureSelector.Label\");\r\n///<summary>&quot;The list of available, uninstalled languages. Language packages may be installed for additional options.&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_CultureSelector_Help=>T(\"AddSystemLocaleWorkflow.CultureSelector.Help\");\r\n///<summary>&quot;URL mapping name&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_UrlMappingName_Label=>T(\"AddSystemLocaleWorkflow.UrlMappingName.Label\");\r\n///<summary>&quot;This string will be inserted into the URL of pages published in a given language. The website &quot;default&quot; language may leave this entry blank.&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_UrlMappingName_Help=>T(\"AddSystemLocaleWorkflow.UrlMappingName.Help\");\r\n///<summary>&quot;User access&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_AllUsersAccess_Label=>T(\"AddSystemLocaleWorkflow.AllUsersAccess.Label\");\r\n///<summary>&quot;Give access to all users&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_AllUsersAccess_ItemLabel=>T(\"AddSystemLocaleWorkflow.AllUsersAccess.ItemLabel\");\r\n///<summary>&quot;If checked, the language will be made available to all registered users for viewing and editing&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_AllUsersAccess_Help=>T(\"AddSystemLocaleWorkflow.AllUsersAccess.Help\");\r\n///<summary>&quot;URL mapping name is already in use&quot;</summary> \r\npublic static string AddSystemLocaleWorkflow_UrlMappingName_InUseMessage=>T(\"AddSystemLocaleWorkflow.UrlMappingName.InUseMessage\");\r\n///<summary>&quot;Edit Language&quot;</summary> \r\npublic static string EditSystemLocaleWorkflow_EditElementActionLabel=>T(\"EditSystemLocaleWorkflow.EditElementActionLabel\");\r\n///<summary>&quot;Edit language&quot;</summary> \r\npublic static string EditSystemLocaleWorkflow_EditElementActionToolTip=>T(\"EditSystemLocaleWorkflow.EditElementActionToolTip\");\r\n///<summary>&quot;Edit Language&quot;</summary> \r\npublic static string EditSystemLocaleWorkflow_Dialog_Label=>T(\"EditSystemLocaleWorkflow.Dialog.Label\");\r\n///<summary>&quot;Language properties&quot;</summary> \r\npublic static string EditSystemLocaleWorkflow_FieldGroup_Label=>T(\"EditSystemLocaleWorkflow.FieldGroup.Label\");\r\n///<summary>&quot;URL mapping name&quot;</summary> \r\npublic static string EditSystemLocaleWorkflow_UrlMappingName_Label=>T(\"EditSystemLocaleWorkflow.UrlMappingName.Label\");\r\n///<summary>&quot;URL mapping name&quot;</summary> \r\npublic static string EditSystemLocaleWorkflow_UrlMappingName_Help=>T(\"EditSystemLocaleWorkflow.UrlMappingName.Help\");\r\n///<summary>&quot;URL mapping name is already in use&quot;</summary> \r\npublic static string EditSystemLocaleWorkflow_UrlMappingName_InUseMessage=>T(\"EditSystemLocaleWorkflow.UrlMappingName.InUseMessage\");\r\n///<summary>&quot;Set as Default&quot;</summary> \r\npublic static string DefineDefaultActiveLocaleWorkflow_ElementActionLabel=>T(\"DefineDefaultActiveLocaleWorkflow.ElementActionLabel\");\r\n///<summary>&quot;Set as default language&quot;</summary> \r\npublic static string DefineDefaultActiveLocaleWorkflow_ElementActionToolTip=>T(\"DefineDefaultActiveLocaleWorkflow.ElementActionToolTip\");\r\n///<summary>&quot;Remove Language&quot;</summary> \r\npublic static string RemoveSystemLocaleWorkflow_RemoveElementActionLabel=>T(\"RemoveSystemLocaleWorkflow.RemoveElementActionLabel\");\r\n///<summary>&quot;Remove language&quot;</summary> \r\npublic static string RemoveSystemLocaleWorkflow_RemoveElementActionToolTip=>T(\"RemoveSystemLocaleWorkflow.RemoveElementActionToolTip\");\r\n///<summary>&quot;Remove Language?&quot;</summary> \r\npublic static string RemoveSystemLocaleWorkflow_Dialog_Label=>T(\"RemoveSystemLocaleWorkflow.Dialog.Label\");\r\n///<summary>&quot;Cannot Remove Last Language&quot;</summary> \r\npublic static string RemoveSystemLocaleWorkflow_Abort_Title=>T(\"RemoveSystemLocaleWorkflow.Abort.Title\");\r\n///<summary>&quot;You are about to remove a language that is the only language for one or more users. Please add other languages to these users and try again.&quot;</summary> \r\npublic static string RemoveSystemLocaleWorkflow_Abort_Description=>T(\"RemoveSystemLocaleWorkflow.Abort.Description\");\r\n///<summary>&quot;Remove this language?&quot;</summary> \r\npublic static string RemoveSystemLocaleWorkflow_Confirm_Description=>T(\"RemoveSystemLocaleWorkflow.Confirm.Description\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_MasterPagePageTemplate {\r\n///<summary>&quot;Add New Master Page&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplateWorkflow_LabelDialog=>T(\"AddNewMasterPagePageTemplateWorkflow.LabelDialog\");\r\n///<summary>&quot;Edit Master Page&quot;</summary> \r\npublic static string EditMasterPageAction_Label=>T(\"EditMasterPageAction.Label\");\r\n///<summary>&quot;Edit source code of the master page&quot;</summary> \r\npublic static string EditMasterPageAction_ToolTip=>T(\"EditMasterPageAction.ToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteMasterPageAction_Label=>T(\"DeleteMasterPageAction.Label\");\r\n///<summary>&quot;Delete page template&quot;</summary> \r\npublic static string DeleteMasterPageAction_ToolTip=>T(\"DeleteMasterPageAction.ToolTip\");\r\n///<summary>&quot;Validation error&quot;</summary> \r\npublic static string EditTemplate_Validation_DialogTitle=>T(\"EditTemplate.Validation.DialogTitle\");\r\n///<summary>&quot;Compilation failed: {0}&quot;</summary> \r\npublic static string EditTemplate_Validation_CompilationFailed_Template=>T(\"EditTemplate.Validation.CompilationFailed\");\r\n///<summary>&quot;Compilation failed: {0}&quot;</summary> \r\npublic static string EditTemplate_Validation_CompilationFailed(object parameter0)=>string.Format(T(\"EditTemplate.Validation.CompilationFailed\"), parameter0);\r\n///<summary>&quot;Page template class does not inherit &apos;{0}&apos;&quot;</summary> \r\npublic static string EditTemplate_Validation_IncorrectBaseClass_Template=>T(\"EditTemplate.Validation.IncorrectBaseClass\");\r\n///<summary>&quot;Page template class does not inherit &apos;{0}&apos;&quot;</summary> \r\npublic static string EditTemplate_Validation_IncorrectBaseClass(object parameter0)=>string.Format(T(\"EditTemplate.Validation.IncorrectBaseClass\"), parameter0);\r\n///<summary>&quot;Failed to evaluate page template property &apos;{0}&apos;. Exception: {1}&quot;</summary> \r\npublic static string EditTemplate_Validation_PropertyError_Template=>T(\"EditTemplate.Validation.PropertyError\");\r\n///<summary>&quot;Failed to evaluate page template property &apos;{0}&apos;. Exception: {1}&quot;</summary> \r\npublic static string EditTemplate_Validation_PropertyError(object parameter0,object parameter1)=>string.Format(T(\"EditTemplate.Validation.PropertyError\"), parameter0,parameter1);\r\n///<summary>&quot;It is not allowed to change the template ID through the current workflow. The original template ID is &apos;{0}&apos;&quot;</summary> \r\npublic static string EditTemplate_Validation_TemplateIdChanged_Template=>T(\"EditTemplate.Validation.TemplateIdChanged\");\r\n///<summary>&quot;It is not allowed to change the template ID through the current workflow. The original template ID is &apos;{0}&apos;&quot;</summary> \r\npublic static string EditTemplate_Validation_TemplateIdChanged(object parameter0)=>string.Format(T(\"EditTemplate.Validation.TemplateIdChanged\"), parameter0);\r\n///<summary>&quot;Add New Master Page Template&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplate_LabelDialog=>T(\"AddNewMasterPagePageTemplate.LabelDialog\");\r\n///<summary>&quot;Template Title&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplate_LabelTemplateTitle=>T(\"AddNewMasterPagePageTemplate.LabelTemplateTitle\");\r\n///<summary>&quot;The title identifies this template in lists. Consider selecting a short but meaningful name.&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplate_LabelTemplateTitleHelp=>T(\"AddNewMasterPagePageTemplate.LabelTemplateTitleHelp\");\r\n///<summary>&quot;Copy from&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplate_LabelCopyFrom=>T(\"AddNewMasterPagePageTemplate.LabelCopyFrom\");\r\n///<summary>&quot;You can copy the markup from another Layout Template by selecting it in this list.&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplate_LabelCopyFromHelp=>T(\"AddNewMasterPagePageTemplate.LabelCopyFromHelp\");\r\n///<summary>&quot;(New template)&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplate_LabelCopyFromEmptyOption=>T(\"AddNewMasterPagePageTemplate.LabelCopyFromEmptyOption\");\r\n///<summary>&quot;Title already used&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplateWorkflow_TitleInUseTitle=>T(\"AddNewMasterPagePageTemplateWorkflow.TitleInUseTitle\");\r\n///<summary>&quot;The title is too long (used as part of a filename).&quot;</summary> \r\npublic static string AddNewMasterPagePageTemplateWorkflow_TitleTooLong=>T(\"AddNewMasterPagePageTemplateWorkflow.TitleTooLong\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.MasterPagePageTemplate\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_MethodBasedFunctionProviderElementProvider {\r\n///<summary>&quot;C# Functions&quot;</summary> \r\npublic static string RootFolderLabel=>T(\"RootFolderLabel\");\r\n///<summary>&quot;Method functions&quot;</summary> \r\npublic static string RootFolderToolTip=>T(\"RootFolderToolTip\");\r\n///<summary>&quot;Delete This Function&quot;</summary> \r\npublic static string DeleteFunction_LabelFieldGroup=>T(\"DeleteFunction.LabelFieldGroup\");\r\n///<summary>&quot;Delete this function&quot;</summary> \r\npublic static string DeleteFunction_Text=>T(\"DeleteFunction.Text\");\r\n///<summary>&quot;Add External C# function&quot;</summary> \r\npublic static string Add=>T(\"Add\");\r\n///<summary>&quot;Add an external C# method based function.&quot;</summary> \r\npublic static string AddToolTip=>T(\"AddToolTip\");\r\n///<summary>&quot;Add Inline C# function&quot;</summary> \r\npublic static string Create=>T(\"Create\");\r\n///<summary>&quot;Add an inline C# method based function.&quot;</summary> \r\npublic static string CreateToolTip=>T(\"CreateToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string Edit=>T(\"Edit\");\r\n///<summary>&quot;Edit Function.&quot;</summary> \r\npublic static string EditToolTip=>T(\"EditToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string Delete=>T(\"Delete\");\r\n///<summary>&quot;Delete Function.&quot;</summary> \r\npublic static string DeleteToolTip=>T(\"DeleteToolTip\");\r\n///<summary>&quot;Type&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep1_LabelType=>T(\"AddNewMethodBasedFunctionStep1.LabelType\");\r\n///<summary>&quot;The type that contains the method in question&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep1_LabelTypeHelp=>T(\"AddNewMethodBasedFunctionStep1.LabelTypeHelp\");\r\n///<summary>&quot;Method name&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep2_LabelMethodName=>T(\"AddNewMethodBasedFunctionStep2.LabelMethodName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep2_HelpMethodName=>T(\"AddNewMethodBasedFunctionStep2.HelpMethodName\");\r\n///<summary>&quot;Method Name&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep3_LabelMethodName=>T(\"AddNewMethodBasedFunctionStep3.LabelMethodName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep3_HelpMethodName=>T(\"AddNewMethodBasedFunctionStep3.HelpMethodName\");\r\n///<summary>&quot;Namespace Name&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep3_LabelNamespaceName=>T(\"AddNewMethodBasedFunctionStep3.LabelNamespaceName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep3_HelpNamespaceName=>T(\"AddNewMethodBasedFunctionStep3.HelpNamespaceName\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string AddNewMethodBasedFunctionStep3_LabelError=>T(\"AddNewMethodBasedFunctionStep3.LabelError\");\r\n///<summary>&quot;Cascade delete error&quot;</summary> \r\npublic static string CascadeDeleteErrorTitle=>T(\"CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string CascadeDeleteErrorMessage=>T(\"CascadeDeleteErrorMessage\");\r\n///<summary>&quot;Could not find type&quot;</summary> \r\npublic static string AddFunction_CouldNotFindType=>T(\"AddFunction.CouldNotFindType\");\r\n///<summary>&quot;The type does not contain any valid method&quot;</summary> \r\npublic static string AddFunction_TypeHasNoValidMethod=>T(\"AddFunction.TypeHasNoValidMethod\");\r\n///<summary>&quot;The type is marked as either abstract or static. Calling methods on abstract or static types is not supported.&quot;</summary> \r\npublic static string AddFunction_TypeIsAbstractOrStatic=>T(\"AddFunction.TypeIsAbstractOrStatic\");\r\n///<summary>&quot;The type must not have overloads&quot;</summary> \r\npublic static string AddFunction_TypeMustNotHaveOverloads=>T(\"AddFunction.TypeMustNotHaveOverloads\");\r\n///<summary>&quot;Method name must be non-empty&quot;</summary> \r\npublic static string AddFunction_MethodNameIsEmpty=>T(\"AddFunction.MethodNameIsEmpty\");\r\n///<summary>&quot;Namespace must be like A.B.C - not start and end with .&quot;</summary> \r\npublic static string AddFunction_InvalidNamespace=>T(\"AddFunction.InvalidNamespace\");\r\n///<summary>&quot;The function name &apos;{0}&apos; is already used&quot;</summary> \r\npublic static string AddFunction_NameAlreadyUsed_Template=>T(\"AddFunction.NameAlreadyUsed\");\r\n///<summary>&quot;The function name &apos;{0}&apos; is already used&quot;</summary> \r\npublic static string AddFunction_NameAlreadyUsed(object parameter0)=>string.Format(T(\"AddFunction.NameAlreadyUsed\"), parameter0);\r\n///<summary>&quot;Edit Method Based Query&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelFieldGroup=>T(\"EditMethodBasedFunction.LabelFieldGroup\");\r\n///<summary>&quot;Method Name&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelMethodName=>T(\"EditMethodBasedFunction.LabelMethodName\");\r\n///<summary>&quot;The name that the function should be know under.&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelMethodNameHelp=>T(\"EditMethodBasedFunction.LabelMethodNameHelp\");\r\n///<summary>&quot;Namespace Name&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelNamespaceName=>T(\"EditMethodBasedFunction.LabelNamespaceName\");\r\n///<summary>&quot;The namespace to place the method under.&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelNamespaceNameHelp=>T(\"EditMethodBasedFunction.LabelNamespaceNameHelp\");\r\n///<summary>&quot;Type&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelType=>T(\"EditMethodBasedFunction.LabelType\");\r\n///<summary>&quot;The type that contains the method in question.&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelTypeHelp=>T(\"EditMethodBasedFunction.LabelTypeHelp\");\r\n///<summary>&quot;Method&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelMethod=>T(\"EditMethodBasedFunction.LabelMethod\");\r\n///<summary>&quot;The method to invoke on the type.&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelMethodHelp=>T(\"EditMethodBasedFunction.LabelMethodHelp\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string EditMethodBasedFunction_LabelError=>T(\"EditMethodBasedFunction.LabelError\");\r\n///<summary>&quot;Method name must be non-empty&quot;</summary> \r\npublic static string EditFunction_MethodNameEmpty=>T(\"EditFunction.MethodNameEmpty\");\r\n///<summary>&quot;Namespace must not start and end with . - example A.B.C&quot;</summary> \r\npublic static string EditFunction_InvalidNamespace=>T(\"EditFunction.InvalidNamespace\");\r\n///<summary>&quot;Could not find type&quot;</summary> \r\npublic static string EditFunction_TypeNotFound=>T(\"EditFunction.TypeNotFound\");\r\n///<summary>&quot;The type does not contain the method&quot;</summary> \r\npublic static string EditFunction_MethodNotInType=>T(\"EditFunction.MethodNotInType\");\r\n///<summary>&quot;The type does not contain any valid method&quot;</summary> \r\npublic static string EditFunction_NoValidMethod=>T(\"EditFunction.NoValidMethod\");\r\n///<summary>&quot;The type must not have overloads&quot;</summary> \r\npublic static string EditFunction_MethodOverloadsNotAllowed=>T(\"EditFunction.MethodOverloadsNotAllowed\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_FieldGroup_Label=>T(\"AddInlineFunctionWorkflow.FieldGroup.Label\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_MethodName_Label=>T(\"AddInlineFunctionWorkflow.MethodName.Label\");\r\n///<summary>&quot;The name of the method you want to create&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_MethodName_Help=>T(\"AddInlineFunctionWorkflow.MethodName.Help\");\r\n///<summary>&quot;Namespace&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_MethodNamespace_Label=>T(\"AddInlineFunctionWorkflow.MethodNamespace.Label\");\r\n///<summary>&quot;The namespace of the method you want to create&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_MethodNamespace_Help=>T(\"AddInlineFunctionWorkflow.MethodNamespace.Help\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_MethodDescription_Label=>T(\"AddInlineFunctionWorkflow.MethodDescription.Label\");\r\n///<summary>&quot;A short description of the function&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_MethodDescription_Help=>T(\"AddInlineFunctionWorkflow.MethodDescription.Help\");\r\n///<summary>&quot;Template&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_InlineFunctionMethodTemplate_Label=>T(\"AddInlineFunctionWorkflow.InlineFunctionMethodTemplate.Label\");\r\n///<summary>&quot;Select the template that you want to use for the new method.&quot;</summary> \r\npublic static string AddInlineFunctionWorkflow_InlineFunctionMethodTemplate_Help=>T(\"AddInlineFunctionWorkflow.InlineFunctionMethodTemplate.Help\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_FieldGroup_Label=>T(\"EditInlineFunctionWorkflow.FieldGroup.Label\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_MethodName_Label=>T(\"EditInlineFunctionWorkflow.MethodName.Label\");\r\n///<summary>&quot;The name of the method you want to create&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_MethodName_Help=>T(\"EditInlineFunctionWorkflow.MethodName.Help\");\r\n///<summary>&quot;Namespace&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_MethodNamespace_Label=>T(\"EditInlineFunctionWorkflow.MethodNamespace.Label\");\r\n///<summary>&quot;The namespace of the method you want to create&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_MethodNamespace_Help=>T(\"EditInlineFunctionWorkflow.MethodNamespace.Help\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_MethodDescription_Label=>T(\"EditInlineFunctionWorkflow.MethodDescription.Label\");\r\n///<summary>&quot;A short description of the function&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_MethodDescription_Help=>T(\"EditInlineFunctionWorkflow.MethodDescription.Help\");\r\n///<summary>&quot;Debug&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_DebugFieldGroup_Label=>T(\"EditInlineFunctionWorkflow.DebugFieldGroup.Label\");\r\n///<summary>&quot;Page&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_DebugPage_Label=>T(\"EditInlineFunctionWorkflow.DebugPage.Label\");\r\n///<summary>&quot;When debugging, this page is used as current page&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_DebugPage_Help=>T(\"EditInlineFunctionWorkflow.DebugPage.Help\");\r\n///<summary>&quot;Data scope&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_DebugPageDataScope_Label=>T(\"EditInlineFunctionWorkflow.DebugPageDataScope.Label\");\r\n///<summary>&quot;When debugging, this is used as current data scope&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_DebugPageDataScope_Help=>T(\"EditInlineFunctionWorkflow.DebugPageDataScope.Help\");\r\n///<summary>&quot;Language&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_DebugActiveLocale_Label=>T(\"EditInlineFunctionWorkflow.DebugActiveLocale.Label\");\r\n///<summary>&quot;When debugging, this is used as the current language&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_DebugActiveLocale_Help=>T(\"EditInlineFunctionWorkflow.DebugActiveLocale.Help\");\r\n///<summary>&quot;Source&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_Code_Label=>T(\"EditInlineFunctionWorkflow.Code.Label\");\r\n///<summary>&quot;Assembly References&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_AssembliesFieldGroup_Label=>T(\"EditInlineFunctionWorkflow.AssembliesFieldGroup.Label\");\r\n///<summary>&quot;Preview&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_Preview_Label=>T(\"EditInlineFunctionWorkflow.Preview.Label\");\r\n///<summary>&quot;Input Parameters&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_ParameterFieldGroup_Label=>T(\"EditInlineFunctionWorkflow.ParameterFieldGroup.Label\");\r\n///<summary>&quot;Administrative&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_AdminitrativeScope_Label=>T(\"EditInlineFunctionWorkflow.AdminitrativeScope.Label\");\r\n///<summary>&quot;Public&quot;</summary> \r\npublic static string EditInlineFunctionWorkflow_PublicScope_Label=>T(\"EditInlineFunctionWorkflow.PublicScope.Label\");\r\n///<summary>&quot;Empty method&quot;</summary> \r\npublic static string InlineFunctionMethodTemplate_Clean=>T(\"InlineFunctionMethodTemplate.Clean\");\r\n///<summary>&quot;Method with parameters&quot;</summary> \r\npublic static string InlineFunctionMethodTemplate_WithParameters=>T(\"InlineFunctionMethodTemplate.WithParameters\");\r\n///<summary>&quot;Method using data connection&quot;</summary> \r\npublic static string InlineFunctionMethodTemplate_DataConnection=>T(\"InlineFunctionMethodTemplate.DataConnection\");\r\n///<summary>&quot;A public static class named {0} is missing from the code. This class should contain the function method.&quot;</summary> \r\npublic static string CSharpInlineFunction_OnMissingContainerType_Template=>T(\"CSharpInlineFunction.OnMissingContainerType\");\r\n///<summary>&quot;A public static class named {0} is missing from the code. This class should contain the function method.&quot;</summary> \r\npublic static string CSharpInlineFunction_OnMissingContainerType(object parameter0)=>string.Format(T(\"CSharpInlineFunction.OnMissingContainerType\"), parameter0);\r\n///<summary>&quot;The namespace in the code &apos;{0}&apos; does not match the given function namespace &apos;{1}&apos;.&quot;</summary> \r\npublic static string CSharpInlineFunction_OnNamespaceMismatch_Template=>T(\"CSharpInlineFunction.OnNamespaceMismatch\");\r\n///<summary>&quot;The namespace in the code &apos;{0}&apos; does not match the given function namespace &apos;{1}&apos;.&quot;</summary> \r\npublic static string CSharpInlineFunction_OnNamespaceMismatch(object parameter0,object parameter1)=>string.Format(T(\"CSharpInlineFunction.OnNamespaceMismatch\"), parameter0,parameter1);\r\n///<summary>&quot;The given function name &apos;{0}&apos; was not found or not public static in the class &apos;{1}&apos;.&quot;</summary> \r\npublic static string CSharpInlineFunction_OnMissionMethod_Template=>T(\"CSharpInlineFunction.OnMissionMethod\");\r\n///<summary>&quot;The given function name &apos;{0}&apos; was not found or not public static in the class &apos;{1}&apos;.&quot;</summary> \r\npublic static string CSharpInlineFunction_OnMissionMethod(object parameter0,object parameter1)=>string.Format(T(\"CSharpInlineFunction.OnMissionMethod\"), parameter0,parameter1);\r\n///<summary>&quot;The parameter &apos;{0}&apos; has not been added to &apos;Input Parameters&apos; - to call your function you need to add the parameter and give it either a test or default value.&quot;</summary> \r\npublic static string CSharpInlineFunction_MissingParameterDefinition_Template=>T(\"CSharpInlineFunction.MissingParameterDefinition\");\r\n///<summary>&quot;The parameter &apos;{0}&apos; has not been added to &apos;Input Parameters&apos; - to call your function you need to add the parameter and give it either a test or default value.&quot;</summary> \r\npublic static string CSharpInlineFunction_MissingParameterDefinition(object parameter0)=>string.Format(T(\"CSharpInlineFunction.MissingParameterDefinition\"), parameter0);\r\n///<summary>&quot;The parameter &apos;{0}&apos; is expecting test value of type &apos;{1}&apos;, got value of type &apos;{2}&apos;.&quot;</summary> \r\npublic static string CSharpInlineFunction_WrongParameterTestValueType_Template=>T(\"CSharpInlineFunction.WrongParameterTestValueType\");\r\n///<summary>&quot;The parameter &apos;{0}&apos; is expecting test value of type &apos;{1}&apos;, got value of type &apos;{2}&apos;.&quot;</summary> \r\npublic static string CSharpInlineFunction_WrongParameterTestValueType(object parameter0,object parameter1,object parameter2)=>string.Format(T(\"CSharpInlineFunction.WrongParameterTestValueType\"), parameter0,parameter1,parameter2);\r\n///<summary>&quot;The parameter &apos;{0}&apos; defined on &apos;Input Parameters&apos; must have a test or default value before your function can be evaluated.&quot;</summary> \r\npublic static string CSharpInlineFunction_MissingParameterTestOrDefaultValue_Template=>T(\"CSharpInlineFunction.MissingParameterTestOrDefaultValue\");\r\n///<summary>&quot;The parameter &apos;{0}&apos; defined on &apos;Input Parameters&apos; must have a test or default value before your function can be evaluated.&quot;</summary> \r\npublic static string CSharpInlineFunction_MissingParameterTestOrDefaultValue(object parameter0)=>string.Format(T(\"CSharpInlineFunction.MissingParameterTestOrDefaultValue\"), parameter0);\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_PackageElementProvider {\r\n///<summary>&quot;Packages&quot;</summary> \r\npublic static string RootFolderLabel=>T(\"RootFolderLabel\");\r\n///<summary>&quot;Explore and manage installed packages&quot;</summary> \r\npublic static string RootFolderToolTip=>T(\"RootFolderToolTip\");\r\n///<summary>&quot;Available Packages&quot;</summary> \r\npublic static string AvailablePackagesFolderLabel=>T(\"AvailablePackagesFolderLabel\");\r\n///<summary>&quot;Available packages&quot;</summary> \r\npublic static string AvailablePackagesFolderToolTip=>T(\"AvailablePackagesFolderToolTip\");\r\n///<summary>&quot;Installed Packages&quot;</summary> \r\npublic static string InstalledPackageFolderLabel=>T(\"InstalledPackageFolderLabel\");\r\n///<summary>&quot;Installed packages&quot;</summary> \r\npublic static string InstalledPackageFolderToolTip=>T(\"InstalledPackageFolderToolTip\");\r\n///<summary>&quot;Local Packages&quot;</summary> \r\npublic static string LocalPackagesFolderLabel=>T(\"LocalPackagesFolderLabel\");\r\n///<summary>&quot;Local packages&quot;</summary> \r\npublic static string LocalPackagesFolderToolTip=>T(\"LocalPackagesFolderToolTip\");\r\n///<summary>&quot;Package Sources&quot;</summary> \r\npublic static string PackageSourcesFolderLabel=>T(\"PackageSourcesFolderLabel\");\r\n///<summary>&quot;Package sources&quot;</summary> \r\npublic static string PackageSourcesFolderToolTip=>T(\"PackageSourcesFolderToolTip\");\r\n///<summary>&quot;Package Info&quot;</summary> \r\npublic static string ViewAvailableInformationLabel=>T(\"ViewAvailableInformationLabel\");\r\n///<summary>&quot;View package information&quot;</summary> \r\npublic static string ViewAvailableInformationToolTip=>T(\"ViewAvailableInformationToolTip\");\r\n///<summary>&quot;Install&quot;</summary> \r\npublic static string InstallLabel=>T(\"InstallLabel\");\r\n///<summary>&quot;Install this C1 Package on your system&quot;</summary> \r\npublic static string InstallToolTip=>T(\"InstallToolTip\");\r\n///<summary>&quot;Package Info&quot;</summary> \r\npublic static string ViewInstalledInformationLabel=>T(\"ViewInstalledInformationLabel\");\r\n///<summary>&quot;View package information&quot;</summary> \r\npublic static string ViewInstalledInformationToolTip=>T(\"ViewInstalledInformationToolTip\");\r\n///<summary>&quot;Install Local Package...&quot;</summary> \r\npublic static string InstallLocalPackageLabel=>T(\"InstallLocalPackageLabel\");\r\n///<summary>&quot;Install package from local file system&quot;</summary> \r\npublic static string InstallLocalPackageToolTip=>T(\"InstallLocalPackageToolTip\");\r\n///<summary>&quot;Add Package Source&quot;</summary> \r\npublic static string AddPackageSourceLabel=>T(\"AddPackageSourceLabel\");\r\n///<summary>&quot;Add package source&quot;</summary> \r\npublic static string AddPackageSourceToolTip=>T(\"AddPackageSourceToolTip\");\r\n///<summary>&quot;Delete Package Source&quot;</summary> \r\npublic static string DeletePackageSourceLabel=>T(\"DeletePackageSourceLabel\");\r\n///<summary>&quot;Delete package source&quot;</summary> \r\npublic static string DeletePackageSourceToolTip=>T(\"DeletePackageSourceToolTip\");\r\n///<summary>&quot;Clear Cache&quot;</summary> \r\npublic static string ClearServerCacheLabel=>T(\"ClearServerCacheLabel\");\r\n///<summary>&quot;Clear cache to get the newest packages&quot;</summary> \r\npublic static string ClearServerCacheToolTip=>T(\"ClearServerCacheToolTip\");\r\n///<summary>&quot;Package Info&quot;</summary> \r\npublic static string ViewAvailableInformation_FieldGroupLabel=>T(\"ViewAvailableInformation.FieldGroupLabel\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string ViewAvailableInformation_NameTextLabel=>T(\"ViewAvailableInformation.NameTextLabel\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string ViewAvailableInformation_DescriptionTextLabel=>T(\"ViewAvailableInformation.DescriptionTextLabel\");\r\n///<summary>&quot;Author&quot;</summary> \r\npublic static string ViewAvailableInformation_AuthorTextLabel=>T(\"ViewAvailableInformation.AuthorTextLabel\");\r\n///<summary>&quot;Free Trial Info&quot;</summary> \r\npublic static string ViewAvailableInformation_TrialInfoFieldGroupLabel=>T(\"ViewAvailableInformation.TrialInfoFieldGroupLabel\");\r\n///<summary>&quot;Trial information&quot;</summary> \r\npublic static string ViewAvailableInformation_TrialInformationLabel=>T(\"ViewAvailableInformation.TrialInformationLabel\");\r\n///<summary>&quot;This is a commercial package, available for free in the trial period. When the trial period has expired functionality may be degraded, unless you choose to purchase a license.&quot;</summary> \r\npublic static string ViewAvailableInformation_TrialInformationText=>T(\"ViewAvailableInformation.TrialInformationText\");\r\n///<summary>&quot;Free trial period (days)&quot;</summary> \r\npublic static string ViewAvailableInformation_TrialDaysLabel=>T(\"ViewAvailableInformation.TrialDaysLabel\");\r\n///<summary>&quot;License Information&quot;</summary> \r\npublic static string ViewAvailableInformation_LicenseInformationGroupLabel=>T(\"ViewAvailableInformation.LicenseInformationGroupLabel\");\r\n///<summary>&quot;Subscription Name&quot;</summary> \r\npublic static string ViewAvailableInformation_SubscriptionNameLabel=>T(\"ViewAvailableInformation.SubscriptionNameLabel\");\r\n///<summary>&quot;License Expiration Date&quot;</summary> \r\npublic static string ViewAvailableInformation_LicenseExpirationDateLabel=>T(\"ViewAvailableInformation.LicenseExpirationDateLabel\");\r\n///<summary>&quot;Installation Info&quot;</summary> \r\npublic static string ViewAvailableInformation_InstallationInfoFieldGroupLabel=>T(\"ViewAvailableInformation.InstallationInfoFieldGroupLabel\");\r\n///<summary>&quot;Version&quot;</summary> \r\npublic static string ViewAvailableInformation_VersionTextLabel=>T(\"ViewAvailableInformation.VersionTextLabel\");\r\n///<summary>&quot;Technical Description&quot;</summary> \r\npublic static string ViewAvailableInformation_TechicalDescriptionTextLabel=>T(\"ViewAvailableInformation.TechicalDescriptionTextLabel\");\r\n///<summary>&quot;Source&quot;</summary> \r\npublic static string ViewAvailableInformation_PackageSourceTextLabel=>T(\"ViewAvailableInformation.PackageSourceTextLabel\");\r\n///<summary>&quot;Price&quot;</summary> \r\npublic static string ViewAvailableInformation_PriceTextLabel=>T(\"ViewAvailableInformation.PriceTextLabel\");\r\n///<summary>&quot;Subscriptions that include this package&quot;</summary> \r\npublic static string ViewAvailableInformation_SubscriptionListLabel=>T(\"ViewAvailableInformation.SubscriptionListLabel\");\r\n///<summary>&quot;Install&quot;</summary> \r\npublic static string ViewAvailableInformation_Toolbar_InstallLabel=>T(\"ViewAvailableInformation.Toolbar.InstallLabel\");\r\n///<summary>&quot;Read more&quot;</summary> \r\npublic static string ViewAvailableInformation_Toolbar_ReadMoreLabel=>T(\"ViewAvailableInformation.Toolbar.ReadMoreLabel\");\r\n///<summary>&quot;Already Installed&quot;</summary> \r\npublic static string ViewAvailableInformation_ShowError_MessageTitle=>T(\"ViewAvailableInformation.ShowError.MessageTitle\");\r\n///<summary>&quot;The package is already installed, cannot install the selected package.&quot;</summary> \r\npublic static string ViewAvailableInformation_ShowError_MessageMessage=>T(\"ViewAvailableInformation.ShowError.MessageMessage\");\r\n///<summary>&quot;Package server did not respond&quot;</summary> \r\npublic static string ViewAvailableInformation_ShowServerError_MessageTitle=>T(\"ViewAvailableInformation.ShowServerError.MessageTitle\");\r\n///<summary>&quot;The package server did not respond, try again or contact the system administrator&quot;</summary> \r\npublic static string ViewAvailableInformation_ShowServerError_MessageMessage=>T(\"ViewAvailableInformation.ShowServerError.MessageMessage\");\r\n///<summary>&quot;Package Info&quot;</summary> \r\npublic static string ViewInstalledInformation_FieldGroupLabel=>T(\"ViewInstalledInformation.FieldGroupLabel\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string ViewInstalledInformation_NameTextLabel=>T(\"ViewInstalledInformation.NameTextLabel\");\r\n///<summary>&quot;Installation date&quot;</summary> \r\npublic static string ViewInstalledInformation_DateTextLabel=>T(\"ViewInstalledInformation.DateTextLabel\");\r\n///<summary>&quot;Installed by&quot;</summary> \r\npublic static string ViewInstalledInformation_UserTextLabel=>T(\"ViewInstalledInformation.UserTextLabel\");\r\n///<summary>&quot;Author&quot;</summary> \r\npublic static string ViewInstalledInformation_AuthorTextLabel=>T(\"ViewInstalledInformation.AuthorTextLabel\");\r\n///<summary>&quot;Version&quot;</summary> \r\npublic static string ViewInstalledInformation_VersionTextLabel=>T(\"ViewInstalledInformation.VersionTextLabel\");\r\n///<summary>&quot;Trial info&quot;</summary> \r\npublic static string ViewInstalledInformation_TrialInfoFieldGroupLabel=>T(\"ViewInstalledInformation.TrialInfoFieldGroupLabel\");\r\n///<summary>&quot;Trial information&quot;</summary> \r\npublic static string ViewInstalledInformation_TrialInformationLabel=>T(\"ViewInstalledInformation.TrialInformationLabel\");\r\n///<summary>&quot;This is a commercial package, available for free in the trial period. When the trial period has expired functionality may be degraded, unless you choose to purchase a license.&quot;</summary> \r\npublic static string ViewInstalledInformation_TrialInformationText=>T(\"ViewInstalledInformation.TrialInformationText\");\r\n///<summary>&quot;Trial expiration date&quot;</summary> \r\npublic static string ViewInstalledInformation_TrialExpireLabel=>T(\"ViewInstalledInformation.TrialExpireLabel\");\r\n///<summary>&quot;License Information&quot;</summary> \r\npublic static string ViewInstalledInformation_LicenseInformationGroupLabel=>T(\"ViewInstalledInformation.LicenseInformationGroupLabel\");\r\n///<summary>&quot;Subscription Name&quot;</summary> \r\npublic static string ViewInstalledInformation_SubscriptionNameLabel=>T(\"ViewInstalledInformation.SubscriptionNameLabel\");\r\n///<summary>&quot;License Expiration Date&quot;</summary> \r\npublic static string ViewInstalledInformation_LicenseExpirationDateLabel=>T(\"ViewInstalledInformation.LicenseExpirationDateLabel\");\r\n///<summary>&quot;Uninstall&quot;</summary> \r\npublic static string ViewInstalledInformation_Toolbar_UninstallLabel=>T(\"ViewInstalledInformation.Toolbar.UninstallLabel\");\r\n///<summary>&quot;Purchase this!&quot;</summary> \r\npublic static string ViewInstalledInformation_Toolbar_PurchaseLabel=>T(\"ViewInstalledInformation.Toolbar.PurchaseLabel\");\r\n///<summary>&quot;Already Uninstalled&quot;</summary> \r\npublic static string ViewInstalledInformation_ShowError_MessageTitle=>T(\"ViewInstalledInformation.ShowError.MessageTitle\");\r\n///<summary>&quot;The package is already uninstalled, cannot uninstall the selected package.&quot;</summary> \r\npublic static string ViewInstalledInformation_ShowError_MessageMessage=>T(\"ViewInstalledInformation.ShowError.MessageMessage\");\r\n///<summary>&quot;Install Package&quot;</summary> \r\npublic static string InstallRemotePackage_Step1_LayoutLabel=>T(\"InstallRemotePackage.Step1.LayoutLabel\");\r\n///<summary>&quot;This is a trial/payment package&quot;</summary> \r\npublic static string InstallRemotePackage_Step1_HeadingTitle=>T(\"InstallRemotePackage.Step1.HeadingTitle\");\r\n///<summary>&quot;This package is subject to payment - please examine the EULA on the next screen for details about trial period and payment terms.&quot;</summary> \r\npublic static string InstallRemotePackage_Step1_HeadingDescription=>T(\"InstallRemotePackage.Step1.HeadingDescription\");\r\n///<summary>&quot;Install Package&quot;</summary> \r\npublic static string InstallRemotePackage_Step2_LayoutLabel=>T(\"InstallRemotePackage.Step2.LayoutLabel\");\r\n///<summary>&quot;License agreement&quot;</summary> \r\npublic static string InstallRemotePackage_Step2_HeadingTitle=>T(\"InstallRemotePackage.Step2.HeadingTitle\");\r\n///<summary>&quot;If you accept the terms of the agreement, click the check box below. You must accept the agreement to install.&quot;</summary> \r\npublic static string InstallRemotePackage_Step2_HeadingDescription=>T(\"InstallRemotePackage.Step2.HeadingDescription\");\r\n///<summary>&quot;I accept the license agreement&quot;</summary> \r\npublic static string InstallRemotePackage_Step2_IAcceptItemLabel=>T(\"InstallRemotePackage.Step2.IAcceptItemLabel\");\r\n///<summary>&quot;You must accept the terms of the license agreement before you can proceed.&quot;</summary> \r\npublic static string InstallRemotePackage_Step2_AcceptMissing=>T(\"InstallRemotePackage.Step2.AcceptMissing\");\r\n///<summary>&quot;Install Package&quot;</summary> \r\npublic static string InstallRemotePackage_Step3_LayoutLabel=>T(\"InstallRemotePackage.Step3.LayoutLabel\");\r\n///<summary>&quot;Download and validate package&quot;</summary> \r\npublic static string InstallRemotePackage_Step3_HeadingTitle=>T(\"InstallRemotePackage.Step3.HeadingTitle\");\r\n///<summary>&quot;The package will be downloaded and validated. Please note that this may take several minutes. Click Next to continue.&quot;</summary> \r\npublic static string InstallRemotePackage_Step3_HeadingDescription=>T(\"InstallRemotePackage.Step3.HeadingDescription\");\r\n///<summary>&quot;Install Local Package&quot;</summary> \r\npublic static string InstallRemotePackage_Step4_LayoutLabel=>T(\"InstallRemotePackage.Step4.LayoutLabel\");\r\n///<summary>&quot;Ready to install&quot;</summary> \r\npublic static string InstallRemotePackage_Step4_HeadingTitle=>T(\"InstallRemotePackage.Step4.HeadingTitle\");\r\n///<summary>&quot;Ready to install the package. Please note that the installation may take several minutes. Click Next to continue.&quot;</summary> \r\npublic static string InstallRemotePackage_Step4_HeadingDescription=>T(\"InstallRemotePackage.Step4.HeadingDescription\");\r\n///<summary>&quot;Ready to install&quot;</summary> \r\npublic static string InstallRemotePackage_Step4_NonUninstallableHeadingTitle=>T(\"InstallRemotePackage.Step4.NonUninstallableHeadingTitle\");\r\n///<summary>&quot;Ready to install the package. Please note that the installation may take several minutes. Also note that this package can not be uninstalled. Click Next to continue.&quot;</summary> \r\npublic static string InstallRemotePackage_Step4_NonUninstallableHeadingDescription=>T(\"InstallRemotePackage.Step4.NonUninstallableHeadingDescription\");\r\n///<summary>&quot;Package Installed&quot;</summary> \r\npublic static string InstallRemotePackage_Step5_LayoutLabel=>T(\"InstallRemotePackage.Step5.LayoutLabel\");\r\n///<summary>&quot;Package installed successfully&quot;</summary> \r\npublic static string InstallRemotePackage_Step5_HeadingTitle=>T(\"InstallRemotePackage.Step5.HeadingTitle\");\r\n///<summary>&quot;Package installed successfully.&quot;</summary> \r\npublic static string InstallRemotePackage_Step5_HeadingDescription=>T(\"InstallRemotePackage.Step5.HeadingDescription\");\r\n///<summary>&quot;Package installation failed&quot;</summary> \r\npublic static string InstallRemotePackage_ShowError_LayoutLabel=>T(\"InstallRemotePackage.ShowError.LayoutLabel\");\r\n///<summary>&quot;Package Installation Failed&quot;</summary> \r\npublic static string InstallRemotePackage_ShowError_InfoTableCaption=>T(\"InstallRemotePackage.ShowError.InfoTableCaption\");\r\n///<summary>&quot;Message&quot;</summary> \r\npublic static string InstallRemotePackage_ShowError_MessageTitle=>T(\"InstallRemotePackage.ShowError.MessageTitle\");\r\n///<summary>&quot;The package Did Not Validate&quot;</summary> \r\npublic static string InstallRemotePackage_ShowWarning_LayoutLabel=>T(\"InstallRemotePackage.ShowWarning.LayoutLabel\");\r\n///<summary>&quot;The package did not validate&quot;</summary> \r\npublic static string InstallRemotePackage_ShowWarning_InfoTableCaption=>T(\"InstallRemotePackage.ShowWarning.InfoTableCaption\");\r\n///<summary>&quot;Install Local Package&quot;</summary> \r\npublic static string InstallLocalPackage_Step1_LayoutLabel=>T(\"InstallLocalPackage.Step1.LayoutLabel\");\r\n///<summary>&quot;Package file&quot;</summary> \r\npublic static string InstallLocalPackage_Step1_FileUploadLabel=>T(\"InstallLocalPackage.Step1.FileUploadLabel\");\r\n///<summary>&quot;Browse to and select the local package file&quot;</summary> \r\npublic static string InstallLocalPackage_Step1_FileUploadHelp=>T(\"InstallLocalPackage.Step1.FileUploadHelp\");\r\n///<summary>&quot;Install Local Package&quot;</summary> \r\npublic static string InstallLocalPackage_Step2_LayoutLabel=>T(\"InstallLocalPackage.Step2.LayoutLabel\");\r\n///<summary>&quot;Ready to install&quot;</summary> \r\npublic static string InstallLocalPackage_Step2_HeadingTitle=>T(\"InstallLocalPackage.Step2.HeadingTitle\");\r\n///<summary>&quot;Ready to install the package. Please note that the installation may take several minutes. Click Next to continue.&quot;</summary> \r\npublic static string InstallLocalPackage_Step2_HeadingDescription=>T(\"InstallLocalPackage.Step2.HeadingDescription\");\r\n///<summary>&quot;Package Installed&quot;</summary> \r\npublic static string InstallLocalPackage_Step3_LayoutLabel=>T(\"InstallLocalPackage.Step3.LayoutLabel\");\r\n///<summary>&quot;Package installed successfully&quot;</summary> \r\npublic static string InstallLocalPackage_Step3_HeadingTitle=>T(\"InstallLocalPackage.Step3.HeadingTitle\");\r\n///<summary>&quot;Package installed successfully.&quot;</summary> \r\npublic static string InstallLocalPackage_Step3_HeadingDescription=>T(\"InstallLocalPackage.Step3.HeadingDescription\");\r\n///<summary>&quot;Package Installation Failed&quot;</summary> \r\npublic static string InstallLocalPackage_ShowError_LayoutLabel=>T(\"InstallLocalPackage.ShowError.LayoutLabel\");\r\n///<summary>&quot;Package installation failed&quot;</summary> \r\npublic static string InstallLocalPackage_ShowError_InfoTableCaption=>T(\"InstallLocalPackage.ShowError.InfoTableCaption\");\r\n///<summary>&quot;Message&quot;</summary> \r\npublic static string InstallLocalPackage_ShowError_MessageTitle=>T(\"InstallLocalPackage.ShowError.MessageTitle\");\r\n///<summary>&quot;The package Did Not Validate&quot;</summary> \r\npublic static string InstallLocalPackage_ShowWarning_LayoutLabel=>T(\"InstallLocalPackage.ShowWarning.LayoutLabel\");\r\n///<summary>&quot;The package did not validate&quot;</summary> \r\npublic static string InstallLocalPackage_ShowWarning_InfoTableCaption=>T(\"InstallLocalPackage.ShowWarning.InfoTableCaption\");\r\n///<summary>&quot;Uninstall Package&quot;</summary> \r\npublic static string UninstallRemotePackage_Step1_LayoutLabel=>T(\"UninstallRemotePackage.Step1.LayoutLabel\");\r\n///<summary>&quot;Ready to check uninstallation process&quot;</summary> \r\npublic static string UninstallRemotePackage_Step1_HeadingTitle=>T(\"UninstallRemotePackage.Step1.HeadingTitle\");\r\n///<summary>&quot;Ready to check the uninstall process of the package. Click Next to continue.&quot;</summary> \r\npublic static string UninstallRemotePackage_Step1_HeadingDescription=>T(\"UninstallRemotePackage.Step1.HeadingDescription\");\r\n///<summary>&quot;Uninstall Package&quot;</summary> \r\npublic static string UninstallRemotePackage_Step2_LayoutLabel=>T(\"UninstallRemotePackage.Step2.LayoutLabel\");\r\n///<summary>&quot;Ready to uninstall&quot;</summary> \r\npublic static string UninstallRemotePackage_Step2_HeadingTitle=>T(\"UninstallRemotePackage.Step2.HeadingTitle\");\r\n///<summary>&quot;Ready to uninstall the package. Please note that the installation may take several minutes. Click Next to continue.&quot;</summary> \r\npublic static string UninstallRemotePackage_Step2_HeadingDescription=>T(\"UninstallRemotePackage.Step2.HeadingDescription\");\r\n///<summary>&quot;Package Uninstalled&quot;</summary> \r\npublic static string UninstallRemotePackage_Step3_LayoutLabel=>T(\"UninstallRemotePackage.Step3.LayoutLabel\");\r\n///<summary>&quot;Package uninstalled successfully&quot;</summary> \r\npublic static string UninstallRemotePackage_Step3_HeadingTitle=>T(\"UninstallRemotePackage.Step3.HeadingTitle\");\r\n///<summary>&quot;Package uninstalled successfully.&quot;</summary> \r\npublic static string UninstallRemotePackage_Step3_HeadingDescription=>T(\"UninstallRemotePackage.Step3.HeadingDescription\");\r\n///<summary>&quot;Package Uninstallation Failed&quot;</summary> \r\npublic static string UninstallRemotePackage_ShowError_LayoutLabel=>T(\"UninstallRemotePackage.ShowError.LayoutLabel\");\r\n///<summary>&quot;Package uninstallation failed&quot;</summary> \r\npublic static string UninstallRemotePackage_ShowError_InfoTableCaption=>T(\"UninstallRemotePackage.ShowError.InfoTableCaption\");\r\n///<summary>&quot;Message&quot;</summary> \r\npublic static string UninstallRemotePackage_ShowError_MessageTitle=>T(\"UninstallRemotePackage.ShowError.MessageTitle\");\r\n///<summary>&quot;Uninstall Package&quot;</summary> \r\npublic static string UninstallRemotePackage_ShowUnregistre_LayoutLabel=>T(\"UninstallRemotePackage.ShowUnregistre.LayoutLabel\");\r\n///<summary>&quot;Registration of uninstallation failed&quot;</summary> \r\npublic static string UninstallRemotePackage_ShowUnregistre_HeadingTitle=>T(\"UninstallRemotePackage.ShowUnregistre.HeadingTitle\");\r\n///<summary>&quot;The registration of uninstallation failed. Contact the package vendor for manual unregistration.&quot;</summary> \r\npublic static string UninstallRemotePackage_ShowUnregistre_HeadingDescription=>T(\"UninstallRemotePackage.ShowUnregistre.HeadingDescription\");\r\n///<summary>&quot;Uninstall Local Package&quot;</summary> \r\npublic static string UninstallLocalPackage_Step1_LayoutLabel=>T(\"UninstallLocalPackage.Step1.LayoutLabel\");\r\n///<summary>&quot;Ready to check uninstallation process&quot;</summary> \r\npublic static string UninstallLocalPackage_Step1_HeadingTitle=>T(\"UninstallLocalPackage.Step1.HeadingTitle\");\r\n///<summary>&quot;Ready to check the uninstall process of the package. Click Next to continue.&quot;</summary> \r\npublic static string UninstallLocalPackage_Step1_HeadingDescription=>T(\"UninstallLocalPackage.Step1.HeadingDescription\");\r\n///<summary>&quot;Uninstall Local Package&quot;</summary> \r\npublic static string UninstallLocalPackage_Step2_LayoutLabel=>T(\"UninstallLocalPackage.Step2.LayoutLabel\");\r\n///<summary>&quot;Ready to uninstall&quot;</summary> \r\npublic static string UninstallLocalPackage_Step2_HeadingTitle=>T(\"UninstallLocalPackage.Step2.HeadingTitle\");\r\n///<summary>&quot;Ready to uninstall the package. Please note that the installation may take several minutes. Click Next to continue.&quot;</summary> \r\npublic static string UninstallLocalPackage_Step2_HeadingDescription=>T(\"UninstallLocalPackage.Step2.HeadingDescription\");\r\n///<summary>&quot;Package Uninstalled&quot;</summary> \r\npublic static string UninstallLocalPackage_Step3_LayoutLabel=>T(\"UninstallLocalPackage.Step3.LayoutLabel\");\r\n///<summary>&quot;Package uninstalled successfully&quot;</summary> \r\npublic static string UninstallLocalPackage_Step3_HeadingTitle=>T(\"UninstallLocalPackage.Step3.HeadingTitle\");\r\n///<summary>&quot;Package uninstalled successfully.&quot;</summary> \r\npublic static string UninstallLocalPackage_Step3_HeadingDescription=>T(\"UninstallLocalPackage.Step3.HeadingDescription\");\r\n///<summary>&quot;Package Uninstallation Failed&quot;</summary> \r\npublic static string UninstallLocalPackage_ShowError_LayoutLabel=>T(\"UninstallLocalPackage.ShowError.LayoutLabel\");\r\n///<summary>&quot;Package uninstallation failed&quot;</summary> \r\npublic static string UninstallLocalPackage_ShowError_InfoTableCaption=>T(\"UninstallLocalPackage.ShowError.InfoTableCaption\");\r\n///<summary>&quot;Message&quot;</summary> \r\npublic static string UninstallLocalPackage_ShowError_MessageTitle=>T(\"UninstallLocalPackage.ShowError.MessageTitle\");\r\n///<summary>&quot;New Package Source&quot;</summary> \r\npublic static string AddPackageSource_Step1_LayoutLabel=>T(\"AddPackageSource.Step1.LayoutLabel\");\r\n///<summary>&quot;Package source data&quot;</summary> \r\npublic static string AddPackageSource_Step1_FieldGroupLabel=>T(\"AddPackageSource.Step1.FieldGroupLabel\");\r\n///<summary>&quot;Package web service URL&quot;</summary> \r\npublic static string AddPackageSource_Step1_UrlLabel=>T(\"AddPackageSource.Step1.UrlLabel\");\r\n///<summary>&quot;Packages can be hosted on remote servers. The package web service URL will be validated in the next step.&quot;</summary> \r\npublic static string AddPackageSource_Step1_UrlHelp=>T(\"AddPackageSource.Step1.UrlHelp\");\r\n///<summary>&quot;The entered text was not a valid URL&quot;</summary> \r\npublic static string AddPackageSource_Step1_UrlNotValid=>T(\"AddPackageSource.Step1.UrlNotValid\");\r\n///<summary>&quot;The server is not a C1 CMS package server&quot;</summary> \r\npublic static string AddPackageSource_Step1_UrlNonPackageServer=>T(\"AddPackageSource.Step1.UrlNonPackageServer\");\r\n///<summary>&quot;Add Package Server Source&quot;</summary> \r\npublic static string AddPackageSource_Step2_LayoutLabel=>T(\"AddPackageSource.Step2.LayoutLabel\");\r\n///<summary>&quot;Server URL is valid&quot;</summary> \r\npublic static string AddPackageSource_Step2_HeadingTitle=>T(\"AddPackageSource.Step2.HeadingTitle\");\r\n///<summary>&quot;Note that the HTTP protocol is used on this connection. This implies that all information will be send unencrypted. Click Finish to add the source.&quot;</summary> \r\npublic static string AddPackageSource_Step2_HeadingNoHttpsDescription=>T(\"AddPackageSource.Step2.HeadingNoHttpsDescription\");\r\n///<summary>&quot;Click Finish to add the source.&quot;</summary> \r\npublic static string AddPackageSource_Step2_HeadingWithHttpsDescription=>T(\"AddPackageSource.Step2.HeadingWithHttpsDescription\");\r\n///<summary>&quot;Delete Confirmation&quot;</summary> \r\npublic static string DeletePackageSource_Step1_LayoutLabel=>T(\"DeletePackageSource.Step1.LayoutLabel\");\r\n///<summary>&quot;Delete the selected server source&quot;</summary> \r\npublic static string DeletePackageSource_Step1_Text=>T(\"DeletePackageSource.Step1.Text\");\r\n///<summary>&quot;Trial Period Has Expired&quot;</summary> \r\npublic static string ConfirmLicense_ExpiredTitle=>T(\"ConfirmLicense.ExpiredTitle\");\r\n///<summary>&quot;The trial period of the package has expired. You need to obtain a valid license.&quot;</summary> \r\npublic static string ConfirmLicense_ExpiredMessage=>T(\"ConfirmLicense.ExpiredMessage\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_PageElementProvider {\r\n///<summary>&quot;Add New Page&quot;</summary> \r\npublic static string AddNewPageStep1_DialogLabel=>T(\"AddNewPageStep1.DialogLabel\");\r\n///<summary>&quot;Add New {0}&quot;</summary> \r\npublic static string AddNewPageStep1_DialogLabelFormat_Template=>T(\"AddNewPageStep1.DialogLabelFormat\");\r\n///<summary>&quot;Add New {0}&quot;</summary> \r\npublic static string AddNewPageStep1_DialogLabelFormat(object parameter0)=>string.Format(T(\"AddNewPageStep1.DialogLabelFormat\"), parameter0);\r\n///<summary>&quot;General settings&quot;</summary> \r\npublic static string GeneralSettings_FieldGroupLabel=>T(\"GeneralSettings.FieldGroupLabel\");\r\n///<summary>&quot;Publication settings&quot;</summary> \r\npublic static string PublicationSettings_FieldGroupLabel=>T(\"PublicationSettings.FieldGroupLabel\");\r\n///<summary>&quot;Advanced settings&quot;</summary> \r\npublic static string AdvancedSettings_FieldGroupLabel=>T(\"AdvancedSettings.FieldGroupLabel\");\r\n///<summary>&quot;Page title&quot;</summary> \r\npublic static string AddNewPageStep1_LabelTitle=>T(\"AddNewPageStep1.LabelTitle\");\r\n///<summary>&quot;The entry specified in this field is shown in the browser window title bar. The field is used by search engines and sitemaps&quot;</summary> \r\npublic static string AddNewPageStep1_LabelTitleHelp=>T(\"AddNewPageStep1.LabelTitleHelp\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string AddNewPageStep1_LabelAbstract=>T(\"AddNewPageStep1.LabelAbstract\");\r\n///<summary>&quot;Use this field for at short description of the page&quot;</summary> \r\npublic static string AddNewPageStep1_LabelAbstractHelp=>T(\"AddNewPageStep1.LabelAbstractHelp\");\r\n///<summary>&quot;Page type&quot;</summary> \r\npublic static string AddNewPageStep1_LabelTemplate=>T(\"AddNewPageStep1.LabelTemplate\");\r\n///<summary>&quot;The page type selection influences the behavior and features of your page, like &apos;a normal page&apos; or &apos;a blog&apos;. The options available depend on features installed.&quot;</summary> \r\npublic static string AddNewPageStep1_HelpTemplate=>T(\"AddNewPageStep1.HelpTemplate\");\r\n///<summary>&quot;Position&quot;</summary> \r\npublic static string AddNewPageStep1_LabelPosition=>T(\"AddNewPageStep1.LabelPosition\");\r\n///<summary>&quot;Select where in the content tree you want the page to be placed.&quot;</summary> \r\npublic static string AddNewPageStep1_HelpPosition=>T(\"AddNewPageStep1.HelpPosition\");\r\n///<summary>&quot;Insert at the top&quot;</summary> \r\npublic static string AddNewPageStep1_LabelAddToTop=>T(\"AddNewPageStep1.LabelAddToTop\");\r\n///<summary>&quot;Insert at the bottom&quot;</summary> \r\npublic static string AddNewPageStep1_LabelAddToBottom=>T(\"AddNewPageStep1.LabelAddToBottom\");\r\n///<summary>&quot;Insert alphabetically&quot;</summary> \r\npublic static string AddNewPageStep1_LabelAddAlphabetic=>T(\"AddNewPageStep1.LabelAddAlphabetic\");\r\n///<summary>&quot;Select position...&quot;</summary> \r\npublic static string AddNewPageStep1_LabelAddBelowOtherPage=>T(\"AddNewPageStep1.LabelAddBelowOtherPage\");\r\n///<summary>&quot;URL title&quot;</summary> \r\npublic static string AddNewPageStep2_LabelUrlTitle=>T(\"AddNewPageStep2.LabelUrlTitle\");\r\n///<summary>&quot;The entry specified in this field is shown in the browser address bar. The field is used by search engines&quot;</summary> \r\npublic static string AddNewPageStep2_HelpUrlTitle=>T(\"AddNewPageStep2.HelpUrlTitle\");\r\n///<summary>&quot;Menu title&quot;</summary> \r\npublic static string AddNewPageStep2_LabelMenuTitle=>T(\"AddNewPageStep2.LabelMenuTitle\");\r\n///<summary>&quot;The entry specified in this field can be used in the navigation on the website&quot;</summary> \r\npublic static string AddNewPageStep2_HelpMenuTitle=>T(\"AddNewPageStep2.HelpMenuTitle\");\r\n///<summary>&quot;Select detailed page position&quot;</summary> \r\npublic static string AddNewPageStep2_LabelPositionSelectorPanel=>T(\"AddNewPageStep2.LabelPositionSelectorPanel\");\r\n///<summary>&quot;Position below&quot;</summary> \r\npublic static string AddNewPageStep2_LabelPositionSelector=>T(\"AddNewPageStep2.LabelPositionSelector\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewPageStep2_HelpPositionSelector=>T(\"AddNewPageStep2.HelpPositionSelector\");\r\n///<summary>&quot;The specified title is too long. Make it shorter and try again&quot;</summary> \r\npublic static string AddNewPageStep1_TitleTooLong=>T(\"AddNewPageStep1.TitleTooLong\");\r\n///<summary>&quot;The specified menu title is too long. Make it shorter and try again&quot;</summary> \r\npublic static string AddNewPageStep1_MenuTitleTooLong=>T(\"AddNewPageStep1.MenuTitleTooLong\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string EditPage_LabelPaneSettings=>T(\"EditPage.LabelPaneSettings\");\r\n///<summary>&quot;Status&quot;</summary> \r\npublic static string EditPage_LabelPublicationState=>T(\"EditPage.LabelPublicationState\");\r\n///<summary>&quot;Send the page to another status&quot;</summary> \r\npublic static string EditPage_HelpPublicationState=>T(\"EditPage.HelpPublicationState\");\r\n///<summary>&quot;Page title&quot;</summary> \r\npublic static string EditPage_LabelPageTitle=>T(\"EditPage.LabelPageTitle\");\r\n///<summary>&quot;The entry specified in this field is shown in the browser window title bar. The field is used by search engines and sitemaps&quot;</summary> \r\npublic static string EditPage_LabelPageTitleHelp=>T(\"EditPage.LabelPageTitleHelp\");\r\n///<summary>&quot;Menu title&quot;</summary> \r\npublic static string EditPage_LabelMenuTitle=>T(\"EditPage.LabelMenuTitle\");\r\n///<summary>&quot;The entry specified in this field can be used in the navigation on the website&quot;</summary> \r\npublic static string EditPage_HelpMenuTitle=>T(\"EditPage.HelpMenuTitle\");\r\n///<summary>&quot;URL title&quot;</summary> \r\npublic static string EditPage_LabelUrlTitle=>T(\"EditPage.LabelUrlTitle\");\r\n///<summary>&quot;URL title was rewritten&quot;</summary> \r\npublic static string EditPage_UrlTitleFormattedTitle=>T(\"EditPage.UrlTitleFormattedTitle\");\r\n///<summary>&quot;According to the current URL replacement rules, URL title was changed to &apos;{0}&apos;&quot;</summary> \r\npublic static string EditPage_UrlTitleFormattedMessage_Template=>T(\"EditPage.UrlTitleFormattedMessage\");\r\n///<summary>&quot;According to the current URL replacement rules, URL title was changed to &apos;{0}&apos;&quot;</summary> \r\npublic static string EditPage_UrlTitleFormattedMessage(object parameter0)=>string.Format(T(\"EditPage.UrlTitleFormattedMessage\"), parameter0);\r\n///<summary>&quot;The entry specified in this field is shown in the browser address bar as a part of the URL address. The field is used by search engines&quot;</summary> \r\npublic static string EditPage_HelpUrlTitle=>T(\"EditPage.HelpUrlTitle\");\r\n///<summary>&quot;Friendly URL&quot;</summary> \r\npublic static string EditPage_LabelFriendlyUrl=>T(\"EditPage.LabelFriendlyUrl\");\r\n///<summary>&quot;The entry specified in this field is a shorter version of the actual page URL and redirects to it, when entered in the browser address bar. Note that some servers may have to be configured to support this feature.&quot;</summary> \r\npublic static string EditPage_HelpFriendlyUrl=>T(\"EditPage.HelpFriendlyUrl\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string EditPage_LabelAbstract=>T(\"EditPage.LabelAbstract\");\r\n///<summary>&quot;Use this field for a short description of the page&quot;</summary> \r\npublic static string EditPage_LabelAbstractHelp=>T(\"EditPage.LabelAbstractHelp\");\r\n///<summary>&quot;Content&quot;</summary> \r\npublic static string EditPage_LabelContent=>T(\"EditPage.LabelContent\");\r\n///<summary>&quot;Preview&quot;</summary> \r\npublic static string EditPage_LabelPreview=>T(\"EditPage.LabelPreview\");\r\n///<summary>&quot;Page type&quot;</summary> \r\npublic static string EditPage_PageTypeSelectorLabel=>T(\"EditPage.PageTypeSelectorLabel\");\r\n///<summary>&quot;The page type selection defines the role of the page, like &apos;a normal page&apos; or &apos;a blog&apos;. The options available depend on features installed.&quot;</summary> \r\npublic static string EditPage_PageTypeSelectorHelp=>T(\"EditPage.PageTypeSelectorHelp\");\r\n///<summary>&quot;{0} characters maximum&quot;</summary> \r\npublic static string EditPage_MaxLength_Template=>T(\"EditPage.MaxLength\");\r\n///<summary>&quot;{0} characters maximum&quot;</summary> \r\npublic static string EditPage_MaxLength(object parameter0)=>string.Format(T(\"EditPage.MaxLength\"), parameter0);\r\n///<summary>&quot;Delete page?&quot;</summary> \r\npublic static string DeletePage_LabelFieldGroup=>T(\"DeletePage.LabelFieldGroup\");\r\n///<summary>&quot;Delete page and all subpages&quot;</summary> \r\npublic static string DeletePageStep1_Title=>T(\"DeletePageStep1.Title\");\r\n///<summary>&quot;All subpages will also be deleted. Continue?&quot;</summary> \r\npublic static string DeletePageStep1_Description=>T(\"DeletePageStep1.Description\");\r\n///<summary>&quot;Delete page &apos;{0}&apos;?&quot;</summary> \r\npublic static string DeletePageStep2_Text_Template=>T(\"DeletePageStep2.Text\");\r\n///<summary>&quot;Delete page &apos;{0}&apos;?&quot;</summary> \r\npublic static string DeletePageStep2_Text(object parameter0)=>string.Format(T(\"DeletePageStep2.Text\"), parameter0);\r\n///<summary>&quot;Another page is using the specified URL title. URL titles must be unique among pages with the same parent.&quot;</summary> \r\npublic static string UrlTitleNotUniqueError=>T(\"UrlTitleNotUniqueError\");\r\n///<summary>&quot;The specified URL title contains invalid characters. Since this field is used to build the web address for the page, certain special characters (like question mark, slash and dot) are not allowed. You can use letters, digits and dash.&quot;</summary> \r\npublic static string UrlTitleNotValidError=>T(\"UrlTitleNotValidError\");\r\n///<summary>&quot;The specified URL title is too long. Make it shorter and try again&quot;</summary> \r\npublic static string UrlTitleTooLong=>T(\"UrlTitleTooLong\");\r\n///<summary>&quot;Another page is using the specified Friendly URL. Friendly URL&apos;s must be unique.&quot;</summary> \r\npublic static string FriendlyUrlNotUniqueError=>T(\"FriendlyUrlNotUniqueError\");\r\n///<summary>&quot;The title can not be empty.&quot;</summary> \r\npublic static string TitleMissingError=>T(\"TitleMissingError\");\r\n///<summary>&quot;Page not saved&quot;</summary> \r\npublic static string PageSaveValidationFailedTitle=>T(\"PageSaveValidationFailedTitle\");\r\n///<summary>&quot;The page did not validate and has not been saved. Please examine field messages.&quot;</summary> \r\npublic static string PageSaveValidationFailedMessage=>T(\"PageSaveValidationFailedMessage\");\r\n///<summary>&quot;Websites&quot;</summary> \r\npublic static string PageElementProvider_RootLabel=>T(\"PageElementProvider.RootLabel\");\r\n///<summary>&quot;Websites&quot;</summary> \r\npublic static string PageElementProvider_RootLabelToolTip=>T(\"PageElementProvider.RootLabelToolTip\");\r\n///<summary>&quot;Add Website&quot;</summary> \r\npublic static string PageElementProvider_AddPageAtRoot=>T(\"PageElementProvider.AddPageAtRoot\");\r\n///<summary>&quot;Add {0}&quot;</summary> \r\npublic static string PageElementProvider_AddPageAtRootFormat_Template=>T(\"PageElementProvider.AddPageAtRootFormat\");\r\n///<summary>&quot;Add {0}&quot;</summary> \r\npublic static string PageElementProvider_AddPageAtRootFormat(object parameter0)=>string.Format(T(\"PageElementProvider.AddPageAtRootFormat\"), parameter0);\r\n///<summary>&quot;Add new homepage&quot;</summary> \r\npublic static string PageElementProvider_AddPageAtRootToolTip=>T(\"PageElementProvider.AddPageAtRootToolTip\");\r\n///<summary>&quot;List Unpublished Content&quot;</summary> \r\npublic static string PageElementProvider_ViewUnpublishedItems=>T(\"PageElementProvider.ViewUnpublishedItems\");\r\n///<summary>&quot;Get an overview of pages and other content that haven&apos;t been published yet.&quot;</summary> \r\npublic static string PageElementProvider_ViewUnpublishedItemsToolTip=>T(\"PageElementProvider.ViewUnpublishedItemsToolTip\");\r\n///<summary>&quot;Unpublished Content&quot;</summary> \r\npublic static string PageElementProvider_ViewUnpublishedItems_document_title=>T(\"PageElementProvider.ViewUnpublishedItems-document-title\");\r\n///<summary>&quot;The list below displays pages and other content which are currently in draft or are ready to be approved / published.&quot;</summary> \r\npublic static string PageElementProvider_ViewUnpublishedItems_document_description=>T(\"PageElementProvider.ViewUnpublishedItems-document-description\");\r\n///<summary>&quot;Edit Page&quot;</summary> \r\npublic static string PageElementProvider_EditPage=>T(\"PageElementProvider.EditPage\");\r\n///<summary>&quot;Edit selected page&quot;</summary> \r\npublic static string PageElementProvider_EditPageToolTip=>T(\"PageElementProvider.EditPageToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string PageElementProvider_Delete=>T(\"PageElementProvider.Delete\");\r\n///<summary>&quot;Delete the selected page&quot;</summary> \r\npublic static string PageElementProvider_DeleteToolTip=>T(\"PageElementProvider.DeleteToolTip\");\r\n///<summary>&quot;Duplicate Page&quot;</summary> \r\npublic static string PageElementProvider_Duplicate=>T(\"PageElementProvider.Duplicate\");\r\n///<summary>&quot;Duplicate the selected page&quot;</summary> \r\npublic static string PageElementProvider_DuplicateToolTip=>T(\"PageElementProvider.DuplicateToolTip\");\r\n///<summary>&quot;Translate Page&quot;</summary> \r\npublic static string PageElementProvider_LocalizePage=>T(\"PageElementProvider.LocalizePage\");\r\n///<summary>&quot;Translate selected page&quot;</summary> \r\npublic static string PageElementProvider_LocalizePageToolTip=>T(\"PageElementProvider.LocalizePageToolTip\");\r\n///<summary>&quot;Undo Translation&quot;</summary> \r\npublic static string PageElementProvider_UnLocalizePage => T(\"PageElementProvider.UnLocalizePage\");\r\n///<summary>&quot;Delete Translation for Selected Page&quot;</summary> \r\npublic static string PageElementProvider_UnLocalizePageToolTip => T(\"PageElementProvider.UnLocalizePageToolTip\");\r\n///<summary>&quot;Add page&quot;</summary> \r\npublic static string PageElementProvider_AddSubPage=>T(\"PageElementProvider.AddSubPage\");\r\n///<summary>&quot;Add {0}&quot;</summary> \r\npublic static string PageElementProvider_AddSubPageFormat_Template=>T(\"PageElementProvider.AddSubPageFormat\");\r\n///<summary>&quot;Add {0}&quot;</summary> \r\npublic static string PageElementProvider_AddSubPageFormat(object parameter0)=>string.Format(T(\"PageElementProvider.AddSubPageFormat\"), parameter0);\r\n///<summary>&quot;Add new page below the selected&quot;</summary> \r\npublic static string PageElementProvider_AddSubPageToolTip=>T(\"PageElementProvider.AddSubPageToolTip\");\r\n///<summary>&quot;Show page local orderings&quot;</summary> \r\npublic static string PageElementProvider_DisplayLocalOrderingLabel=>T(\"PageElementProvider.DisplayLocalOrderingLabel\");\r\n///<summary>&quot;Show page local orderings&quot;</summary> \r\npublic static string PageElementProvider_DisplayLocalOrderingToolTip=>T(\"PageElementProvider.DisplayLocalOrderingToolTip\");\r\n///<summary>&quot;Not yet approved or published&quot;</summary> \r\npublic static string PageElementProvider_DisabledPage=>T(\"PageElementProvider.DisabledPage\");\r\n///<summary>&quot;Website Template required&quot;</summary> \r\npublic static string PageElementProvider_MissingTemplateTitle=>T(\"PageElementProvider.MissingTemplateTitle\");\r\n///<summary>&quot;You should create a &apos;Page Template&apos; first. Go to the &apos;Layout&apos; perspective and create one.&quot;</summary> \r\npublic static string PageElementProvider_MissingTemplateMessage=>T(\"PageElementProvider.MissingTemplateMessage\");\r\n///<summary>&quot;Language required&quot;</summary> \r\npublic static string PageElementProvider_MissingActiveLanguageTitle=>T(\"PageElementProvider.MissingActiveLanguageTitle\");\r\n///<summary>&quot;To add a page, you should firstly add at least one language. It can be done in the &apos;System&apos; perspective.&quot;</summary> \r\npublic static string PageElementProvider_MissingActiveLanguageMessage=>T(\"PageElementProvider.MissingActiveLanguageMessage\");\r\n///<summary>&quot;No page type available&quot;</summary> \r\npublic static string PageElementProvider_NoPageTypesAvailableTitle=>T(\"PageElementProvider.NoPageTypesAvailableTitle\");\r\n///<summary>&quot;You should create a &apos;Page Type&apos; first. Go to the &apos;Layout&apos; perspective and create one.&quot;</summary> \r\npublic static string PageElementProvider_NoPageTypesAvailableMessage=>T(\"PageElementProvider.NoPageTypesAvailableMessage\");\r\n///<summary>&quot;Page type required&quot;</summary> \r\npublic static string PageElementProvider_MissingPageTypeTitle=>T(\"PageElementProvider.MissingPageTypeTitle\");\r\n///<summary>&quot;To create a homepage, a page type without the &quot;only subpages&quot; restriction is required, but none have been added yet. You can add one under the Layout perspective.&quot;</summary> \r\npublic static string PageElementProvider_MissingPageTypeHomepageMessage=>T(\"PageElementProvider.MissingPageTypeHomepageMessage\");\r\n///<summary>&quot;To create a subpage, a page type without the the only homepages restriction is required, but none have been added yet. You can add one under the Layout perspective.&quot;</summary> \r\npublic static string PageElementProvider_MissingPageTypeSubpageMessage=>T(\"PageElementProvider.MissingPageTypeSubpageMessage\");\r\n///<summary>&quot;Unable to add a page!&quot;</summary> \r\npublic static string PageElementProvider_RuleDontAllowPageAddTitle=>T(\"PageElementProvider.RuleDontAllowPageAddTitle\");\r\n///<summary>&quot;The rules that define availability for Page Types prohibit adding a page here.&quot;</summary> \r\npublic static string PageElementProvider_RuleDontAllowPageAddMessage=>T(\"PageElementProvider.RuleDontAllowPageAddMessage\");\r\n///<summary>&quot;Manage host name&quot;</summary> \r\npublic static string ManageHostNames_Add_DialogLabel=>T(\"ManageHostNames.Add.DialogLabel\");\r\n///<summary>&quot;Add host name association to page&quot;</summary> \r\npublic static string ManageHostNames_Add_HeadingTitle=>T(\"ManageHostNames.Add.HeadingTitle\");\r\n///<summary>&quot;You can associate a host name (or a domain name) to a page by specifying it in the field below. Please note that the DNS settings for the specified host name must also be configured, which is done outside this system.&quot;</summary> \r\npublic static string ManageHostNames_Add_HeadingDescription=>T(\"ManageHostNames.Add.HeadingDescription\");\r\n///<summary>&quot;Host name association to page&quot;</summary> \r\npublic static string ManageHostNames_Add_FieldGroupLabel=>T(\"ManageHostNames.Add.FieldGroupLabel\");\r\n///<summary>&quot;Host name&quot;</summary> \r\npublic static string ManageHostNames_Add_HostNameTextBoxLabel=>T(\"ManageHostNames.Add.HostNameTextBoxLabel\");\r\n///<summary>&quot;Specify the host name (like &apos;www.composite.net&apos; or &apos;composite.net&apos;) you want to associate with this page&quot;</summary> \r\npublic static string ManageHostNames_Add_HostNametextBoxHelp=>T(\"ManageHostNames.Add.HostNametextBoxHelp\");\r\n///<summary>&quot;The syntax of the host name is not valid&quot;</summary> \r\npublic static string ManageHostNames_Add_InvalidHostNameSyntaxError=>T(\"ManageHostNames.Add.InvalidHostNameSyntaxError\");\r\n///<summary>&quot;This host name is already associated to a page. You must remove the existing association first.&quot;</summary> \r\npublic static string ManageHostNames_Add_HostNameNotUniqueError=>T(\"ManageHostNames.Add.HostNameNotUniqueError\");\r\n///<summary>&quot;Manage host name&quot;</summary> \r\npublic static string ManageHostNames_Remove_DialogLabel=>T(\"ManageHostNames.Remove.DialogLabel\");\r\n///<summary>&quot;Remove host name association from page&quot;</summary> \r\npublic static string ManageHostNames_Remove_FieldGroupLabel=>T(\"ManageHostNames.Remove.FieldGroupLabel\");\r\n///<summary>&quot;Host names to remove&quot;</summary> \r\npublic static string ManageHostNames_Remove_MultiSelectorLabel=>T(\"ManageHostNames.Remove.MultiSelectorLabel\");\r\n///<summary>&quot;The host names you select will no longer be associated with the page&quot;</summary> \r\npublic static string ManageHostNames_Remove_MultiSelectorHelp=>T(\"ManageHostNames.Remove.MultiSelectorHelp\");\r\n///<summary>&quot;Please confirm deletion of all sub pages&quot;</summary> \r\npublic static string DeletePageWorkflow_MissingConfirmErrorMessage=>T(\"DeletePageWorkflow.MissingConfirmErrorMessage\");\r\n///<summary>&quot;Cascade delete error&quot;</summary> \r\npublic static string DeletePageWorkflow_CascadeDeleteErrorTitle=>T(\"DeletePageWorkflow.CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The page is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string DeletePageWorkflow_CascadeDeleteErrorMessage=>T(\"DeletePageWorkflow.CascadeDeleteErrorMessage\");\r\n///<summary>&quot;Can not delete page&quot;</summary> \r\npublic static string DeletePageWorkflow_HasCompositionsTitle=>T(\"DeletePageWorkflow.HasCompositionsTitle\");\r\n///<summary>&quot;This page has one or more page folders or metadata fields defined on it. Delete these first.&quot;</summary> \r\npublic static string DeletePageWorkflow_HasCompositionsMessage=>T(\"DeletePageWorkflow.HasCompositionsMessage\");\r\n///<summary>&quot;Delete page versions&quot;</summary> \r\npublic static string DeletePageWorkflow_ConfirmAllVersionsDeletion_DialogLabel=>T(\"DeletePageWorkflow.ConfirmAllVersionsDeletion.DialogLabel\");\r\n///<summary>&quot;This page contains multiple versions&quot;</summary> \r\npublic static string DeletePageWorkflow_ConfirmAllVersionsDeletion_Text=>T(\"DeletePageWorkflow.ConfirmAllVersionsDeletion.Text\");\r\n///<summary>&quot;Delete all versions&quot;</summary> \r\npublic static string DeletePageWorkflow_ConfirmAllVersionsDeletion_DeleteAllVersions=>T(\"DeletePageWorkflow.ConfirmAllVersionsDeletion.DeleteAllVersions\");\r\n///<summary>&quot;Delete only current version&quot;</summary> \r\npublic static string DeletePageWorkflow_ConfirmAllVersionsDeletion_DeleteCurrentVersion=>T(\"DeletePageWorkflow.ConfirmAllVersionsDeletion.DeleteCurrentVersion\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string ViewUnpublishedItems_PageTitleLabel=>T(\"ViewUnpublishedItems.PageTitleLabel\");\r\n///<summary>&quot;Version&quot;</summary> \r\npublic static string ViewUnpublishedItems_VersionLabel=>T(\"ViewUnpublishedItems.VersionLabel\");\r\n///<summary>&quot;Status&quot;</summary> \r\npublic static string ViewUnpublishedItems_StatusLabel=>T(\"ViewUnpublishedItems.StatusLabel\");\r\n///<summary>&quot;Author&quot;</summary> \r\npublic static string ViewUnpublishedItems_LabelChangedBy=>T(\"ViewUnpublishedItems.LabelChangedBy\");\r\n///<summary>&quot;Publish Date&quot;</summary> \r\npublic static string ViewUnpublishedItems_PublishDateLabel=>T(\"ViewUnpublishedItems.PublishDateLabel\");\r\n///<summary>&quot;Date and time the page has been scheduled to publish automatically. To edit, see the Publication Schedule in Edit Page mode.&quot;</summary> \r\npublic static string ViewUnpublishedItems_PublishDateHelp=>T(\"ViewUnpublishedItems.PublishDateHelp\");\r\n///<summary>&quot;Unpublish Date&quot;</summary> \r\npublic static string ViewUnpublishedItems_UnpublishDateLabel=>T(\"ViewUnpublishedItems.UnpublishDateLabel\");\r\n///<summary>&quot;Date and time the page has been scheduled to unpublish automatically. To edit, see the Publication Schedule in Edit Page mode.&quot;</summary> \r\npublic static string ViewUnpublishedItems_UnpublishDateHelp=>T(\"ViewUnpublishedItems.UnpublishDateHelp\");\r\n///<summary>&quot;Date Created&quot;</summary> \r\npublic static string ViewUnpublishedItems_DateCreatedLabel=>T(\"ViewUnpublishedItems.DateCreatedLabel\");\r\n///<summary>&quot;Date Modified&quot;</summary> \r\npublic static string ViewUnpublishedItems_DateModifiedLabel=>T(\"ViewUnpublishedItems.DateModifiedLabel\");\r\n///<summary>&quot;Publish Pages&quot;</summary> \r\npublic static string ViewUnpublishedItems_PublishConfirmTitle=>T(\"ViewUnpublishedItems.PublishConfirmTitle\");\r\n///<summary>&quot;You are about to publish these pages. Continue?&quot;</summary> \r\npublic static string ViewUnpublishedItems_PublishConfirmText=>T(\"ViewUnpublishedItems.PublishConfirmText\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_PageTemplateElementProvider {\r\n///<summary>&quot;Page Templates&quot;</summary> \r\npublic static string PageTemplateElementProvider_RootLabel=>T(\"PageTemplateElementProvider.RootLabel\");\r\n///<summary>&quot;You can find the sites XHTML templates here&quot;</summary> \r\npublic static string PageTemplateElementProvider_RootLabelToolTip=>T(\"PageTemplateElementProvider.RootLabelToolTip\");\r\n///<summary>&quot;Add Template&quot;</summary> \r\npublic static string PageTemplateElementProvider_AddTemplate=>T(\"PageTemplateElementProvider.AddTemplate\");\r\n///<summary>&quot;Add new template&quot;</summary> \r\npublic static string PageTemplateElementProvider_AddTemplateToolTip=>T(\"PageTemplateElementProvider.AddTemplateToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string PageTemplateElementProvider_DeleteTemplate=>T(\"PageTemplateElementProvider.DeleteTemplate\");\r\n///<summary>&quot;Delete this item&quot;</summary> \r\npublic static string PageTemplateElementProvider_DeleteTemplateToolTip=>T(\"PageTemplateElementProvider.DeleteTemplateToolTip\");\r\n///<summary>&quot;Shared Code&quot;</summary> \r\npublic static string PageTemplateElementProvider_SharedCodeFolder_Title=>T(\"PageTemplateElementProvider.SharedCodeFolder.Title\");\r\n///<summary>&quot;Files used by layout files&quot;</summary> \r\npublic static string PageTemplateElementProvider_SharedCodeFolder_ToolTip=>T(\"PageTemplateElementProvider.SharedCodeFolder.ToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string EditSharedCodeFile_Label=>T(\"EditSharedCodeFile.Label\");\r\n///<summary>&quot;Edit the file&quot;</summary> \r\npublic static string EditSharedCodeFile_ToolTip=>T(\"EditSharedCodeFile.ToolTip\");\r\n///<summary>&quot;Edit XML Template&quot;</summary> \r\npublic static string PageTemplateElementProvider_EditXmlTemplate=>T(\"PageTemplateElementProvider.EditXmlTemplate\");\r\n///<summary>&quot;Edit the selected XML template&quot;</summary> \r\npublic static string PageTemplateElementProvider_EditXmlTemplateToolTip=>T(\"PageTemplateElementProvider.EditXmlTemplateToolTip\");\r\n///<summary>&quot;Add New XML Page Template&quot;</summary> \r\npublic static string AddNewXmlPageTemplate_LabelDialog=>T(\"AddNewXmlPageTemplate.LabelDialog\");\r\n///<summary>&quot;Template Title&quot;</summary> \r\npublic static string AddNewXmlPageTemplate_LabelTemplateTitle=>T(\"AddNewXmlPageTemplate.LabelTemplateTitle\");\r\n///<summary>&quot;The title identifies this template in lists. Consider selecting a short but meaningful name.&quot;</summary> \r\npublic static string AddNewXmlPageTemplate_LabelTemplateTitleHelp=>T(\"AddNewXmlPageTemplate.LabelTemplateTitleHelp\");\r\n///<summary>&quot;Copy from&quot;</summary> \r\npublic static string AddNewXmlPageTemplate_LabelCopyFrom=>T(\"AddNewXmlPageTemplate.LabelCopyFrom\");\r\n///<summary>&quot;You can copy the markup from another XML Page Template by selecting it in this list.&quot;</summary> \r\npublic static string AddNewXmlPageTemplate_LabelCopyFromHelp=>T(\"AddNewXmlPageTemplate.LabelCopyFromHelp\");\r\n///<summary>&quot;(New template)&quot;</summary> \r\npublic static string AddNewXmlPageTemplate_LabelCopyFromEmptyOption=>T(\"AddNewXmlPageTemplate.LabelCopyFromEmptyOption\");\r\n///<summary>&quot;Title already used&quot;</summary> \r\npublic static string AddNewXmlPageTemplateWorkflow_TitleInUseTitle=>T(\"AddNewXmlPageTemplateWorkflow.TitleInUseTitle\");\r\n///<summary>&quot;The title is too long (used as part of the XML filename).&quot;</summary> \r\npublic static string AddNewXmlPageTemplateWorkflow_TitleTooLong=>T(\"AddNewXmlPageTemplateWorkflow.TitleTooLong\");\r\n///<summary>&quot;Markup Code&quot;</summary> \r\npublic static string EditXmlPageTemplate_LabelMarkUpCode=>T(\"EditXmlPageTemplate.LabelMarkUpCode\");\r\n///<summary>&quot;Template Info&quot;</summary> \r\npublic static string EditXmlPageTemplate_LabelTemplateIdentification=>T(\"EditXmlPageTemplate.LabelTemplateIdentification\");\r\n///<summary>&quot;Template Title&quot;</summary> \r\npublic static string EditXmlPageTemplate_LabelTemplateTitle=>T(\"EditXmlPageTemplate.LabelTemplateTitle\");\r\n///<summary>&quot;The title identifies this template in lists. Consider selecting a short but meaningful name.&quot;</summary> \r\npublic static string EditXmlPageTemplate_LabelTemplateTitleHelp=>T(\"EditXmlPageTemplate.LabelTemplateTitleHelp\");\r\n///<summary>&quot;Unable to Save Template&quot;</summary> \r\npublic static string EditXmlPageTemplateWorkflow_InvalidXmlTitle=>T(\"EditXmlPageTemplateWorkflow.InvalidXmlTitle\");\r\n///<summary>&quot;The page template markup did not validate. {0}&quot;</summary> \r\npublic static string EditXmlPageTemplateWorkflow_InvalidXmlMessage_Template=>T(\"EditXmlPageTemplateWorkflow.InvalidXmlMessage\");\r\n///<summary>&quot;The page template markup did not validate. {0}&quot;</summary> \r\npublic static string EditXmlPageTemplateWorkflow_InvalidXmlMessage(object parameter0)=>string.Format(T(\"EditXmlPageTemplateWorkflow.InvalidXmlMessage\"), parameter0);\r\n///<summary>&quot;Cannot rename a template - the file with the name &apos;{0}&apos; already exists.&quot;</summary> \r\npublic static string EditXmlPageTemplateWorkflow_CannotRenameFileExists_Template=>T(\"EditXmlPageTemplateWorkflow.CannotRenameFileExists\");\r\n///<summary>&quot;Cannot rename a template - the file with the name &apos;{0}&apos; already exists.&quot;</summary> \r\npublic static string EditXmlPageTemplateWorkflow_CannotRenameFileExists(object parameter0)=>string.Format(T(\"EditXmlPageTemplateWorkflow.CannotRenameFileExists\"), parameter0);\r\n///<summary>&quot;Title already used&quot;</summary> \r\npublic static string EditXmlPageTemplateWorkflow_TitleInUseTitle=>T(\"EditXmlPageTemplateWorkflow.TitleInUseTitle\");\r\n///<summary>&quot;Delete This Page Template?&quot;</summary> \r\npublic static string DeletePageTemplateStep1_LabelFieldGroup=>T(\"DeletePageTemplateStep1.LabelFieldGroup\");\r\n///<summary>&quot;Delete page template?&quot;</summary> \r\npublic static string DeletePageTemplateStep1_Text=>T(\"DeletePageTemplateStep1.Text\");\r\n///<summary>&quot;Cascade Delete Error&quot;</summary> \r\npublic static string DeletePageTemplateWorkflow_CascadeDeleteErrorTitle=>T(\"DeletePageTemplateWorkflow.CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted.&quot;</summary> \r\npublic static string DeletePageTemplateWorkflow_CascadeDeleteErrorMessage=>T(\"DeletePageTemplateWorkflow.CascadeDeleteErrorMessage\");\r\n///<summary>&quot;There are {0} page[s] referencing this template: {1}&quot;</summary> \r\npublic static string DeletePageTemplateWorkflow_PageReference_Template=>T(\"DeletePageTemplateWorkflow.PageReference\");\r\n///<summary>&quot;There are {0} page[s] referencing this template: {1}&quot;</summary> \r\npublic static string DeletePageTemplateWorkflow_PageReference(object parameter0,object parameter1)=>string.Format(T(\"DeletePageTemplateWorkflow.PageReference\"), parameter0,parameter1);\r\n///<summary>&quot;There are {0} page type[s] referencing this template: {1}&quot;</summary> \r\npublic static string DeletePageTemplateWorkflow_PageTypeReference_Template=>T(\"DeletePageTemplateWorkflow.PageTypeReference\");\r\n///<summary>&quot;There are {0} page type[s] referencing this template: {1}&quot;</summary> \r\npublic static string DeletePageTemplateWorkflow_PageTypeReference(object parameter0,object parameter1)=>string.Format(T(\"DeletePageTemplateWorkflow.PageTypeReference\"), parameter0,parameter1);\r\n///<summary>&quot;Add New Page Template&quot;</summary> \r\npublic static string AddNewPageTemplate_LabelDialog=>T(\"AddNewPageTemplate.LabelDialog\");\r\n///<summary>&quot;Choose one of the possible types of page templates&quot;</summary> \r\npublic static string AddNewPageTemplate_TemplateTypeHelp=>T(\"AddNewPageTemplate.TemplateTypeHelp\");\r\n///<summary>&quot;Template type&quot;</summary> \r\npublic static string AddNewPageTemplate_TemplateTypeLabel=>T(\"AddNewPageTemplate.TemplateTypeLabel\");\r\n///<summary>&quot;Razor&quot;</summary> \r\npublic static string AddNewPageTemplate_TemplateType_Razor=>T(\"AddNewPageTemplate.TemplateType.Razor\");\r\n///<summary>&quot;Master Page&quot;</summary> \r\npublic static string AddNewPageTemplate_TemplateType_MasterPage=>T(\"AddNewPageTemplate.TemplateType.MasterPage\");\r\n///<summary>&quot;XML&quot;</summary> \r\npublic static string AddNewPageTemplate_TemplateType_XML=>T(\"AddNewPageTemplate.TemplateType.XML\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_PageTemplateFeatureElementProvider {\r\n///<summary>&quot;Page Template Features&quot;</summary> \r\npublic static string ElementProvider_RootLabel=>T(\"ElementProvider.RootLabel\");\r\n///<summary>&quot;Here you can find features - snippets of HTML and functionality - included in the website templates.&quot;</summary> \r\npublic static string ElementProvider_RootToolTip=>T(\"ElementProvider.RootToolTip\");\r\n///<summary>&quot;Add Template Feature&quot;</summary> \r\npublic static string ElementProvider_AddTemplateFeature=>T(\"ElementProvider.AddTemplateFeature\");\r\n///<summary>&quot;Add a new page template feature&quot;</summary> \r\npublic static string ElementProvider_AddTemplateFeatureToolTip=>T(\"ElementProvider.AddTemplateFeatureToolTip\");\r\n///<summary>&quot;Delete Template Feature&quot;</summary> \r\npublic static string ElementProvider_DeleteTemplateFeature=>T(\"ElementProvider.DeleteTemplateFeature\");\r\n///<summary>&quot;Delete this template feature&quot;</summary> \r\npublic static string ElementProvider_DeleteTemplateFeatureToolTip=>T(\"ElementProvider.DeleteTemplateFeatureToolTip\");\r\n///<summary>&quot;Edit Template Feature&quot;</summary> \r\npublic static string ElementProvider_EditTemplateFeature=>T(\"ElementProvider.EditTemplateFeature\");\r\n///<summary>&quot;Edit the selected template feature&quot;</summary> \r\npublic static string ElementProvider_EditTemplateFeatureToolTip=>T(\"ElementProvider.EditTemplateFeatureToolTip\");\r\n///<summary>&quot;Use Visual Editor&quot;</summary> \r\npublic static string ElementProvider_EditVisually=>T(\"ElementProvider.EditVisually\");\r\n///<summary>&quot;When enabled the visual editor will be used to manage this feature&quot;</summary> \r\npublic static string ElementProvider_EditVisuallyToolTip=>T(\"ElementProvider.EditVisuallyToolTip\");\r\n///<summary>&quot;Add New Page Template Feature&quot;</summary> \r\npublic static string AddWorkflow_LabelDialog=>T(\"AddWorkflow.LabelDialog\");\r\n///<summary>&quot;Feature name&quot;</summary> \r\npublic static string AddWorkflow_LabelTemplateFeatureName=>T(\"AddWorkflow.LabelTemplateFeatureName\");\r\n///<summary>&quot;The name is used to identify this feature when included in templates&quot;</summary> \r\npublic static string AddWorkflow_LabelTemplateFeatureNameHelp=>T(\"AddWorkflow.LabelTemplateFeatureNameHelp\");\r\n///<summary>&quot;Editor type&quot;</summary> \r\npublic static string AddWorkflow_LabelTemplateFeatureEditorType=>T(\"AddWorkflow.LabelTemplateFeatureEditorType\");\r\n///<summary>&quot;Choose which type of editor to use when maintaining this feature. You can always switch the editor type in the tree later.&quot;</summary> \r\npublic static string AddWorkflow_LabelTemplateFeatureEditorTypeHelp=>T(\"AddWorkflow.LabelTemplateFeatureEditorTypeHelp\");\r\n///<summary>&quot;Visual Editor&quot;</summary> \r\npublic static string AddWorkflow_LabelTemplateFeatureEditorType_html=>T(\"AddWorkflow.LabelTemplateFeatureEditorType.html\");\r\n///<summary>&quot;Markup Editor&quot;</summary> \r\npublic static string AddWorkflow_LabelTemplateFeatureEditorType_xml=>T(\"AddWorkflow.LabelTemplateFeatureEditorType.xml\");\r\n///<summary>&quot;The name is already used by another feature&quot;</summary> \r\npublic static string AddWorkflow_NameInUse=>T(\"AddWorkflow.NameInUse\");\r\n///<summary>&quot;The title is too long (max 50 characters)&quot;</summary> \r\npublic static string AddWorkflow_NameTooLong=>T(\"AddWorkflow.NameTooLong\");\r\n///<summary>&quot;The name must be usable in a file name - you have invalid characters you need to remove&quot;</summary> \r\npublic static string AddWorkflow_NameNotValidInFilename=>T(\"AddWorkflow.NameNotValidInFilename\");\r\n///<summary>&quot;Delete This Page Template Feature?&quot;</summary> \r\npublic static string DeleteWorkflow_Title=>T(\"DeleteWorkflow.Title\");\r\n///<summary>&quot;If this feature is in use by page templates, this action could lead to errors.&quot;</summary> \r\npublic static string DeleteWorkflow_Text=>T(\"DeleteWorkflow.Text\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_PageTypeElementProvider {\r\n///<summary>&quot;Page Types&quot;</summary> \r\npublic static string PageType_Tree_Root_Label=>T(\"PageType.Tree.Root.Label\");\r\n///<summary>&quot;Placeholder Content&quot;</summary> \r\npublic static string PageType_Tree_DefaultContentElement_Label=>T(\"PageType.Tree.DefaultContentElement.Label\");\r\n///<summary>&quot;Metadata Fields&quot;</summary> \r\npublic static string PageType_Tree_MetaDataFieldsElement_Label=>T(\"PageType.Tree.MetaDataFieldsElement.Label\");\r\n///<summary>&quot;Add Page Type&quot;</summary> \r\npublic static string PageType_Tree_AddNewPageType_Label=>T(\"PageType.Tree.AddNewPageType.Label\");\r\n///<summary>&quot;Add new page type&quot;</summary> \r\npublic static string PageType_Tree_AddNewPageType_ToolTip=>T(\"PageType.Tree.AddNewPageType.ToolTip\");\r\n///<summary>&quot;Edit Page Type&quot;</summary> \r\npublic static string PageType_Tree_EditPageType_Label=>T(\"PageType.Tree.EditPageType.Label\");\r\n///<summary>&quot;Edit selected page type&quot;</summary> \r\npublic static string PageType_Tree_EditPageType_ToolTip=>T(\"PageType.Tree.EditPageType.ToolTip\");\r\n///<summary>&quot;Delete Page Type&quot;</summary> \r\npublic static string PageType_Tree_DeletePageType_Label=>T(\"PageType.Tree.DeletePageType.Label\");\r\n///<summary>&quot;Delete selected page type&quot;</summary> \r\npublic static string PageType_Tree_DeletePageType_ToolTip=>T(\"PageType.Tree.DeletePageType.ToolTip\");\r\n///<summary>&quot;Add Default Content&quot;</summary> \r\npublic static string PageType_Tree_AddDefaultPageContent_Label=>T(\"PageType.Tree.AddDefaultPageContent.Label\");\r\n///<summary>&quot;Add placeholder default content&quot;</summary> \r\npublic static string PageType_Tree_AddDefaultPageContent_ToolTip=>T(\"PageType.Tree.AddDefaultPageContent.ToolTip\");\r\n///<summary>&quot;Edit Default Content&quot;</summary> \r\npublic static string PageType_Tree_EditDefaultPageContent_Label=>T(\"PageType.Tree.EditDefaultPageContent.Label\");\r\n///<summary>&quot;Edit placeholder default content&quot;</summary> \r\npublic static string PageType_Tree_EditDefaultPageContent_ToolTip=>T(\"PageType.Tree.EditDefaultPageContent.ToolTip\");\r\n///<summary>&quot;Delete Default Content&quot;</summary> \r\npublic static string PageType_Tree_DeleteDefaultPageContent_Label=>T(\"PageType.Tree.DeleteDefaultPageContent.Label\");\r\n///<summary>&quot;Delete default content&quot;</summary> \r\npublic static string PageType_Tree_DeleteDefaultPageContent_ToolTip=>T(\"PageType.Tree.DeleteDefaultPageContent.ToolTip\");\r\n///<summary>&quot;Add Metadata Field&quot;</summary> \r\npublic static string PageType_Tree_AddMetaDataField_Label=>T(\"PageType.Tree.AddMetaDataField.Label\");\r\n///<summary>&quot;Add new Metadata field&quot;</summary> \r\npublic static string PageType_Tree_AddMetaDataField_ToolTip=>T(\"PageType.Tree.AddMetaDataField.ToolTip\");\r\n///<summary>&quot;Edit Metadata Field&quot;</summary> \r\npublic static string PageType_Tree_EditMetaDataField_Label=>T(\"PageType.Tree.EditMetaDataField.Label\");\r\n///<summary>&quot;Edit selected Metadata field&quot;</summary> \r\npublic static string PageType_Tree_EditMetaDataField_ToolTip=>T(\"PageType.Tree.EditMetaDataField.ToolTip\");\r\n///<summary>&quot;Delete Metadata Field&quot;</summary> \r\npublic static string PageType_Tree_DeleteMetaDataField_Label=>T(\"PageType.Tree.DeleteMetaDataField.Label\");\r\n///<summary>&quot;Delete selected Metadata field&quot;</summary> \r\npublic static string PageType_Tree_DeleteMetaDataField_ToolTip=>T(\"PageType.Tree.DeleteMetaDataField.ToolTip\");\r\n///<summary>&quot;Add New Page Type&quot;</summary> \r\npublic static string PageType_AddNewPageTypeWorkflow_Layout_Label=>T(\"PageType.AddNewPageTypeWorkflow.Layout.Label\");\r\n///<summary>&quot;New page type settings&quot;</summary> \r\npublic static string PageType_AddNewPageTypeWorkflow_FieldGroup_Label=>T(\"PageType.AddNewPageTypeWorkflow.FieldGroup.Label\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string PageType_AddNewPageTypeWorkflow_NameTextBox_Label=>T(\"PageType.AddNewPageTypeWorkflow.NameTextBox.Label\");\r\n///<summary>&quot;The name of the new page type&quot;</summary> \r\npublic static string PageType_AddNewPageTypeWorkflow_NameTextBox_Help=>T(\"PageType.AddNewPageTypeWorkflow.NameTextBox.Help\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string PageType_AddNewPageTypeWorkflow_DescriptionTextArea_Label=>T(\"PageType.AddNewPageTypeWorkflow.DescriptionTextArea.Label\");\r\n///<summary>&quot;The description of the new page type&quot;</summary> \r\npublic static string PageType_AddNewPageTypeWorkflow_DescriptionTextArea_Help=>T(\"PageType.AddNewPageTypeWorkflow.DescriptionTextArea.Help\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_SettingsPlaceHolder_Label=>T(\"PageType.EditPageTypeWorkflow.SettingsPlaceHolder.Label\");\r\n///<summary>&quot;Page type settings&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_SettingsFieldGroup_Label=>T(\"PageType.EditPageTypeWorkflow.SettingsFieldGroup.Label\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_NameTextBox_Label=>T(\"PageType.EditPageTypeWorkflow.NameTextBox.Label\");\r\n///<summary>&quot;The name of the page type&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_NameTextBox_Help=>T(\"PageType.EditPageTypeWorkflow.NameTextBox.Help\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DescriptionTextArea_Label=>T(\"PageType.EditPageTypeWorkflow.DescriptionTextArea.Label\");\r\n///<summary>&quot;The description of the page type&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DescriptionTextArea_Help=>T(\"PageType.EditPageTypeWorkflow.DescriptionTextArea.Help\");\r\n///<summary>&quot;Available&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_AvailableCheckBox_Label=>T(\"PageType.EditPageTypeWorkflow.AvailableCheckBox.Label\");\r\n///<summary>&quot;Unchecking this will make this page non-selectable on any page&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_AvailableCheckBox_Help=>T(\"PageType.EditPageTypeWorkflow.AvailableCheckBox.Help\");\r\n///<summary>&quot;Preset menu title&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_PresetMenuTitleCheckBox_Label=>T(\"PageType.EditPageTypeWorkflow.PresetMenuTitleCheckBox.Label\");\r\n///<summary>&quot;If this is checked a default value for the menu title on pages is preset&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_PresetMenuTitleCheckBox_Help=>T(\"PageType.EditPageTypeWorkflow.PresetMenuTitleCheckBox.Help\");\r\n///<summary>&quot;Default child page type&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DefaultChildPageTypeKeySelector_Label=>T(\"PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.Label\");\r\n///<summary>&quot;Select a page type to be the default page type for child pages created with this page type&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DefaultChildPageTypeKeySelector_Help=>T(\"PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.Help\");\r\n///<summary>&quot;[None]&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DefaultChildPageTypeKeySelector_NoneSelectedLabel=>T(\"PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.NoneSelectedLabel\");\r\n///<summary>&quot;Layout&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_PageTemplatePlaceHolder_Label=>T(\"PageType.EditPageTypeWorkflow.PageTemplatePlaceHolder.Label\");\r\n///<summary>&quot;Layout&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_PageTemplateRestrictionFieldGroup_Label=>T(\"PageType.EditPageTypeWorkflow.PageTemplateRestrictionFieldGroup.Label\");\r\n///<summary>&quot;Layout restrictions&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_PageTemplateRestrictionMultiKeySelector_Label=>T(\"PageType.EditPageTypeWorkflow.PageTemplateRestrictionMultiKeySelector.Label\");\r\n///<summary>&quot;Select layouts to be only available when editing pages of this page type. If none is selected (default), all will be available.&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_PageTemplateRestrictionMultiKeySelector_Help=>T(\"PageType.EditPageTypeWorkflow.PageTemplateRestrictionMultiKeySelector.Help\");\r\n///<summary>&quot;Default layout&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DefaultPageTemplateKeySelector_Label=>T(\"PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.Label\");\r\n///<summary>&quot;Select a layout to be the default layout for pages created with this page type&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DefaultPageTemplateKeySelector_Help=>T(\"PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.Help\");\r\n///<summary>&quot;[None]&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DefaultPageTemplateKeySelector_NoneSelectedLabel=>T(\"PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.NoneSelectedLabel\");\r\n///<summary>&quot;Availability&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_AvailabilityPlaceHolder_Label=>T(\"PageType.EditPageTypeWorkflow.AvailabilityPlaceHolder.Label\");\r\n///<summary>&quot;Availability&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_AvailabilityFieldGroup_Label=>T(\"PageType.EditPageTypeWorkflow.AvailabilityFieldGroup.Label\");\r\n///<summary>&quot;Homepage relation&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_HomepageRelationKeySelector_Label=>T(\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.Label\");\r\n///<summary>&quot;Homepage relation&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_HomepageRelationKeySelector_Help=>T(\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.Help\");\r\n///<summary>&quot;No restrictions&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_HomepageRelationKeySelector_NoRestrictionLabel=>T(\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.NoRestrictionLabel\");\r\n///<summary>&quot;Only sub pages&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_HomepageRelationKeySelector_OnlySubPagesLabel=>T(\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.OnlySubPagesLabel\");\r\n///<summary>&quot;Only home pages&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_HomepageRelationKeySelector_OnlyHomePagesLabel=>T(\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.OnlyHomePagesLabel\");\r\n///<summary>&quot;Page type parent restriction&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_PageTypeChildRestrictionMultiKeySelector_Label=>T(\"PageType.EditPageTypeWorkflow.PageTypeChildRestrictionMultiKeySelector.Label\");\r\n///<summary>&quot;Only allow this page type as for child pages with the selected page types&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_PageTypeChildRestrictionMultiKeySelector_Help=>T(\"PageType.EditPageTypeWorkflow.PageTypeChildRestrictionMultiKeySelector.Help\");\r\n///<summary>&quot;DataFolders / Applications&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DataFolderApplicationPlaceHolder_Label=>T(\"PageType.EditPageTypeWorkflow.DataFolderApplicationPlaceHolder.Label\");\r\n///<summary>&quot;Data folders&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DataFolderFieldGroup_Label=>T(\"PageType.EditPageTypeWorkflow.DataFolderFieldGroup.Label\");\r\n///<summary>&quot;Data folders&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DataFolderMultiKeySelector_Label=>T(\"PageType.EditPageTypeWorkflow.DataFolderMultiKeySelector.Label\");\r\n///<summary>&quot;Select the data folders that should automatically be added to pages using this page type&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_DataFolderMultiKeySelector_Help=>T(\"PageType.EditPageTypeWorkflow.DataFolderMultiKeySelector.Help\");\r\n///<summary>&quot;Applications&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_ApplicationFieldGroup_Label=>T(\"PageType.EditPageTypeWorkflow.ApplicationFieldGroup.Label\");\r\n///<summary>&quot;Applications&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_ApplicationMultiKeySelector_Label=>T(\"PageType.EditPageTypeWorkflow.ApplicationMultiKeySelector.Label\");\r\n///<summary>&quot;Select the applications that should automatically be added to pages using this page type&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_ApplicationMultiKeySelector_Help=>T(\"PageType.EditPageTypeWorkflow.ApplicationMultiKeySelector.Help\");\r\n///<summary>&quot;The default layout is not one of the selected restricted layouts&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_ValidationError_DefaultTemplateNotInRestrictions=>T(\"PageType.EditPageTypeWorkflow.ValidationError.DefaultTemplateNotInRestrictions\");\r\n///<summary>&quot;Page type parent restrictions are not allowed with home pages only&quot;</summary> \r\npublic static string PageType_EditPageTypeWorkflow_ValidationError_HomepageRelationConflictsWithParentRestrictions=>T(\"PageType.EditPageTypeWorkflow.ValidationError.HomepageRelationConflictsWithParentRestrictions\");\r\n///<summary>&quot;Delete This Page Type?&quot;</summary> \r\npublic static string PageType_DeletePageTypeWorkflow_Confirm_Layout_Label=>T(\"PageType.DeletePageTypeWorkflow.Confirm.Layout.Label\");\r\n///<summary>&quot;Delete the page type {0}?&quot;</summary> \r\npublic static string PageType_DeletePageTypeWorkflow_Confirm_Layout_Messeage_Template=>T(\"PageType.DeletePageTypeWorkflow.Confirm.Layout.Messeage\");\r\n///<summary>&quot;Delete the page type {0}?&quot;</summary> \r\npublic static string PageType_DeletePageTypeWorkflow_Confirm_Layout_Messeage(object parameter0)=>string.Format(T(\"PageType.DeletePageTypeWorkflow.Confirm.Layout.Messeage\"), parameter0);\r\n///<summary>&quot;Page Type in Use&quot;</summary> \r\npublic static string PageType_DeletePageTypeWorkflow_PagesRefering_Layout_Label=>T(\"PageType.DeletePageTypeWorkflow.PagesRefering.Layout.Label\");\r\n///<summary>&quot;The page type {0} is in use and it is not possible to delete it&quot;</summary> \r\npublic static string PageType_DeletePageTypeWorkflow_PagesRefering_Layout_Message_Template=>T(\"PageType.DeletePageTypeWorkflow.PagesRefering.Layout.Message\");\r\n///<summary>&quot;The page type {0} is in use and it is not possible to delete it&quot;</summary> \r\npublic static string PageType_DeletePageTypeWorkflow_PagesRefering_Layout_Message(object parameter0)=>string.Format(T(\"PageType.DeletePageTypeWorkflow.PagesRefering.Layout.Message\"), parameter0);\r\n///<summary>&quot;Add Default Content&quot;</summary> \r\npublic static string PageType_AddPageTypeDefaultPageContentWorkflow_Layout_Label=>T(\"PageType.AddPageTypeDefaultPageContentWorkflow.Layout.Label\");\r\n///<summary>&quot;Placeholder ID&quot;</summary> \r\npublic static string PageType_AddPageTypeDefaultPageContentWorkflow_PlaceHolderIdTextBox_Label=>T(\"PageType.AddPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Label\");\r\n///<summary>&quot;The ID of the placeholder. You can write a non-existing ID and create the placeholder afterwards (by editing Page Template markup).&quot;</summary> \r\npublic static string PageType_AddPageTypeDefaultPageContentWorkflow_PlaceHolderIdTextBox_Help=>T(\"PageType.AddPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Help\");\r\n///<summary>&quot;No templates with {0}&quot;</summary> \r\npublic static string PageType_AddPageTypeDefaultPageContentWorkflow_NonExistingPlaceholderId_Title_Template=>T(\"PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Title\");\r\n///<summary>&quot;No templates with {0}&quot;</summary> \r\npublic static string PageType_AddPageTypeDefaultPageContentWorkflow_NonExistingPlaceholderId_Title(object parameter0)=>string.Format(T(\"PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Title\"), parameter0);\r\n///<summary>&quot;Please note that the Placeholder ID you specified &apos;{0}&apos;, is currently not in any Layout Template.&quot;</summary> \r\npublic static string PageType_AddPageTypeDefaultPageContentWorkflow_NonExistingPlaceholderId_Message_Template=>T(\"PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Message\");\r\n///<summary>&quot;Please note that the Placeholder ID you specified &apos;{0}&apos;, is currently not in any Layout Template.&quot;</summary> \r\npublic static string PageType_AddPageTypeDefaultPageContentWorkflow_NonExistingPlaceholderId_Message(object parameter0)=>string.Format(T(\"PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Message\"), parameter0);\r\n///<summary>&quot;Edit default content&quot;</summary> \r\npublic static string PageType_EditPageTypeDefaultPageContentWorkflow_Layout_Label=>T(\"PageType.EditPageTypeDefaultPageContentWorkflow.Layout.Label\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string PageType_EditPageTypeDefaultPageContentWorkflow_SettingsPlaceHolder_Label=>T(\"PageType.EditPageTypeDefaultPageContentWorkflow.SettingsPlaceHolder.Label\");\r\n///<summary>&quot;Placeholder Settings&quot;</summary> \r\npublic static string PageType_EditPageTypeDefaultPageContentWorkflow_SettingsFieldGroup_Label=>T(\"PageType.EditPageTypeDefaultPageContentWorkflow.SettingsFieldGroup.Label\");\r\n///<summary>&quot;Placeholder ID&quot;</summary> \r\npublic static string PageType_EditPageTypeDefaultPageContentWorkflow_PlaceHolderIdTextBox_Label=>T(\"PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Label\");\r\n///<summary>&quot;The ID of the placeholder. You can write a non-existing ID and create the placeholder afterwards (edit Page Template markup).&quot;</summary> \r\npublic static string PageType_EditPageTypeDefaultPageContentWorkflow_PlaceHolderIdTextBox_Help=>T(\"PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Help\");\r\n///<summary>&quot;Container Classes&quot;</summary> \r\npublic static string PageType_EditPageTypeDefaultPageContentWorkflow_PlaceHolderContainerClassesTextBox_Label=>T(\"PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderContainerClassesTextBox.Label\");\r\n///<summary>&quot;Extra &apos;Container Classes&apos; to add to this placeholder when user is editing this type of page. Container classes let you style the editor and control which components can be added.&quot;</summary> \r\npublic static string PageType_EditPageTypeDefaultPageContentWorkflow_PlaceHolderContainerClassesTextBox_Help=>T(\"PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderContainerClassesTextBox.Help\");\r\n///<summary>&quot;Content&quot;</summary> \r\npublic static string PageType_EditPageTypeDefaultPageContentWorkflow_ContentXhtmlEditor_Label=>T(\"PageType.EditPageTypeDefaultPageContentWorkflow.ContentXhtmlEditor.Label\");\r\n///<summary>&quot;Add Metadata Field&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_Layout_Label=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.Layout.Label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_FieldGroup_Label=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.FieldGroup.Label\");\r\n///<summary>&quot;Programmatic name&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_NameTextBox_Label=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.NameTextBox.Label\");\r\n///<summary>&quot;The unique name of the Metadata field. This can not be changed later!&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_NameTextBox_Help=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.NameTextBox.Help\");\r\n///<summary>&quot;Show with label&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_LabelTextBox_Label=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.LabelTextBox.Label\");\r\n///<summary>&quot;The label of the Metadata field. Used for UI.&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_LabelTextBox_Help=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.LabelTextBox.Help\");\r\n///<summary>&quot;Metadata type&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_MetaDataTypeKeySelector_Label=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataTypeKeySelector.Label\");\r\n///<summary>&quot;The Metadata type&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_MetaDataTypeKeySelector_Help=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataTypeKeySelector.Help\");\r\n///<summary>&quot;Display on tab&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_MetaDataContainerKeySelector_Label=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Label\");\r\n///<summary>&quot;Select the tab to display the Metadata when editing a page.&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_MetaDataContainerKeySelector_Help=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Help\");\r\n///<summary>&quot;Add Metadata default values&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_AddingDefaultMetaData_Title=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.AddingDefaultMetaData.Title\");\r\n///<summary>&quot;The field name with another type is already used.&quot;</summary> \r\npublic static string PageType_AddPageTypeMetaDataFieldWorkflow_ValidationError_MetaDataFieldNameAlreadyUsed=>T(\"PageType.AddPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataFieldNameAlreadyUsed\");\r\n///<summary>&quot;Delete This Metadata Field?&quot;</summary> \r\npublic static string PageType_DeletePageTypeMetaDataFieldWorkflow_Confirm_Layout_Label=>T(\"PageType.DeletePageTypeMetaDataFieldWorkflow.Confirm.Layout.Label\");\r\n///<summary>&quot;Delete the Metadata field {0}? Warning: all its existing Metadata items will also be deleted&quot;</summary> \r\npublic static string PageType_DeletePageTypeMetaDataFieldWorkflow_Confirm_Layout_Message_Template=>T(\"PageType.DeletePageTypeMetaDataFieldWorkflow.Confirm.Layout.Message\");\r\n///<summary>&quot;Delete the Metadata field {0}? Warning: all its existing Metadata items will also be deleted&quot;</summary> \r\npublic static string PageType_DeletePageTypeMetaDataFieldWorkflow_Confirm_Layout_Message(object parameter0)=>string.Format(T(\"PageType.DeletePageTypeMetaDataFieldWorkflow.Confirm.Layout.Message\"), parameter0);\r\n///<summary>&quot;Edit Metadata Field&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_Layout_Label=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.Layout.Label\");\r\n///<summary>&quot;Metadata field settings&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_FieldGroup_Label=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.FieldGroup.Label\");\r\n///<summary>&quot;Label&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_LabelTextBox_Label=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.LabelTextBox.Label\");\r\n///<summary>&quot;The label of the Metadata field. Used for UI&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_LabelTextBox_Help=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.LabelTextBox.Help\");\r\n///<summary>&quot;Tab&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_MetaDataContainerKeySelector_Label=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Label\");\r\n///<summary>&quot;Select the tab to put the Metadata when editing a page&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_MetaDataContainerKeySelector_Help=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Help\");\r\n///<summary>&quot;Metatype&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_MetaTypeName_Label=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.MetaTypeName.Label\");\r\n///<summary>&quot;The name of the metatype.&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_MetaTypeName_Help=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.MetaTypeName.Help\");\r\n///<summary>&quot;The Metadata type is used another place with same name but different label&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_ValidationError_MetaDataFieldNameAlreadyUsed=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataFieldNameAlreadyUsed\");\r\n///<summary>&quot;There exists one or more definitions with the same name, container change is not allowed&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_ValidationError_MetaDataContainerChangeNotAllowed=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataContainerChangeNotAllowed\");\r\n///<summary>&quot;Metadata type has been deleted&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_ValidationError_MetaDataTypeNotExisting_Title=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataTypeNotExisting.Title\");\r\n///<summary>&quot;The Metadata type has been deleted from the system and can no longer be added to any page types&quot;</summary> \r\npublic static string PageType_EditPageTypeMetaDataFieldWorkflow_ValidationError_MetaDataTypeNotExisting_Message=>T(\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataTypeNotExisting.Message\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTypeElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_RazorFunction {\r\n///<summary>&quot;Razor Functions&quot;</summary> \r\npublic static string RootElement_Label=>T(\"RootElement.Label\");\r\n///<summary>&quot;Razor functions&quot;</summary> \r\npublic static string RootElement_ToolTip=>T(\"RootElement.ToolTip\");\r\n///<summary>&quot;Add Razor Function&quot;</summary> \r\npublic static string AddNewRazorFunction_Label=>T(\"AddNewRazorFunction.Label\");\r\n///<summary>&quot;Add a new Razor function&quot;</summary> \r\npublic static string AddNewRazorFunction_ToolTip=>T(\"AddNewRazorFunction.ToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string EditRazorFunction_Label=>T(\"EditRazorFunction.Label\");\r\n///<summary>&quot;Edit Razor Function&quot;</summary> \r\npublic static string EditRazorFunction_ToolTip=>T(\"EditRazorFunction.ToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteRazorFunction_Label=>T(\"DeleteRazorFunction.Label\");\r\n///<summary>&quot;Delete this Razor function&quot;</summary> \r\npublic static string DeleteRazorFunction_ToolTip=>T(\"DeleteRazorFunction.ToolTip\");\r\n///<summary>&quot;Add Razor Function&quot;</summary> \r\npublic static string AddNewRazorFunction_LabelDialog=>T(\"AddNewRazorFunction.LabelDialog\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string AddNewRazorFunction_LabelName=>T(\"AddNewRazorFunction.LabelName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewRazorFunction_HelpName=>T(\"AddNewRazorFunction.HelpName\");\r\n///<summary>&quot;Namespace&quot;</summary> \r\npublic static string AddNewRazorFunction_LabelNamespace=>T(\"AddNewRazorFunction.LabelNamespace\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewRazorFunction_HelpNamespace=>T(\"AddNewRazorFunction.HelpNamespace\");\r\n///<summary>&quot;Copy from&quot;</summary> \r\npublic static string AddNewRazorFunction_LabelCopyFrom=>T(\"AddNewRazorFunction.LabelCopyFrom\");\r\n///<summary>&quot;You can copy the code from another Razor function by selecting it in this list.&quot;</summary> \r\npublic static string AddNewRazorFunction_LabelCopyFromHelp=>T(\"AddNewRazorFunction.LabelCopyFromHelp\");\r\n///<summary>&quot;(New Razor function)&quot;</summary> \r\npublic static string AddNewRazorFunction_LabelCopyFromEmptyOption=>T(\"AddNewRazorFunction.LabelCopyFromEmptyOption\");\r\n///<summary>&quot;A C1 function with the same name already exists.&quot;</summary> \r\npublic static string AddNewRazorFunctionWorkflow_DuplicateName=>T(\"AddNewRazorFunctionWorkflow.DuplicateName\");\r\n///<summary>&quot;The function name is empty&quot;</summary> \r\npublic static string AddNewRazorFunctionWorkflow_EmptyName=>T(\"AddNewRazorFunctionWorkflow.EmptyName\");\r\n///<summary>&quot;The function namespace is empty&quot;</summary> \r\npublic static string AddNewRazorFunctionWorkflow_NamespaceEmpty=>T(\"AddNewRazorFunctionWorkflow.NamespaceEmpty\");\r\n///<summary>&quot;The namespace must be like A.B.C - not starting or ending with a period (.)&quot;</summary> \r\npublic static string AddNewRazorFunctionWorkflow_InvalidNamespace=>T(\"AddNewRazorFunctionWorkflow.InvalidNamespace\");\r\n///<summary>&quot;The total length of the name and the namespace is too long (used to name the .cshtml file).&quot;</summary> \r\npublic static string AddNewRazorFunctionWorkflow_TotalNameTooLang=>T(\"AddNewRazorFunctionWorkflow.TotalNameTooLang\");\r\n///<summary>&quot;Validation Error&quot;</summary> \r\npublic static string EditRazorFunctionWorkflow_Validation_DialogTitle=>T(\"EditRazorFunctionWorkflow.Validation.DialogTitle\");\r\n///<summary>&quot;Compilation failed: {0}&quot;</summary> \r\npublic static string EditRazorFunctionWorkflow_Validation_CompilationFailed_Template=>T(\"EditRazorFunctionWorkflow.Validation.CompilationFailed\");\r\n///<summary>&quot;Compilation failed: {0}&quot;</summary> \r\npublic static string EditRazorFunctionWorkflow_Validation_CompilationFailed(object parameter0)=>string.Format(T(\"EditRazorFunctionWorkflow.Validation.CompilationFailed\"), parameter0);\r\n///<summary>&quot;Razor function should inherit &apos;{0}&apos;&quot;</summary> \r\npublic static string EditRazorFunctionWorkflow_Validation_IncorrectBaseClass_Template=>T(\"EditRazorFunctionWorkflow.Validation.IncorrectBaseClass\");\r\n///<summary>&quot;Razor function should inherit &apos;{0}&apos;&quot;</summary> \r\npublic static string EditRazorFunctionWorkflow_Validation_IncorrectBaseClass(object parameter0)=>string.Format(T(\"EditRazorFunctionWorkflow.Validation.IncorrectBaseClass\"), parameter0);\r\n///<summary>&quot;Delete Razor Function?&quot;</summary> \r\npublic static string DeleteRazorFunctionWorkflow_ConfirmDeleteTitle=>T(\"DeleteRazorFunctionWorkflow.ConfirmDeleteTitle\");\r\n///<summary>&quot;Delete the selected Razor function?&quot;</summary> \r\npublic static string DeleteRazorFunctionWorkflow_ConfirmDeleteMessage=>T(\"DeleteRazorFunctionWorkflow.ConfirmDeleteMessage\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorFunction\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_RazorPageTemplate {\r\n///<summary>&quot;Edit Razor File&quot;</summary> \r\npublic static string EditRazorFileAction_Label=>T(\"EditRazorFileAction.Label\");\r\n///<summary>&quot;Edit the cshtml file&quot;</summary> \r\npublic static string EditRazorFileAction_ToolTip=>T(\"EditRazorFileAction.ToolTip\");\r\n///<summary>&quot;Edit Razor Template&quot;</summary> \r\npublic static string EditRazorTemplateAction_Label=>T(\"EditRazorTemplateAction.Label\");\r\n///<summary>&quot;Edit the cshtml file behind the template&quot;</summary> \r\npublic static string EditRazorTemplateAction_ToolTip=>T(\"EditRazorTemplateAction.ToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteRazorPageTemplateAction_Label=>T(\"DeleteRazorPageTemplateAction.Label\");\r\n///<summary>&quot;Delete page template&quot;</summary> \r\npublic static string DeleteRazorPageTemplateAction_ToolTip=>T(\"DeleteRazorPageTemplateAction.ToolTip\");\r\n///<summary>&quot;Add New Razor Template&quot;</summary> \r\npublic static string AddNewRazorPageTemplate_LabelDialog=>T(\"AddNewRazorPageTemplate.LabelDialog\");\r\n///<summary>&quot;Template Title&quot;</summary> \r\npublic static string AddNewRazorPageTemplate_LabelTemplateTitle=>T(\"AddNewRazorPageTemplate.LabelTemplateTitle\");\r\n///<summary>&quot;The title identifies this template in lists. Consider selecting a short but meaningful name.&quot;</summary> \r\npublic static string AddNewRazorPageTemplate_LabelTemplateTitleHelp=>T(\"AddNewRazorPageTemplate.LabelTemplateTitleHelp\");\r\n///<summary>&quot;Copy from&quot;</summary> \r\npublic static string AddNewRazorPageTemplate_LabelCopyFrom=>T(\"AddNewRazorPageTemplate.LabelCopyFrom\");\r\n///<summary>&quot;You can copy the markup from another Layout Template by selecting it in this list.&quot;</summary> \r\npublic static string AddNewRazorPageTemplate_LabelCopyFromHelp=>T(\"AddNewRazorPageTemplate.LabelCopyFromHelp\");\r\n///<summary>&quot;(New template)&quot;</summary> \r\npublic static string AddNewRazorPageTemplate_LabelCopyFromEmptyOption=>T(\"AddNewRazorPageTemplate.LabelCopyFromEmptyOption\");\r\n///<summary>&quot;Title already used&quot;</summary> \r\npublic static string AddNewRazorPageTemplateWorkflow_TitleInUseTitle=>T(\"AddNewRazorPageTemplateWorkflow.TitleInUseTitle\");\r\n///<summary>&quot;The title is too long (used as part of the .cshtml filename).&quot;</summary> \r\npublic static string AddNewRazorPageTemplateWorkflow_TitleTooLong=>T(\"AddNewRazorPageTemplateWorkflow.TitleTooLong\");\r\n///<summary>&quot;Validation error&quot;</summary> \r\npublic static string EditTemplate_Validation_DialogTitle=>T(\"EditTemplate.Validation.DialogTitle\");\r\n///<summary>&quot;Compilation failed: {0}&quot;</summary> \r\npublic static string EditTemplate_Validation_CompilationFailed_Template=>T(\"EditTemplate.Validation.CompilationFailed\");\r\n///<summary>&quot;Compilation failed: {0}&quot;</summary> \r\npublic static string EditTemplate_Validation_CompilationFailed(object parameter0)=>string.Format(T(\"EditTemplate.Validation.CompilationFailed\"), parameter0);\r\n///<summary>&quot;Page template class does not inherit &apos;{0}&apos;&quot;</summary> \r\npublic static string EditTemplate_Validation_IncorrectBaseClass_Template=>T(\"EditTemplate.Validation.IncorrectBaseClass\");\r\n///<summary>&quot;Page template class does not inherit &apos;{0}&apos;&quot;</summary> \r\npublic static string EditTemplate_Validation_IncorrectBaseClass(object parameter0)=>string.Format(T(\"EditTemplate.Validation.IncorrectBaseClass\"), parameter0);\r\n///<summary>&quot;Failed to evaluate page template property &apos;{0}&apos;. Excepton: {1}&quot;</summary> \r\npublic static string EditTemplate_Validation_PropertyError_Template=>T(\"EditTemplate.Validation.PropertyError\");\r\n///<summary>&quot;Failed to evaluate page template property &apos;{0}&apos;. Excepton: {1}&quot;</summary> \r\npublic static string EditTemplate_Validation_PropertyError(object parameter0,object parameter1)=>string.Format(T(\"EditTemplate.Validation.PropertyError\"), parameter0,parameter1);\r\n///<summary>&quot;It is not allowed to change template id through current workflow. Original template id is &apos;{0}&apos;&quot;</summary> \r\npublic static string EditTemplate_Validation_TemplateIdChanged_Template=>T(\"EditTemplate.Validation.TemplateIdChanged\");\r\n///<summary>&quot;It is not allowed to change template id through current workflow. Original template id is &apos;{0}&apos;&quot;</summary> \r\npublic static string EditTemplate_Validation_TemplateIdChanged(object parameter0)=>string.Format(T(\"EditTemplate.Validation.TemplateIdChanged\"), parameter0);\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorPageTemplate\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_SqlFunction {\r\n///<summary>&quot;SQL Functions&quot;</summary> \r\npublic static string SqlFunctionElementProvider_RootLabel=>T(\"SqlFunctionElementProvider.RootLabel\");\r\n///<summary>&quot;Add Connections and then queries to connections&quot;</summary> \r\npublic static string SqlFunctionElementProvider_RootLabelToolTip=>T(\"SqlFunctionElementProvider.RootLabelToolTip\");\r\n///<summary>&quot;Add SQL Connection&quot;</summary> \r\npublic static string SqlFunctionElementProvider_AddConnection=>T(\"SqlFunctionElementProvider.AddConnection\");\r\n///<summary>&quot;Add new SQL connection&quot;</summary> \r\npublic static string SqlFunctionElementProvider_AddConnectionToolTip=>T(\"SqlFunctionElementProvider.AddConnectionToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string SqlFunctionElementProvider_EditConnection=>T(\"SqlFunctionElementProvider.EditConnection\");\r\n///<summary>&quot;Edit SQL connection&quot;</summary> \r\npublic static string SqlFunctionElementProvider_EditConnectionToolTip=>T(\"SqlFunctionElementProvider.EditConnectionToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string SqlFunctionElementProvider_DeleteConnection=>T(\"SqlFunctionElementProvider.DeleteConnection\");\r\n///<summary>&quot;Delete SQL connection&quot;</summary> \r\npublic static string SqlFunctionElementProvider_DeleteConnectionToolTip=>T(\"SqlFunctionElementProvider.DeleteConnectionToolTip\");\r\n///<summary>&quot;Add New SQL Query&quot;</summary> \r\npublic static string SqlFunctionElementProvider_AddQuery=>T(\"SqlFunctionElementProvider.AddQuery\");\r\n///<summary>&quot;Add a new SQL XML Provider&quot;</summary> \r\npublic static string SqlFunctionElementProvider_AddQueryToolTip=>T(\"SqlFunctionElementProvider.AddQueryToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string SqlFunctionElementProvider_EditQuery=>T(\"SqlFunctionElementProvider.EditQuery\");\r\n///<summary>&quot;Edit SQL Query&quot;</summary> \r\npublic static string SqlFunctionElementProvider_EditQueryToolTip=>T(\"SqlFunctionElementProvider.EditQueryToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string SqlFunctionElementProvider_DeleteQuery=>T(\"SqlFunctionElementProvider.DeleteQuery\");\r\n///<summary>&quot;Delete SQL Query&quot;</summary> \r\npublic static string SqlFunctionElementProvider_DeleteQueryToolTip=>T(\"SqlFunctionElementProvider.DeleteQueryToolTip\");\r\n///<summary>&quot;Add New SQL Query&quot;</summary> \r\npublic static string AddNewSqlFunction_LabelDialog=>T(\"AddNewSqlFunction.LabelDialog\");\r\n///<summary>&quot;Function naming&quot;</summary> \r\npublic static string AddNewSqlFunction_LabelNamingPanel=>T(\"AddNewSqlFunction.LabelNamingPanel\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string AddNewSqlFunction_LabelName=>T(\"AddNewSqlFunction.LabelName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewSqlFunction_HelpName=>T(\"AddNewSqlFunction.HelpName\");\r\n///<summary>&quot;Namespace&quot;</summary> \r\npublic static string AddNewSqlFunction_LabelNamespace=>T(\"AddNewSqlFunction.LabelNamespace\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewSqlFunction_HelpNamespace=>T(\"AddNewSqlFunction.HelpNamespace\");\r\n///<summary>&quot;SQL command text&quot;</summary> \r\npublic static string AddNewSqlFunction_LabelQueryCOmmand=>T(\"AddNewSqlFunction.LabelQueryCOmmand\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewSqlFunction_HelpQueryCOmmand=>T(\"AddNewSqlFunction.HelpQueryCOmmand\");\r\n///<summary>&quot;Is a Stored Procedure&quot;</summary> \r\npublic static string AddEditSqlFunction_LabelIsStoredProcedure=>T(\"AddEditSqlFunction.LabelIsStoredProcedure\");\r\n///<summary>&quot;Yes, the command is a procedure&quot;</summary> \r\npublic static string AddEditSqlFunction_LabelIsStoredProcedureCheckBox=>T(\"AddEditSqlFunction.LabelIsStoredProcedureCheckBox\");\r\n///<summary>&quot;Returns result as XML&quot;</summary> \r\npublic static string AddEditSqlFunction_LabelReturnsXml=>T(\"AddEditSqlFunction.LabelReturnsXml\");\r\n///<summary>&quot;Yes, the command returns XML&quot;</summary> \r\npublic static string AddEditSqlFunction_LabelReturnsXmlCheckBox=>T(\"AddEditSqlFunction.LabelReturnsXmlCheckBox\");\r\n///<summary>&quot;Is a query&quot;</summary> \r\npublic static string AddEditSqlFunction_LabelIsQuery=>T(\"AddEditSqlFunction.LabelIsQuery\");\r\n///<summary>&quot;Yes, the command returns data&quot;</summary> \r\npublic static string AddEditSqlFunction_LabelIsQueryCheckBox=>T(\"AddEditSqlFunction.LabelIsQueryCheckBox\");\r\n///<summary>&quot;SQL Command behaviour&quot;</summary> \r\npublic static string AddEditSqlFunction_LabelCommandBehaviour=>T(\"AddEditSqlFunction.LabelCommandBehaviour\");\r\n///<summary>&quot;SQL Command&quot;</summary> \r\npublic static string AddEditSqlFunction_LabelSqlEditor=>T(\"AddEditSqlFunction.LabelSqlEditor\");\r\n///<summary>&quot;Add New SQL Connection&quot;</summary> \r\npublic static string AddNewSqlFunctionConnection_LabelDialog=>T(\"AddNewSqlFunctionConnection.LabelDialog\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string AddNewSqlFunctionConnection_LabelName=>T(\"AddNewSqlFunctionConnection.LabelName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewSqlFunctionConnection_HelpName=>T(\"AddNewSqlFunctionConnection.HelpName\");\r\n///<summary>&quot;Connection String&quot;</summary> \r\npublic static string AddNewSqlFunctionConnection_LabelConnectionString=>T(\"AddNewSqlFunctionConnection.LabelConnectionString\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewSqlFunctionConnection_HelpConnectionString=>T(\"AddNewSqlFunctionConnection.HelpConnectionString\");\r\n///<summary>&quot;MS SQL Server&quot;</summary> \r\npublic static string AddNewSqlFunctionConnection_LabelIsMSSQL=>T(\"AddNewSqlFunctionConnection.LabelIsMSSQL\");\r\n///<summary>&quot;Database is a MS SQL Server&quot;</summary> \r\npublic static string AddNewSqlFunctionConnection_LabelIsMSSQLCheckBox=>T(\"AddNewSqlFunctionConnection.LabelIsMSSQLCheckBox\");\r\n///<summary>&quot;SQL Connection settings&quot;</summary> \r\npublic static string EditSqlFunctionConnection_LabelFieldGroup=>T(\"EditSqlFunctionConnection.LabelFieldGroup\");\r\n///<summary>&quot;Input Parameters&quot;</summary> \r\npublic static string EditSqlFunction_LabelInputParameters=>T(\"EditSqlFunction.LabelInputParameters\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string EditSqlFunction_LabelSettings=>T(\"EditSqlFunction.LabelSettings\");\r\n///<summary>&quot;Function name and description&quot;</summary> \r\npublic static string EditSqlFunction_LabelNamingAndDescription=>T(\"EditSqlFunction.LabelNamingAndDescription\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string EditSqlFunction_LabelName=>T(\"EditSqlFunction.LabelName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string EditSqlFunction_HelpName=>T(\"EditSqlFunction.HelpName\");\r\n///<summary>&quot;Namespace&quot;</summary> \r\npublic static string EditSqlFunction_LabelNamespace=>T(\"EditSqlFunction.LabelNamespace\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string EditSqlFunction_HelpNamespace=>T(\"EditSqlFunction.HelpNamespace\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string EditSqlFunction_LabelDescription=>T(\"EditSqlFunction.LabelDescription\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string EditSqlFunction_HelpDescription=>T(\"EditSqlFunction.HelpDescription\");\r\n///<summary>&quot;Preview&quot;</summary> \r\npublic static string EditSqlFunction_LabelPreview=>T(\"EditSqlFunction.LabelPreview\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string EditSqlFunctionConnection_LabelName=>T(\"EditSqlFunctionConnection.LabelName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string EditSqlFunctionConnection_HelpName=>T(\"EditSqlFunctionConnection.HelpName\");\r\n///<summary>&quot;Connection String&quot;</summary> \r\npublic static string EditSqlFunctionConnection_LabelConnectionString=>T(\"EditSqlFunctionConnection.LabelConnectionString\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string EditSqlFunctionConnection_HelpConnectionString=>T(\"EditSqlFunctionConnection.HelpConnectionString\");\r\n///<summary>&quot;MS SQL Server&quot;</summary> \r\npublic static string EditSqlFunctionConnection_LabelIsMSSQL=>T(\"EditSqlFunctionConnection.LabelIsMSSQL\");\r\n///<summary>&quot;Database is a MS SQL Server&quot;</summary> \r\npublic static string EditSqlFunctionConnection_LabelIsMSSQLCheckBox=>T(\"EditSqlFunctionConnection.LabelIsMSSQLCheckBox\");\r\n///<summary>&quot;Delete This SQL Connection?&quot;</summary> \r\npublic static string DeleteSqlConnection_LabelFieldGroup=>T(\"DeleteSqlConnection.LabelFieldGroup\");\r\n///<summary>&quot;Delete this SQL connection?&quot;</summary> \r\npublic static string DeleteSqlConnection_Text=>T(\"DeleteSqlConnection.Text\");\r\n///<summary>&quot;Delete This SQL Function?&quot;</summary> \r\npublic static string DeleteSqlFunction_LabelFieldGroup=>T(\"DeleteSqlFunction.LabelFieldGroup\");\r\n///<summary>&quot;Delete this SQL function?&quot;</summary> \r\npublic static string DeleteSqlFunction_Text=>T(\"DeleteSqlFunction.Text\");\r\n///<summary>&quot;Cascade Delete Error&quot;</summary> \r\npublic static string CascadeDeleteErrorTitle=>T(\"CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string CascadeDeleteErrorMessage=>T(\"CascadeDeleteErrorMessage\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_StandardFunctions {\r\n///<summary>&quot;Loads an ASP.NET User Control&quot;</summary> \r\npublic static string Composite_AspNet_LoadUserControl_description=>T(\"Composite.AspNet.LoadUserControl.description\");\r\n///<summary>&quot;The path to the User Controls .ascx file, like “~/Controls/MyControl.ascx”&quot;</summary> \r\npublic static string Composite_AspNet_LoadUserControl_param_Path_help=>T(\"Composite.AspNet.LoadUserControl.param.Path.help\");\r\n///<summary>&quot;Path&quot;</summary> \r\npublic static string Composite_AspNet_LoadUserControl_param_Path_label=>T(\"Composite.AspNet.LoadUserControl.param.Path.label\");\r\n///<summary>&quot;Lets you specify constant boolean value&quot;</summary> \r\npublic static string Composite_Constant_Boolean_description=>T(\"Composite.Constant.Boolean.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Constant_Boolean_param_Constant_help=>T(\"Composite.Constant.Boolean.param.Constant.help\");\r\n///<summary>&quot;Value&quot;</summary> \r\npublic static string Composite_Constant_Boolean_param_Constant_label=>T(\"Composite.Constant.Boolean.param.Constant.label\");\r\n///<summary>&quot;Lets you specify constant date and time value&quot;</summary> \r\npublic static string Composite_Constant_DateTime_description=>T(\"Composite.Constant.DateTime.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Constant_DateTime_param_Constant_help=>T(\"Composite.Constant.DateTime.param.Constant.help\");\r\n///<summary>&quot;Value&quot;</summary> \r\npublic static string Composite_Constant_DateTime_param_Constant_label=>T(\"Composite.Constant.DateTime.param.Constant.label\");\r\n///<summary>&quot;Lets you specify constant decimal value&quot;</summary> \r\npublic static string Composite_Constant_Decimal_description=>T(\"Composite.Constant.Decimal.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Constant_Decimal_param_Constant_help=>T(\"Composite.Constant.Decimal.param.Constant.help\");\r\n///<summary>&quot;Value&quot;</summary> \r\npublic static string Composite_Constant_Decimal_param_Constant_label=>T(\"Composite.Constant.Decimal.param.Constant.label\");\r\n///<summary>&quot;Lets you specify constant Guid value&quot;</summary> \r\npublic static string Composite_Constant_Guid_description=>T(\"Composite.Constant.Guid.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Constant_Guid_param_Constant_help=>T(\"Composite.Constant.Guid.param.Constant.help\");\r\n///<summary>&quot;Value&quot;</summary> \r\npublic static string Composite_Constant_Guid_param_Constant_label=>T(\"Composite.Constant.Guid.param.Constant.label\");\r\n///<summary>&quot;Lets you specify constant integer value&quot;</summary> \r\npublic static string Composite_Constant_Integer_description=>T(\"Composite.Constant.Integer.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Constant_Integer_param_Constant_help=>T(\"Composite.Constant.Integer.param.Constant.help\");\r\n///<summary>&quot;Value&quot;</summary> \r\npublic static string Composite_Constant_Integer_param_Constant_label=>T(\"Composite.Constant.Integer.param.Constant.label\");\r\n///<summary>&quot;Lets you specify constant string value&quot;</summary> \r\npublic static string Composite_Constant_String_description=>T(\"Composite.Constant.String.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Constant_String_param_Constant_help=>T(\"Composite.Constant.String.param.Constant.help\");\r\n///<summary>&quot;Value&quot;</summary> \r\npublic static string Composite_Constant_String_param_Constant_label=>T(\"Composite.Constant.String.param.Constant.label\");\r\n///<summary>&quot;Lets you visually specify a Xhtml document constant&quot;</summary> \r\npublic static string Composite_Constant_XhtmlDocument_description=>T(\"Composite.Constant.XhtmlDocument.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Constant_XhtmlDocument_param_Constant_help=>T(\"Composite.Constant.XhtmlDocument.param.Constant.help\");\r\n///<summary>&quot;Value&quot;</summary> \r\npublic static string Composite_Constant_XhtmlDocument_param_Constant_label=>T(\"Composite.Constant.XhtmlDocument.param.Constant.label\");\r\n///<summary>&quot;Adds a new instance of the given type.&quot;</summary> \r\npublic static string Composite_IDataGenerated_AddDataInstance_description=>T(\"Composite.IDataGenerated.AddDataInstance.description\");\r\n///<summary>&quot;Updates instance(s) with the given values.&quot;</summary> \r\npublic static string Composite_IDataGenerated_UpdateDataInstance_description=>T(\"Composite.IDataGenerated.UpdateDataInstance.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_IDataGenerated_UpdateDataInstance_param_Filter_help=>T(\"Composite.IDataGenerated.UpdateDataInstance.param.Filter.help\");\r\n///<summary>&quot;Filter&quot;</summary> \r\npublic static string Composite_IDataGenerated_UpdateDataInstance_param_Filter_label=>T(\"Composite.IDataGenerated.UpdateDataInstance.param.Filter.label\");\r\n///<summary>&quot;Deletes instance(s) with the given filter.&quot;</summary> \r\npublic static string Composite_IDataGenerated_DeleteDataInstance_description=>T(\"Composite.IDataGenerated.DeleteDataInstance.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_IDataGenerated_DeleteDataInstance_param_Filter_help=>T(\"Composite.IDataGenerated.DeleteDataInstance.param.Filter.help\");\r\n///<summary>&quot;Filter&quot;</summary> \r\npublic static string Composite_IDataGenerated_DeleteDataInstance_param_Filter_label=>T(\"Composite.IDataGenerated.DeleteDataInstance.param.Filter.label\");\r\n///<summary>&quot;Creates a DataReference based on a key value.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetDataReference_description=>T(\"Composite.IDataGenerated.GetDataReference.description\");\r\n///<summary>&quot;The key value of the data to reference.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetDataReference_param_KeyValue_help=>T(\"Composite.IDataGenerated.GetDataReference.param.KeyValue.help\");\r\n///<summary>&quot;Key value&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetDataReference_param_KeyValue_label=>T(\"Composite.IDataGenerated.GetDataReference.param.KeyValue.label\");\r\n///<summary>&quot;Creates a NullableDataReference based on a key value. The default value is &apos;null&apos;, no reference.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetNullableDataReference_description=>T(\"Composite.IDataGenerated.GetNullableDataReference.description\");\r\n///<summary>&quot;The key value of the data to reference.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetNullableDataReference_param_KeyValue_help=>T(\"Composite.IDataGenerated.GetNullableDataReference.param.KeyValue.help\");\r\n///<summary>&quot;Key value&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetNullableDataReference_param_KeyValue_label=>T(\"Composite.IDataGenerated.GetNullableDataReference.param.KeyValue.label\");\r\n///<summary>&quot;Converts a DataReference into a single element filter. This filter will select a maximum of one item.&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_DataReferenceFilter_description=>T(\"Composite.IDataGenerated.Filter.DataReferenceFilter.description\");\r\n///<summary>&quot;The Data Reference to use when selecting data.&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_DataReferenceFilter_param_DataReference_help=>T(\"Composite.IDataGenerated.Filter.DataReferenceFilter.param.DataReference.help\");\r\n///<summary>&quot;Data Reference&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_DataReferenceFilter_param_DataReference_label=>T(\"Composite.IDataGenerated.Filter.DataReferenceFilter.param.DataReference.label\");\r\n///<summary>&quot;Lets you select data based on its reference to the currently rendered page.&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_ActivePageReferenceFilter_description=>T(\"Composite.IDataGenerated.Filter.ActivePageReferenceFilter.description\");\r\n///<summary>&quot;Select what relation the current page must have with the data you wish to retrieve.&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_ActivePageReferenceFilter_param_SitemapScope_help=>T(\"Composite.IDataGenerated.Filter.ActivePageReferenceFilter.param.SitemapScope.help\");\r\n///<summary>&quot;Page scope&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_ActivePageReferenceFilter_param_SitemapScope_label=>T(\"Composite.IDataGenerated.Filter.ActivePageReferenceFilter.param.SitemapScope.label\");\r\n///<summary>&quot;Defines an “and” or “or” query, combining two other filters.&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_CompoundFilter_description=>T(\"Composite.IDataGenerated.Filter.CompoundFilter.description\");\r\n///<summary>&quot;And / or filter&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_CompoundFilter_param_IsAndQuery_label=>T(\"Composite.IDataGenerated.Filter.CompoundFilter.param.IsAndQuery.label\");\r\n///<summary>&quot;If you select “And” both filters are applied to the data. Selecting “Or” will give you the data that matches just one of the filters.&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_CompoundFilter_param_IsAndQuery_help=>T(\"Composite.IDataGenerated.Filter.CompoundFilter.param.IsAndQuery.help\");\r\n///<summary>&quot;One of the two filters (the one to evaluate first)&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_CompoundFilter_param_Left_help=>T(\"Composite.IDataGenerated.Filter.CompoundFilter.param.Left.help\");\r\n///<summary>&quot;Left filter&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_CompoundFilter_param_Left_label=>T(\"Composite.IDataGenerated.Filter.CompoundFilter.param.Left.label\");\r\n///<summary>&quot;One of the two filters (the one to evaluate last)&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_CompoundFilter_param_Right_help=>T(\"Composite.IDataGenerated.Filter.CompoundFilter.param.Right.help\");\r\n///<summary>&quot;Right filter&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_CompoundFilter_param_Right_label=>T(\"Composite.IDataGenerated.Filter.CompoundFilter.param.Right.label\");\r\n///<summary>&quot;Lets you specify a filter on data by specifying requirements for the individual fields. If you set requirements on multiple fields, they are all enforced (and query).&quot;</summary> \r\npublic static string Composite_IDataGenerated_Filter_FieldPredicatesFilter_description=>T(\"Composite.IDataGenerated.Filter.FieldPredicatesFilter.description\");\r\n///<summary>&quot;Retrieves an XML representation of the data. &quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_description=>T(\"Composite.IDataGenerated.GetXml.description\");\r\n///<summary>&quot;Element name&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_ElementName_label=>T(\"Composite.IDataGenerated.GetXml.param.ElementName.label\");\r\n///<summary>&quot;Element namespace&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_ElementNamespace_label=>T(\"Composite.IDataGenerated.GetXml.param.ElementNamespace.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_Filter_help=>T(\"Composite.IDataGenerated.GetXml.param.Filter.help\");\r\n///<summary>&quot;Filter&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_Filter_label=>T(\"Composite.IDataGenerated.GetXml.param.Filter.label\");\r\n///<summary>&quot;When selected the data XML will be preceded by a &lt;PagingInfo /&gt; element detailing number of pages, items and more.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_IncludePagingInfo_help=>T(\"Composite.IDataGenerated.GetXml.param.IncludePagingInfo.help\");\r\n///<summary>&quot;Include paging info&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_IncludePagingInfo_label=>T(\"Composite.IDataGenerated.GetXml.param.IncludePagingInfo.label\");\r\n///<summary>&quot;The field to order data by&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_OrderByField_help=>T(\"Composite.IDataGenerated.GetXml.param.OrderByField.help\");\r\n///<summary>&quot;Order by&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_OrderByField_label=>T(\"Composite.IDataGenerated.GetXml.param.OrderByField.label\");\r\n///<summary>&quot;When set to true results are delivered in ascending order, otherwise descending order is used. Default is ascending order.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_OrderAscending_help=>T(\"Composite.IDataGenerated.GetXml.param.OrderAscending.help\");\r\n///<summary>&quot;Order ascending&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_OrderAscending_label=>T(\"Composite.IDataGenerated.GetXml.param.OrderAscending.label\");\r\n///<summary>&quot;If the number of data elements exceed the page size you can use paging to move to the other pages. See the Page size parameter.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_PageNumber_help=>T(\"Composite.IDataGenerated.GetXml.param.PageNumber.help\");\r\n///<summary>&quot;Page number&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_PageNumber_label=>T(\"Composite.IDataGenerated.GetXml.param.PageNumber.label\");\r\n///<summary>&quot;The number of items to display on one page – the maximum number of elements to return. &quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_PageSize_help=>T(\"Composite.IDataGenerated.GetXml.param.PageSize.help\");\r\n///<summary>&quot;Page size&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_PageSize_label=>T(\"Composite.IDataGenerated.GetXml.param.PageSize.label\");\r\n///<summary>&quot;The data fields to output in the XML. Fewer fields can yield faster renderings.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_PropertyNames_help=>T(\"Composite.IDataGenerated.GetXml.param.PropertyNames.help\");\r\n///<summary>&quot;Selected fields&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_PropertyNames_label=>T(\"Composite.IDataGenerated.GetXml.param.PropertyNames.label\");\r\n///<summary>&quot;If you include reference data in the &apos;Selected properties&apos; setting, you can use this option to control how the referenced data is included. &apos;Inline&apos; is easy to use, but may bloat the size of the XML document.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_ShowReferencesInline_help=>T(\"Composite.IDataGenerated.GetXml.param.ShowReferencesInline.help\");\r\n///<summary>&quot;Show reference data inline&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_ShowReferencesInline_label=>T(\"Composite.IDataGenerated.GetXml.param.ShowReferencesInline.label\");\r\n///<summary>&quot;When true data can be ordered randomly. Specify the number of random results you require by setting the &apos;Page size&apos;. If a filter is specified, this is applied before the random selection. If you specify an &apos;Order by&apos; value, you should specify a low &apos;Page size&apos; or the randomization will become void.&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_Randomized_help=>T(\"Composite.IDataGenerated.GetXml.param.Randomized.help\");\r\n///<summary>&quot;Randomized&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_Randomized_label=>T(\"Composite.IDataGenerated.GetXml.param.Randomized.label\");\r\n///<summary>&quot;Determines if result XML has to be cached, and what priority those cache records should have&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_CachePriority_help=>T(\"Composite.IDataGenerated.GetXml.param.CachePriority.help\");\r\n///<summary>&quot;Cache Priority&quot;</summary> \r\npublic static string Composite_IDataGenerated_GetXml_param_CachePriority_label=>T(\"Composite.IDataGenerated.GetXml.param.CachePriority.label\");\r\n///<summary>&quot;Fetches the ID of the current page or a page relative to the current page.&quot;</summary> \r\npublic static string Composite_Pages_GetPageId_description=>T(\"Composite.Pages.GetPageId.description\");\r\n///<summary>&quot;What page to get id from. The default is from the current page.&quot;</summary> \r\npublic static string Composite_Pages_GetPageId_param_SitemapScope_help=>T(\"Composite.Pages.GetPageId.param.SitemapScope.help\");\r\n///<summary>&quot;Page association&quot;</summary> \r\npublic static string Composite_Pages_GetPageId_param_SitemapScope_label=>T(\"Composite.Pages.GetPageId.param.SitemapScope.label\");\r\n///<summary>&quot;Quick and raw sitemap xhtml.&quot;</summary> \r\npublic static string Composite_Pages_QuickSitemap_description=>T(\"Composite.Pages.QuickSitemap.description\");\r\n///<summary>&quot;Returns a hierarchical XML structure of pages. When executed as part of a page rendering XML elements representing the current and ancestor pages will be appended the attributes isopen=”true” and iscurrent=”true”&quot;</summary> \r\npublic static string Composite_Pages_SitemapXml_description=>T(\"Composite.Pages.SitemapXml.description\");\r\n///<summary>&quot;Source page&quot;</summary> \r\npublic static string Composite_Pages_SitemapXml_param_SourcePage_label=>T(\"Composite.Pages.SitemapXml.param.SourcePage.label\");\r\n///<summary>&quot;By default the source page is the page currently being rendered. Specify a value if you want to get sitemap information relative to another page. The source page controls how page elements are annotated with &apos;isopen&apos; and &apos;iscurrent&apos; and is the starting point when calculating the page scope.&quot;</summary> \r\npublic static string Composite_Pages_SitemapXml_param_SourcePage_help=>T(\"Composite.Pages.SitemapXml.param.SourcePage.help\");\r\n///<summary>&quot;Page scope&quot;</summary> \r\npublic static string Composite_Pages_SitemapXml_param_SitemapScope_label=>T(\"Composite.Pages.SitemapXml.param.SitemapScope.label\");\r\n///<summary>&quot;The scope of pages to extract from the sitemap. The default is &apos;all pages&apos;. You can use this parameter to extract the structure you need to complete your task.&quot;</summary> \r\npublic static string Composite_Pages_SitemapXml_param_SitemapScope_help=>T(\"Composite.Pages.SitemapXml.param.SitemapScope.help\");\r\n///<summary>&quot;Gets information about current page in all the languages.&quot;</summary> \r\npublic static string Composite_Pages_GetForeignPageInfo_description=>T(\"Composite.Pages.GetForeignPageInfo.description\");\r\n///<summary>&quot;Defines a &apos;cache zone&apos; around a function call or markup (typically containing function calls). This function can be used to enhance page rendering performance by caching sections of a web page. The &apos;Object Cache Id&apos; value should be unique to the content being cached.&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_description=>T(\"Composite.Utils.Caching.PageObjectCache.description\");\r\n///<summary>&quot;Object to cache&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_ObjectToCache_label=>T(\"Composite.Utils.Caching.PageObjectCache.param.ObjectToCache.label\");\r\n///<summary>&quot;What you want to cache - this can be a single function call or a section of markup containing one or more function calls.&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_ObjectToCache_help=>T(\"Composite.Utils.Caching.PageObjectCache.param.ObjectToCache.help\");\r\n///<summary>&quot;Unique cache id&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_ObjectCacheId_label=>T(\"Composite.Utils.Caching.PageObjectCache.param.ObjectCacheId.label\");\r\n///<summary>&quot;Specify an ID unique to the content being cached. This value is used - in conjunction with the Page scope - to define a unique cache key.&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_ObjectCacheId_help=>T(\"Composite.Utils.Caching.PageObjectCache.param.ObjectCacheId.help\");\r\n///<summary>&quot;Page scope&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_SitemapScope_label=>T(\"Composite.Utils.Caching.PageObjectCache.param.SitemapScope.label\");\r\n///<summary>&quot;The page scope the cached data should be shared on. By default the page scope is &apos;this website&apos;, but you can change it to page specific caching and more.&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_SitemapScope_help=>T(\"Composite.Utils.Caching.PageObjectCache.param.SitemapScope.help\");\r\n///<summary>&quot;Cache duration (seconds)&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_SecondsToCache_label=>T(\"Composite.Utils.Caching.PageObjectCache.param.SecondsToCache.label\");\r\n///<summary>&quot;The number of seconds the cached object should be reused. Default is 1 minute (60 seconds).&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_SecondsToCache_help=>T(\"Composite.Utils.Caching.PageObjectCache.param.SecondsToCache.help\");\r\n///<summary>&quot;Language specific&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_LanguageSpecific_label=>T(\"Composite.Utils.Caching.PageObjectCache.param.LanguageSpecific.label\");\r\n///<summary>&quot;Choose if the cached object should be uniquely cached per website language or commonly shared among languages.&quot;</summary> \r\npublic static string Composite_Utils_Caching_PageObjectCache_param_LanguageSpecific_help=>T(\"Composite.Utils.Caching.PageObjectCache.param.LanguageSpecific.help\");\r\n///<summary>&quot;AreEqual&quot;</summary> \r\npublic static string Composite_Utils_Compare_AreEqual_description=>T(\"Composite.Utils.Compare.AreEqual.description\");\r\n///<summary>&quot;Compares two objects for equality. Returns true if the two objects are equal.&quot;</summary> \r\npublic static string Composite_Utils_Compare_AreEqual_param_ValueA_help=>T(\"Composite.Utils.Compare.AreEqual.param.ValueA.help\");\r\n///<summary>&quot;Value A to compare.&quot;</summary> \r\npublic static string Composite_Utils_Compare_AreEqual_param_ValueA_label=>T(\"Composite.Utils.Compare.AreEqual.param.ValueA.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Compare_AreEqual_param_ValueB_help=>T(\"Composite.Utils.Compare.AreEqual.param.ValueB.help\");\r\n///<summary>&quot;Value B to compare.&quot;</summary> \r\npublic static string Composite_Utils_Compare_AreEqual_param_ValueB_label=>T(\"Composite.Utils.Compare.AreEqual.param.ValueB.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Compare_IsLessThan_description=>T(\"Composite.Utils.Compare.IsLessThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Compare_IsLessThan_param_ValueA_help=>T(\"Composite.Utils.Compare.IsLessThan.param.ValueA.help\");\r\n///<summary>&quot;Value A to compare.&quot;</summary> \r\npublic static string Composite_Utils_Compare_IsLessThan_param_ValueA_label=>T(\"Composite.Utils.Compare.IsLessThan.param.ValueA.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Compare_IsLessThan_param_ValueB_help=>T(\"Composite.Utils.Compare.IsLessThan.param.ValueB.help\");\r\n///<summary>&quot;Value B to compare.&quot;</summary> \r\npublic static string Composite_Utils_Compare_IsLessThan_param_ValueB_label=>T(\"Composite.Utils.Compare.IsLessThan.param.ValueB.label\");\r\n///<summary>&quot;Reads a string from the application configuration file (web.config or app.config)&quot;</summary> \r\npublic static string Composite_Utils_Configuration_AppSettingsValue_description=>T(\"Composite.Utils.Configuration.AppSettingsValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Configuration_AppSettingsValue_param_KeyName_help=>T(\"Composite.Utils.Configuration.AppSettingsValue.param.KeyName.help\");\r\n///<summary>&quot;Key Name&quot;</summary> \r\npublic static string Composite_Utils_Configuration_AppSettingsValue_param_KeyName_label=>T(\"Composite.Utils.Configuration.AppSettingsValue.param.KeyName.label\");\r\n///<summary>&quot;Add a number of days to the current date and get the resulting date.&quot;</summary> \r\npublic static string Composite_Utils_Date_AddDays_description=>T(\"Composite.Utils.Date.AddDays.description\");\r\n///<summary>&quot;Specify a negative or positive number of days to add to the current date.&quot;</summary> \r\npublic static string Composite_Utils_Date_AddDays_param_DaysToAdd_help=>T(\"Composite.Utils.Date.AddDays.param.DaysToAdd.help\");\r\n///<summary>&quot;Days to add&quot;</summary> \r\npublic static string Composite_Utils_Date_AddDays_param_DaysToAdd_label=>T(\"Composite.Utils.Date.AddDays.param.DaysToAdd.label\");\r\n///<summary>&quot;The current date and time&quot;</summary> \r\npublic static string Composite_Utils_Date_Now_description=>T(\"Composite.Utils.Date.Now.description\");\r\n///<summary>&quot;Returns an input parameter from executing function context. Use this in developing to copy an input value to a new function call.&quot;</summary> \r\npublic static string Composite_Utils_GetInputParameter_description=>T(\"Composite.Utils.GetInputParameter.description\");\r\n///<summary>&quot;Specify the name of the input parameter which value you wish to use here.&quot;</summary> \r\npublic static string Composite_Utils_GetInputParameter_param_InputParameterName_help=>T(\"Composite.Utils.GetInputParameter.param.InputParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Utils_GetInputParameter_param_InputParameterName_label=>T(\"Composite.Utils.GetInputParameter.param.InputParameterName.label\");\r\n///<summary>&quot;Parses a string into an object. The type of object depends on the receiver. Using this function to deliver a value to a DateTime parameter, will make the system parse the string as a DateTime etc.&quot;</summary> \r\npublic static string Composite_Utils_ParseStringToObject_description=>T(\"Composite.Utils.ParseStringToObject.description\");\r\n///<summary>&quot;Specify the string to parse. Note that the string must be formatted in a way that can be converted into the type of object that is expected.&quot;</summary> \r\npublic static string Composite_Utils_ParseStringToObject_param_StringToParse_help=>T(\"Composite.Utils.ParseStringToObject.param.StringToParse.help\");\r\n///<summary>&quot;String to parse&quot;</summary> \r\npublic static string Composite_Utils_ParseStringToObject_param_StringToParse_label=>T(\"Composite.Utils.ParseStringToObject.param.StringToParse.label\");\r\n///<summary>&quot;Returns a new random Guid.&quot;</summary> \r\npublic static string Composite_Utils_Guid_NewGuid_description=>T(\"Composite.Utils.Guid.NewGuid.description\");\r\n///<summary>&quot;A list of all cultures&quot;</summary> \r\npublic static string Composite_Utils_Globalization_AllCultures_description=>T(\"Composite.Utils.Globalization.AllCultures.description\");\r\n///<summary>&quot;The culture for the current user / request.&quot;</summary> \r\npublic static string Composite_Utils_Globalization_CurrentCulture_description=>T(\"Composite.Utils.Globalization.CurrentCulture.description\");\r\n///<summary>&quot;Returns the sum from a list of integers&quot;</summary> \r\npublic static string Composite_Utils_Integer_Sum_description=>T(\"Composite.Utils.Integer.Sum.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Integer_Sum_param_Ints_help=>T(\"Composite.Utils.Integer.Sum.param.Ints.help\");\r\n///<summary>&quot;Integer list&quot;</summary> \r\npublic static string Composite_Utils_Integer_Sum_param_Ints_label=>T(\"Composite.Utils.Integer.Sum.param.Ints.label\");\r\n///<summary>&quot;Check if a boolean is true or false. &quot;</summary> \r\npublic static string Composite_Utils_Predicates_BoolEquals_description=>T(\"Composite.Utils.Predicates.BoolEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_BoolEquals_param_Value_help=>T(\"Composite.Utils.Predicates.BoolEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_BoolEquals_param_Value_label=>T(\"Composite.Utils.Predicates.BoolEquals.param.Value.label\");\r\n///<summary>&quot;Check if a date equals a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeEquals_description=>T(\"Composite.Utils.Predicates.DateTimeEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeEquals_param_Value_help=>T(\"Composite.Utils.Predicates.DateTimeEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeEquals_param_Value_label=>T(\"Composite.Utils.Predicates.DateTimeEquals.param.Value.label\");\r\n///<summary>&quot;Check if a date is greater than a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeGreaterThan_description=>T(\"Composite.Utils.Predicates.DateTimeGreaterThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeGreaterThan_param_Value_help=>T(\"Composite.Utils.Predicates.DateTimeGreaterThan.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeGreaterThan_param_Value_label=>T(\"Composite.Utils.Predicates.DateTimeGreaterThan.param.Value.label\");\r\n///<summary>&quot;Check if a date is less than a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeLessThan_description=>T(\"Composite.Utils.Predicates.DateTimeLessThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeLessThan_param_Value_help=>T(\"Composite.Utils.Predicates.DateTimeLessThan.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DateTimeLessThan_param_Value_label=>T(\"Composite.Utils.Predicates.DateTimeLessThan.param.Value.label\");\r\n///<summary>&quot;Check is a decimal has a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalEquals_description=>T(\"Composite.Utils.Predicates.DecimalEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalEquals_param_Value_help=>T(\"Composite.Utils.Predicates.DecimalEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalEquals_param_Value_label=>T(\"Composite.Utils.Predicates.DecimalEquals.param.Value.label\");\r\n///<summary>&quot;Check if a decimal is greater than a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalGreaterThan_description=>T(\"Composite.Utils.Predicates.DecimalGreaterThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalGreaterThan_param_Value_help=>T(\"Composite.Utils.Predicates.DecimalGreaterThan.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalGreaterThan_param_Value_label=>T(\"Composite.Utils.Predicates.DecimalGreaterThan.param.Value.label\");\r\n///<summary>&quot;Check if a decimal is less than a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalLessThan_description=>T(\"Composite.Utils.Predicates.DecimalLessThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalLessThan_param_Value_help=>T(\"Composite.Utils.Predicates.DecimalLessThan.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_DecimalLessThan_param_Value_label=>T(\"Composite.Utils.Predicates.DecimalLessThan.param.Value.label\");\r\n///<summary>&quot;Check if a Guid equals a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_GuidEquals_description=>T(\"Composite.Utils.Predicates.GuidEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_GuidEquals_param_Value_help=>T(\"Composite.Utils.Predicates.GuidEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_GuidEquals_param_Value_label=>T(\"Composite.Utils.Predicates.GuidEquals.param.Value.label\");\r\n///<summary>&quot;Check if a Guid exists in a comma separated string list&quot;</summary> \r\npublic static string Composite_Utils_Predicates_GuidInCommaSeparatedList_description=>T(\"Composite.Utils.Predicates.GuidInCommaSeparatedList.description\");\r\n///<summary>&quot;List of Guid&quot;</summary> \r\npublic static string Composite_Utils_Predicates_GuidInCommaSeparatedList_param_CommaSeparatedGuids_label=>T(\"Composite.Utils.Predicates.GuidInCommaSeparatedList.param.CommaSeparatedGuids.label\");\r\n///<summary>&quot;A string containing zero or more Guids separated by commas&quot;</summary> \r\npublic static string Composite_Utils_Predicates_GuidInCommaSeparatedList_param_CommaSeparatedGuids_help=>T(\"Composite.Utils.Predicates.GuidInCommaSeparatedList.param.CommaSeparatedGuids.help\");\r\n///<summary>&quot;Check if a string field matches one of the terms in a comma separated string list&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInCommaSeparatedList_description=>T(\"Composite.Utils.Predicates.StringInCommaSeparatedList.description\");\r\n///<summary>&quot;Search terms&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInCommaSeparatedList_param_CommaSeparatedSearchTerms_label=>T(\"Composite.Utils.Predicates.StringInCommaSeparatedList.param.CommaSeparatedSearchTerms.label\");\r\n///<summary>&quot;A string containing search terms separated by commas, like &apos;c1,cms,linq&apos;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInCommaSeparatedList_param_CommaSeparatedSearchTerms_help=>T(\"Composite.Utils.Predicates.StringInCommaSeparatedList.param.CommaSeparatedSearchTerms.help\");\r\n///<summary>&quot;Ignore case&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInCommaSeparatedList_param_IgnoreCase_label=>T(\"Composite.Utils.Predicates.StringInCommaSeparatedList.param.IgnoreCase.label\");\r\n///<summary>&quot;When &apos;false&apos;, casing of the words must match exactly. Default is &apos;true&apos;, case insensitive search&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInCommaSeparatedList_param_IgnoreCase_help=>T(\"Composite.Utils.Predicates.StringInCommaSeparatedList.param.IgnoreCase.help\");\r\n///<summary>&quot;Check if a string field matches one of the strings in the supplied list&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInList_description=>T(\"Composite.Utils.Predicates.StringInList.description\");\r\n///<summary>&quot;Search terms&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInList_param_SearchTerms_label=>T(\"Composite.Utils.Predicates.StringInList.param.SearchTerms.label\");\r\n///<summary>&quot;A list of strings to match up against the searched string field.&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInList_param_SearchTerms_help=>T(\"Composite.Utils.Predicates.StringInList.param.SearchTerms.help\");\r\n///<summary>&quot;Ignore case&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInList_param_IgnoreCase_label=>T(\"Composite.Utils.Predicates.StringInList.param.IgnoreCase.label\");\r\n///<summary>&quot;When &apos;false&apos;, casing of the words must match exactly. Default is &apos;true&apos;, case insensitive search&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringInList_param_IgnoreCase_help=>T(\"Composite.Utils.Predicates.StringInList.param.IgnoreCase.help\");\r\n///<summary>&quot;Check if an integer equals a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerEquals_description=>T(\"Composite.Utils.Predicates.IntegerEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerEquals_param_Value_help=>T(\"Composite.Utils.Predicates.IntegerEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerEquals_param_Value_label=>T(\"Composite.Utils.Predicates.IntegerEquals.param.Value.label\");\r\n///<summary>&quot;Check if an integer is greater than a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerGreaterThan_description=>T(\"Composite.Utils.Predicates.IntegerGreaterThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerGreaterThan_param_Value_help=>T(\"Composite.Utils.Predicates.IntegerGreaterThan.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerGreaterThan_param_Value_label=>T(\"Composite.Utils.Predicates.IntegerGreaterThan.param.Value.label\");\r\n///<summary>&quot;Check if an integer is less than a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerLessThan_description=>T(\"Composite.Utils.Predicates.IntegerLessThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerLessThan_param_Value_help=>T(\"Composite.Utils.Predicates.IntegerLessThan.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_IntegerLessThan_param_Value_label=>T(\"Composite.Utils.Predicates.IntegerLessThan.param.Value.label\");\r\n///<summary>&quot;Check if a string contains a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringContains_description=>T(\"Composite.Utils.Predicates.StringContains.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringContains_param_Value_help=>T(\"Composite.Utils.Predicates.StringContains.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringContains_param_Value_label=>T(\"Composite.Utils.Predicates.StringContains.param.Value.label\");\r\n///<summary>&quot;Check if a string ends with a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringEndsWith_description=>T(\"Composite.Utils.Predicates.StringEndsWith.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringEndsWith_param_Value_help=>T(\"Composite.Utils.Predicates.StringEndsWith.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringEndsWith_param_Value_label=>T(\"Composite.Utils.Predicates.StringEndsWith.param.Value.label\");\r\n///<summary>&quot;Check if a string equals a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringEquals_description=>T(\"Composite.Utils.Predicates.StringEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringEquals_param_Value_help=>T(\"Composite.Utils.Predicates.StringEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringEquals_param_Value_label=>T(\"Composite.Utils.Predicates.StringEquals.param.Value.label\");\r\n///<summary>&quot;Check if a string starts with a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringStartsWith_description=>T(\"Composite.Utils.Predicates.StringStartsWith.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringStartsWith_param_Value_help=>T(\"Composite.Utils.Predicates.StringStartsWith.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringStartsWith_param_Value_label=>T(\"Composite.Utils.Predicates.StringStartsWith.param.Value.label\");\r\n///<summary>&quot;Check if a Guid equals a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableGuidEquals_description=>T(\"Composite.Utils.Predicates.NullableGuidEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableGuidEquals_param_Value_help=>T(\"Composite.Utils.Predicates.NullableGuidEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableGuidEquals_param_Value_label=>T(\"Composite.Utils.Predicates.NullableGuidEquals.param.Value.label\");\r\n///<summary>&quot;Check if a nullable Guid has no value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableGuidNoValue_description=>T(\"Composite.Utils.Predicates.NullableGuidNoValue.description\");\r\n///<summary>&quot;Check if an integer equals a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableIntegerEquals_description=>T(\"Composite.Utils.Predicates.NullableIntegerEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableIntegerEquals_param_Value_help=>T(\"Composite.Utils.Predicates.NullableIntegerEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableIntegerEquals_param_Value_label=>T(\"Composite.Utils.Predicates.NullableIntegerEquals.param.Value.label\");\r\n///<summary>&quot;Check if an nullable integer has no value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableIntegerNoValue_description=>T(\"Composite.Utils.Predicates.NullableIntegerNoValue.description\");\r\n///<summary>&quot;Check if a string has no value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_StringNoValue_description=>T(\"Composite.Utils.Predicates.StringNoValue.description\");\r\n///<summary>&quot;Check if a boolean is true or false. &quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableBoolEquals_description=>T(\"Composite.Utils.Predicates.NullableBoolEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableBoolEquals_param_Value_help=>T(\"Composite.Utils.Predicates.NullableBoolEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableBoolEquals_param_Value_label=>T(\"Composite.Utils.Predicates.NullableBoolEquals.param.Value.label\");\r\n///<summary>&quot;Check if a nullable boolean has no value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableBoolNoValue_description=>T(\"Composite.Utils.Predicates.NullableBoolNoValue.description\");\r\n///<summary>&quot;Check if a date equals a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeEquals_description=>T(\"Composite.Utils.Predicates.NullableDateTimeEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeEquals_param_Value_help=>T(\"Composite.Utils.Predicates.NullableDateTimeEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeEquals_param_Value_label=>T(\"Composite.Utils.Predicates.NullableDateTimeEquals.param.Value.label\");\r\n///<summary>&quot;Check if a date is greater than a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeGreaterThan_description=>T(\"Composite.Utils.Predicates.NullableDateTimeGreaterThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeGreaterThan_param_Value_help=>T(\"Composite.Utils.Predicates.NullableDateTimeGreaterThan.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeGreaterThan_param_Value_label=>T(\"Composite.Utils.Predicates.NullableDateTimeGreaterThan.param.Value.label\");\r\n///<summary>&quot;Check if a date is less than a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeLessThan_description=>T(\"Composite.Utils.Predicates.NullableDateTimeLessThan.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeLessThan_param_Value_help=>T(\"Composite.Utils.Predicates.NullableDateTimeLessThan.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeLessThan_param_Value_label=>T(\"Composite.Utils.Predicates.NullableDateTimeLessThan.param.Value.label\");\r\n///<summary>&quot;Check if a nullable date has no value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDateTimeNoValue_description=>T(\"Composite.Utils.Predicates.NullableDateTimeNoValue.description\");\r\n///<summary>&quot;Check is a decimal has a certain value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDecimalEquals_description=>T(\"Composite.Utils.Predicates.NullableDecimalEquals.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDecimalEquals_param_Value_help=>T(\"Composite.Utils.Predicates.NullableDecimalEquals.param.Value.help\");\r\n///<summary>&quot;The value to compare with&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDecimalEquals_param_Value_label=>T(\"Composite.Utils.Predicates.NullableDecimalEquals.param.Value.label\");\r\n///<summary>&quot;Check is a nullable decimal has no value&quot;</summary> \r\npublic static string Composite_Utils_Predicates_NullableDecimalNoValue_description=>T(\"Composite.Utils.Predicates.NullableDecimalNoValue.description\");\r\n///<summary>&quot;Joins a list of strings to a single string&quot;</summary> \r\npublic static string Composite_Utils_String_Join_description=>T(\"Composite.Utils.String.Join.description\");\r\n///<summary>&quot;The separator to insert between strings.&quot;</summary> \r\npublic static string Composite_Utils_String_Join_param_Separator_help=>T(\"Composite.Utils.String.Join.param.Separator.help\");\r\n///<summary>&quot;Separator&quot;</summary> \r\npublic static string Composite_Utils_String_Join_param_Separator_label=>T(\"Composite.Utils.String.Join.param.Separator.label\");\r\n///<summary>&quot;The list of strings to join&quot;</summary> \r\npublic static string Composite_Utils_String_Join_param_Strings_help=>T(\"Composite.Utils.String.Join.param.Strings.help\");\r\n///<summary>&quot;Strings to join&quot;</summary> \r\npublic static string Composite_Utils_String_Join_param_Strings_label=>T(\"Composite.Utils.String.Join.param.Strings.label\");\r\n///<summary>&quot;Joins two strings to a simple string&quot;</summary> \r\npublic static string Composite_Utils_String_JoinTwo_description=>T(\"Composite.Utils.String.JoinTwo.description\");\r\n///<summary>&quot;The string to put first&quot;</summary> \r\npublic static string Composite_Utils_String_JoinTwo_param_StringA_help=>T(\"Composite.Utils.String.JoinTwo.param.StringA.help\");\r\n///<summary>&quot;String A&quot;</summary> \r\npublic static string Composite_Utils_String_JoinTwo_param_StringA_label=>T(\"Composite.Utils.String.JoinTwo.param.StringA.label\");\r\n///<summary>&quot;The string to put last&quot;</summary> \r\npublic static string Composite_Utils_String_JoinTwo_param_StringB_help=>T(\"Composite.Utils.String.JoinTwo.param.StringB.help\");\r\n///<summary>&quot;String B&quot;</summary> \r\npublic static string Composite_Utils_String_JoinTwo_param_StringB_label=>T(\"Composite.Utils.String.JoinTwo.param.StringB.label\");\r\n///<summary>&quot;A string to insert in between String A and String B. Default is no separator&quot;</summary> \r\npublic static string Composite_Utils_String_JoinTwo_param_Separator_help=>T(\"Composite.Utils.String.JoinTwo.param.Separator.help\");\r\n///<summary>&quot;Separator&quot;</summary> \r\npublic static string Composite_Utils_String_JoinTwo_param_Separator_label=>T(\"Composite.Utils.String.JoinTwo.param.Separator.label\");\r\n///<summary>&quot;Splits a string into a list of string.&quot;</summary> \r\npublic static string Composite_Utils_String_Split_description=>T(\"Composite.Utils.String.Split.description\");\r\n///<summary>&quot;The separator to use when splitting the string. Default is comma (&quot;,&quot;)&quot;</summary> \r\npublic static string Composite_Utils_String_Split_param_Separator_help=>T(\"Composite.Utils.String.Split.param.Separator.help\");\r\n///<summary>&quot;Separator&quot;</summary> \r\npublic static string Composite_Utils_String_Split_param_Separator_label=>T(\"Composite.Utils.String.Split.param.Separator.label\");\r\n///<summary>&quot;The string you wish to split into a list.&quot;</summary> \r\npublic static string Composite_Utils_String_Split_param_String_help=>T(\"Composite.Utils.String.Split.param.String.help\");\r\n///<summary>&quot;String to split&quot;</summary> \r\npublic static string Composite_Utils_String_Split_param_String_label=>T(\"Composite.Utils.String.Split.param.String.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Validation_DateTimeNotNullValidation_description=>T(\"Composite.Utils.Validation.DateTimeNotNullValidation.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Validation_DecimalNotNullValidation_description=>T(\"Composite.Utils.Validation.DecimalNotNullValidation.description\");\r\n///<summary>&quot;Validates the precision of digits (the number of decimals the user has specified)&quot;</summary> \r\npublic static string Composite_Utils_Validation_DecimalPrecisionValidation_description=>T(\"Composite.Utils.Validation.DecimalPrecisionValidation.description\");\r\n///<summary>&quot;The maximum number of digits to allow on the decimal&quot;</summary> \r\npublic static string Composite_Utils_Validation_DecimalPrecisionValidation_param_MaxDigits_help=>T(\"Composite.Utils.Validation.DecimalPrecisionValidation.param.MaxDigits.help\");\r\n///<summary>&quot;Max number of decimal digits&quot;</summary> \r\npublic static string Composite_Utils_Validation_DecimalPrecisionValidation_param_MaxDigits_label=>T(\"Composite.Utils.Validation.DecimalPrecisionValidation.param.MaxDigits.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Validation_GuidNotNullValidation_description=>T(\"Composite.Utils.Validation.GuidNotNullValidation.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Validation_Int32NotNullValidation_description=>T(\"Composite.Utils.Validation.Int32NotNullValidation.description\");\r\n///<summary>&quot;Validates than an integer is within a certain range.&quot;</summary> \r\npublic static string Composite_Utils_Validation_IntegerRangeValidation_description=>T(\"Composite.Utils.Validation.IntegerRangeValidation.description\");\r\n///<summary>&quot;The maximum number allowed in this field.&quot;</summary> \r\npublic static string Composite_Utils_Validation_IntegerRangeValidation_param_max_help=>T(\"Composite.Utils.Validation.IntegerRangeValidation.param.max.help\");\r\n///<summary>&quot;Maximum number&quot;</summary> \r\npublic static string Composite_Utils_Validation_IntegerRangeValidation_param_max_label=>T(\"Composite.Utils.Validation.IntegerRangeValidation.param.max.label\");\r\n///<summary>&quot;The minimum number allowed in this field.&quot;</summary> \r\npublic static string Composite_Utils_Validation_IntegerRangeValidation_param_min_help=>T(\"Composite.Utils.Validation.IntegerRangeValidation.param.min.help\");\r\n///<summary>&quot;Minimum number&quot;</summary> \r\npublic static string Composite_Utils_Validation_IntegerRangeValidation_param_min_label=>T(\"Composite.Utils.Validation.IntegerRangeValidation.param.min.label\");\r\n///<summary>&quot;Validates that a string conforms to the specified regular expression&quot;</summary> \r\npublic static string Composite_Utils_Validation_RegularExpressionValidation_description=>T(\"Composite.Utils.Validation.RegularExpressionValidation.description\");\r\n///<summary>&quot;The regular expression pattern to use&quot;</summary> \r\npublic static string Composite_Utils_Validation_RegularExpressionValidation_param_pattern_help=>T(\"Composite.Utils.Validation.RegularExpressionValidation.param.pattern.help\");\r\n///<summary>&quot;RegEx pattern&quot;</summary> \r\npublic static string Composite_Utils_Validation_RegularExpressionValidation_param_pattern_label=>T(\"Composite.Utils.Validation.RegularExpressionValidation.param.pattern.label\");\r\n///<summary>&quot;Validates that the length of a string is within the specified range&quot;</summary> \r\npublic static string Composite_Utils_Validation_StringLengthValidation_description=>T(\"Composite.Utils.Validation.StringLengthValidation.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Validation_StringLengthValidation_param_max_help=>T(\"Composite.Utils.Validation.StringLengthValidation.param.max.help\");\r\n///<summary>&quot;Maximum length&quot;</summary> \r\npublic static string Composite_Utils_Validation_StringLengthValidation_param_max_label=>T(\"Composite.Utils.Validation.StringLengthValidation.param.max.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Validation_StringLengthValidation_param_min_help=>T(\"Composite.Utils.Validation.StringLengthValidation.param.min.help\");\r\n///<summary>&quot;Minimum length&quot;</summary> \r\npublic static string Composite_Utils_Validation_StringLengthValidation_param_min_label=>T(\"Composite.Utils.Validation.StringLengthValidation.param.min.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Utils_Validation_StringNotNullValidation_description=>T(\"Composite.Utils.Validation.StringNotNullValidation.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Client_BrowserPlatform_description=>T(\"Composite.Web.Client.BrowserPlatform.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Client_BrowserString_description=>T(\"Composite.Web.Client.BrowserString.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Client_BrowserType_description=>T(\"Composite.Web.Client.BrowserType.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Client_BrowserVersion_description=>T(\"Composite.Web.Client.BrowserVersion.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Client_EcmaScriptVersion_description=>T(\"Composite.Web.Client.EcmaScriptVersion.description\");\r\n///<summary>&quot;True if the current request is identified as coming from a crawler (search engine).&quot;</summary> \r\npublic static string Composite_Web_Client_IsCrawler_description=>T(\"Composite.Web.Client.IsCrawler.description\");\r\n///<summary>&quot;True if the current request is identified as coming from a mobile device.&quot;</summary> \r\npublic static string Composite_Web_Client_IsMobileDevice_description=>T(\"Composite.Web.Client.IsMobileDevice.description\");\r\n///<summary>&quot;Common HTML meta tags you probably want in your html head&quot;</summary> \r\npublic static string Composite_Web_Html_Template_CommonMetaTags_description=>T(\"Composite.Web.Html.Template.CommonMetaTags.description\");\r\n///<summary>&quot;Content-Type&quot;</summary> \r\npublic static string Composite_Web_Html_Template_CommonMetaTags_param_ContentType_label=>T(\"Composite.Web.Html.Template.CommonMetaTags.param.ContentType.label\");\r\n///<summary>&quot;By default this is &apos;text/html; charset=utf-8&apos;. If you serve something else you should overwrite this.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_CommonMetaTags_param_ContentType_help=>T(\"Composite.Web.Html.Template.CommonMetaTags.param.ContentType.help\");\r\n///<summary>&quot;Designer&quot;</summary> \r\npublic static string Composite_Web_Html_Template_CommonMetaTags_param_Designer_label=>T(\"Composite.Web.Html.Template.CommonMetaTags.param.Designer.label\");\r\n///<summary>&quot;Who designed this website? Show it in the &apos;Designer&apos; meta tag. Default is not to emit the meta tag.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_CommonMetaTags_param_Designer_help=>T(\"Composite.Web.Html.Template.CommonMetaTags.param.Designer.help\");\r\n///<summary>&quot;Show generator&quot;</summary> \r\npublic static string Composite_Web_Html_Template_CommonMetaTags_param_ShowGenerator_label=>T(\"Composite.Web.Html.Template.CommonMetaTags.param.ShowGenerator.label\");\r\n///<summary>&quot;Show the world you support C1 CMS Foundation - free open source!&quot;</summary> \r\npublic static string Composite_Web_Html_Template_CommonMetaTags_param_ShowGenerator_help=>T(\"Composite.Web.Html.Template.CommonMetaTags.param.ShowGenerator.help\");\r\n///<summary>&quot;Appends a lang=&apos;(language code)&apos; attribute the the parent element, reflecting the language of the current page. You can put this just below the &lt;html /&gt; tag.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_LangAttribute_description=>T(\"Composite.Web.Html.Template.LangAttribute.description\");\r\n///<summary>&quot;Includes a named Page Template Feature at this location. Page Template Features can contain HTML and functional snippets and are managed on the Layout perspective.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_PageTemplateFeature_description=>T(\"Composite.Web.Html.Template.PageTemplateFeature.description\");\r\n///<summary>&quot;Feature name&quot;</summary> \r\npublic static string Composite_Web_Html_Template_PageTemplateFeature_param_FeatureName_label=>T(\"Composite.Web.Html.Template.PageTemplateFeature.param.FeatureName.label\");\r\n///<summary>&quot;The name of the Page Template Feature you wish to include.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_PageTemplateFeature_param_FeatureName_help=>T(\"Composite.Web.Html.Template.PageTemplateFeature.param.FeatureName.help\");\r\n///<summary>&quot;Emits the &apos;definitive title&apos; of the current page; the same value that ends up in the page title tag. This title may originate from the page being rendered or from a C1 Function/ASP.NET control which changed the title to match specific data being featured on the page.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_HtmlTitleValue_description=>T(\"Composite.Web.Html.Template.HtmlTitleValue.description\");\r\n///<summary>&quot;Prefix to be removed&quot;</summary> \r\npublic static string Composite_Web_Html_Template_HtmlTitleValue_param_PrefixToRemove_label=>T(\"Composite.Web.Html.Template.HtmlTitleValue.param.PrefixToRemove.label\");\r\n///<summary>&quot;If the HTML title has a prefix value you wish to get rid of, specify the prefix here. If the prefix is not found in the title, this value is ignored.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_HtmlTitleValue_param_PrefixToRemove_help=>T(\"Composite.Web.Html.Template.HtmlTitleValue.param.PrefixToRemove.help\");\r\n///<summary>&quot;Postfix to be removed&quot;</summary> \r\npublic static string Composite_Web_Html_Template_HtmlTitleValue_param_PostfixToRemove_label=>T(\"Composite.Web.Html.Template.HtmlTitleValue.param.PostfixToRemove.label\");\r\n///<summary>&quot;If the HTML title has a postfix value you wish to get rid of, specify the postfix here. If the postfix is not found in the title, this value is ignored.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_HtmlTitleValue_param_PostfixToRemove_help=>T(\"Composite.Web.Html.Template.HtmlTitleValue.param.PostfixToRemove.help\");\r\n///<summary>&quot;Emits the &apos;definitive description&apos; of the current page; the same value that ends up in the page meta description tag. This value may originate from the page being rendered or from a C1 Function/ASP.NET control which changed the description to match specific data being featured on the page.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_MetaDescriptionValue_description=>T(\"Composite.Web.Html.Template.MetaDescriptionValue.description\");\r\n///<summary>&quot;Element to wrap description&quot;</summary> \r\npublic static string Composite_Web_Html_Template_MetaDescriptionValue_param_Element_label=>T(\"Composite.Web.Html.Template.MetaDescriptionValue.param.Element.label\");\r\n///<summary>&quot;To have the description wrapped in an element (like &lt;p class=&quot;description&quot; /&gt;) specify it here. The element with only be emitted when a description text exist.&quot;</summary> \r\npublic static string Composite_Web_Html_Template_MetaDescriptionValue_param_Element_help=>T(\"Composite.Web.Html.Template.MetaDescriptionValue.param.Element.help\");\r\n///<summary>&quot;Gets a value from the current users cookie collection.&quot;</summary> \r\npublic static string Composite_Web_Request_CookieValue_description=>T(\"Composite.Web.Request.CookieValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_CookieValue_param_CookieName_help=>T(\"Composite.Web.Request.CookieValue.param.CookieName.help\");\r\n///<summary>&quot;Cookie name&quot;</summary> \r\npublic static string Composite_Web_Request_CookieValue_param_CookieName_label=>T(\"Composite.Web.Request.CookieValue.param.CookieName.label\");\r\n///<summary>&quot;If the user does not have this cookie, use this field to specify what value to default to.&quot;</summary> \r\npublic static string Composite_Web_Request_CookieValue_param_FallbackValue_help=>T(\"Composite.Web.Request.CookieValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_CookieValue_param_FallbackValue_label=>T(\"Composite.Web.Request.CookieValue.param.FallbackValue.label\");\r\n///<summary>&quot;Gets a boolean value from a form post (HTTP POST)&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostBoolValue_description=>T(\"Composite.Web.Request.FormPostBoolValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostBoolValue_param_FallbackValue_help=>T(\"Composite.Web.Request.FormPostBoolValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostBoolValue_param_FallbackValue_label=>T(\"Composite.Web.Request.FormPostBoolValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostBoolValue_param_ParameterName_help=>T(\"Composite.Web.Request.FormPostBoolValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostBoolValue_param_ParameterName_label=>T(\"Composite.Web.Request.FormPostBoolValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a decimal value from a form post (HTTP POST)&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostDecimalValue_description=>T(\"Composite.Web.Request.FormPostDecimalValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostDecimalValue_param_FallbackValue_help=>T(\"Composite.Web.Request.FormPostDecimalValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostDecimalValue_param_FallbackValue_label=>T(\"Composite.Web.Request.FormPostDecimalValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostDecimalValue_param_ParameterName_help=>T(\"Composite.Web.Request.FormPostDecimalValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostDecimalValue_param_ParameterName_label=>T(\"Composite.Web.Request.FormPostDecimalValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a Guid value from a form post (HTTP POST)&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostGuidValue_description=>T(\"Composite.Web.Request.FormPostGuidValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostGuidValue_param_FallbackValue_help=>T(\"Composite.Web.Request.FormPostGuidValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostGuidValue_param_FallbackValue_label=>T(\"Composite.Web.Request.FormPostGuidValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostGuidValue_param_ParameterName_help=>T(\"Composite.Web.Request.FormPostGuidValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostGuidValue_param_ParameterName_label=>T(\"Composite.Web.Request.FormPostGuidValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets an integer value from a form post (HTTP POST)&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostIntegerValue_description=>T(\"Composite.Web.Request.FormPostIntegerValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostIntegerValue_param_FallbackValue_help=>T(\"Composite.Web.Request.FormPostIntegerValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostIntegerValue_param_FallbackValue_label=>T(\"Composite.Web.Request.FormPostIntegerValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostIntegerValue_param_ParameterName_help=>T(\"Composite.Web.Request.FormPostIntegerValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostIntegerValue_param_ParameterName_label=>T(\"Composite.Web.Request.FormPostIntegerValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a string value from a form post (HTTP POST)&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostValue_description=>T(\"Composite.Web.Request.FormPostValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostValue_param_FallbackValue_help=>T(\"Composite.Web.Request.FormPostValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostValue_param_FallbackValue_label=>T(\"Composite.Web.Request.FormPostValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostValue_param_ParameterName_help=>T(\"Composite.Web.Request.FormPostValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostValue_param_ParameterName_label=>T(\"Composite.Web.Request.FormPostValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a date and time value from a form post (HTTP POST). The incoming date string is expected to be XML formatted (like “2003-09-26T13:30:00”)&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostXmlFormattedDateTimeValue_description=>T(\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.description\");\r\n///<summary>&quot;The value to use if the post did not contain the specified parameter name.&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostXmlFormattedDateTimeValue_param_FallbackValue_help=>T(\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostXmlFormattedDateTimeValue_param_FallbackValue_label=>T(\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostXmlFormattedDateTimeValue_param_ParameterName_help=>T(\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_FormPostXmlFormattedDateTimeValue_param_ParameterName_label=>T(\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a boolean value from a Url parameter (HTTP GET)&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringBoolValue_description=>T(\"Composite.Web.Request.QueryStringBoolValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringBoolValue_param_FallbackValue_help=>T(\"Composite.Web.Request.QueryStringBoolValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringBoolValue_param_FallbackValue_label=>T(\"Composite.Web.Request.QueryStringBoolValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringBoolValue_param_ParameterName_help=>T(\"Composite.Web.Request.QueryStringBoolValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringBoolValue_param_ParameterName_label=>T(\"Composite.Web.Request.QueryStringBoolValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a decimal value from a Url parameter (HTTP GET)&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringDecimalValue_description=>T(\"Composite.Web.Request.QueryStringDecimalValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringDecimalValue_param_FallbackValue_help=>T(\"Composite.Web.Request.QueryStringDecimalValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringDecimalValue_param_FallbackValue_label=>T(\"Composite.Web.Request.QueryStringDecimalValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringDecimalValue_param_ParameterName_help=>T(\"Composite.Web.Request.QueryStringDecimalValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringDecimalValue_param_ParameterName_label=>T(\"Composite.Web.Request.QueryStringDecimalValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a Guid value from a Url parameter (HTTP GET)&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringGuidValue_description=>T(\"Composite.Web.Request.QueryStringGuidValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringGuidValue_param_FallbackValue_help=>T(\"Composite.Web.Request.QueryStringGuidValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringGuidValue_param_FallbackValue_label=>T(\"Composite.Web.Request.QueryStringGuidValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringGuidValue_param_ParameterName_help=>T(\"Composite.Web.Request.QueryStringGuidValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringGuidValue_param_ParameterName_label=>T(\"Composite.Web.Request.QueryStringGuidValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets an integer value from a Url parameter (HTTP GET)&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringIntegerValue_description=>T(\"Composite.Web.Request.QueryStringIntegerValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringIntegerValue_param_FallbackValue_help=>T(\"Composite.Web.Request.QueryStringIntegerValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringIntegerValue_param_FallbackValue_label=>T(\"Composite.Web.Request.QueryStringIntegerValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringIntegerValue_param_ParameterName_help=>T(\"Composite.Web.Request.QueryStringIntegerValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringIntegerValue_param_ParameterName_label=>T(\"Composite.Web.Request.QueryStringIntegerValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a string value from a Url parameter (HTTP GET)&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringValue_description=>T(\"Composite.Web.Request.QueryStringValue.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringValue_param_FallbackValue_help=>T(\"Composite.Web.Request.QueryStringValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringValue_param_FallbackValue_label=>T(\"Composite.Web.Request.QueryStringValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringValue_param_ParameterName_help=>T(\"Composite.Web.Request.QueryStringValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringValue_param_ParameterName_label=>T(\"Composite.Web.Request.QueryStringValue.param.ParameterName.label\");\r\n///<summary>&quot;Gets a date and time value from a Url parameter (HTTP GET). The incoming date string is expected to be XML formatted (like “2003-09-26T13:30:00”)&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringXmlFormattedDateTimeValue_description=>T(\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.description\");\r\n///<summary>&quot;The value to use if the Url did not contain the specified parameter name.&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringXmlFormattedDateTimeValue_param_FallbackValue_help=>T(\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringXmlFormattedDateTimeValue_param_FallbackValue_label=>T(\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringXmlFormattedDateTimeValue_param_ParameterName_help=>T(\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.param.ParameterName.help\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Composite_Web_Request_QueryStringXmlFormattedDateTimeValue_param_ParameterName_label=>T(\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.param.ParameterName.label\");\r\n///<summary>&quot;Returns additional information passed in a URL along with the page link.&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfo_description=>T(\"Composite.Web.Request.PathInfo.description\");\r\n///<summary>&quot;The segment of the path info to retrieve, using the format &apos;/(0)/(1)/(2)/...&apos;. Specify -1 to get the entire string.&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfo_param_Segment_help=>T(\"Composite.Web.Request.PathInfo.param.Segment.help\");\r\n///<summary>&quot;Segment&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfo_param_Segment_label=>T(\"Composite.Web.Request.PathInfo.param.Segment.label\");\r\n///<summary>&quot;When true, any path info string will be accepted. Default is true.&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfo_param_AutoApprove_help=>T(\"Composite.Web.Request.PathInfo.param.AutoApprove.help\");\r\n///<summary>&quot;AutoApprove&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfo_param_AutoApprove_label=>T(\"Composite.Web.Request.PathInfo.param.AutoApprove.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfo_param_FallbackValue_help=>T(\"Composite.Web.Request.PathInfo.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfo_param_FallbackValue_label=>T(\"Composite.Web.Request.PathInfo.param.FallbackValue.label\");\r\n///<summary>&quot;Extracts an integer value from a PathInfo segment.&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoInt_description=>T(\"Composite.Web.Request.PathInfoInt.description\");\r\n///<summary>&quot;The segment of the path info to retrieve, using the format &apos;/(0)/(1)/(2)/...&apos;.&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoInt_param_Segment_help=>T(\"Composite.Web.Request.PathInfoInt.param.Segment.help\");\r\n///<summary>&quot;Segment&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoInt_param_Segment_label=>T(\"Composite.Web.Request.PathInfoInt.param.Segment.label\");\r\n///<summary>&quot;When true, any path info string will be accepted. Default is true.&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoInt_param_AutoApprove_help=>T(\"Composite.Web.Request.PathInfoInt.param.AutoApprove.help\");\r\n///<summary>&quot;AutoApprove&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoInt_param_AutoApprove_label=>T(\"Composite.Web.Request.PathInfoInt.param.AutoApprove.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoInt_param_FallbackValue_help=>T(\"Composite.Web.Request.PathInfoInt.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoInt_param_FallbackValue_label=>T(\"Composite.Web.Request.PathInfoInt.param.FallbackValue.label\");\r\n///<summary>&quot;Extracts a GUID from a PathInfo segment.&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoGuid_description=>T(\"Composite.Web.Request.PathInfoGuid.description\");\r\n///<summary>&quot;The segment of the path info to retrieve, using the format &apos;/(0)/(1)/(2)/...&apos;. &quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoGuid_param_Segment_help=>T(\"Composite.Web.Request.PathInfoGuid.param.Segment.help\");\r\n///<summary>&quot;Segment&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoGuid_param_Segment_label=>T(\"Composite.Web.Request.PathInfoGuid.param.Segment.label\");\r\n///<summary>&quot;When true, accept any path info string will be accepted. Default is true.&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoGuid_param_AutoApprove_help=>T(\"Composite.Web.Request.PathInfoGuid.param.AutoApprove.help\");\r\n///<summary>&quot;AutoApprove&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoGuid_param_AutoApprove_label=>T(\"Composite.Web.Request.PathInfoGuid.param.AutoApprove.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoGuid_param_FallbackValue_help=>T(\"Composite.Web.Request.PathInfoGuid.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_PathInfoGuid_param_FallbackValue_label=>T(\"Composite.Web.Request.PathInfoGuid.param.FallbackValue.label\");\r\n///<summary>&quot;Notifies the system of PathInfo being used, so that the request is not redirected to the &apos;Page not found&apos; page.&quot;</summary> \r\npublic static string Composite_Web_Request_RegisterPathInfoUsage_description=>T(\"Composite.Web.Request.RegisterPathInfoUsage.description\");\r\n///<summary>&quot;Retrieves a variable from the current users session as a string.&quot;</summary> \r\npublic static string Composite_Web_Request_SessionVariable_description=>T(\"Composite.Web.Request.SessionVariable.description\");\r\n///<summary>&quot;The value to use if the session variable was not found&quot;</summary> \r\npublic static string Composite_Web_Request_SessionVariable_param_FallbackValue_help=>T(\"Composite.Web.Request.SessionVariable.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Request_SessionVariable_param_FallbackValue_label=>T(\"Composite.Web.Request.SessionVariable.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Request_SessionVariable_param_VariableName_help=>T(\"Composite.Web.Request.SessionVariable.param.VariableName.help\");\r\n///<summary>&quot;Variable name&quot;</summary> \r\npublic static string Composite_Web_Request_SessionVariable_param_VariableName_label=>T(\"Composite.Web.Request.SessionVariable.param.VariableName.label\");\r\n///<summary>&quot;Redirects the website visitor to another URL. URL redirects are suppressed when this function executes inside the C1 console.&quot;</summary> \r\npublic static string Composite_Web_Response_Redirect_description=>T(\"Composite.Web.Response.Redirect.description\");\r\n///<summary>&quot;The URL the user should be redirected to, either absolute (http://contoso.com/default.aspx) or relative (/Login.aspx)).&quot;</summary> \r\npublic static string Composite_Web_Response_Redirect_param_Url_help=>T(\"Composite.Web.Response.Redirect.param.Url.help\");\r\n///<summary>&quot;URL&quot;</summary> \r\npublic static string Composite_Web_Response_Redirect_param_Url_label=>T(\"Composite.Web.Response.Redirect.param.Url.label\");\r\n///<summary>&quot;Sets a cookie value for the current user&quot;</summary> \r\npublic static string Composite_Web_Response_SetCookieValue_description=>T(\"Composite.Web.Response.SetCookieValue.description\");\r\n///<summary>&quot;The name of the cookie to set / overwrite&quot;</summary> \r\npublic static string Composite_Web_Response_SetCookieValue_param_CookieName_help=>T(\"Composite.Web.Response.SetCookieValue.param.CookieName.help\");\r\n///<summary>&quot;Cookie name&quot;</summary> \r\npublic static string Composite_Web_Response_SetCookieValue_param_CookieName_label=>T(\"Composite.Web.Response.SetCookieValue.param.CookieName.label\");\r\n///<summary>&quot;The value to store in the cookie&quot;</summary> \r\npublic static string Composite_Web_Response_SetCookieValue_param_Value_help=>T(\"Composite.Web.Response.SetCookieValue.param.Value.help\");\r\n///<summary>&quot;Cookie value&quot;</summary> \r\npublic static string Composite_Web_Response_SetCookieValue_param_Value_label=>T(\"Composite.Web.Response.SetCookieValue.param.Value.label\");\r\n///<summary>&quot;When the cookie should expire (stop to exist). The default value is &apos;session&apos;, when the user closes the browser.&quot;</summary> \r\npublic static string Composite_Web_Response_SetCookieValue_param_Expires_help=>T(\"Composite.Web.Response.SetCookieValue.param.Expires.help\");\r\n///<summary>&quot;Expiration&quot;</summary> \r\npublic static string Composite_Web_Response_SetCookieValue_param_Expires_label=>T(\"Composite.Web.Response.SetCookieValue.param.Expires.label\");\r\n///<summary>&quot;Sets the maximum number of seconds the current page should be publicly cached on the server. To ensure that the page response is not cached set the &quot;Maximum seconds&quot; to &quot;0&quot;. If multiple sources set the server cache duration, the smallest number is used. Note that the file &quot;~/Renderers/Page.aspx&quot; contains a default value for cache duration – you can edit this file to change the default.&quot;</summary> \r\npublic static string Composite_Web_Response_SetServerPageCacheDuration_description=>T(\"Composite.Web.Response.SetServerPageCacheDuration.description\");\r\n///<summary>&quot;The maximum number of seconds the page currently being rendered should be publicly cached. A high value yield good performance, a low value make changes show up faster. A value of &apos;0&apos; ensure that all visitors get a unique response.&quot;</summary> \r\npublic static string Composite_Web_Response_SetServerPageCacheDuration_param_MaxSeconds_help=>T(\"Composite.Web.Response.SetServerPageCacheDuration.param.MaxSeconds.help\");\r\n///<summary>&quot;Maximum seconds&quot;</summary> \r\npublic static string Composite_Web_Response_SetServerPageCacheDuration_param_MaxSeconds_label=>T(\"Composite.Web.Response.SetServerPageCacheDuration.param.MaxSeconds.label\");\r\n///<summary>&quot;Sets a session variable for the current user&quot;</summary> \r\npublic static string Composite_Web_Response_SetSessionVariable_description=>T(\"Composite.Web.Response.SetSessionVariable.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Response_SetSessionVariable_param_Value_help=>T(\"Composite.Web.Response.SetSessionVariable.param.Value.help\");\r\n///<summary>&quot;Value&quot;</summary> \r\npublic static string Composite_Web_Response_SetSessionVariable_param_Value_label=>T(\"Composite.Web.Response.SetSessionVariable.param.Value.label\");\r\n///<summary>&quot;The name of the session variable to set.&quot;</summary> \r\npublic static string Composite_Web_Response_SetSessionVariable_param_VariableName_help=>T(\"Composite.Web.Response.SetSessionVariable.param.VariableName.help\");\r\n///<summary>&quot;Variable name&quot;</summary> \r\npublic static string Composite_Web_Response_SetSessionVariable_param_VariableName_label=>T(\"Composite.Web.Response.SetSessionVariable.param.VariableName.label\");\r\n///<summary>&quot;Gets the web application virtual path. Typically this is &apos;&apos; - the empty string, when running in the website root, but if {applicationname} is running in a sub folder this can be &apos;/MySubfolder&apos;. You can use this value to prefix URL&apos;s so they will work no matter is {applicationname} is running is a subfolder or not. Sample XSLT usage: &lt;img src=&quot;{/in:inputs/in:result[@name=&apos;ApplicationPath&apos;]}/images/myImage.png&quot; /&gt;&quot;</summary> \r\npublic static string Composite_Web_Server_ApplicationPath_description=>T(\"Composite.Web.Server.ApplicationPath.description\");\r\n///<summary>&quot;Gets an IIS application variable&quot;</summary> \r\npublic static string Composite_Web_Server_ApplicationVariable_description=>T(\"Composite.Web.Server.ApplicationVariable.description\");\r\n///<summary>&quot;Value to use if the application variable was not located&quot;</summary> \r\npublic static string Composite_Web_Server_ApplicationVariable_param_FallbackValue_help=>T(\"Composite.Web.Server.ApplicationVariable.param.FallbackValue.help\");\r\n///<summary>&quot;Fallback value&quot;</summary> \r\npublic static string Composite_Web_Server_ApplicationVariable_param_FallbackValue_label=>T(\"Composite.Web.Server.ApplicationVariable.param.FallbackValue.label\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Web_Server_ApplicationVariable_param_VariableName_help=>T(\"Composite.Web.Server.ApplicationVariable.param.VariableName.help\");\r\n///<summary>&quot;Variable name&quot;</summary> \r\npublic static string Composite_Web_Server_ApplicationVariable_param_VariableName_label=>T(\"Composite.Web.Server.ApplicationVariable.param.VariableName.label\");\r\n///<summary>&quot;Gets the value of an IIS Server variable&quot;</summary> \r\npublic static string Composite_Web_Server_ServerVariable_description=>T(\"Composite.Web.Server.ServerVariable.description\");\r\n///<summary>&quot;The IIS Server variable to get.&quot;</summary> \r\npublic static string Composite_Web_Server_ServerVariable_param_VariableName_help=>T(\"Composite.Web.Server.ServerVariable.param.VariableName.help\");\r\n///<summary>&quot;Variable name&quot;</summary> \r\npublic static string Composite_Web_Server_ServerVariable_param_VariableName_label=>T(\"Composite.Web.Server.ServerVariable.param.VariableName.label\");\r\n///<summary>&quot;Loads a local XML file given a relative path&quot;</summary> \r\npublic static string Composite_Xml_LoadFile_description=>T(\"Composite.Xml.LoadFile.description\");\r\n///<summary>&quot;The relative path of the XML file to load&quot;</summary> \r\npublic static string Composite_Xml_LoadFile_param_RelativePath_help=>T(\"Composite.Xml.LoadFile.param.RelativePath.help\");\r\n///<summary>&quot;Relative path&quot;</summary> \r\npublic static string Composite_Xml_LoadFile_param_RelativePath_label=>T(\"Composite.Xml.LoadFile.param.RelativePath.label\");\r\n///<summary>&quot;Loads a local XHTML file given a relative path&quot;</summary> \r\npublic static string Composite_Xml_LoadXhtmlFile_description=>T(\"Composite.Xml.LoadXhtmlFile.description\");\r\n///<summary>&quot;The relative path of the XHTML file to load&quot;</summary> \r\npublic static string Composite_Xml_LoadXhtmlFile_param_RelativePath_help=>T(\"Composite.Xml.LoadXhtmlFile.param.RelativePath.help\");\r\n///<summary>&quot;Relative path&quot;</summary> \r\npublic static string Composite_Xml_LoadXhtmlFile_param_RelativePath_label=>T(\"Composite.Xml.LoadXhtmlFile.param.RelativePath.label\");\r\n///<summary>&quot;Loads a remote XML file given a Url&quot;</summary> \r\npublic static string Composite_Xml_LoadUrl_description=>T(\"Composite.Xml.LoadUrl.description\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string Composite_Xml_LoadUrl_param_Url_help=>T(\"Composite.Xml.LoadUrl.param.Url.help\");\r\n///<summary>&quot;Url&quot;</summary> \r\npublic static string Composite_Xml_LoadUrl_param_Url_label=>T(\"Composite.Xml.LoadUrl.param.Url.label\");\r\n///<summary>&quot;Time period in seconds for which the result should is cached. Default is 0 (no caching).&quot;</summary> \r\npublic static string Composite_Xml_LoadUrl_param_CacheTime_help=>T(\"Composite.Xml.LoadUrl.param.CacheTime.help\");\r\n///<summary>&quot;Seconds to cache&quot;</summary> \r\npublic static string Composite_Xml_LoadUrl_param_CacheTime_label=>T(\"Composite.Xml.LoadUrl.param.CacheTime.label\");\r\n///<summary>&quot;Provides localized date formatting functions for XSLT use. &quot;</summary> \r\npublic static string Composite_Xslt_Extensions_DateFormatting_description=>T(\"Composite.Xslt.Extensions.DateFormatting.description\");\r\n///<summary>&quot;Provides globalization functions for XSLT use.&quot;</summary> \r\npublic static string Composite_Xslt_Extensions_Globalization_description=>T(\"Composite.Xslt.Extensions.Globalization.description\");\r\n///<summary>&quot;Provides functions that parse encoded XML documents or XHTML fragments into nodes. Use this extension when you have XML or XHTML as a string and need to copy it to the output or do transformations on it.&quot;</summary> \r\npublic static string Composite_Xslt_Extensions_MarkupParser_description=>T(\"Composite.Xslt.Extensions.MarkupParser.description\");\r\n///<summary>&quot;Sends an e-mail. Remember to configure SMTP server connection in the web.config file.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_description=>T(\"Composite.Mail.SendMail.description\");\r\n///<summary>&quot;From&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_From_label=>T(\"Composite.Mail.SendMail.param.From.label\");\r\n///<summary>&quot;Sender&apos;s address.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_From_help=>T(\"Composite.Mail.SendMail.param.From.help\");\r\n///<summary>&quot;To&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_To_label=>T(\"Composite.Mail.SendMail.param.To.label\");\r\n///<summary>&quot;Recipient. A list of comma separated email addresses.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_To_help=>T(\"Composite.Mail.SendMail.param.To.help\");\r\n///<summary>&quot;Subject&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_Subject_label=>T(\"Composite.Mail.SendMail.param.Subject.label\");\r\n///<summary>&quot;Email subject.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_Subject_help=>T(\"Composite.Mail.SendMail.param.Subject.help\");\r\n///<summary>&quot;Body&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_Body_label=>T(\"Composite.Mail.SendMail.param.Body.label\");\r\n///<summary>&quot;Email body.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_Body_help=>T(\"Composite.Mail.SendMail.param.Body.help\");\r\n///<summary>&quot;IsHtml&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_IsHtml_label=>T(\"Composite.Mail.SendMail.param.IsHtml.label\");\r\n///<summary>&quot;Defines whether email to be sent is an HTML email or a text email.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_IsHtml_help=>T(\"Composite.Mail.SendMail.param.IsHtml.help\");\r\n///<summary>&quot;CC&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_CC_label=>T(\"Composite.Mail.SendMail.param.CC.label\");\r\n///<summary>&quot;Carbon Copy. A list of comma separated email addresses that are secondary recipients of a message.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_CC_help=>T(\"Composite.Mail.SendMail.param.CC.help\");\r\n///<summary>&quot;ReplyTo&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_ReplyTo_label=>T(\"Composite.Mail.SendMail.param.ReplyTo.label\");\r\n///<summary>&quot;Address that should be used to reply to the message.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_ReplyTo_help=>T(\"Composite.Mail.SendMail.param.ReplyTo.help\");\r\n///<summary>&quot;BCC&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_BCC_label=>T(\"Composite.Mail.SendMail.param.BCC.label\");\r\n///<summary>&quot;Blind Carbon Copy. A list of recipients which will receive a mail but their individual email addresses will be concealed from the complete list of recipients.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_BCC_help=>T(\"Composite.Mail.SendMail.param.BCC.help\");\r\n///<summary>&quot;Attachment&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_Attachment_label=>T(\"Composite.Mail.SendMail.param.Attachment.label\");\r\n///<summary>&quot;List of attached files. \\n     Format it the following [{name}=]{filepath}[,{mime-type] [ | .... ].  \\n     File path can be either relative or absolute path f.e. &quot;C:\\someimage.jpg&quot; or &quot;/coolpicture.jpg&quot;  \\n     If file path starts with &quot;Composite/&quot;, it will be recognized as a path to Composite media, f.e. &apos;Composite/MediaArchive:someImage.gif&apos; \\n      \\n     Examples:  \\n        /attachment.jpg \\n       image.jpg=/attachment.jpg \\n       image.jpg=/attachment.jpg,image/jpg \\n       image1.jpg=/attachment1.jpg,image/jpg|image2.jpg=/attachment2.jpg,image/jpg&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_Attachment_help=>T(\"Composite.Mail.SendMail.param.Attachment.help\");\r\n///<summary>&quot;AttachmentFromMedia&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_AttachmentFromMedia_label=>T(\"Composite.Mail.SendMail.param.AttachmentFromMedia.label\");\r\n///<summary>&quot;A file from media library to be attached.&quot;</summary> \r\npublic static string Composite_Mail_SendMail_param_AttachmentFromMedia_help=>T(\"Composite.Mail.SendMail.param.AttachmentFromMedia.help\");\r\n///<summary>&quot;Filters images by it&apos;s folder path&quot;</summary> \r\npublic static string Composite_Data_Types_IImageFile_MediaFolderFilter_description=>T(\"Composite.Data.Types.IImageFile.MediaFolderFilter.description\");\r\n///<summary>&quot;Media Folder&quot;</summary> \r\npublic static string Composite_Data_Types_IImageFile_MediaFolderFilter_param_MediaFolder_label=>T(\"Composite.Data.Types.IImageFile.MediaFolderFilter.param.MediaFolder.label\");\r\n///<summary>&quot;A reference to a media folder&quot;</summary> \r\npublic static string Composite_Data_Types_IImageFile_MediaFolderFilter_param_MediaFolder_help=>T(\"Composite.Data.Types.IImageFile.MediaFolderFilter.param.MediaFolder.help\");\r\n///<summary>&quot;Include Subfolders&quot;</summary> \r\npublic static string Composite_Data_Types_IImageFile_MediaFolderFilter_param_IncludeSubfolders_label=>T(\"Composite.Data.Types.IImageFile.MediaFolderFilter.param.IncludeSubfolders.label\");\r\n///<summary>&quot;Determines whether images from subfolders should be included.&quot;</summary> \r\npublic static string Composite_Data_Types_IImageFile_MediaFolderFilter_param_IncludeSubfolders_help=>T(\"Composite.Data.Types.IImageFile.MediaFolderFilter.param.IncludeSubfolders.help\");\r\n///<summary>&quot;Filters images by it&apos;s folder path&quot;</summary> \r\npublic static string Composite_Data_Types_IMediaFile_MediaFolderFilter_description=>T(\"Composite.Data.Types.IMediaFile.MediaFolderFilter.description\");\r\n///<summary>&quot;Media Folder&quot;</summary> \r\npublic static string Composite_Data_Types_IMediaFile_MediaFolderFilter_param_MediaFolder_label=>T(\"Composite.Data.Types.IMediaFile.MediaFolderFilter.param.MediaFolder.label\");\r\n///<summary>&quot;A reference to a media folder&quot;</summary> \r\npublic static string Composite_Data_Types_IMediaFile_MediaFolderFilter_param_MediaFolder_help=>T(\"Composite.Data.Types.IMediaFile.MediaFolderFilter.param.MediaFolder.help\");\r\n///<summary>&quot;Include Subfolders&quot;</summary> \r\npublic static string Composite_Data_Types_IMediaFile_MediaFolderFilter_param_IncludeSubfolders_label=>T(\"Composite.Data.Types.IMediaFile.MediaFolderFilter.param.IncludeSubfolders.label\");\r\n///<summary>&quot;Determines whether media files from subfolders should be included.&quot;</summary> \r\npublic static string Composite_Data_Types_IMediaFile_MediaFolderFilter_param_IncludeSubfolders_help=>T(\"Composite.Data.Types.IMediaFile.MediaFolderFilter.param.IncludeSubfolders.help\");\r\n///<summary>&quot;Converts an enumerable of XElements to a Dictionary using named attributes for keys and values.&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_XElementsToDictionary_description=>T(\"Composite.Utils.Dictionary.XElementsToDictionary.description\");\r\n///<summary>&quot;XElements&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_XElementsToDictionary_param_XElements_label=>T(\"Composite.Utils.Dictionary.XElementsToDictionary.param.XElements.label\");\r\n///<summary>&quot;An enumerable of XElements that will be used to create a dictionary from.&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_XElementsToDictionary_param_XElements_help=>T(\"Composite.Utils.Dictionary.XElementsToDictionary.param.XElements.help\");\r\n///<summary>&quot;Key Attribute Name&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_XElementsToDictionary_param_KeyAttributeName_label=>T(\"Composite.Utils.Dictionary.XElementsToDictionary.param.KeyAttributeName.label\");\r\n///<summary>&quot;The name of the attribute on each XElement which value will be used for keys in the dictionary.&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_XElementsToDictionary_param_KeyAttributeName_help=>T(\"Composite.Utils.Dictionary.XElementsToDictionary.param.KeyAttributeName.help\");\r\n///<summary>&quot;Value Attribute Name&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_XElementsToDictionary_param_ValueAttributeName_label=>T(\"Composite.Utils.Dictionary.XElementsToDictionary.param.ValueAttributeName.label\");\r\n///<summary>&quot;The name of the attribute on each XElement which value will be used for values in the dictionary.&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_XElementsToDictionary_param_ValueAttributeName_help=>T(\"Composite.Utils.Dictionary.XElementsToDictionary.param.ValueAttributeName.help\");\r\n///<summary>&quot;Converts an enumerable of objects to a Dictionary using named property names for keys and values.&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_EnumerableToDictionary_description=>T(\"Composite.Utils.Dictionary.EnumerableToDictionary.description\");\r\n///<summary>&quot;Objects&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_EnumerableToDictionary_param_Elements_label=>T(\"Composite.Utils.Dictionary.EnumerableToDictionary.param.Elements.label\");\r\n///<summary>&quot;An enumerable of objects that will be used to create a dictionary from.&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_EnumerableToDictionary_param_Elements_help=>T(\"Composite.Utils.Dictionary.EnumerableToDictionary.param.Elements.help\");\r\n///<summary>&quot;Key Property Name&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_EnumerableToDictionary_param_KeyPropertyName_label=>T(\"Composite.Utils.Dictionary.EnumerableToDictionary.param.KeyPropertyName.label\");\r\n///<summary>&quot;The name of the property on each object which value will be used for keys in the dictionary.&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_EnumerableToDictionary_param_KeyPropertyName_help=>T(\"Composite.Utils.Dictionary.EnumerableToDictionary.param.KeyPropertyName.help\");\r\n///<summary>&quot;Value Property Name&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_EnumerableToDictionary_param_ValuePropertyName_label=>T(\"Composite.Utils.Dictionary.EnumerableToDictionary.param.ValuePropertyName.label\");\r\n///<summary>&quot;The name of the property on each object which value will be used for values in the dictionary.&quot;</summary> \r\npublic static string Composite_Utils_Dictionary_EnumerableToDictionary_param_ValuePropertyName_help=>T(\"Composite.Utils.Dictionary.EnumerableToDictionary.param.ValuePropertyName.help\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.StandardFunctions\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_TimezoneAbbreviations {\r\n///<summary>&quot;Etc/GMT+12&quot;</summary> \r\npublic static string TimezoneAbbreviations_Dateline_Standard_Time=>T(\"TimezoneAbbreviations.Dateline Standard Time\");\r\n///<summary>&quot;Etc/GMT+11&quot;</summary> \r\npublic static string TimezoneAbbreviations_UTC_11=>T(\"TimezoneAbbreviations.UTC-11\");\r\n///<summary>&quot;UTC-10&quot;</summary> \r\npublic static string TimezoneAbbreviations_Aleutian_Standard_Time=>T(\"TimezoneAbbreviations.Aleutian Standard Time\");\r\n///<summary>&quot;HST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Hawaiian_Standard_Time=>T(\"TimezoneAbbreviations.Hawaiian Standard Time\");\r\n///<summary>&quot;MART&quot;</summary> \r\npublic static string TimezoneAbbreviations_Marquesas_Standard_Time=>T(\"TimezoneAbbreviations.Marquesas Standard Time\");\r\n///<summary>&quot;AKST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Alaskan_Standard_Time=>T(\"TimezoneAbbreviations.Alaskan Standard Time\");\r\n///<summary>&quot;UTC-09&quot;</summary> \r\npublic static string TimezoneAbbreviations_UTC_09=>T(\"TimezoneAbbreviations.UTC-09\");\r\n///<summary>&quot;PST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Pacific_Standard_Time_Mexico=>T(\"TimezoneAbbreviations.Pacific Standard Time (Mexico)\");\r\n///<summary>&quot;UTC-08&quot;</summary> \r\npublic static string TimezoneAbbreviations_UTC_08=>T(\"TimezoneAbbreviations.UTC-08\");\r\n///<summary>&quot;PST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Pacific_Standard_Time=>T(\"TimezoneAbbreviations.Pacific Standard Time\");\r\n///<summary>&quot;MST&quot;</summary> \r\npublic static string TimezoneAbbreviations_US_Mountain_Standard_Time=>T(\"TimezoneAbbreviations.US Mountain Standard Time\");\r\n///<summary>&quot;MST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Mountain_Standard_Time_Mexico=>T(\"TimezoneAbbreviations.Mountain Standard Time (Mexico)\");\r\n///<summary>&quot;MST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Mountain_Standard_Time=>T(\"TimezoneAbbreviations.Mountain Standard Time\");\r\n///<summary>&quot;CST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Central_America_Standard_Time=>T(\"TimezoneAbbreviations.Central America Standard Time\");\r\n///<summary>&quot;CST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Central_Standard_Time=>T(\"TimezoneAbbreviations.Central Standard Time\");\r\n///<summary>&quot;EASST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Easter_Island_Standard_Time=>T(\"TimezoneAbbreviations.Easter Island Standard Time\");\r\n///<summary>&quot;CST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Central_Standard_Time_Mexico=>T(\"TimezoneAbbreviations.Central Standard Time (Mexico)\");\r\n///<summary>&quot;CST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Canada_Central_Standard_Time=>T(\"TimezoneAbbreviations.Canada Central Standard Time\");\r\n///<summary>&quot;SAPST&quot;</summary> \r\npublic static string TimezoneAbbreviations_SA_Pacific_Standard_Time=>T(\"TimezoneAbbreviations.SA Pacific Standard Time\");\r\n///<summary>&quot;EST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Eastern_Standard_Time_Mexico=>T(\"TimezoneAbbreviations.Eastern Standard Time (Mexico)\");\r\n///<summary>&quot;EST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Eastern_Standard_Time=>T(\"TimezoneAbbreviations.Eastern Standard Time\");\r\n///<summary>&quot;EST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Haiti_Standard_Time=>T(\"TimezoneAbbreviations.Haiti Standard Time\");\r\n///<summary>&quot;UTC-05&quot;</summary> \r\npublic static string TimezoneAbbreviations_Cuba_Standard_Time=>T(\"TimezoneAbbreviations.Cuba Standard Time\");\r\n///<summary>&quot;EST&quot;</summary> \r\npublic static string TimezoneAbbreviations_US_Eastern_Standard_Time=>T(\"TimezoneAbbreviations.US Eastern Standard Time\");\r\n///<summary>&quot;VET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Venezuela_Standard_Time=>T(\"TimezoneAbbreviations.Venezuela Standard Time\");\r\n///<summary>&quot;PYST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Paraguay_Standard_Time=>T(\"TimezoneAbbreviations.Paraguay Standard Time\");\r\n///<summary>&quot;AST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Atlantic_Standard_Time=>T(\"TimezoneAbbreviations.Atlantic Standard Time\");\r\n///<summary>&quot;AMST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Central_Brazilian_Standard_Time=>T(\"TimezoneAbbreviations.Central Brazilian Standard Time\");\r\n///<summary>&quot;SAWST&quot;</summary> \r\npublic static string TimezoneAbbreviations_SA_Western_Standard_Time=>T(\"TimezoneAbbreviations.SA Western Standard Time\");\r\n///<summary>&quot;CLST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Pacific_SA_Standard_Time=>T(\"TimezoneAbbreviations.Pacific SA Standard Time\");\r\n///<summary>&quot;UTC-04&quot;</summary> \r\npublic static string TimezoneAbbreviations_Turks_And_Caicos_Standard_Time=>T(\"TimezoneAbbreviations.Turks And Caicos Standard Time\");\r\n///<summary>&quot;NST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Newfoundland_Standard_Time=>T(\"TimezoneAbbreviations.Newfoundland Standard Time\");\r\n///<summary>&quot;UTC-03&quot;</summary> \r\npublic static string TimezoneAbbreviations_Tocantins_Standard_Time=>T(\"TimezoneAbbreviations.Tocantins Standard Time\");\r\n///<summary>&quot;BRST&quot;</summary> \r\npublic static string TimezoneAbbreviations_E__South_America_Standard_Time=>T(\"TimezoneAbbreviations.E. South America Standard Time\");\r\n///<summary>&quot;GFT&quot;</summary> \r\npublic static string TimezoneAbbreviations_SA_Eastern_Standard_Time=>T(\"TimezoneAbbreviations.SA Eastern Standard Time\");\r\n///<summary>&quot;ART&quot;</summary> \r\npublic static string TimezoneAbbreviations_Argentina_Standard_Time=>T(\"TimezoneAbbreviations.Argentina Standard Time\");\r\n///<summary>&quot;WGT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Greenland_Standard_Time=>T(\"TimezoneAbbreviations.Greenland Standard Time\");\r\n///<summary>&quot;UYT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Montevideo_Standard_Time=>T(\"TimezoneAbbreviations.Montevideo Standard Time\");\r\n///<summary>&quot;UTC-03&quot;</summary> \r\npublic static string TimezoneAbbreviations_Saint_Pierre_Standard_Time=>T(\"TimezoneAbbreviations.Saint Pierre Standard Time\");\r\n///<summary>&quot;BRT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Bahia_Standard_Time=>T(\"TimezoneAbbreviations.Bahia Standard Time\");\r\n///<summary>&quot;Etc/GMT+2&quot;</summary> \r\npublic static string TimezoneAbbreviations_UTC_02=>T(\"TimezoneAbbreviations.UTC-02\");\r\n///<summary>&quot;AST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Mid_Atlantic_Standard_Time=>T(\"TimezoneAbbreviations.Mid-Atlantic Standard Time\");\r\n///<summary>&quot;AZOT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Azores_Standard_Time=>T(\"TimezoneAbbreviations.Azores Standard Time\");\r\n///<summary>&quot;CVT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Cape_Verde_Standard_Time=>T(\"TimezoneAbbreviations.Cape Verde Standard Time\");\r\n///<summary>&quot;WET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Morocco_Standard_Time=>T(\"TimezoneAbbreviations.Morocco Standard Time\");\r\n///<summary>&quot;Etc/GMT&quot;</summary> \r\npublic static string TimezoneAbbreviations_UTC=>T(\"TimezoneAbbreviations.UTC\");\r\n///<summary>&quot;GMT&quot;</summary> \r\npublic static string TimezoneAbbreviations_GMT_Standard_Time=>T(\"TimezoneAbbreviations.GMT Standard Time\");\r\n///<summary>&quot;GMT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Greenwich_Standard_Time=>T(\"TimezoneAbbreviations.Greenwich Standard Time\");\r\n///<summary>&quot;CET&quot;</summary> \r\npublic static string TimezoneAbbreviations_W__Europe_Standard_Time=>T(\"TimezoneAbbreviations.W. Europe Standard Time\");\r\n///<summary>&quot;CET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Central_Europe_Standard_Time=>T(\"TimezoneAbbreviations.Central Europe Standard Time\");\r\n///<summary>&quot;CET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Romance_Standard_Time=>T(\"TimezoneAbbreviations.Romance Standard Time\");\r\n///<summary>&quot;CET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Central_European_Standard_Time=>T(\"TimezoneAbbreviations.Central European Standard Time\");\r\n///<summary>&quot;WAT&quot;</summary> \r\npublic static string TimezoneAbbreviations_W__Central_Africa_Standard_Time=>T(\"TimezoneAbbreviations.W. Central Africa Standard Time\");\r\n///<summary>&quot;WAST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Namibia_Standard_Time=>T(\"TimezoneAbbreviations.Namibia Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Jordan_Standard_Time=>T(\"TimezoneAbbreviations.Jordan Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_GTB_Standard_Time=>T(\"TimezoneAbbreviations.GTB Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Middle_East_Standard_Time=>T(\"TimezoneAbbreviations.Middle East Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Egypt_Standard_Time=>T(\"TimezoneAbbreviations.Egypt Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Syria_Standard_Time=>T(\"TimezoneAbbreviations.Syria Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_E__Europe_Standard_Time=>T(\"TimezoneAbbreviations.E. Europe Standard Time\");\r\n///<summary>&quot;UTC+02&quot;</summary> \r\npublic static string TimezoneAbbreviations_West_Bank_Standard_Time=>T(\"TimezoneAbbreviations.West Bank Standard Time\");\r\n///<summary>&quot;SAST&quot;</summary> \r\npublic static string TimezoneAbbreviations_South_Africa_Standard_Time=>T(\"TimezoneAbbreviations.South Africa Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_FLE_Standard_Time=>T(\"TimezoneAbbreviations.FLE Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Turkey_Standard_Time=>T(\"TimezoneAbbreviations.Turkey Standard Time\");\r\n///<summary>&quot;IST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Israel_Standard_Time=>T(\"TimezoneAbbreviations.Israel Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Kaliningrad_Standard_Time=>T(\"TimezoneAbbreviations.Kaliningrad Standard Time\");\r\n///<summary>&quot;EET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Libya_Standard_Time=>T(\"TimezoneAbbreviations.Libya Standard Time\");\r\n///<summary>&quot;AST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Arabic_Standard_Time=>T(\"TimezoneAbbreviations.Arabic Standard Time\");\r\n///<summary>&quot;AST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Arab_Standard_Time=>T(\"TimezoneAbbreviations.Arab Standard Time\");\r\n///<summary>&quot;MSK&quot;</summary> \r\npublic static string TimezoneAbbreviations_Belarus_Standard_Time=>T(\"TimezoneAbbreviations.Belarus Standard Time\");\r\n///<summary>&quot;MSK&quot;</summary> \r\npublic static string TimezoneAbbreviations_Russian_Standard_Time=>T(\"TimezoneAbbreviations.Russian Standard Time\");\r\n///<summary>&quot;EAT&quot;</summary> \r\npublic static string TimezoneAbbreviations_E__Africa_Standard_Time=>T(\"TimezoneAbbreviations.E. Africa Standard Time\");\r\n///<summary>&quot;MSK&quot;</summary> \r\npublic static string TimezoneAbbreviations_Astrakhan_Standard_Time=>T(\"TimezoneAbbreviations.Astrakhan Standard Time\");\r\n///<summary>&quot;IRST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Iran_Standard_Time=>T(\"TimezoneAbbreviations.Iran Standard Time\");\r\n///<summary>&quot;GST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Arabian_Standard_Time=>T(\"TimezoneAbbreviations.Arabian Standard Time\");\r\n///<summary>&quot;AZT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Azerbaijan_Standard_Time=>T(\"TimezoneAbbreviations.Azerbaijan Standard Time\");\r\n///<summary>&quot;SAMT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Russia_Time_Zone_3=>T(\"TimezoneAbbreviations.Russia Time Zone 3\");\r\n///<summary>&quot;MUT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Mauritius_Standard_Time=>T(\"TimezoneAbbreviations.Mauritius Standard Time\");\r\n///<summary>&quot;GET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Georgian_Standard_Time=>T(\"TimezoneAbbreviations.Georgian Standard Time\");\r\n///<summary>&quot;AMT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Caucasus_Standard_Time=>T(\"TimezoneAbbreviations.Caucasus Standard Time\");\r\n///<summary>&quot;AFT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Afghanistan_Standard_Time=>T(\"TimezoneAbbreviations.Afghanistan Standard Time\");\r\n///<summary>&quot;UZT&quot;</summary> \r\npublic static string TimezoneAbbreviations_West_Asia_Standard_Time=>T(\"TimezoneAbbreviations.West Asia Standard Time\");\r\n///<summary>&quot;YEKT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Ekaterinburg_Standard_Time=>T(\"TimezoneAbbreviations.Ekaterinburg Standard Time\");\r\n///<summary>&quot;PKT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Pakistan_Standard_Time=>T(\"TimezoneAbbreviations.Pakistan Standard Time\");\r\n///<summary>&quot;IST&quot;</summary> \r\npublic static string TimezoneAbbreviations_India_Standard_Time=>T(\"TimezoneAbbreviations.India Standard Time\");\r\n///<summary>&quot;IST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Sri_Lanka_Standard_Time=>T(\"TimezoneAbbreviations.Sri Lanka Standard Time\");\r\n///<summary>&quot;NPT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Nepal_Standard_Time=>T(\"TimezoneAbbreviations.Nepal Standard Time\");\r\n///<summary>&quot;ALMT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Central_Asia_Standard_Time=>T(\"TimezoneAbbreviations.Central Asia Standard Time\");\r\n///<summary>&quot;BDT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Bangladesh_Standard_Time=>T(\"TimezoneAbbreviations.Bangladesh Standard Time\");\r\n///<summary>&quot;NOVT&quot;</summary> \r\npublic static string TimezoneAbbreviations_N__Central_Asia_Standard_Time=>T(\"TimezoneAbbreviations.N. Central Asia Standard Time\");\r\n///<summary>&quot;MSK+3&quot;</summary> \r\npublic static string TimezoneAbbreviations_Altai_Standard_Time=>T(\"TimezoneAbbreviations.Altai Standard Time\");\r\n///<summary>&quot;MMT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Myanmar_Standard_Time=>T(\"TimezoneAbbreviations.Myanmar Standard Time\");\r\n///<summary>&quot;ICT&quot;</summary> \r\npublic static string TimezoneAbbreviations_SE_Asia_Standard_Time=>T(\"TimezoneAbbreviations.SE Asia Standard Time\");\r\n///<summary>&quot;UTC+07&quot;</summary> \r\npublic static string TimezoneAbbreviations_W__Mongolia_Standard_Time=>T(\"TimezoneAbbreviations.W. Mongolia Standard Time\");\r\n///<summary>&quot;KRAT&quot;</summary> \r\npublic static string TimezoneAbbreviations_North_Asia_Standard_Time=>T(\"TimezoneAbbreviations.North Asia Standard Time\");\r\n///<summary>&quot;UTC+07&quot;</summary> \r\npublic static string TimezoneAbbreviations_Tomsk_Standard_Time=>T(\"TimezoneAbbreviations.Tomsk Standard Time\");\r\n///<summary>&quot;CST&quot;</summary> \r\npublic static string TimezoneAbbreviations_China_Standard_Time=>T(\"TimezoneAbbreviations.China Standard Time\");\r\n///<summary>&quot;IRKT&quot;</summary> \r\npublic static string TimezoneAbbreviations_North_Asia_East_Standard_Time=>T(\"TimezoneAbbreviations.North Asia East Standard Time\");\r\n///<summary>&quot;SGT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Singapore_Standard_Time=>T(\"TimezoneAbbreviations.Singapore Standard Time\");\r\n///<summary>&quot;AWST&quot;</summary> \r\npublic static string TimezoneAbbreviations_W__Australia_Standard_Time=>T(\"TimezoneAbbreviations.W. Australia Standard Time\");\r\n///<summary>&quot;CST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Taipei_Standard_Time=>T(\"TimezoneAbbreviations.Taipei Standard Time\");\r\n///<summary>&quot;ULAT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Ulaanbaatar_Standard_Time=>T(\"TimezoneAbbreviations.Ulaanbaatar Standard Time\");\r\n///<summary>&quot;KST&quot;</summary> \r\npublic static string TimezoneAbbreviations_North_Korea_Standard_Time=>T(\"TimezoneAbbreviations.North Korea Standard Time\");\r\n///<summary>&quot;UTC+09&quot;</summary> \r\npublic static string TimezoneAbbreviations_Transbaikal_Standard_Time=>T(\"TimezoneAbbreviations.Transbaikal Standard Time\");\r\n///<summary>&quot;JST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Tokyo_Standard_Time=>T(\"TimezoneAbbreviations.Tokyo Standard Time\");\r\n///<summary>&quot;KST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Korea_Standard_Time=>T(\"TimezoneAbbreviations.Korea Standard Time\");\r\n///<summary>&quot;YAKT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Yakutsk_Standard_Time=>T(\"TimezoneAbbreviations.Yakutsk Standard Time\");\r\n///<summary>&quot;ACDT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Cen__Australia_Standard_Time=>T(\"TimezoneAbbreviations.Cen. Australia Standard Time\");\r\n///<summary>&quot;ACST&quot;</summary> \r\npublic static string TimezoneAbbreviations_AUS_Central_Standard_Time=>T(\"TimezoneAbbreviations.AUS Central Standard Time\");\r\n///<summary>&quot;AEST&quot;</summary> \r\npublic static string TimezoneAbbreviations_E__Australia_Standard_Time=>T(\"TimezoneAbbreviations.E. Australia Standard Time\");\r\n///<summary>&quot;AEDT&quot;</summary> \r\npublic static string TimezoneAbbreviations_AUS_Eastern_Standard_Time=>T(\"TimezoneAbbreviations.AUS Eastern Standard Time\");\r\n///<summary>&quot;PGT&quot;</summary> \r\npublic static string TimezoneAbbreviations_West_Pacific_Standard_Time=>T(\"TimezoneAbbreviations.West Pacific Standard Time\");\r\n///<summary>&quot;AEDT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Tasmania_Standard_Time=>T(\"TimezoneAbbreviations.Tasmania Standard Time\");\r\n///<summary>&quot;MAGT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Magadan_Standard_Time=>T(\"TimezoneAbbreviations.Magadan Standard Time\");\r\n///<summary>&quot;VLAT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Vladivostok_Standard_Time=>T(\"TimezoneAbbreviations.Vladivostok Standard Time\");\r\n///<summary>&quot;SRET&quot;</summary> \r\npublic static string TimezoneAbbreviations_Russia_Time_Zone_10=>T(\"TimezoneAbbreviations.Russia Time Zone 10\");\r\n///<summary>&quot;UTC+11&quot;</summary> \r\npublic static string TimezoneAbbreviations_Norfolk_Standard_Time=>T(\"TimezoneAbbreviations.Norfolk Standard Time\");\r\n///<summary>&quot;UTC+11&quot;</summary> \r\npublic static string TimezoneAbbreviations_Sakhalin_Standard_Time=>T(\"TimezoneAbbreviations.Sakhalin Standard Time\");\r\n///<summary>&quot;SBT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Central_Pacific_Standard_Time=>T(\"TimezoneAbbreviations.Central Pacific Standard Time\");\r\n///<summary>&quot;PETT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Russia_Time_Zone_11=>T(\"TimezoneAbbreviations.Russia Time Zone 11\");\r\n///<summary>&quot;NZDT&quot;</summary> \r\npublic static string TimezoneAbbreviations_New_Zealand_Standard_Time=>T(\"TimezoneAbbreviations.New Zealand Standard Time\");\r\n///<summary>&quot;Etc/GMT-12&quot;</summary> \r\npublic static string TimezoneAbbreviations_UTC12=>T(\"TimezoneAbbreviations.UTC+12\");\r\n///<summary>&quot;FJST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Fiji_Standard_Time=>T(\"TimezoneAbbreviations.Fiji Standard Time\");\r\n///<summary>&quot;PETT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Kamchatka_Standard_Time=>T(\"TimezoneAbbreviations.Kamchatka Standard Time\");\r\n///<summary>&quot;CHAST&quot;</summary> \r\npublic static string TimezoneAbbreviations_Chatham_Islands_Standard_Time=>T(\"TimezoneAbbreviations.Chatham Islands Standard Time\");\r\n///<summary>&quot;TOT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Tonga_Standard_Time=>T(\"TimezoneAbbreviations.Tonga Standard Time\");\r\n///<summary>&quot;WSDT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Samoa_Standard_Time=>T(\"TimezoneAbbreviations.Samoa Standard Time\");\r\n///<summary>&quot;LINT&quot;</summary> \r\npublic static string TimezoneAbbreviations_Line_Islands_Standard_Time=>T(\"TimezoneAbbreviations.Line Islands Standard Time\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.TimezoneAbbreviations\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_TimezoneDisplayNames {\r\n///<summary>&quot;(UTC-12:00) International Date Line West&quot;</summary> \r\npublic static string TimezoneDisplayName_Dateline_Standard_Time=>T(\"TimezoneDisplayName.Dateline Standard Time\");\r\n///<summary>&quot;(UTC-11:00) Coordinated Universal Time-11&quot;</summary> \r\npublic static string TimezoneDisplayName_UTC_11=>T(\"TimezoneDisplayName.UTC-11\");\r\n///<summary>&quot;(UTC-10:00) Aleutian Islands&quot;</summary> \r\npublic static string TimezoneDisplayName_Aleutian_Standard_Time=>T(\"TimezoneDisplayName.Aleutian Standard Time\");\r\n///<summary>&quot;(UTC-10:00) Hawaii&quot;</summary> \r\npublic static string TimezoneDisplayName_Hawaiian_Standard_Time=>T(\"TimezoneDisplayName.Hawaiian Standard Time\");\r\n///<summary>&quot;(UTC-09:30) Marquesas Islands&quot;</summary> \r\npublic static string TimezoneDisplayName_Marquesas_Standard_Time=>T(\"TimezoneDisplayName.Marquesas Standard Time\");\r\n///<summary>&quot;(UTC-09:00) Alaska&quot;</summary> \r\npublic static string TimezoneDisplayName_Alaskan_Standard_Time=>T(\"TimezoneDisplayName.Alaskan Standard Time\");\r\n///<summary>&quot;(UTC-09:00) Coordinated Universal Time-09&quot;</summary> \r\npublic static string TimezoneDisplayName_UTC_09=>T(\"TimezoneDisplayName.UTC-09\");\r\n///<summary>&quot;(UTC-08:00) Baja California&quot;</summary> \r\npublic static string TimezoneDisplayName_Pacific_Standard_Time_Mexico=>T(\"TimezoneDisplayName.Pacific Standard Time (Mexico)\");\r\n///<summary>&quot;(UTC-08:00) Coordinated Universal Time-08&quot;</summary> \r\npublic static string TimezoneDisplayName_UTC_08=>T(\"TimezoneDisplayName.UTC-08\");\r\n///<summary>&quot;(UTC-08:00) Pacific Time (US &amp; Canada)&quot;</summary> \r\npublic static string TimezoneDisplayName_Pacific_Standard_Time=>T(\"TimezoneDisplayName.Pacific Standard Time\");\r\n///<summary>&quot;(UTC-07:00) Arizona&quot;</summary> \r\npublic static string TimezoneDisplayName_US_Mountain_Standard_Time=>T(\"TimezoneDisplayName.US Mountain Standard Time\");\r\n///<summary>&quot;(UTC-07:00) Chihuahua, La Paz, Mazatlan&quot;</summary> \r\npublic static string TimezoneDisplayName_Mountain_Standard_Time_Mexico=>T(\"TimezoneDisplayName.Mountain Standard Time (Mexico)\");\r\n///<summary>&quot;(UTC-07:00) Mountain Time (US &amp; Canada)&quot;</summary> \r\npublic static string TimezoneDisplayName_Mountain_Standard_Time=>T(\"TimezoneDisplayName.Mountain Standard Time\");\r\n///<summary>&quot;(UTC-06:00) Central America&quot;</summary> \r\npublic static string TimezoneDisplayName_Central_America_Standard_Time=>T(\"TimezoneDisplayName.Central America Standard Time\");\r\n///<summary>&quot;(UTC-06:00) Central Time (US &amp; Canada)&quot;</summary> \r\npublic static string TimezoneDisplayName_Central_Standard_Time=>T(\"TimezoneDisplayName.Central Standard Time\");\r\n///<summary>&quot;(UTC-06:00) Easter Island&quot;</summary> \r\npublic static string TimezoneDisplayName_Easter_Island_Standard_Time=>T(\"TimezoneDisplayName.Easter Island Standard Time\");\r\n///<summary>&quot;(UTC-06:00) Guadalajara, Mexico City, Monterrey&quot;</summary> \r\npublic static string TimezoneDisplayName_Central_Standard_Time_Mexico=>T(\"TimezoneDisplayName.Central Standard Time (Mexico)\");\r\n///<summary>&quot;(UTC-06:00) Saskatchewan&quot;</summary> \r\npublic static string TimezoneDisplayName_Canada_Central_Standard_Time=>T(\"TimezoneDisplayName.Canada Central Standard Time\");\r\n///<summary>&quot;(UTC-05:00) Bogota, Lima, Quito, Rio Branco&quot;</summary> \r\npublic static string TimezoneDisplayName_SA_Pacific_Standard_Time=>T(\"TimezoneDisplayName.SA Pacific Standard Time\");\r\n///<summary>&quot;(UTC-05:00) Chetumal&quot;</summary> \r\npublic static string TimezoneDisplayName_Eastern_Standard_Time_Mexico=>T(\"TimezoneDisplayName.Eastern Standard Time (Mexico)\");\r\n///<summary>&quot;(UTC-05:00) Eastern Time (US &amp; Canada)&quot;</summary> \r\npublic static string TimezoneDisplayName_Eastern_Standard_Time=>T(\"TimezoneDisplayName.Eastern Standard Time\");\r\n///<summary>&quot;(UTC-05:00) Haiti&quot;</summary> \r\npublic static string TimezoneDisplayName_Haiti_Standard_Time=>T(\"TimezoneDisplayName.Haiti Standard Time\");\r\n///<summary>&quot;(UTC-05:00) Havana&quot;</summary> \r\npublic static string TimezoneDisplayName_Cuba_Standard_Time=>T(\"TimezoneDisplayName.Cuba Standard Time\");\r\n///<summary>&quot;(UTC-05:00) Indiana (East)&quot;</summary> \r\npublic static string TimezoneDisplayName_US_Eastern_Standard_Time=>T(\"TimezoneDisplayName.US Eastern Standard Time\");\r\n///<summary>&quot;(UTC-04:00) Asuncion&quot;</summary> \r\npublic static string TimezoneDisplayName_Paraguay_Standard_Time=>T(\"TimezoneDisplayName.Paraguay Standard Time\");\r\n///<summary>&quot;(UTC-04:00) Atlantic Time (Canada)&quot;</summary> \r\npublic static string TimezoneDisplayName_Atlantic_Standard_Time=>T(\"TimezoneDisplayName.Atlantic Standard Time\");\r\n///<summary>&quot;(UTC-04:00) Caracas&quot;</summary> \r\npublic static string TimezoneDisplayName_Venezuela_Standard_Time=>T(\"TimezoneDisplayName.Venezuela Standard Time\");\r\n///<summary>&quot;(UTC-04:00) Cuiaba&quot;</summary> \r\npublic static string TimezoneDisplayName_Central_Brazilian_Standard_Time=>T(\"TimezoneDisplayName.Central Brazilian Standard Time\");\r\n///<summary>&quot;(UTC-04:00) Georgetown, La Paz, Manaus, San Juan&quot;</summary> \r\npublic static string TimezoneDisplayName_SA_Western_Standard_Time=>T(\"TimezoneDisplayName.SA Western Standard Time\");\r\n///<summary>&quot;(UTC-04:00) Santiago&quot;</summary> \r\npublic static string TimezoneDisplayName_Pacific_SA_Standard_Time=>T(\"TimezoneDisplayName.Pacific SA Standard Time\");\r\n///<summary>&quot;(UTC-04:00) Turks and Caicos&quot;</summary> \r\npublic static string TimezoneDisplayName_Turks_And_Caicos_Standard_Time=>T(\"TimezoneDisplayName.Turks And Caicos Standard Time\");\r\n///<summary>&quot;(UTC-03:30) Newfoundland&quot;</summary> \r\npublic static string TimezoneDisplayName_Newfoundland_Standard_Time=>T(\"TimezoneDisplayName.Newfoundland Standard Time\");\r\n///<summary>&quot;(UTC-03:00) Araguaina&quot;</summary> \r\npublic static string TimezoneDisplayName_Tocantins_Standard_Time=>T(\"TimezoneDisplayName.Tocantins Standard Time\");\r\n///<summary>&quot;(UTC-03:00) Brasilia&quot;</summary> \r\npublic static string TimezoneDisplayName_E__South_America_Standard_Time=>T(\"TimezoneDisplayName.E. South America Standard Time\");\r\n///<summary>&quot;(UTC-03:00) Cayenne, Fortaleza&quot;</summary> \r\npublic static string TimezoneDisplayName_SA_Eastern_Standard_Time=>T(\"TimezoneDisplayName.SA Eastern Standard Time\");\r\n///<summary>&quot;(UTC-03:00) City of Buenos Aires&quot;</summary> \r\npublic static string TimezoneDisplayName_Argentina_Standard_Time=>T(\"TimezoneDisplayName.Argentina Standard Time\");\r\n///<summary>&quot;(UTC-03:00) Greenland&quot;</summary> \r\npublic static string TimezoneDisplayName_Greenland_Standard_Time=>T(\"TimezoneDisplayName.Greenland Standard Time\");\r\n///<summary>&quot;(UTC-03:00) Montevideo&quot;</summary> \r\npublic static string TimezoneDisplayName_Montevideo_Standard_Time=>T(\"TimezoneDisplayName.Montevideo Standard Time\");\r\n///<summary>&quot;(UTC-03:00) Saint Pierre and Miquelon&quot;</summary> \r\npublic static string TimezoneDisplayName_Saint_Pierre_Standard_Time=>T(\"TimezoneDisplayName.Saint Pierre Standard Time\");\r\n///<summary>&quot;(UTC-03:00) Salvador&quot;</summary> \r\npublic static string TimezoneDisplayName_Bahia_Standard_Time=>T(\"TimezoneDisplayName.Bahia Standard Time\");\r\n///<summary>&quot;(UTC-02:00) Coordinated Universal Time-02&quot;</summary> \r\npublic static string TimezoneDisplayName_UTC_02=>T(\"TimezoneDisplayName.UTC-02\");\r\n///<summary>&quot;(UTC-02:00) Mid-Atlantic - Old&quot;</summary> \r\npublic static string TimezoneDisplayName_Mid_Atlantic_Standard_Time=>T(\"TimezoneDisplayName.Mid-Atlantic Standard Time\");\r\n///<summary>&quot;(UTC-01:00) Azores&quot;</summary> \r\npublic static string TimezoneDisplayName_Azores_Standard_Time=>T(\"TimezoneDisplayName.Azores Standard Time\");\r\n///<summary>&quot;(UTC-01:00) Cabo Verde Is.&quot;</summary> \r\npublic static string TimezoneDisplayName_Cape_Verde_Standard_Time=>T(\"TimezoneDisplayName.Cape Verde Standard Time\");\r\n///<summary>&quot;(UTC) Coordinated Universal Time&quot;</summary> \r\npublic static string TimezoneDisplayName_UTC=>T(\"TimezoneDisplayName.UTC\");\r\n///<summary>&quot;(UTC+00:00) Casablanca&quot;</summary> \r\npublic static string TimezoneDisplayName_Morocco_Standard_Time=>T(\"TimezoneDisplayName.Morocco Standard Time\");\r\n///<summary>&quot;(UTC+00:00) Dublin, Edinburgh, Lisbon, London&quot;</summary> \r\npublic static string TimezoneDisplayName_GMT_Standard_Time=>T(\"TimezoneDisplayName.GMT Standard Time\");\r\n///<summary>&quot;(UTC+00:00) Monrovia, Reykjavik&quot;</summary> \r\npublic static string TimezoneDisplayName_Greenwich_Standard_Time=>T(\"TimezoneDisplayName.Greenwich Standard Time\");\r\n///<summary>&quot;(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna&quot;</summary> \r\npublic static string TimezoneDisplayName_W__Europe_Standard_Time=>T(\"TimezoneDisplayName.W. Europe Standard Time\");\r\n///<summary>&quot;(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague&quot;</summary> \r\npublic static string TimezoneDisplayName_Central_Europe_Standard_Time=>T(\"TimezoneDisplayName.Central Europe Standard Time\");\r\n///<summary>&quot;(UTC+01:00) Brussels, Copenhagen, Madrid, Paris&quot;</summary> \r\npublic static string TimezoneDisplayName_Romance_Standard_Time=>T(\"TimezoneDisplayName.Romance Standard Time\");\r\n///<summary>&quot;(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb&quot;</summary> \r\npublic static string TimezoneDisplayName_Central_European_Standard_Time=>T(\"TimezoneDisplayName.Central European Standard Time\");\r\n///<summary>&quot;(UTC+01:00) West Central Africa&quot;</summary> \r\npublic static string TimezoneDisplayName_W__Central_Africa_Standard_Time=>T(\"TimezoneDisplayName.W. Central Africa Standard Time\");\r\n///<summary>&quot;(UTC+01:00) Windhoek&quot;</summary> \r\npublic static string TimezoneDisplayName_Namibia_Standard_Time=>T(\"TimezoneDisplayName.Namibia Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Amman&quot;</summary> \r\npublic static string TimezoneDisplayName_Jordan_Standard_Time=>T(\"TimezoneDisplayName.Jordan Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Athens, Bucharest&quot;</summary> \r\npublic static string TimezoneDisplayName_GTB_Standard_Time=>T(\"TimezoneDisplayName.GTB Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Beirut&quot;</summary> \r\npublic static string TimezoneDisplayName_Middle_East_Standard_Time=>T(\"TimezoneDisplayName.Middle East Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Cairo&quot;</summary> \r\npublic static string TimezoneDisplayName_Egypt_Standard_Time=>T(\"TimezoneDisplayName.Egypt Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Chisinau&quot;</summary> \r\npublic static string TimezoneDisplayName_E__Europe_Standard_Time=>T(\"TimezoneDisplayName.E. Europe Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Damascus&quot;</summary> \r\npublic static string TimezoneDisplayName_Syria_Standard_Time=>T(\"TimezoneDisplayName.Syria Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Gaza, Hebron&quot;</summary> \r\npublic static string TimezoneDisplayName_West_Bank_Standard_Time=>T(\"TimezoneDisplayName.West Bank Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Harare, Pretoria&quot;</summary> \r\npublic static string TimezoneDisplayName_South_Africa_Standard_Time=>T(\"TimezoneDisplayName.South Africa Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius&quot;</summary> \r\npublic static string TimezoneDisplayName_FLE_Standard_Time=>T(\"TimezoneDisplayName.FLE Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Istanbul&quot;</summary> \r\npublic static string TimezoneDisplayName_Turkey_Standard_Time=>T(\"TimezoneDisplayName.Turkey Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Jerusalem&quot;</summary> \r\npublic static string TimezoneDisplayName_Israel_Standard_Time=>T(\"TimezoneDisplayName.Israel Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Kaliningrad&quot;</summary> \r\npublic static string TimezoneDisplayName_Kaliningrad_Standard_Time=>T(\"TimezoneDisplayName.Kaliningrad Standard Time\");\r\n///<summary>&quot;(UTC+02:00) Tripoli&quot;</summary> \r\npublic static string TimezoneDisplayName_Libya_Standard_Time=>T(\"TimezoneDisplayName.Libya Standard Time\");\r\n///<summary>&quot;(UTC+03:00) Baghdad&quot;</summary> \r\npublic static string TimezoneDisplayName_Arabic_Standard_Time=>T(\"TimezoneDisplayName.Arabic Standard Time\");\r\n///<summary>&quot;(UTC+03:00) Kuwait, Riyadh&quot;</summary> \r\npublic static string TimezoneDisplayName_Arab_Standard_Time=>T(\"TimezoneDisplayName.Arab Standard Time\");\r\n///<summary>&quot;(UTC+03:00) Minsk&quot;</summary> \r\npublic static string TimezoneDisplayName_Belarus_Standard_Time=>T(\"TimezoneDisplayName.Belarus Standard Time\");\r\n///<summary>&quot;(UTC+03:00) Moscow, St. Petersburg, Volgograd&quot;</summary> \r\npublic static string TimezoneDisplayName_Russian_Standard_Time=>T(\"TimezoneDisplayName.Russian Standard Time\");\r\n///<summary>&quot;(UTC+03:00) Nairobi&quot;</summary> \r\npublic static string TimezoneDisplayName_E__Africa_Standard_Time=>T(\"TimezoneDisplayName.E. Africa Standard Time\");\r\n///<summary>&quot;(UTC+03:30) Tehran&quot;</summary> \r\npublic static string TimezoneDisplayName_Iran_Standard_Time=>T(\"TimezoneDisplayName.Iran Standard Time\");\r\n///<summary>&quot;(UTC+04:00) Abu Dhabi, Muscat&quot;</summary> \r\npublic static string TimezoneDisplayName_Arabian_Standard_Time=>T(\"TimezoneDisplayName.Arabian Standard Time\");\r\n///<summary>&quot;(UTC+04:00) Astrakhan, Ulyanovsk&quot;</summary> \r\npublic static string TimezoneDisplayName_Astrakhan_Standard_Time=>T(\"TimezoneDisplayName.Astrakhan Standard Time\");\r\n///<summary>&quot;(UTC+04:00) Baku&quot;</summary> \r\npublic static string TimezoneDisplayName_Azerbaijan_Standard_Time=>T(\"TimezoneDisplayName.Azerbaijan Standard Time\");\r\n///<summary>&quot;(UTC+04:00) Izhevsk, Samara&quot;</summary> \r\npublic static string TimezoneDisplayName_Russia_Time_Zone_3=>T(\"TimezoneDisplayName.Russia Time Zone 3\");\r\n///<summary>&quot;(UTC+04:00) Port Louis&quot;</summary> \r\npublic static string TimezoneDisplayName_Mauritius_Standard_Time=>T(\"TimezoneDisplayName.Mauritius Standard Time\");\r\n///<summary>&quot;(UTC+04:00) Tbilisi&quot;</summary> \r\npublic static string TimezoneDisplayName_Georgian_Standard_Time=>T(\"TimezoneDisplayName.Georgian Standard Time\");\r\n///<summary>&quot;(UTC+04:00) Yerevan&quot;</summary> \r\npublic static string TimezoneDisplayName_Caucasus_Standard_Time=>T(\"TimezoneDisplayName.Caucasus Standard Time\");\r\n///<summary>&quot;(UTC+04:30) Kabul&quot;</summary> \r\npublic static string TimezoneDisplayName_Afghanistan_Standard_Time=>T(\"TimezoneDisplayName.Afghanistan Standard Time\");\r\n///<summary>&quot;(UTC+05:00) Ashgabat, Tashkent&quot;</summary> \r\npublic static string TimezoneDisplayName_West_Asia_Standard_Time=>T(\"TimezoneDisplayName.West Asia Standard Time\");\r\n///<summary>&quot;(UTC+05:00) Ekaterinburg&quot;</summary> \r\npublic static string TimezoneDisplayName_Ekaterinburg_Standard_Time=>T(\"TimezoneDisplayName.Ekaterinburg Standard Time\");\r\n///<summary>&quot;(UTC+05:00) Islamabad, Karachi&quot;</summary> \r\npublic static string TimezoneDisplayName_Pakistan_Standard_Time=>T(\"TimezoneDisplayName.Pakistan Standard Time\");\r\n///<summary>&quot;(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi&quot;</summary> \r\npublic static string TimezoneDisplayName_India_Standard_Time=>T(\"TimezoneDisplayName.India Standard Time\");\r\n///<summary>&quot;(UTC+05:30) Sri Jayawardenepura&quot;</summary> \r\npublic static string TimezoneDisplayName_Sri_Lanka_Standard_Time=>T(\"TimezoneDisplayName.Sri Lanka Standard Time\");\r\n///<summary>&quot;(UTC+05:45) Kathmandu&quot;</summary> \r\npublic static string TimezoneDisplayName_Nepal_Standard_Time=>T(\"TimezoneDisplayName.Nepal Standard Time\");\r\n///<summary>&quot;(UTC+06:00) Astana&quot;</summary> \r\npublic static string TimezoneDisplayName_Central_Asia_Standard_Time=>T(\"TimezoneDisplayName.Central Asia Standard Time\");\r\n///<summary>&quot;(UTC+06:00) Dhaka&quot;</summary> \r\npublic static string TimezoneDisplayName_Bangladesh_Standard_Time=>T(\"TimezoneDisplayName.Bangladesh Standard Time\");\r\n///<summary>&quot;(UTC+06:00) Novosibirsk&quot;</summary> \r\npublic static string TimezoneDisplayName_N__Central_Asia_Standard_Time=>T(\"TimezoneDisplayName.N. Central Asia Standard Time\");\r\n///<summary>&quot;(UTC+06:30) Yangon (Rangoon)&quot;</summary> \r\npublic static string TimezoneDisplayName_Myanmar_Standard_Time=>T(\"TimezoneDisplayName.Myanmar Standard Time\");\r\n///<summary>&quot;(UTC+07:00) Bangkok, Hanoi, Jakarta&quot;</summary> \r\npublic static string TimezoneDisplayName_SE_Asia_Standard_Time=>T(\"TimezoneDisplayName.SE Asia Standard Time\");\r\n///<summary>&quot;(UTC+07:00) Barnaul, Gorno-Altaysk&quot;</summary> \r\npublic static string TimezoneDisplayName_Altai_Standard_Time=>T(\"TimezoneDisplayName.Altai Standard Time\");\r\n///<summary>&quot;(UTC+07:00) Hovd&quot;</summary> \r\npublic static string TimezoneDisplayName_W__Mongolia_Standard_Time=>T(\"TimezoneDisplayName.W. Mongolia Standard Time\");\r\n///<summary>&quot;(UTC+07:00) Krasnoyarsk&quot;</summary> \r\npublic static string TimezoneDisplayName_North_Asia_Standard_Time=>T(\"TimezoneDisplayName.North Asia Standard Time\");\r\n///<summary>&quot;(UTC+07:00) Tomsk&quot;</summary> \r\npublic static string TimezoneDisplayName_Tomsk_Standard_Time=>T(\"TimezoneDisplayName.Tomsk Standard Time\");\r\n///<summary>&quot;(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi&quot;</summary> \r\npublic static string TimezoneDisplayName_China_Standard_Time=>T(\"TimezoneDisplayName.China Standard Time\");\r\n///<summary>&quot;(UTC+08:00) Irkutsk&quot;</summary> \r\npublic static string TimezoneDisplayName_North_Asia_East_Standard_Time=>T(\"TimezoneDisplayName.North Asia East Standard Time\");\r\n///<summary>&quot;(UTC+08:00) Kuala Lumpur, Singapore&quot;</summary> \r\npublic static string TimezoneDisplayName_Singapore_Standard_Time=>T(\"TimezoneDisplayName.Singapore Standard Time\");\r\n///<summary>&quot;(UTC+08:00) Perth&quot;</summary> \r\npublic static string TimezoneDisplayName_W__Australia_Standard_Time=>T(\"TimezoneDisplayName.W. Australia Standard Time\");\r\n///<summary>&quot;(UTC+08:00) Taipei&quot;</summary> \r\npublic static string TimezoneDisplayName_Taipei_Standard_Time=>T(\"TimezoneDisplayName.Taipei Standard Time\");\r\n///<summary>&quot;(UTC+08:00) Ulaanbaatar&quot;</summary> \r\npublic static string TimezoneDisplayName_Ulaanbaatar_Standard_Time=>T(\"TimezoneDisplayName.Ulaanbaatar Standard Time\");\r\n///<summary>&quot;(UTC+08:30) Pyongyang&quot;</summary> \r\npublic static string TimezoneDisplayName_North_Korea_Standard_Time=>T(\"TimezoneDisplayName.North Korea Standard Time\");\r\n///<summary>&quot;(UTC+08:45) Eucla&quot;</summary> \r\npublic static string TimezoneDisplayName_Aus_Central_W__Standard_Time=>T(\"TimezoneDisplayName.Aus Central W. Standard Time\");\r\n///<summary>&quot;(UTC+09:00) Chita&quot;</summary> \r\npublic static string TimezoneDisplayName_Transbaikal_Standard_Time=>T(\"TimezoneDisplayName.Transbaikal Standard Time\");\r\n///<summary>&quot;(UTC+09:00) Osaka, Sapporo, Tokyo&quot;</summary> \r\npublic static string TimezoneDisplayName_Tokyo_Standard_Time=>T(\"TimezoneDisplayName.Tokyo Standard Time\");\r\n///<summary>&quot;(UTC+09:00) Seoul&quot;</summary> \r\npublic static string TimezoneDisplayName_Korea_Standard_Time=>T(\"TimezoneDisplayName.Korea Standard Time\");\r\n///<summary>&quot;(UTC+09:00) Yakutsk&quot;</summary> \r\npublic static string TimezoneDisplayName_Yakutsk_Standard_Time=>T(\"TimezoneDisplayName.Yakutsk Standard Time\");\r\n///<summary>&quot;(UTC+09:30) Adelaide&quot;</summary> \r\npublic static string TimezoneDisplayName_Cen__Australia_Standard_Time=>T(\"TimezoneDisplayName.Cen. Australia Standard Time\");\r\n///<summary>&quot;(UTC+09:30) Darwin&quot;</summary> \r\npublic static string TimezoneDisplayName_AUS_Central_Standard_Time=>T(\"TimezoneDisplayName.AUS Central Standard Time\");\r\n///<summary>&quot;(UTC+10:00) Brisbane&quot;</summary> \r\npublic static string TimezoneDisplayName_E__Australia_Standard_Time=>T(\"TimezoneDisplayName.E. Australia Standard Time\");\r\n///<summary>&quot;(UTC+10:00) Canberra, Melbourne, Sydney&quot;</summary> \r\npublic static string TimezoneDisplayName_AUS_Eastern_Standard_Time=>T(\"TimezoneDisplayName.AUS Eastern Standard Time\");\r\n///<summary>&quot;(UTC+10:00) Guam, Port Moresby&quot;</summary> \r\npublic static string TimezoneDisplayName_West_Pacific_Standard_Time=>T(\"TimezoneDisplayName.West Pacific Standard Time\");\r\n///<summary>&quot;(UTC+10:00) Hobart&quot;</summary> \r\npublic static string TimezoneDisplayName_Tasmania_Standard_Time=>T(\"TimezoneDisplayName.Tasmania Standard Time\");\r\n///<summary>&quot;(UTC+10:00) Vladivostok&quot;</summary> \r\npublic static string TimezoneDisplayName_Vladivostok_Standard_Time=>T(\"TimezoneDisplayName.Vladivostok Standard Time\");\r\n///<summary>&quot;(UTC+10:30) Lord Howe Island&quot;</summary> \r\npublic static string TimezoneDisplayName_Lord_Howe_Standard_Time=>T(\"TimezoneDisplayName.Lord Howe Standard Time\");\r\n///<summary>&quot;(UTC+11:00) Bougainville Island&quot;</summary> \r\npublic static string TimezoneDisplayName_Bougainville_Standard_Time=>T(\"TimezoneDisplayName.Bougainville Standard Time\");\r\n///<summary>&quot;(UTC+11:00) Chokurdakh&quot;</summary> \r\npublic static string TimezoneDisplayName_Russia_Time_Zone_10=>T(\"TimezoneDisplayName.Russia Time Zone 10\");\r\n///<summary>&quot;(UTC+11:00) Magadan&quot;</summary> \r\npublic static string TimezoneDisplayName_Magadan_Standard_Time=>T(\"TimezoneDisplayName.Magadan Standard Time\");\r\n///<summary>&quot;(UTC+11:00) Norfolk Island&quot;</summary> \r\npublic static string TimezoneDisplayName_Norfolk_Standard_Time=>T(\"TimezoneDisplayName.Norfolk Standard Time\");\r\n///<summary>&quot;(UTC+11:00) Sakhalin&quot;</summary> \r\npublic static string TimezoneDisplayName_Sakhalin_Standard_Time=>T(\"TimezoneDisplayName.Sakhalin Standard Time\");\r\n///<summary>&quot;(UTC+11:00) Solomon Is., New Caledonia&quot;</summary> \r\npublic static string TimezoneDisplayName_Central_Pacific_Standard_Time=>T(\"TimezoneDisplayName.Central Pacific Standard Time\");\r\n///<summary>&quot;(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky&quot;</summary> \r\npublic static string TimezoneDisplayName_Russia_Time_Zone_11=>T(\"TimezoneDisplayName.Russia Time Zone 11\");\r\n///<summary>&quot;(UTC+12:00) Auckland, Wellington&quot;</summary> \r\npublic static string TimezoneDisplayName_New_Zealand_Standard_Time=>T(\"TimezoneDisplayName.New Zealand Standard Time\");\r\n///<summary>&quot;(UTC+12:00) Coordinated Universal Time+12&quot;</summary> \r\npublic static string TimezoneDisplayName_UTC12=>T(\"TimezoneDisplayName.UTC+12\");\r\n///<summary>&quot;(UTC+12:00) Fiji&quot;</summary> \r\npublic static string TimezoneDisplayName_Fiji_Standard_Time=>T(\"TimezoneDisplayName.Fiji Standard Time\");\r\n///<summary>&quot;(UTC+12:00) Petropavlovsk-Kamchatsky - Old&quot;</summary> \r\npublic static string TimezoneDisplayName_Kamchatka_Standard_Time=>T(\"TimezoneDisplayName.Kamchatka Standard Time\");\r\n///<summary>&quot;(UTC+12:45) Chatham Islands&quot;</summary> \r\npublic static string TimezoneDisplayName_Chatham_Islands_Standard_Time=>T(\"TimezoneDisplayName.Chatham Islands Standard Time\");\r\n///<summary>&quot;(UTC+13:00) Nuku&apos;alofa&quot;</summary> \r\npublic static string TimezoneDisplayName_Tonga_Standard_Time=>T(\"TimezoneDisplayName.Tonga Standard Time\");\r\n///<summary>&quot;(UTC+13:00) Samoa&quot;</summary> \r\npublic static string TimezoneDisplayName_Samoa_Standard_Time=>T(\"TimezoneDisplayName.Samoa Standard Time\");\r\n///<summary>&quot;(UTC+14:00) Kiritimati Island&quot;</summary> \r\npublic static string TimezoneDisplayName_Line_Islands_Standard_Time=>T(\"TimezoneDisplayName.Line Islands Standard Time\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.TimezoneDisplayNames\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_UserControlFunction {\r\n///<summary>&quot;User Control Functions&quot;</summary> \r\npublic static string RootElement_Label=>T(\"RootElement.Label\");\r\n///<summary>&quot;Functions based on .ascx controls&quot;</summary> \r\npublic static string RootElement_ToolTip=>T(\"RootElement.ToolTip\");\r\n///<summary>&quot;Add User Control Function&quot;</summary> \r\npublic static string AddNewUserControlFunction_Label=>T(\"AddNewUserControlFunction.Label\");\r\n///<summary>&quot;Add a new User Control function&quot;</summary> \r\npublic static string AddNewUserControlFunction_ToolTip=>T(\"AddNewUserControlFunction.ToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string EditUserControlFunction_Label=>T(\"EditUserControlFunction.Label\");\r\n///<summary>&quot;Edit the User Control Function&quot;</summary> \r\npublic static string EditUserControlFunction_ToolTip=>T(\"EditUserControlFunction.ToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteUserControlFunction_Label=>T(\"DeleteUserControlFunction.Label\");\r\n///<summary>&quot;Delete the User Control function&quot;</summary> \r\npublic static string DeleteUserControlFunction_ToolTip=>T(\"DeleteUserControlFunction.ToolTip\");\r\n///<summary>&quot;Add User Control Function&quot;</summary> \r\npublic static string AddNewUserControlFunction_LabelDialog=>T(\"AddNewUserControlFunction.LabelDialog\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string AddNewUserControlFunction_LabelName=>T(\"AddNewUserControlFunction.LabelName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewUserControlFunction_HelpName=>T(\"AddNewUserControlFunction.HelpName\");\r\n///<summary>&quot;Namespace&quot;</summary> \r\npublic static string AddNewUserControlFunction_LabelNamespace=>T(\"AddNewUserControlFunction.LabelNamespace\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewUserControlFunction_HelpNamespace=>T(\"AddNewUserControlFunction.HelpNamespace\");\r\n///<summary>&quot;Copy from&quot;</summary> \r\npublic static string AddNewUserControlFunction_LabelCopyFrom=>T(\"AddNewUserControlFunction.LabelCopyFrom\");\r\n///<summary>&quot;You can copy the code from another User Control function by selecting it in this list.&quot;</summary> \r\npublic static string AddNewUserControlFunction_LabelCopyFromHelp=>T(\"AddNewUserControlFunction.LabelCopyFromHelp\");\r\n///<summary>&quot;(New User Control function)&quot;</summary> \r\npublic static string AddNewUserControlFunction_LabelCopyFromEmptyOption=>T(\"AddNewUserControlFunction.LabelCopyFromEmptyOption\");\r\n///<summary>&quot;A C1 function with the same name already exists.&quot;</summary> \r\npublic static string AddNewUserControlFunctionWorkflow_DuplicateName=>T(\"AddNewUserControlFunctionWorkflow.DuplicateName\");\r\n///<summary>&quot;Function name is empty&quot;</summary> \r\npublic static string AddNewUserControlFunctionWorkflow_EmptyName=>T(\"AddNewUserControlFunctionWorkflow.EmptyName\");\r\n///<summary>&quot;Function namespace is empty&quot;</summary> \r\npublic static string AddNewUserControlFunctionWorkflow_NamespaceEmpty=>T(\"AddNewUserControlFunctionWorkflow.NamespaceEmpty\");\r\n///<summary>&quot;Namespace must be like A.B.C - not start and end with .&quot;</summary> \r\npublic static string AddNewUserControlFunctionWorkflow_InvalidNamespace=>T(\"AddNewUserControlFunctionWorkflow.InvalidNamespace\");\r\n///<summary>&quot;The total length of the name and the namespace is too long (used to name the ASCX file).&quot;</summary> \r\npublic static string AddNewUserControlFunctionWorkflow_TotalNameTooLang=>T(\"AddNewUserControlFunctionWorkflow.TotalNameTooLang\");\r\n///<summary>&quot;Validation Error&quot;</summary> \r\npublic static string EditUserControlFunctionWorkflow_Validation_DialogTitle=>T(\"EditUserControlFunctionWorkflow.Validation.DialogTitle\");\r\n///<summary>&quot;Compilation failed: {0}&quot;</summary> \r\npublic static string EditUserControlFunctionWorkflow_Validation_CompilationFailed_Template=>T(\"EditUserControlFunctionWorkflow.Validation.CompilationFailed\");\r\n///<summary>&quot;Compilation failed: {0}&quot;</summary> \r\npublic static string EditUserControlFunctionWorkflow_Validation_CompilationFailed(object parameter0)=>string.Format(T(\"EditUserControlFunctionWorkflow.Validation.CompilationFailed\"), parameter0);\r\n///<summary>&quot;The User Control function should inherit &apos;{0}&apos;&quot;</summary> \r\npublic static string EditUserControlFunctionWorkflow_Validation_IncorrectBaseClass_Template=>T(\"EditUserControlFunctionWorkflow.Validation.IncorrectBaseClass\");\r\n///<summary>&quot;The User Control function should inherit &apos;{0}&apos;&quot;</summary> \r\npublic static string EditUserControlFunctionWorkflow_Validation_IncorrectBaseClass(object parameter0)=>string.Format(T(\"EditUserControlFunctionWorkflow.Validation.IncorrectBaseClass\"), parameter0);\r\n///<summary>&quot;Delete User Control Function?&quot;</summary> \r\npublic static string DeleteUserControlFunctionWorkflow_ConfirmDeleteTitle=>T(\"DeleteUserControlFunctionWorkflow.ConfirmDeleteTitle\");\r\n///<summary>&quot;Delete the selected User Control?&quot;</summary> \r\npublic static string DeleteUserControlFunctionWorkflow_ConfirmDeleteMessage=>T(\"DeleteUserControlFunctionWorkflow.ConfirmDeleteMessage\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.UserControlFunction\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_UserGroupElementProvider {\r\n///<summary>&quot;User Groups&quot;</summary> \r\npublic static string UserGroupElementProvider_RootLabel=>T(\"UserGroupElementProvider.RootLabel\");\r\n///<summary>&quot;User Groups&quot;</summary> \r\npublic static string UserGroupElementProvider_RootToolTip=>T(\"UserGroupElementProvider.RootToolTip\");\r\n///<summary>&quot;Add User Group&quot;</summary> \r\npublic static string UserGroupElementProvider_AddNewUserGroupLabel=>T(\"UserGroupElementProvider.AddNewUserGroupLabel\");\r\n///<summary>&quot;Add new User Group&quot;</summary> \r\npublic static string UserGroupElementProvider_AddNewUserGroupToolTip=>T(\"UserGroupElementProvider.AddNewUserGroupToolTip\");\r\n///<summary>&quot;Edit User Group&quot;</summary> \r\npublic static string UserGroupElementProvider_EditUserGroupLabel=>T(\"UserGroupElementProvider.EditUserGroupLabel\");\r\n///<summary>&quot;Edit User Group&quot;</summary> \r\npublic static string UserGroupElementProvider_EditUserGroupToolTip=>T(\"UserGroupElementProvider.EditUserGroupToolTip\");\r\n///<summary>&quot;Delete User Group&quot;</summary> \r\npublic static string UserGroupElementProvider_DeleteUserGroupLabel=>T(\"UserGroupElementProvider.DeleteUserGroupLabel\");\r\n///<summary>&quot;Delete User Group&quot;</summary> \r\npublic static string UserGroupElementProvider_DeleteUserGroupToolTip=>T(\"UserGroupElementProvider.DeleteUserGroupToolTip\");\r\n///<summary>&quot;Add User Group&quot;</summary> \r\npublic static string AddNewUserGroup_AddNewUserGroupStep1_LabelFieldGroup=>T(\"AddNewUserGroup.AddNewUserGroupStep1.LabelFieldGroup\");\r\n///<summary>&quot;User group name&quot;</summary> \r\npublic static string AddNewUserGroup_AddNewUserGroupStep1_UserGroupNameLabel=>T(\"AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameLabel\");\r\n///<summary>&quot;The name of the new user group&quot;</summary> \r\npublic static string AddNewUserGroup_AddNewUserGroupStep1_UserGroupNameHelp=>T(\"AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameHelp\");\r\n///<summary>&quot;A user group with the same name already exists&quot;</summary> \r\npublic static string AddNewUserGroup_AddNewUserGroupStep1_UserGroupNameAlreadyExists=>T(\"AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameAlreadyExists\");\r\n///<summary>&quot;Edit User Group&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_LabelFieldGroup=>T(\"EditUserGroup.EditUserGroupStep1.LabelFieldGroup\");\r\n///<summary>&quot;User group name&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_UserGroupNameLabel=>T(\"EditUserGroup.EditUserGroupStep1.UserGroupNameLabel\");\r\n///<summary>&quot;The name of the user group&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_UserGroupNameHelp=>T(\"EditUserGroup.EditUserGroupStep1.UserGroupNameHelp\");\r\n///<summary>&quot;A user group with the same name already exists&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_UserGroupNameAlreadyExists=>T(\"EditUserGroup.EditUserGroupStep1.UserGroupNameAlreadyExists\");\r\n///<summary>&quot;Perspectives&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_ActivePerspectiveFieldLabel=>T(\"EditUserGroup.EditUserGroupStep1.ActivePerspectiveFieldLabel\");\r\n///<summary>&quot;Perspectives&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_ActivePerspectiveMultiSelectLabel=>T(\"EditUserGroup.EditUserGroupStep1.ActivePerspectiveMultiSelectLabel\");\r\n///<summary>&quot;Select which perspectives the users of this group gets access to view&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_ActivePerspectiveMultiSelectHelp=>T(\"EditUserGroup.EditUserGroupStep1.ActivePerspectiveMultiSelectHelp\");\r\n///<summary>&quot;Global permissions&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_GlobalPermissionsFieldLabel=>T(\"EditUserGroup.EditUserGroupStep1.GlobalPermissionsFieldLabel\");\r\n///<summary>&quot;Global permissions&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_GlobalPermissionsMultiSelectLabel=>T(\"EditUserGroup.EditUserGroupStep1.GlobalPermissionsMultiSelectLabel\");\r\n///<summary>&quot;Global permissions that users in this group should have. The Administrate permission grants the user group access to manage user group permissions and execute other administrative tasks.  The Configure permission grants access to super user tasks.&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_GlobalPermissionsMultiSelectHelp=>T(\"EditUserGroup.EditUserGroupStep1.GlobalPermissionsMultiSelectHelp\");\r\n///<summary>&quot;Data Language Access&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_ActiveLocalesFieldLabel=>T(\"EditUserGroup.EditUserGroupStep1.ActiveLocalesFieldLabel\");\r\n///<summary>&quot;Data Languages&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_ActiveLocalesMultiSelectLabel=>T(\"EditUserGroup.EditUserGroupStep1.ActiveLocalesMultiSelectLabel\");\r\n///<summary>&quot;Users in this group has access to manage data in the selected languages.&quot;</summary> \r\npublic static string EditUserGroup_EditUserGroupStep1_ActiveLocalesMultiSelectHelp=>T(\"EditUserGroup.EditUserGroupStep1.ActiveLocalesMultiSelectHelp\");\r\n///<summary>&quot;User Group Has Users&quot;</summary> \r\npublic static string DeleteUserGroup_DeleteUserGroupInitialStep_UserGroupHasUsersTitle=>T(\"DeleteUserGroup.DeleteUserGroupInitialStep.UserGroupHasUsersTitle\");\r\n///<summary>&quot;You cannot delete a user group that has users.&quot;</summary> \r\npublic static string DeleteUserGroup_DeleteUserGroupInitialStep_UserGroupHasUsersMessage=>T(\"DeleteUserGroup.DeleteUserGroupInitialStep.UserGroupHasUsersMessage\");\r\n///<summary>&quot;Delete User Group&quot;</summary> \r\npublic static string DeleteUserGroup_DeleteUserGroupStep1_LabelFieldGroup=>T(\"DeleteUserGroup.DeleteUserGroupStep1.LabelFieldGroup\");\r\n///<summary>&quot;Delete the selected user group?&quot;</summary> \r\npublic static string DeleteUserGroup_DeleteUserGroupStep1_Text=>T(\"DeleteUserGroup.DeleteUserGroupStep1.Text\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_VisualFunction {\r\n///<summary>&quot;Delete Visual Function?&quot;</summary> \r\npublic static string DeleteStep1_FieldGroupLabel=>T(\"DeleteStep1.FieldGroupLabel\");\r\n///<summary>&quot;Are you sure you wish to delete the selected function?&quot;</summary> \r\npublic static string DeleteStep1_Text=>T(\"DeleteStep1.Text\");\r\n///<summary>&quot;Add Visual Function&quot;</summary> \r\npublic static string AddNew_DialogLabel=>T(\"AddNew.DialogLabel\");\r\n///<summary>&quot;No Datatypes to Visualize&quot;</summary> \r\npublic static string AddNew_NoTypesExistsErrorTitle=>T(\"AddNew.NoTypesExistsErrorTitle\");\r\n///<summary>&quot;No datatypes have been created yet. You must first create a datatype to visualize before you can create a visualization.&quot;</summary> \r\npublic static string AddNew_NoTypesExistsErrorMessage=>T(\"AddNew.NoTypesExistsErrorMessage\");\r\n///<summary>&quot;No Data to Visualize and Preview&quot;</summary> \r\npublic static string AddNew_NoDataExistsErrorTitle=>T(\"AddNew.NoDataExistsErrorTitle\");\r\n///<summary>&quot;Data must exist before you can create a rendering. Add some data to this type and try again.&quot;</summary> \r\npublic static string AddNew_NoDataExistsErrorMessage=>T(\"AddNew.NoDataExistsErrorMessage\");\r\n///<summary>&quot;No Templates&quot;</summary> \r\npublic static string AddNew_NoPageTemplatesExistsErrorTitle=>T(\"AddNew.NoPageTemplatesExistsErrorTitle\");\r\n///<summary>&quot;At least one template must exist before you can create a rendering. Create one template and try again.&quot;</summary> \r\npublic static string AddNew_NoPageTemplatesExistsErrorMessage=>T(\"AddNew.NoPageTemplatesExistsErrorMessage\");\r\n///<summary>&quot;A Language Is Required&quot;</summary> \r\npublic static string AddNew_MissingActiveLanguageTitle=>T(\"AddNew.MissingActiveLanguageTitle\");\r\n///<summary>&quot;To create a visual function a language is required, but no languages have been added yet. You can add one under the System perspective.&quot;</summary> \r\npublic static string AddNew_MissingActiveLanguageMessage=>T(\"AddNew.MissingActiveLanguageMessage\");\r\n///<summary>&quot;Datatype&quot;</summary> \r\npublic static string AddNewStep1_TypeSelectorLabel=>T(\"AddNewStep1.TypeSelectorLabel\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewStep1_TypeSelectorHelp=>T(\"AddNewStep1.TypeSelectorHelp\");\r\n///<summary>&quot;Function name&quot;</summary> \r\npublic static string AddNewStep2_FuncitonNameLabel=>T(\"AddNewStep2.FuncitonNameLabel\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewStep2_FuncitonNameHelp=>T(\"AddNewStep2.FuncitonNameHelp\");\r\n///<summary>&quot;Function namespace&quot;</summary> \r\npublic static string AddNewStep2_FuncitonNamespaceLabel=>T(\"AddNewStep2.FuncitonNamespaceLabel\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewStep2_FuncitonNamespaceHelp=>T(\"AddNewStep2.FuncitonNamespaceHelp\");\r\n///<summary>&quot;Visual Function Settings&quot;</summary> \r\npublic static string Edit_PlaceHolderLabel=>T(\"Edit.PlaceHolderLabel\");\r\n///<summary>&quot;Visual function&quot;</summary> \r\npublic static string Edit_HeadingTitel=>T(\"Edit.HeadingTitel\");\r\n///<summary>&quot;Visual function settings&quot;</summary> \r\npublic static string Edit_FieldGroupLabel=>T(\"Edit.FieldGroupLabel\");\r\n///<summary>&quot;Function name&quot;</summary> \r\npublic static string Edit_FunctionNameLabel=>T(\"Edit.FunctionNameLabel\");\r\n///<summary>&quot;The name of the function. Names must be unique with a namespace.&quot;</summary> \r\npublic static string Edit_FunctionNameHelp=>T(\"Edit.FunctionNameHelp\");\r\n///<summary>&quot;Function namespace&quot;</summary> \r\npublic static string Edit_FunctionNamespaceLabel=>T(\"Edit.FunctionNamespaceLabel\");\r\n///<summary>&quot;The &apos;package&apos; this function belongs to.&quot;</summary> \r\npublic static string Edit_FunctionNamespaceHelp=>T(\"Edit.FunctionNamespaceHelp\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string Edit_FunctionDescriptionLabel=>T(\"Edit.FunctionDescriptionLabel\");\r\n///<summary>&quot;A description of the function that can help people understand what it does.&quot;</summary> \r\npublic static string Edit_FunctionDescriptionHelp=>T(\"Edit.FunctionDescriptionHelp\");\r\n///<summary>&quot;Item list length&quot;</summary> \r\npublic static string Edit_ItemListLenghtLabel=>T(\"Edit.ItemListLenghtLabel\");\r\n///<summary>&quot;The maximum number of items to show.&quot;</summary> \r\npublic static string Edit_ItemListLenghtHelp=>T(\"Edit.ItemListLenghtHelp\");\r\n///<summary>&quot;Item sorting&quot;</summary> \r\npublic static string Edit_ItemSortingLabel=>T(\"Edit.ItemSortingLabel\");\r\n///<summary>&quot;Select which field to use when sorting the list. Use &apos;(random)&apos; to pick randomly from the list.&quot;</summary> \r\npublic static string Edit_ItemSortingHelp=>T(\"Edit.ItemSortingHelp\");\r\n///<summary>&quot;List sort order&quot;</summary> \r\npublic static string Edit_ListSortingLabel=>T(\"Edit.ListSortingLabel\");\r\n///<summary>&quot;Ascending&quot;</summary> \r\npublic static string Edit_ListSortingTrueLabel=>T(\"Edit.ListSortingTrueLabel\");\r\n///<summary>&quot;Descending&quot;</summary> \r\npublic static string Edit_ListSortingFalseLabel=>T(\"Edit.ListSortingFalseLabel\");\r\n///<summary>&quot;Select the sorted order. Ascending order is alphabetically, chronological. This field is ignored when &apos;(random)&apos; sorting is active.&quot;</summary> \r\npublic static string Edit_ListSortingHelp=>T(\"Edit.ListSortingHelp\");\r\n///<summary>&quot;Preview template&quot;</summary> \r\npublic static string Edit_PreviewTemplateLabel=>T(\"Edit.PreviewTemplateLabel\");\r\n///<summary>&quot;This information is only used when previewing the function.&quot;</summary> \r\npublic static string Edit_PreviewTemplateHelp=>T(\"Edit.PreviewTemplateHelp\");\r\n///<summary>&quot;Visual Layout&quot;</summary> \r\npublic static string Edit_WYSIWYGLayoutLabel=>T(\"Edit.WYSIWYGLayoutLabel\");\r\n///<summary>&quot;Preview&quot;</summary> \r\npublic static string Edit_LabelPreview=>T(\"Edit.LabelPreview\");\r\n///<summary>&quot;No templates&quot;</summary> \r\npublic static string Edit_NoPageTemplatesExistsErrorTitle=>T(\"Edit.NoPageTemplatesExistsErrorTitle\");\r\n///<summary>&quot;At least one template must exist before you can edit a rendering. Create one template and try again.&quot;</summary> \r\npublic static string Edit_NoPageTemplatesExistsErrorMessage=>T(\"Edit.NoPageTemplatesExistsErrorMessage\");\r\n///<summary>&quot;A language is required&quot;</summary> \r\npublic static string Edit_MissingActiveLanguageTitle=>T(\"Edit.MissingActiveLanguageTitle\");\r\n///<summary>&quot;To edit a visual function a language is required, but no languages have been added yet. You can add one under the System perspective.&quot;</summary> \r\npublic static string Edit_MissingActiveLanguageMessage=>T(\"Edit.MissingActiveLanguageMessage\");\r\n///<summary>&quot;Select a visual function&quot;</summary> \r\npublic static string Select_FieldGroupLabel=>T(\"Select.FieldGroupLabel\");\r\n///<summary>&quot;Select a function&quot;</summary> \r\npublic static string Select_FunctionFunctionsLabel=>T(\"Select.FunctionFunctionsLabel\");\r\n///<summary>&quot;Select a visual function to edit or delete&quot;</summary> \r\npublic static string Select_FunctionFunctionsHelp=>T(\"Select.FunctionFunctionsHelp\");\r\n///<summary>&quot;Another function with this name exists. Names must be unique.&quot;</summary> \r\npublic static string AddVisualFunctionWorkflow_FunctionNameValidatoinErrorMessage=>T(\"AddVisualFunctionWorkflow.FunctionNameValidatoinErrorMessage\");\r\n///<summary>&quot;Another function with this name exists. Names must be unique.&quot;</summary> \r\npublic static string EditVisualFunctionWorkflow_FunctionNameValidatoinErrorMessage=>T(\"EditVisualFunctionWorkflow.FunctionNameValidatoinErrorMessage\");\r\n///<summary>&quot;Visual Functions&quot;</summary> \r\npublic static string VisualFunctionElementProvider_RootFolderLabel=>T(\"VisualFunctionElementProvider.RootFolderLabel\");\r\n///<summary>&quot;Visual functions&quot;</summary> \r\npublic static string VisualFunctionElementProvider_RootFolderToolTip=>T(\"VisualFunctionElementProvider.RootFolderToolTip\");\r\n///<summary>&quot;Add Visual Function&quot;</summary> \r\npublic static string VisualFunctionElementProvider_AddNewLabel=>T(\"VisualFunctionElementProvider.AddNewLabel\");\r\n///<summary>&quot;Add new visual function&quot;</summary> \r\npublic static string VisualFunctionElementProvider_AddNewToolTip=>T(\"VisualFunctionElementProvider.AddNewToolTip\");\r\n///<summary>&quot;Edit Visual Function&quot;</summary> \r\npublic static string VisualFunctionElementProvider_EditLabel=>T(\"VisualFunctionElementProvider.EditLabel\");\r\n///<summary>&quot;Edit visual function&quot;</summary> \r\npublic static string VisualFunctionElementProvider_EditToolTip=>T(\"VisualFunctionElementProvider.EditToolTip\");\r\n///<summary>&quot;Delete Visual Function&quot;</summary> \r\npublic static string VisualFunctionElementProvider_DeleteLabel=>T(\"VisualFunctionElementProvider.DeleteLabel\");\r\n///<summary>&quot;Delete visual function&quot;</summary> \r\npublic static string VisualFunctionElementProvider_DeleteToolTip=>T(\"VisualFunctionElementProvider.DeleteToolTip\");\r\n///<summary>&quot;Another function with this name exists. Names must be unique.&quot;</summary> \r\npublic static string VisualFunctionElementProvider_FunctionNameNotUniqueError=>T(\"VisualFunctionElementProvider.FunctionNameNotUniqueError\");\r\n///<summary>&quot;New visual function&quot;</summary> \r\npublic static string VisualFunctionElementProviderHelper_AddNewLabel=>T(\"VisualFunctionElementProviderHelper.AddNewLabel\");\r\n///<summary>&quot;New visual function&quot;</summary> \r\npublic static string VisualFunctionElementProviderHelper_AddNewToolTip=>T(\"VisualFunctionElementProviderHelper.AddNewToolTip\");\r\n///<summary>&quot;Edit visual function&quot;</summary> \r\npublic static string VisualFunctionElementProviderHelper_EditLabel=>T(\"VisualFunctionElementProviderHelper.EditLabel\");\r\n///<summary>&quot;Edit visual function&quot;</summary> \r\npublic static string VisualFunctionElementProviderHelper_EditToolTip=>T(\"VisualFunctionElementProviderHelper.EditToolTip\");\r\n///<summary>&quot;Delete visual function&quot;</summary> \r\npublic static string VisualFunctionElementProviderHelper_DeleteLabel=>T(\"VisualFunctionElementProviderHelper.DeleteLabel\");\r\n///<summary>&quot;Delete visual function&quot;</summary> \r\npublic static string VisualFunctionElementProviderHelper_DeleteToolTip=>T(\"VisualFunctionElementProviderHelper.DeleteToolTip\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_WebsiteFileElementProvider {\r\n///<summary>&quot;/&quot;</summary> \r\npublic static string WebsiteFilesRootElement_Label=>T(\"WebsiteFilesRootElement.Label\");\r\n///<summary>&quot;/&quot;</summary> \r\npublic static string LayoutResourcesRootElement_Label=>T(\"LayoutResourcesRootElement.Label\");\r\n///<summary>&quot;Layout&quot;</summary> \r\npublic static string LayoutResourcesKeyNameLabel=>T(\"LayoutResourcesKeyNameLabel\");\r\n///<summary>&quot;Delete File?&quot;</summary> \r\npublic static string DeleteFile_LabelFieldGroup=>T(\"DeleteFile.LabelFieldGroup\");\r\n///<summary>&quot;Delete file?&quot;</summary> \r\npublic static string DeleteFile_Text=>T(\"DeleteFile.Text\");\r\n///<summary>&quot;Delete Folder?&quot;</summary> \r\npublic static string DeleteFolder_LabelFieldGroup=>T(\"DeleteFolder.LabelFieldGroup\");\r\n///<summary>&quot;Delete folder?&quot;</summary> \r\npublic static string DeleteFolder_Text=>T(\"DeleteFolder.Text\");\r\n///<summary>&quot;Add New Folder&quot;</summary> \r\npublic static string AddNewFolder_LabelFieldGroup=>T(\"AddNewFolder.LabelFieldGroup\");\r\n///<summary>&quot;Folder name&quot;</summary> \r\npublic static string AddNewFolder_Text=>T(\"AddNewFolder.Text\");\r\n///<summary>&quot;Enter the name of the new folder&quot;</summary> \r\npublic static string AddNewFolder_Help=>T(\"AddNewFolder.Help\");\r\n///<summary>&quot;A folder with the same name already exists&quot;</summary> \r\npublic static string AddNewFolder_Error_FolderExist=>T(\"AddNewFolder.Error.FolderExist\");\r\n///<summary>&quot;Add New File&quot;</summary> \r\npublic static string AddNewFile_LabelFieldGroup=>T(\"AddNewFile.LabelFieldGroup\");\r\n///<summary>&quot;File name&quot;</summary> \r\npublic static string AddNewFile_Text=>T(\"AddNewFile.Text\");\r\n///<summary>&quot;Enter the name of the new file&quot;</summary> \r\npublic static string AddNewFile_Help=>T(\"AddNewFile.Help\");\r\n///<summary>&quot;A file with the same name already exists&quot;</summary> \r\npublic static string AddNewFile_Error_FileExist=>T(\"AddNewFile.Error.FileExist\");\r\n///<summary>&quot;Upload File&quot;</summary> \r\npublic static string UploadNewWebsiteFile_LabelFieldGroup=>T(\"UploadNewWebsiteFile.LabelFieldGroup\");\r\n///<summary>&quot;Select file&quot;</summary> \r\npublic static string UploadNewWebsiteFile_LabelFile=>T(\"UploadNewWebsiteFile.LabelFile\");\r\n///<summary>&quot;Select file to upload&quot;</summary> \r\npublic static string UploadNewWebsiteFile_HelpFile=>T(\"UploadNewWebsiteFile.HelpFile\");\r\n///<summary>&quot;Overwrite existing file&quot;</summary> \r\npublic static string UploadNewWebsiteFile_ConfirmOverwriteTitle=>T(\"UploadNewWebsiteFile.ConfirmOverwriteTitle\");\r\n///<summary>&quot;A file with the same name already exists, overwrite?&quot;</summary> \r\npublic static string UploadNewWebsiteFile_ConfirmOverwriteDescription=>T(\"UploadNewWebsiteFile.ConfirmOverwriteDescription\");\r\n///<summary>&quot;Wrong File Type&quot;</summary> \r\npublic static string UploadFile_Error_WrongTypeTitle=>T(\"UploadFile.Error.WrongTypeTitle\");\r\n///<summary>&quot;Wrong file type&quot;</summary> \r\npublic static string UploadFile_Error_WrongTypeMessage=>T(\"UploadFile.Error.WrongTypeMessage\");\r\n///<summary>&quot;Upload and Extract Zip&quot;</summary> \r\npublic static string UploadAndExtractZipFileTitle=>T(\"UploadAndExtractZipFileTitle\");\r\n///<summary>&quot;Upload multiple files and folders by providing a Zip file&quot;</summary> \r\npublic static string UploadAndExtractZipFileToolTip=>T(\"UploadAndExtractZipFileToolTip\");\r\n///<summary>&quot;Upload and Extract Zip File&quot;</summary> \r\npublic static string UploadAndExtractZipFile_DialogLabel=>T(\"UploadAndExtractZipFile.DialogLabel\");\r\n///<summary>&quot;Zip file&quot;</summary> \r\npublic static string UploadAndExtractZipFile_FileLabel=>T(\"UploadAndExtractZipFile.FileLabel\");\r\n///<summary>&quot;The file/folder structure of the zip file you select will be extracted and copied to the website&quot;</summary> \r\npublic static string UploadAndExtractZipFile_FileHelp=>T(\"UploadAndExtractZipFile.FileHelp\");\r\n///<summary>&quot;Overwrite existing&quot;</summary> \r\npublic static string UploadAndExtractZipFile_OverwriteExistingLabel=>T(\"UploadAndExtractZipFile.OverwriteExistingLabel\");\r\n///<summary>&quot;If you select this option, existing files will be overwritten&quot;</summary> \r\npublic static string UploadAndExtractZipFile_OverwriteExistingHelp=>T(\"UploadAndExtractZipFile.OverwriteExistingHelp\");\r\n///<summary>&quot;Overwrite existing files&quot;</summary> \r\npublic static string UploadAndExtractZipFile_OverwriteExistingItemLabel=>T(\"UploadAndExtractZipFile.OverwriteExistingItemLabel\");\r\n///<summary>&quot;File &apos;{0}&apos; exists both in the zip and on the website. Choose to overwrite files to complete this action&quot;</summary> \r\npublic static string UploadAndExtractZipFile_FileExistsError_Template=>T(\"UploadAndExtractZipFile.FileExistsError\");\r\n///<summary>&quot;File &apos;{0}&apos; exists both in the zip and on the website. Choose to overwrite files to complete this action&quot;</summary> \r\npublic static string UploadAndExtractZipFile_FileExistsError(object parameter0)=>string.Format(T(\"UploadAndExtractZipFile.FileExistsError\"), parameter0);\r\n///<summary>&quot;No file was uploaded&quot;</summary> \r\npublic static string UploadAndExtractZipFile_FileNotUploaded=>T(\"UploadAndExtractZipFile.FileNotUploaded\");\r\n///<summary>&quot;The uploaded file is not a valid Zip archive&quot;</summary> \r\npublic static string UploadAndExtractZipFile_NotZip=>T(\"UploadAndExtractZipFile.NotZip\");\r\n///<summary>&quot;Zip upload could not be completed&quot;</summary> \r\npublic static string UploadAndExtractZipFile_ErrorDialogLabel=>T(\"UploadAndExtractZipFile.ErrorDialogLabel\");\r\n///<summary>&quot;Upload failed unexpectedly. Please see log for details&quot;</summary> \r\npublic static string UploadAndExtractZipFile_UnexpectedError=>T(\"UploadAndExtractZipFile.UnexpectedError\");\r\n///<summary>&quot;Existing file &apos;{0}&apos; is marked as read only. No files were uploaded&quot;</summary> \r\npublic static string UploadAndExtractZipFile_ExistingFileReadOnly_Template=>T(\"UploadAndExtractZipFile.ExistingFileReadOnly\");\r\n///<summary>&quot;Existing file &apos;{0}&apos; is marked as read only. No files were uploaded&quot;</summary> \r\npublic static string UploadAndExtractZipFile_ExistingFileReadOnly(object parameter0)=>string.Format(T(\"UploadAndExtractZipFile.ExistingFileReadOnly\"), parameter0);\r\n///<summary>&quot;New Folder&quot;</summary> \r\npublic static string AddWebsiteFolderTitle=>T(\"AddWebsiteFolderTitle\");\r\n///<summary>&quot;Add new folder&quot;</summary> \r\npublic static string AddWebsiteFolderToolTip=>T(\"AddWebsiteFolderToolTip\");\r\n///<summary>&quot;New File&quot;</summary> \r\npublic static string AddWebsiteFileTitle=>T(\"AddWebsiteFileTitle\");\r\n///<summary>&quot;Create new file&quot;</summary> \r\npublic static string AddWebsiteFileToolTip=>T(\"AddWebsiteFileToolTip\");\r\n///<summary>&quot;Delete File&quot;</summary> \r\npublic static string DeleteWebsiteFileTitle=>T(\"DeleteWebsiteFileTitle\");\r\n///<summary>&quot;Delete file&quot;</summary> \r\npublic static string DeleteWebsiteFileToolTip=>T(\"DeleteWebsiteFileToolTip\");\r\n///<summary>&quot;Download&quot;</summary> \r\npublic static string DownloadFileTitle=>T(\"DownloadFileTitle\");\r\n///<summary>&quot;Download file&quot;</summary> \r\npublic static string DownloadFileToolTip=>T(\"DownloadFileToolTip\");\r\n///<summary>&quot;Delete Folder&quot;</summary> \r\npublic static string DeleteWebsiteFolderTitle=>T(\"DeleteWebsiteFolderTitle\");\r\n///<summary>&quot;Delete folder&quot;</summary> \r\npublic static string DeleteWebsiteFolderToolTip=>T(\"DeleteWebsiteFolderToolTip\");\r\n///<summary>&quot;Edit File&quot;</summary> \r\npublic static string EditWebsiteFileTitle=>T(\"EditWebsiteFileTitle\");\r\n///<summary>&quot;Edit file&quot;</summary> \r\npublic static string EditWebsiteFileToolTip=>T(\"EditWebsiteFileToolTip\");\r\n///<summary>&quot;Upload File&quot;</summary> \r\npublic static string UploadWebsiteFileTitle=>T(\"UploadWebsiteFileTitle\");\r\n///<summary>&quot;Upload file&quot;</summary> \r\npublic static string UploadWebsiteFileToolTip=>T(\"UploadWebsiteFileToolTip\");\r\n///<summary>&quot;Show in &quot;{0}&quot;&quot;</summary> \r\npublic static string AddFolderToWhiteListTitle_Template=>T(\"AddFolderToWhiteListTitle\");\r\n///<summary>&quot;Show in &quot;{0}&quot;&quot;</summary> \r\npublic static string AddFolderToWhiteListTitle(object parameter0)=>string.Format(T(\"AddFolderToWhiteListTitle\"), parameter0);\r\n///<summary>&quot;Control if this folder should be visible in &quot;{0}&quot;&quot;</summary> \r\npublic static string AddFolderToWhiteListToolTip_Template=>T(\"AddFolderToWhiteListToolTip\");\r\n///<summary>&quot;Control if this folder should be visible in &quot;{0}&quot;&quot;</summary> \r\npublic static string AddFolderToWhiteListToolTip(object parameter0)=>string.Format(T(\"AddFolderToWhiteListToolTip\"), parameter0);\r\n///<summary>&quot;Show in &quot;{0}&quot;&quot;</summary> \r\npublic static string RemoveFolderFromWhiteListTitle_Template=>T(\"RemoveFolderFromWhiteListTitle\");\r\n///<summary>&quot;Show in &quot;{0}&quot;&quot;</summary> \r\npublic static string RemoveFolderFromWhiteListTitle(object parameter0)=>string.Format(T(\"RemoveFolderFromWhiteListTitle\"), parameter0);\r\n///<summary>&quot;Control if this folder should be visible in &quot;{0}&quot;&quot;</summary> \r\npublic static string RemoveFolderFromWhiteListToolTip_Template=>T(\"RemoveFolderFromWhiteListToolTip\");\r\n///<summary>&quot;Control if this folder should be visible in &quot;{0}&quot;&quot;</summary> \r\npublic static string RemoveFolderFromWhiteListToolTip(object parameter0)=>string.Format(T(\"RemoveFolderFromWhiteListToolTip\"), parameter0);\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string DeleteWebsiteFileWorkflow_DeleteErrorTitle=>T(\"DeleteWebsiteFileWorkflow.DeleteErrorTitle\");\r\n///<summary>&quot;Could not delete the file&quot;</summary> \r\npublic static string DeleteWebsiteFileWorkflow_DeleteErrorMessage=>T(\"DeleteWebsiteFileWorkflow.DeleteErrorMessage\");\r\n///<summary>&quot;Error&quot;</summary> \r\npublic static string DeleteWebsiteFolderWorkflow_DeleteErrorTitle=>T(\"DeleteWebsiteFolderWorkflow.DeleteErrorTitle\");\r\n///<summary>&quot;Could not delete the folder&quot;</summary> \r\npublic static string DeleteWebsiteFolderWorkflow_DeleteErrorMessage=>T(\"DeleteWebsiteFolderWorkflow.DeleteErrorMessage\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Plugins_XsltBasedFunction {\r\n///<summary>&quot;XSLT Functions&quot;</summary> \r\npublic static string Plugins_XsltBasedFunctionProviderElementProvider_RootFolderLabel=>T(\"Plugins.XsltBasedFunctionProviderElementProvider.RootFolderLabel\");\r\n///<summary>&quot;XSLT functions&quot;</summary> \r\npublic static string Plugins_XsltBasedFunctionProviderElementProvider_RootFolderToolTip=>T(\"Plugins.XsltBasedFunctionProviderElementProvider.RootFolderToolTip\");\r\n///<summary>&quot;An XSLT function with the same name already exists.&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_DuplicateName=>T(\"AddNewXsltFunctionWorkflow.DuplicateName\");\r\n///<summary>&quot;Method name must be non-empty&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_MethodEmpty=>T(\"AddNewXsltFunctionWorkflow.MethodEmpty\");\r\n///<summary>&quot;Namespace must be non-empty&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_NamespaceEmpty=>T(\"AddNewXsltFunctionWorkflow.NamespaceEmpty\");\r\n///<summary>&quot;Namespace must be like A.B.C - not start and end with .&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_InvalidNamespace=>T(\"AddNewXsltFunctionWorkflow.InvalidNamespace\");\r\n///<summary>&quot;A language is required&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_MissingActiveLanguageTitle=>T(\"AddNewXsltFunctionWorkflow.MissingActiveLanguageTitle\");\r\n///<summary>&quot;To create a XSLT function a language is required, but no languages have been added yet. You can add one under the System perspective.&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_MissingActiveLanguageMessage=>T(\"AddNewXsltFunctionWorkflow.MissingActiveLanguageMessage\");\r\n///<summary>&quot;A page is required&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_MissingPageTitle=>T(\"AddNewXsltFunctionWorkflow.MissingPageTitle\");\r\n///<summary>&quot;To create a XSLT function at least one page has to be added.&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_MissingPageMessage=>T(\"AddNewXsltFunctionWorkflow.MissingPageMessage\");\r\n///<summary>&quot;The total length of the name and the namespace is too long (used to name the XSL file).&quot;</summary> \r\npublic static string AddNewXsltFunctionWorkflow_TotalNameTooLang=>T(\"AddNewXsltFunctionWorkflow.TotalNameTooLang\");\r\n///<summary>&quot;Delete XSLT Function?&quot;</summary> \r\npublic static string DeleteXsltFunctionWorkflow_ConfirmDeleteTitle=>T(\"DeleteXsltFunctionWorkflow.ConfirmDeleteTitle\");\r\n///<summary>&quot;Delete the selected XSLT?&quot;</summary> \r\npublic static string DeleteXsltFunctionWorkflow_ConfirmDeleteMessage=>T(\"DeleteXsltFunctionWorkflow.ConfirmDeleteMessage\");\r\n///<summary>&quot;Cascade Delete Error&quot;</summary> \r\npublic static string DeleteXsltFunctionWorkflow_CascadeDeleteErrorTitle=>T(\"DeleteXsltFunctionWorkflow.CascadeDeleteErrorTitle\");\r\n///<summary>&quot;The type is referenced by another type that does not allow cascade deletes. This operation is halted&quot;</summary> \r\npublic static string DeleteXsltFunctionWorkflow_CascadeDeleteErrorMessage=>T(\"DeleteXsltFunctionWorkflow.CascadeDeleteErrorMessage\");\r\n///<summary>&quot;An XSLT function with the same name already exists.&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_DuplicateName=>T(\"EditXsltFunctionWorkflow.DuplicateName\");\r\n///<summary>&quot;The method name must be non-empty&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_EmptyMethodName=>T(\"EditXsltFunctionWorkflow.EmptyMethodName\");\r\n///<summary>&quot;The namespace must be non-empty&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_NamespaceEmpty=>T(\"EditXsltFunctionWorkflow.NamespaceEmpty\");\r\n///<summary>&quot;The namespace must be like A.B.C - not start and end with &apos;.&apos; (period)&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_InvalidNamespace=>T(\"EditXsltFunctionWorkflow.InvalidNamespace\");\r\n///<summary>&quot;XslFilePath must start with \\ or /&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_InvalidFileName=>T(\"EditXsltFunctionWorkflow.InvalidFileName\");\r\n///<summary>&quot;Invalid function name&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_InvalidName=>T(\"EditXsltFunctionWorkflow.InvalidName\");\r\n///<summary>&quot;Cannot rename the function, file &apos;{0}&apos; already exists.&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_CannotRenameFileExists_Template=>T(\"EditXsltFunctionWorkflow.CannotRenameFileExists\");\r\n///<summary>&quot;Cannot rename the function, file &apos;{0}&apos; already exists.&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_CannotRenameFileExists(object parameter0)=>string.Format(T(\"EditXsltFunctionWorkflow.CannotRenameFileExists\"), parameter0);\r\n///<summary>&quot;The total length of the name and the namespace is too long (used to name the XSL file).&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_TotalNameTooLang=>T(\"EditXsltFunctionWorkflow.TotalNameTooLang\");\r\n///<summary>&quot;Duplicate local function names&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_SameLocalFunctionNameClashTitle=>T(\"EditXsltFunctionWorkflow.SameLocalFunctionNameClashTitle\");\r\n///<summary>&quot;Two or more function calls has the same local name. Change the names so that all are different.&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_SameLocalFunctionNameClashMessage=>T(\"EditXsltFunctionWorkflow.SameLocalFunctionNameClashMessage\");\r\n///<summary>&quot;Add XSLT Function&quot;</summary> \r\npublic static string XsltBasedFunctionProviderElementProvider_Add=>T(\"XsltBasedFunctionProviderElementProvider.Add\");\r\n///<summary>&quot;Add new XSLT function&quot;</summary> \r\npublic static string XsltBasedFunctionProviderElementProvider_AddToolTip=>T(\"XsltBasedFunctionProviderElementProvider.AddToolTip\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string XsltBasedFunctionProviderElementProvider_Edit=>T(\"XsltBasedFunctionProviderElementProvider.Edit\");\r\n///<summary>&quot;Edit XSLT function&quot;</summary> \r\npublic static string XsltBasedFunctionProviderElementProvider_EditToolTip=>T(\"XsltBasedFunctionProviderElementProvider.EditToolTip\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string XsltBasedFunctionProviderElementProvider_Delete=>T(\"XsltBasedFunctionProviderElementProvider.Delete\");\r\n///<summary>&quot;Delete XSLT function&quot;</summary> \r\npublic static string XsltBasedFunctionProviderElementProvider_DeleteToolTip=>T(\"XsltBasedFunctionProviderElementProvider.DeleteToolTip\");\r\n///<summary>&quot;Add New XSLT Function&quot;</summary> \r\npublic static string AddNewXsltFunctionStep1_LabelDialog=>T(\"AddNewXsltFunctionStep1.LabelDialog\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string AddNewXsltFunctionStep1_LabelName=>T(\"AddNewXsltFunctionStep1.LabelName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewXsltFunctionStep1_HelpName=>T(\"AddNewXsltFunctionStep1.HelpName\");\r\n///<summary>&quot;Namespace&quot;</summary> \r\npublic static string AddNewXsltFunctionStep1_LabelNamespace=>T(\"AddNewXsltFunctionStep1.LabelNamespace\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string AddNewXsltFunctionStep1_HelpNamespace=>T(\"AddNewXsltFunctionStep1.HelpNamespace\");\r\n///<summary>&quot;Output type&quot;</summary> \r\npublic static string AddNewXsltFunctionStep1_LabelOutputType=>T(\"AddNewXsltFunctionStep1.LabelOutputType\");\r\n///<summary>&quot;Copy from&quot;</summary> \r\npublic static string AddNewXsltFunctionStep1_LabelCopyFrom=>T(\"AddNewXsltFunctionStep1.LabelCopyFrom\");\r\n///<summary>&quot;(New XSLT function)&quot;</summary> \r\npublic static string AddNewXsltFunctionStep1_LabelCopyFromEmptyOption=>T(\"AddNewXsltFunctionStep1.LabelCopyFromEmptyOption\");\r\n///<summary>&quot;Settings&quot;</summary> \r\npublic static string EditXsltFunction_LabelSettings=>T(\"EditXsltFunction.LabelSettings\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string EditXsltFunction_LabelName=>T(\"EditXsltFunction.LabelName\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string EditXsltFunction_HelpName=>T(\"EditXsltFunction.HelpName\");\r\n///<summary>&quot;Namespace&quot;</summary> \r\npublic static string EditXsltFunction_LabelNamespace=>T(\"EditXsltFunction.LabelNamespace\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string EditXsltFunction_HelpNamespace=>T(\"EditXsltFunction.HelpNamespace\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string EditXsltFunction_LabelDescription=>T(\"EditXsltFunction.LabelDescription\");\r\n///<summary>&quot;&quot;</summary> \r\npublic static string EditXsltFunction_HelpDescription=>T(\"EditXsltFunction.HelpDescription\");\r\n///<summary>&quot;Debug&quot;</summary> \r\npublic static string EditXsltFunction_LabelDebug=>T(\"EditXsltFunction.LabelDebug\");\r\n///<summary>&quot;Page&quot;</summary> \r\npublic static string EditXsltFunction_LabelPage=>T(\"EditXsltFunction.LabelPage\");\r\n///<summary>&quot;When debugging, this page is used as context for the rendering.&quot;</summary> \r\npublic static string EditXsltFunction_HelpPage=>T(\"EditXsltFunction.HelpPage\");\r\n///<summary>&quot;Administrative&quot;</summary> \r\npublic static string EditXsltFunction_LabelAdminitrativeScope=>T(\"EditXsltFunction.LabelAdminitrativeScope\");\r\n///<summary>&quot;Public&quot;</summary> \r\npublic static string EditXsltFunction_LabelPublicScope=>T(\"EditXsltFunction.LabelPublicScope\");\r\n///<summary>&quot;Data scope&quot;</summary> \r\npublic static string EditXsltFunction_LabelPageDataScope=>T(\"EditXsltFunction.LabelPageDataScope\");\r\n///<summary>&quot;Choose public or development version as context for the rendering.&quot;</summary> \r\npublic static string EditXsltFunction_HelpPageDataScope=>T(\"EditXsltFunction.HelpPageDataScope\");\r\n///<summary>&quot;Language&quot;</summary> \r\npublic static string EditXsltFunction_LabelActiveLocales=>T(\"EditXsltFunction.LabelActiveLocales\");\r\n///<summary>&quot;Select language to be used while debugging the function.&quot;</summary> \r\npublic static string EditXsltFunction_HelpActiveLocales=>T(\"EditXsltFunction.HelpActiveLocales\");\r\n///<summary>&quot;Output type&quot;</summary> \r\npublic static string EditXsltFunction_OutputType=>T(\"EditXsltFunction.OutputType\");\r\n///<summary>&quot;Input Parameters&quot;</summary> \r\npublic static string EditXsltFunction_LabelInputParameters=>T(\"EditXsltFunction.LabelInputParameters\");\r\n///<summary>&quot;Function Calls&quot;</summary> \r\npublic static string EditXsltFunction_LabelFunctionCalls=>T(\"EditXsltFunction.LabelFunctionCalls\");\r\n///<summary>&quot;Template&quot;</summary> \r\npublic static string EditXsltFunction_LabelTemplate=>T(\"EditXsltFunction.LabelTemplate\");\r\n///<summary>&quot;Preview&quot;</summary> \r\npublic static string EditXsltFunction_LabelPreview=>T(\"EditXsltFunction.LabelPreview\");\r\n///<summary>&quot;A Language Is Required&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_MissingActiveLanguageTitle=>T(\"EditXsltFunctionWorkflow.MissingActiveLanguageTitle\");\r\n///<summary>&quot;To edit a XSLT function a language is required, but no languages have been added yet. You can add one under the System perspective.&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_MissingActiveLanguageMessage=>T(\"EditXsltFunctionWorkflow.MissingActiveLanguageMessage\");\r\n///<summary>&quot;A Page Is Required&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_MissingPageTitle=>T(\"EditXsltFunctionWorkflow.MissingPageTitle\");\r\n///<summary>&quot;To edit a XSLT function at least one page has to be added.&quot;</summary> \r\npublic static string EditXsltFunctionWorkflow_MissingPageMessage=>T(\"EditXsltFunctionWorkflow.MissingPageMessage\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Search {\r\n///<summary>&quot;Search&quot;</summary> \r\npublic static string SearchPerspective_Label=>T(\"SearchPerspective.Label\");\r\n///<summary>&quot;Search here...&quot;</summary> \r\npublic static string SearchPage_SearchHerePlaceholder=>T(\"SearchPage.SearchHerePlaceholder\");\r\n///<summary>&quot;No results found for &apos;{0}&apos;&quot;</summary> \r\npublic static string SearchPage_NoResultFound_Template=>T(\"SearchPage.NoResultFound\");\r\n///<summary>&quot;No results found for &apos;{0}&apos;&quot;</summary> \r\npublic static string SearchPage_NoResultFound(object parameter0)=>string.Format(T(\"SearchPage.NoResultFound\"), parameter0);\r\n///<summary>&quot;1 result found for &apos;{0}&apos;&quot;</summary> \r\npublic static string SearchPage_SingleResultFound_Template=>T(\"SearchPage.SingleResultFound\");\r\n///<summary>&quot;1 result found for &apos;{0}&apos;&quot;</summary> \r\npublic static string SearchPage_SingleResultFound(object parameter0)=>string.Format(T(\"SearchPage.SingleResultFound\"), parameter0);\r\n///<summary>&quot;{1} results for &apos;{0}&apos;&quot;</summary> \r\npublic static string SearchPage_MultipleResultsFound_Template=>T(\"SearchPage.MultipleResultsFound\");\r\n///<summary>&quot;{1} results for &apos;{0}&apos;&quot;</summary> \r\npublic static string SearchPage_MultipleResultsFound(object parameter0,object parameter1)=>string.Format(T(\"SearchPage.MultipleResultsFound\"), parameter0,parameter1);\r\n///<summary>&quot;Page&quot;</summary> \r\npublic static string DataType_Page=>T(\"DataType.Page\");\r\n///<summary>&quot;Media File&quot;</summary> \r\npublic static string DataType_MediaFile=>T(\"DataType.MediaFile\");\r\n///<summary>&quot;Page Type&quot;</summary> \r\npublic static string FieldNames_PageTypeId=>T(\"FieldNames.PageTypeId\");\r\n///<summary>&quot;Label&quot;</summary> \r\npublic static string FieldNames_Label=>T(\"FieldNames.Label\");\r\n///<summary>&quot;Description&quot;</summary> \r\npublic static string FieldNames_Description=>T(\"FieldNames.Description\");\r\n///<summary>&quot;Data Type&quot;</summary> \r\npublic static string FieldNames_DataType=>T(\"FieldNames.DataType\");\r\n///<summary>&quot;Last Updated&quot;</summary> \r\npublic static string FieldNames_LastUpdated=>T(\"FieldNames.LastUpdated\");\r\n///<summary>&quot;Updated By&quot;</summary> \r\npublic static string FieldNames_UpdatedBy=>T(\"FieldNames.UpdatedBy\");\r\n///<summary>&quot;Publication Status&quot;</summary> \r\npublic static string FieldNames_PublicationStatus=>T(\"FieldNames.PublicationStatus\");\r\n///<summary>&quot;Media Type&quot;</summary> \r\npublic static string FieldNames_MimeType=>T(\"FieldNames.MimeType\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Search\", key);\r\n/// <exclude />\r\npublic static class Untranslated {\r\n///<summary>&quot;Search&quot;</summary>\r\npublic const string SearchPerspective_Label=\"${Composite.Search,SearchPerspective.Label}\";\r\n///<summary>&quot;Search here...&quot;</summary>\r\npublic const string SearchPage_SearchHerePlaceholder=\"${Composite.Search,SearchPage.SearchHerePlaceholder}\";\r\n///<summary>&quot;No results found for &apos;{0}&apos;&quot;</summary>\r\npublic const string SearchPage_NoResultFound=\"${Composite.Search,SearchPage.NoResultFound}\";\r\n///<summary>&quot;1 result found for &apos;{0}&apos;&quot;</summary>\r\npublic const string SearchPage_SingleResultFound=\"${Composite.Search,SearchPage.SingleResultFound}\";\r\n///<summary>&quot;{1} results for &apos;{0}&apos;&quot;</summary>\r\npublic const string SearchPage_MultipleResultsFound=\"${Composite.Search,SearchPage.MultipleResultsFound}\";\r\n///<summary>&quot;Page&quot;</summary>\r\npublic const string DataType_Page=\"${Composite.Search,DataType.Page}\";\r\n///<summary>&quot;Media File&quot;</summary>\r\npublic const string DataType_MediaFile=\"${Composite.Search,DataType.MediaFile}\";\r\n///<summary>&quot;Page Type&quot;</summary>\r\npublic const string FieldNames_PageTypeId=\"${Composite.Search,FieldNames.PageTypeId}\";\r\n///<summary>&quot;Label&quot;</summary>\r\npublic const string FieldNames_Label=\"${Composite.Search,FieldNames.Label}\";\r\n///<summary>&quot;Description&quot;</summary>\r\npublic const string FieldNames_Description=\"${Composite.Search,FieldNames.Description}\";\r\n///<summary>&quot;Data Type&quot;</summary>\r\npublic const string FieldNames_DataType=\"${Composite.Search,FieldNames.DataType}\";\r\n///<summary>&quot;Last Updated&quot;</summary>\r\npublic const string FieldNames_LastUpdated=\"${Composite.Search,FieldNames.LastUpdated}\";\r\n///<summary>&quot;Updated By&quot;</summary>\r\npublic const string FieldNames_UpdatedBy=\"${Composite.Search,FieldNames.UpdatedBy}\";\r\n///<summary>&quot;Publication Status&quot;</summary>\r\npublic const string FieldNames_PublicationStatus=\"${Composite.Search,FieldNames.PublicationStatus}\";\r\n///<summary>&quot;Media Type&quot;</summary>\r\npublic const string FieldNames_MimeType=\"${Composite.Search,FieldNames.MimeType}\";\r\n\r\n}} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Web_FormControl_FunctionCallsDesigner {\r\n///<summary>&quot;Function Properties&quot;</summary> \r\npublic static string DialogTitle=>T(\"DialogTitle\");\r\n///<summary>&quot;Function result local name&quot;</summary> \r\npublic static string FunctionLocalNameGroupLabel=>T(\"FunctionLocalNameGroupLabel\");\r\n///<summary>&quot;Local name&quot;</summary> \r\npublic static string FunctionLocalNameLabel=>T(\"FunctionLocalNameLabel\");\r\n///<summary>&quot;If you include a function multiple times this field can help you distinguish the individual results by their local name. &quot;</summary> \r\npublic static string FunctionLocalNameHelp=>T(\"FunctionLocalNameHelp\");\r\n///<summary>&quot;Parameter Value&quot;</summary> \r\npublic static string ParameterValueLabel=>T(\"ParameterValueLabel\");\r\n///<summary>&quot;Select Function&quot;</summary> \r\npublic static string AddNewFunctionDialogLabel=>T(\"AddNewFunctionDialogLabel\");\r\n///<summary>&quot;Select Function&quot;</summary> \r\npublic static string SetNewFunctionDialogLabel=>T(\"SetNewFunctionDialogLabel\");\r\n///<summary>&quot;Value for parameter &apos;{0}&apos;&quot;</summary> \r\npublic static string ComplexFunctionCallDialogLabel_Template=>T(\"ComplexFunctionCallDialogLabel\");\r\n///<summary>&quot;Value for parameter &apos;{0}&apos;&quot;</summary> \r\npublic static string ComplexFunctionCallDialogLabel(object parameter0)=>string.Format(T(\"ComplexFunctionCallDialogLabel\"), parameter0);\r\n///<summary>&quot;Parameter Type&quot;</summary> \r\npublic static string ParameterTypeLabel=>T(\"ParameterTypeLabel\");\r\n///<summary>&quot;Parameter Name&quot;</summary> \r\npublic static string ParameterNameLabel=>T(\"ParameterNameLabel\");\r\n///<summary>&quot;Return type&quot;</summary> \r\npublic static string ReturnTypeLabel=>T(\"ReturnTypeLabel\");\r\n///<summary>&quot;Validation failed&quot;</summary> \r\npublic static string ValidationFailedAlertTitle=>T(\"ValidationFailedAlertTitle\");\r\n///<summary>&quot;Function &apos;{0}&apos; does not exist.&quot;</summary> \r\npublic static string FunctionNotFound_Template=>T(\"FunctionNotFound\");\r\n///<summary>&quot;Function &apos;{0}&apos; does not exist.&quot;</summary> \r\npublic static string FunctionNotFound(object parameter0)=>string.Format(T(\"FunctionNotFound\"), parameter0);\r\n///<summary>&quot;Required parameter &apos;{0}&apos; has not been defined.&quot;</summary> \r\npublic static string RequiredParameterNotDefined_Template=>T(\"RequiredParameterNotDefined\");\r\n///<summary>&quot;Required parameter &apos;{0}&apos; has not been defined.&quot;</summary> \r\npublic static string RequiredParameterNotDefined(object parameter0)=>string.Format(T(\"RequiredParameterNotDefined\"), parameter0);\r\n///<summary>&quot;Incorrect type cast. Parameter name: &apos;{0}&apos;, function name: &apos;{1}&apos;.&quot;</summary> \r\npublic static string IncorrectTypeCast_Template=>T(\"IncorrectTypeCast\");\r\n///<summary>&quot;Incorrect type cast. Parameter name: &apos;{0}&apos;, function name: &apos;{1}&apos;.&quot;</summary> \r\npublic static string IncorrectTypeCast(object parameter0,object parameter1)=>string.Format(T(\"IncorrectTypeCast\"), parameter0,parameter1);\r\n///<summary>&quot;Default&quot;</summary> \r\npublic static string ParameterTypeDefaultLabel=>T(\"ParameterTypeDefaultLabel\");\r\n///<summary>&quot;Constant&quot;</summary> \r\npublic static string ParameterTypeConstantLabel=>T(\"ParameterTypeConstantLabel\");\r\n///<summary>&quot;Input Parameter&quot;</summary> \r\npublic static string ParameterTypeInputParameterLabel=>T(\"ParameterTypeInputParameterLabel\");\r\n///<summary>&quot;Function&quot;</summary> \r\npublic static string ParameterTypeFunctionLabel=>T(\"ParameterTypeFunctionLabel\");\r\n///<summary>&quot;Add New&quot;</summary> \r\npublic static string AddNewButtonLabel=>T(\"AddNewButtonLabel\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteButtonLabel=>T(\"DeleteButtonLabel\");\r\n///<summary>&quot;Set New&quot;</summary> \r\npublic static string SetNewButtonLabel=>T(\"SetNewButtonLabel\");\r\n///<summary>&quot;Source&quot;</summary> \r\npublic static string ToolBar_LabelSource=>T(\"ToolBar.LabelSource\");\r\n///<summary>&quot;Design&quot;</summary> \r\npublic static string ToolBar_LabelDesign=>T(\"ToolBar.LabelDesign\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Web.FormControl.FunctionCallsDesigner\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Web_FormControl_FunctionParameterDesigner {\r\n///<summary>&quot;Add New&quot;</summary> \r\npublic static string AddNewButtonLabel=>T(\"AddNewButtonLabel\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteButtonLabel=>T(\"DeleteButtonLabel\");\r\n///<summary>&quot;List of input parameters&quot;</summary> \r\npublic static string TreeRootNodeLabel=>T(\"TreeRootNodeLabel\");\r\n///<summary>&quot;Parameter naming and help&quot;</summary> \r\npublic static string ParameterNamingGroupLabel=>T(\"ParameterNamingGroupLabel\");\r\n///<summary>&quot;Parameter name&quot;</summary> \r\npublic static string Name=>T(\"Name\");\r\n///<summary>&quot;The name of the parameter. The name is used by the system to identify this parameter. Names must be unique and may not contain spaces and other special characters. Use names like &apos;Title&apos;, &apos;StartDate&apos;, &apos;LargeImage&apos; etc.&quot;</summary> \r\npublic static string NameHelp=>T(\"NameHelp\");\r\n///<summary>&quot;Label&quot;</summary> \r\npublic static string Label=>T(\"Label\");\r\n///<summary>&quot;The text that users should see when specifying a value for this parameter. This is the &apos;human name&apos; for the parameter.&quot;</summary> \r\npublic static string LabelHelp=>T(\"LabelHelp\");\r\n///<summary>&quot;Help&quot;</summary> \r\npublic static string Help=>T(\"Help\");\r\n///<summary>&quot;Write a short text that tells the user what to do with the parameter.&quot;</summary> \r\npublic static string HelpHelp=>T(\"HelpHelp\");\r\n///<summary>&quot;Parameter type and values&quot;</summary> \r\npublic static string ParameterTypeValueGroupLabel=>T(\"ParameterTypeValueGroupLabel\");\r\n///<summary>&quot;Parameter type&quot;</summary> \r\npublic static string Type=>T(\"Type\");\r\n///<summary>&quot;The type of this parameter.&quot;</summary> \r\npublic static string TypeHelp=>T(\"TypeHelp\");\r\n///<summary>&quot;Default value&quot;</summary> \r\npublic static string DefaultValue=>T(\"DefaultValue\");\r\n///<summary>&quot;You can specify a default value for this parameter. If a parameter has a default value, users are not required to specify it when calling the function.&quot;</summary> \r\npublic static string DefaultValueHelp=>T(\"DefaultValueHelp\");\r\n///<summary>&quot;Specify default value&quot;</summary> \r\npublic static string DefaultValueSpecify=>T(\"DefaultValueSpecify\");\r\n///<summary>&quot;Edit default value&quot;</summary> \r\npublic static string DefaultValueEdit=>T(\"DefaultValueEdit\");\r\n///<summary>&quot;Parameter Default Value&quot;</summary> \r\npublic static string DefaultValueDialogLabel=>T(\"DefaultValueDialogLabel\");\r\n///<summary>&quot;Test value&quot;</summary> \r\npublic static string TestValue=>T(\"TestValue\");\r\n///<summary>&quot;When previewing you can test with different input parameter values using this field. If this is left blank, the default value will be used for previews.&quot;</summary> \r\npublic static string TestValueHelp=>T(\"TestValueHelp\");\r\n///<summary>&quot;Specify test value&quot;</summary> \r\npublic static string TestValueSpecify=>T(\"TestValueSpecify\");\r\n///<summary>&quot;Edit test value&quot;</summary> \r\npublic static string TestValueEdit=>T(\"TestValueEdit\");\r\n///<summary>&quot;Parameter Test Value&quot;</summary> \r\npublic static string TestValueDialogLabel=>T(\"TestValueDialogLabel\");\r\n///<summary>&quot;Parameter presentation&quot;</summary> \r\npublic static string ParameterPresentationGroupLabel=>T(\"ParameterPresentationGroupLabel\");\r\n///<summary>&quot;Widget&quot;</summary> \r\npublic static string Widget=>T(\"Widget\");\r\n///<summary>&quot;You can select which type of input widget (like a textbox) to use when specifying a value for this parameter. Widgets are only available for simple types.&quot;</summary> \r\npublic static string WidgetHelp=>T(\"WidgetHelp\");\r\n///<summary>&quot;(no widget specified)&quot;</summary> \r\npublic static string NoWidgetSpecifiedLabel=>T(\"NoWidgetSpecifiedLabel\");\r\n///<summary>&quot;Parameter Widget&quot;</summary> \r\npublic static string WidgetDialogLabel=>T(\"WidgetDialogLabel\");\r\n///<summary>&quot;Position&quot;</summary> \r\npublic static string Position=>T(\"Position\");\r\n///<summary>&quot;Last&quot;</summary> \r\npublic static string PositionLast=>T(\"PositionLast\");\r\n///<summary>&quot;The position of the parameter. This controls the order of the parameters.&quot;</summary> \r\npublic static string PositionHelp=>T(\"PositionHelp\");\r\n///<summary>&quot;Remember to specify a widget...&quot;</summary> \r\npublic static string SpecifyWidgetTip=>T(\"SpecifyWidgetTip\");\r\n///<summary>&quot;The specified name is not valid.&quot;</summary> \r\npublic static string FieldNameSyntaxInvalid=>T(\"FieldNameSyntaxInvalid\");\r\n///<summary>&quot;Can not save... Another parameter has the same name. Please change the name.&quot;</summary> \r\npublic static string CannotSave=>T(\"CannotSave\");\r\n///<summary>&quot;Invalid name. Parameter names can not contain spaces. You can write a readable name in the Label field below.&quot;</summary> \r\npublic static string SpaceInNameError=>T(\"SpaceInNameError\");\r\n///<summary>&quot;Parameter names can not be empty. Please specify a name.&quot;</summary> \r\npublic static string NameEmptyError=>T(\"NameEmptyError\");\r\n///<summary>&quot;Another parameter uses this name. Parameter names must be unique.&quot;</summary> \r\npublic static string NameAlreadyInUseError=>T(\"NameAlreadyInUseError\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Web.FormControl.FunctionParameterDesigner\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Web_FormControl_TypeFieldDesigner {\r\n///<summary>&quot;Basic&quot;</summary> \r\npublic static string BasicTabLabel=>T(\"BasicTabLabel\");\r\n///<summary>&quot;Advanced&quot;</summary> \r\npublic static string AdvancedTabLabel=>T(\"AdvancedTabLabel\");\r\n///<summary>&quot;Add New&quot;</summary> \r\npublic static string AddNewButtonLabel=>T(\"AddNewButtonLabel\");\r\n///<summary>&quot;Delete&quot;</summary> \r\npublic static string DeleteButtonLabel=>T(\"DeleteButtonLabel\");\r\n///<summary>&quot;Datatype Fields&quot;</summary> \r\npublic static string LabelDataTypeFields=>T(\"LabelDataTypeFields\");\r\n///<summary>&quot;Key field properties&quot;</summary> \r\npublic static string KeyFieldDetailsGroupLabel=>T(\"KeyFieldDetailsGroupLabel\");\r\n///<summary>&quot;Key field type&quot;</summary> \r\npublic static string KeyFieldType=>T(\"KeyFieldType\");\r\n///<summary>&quot;The data type of the key field. Guid fields feature optimal performance, string key fields are usefull when the id values have to be exposed in urls.&quot;</summary> \r\npublic static string KeyFieldTypeHelp=>T(\"KeyFieldTypeHelp\");\r\n///<summary>&quot;Field properties&quot;</summary> \r\npublic static string FieldDetailsGroupLabel=>T(\"FieldDetailsGroupLabel\");\r\n///<summary>&quot;Name&quot;</summary> \r\npublic static string Name=>T(\"Name\");\r\n///<summary>&quot;The name of the field is used by the system to identify this field. Names must be unique and can not contain spaces and other special characters. Use names like &apos;Title&apos;, &apos;StartDate&apos;, &apos;LargeImage&apos; etc.&quot;</summary> \r\npublic static string NameHelp=>T(\"NameHelp\");\r\n///<summary>&quot;Label&quot;</summary> \r\npublic static string Label=>T(\"Label\");\r\n///<summary>&quot;Label text are showed to users when adding a new item based on the datatype.&quot;</summary> \r\npublic static string LabelHelp=>T(\"LabelHelp\");\r\n///<summary>&quot;Help&quot;</summary> \r\npublic static string Help=>T(\"Help\");\r\n///<summary>&quot;Use this entry for a short help text to the user.&quot;</summary> \r\npublic static string HelpHelp=>T(\"HelpHelp\");\r\n///<summary>&quot;Field type and requirements&quot;</summary> \r\npublic static string FieldTypeGroupLabel=>T(\"FieldTypeGroupLabel\");\r\n///<summary>&quot;Field type&quot;</summary> \r\npublic static string FieldType=>T(\"FieldType\");\r\n///<summary>&quot;Select a data type for the field. The type determine which kind of data the field can hold.&quot;</summary> \r\npublic static string FieldTypeHelp=>T(\"FieldTypeHelp\");\r\n///<summary>&quot;String&quot;</summary> \r\npublic static string System_String=>T(\"System.String\");\r\n///<summary>&quot;Integer&quot;</summary> \r\npublic static string System_Int32=>T(\"System.Int32\");\r\n///<summary>&quot;Decimal number&quot;</summary> \r\npublic static string System_Decimal=>T(\"System.Decimal\");\r\n///<summary>&quot;Date&quot;</summary> \r\npublic static string System_DateTime=>T(\"System.DateTime\");\r\n///<summary>&quot;Boolean&quot;</summary> \r\npublic static string System_Boolean=>T(\"System.Boolean\");\r\n///<summary>&quot;Unique Identifier (GUID)&quot;</summary> \r\npublic static string System_Guid=>T(\"System.Guid\");\r\n///<summary>&quot;Data reference&quot;</summary> \r\npublic static string Reference=>T(\"Reference\");\r\n///<summary>&quot;Use this field to further configure your selected type.&quot;</summary> \r\npublic static string TypeDetailsHelp=>T(\"TypeDetailsHelp\");\r\n///<summary>&quot;Optional&quot;</summary> \r\npublic static string Optional=>T(\"Optional\");\r\n///<summary>&quot;Optional fields may be left blank.&quot;</summary> \r\npublic static string OptionalHelp=>T(\"OptionalHelp\");\r\n///<summary>&quot;No&quot;</summary> \r\npublic static string OptionalFalseLabel=>T(\"OptionalFalseLabel\");\r\n///<summary>&quot;Yes&quot;</summary> \r\npublic static string OptionalTrueLabel=>T(\"OptionalTrueLabel\");\r\n///<summary>&quot;Validation rules&quot;</summary> \r\npublic static string ValidationRules=>T(\"ValidationRules\");\r\n///<summary>&quot;You can specify strict rules on the data that is entered in this field, i.e. &quot;must be at least 5 characters long&quot;, &quot;must be a valid e-mail address&quot;, &quot;must be a date in the past&quot; etc.&quot;</summary> \r\npublic static string ValidationRulesHelp=>T(\"ValidationRulesHelp\");\r\n///<summary>&quot;Add validation rules...&quot;</summary> \r\npublic static string ValidationRulesAdd=>T(\"ValidationRulesAdd\");\r\n///<summary>&quot;Edit validation rules&quot;</summary> \r\npublic static string ValidationRulesEdit=>T(\"ValidationRulesEdit\");\r\n///<summary>&quot;Field Validation Rules Configuration&quot;</summary> \r\npublic static string ValidationRulesDialogLabel=>T(\"ValidationRulesDialogLabel\");\r\n///<summary>&quot;Field validation&quot;</summary> \r\npublic static string FieldValidationGroupLabel=>T(\"FieldValidationGroupLabel\");\r\n///<summary>&quot;Form field presentation&quot;</summary> \r\npublic static string FieldPresentationGroupLabel=>T(\"FieldPresentationGroupLabel\");\r\n///<summary>&quot;Structural presentation&quot;</summary> \r\npublic static string FieldStructureGroupLabel=>T(\"FieldStructureGroupLabel\");\r\n///<summary>&quot;Widget type&quot;</summary> \r\npublic static string Widget=>T(\"Widget\");\r\n///<summary>&quot;You can select which type of input widget (like a textbox) to use when editing this field.&quot;</summary> \r\npublic static string WidgetHelp=>T(\"WidgetHelp\");\r\n///<summary>&quot;Field Widget Configuration&quot;</summary> \r\npublic static string WidgetDialogLabel=>T(\"WidgetDialogLabel\");\r\n///<summary>&quot;Position&quot;</summary> \r\npublic static string Position=>T(\"Position\");\r\n///<summary>&quot;Last&quot;</summary> \r\npublic static string PositionLast=>T(\"PositionLast\");\r\n///<summary>&quot;The position of the field. This controls the order of the fields.&quot;</summary> \r\npublic static string PositionHelp=>T(\"PositionHelp\");\r\n///<summary>&quot;Tree grouping&quot;</summary> \r\npublic static string GroupByPriority=>T(\"GroupByPriority\");\r\n///<summary>&quot;(no grouping)...&quot;</summary> \r\npublic static string GroupByPriorityNone=>T(\"GroupByPriorityNone\");\r\n///<summary>&quot;Group by this field&quot;</summary> \r\npublic static string GroupByPriorityFirst=>T(\"GroupByPriorityFirst\");\r\n///<summary>&quot;Group as {0}. priority&quot;</summary> \r\npublic static string GroupByPriorityN_Template=>T(\"GroupByPriorityN\");\r\n///<summary>&quot;Group as {0}. priority&quot;</summary> \r\npublic static string GroupByPriorityN(object parameter0)=>string.Format(T(\"GroupByPriorityN\"), parameter0);\r\n///<summary>&quot;You can specify that a field should be used to group data - this can improve readability when viewing long lists. Use priority when multiple fields are used for grouping.&quot;</summary> \r\npublic static string GroupByPriorityHelp=>T(\"GroupByPriorityHelp\");\r\n///<summary>&quot;Tree ordering&quot;</summary> \r\npublic static string TreeOrdering=>T(\"TreeOrdering\");\r\n///<summary>&quot;(no ordering)...&quot;</summary> \r\npublic static string TreeOrderingNone=>T(\"TreeOrderingNone\");\r\n///<summary>&quot;Order ascending (A-Z)&quot;</summary> \r\npublic static string TreeOrderingFirstAscending=>T(\"TreeOrderingFirstAscending\");\r\n///<summary>&quot;Order descending (Z-A)&quot;</summary> \r\npublic static string TreeOrderingFirstDescending=>T(\"TreeOrderingFirstDescending\");\r\n///<summary>&quot;Order {0}. ascending&quot;</summary> \r\npublic static string TreeOrderingNAscending_Template=>T(\"TreeOrderingNAscending\");\r\n///<summary>&quot;Order {0}. ascending&quot;</summary> \r\npublic static string TreeOrderingNAscending(object parameter0)=>string.Format(T(\"TreeOrderingNAscending\"), parameter0);\r\n///<summary>&quot;Order {0}. descending&quot;</summary> \r\npublic static string TreeOrderingNDescending_Template=>T(\"TreeOrderingNDescending\");\r\n///<summary>&quot;Order {0}. descending&quot;</summary> \r\npublic static string TreeOrderingNDescending(object parameter0)=>string.Format(T(\"TreeOrderingNDescending\"), parameter0);\r\n///<summary>&quot;You can specify that a field should be used to order data in the tree view - this can improve readability when a field is used to position elements on the website.&quot;</summary> \r\npublic static string TreeOrderingHelp=>T(\"TreeOrderingHelp\");\r\n///<summary>&quot;Is title field&quot;</summary> \r\npublic static string IsTitleField=>T(\"IsTitleField\");\r\n///<summary>&quot;Check this if you wish this field to be used as the title field. Title fields are used when listing data, like in the tree to the left.&quot;</summary> \r\npublic static string IsTitleFieldHelp=>T(\"IsTitleFieldHelp\");\r\n///<summary>&quot;Use this as title field in lists&quot;</summary> \r\npublic static string IsTitleFieldLabel=>T(\"IsTitleFieldLabel\");\r\n///<summary>&quot;Field default value&quot;</summary> \r\npublic static string DefaultValueGroupLabel=>T(\"DefaultValueGroupLabel\");\r\n///<summary>&quot;Default value&quot;</summary> \r\npublic static string DefaultValue=>T(\"DefaultValue\");\r\n///<summary>&quot;You can define a default value for this field.&quot;</summary> \r\npublic static string DefaultValueHelp=>T(\"DefaultValueHelp\");\r\n///<summary>&quot;Field default value configuration&quot;</summary> \r\npublic static string DefaultValueDialogLabel=>T(\"DefaultValueDialogLabel\");\r\n///<summary>&quot;Data url&quot;</summary> \r\npublic static string DataUrlGroupLabel=>T(\"DataUrlGroupLabel\");\r\n///<summary>&quot;Field appears in data url&quot;</summary> \r\npublic static string AppearsInUrlLabel=>T(\"AppearsInUrlLabel\");\r\n///<summary>&quot;Use in data urls&quot;</summary> \r\npublic static string AppearsInUrlItemLabel=>T(\"AppearsInUrlItemLabel\");\r\n///<summary>&quot;When checked the field will appear in data urls&quot;</summary> \r\npublic static string AppearsInUrlHelp=>T(\"AppearsInUrlHelp\");\r\n///<summary>&quot;Order&quot;</summary> \r\npublic static string DataUrlOrderLabel=>T(\"DataUrlOrderLabel\");\r\n///<summary>&quot;Order in which the field appear in data url route&quot;</summary> \r\npublic static string DataUrlOrderHelp=>T(\"DataUrlOrderHelp\");\r\n///<summary>&quot;Format&quot;</summary> \r\npublic static string DataUrlDateFormatLabel=>T(\"DataUrlDateFormatLabel\");\r\n///<summary>&quot;Chose in what format the date field will appear in url&quot;</summary> \r\npublic static string DataUrlDateFormatHelp=>T(\"DataUrlDateFormatHelp\");\r\n///<summary>&quot;Year&quot;</summary> \r\npublic static string DataUrlDateFormat_Year=>T(\"DataUrlDateFormat_Year\");\r\n///<summary>&quot;Month&quot;</summary> \r\npublic static string DataUrlDateFormat_Month=>T(\"DataUrlDateFormat_Month\");\r\n///<summary>&quot;Day&quot;</summary> \r\npublic static string DataUrlDateFormat_Day=>T(\"DataUrlDateFormat_Day\");\r\n///<summary>&quot;String maximum length&quot;</summary> \r\npublic static string StringMaximumLength=>T(\"StringMaximumLength\");\r\n///<summary>&quot;16 character maximum&quot;</summary> \r\npublic static string _16CharMax=>T(\"16CharMax\");\r\n///<summary>&quot;32 character maximum&quot;</summary> \r\npublic static string _32CharMax=>T(\"32CharMax\");\r\n///<summary>&quot;64 character maximum&quot;</summary> \r\npublic static string _64CharMax=>T(\"64CharMax\");\r\n///<summary>&quot;128 character maximum&quot;</summary> \r\npublic static string _128CharMax=>T(\"128CharMax\");\r\n///<summary>&quot;256 character maximum&quot;</summary> \r\npublic static string _256CharMax=>T(\"256CharMax\");\r\n///<summary>&quot;512 character maximum&quot;</summary> \r\npublic static string _512CharMax=>T(\"512CharMax\");\r\n///<summary>&quot;1024 character maximum&quot;</summary> \r\npublic static string _1024CharMax=>T(\"1024CharMax\");\r\n///<summary>&quot;Unlimited length&quot;</summary> \r\npublic static string Unlimited=>T(\"Unlimited\");\r\n///<summary>&quot;Search&quot;</summary> \r\npublic static string SearchGroupLabel=>T(\"SearchGroupLabel\");\r\n///<summary>&quot;Text Search&quot;</summary> \r\npublic static string Search_TextSearch=>T(\"Search.TextSearch\");\r\n///<summary>&quot;Index text content&quot;</summary> \r\npublic static string Search_IndexText_Label=>T(\"Search.IndexText.Label\");\r\n///<summary>&quot;When checked, the text content of the field will be searchable.&quot;</summary> \r\npublic static string Search_IndexText_Help=>T(\"Search.IndexText.Help\");\r\n///<summary>&quot;Search Results&quot;</summary> \r\npublic static string Search_SearchResults=>T(\"Search.SearchResults\");\r\n///<summary>&quot;Enable field preview&quot;</summary> \r\npublic static string Search_FieldPreview_Label=>T(\"Search.FieldPreview.Label\");\r\n///<summary>&quot;When checked, the field will appear in the search results table as a column.&quot;</summary> \r\npublic static string Search_FieldPreview_Help=>T(\"Search.FieldPreview.Help\");\r\n///<summary>&quot;Faceted Search&quot;</summary> \r\npublic static string Search_FacetedSearch=>T(\"Search.FacetedSearch\");\r\n///<summary>&quot;Enable faceted search&quot;</summary> \r\npublic static string Search_Facet_Label=>T(\"Search.Facet.Label\");\r\n///<summary>&quot;When checked, the field will appear in search results as a facet.&quot;</summary> \r\npublic static string Search_Facet_Help=>T(\"Search.Facet.Help\");\r\n///<summary>&quot;Decimal number format&quot;</summary> \r\npublic static string DecimalNumberFormat=>T(\"DecimalNumberFormat\");\r\n///<summary>&quot;1 decimal place&quot;</summary> \r\npublic static string _1DecimalPlace=>T(\"1DecimalPlace\");\r\n///<summary>&quot;{0} decimal places&quot;</summary> \r\npublic static string nDecimalPlaces_Template=>T(\"nDecimalPlaces\");\r\n///<summary>&quot;{0} decimal places&quot;</summary> \r\npublic static string nDecimalPlaces(object parameter0)=>string.Format(T(\"nDecimalPlaces\"), parameter0);\r\n///<summary>&quot;Reference Type&quot;</summary> \r\npublic static string ReferenceType=>T(\"ReferenceType\");\r\n///<summary>&quot;The specified name is not valid.&quot;</summary> \r\npublic static string FieldNameSyntaxInvalid=>T(\"FieldNameSyntaxInvalid\");\r\n///<summary>&quot;Can not save... Another Field has the same name. Please change the name.&quot;</summary> \r\npublic static string CannotSave=>T(\"CannotSave\");\r\n///<summary>&quot;Invalid name. Data field names can not contain spaces. You can write a readable name in the Label field below.&quot;</summary> \r\npublic static string SpaceInNameError=>T(\"SpaceInNameError\");\r\n///<summary>&quot;Data field names can not be empty. Please specify a name.&quot;</summary> \r\npublic static string NameEmptyError=>T(\"NameEmptyError\");\r\n///<summary>&quot;Another field uses this name. Data field names must be unique.&quot;</summary> \r\npublic static string NameAlreadyInUseError=>T(\"NameAlreadyInUseError\");\r\n///<summary>&quot;The selected type can not be optional.&quot;</summary> \r\npublic static string NotAnOptionalTypeError=>T(\"NotAnOptionalTypeError\");\r\n///<summary>&quot;Remember to specify a widget...&quot;</summary> \r\npublic static string NoWidgetSelected=>T(\"NoWidgetSelected\");\r\n///<summary>&quot;(no widget specified)&quot;</summary> \r\npublic static string NoWidgetSelectedLabel=>T(\"NoWidgetSelectedLabel\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Web.FormControl.TypeFieldDesigner\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Web_PageBrowser {\r\n///<summary>&quot;Page source&quot;</summary> \r\npublic static string Menu_ViewSource=>T(\"Menu.ViewSource\");\r\n///<summary>&quot;View mode&quot;</summary> \r\npublic static string Menu_ViewMode=>T(\"Menu.ViewMode\");\r\n///<summary>&quot;Back&quot;</summary> \r\npublic static string ContextMenu_Back=>T(\"ContextMenu.Back\");\r\n///<summary>&quot;Forward&quot;</summary> \r\npublic static string ContextMenu_Forward=>T(\"ContextMenu.Forward\");\r\n///<summary>&quot;Refresh&quot;</summary> \r\npublic static string ContextMenu_Refresh=>T(\"ContextMenu.Refresh\");\r\n///<summary>&quot;View Page Source&quot;</summary> \r\npublic static string ContextMenu_ViewSource=>T(\"ContextMenu.ViewSource\");\r\n///<summary>&quot;Go back one page&quot;</summary> \r\npublic static string ToolBarButton_Back_ToolTip=>T(\"ToolBarButton.Back.ToolTip\");\r\n///<summary>&quot;Go forward one page&quot;</summary> \r\npublic static string ToolBarButton_Forward_ToolTip=>T(\"ToolBarButton.Forward.ToolTip\");\r\n///<summary>&quot;Refresh page&quot;</summary> \r\npublic static string ToolBarButton_Refresh_ToolTip=>T(\"ToolBarButton.Refresh.ToolTip\");\r\n///<summary>&quot;Show Tree&quot;</summary> \r\npublic static string ToolBarButton_TreeView_ToolTip=>T(\"ToolBarButton.TreeView.ToolTip\");\r\n///<summary>&quot;Go to the address in the location bar&quot;</summary> \r\npublic static string ToolBarButton_Go_ToolTip=>T(\"ToolBarButton.Go.ToolTip\");\r\n///<summary>&quot;Go to the Start page&quot;</summary> \r\npublic static string ToolBarButton_Home_ToolTip=>T(\"ToolBarButton.Home.ToolTip\");\r\n///<summary>&quot;Access denied&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogTitle_External=>T(\"AddressBar.Invalid.DialogTitle.External\");\r\n///<summary>&quot;External URL cannot loaded.&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogText_External=>T(\"AddressBar.Invalid.DialogText.External\");\r\n///<summary>&quot;Bad URL&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogTitle_BadRequest=>T(\"AddressBar.Invalid.DialogTitle.BadRequest\");\r\n///<summary>&quot;The URL is invalid and cannot be loaded.&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogText_BadRequest=>T(\"AddressBar.Invalid.DialogText.BadRequest\");\r\n///<summary>&quot;Not authorized&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogTitle_Unauthorized=>T(\"AddressBar.Invalid.DialogTitle.Unauthorized\");\r\n///<summary>&quot;You are not authorized to view the page on specified URL.&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogText_Unauthorized=>T(\"AddressBar.Invalid.DialogText.Unauthorized\");\r\n///<summary>&quot;Page not found&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogTitle_NotFound=>T(\"AddressBar.Invalid.DialogTitle.NotFound\");\r\n///<summary>&quot;Page not found on the specified URL.&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogText_NotFound=>T(\"AddressBar.Invalid.DialogText.NotFound\");\r\n///<summary>&quot;Server error&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogTitle_InternalError=>T(\"AddressBar.Invalid.DialogTitle.InternalError\");\r\n///<summary>&quot;The server has reported an error on the specified URL. The page cannot be loaded.&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogText_InternalError=>T(\"AddressBar.Invalid.DialogText.InternalError\");\r\n///<summary>&quot;Page not loaded&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogTitle_Default=>T(\"AddressBar.Invalid.DialogTitle.Default\");\r\n///<summary>&quot;An error prevents the URL from being loaded.&quot;</summary> \r\npublic static string AddressBar_Invalid_DialogText_Default=>T(\"AddressBar.Invalid.DialogText.Default\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Web.PageBrowser\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Web_SEOAssistant {\r\n///<summary>&quot;SEO Assistant&quot;</summary> \r\npublic static string SEOAssistant=>T(\"SEOAssistant\");\r\n///<summary>&quot;Search engine optimization&quot;</summary> \r\npublic static string SEOAssistant_ToolTip=>T(\"SEOAssistant.ToolTip\");\r\n///<summary>&quot;Generate a page preview to compute the SEO indication.&quot;</summary> \r\npublic static string IntroText=>T(\"IntroText\");\r\n///<summary>&quot;Result&quot;</summary> \r\npublic static string TabResult=>T(\"TabResult\");\r\n///<summary>&quot;Keywords&quot;</summary> \r\npublic static string TabKeywords=>T(\"TabKeywords\");\r\n///<summary>&quot;Keywords found in page preview:&quot;</summary> \r\npublic static string ResultHeading=>T(\"ResultHeading\");\r\n///<summary>&quot;No keywords configured.&quot;</summary> \r\npublic static string NoKeywordsWarning=>T(\"NoKeywordsWarning\");\r\n///<summary>&quot;In title&quot;</summary> \r\npublic static string isInTitle=>T(\"isInTitle\");\r\n///<summary>&quot;In URL&quot;</summary> \r\npublic static string isInURL=>T(\"isInURL\");\r\n///<summary>&quot;In menu title&quot;</summary> \r\npublic static string isInMenuTitle=>T(\"isInMenuTitle\");\r\n///<summary>&quot;In description&quot;</summary> \r\npublic static string isInDescription=>T(\"isInDescription\");\r\n///<summary>&quot;In heading&quot;</summary> \r\npublic static string isInHeading=>T(\"isInHeading\");\r\n///<summary>&quot;In content&quot;</summary> \r\npublic static string isInContent=>T(\"isInContent\");\r\n///<summary>&quot;No keywords found in page preview&quot;</summary> \r\npublic static string NoKeywords=>T(\"NoKeywords\");\r\n///<summary>&quot;Failed to analyze the keywords because the markup is not valid&quot;</summary> \r\npublic static string IncorrectHtml=>T(\"IncorrectHtml\");\r\n///<summary>&quot;Add SEO word ...&quot;</summary> \r\npublic static string AddKeywordInputPlaceholder=>T(\"AddKeywordInputPlaceholder\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Web.SEOAssistant\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Web_SourceEditor {\r\n///<summary>&quot;Retrieved on SourceEditorBinding startup to make sure strings are loaded :)&quot;</summary> \r\npublic static string Preload_Key=>T(\"Preload.Key\");\r\n///<summary>&quot;Invalid XHTML&quot;</summary> \r\npublic static string Invalid_HTML_DialogTitle=>T(\"Invalid.HTML.DialogTitle\");\r\n///<summary>&quot;The root &lt;html&gt; tag is missing.&quot;</summary> \r\npublic static string Invalid_HTML_MissingHtml=>T(\"Invalid.HTML.MissingHtml\");\r\n///<summary>&quot;The &lt;head&gt; tag is missing.&quot;</summary> \r\npublic static string Invalid_HTML_MissingHead=>T(\"Invalid.HTML.MissingHead\");\r\n///<summary>&quot;The &lt;body&gt; tag is missing.&quot;</summary> \r\npublic static string Invalid_HTML_MissingBody=>T(\"Invalid.HTML.MissingBody\");\r\n///<summary>&quot;The &lt;head&gt; tag must precede &lt;body&gt;.&quot;</summary> \r\npublic static string Invalid_HTML_HeadBodyIndex=>T(\"Invalid.HTML.HeadBodyIndex\");\r\n///<summary>&quot;The root namespace is wrong.&quot;</summary> \r\npublic static string Invalid_HTML_NamespaceURI=>T(\"Invalid.HTML.NamespaceURI\");\r\n///<summary>&quot;Only one &lt;body&gt; tag allowed.&quot;</summary> \r\npublic static string Invalid_HTML_MultipleBody=>T(\"Invalid.HTML.MultipleBody\");\r\n///<summary>&quot;Only one &lt;head&gt; tag allowed.&quot;</summary> \r\npublic static string Invalid_HTML_MultipleHead=>T(\"Invalid.HTML.MultipleHead\");\r\n///<summary>&quot;The root &lt;html&gt; tag can only have &lt;head&gt; and &lt;body&gt; tags as children.&quot;</summary> \r\npublic static string Invalid_HTML_NotAllowedHtmlChild=>T(\"Invalid.HTML.NotAllowedHtmlChild\");\r\n///<summary>&quot;Source format aborted&quot;</summary> \r\npublic static string Format_XML_ErrorDialog_Title=>T(\"Format.XML.ErrorDialog.Title\");\r\n///<summary>&quot;XML source formatting requires a well-formed document structure.&quot;</summary> \r\npublic static string Format_XML_ErrorDialog_Text=>T(\"Format.XML.ErrorDialog.Text\");\r\n///<summary>&quot;Plain Edit&quot;</summary> \r\npublic static string Switch_PlainEdit_Label=>T(\"Switch.PlainEdit.Label\");\r\n///<summary>&quot;No syntax highlight, faster performance&quot;</summary> \r\npublic static string Switch_PlainEdit_ToolTip=>T(\"Switch.PlainEdit.ToolTip\");\r\n///<summary>&quot;Colored Edit&quot;</summary> \r\npublic static string Switch_ColoredEdit_Label=>T(\"Switch.ColoredEdit.Label\");\r\n///<summary>&quot;Syntax highlight, slower performance&quot;</summary> \r\npublic static string Switch_ColoredEdit_ToolTip=>T(\"Switch.ColoredEdit.ToolTip\");\r\n///<summary>&quot;Insert&quot;</summary> \r\npublic static string Toolbar_Insert_Label=>T(\"Toolbar.Insert.Label\");\r\n///<summary>&quot;Format&quot;</summary> \r\npublic static string Toolbar_Format_Label=>T(\"Toolbar.Format.Label\");\r\n///<summary>&quot;Format XML source&quot;</summary> \r\npublic static string Toolbar_Format_ToolTip=>T(\"Toolbar.Format.ToolTip\");\r\n///<summary>&quot;Toggle word wrap&quot;</summary> \r\npublic static string Toolbar_ToggleWordWrap_Label=>T(\"Toolbar.ToggleWordWrap.Label\");\r\n///<summary>&quot;Find and replace&quot;</summary> \r\npublic static string Toolbar_FindAndReplace_Label=>T(\"Toolbar.FindAndReplace.Label\");\r\n///<summary>&quot;Page URL&quot;</summary> \r\npublic static string Insert_PageURL_Label=>T(\"Insert.PageURL.Label\");\r\n///<summary>&quot;Image URL&quot;</summary> \r\npublic static string Insert_ImageURL_Label=>T(\"Insert.ImageURL.Label\");\r\n///<summary>&quot;Media URL&quot;</summary> \r\npublic static string Insert_MediaURL_Label=>T(\"Insert.MediaURL.Label\");\r\n///<summary>&quot;Frontend URL&quot;</summary> \r\npublic static string Insert_FrontendURL_Label=>T(\"Insert.FrontendURL.Label\");\r\n///<summary>&quot;Function Markup&quot;</summary> \r\npublic static string Insert_FunctionMarkup_Label=>T(\"Insert.FunctionMarkup.Label\");\r\n///<summary>&quot;Translate To {0}&quot;</summary> \r\npublic static string ResxEditor_TranslateTo_Label_Template=>T(\"ResxEditor.TranslateTo.Label\");\r\n///<summary>&quot;Translate To {0}&quot;</summary> \r\npublic static string ResxEditor_TranslateTo_Label(object parameter0)=>string.Format(T(\"ResxEditor.TranslateTo.Label\"), parameter0);\r\n///<summary>&quot;Translate To {0}&quot;</summary> \r\npublic static string ResxEditor_TranslateTo_Tooltip_Template=>T(\"ResxEditor.TranslateTo.Tooltip\");\r\n///<summary>&quot;Translate To {0}&quot;</summary> \r\npublic static string ResxEditor_TranslateTo_Tooltip(object parameter0)=>string.Format(T(\"ResxEditor.TranslateTo.Tooltip\"), parameter0);\r\n///<summary>&quot;Label&quot;</summary> \r\npublic static string ResxEditor_Label=>T(\"ResxEditor.Label\");\r\n///<summary>&quot;Original Text&quot;</summary> \r\npublic static string ResxEditor_OriginalText=>T(\"ResxEditor.OriginalText\");\r\n///<summary>&quot;Translated Text&quot;</summary> \r\npublic static string ResxEditor_TranslatedText=>T(\"ResxEditor.TranslatedText\");\r\n///<summary>&quot;Save&quot;</summary> \r\npublic static string ResxEditor_Save=>T(\"ResxEditor.Save\");\r\n///<summary>&quot;Find and replace&quot;</summary> \r\npublic static string FindAndReplace_LabelTitle=>T(\"FindAndReplace.LabelTitle\");\r\n///<summary>&quot;Find&quot;</summary> \r\npublic static string FindAndReplace_LabelFind=>T(\"FindAndReplace.LabelFind\");\r\n///<summary>&quot;Replace with&quot;</summary> \r\npublic static string FindAndReplace_LabelReplaceWith=>T(\"FindAndReplace.LabelReplaceWith\");\r\n///<summary>&quot;Match case&quot;</summary> \r\npublic static string FindAndReplace_LabelMatchCase=>T(\"FindAndReplace.LabelMatchCase\");\r\n///<summary>&quot;Whole words&quot;</summary> \r\npublic static string FindAndReplace_LabelWholeWords=>T(\"FindAndReplace.LabelWholeWords\");\r\n///<summary>&quot;Find Next&quot;</summary> \r\npublic static string FindAndReplace_ButtonFind=>T(\"FindAndReplace.ButtonFind\");\r\n///<summary>&quot;Replace&quot;</summary> \r\npublic static string FindAndReplace_ButtonReplace=>T(\"FindAndReplace.ButtonReplace\");\r\n///<summary>&quot;Replace all&quot;</summary> \r\npublic static string FindAndReplace_ButtonReplaceAll=>T(\"FindAndReplace.ButtonReplaceAll\");\r\n///<summary>&quot;Find and Replace&quot;</summary> \r\npublic static string FindAndReplace_LaunchButton_Label=>T(\"FindAndReplace.LaunchButton.Label\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Web.SourceEditor\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Composite_Web_VisualEditor {\r\n///<summary>&quot;Retrieved on VisualEditorBinding startup to make sure strings are loaded :)&quot;</summary> \r\npublic static string Preload_Key=>T(\"Preload.Key\");\r\n///<summary>&quot;Strong text&quot;</summary> \r\npublic static string ToolBar_ToolTipStrong=>T(\"ToolBar.ToolTipStrong\");\r\n///<summary>&quot;Emphasize text&quot;</summary> \r\npublic static string ToolBar_ToolTipEmphasize=>T(\"ToolBar.ToolTipEmphasize\");\r\n///<summary>&quot;Underline text&quot;</summary> \r\npublic static string ToolBar_ToolTipUnderline=>T(\"ToolBar.ToolTipUnderline\");\r\n///<summary>&quot;Strike text&quot;</summary> \r\npublic static string ToolBar_ToolTipStrike=>T(\"ToolBar.ToolTipStrike\");\r\n///<summary>&quot;Align left&quot;</summary> \r\npublic static string ToolBar_ToolTipAlignLeft=>T(\"ToolBar.ToolTipAlignLeft\");\r\n///<summary>&quot;Align right&quot;</summary> \r\npublic static string ToolBar_ToolTipAlignRight=>T(\"ToolBar.ToolTipAlignRight\");\r\n///<summary>&quot;Justify left&quot;</summary> \r\npublic static string ToolBar_ToolTipJustifyLeft=>T(\"ToolBar.ToolTipJustifyLeft\");\r\n///<summary>&quot;Justify right&quot;</summary> \r\npublic static string ToolBar_ToolTipJustifyRight=>T(\"ToolBar.ToolTipJustifyRight\");\r\n///<summary>&quot;Justify center&quot;</summary> \r\npublic static string ToolBar_ToolTipJustifyCenter=>T(\"ToolBar.ToolTipJustifyCenter\");\r\n///<summary>&quot;Justify full&quot;</summary> \r\npublic static string ToolBar_ToolTipJustifyFull=>T(\"ToolBar.ToolTipJustifyFull\");\r\n///<summary>&quot;Unordered list&quot;</summary> \r\npublic static string ToolBar_ToolTipUnorderedList=>T(\"ToolBar.ToolTipUnorderedList\");\r\n///<summary>&quot;Ordered list&quot;</summary> \r\npublic static string ToolBar_ToolTipOrderedList=>T(\"ToolBar.ToolTipOrderedList\");\r\n///<summary>&quot;Link&quot;</summary> \r\npublic static string ToolBar_ToolTipLink=>T(\"ToolBar.ToolTipLink\");\r\n///<summary>&quot;Delete link&quot;</summary> \r\npublic static string ToolBar_ToolTipDeleteLink=>T(\"ToolBar.ToolTipDeleteLink\");\r\n///<summary>&quot;Cleanup messy code&quot;</summary> \r\npublic static string ToolBar_ToolTipCleanup=>T(\"ToolBar.ToolTipCleanup\");\r\n///<summary>&quot;Undo&quot;</summary> \r\npublic static string ToolBar_ToolTipUndo=>T(\"ToolBar.ToolTipUndo\");\r\n///<summary>&quot;Redo&quot;</summary> \r\npublic static string ToolBar_ToolTipRedo=>T(\"ToolBar.ToolTipRedo\");\r\n///<summary>&quot;Source&quot;</summary> \r\npublic static string ToolBar_LabelSource=>T(\"ToolBar.LabelSource\");\r\n///<summary>&quot;Visual&quot;</summary> \r\npublic static string ToolBar_LabelWysiwyg=>T(\"ToolBar.LabelWysiwyg\");\r\n///<summary>&quot;Paragraph&quot;</summary> \r\npublic static string FormatSelector_LabelParagraph=>T(\"FormatSelector.LabelParagraph\");\r\n///<summary>&quot;Address&quot;</summary> \r\npublic static string FormatSelector_LabelAddress=>T(\"FormatSelector.LabelAddress\");\r\n///<summary>&quot;Blockquote&quot;</summary> \r\npublic static string FormatSelector_LabelBlockQuote=>T(\"FormatSelector.LabelBlockQuote\");\r\n///<summary>&quot;Division&quot;</summary> \r\npublic static string FormatSelector_LabelDivision=>T(\"FormatSelector.LabelDivision\");\r\n///<summary>&quot;Heading 1&quot;</summary> \r\npublic static string FormatSelector_LabelHeading1=>T(\"FormatSelector.LabelHeading1\");\r\n///<summary>&quot;Heading 2&quot;</summary> \r\npublic static string FormatSelector_LabelHeading2=>T(\"FormatSelector.LabelHeading2\");\r\n///<summary>&quot;Heading 3&quot;</summary> \r\npublic static string FormatSelector_LabelHeading3=>T(\"FormatSelector.LabelHeading3\");\r\n///<summary>&quot;Heading 4&quot;</summary> \r\npublic static string FormatSelector_LabelHeading4=>T(\"FormatSelector.LabelHeading4\");\r\n///<summary>&quot;Heading 5&quot;</summary> \r\npublic static string FormatSelector_LabelHeading5=>T(\"FormatSelector.LabelHeading5\");\r\n///<summary>&quot;Heading 6&quot;</summary> \r\npublic static string FormatSelector_LabelHeading6=>T(\"FormatSelector.LabelHeading6\");\r\n///<summary>&quot;(None)&quot;</summary> \r\npublic static string ClassSelector_LabelNone=>T(\"ClassSelector.LabelNone\");\r\n///<summary>&quot;Insert&quot;</summary> \r\npublic static string ContextMenu_LabelInsert=>T(\"ContextMenu.LabelInsert\");\r\n///<summary>&quot;Paste&quot;</summary> \r\npublic static string ContextMenu_LabelPaste=>T(\"ContextMenu.LabelPaste\");\r\n///<summary>&quot;Link&quot;</summary> \r\npublic static string ContextMenu_LabelLink=>T(\"ContextMenu.LabelLink\");\r\n///<summary>&quot;Unlink&quot;</summary> \r\npublic static string ContextMenu_LabelUnLink=>T(\"ContextMenu.LabelUnLink\");\r\n///<summary>&quot;Link Properties&quot;</summary> \r\npublic static string ContextMenu_LabelLinkProperties=>T(\"ContextMenu.LabelLinkProperties\");\r\n///<summary>&quot;Table…&quot;</summary> \r\npublic static string ContextMenu_LabelTable=>T(\"ContextMenu.LabelTable\");\r\n///<summary>&quot;Manage Table&quot;</summary> \r\npublic static string ContextMenu_LabelTableManage=>T(\"ContextMenu.LabelTableManage\");\r\n///<summary>&quot;Image…&quot;</summary> \r\npublic static string ContextMenu_LabelImage=>T(\"ContextMenu.LabelImage\");\r\n///<summary>&quot;As Simple Text…&quot;</summary> \r\npublic static string ContextMenu_LabelAsText=>T(\"ContextMenu.LabelAsText\");\r\n///<summary>&quot;Field&quot;</summary> \r\npublic static string ContextMenu_LabelField=>T(\"ContextMenu.LabelField\");\r\n///<summary>&quot;Delete Field&quot;</summary> \r\npublic static string ContextMenu_LabelFieldDelete=>T(\"ContextMenu.LabelFieldDelete\");\r\n///<summary>&quot;Function…&quot;</summary> \r\npublic static string ContextMenu_LabelRendering=>T(\"ContextMenu.LabelRendering\");\r\n///<summary>&quot;Character…&quot;</summary> \r\npublic static string ContextMenu_LabelCharacter=>T(\"ContextMenu.LabelCharacter\");\r\n///<summary>&quot;Image Properties…&quot;</summary> \r\npublic static string ContextMenu_LabelImageProperties=>T(\"ContextMenu.LabelImageProperties\");\r\n///<summary>&quot;Function Properties…&quot;</summary> \r\npublic static string ContextMenu_LabelRenderingProperties=>T(\"ContextMenu.LabelRenderingProperties\");\r\n///<summary>&quot;Cut Row&quot;</summary> \r\npublic static string ContextMenu_LabelCutRow=>T(\"ContextMenu.LabelCutRow\");\r\n///<summary>&quot;Copy Row&quot;</summary> \r\npublic static string ContextMenu_LabelCopyRow=>T(\"ContextMenu.LabelCopyRow\");\r\n///<summary>&quot;Paste Row&quot;</summary> \r\npublic static string ContextMenu_LabelPasteRow=>T(\"ContextMenu.LabelPasteRow\");\r\n///<summary>&quot;Before&quot;</summary> \r\npublic static string ContextMenu_LabelBefore=>T(\"ContextMenu.LabelBefore\");\r\n///<summary>&quot;After&quot;</summary> \r\npublic static string ContextMenu_LabelAfter=>T(\"ContextMenu.LabelAfter\");\r\n///<summary>&quot;Table Properties&quot;</summary> \r\npublic static string ContextMenu_LabelTableProperties=>T(\"ContextMenu.LabelTableProperties\");\r\n///<summary>&quot;Cell Properties&quot;</summary> \r\npublic static string ContextMenu_LabelCellProperties=>T(\"ContextMenu.LabelCellProperties\");\r\n///<summary>&quot;Row Properties&quot;</summary> \r\npublic static string ContextMenu_LabelRowProperties=>T(\"ContextMenu.LabelRowProperties\");\r\n///<summary>&quot;Insert Row&quot;</summary> \r\npublic static string ContextMenu_LabelInsertRow=>T(\"ContextMenu.LabelInsertRow\");\r\n///<summary>&quot;Delete Row&quot;</summary> \r\npublic static string ContextMenu_LabelDeleteRow=>T(\"ContextMenu.LabelDeleteRow\");\r\n///<summary>&quot;Insert Column&quot;</summary> \r\npublic static string ContextMenu_LabelInsertcolumn=>T(\"ContextMenu.LabelInsertcolumn\");\r\n///<summary>&quot;Delete Column&quot;</summary> \r\npublic static string ContextMenu_LabelDeleteColumn=>T(\"ContextMenu.LabelDeleteColumn\");\r\n///<summary>&quot;Merge Table Cells&quot;</summary> \r\npublic static string ContextMenu_LabelMergeTableCells=>T(\"ContextMenu.LabelMergeTableCells\");\r\n///<summary>&quot;Split Merged Cells&quot;</summary> \r\npublic static string ContextMenu_LabelSplitMergedCells=>T(\"ContextMenu.LabelSplitMergedCells\");\r\n///<summary>&quot;Delete Table&quot;</summary> \r\npublic static string ContextMenu_LabelDeleteTable=>T(\"ContextMenu.LabelDeleteTable\");\r\n///<summary>&quot;Align Image&quot;</summary> \r\npublic static string ContextMenu_LabelAlignImage=>T(\"ContextMenu.LabelAlignImage\");\r\n///<summary>&quot;Right&quot;</summary> \r\npublic static string ContextMenu_LabelAlignImageRight=>T(\"ContextMenu.LabelAlignImageRight\");\r\n///<summary>&quot;Left&quot;</summary> \r\npublic static string ContextMenu_LabelAlignImageLeft=>T(\"ContextMenu.LabelAlignImageLeft\");\r\n///<summary>&quot;None&quot;</summary> \r\npublic static string ContextMenu_LabelAlignImageNone=>T(\"ContextMenu.LabelAlignImageNone\");\r\n///<summary>&quot;Source code error&quot;</summary> \r\npublic static string ContentError_DialogTitle=>T(\"ContentError.DialogTitle\");\r\n///<summary>&quot;Error in source code:&quot;</summary> \r\npublic static string ContentError_DialogText=>T(\"ContentError.DialogText\");\r\n///<summary>&quot;No placeholders in template.&quot;</summary> \r\npublic static string TemplateTree_NoTemplateWarning=>T(\"TemplateTree.NoTemplateWarning\");\r\n///<summary>&quot;Basic&quot;</summary> \r\npublic static string LabelTabBasic=>T(\"LabelTabBasic\");\r\n///<summary>&quot;Advanced&quot;</summary> \r\npublic static string LabelTabAdvanced=>T(\"LabelTabAdvanced\");\r\n///<summary>&quot;Class&quot;</summary> \r\npublic static string LabelClass=>T(\"LabelClass\");\r\n///<summary>&quot;The class attribute specifies a CSS classname for an element.&quot;</summary> \r\npublic static string HelpClass=>T(\"HelpClass\");\r\n///<summary>&quot;ID&quot;</summary> \r\npublic static string LabelId=>T(\"LabelId\");\r\n///<summary>&quot;The id attribute can be used by JavaScript or CSS to make changes to an element.&quot;</summary> \r\npublic static string HelpId=>T(\"HelpId\");\r\n///<summary>&quot;Clipboard disabled&quot;</summary> \r\npublic static string MozSecurityNote_LabelSecurityStuff=>T(\"MozSecurityNote.LabelSecurityStuff\");\r\n///<summary>&quot;For security reasons, access to the clipboard was blocked by your browser. Please use standard keyboard shortcuts. For a technical description of, how to configure your browser for use with {applicationname}, press the &quot;More Info&quot; button.&quot;</summary> \r\npublic static string MozSecurityNote_TextSecurityStuff=>T(\"MozSecurityNote.TextSecurityStuff\");\r\n///<summary>&quot;Insert Link&quot;</summary> \r\npublic static string Link_LabelInsertLink=>T(\"Link.LabelInsertLink\");\r\n///<summary>&quot;Link Properties&quot;</summary> \r\npublic static string Link_LabelLinkProperties=>T(\"Link.LabelLinkProperties\");\r\n///<summary>&quot;URL&quot;</summary> \r\npublic static string Link_LinkDestination=>T(\"Link.LinkDestination\");\r\n///<summary>&quot;Role&quot;</summary> \r\npublic static string Link_LinkRole=>T(\"Link.LinkRole\");\r\n///<summary>&quot;Title&quot;</summary> \r\npublic static string Link_TitleText=>T(\"Link.TitleText\");\r\n///<summary>&quot;Target&quot;</summary> \r\npublic static string Link_LinkTarget=>T(\"Link.LinkTarget\");\r\n///<summary>&quot;Open in new window&quot;</summary> \r\npublic static string Link_LinkTarget_LabelCheckBox=>T(\"Link.LinkTarget.LabelCheckBox\");\r\n///<summary>&quot;The title text is rendered as a tooltip when the mouse hovers over the link. This can be used to let your customers know where the link is going without disturbing the flow of your text.&quot;</summary> \r\npublic static string Link_TitleTextToolTip=>T(\"Link.TitleTextToolTip\");\r\n///<summary>&quot;Link properties&quot;</summary> \r\npublic static string Link_LabelLink=>T(\"Link.LabelLink\");\r\n///<summary>&quot;Cell type&quot;</summary> \r\npublic static string Tables_Cell_CellType=>T(\"Tables.Cell.CellType\");\r\n///<summary>&quot;Cell width&quot;</summary> \r\npublic static string Tables_Cell_LabelWidth=>T(\"Tables.Cell.LabelWidth\");\r\n///<summary>&quot;Horizontal alignment&quot;</summary> \r\npublic static string Tables_Cell_HorizontalAlignment=>T(\"Tables.Cell.HorizontalAlignment\");\r\n///<summary>&quot;Vertical alignment&quot;</summary> \r\npublic static string Tables_Cell_VerticalAlignment=>T(\"Tables.Cell.VerticalAlignment\");\r\n///<summary>&quot;Apply changes to&quot;</summary> \r\npublic static string Tables_Cell_ApplyTo=>T(\"Tables.Cell.ApplyTo\");\r\n///<summary>&quot;Cell Properties&quot;</summary> \r\npublic static string Tables_Cell_LabelCellProperties=>T(\"Tables.Cell.LabelCellProperties\");\r\n///<summary>&quot;Layout&quot;</summary> \r\npublic static string Tables_Cell_LabelLayout=>T(\"Tables.Cell.LabelLayout\");\r\n///<summary>&quot;Data Cell&quot;</summary> \r\npublic static string Tables_Cell_LabelDataCell=>T(\"Tables.Cell.LabelDataCell\");\r\n///<summary>&quot;Header Cell&quot;</summary> \r\npublic static string Tables_Cell_LabelHeaderCell=>T(\"Tables.Cell.LabelHeaderCell\");\r\n///<summary>&quot;Left&quot;</summary> \r\npublic static string Tables_Cell_LabelLeft=>T(\"Tables.Cell.LabelLeft\");\r\n///<summary>&quot;Right&quot;</summary> \r\npublic static string Tables_Cell_LabelRight=>T(\"Tables.Cell.LabelRight\");\r\n///<summary>&quot;Top&quot;</summary> \r\npublic static string Tables_Cell_LabelTop=>T(\"Tables.Cell.LabelTop\");\r\n///<summary>&quot;Center&quot;</summary> \r\npublic static string Tables_Cell_LabelCenter=>T(\"Tables.Cell.LabelCenter\");\r\n///<summary>&quot;Bottom&quot;</summary> \r\npublic static string Tables_Cell_LabelBottom=>T(\"Tables.Cell.LabelBottom\");\r\n///<summary>&quot;Scope&quot;</summary> \r\npublic static string Tables_Cell_LabelScope=>T(\"Tables.Cell.LabelScope\");\r\n///<summary>&quot;Current cell&quot;</summary> \r\npublic static string Tables_Cell_LabelCurrentCell=>T(\"Tables.Cell.LabelCurrentCell\");\r\n///<summary>&quot;All cells in row&quot;</summary> \r\npublic static string Tables_Cell_LabelAllRowCells=>T(\"Tables.Cell.LabelAllRowCells\");\r\n///<summary>&quot;All cells in table&quot;</summary> \r\npublic static string Tables_Cell_LabelAllTableCells=>T(\"Tables.Cell.LabelAllTableCells\");\r\n///<summary>&quot;Columns&quot;</summary> \r\npublic static string Tables_Merge_Columns=>T(\"Tables.Merge.Columns\");\r\n///<summary>&quot;Rows&quot;</summary> \r\npublic static string Tables_Merge_Rows=>T(\"Tables.Merge.Rows\");\r\n///<summary>&quot;Merge Table Cells&quot;</summary> \r\npublic static string Tables_Merge_LabelMergeCells=>T(\"Tables.Merge.LabelMergeCells\");\r\n///<summary>&quot;Row in table part&quot;</summary> \r\npublic static string Tables_Row_Rows=>T(\"Tables.Row.Rows\");\r\n///<summary>&quot;Horizontal Alignment&quot;</summary> \r\npublic static string Tables_Row_HorizontalAlignment=>T(\"Tables.Row.HorizontalAlignment\");\r\n///<summary>&quot;Vertical Alignment&quot;</summary> \r\npublic static string Tables_Row_VerticalAlignment=>T(\"Tables.Row.VerticalAlignment\");\r\n///<summary>&quot;Apply changes to&quot;</summary> \r\npublic static string Tables_Row_ApplyTo=>T(\"Tables.Row.ApplyTo\");\r\n///<summary>&quot;Row Properties&quot;</summary> \r\npublic static string Tables_Row_LabelRowProperties=>T(\"Tables.Row.LabelRowProperties\");\r\n///<summary>&quot;Layout&quot;</summary> \r\npublic static string Tables_Row_LabelLayout=>T(\"Tables.Row.LabelLayout\");\r\n///<summary>&quot;Table Head&quot;</summary> \r\npublic static string Tables_Row_LabelTableHead=>T(\"Tables.Row.LabelTableHead\");\r\n///<summary>&quot;Table Body&quot;</summary> \r\npublic static string Tables_Row_LabelTableBody=>T(\"Tables.Row.LabelTableBody\");\r\n///<summary>&quot;Table Foot&quot;</summary> \r\npublic static string Tables_Row_LabelTableFoot=>T(\"Tables.Row.LabelTableFoot\");\r\n///<summary>&quot;Left&quot;</summary> \r\npublic static string Tables_Row_LabelLeft=>T(\"Tables.Row.LabelLeft\");\r\n///<summary>&quot;Center&quot;</summary> \r\npublic static string Tables_Row_LabelCenter=>T(\"Tables.Row.LabelCenter\");\r\n///<summary>&quot;Right&quot;</summary> \r\npublic static string Tables_Row_LabelRight=>T(\"Tables.Row.LabelRight\");\r\n///<summary>&quot;Top&quot;</summary> \r\npublic static string Tables_Row_LabelTop=>T(\"Tables.Row.LabelTop\");\r\n///<summary>&quot;Bottom&quot;</summary> \r\npublic static string Tables_Row_LabelBottom=>T(\"Tables.Row.LabelBottom\");\r\n///<summary>&quot;Scope&quot;</summary> \r\npublic static string Tables_Row_LabelScope=>T(\"Tables.Row.LabelScope\");\r\n///<summary>&quot;Current row&quot;</summary> \r\npublic static string Tables_Row_LabelCurrentRow=>T(\"Tables.Row.LabelCurrentRow\");\r\n///<summary>&quot;Odd rows in table&quot;</summary> \r\npublic static string Tables_Row_LabelOddRows=>T(\"Tables.Row.LabelOddRows\");\r\n///<summary>&quot;Even rows in table&quot;</summary> \r\npublic static string Tables_Row_LabelEvenRows=>T(\"Tables.Row.LabelEvenRows\");\r\n///<summary>&quot;All rows in table&quot;</summary> \r\npublic static string Tables_Row_LabelAllRows=>T(\"Tables.Row.LabelAllRows\");\r\n///<summary>&quot;Insert Table&quot;</summary> \r\npublic static string Tables_Table_TitleInsert=>T(\"Tables.Table.TitleInsert\");\r\n///<summary>&quot;Table Properties&quot;</summary> \r\npublic static string Tables_Table_TitleUpdate=>T(\"Tables.Table.TitleUpdate\");\r\n///<summary>&quot;Columns&quot;</summary> \r\npublic static string Tables_Table_Columns=>T(\"Tables.Table.Columns\");\r\n///<summary>&quot;Rows&quot;</summary> \r\npublic static string Tables_Table_Rows=>T(\"Tables.Table.Rows\");\r\n///<summary>&quot;Summary&quot;</summary> \r\npublic static string Tables_Table_Summary=>T(\"Tables.Table.Summary\");\r\n///<summary>&quot;The summary explains the table content and structure so that people using non-visual browsers (such as blind people) may better understand it. This is especially important for tables without captions.&quot;</summary> \r\npublic static string Tables_Table_SummaryHelp=>T(\"Tables.Table.SummaryHelp\");\r\n///<summary>&quot;Table layout&quot;</summary> \r\npublic static string Tables_Table_LabelLayout=>T(\"Tables.Table.LabelLayout\");\r\n///<summary>&quot;Table description&quot;</summary> \r\npublic static string Tables_Table_LabelMeta=>T(\"Tables.Table.LabelMeta\");\r\n///<summary>&quot;Source&quot;</summary> \r\npublic static string Image_Source=>T(\"Image.Source\");\r\n///<summary>&quot;Alternate text&quot;</summary> \r\npublic static string Image_AlternativeText=>T(\"Image.AlternativeText\");\r\n///<summary>&quot;The alternate text is displayed as visible text in browsers where images cannot be rendered normally. This may be the case for mobile phone browsers and special browsers for the visually impaired. The alt attribute should clearly describe the content of the image.&quot;</summary> \r\npublic static string Image_AlternativeTextToolTip=>T(\"Image.AlternativeTextToolTip\");\r\n///<summary>&quot;Title text&quot;</summary> \r\npublic static string Image_TitleText=>T(\"Image.TitleText\");\r\n///<summary>&quot;The title text is rendered as a tooltip when the mouse hovers over the image. An image that might be confusing for the viewer can be instantly clarified by a title.&quot;</summary> \r\npublic static string Image_TitleTextToolTip=>T(\"Image.TitleTextToolTip\");\r\n///<summary>&quot;Image properties&quot;</summary> \r\npublic static string Image_LabelImage=>T(\"Image.LabelImage\");\r\n///<summary>&quot;Insert Image&quot;</summary> \r\npublic static string Image_LabelInsertImage=>T(\"Image.LabelInsertImage\");\r\n///<summary>&quot;Image Properties&quot;</summary> \r\npublic static string Image_LabelImageProperties=>T(\"Image.LabelImageProperties\");\r\n///<summary>&quot;Maximum Width&quot;</summary> \r\npublic static string Image_MaxWidth=>T(\"Image.MaxWidth\");\r\n///<summary>&quot;If the width of the image is bigger that the specified value, it will be downsized to the specified value.&quot;</summary> \r\npublic static string Image_MaxWidthToolTip=>T(\"Image.MaxWidthToolTip\");\r\n///<summary>&quot;Maximum Height&quot;</summary> \r\npublic static string Image_MaxHeight=>T(\"Image.MaxHeight\");\r\n///<summary>&quot;If the height of the image is bigger that the specified value, it will be downsized to the specified value.&quot;</summary> \r\npublic static string Image_MaxHeightToolTip=>T(\"Image.MaxHeightToolTip\");\r\n///<summary>&quot;Select Character&quot;</summary> \r\npublic static string CharMap_LabelSelectSpecialChar=>T(\"CharMap.LabelSelectSpecialChar\");\r\n///<summary>&quot;General&quot;</summary> \r\npublic static string CharMap_LabelGeneral=>T(\"CharMap.LabelGeneral\");\r\n///<summary>&quot;Alphabetical&quot;</summary> \r\npublic static string CharMap_LabelAlphabetical=>T(\"CharMap.LabelAlphabetical\");\r\n///<summary>&quot;Math &amp; Symbols&quot;</summary> \r\npublic static string CharMap_LabelMathSymbols=>T(\"CharMap.LabelMathSymbols\");\r\n///<summary>&quot;Common&quot;</summary> \r\npublic static string CharMap_LabelCommon=>T(\"CharMap.LabelCommon\");\r\n///<summary>&quot;Quotation&quot;</summary> \r\npublic static string CharMap_LabelQuotation=>T(\"CharMap.LabelQuotation\");\r\n///<summary>&quot;Currency&quot;</summary> \r\npublic static string CharMap_LabelCurrency=>T(\"CharMap.LabelCurrency\");\r\n///<summary>&quot;Latin&quot;</summary> \r\npublic static string CharMap_LabelLatin=>T(\"CharMap.LabelLatin\");\r\n///<summary>&quot;Greek&quot;</summary> \r\npublic static string CharMap_LabelGreek=>T(\"CharMap.LabelGreek\");\r\n///<summary>&quot;Math and Logic&quot;</summary> \r\npublic static string CharMap_LabelMathAndLogic=>T(\"CharMap.LabelMathAndLogic\");\r\n///<summary>&quot;Symbols&quot;</summary> \r\npublic static string CharMap_LabelSymbols=>T(\"CharMap.LabelSymbols\");\r\n///<summary>&quot;Arrows&quot;</summary> \r\npublic static string CharMap_LabelArrows=>T(\"CharMap.LabelArrows\");\r\n///<summary>&quot;Paste as Text&quot;</summary> \r\npublic static string TextPaste_Label=>T(\"TextPaste.Label\");\r\n///<summary>&quot;Paste content here. Then press OK.&quot;</summary> \r\npublic static string TextPaste_PasteHereContent=>T(\"TextPaste.PasteHereContent\");\r\n///<summary>&quot;How to spell check ...&quot;</summary> \r\npublic static string SpellCheck_InfoLabel=>T(\"SpellCheck.InfoLabel\");\r\n///<summary>&quot;How to spell check in the Visual Editor&quot;</summary> \r\npublic static string SpellCheck_InfoCaption=>T(\"SpellCheck.InfoCaption\");\r\n///<summary>&quot;To get suggestions for a misspelled word, press your SHIFT key down when you invoke the context menu.&quot;</summary> \r\npublic static string SpellCheck_InfoText=>T(\"SpellCheck.InfoText\");\r\n///<summary>&quot;Find and Replace&quot;</summary> \r\npublic static string SearchAndReplace_LaunchButton_Label=>T(\"SearchAndReplace.LaunchButton.Label\");\r\n///<summary>&quot;Find and replace&quot;</summary> \r\npublic static string SearchAndReplace_LabelTitle=>T(\"SearchAndReplace.LabelTitle\");\r\n///<summary>&quot;Find&quot;</summary> \r\npublic static string SearchAndReplace_LabelFind=>T(\"SearchAndReplace.LabelFind\");\r\n///<summary>&quot;Replace with&quot;</summary> \r\npublic static string SearchAndReplace_LabelReplaceWith=>T(\"SearchAndReplace.LabelReplaceWith\");\r\n///<summary>&quot;Match case&quot;</summary> \r\npublic static string SearchAndReplace_LabelMatchCase=>T(\"SearchAndReplace.LabelMatchCase\");\r\n///<summary>&quot;Whole words&quot;</summary> \r\npublic static string SearchAndReplace_LabelWholeWords=>T(\"SearchAndReplace.LabelWholeWords\");\r\n///<summary>&quot;Find Next&quot;</summary> \r\npublic static string SearchAndReplace_ButtonFind=>T(\"SearchAndReplace.ButtonFind\");\r\n///<summary>&quot;Replace&quot;</summary> \r\npublic static string SearchAndReplace_ButtonReplace=>T(\"SearchAndReplace.ButtonReplace\");\r\n///<summary>&quot;Replace all&quot;</summary> \r\npublic static string SearchAndReplace_ButtonReplaceAll=>T(\"SearchAndReplace.ButtonReplaceAll\");\r\n///<summary>&quot;nothing was found&quot;</summary> \r\npublic static string SearchAndReplace_NothingFoundMessage=>T(\"SearchAndReplace.NothingFoundMessage\");\r\n///<summary>&quot;item(s) found&quot;</summary> \r\npublic static string SearchAndReplace_ItemsWereFoundMessage=>T(\"SearchAndReplace.ItemsWereFoundMessage\");\r\n///<summary>&quot;Edit&quot;</summary> \r\npublic static string Function_Edit=>T(\"Function.Edit\");\r\n///<summary>&quot;Edit {0}&quot;</summary> \r\npublic static string LaunchButton_Label_Template=>T(\"LaunchButton.Label\");\r\n///<summary>&quot;Edit {0}&quot;</summary> \r\npublic static string LaunchButton_Label(object parameter0)=>string.Format(T(\"LaunchButton.Label\"), parameter0);\r\n///<summary>&quot;Components&quot;</summary> \r\npublic static string Components_LaunchButton_Label=>T(\"Components.LaunchButton.Label\");\r\n///<summary>&quot;Component...&quot;</summary> \r\npublic static string ContextMenu_LabelComponent=>T(\"ContextMenu.LabelComponent\");\r\n///<summary>&quot;Select a component&quot;</summary> \r\npublic static string Components_Window_Headline=>T(\"Components.Window.Headline\");\r\n///<summary>&quot;No selectable components&quot;</summary> \r\npublic static string Components_Window_NoItems=>T(\"Components.Window.NoItems\");\r\n///<summary>&quot;Filter...&quot;</summary> \r\npublic static string Components_Window_DialogFilterPlaceholder=>T(\"Components.Window.DialogFilterPlaceholder\");\r\n///<summary>&quot;OK&quot;</summary> \r\npublic static string Components_Window_Ok=>T(\"Components.Window.Ok\");\r\n///<summary>&quot;Cancel&quot;</summary> \r\npublic static string Components_Window_Cancel=>T(\"Components.Window.Cancel\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Composite.Web.VisualEditor\", key);\r\n} \r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class Orckestra_Tools_UrlConfiguration {\r\n///<summary>&quot;URL Configuration&quot;</summary> \r\npublic static string Tree_ConfigurationElementLabel=>T(\"Tree.ConfigurationElementLabel\");\r\n///<summary>&quot;This section allows configuring shorter and friendlier urls&quot;</summary> \r\npublic static string Tree_ConfigurationElementToolTip=>T(\"Tree.ConfigurationElementToolTip\");\r\n///<summary>&quot;Edit URL Configuration&quot;</summary> \r\npublic static string Tree_ConfigurationElementEditLabel=>T(\"Tree.ConfigurationElementEditLabel\");\r\n///<summary>&quot;Edit URL Configuration&quot;</summary> \r\npublic static string Tree_ConfigurationElementEditToolTip=>T(\"Tree.ConfigurationElementEditToolTip\");\r\n///<summary>&quot;Hostnames&quot;</summary> \r\npublic static string Tree_HostnamesFolderLabel=>T(\"Tree.HostnamesFolderLabel\");\r\n///<summary>&quot;Here you can map a hostname to a site&quot;</summary> \r\npublic static string Tree_HostnamesFolderToolTip=>T(\"Tree.HostnamesFolderToolTip\");\r\n///<summary>&quot;Add Hostname&quot;</summary> \r\npublic static string Tree_AddHostnameLabel=>T(\"Tree.AddHostnameLabel\");\r\n///<summary>&quot;Add a new hostname mapping&quot;</summary> \r\npublic static string Tree_AddHostnameToolTip=>T(\"Tree.AddHostnameToolTip\");\r\n///<summary>&quot;Edit Hostname&quot;</summary> \r\npublic static string Tree_EditHostnameLabel=>T(\"Tree.EditHostnameLabel\");\r\n///<summary>&quot;Edit this hostname mapping&quot;</summary> \r\npublic static string Tree_EditHostnameToolTip=>T(\"Tree.EditHostnameToolTip\");\r\n///<summary>&quot;Delete Hostname&quot;</summary> \r\npublic static string Tree_DeleteHostnameLabel=>T(\"Tree.DeleteHostnameLabel\");\r\n///<summary>&quot;Delete this hostname mapping&quot;</summary> \r\npublic static string Tree_DeleteHostnameToolTip=>T(\"Tree.DeleteHostnameToolTip\");\r\n///<summary>&quot;UrlConfiguration&quot;</summary> \r\npublic static string Tree_UrlConfigurationLabel=>T(\"Tree.UrlConfigurationLabel\");\r\n///<summary>&quot;URL Configuration&quot;</summary> \r\npublic static string UrlConfiguration_Title=>T(\"UrlConfiguration.Title\");\r\n///<summary>&quot;Page URL Suffix&quot;</summary> \r\npublic static string UrlConfiguration_PageUrlSuffix_Label=>T(\"UrlConfiguration.PageUrlSuffix.Label\");\r\n///<summary>&quot;A string that will be appended to all page urls. F.e. &apos;.aspx&apos; or &apos;.html&apos;, leaving this field empty will produce extensionless urls&quot;</summary> \r\npublic static string UrlConfiguration_PageUrlSuffix_Help=>T(\"UrlConfiguration.PageUrlSuffix.Help\");\r\n///<summary>&quot;New Hostname&quot;</summary> \r\npublic static string HostnameBinding_AddNewHostnameTitle=>T(\"HostnameBinding.AddNewHostnameTitle\");\r\n///<summary>&quot;Hostname&quot;</summary> \r\npublic static string HostnameBinding_Hostname_Label=>T(\"HostnameBinding.Hostname.Label\");\r\n///<summary>&quot;Hostname to which current url building rules will be applied&quot;</summary> \r\npublic static string HostnameBinding_Hostname_Help=>T(\"HostnameBinding.Hostname.Help\");\r\n///<summary>&quot;Page&quot;</summary> \r\npublic static string HostnameBinding_Page_Label=>T(\"HostnameBinding.Page.Label\");\r\n///<summary>&quot;Root page that will be the default page for the current hostname&quot;</summary> \r\npublic static string HostnameBinding_Page_Help=>T(\"HostnameBinding.Page.Help\");\r\n///<summary>&quot;URL&quot;</summary> \r\npublic static string HostnameBinding_IncludeHomepageUrlTitle_Label=>T(\"HostnameBinding.IncludeHomepageUrlTitle.Label\");\r\n///<summary>&quot;Include homepage URL Title&quot;</summary> \r\npublic static string HostnameBinding_IncludeHomepageUrlTitle_ItemLabel=>T(\"HostnameBinding.IncludeHomepageUrlTitle.ItemLabel\");\r\n///<summary>&quot;Determines whether root page&apos;s title should be a part of url. Not having it checked produces shorter urls&quot;</summary> \r\npublic static string HostnameBinding_IncludeHomepageUrlTitle_Help=>T(\"HostnameBinding.IncludeHomepageUrlTitle.Help\");\r\n///<summary>&quot;Include language URL mapping&quot;</summary> \r\npublic static string HostnameBinding_IncludeLanguageUrlMapping_ItemLabel=>T(\"HostnameBinding.IncludeLanguageUrlMapping.ItemLabel\");\r\n///<summary>&quot;Determines whether language code should be a part of a url&quot;</summary> \r\npublic static string HostnameBinding_IncludeLanguageUrlMapping_Help=>T(\"HostnameBinding.IncludeLanguageUrlMapping.Help\");\r\n///<summary>&quot;Enforce HTTPS&quot;</summary> \r\npublic static string HostnameBinding_EnforceHttps_ItemLabel=>T(\"HostnameBinding.EnforceHttps.ItemLabel\");\r\n///<summary>&quot;When checked, all the HTTP requests will be redirected to HTTPS links&quot;</summary> \r\npublic static string HostnameBinding_EnforceHttps_Help=>T(\"HostnameBinding.EnforceHttps.Help\");\r\n///<summary>&quot;Custom 404 Page&quot;</summary> \r\npublic static string HostnameBinding_Custom404Page_Label=>T(\"HostnameBinding.Custom404Page.Label\");\r\n///<summary>&quot;Url to which request will be redirected in the case there&apos;s a request to non-existent c1 page&quot;</summary> \r\npublic static string HostnameBinding_Custom404Page_Help=>T(\"HostnameBinding.Custom404Page.Help\");\r\n///<summary>&quot;Alias hostnames&quot;</summary> \r\npublic static string HostnameBinding_Aliases_Label=>T(\"HostnameBinding.Aliases.Label\");\r\n///<summary>&quot;Hostnames from which all requests will be redirected to the current hostname&quot;</summary> \r\npublic static string HostnameBinding_Aliases_Help=>T(\"HostnameBinding.Aliases.Help\");\r\n///<summary>&quot;Alias Redirect&quot;</summary> \r\npublic static string HostnameBinding_UsePermanentRedirect_Label=>T(\"HostnameBinding.UsePermanentRedirect.Label\");\r\n///<summary>&quot;Use permanent redirect (HTTP 301)&quot;</summary> \r\npublic static string HostnameBinding_UsePermanentRedirect_ItemLabel=>T(\"HostnameBinding.UsePermanentRedirect.ItemLabel\");\r\n///<summary>&quot;When redirecting from an alias to the common hostname, a permanent redirect will tell visitors (browsers and search engines) that this redirect should be considered permanent and may be cached. Checking this box has a positive effect on SEO, provided the alias rule do not change in the near future&quot;</summary> \r\npublic static string HostnameBinding_UsePermanentRedirect_Help=>T(\"HostnameBinding.UsePermanentRedirect.Help\");\r\nprivate static string T(string key) => StringResourceSystemFacade.GetString(\"Orckestra.Tools.UrlConfiguration\", key);\r\n} \r\n\r\n\t}\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/LocalizationFiles.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"true\" language=\"C#\" #>\r\n<#@ output extension=\".cs\" #>\r\n\r\n<#@ assembly name=\"System.Configuration\" #> \r\n<#@ assembly name=\"System.Core\" #> \r\n<#@ assembly name=\"System.Xml\" #> \r\n<#@ assembly name=\"System.Xml.Linq\" #> \r\n\r\n<#@ import namespace=\"System.IO\" #> \r\n<#@ import namespace=\"System.Globalization\" #> \r\n<#@ import namespace=\"System.Configuration\" #> \r\n<#@ import namespace=\"System.Linq\" #> \r\n<#@ import namespace=\"System.Text\" #> \r\n<#@ import namespace=\"System.Xml.Linq\" #> \r\n\r\n<# var pathToCurrentFolder = Host.ResolvePath(@\"\"); \r\n   var pathToSolutionFolder = pathToCurrentFolder.Substring(0, pathToCurrentFolder.Length - @\"Composite\\Core\\ResourceSystem\".Length);\r\n   var pathToLocalizationFiles = pathToSolutionFolder + @\"WebSite\\Composite\\localization\";\r\n#>\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.Core.ResourceSystem\r\n{\r\n\t/// <summary>    \r\n\t/// Class generated from localization files  \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class LocalizationFiles\r\n\t{\r\n\t\t<#= GenerateCode(pathToLocalizationFiles) #>\r\n\t}\r\n}\r\n\r\n\r\n<#+\r\n\r\n    public static string GenerateCode(string folder) {  \r\n\r\n\tvar propertyDefinitions = new StringBuilder();\r\n\tvar classDefinitions = new StringBuilder();\r\n\r\n\tstring[] files = Directory.GetFiles(folder,  @\"*.en-us.xml\");\r\n\r\n\tforeach(string filePath in files) {\r\n\t    string friendlyFileName = filePath.Substring(folder.Length + 1, filePath.Length - folder.Length - \".en-us.xml\".Length - 1);\r\n\t\tstring fileIdentifier = friendlyFileName.Replace(\".\", \"_\");\r\n\r\n\r\n\t\tstring className = fileIdentifier;\r\n\r\n\t\tif(className == \"MimeTypes\") continue;\r\n\r\n/*\r\n\t\tpropertyDefinitions.Append(@\" \r\n    /// <exclude />\r\n  public static %classname% %propertyname% { get { return new %classname%(); } }\"\r\n\t\t\t\t\t\t  .Replace(\"%classname%\", className)\r\n\t\t\t\t\t\t  .Replace(\"%propertyname%\", fileIdentifier));\r\n\r\n*/\r\n\r\n\t   classDefinitions.Append(@\"\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\t   public static class %classname% {\r\n\"\r\n\t                           .Replace(\"%classname%\", className));\r\n\r\n       GenerateLocalizationProperties(filePath, friendlyFileName, classDefinitions, className.Contains(\"Search\"));\r\n\r\n\t   classDefinitions.Append(\"} \\r\\n\");\r\n\t}\r\n\r\n\t\r\n\r\n    return propertyDefinitions.ToString() + classDefinitions.ToString();\r\n}\r\n\r\n        private static void GenerateLocalizationProperties(string filePath, string friendlyFileName, StringBuilder output, bool generateConstants)\r\n        {\r\n            XDocument xdoc = XDocument.Load(filePath);\r\n\r\n\t\t\tvar constants = new StringBuilder();\r\n\r\n            foreach(var element in xdoc.Root.Elements())\r\n            {\r\n                var keyAttr = element.Attribute(\"key\");\r\n                if(keyAttr == null)\r\n                {\r\n                    throw new InvalidOperationException(\"Missing 'key' attribute. File: \" + filePath);\r\n                }\r\n\r\n\t\t\t\tvar valueAttr = element.Attribute(\"value\");\r\n                if(valueAttr == null)\r\n                {\r\n                    throw new InvalidOperationException(\"Missing 'value' attribute. File: \" + filePath);\r\n                }\r\n\r\n                string key = keyAttr.Value;\r\n\t\t\t\tstring value = valueAttr.Value;\r\n\r\n                string propertyName = key.Replace(\".\", \"_\").Replace(\"-\", \"_\").Replace(\" \", \"_\").Replace(\"(\", \"\").Replace(\")\", \"\").Replace(\"+\", \"\");\r\n\t\t\t\tif (char.IsDigit(propertyName[0])) propertyName = \"_\" + propertyName;\r\n\r\n\t\t\t\tint parametersCount = 0;\r\n\r\n\t\t\t\twhile(value.Contains(\"{\" + parametersCount + \"}\")) {\r\n\t\t\t\t\tparametersCount++;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar xmlComment = \"///<summary>&quot;%comment%&quot;</summary> \\r\\n\"\r\n\t\t\t\t\t\t\t   .Replace(\"%comment%\", XmlEncode(value).Replace(\"\\r\\n\", \"\\r\\n ///\"));\r\n\r\n\t\t\t\toutput.Append(xmlComment);\r\n\r\n\t\t\t\toutput.Append(\"public static string %property%=>T(\\\"%key%\\\");\\r\\n\"\r\n\t\t\t\t\t\t\t\t.Replace(\"%comment%\", XmlEncode(value).Replace(\"\\r\\n\", \"\\r\\n ///\"))\r\n\t\t\t\t\t\t\t\t.Replace(\"%key%\", key)\r\n\t\t\t\t\t\t\t\t.Replace(\"%property%\", propertyName + (parametersCount > 0 ? \"_Template\" : \"\") ));\r\n\r\n\t\t\t\tif(parametersCount > 0) \r\n\t\t\t\t{\r\n\t\t\t\t\tstring[] parametersDefinitions = new string[parametersCount];\r\n\t\t\t\t\tstring[] parametersReferences = new string[parametersCount];\r\n\r\n\t\t\t\t\tfor(int i=0; i<parametersCount; i++) {\r\n\t\t\t\t\t\tparametersDefinitions[i] = \"object parameter\" + i;\r\n\t\t\t\t\t\tparametersReferences[i] = \"parameter\" + i;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tstring parametersDefinitionsStr = string.Join(\",\", parametersDefinitions);\r\n\t\t\t\t\tstring parametersReferencesStr = string.Join(\",\", parametersReferences);\r\n\r\n\t\t\t\t\toutput.Append(xmlComment);\r\n\t\t\t\t\toutput.Append(\"public static string %property%(%parametersDef%)=>string.Format(T(\\\"%key%\\\"), %parametersRef%);\\r\\n\"\r\n\t\t\t\t\t\t\t\t   .Replace(\"%key%\", key)\r\n\t\t\t\t\t\t\t\t   .Replace(\"%property%\", propertyName)\r\n\t\t\t\t\t\t\t\t   .Replace(\"%parametersDef%\", parametersDefinitionsStr)\r\n\t\t\t\t\t\t\t\t   .Replace(\"%parametersRef%\", parametersReferencesStr));\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconstants.AppendLine(\"///<summary>&quot;%comment%&quot;</summary>\\r\\npublic const string %property%=\\\"${%fileName%,%key%}\\\";\"\r\n\t\t\t\t\t\t\t\t\t.Replace(\"%comment%\", XmlEncode(value).Replace(\"\\r\\n\", \"\\r\\n ///\"))\r\n\t\t\t\t\t\t\t\t\t.Replace(\"%property%\", propertyName)\r\n\t\t\t\t\t\t\t\t\t.Replace(\"%fileName%\", friendlyFileName)\r\n\t\t\t\t\t\t\t\t\t.Replace(\"%key%\", key));\r\n            }\r\n\t\t\t\r\n            output.Append(\r\n@\"private static string T(string key) => StringResourceSystemFacade.GetString(\"\"\" + friendlyFileName + @\"\"\", key);\r\n\");\r\n\t\t\tif(generateConstants) {\r\n\t\t\t\toutput.Append(\r\n@\"/// <exclude />\r\npublic static class Untranslated {\r\n\" + constants + @\"\r\n}\");\r\n\r\n\t\t\t}\r\n        }\r\n\r\n\tprivate static string XmlEncode(string text)\r\n    {\r\n        return text.Replace(\"&\", \"&amp;\").Replace(\"<\", \"&lt;\").Replace(\">\", \"&gt;\").Replace(\"\\\"\", \"&quot;\").Replace(\"'\", \"&apos;\");\r\n    }\r\n#>\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/ILocalizationProvider.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider\r\n{\r\n\tinternal interface ILocalizationProvider : IResourceProvider\r\n\t{\r\n\t    IEnumerable<string> GetSections();\r\n\r\n        string GetString(string section, string stringId, CultureInfo cultureInfo);\r\n\r\n        /// <summary>\r\n        /// A dictionary of stringId -> stringValue\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        ReadOnlyDictionary<string, string> GetAllStrings(string section, CultureInfo cultureInfo);\r\n\r\n        IEnumerable<CultureInfo> GetSupportedCultures();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/IResourceProvider.cs",
    "content": "using Composite.Core.ResourceSystem.Plugins.ResourceProvider.Runtime;\r\n\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider\r\n{\r\n    [CustomFactory(typeof(ResourceProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(ResourceProviderDefaultNameRetriever))]\r\n\tinternal interface IResourceProvider\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/IStringResourceProvider.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider\r\n{\r\n\tinternal interface IStringResourceProvider : IResourceProvider\r\n\t{\r\n        string GetStringValue(string stringId, CultureInfo cultureInfo);\r\n\r\n        /// <summary>\r\n        /// A dictionary of stringId -> stringValue\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        IDictionary<string, string> GetAllStrings(CultureInfo cultureInfo);\r\n\r\n        IEnumerable<CultureInfo> GetSupportedCultures();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/NonConfigurableResourceProvider.cs",
    "content": "using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableResourceProviderAssembler))]\r\n    internal class NonConfigurableResourceProvider : ResourceProviderData\r\n    {\r\n    }\r\n\r\n\r\n    internal sealed class NonConfigurableResourceProviderAssembler : IAssembler<IResourceProvider, ResourceProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IResourceProvider Assemble(IBuilderContext context, ResourceProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IResourceProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/ResourceProviderData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableResourceProviderAssembler))]\r\n    [ConfigurationElementType(typeof(NonConfigurableResourceProvider))]\r\n    internal class ResourceProviderData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/Runtime/ResourceProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider.Runtime\r\n{\r\n    internal sealed class ResourceProviderCustomFactory : AssemblerBasedCustomFactory<IResourceProvider, ResourceProviderData>\r\n\t{\r\n        protected override ResourceProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ResourceProviderSettings settings = configurationSource.GetSection(ResourceProviderSettings.SectionName) as ResourceProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ResourceProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.ResourceProviderPlugins.Get(name);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/Runtime/ResourceProviderDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider.Runtime\r\n{\r\n    internal sealed class ResourceProviderDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/Runtime/ResourceProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider.Runtime\r\n{\r\n    internal sealed class ResourceProviderFactory : NameTypeFactoryBase<IResourceProvider>\r\n\t{\r\n        public ResourceProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/Plugins/ResourceProvider/Runtime/ResourceProviderSettings.cs",
    "content": "using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem.Plugins.ResourceProvider.Runtime\r\n{\r\n    internal sealed class ResourceProviderSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.Core.ResourceSystem.Plugins.ResourceProviderConfiguration\";\r\n\r\n\r\n        private const string _resourceProviderPluginsProperty = \"ResourceProviderPlugins\";\r\n        [ConfigurationProperty(_resourceProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<ResourceProviderData> ResourceProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<ResourceProviderData>)base[_resourceProviderPluginsProperty];\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/ResourceHandle.cs",
    "content": "using System;\r\nusing Composite.Core.ResourceSystem.Icons;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class ResourceHandle\r\n    {\r\n        /// <exclude />\r\n        public static ResourceHandle Build(string resourceNamespace, string resourceName)\r\n        {\r\n            return new ResourceHandle(resourceNamespace, resourceName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle BuildIconFromDefaultProvider(string resourceName)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, resourceName);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// DO NOT USE! For serializing only!\r\n        /// </summary>        \r\n        public ResourceHandle() { }\r\n\r\n\r\n        /// <exclude />\r\n        public ResourceHandle(string resourceNamespace, string resourceName)\r\n        {\r\n            this.ResourceName = resourceName;\r\n            this.ResourceNamespace = resourceNamespace;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ResourceNamespace { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string ResourceName{ get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ResourceSystem/StringResourceSystemFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Threading;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.Caching;\r\nusing Composite.Core.ResourceSystem.Foundation.PluginFacades;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.ResourceSystem\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class StringResourceSystemFacade\r\n    {\r\n        private static readonly string LogTitle = typeof (StringResourceSystemFacade).Name;\r\n        private static Regex _regex = new Regex(@\"\\$\\{(?<id>.+?)\\}\", RegexOptions.Compiled);\r\n\r\n        private static readonly int ResourceCacheSize = 5000;\r\n        private static readonly Cache<string, ExtendedNullable<string>> _resourceCache = new Cache<string, ExtendedNullable<string>>(\"Resource strings\", ResourceCacheSize);\r\n\r\n        private static readonly string Error_SectionNotDefined =  \"*** SECTION NOT FOUND ***\";\r\n        private static readonly string Error_StringNotDefined = \"*** STRING NOT FOUND ***\";\r\n\r\n        /// <exclude />\r\n        public static void Initialize()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetString(string providerName, string stringName)\r\n        {\r\n            return GetString(providerName, stringName, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetString(string section, string stringName, bool throwOnError)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(section, \"section\");\r\n            Verify.ArgumentNotNullOrEmpty(stringName, \"stringName\");\r\n\r\n            var culture = Thread.CurrentThread.CurrentUICulture;\r\n\r\n            string cacheKey = culture.Name + section + stringName;\r\n            ExtendedNullable<string> cachedValue = _resourceCache.Get(cacheKey);\r\n            if (cachedValue != null)\r\n            {\r\n                return cachedValue.Value;\r\n            }\r\n\r\n            if (throwOnError)\r\n            {\r\n                Verify.ArgumentCondition(!section.Contains(','), \"section\", \"providerName may not contain ',' symbol\");\r\n                Verify.ArgumentCondition(!stringName.Contains(','), \"stringName\", \"stringName may not contain ',' symbol\");\r\n            }\r\n\r\n\r\n            string result = ResourceProviderPluginFacade.GetStringValue(section, stringName, culture);\r\n            if(result != null)\r\n            {\r\n                _resourceCache.Add(cacheKey, new ExtendedNullable<string> {Value = result});\r\n                return result;\r\n            }\r\n\r\n            if (!throwOnError)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (!ResourceProviderPluginFacade.LocalizationSectionDefined(section))\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Localization section not defined '{0}:{1}'\".FormatWith(section, stringName));\r\n\r\n                return Error_SectionNotDefined;\r\n            }\r\n\r\n\r\n            Log.LogVerbose(LogTitle, \"Localization string not defined '{0}:{1}'\".FormatWith(section, stringName));\r\n\r\n            return Error_StringNotDefined;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a list of all defined localization sections\r\n        /// </summary>\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetLocalizationSectionNames()\r\n        {\r\n            return ResourceProviderPluginFacade.GetLocalizationSectionNames();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool TryGetString(string providerName, string stringName, out string resultString)\r\n        {\r\n            resultString = GetString(providerName, stringName, false);\r\n\r\n            return resultString != null && (resultString != Error_SectionNotDefined) && (resultString != Error_StringNotDefined);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static List<KeyValuePair> GetLocalization(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentCondition(!providerName.Contains(','),  \"providerName\", \"providerName may not contain ','\");\r\n\r\n            if (providerName == \"XmlStringResourceProvider\")\r\n            {\r\n                providerName = \"Composite.Management\";\r\n            }\r\n\r\n            IDictionary<string, string> translations = ResourceProviderPluginFacade.GetAllStrings(providerName);\r\n\r\n\r\n            if(translations == null)\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Missing localization section: '{0}'\".FormatWith(providerName));\r\n                return new List<KeyValuePair>();\r\n            }\r\n\r\n            List<KeyValuePair> result = new List<KeyValuePair>();\r\n            foreach (KeyValuePair<string, string> pair in translations)\r\n            {\r\n                result.Add(new KeyValuePair(pair.Key, pair.Value));\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<CultureInfo> GetSupportedCultures()\r\n        {\r\n            return ResourceProviderPluginFacade.GetSupportedStringCultures();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo GetDefaultStringCulture()\r\n        {\r\n            return CultureInfo.CreateSpecificCulture(\"en-US\");\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a (localized) list of cultures, where the value is \"(region) / (language)\", where (language) is the language \r\n        /// application users will get, if they select the specified culture.\r\n        /// </summary>\r\n        /// <returns>A list of (culture name, region/language label) </returns>\r\n        [Obsolete(\"Go call GetSupportedCulturesList()\", true)]\r\n        public static List<KeyValuePair> GetApplicationRegionAndLanguageList()\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a localized label for a culture. Fall back to system display name.\r\n        /// </summary>\r\n        /// <param name=\"culture\">culture to get a localized label for</param>\r\n        /// <returns>Label for the culture</returns>\r\n        public static string GetCultureTitle(CultureInfo culture)\r\n        {\r\n            string localizedLanguageTitle;\r\n            if (TryGetString(\"Composite.Cultures\", culture.Name, out localizedLanguageTitle))\r\n            {\r\n                return localizedLanguageTitle;\r\n            }\r\n\r\n            return culture.DisplayName;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a (localized) list of all cultures\r\n        /// </summary>\r\n        /// <returns>A dictionary of (culture name, region/language label) </returns>\r\n        public static Dictionary<string, string> GetAllCultures()\r\n        {\r\n            var cultureInfos = CultureInfo.GetCultures(CultureTypes.SpecificCultures);\r\n            Dictionary<string, string> cultures = cultureInfos.ToDictionary(f => f.Name, GetCultureTitle);\r\n            return cultures.OrderBy(f => f.Value).ToDictionary(f => f.Key, f => f.Value);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a (localized) list of cultures supported by the C1 Console \r\n        /// </summary>\r\n        /// <returns>A list of (culture name, region/language label) </returns>\r\n        public static List<KeyValuePair> GetSupportedCulturesList()\r\n        {\r\n            List<CultureInfo> supportedCultures = StringResourceSystemFacade.GetSupportedCultures().ToList();\r\n            CultureInfo defaultCulture = StringResourceSystemFacade.GetDefaultStringCulture();\r\n\r\n            List<KeyValuePair> translatedOptions = new List<KeyValuePair>();\r\n\r\n            List<KeyValuePair> culturesLocalizedList = StringResourceSystemFacade.GetLocalization(\"Composite.Cultures\");\r\n\r\n            string defaultCultureDisplayName = culturesLocalizedList.Where(f => f.Key == defaultCulture.Name).Select(f => f.Value).FirstOrDefault();\r\n            if (defaultCultureDisplayName == null) defaultCultureDisplayName = defaultCulture.EnglishName;\r\n\r\n            foreach (CultureInfo culture in supportedCultures)\r\n            {\r\n                string cultureDisplayName = culturesLocalizedList.Where(f => f.Key == culture.Name).Select(f => f.Value).FirstOrDefault();\r\n                if (cultureDisplayName == null) cultureDisplayName = culture.EnglishName;\r\n\r\n                translatedOptions.Add(new KeyValuePair(culture.Name, cultureDisplayName));\r\n            }\r\n\r\n            translatedOptions = translatedOptions.OrderBy(f => f.Value).ToList();\r\n\r\n            return translatedOptions;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Parses the <paramref name=\"stringToParse\"/> for any localization strings\r\n        /// if there is any matches and these have a value, then the string is replaced\r\n        /// the result string is returned.\r\n        /// </summary>\r\n        /// <param name=\"stringToParse\"></param>\r\n        /// <returns></returns>\r\n        public static string ParseString(string stringToParse)\r\n        {\r\n            if (stringToParse == null) return null;\r\n\r\n            MatchCollection matchCollection = _regex.Matches(stringToParse);\r\n\r\n            string currentString = stringToParse;\r\n            foreach (Match match in matchCollection)\r\n            {\r\n                string compositeName = match.Groups[\"id\"].Value;\r\n\r\n                if (string.IsNullOrWhiteSpace(compositeName)) continue;\r\n\r\n                int idx = compositeName.LastIndexOf(',');\r\n                if (idx == -1) continue;\r\n\r\n                string resourceStoreName = compositeName.Remove(idx);\r\n                string stringName = compositeName.Remove(0, idx + 1).TrimStart(' ');\r\n\r\n                string replacement = GetString(resourceStoreName, stringName);\r\n\r\n                currentString = currentString.Replace(match.Value, replacement);\r\n            }\r\n\r\n            return currentString;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> SplitParseableStrings(string stringToSplit, char separator)\r\n        {\r\n            if (string.IsNullOrEmpty(stringToSplit))\r\n            {\r\n                yield break;\r\n            }\r\n\r\n            bool isInIgnoreSeparatorMode = false;\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            foreach( char c in stringToSplit)\r\n            {\r\n                if (isInIgnoreSeparatorMode == false && c == separator)\r\n                {\r\n                    yield return sb.ToString();\r\n                    sb = new StringBuilder();\r\n                }\r\n                else\r\n                {\r\n                    if (c == '}')\r\n                    {\r\n                        isInIgnoreSeparatorMode = false;\r\n                    }\r\n\r\n                    if (c == '$')\r\n                    {\r\n                        isInIgnoreSeparatorMode = true;\r\n                    }\r\n\r\n                    sb.Append(c);\r\n                }\r\n            }\r\n\r\n            yield return sb.ToString();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/AttributeBasedRoutingHelper.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing Composite.Core.Extensions;\nusing Composite.Core.Types;\nusing Composite.Data;\n\nnamespace Composite.Core.Routing\n{\n    internal class AttributeBasedRoutingHelper\n    {\n        internal class PropertyUrlMapping\n        {\n            public Attribute Attribute;\n            public PropertyInfo Property;\n            public IRelativeRouteToPredicateMapper Mapper;\n        }\n\n\n        internal interface IRelativeRouteResover : IRelativeRouteToPredicateMapper\n        {\n            /// <exclude />\n            IData TryGetData(Guid pageId, RelativeRoute routePart);\n        }\n\n\n        public static IRelativeRouteToPredicateMapper GetPredicateMapper(Type dataType)\n        {\n            Verify.ArgumentNotNull(dataType, \"dataType\");\n            Verify.ArgumentCondition(dataType.IsInterface && typeof(IData).IsAssignableFrom(dataType),\n                \"dataType\", \"The data type have to an interface, inheriting {0}\".FormatWith(typeof(IData).FullName));\n\n            var mappings = dataType\n                .GetAllProperties()\n                .SelectMany(prop => prop\n                    .GetCustomAttributes().OfType<RouteSegmentAttribute>()\n                    .Select(attr => new { Attribute = attr, attr.Order, Property = prop, Mapper = attr.BuildMapper(prop) }))\n                .OrderBy(a => a.Order)\n                .Select(a => new PropertyUrlMapping { Attribute = a.Attribute, Property = a.Property, Mapper = a.Mapper })\n                .ToArray();\n\n            if (!mappings.Any())\n            {\n                return null;\n            }\n\n            foreach (var mapping in mappings)\n            {\n                Verify.IsNotNull(mapping.Mapper, \"An attribute of type '{0}' returned a null mapper\", mapping.Attribute.GetType().FullName);\n            }\n\n            var targetType = typeof (DataTypeRelativeRouteToPredicateMapper<>).MakeGenericType(dataType);\n            var constructor = targetType.GetConstructor(new[] {typeof (PropertyUrlMapping[])});\n            return (IRelativeRouteToPredicateMapper) constructor.Invoke(new object[] { mappings });\n        }\n\n        internal class DataTypeRelativeRouteToPredicateMapper<TDataType> \n            : IRelativeRouteResover, \n              IRelativeRouteToPredicateMapper<TDataType> where TDataType : class, IData\n        {\n            private readonly PropertyUrlMapping[] _mappings;\n\n            private readonly PropertyUrlMapping _keyMapping;\n            private readonly int _keyFieldUrlSegmentOffset;\n\n\n            /// <summary>\n            /// Invoked via reflection.\n            /// </summary>\n            /// <param name=\"mappings\"></param>\n            public DataTypeRelativeRouteToPredicateMapper(PropertyUrlMapping[] mappings)\n            {\n                _mappings = mappings;\n\n                var keyProperties = typeof(TDataType).GetKeyProperties();\n                if (keyProperties.Count == 1)\n                {\n                    var keyProperty = keyProperties[0];\n                    var keyValueProviderType =\n                        typeof(IRelativeRouteValueProvider<>).MakeGenericType(keyProperty.PropertyType);\n\n                    int pathSegmentsToIgnore = 0;\n                    for (int i = 0; i < _mappings.Length; i++)\n                    {\n                        var propertyMapping = _mappings[i];\n                        if (propertyMapping.Property == keyProperty\n                            && keyValueProviderType.IsInstanceOfType(propertyMapping.Mapper))\n                        {\n                            _keyMapping = propertyMapping;\n                            _keyFieldUrlSegmentOffset = pathSegmentsToIgnore;\n                        }\n\n                        pathSegmentsToIgnore += propertyMapping.Mapper.PathSegmentsCount;\n                    }\n                }\n            }\n\n            public int PathSegmentsCount\n            {\n                get\n                {\n                    return _mappings.Sum(m => m.Mapper.PathSegmentsCount);\n                }\n            }\n\n            public Expression<Func<TDataType, bool>> GetPredicate(Guid pageId, RelativeRoute route)\n            {\n                int segmentsProcessed = 0;\n                var segments = route.PathSegments;\n\n                var parameterExpression = Expression.Parameter(typeof(TDataType), \"t\");\n\n                Expression filterExpression = null;\n\n                foreach (var mapping in _mappings)\n                {\n                    string[] segmentsArgument = null;\n                    if (mapping.Mapper.PathSegmentsCount > 0)\n                    {\n                        segmentsArgument = segments.Skip(segmentsProcessed).Take(mapping.Mapper.PathSegmentsCount).ToArray();\n\n                        segmentsProcessed += mapping.Mapper.PathSegmentsCount;\n                    }\n\n                    var relativeRoute = new RelativeRoute\n                    {\n                        PathSegments = segmentsArgument,\n                        QueryString = route.QueryString\n                    };\n\n                    var fieldFilter = GetFieldFilter(mapping.Mapper, mapping.Property.PropertyType, pageId, relativeRoute);\n                    if (fieldFilter == null)\n                    {\n                        return null;\n                    }\n\n                    var propertyExpression = Expression.Property(parameterExpression, mapping.Property);\n\n                    var filterFragmentExpression = Expression.Invoke(fieldFilter, propertyExpression);\n\n                    filterExpression = filterExpression == null\n                        ? (Expression)filterFragmentExpression\n                        : Expression.AndAlso(filterExpression, filterFragmentExpression);\n                }\n\n                if (filterExpression == null)\n                {\n                    return null;\n                }\n\n                if (typeof (IPageRelatedData).IsAssignableFrom(typeof (TDataType)))\n                {\n                    var pageIdProperty = typeof (IPageRelatedData).GetProperty(\"PageId\");\n\n                    var propertyExpr = Expression.Property(parameterExpression, pageIdProperty);\n                    var pageIdMatchExpr = Expression.Equal(propertyExpr, Expression.Constant(pageId));\n\n                    filterExpression = Expression.AndAlso(pageIdMatchExpr, filterExpression);\n                }\n\n                return Expression.Lambda<Func<TDataType, bool>>(filterExpression, parameterExpression);\n            }\n\n            public RelativeRoute GetRoute(TDataType dataItem, bool searchSignificant)\n            {\n                Verify.ArgumentNotNull(dataItem, \"dataItem\");\n\n                var resultSegments = new List<string>();\n                NameValueCollection resultQueryString = null;\n\n                foreach (var mapping in _mappings)\n                {\n                    object filedValue = mapping.Property.GetValue(dataItem);\n                    if (filedValue == null)\n                    {\n                        return null;\n                    }\n\n                    bool fieldSearchSignificant = searchSignificant && (_keyMapping == null || mapping == _keyMapping);\n\n                    var relativeRoute = InvokeMapper(mapping.Mapper, mapping.Property.PropertyType, filedValue, fieldSearchSignificant);\n                    if (relativeRoute == null)\n                    {\n                        return null;\n                    }\n\n                    resultSegments.AddRange(relativeRoute.PathSegments);\n\n                    if (relativeRoute.QueryString != null && relativeRoute.QueryString.HasKeys())\n                    {\n                        if (resultQueryString == null)\n                        {\n                            resultQueryString = new NameValueCollection(relativeRoute.QueryString);\n                        }\n                        else\n                        {\n                            resultQueryString.Add(relativeRoute.QueryString);\n                        }\n                    }\n                }\n\n                return new RelativeRoute\n                {\n                    PathSegments = resultSegments.ToArray(),\n                    QueryString = resultQueryString\n                };\n            }\n\n            private RelativeRoute InvokeMapper(\n                IRelativeRouteToPredicateMapper mapper, \n                Type fieldType, \n                object fieldValue, \n                bool searchSignificant)\n            {\n                var @interface = typeof(IRelativeRouteToPredicateMapper<>).MakeGenericType(fieldType);\n                return @interface.GetMethod(\"GetRoute\").Invoke(mapper, new[] { fieldValue, searchSignificant }) as RelativeRoute;\n            }\n\n            private Expression GetFieldFilter(\n                IRelativeRouteToPredicateMapper mapper,\n                Type propertyType,\n                Guid pageId, \n                RelativeRoute relativeRoute)\n            {\n                var @interface = typeof(IRelativeRouteToPredicateMapper<>).MakeGenericType(propertyType);\n                return @interface.GetMethod(\"GetPredicate\").Invoke(mapper, new object[] { pageId, relativeRoute }) as Expression;\n            }\n\n            public IData TryGetData(Guid pageId, RelativeRoute routePart)\n            {\n                if (routePart.PathSegments.Length != PathSegmentsCount)\n                {\n                    return null;\n                }\n\n                // Searching by key, if key value is provided by mappers\n                if (_keyMapping != null)\n                {\n                    var keyRoutePart = new RelativeRoute\n                    {\n                        PathSegments = routePart.PathSegments.Skip(_keyFieldUrlSegmentOffset)\n                            .Take(_keyMapping.Mapper.PathSegmentsCount).ToArray(),\n                        QueryString = routePart.QueryString\n                    };\n\n                    return TryDataByKeyProperty(_keyMapping, keyRoutePart);\n                }\n\n                // Searching by a fields predicate otherwise\n                var predicate = GetPredicate(pageId, routePart);\n                if (predicate == null)\n                {\n                    return null;\n                }\n\n                var dataSet = DataFacade.GetData<TDataType>(predicate).Take(2).ToList();\n\n                if (dataSet.Count == 0)\n                {\n                    return null;\n                }\n\n                if (dataSet.Count > 1)\n                {\n                    throw new DataUrlCollisionException(typeof(TDataType), routePart);\n                }\n\n                return dataSet[0];\n            }\n\n            private IData TryDataByKeyProperty(PropertyUrlMapping propertyMapping, RelativeRoute keyRoutePart)\n            {\n                var method = StaticReflection.GetGenericMethodInfo(() => TryDataByKeyProperty<Guid>(null, null));\n\n                var genericMethod = method.MakeGenericMethod(propertyMapping.Property.PropertyType);\n                return genericMethod.Invoke(this, new object[] {propertyMapping, keyRoutePart}) as TDataType;\n            }\n\n\n            private TDataType TryDataByKeyProperty<TKeyType>(PropertyUrlMapping propertyMapping, RelativeRoute keyRoutePart)\n            {\n                var valueProvider = propertyMapping.Mapper as IRelativeRouteValueProvider<TKeyType>;\n                if (valueProvider == null)\n                {\n                    return null;\n                }\n\n                TKeyType key;\n                if (!valueProvider.TryGetValue(keyRoutePart, out key))\n                {\n                    return null;\n                }\n\n                return DataFacade.TryGetDataByUniqueKey(typeof (TDataType), key) as TDataType;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Core/Routing/DataReferenceRelativeRouteToPredicateMapper.cs",
    "content": "﻿using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing Composite.Core.Linq;\nusing Composite.Core.Types;\nusing Composite.Data;\n\nnamespace Composite.Core.Routing\n{\n    internal class DataReferenceRelativeRouteToPredicateMapper<TDataType, TField> \n        : IRelativeRouteToPredicateMapper<TField> where TDataType: class, IData\n    {\n        private readonly IRelativeRouteToPredicateMapper<TDataType> _dataTypeMapper;\n\n        public DataReferenceRelativeRouteToPredicateMapper(IRelativeRouteToPredicateMapper<TDataType> dataTypeMapper)\n        {\n            _dataTypeMapper = dataTypeMapper;\n        }\n\n        public int PathSegmentsCount\n        {\n            get { return _dataTypeMapper.PathSegmentsCount; }\n        }\n\n        public Expression<Func<TField, bool>> GetPredicate(Guid pageId, RelativeRoute relativeRoute)\n        {\n            var dataPredicate = _dataTypeMapper.GetPredicate(pageId, relativeRoute);\n            if (dataPredicate == null) return null;\n\n\n            var data = DataFacade.GetData<TDataType>(dataPredicate).Evaluate();\n            if (data.Count == 0)\n            {\n                return null;\n            }\n\n            if (data.Count > 1)\n            {\n                throw new DataUrlCollisionException(typeof(TDataType), relativeRoute);\n            }\n\n            var keyObject = data.First().GetUniqueKey();\n            var key = ValueTypeConverter.Convert<TField>(keyObject);\n\n            var paramExpr = Expression.Parameter(typeof (TField));\n            var body = Expression.Equal(paramExpr, Expression.Constant(key));\n            return Expression.Lambda<Func<TField, bool>>(body, paramExpr);\n        }\n\n        public RelativeRoute GetRoute(TField fieldValue, bool fieldSearchSignificant)\n        {\n            var data = DataFacade.TryGetDataByUniqueKey<TDataType>((object)fieldValue);\n            if (data == null)\n            {\n                return null;\n            }\n\n            return _dataTypeMapper.GetRoute(data, fieldSearchSignificant);\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Core/Routing/DataUrlCollisionException.cs",
    "content": "﻿using System;\n\nnamespace Composite.Core.Routing\n{\n    internal class DataUrlCollisionException : Exception\n    {\n        public DataUrlCollisionException(Type dataType, RelativeRoute relativeRoute)\n            : base($\"There are multiple data items of type '{dataType}' matching the same relative route '{relativeRoute}'\")\n        {\n            \n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Core/Routing/DataUrls.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>\r\n    /// Building/parsing data urls, and registering <see cref=\"IDataUrlMapper\"/> objects.\r\n    /// </summary>\r\n    public static class DataUrls\r\n    {\r\n        private static readonly string LogTitle = typeof (DataUrls).FullName;\r\n\r\n        private static readonly ConcurrentDictionary<Type, IDataUrlMapper> _globalDataUrlMappers =\r\n            new ConcurrentDictionary<Type, IDataUrlMapper>();\r\n\r\n        private static readonly ConcurrentDictionary<Guid, ConcurrentDictionary<Type, IDataUrlMapper>> _dynamicPageDataUrlMappers =\r\n            new ConcurrentDictionary<Guid, ConcurrentDictionary<Type, IDataUrlMapper>>();\r\n\r\n        private static readonly ConcurrentDictionary<Guid, ConcurrentBag<KeyValuePair<Type, IDataUrlMapper>>> _staticPageDataUrlMappers =\r\n            new ConcurrentDictionary<Guid, ConcurrentBag<KeyValuePair<Type, IDataUrlMapper>>>();\r\n\r\n        static DataUrls()\r\n        {\r\n            GlobalEventSystemFacade.OnDesignChange += () => _dynamicPageDataUrlMappers.Clear();\r\n            Action<IPage> clearCache = page =>\r\n            {\r\n                ConcurrentDictionary<Type, IDataUrlMapper> temp;\r\n                _dynamicPageDataUrlMappers.TryRemove(page.Id, out temp);\r\n            };\r\n\r\n            DataEvents<IPage>.OnDeleted += (sender, args) => clearCache((IPage) args.Data);\r\n            DataEvents<IPage>.OnAfterUpdate += (sender, args) => clearCache((IPage) args.Data);\r\n            DataEvents<IPage>.OnStoreChanged += (sender, args) =>\r\n            {\r\n                if (!args.DataEventsFired)\r\n                {\r\n                    _dynamicPageDataUrlMappers.Clear();\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the data item by page url data; returns <value>null</value> if no data url mappers found.\r\n        /// </summary>\r\n        /// <param name=\"pageUrlData\"></param>\r\n        /// <returns></returns>\r\n        public static IDataReference TryGetData(PageUrlData pageUrlData)\r\n        {\r\n            Verify.ArgumentNotNull(pageUrlData, \"pageUrlData\");\r\n\r\n            if (string.IsNullOrEmpty(pageUrlData.PathInfo) && !pageUrlData.HasQueryParameters)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            foreach (var globalDataUrlMapper in _globalDataUrlMappers)\r\n            {\r\n                try\r\n                {\r\n                    var data = globalDataUrlMapper.Value.GetData(pageUrlData);\r\n                    if (data != null) return data;\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n\r\n            var page = pageUrlData.GetPage();\r\n            if (page == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            foreach (var mapper in GetMappersForPage(page.Id))\r\n            {\r\n                try\r\n                {\r\n                    var data = mapper.GetData(pageUrlData);\r\n                    if (data != null) return data;\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets page url data by data reference; returns <value>null</value> if no data url mappers found.\r\n        /// </summary>\r\n        /// <param name=\"dataReference\">The data reference.</param>\r\n        /// <returns></returns>\r\n        public static PageUrlData TryGetPageUrlData(IDataReference dataReference)\r\n        {\r\n            Verify.ArgumentNotNull(dataReference, \"dataReference\");\r\n            var interfaceType = dataReference.ReferencedType;\r\n\r\n            IDataUrlMapper dataUrlMapper;\r\n            if (_globalDataUrlMappers.TryGetValue(interfaceType, out dataUrlMapper))\r\n            {\r\n                return dataUrlMapper.GetPageUrlData(dataReference);\r\n            }\r\n\r\n            if (typeof(IPageRelatedData).IsAssignableFrom(interfaceType))\r\n            {\r\n                IData data = dataReference.Data;\r\n                if (data == null)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                Guid pageId = (data as IPageRelatedData).PageId;\r\n                return TryGetPageUrlData(pageId, dataReference);\r\n            }\r\n\r\n            foreach (var pageId in GetPageReferences(dataReference))\r\n            {\r\n                var pageUrlData = TryGetPageUrlData(pageId, dataReference);\r\n                if (pageUrlData != null)\r\n                {\r\n                    return pageUrlData;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicates whether there's a registered <see cref=\"IDataUrlMapper\"/> that can build a url for a given data reference. \r\n        /// </summary>\r\n        /// <param name=\"dataReference\">The data reference.</param>\r\n        /// <returns></returns>\r\n        public static bool CanBuildUrlForData(IDataReference dataReference)\r\n        {\r\n            Verify.ArgumentNotNull(dataReference, \"dataReference\");\r\n            var interfaceType = dataReference.ReferencedType;\r\n\r\n            if (_globalDataUrlMappers.ContainsKey(interfaceType))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            if (typeof(IPageRelatedData).IsAssignableFrom(interfaceType))\r\n            {\r\n                IData data = dataReference.Data;\r\n\r\n                Guid pageId = (data as IPageRelatedData).PageId;\r\n                return CanBuildUrlForData(interfaceType, pageId);\r\n            }\r\n\r\n            return GetPageReferences(dataReference).Any(pageId => CanBuildUrlForData(interfaceType, pageId));\r\n        }\r\n\r\n        private static bool CanBuildUrlForData(Type interfaceType, Guid pageId)\r\n        {\r\n            return GetMappersForPage(pageId, interfaceType).Any();\r\n        }\r\n\r\n        private static IEnumerable<Guid> GetPageReferences(IDataReference dataReference)\r\n        {\r\n            IData data = null;\r\n\r\n            foreach (var propertyInfo in GetPageReferenceFields(dataReference.ReferencedType))\r\n            {\r\n                data = data ?? dataReference.Data;\r\n                if (data == null)\r\n                {\r\n                    yield break;\r\n                }\r\n\r\n                Guid pageId = (Guid)propertyInfo.GetValue(data, null);\r\n                if (pageId != Guid.Empty)\r\n                {\r\n                    yield return pageId;\r\n                }\r\n            }\r\n        }\r\n\r\n        private static IEnumerable<PropertyInfo> GetPageReferenceFields(Type referencedType)\r\n        {\r\n            var descriptor = DataMetaDataFacade.GetDataTypeDescriptor(referencedType.GetImmutableTypeId());\r\n            if (descriptor == null)\r\n            {\r\n                return Enumerable.Empty<PropertyInfo>();\r\n            }\r\n\r\n            return descriptor.Fields.Where(f => f.InstanceType == typeof(Guid) \r\n                && f.ForeignKeyReferenceTypeName != null\r\n                && TypeManager.TryGetType(f.ForeignKeyReferenceTypeName) == typeof(IPage))\r\n                .Select(f => referencedType.GetProperty(f.Name));\r\n        }\r\n\r\n\r\n        private static PageUrlData TryGetPageUrlData(Guid pageId, IDataReference dataReference)\r\n        {\r\n            foreach (var mapper in GetMappersForPage(pageId, dataReference.ReferencedType))\r\n            {\r\n                var pageUrlData = mapper.GetPageUrlData(dataReference);\r\n                if (pageUrlData != null) return pageUrlData;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private static IEnumerable<IDataUrlMapper> GetMappersForPage(Guid pageId, Type interfaceType = null)\r\n        {\r\n            if (pageId == Guid.Empty) yield break;\r\n\r\n            var page = PageManager.GetPageById(pageId);\r\n            if (page == null) yield break;\r\n\r\n            var staticMappers = GetStaticMappers(page);\r\n            foreach (var mapper in staticMappers)\r\n            {\r\n                if (interfaceType == null || mapper.Key.IsAssignableFrom(interfaceType))\r\n                {\r\n                    yield return mapper.Value;\r\n                }\r\n            }\r\n\r\n            var mappers = GetDynamicMappers(page);\r\n            foreach (var mapper in mappers)\r\n            {\r\n                if (interfaceType == null || mapper.Key.IsAssignableFrom(interfaceType))\r\n                {\r\n                    yield return mapper.Value;\r\n                }\r\n            }\r\n        }\r\n\r\n        private static IEnumerable<KeyValuePair<Type, IDataUrlMapper>> GetStaticMappers(IPage page)\r\n        {\r\n            ConcurrentBag<KeyValuePair<Type, IDataUrlMapper>> result;\r\n            if (!_staticPageDataUrlMappers.TryGetValue(page.Id, out result))\r\n            {\r\n                return Enumerable.Empty<KeyValuePair<Type, IDataUrlMapper>>();\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static IEnumerable<KeyValuePair<Type, IDataUrlMapper>> GetDynamicMappers(IPage page)\r\n        {\r\n            ConcurrentDictionary<Type, IDataUrlMapper> mappers;\r\n\r\n            PageRenderingHistory.RenderPageIfNotRendered(page);\r\n\r\n            if (!_dynamicPageDataUrlMappers.TryGetValue(page.Id, out mappers))\r\n            {\r\n                return Enumerable.Empty<KeyValuePair<Type, IDataUrlMapper>>();\r\n            }\r\n\r\n            return mappers;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Registers a global data url mapper for the specified type.\r\n        /// </summary>\r\n        /// <param name=\"dataUrlMapper\"></param>\r\n        /// <typeparam name=\"T\">The data type.</typeparam>\r\n        public static void RegisterGlobalDataUrlMapper<T>(IDataUrlMapper dataUrlMapper) where T : class, IData\r\n        {\r\n            RegisterGlobalDataUrlMapper(typeof (T), dataUrlMapper);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers a global data url mapper for the specified type.\r\n        /// </summary>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <param name=\"dataUrlMapper\">The data url mapper.</param>\r\n        public static void RegisterGlobalDataUrlMapper(Type dataType, IDataUrlMapper dataUrlMapper)\r\n        {\r\n            Verify.ArgumentCondition(dataType.IsInterface && typeof(IData).IsAssignableFrom(dataType), \"dataType\",\r\n                \"The data type should be an interface inheriting Composite.Data.IData\");\r\n\r\n            _globalDataUrlMappers[dataType] = dataUrlMapper;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers a data url mapper associated with a page.\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"dataUrlMapper\">The data url mapper.</param>\r\n        /// <typeparam name=\"T\">The data type.</typeparam>\r\n        public static void RegisterDynamicDataUrlMapper<T>(Guid pageId, IDataUrlMapper dataUrlMapper) where T: class, IData\r\n        {\r\n            RegisterDynamicDataUrlMapper(pageId, typeof(T), dataUrlMapper);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers a data url mapper associated with a page.\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <param name=\"dataUrlMapper\">The data url mapper.</param>\r\n        public static void RegisterDynamicDataUrlMapper(Guid pageId, Type dataType, IDataUrlMapper dataUrlMapper)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(dataUrlMapper, \"dataUrlMapper\");\r\n            Verify.ArgumentCondition(dataType.IsInterface && typeof(IData).IsAssignableFrom(dataType), \"dataType\",\r\n                    \"The data type should be an interface inheriting Composite.Data.IData\");\r\n\r\n            var handlerList = _dynamicPageDataUrlMappers.GetOrAdd(pageId,\r\n                key => new ConcurrentDictionary<Type, IDataUrlMapper>());\r\n\r\n            handlerList[dataType] = dataUrlMapper;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers a data url mapper associated with a page.\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <param name=\"dataUrlMapper\">The data url mapper.</param>\r\n        public static void RegisterStaticDataUrlMapper(Guid pageId, Type dataType, IDataUrlMapper dataUrlMapper)\r\n        {\r\n            Verify.ArgumentNotNull(dataUrlMapper, \"dataUrlMapper\");\r\n            Verify.ArgumentCondition(dataType.IsInterface && typeof(IData).IsAssignableFrom(dataType), \"dataType\",\r\n                    \"The data type should be an interface inheriting Composite.Data.IData\");\r\n\r\n            var handlerList = _staticPageDataUrlMappers.GetOrAdd(pageId,\r\n                key => new ConcurrentBag<KeyValuePair<Type, IDataUrlMapper>>());\r\n\r\n            if (handlerList.Count > 100)\r\n            {\r\n                // Preventing a memory leak here\r\n                return;\r\n            }\r\n\r\n            handlerList.Add(new KeyValuePair<Type, IDataUrlMapper>(dataType, dataUrlMapper));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/DefaultRelativeRouteToPredicateMapper.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.Routing.Foundation.PluginFacades;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    internal class DefaultRelativeRouteToPredicateMapper<TValue> \r\n        : IRelativeRouteToPredicateMapper<TValue>, IRelativeRouteValueProvider<TValue>\r\n    {\r\n        public int PathSegmentsCount => 1;\r\n\r\n        public Expression<Func<TValue, bool>> GetPredicate(Guid pageId, RelativeRoute routePart)\r\n        {\r\n            TValue fieldValue;\r\n\r\n            if (!TryGetValue(routePart, out fieldValue))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return field => field.Equals(fieldValue);\r\n        }\r\n\r\n        public RelativeRoute GetRoute(TValue fieldValue, bool searchSignificant)\r\n        {\r\n            if (!typeof(TValue).IsValueType && fieldValue == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string stringValue;\r\n            if (IsGuidField)\r\n            {\r\n                stringValue = UrlUtils.CompressGuid((fieldValue as Guid?).Value);\r\n            }\r\n            else if (IsStringField)\r\n            {\r\n                stringValue = searchSignificant ? UrlUtils.EncodeUrlInvalidCharacters(fieldValue as string)\r\n                                                : StringToUrlPart(fieldValue as string);\r\n            }\r\n            else\r\n            {\r\n                stringValue = ValueTypeConverter.Convert<string>(fieldValue);\r\n            }\r\n            \r\n\r\n            return new RelativeRoute {PathSegments = new[] {stringValue}};\r\n        }\r\n\r\n        private static string StringToUrlPart(string partnerName)\r\n        {\r\n            return UrlFormattersPluginFacade.FormatUrl(partnerName, true);\r\n        }\r\n\r\n        public bool TryGetValue(RelativeRoute routePart, out TValue value)\r\n        {\r\n            var stringValue = routePart.PathSegments.Single();\r\n\r\n            if (string.IsNullOrEmpty(stringValue))\r\n            {\r\n                value = default(TValue);\r\n                return false;\r\n            }\r\n\r\n            if (IsGuidField)\r\n            {\r\n                Guid tempGuid;\r\n\r\n                if (!UrlUtils.TryExpandGuid(stringValue, out tempGuid) && !Guid.TryParse(stringValue, out tempGuid))\r\n                {\r\n                    value = default(TValue);\r\n                    return false;\r\n                }\r\n\r\n                value = (TValue)(tempGuid as object);\r\n                return true;\r\n            }\r\n\r\n            if (IsStringField)\r\n            {\r\n                value = (TValue) (UrlUtils.DecodeUrlInvalidCharacters(stringValue) as object);\r\n                return true;\r\n            }\r\n\r\n            Exception exception;\r\n            object valueObj = ValueTypeConverter.TryConvert(stringValue, typeof(TValue), out exception);\r\n\r\n            bool success = valueObj != null;\r\n            value = success ? (TValue) valueObj : default(TValue);\r\n\r\n            return success;\r\n        }\r\n\r\n\r\n        private bool IsStringField => typeof(TValue) == typeof(string);\r\n\r\n        private bool IsGuidField => typeof(TValue) == typeof(Guid);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Foundation/PluginFacades/PageUrlProviderPluginFacade.cs",
    "content": "﻿using Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders.Runtime;\r\nusing Composite.Core.Routing.Plugins.Runtime;\r\n\r\nnamespace Composite.Core.Routing.Foundation.PluginFacades\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PageUrlProviderPluginFacade\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n        static PageUrlProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => _resourceLocker.ResetInitialization());\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IPageUrlProvider GetDefaultProvider()\r\n        {\r\n            var resources = _resourceLocker.Resources;\r\n\r\n            string providerName = resources.DefaultPageUrlProviderName;\r\n\r\n            var provider = resources.ProviderCache[providerName];\r\n\r\n            if (provider == null)\r\n            {\r\n                lock (resources.ProviderCache)\r\n                {\r\n                    provider = resources.ProviderCache[providerName];\r\n                    if (provider == null)\r\n                    {\r\n                        provider = resources.Factory.Create(providerName);\r\n                        Verify.IsNotNull(provider, \"Failed to build page url provider '{0}'\", providerName);\r\n\r\n                        resources.ProviderCache.Add(providerName, provider);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return provider;\r\n        }\r\n\r\n        private sealed class Resources\r\n        {\r\n            private string _defaultPageUrlProviderName;\r\n            public PageUrlProviderFactory Factory { get; set; }\r\n            public Hashtable<string, IPageUrlProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.Factory = new PageUrlProviderFactory();\r\n                resources.ProviderCache = new Hashtable<string, IPageUrlProvider>();\r\n            }\r\n\r\n            public string DefaultPageUrlProviderName\r\n            {\r\n                get\r\n                {\r\n                    if (_defaultPageUrlProviderName == null)\r\n                    {\r\n                        string sectionName = UrlsConfiguration.SectionName;\r\n                        var routingConfiguration = ConfigurationServices.ConfigurationSource.GetSection(sectionName) as UrlsConfiguration;\r\n\r\n                        Verify.IsNotNull(routingConfiguration, \"Missing configuration section '{0}'\", sectionName);\r\n\r\n                        _defaultPageUrlProviderName = routingConfiguration.DefaultPageUrlProviderName;\r\n                    }\r\n\r\n                    return _defaultPageUrlProviderName;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Foundation/PluginFacades/UrlFormattersPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Routing.Plugins.Runtime;\r\nusing Composite.Core.Routing.Plugins.UrlFormatters;\r\nusing Composite.Core.Routing.Plugins.UrlFormatters.Runtime;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\nnamespace Composite.Core.Routing.Foundation.PluginFacades\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class UrlFormattersPluginFacade\r\n    {\r\n        private static readonly string LogTitle = typeof(UrlFormattersPluginFacade).FullName;\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n        static UrlFormattersPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => _resourceLocker.ResetInitialization());\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string FormatUrl(string url, bool onlyMandatory)\r\n        {\r\n            IEnumerable<Tuple<IUrlFormatter, bool>> urlFormatters = _resourceLocker.Resources.UrlFormatters;\r\n\r\n            foreach(var urlFormatter in urlFormatters)\r\n            {\r\n                if (!onlyMandatory || urlFormatter.Item2)\r\n                {\r\n                    url = urlFormatter.Item1.FormatUrl(url);\r\n                }\r\n            }\r\n\r\n            url = FilterInvalidCharacters(url);\r\n\r\n            return url;\r\n        }\r\n\r\n        private static string FilterInvalidCharacters(string pageTitle)\r\n        {\r\n            var regexClientValidationRule = \r\n                ClientValidationRuleFacade.GetClientValidationRules(typeof(IPage), \"UrlTitle\")\r\n                                          .OfType<RegexClientValidationRule>().Single();\r\n\r\n            var generated = new StringBuilder();\r\n            var regex = new Regex(regexClientValidationRule.Expression);\r\n\r\n            foreach (char c in pageTitle)\r\n            {\r\n                var matchString = new string(c, 1);\r\n                if (regex.IsMatch(matchString))\r\n                {\r\n                    generated.Append(c);\r\n                }\r\n            }\r\n\r\n            return generated.ToString();\r\n        }\r\n\r\n        private sealed class Resources\r\n        {\r\n            public IEnumerable<Tuple<IUrlFormatter, bool>> UrlFormatters { get; private set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                const string sectionName = UrlsConfiguration.SectionName;\r\n                var routingConfiguration = ConfigurationServices.ConfigurationSource.GetSection(sectionName) as UrlsConfiguration;\r\n                Verify.IsNotNull(routingConfiguration, \"Config section '{0}' is missing\", sectionName);\r\n\r\n                var factory = new UrlFormatterFactory();\r\n\r\n                var formatters = new List<Tuple<IUrlFormatter, bool>>();\r\n\r\n                var urlFormattersConfigNode = routingConfiguration.UrlFormatters;\r\n                if (urlFormattersConfigNode != null)\r\n                {\r\n                    foreach (var urlFormatterData in urlFormattersConfigNode)\r\n                    {\r\n                        string name = urlFormatterData.Name;\r\n\r\n                        try\r\n                        {\r\n                            formatters.Add(new Tuple<IUrlFormatter, bool>(factory.Create(name), urlFormatterData.Mandatory));\r\n                        }\r\n                        catch(Exception ex)\r\n                        {\r\n                            Log.LogError(LogTitle, \"Failed to load url formatter '{0}'\", name);\r\n                            Log.LogError(LogTitle, ex);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                resources.UrlFormatters = formatters;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/HostnameBindingsFacade.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Routing.Pages;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    internal class HostnameBindingsFacade\r\n    {\r\n        static HostnameBindingsFacade()\r\n        {\r\n            DataEventSystemFacade.SubscribeToDataBeforeAdd<IUrlConfiguration>(OnBeforeUpdatingHostnameConfiguration, true);\r\n            DataEventSystemFacade.SubscribeToDataBeforeUpdate<IUrlConfiguration>(OnBeforeUpdatingHostnameConfiguration, true);\r\n\r\n            DataEventSystemFacade.SubscribeToDataBeforeAdd<IHostnameBinding>(OnBeforeUpdatingHostnameBinding, true);\r\n            DataEventSystemFacade.SubscribeToDataBeforeUpdate<IHostnameBinding>(OnBeforeUpdatingHostnameBinding, true);\r\n        }\r\n\r\n        private static void OnBeforeUpdatingHostnameConfiguration(object sender, DataEventArgs dataeventargs)\r\n        {\r\n            var configurationNode = dataeventargs.Data as IUrlConfiguration;\r\n\r\n            Verify.IsNotNull(configurationNode, \"configurationNode is null\");\r\n\r\n            // Trimming page url suffix\r\n            configurationNode.PageUrlSuffix = (configurationNode.PageUrlSuffix ?? string.Empty).Trim();\r\n        }\r\n\r\n        private static void OnBeforeUpdatingHostnameBinding(object sender, DataEventArgs dataeventargs)\r\n        {\r\n            var hostnameBinding = dataeventargs.Data as IHostnameBinding;\r\n\r\n            Verify.IsNotNull(hostnameBinding, \"hostnameBinding is null\");\r\n\r\n            // Trimming and lowercasing hostname\r\n            hostnameBinding.Hostname = (hostnameBinding.Hostname ?? string.Empty).Trim().ToLowerInvariant();\r\n            hostnameBinding.PageNotFoundUrl = (hostnameBinding.PageNotFoundUrl ?? string.Empty).Trim();\r\n        }\r\n\r\n\r\n        public static void Initialize()\r\n        {\r\n            lock (typeof(HostnameBindingsFacade))\r\n            {\r\n                using (ThreadDataManager.EnsureInitialize())\r\n                {\r\n                    if (DataFacade.GetData<IUrlConfiguration>().Any())\r\n                    {\r\n                        return;\r\n                    }\r\n                    \r\n                    var configurationData = DataFacade.BuildNew<IUrlConfiguration>();\r\n                    configurationData.Id = new Guid(\"c7bd886b-7208-4257-b641-df2571a4872b\");\r\n\r\n                    configurationData.PageUrlSuffix = string.Empty;\r\n\r\n                    DataFacade.AddNew(configurationData);\r\n                }\r\n            }\r\n        }\r\n\r\n        internal static IHostnameBinding GetBindingForCurrentRequest()\r\n        {\r\n            return GetHostnameBinding(HttpContext.Current);\r\n        }\r\n\r\n        private static IHostnameBinding GetHostnameBinding(HttpContext httpContext)\r\n        {\r\n            if(httpContext == null) return null;\r\n\r\n            string host = httpContext.Request.Url.Host;\r\n\r\n            // TODO: optimize?\r\n            return DataFacade.GetData<IHostnameBinding>().AsEnumerable().FirstOrDefault(b => b.Hostname == host);\r\n        }\r\n\r\n        internal static IHostnameBinding GetAliasBinding(HttpContext httpContext)\r\n        {\r\n            if (httpContext == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string hostname = httpContext.Request.Url.Host.ToLowerInvariant();\r\n\r\n            foreach (var hostnameBinding in DataFacade.GetData<IHostnameBinding>(true).AsEnumerable())\r\n            {\r\n                string[] aliases = hostnameBinding.Aliases.Split(new[] {\"\\r\\n\", \"\\n\"},\r\n                    StringSplitOptions.RemoveEmptyEntries);\r\n\r\n                if (aliases.Any(a => a == hostname))\r\n                {\r\n                    return hostnameBinding;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        internal static bool IsPageNotFoundRequest()\r\n        {\r\n            var context = HttpContext.Current;\r\n            if(context == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            string customPageNotFoundUrl = GetCustomPageNotFoundUrl(context);\r\n\r\n            if (customPageNotFoundUrl.IsNullOrEmpty())\r\n            {\r\n                return false;\r\n            }\r\n\r\n            customPageNotFoundUrl = customPageNotFoundUrl.Trim();\r\n\r\n            if(!customPageNotFoundUrl.StartsWith(\"/\") && !customPageNotFoundUrl.Contains(\"://\"))\r\n            {\r\n                customPageNotFoundUrl = \"/\" + customPageNotFoundUrl;\r\n            }\r\n\r\n            var request = context.Request;\r\n\r\n            return request.RawUrl == customPageNotFoundUrl\r\n                    || request.Url.PathAndQuery == customPageNotFoundUrl\r\n                    || request.Url.PathAndQuery.StartsWith(customPageNotFoundUrl + \"?\");\r\n        }\r\n\r\n        internal static string GetCustomPageNotFoundUrl() => GetCustomPageNotFoundUrl(HttpContext.Current);\r\n        \r\n\r\n        private static string GetCustomPageNotFoundUrl(HttpContext httpContext)\r\n        {\r\n            if (httpContext == null) return null;\r\n\r\n            var binding = GetHostnameBinding(httpContext);\r\n            if(string.IsNullOrEmpty(binding?.PageNotFoundUrl))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string url = binding.PageNotFoundUrl;\r\n\r\n            var defaultCulture = DataLocalizationFacade.DefaultLocalizationCulture;\r\n\r\n            CultureInfo localeFromRequest =\r\n                C1PageRoute.PageUrlData?.LocalizationScope\r\n                ?? DefaultPageUrlProvider.GetCultureInfo(httpContext.Request.FilePath, binding, out _)\r\n                ?? defaultCulture;\r\n\r\n            using (new DataConnection(localeFromRequest))\r\n            {\r\n                url = InternalUrls.TryConvertInternalUrlToPublic(url) ?? url;\r\n            }\r\n\r\n            if (url.StartsWith(\"~/\") && localeFromRequest.Name != defaultCulture.Name)\r\n            {\r\n                using (new DataConnection(defaultCulture))\r\n                {\r\n                    url = InternalUrls.TryConvertInternalUrlToPublic(url) ?? url;\r\n                }\r\n            }\r\n\r\n            if (url.StartsWith(\"~/\")) url = UrlUtils.ResolvePublicUrl(url);\r\n\r\n            return url;\r\n        }\r\n\r\n        internal static bool ServeCustomPageNotFoundPage(HttpContext httpContext)\r\n        {\r\n            string rawUrl = httpContext.Request.RawUrl;\r\n\r\n            string customPageNotFoundUrl = GetCustomPageNotFoundUrl(httpContext);\r\n\r\n            if (string.IsNullOrEmpty(customPageNotFoundUrl))\r\n            {\r\n                return false;\r\n            }\r\n            \r\n            if (rawUrl == customPageNotFoundUrl || httpContext.Request.Url.PathAndQuery == customPageNotFoundUrl)\r\n            {\r\n                throw new HttpException(404, $\"'Page not found' wasn't handled. Url: '{rawUrl}'\");\r\n            }\r\n\r\n            if (HttpRuntime.UsingIntegratedPipeline && customPageNotFoundUrl.StartsWith(\"/\"))\r\n            {\r\n                httpContext.Server.TransferRequest(customPageNotFoundUrl);\r\n                return true;\r\n            }\r\n\r\n            httpContext.Response.Redirect(customPageNotFoundUrl, true);\r\n\r\n            throw new InvalidOperationException(\"This code should not be reachable\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/IDataUrlMapper.cs",
    "content": "﻿using System;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>\r\n    /// Provides a link between a data item and a url\r\n    /// </summary>\r\n    public interface IDataUrlMapper \r\n    {\r\n        /// <summary>\r\n        /// Gets a data item by page url data\r\n        /// </summary>\r\n        /// <param name=\"pageUrlData\"></param>\r\n        /// <returns></returns>\r\n        IDataReference GetData(PageUrlData pageUrlData);\r\n\r\n        /// <summary>\r\n        /// Gets page url data by a a data item\r\n        /// </summary>\r\n        /// <param name=\"instance\"></param>\r\n        /// <returns></returns>\r\n        PageUrlData GetPageUrlData(IDataReference instance);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/IInternalUrlConverter.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>\r\n    /// An interface for internal url transformation.\r\n    /// </summary>\r\n    public interface IInternalUrlConverter\r\n    {\r\n        /// <summary>\r\n        /// Contains an enumeration of url prefixes for urls current convert is handling\r\n        /// </summary>\r\n        IEnumerable<string> AcceptedUrlPrefixes { get; }\r\n\r\n        /// <summary>\r\n        /// Converts a url in an internal format (f.e. \"~/page(guid)\" or \"~/media(guid)\") to a public serveable url (f.e. \"/page/subpage\").\r\n        /// </summary>\r\n        /// <param name=\"internalUrl\">An internal url.</param>\r\n        /// <param name=\"urlSpace\">The target url space.</param>\r\n        /// <returns></returns>\r\n        string ToPublicUrl(string internalUrl, UrlSpace urlSpace);\r\n\r\n        /// <summary>\r\n        /// Converts an internal url in an internal format (f.e. \"~/page(guid)\" or \"~/media(guid)\") to a data reference.\r\n        /// </summary>\r\n        /// <param name=\"internalUrl\">An internal url.</param>\r\n        /// <returns></returns>\r\n        IDataReference ToDataReference(string internalUrl);\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Routing/IInternalUrlProvider.cs",
    "content": "﻿using Composite.Data;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>\r\n    /// Providers internal urls for data references.\r\n    /// </summary>\r\n    public interface IInternalUrlProvider\r\n    {\r\n        /// <summary>\r\n        /// Builds an internal urls for the specified data reference.\r\n        /// </summary>\r\n        /// <param name=\"reference\">The data reference.</param>\r\n        /// <returns></returns>\r\n        string BuildInternalUrl(IDataReference reference);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/IMediaUrlProvider.cs",
    "content": "﻿using System;\r\nusing Composite.Core.WebClient.Media;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>    \r\n    /// An interface for providing media urls for a given media id.\r\n    /// </summary>\r\n    public interface IMediaUrlProvider\r\n    {\r\n        /// <summary>\r\n        /// Gets a public media url\r\n        /// </summary>\r\n        /// <param name=\"storeId\">The store id.</param>\r\n        /// <param name=\"mediaId\">The media id.</param>\r\n        /// <returns></returns>\r\n        string GetPublicMediaUrl(string storeId, Guid mediaId);\r\n    }\r\n\r\n    /// <summary>    \r\n    /// An interface for providing media urls for a given media id.\r\n    /// </summary>\r\n    public interface IResizableImageUrlProvider: IMediaUrlProvider\r\n    {\r\n        /// <summary>\r\n        /// Gets a public media url, that takes the specified resizing options into account\r\n        /// </summary>\r\n        /// <param name=\"storeId\">The store id.</param>\r\n        /// <param name=\"mediaId\">The media id.</param>\r\n        /// <param name=\"resizingOptions\">The image resizing options.</param>\r\n        /// <returns></returns>\r\n        string GetResizedImageUrl(string storeId, Guid mediaId, ResizingOptions resizingOptions);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/IRelativeRouteToPredicateMapper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Specialized;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Web;\r\n\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <exclude />\r\n    public class RelativeRoute\r\n    {\r\n        /// <exclude />\r\n        public string[] PathSegments { get; set; }\r\n\r\n        /// <exclude />\r\n        public NameValueCollection QueryString { get; set; }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            string result = PathSegments != null ? string.Join(\"/\", PathSegments) : string.Empty;\r\n\r\n            if (result != string.Empty)\r\n            {\r\n                result = \"/\" + result;\r\n            }\r\n\r\n            if (QueryString != null && QueryString.Count > 0)\r\n            {\r\n                Func<string, string> encode = HttpUtility.HtmlAttributeEncode;\r\n\r\n                result += \"?\" + string.Join(\"&\",\r\n                            QueryString.Cast<string>().Select(key => $\"{encode(key)}={encode(QueryString[key])}\"));\r\n\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n\r\n    /// <exclude />\r\n    public interface IRelativeRouteToPredicateMapper\r\n    {\r\n        /// <summary>\r\n        /// Returns the amount of path info segments, handled by current mapper.\r\n        /// </summary>\r\n        int PathSegmentsCount { get; }\r\n    }\r\n\r\n    /// <exclude />\r\n    public interface IRelativeRouteToPredicateMapper<T> : IRelativeRouteToPredicateMapper\r\n    {\r\n        /// <summary>\r\n        /// Gets a predicate for filtering data based on a url segment\r\n        /// </summary>\r\n        /// <param name=\"pageId\"></param>\r\n        /// <param name=\"routePart\">The relative route</param>\r\n        /// <returns></returns>\r\n        Expression<Func<T, bool>> GetPredicate(Guid pageId, RelativeRoute routePart);\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"fieldValue\"></param>\r\n        /// <param name=\"searchSignificant\">When <value>false</value>, the generated relative route will not be used for database querying.</param>\r\n        /// <returns></returns>\r\n        RelativeRoute GetRoute(T fieldValue, bool searchSignificant);\r\n    }\r\n\r\n    /// <exclude />\r\n    public interface IRelativeRouteValueProvider<T> : IRelativeRouteToPredicateMapper\r\n    {\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"routePart\"></param>\r\n        /// <param name=\"value\"></param>\r\n        /// <returns></returns>\r\n        bool TryGetValue(RelativeRoute routePart, out T value);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/InternalUrls.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Plugins.Routing.InternalUrlConverters;\r\nusing Composite.Plugins.Routing.InternalUrlProviders;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>\r\n    /// Allows setting custom urls conversions.\r\n    /// </summary>\r\n    public static class InternalUrls\r\n    {\r\n        private static readonly List<IInternalUrlConverter> _converters = new List<IInternalUrlConverter>();\r\n        private static readonly ConcurrentDictionary<Type, IInternalUrlProvider> _providers = new ConcurrentDictionary<Type, IInternalUrlProvider>();\r\n\r\n        internal static void Initialize_PostDataTypes()\r\n        {\r\n            foreach (Type type in DataProviderRegistry.AllInterfaces)\r\n            {\r\n                string internalUrlPrefix = DynamicTypeReflectionFacade.GetInternalUrlPrefix(type);\r\n                if(string.IsNullOrEmpty(internalUrlPrefix)) continue;\r\n\r\n                Register(new DataInternalUrlConverter(internalUrlPrefix, type));\r\n                Register(type, new DataInternalUrlProvider(internalUrlPrefix, type));\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Registers an internal url converter.\r\n        /// </summary>\r\n        /// <param name=\"urlConverter\"></param>\r\n        public static void Register(IInternalUrlConverter urlConverter)\r\n        {\r\n            _converters.Add(urlConverter);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Register an internal url provider.\r\n        /// </summary>\r\n        /// <param name=\"dataType\"></param>\r\n        /// <param name=\"urlProvider\"></param>\r\n        public static void Register(Type dataType, IInternalUrlProvider urlProvider)\r\n        {\r\n            _providers[dataType] = urlProvider;\r\n        }\r\n        \r\n\r\n        /// <summary>\r\n        /// Converts internal urls to public ones in a given html fragment\r\n        /// </summary>\r\n        /// <param name=\"html\"></param>\r\n        /// <returns></returns>\r\n        public static string ConvertInternalUrlsToPublic(string html)\r\n        {\r\n            Verify.ArgumentNotNull(html, \"html\");\r\n\r\n            return ConvertInternalUrlsToPublic(html, _converters);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicates whether internal urls can be generated for the specified data type.\r\n        /// </summary>\r\n        /// <param name=\"dataType\"></param>\r\n        /// <returns></returns>\r\n        public static bool DataTypeSupported(Type dataType)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n\r\n            return _providers.ContainsKey(dataType);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets an internal url for the specified data reference.\r\n        /// </summary>\r\n        /// <param name=\"dataReference\">The data referenc.</param>\r\n        /// <returns></returns>\r\n        public static string TryBuildInternalUrl(IDataReference dataReference)\r\n        {\r\n            Verify.ArgumentNotNull(dataReference, \"dataReference\");\r\n\r\n            var type = dataReference.ReferencedType;\r\n\r\n            IInternalUrlProvider internalUrlProvider;\r\n\r\n            if (!_providers.TryGetValue(type, out internalUrlProvider))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return internalUrlProvider.BuildInternalUrl(dataReference);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Tries to parse an internal url, returns a <value>null</value> if failed.\r\n        /// </summary>\r\n        /// <param name=\"internalUrl\">The internal url.</param>\r\n        /// <returns></returns>\r\n        public static IDataReference TryParseInternalUrl(string internalUrl)\r\n        {\r\n            if (!internalUrl.StartsWith(\"~/\")) return null;\r\n\r\n            string urlWithoutTilde = internalUrl.Substring(2);\r\n            foreach (var converter in _converters)\r\n            {\r\n                foreach (var prefix in converter.AcceptedUrlPrefixes.Reverse())\r\n                {\r\n                    if (urlWithoutTilde.StartsWith(prefix, StringComparison.Ordinal))\r\n                    {\r\n                        return converter.ToDataReference(internalUrl);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Tries to convert an internal url to a public one, returns the original value if failed.\r\n        /// </summary>\r\n        /// <param name=\"internalUrl\">The internal url.</param>\r\n        /// <param name=\"urlSpace\">The url space.</param>\r\n        /// <returns></returns>\r\n        public static string TryConvertInternalUrlToPublic(string internalUrl, UrlSpace urlSpace = null)\r\n        {\r\n            if (!internalUrl.StartsWith(\"~/\")) return internalUrl;\r\n\r\n            string urlWithoutTilde = internalUrl.Substring(2);\r\n\r\n            foreach (var converter in _converters)\r\n            {\r\n                foreach (var prefix in converter.AcceptedUrlPrefixes.Reverse())\r\n                {\r\n                    if (urlWithoutTilde.StartsWith(prefix, StringComparison.Ordinal))\r\n                    {\r\n                        return converter.ToPublicUrl(internalUrl, urlSpace ?? new UrlSpace()) ?? internalUrl;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return internalUrl;\r\n        }\r\n\r\n        private static string ResolvePrefix(string urlPrefix) => UrlUtils.PublicRootPath + \"/\" + urlPrefix;\r\n\r\n        private static Dictionary<string, IInternalUrlConverter> GetConvertersMap(Func<string, string> mapPrefix)\r\n        {\r\n            var result = new Dictionary<string, IInternalUrlConverter>();\r\n            foreach (var converter in _converters)\r\n            {\r\n                foreach (var prefix in converter.AcceptedUrlPrefixes)\r\n                {\r\n                    result[mapPrefix(prefix)] = converter;\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static bool IsLinkAttribute(XName attrName) =>\r\n            attrName.LocalName == \"src\"\r\n            || attrName.LocalName == \"href\"\r\n            || attrName.LocalName == \"srcset\";\r\n\r\n\r\n        /// <summary>\r\n        /// Converts internal urls to public ones in a given html fragment\r\n        /// </summary>\r\n        /// <param name=\"document\"></param>\r\n        /// <returns></returns>\r\n        public static void ConvertInternalUrlsToPublic(XDocument document)\r\n        {\r\n            Verify.ArgumentNotNull(document, nameof(document));\r\n\r\n            var convertersMap = GetConvertersMap(ResolvePrefix);\r\n            if (!convertersMap.Any()) return;\r\n\r\n            var urlSpace = new UrlSpace();\r\n\r\n            var convertionCache = new Dictionary<string, string>();\r\n            foreach (var element in document.Descendants())\r\n            {\r\n                foreach (var attr in element.Attributes().Where(a => IsLinkAttribute(a.Name)))\r\n                {\r\n                    string link = attr.Value;\r\n                    if (convertionCache.TryGetValue(link, out string cachedLink))\r\n                    {\r\n                        attr.Value = cachedLink;\r\n                        continue;\r\n                    }\r\n\r\n                    foreach (var prefix in convertersMap.Keys)\r\n                    {\r\n                        if (link.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))\r\n                        {\r\n                            var converter = convertersMap[prefix];\r\n                            var newLink = converter.ToPublicUrl(link, urlSpace);\r\n                            if (newLink != null && newLink != link)\r\n                            {\r\n                                convertionCache[link] = newLink;\r\n                                attr.Value = newLink;\r\n                                break;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Converts internal urls to public ones in a given html fragment\r\n        /// </summary>\r\n        /// <param name=\"html\"></param>\r\n        /// <param name=\"converters\"></param>\r\n        /// <returns></returns>\r\n        internal static string ConvertInternalUrlsToPublic(string html, IEnumerable<IInternalUrlConverter> converters)\r\n        {\r\n            var convertersMap = GetConvertersMap(_ => _);\r\n            if (!convertersMap.Any())\r\n            {\r\n                return html;\r\n            }\r\n\r\n            // Urls, generated in UserControl-s may still have \"~/\" as a prefix\r\n            foreach (var urlPrefix in convertersMap.Keys)\r\n            {\r\n                string rawUrlPrefix = \"~/\" + urlPrefix;\r\n                string resolvedUrlPrefix = ResolvePrefix(urlPrefix);\r\n\r\n                html = UrlUtils.ReplaceUrlPrefix(html, rawUrlPrefix, resolvedUrlPrefix);\r\n            }\r\n\r\n            StringBuilder result = null;\r\n\r\n            var urlsToConvert = new List<UrlToConvert> ();\r\n\r\n            foreach (var pair in convertersMap)\r\n            {\r\n                string internalPrefix = ResolvePrefix(pair.Key);\r\n                var converter = pair.Value;\r\n\r\n                // Bracket encoding fix\r\n                string prefixToSearch = internalPrefix;\r\n                if (prefixToSearch.EndsWith(\"(\", StringComparison.Ordinal))\r\n                {\r\n                    prefixToSearch = prefixToSearch.Substring(0, internalPrefix.Length - 1);\r\n                }\r\n\r\n                urlsToConvert.AddRange(UrlUtils.FindUrlsInHtml(html, prefixToSearch).Select(match => \r\n                    new UrlToConvert(match, internalPrefix, converter)));\r\n            }\r\n            \r\n            // Sorting the offsets by descending, so we can replace urls in that order by not affecting offsets of not yet processed urls\r\n            urlsToConvert.Sort((a, b) => -a.Match.Index.CompareTo(b.Match.Index));\r\n\r\n            int lastReplacementIndex = int.MaxValue;\r\n\r\n            var urlSpace = new UrlSpace();\r\n\r\n            var measurements = new Dictionary<string, Measurement>();\r\n\r\n            var convertionCache = new Dictionary<string, string>();\r\n            foreach (var urlToConvert in urlsToConvert)\r\n            {\r\n                UrlUtils.UrlMatch urlMatch = urlToConvert.Match;\r\n                if(urlMatch.Index == lastReplacementIndex) continue;\r\n\r\n                string internalUrlPrefix = urlToConvert.UrlPrefix;\r\n\r\n                string internalUrl = urlMatch.Value;\r\n                string publicUrl;\r\n\r\n                if (!convertionCache.TryGetValue(internalUrl, out publicUrl))\r\n                {\r\n                    string decodedInternalUrl = internalUrl.Replace(\"%28\", \"(\").Replace(\"%29\", \")\").Replace(\"&amp;\", \"&\");\r\n\r\n                    if (!decodedInternalUrl.StartsWith(internalUrlPrefix))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    var converter = urlToConvert.Converter;\r\n                    MeasureConvertionPerformance(measurements, converter, () =>\r\n                    {\r\n                        publicUrl = urlToConvert.Converter.ToPublicUrl(decodedInternalUrl, urlSpace);\r\n                    });\r\n\r\n                    if (publicUrl == null)\r\n                    {\r\n                        convertionCache.Add(internalUrl, null);\r\n                        continue;\r\n                    }\r\n\r\n                    // Encoding xml attribute value\r\n                    publicUrl = publicUrl.Replace(\"&\", \"&amp;\");\r\n\r\n                    convertionCache.Add(internalUrl, publicUrl);\r\n                }\r\n                else\r\n                {\r\n                    if (internalUrl == null) continue;\r\n                }\r\n\r\n                if (result == null)\r\n                {\r\n                    result = new StringBuilder(html);\r\n                }\r\n\r\n                result.Remove(urlMatch.Index, urlMatch.Value.Length);\r\n                result.Insert(urlMatch.Index, publicUrl);\r\n\r\n                lastReplacementIndex = urlMatch.Index;\r\n            }\r\n\r\n            foreach (var measurement in measurements.Values)\r\n            {\r\n                Profiler.AddSubMeasurement(measurement);\r\n            }\r\n\r\n            return result != null ? result.ToString() : html;\r\n        }\r\n\r\n        private static void MeasureConvertionPerformance(Dictionary<string, Measurement> measurements, IInternalUrlConverter converter, Action action)\r\n        {\r\n            string key = converter.GetType().FullName;\r\n\r\n            var stopwatch = new Stopwatch();\r\n\r\n            long memoryBefore = GC.GetTotalMemory(false);\r\n\r\n            stopwatch.Start();\r\n            action();\r\n            stopwatch.Stop();\r\n\r\n            long memoryTotal = GC.GetTotalMemory(false) - memoryBefore;\r\n            long totalTime = (stopwatch.ElapsedTicks*1000000)/Stopwatch.Frequency;\r\n\r\n            if (memoryTotal < 0)\r\n            {\r\n                memoryTotal = 0;\r\n            }\r\n\r\n            Measurement existingRecord;\r\n            if (measurements.TryGetValue(key, out existingRecord))\r\n            {\r\n                existingRecord.MemoryUsage += memoryTotal;\r\n                existingRecord.TotalTime += totalTime; // NOTE: Loosing some of the precision here\r\n            }\r\n            else\r\n            {\r\n                measurements.Add(key, new Measurement(key) { MemoryUsage = memoryTotal, TotalTime = totalTime });\r\n            }\r\n        }\r\n\r\n        private class UrlToConvert : Tuple<UrlUtils.UrlMatch, string, IInternalUrlConverter>\r\n        {\r\n            public UrlToConvert(UrlUtils.UrlMatch match, string urlPrefix, IInternalUrlConverter converter)\r\n                : base(match, urlPrefix, converter)\r\n            {\r\n            }\r\n\r\n            public UrlUtils.UrlMatch Match { get { return Item1; } }\r\n            public string UrlPrefix { get { return Item2; } }\r\n            public IInternalUrlConverter Converter { get { return Item3; } }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/MediaUrlData.cs",
    "content": "﻿using System;\r\nusing System.Collections.Specialized;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary> \r\n    /// Information stored in a media url\r\n    /// </summary>\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class MediaUrlData\r\n    {\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"MediaUrlData\"/> class.\r\n        /// </summary>\r\n        public MediaUrlData() {}\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"MediaUrlData\" /> class.\r\n        /// </summary>\r\n        /// <param name=\"mediaStore\">The media store.</param>\r\n        /// <param name=\"mediaId\">The media id.</param>\r\n        /// <param name=\"queryParameters\">The query parameters.</param>\r\n        public MediaUrlData(string mediaStore, Guid mediaId, NameValueCollection queryParameters = null)\r\n        {\r\n            MediaStore = mediaStore;\r\n            MediaId = mediaId;\r\n            QueryParameters = queryParameters ?? new NameValueCollection();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"MediaUrlData\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"mediaFile\">The media file.</param>\r\n        public MediaUrlData(IMediaFile mediaFile)\r\n        {\r\n            MediaStore = mediaFile.StoreId;\r\n            MediaId = mediaFile.Id;\r\n            QueryParameters = new NameValueCollection();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the media id.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The media id.\r\n        /// </value>\r\n        public Guid MediaId { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the media store.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The media store.\r\n        /// </value>\r\n        public string MediaStore { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the query parameters.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The query parameters.\r\n        /// </value>\r\n        public NameValueCollection QueryParameters { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/MediaUrls.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Specialized;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Media;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Routing.MediaUrlProviders;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>    \r\n    /// Responsible for parsing and building media urls\r\n    /// </summary>\r\n    public static class MediaUrls\r\n    {\r\n        internal static readonly string DefaultMediaStore = \"MediaArchive\";\r\n        private static readonly string MediaUrl_UnprocessedInternalPrefix = \"~/media(\";\r\n        private static readonly string MediaUrl_InternalPrefix = UrlUtils.PublicRootPath + \"/media(\";\r\n        internal static readonly string MediaUrl_PublicPrefix = UrlUtils.PublicRootPath + \"/media/\";\r\n\r\n        private static readonly string MediaUrl_UnprocessedRenderPrefix = \"~/Renderers/ShowMedia.ashx\";\r\n        private static readonly string MediaUrl_RenderPrefix = UrlUtils.PublicRootPath + \"/Renderers/ShowMedia.ashx\";\r\n\r\n        private static Lazy<IResizableImageUrlProvider> _defaultMediaUrlProvider = new Lazy<IResizableImageUrlProvider>(() => new DefaultMediaUrlProvider(null));\r\n\r\n        private static ConcurrentDictionary<string, IMediaUrlProvider> _mediaUrlProviders = new ConcurrentDictionary<string, IMediaUrlProvider>();\r\n\r\n        /// <summary>\r\n        /// Parses the URL.\r\n        /// </summary>\r\n        /// <param name=\"relativeUrl\">The relative URL.</param>\r\n        /// <returns></returns>\r\n        public static MediaUrlData ParseUrl(string relativeUrl)\r\n        {\r\n            UrlKind urlKind;\r\n            return ParseUrl(relativeUrl, out urlKind);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Parses the URL.\r\n        /// </summary>\r\n        /// <param name=\"relativeUrl\">The relative URL.</param>\r\n        /// <param name=\"urlKind\">Kind of the URL.</param>\r\n        /// <returns></returns>\r\n        public static MediaUrlData ParseUrl(string relativeUrl, out UrlKind urlKind)\r\n        {\r\n            relativeUrl = relativeUrl.Replace(\"%28\", \"(\").Replace(\"%29\", \")\");\r\n\r\n            if(relativeUrl.StartsWith(MediaUrl_RenderPrefix, StringComparison.OrdinalIgnoreCase)\r\n               || relativeUrl.StartsWith(MediaUrl_UnprocessedRenderPrefix, StringComparison.OrdinalIgnoreCase))\r\n            {\r\n                return ParseRenderUrl(relativeUrl, out urlKind);\r\n            }\r\n\r\n            urlKind = UrlKind.Undefined;\r\n\r\n            bool isInternalLink = relativeUrl.StartsWith(MediaUrl_InternalPrefix, StringComparison.Ordinal);\r\n            bool isInternalUnprocessedLink = !isInternalLink && relativeUrl.StartsWith(MediaUrl_UnprocessedInternalPrefix, StringComparison.Ordinal);\r\n\r\n            if (isInternalLink || isInternalUnprocessedLink)\r\n            {\r\n                string prefix = isInternalLink ? MediaUrl_InternalPrefix : MediaUrl_UnprocessedInternalPrefix;\r\n\r\n                var result = ParseInternalUrl(relativeUrl, prefix);\r\n                if(result != null)\r\n                {\r\n                    urlKind = UrlKind.Internal;\r\n                } \r\n\r\n                return result;\r\n            }\r\n\r\n            int minimumLengthOfPublicMediaUrl = MediaUrl_PublicPrefix.Length + 22; /* 2 - length of a compressed guid */\r\n            if (relativeUrl.Length >= minimumLengthOfPublicMediaUrl\r\n                && relativeUrl.StartsWith(MediaUrl_PublicPrefix))\r\n            {\r\n                // Parsing urls like /<site root>/media/{MediaId}*\r\n                Guid mediaId;\r\n\r\n                if (TryExtractMediaId(relativeUrl, MediaUrl_PublicPrefix.Length, out mediaId))\r\n                {\r\n                    NameValueCollection queryParams = new UrlBuilder(relativeUrl).GetQueryParameters();\r\n\r\n                    urlKind = UrlKind.Public;\r\n                    return new MediaUrlData\r\n                    {\r\n                        MediaId = mediaId,\r\n                        MediaStore = DefaultMediaStore,\r\n                        QueryParameters = queryParams\r\n                    };\r\n                }\r\n\r\n                // Parsing urls like /<site root>/media/<MediaArchive>/{MediaId}*\r\n                int slashOffset = relativeUrl.IndexOf('/', MediaUrl_PublicPrefix.Length + 1);\r\n\r\n                if (slashOffset > MediaUrl_PublicPrefix.Length + 1 \r\n                    && TryExtractMediaId(relativeUrl, slashOffset + 1, out mediaId))\r\n                {\r\n                    string mediaStore = relativeUrl.Substring(MediaUrl_PublicPrefix.Length, slashOffset - MediaUrl_PublicPrefix.Length);\r\n\r\n                    NameValueCollection queryParams = new UrlBuilder(relativeUrl).GetQueryParameters();\r\n\r\n                    urlKind = UrlKind.Public;\r\n                    return new MediaUrlData\r\n                    {\r\n                        MediaId = mediaId,\r\n                        MediaStore = mediaStore,\r\n                        QueryParameters = queryParams\r\n                    };\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private static bool TryExtractMediaId(string url, int offset, out Guid mediaId)\r\n        {\r\n            // Extracting a guid, which is kept in plain or compressed as base64 like form\r\n            if((url.Length >= offset + 36 && Guid.TryParse(url.Substring(offset, 36), out mediaId))\r\n                /*|| (url.Length >= offset + 22 && UrlUtils.TryExpandGuid(url.Substring(offset, 22), out mediaId))*/)\r\n            {\r\n                return true;\r\n            }\r\n\r\n            mediaId = Guid.Empty;\r\n            return false;\r\n        }\r\n\r\n        private static MediaUrlData ParseRenderUrl(string relativeUrl, out UrlKind urlKind)\r\n        {\r\n            try\r\n            {\r\n                var queryParameters = new UrlBuilder(relativeUrl).GetQueryParameters();\r\n                IMediaFile mediaFile = MediaUrlHelper.GetFileFromQueryString(queryParameters);\r\n                Verify.IsNotNull(mediaFile, \"failed to get file from a query string\");\r\n\r\n                urlKind = UrlKind.Renderer;\r\n\r\n                queryParameters.Remove(\"id\");\r\n                queryParameters.Remove(\"i\");\r\n                queryParameters.Remove(\"src\");\r\n                queryParameters.Remove(\"store\");\r\n\r\n                return new MediaUrlData { MediaId = mediaFile.Id, MediaStore = mediaFile.StoreId, QueryParameters = queryParameters };\r\n            }\r\n            catch(Exception)\r\n            {\r\n                urlKind = UrlKind.Undefined;\r\n                return null;\r\n            }\r\n        }\r\n\r\n        private static MediaUrlData ParseInternalUrl(string relativeUrl, string urlPrefix)\r\n        {\r\n            int endBracketOffset = relativeUrl.IndexOf(\")\", StringComparison.Ordinal);\r\n            if (endBracketOffset < 0) return null;\r\n\r\n            string mediaStoreAndId = relativeUrl.Substring(urlPrefix.Length, endBracketOffset - urlPrefix.Length);\r\n\r\n            string store = null;\r\n            string mediaIdStr;\r\n\r\n            int separatorIndex = mediaStoreAndId.LastIndexOf(\":\", StringComparison.Ordinal);\r\n            if (separatorIndex > 0)\r\n            {\r\n                store = mediaStoreAndId.Substring(0, separatorIndex);\r\n                mediaIdStr = mediaStoreAndId.Substring(separatorIndex + 1);\r\n            }\r\n            else\r\n            {\r\n                mediaIdStr = mediaStoreAndId;\r\n            }\r\n\r\n            Guid mediaId;\r\n            if (!Guid.TryParse(mediaIdStr, out mediaId))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            NameValueCollection queryParams = new UrlBuilder(relativeUrl).GetQueryParameters();\r\n\r\n            return new MediaUrlData\r\n                       {\r\n                           MediaId = mediaId,\r\n                           MediaStore = store ?? DefaultMediaStore,\r\n                           QueryParameters = queryParams\r\n                       };\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds the URL.\r\n        /// </summary>\r\n        /// <param name=\"mediaFile\">The media file.</param>\r\n        /// <param name=\"urlKind\">Kind of the URL.</param>\r\n        /// <returns></returns>\r\n        public static string BuildUrl(IMediaFile mediaFile, UrlKind urlKind = UrlKind.Public)\r\n        {\r\n            return BuildUrl(new MediaUrlData(mediaFile), urlKind);\r\n        }\r\n        \r\n        /// <summary>\r\n        /// Builds the URL.\r\n        /// </summary>\r\n        /// <param name=\"mediaUrlData\">The media URL data.</param>\r\n        /// <param name=\"urlKind\">Kind of the URL.</param>\r\n        /// <returns></returns>\r\n        public static string BuildUrl(MediaUrlData mediaUrlData, UrlKind urlKind)\r\n        {\r\n            Verify.ArgumentNotNull(mediaUrlData, \"mediaUrlData\");\r\n\r\n            switch (urlKind)\r\n            {\r\n                case UrlKind.Internal:\r\n                    return BuildInternalUrl(mediaUrlData);\r\n                case UrlKind.Renderer:\r\n                    return BuildRendererUrl(mediaUrlData);\r\n                case UrlKind.Public:\r\n                    return BuildPublicUrl(mediaUrlData);\r\n            }\r\n\r\n            throw new NotSupportedException(\"Not supported url kind. urlKind == '{0}'\".FormatWith(urlKind));\r\n        }\r\n\r\n        private static string BuildInternalUrl(MediaUrlData mediaUrlData)\r\n        {\r\n            string storeId = mediaUrlData.MediaStore == DefaultMediaStore \r\n                             ? \"\" \r\n                             : mediaUrlData.MediaStore + \":\";\r\n\r\n            var urlBuilder = new UrlBuilder(\"~/media(\" + storeId + mediaUrlData.MediaId + \")\");\r\n\r\n            if (mediaUrlData.QueryParameters != null)\r\n            {\r\n                urlBuilder.AddQueryParameters(mediaUrlData.QueryParameters);\r\n            }\r\n\r\n            return urlBuilder.ToString();\r\n        }\r\n\r\n        private static string BuildRendererUrl(MediaUrlData mediaUrlData)\r\n        {\r\n            var queryParams = new NameValueCollection(mediaUrlData.QueryParameters)\r\n            {\r\n                {\"id\", mediaUrlData.MediaId.ToString()}\r\n            };\r\n\r\n            if (mediaUrlData.MediaStore != null \r\n                && mediaUrlData.MediaStore != DefaultMediaStore)\r\n            {\r\n                queryParams.Add(\"store\", mediaUrlData.MediaStore);\r\n            }\r\n\r\n            var url = new UrlBuilder(UrlUtils.PublicRootPath + \"/Renderers/ShowMedia.ashx\");\r\n            url.AddQueryParameters(queryParams);\r\n\r\n            return url;\r\n        }\r\n\r\n        private static string BuildPublicUrl(MediaUrlData mediaUrlData)\r\n        {\r\n            IMediaUrlProvider urlProvider;\r\n            if (!_mediaUrlProviders.TryGetValue(mediaUrlData.MediaStore, out urlProvider))\r\n            {\r\n                urlProvider = _defaultMediaUrlProvider.Value;\r\n            }\r\n\r\n            if (mediaUrlData.QueryParameters.Count > 0)\r\n            {\r\n                string mediaUrl;\r\n                var resizingOptions = ResizingOptions.Parse(mediaUrlData.QueryParameters);\r\n                var noneResizingOptions = mediaUrlData.QueryParameters;\r\n\r\n                if (!resizingOptions.IsEmpty)\r\n                {\r\n                    var imageResizableUrlProvider = urlProvider is IResizableImageUrlProvider\r\n                        ? urlProvider as IResizableImageUrlProvider\r\n                        : _defaultMediaUrlProvider.Value;\r\n\r\n                    mediaUrl = imageResizableUrlProvider.GetResizedImageUrl(mediaUrlData.MediaStore, mediaUrlData.MediaId, resizingOptions);\r\n\r\n                    foreach (var key in HttpUtility.ParseQueryString(resizingOptions.ToString()).AllKeys)\r\n                    {\r\n                        noneResizingOptions.Remove(key);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    mediaUrl = urlProvider.GetPublicMediaUrl(mediaUrlData.MediaStore, mediaUrlData.MediaId);\r\n                }\r\n\r\n                if (noneResizingOptions.Count > 0)\r\n                {\r\n                    var urlBuilder = new UrlBuilder(mediaUrl);\r\n\r\n                    urlBuilder.AddQueryParameters(noneResizingOptions);\r\n\r\n                    return urlBuilder.ToString();\r\n                }\r\n\r\n                return mediaUrl;\r\n            }\r\n\r\n            return urlProvider.GetPublicMediaUrl(mediaUrlData.MediaStore, mediaUrlData.MediaId);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers a media url provider\r\n        /// </summary>\r\n        /// <param name=\"storeId\">The store id.</param>\r\n        /// <param name=\"mediaUrlProvider\">The media url provider.</param>\r\n        public static void RegisterMediaUrlProvider(string storeId, IMediaUrlProvider mediaUrlProvider)\r\n        {\r\n            _mediaUrlProviders[storeId] = mediaUrlProvider;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/PageNotFoundRoute.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing System.Web.Routing;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    internal class PageNotFoundRoute : Route\r\n    {\r\n        public PageNotFoundRoute()\r\n            : base(\"{*url}\", new PageNotFoundRouteHandler())\r\n        {\r\n        }\r\n\r\n        public override RouteData GetRouteData(HttpContextBase httpContext)\r\n        {\r\n            // Skipping the route is there's no associated \"Page not found\" url\r\n            if(string.IsNullOrEmpty(HostnameBindingsFacade.GetCustomPageNotFoundUrl()))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            // Skipping root request\r\n            if(httpContext.Request.RawUrl.Length == UrlUtils.PublicRootPath.Length + 1)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return base.GetRouteData(httpContext);\r\n        }\r\n    }\r\n\r\n    internal class PageNotFoundRouteHandler: IRouteHandler\r\n    {\r\n        public IHttpHandler GetHttpHandler(RequestContext requestContext)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if (!HostnameBindingsFacade.ServeCustomPageNotFoundPage(httpContext))\r\n            {\r\n                throw new InvalidOperationException(\"Failed to redirect to 'page not found' url\");\r\n            }\r\n\r\n            return EmptyHttpHandler.Instance;\r\n        }\r\n\r\n        private class EmptyHttpHandler : IHttpHandler\r\n        {\r\n            private EmptyHttpHandler()\r\n            {\r\n            }\r\n\r\n            static EmptyHttpHandler()\r\n            {\r\n                Instance = new EmptyHttpHandler();\r\n            }\r\n\r\n            public static EmptyHttpHandler Instance { get; private set; }\r\n            \r\n\r\n            public bool IsReusable\r\n            {\r\n                get { return true; }\r\n            }\r\n\r\n            public void ProcessRequest(HttpContext context)\r\n            {\r\n                throw new InvalidOperationException(\"This code should not be reachable\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/PageUrlData.cs",
    "content": "﻿using System;\r\nusing System.Collections.Specialized;\r\nusing System.Globalization;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>\r\n    /// Information stored in a C1 CMS page url\r\n    /// </summary>\r\n    public class PageUrlData\r\n    {\r\n        /// <exclude />\r\n        public PageUrlData()\r\n        {\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"PageUrlData\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        public PageUrlData(IPage page)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n\r\n            PageId = page.Id;\r\n            VersionId = page.VersionId;\r\n            this.PublicationScope = page.DataSourceId.PublicationScope;\r\n            this.LocalizationScope = page.DataSourceId.LocaleScope;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"PageUrlData\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"publicationScope\">The publication scope.</param>\r\n        /// <param name=\"localizationScope\">The localization scope.</param>\r\n        public PageUrlData(Guid pageId, PublicationScope publicationScope, CultureInfo localizationScope)\r\n        {\r\n            PageId = pageId;\r\n            PublicationScope = publicationScope;\r\n            LocalizationScope = localizationScope;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the page id.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The page id.\r\n        /// </value>\r\n        public Guid PageId { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the page version id.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The page id.\r\n        /// </value>\r\n        public Guid? VersionId { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the publication scope.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The publication scope.\r\n        /// </value>\r\n        public PublicationScope PublicationScope { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the localization scope.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The localization scope.\r\n        /// </value>\r\n        public CultureInfo LocalizationScope { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the path info.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The path info.\r\n        /// </value>\r\n        public virtual string PathInfo { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the query parameters.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The query parameters.\r\n        /// </value>\r\n        public virtual NameValueCollection QueryParameters { get; set; }\r\n\r\n\r\n        internal bool HasQueryParameters\r\n        {\r\n            get { return QueryParameters != null && QueryParameters.HasKeys(); }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/PageUrls.cs",
    "content": "﻿using System.Web;\r\nusing Composite.Core.Routing.Foundation.PluginFacades;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary> \r\n    /// Responsible for parsing and building page urls\r\n    /// </summary>\r\n    public static class PageUrls\r\n    {\r\n        private static IPageUrlProvider GetDefaultProvider()\r\n        {\r\n            return PageUrlProviderPluginFacade.GetDefaultProvider();\r\n        }\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public static IPageUrlProvider UrlProvider\r\n        {\r\n            get { return GetDefaultProvider(); }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parses the URL.\r\n        /// </summary>\r\n        /// <param name=\"absoluteUrl\">The absolute URL.</param>\r\n        /// <returns></returns>\r\n        public static PageUrlData ParseUrl(string absoluteUrl)\r\n        {\r\n            UrlKind urlKind;\r\n            return ParseUrl(absoluteUrl, out urlKind);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parses the URL.\r\n        /// </summary>\r\n        /// <param name=\"absoluteUrl\">The absolute URL.</param>\r\n        /// <param name=\"urlKind\">Kind of the URL.</param>\r\n        /// <returns></returns>\r\n        public static PageUrlData ParseUrl(string absoluteUrl, out UrlKind urlKind)\r\n        {\r\n            if (absoluteUrl.StartsWith(\"http\") && absoluteUrl.Contains(\"://\"))\r\n            {\r\n                return UrlProvider.ParseUrl(absoluteUrl, out urlKind);\r\n            }\r\n\r\n            var context = HttpContext.Current;\r\n            string hostname = context != null ? context.Request.Url.Host : null;\r\n            var urlSpace = new UrlSpace(hostname, absoluteUrl);\r\n\r\n            return UrlProvider.ParseUrl(absoluteUrl, urlSpace, out urlKind);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parses the URL.\r\n        /// </summary>\r\n        /// <param name=\"relativeUrl\">The relative URL.</param>\r\n        /// <param name=\"urlSpace\">The URL space.</param>\r\n        /// <param name=\"urlKind\">Kind of the URL.</param>\r\n        /// <returns></returns>\r\n        public static PageUrlData ParseUrl(string relativeUrl, UrlSpace urlSpace, out UrlKind urlKind) \r\n        {\r\n            Verify.ArgumentNotNull(relativeUrl, \"relativeUrl\");\r\n\r\n            return UrlProvider.ParseUrl(relativeUrl, urlSpace, out urlKind);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds the URL.\r\n        /// </summary>\r\n        /// <param name=\"pageUrlData\">The page URL data.</param>\r\n        /// <param name=\"urlKind\">Kind of the URL.</param>\r\n        /// <param name=\"urlSpace\">The URL space.</param>\r\n        /// <returns></returns>\r\n        public static string BuildUrl(PageUrlData pageUrlData, UrlKind urlKind = UrlKind.Public, UrlSpace urlSpace = null) \r\n        {\r\n            Verify.ArgumentNotNull(pageUrlData, \"pageUrlData\");\r\n\r\n            return UrlProvider.BuildUrl(pageUrlData, urlKind, urlSpace ?? new UrlSpace());\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds the URL.\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        /// <param name=\"urlKind\">Kind of the URL.</param>\r\n        /// <param name=\"urlSpace\">The URL space.</param>\r\n        /// <returns></returns>\r\n        public static string BuildUrl(IPage page, UrlKind urlKind = UrlKind.Public, UrlSpace urlSpace = null)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n\r\n            return BuildUrl(new PageUrlData(page), urlKind, urlSpace ?? new UrlSpace());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Pages/C1PageRoute.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.Web;\r\nusing System.Web.Routing;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.Renderings;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Search.DocumentSources;\r\n\r\nnamespace Composite.Core.Routing.Pages\r\n{\r\n    /// <summary>\r\n    /// Implements C1 page route for ASP.NET routing\r\n    /// </summary>\r\n    public class C1PageRoute : RouteBase\r\n    {\r\n        /// <exclude />\r\n        public static readonly string RouteData_PageUrl = \"C1Page\";\r\n\r\n        internal static readonly string HttpContextItem_C1PageUrl = \"C1_PageUrl\";\r\n        private static readonly string HttpContextItem_PathInfoHandled = \"C1PageRoute_PathInfoHandled\";\r\n\r\n        /// <exclude />\r\n        public static PageUrlData PageUrlData\r\n        {\r\n            get\r\n            {\r\n                var httpContext = HttpContext.Current;\r\n                return httpContext != null ? httpContext.Items[HttpContextItem_C1PageUrl] as PageUrlData : null;\r\n            }\r\n            set\r\n            {\r\n                var httpContext = HttpContext.Current;\r\n                Verify.IsNotNull(httpContext, \"HttpContext is not available\");\r\n\r\n                httpContext.Items[HttpContextItem_C1PageUrl] = value;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Get the additional information that was passed in URL along with page url\r\n        /// </summary>\r\n        /// <returns>The PathInfo url part.</returns>\r\n        public static string GetPathInfo()\r\n        {\r\n            return PageUrlData?.PathInfo;\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method has to be called to notify the system that PathInfo was used, and the request will not be redirected to \"Page not found\" page\r\n        /// </summary>\r\n        public static void RegisterPathInfoUsage()\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if(!httpContext.Items.Contains(HttpContextItem_PathInfoHandled))\r\n            {\r\n                httpContext.Items.Add(HttpContextItem_PathInfoHandled, true);\r\n            }\r\n        }\r\n\r\n        /// <exclude/>\r\n        [Obsolete(\"User PathInfoUsed property instead\")]\r\n        public static bool PathInfoHasBeenUsed()\r\n        {\r\n            return PathInfoUsed;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a value indicating whether path info part of C1 page url has been used.\r\n        /// </summary>\r\n        /// <value>\r\n        ///   <c>true</c> if path info has been used; otherwise, <c>false</c>.\r\n        /// </value>\r\n        public static bool PathInfoUsed\r\n        {\r\n            get\r\n            {\r\n                var httpContext = HttpContext.Current;\r\n\r\n                return httpContext != null && httpContext.Items.Contains(HttpContextItem_PathInfoHandled);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override RouteData GetRouteData(HttpContextBase context)\r\n        {\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string localPath = context.Request.Url.LocalPath;\r\n\r\n            if (IsPagePreviewPath(localPath) &&\r\n                PagePreviewContext.TryGetPreviewKey(context.Request, out Guid previewKey))\r\n            {\r\n                var page = PagePreviewContext.GetPage(previewKey);\r\n                if (page == null) throw new InvalidOperationException(\"Not preview information found by key: \" + previewKey);\r\n\r\n                return new RouteData(this, new C1PageRouteHandler(new PageUrlData(page)));\r\n            }\r\n\r\n            if (UrlUtils.IsAdminConsoleRequest(localPath) || IsRenderersPath(localPath))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var urlProvider = PageUrls.UrlProvider;\r\n\r\n            string currentUrl = context.Request.Url.OriginalString;\r\n\r\n            UrlKind urlKind;\r\n\r\n            PageUrlData pageUrlData = urlProvider.ParseUrl(currentUrl, out urlKind);\r\n            if (pageUrlData == null || urlKind == UrlKind.Renderer)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var urlSpace = new UrlSpace(context);\r\n\r\n            // Redirecting friendly urls to public urls\r\n            if (urlKind == UrlKind.Friendly || urlKind == UrlKind.Redirect || urlKind == UrlKind.Internal)\r\n            {\r\n                if(pageUrlData.PathInfo == \"/\")\r\n                {\r\n                    pageUrlData.PathInfo = null;\r\n                }\r\n\r\n                string publicUrl = urlProvider.BuildUrl(pageUrlData, UrlKind.Public, urlSpace);\r\n                if(publicUrl == null)\r\n                {\r\n                    if (urlKind != UrlKind.Internal)\r\n                    {\r\n                        return null;\r\n                    }\r\n                    // Rendering internal url if public url is missing\r\n                }\r\n                else\r\n                {\r\n                    return GetRedirectRoute(publicUrl);\r\n                }\r\n            }\r\n\r\n            Verify.That(urlKind == UrlKind.Public || urlKind == UrlKind.Internal, \"Unexpected url kind '{0}\", urlKind);\r\n\r\n            bool isPublicUrl = urlKind == UrlKind.Public;\r\n\r\n\r\n            if (isPublicUrl)\r\n            {\r\n                // If url ends with a trailing slash - doing a redirect. F.e. http://localhost/a/ -> http://localhost/a\r\n                if (pageUrlData.PathInfo == \"/\")\r\n                {\r\n                    pageUrlData.PathInfo = null;\r\n                    return GetRedirectRoute(urlProvider.BuildUrl(pageUrlData, UrlKind.Public, urlSpace));\r\n                }\r\n\r\n                // Checking casing in url, so the same page will not appear as a few pages by a crawler\r\n                string correctUrl = urlProvider.BuildUrl(pageUrlData, UrlKind.Public, urlSpace);\r\n                Verify.IsNotNull(correctUrl, \"Failed to rebuild a public url from url '{0}'\", currentUrl);\r\n\r\n                string originalFilePath = new UrlBuilder(currentUrl).RelativeFilePath;\r\n                string correctFilePath = new UrlBuilder(correctUrl).RelativeFilePath;\r\n\r\n                string decodedOriginalPath = HttpUtility.UrlDecode(originalFilePath);\r\n                string decodedCorrectFilePath = HttpUtility.UrlDecode(correctFilePath);\r\n\r\n                if (!urlSpace.ForceRelativeUrls \r\n                    && (originalFilePath.Length != correctFilePath.Length\r\n                        && decodedOriginalPath != correctFilePath\r\n                        && decodedOriginalPath != decodedCorrectFilePath)\r\n                    || (string.Compare(originalFilePath, correctFilePath, false, CultureInfo.InvariantCulture) != 0 \r\n                        && string.Compare(originalFilePath, correctFilePath, true, CultureInfo.InvariantCulture) == 0)\r\n                        && decodedOriginalPath != decodedCorrectFilePath)\r\n                {\r\n                    // redirect to a url with right casing\r\n                    return GetRedirectRoute(correctUrl);\r\n                }\r\n            }\r\n\r\n            // GetRouteData may be executed multiple times\r\n            if (!context.Items.Contains(HttpContextItem_C1PageUrl))\r\n            {\r\n                PageUrlData = pageUrlData;\r\n            }\r\n\r\n            var data = new RouteData(this, new C1PageRouteHandler(pageUrlData));\r\n            data.Values.Add(RouteData_PageUrl, pageUrlData);\r\n\r\n            return data;\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n        }\r\n\r\n        private static bool IsRenderersPath(string relativeUrl)\r\n        {\r\n            return relativeUrl.StartsWith(UrlUtils.RenderersRootPath + \"/\", true);\r\n        }\r\n\r\n        private static bool IsPagePreviewPath(string relativeUrl)\r\n        {\r\n            return relativeUrl.StartsWith($\"{UrlUtils.RenderersRootPath}/PagePreview\", true);\r\n        }\r\n\r\n        private RouteData GetRedirectRoute(string url)\r\n        {\r\n            return new RouteData(this, new SeoFriendlyRedirectRouteHandler(url));\r\n        }\r\n\r\n        /// <exclude />\r\n        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Pages/C1PageRouteHander.cs",
    "content": "using System;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.Collections.Concurrent;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Compilation;\r\nusing System.Web.Configuration;\r\nusing System.Web.Hosting;\r\nusing System.Web.Routing;\r\nusing System.Web.UI;\r\nusing System.Xml.Linq;\r\nusing Composite.AspNet;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.PageTemplates;\r\n\r\n\r\nnamespace Composite.Core.Routing.Pages\r\n{\r\n    /// <summary>\r\n    /// A route handler for the \"C1 page\" route.\r\n    /// </summary>\r\n    public class C1PageRouteHandler : IRouteHandler\r\n    {\r\n        private const string PageHandlerPath = \"Renderers/Page.aspx\";\r\n        private const string PageHandlerVirtualPath = \"~/\" + PageHandlerPath;\r\n\r\n        private readonly PageUrlData _pageUrlData;\r\n\r\n        private static readonly Type _handlerType;\r\n\r\n\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\")]\r\n        static C1PageRouteHandler()\r\n        {\r\n            bool isIntegratedPipeline = HttpRuntime.UsingIntegratedPipeline;\r\n            string sectionName = isIntegratedPipeline ? \"system.webServer\" : \"system.web\";\r\n\r\n            var config = WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath).GetSection(sectionName);\r\n            if (config != null)\r\n            {\r\n                string handlersSectionName = isIntegratedPipeline ? \"handlers\" : \"httpHandlers\";\r\n\r\n                var handlers = XElement.Parse(config.SectionInformation.GetRawXml()).Element(handlersSectionName);\r\n                if(handlers == null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                var handler = handlers\r\n                    .Elements(\"add\")\r\n                    .Where(e => e.Attribute(\"path\")?.Value.Equals(PageHandlerPath, StringComparison.OrdinalIgnoreCase) ?? false)\r\n                    .SingleOrDefaultOrException($\"Multiple handlers for '{PageHandlerPath}' were found'\");\r\n\r\n                if (handler != null)\r\n                {\r\n                    var typeAttr = handler.Attribute(\"type\");\r\n                    Verify.IsNotNull(typeAttr, \"'type' attribute is missing\");\r\n\r\n                    _handlerType = Type.GetType(typeAttr.Value);\r\n                    if(_handlerType == null)\r\n                    {\r\n                        Log.LogError(nameof(C1PageRouteHandler), $\"Failed to load type '{typeAttr.Value}'\");\r\n                    }\r\n                }\r\n            }\r\n\r\n        }\r\n\r\n        /// <summary>\r\n        /// Creates a new instance of <see cref=\"C1PageRouteHandler\"/>.\r\n        /// </summary>\r\n        /// <param name=\"pageUrlData\"></param>\r\n        public C1PageRouteHandler(PageUrlData pageUrlData)\r\n        {\r\n            _pageUrlData = pageUrlData;\r\n        }\r\n\r\n\r\n        /// <inheritdoc/>\r\n        public IHttpHandler GetHttpHandler(RequestContext requestContext)\r\n        {\r\n            var context = requestContext.HttpContext;\r\n\r\n            string localPath = context.Request.Url.LocalPath;\r\n            string pathInfo = _pageUrlData.PathInfo;\r\n\r\n            // Doing a url rewriting so ASP.NET will get correct FilePath/PathInfo properties\r\n            if (!pathInfo.IsNullOrEmpty())\r\n            {\r\n                string filePath = localPath.Substring(0, localPath.Length - pathInfo.Length);\r\n\r\n                string queryString = context.Request.Url.Query;\r\n                if (queryString.StartsWith(\"?\"))\r\n                {\r\n                    queryString = queryString.Substring(1);\r\n                }\r\n                context.RewritePath(filePath, pathInfo, queryString);\r\n            }\r\n\r\n            if (_handlerType == null && GlobalSettingsFacade.OmitAspNetWebFormsSupport)\r\n            {\r\n                var page = _pageUrlData.GetPage()\r\n                    ?? throw new HttpException(404, \"Page not found - either this page has not been published yet or it has been deleted.\");\r\n\r\n                if (IsSlimPageRenderer(page.TemplateId))\r\n                {\r\n                    return new CmsPageHttpHandler();\r\n                }\r\n            }\r\n\r\n            // Disabling ASP.NET cache if there's a logged-in user\r\n            if (Composite.C1Console.Security.UserValidationFacade.IsLoggedIn())\r\n            {\r\n                context.Response.Cache.SetCacheability(HttpCacheability.NoCache);\r\n            }\r\n\r\n            if (_handlerType != null)\r\n            {\r\n                return (IHttpHandler)Activator.CreateInstance(_handlerType);\r\n            }\r\n\r\n            return (IHttpHandler)BuildManager.CreateInstanceFromVirtualPath(PageHandlerVirtualPath, typeof(Page));\r\n        }\r\n\r\n        private static readonly ConcurrentDictionary<Guid, bool> _pageRendererTypCache\r\n            = new ConcurrentDictionary<Guid, bool>();\r\n\r\n        private bool IsSlimPageRenderer(Guid pageTemplate)\r\n        {\r\n            return _pageRendererTypCache.GetOrAdd(pageTemplate, \r\n                templateId => PageTemplateFacade.BuildPageRenderer(templateId) is ISlimPageRenderer);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Pages/SeoFriendlyRedirectHttpHandler.cs",
    "content": "﻿using System.Web;\r\n\r\nnamespace Composite.Core.Routing.Pages\r\n{\r\n    internal class SeoFriendlyRedirectHttpHandler: IHttpHandler\r\n    {\r\n        private readonly string _redirectUrl;\r\n\r\n        public SeoFriendlyRedirectHttpHandler(string redirectUrl)\r\n        {\r\n            _redirectUrl = redirectUrl;\r\n        }\r\n\r\n        public bool IsReusable\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n        public void ProcessRequest(HttpContext context)\r\n        {\r\n            context.Response.AddHeader(\"Location\", _redirectUrl);\r\n            context.Response.StatusCode = 301; // Http 301 - \"Permanently moved\"\r\n            context.ApplicationInstance.CompleteRequest();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Pages/SeoFriendlyRedirectRouteHandler.cs",
    "content": "using System.Web;\r\nusing System.Web.Routing;\r\n\r\nnamespace Composite.Core.Routing.Pages\r\n{\r\n    /// <summary>\r\n    /// A route handler that performs an HTTP redirect with response code 301 (Permanently moved).\r\n    /// </summary>\r\n    public class SeoFriendlyRedirectRouteHandler: IRouteHandler\r\n    {\r\n        private readonly string _redirectUrl;\r\n\r\n        /// <summary>\r\n        /// Creates a new instance of <see cref=\"SeoFriendlyRedirectRouteHandler\"/>\r\n        /// </summary>\r\n        /// <param name=\"redirectUrl\">The URL to redirect to.</param>\r\n        public SeoFriendlyRedirectRouteHandler(string redirectUrl)\r\n        {\r\n            _redirectUrl = redirectUrl;\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public IHttpHandler GetHttpHandler(RequestContext requestContext)\r\n        {\r\n            return new SeoFriendlyRedirectHttpHandler(_redirectUrl);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/PageUrlsProviders/IPageUrlBuilder.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.Routing.Plugins.PageUrlsProviders\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Obsolete]\r\n    public interface IPageUrlBuilder\r\n    {\r\n        /// <summary>\r\n        /// Gets url information for a page\r\n        /// </summary>\r\n        /// <param name=\"page\">A page</param>\r\n        /// <param name=\"parentPageId\">Id of parent page, to be used for optimization purposes</param>\r\n        /// <returns></returns>\r\n        PageUrlSet BuildUrlSet(IPage page, Guid parentPageId);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/PageUrlsProviders/IPageUrlProvider.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders.Runtime;\r\nusing Composite.Data;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Core.Routing.Plugins.PageUrlsProviders\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [CustomFactory(typeof(PageUrlProviderCustomFactory))]\r\n    public interface IPageUrlProvider\r\n    {\r\n        /// <summary>\r\n        /// Creates a new instance of PageUrlBuilder which will be used while building a C1 pages sitemap\r\n        /// </summary>\r\n        /// <param name=\"publicationScope\">The publication scope.</param>\r\n        /// <param name=\"localizationScope\">The localization scope.</param>\r\n        /// <param name=\"urlSpace\">The URL space. Is used for providing different urls for f.e. different hostnames, etc.</param>\r\n        /// <returns></returns>\r\n        [Obsolete]\r\n        IPageUrlBuilder CreateUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace);\r\n\r\n        /// <exclude />\r\n        bool IsInternalUrl(string relativeUrl);\r\n\r\n        /// <exclude />\r\n        PageUrlData ParseInternalUrl(string relativeUrl);\r\n\r\n        /// <exclude />\r\n        PageUrlData ParseUrl(string relativeUrl, UrlSpace urlSpace, out UrlKind urlKind);\r\n\r\n        /// <exclude />\r\n        PageUrlData ParseUrl(string absoluteUrl, out UrlKind urlKind);\r\n\r\n        /// <exclude />\r\n        string BuildUrl(PageUrlData pageUrlData, UrlKind urlKind, UrlSpace urlSpace);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/PageUrlsProviders/PageUrlSet.cs",
    "content": "﻿namespace Composite.Core.Routing.Plugins.PageUrlsProviders\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PageUrlSet\r\n    {\r\n        /// <summary>\r\n        /// Url by which page will be accessable\r\n        /// </summary>\r\n        public string PublicUrl { get; set; }\r\n\r\n        /// <summary>\r\n        /// Friendly url, requesting this url will lead to a redirect to PublicUrl\r\n        /// </summary>\r\n        public string FriendlyUrl { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/PageUrlsProviders/Runtime/NonConfigurablePageUrlProvider.cs",
    "content": "﻿using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Routing.Plugins.PageUrlsProviders.Runtime\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Assembler(typeof(NonConfigurablePageUrlProviderAssembler))]\r\n    public sealed class NonConfigurablePageUrlProvider : PageUrlProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NonConfigurablePageUrlProviderAssembler : IAssembler<IPageUrlProvider, PageUrlProviderData>\r\n    {\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IPageUrlProvider Assemble(IBuilderContext context, PageUrlProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IPageUrlProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/PageUrlsProviders/Runtime/PageUrlProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing.Plugins.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Routing.Plugins.PageUrlsProviders.Runtime\r\n{\r\n    internal sealed class PageUrlProviderCustomFactory : AssemblerBasedCustomFactory<IPageUrlProvider, PageUrlProviderData>\r\n    {\r\n        protected override PageUrlProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            string section = UrlsConfiguration.SectionName;\r\n            var settings = configurationSource.GetSection(section) as UrlsConfiguration;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(\"The configuration section '{0}' was not found in the configuration\".FormatWith(section));\r\n            }\r\n\r\n            return settings.PageUrlProviders.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/PageUrlsProviders/Runtime/PageUrlProviderData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Core.Routing.Plugins.PageUrlsProviders.Runtime\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ConfigurationElementType(typeof(NonConfigurablePageUrlProvider))]\r\n    public class PageUrlProviderData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/PageUrlsProviders/Runtime/PageUrlProviderFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Core.Routing.Plugins.PageUrlsProviders.Runtime\r\n{\r\n    internal sealed class PageUrlProviderFactory : NameTypeFactoryBase<IPageUrlProvider>\r\n    {\r\n        public PageUrlProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Routing/Plugins/Runtime/UrlsConfiguration.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders.Runtime;\r\nusing Composite.Core.Routing.Plugins.UrlFormatters.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Routing.Plugins.Runtime\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class UrlsConfiguration : SerializableConfigurationSection\r\n    {\r\n        /// <exclude />\r\n        public const string SectionName = \"Composite.Core.Urls\";\r\n\r\n\r\n        private const string _defaultPageUrlProviderNameProperty = \"defaultPageUrlProviderName\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_defaultPageUrlProviderNameProperty, IsRequired = true)]\r\n        public string DefaultPageUrlProviderName\r\n        {\r\n            get { return (string)base[_defaultPageUrlProviderNameProperty]; }\r\n            set { base[_defaultPageUrlProviderNameProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _pageUrlProvidersProperty = \"PageUrlProviders\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_pageUrlProvidersProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<PageUrlProviderData> PageUrlProviders\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<PageUrlProviderData>)base[_pageUrlProvidersProperty];\r\n            }\r\n        }\r\n\r\n        private const string _urlFormattersProperty = \"UrlFormatters\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_urlFormattersProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<UrlFormatterData> UrlFormatters\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<UrlFormatterData>)base[_urlFormattersProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/UrlFormatters/IUrlFormatter.cs",
    "content": "﻿using Composite.Core.Routing.Plugins.UrlFormatters.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Core.Routing.Plugins.UrlFormatters\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [CustomFactory(typeof(UrlFormatterCustomFactory))]\r\n    public interface IUrlFormatter\r\n    {\r\n        /// <exclude />\r\n        string FormatUrl(string url);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/UrlFormatters/Runtime/NonConfigurableUrlFormatter.cs",
    "content": "﻿using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Routing.Plugins.UrlFormatters.Runtime\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Assembler(typeof(NonConfigurableUrlFormatterAssembler))]\r\n    public sealed class NonConfigurableUrlFormatter : UrlFormatterData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NonConfigurableUrlFormatterAssembler : IAssembler<IUrlFormatter, UrlFormatterData>\r\n    {\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IUrlFormatter Assemble(IBuilderContext context, UrlFormatterData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IUrlFormatter)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/UrlFormatters/Runtime/UrlFormatterCustomFactory.cs",
    "content": "using System.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing.Plugins.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Routing.Plugins.UrlFormatters.Runtime\r\n{\r\n    internal sealed class UrlFormatterCustomFactory : AssemblerBasedCustomFactory<IUrlFormatter, UrlFormatterData>\r\n    {\r\n        protected override UrlFormatterData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            string section = UrlsConfiguration.SectionName;\r\n            var settings = configurationSource.GetSection(section) as UrlsConfiguration;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(\"The configuration section '{0}' was not found in the configuration\".FormatWith(section));\r\n            }\r\n\r\n            return settings.UrlFormatters.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/UrlFormatters/Runtime/UrlFormatterData.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Core.Routing.Plugins.UrlFormatters.Runtime\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ConfigurationElementType(typeof(NonConfigurableUrlFormatter))]\r\n    public class UrlFormatterData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n        private const string MandatoryPropertyName = \"mandatory\";\r\n\r\n        /// <exclude />\r\n        [ConfigurationProperty(MandatoryPropertyName, IsRequired = true)]\r\n        public bool Mandatory\r\n        {\r\n            get\r\n            {\r\n                return (bool)this[MandatoryPropertyName];\r\n            }\r\n            set\r\n            {\r\n                this[MandatoryPropertyName] = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/Plugins/UrlFormatters/Runtime/UrlFormatterFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Core.Routing.Plugins.UrlFormatters.Runtime\r\n{\r\n    internal sealed class UrlFormatterFactory : NameTypeFactoryBase<IUrlFormatter>\r\n    {\r\n        public UrlFormatterFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Routing/Routes.cs",
    "content": "﻿using System;\r\nusing System.Web.Routing;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>\r\n    /// Allows adding custom routes with a priority in relation to defined by CompositeC1 routes.\r\n    /// </summary>\r\n    public static class Routes\r\n    {\r\n        /// <exclude />\r\n        [Obsolete(\"Use RegisterPageRoute() and Register404Route() instead\", true)]\r\n        public static void Register()\r\n        {\r\n            var routes = RouteTable.Routes;\r\n\r\n            RegisterPageRoute(routes);\r\n            Register404Route(routes);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers C1's page route.\r\n        /// </summary>\r\n        public static void RegisterPageRoute(RouteCollection routes)\r\n        {\r\n            routes.Ignore(\"Composite/{*pathInfo}\");\r\n            routes.Ignore(\"{resource}.axd/{*pathInfo}\");\r\n\r\n            AddFunctionBoxRoute(routes);\r\n            AddSiteMapRoutes(routes);\r\n\r\n            if (OnBeforePageRouteAdded != null)\r\n            {\r\n                OnBeforePageRouteAdded(routes);\r\n            }\r\n\r\n            routes.Add(\"c1 page route\", new C1PageRoute());\r\n\r\n            if (OnAfterPageRouteAdded != null)\r\n            {\r\n                OnAfterPageRouteAdded(routes);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers C1's 404 route that catches all requests. \r\n        /// This method should be called only after all other routes are registered.\r\n        /// </summary>\r\n        public static void Register404Route(RouteCollection routes)\r\n        {\r\n            // Ignoring routes that shouldn't be caught by 404 handler\r\n            routes.Ignore(\"Renderers/{*pathInfo}\");\r\n            routes.Ignore(\"{*all_css_aspx}\", new { all_css_aspx = @\".*\\.css.aspx(/.*)?\" });\r\n\r\n            routes.Add(\"c1 404 route\", new PageNotFoundRoute());\r\n        }\r\n\r\n        private static void AddSiteMapRoutes(RouteCollection routes)\r\n        {\r\n            routes.Ignore(\"sitemap.xml\");\r\n            routes.Ignore(\"{language}/sitemap.xml\");\r\n            routes.Ignore(\"{language}/{urlTitle}/sitemap.xml\");\r\n        }\r\n\r\n        private static void AddFunctionBoxRoute(RouteCollection routes)\r\n        {\r\n            routes.Add(\"c1 function image\", new FunctionBoxRoute());\r\n            routes.Add(\"c1 template preview\", new TemplatePreviewRoute());\r\n        }\r\n\r\n        /// <summary>\r\n        /// Occurs before C1 page route is added.\r\n        /// </summary>\r\n        public static event RouteRegistration OnBeforePageRouteAdded;\r\n\r\n        /// <summary>\r\n        /// Occurs after C1 page route is added.\r\n        /// </summary>\r\n        public static event RouteRegistration OnAfterPageRouteAdded;\r\n\r\n        /// <summary>\r\n        /// Handles route registration\r\n        /// </summary>\r\n        /// <param name=\"routeCollection\">The route collection.</param>\r\n        public delegate void RouteRegistration(RouteCollection routeCollection);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/UrlKind.cs",
    "content": "﻿namespace Composite.Core.Routing\r\n{\r\n    /// <summary>\r\n    /// Url kind\r\n    /// </summary>\r\n    public enum UrlKind\r\n    {\r\n        /// <exclude />\r\n        Undefined = 0,\r\n        /// <summary>\r\n        /// A main, human friendly url by which a resource is accessed. F.e.:\r\n        /// Page: \"/Home/About\"\r\n        /// An image: \"/media/6fb4c70b-12a6-4522-add6-1f40828c5452/Sample images/Colors of Inspiration.jpg\"\r\n        /// </summary>\r\n        Public = 1,\r\n        /// <summary>\r\n        /// Url to an ASP.NET handler. F.e. link to a page: \"/Renderers/Page.aspx?id=7446ceda-df90-49f0-a183-4e02ed6f6eec\"\r\n        /// Renderer url is expected to be handled without routing.\r\n        /// </summary>\r\n        Renderer = 2,\r\n        /// <summary>\r\n        /// The way links are kept in html content\r\n        /// For pages \r\n        ///   Short: ~/page({Page id})\r\n        ///   Full:  ~/page({Page id})[ /c1mode(unpublished) ][ /{PathInfo} ][ ?{Query string} ]\r\n        /// For media archive\r\n        ///   Short: ~/media({Media file Id})\r\n        ///   Full:  ~/media([{Media store}:]{Media file Id})[ ?{Query string} ]\r\n        /// </summary>\r\n        Internal = 5,\r\n        /// <summary>\r\n        /// Friendly url. A short url, by accessing which C1 will make a redirect to related \"public\" url\r\n        /// </summary>\r\n        Friendly = 3,\r\n        /// <summary>\r\n        /// Redirect url. As in the case of \"friendly urls\", is used for supporting obsolete urls \r\n        /// </summary>\r\n        Redirect = 4\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Routing/UrlSpace.cs",
    "content": "﻿using System.Web;\r\nusing Composite.Plugins.Routing.Pages;\r\n\r\nnamespace Composite.Core.Routing\r\n{\r\n    /// <summary>    \r\n    /// Allows producing different urls for different hostnames, also to forcibly produce relative urls when needed \r\n    /// (f.e. browsing in a console, where an iframe source has to point to the same hostname).\r\n    /// </summary>\r\n    public class UrlSpace\r\n    {\r\n        internal UrlSpace(string hostname)\r\n        {\r\n            Hostname = hostname;\r\n            ForceRelativeUrls = false;\r\n        }\r\n\r\n        internal UrlSpace(string hostname, string relativeUrl)\r\n        {\r\n            Initialize(hostname, relativeUrl);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"UrlSpace\"/> class.\r\n        /// </summary>\r\n        public UrlSpace()\r\n        {\r\n            var httpContext = System.Web.HttpContext.Current;\r\n\r\n            if(httpContext != null)\r\n            {\r\n                InitializeThroughHttpContext(httpContext);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"UrlSpace\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"httpContext\">The HTTP context.</param>\r\n        public UrlSpace(HttpContext httpContext)\r\n        {\r\n            Verify.ArgumentNotNull(httpContext, \"httpContext\");\r\n\r\n            InitializeThroughHttpContext(httpContext);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"UrlSpace\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"httpContextBase\">The HTTP context base.</param>\r\n        public UrlSpace(HttpContextBase httpContextBase)\r\n        {\r\n            Verify.ArgumentNotNull(httpContextBase, \"httpContextBase\");\r\n\r\n            var url = httpContextBase.Request.Url;\r\n\r\n            Initialize(url.Host, url.LocalPath);\r\n        }\r\n\r\n        private void InitializeThroughHttpContext(HttpContext httpContext)\r\n        {\r\n            Initialize(httpContext.Request.Url.Host, httpContext.Request.Url.LocalPath);\r\n        }\r\n\r\n        private void Initialize(string hostname, string relativeUrl)\r\n        {\r\n            ForceRelativeUrls = HttpUtility.UrlDecode(relativeUrl).Contains(DefaultPageUrlProvider.UrlMarker_RelativeUrl);\r\n\r\n            if (!ForceRelativeUrls)\r\n            {\r\n                Hostname = hostname;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the hostname.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The hostname.\r\n        /// </value>\r\n        public string Hostname { get; set; }\r\n\r\n        /// <summary>\r\n        /// Disables hostname bindings, so all output urls will be relative. Is used in in-console preview.\r\n        /// </summary>\r\n        public bool ForceRelativeUrls { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/CodeGeneration/Foundation/ISerializer.cs",
    "content": "﻿using System.Text;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Serialization.CodeGeneration.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface ISerializer\r\n    {\r\n        /// <exclude />\r\n        object Deserialize(Dictionary<string, string> objectState);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/CodeGeneration/PropertySerializerManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Serialization.CodeGeneration.Foundation;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Serialization.CodeGeneration\r\n{\r\n    internal static class PropertySerializerManager\r\n    {\r\n        private static readonly ResourceLocker<Resources> ResourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize, false);\r\n\r\n\r\n        static PropertySerializerManager()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a property serializer for the given property type.\r\n        /// If no serializer exists, one will be runtime code generated.\r\n        /// </summary>\r\n        /// <param name=\"propertyClassType\"></param>\r\n        /// <returns></returns>\r\n        public static ISerializer GetPropertySerializer(Type propertyClassType)\r\n        {\r\n            ISerializer serializer;\r\n\r\n            if (!ResourceLocker.Resources.SerializersTypesCache.TryGetValue(propertyClassType, out serializer))\r\n            {\r\n                using (ResourceLocker.Locker)\r\n                {\r\n                    if (!ResourceLocker.Resources.SerializersTypesCache.TryGetValue(propertyClassType, out serializer))\r\n                    {\r\n                        Type propertySerializerType = GetPropertySerializerType(propertyClassType);\r\n\r\n                        serializer = (ISerializer)Activator.CreateInstance(propertySerializerType);\r\n\r\n                        ResourceLocker.Resources.SerializersTypesCache.Add(propertySerializerType, serializer);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return serializer;\r\n        }\r\n\r\n\r\n\r\n        private static Type GetPropertySerializerType(Type propertyClassType)\r\n        {\r\n            string propertySerializerTypeName = PropertySerializerTypeCodeGenerator.CreateSerializerClassFullName(propertyClassType);\r\n\r\n            Type propertySerializerType = TypeManager.TryGetType(propertySerializerTypeName);\r\n\r\n            if (propertySerializerType == null)\r\n            {\r\n                propertySerializerType = CodeGeneratePropertySerializer(propertyClassType);\r\n            }\r\n\r\n            return propertySerializerType;\r\n        }\r\n\r\n\r\n\r\n\r\n        private static Type CodeGeneratePropertySerializer(Type propertyClassType)\r\n        {\r\n            CodeGenerationBuilder codeGenerationBuilder = new CodeGenerationBuilder(\"PropertySerializer: \" + propertyClassType.FullName);\r\n\r\n            PropertySerializerTypeCodeGenerator.AddPropertySerializerTypeCode(codeGenerationBuilder, propertyClassType);\r\n\r\n            IEnumerable<Type> types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder);\r\n\r\n            return types.Single();\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            ResourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Dictionary<Type, ISerializer> SerializersTypesCache;\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.SerializersTypesCache = new Dictionary<Type, ISerializer>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/CodeGeneration/PropertySerializerTypeCodeGenerator.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Runtime.Serialization;\r\nusing System.Text;\r\nusing Composite.Core.Serialization.CodeGeneration.Foundation;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Serialization.CodeGeneration\r\n{\r\n    /// <summary>\r\n    /// This class creates the CodeDOM for a given property class\r\n    /// </summary>\r\n    internal static class PropertySerializerTypeCodeGenerator\r\n    {\r\n        private const string NamespaceName = \"CompositeGenerated.PropertySerializers\";\r\n\r\n\r\n        internal static void AddPropertySerializerTypeCode(CodeGenerationBuilder codeGenerationBuilder, Type propertyClassType)\r\n        {\r\n            codeGenerationBuilder.AddReference(propertyClassType.Assembly);\r\n            codeGenerationBuilder.AddReference(typeof(EditorBrowsableAttribute).Assembly);\r\n            codeGenerationBuilder.AddReference(typeof(StringConversionServices).Assembly);\r\n\r\n            CodeTypeDeclaration codeTypeDeclaration = CreateCodeTypeDeclaration(propertyClassType);\r\n\r\n            codeGenerationBuilder.AddType(NamespaceName, codeTypeDeclaration);\r\n        }\r\n\r\n\r\n\r\n        internal static void AddPropertySerializerTypeCode(CodeGenerationBuilder codeGenerationBuilder, string propertyClassTypeName, IList<Tuple<string, Type>> properties)\r\n        {\r\n            codeGenerationBuilder.AddReference(typeof(EditorBrowsableAttribute).Assembly);\r\n            codeGenerationBuilder.AddReference(typeof(StringConversionServices).Assembly);\r\n\r\n            CodeTypeDeclaration codeTypeDeclaration = CreateCodeTypeDeclaration(propertyClassTypeName, properties);\r\n\r\n            codeGenerationBuilder.AddType(NamespaceName, codeTypeDeclaration);\r\n        }\r\n\r\n\r\n\r\n        internal static string CreateSerializerClassFullName(Type propertyClassType)\r\n        {\r\n            return NamespaceName + \".\" + CreateSerializerClassName(propertyClassType.FullName);\r\n        }        \r\n\r\n\r\n\r\n        internal static CodeTypeDeclaration CreateCodeTypeDeclaration(Type propertyClassType)\r\n        {\r\n            var properties = GetSerializeableProperties(propertyClassType).Select(p => new Tuple<string,Type>(p.Name, p.PropertyType)).ToList();\r\n\r\n            return CreateCodeTypeDeclaration(propertyClassType.FullName, properties);\r\n        }\r\n\r\n\r\n\r\n        internal static CodeTypeDeclaration CreateCodeTypeDeclaration(string propertyClassTypeName, IList<Tuple<string, Type>> properties)\r\n        {\r\n            string className = CreateSerializerClassName(propertyClassTypeName);\r\n\r\n            CodeTypeDeclaration declaration = new CodeTypeDeclaration(className);\r\n            declaration.IsClass = true;\r\n            declaration.TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed;\r\n            declaration.BaseTypes.Add(typeof(ISerializer));\r\n            declaration.CustomAttributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(EditorBrowsableAttribute)),\r\n                    new CodeAttributeArgument(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeTypeReferenceExpression(typeof(EditorBrowsableState)),\r\n                            EditorBrowsableState.Never.ToString()\r\n                        )\r\n                    )\r\n                )\r\n            );\r\n\r\n            AddDeserializeMethod(declaration, propertyClassTypeName, properties);\r\n\r\n            return declaration;\r\n        }\r\n\r\n\r\n\r\n        private static void AddDeserializeMethod(CodeTypeDeclaration declaration, string propertyClassTypeName, IList<Tuple<string, Type>> properties)\r\n        {\r\n            CodeMemberMethod method = new CodeMemberMethod();\r\n            method.Name = \"Deserialize\";\r\n            method.ReturnType = new CodeTypeReference(typeof(object));\r\n            method.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Dictionary<string, string>), \"objectState\"));\r\n\r\n\r\n            method.Statements.Add(new CodeVariableDeclarationStatement(\r\n                    propertyClassTypeName,\r\n                    \"propertyClass\",\r\n                    new CodeObjectCreateExpression(propertyClassTypeName)\r\n                ));\r\n\r\n\r\n            foreach (var property in properties)\r\n            {\r\n                Type propertyType;\r\n                string methodName;\r\n                if (property.Item2.IsArray == false)\r\n                {\r\n                    propertyType = property.Item2;\r\n                    methodName = \"DeserializeValue\";\r\n                }\r\n                else\r\n                {\r\n                    propertyType = property.Item2.GetElementType();\r\n                    methodName = \"DeserializeValueArray\";\r\n                }\r\n\r\n\r\n                method.Statements.Add(new CodeAssignStatement(\r\n                        new CodePropertyReferenceExpression(\r\n                            new CodeVariableReferenceExpression(\"propertyClass\"),\r\n                            property.Item1\r\n                        ),\r\n                        new CodeMethodInvokeExpression(\r\n                            new CodeMethodReferenceExpression(\r\n                                new CodeTypeReferenceExpression(typeof(StringConversionServices)),\r\n                                methodName,\r\n                                new CodeTypeReference[] {\r\n                                    new CodeTypeReference(propertyType), \r\n                                }\r\n                            ),\r\n                            new CodeExpression[] {\r\n                                new CodeArrayIndexerExpression(\r\n                                    new CodeVariableReferenceExpression(\"objectState\"),\r\n                                    new CodeExpression[] {\r\n                                        new CodePrimitiveExpression(\r\n                                            property.Item1\r\n                                        )    \r\n                                    }\r\n                                ),\r\n                                new CodePropertyReferenceExpression(\r\n                                    new CodeVariableReferenceExpression(\"propertyClass\"),\r\n                                    property.Item1\r\n                                )\r\n                            }\r\n                        )\r\n                    ));\r\n            }\r\n\r\n\r\n            method.Statements.Add(new CodeMethodReturnStatement(\r\n                    new CodeVariableReferenceExpression(\"propertyClass\")\r\n                ));\r\n\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n\r\n        private static List<PropertyInfo> GetSerializeableProperties(Type type)\r\n        {\r\n            List<PropertyInfo> serializeableProperties = new List<PropertyInfo>();\r\n\r\n            PropertyInfo[] properties = type.GetProperties();\r\n\r\n            foreach (PropertyInfo property in properties)\r\n            {\r\n                if (UseableForSerialization(property))\r\n                {\r\n                    serializeableProperties.Add(property);\r\n                }\r\n                else\r\n                {\r\n                    throw new SerializationException(string.Format(\"Property {1} on type {0} has type {2} which is not serializeable.\", type.FullName, property.Name, property.PropertyType));\r\n                }\r\n            }\r\n\r\n            return serializeableProperties;\r\n        }\r\n\r\n\r\n\r\n        private static bool UseableForSerialization(PropertyInfo property)\r\n        {\r\n            bool isUseable = property.CanRead && property.CanWrite;\r\n\r\n            if (isUseable)\r\n            {\r\n                foreach (MethodInfo mi in property.GetAccessors(false))\r\n                {\r\n                    isUseable = isUseable && mi.IsPublic;\r\n                }\r\n            }\r\n\r\n            isUseable = isUseable && TypeUseableForSerialization(property.PropertyType);\r\n\r\n            return isUseable;\r\n        }              \r\n\r\n\r\n\r\n        private static bool TypeUseableForSerialization(Type propertyType)\r\n        {\r\n            if (propertyType.IsSerializable == false)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (propertyType.IsAbstract && propertyType != typeof(Type))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (propertyType.IsCOMObject || propertyType.IsGenericType || propertyType.IsInterface)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private static string CreateSerializerClassName(string propertyClassTypeFullName)\r\n        {\r\n            return string.Format(\"{0}CustomSerializer\", propertyClassTypeFullName.Replace('.', '_').Replace('+', '_'));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/CompositeCollectionValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal sealed class CompositeCollectionValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n            if (xmlSerializer == null) throw new ArgumentNullException(\"xmlSerializer\");\r\n\r\n            serializedObject = null;\r\n\r\n            MethodInfo methodInfo;\r\n            if (objectToSerializeType.IsGenericType)\r\n            {\r\n                Type genericType = objectToSerializeType.GetGenericTypeDefinition();\r\n\r\n                string methodName;\r\n                if (genericType == typeof(Pair<,>))\r\n                {\r\n                    methodName = \"SerializePair\";\r\n                }\r\n\r\n                else\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                methodInfo = typeof(CompositeCollectionValueXmlSerializer).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static);\r\n                methodInfo = methodInfo.MakeGenericMethod(objectToSerializeType.GetGenericArguments());\r\n            }\r\n            else\r\n            {\r\n                string methodName;\r\n                if (objectToSerializeType == typeof(KeyValuePair))\r\n                {\r\n                    methodName = \"SerializeKeyValuePair\";\r\n                }\r\n                else\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                methodInfo = typeof(CompositeCollectionValueXmlSerializer).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static);\r\n            }\r\n\r\n\r\n            XElement result = methodInfo.Invoke(null, new object[] { objectToSerialize, xmlSerializer }) as XElement;\r\n            string serializedType = TypeManager.SerializeType(objectToSerializeType);\r\n\r\n            result.Add(new XAttribute(\"type\", serializedType));\r\n            serializedObject = result;\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n            if (xmlSerializer == null) throw new ArgumentNullException(\"xmlSerializer\");\r\n\r\n            deserializedObject = null;\r\n\r\n            XAttribute typeAttribute = serializedObject.Attribute(\"type\");\r\n            if (typeAttribute == null) return false;\r\n\r\n            Type type = TypeManager.GetType(typeAttribute.Value);\r\n\r\n            MethodInfo methodInfo;\r\n            if (type.IsGenericType)\r\n            {\r\n                Type genericType = type.GetGenericTypeDefinition();\r\n\r\n                string methodName;\r\n                if (genericType == typeof(Pair<,>))\r\n                {\r\n                    methodName = \"DeserializePair\";\r\n                }\r\n                else\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                methodInfo = typeof(CompositeCollectionValueXmlSerializer).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static);\r\n                methodInfo = methodInfo.MakeGenericMethod(type.GetGenericArguments());\r\n            }\r\n            else\r\n            {\r\n                string methodName;\r\n                if (type == typeof(KeyValuePair))\r\n                {\r\n                    methodName = \"DeserializeKeyValuePair\";\r\n                }\r\n                else\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                methodInfo = typeof(CompositeCollectionValueXmlSerializer).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static);\r\n            }\r\n\r\n            try\r\n            {\r\n                object result = methodInfo.Invoke(null, new object[] { serializedObject, xmlSerializer });\r\n                if (result != null)\r\n                {\r\n                    deserializedObject = result;\r\n                    return true;\r\n                }\r\n                else\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n            catch (Exception)\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static XElement SerializePair<TKey, TValue>(Pair<TKey, TValue> pairToSerialize, IXmlSerializer xmlSerializer)\r\n        {\r\n            XElement result = new XElement(\"Pair\");\r\n\r\n            XElement serializedKey = xmlSerializer.Serialize(typeof(TKey), pairToSerialize.First);\r\n            XElement serializedValue = xmlSerializer.Serialize(typeof(TValue), pairToSerialize.Second);\r\n\r\n            result.Add(new XElement(\"First\", serializedKey));\r\n            result.Add(new XElement(\"Second\", serializedValue));\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static Pair<TKey, TValue> DeserializePair<TKey, TValue>(XElement serializedObject, IXmlSerializer xmlSerializer)\r\n        {\r\n            if (serializedObject.Name.LocalName != \"Pair\") throw new InvalidOperationException();\r\n\r\n            XElement keyElement = serializedObject.Element(\"First\");\r\n            if (keyElement == null) throw new InvalidOperationException();\r\n            object keyValue = xmlSerializer.Deserialize(keyElement.Elements().Single());\r\n\r\n            XElement valueElement = serializedObject.Element(\"Second\");\r\n            if (valueElement == null) throw new InvalidOperationException();\r\n            object valueValue = xmlSerializer.Deserialize(valueElement.Elements().Single());\r\n\r\n            Pair<TKey, TValue> result = new Pair<TKey, TValue>((TKey)keyValue, (TValue)valueValue);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static XElement SerializeKeyValuePair(KeyValuePair KeyValuePairToSerialize, IXmlSerializer xmlSerializer)\r\n        {\r\n            XElement result = new XElement(\"KeyValuePair\");\r\n\r\n            XElement serializedKey = xmlSerializer.Serialize(typeof(string), KeyValuePairToSerialize.Key);\r\n            XElement serializedValue = xmlSerializer.Serialize(typeof(string), KeyValuePairToSerialize.Value);\r\n\r\n            result.Add(new XElement(\"Key\", serializedKey));\r\n            result.Add(new XElement(\"Value\", serializedValue));\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static KeyValuePair DeserializeKeyValuePair(XElement serializedObject, IXmlSerializer xmlSerializer)\r\n        {\r\n            if (serializedObject.Name.LocalName != \"KeyValuePair\") throw new InvalidOperationException();\r\n\r\n            XElement keyElement = serializedObject.Element(\"Key\");\r\n            if (keyElement == null) return null;\r\n            object keyValue = xmlSerializer.Deserialize(keyElement.Elements().Single());\r\n\r\n            XElement valueElement = serializedObject.Element(\"Value\");\r\n            if (valueElement == null) return null;\r\n            object valueValue = xmlSerializer.Deserialize(valueElement.Elements().Single());\r\n\r\n            KeyValuePair result = new KeyValuePair((string)keyValue, (string)valueValue);\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/CompositeJsonSerializer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Runtime.Serialization;\r\nusing System.Runtime.Serialization.Formatters;\r\nusing System.Security;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Newtonsoft.Json;\r\nusing Newtonsoft.Json.Linq;\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    /// <summary>\r\n    /// Use this class to serialize and deserialize objects with json serializer\r\n    /// </summary>\r\n    public static class CompositeJsonSerializer\r\n    {\r\n        private const string ObjectKeyString = \"meta:obj\";\r\n        private const string TypeKeyString = \"meta:type\";\r\n        private const string HashKeyString = \"meta:hash\";\r\n\r\n        /// <summary>\r\n        /// Check if string is serialized with JsonSerializer\r\n        /// </summary>\r\n        /// <param name=\"str\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsJsonSerialized(string str)\r\n        {\r\n            return str.StartsWith(\"{\");\r\n        }\r\n\r\n        /// <summary>\r\n        /// Serialize with automatic type name handling\r\n        /// </summary>\r\n        /// <param name=\"obj\">Object to serialize</param>\r\n        /// <returns>serialized string</returns>\r\n        public static string Serialize(object obj)\r\n        {\r\n            var serializedData = JsonConvert.SerializeObject(obj, new JsonSerializerSettings\r\n            {\r\n                TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple,\r\n                TypeNameHandling = TypeNameHandling.Auto,\r\n                Converters = { new JsonTypeConverter() },\r\n                Binder = CompositeSerializationBinder.Instance\r\n            });\r\n\r\n            return serializedData;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Serialize with json object structure type name handling\r\n        /// </summary>\r\n        /// <param name=\"obj\">Object to serialize</param>\r\n        /// <returns>serialized string</returns>\r\n        public static string SerializeObject(object obj)\r\n        {\r\n            var serializedData = JsonConvert.SerializeObject(obj, new JsonSerializerSettings\r\n            {\r\n                TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple,\r\n                TypeNameHandling = TypeNameHandling.Objects,\r\n                Formatting = Formatting.None,\r\n                Converters = { new JsonTypeConverter() },\r\n                Binder = CompositeSerializationBinder.Instance\r\n            });\r\n\r\n            return serializedData;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Serialize only the property names that is specified\r\n        /// </summary>\r\n        /// <param name=\"obj\">Object to serialize</param>\r\n        /// <param name=\"propertyNames\">List of properties to be serialized</param>\r\n        /// <returns>serialized string</returns>\r\n        public static string SerializePartial(object obj, IEnumerable<string> propertyNames)\r\n        {\r\n            if (propertyNames == null)\r\n            {\r\n                return SerializeObject(obj);\r\n            }\r\n\r\n            var serializedData = JsonConvert.SerializeObject(obj, new JsonSerializerSettings\r\n            {\r\n                Converters = { new PartialJsonConvertor(propertyNames, obj.GetType()) }\r\n            });\r\n\r\n            return serializedData;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Serialize with a wrapper containing the serialized object, its hash sign and its type\r\n        /// </summary>\r\n        /// <param name=\"obj\">Object to serialize</param>\r\n        /// <param name=\"shouldSign\">To calculate the hash sign</param>\r\n        /// <returns>serialized string</returns>\r\n        public static string Serialize(object obj, bool shouldSign)\r\n        {\r\n            var type = obj.GetType();\r\n            string serializedData;\r\n\r\n            var methodInfo = type.GetMethod(\"Serialize\");\r\n            if (methodInfo == null)\r\n            {\r\n                serializedData = Serialize(obj);\r\n            }\r\n            else\r\n            {\r\n                serializedData = (string)methodInfo.Invoke(obj, null);\r\n            }\r\n\r\n            var hash = shouldSign ? HashSigner.GetSignedHash(serializedData).GetHashCode() : 0;\r\n\r\n            var serializedProperties = IsJsonSerialized(serializedData)\r\n                ? serializedData.Substring(1, serializedData.Length - 2)\r\n                : $@\"\"\"{ObjectKeyString}\"\":\"\"{serializedData}\"\"\";\r\n\r\n            return \"{\" + serializedProperties\r\n                + $@\",\"\"{TypeKeyString}\"\":\"\"{GetSerializedTypeName(type)}\"\"\"\r\n                + (shouldSign ? $@\",\"\"{HashKeyString}\"\":\"\"{hash}\"\"\" : \"\")\r\n                + \"}\";\r\n        }\r\n\r\n        /// <summary>\r\n        /// Deserialize string into object with specified type\r\n        /// </summary>\r\n        /// <param name=\"str\">Serialized string</param>\r\n        /// <typeparam name=\"T\">Type of returned object</typeparam>\r\n        /// <returns>The object</returns>\r\n        public static T Deserialize<T>(string str)\r\n        {\r\n            var obj = JsonConvert.DeserializeObject<T>(str, new JsonSerializerSettings\r\n            {\r\n                TypeNameHandling = TypeNameHandling.Auto,\r\n                Binder = CompositeSerializationBinder.Instance,\r\n                MaxDepth = 128\r\n            });\r\n\r\n            return obj;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Deserialize strings into object with specified type by merging them together\r\n        /// </summary>\r\n        /// <param name=\"strs\">Serialized string</param>\r\n        /// <typeparam name=\"T\">Type of returned object</typeparam>\r\n        /// <returns>The object</returns>\r\n        public static T Deserialize<T>(params string[] strs)\r\n        {\r\n            var combinedObj = new JObject();\r\n\r\n            var mergeSettings = new JsonMergeSettings\r\n            {\r\n                MergeArrayHandling = MergeArrayHandling.Union\r\n            };\r\n\r\n            try\r\n            {\r\n                foreach (var s in strs)\r\n                {\r\n                    combinedObj.Merge(JObject.Parse(s), mergeSettings);\r\n                }\r\n            }\r\n            catch (Exception)\r\n            {\r\n                throw new ArgumentException(\"Cannot merge arguments into one\");\r\n            }\r\n\r\n            var obj = JsonConvert.DeserializeObject<T>(combinedObj.ToString(), new JsonSerializerSettings\r\n            {\r\n                TypeNameHandling = TypeNameHandling.Auto,\r\n                Binder = CompositeSerializationBinder.Instance,\r\n                MaxDepth = 128\r\n            });\r\n\r\n            return obj;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Deserialize string into object\r\n        /// </summary>\r\n        /// <param name=\"str\">Serialized string</param>\r\n        /// <returns>The object</returns>\r\n        public static object Deserialize(string str)\r\n        {\r\n            var obj = JsonConvert.DeserializeObject(str, new JsonSerializerSettings\r\n            {\r\n                TypeNameHandling = TypeNameHandling.Objects,\r\n                Binder = CompositeSerializationBinder.Instance,\r\n                MaxDepth = 128\r\n            });\r\n\r\n            return obj;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Deserialize strings into object with specified type from a hash signed wrapper\r\n        /// </summary>\r\n        /// <param name=\"str\">Serialized string</param>\r\n        /// <param name=\"isSigned\">Is signed</param>\r\n        /// <typeparam name=\"T\">Type of returned object</typeparam>\r\n        /// <returns>The object</returns>\r\n        public static T Deserialize<T>(string str, bool isSigned)\r\n        {\r\n            var legacyStyleSerialized = str.StartsWith(\"{\\\"\" + ObjectKeyString + \"\\\":\\\"\");\r\n\r\n            string obj;\r\n            var hash = 0;\r\n\r\n            var typeName = str.GetValue(TypeKeyString);\r\n            if (string.IsNullOrWhiteSpace(typeName))\r\n            {\r\n                throw new SerializationException($\"Failed to extract '{TypeKeyString}' property\");\r\n            }\r\n\r\n            var type = TypeManager.TryGetType(typeName);\r\n\r\n            if (type == null)\r\n            {\r\n                throw new SerializationException($\"Failed to resolve type '{typeName}'\");\r\n            }\r\n\r\n            if (isSigned)\r\n            {\r\n                if (!int.TryParse(str.GetValue(HashKeyString), out hash))\r\n                {\r\n                    throw new SerializationException($\"Missing or invalid '{HashKeyString}' property\");\r\n                }\r\n            }\r\n\r\n            if (legacyStyleSerialized)\r\n            {\r\n                obj = str.GetValue(ObjectKeyString);\r\n            }\r\n            else\r\n            {\r\n                obj = \"{\" + str.Substring(1, str.LastIndexOf(TypeKeyString, StringComparison.InvariantCulture) - 3) + \"}\";\r\n            }\r\n\r\n            if (isSigned)\r\n            {\r\n                if (!HashSigner.ValidateSignedHash(obj, new HashValue(hash)))\r\n                {\r\n                    throw new SecurityException($\"Serialized {typeof(T).FullName} is tampered\");\r\n                }\r\n            }\r\n\r\n            var methodInfo = type.GetMethod(\"Deserialize\", BindingFlags.Public | BindingFlags.Static);\r\n            if (methodInfo == null)\r\n            {\r\n                return Deserialize<T>(obj);\r\n            }\r\n\r\n            if (!(typeof(T).IsAssignableFrom(methodInfo.ReturnType)))\r\n            {\r\n                Log.LogWarning(\"CompositeJsonSerializer\", $\"The action {typeName} is missing a public static Deserialize method taking a string as parameter and returning an {typeof(T)}\");\r\n\r\n                throw new InvalidOperationException($\"The token {typeName} is missing a public static Deserialize method taking a string as parameter and returning an {typeof(T)}\");\r\n            }\r\n\r\n            return (T)methodInfo.Invoke(null, new object[] { obj });\r\n        }\r\n\r\n        private static string GetValue(this string str, string key)\r\n        {\r\n            var searchTerm = \"\\\"\" + key + \"\\\":\\\"\";\r\n            var valueStartIndex = str.LastIndexOf(searchTerm, StringComparison.InvariantCulture) + searchTerm.Length;\r\n            var valueLength = str.IndexOf(\"\\\"\", valueStartIndex, StringComparison.InvariantCulture) - valueStartIndex;\r\n            var value = str.Substring(valueStartIndex, valueLength);\r\n\r\n            return value;\r\n        }\r\n\r\n        private static string GetSerializedTypeName(Type type)\r\n        {\r\n            return $\"{type.FullName}, {type.Assembly.GetName().Name}\";\r\n        }\r\n\r\n        private class JsonTypeConverter : JsonConverter\r\n        {\r\n            public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)\r\n            {\r\n                var type = (Type)value;\r\n                writer.WriteValue(GetSerializedTypeName(type));\r\n            }\r\n\r\n            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n            public override bool CanRead => false;\r\n\r\n            public override bool CanConvert(Type objectType)\r\n            {\r\n                return typeof(Type).IsAssignableFrom(objectType);\r\n            }\r\n        }\r\n\r\n        private class PartialJsonConvertor : JsonConverter\r\n        {\r\n            private readonly IEnumerable<string> _propertyNames;\r\n            private readonly Type _type;\r\n\r\n            public PartialJsonConvertor(IEnumerable<string> propertyNames, Type type)\r\n            {\r\n                _propertyNames = propertyNames;\r\n                _type = type;\r\n            }\r\n\r\n            public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)\r\n            {\r\n                var o = new JObject();\r\n\r\n                o.AddFirst(new JProperty(\"$type\", GetSerializedTypeName(_type)));\r\n\r\n                var jsonSerializer = new JsonSerializer\r\n                {\r\n                    TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple,\r\n                    TypeNameHandling = TypeNameHandling.Objects,\r\n                    Converters = { new JsonTypeConverter() }\r\n                };\r\n\r\n                foreach (var property in _propertyNames)\r\n                {\r\n                    o.Add(property, JToken.FromObject(GetPropValue(value, property), jsonSerializer));\r\n                }\r\n\r\n                o.WriteTo(writer);\r\n            }\r\n\r\n            private static object GetPropValue(object src, string propName)\r\n            {\r\n                var prop = src.GetType().GetProperty(propName);\r\n                if (prop == null)\r\n                {\r\n                    throw new ArgumentException($\"There is no {propName} in {src.GetType().FullName}\");\r\n                }\r\n\r\n                return prop.GetValue(src, null);\r\n            }\r\n\r\n            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n            public override bool CanConvert(Type objectType)\r\n            {\r\n                return true;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/CompositeSerializationBinder.cs",
    "content": "using System;\r\nusing System.Reflection;\r\nusing System.Runtime.Serialization;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Newtonsoft.Json.Serialization;\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    /// <summary>\r\n    /// Removes temporary assembly references when serializing references to generated classes.\r\n    /// </summary>\r\n    internal class CompositeSerializationBinder: DefaultSerializationBinder\r\n    {\r\n        private const string GeneratedTypesNamespacePrefix = \"CompositeGenerated.\";\r\n        private const string GeneratedTypesAssemblyName = \"Composite.Generated\";\r\n\r\n        public static SerializationBinder Instance { get; } = new CompositeSerializationBinder();\r\n\r\n        public override void BindToName(Type serializedType, out string assemblyName, out string typeName)\r\n        {\r\n            typeName = serializedType.FullName;\r\n\r\n            if (typeName.StartsWith(GeneratedTypesNamespacePrefix, StringComparison.OrdinalIgnoreCase)\r\n                && Guid.TryParse(serializedType.Assembly.GetName().Name, out _))\r\n            {\r\n                assemblyName = GeneratedTypesAssemblyName;\r\n            }\r\n            else\r\n            {\r\n                assemblyName = serializedType.Assembly.FullName;\r\n            }\r\n        }\r\n\r\n        public override Type BindToType(string assemblyName, string typeName)\r\n        {\r\n            if (assemblyName == GeneratedTypesAssemblyName\r\n                && typeName.StartsWith(GeneratedTypesNamespacePrefix, StringComparison.OrdinalIgnoreCase))\r\n            {\r\n                var result = TypeManager.TryGetType($\"{typeName}, {assemblyName}\") ?? TypeManager.TryGetType(typeName);\r\n                if (result != null) return result;\r\n            }\r\n\r\n            var type = base.BindToType(assemblyName, typeName);\r\n\r\n            VerityTypeIsSupported(new AssemblyName(assemblyName), typeName, type);\r\n\r\n            return type;\r\n        }\r\n\r\n        private void VerityTypeIsSupported(AssemblyName assemblyName, string typeFullName, Type type)\r\n        {\r\n            if (!TypeIsSupported(assemblyName, typeFullName, type))\r\n            {\r\n                throw new NotSupportedException($\"Not supported object type '{typeFullName}'\");\r\n            }\r\n\r\n            if (type.IsGenericType)\r\n            {\r\n                foreach (var typeArgument in type.GetGenericArguments())\r\n                {\r\n                    VerityTypeIsSupported(typeArgument.Assembly.GetName(), typeArgument.FullName, typeArgument);\r\n                }\r\n            }\r\n        }\r\n\r\n        private bool TypeIsSupported(AssemblyName assemblyName, string typeName, Type type)\r\n        {\r\n            if (assemblyName.Name == typeof(object).Assembly.GetName().Name /* \"mscorlib\" */)\r\n            {\r\n                var dotOffset = typeName.LastIndexOf(\".\", StringComparison.Ordinal);\r\n                if (dotOffset > 0)\r\n                {\r\n                    string @namespace = typeName.Substring(0, dotOffset);\r\n\r\n                    return @namespace == nameof(System) || @namespace.StartsWith(\"System.Collections\");\r\n                }\r\n            }\r\n\r\n            return type != null\r\n                   && (type.IsEnum\r\n                       || typeof(EntityToken).IsAssignableFrom(type)\r\n                       || typeof(SearchToken).IsAssignableFrom(type)\r\n                       || typeof(IDataId).IsAssignableFrom(type)\r\n                       || type == typeof(DataSourceId)\r\n                       || type == typeof(DataScopeIdentifier));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/ISerializerHandler.cs",
    "content": "﻿namespace Composite.Core.Serialization\r\n{\r\n    /// <summary>\r\n    /// Handler to serialize and deserialize data for use in Workflows during ie. postbacks.\r\n    /// </summary>\r\n\tpublic interface ISerializerHandler\r\n\t{\r\n        /// <summary>\r\n        /// Returns a string representation of an object\r\n        /// </summary>\r\n        /// <param name=\"objectToSerialize\"></param>\r\n        /// <returns></returns>\r\n        string Serialize(object objectToSerialize);\r\n\r\n        /// <summary>\r\n        /// Returns the constructed object deserialized from the passed string\r\n        /// </summary>\r\n        /// <param name=\"serializedObject\"></param>\r\n        /// <returns></returns>\r\n        object Deserialize(string serializedObject);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/ISerializerHandlerFacade.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal interface ISerializerHandlerFacade\r\n\t{\r\n        bool TrySerialize(object objectToSerialize, out string serializedObject, out string errorMessage);\r\n        object Deserialize(string serializedObject);\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/IValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal interface IValueXmlSerializer\r\n    {\r\n        bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject);\r\n        bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/IXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal interface IXmlSerializer\r\n    {\r\n        XElement Serialize(Type objectToSerializeType, object objectToSerialize);\r\n        object Deserialize(XElement serializedObject);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/PrettyPrinter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Data;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.DynamicTypes;\r\nusing System.Reflection;\r\nusing System.Collections;\r\nusing System.ComponentModel;\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    /// <summary>    \r\n    /// Used for printing a value to a string in a nice way.\r\n    /// The result string will contain line feeds etc.\r\n    /// It handles IData, Lists, Dictionaries, KeyValyePairs, Tupples etc.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public static class PrettyPrinter\r\n    {\r\n        /// <summary>        \r\n        /// </summary>\r\n        /// <param name=\"result\"></param>\r\n        /// <returns></returns>\r\n        public static string Print(object result)\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            Print(result, sb, 0);\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        private static void Print(object result, StringBuilder sb, int indentLevel, bool includeLineFeed = true)\r\n        {\r\n            if (result == null)\r\n            {\r\n                sb.AppendLine(\"(null)\");\r\n            }\r\n            else if ((result is IEnumerable) && (result.GetType() != typeof(string)))\r\n            {\r\n                IEnumerable enumerable = result as IEnumerable;\r\n                List<object> values = enumerable.ToListOfObjects();\r\n\r\n                sb.AppendLine();\r\n\r\n                int counter = 0;\r\n                foreach (object value in values)\r\n                {\r\n                    PrintIndent(sb, indentLevel);\r\n                    sb.Append(\"result[\" + counter + \"] : \");\r\n                    Print(value, sb, indentLevel + 1);\r\n\r\n                    counter++;\r\n                }\r\n            }\r\n            else if (result is IData)\r\n            {\r\n                IData dataItem = result as IData;\r\n\r\n                DataTypeDescriptor dataTypeDescriptor = Composite.Data.DynamicTypes.DynamicTypeManager.GetDataTypeDescriptor(dataItem.GetImmutableTypeId());\r\n\r\n                sb.AppendLine(dataItem.GetType().ToString());\r\n                PrintIndent(sb, indentLevel);\r\n                sb.AppendLine(\"{\");\r\n                foreach (DataFieldDescriptor dataFieldDescriptor in dataTypeDescriptor.Fields)\r\n                {\r\n                    PropertyInfo propertyInfo = dataItem.GetType().GetPropertiesRecursively().Where(f => f.Name == dataFieldDescriptor.Name).First();\r\n\r\n                    object value = propertyInfo.GetValue(dataItem, null);\r\n\r\n                    PrintIndent(sb, indentLevel + 1);\r\n\r\n                    sb.Append(dataFieldDescriptor.Name + \" : \");\r\n\r\n                    if (value != null) sb.Append(value.ToString());\r\n                    else sb.Append(\"(null)\");\r\n\r\n                    sb.AppendLine(\", \");\r\n                }\r\n                PrintIndent(sb, indentLevel);\r\n                sb.AppendLine(\"{\");\r\n            }\r\n            else if ((result.GetType().IsGenericType) && (result.GetType().GetGenericTypeDefinition() == typeof(KeyValuePair<,>)))\r\n            {\r\n                PropertyInfo keyPropertyInfo = result.GetType().GetProperty(\"Key\");\r\n                PropertyInfo valuePropertyInfo = result.GetType().GetProperty(\"Value\");\r\n\r\n                object keyValue = keyPropertyInfo.GetValue(result, null);\r\n                object valueValue = valuePropertyInfo.GetValue(result, null);\r\n                sb.Append(\"(\");\r\n                Print(keyValue, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(valueValue, sb, indentLevel + 1, false);\r\n                sb.AppendLine(\")\");\r\n            }\r\n            else if ((result.GetType().IsGenericType) && (result.GetType().GetGenericTypeDefinition() == typeof(Tuple<,>)))\r\n            {\r\n                PropertyInfo item1PropertyInfo = result.GetType().GetProperty(\"Item1\");\r\n                PropertyInfo item2PropertyInfo = result.GetType().GetProperty(\"Item2\");\r\n\r\n                object item1Value = item1PropertyInfo.GetValue(result, null);\r\n                object item2Value = item2PropertyInfo.GetValue(result, null);\r\n                sb.Append(\"(\");\r\n                Print(item1Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item2Value, sb, indentLevel + 1, false);\r\n                sb.AppendLine(\")\");\r\n            }\r\n            else if ((result.GetType().IsGenericType) && (result.GetType().GetGenericTypeDefinition() == typeof(Tuple<,,>)))\r\n            {\r\n                PropertyInfo item1PropertyInfo = result.GetType().GetProperty(\"Item1\");\r\n                PropertyInfo item2PropertyInfo = result.GetType().GetProperty(\"Item2\");\r\n                PropertyInfo item3PropertyInfo = result.GetType().GetProperty(\"Item3\");\r\n\r\n                object item1Value = item1PropertyInfo.GetValue(result, null);\r\n                object item2Value = item2PropertyInfo.GetValue(result, null);\r\n                object item3Value = item3PropertyInfo.GetValue(result, null);\r\n\r\n                sb.Append(\"(\");\r\n                Print(item1Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item2Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item3Value, sb, indentLevel + 1, false);\r\n                sb.AppendLine(\")\");\r\n            }\r\n            else if ((result.GetType().IsGenericType) && (result.GetType().GetGenericTypeDefinition() == typeof(Tuple<,,,>)))\r\n            {\r\n                PropertyInfo item1PropertyInfo = result.GetType().GetProperty(\"Item1\");\r\n                PropertyInfo item2PropertyInfo = result.GetType().GetProperty(\"Item2\");\r\n                PropertyInfo item3PropertyInfo = result.GetType().GetProperty(\"Item3\");\r\n                PropertyInfo item4PropertyInfo = result.GetType().GetProperty(\"Item4\");\r\n\r\n                object item1Value = item1PropertyInfo.GetValue(result, null);\r\n                object item2Value = item2PropertyInfo.GetValue(result, null);\r\n                object item3Value = item3PropertyInfo.GetValue(result, null);\r\n                object item4Value = item4PropertyInfo.GetValue(result, null);\r\n\r\n                sb.Append(\"(\");\r\n                Print(item1Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item2Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item3Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item4Value, sb, indentLevel + 1, false);\r\n                sb.AppendLine(\")\");\r\n            }\r\n            else if ((result.GetType().IsGenericType) && (result.GetType().GetGenericTypeDefinition() == typeof(Tuple<,,,,>)))\r\n            {\r\n                PropertyInfo item1PropertyInfo = result.GetType().GetProperty(\"Item1\");\r\n                PropertyInfo item2PropertyInfo = result.GetType().GetProperty(\"Item2\");\r\n                PropertyInfo item3PropertyInfo = result.GetType().GetProperty(\"Item3\");\r\n                PropertyInfo item4PropertyInfo = result.GetType().GetProperty(\"Item4\");\r\n                PropertyInfo item5PropertyInfo = result.GetType().GetProperty(\"Item5\");\r\n\r\n                object item1Value = item1PropertyInfo.GetValue(result, null);\r\n                object item2Value = item2PropertyInfo.GetValue(result, null);\r\n                object item3Value = item3PropertyInfo.GetValue(result, null);\r\n                object item4Value = item4PropertyInfo.GetValue(result, null);\r\n                object item5Value = item5PropertyInfo.GetValue(result, null);\r\n\r\n                sb.Append(\"(\");\r\n                Print(item1Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item2Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item3Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item4Value, sb, indentLevel + 1, false);\r\n                sb.Append(\", \");\r\n                Print(item5Value, sb, indentLevel + 1, false);\r\n                sb.AppendLine(\")\");\r\n            }\r\n            else\r\n            {\r\n                if (includeLineFeed)\r\n                {\r\n                    sb.AppendLine(result.ToString());\r\n                }\r\n                else\r\n                {\r\n                    sb.Append(result.ToString());\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void PrintIndent(StringBuilder sb, int indentLevel)\r\n        {\r\n            for (int i = 0; i < indentLevel; i++)\r\n            {\r\n                sb.Append(\"  \");\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Core/Serialization/PropertySerializerHandler.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n\tclass PropertySerializerHandler : ISerializerHandler\r\n\t{\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            if (objectToSerialize == null) throw new ArgumentNullException(\"objectToSerialize\");\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"_Type_\", TypeManager.SerializeType(objectToSerialize.GetType()));\r\n\r\n            IEnumerable<PropertyInfo> propertyInfos =\r\n                from prop in objectToSerialize.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)\r\n                where prop.CanRead && prop.CanWrite \r\n                select prop;\r\n\r\n            foreach (PropertyInfo propertyInfo in propertyInfos)\r\n            {\r\n                MethodInfo methodInfo =\r\n                        (from mi in typeof(StringConversionServices).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                         where mi.Name == \"SerializeKeyValuePair\" &&\r\n                               mi.IsGenericMethodDefinition &&\r\n                               mi.GetParameters().Length == 3 &&\r\n                               mi.GetParameters()[2].ParameterType.IsGenericParameter \r\n                         select mi).SingleOrDefault();\r\n                \r\n                methodInfo = methodInfo.MakeGenericMethod(new Type[] { propertyInfo.PropertyType });\r\n\r\n                object propertyValue = propertyInfo.GetValue(objectToSerialize, null);\r\n\r\n                methodInfo.Invoke(null, new object[] { sb, propertyInfo.Name, propertyValue });\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedObject);\r\n\r\n            if (dic.ContainsKey(\"_Type_\") == false) throw new ArgumentException(\"serializedObject is of wrong format\");\r\n\r\n            string typeString = StringConversionServices.DeserializeValueString(dic[\"_Type_\"]);\r\n            Type type = TypeManager.GetType(typeString);\r\n\r\n            object obj = Activator.CreateInstance(type);\r\n\r\n            IEnumerable<PropertyInfo> propertyInfos =\r\n                from prop in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)\r\n                where prop.CanRead && prop.CanWrite \r\n                select prop;\r\n\r\n            foreach (PropertyInfo propertyInfo in propertyInfos)\r\n            {\r\n                if (dic.ContainsKey(propertyInfo.Name) == false) throw new ArgumentException(\"serializedObject is of wrong format\");\r\n\r\n                MethodInfo methodInfo =\r\n                        (from mi in typeof(StringConversionServices).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                         where mi.Name == \"DeserializeValue\" &&\r\n                               mi.IsGenericMethodDefinition &&\r\n                               mi.GetParameters().Length == 2 &&\r\n                               mi.GetParameters()[1].ParameterType.IsGenericParameter \r\n                         select mi).SingleOrDefault();\r\n\r\n                object defaultValue;\r\n                if (propertyInfo.PropertyType == typeof(Guid)) defaultValue = default(Guid);\r\n                else if (propertyInfo.PropertyType == typeof(string)) defaultValue = default(string);\r\n                else if (propertyInfo.PropertyType == typeof(int)) defaultValue = default(int);\r\n                else if (propertyInfo.PropertyType == typeof(DateTime)) defaultValue = default(DateTime);\r\n                else if (propertyInfo.PropertyType == typeof(bool)) defaultValue = default(bool);\r\n                else if (propertyInfo.PropertyType == typeof(decimal)) defaultValue = default(decimal);\r\n                else if (propertyInfo.PropertyType == typeof(long)) defaultValue = default(long);\r\n                else defaultValue = null;\r\n\r\n                methodInfo = methodInfo.MakeGenericMethod(new Type[] { propertyInfo.PropertyType });\r\n               \r\n                object propertyValue = methodInfo.Invoke(null, new object[] { dic[propertyInfo.Name], defaultValue });\r\n\r\n                propertyInfo.SetValue(obj, propertyValue, null);\r\n            }\r\n\r\n            return obj;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SerializationFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Serialization.CodeGeneration;\r\nusing Composite.Core.Serialization.CodeGeneration.Foundation;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal static class SerializationFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static SerializationFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        public static object Deserialize(Type propertyClassType, string serializedProperties)\r\n        {\r\n            ISerializer serializer = GetSerializer(propertyClassType);\r\n\r\n            Dictionary<string, string> objectState =\r\n                StringConversionServices.ParseKeyValueCollection(serializedProperties);\r\n\r\n            return serializer.Deserialize(objectState);\r\n        }\r\n\r\n\r\n\r\n        public static T Deserialize<T>(Type propertyClassType, string serializedProperties)\r\n        {\r\n            ISerializer serializer = GetSerializer(propertyClassType);\r\n\r\n            Dictionary<string, string> objectState =\r\n                StringConversionServices.ParseKeyValueCollection(serializedProperties);\r\n\r\n            return (T)serializer.Deserialize(objectState);\r\n        }\r\n\r\n\r\n\r\n        private static ISerializer GetSerializer(Type propertyClassType)\r\n        {\r\n            var reusourceLocker = _resourceLocker;\r\n            var serializerCache = reusourceLocker.Resources.SerializerCache;\r\n\r\n            ISerializer serializer;\r\n\r\n            if (serializerCache.TryGetValue(propertyClassType, out serializer))\r\n            {\r\n                return serializer;\r\n            }\r\n\r\n\r\n            using (reusourceLocker.Locker)\r\n            {\r\n                if (!serializerCache.TryGetValue(propertyClassType, out serializer))\r\n                {\r\n                    serializer = PropertySerializerManager.GetPropertySerializer(propertyClassType);\r\n\r\n                    serializerCache.Add(propertyClassType, serializer);\r\n                }\r\n            }\r\n\r\n            return serializer;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public CompiledTypeCache<ISerializer> SerializerCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.SerializerCache = new CompiledTypeCache<ISerializer>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SerializerHandlerAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    /// <summary>\r\n    /// Defines which <see cref=\"ISerializerHandler\" /> is used to serialize and deserialize this class\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]\r\n    public sealed class SerializerHandlerAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Defines which <see cref=\"ISerializerHandler\" /> is used to serialize and deserialize this class\r\n        /// </summary>\r\n        /// <param name=\"serializerHandlerType\"></param>\r\n        public SerializerHandlerAttribute(Type serializerHandlerType)\r\n        {\r\n            this.SerializerHandlerType = serializerHandlerType;\r\n        }\r\n\r\n        /// <summary>\r\n        /// The <see cref=\"ISerializerHandler\" /> type which is used to serialize and deserialize the class the attribute is added to\r\n        /// </summary>\r\n        public Type SerializerHandlerType { get; private set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SerializerHandlerFacade.cs",
    "content": "﻿using Composite.C1Console.Events;\r\nusing System;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal static class SerializerHandlerFacade\r\n    {\r\n        private static ISerializerHandlerFacade _implementation = new SerializerHandlerFacadeImpl();\r\n\r\n        internal static ISerializerHandlerFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        static SerializerHandlerFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        public static string Serialize(object objectToSerialize)\r\n        {\r\n            string serializedObject;\r\n            string errorMessage;\r\n            if (TrySerialize(objectToSerialize, out serializedObject, out errorMessage) == false)\r\n            {\r\n                throw new InvalidOperationException(errorMessage);\r\n            }\r\n\r\n            return serializedObject;\r\n        }\r\n\r\n\r\n        public static bool TrySerialize(object objectToSerialize, out string serializedObject)\r\n        {\r\n            string errorMessage;\r\n            return TrySerialize(objectToSerialize, out serializedObject, out errorMessage);\r\n        }\r\n\r\n\r\n\r\n        public static bool TrySerialize(object objectToSerialize, out string serializedObject, out string errorMessage)\r\n        {\r\n            return _implementation.TrySerialize(objectToSerialize, out serializedObject, out errorMessage);\r\n        }\r\n\r\n\r\n\r\n        public static object Deserialize(string serializedObject)\r\n        {\r\n            return _implementation.Deserialize(serializedObject);\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SerializerHandlerFacadeImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal sealed class SerializerHandlerFacadeImpl : ISerializerHandlerFacade\r\n\t{\r\n        private Dictionary<Type, ISerializerHandler> _serializeHandlers = new Dictionary<Type, ISerializerHandler>();\r\n        private readonly object _lock = new object();\r\n\r\n\r\n\r\n        public bool TrySerialize(object objectToSerialize, out string serializedObject, out string errorMessage)\r\n        {\r\n            if (objectToSerialize == null) throw new ArgumentNullException(\"objectToSerialize\");\r\n\r\n            serializedObject = null;\r\n\r\n            IEnumerable<SerializerHandlerAttribute> serializerHandlerAttributes = objectToSerialize.GetType().GetCustomAttributesRecursively<SerializerHandlerAttribute>();\r\n            if (serializerHandlerAttributes.Count() == 0)\r\n            {\r\n                errorMessage = string.Format(\"The type '{0}' has no '{1}' defined in its inherit tree\", objectToSerialize.GetType(), typeof(SerializerHandlerAttribute));\r\n                return false;\r\n            }\r\n\r\n            SerializerHandlerAttribute serializerHandlerAttribute = serializerHandlerAttributes.First();\r\n            if (serializerHandlerAttribute.SerializerHandlerType == null)\r\n            {\r\n                errorMessage = string.Format(\"The type '{0}' has specified a null argument to the '{1}'\", objectToSerialize.GetType(), typeof(SerializerHandlerAttribute));\r\n                return false;\r\n            }\r\n\r\n            if (typeof(ISerializerHandler).IsAssignableFrom(serializerHandlerAttribute.SerializerHandlerType) == false)\r\n            {\r\n                errorMessage = string.Format(\"The type '{0}' has specified a type that does not implement the '{1}' argument to the '{2}'\", objectToSerialize.GetType(), typeof(ISerializerHandler), typeof(SerializerHandlerAttribute));\r\n                return false;\r\n            }\r\n\r\n            Type serializeHandlerType = serializerHandlerAttribute.SerializerHandlerType;\r\n\r\n            ISerializerHandler serializerHandler;\r\n            lock (_lock)\r\n            {\r\n                if (_serializeHandlers.TryGetValue(serializeHandlerType, out serializerHandler) == false)\r\n                {\r\n                    serializerHandler = (ISerializerHandler)Activator.CreateInstance(serializeHandlerType);\r\n\r\n                    _serializeHandlers.Add(serializeHandlerType, serializerHandler);\r\n                }\r\n            }\r\n\r\n            string serializedObj = serializerHandler.Serialize(objectToSerialize);\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"SerializerHandlerType\", TypeManager.SerializeType(serializerHandler.GetType()));\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"SerializedObject\", serializedObj);\r\n\r\n            errorMessage = null;\r\n            serializedObject = sb.ToString();\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedObject);\r\n\r\n            if ((dic.ContainsKey(\"SerializerHandlerType\") == false) || (dic.ContainsKey(\"SerializedObject\") == false)) throw new InvalidOperationException(\"serializedObject is of wrong format\");\r\n\r\n            string serilizerHandlerTypeString = StringConversionServices.DeserializeValueString(dic[\"SerializerHandlerType\"]);\r\n            Type serilizerHandlerType = TypeManager.GetType(serilizerHandlerTypeString);\r\n\r\n            ISerializerHandler serializerHandler;\r\n            lock (_lock)\r\n            {\r\n                if (_serializeHandlers.TryGetValue(serilizerHandlerType, out serializerHandler) == false)\r\n                {\r\n                    serializerHandler = (ISerializerHandler)Activator.CreateInstance(serilizerHandlerType);\r\n\r\n                    _serializeHandlers.Add(serilizerHandlerType, serializerHandler);\r\n                }\r\n            }\r\n\r\n            string serializedObjectString = StringConversionServices.DeserializeValueString(dic[\"SerializedObject\"]);\r\n            object resultObject = serializerHandler.Deserialize(serializedObjectString);\r\n\r\n            return resultObject;\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _serializeHandlers = new Dictionary<Type, ISerializerHandler>();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SerializerHandlerValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\n\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    class SerializerHandlerValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n\r\n            string serializedResult;\r\n            bool result = SerializerHandlerFacade.TrySerialize(objectToSerialize, out serializedResult);\r\n            if (result == false)\r\n            {\r\n                serializedObject = null;\r\n                return false;\r\n            }\r\n\r\n            serializedObject = new XElement(\"SerializerHandler\", new XAttribute(\"value\", serializedResult));\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject.Name.LocalName != \"SerializerHandler\") return false;\r\n\r\n            XAttribute valueAttribute = serializedObject.Attribute(\"value\");\r\n            if (valueAttribute == null) return false;\r\n\r\n            try\r\n            {\r\n                deserializedObject = SerializerHandlerFacade.Deserialize(valueAttribute.Value);\r\n\r\n                return true;\r\n            }\r\n            catch (DataSerilizationException)\r\n            {\r\n                throw;\r\n            }\r\n            catch (Exception)\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/StringConversionServices.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.ComponentModel;\r\nusing System.Collections.Generic;\r\nusing System.Text.RegularExpressions;\r\nusing System.Globalization;\r\nusing System.Reflection;\r\nusing System.Collections.Concurrent;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class StringConversionServices\r\n    {\r\n        private const string _unencodedValueMarker = \"'\";\r\n        private const string _encodedValueMarker = \"\\\\'\";\r\n\r\n        private const string _unencodedEqualAndValueMarker = \"=\" + _unencodedValueMarker;\r\n\r\n        private const string _keyValuePairRegExPattern = @\"\\s*(?<Key>[^=\\s]*)\\s*=\\s*(?<IsNull>null|\" + _unencodedValueMarker + @\"(?<Value>[^\" + _unencodedValueMarker + @\"\\\\\\r\\n]*(\\\\.[^\" + _unencodedValueMarker + @\"\\\\\\r\\n]*)*)\" + _unencodedValueMarker + @\")\\s*,*\\s*\";\r\n        private static Regex _keyValuePairRegEx = new Regex(_keyValuePairRegExPattern, RegexOptions.Compiled);\r\n\r\n        private const string _listElementRegExPattern = @\"\\s*\" + _unencodedValueMarker + @\"(?<Value>[^\" + _unencodedValueMarker + @\"\\\\\\r\\n]*(\\\\.[^\" + _unencodedValueMarker + @\"\\\\\\r\\n]*)*)\" + _unencodedValueMarker + @\"\\s*,*\\s*\";\r\n        private static Regex _listElementRegEx = new Regex(_listElementRegExPattern, RegexOptions.Compiled);\r\n\r\n        private static readonly NumberFormatInfo _numberFormatInfo = CultureInfo.InvariantCulture.NumberFormat;\r\n\r\n        // Caching\r\n        private static readonly ConcurrentDictionary<Type, MethodInfo> _serializeKeyValuePairMethodInfoCache = new ConcurrentDictionary<Type, MethodInfo>();\r\n        private static readonly ConcurrentDictionary<Type, MethodInfo> _deserializeValueMethodInfoCache = new ConcurrentDictionary<Type, MethodInfo>();\r\n\r\n\r\n        #region DateTime\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, DateTime propertyValue)\r\n        {\r\n            builder.Append(propertyName);\r\n            builder.Append(_unencodedEqualAndValueMarker);\r\n            \r\n            TypeConverter tc = TypeDescriptor.GetConverter(typeof(DateTime));\r\n            builder.Append(tc.ConvertToString(propertyValue));\r\n\r\n            builder.Append(_unencodedValueMarker);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, DateTime propertyValue)\r\n        {\r\n            SerializeKeyValuePair<DateTime>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static DateTime DeserializeValue<PT>(string stringRepresentation, DateTime deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(DateTime);\r\n            }\r\n\r\n            TypeConverter tc = TypeDescriptor.GetConverter(typeof(DateTime));\r\n            return (DateTime)tc.ConvertFromString(stringRepresentation);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static DateTime DeserializeValueDateTime(string stringRepresentation)\r\n        {\r\n            return DeserializeValue<DateTime>(stringRepresentation, DateTime.Now);\r\n        }\r\n        #endregion\r\n\r\n\r\n        #region int\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, int propertyValue)\r\n        {\r\n            builder.Append(propertyName);\r\n            builder.Append(_unencodedEqualAndValueMarker);\r\n            builder.Append(propertyValue.ToString());\r\n            builder.Append(_unencodedValueMarker);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, PT propertyValue, IEnumerable<string> filterProperties)\r\n        {\r\n            if (filterProperties != null && !filterProperties.Contains(propertyName))\r\n                return;\r\n            SerializeKeyValuePair<PT>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, int propertyValue)\r\n        {\r\n            SerializeKeyValuePair<int>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static int DeserializeValue<PT>(string stringRepresentation, int deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(int);\r\n            }\r\n\r\n            return Int32.Parse(stringRepresentation);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static int DeserializeValueInt(string stringRepresentation)\r\n        {\r\n            return DeserializeValue<int>(stringRepresentation, default(int));\r\n        }\r\n        #endregion\r\n\r\n        #region long\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, long propertyValue)\r\n        {\r\n            builder.Append(propertyName);\r\n            builder.Append(_unencodedEqualAndValueMarker);\r\n            builder.Append(propertyValue.ToString());\r\n            builder.Append(_unencodedValueMarker);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, long propertyValue)\r\n        {\r\n            SerializeKeyValuePair<long>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static long DeserializeValue<PT>(string stringRepresentation, long deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(long);\r\n            }\r\n\r\n            return long.Parse(stringRepresentation);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static long DeserializeValueLong(string stringRepresentation)\r\n        {\r\n            return DeserializeValue<long>(stringRepresentation, default(long));\r\n        }\r\n        #endregion\r\n        \r\n        #region decimal\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, decimal propertyValue)\r\n        {\r\n            builder.Append(propertyName);\r\n            builder.Append(_unencodedEqualAndValueMarker);\r\n            builder.Append(propertyValue.ToString(_numberFormatInfo));\r\n            builder.Append(_unencodedValueMarker);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, decimal propertyValue)\r\n        {\r\n            SerializeKeyValuePair<decimal>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static decimal DeserializeValue<PT>(string stringRepresentation, decimal deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(decimal);\r\n            }\r\n\r\n            return decimal.Parse(stringRepresentation, _numberFormatInfo);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static decimal DeserializeValueDecimal(string stringRepresentation)\r\n        {\r\n            return DeserializeValue<decimal>(stringRepresentation, default(decimal));\r\n        }\r\n        #endregion\r\n        \r\n        #region bool\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, bool propertyValue)\r\n        {\r\n            builder.Append(propertyName);\r\n            builder.Append(_unencodedEqualAndValueMarker);\r\n            builder.Append(propertyValue.ToString());\r\n            builder.Append(_unencodedValueMarker);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, bool propertyValue)\r\n        {\r\n            SerializeKeyValuePair<bool>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool DeserializeValue<PT>(string stringRepresentation, bool deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(bool);\r\n            }\r\n\r\n            return bool.Parse(stringRepresentation);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool DeserializeValueBool(string stringRepresentation)\r\n        {\r\n            return DeserializeValue<bool>(stringRepresentation, default(bool));\r\n        }\r\n        #endregion\r\n\r\n        #region Guid\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, Guid propertyValue)\r\n        {\r\n            builder.Append(propertyName);\r\n            builder.Append(_unencodedEqualAndValueMarker);\r\n            builder.Append(propertyValue.ToString(\"D\"));\r\n            builder.Append(_unencodedValueMarker);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, Guid propertyValue)\r\n        {\r\n            SerializeKeyValuePair<Guid>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Guid DeserializeValue<PT>(string stringRepresentation, Guid deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(Guid);\r\n            }\r\n\r\n            return new Guid(stringRepresentation);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Guid DeserializeValueGuid(string stringRepresentation)\r\n        {\r\n            return DeserializeValue<Guid>(stringRepresentation, Guid.Empty);\r\n        }\r\n        #endregion\r\n\r\n        #region Type\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, Type propertyValue)\r\n        {\r\n            if (null == propertyValue)\r\n            {\r\n                builder.Append(propertyName);\r\n                builder.Append(\"=null\");\r\n            }\r\n            else\r\n            {\r\n\r\n                builder.Append(propertyName);\r\n                builder.Append(_unencodedEqualAndValueMarker);\r\n                string typeString = String.Format(\"{0}, {1}\", propertyValue.FullName, propertyValue.Assembly.FullName.Split(',')[0]);\r\n                builder.Append(typeString);\r\n                builder.Append(_unencodedValueMarker);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, Type propertyValue)\r\n        {\r\n            SerializeKeyValuePair<Type>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Type DeserializeValue<PT>(string stringRepresentation, Type deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(Type);\r\n            }\r\n\r\n            return Type.GetType(stringRepresentation);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Type DeserializeValueType(string stringRepresentation)\r\n        {\r\n            return DeserializeValue<Type>(stringRepresentation, default(Type));\r\n        }\r\n        #endregion\r\n\r\n        #region string\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, string propertyValue)\r\n        {\r\n            if (null == propertyValue)\r\n            {\r\n                builder.Append(propertyName);\r\n                builder.Append(\"=null\");\r\n            }\r\n            else\r\n            {\r\n                builder.Append(propertyName);\r\n                builder.Append(_unencodedEqualAndValueMarker);\r\n                builder.Append(Escape(propertyValue));\r\n                builder.Append(_unencodedValueMarker);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, string propertyValue)\r\n        {\r\n            SerializeKeyValuePair<string>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string DeserializeValue<PT>(string stringRepresentation, string deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(string);\r\n            }\r\n\r\n            return Unescape(stringRepresentation);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string DeserializeValueString(string stringRepresentation)\r\n        {\r\n            return DeserializeValue<string>(stringRepresentation, \"\");\r\n        }\r\n        #endregion\r\n\r\n        #region Generic type\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair<PT>(StringBuilder builder, string propertyName, PT propertyValue)\r\n        {\r\n            if (null == propertyValue)\r\n            {\r\n                builder.Append(propertyName);\r\n                builder.Append(\"=null\");\r\n            }\r\n            else\r\n            {\r\n                TypeConverter tc = TypeDescriptor.GetConverter(typeof(PT));\r\n\r\n                builder.Append(propertyName);\r\n                builder.Append(_unencodedEqualAndValueMarker);\r\n                builder.Append(Escape(tc.ConvertToString(propertyValue)));\r\n                builder.Append(_unencodedValueMarker);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static PT DeserializeValue<PT>(string stringRepresentation, PT deserializationTarget)\r\n        {\r\n            if (stringRepresentation == null)\r\n            {\r\n                return default(PT);\r\n            }\r\n\r\n            TypeConverter tc = TypeDescriptor.GetConverter(typeof(PT));\r\n            return (PT)tc.ConvertFromString(Unescape(stringRepresentation));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static PT DeserializeValue<PT>(string stringRepresentation)\r\n            where PT : class\r\n        {\r\n            return DeserializeValue<PT>(stringRepresentation, (PT)null);\r\n        }\r\n        #endregion\r\n\r\n\r\n        #region array ([])\r\n        /// <exclude />\r\n        public static void SerializeKeyValueArrayPair<PT>(StringBuilder builder, string propertyName, PT[] propertyValue)\r\n        {\r\n            if (null != propertyValue)\r\n            {\r\n                TypeConverter tc = TypeDescriptor.GetConverter(typeof(PT));\r\n\r\n                Converter<PT, string> innerConverter = new Converter<PT, string>(\r\n                    delegate(PT target)\r\n                    {\r\n                        return Escape(tc.ConvertToString(target));\r\n                    }\r\n                );\r\n\r\n                string[] valuesAsStringArray = Array.ConvertAll<PT, string>(propertyValue as PT[], innerConverter);\r\n\r\n                StringBuilder sb = new StringBuilder();\r\n                bool isFirst = true;\r\n\r\n                foreach (string value in valuesAsStringArray)\r\n                {\r\n                    if (isFirst)\r\n                    {\r\n                        isFirst = false;\r\n                    }\r\n                    {\r\n                        sb.Append(\", \");\r\n                    }\r\n\r\n                    sb.Append(string.Format(\"{0}{1}{0}\", _unencodedValueMarker, value));\r\n                }\r\n\r\n                builder.Append(propertyName);\r\n                builder.Append(_unencodedEqualAndValueMarker);\r\n                builder.Append(Escape(sb.ToString()));\r\n                builder.Append(_unencodedValueMarker);\r\n            }\r\n            else\r\n            {\r\n                // null value\r\n                builder.Append(propertyName);\r\n                builder.Append(\"=null\");\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValueArrayPair<PT>(StringBuilder builder, string propertyName, PT[] propertyValue,IEnumerable<string> filterProperties)\r\n        {\r\n            if (filterProperties != null && !filterProperties.Contains(propertyName))\r\n                return;\r\n            SerializeKeyValueArrayPair<PT>(builder, propertyName, propertyValue);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static PT[] DeserializeValueArray<PT>(string stringRepresentation, PT[] deserializationTarget)\r\n        {\r\n            if (stringRepresentation != null)\r\n            {\r\n                string unescapedStringRepresentation = Unescape(stringRepresentation);\r\n\r\n                string[] valuesAsStringArray = ParseElementList(unescapedStringRepresentation);\r\n\r\n                TypeConverter tc = TypeDescriptor.GetConverter(typeof(PT));\r\n\r\n                Converter<string, PT> innerConverter = new Converter<string, PT>(\r\n                    delegate(string source)\r\n                    {\r\n                        return (PT)tc.ConvertFromString(Unescape(source));\r\n                    }\r\n                );\r\n\r\n                PT[] resultArray = Array.ConvertAll<string, PT>(valuesAsStringArray, innerConverter);\r\n\r\n                return resultArray;\r\n            }\r\n            else\r\n            {\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static PT[] DeserializeValueArray<PT>(string stringRepresentation)\r\n        {\r\n            return DeserializeValueArray<PT>(stringRepresentation, (PT[])null);\r\n        }\r\n        #endregion\r\n\r\n\r\n        /// <exclude />\r\n        public static void SerializeKeyValuePair(StringBuilder builder, string propertyName, object propertyValue, Type propertyType)\r\n        {\r\n            Func<Type, MethodInfo> factory = f =>\r\n            {\r\n                MethodInfo method =\r\n                    (from mi in typeof(StringConversionServices).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                     where mi.Name == \"SerializeKeyValuePair\" &&\r\n                           mi.IsGenericMethodDefinition &&\r\n                           mi.GetParameters().Length == 3 &&\r\n                           mi.GetParameters()[2].ParameterType.IsGenericParameter \r\n                     select mi).SingleOrDefault();\r\n\r\n                method = method.MakeGenericMethod(new Type[] { f });\r\n\r\n                return method;\r\n            };\r\n\r\n            MethodInfo methodInfo = _serializeKeyValuePairMethodInfoCache.GetOrAdd(propertyType, factory);\r\n\r\n            methodInfo.Invoke(null, new object[] { builder, propertyName, propertyValue });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static object DeserializeValue(string stringRepresentation, Type propertyType)\r\n        {\r\n            Func<Type, MethodInfo> factory = f =>\r\n            {\r\n                MethodInfo method =\r\n                    (from mi in typeof(StringConversionServices).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                     where mi.Name == \"DeserializeValue\" &&\r\n                           mi.IsGenericMethodDefinition &&\r\n                           mi.GetParameters().Length == 2 &&\r\n                           mi.GetParameters()[1].ParameterType.IsGenericParameter \r\n                     select mi).SingleOrDefault();                \r\n\r\n                method = method.MakeGenericMethod(new Type[] { f });\r\n\r\n                return method;\r\n            };\r\n\r\n            object defaultValue;\r\n            if (propertyType == typeof(Guid)) defaultValue = default(Guid);\r\n            else if (propertyType == typeof(string)) defaultValue = default(string);\r\n            else if (propertyType == typeof(int)) defaultValue = default(int);\r\n            else if (propertyType == typeof(DateTime)) defaultValue = default(DateTime);\r\n            else if (propertyType == typeof(bool)) defaultValue = default(bool);\r\n            else if (propertyType == typeof(decimal)) defaultValue = default(decimal);\r\n            else if (propertyType == typeof(long)) defaultValue = default(long);\r\n            else defaultValue = null;\r\n\r\n            MethodInfo methodInfo = _deserializeValueMethodInfoCache.GetOrAdd(propertyType, factory);\r\n            \r\n            object result = methodInfo.Invoke(null, new object[] { stringRepresentation, defaultValue });\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<string, string> ParseKeyValueCollection(string keyValueCollectionString)\r\n        {\r\n            Dictionary<string, string> parsed = new Dictionary<string, string>();\r\n\r\n            MatchCollection matches = _keyValuePairRegEx.Matches(keyValueCollectionString);\r\n\r\n            foreach (Match m in matches)\r\n            {\r\n                string key = m.Groups[\"Key\"].Value;\r\n\r\n                if (m.Groups[\"IsNull\"].Value == \"null\")\r\n                {\r\n                    parsed.Add(key, null);\r\n                }\r\n                else\r\n                {\r\n                    string value = m.Groups[\"Value\"].Value;\r\n\r\n                    parsed.Add(key, value);\r\n                }\r\n            }\r\n\r\n            return parsed;\r\n        }\r\n\r\n\r\n        private static string[] ParseElementList(string elements)\r\n        {\r\n            MatchCollection matches = _listElementRegEx.Matches(elements);\r\n\r\n            string[] result = new string[matches.Count];\r\n\r\n            int i = 0;\r\n            foreach (Match m in matches)\r\n            {\r\n                result[i++] = m.Groups[\"Value\"].Value;\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        private static string Escape(string sourceString)\r\n        {\r\n            return Regex.Escape(sourceString).Replace(_unencodedValueMarker, _encodedValueMarker);\r\n        }\r\n\r\n\r\n        private static string Unescape(string escapedStringRepresentation)\r\n        {\r\n            return Regex.Unescape(escapedStringRepresentation.Replace(_encodedValueMarker, _unencodedValueMarker));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SystemCollectionValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal sealed class SystemCollectionValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n            if (xmlSerializer == null) throw new ArgumentNullException(\"xmlSerializer\");\r\n\r\n            serializedObject = null;\r\n\r\n\r\n            bool isArray = objectToSerializeType.IsArray;\r\n            if (!objectToSerializeType.IsGenericType && !isArray) return false;\r\n\r\n            if (isArray)\r\n            {\r\n                objectToSerializeType = objectToSerializeType.GetInterfaces()\r\n                    .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof (ICollection<>));\r\n\r\n                if (objectToSerializeType == null)\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n            \r\n            Type genericType = objectToSerializeType.GetGenericTypeDefinition();\r\n\r\n            MethodInfo methodInfo;\r\n\r\n            if (genericType == typeof(List<>) || genericType == typeof(ICollection<>))\r\n            {\r\n                methodInfo = StaticReflection.GetGenericMethodInfo(o => SerializeCollection<object>(null, null));\r\n            }\r\n            else if (genericType == typeof(Dictionary<,>))\r\n            {\r\n                methodInfo = StaticReflection.GetGenericMethodInfo(o => SerializeDictionary<object, object>(null, null));\r\n            }\r\n            else if (genericType == typeof(KeyValuePair<,>))\r\n            {\r\n                methodInfo = StaticReflection.GetGenericMethodInfo(o => SerializeKeyValuePair(new KeyValuePair<object, object>(), null));\r\n            }\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n\r\n            methodInfo = methodInfo.MakeGenericMethod(objectToSerializeType.GetGenericArguments());\r\n\r\n            XElement result = methodInfo.Invoke(null, new object[] { objectToSerialize, xmlSerializer }) as XElement;\r\n            string serializedType = TypeManager.SerializeType(objectToSerializeType);\r\n\r\n            result.Add(new XAttribute(\"type\", serializedType));\r\n            serializedObject = result;\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n            if (xmlSerializer == null) throw new ArgumentNullException(\"xmlSerializer\");\r\n\r\n            deserializedObject = null;\r\n\r\n            XAttribute typeAttribute = serializedObject.Attribute(\"type\");\r\n            if (typeAttribute == null) return false;\r\n\r\n            Type type = TypeManager.GetType(typeAttribute.Value);\r\n\r\n            if (type.IsGenericType == false) return false;\r\n            Type genericType = type.GetGenericTypeDefinition();\r\n\r\n\r\n            MethodInfo methodInfo;\r\n\r\n            if (genericType == typeof(List<>))\r\n            {\r\n                methodInfo = StaticReflection.GetGenericMethodInfo(o => DeserializeList<object>(null, null));\r\n            }\r\n            else if (genericType == typeof(Dictionary<,>))\r\n            {\r\n                methodInfo = StaticReflection.GetGenericMethodInfo(o => DeserializeDictionary<object, object>(null, null));\r\n            }\r\n            else if (genericType == typeof(KeyValuePair<,>))\r\n            {\r\n                methodInfo = StaticReflection.GetGenericMethodInfo(o => DeserializeKeyValuePair<object, object>(null, null));\r\n            }\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n\r\n            methodInfo = methodInfo.MakeGenericMethod(type.GetGenericArguments());\r\n\r\n            try\r\n            {\r\n                object result = methodInfo.Invoke(null, new object[] { serializedObject, xmlSerializer });\r\n                if (result != null)\r\n                {\r\n                    deserializedObject = result;\r\n                    return true;\r\n                }\r\n                \r\n                return false;\r\n            }\r\n            catch (TargetInvocationException exception)\r\n            {\r\n                if (exception.InnerException is DataSerilizationException)\r\n                {\r\n                    throw exception.InnerException;\r\n                }\r\n                \r\n                return false;\r\n            }\r\n            catch (Exception)\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        private static XElement SerializeCollection<T>(ICollection<T> listToSerialize, IXmlSerializer xmlSerializer)\r\n        {\r\n            XElement result = new XElement(\"List\");\r\n\r\n            if (listToSerialize == null) return result;\r\n\r\n            foreach (T itemValue in listToSerialize)\r\n            {\r\n                XElement serializedItemValue = xmlSerializer.Serialize(typeof(T), itemValue);\r\n\r\n                result.Add(serializedItemValue);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static List<T> DeserializeList<T>(XElement serializedObject, IXmlSerializer xmlSerializer)\r\n        {\r\n            if (serializedObject.Name.LocalName != \"List\") return null;\r\n\r\n            List<T> result = new List<T>();\r\n\r\n            foreach (XElement childElement in serializedObject.Elements())\r\n            {\r\n                object childValue = xmlSerializer.Deserialize(childElement);\r\n\r\n                result.Add((T)childValue);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static XElement SerializeDictionary<TKey, TValue>(Dictionary<TKey, TValue> dictionaryToSerialize, IXmlSerializer xmlSerializer)\r\n        {\r\n            XElement result = new XElement(\"Dictionary\");\r\n\r\n            foreach (KeyValuePair<TKey, TValue> kvp in dictionaryToSerialize)\r\n            {\r\n                XElement serializedKey = xmlSerializer.Serialize(typeof(TKey), kvp.Key);\r\n                XElement serializedValue = xmlSerializer.Serialize(typeof(TValue), kvp.Value);\r\n\r\n                result.Add(new XElement(\"KeyPair\",\r\n                    new XElement(\"Key\", serializedKey),\r\n                    new XElement(\"Value\", serializedValue)));\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static Dictionary<TKey, TValue> DeserializeDictionary<TKey, TValue>(XElement serializedObject, IXmlSerializer xmlSerializer)\r\n        {\r\n            if (serializedObject.Name.LocalName != \"Dictionary\") return null;\r\n\r\n            Dictionary<TKey, TValue> result = new Dictionary<TKey, TValue>();\r\n\r\n            foreach (XElement childElement in serializedObject.Elements(\"KeyPair\"))\r\n            {\r\n                XElement keyElement = childElement.Element(\"Key\");\r\n                if (keyElement == null) return null;\r\n                object keyValue = xmlSerializer.Deserialize(keyElement.Elements().Single());\r\n\r\n                XElement valueElement = childElement.Element(\"Value\");\r\n                if (valueElement == null) return null;\r\n                object valueValue = xmlSerializer.Deserialize(valueElement.Elements().Single());\r\n\r\n                result.Add((TKey)keyValue, (TValue)valueValue);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static XElement SerializeKeyValuePair<TKey, TValue>(KeyValuePair<TKey, TValue> KeyValuePairToSerialize, IXmlSerializer xmlSerializer)\r\n        {\r\n            XElement result = new XElement(\"KeyValuePair\");\r\n\r\n            XElement serializedKey = xmlSerializer.Serialize(typeof(TKey), KeyValuePairToSerialize.Key);\r\n            XElement serializedValue = xmlSerializer.Serialize(typeof(TValue), KeyValuePairToSerialize.Value);\r\n\r\n            result.Add(new XElement(\"Key\", serializedKey));\r\n            result.Add(new XElement(\"Value\", serializedValue));\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static KeyValuePair<TKey, TValue> DeserializeKeyValuePair<TKey, TValue>(XElement serializedObject, IXmlSerializer xmlSerializer)\r\n        {\r\n            if (serializedObject.Name.LocalName != \"KeyValuePair\") throw new InvalidOperationException();\r\n\r\n            XElement keyElement = serializedObject.Element(\"Key\");\r\n            if (keyElement == null) throw new InvalidOperationException();\r\n            object keyValue = xmlSerializer.Deserialize(keyElement.Elements().Single());\r\n\r\n            XElement valueElement = serializedObject.Element(\"Value\");\r\n            if (valueElement == null) throw new InvalidOperationException();\r\n            object valueValue = xmlSerializer.Deserialize(valueElement.Elements().Single());\r\n\r\n            KeyValuePair<TKey, TValue> result = new KeyValuePair<TKey, TValue>((TKey)keyValue, (TValue)valueValue);\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SystemPrimitivValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal sealed class SystemPrimitivValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n\r\n            if ((objectToSerializeType != typeof(int)) &&\r\n                (objectToSerializeType != typeof(long)) &&\r\n                (objectToSerializeType != typeof(bool)) &&\r\n                (objectToSerializeType != typeof(string)) &&\r\n                (objectToSerializeType != typeof(double)) &&\r\n                (objectToSerializeType != typeof(decimal)) &&\r\n                (objectToSerializeType != typeof(Guid)) &&\r\n                (objectToSerializeType != typeof(DateTime)))\r\n            {\r\n                serializedObject = null;\r\n                return false;\r\n            }\r\n\r\n            serializedObject = new XElement(\"Value\");\r\n\r\n            string serializedType = TypeManager.SerializeType(objectToSerializeType);\r\n\r\n            serializedObject.Add(new XAttribute(\"type\", serializedType));\r\n\r\n            if (objectToSerialize != null)\r\n            {\r\n                serializedObject.Add(new XAttribute(\"value\", objectToSerialize));\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject.Name.LocalName != \"Value\") return false;\r\n\r\n            XAttribute typeAttribute = serializedObject.Attribute(\"type\");\r\n            if (typeAttribute == null) return false;\r\n\r\n            XAttribute valueAttribute = serializedObject.Attribute(\"value\");\r\n            if (valueAttribute == null) return true;\r\n\r\n            Type type = TypeManager.GetType(typeAttribute.Value);\r\n\r\n            if (type == typeof(int)) deserializedObject = (int)valueAttribute;\r\n            else if (type == typeof(long)) deserializedObject = (long)valueAttribute;\r\n            else if (type == typeof(bool)) deserializedObject = (bool)valueAttribute;\r\n            else if (type == typeof(string)) deserializedObject = (string)valueAttribute;\r\n            else if (type == typeof(double)) deserializedObject = (double)valueAttribute;\r\n            else if (type == typeof(decimal)) deserializedObject = (decimal)valueAttribute;\r\n            else if (type == typeof(Guid)) deserializedObject = (Guid)valueAttribute;\r\n            else if (type == typeof(DateTime)) deserializedObject = (DateTime)valueAttribute;\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SystemSerializableValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization.Formatters.Binary;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal sealed class SystemSerializableValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n\r\n            serializedObject = null;\r\n\r\n            int attributeCount = objectToSerializeType.GetCustomAttributes(typeof(SerializableAttribute), false).Length;\r\n\r\n            if (attributeCount > 0) \r\n            {\r\n                serializedObject = new XElement(\"Serializable\");\r\n\r\n                if (objectToSerialize != null)\r\n                {\r\n                    using (MemoryStream ms = new MemoryStream())\r\n                    {\r\n                        BinaryFormatter binaryFormatter = new BinaryFormatter();\r\n                        binaryFormatter.Serialize(ms, objectToSerialize);\r\n\r\n                        ms.Seek(0, SeekOrigin.Begin);\r\n\r\n                        using (BinaryReader br = new BinaryReader(ms))\r\n                        {\r\n                            byte[] bytes = br.ReadBytes((int)ms.Length);\r\n\r\n                            string result = Convert.ToBase64String(bytes);\r\n\r\n                            serializedObject.Add(new XAttribute(\"value\", result));\r\n                        }\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    serializedObject.Add(new XAttribute(\"type\", TypeManager.SerializeType(objectToSerializeType)));\r\n                }\r\n\r\n                return true;\r\n            }\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n            if (serializedObject.Name.LocalName != \"Serializable\") return false;\r\n\r\n            \r\n\r\n            XAttribute typeAttribute = serializedObject.Attribute(\"type\");\r\n            XAttribute valueAttribute = serializedObject.Attribute(\"value\");\r\n            \r\n            if ((valueAttribute == null) && (typeAttribute != null))\r\n            {\r\n                Type type = TypeManager.GetType(typeAttribute.Value);\r\n                int attributeCount = type.GetCustomAttributes(typeof(SerializableAttribute), false).Length;\r\n\r\n                if (attributeCount > 0)\r\n                {\r\n                    return true;\r\n                }\r\n                else\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n            else if ((valueAttribute != null) && (typeAttribute == null))\r\n            {\r\n                byte[] bytes = Convert.FromBase64String(valueAttribute.Value);\r\n                using (MemoryStream ms = new MemoryStream(bytes))\r\n                {\r\n                    BinaryFormatter binaryFormatter = new BinaryFormatter();\r\n\r\n                    deserializedObject = binaryFormatter.Deserialize(ms);\r\n\r\n                    return true;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/SystemTypesValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core.Types;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal sealed class SystemTypesValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n\r\n            if ((objectToSerializeType == typeof(Type)) ||\r\n                (objectToSerializeType == typeof(Type).GetType()))\r\n            {\r\n\r\n                serializedObject = new XElement(\"Value\");\r\n\r\n                string serializedType = TypeManager.SerializeType(typeof(Type));\r\n                serializedObject.Add(new XAttribute(\"type\", serializedType));\r\n\r\n                if (objectToSerialize != null)\r\n                {\r\n                    serializedObject.Add(new XAttribute(\"value\", TypeManager.SerializeType((Type)objectToSerialize)));\r\n                }\r\n\r\n                return true;\r\n\r\n            }\r\n            else\r\n            {\r\n                serializedObject = null;\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject.Name.LocalName != \"Value\") return false;\r\n\r\n            XAttribute typeAttribute = serializedObject.Attribute(\"type\");\r\n            if (typeAttribute == null) return false;\r\n\r\n            XAttribute valueAttribute = serializedObject.Attribute(\"value\");\r\n            if (valueAttribute == null) return true;\r\n\r\n            Type type = TypeManager.GetType(typeAttribute.Value);\r\n\r\n            if (type == typeof(Type))\r\n            {\r\n                deserializedObject = TypeManager.GetType(valueAttribute.Value);\r\n                return true;\r\n            }\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n\r\n            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Serialization/XmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.Serialization\r\n{\r\n    internal sealed class XmlSerializer : IXmlSerializer\r\n    {\r\n        IEnumerable<IValueXmlSerializer> _valueXmlSerializers;\r\n\r\n\r\n\r\n        public XmlSerializer(IEnumerable<IValueXmlSerializer> valueXmlSerializers)\r\n        {\r\n            if (valueXmlSerializers == null) throw new ArgumentNullException(\"valueXmlSerializers\");\r\n\r\n            _valueXmlSerializers = valueXmlSerializers.ToList();\r\n        }\r\n\r\n\r\n\r\n        public static IXmlSerializer CreateStandardSerializer()\r\n        {\r\n            return new XmlSerializer(new IValueXmlSerializer[]\r\n                {\r\n                    new SystemPrimitivValueXmlSerializer(),\r\n                    new SystemCollectionValueXmlSerializer()\r\n                });\r\n        }\r\n\r\n\r\n\r\n        public XElement Serialize(Type objectToSerializeType, object objectToSerialize)\r\n        {\r\n            if (objectToSerializeType == typeof(object)) \r\n            {\r\n                if (objectToSerialize != null)\r\n                {\r\n                    objectToSerializeType = objectToSerialize.GetType();\r\n                }\r\n                else\r\n                {\r\n                    return new XElement(\"Null\");\r\n                }\r\n            }\r\n\r\n\r\n            XElement serializedObject;\r\n            foreach (IValueXmlSerializer valueXmlSerializer in _valueXmlSerializers)\r\n            {\r\n                if (valueXmlSerializer.TrySerialize(objectToSerializeType, objectToSerialize, this, out serializedObject))\r\n                {\r\n                    return serializedObject;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException(string.Format(\"Could not serialize object of type '{0}'\", objectToSerializeType));\r\n        }\r\n\r\n\r\n\r\n        public object Deserialize(XElement serializedObject)\r\n        {\r\n            if (serializedObject.Name.LocalName == \"Null\")\r\n            {\r\n                return null;\r\n            }\r\n\r\n            object deserializedObject;\r\n            foreach (IValueXmlSerializer valueXmlSerializer in _valueXmlSerializers)\r\n            {\r\n                if (valueXmlSerializer.TryDeserialize(serializedObject, this, out deserializedObject))\r\n                {\r\n                    return deserializedObject;\r\n                }\r\n            }\r\n\r\n            string serializedObjectStr = serializedObject.ToString();\r\n\r\n\r\n            // If necessary, cutting the size, since otherwise it may lead to megabyte long exception text\r\n            if(serializedObjectStr.Length > 10000)\r\n            {\r\n                serializedObjectStr = serializedObjectStr.Substring(0, 10000);\r\n            }\r\n            throw new InvalidOperationException(string.Format(\"Could not deserialize '{0}'\", serializedObjectStr));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/ServiceLocator.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Threading;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Composite.Core\r\n{\r\n    /// <summary>\r\n    /// A mechanism for retrieving a service objects; that is, an object that provides custom support to other objects.\r\n    /// \r\n    /// To register a service, see <see cref=\"Composite.Core.Application.ApplicationStartupAttribute\"/> \r\n    /// </summary>\r\n    /// <remarks>\r\n    /// The underlying plumbing is from <see cref=\"Microsoft.Extensions.DependencyInjection\"/>.\r\n    /// </remarks>\r\n    public static class ServiceLocator\r\n    {\r\n        private const string HttpContextKey = \"HttpApplication.ServiceScope\";\r\n        private const string ThreadDataKey = \"HttpApplication.ServiceScope\";\r\n        private static IServiceCollection _serviceCollection = new ServiceCollection();\r\n        private static IServiceProvider _serviceProvider;\r\n        private static ConcurrentDictionary<Type, bool> _hasTypeLookup = new ConcurrentDictionary<Type, bool>();\r\n        private static Func<IServiceCollection, IServiceProvider> _serviceProviderBuilder = s =>\r\n        {\r\n            var configurationSection = (CompilationSection)WebConfigurationManager.GetSection(\"system.web/compilation\");\r\n\r\n            return s.BuildServiceProvider(validateScopes: configurationSection?.Debug ?? false);\r\n        };\r\n\r\n        /// <summary>\r\n        /// Get service of type T\r\n        /// </summary>\r\n        /// <typeparam name=\"T\">The type of service object to get</typeparam>\r\n        /// <returns>A service object of type T or null if there is no such service</returns>\r\n        public static T GetService<T>()\r\n        {\r\n            return ServiceProvider.GetService<T>();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Get service of type T\r\n        /// </summary>\r\n        /// <typeparam name=\"T\">The type of service object to get</typeparam>\r\n        /// <exception cref=\"System.InvalidOperationException\">There is no service of type T</exception>\r\n        /// <returns>A service object of type T or null if there is no such service</returns>\r\n        public static T GetRequiredService<T>()\r\n        {\r\n            return ServiceProvider.GetRequiredService<T>();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Get services of type T\r\n        /// </summary>\r\n        /// <typeparam name=\"T\">The type of service objects to get</typeparam>\r\n        /// <returns>An enumerable of service objects of type T</returns>\r\n        public static IEnumerable<T> GetServices<T>()\r\n        {\r\n            return ServiceProvider.GetServices<T>();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Get service of the specified type\r\n        /// </summary>\r\n        /// <param name=\"serviceType\">The type of service object to get</param>\r\n        /// <returns>A service object of type serviceType or null if there is no such service</returns>\r\n        public static object GetService(Type serviceType)\r\n        {\r\n            return ServiceProvider.GetService(serviceType);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Get service of the specified type\r\n        /// </summary>\r\n        /// <param name=\"serviceType\">The type of service object to get</param>\r\n        /// <exception cref=\"System.InvalidOperationException\">There is no service of type serviceType</exception>\r\n        /// <returns>A service object of type serviceType</returns>\r\n        public static object GetRequiredService(Type serviceType)\r\n        {\r\n            return ServiceProvider.GetRequiredService(serviceType);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Get services of the specified type\r\n        /// </summary>\r\n        /// <param name=\"serviceType\">The type of service objects to get</param>\r\n        /// <returns>An enumerable of service objects of type serviceType</returns>\r\n        public static IEnumerable<object> GetServices(Type serviceType)\r\n        {\r\n            return ServiceProvider.GetServices(serviceType);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Replaces the default services container by registering a builder for your own IServiceProvider.\r\n        /// You must register this during the service configuration phase, see <see cref=\"Composite.Core.Application.ApplicationStartupAttribute\"/> and the ConfigureServices method.\r\n        /// </summary>\r\n        /// <param name=\"serviceProviderBuilder\">A callback function that returns your custom IServiceProvider</param>\r\n        public static void SetServiceProvider(Func<IServiceCollection, IServiceProvider> serviceProviderBuilder)\r\n        {\r\n            Verify.ArgumentNotNull(serviceProviderBuilder, nameof(serviceProviderBuilder));\r\n            Verify.IsNull(_serviceProvider, \"ServiceProvider already created and cannot be replaced at this time. Your custom ServiceProvider must be set during application startup - see ApplicationStartupAttribute and ConfigureServices().\");\r\n\r\n            _serviceProviderBuilder = serviceProviderBuilder;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets an application service provider\r\n        /// </summary>\r\n        public static IServiceProvider ServiceProvider\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_serviceProvider,\"IServiceProvider not build - call out of expected sequence.\");\r\n\r\n                return RequestScopedServiceProvider ?? _serviceProvider;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static bool HasService(Type serviceType)\r\n        {\r\n            Verify.ArgumentNotNull(serviceType, nameof(serviceType));\r\n\r\n            if (ServiceLocatorNotInitialized)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            Verify.IsNotNull(_serviceProvider, \"IServiceProvider not build - call out of expected sequence.\");\r\n\r\n            bool hasType;\r\n\r\n            if (!_hasTypeLookup.TryGetValue(serviceType, out hasType))\r\n            {\r\n                if (_serviceCollection.Any(sd =>\r\n                    sd.ServiceType.IsAssignableFrom(serviceType)\r\n                || (serviceType.IsGenericType\r\n                    && sd.ServiceType.IsAssignableFrom(serviceType.GetGenericTypeDefinition()))))\r\n                {\r\n                    hasType = true;\r\n                }\r\n                else\r\n                {\r\n                    try\r\n                    {\r\n                        hasType = ServiceProvider.GetService(serviceType) != null;\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        hasType = false;\r\n                    }\r\n                }\r\n\r\n                _hasTypeLookup.TryAdd(serviceType, hasType);\r\n            }\r\n\r\n            return hasType;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// A service collection to be populated at startup\r\n        /// </summary>\r\n        internal static IServiceCollection ServiceCollection\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNull(_serviceProvider, \"ServiceCollection accessed after ServiceProvider build-up - call out of sequence.\");\r\n\r\n                return _serviceCollection;\r\n            }\r\n        }\r\n\r\n\r\n        internal static void BuildServiceProvider()\r\n        {\r\n            _serviceProvider = _serviceProviderBuilder(_serviceCollection);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a service scope associated with the current http context\r\n        /// </summary>\r\n        internal static void CreateRequestServicesScope(HttpContext context)\r\n        {\r\n            Verify.ArgumentNotNull(context, nameof(context));\r\n            Verify.IsNotNull(_serviceProvider, \"ServiceProvider not initialized yet\");\r\n            Verify.IsNull(context.Items[HttpContextKey], \"Multiple calls to CreateRequestServicesScope unexpected\");\r\n\r\n            var serviceScopeFactory = (IServiceScopeFactory)_serviceProvider.GetService(typeof(IServiceScopeFactory));\r\n            var serviceScope = serviceScopeFactory.CreateScope();\r\n\r\n            context.Items[HttpContextKey] = serviceScope;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Disposes a service scope associated with the current http context\r\n        /// </summary>\r\n        internal static void DisposeRequestServicesScope(HttpContext context)\r\n        {\r\n            Verify.ArgumentNotNull(context, nameof(context));\r\n            var scope = (IServiceScope)context.Items[HttpContextKey];\r\n            if (scope != null)\r\n            {\r\n                scope.Dispose();\r\n                context.Items.Remove(HttpContextKey);\r\n            }\r\n        }\r\n\r\n        internal static IDisposable EnsureThreadDataServiceScope()\r\n        {\r\n            if (RequestScopedServiceProvider != null || ServiceLocatorNotInitialized) return EmptyDisposable.Instance;\r\n\r\n            var current = ThreadDataManager.GetCurrentNotNull();\r\n\r\n            var serviceScopeFactory = (IServiceScopeFactory)_serviceProvider.GetService(typeof(IServiceScopeFactory));\r\n            var serviceScope = serviceScopeFactory.CreateScope();\r\n\r\n            current.SetValue(ThreadDataKey, serviceScope);\r\n\r\n            return new ThreadDataServiceScopeDisposable(current);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Return a IServiceScope - if a scope has been initialized on the request (HttpContext) a scoped provider is returned.\r\n        /// </summary>\r\n        private static IServiceProvider RequestScopedServiceProvider\r\n        {\r\n            get\r\n            {\r\n                var context = HttpContext.Current;\r\n                if (context != null)\r\n                {\r\n                    var scope = (IServiceScope)context.Items[HttpContextKey];\r\n\r\n                    return scope?.ServiceProvider;\r\n                }\r\n\r\n                var threadData = ThreadDataManager.Current;\r\n                if (threadData != null)\r\n                {\r\n                    var scope = (IServiceScope) threadData[ThreadDataKey];\r\n                    return scope?.ServiceProvider;\r\n                }\r\n\r\n                return null;\r\n            }\r\n        }\r\n\r\n        private class ThreadDataServiceScopeDisposable : IDisposable\r\n        {\r\n            private readonly ThreadDataManagerData _threadData;\r\n\r\n            public ThreadDataServiceScopeDisposable(ThreadDataManagerData threadData)\r\n            {\r\n                _threadData = threadData;\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                var scope = (IServiceScope)_threadData[ThreadDataKey];\r\n\r\n                scope?.Dispose();\r\n                _threadData.SetValue(ThreadDataKey, null);\r\n            }\r\n        }\r\n\r\n        private static bool ServiceLocatorNotInitialized =>\r\n            !SystemSetupFacade.IsSystemFirstTimeInitialized || SystemSetupFacade.SetupIsRunning;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/SmtpMailer.cs",
    "content": "﻿using System.Net.Mail;\nusing System.Threading.Tasks;\n\nnamespace Composite.Core\n{\n    internal class SmtpMailer : IMailer\n    {\n        public void Send(MailMessage message)\n        {\n            using (var client = new SmtpClient())\n            {\n                client.Send(message);\n            }\n        }\n\n        public async Task SendAsync(MailMessage message)\n        {\n            using (var client = new SmtpClient())\n            {\n                await client.SendMailAsync(message);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Core/Sql/SqlConnectionManager.cs",
    "content": "﻿using System.Data.SqlClient;\r\nusing Composite.Core.Threading;\r\n\r\nnamespace Composite.Core.Sql\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class SqlConnectionManager\r\n\t{\r\n        /// <exclude />\r\n        public static SqlConnection GetConnection(string connectionString)\r\n        {\r\n            string threadDataKey = \"SqlDataContext\" + connectionString + \"_SqlConnection\";\r\n\r\n            var threadData = ThreadDataManager.GetCurrentNotNull();\r\n\r\n            SqlConnection connection;\r\n            if (threadData.HasValue(threadDataKey))\r\n            {\r\n                connection = threadData[threadDataKey] as SqlConnection;\r\n            }\r\n            else\r\n            {\r\n                connection = new SqlConnection(connectionString);\r\n                connection.Open();\r\n\r\n                threadData.SetValue(threadDataKey, connection);\r\n                threadData.OnDispose += connection.Close;\r\n            }\r\n            return connection;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Threading/ThreadCultureScope.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Globalization;\r\nusing System.Threading;\r\n\r\nnamespace Composite.Core.Threading\r\n{\r\n    /// <summary>\r\n    /// Will set the threads Culture and reset it to the original value when this is disposed of.\r\n    /// <example>\r\n    /// using( var cultureScope = new ThreadCultureScope( new CultureInfo(\"da-DK\") ) )\r\n    /// {\r\n    ///   // Code here will run in da-DK scope. \r\n    ///   // Culture in effect before the using statement will be reset when exiting the using.\r\n    /// }\r\n    /// </example>\r\n    /// </summary>\r\n    public sealed class ThreadCultureScope : IDisposable\r\n    {\r\n        private CultureInfo _originalCulture = null;\r\n        private CultureInfo _originalUiCulture = null;\r\n        private CultureInfo _desiredCulture = null;\r\n        private CultureInfo _desiredUiCulture = null;\r\n        private bool _disposed = false;\r\n\r\n        /// <summary>\r\n        /// Constructs a new culture scope, setting the threads CurrentCulture and resetting when this is disposed. The CurrentUiCulture is not affected.\r\n        /// </summary>\r\n        /// <param name=\"culture\">Desired culture to be in effect</param>\r\n        public ThreadCultureScope(CultureInfo culture)\r\n        {\r\n            _originalCulture = Thread.CurrentThread.CurrentCulture;\r\n            _desiredCulture = culture;\r\n\r\n            Thread.CurrentThread.CurrentCulture = culture;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new culture scope, setting the threads CurrentCulture and CurrentUiCulture and resetting when this is disposed.\r\n        /// </summary>\r\n        /// <param name=\"culture\">Desired culture to be in effect</param>\r\n        /// <param name=\"uiCulture\">Desired UI culture to be in effect</param>\r\n        public ThreadCultureScope(CultureInfo culture, CultureInfo uiCulture)\r\n            : this(culture)\r\n        {\r\n            _originalUiCulture = Thread.CurrentThread.CurrentUICulture;\r\n            _desiredUiCulture = uiCulture;\r\n\r\n            Thread.CurrentThread.CurrentUICulture = uiCulture;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The culture this class was constructed to use\r\n        /// </summary>\r\n        public CultureInfo Culture\r\n        {\r\n            get { return _desiredCulture; }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The UI culture this class was constructed to use or null if none were specified.\r\n        /// </summary>\r\n        public CultureInfo UiCulture\r\n        {\r\n            get { return _desiredUiCulture; }\r\n        }\r\n\r\n        \r\n        /// <summary>\r\n        /// Return thread culture settings to their original values.\r\n        /// </summary>\r\n        public void Dispose()\r\n        {\r\n            if (!_disposed)\r\n            {\r\n                if (_originalCulture!=null)\r\n                    Thread.CurrentThread.CurrentCulture = _originalCulture;\r\n\r\n                if (_originalUiCulture != null)\r\n                    Thread.CurrentThread.CurrentUICulture = _originalUiCulture;\r\n\r\n                _disposed = true;                \r\n            }\r\n\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~ThreadCultureScope()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Threading/ThreadDataManager.cs",
    "content": "using System;\r\nusing System.Web;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.Core.Threading\r\n{\r\n    /// <summary>    \r\n    /// This class coordinates data connections and ensures that multiple requests to SQL Server will reuse the same sql connection, allowing transactions to run without the use of MSDTC\r\n    /// </summary>\r\n    public static class ThreadDataManager\r\n    {\r\n        private static readonly string LogTitle = typeof(ThreadDataManager).Name;\r\n        private const string c_HttpContextItemsId = \"ThreadDataManager\";\r\n\r\n        [ThreadStatic]\r\n        private static ThreadDataManagerData _threadDataManagerData;\r\n\r\n        /// <summary>\r\n        /// Gets <see cref=\"Composite.Core.Threading.ThreadDataManagerData\" /> object for the current thread\r\n        /// </summary>\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public static ThreadDataManagerData Current\r\n        {\r\n            get\r\n            {\r\n                var currentContext = _threadDataManagerData;\r\n\r\n                if(currentContext != null)\r\n                {\r\n                    return currentContext;\r\n                }\r\n\r\n                var httpContext = HttpContext.Current;\r\n\r\n                if (httpContext != null)\r\n                {\r\n                    var data = httpContext.Items[c_HttpContextItemsId] as ThreadDataManagerData;\r\n\r\n                    if (data == null)\r\n                    {\r\n                        InitializeThroughHttpContext();\r\n\r\n                        data = httpContext.Items[c_HttpContextItemsId] as ThreadDataManagerData;\r\n\r\n                        Verify.That(data != null, \"Failed to initialize data through http context\");\r\n                    }\r\n\r\n                    return data;\r\n                }\r\n\r\n                return null;\r\n            }\r\n            internal set\r\n            {\r\n                _threadDataManagerData = value;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the current thread data, in the case of <see cref=\"Composite.Core.Threading.ThreadDataManager\" /> not being initialized it'll throw an exception\r\n        /// </summary>\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public static ThreadDataManagerData GetCurrentNotNull()\r\n        {\r\n            ThreadDataManagerData current = Current;\r\n            Verify.That(current != null, \r\n@\"ThreadDataManager hasn't been initialized in the current thread. You probably have forgotten to use Composite.Core.Threading.ThreadDataManager.EnsureInitialize() call on a custom created thread.\r\nExample of usage:\r\nusing(Composite.Core.Threading.ThreadDataManager.EnsureInitialize())\r\n{\r\n  // Code that works with C1 data layer goes here\r\n  .....\r\n}\");\r\n            current.CheckNotDisposed();\r\n\r\n            return current;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates  a new instance of <see cref=\"Composite.Core.Threading.ThreadDataManagerData\" /> object\r\n        /// </summary>\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public static ThreadDataManagerData CreateNew()\r\n        {\r\n            var current = Current;\r\n            current?.CheckNotDisposed();\r\n\r\n            return new ThreadDataManagerData(current);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public static IDisposable Initialize()\r\n        {\r\n            return new ThreadDataManagerScope(new ThreadDataManagerData(), true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public static IDisposable Initialize(ThreadDataManagerData parentThreadData)\r\n        {\r\n            parentThreadData?.CheckNotDisposed();\r\n\r\n            return new ThreadDataManagerScope(new ThreadDataManagerData(parentThreadData), true);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns an <see cref=\"System.IDisposable\" /> scope, checks that ThreadDataManager is initialized for the current thread, if not - does the initialization.\r\n        /// Should be called in all non ASP.NET threads, that are using C1 data API.\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (Composite.Core.Threading.ThreadDataManager.EnsureInitialize())\r\n        /// using (var conn = new DataConnection(PublicationScope.Published, new CultureInfo(\"en-US\")))\r\n        /// {\r\n        ///   var pages = conn.Get&lt;Composite.Data.Types.IPage&gt;();\t\r\n        ///   // ...\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <returns>An <see cref=\"System.IDisposable\" /> scope</returns>\r\n        public static IDisposable EnsureInitialize()\r\n        {\r\n            if (Current != null) return EmptyDisposable.Instance;\r\n\r\n            return Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public static void InitializeThroughHttpContext()\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            Verify.IsNotNull(httpContext, \"This can only be called from a thread started with a current http context\");\r\n\r\n            if (httpContext.Items[c_HttpContextItemsId] == null)\r\n            {\r\n                if (_threadDataManagerData != null)\r\n                {\r\n                    Log.LogCritical(LogTitle, \"ThreadData has already been initialized in the current thread. It's been reset to NULL value, resource leaks are possible.\");\r\n                    _threadDataManagerData = null;\r\n                }\r\n\r\n                var threadData = new ThreadDataManagerData();\r\n                httpContext.Items[c_HttpContextItemsId] = threadData;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        [Obsolete(\"Use the overload taking no parameters instead\")]\r\n        public static void InitializeThroughHttpContext(bool forceUserValidation)\r\n        {\r\n            InitializeThroughHttpContext();\r\n\r\n            if (forceUserValidation)\r\n            {\r\n                string username = LoginSessionStorePluginFacade.StoredUsername;\r\n            }\r\n        }\r\n\r\n\r\n        \r\n        /// <summary>\r\n        /// To be used only in Global.asax\r\n        /// </summary>\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public static void FinalizeThroughHttpContext()\r\n        {\r\n            if(_threadDataManagerData != null)\r\n            {\r\n                _threadDataManagerData = null;\r\n                Log.LogError(LogTitle, \"Thread data hasn't been disposed after request execution. Resource leaks are possible.\");\r\n            }\r\n\r\n\r\n            var httpContext = HttpContext.Current;\r\n\r\n            // Checking if ThreadData was initialized though HttpContext\r\n            var currentData = httpContext.Items[c_HttpContextItemsId] as IDisposable;\r\n            if (currentData != null)\r\n            {\r\n                httpContext.Items[c_HttpContextItemsId] = null;\r\n                try\r\n                {\r\n                    currentData.Dispose();\r\n                }\r\n                catch(Exception e)\r\n                {\r\n                    Log.LogError(LogTitle, e);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private sealed class ThreadDataManagerScope : IDisposable\r\n        {\r\n            private bool _disposed;\r\n            private readonly bool _disposeData;\r\n            private readonly ThreadDataManagerData _threadData;\r\n            private readonly ThreadDataManagerData _threadDataValueToBeRestored;\r\n\r\n\r\n            public ThreadDataManagerScope(ThreadDataManagerData newCurrentData, bool disposeData)\r\n            {\r\n                Verify.ArgumentNotNull(newCurrentData, \"newCurrentData\");\r\n                newCurrentData.CheckNotDisposed();\r\n\r\n                _threadData = newCurrentData;\r\n\r\n                // NOTE: We shouldn't take value from 'Current' property, since it may return it from HttpContext\r\n                _threadDataValueToBeRestored = _threadDataManagerData;\r\n                _threadDataManagerData = newCurrentData;\r\n\r\n                _disposeData = disposeData;\r\n            }\r\n\r\n\r\n            public void Dispose()\r\n            {\r\n                Dispose(true);\r\n                GC.SuppressFinalize(this);\r\n            }\r\n\r\n\r\n            public void Dispose(bool disposing)\r\n            {\r\n                if (disposing)\r\n                {\r\n                    try\r\n                    {\r\n                        if (_disposed) throw new ObjectDisposedException(typeof(ThreadDataManagerData).FullName);\r\n\r\n                        _disposed = true;\r\n\r\n                        if (_disposeData)\r\n                        {\r\n                            try\r\n                            {\r\n                                _threadData.Dispose();\r\n                            }\r\n                            catch (Exception e)\r\n                            {\r\n                                Log.LogError(LogTitle, e);\r\n                            }\r\n\r\n                            Verify.IsTrue(Current == _threadData,\r\n                                \"ThreadDataManager.Current points to a different thread data object!!!\");\r\n                        }\r\n                    }\r\n                    finally\r\n                    {\r\n                        _threadDataManagerData = _threadDataValueToBeRestored;\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    if (!_disposed && _disposeData)\r\n                    {\r\n                        try\r\n                        {\r\n                            _threadData.Dispose();\r\n                        }\r\n                        catch (Exception)\r\n                        {\r\n                            // silent...\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n#endif\r\n            ~ThreadDataManagerScope()\r\n            {\r\n#if LeakCheck\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n#endif\r\n                Dispose(false);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Threading/ThreadDataManagerData.cs",
    "content": "﻿using System.Threading;\r\nusing Composite.Core.Collections.Generic;\r\nusing System;\r\n\r\n\r\nnamespace Composite.Core.Threading\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ThreadDataManagerData: IDisposable\r\n    {\r\n        /// <exclude />\r\n        public ThreadDataManagerData Parent { get; set; }\r\n        private Hashtable<object, object> Data { get; set; }\r\n        private bool _disposed = false;\r\n\r\n\r\n        /// <exclude />\r\n        public ThreadDataManagerData()\r\n            : this(null)\r\n        {\r\n        }\r\n\r\n        internal delegate void OnThreadDataDisposedDelegate();\r\n\r\n        /// <exclude />\r\n        public event ThreadStart OnDispose;\r\n\r\n        /// <exclude />\r\n        public ThreadDataManagerData(ThreadDataManagerData parentThreadData)\r\n        {\r\n            this.Parent = parentThreadData;\r\n            this.Data = new Hashtable<object, object>();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will find the first one that contains the key and return the value\r\n        /// </summary>\r\n        /// <param name=\"key\"></param>\r\n        /// <param name=\"value\"></param>\r\n        /// <returns></returns>\r\n        public bool TryGetParentValue(object key, out object value)\r\n        {\r\n            CheckNotDisposed();\r\n\r\n            ThreadDataManagerData current = this;\r\n            while (current != null && !current.Data.ContainsKey(key))\r\n            {\r\n                current = current.Parent;\r\n            }\r\n\r\n            if (current == null)\r\n            {\r\n                value = null;\r\n                return false;\r\n            }\r\n\r\n            value = current.Data[key];\r\n            return true;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void SetValue(object key, object value)\r\n        {\r\n            CheckNotDisposed();\r\n\r\n            this.Data[key] = value;\r\n        }\r\n\r\n        /// <exclude />\r\n        public object GetValue(object key)\r\n        {\r\n            CheckNotDisposed();\r\n\r\n            return Data[key];\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool HasValue(object key)\r\n        {\r\n            CheckNotDisposed();\r\n\r\n            return this.Data.ContainsKey(key);\r\n        }\r\n\r\n        /// <exclude />\r\n        public object this[object key] => GetValue(key);\r\n\r\n        /// <exclude />\r\n        public void CheckNotDisposed()\r\n        {\r\n            if(_disposed) throw new ObjectDisposedException(\"TheadDataManagerData\");\r\n        }\r\n\r\n        #region IDisposable Members\r\n\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            OnDispose?.Invoke();\r\n            _disposed = true;\r\n\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~ThreadDataManagerData()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n        #endregion\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Threading/ThreadManager.cs",
    "content": "﻿using System.Threading;\r\n\r\n\r\nnamespace Composite.Core.Threading\r\n{\r\n    internal static class ThreadManager\r\n    {\r\n        public static ParameterizedThreadStart CreateThreadStart(ThreadStart threadStart)\r\n        {\r\n            return delegate(object parameter)\r\n            {\r\n                StartThreadData startThreadData = (StartThreadData)parameter;\r\n\r\n                using (ThreadDataManager.Initialize(startThreadData.Data))\r\n                {\r\n                    threadStart();\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n\r\n        public static ParameterizedThreadStart CreateParameterizedThreadStart(ParameterizedThreadStart parameterizedThreadStart)\r\n        {\r\n            return delegate(object parameter)\r\n            {\r\n                StartThreadData startThreadData = (StartThreadData)parameter;\r\n\r\n                using (ThreadDataManager.Initialize(startThreadData.Data))\r\n                {\r\n                    parameterizedThreadStart(startThreadData.Parameter);\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n\r\n        public static void StartThread(Thread thread)\r\n        {\r\n            ThreadDataManagerData data = ThreadDataManager.Current;\r\n\r\n            StartThreadData startThreadData = new StartThreadData\r\n            {\r\n                Data = data,\r\n            };\r\n\r\n            thread.Start(startThreadData);\r\n        }\r\n\r\n\r\n\r\n        public static void StartThread(Thread thread, object parameter)\r\n        {\r\n            ThreadDataManagerData data = ThreadDataManager.Current;\r\n\r\n            StartThreadData startThreadData = new StartThreadData\r\n            {\r\n                Data = data,\r\n                Parameter = parameter\r\n            };\r\n\r\n            thread.Start(startThreadData);\r\n        }\r\n\r\n\r\n\r\n        private sealed class StartThreadData\r\n        {\r\n            public ThreadDataManagerData Data { get; set; }\r\n            public object Parameter { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Threading/TwoPhaseFileLock.cs",
    "content": "﻿using System;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.IO;\r\nusing System.Threading;\r\n\r\n\r\nnamespace Composite.Core.Threading\r\n{\r\n    /// <summary>\r\n    /// Algorithm\r\n    /// \r\n    /// Initial:  None of the files exists. Enter is allowed. Leave is an exception.\r\n    ///    - Write phase one file\r\n    ///    - Delete phase two file\r\n    /// \r\n    /// Enter: Wait until phase two file exists and phase one does not exist. Other AD/Thread has left.\r\n    ///        Exception: Only wait for max ms\r\n    ///        - Write phase one file (Preventing other Enter's)\r\n    ///        - Delete phase two file\r\n    /// \r\n    /// Leave: If phase one file exists (if not => I have timed out)\r\n    ///        - Write phase two file (Allowes other Enter's)\r\n    ///        - Delete phase one file\r\n    /// \r\n    /// </summary>\r\n    internal class TwoPhaseFileLock\r\n    {\r\n        private string PhaseOneFilePath { get; set; }\r\n        private string PhaseTwoFilePath { get; set; }\r\n\r\n        public TwoPhaseFileLock(string id, string workDirectory)\r\n        {\r\n            Timeout = 45000;\r\n            PhaseOneFilePath = Path.Combine(workDirectory, id + \".entered\");\r\n            PhaseTwoFilePath = Path.Combine(workDirectory, id + \".left\");\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Time out time in ms. Default is 10000\r\n        /// </summary>\r\n        public int Timeout { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Acquires the lock.\r\n        /// </summary>\r\n        /// <returns>\r\n        /// Returns true if the lock was obtained successfully. \r\n        /// Returns false if the lock was acquried due to timeout.\r\n        /// </returns>\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public bool Acquire()\r\n        {                        \r\n            bool gotTheLock = false;\r\n            if (IsFirstTime())\r\n            {\r\n                gotTheLock = true;\r\n            }\r\n            else\r\n            {\r\n                gotTheLock = true;\r\n                int startTime = Environment.TickCount;\r\n\r\n                while (File.Exists(PhaseOneFilePath) && !File.Exists(PhaseTwoFilePath))\r\n                {\r\n                    Thread.Sleep(50);\r\n\r\n                    int timeElapsed = Environment.TickCount - startTime;\r\n                    if (timeElapsed >= Timeout)\r\n                    {\r\n                        gotTheLock = false;\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n\r\n            Log.LogInformation(\"TwoPhaseFileLock\", string.Format(\"AppDomain {0} acquiring the lock ({1})\", AppDomain.CurrentDomain.Id, gotTheLock));\r\n\r\n            File.WriteAllText(PhaseOneFilePath, \"\");\r\n            SafeDelete(PhaseTwoFilePath);\r\n\r\n            return gotTheLock;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Releases the lock.\r\n        /// </summary>\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void Release()\r\n        {\r\n            Log.LogInformation(\"TwoPhaseFileLock\", string.Format(\"AppDomain {0} releasing the lock\", AppDomain.CurrentDomain.Id));\r\n\r\n            if (IsFirstTime())\r\n            {\r\n                throw new InvalidOperationException(\"Releasing the lock is not allowed before it has been acquired!\");\r\n            }\r\n            if (File.Exists(PhaseOneFilePath))\r\n            {\r\n                File.WriteAllText(PhaseTwoFilePath, \"\");\r\n                SafeDelete(PhaseOneFilePath);\r\n            }\r\n        }\r\n\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        private bool IsFirstTime()\r\n        {\r\n            return !File.Exists(PhaseOneFilePath) && !File.Exists(PhaseTwoFilePath);\r\n        }\r\n\r\n\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        private static void SafeDelete(string filePath)\r\n        {\r\n            try\r\n            {\r\n                if (File.Exists(filePath))\r\n                {\r\n                    File.Delete(filePath);\r\n                }\r\n            }\r\n            catch (Exception)\r\n            {\r\n                // Ignore\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/AssemblyExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class AssemblyExtensionMethods\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<Type> GetTypes(this IEnumerable<Assembly> assemblies)\r\n        {\r\n            foreach (Assembly assembly in assemblies)\r\n            {\r\n                IEnumerable<Type> types = null;\r\n\r\n                try\r\n                {\r\n                    types = assembly.GetTypes();\r\n                }\r\n                catch\r\n                {\r\n                    // Ignore\r\n                }\r\n\r\n                if (types == null) continue;\r\n                \r\n                foreach (Type type in types)\r\n                {\r\n                    yield return type;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/AssemblyFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n\tpublic static class AssemblyFacade\r\n    {\r\n        private static readonly string LogTitle = typeof (AssemblyFacade).Name;\r\n        private static readonly Type RuntimeModuleType = typeof(Module).Assembly.GetType(\"System.Reflection.RuntimeModule\");\r\n\r\n        private static bool _compositeGeneratedErrorLogged;\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Assembly> GetLoadedAssembliesFromBin()\r\n        {\r\n            string binDirectory = PathUtil.Resolve(GlobalSettingsFacade.BinDirectory).ToLowerInvariant().Replace('\\\\', '/');\r\n\r\n            List<Assembly> assemblies = new List<Assembly>();\r\n            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())\r\n            {\r\n                if (assembly.IsDynamic) continue;\r\n\r\n                try\r\n                {\r\n                    string codebase = assembly.CodeBase.ToLowerInvariant();\r\n\r\n                    if (codebase.Contains(binDirectory))\r\n                    {\r\n                        assemblies.Add(assembly);\r\n                    }\r\n                }\r\n                catch\r\n                {\r\n                    // Ignore exceptions\r\n                }\r\n            }\r\n\r\n            return assemblies;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets list of file pathes of .NET dll files from \"~/Bin\" folder, excluding Composite.Generated.dll.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetAssembliesFromBin()\r\n        {\r\n            return GetAssembliesFromBin(false);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets list of file pathes of .NET dll files from \"~/Bin\" folder.\r\n        /// </summary>\r\n        /// <param name=\"includeCompositeGenerated\">if set to <c>true</c> Composite.Generated.dll will also be included.</param>\r\n        /// <returns></returns>\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetAssembliesFromBin(bool includeCompositeGenerated)\r\n        {\r\n            var assembliesFromBin = new List<string>();\r\n\r\n            foreach (string binFilePath in C1Directory.GetFiles(PathUtil.Resolve(GlobalSettingsFacade.BinDirectory), \"*.dll\")) {\r\n                string assemblyFileName = Path.GetFileName(binFilePath);\r\n\r\n                if (!includeCompositeGenerated)\r\n                {\r\n                    if (assemblyFileName.IndexOf(CodeGenerationManager.CompositeGeneratedFileName, StringComparison.OrdinalIgnoreCase) >= 0) continue;\r\n                }\r\n\r\n                if (IsDotNetAssembly(binFilePath)) {\r\n                    assembliesFromBin.Add(binFilePath);\r\n                }\r\n            }\r\n\r\n            return assembliesFromBin;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the Composite.Generated assembly from the  \"~/Bin\" folder\r\n        /// </summary>\r\n        /// <exclude />\r\n        public static Assembly GetGeneratedAssemblyFromBin()\r\n        {\r\n            foreach (string binFilePath in C1Directory.GetFiles(PathUtil.Resolve(GlobalSettingsFacade.BinDirectory), \"*.dll\"))\r\n            {\r\n                string assemblyFileName = Path.GetFileName(binFilePath);\r\n\r\n                if (assemblyFileName.IndexOf(CodeGenerationManager.CompositeGeneratedFileName, StringComparison.OrdinalIgnoreCase) < 0)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                try\r\n                {\r\n                    return Assembly.LoadFrom(binFilePath);\r\n                }\r\n                catch(Exception ex)\r\n                {\r\n                    if (!_compositeGeneratedErrorLogged)\r\n                    {\r\n                        Log.LogInformation(LogTitle, \"Failed to load ~/Bin/Composite.Generated.dll \");\r\n                        Log.LogWarning(LogTitle, ex);\r\n\r\n                        _compositeGeneratedErrorLogged = true;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private static bool IsDotNetAssembly(string dllFilePath)\r\n        {\r\n            try {\r\n                AssemblyName.GetAssemblyName(dllFilePath);\r\n            }\r\n            catch (BadImageFormatException) {\r\n                return false;\r\n            }\r\n            catch (Exception) {\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Assembly GetAppCodeAssembly()\r\n        {\r\n            return AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(IsAppCodeDll);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsInMemoryAssembly(Assembly asm)\r\n        {\r\n            // Checking \r\n            // (asm.ManifestModule as System.Reflection.RuntimeModule).GetFullyQualifiedName() == \"<In Memory Module>\"\r\n\r\n            if (!RuntimeModuleType.IsInstanceOfType(asm.ManifestModule)) return false;\r\n\r\n            var method = RuntimeModuleType.GetMethod(\"GetFullyQualifiedName\", BindingFlags.NonPublic | BindingFlags.Instance);\r\n            return (method.Invoke(asm.ManifestModule, new object[0]) as string) == \"<In Memory Module>\";\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsAppCodeDll(Assembly assembly)\r\n        {\r\n            string fullName = assembly.FullName;\r\n            return fullName != null && (fullName.StartsWith(\"App_Code.\") || fullName.StartsWith(\"App_Code,\"));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets assemblies from bin and app code assembly\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static IEnumerable<Assembly> GetAllAssemblies()\r\n        {\r\n            List<Assembly> assemblies = GetLoadedAssembliesFromBin().ToList();\r\n\r\n            Assembly appCodeAssembly = GetAppCodeAssembly();\r\n\r\n            if (appCodeAssembly != null)\r\n            {\r\n                assemblies.Add(appCodeAssembly);\r\n            }\r\n\r\n            return assemblies;\r\n        }\r\n\r\n        internal static bool AssemblyPotentiallyUsesType(Assembly assembly, Type type)\r\n        {\r\n            Verify.ArgumentNotNull(assembly, nameof(assembly));\r\n            Verify.ArgumentNotNull(type, nameof(type));\r\n\r\n            var typeAssembly = type.Assembly;\r\n            string typeAssemblyName = typeAssembly.GetName().Name;\r\n\r\n            return assembly == typeAssembly\r\n                   || assembly.GetReferencedAssemblies().Any(r => r.Name == typeAssemblyName);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/AssemblyLocationExtensions.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal static class AssemblyLocationExtensions\r\n    {\r\n        /// <summary>\r\n        /// Adds assembly locations to a string collection of the collection does not already has them.\r\n        /// Note: Case insensitive\r\n        /// </summary>\r\n        /// <param name=\"stringCollection\"></param>\r\n        /// <param name=\"assemblyLocations\"></param>\r\n        /// <exclude />\r\n        public static void AddRangeIfNotContained(this StringCollection stringCollection, IEnumerable<string> assemblyLocations)\r\n        {\r\n            foreach (string assemblyLocation in assemblyLocations)\r\n            {\r\n                AddIfNotContained(stringCollection, assemblyLocation);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a assembly location to a string collection of the collection does not already has it.\r\n        /// Note: Case insensitive\r\n        /// </summary>\r\n        /// <param name=\"stringCollection\"></param>\r\n        /// <param name=\"assemblyLocation\"></param>\r\n        /// <exclude />\r\n        public static void AddIfNotContained(this StringCollection stringCollection, string assemblyLocation)\r\n        {\r\n            string assemblyFileName = Path.GetFileName(assemblyLocation);\r\n\r\n            bool isContained = stringCollection.\r\n                OfType<string>().\r\n                Where(f => f.IndexOf(assemblyFileName, StringComparison.InvariantCultureIgnoreCase) >= 0).\r\n                Any();\r\n\r\n            if (!isContained)\r\n            {\r\n                stringCollection.Add(assemblyLocation);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/BuildinPlugins/BuildinTypeManagerTypeHandler/BuildinTypeManagerTypeHandler.cs",
    "content": "﻿using System;\r\nusing Composite.Plugins.Types.TypeManagerTypeHandler.DynamicBuildManagerTypeManagerTypeHandler;\r\nusing Composite.Plugins.Types.TypeManagerTypeHandler.SystemTypeManagerTypeHandler;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler;\r\n\r\n\r\nnamespace Composite.Core.Types.BuildinPlugins.BuildinTypeManagerTypeHandler\r\n{\r\n    internal sealed class BuildinTypeManagerTypeHandler : ITypeManagerTypeHandler\r\n    {\r\n        public Type GetType(string fullName)\r\n        {\r\n            Type type;\r\n            ITypeManagerTypeHandler handler;\r\n\r\n            handler = new DynamicBuildManagerTypeManagerTypeHandler();\r\n            type = handler.GetType(fullName);\r\n            if (type != null) return type;\r\n\r\n            handler = new SystemTypeManagerTypeHandler();\r\n            type = handler.GetType(fullName);\r\n            if (type != null) return type;\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        public string SerializeType(Type type)\r\n        {\r\n            string serializedType;\r\n            ITypeManagerTypeHandler handler;\r\n\r\n            handler = new DynamicBuildManagerTypeManagerTypeHandler();\r\n            serializedType = handler.SerializeType(type);\r\n            if (serializedType != null) return serializedType;\r\n\r\n            handler = new SystemTypeManagerTypeHandler();\r\n            serializedType = handler.SerializeType(type);\r\n            if (serializedType != null) return serializedType;\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        public bool HasTypeWithName(string typeFullname)\r\n        {\r\n            ITypeManagerTypeHandler handler;\r\n\r\n            handler = new DynamicBuildManagerTypeManagerTypeHandler();\r\n            if (handler.HasTypeWithName(typeFullname)) return true;\r\n\r\n            handler = new SystemTypeManagerTypeHandler();\r\n            if (handler.HasTypeWithName(typeFullname)) return true;\r\n\r\n            return false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/CSharpCodeProviderFactory.cs",
    "content": "using System.CodeDom.Compiler;\nusing Microsoft.CSharp;\n\nnamespace Composite.Core.Types\n{\n    internal class CSharpCodeProviderFactory\n    {\n        public static CSharpCodeProvider CreateCompiler()\n        {\n            return (CSharpCodeProvider)CodeDomProvider.CreateProvider(\"c#\");\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Core/Types/CodeCompatibilityChecker.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.CodeDom.Compiler;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal static class CodeCompatibilityChecker\r\n    {\r\n        /// <summary>\r\n        /// This method will try to compile the given type to see if any changes done to the type\r\n        /// will conflict with code in App_Code\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptorToTest\"></param>\r\n        /// <returns></returns>\r\n        public static CompatibilityCheckResult CheckCompatibilityWithAppCodeFolder(DataTypeDescriptor dataTypeDescriptorToTest)\r\n        {\r\n            return CheckAgainstAppCode(dataTypeDescriptorToTest, true);\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method will check if any code in en App_Code folder depends on the given data interface.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptorToTest\"></param>\r\n        /// <returns></returns>\r\n        public static CompatibilityCheckResult CheckIfAppCodeDependsOnInterface(DataTypeDescriptor dataTypeDescriptorToTest)\r\n        {\r\n            return CheckAgainstAppCode(dataTypeDescriptorToTest, false);\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method checks to see if any change in the given data type descriptor will make code \r\n        /// in App_Code fail and hence the site will fail.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptorToTest\"></param>\r\n        /// <param name=\"includeDataTypeDescriptor\">\r\n        /// If true, the data type descriptor will be used instead of the original.\r\n        /// If false, it will be excluded.\r\n        /// </param>\r\n        /// <returns></returns>\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\", Justification = \"File api is used for creating temporary files\")]\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\", Justification = \"File api is used for creating temporary files\")]\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"File api is used for creating temporary files\")]\r\n        private static CompatibilityCheckResult CheckAgainstAppCode(DataTypeDescriptor dataTypeDescriptorToTest, bool includeDataTypeDescriptor)\r\n        {\r\n            var filesToCompile = GetAppCodeFiles().ToList();\r\n            if (filesToCompile.Count == 0)\r\n            {\r\n                return new CompatibilityCheckResult();\r\n            }\r\n\r\n            var csCompiler = CSharpCodeProviderFactory.CreateCompiler();\r\n\r\n            var referencedAssemblies = new List<Assembly>();\r\n            var codeTypeDeclarations = new Dictionary<string, List<CodeTypeDeclaration>>();\r\n\r\n            foreach (var dataTypeDescriptor in DataMetaDataFacade.GeneratedTypeDataTypeDescriptors)\r\n            {\r\n                if (!includeDataTypeDescriptor && dataTypeDescriptor.DataTypeId == dataTypeDescriptorToTest.DataTypeId)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var dataTypeDescriptorToUse = dataTypeDescriptor;\r\n\r\n                if (includeDataTypeDescriptor && dataTypeDescriptor.DataTypeId == dataTypeDescriptorToTest.DataTypeId)\r\n                {\r\n                    dataTypeDescriptorToUse = dataTypeDescriptorToTest;\r\n                }\r\n\r\n                referencedAssemblies.AddRange(InterfaceCodeGenerator.GetReferencedAssemblies(dataTypeDescriptorToUse));\r\n\r\n                var codeTypeDeclaration = InterfaceCodeGenerator.CreateCodeTypeDeclaration(dataTypeDescriptorToUse);\r\n                if (!codeTypeDeclarations.TryGetValue(dataTypeDescriptorToUse.Namespace, out var declarations))\r\n                {\r\n                    declarations = new List<CodeTypeDeclaration>();\r\n\r\n                    codeTypeDeclarations.Add(dataTypeDescriptorToUse.Namespace, declarations);\r\n                }\r\n\r\n                declarations.Add(codeTypeDeclaration);\r\n\r\n                var tempFilePath = GetTempFileName(dataTypeDescriptorToUse);\r\n\r\n                filesToCompile.Add(tempFilePath);\r\n\r\n                using (var file = File.Create(tempFilePath))\r\n                {\r\n                    using (var sw = new StreamWriter(file))\r\n                    {\r\n                        var codeNamespace = new CodeNamespace(dataTypeDescriptorToUse.Namespace);\r\n\r\n                        codeNamespace.Types.Add(codeTypeDeclaration);\r\n\r\n                        csCompiler.GenerateCodeFromNamespace(codeNamespace, sw, new CodeGeneratorOptions());\r\n                    }\r\n\r\n                    var sb = new StringBuilder();\r\n                    using (var sw = new StringWriter(sb))\r\n                    {\r\n                        csCompiler.GenerateCodeFromMember(codeTypeDeclaration, sw, new CodeGeneratorOptions());\r\n                    }\r\n                }\r\n            }\r\n\r\n            filesToCompile.Sort();\r\n\r\n            var compilerParameters = new CompilerParameters\r\n            {\r\n                GenerateExecutable = false,\r\n                GenerateInMemory = true\r\n            };\r\n\r\n            compilerParameters.ReferencedAssemblies.AddRangeIfNotContained(referencedAssemblies.Select(f => f.Location).ToArray());\r\n            compilerParameters.ReferencedAssemblies.AddRangeIfNotContained(CodeGenerationManager.CompiledAssemblies.Select(f => f.Location).ToArray());\r\n\r\n            compilerParameters.AddLoadedAssemblies(false);\r\n            compilerParameters.AddAssemblyLocationsFromBin();\r\n            compilerParameters.AddCommonAssemblies();\r\n            compilerParameters.RemoveGeneratedAssemblies();\r\n\r\n            var codeCompileUnit = new CodeCompileUnit();\r\n            foreach (var kvp in codeTypeDeclarations)\r\n            {\r\n                var codeNamespace = new CodeNamespace(kvp.Key);\r\n\r\n                codeNamespace.Types.AddRange(kvp.Value.ToArray());\r\n                codeCompileUnit.Namespaces.Add(codeNamespace);\r\n            }\r\n\r\n            var compiler = CSharpCodeProviderFactory.CreateCompiler();\r\n            var compileResult = compiler.CompileAssemblyFromFile(compilerParameters, filesToCompile.ToArray());\r\n\r\n            if (!compileResult.Errors.HasErrors)\r\n            {\r\n                return new CompatibilityCheckResult();\r\n            }\r\n\r\n            // Checking for a missing assembly error, if it is present, that means that App_Code check isn't applicable due to circular reference\r\n            foreach (CompilerError error in compileResult.Errors)\r\n            {\r\n                if (error.ErrorNumber == \"CS0012\" && error.ErrorText.Contains(\"Composite.Generated\"))\r\n                {\r\n                    return new CompatibilityCheckResult();\r\n                }\r\n            }\r\n\r\n            return new CompatibilityCheckResult(compileResult);\r\n        }\r\n\r\n\r\n        private static string GetTempFileName(DataTypeDescriptor typeDescriptor)\r\n        {\r\n            var folderPath = PathUtil.Resolve(GlobalSettingsFacade.GeneratedAssembliesDirectory);\r\n\r\n            var filePath = Path.Combine(folderPath, typeDescriptor.GetFullInterfaceName() + \".cs\");\r\n            if (filePath.Length > 255)\r\n            {\r\n                filePath = Path.Combine(folderPath, typeDescriptor.DataTypeId + \".cs\");\r\n            }\r\n\r\n            return filePath;\r\n        }\r\n\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        private static IEnumerable<string> GetAppCodeFiles()\r\n        {\r\n            var appCodeFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GlobalSettingsFacade.AppCodeDirectory);\r\n            if (!Directory.Exists(appCodeFolderPath))\r\n            {\r\n                return new string[0];\r\n            }\r\n\r\n            return Directory.GetFiles(appCodeFolderPath, \"*.cs\", SearchOption.AllDirectories);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/CodeGenerationBuilder.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary> \r\n    /// This class is used when compiling new types at run time in C1.\r\n    /// It is used in two way. The first usage is for creating types that is located in temp assemblies. \r\n    /// Normaly when temp assemblies has ben made a restart of C1 is done. And this leads into the second\r\n    /// usage which is when the Composite.Generated.dll is compiled. This is done through the implementation\r\n    /// and adding of the interface <see cref=\"ICodeProvider\"/> and <see cref=\"CodeGenerationManager\"/>.\r\n    /// </summary>\r\n    public class CodeGenerationBuilder\r\n    {\r\n        private readonly Dictionary<string, CodeNamespace> _namespaces = new Dictionary<string, CodeNamespace>();\r\n        private readonly List<string> _assemblyLocations = new List<string>();\r\n\r\n        internal string DebugLabel { get; private set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new instance.\r\n        /// </summary>\r\n        /// <param name=\"debugLabel\">This label will be used for logging when compiling the types.</param>\r\n        public CodeGenerationBuilder(string debugLabel = null)\r\n        {\r\n            DebugLabel = debugLabel ?? \"\";\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a referenced assembly to be used in the compilation.\r\n        /// </summary>\r\n        /// <param name=\"assembly\">The referenced assembly.</param>\r\n        public void AddReference(Assembly assembly)\r\n        {\r\n            AddReference(assembly.Location);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a referenced assembly to be used in the compilation.\r\n        /// </summary>\r\n        /// <param name=\"assemblyLocation\">The location of the referenced assembly.</param>\r\n        public void AddReference(string assemblyLocation)\r\n        {\r\n            if (!_assemblyLocations.Contains(assemblyLocation, StringComparer.InvariantCultureIgnoreCase))\r\n            {\r\n                _assemblyLocations.Add(assemblyLocation);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a code namespace containing types to compile.\r\n        /// </summary>\r\n        /// <param name=\"codeNamespace\">Code namespace to add.</param>\r\n        public void AddNamespace(CodeNamespace codeNamespace)\r\n        {\r\n            CodeNamespace existingCodeNamespace;\r\n            if (!_namespaces.TryGetValue(codeNamespace.Name, out existingCodeNamespace))\r\n            {\r\n                _namespaces.Add(codeNamespace.Name, codeNamespace);\r\n            }\r\n            else\r\n            {\r\n                existingCodeNamespace.Types.AddRange(codeNamespace.Types);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a new type declaration to compile. If the type name already exists in\r\n        /// the given namespace. The type is skipped!\r\n        /// </summary>\r\n        /// <param name=\"namespaceName\">Namespace to add the type to.</param>\r\n        /// <param name=\"codeTypeDeclaration\">Type declaration to compile.</param>\r\n        public void AddType(string namespaceName, CodeTypeDeclaration codeTypeDeclaration)\r\n        {\r\n            AddTypes(namespaceName, new[] { codeTypeDeclaration });\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds new type declarations to compile. If a type name already exists in\r\n        /// the given namespace. The type is skipped!\r\n        /// </summary>\r\n        /// <param name=\"namespaceName\"></param>\r\n        /// <param name=\"codeTypeDeclarations\"></param>\r\n        public void AddTypes(string namespaceName, IEnumerable<CodeTypeDeclaration> codeTypeDeclarations)\r\n        {\r\n            CodeNamespace codeNamespace;\r\n            if (!_namespaces.TryGetValue(namespaceName, out codeNamespace))\r\n            {\r\n                codeNamespace = new CodeNamespace(namespaceName);\r\n                _namespaces.Add(namespaceName, codeNamespace);\r\n\r\n                codeNamespace.Types.AddRange(codeTypeDeclarations.ToArray());\r\n            }\r\n            else\r\n            {\r\n                foreach (CodeTypeDeclaration newCodeTypeDeclaration in codeTypeDeclarations)\r\n                {\r\n                    bool alreadyExists = false;\r\n                    foreach (CodeTypeDeclaration exitingTypeDeclaration in codeNamespace.Types)\r\n                    {\r\n                        if (exitingTypeDeclaration.Name == newCodeTypeDeclaration.Name)\r\n                        {\r\n                            alreadyExists = true;\r\n                            break;\r\n                        }\r\n                    }\r\n\r\n                    if (!alreadyExists)\r\n                    {\r\n                        codeNamespace.Types.Add(newCodeTypeDeclaration);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Added assembly locations\r\n        /// </summary>\r\n        public IEnumerable<string> AssemblyLocations\r\n        {\r\n            get\r\n            {\r\n                return _assemblyLocations;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Added namespaces\r\n        /// </summary>\r\n        public IEnumerable<CodeNamespace> Namespaces\r\n        {\r\n            get\r\n            {\r\n                return _namespaces.Values;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/CodeGenerationCommon.cs",
    "content": "﻿using System;\r\nusing System.CodeDom.Compiler;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal static class CodeGenerationCommon\r\n    {\r\n        /// <summary>\r\n        /// Adds all assemblies from bin, except Composite.Generated.dll\r\n        /// </summary>\r\n        /// <param name=\"compilerParameters\"></param>\r\n        public static void AddAssemblyLocationsFromBin(this CompilerParameters compilerParameters)\r\n        {\r\n            AssemblyFacade.GetAssembliesFromBin().ForEach(compilerParameters.ReferencedAssemblies.AddIfNotContained);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Add assemblies that are loaded in the app domain.\r\n        /// </summary>\r\n        /// <param name=\"compilerParameters\">The compiler parameters.</param>\r\n        /// <param name=\"includeAppCode\">if set to <c>true</c> reference to App_Code will be included to results.</param>\r\n        public static void AddLoadedAssemblies(this CompilerParameters compilerParameters, bool includeAppCode)\r\n        {\r\n            var foundAssemblyLocations = new Dictionary<string, string>();\r\n\r\n            IEnumerable<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(AssemblyHasLocation);\r\n                \r\n            if(!includeAppCode)\r\n            {\r\n                assemblies = assemblies.Where(asm => !asm.GetName().Name.StartsWith(\"App_Code\"));\r\n            }\r\n                \r\n            IEnumerable<string> locations = assemblies.Select(a => a.Location);\r\n\r\n            foreach (string location in locations)\r\n            {\r\n                string locationKey = Path.GetFileName(location).ToLowerInvariant();\r\n\r\n\r\n                if (!foundAssemblyLocations.ContainsKey(locationKey))\r\n                {\r\n                    foundAssemblyLocations.Add(locationKey, location);\r\n                }\r\n                else\r\n                {\r\n                    string currentUsedLocation = foundAssemblyLocations[locationKey];\r\n\r\n                    DateTime currentlyUsedLastWrite = C1File.GetLastWriteTime(currentUsedLocation);\r\n                    DateTime locationCandidateLastWrite = C1File.GetLastWriteTime(location);\r\n\r\n                    if (locationCandidateLastWrite > currentlyUsedLastWrite)\r\n                    {\r\n                        foundAssemblyLocations.Remove(locationKey);\r\n                        foundAssemblyLocations.Add(locationKey, location);\r\n                    }\r\n                }\r\n            }\r\n\r\n            compilerParameters.ReferencedAssemblies.AddRangeIfNotContained(foundAssemblyLocations.Values);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Add common used assemblies\r\n        /// </summary>\r\n        /// <param name=\"compilerParameters\"></param>\r\n        public static void AddCommonAssemblies(this CompilerParameters compilerParameters)\r\n        {\r\n            var commonAssemblies = new List<string>\r\n            {\r\n                typeof(System.Linq.Expressions.Expression).Assembly.Location,\r\n                typeof(System.Xml.Linq.XElement).Assembly.Location,\r\n                typeof(System.Xml.Serialization.IXmlSerializable).Assembly.Location,\r\n                typeof(System.Data.Linq.Mapping.TableAttribute).Assembly.Location,\r\n                typeof(System.ComponentModel.IContainer).Assembly.Location,\r\n                typeof(System.Data.SqlClient.SqlCommand).Assembly.Location\r\n            };\r\n\r\n            compilerParameters.ReferencedAssemblies.AddRangeIfNotContained(commonAssemblies);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Removes generated assemblies including Composite.Generated.dll\r\n        /// </summary>\r\n        /// <param name=\"compilerParameters\"></param>\r\n        public static void RemoveGeneratedAssemblies(this CompilerParameters compilerParameters)\r\n        {\r\n            List<string> assembliesToRemove = compilerParameters.ReferencedAssemblies.\r\n                OfType<string>().\r\n                Where(f => f.IndexOf(CodeGenerationManager.CompositeGeneratedFileName, StringComparison.InvariantCultureIgnoreCase) >= 0 ||\r\n                           f.StartsWith(PathUtil.Resolve(GlobalSettingsFacade.GeneratedAssembliesDirectory), StringComparison.InvariantCultureIgnoreCase)).\r\n                Select(f => f).\r\n                ToList();\r\n\r\n            assembliesToRemove.ForEach(compilerParameters.ReferencedAssemblies.Remove);\r\n        }\r\n\r\n\r\n\r\n        [DebuggerStepThrough]\r\n        private static bool AssemblyHasLocation(Assembly assembly)\r\n        {\r\n            if (assembly.GetType().FullName == \"System.Reflection.Emit.InternalAssemblyBuilder\")\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (assembly.GlobalAssemblyCache)\r\n            {\r\n                return true;\r\n            }\r\n\r\n            try\r\n            {\r\n                return assembly.ManifestModule.Name != \"<Unknown>\" &&\r\n                       assembly.ManifestModule.FullyQualifiedName != \"<In Memory Module>\" &&\r\n                       assembly.ManifestModule.ScopeName != \"RefEmit_InMemoryManifestModule\" &&\r\n                       !string.IsNullOrEmpty(assembly.Location);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/CodeGenerationHelper.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class CodeGenerationHelper\r\n\t{\r\n        /// <exclude />\r\n        public static string GetTypeAlias(Type type)\r\n        {\r\n            return GetTypeAlias(type.FullName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetTypeAlias(string typeFullName)\r\n        {\r\n            return typeFullName.Replace(\".\", \"_\");\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/CodeGenerationManager.cs",
    "content": "﻿//#warning REMOVE THIS LINE!!!\r\n//#define OUTPUT_SOURCE_CODE_ON_ERROR\r\n\r\nusing System;\r\nusing System.CodeDom;\r\nusing System.CodeDom.Compiler;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Data.Foundation.CodeGeneration;\r\nusing Composite.Data.GeneratedTypes;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>\r\n    /// Handles all dynamic type compilations and the generation of Composite.Generated.dll\r\n    /// </summary>\r\n    public static class CodeGenerationManager\r\n    {\r\n        internal static readonly string LogTitle = typeof(CodeGenerationManager).Name;\r\n        private const int NumberOfCompileRetries = 10;\r\n\r\n        private static readonly object _lock = new object();\r\n        private static bool _compositeGeneratedCompiled = true;\r\n        private static List<ICodeProvider> _dynamicallyAddedCodeProviders = new List<ICodeProvider>();\r\n        private static readonly List<Assembly> _compiledAssemblies = new List<Assembly>();\r\n        private static readonly Dictionary<string, Type> _compiledTypesByFullName = new Dictionary<string, Type>();\r\n\r\n        /// <summary>\r\n        /// If set to <c>true</c>, /Bin/Composite.Generated.dll won't be overwritten on shutdown\r\n        /// </summary>\r\n        public static bool SuppressGeneration { get; set; }\r\n\r\n        static CodeGenerationManager()\r\n        {\r\n            string assemblyTempPath = null;\r\n\r\n            try\r\n            {\r\n                assemblyTempPath = PathUtil.Resolve(GlobalSettingsFacade.GeneratedAssembliesDirectory);\r\n            }\r\n            catch\r\n            {\r\n                // NOTE: We don't want this static constructor fail if GlobalSettingsFacade failed to load.\r\n            }\r\n\r\n            if (assemblyTempPath != null)\r\n            {\r\n                if (!C1Directory.Exists(assemblyTempPath))\r\n                {\r\n                    C1Directory.CreateDirectory(assemblyTempPath);\r\n                }\r\n            }\r\n\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n            GlobalEventSystemFacade.SubscribeToShutDownEvent(args => ClearOldTempFiles());\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Validates that the current Composite.Generated.dll is not compiled after the given \r\n        /// time. If it is compiled after the given time. Any attempts to recompile Composite.Generated.dll\r\n        /// will be ignored. This is used to stop app domains from shutting each other down by recompiles.\r\n        /// </summary>\r\n        /// <param name=\"time\"></param>\r\n        internal static void ValidateCompositeGenerate(DateTime time)\r\n        {\r\n            if (SuppressGeneration)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var filePath = Path.Combine(PathUtil.BaseDirectory, \"Bin\", \"Composite.Generated.dll\");\r\n            if (!C1File.Exists(filePath))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var lastWrite = C1File.GetLastWriteTime(filePath);\r\n            if (lastWrite <= time)\r\n            {\r\n                return;\r\n            }\r\n\r\n            _compositeGeneratedCompiled = true;\r\n            Log.LogVerbose(LogTitle, $\"Assembly in this application domain is newer than this application domain ({AppDomain.CurrentDomain.Id})\");\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method will recompile Composite.Generated.dll and drop it into bin.\r\n        /// </summary>\r\n        /// <param name=\"forceGeneration\"></param>\r\n        public static void GenerateCompositeGeneratedAssembly(bool forceGeneration = false)\r\n        {\r\n            if (SuppressGeneration)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (forceGeneration || !_compositeGeneratedCompiled)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (forceGeneration || !_compositeGeneratedCompiled)\r\n                    {\r\n                        Log.LogVerbose(LogTitle, $\"Compiling new assembly in this application domain ({AppDomain.CurrentDomain.Id})\");\r\n\r\n                        var t1 = Environment.TickCount;\r\n\r\n                        var builder = new CodeGenerationBuilder(\"Composite.Generated.dll\");\r\n                        PopulateBuilder(builder);\r\n\r\n                        var t2 = Environment.TickCount;\r\n\r\n                        Compile(builder);\r\n\r\n                        var t3 = Environment.TickCount;\r\n\r\n                        var numberOfTypes = builder.Namespaces.SelectMany(f => f.Types.OfType<CodeTypeDeclaration>()).Count();\r\n\r\n                        Log.LogVerbose(LogTitle, \"Number of types build: \" + numberOfTypes +\r\n                                                 \"\\nBuilding code dom: \" + (t2 - t1) + \"ms\" +\r\n                                                 \"\\nCompiling code dom: \" + (t3 - t2) + \"ms\" +\r\n                                                 \"\\nTotal compilation: \" + (t3 - t1) + \"ms\");\r\n\r\n                        _compositeGeneratedCompiled = true;\r\n\r\n                        return;\r\n                    }\r\n                }\r\n            }\r\n\r\n            Log.LogVerbose(LogTitle, \"New assembly already compiled by this application domain ({0})\", AppDomain.CurrentDomain.Id);\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method will compile the type defined in <paramref name=\"codeGenerationBuilder\"/>\r\n        /// and return the result types. These types exists in a temp assembly, that will be\r\n        /// deleted when the app domain is terminated.\r\n        /// </summary>\r\n        /// <param name=\"codeGenerationBuilder\"></param>\r\n        /// <param name=\"verbose\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<Type> CompileRuntimeTempTypes(CodeGenerationBuilder codeGenerationBuilder, bool verbose = true)\r\n        {\r\n            var t1 = Environment.TickCount;\r\n\r\n            _compositeGeneratedCompiled = false; // When compiling a new type, Composite.Generated.dll should always be recompiled\r\n\r\n            var compilerParameters = new CompilerParameters\r\n            {\r\n                GenerateExecutable = false,\r\n                GenerateInMemory = false,\r\n                OutputAssembly = Path.Combine(TempAssemblyFolderPath, Guid.NewGuid() + \".dll\")\r\n            };\r\n\r\n            compilerParameters.ReferencedAssemblies.AddRangeIfNotContained(codeGenerationBuilder.AssemblyLocations.ToArray());\r\n            compilerParameters.ReferencedAssemblies.AddRangeIfNotContained(_compiledAssemblies.Select(f => f.Location).ToArray());\r\n            compilerParameters.AddAssemblyLocationsFromBin();\r\n\r\n            var codeCompileUnit = new CodeCompileUnit();\r\n\r\n            codeCompileUnit.Namespaces.AddRange(codeGenerationBuilder.Namespaces.ToArray());\r\n\r\n            var compiler = CSharpCodeProviderFactory.CreateCompiler();\r\n            var compileResult = compiler.CompileAssemblyFromDom(compilerParameters, codeCompileUnit);\r\n\r\n            if (!compileResult.Errors.HasErrors)\r\n            {\r\n                var resultAssembly = compileResult.CompiledAssembly;\r\n\r\n                AddCompiledAssembly(resultAssembly);\r\n\r\n                var resultTypes = resultAssembly.GetTypes();\r\n\r\n                var t2 = Environment.TickCount;\r\n\r\n                Log.LogVerbose(LogTitle, $\"Compile '{codeGenerationBuilder.DebugLabel}' in {t2 - t1}ms\");\r\n                Log.LogVerbose(LogTitle, $\"Types from : {compilerParameters.OutputAssembly}\");\r\n\r\n                foreach (var resultType in resultTypes)\r\n                {\r\n                    _compiledTypesByFullName[resultType.FullName] = resultType;\r\n                }\r\n\r\n                return resultTypes;\r\n            }\r\n\r\n            OutputSourceCodeOnError(compiler, codeCompileUnit);\r\n\r\n            var failedAssemblyLoads = LoadAssembliesToMemory(compilerParameters.ReferencedAssemblies);\r\n\r\n            var sb = new StringBuilder();\r\n            failedAssemblyLoads.ForEach(asm => sb.AppendFormat(\"Failed to load dll: '{0}' : {1}\", asm.First, asm.Second).AppendLine());\r\n\r\n            sb.AppendLine(\"Failed building: \" + codeGenerationBuilder.DebugLabel);\r\n            foreach (CompilerError compilerError in compileResult.Errors)\r\n            {\r\n                if (compilerError.IsWarning)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var entry = \"Compile error: \" + compilerError.ErrorNumber + \"(\" + compilerError.Line + \")\" + \": \" + compilerError.ErrorText.Replace(\"{\", \"{{\").Replace(\"}\", \"}}\");\r\n\r\n                if (verbose)\r\n                {\r\n                    Log.LogError(LogTitle, entry);\r\n                }\r\n\r\n                sb.AppendLine(entry);\r\n            }\r\n\r\n            throw new InvalidOperationException(sb.ToString());\r\n        }\r\n\r\n        private static IEnumerable<Pair<string, Exception>> LoadAssembliesToMemory(StringCollection assemblyLocations)\r\n        {\r\n            var failedAssemblyLoads = new List<Pair<string, Exception>>();\r\n            foreach (var assemblyLocation in assemblyLocations)\r\n            {\r\n                if (PackageAssemblyHandler.TryGetAlreadyLoadedAssembly(assemblyLocation) != null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                try\r\n                {\r\n                    var assembly = Assembly.LoadFrom(assemblyLocation);\r\n                    assembly.GetTypes(); // Accessing GetTypes() to iterate classes\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    var exceptionToLog = ex;\r\n\r\n                    var loadException = ex as ReflectionTypeLoadException;\r\n                    if (loadException?.LoaderExceptions != null && loadException.LoaderExceptions.Any())\r\n                    {\r\n                        exceptionToLog = loadException.LoaderExceptions.First();\r\n                    }\r\n\r\n                    failedAssemblyLoads.Add(new Pair<string, Exception>(assemblyLocation, exceptionToLog));\r\n                }\r\n            }\r\n\r\n            return failedAssemblyLoads;\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method returns true if the given type <paramref name=\"type\"/> is\r\n        /// compiled at runetime. Otherwise false.\r\n        /// </summary>\r\n        /// <param name=\"type\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsCompiledAtRuntime(Type type)\r\n        {\r\n            return type.Assembly.Location.StartsWith(PathUtil.Resolve(GlobalSettingsFacade.GeneratedAssembliesDirectory), StringComparison.InvariantCultureIgnoreCase);\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method returns true if the types given by <paramref name=\"dependingTypes\"/> needs a recompile because\r\n        /// they either is null or the type given by <paramref name=\"dependableType\"/> has changed and there for\r\n        /// exists in a compiled at runtime assembly.\r\n        /// </summary>\r\n        /// <param name=\"dependableType\">A type that all the types given by <paramref name=\"dependingTypes\"/> depends on. </param>\r\n        /// <param name=\"dependingTypes\">All types in this enumerable should either be null or depend on the typoe given by <paramref name=\"dependableType\"/></param>\r\n        /// <returns>Returns true if the types given by <paramref name=\"dependingTypes\"/> needs a recompile.</returns>\r\n        public static bool IsRecompileNeeded(Type dependableType, IEnumerable<Type> dependingTypes)\r\n        {\r\n            foreach (var dependingType in dependingTypes)\r\n            {\r\n                if (dependingType == null)\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                if (IsCompiledAtRuntime(dependableType) && !IsCompiledAtRuntime(dependingType))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Use this method to add a <see cref=\"ICodeProvider\"/> implementation\r\n        /// that will be used when (and only) generating the final Composite.Generated.dll.\r\n        /// </summary>\r\n        /// <param name=\"codeProvider\"></param>\r\n        public static void AddAssemblyCodeProvider(ICodeProvider codeProvider)\r\n        {\r\n            _dynamicallyAddedCodeProviders.Add(codeProvider);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the compiled types.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static Type GetCompiledType(string fullName)\r\n        {\r\n            return _compiledTypesByFullName.TryGetValue(fullName, out var type) ? type : null;\r\n        }\r\n\r\n        private static void Compile(CodeGenerationBuilder builder)\r\n        {\r\n            var compilerParameters = new CompilerParameters\r\n            {\r\n                GenerateExecutable = false,\r\n                GenerateInMemory = false,\r\n                OutputAssembly = CompositeGeneratedAssemblyPath,\r\n                TempFiles = new TempFileCollection(TempAssemblyFolderPath)\r\n            };\r\n\r\n            compilerParameters.ReferencedAssemblies.AddRangeIfNotContained(builder.AssemblyLocations.ToArray());\r\n            compilerParameters.AddAssemblyLocationsFromBin();\r\n\r\n            var codeCompileUnit = new CodeCompileUnit();\r\n\r\n            codeCompileUnit.Namespaces.AddRange(builder.Namespaces.ToArray());\r\n\r\n            for (var i = 0; i < NumberOfCompileRetries; i++)\r\n            {\r\n                var compiler = CSharpCodeProviderFactory.CreateCompiler();\r\n                CompilerResults compileResult = compiler.CompileAssemblyFromDom(compilerParameters, codeCompileUnit);\r\n\r\n                if (!compileResult.Errors.HasErrors)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                if (i == NumberOfCompileRetries - 1)\r\n                {\r\n                    OutputSourceCodeOnError(compiler, codeCompileUnit);\r\n\r\n                    var sb = new StringBuilder();\r\n                    foreach (CompilerError compilerError in compileResult.Errors)\r\n                    {\r\n                        if (compilerError.IsWarning)\r\n                        {\r\n                            continue;\r\n                        }\r\n\r\n                        var entry = \"Compile error: \" + compilerError.ErrorNumber + \"(\" + compilerError.Line + \")\" + \": \" + compilerError.ErrorText.Replace(\"{\", \"{{\").Replace(\"}\", \"}}\");\r\n\r\n                        Log.LogError(LogTitle, entry);\r\n\r\n                        sb.AppendLine(entry);\r\n                    }\r\n\r\n                    throw new InvalidOperationException(sb.ToString());\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns all currently temp compiled assemblies.\r\n        /// </summary>\r\n        internal static IEnumerable<Assembly> CompiledAssemblies => _compiledAssemblies;\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        internal static string TempAssemblyFolderPath => PathUtil.Resolve(GlobalSettingsFacade.GeneratedAssembliesDirectory);\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        internal static string BinFolder => RuntimeInformation.IsUnittest ? PathUtil.BaseDirectory : Path.Combine(PathUtil.BaseDirectory, \"Bin\");\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        internal static string CompositeGeneratedFileName => \"Composite.Generated.dll\";\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        internal static string CompositeGeneratedAssemblyPath => Path.Combine(BinFolder, \"Composite.Generated.dll\");\r\n\r\n        private static void PopulateBuilder(CodeGenerationBuilder builder)\r\n        {\r\n            foreach (var provider in CodeProviders)\r\n            {\r\n                provider.GetCodeToCompile(builder);\r\n            }\r\n        }\r\n\r\n        private static IEnumerable<ICodeProvider> CodeProviders\r\n        {\r\n            get\r\n            {\r\n                yield return new InterfaceCodeProvider();\r\n                yield return new EmptyDataClassCodeProvider();\r\n                yield return new DataWrapperClassCodeProvider();\r\n\r\n                foreach (var codeProvider in _dynamicallyAddedCodeProviders)\r\n                {\r\n                    yield return codeProvider;\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void AddCompiledAssembly(Assembly newAssembly)\r\n        {\r\n            var newType = newAssembly.GetTypes().First();\r\n\r\n            var assembliesToRemove = new List<Assembly>();\r\n            foreach (var assembly in _compiledAssemblies)\r\n            {\r\n                var type = assembly.GetTypes().SingleOrDefault(f => f.FullName == newType.FullName);\r\n                if (type != null)\r\n                {\r\n                    assembliesToRemove.Add(assembly);\r\n                }\r\n            }\r\n\r\n            foreach (var assemblyToRemove in assembliesToRemove)\r\n            {\r\n                _compiledAssemblies.Remove(assemblyToRemove);\r\n            }\r\n\r\n            _compiledAssemblies.Add(newAssembly);\r\n        }\r\n\r\n        private static void Flush()\r\n        {\r\n            _dynamicallyAddedCodeProviders = new List<ICodeProvider>();\r\n        }\r\n\r\n        private static void ClearOldTempFiles()\r\n        {\r\n            var yesterday = DateTime.Now.AddDays(-1);\r\n            var oldFiles = C1Directory.GetFiles(TempAssemblyFolderPath, \"*.*\").Where(filePath => C1File.GetCreationTime(filePath) < yesterday).ToArray();\r\n\r\n            foreach (var file in oldFiles)\r\n            {\r\n                try\r\n                {\r\n                    C1File.Delete(file);\r\n                }\r\n                catch\r\n                {\r\n                    // Silent\r\n                }\r\n            }\r\n        }\r\n\r\n        [Conditional(\"OUTPUT_SOURCE_CODE_ON_ERROR\")]\r\n        private static void OutputSourceCodeOnError(CodeDomProvider compiler, CodeCompileUnit codeCompileUnit)\r\n        {\r\n            using (var file = File.Create(Path.Combine(PathUtil.BaseDirectory, \"output.cs\")))\r\n            {\r\n                using (var sw = new StreamWriter(file))\r\n                {\r\n                    compiler.GenerateCodeFromCompileUnit(codeCompileUnit, sw, new CodeGeneratorOptions());\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/CompatibilityCheckResult.cs",
    "content": "﻿using System;\r\nusing System.CodeDom.Compiler;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class CompatibilityCheckResult\r\n\t{\r\n        internal CompatibilityCheckResult()\r\n        {\r\n            Successful = true;\r\n        }\r\n\r\n        internal CompatibilityCheckResult(CompilerResults compilerResults)\r\n        {\r\n            Successful = !compilerResults.Errors.HasErrors;\r\n            CompilerResults = compilerResults;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Successful { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public CompilerResults CompilerResults { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n\t    public string ErrorMessage\r\n\t    {\r\n\t        get\r\n\t        {\r\n                var compilationErrors = CompilerResults.Errors;\r\n                if (compilationErrors.HasErrors)\r\n                {\r\n                    for(int i=0; i<compilationErrors.Count; i++)\r\n                    {\r\n                        if(!compilationErrors[i].IsWarning)\r\n                        {\r\n                            CompilerError firstError = compilationErrors[i];\r\n                            return \"(File name: '{0}', line: {1}, column: {2}, message: {3})\".FormatWith(firstError.FileName, firstError.Line, firstError.Column, firstError.ErrorText);\r\n                        }\r\n                    }\r\n                    throw new InvalidOperationException(\"Failed to parse error\");\r\n                    \r\n                }\r\n\t            return string.Empty;\r\n\t        }\r\n\t    }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/DataReferenceLabelPair.cs",
    "content": "﻿using System;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    internal sealed class DataReferenceLabelPair<T> where T : class, IData\r\n    {\r\n        public DataReferenceLabelPair(DataReference<T> reference, string label)\r\n        {\r\n            this.Label = label;\r\n            this.DataReference = reference;\r\n        }\r\n\r\n        public DataReferenceLabelPair(T data, string label)\r\n        {\r\n            this.Label = label;\r\n            this.DataReference = new DataReference<T>(data);\r\n        }\r\n\r\n        public string Label { get; private set; }\r\n        public DataReference<T> DataReference { get; private set; }\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/DynamicBuildManagerTypeCache.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    internal sealed class CompiledTypeCache<TValue>\r\n    {\r\n        private readonly Hashtable<string, CacheItem> _cache = new Hashtable<string, CacheItem>();\r\n\r\n\r\n        public void RemoveOldVersion(Type key)\r\n        {\r\n            string cacheKey = GetCacheKey(key);\r\n\r\n            CacheItem cacheItem;\r\n            if (_cache.TryGetValue(cacheKey, out cacheItem))\r\n            {               \r\n                _cache.Remove(cacheKey);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Add(Type key, TValue value)\r\n        {\r\n            string cacheKey = GetCacheKey(key);\r\n\r\n            CacheItem cacheItem;\r\n            if (_cache.TryGetValue(cacheKey, out cacheItem))\r\n            {\r\n                if (cacheItem.Type == key) throw new ArgumentException(\"Adding an item with duplicate key\");\r\n\r\n                _cache[cacheKey] = new CacheItem { Type = key, Value = value };\r\n            }\r\n            else\r\n            {\r\n                _cache.Add(cacheKey, new CacheItem { Type = key, Value = value });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool ContainsKey(Type key)\r\n        {\r\n            CacheItem cacheItem;\r\n            if (_cache.TryGetValue(GetCacheKey(key), out cacheItem) == false) return false;\r\n           \r\n            return true;\r\n        }\r\n\r\n        private static string GetCacheKey(Type key)\r\n        {\r\n            return TypeManager.SerializeType(key) + key.Assembly.FullName;\r\n        }\r\n\r\n\r\n        public bool TryGetValue(Type key, out TValue value)\r\n        {\r\n            CacheItem cacheItem;\r\n            if (!_cache.TryGetValue(GetCacheKey(key), out cacheItem))\r\n            {\r\n                value = default(TValue);\r\n                return false;\r\n            }\r\n           \r\n\r\n            value = cacheItem.Value;            \r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> Keys\r\n        {\r\n            get\r\n            {\r\n                foreach (CacheItem item in _cache.GetValues())\r\n                {\r\n                    yield return item.Type;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public TValue this[Type key]\r\n        {\r\n            get\r\n            {\r\n                CacheItem cacheItem;\r\n                if (_cache.TryGetValue(GetCacheKey(key), out cacheItem) == false)\r\n                {\r\n                    throw new ArgumentException(\"Key not found\");\r\n                }                \r\n\r\n                return cacheItem.Value;\r\n            }\r\n            set\r\n            {\r\n                string cacheKey = GetCacheKey(key);\r\n\r\n                CacheItem cacheItem;\r\n                if (!_cache.TryGetValue(cacheKey, out cacheItem)) throw new ArgumentException(\"Key not found\");               \r\n\r\n                _cache[cacheKey] = new CacheItem { Type = key, Value = value };\r\n            }\r\n        }\r\n\r\n\r\n\r\n        \r\n\r\n\r\n        private sealed class CacheItem\r\n        {\r\n            public Type Type { get; set; }\r\n            public TValue Value { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/ExtendedNullable.cs",
    "content": "namespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ExtendedNullable<T>\r\n    {\r\n        private T _value = default(T);\r\n        private bool _hasValue = false;\r\n\r\n\r\n        /// <exclude />\r\n        public static implicit operator ExtendedNullable<T>(T value)\r\n        {\r\n            ExtendedNullable<T> extendedNullable = new ExtendedNullable<T>();\r\n\r\n            extendedNullable.Value = value;\r\n\r\n            return extendedNullable;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool HasValue\r\n        {\r\n            get\r\n            {\r\n                return _hasValue;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public T Value\r\n        {\r\n            get\r\n            {\r\n                return _value;\r\n            }\r\n            set\r\n            {\r\n                SetValue(value);\r\n            }\r\n        }\r\n\r\n\r\n        private void SetValue(T value)\r\n        {\r\n            _value = value;\r\n            _hasValue = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Foundation/AssemblyFilenameCollection.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\n\r\n\r\nnamespace Composite.Core.Types.Foundation\r\n{\r\n    internal sealed class AssemblyFilenameCollection\r\n    {\r\n        private readonly Dictionary<string, string> _assemblyFilenames = new Dictionary<string, string>();\r\n\r\n\r\n\r\n        public bool ContainsAssemblyFilename(string assemblyFilename)\r\n        {\r\n            if (string.IsNullOrEmpty(assemblyFilename)) throw new ArgumentNullException(\"assemblyFilename\");\r\n\r\n            string assemblyName = GetAssemblyName(assemblyFilename);\r\n\r\n            return _assemblyFilenames.ContainsKey(assemblyName);\r\n        }\r\n\r\n\r\n\r\n        public bool ContainsAssemblyName(string assemblyName)\r\n        {\r\n            if (string.IsNullOrEmpty(assemblyName)) throw new ArgumentNullException(\"assemblyName\");\r\n\r\n            return _assemblyFilenames.ContainsKey(assemblyName);\r\n        }\r\n\r\n\r\n\r\n        public void Add(string assemblyFilename)\r\n        {\r\n            if (string.IsNullOrEmpty(assemblyFilename)) throw new ArgumentNullException(\"assemblyFilename\");\r\n\r\n            string assemblyName = GetAssemblyName(assemblyFilename);\r\n\r\n            _assemblyFilenames[assemblyName] = assemblyFilename;\r\n        }\r\n\r\n\r\n\r\n        public string GetFilenameByAssemblyName(string assemblyName)\r\n        {\r\n            if (string.IsNullOrEmpty(assemblyName)) throw new ArgumentNullException(\"assemblyName\");\r\n\r\n            string assemblyFilename;\r\n            if (!_assemblyFilenames.TryGetValue(assemblyName, out assemblyFilename))\r\n            {\r\n                throw new ArgumentException($\"Does not contain the assembly name '{assemblyName}'\");\r\n            }\r\n\r\n            return assemblyFilename;\r\n        }\r\n\r\n\r\n\r\n        public static string GetAssemblyName(string assemblyFilename)\r\n        {\r\n            string filename = Path.GetFileName(assemblyFilename);\r\n\r\n            string extension = Path.GetExtension(filename);\r\n\r\n            filename = filename.Remove(filename.Length - extension.Length);\r\n\r\n            return filename;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Foundation/CompileUnitBaseTypeProber.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.CodeDom.Compiler;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Core.Types.Foundation\r\n{\r\n    // This code do NOT take generic base types into account. See http://msdn2.microsoft.com/en-us/library/system.codedom.codetypereference.basetype.aspx\r\n    internal static class CompileUnitBaseTypeProber\r\n    {\r\n        /// <summary>\r\n        /// Probes all class declarations, locates types with base types and return a map from found base types to all type declarations having this base type.\r\n        /// </summary>\r\n        /// <param name=\"compileUnit\">The compile unit to probe</param>\r\n        /// <param name=\"allowedBaseTypeAssemblies\">The collection of assemblies all base types are expected to stem from.</param>\r\n        /// <returns>A dictionary of all found base types that map to a list of type declarations using this base type.</returns>\r\n        public static Dictionary<Type, List<KeyValuePair<CodeNamespace, CodeTypeDeclaration>>> MapTypeDeclarationInheritance(this CodeCompileUnit compileUnit, IEnumerable<Assembly> allowedBaseTypeAssemblies)\r\n        {\r\n            Func<string, Type> typeResolver = f => allowedBaseTypeAssemblies.Select(g => g.GetType(f, false)).FirstOrDefault(g => g != null);\r\n\r\n            return MapTypeDeclarationInheritance(compileUnit, typeResolver);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Probes all class declarations, locates types with base types and return a map from found base types to all type declarations having this base type.\r\n        /// </summary>\r\n        /// <param name=\"compileUnit\">The compile unit to probe</param>\r\n        /// <param name=\"parms\">The parameters used for compilation. Used to locate relevant assemblies</param>\r\n        /// <returns>A dictionary of all found base types that map to a list of type declarations using this base type.</returns>\r\n        public static Dictionary<Type, List<KeyValuePair<CodeNamespace, CodeTypeDeclaration>>> MapTypeDeclarationInheritance(this CodeCompileUnit compileUnit, CompilerParameters parms)\r\n        {\r\n            Func<string, Type> typeResolver = f => GetTypeFromReferencedAssemblies(parms, f);\r\n\r\n            return MapTypeDeclarationInheritance(compileUnit, typeResolver);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Probes all class declarations, locates types with base types and return a map from found base types to all type declarations having this base type.\r\n        /// </summary>\r\n        /// <param name=\"compileUnit\">The compile unit to probe</param>\r\n        /// <param name=\"typeResolver\">A function that can map a type full name (without assembly information) to a Type</param>\r\n        /// <returns>A dictionary of all found base types that map to a list of type declarations using this base type.</returns>\r\n        public static Dictionary<Type, List<KeyValuePair<CodeNamespace, CodeTypeDeclaration>>> MapTypeDeclarationInheritance(this CodeCompileUnit compileUnit, Func<string, Type> typeResolver)\r\n        {\r\n            var baseTypeToTypeDeclaration = new Dictionary<Type, List<KeyValuePair<CodeNamespace, CodeTypeDeclaration>>>();\r\n\r\n            foreach (CodeNamespace codeNamespace in compileUnit.Namespaces)\r\n            {\r\n                foreach (CodeTypeDeclaration codeTypeDeclaration in codeNamespace.Types)\r\n                {\r\n                    foreach (CodeTypeReference baseTypeReference in codeTypeDeclaration.BaseTypes)\r\n                    {\r\n                        string baseTypeName = baseTypeReference.BaseType;\r\n\r\n                        Type baseType = typeResolver(baseTypeName);\r\n\r\n                        if (baseType == null)\r\n                        {\r\n                            // Base class be null since some generated classes are based on someother generated classes\r\n                            continue;\r\n                        }\r\n\r\n                        if (baseTypeToTypeDeclaration.ContainsKey(baseType) == false) baseTypeToTypeDeclaration.Add(baseType, new List<KeyValuePair<CodeNamespace, CodeTypeDeclaration>>());\r\n\r\n                        baseTypeToTypeDeclaration[baseType].Add(new KeyValuePair<CodeNamespace, CodeTypeDeclaration>(codeNamespace, codeTypeDeclaration));\r\n                    }\r\n                }\r\n            }\r\n\r\n            return baseTypeToTypeDeclaration;\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        private static Type GetTypeFromReferencedAssemblies(CompilerParameters parms, string baseTypeName)\r\n        {\r\n            Assembly[] knownAssemblies = AppDomain.CurrentDomain.GetAssemblies();\r\n\r\n            Type baseType = Type.GetType(baseTypeName, false);\r\n\r\n            if (baseType == null)\r\n            {\r\n                foreach (string referencedAssemblyFileName in parms.ReferencedAssemblies)\r\n                {\r\n                    Assembly assembly = knownAssemblies\r\n                                        .FirstOrDefault(f => f.CodeBase.EndsWith(referencedAssemblyFileName, StringComparison.OrdinalIgnoreCase));\r\n\r\n                    if (assembly != null)\r\n                    {\r\n                        baseType = assembly.GetType(baseTypeName, false);\r\n\r\n                        if (baseType != null)\r\n                            break;\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new InvalidOperationException(string.Format(\"Did not find a candidate for referenced assembly '{0}'\", referencedAssemblyFileName));\r\n                    }\r\n\r\n                }\r\n            }\r\n\r\n            return baseType;\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Foundation/PluginFacades/ITypeManagerTypeHandlerPluginFacade.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Core.Types.Foundation.PluginFacades\r\n{\r\n\tinternal interface ITypeManagerTypeHandlerPluginFacade\r\n\t{\r\n        Type GetType(string providerName, string fullName);\r\n        string SerializedType(string providerName, Type type);\r\n        bool HasTypeWithName(string providerName, string typeFullname);\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Foundation/PluginFacades/TypeManagerTypeHandlerPluginFacade.cs",
    "content": "using System;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.Types.Foundation.PluginFacades\r\n{\r\n    internal static class TypeManagerTypeHandlerPluginFacade\r\n    {\r\n        private static ITypeManagerTypeHandlerPluginFacade _implementation = new TypeManagerTypeHandlerPluginFacadeImpl();\r\n\r\n        internal static ITypeManagerTypeHandlerPluginFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        static TypeManagerTypeHandlerPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static Type GetType(string providerName, string fullName)\r\n        {\r\n            return _implementation.GetType(providerName, fullName);\r\n        }\r\n\r\n\r\n\r\n        public static string SerializedType(string providerName, Type type)\r\n        {\r\n            return _implementation.SerializedType(providerName, type);\r\n        }\r\n\r\n\r\n\r\n        public static bool HasTypeWithName(string providerName, string typeFullname)\r\n        {\r\n            return _implementation.HasTypeWithName(providerName, typeFullname);\r\n        }\r\n\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Foundation/PluginFacades/TypeManagerTypeHandlerPluginFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler.Runtime;\r\n\r\n\r\nnamespace Composite.Core.Types.Foundation.PluginFacades\r\n{\r\n    internal sealed class TypeManagerTypeHandlerPluginFacadeImpl : ITypeManagerTypeHandlerPluginFacade\r\n    {\r\n        private static readonly object _syncRoot = new object();\r\n        private static Resources _resources;\r\n\r\n        public Type GetType(string providerName, string fullName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentNotNullOrEmpty(fullName, \"fullName\");\r\n\r\n            ITypeManagerTypeHandler typeManagerTypeHandler = GetTypeManagerTypeHandler(providerName);\r\n            return typeManagerTypeHandler.GetType(fullName);\r\n        }\r\n\r\n\r\n\r\n        public string SerializedType(string providerName, Type type)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentNotNull(type, \"type\");\r\n\r\n            ITypeManagerTypeHandler typeManagerTypeHandler = GetTypeManagerTypeHandler(providerName);\r\n            return typeManagerTypeHandler.SerializeType(type);\r\n        }\r\n\r\n\r\n\r\n        public bool HasTypeWithName(string providerName, string typeFullname)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentNotNullOrEmpty(typeFullname, \"typeFullname\");\r\n\r\n            ITypeManagerTypeHandler typeManagerTypeHandler = GetTypeManagerTypeHandler(providerName);\r\n            return typeManagerTypeHandler.HasTypeWithName(typeFullname);\r\n        }\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _resources = null;\r\n        }\r\n\r\n        private static ITypeManagerTypeHandler GetTypeManagerTypeHandler(string providerName)\r\n        {\r\n            Resources resources = GetResources();\r\n\r\n            return resources.TypeHandlerCache.GetOrAdd(providerName,\r\n                provider =>\r\n                {\r\n                    ITypeManagerTypeHandler typeHandler = resources.Factory.Create(provider);\r\n\r\n                    return typeHandler;\r\n                });\r\n        }\r\n\r\n\r\n        private static Resources GetResources()\r\n        {\r\n            Resources result = _resources;\r\n            if(result == null)\r\n            {\r\n                lock(_syncRoot)\r\n                {\r\n                    result = _resources;\r\n                    if(result == null)\r\n                    {\r\n                        result = BuildResources();\r\n                        _resources = result;\r\n                    }\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n        private static Resources BuildResources()\r\n        {\r\n            return new Resources\r\n                       {\r\n                           Factory = new TypeManagerTypeHandlerFactory(),\r\n                           TypeHandlerCache = new ConcurrentDictionary<string, ITypeManagerTypeHandler>()\r\n                       };\r\n        }\r\n\r\n        private sealed class Resources\r\n        {\r\n            public TypeManagerTypeHandlerFactory Factory { get; set; }\r\n            public ConcurrentDictionary<string, ITypeManagerTypeHandler> TypeHandlerCache { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/GenericComparer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Collections;\r\nusing System.Reflection;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    internal class GenericComparer<T> : IComparer, IComparer<T> \r\n    {\r\n        public static GenericComparer<T> Build(Type type, string propertyName)\r\n        {\r\n            return new GenericComparer<T>(type, propertyName, true);\r\n        }\r\n\r\n\r\n\r\n        public static GenericComparer<T> Build(Type type, string propertyName, bool ascDesc)\r\n        {\r\n            return new GenericComparer<T>(type, propertyName, ascDesc);\r\n        }\r\n\r\n\r\n\r\n        private MemberInfo _field;\r\n        private bool _ascDesc;\r\n\r\n        public GenericComparer(Type type, string propertyName, bool ascDesc)\r\n        {\r\n            this._field = type.GetPropertiesRecursively(f => f.Name == propertyName)[0];\r\n            this._ascDesc = ascDesc;\r\n        }\r\n\r\n\r\n\r\n        object GetValue(object obj)\r\n        {\r\n\r\n            if (_field is FieldInfo)\r\n\r\n                return ((FieldInfo)_field).GetValue(obj);\r\n\r\n            else\r\n\r\n                return ((PropertyInfo)_field).GetValue(obj, new object[0]);\r\n\r\n        }\r\n\r\n\r\n\r\n        int IComparer.Compare(object obj1, object obj2)\r\n        {\r\n            IComparable comparer = (IComparable)GetValue(obj1);\r\n\r\n            return comparer.CompareTo(GetValue(obj2)) * (_ascDesc ? 1 : -1);\r\n\r\n        }\r\n\r\n\r\n        public int Compare(T obj1, T obj2)\r\n        {\r\n            IComparable comparer = (IComparable)GetValue(obj1);\r\n            object value = GetValue(obj2);\r\n\r\n            if ((comparer == null) && (value == null)) return 0;\r\n\r\n            if (comparer == null) return (_ascDesc ? 1 : -1);\r\n            if (value == null) return (_ascDesc ? -1 : 1);\r\n\r\n            return comparer.CompareTo(value) * (_ascDesc ? 1 : -1);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/ICodeProvider.cs",
    "content": "﻿using System.ComponentModel;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>\r\n    /// Implementing this interface and regitre an instance with the method <see cref=\"CodeGenerationManager.AddAssemblyCodeProvider\"/>\r\n    /// you can get code compiled when C1 shuts down or restarts. \r\n    /// Use the <see cref=\"CodeGenerationBuilder\"/> to add code to compile.\r\n    /// Compiling code when C1 is running see the method <see cref=\"CodeGenerationManager.CompileRuntimeTempTypes\"/>.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    public interface ICodeProvider\r\n    {\r\n        /// <summary>\r\n        /// Add code namespaces and types and references you want to have compiled\r\n        /// to the builder.\r\n        /// </summary>\r\n        /// <param name=\"builder\"></param>\r\n        void GetCodeToCompile(CodeGenerationBuilder builder);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/ITypeManager.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n\tinternal interface ITypeManager\r\n\t{\r\n        Type GetType(string fullName);\r\n        Type TryGetType(string fullName);\r\n        string SerializeType(Type type);\r\n        string TrySerializeType(Type type);\r\n        bool HasTypeWithName(string typeFullname);\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/KeyValuePair.cs",
    "content": "namespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class KeyValuePair\r\n    {\r\n        private string _key = \"\";\r\n        private string _value = \"\";\r\n\r\n        /// <exclude />\r\n        public KeyValuePair()\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public KeyValuePair(string key, string value)\r\n        {\r\n            _key = key;\r\n            _value = value;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Key\r\n        {\r\n            get { return _key; }\r\n            set { _key = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Value\r\n        {\r\n            get { return _value; }\r\n            set { _value = value; }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Types/NameTypePair.cs",
    "content": "using System;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    internal sealed class NameTypePair\r\n    {\r\n        private string _name;\r\n        private Type _type;\r\n\r\n        public NameTypePair(string name, Type type)\r\n        {\r\n            _name = name;\r\n            _type = type;\r\n        }\r\n\r\n        public string Name\r\n        {\r\n            get { return _name; }\r\n        }\r\n\r\n        public Type Type\r\n        {\r\n            get { return _type; }\r\n        }\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Pair.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class Pair<TFirst, TSecond>\r\n\t{\r\n\r\n        /// <exclude />\r\n        public Pair(TFirst firstValue, TSecond secondValue)\r\n        {\r\n            this.First = firstValue;\r\n            this.Second = secondValue;\r\n        }\r\n\r\n        /// <exclude />\r\n        public TFirst First { get; set; }\r\n\r\n        /// <exclude />\r\n        public TSecond Second { get; set; }\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as Pair<TFirst, TSecond>);   \r\n        }\r\n\r\n        /// <exclude />\r\n        public bool Equals(Pair<TFirst, TSecond> pair)\r\n        {\r\n            if (pair == null) return false;\r\n\r\n            return object.Equals(this.First, pair.First) && object.Equals(this.Second, pair.Second);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return this.First.GetHashCode() ^ this.Second.GetHashCode();\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return string.Format(\"First: {0}, Second: {1}\", this.First, this.Second);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Plugins/TypeManagerTypeHandler/ITypeManagerTypeHandler.cs",
    "content": "using System;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Types.Plugins.TypeManagerTypeHandler\r\n{\r\n    [CustomFactory(typeof(TypeManagerTypeHandlerCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(TypeManagerTypeHandlerDefaultNameRetriever))]\r\n    internal interface ITypeManagerTypeHandler\r\n    {        \r\n        Type GetType(string serializedType);\r\n        string SerializeType(Type type);\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"typeFullname\">Full name: namespace+name. X.Y.Z where X.Y is the namespace and Z is the type.</param>\r\n        /// <returns></returns>\r\n        bool HasTypeWithName(string typeFullname);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Plugins/TypeManagerTypeHandler/NonConfigurableTypeManagerTypeHandler.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Types.Plugins.TypeManagerTypeHandler\r\n{\r\n    [Assembler(typeof(NonConfigurableTypeManagerTypeHandlerAssembler))]\r\n    internal sealed class NonConfigurableTypeManagerTypeHandler : TypeManagerTypeHandlerData\r\n    {\r\n    }\r\n\r\n\r\n    internal sealed class NonConfigurableTypeManagerTypeHandlerAssembler : IAssembler<ITypeManagerTypeHandler, TypeManagerTypeHandlerData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public ITypeManagerTypeHandler Assemble(IBuilderContext context, TypeManagerTypeHandlerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (ITypeManagerTypeHandler)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Plugins/TypeManagerTypeHandler/Runtime/TypeManagerTypeHandlerCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Types.Plugins.TypeManagerTypeHandler.Runtime\r\n{\r\n    internal sealed class TypeManagerTypeHandlerCustomFactory : AssemblerBasedCustomFactory<ITypeManagerTypeHandler, TypeManagerTypeHandlerData>\r\n    {\r\n        protected override TypeManagerTypeHandlerData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            TypeManagerTypeHandlerSettings settings = configurationSource.GetSection(TypeManagerTypeHandlerSettings.SectionName) as TypeManagerTypeHandlerSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", TypeManagerTypeHandlerSettings.SectionName));\r\n            }\r\n\r\n            return settings.TypeManagerTypeHandlerPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Plugins/TypeManagerTypeHandler/Runtime/TypeManagerTypeHandlerDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Types.Plugins.TypeManagerTypeHandler.Runtime\r\n{\r\n    internal sealed class TypeManagerTypeHandlerDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Plugins/TypeManagerTypeHandler/Runtime/TypeManagerTypeHandlerFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.Types.Plugins.TypeManagerTypeHandler.Runtime\r\n{\r\n    internal sealed class TypeManagerTypeHandlerFactory : NameTypeFactoryBase<ITypeManagerTypeHandler>\r\n    {\r\n        public TypeManagerTypeHandlerFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Plugins/TypeManagerTypeHandler/Runtime/TypeManagerTypeHandlerSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Types.Plugins.TypeManagerTypeHandler.Runtime\r\n{\r\n    internal sealed class TypeManagerTypeHandlerSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Core.Types.Plugins.TypeManagerTypeHandler\";\r\n        \r\n\r\n        private const string _typeManagerTypeHandlerPluginsProperty = \"TypeManagerTypeHandlerPlugins\";\r\n        [ConfigurationProperty(_typeManagerTypeHandlerPluginsProperty, IsRequired = true)]\r\n        public NameTypeConfigurationElementCollection<TypeManagerTypeHandlerData, TypeManagerTypeHandlerData> TypeManagerTypeHandlerPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeConfigurationElementCollection<TypeManagerTypeHandlerData, TypeManagerTypeHandlerData>)base[_typeManagerTypeHandlerPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/Plugins/TypeManagerTypeHandler/TypeManagerTypeHandlerData.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Types.Plugins.TypeManagerTypeHandler\r\n{\r\n    internal class TypeManagerTypeHandlerData : NameTypeConfigurationElement\r\n    {\r\n        private const string _priorityPropertyName = \"priority\";\r\n        [ConfigurationProperty(_priorityPropertyName, IsRequired = true, IsKey = true)]\r\n        public int Priority\r\n        {\r\n            get { return (int)base[_priorityPropertyName]; }\r\n            set { base[_priorityPropertyName] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/PrimitiveTypes.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    internal static class PrimitiveTypes\r\n    {\r\n        private static readonly Type[] _primitiveTypes = \r\n                {\r\n                    typeof(DateTime),\r\n                    typeof(Boolean),\r\n                    typeof(Byte),\r\n                    typeof(Char),\r\n                    typeof(Double),\r\n                    typeof(Guid),\r\n                    typeof(Int16),\r\n                    typeof(Int32),\r\n                    typeof(Int64),\r\n                    typeof(SByte),\r\n                    typeof(Single),\r\n                    typeof(UInt16),\r\n                    typeof(UInt32),\r\n                    typeof(UInt64),\r\n                    typeof(string),\r\n                    typeof(Decimal)\r\n                };\r\n\r\n\r\n\r\n        public static IEnumerable<Type> Types\r\n        {\r\n            get\r\n            {\r\n                return _primitiveTypes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static bool IsPrimitiveType(this Type type)\r\n        {\r\n            return _primitiveTypes.Contains(type);\r\n        }\r\n\r\n\r\n\r\n        public static bool IsPrimitiveOrNullableType(this Type type)\r\n        {\r\n            if ((type.IsGenericType) &&\r\n                (type.GetGenericTypeDefinition() == typeof(Nullable<>)))\r\n            {\r\n                return IsPrimitiveType(type.GetGenericArguments()[0]);\r\n            }\r\n            else\r\n            {\r\n                return IsPrimitiveType(type);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/StaticReflection.cs",
    "content": "﻿using System;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    internal static class StaticReflection\r\n    {\r\n        public static MethodInfo GetGenericMethodInfo(Expression<Action<object>> expression)\r\n        {\r\n            Verify.ArgumentNotNull(expression, \"expression\");\r\n\r\n            return GetMethodInfo(expression.Body).GetGenericMethodDefinition();\r\n        }\r\n\r\n        public static MethodInfo GetGenericMethodInfo(Expression<Func<object>> expression)\r\n        {\r\n            Verify.ArgumentNotNull(expression, \"expression\");\r\n\r\n            return GetMethodInfo(expression.Body).GetGenericMethodDefinition();\r\n        }\r\n\r\n        public static MethodInfo GetMethodInfo<T, S>(Expression<Func<T, S>>  expression)\r\n        {\r\n            return GetMethodInfo(expression.Body as MethodCallExpression);\r\n        }\r\n\r\n        public static MethodInfo GetMethodInfo<T>(Expression<Func<T>> expression)\r\n        {\r\n            return GetMethodInfo(expression.Body as MethodCallExpression);\r\n        }\r\n\r\n        public static MethodInfo GetMethodInfo(Expression expression)\r\n        {\r\n            Verify.ArgumentNotNull(expression, \"expression\");\r\n\r\n            if (expression is UnaryExpression\r\n                && (expression as UnaryExpression).NodeType == ExpressionType.Convert)\r\n            {\r\n                expression = (expression as UnaryExpression).Operand;\r\n            }\r\n\r\n            Verify.ArgumentCondition(expression is MethodCallExpression, \"expressionBody\", \r\n                                     \"Expression body should be of type '{0}'\".FormatWith(typeof(MethodCallExpression).Name));\r\n\r\n            return (expression as MethodCallExpression).Method;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/TypeExtensionMethods.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class TypeExtensionMethods\r\n    {\r\n        private static Hashtable<PropertyInfo, List<Attribute>> _propertyAttributeCache = new Hashtable<PropertyInfo, List<Attribute>>();\r\n\r\n        /// <exclude />\r\n        static TypeExtensionMethods()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetVersionNeutralName(this Type type)\r\n        {\r\n            if (!type.IsGenericType)\r\n            {\r\n                return string.Format(\"{0},{1}\", type.FullName, type.Assembly.FullName.Split(',')[0]);\r\n            }\r\n            \r\n            Type[] genericArguments = type.GetGenericArguments();\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n            bool firstTime = true;\r\n            foreach (Type genericType in genericArguments)\r\n            {\r\n                string serializedType = GetVersionNeutralName(genericType);\r\n\r\n                if (firstTime == false)\r\n                {\r\n                    sb.Append(\",\");\r\n                }\r\n                else\r\n                {\r\n                    firstTime = false;\r\n                }\r\n\r\n                sb.Append(string.Format(\"[{0}]\", serializedType));\r\n            }\r\n\r\n            string fullName = type.FullName.Remove(type.FullName.IndexOf('['));\r\n\r\n            return string.Format(\"{0}[{1}],{2}\", fullName, sb, type.Assembly.FullName.Split(',')[0]);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<PropertyInfo> GetPropertiesRecursively(this Type type)\r\n        {\r\n            return GetPropertiesRecursively(type, null);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<PropertyInfo> GetPropertiesRecursively(this Type type, Func<PropertyInfo, bool> predicate)\r\n        {\r\n            predicate = predicate ?? (p => true);\r\n\r\n            var properties = new List<PropertyInfo>();\r\n            properties.AddRange(type.GetProperties().Where(predicate));\r\n\r\n            Type[] interfaceTypes = type.GetInterfaces();\r\n            foreach (Type interfaceType in interfaceTypes)\r\n            {\r\n                properties.AddRange(interfaceType.GetProperties().Where(predicate));\r\n            }\r\n\r\n            // A compatibility fix, returning the same \"PageId\" property twice usually leads to an error\r\n            if (typeof (IPageData).IsAssignableFrom(type))\r\n            {\r\n                properties.RemoveAll(p => p.Name == nameof (IPageData.PageId) && p.DeclaringType == typeof (IPageData));\r\n            }\r\n\r\n            return properties;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<Type> GetInterfacesRecursively(this Type type)\r\n        {\r\n            var interfaces = new List<Type>();\r\n\r\n            GetInterfacesRecursively(type, null, interfaces);\r\n\r\n            return interfaces;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<Type> GetInterfacesRecursively(this Type type, Func<Type, bool> predicate)\r\n        {\r\n            var interfaces = new List<Type>();\r\n\r\n            GetInterfacesRecursively(type, predicate, interfaces);\r\n\r\n            return interfaces;\r\n        }\r\n\r\n\r\n\r\n        private static void GetInterfacesRecursively(this Type type, Func<Type, bool> predicate, List<Type> interfaces)\r\n        {\r\n            foreach (Type interfaceType in type.GetInterfaces())\r\n            {\r\n                if (predicate == null || predicate(interfaceType))\r\n                {\r\n                    if (!interfaces.Contains(interfaceType))\r\n                    {\r\n                        interfaces.Add(interfaceType);\r\n                    }\r\n                }\r\n\r\n                GetInterfacesRecursively(interfaceType, predicate, interfaces);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string SerializeValue(this Type sourceType, object valueToSerialize)\r\n        {\r\n            if (valueToSerialize == null) return null;\r\n\r\n            if (sourceType == typeof(string)) return (string)valueToSerialize;\r\n            if (sourceType == typeof(Guid)) return valueToSerialize.ToString();\r\n            if (sourceType == typeof(int)) return valueToSerialize.ToString();\r\n\r\n            throw new NotImplementedException(string.Format(\"Serialization of the the type {0} is not supported\", sourceType.FullName));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static object DeserializeValue(this Type targetType, string serializedValue)\r\n        {\r\n            if (serializedValue == null) return null;\r\n\r\n            if (targetType == typeof(string)) return serializedValue;\r\n            if (targetType == typeof(Guid)) return new Guid(serializedValue);\r\n            if (targetType == typeof(int)) return int.Parse(serializedValue); ;\r\n\r\n            throw new NotImplementedException(string.Format(\"Deserializing values of the the type {0} is not supported\", targetType.FullName));\r\n        }\r\n\r\n\r\n        private static readonly Hashtable<Type, List<Attribute>> _interfaceAttributeCache = new Hashtable<Type, List<Attribute>>();\r\n        private static readonly object _lock = new object();\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<T> GetCustomInterfaceAttributes<T>(this Type type) where T : Attribute\r\n        {\r\n            List<Attribute> attributeList;\r\n\r\n            if (!_interfaceAttributeCache.TryGetValue(type, out attributeList))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_interfaceAttributeCache.TryGetValue(type, out attributeList))\r\n                    {\r\n                        attributeList = new List<Attribute>();\r\n                        GetCustomAttributesRecursively(type, attributeList, null, new List<Type>(), true);\r\n\r\n                        _interfaceAttributeCache.Add(type, attributeList);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return attributeList.OfType<T>();\r\n        }\r\n\r\n\r\n\r\n\r\n        private static readonly ConcurrentDictionary<Type, List<Attribute>> _typeAttributeCache = new ConcurrentDictionary<Type, List<Attribute>>();\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<T> GetCustomAttributesRecursively<T>(this Type type)\r\n            where T : Attribute\r\n        {\r\n            return GetCustomAttributesRecursively(type).OfType<T>();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Attribute> GetCustomAttributesRecursively(this Type type, Type attributeType)\r\n        {\r\n            return GetCustomAttributesRecursively(type).Where(attr => attr.GetType() == attributeType);\r\n        }\r\n\r\n\r\n        private static IEnumerable<Attribute> GetCustomAttributesRecursively(this Type type)\r\n        {\r\n            return _typeAttributeCache.GetOrAdd(type, t =>\r\n            {\r\n                var attributeList = new List<Attribute>();\r\n\r\n                GetCustomAttributesRecursively(t, attributeList, null, new List<Type>(), false);\r\n\r\n                return attributeList;\r\n            });\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<T> GetCustomAttributesRecursively<T>(this PropertyInfo propertyInfo)\r\n            where T : Attribute\r\n        {\r\n            List<Attribute> attributeList;\r\n\r\n            if (!_propertyAttributeCache.TryGetValue(propertyInfo, out attributeList))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_propertyAttributeCache.TryGetValue(propertyInfo, out attributeList))\r\n                    {\r\n                        attributeList = new List<Attribute>();\r\n                        GetCustomAttributesRecursively(propertyInfo.DeclaringType, attributeList, propertyInfo.Name, new List<Type>(), false);\r\n\r\n                        _propertyAttributeCache.Add(propertyInfo, attributeList);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return attributeList.OfType<T>();\r\n        }\r\n\r\n\r\n\r\n        private static void GetCustomAttributesRecursively(Type type, List<Attribute> foundAttributes, string propertyName, List<Type> typesChecked, bool examineInterfacesOnly)\r\n        {\r\n            if (typesChecked.Contains(type))\r\n            {\r\n                return;\r\n            }\r\n            \r\n            typesChecked.Add(type);\r\n            \r\n\r\n            IEnumerable<Attribute> attributes = null;\r\n\r\n            if (propertyName == null)\r\n            {\r\n                if (!examineInterfacesOnly || type.IsInterface)\r\n                {\r\n                    attributes = type.GetCustomAttributes(false).Cast<Attribute>();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                PropertyInfo propertyInfo = type.GetProperty(propertyName);\r\n\r\n                if (propertyInfo != null)\r\n                {\r\n                    attributes = propertyInfo.GetCustomAttributes(true).Cast<Attribute>();\r\n                }\r\n            }\r\n\r\n            if (attributes != null)\r\n            {\r\n                foundAttributes.AddRange(attributes);\r\n            }\r\n            \r\n            if (!examineInterfacesOnly && type.BaseType != null && type.BaseType != typeof(object))\r\n            {\r\n                GetCustomAttributesRecursively(type.BaseType, foundAttributes, propertyName, typesChecked, examineInterfacesOnly);\r\n            }\r\n\r\n            Type[] interfaces = type.GetInterfaces();\r\n            foreach (Type interfaceType in interfaces)\r\n            {\r\n                GetCustomAttributesRecursively(interfaceType, foundAttributes, propertyName, typesChecked, examineInterfacesOnly);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetShortLabel(this Type type)\r\n        {\r\n            if (type.IsGenericType)\r\n            {\r\n                string genericUglyName = type.Name;\r\n\r\n                if (genericUglyName.IndexOf('`') > -1)\r\n                {\r\n                    StringBuilder sb = new StringBuilder(genericUglyName.Substring(0, genericUglyName.IndexOf('`')));\r\n\r\n                    sb.Append('<');\r\n                    bool firstArg = true;\r\n                    foreach (Type genericArgument in type.GetGenericArguments())\r\n                    {\r\n                        if (firstArg == false) sb.Append(',');\r\n                        sb.Append(genericArgument.GetShortLabel());\r\n                        firstArg = false;\r\n                    }\r\n                    sb.Append('>');\r\n\r\n                    return sb.ToString();\r\n                }\r\n                \r\n                return type.Name;\r\n            }\r\n            \r\n            var titleAttributes = type.GetCustomInterfaceAttributes<TitleAttribute>();\r\n            if (titleAttributes != null && titleAttributes.Any())\r\n            {\r\n                return titleAttributes.First().Title;\r\n            }\r\n\r\n            return type.Name;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsLazyGenericType(this Type type)\r\n        {\r\n            return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Lazy<>);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsAssignableOrLazyFrom(this Type currentType, Type possibleSubType)\r\n        {\r\n            if (currentType.IsAssignableFrom(possibleSubType))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            if (possibleSubType.IsLazyGenericType())\r\n            {\r\n                var lazyType = possibleSubType.GetGenericArguments().First();\r\n\r\n                return currentType.IsAssignableFrom(lazyType);\r\n            }\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _propertyAttributeCache = new Hashtable<PropertyInfo, List<Attribute>>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/TypeLocator.cs",
    "content": "using System;\r\nusing System.Reflection;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\n\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]\r\n    internal sealed class BaseTypeIncludesAttribute : Attribute\r\n    {\r\n        private Type _baseType;\r\n        private TypeIncludes _includes;\r\n\r\n        \r\n        \r\n        public BaseTypeIncludesAttribute(Type baseType) : this(baseType, TypeIncludes.ConcreteTypes)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public BaseTypeIncludesAttribute(Type baseType, TypeIncludes includes)\r\n        {\r\n            _baseType = baseType;\r\n            _includes = includes;\r\n        }\r\n\r\n\r\n\r\n        public Type BaseType { get { return _baseType; } }\r\n        public TypeIncludes TypeIncludes { get { return _includes; } }\r\n    }\r\n\r\n    [Flags]\r\n    internal enum TypeIncludes\r\n    {\r\n        /// <summary>\r\n        /// Include interfaces in the result.\r\n        /// </summary>\r\n        InterfaceTypes = 0x01,\r\n        /// <summary>\r\n        /// Include concrete types in the result.\r\n        /// </summary>\r\n        ConcreteTypes = 0x02,\r\n        /// <summary>\r\n        /// Include primitives in the result.\r\n        /// </summary>\r\n        PrimitiveTypes = 0x04,\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TypeLocator\r\n    {\r\n        public static IEnumerable<Type> FindTypes(TypeIncludes flags)\r\n        {\r\n            return FindTypes(flags, typeof(object));\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Type> FindTypes(TypeIncludes flags, Type baseType)\r\n        {\r\n            if (baseType == null) throw new ArgumentNullException(\"baseType\", \"Must be set to a type\");\r\n\r\n            Func<Type, bool> predicate = BuildPredicate(flags);\r\n            var foundTypes = from containedType in FindTypes(baseType)\r\n                             where predicate(containedType)\r\n                             select containedType;\r\n\r\n            if (!(IsSet(flags, TypeIncludes.ConcreteTypes) && IsConcreteType(baseType)))\r\n            {\r\n                if(foundTypes.Contains(baseType))\r\n                {\r\n                    IList<Type> b = new List<Type>();\r\n                    b.Add(baseType);\r\n                    foundTypes = foundTypes.Except(b.AsQueryable());\r\n                }\r\n            }\r\n            \r\n            if (IsSet(flags, TypeIncludes.PrimitiveTypes))\r\n            {\r\n                foundTypes = foundTypes.Concat(FindPrimitiveTypes());\r\n            }\r\n            return foundTypes;\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<Type> FindPrimitiveTypes()\r\n        {\r\n            return PrimitiveTypes.Types;\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<Type> FindTypes(Type type)\r\n        {\r\n            IEnumerable<Assembly> assemblies = GetPropeableAssemblies();\r\n\r\n            var typesFound =\r\n                from containedTypes in\r\n                    (\r\n                        from assembly in assemblies\r\n                        select GetTypesFromAssembly( assembly )\r\n                    )\r\n                from singleType in containedTypes\r\n                where type.IsAssignableFrom(singleType) \r\n                select singleType;\r\n            return typesFound;\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<Type> GetTypesFromAssembly(Assembly assembly)\r\n        {\r\n            try\r\n            {\r\n                return assembly.GetTypes();\r\n            }\r\n            catch (ReflectionTypeLoadException ex)\r\n            {\r\n                if (ex.LoaderExceptions.Length > 0)\r\n                {\r\n                    throw new InvalidOperationException(\"Failed to reflect the assembly \" + assembly.FullName + \". The loader exception message is \" + ex.LoaderExceptions[0].Message, ex);\r\n                }\r\n                throw new InvalidOperationException(\"Failed to reflect the assembly \" + assembly.FullName, ex);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<Assembly> GetPropeableAssemblies()\r\n        {\r\n            return\r\n                from assembly in AppDomain.CurrentDomain.GetAssemblies()\r\n                where IsProbeableAssembly(assembly.FullName) \r\n                select assembly;\r\n        }\r\n\r\n\r\n\r\n        public static bool IsProbeableAssembly(string assemblyFullName)\r\n        {\r\n            string lowerAssemblyName = assemblyFullName.ToLowerInvariant();\r\n\r\n            if (lowerAssemblyName.IndexOf(',') > -1)\r\n            {\r\n                lowerAssemblyName = lowerAssemblyName.Substring(0, lowerAssemblyName.IndexOf(','));\r\n            }\r\n            \r\n\r\n            foreach (string excludeName in GlobalSettingsFacade.NonProbableAssemblyNames.Where(n => n.Contains(\"*\") == false))\r\n            {\r\n                if (lowerAssemblyName == excludeName.ToLowerInvariant()) return false;\r\n            }\r\n\r\n            foreach (string excludeStartName in GlobalSettingsFacade.NonProbableAssemblyNames.Where(n => n.EndsWith(\"*\")))\r\n            {\r\n                if (lowerAssemblyName.StartsWith(excludeStartName.Replace(\"*\", \"\").ToLowerInvariant())) return false;\r\n            }\r\n\r\n            return true;\r\n\r\n        }\r\n\r\n\r\n\r\n        private static bool IsConcreteType(Type type)\r\n        {\r\n            return (type.IsClass || type.IsValueType) && !type.IsAbstract;\r\n        }\r\n\r\n\r\n\r\n        private static IList<Func<Type, bool>> SelectFuntions(TypeIncludes flags)\r\n        {\r\n            bool includeAllInterfaces = IsSet(flags, TypeIncludes.InterfaceTypes);\r\n            bool includeConcreteTypes = IsSet(flags, TypeIncludes.ConcreteTypes);\r\n\r\n            List<Func<Type, bool>> functions = new List<Func<Type, bool>>();\r\n            if (includeAllInterfaces)\r\n            {\r\n                functions.Add(x => x.IsInterface);\r\n            }\r\n            if (includeConcreteTypes)\r\n            {\r\n                functions.Add(x => (IsConcreteType(x)));\r\n            }\r\n\r\n            return functions;\r\n        }\r\n\r\n\r\n\r\n        private static Func<Type, bool> BuildPredicate(TypeIncludes flags)\r\n        {\r\n            IList<Func<Type, bool>> functions = SelectFuntions(flags);\r\n\r\n            Func<Func<Type, bool>, Func<Type, bool>, Func<Type, bool>>\r\n                or = (f1, f2) => (t => f1(t) || f2(t));\r\n\r\n            Func<Type, bool> current = (x => false);\r\n            foreach (Func<Type, bool> func in functions)\r\n            {\r\n                current = or(func, current);\r\n            }\r\n            return current;\r\n        }\r\n\r\n\r\n\r\n        private static bool IsSet(TypeIncludes flags, TypeIncludes compareFlag)\r\n        {\r\n            return ((flags & compareFlag) == compareFlag);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/TypeManager.cs",
    "content": "using System;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class TypeManager\r\n    {\r\n        private static ITypeManager _implementation = new TypeManagerImpl();\r\n\r\n        internal static ITypeManager Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n        static TypeManager()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a type by name, throws an exception if no type found.\r\n        /// </summary>\r\n        /// <param name=\"fullName\">The full name of the type.</param>\r\n        /// <returns>A <see cref=\"System.Type\"/> instance.</returns>\r\n        public static Type GetType(string fullName)\r\n        {\r\n            return _implementation.GetType(fullName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the type with the provided fullName (or null).\r\n        /// </summary>\r\n        /// <returns>A type or null</returns>\r\n        public static Type TryGetType(string fullName)\r\n        {\r\n            return _implementation.TryGetType(fullName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetRuntimeFullName(string fullName)\r\n        {\r\n            if (fullName.StartsWith(\"DynamicType:\")) return fullName.Remove(0, \"DynamicType:\".Length);\r\n\r\n            return fullName;\r\n        }\r\n\r\n        /// <summary>\r\n        /// In C1 2.1 and older dynamic types had a \"DynamicType:\" prefix in references. \r\n        /// This method removes this no longer used prefix.\r\n        /// </summary>\r\n        internal static string FixLegasyTypeName(string typeManagerTypeName)\r\n        {\r\n            if (typeManagerTypeName.StartsWith(\"DynamicType:\", StringComparison.InvariantCultureIgnoreCase))\r\n            {\r\n                return typeManagerTypeName.Remove(0, \"DynamicType:\".Length);\r\n            }\r\n\r\n            return typeManagerTypeName;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string SerializeType(Type type)\r\n        {\r\n            return _implementation.SerializeType(type);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string TrySerializeType(Type type)\r\n        {\r\n            return _implementation.TrySerializeType(type);\r\n        }\r\n      \r\n\r\n\r\n        /// <summary>\r\n        /// This method return true if there is type with the fullname <para>typeFullname</para> anywhere in the system.\r\n        /// </summary>\r\n        /// <param name=\"typeFullname\">Full name: namespace+name. X.Y.Z where X.Y is the namespace and Z is the type.</param>\r\n        /// <returns></returns>\r\n        public static bool HasTypeWithName(string typeFullname)\r\n        {\r\n            return _implementation.HasTypeWithName(typeFullname);\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Core/Types/TypeManagerImpl.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Types.BuildinPlugins.BuildinTypeManagerTypeHandler;\r\nusing Composite.Core.Types.Foundation.PluginFacades;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    internal sealed class TypeManagerImpl : ITypeManager\r\n    {\r\n        private ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize, false);\r\n        private ConcurrentDictionary<Type, string> _serializedTypeLookup = new ConcurrentDictionary<Type, string>();\r\n       \r\n\r\n        public Type GetType(string fullName)\r\n        {\r\n            return GetType(fullName, true);\r\n        }\r\n\r\n        private Type GetType(string fullName, bool throwIfNotFound)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(fullName, \"fullName\");\r\n\r\n            Type type;\r\n\r\n            // A little nasty check here... /MRJ\r\n            if (fullName.StartsWith(\"<t\"))\r\n            {\r\n                var element = XElement.Parse(fullName);\r\n\r\n                type = GetGenericType(element);\r\n            }\r\n            else\r\n            {\r\n                type = GetNonGenericType(fullName);\r\n            }\r\n\r\n            if (throwIfNotFound && type == null)\r\n            {\r\n                throw new InvalidOperationException($\"The type '{fullName}' could not be found\");\r\n            }\r\n\r\n            return type;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the type with the provided fullName (or null).\r\n        /// </summary>\r\n        /// <returns>A type or null</returns>\r\n        public Type TryGetType(string fullName)\r\n        {\r\n            try\r\n            {\r\n                return GetType(fullName, false);\r\n            }\r\n            catch\r\n            {\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string SerializeType(Type type)\r\n        {\r\n            string serializedType = TrySerializeType(type);\r\n\r\n            if (string.IsNullOrEmpty(serializedType))\r\n            {\r\n                throw new InvalidOperationException(\r\n                    $\"No TypeManagerTypeHandler plugins could serialize the given type '{type}'\");\r\n            }\r\n\r\n            return serializedType;\r\n        }\r\n\r\n\r\n\r\n        public string TrySerializeType(Type type)\r\n        {\r\n            Verify.ArgumentNotNull(type, nameof(type));\r\n\r\n            return _serializedTypeLookup.GetOrAdd(type,\r\n                t => t.IsGenericType ? TrySerializeGenericType(t).ToString() : TrySerializeNonGenericType(t));\r\n        }\r\n\r\n\r\n\r\n        public void AddCompiledType(Type compiledType)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method return true if there is type with the fullname <para>typeFullname</para> anywhere in the system.\r\n        /// </summary>\r\n        /// <param name=\"typeFullname\">Full name: namespace+name. X.Y.Z where X.Y is the namespace and Z is the type.</param>\r\n        /// <returns></returns>\r\n        public bool HasTypeWithName(string typeFullname)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                if (_resourceLocker.Resources.BuildinHandler != null)\r\n                {\r\n                    return _resourceLocker.Resources.BuildinHandler.HasTypeWithName(typeFullname);\r\n                }\r\n            }\r\n\r\n            var providerEntries = _resourceLocker.Resources.ProviderNameList;\r\n            \r\n            return providerEntries.Any(entry => TypeManagerTypeHandlerPluginFacade.HasTypeWithName(entry.ProviderName, typeFullname));\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _serializedTypeLookup = new ConcurrentDictionary<Type, string>();\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private Type GetGenericType(XElement element)\r\n        {\r\n            if (element.HasElements)\r\n            {\r\n                XAttribute attribute = element.Attribute(\"n\");\r\n\r\n                if (attribute == null) return null;\r\n\r\n                List<Type> genericArguments = new List<Type>();\r\n\r\n                foreach (XElement childElement in element.Elements())\r\n                {\r\n                    Type type = GetGenericType(childElement);\r\n\r\n                    if (type == null) return null;\r\n\r\n                    genericArguments.Add(type);\r\n                }\r\n\r\n                Type genericType = Type.GetType(attribute.Value);\r\n\r\n                return genericType?.MakeGenericType(genericArguments.ToArray());\r\n            }\r\n            else\r\n            {\r\n                XAttribute attribute = element.Attribute(\"n\");\r\n\r\n                if (attribute == null) return null;\r\n\r\n                return GetNonGenericType(attribute.Value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Type GetNonGenericType(string fullName)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                if (_resourceLocker.Resources.BuildinHandler != null)\r\n                {\r\n                    return _resourceLocker.Resources.BuildinHandler.GetType(fullName);\r\n                }\r\n            }\r\n\r\n            fullName = TypeManager.FixLegasyTypeName(fullName);\r\n\r\n            // This should be the first thing tried, otherwise \"old\" types are found in Composite.Generated.dll instead of a possible new compiled version of the type /MRJ\r\n            if (!fullName.Contains(\",\"))\r\n            {\r\n                Type compositeType = typeof (Composite.Data.IData).Assembly.GetType(fullName, false);\r\n                if (compositeType != null) return compositeType;\r\n            }\r\n\r\n            List<ProviderEntry> providerEntries = new List<ProviderEntry>(_resourceLocker.Resources.ProviderNameList);\r\n\r\n            foreach (ProviderEntry entry in providerEntries)\r\n            {\r\n                Type type = TypeManagerTypeHandlerPluginFacade.GetType(entry.ProviderName, fullName);\r\n\r\n                if (type != null)\r\n                {\r\n                    return type;\r\n                }\r\n            }\r\n            \r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private XElement TrySerializeGenericType(Type type)\r\n        {\r\n            if (type.IsGenericType)\r\n            {\r\n                Type genericType = type.GetGenericTypeDefinition();\r\n\r\n                Type[] genericArguments = type.GetGenericArguments();\r\n\r\n                XElement element =\r\n                    new XElement(\"t\",\r\n                        new XAttribute(\"n\", genericType.AssemblyQualifiedName)\r\n                    );\r\n\r\n                foreach (Type genericArgument in genericArguments)\r\n                {\r\n                    XElement elm = TrySerializeGenericType(genericArgument);\r\n\r\n                    if (elm == null) return null;\r\n\r\n                    element.Add(elm);\r\n                }\r\n\r\n                return element;\r\n            }\r\n            \r\n            string serializedType = TrySerializeNonGenericType(type);\r\n            if (serializedType == null) return null;\r\n\r\n            return new XElement(\"t\", new XAttribute(\"n\", serializedType));\r\n        }\r\n\r\n\r\n\r\n        private string TrySerializeNonGenericType(Type type)\r\n        {\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                if (_resourceLocker.Resources.BuildinHandler != null)\r\n                {\r\n                    string serializedType = _resourceLocker.Resources.BuildinHandler.SerializeType(type);\r\n\r\n                    if (serializedType != null)\r\n                    {\r\n                        return serializedType;\r\n                    }\r\n                }\r\n            }\r\n\r\n            var providerEntries = new List<ProviderEntry>(_resourceLocker.Resources.ProviderNameList);\r\n\r\n            foreach (ProviderEntry entry in providerEntries)\r\n            {\r\n                string serializedType = TypeManagerTypeHandlerPluginFacade.SerializedType(entry.ProviderName, type);\r\n\r\n                if (serializedType != null)\r\n                {\r\n                    return serializedType;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private static IConfigurationSource GetConfiguration()\r\n        {\r\n            IConfigurationSource source = ConfigurationServices.ConfigurationSource;\r\n\r\n            if (null == source)\r\n            {\r\n                throw new ConfigurationErrorsException(\"No configuration source specified\");\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public List<ProviderEntry> ProviderNameList;\r\n            public ITypeManagerTypeHandler BuildinHandler;\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.BuildinHandler = null;\r\n\r\n                if (RuntimeInformation.IsUnittest\r\n                    && ConfigurationServices.ConfigurationSource?.GetSection(TypeManagerTypeHandlerSettings.SectionName) == null)\r\n                {\r\n                    resources.BuildinHandler = new BuildinTypeManagerTypeHandler();\r\n                }\r\n                else\r\n                {\r\n                    IConfigurationSource source = GetConfiguration();\r\n\r\n                    TypeManagerTypeHandlerSettings settings = source.GetSection(TypeManagerTypeHandlerSettings.SectionName) as TypeManagerTypeHandlerSettings;\r\n\r\n                    if (settings == null)\r\n                    {\r\n                        throw new ConfigurationErrorsException($\"Failed to load the configuration section '{TypeManagerTypeHandlerSettings.SectionName}' from the configuration\");\r\n                    }\r\n\r\n                    resources.ProviderNameList = new List<ProviderEntry>();\r\n\r\n                    foreach (TypeManagerTypeHandlerData data in settings.TypeManagerTypeHandlerPlugins)\r\n                    {\r\n                        resources.ProviderNameList.Add(new ProviderEntry(data.Priority, data.Name));\r\n                    }\r\n\r\n                    resources.ProviderNameList.Sort((e1, e2) => e1.Priority - e2.Priority);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [DebuggerDisplay(\"ProviderName = {ProviderName}, Priority = {Priority}\")]\r\n        private class ProviderEntry\r\n        {\r\n            public ProviderEntry(int priority, string providerName)\r\n            {\r\n                Priority = priority;\r\n                ProviderName = providerName;\r\n            }\r\n\r\n            public int Priority { get; }\r\n\r\n            public string ProviderName { get; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Types/ValueTypeConverter.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ValueTypeConverter\r\n    {\r\n        private static readonly MethodInfo NewLazyObjectMethodInfo = StaticReflection.GetGenericMethodInfo(() => NewLazyObject<object>(null));\r\n\r\n        /// <exclude />\r\n        public static object Convert(object value, Type targetType)\r\n        {\r\n            Exception conversionError;\r\n            return TryConvert(value, targetType, out conversionError);\r\n        }\r\n\r\n        /// <exclude />\r\n        internal static object TryConvert(object value, Type targetType, out Exception conversionError)\r\n        {\r\n            conversionError = null;\r\n\r\n            if (value == null)\r\n            {\r\n                if (!targetType.IsPrimitive)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                throw new InvalidOperationException(string.Format(\"Can not convert null to type '{0}'\", targetType));\r\n            }\r\n\r\n            \r\n            if (targetType.IsInstanceOfType(value))\r\n            {\r\n                return value;\r\n            }\r\n\r\n            if (targetType.IsLazyGenericType() && !value.GetType().IsLazyGenericType())\r\n            {\r\n                Type genericArgument = targetType.GetGenericArguments()[0];\r\n\r\n                object convertedValue = TryConvert(value, genericArgument, out conversionError);\r\n\r\n                return CreateLazyObject(() => convertedValue, genericArgument);\r\n            }\r\n\r\n\r\n            var helper = targetType.GetCustomAttributesRecursively<ValueTypeConverterHelperAttribute>().FirstOrDefault();\r\n            if (helper != null)\r\n            {\r\n                object ret;\r\n                if (helper.TryConvert(value, targetType, out ret))\r\n                {\r\n                    return ret;\r\n                }\r\n            }\r\n\r\n            var helper2 = value.GetType().GetCustomAttributesRecursively<ValueTypeConverterHelperAttribute>().FirstOrDefault();\r\n            if (helper2 != null)\r\n            {\r\n                object ret;\r\n                if (helper2.TryConvert(value, targetType, out ret))\r\n                {\r\n                    return ret;\r\n                }\r\n            }\r\n\r\n            if (targetType == typeof(object))\r\n            {\r\n                return value;\r\n            }\r\n\r\n            if ((IsGenericEnumerable(value.GetType())) &&\r\n                (IsGenericEnumerable(targetType)))\r\n            {\r\n                Type targetItemType = targetType.GetGenericArguments()[0];\r\n\r\n                IList targetValue = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(new [] { targetItemType }));\r\n\r\n                foreach (object valueItem in ((IEnumerable)value))\r\n                {\r\n                    object convertedValueItem = Convert(valueItem, targetItemType);\r\n\r\n                    targetValue.Add(convertedValueItem);\r\n                }\r\n\r\n                return targetValue;\r\n            }\r\n\r\n            // Haz item, wantz list of it.\r\n            if (!IsGenericEnumerable(value.GetType())\r\n                && IsGenericEnumerable(targetType))\r\n            {\r\n                Type targetItemType = targetType.GetGenericArguments()[0];\r\n\r\n                if (targetItemType.IsInstanceOfType(value))\r\n                {\r\n                    IList targetValue = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(new [] { targetItemType }));\r\n                    if (value is string)\r\n                    {\r\n                        ((string)value).Split(',').ForEach(f => targetValue.Add(f));\r\n                    }\r\n                    else\r\n                    {\r\n                        targetValue.Add(value);\r\n                    }\r\n                    return targetValue;\r\n                }\r\n            }\r\n\r\n            var stringValue = value as string;\r\n            if (stringValue != null)\r\n            {\r\n                return TryConvertStringValue(stringValue, targetType, ref conversionError);\r\n            }\r\n\r\n            if (targetType == typeof(string))\r\n            {\r\n                if (value is Type) return TypeManager.SerializeType((Type)value);\r\n                if (value is DateTime) return XmlConvert.ToString((DateTime)value, XmlDateTimeSerializationMode.Local);\r\n                if (value is IEnumerable) return string.Join(\",\", ((IEnumerable)value).Cast<string>().ToArray());\r\n            }\r\n\r\n            TypeConverter targetConverter = TypeDescriptor.GetConverter(targetType);\r\n            if (targetConverter.CanConvertFrom(value.GetType()))\r\n            {\r\n                return targetConverter.ConvertFrom(null, UserSettings.CultureInfo, value);\r\n            }\r\n\r\n            TypeConverter valueConverter = TypeDescriptor.GetConverter(value.GetType());\r\n            if (valueConverter.CanConvertTo(targetType))\r\n            {\r\n                return valueConverter.ConvertTo(null, UserSettings.CultureInfo, value, targetType);\r\n            }\r\n\r\n            throw new InvalidOperationException(string.Format(\"No conversion from {0} to {1} could be found\", value.GetType(), targetType));\r\n        }\r\n\r\n        private static object TryConvertStringValue(string stringValue, Type targetType, ref Exception conversionError)\r\n        {\r\n            if (targetType == typeof (Type))\r\n            {\r\n                return stringValue != string.Empty ? TypeManager.GetType(stringValue) : null;\r\n            }\r\n\r\n            if (targetType == typeof (XhtmlDocument))\r\n            {\r\n                if (stringValue == string.Empty)\r\n                {\r\n                    return new XhtmlDocument();\r\n                }\r\n                return XhtmlDocument.Parse(stringValue);\r\n            }\r\n\r\n            if (targetType == typeof (XDocument))\r\n            {\r\n                return XDocument.Parse(stringValue);\r\n            }\r\n\r\n            if (targetType == typeof (XElement))\r\n            {\r\n                return XElement.Parse(stringValue);\r\n            }\r\n\r\n            if (targetType == typeof (IEnumerable<XNode>))\r\n            {\r\n                try\r\n                {\r\n                    XElement wrapper = XElement.Parse(string.Format(\"<wrapper>{0}</wrapper>\", stringValue));\r\n                    return wrapper.Nodes();\r\n                }\r\n                catch\r\n                {\r\n                    throw new InvalidCastException(string.Format(\"Unable to convert string '{0}' to a list of XNodes.\", stringValue));\r\n                }\r\n            }\r\n\r\n            if (targetType == typeof (IEnumerable<XElement>))\r\n            {\r\n                try\r\n                {\r\n                    XElement wrapper = XElement.Parse(string.Format(\"<wrapper>{0}</wrapper>\", stringValue));\r\n                    return wrapper.Elements();\r\n                }\r\n                catch\r\n                {\r\n                    throw new InvalidCastException(string.Format(\"Unable to convert string '{0}' to a list of XElements.\", stringValue));\r\n                }\r\n            }\r\n\r\n            if (targetType == typeof (XNamespace))\r\n            {\r\n                return XNamespace.Get(stringValue);\r\n            }\r\n\r\n            if (targetType.IsGenericType && targetType.GetGenericTypeDefinition() == typeof (Nullable<>))\r\n            {\r\n                Type valueType = targetType.GetGenericArguments()[0];\r\n                if (IsOneOfTheHandledValueTypes(valueType))\r\n                {\r\n                    if (stringValue.Trim().Length == 0)\r\n                    {\r\n                        return null;\r\n                    }\r\n\r\n                    return TryConvertValueType(stringValue, valueType, out conversionError);\r\n                }\r\n            }\r\n\r\n\r\n            if (IsOneOfTheHandledValueTypes(targetType))\r\n            {\r\n                return TryConvertValueType(stringValue, targetType, out conversionError);\r\n            }\r\n\r\n            TypeConverter tc = TypeDescriptor.GetConverter(targetType);\r\n            CultureInfo culture = LocalizationScopeManager.CurrentLocalizationScope;\r\n            object convertedResult = tc.ConvertFromString(null, culture, stringValue);\r\n\r\n            if (convertedResult == null && !string.IsNullOrEmpty(stringValue))\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Unable to convert string value '{0}' to type '{1}'\", stringValue, targetType.FullName));\r\n            }\r\n\r\n            return convertedResult;\r\n        }\r\n\r\n        private static object CreateLazyObject(Func<object> func, Type type)\r\n        {\r\n            return NewLazyObjectMethodInfo.MakeGenericMethod(type).Invoke(null, new object[] { func });\r\n        }\r\n\r\n        private static Lazy<T> NewLazyObject<T>(Func<object> func)\r\n        {\r\n            return new Lazy<T>(() => (T)func(), true);\r\n        }\r\n\r\n        private static bool IsOneOfTheHandledValueTypes(Type type)\r\n        {\r\n            return type == typeof (bool) || type == typeof (Guid) || type == typeof (int) || type == typeof (Decimal);\r\n        }\r\n\r\n        private static object TryConvertValueType(string stringValue, Type targetType, out Exception conversionError)\r\n        {\r\n            conversionError = null;\r\n\r\n            if (targetType == typeof(bool))\r\n            {\r\n                bool boolResult;\r\n\r\n                if (!bool.TryParse(stringValue, out boolResult))\r\n                {\r\n                    boolResult = false;\r\n\r\n                    // TODO: localize\r\n                    conversionError = new InvalidOperationException(\"Failed to convert value '{0}' into a Boolean\".FormatWith(stringValue));\r\n                }\r\n                return boolResult;\r\n            }\r\n\r\n            if (targetType == typeof(int))\r\n            {\r\n                int intResult = 0;\r\n                try\r\n                {\r\n                    intResult = Int32.Parse(stringValue);\r\n                }\r\n                catch(OverflowException)\r\n                {\r\n                    conversionError = new InvalidOperationException(LocalizationFiles.Composite_Management.Validation_Int32_Overflow);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    conversionError = ex;\r\n                }\r\n\r\n                return intResult;\r\n            }\r\n\r\n            if (targetType == typeof(decimal))\r\n            {\r\n                // TODO: localize\r\n                decimal decimalResult;\r\n                if (!decimal.TryParse(stringValue, out decimalResult))\r\n                {\r\n                    conversionError = new InvalidOperationException(\"Failed to convert value '{0}' into a Decimal\".FormatWith(stringValue));\r\n                }\r\n\r\n                return decimalResult;\r\n            }\r\n\r\n            if (targetType == typeof(Guid))\r\n            {\r\n                Guid guidResult = Guid.Empty;\r\n                \r\n                if (string.IsNullOrEmpty(stringValue) || !Guid.TryParse(stringValue, out guidResult))\r\n                {\r\n                    // TODO: localize\r\n                    conversionError = new InvalidOperationException(\"Failed to convert value '{0}' into a Guid\".FormatWith(stringValue));\r\n                }\r\n                \r\n                return guidResult;\r\n            }\r\n\r\n            throw new NotImplementedException(\"Supported types should be defined in IsOneOfTheHandledValueTypes() method\");\r\n        }\r\n\r\n        /// <exclude />\r\n        public static T Convert<T>(object value)\r\n        {\r\n            return (T)Convert(value, typeof(T));\r\n        }\r\n\r\n\r\n\r\n        private static bool IsGenericEnumerable(Type type)\r\n        {\r\n            if (!type.IsGenericType) return false;\r\n\r\n            type = type.GetGenericTypeDefinition();\r\n\r\n            return typeof (IEnumerable<>).IsAssignableFrom(type) \r\n                || typeof (List<>).IsAssignableFrom(type) \r\n                || typeof (IList<>).IsAssignableFrom(type);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/Types/ValueTypeConverterHelperAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Core.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic abstract class ValueTypeConverterHelperAttribute : Attribute\r\n\t{\r\n        /// <exclude />\r\n        public abstract bool TryConvert(object sourcevalue, Type targetType, out object targetValue);\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/UrlBuilder.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing.Pages;\r\n\r\n\r\nnamespace Composite.Core\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class UrlBuilder\r\n    {\r\n        private static readonly string IncorrectValueParam = \"__***IncorrectValue***__\";\r\n\r\n        private string _pathInfo;\r\n        private string _filePath;\r\n        private string _anchor;\r\n        private readonly List<KeyValuePair<string, string>> _queryParameters;\r\n\r\n\r\n        /// <exclude />\r\n        public UrlBuilder(string url)\r\n        {\r\n            Verify.ArgumentNotNull(url, nameof(url));\r\n\r\n            _queryParameters = new List<KeyValuePair<string, string>>();\r\n\r\n            int anchorIndex = url.IndexOf('#');\r\n            if(anchorIndex > -1)\r\n            {\r\n                Anchor = (anchorIndex == url.Length - 1) ? string.Empty : url.Substring(anchorIndex + 1);\r\n\r\n                url = url.Substring(0, anchorIndex);\r\n            }\r\n\r\n            int questionMarkIndex = url.IndexOf('?');\r\n            if (questionMarkIndex < 0)\r\n            {\r\n                ExtractPathInfo(url, url, out _filePath, out _pathInfo);\r\n                return;\r\n            }\r\n\r\n            ExtractPathInfo(url, url.Substring(0, questionMarkIndex), out _filePath, out _pathInfo);\r\n\r\n            if (questionMarkIndex + 1 == url.Length)\r\n            {\r\n                return;\r\n            }\r\n\r\n            string queryParamStr = url.Substring(questionMarkIndex + 1, url.Length - questionMarkIndex - 1);\r\n\r\n            foreach (string queryParam in queryParamStr.Split(new[] { \"&amp;\", \"&\" }, StringSplitOptions.RemoveEmptyEntries))\r\n            {\r\n                string[] parts = queryParam.Split(new[] { '=' });\r\n\r\n                bool badUrl = parts.Length != 2;\r\n                if (!badUrl)\r\n                {\r\n                    string encodedKey = parts[0];\r\n                    string encodedValue = parts[1];\r\n\r\n                    string key = DefaultHttpEncoder.UrlDecode(encodedKey);\r\n                    string value = DefaultHttpEncoder.UrlDecode(encodedValue);\r\n\r\n                    // For media URLs we need to support \"/\" character in a query parameter value\r\n                    badUrl = DefaultHttpEncoder.UrlEncode(key) != encodedKey.Replace(\"%20\", \"+\")\r\n                             || DefaultHttpEncoder.UrlEncode(value) != encodedValue.Replace(\"%20\", \"+\").Replace(\"/\", \"%2f\");\r\n\r\n                    if (!badUrl)\r\n                    {\r\n                        _queryParameters.Add(new KeyValuePair<string, string>(key, value));\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                _queryParameters.Add(new KeyValuePair<string, string>(queryParam, IncorrectValueParam));\r\n            }\r\n        }\r\n\r\n        internal static class DefaultHttpEncoder\r\n        {\r\n            public static string UrlEncode(string urlPart)\r\n            {\r\n                using (new NoHttpContext())\r\n                {\r\n                    return HttpUtility.UrlEncode(urlPart);\r\n                }\r\n            }\r\n\r\n            public static string UrlPathEncode(string urlPart)\r\n            {\r\n                using (new NoHttpContext())\r\n                {\r\n                    return HttpUtility.UrlPathEncode(urlPart);\r\n                }\r\n            }\r\n\r\n            public static string UrlDecode(string urlPart)\r\n            {\r\n                using (new NoHttpContext())\r\n                {\r\n                    return HttpUtility.UrlDecode(urlPart);\r\n                }\r\n            }\r\n\r\n            private class NoHttpContext : IDisposable\r\n            {\r\n                private readonly HttpContext _context;\r\n\r\n                public NoHttpContext()\r\n                {\r\n                    _context = HttpContext.Current;\r\n                    HttpContext.Current = null;\r\n                }\r\n\r\n                public void Dispose()\r\n                {\r\n                    HttpContext.Current = _context;\r\n#if LeakCheck\r\n                    GC.SuppressFinalize(this);\r\n#endif\r\n                }\r\n\r\n#if LeakCheck\r\n                private string stack = Environment.StackTrace;\r\n                /// <exclude />\r\n                ~NoHttpContext()\r\n                {\r\n                    Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n                }\r\n#endif\r\n            }\r\n        }\r\n\r\n        private static void ExtractPathInfo(string originalUrl, string relativePath, out string filePath, out string pathInfo)\r\n        {\r\n            // Checking if pageInfo has already been extracted by C1PageRoute. It enables backward compatibility with some modules\r\n            var httpContext = HttpContext.Current;\r\n            if(httpContext != null\r\n               && httpContext.RequestIsAvaliable()\r\n               && originalUrl == httpContext.Request.RawUrl\r\n               && C1PageRoute.PageUrlData != null)\r\n            {\r\n                pathInfo = C1PageRoute.PageUrlData.PathInfo;\r\n\r\n                int pathInfoLength = (pathInfo ?? string.Empty).Length;\r\n                filePath = relativePath.Substring(0, relativePath.Length - pathInfoLength);\r\n                return;\r\n            }\r\n\r\n            int aspxExtOffset = relativePath.IndexOf(\".aspx\", StringComparison.Ordinal);\r\n            if (aspxExtOffset < 0 || aspxExtOffset == relativePath.Length - 5)\r\n            {\r\n                pathInfo = null;\r\n                filePath = relativePath;\r\n                return;\r\n            }\r\n            filePath = relativePath.Substring(0, aspxExtOffset + 5);\r\n            pathInfo = relativePath.Substring(aspxExtOffset + 5);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            // NOTE: StringBuilder shouldn't be used here - it is to slow\r\n            string queryString = QueryString;\r\n\r\n            string result = _filePath;\r\n            if (_pathInfo != null)\r\n            {\r\n                // TODO: encode symbols in path info\r\n                result += _pathInfo;\r\n            }\r\n\r\n            if (queryString != string.Empty)\r\n            {\r\n                result += \"?\" + queryString;\r\n            }\r\n\r\n            if(_anchor != null)\r\n            {\r\n                result += \"#\" + _anchor;\r\n            }\r\n\r\n            return result; // _filePath + _pathInfo + \"?\" + queryString + (\"#\" + _anchor)\"\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddQueryParameters(NameValueCollection parameters)\r\n        {\r\n            foreach (string key in parameters)\r\n            {\r\n                this[key] = parameters[key];\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public NameValueCollection GetQueryParameters()\r\n        {\r\n            var result = new NameValueCollection();\r\n            foreach (KeyValuePair<string, string> pair in _queryParameters)\r\n            {\r\n                result.Add(pair.Key, pair.Value);\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string this[string key]\r\n        {\r\n            get\r\n            {\r\n                string value = _queryParameters.Where(pair => pair.Key == key).Select(pair => pair.Value).FirstOrDefault();\r\n                return value ?? string.Empty;\r\n            }\r\n            set\r\n            {\r\n                for (int i = 0; i < _queryParameters.Count; i++)\r\n                {\r\n                    if (_queryParameters[i].Key == key)\r\n                    {\r\n                        if (value == null)\r\n                        {\r\n                            _queryParameters.RemoveAt(i);\r\n                        }\r\n                        else\r\n                        {\r\n                            _queryParameters[i] = new KeyValuePair<string, string>(key, value);\r\n                        }\r\n\r\n                        return;\r\n                    }\r\n                }\r\n\r\n                if (value != null)\r\n                {\r\n                    _queryParameters.Add(new KeyValuePair<string, string>(key, value));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string PathInfo\r\n        {\r\n            get\r\n            {\r\n                return _pathInfo ?? string.Empty;\r\n            }\r\n            set\r\n            {\r\n                _pathInfo = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string FilePath\r\n        {\r\n            get\r\n            {\r\n                return _filePath;\r\n            }\r\n            set\r\n            {\r\n                Verify.ArgumentNotNull(value, \"value\");\r\n                _filePath = value;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns FilePath + PathInfo \r\n        /// </summary>\r\n        /// <exclude />\r\n        internal string FullPath\r\n        {\r\n            get\r\n            {\r\n                return (_filePath ?? string.Empty) + (_pathInfo ?? string.Empty);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string RelativeFilePath\r\n        {\r\n            get \r\n            { \r\n                string serverUrl = ServerUrl;\r\n                return (serverUrl == string.Empty) ? _filePath : _filePath.Substring(serverUrl.Length - 1);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ServerUrl\r\n        {\r\n            get\r\n            {\r\n                if (_filePath.IsNullOrEmpty())\r\n                {\r\n                    return string.Empty;\r\n                }\r\n\r\n                int index1 = _filePath.IndexOf(\"://\", StringComparison.Ordinal);\r\n                if (index1 <= 0 || _filePath.Length == index1 + 4)\r\n                {\r\n                    return string.Empty;\r\n                }\r\n\r\n                int index2 = _filePath.IndexOf('/', index1 + 3);\r\n                if (index2 < 0)\r\n                {\r\n                    // Urls like \"http://ww.composite.net\"\r\n                    return _filePath;\r\n                }\r\n\r\n                return _filePath.Substring(0, index2 + 1);\r\n            }\r\n            set\r\n            {\r\n                if (!ServerUrl.IsNullOrEmpty())\r\n                {\r\n                    throw new NotImplementedException();\r\n                }\r\n\r\n                if (value.IsNullOrEmpty()) return;\r\n\r\n                Verify.IsTrue(value.EndsWith(\"/\"), \"Wrong server url string\");\r\n\r\n                if (_filePath.StartsWith(\"/\")) _filePath = _filePath.Substring(1);\r\n\r\n                _filePath = value + _filePath;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string QueryString\r\n        {\r\n            get\r\n            {\r\n                if (_queryParameters.Count == 0)\r\n                {\r\n                    return string.Empty;\r\n                }\r\n\r\n                var sb = new StringBuilder();\r\n                for (int i = 0; i < _queryParameters.Count; i++)\r\n                {\r\n                    if (i != 0)\r\n                    {\r\n                        sb.Append(\"&\");\r\n                    }\r\n\r\n                    if (_queryParameters[i].Value == IncorrectValueParam)\r\n                    {\r\n                        sb.Append(_queryParameters[i].Key);\r\n                    }\r\n                    else\r\n                    {\r\n                        sb.Append(DefaultHttpEncoder.UrlEncode(_queryParameters[i].Key));\r\n                        sb.Append('=');\r\n                        sb.Append(DefaultHttpEncoder.UrlEncode(_queryParameters[i].Value));\r\n                    }\r\n                }\r\n\r\n                return sb.ToString();\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static implicit operator string(UrlBuilder builder)\r\n        {\r\n            return builder.ToString();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Anchor\r\n        {\r\n            get\r\n            {\r\n                return _anchor;\r\n            }\r\n            set\r\n            {\r\n                _anchor = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Ajax/AjaxResponseHttpModule.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.WebPages;\r\n\r\nnamespace Composite.Core.WebClient.Ajax\r\n{\r\n    internal class AjaxResponseHttpModule : IHttpModule\r\n\t{\r\n        public void Init(HttpApplication context)\r\n        {\r\n            context.PostMapRequestHandler += AttachFilter;\r\n        }\r\n\r\n        private static void AttachFilter(object sender, EventArgs e)\r\n\t    {\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if (httpContext.Handler != null \r\n                && (httpContext.Handler is Page || httpContext.Handler is WebPageHttpHandler)\r\n                && httpContext.Request.RequestType == \"GET\")\r\n            {\r\n                var response = httpContext.Response;\r\n                response.Filter = new AjaxStream(response.Filter);\r\n            }\r\n\t    }\r\n\r\n\t    public void Dispose()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Ajax/AjaxStream.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Web;\r\nusing Composite.Core.WebClient.HttpModules;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Ajax\r\n{\r\n    internal class AjaxStream : Utf8StringTransformationStream\r\n    {\r\n        private static readonly string ScriptManagerJS = \"UpdateManager.xhtml = null;\";\r\n\r\n        public AjaxStream(Stream innerOuputStream): base(innerOuputStream) { }\r\n\r\n        public override string Process(string str)\r\n        {\r\n            int jsCodePosition = str.IndexOf(ScriptManagerJS, StringComparison.Ordinal);\r\n            if (jsCodePosition == -1)\r\n            {\r\n                return str;\r\n            }\r\n\r\n            // Removing encoding symbol\r\n            if (str[0] != '<') // Method StartsWith(...) doesn't work correctly here\r\n            {\r\n                str = str.Substring(1);\r\n                jsCodePosition--;\r\n            }\r\n\r\n            string encodedText = HttpContext.Current.Server.UrlEncode(str).Replace(\"+\", \"%20\"); //EncodeJsString(str);\r\n\r\n            return string.Format(\"{0}UpdateManager.xhtml = \\\"{1}\\\";{2}\",\r\n                                 str.Substring(0, jsCodePosition),\r\n                                 encodedText,\r\n                                 str.Substring(jsCodePosition + ScriptManagerJS.Length));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/ApplicationLevelEventHandlers.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.AspNet;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Search;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Implementation;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.Media;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Elements.UrlToEntityToken;\r\nusing Composite.Plugins.Routing.InternalUrlConverters;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <summary>    \r\n    /// ASP.NET Application level logic. This class primarily interact between C1 CMS and the ASP.NET Application.  \r\n    /// Most of the members on this class is not documented, except for those which developers may find useful to interact with.\r\n    /// </summary>\r\n    public static class ApplicationLevelEventHandlers\r\n    {\r\n        private const string _verboseLogEntryTitle = \"RGB(205, 92, 92)ApplicationEventHandler\";\r\n        static readonly object _syncRoot = new object();\r\n        private static DateTime _startTime;\r\n        private static bool _systemIsInitialized;\r\n        private static readonly ConcurrentDictionary<string, Func<HttpContext, string>> _c1PageCustomStringProviders = new ConcurrentDictionary<string, Func<HttpContext, string>>();\r\n\r\n        /// <exclude />\r\n        public static bool LogRequestDetails { get; set; }\r\n\r\n        /// <exclude />\r\n        public static bool LogApplicationLevelErrors { get; set; }\r\n\r\n\r\n        \r\n\r\n        /// <exclude />\r\n        public static void Application_Start(object sender, EventArgs e)\r\n        {\r\n            _startTime = DateTime.Now;\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                Log.LogInformation(_verboseLogEntryTitle, \"AppDomain {0} started at {1} in process {2}\", AppDomain.CurrentDomain.Id, _startTime.ToString(\"HH:mm:ss:ff\"), Process.GetCurrentProcess().Id);\r\n            }\r\n\r\n            SystemSetupFacade.SetFirstTimeStart();\r\n\r\n            InitializeServices();\r\n\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (_systemIsInitialized)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (AppDomain.CurrentDomain.BaseDirectory.Length > GlobalSettingsFacade.MaximumRootPathLength)\r\n            {\r\n                throw new InvalidOperationException(\"Windows limitation problem detected! You have installed the website at a place where the total path length of the file with the longest filename exceeds the maximum allowed in Windows. See http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#paths\");\r\n            }\r\n\r\n            \r\n            AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;\r\n\r\n            lock (_syncRoot)\r\n            {\r\n                if (_systemIsInitialized) return;\r\n\r\n                ApplicationStartInitialize(RuntimeInformation.IsDebugBuild);\r\n\r\n                _systemIsInitialized = true;\r\n            }\r\n        }\r\n\r\n\r\n        private static void InitializeServices()\r\n        {\r\n            UrlToEntityTokenFacade.Register(new DataUrlToEntityTokenMapper());\r\n            UrlToEntityTokenFacade.Register(new MediaUrlToEntityTokenMapper());\r\n            UrlToEntityTokenFacade.Register(new ServerLogUrlToEntityTokenMapper());\r\n            UrlToEntityTokenFacade.Register(new WebsiteFileUrlToEntityTokenMapper());\r\n\r\n            var services = ServiceLocator.ServiceCollection;\r\n            services.AddLogging();\r\n            services.AddRoutedData();\r\n            services.AddDataActionTokenResolver();\r\n            services.AddDefaultSearchDocumentSourceProviders();\r\n            services.AddDefaultImageFileFormatProviders();\r\n\r\n            InternalUrls.Register(new MediaInternalUrlConverter());\r\n            InternalUrls.Register(new PageInternalUrlConverter());\r\n\r\n            services.AddSingleton<IMailer>(new SmtpMailer());\r\n\r\n            services.AddTransient<ISiteMapPlugin, CmsPagesSiteMapPlugin>();\r\n\r\n            VersionedDataHelper.Initialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void Application_End(object sender, EventArgs e)\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                Log.LogInformation(_verboseLogEntryTitle, \"AppDomain {0} ended at {1} in process {2}\", AppDomain.CurrentDomain.Id, DateTime.Now.ToString(\"HH:mm:ss:ff\"), Process.GetCurrentProcess().Id);\r\n            }\r\n\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n            {\r\n                return;\r\n            }\r\n\r\n\r\n            using (ThreadDataManager.Initialize())\r\n            {\r\n                try\r\n                {\r\n                    CodeGenerationManager.ValidateCompositeGenerate(_startTime);\r\n                    CodeGenerationManager.GenerateCompositeGeneratedAssembly();\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogCritical(\"Global.asax\", \"Error updating Composite.Generated.dll\");\r\n                    Log.LogCritical(\"Global.asax\", ex);\r\n                }               \r\n\r\n                try\r\n                {\r\n                    GlobalEventSystemFacade.PrepareForShutDown();\r\n                    if (RuntimeInformation.IsDebugBuild)\r\n                    {\r\n                        LogShutDownReason();\r\n                    }\r\n                    GlobalEventSystemFacade.ShutDownTheSystem();\r\n                    \r\n                    TempDirectoryFacade.OnApplicationEnd();\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogCritical(\"Global.asax\", ex);\r\n\r\n                    throw;\r\n                }\r\n\r\n                Log.LogVerbose(\"Global.asax\", $\"--- Web Application End, {DateTime.Now.ToLongTimeString()} Id = {AppDomain.CurrentDomain.Id}---\");\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void Application_BeginRequest(object sender, EventArgs e)\r\n        {\r\n            var context = ((HttpApplication) sender).Context;\r\n\r\n            ThreadDataManager.InitializeThroughHttpContext();\r\n\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n            {\r\n            ServiceLocator.CreateRequestServicesScope(context);\r\n            }\r\n\r\n            if (LogRequestDetails)\r\n            {\r\n                // LoggingService.LogVerbose(\"Begin request\", string.Format(\"{0}\", Request.Path));\r\n                context.Items.Add(\"Global.asax timer\", Environment.TickCount);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void Application_EndRequest(object sender, EventArgs e)\r\n        {\r\n            var context = ((HttpApplication) sender).Context;\r\n\r\n            try\r\n            {\r\n                ServiceLocator.DisposeRequestServicesScope(context);\r\n\r\n                if (LogRequestDetails && context.Items.Contains(\"Global.asax timer\"))\r\n                {\r\n                    int startTimer = (int)context.Items[\"Global.asax timer\"];\r\n                    string requestPath = context.Request.Path;\r\n                    Log.LogVerbose(\"End request\", $\"{requestPath} - took {Environment.TickCount - startTimer} ms\");\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                ThreadDataManager.FinalizeThroughHttpContext();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void Application_Error(object sender, EventArgs e)\r\n        {\r\n            var httpApplication = (HttpApplication) sender;\r\n            Exception exception = httpApplication.Server.GetLastError();\r\n\r\n            var eventType = TraceEventType.Error;\r\n\r\n            var httpContext = httpApplication.Context;\r\n\r\n            if (httpContext != null)\r\n            {\r\n                bool is404 = exception is HttpException httpException\r\n                             && httpException.GetHttpCode() == 404;\r\n\r\n                if (is404)\r\n                {\r\n                    string rawUrl = httpContext.Request.RawUrl;\r\n\r\n                    if (!UrlUtils.IsAdminConsoleRequest(rawUrl))\r\n                    {\r\n                        string customPageNotFoundUrl = HostnameBindingsFacade.GetCustomPageNotFoundUrl();\r\n\r\n                        if (!customPageNotFoundUrl.IsNullOrEmpty())\r\n                        {\r\n                            if (rawUrl == customPageNotFoundUrl)\r\n                            {\r\n                                throw new HttpException(500, $\"'Page not found' url isn't handled. Url: '{rawUrl}'\");\r\n                            }\r\n\r\n                            httpContext.Server.ClearError();\r\n                            httpContext.Response.Clear();\r\n\r\n                            httpContext.Response.Redirect(customPageNotFoundUrl, true);\r\n\r\n                            return;\r\n                        }\r\n\r\n                        eventType = TraceEventType.Verbose;\r\n                    }\r\n                }\r\n\r\n                // Logging request url\r\n                if (LogApplicationLevelErrors)\r\n                {\r\n                    HttpRequest request = null;\r\n\r\n                    try\r\n                    {\r\n                        request = httpContext.Request;\r\n                    }\r\n                    catch\r\n                    {\r\n                        // Request may not be available at this point\r\n                    }\r\n\r\n                    if (request != null)\r\n                    {\r\n                        LoggingService.LogEntry(\"Application Error\",\r\n                                            $\"Failed to process '{request.RequestType}' request to url '{request.RawUrl}'\",\r\n                                            LoggingService.Category.General, eventType);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (LogApplicationLevelErrors)\r\n            {\r\n                while (exception != null)\r\n                {\r\n                    LoggingService.LogEntry(\"Application Error\", exception.ToString(), LoggingService.Category.General, eventType);\r\n                    exception = exception.InnerException;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetVaryByCustomString(HttpContext context, string custom)\r\n        {\r\n            if (custom == \"C1Page\")\r\n            {\r\n                string rawUrl = context.Request.RawUrl;\r\n\r\n                UrlKind urlKind;\r\n                var pageUrl = PageUrls.UrlProvider.ParseUrl(rawUrl, new UrlSpace(context), out urlKind);\r\n\r\n                var page = pageUrl?.GetPage();\r\n                if (page != null)\r\n                {\r\n                    var pageCacheKey = new StringBuilder(page.ChangeDate.ToString(CultureInfo.InvariantCulture));\r\n\r\n                    if (context.Request.IsSecureConnection)\r\n                    {\r\n                        pageCacheKey.Append(\"https\");\r\n                    }\r\n\r\n                    // Adding the relative path from RawUrl as a part of cache key to make ASP.NET cache respect casing of urls\r\n                    pageCacheKey.Append(new UrlBuilder(rawUrl).FullPath);\r\n                    foreach (string key in _c1PageCustomStringProviders.Keys)\r\n                    {\r\n                        pageCacheKey.Append(_c1PageCustomStringProviders[key](context));\r\n                    }\r\n\r\n                    return pageCacheKey.ToString();\r\n                }\r\n                return string.Empty;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Register a function that provide a custom string to be part of a C1 Page cache key. You should register a function just once and during the application initialization.\r\n        /// Your function will be called with the current HttpContext and should return either null or a string for the C1 Page request in relation to caching.\r\n        /// An example situation where this can be used: You want to have full page caching, but you have C1 Page content being dependant on client settings, such as HTTP CLIENT.\r\n        /// You should kep the 'spread in values' you return to a minimum - each unique string will create a new cache entry and consume memory.\r\n        /// </summary>\r\n        /// <param name=\"providerId\">A string unique for your function - used to ensure this is only registered once</param>\r\n        /// <param name=\"customStringBuilder\">Your function the can return a custom string</param>\r\n        public static void RegisterC1PageVaryByCustomStringProvider( string providerId, Func<HttpContext,string> customStringBuilder)\r\n        {\r\n            _c1PageCustomStringProviders.GetOrAdd(providerId, customStringBuilder);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void ApplicationStartInitialize(bool displayDebugInfo = false)\r\n        {\r\n            ThreadDataManager.InitializeThroughHttpContext();\r\n\r\n            if (displayDebugInfo)\r\n            {\r\n                Log.LogVerbose(\"Global.asax\", \"--- Web Application Start, {0} Id = {1} ---\", DateTime.Now.ToLongTimeString(), AppDomain.CurrentDomain.Id);\r\n            }\r\n\r\n            PerformanceCounterFacade.SystemStartupIncrement();\r\n\r\n            using (GlobalInitializerFacade.GetPreInitHandlersScope())\r\n            {\r\n                ApplicationStartupFacade.FireConfigureServices(ServiceLocator.ServiceCollection);\r\n\r\n                ServiceLocator.BuildServiceProvider();\r\n                ServiceLocator.CreateRequestServicesScope(HttpContext.Current);\r\n                HttpRuntime.WebObjectActivator = new WebObjectActivator(ServiceLocator.ServiceProvider);\r\n\r\n                ApplicationStartupFacade.FireBeforeSystemInitialize(ServiceLocator.ServiceProvider);\r\n            }\r\n\r\n            TempDirectoryFacade.OnApplicationStart();\r\n\r\n            HostnameBindingsFacade.Initialize();\r\n\r\n            ApplicationStartupFacade.FireSystemInitialized(ServiceLocator.ServiceProvider);\r\n\r\n            ThreadDataManager.FinalizeThroughHttpContext();\r\n        }\r\n\r\n\r\n\r\n        private static void CurrentDomain_DomainUnload(object sender, EventArgs e)\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                Log.LogInformation(_verboseLogEntryTitle, $\"AppDomain {AppDomain.CurrentDomain.Id} unloaded at {DateTime.Now:HH:mm:ss:ff}\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void LogShutDownReason()\r\n        {\r\n            HttpRuntime runtime = (HttpRuntime)typeof(System.Web.HttpRuntime).InvokeMember(\"_theRuntime\",\r\n                                                                                        System.Reflection.BindingFlags.NonPublic |\r\n                                                                                        System.Reflection.BindingFlags.Static |\r\n                                                                                        System.Reflection.BindingFlags.GetField,\r\n                                                                                        null, null, null);\r\n\r\n            if (runtime == null)\r\n            {\r\n                Log.LogWarning(\"ASP.NET Shut Down\", \"Unable to determine cause of shut down\");\r\n                return;\r\n            }\r\n\r\n            string shutDownMessage = (string)runtime.GetType().InvokeMember(\"_shutDownMessage\",\r\n                                                                         System.Reflection.BindingFlags.NonPublic |\r\n                                                                         System.Reflection.BindingFlags.Instance |\r\n                                                                         System.Reflection.BindingFlags.GetField,\r\n                                                                         null, runtime, null);\r\n\r\n            string shutDownStack = (string)runtime.GetType().InvokeMember(\"_shutDownStack\",\r\n                                                                       System.Reflection.BindingFlags.NonPublic |\r\n                                                                       System.Reflection.BindingFlags.Instance |\r\n                                                                       System.Reflection.BindingFlags.GetField,\r\n                                                                       null, runtime, null);\r\n\r\n            shutDownMessage = (shutDownMessage ?? \"null\").Replace(\"\\n\", \"   \\n\");\r\n\r\n            Log.LogVerbose(\"RGB(250,50,50)ASP.NET Shut Down\",\r\n                $\"_shutDownMessage=\\n{shutDownMessage}\\n\\n_shutDownStack=\\n{shutDownStack}\");\r\n\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/BrowserRender.cs",
    "content": "﻿// #define BrowserRender_NoCache\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Web;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.Parallelization;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Timer = System.Timers.Timer;\r\nusing System.Threading.Tasks;\r\nusing Composite.Core.WebClient.PhantomJs;\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    internal static class BrowserRender\r\n    {\r\n        private static readonly string LogTitle = typeof (BrowserRender).Name;\r\n        private static readonly string CacheImagesFolder = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.CacheDirectory), \"PreviewImages\");\r\n\r\n        static BrowserRender()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToShutDownEvent(a => ShutdownPhantomJsExeSilent());\r\n            PackageInstaller.OnPackageInstallation += ShutdownPhantomJsExeSilent;\r\n\r\n            FileChangeNotificator.Subscribe(PhantomServer.ScriptFilePath, (a, b) => PhantomServer.ShutDown(false));\r\n        }\r\n\r\n        private static Timer _recycleTimer;\r\n        private static DateTime _lastUsageDate = DateTime.MinValue;\r\n        private static readonly TimeSpan RecycleOnIdleInterval = TimeSpan.FromSeconds(30); \r\n        private const int RecycleTimerInterval_ms = 10000;\r\n        private const int EnsureReadinessDelay_ms = 30000;\r\n\r\n        private static volatile bool Enabled = true;\r\n        private static volatile bool ServerAvailabilityChecked;\r\n        private static readonly AsyncLock _serverAvailabilityCheckLock = new AsyncLock();\r\n\r\n        /// <summary>\r\n        /// Ensures that the BrowserRenderer service is launched, without blocking the current thread\r\n        /// </summary>\r\n        public static void EnsureReadiness()\r\n        {\r\n            if (!GlobalSettingsFacade.FunctionPreviewEnabled) return;\r\n\r\n            _lastUsageDate = DateTime.Now;\r\n            if (ServerAvailabilityChecked) return;\r\n\r\n            var context = HttpContext.Current;\r\n\r\n            HttpCookie[] cookies = GetAuthenticationCookies(context);\r\n            Task.Factory.StartNew(async () =>\r\n            {\r\n                const int delaySlice = 500;\r\n                for (int i = 0; i < EnsureReadinessDelay_ms / delaySlice; i++)\r\n                {\r\n                    if (!SystemFullyOnline) return;\r\n                    await Task.Delay(delaySlice);\r\n                }\r\n                \r\n                await CheckServerAvailabilityAsync(context, cookies);\r\n            });\r\n        }\r\n\r\n\r\n        public static DateTime GetLastCacheUpdateTime(string mode)\r\n        {\r\n            string folderPath = GetCacheFolder(mode);\r\n\r\n            if (!C1Directory.Exists(folderPath))\r\n            {\r\n                C1Directory.CreateDirectory(folderPath);\r\n            }\r\n\r\n            return C1Directory.GetCreationTime(folderPath);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Renders a url and return a full path to a rendered image, or <value>null</value> when rendering process is failing or inaccessible.\r\n        /// </summary>\r\n        public static async Task<RenderingResult> RenderUrlAsync(HttpContext context, string url, string mode)\r\n        {\r\n            string dropFolder = GetCacheFolder(mode);\r\n\r\n            if (!C1Directory.Exists(dropFolder))\r\n            {\r\n                C1Directory.CreateDirectory(dropFolder);\r\n            }\r\n            string urlHash = Convert.ToBase64String(BitConverter.GetBytes(url.GetHashCode())).Substring(0, 6).Replace('+', '-').Replace('/', '_');\r\n\r\n            string outputImageFileName = Path.Combine(dropFolder, urlHash + \".png\");\r\n            string outputFileName = Path.Combine(dropFolder, urlHash + \".output\");\r\n            string redirectLogFileName = Path.Combine(dropFolder, urlHash + \".redirect\");\r\n            string errorFileName = Path.Combine(dropFolder, urlHash + \".error\");\r\n\r\n            if (C1File.Exists(outputImageFileName) || C1File.Exists(outputFileName))\r\n            {\r\n#if BrowserRender_NoCache\r\n                File.Delete(outputFileName);\r\n#else\r\n                string[] output = C1File.Exists(outputFileName) ? C1File.ReadAllLines(outputFileName) : null;\r\n\r\n                return new RenderingResult { FilePath = outputImageFileName, Output = output, Status = RenderingResultStatus.Success};\r\n#endif\r\n            }\r\n\r\n            if (!Enabled)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var result = await MakePreviewRequestAsync(context, url, outputImageFileName, mode);\r\n\r\n            if (result.Status >= RenderingResultStatus.Error)\r\n            {\r\n                C1File.WriteAllLines(errorFileName, result.Output);\r\n            }\r\n\r\n            if (!Enabled)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (result.Status == RenderingResultStatus.Success)\r\n            {\r\n                C1File.WriteAllLines(outputFileName, result.Output);\r\n            }\r\n            else if (result.Status == RenderingResultStatus.Redirect)\r\n            {\r\n                C1File.WriteAllLines(redirectLogFileName, result.Output);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        public static void ClearCache(string renderingMode)\r\n        {\r\n            var folder = GetCacheFolder(renderingMode);\r\n\r\n            if (C1Directory.Exists(folder))\r\n            {\r\n                Task.Run(() => ClearCacheInt(folder));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static string GetCacheFolder(string mode)\r\n        {\r\n            return CacheImagesFolder + \"\\\\\" + mode;\r\n        }\r\n\r\n        private static async Task<RenderingResult> MakePreviewRequestAsync(HttpContext context, string url, string outputFileName, string mode)\r\n        {\r\n            var cookies = GetAuthenticationCookies(context);\r\n            await CheckServerAvailabilityAsync(context, cookies);\r\n\r\n            if (!Enabled)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            _lastUsageDate = DateTime.Now;\r\n\r\n            return await PhantomServer.RenderUrlAsync(cookies, url, outputFileName, mode);\r\n        }\r\n\r\n        private static HttpCookie[] GetAuthenticationCookies(HttpContext context)\r\n        {\r\n            var allCookies = context.Request.Cookies;\r\n            var result = new List<HttpCookie>();\r\n\r\n            foreach (string cookieName in allCookies)\r\n            {\r\n                var cookie = allCookies[cookieName];\r\n                result.Add(cookie);\r\n            }\r\n\r\n            return result.ToArray();\r\n        }\r\n\r\n\r\n        private static bool SystemFullyOnline => \r\n            ApplicationOnlineHandlerFacade.IsApplicationOnline \r\n            && GlobalInitializerFacade.SystemCoreInitialized \r\n            && !GlobalInitializerFacade.SystemCoreInitializing \r\n            && SystemSetupFacade.IsSystemFirstTimeInitialized;\r\n\r\n\r\n        private static async Task CheckServerAvailabilityAsync(HttpContext context, HttpCookie[] cookies)\r\n        {\r\n            if (ServerAvailabilityChecked || cookies == null) return;\r\n\r\n            using (await _serverAvailabilityCheckLock.LockAsync())\r\n            {\r\n                if (ServerAvailabilityChecked) return;\r\n\r\n                if (!SystemFullyOnline) return;\r\n\r\n                try\r\n                {\r\n                    string testUrl = UrlUtils.Combine(new UrlBuilder(context.Request.Url.ToString()).ServerUrl, UrlUtils.PublicRootPath);\r\n\r\n                    SetupRecycleTimer();\r\n\r\n                    string outputFileName = Path.Combine(TempDirectoryFacade.TempDirectoryPath, \"phantomtest.png\");\r\n\r\n                    var result = await PhantomServer.RenderUrlAsync(cookies, testUrl, outputFileName, \"test\");\r\n\r\n                    if (result.Status == RenderingResultStatus.PhantomServerTimeout\r\n                        || result.Status == RenderingResultStatus.PhantomServerIncorrectResponse\r\n                        || result.Status == RenderingResultStatus.PhantomServerNoOutput)\r\n                    {\r\n                        Enabled = false;\r\n                        Log.LogWarning(LogTitle, \"The function preview feature will be turned off as PhantomJs server failed to complete a test HTTP request\");\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogWarning(LogTitle, \"PhantomJs server unable to complete HTTP requests, preventing C1 Function preview images from being generated. \" + Environment.NewLine + ex);\r\n                    Enabled = false;\r\n\r\n                    PhantomServer.ShutDown(false);\r\n                }\r\n                finally\r\n                {\r\n                    ServerAvailabilityChecked = true;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static void ShutdownPhantomJsExeSilent()\r\n        {\r\n            Enabled = false;\r\n            try\r\n            {\r\n                PhantomServer.ShutDown(false, true);\r\n            }\r\n            catch\r\n            {\r\n            }\r\n        }\r\n\r\n\r\n        private static void ClearCacheInt(string folder)\r\n        {\r\n            foreach (var file in C1Directory.GetFiles(folder, \"*.*\"))\r\n            {\r\n                try\r\n                {\r\n                    C1File.Delete(file);\r\n                }\r\n                catch\r\n                {\r\n                }\r\n            }\r\n\r\n            C1Directory.SetCreationTime(folder, DateTime.Now);\r\n        }\r\n\r\n\r\n        private static void SetupRecycleTimer()\r\n        {\r\n            if (_recycleTimer != null) return;\r\n\r\n            var timer = new Timer(RecycleTimerInterval_ms) {AutoReset = true};\r\n            timer.Elapsed += (a, b) => RecycleIfNotUsed();\r\n            timer.Start();\r\n\r\n            _recycleTimer = timer;\r\n        }\r\n\r\n\r\n        private static void RecycleIfNotUsed()\r\n        {\r\n            if (DateTime.Now - _lastUsageDate < RecycleOnIdleInterval)\r\n            {\r\n                return;\r\n            }\r\n\r\n            PhantomServer.ShutDown(false);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/BuildManagerHelper.cs",
    "content": "using Composite.Core.IO;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Web.Compilation;\r\nusing System.Web.Hosting;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    internal static class BuildManagerHelper\r\n    {\r\n        private static DateTime? _delayPreloadTo = null;\r\n        private static TimeSpan PreloadDelay = TimeSpan.FromSeconds(2);\r\n        private static TimeSpan InitializationDelay = TimeSpan.FromSeconds(30);\r\n\r\n        private static readonly string LogTitle = typeof (BuildManagerHelper).Name;\r\n        private static int _preloadingInitiated;\r\n\r\n        /// <summary>\r\n        /// Preloading (compiling) all the controls. Speeds up first time editing in console.\r\n        /// </summary>\r\n        public static void InitializeControlPreLoading()\r\n        {\r\n            if (_preloadingInitiated == 0 && Interlocked.Increment(ref _preloadingInitiated) == 1)\r\n            {\r\n                Task.Factory.StartNew(LoadAllControls);\r\n            }\r\n        }\r\n\r\n        private static bool IsRestarting => HostingEnvironment.ApplicationHost.ShutdownInitiated();\r\n\r\n        private static void LoadAllControls()\r\n        {\r\n            try\r\n            {\r\n                const int waitSlice = 500;\r\n                for (int i = 0; i < InitializationDelay.TotalMilliseconds / waitSlice; i++)\r\n                {\r\n                    if(IsRestarting) return;\r\n                    Thread.Sleep(waitSlice);\r\n                }\r\n\r\n                const string configFileFilePath = \"~/App_Data/Composite/Composite.config\";\r\n                var config = XDocument.Load(PathUtil.Resolve(configFileFilePath));\r\n\r\n                var controlPathes = from element in config.Descendants()\r\n                    let userControlVirtualPath = (string) element.Attribute(\"userControlVirtualPath\")\r\n                    where userControlVirtualPath != null\r\n                    select userControlVirtualPath;\r\n\r\n                var controlsToCompile = new List<string>();\r\n\r\n                foreach (var controlPath in controlPathes)\r\n                {\r\n                    if (!C1File.Exists(PathUtil.Resolve(controlPath)))\r\n                    {\r\n                        Log.LogWarning(LogTitle, $\"Missing a control file '{controlPath}' referenced in '{configFileFilePath}'\");\r\n                        continue;\r\n                    }\r\n\r\n                    controlsToCompile.Add(controlPath);\r\n                }\r\n\r\n\r\n                Func<string, bool> isAshxAsmxPath = f => f == \".ashx\" || f == \".asmx\";\r\n                Func<string, bool> isAspNetPath = f => f == \".aspx\" || isAshxAsmxPath(f);\r\n                var aspnetPaths = DirectoryUtils.GetFilesRecursively(PathUtil.Resolve(\"~/Composite\")).Where(f => isAshxAsmxPath(Path.GetExtension(f)))\r\n                    .Concat(DirectoryUtils.GetFilesRecursively(PathUtil.Resolve(\"~/Renderers\")).Where(f => isAspNetPath(Path.GetExtension(f))))\r\n                    .Select(PathUtil.GetWebsitePath)\r\n                    .ToList();\r\n\r\n                var compileGroups = new List<Tuple<string, ICollection<string>>>()\r\n                {\r\n                    new Tuple<string, ICollection<string>>(\"ASP.NET controls\", controlsToCompile),\r\n                    new Tuple<string, ICollection<string>>(\"ASP.NET pages and handlers\", aspnetPaths),\r\n                };\r\n\r\n\r\n                foreach (var compileGroup in compileGroups)\r\n                {\r\n                    if (HostingEnvironment.ApplicationHost.ShutdownInitiated()) return;\r\n\r\n                    Log.LogVerbose(LogTitle, \"Preloading \" + compileGroup.Item1);\r\n\r\n                    var stopWatch = new Stopwatch();\r\n                    stopWatch.Start();\r\n\r\n                    foreach (var virtualPath in compileGroup.Item2)\r\n                    {\r\n                        while (true)\r\n                        {\r\n                            if (IsRestarting) return;\r\n\r\n                            Thread.MemoryBarrier();\r\n                            var waitUntil = _delayPreloadTo;\r\n                            var now = DateTime.Now;\r\n\r\n                            if (waitUntil == null || waitUntil <= now)\r\n                            {\r\n                                break;\r\n                            }\r\n\r\n                            Thread.Sleep(waitUntil.Value - now);\r\n                        }\r\n\r\n                        try\r\n                        {\r\n                            using (new DisableUrlMedataScope())\r\n                            {\r\n                                string compilePath = (virtualPath.StartsWith(\"~\") ? \"\" : \"~\") + virtualPath;\r\n                                BuildManager.GetCompiledType(compilePath);\r\n                            }\r\n                        }\r\n                        catch (ThreadAbortException)\r\n                        {\r\n                            // this exception is automatically rethrown after this catch\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            Log.LogWarning(LogTitle, ex);\r\n                        }\r\n                    }\r\n\r\n                    stopWatch.Stop();\r\n\r\n                    Log.LogVerbose(LogTitle, $\"Preloading {compileGroup.Item1} completed in {stopWatch.ElapsedMilliseconds} ms\");\r\n                }\r\n            }\r\n            catch (ThreadAbortException)\r\n            {\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogWarning(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a user control. Prevents an exception that appears in Visual Studio while debugging\r\n        /// </summary>\r\n        /// <param name=\"virtualPath\"></param>\r\n        /// <returns></returns>\r\n        public static Type GetCompiledType(string virtualPath)\r\n        {\r\n            using (DisableUrlMetadataCachingScope())\r\n            {\r\n                return BuildManager.GetCompiledType(virtualPath);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Disabling the \"url metadata caching\" prevents <see cref=\"System.Web.HttpException\" /> in debugger \r\n        /// </summary>\r\n        /// <param name=\"disableCaching\"></param>\r\n        public static void DisableUrlMetadataCaching(bool disableCaching)\r\n        {\r\n            if (!RuntimeInformation.IsDebugBuild)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var systemWeb = typeof(System.Web.TraceMode).Assembly;\r\n            Type cachedPathData = systemWeb.GetType(\"System.Web.CachedPathData\", false);\r\n\r\n            var field = cachedPathData?.GetField(\"s_doNotCacheUrlMetadata\", BindingFlags.Static | BindingFlags.NonPublic);\r\n\r\n            field?.SetValue(null, disableCaching);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Disabling the \"url metadata caching\" prevents <see cref=\"System.Web.HttpException\" /> in debugger \r\n        /// </summary>\r\n        public static IDisposable DisableUrlMetadataCachingScope()\r\n        {\r\n            _delayPreloadTo = DateTime.Now.Add(PreloadDelay);\r\n\r\n            return new DisableUrlMedataScope();\r\n        }\r\n\r\n        internal class DisableUrlMedataScope : IDisposable\r\n        {\r\n            public DisableUrlMedataScope()\r\n            {\r\n                DisableUrlMetadataCaching(true);\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                DisableUrlMetadataCaching(false);\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~DisableUrlMedataScope()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Captcha/Captcha.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Text;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Captcha\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class Captcha\r\n    {\r\n        private static readonly string DateTimeFormat = \"yyyyMMddHHmmss\";\r\n        private static readonly string CaptchaCharacters = \"abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789\";\r\n        private static readonly string CaptchaServiceUrl = UrlUtils.PublicRootPath + \"/Renderers/Captcha.ashx\";\r\n        private static readonly int CaptchaLength = 4;\r\n        private static readonly int CaptchaExpiration = 30; // In minutes\r\n        private static int _counter = 0;\r\n\r\n        private static readonly Random _random = new Random();\r\n\r\n        // munute offset -> set of used records\r\n        private static readonly Hashtable<int, Hashset<string>> _alreadyUsedRecords = new Hashtable<int, Hashset<string>>();\r\n\r\n\r\n        /// <exclude />\r\n        public static string CreateEncryptedValue()\r\n        {\r\n            DateTime now = DateTime.Now;\r\n            string value = now.ToString(DateTimeFormat);\r\n            value += \"|\" + GenerateText();\r\n\r\n            return Encryption.Encrypt(value);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsValid(string encryptedValue)\r\n        {\r\n            string value;\r\n\r\n            DateTime now = DateTime.Now;\r\n            DateTime timeStamp;\r\n            return !string.IsNullOrEmpty(encryptedValue)\r\n                   && Decrypt(encryptedValue, out timeStamp, out value)\r\n                   && timeStamp.AddMinutes(CaptchaExpiration) > now\r\n                   && now >= timeStamp\r\n                   && !IsAlreadyUsed(encryptedValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsValid(string value, string encryptedValue)\r\n        {\r\n            string correctValue;\r\n\r\n            DateTime now = DateTime.Now;\r\n            DateTime timeStamp;\r\n            return Decrypt(encryptedValue, out timeStamp, out correctValue)\r\n                   && string.Compare(value, correctValue, true) == 0\r\n                   && timeStamp.AddMinutes(CaptchaExpiration) > now\r\n                   && now >= timeStamp\r\n                   && !IsAlreadyUsed(encryptedValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void RegisterUsage(string encryptedValue)\r\n        {\r\n            string value;\r\n            DateTime dateTime;\r\n            Decrypt(encryptedValue, out dateTime, out value);\r\n\r\n            int minute = GetMinute(dateTime);\r\n\r\n            Hashset<string> usedRecords = _alreadyUsedRecords[minute];\r\n            if (usedRecords == null)\r\n            {\r\n                lock(_alreadyUsedRecords)\r\n                {\r\n                    usedRecords = _alreadyUsedRecords[minute];\r\n                    if (usedRecords == null)\r\n                    {\r\n                        usedRecords = new Hashset<string>();\r\n                        _alreadyUsedRecords.Add(minute, usedRecords);\r\n                    }\r\n                }\r\n            }\r\n\r\n            lock(usedRecords)\r\n            {\r\n                if(!usedRecords.Contains(encryptedValue))\r\n                {\r\n                    usedRecords.Add(encryptedValue);\r\n                }\r\n            }\r\n\r\n            // Periodic clean-up\r\n            _counter++;\r\n            if(_counter % 1000 == 0)\r\n            {\r\n                lock(_alreadyUsedRecords)\r\n                {\r\n                    int currentMinute = GetMinute(DateTime.Now);\r\n\r\n                    ICollection<int> keys = _alreadyUsedRecords.GetKeys();\r\n                    foreach(int key in keys)\r\n                    {\r\n                        if (key < currentMinute - CaptchaExpiration || key > currentMinute + 10)\r\n                        {\r\n                            _alreadyUsedRecords.Remove(key);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsAlreadyUsed(string encryptedValue)\r\n        {\r\n            string value;\r\n            DateTime dateTime;\r\n            Decrypt(encryptedValue, out dateTime, out value);\r\n\r\n            int offset = GetMinute(dateTime);\r\n\r\n            var records = _alreadyUsedRecords[offset];\r\n\r\n            return records != null && records.Contains(encryptedValue);\r\n        }\r\n\r\n\r\n        private static int GetMinute(DateTime dateTime)\r\n        {\r\n            return dateTime.Hour * 60 + dateTime.Minute;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool Decrypt(string encryptedValue, out DateTime timestamp, out string value)\r\n        {\r\n            timestamp = DateTime.MinValue;\r\n            value = null;\r\n\r\n            string decrypted = Encryption.Decrypt(encryptedValue);\r\n            if (decrypted.IsNullOrEmpty())\r\n            {\r\n                return false;\r\n            }\r\n\r\n            int separatorIndex = decrypted.IndexOf(\"|\");\r\n            if (separatorIndex <= 0 || separatorIndex == decrypted.Length - 1)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            string datePart = decrypted.Substring(0, separatorIndex);\r\n            string captchaPart = decrypted.Substring(separatorIndex + 1);\r\n\r\n            if (!DateTime.TryParseExact(datePart, DateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out timestamp))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            value = captchaPart;\r\n            return true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetImageUrl(string encryptedCaptchaValue)\r\n        {\r\n            var url = new UrlBuilder(CaptchaServiceUrl);\r\n            url[\"value\"] = encryptedCaptchaValue;\r\n            return url.ToString();\r\n        }\r\n\r\n        private static string GenerateText()\r\n        {\r\n            StringBuilder sb = new StringBuilder(CaptchaLength);\r\n            for (int i = 0; i < CaptchaLength; i++)\r\n            {\r\n                sb.Append(CaptchaCharacters[_random.Next(0, CaptchaCharacters.Length)]);\r\n            }\r\n            return sb.ToString();\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Captcha/CaptchaConfiguration.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Xml;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\nnamespace Composite.Core.WebClient.Captcha\r\n{\r\n    internal static class CaptchaConfiguration\r\n    {\r\n        private static readonly string CaptchaConfigurationFilePath = @\"App_Data\\Composite\\Configuration\\Captcha.xml\";\r\n\r\n        public static string Password { get; }\r\n\r\n        static CaptchaConfiguration()\r\n        {\r\n            string configurationFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CaptchaConfigurationFilePath);\r\n\r\n            string password = null;\r\n\r\n            if (C1File.Exists(configurationFilePath))\r\n            {\r\n                var doc = new XmlDocument();\r\n                try\r\n                {\r\n                    using (var sr = new C1StreamReader(configurationFilePath))\r\n                    {\r\n                        doc.Load(sr);\r\n                    }\r\n\r\n                    var passwordNode = doc.SelectSingleNode(\"captcha/password\");\r\n                    if (!string.IsNullOrEmpty(passwordNode?.InnerText))\r\n                    {\r\n                        password = passwordNode.InnerText;\r\n                    }\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    // Do nothing\r\n                }\r\n\r\n                if (password != null)\r\n                {\r\n                    Password = password;\r\n                    return;\r\n                }\r\n\r\n                // Deleting configuration file\r\n                C1File.Delete(configurationFilePath);\r\n            }\r\n\r\n\r\n            password = Guid.NewGuid().ToString();\r\n\r\n            string configFile = @\"<captcha> <password>{0}</password> </captcha>\".FormatWith(password);\r\n\r\n            C1File.WriteAllText(configurationFilePath, configFile);\r\n\r\n            Password = password;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Captcha/Encryption.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Captcha\r\n{\r\n    internal static class Encryption\r\n    {\r\n        private static readonly byte[] _encryptionKey;\r\n        private static readonly byte[] RijndaelIV = { 1, 84, 22, 19, 154, 221, 4, 30, 56, 4, 114, 59, 90, 2, 5, 10 };\r\n\r\n        static Encryption()\r\n        {\r\n            string key = InstallationInformationFacade.InstallationId + CaptchaConfiguration.Password;\r\n\r\n            byte[] keyBytes = Encoding.UTF8.GetBytes(key);\r\n\r\n            using (var hashAlgorithm = MD5.Create())\r\n            {\r\n                _encryptionKey = hashAlgorithm.ComputeHash(keyBytes);\r\n            }\r\n        }\r\n\r\n        public static string Encrypt(string value)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(value, nameof(value));\r\n\r\n            return ByteToHexString(RijndaelEncrypt(value));\r\n        }\r\n\r\n        private static byte[] RijndaelEncrypt(string value)\r\n        {\r\n            // Create a RijndaelManaged object\r\n            // with the specified key and IV.\r\n            using (var rima = new RijndaelManaged())\r\n            {\r\n                rima.Key = _encryptionKey;\r\n                rima.IV = RijndaelIV;\r\n\r\n                // Create a decrytor to perform the stream transform.\r\n                ICryptoTransform encryptor = rima.CreateEncryptor();\r\n\r\n                // Create the streams used for encryption.\r\n                using (var msEncrypt = new MemoryStream())\r\n                {\r\n                    using (var csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))\r\n                    using (var swEncrypt = new C1StreamWriter(csEncrypt))\r\n                    {\r\n                        //Write all data to the stream.\r\n                        swEncrypt.Write(value);\r\n                    }\r\n                    // Return the encrypted bytes from the memory stream.\r\n                    return msEncrypt.ToArray();\r\n                }\r\n            }\r\n        }\r\n\r\n        public static string Decrypt(string encryptedValue)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(encryptedValue, nameof(encryptedValue));\r\n            byte[] encodedSequence = HexStringToByteArray(encryptedValue);\r\n\r\n            return RijndaelDecrypt(encodedSequence);\r\n        }\r\n\r\n        private static string RijndaelDecrypt(byte[] bytes)\r\n        {\r\n            using (var rima = new RijndaelManaged())\r\n            {\r\n                rima.Key = _encryptionKey;\r\n                rima.IV = RijndaelIV;\r\n\r\n                // Create a decrytor to perform the stream transform.\r\n                ICryptoTransform decryptor = rima.CreateDecryptor();\r\n\r\n                // Create the streams used for decryption.\r\n                using (var msDecrypt = new MemoryStream(bytes))\r\n                using (var csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))\r\n                using (var srDecrypt = new C1StreamReader(csDecrypt))\r\n                {\r\n                    // Read the decrypted bytes from the decrypting stream\r\n                    // and place them in a string.\r\n                    return srDecrypt.ReadToEnd();\r\n                }\r\n            }\r\n        }\r\n\r\n        private static string ByteToHexString(byte[] myArray)\r\n        {\r\n            return BitConverter.ToString(myArray);\r\n        }\r\n\r\n        private static byte[] HexStringToByteArray(string myArray)\r\n        {\r\n            string[] hexElements = myArray.Split('-');\r\n\r\n            byte[] recreatedByteArray = new byte[hexElements.Length];\r\n            for (int i = 0; i < hexElements.Length; i++)\r\n            {\r\n                recreatedByteArray[i] = byte.Parse(hexElements[i].Trim(), NumberStyles.HexNumber, CultureInfo.InvariantCulture);\r\n            }\r\n            return recreatedByteArray;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Captcha/ImageCreator.cs",
    "content": "﻿using System;\r\nusing System.Drawing;\r\nusing System.Drawing.Drawing2D;\r\nusing System.Drawing.Imaging;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Captcha\r\n{\r\n    /// <summary>\r\n    /// Image creator\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class ImageCreator\r\n    {\r\n        #region private members\r\n        int Height;\r\n        int Width;\r\n        string ImageText = string.Empty;\r\n        string _FontFamilyName = string.Empty;\r\n        FontWarpFactor _FontWarp;\r\n        NoiseLevel _Noise;\r\n        LineNoiseLevel _LineNoise;\r\n        Color _BackgroundColor = Color.White;\r\n        Color _NoiseColor = Color.Black;\r\n        Color _LineNoiseColor = Color.Black;\r\n        Color _FontColor = Color.Black;\r\n        Random Rand = new Random();\r\n        // a list of known good fonts in on both Windows XP and Windows Server 2003\r\n        string[] FontWhitelist = { \"arial\", \"arial black\", \"comic sans ms\", \"courier new\", \"estrangelo edessa\",\r\n\t\t\t\"franklin gothic medium\", \"georgia\", \"lucida console\", \"lucida sans unicode\", \"mangal\", \"microsoft sans serif\",\r\n\t\t\t\"palatino linotype\", \"sylfaen\", \"tahoma\", \"times new roman\", \"trebuchet ms\", \"verdana\"};\r\n        #endregion\r\n\r\n        #region properties\r\n        /// <exclude />\r\n        public string FontFamilyName\r\n        {\r\n            get\r\n            {\r\n                return _FontFamilyName;\r\n            }\r\n            set\r\n            {\r\n                _FontFamilyName = value;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public FontWarpFactor FontWarp\r\n        {\r\n            get\r\n            {\r\n                return _FontWarp;\r\n            }\r\n            set\r\n            {\r\n                _FontWarp = value;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public NoiseLevel Noise\r\n        {\r\n            get\r\n            {\r\n                return _Noise;\r\n            }\r\n            set\r\n            {\r\n                _Noise = value;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public LineNoiseLevel LineNoise\r\n        {\r\n            get\r\n            {\r\n                return _LineNoise;\r\n            }\r\n            set\r\n            {\r\n                _LineNoise = value;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public Color BackgroundColor\r\n        {\r\n            get\r\n            {\r\n                return _BackgroundColor;\r\n            }\r\n            set\r\n            {\r\n                _BackgroundColor = value;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public Color NoiseColor\r\n        {\r\n            get\r\n            {\r\n                return _NoiseColor;\r\n            }\r\n            set\r\n            {\r\n                _NoiseColor = value;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public Color LineNoiseColor\r\n        {\r\n            get\r\n            {\r\n                return _LineNoiseColor;\r\n            }\r\n            set\r\n            {\r\n                _LineNoiseColor = value;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public Color FontColor\r\n        {\r\n            get\r\n            {\r\n                return _FontColor;\r\n            }\r\n            set\r\n            {\r\n                _FontColor = value;\r\n            }\r\n        }\r\n        #endregion\r\n\r\n        #region Constructors\r\n        /// <summary>\r\n        /// Class for generating CAPTCHA images\r\n        /// </summary>\r\n        /// <param name=\"width\">Width of the image</param>\r\n        /// <param name=\"height\">Height of the image</param>\r\n        public ImageCreator(int width, int height)\r\n        {\r\n            if (height < 10 || height > 400)\r\n            {\r\n                throw new ArgumentOutOfRangeException(\"height\");\r\n            }\r\n            if (width < 100 || height > 500)\r\n            {\r\n                throw new ArgumentOutOfRangeException(\"width\");\r\n            }\r\n            Height = height;\r\n            Width = width;\r\n        }\r\n        #endregion\r\n\r\n        #region Public methods\r\n        /// <exclude />\r\n        public Bitmap CreateImage(string text)\r\n        {\r\n            ImageText = text;\r\n            return GenerateImagePrivate();\r\n        }\r\n        #endregion\r\n\r\n        #region Private Members\r\n        private Bitmap GenerateImagePrivate()\r\n        {\r\n            Rectangle rectangle;\r\n            Bitmap bitmap = new Bitmap(Width, Height, PixelFormat.Format32bppArgb);\r\n            Graphics graphics = Graphics.FromImage(bitmap);\r\n            graphics.SmoothingMode = SmoothingMode.AntiAlias;\r\n\r\n            // fill an empty white rectangle\r\n            rectangle = new Rectangle(0, 0, Width, Height);\r\n            using (var backgroundBrush = new SolidBrush(BackgroundColor))\r\n            {\r\n                graphics.FillRectangle(backgroundBrush, rectangle);\r\n            }\r\n\r\n            int charOffset = 0;\r\n            double charWidth = Width / ImageText.Length;\r\n            Rectangle rectangleChar;\r\n\r\n            using (var solidFontBrush = new SolidBrush(FontColor))\r\n            foreach (char c in ImageText)\r\n            {\r\n                // establish font and draw area\r\n                rectangleChar = new Rectangle(Convert.ToInt32(charOffset * charWidth), 0, Convert.ToInt32(charWidth), Height);\r\n\r\n                // warp the character\r\n                GraphicsPath graphicsPath;\r\n\r\n                // TODO: Creating a font is the heaviest operation, takes ~ 300ms every CAPTCHA request, some caching logic can be done here\r\n                using (Font font = GetFont())\r\n                {\r\n                    graphicsPath = TextPath(c, font, rectangleChar);\r\n                }\r\n\r\n                WarpText(graphicsPath, rectangleChar);\r\n\r\n                // draw the character\r\n                graphics.FillPath(solidFontBrush, graphicsPath);\r\n\r\n                charOffset += 1;\r\n            }\r\n\r\n            AddNoise(graphics, rectangle);\r\n            AddLine(graphics, rectangle);\r\n\r\n            // clean up unmanaged resources\r\n            graphics.Dispose();\r\n\r\n            return bitmap;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns the CAPTCHA font in an appropriate size \r\n        /// </summary>\r\n        private Font GetFont()\r\n        {\r\n            Single FontSize;\r\n            string FontName = FontFamilyName;\r\n            if (String.IsNullOrEmpty(FontName))\r\n            {\r\n                FontName = RandomFontFamily();\r\n            }\r\n            switch (FontWarp)\r\n            {\r\n                case FontWarpFactor.None:\r\n                    FontSize = Convert.ToInt32(Height * 0.7);\r\n                    break;\r\n                case FontWarpFactor.Low:\r\n                    FontSize = Convert.ToInt32(Height * 0.8);\r\n                    break;\r\n                case FontWarpFactor.Medium:\r\n                    FontSize = Convert.ToInt32(Height * 0.85);\r\n                    break;\r\n                case FontWarpFactor.High:\r\n                    FontSize = Convert.ToInt32(Height * 0.9);\r\n                    break;\r\n                default:\r\n                    FontSize = Convert.ToInt32(Height * 0.95);\r\n                    break;\r\n\r\n            }\r\n            return new Font(FontName, FontSize, FontStyle.Bold);\r\n        }\r\n        /// <summary>\r\n        /// Returns a random font family from the font whitelist\r\n        /// </summary>\r\n        private string RandomFontFamily()\r\n        {\r\n            return FontWhitelist[Rand.Next(0, FontWhitelist.GetLength(0) - 1)];\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a GraphicsPath containing the specified string and font\r\n        /// </summary>\r\n        private static GraphicsPath TextPath(char s, Font font, Rectangle rectangle)\r\n        {\r\n            StringFormat stringFormat = new StringFormat();\r\n            stringFormat.Alignment = StringAlignment.Near;\r\n            stringFormat.LineAlignment = StringAlignment.Near;\r\n            GraphicsPath graphicsPath = new GraphicsPath();\r\n            graphicsPath.AddString(s.ToString(), font.FontFamily, (int)font.Style, font.Size, rectangle, stringFormat);\r\n            stringFormat.Dispose();\r\n            return graphicsPath;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Warp the provided text GraphicsPath by a variable amount\r\n        /// </summary>\r\n        private void WarpText(GraphicsPath textPath, Rectangle rectangle)\r\n        {\r\n            float WarpDivisor;\r\n            float RangeModifier;\r\n\r\n            switch (FontWarp)\r\n            {\r\n                case FontWarpFactor.None:\r\n                    return;\r\n                case FontWarpFactor.Low:\r\n                    WarpDivisor = 6f;\r\n                    RangeModifier = 1f;\r\n                    break;\r\n                case FontWarpFactor.Medium:\r\n                    WarpDivisor = 5f;\r\n                    RangeModifier = 1.3f;\r\n                    break;\r\n                case FontWarpFactor.High:\r\n                    WarpDivisor = 4.5f;\r\n                    RangeModifier = 1.4f;\r\n                    break;\r\n                default:\r\n                    WarpDivisor = 4f;\r\n                    RangeModifier = 1.5f;\r\n                    break;\r\n            }\r\n\r\n            RectangleF rectangleF;\r\n            rectangleF = new RectangleF(Convert.ToSingle(rectangle.Left), 0, Convert.ToSingle(rectangle.Width), rectangle.Height);\r\n\r\n            int HeightRange = Convert.ToInt32(rectangle.Height / WarpDivisor);\r\n            int WidthRange = Convert.ToInt32(rectangle.Width / WarpDivisor);\r\n            int Left = rectangle.Left - Convert.ToInt32(WidthRange * RangeModifier);\r\n            int Top = rectangle.Top - Convert.ToInt32(HeightRange * RangeModifier);\r\n            int Width = rectangle.Left + rectangle.Width + Convert.ToInt32(WidthRange * RangeModifier);\r\n            int Height = rectangle.Top + rectangle.Height + Convert.ToInt32(HeightRange * RangeModifier);\r\n\r\n            if (Left < 0)\r\n            {\r\n                Left = 0;\r\n            }\r\n            if (Top < 0)\r\n            {\r\n                Top = 0;\r\n            }\r\n            if (Width > this.Width)\r\n            {\r\n                Width = this.Width;\r\n            }\r\n            if (Height > this.Height)\r\n            {\r\n                Height = this.Height;\r\n            }\r\n\r\n            PointF LeftTop = RandomPoint(Left, Left + WidthRange, Top, Top + HeightRange);\r\n            PointF RightTop = RandomPoint(Width - WidthRange, Width, Top, Top + HeightRange);\r\n            PointF LeftBottom = RandomPoint(Left, Left + WidthRange, Height - HeightRange, Height);\r\n            PointF RightBottom = RandomPoint(Width - WidthRange, Width, Height - HeightRange, Height);\r\n\r\n            PointF[] Points = { LeftTop, RightTop, LeftBottom, RightBottom };\r\n\r\n            Matrix matrix = new Matrix();\r\n            matrix.Translate(0, 0);\r\n            textPath.Warp(Points, rectangleF, matrix, WarpMode.Perspective, 0);\r\n            matrix.Dispose();\r\n        }\r\n        /// <summary>\r\n        /// Add a variable level of graphic noise to the image\r\n        /// </summary>\r\n        private void AddNoise(Graphics graphics1, Rectangle rect)\r\n        {\r\n            int density;\r\n            int size;\r\n\r\n            switch (Noise)\r\n            {\r\n                case NoiseLevel.None:\r\n                    return;\r\n                case NoiseLevel.Low:\r\n                    density = 150;\r\n                    size = 40;\r\n                    break;\r\n                case NoiseLevel.Medium:\r\n                    density = 100;\r\n                    size = 40;\r\n                    break;\r\n                case NoiseLevel.High:\r\n                    density = 50;\r\n                    size = 39;\r\n                    break;\r\n                default:\r\n                    density = 20;\r\n                    size = 38;\r\n                    break;\r\n            }\r\n\r\n            using (SolidBrush br = new SolidBrush(NoiseColor))\r\n            {\r\n                int max = Convert.ToInt32(Math.Max(rect.Width, rect.Height)/size);\r\n\r\n                for (int i = 0; i <= Convert.ToInt32((rect.Width*rect.Height)/density); i++)\r\n                {\r\n                    graphics1.FillEllipse(br, Rand.Next(rect.Width), Rand.Next(rect.Height), Rand.Next(max), Rand.Next(max));\r\n                }\r\n            }\r\n        }\r\n        /// <summary>\r\n        /// Add variable level of curved lines to the image\r\n        /// </summary>\r\n        private void AddLine(Graphics graphics1, Rectangle rect)\r\n        {\r\n            int length;\r\n            float width;\r\n            int linecount;\r\n\r\n            switch (LineNoise)\r\n            {\r\n                case LineNoiseLevel.None:\r\n                    return;\r\n                case LineNoiseLevel.Low:\r\n                    length = 4;\r\n                    width = Convert.ToSingle(Height / 31.25); // 1.6\r\n                    linecount = 1;\r\n                    break;\r\n                case LineNoiseLevel.Medium:\r\n                    length = 5;\r\n                    width = Convert.ToSingle(Height / 27.7777); // 1.8\r\n                    linecount = 1;\r\n                    break;\r\n                case LineNoiseLevel.High:\r\n                    length = 3;\r\n                    width = Convert.ToSingle(Height / 25); // 2.0\r\n                    linecount = 2;\r\n                    break;\r\n                default:\r\n                    length = 3;\r\n                    width = Convert.ToSingle(Height / 22.7272); // 2.2\r\n                    linecount = 3;\r\n                    break;\r\n            }\r\n\r\n            using(Pen p = new Pen(LineNoiseColor, width))\r\n            {\r\n                PointF[] pf = new PointF[length];\r\n\r\n                for (int l = 1; l <= linecount; l++)\r\n                {\r\n                    for (int i = 0; i < length; i++)\r\n                    {\r\n                        pf[i] = RandomPoint(rect);\r\n                    }\r\n                    graphics1.DrawCurve(p, pf, 1.75f);\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a random point within the specified rectangle\r\n        /// </summary>\r\n        private PointF RandomPoint(Rectangle rect)\r\n        {\r\n            return RandomPoint(rect.Left, rect.Width, rect.Top, rect.Bottom);\r\n        }\r\n        /// <summary>\r\n        /// Returns a random point within the specified x and y ranges\r\n        /// </summary>\r\n        private PointF RandomPoint(int xmin, int xmax, int ymin, int ymax)\r\n        {\r\n            return new PointF(Rand.Next(xmin, xmax), Rand.Next(ymin, ymax));\r\n        }\r\n        #endregion\r\n    }\r\n\r\n    /// <summary>\r\n    /// Amount of random font warping to apply to rendered text\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public enum FontWarpFactor\r\n    {\r\n        /// <exclude />\r\n        None = 0,\r\n\r\n        /// <exclude />\r\n        Low = 1,\r\n\r\n        /// <exclude />\r\n        Medium = 2,\r\n\r\n        /// <exclude />\r\n        High = 3,\r\n\r\n        /// <exclude />\r\n        Extreme = 4\r\n    }\r\n\r\n    /// <summary>\r\n    /// Amount of background noise to add to rendered image\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public enum NoiseLevel\r\n    {\r\n        /// <exclude />\r\n        None = 0,\r\n\r\n        /// <exclude />\r\n        Low = 1,\r\n\r\n        /// <exclude />\r\n        Medium = 2,\r\n\r\n        /// <exclude />\r\n        High = 3,\r\n\r\n        /// <exclude />\r\n        Extreme = 4\r\n    }\r\n\r\n    /// <summary>\r\n    /// Amount of curved line noise to add to rendered image\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public enum LineNoiseLevel\r\n    {\r\n        /// <exclude />\r\n        None = 0,\r\n\r\n        /// <exclude />\r\n        Low = 1,\r\n\r\n        /// <exclude />\r\n        Medium = 2,\r\n\r\n        /// <exclude />\r\n        High = 3,\r\n\r\n        /// <exclude />\r\n        Extreme = 4\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/ConsoleInfo.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n\tinternal static class ConsoleInfo\r\n\t{\r\n        public static string TryGetConsoleId()\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null && HttpContext.Current.Request.QueryString != null)\r\n            {\r\n                return HttpContext.Current.Request.QueryString[\"consoleId\"];\r\n            }\r\n            else\r\n            {\r\n                return null;\r\n            }\r\n\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/ControlCompilerService.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Configuration;\r\nusing Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory;\r\nusing Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory.Runtime;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory.Runtime;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Logging;\r\nusing System.Collections;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ControlCompilerService\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetControlPaths()\r\n        {\r\n            UiControlFactorySettings uiControlFactorySettings = ConfigurationServices.ConfigurationSource.GetSection(UiControlFactorySettings.SectionName) as UiControlFactorySettings;\r\n\r\n            foreach (Composite.C1Console.Forms.Plugins.UiControlFactory.Runtime.ChannelConfigurationElement channelElement in uiControlFactorySettings.Channels)\r\n            {\r\n                foreach (NamespaceConfigurationElement namespaceElement in channelElement.Namespaces)\r\n                {\r\n                    foreach (UiControlFactoryData uiControlFactoryData in namespaceElement.Factories)\r\n                    {\r\n                        PropertyInfo propertyInfo = uiControlFactoryData.GetType().GetProperty(\"UserControlVirtualPath\");\r\n                        if (propertyInfo != null)\r\n                        {\r\n                            string path = (string)propertyInfo.GetValue(uiControlFactoryData, null);\r\n\r\n                            yield return path;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            UiContainerFactorySettings uiContainerFactorySettings = ConfigurationServices.ConfigurationSource.GetSection(UiContainerFactorySettings.SectionName) as UiContainerFactorySettings;\r\n\r\n            foreach (Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory.Runtime.ChannelConfigurationElement channelElement in uiContainerFactorySettings.Channels)\r\n            {\r\n                foreach (UiContainerFactoryData uiControlFactoryData in channelElement.Factories)\r\n                {\r\n                    PropertyInfo propertyInfo = uiControlFactoryData.GetType().GetProperty(\"UserControlVirtualPath\");\r\n                    if (propertyInfo != null)\r\n                    {\r\n                        string path = (string)propertyInfo.GetValue(uiControlFactoryData, null);\r\n\r\n                        yield return path;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void CompileAll()\r\n        {\r\n            FieldInfo theBuildManagerFieldInfo = typeof(System.Web.Compilation.BuildManager).GetField(\"_theBuildManager\", BindingFlags.NonPublic | BindingFlags.Static);\r\n            FieldInfo cachesManagerFieldInfo = typeof(System.Web.Compilation.BuildManager).GetField(\"_caches\", BindingFlags.NonPublic | BindingFlags.Instance);\r\n\r\n            object currentBuilderManager = theBuildManagerFieldInfo.GetValue(null);\r\n            IEnumerable caches = cachesManagerFieldInfo.GetValue(currentBuilderManager) as IEnumerable;\r\n\r\n            Type standardDiskBuildResultCacheType = caches.OfType<object>().Where(f => f.GetType().FullName == \"System.Web.Compilation.StandardDiskBuildResultCache\").Select(f => f.GetType()).Single();\r\n            FieldInfo maxRecompilationsFieldInfo = standardDiskBuildResultCacheType.BaseType.GetField(\"s_maxRecompilations\", BindingFlags.NonPublic | BindingFlags.Static);\r\n\r\n            object oldValue = maxRecompilationsFieldInfo.GetValue(null);\r\n            maxRecompilationsFieldInfo.SetValue(null, 500);\r\n\r\n            IEnumerable<string> paths = GetControlPaths();\r\n\r\n            IPerformanceCounterToken performanceCounterToken = PerformanceCounterFacade.BeginAspNetControlCompile();\r\n\r\n            // ParallelFacade.ForEach(paths, path => // Call to parallelization facade causes a deadlock while starting-up!!!\r\n            foreach (string path in paths)\r\n            {\r\n                int t1 = Environment.TickCount;\r\n                Type type = BuildManagerHelper.GetCompiledType(path);\r\n                int t2 = Environment.TickCount;\r\n\r\n                LoggingService.LogVerbose(\"RGB(180, 180, 255)ControlCompilerService\", string.Format(\"{0} compiled in {1} ms\", path, t2 - t1));\r\n            }\r\n\r\n            PerformanceCounterFacade.EndAspNetControlCompile(performanceCounterToken, paths.Count());\r\n\r\n           // maxRecompilationsFieldInfo.SetValue(null, oldValue);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/CookieHandler.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class CookieHandler\r\n    {\r\n        /// <summary>\r\n        /// Gets a cookie value specific for the current application instance (port and virtual path). \r\n        /// The actual cookie name will be appended port and path info to ensure a unique cookie across multiple\r\n        /// C1 sites running on the same host name. \r\n        /// To have explicit control over cookie naming, use the ASP.NET Cookies class.\r\n        /// </summary>\r\n        /// <param name=\"cookieName\">The name used to set this cookie</param>\r\n        /// <returns>Value of the cookie, or null if the cookie was not found</returns>\r\n        public static string Get(string cookieName)\r\n        {\r\n            var context = HttpContext.Current;\r\n            Verify.That(context != null, \"HttpContext is not available.\");\r\n\r\n            cookieName = GetApplicationSpecificCookieName(cookieName);\r\n\r\n            if (context.Items[\"setCookies\"]!=null)\r\n            {\r\n                var setCookies = context.Items[\"setCookies\"] as HttpCookieCollection;\r\n                var responseCookie = GetCookie(setCookies, cookieName);\r\n                if (responseCookie != null)\r\n                {\r\n                    return responseCookie.Value;\r\n                }\r\n            }\r\n\r\n            var requestCookie = GetCookie(context.Request.Cookies, cookieName);\r\n\r\n            return requestCookie?.Value;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Sets a cookie specific for the current application instance (port and virtual path). In order to read this cookie you should use the Get() methos on this class. \r\n        /// To have explicit control over cookie naming, use the ASP.NET Cookies class.\r\n        /// </summary>\r\n        public static void Set(string cookieName, string value)\r\n        {\r\n            SetCookieInternal(cookieName, value);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Sets a cookie specific for the current application instance (port and virtual path). In order to read this cookie you should use the Get() methos on this class. \r\n        /// To have explicit control over cookie naming, use the ASP.NET Cookies class.\r\n        /// </summary>\r\n        public static void Set(string cookieName, string value, DateTime expires)\r\n        {\r\n            var cookie = SetCookieInternal(cookieName, value);\r\n            cookie.Expires = expires;\r\n        }\r\n\r\n        internal static HttpCookie SetCookieInternal(string cookieName, string value)\r\n        {\r\n            var context = HttpContext.Current;\r\n            Verify.That(context != null, \"HttpContext is not available.\");\r\n\r\n            cookieName = GetApplicationSpecificCookieName(cookieName);\r\n            var cookie = context.Response.Cookies[cookieName];\r\n            cookie.Value = value;\r\n\r\n            context.Items[\"setCookies\"] = context.Response.Cookies;\r\n\r\n            return cookie;\r\n        }\r\n\r\n        internal static string GetApplicationSpecificCookieName(string cookieName)\r\n        {\r\n            int siteUniqueHash = InstallationInformationFacade.InstallationId.GetHashCode();\r\n            return string.Format(\"{0}_{1}_{2}\", cookieName, siteUniqueHash, UrlUtils.PublicRootPath.GetHashCode());\r\n        }\r\n\r\n        private static HttpCookie GetCookie(HttpCookieCollection cookies, string key)\r\n        {\r\n            if(!cookies.AllKeys.Any(cookieKey => cookieKey == key))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return cookies[key];\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/ErrorServices.cs",
    "content": "﻿using System;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ErrorServices\r\n    {\r\n        /// <exclude />\r\n        public static void DocumentAdministrativeError(Exception exception)\r\n        {\r\n\r\n            StringBuilder consoleMsg = new StringBuilder();\r\n            consoleMsg.AppendLine(exception.GetBaseException().ToString());\r\n\r\n            Log.LogCritical(\"Web Application Error, Exception\", exception);\r\n\r\n            var httpContext = HttpContext.Current;\r\n            if (httpContext != null && httpContext.Request != null && httpContext.Request.Url != null)\r\n            {\r\n                consoleMsg.AppendLine();\r\n                consoleMsg.AppendLine(\"URL:     \" + HttpContext.Current.Request.Url);\r\n                if (HttpContext.Current.Request.UrlReferrer != null)\r\n                {\r\n                    consoleMsg.AppendLine(\"Referer: \" + httpContext.Request.UrlReferrer.AbsolutePath);\r\n                }\r\n            }\r\n\r\n            string consoleId = ConsoleInfo.TryGetConsoleId();\r\n            if (consoleId != null)\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new LogEntryMessageQueueItem { Level = LogLevel.Error, Message = consoleMsg.ToString(), Sender = typeof(ErrorServices) }, consoleId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RedirectUserToErrorPage(string uiContainerName, Exception exception)\r\n        {\r\n            if (HttpContext.Current == null)\r\n                return;\r\n\r\n            string redirectUrl;\r\n\r\n            switch (uiContainerName)\r\n            {\r\n                case \"Document\":\r\n                    redirectUrl = UrlUtils.ResolveAdminUrl(\"content/misc/errors/error.aspx\") + \"?\" + ConvertExceptionToQueryString(exception);\r\n                    break;\r\n\r\n                case null:\r\n                case \"Wizard\":\r\n                case \"DataDialog\":\r\n                case \"ConfirmDialog\":\r\n                    redirectUrl = UrlUtils.ResolveAdminUrl(\"content/misc/errors/error_dialog.aspx\") + \"?\" + ConvertExceptionToQueryString(exception);\r\n                    break;\r\n\r\n                default:\r\n                    Log.LogWarning(\"ErrorServices\", string.Format(\"Unhandled redirect! Unknown container: '{0}\", uiContainerName));\r\n                    throw new NotImplementedException(string.Format(\"Unknown container: '{0}'\", uiContainerName));\r\n            }\r\n\r\n            HttpContext.Current.Response.Redirect(redirectUrl, true);\r\n        }\r\n\r\n        private static string ConvertExceptionToQueryString(Exception exception)\r\n        {\r\n            var sbResult = new StringBuilder();\r\n\r\n            int exceptionIndex = 0;\r\n\r\n            while (exception != null)\r\n            {\r\n                if(sbResult.Length > 0)\r\n                {\r\n                    sbResult.Append(\"&\");\r\n                }\r\n\r\n                string encodedExceptionType = HttpUtility.UrlEncode(exception.GetType().Name);\r\n                string encodedExceptionMessage = HttpUtility.UrlEncode(exception.Message);\r\n                string encodedExceptionStackTrace = HttpUtility.UrlEncode(exception.StackTrace);\r\n                if (encodedExceptionStackTrace.Length > 1000) encodedExceptionStackTrace = encodedExceptionStackTrace.Substring(0, 1000);\r\n\r\n                string indexStr = exceptionIndex == 0 ? string.Empty : exceptionIndex.ToString();\r\n\r\n                sbResult.Append(\"type{0}=\".FormatWith(indexStr) + encodedExceptionType);\r\n                sbResult.Append(\"&msg{0}=\".FormatWith(indexStr) + encodedExceptionMessage);\r\n                sbResult.Append(\"&stack{0}=\".FormatWith(indexStr) + encodedExceptionStackTrace);\r\n\r\n                exceptionIndex++;\r\n                exception = exception.InnerException;\r\n            }\r\n\r\n            return sbResult.ToString();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowMediators/ActionExecutionMediator.cs",
    "content": "using Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Core.WebClient.FlowMediators\r\n{\r\n    internal static class ActionExecutionMediator\r\n    {\r\n        public static void ExecuteElementAction(ElementHandle elementHandle, ActionHandle actionHandle, string consoleId)\r\n        {\r\n            var flowServicesContainer = new FlowControllerServicesContainer(\r\n                new ManagementConsoleMessageService(consoleId),\r\n                new ElementDataExchangeService(elementHandle.ProviderName),\r\n                new ActionExecutionService(elementHandle.ProviderName, consoleId),\r\n                new ElementInformationService(elementHandle)\r\n            );\r\n\r\n            FlowToken flowToken = ActionExecutorFacade.Execute(elementHandle.EntityToken, actionHandle.ActionToken, flowServicesContainer);\r\n\r\n            IFlowUiDefinition uiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);\r\n\r\n            if (uiDefinition is FlowUiDefinitionBase flowUiDefinition)\r\n            {\r\n                string serializedEntityToken = EntityTokenSerializer.Serialize(elementHandle.EntityToken, true);\r\n                ViewTransitionHelper.HandleNew(consoleId, elementHandle.ProviderName, serializedEntityToken, flowToken, flowUiDefinition);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static bool ExecuteElementDraggedAndDropped(ElementHandle draggedElementHandle, ElementHandle newParentdElementHandle, int dropIndex, string consoleId, bool isCopy)\r\n        {\r\n            var flowServicesContainer = new FlowControllerServicesContainer(\r\n                new ManagementConsoleMessageService(consoleId),\r\n                new ElementDataExchangeService(draggedElementHandle.ProviderName),\r\n                new ActionExecutionService(draggedElementHandle.ProviderName, consoleId)\r\n            );\r\n\r\n            return ElementFacade.ExecuteElementDraggedAndDropped(draggedElementHandle, newParentdElementHandle, dropIndex, isCopy, flowServicesContainer);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowMediators/ActionExecutionService.cs",
    "content": "using Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Tasks;\r\n\r\n\r\nnamespace Composite.Core.WebClient.FlowMediators\r\n{\r\n    internal sealed class ActionExecutionService : IActionExecutionService\r\n    {\r\n        public ActionExecutionService(string elementProviderName, string consoleId)\r\n        {\r\n            this.ElementProviderName = elementProviderName;\r\n            this.ConsoleId = consoleId;\r\n        }\r\n\r\n        private string ElementProviderName { get; }\r\n        private string ConsoleId { get; }\r\n\r\n        public void Execute(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)\r\n        {\r\n            var flowServicesContainer = new FlowControllerServicesContainer(\r\n                new ManagementConsoleMessageService(this.ConsoleId),\r\n                new ElementDataExchangeService(this.ElementProviderName),\r\n                this\r\n            );\r\n\r\n            FlowToken flowToken = ActionExecutorFacade.Execute(entityToken, actionToken, flowServicesContainer, taskManagerEvent);\r\n\r\n            IFlowUiDefinition uiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);\r\n\r\n            if (uiDefinition is FlowUiDefinitionBase flowUiDefinition)\r\n            {\r\n                string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);\r\n                ViewTransitionHelper.HandleNew(this.ConsoleId, this.ElementProviderName, serializedEntityToken, flowToken, flowUiDefinition);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowMediators/FormFlowRendering/FormFlowRenderingService.cs",
    "content": "﻿using System.Web.UI;\r\n\r\nnamespace Composite.Core.WebClient.FlowMediators.FormFlowRendering\r\n{\r\n    internal class FormFlowWebRenderingService : IFormFlowWebRenderingService\r\n    {\r\n        public void SetNewPageOutput(Control pageOutput)\r\n        {\r\n            this.NewPageOutput = pageOutput;\r\n        }\r\n\r\n        public void SetNewPageMimeType(string mimyType)\r\n        {\r\n            this.NewPageMimeType = mimyType;\r\n        }\r\n\r\n        public Control NewPageOutput { get; private set; }\r\n\r\n        public string NewPageMimeType { get; private set; }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowMediators/FormFlowRendering/FormFlowUiDefinitionRenderer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Forms.Flows.Foundation.PluginFacades;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.Core.WebClient.FlowMediators.FormFlowRendering\r\n{\r\n    internal static class FormFlowUiDefinitionRenderer\r\n    {\r\n        public static IUiControl Render(\r\n            string consoleId,\r\n            string elementProviderName,\r\n            FlowToken flowToken,\r\n            FormFlowUiDefinition formFlowUiCommand,\r\n            IFormChannelIdentifier channel,\r\n            bool debugMode,\r\n            FlowControllerServicesContainer servicesContainer)\r\n        {\r\n            FlowControllerServicesContainer formServicesContainer = new FlowControllerServicesContainer(servicesContainer);\r\n            formServicesContainer.AddService(new FormFlowRenderingService());\r\n            formServicesContainer.AddService(new FormFlowWebRenderingService());\r\n\r\n            IFormMarkupProvider formMarkupProvider = formFlowUiCommand.MarkupProvider;\r\n            IFormMarkupProvider customToolbarItemsMarkupProvider = formFlowUiCommand.CustomToolbarItemsMarkupProvider;\r\n            Dictionary<string, object> innerFormBindings = formFlowUiCommand.BindingsProvider.GetBindings();\r\n            Dictionary<IFormEventIdentifier, FormFlowEventHandler> eventHandlers = formFlowUiCommand.EventHandlers;\r\n            Dictionary<string, List<ClientValidationRule>> bindingsValidationRules = formFlowUiCommand.BindingsValidationRules;\r\n\r\n            FormTreeCompiler formCompiler = new FormTreeCompiler();\r\n            IUiContainer renderingContainer = GetRenderingContainer(channel, formFlowUiCommand.UiContainerType);\r\n\r\n            // Setting state related objects so the delegate below can access them \"fresh\"\r\n            CurrentFormTreeCompiler = formCompiler;\r\n            CurrentInnerFormBindings = innerFormBindings;\r\n            CurrentControlContainer = (IWebUiContainer)renderingContainer;\r\n\r\n\r\n            Dictionary<string, object> containerEventHandlerStubs = new Dictionary<string, object>();\r\n\r\n            foreach (IFormEventIdentifier eventIdentifier in eventHandlers.Keys)\r\n            {\r\n                IFormEventIdentifier localScopeEventIdentifier = eventIdentifier;  // See: Local variable usage with anonymous methods within loop control structures\r\n\r\n                EventHandler handlerStub = delegate(object sender, EventArgs e)\r\n                {\r\n                    try\r\n                    {\r\n                        BaseEventHandler(consoleId, elementProviderName, flowToken, formFlowUiCommand, servicesContainer, eventHandlers, localScopeEventIdentifier, formServicesContainer);\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        formServicesContainer.GetService<IManagementConsoleMessageService>().ShowLogEntry(typeof(FormFlowUiDefinitionRenderer), ex);\r\n                        throw;\r\n                    }\r\n                };\r\n\r\n                containerEventHandlerStubs.Add(eventIdentifier.BindingName, handlerStub);\r\n\r\n                if (innerFormBindings.ContainsKey(eventIdentifier.BindingName))\r\n                {\r\n                    innerFormBindings.Remove(eventIdentifier.BindingName);\r\n                }\r\n\r\n                innerFormBindings.Add(eventIdentifier.BindingName, handlerStub);\r\n            }\r\n\r\n            XDocument document;\r\n\r\n            using (XmlReader formMarkupReader = formMarkupProvider.GetReader())\r\n            {\r\n                document = XDocument.Load(formMarkupReader);\r\n                formMarkupReader.Close();\r\n            }\r\n\r\n            formCompiler.Compile(document, channel, innerFormBindings, debugMode, \"\", bindingsValidationRules);\r\n\r\n            IUiControl innerForm = formCompiler.UiControl;\r\n\r\n            IUiControl customToolbarItems = null;\r\n            if (customToolbarItemsMarkupProvider != null)\r\n            {\r\n                var toolbarCompiler = new FormTreeCompiler();\r\n                CurrentCustomToolbarFormTreeCompiler = toolbarCompiler;\r\n\r\n                using (XmlReader formMarkupReader = customToolbarItemsMarkupProvider.GetReader())\r\n                {\r\n                    toolbarCompiler.Compile(formMarkupReader, channel, innerFormBindings, debugMode, bindingsValidationRules);\r\n                }\r\n                customToolbarItems = toolbarCompiler.UiControl;\r\n            }\r\n\r\n            CurrentControlTreeRoot = (IWebUiControl)innerForm;\r\n\r\n            string label = formCompiler.Label;\r\n            if(label.IsNullOrEmpty())\r\n            {\r\n                label = formFlowUiCommand.ContainerLabel ?? \"\";\r\n            }\r\n\r\n            string labelField = GetFormLabelField(document);\r\n            ResourceHandle containerIcon = formCompiler.Icon;\r\n\r\n            return renderingContainer.Render(formCompiler.UiControl, customToolbarItems, channel, containerEventHandlerStubs, label, labelField, formCompiler.Tooltip, containerIcon);\r\n        }\r\n\r\n        private static void BaseEventHandler(string consoleId, \r\n                                             string elementProviderName, \r\n                                             FlowToken flowToken,\r\n                                             FormFlowUiDefinition formFlowUiCommand,\r\n                                             FlowControllerServicesContainer servicesContainer, \r\n                                             Dictionary<IFormEventIdentifier, FormFlowEventHandler> eventHandlers,\r\n                                             IFormEventIdentifier localScopeEventIdentifier,\r\n                                             FlowControllerServicesContainer formServicesContainer)\r\n        {\r\n            FormTreeCompiler activeFormTreeCompiler = CurrentFormTreeCompiler;\r\n            Dictionary<string, object> activeInnerFormBindings = CurrentInnerFormBindings;\r\n\r\n            FormFlowEventHandler handler = eventHandlers[localScopeEventIdentifier];\r\n            Dictionary<string, Exception> bindingErrors = activeFormTreeCompiler.SaveAndValidateControlProperties();\r\n\r\n            FormTreeCompiler activeCustomToolbarFormTreeCompiler = CurrentCustomToolbarFormTreeCompiler;\r\n            if (activeCustomToolbarFormTreeCompiler != null)\r\n            {\r\n                var toolbarBindingErrors = activeCustomToolbarFormTreeCompiler.SaveAndValidateControlProperties();\r\n                foreach (var pair in toolbarBindingErrors)\r\n                {\r\n                    bindingErrors.Add(pair.Key, pair.Value);\r\n                }\r\n            }\r\n\r\n            formServicesContainer.AddService(new BindingValidationService(bindingErrors));\r\n\r\n            handler.Invoke(flowToken, activeInnerFormBindings, formServicesContainer);\r\n\r\n            if (formServicesContainer.GetService<IManagementConsoleMessageService>().CloseCurrentViewRequested)\r\n            {\r\n                ViewTransitionHelper.HandleCloseCurrentView(formFlowUiCommand.UiContainerType);\r\n                return;\r\n            }\r\n            \r\n            var formFlowService = formServicesContainer.GetService<IFormFlowRenderingService>();\r\n            bool replacePageOutput = (formServicesContainer.GetService<IFormFlowWebRenderingService>().NewPageOutput != null);\r\n\r\n            bool rerenderView = formFlowService.RerenderViewRequested;\r\n            if (formFlowService.BindingPathedMessages != null)\r\n            {\r\n                ShowFieldMessages(CurrentControlTreeRoot, formFlowService.BindingPathedMessages, CurrentControlContainer,\r\n                                    servicesContainer);\r\n            }\r\n\r\n            List<bool> boolCounterList = new List<bool> {replacePageOutput, rerenderView};\r\n\r\n            if (boolCounterList.Count(f => f) > 1)\r\n            {\r\n                StringBuilder sb = new StringBuilder(\"Flow returned conflicting directives for post handling:\\n\");\r\n                if (replacePageOutput) sb.AppendLine(\" - Replace page output with new web control.\");\r\n                if (rerenderView) sb.AppendLine(\" - Rerender view.\");\r\n\r\n                throw new InvalidOperationException(sb.ToString());\r\n            }\r\n\r\n            if (rerenderView)\r\n            {\r\n                Log.LogVerbose(\"FormFlowRendering\", \"Re-render requested\");\r\n                IFlowUiDefinition newFlowUiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken,\r\n                                                                                                    servicesContainer);\r\n                if (!(newFlowUiDefinition is FlowUiDefinitionBase))\r\n                    throw new NotImplementedException(\"Unable to handle transitions to ui definition of type \" +\r\n                                                        newFlowUiDefinition.GetType());\r\n                ViewTransitionHelper.HandleRerender(consoleId, elementProviderName, flowToken, formFlowUiCommand,\r\n                                                    (FlowUiDefinitionBase) newFlowUiDefinition, servicesContainer);\r\n            }\r\n\r\n            if (replacePageOutput)\r\n            {\r\n                Log.LogVerbose(\"FormFlowRendering\", \"Replace pageoutput requested\");\r\n                IFormFlowWebRenderingService webRenderingService =\r\n                    formServicesContainer.GetService<IFormFlowWebRenderingService>();\r\n                Control newPageOutput = webRenderingService.NewPageOutput;\r\n\r\n                foreach (Control control in GetNestedControls(newPageOutput).Where(f => f is ScriptManager).ToList())\r\n                {\r\n                    control.Parent.Controls.Remove(control);\r\n                }\r\n\r\n                Page currentPage = HttpContext.Current.Handler as Page;\r\n\r\n                HtmlHead newHeadControl = GetNestedControls(newPageOutput).FirstOrDefault(f => f is HtmlHead) as HtmlHead;\r\n\r\n                HtmlHead oldHeadControl = currentPage.Header;\r\n\r\n                ControlCollection headContainer = null;\r\n                bool headersHasToBeSwitched = newHeadControl != null && oldHeadControl != null;\r\n                if (headersHasToBeSwitched)\r\n                {\r\n                    headContainer = newHeadControl.Parent.Controls;\r\n                    headContainer.Remove(newHeadControl);\r\n                }\r\n\r\n                currentPage.Controls.Clear();\r\n                if (string.IsNullOrEmpty(webRenderingService.NewPageMimeType))\r\n                {\r\n                    currentPage.Response.ContentType = \"text/html\";\r\n                }\r\n                else\r\n                {\r\n                    currentPage.Response.ContentType = webRenderingService.NewPageMimeType;\r\n                }\r\n                currentPage.Controls.Add(newPageOutput);\r\n\r\n                if (headersHasToBeSwitched)\r\n                {\r\n                    oldHeadControl.Controls.Clear();\r\n                    oldHeadControl.InnerHtml = \"\";\r\n                    oldHeadControl.InnerText = \"\";\r\n                    if (newHeadControl.ID != null)\r\n                    {\r\n                        oldHeadControl.ID = newHeadControl.ID;\r\n                    }\r\n                    oldHeadControl.Title = newHeadControl.Title;\r\n\r\n                    headContainer.AddAt(0, oldHeadControl);\r\n\r\n                    foreach (Control c in newHeadControl.Controls.Cast<Control>().ToList())\r\n                    {\r\n                        oldHeadControl.Controls.Add(c);\r\n                    }\r\n                }\r\n            }\r\n            \r\n        }\r\n\r\n        private static string GetFormLabelField(XDocument formMarkup)\r\n        {\r\n            var labelElement = formMarkup.Descendants(Namespaces.BindingForms10 + \"layout.label\").FirstOrDefault() \r\n                            ?? formMarkup.Descendants().FirstOrDefault(e => e.Name.LocalName == \"TabPanels.Label\");\r\n\r\n            var readBinding = labelElement?.Element(Namespaces.BindingForms10 + \"read\");\r\n            if(readBinding == null) return null;\r\n\r\n            return (string)readBinding.Attribute(\"source\");\r\n        }\r\n\r\n        private static IUiContainer GetRenderingContainer(IFormChannelIdentifier channel, IFlowUiContainerType containerIdentifier)\r\n        {\r\n            return UiContainerFactoryFactoryPluginFacade.CreateContainer(channel, containerIdentifier);\r\n        }\r\n\r\n\r\n\r\n        private static readonly string _formTreeCompilerLookupKey = typeof(FormFlowUiDefinitionRenderer).FullName + \"FormTreeCompiler\";\r\n        private static readonly string _customToolbarFormTreeCompilerLookupKey = typeof(FormFlowUiDefinitionRenderer).FullName + \"CustomToolbarFormTreeCompiler\";\r\n        private static readonly string _innerFormBindingsLookupKey = typeof(FormFlowUiDefinitionRenderer).FullName + \"InnerFormBindings\";\r\n        private static readonly string _currentControlTreeRoot = typeof(FormFlowUiDefinitionRenderer).FullName + \"ControlTreeRoot\";\r\n        private static readonly string _currentControlContainer = typeof(FormFlowUiDefinitionRenderer).FullName + \"ControlContainer\";\r\n\r\n\r\n\r\n        internal static FormTreeCompiler CurrentFormTreeCompiler\r\n        {\r\n            get { return HttpContext.Current.Items[_formTreeCompilerLookupKey] as FormTreeCompiler; }\r\n            set { HttpContext.Current.Items[_formTreeCompilerLookupKey] = value; }\r\n        }\r\n\r\n        private static FormTreeCompiler CurrentCustomToolbarFormTreeCompiler\r\n        {\r\n            get { return HttpContext.Current.Items[_customToolbarFormTreeCompilerLookupKey] as FormTreeCompiler; }\r\n            set { HttpContext.Current.Items[_customToolbarFormTreeCompilerLookupKey] = value; }\r\n        }\r\n\r\n        private static Dictionary<string, object> CurrentInnerFormBindings\r\n        {\r\n            get { return HttpContext.Current.Items[_innerFormBindingsLookupKey] as Dictionary<string, object>; }\r\n            set { HttpContext.Current.Items[_innerFormBindingsLookupKey] = value; }\r\n        }\r\n\r\n        private static IWebUiControl CurrentControlTreeRoot\r\n        {\r\n            get { return HttpContext.Current.Items[_currentControlTreeRoot] as IWebUiControl; }\r\n            set { HttpContext.Current.Items[_currentControlTreeRoot] = value; }\r\n        }\r\n        private static IWebUiContainer CurrentControlContainer\r\n        {\r\n            get { return HttpContext.Current.Items[_currentControlContainer] as IWebUiContainer; }\r\n            set { HttpContext.Current.Items[_currentControlContainer] = value; }\r\n        }\r\n\r\n\r\n\r\n\r\n        private static void ShowFieldMessages(IWebUiControl webUiControlTreeRoot, Dictionary<string, string> bindingPathedMessages, IWebUiContainer container, FlowControllerServicesContainer servicesContainer)\r\n        {\r\n            var pathToClientIDMappings = new Dictionary<string, string>();\r\n            ResolveBindingPathToClientIDMappings(webUiControlTreeRoot, pathToClientIDMappings);\r\n\r\n            var cliendIDPathedMessages = new Dictionary<string, string>();\r\n            var homelessMessages = new Dictionary<string, string>();\r\n\r\n            foreach (var msgElement in bindingPathedMessages)\r\n            {\r\n                string clientId = null;\r\n\r\n                if (pathToClientIDMappings.TryGetValue(msgElement.Key, out clientId))\r\n                {\r\n                    cliendIDPathedMessages.Add(clientId, msgElement.Value);\r\n                }\r\n                else\r\n                {\r\n                    homelessMessages.Add(msgElement.Key, msgElement.Value);\r\n                }\r\n            }\r\n\r\n            container.ShowFieldMessages(cliendIDPathedMessages);\r\n\r\n            if (homelessMessages.Count > 0)\r\n            {\r\n                StringBuilder sb = new StringBuilder();\r\n\r\n                foreach (var msgElement in homelessMessages)\r\n                {\r\n                    sb.AppendFormat(\"{0}: {1}\\n\", msgElement.Key, msgElement.Value);\r\n                }\r\n\r\n                var consoleMsgService = servicesContainer.GetService<IManagementConsoleMessageService>();\r\n                consoleMsgService.ShowMessage(DialogType.Warning, \"Field messages\", sb.ToString());\r\n            }\r\n        }\r\n\r\n\r\n        internal static void ResolveBindingPathToClientIDMappings(IWebUiControl webUiControl, Dictionary<string, string> resolvedMappings)\r\n        {\r\n            var container = webUiControl as ContainerUiControlBase;\r\n            if (container != null)\r\n            {\r\n                foreach (IUiControl child in container.UiControls)\r\n                {\r\n                    ResolveBindingPathToClientIDMappings((IWebUiControl)child, resolvedMappings);\r\n                }\r\n            }\r\n\r\n            if (webUiControl.SourceBindingPaths != null && webUiControl.ClientName != null && webUiControl.SourceBindingPaths.Count > 0)\r\n            {\r\n                foreach (string sourceBindingPath in webUiControl.SourceBindingPaths)\r\n                {\r\n                    resolvedMappings.Add(sourceBindingPath, webUiControl.ClientName);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static IEnumerable<Control> GetNestedControls(Control control)\r\n        {\r\n            foreach (Control child in control.Controls)\r\n            {\r\n                yield return child;\r\n\r\n                foreach (Control nested in GetNestedControls(child))\r\n                {\r\n                    yield return nested;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowMediators/FormFlowRendering/IFormFlowWebRenderingService.cs",
    "content": "﻿using Composite.C1Console.Actions;\r\nusing System.Web.UI;\r\n\r\n\r\nnamespace Composite.Core.WebClient.FlowMediators.FormFlowRendering\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFormFlowWebRenderingService : IFlowControllerService\r\n    {\r\n        /// <exclude />\r\n        void SetNewPageOutput(Control pageOutput);\r\n\r\n        /// <exclude />\r\n        void SetNewPageMimeType(string mimyType);\r\n\r\n        /// <exclude />\r\n        Control NewPageOutput { get; }\r\n\r\n        /// <exclude />\r\n        string NewPageMimeType { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowMediators/TreeServicesFacade.cs",
    "content": "using System; \r\nusing System.Collections.Generic; \r\nusing System.Linq; \r\nusing Composite.C1Console.Events; \r\nusing Composite.C1Console.Elements; \r\nusing Composite.Core.Logging; \r\nusing Composite.Core.ResourceSystem.Icons; \r\nusing Composite.C1Console.Security; \r\nusing Composite.C1Console.Users; \r\nusing Composite.Core.WebClient.Services.TreeServiceObjects; \r\nusing Composite.Core.WebClient.Services.TreeServiceObjects.ExtensionMethods; \r\n \r\n \r\nnamespace Composite.Core.WebClient.FlowMediators \r\n{ \r\n    internal class NullRootEntityToken : EntityToken \r\n    { \r\n        public override string Type { get { return \"null\"; } } \r\n        public override string Source { get { return \"null\"; } } \r\n        public override string Id { get { return \"null\"; } } \r\n        public override string Serialize() { return \"NullRootEntiryToken\"; } \r\n    } \r\n \r\n    /// <exclude /> \r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]  \r\n    public static class TreeServicesFacade \r\n    { \r\n        /// <exclude /> \r\n        public static ClientElement GetRoot() \r\n        { \r\n                List<Element> roots = ElementFacade.GetRoots(null).ToList(); \r\n \r\n                if (roots.Count == 0) \r\n                { \r\n                    // user with out any access logging in - return \"empty root\" \r\n                    roots = ElementFacade.GetRootsWithNoSecurity().ToList(); \r\n                    if (roots.Count == 0) throw new InvalidOperationException(\"No roots specified\"); \r\n                    if (roots.Count > 1) throw new InvalidOperationException(\"More than one root specified\"); \r\n \r\n                    var emptyElement = new Element(new ElementHandle(\"nullRoot\", new NullRootEntityToken())); \r\n                    emptyElement.VisualData = new ElementVisualizedData { HasChildren = false, Label = \"nullroot\", Icon = CommonElementIcons.Folder }; \r\n \r\n                    roots.Clear(); \r\n                    roots.Add(emptyElement); \r\n                } \r\n                else if (roots.Count > 1) \r\n                { \r\n                    throw new InvalidOperationException(\"More than one root specified\"); \r\n                } \r\n \r\n                return roots[0].GetClientElement(); \r\n        } \r\n \r\n \r\n \r\n        /// <exclude /> \r\n        public static List<ClientElement> GetRoots(string providerHandle, string serializedSearchToken) \r\n        { \r\n                SearchToken searchToken = null; \r\n                if (!string.IsNullOrEmpty(serializedSearchToken)) \r\n                { \r\n                    searchToken = SearchToken.Deserialize(serializedSearchToken); \r\n                } \r\n \r\n                List<Element> roots; \r\n                if (UserSettings.ForeignLocaleCultureInfo == null || UserSettings.ForeignLocaleCultureInfo.Equals(UserSettings.ActiveLocaleCultureInfo)) \r\n                { \r\n                    roots = ElementFacade.GetRoots(new ElementProviderHandle(providerHandle), searchToken).ToList(); \r\n                } \r\n                else \r\n                { \r\n                    roots = ElementFacade.GetForeignRoots(new ElementProviderHandle(providerHandle), searchToken).ToList(); \r\n                } \r\n \r\n                return roots.ToClientElementList(); \r\n        } \r\n \r\n \r\n \r\n        /// <exclude /> \r\n        public static List<string> GetLocaleAwarePerspectiveElements() \r\n        { \r\n            IEnumerable<Element> elements = ElementFacade.GetPerspectiveElements(true); \r\n \r\n            List<string> clientElementKeys = new List<string>(); \r\n            foreach (Element element in elements) \r\n            { \r\n                if (element.IsLocaleAware) \r\n                { \r\n                    clientElementKeys.Add(element.GetClientElement().ElementKey); \r\n                } \r\n            } \r\n \r\n            return clientElementKeys; \r\n        } \r\n \r\n \r\n \r\n        /// <exclude /> \r\n        public static List<ClientElement> GetPerspectiveElementsWithNoSecurity() \r\n        { \r\n            return ElementFacade.GetPerspectiveElementsWithNoSecurity().ToList().ToClientElementList(); \r\n        } \r\n \r\n \r\n \r\n        /// <exclude /> \r\n        public static List<ClientElement> GetChildren(string providerName, string serializedEntityToken, string piggybag, string serializedSearchToken) \r\n        { \r\n                //LoggingService.LogVerbose(\"RGB(255, 0, 255)TreeServiceFacade\", \"----- Start -----------------------------------------------\"); \r\n \r\n                int t1 = Environment.TickCount; \r\n \r\n                EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken); \r\n                ElementHandle elementHandle = new ElementHandle(providerName, entityToken, piggybag); \r\n \r\n                //int t2 = Environment.TickCount; \r\n \r\n                SearchToken searchToken = null; \r\n                if (!string.IsNullOrEmpty(serializedSearchToken)) \r\n                { \r\n                    searchToken = SearchToken.Deserialize(serializedSearchToken); \r\n                } \r\n \r\n                List<Element> childElements; \r\n                if (UserSettings.ForeignLocaleCultureInfo == null || UserSettings.ForeignLocaleCultureInfo.Equals(UserSettings.ActiveLocaleCultureInfo)) \r\n                { \r\n                    childElements = ElementFacade.GetChildren(elementHandle, searchToken).ToList(); \r\n                } \r\n                else \r\n                { \r\n                    childElements = ElementFacade.GetForeignChildren(elementHandle, searchToken).ToList(); \r\n                } \r\n \r\n                //int t3 = Environment.TickCount; \r\n \r\n                List<ClientElement> resultList = childElements.ToClientElementList(); \r\n \r\n                int t4 = Environment.TickCount; \r\n \r\n                //LoggingService.LogVerbose(\"RGB(255, 0, 255)TreeServiceFacade\", string.Format(\"ElementHandle: {0} ms\", t2 - t1)); \r\n                //LoggingService.LogVerbose(\"RGB(255, 0, 255)TreeServiceFacade\", string.Format(\"GetChildren: {0} ms\", t3 - t2)); \r\n                //LoggingService.LogVerbose(\"RGB(255, 0, 255)TreeServiceFacade\", string.Format(\"ToClientElementList: {0} ms\", t4 - t3)); \r\n                //LoggingService.LogVerbose(\"RGB(255, 0, 255)TreeServiceFacade\", string.Format(\"Total: {0} ms\", t4 - t1)); \r\n                //LoggingService.LogVerbose(\"RGB(255, 0, 255)TreeServiceFacade\", \"----- End -------------------------------------------------\"); \r\n \r\n                //LoggingService.LogVerbose(\"TreeServiceFacade\", string.Format(\"GetChildren: {0} ms\", t4 - t1)); \r\n \r\n                return resultList; \r\n        } \r\n \r\n \r\n \r\n        /// <exclude /> \r\n        public static List<RefreshChildrenInfo> GetMultipleChildren(List<RefreshChildrenParams> nodesToBeRefreshed) \r\n        { \r\n                int t1 = Environment.TickCount; \r\n \r\n                var result = new List<RefreshChildrenInfo>(); \r\n \r\n                foreach (RefreshChildrenParams node in nodesToBeRefreshed) \r\n                { \r\n                    EntityToken entityToken; \r\n \r\n                    try \r\n                    { \r\n                        entityToken = EntityTokenSerializer.Deserialize(node.EntityToken); \r\n                    } \r\n                    catch (EntityTokenSerializerException) \r\n                    { \r\n                        continue; \r\n                    } \r\n                     \r\n                    var elementHandle = new ElementHandle(node.ProviderName, entityToken, node.Piggybag); \r\n                    SearchToken searchToken = null; \r\n                    if (!string.IsNullOrEmpty(node.SearchToken)) \r\n                    { \r\n                        searchToken = SearchToken.Deserialize(node.SearchToken); \r\n                    } \r\n \r\n                    List<Element> childElements; \r\n                    if (UserSettings.ForeignLocaleCultureInfo == null || UserSettings.ForeignLocaleCultureInfo.Equals(UserSettings.ActiveLocaleCultureInfo)) \r\n                    { \r\n                        childElements = ElementFacade.GetChildren(elementHandle, searchToken).ToList(); \r\n                    } \r\n                    else \r\n                    { \r\n                        childElements = ElementFacade.GetForeignChildren(elementHandle, searchToken).ToList(); \r\n                    } \r\n \r\n                    result.Add(new RefreshChildrenInfo \r\n                      { \r\n                          ElementKey = GetElementKey(node.ProviderName, node.EntityToken, node.Piggybag), \r\n                          ClientElements = childElements.ToClientElementList() \r\n                      }); \r\n                } \r\n \r\n                int t2 = Environment.TickCount; \r\n \r\n                //LoggingService.LogVerbose(\"TreeServiceFacade\", string.Format(\"GetMultipleChildren: {0} ms\", t2 - t1)); \r\n \r\n                return result; \r\n        } \r\n \r\n \r\n \r\n        /// <exclude /> \r\n        public static List<ClientLabeledProperty> GetLabeledProperties(string providerName, string serializedEntityToken, string piggybag) \r\n        { \r\n            var elementEntityToken = EntityTokenSerializer.Deserialize(serializedEntityToken); \r\n            var elementHandle = new ElementHandle(providerName, elementEntityToken, piggybag); \r\n \r\n            bool showForeign = UserSettings.ForeignLocaleCultureInfo != null  \r\n                              && UserSettings.ForeignLocaleCultureInfo.Equals(UserSettings.ActiveLocaleCultureInfo); \r\n \r\n            var labeledProperties = showForeign  \r\n                ? ElementFacade.GetForeignLabeledProperties(elementHandle)  \r\n                : ElementFacade.GetLabeledProperties(elementHandle); \r\n \r\n            return \r\n                (from property in labeledProperties \r\n                 select new ClientLabeledProperty(property)).ToList(); \r\n        } \r\n \r\n \r\n \r\n        /// <exclude /> \r\n        public static void ExecuteElementAction(string providerName, string serializedEntityToken, string piggybag, string serializedActionToken, string consoleId) \r\n        { \r\n            using (DebugLoggingScope.MethodInfoScope) \r\n            { \r\n                EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken); \r\n                if (!entityToken.IsValid()) \r\n                { \r\n                    ShowInvalidEntityMessage(consoleId); \r\n                    return; \r\n                } \r\n \r\n                var elementHandle = new ElementHandle(providerName, entityToken, piggybag); \r\n \r\n                ActionToken actionToken = ActionTokenSerializer.Deserialize(serializedActionToken, true); \r\n                ActionHandle actionHandle = new ActionHandle(actionToken); \r\n \r\n                ActionExecutionMediator.ExecuteElementAction(elementHandle, actionHandle, consoleId); \r\n            } \r\n        } \r\n \r\n \r\n \r\n        /// <exclude /> \r\n        public static bool ExecuteElementDraggedAndDropped(string draggedElementProviderName, string draggedElementSerializedEntityToken, string draggedElementPiggybag, string newParentElementProviderName, string newParentElementSerializedEntityToken, string newParentElementPiggybag, int dropIndex, string consoleId, bool isCopy) \r\n        { \r\n            if (draggedElementProviderName != newParentElementProviderName) \r\n            { \r\n                throw new InvalidOperationException(\"Only drag'n'drop internal in element providers are allowed\"); \r\n            } \r\n \r\n            EntityToken draggedElementEntityToken = EntityTokenSerializer.Deserialize(draggedElementSerializedEntityToken); \r\n            ElementHandle draggedElementHandle = new ElementHandle(draggedElementProviderName, draggedElementEntityToken, draggedElementPiggybag); \r\n \r\n            EntityToken newParentElementEntityToken = EntityTokenSerializer.Deserialize(newParentElementSerializedEntityToken); \r\n            ElementHandle newParentdElementHandle = new ElementHandle(newParentElementProviderName, newParentElementEntityToken, newParentElementPiggybag); \r\n \r\n            return ActionExecutionMediator.ExecuteElementDraggedAndDropped(draggedElementHandle, newParentdElementHandle, dropIndex, consoleId, isCopy);                             \r\n        } \r\n \r\n \r\n        /// <exclude /> \r\n        public static List<RefreshChildrenInfo> FindEntityToken(string serializedAncestorEntityToken, string serializedEntityToken, List<RefreshChildrenParams> openedNodes) \r\n        { \r\n            Verify.ArgumentNotNullOrEmpty(serializedAncestorEntityToken, \"serializedAncestorEntityToken\"); \r\n            Verify.ArgumentNotNullOrEmpty(serializedEntityToken, \"serializedEntityToken\"); \r\n \r\n            EntityToken ancestorEntityToken = EntityTokenSerializer.Deserialize(serializedAncestorEntityToken); \r\n            EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken); \r\n \r\n            return FindEntityToken(ancestorEntityToken, entityToken, openedNodes); \r\n        } \r\n \r\n         \r\n        internal static List<RefreshChildrenInfo> FindEntityToken(EntityToken ancestorEntityToken, EntityToken entityToken, List<RefreshChildrenParams> nodesToRefresh) \r\n        { \r\n            var openedNodes = nodesToRefresh.Select(node => new  \r\n            { \r\n                EntityToken = EntityTokenSerializer.Deserialize(node.EntityToken), \r\n                ElementData = node \r\n            }).ToList(); \r\n \r\n            foreach (List<EntityToken> ancestorChain in GetAncestorChains(ancestorEntityToken, entityToken)) \r\n            { \r\n                if (ancestorChain == null || ancestorChain.Count == 0) \r\n                { \r\n                    continue; \r\n                } \r\n \r\n                List<EntityToken> ancestorEntityTokens = ancestorChain.ToList(); \r\n \r\n                int lastAlreadyOpenedNodeIndex = 0; \r\n                while (lastAlreadyOpenedNodeIndex + 1 < ancestorChain.Count \r\n                       && openedNodes.Any(node => node.EntityToken.Equals(ancestorEntityTokens[lastAlreadyOpenedNodeIndex + 1]))) \r\n                { \r\n                    lastAlreadyOpenedNodeIndex++; \r\n                } \r\n \r\n                var openNode = openedNodes.FirstOrDefault(node => node.EntityToken.Equals(ancestorEntityTokens[lastAlreadyOpenedNodeIndex])); \r\n                if (openNode == null) \r\n                { \r\n                    return null; \r\n                } \r\n \r\n                // Expanding all the nodes under the root \r\n                var nodesToBeExpanded = new List<EntityToken>(); \r\n                nodesToBeExpanded.AddRange(ancestorEntityTokens.Skip(lastAlreadyOpenedNodeIndex)); \r\n                nodesToBeExpanded.RemoveAt(nodesToBeExpanded.Count - 1); \r\n                // Last node is a target one, so doesn't have to be expanded \r\n                nodesToBeExpanded.AddRange(openedNodes.Select(node => node.EntityToken)); \r\n \r\n                var result = new List<RefreshChildrenInfo>(); \r\n                // Expanding all the nodes, and checking if all of the nodes in the ancestor chain is marked  \r\n                // as seen in TreeLockBehaviour \r\n                bool success = \r\n                    ExpandNodesRec(openNode.ElementData.EntityToken, \r\n                               openNode.ElementData.ProviderName, \r\n                               openNode.ElementData.Piggybag, \r\n                               nodesToBeExpanded, \r\n                               result, \r\n                               ancestorEntityTokens); \r\n \r\n                if (success) \r\n                { \r\n                    return result; \r\n                } \r\n            } \r\n            return null; \r\n        } \r\n \r\n        /// <summary> \r\n        /// Expands nodes recurcively. \r\n        /// </summary> \r\n        /// <param name=\"entityToken\"></param> \r\n        /// <param name=\"elementProviderName\"></param> \r\n        /// <param name=\"piggybag\"></param> \r\n        /// <param name=\"entityTokensToBeExpanded\"></param> \r\n        /// <param name=\"resultList\"></param> \r\n        /// <param name=\"keyNodes\"></param> \r\n        /// <returns>Returns false, if there's a key node, that has [element.TreeLockBehavior == None]</returns> \r\n        private static bool ExpandNodesRec(string entityToken, string elementProviderName, string piggybag,  \r\n            List<EntityToken> entityTokensToBeExpanded, List<RefreshChildrenInfo> resultList, List<EntityToken> keyNodes) \r\n        { \r\n            if (resultList.Count > 1000) // Preventing an infinite loop \r\n            { \r\n                return true; \r\n            } \r\n            List<ClientElement> children = GetChildren(elementProviderName, entityToken, piggybag, null); \r\n \r\n            var refreshChildrenInfo = new RefreshChildrenInfo \r\n            { \r\n                ElementKey = GetElementKey(elementProviderName, entityToken, piggybag), \r\n                ClientElements = children \r\n            }; \r\n            resultList.Add(refreshChildrenInfo); \r\n \r\n            foreach (ClientElement child in children) \r\n            { \r\n                var childEntityToken = EntityTokenSerializer.Deserialize(child.EntityToken); \r\n \r\n                if (!child.TreeLockEnabled \r\n                    && keyNodes.Contains(childEntityToken)) \r\n                { \r\n                    return false; \r\n                } \r\n \r\n                if (entityTokensToBeExpanded.Contains(childEntityToken)) \r\n                { \r\n                    if (ExpandNodesRec(child.EntityToken,  \r\n                                       child.ProviderName,  \r\n                                       child.Piggybag,  \r\n                                       entityTokensToBeExpanded, \r\n                                       resultList,  \r\n                                       keyNodes)) \r\n                    { \r\n                        return true; \r\n                    } \r\n                } \r\n                else \r\n                { \r\n                    if (keyNodes.Contains(childEntityToken)) \r\n                    { \r\n                        return true; \r\n                    } \r\n                } \r\n            } \r\n \r\n            return false; \r\n        } \r\n \r\n \r\n \r\n        // TODO: Move logic to another place \r\n        private static string GetElementKey(string providerName, string entityToken, string piggybag) \r\n        { \r\n            return providerName + entityToken + piggybag; \r\n        } \r\n \r\n \r\n \r\n        private static IEnumerable<List<EntityToken>> GetAncestorChains(EntityToken ancestorEnitityToken, EntityToken entityToken) \r\n        { \r\n            foreach (List<EntityToken> ancestorChain in GetAncestorChains(entityToken, 20)) \r\n            { \r\n                if (ancestorChain.Count > 1) \r\n                { \r\n                    int index = ancestorChain.IndexOf(ancestorEnitityToken); \r\n                    if(index < 0) continue; \r\n \r\n                    yield return (index == 0) ? ancestorChain : ancestorChain.GetRange(index, ancestorChain.Count - index); \r\n                } \r\n            } \r\n        } \r\n \r\n \r\n \r\n        private static IEnumerable<List<EntityToken>> GetAncestorChains(EntityToken descendant, int deep, List<EntityToken> visitedParents = null) \r\n        { \r\n            if (deep == 0) \r\n            { \r\n                yield return new List<EntityToken>(); \r\n                yield break; \r\n            } \r\n \r\n            if (visitedParents == null) \r\n            { \r\n                visitedParents = new List<EntityToken>(); \r\n            } \r\n            visitedParents.Add(descendant); \r\n \r\n            List<EntityToken> parents = ParentsFacade.GetAllParents(descendant); \r\n            if (parents.Count == 0) \r\n            { \r\n                var newChain = new List<EntityToken> {descendant}; \r\n                yield return newChain; \r\n                yield break; \r\n            } \r\n \r\n            // NOTE: A workaround which gives \"AllFunctionElementProvider\" search results less priority that other function element providers \r\n            if (parents.Count == 2 && parents[0].Id != null && parents[0].Id.StartsWith(\"ROOT:AllFunctionsElementProvider\")) \r\n            { \r\n                parents.Reverse(); \r\n            } \r\n \r\n            foreach (var parent in parents) \r\n            {                 \r\n                foreach (List<EntityToken> chain in GetAncestorChains(parent, deep - 1, visitedParents)) \r\n                { \r\n                    chain.Add(descendant); \r\n                    yield return chain; \r\n                } \r\n            } \r\n        } \r\n \r\n \r\n \r\n        private static void ShowInvalidEntityMessage(string consoleId) \r\n        { \r\n            // TODO: Add tree refreshing, localize message \r\n            var msgBoxEntry = new MessageBoxMessageQueueItem { DialogType = DialogType.Error, Title = \"Data item not found\", Message = \"This item seems to have been deleted.\\n\\nPlease update the tree by using the context menu \\\"Refresh\\\" command.\" }; \r\n            ConsoleMessageQueueFacade.Enqueue(msgBoxEntry, consoleId); \r\n        } \r\n    } \r\n} \r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowMediators/ViewTransitionHelper.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing System.Web;\r\nusing Composite.C1Console.Elements;\r\n\r\nnamespace Composite.Core.WebClient.FlowMediators\r\n{\r\n    internal static class ViewTransitionHelper\r\n    {\r\n        internal static string MakeViewId(string serializedFlowHandle)\r\n        {\r\n            return \"view\" + serializedFlowHandle.GetHashCode();\r\n        }\r\n\r\n        internal static void HandleRerender(string consoleId, string elementProviderName, FlowToken flowToken, FlowUiDefinitionBase oldUiDefinition, FlowUiDefinitionBase newUiDefinition, FlowControllerServicesContainer servicesContainer)\r\n        {\r\n            if (newUiDefinition.UiContainerType.ActionResultResponseType != oldUiDefinition.UiContainerType.ActionResultResponseType)\r\n            {\r\n                var messageService = servicesContainer.GetService<IManagementConsoleMessageService>();\r\n                messageService.CloseCurrentView();\r\n                HandleNew(consoleId, elementProviderName, string.Empty, flowToken, newUiDefinition);\r\n            }\r\n            else\r\n            {\r\n                // Force update in same container\r\n                HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery, false);\r\n            }\r\n        }\r\n\r\n\r\n        internal static void HandleNew(string consoleId, string elementProviderName, string serializedEntityToken, FlowToken flowToken, FlowUiDefinitionBase uiDefinition)\r\n        {\r\n            ActionResultResponseType actionViewType = uiDefinition.UiContainerType.ActionResultResponseType;\r\n\r\n            if (actionViewType != ActionResultResponseType.None)\r\n            {\r\n                FlowHandle flowHandle = new FlowHandle(flowToken);\r\n                string serializedFlowHandle = flowHandle.Serialize();\r\n                string viewId = MakeViewId(serializedFlowHandle);\r\n\r\n                ViewType viewType;\r\n                switch (actionViewType)\r\n                {\r\n                    case ActionResultResponseType.OpenDocument:\r\n                        viewType = ViewType.Main;\r\n                        break;\r\n                    case ActionResultResponseType.OpenModalDialog:\r\n                        viewType = ViewType.ModalDialog;\r\n                        break;\r\n                    default:\r\n                        throw new Exception(\"unknown action response type\");\r\n                }\r\n\r\n                string url = string.Format(\"{0}?consoleId={1}&flowHandle={2}&elementProvider={3}\",\r\n                    UrlUtils.ResolveAdminUrl(\"content/flow/FlowUi.aspx\"),\r\n                    consoleId,\r\n                    HttpUtility.UrlEncode(serializedFlowHandle),\r\n                    HttpUtility.UrlEncode(elementProviderName));\r\n\r\n                OpenViewMessageQueueItem openView = new OpenViewMessageQueueItem\r\n                {\r\n                    ViewType = viewType,\r\n                    EntityToken = serializedEntityToken,\r\n                    FlowHandle = flowHandle.Serialize(),\r\n                    Url = url,\r\n                    ViewId = viewId\r\n                };\r\n\r\n                if (uiDefinition is VisualFlowUiDefinitionBase)\r\n                {\r\n                    VisualFlowUiDefinitionBase visualUiDefinition = (VisualFlowUiDefinitionBase)uiDefinition;\r\n                    if (string.IsNullOrEmpty(visualUiDefinition.ContainerLabel) == false) openView.Label = visualUiDefinition.ContainerLabel;\r\n                }\r\n\r\n                ConsoleMessageQueueFacade.Enqueue(openView, consoleId);\r\n            }\r\n        }\r\n\r\n        internal static void HandleCloseCurrentView(IFlowUiContainerType uiContainerType)\r\n        {\r\n            string redirectUrl;\r\n            switch (uiContainerType.ContainerName)\r\n            {\r\n\r\n                case \"Document\":\r\n                    redirectUrl = UrlUtils.ResolveAdminUrl(\"content/flow/FlowUiCompleted.aspx\");\r\n                    break;\r\n                case \"Wizard\":\r\n                case \"DataDialog\":\r\n                case \"ConfirmDialog\":\r\n                    redirectUrl = UrlUtils.ResolveAdminUrl(\"content/flow/FlowUiCompletedDialog.aspx\");\r\n                    break;\r\n                default:\r\n                    throw new NotImplementedException(\"Unknown container \" + uiContainerType.ContainerName);\r\n            }\r\n\r\n            HttpContext.Current.Response.Redirect(redirectUrl, false);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowMediators/WebFlowUiMediator.cs",
    "content": "using System;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing System.Linq;\r\nusing System.Web.UI.HtmlControls;\r\n\r\nnamespace Composite.Core.WebClient.FlowMediators\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class WebFlowUiMediator\r\n    {\r\n        /// <exclude />\r\n        public static Control GetFlowUi(FlowHandle flowHandle, string elementProviderName, string consoleId, out string uiContainerName)\r\n        {\r\n            uiContainerName = null;\r\n\r\n            try\r\n            {\r\n                Control webControl = null;\r\n                string viewId = ViewTransitionHelper.MakeViewId(flowHandle.Serialize());\r\n\r\n                var flowServicesContainer = new FlowControllerServicesContainer(\r\n                    new ActionExecutionService(elementProviderName, consoleId),\r\n                    new ManagementConsoleMessageService(consoleId, viewId),\r\n                    new ElementDataExchangeService(elementProviderName)\r\n                );\r\n\r\n                FlowToken flowToken = flowHandle.FlowToken;\r\n                IFlowUiDefinition flowUiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, flowServicesContainer);\r\n\r\n                if (flowUiDefinition is FormFlowUiDefinition formFlowUiDefinition)\r\n                {\r\n                    uiContainerName = formFlowUiDefinition.UiContainerType.ContainerName;\r\n\r\n                    IUiControl uiForm = FormFlowUiDefinitionRenderer.Render(consoleId, elementProviderName, flowToken, formFlowUiDefinition, WebManagementChannel.Identifier, false, flowServicesContainer);\r\n                    IWebUiControl webForm = (IWebUiControl)uiForm;\r\n                    webControl = webForm.BuildWebControl();\r\n\r\n                    if (string.IsNullOrEmpty(webControl.ID)) webControl.ID = \"FlowUI\";\r\n\r\n                    if (RuntimeInformation.TestAutomationEnabled\r\n                        && formFlowUiDefinition.MarkupProvider is ITestAutomationLocatorInformation testAutomationLocatorInformation)\r\n                    {\r\n                        var htmlform = webControl.Controls.OfType<HtmlForm>().FirstOrDefault();\r\n\r\n                        htmlform?.Attributes.Add(\"data-qa\", testAutomationLocatorInformation.TestAutomationLocator);\r\n                    }\r\n                }\r\n\r\n                return webControl;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                ErrorServices.DocumentAdministrativeError(ex);\r\n                ErrorServices.RedirectUserToErrorPage(uiContainerName, ex);\r\n            }\r\n\r\n            return new LiteralControl(\"ERROR\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FlowPage.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\r\n    public class FlowPage: Page\r\n    {\r\n        /// <exclude />\r\n        public bool SaveStepSucceeded { get; set; }\r\n\r\n        /// <exclude />\r\n        public EventHandler OnSave { get; set; }\r\n\r\n        /// <exclude />\r\n        public EventHandler OnSaveAndPublish { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FunctionBoxRouteHandler.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Drawing;\r\nusing System.Drawing.Imaging;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Web;\r\nusing System.Web.Routing;\r\nusing Composite.C1Console.Drawing;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient.Renderings;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    internal class FunctionBoxRoute : Route\r\n    {\r\n        // Adding \"x\" as a fictional paramter, so MVC wouldn't use this route for producing outbound links\r\n        public FunctionBoxRoute() : base(\"Renderers/FunctionBo{x}\", new FunctionBoxRouteHandler()) { }\r\n    }\r\n\r\n    \r\n    internal class FunctionBoxRouteHandler : IRouteHandler\r\n    {\r\n        public IHttpHandler GetHttpHandler(RequestContext requestContext)\r\n        {\r\n            return new FunctionBoxHttpHandler();\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Renders image that shows information about a function information in Visual Editor\r\n    /// </summary>\r\n    internal class FunctionBoxHttpHandler : HttpTaskAsyncHandler\r\n    {\r\n        private const int MinCharsPerDescriptionLine = 55;\r\n        private static readonly string LogTitle = nameof(FunctionBoxHttpHandler);\r\n\r\n        public override async Task ProcessRequestAsync(HttpContext context)\r\n        {\r\n            if (!UserValidationFacade.IsLoggedIn())\r\n            {\r\n                context.Response.ContentType = MimeTypeInfo.Text;\r\n                context.Response.Write(\"No user logged in\");\r\n                context.Response.StatusCode = 401;\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                string title = context.Request[\"title\"];\r\n                bool editable = context.Request[\"editable\"] == \"true\";\r\n\r\n                Verify.That(!title.IsNullOrEmpty(), \"Missing query string argument 'title'\");\r\n\r\n                string boxtype = context.Request[\"type\"];\r\n                Verify.That(!boxtype.IsNullOrEmpty(), \"Missing query string argument 'boxtype'\");\r\n\r\n                IEnumerable<string> existingTemplateImages = new[] { \"html\", \"function\", \"warning\" };\r\n                Verify.That(existingTemplateImages.Contains(boxtype),\r\n                    \"Query string argument 'boxtype' expected to be one of the following values: \" + string.Join(\", \", existingTemplateImages));\r\n\r\n                string description = context.Request[\"description\"];\r\n                string encodedMarkup = context.Request[\"markup\"];\r\n\r\n                string language = context.Request[\"lang\"];\r\n\r\n                if (!string.IsNullOrEmpty(language))\r\n                {\r\n                    Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(language);\r\n                }\r\n\r\n                List<string> textLines = null;\r\n                if (description != null)\r\n                {\r\n                    textLines = GetDescriptionLines(description);\r\n                }\r\n\r\n\r\n                Bitmap previewImage = null;\r\n\r\n                try\r\n                {\r\n                    if (GlobalSettingsFacade.FunctionPreviewEnabled && encodedMarkup != null)\r\n                    {\r\n                        try\r\n                        {\r\n                            string fileName = await FunctionPreview.GetPreviewFunctionPreviewImageFile(context);\r\n\r\n                            if (!context.Response.IsClientConnected)\r\n                            {\r\n                                return;\r\n                            }\r\n\r\n                            if (fileName != null)\r\n                            {\r\n                                previewImage = new Bitmap(fileName);\r\n\r\n                                if (previewImage.Width <= 1 && previewImage.Height <= 1)\r\n                                {\r\n                                    previewImage = null;\r\n                                }\r\n                            }\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            Log.LogError(\"Function preview\", ex);\r\n                        }\r\n                    }\r\n\r\n                    if (boxtype == \"function\")\r\n                    {\r\n                        if (previewImage != null)\r\n                        {\r\n                            FunctionPresentation.GenerateFunctionBoxWithPreview(context, title, previewImage, editable, context.Response.OutputStream);\r\n                        }\r\n                        else\r\n                        {\r\n                            FunctionPresentation.GenerateFunctionBoxWithText(context, title, false, editable, textLines, context.Response.OutputStream);\r\n                        }\r\n                    }\r\n                    else if (boxtype == \"warning\")\r\n                    {\r\n                        FunctionPresentation.GenerateFunctionBoxWithText(context, title, true, editable, textLines, context.Response.OutputStream);\r\n                    }\r\n                    else \r\n                    {\r\n                        GenerateBoxImage(context, boxtype, title, previewImage, textLines);\r\n                    }\r\n                    \r\n                }\r\n                finally\r\n                {\r\n                    previewImage?.Dispose();\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                if (ex is HttpException && !context.Response.IsClientConnected)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                Log.LogError(LogTitle, ex);\r\n\r\n                if (context.Response.IsClientConnected)\r\n                {\r\n                    try\r\n                    {\r\n                        context.Response.Redirect(UrlUtils.AdminRootPath + \"/images/function.png\", false);\r\n                    }\r\n                    catch (Exception redirectError)\r\n                    {\r\n                        Log.LogError(LogTitle, redirectError);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n \r\n\r\n        private static void GenerateBoxImage(HttpContext context, string boxtype, string title, Bitmap previewImage,\r\n            List<string> textLines)\r\n        {\r\n            string filePath = context.Server.MapPath(UrlUtils.ResolveAdminUrl($\"images/{boxtype}box.png\"));\r\n            using (var bitmap = (Bitmap) Bitmap.FromFile(filePath))\r\n            {\r\n                var imageCreator = new ImageTemplatedBoxCreator(bitmap, new Point(55, 40), new Point(176, 78))\r\n                {\r\n                    MinHeight = 50\r\n                };\r\n\r\n\r\n                int textLeftPadding = (boxtype == \"function\" ? 30 : 36);\r\n\r\n                imageCreator.SetTitle(title, new Size(textLeftPadding, 9), new Size(70, 15), Color.Black,\r\n                    \"Tahoma\", 8.0f, FontStyle.Bold);\r\n\r\n                if (previewImage != null)\r\n                {\r\n                    imageCreator.SetPreviewImage(previewImage, new Size(10, 32), new Size(10, 16));\r\n                }\r\n                else\r\n                {\r\n                    if (textLines != null)\r\n                    {\r\n                        imageCreator.SetTextLines(textLines, new Size(textLeftPadding, 0), new Size(100, 80),\r\n                            Color.Black, \"Tahoma\", 8.0f, FontStyle.Regular);\r\n                    }\r\n                }\r\n\r\n                context.Response.ContentType = \"image/png\";\r\n                context.Response.Cache.SetExpires(DateTime.Now.AddDays(10));\r\n\r\n                using (Bitmap boxBitmap = imageCreator.CreateBitmap())\r\n                {\r\n                    boxBitmap.Save(context.Response.OutputStream, ImageFormat.Png);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static List<string> GetDescriptionLines(string description)\r\n        {\r\n            var lines = new List<string>();\r\n\r\n            if (!description.IsNullOrEmpty())\r\n            {\r\n                description = UrlUtils.UnZipContent(description);\r\n\r\n                foreach (string naturalLine in description.Split('\\n'))\r\n                {\r\n                    if (naturalLine.Length == 0) lines.Add(\"\");\r\n\r\n                    string rest = naturalLine.Trim();\r\n\r\n                    while (rest.Length > MinCharsPerDescriptionLine && rest.IndexOf(' ') > -1)\r\n                    {\r\n                        int firstSpaceIndex = rest.LastIndexOf(' ', MinCharsPerDescriptionLine);\r\n\r\n                        if (firstSpaceIndex == -1) firstSpaceIndex = rest.IndexOf(' ');\r\n\r\n                        if (firstSpaceIndex > -1)\r\n                        {\r\n                            lines.Add(rest.Substring(0, firstSpaceIndex));\r\n                            rest = rest.Substring(firstSpaceIndex + 1).Trim();\r\n                        }\r\n                    }\r\n\r\n                    if (rest.Length > 0)\r\n                    {\r\n                        lines.Add(rest);\r\n                    }\r\n                }\r\n            }\r\n            return lines;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool IsReusable => true;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FunctionCallEditor/FunctionCallEditorStateSimple.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Serialization;\r\nusing Composite.Functions;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Core.WebClient.FunctionCallEditor\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class FunctionCallEditorStateSimple : IFunctionCallEditorState\r\n    {\r\n        /// <exclude />\r\n        public string FunctionCallsXml { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool ShowLocalFunctionNames { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool AllowLocalFunctionNameEditing { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool AllowSelectingInputParameters { get; set; }\r\n\r\n        /// <exclude />\r\n        public string AllowedTypes { get; set; }\r\n\r\n        [XmlIgnore]\r\n        List<NamedFunctionCall> IFunctionCallEditorState.FunctionCalls\r\n        {\r\n            get\r\n            {\r\n                var functionList = new List<NamedFunctionCall>();\r\n\r\n                if (FunctionCallsXml != null)\r\n                {\r\n                    XElement root = XElement.Parse(FunctionCallsXml);\r\n\r\n                    foreach (XElement functionElement in root.Elements())\r\n                    {\r\n                        string localname;\r\n                        XAttribute localNameAttr = functionElement.Attribute(\"localname\");\r\n                        localname = localNameAttr != null ? localNameAttr.Value : string.Empty;\r\n\r\n                        var functionDefinition = (BaseFunctionRuntimeTreeNode) FunctionTreeBuilder.Build(functionElement, true);\r\n\r\n                        functionList.Add(new NamedFunctionCall(localname, functionDefinition));\r\n                    }\r\n                }\r\n                return functionList;\r\n            }\r\n            set\r\n            {\r\n                List<NamedFunctionCall> functionCalls = value;\r\n\r\n                Verify.IsNotNull(functionCalls, \"Failed to get function calls\");\r\n\r\n                XElement functionsNode = new XElement(\"functions\");\r\n\r\n                foreach (var localNamedFunctionCall in functionCalls)\r\n                {\r\n                    Guid handle = Guid.NewGuid();\r\n\r\n                    BaseFunctionRuntimeTreeNode functionRuntime = localNamedFunctionCall.FunctionCall;\r\n\r\n                    XElement function = functionRuntime.Serialize();\r\n                    function.Add(new XAttribute(\"localname\", localNamedFunctionCall.Name));\r\n                    function.Add(new XAttribute(\"handle\", handle));\r\n\r\n                    functionsNode.Add(function);\r\n                }\r\n\r\n                FunctionCallsXml = functionsNode.ToString();\r\n            }\r\n        }\r\n\r\n        [XmlIgnore]\r\n        List<Functions.ManagedParameters.ManagedParameterDefinition> IParameterEditorState.Parameters\r\n        {\r\n            get\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n            set\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        [XmlIgnore]\r\n        public List<Type> ParameterTypeOptions\r\n        {\r\n            get\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n            set\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        [XmlIgnore]\r\n        public Type[] AllowedResultTypes\r\n        {\r\n            get\r\n            {\r\n                var result = new List<Type>();\r\n                if (AllowedTypes != null)\r\n                {\r\n                    foreach (string typeName in AllowedTypes.Split(new [] {';'}, StringSplitOptions.RemoveEmptyEntries))\r\n                    {\r\n                        result.Add(TypeManager.GetType(typeName));\r\n                    }\r\n                }\r\n                return result.ToArray();\r\n            }\r\n            set\r\n            {\r\n                AllowedTypes = value == null ? null : string.Join(\";\", from t in value select TypeManager.SerializeType(t));\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool WidgetFunctionSelection\r\n        {\r\n            get; set;\r\n        }\r\n\r\n        bool IFunctionCallEditorState.ShowLocalFunctionNames\r\n        {\r\n            get { return ShowLocalFunctionNames; }\r\n        }\r\n\r\n        bool IFunctionCallEditorState.AllowLocalFunctionNameEditing\r\n        {\r\n            get { return AllowLocalFunctionNameEditing; }\r\n        }\r\n\r\n        bool IFunctionCallEditorState.AllowSelectingInputParameters\r\n        {\r\n            get { return AllowSelectingInputParameters; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public int MaxFunctionAllowed\r\n        {\r\n            get; set; \r\n        }\r\n\r\n        int IFunctionCallEditorState.MaxFunctionAllowed\r\n        {\r\n            get { return MaxFunctionAllowed; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ConsoleId\r\n        {\r\n            get; set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FunctionCallEditor/FunctionMarkupHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Core.WebClient.FunctionCallEditor\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class FunctionMarkupHelper\r\n    {\r\n        private static readonly string LogTitle = typeof (FunctionMarkupHelper).Name;\r\n        private static readonly XName ParameterNodeXName = Namespaces.Function10 + \"param\";\r\n        private static readonly XName ParameterValueElementXName = Namespaces.Function10 + \"paramelement\";\r\n        \r\n\r\n        /// <summary>\r\n        /// Gets simple parameter value from it's markup.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static object GetParameterValue(XElement parameterNode, ParameterProfile parameterProfile)\r\n        {\r\n            List<XElement> parameterElements = parameterNode.Elements(ParameterValueElementXName).ToList();\r\n            if (parameterElements.Any())\r\n            {\r\n                return parameterElements.Select(element => element.Attribute(\"value\").Value).ToList();\r\n            }\r\n\r\n            var valueAttr = parameterNode.Attribute(\"value\");\r\n            if (valueAttr != null)\r\n            {\r\n                try\r\n                {\r\n                    return XmlSerializationHelper.Deserialize(valueAttr, parameterProfile.Type);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, ex);\r\n\r\n                    return parameterProfile.GetDefaultValue();\r\n                }\r\n            }\r\n\r\n            if (parameterNode.Elements().Any())\r\n            {\r\n                Type paramType = parameterProfile.Type;\r\n\r\n                if (paramType.IsSubclassOf(typeof(XContainer))\r\n                    || (paramType.IsLazyGenericType()\r\n                        && paramType.GetGenericArguments()[0].IsSubclassOf(typeof(XContainer))))\r\n                {\r\n                    return ValueTypeConverter.Convert(parameterNode.Elements().First(), parameterProfile.Type);\r\n                }\r\n\r\n                throw new NotImplementedException(\"Not supported type of function parameter element node: '{0}'\".FormatWith(paramType.FullName));\r\n            }\r\n\r\n            return parameterProfile.GetDefaultValue();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void SetParameterValue(XElement functionMarkup, ParameterProfile parameter, object parameterValue)\r\n        {\r\n            bool newValueNotEmpty = parameterValue != null\r\n\t                                && (!(parameterValue is IList) || ((IList) parameterValue).Count > 0)\r\n\t                                && !(parameter.IsRequired && parameterValue as string == string.Empty);\r\n\r\n            var parameterNode = functionMarkup.Elements(ParameterNodeXName).FirstOrDefault(p => (string)p.Attribute(\"name\") == parameter.Name);\r\n\r\n\t        if (parameterNode != null)\r\n\t        {\r\n                parameterNode.Remove();\r\n\t        }\r\n\r\n\t        if (newValueNotEmpty && parameterValue != parameter.GetDefaultValue())\r\n\t        {\r\n\t            var newConstantParam = new ConstantObjectParameterRuntimeTreeNode(parameter.Name, parameterValue);\r\n\r\n\t            functionMarkup.Add(newConstantParam.Serialize());\r\n\t        }\r\n        }\r\n\r\n        \r\n        /// <exclude />\r\n        public static IDictionary<string, XElement> GetParameterNodes(XElement functionMarkup)\r\n        {\r\n            return functionMarkup.Elements(ParameterNodeXName).ToDictionary(e => (string)e.Attribute(\"name\"));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FunctionCallEditor/IFunctionCallEditorState.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Serialization;\r\nusing Composite.Functions;\r\nusing Composite.Functions.ManagedParameters;\r\n\r\nnamespace Composite.Core.WebClient.FunctionCallEditor\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IParameterEditorState\r\n    {\r\n        /// <exclude />\r\n        [XmlIgnore]\r\n        List<ManagedParameterDefinition> Parameters { get; set; }\r\n\r\n        /// <exclude />\r\n        [XmlIgnore]\r\n        List<Type> ParameterTypeOptions { get; set; }\r\n    }\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFunctionCallEditorState : IParameterEditorState\r\n    {\r\n        /// <exclude />\r\n        [XmlIgnore]\r\n        List<NamedFunctionCall> FunctionCalls { get; set; }\r\n\r\n        /// <exclude />\r\n        bool ShowLocalFunctionNames { get; } // Check if this setting is used\r\n\r\n        /// <exclude />\r\n        bool WidgetFunctionSelection { get; }\r\n\r\n        /// <exclude />\r\n        bool AllowLocalFunctionNameEditing { get; }\r\n\r\n        /// <exclude />\r\n        bool AllowSelectingInputParameters { get; }\r\n\r\n        /// <exclude />\r\n        Type[] AllowedResultTypes { get; }\r\n\r\n        /// <exclude />\r\n        int MaxFunctionAllowed { get; }\r\n\r\n        /// <exclude />\r\n        string ConsoleId { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FunctionCallEditor/TreeHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Core.WebClient.FunctionCallEditor\r\n{\r\n    /// <summary>\r\n    /// Contains helper methods to work with serialized function calls tree\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]  \r\n    public static class TreeHelper\r\n    {\r\n        /// <exclude />\r\n        public static readonly string PathSeparator = \"/\";\r\n\r\n\r\n        private static readonly XName ParameterNodeName = Namespaces.Function10 + \"param\";\r\n        private static readonly XName FunctionNodeName = Namespaces.Function10 + \"function\";\r\n        private static readonly XName WidgetFunctionNodeName = Namespaces.Function10 + \"widgetfunction\";\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetRootFunctionPath(int functionIndex)\r\n        {\r\n            return string.Format(\"/function[{0}]\", functionIndex);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetParameterPath(string parentFunctionPath, string parameterName)\r\n        {\r\n            return string.Format(\"{0}/@{1}\", parentFunctionPath, parameterName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetFunctionCallPath(string parameterNodePath)\r\n        {\r\n            return string.Format(\"{0}/function\", parameterNodePath);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<XElement, string> GetElementToPathMap(XDocument functionMarkup)\r\n        {\r\n            return GetElementToPathMap(functionMarkup.Root);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<XElement, string> GetElementToPathMap(XElement root)\r\n        {\r\n            var functionToPathMap = new Dictionary<XElement, string>();\r\n\r\n            // Creating node->path dictionary\r\n            int functionCounter = 0;\r\n            foreach (XElement rootFunctionElement in root.Elements().GetFunctionsAndWidgetFunctions())\r\n            {\r\n                functionCounter++;\r\n\r\n                functionToPathMap.Add(rootFunctionElement, GetRootFunctionPath(functionCounter));\r\n\r\n                foreach (XElement element in rootFunctionElement.Descendants().Where(f=>f.Name == ParameterNodeName || f.Name == FunctionNodeName))\r\n                {\r\n                    string parentPathId;\r\n                    if (functionToPathMap.TryGetValue(element.Parent, out parentPathId))\r\n                    {\r\n                        if (element.Name == ParameterNodeName)\r\n                        {\r\n                            functionToPathMap.Add(element, GetParameterPath(parentPathId, element.Attribute(\"name\").Value));\r\n                        }\r\n                        else if (element.Name == FunctionNodeName)\r\n                        {\r\n                            functionToPathMap.Add(element, GetFunctionCallPath(parentPathId));\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return functionToPathMap;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<XElement, string> GetElementToIdMap(XDocument functionMarkup, Dictionary<string, string> pathToIDmap)\r\n        {\r\n            Dictionary<XElement, string> functionToPathMap = GetElementToPathMap(functionMarkup);\r\n\r\n            var result = new Dictionary<XElement, string>();\r\n\r\n            foreach (XElement element in functionToPathMap.Keys)\r\n            {\r\n                string elementPath = functionToPathMap[element];\r\n                if (pathToIDmap.ContainsKey(elementPath))\r\n                {\r\n                    result.Add(element, pathToIDmap[elementPath]);\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException(\"Function tree xml has already been changed\");\r\n                    // TODO: should this ever happen?\r\n                    //result.Add(element, GetNewId());\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<string, string> BuildTreePathToIdDictionary(XDocument functionMarkup)\r\n        {\r\n            // Populating path->id dictionary\r\n            var treePathToIdMapping = new Dictionary<string, string>();\r\n\r\n            var elementToPathMap = GetElementToPathMap(functionMarkup);\r\n\r\n            elementToPathMap.Values.ToList().ForEach(\r\n                value => treePathToIdMapping.Add(value, GetNewId())\r\n            );\r\n\r\n            List<XElement> functionNodes = functionMarkup\r\n                .Descendants()\r\n                .Where(node => (node.Name == FunctionNodeName || node.Name == WidgetFunctionNodeName) && !node.Ancestors().Where(f=>f.Parent!=null).Any(g=>g.Name.Namespace != Namespaces.Function10))\r\n                .ToList();\r\n            foreach (XElement functionNode in functionNodes)\r\n            {\r\n                foreach (string parameterName in GetUndefinedParameterNames(functionNode))\r\n                {\r\n                    string functionPath = elementToPathMap[functionNode];\r\n\r\n                    treePathToIdMapping.Add(GetParameterPath(functionPath, parameterName), GetNewId());\r\n                }\r\n            }\r\n\r\n            return treePathToIdMapping;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement GetParameterNode(XElement functionNode, string parameterName)\r\n        {\r\n            return (from parameter in functionNode.Elements()\r\n                    let nameAttribute = parameter.Attribute(\"name\")\r\n                    where nameAttribute != null && nameAttribute.Value == parameterName\r\n                    select parameter).FirstOrDefault();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetNewId()\r\n        {\r\n            return Guid.NewGuid().ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement FindByPath(XElement root, string path)\r\n        {\r\n            int functionCounter = 0;\r\n            foreach (XElement rootFunctionElement in root.Elements().GetFunctionsAndWidgetFunctions())\r\n            {\r\n                functionCounter++;\r\n                string rootFunctionPath = GetRootFunctionPath(functionCounter);\r\n\r\n                if (path == rootFunctionPath)\r\n                {\r\n                    return rootFunctionElement;\r\n                }\r\n\r\n                if (!path.StartsWith(rootFunctionPath + PathSeparator))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                foreach (XElement element in rootFunctionElement.Elements())\r\n                {\r\n                    XElement result = FindByPathRec(element, rootFunctionPath, path);\r\n                    if (result != null) return result;\r\n                }\r\n\r\n                break;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        internal static XElement FindByPathRec(XElement element, string parentPath, string pathToFind)\r\n        {\r\n            string path;\r\n\r\n            if (element.Name == ParameterNodeName)\r\n            {\r\n                path = GetParameterPath(parentPath, element.Attribute(\"name\").Value);\r\n            }\r\n            else if (element.Name == FunctionNodeName)\r\n            {\r\n                path = GetFunctionCallPath(parentPath);\r\n            }\r\n            else return null;\r\n\r\n            if (pathToFind == path)\r\n            {\r\n                return element;\r\n            }\r\n\r\n            if (pathToFind.StartsWith(path + PathSeparator))\r\n            {\r\n                foreach (XElement child in element.Elements())\r\n                {\r\n                    XElement result = FindByPathRec(child, path, pathToFind);\r\n                    if (result != null) return result;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string[] GetUndefinedParameterNames(XElement functionXElement)\r\n        {\r\n            var result = new List<string>();\r\n            // Can be optimized\r\n            foreach (string paramName in GetParameterNames(functionXElement))\r\n            {\r\n                if (!FunctionHasParameterDefined(functionXElement, paramName))\r\n                {\r\n                    result.Add(paramName);\r\n                }\r\n            }\r\n            return result.ToArray();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string[] GetParameterNames(XElement functionXElement)\r\n        {\r\n            if (functionXElement.Name != FunctionNodeName && functionXElement.Name != WidgetFunctionNodeName)\r\n            {\r\n                return new string[0];\r\n            }\r\n\r\n            string functionName = functionXElement.Attribute(\"name\").Value;\r\n            IMetaFunction function = (functionXElement.Name == FunctionNodeName) \r\n                ? (IMetaFunction)FunctionFacade.GetFunction(functionName)    \r\n                : FunctionFacade.GetWidgetFunction(functionName);\r\n\r\n            return function.ParameterProfiles.Select(parameter => parameter.Name).ToArray();\r\n        }\r\n\r\n\r\n\r\n        private static bool FunctionHasParameterDefined(XElement functionXElement, string parameterName)\r\n        {\r\n            return functionXElement.Elements(ParameterNodeName).Any(node => node.Attribute(\"name\").Value == parameterName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IMetaFunction GetFunction(XElement functionNode)\r\n        {\r\n            string functionName = functionNode.Attribute(\"name\").Value;\r\n\r\n            if(functionNode.Name == WidgetFunctionNodeName)\r\n            {\r\n                return FunctionFacade.GetWidgetFunction(functionName);\r\n            }\r\n\r\n            return FunctionFacade.GetFunction(functionName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<XElement> GetFunctionsAndWidgetFunctions(this IEnumerable<XElement> elements)\r\n        {\r\n            return elements.Where(element => element.Name ==  FunctionNodeName || element.Name == WidgetFunctionNodeName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/FunctionUiHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class FunctionUiHelper\r\n\t{\r\n        /// <exclude />\r\n        public static FormTreeCompiler AttachAndCompileParameterWidgets(Control attachmentControl, IEnumerable<ParameterProfile> parameterProfiles, Dictionary<string, object> bindings, string uniqueName, string panelLabel, IFormChannelIdentifier channelIdentifier, bool reset)\r\n        {\r\n            FormTreeCompiler compiler = FunctionUiHelper.BuildWidgetForParameters(parameterProfiles, bindings, uniqueName, panelLabel, channelIdentifier);\r\n            IWebUiControl webUiControl = (IWebUiControl)compiler.UiControl;\r\n            Control form = webUiControl.BuildWebControl();\r\n            attachmentControl.Controls.Add(form);\r\n\r\n            if (reset)\r\n            {\r\n                webUiControl.InitializeViewState();\r\n            }\r\n\r\n            return compiler;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static FormTreeCompiler BuildWidgetForParameters(IEnumerable<ParameterProfile> parameterProfiles, Dictionary<string, object> bindings, string uniqueName, string panelLabel, IFormChannelIdentifier channelIdentifier)\r\n        {\r\n            XNamespace stdControlLibSpace = Namespaces.BindingFormsStdUiControls10;\r\n\r\n            var bindingsDeclaration = new XElement(Namespaces.BindingForms10 + \"bindings\");\r\n            var widgetPlaceholder = new XElement(stdControlLibSpace + \"FieldGroup\", new XAttribute(\"Label\", panelLabel));\r\n\r\n            var bindingsValidationRules = new Dictionary<string, List<ClientValidationRule>>();\r\n\r\n            foreach (ParameterProfile parameterProfile in parameterProfiles.Where(f=>f.WidgetFunction!=null))\r\n            {\r\n                IWidgetFunction widgetFunction = parameterProfile.WidgetFunction;\r\n\r\n                Type bindingType = widgetFunction != null && parameterProfile.Type.IsLazyGenericType() ? \r\n                                    widgetFunction.ReturnType : parameterProfile.Type;\r\n\r\n                bindingsDeclaration.Add(\r\n                    new XElement(Namespaces.BindingForms10 + \"binding\",\r\n                        new XAttribute(\"optional\", true),\r\n                        new XAttribute(\"name\", parameterProfile.Name),\r\n                        new XAttribute(\"type\", bindingType.AssemblyQualifiedName)));\r\n\r\n                var context = new FunctionContextContainer();\r\n                XElement uiMarkup = FunctionFacade.GetWidgetMarkup(widgetFunction, parameterProfile.Type, parameterProfile.WidgetFunctionParameters, parameterProfile.Label, parameterProfile.HelpDefinition, parameterProfile.Name, context);\r\n\r\n                widgetPlaceholder.Add(uiMarkup);\r\n\r\n                if (!bindings.ContainsKey(parameterProfile.Name))\r\n                {\r\n                    bindings.Add(parameterProfile.Name, \"\");\r\n                }\r\n\r\n                if (parameterProfile.IsRequired)\r\n                {\r\n                    bindingsValidationRules.Add(parameterProfile.Name, new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n                }\r\n            }\r\n\r\n            FormDefinition widgetFormDefinition = BuildFormDefinition(bindingsDeclaration, widgetPlaceholder, bindings);\r\n\r\n            var compiler = new FormTreeCompiler();\r\n\r\n            using (XmlReader reader = widgetFormDefinition.FormMarkup)\r\n            {\r\n                compiler.Compile(reader, channelIdentifier, widgetFormDefinition.Bindings, false, \"WidgetParameterSetters\" + uniqueName, bindingsValidationRules);\r\n            }\r\n\r\n            return compiler;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"bindingsDeclarationMarkup\">Binding declarations - a list of elements like &lt;binding name=\"...\" type=\"...\" optional=\"false\" xmlns=\"http://www.composite.net/ns/management/bindingforms/1.0\" /></param>\r\n        /// <param name=\"uiControlMarkup\">The visual content of the form. All namespaces that controls and functions belong to must be declared.</param>\r\n        /// <param name=\"bindings\"></param>                \r\n        /// <returns></returns>\r\n        private static FormDefinition BuildFormDefinition(XNode bindingsDeclarationMarkup, XNode uiControlMarkup, Dictionary<string, object> bindings)\r\n        {\r\n            XNamespace placeholderSpace = \"#internal\";\r\n            XNamespace stdControlLibSpace = Namespaces.BindingFormsStdUiControls10;\r\n\r\n            string formXml =\r\n            #region XML for form\r\n @\"<?xml version='1.0' encoding='utf-8' ?>\r\n<cms:formdefinition\r\n  xmlns:internal='\" + placeholderSpace + @\"'\r\n  xmlns:cms='\" + Namespaces.BindingForms10 + @\"'>\r\n\r\n  <internal:bindingsDeclarationPlaceholder />\r\n\r\n  <cms:layout>\r\n    <!--FieldGroup xmlns='\" + stdControlLibSpace + @\"'-->\r\n      <internal:uiControlPlaceholder />\r\n    <!--/FieldGroup-->\r\n  </cms:layout>\r\n  \r\n</cms:formdefinition>\";\r\n            #endregion\r\n\r\n            var formMarkup = XDocument.Parse(formXml);\r\n\r\n            XElement bindingDeclarationPlaceholder = formMarkup.Descendants(placeholderSpace + \"bindingsDeclarationPlaceholder\").First();\r\n\r\n            bindingDeclarationPlaceholder.ReplaceWith(bindingsDeclarationMarkup);\r\n\r\n            XElement uiControlPlaceholder = formMarkup.Descendants(placeholderSpace + \"uiControlPlaceholder\").First();\r\n            uiControlPlaceholder.ReplaceWith(uiControlMarkup);\r\n\r\n            return new FormDefinition(formMarkup.CreateReader(), bindings);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/HttpModules/AdministrativeAuthorizationHttpModule.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.WebClient.HttpModules\r\n{\r\n    /// <summary>\r\n    ///  Http Module that ensures that only authenticated users can access /Composite/* files not explicitly allowed to everyone.\r\n    ///  Also ensure that HTTPS rules are enforced.\r\n    /// </summary>\r\n    internal class AdministrativeAuthorizationHttpModule : IHttpModule\r\n    {\r\n        private static readonly List<string> _allAllowedPaths = new List<string>();\r\n        private static string _adminRootPath;\r\n        private static string _servicesPath;\r\n        private static string _loginPagePath;\r\n        private static readonly object _lock = new object();\r\n        private static bool _allowC1ConsoleRequests;\r\n        private static bool _forceHttps = true;\r\n        private static bool _allowFallbackToHttp = true;\r\n        private static int? _customHttpsPortNumber;\r\n\r\n        private const string webauthorizationRelativeConfigPath = \"~/Composite/webauthorization.config\";\r\n        private const string c1ConsoleAccessRelativeConfigPath = \"~/App_Data/Composite/Configuration/C1ConsoleAccess.xml\";\r\n        private const string unsecureRedirectRelativePath = \"~/Composite/unsecure.aspx\";\r\n        private const string loginPagePathAttributeName = \"loginPagePath\";\r\n        private const string allowElementName = \"allow\";\r\n        private const string allow_pathAttributeName = \"path\";\r\n\r\n        private const string c1ConsoleRequestsNotAllowedHtmlTemplate = @\"<!DOCTYPE html>\r\n<html lang='en'>\r\n    <head>\r\n        <title>Access Denied</title>\r\n    </head>\r\n    <body>\r\n        <h1>Access Denied</h1>\r\n        <p>Administrative access has been disabled on this site.</p>\r\n        <p style='display:none'>IE Padding, preventing it from showing a generic error page: {0}</p>\r\n    </body>\r\n</html>\";\r\n\r\n        static AdministrativeAuthorizationHttpModule()\r\n        {\r\n            _allowC1ConsoleRequests = false;\r\n            string adminRootPath = HostingEnvironment.MapPath(UrlUtils.AdminRootPath);\r\n            bool adminFolderExists;\r\n\r\n            try\r\n            {\r\n                adminFolderExists = C1Directory.Exists(adminRootPath);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                // we fail miserably here when write permissions are missing, also the default exception is exceptionally crappy\r\n                throw new IOException(\"Please ensure that the web application process has permissions to read and modify the entire web app directory structure.\", ex);\r\n            }\r\n\r\n            if (adminFolderExists)\r\n            {\r\n                _allowC1ConsoleRequests = true;\r\n                LoadConfiguration();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Dispose()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public void Init(HttpApplication context)\r\n        {\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n            {\r\n                return;\r\n            }\r\n\r\n            context.AuthorizeRequest += context_AuthorizeRequest;\r\n        }\r\n\r\n\r\n\r\n        private static bool AlwaysAllowUnsecured(string requestPath)\r\n        {\r\n            string fileName = Path.GetFileName(requestPath);\r\n            return fileName.StartsWith(\"unsecure\") ||\r\n                fileName == \"blank.png\" ||\r\n                fileName == \"box.png\" ||\r\n                fileName == \"button.png\" ||\r\n                fileName == \"startcomposite.png\" ||\r\n                fileName == \"default.css.aspx\";\r\n        }\r\n\r\n\r\n\r\n        private void context_AuthorizeRequest(object sender, EventArgs e)\r\n        {\r\n            var application = (HttpApplication)sender;\r\n            HttpContext context = application.Context;\r\n\r\n            string currentPath = context.Request.Path.ToLowerInvariant();\r\n\r\n            if (_adminRootPath == null || !currentPath.StartsWith(_adminRootPath))\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (!_allowC1ConsoleRequests)\r\n            {\r\n                context.Response.ContentType = \"text/html\";\r\n                string iePadding = new String('!', 512);\r\n                context.Response.Write(string.Format(c1ConsoleRequestsNotAllowedHtmlTemplate, iePadding));\r\n                context.Response.End();\r\n                return;\r\n            }\r\n\r\n            var url = context.Request.Url;\r\n\r\n            // https check\r\n            if (_forceHttps && url.Scheme != \"https\")\r\n            {\r\n                if (!AlwaysAllowUnsecured(url.LocalPath) && !UserOptedOutOfHttps(context))\r\n                {\r\n                    context.Response.Redirect(\r\n                        $\"{unsecureRedirectRelativePath}?fallback={_allowFallbackToHttp.ToString().ToLower()}&httpsport={_customHttpsPortNumber}\");\r\n                }\r\n            }\r\n\r\n            // access check\r\n            if (currentPath.Length > _adminRootPath.Length && !UserValidationFacade.IsLoggedIn()\r\n                && !_allAllowedPaths.Any(p => currentPath.StartsWith(p, StringComparison.OrdinalIgnoreCase)))\r\n            {\r\n                if (currentPath.StartsWith(_servicesPath))\r\n                {\r\n                    context.Response.StatusCode = 403;\r\n                    context.Response.End();\r\n                    return;\r\n                }\r\n\r\n                Log.LogWarning(\"Authorization\", \"DENIED {0} access to {1}\", context.Request.UserHostAddress, currentPath);\r\n                string redirectUrl =$\"{_loginPagePath}?ReturnUrl={HttpUtility.UrlEncode(url.PathAndQuery, Encoding.UTF8)}\";\r\n                context.Response.Redirect(redirectUrl, true);\r\n                return;\r\n\r\n            }\r\n\r\n            // On authenticated request make sure these resources gets compiled / launched.\r\n            if (IsConsoleOnline)\r\n            {\r\n                BrowserRender.EnsureReadiness();\r\n                BuildManagerHelper.InitializeControlPreLoading();\r\n            }\r\n        }\r\n\r\n\r\n        private bool IsConsoleOnline =>\r\n            ApplicationOnlineHandlerFacade.IsApplicationOnline\r\n            && GlobalInitializerFacade.SystemCoreInitialized\r\n            && !GlobalInitializerFacade.SystemCoreInitializing\r\n            && SystemSetupFacade.IsSystemFirstTimeInitialized;\r\n\r\n        private bool UserOptedOutOfHttps(HttpContext context)\r\n        {\r\n            if (!_allowFallbackToHttp)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            HttpCookie cookie = context.Request.Cookies[\"avoidc1consolehttps\"];\r\n            return cookie?.Value == \"true\";\r\n        }\r\n\r\n\r\n\r\n        private static void LoadConfiguration()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _adminRootPath = UrlUtils.AdminRootPath.ToLowerInvariant();\r\n\r\n                if (!_adminRootPath.EndsWith(\"/\"))\r\n                {\r\n                    _adminRootPath = $\"{_adminRootPath}/\";\r\n                }\r\n\r\n                _servicesPath = _adminRootPath + \"services/\";\r\n\r\n                LoadAllowedPaths();\r\n                _allowC1ConsoleRequests = true;\r\n                LoadC1ConsoleAccessConfig();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void LoadC1ConsoleAccessConfig()\r\n        {\r\n            // defaults - keeping these if config file is missing or fucked up somehow\r\n            _forceHttps = false;\r\n            _allowFallbackToHttp = true;\r\n            _customHttpsPortNumber = null;\r\n\r\n            string c1ConsoleAccessConfigPath = HostingEnvironment.MapPath(c1ConsoleAccessRelativeConfigPath);\r\n\r\n            if (C1File.Exists(c1ConsoleAccessConfigPath))\r\n            {\r\n                try\r\n                {\r\n                    XDocument accessDoc = XDocumentUtils.Load(c1ConsoleAccessConfigPath);\r\n                    _allowC1ConsoleRequests = _allowC1ConsoleRequests && (bool)accessDoc.Root.Attribute(\"enabled\");\r\n\r\n                    XElement protocolElement = accessDoc.Root.Element(\"ClientProtocol\");\r\n                    _forceHttps = (bool)protocolElement.Attribute(\"forceHttps\");\r\n                    _allowFallbackToHttp = (bool)protocolElement.Attribute(\"allowFallbackToHttp\");\r\n\r\n                    var customHttpsPortNumberAttrib = protocolElement.Attribute(\"customHttpsPortNumber\");\r\n\r\n                    if (customHttpsPortNumberAttrib != null && customHttpsPortNumberAttrib.Value.Length > 0)\r\n                    {\r\n                        _customHttpsPortNumber = (int)customHttpsPortNumberAttrib;\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(\"Authorization\", \"Problem parsing '{0}'. Will use defaults and allow normal access. Error was '{1}'\", c1ConsoleAccessRelativeConfigPath, ex.Message);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void LoadAllowedPaths()\r\n        {\r\n            _allAllowedPaths.Clear();\r\n\r\n            string webauthorizationConfigPath = HostingEnvironment.MapPath(webauthorizationRelativeConfigPath);\r\n\r\n            if (!C1File.Exists(webauthorizationConfigPath))\r\n            {\r\n                Log.LogInformation(nameof(AdministrativeAuthorizationHttpModule), \"File '{0}' not found - all access to the ~/Composite folder will be blocked\", webauthorizationConfigPath);\r\n                return;\r\n            }\r\n\r\n            XDocument webauthorizationConfigDocument = XDocumentUtils.Load(webauthorizationConfigPath);\r\n\r\n            XAttribute loginPagePathAttribute = Verify.ResultNotNull(webauthorizationConfigDocument.Root.Attribute(\"loginPagePath\"), \"Missing '{0}' attribute on '{1}' root element\", loginPagePathAttributeName, webauthorizationRelativeConfigPath);\r\n            string relativeLoginPagePath = Verify.StringNotIsNullOrWhiteSpace(loginPagePathAttribute.Value, \"Unexpected empty '{0}' attribute on '{1}' root element\", loginPagePathAttributeName, webauthorizationRelativeConfigPath);\r\n\r\n            _loginPagePath = UrlUtils.ResolveAdminUrl(relativeLoginPagePath);\r\n\r\n            foreach (XElement allowElement in webauthorizationConfigDocument.Root.Elements(allowElementName))\r\n            {\r\n                XAttribute relativePathAttribute = Verify.ResultNotNull(allowElement.Attribute(allow_pathAttributeName), \"Missing '{0}' attribute on '{1}' element in '{2}'.\", allow_pathAttributeName, allowElement, webauthorizationRelativeConfigPath);\r\n                string relativePath = Verify.StringNotIsNullOrWhiteSpace(relativePathAttribute.Value, \"Empty '{0}' attribute on '{1}' element in '{2}'.\", allow_pathAttributeName, allowElement, webauthorizationRelativeConfigPath);\r\n\r\n                string fullPath = UrlUtils.ResolveAdminUrl(relativePath).ToLowerInvariant();\r\n                _allAllowedPaths.Add(fullPath);\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/HttpModules/AdministrativeCultureSetterHttpModule.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.Threading;\r\nusing System.Web;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.Core.WebClient.HttpModules\r\n{\r\n    internal class AdministrativeCultureSetterHttpModule : IHttpModule\r\n    {\r\n        public void Init(HttpApplication context)\r\n        {\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n            {\r\n                return;\r\n            }\r\n\r\n            context.AuthorizeRequest += context_AuthorizeRequest;\r\n        }\r\n\r\n\r\n        void context_AuthorizeRequest(object sender, EventArgs e)\r\n        {\r\n            HttpApplication application = (HttpApplication)sender;\r\n            HttpContext context = application.Context;\r\n\r\n            bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context);\r\n\r\n            if (adminRootRequest)\r\n            {\r\n                if (UserValidationFacade.IsLoggedIn())\r\n                {\r\n                    Thread.CurrentThread.CurrentCulture = UserSettings.CultureInfo;\r\n                    Thread.CurrentThread.CurrentUICulture = UserSettings.C1ConsoleUiLanguage;\r\n                }\r\n                else\r\n                {\r\n                    var defaultCulture = CultureInfo.CreateSpecificCulture(GlobalSettingsFacade.DefaultCultureName);\r\n\r\n                    Thread.CurrentThread.CurrentCulture = defaultCulture;\r\n                    Thread.CurrentThread.CurrentUICulture = defaultCulture;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public void Dispose()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/HttpModules/AdministrativeDataScopeSetterHttpModule.cs",
    "content": "using System;\r\nusing System.Web;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements.Foundation;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Core.WebClient.HttpModules\r\n{\r\n    internal class AdministrativeDataScopeSetterHttpModule : IHttpModule\r\n    {\r\n        private static bool _consoleArtifactsInitialized = false;\r\n        private static object _consoleArtifactsInitializeLock = new object();\r\n\r\n        public void Init(HttpApplication context)\r\n        {\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var moduleInstance = new ModuleInstance();\r\n            context.AuthorizeRequest += moduleInstance.AuthorizeRequest;\r\n            context.EndRequest += moduleInstance.EndRequest;\r\n        }\r\n\r\n        private class ModuleInstance\r\n        {\r\n            private DataScope _dataScope;\r\n\r\n            public void AuthorizeRequest(object sender, EventArgs e)\r\n            {\r\n                if (!SystemSetupFacade.IsSystemFirstTimeInitialized) return;\r\n\r\n                HttpApplication application = (HttpApplication)sender;\r\n                HttpContext context = application.Context;\r\n\r\n                bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context);\r\n\r\n                if (adminRootRequest && UserValidationFacade.IsLoggedIn())\r\n                {\r\n                    _dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo);\r\n\r\n                    if (!_consoleArtifactsInitialized)\r\n                    {\r\n                        lock(_consoleArtifactsInitializeLock)\r\n                        {\r\n                            if (!_consoleArtifactsInitialized && !SystemSetupFacade.SetupIsRunning)\r\n                            {\r\n                                HookingFacade.EnsureInitialization();\r\n                                FlowControllerFacade.Initialize();\r\n                                ConsoleFacade.Initialize();\r\n                                ElementProviderLoader.LoadAllProviders();\r\n                                _consoleArtifactsInitialized = true;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            public void EndRequest(object sender, EventArgs e)\r\n            {\r\n                _dataScope?.Dispose();\r\n                _dataScope = null;\r\n            }\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/HttpModules/AdministrativeResponseFilterHttpModule.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing Composite.Core.Types;\r\nusing System.Web.WebPages;\r\n\r\n\r\nnamespace Composite.Core.WebClient.HttpModules\r\n{\r\n    internal class AdministrativeResponseFilterHttpModule : IHttpModule\r\n    {\r\n        private static readonly Pair<string, string>[] ReplacementRules = new []\r\n       {\r\n           new Pair<string, string>(@\" xmlns:xsi=\"\"http://www.w3.org/2001/XMLSchema-instance\"\"\", @\"\"), \r\n           new Pair<string, string>(@\" xmlns:xsd=\"\"http://www.w3.org/2001/XMLSchema\"\"\", @\"\"),\r\n           new Pair<string, string>(@\"xmlns:ui=\"\"http://www.composite.net/ns/ui/1.0\"\"\", @\"xmlns:ui=\"\"http://www.w3.org/1999/xhtml\"\"\")\r\n        };\r\n\r\n        public void Init(HttpApplication context)\r\n        {\r\n            context.PostMapRequestHandler += AttachFilter;\r\n        }\r\n\r\n        private static void AttachFilter(object sender, EventArgs e)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if (!UrlUtils.IsAdminConsoleRequest(httpContext)) return;\r\n\r\n            if (httpContext.Handler is Page || httpContext.Handler is WebPageHttpHandler)\r\n            {\r\n                httpContext.Response.Filter = new ReplacementStream(httpContext.Response.Filter);\r\n            }\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n        }\r\n\r\n        internal class ReplacementStream : Utf8StringTransformationStream\r\n        {\r\n            public ReplacementStream(Stream innerStream) : base(innerStream) {}\r\n\r\n            public override string Process(string str)\r\n            {\r\n                var sb = new StringBuilder(str);\r\n\r\n                foreach(var kvp in ReplacementRules)\r\n                {\r\n                    sb.Replace(kvp.First, kvp.Second);\r\n                }\r\n\r\n                return sb.ToString();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/HttpModules/Utf8StringTransformationStream.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\n\r\nnamespace Composite.Core.WebClient.HttpModules\r\n{\r\n    internal abstract class Utf8StringTransformationStream : Stream\r\n    {\r\n        private readonly Stream _innerStream;\r\n        private MemoryStream _ms = new MemoryStream();\r\n\r\n        private bool? _responseIsUtf8;\r\n\r\n        public Utf8StringTransformationStream(Stream innerOuputStream)\r\n        {\r\n            _innerStream = innerOuputStream;\r\n        }\r\n\r\n        public override bool CanRead\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n        public override bool CanSeek\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n        public override bool CanWrite\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n        public override void Flush()\r\n        {\r\n            // DO NOTHING HERE\r\n        }\r\n\r\n        public override long Length\r\n        {\r\n            get { throw new NotSupportedException(); }\r\n        }\r\n\r\n        public override long Position\r\n        {\r\n            get { throw new NotSupportedException(); }\r\n            set { throw new NotSupportedException(); }\r\n        }\r\n\r\n        public override int Read(byte[] buffer, int offset, int count)\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n        public override long Seek(long offset, SeekOrigin origin)\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n        public override void SetLength(long value)\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n        public override void Write(byte[] buffer, int offset, int count)\r\n        {\r\n            if (_responseIsUtf8 == null)\r\n            {\r\n                _responseIsUtf8 = buffer.Take(3).SequenceEqual(Encoding.UTF8.GetPreamble());\r\n            }\r\n\r\n            if (!_responseIsUtf8.Value)\r\n            {\r\n                _innerStream.Write(buffer, offset, count);\r\n                return;\r\n            }\r\n\r\n            if (!_ms.CanWrite)\r\n            {\r\n                // Reopening stream if it was empty\r\n                _ms = new MemoryStream();\r\n            }\r\n            _ms.Write(buffer, offset, count);\r\n        }\r\n\r\n        public override void Close()\r\n        {\r\n            if (_responseIsUtf8 == null || !_responseIsUtf8.Value)\r\n            {\r\n                _innerStream.Close();\r\n                return;\r\n            }\r\n\r\n            // Checking if the stream was already closed\r\n            if (!_ms.CanSeek)\r\n            {\r\n                return;\r\n            }\r\n\r\n            _ms.Seek(0, SeekOrigin.Begin);\r\n\r\n            var bytes = _ms.ToArray();\r\n\r\n            string str = Encoding.UTF8.GetString(bytes);\r\n\r\n            string newValue = Process(str);\r\n\r\n            if (newValue != str)\r\n            {\r\n                bytes = Encoding.UTF8.GetBytes(newValue);\r\n            }\r\n\r\n            _innerStream.Write(bytes, 0, bytes.Length);\r\n\r\n            _innerStream.Close();\r\n            _ms.Close();\r\n        }\r\n\r\n        public abstract string Process(string str);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Logging/WFC/ILogService.cs",
    "content": "﻿using System;\r\nusing System.ServiceModel;\r\nusing System.ServiceModel.Web;\r\n\r\nnamespace Composite.Core.WebClient.Logging.WCF\r\n{\r\n    [ServiceContract]\r\n\tinternal interface ILogService\r\n\t{\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n        string GetVersion();\r\n\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n        string Authenticate(string adminPassword);\r\n\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n        DateTime GetLastStartupTime();\r\n\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n\t    DateTime GetServerTime();\r\n\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n        DateTime[] GetLoggingDates();\r\n\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n        int GetLogEntriesCount(DateTime timeFrom, DateTime timeTo, bool includeVerbose);\r\n\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n        int GetLogEntriesCountByDate(DateTime date, bool includeVerbose);\r\n\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n        LogEntry[] GetLogEntries(DateTime timeFrom, DateTime timeTo, bool includeVerbose, int maximumAmount);\r\n\r\n        [OperationContract]\r\n        [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]\r\n        LogEntry[] GetLogEntriesFrom(DateTime timeFrom, bool includeVerbose, int maximumAmount);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Logging/WFC/LogEntry.cs",
    "content": "﻿using System;\r\nusing System.Runtime.Serialization;\r\n\r\nnamespace Composite.Core.WebClient.Logging.WCF\r\n{\r\n    [DataContract(Name = \"LogEntry\", Namespace = \"http://schemas.datacontract.org/2004/07/Composite.Logging.WCF\")]\r\n\tinternal class LogEntry\r\n\t{\r\n        public LogEntry()\r\n        {\r\n        }\r\n\r\n        public LogEntry(Composite.Core.Logging.LogEntry fileLogEntry)\r\n        {\r\n            TimeStamp = fileLogEntry.TimeStamp;\r\n            ApplicationDomainId = fileLogEntry.ApplicationDomainId;\r\n            ThreadId = fileLogEntry.ThreadId;\r\n            Severity = fileLogEntry.Severity;\r\n            Title = fileLogEntry.Title;\r\n            DisplayOptions = fileLogEntry.DisplayOptions;\r\n            Message = fileLogEntry.Message;\r\n        }\r\n\r\n        [DataMember]\r\n        public DateTime TimeStamp;\r\n\r\n        [DataMember]\r\n        public int ApplicationDomainId;\r\n\r\n        [DataMember]\r\n        public int ThreadId;\r\n\r\n        [DataMember]\r\n        public string Severity;\r\n\r\n        [DataMember]\r\n        public string Title;\r\n\r\n        [DataMember]\r\n        public string DisplayOptions;\r\n\r\n        [DataMember]\r\n        public string Message;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Logging/WFC/LogService.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.ServiceModel;\r\nusing System.ServiceModel.Activation;\r\nusing System.Xml;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Threading;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Logging.WCF\r\n{\r\n    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]\r\n    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]\r\n    internal class LogService : ILogService\r\n    {\r\n        private static readonly string LoggerConfigurationFilePath = @\"App_Data\\Composite\\Configuration\\Logger.xml\";\r\n        private static readonly object _syncRoot = new object();\r\n\r\n        private static string _loggerPassword;\r\n\r\n        private static string LoggerPassword\r\n        {\r\n            get\r\n            {\r\n                if (_loggerPassword == null)\r\n                {\r\n                    lock (_syncRoot)\r\n                    {\r\n                        if (_loggerPassword == null)\r\n                        {\r\n                            string configurationFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, LoggerConfigurationFilePath);\r\n\r\n                            if (C1File.Exists(configurationFilePath))\r\n                            {\r\n\r\n                                var doc = new XmlDocument();\r\n                                try\r\n                                {\r\n                                    using (var sr = new C1StreamReader(configurationFilePath))\r\n                                    {\r\n                                        doc.Load(sr);\r\n                                    }\r\n\r\n                                    var passwordNode = doc.SelectSingleNode(\"logger/password\");\r\n                                    if (passwordNode != null && !string.IsNullOrEmpty(passwordNode.InnerText))\r\n                                    {\r\n                                        _loggerPassword = passwordNode.InnerText;\r\n                                    }\r\n                                }\r\n                                catch (Exception)\r\n                                {\r\n                                    // Do nothing\r\n                                }\r\n\r\n                                if (_loggerPassword == null)\r\n                                {\r\n                                    // Deleting configuration file\r\n                                    C1File.Delete(configurationFilePath);\r\n                                }\r\n                            }\r\n\r\n                            if (_loggerPassword == null)\r\n                            {\r\n                                _loggerPassword = Guid.NewGuid().ToString();\r\n\r\n                                string configFile = @\"<logger> <password>{0}</password> </logger>\".FormatWith(_loggerPassword);\r\n\r\n                                C1File.WriteAllText(configurationFilePath, configFile);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return _loggerPassword;\r\n            }\r\n        }\r\n\r\n        public string GetVersion()\r\n        {\r\n            return \"2.0\";\r\n        }\r\n\r\n        public string Authenticate(string loginAndPassword)\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return \"\";\r\n\r\n            bool userIsValid;\r\n\r\n            string login;\r\n            string password;\r\n\r\n            int separatorOffset = loginAndPassword.IndexOf(\"|\");\r\n            if (separatorOffset > 0 && separatorOffset < loginAndPassword.Length - 1)\r\n            {\r\n                login = loginAndPassword.Substring(0, separatorOffset);\r\n                password = loginAndPassword.Substring(separatorOffset + 1);\r\n            }\r\n            else\r\n            {\r\n                // Backward compatibility with old LogViewer\r\n                login = \"admin\";\r\n                password = loginAndPassword;\r\n            }\r\n\r\n            bool userIsAdmin = false;\r\n\r\n            using (ThreadDataManager.Initialize())\r\n            {\r\n                userIsValid = LoginProviderPluginFacade.FormValidateUser(login, password) == LoginResult.Success;\r\n\r\n                if (userIsValid)\r\n                {\r\n                    string userName = login.ToLowerInvariant();\r\n                    var userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userName).ToList();\r\n                    var userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userName).ToList();\r\n\r\n                    EntityToken rootEntityToken = AttachingPoint.PerspectivesRoot.EntityToken;\r\n                    var permissions = PermissionTypeFacade.GetCurrentPermissionTypes(new UserToken(userName), rootEntityToken, userPermissionDefinitions, userGroupPermissionDefinitions);\r\n\r\n                    userIsAdmin = permissions.Contains(PermissionType.Administrate);\r\n                }\r\n            }\r\n\r\n            return (userIsValid && userIsAdmin) ? LoggerPassword : string.Empty;\r\n        }\r\n\r\n        public DateTime GetLastStartupTime()\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return DateTime.MinValue;\r\n\r\n            CheckSecurity();\r\n\r\n            return LogManager.GetLastStartupTime();\r\n        }\r\n\r\n        public DateTime GetServerTime()\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return DateTime.MinValue;\r\n\r\n            CheckSecurity();\r\n\r\n            return DateTime.Now;\r\n        }\r\n\r\n        public DateTime[] GetLoggingDates()\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return new DateTime[] { };\r\n\r\n            CheckSecurity();\r\n\r\n            return LogManager.GetLoggingDates();\r\n        }\r\n\r\n        public int GetLogEntriesCount(DateTime timeFrom, DateTime timeTo, bool includeVerbose)\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return 0;\r\n\r\n            CheckSecurity();\r\n\r\n            return LogManager.GetLogEntriesCount(timeFrom, timeTo, includeVerbose);\r\n        }\r\n\r\n        public int GetLogEntriesCountByDate(DateTime date, bool includeVerbose)\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return 0;\r\n\r\n            CheckSecurity();\r\n\r\n            return LogManager.GetLogEntriesCountByDate(date, includeVerbose);\r\n        }\r\n\r\n        public LogEntry[] GetLogEntries(DateTime timeFrom, DateTime timeTo, bool includeVerbose, int maximumAmount)\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return new LogEntry[] { };\r\n\r\n            CheckSecurity();\r\n\r\n            return Wrap(LogManager.GetLogEntries(timeFrom, timeTo, includeVerbose, maximumAmount));\r\n        }\r\n\r\n        public LogEntry[] GetLogEntriesFrom(DateTime timeFrom, bool includeVerbose, int maximumAmount)\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return new LogEntry[] { };\r\n\r\n            CheckSecurity();\r\n\r\n            return GetLogEntries(timeFrom, DateTime.MaxValue, includeVerbose, maximumAmount);\r\n        }\r\n\r\n        private static void CheckSecurity()\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) return;\r\n\r\n            string header = OperationContext.Current.IncomingMessageHeaders.GetHeader<string>(\"AuthToken\", \"Composite.Logger\");\r\n\r\n            Verify.That(header == LoggerPassword, \"User hasn't been authentificated\");\r\n        }\r\n\r\n        private static LogEntry[] Wrap(Composite.Core.Logging.LogEntry[] logEntries)\r\n        {\r\n            if (logEntries == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var result = new LogEntry[logEntries.Length];\r\n            for (int i = 0; i < result.Length; i++)\r\n            {\r\n                result[i] = new LogEntry(logEntries[i]);\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Media/DefaultImageFileFormatProvider.cs",
    "content": "using System;\r\nusing System.Drawing;\r\nusing System.IO;\r\n\r\nnamespace Composite.Core.WebClient.Media\r\n{\r\n    internal class DefaultImageFileFormatProvider: IImageFileFormatProvider\r\n    {\r\n        private readonly Action<Bitmap, string, int?> _saveAction;\r\n\r\n        public DefaultImageFileFormatProvider(string mediaType, string extension, Action<Bitmap, string, int?> saveAction, bool canSetImageQuality = false)\r\n        {\r\n            MediaType = mediaType ?? throw new ArgumentNullException(nameof(mediaType));\r\n            FileExtension = extension ?? throw new ArgumentNullException(nameof(extension));\r\n            _saveAction = saveAction ?? throw new ArgumentNullException(nameof(saveAction));\r\n            CanSetImageQuality = canSetImageQuality;\r\n        }\r\n\r\n        public string MediaType { get; }\r\n\r\n        public string FileExtension { get; }\r\n\r\n        public bool CanSetImageQuality { get; }\r\n\r\n        public bool CanReadImageSize => true;\r\n\r\n        public bool TryGetSize(Stream imageStream, out Size size)\r\n        {\r\n            return ImageSizeReader.TryGetSize(imageStream, out size);\r\n        }\r\n\r\n        public Bitmap LoadImageFromStream(Stream stream) => new Bitmap(stream);\r\n\r\n        public void SaveImageToFile(Bitmap image, string outputFilePath, int? qualityPercentage = null)\r\n        {\r\n            _saveAction(image, outputFilePath, qualityPercentage);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Media/IImageFileFormatProvider.cs",
    "content": "using System.Drawing;\r\nusing System.IO;\r\n\r\nnamespace Composite.Core.WebClient.Media\r\n{\r\n    /// <summary>\r\n    /// A provider that enables reading/saving images for a specific image format.\r\n    /// </summary>\r\n    public interface IImageFileFormatProvider\r\n    {\r\n        /// <summary>\r\n        /// A media type (aka MIME type) that describes the image format (f.e. \"image/jpeg\").\r\n        /// </summary>\r\n        string MediaType { get; }\r\n\r\n        /// <summary>\r\n        /// A file extension that is associated with the image format.\r\n        /// </summary>\r\n        string FileExtension { get; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether the provider allows specifying quality percentage when saving an image.\r\n        /// </summary>\r\n        bool CanSetImageQuality { get; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether the provider allows reading image dimensions from the beginning of the stream.\r\n        /// </summary>\r\n        bool CanReadImageSize { get; }\r\n\r\n        /// <summary>\r\n        /// Tries to read image's size from the file header.\r\n        /// </summary>\r\n        /// <param name=\"imageStream\">The input stream with an image.</param>\r\n        /// <param name=\"size\">The size of the image</param>\r\n        /// <returns><value>True</value> if the image size was extracted successfully.</returns>\r\n        bool TryGetSize(Stream imageStream, out Size size);\r\n\r\n        /// <summary>\r\n        /// Loads a <see cref=\"Bitmap\"/> out of stream .\r\n        /// </summary>\r\n        /// <param name=\"stream\">The input stream.</param>\r\n        /// <returns></returns>\r\n        Bitmap LoadImageFromStream(Stream stream);\r\n\r\n        /// <summary>\r\n        /// Saves an image to a file with a given quality.\r\n        /// </summary>\r\n        /// <param name=\"image\">The image to be saved.</param>\r\n        /// <param name=\"outputFilePath\">The full path to a file.</param>\r\n        /// <param name=\"qualityPercentage\">The desired quality of the image - from 1 to 100.</param>\r\n        void SaveImageToFile(Bitmap image, string outputFilePath, int? qualityPercentage = null);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Media/ImageFormatProviders.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Drawing;\r\nusing System.Drawing.Imaging;\r\nusing System.Linq;\r\nusing Composite.Core.IO;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Media\r\n{\r\n    internal static class ImageFormatProviders\r\n    {\r\n        private static readonly ImageCodecInfo JpegCodecInfo = ImageCodecInfo.GetImageEncoders().First(codec => codec.FormatID == ImageFormat.Jpeg.Guid);\r\n\r\n        private static Action<Bitmap, string, int?> GetSaveInFormatFunction(ImageFormat imageFormat) =>\r\n            (resizedImage, outputFilePath, quality) => resizedImage.Save(outputFilePath, imageFormat);\r\n\r\n        internal static void AddDefaultImageFileFormatProviders(this IServiceCollection services)\r\n        {\r\n            var providers = new List<DefaultImageFileFormatProvider>\r\n            {\r\n                new DefaultImageFileFormatProvider(MimeTypeInfo.Jpeg, \"jpeg\", (resizedImage, outputFilePath, quality) =>\r\n                {\r\n                    var parameters = new EncoderParameters(1);\r\n                    parameters.Param[0] = new EncoderParameter(Encoder.Quality, quality ?? 75);\r\n\r\n                    resizedImage.Save(outputFilePath, JpegCodecInfo, parameters);\r\n                }, canSetImageQuality: true),\r\n                new DefaultImageFileFormatProvider(MimeTypeInfo.Png, \"png\", GetSaveInFormatFunction(ImageFormat.Png)),\r\n                new DefaultImageFileFormatProvider(MimeTypeInfo.Gif, \"gif\", GetSaveInFormatFunction(ImageFormat.Gif)),\r\n                new DefaultImageFileFormatProvider(MimeTypeInfo.Tiff, \"tiff\", GetSaveInFormatFunction(ImageFormat.Tiff)),\r\n                new DefaultImageFileFormatProvider(MimeTypeInfo.Bmp, \"bmp\", GetSaveInFormatFunction(ImageFormat.Bmp))\r\n            };\r\n\r\n            providers.ForEach(p => services.AddSingleton<IImageFileFormatProvider>(p));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Media/ImageResizer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Drawing;\r\nusing System.Drawing.Drawing2D;\r\nusing System.Drawing.Imaging;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.IO;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.WebClient.Media\r\n{\r\n    ///<summary>\r\n    /// Class that performs image resizing\r\n    ///</summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class ImageResizer\r\n    {\r\n        private const string ResizedImagesCacheDirectory = \"~/App_Data/Composite/Cache/Resized images\";\r\n\r\n        private static Dictionary<string, IImageFileFormatProvider> _imageFormatProviders;\r\n\r\n        private static Dictionary<string, IImageFileFormatProvider> ImageFormatProviders\r\n        {\r\n            get\r\n            {\r\n                if (_imageFormatProviders != null) return _imageFormatProviders;\r\n\r\n                var customProviders = ServiceLocator.GetServices<IImageFileFormatProvider>().ToList();\r\n\r\n                var result = new Dictionary<string, IImageFileFormatProvider>();\r\n                customProviders.ForEach(provider =>\r\n                {\r\n                    var mediaType = provider.MediaType;\r\n                    if (string.IsNullOrWhiteSpace(mediaType))\r\n                        throw new InvalidOperationException($\"Empty MediaType returned by provider {provider.GetType().FullName}\");\r\n\r\n                    result[mediaType] = provider;\r\n                });\r\n\r\n                return _imageFormatProviders = result;\r\n            }\r\n        }\r\n\r\n        private static readonly TimeSpan CacheExpirationTimeSpan = new TimeSpan(1, 0, 0, 0);\r\n\r\n        private static string _resizedImagesDirectoryPath;\r\n\r\n        private static string ResizedImagesDirectoryPath\r\n        {\r\n            get\r\n            {\r\n                if (_resizedImagesDirectoryPath == null)\r\n                {\r\n                    _resizedImagesDirectoryPath = HostingEnvironment.MapPath(ResizedImagesCacheDirectory);\r\n\r\n                    if (!C1Directory.Exists(_resizedImagesDirectoryPath))\r\n                    {\r\n                        C1Directory.CreateDirectory(_resizedImagesDirectoryPath);\r\n                    }\r\n                }\r\n\r\n                return _resizedImagesDirectoryPath;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the resized image.\r\n        /// </summary>\r\n        /// <param name=\"file\">The media file.</param>\r\n        /// <param name=\"resizingOptions\">The resizing options.</param>\r\n        /// <param name=\"sourceMediaType\">The media type of the image.</param>\r\n        /// <param name=\"targetMediaType\">The media type for the resized image.</param>\r\n        /// <returns>A full file path to a resized image; null if there's no need to resize the image</returns>\r\n        public static string GetResizedImage(IMediaFile file, ResizingOptions resizingOptions,\r\n                                             string sourceMediaType, string targetMediaType)\r\n        {\r\n            Verify.ArgumentNotNull(file, nameof(file));\r\n            Verify.ArgumentNotNullOrEmpty(sourceMediaType, nameof(sourceMediaType));\r\n            Verify.ArgumentNotNullOrEmpty(targetMediaType, nameof(targetMediaType));\r\n\r\n            if (!ImageFormatProviders.TryGetValue(sourceMediaType, out var sourceImageFormatProvider))\r\n                throw new ArgumentException($\"Unsupported media type '{sourceMediaType}'\", nameof(sourceMediaType));\r\n\r\n            if (!ImageFormatProviders.TryGetValue(targetMediaType, out var imageFileFormatProvider))\r\n                throw new ArgumentException($\"Unsupported media type '{targetMediaType}'\", nameof(targetMediaType));\r\n\r\n\r\n            string imageKey = file.CompositePath;\r\n\r\n            string imageSizeCacheKey = nameof(ImageResizer) + imageKey;\r\n            Size? imageSize = HttpRuntime.Cache.Get(imageSizeCacheKey) as Size?;\r\n\r\n            Func<Stream, Bitmap> loadImageFunc = sourceImageFormatProvider.LoadImageFromStream;\r\n\r\n            Bitmap bitmap = null;\r\n            Stream fileStream = null;\r\n            try\r\n            {\r\n                if (imageSize == null)\r\n                {\r\n                    if (sourceImageFormatProvider.CanReadImageSize)\r\n                    {\r\n                        fileStream = file.GetReadStream();\r\n                        if (sourceImageFormatProvider.TryGetSize(fileStream, out var imageSizeFromProvider))\r\n                        {\r\n                            imageSize = imageSizeFromProvider;\r\n                        }\r\n\r\n                        fileStream.Close();\r\n                        fileStream.Dispose();\r\n                        fileStream = null;\r\n                    }\r\n\r\n                    if (imageSize == null)\r\n                    {\r\n                        fileStream = file.GetReadStream();\r\n                        bitmap = loadImageFunc(fileStream);\r\n\r\n                        imageSize = new Size { Width = bitmap.Width, Height = bitmap.Height };\r\n                    }\r\n\r\n                    // We can provider cache dependency only for the native media provider\r\n                    CacheDependency cacheDependency = null;\r\n                    if (file is FileSystemFileBase fileSystemFile)\r\n                    {\r\n                        cacheDependency = new CacheDependency(fileSystemFile.SystemPath);\r\n                    }\r\n\r\n                    HttpRuntime.Cache.Add(imageSizeCacheKey, imageSize, cacheDependency, DateTime.MaxValue, CacheExpirationTimeSpan, CacheItemPriority.Normal, null);\r\n                }\r\n\r\n                bool needToResize = CalculateSize(imageSize.Value.Width, imageSize.Value.Height, resizingOptions,\r\n                                                  out int newWidth, out int newHeight, out bool centerCrop);\r\n\r\n                needToResize = needToResize || resizingOptions.CustomQuality;\r\n\r\n                if (!needToResize)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                string mediaFileHash = GetMediaHash(imageKey);\r\n\r\n                string centerCroppedString = centerCrop ? \"c\" : string.Empty;\r\n\r\n                string fileExtension = imageFileFormatProvider.FileExtension;\r\n                string qualityCacheKeyPart = imageFileFormatProvider.CanSetImageQuality\r\n                    ? $\"_{resizingOptions.Quality}\"\r\n                    : \"\";\r\n\r\n                string resizedImageFileName = $\"{newWidth}x{newHeight}{centerCroppedString}_{mediaFileHash}{qualityCacheKeyPart}.{fileExtension}\";\r\n\r\n                string resizedImageFullPath = Path.Combine(ResizedImagesDirectoryPath, resizedImageFileName);\r\n\r\n                if (!C1File.Exists(resizedImageFullPath) || C1File.GetLastWriteTime(resizedImageFullPath) != file.LastWriteTime)\r\n                {\r\n                    if (bitmap == null)\r\n                    {\r\n                        fileStream = file.GetReadStream();\r\n                        bitmap = loadImageFunc(fileStream);\r\n                    }\r\n\r\n                    using (Bitmap resizedImage = ResizeImage(bitmap, newWidth, newHeight, centerCrop))\r\n                    {\r\n                        int? imageQuality = imageFileFormatProvider.CanSetImageQuality ? (int?)resizingOptions.Quality : null;\r\n\r\n                        imageFileFormatProvider.SaveImageToFile(resizedImage, resizedImageFullPath, imageQuality);\r\n                    }\r\n\r\n                    if (file.LastWriteTime.HasValue)\r\n                    {\r\n                        C1File.SetLastWriteTime(resizedImageFullPath, file.LastWriteTime.Value);\r\n                    }\r\n                }\r\n\r\n                return resizedImageFullPath;\r\n            }\r\n            finally\r\n            {\r\n                bitmap?.Dispose();\r\n                fileStream?.Dispose();\r\n            }\r\n        }\r\n\r\n        private static string GetMediaHash(string mediaKeyPath)\r\n        {\r\n            var guid = HashingHelper.ComputeMD5Hash(mediaKeyPath, Encoding.UTF8);\r\n            return UrlUtils.CompressGuid(guid).Substring(10);\r\n        }\r\n\r\n        private static bool CalculateSize(int width, int height, ResizingOptions resizingOptions, out int newWidth, out int newHeight, out bool centerCrop)\r\n        {\r\n            // Can be refactored to use System.Drawing.Size class instead of (width & height).\r\n\r\n            if (width == 0 || height == 0)\r\n            {\r\n                newHeight = newWidth = 0;\r\n                centerCrop = false;\r\n                return false;\r\n            }\r\n\r\n            Verify.ArgumentCondition(width > 0, \"width\", \"Negative values aren't allowed\");\r\n            Verify.ArgumentCondition(height > 0, \"height\", \"Negative values aren't allowed\");\r\n\r\n            centerCrop = false;\r\n\r\n            // If both height and width are defined - we have \"scaling\"\r\n            if (resizingOptions.Height != null && resizingOptions.Width != null)\r\n            {\r\n                newHeight = (int)resizingOptions.Height;\r\n                newWidth = (int)resizingOptions.Width;\r\n\r\n                // we do not allow scaling to a size, bigger than original one\r\n                if (newHeight > height)\r\n                {\r\n                    newHeight = height;\r\n                }\r\n\r\n                if (newWidth > width)\r\n                {\r\n                    newWidth = width;\r\n                }\r\n\r\n                // If the target dimensions are bigger or the same size as of the image - no resizing is done\r\n                if (newWidth == width && newHeight == height)\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                switch (resizingOptions.ResizingAction)\r\n                {\r\n                    case ResizingAction.Stretch:\r\n                        // no additional logic\r\n                        break;\r\n\r\n                    case ResizingAction.Crop:\r\n                        centerCrop = true;\r\n                        break;\r\n\r\n                    case ResizingAction.Fit:\r\n                    case ResizingAction.Fill:\r\n                        // No float point division for better precision\r\n                        Int64 heightProportionArea = (Int64)newHeight * width;\r\n                        Int64 widthProportionArea = (Int64)newWidth * height;\r\n\r\n                        if (heightProportionArea == widthProportionArea)\r\n                        {\r\n                            break;\r\n                        }\r\n\r\n                        if ((heightProportionArea > widthProportionArea)\r\n                            //  (newHeight / height) > (newWidth / width) \r\n                              ^ (resizingOptions.ResizingAction == ResizingAction.Fit))\r\n                        {\r\n                            newWidth = (int)(heightProportionArea / height);\r\n                            // newWidth = width * (newHeight / height)\r\n                        }\r\n                        else\r\n                        {\r\n                            newHeight = (int)(widthProportionArea / width);\r\n                            // newHeight = height * (newWidth / width)\r\n                        }\r\n\r\n                        break;\r\n                }\r\n\r\n                return true;\r\n            }\r\n\r\n            newWidth = width;\r\n            newHeight = height;\r\n\r\n            // If image doesn't fit to boundaries \"maxWidth X maxHeight\", downsizing it\r\n            int? maxWidth = resizingOptions.Width;\r\n            if (resizingOptions.MaxWidth != null && (maxWidth == null || resizingOptions.MaxWidth < maxWidth))\r\n            {\r\n                maxWidth = resizingOptions.MaxWidth;\r\n            }\r\n\r\n            int? maxHeight = resizingOptions.Height;\r\n            if (resizingOptions.MaxHeight != null && (maxHeight == null || resizingOptions.MaxHeight < maxHeight))\r\n            {\r\n                maxHeight = resizingOptions.MaxHeight;\r\n            }\r\n\r\n            // Applying MaxHeight and MaxWidth limitations\r\n            if (maxHeight != null && (int)maxHeight < newHeight)\r\n            {\r\n                newHeight = (int)maxHeight;\r\n                newWidth = (int)(width * (double)(int)maxHeight / height);\r\n            }\r\n\r\n            if (maxWidth != null && (int)maxWidth < newWidth)\r\n            {\r\n                newWidth = (int)maxWidth;\r\n                newHeight = (int)(height * (double)(int)maxWidth / width);\r\n            }\r\n\r\n            return newWidth != width || newHeight != height;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Resizes an image\r\n        /// </summary>\r\n        /// <param name=\"image\">source</param>\r\n        /// <param name=\"newWidth\">width</param>\r\n        /// <param name=\"newHeight\">height</param>\r\n        /// <param name=\"centerCrop\">when true, cropping will happen</param>\r\n        /// <returns>the resized image</returns>\r\n        public static Bitmap ResizeImage(Bitmap image, int newWidth, int newHeight, bool centerCrop)\r\n        {\r\n            Verify.ArgumentNotNull(image, \"image\");\r\n\r\n            Bitmap resizedImage = new Bitmap(newWidth, newHeight);\r\n\r\n            resizedImage.SetResolution(72, 72);\r\n\r\n            using (Graphics newGraphic = Graphics.FromImage(resizedImage))\r\n            {\r\n                newGraphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;\r\n                newGraphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;\r\n                // newGraphic.PixelOffsetMode = PixelOffsetMode.HighQuality;\r\n\r\n                if (centerCrop)\r\n                {\r\n                    float xRatio = image.Width / (float)newWidth;\r\n                    float yRatio = image.Height / (float)newHeight;\r\n\r\n                    if (xRatio > yRatio)\r\n                    {\r\n                        float dx = (image.Width / yRatio) - newWidth;\r\n\r\n                        DrawWithoutBlending(newGraphic, image, -dx / 2.0f, 0.0f, newWidth + dx, newHeight);\r\n                    }\r\n                    else if (yRatio > xRatio)\r\n                    {\r\n                        float dy = (image.Height / xRatio) - newHeight;\r\n                        DrawWithoutBlending(newGraphic, image, 0.0f, -dy / 2.0f, newWidth, newHeight + dy);\r\n                    }\r\n                    else\r\n                    {\r\n                        DrawWithoutBlending(newGraphic, image, 0, 0, newWidth, newHeight);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    DrawWithoutBlending(newGraphic, image, 0, 0, newWidth, newHeight);\r\n                }\r\n            }\r\n\r\n            return resizedImage;\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Draws a bitmap without background blending on first row and first column\r\n        /// </summary>\r\n        private static void DrawWithoutBlending(Graphics graphic, Bitmap bitmap, int x, int y, int width, int height)\r\n        {\r\n            using (var wrapMode = new ImageAttributes())\r\n            {\r\n                wrapMode.SetWrapMode(WrapMode.TileFlipXY);\r\n\r\n                graphic.DrawImage(bitmap,\r\n                                  new Rectangle(x, y, width, height),\r\n                                  0, 0, bitmap.Width, bitmap.Height,\r\n                                  GraphicsUnit.Pixel,\r\n                                  wrapMode);\r\n            }\r\n        }\r\n\r\n        private static void DrawWithoutBlending(Graphics graphic, Bitmap bitmap, float x, float y, float width, float height)\r\n        {\r\n            const double delta = 0.001;\r\n\r\n            DrawWithoutBlending(graphic, bitmap,\r\n                (int)Math.Floor(x + delta),\r\n                (int)Math.Floor(y + delta),\r\n                (int)Math.Ceiling(width - delta),\r\n                (int)Math.Ceiling(height - delta));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a value indicating whether an image of a given media type can be resized.\r\n        /// </summary>\r\n        /// <param name=\"mediaType\">A media type.</param>\r\n        public static bool SourceMediaTypeSupported(string mediaType)\r\n        {\r\n            if (mediaType == null) throw new ArgumentNullException(nameof(mediaType));\r\n\r\n            return ImageFormatProviders.ContainsKey(mediaType);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a value indicating whether resized imaged can be saved in the specified media type.\r\n        /// </summary>\r\n        /// <param name=\"mediaType\">A media type.</param>\r\n        public static bool TargetMediaTypeSupported(string mediaType)\r\n        {\r\n            if (mediaType == null) throw new ArgumentNullException(nameof(mediaType));\r\n\r\n            return ImageFormatProviders.ContainsKey(mediaType);\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete]\r\n        public class SupportedImageFormats\r\n        {\r\n            /// <exclude />\r\n            public static ImageFormat JPG => ImageFormat.Jpeg;\r\n\r\n            /// <exclude />\r\n            public static ImageFormat PNG => ImageFormat.Png;\r\n\r\n            /// <exclude />\r\n            public static ImageFormat TIFF => ImageFormat.Tiff;\r\n\r\n            /// <exclude />\r\n            public static ImageFormat GIF => ImageFormat.Gif;\r\n\r\n            /// <exclude />\r\n            public static ImageFormat BMP => ImageFormat.Bmp;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Media/ImageSizeReader.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Drawing;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Core.WebClient.Media\r\n{\r\n    /// <summary>\r\n    /// Kudos to http://stackoverflow.com/a/112711/396091\r\n    /// </summary>\r\n    internal static class ImageSizeReader\r\n    {\r\n        const string errorMessage = \"Could not recognise image format.\";\r\n\r\n        private static Dictionary<byte[], Func<BinaryReader, Size>> imageFormatDecoders = new Dictionary<byte[], Func<BinaryReader, Size>>()\r\n        {\r\n            { new byte[]{ 0x42, 0x4D }, DecodeBitmap},\r\n            { new byte[]{ 0x47, 0x49, 0x46, 0x38, 0x37, 0x61 }, DecodeGif },\r\n            { new byte[]{ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 }, DecodeGif },\r\n            { new byte[]{ 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }, DecodePng },\r\n            { new byte[]{ 0xff, 0xd8 }, DecodeJfif },\r\n        };\r\n\r\n        /// <summary>\r\n        /// Gets the width and height of an image.\r\n        /// </summary>\r\n        /// <param name=\"imageStream\">Stream containing image bytes</param>\r\n        /// <param name=\"size\">The calculated size of the image</param>\r\n        /// <returns>True if the size was calculated</returns>\r\n        internal static bool TryGetSize(Stream imageStream, out Size size)\r\n        {\r\n            try\r\n            {\r\n                using (BinaryReader binaryReader = new BinaryReader(imageStream))\r\n                {\r\n                    size = GetSize(binaryReader);\r\n                    return true;\r\n                }\r\n\r\n            }\r\n            catch (Exception)\r\n            {\r\n                size = new Size(-1, -1);\r\n                return false;\r\n            }\r\n        }\r\n\r\n        private static Size GetSize(BinaryReader binaryReader)\r\n        {\r\n            int maxMagicBytesLength = imageFormatDecoders.Keys.OrderByDescending(x => x.Length).First().Length;\r\n\r\n            byte[] magicBytes = new byte[maxMagicBytesLength];\r\n\r\n            for (int i = 0; i < maxMagicBytesLength; i += 1)\r\n            {\r\n                magicBytes[i] = binaryReader.ReadByte();\r\n\r\n                foreach (var kvPair in imageFormatDecoders)\r\n                {\r\n                    if (magicBytes.StartsWith(kvPair.Key))\r\n                    {\r\n                        return kvPair.Value(binaryReader);\r\n                    }\r\n                }\r\n            }\r\n\r\n            throw new ArgumentException(errorMessage, \"binaryReader\");\r\n        }\r\n\r\n        private static bool StartsWith(this byte[] thisBytes, byte[] thatBytes)\r\n        {\r\n            for (int i = 0; i < thatBytes.Length; i += 1)\r\n            {\r\n                if (thisBytes[i] != thatBytes[i])\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n            return true;\r\n        }\r\n\r\n        private static short ReadLittleEndianInt16(this BinaryReader binaryReader)\r\n        {\r\n            byte[] bytes = new byte[sizeof(short)];\r\n            for (int i = 0; i < sizeof(short); i += 1)\r\n            {\r\n                bytes[sizeof(short) - 1 - i] = binaryReader.ReadByte();\r\n            }\r\n            return BitConverter.ToInt16(bytes, 0);\r\n        }\r\n\r\n        private static int ReadLittleEndianInt32(this BinaryReader binaryReader)\r\n        {\r\n            byte[] bytes = new byte[sizeof(int)];\r\n            for (int i = 0; i < sizeof(int); i += 1)\r\n            {\r\n                bytes[sizeof(int) - 1 - i] = binaryReader.ReadByte();\r\n            }\r\n            return BitConverter.ToInt32(bytes, 0);\r\n        }\r\n\r\n        private static Size DecodeBitmap(BinaryReader binaryReader)\r\n        {\r\n            binaryReader.ReadBytes(16);\r\n            int width = binaryReader.ReadInt32();\r\n            int height = binaryReader.ReadInt32();\r\n            return new Size(width, height);\r\n        }\r\n\r\n        private static Size DecodeGif(BinaryReader binaryReader)\r\n        {\r\n            int width = binaryReader.ReadInt16();\r\n            int height = binaryReader.ReadInt16();\r\n            return new Size(width, height);\r\n        }\r\n\r\n        private static Size DecodePng(BinaryReader binaryReader)\r\n        {\r\n            binaryReader.ReadBytes(8);\r\n            int width = binaryReader.ReadLittleEndianInt32();\r\n            int height = binaryReader.ReadLittleEndianInt32();\r\n            return new Size(width, height);\r\n        }\r\n\r\n        private static Size DecodeJfif(BinaryReader binaryReader)\r\n        {\r\n            while (binaryReader.ReadByte() == byte.MaxValue)\r\n            {\r\n                byte marker = binaryReader.ReadByte();\r\n                ushort chunkLength = (ushort)binaryReader.ReadLittleEndianInt16();\r\n\r\n                if (marker == 0xc0 || marker == 0xc2)\r\n                {\r\n                    binaryReader.ReadByte();\r\n\r\n                    short height = binaryReader.ReadLittleEndianInt16();\r\n                    short width = binaryReader.ReadLittleEndianInt16();\r\n\r\n                    return new Size(width, height);\r\n                }\r\n                binaryReader.ReadBytes(chunkLength - 2);\r\n            }\r\n\r\n            throw new ArgumentException(\"Could not recognise image format.\");\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Media/ResizingAction.cs",
    "content": "﻿namespace Composite.Core.WebClient.Media\r\n{\r\n    /// <summary>    \r\n    /// Resizing action for <see ref=\"Composite.Core.WebClient.Media.ImageResizer\" />\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public enum ResizingAction\r\n    {\r\n        /// <summary>\r\n        /// Stretches image so it fills the specified area. The result image dimensions are newer bigger than original dimensions.\r\n        /// It is the default action\r\n        /// </summary>\r\n        Stretch = 0, \r\n        /// <summary>\r\n        /// Scales image proportionally down (if necessary) so it fits the specified area.\r\n        /// Also knows as \"touch from inside\";\r\n        /// </summary>\r\n        Fit = 1,\r\n        /// <summary>\r\n        /// Scales image proportionally down (if necessary) so it fills the specified area. \r\n        /// </summary>\r\n        Fill = 2,\r\n        /// <summary>\r\n        /// Scales image proportionally down (if necessary) so it fills the specified area, and crops the parts that are outside area's boundaries.\r\n        /// Also knows as \"touch from outside\";\r\n        /// </summary>\r\n        Crop = 3\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Media/ResizingOptions.cs",
    "content": "using System;\r\nusing System.Collections.Specialized;\r\nusing System.Configuration;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.Core.WebClient.Media\r\n{\r\n    /// <summary>    \r\n    /// Resizing options for <see ref=\"Composite.Core.WebClient.Media.ImageResizer\" />\r\n    /// </summary>\r\n    public class ResizingOptions\r\n    {\r\n        private const string ResizedImageKeys = \"~/App_Data/Composite/Media/ResizingOptions.xml\";\r\n        private static string _resizedImageKeysFilePath;\r\n\r\n        private const string ResizingOptionsConfigFileName = \"ImageResizing.xml\";\r\n        private static volatile string _hashSalt;\r\n        private static readonly object SyncRoot = new object();\r\n\r\n        private int? _qualityOverride;\r\n\r\n        /// <summary>\r\n        /// Image height\r\n        /// </summary>\r\n        public int? Height { get; set; }\r\n\r\n        /// <summary>\r\n        /// Image width\r\n        /// </summary>\r\n        public int? Width { get; set; }\r\n\r\n        /// <summary>\r\n        /// Maximum height\r\n        /// </summary>\r\n        public int? MaxHeight { get; set; }\r\n\r\n        /// <summary>\r\n        /// Maximum width\r\n        /// </summary>\r\n        public int? MaxWidth { get; set; }\r\n\r\n        /// <summary>\r\n        /// Indicate if resizing options has a default or non-default quality setting (used when doing lossy compression). \r\n        /// </summary>\r\n        public bool CustomQuality => _qualityOverride.HasValue;\r\n\r\n        /// <summary>\r\n        /// Image quality (when doing lossy compression)\r\n        /// </summary>\r\n        public int Quality\r\n        {\r\n            get => _qualityOverride ?? GlobalSettingsFacade.ImageQuality;\r\n\r\n            set\r\n            {\r\n                _qualityOverride = value;\r\n\r\n                if (_qualityOverride < 1)\r\n                {\r\n                    _qualityOverride = 1;\r\n                }\r\n\r\n                if (_qualityOverride > 100)\r\n                {\r\n                    _qualityOverride = 100;\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Resizing action\r\n        /// </summary>\r\n        public ResizingAction ResizingAction { get; set; }\r\n\r\n        /// <summary>\r\n        /// The preferred media type for the generated resized image.\r\n        /// If the media type isn't supported, the original image will be returned.\r\n        /// </summary>\r\n        public string MediaType { get; set; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether any options were specified\r\n        /// </summary>\r\n        public bool IsEmpty => Height == null && Width == null && MaxHeight == null && MaxWidth == null && _qualityOverride == null;\r\n\r\n        /// <exclude />\r\n        public ResizingOptions() { }\r\n\r\n        /// <summary>\r\n        /// Parses resizing options from query string collection\r\n        /// </summary>\r\n        /// <param name=\"httpServerUtility\">An instance of <see ref=\"System.Web.HttpServerUtility\" />.</param>\r\n        /// <param name=\"queryString\">The query string.</param>\r\n        /// <returns>Resizing options</returns>\r\n        [Obsolete(\"Use an overload not taking an HttpServerUtility instance as a parameter\")]\r\n        public static ResizingOptions Parse(HttpServerUtility httpServerUtility, NameValueCollection queryString)\r\n        {\r\n            return Parse(queryString);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parses resizing options from query string collection\r\n        /// </summary>\r\n        /// <param name=\"queryString\">The query string.</param>\r\n        /// <returns>Resizing options</returns>\r\n        public static ResizingOptions Parse(NameValueCollection queryString)\r\n        {\r\n            var resizingKey = queryString[\"k\"];\r\n\r\n            return string.IsNullOrEmpty(resizingKey) ? FromQueryString(queryString) : new ResizingOptions(resizingKey);\r\n        }\r\n\r\n        /// <exclude />\r\n        internal ResizingOptions(string predefinedOptionsName)\r\n        {\r\n            //Load the xml file\r\n            var options = GetPredefinedResizingOptions().Elements(\"image\");\r\n\r\n            foreach (var e in options.Where(e => (string)e.Attribute(\"name\") == predefinedOptionsName))\r\n            {\r\n                Height = ParseOptionalIntAttribute(e, \"height\");\r\n                Width = ParseOptionalIntAttribute(e, \"width\");\r\n                MaxHeight = ParseOptionalIntAttribute(e, \"maxheight\");\r\n                MaxWidth = ParseOptionalIntAttribute(e, \"maxwidth\");\r\n                _qualityOverride = ParseOptionalIntAttribute(e, \"quality\");\r\n\r\n                var attr = e.Attribute(\"action\");\r\n                if (attr != null)\r\n                {\r\n                    ResizingAction = (ResizingAction)Enum.Parse(typeof(ResizingAction), attr.Value, true);\r\n                }\r\n\r\n                MediaType = (string) e.Attribute(\"mediaType\");\r\n            }\r\n        }\r\n\r\n        private static int? ParseOptionalIntAttribute(XElement element, string attributeName)\r\n        {\r\n            var attribute = element.Attribute(attributeName);\r\n\r\n            return attribute == null ? (int?)null : int.Parse(attribute.Value);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets resizing options from query string\r\n        /// </summary>\r\n        /// <param name=\"queryString\">The query string.</param>\r\n        /// <returns>Resizing options</returns>\r\n        private static ResizingOptions FromQueryString(NameValueCollection queryString)\r\n        {\r\n            var result = new ResizingOptions();\r\n\r\n            var str = queryString[\"w\"];\r\n            if (!string.IsNullOrEmpty(str))\r\n            {\r\n                result.Width = int.Parse(str);\r\n            }\r\n\r\n            str = queryString[\"h\"];\r\n            if (!string.IsNullOrEmpty(str))\r\n            {\r\n                result.Height = int.Parse(str);\r\n            }\r\n\r\n            str = queryString[\"mw\"];\r\n            if (!string.IsNullOrEmpty(str))\r\n            {\r\n                result.MaxWidth = int.Parse(str);\r\n            }\r\n\r\n            str = queryString[\"mh\"];\r\n            if (!string.IsNullOrEmpty(str))\r\n            {\r\n                result.MaxHeight = int.Parse(str);\r\n            }\r\n\r\n            str = queryString[\"q\"];\r\n            if (!string.IsNullOrEmpty(str))\r\n            {\r\n                result.Quality = int.Parse(str);\r\n            }\r\n\r\n            var action = queryString[\"action\"];\r\n            if (!string.IsNullOrEmpty(action) && Enum.TryParse(action, true, out ResizingAction resizingAction))\r\n            {\r\n                result.ResizingAction = resizingAction;\r\n            }\r\n            else\r\n            {\r\n                result.ResizingAction = ResizingAction.Stretch;\r\n            }\r\n\r\n            var mediaType = queryString[\"mt\"];\r\n            if (!string.IsNullOrEmpty(mediaType))\r\n            {\r\n                result.MediaType = mediaType;\r\n            }\r\n\r\n            return result;\r\n        }\r\n        private static XElement GetPredefinedResizingOptions()\r\n        {\r\n            //If it's not there, load the xml document and then add it to the cache\r\n            if (!(HttpRuntime.Cache.Get(\"ResizedImageKeys\") is XElement xel))\r\n            {\r\n                if (_resizedImageKeysFilePath == null)\r\n                {\r\n                    _resizedImageKeysFilePath = PathUtil.Resolve(ResizedImageKeys);\r\n                }\r\n\r\n                if (!C1File.Exists(_resizedImageKeysFilePath))\r\n                {\r\n                    var directoryPath = Path.GetDirectoryName(_resizedImageKeysFilePath);\r\n                    if (!C1Directory.Exists(directoryPath)) C1Directory.CreateDirectory(directoryPath);\r\n\r\n                    var config = new XElement(\"ResizedImages\",\r\n                        new XElement(\"image\",\r\n                            new XAttribute(\"name\", \"thumbnail\"),\r\n                            new XAttribute(\"maxwidth\", \"100\"),\r\n                            new XAttribute(\"maxheight\", \"100\")),\r\n                        new XElement(\"image\",\r\n                            new XAttribute(\"name\", \"normal\"),\r\n                            new XAttribute(\"maxwidth\", \"200\")),\r\n                        new XElement(\"image\",\r\n                            new XAttribute(\"name\", \"large\"),\r\n                            new XAttribute(\"maxheight\", \"300\"))\r\n                    );\r\n\r\n                    config.SaveToPath(_resizedImageKeysFilePath);\r\n                }\r\n\r\n                xel = XElementUtils.Load(_resizedImageKeysFilePath);\r\n\r\n                var cd = new CacheDependency(_resizedImageKeysFilePath);\r\n                var cacheExpirationTimeSpan = new TimeSpan(24, 0, 0);\r\n\r\n                HttpRuntime.Cache.Add(\"ResizedImageKeys\", xel, cd, Cache.NoAbsoluteExpiration, cacheExpirationTimeSpan, CacheItemPriority.Default, null);\r\n            }\r\n\r\n            return xel;\r\n        }\r\n\r\n        private static string GetHashSalt()\r\n        {\r\n            if (_hashSalt != null) return _hashSalt;\r\n\r\n            lock (SyncRoot)\r\n            {\r\n                if (_hashSalt != null) return _hashSalt;\r\n\r\n                string filePath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.ConfigurationDirectory), ResizingOptionsConfigFileName);\r\n                if (!C1File.Exists(filePath))\r\n                {\r\n                    var config = new XElement(\"ResizedImages\",\r\n                        new XAttribute(\"hashSalt\", Guid.NewGuid()));\r\n\r\n                    config.SaveToPath(filePath);\r\n                }\r\n\r\n                var xml = XElementUtils.Load(filePath);\r\n\r\n                var hashSalt = (string)xml.Attribute(\"hashSalt\");\r\n                if (hashSalt == null) throw new ConfigurationErrorsException(\"Missing required attribute 'hashSalt'\", null, filePath, 0);\r\n\r\n                return _hashSalt = hashSalt;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            var sb = new StringBuilder();\r\n            var parameters = new[] { Width, Height, MaxWidth, MaxHeight, _qualityOverride };\r\n            var parameterNames = new[] { \"w\", \"h\", \"mw\", \"mh\", \"q\" };\r\n\r\n            for (var i = 0; i < parameters.Length; i++)\r\n            {\r\n                if (parameters[i] == null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                sb.Append(sb.Length == 0 ? String.Empty : \"&\");\r\n                sb.Append(parameterNames[i]).Append(\"=\").Append((int)parameters[i]);\r\n            }\r\n\r\n            if (ResizingAction != ResizingAction.Stretch)\r\n            {\r\n                sb.Append(sb.Length == 0 ? String.Empty : \"&\");\r\n                sb.Append(\"action=\").Append(ResizingAction.ToString().ToLowerInvariant());\r\n            }\r\n\r\n            if (!string.IsNullOrWhiteSpace(MediaType))\r\n            {\r\n                sb.Append(sb.Length == 0 ? String.Empty : \"&\");\r\n                sb.Append(\"mt=\").Append(MediaType);\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a secure hash for the current resizing options. The hash is salted with machine key and can be used to confirm that\r\n        /// an image URL with resizing options was generated by the website. \r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public string GetSecureHash(Guid mediaId)\r\n        {\r\n            var value = mediaId + this.ToString() + GetHashSalt();\r\n            var hash = HashingHelper.ComputeMD5Hash(value, Encoding.UTF8);\r\n            return hash.ToString().Substring(0, 5);\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Core/WebClient/MediaUrlHelper.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Routing.InternalUrlConverters;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class MediaUrlHelper\r\n    {\r\n        private static readonly string DefaultMediaStore = \"MediaArchive\";\r\n\r\n        private static readonly int MediaFileCacheSize = 2000;\r\n        private static readonly Cache<string, ExtendedNullable<IMediaFile>> _mediaFileCache = new Cache<string, ExtendedNullable<IMediaFile>>(\"Media files\", MediaFileCacheSize);\r\n\r\n        static MediaUrlHelper()\r\n        {\r\n            void OnMediaFileChanged(object sender, DataEventArgs args)\r\n            {\r\n                if (args.Data is IMediaFile mediaFile)\r\n                {\r\n                    _mediaFileCache.Remove(GetCacheKey(mediaFile.StoreId, mediaFile.Id));\r\n                }\r\n                if (args.Data is IMediaFileData mediaFileData)\r\n                {\r\n                    _mediaFileCache.Remove(GetCacheKey(DefaultMediaStore, mediaFileData.Id));\r\n                }\r\n            }\r\n\r\n            void OnStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n            {\r\n                if (!storeEventArgs.DataEventsFired)\r\n                {\r\n                    _mediaFileCache.Clear();\r\n                }\r\n            }\r\n\r\n            DataEvents<IMediaFile>.OnAfterAdd += OnMediaFileChanged;\r\n            DataEvents<IMediaFile>.OnAfterUpdate += OnMediaFileChanged;\r\n            DataEvents<IMediaFile>.OnDeleted += OnMediaFileChanged;\r\n            DataEvents<IMediaFile>.OnStoreChanged += OnStoreChanged;\r\n\r\n            DataEvents<IMediaFileData>.OnAfterAdd += OnMediaFileChanged;\r\n            DataEvents<IMediaFileData>.OnAfterUpdate += OnMediaFileChanged;\r\n            DataEvents<IMediaFileData>.OnDeleted += OnMediaFileChanged;\r\n            DataEvents<IMediaFileData>.OnStoreChanged += OnStoreChanged;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetUrl(IMediaFile file) => GetUrl(file, true, false);\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetUrl(IMediaFile file, bool isInternal) => GetUrl(file, isInternal, false);\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetUrl(IMediaFile file, bool isInternal, bool downloadableMedia)\r\n        {\r\n            string url = MediaUrls.BuildUrl(file, isInternal ? UrlKind.Internal : UrlKind.Public);\r\n\r\n            if (!downloadableMedia) return url;\r\n\r\n            var urlBuilder = new UrlBuilder(url)\r\n            {\r\n                [\"download\"] = \"true\"\r\n            };\r\n\r\n            return urlBuilder.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IMediaFile GetFileFromQueryString(NameValueCollection queryParameters)\r\n        {\r\n            Verify.ArgumentNotNull(queryParameters, nameof(queryParameters));\r\n\r\n            string idStr = queryParameters[\"id\"];\r\n\r\n            // In order to support old-style queries, checking composite path in \"i\" and \"src\" query parameters\r\n            string compositePath = queryParameters[\"i\"];\r\n            if (compositePath.IsNullOrEmpty())\r\n            {\r\n                compositePath = queryParameters[\"src\"];\r\n                if (compositePath.IsNullOrEmpty()\r\n                    && idStr != null && idStr.Contains(\":\"))\r\n                {\r\n                    compositePath = idStr;\r\n                }\r\n            }\r\n\r\n            string storeId;\r\n            IMediaFile result;\r\n\r\n            if (!compositePath.IsNullOrEmpty())\r\n            {\r\n                // Parsing a friendly media url\r\n                int separatorIndex = compositePath.IndexOf(\":\", System.StringComparison.Ordinal);\r\n                if (separatorIndex < 0 || separatorIndex == compositePath.Length - 1) throw new InvalidOperationException();\r\n\r\n                storeId = compositePath.Substring(0, separatorIndex);\r\n                string secondPart = compositePath.Substring(separatorIndex + 1);\r\n\r\n                try\r\n                {\r\n                    if (Guid.TryParse(secondPart, out Guid fileId))\r\n                    {\r\n                        result = GetFileById(storeId, fileId);\r\n                    }\r\n                    else\r\n                    {\r\n                        compositePath = compositePath.Replace(\"://\", \":/\");\r\n\r\n                        result = GetFileByCompositePath(storeId, compositePath);\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw new FileNotFoundException($\"File '{compositePath}' was not found.\", ex);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                // Parsing an internal media url\r\n                storeId = queryParameters[\"store\"] ?? DefaultMediaStore;\r\n\r\n                if (storeId.IsNullOrEmpty() || idStr.IsNullOrEmpty())\r\n                {\r\n                    throw new InvalidOperationException(\"Missing id from query\");\r\n                }\r\n\r\n                Guid id = new Guid(idStr);\r\n\r\n                try\r\n                {\r\n                    result = GetFileById(storeId, id);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw new FileNotFoundException($\"File not found. Storage: '{storeId}', Id: {id}\", ex);\r\n                }\r\n            }\r\n\r\n            return result ?? throw new FileNotFoundException(\"File not found.\");\r\n        }\r\n\r\n        internal static string GetCacheKey(string storeId, Guid fileId) => storeId + fileId;\r\n\r\n        internal static IMediaFile GetFileById(string storeId, Guid fileId)\r\n        {\r\n            string cacheKey = GetCacheKey(storeId, fileId);\r\n            var cachedValue = _mediaFileCache.Get(cacheKey);\r\n            if (cachedValue != null)\r\n            {\r\n                return cachedValue.Value;\r\n            }\r\n\r\n            using (new DataScope(DataScopeIdentifier.Public))\r\n            {\r\n                var query = DataFacade.GetData<IMediaFile>();\r\n\r\n                var result = query.IsEnumerableQuery()\r\n                    ? (query as IEnumerable<IMediaFile>).FirstOrDefault(f => f.Id == fileId && f.StoreId == storeId)\r\n                    : query.FirstOrDefault(f => f.StoreId == storeId && f.Id == fileId);\r\n\r\n                _mediaFileCache.Add(cacheKey, new ExtendedNullable<IMediaFile> { Value = result });\r\n\r\n                return result;\r\n            }\r\n\r\n        }\r\n\r\n        private static IMediaFile GetFileByCompositePath(string storeId, string compositePath)\r\n        {\r\n            using (new DataScope(DataScopeIdentifier.Public))\r\n            {\r\n                var query = DataFacade.GetData<IMediaFile>();\r\n\r\n                if (query.IsEnumerableQuery())\r\n                {\r\n                    return (query as IEnumerable<IMediaFile>)\r\n                        .FirstOrDefault(f => f.CompositePath == compositePath && f.StoreId == storeId);\r\n                }\r\n\r\n                return query\r\n                    .FirstOrDefault(f => f.StoreId == storeId && f.CompositePath == compositePath);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Guid.TryParse()\")]\r\n        public static bool IsValidGuid(string value) => Guid.TryParse(value, out _);\r\n\r\n\r\n        /// <exclude />\r\n        public static string ChangeInternalMediaUrlsToPublic(string content)\r\n        {\r\n            return InternalUrls.ConvertInternalUrlsToPublic(content, new[] { new MediaInternalUrlConverter() });\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/PageStructureRpc.cs",
    "content": "﻿using Composite.Core.Application;\r\nusing Composite.Core.WebClient.Services.WampRouter;\r\nusing Composite.Plugins.Components.ComponentsEndpoint;\r\nusing Composite.Plugins.Search.Endpoint;\r\nusing WampSharp.V2.Rpc;\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    [ApplicationStartup]\r\n    class ComponentsEndpoint\r\n    {\r\n        public static void OnInitialized()\r\n        {\r\n            WampRouterFacade.RegisterCallee(new PageStructureRpc());\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Rpcs related to page structure\r\n    /// </summary>\r\n    public class PageStructureRpc : IRpcService\r\n    {\r\n        /// <summary>\r\n        /// To get page structure by its name\r\n        /// </summary>\r\n        /// <returns>Page structure</returns>\r\n        [WampProcedure(\"structure.page\")]\r\n        public object Get(string name)\r\n        {\r\n            // TODO: use an interface to resolve a page structure object\r\n            if (name == \"search\")\r\n            {\r\n                return new ConsoleSearchPageStructure();\r\n            }\r\n\r\n            return new ComponentsResponseMessage();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/PageUrlHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Plugins.Routing.InternalUrlConverters;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Obsolete(\"Use 'Composite.Data' namespace instead\")]\r\n    public sealed class PageUrlOptions\r\n    {\r\n        /// <exclude />\r\n        public PageUrlOptions(string dataScopeIdentifierName, CultureInfo locale, Guid pageId) :\r\n            this(dataScopeIdentifierName, locale, pageId, UrlType.Undefined)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public PageUrlOptions(string dataScopeIdentifierName, CultureInfo locale, Guid pageId, UrlType urlType)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(dataScopeIdentifierName, \"dataScopeIdentifierName\");\r\n            Verify.ArgumentNotNull(locale, \"locale\");\r\n            Verify.ArgumentCondition(pageId != Guid.Empty, \"pageId\", \"PageId should not be an empty guid.\");\r\n\r\n            DataScopeIdentifierName = dataScopeIdentifierName;\r\n            Locale = locale;\r\n            PageId = pageId;\r\n            UrlType = urlType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public UrlType UrlType { get; private set; }\r\n\r\n        /// <exclude />\r\n        public string DataScopeIdentifierName { get; private set; }\r\n\r\n        /// <exclude />\r\n        public CultureInfo Locale { get; private set; }\r\n\r\n        /// <exclude />\r\n        public Guid PageId { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public DataScopeIdentifier DataScopeIdentifier\r\n        {\r\n            get { return DataScopeIdentifier.Deserialize(DataScopeIdentifierName); }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IPage GetPage()\r\n        {\r\n            var dataScope = DataScopeIdentifier.Deserialize(DataScopeIdentifierName);\r\n            using (new DataScope(dataScope, Locale))\r\n            {\r\n                return PageManager.GetPageById(PageId);\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Obsolete(\"Use 'Composite.Data' namespace instead\")]\r\n    public enum UrlType\r\n    {\r\n        /// <exclude />\r\n        Undefined = 0,\r\n\r\n        /// <exclude />\r\n        Public = 1,\r\n\r\n        /// <exclude />\r\n        Internal = 2,\r\n\r\n        /// <exclude />\r\n        Friendly = 3\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PageUrlHelper\r\n    {\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Data.PageUrl instead\")]\r\n        public static PageUrlOptions ParseUrl(string url)\r\n        {\r\n            var urlString = new UrlString(url);\r\n            return IsPublicUrl(urlString) ? ParsePublicUrl(url) : ParseInternalUrl(url);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Data.PageUrl instead\")]\r\n        public static PageUrlOptions ParseUrl(string url, out NameValueCollection notUsedQueryStringParameters)\r\n        {\r\n            return IsPublicUrl(url) \r\n                ? ParsePublicUrl(url, out notUsedQueryStringParameters)\r\n                : ParseInternalUrl(url, out notUsedQueryStringParameters);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Data.PageUrl instead\")]\r\n        public static PageUrlOptions ParseInternalUrl(string url)\r\n        {\r\n            NameValueCollection notUsedQueryStringParameters;\r\n            return ParseInternalUrl(url, out notUsedQueryStringParameters);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Data.PageUrl instead\")]\r\n        public static PageUrlOptions ParseInternalUrl(string url, out NameValueCollection notUsedQueryStringParameters)\r\n        {\r\n            var urlString = new UrlString(url);\r\n\r\n            return ParseQueryString(urlString.GetQueryParameters(), out notUsedQueryStringParameters);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Data.PageUrl instead\")]\r\n        public static PageUrlOptions ParsePublicUrl(string url)\r\n        {\r\n            NameValueCollection notUsedQueryParameters;\r\n            return ParsePublicUrl(url, out notUsedQueryParameters);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Data.PageUrl instead\")]\r\n        public static PageUrlOptions ParsePublicUrl(string url, out NameValueCollection notUsedQueryParameters)\r\n        {\r\n            var urlString = new UrlString(url);\r\n\r\n            notUsedQueryParameters = null;\r\n            if (!IsPublicUrl(urlString.FilePath))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string requestPath;\r\n            Uri uri;\r\n\r\n            if (Uri.TryCreate(urlString.FilePath, UriKind.Absolute, out uri))\r\n            {\r\n                requestPath = HttpUtility.UrlDecode(uri.AbsolutePath).ToLower();\r\n            }\r\n            else\r\n            {\r\n                requestPath = urlString.FilePath.ToLower();\r\n            }\r\n\r\n            string requestPathWithoutUrlMappingName;\r\n            CultureInfo locale = PageUrl.GetCultureInfo(requestPath, out requestPathWithoutUrlMappingName);\r\n\r\n            if (locale == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string dataScopeName = urlString[\"dataScope\"];\r\n\r\n            if(dataScopeName.IsNullOrEmpty())\r\n            {\r\n                dataScopeName = DataScopeIdentifier.GetDefault().Name;\r\n            }\r\n\r\n            Guid pageId = Guid.Empty;\r\n            using (new DataScope(DataScopeIdentifier.Deserialize(dataScopeName), locale))\r\n            {\r\n                if (PageStructureInfo.GetLowerCaseUrlToIdLookup().TryGetValue(requestPath.ToLower(), out pageId) == false)\r\n                {\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            urlString[\"dataScope\"] = null;\r\n\r\n            notUsedQueryParameters = urlString.GetQueryParameters();\r\n\r\n            return new PageUrlOptions(dataScopeName, locale, pageId, UrlType.Public);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"To be removed\")]\r\n        public static CultureInfo GetCultureInfo(string requestPath)\r\n        {\r\n            string newRequestPath;\r\n\r\n            return PageUrl.GetCultureInfo(requestPath, out newRequestPath);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"To be removed\")]\r\n        public static CultureInfo GetCultureInfo(string requestPath, out string requestPathWithoutUrlMappingName)\r\n        {\r\n            return PageUrl.GetCultureInfo(requestPath, out requestPathWithoutUrlMappingName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"To be removed\")]\r\n        public static bool IsPublicUrl(string relativePath)\r\n        {\r\n            relativePath = relativePath.ToLower();\r\n\r\n            return relativePath.Contains(\".aspx\")\r\n                   && !relativePath.Contains(\"/renderers/page.aspx\")\r\n                   && !IsAdminPath(relativePath);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"To be removed\")]\r\n        public static bool IsPublicUrl(UrlString url)\r\n        {\r\n            return IsPublicUrl(url.FilePath);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsInternalUrl(string url)\r\n        {\r\n            return IsInternalUrl(new UrlBuilder(url));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"To be removed\")]\r\n        public static bool IsInternalUrl(UrlString url)\r\n        {\r\n            return url.FilePath.EndsWith(\"Renderers/Page.aspx\", true);\r\n        }\r\n\r\n        private static bool IsInternalUrl(UrlBuilder url)\r\n        {\r\n            return url.FilePath.EndsWith(\"Renderers/Page.aspx\", true);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Data.PageUrl.Build() instead\")]\r\n        public static UrlString BuildUrl(PageUrlOptions options)\r\n        {\r\n            Verify.ArgumentNotNull(options, \"options\");\r\n            Verify.ArgumentCondition(options.UrlType != UrlType.Undefined, \"options\", \"Url type is undefined\");\r\n\r\n            return BuildUrl(options.UrlType, options);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"To be removed\")]\r\n        public static bool IsAdminPath(string relativeUrl)\r\n        {\r\n            return string.Compare(relativeUrl, UrlUtils.AdminRootPath, true) == 0\r\n                   || relativeUrl.StartsWith(UrlUtils.AdminRootPath + \"/\", true);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Data.PageUrl.Build() instead\")]\r\n        public static UrlString BuildUrl(UrlType urlType, PageUrlOptions options)\r\n        {\r\n            Verify.ArgumentNotNull(options, \"options\");\r\n\r\n            Verify.ArgumentCondition(urlType != UrlType.Undefined, \"urlType\", \"Url type is undefined\"); \r\n\r\n            if (urlType == UrlType.Public)\r\n            {\r\n                var lookupTable = PageStructureInfo.GetIdToUrlLookup(options.DataScopeIdentifierName, options.Locale);\r\n\r\n                if (!lookupTable.ContainsKey(options.PageId))\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                var publicUrl = new UrlString(lookupTable[options.PageId]);\r\n                if(options.DataScopeIdentifierName != DataScopeIdentifier.GetDefault().Name)\r\n                {\r\n                    publicUrl[\"dataScope\"] = options.DataScopeIdentifierName;\r\n                }\r\n\r\n                return publicUrl;\r\n            }\r\n\r\n            if(urlType == UrlType.Internal)\r\n            {\r\n                string basePath = UrlUtils.ResolvePublicUrl(\"Renderers/Page.aspx\");\r\n                var result = new UrlString(basePath);\r\n\r\n                result[\"pageId\"] = options.PageId.ToString();\r\n                result[\"cultureInfo\"] = options.Locale.ToString();\r\n                result[\"dataScope\"] = options.DataScopeIdentifierName;\r\n\r\n                return result;\r\n            }\r\n\r\n            throw new NotImplementedException(\"BuildUrl function supports only 'Public' and 'Unternal' urls.\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"To be removed, use Composite.Data.PageUrl.TryParseFriendlyUrl(...) instead\")]\r\n        public static bool TryParseFriendlyUrl(string relativeUrl, out PageUrlOptions urlOptions)\r\n        {\r\n            if (IsAdminPath(relativeUrl))\r\n            {\r\n                urlOptions = null;\r\n                return false;\r\n            }\r\n\r\n            string path;\r\n            CultureInfo cultureInfo = PageUrl.GetCultureInfo(relativeUrl, out path);\r\n            if (cultureInfo == null)\r\n            {\r\n                urlOptions = null;\r\n                return false;\r\n            }\r\n\r\n            string loweredRelativeUrl = relativeUrl.ToLower(CultureInfo.InvariantCulture);\r\n\r\n            // Getting the site map\r\n            IEnumerable<XElement> siteMap;\r\n            DataScopeIdentifier dataScope = DataScopeIdentifier.GetDefault();\r\n            using (new DataScope(dataScope, cultureInfo))\r\n            {\r\n                siteMap = PageStructureInfo.GetSiteMap();\r\n            }\r\n\r\n            XAttribute matchingAttributeNode = siteMap.DescendantsAndSelf()\r\n                .Attributes(\"FriendlyUrl\")\r\n                .FirstOrDefault(f => string.Equals(f.Value, loweredRelativeUrl, StringComparison.OrdinalIgnoreCase));\r\n            \r\n            if(matchingAttributeNode == null)\r\n            {\r\n                urlOptions = null;\r\n                return false;\r\n            }\r\n            \r\n            XElement pageNode = matchingAttributeNode.Parent;\r\n\r\n            XAttribute pageIdAttr = pageNode.Attributes(\"Id\").FirstOrDefault();\r\n            Verify.IsNotNull(pageIdAttr, \"Failed to get 'Id' attribute from the site map\"); \r\n            Guid pageId = new Guid(pageIdAttr.Value);\r\n\r\n            urlOptions = new PageUrlOptions(dataScope.Name, cultureInfo, pageId, UrlType.Friendly);\r\n            return true;\r\n        }\r\n\r\n        /// <summary>\r\n        /// To be used for handling 'internal' links.\r\n        /// </summary>\r\n        /// <param name=\"queryString\">Query string.</param>\r\n        /// <param name=\"notUsedQueryParameters\">Query string parameters that were not used.</param>\r\n        /// <returns></returns>\r\n        [Obsolete(\"To be removed. Use Composite.Core.Routing.PageUrls instead.\")]\r\n        public static PageUrlOptions ParseQueryString(NameValueCollection queryString, out NameValueCollection notUsedQueryParameters)\r\n        {\r\n\t\t\tif (string.IsNullOrEmpty(queryString[\"pageId\"])) throw new InvalidOperationException(\"Invalid query string. The 'pageId' parameter of the GUID type is expected.\");\r\n\r\n            string dataScopeName = queryString[\"dataScope\"] ?? DataScopeIdentifier.PublicName;\r\n\r\n            string cultureInfoStr = queryString[\"cultureInfo\"];\r\n            if(cultureInfoStr.IsNullOrEmpty())\r\n            {\r\n                cultureInfoStr = queryString[\"CultureInfo\"];\r\n            }\r\n\r\n            CultureInfo cultureInfo;\r\n            if (!cultureInfoStr.IsNullOrEmpty())\r\n            {\r\n                cultureInfo = new CultureInfo(cultureInfoStr);\r\n            }\r\n            else\r\n            {\r\n                cultureInfo = LocalizationScopeManager.CurrentLocalizationScope;\r\n                if(cultureInfo.Equals(CultureInfo.InvariantCulture))\r\n                {\r\n                    cultureInfo = DataLocalizationFacade.DefaultLocalizationCulture;\r\n                }\r\n            }\r\n\r\n            Guid pageId = new Guid(queryString[\"pageId\"]);\r\n\r\n            notUsedQueryParameters = new NameValueCollection();\r\n\r\n            var queryKeys = new[] { \"pageId\", \"dataScope\", \"cultureInfo\", \"CultureInfo\" };\r\n            var notUsedKeys = queryString.AllKeys.Where(key => !queryKeys.Contains(key, StringComparer.InvariantCultureIgnoreCase));\r\n\r\n            foreach (string key in notUsedKeys)\r\n            {\r\n                notUsedQueryParameters.Add(key, queryString[key]);\r\n            }\r\n\r\n            return new PageUrlOptions(dataScopeName, cultureInfo, pageId, UrlType.Internal);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string ChangeRenderingPageUrlsToPublic(string html)\r\n        {\r\n            return InternalUrls.ConvertInternalUrlsToPublic(html, new[] {new PageInternalUrlConverter()});\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// \"PathInfo\" it is a part between aspx page path\r\n        /// </summary>\r\n        /// <param name=\"url\"></param>\r\n        /// <returns></returns>\r\n        internal static string GetPathInfoFromInternalUrl(string url)\r\n        {\r\n            // From string \".../Renderers/Page.aspx/AAAA/VVV/CCC?pageId=...\" will extract \"/AAAA/VVV/CCC\"\r\n            int aspxOffset = url.IndexOf(\".aspx\", StringComparison.Ordinal);\r\n\r\n            if(url[aspxOffset + 5] == '?') return null;\r\n\r\n            return url.Substring(aspxOffset + 5, url.IndexOf('?', aspxOffset + 6) - aspxOffset - 5);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/PhantomJs/PhantomServer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.Serialization.Json;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Parallelization;\r\n\r\nnamespace Composite.Core.WebClient.PhantomJs\r\n{\r\n    /// <summary> \r\n    /// Contains information about currently running instance of a PhantomJS server\r\n    /// </summary>\r\n    internal class PhantomServer : IDisposable\r\n    {\r\n        private const string LogTitle = nameof(PhantomServer);\r\n        private const string EndOfReplyMarker = \"END_OF_REPLY\";\r\n\r\n        const string ConfigFileName = \"config.json\";\r\n        const string ScriptFileName = \"renderingServer.js\";\r\n        static readonly string _phantomJsFolder = HostingEnvironment.MapPath(\"~/App_Data/Composite/PhantomJs\");\r\n        static readonly string _phantomJsPath = Path.Combine(_phantomJsFolder, \"phantomjs.exe\");\r\n\r\n\r\n        private readonly StreamWriter _stdin;\r\n        private readonly StreamReader _stdout;\r\n        private readonly StreamReader _stderror;\r\n\r\n        private readonly Process _process;\r\n        private readonly Job _job;\r\n\r\n        private static PhantomServer _instance;\r\n        private static readonly AsyncLock _instanceAsyncLock = new AsyncLock();\r\n\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        private PhantomServer()\r\n        {\r\n            var tempDirectory = PathUtil.Resolve(GlobalSettingsFacade.TempDirectory);\r\n            var cachePath = Path.Combine(tempDirectory, \"phantomjs_cache\");\r\n            var localStoragePath = Path.Combine(tempDirectory, \"phantomjs_ls\");\r\n\r\n            _process = new Process\r\n            {\r\n                StartInfo =\r\n                    {\r\n                        WorkingDirectory = _phantomJsFolder,\r\n                        FileName = \"\\\"\" + _phantomJsPath + \"\\\"\",\r\n                        Arguments = $\"\\\"--local-storage-path={localStoragePath}\\\" \\\"--disk-cache-path={cachePath}\\\" --config={ConfigFileName} {ScriptFileName}\",\r\n                        RedirectStandardOutput = true,\r\n                        RedirectStandardError = true,\r\n                        RedirectStandardInput = true,\r\n                        CreateNoWindow = true,\r\n                        StandardOutputEncoding = Encoding.UTF8,\r\n                        UseShellExecute = false,\r\n                        WindowStyle = ProcessWindowStyle.Hidden\r\n                    }\r\n            };\r\n\r\n            _process.Start();\r\n\r\n            _stdin = _process.StandardInput;\r\n            _stdout = _process.StandardOutput;\r\n            _stderror = _process.StandardError;\r\n            _stdin.AutoFlush = true;\r\n\r\n            _job = new Job();\r\n            _job.AddProcess(_process.Handle);\r\n        }\r\n\r\n\r\n        public static void ShutDown(bool alreadyLocked, bool silent = false)\r\n        {\r\n            PhantomServer ps;\r\n\r\n            using (alreadyLocked ? null : _instanceAsyncLock.Lock())\r\n            {\r\n                if (_instance == null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                ps = _instance;\r\n                _instance = null;\r\n            }\r\n\r\n            ps.DisposeInternal(silent);\r\n            GC.SuppressFinalize(ps);\r\n        }\r\n\r\n\r\n        // Ensures that an instance have been started\r\n        //public async static Task StartAsync()\r\n        //{\r\n        //    using (await _instanceAsyncLock.LockAsync())\r\n        //    {\r\n        //        var instance = PhantomServer.Instance;\r\n        //    }\r\n        //}\r\n\r\n\r\n        private static PhantomServer Instance\r\n        {\r\n            get\r\n            {\r\n                return _instance ?? (_instance = new PhantomServer());\r\n            }\r\n        }\r\n\r\n\r\n        public static async Task<RenderingResult> RenderUrlAsync(HttpCookie[] cookies, string url, string outputImageFilePath, string mode)\r\n        {\r\n            url = url.Replace(\" \", \"%20\"); // Preventing a redirect in PhantomJS\r\n\r\n            using (await _instanceAsyncLock.LockAsync())\r\n            {\r\n                var renderingResult = Instance.RenderUrlImpl(cookies, url, outputImageFilePath, mode);\r\n\r\n                if (renderingResult.Status == RenderingResultStatus.PhantomServerTimeout\r\n                    || renderingResult.Status == RenderingResultStatus.PhantomServerIncorrectResponse\r\n                    || renderingResult.Status == RenderingResultStatus.PhantomServerNoOutput)\r\n                {\r\n                    Log.LogWarning(LogTitle, \"Shutting down PhantomJs server. Reason: {0}, Output: {1}\", \r\n                        renderingResult.Status, string.Join(Environment.NewLine, renderingResult.Output));\r\n\r\n                    try\r\n                    {\r\n                        ShutDown(true);\r\n                    }\r\n                    catch (Exception shutdownException)\r\n                    {\r\n                        Log.LogError(LogTitle, shutdownException);\r\n                    }\r\n                }\r\n\r\n                return renderingResult;\r\n            }\r\n        }\r\n\r\n        private bool IsEndOfReply(string line)\r\n        {\r\n            return line.StartsWith(EndOfReplyMarker);\r\n        }\r\n\r\n\r\n        private RenderingResult RenderUrlImpl(HttpCookie[] cookies, string url, string outputImageFilePath, string mode)\r\n        {\r\n            Verify.ArgumentNotNull(cookies, nameof(cookies));\r\n\r\n            string cookieDomain = new Uri(url).Host;\r\n\r\n            var request = new RenderPreviewRequest\r\n            {\r\n                requestId = \"1\",\r\n                mode = mode,\r\n                url = url,\r\n                outputFilePath = outputImageFilePath,\r\n                cookies = cookies.Select(cookie => new CookieInformation\r\n                {\r\n                    name = cookie.Name,\r\n                    value = cookie.Value,\r\n                    domain = cookieDomain\r\n                }).ToArray()\r\n            };\r\n\r\n            var ms = new MemoryStream();\r\n            var ser = new DataContractJsonSerializer(typeof(RenderPreviewRequest));\r\n            ser.WriteObject(ms, request);\r\n\r\n            var json = Encoding.UTF8.GetString(ms.ToArray());\r\n\r\n            var output = new List<string>();\r\n\r\n            Task readerTask = Task.Run(() =>\r\n            {\r\n                _stdin.WriteLine(json);\r\n\r\n                string line;\r\n\r\n                do\r\n                {\r\n                    line = _stdout.ReadLine();\r\n                    lock (output)\r\n                    {\r\n                        output.Add(line);\r\n                    }\r\n\r\n                } while (!IsEndOfReply(line));\r\n            });\r\n\r\n            var secondsSinceStartup = (DateTime.Now - _process.StartTime).TotalSeconds;\r\n            double timeout = secondsSinceStartup < 120 || mode == \"test\" ? 65 : 30;\r\n\r\n            readerTask.Wait(TimeSpan.FromSeconds(timeout));\r\n\r\n            // TODO: check for theother task statuses\r\n            switch (readerTask.Status)\r\n            {\r\n                case TaskStatus.RanToCompletion:\r\n                    if (output.Count == 0)\r\n                    {\r\n                        return new RenderingResult\r\n                        {\r\n                            Status = RenderingResultStatus.PhantomServerNoOutput,\r\n                            Output = new [] { \"(null)\" }\r\n                        };\r\n                    }\r\n                    break;\r\n                default:\r\n                    string[] outputCopy;\r\n                    lock (output)\r\n                    {\r\n                        outputCopy = output.ToArray();\r\n                    }\r\n\r\n                    string logMessage = \"Request failed to complete within expected time: \" +\r\n#if DEBUG\r\n                        json\r\n#else\r\n                                url + \" \" + mode\r\n#endif\r\n                        ;\r\n\r\n\r\n                    return new RenderingResult\r\n                    {\r\n                        Status = RenderingResultStatus.PhantomServerTimeout,\r\n                        Output = new [] { logMessage}.Concat(outputCopy).ToArray(),\r\n                        FilePath = outputImageFilePath\r\n                    };\r\n            }\r\n\r\n            if (C1File.Exists(outputImageFilePath))\r\n            {\r\n                return new RenderingResult\r\n                {\r\n                    Status = RenderingResultStatus.Success,\r\n                    Output = output,\r\n                    FilePath = outputImageFilePath\r\n                };\r\n            }\r\n\r\n            var lastMessage = output.Last();\r\n\r\n            if (!lastMessage.StartsWith(EndOfReplyMarker))\r\n            {\r\n                Log.LogError(LogTitle, $\"Missing {EndOfReplyMarker} in the response\");\r\n            }\r\n\r\n            string redirectUrl = null;\r\n            RenderingResultStatus? status = null;\r\n\r\n            foreach (var line in output)\r\n            {\r\n                const string redirectResponsePrefix = \"REDIRECT: \";\r\n\r\n                if (line == \"SUCCESS\")\r\n                {\r\n                    status = RenderingResultStatus.Success;\r\n                }\r\n                else if (line.StartsWith(redirectResponsePrefix))\r\n                {\r\n                    status = RenderingResultStatus.Redirect;\r\n                    redirectUrl = line.Substring(redirectResponsePrefix.Length);\r\n                }\r\n                else if (line.StartsWith(\"TIMEOUT: \"))\r\n                {\r\n                    status = RenderingResultStatus.Timeout;\r\n                }\r\n                else if (line.StartsWith(\"ERROR: \"))\r\n                {\r\n                    status = RenderingResultStatus.Error;\r\n                }\r\n            }\r\n\r\n            status = status ?? RenderingResultStatus.PhantomServerIncorrectResponse;\r\n\r\n            return new RenderingResult\r\n            {\r\n                Status = status.Value,\r\n                Output = output,\r\n                RedirectUrl = redirectUrl\r\n            };\r\n        }\r\n\r\n        public static string ScriptFilePath\r\n        {\r\n            get { return Path.Combine(_phantomJsFolder, ScriptFileName); }\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n            GC.SuppressFinalize(this);\r\n        }\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n#endif\r\n        ~PhantomServer()\r\n        {\r\n#if LeakCheck\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n#endif\r\n            // Finalizer calls Dispose(false)\r\n            Dispose(false);\r\n        }\r\n\r\n        void Dispose(bool disposing)\r\n        {\r\n            if (!disposing)\r\n            {\r\n                return;\r\n            }\r\n\r\n            DisposeInternal(false);\r\n        }\r\n\r\n        void DisposeInternal(bool silent)\r\n        {\r\n            bool processHasExited;\r\n\r\n            try\r\n            {\r\n                processHasExited = _process.HasExited;\r\n            }\r\n            catch (Exception)\r\n            {\r\n                processHasExited = true;\r\n            }\r\n\r\n            if (!processHasExited)\r\n            {\r\n                _stdin.WriteLine(\"exit\");\r\n            }\r\n\r\n            bool streamsClosed = false;\r\n\r\n            Task<string> errorFeedbackTask = null;\r\n            string processOutputSummary = null;\r\n\r\n            if (!silent)\r\n            {\r\n                errorFeedbackTask = Task.Factory.StartNew(() =>\r\n                {\r\n                    try\r\n                    {\r\n                        if (streamsClosed)\r\n                        {\r\n                            // Simplifies debugging\r\n                            return null;\r\n                        }\r\n\r\n                        string stdOut = _stdout.ReadToEnd();\r\n                        string stdError = _stderror.ReadToEnd();\r\n\r\n                        string result = !string.IsNullOrEmpty(stdOut) ? $\"stdout: '{stdOut}'\" : \"\";\r\n\r\n                        if (!string.IsNullOrWhiteSpace(stdError))\r\n                        {\r\n                            if (result.Length > 0) { result += Environment.NewLine; }\r\n\r\n                            result += $\"stderr: {stdError}\";\r\n                        }\r\n\r\n                        return result;\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        return ex.Message;\r\n                    }\r\n                });\r\n\r\n\r\n                errorFeedbackTask.Wait(500);\r\n\r\n                processOutputSummary = errorFeedbackTask.Status == TaskStatus.RanToCompletion ? errorFeedbackTask.Result : \"Process Hang\";\r\n            }\r\n\r\n            if (!processHasExited)\r\n            {\r\n                try\r\n                {\r\n                    processHasExited = _process.HasExited;\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    processHasExited = true;\r\n                }\r\n\r\n                if (!processHasExited)\r\n                {\r\n                    streamsClosed = true;\r\n\r\n                    _stdin.Close();\r\n                    _stdout.Close();\r\n                    _stderror.Close();\r\n                    _process.Kill();\r\n                    _process.WaitForExit(500);\r\n                }\r\n            }\r\n\r\n            int exitCode = _process.ExitCode;\r\n\r\n            streamsClosed = true;\r\n\r\n            _stdin.Dispose();\r\n            _stdout.Dispose();\r\n            _stderror.Dispose();\r\n\r\n            _process.Dispose();\r\n            _job.Dispose();\r\n\r\n            bool meaningfullExitCode = exitCode != 0 && exitCode != -1073741819 /* Access violation, the ExitCode property returns this value by default for some reason */;\r\n\r\n            if (silent)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (meaningfullExitCode\r\n                || errorFeedbackTask.Status != TaskStatus.RanToCompletion\r\n                || !string.IsNullOrEmpty(processOutputSummary))\r\n            {\r\n                string errorMessage = \"Error executing PhantomJs.exe\";\r\n                if (meaningfullExitCode) errorMessage += \"; Exit code: {0}\".FormatWith(exitCode);\r\n\r\n                if (!string.IsNullOrEmpty(processOutputSummary))\r\n                {\r\n                    errorMessage += Environment.NewLine + processOutputSummary;\r\n                }\r\n                throw new InvalidOperationException(errorMessage);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/PhantomJs/RenderPreviewRequest.cs",
    "content": "﻿using System.Runtime.Serialization;\r\n\r\nnamespace Composite.Core.WebClient.PhantomJs\r\n{\r\n    [DataContract]\r\n    internal class CookieInformation\r\n    {\r\n        [DataMember]\r\n        public string name { get; set; }\r\n\r\n        [DataMember]\r\n        public string value { get; set; }\r\n\r\n        [DataMember]\r\n        public string domain { get; set; }\r\n    }\r\n\r\n    [DataContract]\r\n    internal class RenderPreviewRequest\r\n    {\r\n        [DataMember]\r\n        public string requestId { get; set; }\r\n\r\n        [DataMember]\r\n        public string mode { get; set; }\r\n\r\n        [DataMember]\r\n        public string url { get; set; }\r\n\r\n        [DataMember]\r\n        public string outputFilePath { get; set; }\r\n\r\n        [DataMember]\r\n        public CookieInformation[] cookies { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/PhantomJs/RenderingResult.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.Core.WebClient.PhantomJs\r\n{\r\n    internal class RenderingResult\r\n    {\r\n        public RenderingResultStatus Status { get; set; }\r\n        public string FilePath { get; set; }\r\n        public ICollection<string> Output { get; set; }\r\n        public string RedirectUrl { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/PhantomJs/RenderingResultStatus.cs",
    "content": "﻿namespace Composite.Core.WebClient.PhantomJs\r\n{\r\n    internal enum RenderingResultStatus\r\n    {\r\n        Success = 0,\r\n        Redirect = 1,\r\n        Error = 2,\r\n        Timeout = 3,\r\n        PhantomServerTimeout = 4,\r\n        PhantomServerIncorrectResponse = 5,\r\n        PhantomServerNoOutput = 6\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Presentation/CssRequestHandler.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.Core.IO;\r\n\r\n/*\r\n * Important notice: This setup has been hardwired to handle MY personal \r\n * CSS authoring preferences (formatting and indentation etc). Also notice \r\n * that the excecptionhanding is currently miserable, CSS author can easily \r\n * fire an indexOutOfBounds and stuff. For now, please use my precise syntax.\r\n */\r\n\r\n\r\nnamespace Composite.Core.WebClient.Presentation\r\n{\r\n    class CssRequestHandler : IHttpHandler\r\n    {\r\n    \r\n    \t// carries browser and platform info\r\n\t\tprivate class User\r\n\t\t{\r\n            public bool\r\n                isMozilla = false,\r\n                isWebKit = false,\r\n                isOpera = false,\r\n                isIE = false,\r\n                isIE6 = false,\r\n                isIE7 = false,\r\n                isIE8 = false,\r\n                isIE9 = false,\r\n                isVista = false,\r\n                isOSX = false,\r\n                isDefault = false;\r\n\t\t\t\t\r\n\t\t\tpublic User(HttpContext context)\r\n\t\t\t{\r\n                string agent = context.Request.UserAgent ?? string.Empty;\r\n\r\n\t\t\t\tthis.isIE = agent.Contains(\"MSIE\")/* || agent.Contains(\"Trident\")*/;\r\n                this.isIE6 = agent.Contains(\"MSIE 6\");\r\n                this.isIE7 = agent.Contains(\"MSIE 7\");\r\n                this.isIE8 = agent.Contains(\"MSIE 8\");\r\n                this.isIE9 = agent.Contains(\"MSIE 9\");\r\n                \r\n                this.isWebKit = agent.Contains ( \"WebKit\" );\r\n                this.isOpera = agent.Contains ( \"Opera\" );\r\n                \r\n                // NOTE: WEBKIT AND OPERA IS MOZILLA FOR NOW!!!\r\n                this.isMozilla = !this.isIE; // && !this.isWebKit && !this.isOpera;\r\n\t\t\t\t\r\n\t\t\t\t// analyze os\r\n                this.isVista = agent.Contains(\"NT 6\"); // Windows7 now counts as Vista!\r\n                this.isOSX = agent.Contains(\"OS X\");\r\n\t\t\t\tthis.isDefault = !this.isVista && !this.isOSX;\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n                // analyze browser\r\n\t\t\t\tthis.isMozilla = agent.Contains(\"Gecko\");\r\n                this.isIE = !this.isMozilla;\r\n                this.isIE6 = this.isIE && agent.Contains(\"MSIE 6\");\r\n                this.isIE7 = this.isIE && agent.Contains(\"MSIE 7\");\r\n                this.isIE8 = this.isIE && agent.Contains(\"MSIE 8\");\r\n                this.isIE9 = this.isIE && agent.Contains(\"MSIE 9\");\r\n\t\t\t\t*/\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// stores various variables while iterating lines\r\n        private class State\r\n        {\r\n            public string rootPath { get; private set; }\r\n            public string skinPath { get; private set; }\r\n            public string folderPath { get; private set; }\r\n\t\t\tpublic bool isValid = true;\r\n\t\t\t\r\n            public State(HttpContext context)\r\n            {\r\n                // the root of the administratin console\r\n                this.rootPath = UrlUtils.AdminRootPath;\r\n\r\n                // the root of the skin folder - hardcoded for now\r\n                this.skinPath = UrlUtils.AdminRootPath + \"/skins/system\";\r\n\r\n                // the folder of the currently parsed CSS file\r\n                this.folderPath = Path.GetDirectoryName(context.Request.Path).Replace('\\\\', '/');\r\n            }\r\n        }\r\n\r\n        private class Colors\r\n        {\r\n            private Dictionary<string,string> scheme = new Dictionary<string,string>();\r\n\r\n            public Colors ( User user )\r\n            {\r\n                scheme.Add(\"threedface\", \"#FFFFFF\");\r\n\t\t\t\tscheme.Add(\"threedshadow\", \"#DDDDDD\");\r\n                scheme.Add(\"threedlightshadow\", \"rgb(227,227,227)\");\r\n                scheme.Add(\"threedhighlight\", \"rgb(255,255,255)\");\r\n                scheme.Add(\"threeddarkshadow\", \"rgb(105,105,105)\");\r\n                scheme.Add(\"highlighttext\", \"rgb(255,255,255)\");\r\n                scheme.Add(\"highlight\", \"rgb(51,153,255)\");\r\n                scheme.Add(\"appworkspace\", \"rgb(171,171,171)\");\r\n                scheme.Add(\"graytext\", \"rgb(109,109,109)\");\r\n                scheme.Add(\"infobackground\", \"rgb(255,255,225)\");\r\n                scheme.Add(\"infotext\", \"rgb(0,0,0)\");\r\n                scheme.Add(\"menutext\", \"rgb(0,0,0)\");\r\n                scheme.Add(\"menu\", \"rgb(240,240,240)\");\r\n                scheme.Add(\"windowtext\", \"rgb(0,0,0)\");\r\n                scheme.Add(\"window\", \"rgb(250,250,250)\");\r\n                scheme.Add(\"toolbar\", \"#D3DAED\"); // c1 special!\r\n                /*\r\n                scheme.Add ( \"buttonface\", \"pink\" );\r\n                scheme.Add ( \"buttonhighlight\", \"pink\");\r\n                scheme.Add ( \"buttonshadow\", \"pink\" );\r\n                scheme.Add(\"buttontext\", \"pink\");\r\n                */\r\n            }\r\n\r\n            public string get (string key)\r\n            {\r\n                key = key.ToLowerInvariant();\r\n                string result = key;\r\n                if ( scheme.ContainsKey ( key ))\r\n                {\r\n                    result = scheme[key];\r\n                }\r\n                return result;\r\n            }\r\n        }\r\n\r\n        public bool IsReusable\r\n        {\r\n            get { return false; }\r\n        }\r\n\t\t\r\n\t\t/**\r\n\t\t * Process request.\r\n\t\t */\r\n        public void ProcessRequest(HttpContext context)\r\n        {\r\n            if (CookieHandler.Get(\"mode\") == \"develop\")\r\n            {\r\n                context.Response.Cache.SetExpires(DateTime.Now.AddMonths(-1));\r\n                context.Response.Cache.SetCacheability(HttpCacheability.NoCache);\r\n            }\r\n            else\r\n            {\r\n                context.Response.Cache.SetExpires(DateTime.Now.AddMonths(1));\r\n                context.Response.Cache.SetCacheability(HttpCacheability.Private);\r\n            }\r\n\r\n            string webPath  = context.Request.Path;\r\n            string cssPath  = webPath.Substring(0, webPath.LastIndexOf(\".aspx\"));\r\n            string filePath = context.Server.MapPath(cssPath);\r\n\r\n            context.Response.ContentType = \"text/css\";\r\n\r\n            State state = new State( context );\r\n            User user = new User ( context );\r\n            Colors colors = new Colors (user);\r\n\r\n            if (C1File.Exists(filePath))\r\n            {\r\n                var sb = new StringBuilder();\r\n\r\n                string[] lines = C1File.ReadAllLines(filePath);\r\n                foreach (string line in lines)\r\n                {\r\n                \t// context.Response.Write ( \"/*\" + line.ToString() + \"*/\" + \"\\n\" );\r\n                    string result = Parse(line, user, state, colors);\r\n                    if (result != null)\r\n                    {\r\n                        sb.Append(result).Append(\"\\n\");\r\n                    }\r\n                }\r\n\r\n                context.Response.Write ( sb.ToString() );\r\n            }\r\n            else\r\n            {\r\n                // Make it obvious that there is some kind of css fåk up.\r\n                context.Response.Write(\"body { border: 1px solid red ! important; }\");\r\n                context.Response.StatusCode = 404;\r\n            }\r\n        }\r\n\t\t\r\n\t\t/**\r\n\t\t * Parse a sigle line\r\n\t\t */\r\n        private string Parse(string line, User user, State state, Colors colors)\r\n        {\r\n            string trim = line.Trim();\r\n\r\n            if (trim.Length == 0) return null;\r\n\r\n            char firstChar = trim[0];\r\n\r\n\r\n            if (firstChar == '#' && trim.StartsWith(\"#endregion\", StringComparison.Ordinal))\r\n            {\r\n                state.isValid = true;\r\n                return null;\r\n            }\r\n\r\n\t\t\tif (!state.isValid) \r\n\t\t\t{\r\n\t\t\t    return null;\r\n\t\t\t}\r\n\r\n            if (firstChar == '-' && trim.StartsWith(\"-vendor-\", StringComparison.Ordinal))\r\n            {\r\n                String was = line;\r\n                if (user.isWebKit)\r\n                {\r\n                    line = line.Replace(\"-vendor-\", \"-webkit-\");\r\n                }\r\n                else if (user.isMozilla)\r\n                {\r\n                \tline = line.Replace(\"-vendor-\", \"-moz-\");\r\n                }\r\n                else if (user.isOpera)\r\n                {\r\n                    line = line.Replace(\"-vendor-\", \"-o-\");\r\n                }\r\n                else\r\n                {\r\n                    line = line.Replace(\"-vendor-\", \"-ms-\");\r\n                }\r\n                line += \"\\n\" + was.Replace(\"-vendor-\", \"\");\r\n            }\r\n\r\n\r\n            if (firstChar == '#' && trim.StartsWith(\"#region\", StringComparison.Ordinal))\r\n            {\r\n            \tif ( trim.IndexOf ( \" \" ) >-1 ) {\r\n\t\t\t\t\tstring statement = trim.Split(' ')[ 1 ];\r\n\t\t\t\t\tswitch (statement) {\r\n\t\t\t\t\t\tcase \"vista\" :\r\n\t\t\t\t\t\t\tstate.isValid = user.isVista;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"osx\" :\r\n\t\t\t\t\t\t\tstate.isValid = user.isOSX;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"default\" :\r\n\t\t\t\t\t\t\tstate.isValid = user.isDefault;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"moz\" :\r\n\t\t\t\t\t\t\tstate.isValid = user.isMozilla;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"ie\" :\r\n\t\t\t\t\t\t\tstate.isValid = !user.isMozilla;\r\n\t\t\t\t\t\t\tbreak;\r\n                        case \"ie6\" :\r\n                            state.isValid = user.isIE6;\r\n                            break;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n                return null;\r\n            }\r\n\r\n            if (firstChar == '@')\r\n            {\r\n                string statement = line.Substring(0, line.IndexOf(\" \"));\r\n                switch (statement)\r\n                {\r\n                    case \"@import\":\r\n                        string url = getURLPart ( line );\r\n                        line = line.Replace(url, url + \".aspx\");\r\n                        break;\r\n                    case \"@namespace\" :\r\n                        line = user.isMozilla ? line : null;\r\n                        break;\r\n                }\r\n            }\r\n            else if (firstChar == '#')\r\n            {\r\n                string originalLine = line;\r\n\r\n                string statement = line.Substring(0, line.IndexOf(\" \"));\r\n                line = line.Substring(statement.Length + 1); // cutting statement and the following space\r\n                switch (statement.Trim())\r\n                {\r\n                    case \"#ie\":\r\n                        line = user.isIE ? line : null;\r\n                        break;\r\n                    case \"#ie6\":\r\n                        line = user.isIE6 ? line : null;\r\n                        break;\r\n                    case \"#ie7\":\r\n                        line = user.isIE7 ? line : null;\r\n                        break;\r\n                    case \"#ie8\":\r\n                        line = user.isIE8 ? line : null;\r\n                        break;\r\n                    case \"#moz\":\r\n                        line = user.isMozilla ? line : null;\r\n                        break;\r\n                    case \"#opacity:\":\r\n                        string value = getValuePart(line);\r\n                        line = \"opacity: \" + value + \";\";\r\n                        break;\r\n                    case \"#alphabackdrop:\":\r\n                        string url = getURLPart(line);\r\n                        line = \"background-image: url(\\\"\" + url + \"\\\");\";\r\n                        break;\r\n                    case \"#alphaimage:\":\r\n                        string url2 = getURLPart(line);\r\n                        line = \"background-image: url(\\\"\" + url2 + \"\\\"); background-repeat: no-repeat;\";\r\n                        break;\r\n\r\n                    default:\r\n                        // Line may contain an identifier\r\n                        line = originalLine; \r\n                        break;\r\n                }\r\n            }\r\n\r\n\r\n            if (line != null)\r\n            {\r\n                if (!user.isMozilla)\r\n                {\r\n                    line = line.Replace(\"ui|\", string.Empty);\r\n                }\r\n\r\n                if(line.Contains(\"$\"))\r\n                {\r\n                    line = line.Replace(\"${root}\", state.rootPath)\r\n                               .Replace(\"${folder}\", state.folderPath)\r\n                               .Replace(\"${skin}\", state.skinPath);\r\n\r\n                    while (line.Contains(\"$(color:\"))\r\n                    {\r\n                        line = colorize(line, colors);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return line;\r\n        }\r\n\r\n        private string colorize (string line, Colors colors )\r\n        {\r\n\r\n            string START = \"$(color:\";\r\n            string STOP = \")\";\r\n\r\n            int index1 = line.IndexOf(START);\r\n            string before = line.Substring(0,index1);\r\n            string after = line.Substring(index1 , line.Length - index1);\r\n\r\n            int index2 = after.IndexOf(STOP);\r\n            string final = after.Substring(index2 + 1, after.Length - (index2 + 1));\r\n\r\n            string key = after.Substring( START.Length, after.Length - START.Length - ( after.Length - index2 ));\r\n            \r\n            line = before + colors.get ( key ) + final;\r\n            return line;\r\n        }\r\n\r\n\t\t\r\n\t\t/**\r\n\t\t * Isolate URL part of a line\r\n\t\t */\r\n        private string getURLPart(string line)\r\n        {\r\n            return line.Split('\\\"')[1];\r\n        }\r\n\r\n        /**\r\n\t\t * Isolate value part of a line\r\n\t\t */\r\n        private string getValuePart(string line)\r\n        {\r\n            string two = line.Split(';')[0];\r\n            return two.Trim();\r\n        }\r\n\t\t\r\n        // *\r\n        // * Isolate $ notation part of a line\r\n        // */\r\n        //private string getVarPart (string line)\r\n        //{\r\n        //    string result = line;\r\n        //    if ( line.Contains ( \"${\" ) && line.Contains ( \"}\" )) {\r\n        //        int start = line.LastIndexOf(\"${\");\r\n        //        int stop = line.LastIndexOf(\"}\");\r\n        //        result = line.Substring(start, stop - start + 1);\r\n        //    }\r\n        //    return result;\r\n        //}\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Presentation/OutputTransformationManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing System.Web.Hosting;\r\nusing System.Xml;\r\nusing System.Xml.Xsl;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Presentation\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class OutputTransformationManager\r\n    {\r\n        private const string _contextItemKey = \"AdministrativeOutputTransformationHttpModule.TransformationList\";\r\n\r\n        /// <exclude />\r\n        public static void Activate()\r\n        {\r\n            EnsureResponseFilter();\r\n           \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void RegisterTransformation(string transformationPath, int position)\r\n        {\r\n            HttpContext context = HttpContext.Current;\r\n            if (context.Items.Contains(_contextItemKey) == false) throw new InvalidOperationException(\"Activate must be called first\");\r\n\r\n            List<Transformation> transformations = (List<Transformation>)context.Items[_contextItemKey];\r\n            transformations.Add(new Transformation { TransformationPath = transformationPath, Position = position });\r\n        }\r\n\r\n\r\n        internal static IEnumerable<string> GetTransformationsInPriority()\r\n        {\r\n            HttpContext context = HttpContext.Current;\r\n            if (context.Items.Contains(_contextItemKey) == false) throw new InvalidOperationException(\"Activate must be called first\");\r\n\r\n            List<Transformation> transformations = (List<Transformation>)context.Items[_contextItemKey];\r\n            foreach (Transformation transformation in transformations.OrderBy(f => f.Position))\r\n            {\r\n                yield return transformation.TransformationPath;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void EnsureResponseFilter()\r\n        {\r\n            HttpContext context = HttpContext.Current;\r\n\r\n            if (context.Items.Contains(_contextItemKey) == false)\r\n            {\r\n                context.Response.Filter = new XslTransformationStream(context.Response.Filter);\r\n\r\n                context.Items.Add(_contextItemKey, new List<Transformation>());\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        #region Helper classes\r\n        private class Transformation\r\n        {\r\n            public string TransformationPath { get; set; }\r\n            public int Position { get; set; }\r\n        }\r\n\r\n        private class XslTransformationStream : Stream\r\n        {\r\n            public XslTransformationStream(Stream outputStream)\r\n            {\r\n                _buffer = new MemoryStream(8192);\r\n                _responseOutputStream = outputStream;\r\n            }\r\n\r\n            private readonly Stream _responseOutputStream;\r\n            private readonly MemoryStream _buffer;\r\n\r\n\r\n            /*\r\n             * Moth knows about the ugly parameters, please refactor!\r\n             * We should probably supply XSLT params by webcontrol markup...\r\n             */\r\n\r\n            public static MemoryStream Transform(MemoryStream buffer, String mode, String browser, String platform)\r\n            {\r\n                List<string> xsltFilePaths = GetTransformationsInPriority().ToList();\r\n\r\n                if (xsltFilePaths.Count == 0)\r\n                {\r\n                    return buffer;\r\n                }\r\n\r\n                // Detection doctype\r\n                buffer.Seek(0, SeekOrigin.Begin);\r\n                string line;\r\n\r\n                using (var reader = new StreamReader(buffer, Encoding.UTF8, true, 1024, true))\r\n                {\r\n                    line = reader.ReadLine();\r\n                }\r\n                var doctype = line.Contains(\"<!DOCTYPE\");\r\n                buffer.Seek(0, SeekOrigin.Begin);\r\n\r\n\r\n                var readerSettings = new XmlReaderSettings\r\n                {\r\n                    XmlResolver = null,\r\n                    DtdProcessing = DtdProcessing.Parse,\r\n                    CheckCharacters = false\r\n                };\r\n\r\n                MemoryStream outputStream = null;\r\n\r\n                int xsltCount = xsltFilePaths.Count;\r\n\r\n                for (int i = 0; i < xsltCount; i++)\r\n                {\r\n                    string xsltFilePath = xsltFilePaths[i];\r\n                    bool isFirst = (i == 0);\r\n\r\n                    MemoryStream inputStream = isFirst ? buffer : outputStream;\r\n                    inputStream.Position = 0;\r\n                    outputStream = new MemoryStream();\r\n                        \r\n                    /*\r\n                        * Hardcoding a parameter for masterfilter.xsl\r\n                        * TODO: parametersetup in webcontrol markup!\r\n                        */\r\n\r\n                    var transformer = GetCachedTransformation(xsltFilePath);\r\n\r\n                    var argList = new XsltArgumentList();\r\n                    if ( !string.IsNullOrEmpty ( mode )) {\r\n\t                    argList.AddParam(\"mode\", \"\", mode );\r\n\t                }\r\n\t                if ( !string.IsNullOrEmpty ( browser )) {\r\n\t                    argList.AddParam(\"browser\", \"\", browser );\r\n\t                }\r\n                    if (!string.IsNullOrEmpty(platform))\r\n                    {\r\n                        argList.AddParam(\"platform\", \"\", platform);\r\n                    }\r\n                    argList.AddParam(\"version\", \"\", RuntimeInformation.ProductVersion.ToString());\r\n                    argList.AddParam(\"doctype\", \"\", doctype.ToString());\r\n                    argList.AddParam(\"appVirtualPath\", \"\", GetAppRootPath());\r\n\r\n                    var reader = XmlReader.Create(inputStream, readerSettings);\r\n                    var writer = XmlWriter.Create(outputStream, transformer.OutputSettings);\r\n                    \r\n                    try\r\n                    {\r\n                        transformer.Transform(reader, argList, writer);\r\n                    }\r\n                    catch (XmlException xmlException)\r\n                    {\r\n                        string tempFilePath = TempDirectoryFacade.GetTempFileName(\".xml\");\r\n\r\n                        inputStream.Position = 0;\r\n                        string markup;\r\n                        using (var sr = new C1StreamReader(inputStream))\r\n                        {\r\n                            markup = sr.ReadToEnd();\r\n                        }\r\n                        \r\n                        C1File.WriteAllText(tempFilePath, markup); \r\n\r\n                        throw new InvalidOperationException(\r\n                            $\"Incorrect xml markup, source saved in '{tempFilePath}'\", \r\n                            xmlException);\r\n                    }\r\n                }\r\n\r\n                Verify.That(outputStream != null, \"NullRef\");\r\n\r\n                return outputStream;\r\n            }\r\n\r\n            private static XslCompiledTransform GetCachedTransformation(string xsltFilePath)\r\n            {\r\n                string transformationCacheKey = \"Compiled\" + xsltFilePath;\r\n                var cache = HostingEnvironment.Cache;\r\n\r\n                XslCompiledTransform transformer = cache[transformationCacheKey] as XslCompiledTransform;\r\n                if (transformer == null)\r\n                {\r\n                    lock (typeof (XslTransformationStream))\r\n                    {\r\n                        transformer = cache[transformationCacheKey] as XslCompiledTransform;\r\n                        if (transformer == null)\r\n                        {\r\n                            transformer = XsltServices.GetCompiledXsltTransform(xsltFilePath);\r\n                            cache.Add(transformationCacheKey,\r\n                                transformer,\r\n                                new CacheDependency(xsltFilePath),\r\n                                DateTime.MaxValue,\r\n                                TimeSpan.FromDays(1.0),\r\n                                CacheItemPriority.Default,\r\n                                null);\r\n                        }\r\n                    }\r\n                }\r\n                return transformer;\r\n            }\r\n\r\n\r\n            private static string GetAppRootPath()\r\n            {\r\n                string appPath = HostingEnvironment.ApplicationVirtualPath;\r\n\r\n                if (appPath.EndsWith(\"/\") || appPath.EndsWith(@\"\\\"))\r\n                {\r\n                    appPath = appPath.Remove(appPath.Length - 1, 1);\r\n                }\r\n\r\n                return appPath;\r\n            }\r\n\r\n            public override void Write(byte[] buffer, int offset, int count)\r\n            {\r\n                if (_buffer.CanWrite)\r\n                    _buffer.Write(buffer, offset, count);\r\n            }\r\n\r\n            public override void Close()\r\n            {\r\n                var httpContext = HttpContext.Current;\r\n\r\n                try\r\n                {\r\n                    if (!_buffer.CanRead || (_buffer.Length == 0))\r\n                    {\r\n                        return;\r\n                    }\r\n\r\n                    MemoryStream output = _buffer;\r\n\r\n                    if (httpContext.Response.StatusCode == 200)\r\n                    {\r\n                        try\r\n                        {\r\n                            string mode = CookieHandler.Get(\"mode\");\r\n                            string browser = \"undefined\";\r\n                            string platform = \"undefined\";\r\n\r\n                            string userAgent = httpContext.Request.UserAgent;\r\n\r\n                            if (!userAgent.IsNullOrEmpty())\r\n                            {\r\n                                if (userAgent.IndexOf(\"Gecko\", StringComparison.Ordinal) > -1 /*&& !userAgent.Contains(\"Trident\")*/)\r\n                                {\r\n                                    browser = \"mozilla\";\r\n                                }\r\n                                else\r\n                                {\r\n                                    browser = \"explorer\";\r\n                                }\r\n                                if (userAgent.IndexOf(\"Windows NT\", StringComparison.Ordinal) > -1)\r\n                                {\r\n                                    platform = \"vista\";\r\n                                }\r\n                                else if (userAgent.IndexOf(\"OS X\", StringComparison.Ordinal) > -1)\r\n                                {\r\n                                    platform = \"osx\";\r\n                                }\r\n                                else\r\n                                {\r\n                                    platform = \"default\";\r\n                                }\r\n                            }\r\n\r\n                            output = Transform(_buffer, mode, browser, platform);\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            Log.LogCritical(\"AdministrativeOutputTransformationHttpModule\", ex);\r\n                            throw;\r\n                        }\r\n                    }\r\n\r\n                    if(output.Position != 0)\r\n                    {\r\n                        output.Seek(0, SeekOrigin.Begin);\r\n                    }\r\n                    output.WriteTo(_responseOutputStream);\r\n                }\r\n                finally\r\n                {\r\n                    _responseOutputStream.Close();\r\n                }\r\n            }\r\n\r\n            public override bool CanRead => _responseOutputStream.CanRead;\r\n\r\n            public override bool CanSeek => _responseOutputStream.CanSeek;\r\n\r\n            public override bool CanWrite => _responseOutputStream.CanWrite;\r\n\r\n            public override long Length => _responseOutputStream.Length;\r\n\r\n            public override long Position\r\n            {\r\n                get { return _responseOutputStream.Position; }\r\n                set { _responseOutputStream.Position = value; }\r\n            }\r\n\r\n            public override long Seek(long offset, SeekOrigin origin)\r\n            {\r\n                return _responseOutputStream.Seek(offset, origin);\r\n            }\r\n\r\n            public override void SetLength(long value)\r\n            {\r\n                _responseOutputStream.SetLength(value);\r\n            }\r\n\r\n            public override void Flush()\r\n            {\r\n                _responseOutputStream.Flush();\r\n            }\r\n\r\n            public override int Read(byte[] buffer, int offset, int count)\r\n            {\r\n                return _responseOutputStream.Read(buffer, offset, count);\r\n            }\r\n        }\r\n        #endregion\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Presentation/ViewServices.cs",
    "content": "﻿using System.Web;\r\n\r\nnamespace Composite.Core.WebClient.Presentation\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class ViewServices\r\n    {\r\n        private static HttpRequest Request\r\n        {\r\n            get\r\n            {\r\n                return HttpContext.Current.Request;\r\n            }\r\n        }\r\n\r\n        private static HttpResponse Response\r\n        {\r\n            get\r\n            {\r\n                return HttpContext.Current.Response;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// For ~/Composite requests - register basix XSL transformations \r\n        /// </summary>\r\n        public static void RegisterCommonTransformations()\r\n        {\r\n            OutputTransformationManager.Activate();\r\n\r\n            OutputTransformationManager.RegisterTransformation(\r\n                Request.MapPath(\"~/Composite/transformations/defaultfilters/structurefilter.xsl\"), 1);\r\n            OutputTransformationManager.RegisterTransformation(\r\n                Request.MapPath(\"~/Composite/transformations/defaultfilters/masterfilter.xsl\"), 10);\r\n            OutputTransformationManager.RegisterTransformation(\r\n                Request.MapPath(\"~/Composite/transformations/defaultfilters/finalizefilter.xsl\"), 20);\r\n\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void RegisterMimeType()\r\n        {\r\n            if (Request.UserAgent != null && !Request.UserAgent.Contains(\"MSIE\"))\r\n            {\r\n                Response.ContentType = \"application/xhtml+xml\";\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/CultureExtrator.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Core.WebClient;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n    [Obsolete(\"No longer used\")]\r\n    internal static class CultureExtrator\r\n    {\r\n        public static CultureInfo GetCultureInfo(string requestPath)\r\n        {\r\n            string newRequestPath;\r\n\r\n            return GetCultureInfo(requestPath, out newRequestPath);\r\n        }\r\n\r\n\r\n        public static CultureInfo GetCultureInfo(string requestPath, out string requestPathWithoutUrlMappingName)\r\n        {\r\n            requestPathWithoutUrlMappingName = requestPath;\r\n\r\n            int startIndex = requestPath.IndexOf('/', UrlUtils.PublicRootPath.Length) + 1;\r\n            if (startIndex >= 0)\r\n            {\r\n                int endIndex = requestPath.IndexOf('/', startIndex) - 1;\r\n                if (endIndex >= 0)\r\n                {\r\n                    string urlMappingName = requestPath.Substring(startIndex, endIndex - startIndex + 1).ToLowerInvariant();\r\n\r\n                    if (DataLocalizationFacade.UrlMappingNames.Contains(urlMappingName))\r\n                    {\r\n                        CultureInfo cultureInfo = DataLocalizationFacade.GetCultureInfoByUrlMappingName(urlMappingName);\r\n\r\n                        bool exists = DataLocalizationFacade.ActiveLocalizationNames.Contains(cultureInfo.Name);\r\n\r\n                        if (exists)\r\n                        {\r\n                            requestPathWithoutUrlMappingName = requestPath.Remove(startIndex - 1, endIndex - startIndex + 2);\r\n\r\n                            return cultureInfo;\r\n                        }\r\n                        return null;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return DataLocalizationFacade.DefaultUrlMappingCulture;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Data/DataXhtmlRenderingServices.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class DataXhtmlRenderingServices\r\n\t{\r\n        /// <exclude />\r\n        public static bool CanRender(Type dataTypeToRender, XhtmlRenderingType renderingType)\r\n        {\r\n            IEnumerable<XhtmlRendererProviderAttribute> rendererAttributes = dataTypeToRender.GetCustomInterfaceAttributes<XhtmlRendererProviderAttribute>();\r\n            return rendererAttributes.Any(f => f.SupportedRenderingType == renderingType);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static XhtmlDocument Render(IDataReference dataToRender, XhtmlRenderingType renderingType)\r\n        {\r\n            Type dataTypeToRender = dataToRender.ReferencedType;\r\n            IEnumerable<XhtmlRendererProviderAttribute> rendererAttributes = dataTypeToRender.GetCustomInterfaceAttributes<XhtmlRendererProviderAttribute>();\r\n\r\n            XhtmlRendererProviderAttribute rendererAttribute = rendererAttributes.FirstOrDefault(f => f.SupportedRenderingType == renderingType);\r\n\r\n            if (rendererAttribute == null) throw new NotImplementedException(string.Format(\"No '{0}' xhtml renderer found for type '{1}'\",renderingType, dataTypeToRender.FullName));\r\n\r\n            IDataXhtmlRenderer renderer = rendererAttribute.BuildRenderer();\r\n\r\n            return renderer.Render(dataToRender);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Data/IDataXhtmlRenderer.cs",
    "content": "﻿using System;\r\nusing Composite.Data;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IDataXhtmlRenderer\r\n    {\r\n        /// <exclude />\r\n        XhtmlDocument Render(IDataReference dataToRender);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Data/KeyTemplatedXhtmlRendererAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Data;\r\nusing System.Xml.Linq;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.WebClient;\r\nusing System.Web;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class KeyTemplatedXhtmlRendererAttribute : XhtmlRendererProviderAttribute\r\n    {\r\n        private XhtmlRenderingType _supportedRenderingType;\r\n        private IDataXhtmlRenderer _renderer;\r\n        private XhtmlRenderingEncoding _renderingEncoding;\r\n\r\n        /// <summary>\r\n        /// Created a XHTML Renderer that uses the specified template to create markup.\r\n        /// The key of the data will be inserted into the specified template where '{id}' is.\r\n        /// If you spcify '{label}' the system will fetch the value of the label field and insert it.\r\n        /// You also can use '{field:__a field name__}' syntax to insert a field value.\r\n        /// Use '~' to create absolute paths.\r\n        /// Example: <example>&lt;a href='~/showProduct.aspx?id={id}'>read more about {label}&lt;/a></example>\r\n        /// </summary>\r\n        public KeyTemplatedXhtmlRendererAttribute(XhtmlRenderingType renderingType, string formatedTemplate)\r\n        {\r\n            this.FormatedTemplate = formatedTemplate;\r\n            _supportedRenderingType = renderingType;\r\n            _renderingEncoding = XhtmlRenderingEncoding.None;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Created a XHTML Renderer that uses the specified template to create markup.\r\n        /// The key of the data will be inserted into the specified template where '{id}' is.\r\n        /// If you spcify '{label}' the system will fetch the value of the label field and insert it.\r\n        /// You also can use '{field:__a field name__}' syntax to insert a field value.\r\n        /// Use '~' to create absolute paths.\r\n        /// Example: <example>&lt;a href='~/showProduct.aspx?id={id}'>read more about {label}&lt;/a></example>\r\n        /// </summary>\r\n        public KeyTemplatedXhtmlRendererAttribute(XhtmlRenderingType renderingType, XhtmlRenderingEncoding renderingEncoding, string formatedTemplate)\r\n        {\r\n            this.FormatedTemplate = formatedTemplate;\r\n            _supportedRenderingType = renderingType;\r\n            _renderingEncoding = renderingEncoding;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string FormatedTemplate\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override IDataXhtmlRenderer BuildRenderer()\r\n        {\r\n            if (_renderer == null)\r\n            {\r\n                _renderer = new KeyBasedXhtmlRenderer(this.FormatedTemplate, _renderingEncoding);\r\n            }\r\n            return _renderer;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override XhtmlRenderingType SupportedRenderingType\r\n        {\r\n            get\r\n            {\r\n                return _supportedRenderingType;\r\n            }\r\n        }\r\n\r\n\r\n        private class KeyBasedXhtmlRenderer : IDataXhtmlRenderer\r\n        {\r\n            private static readonly string LogTitle = \"KeyBasedXhtmlRenderer\";\r\n\r\n            private readonly string _templateString;\r\n\r\n            private readonly List<string> _fieldNames = new List<string>();\r\n            private readonly List<string> _fieldPatterns = new List<string>();\r\n            private readonly bool _labelHasToBeEvaluated;\r\n            private readonly bool _idHasToBeEvaluated;\r\n            private readonly XhtmlRenderingEncoding _renderingEncoding;\r\n\r\n            private readonly Hashtable<Type, Hashtable<string, PropertyInfo>> _reflectionCache = new Hashtable<Type, Hashtable<string, PropertyInfo>>();\r\n\r\n            public KeyBasedXhtmlRenderer(string templateString, XhtmlRenderingEncoding renderingEncoding)\r\n            {\r\n                templateString = templateString.Replace(\"~\", UrlUtils.PublicRootPath);\r\n                templateString = templateString.Replace(\"{label}\", \"{0}\");\r\n                templateString = templateString.Replace(\"{id}\", \"{1}\");\r\n\r\n                _labelHasToBeEvaluated = templateString.Contains(\"{0}\");\r\n                _idHasToBeEvaluated = templateString.Contains(\"{1}\");\r\n                _renderingEncoding = renderingEncoding;\r\n\r\n                int stringFormattingIndex = 2;\r\n\r\n                while (true)\r\n                {\r\n                    int fieldDefinitionOffset = templateString.IndexOf(\"{field:\");\r\n                    if (fieldDefinitionOffset < 0) break;\r\n\r\n                    int closingBraceIndex = templateString.IndexOf(\"}\", fieldDefinitionOffset + 7);\r\n                    Verify.That(closingBraceIndex > 0, \"Invalid rendering template.\");\r\n\r\n                    string fieldName = templateString.Substring(fieldDefinitionOffset + 7, closingBraceIndex - fieldDefinitionOffset - 7);\r\n                    _fieldNames.Add(fieldName);\r\n\r\n                    string fieldPattern = templateString.Substring(fieldDefinitionOffset, closingBraceIndex - fieldDefinitionOffset + 1);\r\n                    _fieldPatterns.Add(fieldPattern);\r\n\r\n                    templateString = templateString.Replace(fieldPattern, \"{\" + (stringFormattingIndex++) + \"}\");\r\n                }\r\n\r\n                _templateString = string.Format(\"<body xmlns='{0}'>{1}</body>\", Namespaces.Xhtml, templateString);\r\n            }\r\n\r\n\r\n            public XhtmlDocument Render(IDataReference dataReferenceToRender)\r\n            {\r\n                if (!dataReferenceToRender.IsSet)\r\n                {\r\n                    return new XhtmlDocument();\r\n                }\r\n\r\n                IData dataToRender;\r\n\r\n                if (dataReferenceToRender.ReferencedType == typeof(IPage))\r\n                {\r\n                    dataToRender = DataFacade.TryGetDataByUniqueKey<IPage>(dataReferenceToRender.KeyValue);\r\n                    if (dataToRender == null)\r\n                    {\r\n                        return new XhtmlDocument();\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    dataToRender = dataReferenceToRender.Data;\r\n                }\r\n\r\n                string markup = _templateString;\r\n                string labelEncoded = \"\";\r\n                string keyValue = \"\";\r\n\r\n\r\n                if (_labelHasToBeEvaluated)\r\n                {\r\n                    labelEncoded = HttpUtility.HtmlEncode(dataToRender.GetLabel());\r\n                }\r\n\r\n                if (_idHasToBeEvaluated)\r\n                {\r\n                    keyValue = dataReferenceToRender.KeyValue.ToString();\r\n                }\r\n\r\n                var parameters = new object[2 + _fieldNames.Count];\r\n\r\n                parameters[0] = labelEncoded;\r\n                parameters[1] = keyValue;\r\n\r\n                // Getting field values\r\n                for (int i = 0; i < _fieldNames.Count; i++)\r\n                {\r\n                    Type referenceType = dataReferenceToRender.ReferencedType;\r\n\r\n                    var propertiesMap = _reflectionCache.EnsureValue(referenceType,\r\n                        () => new Hashtable<string, PropertyInfo>());\r\n\r\n                    string fieldName = _fieldNames[i];\r\n\r\n                    PropertyInfo propertyInfo;\r\n                    if (!propertiesMap.TryGetValue(fieldName, out propertyInfo))\r\n                    {\r\n                        lock (propertiesMap)\r\n                        {\r\n                            if (!propertiesMap.TryGetValue(fieldName, out propertyInfo))\r\n                            {\r\n                                Type type = referenceType;\r\n\r\n                                while (type != null && type != typeof(object))\r\n                                {\r\n                                    propertyInfo = type.GetProperty(fieldName);\r\n                                    if (propertyInfo != null)\r\n                                    {\r\n                                        propertiesMap.Add(fieldName, propertyInfo);\r\n                                        break;\r\n                                    }\r\n\r\n                                    if (type.GetInterfaces().Length > 0)\r\n                                    {\r\n                                        type = type.GetInterfaces()[0];\r\n                                    }\r\n                                }\r\n\r\n                                if (propertyInfo == null)\r\n                                {\r\n                                    LoggingService.LogWarning(LogTitle, \"Failed to find property '{0}' on type '{1}'\"\r\n                                        .FormatWith(fieldName, referenceType.FullName));\r\n\r\n                                    propertiesMap.Add(fieldName, null);\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n\r\n                    string value = String.Empty;\r\n\r\n                    if (propertyInfo != null)\r\n                    {\r\n                        value = (propertyInfo.GetValue(dataToRender, new object[0]) ?? String.Empty).ToString();\r\n                    }\r\n\r\n                    switch (_renderingEncoding)\r\n                    {\r\n                        case XhtmlRenderingEncoding.None:\r\n                            break;\r\n                        case XhtmlRenderingEncoding.AttributeContent:\r\n                            value = HttpUtility.HtmlAttributeEncode(value);\r\n                            break;\r\n                        case XhtmlRenderingEncoding.TextContent:\r\n                            value = HttpUtility.HtmlEncode(value);\r\n                            break;\r\n                        default:\r\n                            throw new NotImplementedException(\"Unexpected XhtmlRenderingEncoding value\");\r\n                    }\r\n\r\n                    parameters[2 + i] = value;\r\n                }\r\n\r\n                string evaluatedMarkup = string.Format(markup, parameters);\r\n\r\n                XElement bodyMarkup = XElement.Parse(evaluatedMarkup);\r\n\r\n                XhtmlDocument xhtmlDocument = new XhtmlDocument();\r\n\r\n                xhtmlDocument.Body.Add(bodyMarkup.Nodes());\r\n\r\n                return xhtmlDocument;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Data/XhtmlRendererProviderAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]\r\n    public abstract class XhtmlRendererProviderAttribute : Attribute\r\n    {\r\n        /// <exclude />\r\n        public abstract XhtmlRenderingType SupportedRenderingType\r\n        {\r\n            get;\r\n        }\r\n\r\n        /// <exclude />\r\n        public abstract IDataXhtmlRenderer BuildRenderer();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Data/XhtmlRenderingEncodingEnum.cs",
    "content": "﻿namespace Composite.Core.WebClient.Renderings.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public enum XhtmlRenderingEncoding\r\n    {\r\n        /// <summary>Do not encode (data fields are parsable as xml snippet)</summary>\r\n        None = 0,\r\n        /// <summary>Data fields should be parsed for use in xml attribute values</summary>\r\n        AttributeContent = 1,\r\n        /// <summary>Data fields should be parsed for use xml text</summary>\r\n        TextContent = 2,\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Data/XhtmlRenderingTypeEnum.cs",
    "content": "﻿namespace Composite.Core.WebClient.Renderings.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum XhtmlRenderingType\r\n    {\r\n        /// <exclude />\r\n        Embedable\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Foundation/IRenderingResponseHandlerRegistry.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Foundation\r\n{\r\n\tinternal interface IRenderingResponseHandlerRegistry\r\n\t{\r\n        IEnumerable<string> RenderingResponseHandlerNames { get; }\r\n        void Flush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Foundation/PluginFacades/RenderingResponseHandlerPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Data;\r\nusing Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler;\r\nusing Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.Runtime;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Foundation.PluginFacades\r\n{\r\n    internal static class RenderingResponseHandlerPluginFacade\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n        public static RenderingResponseHandlerResult GetDataResponseHandling(string handlerName, DataEntityToken requestedItemEntityToken)\r\n        {\r\n            IDataRenderingResponseHandler handler = GetRenderingResponseHandler(handlerName) as IDataRenderingResponseHandler;\r\n            Verify.IsNotNull(handler, \"The Rendering Response Handler named '{0}' does not implement the required interface '{1}'\", handlerName, typeof(IDataRenderingResponseHandler));\r\n\r\n            return handler.GetDataResponseHandling(requestedItemEntityToken);\r\n        }\r\n\r\n\r\n\r\n        public static bool IsDataRenderingResponseHandler(string handlerName)\r\n        {\r\n            IDataRenderingResponseHandler handler = GetRenderingResponseHandler(handlerName) as IDataRenderingResponseHandler;\r\n\r\n            return handler != null;\r\n        }\r\n\r\n\r\n\r\n        private static IRenderingResponseHandler GetRenderingResponseHandler(string handlerName)\r\n        {\r\n            IRenderingResponseHandler applicationStartupHandler;\r\n\r\n            var resources = _resourceLocker;\r\n\r\n            var providerCache = resources.Resources.ProviderCache;\r\n            if (providerCache.TryGetValue(handlerName, out applicationStartupHandler))\r\n            {\r\n                return applicationStartupHandler;\r\n            }\r\n\r\n            using (resources.Locker)\r\n            {\r\n                if (providerCache.TryGetValue(handlerName, out applicationStartupHandler) == false)\r\n                {\r\n                    try\r\n                    {\r\n                        applicationStartupHandler = resources.Resources.Factory.Create(handlerName);\r\n\r\n                        providerCache.Add(handlerName, applicationStartupHandler);\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return applicationStartupHandler;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", RenderingResponseHandlerSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public RenderingResponseHandlerFactory Factory { get; set; }\r\n            public Hashtable<string, IRenderingResponseHandler> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new RenderingResponseHandlerFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Hashtable<string, IRenderingResponseHandler>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Foundation/RenderingResponseHandlerRegistry.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Foundation\r\n{\r\n\tinternal static class RenderingResponseHandlerRegistry\r\n\t{\r\n        private static IRenderingResponseHandlerRegistry _implementation = new RenderingResponseHandlerRegistryImpl();\r\n\r\n\r\n        static RenderingResponseHandlerRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        internal static IRenderingResponseHandlerRegistry Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        public static IEnumerable<string> RenderingResponseHandlerNames\r\n        {\r\n            get\r\n            {\r\n                return _implementation.RenderingResponseHandlerNames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _implementation.Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Foundation/RenderingResponseHandlerRegistryImpl.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler;\r\nusing Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.Runtime;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Foundation\r\n{\r\n    internal sealed class RenderingResponseHandlerRegistryImpl : IRenderingResponseHandlerRegistry\r\n\t{\r\n        private List<string> _renderingResponseHandlerNames = null;\r\n        private static object _lock = new object();\r\n\r\n\r\n        public IEnumerable<string> RenderingResponseHandlerNames\r\n        {\r\n            get \r\n            {\r\n                Initialize();\r\n\r\n                foreach (string name in _renderingResponseHandlerNames)\r\n                {\r\n                    yield return name;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _renderingResponseHandlerNames = null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            if (_renderingResponseHandlerNames == null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_renderingResponseHandlerNames == null)\r\n                    {\r\n                        _renderingResponseHandlerNames = new List<string>();\r\n\r\n                        RenderingResponseHandlerSettings renderingResponseHandlerSettings = ConfigurationServices.ConfigurationSource.GetSection(RenderingResponseHandlerSettings.SectionName) as RenderingResponseHandlerSettings;\r\n                        foreach (RenderingResponseHandlerData renderingResponseHandlerData in renderingResponseHandlerSettings.RenderingResponseHandlerPlugins)\r\n                        {\r\n                            _renderingResponseHandlerNames.Add(renderingResponseHandlerData.Name);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/FunctionPreview.cs",
    "content": "﻿using System;\r\nusing System.Threading.Tasks;\r\nusing System.Web;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.WebClient.PhantomJs;\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n    /// <exclude />\r\n    public static class FunctionPreview\r\n    {\r\n        private const string RenderingMode = \"function\";\r\n\r\n        static FunctionPreview()\r\n        {\r\n            GlobalEventSystemFacade.OnDesignChange += () => BrowserRender.ClearCache(RenderingMode);\r\n        }\r\n\r\n        internal static async Task<string> GetPreviewFunctionPreviewImageFile(HttpContext context)\r\n        {\r\n            string previewUrl = context.Request.Url.ToString().Replace(\"/FunctionBox?\", \"/FunctionPreview.ashx?\");\r\n\r\n            var renderingResult = await BrowserRender.RenderUrlAsync(context, previewUrl, RenderingMode);\r\n\r\n            if (renderingResult == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (renderingResult.Status == RenderingResultStatus.Success)\r\n            {\r\n                return renderingResult.FilePath;\r\n            }\r\n\r\n            if (renderingResult.Status >= RenderingResultStatus.Error)\r\n            {\r\n                string functionTitle = context.Request.QueryString[\"title\"] ?? \"null\";\r\n\r\n                Log.LogWarning(\"FunctionPreview\", \"Failed to build preview for function '{0}'. Reason: {1}; Output:\\r\\n{2}\",\r\n                    functionTitle, renderingResult.Status, string.Join(Environment.NewLine, renderingResult.Output));\r\n            }\r\n            return null;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static int GetFunctionPreviewHash()\r\n        {\r\n            if (!GlobalSettingsFacade.FunctionPreviewEnabled)\r\n            {\r\n                return 0;\r\n            }\r\n\r\n            return BrowserRender.GetLastCacheUpdateTime(RenderingMode).GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/INonCachebleRequestHostnameMapper.cs",
    "content": "namespace Composite.Core.WebClient.Renderings\r\n{\r\n    /// <summary>\r\n    /// Enables redirecting hostnames for extranet protected media requests in reverse caching proxy configuration.\r\n    /// </summary>\r\n    public interface INonCachebleRequestHostnameMapper\r\n    {\r\n        /// <summary>\r\n        /// Gets a hostname to redirect to.\r\n        /// </summary>\r\n        /// <param name=\"hostname\"></param>\r\n        /// <returns></returns>\r\n        string GetRedirectToHostname(string hostname);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/IRenderingResponseHandlerFacade.cs",
    "content": "﻿using Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n\tinternal interface IRenderingResponseHandlerFacade\r\n\t{\r\n        RenderingResponseHandlerResult GetDataResponseHandling(DataEntityToken requestedItemEntityToken);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/IPageContentFilter.cs",
    "content": "using Composite.Core.Xml;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    /// <summary>\r\n    /// An interface that allows post processing of pages generated with <see cref=\"PageRenderer\"/> class.\r\n    /// </summary>\r\n    public interface IPageContentFilter\r\n    {\r\n        /// <summary>\r\n        /// Filters the output.\r\n        /// </summary>\r\n        /// <param name=\"document\">The document to be updated.</param>\r\n        /// <param name=\"page\">The C1 page currently being rendered.</param>\r\n        /// <returns></returns>\r\n        void Filter(XhtmlDocument document, IPage page);\r\n\r\n        /// <summary>\r\n        /// Gets the execution order. Filters with lower values will be executed first.\r\n        /// </summary>\r\n        int Order { get; }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/IXElementToControlMapper.cs",
    "content": "﻿using System.Xml.Linq;\r\nusing System.Web.UI;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IXElementToControlMapper\r\n\t{\r\n        /// <exclude />\r\n        bool TryGetControlFromXElement(XElement element, out Control control);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/PageAssociationScopeEnum.cs",
    "content": "﻿//namespace Composite.Core.WebClient.Renderings.Page\r\n//{\r\n//    /// <summary>    \r\n//    /// </summary>\r\n//    /// <exclude />\r\n//    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n//    public enum SitemapScope\r\n//    {\r\n//        CurrentPage = 0,\r\n//        CurrentAndDescendantPages = 1,\r\n//        ChildPages = 2,\r\n//        SiblingPages = 15,\r\n//        AncestorPages = 3,\r\n//        AncestorAndCurrent = 4,\r\n//        ParentPage = 5,\r\n//        Level1Page = 6,\r\n//        Level2Page = 7,\r\n//        Level3Page = 8,\r\n//        Level4Page = 9,\r\n//        Level1AndSiblings = 16,\r\n//        Level2AndSiblings = 17,\r\n//        Level3AndSiblings = 18,\r\n//        Level4AndSiblings = 19,\r\n//        Level1AndDescendants = 10,\r\n//        Level2AndDescendants = 11,\r\n//        Level3AndDescendants = 12,\r\n//        Level4AndDescendants = 13,\r\n//        AllPages = 14\r\n//    }\r\n//}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/PagePreviewBuilder.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    /// <summary>\r\n    /// Allow previewing a page 'in mem' in a simulated GET request. Requires IIS to run in \"Integrated\" pipeline mode.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class PagePreviewBuilder\r\n    {\r\n        /// <summary>\r\n        /// Execute an 'im mem' preview request of the provided page and content. Requires IIS to run in \"Integrated\" pipeline mode.\r\n        /// </summary>\r\n        /// <param name=\"selectedPage\">Page to render. Functionality reading the rendered page ID will get the ID from this object.</param>\r\n        /// <param name=\"contents\">Content to render on the page</param>\r\n        /// <returns>\r\n        /// In Pipeline mode the content is written directly to the HttpContext and an empty string is returned.\r\n        /// The IIS classic mode is no longer supported and will throw an exception. \r\n        /// </returns>\r\n        public static string RenderPreview(IPage selectedPage, IList<IPagePlaceholderContent> contents)\r\n        {\r\n            return RenderPreview(selectedPage, contents, RenderingReason.PreviewUnsavedChanges);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Execute an 'im mem' preview request of the provided page and content. Requires IIS to run in \"Integrated\" pipeline mode.\r\n        /// </summary>\r\n        /// <param name=\"selectedPage\">Page to render. Functionality reading the rendered page ID will get the ID from this object.</param>\r\n        /// <param name=\"contents\">Content to render on the page</param>\r\n        /// <param name=\"renderingReason\">The rendering reason</param>\r\n        /// <returns>\r\n        /// In Pipeline mode the content is written directly to the HttpContext and an empty string is returned.\r\n        /// The IIS classic mode is no longer supported and will throw an exception. \r\n        /// </returns>\r\n        public static string RenderPreview(IPage selectedPage, IList<IPagePlaceholderContent> contents, RenderingReason renderingReason)\r\n        {\r\n            if (!HttpRuntime.UsingIntegratedPipeline)\r\n            {\r\n                throw new InvalidOperationException(\"IIS classic mode not supported\");\r\n            }\r\n\r\n            var previewKey = Guid.NewGuid();\r\n            PagePreviewContext.Save(previewKey, selectedPage, contents, renderingReason);\r\n\r\n            // The header trick here is to work around (what seems to be) a bug in .net 4.5, where preserveForm=false is ignored\r\n            // asp.net 4.5 request validation will see the 'page edit http post' data and start bitching. It really should not.\r\n            var headers = new System.Collections.Specialized.NameValueCollection\r\n            {\r\n                {\"Content-Length\", \"0\"}\r\n            };\r\n\r\n            var ctx = HttpContext.Current;\r\n            string cookieHeader = ctx.Request.Headers[\"Cookie\"];\r\n            if (!string.IsNullOrEmpty(cookieHeader))\r\n            {\r\n                headers.Add(\"Cookie\", cookieHeader);\r\n            }\r\n\r\n            string previewPath = $\"~/Renderers/PagePreview?{PagePreviewContext.PreviewKeyUrlParameter}={previewKey}\";\r\n            ctx.Server.TransferRequest(previewPath, false, \"GET\", headers);\r\n\r\n            return String.Empty;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/PagePreviewContext.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    public static class PagePreviewContext\r\n    {\r\n        public static readonly string PreviewKeyUrlParameter = \"previewKey\";\r\n\r\n        private static readonly TimeSpan PreviewExpirationTimeSpan = new TimeSpan(0, 20, 0);\r\n\r\n        private static string CacheKey_Page(Guid key) => key + \"_SelectedPage\";\r\n        private static string CacheKey_Contents(Guid key) => key + \"_SelectedContents\";\r\n        private static string CacheKey_RenderingReason(Guid key) => key + \"_RenderingReason\";\r\n\r\n        public static void Save(Guid previewKey, IPage selectedPage, IList<IPagePlaceholderContent> contents, RenderingReason renderingReason)\r\n        {\r\n            var cache = HttpRuntime.Cache;\r\n\r\n            cache.Add(CacheKey_Page(previewKey), selectedPage, null, Cache.NoAbsoluteExpiration, PreviewExpirationTimeSpan, CacheItemPriority.NotRemovable, null);\r\n            cache.Add(CacheKey_Contents(previewKey), contents, null, Cache.NoAbsoluteExpiration, PreviewExpirationTimeSpan, CacheItemPriority.NotRemovable, null);\r\n            cache.Add(CacheKey_RenderingReason(previewKey), renderingReason, null, Cache.NoAbsoluteExpiration, PreviewExpirationTimeSpan, CacheItemPriority.NotRemovable, null);\r\n        }\r\n\r\n        public static bool TryGetPreviewKey(HttpRequest request, out Guid previewKey)\r\n        {\r\n            return TryGetPreviewKey(request.QueryString, out previewKey);\r\n        }\r\n\r\n        public static bool TryGetPreviewKey(HttpRequestBase request, out Guid previewKey)\r\n        {\r\n            return TryGetPreviewKey(request.QueryString, out previewKey);\r\n        }\r\n\r\n        private static bool TryGetPreviewKey(NameValueCollection queryString, out Guid previewKey)\r\n        {\r\n            var value = queryString[PreviewKeyUrlParameter];\r\n            if (!string.IsNullOrWhiteSpace(value) && Guid.TryParse(value, out previewKey))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            previewKey = Guid.Empty;\r\n            return false;\r\n        }\r\n\r\n        public static IPage GetPage(Guid previewKey)\r\n            => (IPage) HttpRuntime.Cache.Get(CacheKey_Page(previewKey));\r\n\r\n        public static IList<IPagePlaceholderContent> GetPageContents(Guid previewKey)\r\n            => (IList<IPagePlaceholderContent>)HttpRuntime.Cache.Get(CacheKey_Contents(previewKey));\r\n\r\n        public static RenderingReason GetRenderingReason(Guid previewKey)\r\n            => (RenderingReason)HttpRuntime.Cache.Get(CacheKey_RenderingReason(previewKey));\r\n\r\n        public static void Remove(Guid previewKey)\r\n        {\r\n            var cache = HttpRuntime.Cache;\r\n\r\n            cache.Remove(CacheKey_Page(previewKey));\r\n            cache.Remove(CacheKey_Contents(previewKey));\r\n            cache.Remove(CacheKey_RenderingReason(previewKey));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/PageRenderer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\nusing Composite.Core.Xml;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Caching;\r\nusing Composite.Plugins.PageTemplates.XmlPageTemplates;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PageRenderer\r\n    {\r\n        private static readonly string LogTitle = typeof(PageRenderer).Name;\r\n        private static readonly NameBasedAttributeComparer _nameBasedAttributeComparer = new NameBasedAttributeComparer();\r\n\r\n        private static readonly XName XName_function = Namespaces.Function10 + \"function\";\r\n        private static readonly XName XName_Id = \"id\";\r\n        private static readonly XName XName_Name = \"name\";\r\n\r\n        /// <exclude />\r\n        public static FunctionContextContainer GetPageRenderFunctionContextContainer()\r\n        {\r\n            var mapper = new XEmbeddedControlMapper();\r\n\r\n            var contextContainer = new FunctionContextContainer\r\n            {\r\n                XEmbedableMapper = mapper,\r\n                SuppressXhtmlExceptions = GlobalSettingsFacade.PrettifyRenderFunctionExceptions \r\n                                            || PageRenderer.RenderingReason == RenderingReason.ScreenshotGeneration \r\n            };\r\n\r\n            return contextContainer;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Control Render(this IPage page, IEnumerable<IPagePlaceholderContent> placeholderContents, FunctionContextContainer functionContextContainer)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n            Verify.ArgumentNotNull(functionContextContainer, \"functionContextContainer\");\r\n            Verify.ArgumentCondition(functionContextContainer.XEmbedableMapper is XEmbeddedControlMapper,\r\n                \"functionContextContainer\", $\"Unknown or missing XEmbedableMapper on context container. Use {nameof(GetPageRenderFunctionContextContainer)}().\");\r\n\r\n            CurrentPage = page;\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                string url = PageUrls.BuildUrl(page);\r\n\r\n                using (TimerProfilerFacade.CreateTimerProfiler(url ?? \"(no url)\"))\r\n                {\r\n                    var cultureInfo = page.DataSourceId.LocaleScope;\r\n                    System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;\r\n                    System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;\r\n\r\n                    XEmbeddedControlMapper mapper = (XEmbeddedControlMapper)functionContextContainer.XEmbedableMapper;\r\n\r\n                    XDocument document = TemplateInfo.GetTemplateDocument(page.TemplateId);\r\n\r\n                    ResolvePlaceholders(document, placeholderContents);\r\n\r\n                    Control c = Render(document, functionContextContainer, mapper, page);\r\n\r\n                    return c;\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static XhtmlDocument ParsePlaceholderContent(IPagePlaceholderContent placeholderContent)\r\n        {\r\n            if (string.IsNullOrEmpty(placeholderContent?.Content))\r\n            {\r\n                return new XhtmlDocument();\r\n            }\r\n\r\n            if (placeholderContent.Content.StartsWith(\"<html\"))\r\n            {\r\n                try\r\n                {\r\n                    return XhtmlDocument.Parse(placeholderContent.Content);\r\n                }\r\n                catch (Exception) { }\r\n            }\r\n\r\n            return XhtmlDocument.Parse($\"<html xmlns='{Namespaces.Xhtml}'><head/><body>{placeholderContent.Content}</body></html>\");\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Replaces &lt;rendering:placeholder  ... /&gt; tags with provided placeholder contents. Used by <see cref=\"XmlPageRenderer\"/>.\r\n        /// </summary>\r\n        /// <param name=\"document\">The document to be updated.</param>\r\n        /// <param name=\"placeholderContents\">The placeholder content to be used.</param>\r\n        internal static void ResolvePlaceholders(XDocument document, IEnumerable<IPagePlaceholderContent> placeholderContents)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                var placeHolders = \r\n                    (from  placeholder in document.Descendants(RenderingElementNames.PlaceHolder)\r\n                    let idAttribute = placeholder.Attribute(RenderingElementNames.PlaceHolderIdAttribute)\r\n                    where idAttribute != null\r\n                    select new { Element = placeholder, IdAttribute = idAttribute}).ToList();\r\n\r\n                foreach (var placeholder in placeHolders)\r\n                {\r\n                    string placeHolderId = placeholder.IdAttribute.Value;\r\n                    placeholder.IdAttribute.Remove();\r\n\r\n                    IPagePlaceholderContent placeHolderContent =\r\n                        placeholderContents.FirstOrDefault(f => f.PlaceHolderId == placeHolderId);\r\n\r\n                    XhtmlDocument xhtmlDocument = ParsePlaceholderContent(placeHolderContent);\r\n                    placeholder.Element.ReplaceWith(xhtmlDocument.Root);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Control Render(this IPage page, IEnumerable<IPagePlaceholderContent> placeholderContents)\r\n        {\r\n            return page.Render(placeholderContents, GetPageRenderFunctionContextContainer());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Guid CurrentPageId => CurrentPage?.Id ?? Guid.Empty;\r\n\r\n\r\n        /// <summary>\r\n        /// Returns <value>true</value> if the page is rendered in a \"Preview\" mode\r\n        /// </summary>\r\n        public static RenderingReason RenderingReason\r\n        {\r\n            get\r\n            {\r\n                return RequestLifetimeCache.TryGet<RenderingReason>(\"PageRenderer.RenderingReason\");\r\n            }\r\n            set\r\n            {\r\n                RequestLifetimeCache.Add(\"PageRenderer.RenderingReason\", value);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IPage CurrentPage\r\n        {\r\n            get\r\n            {\r\n                return RequestLifetimeCache.TryGet<IPage>(\"PageRenderer.IPage\");\r\n            }\r\n            set\r\n            {\r\n                var currentValue = CurrentPage;\r\n                if (currentValue == value)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                Verify.IsNull(currentValue, \"CurrentPage is already set\");\r\n\r\n                RequestLifetimeCache.Add(\"PageRenderer.IPage\", value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo CurrentPageCulture => CurrentPage?.DataSourceId.LocaleScope;\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete]\r\n        public static IEnumerable<IData> GetCurrentPageAssociatedData(Type type)\r\n        {\r\n            return PageRenderer.CurrentPage.GetReferees(type);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete]\r\n        public static IEnumerable<IData> GetCurrentPageAssociatedData<T>() where T : IData\r\n        {\r\n            return PageRenderer.CurrentPage.GetReferees(typeof(T));\r\n        }\r\n\r\n\r\n        internal static void ProcessXhtmlDocument(XhtmlDocument xhtmlDocument, IPage page)\r\n        {\r\n            using (Profiler.Measure(\"Normalizing XHTML document\"))\r\n            {\r\n                NormalizeXhtmlDocument(xhtmlDocument);\r\n            }\r\n\r\n            using (Profiler.Measure(\"Resolving relative paths\"))\r\n            {\r\n                ResolveRelativePaths(xhtmlDocument);\r\n            }\r\n\r\n            using (Profiler.Measure(\"Appending C1 meta tags\"))\r\n            {\r\n                AppendC1MetaTags(page, xhtmlDocument);\r\n            }\r\n\r\n            using (Profiler.Measure(\"Sorting <head> elements\"))\r\n            {\r\n                PrioritizeHeadNodes(xhtmlDocument);\r\n            }\r\n\r\n            using (Profiler.Measure(\"Parsing localization strings\"))\r\n            {\r\n                LocalizationParser.Parse(xhtmlDocument);\r\n            }\r\n\r\n            using (Profiler.Measure(\"Converting URLs from internal to public format (XhtmlDocument)\"))\r\n            {\r\n                InternalUrls.ConvertInternalUrlsToPublic(xhtmlDocument);\r\n            }\r\n\r\n            var filters = ServiceLocator.GetServices<IPageContentFilter>().OrderBy(f => f.Order).ToList();\r\n            if (filters.Any())\r\n            {\r\n                using (Profiler.Measure(\"Executing page content filters\"))\r\n                {\r\n                    filters.ForEach(filter =>\r\n                    {\r\n                        using (Profiler.Measure($\"Filter: {filter.GetType().FullName}\"))\r\n                        {\r\n                            filter.Filter(xhtmlDocument, page);\r\n                        }\r\n                    });\r\n                }\r\n            }\r\n        }\r\n\r\n        private static bool IsTitleOrMetaTag(XElement e) =>\r\n            e.Name.LocalName.Equals(\"title\", StringComparison.OrdinalIgnoreCase)\r\n            || e.Name.LocalName.Equals(\"meta\", StringComparison.OrdinalIgnoreCase);\r\n\r\n        private static bool CheckForDuplication(HashSet<string> values, string value)\r\n        {\r\n            if (!string.IsNullOrWhiteSpace(value))\r\n            {\r\n                if (values.Contains(value)) return true;\r\n\r\n                values.Add(value);\r\n            }\r\n            \r\n            return false;\r\n        }\r\n\r\n        private static string AttributesAsString(this XElement e)\r\n        {\r\n            var str = new StringBuilder();\r\n            foreach (var attr in e.Attributes().OrderBy(a => a.Name.NamespaceName).ThenBy(a => a.Name.LocalName))\r\n            {\r\n                str.Append(attr.Name.LocalName);\r\n                str.Append(\"=\\\"\");\r\n                str.Append(attr.Value);\r\n                str.Append(\"\\\" \");\r\n            }\r\n\r\n            return str.ToString();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void ProcessDocumentHead(XhtmlDocument xhtmlDocument)\r\n        {\r\n            RemoveDuplicates(xhtmlDocument.Head);\r\n        }\r\n\r\n        private static void RemoveDuplicates(XElement head)\r\n        {\r\n            var uniqueIdValues = new HashSet<string>(StringComparer.OrdinalIgnoreCase);\r\n            var uniqueMetaNameValues = new HashSet<string>(StringComparer.OrdinalIgnoreCase);\r\n            var uniqueScriptAttributes = new HashSet<string>(StringComparer.OrdinalIgnoreCase);\r\n            var uniqueLinkAttributes = new HashSet<string>(StringComparer.OrdinalIgnoreCase);\r\n\r\n            var priorityOrderedElements = new List<XElement>();\r\n\r\n            priorityOrderedElements.AddRange(head.Elements().Where(IsTitleOrMetaTag));\r\n            priorityOrderedElements.Reverse();\r\n            priorityOrderedElements.AddRange(head.Elements().Where(e => !IsTitleOrMetaTag(e)));\r\n\r\n            bool titleTagEncountered = false;\r\n\r\n            foreach (var e in priorityOrderedElements)\r\n            {\r\n                var tagName = e.Name.LocalName.ToLowerInvariant();\r\n                bool toBeRemoved;\r\n\r\n                if (tagName == \"title\")\r\n                {\r\n                    toBeRemoved = titleTagEncountered;\r\n                    titleTagEncountered = true;\r\n                }\r\n                else\r\n                {\r\n                    var id = (string)e.Attribute(XName_Id);\r\n\r\n                    toBeRemoved = CheckForDuplication(uniqueIdValues, id);\r\n\r\n                    if (!toBeRemoved && !e.Nodes().Any())\r\n                    {\r\n                        switch (tagName)\r\n                        {\r\n                            case \"meta\":\r\n                                var name = (string)e.Attribute(XName_Name);\r\n                                toBeRemoved = CheckForDuplication(uniqueMetaNameValues, name);\r\n                                break;\r\n                            case \"script\":\r\n                                toBeRemoved = CheckForDuplication(uniqueScriptAttributes, e.AttributesAsString());\r\n                                break;\r\n                            case \"link\":\r\n                                toBeRemoved = CheckForDuplication(uniqueLinkAttributes, e.AttributesAsString());\r\n                                break;\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (toBeRemoved)\r\n                {\r\n                    e.Remove();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Control Render(XDocument document, FunctionContextContainer contextContainer, IXElementToControlMapper mapper, IPage page)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                bool disableCaching = false;\r\n\r\n                using (Profiler.Measure(\"Executing embedded functions\"))\r\n                {\r\n                    ExecuteFunctionsRec(document.Root, contextContainer, func =>\r\n                    {\r\n                        if (!disableCaching && !FunctionAllowsCaching(func))\r\n                        {\r\n                            disableCaching = true;\r\n                        }\r\n\r\n                        return true;\r\n                    });\r\n                }\r\n\r\n                if (disableCaching)\r\n                {\r\n                    using (Profiler.Measure(\"PageRenderer: Disabling HTTP caching as at least one of the functions is not cacheable\"))\r\n                    {\r\n                        HttpContext.Current?.Response.Cache.SetCacheability(HttpCacheability.NoCache);\r\n                    }\r\n                }\r\n\r\n                using (Profiler.Measure(\"Resolving page fields\"))\r\n                {\r\n                    ResolvePageFields(document, page);\r\n                }\r\n\r\n                using (Profiler.Measure(\"Normalizing ASP.NET forms\"))\r\n                {\r\n                    NormalizeAspNetForms(document);\r\n                }\r\n\r\n                if (document.Root.Name != RenderingElementNames.Html)\r\n                {\r\n                    return new LiteralControl(document.ToString());\r\n                }\r\n\r\n                var xhtmlDocument = new XhtmlDocument(document);\r\n\r\n                ProcessXhtmlDocument(xhtmlDocument, page);\r\n\r\n                using (Profiler.Measure(\"Converting XHTML document into an ASP.NET control\"))\r\n                {\r\n                    return xhtmlDocument.AsAspNetControl(mapper);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static void PrioritizeHeadNodes(XhtmlDocument xhtmlDocument)\r\n        {\r\n            var prioritizedHeadNodes = new List<Tuple<int, XNode>>();\r\n            foreach (var node in xhtmlDocument.Head.Nodes().ToList())\r\n            {\r\n                int p = GetHeadNodePriority(node);\r\n                prioritizedHeadNodes.Add(new Tuple<int, XNode>(p, node));\r\n                node.Remove();\r\n            }\r\n            xhtmlDocument.Head.Add(prioritizedHeadNodes.OrderBy(f => f.Item1).Select(f => f.Item2));\r\n        }\r\n\r\n        private static string AttributeValueLowered(this XElement element, string attributeName)\r\n        {\r\n            string value = (string)element.Attribute(attributeName);\r\n            return value?.ToLowerInvariant();\r\n        }\r\n\r\n        private static int GetHeadNodePriority(XNode headNode)\r\n        {\r\n            if (headNode is XElement headElement)\r\n            {\r\n                if (headElement.Name.LocalName == \"title\") return 0;\r\n                if (headElement.Name.LocalName == \"meta\")\r\n                {\r\n                    if (headElement.AttributeValueLowered(\"http-equiv\") == \"content-type\") return 10;\r\n                    if (headElement.Attribute(\"charset\") != null) return 11;\r\n                    if (headElement.Attribute(\"http-equiv\") != null) return 11;\r\n\r\n                    if (headElement.AttributeValueLowered(\"name\") == \"description\") return 12;\r\n\r\n                    if (headElement.Attribute(\"name\") != null) return 20;\r\n\r\n                    if (headElement.Attribute(\"property\") != null) return 25;\r\n\r\n                    return 20;\r\n                }\r\n                if (headElement.Name.LocalName == \"link\") return 30;\r\n                if (headElement.Name.LocalName == \"script\") return 40;\r\n            }\r\n\r\n            return 100;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Appends the c1 meta tags to the head section. Those tag are used later on by SEO assistant.\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        /// <param name=\"xhtmlDocument\">The XHTML document.</param>\r\n        public static void AppendC1MetaTags(IPage page, XhtmlDocument xhtmlDocument)\r\n        {\r\n            if (UserValidationFacade.IsLoggedIn())\r\n            {\r\n                bool emitMenuTitleMetaTag = string.IsNullOrEmpty(page.MenuTitle) == false;\r\n                bool emitUrlMetaTag = string.IsNullOrEmpty(page.UrlTitle) == false;\r\n\r\n                if (emitMenuTitleMetaTag || emitUrlMetaTag)\r\n                {\r\n                    xhtmlDocument.Head.Add(\r\n                        new XComment(\"The C1.* meta tags are only emitted when you are logged in\"),\r\n                        new XElement(Namespaces.Xhtml + \"link\",\r\n                            new XAttribute(\"rel\", \"schema.C1\"),\r\n                            new XAttribute(\"href\", \"http://www.composite.net/ns/c1/seoassistant\")));\r\n\r\n                    if (emitMenuTitleMetaTag)\r\n                    {\r\n                        xhtmlDocument.Head.Add(\r\n                            new XElement(Namespaces.Xhtml + \"meta\",\r\n                                new XAttribute(\"name\", \"C1.menutitle\"),\r\n                                new XAttribute(\"content\", page.MenuTitle)));\r\n                    }\r\n\r\n                    if (emitUrlMetaTag)\r\n                    {\r\n                        var editPreview = PageRenderer.RenderingReason == RenderingReason.PreviewUnsavedChanges;\r\n\r\n                        string url = PageUrls.BuildUrl(page) ?? PageUrls.BuildUrl(page, UrlKind.Internal);\r\n\r\n                        var pageUrl = string.Format(\"{0}{1}{2}\",\r\n                            url.Replace(\"/c1mode(unpublished)\", \"\").Replace(\"/c1mode(relative)\",\"\"),\r\n                            editPreview ? \"/\" + page.UrlTitle : C1PageRoute.GetPathInfo(),\r\n                            editPreview ? \"\" : HttpContext.Current.Request.Url.Query);\r\n\r\n                        xhtmlDocument.Head.Add(\r\n                            new XElement(Namespaces.Xhtml + \"meta\",\r\n                                new XAttribute(\"name\", \"C1.urlseowords\"),\r\n                                new XAttribute(\"content\", pageUrl)));\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void ResolveRelativePaths(XhtmlDocument xhtmlDocument)\r\n        {\r\n            IEnumerable<XElement> xhtmlElements = xhtmlDocument.Descendants().Where(f => f.Name.Namespace == Namespaces.Xhtml);\r\n            IEnumerable<XAttribute> pathAttributes = xhtmlElements.Attributes().Where(f => f.Name.LocalName == \"src\" || f.Name.LocalName == \"href\" || f.Name.LocalName == \"action\");\r\n\r\n            string applicationVirtualPath = UrlUtils.PublicRootPath;\r\n\r\n            List<XAttribute> relativePathAttributes = pathAttributes.Where(f => f.Value.StartsWith(\"~/\") || f.Value.StartsWith(\"%7E/\")).ToList();\r\n\r\n            foreach (XAttribute relativePathAttribute in relativePathAttributes)\r\n            {\r\n                int tildePrefixLength = (relativePathAttribute.Value.StartsWith(\"~\") ? 1 : 3);\r\n                relativePathAttribute.Value = applicationVirtualPath + relativePathAttribute.Value.Substring(tildePrefixLength);\r\n            }\r\n\r\n            if (applicationVirtualPath.Length > 1)\r\n            {\r\n                List<XAttribute> hardRootedPathAttributes = pathAttributes.Where(f => f.Value.StartsWith(\"/Renderers/\")).ToList();\r\n\r\n                foreach (XAttribute hardRootedPathAttribute in hardRootedPathAttributes)\r\n                {\r\n                    hardRootedPathAttribute.Value = applicationVirtualPath + hardRootedPathAttribute.Value;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void NormalizeAspNetForms(XDocument document)\r\n        {\r\n            var aspNetFormXName = Namespaces.AspNetControls + \"form\";\r\n            List<XElement> aspNetFormElements = document.Descendants(aspNetFormXName).Reverse().ToList();\r\n\r\n            foreach (XElement aspNetFormElement in aspNetFormElements)\r\n            {\r\n                if (aspNetFormElement.Ancestors(aspNetFormXName).Any())\r\n                {\r\n                    aspNetFormElement.ReplaceWith(aspNetFormElement.Nodes());\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void ResolvePageFields(XDocument document, IPage page)\r\n        {\r\n            foreach (XElement elem in document.Descendants(RenderingElementNames.PageTitle).ToList())\r\n            {\r\n                elem.ReplaceWith(page.Title);\r\n            }\r\n\r\n            foreach (XElement elem in document.Descendants(RenderingElementNames.PageAbstract).ToList())\r\n            {\r\n                elem.ReplaceWith(page.Description);\r\n            }\r\n\r\n\r\n            foreach (XElement elem in document.Descendants(RenderingElementNames.PageMetaTagDescription).ToList())\r\n            {\r\n                if (string.IsNullOrEmpty(page.Description))\r\n                {\r\n                    elem.Remove();\r\n                    continue;\r\n                }\r\n\r\n                elem.ReplaceWith(new XElement(Namespaces.Xhtml + \"meta\",\r\n                    new XAttribute(\"name\", \"description\"),\r\n                    new XAttribute(\"content\", page.Description)));\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes functions that match the predicate recursively,\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"element\"></param>\r\n        /// <param name=\"functionContext\"></param>\r\n        /// <param name=\"functionShouldBeExecuted\">A predicate that defines whether a function should be executed based on its name.</param>\r\n        /// <returns><value>True</value> if all of the functions has matched the predicate</returns>\r\n        internal static bool ExecuteFunctionsRec(\r\n            XElement element, \r\n            FunctionContextContainer functionContext,\r\n            Predicate<string> functionShouldBeExecuted = null)\r\n        {\r\n            if (element.Name != XName_function)\r\n            {\r\n                var children = element.Elements();\r\n                if (element.Elements(XName_function).Any())\r\n                {\r\n                    // Allows replacing the function elements without breaking the iterator\r\n                    children = children.ToList(); \r\n                }\r\n\r\n                bool allChildrenExecuted = true;\r\n                foreach (var childElement in children)\r\n                {\r\n                    if (!ExecuteFunctionsRec(childElement, functionContext, functionShouldBeExecuted))\r\n                    {\r\n                        allChildrenExecuted = false;\r\n                    }\r\n                }\r\n                return allChildrenExecuted;\r\n            }\r\n\r\n            bool allRecFunctionsExecuted = true;\r\n\r\n            string functionName = (string) element.Attribute(XName_Name);\r\n            object result;\r\n            try\r\n            {\r\n                // Evaluating function calls in parameters\r\n                IEnumerable<XElement> parameters = element.Elements();\r\n\r\n                bool allParametersEvaluated = true;\r\n                foreach (XElement parameterNode in parameters.ToList())\r\n                {\r\n                    var parameterName = (string)parameterNode.Attribute(XName_Name);\r\n                    if (ParameterIsLazyEvaluated(functionName, parameterName))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    if (!ExecuteFunctionsRec(parameterNode, functionContext, functionShouldBeExecuted))\r\n                    {\r\n                        allParametersEvaluated = false;\r\n                    }\r\n                }\r\n\r\n                if (!allParametersEvaluated)\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                if (functionShouldBeExecuted != null &&\r\n                    !functionShouldBeExecuted(functionName))\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                // Executing a function call\r\n                BaseRuntimeTreeNode runtimeTreeNode = FunctionTreeBuilder.Build(element);\r\n                result = runtimeTreeNode.GetValue(functionContext);\r\n\r\n                if (result != null)\r\n                {\r\n                    // Evaluating functions in a result of a function call\r\n                    result = functionContext.MakeXEmbedable(result);\r\n\r\n                    foreach (XElement xelement in GetXElements(result).ToList())\r\n                    {\r\n                        if (!ExecuteFunctionsRec(xelement, functionContext, functionShouldBeExecuted))\r\n                        {\r\n                            allRecFunctionsExecuted = false;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                using (Profiler.Measure(\"PageRenderer. Logging exception: \" + ex.Message))\r\n                {\r\n                    XElement errorBoxHtml;\r\n\r\n                    if (!functionContext.ProcessException(functionName, ex, LogTitle, out errorBoxHtml))\r\n                    {\r\n                        throw;\r\n                    }\r\n\r\n                    result = errorBoxHtml;\r\n                }\r\n            }\r\n\r\n            ReplaceFunctionWithResult(element, result);\r\n\r\n            return allRecFunctionsExecuted;\r\n        }\r\n\r\n        private static bool ParameterIsLazyEvaluated(string functionName, string parameterName)\r\n        {\r\n            return functionName == PageObjectCacheFunction.FunctionName &&\r\n                   parameterName == PageObjectCacheFunction.ParameterNames.ObjectToCache;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void ExecuteEmbeddedFunctions(XElement element, FunctionContextContainer functionContext)\r\n        {\r\n            ExecuteFunctionsRec(element, functionContext, null);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes all cacheable (not dynamic) functions and returns <value>True</value> \r\n        /// if all of the functions were cacheable.\r\n        /// </summary>\r\n        /// <param name=\"element\"></param>\r\n        /// <param name=\"functionContext\"></param>\r\n        /// <returns></returns>\r\n        internal static bool ExecuteCacheableFunctions(XElement element, FunctionContextContainer functionContext)\r\n        {\r\n            return ExecuteFunctionsRec(element, functionContext, FunctionAllowsCaching);\r\n        }\r\n\r\n        private static bool FunctionAllowsCaching(string name)\r\n        {\r\n            var function = FunctionFacade.GetFunction(name);\r\n            return !(function is IDynamicFunction df && df.PreventFunctionOutputCaching);\r\n        }\r\n\r\n        private static void ReplaceFunctionWithResult(XElement functionCall, object result)\r\n        {\r\n            if (result == null)\r\n            {\r\n                functionCall.Remove();\r\n                return;\r\n            }\r\n\r\n            if (result is XAttribute && functionCall.Parent != null)\r\n            {\r\n                functionCall.Parent.Add(result);\r\n                functionCall.Remove();\r\n            }\r\n            else\r\n            {\r\n                functionCall.ReplaceWith(result);\r\n            }\r\n        }\r\n\r\n        private static IEnumerable<XElement> GetXElements(object source)\r\n        {\r\n            if (source is XElement element)\r\n            {\r\n                yield return element;\r\n            }\r\n\r\n            if (source is IEnumerable<XNode> nodes)\r\n            {\r\n                foreach (var xElement in nodes.OfType<XElement>())\r\n                {\r\n                    yield return xElement;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private class NameBasedAttributeComparer : IEqualityComparer<XAttribute>\r\n        {\r\n            public bool Equals(XAttribute x, XAttribute y)\r\n            {\r\n                return x.Name == y.Name;\r\n            }\r\n\r\n            public int GetHashCode(XAttribute obj)\r\n            {\r\n                return obj.Name.GetHashCode();\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void NormalizeXhtmlDocument(XhtmlDocument rootDocument)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                while (true)\r\n                {\r\n                    XElement nestedDocument = rootDocument.Root.Descendants(XhtmlDocument.XName_html).FirstOrDefault();\r\n\r\n                    if (nestedDocument == null) break;\r\n                    \r\n                    var nestedHead = nestedDocument.Element(XhtmlDocument.XName_head);\r\n                    var nestedBody = nestedDocument.Element(XhtmlDocument.XName_body);\r\n\r\n                    Verify.IsNotNull(nestedHead, \"XHTML document is missing <head /> element\");\r\n                    Verify.IsNotNull(nestedBody, \"XHTML document is missing <body /> element\");\r\n\r\n                    rootDocument.Root.Add(nestedDocument.Attributes().Except(rootDocument.Root.Attributes(), _nameBasedAttributeComparer));\r\n\r\n                    rootDocument.Head.Add(nestedHead.Nodes());\r\n\r\n                    rootDocument.Head.Add(nestedHead.Attributes().Except(rootDocument.Head.Attributes(), _nameBasedAttributeComparer));\r\n                    rootDocument.Body.Add(nestedBody.Attributes().Except(rootDocument.Body.Attributes(), _nameBasedAttributeComparer));\r\n\r\n                    nestedDocument.ReplaceWith(nestedBody.Nodes());\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool DisableAspNetPostback(Control c)\r\n        {\r\n            bool formDisabled;\r\n            DisableAspNetPostback(c, out formDisabled);\r\n            return formDisabled;\r\n        }\r\n\r\n\r\n        private static void DisableAspNetPostback(Control c, out bool formDisabled)\r\n        {\r\n            formDisabled = false;\r\n\r\n            if (c is HtmlForm form)\r\n            {\r\n                form.Attributes.Add(\"onsubmit\", \"alert('Postback disabled in preview mode'); return false;\");\r\n                formDisabled = true;\r\n                return;\r\n            }\r\n\r\n            if (c is HtmlHead)\r\n            {\r\n                return;\r\n            }\r\n\r\n            foreach (Control child in c.Controls)\r\n            {\r\n                DisableAspNetPostback(child, out formDisabled);\r\n                if (formDisabled) break;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/PageStructureInfo.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing MapKey = System.Tuple<Composite.Data.PublicationScope, string, string>;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PageStructureInfo\r\n    {\r\n        /// <exclude />\r\n        [Obsolete(\"Now sitemap generates xml that belongs to empty namespace, so this constant shouldn't be used\", true)]\r\n        public const string SitemapNamespaceString = \"\";\r\n\r\n        internal static class AttributeNames\r\n        {\r\n            public static XName Id = \"Id\";\r\n            public static XName Title = \"Title\";\r\n            public static XName MenuTitle = \"MenuTitle\";\r\n            public static XName UrlTitle = \"UrlTitle\";\r\n            public static XName Description = \"Description\";\r\n            public static XName ChangedDate = \"ChangedDate\";\r\n            public static XName ChangedBy = \"ChangedBy\";\r\n            public static XName URL = \"URL\";\r\n            public static XName FriendlyUrl = \"FriendlyUrl\";\r\n            public static XName Depth = \"Depth\";\r\n        }\r\n\r\n        internal static class ElementNames\r\n        {\r\n            public static XName Page = \"Page\"; \r\n        }\r\n\r\n        private class Version\r\n        {\r\n            public int VersionNumber;\r\n        }\r\n\r\n        /// <summary>\r\n        /// An immutable instanse of a pages map\r\n        /// </summary>\r\n        private class Map\r\n        {\r\n            public IEnumerable<XElement> RootPagesLookup;\r\n            public Dictionary<string, Guid> UrlToIdLookup;\r\n            public Dictionary<string, Guid> LowerCaseUrlToIdLookup;\r\n            public Dictionary<Guid, string> IdToUrlLookup;\r\n#pragma warning disable 612\r\n            public IPageUrlBuilder PageUrlBuilder;\r\n#pragma warning restore 612\r\n        }\r\n\r\n        private static readonly Hashtable<MapKey, Map> _generatedMaps = new Hashtable<MapKey, Map>();\r\n        private static readonly Hashtable<MapKey, Version> _versions = new Hashtable<MapKey, Version>();\r\n        private static readonly object _updatingLock = new object();\r\n        //private static readonly object[] _buildingLock = new[] { new object(), new object() }; // Separated objects for 'Public' and 'Administrated' scopes\r\n\r\n        private static readonly HashSet<string> _knownNotUniqueUrls = new HashSet<string>();\r\n\r\n        private static readonly XName PageElementName = \"Page\";\r\n\r\n        private static readonly string LogTitle = \"PageStructureInfo\";\r\n\r\n        static PageStructureInfo()\r\n        {\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IPage>(OnPagesChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IPageStructure>(OnPageStructureChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<ISystemActiveLocale>((a, b) => ClearCachedData(), true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IHostnameBinding>((a, b) => ClearCachedData(), true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IUrlConfiguration>((a, b) => ClearCachedData(), true);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Builds a list of [Page Id, Page label] pairs.\r\n        /// The items in the list is returned in document order and the labels are indented with one space for each depth level\r\n        /// of the page.\r\n        /// </summary>\r\n        [Obsolete]\r\n        public static IEnumerable<KeyValuePair<Guid, string>> PageListInDocumentOrder()\r\n        {\r\n            return PageListInDocumentOrder(GetSiteMap(), 0);\r\n        }\r\n\r\n        private static IEnumerable<KeyValuePair<Guid, string>> PageListInDocumentOrder(IEnumerable<XElement> pageElements, int indentLevel)\r\n        {\r\n            var indentString = new string(' ', indentLevel);\r\n\r\n\r\n            foreach (XElement pageElement in pageElements)\r\n            {\r\n                string label = GetLabelForPageElement(indentString, pageElement);\r\n                var id = GetIdForPageElement(pageElement);\r\n                yield return new KeyValuePair<Guid, string>(id, label);\r\n\r\n                foreach (KeyValuePair<Guid, string> childOption in PageListInDocumentOrder(pageElement.Elements(), indentLevel + 1))\r\n                {\r\n                    yield return childOption;\r\n                }\r\n            }\r\n        }\r\n\r\n        internal static Guid GetIdForPageElement(XElement pageElement)\r\n        {\r\n            string id = pageElement.Attribute(AttributeNames.Id).Value;\r\n            return Guid.Parse(id);\r\n        }\r\n\r\n        internal static string GetLabelForPageElement(string indentString, XElement pageElement)\r\n        {\r\n            string labelText = (pageElement.Attribute(AttributeNames.MenuTitle) ?? pageElement.Attribute(AttributeNames.Title)).Value;\r\n\r\n            return string.Format(\"{0}{1}\", indentString, labelText);\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<XElement> GetSiteMap()\r\n        {\r\n            return GetMap().RootPagesLookup;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<XElement> GetSiteMapWithActivePageAnnotations()\r\n        {\r\n            Guid pageId = PageRenderer.CurrentPageId;\r\n\r\n            return GetSiteMapWithActivePageAnnotations(pageId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<XElement> GetSiteMapWithActivePageAnnotations(Guid pageId)\r\n        {\r\n            return GetSitemapByScope(SitemapScope.All, pageId);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns portions of the sitemap in acordance with the specified scope. Sitemap elements are hierarchically\r\n        /// ordered and are marked with 'isopen' and 'iscurrent' attributes when open/selected relative to the supplied pageId.\r\n        /// </summary>\r\n        /// <param name=\"associationScope\">The scope of pages to return. This is relative to the specified pageId.</param>\r\n        /// <param name=\"pageId\">The C1 Page ID to use when defining the scope. This must be a valid page id.</param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<XElement> GetSitemapByScope(SitemapScope associationScope, Guid pageId)\r\n        {\r\n            List<XElement> pageElements = GetSitemapByScopeUnannotated(associationScope, pageId).ToList();\r\n            AnnotatePagesWithOpenAndCurrent(pageId, pageElements);\r\n\r\n            return pageElements;\r\n        }\r\n\r\n        private static IEnumerable<Guid> GetDescendants(Guid pageId)\r\n        {\r\n            foreach (var childId in PageManager.GetChildrenIDs(pageId))\r\n            {\r\n                foreach (var descendantOrSelf in GetDescendantsAndSelf(childId))\r\n                {\r\n                    yield return descendantOrSelf;\r\n                }\r\n            }\r\n        }\r\n\r\n        private static IEnumerable<Guid> GetDescendantsAndSelf(Guid pageId)\r\n        {\r\n            yield return pageId;\r\n\r\n            foreach (var childId in PageManager.GetChildrenIDs(pageId))\r\n            {\r\n                foreach (var descendantOrSelf in GetDescendantsAndSelf(childId))\r\n                {\r\n                    yield return descendantOrSelf;\r\n                }\r\n            }\r\n        }\r\n\r\n        private static List<Guid> GetAncestors(Guid pageId, bool andSelf)\r\n        {\r\n            var result = new List<Guid>();\r\n\r\n            if (andSelf)\r\n            {\r\n                result.Add(pageId);\r\n            }\r\n\r\n            pageId = PageManager.GetParentId(pageId);\r\n\r\n            while (pageId != Guid.Empty)\r\n            {\r\n                result.Add(pageId);\r\n\r\n                pageId = PageManager.GetParentId(pageId);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Guid> GetAssociatedPageIds(Guid pageId, SitemapScope associationScope)\r\n        {\r\n            switch (associationScope)\r\n            {\r\n                case SitemapScope.Current:\r\n                    return new[] {pageId};\r\n                case SitemapScope.All:\r\n                    return DataFacade.GetData<IPage>().Select(p => p.Id).ToList();\r\n                case SitemapScope.Descendants:\r\n                    return GetDescendants(pageId);\r\n                case SitemapScope.DescendantsAndCurrent:\r\n                    return GetDescendantsAndSelf(pageId);\r\n                case SitemapScope.Children:\r\n                    return PageManager.GetChildrenIDs(pageId);\r\n                case SitemapScope.Siblings:\r\n                    Guid parentId = PageManager.GetParentId(pageId);\r\n                    return PageManager.GetChildrenIDs(parentId).Where(i => i != pageId);\r\n                case SitemapScope.SiblingsAndSelf:\r\n                    parentId = PageManager.GetParentId(pageId);\r\n                    return PageManager.GetChildrenIDs(parentId);\r\n                case SitemapScope.Ancestors:\r\n                    return GetAncestors(pageId, false);\r\n                case SitemapScope.AncestorsAndCurrent:\r\n                    return GetAncestors(pageId, true);\r\n                case SitemapScope.Parent:\r\n                    parentId = PageManager.GetParentId(pageId);\r\n                    return parentId != Guid.Empty ? new[] {parentId} : new Guid[0];\r\n                case SitemapScope.Level1:\r\n                case SitemapScope.Level2:\r\n                case SitemapScope.Level3:\r\n                case SitemapScope.Level4:\r\n                case SitemapScope.Level1AndDescendants:\r\n                case SitemapScope.Level2AndDescendants:\r\n                case SitemapScope.Level3AndDescendants:\r\n                case SitemapScope.Level4AndDescendants:\r\n                case SitemapScope.Level1AndSiblings:\r\n                case SitemapScope.Level2AndSiblings:\r\n                case SitemapScope.Level3AndSiblings:\r\n                case SitemapScope.Level4AndSiblings:\r\n                    int level = int.Parse(associationScope.ToString().Substring(5, 1));\r\n\r\n                    var ancestors = GetAncestors(pageId, true);\r\n\r\n                    ancestors.Reverse();\r\n\r\n                    bool andSiblings = associationScope.ToString().EndsWith(\"AndSiblings\");\r\n                    if (andSiblings)\r\n                    {\r\n                        if (ancestors.Count < level - 1)\r\n                        {\r\n                            return new Guid[0];\r\n                        }\r\n\r\n                        Guid parentPageId = level == 1 ? Guid.Empty : ancestors[level - 2];\r\n                        return GetAssociatedPageIds(parentPageId, SitemapScope.Children);\r\n                    }\r\n\r\n                    if (ancestors.Count < level)\r\n                    {\r\n                        return new Guid[0];\r\n                    }\r\n\r\n                    Guid levelPageId = ancestors[level - 1];\r\n\r\n                    bool andDescendants = associationScope.ToString().EndsWith(\"AndDescendants\");\r\n                    if (andDescendants)\r\n                    {\r\n                        return GetDescendantsAndSelf(levelPageId);\r\n                    }\r\n\r\n                    \r\n\r\n                    return new[] {levelPageId};\r\n                default:\r\n                    throw new NotImplementedException(\"Unhandled SitemapScope type: \" + associationScope);\r\n            }\r\n        }\r\n        \r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Guid> GetAssociatedPageIds(Guid pageId, SitemapScope associationScope, IEnumerable<XElement> sitemaps)\r\n        {\r\n            switch (associationScope)\r\n            {\r\n                case SitemapScope.Current:\r\n                    yield return pageId;\r\n                    break;\r\n                case SitemapScope.All:\r\n#pragma warning disable 618\r\n                    foreach (Guid id in GetIdToUrlLookup().Keys)\r\n#pragma warning restore 618\r\n                    {\r\n                        yield return id;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Descendants:\r\n                case SitemapScope.DescendantsAndCurrent:\r\n                case SitemapScope.Children:\r\n                case SitemapScope.Siblings:\r\n                case SitemapScope.Ancestors:\r\n                case SitemapScope.AncestorsAndCurrent:\r\n                case SitemapScope.Parent:\r\n                case SitemapScope.Level1:\r\n                case SitemapScope.Level2:\r\n                case SitemapScope.Level3:\r\n                case SitemapScope.Level4:\r\n                case SitemapScope.Level1AndDescendants:\r\n                case SitemapScope.Level2AndDescendants:\r\n                case SitemapScope.Level3AndDescendants:\r\n                case SitemapScope.Level4AndDescendants:\r\n                case SitemapScope.Level1AndSiblings:\r\n                case SitemapScope.Level2AndSiblings:\r\n                case SitemapScope.Level3AndSiblings:\r\n                case SitemapScope.Level4AndSiblings:\r\n                    string pageIdString = pageId.ToString();\r\n                    XAttribute idMatchAttrib = sitemaps.DescendantsAndSelf().Attributes(AttributeNames.Id).FirstOrDefault(id => id.Value == pageIdString);\r\n                    if (idMatchAttrib != null)\r\n                    {\r\n                        XElement currentPageElement = idMatchAttrib.Parent;\r\n                        IEnumerable<XElement> scopeElements = GetPageElementsByScope(associationScope, currentPageElement);\r\n\r\n                        foreach (XElement pageElement in scopeElements)\r\n                        {\r\n                            yield return new Guid(pageElement.Attribute(AttributeNames.Id).Value);\r\n                        }\r\n                    }\r\n                    break;\r\n                default:\r\n                    throw new NotImplementedException(\"Unhandled SitemapScope type: \" + associationScope);\r\n            }\r\n        }\r\n\r\n        private static Map GetMap()\r\n        {\r\n            return GetMap(DataScopeManager.CurrentDataScope.ToPublicationScope(), LocalizationScopeManager.CurrentLocalizationScope);\r\n        }\r\n\r\n        private static Map GetMap(PublicationScope publicationScope, CultureInfo localizationScope)\r\n        {\r\n            return GetMap(publicationScope, localizationScope, new UrlSpace());\r\n        }\r\n\r\n        private static Map GetMap(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace)\r\n        {\r\n            Verify.ArgumentNotNull(localizationScope, \"localizationScope\");\r\n            Verify.ArgumentNotNull(urlSpace, \"urlSpace\");\r\n\r\n            if (System.Transactions.Transaction.Current != null)\r\n            {\r\n                var exceptionToLog = new Exception(\"It is not safe to use PageStructureInfo/SiteMap functionality in transactional context. Method Composite.Data.PageManager can be used instead.\");\r\n                Log.LogWarning(typeof(PageStructureInfo).Name, exceptionToLog);\r\n            }\r\n\r\n            var scopeKey = GetScopeKey(publicationScope, localizationScope, urlSpace);\r\n            Map map = _generatedMaps[scopeKey];\r\n\r\n            if (map != null)\r\n            {\r\n                return map;\r\n            }\r\n\r\n            // Using different sync roots for different datascopes\r\n            //object buildingLock = _buildingLock[scopeKey.First == DataScopeIdentifier.Public.Name ? 0 : 1];\r\n\r\n            // NOTE: Do not using a lock because it could because GetAssociatedPageIds is used inside transactions on some sites and it causes deadlocks \r\n\r\n            // lock (buildingLock)\r\n            {\r\n                map = _generatedMaps[scopeKey];\r\n                if (map != null)\r\n                {\r\n                    return map;\r\n                }\r\n\r\n\r\n                Version version = _versions[scopeKey];\r\n                if (version == null)\r\n                {\r\n                    lock (_updatingLock)\r\n                    {\r\n                        version = _versions[scopeKey];\r\n                        if (version == null)\r\n                        {\r\n                            _versions.Add(scopeKey, version = new Version());\r\n                        }\r\n                    }\r\n                }\r\n\r\n                Thread.MemoryBarrier();\r\n                int currentVersion = version.VersionNumber;\r\n                Thread.MemoryBarrier();\r\n\r\n                using(new DataScope(publicationScope, localizationScope))\r\n                {\r\n                    map = BuildMap(urlSpace);\r\n                }\r\n\r\n                lock (_updatingLock)\r\n                {\r\n                    if (_versions[scopeKey].VersionNumber == currentVersion)\r\n                    {\r\n                        _generatedMaps.Remove(scopeKey);\r\n                        _generatedMaps.Add(scopeKey, map);\r\n                    }\r\n                }\r\n\r\n                return map;\r\n            }\r\n        }\r\n\r\n        private static Tuple<PublicationScope, string, string> GetScopeKey(PublicationScope publicationScope, CultureInfo cultureInfo, UrlSpace urlSpace)\r\n        {\r\n            string hostnameScopeKey = urlSpace.ForceRelativeUrls ? \"relative urls\" : urlSpace.Hostname;\r\n\r\n            return new Tuple<PublicationScope, string, string>(publicationScope, cultureInfo.Name, hostnameScopeKey);\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Core.Routing namespace to work with URLs\")]\r\n        public static bool TryGetPageUrl(Guid guid, out string pageUrl)\r\n        {\r\n            return GetMap().IdToUrlLookup.TryGetValue(guid, out pageUrl);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Core.WebClient.UrlPageHelper class\")]\r\n        public static bool TryGetPageUrlByFriendlyUrl(string friendlyUrl, out string pageUrl)\r\n        {\r\n            string lowerFriendlyUrl = friendlyUrl.ToLowerInvariant();\r\n\r\n            string matchingUrl = GetSiteMap().DescendantsAndSelf().Attributes(\"FriendlyUrl\").Where(f => f.Value.ToLowerInvariant() == lowerFriendlyUrl).Select(f => f.Parent.Attribute(\"URL\").Value).FirstOrDefault();\r\n\r\n            pageUrl = matchingUrl;\r\n\r\n            return matchingUrl != null;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Core.Routing namespace to work with URLs\")]\r\n        public static Dictionary<string, Guid> GetUrlToIdLookup()\r\n        {\r\n            return GetMap().UrlToIdLookup;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Core.Routing namespace to work with URLs\")]\r\n        public static Dictionary<string, Guid> GetLowerCaseUrlToIdLookup()\r\n        {\r\n            return GetMap().LowerCaseUrlToIdLookup;\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Core.Routing namespace to work with URLs\")]\r\n        public static IPageUrlBuilder GetPageUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace)\r\n        {\r\n            return GetMap(publicationScope, localizationScope, urlSpace).PageUrlBuilder;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Core.Routing namespace to work with URLs\")]\r\n        public static Dictionary<Guid, string> GetIdToUrlLookup()\r\n        {\r\n            return GetIdToUrlLookup(DataScopeManager.CurrentDataScope.Name, LocalizationScopeManager.CurrentLocalizationScope);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Core.Routing namespace to work with URLs\")]\r\n        public static Dictionary<Guid, string> GetIdToUrlLookup(string dataScopeIdentifier, CultureInfo culture)\r\n        {\r\n            using (new DataScope(DataScopeIdentifier.Deserialize(dataScopeIdentifier), culture))\r\n            {\r\n                return GetMap().IdToUrlLookup;\r\n            }\r\n        }\r\n\r\n\r\n        private static IEnumerable<XElement> GetPageElementBySiteDepth(XElement associatedPageElement, int siteDepth)\r\n        {\r\n            XElement match = associatedPageElement.AncestorsAndSelf(PageElementName).Reverse().Take(siteDepth).LastOrDefault();\r\n\r\n            if (match != null && match.Attribute(\"Depth\").Value == siteDepth.ToString())\r\n            {\r\n                yield return match;\r\n            }\r\n        }\r\n\r\n        internal static IEnumerable<XElement> GetPageElementsByScope(SitemapScope associationScope, XElement currentPageElement)\r\n        {\r\n            IEnumerable<XElement> scopeElements = null;\r\n            XElement matchPage;\r\n\r\n            switch (associationScope)\r\n            {\r\n                case SitemapScope.Parent:\r\n                    if (currentPageElement.Parent != null && currentPageElement.Parent.Name == PageElementName)\r\n                    {\r\n                        yield return currentPageElement.Parent;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Descendants:\r\n                    scopeElements = currentPageElement.Descendants(PageElementName);\r\n                    break;\r\n                case SitemapScope.DescendantsAndCurrent:\r\n                    scopeElements = currentPageElement.DescendantsAndSelf(PageElementName);\r\n                    break;\r\n                case SitemapScope.Children:\r\n                    scopeElements = currentPageElement.Elements(PageElementName);\r\n                    break;\r\n                case SitemapScope.Siblings:\r\n                    scopeElements = currentPageElement.Parent.Elements(PageElementName);\r\n                    break;\r\n                case SitemapScope.Ancestors:\r\n                    scopeElements = currentPageElement.Ancestors(PageElementName);\r\n                    break;\r\n                case SitemapScope.AncestorsAndCurrent:\r\n                    scopeElements = currentPageElement.AncestorsAndSelf(PageElementName);\r\n                    break;\r\n                case SitemapScope.Level1:\r\n                    scopeElements = GetPageElementBySiteDepth(currentPageElement, 1);\r\n                    break;\r\n                case SitemapScope.Level2:\r\n                    scopeElements = GetPageElementBySiteDepth(currentPageElement, 2);\r\n                    break;\r\n                case SitemapScope.Level3:\r\n                    scopeElements = GetPageElementBySiteDepth(currentPageElement, 3);\r\n                    break;\r\n                case SitemapScope.Level4:\r\n                    scopeElements = GetPageElementBySiteDepth(currentPageElement, 4);\r\n                    break;\r\n                case SitemapScope.Level1AndDescendants:\r\n                    scopeElements = GetPageElementBySiteDepth(currentPageElement, 1).DescendantsAndSelf();\r\n                    break;\r\n                case SitemapScope.Level2AndDescendants:\r\n                    scopeElements = GetPageElementBySiteDepth(currentPageElement, 2).DescendantsAndSelf();\r\n                    break;\r\n                case SitemapScope.Level3AndDescendants:\r\n                    scopeElements = GetPageElementBySiteDepth(currentPageElement, 3).DescendantsAndSelf();\r\n                    break;\r\n                case SitemapScope.Level4AndDescendants:\r\n                    scopeElements = GetPageElementBySiteDepth(currentPageElement, 4).DescendantsAndSelf();\r\n                    break;\r\n                case SitemapScope.Level1AndSiblings:\r\n                    matchPage = GetPageElementBySiteDepth(currentPageElement, 1).FirstOrDefault();\r\n                    if (matchPage != null && matchPage.Parent != null)\r\n                    {\r\n                        scopeElements = matchPage.Parent.Elements(PageElementName);\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level2AndSiblings:\r\n                    matchPage = GetPageElementBySiteDepth(currentPageElement, 1).FirstOrDefault();\r\n                    if (matchPage != null)\r\n                    {\r\n                        scopeElements = matchPage.Elements(PageElementName);\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level3AndSiblings:\r\n                    matchPage = GetPageElementBySiteDepth(currentPageElement, 2).FirstOrDefault();\r\n                    if (matchPage != null)\r\n                    {\r\n                        scopeElements = matchPage.Elements(PageElementName);\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level4AndSiblings:\r\n                    matchPage = GetPageElementBySiteDepth(currentPageElement, 3).FirstOrDefault();\r\n                    if (matchPage != null)\r\n                    {\r\n                        scopeElements = matchPage.Elements(PageElementName);\r\n                    }\r\n                    break;\r\n                default:\r\n                    throw new NotImplementedException(\"Unhandled SitemapScope type: \" + associationScope);\r\n            }\r\n\r\n            if (scopeElements != null)\r\n            {\r\n                foreach (XElement scopeElement in scopeElements)\r\n                {\r\n                    yield return scopeElement;\r\n                }\r\n            }\r\n        }\r\n\r\n        private class PageTreeInfo\r\n        {\r\n            public Guid ID;\r\n            public int LocalOrdering;\r\n            public XElement Element;\r\n        }\r\n\r\n\r\n        private class SitemapBuildingData\r\n        {\r\n            private class PageIdComparer : IEqualityComparer<IPage>\r\n            {\r\n                public bool Equals(IPage x, IPage y) => x.Id == y.Id;\r\n\r\n                public int GetHashCode(IPage obj) => obj.Id.GetHashCode();\r\n            }\r\n\r\n            public SitemapBuildingData()\r\n            {\r\n                Pages = DataFacade.GetData<IPage>().Evaluate().Distinct(new PageIdComparer()).ToList();\r\n                Structures = DataFacade.GetData<IPageStructure>().ToList();\r\n\r\n                PageById = new Hashtable<Guid, IPage>();\r\n                foreach (IPage page in Pages)\r\n                {\r\n                    PageById.Add(page.Id, page);\r\n                }\r\n\r\n                StructureById = new Hashtable<Guid, IPageStructure>();\r\n                foreach (IPageStructure structure in Structures)\r\n                {\r\n                    StructureById.Add(structure.Id, structure);\r\n                }\r\n            }\r\n\r\n            public List<IPage> Pages { get; private set; }\r\n            public List<IPageStructure> Structures { get; private set; }\r\n\r\n            public Hashtable<Guid, IPage> PageById { get; private set; }\r\n            public Hashtable<Guid, IPageStructure> StructureById { get; private set; }\r\n        }\r\n\r\n        private static Map BuildMap(UrlSpace urlSpace)\r\n        {\r\n            using (DebugLoggingScope.MethodInfoScope)\r\n            {\r\n                var publicationScope = DataScopeManager.CurrentDataScope.ToPublicationScope();\r\n                var localizationScope = LocalizationScopeManager.CurrentLocalizationScope;\r\n\r\n                Log.LogVerbose(LogTitle, string.Format(\"Building page structure in the publication scope '{0}' with the localization scope '{1}'\", publicationScope, localizationScope));\r\n\r\n                var urlToIdLookup = new Dictionary<string, Guid>();\r\n                var idToUrlLookup = new Dictionary<Guid, string>();\r\n\r\n                var pagesData = new SitemapBuildingData();\r\n\r\n                var pageToToChildElementsTable = new Hashtable<Guid, List<PageTreeInfo>>();\r\n                foreach (IPage page in pagesData.Pages)\r\n                {\r\n                    IPageStructure pageStructure = pagesData.StructureById[page.Id];\r\n\r\n                    if (pageStructure == null)\r\n                    {\r\n                        Log.LogWarning(LogTitle, \"Failed to find PageStructure data. Page ID is '{0}'\".FormatWith(page.Id));\r\n                        continue;\r\n                    }\r\n\r\n                    int localOrdering = pageStructure.LocalOrdering;\r\n\r\n                    var pageElement = new XElement(ElementNames.Page,\r\n                         new XAttribute(AttributeNames.Id, page.Id),\r\n                         new XAttribute(AttributeNames.Title, page.Title),\r\n                         (string.IsNullOrEmpty(page.MenuTitle) ? null : new XAttribute(AttributeNames.MenuTitle, page.MenuTitle)),\r\n                         new XAttribute(AttributeNames.UrlTitle, page.UrlTitle),\r\n                         new XAttribute(AttributeNames.Description, page.Description ?? string.Empty),\r\n                         new XAttribute(AttributeNames.ChangedDate, page.ChangeDate),\r\n                         new XAttribute(AttributeNames.ChangedBy, page.ChangedBy ?? string.Empty));\r\n\r\n                    var list = pageToToChildElementsTable[pageStructure.ParentId];\r\n\r\n                    if (list == null)\r\n                    {\r\n                        list = new List<PageTreeInfo>();\r\n                        pageToToChildElementsTable[pageStructure.ParentId] = list;\r\n                    }\r\n\r\n                    list.Add(new PageTreeInfo\r\n                    {\r\n                        ID = page.Id,\r\n                        LocalOrdering = localOrdering,\r\n                        Element = pageElement\r\n                    });\r\n                }\r\n\r\n                var root = new XElement(\"root\");\r\n\r\n                BuildXmlStructure(root, Guid.Empty, pageToToChildElementsTable, 100);\r\n\r\n#pragma warning disable 612\r\n                var pageUrlBuilder = PageUrls.UrlProvider.CreateUrlBuilder(publicationScope, localizationScope, urlSpace);\r\n                BuildFolderPaths(pagesData, root.Elements(), pageUrlBuilder, urlToIdLookup);\r\n#pragma warning restore 612\r\n\r\n                foreach (var urlLookupEntry in urlToIdLookup)\r\n                {\r\n                    idToUrlLookup.Add(urlLookupEntry.Value, urlLookupEntry.Key);\r\n                }\r\n\r\n                var lowerCaseUrlToIdLookup = new Dictionary<string, Guid>();\r\n\r\n                foreach (KeyValuePair<string, Guid> keyValuePair in urlToIdLookup)\r\n                {\r\n                    string loweredUrl = keyValuePair.Key.ToLowerInvariant();\r\n\r\n                    if (lowerCaseUrlToIdLookup.ContainsKey(loweredUrl))\r\n                    {\r\n                        if (!_knownNotUniqueUrls.Contains(loweredUrl))\r\n                        {\r\n                            lock (_knownNotUniqueUrls)\r\n                            {\r\n                                _knownNotUniqueUrls.Add(loweredUrl);\r\n                            }\r\n                            Log.LogError(LogTitle, \"Multiple pages share the same path '{0}'. Page ID: '{1}'. Duplicates are ignored.\".FormatWith(loweredUrl, keyValuePair.Value));\r\n                        }\r\n                        \r\n                        continue;\r\n                    }\r\n\r\n                    lowerCaseUrlToIdLookup.Add(loweredUrl, keyValuePair.Value);\r\n                }\r\n\r\n                return new Map\r\n                           {\r\n                               IdToUrlLookup = idToUrlLookup,\r\n                               UrlToIdLookup = urlToIdLookup,\r\n                               LowerCaseUrlToIdLookup = lowerCaseUrlToIdLookup,\r\n                               RootPagesLookup = root.Elements(),\r\n                               PageUrlBuilder = pageUrlBuilder\r\n                           };\r\n            }\r\n        }\r\n\r\n        private static void BuildXmlStructure(XElement root, Guid currentPageId, Hashtable<Guid, List<PageTreeInfo>> pageToChildElementsTable, int depth)\r\n        {\r\n            if (depth == 0) return;\r\n\r\n            List<PageTreeInfo> children = pageToChildElementsTable[currentPageId];\r\n            if (children == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            foreach (PageTreeInfo pageInfo in children.OrderBy(pageInfo => pageInfo.LocalOrdering))\r\n            {\r\n                root.Add(pageInfo.Element);\r\n\r\n                BuildXmlStructure(pageInfo.Element, pageInfo.ID, pageToChildElementsTable, depth - 1);\r\n            }\r\n        }\r\n\r\n        [Obsolete(\"Use Composite.Core.Routing namespace to work with URLs\")]\r\n        private static void BuildFolderPaths(SitemapBuildingData pagesData, IEnumerable<XElement> roots, IPageUrlBuilder pageUrlBuilder, IDictionary<string, Guid> urlToIdLookup)\r\n        {\r\n            BuildFolderPaths(pagesData, roots, urlToIdLookup, pageUrlBuilder);\r\n        }\r\n\r\n        [Obsolete(\"Use Composite.Core.Routing namespace to work with URLs\")]\r\n        private static void BuildFolderPaths(SitemapBuildingData pagesData, IEnumerable<XElement> elements, IDictionary<string, Guid> urlToIdLookup, IPageUrlBuilder builder)\r\n        {\r\n            foreach (XElement element in elements)\r\n            {\r\n                Guid pageId = new Guid(element.Attribute(AttributeNames.Id).Value);\r\n\r\n                IPage page = pagesData.PageById[pageId];\r\n                IPageStructure pageStructure = pagesData.StructureById[pageId];\r\n                if (pageStructure == null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                Guid parentId = pageStructure.ParentId;\r\n\r\n                PageUrlSet pageUrls = builder.BuildUrlSet(page, parentId);\r\n                if(pageUrls == null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                element.Add(new XAttribute(AttributeNames.URL, pageUrls.PublicUrl));\r\n\r\n                string lookupUrl = pageUrls.PublicUrl;\r\n\r\n                if(pageUrls.FriendlyUrl != null)\r\n                {\r\n                    element.Add(new XAttribute(AttributeNames.FriendlyUrl, pageUrls.FriendlyUrl));\r\n                }\r\n\r\n                //// FolderPath isn't used any more\r\n                //element.Add(new XAttribute(\"FolderPath\", builder.FolderPaths[pageId]));\r\n\r\n                element.Add(new XAttribute(AttributeNames.Depth, 1 + element.Ancestors(PageElementName).Count()));\r\n\r\n                // NOTE: urlToIdLookup is obsolete, but old API needs it\r\n                if (urlToIdLookup.ContainsKey(lookupUrl))\r\n                {\r\n                    Log.LogError(LogTitle, \"Multiple pages share the same path '{0}', page ID: '{1}'. Duplicates are ignored.\".FormatWith(pageUrls.PublicUrl, pageId));\r\n                    continue;\r\n                }\r\n\r\n                urlToIdLookup.Add(lookupUrl, pageId);\r\n\r\n                BuildFolderPaths(pagesData, element.Elements(), urlToIdLookup, builder);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnPagesChanged(object sender, StoreEventArgs args)\r\n        {\r\n            IncrementVersion(DataScopeIdentifier.FromPublicationScope(args.PublicationScope));\r\n        }\r\n\r\n        private static void OnPageStructureChanged(object sender, StoreEventArgs args)\r\n        {\r\n            IncrementVersion(DataScopeIdentifier.Public);\r\n            IncrementVersion(DataScopeIdentifier.Administrated);\r\n        }\r\n\r\n        private static void IncrementVersion(DataScopeIdentifier dataScopeIdentifier)\r\n        {\r\n            var publicationScope = dataScopeIdentifier.ToPublicationScope();\r\n\r\n            ClearCachedData(key => key.Item1 == publicationScope);\r\n        }\r\n\r\n         private static void ClearCachedData()\r\n         {\r\n             ClearCachedData(c => true);\r\n         }\r\n\r\n        private static void ClearCachedData(Func<MapKey, bool> condition)\r\n        {\r\n            lock (_updatingLock)\r\n            {\r\n                var keysToUpdate = _versions.GetKeys().Where(condition).ToList();\r\n\r\n                foreach (var key in keysToUpdate)\r\n                {\r\n                    // Updating versions\r\n                    Interlocked.Increment(ref _versions[key].VersionNumber);\r\n\r\n                    // Clearing cached data\r\n                    _generatedMaps.Remove(key);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void AnnotatePagesWithOpenAndCurrent(Guid pageId, List<XElement> pageElements)\r\n        {\r\n            string pageIdAsString = pageId.ToString();\r\n            XAttribute matchingPageIdAttrib = GetSiteMap().DescendantsAndSelf().Attributes(AttributeNames.Id).FirstOrDefault(f => f.Value == pageIdAsString);\r\n\r\n            if (matchingPageIdAttrib != null)\r\n            {\r\n                List<string> openPageIdList = matchingPageIdAttrib.Parent.AncestorsAndSelf(PageElementName).Attributes(AttributeNames.Id).Select(f => f.Value).ToList();\r\n\r\n                foreach (XElement openPage in pageElements.DescendantsAndSelf(PageElementName).Where(f => openPageIdList.Contains(f.Attribute(AttributeNames.Id).Value)))\r\n                {\r\n                    openPage.Add(new XAttribute(\"isopen\", \"true\"));\r\n                    if (openPage.Attribute(AttributeNames.Id).Value == pageIdAsString)\r\n                    {\r\n                        openPage.Add(new XAttribute(\"iscurrent\", \"true\"));\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<XElement> GetSitemapByScopeUnannotated(SitemapScope associationScope, Guid pageId)\r\n        {\r\n            if (associationScope == SitemapScope.All)\r\n            {\r\n                foreach (XElement homepage in GetSiteMap())\r\n                {\r\n                    yield return new XElement(homepage);\r\n                }\r\n\r\n                yield break;\r\n            }\r\n\r\n            Verify.ArgumentCondition(pageId != Guid.Empty, \"pageId\", \"The parameter is Guid.Empty\");\r\n\r\n            XElement currentPageElement = PageStructureInfo.GetSiteMap().DescendantsAndSelf().FirstOrDefault(f => f.Attribute(\"Id\").Value == pageId.ToString());\r\n\r\n            // finde dybden - hvis scope dybden == nuværende dybde + 1, så skift nuværende til first child\r\n\r\n            if (currentPageElement == null) throw new ArgumentException(\"No page with the given ID could be located in the current data scope ('{0}').\".FormatWith(pageId), \"pageId\");\r\n\r\n            XElement pageCopy = null;\r\n\r\n            switch (associationScope)\r\n            {\r\n                case SitemapScope.Current:\r\n                    yield return new XElement(currentPageElement.Name, currentPageElement.Attributes());\r\n                    break;\r\n                case SitemapScope.Parent:\r\n                    if (currentPageElement.Parent != null && currentPageElement.Parent.Name == PageElementName)\r\n                    {\r\n                        yield return new XElement(currentPageElement.Parent.Name, currentPageElement.Parent.Attributes());\r\n                    }\r\n                    break;\r\n                case SitemapScope.Descendants:\r\n                    foreach (XElement child in currentPageElement.Elements(PageElementName))\r\n                    {\r\n                        yield return new XElement(child);\r\n                    }\r\n                    break;\r\n                case SitemapScope.DescendantsAndCurrent:\r\n                    yield return new XElement(currentPageElement);\r\n                    break;\r\n                case SitemapScope.Children:\r\n                    foreach (XElement page in currentPageElement.Elements(PageElementName))\r\n                    {\r\n                        yield return new XElement(page.Name, page.Attributes());\r\n                    }\r\n                    break;\r\n                case SitemapScope.Siblings:\r\n                    foreach (XElement page in currentPageElement.Parent.Elements(PageElementName))\r\n                    {\r\n                        yield return new XElement(page.Name, page.Attributes());\r\n                    }\r\n                    break;\r\n                case SitemapScope.Ancestors:\r\n                    foreach (XElement page in currentPageElement.Ancestors(PageElementName))\r\n                    {\r\n                        pageCopy = new XElement(page.Name, page.Attributes(), pageCopy);\r\n                    }\r\n                    yield return pageCopy;\r\n                    break;\r\n                case SitemapScope.AncestorsAndCurrent:\r\n                    foreach (XElement page in currentPageElement.AncestorsAndSelf(PageElementName))\r\n                    {\r\n                        pageCopy = new XElement(page.Name, page.Attributes(), pageCopy);\r\n                    }\r\n                    yield return pageCopy;\r\n                    break;\r\n                case SitemapScope.Level1:\r\n                    pageCopy = GetPageCopyBySiteDepth(currentPageElement, 1, true);\r\n                    if (pageCopy != null)\r\n                    {\r\n                        yield return pageCopy;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level2:\r\n                    pageCopy = GetPageCopyBySiteDepth(currentPageElement, 2, true);\r\n                    if (pageCopy != null)\r\n                    {\r\n                        yield return pageCopy;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level3:\r\n                    pageCopy = GetPageCopyBySiteDepth(currentPageElement, 3, true);\r\n                    if (pageCopy != null)\r\n                    {\r\n                        yield return pageCopy;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level4:\r\n                    pageCopy = GetPageCopyBySiteDepth(currentPageElement, 4, true);\r\n                    if (pageCopy != null)\r\n                    {\r\n                        yield return pageCopy;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level1AndSiblings:\r\n                    foreach (XElement page in PageStructureInfo.GetSiteMap())\r\n                    {\r\n                        yield return new XElement(page.Name, page.Attributes());\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level2AndSiblings:\r\n                    foreach (XElement page in GetSiblingsCopyBySiteDepth(currentPageElement, 2))\r\n                    {\r\n                        yield return page;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level3AndSiblings:\r\n                    foreach (XElement page in GetSiblingsCopyBySiteDepth(currentPageElement, 3))\r\n                    {\r\n                        yield return page;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level4AndSiblings:\r\n                    foreach (XElement page in GetSiblingsCopyBySiteDepth(currentPageElement, 4))\r\n                    {\r\n                        yield return page;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level1AndDescendants:\r\n                    pageCopy = GetPageCopyBySiteDepth(currentPageElement, 1, false);\r\n                    if (pageCopy != null)\r\n                    {\r\n                        yield return pageCopy;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level2AndDescendants:\r\n                    pageCopy = GetPageCopyBySiteDepth(currentPageElement, 2, false);\r\n                    if (pageCopy != null)\r\n                    {\r\n                        yield return pageCopy;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level3AndDescendants:\r\n                    pageCopy = GetPageCopyBySiteDepth(currentPageElement, 3, false);\r\n                    if (pageCopy != null)\r\n                    {\r\n                        yield return pageCopy;\r\n                    }\r\n                    break;\r\n                case SitemapScope.Level4AndDescendants:\r\n                    pageCopy = GetPageCopyBySiteDepth(currentPageElement, 4, false);\r\n                    if (pageCopy != null)\r\n                    {\r\n                        yield return pageCopy;\r\n                    }\r\n                    break;\r\n                default:\r\n                    throw new NotImplementedException(\"Unhandled SitemapScope type: \" + associationScope);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static XElement GetPageCopyBySiteDepth(XElement associatedPageElement, int siteDepth, bool shallow)\r\n        {\r\n            string siteDepthStr = siteDepth.ToString();\r\n            XElement match = associatedPageElement.AncestorsAndSelf(PageElementName).SingleOrDefault(f => f.Attribute(AttributeNames.Depth).Value == siteDepthStr);\r\n\r\n            if (match == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (shallow)\r\n            {\r\n                return new XElement(match.Name, match.Attributes());\r\n            }\r\n\r\n            return new XElement(match);\r\n        }\r\n\r\n\r\n        private static IEnumerable<XElement> GetSiblingsCopyBySiteDepth(XElement associatedPageElement, int siteDepth)\r\n        {\r\n            int currentPageDepth = Int32.Parse(associatedPageElement.Attribute(AttributeNames.Depth).Value);\r\n\r\n            IEnumerable<XElement> elementsToCopy = null;\r\n\r\n            if (siteDepth == 1)\r\n            {\r\n                elementsToCopy = associatedPageElement.AncestorsAndSelf(PageElementName).Where(f => f.Attribute(AttributeNames.Depth).Value == \"1\");\r\n            }\r\n            else if (currentPageDepth >= siteDepth)\r\n            {\r\n                elementsToCopy = associatedPageElement.AncestorsAndSelf(PageElementName).Where(f => f.Attribute(AttributeNames.Depth).Value == (siteDepth - 1).ToString()).Elements(PageElementName);\r\n            }\r\n            else\r\n            {\r\n                if (currentPageDepth == siteDepth - 1)\r\n                {\r\n                    elementsToCopy = associatedPageElement.Elements(PageElementName);\r\n                }\r\n            }\r\n\r\n            if (elementsToCopy != null)\r\n            {\r\n                foreach (XElement pageElement in elementsToCopy)\r\n                {\r\n                    yield return new XElement(pageElement.Name, pageElement.Attributes());\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/RenderingReason.cs",
    "content": "﻿namespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    /// <summary>\r\n    /// Describes a rendering reason\r\n    /// </summary>\r\n    public enum RenderingReason\r\n    {\r\n        /// <summary>\r\n        /// Undefined\r\n        /// </summary>\r\n        Undefined = 0,\r\n        /// <summary>\r\n        /// A page was requested through a browser\r\n        /// </summary>\r\n        PageView = 1,\r\n        /// <summary>\r\n        /// A page is viewed from C1 Console's browser\r\n        /// </summary>\r\n        C1ConsoleBrowserPageView = 2,\r\n        /// <summary>\r\n        /// A page is rendered from withing an \"Edit page\" workflow\r\n        /// </summary>\r\n        PreviewUnsavedChanges = 4,\r\n        /// <summary>\r\n        /// A page is rendered to generate an image to be used for function/template visualization\r\n        /// </summary>\r\n        ScreenshotGeneration = 8,\r\n        /// <summary>\r\n        /// A page is rendered to build a search index.\r\n        /// </summary>\r\n        BuildSearchIndex = 16\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/XElementToAspNetExtensions.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Web.UI.WebControls;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class XElementToAspNetExtensions\r\n    {\r\n        private static readonly XName XName_Id = \"id\";\r\n        private static readonly XName XName_Xmlns = \"xmlns\";\r\n        private static readonly XName XName_Title = Namespaces.Xhtml + \"title\";\r\n        private static readonly XName XName_Meta = Namespaces.Xhtml + \"meta\";\r\n\r\n        private static readonly HashSet<string> VoidElements = new HashSet<string>\r\n        {\r\n            \"area\", \"base\", \"br\", \"col\", \"command\", \"embed\", \"hr\", \"img\", \"input\", \"keygen\", \"link\", \"meta\", \"param\",\r\n            \"source\", \"track\", \"wbr\"\r\n        };\r\n\r\n        /// <exclude />\r\n        public static Control AsAspNetControl(this XhtmlDocument xhtmlDocument)\r\n        {\r\n            return xhtmlDocument.AsAspNetControl(NoMappingMapper.GetInstance());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Control AsAspNetControl(this XhtmlDocument xhtmlDocument, IXElementToControlMapper controlMapper)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                var htmlControl = new HtmlGenericControl(\"html\");\r\n                CopyAttributes(xhtmlDocument.Root, htmlControl);\r\n\r\n                HtmlHead headControl = xhtmlDocument.BuildHtmlHeadControl(controlMapper);\r\n\r\n                Control bodyControl = xhtmlDocument.Body.AsAspNetControl(controlMapper);\r\n\r\n                htmlControl.Controls.Add(headControl);\r\n                htmlControl.Controls.Add(bodyControl);\r\n\r\n                PlaceHolder pageHolder = new PlaceHolder();\r\n                if (xhtmlDocument.DocumentType != null)\r\n                {\r\n                    string docType = xhtmlDocument.DocumentType.ToString();\r\n                    var offset = docType.IndexOf(\"[]\", StringComparison.Ordinal);\r\n                    if (offset >= 0)\r\n                    {\r\n                        docType = docType.Remove(offset, 2);\r\n                    }\r\n\r\n                    pageHolder.Controls.Add(new LiteralControl(docType));\r\n                }\r\n                pageHolder.Controls.Add(htmlControl);\r\n\r\n                return pageHolder;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Control AsAspNetControl(this XNode xnode)\r\n        {\r\n            return xnode.AsAspNetControl(NoMappingMapper.GetInstance());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Control AsAspNetControl(this XNode xnode, IXElementToControlMapper controlMapper)\r\n        {\r\n            if (xnode is XElement element) return element.AsAspNetControl(controlMapper);\r\n            if (xnode is XDocument document) return document.Root.AsAspNetControl(controlMapper);\r\n\r\n            if (xnode is XText text) return new LiteralControl(text.Value);\r\n            if (xnode is XComment comment) return new LiteralControl($\"<!--{comment.Value}-->\");\r\n\r\n            throw new NotImplementedException($\"Type '{xnode.GetType().Name}' not handled\");\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Control AsAspNetControl(this XElement element)\r\n        {\r\n            return element.AsAspNetControl(NoMappingMapper.GetInstance());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Control AsAspNetControl(this XElement element, IXElementToControlMapper controlMapper)\r\n        {\r\n            Control control;\r\n\r\n            if (!controlMapper.TryGetControlFromXElement(element, out control))\r\n            {\r\n                if (IsHtmlControlElement(element) || element.Attribute(XName_Id) != null)\r\n                {\r\n                    control = new HtmlGenericControl(element.Name.LocalName)\r\n                    {\r\n                        ClientIDMode = ClientIDMode.Static\r\n                    };\r\n                    CopyAttributes(element, (HtmlControl)control);\r\n                    ExportChildNodes(element.Nodes(), control, controlMapper);\r\n                }\r\n                else\r\n                {\r\n                    XElement copy = CopyWithoutNamespace(element, Namespaces.Xhtml);\r\n                    control = new LiteralControl(copy.ToString());\r\n                }\r\n            }\r\n\r\n            return control;\r\n        }\r\n\r\n\r\n\r\n        private static XElement CopyWithoutNamespace(XElement source, XNamespace namespaceToRemove)\r\n        {\r\n            XNamespace sourceNs = source.Name.Namespace;\r\n            XName newName = sourceNs.Equals(namespaceToRemove) ? source.Name.LocalName : source.Name;\r\n            XElement copy = new XElement(newName);\r\n\r\n            if (!sourceNs.Equals(namespaceToRemove) \r\n                && sourceNs != source.Parent.Name.Namespace \r\n                && source.Attribute(XName_Xmlns) == null\r\n                && (sourceNs == Namespaces.Xhtml.NamespaceName || sourceNs == Namespaces.Svg.NamespaceName))\r\n            {\r\n                copy.Add(new XAttribute(XName_Xmlns, source.Name.Namespace));\r\n            }\r\n\r\n            copy.Add(source.Attributes().Where(a => a.Name.Namespace == namespaceToRemove)\r\n                                                .Select(a => new XAttribute(a.Name.LocalName, a.Value)));\r\n\r\n            Func<XAttribute, bool> isNotHtmlRelatedNsDeclaration = \r\n                ns => !ns.IsNamespaceDeclaration \r\n                || (ns.Value != Namespaces.Xhtml.NamespaceName && ns.Value != Namespaces.Svg.NamespaceName);\r\n\r\n            copy.Add(source.Attributes().Where(a => a.Name.Namespace != namespaceToRemove && isNotHtmlRelatedNsDeclaration(a))\r\n                                        .Select(a => new XAttribute(a.Name, a.Value)));\r\n\r\n            foreach (XNode child in source.Nodes())\r\n            {\r\n                if (child is XElement)\r\n                {\r\n                    copy.Add(CopyWithoutNamespace(child as XElement, namespaceToRemove));\r\n                }\r\n                else\r\n                {\r\n                    copy.Add(child);\r\n                }\r\n            }\r\n\r\n            return copy;\r\n        }\r\n\r\n\r\n        private static bool IsHtmlControlElement(XElement element)\r\n        {\r\n            var name = element.Name;\r\n            string xNamespace = element.Name.Namespace.NamespaceName;\r\n\r\n            return (xNamespace == Namespaces.Xhtml.NamespaceName || xNamespace == string.Empty)\r\n                   && !VoidElements.Contains(name.LocalName);\r\n        }\r\n\r\n\r\n\r\n        private static void ExportChildNodes(IEnumerable<XNode> nodes, Control containerControl, IXElementToControlMapper controlMapper)\r\n        {\r\n            foreach (var childNode in nodes)\r\n            {\r\n                if (childNode is XElement element)\r\n                {\r\n                    containerControl.Controls.Add(element.AsAspNetControl(controlMapper));\r\n                    continue;\r\n                }\r\n\r\n                if (childNode is XCData cdata)\r\n                {\r\n                    if (!childNode.Ancestors().Any(f => f.Name.LocalName == \"script\"))\r\n                    {\r\n                        var literal = new LiteralControl(cdata.Value);\r\n                        containerControl.Controls.Add(literal);\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                if (childNode is XText)\r\n                {\r\n                    var literal = new LiteralControl(childNode.ToString());\r\n                    containerControl.Controls.Add(literal);\r\n                    continue;\r\n                }\r\n\r\n                if (childNode is XComment)\r\n                {\r\n                    containerControl.Controls.Add(new LiteralControl(childNode + \"\\n\"));\r\n                    continue;\r\n                }\r\n\r\n                throw new NotImplementedException($\"Unhandled XNode type '{childNode.GetType()}'\");\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void CopyAttributes(this XElement source, HtmlControl target)\r\n        {\r\n            CopyAttributes(source, target, true);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void CopyAttributes(this XElement source, HtmlControl target, bool copyXmlnsAttribute)\r\n        {\r\n            foreach (var attribute in source.Attributes())\r\n            {\r\n                if (attribute.Name.LocalName == \"id\")\r\n                {\r\n                    target.ID = attribute.Value;\r\n                    continue;\r\n                }\r\n\r\n                if (attribute.Name.Namespace == Namespaces.XmlNs)\r\n                {\r\n                    string namespaceName = attribute.Value;\r\n\r\n                    if (namespaceName != \"http://www.w3.org/1999/xhtml\"\r\n                        && !namespaceName.StartsWith(\"http://www.composite.net/ns\"))\r\n                    {\r\n                        target.Attributes.Add($\"xmlns:{attribute.Name.LocalName}\", attribute.Value);\r\n                    }\r\n\r\n                    continue;\r\n                }\r\n\r\n                string localName = attribute.Name.LocalName;\r\n                if (localName != XName_Xmlns\r\n                    || (copyXmlnsAttribute\r\n                        && (source.Parent == null || source.Name.Namespace != source.Parent.Name.Namespace)))\r\n                {\r\n                    string htmlAttributeName;\r\n\r\n                    if (attribute.Name.Namespace != source.Name.Namespace\r\n                        && attribute.Name.Namespace.NamespaceName != string.Empty)\r\n                    {\r\n                        string namespacePrefix = source.GetPrefixOfNamespace(attribute.Name.NamespaceName);\r\n\r\n                        htmlAttributeName = namespacePrefix + \":\" + localName;\r\n                    }\r\n                    else\r\n                    {\r\n                        htmlAttributeName = localName;\r\n                    }\r\n\r\n                    target.Attributes.Add(htmlAttributeName, attribute.Value);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        internal static void MergeToHeadControl(this XhtmlDocument xhtmlDocument, HtmlHead headControl, IXElementToControlMapper controlMapper)\r\n        {\r\n            XElement headSource = xhtmlDocument.Head;\r\n\r\n            if (headSource == null) return;\r\n\r\n            CopyAttributes(headSource, headControl);\r\n\r\n            XElement titleElement = headSource.Elements(XName_Title).LastOrDefault();\r\n            if (titleElement != null)\r\n            {\r\n                HtmlTitle existingControl = headControl.Controls.OfType<HtmlTitle>().FirstOrDefault();\r\n\r\n                if (existingControl != null)\r\n                {\r\n                    headControl.Controls.Remove(existingControl);\r\n                }\r\n\r\n                // NOTE: we aren't using headControl.Title property since it adds \"<title>\" tag as the last one\r\n                headControl.Controls.AddAt(0, new HtmlTitle { Text = HttpUtility.HtmlEncode(titleElement.Value) });\r\n            }\r\n\r\n            var metaTags = headSource.Elements().Where(f => f.Name == XName_Meta);\r\n            int metaTagPosition = Math.Min(1, headControl.Controls.Count);\r\n            foreach (var metaTag in metaTags)\r\n            {\r\n                var metaControl = new HtmlMeta();\r\n                foreach (var attribute in metaTag.Attributes())\r\n                {\r\n                    if (attribute.Name.LocalName == \"id\")\r\n                    {\r\n                        metaControl.ID = attribute.Value;\r\n                    }\r\n                    else\r\n                    {\r\n                        metaControl.Attributes.Add(attribute.Name.LocalName, attribute.Value);\r\n                    }\r\n                }\r\n                headControl.Controls.AddAt(metaTagPosition++, metaControl);\r\n            }\r\n\r\n            ExportChildNodes(headSource.Nodes().Where(f => \r\n                !(f is XElement element) || (element.Name != XName_Title && element.Name != XName_Meta)), \r\n                headControl, controlMapper);\r\n\r\n            headControl.RemoveDuplicates();\r\n        }\r\n\r\n\r\n\r\n        private static void RemoveDuplicates(this HtmlHead headControl)\r\n        {\r\n            HashSet<string> uniqueIdValues = new HashSet<string>();\r\n            HashSet<string> uniqueMetaNameValues = new HashSet<string>();\r\n            HashSet<string> uniqueScriptAttributes = new HashSet<string>();\r\n            HashSet<string> uniqueLinkAttributes = new HashSet<string>();\r\n\r\n            IEnumerable<HtmlControl> controls = headControl.Controls.OfType<HtmlControl>();\r\n\r\n            // Leaving last instances of each meta tag, and first instances of script/link tags\r\n            var priorityOrderedControls = new List<HtmlControl>();\r\n\r\n            var ignoreCase = StringComparison.OrdinalIgnoreCase;\r\n            priorityOrderedControls.AddRange(controls.Where(c => c.TagName.Equals(\"meta\", ignoreCase)).Reverse());\r\n            priorityOrderedControls.AddRange(controls.Where(c => !c.TagName.Equals(\"meta\", ignoreCase)));\r\n\r\n            foreach (HtmlControl c in priorityOrderedControls)\r\n            {\r\n                bool remove = IsDuplicate(uniqueIdValues, c.ClientID);\r\n\r\n                if (c.Controls.Count == 0)\r\n                {\r\n                    switch (c.TagName.ToLower())\r\n                    {\r\n                        case \"meta\":\r\n                            remove = remove || IsDuplicate(uniqueMetaNameValues, c.Attributes[\"name\"]);\r\n                            break;\r\n                        case \"script\":\r\n                            remove = remove || IsDuplicate(uniqueScriptAttributes, c.AttributesAsString());\r\n                            break;\r\n                        case \"link\":\r\n                            remove = remove || IsDuplicate(uniqueLinkAttributes, c.AttributesAsString());\r\n                            break;\r\n                    }\r\n                }\r\n\r\n                if (remove)\r\n                {\r\n                    headControl.Controls.Remove(c);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static string AttributesAsString(this HtmlControl c)\r\n        {\r\n            var str = new StringBuilder(c.ClientID);\r\n            var keys = c.Attributes.Keys.Cast<string>().OrderBy(f => f);\r\n\r\n            foreach (string key in keys)\r\n            {\r\n                str.Append(key);\r\n                str.Append(\"=\\\"\");\r\n                str.Append(c.Attributes[key]);\r\n                str.Append(\"\\\" \");\r\n            }\r\n\r\n            return str.ToString();\r\n        }\r\n\r\n        private static bool IsDuplicate(HashSet<string> uniqueList, string uniqueString)\r\n        {\r\n            if (!string.IsNullOrEmpty(uniqueString))\r\n            {\r\n                var lowered = uniqueString.ToLowerInvariant();\r\n                if (uniqueList.Contains(lowered))\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                uniqueList.Add(lowered);\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        private static HtmlHead BuildHtmlHeadControl(this XhtmlDocument xhtmlDocument, IXElementToControlMapper controlMapper)\r\n        {\r\n            var headControl = new HtmlHead();\r\n\r\n            xhtmlDocument.MergeToHeadControl(headControl, controlMapper);\r\n\r\n            return headControl;\r\n        }\r\n\r\n\r\n        #region Private helper class\r\n        private class NoMappingMapper : IXElementToControlMapper\r\n        {\r\n            private static readonly NoMappingMapper _instance = new NoMappingMapper();\r\n\r\n            public static IXElementToControlMapper GetInstance()\r\n            {\r\n                return _instance;\r\n            }\r\n\r\n            public bool TryGetControlFromXElement(XElement element, out Control control)\r\n            {\r\n                control = null;\r\n                return false;\r\n            }\r\n        }\r\n        #endregion\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Page/XEmbeddedControlMapper.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Web.UI.WebControls;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Page\r\n{\r\n    internal sealed class XEmbeddedControlMapper : IFunctionResultToXEmbedableMapper, IXElementToControlMapper\r\n\t{\r\n        private static readonly XName _markerElementName = Namespaces.AspNetControls + \"marker\";\r\n        private static readonly XName _formElementName = Namespaces.AspNetControls + \"form\";\r\n        private static readonly XName _placeholderElementName = Namespaces.AspNetControls + \"placeholder\";\r\n\r\n\r\n        private readonly Hashtable<string, Control> _controls = new Hashtable<string, Control>();\r\n\r\n        // IFunctionResultToXElementMapper\r\n        public bool TryMakeXEmbedable(FunctionContextContainer contextContainer, object resultObject, out XNode resultElement)\r\n        {\r\n            var control = resultObject as Control;\r\n\r\n            if (control == null)\r\n            {\r\n                resultElement = null;\r\n                return false;\r\n            }\r\n\r\n            string controlMarkerKey;\r\n\r\n            lock (_controls)\r\n            {\r\n                controlMarkerKey = string.Format(\"[Composite.Function.Render.Asp.Net.Control.{0}]\", _controls.Count);\r\n                _controls.Add(controlMarkerKey, control);\r\n            }\r\n\r\n            resultElement =\r\n                XElement.Parse(@\"<c1marker:{0} xmlns:c1marker=\"\"{1}\"\" key=\"\"{2}\"\" />\"\r\n                .FormatWith(_markerElementName.LocalName,\r\n                            _markerElementName.Namespace,\r\n                            controlMarkerKey));\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n        // IXElementToControlMapper\r\n        public bool TryGetControlFromXElement(XElement element, out Control control)\r\n        {\r\n            if (element.Name.Namespace != Namespaces.AspNetControls)\r\n            {\r\n                control = null;\r\n                return false;\r\n            }\r\n            \r\n            if (element.Name == _markerElementName)\r\n            {\r\n                control = _controls[element.Attribute(\"key\").Value];\r\n                return true;\r\n            }\r\n\r\n            if (element.Name == _formElementName)\r\n            {\r\n                control = new HtmlForm();\r\n\r\n                element.CopyAttributes(control as HtmlForm, false);\r\n\r\n                foreach (var child in element.Nodes())\r\n                {\r\n                    control.Controls.Add(child.AsAspNetControl(this));\r\n                }\r\n\r\n                return true;\r\n            }\r\n\r\n            if (element.Name == _placeholderElementName)\r\n            {\r\n                control = new PlaceHolder();\r\n\r\n                XAttribute idAttribute = element.Attribute(\"id\");\r\n                if (idAttribute != null)\r\n                {\r\n                    control.ID = idAttribute.Value;\r\n                }\r\n\r\n                foreach (var child in element.Nodes())\r\n                {\r\n                    control.Controls.Add(child.AsAspNetControl(this));\r\n                }\r\n\r\n                return true;\r\n            }\r\n\r\n            throw new InvalidOperationException(string.Format(\"Unhandled ASP.NET tag '{0}'.\", element.Name));\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Plugins/RenderingResponseHandler/IDataRenderingResponseHandler.cs",
    "content": "﻿using Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler\r\n{\r\n    /// <summary>\r\n    /// C1 CMS allow you to build a RenderingResponseHandler plug-in. It enables developers to intercept \r\n    /// page and media requests and control if the request should be accepted or redirected and if the rendered \r\n    /// resource is allowed to be publicly cached.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// To create a RenderingResponseHandler plug-in:\r\n    /// <list type=\"number\">\r\n    /// <item>\r\n    /// <description>In Visual Studio, create a new \"Class Library\" project (or use an existing project if you have one).</description>\r\n    /// </item>\r\n    /// <item>\r\n    /// <description>Add references to the following assemblies ( Browse and located on your web site):\r\n    /// \t<list type=\"bullet\">\r\n    /// \t\t<item>\r\n    ///\t \t\t<description>/bin/Composite.dll</description>\r\n    /// \t\t</item>\r\n    /// \t\t<item>\r\n    /// \t\t\t<description>/bin/Microsoft.Practices.EnterpriseLibrary.Common.dll</description>\r\n    /// \t\t</item>\r\n    /// \t</list></description>\r\n    /// </item>\r\n    /// <item>\r\n    /// <description>In each assembly reference's properties, set Copy Local to 'False'.</description>\r\n    /// </item>\r\n    /// <item>\r\n    /// <description>Add a reference to System.Configuration (.NET)</description>\r\n    /// </item>\r\n    /// <item>\r\n    /// <description>Create a new class for your plug-in (see the source code example below).</description>\r\n    /// </item>\r\n    /// <item>\r\n    /// <description>Compile the project and copy the DLL to the website /bin folder.</description>\r\n    /// </item>\r\n    /// </list>\r\n    /// To register a RenderingResponseHandler plug-in:\r\n    /// <list type=\"number\">\r\n    /// <item>\r\n    /// <description>Edit the file /App_Data/Composite/Composite.config.</description>\r\n    /// </item>\r\n    /// <item>\r\n    /// <description>Locate the element <RenderingResponseHandlerPlugins />.</description>\r\n    /// </item>\r\n    /// <item>\r\n    /// <description>Add a new element inside the &lt;RenderingResponseHandlerPlugins /&gt; element:\r\n    ///\r\n    ///    &lt;add name=\"Sample\" type=\"TypeName, AssemblyName\"/&gt;\r\n    ///\r\n    /// changing 'Sample' to a name relevant to your project and 'TypeName, AssemblyName' to the fully qualified class name of your plug-in class.</description>\r\n    /// </item>\r\n    /// <item>\r\n    /// <description>Restart the C1 site (recycle app pool or use C1 Console; Tools | Restart Server)</description>\r\n    /// </item>\r\n    /// </list>\r\n    /// </remarks>\r\n    /// <example>\r\n    /// Sample plugin:\r\n    /// <code>\r\n    ///using System;\r\n    ///using Composite.Data;\r\n    ///using Composite.Data.Types;\r\n    ///using Composite.Core.Logging;\r\n    ///using Composite.Core.WebClient.Renderings;\r\n    ///using Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler;\r\n    ///\r\n    ///using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n    ///\r\n    ///\r\n    ///namespace RenderingResponseHandlerSample\r\n    ///{\r\n    ///    [ConfigurationElementType(typeof(NonConfigurableRenderingResponseHandler))]\r\n    ///    public class RenderingResponseHandlerPluginSample : IDataRenderingResponseHandler\r\n    ///    {\r\n    ///        // Have the TCP logger running to see the string being logged - see Composite.Tools.TcpCustomTraceListener\r\n    ///        // This sample will redirect requests for pages and media containing the word 'secret' in their title / path.\r\n    ///        public RenderingResponseHandlerResult GetDataResponseHandling(DataEntityToken requestedItemEntityToken)\r\n    ///        {\r\n    ///            IData requestedData = requestedItemEntityToken.Data;\r\n    ///\r\n    ///            bool redirect = false;\r\n    ///\r\n    ///            if (requestedData is IPage)\r\n    ///            {\r\n    ///                IPage requestedPage = (IPage)requestedData;\r\n    ///                LoggingService.LogVerbose(\"Sample\", string.Format(\"Request for page '{0}'.\", requestedPage.Title));\r\n    ///\r\n    ///                if (requestedPage.Title.ToLower().Contains(\"secret\"))\r\n    ///                {\r\n    ///                    redirect = true;\r\n    ///                }\r\n    ///            }\r\n    ///            else if (requestedData is IMediaFile)\r\n    ///            {\r\n    ///                IMediaFile requestedMediaFile = (IMediaFile)requestedData;\r\n    ///                LoggingService.LogVerbose(\"Sample\", string.Format(\"Request for media file '{0}'.\", requestedMediaFile.CompositePath));\r\n    ///\r\n    ///                if (requestedMediaFile.CompositePath.ToLower().Contains(\"secret\"))\r\n    ///                {\r\n    ///                    redirect = true;\r\n    ///                }\r\n    ///            }\r\n    ///\r\n    ///            if (redirect)\r\n    ///            {\r\n    ///                return new RenderingResponseHandlerResult\r\n    ///                {\r\n    ///                    PreventPublicCaching = true,\r\n    ///                    RedirectRequesterTo = new Uri(\"http://docs.composite.net/\")\r\n    ///                };\r\n    ///            }\r\n    ///            else\r\n    ///            {\r\n    ///                return new RenderingResponseHandlerResult\r\n    ///                {\r\n    ///                    PreventPublicCaching = false\r\n    ///                };\r\n    ///            }\r\n    ///        }\r\n    ///    }\r\n    ///}\r\n    /// </code>\r\n    /// Sample configuration snippet from Composite.config:\r\n    /// <code>\r\n    /// &lt;Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandlerConfiguration&gt; \r\n    ///   &lt;RenderingResponseHandlerPlugins&gt; \r\n    ///     &lt;add name=\"Sample\" type=\"RenderingResponseHandlerSample.RenderingResponseHandlerPluginSample, RenderingResponseHandlerSample\" /&gt; \r\n    ///   &lt;/RenderingResponseHandlerPlugins&gt; \r\n    /// &lt;/Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandlerConfiguration&gt;    \r\n    /// </code>\r\n    /// </example>\r\n    public interface IDataRenderingResponseHandler : IRenderingResponseHandler\r\n\t{\r\n        /// <summary>\r\n        /// Method which gets called for all C1 media file requests and (un-cached) C1 page requests. \r\n        /// The fate of the request is described in the <see cref=\"RenderingResponseHandlerResult\"/> return value.\r\n        /// </summary>\r\n        /// <param name=\"requestedItemEntityToken\">The data being rendered. This can be <see cref=\"Composite.Data.Types.IPage\"/> and <see cref=\"Composite.Data.Types.IMediaFile\"/>.</param>\r\n        /// <returns>A <see cref=\"RenderingResponseHandlerResult\"/> object detailing what should happen to the user request. Returning null means no special handling should be done (request should continue).</returns>\r\n        RenderingResponseHandlerResult GetDataResponseHandling(DataEntityToken requestedItemEntityToken);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Plugins/RenderingResponseHandler/IRenderingResponseHandler.cs",
    "content": "﻿using Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler\r\n{\r\n    /// <summary>\r\n    /// Base interface - use the interface <see cref=\"IDataRenderingResponseHandler\"/> for handling page and media requests.\r\n    /// </summary>\r\n    [CustomFactory(typeof(RenderingResponseHandlerCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(RenderingResponseHandlerDefaultNameRetriever))]\r\n\tpublic interface IRenderingResponseHandler\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Plugins/RenderingResponseHandler/NonConfigurableHookRegistrator.cs",
    "content": "using System;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler\r\n{\r\n    /// <summary>\r\n    /// Configuration object with no custom config settings. When developing your own <see cref=\"IRenderingResponseHandler\"/> \r\n    /// plugin you can use this if you do not require any special configuration in the Composite.config file.\r\n    /// </summary>\r\n    [Assembler(typeof(NonConfigurableRenderingResponseHandlerAssembler))]\r\n    public sealed class NonConfigurableRenderingResponseHandler : RenderingResponseHandlerData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NonConfigurableRenderingResponseHandlerAssembler : IAssembler<IRenderingResponseHandler, RenderingResponseHandlerData>\r\n\t{\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IRenderingResponseHandler Assemble(IBuilderContext context, RenderingResponseHandlerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IRenderingResponseHandler)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Plugins/RenderingResponseHandler/RenderingResponseHandlerData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler\r\n{\r\n    /// <summary>\r\n    /// Base class for <see cref=\"IRenderingResponseHandler\"/> plugin configuration. If you do not require special\r\n    /// configuration, use <see cref=\"NonConfigurableRenderingResponseHandler\"/>.\r\n    /// </summary>\r\n    [ConfigurationElementType(typeof(NonConfigurableRenderingResponseHandler))]\r\n    public class RenderingResponseHandlerData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Plugins/RenderingResponseHandler/Runtime/RenderingResponseHandlerCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.Runtime\r\n{\r\n    internal sealed class RenderingResponseHandlerCustomFactory : AssemblerBasedCustomFactory<IRenderingResponseHandler, RenderingResponseHandlerData>\r\n\t{\r\n        protected override RenderingResponseHandlerData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            RenderingResponseHandlerSettings settings = configurationSource.GetSection(RenderingResponseHandlerSettings.SectionName) as RenderingResponseHandlerSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", RenderingResponseHandlerSettings.SectionName));\r\n            }\r\n\r\n            return settings.RenderingResponseHandlerPlugins.Get(name);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Plugins/RenderingResponseHandler/Runtime/RenderingResponseHandlerDefaultNameRetriever.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.Runtime\r\n{\r\n    internal sealed class RenderingResponseHandlerDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Plugins/RenderingResponseHandler/Runtime/RenderingResponseHandlerFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.Runtime\r\n{\r\n    internal sealed class RenderingResponseHandlerFactory : NameTypeFactoryBase<IRenderingResponseHandler>\r\n\t{\r\n        public RenderingResponseHandlerFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Plugins/RenderingResponseHandler/Runtime/RenderingResponseHandlerSettings.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing System.Configuration;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.Runtime\r\n{\r\n    internal sealed class RenderingResponseHandlerSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandlerConfiguration\";\r\n\r\n\r\n        private const string _hookRegistratorPluginsProperty = \"RenderingResponseHandlerPlugins\";\r\n        [ConfigurationProperty(_hookRegistratorPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<RenderingResponseHandlerData> RenderingResponseHandlerPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<RenderingResponseHandlerData>)base[_hookRegistratorPluginsProperty];\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/RenderingContext.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Web;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Routing.Pages;\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n    /// <summary>\r\n    /// Rendering context\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class RenderingContext: IDisposable\r\n    {\r\n        private static readonly string LogTitle = typeof (RenderingContext).Name;\r\n\r\n        /// <summary>\r\n        /// Indicates whether performance profiling is enabled.\r\n        /// </summary>\r\n        /// <value><c>true</c> if profiling is enabled; otherwise, <c>false</c>.</value>\r\n        public bool ProfilingEnabled { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether page is shown in preview mode.\r\n        /// </summary>\r\n        /// <value><c>true</c> if page is shown in preview mode; otherwise, <c>false</c>.</value>\r\n        public bool PreviewMode { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the current c1 page.\r\n        /// </summary>\r\n        /// <value>The page.</value>\r\n        public IPage Page { get; private set; }\r\n\r\n        internal PageContentToRender PageContentToRender { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether page caching is disabled.\r\n        /// </summary>\r\n        /// <value><c>true</c> if page caching is disabled; otherwise, <c>false</c>.</value>\r\n        public bool CachingDisabled { get; private set; }\r\n\r\n        private static readonly List<string> _prettifyErrorUrls = new List<string>();\r\n        private static int _prettifyErrorCount;\r\n\r\n        private Guid _previewKey;\r\n        private IDisposable _pagePerfMeasuring;\r\n        private string _cachedUrl;\r\n        private IDisposable _dataScope;\r\n\r\n        private RenderingContext()\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public static RenderingContext InitializeFromHttpContext()\r\n        {\r\n            var renderingContext = new RenderingContext();\r\n            renderingContext.InitializeFromHttpContextInternal();\r\n            return renderingContext;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Runs the response handlers.\r\n        /// </summary>\r\n        /// <returns><c>true</c> if a handler has already processed the request and no further writing to response should be done; otherwise, <c>false</c>.</returns>\r\n        public bool RunResponseHandlers()\r\n        {\r\n            if (PreviewMode)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            var httpContext = HttpContext.Current;\r\n            var response = httpContext.Response;\r\n\r\n            var responseHandling = RenderingResponseHandlerFacade.GetDataResponseHandling(PageRenderer.CurrentPage.GetDataEntityToken());\r\n            if (responseHandling != null)\r\n            {\r\n                if (responseHandling.PreventPublicCaching)\r\n                {\r\n                    response.Cache.SetCacheability(HttpCacheability.NoCache);\r\n                    CachingDisabled = true;\r\n                }\r\n\r\n                if (responseHandling.EndRequest || responseHandling.RedirectRequesterTo != null)\r\n                {\r\n                    if (responseHandling.RedirectRequesterTo != null)\r\n                    {\r\n                        response.Redirect(responseHandling.RedirectRequesterTo.ToString(), false);\r\n                    }\r\n\r\n                    httpContext.ApplicationInstance.CompleteRequest();\r\n\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<IPagePlaceholderContent> GetPagePlaceholderContents()\r\n        {\r\n            return PreviewMode ? PagePreviewContext.GetPageContents(_previewKey)\r\n                               : PageManager.GetPlaceholderContent(Page.Id, Page.VersionId);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ConvertInternalLinks(string xhtml)\r\n        {\r\n            using (Profiler.Measure(\"Converting internal urls to public\"))\r\n            {\r\n                return InternalUrls.ConvertInternalUrlsToPublic(xhtml);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormatXhtml(string xhtml)\r\n        {\r\n            try\r\n            {\r\n                using (Profiler.Measure(\"Formatting output XHTML with Composite.Core.Xml.XhtmlPrettifier\"))\r\n                {\r\n                    xhtml = Composite.Core.Xml.XhtmlPrettifier.Prettify(xhtml);\r\n                }\r\n            }\r\n            catch\r\n            {\r\n                if (!PreviewMode)\r\n                {\r\n                    const int maxWarningsToShow = 3;\r\n\r\n                    if (_prettifyErrorCount < maxWarningsToShow)\r\n                    {\r\n                        lock (_prettifyErrorUrls)\r\n                        {\r\n                            if (!_prettifyErrorUrls.Contains(_cachedUrl) && _prettifyErrorCount < maxWarningsToShow)\r\n                            {\r\n                                _prettifyErrorUrls.Add(_cachedUrl);\r\n                                _prettifyErrorCount++;\r\n                                Log.LogWarning(LogTitle, \"Failed to format output xhtml in a pretty way - your page output is likely not strict xml. Url: \" + (HttpUtility.UrlDecode(_cachedUrl) ?? \"undefined\"));\r\n                                if (maxWarningsToShow == _prettifyErrorCount)\r\n                                {\r\n                                    Log.LogInformation(LogTitle, $\"{maxWarningsToShow} xhtml format errors logged since startup. No more will be logged until next startup.\");\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return xhtml;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string BuildProfilerReport()\r\n        {\r\n            _pagePerfMeasuring.Dispose();\r\n\r\n            Measurement measurement = Profiler.EndProfiling();\r\n\r\n            var url = new UrlBuilder(HttpContext.Current.Request.Url.ToString())\r\n            {\r\n                [\"c1mode\"] = null\r\n            };\r\n\r\n            return ProfilerReport.BuildReport(measurement, url);\r\n        }\r\n\r\n\r\n        private void InitializeFromHttpContextInternal()\r\n        {\r\n            HttpContext httpContext = HttpContext.Current;\r\n            var request = httpContext.Request;\r\n            var response = httpContext.Response;\r\n\r\n           ProfilingEnabled = request.Url.OriginalString.Contains(\"c1mode=perf\");\r\n            if (ProfilingEnabled)\r\n            {\r\n                if (!UserValidationFacade.IsLoggedIn())\r\n                {\r\n                    string loginUrl = GetLoginRedirectUrl(request.RawUrl);\r\n                    response.Write(@\"You must be logged into <a href=\"\"\" + loginUrl + @\"\"\">C1 console</a> to have the performance view enabled\");\r\n                    response.End(); // throws ThreadAbortException\r\n                    return;\r\n                }\r\n\r\n                Profiler.BeginProfiling();\r\n                _pagePerfMeasuring = Profiler.Measure(\"C1 Page\");\r\n            }\r\n\r\n            PreviewMode = PagePreviewContext.TryGetPreviewKey(request, out _previewKey);\r\n\r\n            if (PreviewMode)\r\n            {\r\n                Page = PagePreviewContext.GetPage(_previewKey);\r\n                C1PageRoute.PageUrlData = new PageUrlData(Page);\r\n                PageRenderer.RenderingReason = PagePreviewContext.GetRenderingReason(_previewKey);\r\n            }\r\n            else\r\n            {\r\n                PageUrlData pageUrl = C1PageRoute.PageUrlData ??  PageUrls.UrlProvider.ParseInternalUrl(request.Url.OriginalString);\r\n                Page = pageUrl.GetPage();\r\n\r\n                _cachedUrl = request.Url.PathAndQuery;\r\n\r\n                PageRenderer.RenderingReason = new UrlSpace(httpContext).ForceRelativeUrls \r\n                    ? RenderingReason.C1ConsoleBrowserPageView \r\n                    : RenderingReason.PageView;\r\n            }\r\n\r\n            ValidateViewUnpublishedRequest(httpContext);\r\n\r\n            if (Page == null)\r\n            {\r\n                throw new HttpException(404, \"Page not found - either this page has not been published yet or it has been deleted.\");\r\n            }\r\n\r\n            if (Page.DataSourceId.PublicationScope != PublicationScope.Published)\r\n            {\r\n                response.Cache.SetCacheability(HttpCacheability.NoCache);\r\n                CachingDisabled = true;\r\n            }\r\n\r\n            PageRenderer.CurrentPage = Page;\r\n\r\n            var culture = Page.DataSourceId.LocaleScope;\r\n\r\n            _dataScope = new DataScope(Page.DataSourceId.PublicationScope, culture);\r\n            Thread.CurrentThread.CurrentCulture = culture;\r\n            Thread.CurrentThread.CurrentUICulture = culture;\r\n\r\n            var pagePlaceholderContents = GetPagePlaceholderContents();\r\n            PageContentToRender = new PageContentToRender(Page, pagePlaceholderContents, PreviewMode);\r\n\r\n            AttachRendererToAspNetPage(httpContext);\r\n        }\r\n\r\n        private void AttachRendererToAspNetPage(HttpContext context)\r\n        {\r\n            Verify.IsNotNull(context.Handler, \"HttpHandler isn't defined\");\r\n            var aspnetPage = context.Handler as System.Web.UI.Page;\r\n            if (aspnetPage == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var pageRenderer = PageTemplateFacade.BuildPageRenderer(Page.TemplateId);\r\n            pageRenderer.AttachToPage(aspnetPage, PageContentToRender);\r\n        }\r\n\r\n        private void ValidateViewUnpublishedRequest(HttpContext httpContext)\r\n        {\r\n            bool isPreviewingUrl = httpContext.Request.Url.OriginalString.Contains(DefaultPageUrlProvider.UrlMarker_RelativeUrl);\r\n            bool isUnpublishedPage = Page != null && Page.DataSourceId.PublicationScope != PublicationScope.Published;\r\n\r\n            if ((isUnpublishedPage || isPreviewingUrl)\r\n                && !UserValidationFacade.IsLoggedIn())\r\n            {\r\n                string redirectUrl = GetLoginRedirectUrl(httpContext.Request.Url.OriginalString);\r\n\r\n                httpContext.Response.Redirect(redirectUrl, true);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Redirects to 404 page if PathInfo wasn't used. Adds 404 status code if the current page is specified as 404 page in hostname binding.\r\n        /// Note that all C1 functions on page have to be executed before calling this method.\r\n        /// </summary>\r\n        /// <returns><c>True</c> if the request was transferred to a 404 page and rendering should be stopped.</returns>\r\n        public bool PreRenderRedirectCheck()\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if (!C1PageRoute.GetPathInfo().IsNullOrEmpty()\r\n                && !C1PageRoute.PathInfoUsed)\r\n            {\r\n                // Redirecting to PageNotFoundUrl or setting 404 response code if PathInfo url part hasn't been used\r\n                if (HostnameBindingsFacade.ServeCustomPageNotFoundPage(httpContext))\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                throw new HttpException(404, $\"Page not found\");\r\n            }\r\n\r\n            // Setting 404 response code if it is a request to a custom \"Page not found\" page\r\n            if (HostnameBindingsFacade.IsPageNotFoundRequest())\r\n            {\r\n                httpContext.Response.StatusCode = 404;\r\n            }\r\n\r\n            return false;\r\n        }\r\n        \r\n        private static string GetLoginRedirectUrl(string url)\r\n        {\r\n            return UrlUtils.PublicRootPath + \"/Composite/Login.aspx?ReturnUrl=\" +\r\n                   HttpUtility.UrlEncode(url, Encoding.UTF8);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            PageRenderingHistory.MarkPageAsRendered(this.Page);\r\n\r\n            _dataScope?.Dispose();\r\n\r\n            if (PreviewMode)\r\n            {\r\n                PagePreviewContext.Remove(_previewKey);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/RenderingElementNames.cs",
    "content": "﻿using System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class RenderingElementNames\r\n    {\r\n        /// <exclude />\r\n        public static XName Html { get; } = Namespaces.Xhtml + \"html\";\r\n\r\n        /// <exclude />\r\n        public static XName PlaceHolder { get; } = Namespaces.Rendering10 + \"placeholder\";\r\n\r\n        /// <exclude />\r\n        public static XName PlaceHolderIdAttribute { get; } = \"id\";\r\n\r\n        /// <exclude />\r\n        public static XName PlaceHolderTitleAttribute { get; } = \"title\";\r\n\r\n        /// <exclude />\r\n        public static XName PlaceHolderDefaultAttribute { get; } = \"default\";\r\n\r\n        /// <exclude />\r\n        public static XName PageTitle { get; } = Namespaces.Rendering10 + \"page.title\";\r\n\r\n        /// <exclude />\r\n        public static XName PageAbstract { get; } = Namespaces.Rendering10 + \"page.description\";\r\n\r\n        /// <exclude />\r\n        public static XName PageMetaTagDescription { get; } = Namespaces.Rendering10 + \"page.metatag.description\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/RenderingResponseHandlerFacade.cs",
    "content": "﻿using Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n    /// <summary>\r\n    /// Pass information about a request through all <see cref=\"Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.IDataRenderingResponseHandler\"/> \r\n    /// plugins registered on the C1 CMS site. Use this if you are handling raw page / media http requests yourself.\r\n    /// \r\n    /// </summary>\r\n\tpublic static class RenderingResponseHandlerFacade\r\n\t{\r\n        private static IRenderingResponseHandlerFacade _implementation = new RenderingResponseHandlerFacadeImpl();\r\n\r\n        internal static IRenderingResponseHandlerFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Pass information about a request through all <see cref=\"Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler.IDataRenderingResponseHandler\"/> \r\n        /// plugins registered on the C1 CMS site. The resulting <see cref=\"RenderingResponseHandlerResult\"/> define how you should treat the request.\r\n        /// </summary>\r\n        /// <param name=\"requestedItemEntityToken\">The data being rendered. This can be <see cref=\"Composite.Data.Types.IPage\"/> and <see cref=\"Composite.Data.Types.IMediaFile\"/>.</param>\r\n        /// <returns>A <see cref=\"RenderingResponseHandlerResult\"/> object detailing what should happen to the user request. Returning null means no special handling should be done (request should continue).</returns>\r\n        public static RenderingResponseHandlerResult GetDataResponseHandling(DataEntityToken requestedItemEntityToken)\r\n        {\r\n            return _implementation.GetDataResponseHandling(requestedItemEntityToken);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/RenderingResponseHandlerFacadeImpl.cs",
    "content": "using Composite.Data;\r\nusing Composite.Core.WebClient.Renderings.Foundation;\r\nusing Composite.Core.WebClient.Renderings.Foundation.PluginFacades;\r\nusing Composite.Core.WebClient.Renderings.Plugins.RenderingResponseHandler;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n    internal sealed class RenderingResponseHandlerFacadeImpl : IRenderingResponseHandlerFacade\r\n\t{\r\n        public RenderingResponseHandlerResult GetDataResponseHandling(DataEntityToken requestedItemEntityToken)\r\n        {\r\n            foreach (string name in RenderingResponseHandlerRegistry.RenderingResponseHandlerNames)\r\n            {\r\n                if (!RenderingResponseHandlerPluginFacade.IsDataRenderingResponseHandler(name)) continue;\r\n\r\n                var result = RenderingResponseHandlerPluginFacade.GetDataResponseHandling(name, requestedItemEntityToken);\r\n\r\n                if (result != null && result.IsNotEmpty)\r\n                {\r\n                    return result;\r\n                }\r\n            }\r\n\r\n            foreach (var responseHandler in ServiceLocator.GetServices<IDataRenderingResponseHandler>())\r\n            {\r\n                var result = responseHandler.GetDataResponseHandling(requestedItemEntityToken);\r\n\r\n                if (result != null && result.IsNotEmpty)\r\n                {\r\n                    return result;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/RenderingResponseHandlerResult.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n    /// <summary>\r\n    /// Describe how a request should be handled in terms of allowing the request, ending it, redirecting it and caching it.\r\n    /// </summary>\r\n\tpublic sealed class RenderingResponseHandlerResult\r\n\t{\r\n        /// <summary>\r\n        /// When true full page caching will explicitly be denied. Page caching can greatly increase website performance,\r\n        /// but is not desireable on pages that require validation or contain personalized content. Default is false.\r\n        /// </summary>\r\n        public bool PreventPublicCaching { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// To block the request and have the user redirected to another location specify the destination URL here. \r\n        /// Default is null.\r\n        /// </summary>\r\n        public Uri RedirectRequesterTo { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// When true, the request will not continue. Default is false\r\n        /// </summary>\r\n        public bool EndRequest { get; set; }\r\n\r\n        internal bool IsNotEmpty => PreventPublicCaching || EndRequest || RedirectRequesterTo != null;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/RequestInterceptorHttpModule.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings\r\n{\r\n    internal class RequestInterceptorHttpModule : IHttpModule\r\n    {\r\n        public void Init(HttpApplication context)\r\n        {\r\n            context.BeginRequest += context_BeginRequest;\r\n            context.PreRequestHandlerExecute += context_PreRequestHandlerExecute;\r\n        }\r\n\r\n        void context_BeginRequest(object sender, EventArgs e)\r\n        {\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized) return;\r\n\r\n            ThreadDataManager.InitializeThroughHttpContext();\r\n\r\n            var httpContext = (sender as HttpApplication).Context;\r\n\r\n            if (CheckForHostnameAliasRedirect(httpContext))\r\n            {\r\n                return;\r\n            }\r\n\r\n            IHostnameBinding hostnameBinding = HostnameBindingsFacade.GetBindingForCurrentRequest();\r\n\r\n            if (hostnameBinding != null\r\n                && hostnameBinding.EnforceHttps\r\n                && !httpContext.Request.IsSecureConnection)\r\n            {\r\n                RedirectToHttps(httpContext);\r\n                return;\r\n            }\r\n\r\n            if (HandleMediaRequest(httpContext))\r\n            {\r\n                return;\r\n            }\r\n\r\n            SetCultureByHostname(hostnameBinding);\r\n\r\n            PrettifyPublicMarkup(httpContext);\r\n\r\n            HandleRootRequestInClassicMode(httpContext);\r\n        }\r\n\r\n        private void RedirectToHttps(HttpContext context)\r\n        {\r\n            var url = context.Request.Url.ToString();\r\n\r\n            const string expectedPrefix = \"http:\";\r\n            Verify.That(url.StartsWith(expectedPrefix, StringComparison.OrdinalIgnoreCase), \"Unexpected protocol, url: '{0}'\", url);\r\n\r\n            var redirectUrl = \"https:\" + url.Substring(expectedPrefix.Length);\r\n            context.Response.Redirect(redirectUrl, false);\r\n        }\r\n\r\n        static void SetCultureByHostname(IHostnameBinding hostnameBinding)\r\n        {\r\n            if ((hostnameBinding?.Culture).IsNullOrEmpty())\r\n            {\r\n                return;\r\n            }\r\n            \r\n            var cultureInfo = new CultureInfo(hostnameBinding.Culture);\r\n            var thread = System.Threading.Thread.CurrentThread;\r\n            thread.CurrentCulture = cultureInfo;\r\n            thread.CurrentUICulture = cultureInfo;\r\n        }\r\n\r\n\r\n        static void PrettifyPublicMarkup(HttpContext httpContext)\r\n        {\r\n            httpContext.Response.AppendHeader(\"X-Powered-By\", GlobalSettingsFacade.ApplicationName);\r\n        }\r\n\r\n        static bool HandleMediaRequest(HttpContext httpContext)\r\n        {\r\n            string rawUrl = httpContext.Request.RawUrl;\r\n\r\n            UrlKind urlKind;\r\n            var mediaUrlData = MediaUrls.ParseUrl(rawUrl, out urlKind);\r\n\r\n            // Redirecting to public media url if it isn't pointing to our handler\r\n            if (urlKind == UrlKind.Internal && mediaUrlData.MediaStore != MediaUrls.DefaultMediaStore)\r\n            {\r\n                string publicUrl = MediaUrls.BuildUrl(mediaUrlData, UrlKind.Public);\r\n\r\n                if (!string.IsNullOrEmpty(publicUrl) && !publicUrl.StartsWith(MediaUrls.MediaUrl_PublicPrefix))\r\n                {\r\n                    httpContext.Response.Redirect(publicUrl, false);\r\n                    httpContext.Response.ExpiresAbsolute = DateTime.Now.AddDays(1);\r\n                    httpContext.ApplicationInstance.CompleteRequest();\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            if(mediaUrlData != null\r\n                && (urlKind == UrlKind.Public || urlKind == UrlKind.Internal))\r\n            {\r\n                string rendererUrl = MediaUrls.BuildUrl(mediaUrlData, UrlKind.Renderer);\r\n\r\n                httpContext.RewritePath(rendererUrl);\r\n                return true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        void context_PreRequestHandlerExecute(object sender, EventArgs e)\r\n        {\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized) return;\r\n\r\n            // Left for backward compatibility with Contrib master pages support, to be removed \r\n            // when support for master pages is implemented in C1\r\n            // RenderingContext.PreRenderRedirectCheck() does the same logic\r\n            var httpContext = (sender as HttpApplication).Context;\r\n\r\n            var page = httpContext.Handler as System.Web.UI.Page;\r\n            if (page == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(C1PageRoute.GetPathInfo()))\r\n            {\r\n                page.PreRender += (a, b) => CheckThatPathInfoHasBeenUsed(httpContext, page);\r\n            }\r\n\r\n            // Setting 404 response code if it is a request to a custom \"Page not found\" page\r\n            if (HostnameBindingsFacade.IsPageNotFoundRequest())\r\n            {\r\n                page.PreRender += (a, b) =>\r\n                {\r\n                    httpContext.Response.TrySkipIisCustomErrors = true;\r\n                    httpContext.Response.StatusCode = 404;\r\n                };\r\n            }\r\n        }\r\n\r\n        private static void HandleRootRequestInClassicMode(HttpContext httpContext)\r\n        {\r\n            if (HttpRuntime.UsingIntegratedPipeline)\r\n            {\r\n                return;\r\n            }\r\n\r\n            // Resolving root path \"/\" for classic mode\r\n            string rawUrl = httpContext.Request.RawUrl;\r\n\r\n            string rootPath = UrlUtils.PublicRootPath\r\n                                + (UrlUtils.PublicRootPath.EndsWith(\"/\") ? \"\" : \"/\");\r\n\r\n            string defaultAspxPath = rootPath + \"default.aspx\";\r\n\r\n            if (rawUrl.StartsWith(defaultAspxPath, StringComparison.InvariantCultureIgnoreCase))\r\n            {\r\n                string query = rawUrl.Substring(defaultAspxPath.Length);\r\n\r\n                string shorterQuery = rootPath + query;\r\n\r\n                // Checking that there's a related page)\r\n                if (PageUrls.ParseUrl(shorterQuery) != null)\r\n                {\r\n                    httpContext.RewritePath(shorterQuery);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void CheckThatPathInfoHasBeenUsed(HttpContext httpContext, System.Web.UI.Page page)\r\n        {\r\n            if (C1PageRoute.PathInfoUsed)\r\n            {\r\n                return;\r\n            }\r\n\r\n            // Redirecting to PageNotFoundUrl or setting 404 response code if PathInfo url part hasn't been used\r\n            if (!HostnameBindingsFacade.ServeCustomPageNotFoundPage(httpContext))\r\n            {\r\n                page.Response.StatusCode = 404;\r\n            }\r\n\r\n            page.Response.End();\r\n        }\r\n\r\n\r\n        public void Dispose()\r\n        {\r\n        }\r\n\r\n        static bool CheckForHostnameAliasRedirect(HttpContext httpContext)\r\n        {\r\n            if (UrlUtils.IsAdminConsoleRequest(httpContext) \r\n                || UrlUtils.IsRendererRequest(httpContext)  \r\n                || new UrlSpace(httpContext).ForceRelativeUrls)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            var hostnameBinding = HostnameBindingsFacade.GetAliasBinding(httpContext);\r\n\r\n            if (hostnameBinding == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            string hostname = httpContext.Request.Url.Host.ToLowerInvariant();\r\n\r\n            var request = httpContext.Request;\r\n\r\n            string newUrl = request.Url.AbsoluteUri.Replace(\"://\" + hostname, \"://\" + hostnameBinding.Hostname);\r\n\r\n            if (hostnameBinding.UsePermanentRedirect)\r\n            {\r\n                httpContext.Response.RedirectPermanent(newUrl, false);\r\n            }\r\n            else\r\n            {\r\n                httpContext.Response.Redirect(newUrl, false);\r\n            }\r\n            httpContext.ApplicationInstance.CompleteRequest();\r\n            return true;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Template/PageTemplateFeatureFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Configuration;\r\nusing System.IO;\r\nusing Composite.Data.Caching;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Template\r\n{\r\n    /// <summary>\r\n    /// Provides access to Page Template Features\r\n    /// </summary>\r\n    public static class PageTemplateFeatureFacade\r\n    {\r\n        private static readonly Cache<string, XhtmlDocument> _featureCache = new Cache<string, XhtmlDocument>(\"Page Template Features\");\r\n        private static List<string> _featureNamesCache;\r\n\r\n        private static readonly object _lock = new object();\r\n\r\n        private static C1FileSystemWatcher _featureDirectoryFileSystemWatcher;\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a Page Template Feature based on name.\r\n        /// </summary>\r\n        /// <param name=\"featureName\">Name of the Page Template Feature to return.</param>\r\n        /// <returns></returns>\r\n        public static XhtmlDocument GetPageTemplateFeature(string featureName)\r\n        {\r\n            EnsureWatcher();\r\n\r\n            string featureKey = featureName.ToLowerInvariant();\r\n\r\n            XhtmlDocument cachedFeatureDocument = _featureCache.Get(featureKey);\r\n\r\n            if (cachedFeatureDocument == null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    cachedFeatureDocument = _featureCache.Get(featureKey);\r\n\r\n                    if (cachedFeatureDocument == null)\r\n                    {\r\n                        cachedFeatureDocument = LoadPageTemplateFeature(featureName);\r\n\r\n                        _featureCache.Add(featureKey, cachedFeatureDocument);\r\n                    }\r\n                }\r\n\r\n            }\r\n\r\n            return new XhtmlDocument(cachedFeatureDocument);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the feature names.\r\n        /// </summary>\r\n        public static IEnumerable<string> FeatureNames\r\n        {\r\n            get\r\n            {\r\n                EnsureWatcher();\r\n\r\n                List<string> featureNames = _featureNamesCache;\r\n\r\n                if (featureNames == null)\r\n                {\r\n                    lock (_lock)\r\n                    {\r\n                        featureNames = _featureNamesCache;\r\n\r\n                        if (featureNames == null)\r\n                        {\r\n                            string featureDirectoryPath = PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory);\r\n                            C1DirectoryInfo featureDirectory = new C1DirectoryInfo(featureDirectoryPath);\r\n\r\n                            var files = featureDirectory.GetFiles(\"*.xml\").Concat(featureDirectory.GetFiles(\"*.html\"));\r\n\r\n                            featureNames = new List<string>();\r\n\r\n                            foreach (var file in files)\r\n                            {\r\n                                featureNames.Add(Path.GetFileNameWithoutExtension(file.Name));\r\n                            }\r\n\r\n                            featureNames =  featureNames.Distinct().ToList();\r\n\r\n                            _featureNamesCache = featureNames;\r\n                        }\r\n                    }\r\n                }\r\n                \r\n                return featureNames;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the path of a named feature\r\n        /// </summary>\r\n        /// <param name=\"featureName\">Name of the Page Template Feature to get path for.</param>\r\n        /// <returns></returns>\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public static string GetPageTemplateFeaturePath(string featureName)\r\n        {\r\n            string extensionlessPath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory), featureName);\r\n\r\n            if (C1File.Exists(extensionlessPath + \".html\"))\r\n            {\r\n                return extensionlessPath + \".html\";\r\n            }\r\n            else if (C1File.Exists(extensionlessPath + \".xml\"))\r\n            {\r\n                return extensionlessPath + \".xml\";\r\n            }\r\n            else\r\n            {\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the path of a named feature\r\n        /// </summary>\r\n        /// <param name=\"featureName\">Name of the Page Template Feature to get path for.</param>\r\n        /// <param name=\"extension\">The extension.</param>\r\n        /// <returns></returns>\r\n        /// <exclude/>\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public static string GetNewPageTemplateFeaturePath(string featureName, string extension)\r\n        {\r\n            if (!extension.StartsWith(\".\"))\r\n            {\r\n                extension = \".\" + extension;\r\n            }\r\n\r\n            if (extension != \".xml\" && extension != \".html\")\r\n            {\r\n                throw new ArgumentException(\"Expecting '.xml' or '.html'\", \"extension\");\r\n            }\r\n\r\n            return Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory), featureName + extension);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Loads a Page Template Feature based on name.\r\n        /// </summary>\r\n        /// <param name=\"featureName\">Name of the Page Template Feature to load.</param>\r\n        /// <returns></returns>\r\n        private static XhtmlDocument LoadPageTemplateFeature(string featureName)\r\n        {\r\n            string featurePath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory), featureName + \".xml\");\r\n\r\n            if (!C1File.Exists(featurePath))\r\n            {\r\n                featurePath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory), featureName + \".html\");\r\n            }\r\n\r\n            if (!C1File.Exists(featurePath))\r\n            {\r\n                throw new InvalidOperationException(\"Unknown feature '\" + featureName + \"'\");\r\n            }\r\n\r\n            var doc = XDocumentUtils.Load(featurePath);\r\n\r\n            return new XhtmlDocument(doc);\r\n        }\r\n\r\n\r\n        private static void EnsureWatcher()\r\n        {\r\n            if (_featureDirectoryFileSystemWatcher==null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_featureDirectoryFileSystemWatcher == null)\r\n                    {\r\n                        string featureDirectoryPath = PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory);\r\n\r\n                        _featureDirectoryFileSystemWatcher = new C1FileSystemWatcher(featureDirectoryPath,\"*\");\r\n\r\n                        _featureDirectoryFileSystemWatcher.Changed += FeatureDirectory_Changed;\r\n                        _featureDirectoryFileSystemWatcher.Created += FeatureDirectory_Changed;\r\n                        _featureDirectoryFileSystemWatcher.Deleted += FeatureDirectory_Changed;\r\n                        _featureDirectoryFileSystemWatcher.Renamed += FeatureDirectory_Changed;\r\n                        _featureDirectoryFileSystemWatcher.EnableRaisingEvents = true;\r\n\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void FeatureDirectory_Changed(object sender, FileSystemEventArgs e)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _featureNamesCache = null;\r\n                _featureCache.Clear();\r\n            }\r\n        }\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Template/TemplateInfo.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web.Hosting;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Streams;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Template\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class TemplateInfo\r\n\t{\r\n        private static readonly Cache<Guid, IXmlPageTemplate> PageTemplateCache = new Cache<Guid, IXmlPageTemplate>(\"Page templates\", 100);\r\n\r\n        /// <exclude />\r\n        static TemplateInfo() {\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IXmlPageTemplate>(PageTemplate_Changed, true);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<IXmlPageTemplate>(PageTemplate_Changed, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IXmlPageTemplate>(PageTemplate_StoreChanged, true);\r\n        }\r\n\r\n\r\n        private static void PageTemplate_StoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n\t    {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                PageTemplateCache.Clear();\r\n            }\r\n\t    }\r\n\r\n        private static void PageTemplate_Changed(object sender, DataEventArgs dataEventArgs)\r\n\t    {\r\n            var pageTemplate = dataEventArgs.Data as IXmlPageTemplate;\r\n            Verify.ArgumentCondition(pageTemplate != null, \"dataEventArgs\", \"Data is null or has an incorrect data type.\");\r\n            PageTemplateCache.Remove(pageTemplate.Id);\r\n\t    }\r\n\r\n\r\n        /// <exclude />\r\n\t    public static TemplatePlaceholdersInfo GetRenderingPlaceHolders(Guid templateId)\r\n        {\r\n            XDocument document = GetTemplateDocument(templateId);\r\n            IEnumerable<XElement> placeHoldersWithId = document.Descendants(RenderingElementNames.PlaceHolder).Where( e=>e.Attribute(RenderingElementNames.PlaceHolderIdAttribute)!=null);\r\n\r\n            TemplatePlaceholdersInfo info = new TemplatePlaceholdersInfo();\r\n\r\n            info.Placeholders = (\r\n                from placeHolder in placeHoldersWithId\r\n                orderby GetPlaceHolderTitle(placeHolder)\r\n                select new KeyValuePair(\r\n                    placeHolder.Attribute(RenderingElementNames.PlaceHolderIdAttribute).Value,\r\n                    GetPlaceHolderTitle(placeHolder))).ToList();\r\n\r\n            XAttribute defaultTrueAttribute = placeHoldersWithId.Attributes(RenderingElementNames.PlaceHolderDefaultAttribute).Where(a => a.Value == \"true\").FirstOrDefault();\r\n\r\n            if (defaultTrueAttribute != null)\r\n            {\r\n                info.DefaultPlaceholderId = defaultTrueAttribute.Parent.Attribute(RenderingElementNames.PlaceHolderIdAttribute).Value;\r\n            }\r\n            else\r\n            {\r\n                if (info.Placeholders.Any())\r\n                {\r\n                    info.DefaultPlaceholderId = info.Placeholders.First().Key;\r\n                }\r\n            }\r\n\r\n            return info;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XDocument GetTemplateDocument(Guid templateId)\r\n        {\r\n            IXmlPageTemplate template = GetTemplate(templateId);\r\n\r\n            var templateWrapper = PageTemplateFileWrapper.Get(template);\r\n            string templateMarkup = templateWrapper.Content;\r\n\r\n            XDocument document;\r\n            try\r\n            {\r\n                document = XDocument.Parse(templateMarkup);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException(\"Failed to parse template markup for file '{0}'\"\r\n                                                    .FormatWith(templateWrapper.RelativeFilePath), ex);\r\n            }\r\n\r\n            return document;\r\n        }\r\n\r\n\r\n\r\n        private static IXmlPageTemplate GetTemplate(Guid templateId)\r\n        {\r\n            IXmlPageTemplate cachedValue = PageTemplateCache.Get(templateId);\r\n\r\n            if(cachedValue != null)\r\n            {\r\n                return cachedValue;\r\n            }\r\n\r\n            var templates =\r\n                from template in DataFacade.GetData<Composite.Data.Types.IXmlPageTemplate>()\r\n                where template.Id == templateId\r\n                select template;\r\n\r\n            IXmlPageTemplate result = templates.FirstOrDefault();\r\n            Verify.That(result != null, \"Failed to get a page template by id. Id = '{0}'\", templateId);\r\n\r\n            PageTemplateCache.Add(templateId, result);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static string GetPlaceHolderTitle(XElement placeHolder)\r\n        {\r\n            XAttribute titleAttribute = placeHolder.Attribute(RenderingElementNames.PlaceHolderTitleAttribute);\r\n\r\n            if (titleAttribute != null)\r\n            {\r\n                return titleAttribute.Value;\r\n            }\r\n            else\r\n            {\r\n                return placeHolder.Attribute(RenderingElementNames.PlaceHolderIdAttribute).Value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// In order to avoid memory leaks we have a separate object that represents loaded file content.\r\n        /// </summary>\r\n        private class PageTemplateFileWrapper\r\n        {\r\n            private readonly string _content;\r\n            private readonly string _pageTemplateFilePath;\r\n            private readonly string _fileFullPath;\r\n\r\n            private static Cache<string, PageTemplateFileWrapper> _cache = new Cache<string, PageTemplateFileWrapper>(\"Page template files\", 100);\r\n\r\n            internal PageTemplateFileWrapper(IXmlPageTemplate pageTemplate)\r\n            {\r\n                _pageTemplateFilePath = pageTemplate.PageTemplateFilePath;\r\n                IFile file = IFileServices.GetFile<IPageTemplateFile>(_pageTemplateFilePath);\r\n                _content = file.ReadAllText();\r\n\r\n                var systemFile = file as FileSystemFileBase;\r\n                Verify.IsNotNull(systemFile, \"File should be of type '{0}'\", typeof(FileSystemFileBase).Name);\r\n\r\n                _fileFullPath = systemFile.SystemPath;\r\n\r\n                file.SubscribeOnChanged(OnFileChanged);\r\n            }\r\n\r\n            public string Content\r\n            {\r\n                get { return _content; }\r\n            }\r\n\r\n            public string RelativeFilePath\r\n            {\r\n                get\r\n                {\r\n                    return _fileFullPath.Substring(HostingEnvironment.ApplicationPhysicalPath.Length - 1);\r\n                }\r\n            }\r\n\r\n            private void OnFileChanged(string filePath, FileChangeType changeType)\r\n            {\r\n                _cache.Remove(_pageTemplateFilePath);\r\n            }\r\n\r\n            public static PageTemplateFileWrapper Get(IXmlPageTemplate pageTemplate)\r\n            {\r\n                PageTemplateFileWrapper result = _cache.Get(pageTemplate.PageTemplateFilePath);\r\n                if(result != null)\r\n                {\r\n                    return result;\r\n                }\r\n\r\n                result = new PageTemplateFileWrapper(pageTemplate);\r\n                _cache.Add(result._pageTemplateFilePath, result);\r\n                return result;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Renderings/Template/TemplatePlaceholdersInfo.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Core.WebClient.Renderings.Template\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class TemplatePlaceholdersInfo\r\n\t{\r\n        /// <exclude />\r\n        public IEnumerable<KeyValuePair> Placeholders { get; set; }\r\n\r\n        /// <exclude />\r\n        public string DefaultPlaceholderId { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/ScriptHandler.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum CompositeScriptMode\r\n    {\r\n        /// <exclude />\r\n        OPERATE = 0,\r\n\r\n        /// <exclude />\r\n        DEVELOP = 1,\r\n\r\n        /// <exclude />\r\n        COMPILE = 2,\r\n    };\r\n\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ScriptHandler\r\n    {\r\n        private static string _compileScriptsFilename = \"CompileScripts.xml\";\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string MergeScripts(string type, IEnumerable<string> scriptFilenames, string folderPath, string targetPath)\r\n        {\r\n            string sourcesFilename = targetPath + \"\\\\\" + type + \"-uncompressed.js\";\r\n\r\n            FileUtils.RemoveReadOnly(sourcesFilename);\r\n\r\n            C1File.WriteAllText(sourcesFilename, string.Empty /* GetTimestampString() */);\r\n\r\n            foreach (string scriptFilename in scriptFilenames)\r\n            {\r\n                string scriptPath = scriptFilename.Replace(\"${root}\", folderPath).Replace(\"/\", \"\\\\\");\r\n\r\n                string lines = C1File.ReadAllText(scriptPath);\r\n\r\n                \r\n                C1File.AppendAllText(sourcesFilename, lines);\r\n                C1File.AppendAllText(sourcesFilename, Environment.NewLine + Environment.NewLine);\r\n            }\r\n\r\n            return sourcesFilename;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string BuildTopLevelClassNames(IEnumerable<string> scriptFilenames, string folderPath, string targetPath)\r\n        {\r\n            var classes = new StringBuilder();\r\n\r\n            classes.AppendLine(\"var topLevelClassNames = [ // Don't edit! This file is automatically generated.\");\r\n\r\n            bool first = true;\r\n            foreach (string scriptFilename in scriptFilenames)\r\n            {\r\n                string scriptPath = scriptFilename.Replace(\"${root}\", folderPath);\r\n                if (scriptPath.IndexOf(\"/scripts/source/page/\") == -1)\r\n                {\r\n                    if (first)\r\n                    {\r\n                        first = false;\r\n                    }\r\n                    else\r\n                    {\r\n                        classes.AppendLine(\",\");\r\n                    }\r\n\r\n                    int _start = scriptPath.LastIndexOf(\"/\") + 1;\r\n                    int _length = scriptPath.LastIndexOf(\".js\") - _start;\r\n\r\n                    string className = scriptPath.Substring(_start, _length);\r\n\r\n                    classes.Append(\"\\t\\\"\" + className + \"\\\"\");\r\n                }\r\n            }\r\n\r\n            classes.AppendLine(\"];\");\r\n\r\n            string classesFilename = targetPath + \"\\\\\" + \"toplevelclassnames.js\";\r\n\r\n            FileUtils.RemoveReadOnly(classesFilename);\r\n\r\n            C1File.WriteAllText(classesFilename, string.Empty /* GetTimestampString() */);\r\n            C1File.AppendAllText(classesFilename, classes.ToString());\r\n\r\n            return classesFilename;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetTopScripts(CompositeScriptMode scriptMode, string folderPath)\r\n        {\r\n            IEnumerable<string> result = GetStrings(\"top\", scriptMode.ToString().ToLower(), folderPath);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetSubScripts(CompositeScriptMode scriptMode, string folderPath)\r\n        {\r\n            IEnumerable<string> result = GetStrings(\"sub\", scriptMode.ToString().ToLower(), folderPath);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<string> GetStrings(string type, string mode, string folderPath)\r\n        {\r\n            string filename = Path.Combine(folderPath, _compileScriptsFilename);\r\n\r\n            XDocument doc = XDocumentUtils.Load(filename);\r\n\r\n            if (mode == \"compile\") mode = \"develop\";\r\n\r\n            XName name = \"name\";\r\n\r\n            XElement topElement = doc.Root.Elements().Single(f => f.Attribute(name).Value == type);\r\n            XElement modeElement = topElement.Elements().Single(f => f.Attribute(name).Value == mode);\r\n\r\n            return\r\n                from e in modeElement.Elements()\r\n                select e.Attribute(\"filename\").Value;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/ScriptLoader.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Diagnostics;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing System.Net.Sockets;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    \r\n    /// <summary>\r\n    /// A common Scriptloader class for Razor and Aspx Pages.\r\n    /// </summary>\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ScriptLoader\r\n    {\r\n        static bool _hasServerToServerConnection;\r\n\r\n        private readonly HttpContext _ctx;        \r\n        private readonly string _type;\r\n        private readonly bool _updateManagerDisabled;\r\n        private readonly CompositeScriptMode _mode;\r\n\r\n        private readonly IEnumerable<string> _defaultscripts;\r\n\r\n\r\n        /// <exclude />\r\n        public ScriptLoader(string type, string directive = null, bool updateManagerDisabled = false)\r\n        {\r\n            _ctx = HttpContext.Current;\r\n            _type = type;\r\n            _updateManagerDisabled = updateManagerDisabled;\r\n\r\n            if (directive == \"compile\")\r\n            {\r\n                _mode = CompositeScriptMode.COMPILE;\r\n            }\r\n            else if (CookieHandler.Get(\"mode\") == \"develop\")\r\n            {\r\n                _mode = CompositeScriptMode.DEVELOP;\r\n            }\r\n            else\r\n            {\r\n                _mode = CompositeScriptMode.OPERATE;\r\n            }\r\n\r\n            string folderPath = Path.Combine(_ctx.Request.PhysicalApplicationPath, \"Composite\");\r\n\r\n            switch (type)\r\n            {\r\n                case \"top\":\r\n                    _defaultscripts = ScriptHandler.GetTopScripts(_mode, folderPath);\r\n\r\n                    break;\r\n                case \"sub\":\r\n                    _defaultscripts = ScriptHandler.GetSubScripts(_mode, folderPath);\r\n                    break;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Create and render the markup for Razor Pages\r\n        /// </summary>\r\n        /// <param name=\"type\"></param>\r\n        /// <param name=\"directive\"></param>\r\n        /// <returns></returns>\r\n        public static string Render(string type , string directive = null)\r\n        {\r\n            return new ScriptLoader(type, directive).Render();\r\n        }\r\n        \r\n\r\n        /// <exclude />\r\n        public string Render()\r\n        {\r\n            var builder = new StringBuilder();\r\n            switch (_mode)\r\n            {\r\n                case CompositeScriptMode.OPERATE:\r\n                case CompositeScriptMode.DEVELOP:\r\n                    RenderMarkup(builder);\r\n                    break;\r\n                case CompositeScriptMode.COMPILE:\r\n                    CompileScript(builder);\r\n                    break;\r\n            }\r\n            return builder.ToString();\r\n        }\r\n\r\n\r\n        #region Private Methods\r\n\r\n        private void CompileScript(StringBuilder writer)\r\n        {\r\n            try\r\n            {\r\n                string folderPath = Path.Combine(_ctx.Request.PhysicalApplicationPath, \"Composite\");\r\n\r\n                string targetPath = folderPath + \"\\\\scripts\\\\compressed\";\r\n\r\n\r\n                ScriptHandler.MergeScripts(_type, _defaultscripts, folderPath, targetPath);\r\n                if (_type == \"top\")\r\n                {\r\n                    ScriptHandler.BuildTopLevelClassNames(_defaultscripts, folderPath, targetPath);\r\n                }\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                Log.LogError(typeof(ScriptLoader).FullName, new InvalidOperationException(\"Failed to compile scripts\", e));\r\n\r\n                writer.Append(\"<p> Failed to compile scripts. Exception text:\");\r\n                writer.Append(HttpUtility.HtmlEncode(e.ToString()));\r\n                writer.Append(\"</p>\");\r\n            }\r\n        }\r\n\r\n\r\n        /**\r\n         * Render markup\r\n         */\r\n        private void RenderMarkup(StringBuilder builder)\r\n        {\r\n            //string thisVirtualFolder = Composite.Core.IO.Path.GetDirectoryName(this.AppRelativeVirtualPath);\r\n            //string parentVirtualFolder = thisVirtualFolder.Substring(0, thisVirtualFolder.LastIndexOf(Composite.Core.IO.Path.DirectorySeparatorChar));\r\n            //string fullPathWindowsStyle = parentVirtualFolder.Replace( \"~\", HttpContext.Current.Request.ApplicationPath );\r\n\r\n            string root = UrlUtils.AdminRootPath;\r\n\r\n            string scriptMarkup = GetScriptMarkup();\r\n\r\n\r\n            foreach (string ss in _defaultscripts)\r\n            {\r\n                string relativeLink = ss.Replace(\"${root}\", root);\r\n\r\n                string filePath = PathUtil.Resolve(ss.Replace(\"${root}\", \"~/Composite\"));\r\n                if (C1File.Exists(filePath))\r\n                {\r\n                    DateTime lastModified = C1File.GetLastWriteTimeUtc(filePath);\r\n                    relativeLink += \"?timestamp=\" + lastModified.GetHashCode();\r\n                }\r\n\r\n                builder.AppendLine(\r\n                    scriptMarkup.Replace(\"${scriptsource}\", relativeLink)\r\n                );\r\n            }\r\n\r\n            if (_type == \"top\")\r\n            {\r\n                // We emit a version number - which we want the client to remember\r\n                _ctx.Response.Cache.SetExpires(DateTime.Now.AddYears(-10));\r\n                _ctx.Response.Cache.SetCacheability(HttpCacheability.Private);\r\n\r\n                var url = _ctx.Request.Url;\r\n                bool isLocalHost = url.Host.ToLowerInvariant() == \"localhost\";\r\n\r\n                _hasServerToServerConnection = HasServerToServerConnection(); \r\n\r\n                builder.AppendLine(@\"<script type=\"\"text/javascript\"\">\");\r\n\r\n                Func<bool, string> toJson = b => b.ToString().ToLowerInvariant();\r\n\r\n                builder.AppendFormat(@\"Application.hasExternalConnection = {0};\", toJson(_hasServerToServerConnection));\r\n                builder.AppendFormat(@\"Application.isDeveloperMode = {0};\", toJson(_mode == CompositeScriptMode.DEVELOP));\r\n                builder.AppendFormat(@\"Application.isLocalHost = {0};\", toJson(isLocalHost));\r\n                builder.AppendFormat(@\"Application.isOnPublicNet = {0};\", toJson(UrlIsOnPublicNet(url)));\r\n\r\n                builder.AppendLine(@\"</script>\");\r\n\r\n\t\t\t}\r\n            else\r\n            {\r\n                if (!_updateManagerDisabled)\r\n                {\r\n                    builder.AppendLine(@\"<script type=\"\"text/javascript\"\">\");\r\n                    builder.AppendLine(@\"UpdateManager.xhtml = null;\");\r\n                    builder.AppendLine(@\"</script>\");\r\n                }\r\n            }\r\n        }\r\n\r\n        \r\n        /// <summary>\r\n        /// When there are lots of scripts around, Mozilla cannot grok the closing \r\n        /// script tag. It throws a \"Error: mismatched tag. Expected: &lt;/head&gt;\". \r\n        /// Explorer, on the other hand, needs the closing script tag.\r\n        /// </summary>\r\n        private string GetScriptMarkup()\r\n        {\r\n            string userAgent = _ctx.Request.UserAgent;\r\n\r\n            if (userAgent != null && userAgent.IndexOf(\"Gecko\", StringComparison.InvariantCulture) > -1)\r\n            {\r\n                return @\"<script type=\"\"application/javascript\"\" src=\"\"${scriptsource}\"\"/>\";\r\n            }\r\n\r\n            return @\"<script type=\"\"text/javascript\"\" src=\"\"${scriptsource}\"\"></script>\";\r\n        }\r\n\r\n        /**\r\n         * Attempt remote connection. We test the connection by \r\n         * looking for the exact document title \"Start\" in the response. \r\n         */\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationManagerClass:DoNotUseConfigurationManagerClass\")]\r\n        private static bool HasServerToServerConnection()\r\n        {\r\n            bool result = false;\r\n            try\r\n            {\r\n                string uri = ConfigurationManager.AppSettings[\"Composite.StartPage.Url\"];\r\n\r\n                if (string.IsNullOrEmpty(uri))\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                XDocument loaded = null;\r\n                Task task = Task.Factory.StartNew(() => loaded = TryLoad(uri));\r\n\r\n                task.Wait(2500);\r\n                if (task.IsCompleted && loaded != null)\r\n                {\r\n                    XElement titleElement = loaded.Descendants(Namespaces.Xhtml + \"title\").FirstOrDefault();\r\n                    result = (titleElement != null && titleElement.Value == \"Start\");\r\n                }\r\n            }\r\n            catch (Exception) { }\r\n            return result;\r\n        }\r\n\r\n\r\n        private bool UrlIsOnPublicNet(Uri currentUri)\r\n        {\r\n            if (currentUri.HostNameType != UriHostNameType.Dns) return false;\r\n\r\n            string hostname = currentUri.Host.ToLowerInvariant();\r\n\r\n            if (hostname.IndexOf('.') == -1) return false;\r\n\r\n            IPHostEntry dnsResult;\r\n            try\r\n            {\r\n                dnsResult = System.Net.Dns.GetHostEntry(hostname);\r\n            }\r\n            catch (SocketException)\r\n            {\r\n                return false;\r\n            }\r\n            \r\n            if (dnsResult.AddressList.Length == 0)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            var address = dnsResult.AddressList.First().MapToIPv6();\r\n            return !address.IsIPv6SiteLocal && !address.IsIPv6LinkLocal;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool UnbundledScriptsAvailable()\r\n        {\r\n            var filePath = HostingEnvironment.MapPath(UrlUtils.AdminRootPath + \"/scripts/source/top/interfaces/IAcceptable.js\");\r\n\r\n            return C1File.Exists(filePath);\r\n        }\r\n\r\n        [DebuggerStepThrough]\r\n        private static XDocument TryLoad(string uri)\r\n        {\r\n            try\r\n            {\r\n                return XDocumentUtils.Load(uri);\r\n            }\r\n            catch\r\n            {\r\n                /* silent */\r\n                return null;\r\n            }\r\n        }\r\n\r\n        #endregion\r\n    }\r\n\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/ActionTypeEnum.cs",
    "content": "namespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public enum ActionType\r\n    {\r\n        /// <exclude />\r\n        OpenView = 0,\r\n\r\n        /// <exclude />\r\n        OpenExternalView = 17,\r\n\r\n        /// <exclude />\r\n        OpenGenericView = 1,\r\n\r\n        /// <exclude />\r\n        OpenViewDefinition = 2,\r\n\r\n        /// <exclude />\r\n        CloseView = 3,\r\n\r\n        /// <exclude />\r\n        DownloadFile = 4,\r\n\r\n        /// <exclude />\r\n        MessageBox = 5,\r\n\r\n        /// <exclude />\r\n        RefreshTree = 6,\r\n\r\n        /// <exclude />\r\n        LogEntry = 7,\r\n\r\n        /// <exclude />\r\n        Reboot = 8,\r\n\r\n        /// <exclude />\r\n        CollapseAndRefresh = 9,\r\n\r\n        /// <exclude />\r\n        CloseAllViews = 10,\r\n\r\n        /// <exclude />\r\n        LockSystem = 11,\r\n\r\n        /// <exclude />\r\n        BroadcastMessage = 12,\r\n\r\n        /// <exclude />\r\n        SaveStatus = 13,\r\n\r\n        /// <exclude />\r\n        BindEntityTokenToView = 14,\r\n\r\n        /// <exclude />\r\n        ExpandTreeNode = 15,\r\n\r\n        /// <exclude />\r\n        SelectElement = 16,\r\n\r\n        /// <exclude />\r\n        OpenSlideView = 18,\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/BindEntityTokenToViewParams.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class BindEntityTokenToViewParams\r\n\t{\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/BroadcastMessageParams.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class BroadcastMessageParams\r\n\t{\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Value { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/CloseAllViewsParams.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class CloseAllViewsParams\r\n\t{\r\n        /// <exclude />\r\n        public string Reason { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/CloseViewParams.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class CloseViewParams\r\n    {\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/ConsoleAction.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ConsoleAction\r\n    {\r\n        /// <exclude />\r\n        public ConsoleAction()\r\n        {\r\n            this.Id = Guid.NewGuid().ToString();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Id { get; set; }\r\n\r\n        /// <exclude />\r\n        public int SequenceNumber { get; set; }\r\n\r\n        /// <exclude />\r\n        public ActionType ActionType { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public OpenViewParams OpenViewParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public OpenGenericViewParams OpenGenericViewParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public OpenExternalViewParams OpenExternalViewParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public OpenSlideViewParams OpenSlideViewParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public DownloadFileParams DownloadFileParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public OpenViewDefinitionParams OpenViewDefinitionParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public CloseViewParams CloseViewParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public RefreshTreeParams RefreshTreeParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public MessageBoxParams MessageBoxParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public LogEntryParams LogEntryParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public BroadcastMessageParams BroadcastMessageParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public CloseAllViewsParams CloseAllViewsParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public SaveStatusParams SaveStatusParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public BindEntityTokenToViewParams BindEntityTokenToViewParams { get; set; }\r\n\r\n        /// <exclude />\r\n        public SelectElementParams SelectElementParams { get; set; }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/ConsoleMessageServiceFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Events.Foundation;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.ResourceSystem.Icons;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class ConsoleMessageServiceFacade\r\n    {\r\n        /// <exclude />\r\n        public static int CurrentChangeNumber\r\n        {\r\n            get { return ConsoleMessageQueueFacade.CurrentChangeNumber; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static GetMessagesResult GetNewMessages(string consoleId, int lastKnownChangeNumber)\r\n        {\r\n            ConsoleFacade.RegisterConsole(UserSettings.Username, consoleId);\r\n\r\n            List<ConsoleAction> newMessages = new List<ConsoleAction>();\r\n\r\n            GetMessagesResult result = new GetMessagesResult();\r\n            result.CurrentSequenceNumber = ConsoleMessageQueueFacade.CurrentChangeNumber;\r\n\r\n            List<ConsoleMessageQueueElement> messageQueueElements = ConsoleMessageQueueFacade.GetQueueElements(lastKnownChangeNumber, consoleId).ToList();\r\n            if (messageQueueElements.Any() && messageQueueElements.Max(f => f.QueueItemNumber) > result.CurrentSequenceNumber)\r\n            {\r\n                result.CurrentSequenceNumber = messageQueueElements.Max(f => f.QueueItemNumber);\r\n            }\r\n\r\n            DocumentSuspectMessageRequests(consoleId, lastKnownChangeNumber, result, messageQueueElements);\r\n\r\n            // Open views...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is OpenViewMessageQueueItem))\r\n            {\r\n                OpenViewMessageQueueItem openViewItem = (OpenViewMessageQueueItem)queueElement.QueueItem;\r\n\r\n                List<KeyValuePair> arguments = new List<KeyValuePair>();\r\n                if (openViewItem.UrlPostArguments != null)\r\n                {\r\n                    foreach (var entry in openViewItem.UrlPostArguments)\r\n                    {\r\n                        arguments.Add(new KeyValuePair(entry.Key, entry.Value));\r\n                    }\r\n                }\r\n\r\n                OpenViewParams openViewParams = new OpenViewParams\r\n                {\r\n                    Url = openViewItem.Url,\r\n                    Argument = arguments,\r\n                    EntityToken = openViewItem.EntityToken,\r\n                    FlowHandle = openViewItem.FlowHandle,\r\n                    ViewId = openViewItem.ViewId,\r\n                    ViewType = openViewItem.ViewType.AsConsoleType(),\r\n                    Label = openViewItem.Label,\r\n                    ToolTip = openViewItem.ToolTip ?? openViewItem.Label\r\n                };\r\n\r\n                openViewParams.Image = GetImage(openViewItem.IconResourceHandle);\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.OpenView,\r\n                    OpenViewParams = openViewParams\r\n                });\r\n            }\r\n\r\n\r\n            // Open view definitions...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is OpenHandledViewMessageQueueItem))\r\n            {\r\n                OpenHandledViewMessageQueueItem openViewDefItem = (OpenHandledViewMessageQueueItem)queueElement.QueueItem;\r\n\r\n                List<KeyValuePair> arguments = new List<KeyValuePair>();\r\n                foreach (var entry in openViewDefItem.Arguments)\r\n                {\r\n                    arguments.Add(new KeyValuePair(entry.Key, entry.Value));\r\n                }\r\n\r\n                OpenViewDefinitionParams openViewDefParams = new OpenViewDefinitionParams\r\n                {\r\n                    ViewId = openViewDefItem.Handle + Guid.NewGuid().ToString(),\r\n                    EntityToken = openViewDefItem.EntityToken,\r\n                    Handle = openViewDefItem.Handle,\r\n                    Argument = arguments\r\n                };\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.OpenViewDefinition,\r\n                    OpenViewDefinitionParams = openViewDefParams\r\n                });\r\n            }\r\n\r\n\r\n            // Open generic views...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is OpenGenericViewQueueItem))\r\n            {\r\n                OpenGenericViewQueueItem openGenericView = (OpenGenericViewQueueItem)queueElement.QueueItem;\r\n\r\n                List<KeyValuePair> arguments = new List<KeyValuePair>();\r\n                foreach (var entry in openGenericView.UrlPostArguments)\r\n                {\r\n                    arguments.Add(new KeyValuePair(entry.Key, entry.Value));\r\n                }\r\n\r\n                OpenGenericViewParams openGenericViewParams = new OpenGenericViewParams\r\n                {\r\n                    ViewId = openGenericView.ViewId,\r\n                    EntityToken = openGenericView.EntityToken,\r\n                    Label = openGenericView.Label,\r\n                    ToolTip = openGenericView.ToolTip ?? openGenericView.Label,\r\n                    Url = openGenericView.Url,\r\n                    UrlPostArguments = arguments\r\n                };\r\n\r\n                openGenericViewParams.Image = GetImage(openGenericView.IconResourceHandle);\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.OpenGenericView,\r\n                    OpenGenericViewParams = openGenericViewParams\r\n                });\r\n            }\r\n\r\n            // Open external views...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is OpenExternalViewQueueItem))\r\n            {\r\n                var openExternalView = (OpenExternalViewQueueItem)queueElement.QueueItem;\r\n\r\n                var arguments = new List<KeyValuePair>();\r\n                foreach (var entry in openExternalView.UrlPostArguments)\r\n                {\r\n                    arguments.Add(new KeyValuePair(entry.Key, entry.Value));\r\n                }\r\n\r\n                var openExternalViewParams = new OpenExternalViewParams\r\n                {\r\n                    ViewId = openExternalView.ViewId,\r\n                    EntityToken = openExternalView.EntityToken,\r\n                    Label = openExternalView.Label,\r\n                    ToolTip = openExternalView.ToolTip ?? openExternalView.Label,\r\n                    ViewType = openExternalView.ViewType,\r\n                    Url = openExternalView.Url,\r\n                    UrlPostArguments = arguments\r\n                };\r\n\r\n                openExternalViewParams.Image = GetImage(openExternalView.IconResourceHandle);\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.OpenExternalView,\r\n                    OpenExternalViewParams = openExternalViewParams\r\n                });\r\n            }\r\n\r\n            // Open slide views...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is OpenSlideViewQueueItem))\r\n            {\r\n                var openSlideView = (OpenSlideViewQueueItem)queueElement.QueueItem;\r\n\r\n                var openSlideViewParams = new OpenSlideViewParams\r\n                {\r\n                    ViewId = openSlideView.ViewId,\r\n                    EntityToken = openSlideView.EntityToken,\r\n                    Url = openSlideView.Url\r\n                };\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.OpenSlideView,\r\n                    OpenSlideViewParams = openSlideViewParams\r\n                });\r\n            }\r\n\r\n\r\n            // Download files...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is DownloadFileMessageQueueItem))\r\n            {\r\n                DownloadFileMessageQueueItem downloadFileItem = (DownloadFileMessageQueueItem)queueElement.QueueItem;\r\n\r\n                DownloadFileParams downloadFileParams = new DownloadFileParams\r\n                {\r\n                    Url = downloadFileItem.Url,\r\n                };\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.DownloadFile,\r\n                    DownloadFileParams = downloadFileParams\r\n                });\r\n            }\r\n\r\n\r\n            // Close views...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is CloseViewMessageQueueItem))\r\n            {\r\n                CloseViewMessageQueueItem closeViewItem = (CloseViewMessageQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.CloseView,\r\n                    CloseViewParams = new CloseViewParams\r\n                     {\r\n                         ViewId = closeViewItem.ViewId\r\n                     }\r\n                });\r\n            }\r\n\r\n\r\n            // Refresh tree... Ignoring requests for the same entity tokens\r\n            var entityTokensToRefresh = new HashSet<string>();\r\n            var refreshMessages = new List<ConsoleAction>();\r\n\r\n            foreach (var queueElement in messageQueueElements.Where(f => f.QueueItem is RefreshTreeMessageQueueItem)\r\n                .OrderByDescending(f => f.QueueItemNumber))\r\n            {\r\n                var refreshTreeItem = (RefreshTreeMessageQueueItem)queueElement.QueueItem;\r\n\r\n                string serializedEntityToken = EntityTokenSerializer.Serialize(refreshTreeItem.EntityToken, true);\r\n                if (entityTokensToRefresh.Contains(serializedEntityToken))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                entityTokensToRefresh.Add(serializedEntityToken);\r\n\r\n                refreshMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.RefreshTree,\r\n                    RefreshTreeParams = new RefreshTreeParams\r\n                     {\r\n                         EntityToken = serializedEntityToken,\r\n                     }\r\n                });\r\n            }\r\n\r\n            refreshMessages.Reverse();\r\n            newMessages.AddRange(refreshMessages);\r\n\r\n            // Send message boxes...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is MessageBoxMessageQueueItem))\r\n            {\r\n                MessageBoxMessageQueueItem messageBoxItem = (MessageBoxMessageQueueItem)queueElement.QueueItem;\r\n\r\n                DialogType clientDialogType = DialogType.Message;\r\n\r\n                switch (messageBoxItem.DialogType)\r\n                {\r\n                    case Composite.C1Console.Events.DialogType.Message:\r\n                        clientDialogType = DialogType.Message;\r\n                        break;\r\n                    case Composite.C1Console.Events.DialogType.Question:\r\n                        clientDialogType = DialogType.Question;\r\n                        break;\r\n                    case Composite.C1Console.Events.DialogType.Warning:\r\n                        clientDialogType = DialogType.Warning;\r\n                        break;\r\n                    case Composite.C1Console.Events.DialogType.Error:\r\n                        clientDialogType = DialogType.Error;\r\n                        break;\r\n                    default:\r\n                        clientDialogType = DialogType.Message;\r\n                        break;\r\n                }\r\n\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                                {\r\n                                    SequenceNumber = queueElement.QueueItemNumber,\r\n                                    ActionType = ActionType.MessageBox,\r\n                                    MessageBoxParams = new MessageBoxParams\r\n                                                     {\r\n                                                         DialogType = clientDialogType,\r\n                                                         Title = messageBoxItem.Title,\r\n                                                         Message = messageBoxItem.Message\r\n                                                     }\r\n                                });\r\n            }\r\n\r\n\r\n            // Send log entries...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is LogEntryMessageQueueItem))\r\n            {\r\n                var logEntryItem = (LogEntryMessageQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                                {\r\n                                    SequenceNumber = queueElement.QueueItemNumber,\r\n                                    ActionType = ActionType.LogEntry,\r\n                                    LogEntryParams = new LogEntryParams\r\n                                                     {\r\n                                                         SenderId = logEntryItem.Sender.Name,\r\n                                                         Level = logEntryItem.Level.AsConsoleType(),\r\n                                                         Message = logEntryItem.Message\r\n\r\n                                                     }\r\n                                });\r\n            }\r\n\r\n\r\n            // Restart console application (like culture change)...\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is RebootConsoleMessageQueueItem))\r\n            {\r\n                var rebootConsoleItem = (RebootConsoleMessageQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.Reboot\r\n                });\r\n            }\r\n\r\n\r\n            // Collaps the tree and refresh\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is CollapseAndRefreshConsoleMessageQueueItem))\r\n            {\r\n                var collapseAndRefreshConsoleMessageQueueItem = (CollapseAndRefreshConsoleMessageQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.CollapseAndRefresh\r\n                });\r\n            }\r\n\r\n\r\n            // Close all open views\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is CloseAllViewsMessageQueueItem))\r\n            {\r\n                var closeAllViewsMessageQueueItem = (CloseAllViewsMessageQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.CloseAllViews,\r\n                    CloseAllViewsParams = new CloseAllViewsParams { Reason = closeAllViewsMessageQueueItem.Reason }\r\n                });\r\n            }\r\n\r\n\r\n            // Lock the console application\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is LockSystemConsoleMessageQueueItem))\r\n            {\r\n                var lockSystemConsoleMessageQueueItem = (LockSystemConsoleMessageQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.LockSystem\r\n                });\r\n            }\r\n\r\n\r\n            // Lock the console application\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is BroadcastMessageQueueItem))\r\n            {\r\n                var broadcastMessageQueueItem = (BroadcastMessageQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.BroadcastMessage,\r\n                    BroadcastMessageParams = new BroadcastMessageParams\r\n                    {\r\n                        Name = broadcastMessageQueueItem.Name,\r\n                        Value = broadcastMessageQueueItem.Value\r\n                    }\r\n                });\r\n            }\r\n\r\n\r\n            // SaveStatus\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is SaveStatusConsoleMessageQueueItem))\r\n            {\r\n                var saveStatusConsoleMessageQueueItem = (SaveStatusConsoleMessageQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.SaveStatus,\r\n                    SaveStatusParams = new SaveStatusParams { ViewId = saveStatusConsoleMessageQueueItem.ViewId, Succeeded = saveStatusConsoleMessageQueueItem.Succeeded }\r\n                });\r\n            }\r\n\r\n            // BindEntityToken\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is BindEntityTokenToViewQueueItem))\r\n            {\r\n                var bindEntityTokenToViewQueueItem = (BindEntityTokenToViewQueueItem)queueElement.QueueItem;\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.BindEntityTokenToView,\r\n                    BindEntityTokenToViewParams = new BindEntityTokenToViewParams { ViewId = bindEntityTokenToViewQueueItem.ViewId, EntityToken = bindEntityTokenToViewQueueItem.EntityToken }\r\n                });\r\n            }\r\n\r\n            // BindEntityToken\r\n            foreach (ConsoleMessageQueueElement queueElement in messageQueueElements.Where(f => f.QueueItem is SelectElementQueueItem))\r\n            {\r\n                var selectElementQueueItem = (SelectElementQueueItem)queueElement.QueueItem;\r\n\r\n                newMessages.Add(new ConsoleAction\r\n                {\r\n                    SequenceNumber = queueElement.QueueItemNumber,\r\n                    ActionType = ActionType.SelectElement,\r\n                    SelectElementParams = new SelectElementParams\r\n                    {\r\n                        EntityToken = selectElementQueueItem.EntityToken,\r\n                        PerspectiveElementKey = selectElementQueueItem.PerspectiveElementKey\r\n                    }\r\n                });\r\n            }\r\n\r\n            result.ConsoleActions = newMessages.OrderBy(f => f.SequenceNumber).ToList();\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// If the client feeding from the queue goes haywire, we start to log details about it for debug purposes.\r\n        /// </summary>\r\n        private static void DocumentSuspectMessageRequests(string consoleId, int lastKnownChangeNumber, GetMessagesResult result, List<ConsoleMessageQueueElement> messageQueueElements)\r\n        {\r\n            int maxSecondsExpected = 60;\r\n\r\n            if (lastKnownChangeNumber > result.CurrentSequenceNumber)\r\n            {\r\n                LoggingService.LogInformation(\"ConsoleMessageServiceFacade\", string.Format(\"Console '{0}' has a last known change numer of {1}, but server current number is {2}.\", consoleId, lastKnownChangeNumber, result.CurrentSequenceNumber));\r\n            }\r\n\r\n            if (messageQueueElements.Any() && DateTime.Now.Subtract(messageQueueElements.Min(f => f.EnqueueTime)).TotalSeconds > maxSecondsExpected)\r\n            {\r\n                ConsoleMessageQueueFacade.DoDebugSerializationToFileSystem();\r\n                LoggingService.LogWarning(\"ConsoleMessageServiceFacade\", string.Format(\"Console '{0}' are requesting messages that are more than {1} seconds old. Console has last known change number {2}, server is now at {3}. Debug XML dump saved at '{4}'.\", consoleId, maxSecondsExpected, lastKnownChangeNumber, result.CurrentSequenceNumber, GlobalSettingsFacade.TempDirectory));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static string GetImage(ResourceHandle resourceHandle)\r\n        {\r\n            if (resourceHandle == null) return null;\r\n\r\n\t\t    return string.Format(\"${{icon:{0}:{1}}}\",\r\n\t\t\t        resourceHandle.ResourceNamespace, resourceHandle.ResourceName);\r\n\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/DialogTypeEnum.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum DialogType\r\n    {\r\n        /// <exclude />\r\n        Message,\r\n\r\n        /// <exclude />\r\n        Question,\r\n\r\n        /// <exclude />\r\n        Warning,\r\n\r\n        /// <exclude />\r\n        Error\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/DownloadFileParams.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class DownloadFileParams\r\n    {\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/GetMessagesResult.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class GetMessagesResult\r\n    {\r\n        /// <exclude />\r\n        public int CurrentSequenceNumber { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<ConsoleAction> ConsoleActions { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/LogEntryParams.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class LogEntryParams\r\n    {\r\n        /// <exclude />\r\n        public string SenderId { get; set; }\r\n        \r\n        /// <exclude />\r\n        public LogLevel Level { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Message { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/LogLevelEnum.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum LogLevel\r\n    {\r\n        /// <exclude />\r\n        Fine,\r\n\r\n        /// <exclude />\r\n        Info,\r\n\r\n        /// <exclude />\r\n        Debug,\r\n\r\n        /// <exclude />\r\n        Warn,\r\n\r\n        /// <exclude />\r\n        Error,\r\n\r\n        /// <exclude />\r\n        Fatal\r\n    }\r\n\r\n\r\n    internal static class InternalLogLevelConvertExtensions\r\n    {\r\n        internal static LogLevel AsConsoleType(this Composite.Core.Logging.LogLevel internalLogLevel)\r\n        {\r\n            switch (internalLogLevel)\r\n            {\r\n                case Composite.Core.Logging.LogLevel.Info:\r\n                    return LogLevel.Info;\r\n                case Composite.Core.Logging.LogLevel.Debug:\r\n                    return LogLevel.Debug;\r\n                case Composite.Core.Logging.LogLevel.Fine:\r\n                    return LogLevel.Fine;\r\n                case Composite.Core.Logging.LogLevel.Warning:\r\n                    return LogLevel.Warn;\r\n                case Composite.Core.Logging.LogLevel.Error:\r\n                    return LogLevel.Error;\r\n                case Composite.Core.Logging.LogLevel.Fatal:\r\n                    return LogLevel.Fatal;\r\n                default:\r\n                    throw new ArgumentException(\"Unknown Composite.Core.Logging.LogLevel \" + internalLogLevel.ToString());\r\n            }\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/MessageBoxParams.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class MessageBoxParams\r\n    {\r\n        /// <exclude />\r\n        public string Title { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Message { get; set; }\r\n\r\n        /// <exclude />\r\n        public DialogType DialogType { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/OpenExternalViewParams.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class OpenExternalViewParams\r\n    {\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n        /// <exclude />\r\n        public string ToolTip { get; set; }\r\n        /// <exclude />\r\n        public string Image { get; set; }\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n        /// <exclude />\r\n        public string ViewType { get; set; }\r\n        /// <exclude />\r\n        public List<KeyValuePair> UrlPostArguments { get; set; }          \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/OpenGenericViewParams.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class OpenGenericViewParams\r\n    {\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ToolTip { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Image { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<KeyValuePair> UrlPostArguments { get; set; }          \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/OpenSlideViewParams.cs",
    "content": "using System.Collections.Generic;\nusing Composite.Core.Types;\n\n\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\n{\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n    public class OpenSlideViewParams\n    {\n        /// <exclude />\n        public string ViewId { get; set; }\n        /// <exclude />\n        public string EntityToken { get; set; }\n        /// <exclude />\n        public string Url { get; set; }\n    }\n}\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/OpenViewDefinitionParams.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class OpenViewDefinitionParams\r\n    {\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Handle { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<KeyValuePair> Argument { get; set; }  \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/OpenViewParams.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class OpenViewParams\r\n    {\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FlowHandle { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Handle { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<KeyValuePair> Argument { get; set; }\r\n\r\n        /// <exclude />\r\n        public ViewType ViewType { get; set; }\r\n\r\n        /// <summary>\r\n        /// Label for view\r\n        /// </summary>\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// Icon URL\r\n        /// </summary>\r\n        public string Image { get; set; }\r\n\r\n        /// <summary>\r\n        /// Tooltip for view tab\r\n        /// </summary>\r\n        public string ToolTip { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/RefreshTreeParams.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class RefreshTreeParams\r\n    {\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/SaveStatusParams.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class SaveStatusParams\r\n    {\r\n        /// <exclude />\r\n        public string ViewId { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool Succeeded { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/SelectElementParams.cs",
    "content": "﻿\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class SelectElementParams\r\n    {\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string PerspectiveElementKey { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/ConsoleMessageService/ViewTypeEnum.cs",
    "content": "using System;\r\n\r\nnamespace Composite.Core.WebClient.Services.ConsoleMessageService\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public enum ViewType\r\n    {\r\n        /// <exclude />\r\n        External = 6,\r\n\r\n        /// <exclude />\r\n        Main = 0,\r\n\r\n        /// <exclude />\r\n        ModalDialog = 1,\r\n\r\n        /// <exclude />\r\n        RightTop = 2,\r\n\r\n        /// <exclude />\r\n        RightBottom = 3,\r\n\r\n        /// <exclude />\r\n        BottomLeft = 4,\r\n\r\n        /// <exclude />\r\n        BottomRight = 5\r\n    }\r\n\r\n    internal static class InternalViewTypeConvertExtensions\r\n    {\r\n        internal static ViewType AsConsoleType( this Composite.C1Console.Events.ViewType internalViewType )\r\n        {\r\n            switch (internalViewType)\r\n            {\r\n                case Composite.C1Console.Events.ViewType.External:\r\n                    return ViewType.External;\r\n                case Composite.C1Console.Events.ViewType.Main:\r\n                    return ViewType.Main;\r\n                case Composite.C1Console.Events.ViewType.ModalDialog:\r\n                    return ViewType.ModalDialog;\r\n                case Composite.C1Console.Events.ViewType.RightTop:\r\n                    return ViewType.RightTop;\r\n                case Composite.C1Console.Events.ViewType.RightBottom:\r\n                    return ViewType.RightBottom;\r\n                case Composite.C1Console.Events.ViewType.BottomLeft:\r\n                    return ViewType.BottomLeft;\r\n                case Composite.C1Console.Events.ViewType.BottomRight:\r\n                    return ViewType.BottomRight;\r\n                default:\r\n                    throw new ArgumentException( \"Unknown Composite.C1Console.Events.ViewType \" + internalViewType.ToString() );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/LocalizationServiceObjects/ClientLocale.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.LocalizationServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ClientLocale\r\n    {\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public string IsoName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string UrlMappingName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string SerializedActionToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsCurrent { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/LocalizationServiceObjects/ClientLocales.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.LocalizationServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class ClientLocales\r\n\t{\r\n        /// <exclude />\r\n        public string ActiveLocaleName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ForeignLocaleName { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/LocalizationServiceObjects/PageLocale.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.LocalizationServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"Culture = {Name}, IsCurrent = {IsCurrent}, Url = {Url}\")]\r\n\tpublic sealed class PageLocale\r\n\t{\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public string IsoName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string UrlMappingName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsCurrent { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/SecurityServiceObjets/EntityPermissionDetails.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.SecurityServiceObjets\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class EntityPermissionDetails\r\n\t{\r\n        /// <exclude />\r\n        public List<UserPermissions> InheritedUserPermissions { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<UserPermissions> EntityUserPermissions { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/SecurityServiceObjets/UserPermissions.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.SecurityServiceObjets\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class UserPermissions\r\n\t{\r\n        /// <exclude />\r\n        public string UserName { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<string> PermissionTypes { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ClientAction.cs",
    "content": "using Composite.Core.ResourceSystem;\r\nusing System;\r\nusing Composite.C1Console.Elements;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ClientAction\r\n    {\r\n        /// <exclude />\r\n        public string ActionToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ToolTip { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool Disabled { get; set; }\r\n\r\n        /// <exclude />\r\n        public ResourceHandle Icon { get; set; }\r\n\r\n        /// <exclude />\r\n        public ClientActionCategory ActionCategory { get; set; }\r\n\r\n        /// <exclude />\r\n        public string CheckboxStatus { get; set; }\r\n\r\n        /// <exclude />\r\n        public string TagValue { get; set; }\r\n\r\n        /// <exclude />\r\n        public int ActivePositions { get; set; }\r\n\r\n        /// <exclude />\r\n        public DialogStrings BulkExecutionDialog { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ActionKey \r\n        {\r\n            get\r\n            {\r\n                string secondaryValuesMashup = string.Format(\"{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}\",\r\n                    this.Label,\r\n                    this.ToolTip,\r\n                    this.Disabled,\r\n                    this.Icon.ResourceName,\r\n                    this.Icon.ResourceNamespace,\r\n                    this.ActionCategory.FolderName,\r\n                    this.ActionCategory.GroupId,\r\n                    this.ActionCategory.IsInFolder,\r\n                    this.ActionCategory.IsInToolbar,\r\n                    this.ActionCategory.Name,\r\n                    this.CheckboxStatus);\r\n\r\n                return (this.ActionToken + this.Label).GetHashCode() + \"::\" + secondaryValuesMashup.GetHashCode();\r\n            }\r\n            set\r\n            {\r\n            \t// now being returned from client via SOAP!\r\n            \t// throw new InvalidOperationException(\"This can not be set\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ClientActionCategory.cs",
    "content": "namespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ClientActionCategory\r\n    {\r\n        /// <exclude />\r\n        public string GroupId { get; set; }\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic string GroupName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsInToolbar { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsInFolder { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FolderName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ActionBundle { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ClientBrowserViewSettings.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects\n{\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n    public class ClientBrowserViewSettings\n    {\n        /// <summary>\n        /// Url to load in browser\n        /// </summary>\n        public string Url { get; set; }\n\n        /// <summary>\n        /// True if tooling (view, SEO tools etc) should be active for URL\n        /// </summary>\n        public bool ToolingOn { get; set; }\n    }\n}\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ClientElement.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"ClientElement: '{Label}'\")]\r\n    public sealed class ClientElement\r\n    {\r\n        /// <exclude />\r\n        public string ElementKey { get; set; }  // CORE\r\n\r\n        /// <exclude />\r\n        public string ProviderName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Piggybag { get; set; }\r\n\r\n        /// <exclude />\r\n        public string PiggybagHash { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }  // CORE\r\n\r\n        /// <exclude />\r\n        public string ToolTip { get; set; }  // CORE\r\n\r\n        /// <exclude />\r\n        public bool HasChildren { get; set; }  // CORE\r\n\r\n        /// <exclude />\r\n        public bool IsDisabled { get; set; }  // CORE\r\n\r\n        /// <exclude />\r\n        public ResourceHandle Icon { get; set; }  // CORE\r\n\r\n        /// <exclude />\r\n        public ResourceHandle OpenedIcon { get; set; }   // CORE       \r\n\r\n        /// <exclude />\r\n        public List<ClientAction> Actions { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<string> ActionKeys { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<KeyValuePair> PropertyBag { get; set; }  // CORE\r\n\r\n        /// <exclude />\r\n        public List<string> DropTypeAccept { get; set; }\r\n        \r\n        /// <exclude />\r\n        public bool DetailedDropSupported { get; set; }\r\n\r\n        /// <exclude />\r\n        public string DragType { get; set; }\r\n\r\n        /// <exclude />\r\n        public string TagValue { get; set; } // CORE\r\n\r\n        /// <exclude />\r\n        public bool ContainsTaggedActions { get; set; } // CORE\r\n\r\n        /// <summary>\r\n        /// When client is searching through elements to find the element with the given entity token, \r\n        /// the client should disregard elements with TreeLockEnabled == <value>true</value> and continue searching.\r\n        /// </summary>\r\n        public bool TreeLockEnabled { get; set; }\r\n\r\n        /// <summary>\r\n        /// Having a common ElementBundle across elements will make the client bundle them up as a single node, and allow the user to select a specific element via a drop down, showing individual BundleElementName values\r\n        /// </summary>\r\n        public string ElementBundle { get; set; }\r\n\r\n        /// <summary>\r\n        /// When bundling elements this field is used to identify this specific element for selection\r\n        /// </summary>\r\n        public string BundleElementName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ClientElementChangeDescriptor.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\n\r\n// Describes a set of changed elements by listing their ElementHandles\r\n// The latest sequence change number is returned as well.\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    internal class ClientElementChangeDescriptor\r\n    {\r\n        public ClientElementChangeDescriptor()\r\n        {\r\n            this.ElementHandles = new List<string>();\r\n        }\r\n\r\n        /// <summary>\r\n        /// The client should use the \"current sequence number\" the next time it queries for changes\r\n        /// </summary>\r\n        public int CurrentSequenceNumber { get; set; }\r\n        public List<string> ElementHandles { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ClientLabeledProperty.cs",
    "content": "﻿\r\nusing Composite.C1Console.Elements;\r\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class ClientLabeledProperty\r\n\t{\r\n        /// <exclude />\r\n        public ClientLabeledProperty()\r\n        { }\r\n\r\n        /// <exclude />\r\n        public ClientLabeledProperty(LabeledProperty labeledProperty)\r\n        {\r\n            this.Name = labeledProperty.Name;\r\n            this.Label = labeledProperty.Label;\r\n            this.Value = labeledProperty.Value;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The name of the property. The name is constant across cultures and is intended as an id other systems can use.\r\n        /// </summary>\r\n        public string Name { get; set; }\r\n\r\n        /// <summary>\r\n        /// The label the user should see.\r\n        /// </summary>\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// The value of the property\r\n        /// </summary>\r\n        public string Value { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ClientProviderNameEntityTokenClientElementsTriple.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    internal sealed class ClientProviderNameEntityTokenClientElementsTriple\r\n\t{        \r\n        public string ProviderName { get; set; }\r\n        public string EntityToken { get; set; }  \r\n        public List<ClientElement> ClientElements { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ClientProviderNameEntityTokenPair.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    internal sealed class ClientProviderNameEntityTokenPair\r\n\t{        \r\n        public string ProviderName { get; set; }\r\n        public string EntityToken { get; set; }  \r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ExtensionMethods/ElementActionExtensionMethods.cs",
    "content": "using System.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing System;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects.ExtensionMethods\r\n{\r\n    internal static class ElementActionExtensionMethods\r\n    {\r\n        public static List<ClientAction> ToClientActionList(this IEnumerable<ElementAction> actions)\r\n        {\r\n            var clientActions =\r\n                from action in actions\r\n                let visualData = action.VisualData\r\n                let actionLocation = visualData.ActionLocation\r\n                orderby actionLocation.ActionGroup.Priority, actionLocation.ActionGroup.Name, actionLocation.ActionType\r\n                select new ClientAction\r\n                      {\r\n                          ActionToken = ActionTokenSerializer.Serialize(action.ActionHandle.ActionToken, true),\r\n                          Label = visualData.Label,\r\n                          ToolTip = visualData.ToolTip,\r\n                          Disabled = visualData.Disabled,\r\n                          Icon = visualData.Icon,\r\n                          BulkExecutionDialog = visualData.BulkExecutionDialog,\r\n                          CheckboxStatus = GetCheckboxStatusString(visualData.ActionCheckedStatus),\r\n                          ActivePositions = (int)visualData.ActivePositions,\r\n                          TagValue = action.TagValue,\r\n                          ActionCategory = new ClientActionCategory\r\n                               {\r\n                                   GroupId = CalculateActionCategoryGroupId(actionLocation.ActionGroup),\r\n                                   GroupName = actionLocation.ActionGroup.Name,\r\n                                   Name = actionLocation.ActionType.ToString(),\r\n                                   IsInFolder = actionLocation.IsInFolder,\r\n                                   IsInToolbar = actionLocation.IsInToolbar,\r\n                                   FolderName = actionLocation.FolderName,\r\n                                   ActionBundle = actionLocation.ActionBundle\r\n                          }\r\n                      };\r\n\r\n            return clientActions.ToList();\r\n        }\r\n\r\n\r\n        private static string GetCheckboxStatusString(ActionCheckedStatus actionCheckedStatus)\r\n        {\r\n            switch (actionCheckedStatus)\r\n            {\r\n                case ActionCheckedStatus.Uncheckable:\r\n                    return null;\r\n                case ActionCheckedStatus.Unchecked:\r\n                    return \"Unchecked\";\r\n                case ActionCheckedStatus.Checked:\r\n                    return \"Checked\";\r\n                default:\r\n                    throw new InvalidOperationException(\"Unexpected ActionCheckedStatus value\");\r\n            }\r\n        }\r\n\r\n        private static string CalculateActionCategoryGroupId(ActionGroup actionGroup)\r\n        {\r\n            return \"Key\" + (actionGroup.Priority + actionGroup.Name).GetHashCode();\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/ExtensionMethods/ElementExtensionMethods.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects.ExtensionMethods\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ElementExtensionMethods\r\n    {\r\n        /// <exclude />\r\n        public static ClientElement GetClientElement(this Element element)\r\n        {\r\n            if (element.VisualData.Icon == null || element.Actions.Any(a => a.VisualData?.Icon == null))\r\n            {\r\n                throw new InvalidOperationException($\"Unable to create ClientElement from Element with entity token '{element.ElementHandle.EntityToken.Serialize()}'. The element or one of its actions is missing an icon definition.\");\r\n            }\r\n\r\n            string entityToken = EntityTokenSerializer.Serialize(element.ElementHandle.EntityToken, true);\r\n\r\n            string piggyBag = element.ElementHandle.SerializedPiggyback;\r\n            \r\n            var clientElement = new ClientElement\r\n                   {\r\n                       ElementKey = $\"{element.ElementHandle.ProviderName}{entityToken}{piggyBag}\", \r\n                       ProviderName = element.ElementHandle.ProviderName,\r\n                       EntityToken = entityToken,\r\n                       Piggybag = piggyBag,\r\n                       PiggybagHash = HashSigner.GetSignedHash(piggyBag).Serialize(),\r\n                       Label = element.VisualData.Label,\r\n                       HasChildren = element.VisualData.HasChildren,\r\n                       IsDisabled = element.VisualData.IsDisabled,\r\n                       Icon = element.VisualData.Icon,\r\n                       OpenedIcon = element.VisualData.OpenedIcon,\r\n                       ToolTip = element.VisualData.ToolTip,\r\n                       Actions = element.Actions.ToClientActionList(),\r\n                       PropertyBag = element.PropertyBag.ToClientPropertyBag(),\r\n                       TagValue = element.TagValue,\r\n                       ContainsTaggedActions = element.Actions.Any(f => f.TagValue != null),\r\n                       TreeLockEnabled = element.TreeLockBehavior == TreeLockBehavior.Normal,\r\n                       ElementBundle = element.VisualData.ElementBundle,\r\n                       BundleElementName = element.VisualData.BundleElementName\r\n                   };\r\n\r\n            clientElement.ActionKeys =\r\n                (from clientAction in clientElement.Actions\r\n                 select clientAction.ActionKey).ToList();\r\n\r\n            if (element.MovabilityInfo.DragType != null) clientElement.DragType = element.MovabilityInfo.GetHashedTypeIdentifier();\r\n\r\n            List<string> apoptables = element.MovabilityInfo.GetDropHashTypeIdentifiers();\r\n            if (apoptables != null && apoptables.Count > 0)\r\n            {\r\n                clientElement.DropTypeAccept = apoptables;\r\n            }\r\n\r\n            clientElement.DetailedDropSupported = element.MovabilityInfo.SupportsIndexedPosition;\r\n\r\n            return clientElement;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<ClientElement> ToClientElementList(this List<Element> elements)\r\n        {\r\n            var list = new List<ClientElement>(elements.Count);\r\n            list.AddRange(elements.Select(element => element.GetClientElement()));\r\n\r\n            return list;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<KeyValuePair> ToClientPropertyBag(this Dictionary<string, string> propertyBag)\r\n        {\r\n            if (propertyBag == null || propertyBag.Count == 0) return null;\r\n\r\n            return propertyBag.Select(kvp => new KeyValuePair(kvp.Key, kvp.Value)).ToList();\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/RefreshChildrenInfo.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class RefreshChildrenInfo\r\n\t{\r\n        /// <exclude />\r\n        public string ElementKey { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<ClientElement> ClientElements { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/TreeServiceObjects/RefreshChildrenParams.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.TreeServiceObjects\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class RefreshChildrenParams\r\n\t{\r\n        /// <exclude />\r\n        public string ProviderName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string EntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Piggybag { get; set; }\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic string SearchToken { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/IRpcService.cs",
    "content": "﻿namespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    /// <summary>\r\n    /// This class should be implemented when a callee is going to be registered on Wamp Router\r\n    /// </summary>\r\n    public interface IRpcService\r\n    {\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/IWampEventHandler.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    /// <summary>\r\n    /// This class should be implemented when a publisher is going to be registered on Wamp Router\r\n    /// </summary>\r\n    /// <typeparam name=\"TObservable\"></typeparam>\r\n    /// <typeparam name=\"TResult\"></typeparam>\r\n    public interface IWampEventHandler<out TObservable,out TResult>\r\n    {\r\n        /// <summary>\r\n        /// Topic uri\r\n        /// </summary>\r\n        string Topic { get; }\r\n        /// <summary>\r\n        /// Observable event\r\n        /// </summary>\r\n        IObservable<TObservable> Event { get; }\r\n\r\n        /// <summary>\r\n        /// Data to be published from the observable event\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        TResult GetNewData();\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/UserNameBasedAuthenticationFactory.cs",
    "content": "using WampSharp.V2.Authentication;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    internal class UserNameBasedAuthenticationFactory : IWampSessionAuthenticatorFactory\r\n    {\r\n        public IWampSessionAuthenticator GetSessionAuthenticator(WampPendingClientDetails details,\r\n            IWampSessionAuthenticator transportAuthenticator)\r\n        {\r\n            if (!transportAuthenticator.IsAuthenticated)\r\n            {\r\n                throw new WampAuthenticationException(\"Cookie wasn't present\");\r\n            }\r\n\r\n            return transportAuthenticator;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/UserNameBasedAuthorizer.cs",
    "content": "using WampSharp.V2.Authentication;\r\nusing WampSharp.V2.Core.Contracts;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    internal class UserNameBasedAuthorizer : IWampAuthorizer\r\n    {\r\n        public bool CanRegister(RegisterOptions options, string procedure)\r\n        {\r\n            return true;\r\n        }\r\n\r\n        public bool CanCall(CallOptions options, string procedure)\r\n        {\r\n            options.DiscloseMe = true;\r\n            return true;\r\n        }\r\n\r\n        public bool CanPublish(PublishOptions options, string topicUri)\r\n        {\r\n            return true;\r\n        }\r\n\r\n        public bool CanSubscribe(SubscribeOptions options, string topicUri)\r\n        {\r\n            return true;\r\n        }\r\n\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/UserNameBasedCookieAuthenticationFactory.cs",
    "content": "using Composite.C1Console.Security;\r\nusing WampSharp.V2.Authentication;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    internal class UserNameBasedCookieAuthenticationFactory : ICookieAuthenticatorFactory\r\n    {\r\n        public IWampSessionAuthenticator CreateAuthenticator(ICookieProvider cookieProvider)\r\n        {\r\n            var userName = UserValidationFacade.GetUsername();\r\n\r\n            return new UserNameBasedCookieAuthenticator(userName);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/UserNameBasedCookieAuthenticator.cs",
    "content": "using Composite.C1Console.Security;\r\nusing WampSharp.V2.Authentication;\r\nusing WampSharp.V2.Core.Contracts;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    internal class UserNameBasedCookieAuthenticator : WampSessionAuthenticator\r\n    {\r\n        public UserNameBasedCookieAuthenticator(string userName)\r\n        {\r\n            this.AuthenticationId = userName;\r\n        }\r\n\r\n        public override void Authenticate(string signature, AuthenticateExtraData extra)\r\n        {\r\n            throw new WampAuthenticationException(\"Cookie wasn't present\");\r\n        }\r\n\r\n        public override bool IsAuthenticated => true;\r\n\r\n        public override string AuthenticationId { get; }\r\n\r\n        public override IWampAuthorizer Authorizer => new UserNameBasedAuthorizer();\r\n\r\n        public override string AuthenticationMethod => nameof(UserValidationFacade);\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/WampLogger.cs",
    "content": "﻿using System;\r\nusing System.Diagnostics;\r\nusing System.Text.RegularExpressions;\r\nusing Composite.Core.Logging;\r\nusing WampSharp.Logging;\r\nusing LogLevel = WampSharp.Logging.LogLevel;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    class WampLogger : ILogProvider\r\n    {\r\n        public Logger GetLogger(string name)\r\n        {\r\n            return new CompositeLoggerWrapper().Log;\r\n        }\r\n\r\n        public IDisposable OpenNestedContext(string message)\r\n        {\r\n            return null;\r\n        }\r\n\r\n        public IDisposable OpenMappedContext(string key, string value)\r\n        {\r\n            return null;\r\n        }\r\n\r\n        internal class CompositeLoggerWrapper\r\n        {\r\n            public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception,\r\n                params object[] formatParameters)\r\n            {\r\n                if (exception is OperationCanceledException)\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                if (messageFunc != null)\r\n                {\r\n                    var eventType = GetTraceEventType(logLevel);\r\n\r\n                    var message = FormatMessage(messageFunc, formatParameters);\r\n\r\n                    LoggingService.LogEntry(nameof(WampLogger), message, LoggingService.Category.General, eventType);\r\n                }\r\n\r\n                if (exception != null)\r\n                {\r\n                    Core.Log.LogError(nameof(WampLogger), exception);\r\n                }\r\n\r\n                return true;\r\n            }\r\n\r\n            private static TraceEventType GetTraceEventType(LogLevel logLevel)\r\n            {\r\n                switch (logLevel)\r\n                {\r\n                    case LogLevel.Fatal:\r\n                        return TraceEventType.Critical;\r\n                    case LogLevel.Error:\r\n                        return TraceEventType.Error;\r\n                    case LogLevel.Warn:\r\n                        return TraceEventType.Warning;\r\n                    case LogLevel.Info:\r\n                        return TraceEventType.Information;\r\n                    case LogLevel.Trace:\r\n                    case LogLevel.Debug:\r\n                        return TraceEventType.Verbose;\r\n                }\r\n\r\n                return TraceEventType.Warning;\r\n            }\r\n\r\n\r\n            private string FormatMessage(Func<string> messageFunc, params object[] formatParameters)\r\n            {\r\n                var message = messageFunc();\r\n                var needle = new Regex(@\"\\{(.*?)\\}\");\r\n\r\n                int i = 0;\r\n                while (needle.IsMatch(message))\r\n                {\r\n                    message = needle.Replace(message, \"^\" + i + \"#\", 1);\r\n                    i++;\r\n                }\r\n\r\n                return string.Format(message.Replace('#', '}').Replace('^', '{'), formatParameters);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/WampRouteWrapper.cs",
    "content": "﻿using System.Web;\r\nusing System.Web.Routing;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    /// <summary>\r\n    /// A wrapper around a <see cref=\"RouteBase\"/>, that prevent inner route's influence on MVC links resolution.\r\n    /// </summary>\r\n    internal class WampRouteWrapper : RouteBase\r\n    {\r\n        private readonly RouteBase _innerRoute;\r\n\r\n        public WampRouteWrapper(RouteBase innerRoute)\r\n        {\r\n            _innerRoute = innerRoute;\r\n        }\r\n\r\n        public override RouteData GetRouteData(HttpContextBase context) => _innerRoute.GetRouteData(context);\r\n\r\n        public override VirtualPathData GetVirtualPath(RequestContext r, RouteValueDictionary v) => null;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/WampRouter.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Reactive.Subjects;\r\nusing System.Web.Routing;\r\nusing Newtonsoft.Json;\r\nusing Newtonsoft.Json.Serialization;\r\nusing WampSharp.AspNet.WebSockets.Server;\r\nusing WampSharp.Binding;\r\nusing WampSharp.Logging;\r\nusing WampSharp.V2;\r\nusing WampSharp.V2.Realm;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    internal class WampRouter\r\n    {\r\n        private const string DefaultRealmName = \"realm\";\r\n        private const string WampConsoleUrl = \"api/Router\";\r\n        private WampHost _host;\r\n\r\n        public WampRouter()\r\n        {\r\n            LogProvider.SetCurrentLogProvider(new WampLogger());\r\n            try\r\n            {\r\n                StartWampRouter();\r\n                Log.LogVerbose(nameof(WampRouter),\"WAMP router initiated successfully\");\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                Log.LogCritical(nameof(WampRouter), \"WAMP router could not be instantiated\");\r\n                Log.LogCritical(nameof(WampRouter), e);\r\n            }\r\n            \r\n        }\r\n\r\n        public void RegisterCallee(IRpcService instance)\r\n        {\r\n            RegisterCallee(DefaultRealmName, instance);\r\n        }\r\n\r\n        public void RegisterCallee(string realmName, IRpcService instance) \r\n        {\r\n            var realm = _host.RealmContainer.GetRealmByName(realmName);\r\n\r\n            var registrationTask = realm.Services.RegisterCallee(instance);\r\n            registrationTask.Wait();\r\n        }\r\n\r\n        public void RegisterPublisher<TObservable, TResult>\r\n            (IWampEventHandler<TObservable, TResult> eventObservable)\r\n        {\r\n            RegisterPublisher(DefaultRealmName, eventObservable);\r\n        }\r\n\r\n        public void RegisterPublisher<TObservable, TResult>\r\n            (string realmName, IWampEventHandler<TObservable,TResult> eventObservable)\r\n        {\r\n            IWampHostedRealm realm = _host.RealmContainer.GetRealmByName(realmName);\r\n\r\n            ISubject<TResult> subject =\r\n                realm.Services.GetSubject<TResult>(eventObservable.Topic);\r\n\r\n            IObservable<TObservable> observableEvent = eventObservable.Event;\r\n\r\n            observableEvent.Subscribe(x =>\r\n            {\r\n                if (!realm.TopicContainer.TopicUris.Any(f => f.Equals(eventObservable.Topic)))\r\n                {\r\n                    Log.LogVerbose(nameof(WampRouter),\r\n                        $\"Trying to publish on topic: {eventObservable.Topic}, but there is no subscriber to this topic\");\r\n                }\r\n                else\r\n                {\r\n                    subject.OnNext(eventObservable.GetNewData());\r\n                }\r\n            });\r\n        }\r\n\r\n        private void StartWampRouter()\r\n        {\r\n            _host = new WampAuthenticationHost(new UserNameBasedAuthenticationFactory());\r\n\r\n            string routeUrl = $\"{UrlUtils.AdminFolderName}/{WampConsoleUrl}\";\r\n            if (routeUrl.StartsWith(\"/\"))\r\n            {\r\n                routeUrl = routeUrl.Substring(1);\r\n            }\r\n\r\n            _host.RegisterTransport(\r\n                new AspNetWebSocketTransport(routeUrl, new UserNameBasedCookieAuthenticationFactory()),\r\n                new JTokenJsonBinding(new JsonSerializer\r\n                {\r\n                    ContractResolver = new CamelCasePropertyNamesContractResolver()\r\n                }));\r\n            \r\n            IWampHostedRealm realm = _host.RealmContainer.GetRealmByName(DefaultRealmName);\r\n\r\n            realm.SessionCreated += SessionCreated;\r\n            realm.SessionClosed += SessionRemoved;\r\n            _host.Open();\r\n\r\n            FixWampRoute(routeUrl);\r\n        }\r\n\r\n        private static void FixWampRoute(string routeUrl)\r\n        {\r\n            var routes = RouteTable.Routes;\r\n\r\n            for (int i = 0; i < routes.Count; i++)\r\n            {\r\n                var route = routes[i] as Route;\r\n                if (route?.Url == routeUrl)\r\n                {\r\n                    routes.Remove(route);\r\n                    routes.Add(new WampRouteWrapper(route));\r\n                    return;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static void SessionCreated(object sender, WampSessionCreatedEventArgs e)\r\n        {\r\n            Log.LogVerbose(nameof(WampRouter),\"A new WAMP client is connected\");\r\n        }\r\n\r\n        private static void SessionRemoved(object sender, WampSessionCloseEventArgs e)\r\n        {\r\n            Log.LogVerbose(nameof(WampRouter), \"A connection error occured\");\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/WampRouterFacade.cs",
    "content": "namespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    /// <summary>\r\n    /// Wamp Router Facade for registering clients\r\n    /// </summary>\r\n    public static class WampRouterFacade\r\n    {\r\n        /// <summary>\r\n        /// Method for registering callee\r\n        /// </summary>\r\n        /// <param name=\"realmName\"></param>\r\n        /// <param name=\"instance\"></param>\r\n        /// <returns></returns>\r\n        public static bool RegisterCallee(string realmName, IRpcService instance)\r\n        {\r\n            var wampRouter = ServiceLocator.GetRequiredService<WampRouter>();\r\n            if (wampRouter == null)\r\n                return false;\r\n            wampRouter.RegisterCallee(realmName,instance);\r\n            return true;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Method for registering callee\r\n        /// </summary>\r\n        /// <param name=\"instance\"></param>\r\n        /// <returns></returns>\r\n        public static bool RegisterCallee(IRpcService instance)\r\n        {\r\n            var wampRouter = ServiceLocator.GetRequiredService<WampRouter>();\r\n            if (wampRouter == null)\r\n                return false;\r\n            wampRouter.RegisterCallee(instance);\r\n            return true;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Method for registering publisher\r\n        /// </summary>\r\n        /// <param name=\"realmName\"></param>\r\n        /// <param name=\"eventObservable\"></param>\r\n        /// <typeparam name=\"TObservable\"></typeparam>\r\n        /// <typeparam name=\"TResult\"></typeparam>\r\n        /// <returns></returns>\r\n        public static bool RegisterPublisher<TObservable,TResult>\r\n            (string realmName, IWampEventHandler<TObservable, TResult> eventObservable)\r\n        {\r\n            var wampRouter = ServiceLocator.GetRequiredService<WampRouter>();\r\n            if (wampRouter == null)\r\n                return false;\r\n            wampRouter.RegisterPublisher(realmName, eventObservable);\r\n            return true;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Method for registering publisher\r\n        /// </summary>\r\n        /// <param name=\"eventObservable\"></param>\r\n        /// <typeparam name=\"TObservable\"></typeparam>\r\n        /// <typeparam name=\"TResult\"></typeparam>\r\n        /// <returns></returns>\r\n        public static bool RegisterPublisher<TObservable,TResult>\r\n            (IWampEventHandler<TObservable, TResult> eventObservable)\r\n        {\r\n            var wampRouter = ServiceLocator.GetRequiredService<WampRouter>();\r\n            if (wampRouter == null)\r\n                return false;\r\n            wampRouter.RegisterPublisher(eventObservable);\r\n            return true;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/WampRouter/WampRouterResolverRegistry.cs",
    "content": "using Composite.Core.Application;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Composite.Core.WebClient.Services.WampRouter\r\n{\r\n    [ApplicationStartup]\r\n    internal class WampRouterResolverRegistry\r\n    {\r\n        public void ConfigureServices(IServiceCollection serviceCollection)\r\n        {\r\n            serviceCollection.Add(ServiceDescriptor.Singleton(new WampRouter()));\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/Services/WysiwygEditor/MarkupTransformationServices.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Xsl;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing TidyNet;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Services.WysiwygEditor\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class TidyHtmlResult\r\n    {\r\n        /// <exclude />\r\n        public XDocument Output { get; set; }\r\n        \r\n        /// <exclude />\r\n        public string ErrorSummary { get; set; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// Summary description for HtmlTidyServices\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class MarkupTransformationServices\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<string> Html5specificElementNames = new List<string> { \"article\", \"aside\", \"audio\", \"canvas\", \"command\", \"datalist\", \"details\", \"embed\", \"figcaption\", \"figure\", \"footer\", \"header\", \"hgroup\", \"keygen\", \"mark\", \"meter\", \"nav\", \"output\", \"progress\", \"rp\", \"rt\", \"ruby\", \"section\", \"source\", \"summary\", \"time\", \"video\", \"wbr\", \"main\", \"link\", \"meta\", \"i\" };\r\n\r\n        static readonly Regex _duplicateAttributesRegex = new Regex(@\"<([^>]*?) (?<attributeName>\\w*?)=(?<quote>\"\")([^>]*?)(\\k<quote>)([^>]*?) (\\k<attributeName>)=(?<quote2>\"\")([^>]*?)(\\k<quote2>)([^>]*?)>\", RegexOptions.Compiled);\r\n        static readonly Regex _namespacePrefixedElement = new Regex(@\"<([a-zA-Z0-9\\._]*?):([a-zA-Z0-9\\._]*)([^>]*?)(/?)>\", RegexOptions.Multiline | RegexOptions.Compiled);\r\n        static readonly Regex _elementWithNamespaceDeclaration = new Regex(@\"<(.*?) xmlns:([a-zA-Z0-9\\._]*)=\"\"(.*?)\"\"(.*?)(/?)>\", RegexOptions.Compiled);\r\n        static readonly Regex _elementsWithPrefixedAttributes = new Regex(@\"<[^>]*? ([\\w]):.*?>\", RegexOptions.Compiled);\r\n        static readonly Regex _customNamespaceDeclarations = new Regex(@\"<(.*?) xmlns:(?<prefix>[a-zA-Z0-9\\._]*?)=\"\"(?<uri>.*?)\"\"([^>]*?)>\", RegexOptions.Compiled);\r\n\r\n        /// <summary>\r\n        /// Repairs an html fragment (makes it Xhtml) and executes a transformation on it.\r\n        /// </summary>\r\n        /// <param name=\"html\">The html to repair</param>\r\n        /// <param name=\"xsltPath\">The path to the XSLT to use for transformation</param>\r\n        /// <param name=\"xsltParameters\"></param> \r\n        /// <param name=\"errorSummary\">out value - warnings generated while repairing the html</param>\r\n        /// <returns></returns>\r\n        public static XDocument RepairXhtmlAndTransform(string html, string xsltPath, Dictionary<string, string> xsltParameters, out string errorSummary)\r\n        {\r\n            TidyHtmlResult tidyHtmlResult = MarkupTransformationServices.TidyHtml(html);\r\n\r\n            errorSummary = tidyHtmlResult.ErrorSummary;\r\n            XNode tidiedXhtml = tidyHtmlResult.Output;\r\n            XDocument outputDocument = new XDocument();\r\n\r\n            XslCompiledTransform xslt = XsltServices.GetCompiledXsltTransform(xsltPath);\r\n\r\n            using (XmlWriter writer = outputDocument.CreateXhtmlWriter())\r\n            {\r\n                using (XmlReader reader = tidiedXhtml.CreateReader())\r\n                {\r\n                    if (xsltParameters != null && xsltParameters.Count > 0)\r\n                    {\r\n                        XsltArgumentList xsltArgumentList = new XsltArgumentList();\r\n                        foreach (var xsltParameter in xsltParameters)\r\n                        {\r\n                            xsltArgumentList.AddParam(xsltParameter.Key, \"\", xsltParameter.Value );\r\n                        }\r\n                        xslt.Transform(reader, xsltArgumentList, writer);\r\n                    }\r\n                    else\r\n                    {\r\n                        xslt.Transform(reader, writer);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return outputDocument;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Repairs an html fragment (makes it Xhtml) and executes a transformation on it.\r\n        /// </summary>\r\n        /// <param name=\"xml\">The xml to repair</param>\r\n        /// <param name=\"xsltPath\">The path to the XSLT to use for transformation</param>        \r\n        /// <returns></returns>\r\n        public static XDocument RepairXmlAndTransform(string xml, string xsltPath)\r\n        {\r\n            XDocument tidiedXml = MarkupTransformationServices.TidyXml(xml);\r\n\r\n            XDocument outputDocument = new XDocument();\r\n\r\n            XslCompiledTransform xslt = XsltServices.GetCompiledXsltTransform(xsltPath);\r\n\r\n            using (XmlWriter writer = outputDocument.CreateWriter())\r\n            {\r\n                using (XmlReader reader = tidiedXml.CreateReader())\r\n                {\r\n                    xslt.Transform(reader, writer);\r\n                }\r\n            }\r\n\r\n            return outputDocument;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Cleans HTML documents or fragments into XHTML conformant markup\r\n        /// </summary>\r\n        /// <param name=\"htmlMarkup\">The html to clean</param>\r\n        /// <returns>A fully structured XHTML document, incl. html, head and body elements.</returns>\r\n        public static TidyHtmlResult TidyHtml(string htmlMarkup)\r\n        {\r\n            Tidy tidy = GetXhtmlConfiguredTidy();\r\n\r\n            List<string> namespacePrefixedElementNames = LocateNamespacePrefixedElementNames(htmlMarkup);\r\n            Dictionary<string, string> namespacePrefixToUri = LocateNamespacePrefixToUriDeclarations(htmlMarkup);\r\n            List<string> badNamespacePrefixedElementNames = namespacePrefixedElementNames\r\n                .Where(s => !namespacePrefixToUri.Any(d => s.StartsWith(d.Key))).ToList();\r\n            AllowNamespacePrefixedElementNames(tidy, namespacePrefixedElementNames);\r\n            AllowHtml5ElementNames(tidy);\r\n\r\n            string xhtml = ParseMarkup(htmlMarkup, tidy, out TidyMessageCollection tidyMessages);\r\n\r\n            if (xhtml.IndexOf(\"<html>\")>-1)\r\n            {\r\n                xhtml = xhtml.Replace(\"<html>\", \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\");\r\n            }\r\n\r\n            if (xhtml.IndexOf(\"xmlns=\\\"http://www.w3.org/1999/xhtml\\\"\") == -1)\r\n            {\r\n                xhtml = xhtml.Replace(\"<html\", \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\"\");\r\n            }\r\n\r\n            xhtml = RemoveDuplicateAttributes(xhtml);\r\n            xhtml = RemoveXmlDeclarations(xhtml);\r\n            xhtml = UndoLowerCasingOfElementNames(xhtml, namespacePrefixedElementNames);\r\n            xhtml = UndoLowerCasingOfNamespacePrefixes(xhtml, namespacePrefixToUri);\r\n            StringBuilder messageBuilder = new StringBuilder();\r\n            foreach (TidyMessage message in tidyMessages)\r\n            {\r\n                if (message.Level == MessageLevel.Warning)\r\n                    messageBuilder.AppendLine(message.ToString());\r\n            }\r\n\r\n            List<string> badNamespacePrefixes = badNamespacePrefixedElementNames.Select(n => n.Substring(0, n.IndexOf(':'))).Union(LocateAttributeNamespacePrefixes(xhtml)).Distinct().Where(f => IsValidXmlName(f)).ToList();\r\n\r\n            XDocument outputResult;\r\n            if (badNamespacePrefixedElementNames.Any())\r\n            {\r\n                string badDeclared = string.Join(\" \", badNamespacePrefixes.Select(p => $\"xmlns:{p}='#bad'\"));\r\n                XDocument badDoc = XDocument.Parse($\"<root {badDeclared}>{xhtml}</root>\");\r\n                badDoc.Descendants().Attributes().Where(e => e.Name.Namespace == \"#bad\").Remove();\r\n                badDoc.Descendants().Where(e => e.Name.Namespace == \"#bad\").Remove();\r\n                outputResult = new XDocument(badDoc.Root.Descendants().First());\r\n            }\r\n            else\r\n            {\r\n                outputResult = XDocument.Parse(xhtml, LoadOptions.PreserveWhitespace);\r\n            }\r\n\r\n            return new TidyHtmlResult { Output = outputResult, ErrorSummary = messageBuilder.ToString() };\r\n        }\r\n\r\n        private static string ParseMarkup(string markup, Tidy tidy, out TidyMessageCollection tidyMessages)\r\n        {\r\n            string result;\r\n\r\n            tidyMessages = new TidyMessageCollection();\r\n            byte[] htmlByteArray = Encoding.UTF8.GetBytes(markup);\r\n\r\n            using (var inputStream = new MemoryStream(htmlByteArray))\r\n            {\r\n                using (var outputStream = new MemoryStream())\r\n                {\r\n                    tidy.Parse(inputStream, outputStream, tidyMessages);\r\n                    outputStream.Position = 0;\r\n                    using (var sr = new C1StreamReader(outputStream))\r\n                    {\r\n                        result = sr.ReadToEnd();\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (tidyMessages.Errors > 0)\r\n            {\r\n                var errorMessageBuilder = new StringBuilder();\r\n                foreach (TidyMessage message in tidyMessages)\r\n                {\r\n                    if (message.Level == MessageLevel.Error)\r\n                        errorMessageBuilder.AppendLine(message.ToString());\r\n                }\r\n                throw new InvalidOperationException($\"Failed to parse html:\\n\\n{errorMessageBuilder}\");\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Cleans HTML documents or fragments into XHTML conformant markup\r\n        /// </summary>\r\n        /// <param name=\"xmlMarkup\">The html to clean</param>\r\n        /// <returns></returns>\r\n        public static XDocument TidyXml(string xmlMarkup)\r\n        {\r\n            try\r\n            {\r\n                return XhtmlDocument.Parse(xmlMarkup);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                // take the slow road below...\r\n            }\r\n\r\n            Tidy tidy = GetXmlConfiguredTidy();\r\n\r\n            List<string> namespacePrefixedElementNames = LocateNamespacePrefixedElementNames(xmlMarkup);\r\n            AllowNamespacePrefixedElementNames(tidy, namespacePrefixedElementNames);\r\n            AllowHtml5ElementNames(tidy);\r\n\r\n            string xml = ParseMarkup(xmlMarkup, tidy, out TidyMessageCollection _);\r\n\r\n            xml = RemoveDuplicateAttributes(xml);\r\n\r\n            return XDocument.Parse(xml);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string OutputBodyDescendants(XDocument source)\r\n        {\r\n            string bodyInnerXhtml = \"\";\r\n\r\n            XmlWriterSettings settings = CustomizedWriterSettings();\r\n            using (var memoryStream = new MemoryStream())\r\n            {\r\n                using (var writer = XmlWriter.Create(memoryStream, settings))\r\n                {\r\n                    XNamespace xhtml = \"http://www.w3.org/1999/xhtml\";\r\n                    XElement bodyElement = source.Descendants(xhtml + \"body\").First();\r\n\r\n                    foreach (XNode element in bodyElement.Nodes())\r\n                    {\r\n                        element.WriteTo(writer);\r\n                    }\r\n\r\n                    writer.Close();\r\n                }\r\n\r\n                memoryStream.Position = 0;\r\n                using (var sr = new C1StreamReader(memoryStream))\r\n                {\r\n                    bodyInnerXhtml = sr.ReadToEnd();\r\n                }\r\n            }\r\n\r\n            bodyInnerXhtml = bodyInnerXhtml.Replace(\" xmlns=\\\"http://www.w3.org/1999/xhtml\\\"\", \"\");\r\n\r\n            var prefixToUriLookup = new Dictionary<string, string>();\r\n\r\n            int lastLength = -1;\r\n            while (bodyInnerXhtml.Length != lastLength)\r\n            {\r\n                lastLength = bodyInnerXhtml.Length;\r\n                MatchCollection matchCollection = _customNamespaceDeclarations.Matches(bodyInnerXhtml);\r\n\r\n                foreach (Match match in matchCollection)\r\n                {\r\n                    string prefix = match.Groups[\"prefix\"].Value;\r\n                    if (!prefixToUriLookup.ContainsKey(prefix))\r\n                    {\r\n                        prefixToUriLookup.Add(prefix, match.Groups[\"uri\"].Value);\r\n                    }\r\n                }\r\n\r\n                if (matchCollection.Count > 0)\r\n                {\r\n                    bodyInnerXhtml = _customNamespaceDeclarations.Replace(bodyInnerXhtml, \"<$1$2>\");\r\n                }\r\n            }\r\n\r\n            foreach (var prefixInfo in prefixToUriLookup)\r\n            {\r\n                Regex namespacePrefixedElement = new Regex(\"<(\" + prefixInfo.Key + @\":[a-zA-Z0-9\\._]*?)([^>]*?)( ?/?)>\", RegexOptions.Compiled);\r\n                bodyInnerXhtml = namespacePrefixedElement.Replace(bodyInnerXhtml, \"<$1$2 xmlns:\" + prefixInfo.Key + \"=\\\"\" + prefixInfo.Value + \"\\\"$3>\");\r\n            }\r\n\r\n            return bodyInnerXhtml;\r\n        }\r\n\r\n\r\n        private static XmlWriterSettings CustomizedWriterSettings()\r\n        {\r\n            return new XmlWriterSettings\r\n            {\r\n                OmitXmlDeclaration = true,\r\n                ConformanceLevel = ConformanceLevel.Fragment,\r\n                CloseOutput = false,\r\n                Indent = true,\r\n                IndentChars = \"\\t\"\r\n            };\r\n        }\r\n\r\n\r\n        private static string RemoveXmlDeclarations(string html)\r\n        {\r\n            Regex duplicateAttributesRegex = new Regex(@\"<\\?.*?>\");\r\n\r\n            int prevLength = -1;\r\n            while (html.Length != prevLength)\r\n            {\r\n                prevLength = html.Length;\r\n                html = duplicateAttributesRegex.Replace(html, \"\");\r\n            }\r\n\r\n            return html;\r\n        }\r\n\r\n        private static string RemoveDuplicateAttributes(string html)\r\n        {\r\n            // TODO: optimize, way to slow, takes 150ms!\r\n            int prevLength = -1;\r\n            while (html.Length != prevLength)\r\n            {\r\n                prevLength = html.Length;\r\n                html = _duplicateAttributesRegex.Replace(html, @\"<$1 ${attributeName}=\"\"$2\"\"$4$8>\");\r\n            }\r\n\r\n            return html;\r\n        }\r\n\r\n\r\n\r\n        private static string UndoLowerCasingOfNamespacePrefixes(string html, Dictionary<string, string> namespacePrefixToUri)\r\n        {\r\n            foreach (var namespaceMapping in namespacePrefixToUri.Where(f => f.Key.ToLower() != f.Key))\r\n            {\r\n                Regex tidyCasedElement = new Regex(@\"<(.*?) xmlns:\" + namespaceMapping.Key.ToLower() + @\"=\"\"\" + namespaceMapping.Value + @\"\"\"(.*?)>\");\r\n                html = tidyCasedElement.Replace(html, \"<$1 xmlns:\" + namespaceMapping.Key + @\"=\"\"\" + namespaceMapping.Value + @\"\"\"$2>\");\r\n            }\r\n\r\n            return html;\r\n        }\r\n\r\n\r\n\r\n        private static string UndoLowerCasingOfElementNames(string html, List<string> elementNames)\r\n        {\r\n            foreach (string elementName in elementNames.Where(f => f.ToLower() != f))\r\n            {\r\n                Regex tidyCasedElement = new Regex(@\"<(/?)\" + elementName.ToLower() + @\"(.*?)>\");\r\n                html = tidyCasedElement.Replace(html, \"<$1\" + elementName + \"$2>\");\r\n            }\r\n\r\n            return html;\r\n        }\r\n\r\n\r\n\r\n        private static Tidy GetXhtmlConfiguredTidy()\r\n        {\r\n            var t = new Tidy();\r\n\r\n            t.Options.RawOut = true;\r\n            t.Options.TidyMark = false;\r\n\r\n            t.Options.CharEncoding = CharEncoding.UTF8;\r\n            t.Options.DocType = DocType.Omit;\r\n            t.Options.WrapLen = 0;\r\n\r\n            t.Options.BreakBeforeBR = true;\r\n            t.Options.DropEmptyParas = true;\r\n            t.Options.Word2000 = true;\r\n            t.Options.MakeClean = false;\r\n            t.Options.Xhtml = true;\r\n\r\n            t.Options.QuoteNbsp = false;\r\n            t.Options.NumEntities = true;\r\n            t.Options.AllowElementPruning = false;\r\n            t.Options.LogicalEmphasis = true;\r\n\r\n            return t;\r\n        }\r\n\r\n\r\n\r\n        private static Tidy GetXmlConfiguredTidy()\r\n        {\r\n            Tidy t = new Tidy();\r\n\r\n            t.Options.RawOut = true;\r\n            t.Options.TidyMark = false;\r\n\r\n            t.Options.CharEncoding = CharEncoding.UTF8;\r\n            t.Options.DocType = DocType.Omit;\r\n            t.Options.WrapLen = 0;\r\n\r\n            t.Options.Xhtml = false;\r\n            t.Options.XmlOut = true;\r\n\r\n            t.Options.QuoteNbsp = false;\r\n            t.Options.NumEntities = true;\r\n\r\n            return t;\r\n        }\r\n\r\n\r\n        private static void AllowHtml5ElementNames(Tidy tidy)\r\n        {\r\n            foreach (string elementName in Html5specificElementNames)\r\n            {\r\n                tidy.Options.AddTag(elementName.ToLower());\r\n            }\r\n        }\r\n\r\n\r\n        private static void AllowNamespacePrefixedElementNames(Tidy tidy, List<string> elementNames)\r\n        {\r\n            foreach (string elementName in elementNames.Where(en => en != \"f:function\" && en != \"f:param\")) // f:* written into TidyNet.dll to fix http://compositec1.codeplex.com/workitem/1144\r\n            {\r\n                tidy.Options.AddTag(elementName.ToLower());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static List<string> LocateNamespacePrefixedElementNames(string htmlMarkup)\r\n        {\r\n            var prefixedElementNames = new List<string>();\r\n\r\n            MatchCollection matches = _namespacePrefixedElement.Matches(htmlMarkup);\r\n\r\n            foreach (Match match in matches)\r\n            {\r\n                string prefixedElementName = $\"{match.Groups[1].Value}:{match.Groups[2].Value}\";\r\n                if (!prefixedElementNames.Contains(prefixedElementName))\r\n                {\r\n                    prefixedElementNames.Add(prefixedElementName);\r\n                }\r\n            }\r\n            return prefixedElementNames;\r\n        }\r\n\r\n\r\n\r\n        private static List<string> LocateAttributeNamespacePrefixes(string htmlMarkup)\r\n        {\r\n            List<string> prefixes = new List<string>();\r\n\r\n            \r\n            MatchCollection matches = _elementsWithPrefixedAttributes.Matches(htmlMarkup);\r\n\r\n            foreach (Match match in matches)\r\n            {\r\n                string prefix = match.Groups[1].Value;\r\n                if (prefixes.Contains(prefix) == false)\r\n                {\r\n                    prefixes.Add(prefix);\r\n                }\r\n            }\r\n            return prefixes;\r\n        }\r\n\r\n\r\n\r\n        private static Dictionary<string, string> LocateNamespacePrefixToUriDeclarations(string htmlMarkup)\r\n        {\r\n            var prefixToUri = new Dictionary<string, string>();\r\n\r\n            MatchCollection matches = _elementWithNamespaceDeclaration.Matches(htmlMarkup);\r\n\r\n            foreach (Match match in matches)\r\n            {\r\n                string prefix = match.Groups[2].Value;\r\n                string uri = match.Groups[3].Value;\r\n\r\n                if (!prefixToUri.ContainsKey(prefix))\r\n                {\r\n                    prefixToUri.Add(prefix, uri);\r\n                }\r\n                else\r\n                {\r\n                    if (prefixToUri[prefix] != uri) throw new NotImplementedException($\"The namespace prefix {prefix} is used to identify multiple namespaces. This may be legal XML but is not supported here\");\r\n                }\r\n            }\r\n            return prefixToUri;\r\n        }\r\n\r\n\r\n\r\n\r\n        private static bool IsValidXmlName(string name)\r\n        {\r\n            try\r\n            {\r\n                return name == XmlConvert.VerifyName(name);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Services/WysiwygEditor/PageTemplatePreview.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Drawing;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing Composite.C1Console.Events;\r\nusing System.Threading.Tasks;\r\nusing Composite.Core.WebClient.PhantomJs;\r\n\r\nnamespace Composite.Core.WebClient.Services.WysiwygEditor\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PageTemplatePreview\r\n    {\r\n        private static readonly string ServiceUrl = UrlUtils.ResolvePublicUrl(\"~/Renderers/TemplatePreview.ashx\");\r\n        private const string RenderingMode = \"template\";\r\n\r\n        static PageTemplatePreview()\r\n        {\r\n            GlobalEventSystemFacade.OnDesignChange += ClearCache;\r\n        }\r\n\r\n        /// <exclude />\r\n        public class PlaceholderInformation\r\n        {\r\n            /// <exclude />\r\n            public string PlaceholderId { get; set; }\r\n\r\n            /// <exclude />\r\n            public Rectangle ClientRectangle { get; set; }\r\n\r\n            /// <exclude />\r\n            public Rectangle ClientRectangleWithZoom { get; set; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool GetPreviewInformation(HttpContext context, Guid pageId, Guid templateId, out string imageFilePath, out PlaceholderInformation[] placeholders)\r\n        {\r\n            int updateHash = BrowserRender.GetLastCacheUpdateTime(RenderingMode).GetHashCode();\r\n            string requestUrl = new UrlBuilder(context.Request.Url.ToString()).ServerUrl \r\n                + ServiceUrl + $\"?p={pageId}&t={templateId}&hash={updateHash}\";\r\n\r\n            RenderingResult result = null;\r\n\r\n            var renderTask = BrowserRender.RenderUrlAsync(context, requestUrl, RenderingMode);\r\n            renderTask.Wait(10000);\r\n            if (renderTask.Status == TaskStatus.RanToCompletion)\r\n            {\r\n                result = renderTask.Result;\r\n            }\r\n\r\n            if (result == null)\r\n            {\r\n                imageFilePath = null;\r\n                placeholders = null;\r\n                return false;\r\n            }\r\n\r\n            if (result.Status != RenderingResultStatus.Success)\r\n            {\r\n                Log.LogWarning(\"PageTemplatePreview\", \"Failed to build preview for page template '{0}'. Reason: {1}; Output:\\r\\n{2}\",\r\n                    templateId, result.Status, string.Join(Environment.NewLine, result.Output));\r\n\r\n                imageFilePath = null;\r\n                placeholders = null;\r\n                return false;\r\n            }\r\n\r\n            imageFilePath = result.FilePath;\r\n            ICollection<string> output = result.Output;\r\n            const string templateInfoPrefix = \"templateInfo:\";\r\n\r\n            var placeholderData = output.FirstOrDefault(l => l.StartsWith(templateInfoPrefix));\r\n\r\n            var pList = new List<PlaceholderInformation>();\r\n\r\n            // TODO: use JSON\r\n            if (placeholderData != null)\r\n            {\r\n                foreach (var infoPart in placeholderData.Substring(templateInfoPrefix.Length).Split('|'))\r\n                {\r\n                    string[] parts = infoPart.Split(',');\r\n\r\n                    double left, top, width, height;\r\n\r\n                    if (parts.Length != 5\r\n                        || !double.TryParse(parts[1], out left)\r\n                        || !double.TryParse(parts[2], out top)\r\n                        || !double.TryParse(parts[3], out width)\r\n                        || !double.TryParse(parts[4], out height))\r\n                    {\r\n                        throw new InvalidOperationException($\"Incorrectly serialized template part info: {infoPart}\");\r\n                    }\r\n\r\n                    var zoom = 1.0;\r\n\r\n                    pList.Add(new PlaceholderInformation\r\n                    {\r\n                        PlaceholderId = parts[0], \r\n                        ClientRectangle = new Rectangle((int)left, (int)top, (int)width, (int)height),\r\n                        ClientRectangleWithZoom = new Rectangle(\r\n                            (int)Math.Round(zoom * left), \r\n                            (int)Math.Round(zoom * top),\r\n                            (int)Math.Round(zoom * width),\r\n                            (int)Math.Round(zoom * height))\r\n                    });\r\n                }\r\n            }\r\n\r\n            placeholders = pList.ToArray();\r\n            return true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void ClearCache()\r\n        {\r\n            BrowserRender.ClearCache(RenderingMode);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Setup/SetupServiceFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Net;\r\nusing System.ServiceModel;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.WebClient.Setup.WebServiceClient;\r\nusing Composite.Core.Xml;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Setup\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class SetupServiceFacade\r\n    {\r\n        /// <exclude />\r\n        public static XNamespace XmlNamespace = (XNamespace)\"urn:Composte.C1.Setup\";\r\n\r\n        /// <exclude />\r\n        public static XName PackageElementName = XmlNamespace + \"package\";\r\n\r\n        /// <exclude />\r\n        public static string UrlAttributeName = \"url\";\r\n\r\n        /// <exclude />\r\n        public static string IdAttributeName = \"id\";\r\n\r\n        /// <exclude />\r\n        public static string KeyAttributeName = \"key\";\r\n\r\n        /// <exclude />\r\n        public static string PackageServicePingUrlFormat = \"{0}/C1.asmx\";\r\n\r\n        private static readonly string SetupServiceUrl = \"{0}/Setup/Setup.asmx\";\r\n\r\n\r\n        private static string _packageServerUrl;\r\n        private static readonly string LogTitle = typeof(SetupServiceFacade).Name;\r\n        private static readonly string VerboseLogTitle = \"RGB(255, 55, 85)\" + LogTitle;\r\n\r\n        /// <exclude />\r\n        public static string PackageServerUrl\r\n        {\r\n            get\r\n            {\r\n                if (_packageServerUrl == null)\r\n                {\r\n                    string filepath = PathUtil.Resolve(@\"~/App_Data/Composite/Composite.config\");\r\n\r\n                    XDocument doc = XDocumentUtils.Load(filepath);\r\n                    XElement element = doc.Root.Descendants(\"Composite.SetupConfiguration\").Single();\r\n\r\n                    _packageServerUrl = element.Attribute(\"PackageServerUrl\").Value;\r\n                }\r\n\r\n                return _packageServerUrl;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool SetUp(string setupDescriptionXml, string username, string password, string email, string language, string consoleLanguage, bool newsletter)\r\n        {\r\n            ApplicationOnlineHandlerFacade.TurnApplicationOffline(false);\r\n\r\n            username = username.Trim().ToLowerInvariant();\r\n\r\n            XElement setupDescription = XElement.Parse(setupDescriptionXml);\r\n\r\n            XElement setupRegistrationDescription = new XElement(\"registration\",\r\n                new XElement(\"user_email\", email),\r\n                new XElement(\"user_newsletter\", newsletter),\r\n                new XElement(\"user_consolelanguage\", consoleLanguage),\r\n                new XElement(\"user_websitelanguage\", language),\r\n                setupDescription);\r\n\r\n            bool success = false;\r\n\r\n            try\r\n            {\r\n                Log.LogInformation(VerboseLogTitle, \"Downloading packages\");\r\n\r\n                string[] packageUrls = GetPackageUrls(setupDescription).ToArray();\r\n                MemoryStream[] packages = new MemoryStream[packageUrls.Length];\r\n\r\n                Parallel.For(0, packageUrls.Length, i =>\r\n                {\r\n                    packages[i] = DownloadPackage(packageUrls[i]);\r\n                });\r\n\r\n                Log.LogInformation(VerboseLogTitle, \"Setting up the system for the first time\");\r\n\r\n                CultureInfo locale = new CultureInfo(language);\r\n                CultureInfo userCulture = new CultureInfo(consoleLanguage);\r\n\r\n                ApplicationLevelEventHandlers.ApplicationStartInitialize();\r\n\r\n                Log.LogInformation(VerboseLogTitle, \"Creating first locale: \" + language);\r\n                LocalizationFacade.AddLocale(locale, \"\", true, true, true);\r\n\r\n\r\n                Log.LogInformation(VerboseLogTitle, \"Creating first user: \" + username);\r\n                AdministratorAutoCreator.AutoCreateAdministrator(username, password, email, false);\r\n                UserValidationFacade.FormValidateUser(username, password);\r\n\r\n                UserSettings.SetUserCultureInfo(username, userCulture);\r\n\r\n                CultureInfo installedLanguagePackageCulture = InstallLanguagePackage(userCulture);\r\n\r\n                UserSettings.SetUserC1ConsoleUiLanguage(username, installedLanguagePackageCulture ?? StringResourceSystemFacade.GetDefaultStringCulture());\r\n\r\n                using (new DataScope(locale))\r\n                {\r\n                    for (int i = 0; i < packageUrls.Length; i++)\r\n                    {\r\n                        Log.LogVerbose(VerboseLogTitle, \"Installing package from url \" + packageUrls[i]);\r\n                        InstallPackage(packageUrls[i], packages[i]);\r\n\r\n                        // Releasing a reference to reduce memory usage\r\n                        packages[i].Dispose();\r\n                        packages[i] = null;\r\n                    }\r\n                }\r\n\r\n                RegisterSetup(setupRegistrationDescription.ToString(), \"\");\r\n\r\n                Log.LogInformation(VerboseLogTitle, \"Done setting up the system for the first time! Enjoy!\");\r\n\r\n                success = true;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(LogTitle, ex);\r\n                Log.LogWarning(LogTitle, \"First time setup failed - could not download, install package or otherwise complete the setup.\");\r\n                RegisterSetup(setupRegistrationDescription.ToString(), ex.ToString());\r\n\r\n                if (RuntimeInformation.IsDebugBuild)\r\n                {\r\n                    ApplicationOnlineHandlerFacade.TurnApplicationOnline();\r\n                    throw;\r\n                }\r\n            }\r\n\r\n            ApplicationOnlineHandlerFacade.TurnApplicationOnline();\r\n            return success;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool PingServer()\r\n        {\r\n            SetupSoapClient client = CreateClient();\r\n\r\n            return client.Ping();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement GetSetupDescription()\r\n        {\r\n            SetupSoapClient client = CreateClient();\r\n\r\n            return client.GetSetupDescription(\r\n                RuntimeInformation.ProductVersion.ToString(),\r\n                InstallationInformationFacade.InstallationId.ToString());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement GetLanguages()\r\n        {\r\n            SetupSoapClient client = CreateClient();\r\n\r\n            return client.GetLanguages(RuntimeInformation.ProductVersion.ToString(),\r\n                InstallationInformationFacade.InstallationId.ToString());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Dictionary<CultureInfo, string> GetLanguagePackages()\r\n        {\r\n            SetupSoapClient client = CreateClient();\r\n\r\n            XElement xml = client.GetLanguagePackages(RuntimeInformation.ProductVersion.ToString(),\r\n                InstallationInformationFacade.InstallationId.ToString());\r\n\r\n            return xml.Descendants(\"Language\")\r\n                .ToDictionary(f => new CultureInfo(f.Attribute(\"key\").Value), f => f.Attribute(\"url\").Value);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static XmlDocument GetGetLicense()\r\n        {\r\n            SetupSoapClient client = CreateClient();\r\n\r\n            XElement xml = client.GetGetLicense(RuntimeInformation.ProductVersion.ToString(),\r\n                    InstallationInformationFacade.InstallationId.ToString());\r\n\r\n            var doc = new XmlDocument();\r\n            using (var reader = xml.CreateReader())\r\n            {\r\n                doc.Load(reader);\r\n            }\r\n\r\n            return doc;\r\n        }\r\n\r\n\r\n\r\n        private static void RegisterSetup(string setupDescriptionXml, string exception)\r\n        {\r\n            SetupSoapClient client = CreateClient();\r\n\r\n            client.RegisterSetup(RuntimeInformation.ProductVersion.ToString(),\r\n                InstallationInformationFacade.InstallationId.ToString(), setupDescriptionXml, exception);\r\n        }\r\n\r\n\r\n\r\n        private static CultureInfo InstallLanguagePackage(CultureInfo userCulture)\r\n        {\r\n            Dictionary<CultureInfo, string> languagePackages = GetLanguagePackages();\r\n\r\n            CultureInfo installLanguagePackageCulture = \r\n                languagePackages.ContainsKey(userCulture) ? \r\n                userCulture : \r\n                languagePackages.Keys.FirstOrDefault(f => f.TwoLetterISOLanguageName == userCulture.TwoLetterISOLanguageName);\r\n\r\n            if (installLanguagePackageCulture != null)\r\n            {\r\n                string url = languagePackages[installLanguagePackageCulture];\r\n\r\n                string packageUrl = ResolvePackageUrl(url);\r\n\r\n                Log.LogInformation(VerboseLogTitle, \"Installing package: \" + packageUrl);\r\n\r\n                var packageStream = DownloadPackage(packageUrl);\r\n                InstallPackage(packageUrl, packageStream);\r\n            }\r\n\r\n            return installLanguagePackageCulture;\r\n        }\r\n\r\n\r\n        private static MemoryStream DownloadPackage(string packageUrl)\r\n        {\r\n            var packageStream = new MemoryStream();\r\n\r\n            try\r\n            {\r\n                var request = (HttpWebRequest) WebRequest.Create(packageUrl);\r\n                var response = (HttpWebResponse) request.GetResponse();\r\n\r\n                const int bufferSize = 32768;\r\n                byte[] buffer = new byte[bufferSize];\r\n\r\n                using (Stream inputStream = response.GetResponseStream())\r\n                {\r\n                    int read;\r\n                    while ((read = inputStream.Read(buffer, 0, bufferSize)) > 0)\r\n                    {\r\n                        packageStream.Write(buffer, 0, read);\r\n                    }\r\n\r\n                    inputStream.Close();\r\n                }\r\n            }\r\n            catch(ThreadAbortException) {}\r\n            catch(Exception ex)\r\n            {\r\n                throw new InvalidOperationException($\"Failed to download package '{packageUrl}'\", ex);\r\n            }\r\n\r\n            packageStream.Seek(0, SeekOrigin.Begin);\r\n            return packageStream;\r\n        }\r\n\r\n\r\n        private static void InstallPackage(string packageUrl, Stream packageStream)\r\n        {\r\n            PackageManagerInstallProcess packageManagerInstallProcess = PackageManager.Install(packageStream, true);\r\n            if (packageManagerInstallProcess.PreInstallValidationResult.Count > 0)\r\n            {\r\n                throw WrapFirstValidationException(packageUrl, packageManagerInstallProcess.PreInstallValidationResult);\r\n            }\r\n                \r\n            List<PackageFragmentValidationResult> validationResult = packageManagerInstallProcess.Validate();\r\n\r\n            if (validationResult.Count > 0)\r\n            {\r\n                throw WrapFirstValidationException(packageUrl, validationResult);\r\n            }\r\n                \r\n            List<PackageFragmentValidationResult> installResult = packageManagerInstallProcess.Install();\r\n            if (installResult.Count > 0)\r\n            {\r\n                throw WrapFirstValidationException(packageUrl, installResult);\r\n            }\r\n        }\r\n        \r\n\r\n\r\n\r\n        private static SetupSoapClient CreateClient()\r\n        {\r\n            var timeout = TimeSpan.FromMinutes(RuntimeInformation.IsDebugBuild ? 2 : 1);\r\n\r\n            var basicHttpBinding = new BasicHttpBinding\r\n            {\r\n                CloseTimeout = timeout,\r\n                OpenTimeout = timeout,\r\n                ReceiveTimeout = timeout,\r\n                SendTimeout = timeout,\r\n                MaxReceivedMessageSize = int.MaxValue\r\n            };\r\n\r\n\r\n            if (PackageServerUrl.StartsWith(\"https://\"))\r\n            {\r\n                basicHttpBinding.Security.Mode = BasicHttpSecurityMode.Transport;\r\n            }\r\n\r\n            return new SetupSoapClient(basicHttpBinding, new EndpointAddress(string.Format(SetupServiceUrl, PackageServerUrl)));\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<string> GetPackageUrls(XElement setupDescription)\r\n        {\r\n            var keyAttributes = setupDescription.Descendants().Attributes(KeyAttributeName).ToList();\r\n            if (!keyAttributes.Any())\r\n            {\r\n                throw new InvalidOperationException(\"Invalid setup description: \" + setupDescription);\r\n            }\r\n\r\n            int maxkey = keyAttributes.Select(f => (int)f).Max();\r\n\r\n            SetupSoapClient client = CreateClient();\r\n            \r\n            XElement originalSetupDescription = client.GetSetupDescription(RuntimeInformation.ProductVersion.ToString(),\r\n                    InstallationInformationFacade.InstallationId.ToString());\r\n\r\n            var element =\r\n                (from elm in originalSetupDescription.Descendants()\r\n                 let keyAttr = elm.Attribute(KeyAttributeName)\r\n                 where keyAttr != null && (int)keyAttr == maxkey\r\n                 select elm).Single();\r\n\r\n            foreach (XElement packageElement in setupDescription.Descendants(PackageElementName))\r\n            {\r\n                XAttribute idAttribute = packageElement.Attribute(IdAttributeName);\r\n                if (idAttribute == null)\r\n                {\r\n                    throw new InvalidOperationException($\"Setup XML malformed, '{IdAttributeName}' is missing on a '{PackageElementName}' element\");\r\n                }\r\n\r\n                string url =\r\n                    (from elm in element.Descendants(PackageElementName)\r\n                     where elm.Attribute(IdAttributeName).Value == idAttribute.Value\r\n                     select elm.Attribute(UrlAttributeName).Value).SingleOrDefault();\r\n\r\n                yield return ResolvePackageUrl(url);\r\n            }\r\n        }\r\n\r\n        private static string ResolvePackageUrl(string url)\r\n        {\r\n            if (url.StartsWith(\"http://\") || url.StartsWith(\"https://\"))\r\n            {\r\n                return url;\r\n            }\r\n\r\n            return PackageServerUrl + url;\r\n        }\r\n\r\n\r\n        private static Exception WrapFirstValidationException(string packageUrl, IEnumerable<PackageFragmentValidationResult> packageFragmentValidationResults)\r\n        {\r\n            var firstError = packageFragmentValidationResults.First();\r\n            var innerException = firstError.Exception ?? new InvalidOperationException(firstError.Message);\r\n            \r\n            throw new InvalidOperationException($\"Failed to install package '{packageUrl}'\", innerException);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/Setup/WebServiceClient/Reference.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:4.0.30319.1\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace Composite.Core.WebClient.Setup.WebServiceClient\r\n{\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ServiceModel.ServiceContractAttribute(Namespace = \"http://www.composite.net/ns/management\", ConfigurationName = \"ServiceReference1.SetupSoap\")]\r\n    internal interface SetupSoap\r\n    {\r\n\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://www.composite.net/ns/management/Ping\", ReplyAction = \"*\")]\r\n        bool Ping();\r\n\r\n        // CODEGEN: Generating message contract since element name version from namespace http://www.composite.net/ns/management is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://www.composite.net/ns/management/GetSetupDescription\", ReplyAction = \"*\")]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionResponse GetSetupDescription(Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name version from namespace http://www.composite.net/ns/management is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://www.composite.net/ns/management/GetGetLicense\", ReplyAction = \"*\")]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseResponse GetGetLicense(Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name version from namespace http://www.composite.net/ns/management is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://www.composite.net/ns/management/GetLanguages\", ReplyAction = \"*\")]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesResponse GetLanguages(Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name version from namespace http://www.composite.net/ns/management is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://www.composite.net/ns/management/GetLanguagePackages\", ReplyAction = \"*\")]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesResponse GetLanguagePackages(Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesRequest request);\r\n\r\n        // CODEGEN: Generating message contract since element name version from namespace http://www.composite.net/ns/management is not marked nillable\r\n        [System.ServiceModel.OperationContractAttribute(Action = \"http://www.composite.net/ns/management/RegisterSetup\", ReplyAction = \"*\")]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupResponse RegisterSetup(Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupRequest request);\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class GetSetupDescriptionRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetSetupDescription\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionRequestBody Body;\r\n\r\n        public GetSetupDescriptionRequest()\r\n        {\r\n        }\r\n\r\n        public GetSetupDescriptionRequest(Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class GetSetupDescriptionRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public string version;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)]\r\n        public string installationId;\r\n\r\n        public GetSetupDescriptionRequestBody()\r\n        {\r\n        }\r\n\r\n        public GetSetupDescriptionRequestBody(string version, string installationId)\r\n        {\r\n            this.version = version;\r\n            this.installationId = installationId;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class GetSetupDescriptionResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetSetupDescriptionResponse\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionResponseBody Body;\r\n\r\n        public GetSetupDescriptionResponse()\r\n        {\r\n        }\r\n\r\n        public GetSetupDescriptionResponse(Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class GetSetupDescriptionResponseBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public System.Xml.Linq.XElement GetSetupDescriptionResult;\r\n\r\n        public GetSetupDescriptionResponseBody()\r\n        {\r\n        }\r\n\r\n        public GetSetupDescriptionResponseBody(System.Xml.Linq.XElement GetSetupDescriptionResult)\r\n        {\r\n            this.GetSetupDescriptionResult = GetSetupDescriptionResult;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class GetGetLicenseRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetGetLicense\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseRequestBody Body;\r\n\r\n        public GetGetLicenseRequest()\r\n        {\r\n        }\r\n\r\n        public GetGetLicenseRequest(Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class GetGetLicenseRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public string version;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)]\r\n        public string installationId;\r\n\r\n        public GetGetLicenseRequestBody()\r\n        {\r\n        }\r\n\r\n        public GetGetLicenseRequestBody(string version, string installationId)\r\n        {\r\n            this.version = version;\r\n            this.installationId = installationId;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class GetGetLicenseResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetGetLicenseResponse\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseResponseBody Body;\r\n\r\n        public GetGetLicenseResponse()\r\n        {\r\n        }\r\n\r\n        public GetGetLicenseResponse(Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class GetGetLicenseResponseBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public System.Xml.Linq.XElement GetGetLicenseResult;\r\n\r\n        public GetGetLicenseResponseBody()\r\n        {\r\n        }\r\n\r\n        public GetGetLicenseResponseBody(System.Xml.Linq.XElement GetGetLicenseResult)\r\n        {\r\n            this.GetGetLicenseResult = GetGetLicenseResult;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class GetLanguagesRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetLanguages\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesRequestBody Body;\r\n\r\n        public GetLanguagesRequest()\r\n        {\r\n        }\r\n\r\n        public GetLanguagesRequest(Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class GetLanguagesRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public string version;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)]\r\n        public string installationId;\r\n\r\n        public GetLanguagesRequestBody()\r\n        {\r\n        }\r\n\r\n        public GetLanguagesRequestBody(string version, string installationId)\r\n        {\r\n            this.version = version;\r\n            this.installationId = installationId;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class GetLanguagesResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetLanguagesResponse\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesResponseBody Body;\r\n\r\n        public GetLanguagesResponse()\r\n        {\r\n        }\r\n\r\n        public GetLanguagesResponse(Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class GetLanguagesResponseBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public System.Xml.Linq.XElement GetLanguagesResult;\r\n\r\n        public GetLanguagesResponseBody()\r\n        {\r\n        }\r\n\r\n        public GetLanguagesResponseBody(System.Xml.Linq.XElement GetLanguagesResult)\r\n        {\r\n            this.GetLanguagesResult = GetLanguagesResult;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class GetLanguagePackagesRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetLanguagePackages\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesRequestBody Body;\r\n\r\n        public GetLanguagePackagesRequest()\r\n        {\r\n        }\r\n\r\n        public GetLanguagePackagesRequest(Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class GetLanguagePackagesRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public string version;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)]\r\n        public string installationId;\r\n\r\n        public GetLanguagePackagesRequestBody()\r\n        {\r\n        }\r\n\r\n        public GetLanguagePackagesRequestBody(string version, string installationId)\r\n        {\r\n            this.version = version;\r\n            this.installationId = installationId;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class GetLanguagePackagesResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"GetLanguagePackagesResponse\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesResponseBody Body;\r\n\r\n        public GetLanguagePackagesResponse()\r\n        {\r\n        }\r\n\r\n        public GetLanguagePackagesResponse(Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class GetLanguagePackagesResponseBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public System.Xml.Linq.XElement GetLanguagePackagesResult;\r\n\r\n        public GetLanguagePackagesResponseBody()\r\n        {\r\n        }\r\n\r\n        public GetLanguagePackagesResponseBody(System.Xml.Linq.XElement GetLanguagePackagesResult)\r\n        {\r\n            this.GetLanguagePackagesResult = GetLanguagePackagesResult;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class RegisterSetupRequest\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RegisterSetup\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupRequestBody Body;\r\n\r\n        public RegisterSetupRequest()\r\n        {\r\n        }\r\n\r\n        public RegisterSetupRequest(Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupRequestBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class RegisterSetupRequestBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 0)]\r\n        public string version;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 1)]\r\n        public string installationId;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 2)]\r\n        public string setupDescriptionXml;\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 3)]\r\n        public string exception;\r\n\r\n        public RegisterSetupRequestBody()\r\n        {\r\n        }\r\n\r\n        public RegisterSetupRequestBody(string version, string installationId, string setupDescriptionXml, string exception)\r\n        {\r\n            this.version = version;\r\n            this.installationId = installationId;\r\n            this.setupDescriptionXml = setupDescriptionXml;\r\n            this.exception = exception;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.ServiceModel.MessageContractAttribute(IsWrapped = false)]\r\n    internal partial class RegisterSetupResponse\r\n    {\r\n\r\n        [System.ServiceModel.MessageBodyMemberAttribute(Name = \"RegisterSetupResponse\", Namespace = \"http://www.composite.net/ns/management\", Order = 0)]\r\n        public Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupResponseBody Body;\r\n\r\n        public RegisterSetupResponse()\r\n        {\r\n        }\r\n\r\n        public RegisterSetupResponse(Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupResponseBody Body)\r\n        {\r\n            this.Body = Body;\r\n        }\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n    [System.Runtime.Serialization.DataContractAttribute(Namespace = \"http://www.composite.net/ns/management\")]\r\n    internal partial class RegisterSetupResponseBody\r\n    {\r\n\r\n        [System.Runtime.Serialization.DataMemberAttribute(Order = 0)]\r\n        public bool RegisterSetupResult;\r\n\r\n        public RegisterSetupResponseBody()\r\n        {\r\n        }\r\n\r\n        public RegisterSetupResponseBody(bool RegisterSetupResult)\r\n        {\r\n            this.RegisterSetupResult = RegisterSetupResult;\r\n        }\r\n    }\r\n\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    internal interface SetupSoapChannel : Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap, System.ServiceModel.IClientChannel\r\n    {\r\n    }\r\n\r\n    [System.Diagnostics.DebuggerStepThroughAttribute()]\r\n    [System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.ServiceModel\", \"4.0.0.0\")]\r\n    internal partial class SetupSoapClient : System.ServiceModel.ClientBase<Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap>, Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap\r\n    {\r\n\r\n        public SetupSoapClient()\r\n        {\r\n        }\r\n\r\n        public SetupSoapClient(string endpointConfigurationName) :\r\n            base(endpointConfigurationName)\r\n        {\r\n        }\r\n\r\n        public SetupSoapClient(string endpointConfigurationName, string remoteAddress) :\r\n            base(endpointConfigurationName, remoteAddress)\r\n        {\r\n        }\r\n\r\n        public SetupSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :\r\n            base(endpointConfigurationName, remoteAddress)\r\n        {\r\n        }\r\n\r\n        public SetupSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :\r\n            base(binding, remoteAddress)\r\n        {\r\n        }\r\n\r\n        public bool Ping()\r\n        {\r\n            return base.Channel.Ping();\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionResponse Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap.GetSetupDescription(Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionRequest request)\r\n        {\r\n            return base.Channel.GetSetupDescription(request);\r\n        }\r\n\r\n        public System.Xml.Linq.XElement GetSetupDescription(string version, string installationId)\r\n        {\r\n            Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionRequest inValue = new Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionRequest();\r\n            inValue.Body = new Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionRequestBody();\r\n            inValue.Body.version = version;\r\n            inValue.Body.installationId = installationId;\r\n            Composite.Core.WebClient.Setup.WebServiceClient.GetSetupDescriptionResponse retVal = ((Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap)(this)).GetSetupDescription(inValue);\r\n            return retVal.Body.GetSetupDescriptionResult;\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseResponse Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap.GetGetLicense(Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseRequest request)\r\n        {\r\n            return base.Channel.GetGetLicense(request);\r\n        }\r\n\r\n        public System.Xml.Linq.XElement GetGetLicense(string version, string installationId)\r\n        {\r\n            Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseRequest inValue = new Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseRequest();\r\n            inValue.Body = new Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseRequestBody();\r\n            inValue.Body.version = version;\r\n            inValue.Body.installationId = installationId;\r\n            Composite.Core.WebClient.Setup.WebServiceClient.GetGetLicenseResponse retVal = ((Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap)(this)).GetGetLicense(inValue);\r\n            return retVal.Body.GetGetLicenseResult;\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesResponse Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap.GetLanguages(Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesRequest request)\r\n        {\r\n            return base.Channel.GetLanguages(request);\r\n        }\r\n\r\n        public System.Xml.Linq.XElement GetLanguages(string version, string installationId)\r\n        {\r\n            Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesRequest inValue = new Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesRequest();\r\n            inValue.Body = new Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesRequestBody();\r\n            inValue.Body.version = version;\r\n            inValue.Body.installationId = installationId;\r\n            Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagesResponse retVal = ((Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap)(this)).GetLanguages(inValue);\r\n            return retVal.Body.GetLanguagesResult;\r\n        }\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesResponse Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap.GetLanguagePackages(Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesRequest request)\r\n        {\r\n            \r\n            return base.Channel.GetLanguagePackages(request);\r\n        }\r\n\r\n        public System.Xml.Linq.XElement GetLanguagePackages(string version, string installationId)\r\n        {\r\n            Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesRequest inValue = new Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesRequest();\r\n            inValue.Body = new Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesRequestBody();\r\n            inValue.Body.version = version;\r\n            inValue.Body.installationId = installationId;\r\n            Composite.Core.WebClient.Setup.WebServiceClient.GetLanguagePackagesResponse retVal = ((Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap)(this)).GetLanguagePackages(inValue);\r\n            return retVal.Body.GetLanguagePackagesResult;\r\n        }\r\n\r\n\r\n        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupResponse Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap.RegisterSetup(Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupRequest request)\r\n        {\r\n            return base.Channel.RegisterSetup(request);\r\n        }\r\n\r\n        public bool RegisterSetup(string version, string installationId, string setupDescriptionXml, string exception)\r\n        {\r\n            Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupRequest inValue = new Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupRequest();\r\n            inValue.Body = new Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupRequestBody();\r\n            inValue.Body.version = version;\r\n            inValue.Body.installationId = installationId;\r\n            inValue.Body.setupDescriptionXml = setupDescriptionXml;\r\n            inValue.Body.exception = exception;\r\n            Composite.Core.WebClient.Setup.WebServiceClient.RegisterSetupResponse retVal = ((Composite.Core.WebClient.Setup.WebServiceClient.SetupSoap)(this)).RegisterSetup(inValue);\r\n            return retVal.Body.RegisterSetupResult;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/StandardPlugins/SessionStateProviders/DefaultSessionStateProvider/DefaultSessionStateProvider.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing Composite.Data;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.State.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.WebClient.SessionStateProviders.DefaultSessionStateProvider\r\n{\r\n    [ConfigurationElementType(typeof(SessionStateProviderData))]\r\n    internal class DefaultSessionStateProvider : ISessionStateProvider\r\n    {\r\n        private static int _counter = 0;\r\n\r\n        public void AddState<T>(Guid stateId, T value, DateTime exirationDate)\r\n        {\r\n            PerformCleanUpIfNeeded();\r\n\r\n            var sessionStateEntry = DataFacade.BuildNew<ISessionStateEntry>();\r\n            sessionStateEntry.Id = stateId;\r\n            sessionStateEntry.ExpirationDate = exirationDate;\r\n            sessionStateEntry.SerializedValue = SerializationUtil.Serialize(value);\r\n\r\n            using(new DataScope(PublicationScope.Unpublished)) \r\n            using (Composite.Data.Transactions.TransactionsFacade.SuppressTransactionScope())\r\n            {\r\n                DataFacade.AddNew(sessionStateEntry);\r\n            }\r\n        }\r\n\r\n        public bool TryGetState<T>(Guid stateId, out T state)\r\n        {\r\n            ISessionStateEntry entry = GetSessionStateEntry(stateId);\r\n\r\n            if (entry == null)\r\n            {\r\n                state = default(T);\r\n                return false;\r\n            }\r\n\r\n            state = SerializationUtil.Deserialize<T>(entry.SerializedValue);\r\n            return true;\r\n        }\r\n\r\n        public void SetState<T>(Guid stateId, T value, DateTime expirationDate)\r\n        {\r\n            Verify.ArgumentNotNull(value, \"value\");\r\n            Verify.ArgumentCondition(expirationDate != DateTime.MaxValue, \"expirationDate\", \"Expiration date has to be achievable\");\r\n            Verify.ArgumentCondition(stateId != Guid.Empty, \"stateId\", \"Guid.Empty isn't an exceptable value.\");\r\n\r\n            ISessionStateEntry entry = GetSessionStateEntry(stateId);\r\n\r\n            if (entry == null)\r\n            {\r\n                AddState(stateId, value, expirationDate);\r\n                return;\r\n            }\r\n\r\n            entry.SerializedValue = SerializationUtil.Serialize(value);\r\n            entry.ExpirationDate = expirationDate;\r\n\r\n            using (new DataScope(PublicationScope.Unpublished)) \r\n            using (Composite.Data.Transactions.TransactionsFacade.SuppressTransactionScope())\r\n            {\r\n                DataFacade.Update(entry);\r\n            }\r\n        }\r\n\r\n        public void RemoveState(Guid stateId)\r\n        {\r\n            ISessionStateEntry entry = GetSessionStateEntry(stateId);\r\n\r\n            if (entry == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            using (Composite.Data.Transactions.TransactionsFacade.SuppressTransactionScope())\r\n            {\r\n                DataFacade.Delete(entry);\r\n            }\r\n        }\r\n\r\n        private static ISessionStateEntry GetSessionStateEntry(Guid stateId)\r\n        {\r\n            using (new DataScope(PublicationScope.Unpublished))\r\n            {\r\n                var queryable = DataFacade.GetData<ISessionStateEntry>();\r\n\r\n                ISessionStateEntry entry;\r\n                if (queryable.IsEnumerableQuery())\r\n                {\r\n                    entry = queryable.AsEnumerable().FirstOrDefault(row => row.Id == stateId);\r\n                }\r\n                else\r\n                {\r\n                    entry = queryable.FirstOrDefault(row => row.Id == stateId);\r\n                }\r\n\r\n                return entry;\r\n            }\r\n        }\r\n\r\n        private static void PerformCleanUpIfNeeded()\r\n        {\r\n            // Performingc cleaning-up at the first time with probability 20%, and on once per every 100 calls\r\n            int counter = Interlocked.Increment(ref _counter);\r\n            if (counter == 1)\r\n            {\r\n                if(DateTime.Now.Second % 5 != 3)\r\n                {\r\n                    return;\r\n                }\r\n            }\r\n            else if (counter % 100 != 1)\r\n            {\r\n                return;\r\n            }\r\n\r\n            CleanUpData();\r\n        }\r\n\r\n        private static void CleanUpData()\r\n        {\r\n            var now = DateTime.Now;\r\n            try\r\n            {\r\n                using (new DataScope(PublicationScope.Unpublished)) \r\n                using (Composite.Data.Transactions.TransactionsFacade.SuppressTransactionScope())\r\n                {\r\n                    DataFacade.Delete<ISessionStateEntry>(entry => entry.ExpirationDate < now);\r\n                }\r\n            }\r\n            catch(Exception e)\r\n            {\r\n                LoggingService.LogWarning(typeof(DefaultSessionStateProvider).Name, new InvalidOperationException(\"Failed to perform clean-up\", e));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/StandardPlugins/SessionStateProviders/DefaultSessionStateProvider/ISessionStateEntry.cs",
    "content": "﻿using System;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.WebClient.SessionStateProviders.DefaultSessionStateProvider\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Title(\"Session State Entry\")]\r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{91964c1b-35c1-446c-9e47-6b8d8e65997f}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n    [Caching(CachingType.Full)]\r\n    public interface ISessionStateEntry : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{8e0f00dc-a364-4bdc-bed4-0fa771cce148}\")]\r\n        Guid Id { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{f2ba2a81-cd6a-4e48-8f12-a4446a1df046}\")]\r\n        DateTime ExpirationDate { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{174b9f86-c45b-434a-a3a1-083f78fcfa93}\")]\r\n        string SerializedValue { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/StandardPlugins/SessionStateProviders/DefaultSessionStateProvider/SerializationUtil.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Xml;\r\nusing System.Xml.Serialization;\r\n\r\n\r\nnamespace Composite.Plugins.WebClient.SessionStateProviders.DefaultSessionStateProvider\r\n{\r\n    internal static class SerializationUtil\r\n    {\r\n        internal static readonly Encoding Encoding = Encoding.UTF8;\r\n\r\n        public static string SerializeInternal<T>(T value)\r\n        {\r\n            return SerializeInternal(typeof (T), value);\r\n        }\r\n\r\n        public static string SerializeInternal(Type type, object value)\r\n        {\r\n            XmlSerializer serializer = GetSerializer(type);\r\n\r\n            using (MemoryStream ms = new MemoryStream())\r\n            {\r\n                using (var xmlTextWriter = new XmlTextWriter(ms, Encoding))\r\n                {\r\n                    serializer.Serialize(xmlTextWriter, value);\r\n                }\r\n\r\n                return Encoding.GetString(ms.ToArray());\r\n            }\r\n        }\r\n\r\n        public static object DeserializeInternal(Type type, string serializedValue)\r\n        {\r\n            XmlSerializer serializer = GetSerializer(type);\r\n\r\n            byte[] bytes = Encoding.GetBytes(serializedValue);\r\n\r\n            using (var stream = new MemoryStream(bytes))\r\n            {\r\n                return serializer.Deserialize(stream);\r\n            }\r\n        }\r\n\r\n        public static string Serialize<T>(T value)\r\n        {\r\n            Type type = typeof (T);\r\n            if(TypeRequiresWrapping(type))\r\n            {\r\n                return SerializeInternal(new XmlSerializationWrapper(value));\r\n            }\r\n            return SerializeInternal<T>(value);\r\n        }\r\n\r\n        public static T Deserialize<T>(string serializedValue)\r\n        {\r\n            Type type = typeof (T);\r\n            if (TypeRequiresWrapping(type))\r\n            {\r\n                var wrapper = (XmlSerializationWrapper)DeserializeInternal(typeof (XmlSerializationWrapper), serializedValue);\r\n                return (T)wrapper.Deserialize();\r\n            }\r\n            return (T) DeserializeInternal(type, serializedValue);\r\n        }\r\n\r\n        private static bool TypeRequiresWrapping(Type type)\r\n        {\r\n            return type.IsInterface\r\n                   || type.FullName == \"System.Object\"\r\n                   || (type.IsClass && !type.IsSealed);\r\n        }\r\n\r\n        private static XmlSerializer GetSerializer(Type type)\r\n        {\r\n            // TODO: implement caching\r\n            return new XmlSerializer(type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/StandardPlugins/SessionStateProviders/DefaultSessionStateProvider/XmlSerializationWrapper.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Runtime.Serialization;\r\nusing System.Xml.Serialization;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Plugins.WebClient.SessionStateProviders.DefaultSessionStateProvider\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    [XmlRootAttribute(ElementName = \"root\")]\r\n    public sealed class XmlSerializationWrapper\r\n    {\r\n        /// <exclude />\r\n        public string TypeName;\r\n\r\n        /// <exclude />\r\n        public string AssebmlyName;\r\n\r\n        /// <exclude />\r\n        public string Value;\r\n\r\n\r\n        // For serialization purposes\r\n        /// <exclude />\r\n        public XmlSerializationWrapper()\r\n        {\r\n        }\r\n\r\n\r\n        internal XmlSerializationWrapper(object value)\r\n        {\r\n            Verify.ArgumentNotNull(value, \"value\");\r\n\r\n            Type type = value.GetType();\r\n\r\n            TypeName = type.FullName;\r\n            AssebmlyName = type.Assembly.GetName().Name;\r\n\r\n            Value = SerializationUtil.SerializeInternal(type, value);\r\n        }\r\n\r\n        /// <exclude />\r\n        public object Deserialize()\r\n        {\r\n            Verify.IsNotNull(AssebmlyName, \"'AssebmlyName' is null\");\r\n            Verify.IsNotNull(TypeName, \"'TypeName' is null\");\r\n\r\n            // TODO: Caching?\r\n            Assembly asm = AppDomain.CurrentDomain.GetAssemblies().Where(a => a.GetName().Name == AssebmlyName).FirstOrDefault();\r\n\r\n            if(asm == null) throw new SerializationException(\"Failed to find assembly '{0}'\".FormatWith(AssebmlyName));\r\n\r\n            Type type = asm.GetType(TypeName);\r\n            Verify.IsNotNull(type, \"Failed to get type '{0}' from assembly '{1}'\", AssebmlyName, TypeName);\r\n\r\n            return SerializationUtil.DeserializeInternal(type, Value);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/State/ISessionStateProvider.cs",
    "content": "﻿using System;\r\nusing Composite.Core.WebClient.State.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Core.WebClient.State\r\n{\r\n    /// <summary>\r\n    /// Defines access to a session state\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [CustomFactory(typeof(SessionStateProviderCustomFactory))]\r\n    public interface ISessionStateProvider \r\n    {\r\n        /// <exclude />\r\n        void AddState<T>(Guid stateId, T value, DateTime exirationDate);\r\n\r\n        /// <exclude />\r\n        bool TryGetState<T>(Guid stateId, out T state);\r\n\r\n        /// <exclude />\r\n        void SetState<T>(Guid stateId, T value, DateTime exirationDate);\r\n\r\n        /// <exclude />\r\n        void RemoveState(Guid stateId);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/State/Runtime/SessionStateProviderCustomFactory.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Core.WebClient.State.Runtime\r\n{\r\n    internal sealed class SessionStateProviderCustomFactory : AssemblerBasedCustomFactory<ISessionStateProvider, SessionStateProviderData>\r\n    {\r\n        protected override SessionStateProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            SessionStateProviderSettings settings = configurationSource.GetSection(SessionStateProviderSettings.SectionName) as SessionStateProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", SessionStateProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.Providers.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/State/Runtime/SessionStateProviderFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Core.WebClient.State.Runtime\r\n{\r\n    internal class SessionStateProviderFactory : NameTypeFactoryBase<ISessionStateProvider>\r\n    {\r\n        public SessionStateProviderFactory() \r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/State/Runtime/SessionStateProviderSettings.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nnamespace Composite.Core.WebClient.State.Runtime\r\n{\r\n    internal sealed class SessionStateProviderSettings :  SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Core.WebClient.Plugins.SessionStateProviderConfiguration\";\r\n\r\n        private const string _providersPropertyName = \"Providers\";\r\n        [ConfigurationProperty(_providersPropertyName)]\r\n        public NameTypeConfigurationElementCollection<SessionStateProviderData, SessionStateProviderData> Providers\r\n        {\r\n            get { return (NameTypeConfigurationElementCollection<SessionStateProviderData, SessionStateProviderData>)base[_providersPropertyName]; }\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(NonConfigurableSessionStateProviderDataAssembler))]\r\n    internal class SessionStateProviderData : NameTypeConfigurationElement\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableSessionStateProviderDataAssembler : IAssembler<ISessionStateProvider, SessionStateProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public ISessionStateProvider Assemble(IBuilderContext context, SessionStateProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (ISessionStateProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Core/WebClient/State/StateManager.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.State.Runtime;\r\n\r\nnamespace Composite.Core.WebClient.State\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class SessionStateManager\r\n    {\r\n        /// <exclude />\r\n        public static readonly string DefaultProviderName = \"Default\"; \r\n\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n        static SessionStateManager()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static ISessionStateProvider DefaultProvider\r\n        {\r\n            get { return GetProvider(DefaultProviderName); }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static ISessionStateProvider GetProvider(string name)\r\n        {\r\n            var resources = _resourceLocker;\r\n\r\n            ISessionStateProvider provider;\r\n\r\n            if (!resources.Resources.Providers.TryGetValue(name, out provider))\r\n            {\r\n                lock (resources)\r\n                {\r\n                    if (!resources.Resources.Providers.TryGetValue(name, out provider))\r\n                    {\r\n                        try\r\n                        {\r\n                            provider = resources.Resources.Factory.Create(name);\r\n\r\n                            resources.Resources.Providers.Add(name, provider);\r\n                        }\r\n                        catch (ArgumentException ex)\r\n                        {\r\n                            HandleConfigurationError(ex);\r\n                        }\r\n                        catch (ConfigurationErrorsException ex)\r\n                        {\r\n                            HandleConfigurationError(ex);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return provider;\r\n        }\r\n\r\n        private static void Flush()\r\n        {\r\n            var resourceLocker = _resourceLocker;\r\n            lock (resourceLocker)\r\n            {\r\n                resourceLocker.ResetInitialization();\r\n            }\r\n        }\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(\"Failed to load the configuration section '{0}' from the configuration.\".FormatWith(SessionStateProviderSettings.SectionName), ex);\r\n        }\r\n\r\n        private sealed class Resources\r\n        {\r\n            public SessionStateProviderFactory Factory { get; set; }\r\n            public Hashtable<string, ISessionStateProvider> Providers { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new SessionStateProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.Providers = new Hashtable<string, ISessionStateProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/StyleLoader.cs",
    "content": "﻿using Composite.Core.IO;\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class StyleLoader\r\n    {\r\n        /// <exclude />\r\n        public static string Render(string directive = null)\r\n        {\r\n            string root = UrlUtils.AdminRootPath;\r\n\r\n            bool isInDevelopMode = CookieHandler.Get(\"mode\") == \"develop\";\r\n\r\n            string styleFile = isInDevelopMode \r\n                ? \"/styles/styles.css\" \r\n                : \"/styles/styles.min.css\";\r\n\r\n            string cssLink = root + styleFile;\r\n\r\n            string filePath = PathUtil.Resolve(\"~/Composite\" + styleFile);\r\n            if (C1File.Exists(filePath))\r\n            {\r\n                cssLink += \"?timestamp=\" + C1File.GetLastWriteTimeUtc(filePath).GetHashCode();\r\n            }\r\n\r\n            return stylesheet(cssLink);\r\n        }\r\n\r\n        private static string stylesheet(string url)\r\n        {\r\n            return @\"<link rel=\"\"stylesheet\"\" type=\"\"text/css\"\" href=\"\"\" + url + @\"\"\"/>\";\r\n        }\r\n    }\r\n\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/TemplatePreviewRouteHandler.cs",
    "content": "using System;\r\nusing System.Web;\r\nusing System.Web.Routing;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient.Services.WysiwygEditor;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    internal class TemplatePreviewRoute : Route\r\n    {\r\n        // Adding \"x\" as a fictional paramter, so MVC wouldn't use this route for producing outbound links\r\n        public TemplatePreviewRoute() : base(\"Renderers/TemplatePreviewImag{e}\", new TemplatePreviewRouteHandler()) { }\r\n    }\r\n\r\n    \r\n    internal class TemplatePreviewRouteHandler : IRouteHandler\r\n    {\r\n        public IHttpHandler GetHttpHandler(RequestContext requestContext)\r\n        {\r\n            return new TemplatePreviewHttpHandler();\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Renders image that shows information about a function information in Visual Editor\r\n    /// </summary>\r\n    internal class TemplatePreviewHttpHandler : IHttpHandler\r\n    {\r\n        public void ProcessRequest(HttpContext context)\r\n        {\r\n            if (!UserValidationFacade.IsLoggedIn())\r\n            {\r\n                context.Response.ContentType = MimeTypeInfo.Text;\r\n                context.Response.Write(\"No user logged in\");\r\n                context.Response.StatusCode = 401;\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                string t = context.Request[\"t\"];\r\n                Verify.That(!t.IsNullOrEmpty(), \"Missing query string argument 't'\");\r\n\r\n                string p = context.Request[\"p\"];\r\n                Verify.That(!p.IsNullOrEmpty(), \"Missing query string argument 'p'\");\r\n\r\n                Guid templateId = Guid.Parse(t);\r\n                Guid pageId = Guid.Parse(p);\r\n\r\n\r\n                PageTemplatePreview.GetPreviewInformation(context, pageId, templateId, out string filePath, out _);\r\n\r\n                Verify.That(C1File.Exists(filePath), \"Preview file missing\");\r\n                context.Response.ContentType = \"image/png\";\r\n                context.Response.WriteFile(filePath);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(nameof(TemplatePreviewHttpHandler), ex);\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n        public bool IsReusable => true;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/BindingUpdatePanel.cs",
    "content": "﻿//using System.ComponentModel;\r\n//using System.Web.UI;\r\n//using System.Web.UI.WebControls;\r\n//using Composite.Core.IO;\r\n//using System.Globalization;\r\n\r\n//using Composite.Core.WebClient.UiControlLib.Foundation;\r\n\r\n//namespace Composite.Core.WebClient.UiControlLib\r\n//{\r\n//    public enum RepaintModeOptions\r\n//    {\r\n//        Normal,\r\n//        Hidden,\r\n//        Suspended\r\n//    }\r\n\r\n//    public class DisabledUpdatePanel : PlaceHolder\r\n//    {\r\n//        public DisabledUpdatePanel()\r\n//        {\r\n//            ChildrenAsTriggers = true;\r\n//            UpdateMode = UpdatePanelUpdateMode.Always;\r\n//        }\r\n\r\n//        public bool IsInPartialRendering\r\n//        {\r\n//            get\r\n//            {\r\n//                return false;\r\n//            }\r\n//        }\r\n\r\n//        public UpdatePanelUpdateMode UpdateMode { get; set; }\r\n        \r\n//        public bool ChildrenAsTriggers { get; set; }\r\n\r\n//        public Control ContentTemplateContainer\r\n//        {\r\n//            get\r\n//            {\r\n//                return this;\r\n//            }\r\n//        }\r\n\r\n//        public void Update()\r\n//        {\r\n//            // Do nothing\r\n//        }\r\n//    }\r\n\r\n\r\n//    public class BindingUpdatePanel : /* DisabledUpdatePanel */ UpdatePanel \r\n//    {\r\n//        public BindingUpdatePanel()\r\n//        {\r\n//            this.RepaintMode = RepaintModeOptions.Normal;\r\n//        }\r\n\r\n\r\n//        private bool _rendered = false;\r\n\r\n//        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"CSS class names\")]\r\n//        public string CssClass { get; set; }\r\n\r\n//        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"How repaints should be handled on the client (Normal, Hidden or Suspended)\")]\r\n//        public RepaintModeOptions RepaintMode { get; set; }// normal, hidden, suspended\r\n\r\n//        [Category(\"Appearance\"), DefaultValue(\"\")]\r\n//        public string Flex { get; set; }\r\n        \r\n//        [Category(\"Appearance\"), DefaultValue(\"\")]\r\n//        public string ForceFitness { get; set; }\r\n\r\n//        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"Some ui:updatepanels may be of a specialized type\")]\r\n//        public string ClientType { get; set; }\r\n\r\n\r\n//        protected override void RenderChildren(HtmlTextWriter writer)\r\n//        {\r\n//            if (this.IsInPartialRendering==false)\r\n//            {\r\n//                if (string.IsNullOrEmpty(this.CssClass) == false)\r\n//                {\r\n//                    writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);\r\n//                }\r\n\r\n//                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);\r\n//                writer.AddAttribute(\"repaintmode\", this.RepaintMode.ToString().ToLower());\r\n//                if (string.IsNullOrEmpty(this.Flex)==false) writer.AddAttribute(\"flex\", this.Flex);\r\n//                if (string.IsNullOrEmpty(this.ForceFitness)==false) writer.AddAttribute(\"forcefitness\", this.ForceFitness);\r\n//                if (string.IsNullOrEmpty(this.ClientType) == false) writer.AddAttribute(\"type\", this.ClientType);\r\n\r\n//                writer.RenderBeginTag(\"ui:updatepanel\");\r\n//                writer.RenderBeginTag(\"ui:updatepanelbody\");\r\n\r\n//                HtmlTextWriter writer2 = new HtmlTextWriter(new StringWriter(Users.UserSettings.CultureInfo));\r\n//                base.RenderChildren(writer2);\r\n//                string innerMarkupWithUnwantedDiv = writer2.InnerWriter.ToString();\r\n\r\n//                int openTagEnd = innerMarkupWithUnwantedDiv.IndexOf('>');\r\n//                int closeTagStart = innerMarkupWithUnwantedDiv.LastIndexOf('<');\r\n\r\n//                if (closeTagStart > openTagEnd)\r\n//                {\r\n//                    writer.Write( innerMarkupWithUnwantedDiv.Substring( openTagEnd+1, (closeTagStart - openTagEnd)-1 ));\r\n//                }\r\n\r\n//                writer.RenderEndTag();\r\n//                writer.RenderEndTag();\r\n//            }\r\n//            else\r\n//            {\r\n//                if (_rendered==true)\r\n//                {\r\n//                    return;\r\n//                }\r\n\r\n//                base.RenderChildren(writer);\r\n//            }\r\n//            _rendered = true;\r\n//        }\r\n\r\n\r\n//    }\r\n//}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/CheckBox.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\n\r\n\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class CheckBox : System.Web.UI.WebControls.CheckBox\r\n    {\r\n        /// <exclude />\r\n        public string ItemLabel\r\n        {\r\n            get { return (string) ViewState[nameof(ItemLabel)]; }\r\n            set { ViewState[nameof(ItemLabel)] = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            writer.WriteBeginTag(\"ui:checkbox\");\r\n\r\n            writer.WriteAttribute(\"label\", StringResourceSystemFacade.ParseString(this.ItemLabel ?? \"\"));\r\n\r\n            if (!string.IsNullOrEmpty(this.ToolTip))\r\n            {\r\n                writer.WriteAttribute(\"title\", StringResourceSystemFacade.ParseString(this.ToolTip ?? \"\"));\r\n            }\r\n\r\n            writer.WriteAttribute(\"name\", this.UniqueID);\r\n\r\n            if (this.AutoPostBack)\r\n            {\r\n                writer.WriteAttribute(\"callbackid\", this.ClientID);\r\n                writer.WriteAttribute(\"oncommand\", \"this.dispatchAction(PageBinding.ACTIONEVENT_DOPOSTBACK);\");\r\n            }\r\n\r\n            writer.WriteAttribute(\"ischecked\", this.Checked.ToString().ToLower());\r\n\r\n            this.WriteClientAttributes(writer);\r\n\r\n            writer.Write(HtmlTextWriter.SelfClosingTagEnd);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/ClickButton.cs",
    "content": "﻿using System.ComponentModel;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\n\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ClickButton : LinkButton\r\n    {\r\n        /// <exclude />\r\n        public ClickButton()\r\n        {\r\n            this.AutoPostBack = true;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"The id the ui client should see\")]\r\n        public virtual string CustomClientId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"Client sceipt that ensure post back should be appended to CustomClientScript. Default is true.\")]\r\n        public virtual bool AutoPostBack { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"Image to show in the buttom\")]\r\n        public virtual string ImageUrl { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"Image to show in the buttom when the button is disabled\")]\r\n        public virtual string ImageUrlWhenDisabled { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            writer.WriteBeginTag(\"ui:clickbutton\");\r\n\r\n            writer.WriteAttribute(\"label\", StringResourceSystemFacade.ParseString(this.Text));\r\n            writer.WriteAttribute(\"callbackid\", this.ClientID);\r\n\r\n            string oncommand = \"\";\r\n            if (string.IsNullOrEmpty(this.OnClientClick) == false)\r\n            {\r\n                oncommand += this.OnClientClick;\r\n            }\r\n            if (this.AutoPostBack)\r\n            {\r\n                if (oncommand.Length > 0 && oncommand.Trim().EndsWith(\";\") == false)\r\n                {\r\n                    oncommand += \";\";\r\n                }\r\n\t\t\t\t\r\n\t\t\t\t// now implied by callbackid!\r\n                // oncommand += \"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\";\r\n            }\r\n            if (string.IsNullOrEmpty(oncommand) == false)\r\n            {\r\n                writer.WriteAttribute(\"oncommand\", oncommand);\r\n            }\r\n\r\n            if (string.IsNullOrEmpty(this.CustomClientId) == false)\r\n            {\r\n                writer.WriteAttribute(\"id\", this.CustomClientId);\r\n            }\r\n            if (string.IsNullOrEmpty(this.ImageUrl) == false)\r\n            {\r\n                writer.WriteAttribute(\"image\", this.ImageUrl);\r\n            }\r\n            if (string.IsNullOrEmpty(this.ImageUrlWhenDisabled) == false)\r\n            {\r\n                writer.WriteAttribute(\"image-disabled\", this.ImageUrlWhenDisabled);\r\n            }\r\n            if (this.Enabled == false)\r\n            {\r\n                writer.WriteAttribute(\"isdisabled\", \"true\");\r\n            }\r\n\r\n            this.WriteClientAttributes(writer);\r\n\r\n\r\n            writer.Write(HtmlTextWriter.SelfClosingTagEnd);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/ComboBox.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\n\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ComboBox : DropDownList\r\n    {\r\n        private static readonly string ReservedKey = \"___reserved value\";\r\n\r\n        /// <exclude />\r\n        public bool SelectionRequired { get; set; }\r\n\r\n        /// <exclude />\r\n        public string SelectionRequiredLabel { get; set; }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override HtmlTextWriterTag TagKey\r\n        {\r\n            get { return HtmlTextWriterTag.Unknown; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override string TagName\r\n        {\r\n            get { return \"ui:datainputselector\"; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void AddAttributesToRender(HtmlTextWriter writer)\r\n        {\r\n            writer.AddAttribute(\"name\", this.UniqueID);\r\n            writer.AddAttribute(\"callbackid\", this.ClientID);\r\n\r\n            if (this.AutoPostBack)\r\n            {\r\n                writer.AddAttribute(\"onselectionchange\", \"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\");\r\n            }\r\n            if (this.SelectionRequired)\r\n            {\r\n                writer.AddAttribute(\"required\", \"true\");\r\n                string requiredLabel = this.SelectionRequiredLabel;\r\n                if (string.IsNullOrEmpty(requiredLabel)) requiredLabel = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AspNetUiControl.Selector.SelectValueLabel\");\r\n                writer.AddAttribute(\"label\", requiredLabel);\r\n            }\r\n\r\n            if(!SelectedValue.IsNullOrEmpty())\r\n            {\r\n                writer.AddAttribute(\"value\", SelectedValue);\r\n            }\r\n\r\n            this.AddClientAttributes(writer);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string SelectedValue\r\n        {\r\n            get\r\n            {\r\n                return base.SelectedValue;\r\n            }\r\n            set\r\n            {\r\n                if(this.Items.FindByValue(value) == null)\r\n                {\r\n                    this.Items.Add(new ListItem(ReservedKey, value));\r\n                }\r\n                base.SelectedValue = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void RenderContents(HtmlTextWriter writer)\r\n        {\r\n            for (int i = 0; i < this.Items.Count; i++)\r\n            {\r\n                if (Items[i].Text == ReservedKey)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                string label = StringResourceSystemFacade.ParseString(this.Items[i].Text);\r\n\r\n                int firstNonSpaceSpacePosition = 0;\r\n                while (firstNonSpaceSpacePosition < label.Length && label.Substring(firstNonSpaceSpacePosition, 1) == \" \")\r\n                    firstNonSpaceSpacePosition++;\r\n\r\n                string spacing = new String(Convert.ToChar(160), firstNonSpaceSpacePosition * 2);\r\n                this.Items[i].Text = string.Concat(spacing, label.Substring(firstNonSpaceSpacePosition));\r\n            }\r\n\r\n            ListItemCollection items = this.Items;\r\n\r\n            if (items.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            foreach(ListItem item in items)\r\n            {\r\n                if (!item.Enabled || item.Text == ReservedKey)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                writer.WriteBeginTag(\"ui:selection\");\r\n\r\n                writer.WriteAttribute(\"value\", item.Value, true);\r\n\r\n                //if (this.Page != null)\r\n                //{\r\n                //    this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, item.Value);\r\n                //}\r\n                writer.Write(HtmlTextWriter.SelfClosingTagEnd);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection)\r\n        {\r\n            string postedValue = postCollection[postDataKey];\r\n            if(!postedValue.IsNullOrEmpty() && this.Items.FindByValue(postedValue) == null)\r\n            {\r\n                this.Items.Add(new ListItem(ReservedKey, postedValue));\r\n            }\r\n\r\n            return base.LoadPostData(postDataKey, postCollection);\r\n        } \r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/DataInput.cs",
    "content": "﻿using System.ComponentModel;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing Castle.Core.Internal;\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\n\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum DataInputType\r\n    {\r\n        /// <exclude />\r\n        Default,\r\n\r\n        /// <exclude />\r\n        Integer,\r\n\r\n        /// <exclude />\r\n        Decimal,\r\n\r\n        /// <exclude />\r\n        Password,\r\n\r\n        /// <exclude />\r\n        ProgrammingIdentifier,\r\n\r\n        /// <exclude />\r\n        ProgrammingNamespace,\r\n\r\n        /// <exclude />\r\n        ReadOnly\r\n    }\r\n\r\n\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class DataInput : TextBox\r\n    {\r\n        /// <exclude />\r\n        public DataInput()\r\n            : base()\r\n        {\r\n            this.InputType = DataInputType.Default;\r\n        }\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"The type of data expected in this field\")]\r\n        public virtual DataInputType InputType { get; set; }\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"Language to use for spell check for input field\")]\r\n        public virtual string Language { get; set; }\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(0), Description(\"The required minimum length of this field. Default is 0 (no minimum).\")]\r\n        public virtual int MinLength { get; set; }\r\n\r\n        /// <exclude />\r\n        protected override HtmlTextWriterTag TagKey\r\n        {\r\n            get { return HtmlTextWriterTag.Unknown; }\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override string TagName\r\n        {\r\n            get { return \"ui:datainput\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void AddAttributesToRender(HtmlTextWriter writer)\r\n        {\r\n            writer.AddAttribute(\"value\", this.Text);\r\n            writer.AddAttribute(\"name\", this.UniqueID);\r\n\r\n            if (this.MaxLength > 0)\r\n            {\r\n                writer.AddAttribute(\"maxlength\", this.MaxLength.ToString());\r\n            }\r\n\r\n            if (this.MinLength > 0)\r\n            {\r\n                writer.AddAttribute(\"minlength\", this.MinLength.ToString());\r\n            }\r\n\r\n            if (this.AutoPostBack)\r\n            {\r\n                writer.AddAttribute(\"callbackid\", this.ClientID);\r\n                writer.AddAttribute(\"onvaluechange\", \"this.dispatchAction ( PageBinding.ACTION_DOPOSTBACK )\");\r\n            }\r\n\r\n            if (!this.Language.IsNullOrEmpty())\r\n            {\r\n                writer.AddAttribute(\"lang\", Language);\r\n            }\r\n\r\n            if (!Enabled)\r\n            {\r\n                writer.AddAttribute(\"isdisabled\", \"true\");\r\n            }\r\n\r\n            if (this.InputType != DataInputType.Default)\r\n            {\r\n                switch (this.InputType)\r\n                {\r\n                    case DataInputType.Integer:\r\n                        writer.AddAttribute(\"type\", \"integer\");\r\n                        break;\r\n                    case DataInputType.Decimal:\r\n                        writer.AddAttribute(\"type\", \"number\");\r\n                        break;\r\n                    case DataInputType.Password:\r\n                        writer.AddAttribute(\"password\", \"true\");\r\n                        break;\r\n                    case DataInputType.ProgrammingIdentifier:\r\n                        writer.AddAttribute(\"type\", \"programmingidentifier\");\r\n                        break;\r\n                    case DataInputType.ProgrammingNamespace:\r\n                        writer.AddAttribute(\"type\", \"programmingnamespace\");\r\n                        break;\r\n                    case DataInputType.ReadOnly:\r\n                        writer.AddAttribute(\"readonly\", \"true\");\r\n                        break;\r\n                    default:\r\n                        break;\r\n                }\r\n            }\r\n\r\n            this.AddClientAttributes(writer);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/DocumentDirtyEvent.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <summary>\r\n    /// When added to a document, the document will be marked as 'dirty' and the save button will be enabled.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class DocumentDirtyEvent : BaseControl\r\n    {\r\n        /// <exclude />\r\n        public DocumentDirtyEvent()\r\n            : base(\"ui:binding\")\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void RenderAttributes(HtmlTextWriter writer)\r\n        {\r\n            Attributes[\"onattach\"] = \"this.dispatchAction(Binding.ACTION_DIRTY);\";\r\n\r\n            base.RenderAttributes(writer);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/Feedback.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <summary>\r\n    /// Creates a few tags that are responsible for communiation with C1 backend UI's javascript.\r\n    /// </summary>\r\n    /// <example>\r\n    /// <code>\r\n    ///   &lt;aspui:Feedback runat=\"server\"  OnCommand=\"MethodToBeExecutedOnCommand\" ResponseStatus=\"ResponseStatus\" /&gt;\r\n    /// </code>  \r\n    /// \r\n    ///   is an equivalent to the following markup:\r\n    /// <code>    \r\n    ///  &lt;ui:feedbackset id=\"feedback\"&gt;\r\n    ///    &lt;!-- request --&gt;\r\n    ///    &lt;aspui:Generic runat=\"server\"\r\n    ///        ID=\"btnRequest\"\r\n    ///        OnCommand=\"MethodToBeExecutedOnCommand\"\r\n    ///        TagName=\"ui:request\"\r\n    ///        clientid=\"request\"\r\n    ///        callbackid=\"request\"\r\n    ///        value=\"\"/&gt;\r\n    ///\t\t\r\n    ///    &lt;!-- response --&gt;\r\n    ///    &lt;aspui:Generic runat=\"server\"\r\n    ///        ID=\"tagResponse\"\r\n    ///        TagName=\"ui:response\"\r\n    ///        clientid=\"response\"\r\n    ///        status=\"ResponseStatus\"/&gt;\r\n\t///\t\r\n    ///  &lt;/ui:feedbackset&gt;\r\n    /// </code> \r\n    /// </example>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Feedback : Generic\r\n    {\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public enum Status\r\n        {\r\n            /// <exclude />\r\n            Empty = 0,\r\n\r\n            /// <exclude />\r\n            Success = 1,\r\n\r\n            /// <exclude />\r\n            Failure = 2,\r\n\r\n            /// <exclude />\r\n            Ping = 3\r\n        }\r\n\r\n        private Generic _requestTag;\r\n        private Generic _responseTag;\r\n        private Generic _consoleIdField;\r\n        private Generic _viewIdField;\r\n\r\n        private string _consoleId;\r\n\r\n        /// <exclude />\r\n        public Feedback(string emptyParameter) : base(\"ui:feedbackset\")\r\n        {\r\n            this.Attributes[\"clientid\"] = \"feedback\";\r\n\r\n            _requestTag = new Generic(\"ui:request\");\r\n            _requestTag.Attributes[\"clientid\"] = \"__REQUEST\";\r\n            _requestTag.Attributes[\"callbackid\"] = \"__REQUEST\";\r\n\r\n            _responseTag = new Generic(\"ui:response\");\r\n            _responseTag.Attributes[\"clientid\"] = \"__RESPONSE\";\r\n            _responseTag.Attributes[\"checksum\"] = DateTime.Now.Ticks.ToString();\r\n\r\n            _consoleIdField = new Generic(\"input\");\r\n            _consoleIdField.Attributes[\"type\"] = \"hidden\";\r\n            _consoleIdField.Attributes[\"clientid\"] = \"__CONSOLEID\";\r\n            _consoleIdField.Attributes[\"name\"] = \"__CONSOLEID\";\r\n\r\n            _viewIdField = new Generic(\"input\");\r\n            _viewIdField.Attributes[\"type\"] = \"hidden\";\r\n            _viewIdField.Attributes[\"clientid\"] = \"__VIEWID\";\r\n            _viewIdField.Attributes[\"name\"] = \"__VIEWID\";\r\n\r\n            // Persisting \"__CONSOLEID\" field value\r\n            _consoleId = GetConsoleId();\r\n            if (!_consoleId.IsNullOrEmpty())\r\n            {\r\n                _consoleIdField.Attributes[\"value\"] = _consoleId;\r\n            }\r\n\r\n            this.Controls.Add(_requestTag);\r\n            this.Controls.Add(_responseTag);\r\n            _requestTag.Controls.Add(_consoleIdField);\r\n            _requestTag.Controls.Add(_viewIdField);\r\n        }\r\n\r\n        /// <exclude />\r\n        public string OnCommand\r\n        {\r\n            set { _requestTag.Attributes[\"OnCommand\"] = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ResponseStatus\r\n        {\r\n            set { _responseTag.Attributes[\"status\"] = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetStatus(Status status)\r\n        {\r\n            switch (status)\r\n            {\r\n                case Status.Empty:\r\n                    _responseTag.Attributes.Remove(\"status\");\r\n                    break;\r\n                case Status.Success:\r\n                    ResponseStatus = \"success\";\r\n                    break;\r\n                case Status.Failure:\r\n                    ResponseStatus = \"failure\";\r\n                    break;\r\n                case Status.Ping:\r\n                    ResponseStatus = \"ooookay\";\r\n                    break;\r\n                default:\r\n                    Core.Logging.LoggingService.LogWarning(typeof(Feedback).FullName, \"Unexpected status value \");\r\n                    break;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetStatus(bool success)\r\n        {\r\n            SetStatus(success ? Status.Success : Status.Failure);\r\n        }\r\n\r\n        /// <exclude />\r\n        public string GetPostedMessage()\r\n        {\r\n            return this.Page.IsPostBack ? this.Page.Request.Form[\"__REQUEST\"] : string.Empty; \r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool IsPosted\r\n        {\r\n            get \r\n            {\r\n                return Page.IsPostBack && Page.Request.Form[\"__EVENTTARGET\"].Replace('$', '_') == _requestTag.Attributes[\"clientid\"].Replace('$', '_');\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void OnPreRender(EventArgs e)\r\n        {\r\n            // Setting default status value - \"Ping\"\r\n            if (_requestTag.IsPosted \r\n                && _responseTag.Attributes[\"status\"].IsNullOrEmpty()\r\n                && GetPostedMessage() == \"refresh\")\r\n            {\r\n                SetStatus(Status.Ping);\r\n            }\r\n\r\n            // Updating information about console mesages system\r\n            if (_consoleId != null)\r\n            {\r\n                int messageNumber = C1Console.Events.ConsoleMessageQueueFacade.GetLatestMessageNumber(_consoleId);\r\n                _responseTag.Attributes[\"messagequeueindex\"] = messageNumber.ToString();\r\n            }\r\n\r\n            base.OnPreRender(e);\r\n        }\r\n\r\n\r\n        private static string GetConsoleId()\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if (httpContext != null\r\n                && httpContext.Request != null)\r\n            {\r\n                var request = httpContext.Request;\r\n                return request.QueryString[\"consoleId\"] ?? httpContext.Request.Form[\"__CONSOLEID\"];\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        /// <exclude />\r\n        public void MarkAsDirty()\r\n        {\r\n             this._responseTag.Attributes[\"dirty\"] = \"true\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/FieldMessage.cs",
    "content": "﻿\r\nusing System;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\n\r\nusing System.Web;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class FieldMessage : Label\r\n    {\r\n        /// <exclude />\r\n        public FieldMessage(string targetName, string text)\r\n        {\r\n            this.TargetName = targetName;\r\n            this.Text = text;\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual string TargetName { get; set; }\r\n\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            writer.WriteBeginTag(\"ui:errorset\");\r\n            writer.WriteAttribute(\"timestamp\", HttpUtility.HtmlAttributeEncode(DateTime.Now.Ticks.ToString()));\r\n            writer.Write(HtmlTextWriter.TagRightChar);\r\n            \r\n\r\n            writer.WriteBeginTag(\"ui:error\");\r\n\r\n            writer.WriteAttribute(\"text\", HttpUtility.HtmlAttributeEncode(StringResourceSystemFacade.ParseString(this.Text)));\r\n            writer.WriteAttribute(\"targetname\", HttpUtility.HtmlAttributeEncode(this.TargetName));\r\n\r\n            writer.Write(HtmlTextWriter.SelfClosingTagEnd);\r\n\r\n            writer.WriteEndTag(\"ui:errorset\");\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/Foundation/BaseControl.cs",
    "content": "﻿using System;\r\nusing System.Web.UI.HtmlControls;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib.Foundation\r\n{\r\n    /// <summary>\r\n    /// A generic control with support for client identifiers.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class BaseControl : HtmlGenericControl\r\n    {\r\n        private string _clientID;\r\n\r\n        /// <exclude />\r\n        public BaseControl(string tagName) : base(tagName)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnInit(EventArgs e)\r\n        {\r\n            string clientID = this.Attributes[\"ClientID\"];\r\n            if(clientID.IsNullOrEmpty())\r\n            {\r\n                clientID = Attributes[\"clientid\"];\r\n\r\n                if (clientID.IsNullOrEmpty())\r\n                {\r\n                    clientID = null;\r\n                }\r\n            }\r\n            _clientID = clientID;\r\n\r\n            base.OnInit(e);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string  ClientID\r\n        {\r\n        \tget \r\n        \t{ \r\n                if(_clientID != null)\r\n                {\r\n                    return _clientID;\r\n                }\r\n\r\n                if(this.ID != null)\r\n                {\r\n                    return base.UniqueID;\r\n                }\r\n\r\n        \t    return null;\r\n        \t}\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/Foundation/ClientAttributes.cs",
    "content": "﻿using System.Web.UI.WebControls;\r\nusing System.Web.UI;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib.Foundation\r\n{\r\n    /// <exclude />\r\n\tpublic static class ClientAttributes\r\n\t{\r\n        internal static void WriteClientAttributes(this WebControl uiControl, HtmlTextWriter writer)\r\n        {\r\n            foreach (string attributeName in uiControl.Attributes.Keys)\r\n            {\r\n                string attributeNameLower = attributeName.ToLowerInvariant();\r\n                if (attributeNameLower.StartsWith(\"client_\"))\r\n                {\r\n                    string clientAttributeName = attributeNameLower.Substring(\"client_\".Length);\r\n                    writer.WriteAttribute(clientAttributeName, uiControl.Attributes[attributeName]);\r\n                }\r\n            }\r\n        }\r\n\r\n        internal static void AddClientAttributes(this WebControl uiControl, HtmlTextWriter writer)\r\n        {\r\n            foreach (string attributeName in uiControl.Attributes.Keys)\r\n            {\r\n                string attributeNameLower = attributeName.ToLowerInvariant();\r\n                if (attributeNameLower.StartsWith(\"client_\"))\r\n                {\r\n                    string clientAttributeName = attributeNameLower.Substring(\"client_\".Length);\r\n                    writer.AddAttribute(clientAttributeName, uiControl.Attributes[attributeName]);\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void CopyClientAttributesTo(this UserControl uiControl, WebControl targetControl)\r\n        {\r\n            foreach (string attributeName in uiControl.Attributes.Keys)\r\n            {\r\n                string attributeNameLower = attributeName.ToLowerInvariant();\r\n                if (attributeNameLower.StartsWith(\"client_\"))\r\n                {\r\n                    targetControl.Attributes[attributeName] = uiControl.Attributes[attributeName];\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/Generic.cs",
    "content": "﻿using System;\r\nusing System.Reflection;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <summary>\r\n    /// To be used for creating stateless tags. Copies all the attributes from markup to the generated tag,\r\n    /// the \"clientid\" attribute will be transformed to \"id\" attribute.\r\n    /// </summary>\r\n    /// <exclude />    \r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Generic : HtmlGenericControl \r\n    {\r\n        private string _callbackid;\r\n        private string _methodName;\r\n        private bool? _posted;\r\n\r\n\r\n        /// <exclude />\r\n        public Generic(string tag)\r\n            : base(tag)\r\n        {\r\n            base.EnableViewState = false;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public virtual bool IsPosted\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_posted, \"This property isn't awailable until 'PageLoad' event\");\r\n                return _posted.Value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnLoad(System.EventArgs e)\r\n        {\r\n            _posted = false;\r\n            base.OnLoad(e);\r\n\r\n            if (Attributes[\"HasCallbackId\"] == \"true\" && Attributes[\"callbackid\"].IsNullOrEmpty())\r\n            {\r\n                Attributes.Remove(\"HasCallbackId\");\r\n                Attributes[\"callbackid\"] = this.UniqueID;\r\n            }\r\n\r\n            _callbackid = this.Attributes[\"callbackid\"] ?? string.Empty;\r\n            _methodName = Attributes[\"OnCommand\"];\r\n\r\n            // NOTE: to be removed\r\n            if(_methodName.IsNullOrEmpty())\r\n            {\r\n                _methodName = Attributes[\"OnServerClick\"];\r\n            }\r\n\r\n            if(_callbackid != null\r\n                && Page.IsPostBack \r\n                && !Page.Request.Form[\"__EVENTTARGET\"].IsNullOrEmpty()\r\n                && Page.Request.Form[\"__EVENTTARGET\"].Replace('$', '_') == _callbackid.Replace('$', '_'))\r\n            {\r\n                _posted = true;\r\n                if(_methodName != null)\r\n                {\r\n                    this.Page.RegisterRequiresRaiseEvent(new PostBackEventHandler(this));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override void RenderAttributes(HtmlTextWriter writer)\r\n        {\r\n            string clientId = Attributes[\"clientid\"];\r\n            if(clientId.IsNullOrEmpty() && !ID.IsNullOrEmpty())\r\n            {\r\n                clientId = ID;\r\n            }\r\n\r\n            if (!clientId.IsNullOrEmpty())\r\n            {\r\n                writer.WriteAttribute(\"id\", clientId);\r\n\r\n                Attributes.Remove(\"clientid\");\r\n            }\r\n\r\n            string label = Attributes[\"label\"];\r\n            if (!label.IsNullOrEmpty())\r\n            {\r\n                Attributes[\"label\"] = StringResourceSystemFacade.ParseString(label);\r\n            }\r\n\r\n            Attributes.Remove(\"OnServerClick\"); // Server-side attribute\r\n            Attributes.Remove(\"OnCommand\"); // Server-side attribute\r\n\r\n            this.Attributes.Render(writer);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected class PostBackEventHandler : IPostBackEventHandler\r\n        {\r\n            private Generic _control;\r\n\r\n\r\n            /// <exclude />\r\n            public PostBackEventHandler(Generic control)\r\n            {\r\n                _control = control;\r\n            }\r\n\r\n\r\n            /// <exclude />\r\n            public void RaisePostBackEvent(string eventArgument)\r\n            {\r\n                string methodName = _control._methodName;\r\n\r\n                Control controlThatHandlesEvent = GetControlThatHandlesEvent(_control);\r\n\r\n                if (controlThatHandlesEvent == null)\r\n                {\r\n                    Core.Logging.LoggingService.LogError(typeof(Generic).FullName, \"Failed to find parent control, that appropriate for event handling\".FormatWith(methodName));\r\n                    return;\r\n                }\r\n\r\n                Type type = controlThatHandlesEvent.GetType();\r\n\r\n                MethodInfo methodInfo = null;\r\n                \r\n                while(methodInfo == null && type != typeof(object))\r\n                {\r\n                    methodInfo = type.GetMethod(methodName);\r\n                    type = type.BaseType;\r\n                }\r\n\r\n                if(methodInfo == null)\r\n                {\r\n                    Log.LogError(typeof(Generic).FullName, \"Failed to find method '{0}'\", methodName);\r\n                    return;\r\n                }\r\n\r\n                methodInfo.Invoke(controlThatHandlesEvent, new object[0]);\r\n            }\r\n\r\n\r\n            private static Control GetControlThatHandlesEvent(Generic generic)\r\n            {\r\n                Control control = generic;\r\n                do\r\n                {\r\n                    control = control.Parent;\r\n                } while (control != null \r\n                    && !(control is UserControl)\r\n                    && !(control is Page));\r\n\r\n                return control;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/HtmlEncodedPlaceHolder.cs",
    "content": "﻿using System.IO;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\n\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class HtmlEncodedPlaceHolder : PlaceHolder\r\n\t{\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            StringBuilder markupBuilder = new StringBuilder();\r\n            StringWriter sw = new StringWriter(markupBuilder);\r\n            base.Render(new HtmlTextWriter(sw));\r\n\r\n            writer.Write( HttpUtility.HtmlEncode(markupBuilder.ToString()));\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/PostBackDialog.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <summary>\r\n    /// Generates a tag like\r\n    /// &lt;ui:postbackdialog id=\"uniqueID\" callbackid=\"uniqueCallbackID\" label=\"Hello\" tooltip=\"Hello Master!\" handle=\"Composite.Management.PageSelectorDialog\" value=\"DEFAULT VALUE!\" /&gt;\r\n    /// and persists \"value\" attribute.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PostBackDialog : BaseControl\r\n    {\r\n        private static readonly string ZipPrefix = \"ZIP_\";\r\n\r\n        /// <exclude />\r\n        protected const string DefaultSelectorTagName = \"ui:postbackdialog\";\r\n\r\n        /// <exclude />\r\n        protected const string NullableSelectorTagName = \"ui:nullpostbackdialog\";\r\n\r\n\r\n        /// <exclude />\r\n        public PostBackDialog(string emptyParameter) : base(DefaultSelectorTagName)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnInit(EventArgs e)\r\n        {\r\n            base.OnInit(e);\r\n\r\n            // Persisting value from postback\r\n            string formKey = this.Attributes[\"callbackid\"];\r\n            if (formKey.IsNullOrEmpty())\r\n            {\r\n                formKey = this.ClientID;\r\n            }\r\n\r\n            if (Page.IsPostBack \r\n                && Page.Request.Form[\"__EVENTTARGET\"] == formKey\r\n                || !Page.Request.Form[formKey].IsNullOrEmpty())\r\n            {\r\n                string postedValue = Page.Request.Form[formKey];\r\n\r\n                Value = EncodeValue && postedValue.StartsWith(ZipPrefix)\r\n                    ? UrlUtils.UnZipContent(postedValue.Substring(ZipPrefix.Length))\r\n                    : HttpContext.Current.Server.UrlDecode(postedValue);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Setting to true leads to inserting \"ui:nullpostbackdatadialog\" tag \r\n        /// </summary>\r\n        public bool Nullable \r\n        {   \r\n            get\r\n            {\r\n                return TagName == NullableSelectorTagName;\r\n            } \r\n            set\r\n            {\r\n                TagName = value ? NullableSelectorTagName : DefaultSelectorTagName;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Value { get; set; }\r\n\r\n        /// <exclude />\r\n        public string DefaultValue { get; set; }\r\n\r\n        \r\n        /// <summary>\r\n        /// When <value>true</value>, the values are encoded in a way it is safe to use them in url's query string\r\n        /// </summary>\r\n        public bool EncodeValue { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void RenderAttributes(System.Web.UI.HtmlTextWriter writer)\r\n        {\r\n        \t// added for error balloons to fixitup good\r\n        \tAttributes[\"name\"] = ClientID;\r\n        \r\n            if(Attributes[\"callbackid\"].IsNullOrEmpty())\r\n            {\r\n                Attributes[\"callbackid\"] = ClientID;\r\n                Attributes[\"name\"] = ClientID;\r\n            }\r\n\r\n            if (Value != null)\r\n            {\r\n                Attributes[\"value\"] = EncodeValue ? (ZipPrefix + UrlUtils.ZipContent(Value)) : Value;\r\n            }\r\n\r\n            if (DefaultValue != null)\r\n            {\r\n                Attributes[\"defaultValue\"] = EncodeValue ? (ZipPrefix + UrlUtils.ZipContent(DefaultValue)) : DefaultValue;\r\n            }\r\n\r\n            base.RenderAttributes(writer);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/Selector.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\n\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Selector : DropDownList\r\n    {\r\n        /// <exclude />\r\n        public Selector()\r\n            : base()\r\n        {\r\n            bool isInternetExplorer = HttpContext.Current.Request.UserAgent.Contains(\"MSIE\");\r\n            this.SimpleSelectorMode = false; // isInternetExplorer;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool SelectionRequired { get; set; }\r\n\r\n        /// <exclude />\r\n        public string SelectionRequiredLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool SimpleSelectorMode { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsDisabled { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected override HtmlTextWriterTag TagKey\r\n        {\r\n            get { return HtmlTextWriterTag.Unknown; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override string TagName\r\n        {\r\n            get { return this.SimpleSelectorMode ? \"ui:simpleselector\" : \"ui:selector\"; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void AddAttributesToRender(HtmlTextWriter writer)\r\n        {\r\n            \r\n             writer.AddAttribute(\"name\", this.UniqueID);\r\n            writer.AddAttribute(\"callbackid\", this.ClientID);\r\n\r\n            if (this.AutoPostBack)\r\n            {\r\n                writer.AddAttribute(\"onchange\", \"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\");\r\n            }\r\n\r\n            if (this.SelectionRequired)\r\n            {\r\n                writer.AddAttribute(\"required\", \"true\");\r\n                string requiredLabel = this.SelectionRequiredLabel;\r\n                if (string.IsNullOrEmpty(requiredLabel)) requiredLabel = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AspNetUiControl.Selector.SelectValueLabel\");\r\n                writer.AddAttribute(\"label\", requiredLabel);\r\n            }\r\n\r\n            if (this.IsDisabled)\r\n            {\r\n                writer.AddAttribute(\"isdisabled\", \"true\");\r\n            }\r\n\r\n            this.AddClientAttributes(writer);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void RenderContents(HtmlTextWriter writer)\r\n        {\r\n            for (int i = 0; i < this.Items.Count; i++)\r\n            {\r\n                string label = StringResourceSystemFacade.ParseString(this.Items[i].Text);\r\n\r\n                int firstNonSpaceSpacePosition = 0;\r\n                while (firstNonSpaceSpacePosition < label.Length && label.Substring(firstNonSpaceSpacePosition, 1) == \" \")\r\n                    firstNonSpaceSpacePosition++;\r\n\r\n                string spacing = new String(Convert.ToChar(160), firstNonSpaceSpacePosition * 2);\r\n                this.Items[i].Text = string.Concat(spacing, label.Substring(firstNonSpaceSpacePosition));\r\n            }\r\n\r\n            if (this.SimpleSelectorMode == false)\r\n            {\r\n                ListItemCollection items = this.Items;\r\n                int count = items.Count;\r\n                if (count > 0)\r\n                {\r\n                    bool flag = false;\r\n                    for (int i = 0; i < count; i++)\r\n                    {\r\n                        ListItem item = items[i];\r\n                        if (item.Enabled)\r\n                        {\r\n                            writer.WriteBeginTag(\"ui:selection\");\r\n                            if (item.Selected && this.SelectionRequired == false)\r\n                            {\r\n                                if (flag)\r\n                                {\r\n                                    this.VerifyMultiSelect();\r\n                                }\r\n                                flag = true;\r\n                                writer.WriteAttribute(\"selected\", \"true\");\r\n                            }\r\n\r\n                            writer.WriteAttribute(\"label\", item.Text, true);\r\n                            writer.WriteAttribute(\"value\", item.Value, true);\r\n                            writer.WriteAttribute(\"tooltip\", item.Text, true);\r\n                            if (this.Page != null)\r\n                            {\r\n                                this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, item.Value);\r\n                            }\r\n                            writer.Write(HtmlTextWriter.SelfClosingTagEnd);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                base.RenderContents(writer);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void RenderBeginTag(HtmlTextWriter writer)\r\n        {\r\n            base.RenderBeginTag(writer);\r\n\r\n            if (this.SimpleSelectorMode)\r\n            {\r\n                writer.WriteFullBeginTag(\"select\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void RenderEndTag(HtmlTextWriter writer)\r\n        {\r\n        \r\n        \tif (this.SimpleSelectorMode)\r\n            {\r\n                writer.WriteEndTag(\"select\");\r\n            }\r\n\r\n            base.RenderEndTag(writer);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/TextArea.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class TextArea : BaseControl\r\n    {\r\n        /// <exclude />\r\n        public TextArea(string tagName): base(\"ui:textbox\")\r\n        {\r\n            // TODO: refactor\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void OnInit(EventArgs e)\r\n        {\r\n            base.OnInit(e);\r\n\r\n            // Loading postback data\r\n            if (Page.IsPostBack)\r\n            {\r\n                Text = this.Page.Request.Form[ClientID];\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void RenderChildren(HtmlTextWriter writer)\r\n        {\r\n            writer.WriteBeginTag(\"textarea\");\r\n            writer.Write((char)'>');\r\n\r\n            if(!Text.IsNullOrEmpty())\r\n            {\r\n                writer.WriteEncodedText(Text);\r\n            }\r\n            writer.WriteEndTag(\"textarea\");\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void RenderAttributes(HtmlTextWriter writer)\r\n        {\r\n            Attributes[\"name\"] = ClientID;\r\n\r\n            base.RenderAttributes(writer);\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Text\r\n        {\r\n            get; set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/TextBox.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <summary>\r\n    /// Fixes a basic 'System.Web.UI.WebControls.TextBox' control, so it renders correctly in 'MultiLine' mode\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class TextBox : System.Web.UI.WebControls.TextBox\r\n    {\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            this.RenderBeginTag(writer);\r\n            if (this.TextMode == TextBoxMode.MultiLine)\r\n            {\r\n                HttpUtility.HtmlEncode(/* Environment.NewLine + */this.Text, writer);\r\n            }\r\n            this.RenderEndTag(writer);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/ToolbarButton.cs",
    "content": "﻿using System.ComponentModel;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\n\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ToolbarButton : LinkButton\r\n    {\r\n        /// <exclude />\r\n        [Category(\"Behavior\"), DefaultValue(\"\"), Description(\"The id as the UI client should see\")]\r\n        public virtual string CustomClientId { get; set; }\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"Image to show on the button\")]\r\n        public virtual string ImageUrl { get; set; }\r\n\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"Image to show on the button when it is disabled\")]\r\n        public virtual string ImageUrlWhenDisabled { get; set; }\r\n\r\n        /// <exclude />\r\n        [Category(\"Behavior\"), DefaultValue(\"\"), Description(\"ID of ui:broadcaster to observe\")]\r\n        public virtual string ObservesClientBroadcaster { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            writer.WriteBeginTag(\"ui:toolbarbutton\");\r\n\r\n            writer.WriteAttribute(\"label\", StringResourceSystemFacade.ParseString(this.Text));\r\n            writer.WriteAttribute(\"callbackid\", this.ClientID);\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * PageBinding.ACTION_DOPOSTBACK emitted by default when callbackid is specified. \r\n\t\t\t * Note that this uncomment has disabled support for further clientside oncommand actions...\r\n\t\t\t *\r\n            string clientScripting = string.Format(\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK);{0}\", this.OnClientClick);\r\n            writer.WriteAttribute(\"oncommand\", clientScripting);\r\n            */\r\n\r\n            if (string.IsNullOrEmpty(this.CustomClientId) == false)\r\n            {\r\n                writer.WriteAttribute(\"id\", this.CustomClientId);\r\n            }\r\n            else\r\n            {\r\n                writer.WriteAttribute(\"id\", this.ClientID);\r\n            }\r\n\r\n            if (string.IsNullOrEmpty(this.ObservesClientBroadcaster) == false)\r\n            {\r\n                writer.WriteAttribute(\"observes\", this.ObservesClientBroadcaster);\r\n            }\r\n            if (string.IsNullOrEmpty(this.ImageUrl) == false)\r\n            {\r\n                writer.WriteAttribute(\"image\", this.ImageUrl);\r\n            }\r\n            if (string.IsNullOrEmpty(this.ImageUrlWhenDisabled) == false)\r\n            {\r\n                writer.WriteAttribute(\"image-disabled\", this.ImageUrlWhenDisabled);\r\n            }\r\n            if (this.Enabled == false)\r\n            {\r\n                writer.WriteAttribute(\"isdisabled\", \"true\");\r\n            }\r\n\r\n            this.WriteClientAttributes(writer);\r\n\r\n            writer.Write( HtmlTextWriter.SelfClosingTagEnd );\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UiControlLib/TreeNode.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\n\r\nusing Composite.Core.WebClient.UiControlLib.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Core.WebClient.UiControlLib\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class TreeNode : LinkButton\r\n    {\r\n        /// <exclude />\r\n        [Category(\"Appearance\"), DefaultValue(\"\"), Description(\"Image to show as tree node bullet\")]\r\n        public virtual string ImageUrl\r\n        {\r\n            get { return ViewState[\"imageUrl\"] as string; }\r\n            set { ViewState[\"imageUrl\"] = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void Focus()\r\n        {\r\n            this.Focused = true;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public virtual bool Focused { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            writer.WriteBeginTag(\"ui:treenode\");\r\n\r\n            writer.WriteAttribute(\"label\", StringResourceSystemFacade.ParseString(this.Text));\r\n\r\n            writer.WriteAttribute(\"id\", this.ClientID);\r\n\r\n            // bool checksumAttrRequired = false;\r\n\r\n            if(!Focused)\r\n            {\r\n                writer.WriteAttribute(\"callbackid\", this.ClientID);\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(this.ImageUrl))\r\n            {\r\n                writer.WriteAttribute(\"image\", this.ImageUrl);\r\n            }\r\n\r\n            if(this.Focused)\r\n            {\r\n                // checksumAttrRequired = true;\r\n                writer.WriteAttribute(\"focused\", \"true\");\r\n            }\r\n\r\n            //if(checksumAttrRequired)\r\n            //{\r\n            //    writer.WriteAttribute(\"checksum\", DateTime.Now.Ticks.ToString());\r\n            //}\r\n\r\n            //if (this.Focused)\r\n            //{\r\n            //    writer.WriteAttribute(\"focused\", \"true\");\r\n            //    if (string.IsNullOrEmpty(this.OnClientClick) == false)\r\n            //    {\r\n            //        writer.WriteAttribute(\"onbindingfocus\", this.OnClientClick);\r\n            //    }\r\n            //}\r\n            //else\r\n            //{\r\n            //    string clientScripting = string.Format(\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK);{0}\", this.OnClientClick);\r\n            //    writer.WriteAttribute(\"onbindingfocus\", clientScripting);\r\n            //}\r\n\r\n            this.WriteClientAttributes(writer);\r\n\r\n            writer.Write( HtmlTextWriter.SelfClosingTagEnd );\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Core/WebClient/UrlString.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Obsolete(\"Use Composite.UrlBuilder\")]\r\n    public sealed class UrlString\r\n    {\r\n        private static readonly string IncorrectValueParam = \"__***IncorrectValue***__\";\r\n\r\n        private string _pathInfo;\r\n        private string _filePath;\r\n        private List<KeyValuePair<string, string>> _queryParameters;\r\n\r\n\r\n        /// <exclude />\r\n        public UrlString(string url)\r\n        {\r\n            _queryParameters = new List<KeyValuePair<string, string>>();\r\n\r\n            int questionMarkIndex = url.IndexOf(\"?\");\r\n            if (questionMarkIndex < 0)\r\n            {\r\n                ExtractPathInfo(url, out _filePath, out _pathInfo);\r\n                return;\r\n            }\r\n\r\n            ExtractPathInfo(url.Substring(0, questionMarkIndex), out _filePath, out _pathInfo);\r\n\r\n            if (questionMarkIndex + 1 == url.Length)\r\n            {\r\n                return;\r\n            }\r\n\r\n            string queryParamStr = url.Substring(questionMarkIndex + 1, url.Length - questionMarkIndex - 1);\r\n            foreach (string queryParam in queryParamStr.Split(new[] { \"&amp;\", \"&\" }, StringSplitOptions.RemoveEmptyEntries))\r\n            {\r\n                string[] parts = queryParam.Split(new[] { '=' });\r\n\r\n                bool badUrl = parts.Length != 2;\r\n                if (!badUrl)\r\n                {\r\n                    string encodedKey = parts[0];\r\n                    string encodedValue = parts[1];\r\n\r\n                    string key = HttpUtility.UrlDecode(encodedKey);\r\n                    string value = HttpUtility.UrlDecode(encodedValue);\r\n\r\n                    badUrl = HttpUtility.UrlEncode(key) != encodedKey\r\n                             || HttpUtility.UrlEncode(value) != encodedValue;\r\n\r\n                    if (!badUrl)\r\n                    {\r\n                        _queryParameters.Add(new KeyValuePair<string, string>(key, value));\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                _queryParameters.Add(new KeyValuePair<string, string>(queryParam, IncorrectValueParam));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ExtractPathInfo(string relativePath, out string filePath, out string pathInfo)\r\n        {\r\n            int aspxExtOffset = relativePath.IndexOf(\".aspx\");\r\n            if (aspxExtOffset < 0 || aspxExtOffset == relativePath.Length - 5)\r\n            {\r\n                pathInfo = null;\r\n                filePath = relativePath;\r\n                return;\r\n            }\r\n            filePath = relativePath.Substring(0, aspxExtOffset + 5);\r\n            pathInfo = relativePath.Substring(aspxExtOffset + 5);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            // NOTE: StringBuilder shouldn't be used - it is to slow\r\n            string queryString = QueryString;\r\n\r\n            string result = _filePath;\r\n            if (_pathInfo != null)\r\n            {\r\n                result += _pathInfo;\r\n            }\r\n\r\n            if (queryString != string.Empty)\r\n            {\r\n                result += \"?\" + queryString;\r\n            }\r\n\r\n            return result; // _filePath + _pathInfo + \"?\" + queryString\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddQueryParameters(NameValueCollection parameters)\r\n        {\r\n            foreach (string key in parameters)\r\n            {\r\n                this[key] = parameters[key];\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public NameValueCollection GetQueryParameters()\r\n        {\r\n            var result = new NameValueCollection();\r\n            foreach (KeyValuePair<string, string> pair in _queryParameters)\r\n            {\r\n                result.Add(pair.Key, pair.Value);\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string this[string key]\r\n        {\r\n            get\r\n            {\r\n                string value = _queryParameters.Where(pair => pair.Key == key).Select(pair => pair.Value).FirstOrDefault();\r\n                return value ?? string.Empty;\r\n            }\r\n            set\r\n            {\r\n                for (int i = 0; i < _queryParameters.Count; i++)\r\n                {\r\n                    if (_queryParameters[i].Key == key)\r\n                    {\r\n                        if (value == null)\r\n                        {\r\n                            _queryParameters.RemoveAt(i);\r\n                        }\r\n                        else\r\n                        {\r\n                            _queryParameters[i] = new KeyValuePair<string, string>(key, value);\r\n                        }\r\n\r\n                        return;\r\n                    }\r\n                }\r\n\r\n                if (value != null)\r\n                {\r\n                    _queryParameters.Add(new KeyValuePair<string, string>(key, value));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string PathInfo\r\n        {\r\n            get\r\n            {\r\n                return _pathInfo ?? string.Empty;\r\n            }\r\n            set\r\n            {\r\n                _pathInfo = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FilePath\r\n        {\r\n            get\r\n            {\r\n                return _filePath;\r\n            }\r\n            set\r\n            {\r\n                Verify.ArgumentNotNull(value, \"value\");\r\n                _filePath = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ServerUrl\r\n        {\r\n            get\r\n            {\r\n                if (_filePath.IsNullOrEmpty())\r\n                {\r\n                    return string.Empty;\r\n                }\r\n\r\n                int index1 = _filePath.IndexOf(\"://\");\r\n                if (index1 <= 0 || _filePath.Length == index1 + 4)\r\n                {\r\n                    return string.Empty;\r\n                }\r\n\r\n                int index2 = _filePath.IndexOf(\"/\", index1 + 3);\r\n                if (index2 < 0)\r\n                {\r\n                    return string.Empty;\r\n                }\r\n\r\n                return _filePath.Substring(0, index2 + 1);\r\n            }\r\n            set\r\n            {\r\n                if (!ServerUrl.IsNullOrEmpty())\r\n                {\r\n                    throw new NotImplementedException();\r\n                }\r\n\r\n                if (value.IsNullOrEmpty()) return;\r\n\r\n                Verify.IsTrue(value.EndsWith(\"/\"), \"Wrong server url string\");\r\n\r\n                if (_filePath.StartsWith(\"/\")) _filePath = _filePath.Substring(1);\r\n\r\n                _filePath = value + _filePath;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string QueryString\r\n        {\r\n            get\r\n            {\r\n                if (_queryParameters.Count == 0)\r\n                {\r\n                    return string.Empty;\r\n                }\r\n\r\n                var sb = new StringBuilder();\r\n                for (int i = 0; i < _queryParameters.Count; i++)\r\n                {\r\n                    if (i != 0)\r\n                    {\r\n                        sb.Append(\"&\");\r\n                    }\r\n\r\n                    if (_queryParameters[i].Value == IncorrectValueParam)\r\n                    {\r\n                        sb.Append(_queryParameters[i].Key);\r\n                    }\r\n                    else\r\n                    {\r\n                        sb.Append(HttpUtility.UrlEncode(_queryParameters[i].Key));\r\n                        sb.Append('=');\r\n                        sb.Append(HttpUtility.UrlEncode(_queryParameters[i].Value));\r\n                    }\r\n                }\r\n\r\n                return sb.ToString();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/UrlUtils.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.IO.Compression;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class UrlUtils\r\n    {\r\n        private const char UrlEncode_EscapeCharacter = '$';\r\n        private const char UrlEncode_SpaceReplacement = '-';\r\n        private const char UrlEncode_SpaceReplacementReplacement = '_';\r\n\r\n        private static readonly string _adminFolderName = \"Composite\";\r\n        private static readonly string _renderersFolderName = \"Renderers\";\r\n        private static readonly string _applicationVirtualPath;\r\n        private static readonly string[] UrlStartMarkers = { \"\\\"\", \"\\'\", \"&#39;\", \"&#34;\" };\r\n        private static readonly string SessionUrlPrefix = \"Session_\";\r\n\r\n\r\n        /// <exclude />\r\n        public static string PublicRootPath => _applicationVirtualPath;\r\n\r\n\r\n        /// <exclude />\r\n        public static string AdminRootPath => $\"{_applicationVirtualPath}/{_adminFolderName}\";\r\n\r\n\r\n        /// <exclude />\r\n        public static string RenderersRootPath => $\"{_applicationVirtualPath}/{_renderersFolderName}\";\r\n\r\n\r\n        /// <exclude />\r\n        internal static string AdminFolderName => _adminFolderName;\r\n\r\n\r\n        static UrlUtils()\r\n        {\r\n            string appPath = HostingEnvironment.ApplicationVirtualPath ?? \"\"; \r\n\r\n            if (appPath.EndsWith(\"/\") || appPath.EndsWith(@\"\\\"))\r\n            {\r\n                appPath = appPath.Remove(appPath.Length - 1, 1);\r\n            }\r\n\r\n            _applicationVirtualPath = appPath;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string ResolveAdminUrl(string adminRelativePath)\r\n        {\r\n            if (adminRelativePath == null) throw new ArgumentNullException(nameof(adminRelativePath));\r\n            if (adminRelativePath.IndexOf('~') > -1 || adminRelativePath.StartsWith(\"/\") )\r\n            {\r\n                throw new ArgumentException(\"The relative URL may not be rooted or contain '~'\");\r\n            }\r\n\r\n            string[] split = adminRelativePath.Split('?');\r\n            string checkForBackSlashes = split[0];\r\n            if (checkForBackSlashes.Contains(@\"\\\"))\r\n            {\r\n                Log.LogWarning(\"ResolveAdminUrl\", $@\"The url '{checkForBackSlashes}' contains '\\' which is not allowed.\");\r\n            }\r\n\r\n            return $\"{_applicationVirtualPath}/{_adminFolderName}/{adminRelativePath}\";\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string ResolvePublicUrl(string publicRelativePath)\r\n        {\r\n            if (publicRelativePath == null) throw new ArgumentNullException(nameof(publicRelativePath));\r\n\r\n            if (publicRelativePath.StartsWith(\"/\"))\r\n            {\r\n                throw new ArgumentException(\"The relative URL may not be rooted. It should be either relative to root or start with ~/\");\r\n            }\r\n\r\n            if (publicRelativePath.StartsWith(\"~/\"))\r\n            {\r\n                publicRelativePath = publicRelativePath.Remove(0, 2);\r\n            }\r\n\r\n            return $\"{_applicationVirtualPath}/{publicRelativePath}\";\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Determines whether the current request is administration console request. \r\n        /// (Requests to [/virtual path]/Composite/*)\r\n        /// </summary>\r\n        internal static bool IsAdminConsoleRequest(HttpContext httpContext)\r\n        {\r\n            string relativeUrl = httpContext.Request.Path;\r\n\r\n            return IsAdminConsoleRequest(relativeUrl);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Determines whether the current request is a renderer request. \r\n        /// (Requests to [/virtual path]/Composite/*)\r\n        /// </summary>\r\n        internal static bool IsRendererRequest(HttpContext httpContext)\r\n        {\r\n            string requestPath = httpContext.Request.Path;\r\n\r\n            return string.Compare(requestPath, RenderersRootPath, StringComparison.OrdinalIgnoreCase) == 0\r\n                   || requestPath.StartsWith(RenderersRootPath + \"/\", StringComparison.OrdinalIgnoreCase);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Determines whether the current request is administration console request. \r\n        /// (Requests to [/virtual path]/Composite/*)\r\n        /// </summary>\r\n        public static bool IsAdminConsoleRequest(string requestPath)\r\n        {\r\n            return string.Compare(requestPath, UrlUtils.AdminRootPath, StringComparison.OrdinalIgnoreCase) == 0\r\n                   || requestPath.StartsWith(UrlUtils.AdminRootPath + \"/\", StringComparison.OrdinalIgnoreCase);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string Combine( string path1, string path2 )\r\n        {\r\n            if (string.IsNullOrEmpty(path1)) return path2;\r\n            if (string.IsNullOrEmpty(path2)) return path1;\r\n\r\n            bool path1EndsWithSlash = path1.EndsWith(\"/\");\r\n            bool path2StartsWithSlash = path2.StartsWith(\"/\");\r\n\r\n            if (path1EndsWithSlash != path2StartsWithSlash)\r\n            {\r\n                return path1 + path2;\r\n            }\r\n\r\n            if (path1EndsWithSlash)\r\n            {\r\n                return path1 + path2.Substring(1);\r\n            }\r\n\r\n            return path1 + \"/\" + path2;\r\n        }\r\n\r\n        internal class UrlMatch\r\n        {\r\n            public int Index;\r\n            public string Value;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Finds all the urls that start with <paramref name=\"urlPrefix\"/>.\r\n        /// We assume that each url ends before one of the following strings:\r\n        /// double quote, single quote, or &#39; which is single quote mark (') encoded in xml attribute \r\n        /// </summary>\r\n        /// <param name=\"html\">The html content.</param>\r\n        /// <param name=\"urlPrefix\">The url prefix</param>\r\n        /// <returns>List of urls, sorted by the order they appear</returns>\r\n        internal static List<UrlMatch> FindUrlsInHtml(string html, string urlPrefix)\r\n        {\r\n            var result = new List<UrlMatch>();\r\n\r\n            int startIndex = 0;\r\n\r\n            while (true)\r\n            {\r\n                int urlOffset = html.IndexOf(urlPrefix, startIndex, StringComparison.OrdinalIgnoreCase);\r\n                if (urlOffset < 5) break;\r\n\r\n                int prefixEndOffset = urlOffset + urlPrefix.Length;\r\n                int endOffset = -1;\r\n\r\n                char lastQuoteSymbol = html[urlOffset - 1];\r\n\r\n                // If starts with a quote symbol- should end with the same quote symbol\r\n                if (lastQuoteSymbol == '\\''\r\n                    || lastQuoteSymbol == '\\\"')\r\n                {\r\n                    endOffset = html.IndexOf(lastQuoteSymbol, prefixEndOffset);\r\n                }\r\n                else if (lastQuoteSymbol == ';' && urlOffset > 5)\r\n                {\r\n                    string fiveCharsPrefix = html.Substring(urlOffset - 5, 5);\r\n\r\n                    if (fiveCharsPrefix == \"&#34;\" \r\n                        || fiveCharsPrefix == \"&#39;\")\r\n                    {\r\n                        endOffset = html.IndexOf(fiveCharsPrefix, prefixEndOffset, StringComparison.Ordinal);\r\n                    }\r\n                }\r\n\r\n                // Skipping match if the quotes aren't defined\r\n                if(endOffset < 0)\r\n                {\r\n                    startIndex = prefixEndOffset;\r\n                    continue;\r\n                }\r\n\r\n                // Skipping html anchors \r\n                int hashSignIndex = html.IndexOf('#', prefixEndOffset, endOffset - prefixEndOffset);\r\n                if (hashSignIndex > 0)\r\n                {\r\n                    endOffset = hashSignIndex;\r\n                }\r\n\r\n                result.Add(new UrlMatch\r\n                {\r\n                    Index = urlOffset,\r\n                    Value = html.Substring(urlOffset, endOffset - urlOffset)\r\n                });\r\n\r\n                startIndex = endOffset;\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        internal static string ReplaceUrlPrefix(string html, string oldPrefix, string newPrefix)\r\n        {\r\n            foreach (string urlStartMarker in UrlStartMarkers)\r\n            {\r\n                html = html.Replace(urlStartMarker + oldPrefix, urlStartMarker + newPrefix);\r\n            }\r\n\r\n            return html;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string ZipContent(string text)\r\n        {\r\n            if (text.IsNullOrEmpty()) return text;\r\n\r\n            byte[] bytes = Encoding.UTF8.GetBytes(text);\r\n\r\n            byte[] newBytes;\r\n\r\n            using (var compressStream = new MemoryStream())\r\n            using (var compressor = new DeflateStream(compressStream, CompressionMode.Compress))\r\n            {\r\n                compressor.Write(bytes, 0, bytes.Length);\r\n                compressor.Close();\r\n                newBytes = compressStream.ToArray();\r\n            }\r\n\r\n            string base64 = Convert.ToBase64String(newBytes);\r\n\r\n            if (base64.Length <= 512)\r\n            {\r\n                string urlFriendlyBase64 = base64.Replace(\"+\", \"_\").Replace(\"/\", \".\").Replace(\"=\", \"-\");\r\n\r\n                return urlFriendlyBase64;\r\n            }\r\n\r\n            Guid stateId = GetMD5Hash(bytes);\r\n\r\n            using (new DataConnection())\r\n            {\r\n                SessionStateManager.DefaultProvider.SetState(stateId, text, DateTime.Now.AddHours(1.0));\r\n            }\r\n\r\n            return SessionUrlPrefix + stateId;\r\n        }\r\n\r\n        private static Guid GetMD5Hash(byte[] bytes)\r\n        {\r\n            using (MD5 md5 = MD5.Create())\r\n            {\r\n                return new Guid(md5.ComputeHash(bytes));\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string UnZipContent(string zippedContent)\r\n        {\r\n            if (zippedContent.IsNullOrEmpty()) return zippedContent;\r\n\r\n            if (zippedContent.StartsWith(SessionUrlPrefix))\r\n            {\r\n                Guid stateId = Guid.Parse(zippedContent.Substring(SessionUrlPrefix.Length));\r\n\r\n                using (new DataConnection())\r\n                {\r\n                    string urlFromSession;\r\n                    bool succeed = SessionStateManager.DefaultProvider.TryGetState(stateId, out urlFromSession);\r\n\r\n                    Verify.That(succeed, \"Failed to extract a url part from session\");\r\n\r\n                    return urlFromSession;\r\n                }\r\n            }\r\n\r\n            string base64 = zippedContent.Replace(\"_\", \"+\").Replace(\".\", \"/\").Replace(\"-\", \"=\");\r\n\r\n            byte[] bytes = Convert.FromBase64String(base64);\r\n\r\n            using (var ms = new MemoryStream(bytes))\r\n            using (var result = new MemoryStream())\r\n            using (var deflateStream = new DeflateStream(ms, CompressionMode.Decompress))\r\n            {\r\n                deflateStream.CopyTo(result);\r\n                deflateStream.Close();\r\n\r\n                return Encoding.UTF8.GetString(result.ToArray());                \r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string CompressGuid(Guid guid)\r\n        {\r\n            return Convert.ToBase64String(guid.ToByteArray())\r\n                    .Substring(0, 22)\r\n                    .Replace('+', '-')\r\n                    .Replace('/', '_');\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool TryExpandGuid(string urlPart, out Guid guid)\r\n        {\r\n            if (urlPart == null || urlPart.Length != 22 \r\n                || urlPart.Contains(\"/\")\r\n                || urlPart.Contains(\"+\"))\r\n            {\r\n                guid = Guid.Empty;\r\n                return false;\r\n            }\r\n\r\n            string base64 = urlPart\r\n                    .Replace('_', '/')\r\n                    .Replace('-', '+')\r\n                    + \"==\";\r\n\r\n            try\r\n            {\r\n                var bytes = Convert.FromBase64String(base64);\r\n                guid = new Guid(bytes);\r\n\r\n                return true;\r\n            }\r\n            catch\r\n            {\r\n                guid = Guid.Empty;\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string EncodeUrlInvalidCharacters(string value)\r\n        {\r\n            var symbolsToEncode = new Hashset<char>(new[] { '<', '>', '*', '%', '&', '\\\\', '?', '/' });\r\n\r\n            symbolsToEncode.Add(UrlEncode_EscapeCharacter);\r\n            symbolsToEncode.Add(UrlEncode_SpaceReplacementReplacement);\r\n\r\n            var sb = new StringBuilder(value.Length);\r\n\r\n            foreach (var ch in value)\r\n            {\r\n                if (ch == UrlEncode_SpaceReplacement)\r\n                {\r\n                    sb.Append(UrlEncode_SpaceReplacementReplacement);\r\n                    continue;\r\n                }\r\n\r\n                if (ch == ' ')\r\n                {\r\n                    sb.Append(UrlEncode_SpaceReplacement);\r\n                    continue;\r\n                }\r\n\r\n                if (!symbolsToEncode.Contains(ch))\r\n                {\r\n                    sb.Append(ch);\r\n                    continue;\r\n                }\r\n\r\n                int code = (int)ch;\r\n                Verify.That(code <= 256, \"1 byte ASCII code expected\");\r\n\r\n                sb.Append(UrlEncode_EscapeCharacter).Append(code.ToString(\"X2\"));\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string DecodeUrlInvalidCharacters(string value)\r\n        {\r\n            var sb = new StringBuilder(value.Length);\r\n\r\n            for (int position = 0; position < value.Length; position++)\r\n            {\r\n                var ch = value[position];\r\n                if (ch == UrlEncode_SpaceReplacement)\r\n                {\r\n                    sb.Append(' ');\r\n                    continue;\r\n                }\r\n\r\n                if (ch == UrlEncode_SpaceReplacementReplacement)\r\n                {\r\n                    sb.Append(UrlEncode_SpaceReplacement);\r\n                    continue;\r\n                }\r\n\r\n                if (ch == UrlEncode_EscapeCharacter && position + 2 < value.Length)\r\n                {\r\n                    var hexCode = value.Substring(position + 1, 2).ToLowerInvariant();\r\n                    const string hexadecimalDigits = \"0123456789abcdef\";\r\n\r\n                    int firstDigit = hexadecimalDigits.IndexOf(hexCode[0]);\r\n                    int secondDigit = hexadecimalDigits.IndexOf(hexCode[1]);\r\n\r\n                    if (firstDigit > -1 && secondDigit > -1)\r\n                    {\r\n                        sb.Append((char) ((firstDigit << 4) + secondDigit));\r\n                        position += 2;\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                sb.Append(ch);\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/XhtmlPage.cs",
    "content": "﻿using System.IO;\r\nusing System.Text.RegularExpressions;\r\nusing System.Web.UI;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic abstract class XhtmlPage : Page\r\n\t{\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            Regex xmlScriptRegex = new Regex(@\"(<script\\stype=\"\"text/javascript\"\">)(\\s*<!--)((?:.|\\n)*?)(\\s*-->\\s*)(</script>)\");\r\n            string xmlScriptCDATAWrapper = \"$1\\n// <![CDATA[$3 // ]]>\\n$5\";\r\n\r\n            StringWriter sw = new StringWriter();\r\n            base.Render(new HtmlTextWriter(sw));\r\n            string html = sw.ToString();\r\n\r\n            html = xmlScriptRegex.Replace(html, xmlScriptCDATAWrapper);\r\n\r\n            writer.Write(html);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/WebClient/XsltServices.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Xsl;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Core.WebClient\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class XsltServices\r\n\t{\r\n        private static Dictionary<string, XslCompiledTransform> _xsltLookup = new Dictionary<string, XslCompiledTransform>();\r\n        private static Dictionary<string, DateTime> _xsltFileTimestamps = new Dictionary<string, DateTime>();\r\n        private static object _lock = new object();\r\n\r\n        /// <exclude />\r\n        public static XslCompiledTransform GetCompiledXsltTransform(string stylesheetPath)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                DateTime lastXsltFileWrite = C1File.GetLastWriteTime(stylesheetPath);\r\n\r\n                bool compiledVersionExists = _xsltLookup.ContainsKey(stylesheetPath);\r\n                bool reloadFresh = (DateTime.Now - lastXsltFileWrite).TotalMinutes < 30;\r\n\r\n                if (compiledVersionExists == false || lastXsltFileWrite > _xsltFileTimestamps[stylesheetPath] || reloadFresh)\r\n                {\r\n                    XslCompiledTransform xslt = new XslCompiledTransform();\r\n                    using (XmlReader reader = XmlReaderUtils.Create(stylesheetPath))\r\n                    {\r\n                        xslt.Load(reader);\r\n                    }\r\n\r\n                    if (compiledVersionExists)\r\n                    {\r\n                        _xsltLookup.Remove(stylesheetPath);\r\n                        _xsltFileTimestamps.Remove(stylesheetPath);\r\n                    }\r\n\r\n                    _xsltLookup.Add(stylesheetPath, xslt);\r\n                    _xsltFileTimestamps.Add(stylesheetPath, lastXsltFileWrite);\r\n                }\r\n            }\r\n\r\n            return _xsltLookup[stylesheetPath];\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XDocument XslTransform(this XDocument sourceDocument, string xsltFilePath)\r\n        {\r\n            XDocument outputDocument = new XDocument();\r\n\r\n            XslCompiledTransform xslt = XsltServices.GetCompiledXsltTransform(xsltFilePath);\r\n\r\n            using (XmlWriter writer = outputDocument.CreateWriter())\r\n            {\r\n                using (XmlReader reader = sourceDocument.CreateReader())\r\n                {\r\n                    xslt.Transform(reader, writer);\r\n                }\r\n            }\r\n\r\n            return outputDocument;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/LimitedDepthXmlWriter.cs",
    "content": "﻿using System;\r\nusing System.Xml;\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class LimitedDepthXmlWriter : XmlWriter\r\n\t{\r\n        private readonly XmlWriter _innerWriter;\r\n        private readonly int _maxDepth;\r\n        private int _depth;\r\n\r\n        /// <exclude />\r\n        public LimitedDepthXmlWriter(XmlWriter innerWriter): this(innerWriter, 100)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public LimitedDepthXmlWriter(XmlWriter innerWriter, int maxDepth)\r\n        {\r\n            _maxDepth = maxDepth;\r\n            _innerWriter = innerWriter;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void Close()\r\n        {\r\n            _innerWriter.Close();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void Flush()\r\n        {\r\n            _innerWriter.Flush();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string LookupPrefix(string ns)\r\n        {\r\n            return _innerWriter.LookupPrefix(ns);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteBase64(byte[] buffer, int index, int count)\r\n        {\r\n            _innerWriter.WriteBase64(buffer, index, count);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteCData(string text)\r\n        {\r\n            _innerWriter.WriteCData(text);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteCharEntity(char ch)\r\n        {\r\n            _innerWriter.WriteCharEntity(ch);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteChars(char[] buffer, int index, int count)\r\n        {\r\n            _innerWriter.WriteChars(buffer, index, count);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteComment(string text)\r\n        {\r\n            _innerWriter.WriteComment(text);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteDocType(string name, string pubid, string sysid, string subset)\r\n        {\r\n            _innerWriter.WriteDocType(name, pubid, sysid, subset);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteEndAttribute()\r\n        {\r\n            _innerWriter.WriteEndAttribute();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteEndDocument()\r\n        {\r\n            _innerWriter.WriteEndDocument();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteEndElement()\r\n        {\r\n            _depth--;\r\n\r\n            _innerWriter.WriteEndElement();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteEntityRef(string name)\r\n        {\r\n            _innerWriter.WriteEntityRef(name);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteFullEndElement()\r\n        {\r\n            _innerWriter.WriteFullEndElement();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteProcessingInstruction(string name, string text)\r\n        {\r\n            _innerWriter.WriteProcessingInstruction(name, text);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteRaw(string data)\r\n        {\r\n            _innerWriter.WriteRaw(data);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteRaw(char[] buffer, int index, int count)\r\n        {\r\n            _innerWriter.WriteRaw(buffer, index, count);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteStartAttribute(string prefix, string localName, string ns)\r\n        {\r\n            _innerWriter.WriteStartAttribute(prefix, localName, ns);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteStartDocument(bool standalone)\r\n        {\r\n            _innerWriter.WriteStartDocument(standalone);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteStartDocument()\r\n        {\r\n            _innerWriter.WriteStartDocument();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteStartElement(string prefix, string localName, string ns)\r\n        {\r\n            if (_depth++ > _maxDepth) ThrowException();\r\n\r\n            _innerWriter.WriteStartElement(prefix, localName, ns);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override WriteState WriteState\r\n        {\r\n            get { return _innerWriter.WriteState; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteString(string text)\r\n        {\r\n            _innerWriter.WriteString(text);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteSurrogateCharEntity(char lowChar, char highChar)\r\n        {\r\n            _innerWriter.WriteSurrogateCharEntity(lowChar, highChar);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void WriteWhitespace(string ws)\r\n        {\r\n            _innerWriter.WriteWhitespace(ws);\r\n        }\r\n\r\n\r\n        private void ThrowException()\r\n        {\r\n            throw new InvalidOperationException(string.Format(\"Result xml has more the {0} nested tags. It is possible that xslt transformation contains an endless recursive call.\", _maxDepth));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/Namespaces.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Xml.Linq;\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// Commonly used XML namespaces\r\n    /// </summary>\r\n\tpublic static class Namespaces\r\n\t{\r\n        private static readonly Dictionary<XNamespace, string> _canonicalPrefixes = new Dictionary<XNamespace, string>();\r\n\r\n        static Namespaces()\r\n        {\r\n            Namespaces.BindingForms10 = Composite.C1Console.Forms.Foundation.FormTreeCompiler.CompilerGlobals.RootNamespaceURI;\r\n            Namespaces.BindingFormsStdUiControls10 = \"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\";\r\n            Namespaces.BindingFormsStdFuncLib10 = \"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\";\r\n            Namespaces.Function10 = \"http://www.composite.net/ns/function/1.0\";\r\n            Namespaces.Rendering10 = \"http://www.composite.net/ns/rendering/1.0\";\r\n            Namespaces.Localization10 = \"http://www.composite.net/ns/localization/1.0\";\r\n            Namespaces.DynamicData10 = \"http://www.composite.net/ns/dynamicdata/1.0\";\r\n\r\n            Namespaces.AspNetControls = \"http://www.composite.net/ns/asp.net/controls\";\r\n\r\n            Namespaces.Data = \"http://www.composite.net/ns/data\";\r\n\r\n            Namespaces.XmlNs = \"http://www.w3.org/2000/xmlns/\";\r\n\r\n            Namespaces.Xhtml = \"http://www.w3.org/1999/xhtml\";\r\n            Namespaces.Svg = \"http://www.w3.org/2000/svg\";\r\n            Namespaces.Xsl = \"http://www.w3.org/1999/XSL/Transform\";\r\n\r\n            Namespaces.Xsi = \"http://www.w3.org/2001/XMLSchema-instance\";\r\n            Namespaces.Xsd = \"http://www.w3.org/2001/XMLSchema\";\r\n\r\n            Namespaces.Components = \"http://www.composite.net/ns/components/1.0\";\r\n\r\n            _canonicalPrefixes.Add(Namespaces.Function10, \"f\");\r\n            _canonicalPrefixes.Add(Namespaces.Svg, \"svg\");\r\n            _canonicalPrefixes.Add(Namespaces.Rendering10, \"rendering\");\r\n            _canonicalPrefixes.Add(Namespaces.Xsl, \"xsl\");\r\n            _canonicalPrefixes.Add(Namespaces.AspNetControls, \"asp\");\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Namespace for handling forms in the C1 Console: http://www.composite.net/ns/management/bindingforms/1.0\r\n        /// </summary>\r\n        public static XNamespace BindingForms10 { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace for handling forms in the C1 Console: http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\r\n        /// </summary>\r\n        public static XNamespace BindingFormsStdUiControls10 { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace for handling forms in the C1 Console: http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\r\n        /// </summary>\r\n        public static XNamespace BindingFormsStdFuncLib10 { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace for C1 Functions: http://www.composite.net/ns/function/1.0\r\n        /// </summary>\r\n        public static XNamespace Function10 { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace for rendering page title, description and content: http://www.composite.net/ns/rendering/1.0\r\n        /// </summary>\r\n        public static XNamespace Rendering10 { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace for getting localized strings or content: http://www.composite.net/ns/localization/1.0\r\n        /// </summary>\r\n        public static XNamespace Localization10 { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace for ASP.NET Web Forms in C1 CMS pages: http://www.composite.net/ns/asp.net/controls\r\n        /// </summary>\r\n        public static XNamespace AspNetControls { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace for refering to data types: http://www.composite.net/ns/data\r\n        /// </summary>\r\n        public static XNamespace Data { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace\r\n        /// </summary>\r\n        public static XNamespace DynamicData10 { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace\r\n        /// </summary>\r\n        public static XNamespace XmlNs { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace for XHTML documents in C1 CMS: http://www.w3.org/1999/xhtml\r\n        /// </summary>\r\n        public static XNamespace Xhtml { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace\r\n        /// </summary>\r\n        public static XNamespace Svg { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace\r\n        /// </summary>\r\n        public static XNamespace Xsl { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace\r\n        /// </summary>\r\n        public static XNamespace Xsi { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace\r\n        /// </summary>\r\n        public static XNamespace Xsd { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Namespace\r\n        /// </summary>\r\n        public static XNamespace Components { get; private set; }\r\n\r\n        /// <summary>\r\n        /// If known returns a canonical prefix for a given XML namespace\r\n        /// </summary>\r\n        /// <param name=\"xmlns\">Namespace to match</param>\r\n        /// <param name=\"prefix\">prefix for namespace, if any</param>\r\n        /// <returns>True when a prefix was found, otherwise false</returns>\r\n        public static bool TryGetCanonicalPrefix(XNamespace xmlns, out string prefix)\r\n        {\r\n            return _canonicalPrefixes.TryGetValue(xmlns, out prefix);            \r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/UriResolver.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Net;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    internal static class UriResolver\r\n    {\r\n        public static Stream GetStream(string inputUri)\r\n        {\r\n            Uri resolvedUri = ResolveUri(inputUri);\r\n\r\n            if (resolvedUri.Scheme == \"file\")\r\n            {\r\n                return new C1FileStream(resolvedUri.LocalPath, FileMode.Open, FileAccess.Read, FileShare.Read);\r\n            }\r\n            else\r\n            {\r\n                WebRequest request = WebRequest.Create(resolvedUri);\r\n\r\n                WebResponse response = request.GetResponse();\r\n\r\n                return response.GetResponseStream();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static Uri ResolveUri(string inputUri)\r\n        {\r\n            Uri uri = new Uri(inputUri, UriKind.RelativeOrAbsolute);\r\n            \r\n            if (!uri.IsAbsoluteUri && (uri.OriginalString.Length > 0))\r\n            {\r\n                uri = new Uri(Path.GetFullPath(inputUri));\r\n            }\r\n            \r\n            return uri;\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XAttributeUtils.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class XAttributeUtils\r\n\t{\r\n        /// <exclude />\r\n        public static string GetValueOrDefault(this XAttribute attribute, string defaultValue)\r\n        {\r\n            if (attribute == null) return defaultValue;\r\n\r\n            return attribute.Value;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetIntValue(this XAttribute attribute, out int value)\r\n        {\r\n            if (attribute == null) throw new ArgumentNullException(\"attribute\");\r\n\r\n            value = default(int);\r\n            try\r\n            {\r\n                value = (int)attribute;\r\n            }\r\n            catch(FormatException)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetBoolValue(this XAttribute attribute, out bool value)\r\n        {\r\n            if (attribute == null) throw new ArgumentNullException(\"attribute\");\r\n\r\n            value = default(bool);\r\n            try\r\n            {\r\n                value = (bool)attribute;\r\n            }\r\n            catch (FormatException)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetGuidValue(this XAttribute attribute, out Guid value)\r\n        {\r\n            if (attribute == null) throw new ArgumentNullException(\"attribute\");\r\n\r\n            value = default(Guid);\r\n            try\r\n            {\r\n                value = (Guid)attribute;\r\n            }\r\n            catch (FormatException)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XDocumentUtils.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class XDocumentUtils\r\n    {\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        /// <param name=\"inputUri\">This could be a file or a url</param>\r\n        public static XDocument Load(string inputUri)\r\n        {\r\n            return Load(inputUri, LoadOptions.None);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        /// <param name=\"loadOptions\">Load options.</param>\r\n        /// <param name=\"inputUri\">This could be a file or a url</param>\r\n        public static XDocument Load(string inputUri, LoadOptions loadOptions)\r\n        {\r\n            if (inputUri.Contains(\"://\"))\r\n            {\r\n                using (Stream stream = UriResolver.GetStream(inputUri))\r\n                {\r\n                    return XDocument.Load(stream, loadOptions);\r\n                }\r\n            }\r\n\r\n            return XDocument.Load(inputUri, loadOptions);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        public static void Save(XDocument document, string filename)\r\n        {\r\n            using (C1FileStream stream = new C1FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.Read))\r\n            {\r\n                document.Save(stream);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        public static void SaveToFile(this XDocument document, string filename)\r\n        {\r\n            Save(document, filename);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetDocumentAsString(this XDocument document)\r\n        {\r\n            Verify.ArgumentNotNull(document, \"document\");\r\n\r\n            using (var ms = new MemoryStream())\r\n            {\r\n                using (var sw = new C1StreamWriter(ms))\r\n                {\r\n                    document.Save(sw);\r\n\r\n                    ms.Seek(0, SeekOrigin.Begin);\r\n\r\n                    using (var sr = new C1StreamReader(ms))\r\n                    {\r\n                        return sr.ReadToEnd();\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XElementUtils.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class XElementUtils\r\n    {\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        /// <param name=\"inputUri\">This could be a file or a url</param>\r\n        public static XElement Load(string inputUri)\r\n        {\r\n            XElement element;\r\n\r\n            using (Stream stream = UriResolver.GetStream(inputUri))\r\n            {\r\n                element = XElement.Load(stream);\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        public static void SaveToPath(this XElement element, string fileName)\r\n        {\r\n            using (var stream = new C1FileStream(fileName, FileMode.Create, FileAccess.Write))\r\n            {                \r\n                element.Save(stream);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool HasSameSiblings(this XElement element)\r\n        {\r\n            if (element == null) throw new ArgumentNullException(\"element\");\r\n\r\n            if (element.Parent == null) return false;\r\n\r\n            return element.Parent.Elements().Count(f => f.Name == element.Name) > 1;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static int GetSameSiblingsBeforeCount(this XElement element)\r\n        {\r\n            if (element == null) throw new ArgumentNullException(\"element\");\r\n\r\n            return element.NodesBeforeSelf().Count(f => f is XElement && ((XElement)f).Name == element.Name);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the value of the XElement attribute with the specified name. \r\n        /// </summary>\r\n        /// <param name=\"element\"></param>\r\n        /// <param name=\"attributeName\">The name of the attribute to (try to) get</param>\r\n        /// <returns>The value of the attribute or null if the attribute does not exist.</returns>\r\n        public static string GetAttributeValue(this XElement element, string attributeName)\r\n        {\r\n            if (element == null) throw new ArgumentNullException(\"element\");\r\n            if (string.IsNullOrEmpty(attributeName)) throw new ArgumentNullException(\"attributeName\");\r\n\r\n            return GetAttributeValue(element, (XName)attributeName);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the value of the XElement attribute with the specified name.\r\n        /// </summary>\r\n        /// <param name=\"element\">The element.</param>\r\n        /// <param name=\"attributeXName\">XName of the attribute.</param>\r\n        /// <returns>\r\n        /// The value of the attribute or null if the attribute does not exist.\r\n        /// </returns>\r\n        public static string GetAttributeValue(this XElement element, XName attributeXName)\r\n        {\r\n            Verify.ArgumentNotNull(element, \"element\");\r\n            Verify.ArgumentNotNull(attributeXName, \"attributeXName\");\r\n\r\n            return  (string) element.Attribute(attributeXName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Merge in elements and attributes. New child elements and new attributes are imported to the source. Conflicts are ignored (not merged).\r\n        /// </summary>\r\n        /// <param name=\"source\">the structure to add new elements and attributes to</param>\r\n        /// <param name=\"toBeImported\">what to import</param>\r\n        /// <returns>The modified source.</returns>\r\n        public static XElement ImportSubtree(this XElement source, XElement toBeImported)\r\n        {\r\n            if (toBeImported != null)\r\n            {\r\n                foreach (XAttribute targetAttribute in from targetAttribute in toBeImported.Attributes() let sourceAttribute = source.Attribute(targetAttribute.Name) where sourceAttribute == null select targetAttribute)\r\n                {\r\n                    source.Add(targetAttribute);\r\n                }\r\n\r\n                foreach (XElement targetChild in toBeImported.Elements())\r\n                {\r\n                    XElement sourceChild = FindElement(source, targetChild);\r\n\r\n                    if (sourceChild != null && !HasConflict(sourceChild, targetChild))\r\n                    {\r\n                        sourceChild.ImportSubtree(targetChild);\r\n                    }\r\n                    else\r\n                    {\r\n                        if (targetChild.Name.LocalName == \"configSections\")\r\n                        {\r\n                            source.AddFirst(targetChild);\r\n                        }\r\n                        else\r\n                        {\r\n                            source.Add(targetChild);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Removes attributes and child elements from source which match ditto 100% in tatoBeExcludedget. Elements in source which has other child elements or attributes are not removed.\r\n        /// </summary>\r\n        /// <param name=\"source\">XElement to modify</param>\r\n        /// <param name=\"toBeExcluded\">what to locate and remove</param>\r\n        /// <returns>The modified source.</returns>\r\n        public static XElement RemoveMatches(this XElement source, XElement toBeExcluded)\r\n        {\r\n            if (toBeExcluded != null)\r\n            {\r\n                foreach (XAttribute a in source.Attributes().Where(a => toBeExcluded.GetAttributeValue(a.Name) == a.Value).ToList())\r\n                {\r\n                    a.Remove();\r\n                }\r\n\r\n                foreach (XElement sourceChild in source.Elements().ToList())\r\n                {\r\n                    XElement targetChild = FindElement(toBeExcluded, sourceChild);\r\n                    if (targetChild != null && !HasConflict(sourceChild, targetChild))\r\n                    {\r\n                        RemoveMatches(sourceChild, targetChild);\r\n\r\n                        if (!sourceChild.HasAttributes && !sourceChild.HasElements)\r\n                        {\r\n                            sourceChild.Remove();\r\n                            targetChild.Remove();\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return source;\r\n        }\r\n\r\n\r\n\r\n        private static bool HasConflict(XElement source, XElement target)\r\n        {\r\n            foreach (XAttribute targetAttribute in target.Attributes())\r\n            {\r\n                string sourceAttributeValue = source.GetAttributeValue(targetAttribute.Name);\r\n                if (sourceAttributeValue != null && sourceAttributeValue != targetAttribute.Value)\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        private static int CountEquals(XElement target, XElement left, XElement right)\r\n        {\r\n            int leftEqualsCount = CountEquals(left, target, IsAttributeEqual);\r\n            int rightEqualsCount = CountEquals(right, target, IsAttributeEqual);\r\n\r\n            if (leftEqualsCount == rightEqualsCount)\r\n            {\r\n                int leftNameMatches = CountEquals(left, target, (a, b) => a.Name == b.Name);\r\n                int rightNameMatches = CountEquals(right, target, (a, b) => a.Name == b.Name);\r\n\r\n                return rightNameMatches.CompareTo(leftNameMatches);\r\n            }\r\n\r\n            return rightEqualsCount.CompareTo(leftEqualsCount);\r\n        }\r\n\r\n\r\n\r\n        private static int CountEquals(XElement left, XElement right, Func<XAttribute, XAttribute, bool> equal)\r\n        {\r\n            IEnumerable<XAttribute> equals = from l in left.Attributes()\r\n                                             from r in right.Attributes()\r\n                                             where equal(l, r)\r\n                                             select l;\r\n            return equals.Count();\r\n        }\r\n\r\n\r\n\r\n        private static bool IsAttributeEqual(XAttribute source, XAttribute target)\r\n        {\r\n            if (source == null && target == null)\r\n            {\r\n                return true;\r\n            }\r\n\r\n            if (source == null || target == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return source.Name == target.Name && source.Value == target.Value;\r\n        }\r\n\r\n\r\n\r\n        private static XElement FindElement(XElement source, XElement target)\r\n        {\r\n            List<XElement> sourceElements = source.Elements(target.Name).ToList();\r\n\r\n            sourceElements.Sort((l, r) => CountEquals(target, l, r));\r\n\r\n            return sourceElements.FirstOrDefault();\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XNodeExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing System.Xml;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class XNodeExtensionMethods\r\n    {\r\n        /// <summary>\r\n        /// Returns an XPath to the specified XObject for documentation purposes. Namespaces\r\n        /// are not handled by this function and using the returned XPath to look up the element\r\n        /// is not guaranteed to work.\r\n        /// </summary>\r\n        /// <param name=\"xObject\"></param>\r\n        /// <returns></returns>\r\n        public static string GetXPath(this XObject xObject)\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            GetXPath(xObject, sb);\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n        \r\n        private static void GetXPath(this XObject xObject, StringBuilder currentPath)\r\n        {\r\n            if (xObject == null) throw new ArgumentNullException(\"xObject\");\r\n\r\n            XElement element = xObject as XElement;\r\n            if (element != null)\r\n            {\r\n                if (element.Parent != null)\r\n                {\r\n                    if (element.HasSameSiblings() == false)\r\n                    {\r\n                        currentPath.Insert(0, element.Name.LocalName);\r\n                        currentPath.Insert(0, \"/\");\r\n                    }\r\n                    else\r\n                    {\r\n                        int count = 1 + element.GetSameSiblingsBeforeCount();\r\n\r\n                        currentPath.Insert(0, \"]\");\r\n                        currentPath.Insert(0, count);\r\n                        currentPath.Insert(0, \"[\");\r\n                        currentPath.Insert(0, element.Name.LocalName);\r\n                        currentPath.Insert(0, \"/\");\r\n                    }\r\n\r\n                    GetXPath(element.Parent, currentPath);\r\n                    return;\r\n                }\r\n                else\r\n                {\r\n                    currentPath.Insert(0, element.Name.LocalName);\r\n                    currentPath.Insert(0, \"/\");\r\n                    return;\r\n                }\r\n            }\r\n\r\n            XAttribute attribute = xObject as XAttribute;\r\n            if (attribute != null)\r\n            {\r\n                currentPath.Insert(0, attribute.Name);\r\n                currentPath.Insert(0, \"@\");\r\n\r\n                GetXPath(attribute.Parent, currentPath);\r\n                return;\r\n            }\r\n\r\n            throw new NotSupportedException(\"Only XElement and XAttribute supported\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string[] InlineElements = new string[]\r\n        {\r\n            \"a\", \r\n            \"abbr\", \r\n            \"acronym\", \r\n            \"b\", \r\n            \"basefont\", \r\n            \"bdo\", \r\n            \"big\", \r\n            \"br\", \r\n            \"cite\", \r\n            \"code\", \r\n            \"dfn\", \r\n            \"em\", \r\n            \"font\", \r\n            \"i\", \r\n            \"img\", \r\n            \"input\", \r\n            \"kbd\", \r\n            \"label\", \r\n            \"q\", \r\n            \"s\", \r\n            \"samp\", \r\n            \"select\", \r\n            \"small\", \r\n            \"span\", \r\n            \"strike\", \r\n            \"strong\", \r\n            \"sub\", \r\n            \"sup\", \r\n            \"textarea\", \r\n            \"tt\", \r\n            \"u\", \r\n            \"var\"\r\n        };\r\n\r\n        private static readonly HashSet<string> InlineElementsLookup = new HashSet<string>(InlineElements);\r\n\r\n        /// <exclude />\r\n        public static bool IsBlockElement(this XNode node)\r\n        {\r\n            if (node == null) return false;\r\n\r\n            XElement element = node as XElement;\r\n            if (element == null) return false;\r\n\r\n            if (element.Name.Namespace == Namespaces.Xhtml)\r\n            {\r\n                if (InlineElementsLookup.Contains(element.Name.LocalName.ToLowerInvariant())) \r\n                    return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsWhitespaceAware(this XNode node)\r\n        {\r\n            if (node == null) return false;\r\n\r\n            XElement element = node as XElement;\r\n            if (element == null) return false;\r\n\r\n            string localName = element.Name.LocalName.ToLowerInvariant();\r\n            return (localName == \"pre\") || (localName == \"textarea\");\r\n        }      \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XhtmlDocument.cs",
    "content": "﻿using System.Xml.Linq;\r\nusing System;\r\nusing Composite.Core.Types;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Xml;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>\r\n    /// Represents an XHTML Document inside C1 CMS. \r\n    /// \r\n    /// This structure can contain both head elements and body elements (content) and XhtmlDocuments that are being rendered\r\n    /// can be nested within each other. The C1 CMS core will normalize such a nested structure when rendering a page, ensuring head elementsa flow to the top level\r\n    /// document and body content is left, ultimately yielding one complete and correctly structured xhtml page.\r\n    /// </summary>\r\n    [XhtmlDocumentConverter]\r\n    public sealed class XhtmlDocument : XDocument\r\n    {\r\n        internal static readonly XName XName_html = Namespaces.Xhtml + \"html\";\r\n        internal static readonly XName XName_head = Namespaces.Xhtml + \"head\";\r\n        internal static readonly XName XName_body = Namespaces.Xhtml + \"body\";\r\n\r\n        private static readonly string XhtmlFragmentDtdInternalSubset;\r\n        private static readonly string EntityFileName = PathUtil.Resolve(\"~/App_Data/Composite/Configuration/Entities.xml\");\r\n\r\n        static XhtmlDocument()\r\n        {\r\n            if (File.Exists(EntityFileName))\r\n            {\r\n                var doc = XDocument.Load(EntityFileName);\r\n\r\n                var sb = new StringBuilder();\r\n\r\n                foreach (var element in doc.Root.Elements())\r\n                {\r\n                    string name = (string) element.Attribute(\"name\");\r\n                    string xmlsafe = (string) element.Attribute(\"xmlsafe\");\r\n\r\n                    if (!string.IsNullOrEmpty(name) && xmlsafe != null)\r\n                    {\r\n                        sb.AppendFormat(@\"<!ENTITY {0} '{1}'>\", name, xmlsafe);\r\n                    }\r\n                }\r\n\r\n                XhtmlFragmentDtdInternalSubset = sb.ToString();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Constructs an empty XhtmlDocument\r\n        /// </summary>\r\n        public XhtmlDocument()\r\n            : base(new XElement(XName_html,\r\n                new XElement(XName_head),\r\n                new XElement(XName_body)))\r\n        { }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a XhtmlDocument based on an existing html element\r\n        /// </summary>\r\n        /// <param name=\"htmlElement\">Existing html element the XhtmlDocument should be cloned from</param>\r\n        public XhtmlDocument(XElement htmlElement)\r\n            : base(htmlElement)\r\n        {\r\n            this.Validate();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a XhtmlDocument based on an existing XDocument\r\n        /// </summary>\r\n        /// <param name=\"other\">Existing XDocument instance the XhtmlDocument should be cloned from</param>\r\n        public XhtmlDocument(XDocument other)\r\n            : base(other)\r\n        {\r\n            this.Validate();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The head element for the XHTML Document\r\n        /// </summary>\r\n        public XElement Head => this.Root.Element(XName_head);\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The body element for the XHTML Document\r\n        /// </summary>\r\n        public XElement Body => this.Root.Element(XName_body);\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the XhtmlDocument has empty head and body sections.\r\n        /// </summary>\r\n        public bool IsEmpty\r\n        {\r\n            get\r\n            {\r\n                bool hasContent = this.Head.Nodes().Any() || this.Body.Nodes().Any() || this.Body.Attributes().Any();\r\n\r\n                return !hasContent;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Parses a serialized xhtml document and returns XhtmlDocument.\r\n        /// </summary>\r\n        /// <param name=\"xhtml\">xhtml to parse.</param>\r\n        /// <returns>XhtmlDocument representing the supplied string</returns>\r\n        public new static XhtmlDocument Parse(string xhtml)\r\n        {\r\n            var doc = new XhtmlDocument(XDocument.Parse(xhtml));\r\n\r\n            List<XElement> sourceWhitespaceSensitiveElements = GetWhitespaceSensitiveElements(doc);\r\n\r\n            if (sourceWhitespaceSensitiveElements.Any())\r\n            {\r\n                XhtmlDocument docWithWhitespaces = new XhtmlDocument(XDocument.Parse(xhtml, LoadOptions.PreserveWhitespace));\r\n                List<XElement> fixedWhitespaceSensitiveElements = GetWhitespaceSensitiveElements(docWithWhitespaces);\r\n\r\n                for (int i = 0; i < sourceWhitespaceSensitiveElements.Count; i++)\r\n                {\r\n                    sourceWhitespaceSensitiveElements[i].ReplaceWith(fixedWhitespaceSensitiveElements[i]);\r\n                }\r\n            }\r\n\r\n            return doc;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Parses a serialized xhtml document and returns XhtmlDocument.\r\n        /// </summary>\r\n        /// <param name=\"xhtml\">xhtml to parse.</param>\r\n        /// <param name=\"options\">This parameter is here for informative purposes - only LoadOptions.None is accepted, since anything else is a change to the DOM and a breeding ground for bugs</param>\r\n        /// <returns>XhtmlDocument representing the supplied string</returns>\r\n        public new static XhtmlDocument Parse(string xhtml, LoadOptions options)\r\n        {\r\n            if (options != LoadOptions.None)\r\n                throw new NotImplementedException(\"PreserveWhitespace (anything but None) option is explicitly disallowed to prevent bugs - it will turn insignificant whitespace into text nodes, changing the DOM.\");\r\n\r\n            return Parse(xhtml);\r\n        }\r\n\r\n\r\n        private void Validate()\r\n        {\r\n            if (this.Root != null)\r\n            {\r\n                Verify.That(this.Root.Name == XName_html, \"Supplied XDocument must have a root named html belonging to the namespace xmlns=\\\"{0}\\\"\", Namespaces.Xhtml);\r\n                Verify.IsNotNull(this.Head, \"XHTML document is missing <head /> element\");\r\n                Verify.IsNotNull(this.Body, \"XHTML document is missing <body /> element\");\r\n            }\r\n        }\r\n\r\n\r\n        private static List<XElement> GetWhitespaceSensitiveElements(XhtmlDocument doc)\r\n        {\r\n            return doc.Descendants().Where(node => node.Name.Namespace == Namespaces.Xhtml && (node.Name.LocalName == \"pre\" || node.Name.LocalName == \"textarea\")).ToList();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Parses an xhtml fragment of into an XhtmlDocument.\r\n        /// </summary>\r\n        /// <param name=\"fragment\"></param>\r\n        /// <returns></returns>\r\n        public static XhtmlDocument ParseXhtmlFragment(string fragment)\r\n        {\r\n            if (string.IsNullOrEmpty(fragment))\r\n            {\r\n                return new XhtmlDocument();\r\n            }\r\n\r\n            var nodes = new List<XNode>();\r\n\r\n            using (var stringReader = new StringReader(fragment))\r\n            {\r\n                var xmlReaderSettings = new XmlReaderSettings\r\n                {\r\n                    IgnoreWhitespace = true,\r\n                    DtdProcessing = DtdProcessing.Parse,\r\n                    MaxCharactersFromEntities = 10000000,\r\n                    XmlResolver = null,\r\n                    ConformanceLevel = ConformanceLevel.Fragment // Allows multiple XNode-s\r\n                };\r\n\r\n                var inputContext = FragmentContainsHtmlEntities(fragment) ? GetXhtmlFragmentParserContext() : null;\r\n\r\n                using (var xmlReader = XmlReader.Create(stringReader, xmlReaderSettings, inputContext))\r\n                {\r\n                    xmlReader.MoveToContent();\r\n\r\n                    while (!xmlReader.EOF)\r\n                    {\r\n                        XNode node = XNode.ReadFrom(xmlReader);\r\n                        nodes.Add(node);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (nodes.Count == 1 && nodes[0] is XElement element && element.Name.LocalName == \"html\")\r\n            {\r\n                return new XhtmlDocument(element);\r\n            }\r\n\r\n            var document = new XhtmlDocument();\r\n            document.Body.Add(nodes);\r\n\r\n            return document;\r\n        }\r\n\r\n        private static bool FragmentContainsHtmlEntities(string fragment)\r\n        {\r\n            int searchOffset = 0;\r\n\r\n            while (searchOffset != -1)\r\n            {\r\n                int ampersandOffset = fragment.IndexOf(\"&\", searchOffset, StringComparison.Ordinal);\r\n                if (ampersandOffset == -1)\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                searchOffset = ampersandOffset + 1;\r\n\r\n                int symbolsLeft = fragment.Length - ampersandOffset - 1;\r\n                if ((symbolsLeft > 0 && fragment[ampersandOffset + 1] == '#')\r\n                    || (symbolsLeft >= 4\r\n                        && fragment[ampersandOffset + 1] == 'a'\r\n                        && fragment[ampersandOffset + 2] == 'm'\r\n                        && fragment[ampersandOffset + 3] == 'p'\r\n                        && fragment[ampersandOffset + 4] == ';')\r\n                    || (symbolsLeft >= 5\r\n                        && fragment[ampersandOffset + 1] == 'a'\r\n                        && fragment[ampersandOffset + 2] == 'p'\r\n                        && fragment[ampersandOffset + 3] == 'o'\r\n                        && fragment[ampersandOffset + 4] == 's'\r\n                        && fragment[ampersandOffset + 5] == ';')\r\n                    || (symbolsLeft >= 5\r\n                        && fragment[ampersandOffset + 1] == 'q'\r\n                        && fragment[ampersandOffset + 2] == 'u'\r\n                        && fragment[ampersandOffset + 3] == 'o'\r\n                        && fragment[ampersandOffset + 4] == 't'\r\n                        && fragment[ampersandOffset + 5] == ';')\r\n                    || (symbolsLeft >= 3\r\n                        && fragment[ampersandOffset + 1] == 'g'\r\n                        && fragment[ampersandOffset + 2] == 't'\r\n                        && fragment[ampersandOffset + 3] == ';')\r\n                    || (symbolsLeft >= 3\r\n                        && fragment[ampersandOffset + 1] == 'l'\r\n                        && fragment[ampersandOffset + 2] == 't'\r\n                        && fragment[ampersandOffset + 3] == ';'))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                return true;\r\n            }\r\n\r\n            // this line should not be reachable\r\n            return false;\r\n        }\r\n\r\n        private static XmlParserContext GetXhtmlFragmentParserContext()\r\n        {\r\n            if (XhtmlFragmentDtdInternalSubset == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new XmlParserContext(null, null, \"internal\",\r\n                String.Empty,\r\n                String.Empty,\r\n                XhtmlFragmentDtdInternalSubset,\r\n                String.Empty,\r\n                String.Empty,\r\n                XmlSpace.Default,\r\n                Encoding.UTF8);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class XhtmlDocumentConverterAttribute : ValueTypeConverterHelperAttribute\r\n    {\r\n        public override bool TryConvert(object value, Type targetType, out object targetValue)\r\n        {\r\n            Verify.ArgumentNotNull(value, \"value\");\r\n\r\n            if (targetType == typeof(XhtmlDocument) && value is XElement element)\r\n            {\r\n                targetValue = new XhtmlDocument(element);\r\n                return true;\r\n            }\r\n\r\n            if ((targetType == typeof(XElement) || targetType == typeof(XNode))\r\n                && value is XhtmlDocument document)\r\n            {\r\n                targetValue = document.Root;\r\n                return true;\r\n            }\r\n\r\n            targetValue = null;\r\n            return false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XhtmlErrorFormatter.cs",
    "content": "﻿using System;\r\nusing System.Reflection;\r\nusing System.Web;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>\r\n    /// Provide html formatting for errors\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class XhtmlErrorFormatter\r\n    {\r\n        private const string ErrorDivStyle = \"border: 1px solid red; padding: 2px 6px 2px 6px; background-color: InfoBackground; color: InfoText; -moz-border-radius: 4px; -moz-box-shadow: 1px 1px 3px 0 rgba(0,0,0,0.75); margin-bottom: 5px;font-size: 12px; line-height: 16px;\";\r\n        private const string SourceCodeStyle = \"border: 1px solid #AAAAAA; padding: 5px; background-color: #EEEEEE;font-size: 12px;\";\r\n        private const string SourceCodeErrorLineStyle = \"background-color: white; color: red\";\r\n        private static readonly string ExceptionData_SourceCode = \"C1.SourceCode\";\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use EmbedSourceCodeInformation() instead\")]\r\n        public static void EmbedSouceCodeInformation(Exception ex, string[] sourceCodeLines, int errorLine)\r\n        {\r\n            EmbedSourceCodeInformation(ex, sourceCodeLines, errorLine);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Embeds the source code information.\r\n        /// </summary>\r\n        /// <param name=\"ex\">The exception.</param>\r\n        /// <param name=\"sourceCodeLines\">The source code lines.</param>\r\n        /// <param name=\"errorLine\">The error line number.</param>\r\n        public static void EmbedSourceCodeInformation(Exception ex, string[] sourceCodeLines, int errorLine)\r\n        {\r\n            if (ex.Data.Contains(ExceptionData_SourceCode))\r\n            {\r\n                return;\r\n            }\r\n\r\n            ex.Data[ExceptionData_SourceCode] = SourceCodePreview(sourceCodeLines, errorLine).ToString();\r\n        }\r\n\r\n        private static XElement SourceCodePreview(string filePath, int errorLine)\r\n        {\r\n            string[] lines = C1File.ReadAllLines(filePath);\r\n\r\n            return SourceCodePreview(lines, errorLine);\r\n        }\r\n\r\n        private static XElement SourceCodePreview(string[] sourceCodeLines, int errorLine)\r\n        {\r\n            var result = new XElement(Namespaces.Xhtml + \"pre\", new XAttribute(\"style\", SourceCodeStyle));\r\n\r\n            int firstLineIndexToShow = Math.Max(0, errorLine - 3);\r\n            int lastLineIndexToShow = Math.Min(sourceCodeLines.Length - 1, errorLine + 1);\r\n\r\n            for (int i = firstLineIndexToShow; i <= lastLineIndexToShow; i++)\r\n            {\r\n                string text = (i + 1) + \": \" + sourceCodeLines[i];\r\n                if (i == errorLine - 1)\r\n                {\r\n                    result.Add(new XElement(Namespaces.Xhtml + \"div\", new XAttribute(\"style\", SourceCodeErrorLineStyle), text));\r\n                }\r\n                else\r\n                {\r\n                    result.Add(text + Environment.NewLine);\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Create a html element documenting an exception. If the page being rendered is requested by an authenticated C1 Console user the \r\n        /// exception information is more verbose.\r\n        /// </summary>\r\n        /// <param name=\"ex\"></param>\r\n        /// <param name=\"functionName\"></param>\r\n        /// <returns></returns>\r\n        internal static XElement GetErrorDescriptionHtmlElement(Exception ex, string functionName)\r\n        {\r\n            if (!Composite.C1Console.Security.UserValidationFacade.IsLoggedIn())\r\n            {\r\n                return new XElement(Namespaces.Xhtml + \"span\",\r\n                                    new XAttribute(\"class\", \"c1error\"),\r\n                                    \"[ Error ]\");\r\n            }\r\n\r\n            XElement functionInfo = functionName == null ? null : new XElement(Namespaces.Xhtml + \"div\", \"Function: \" + functionName);\r\n\r\n            XElement sourceCode = GetSourceCodeInfo(ex);\r\n\r\n            bool sourceAlreadyShown = false;\r\n\r\n            XElement nestedExceptionInfo = ex.InnerException == null\r\n                                               ? null\r\n                                               : new XElement(Namespaces.Xhtml + \"div\",\r\n                                                              new XAttribute(\"style\", \"font-size: 0.9em\"),\r\n                                                              GetNestedHtmlListFromExceptions(ex.InnerException,\r\n                                                                                              ref sourceAlreadyShown));\r\n\r\n            return new XElement(Namespaces.Xhtml + \"div\",\r\n                                new XAttribute(\"class\", \"c1errordetails\"),\r\n                                new XAttribute(\"style\", ErrorDivStyle),\r\n                                new XElement(Namespaces.Xhtml + \"strong\", \r\n                                                new XAttribute(\"title\", ex.StackTrace),\r\n                                                string.Format(\"Error: {0}\", ex.Message)),\r\n                                !sourceAlreadyShown ? sourceCode : null,\r\n                                functionInfo,\r\n                                nestedExceptionInfo\r\n                                );\r\n        }\r\n\r\n        private static XElement GetNestedHtmlListFromExceptions(Exception ex, ref bool sourceCodeShown)\r\n        {\r\n            if (ex == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            XElement sourceCode = GetSourceCodeInfo(ex);\r\n\r\n            XElement nestedExceptionsInfo = GetNestedHtmlListFromExceptions(ex.InnerException, ref sourceCodeShown);\r\n\r\n            bool showSourceCode = !sourceCodeShown && sourceCode != null;\r\n\r\n            sourceCodeShown |= showSourceCode;\r\n\r\n            return new XElement(Namespaces.Xhtml + \"div\",\r\n                new XAttribute(\"style\", \"padding-left: 10px;\"),\r\n                new XAttribute(\"title\", ex.StackTrace ?? \"\"),\r\n                ex.Message,\r\n                showSourceCode ? sourceCode : null,\r\n                nestedExceptionsInfo);\r\n        }\r\n\r\n        private static XElement GetSourceCodeInfo(Exception ex)\r\n        {\r\n            if (ex.Data.Contains(ExceptionData_SourceCode))\r\n            {\r\n                return XElement.Parse((string)ex.Data[ExceptionData_SourceCode]);\r\n            }\r\n\r\n            if (ex is HttpCompileException)\r\n            {\r\n                object firstCompileError = GetPropertyValue(ex, \"FirstCompileError\");\r\n\r\n                if (firstCompileError != null)\r\n                {\r\n                    string filePath = (string)GetPropertyValue(firstCompileError, \"FileName\");\r\n                    int line = (int)GetPropertyValue(firstCompileError, \"Line\");\r\n\r\n                    if (!string.IsNullOrEmpty(filePath))\r\n                    {\r\n                        return SourceCodePreview(filePath, line);\r\n                    }\r\n                }\r\n            }\r\n\r\n            var httpParseException = ex as HttpParseException;\r\n            if (httpParseException != null)\r\n            {\r\n                return SourceCodePreview(httpParseException.FileName, httpParseException.Line);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private static object GetPropertyValue(object @object, string name)\r\n        {\r\n            var property = @object.GetType().GetProperty(name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);\r\n\r\n            Verify.IsNotNull(property, \"Missing property '{0}' on type '{1}'\", name, @object.GetType());\r\n\r\n            return property.GetValue(@object, null);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XhtmlPrettifier.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Xml;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class XhtmlPrettifier\r\n    {\r\n        private static string _ampersandWord = \"C1AMPERSAND\";\r\n        private static readonly Regex _encodeCDataRegex = new Regex(@\"<!\\[CDATA\\[((?:[^]]|\\](?!\\]>))*)\\]\\]>\", RegexOptions.Compiled);\r\n        private static readonly Regex _decodeCDataRegex = new Regex(\"C1CDATAREPLACE(?<counter>[0-9]*)\", RegexOptions.Compiled);\r\n        private static readonly Regex _encodeRegex = new Regex(@\"&(?<tag>[^\\;]+;)\", RegexOptions.Compiled);\r\n        private static readonly Regex _decodeRegex = new Regex(@\"C1AMPERSAND(?<tag>[^\\;]+;)\", RegexOptions.Compiled);\r\n\r\n        private static readonly char[] IncorrectEscapeSequenceCharacters = { '\\'', '\\\"', '<', '>', ' ' };\r\n        \r\n\r\n        private static readonly char[] WhitespaceChars = { '\\t', '\\n', '\\v', '\\f', '\\r', ' ', '\\x0085', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '​', '\\u2028', '\\u2029', '　', '﻿' };\r\n        private static readonly HashSet<char> WhitespaceCharsLookup = new HashSet<char>(WhitespaceChars);\r\n\r\n        private static readonly HashSet<NamespaceName> CompactElements = new HashSet<NamespaceName>(new []\r\n        {\r\n            new NamespaceName { Name = \"title\", Namespace = \"\" }\r\n        });\r\n\r\n        private static readonly HashSet<NamespaceName> AlwaysWrapElements = new HashSet<NamespaceName>(new[]\r\n        {\r\n            new NamespaceName { Name = \"html\", Namespace = \"\" },\r\n            new NamespaceName { Name = \"head\", Namespace = \"\" },\r\n            new NamespaceName { Name = \"body\", Namespace = \"\" }\r\n        });\r\n\r\n        internal static readonly HashSet<NamespaceName> InlineElements = new HashSet<NamespaceName>(new []\r\n        {\r\n            new NamespaceName { Name = \"a\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"abbr\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"acronym\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"b\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"basefont\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"bdo\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"big\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"br\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"cite\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"code\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"dfn\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"em\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"fieldreference\", Namespace = Namespaces.DynamicData10.NamespaceName },\r\n            new NamespaceName { Name = \"font\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"i\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"img\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"input\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"kbd\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"label\", Namespace = \"\" },\r\n            new NamespaceName { Name = \"mark\", Namespace = \"\" },\r\n            new NamespaceName { Name = \"page.description\", Namespace = Namespaces.Rendering10.NamespaceName },\r\n            new NamespaceName { Name = \"page.title\", Namespace = Namespaces.Rendering10.NamespaceName },\r\n            new NamespaceName { Name = \"q\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"s\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"samp\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"select\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"small\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"span\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"strike\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"strong\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"sub\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"sup\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"textarea\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"tt\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"u\", Namespace = \"\" }, \r\n            new NamespaceName { Name = \"var\", Namespace = \"\" },\r\n        });\r\n\r\n\r\n\r\n        private static readonly HashSet<NamespaceName> WhitespaceAwareElements = new HashSet<NamespaceName>(new[]\r\n            {\r\n                new NamespaceName { Name = \"style\", Namespace = \"\" }, \r\n                new NamespaceName { Name = \"script\", Namespace = \"\" }, \r\n                new NamespaceName { Name = \"pre\", Namespace = \"\" }, \r\n                new NamespaceName { Name = \"textarea\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"variable\", Namespace = \"http://www.w3.org/1999/xsl/transform\" }\r\n            });\r\n\r\n\r\n\r\n        private static readonly HashSet<NamespaceName> SelfClosingElements = new HashSet<NamespaceName>(new []\r\n            {\r\n                // \"Void elements\" defined in HTML5\r\n                new NamespaceName { Name = \"area\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"base\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"br\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"col\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"command\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"embed\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"hr\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"img\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"input\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"keygen\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"link\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"meta\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"param\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"source\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"track\", Namespace = \"\" },\r\n                new NamespaceName { Name = \"wbr\", Namespace = \"\" },\r\n                // Obsolete element types\r\n                new NamespaceName { Name = \"basefont\", Namespace = \"\" }, \r\n                new NamespaceName { Name = \"frame\", Namespace = \"\" }\r\n            });\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string Prettify(string xmlString)\r\n        {\r\n            return Prettify(xmlString, \"\\t\");\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string Prettify(string xmlString, string indentString)\r\n        {\r\n            xmlString = XmlUtils.RemoveXmlDeclaration(xmlString);\r\n            CDataMatchHandler cdataMatchHandler;\r\n\r\n            IEnumerable<XmlNode> tree = BuildTree(xmlString, out cdataMatchHandler);\r\n\r\n            var sb = new StringBuilder();\r\n            NodeTreeToString(tree, sb, indentString, false);\r\n\r\n            string result = sb.ToString();\r\n\r\n            result = _decodeCDataRegex.Replace(result, cdataMatchHandler.Decode);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        private static void NodeTreeToString(IEnumerable<XmlNode> nodes, StringBuilder stringBuilder, string indentString, bool keepWhiteSpaces)\r\n        {\r\n            foreach (XmlNode node in nodes)\r\n            {\r\n                if (node.NodeType == XmlNodeType.Element)\r\n                {\r\n                    if (!keepWhiteSpaces\r\n                        && (node.IsBlockElement() \r\n                            || node.ContainsBlockElements \r\n                            || (node.ParentNode != null && node.ParentNode.ContainsBlockElements)) \r\n                        && (node.Level > 0))\r\n                    {\r\n                        stringBuilder.AppendLine().AddIndent(node.Level, indentString);\r\n                    }\r\n\r\n                    stringBuilder.Append(\"<\").Append(node.Name);\r\n                    foreach (XmlAttribute attribute in node.Attributes)\r\n                    {\r\n                        if (!attribute.Name.StartsWith(\"xmlns\", StringComparison.OrdinalIgnoreCase) \r\n                            || node.ParentNode == null \r\n                            || node.ParentNode.NamespaceByPrefix(attribute.Name) != node.NamespaceURI)\r\n                        {\r\n                            stringBuilder.Append(\" \").Append(attribute.Name).Append(\"=\\\"\").Append(EncodeAttributeString(attribute.Value)).Append(\"\\\"\");\r\n                        }\r\n                    }\r\n\r\n                    bool isSelfClosingAndEmpty = node.IsSelfClosingElement() &&\r\n                                                 !node.IsAlwaysWrapElement() &&\r\n                                                 (node.IsEmpty \r\n                                                  || !node.ChildNodes.Any(f => f.NodeType == XmlNodeType.Element || f.NodeType == XmlNodeType.Text));\r\n\r\n                    stringBuilder.Append(isSelfClosingAndEmpty ? \" />\" : \">\");\r\n\r\n                    bool nodeIsWhiteSpaceAware = node.IsWhitespaceAware();\r\n\r\n                    // Recursive call\r\n                    NodeTreeToString(node.ChildNodes, stringBuilder, indentString, keepWhiteSpaces || nodeIsWhiteSpaceAware);\r\n\r\n\r\n                    if (!isSelfClosingAndEmpty)\r\n                    {\r\n                        if (!keepWhiteSpaces && !nodeIsWhiteSpaceAware && (node.ContainsBlockElements || node.IsAlwaysWrapElement()) && !node.IsCompactElement())\r\n                        {\r\n                            stringBuilder.AppendLine().AddIndent(node.Level, indentString);\r\n                        }\r\n\r\n                        stringBuilder.Append(\"</\").Append(node.Name).Append(\">\");\r\n                    }\r\n                }\r\n                else if (node.NodeType == XmlNodeType.Text)\r\n                {\r\n                    string value;\r\n\r\n                    bool addSpaceToBegin = false, addSpaceToEnd = false;\r\n\r\n                    if (!keepWhiteSpaces)\r\n                    {\r\n                        bool startsWithWhitespace = WhitespaceCharsLookup.Contains(node.Value[0]);\r\n                        bool endsWithWhitespace = WhitespaceCharsLookup.Contains(node.Value[node.Value.Length - 1]);\r\n\r\n                        value = SuperTrim(node.Value);\r\n\r\n                        if (startsWithWhitespace )\r\n                        {\r\n                            if ((node.PreviousNode != null && !node.PreviousNode.IsBlockElement())\r\n                                || (node.ParentNode != null && !node.ParentNode.IsBlockElement() && !node.ParentNode.IsCompactElement()))\r\n                            {\r\n                                addSpaceToBegin = true;\r\n                            }\r\n                        }\r\n\r\n                        if (endsWithWhitespace )\r\n                        {\r\n                            if ((node.NextNode != null && !node.NextNode.IsBlockElement())\r\n                                || (node.ParentNode != null && !node.ParentNode.IsBlockElement() && !node.ParentNode.IsCompactElement()))\r\n                            {\r\n                                addSpaceToEnd = true;\r\n                            }\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        value = node.Value;\r\n                    }\r\n\r\n                    if (addSpaceToBegin)\r\n                    {\r\n                        stringBuilder.Append(\" \");\r\n                    }\r\n\r\n                    stringBuilder.Append(EncodeElementString(value));\r\n\r\n                    if (addSpaceToEnd)\r\n                    {\r\n                        stringBuilder.Append(\" \");\r\n                    }\r\n                }\r\n                else if (node.NodeType == XmlNodeType.Whitespace || node.NodeType == XmlNodeType.SignificantWhitespace)\r\n                {\r\n                    if (node.PreviousNode != null && node.PreviousNode.NodeType == XmlNodeType.Element && !node.PreviousNode.IsBlockElement() &&\r\n                        node.NextNode != null && node.NextNode.NodeType == XmlNodeType.Element && !node.NextNode.IsBlockElement())\r\n                    {\r\n                        stringBuilder.Append(\" \");\r\n                    }\r\n                    else if (keepWhiteSpaces || (node.NextNode != null && node.NextNode.NodeType == XmlNodeType.Comment))\r\n                    {\r\n                        stringBuilder.Append(node.Value);\r\n                    }\r\n                }\r\n                else if (node.NodeType == XmlNodeType.CDATA)\r\n                {\r\n                    if(!keepWhiteSpaces)\r\n                    {\r\n                        stringBuilder.AppendLine();\r\n                    }\r\n                    stringBuilder.Append(\"<![CDATA[\");\r\n                    stringBuilder.Append(node.Value);\r\n                    stringBuilder.Append(\"]]>\");\r\n\r\n                    if (!keepWhiteSpaces)\r\n                    {\r\n                        stringBuilder.AppendLine().AddIndent(node.Level - 1, indentString);\r\n                    }\r\n                }\r\n                else if (node.NodeType == XmlNodeType.Comment)\r\n                {\r\n                    var previousNode = node.PreviousNode;\r\n\r\n                    if(previousNode == null || \r\n                        (previousNode.NodeType != XmlNodeType.Text \r\n                        && previousNode.NodeType != XmlNodeType.Whitespace))\r\n                    {\r\n                        stringBuilder.AppendLine().AddIndent(node.Level, indentString);\r\n                    }\r\n\r\n                    stringBuilder.Append(\"<!--\").Append(RemoveC1EncodedAmpersands(node.Value)).Append(\"-->\");\r\n                    if (node.ParentNode != null && !node.ParentNode.IsBlockElement())\r\n                    {\r\n                        stringBuilder.AppendLine().AddIndent(node.Level - 1, indentString);\r\n                    }\r\n                }\r\n                else if (node.NodeType == XmlNodeType.DocumentType)\r\n                {\r\n                    stringBuilder.Append(\"<!DOCTYPE \" + node.Name);\r\n\r\n                    foreach (XmlAttribute attribute in node.Attributes)\r\n                    {\r\n                        if (attribute.Name.ToLowerInvariant() != \"system\")\r\n                        {\r\n                            stringBuilder.Append(\" \").Append(attribute.Name).Append(\" \\\"\").Append(attribute.Value).Append(\"\\\"\");\r\n                        }\r\n                        else\r\n                        {\r\n                            stringBuilder.Append(\" \\\"\").Append(attribute.Value).Append(\"\\\"\");\r\n                        }\r\n                    }\r\n\r\n                    stringBuilder.AppendLine(\">\");\r\n                }\r\n                else if (node.NodeType == XmlNodeType.XmlDeclaration)\r\n                {\r\n                    stringBuilder.Append(\"<?\");\r\n                    stringBuilder.Append(node.Name);\r\n                    stringBuilder.Append(\" \");\r\n                    stringBuilder.Append(node.Value);\r\n                    stringBuilder.AppendLine(\"?>\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static StringBuilder AddIndent(this StringBuilder sb, int level, string indentString)\r\n        {\r\n            for (int i = 0; i < level; i++)\r\n            {\r\n                sb.Append(indentString);\r\n            }\r\n\r\n            return sb;\r\n        }\r\n\r\n\r\n\r\n        private static string EncodeAttributeString(string value)\r\n        {\r\n            value = value.Replace(\"&\", \"&amp;\").Replace(\"<\", \"&lt;\").Replace(\">\", \"&gt;\").Replace(\"\\\"\", \"&quot;\");\r\n\r\n            return RemoveC1EncodedAmpersands(value);\r\n        }\r\n\r\n\r\n\r\n        private static string EncodeElementString(string value)\r\n        {\r\n            value = value.Replace(\"&\", \"&amp;\").Replace(\"<\", \"&lt;\").Replace(\">\", \"&gt;\");\r\n\r\n            return RemoveC1EncodedAmpersands(value);\r\n        }\r\n\r\n\r\n        private static string RemoveC1EncodedAmpersands(string value)\r\n        {\r\n            return _decodeRegex.Replace(value, match => \"&\" + match.Groups[\"tag\"].Value);\r\n        }\r\n\r\n\r\n        \r\n        /// <summary>\r\n        /// Merges sequences of white spaces\r\n        /// </summary>\r\n        /// <exclude />\r\n        public static string SuperTrim(string value)\r\n        {\r\n            StringBuilder sb = null;\r\n\r\n            value = value.Trim(WhitespaceChars); /* Symbol #160 - the non-breaking space, shouldn't be trimmed */\r\n\r\n            int index = 0;\r\n            int oldIndex = 0;\r\n            while (index < value.Length)\r\n            {\r\n                char ch = value[index];\r\n\r\n                // If there's just one space in a sequence, ignoring it\r\n                if (ch == ' ' && !WhitespaceCharsLookup.Contains(value[index + 1]))\r\n                {\r\n                    index += 2;\r\n                    continue;\r\n                }\r\n\r\n                if(WhitespaceCharsLookup.Contains(ch))\r\n                {\r\n                    sb = sb ?? new StringBuilder();\r\n\r\n                    sb.Append(value, oldIndex, index - oldIndex);\r\n                    sb.Append(\" \");\r\n\r\n                    do\r\n                    {\r\n                        ++index;\r\n                    } while (WhitespaceCharsLookup.Contains(value[index]));\r\n\r\n                    oldIndex = index;\r\n                }\r\n\r\n                index++;\r\n            }\r\n\r\n            if (sb == null)\r\n            {\r\n                return value;\r\n            }\r\n\r\n            sb.Append(value, oldIndex, index - oldIndex);\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<XmlNode> BuildTree(string xmlString, out CDataMatchHandler cdataMatchHandler)\r\n        {\r\n            cdataMatchHandler = new CDataMatchHandler();\r\n\r\n            xmlString = _encodeCDataRegex.Replace(xmlString, cdataMatchHandler.Encode);\r\n\r\n            xmlString = _encodeRegex.Replace(xmlString, delegate(Match match)\r\n            {\r\n                string entiryStr =  match.Groups[\"tag\"].Value;\r\n\r\n                return IsCorrectEscapeEntity(entiryStr) \r\n                    ?  _ampersandWord + entiryStr\r\n                    : \"&\" + entiryStr;\r\n            });\r\n\r\n\r\n            var xmlReaderSettings = new XmlReaderSettings {DtdProcessing = DtdProcessing.Parse, XmlResolver = null};\r\n\r\n            using (XmlReader xmlReader = XmlTextReader.Create(new StringReader(xmlString), xmlReaderSettings))\r\n            {\r\n                return BuildTree(xmlReader, 0).ToList();\r\n            }\r\n        }\r\n\r\n\r\n        private static bool IsCorrectEscapeEntity(string match)\r\n        {\r\n            return (match.Length < 30) && match.IndexOfAny(IncorrectEscapeSequenceCharacters) == -1;\r\n        }\r\n\r\n\r\n        private static IEnumerable<XmlNode> BuildTree(XmlReader xmlReader, int level)\r\n        {\r\n            while (xmlReader.Read() )\r\n            {\r\n                if (xmlReader.NodeType == XmlNodeType.EndElement) yield break;\r\n\r\n                var node = new XmlNode\r\n                {\r\n                    NodeType = xmlReader.NodeType,\r\n                    Name = xmlReader.Name,\r\n                    NamespaceURI = xmlReader.NamespaceURI ?? \"\",\r\n                    Value = xmlReader.Value,\r\n                    Level = level,\r\n                    IsEmpty = xmlReader.IsEmptyElement\r\n                };\r\n\r\n                if (node.NodeType == XmlNodeType.Element || node.NodeType == XmlNodeType.DocumentType)\r\n                {\r\n                    int attributeCount = xmlReader.AttributeCount;\r\n                    for (int i = 0; i < attributeCount; i++)\r\n                    {\r\n                        xmlReader.MoveToAttribute(i);\r\n\r\n                        var attribute = new XmlAttribute\r\n                        {\r\n                            Name = xmlReader.Name, \r\n                            Value = xmlReader.Value\r\n                        };\r\n\r\n                        node.AddAttribute(attribute);\r\n                    }\r\n\r\n                    if (node.NodeType == XmlNodeType.Element)\r\n                    {\r\n                        if (!node.IsEmpty)\r\n                        {\r\n                            foreach (XmlNode childNode in BuildTree(xmlReader, level + 1))\r\n                            {\r\n                                node.AddChild(childNode);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n                yield return node;\r\n            }\r\n        }\r\n\r\n\r\n        private enum TriState\r\n        {\r\n            Undefined = -1,\r\n            False = 0,\r\n            True = 1\r\n        }\r\n\r\n        [DebuggerDisplay(\"Type = {NodeType}, Name = {Name}, Value = {Value}\")]\r\n        private class XmlNode\r\n        {\r\n            private static readonly IEnumerable<XmlAttribute> EmptyAttributeList = Enumerable.Empty<XmlAttribute>();\r\n\r\n            private XmlNode _firstNode;\r\n            private XmlNode _lastNode;\r\n            private List<XmlAttribute> _attributes;\r\n            private TriState _containsBlockElements = TriState.Undefined;\r\n            private TriState _isBlockElement = TriState.Undefined;\r\n            private TriState _isCompactElement = TriState.Undefined;\r\n            private TriState _isAlwaysWrapElement = TriState.Undefined;\r\n            private NamespaceName _namespaceName;\r\n\r\n            public XmlNodeType NodeType { get; internal set; }\r\n            public string Name { get; internal set; }\r\n            public string Value { get; internal set; }\r\n            public bool IsEmpty { get; internal set; }\r\n            public string NamespaceURI { get; internal set; }\r\n\r\n            public int Level { get; internal set; }\r\n            public XmlNode ParentNode { get; internal set; }\r\n            public XmlNode PreviousNode { get; internal set; }\r\n            public XmlNode NextNode { get; internal set; }\r\n\r\n            private NamespaceName GetNamespaceName()\r\n            {\r\n                if (_namespaceName == null)\r\n                {\r\n                    _namespaceName = new NamespaceName { Name = this.Name.ToLowerInvariant(), Namespace = GetCustomNamespace() };\r\n                }\r\n                return _namespaceName;\r\n            }\r\n\r\n\r\n            public void AddChild(XmlNode childNode)\r\n            {\r\n                childNode.ParentNode = this;\r\n\r\n                if (_lastNode != null)\r\n                {\r\n                    _lastNode.NextNode = childNode;\r\n                    childNode.PreviousNode = _lastNode;\r\n                }\r\n                else\r\n                {\r\n                    _firstNode = childNode;\r\n                }\r\n\r\n                _lastNode = childNode;\r\n            }\r\n\r\n\r\n\r\n            public void AddAttribute(XmlAttribute attribute)\r\n            {\r\n                if (_attributes == null)\r\n                {\r\n                    _attributes = new List<XmlAttribute>();\r\n                }\r\n                _attributes.Add(attribute);\r\n            }\r\n\r\n\r\n\r\n            public IEnumerable<XmlNode> ChildNodes\r\n            {\r\n                get\r\n                {\r\n                    XmlNode currentNode = _firstNode;\r\n                    while (currentNode != null)\r\n                    {\r\n                        yield return currentNode;\r\n                        currentNode = currentNode.NextNode;\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public IEnumerable<XmlAttribute> Attributes\r\n            {\r\n                get\r\n                {\r\n                    return _attributes ?? EmptyAttributeList;\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public bool ContainsBlockElements\r\n            {\r\n                get\r\n                {\r\n                    if(_containsBlockElements == TriState.Undefined)\r\n                    {\r\n                        _containsBlockElements = ChildNodes.Any(node => node.IsBlockElement() || node.ContainsBlockElements)\r\n                            ? TriState.True : TriState.False;\r\n                    }\r\n\r\n                    return _containsBlockElements == TriState.True;\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public string NamespaceByPrefix(string namespacePrefix)\r\n            {\r\n                var defined = _attributes == null ? null : _attributes.FirstOrDefault(f => f.Name == namespacePrefix);\r\n\r\n                if (defined != null)\r\n                {\r\n                    return defined.Value;\r\n                }\r\n\r\n                if (this.ParentNode != null)\r\n                {\r\n                    return this.ParentNode.NamespaceByPrefix(namespacePrefix);\r\n                }\r\n\r\n                return null;\r\n            }\r\n\r\n\r\n            public bool IsCompactElement()\r\n            {\r\n                if (_isCompactElement == TriState.Undefined)\r\n                {\r\n                    _isCompactElement = this.NodeType == XmlNodeType.Element\r\n                                      && CompactElements.Contains(GetNamespaceName())\r\n                                      ? TriState.True : TriState.False; ;\r\n                }\r\n\r\n                return _isCompactElement == TriState.True;\r\n            }\r\n\r\n\r\n            public bool IsAlwaysWrapElement()\r\n            {\r\n                if (_isAlwaysWrapElement == TriState.Undefined)\r\n                {\r\n                    _isAlwaysWrapElement = this.NodeType == XmlNodeType.Element\r\n                                      && AlwaysWrapElements.Contains(GetNamespaceName())\r\n                                      ? TriState.True : TriState.False; ;\r\n                }\r\n\r\n                return _isAlwaysWrapElement == TriState.True;\r\n            }\r\n            \r\n\r\n            public bool IsBlockElement()\r\n            {\r\n                if(_isBlockElement == TriState.Undefined)\r\n                {\r\n                    _isBlockElement = this.NodeType == XmlNodeType.Element\r\n                                      && !InlineElements.Contains(GetNamespaceName())\r\n                                      ? TriState.True : TriState.False; ;\r\n                }\r\n\r\n                return _isBlockElement == TriState.True;\r\n            }\r\n            \r\n\r\n            public bool IsWhitespaceAware()\r\n            {\r\n                if (this.NodeType != XmlNodeType.Element) return false;\r\n\r\n                if (WhitespaceAwareElements.Contains(GetNamespaceName())) return true;\r\n\r\n                return false;\r\n            }\r\n\r\n\r\n\r\n            public bool IsSelfClosingElement()\r\n            {\r\n                if (this.NodeType != XmlNodeType.Element) return false;\r\n\r\n                var name = GetNamespaceName();\r\n\r\n                if (SelfClosingElements.Contains(name)) return true;\r\n\r\n                return name.Namespace != \"\";\r\n            }\r\n\r\n\r\n\r\n            private string GetCustomNamespace()\r\n            {\r\n                string namespaceName = this.NamespaceURI.ToLowerInvariant();\r\n                if (namespaceName == \"http://www.w3.org/1999/xhtml\")\r\n                {\r\n                    namespaceName = \"\";\r\n                }\r\n\r\n                return namespaceName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [DebuggerDisplay(\"Name = {Name}, Value = {Value}\")]\r\n        private class XmlAttribute\r\n        {\r\n            public string Name { get; internal set; }\r\n            public string Value { get; internal set; }\r\n        }\r\n\r\n\r\n\r\n        internal sealed class NamespaceName\r\n        {\r\n            public string Name;\r\n            public string Namespace;\r\n\r\n            public bool Equals(NamespaceName namespaceName)\r\n            {\r\n                if (namespaceName == null) return false;\r\n\r\n                return this.Name == namespaceName.Name && this.Namespace == namespaceName.Namespace;\r\n            }\r\n\r\n            public override bool Equals(object obj)\r\n            {\r\n                return Equals(obj as NamespaceName);\r\n            }\r\n\r\n            public override int GetHashCode()\r\n            {\r\n                return this.Name.GetHashCode() ^ this.Namespace.GetHashCode();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private sealed class CDataMatchHandler\r\n        {\r\n            List<string> cDatas = new List<string>();\r\n\r\n            public string Encode(Match match)\r\n            {\r\n                string s = \"C1CDATAREPLACE\" + cDatas.Count.ToString();\r\n\r\n                cDatas.Add(match.Value);\r\n\r\n                return s;\r\n            }\r\n\r\n            public string Decode(Match match)\r\n            {\r\n                int index = int.Parse(match.Groups[\"counter\"].Value);\r\n\r\n                return cDatas[index];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XhtmlWriter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n\t/// <summary>\r\n\t/// </summary>\r\n\t/// <exclude />\r\n\t[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n\tpublic static class XhtmlWriterExtensions\r\n\t{\r\n        /// <exclude />\r\n\t\tpublic static XmlWriter CreateXhtmlWriter(this XContainer container)\r\n\t\t{\r\n\t\t\treturn new XhtmlWriter(container.CreateWriter());\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t/// <summary>\r\n\t/// </summary>\r\n\t/// <exclude />\r\n\t[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n\tpublic class XhtmlWriter : XmlWriter\r\n\t{\r\n\t\tprivate readonly XmlWriter _innerWriter;\r\n\t\tprivate string openingElement = String.Empty;\r\n\t\tprivate static HashSet<string> selfClosingElements = new HashSet<string>(\r\n\t\t\tnew []{\r\n\t\t\t\t\"area\",\r\n\t\t\t\t\"base\",\r\n\t\t\t\t\"basefont\",\r\n\t\t\t\t\"br\",\r\n\t\t\t\t\"hr\",\r\n\t\t\t\t\"input\",\r\n\t\t\t\t\"img\",\r\n\t\t\t\t\"link\",\r\n\t\t\t\t\"meta\"\r\n\t\t\t});\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic XhtmlWriter(XmlWriter innerWriter)\r\n\t\t{\r\n\t\t\t_innerWriter = innerWriter;\r\n\t\t}\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void Close()\r\n\t\t{\r\n\t\t\t_innerWriter.Close();\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void Flush()\r\n\t\t{\r\n\t\t\t_innerWriter.Flush();\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override string LookupPrefix(string ns)\r\n\t\t{\r\n\t\t\treturn _innerWriter.LookupPrefix(ns);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteBase64(byte[] buffer, int index, int count)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteBase64(buffer, index, count);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteCData(string text)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteCData(text);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteCharEntity(char ch)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteCharEntity(ch);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteChars(char[] buffer, int index, int count)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteChars(buffer, index, count);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteComment(string text)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteComment(text);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteDocType(string name, string pubid, string sysid, string subset)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteDocType(name, pubid, sysid, subset);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteEndAttribute()\r\n\t\t{\r\n\t\t\t_innerWriter.WriteEndAttribute();\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteEndDocument()\r\n\t\t{\r\n\t\t\t_innerWriter.WriteEndDocument();\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteEndElement()\r\n\t\t{\r\n\t\t\tif (!selfClosingElements.Contains(openingElement))\r\n\t\t\t{\r\n\t\t\t\tWriteFullEndElement();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t_innerWriter.WriteEndElement();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteEntityRef(string name)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteEntityRef(name);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteFullEndElement()\r\n\t\t{\r\n\t\t\t_innerWriter.WriteFullEndElement();\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteProcessingInstruction(string name, string text)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteProcessingInstruction(name, text);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteRaw(string data)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteRaw(data);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteRaw(char[] buffer, int index, int count)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteRaw(buffer, index, count);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteStartAttribute(string prefix, string localName, string ns)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteStartAttribute(prefix, localName, ns);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteStartDocument(bool standalone)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteStartDocument(standalone);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteStartDocument()\r\n\t\t{\r\n\t\t\t_innerWriter.WriteStartDocument();\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteStartElement(string prefix, string localName, string ns)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteStartElement(prefix, localName, ns);\r\n\t\t\topeningElement = localName;\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override WriteState WriteState\r\n\t\t{\r\n\t\t\tget { return _innerWriter.WriteState; }\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteString(string text)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteString(text);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteSurrogateCharEntity(char lowChar, char highChar)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteSurrogateCharEntity(lowChar, highChar);\r\n\t\t}\r\n\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic override void WriteWhitespace(string ws)\r\n\t\t{\r\n\t\t\t_innerWriter.WriteWhitespace(ws);\r\n\t\t}\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XmlDocumentUtil.cs",
    "content": "﻿using System.IO;\r\nusing System.Xml;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    internal static class XmlDocumentUtil\r\n    {\r\n        public static void Load(XmlDocument document, string filename)\r\n        {\r\n            using (Stream stream = new C1FileStream(filename, FileMode.Open))\r\n            {\r\n                document.Load(stream);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void Save(XmlDocument document, string filename)\r\n        {\r\n            using (Stream stream = new C1FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.Read))\r\n            {\r\n                document.Save(stream);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XmlReaderUtils.cs",
    "content": "﻿using System.IO;\r\nusing System.Xml;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class XmlReaderUtils\r\n    {\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        public static XmlReader Create(string path)\r\n        {\r\n            return Create(path, null);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        public static XmlReader Create(string path, XmlReaderSettings settings)\r\n        {\r\n            MemoryStream memoryStream = new MemoryStream();\r\n\r\n            using (Stream stream = new C1FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))\r\n            {\r\n                StreamUtils.CopyStream(stream, memoryStream);\r\n            }\r\n\r\n            memoryStream.Seek(0, SeekOrigin.Begin);\r\n\r\n            if (settings == null)\r\n            {\r\n                return XmlReader.Create(memoryStream);\r\n            }\r\n            else\r\n            {\r\n                return XmlReader.Create(memoryStream, settings);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XmlSchemaSetUtils.cs",
    "content": "﻿using System.Xml;\r\nusing System.Xml.Schema;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    internal static class XmlSchemaSetUtils\r\n    {\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        public static XmlSchema AddFromPath(this XmlSchemaSet xmlSchemaSet, string targetNamespace, string path)\r\n        {\r\n            using (C1StreamReader streamReader = new C1StreamReader(path))\r\n            {\r\n                using (XmlReader xmlReader = XmlReader.Create(streamReader))\r\n                {\r\n                    return xmlSchemaSet.Add(targetNamespace, xmlReader);                    \r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XmlSerializationHelper.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class XmlSerializationHelper\r\n    {\r\n        /// <summary>\r\n        /// Converts the object into an xml serializable object.\r\n        /// </summary>\r\n        /// <exclude />\r\n        public static object GetSerializableObject(object value)\r\n        {\r\n            if (value == null) return null;\r\n\r\n            var type = value.GetType();\r\n            if (type == typeof (string)\r\n                || type == typeof (double)\r\n                || type == typeof (float)\r\n                || type == typeof (decimal)\r\n                || type == typeof (DateTime)\r\n                || type == typeof (DateTimeOffset)\r\n                || type == typeof (TimeSpan))\r\n            {\r\n                return value;\r\n            }\r\n\r\n            return ValueTypeConverter.Convert<string>(value);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static object Deserialize(XAttribute attribute, Type type)\r\n        {\r\n            if (type == typeof(string)) return (string)attribute;\r\n            if (type == typeof(double) || type == typeof(double?)) return (double)attribute;\r\n            if (type == typeof(float) || type == typeof(float?)) return (float)attribute;\r\n            if (type == typeof(decimal) || type == typeof(decimal?)) return (decimal)attribute;\r\n            if (type == typeof(DateTime) || type == typeof(DateTime?)) return (DateTime)attribute;\r\n            if (type == typeof(DateTimeOffset) || type == typeof(DateTimeOffset?)) return (DateTimeOffset)attribute;\r\n            if (type == typeof(TimeSpan) || type == typeof(TimeSpan?)) return (TimeSpan)attribute;\r\n\r\n            return ValueTypeConverter.Convert(attribute.Value, type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XmlUtils.cs",
    "content": "﻿using System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>\r\n    /// \r\n    /// </summary>\r\n\tpublic static class XmlUtils\r\n\t{\r\n        /// <summary>\r\n        /// Builds an XName - will use null namespace if namespaceName is null or empty.\r\n        /// </summary>\r\n        /// <param name=\"namespaceName\">Namespace of element</param>\r\n        /// <param name=\"localName\">Local name of element</param>\r\n        /// <returns>Corosponding XName</returns>\r\n        public static XName GetXName(string namespaceName, string localName)\r\n        {\r\n            if (string.IsNullOrEmpty(namespaceName) == false)\r\n            {\r\n                return ((XNamespace)namespaceName) + localName;\r\n            }\r\n            else\r\n            {\r\n                return localName;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Removes the XML declaration (like &lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;) if present from the provided agrument. \r\n        /// </summary>\r\n        /// <param name=\"xml\">The string to remove XML declaration from</param>\r\n        /// <returns>The XML document without any XML declaration</returns>\r\n        public static string RemoveXmlDeclaration(string xml)\r\n        {\r\n            xml = xml.Trim();\r\n\r\n            if (xml.StartsWith(\"<?xml\") && xml.Contains(\"?>\"))\r\n            {\r\n                xml = xml.Substring(xml.IndexOf(\"?>\") + 2);\t\r\n            }\r\n\r\n            return xml;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XmlWriterUtils.cs",
    "content": "﻿using System.IO;\r\nusing System.Xml;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>   \r\n    /// This class contains Composite IO versions of System.Xml.XmlWriter/System.Xml.XmlTextWriter Create.\r\n    /// These method should be used instead of the ones in System.Xml.XmlWriter/System.Xml.XmlTextWriter.\r\n    /// </summary>\r\n    public static class XmlWriterUtils\r\n    {\r\n        /// <summary>\r\n        /// Creates a new XmlWriter\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file</param>\r\n        /// <returns>Returns the newly created XmlWriter</returns>\r\n        public static XmlWriter Create(string path)\r\n        {\r\n            Stream stream = new C1FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read);\r\n\r\n            XmlWriterSettings settings = new XmlWriterSettings();\r\n            settings.CloseOutput = true;\r\n\r\n            return XmlWriter.Create(stream, settings);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new XmlWriter\r\n        /// </summary>\r\n        /// <param name=\"path\">Path to file</param>\r\n        /// <param name=\"settings\">An instance to XmlWriterSettings</param>\r\n        /// <returns>Returns the newly created XmlWriter</returns>\r\n        public static XmlWriter Create(string path, XmlWriterSettings settings)\r\n        {\r\n            Stream stream = new C1FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read);\r\n\r\n            settings.CloseOutput = true;\r\n\r\n            return XmlWriter.Create(stream, settings);\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XslCompiledTransformUtils.cs",
    "content": "﻿using System.Xml;\r\nusing System.Xml.Xsl;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class XslCompiledTransformUtils\r\n    {\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        public static void LoadFromPath(this XslCompiledTransform xslCompiledTransform, string path)\r\n        {\r\n            using (C1StreamReader streamReader = new C1StreamReader(path))\r\n            {\r\n                using (XmlReader xmlReader = XmlReader.Create(streamReader))\r\n                {\r\n                    xslCompiledTransform.Load(xmlReader);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This should be a part of the I/O layer\r\n        /// </summary>\r\n        public static void LoadFromPath(this XslCompiledTransform xslCompiledTransform, string path, XsltSettings settings, XmlResolver stylesheetResolver)\r\n        {\r\n            using (C1StreamReader streamReader = new C1StreamReader(path))\r\n            {\r\n                using (XmlReader xmlReader = XmlReader.Create(streamReader))\r\n                {\r\n                    xslCompiledTransform.Load(xmlReader, settings, stylesheetResolver);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Core/Xml/XsltExtensionDefinition.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\n\r\nnamespace Composite.Core.Xml\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IXsltExtensionDefinition\r\n    {\r\n        /// <exclude />\r\n        XNamespace ExtensionNamespace { get; }\r\n\r\n        /// <exclude />\r\n        object EntensionObjectAsObject { get; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class XsltExtensionDefinition<T> : IXsltExtensionDefinition\r\n\t{\r\n        /// <exclude />\r\n        public XNamespace ExtensionNamespace { get; set; }\r\n\r\n        /// <exclude />\r\n        public T EntensionObject { get; set; }\r\n\r\n        /// <exclude />\r\n        public object EntensionObjectAsObject\r\n        {\r\n            get { return this.EntensionObject; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/AutoUpdatebleAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// IData types decorated with this attribute will be have their store auto created and updated if the interface changes. \r\n    /// You should use this attribute for data types that C1 CMS should be able to auto support via data providers.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]\r\n\tpublic sealed class AutoUpdatebleAttribute : Attribute\r\n\t{\r\n        /// <exclude />\r\n        public AutoUpdatebleAttribute()\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/BuildNewHandlerAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>  \r\n    /// This attribute is used to override the default behavior when creating new data items.\r\n    /// See <see cref=\"IBuildNewHandler\"/> for mor information on this subject.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]\r\n    public sealed class BuildNewHandlerAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Creates a new BuildNewHandlerAttribute\r\n        /// </summary>\r\n        /// <param name=\"buildNewHandlerType\">This should be a type that inherits <see cref=\"IBuildNewHandler\"/></param>\r\n        public BuildNewHandlerAttribute(Type buildNewHandlerType)\r\n        {\r\n            this.BuildNewHandlerType = buildNewHandlerType;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The build handle type that inherits <see cref=\"IBuildNewHandler\"/>\r\n        /// </summary>\r\n        public Type BuildNewHandlerType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/Cache.cs",
    "content": "﻿using System.Collections;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.Data.Caching\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Cache<K, V>: Cache where V: class\r\n    {\r\n        /// <exclude />\r\n        public Cache(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public Cache(string name, int maximumSize)\r\n            : base(name, maximumSize)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public V Get(K key)\r\n        {\r\n            return base.Get(key) as V;\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Remove(K key)\r\n        {\r\n            base.Remove(key);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Add(K key, V value)\r\n        {\r\n            base.Add(key, value);\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<K> GetKeys()\r\n        {\r\n            lock(_syncRoot)\r\n            {\r\n                ICollection keys = _table.Keys;\r\n                K[] result = new K[keys.Count];\r\n                keys.CopyTo(result, 0);\r\n\r\n                return result;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Represents a cache.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Cache\r\n    {\r\n        private static readonly int DefaultMaximumCacheSize = 1000;\r\n\r\n        /// <exclude />\r\n        protected readonly Hashtable _table = new Hashtable();\r\n\r\n        /// <exclude />\r\n        protected readonly object _syncRoot = new object();\r\n\r\n        private bool _enabled = true;\r\n        private bool _clearOnFlush = true;\r\n        private int _maxSize;\r\n        private readonly int _defaultMaximumSize;\r\n\r\n\r\n        /// <exclude />\r\n        public Cache(string name): this(name, DefaultMaximumCacheSize)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public Cache(string name, int defaultMaximumSize)\r\n        {\r\n            Verify.ArgumentCondition(defaultMaximumSize >= 10, \"maximumSize\", \"Maximum cache size should be at least 10 element.\");\r\n            Verify.ArgumentNotNullOrEmpty(name, \"name\");\r\n\r\n            Name = name;\r\n            _defaultMaximumSize = defaultMaximumSize;\r\n           \r\n            ReadConfiguration();\r\n\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlush);\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnPostFlush);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Enabled => _enabled;\r\n\r\n\r\n        /// <exclude />\r\n        public string Name { get; }\r\n\r\n\r\n        /// <exclude />\r\n        protected object Get(object key) => _table[key];\r\n\r\n\r\n        /// <exclude />\r\n        protected void Add(object key, object value)\r\n        {\r\n            if(!_enabled)\r\n            {\r\n                return;\r\n            }\r\n\r\n            lock (_syncRoot)\r\n            {\r\n                if (_maxSize != -1 && _table.Count > _maxSize)\r\n                {\r\n                    Log.LogWarning(\"Cache\", $\"Clearing cache '{Name}' as it exceeded maximum size {_maxSize} elements. Edit configuration file /App_Data/Composite/Composite.config to increase the cache size.\");\r\n                    _table.Clear();\r\n                }\r\n\r\n                if (_table.Contains(key))\r\n                {\r\n                    _table.Remove(key);\r\n                }\r\n\r\n                _table.Add(key, value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected void Remove(object key)\r\n        {\r\n            if (!_enabled)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if(!_table.Contains(key))\r\n                return;\r\n\r\n            lock(_syncRoot)\r\n            {\r\n                if (!_table.Contains(key))\r\n                    return;\r\n\r\n                _table.Remove(key);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Clear()\r\n        {\r\n            lock (_syncRoot)\r\n            {\r\n                _table.Clear();\r\n            }\r\n        }\r\n\r\n        void OnFlush(FlushEventArgs args)\r\n        {\r\n            if (_clearOnFlush)\r\n            {\r\n                Clear();\r\n            }\r\n        }\r\n\r\n        void OnPostFlush(FlushEventArgs args)\r\n        {\r\n            ReadConfiguration();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool ClearOnFlush\r\n        {\r\n            set { _clearOnFlush = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected void ReadConfiguration()\r\n        {\r\n            CachingSettings cachingSettings = GlobalSettingsFacade.GetNamedCaching(this.Name);\r\n            _enabled = cachingSettings.Enabled;\r\n            _maxSize = cachingSettings.GetSize(_defaultMaximumSize);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/CachedTable.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Data.Caching\r\n{\r\n    /// <summary>\r\n    /// Cached table\r\n    /// </summary>\r\n    internal abstract class CachedTable\r\n    {\r\n        /// <summary>\r\n        /// The queryable data\r\n        /// </summary>\r\n        public abstract IQueryable Queryable { get; }\r\n\r\n        internal abstract bool Add(IEnumerable<IData> dataset);\r\n\r\n        internal abstract bool Update(IEnumerable<IData> dataset);\r\n\r\n        internal abstract bool Remove(IEnumerable<IData> dataset);\r\n\r\n        /// <summary>\r\n        /// Row by key table\r\n        /// </summary>\r\n        public abstract IReadOnlyDictionary<object, IEnumerable<IData>> RowsByKey { get; }\r\n    }\r\n\r\n    internal class CachedTable<T> : CachedTable\r\n    {\r\n        private IReadOnlyCollection<T> _items;\r\n        private IReadOnlyDictionary<object, IEnumerable<IData>> _rowsByKey;\r\n\r\n        public CachedTable(IReadOnlyCollection<T> items)\r\n        {\r\n            _items = items;\r\n        }\r\n\r\n        public override IQueryable Queryable => _items.AsQueryable();\r\n\r\n\r\n        internal override bool Add(IEnumerable<IData> dataset)\r\n        {\r\n            var toAdd = dataset.Cast<T>().ToList();\r\n\r\n            lock (this)\r\n            {\r\n                var existingRows = _items;\r\n\r\n                var newTable = new List<T>(existingRows.Count + toAdd.Count);\r\n                newTable.AddRange(existingRows);\r\n                newTable.AddRange(toAdd);\r\n\r\n                _items = newTable;\r\n                _rowsByKey = null; // Can be optimized as well\r\n\r\n                return true;\r\n            }\r\n        }\r\n\r\n\r\n        internal override bool Update(IEnumerable<IData> dataset)\r\n        {\r\n            var toUpdate = dataset.ToDictionary(_ => _.DataSourceId);\r\n\r\n            lock (this)\r\n            {\r\n                var existingRows = _items;\r\n\r\n\r\n                var updated = new List<T>(existingRows.Count);\r\n\r\n                int updatedTotal = 0;\r\n                foreach (var data in existingRows)\r\n                {\r\n                    bool matched = toUpdate.TryGetValue(((IData)data).DataSourceId, out IData updatedDataItem);\r\n\r\n                    if (matched)\r\n                    {\r\n                        updatedTotal++;\r\n                    }\r\n\r\n                    updated.Add(matched ? (T)updatedDataItem : data);\r\n                }\r\n\r\n                _items = updated.AsReadOnly();\r\n                _rowsByKey = null; // Can be optimized as well\r\n\r\n                return updatedTotal == toUpdate.Count;\r\n            }\r\n        }\r\n\r\n\r\n        internal override bool Remove(IEnumerable<IData> dataset)\r\n        {\r\n            var toRemove = new HashSet<DataSourceId>(dataset.Select(_ => _.DataSourceId));\r\n\r\n            lock (this)\r\n            {\r\n                var existingRows = _items;\r\n\r\n                if (existingRows.Count < toRemove.Count) return false;\r\n\r\n                var newTable = new List<T>(existingRows.Count - toRemove.Count);\r\n\r\n                int removed = 0;\r\n                foreach (var item in existingRows)\r\n                {\r\n                    if (toRemove.Contains(((IData)item).DataSourceId))\r\n                    {\r\n                        removed++;\r\n                        continue;\r\n                    }\r\n                    newTable.Add(item);\r\n                }\r\n                _items = newTable;\r\n                _rowsByKey = null; // Can be optimized as well\r\n\r\n                return removed == toRemove.Count;\r\n            }\r\n        }\r\n\r\n\r\n        public override IReadOnlyDictionary<object, IEnumerable<IData>> RowsByKey\r\n        {\r\n            get\r\n            {\r\n                var result = _rowsByKey;\r\n                if (result != null) return result;\r\n\r\n                lock (this)\r\n                {\r\n                    result = _rowsByKey;\r\n                    if (result != null) return result;\r\n\r\n                    var keyPropertyInfo = typeof(T).GetKeyProperties().Single();\r\n\r\n                    result = _items\r\n                        .GroupBy(data => keyPropertyInfo.GetValue(data, null))\r\n                        .ToDictionary(group => group.Key, group => group.ToArray() as IEnumerable<IData>);\r\n\r\n                    return _rowsByKey = result;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/CachingEnumerator.cs",
    "content": "﻿using System.Collections;\r\nusing System.Collections.Generic;\r\nusing System;\r\nusing Composite.Data.Foundation.CodeGeneration;\r\n\r\n\r\nnamespace Composite.Data.Caching\r\n{\r\n    internal sealed class CachingEnumerator<T> : IEnumerator<T>\r\n    {\r\n        private readonly IEnumerator<T> _enumerator;\r\n        private Func<T, T> _wrapperConstructor;\r\n\r\n\r\n        public CachingEnumerator(IEnumerator<T> enumerator)\r\n        {\r\n            _enumerator = enumerator;\r\n        }\r\n\r\n\r\n        public T Current => WrapperConstructor(_enumerator.Current);\r\n\r\n\r\n        public void Dispose()\r\n        {\r\n            _enumerator.Dispose();\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~CachingEnumerator()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n            object IEnumerator.Current => WrapperConstructor(_enumerator.Current);\r\n\r\n\r\n        public bool MoveNext()\r\n        {\r\n            return _enumerator.MoveNext();\r\n        }\r\n\r\n\r\n        public void Reset()\r\n        {\r\n            _enumerator.Reset();\r\n        }\r\n\r\n\r\n        private Func<T, T> WrapperConstructor\r\n        {\r\n            get\r\n            {\r\n                return _wrapperConstructor \r\n                    ?? (_wrapperConstructor = DataWrapperTypeManager.GetWrapperConstructor<T>());\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/CachingQueryable.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Threading;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Caching.Foundation;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Foundation;\r\n\r\n\r\nnamespace Composite.Data.Caching\r\n{\r\n    internal sealed class CachingEnumerable<T> : IEnumerable<T>\r\n    {\r\n        private readonly IEnumerable<T> _enumerable;\r\n\r\n        public CachingEnumerable(IEnumerable<T> enumerable)\r\n        {\r\n            _enumerable = enumerable;\r\n        }\r\n\r\n\r\n        public IEnumerator<T> GetEnumerator()\r\n        {\r\n            return new CachingEnumerator<T>(_enumerable.GetEnumerator());\r\n        }\r\n\r\n\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            return new CachingEnumerator<T>(_enumerable.GetEnumerator());\r\n        }\r\n    }\r\n\r\n    internal interface ICachedQuery\r\n    {\r\n        IQueryable GetOriginalQuery();\r\n    }\r\n\r\n    /// <summary>\r\n    /// Used for optimizing execution of GetDataByUniqueKey method\r\n    /// </summary>\r\n    internal interface ICachingQueryable_CachedByKey\r\n    {\r\n        IData GetCachedValueByKey(object key);\r\n        IEnumerable<IData> GetCachedVersionValuesByKey(object key);\r\n    }\r\n\r\n\r\n    internal sealed class CachingQueryable<T> : ICachedQuery, IOrderedQueryable<T>, IQueryProvider, ICachingQueryable, ICachingQueryable_CachedByKey\r\n    {\r\n        private readonly IQueryable _source;\r\n        private readonly Expression _currentExpression;\r\n        private readonly CachingEnumerable<T> _wrappedEnumerable;\r\n        private readonly Func<IQueryable> _getQueryFunc;\r\n\r\n        private volatile CachedTable _cachedTable;\r\n        private static readonly MethodInfo _wrappingMethodInfo;\r\n        private static readonly MethodInfo _listWrappingMethodInfo;\r\n\r\n        private IEnumerable<T> _innerEnumerable;\r\n\r\n        static CachingQueryable()\r\n        {\r\n            if (typeof(IData).IsAssignableFrom(typeof(T)))\r\n            {\r\n                _wrappingMethodInfo = StaticReflection.GetGenericMethodInfo(a => DataWrappingFacade.Wrap((IData) a))\r\n                                                      .MakeGenericMethod(new[] {typeof (T)});\r\n            }\r\n            if (typeof(IData).IsAssignableFrom(typeof(T)))\r\n            {\r\n                _listWrappingMethodInfo = StaticReflection.GetGenericMethodInfo(a => WrapData((IEnumerable<IData>)a))\r\n                                                      .MakeGenericMethod(typeof(T));\r\n            }\r\n        }\r\n\r\n        private static IEnumerable<TData> WrapData<TData>(IEnumerable<TData> input) where TData : class, IData\r\n        {\r\n            return input.Select(DataWrappingFacade.Wrap<TData>);\r\n        }\r\n\r\n        public CachingQueryable(CachedTable cachedTable, Func<IQueryable> originalQueryGetter)\r\n        {\r\n            _cachedTable = cachedTable;\r\n\r\n            _source = cachedTable.Queryable;\r\n            _currentExpression = Expression.Constant(this);\r\n            _getQueryFunc = originalQueryGetter;\r\n\r\n            if (_source is IEnumerable<T>)\r\n            {\r\n                _innerEnumerable = _source as IEnumerable<T>;\r\n                if(_innerEnumerable is CachingEnumerable<T>)\r\n                {\r\n                    _wrappedEnumerable = _innerEnumerable as CachingEnumerable<T>;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public CachingQueryable(IQueryable source, Expression currentExpression, Func<IQueryable> originalQueryGetter)\r\n        {\r\n            _source = source;\r\n            _currentExpression = currentExpression;\r\n            _getQueryFunc = originalQueryGetter;\r\n        }\r\n\r\n\r\n\r\n        #region Generic methods\r\n\r\n        public IQueryable<S> CreateQuery<S>(Expression expression)\r\n        {\r\n            return new CachingQueryable<S>(_source, expression, _getQueryFunc);\r\n        }\r\n\r\n        public IEnumerator<T> GetEnumerator()\r\n        {\r\n            var enumerable = BuildEnumerable();\r\n\r\n            if (_wrappedEnumerable != null)\r\n            {\r\n                return _wrappedEnumerable.GetEnumerator();\r\n            }\r\n\r\n            var enumerator = enumerable.GetEnumerator();\r\n\r\n            if (_source.ElementType == typeof(T))\r\n            {\r\n                return new CachingEnumerator<T>(enumerator);\r\n            }\r\n            return enumerator;\r\n        }\r\n\r\n\r\n        private IEnumerable<T> BuildEnumerable()\r\n        {\r\n            if (_innerEnumerable == null) {\r\n                lock (this) {\r\n                    if (_innerEnumerable == null) {\r\n                        var visitor = new ChangeSourceExpressionVisitor();\r\n\r\n                        Expression newExpression = visitor.Visit(_currentExpression);\r\n\r\n                        var result = (IQueryable<T>)_source.Provider.CreateQuery(newExpression);\r\n\r\n                        Verify.IsNotNull(result, \"Failed to create an enumerator\");\r\n\r\n                        Thread.MemoryBarrier();\r\n                        _innerEnumerable = result;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return _innerEnumerable;\r\n        }\r\n\r\n        public S Execute<S>(Expression expression)\r\n        {\r\n            var visitor = new ChangeSourceExpressionVisitor();\r\n\r\n            Expression newExpression = visitor.Visit(expression);\r\n\r\n            object result = _source.Provider.Execute(newExpression);\r\n\r\n            if (result != null && _source.ElementType == typeof(S))\r\n            {\r\n                result = (S) _wrappingMethodInfo.Invoke(null, new [] { result });\r\n            }\r\n            return (S) result;\r\n        }\r\n\r\n        #endregion\r\n\r\n        #region Non generic methods\r\n\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            MethodInfo methodInfo = CachingQueryableCache.GetCachingQueryableGetEnumeratorMethodInfo(typeof(T));\r\n\r\n            return (IEnumerator)methodInfo.Invoke(this, null);\r\n        }\r\n\r\n\r\n\r\n        public IQueryable CreateQuery(Expression expression)\r\n        {\r\n            if (_currentExpression == expression) return this;\r\n\r\n            Type elementType = TypeHelpers.FindElementType(expression);\r\n\r\n            Type queryableType = CachingQueryableCache.GetCachingQueryableType(elementType);\r\n\r\n            return (IQueryable)Activator.CreateInstance(\r\n                queryableType,\r\n                new object[] { _source, expression, _getQueryFunc });\r\n        }\r\n\r\n\r\n\r\n        public object Execute(Expression expression)\r\n        {\r\n            MethodInfo methodInfo = CachingQueryableCache.GetCachingQueryableExecuteMethodInfo(typeof(T), expression.Type);\r\n\r\n            return methodInfo.Invoke(this, new object[] { expression });\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n        public IData GetCachedValueByKey(object key)\r\n        {\r\n            var filteredData = GetFromCacheFiltered(key);\r\n            if (filteredData == null) return null;\r\n\r\n            var result = filteredData.FirstOrDefault();\r\n            if (result == null) return null;\r\n\r\n            return _wrappingMethodInfo.Invoke(null, new object[] { result }) as IData;\r\n        }\r\n\r\n\r\n        public IEnumerable<IData> GetCachedVersionValuesByKey(object key)\r\n        {\r\n            var result = GetFromCacheFiltered(key);\r\n            if (result == null) return Enumerable.Empty<IData>();\r\n\r\n            return _listWrappingMethodInfo.Invoke(null, new object[] { result }) as IEnumerable<IData>;\r\n        }\r\n\r\n\r\n        private IEnumerable<T> GetFromCacheFiltered(object key)\r\n        {\r\n            var cachedTable = GetCachedTable().RowsByKey;\r\n            IEnumerable<IData> cachedRows;\r\n\r\n            if (!cachedTable.TryGetValue(key, out cachedRows))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            IEnumerable<T> filteredData = cachedRows.Cast<T>();\r\n\r\n            var filterMethodInfo = StaticReflection.GetGenericMethodInfo(\r\n                    () => ((DataInterceptor)null).InterceptGetData((IEnumerable<IData>)null))\r\n                    .MakeGenericMethod(typeof(T));\r\n\r\n            foreach (var dataInterceptor in DataFacade.GetDataInterceptors(typeof(T)))\r\n            {\r\n                filteredData = (IEnumerable<T>)filterMethodInfo.Invoke(dataInterceptor, new object[] { filteredData });\r\n            }\r\n\r\n            return filteredData;\r\n        }\r\n\r\n\r\n\r\n        private CachedTable GetCachedTable()\r\n        {\r\n            if (_cachedTable == null)\r\n            {\r\n                lock (this)\r\n                {\r\n                    _cachedTable = _cachedTable ?? new CachedTable<T>(GetOriginalQuery().Cast<T>().ToList());\r\n                }\r\n            }\r\n\r\n            return _cachedTable;\r\n        }\r\n\r\n\r\n        public Expression Expression => _currentExpression;\r\n\r\n        public Type ElementType => typeof(T);\r\n\r\n        public IQueryProvider Provider => this;\r\n\r\n        public IQueryable Source => _source;\r\n\r\n        public IQueryable GetOriginalQuery() => _getQueryFunc();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/DataCachingFacade.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\n\r\nusing ScopeKey = System.Tuple<Composite.Data.DataScopeIdentifier, System.Globalization.CultureInfo>;\r\n\r\nusing TypeData = System.Collections.Concurrent.ConcurrentDictionary<\r\n    System.Tuple<Composite.Data.DataScopeIdentifier, System.Globalization.CultureInfo>,\r\n    Composite.Data.Caching.CachedTable>;\r\n\r\nnamespace Composite.Data.Caching\r\n{\r\n    /// <summary>\r\n    /// Provide information about data caching and means to flush data from the active cache.\r\n    /// </summary>\r\n    public static class DataCachingFacade\r\n    {\r\n        private static readonly string CacheName = \"DataAccess\";\r\n\r\n        private static readonly ConcurrentDictionary<Type, TypeData> _cachedData = new ConcurrentDictionary<Type, TypeData>();\r\n        private static readonly ConcurrentDictionary<Type, byte> _disabledTypes = new ConcurrentDictionary<Type, byte>();\r\n\r\n        private static bool _isEnabled = true;\r\n        private static int _maximumSize = -1;\r\n        private static MethodInfo _queryableTakeMathodInfo;\r\n\r\n\r\n        static DataCachingFacade()\r\n        {\r\n            ReadSettings();\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n            DataEvents<IData>.OnStoreChanged += (sender, args) =>\r\n            {\r\n                if (!args.DataEventsFired)\r\n                {\r\n                    ClearCache(args.DataType, args.PublicationScope, args.Locale);\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a value indicating if data caching is enabled\r\n        /// </summary>\r\n        public static bool Enabled => _isEnabled;\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a value indicating if data caching is possible for a specific data type\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The data type to check</param>\r\n        /// <returns>True if caching is possible</returns>\r\n        public static bool IsTypeCacheable(Type interfaceType)\r\n        {\r\n            Guid dataTypeId;\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n\r\n            return _isEnabled\r\n                   && (DataAttributeFacade.GetCachingType(interfaceType) == CachingType.Full\r\n                   || (interfaceType.TryGetImmutableTypeId(out dataTypeId)\r\n                    && DynamicTypeManager.TryGetDataTypeDescriptor(interfaceType, out dataTypeDescriptor)\r\n                    && dataTypeDescriptor.Cachable));\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a value indicating if data caching is enabled for a specific data type\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The data type to check</param>\r\n        /// <returns>True if caching is enabled</returns>\r\n        public static bool IsDataAccessCacheEnabled(Type interfaceType)\r\n        {\r\n            return IsTypeCacheable(interfaceType) && !_disabledTypes.ContainsKey(interfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        internal static IQueryable<T> GetDataFromCache<T>(Func<IQueryable<T>> getQueryFunc)\r\n            where T : class, IData\r\n        {\r\n            Verify.That(_isEnabled, \"The cache is disabled.\");\r\n\r\n            var dataScopeIdentifier = DataScopeManager.MapByType(typeof(T));\r\n            var localizationScope = LocalizationScopeManager.MapByType(typeof(T));\r\n\r\n            var typeData = _cachedData.GetOrAdd(typeof(T), t => new TypeData());\r\n\r\n            var cacheKey = new Tuple<DataScopeIdentifier, CultureInfo>(dataScopeIdentifier, localizationScope);\r\n\r\n            CachedTable cachedTable;\r\n            if (!typeData.TryGetValue(cacheKey, out cachedTable))\r\n            {\r\n                IQueryable<T> wholeTable = getQueryFunc();\r\n\r\n                if(!DataProvidersSupportDataWrapping(typeof(T)))\r\n                {\r\n                    DisableCachingForType(typeof(T));\r\n\r\n                    return Verify.ResultNotNull(wholeTable);\r\n                }\r\n\r\n                if(_maximumSize != -1)\r\n                {\r\n                    List<T> cuttedTable = TakeElements(wholeTable, _maximumSize + 1).Cast<T>().ToList();\r\n                    if(cuttedTable.Count > _maximumSize)\r\n                    {\r\n                        DisableCachingForType(typeof (T));\r\n\r\n                        return Verify.ResultNotNull(wholeTable);\r\n                    }\r\n                    cachedTable = new CachedTable<T>(cuttedTable);\r\n                }\r\n                else\r\n                {\r\n                    cachedTable = new CachedTable<T>(wholeTable.ToList());\r\n                }\r\n\r\n                typeData[cacheKey] = cachedTable;\r\n            }\r\n\r\n            var typedData = cachedTable.Queryable as IQueryable<T>;\r\n            Verify.IsNotNull(typedData, \"Cached value is invalid.\");\r\n\r\n            // Leaving a possibility to extract original query\r\n            Func<IQueryable> originalQueryGetter = () =>\r\n            {\r\n                using (new DataScope(dataScopeIdentifier, localizationScope))\r\n                {\r\n                    return getQueryFunc();\r\n                }\r\n            };\r\n\r\n            return new CachingQueryable<T>(cachedTable, originalQueryGetter);\r\n        }\r\n\r\n\r\n        \r\n        private static bool DataProvidersSupportDataWrapping(Type T)\r\n        {\r\n            var providerNames = DataProviderRegistry.GetDataProviderNamesByInterfaceType(T);\r\n            Verify.IsNotNull(providerNames, \"Failed to get data provider names list\");\r\n\r\n            return providerNames.All(DataProviderPluginFacade.AllowsResultsWrapping);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Flush cached data for a data type in the current data scope.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The type of data to flush from the cache</param>\r\n        public static void ClearCache(Type interfaceType)\r\n        {\r\n            ClearCache(interfaceType, null);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Flush cached data for a data type in the specified data scope.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The type of data to flush from the cache</param>\r\n        /// <param name=\"publicationScope\">The publication scope to flush</param>\r\n        public static void ClearCache(Type interfaceType, PublicationScope publicationScope)\r\n        {\r\n            ClearCache(interfaceType, DataScopeIdentifier.FromPublicationScope(publicationScope));\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Flush cached data for a data type in the specified data scope.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The type of data to flush from the cache</param>\r\n        /// <param name=\"publicationScope\">The publication scope to flush</param>\r\n        /// <param name=\"localizationScope\">The localization scope to flush</param>\r\n        public static void ClearCache(Type interfaceType, PublicationScope publicationScope, CultureInfo localizationScope)\r\n        {\r\n            ClearCache(interfaceType, DataScopeIdentifier.FromPublicationScope(publicationScope), localizationScope);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Flush cached data for a data type in the specified data scope.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The type of data to flush from the cache</param>\r\n        /// <param name=\"dataScopeIdentifier\">The data scope to flush</param>\r\n        public static void ClearCache(Type interfaceType, DataScopeIdentifier dataScopeIdentifier)\r\n        {\r\n            TypeData typeData;\r\n            if(!_cachedData.TryGetValue(interfaceType, out typeData)) return;\r\n\r\n            dataScopeIdentifier = dataScopeIdentifier ?? DataScopeManager.MapByType(interfaceType);\r\n\r\n            var toRemove = typeData.Keys.Where(key => key.Item1 == dataScopeIdentifier).ToList();\r\n\r\n            foreach (var key in toRemove)\r\n            {\r\n                CachedTable value;\r\n                typeData.TryRemove(key, out value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Removes the specified data collection from the cache. \r\n        /// </summary>\r\n        /// <param name=\"dataset\"></param>\r\n        internal static void RemoveDataFromCache(IReadOnlyCollection<IData> dataset)\r\n        {\r\n            UpdateCachedTables(dataset, (table, data) => table.Remove(data));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Removes the specified data collection from the cache. \r\n        /// </summary>\r\n        /// <param name=\"dataset\"></param>\r\n        internal static void UpdateCachedData(IReadOnlyCollection<IData> dataset)\r\n        {\r\n            UpdateCachedTables(dataset, (table, data) => table.Update(data));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Adds the specified data collection to the cache. \r\n        /// </summary>\r\n        /// <param name=\"dataset\"></param>\r\n        internal static void AddDataToCache(IReadOnlyCollection<IData> dataset)\r\n        {\r\n            UpdateCachedTables(dataset, (table, data) => table.Add(data));\r\n        }\r\n\r\n        internal static void UpdateCachedTables(\r\n            IReadOnlyCollection<IData> dataset,\r\n            Func<CachedTable, IEnumerable<IData>, bool> action)\r\n        {\r\n            if (dataset.Count == 0) return;\r\n\r\n            var groupedData = from data in dataset\r\n                let ds = data.DataSourceId\r\n                group data by new\r\n                {\r\n                    ds.InterfaceType,\r\n                    ds.DataScopeIdentifier,\r\n                    ds.LocaleScope\r\n                };\r\n\r\n            foreach (var group in groupedData)\r\n            {\r\n                TypeData typeData;\r\n                if (!_cachedData.TryGetValue(group.Key.InterfaceType, out typeData))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var scopeKey = new ScopeKey(group.Key.DataScopeIdentifier, group.Key.LocaleScope);\r\n                CachedTable cachedTable;\r\n                if (!typeData.TryGetValue(scopeKey, out cachedTable))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                bool success = action(cachedTable, group);\r\n                if (!success)\r\n                {\r\n                    var key = group.Key;\r\n                    Log.LogError(nameof(DataCachingFacade), $\"Cache out of sync for type '{key.InterfaceType}' scope '{key.DataScopeIdentifier}' culture '{key.LocaleScope}'\");\r\n\r\n                    ClearCache(key.InterfaceType, key.DataScopeIdentifier, key.LocaleScope);\r\n                }\r\n            }\r\n\r\n            // TODO: clear cache on transaction rollback?\r\n        }\r\n\r\n        internal static void ClearCache(Type interfaceType, DataScopeIdentifier dataScopeIdentifier, CultureInfo localizationScope)\r\n        {\r\n            if (!_cachedData.TryGetValue(interfaceType, out TypeData typeData)) return;\r\n\r\n            dataScopeIdentifier = dataScopeIdentifier ?? DataScopeManager.MapByType(interfaceType);\r\n            localizationScope = !DataLocalizationFacade.IsLocalized(interfaceType)\r\n                ? CultureInfo.InvariantCulture\r\n                : (localizationScope ?? LocalizationScopeManager.CurrentLocalizationScope);\r\n\r\n            var key = new Tuple<DataScopeIdentifier, CultureInfo>(dataScopeIdentifier, localizationScope);\r\n\r\n            typeData.TryRemove(key, out _);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This method is also called by the DataFacade\r\n        /// </summary>\r\n        internal static void Flush()\r\n        {\r\n            _cachedData.Clear();\r\n            _disabledTypes.Clear();\r\n        }\r\n\r\n\r\n\r\n        private static void ReadSettings()\r\n        {\r\n            CachingSettings cachingSettings = GlobalSettingsFacade.GetNamedCaching(CacheName);\r\n            _isEnabled = cachingSettings.Enabled;\r\n            _maximumSize = cachingSettings.Size;\r\n        }\r\n\r\n\r\n        \r\n        private static IQueryable TakeElements(IQueryable queryable, int count)\r\n        {\r\n            MethodInfo method = GetQueryableTakeMethodInfo(queryable.ElementType);\r\n\r\n            var resultTable = (IQueryable) method.Invoke(null, new object[] {queryable, count});\r\n\r\n            return resultTable;\r\n        }\r\n\r\n        private static MethodInfo GetQueryableTakeMethodInfo(Type type)\r\n        {\r\n            if(_queryableTakeMathodInfo == null)\r\n            {\r\n                _queryableTakeMathodInfo = (from method in typeof(Queryable).GetMethods(BindingFlags.Static | BindingFlags.Public)\r\n                              where method.Name == nameof(Queryable.Take) &&\r\n                              method.IsGenericMethod\r\n                              select method).First();\r\n            }\r\n            return _queryableTakeMathodInfo.MakeGenericMethod(type);\r\n        }\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n            ReadSettings();\r\n        }\r\n\r\n        private static void DisableCachingForType(Type type)\r\n        {\r\n            _disabledTypes.TryAdd(type, 0);\r\n\r\n            TypeData data;\r\n            _cachedData.TryRemove(type, out data);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/Foundation/CachingQueryableCache.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Data.Caching.Foundation\r\n{\r\n    internal static class CachingQueryableCache\r\n    {\r\n        private static readonly ConcurrentDictionary<Type, MethodInfo> _getEnumeratorMethodInfoCache = new ConcurrentDictionary<Type, MethodInfo>();\r\n        private static readonly ConcurrentDictionary<Type, Type> _queryableTypeCache = new ConcurrentDictionary<Type, Type>();\r\n        private static readonly ConcurrentDictionary<Tuple<Type, Type>, MethodInfo> _executeMethodInfoCache = new ConcurrentDictionary<Tuple<Type, Type>, MethodInfo>();\r\n\r\n\r\n        static CachingQueryableCache()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetCachingQueryableGetEnumeratorMethodInfo(Type genericType)\r\n        {\r\n            return _getEnumeratorMethodInfoCache.GetOrAdd(genericType, genType =>\r\n            {\r\n                Type type = typeof (CachingQueryable<>).MakeGenericType(new[] {genType});\r\n\r\n                return type.GetMethods().First(method => method.Name == \"GetEnumerator\");\r\n            });\r\n        }\r\n\r\n\r\n\r\n        public static Type GetCachingQueryableType(Type elementType)\r\n        {\r\n            return _queryableTypeCache.GetOrAdd(elementType, eType => typeof(CachingQueryable<>).MakeGenericType(new[] { eType }));\r\n        }\r\n        \r\n\r\n        public static MethodInfo GetCachingQueryableExecuteMethodInfo(Type genericType, Type expressionType)\r\n        {\r\n            return _executeMethodInfoCache.GetOrAdd(new Tuple<Type, Type>(genericType, expressionType), pair =>\r\n            {\r\n                Type type = typeof(CachingQueryable<>).MakeGenericType(new[] { pair.Item1 });\r\n\r\n                var genericMethodInfo = type.GetMethods().First(method => method.Name == \"Execute\" && method.IsGenericMethod);\r\n\r\n                return genericMethodInfo.MakeGenericMethod(new[] { pair.Item2 });\r\n            });\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _getEnumeratorMethodInfoCache.Clear();\r\n            _queryableTypeCache.Clear();\r\n            _executeMethodInfoCache.Clear();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/Foundation/ChangeSourceExpressionVisitor.cs",
    "content": "using System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.Data.Caching.Foundation\r\n{\r\n    internal sealed class ChangeSourceExpressionVisitor : ExpressionVisitor\r\n    {\r\n        private readonly Expression _newSourceExpression;\r\n\r\n        public ChangeSourceExpressionVisitor()\r\n        {\r\n            _newSourceExpression = null;\r\n        }\r\n\r\n\r\n        public ChangeSourceExpressionVisitor(Expression newSourceExpression)\r\n        {\r\n            _newSourceExpression = newSourceExpression;\r\n        }\r\n\r\n\r\n        protected override Expression VisitConstant(ConstantExpression c)\r\n        {\r\n            if (c.Value == null) return base.VisitConstant(c);\r\n\r\n            if (c.Value is ICachingQueryable)\r\n            {\r\n                if (_newSourceExpression == null)\r\n                {\r\n                    return ((ICachingQueryable)c.Value).Source.Expression;\r\n                }\r\n                return _newSourceExpression;\r\n            }\r\n\r\n            return base.VisitConstant(c);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/ICachingQueryable.cs",
    "content": "using System.Linq;\r\n\r\n\r\nnamespace Composite.Data.Caching\r\n{\r\n    internal interface ICachingQueryable\r\n    {\r\n        IQueryable Source { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/TableVersion.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.Threading;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Data.Caching\r\n{\r\n    internal static class TableVersion\r\n    {\r\n        private static readonly Hashtable<string, ExtendedNullable<int>> _versionNumbers = new Hashtable<string, ExtendedNullable<int>>();\r\n        private static Hashset<Type> _subscribedTo = new Hashset<Type>();\r\n        private static int _flushCounter;\r\n\r\n        static TableVersion()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n        public static int Get(Type type)\r\n        {\r\n            Verify.ArgumentNotNull(type, \"type\");\r\n\r\n            if(typeof(IMediaFile).IsAssignableFrom(type))\r\n            {\r\n                type = typeof (IMediaFileData);\r\n            }\r\n\r\n            EnsureSubscribtion(type);\r\n\r\n            string key = GetKey(type);\r\n            ExtendedNullable<int> record = _versionNumbers[key];\r\n\r\n            return _flushCounter + (record == null ? 0 : record.Value);\r\n        }\r\n\r\n        private static string GetKey(Type type)\r\n        {\r\n            return GetKey(type, DataScopeManager.MapByType(type), LocalizationScopeManager.MapByType(type));\r\n        }\r\n\r\n        private static string GetKey(Type type, DataScopeIdentifier dataScopeIdentifier, CultureInfo cultureInfo)\r\n        {\r\n            return type.FullName + \" \" + dataScopeIdentifier.Name + \" \" + cultureInfo.Name;\r\n        }\r\n\r\n        private static void IncreaseTableVersion(Type type, DataScopeIdentifier dataScopeIdentifier, CultureInfo locale)\r\n        {\r\n            string key =  GetKey(type, dataScopeIdentifier, locale);\r\n\r\n            lock (_versionNumbers)\r\n            {\r\n                if (_versionNumbers.ContainsKey(key))\r\n                {\r\n                    _versionNumbers[key].Value++;\r\n                }\r\n                else\r\n                {\r\n                    _versionNumbers.Add(key, 1);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void EnsureSubscribtion(Type type)\r\n        {\r\n            if (!_subscribedTo.Contains(type))\r\n            {\r\n                lock (_subscribedTo)\r\n                {\r\n                    if (!_subscribedTo.Contains(type))\r\n                    {\r\n                        _subscribedTo.Add(type);\r\n\r\n                        DataEventSystemFacade.SubscribeToStoreChanged(type, (sender, storeEventArgs) => IncreaseTableVersion(type, DataScopeIdentifier.FromPublicationScope(storeEventArgs.PublicationScope), storeEventArgs.Locale), false);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Interlocked.Increment(ref _flushCounter);\r\n            _subscribedTo = new Hashset<Type>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Caching/WeakRefCache.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Data.Caching\r\n{\r\n    internal class WeakRefCache<K, V> : Cache where V : class\r\n    {\r\n        private int _counter;\r\n\r\n        public WeakRefCache(string name)\r\n            : base(name)\r\n        {\r\n        }\r\n\r\n        public WeakRefCache(string name, int maximumSize)\r\n            : base(name, maximumSize)\r\n        {\r\n        }\r\n\r\n        public V Get(K key)\r\n        {\r\n            var weakReference = base.Get(key) as WeakReference;\r\n\r\n            return (weakReference != null ? weakReference.Target : null) as V;\r\n        }\r\n\r\n        public void Remove(K key)\r\n        {\r\n            base.Remove(key);\r\n        }\r\n\r\n        public void Add(K key, V value)\r\n        {\r\n            base.Add(key, new WeakReference(value));\r\n\r\n            // Cleaning-up \"dead\" references\r\n            _counter++;\r\n            if (_counter % 500 == 0)\r\n            {\r\n                foreach (K k in GetKeys())\r\n                {\r\n                    WeakReference weakRef = Get(k) as WeakReference;\r\n\r\n                    if (weakRef != null && !weakRef.IsAlive)\r\n                    {\r\n                        Remove(k);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        public IEnumerable<K> GetKeys()\r\n        {\r\n            lock(_syncRoot)\r\n            {\r\n                ICollection keys = _table.Keys;\r\n                K[] result = new K[keys.Count];\r\n                keys.CopyTo(result, 0);\r\n\r\n                return result;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/CachingAttribute.cs",
    "content": "using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]\r\n    public sealed class CachingAttribute : Attribute\r\n\t{\r\n        /// <exclude />\r\n        public CachingAttribute(CachingType cachingType)\r\n        {\r\n            this.CachingType = cachingType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public CachingType CachingType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\t}\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum CachingType\r\n    {\r\n        /// <exclude />\r\n        Full,\r\n\r\n        /// <exclude />\r\n        None\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/CodeGeneratedAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]\r\n\tpublic sealed class CodeGeneratedAttribute : Attribute\r\n\t{\r\n        /// <exclude />\r\n        public CodeGeneratedAttribute()\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataAssociationAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]    \r\n    public sealed class DataAssociationAttribute : Attribute\r\n\t{\r\n        /// <exclude />\r\n        public DataAssociationAttribute(Type associatedInterfaceType, string foreignKeyPropertyName, DataAssociationType dataAssociationType)\r\n        {\r\n            this.AssociatedInterfaceType = associatedInterfaceType;\r\n            this.ForeignKeyPropertyName = foreignKeyPropertyName;\r\n            this.AssociationType = dataAssociationType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type AssociatedInterfaceType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ForeignKeyPropertyName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataAssociationType AssociationType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\t}\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum DataAssociationType\r\n    {\r\n        /// <exclude />\r\n        None = 0,\r\n\r\n        /// <exclude />\r\n        Aggregation = 1,\r\n\r\n        /// <exclude />\r\n        Composition = 2\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataAttributeFacade.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// This facade is used to obtain attribute informations for IData's and IData subinterface types\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DataAttributeFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize, false);\r\n\r\n\r\n        static DataAttributeFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsAutoUpdateble(this IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return IsAutoUpdateble(data.DataSourceId.InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsAutoUpdateble(this Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            bool isAutoUpdateble;\r\n\r\n            if (!_resourceLocker.Resources.InterfaceToAutoUpdatebleCache.TryGetValue(interfaceType, out isAutoUpdateble))\r\n            {\r\n                isAutoUpdateble = interfaceType.GetCustomInterfaceAttributes<AutoUpdatebleAttribute>().Any();\r\n\r\n                _resourceLocker.Resources.InterfaceToAutoUpdatebleCache.Add(interfaceType, isAutoUpdateble);\r\n            }\r\n\r\n            return isAutoUpdateble;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Checks whether the specified type is a custom defined IData interface, which is not generated\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <exclude />\r\n        internal static bool IsStaticDataType(this Type interfaceType)\r\n        {\r\n            return typeof (IData).IsAssignableFrom(interfaceType)\r\n                   && interfaceType.Assembly != typeof (IData).Assembly\r\n                   && !IsGenerated(interfaceType);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool IsGenerated(this Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            bool isGenerated;\r\n\r\n            var cache = _resourceLocker.Resources.InterfaceToGeneratedCache;\r\n\r\n            if (cache.TryGetValue(interfaceType, out isGenerated))\r\n            {\r\n                return isGenerated;\r\n            }\r\n\r\n            lock (cache)\r\n            {\r\n                if (cache.TryGetValue(interfaceType, out isGenerated))\r\n                {\r\n                    return isGenerated;\r\n                }\r\n\r\n                isGenerated = interfaceType.GetCustomInterfaceAttributes<CodeGeneratedAttribute>().Any();\r\n\r\n                cache.Add(interfaceType, isGenerated);\r\n            }\r\n\r\n            return isGenerated;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Guid GetImmutableTypeId(this IData data)\r\n        {\r\n            return GetImmutableTypeId(data.DataSourceId.InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Guid GetImmutableTypeId(this Type interfaceType)\r\n        {\r\n\t\t\tVerify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            Guid immutableTypeId;\r\n\r\n        \tbool success = TryGetImmutableTypeId(interfaceType, out immutableTypeId);\r\n\t\t\tVerify.That(success, \"No '{0}' defined on the type '{1}'\", typeof(ImmutableTypeIdAttribute), interfaceType);\r\n\r\n            return immutableTypeId;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetImmutableTypeId(this Type interfaceType, out Guid immutableTypeId)\r\n        {\r\n\t\t\tVerify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            var interfaceToImmutableTypeIdCache = _resourceLocker.Resources.InterfaceToImmutableTypeIdCache;\r\n\r\n            immutableTypeId = interfaceToImmutableTypeIdCache.GetOrAdd(interfaceType, type =>\r\n            {\r\n                var attributes = type.GetCustomInterfaceAttributes<ImmutableTypeIdAttribute>().ToList();\r\n\r\n                return attributes.Count == 0 ? Guid.Empty : attributes[0].ImmutableTypeId;\r\n            });\r\n\r\n            return immutableTypeId != Guid.Empty;\r\n\t\t}\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsNotReferenceable(this IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            return IsNotReferenceable(data.DataSourceId.InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsNotReferenceable(this Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            var map = _resourceLocker.Resources.InterfaceToNotReferenceableCache;\r\n\r\n            return map.GetOrAdd(interfaceType, type => type.GetCustomInterfaceAttributes<NotReferenceableAttribute>().Any());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetLabel(this IData data)\r\n        {\r\n            if (data == null)\r\n            {\r\n                return _resourceLocker.Resources.UndefinedDataLableValue;\r\n            }\r\n\r\n            return data.GetLabel(true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetLabel(this IData data, bool useForeignLabel)\r\n        {\r\n            if (data == null)\r\n            {\r\n                return _resourceLocker.Resources.UndefinedDataLableValue;\r\n            }\r\n\r\n            int foreignKeysExpanded = 0;\r\n            MethodInfo methodInfo;\r\n\r\n            while (true)\r\n            {\r\n                string undefinedLabelValue;\r\n\r\n                string propertyName;\r\n                GetLabelVisualizationMethodInfo(data, \r\n                    useForeignLabel, \r\n                    out methodInfo, \r\n                    out propertyName,\r\n                    out undefinedLabelValue);\r\n\r\n                if (methodInfo == null)\r\n                {\r\n                    return undefinedLabelValue;\r\n                }\r\n\r\n                if (propertyName != null)\r\n                {\r\n                    data = data.GetReferenced(propertyName);\r\n                    foreignKeysExpanded++;\r\n\r\n                    if (data == null)\r\n                    {\r\n                        return string.Format(undefinedLabelValue, propertyName);\r\n                    }\r\n\r\n                    // checking if we have an endless recursion while calculating field titles\r\n                    if(foreignKeysExpanded > 10)\r\n                    {\r\n                        return string.Format(undefinedLabelValue, propertyName);\r\n                    }\r\n                    continue;\r\n                }\r\n\r\n                break;\r\n            }\r\n\r\n            object result = methodInfo.Invoke(data, null);\r\n\r\n            if ((result != null) && !(result is string))\r\n            {\r\n                return result.ToString();\r\n            }\r\n\r\n            return (string)result;\r\n        }\r\n\r\n\r\n        private static void GetLabelVisualizationMethodInfo(IData data, bool useForeignLabel, out MethodInfo methodInfo, out string propertyName, out string undefinedLabelValue)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                undefinedLabelValue = _resourceLocker.Resources.UndefinedLableValue;\r\n\r\n                KeyValuePair<MethodInfo, string> cachedValue;\r\n\r\n                if (_resourceLocker.Resources.InterfaceTypeToLabelMethodInfoCache.TryGetValue(data.DataSourceId.InterfaceType, out cachedValue))\r\n                {\r\n                    methodInfo = cachedValue.Key;\r\n                    propertyName = cachedValue.Value;\r\n                    return;\r\n                }\r\n\r\n                PropertyInfo propertyInfo = GetLabelPropertyInfo(data);\r\n                propertyName = null;\r\n\r\n                if (useForeignLabel)\r\n                {\r\n                    List<ForeignKeyAttribute> foreignKeyAttributes = propertyInfo.GetCustomAttributesRecursively<ForeignKeyAttribute>().ToList();\r\n                    if (foreignKeyAttributes.Count > 0)\r\n                    {\r\n                        propertyName = propertyInfo.Name;\r\n\r\n                        IData foreignData = data.GetReferenced(propertyInfo.Name);\r\n\r\n                        if (foreignData == null)\r\n                        {\r\n                            undefinedLabelValue = string.Format(undefinedLabelValue, propertyInfo.Name);\r\n                            methodInfo = null;\r\n                            return;\r\n                        }\r\n\r\n                        propertyInfo = GetLabelPropertyInfo(foreignData);\r\n                    }\r\n                }\r\n\r\n                methodInfo = propertyInfo.GetGetMethod();\r\n\r\n                var cacheEntry = new KeyValuePair<MethodInfo, string>(methodInfo, propertyName);\r\n                _resourceLocker.Resources.InterfaceTypeToLabelMethodInfoCache.Add(data.DataSourceId.InterfaceType, cacheEntry);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static PropertyInfo GetLabelPropertyInfo(IData data)\r\n        {\r\n            return GetLabelPropertyInfo(data.DataSourceId.InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static PropertyInfo GetLabelPropertyInfo(this Type interfaceType)\r\n        {\r\n            List<LabelPropertyNameAttribute> list = interfaceType.GetCustomInterfaceAttributes<LabelPropertyNameAttribute>().ToList();\r\n\r\n            PropertyInfo propertyInfo = null;\r\n            if (list.Count != 0)\r\n            {\r\n                propertyInfo = interfaceType.GetPropertiesRecursively(pi => pi.Name == list[0].PropertyName).FirstOrDefault();\r\n            }\r\n            else\r\n            {\r\n                propertyInfo = interfaceType.GetPropertiesRecursively(pi => typeof(IData).IsAssignableFrom(pi.DeclaringType)).FirstOrDefault();\r\n            }\r\n\r\n            if (propertyInfo == null)\r\n            {\r\n                throw new InvalidOperationException(\"No label property defined or property not found\");\r\n            }\r\n\r\n            return propertyInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static CachingType GetCachingType(Type interfaceType)\r\n        {\r\n            var map = _resourceLocker.Resources.InterfaceTypeToCachingTypeCache;\r\n\r\n            return map.GetOrAdd(interfaceType, type =>\r\n            {\r\n                var list = type.GetCustomInterfaceAttributes<CachingAttribute>().ToList();\r\n\r\n                return (list.Count == 0) ? CachingType.None : list[0].CachingType;\r\n            });\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use GetDataReferenceProperties() instead \")]\r\n        public static List<ForeignPropertyInfo> GetDataReferencePropertyInfoes(Type interfaceType)\r\n        {\r\n            return new List<ForeignPropertyInfo>(GetDataReferenceProperties(interfaceType));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IReadOnlyList<ForeignPropertyInfo> GetDataReferenceProperties(Type interfaceType)\r\n        {\r\n            var map = _resourceLocker.Resources.InterfaceTypeToDataReferenceProperties;\r\n\r\n            return map.GetOrAdd(interfaceType, type =>\r\n            {\r\n                var foreignKeyProperies = new List<ForeignPropertyInfo>();\r\n\r\n                foreach (PropertyInfo propertyInfo in type.GetPropertiesRecursively())\r\n                {\r\n                    var  attributes = propertyInfo.GetCustomAttributesRecursively<ForeignKeyAttribute>().ToList();\r\n\r\n                    Verify.That(attributes.Count <= 1, \"More than one '{0}' specified for the property named '{1}'\", typeof (ForeignKeyAttribute), propertyInfo.Name);\r\n\r\n                    if (attributes.Count == 1)\r\n                    {\r\n                        var attr = attributes[0];\r\n\r\n                        if (attr.IsValid)\r\n                        {\r\n                            if (attr.InterfaceType == null)\r\n                            {\r\n                                throw new InvalidOperationException(\r\n                                    $\"Null argument is not allowed for the attribute '{typeof (ForeignKeyAttribute)}' on the property '{propertyInfo}'\");\r\n                            }\r\n                                \r\n\r\n                            if (!typeof (IData).IsAssignableFrom(attr.InterfaceType))\r\n                            {\r\n                                throw new InvalidOperationException(\r\n                                    $\"The argument should inherit the type '{typeof (IData)}' for the attribute '{typeof (ForeignKeyAttribute)}' on the property '{propertyInfo}'\");\r\n                            }\r\n\r\n                            if (attr.IsNullReferenceValueSet)\r\n                            {\r\n                                foreignKeyProperies.Add(new ForeignPropertyInfo(\r\n                                    propertyInfo,\r\n                                    attr.InterfaceType,\r\n                                    attr.KeyPropertyName,\r\n                                    attr.AllowCascadeDeletes,\r\n                                    attr.NullReferenceValue,\r\n                                    attr.NullReferenceValueType,\r\n                                    attr.NullableString\r\n                                    ));\r\n                            }\r\n                            else\r\n                            {\r\n                                foreignKeyProperies.Add(new ForeignPropertyInfo(\r\n                                    propertyInfo,\r\n                                    attr.InterfaceType,\r\n                                    attr.KeyPropertyName,\r\n                                    attr.AllowCascadeDeletes,\r\n                                    attr.NullableString\r\n                                    ));\r\n                            }\r\n                        }\r\n                        else\r\n                        {\r\n                            Log.LogWarning(\"DataAttributeFacade\", \"Ignoring unknown foreign key reference from type '{0}' to type '{1}'. \",\r\n                                    type.FullName, attr.TypeManagerName);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return foreignKeyProperies;\r\n            });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IReadOnlyList<string> GetKeyPropertyNames(this Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            var map = _resourceLocker.Resources.InterfaceTypeToKeyPropertyNames;\r\n\r\n            return map.GetOrAdd(interfaceType, type => (from kpn in type.GetCustomAttributesRecursively<KeyPropertyNameAttribute>()\r\n                                                        orderby kpn.Index\r\n                                                        select kpn.KeyPropertyName).ToList());\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IReadOnlyList<string> GetVersionKeyPropertyNames(this Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            var map = _resourceLocker.Resources.InterfaceTypeToVersionKeyPropertyNames;\r\n\r\n            return map.GetOrAdd(interfaceType, type => \r\n                (from kpn in type.GetCustomAttributesRecursively<VersionKeyPropertyNameAttribute>()\r\n                 orderby kpn.VersionKeyPropertyName\r\n                 select kpn.VersionKeyPropertyName).ToList());\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use GetKeyProperties() instead\")]\r\n        public static List<PropertyInfo> GetKeyPropertyInfoes(this IData data)\r\n        {\r\n            return GetKeyProperties(data);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static List<PropertyInfo> GetKeyProperties(this IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            // Return type is List<PropertyInfo> for backward compatibility with the PackageCreator package\r\n            return new List<PropertyInfo>(GetKeyProperties(data.DataSourceId.InterfaceType));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use GetKeyProperties() instead\")]\r\n        public static List<PropertyInfo> GetKeyPropertyInfoes(this Type interfaceType)\r\n        {\r\n            return new List<PropertyInfo>(GetKeyProperties(interfaceType)); \r\n        }\r\n\r\n        /// <exclude />\r\n        public static IReadOnlyList<PropertyInfo> GetPhysicalKeyProperties(this Type interfaceType)\r\n        {\r\n            var versionKeyAttributes = interfaceType\r\n                .GetCustomAttributesRecursively<VersionKeyPropertyNameAttribute>();\r\n            \r\n            var versionProperties = versionKeyAttributes\r\n                .Select(v => interfaceType.GetDataPropertyRecursively(v.VersionKeyPropertyName));\r\n\r\n            var keyProperties = GetKeyProperties(interfaceType);\r\n\r\n            return keyProperties.Concat(versionProperties).ToList();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IReadOnlyList<PropertyInfo> GetKeyProperties(this Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType))\r\n            {\r\n                throw new ArgumentException($\"The specified type must inherit from '{typeof (IData)}\");\r\n            }\r\n\r\n            var map = _resourceLocker.Resources.InterfaceTypeToKeyPropertyInfo;\r\n\r\n            return map.GetOrAdd(interfaceType, type =>\r\n            {\r\n                var keyProperties = new List<PropertyInfo>();\r\n\r\n                List<PropertyInfo> properties = type.GetPropertiesRecursively();\r\n\r\n                foreach (string name in GetKeyPropertyNames(type))\r\n                {\r\n                    PropertyInfo propertyInfo = properties.FirstOrDefault(pi => pi.Name == name);\r\n\r\n                    Verify.IsNotNull(propertyInfo, \"Type '{0}' declare (or inherit) a '{1}' with a name '{2}' that was not found as a property on the type.\", type, typeof(KeyPropertyNameAttribute), name);\r\n\r\n                    keyProperties.Add(propertyInfo);\r\n                }\r\n\r\n                return keyProperties;\r\n\r\n            });\r\n        }\r\n\r\n        internal static PropertyInfo GetSingleKeyProperty(this Type interfaceType)\r\n        {\r\n            return interfaceType.GetKeyProperties().SingleOrException(\r\n                \"No key properties defined on data type '{0}'\",\r\n                \"Multiple key proterties defined for data type '{0}'\", interfaceType);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetTypeTitle(this IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            return GetTypeTitle(data.DataSourceId.InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetTypeTitle(this Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) throw new ArgumentException($\"The specified type must inherit from '{typeof (IData)}\");\r\n\r\n            string title;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.InterfaceTypeToTypeTitle.TryGetValue(interfaceType, out title) == false)\r\n                {\r\n                    List<TitleAttribute> attributes = interfaceType.GetCustomAttributesRecursively<TitleAttribute>().ToList();\r\n\r\n                    if (attributes.Count == 0)\r\n                    {\r\n                        title = interfaceType.Name;\r\n                    }\r\n                    else if (attributes.Count == 1)\r\n                    {\r\n                        title = attributes[0].Title;\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new InvalidOperationException(\r\n                            $\"More than one '{typeof (TitleAttribute)}' defined on the type '{interfaceType}'\");\r\n                    }\r\n\r\n                    _resourceLocker.Resources.InterfaceTypeToTypeTitle.Add(interfaceType, title);\r\n                }\r\n            }\r\n\r\n            return title;\r\n        }      \r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public string UndefinedLableValue { get; set; }\r\n            public string UndefinedDataLableValue { get; set; }\r\n            public Dictionary<Type, bool> InterfaceToAutoUpdatebleCache { get; set; }\r\n            public Dictionary<Type, bool> InterfaceToGeneratedCache { get; set; }\r\n            public ConcurrentDictionary<Type, Guid> InterfaceToImmutableTypeIdCache { get; set; }\r\n            public ConcurrentDictionary<Type, bool> InterfaceToNotReferenceableCache { get; set; }\r\n            public Dictionary<Type, KeyValuePair<MethodInfo, string>> InterfaceTypeToLabelMethodInfoCache { get; set; }\r\n            public ConcurrentDictionary<Type, CachingType> InterfaceTypeToCachingTypeCache { get; set; }\r\n            public ConcurrentDictionary<Type, IReadOnlyList<ForeignPropertyInfo>> InterfaceTypeToDataReferenceProperties { get; set; }\r\n            public ConcurrentDictionary<Type, IReadOnlyList<PropertyInfo>> InterfaceTypeToKeyPropertyInfo { get; set; }\r\n            public Dictionary<Type, string> InterfaceTypeToTypeTitle { get; set; }\r\n            public ConcurrentDictionary<Type, IReadOnlyList<string>> InterfaceTypeToKeyPropertyNames { get; set; }\r\n            public ConcurrentDictionary<Type, IReadOnlyList<string>> InterfaceTypeToVersionKeyPropertyNames { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.UndefinedLableValue = StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"UndefinedLabelTemplate\");\r\n                resources.UndefinedDataLableValue = StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"UndefinedDataLavelTemplate\");\r\n                resources.InterfaceToAutoUpdatebleCache = new Dictionary<Type, bool>();\r\n                resources.InterfaceToGeneratedCache = new Dictionary<Type, bool>();\r\n                resources.InterfaceToImmutableTypeIdCache = new ConcurrentDictionary<Type, Guid>();\r\n                resources.InterfaceToNotReferenceableCache = new ConcurrentDictionary<Type, bool>();\r\n                resources.InterfaceTypeToLabelMethodInfoCache = new Dictionary<Type, KeyValuePair<MethodInfo, string>>();\r\n                resources.InterfaceTypeToCachingTypeCache = new ConcurrentDictionary<Type, CachingType>();\r\n                resources.InterfaceTypeToDataReferenceProperties = new ConcurrentDictionary<Type, IReadOnlyList<ForeignPropertyInfo>>();\r\n                resources.InterfaceTypeToKeyPropertyInfo = new ConcurrentDictionary<Type, IReadOnlyList<PropertyInfo>>();\r\n                resources.InterfaceTypeToTypeTitle = new Dictionary<Type, string>();\r\n                resources.InterfaceTypeToKeyPropertyNames = new ConcurrentDictionary<Type, IReadOnlyList<string>>();\r\n                resources.InterfaceTypeToVersionKeyPropertyNames = new ConcurrentDictionary<Type, IReadOnlyList<string>>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataConnection.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Represents a connection to the C1 CMS data system.\r\n    /// </summary>\r\n    /// <example>\r\n    /// Here is an example of how to use it\r\n    /// <code>\r\n    /// using (DataConnection connection = new DataConnection())\r\n    /// {\r\n    ///    var q = \r\n    ///       from d in connection.Get&lt;IMyDataType&gt;()\r\n    ///       where d.Name == \"Foo\"\r\n    ///       select d;\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    public class DataConnection : ImplementationContainer<DataConnectionImplementation>, IDisposable\r\n    {\r\n        //private ImplementationContainer<PageDataConnection> _pageDataConnection;\r\n        private readonly ImplementationContainer<SitemapNavigator> _sitemapNavigator;\r\n\r\n        private bool _disposed;\r\n\r\n        \r\n        /// <summary>\r\n        /// Resolve service of a specific type that is attached to connection's data scope\r\n        /// </summary>\r\n        /// <param name=\"t\"></param>\r\n        /// <returns></returns>\r\n        public object GetService(Type t)\r\n        {\r\n            return ImplementationFactory.CurrentFactory.ResolveService(t);\r\n        }\r\n\r\n        /// <summary>\r\n        /// attach service to data connection\r\n        /// </summary>\r\n        /// <param name=\"service\"></param>\r\n        public void AddService(object service)\r\n        {\r\n            Implementation.DataScope.AddService(service);\r\n        }\r\n\r\n        /// <summary>\r\n        /// disable all services in the data connection\r\n        /// </summary>\r\n        public void DisableServices()\r\n        {\r\n            Implementation.DataScope.DisableServices();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Creates a new <see cref=\"DataConnection\"/> instance inheriting the <see cref=\"Composite.Data.PublicationScope\"/>\r\n        /// and locale set on the call stack. When outside an existing scope this default to PublicationScope,Published and the\r\n        /// default language on the website. You should use this constructure unless you need to force data to come from an alternative \r\n        /// scope. <see cref=\"DataConnection\"/> can be used to access the C1 CMS storage.\r\n        /// </summary>\r\n        /// <example>\r\n        /// Here is an example of how to use it\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    var q = \r\n        ///       from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///       where d.Name == \"Foo\"\r\n        ///       select d;\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        public DataConnection()\r\n            : base(() => ImplementationFactory.CurrentFactory.CreateDataConnection(null, null))\r\n        {\r\n            CreateImplementation();\r\n\r\n            //_pageDataConnection = new ImplementationContainer<PageDataConnection>(() => new PageDataConnection());\r\n            _sitemapNavigator = new ImplementationContainer<SitemapNavigator>(() => new SitemapNavigator(this));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new <see cref=\"DataConnection\"/> instance with the given <paramref name=\"scope\"/>\r\n        /// and current (or default) locale. <see cref=\"DataConnection\"/> can be used to access the C1 CMS storage.\r\n        /// </summary>\r\n        /// <param name=\"scope\">The <see cref=\"Composite.Data.PublicationScope\"/> data should be read from.</param>\r\n        /// <example>\r\n        /// Here is an example of how to use it\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection(PublicationScope.Published))\r\n        /// {\r\n        ///    var q = \r\n        ///       from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///       where d.Name == \"Foo\"\r\n        ///       select d;\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        public DataConnection(PublicationScope scope)\r\n            : base(() => ImplementationFactory.CurrentFactory.CreateDataConnection(scope, null))\r\n        {\r\n            if ((scope < PublicationScope.Unpublished) || (scope > PublicationScope.Published)) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n            CreateImplementation();\r\n\r\n            //_pageDataConnection = new ImplementationContainer<PageDataConnection>(() => new PageDataConnection(scope));\r\n            _sitemapNavigator = new ImplementationContainer<SitemapNavigator>(() => new SitemapNavigator(this));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new <see cref=\"DataConnection\"/> instance with current or default <see cref=\"Composite.Data.PublicationScope\"/>\r\n        /// and the given <paramref name=\"locale\"/>. <see cref=\"DataConnection\"/> can be used to access the C1 CMS storage.\r\n        /// </summary>\r\n        /// <param name=\"locale\">The desired locale. This should be one of the locale found in <see cref=\"Composite.Data.DataConnection.AllLocales\"/></param>\r\n        /// <example>\r\n        /// Here is an example of how to use it\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection(new CultureInfo(\"da-DK\")))\r\n        /// {\r\n        ///    var q = \r\n        ///       from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///       where d.Name == \"Foo\"\r\n        ///       select d;\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        public DataConnection(CultureInfo locale)\r\n            : base(() => ImplementationFactory.CurrentFactory.CreateDataConnection(null, locale))\r\n        {\r\n            CreateImplementation();\r\n\r\n            //_pageDataConnection = new ImplementationContainer<PageDataConnection>(() => new PageDataConnection(locale));\r\n            _sitemapNavigator = new ImplementationContainer<SitemapNavigator>(() => new SitemapNavigator(this));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new <see cref=\"DataConnection\"/> instance with the given <paramref name=\"scope\"/>\r\n        /// and the given <paramref name=\"locale\"/>. <see cref=\"DataConnection\"/> can be used to access the C1 CMS storage.\r\n        /// </summary>\r\n        /// <param name=\"scope\">The <see cref=\"Composite.Data.PublicationScope\"/> data should be read from.</param>\r\n        /// <param name=\"locale\">The desired locale. This should be one of the locale found in <see cref=\"Composite.Data.DataConnection.AllLocales\"/></param>\r\n        /// <example>\r\n        /// Here is an example of how to use it\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection(PublicationScope.Published, new CultureInfo(\"da-DK\")))\r\n        /// {\r\n        ///    var q = \r\n        ///       from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///       where d.Name == \"Foo\"\r\n        ///       select d;\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        public DataConnection(PublicationScope scope, CultureInfo locale)\r\n            : base(() => ImplementationFactory.CurrentFactory.CreateDataConnection(scope, locale))\r\n        {\r\n            if ((scope < PublicationScope.Unpublished) || (scope > PublicationScope.Published)) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n            CreateImplementation();\r\n\r\n            //_pageDataConnection = new ImplementationContainer<PageDataConnection>(() => new PageDataConnection(scope, locale));\r\n            _sitemapNavigator = new ImplementationContainer<SitemapNavigator>(() => new SitemapNavigator(this));\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns an IQueryable of the given IData interface. \r\n        /// If no storage supports the given IData interface, an exception is thrown.\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    var q = \r\n        ///       from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///       where d.Name == \"Foo\"\r\n        ///       select d;\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <returns>Returns an IQueryable of the given IData interface for further querying</returns>\r\n        public IQueryable<TData> Get<TData>()\r\n             where TData : class, IData\r\n        {\r\n            return this.Implementation.Get<TData>();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds the <typeparamref name=\"TData\"/> instance to the default C1 storage.\r\n        /// If the storage does not exist, then one is created.\r\n        /// This method triggers the events OnBeforeAdd and OnAfterAdd for the item <paramref name=\"item\"/>. \r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n        ///    myDataType.Name = \"John Doe\";\r\n        ///    myDataType = connection.Add&lt;IMyDataType&gt;(myDataType); \r\n        /// \r\n        ///    // Note that the reassigned of myDataType is important here\r\n        ///    // if its used for an later update.\r\n        /// \r\n        ///    myDataType.Name = \"Jane Doe\";\r\n        ///    connection.Update&lt;IMyDataType&gt;(myDataType);\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <param name=\"item\">The data item to add</param>\r\n        /// <returns>The newly added data item. Note: This could differ from the <paramref name=\"item\"/></returns>\r\n        public TData Add<TData>(TData item)\r\n            where TData : class, IData\r\n        {\r\n            return this.Implementation.Add<TData>(item);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds the <typeparamref name=\"TData\"/> instances to the default C1 storage.\r\n        /// If the storage does not exist, then one is created.\r\n        /// This method triggers the events OnBeforeAdd and OnAfterAdd for each item in <paramref name=\"items\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    List&lt;IMyDataType&gt; items = new List&lt;IMyDataType&gt;();\r\n        ///    \r\n        ///    for (int i = 0; i &lt; 10; i++)\r\n        ///    {\r\n        ///       IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n        ///       myDataType.Name = \"John Doe\";\r\n        ///       myDataType.Number = i;\r\n        ///       items.Add(myDataType);\r\n        ///    }   \r\n        ///    \r\n        ///    connection.Add&lt;IMyDataType&gt;(items);\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <param name=\"items\">The data items to add</param>\r\n        /// <returns>The newly added data items. Note: These could differ from the items in <paramref name=\"items\"/></returns>\r\n        public IList<TData> Add<TData>(IEnumerable<TData> items)\r\n            where TData : class, IData\r\n        {\r\n            return this.Implementation.Add<TData>(items);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Updates the given <typeparamref name=\"TData\"/> instance in the C1 storage. \r\n        /// If any property values has been changed, these would be saved into the storage.\r\n        /// This method triggers the events OnBeforeUpdate and OnAfterUpdate for the item <paramref name=\"item\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    IMyDataType myDataType = \r\n        ///       (from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///        where d.Name == \"Foo\"\r\n        ///        select d).First();\r\n        ///    \r\n        ///    myDataType.Name = \"Bar\";\r\n        ///    \r\n        ///    connection.Update&lt;IMyDataType&gt;(myDataType);\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <param name=\"item\">The item to update in the C1 storage</param>\r\n        public void Update<TData>(TData item)\r\n            where TData : class, IData\r\n        {\r\n            this.Implementation.Update<TData>(item);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Updates the geven <typeparamref name=\"TData\"/> instances in the C1 storage.\r\n        /// If any property values in any of the <typeparamref name=\"TData\"/> instances, these would be saved into the storage.\r\n        /// This method triggers the events OnBeforeUpdate and OnAfterUpdate for each item in <paramref name=\"items\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    IEnumerable&lt;IMyDataType&gt; myDataTypes = \r\n        ///       from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///       where d.Value > 10\r\n        ///       select d;\r\n        ///    \r\n        ///    foreach (IMyDataType in myDataTypes)\r\n        ///    {\r\n        ///       myDataType.Value += 10;\r\n        ///    }   \r\n        ///    \r\n        ///    connection.Update&lt;IMyDataType&gt;(myDataTypes);\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <param name=\"items\">The items to update in the C1 storage</param>\r\n        public void Update<TData>(IEnumerable<TData> items)\r\n            where TData : class, IData\r\n        {\r\n            this.Implementation.Update<TData>(items);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the given <typeparamref name=\"TData\"/> instance permently from the C1 storage.        \r\n        /// This method triggers the event OnDeleted for the item <paramref name=\"item\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    IMyDataType myDataType = \r\n        ///       (from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///        where d.Name == \"Foo\"\r\n        ///        select d).First();\r\n        ///    \r\n        ///    \r\n        ///    connection.Delete&lt;IMyDataType&gt;(myDataType);\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <param name=\"item\">The item to delete</param>\r\n        public void Delete<TData>(TData item)\r\n            where TData : class, IData\r\n        {\r\n            this.Implementation.Delete<TData>(item);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Deletes the given <typeparamref name=\"TData\"/> instances permently from the C1 storage.\r\n        /// This method triggers the event OnDeleted for each item in <paramref name=\"items\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    IMyDataType myDataTypes = \r\n        ///       from d in connection.Get&lt;IMyDataType&gt;()\r\n        ///       where d.Name == \"Foo\"\r\n        ///       select d;\r\n        ///    \r\n        ///    \r\n        ///    connection.Delete&lt;IMyDataType&gt;(myDataTypes);\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <param name=\"items\">The items to delete</param>\r\n        public void Delete<TData>(IEnumerable<TData> items)\r\n            where TData : class, IData\r\n        {\r\n            this.Implementation.Delete<TData>(items);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Create a new <typeparamref name=\"TData\"/> that can be added using <see cref=\"Composite.Data.DataConnection.Add&lt;TData&gt;(TData)\"/>.\r\n        /// This method triggers the event OnNew for the return value of the method.\r\n        /// </summary>\r\n        /// <example>\r\n        /// Here is an example of how to create a new IData instance and add it to the C1 storage.\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n        ///    myDataType.Name = \"John Doe\";\r\n        ///    connection.Add&lt;IMyDataType&gt;(myDataType);        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <returns>Returns a new instance of the <typeparamref name=\"TData\"/></returns>\r\n        public static TData New<TData>()\r\n            where TData : class, IData\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessDataConnection.New<TData>();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Create a new <typeparamref name=\"TData\"/> that can be added using <see cref=\"Composite.Data.DataConnection.Add&lt;TData&gt;(TData)\"/>.\r\n        /// This method triggers the event OnNew for the return value of the method.\r\n        /// </summary>\r\n        /// Here is an example of how to create a new IData instance and add it to the C1 storage.\r\n        /// <example>\r\n        /// <code>\r\n        /// using (DataConnection connection = new DataConnection())\r\n        /// {\r\n        ///    IMyDataType myDataType = connection.CreateNew&lt;IMyDataType&gt;();\r\n        ///    myDataType.Name = \"John Doe\";\r\n        ///    connection.Add&lt;IMyDataType&gt;(myDataType);        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <returns>Returns a new instance of the <typeparamref name=\"TData\"/></returns>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Performance\", \"CA1822:MarkMembersAsStatic\", Justification = \"This is want we want\")]\r\n        public TData CreateNew<TData>()\r\n            where TData : class, IData\r\n        {\r\n            return ImplementationFactory.CurrentFactory.StatelessDataConnection.New<TData>();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The current publication scope.\r\n        /// </summary>\r\n        public PublicationScope CurrentPublicationScope\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.CurrentPublicationScope;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The current locale.\r\n        /// </summary>\r\n        public CultureInfo CurrentLocale\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.CurrentLocale;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// All locales added to C1.\r\n        /// </summary>\r\n        /// <example>\r\n        /// Here is an example of how to enumerate all locales added to C1.\r\n        /// <code>\r\n        /// foreach (CultureInfo locale in DataConnection.Locales)\r\n        /// {\r\n        ///    // Use the locale\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        public static IEnumerable<CultureInfo> AllLocales\r\n        {\r\n            get\r\n            {\r\n                return ImplementationFactory.CurrentFactory.StatelessDataConnection.AllLocales;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        ///// <summary>\r\n        ///// A PageDataConnection instanse. See <see cref=\"Composite.Data.PageDataConnection\"/>\r\n        ///// </summary>\r\n        //public PageDataConnection PageDataConnection\r\n        //{\r\n        //    get\r\n        //    {\r\n        //        return _pageDataConnection.Implementation;\r\n        //    }\r\n        //}\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// A SitemapNavigator instance. See <see cref=\"Composite.Data.SitemapNavigator\"/>\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\")]\r\n        public SitemapNavigator SitemapNavigator\r\n        {\r\n            get\r\n            {\r\n                return _sitemapNavigator.Implementation;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~DataConnection()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n\r\n        /// <exclude />\r\n        protected virtual void Dispose(bool disposing)\r\n        {\r\n            if (!disposing) return;\r\n\r\n            if (_disposed)\r\n            {\r\n                throw new ObjectDisposedException(nameof(DataConnection));\r\n            }\r\n\r\n            this.DisposeImplementation();\r\n            \r\n            _sitemapNavigator.Implementation.DisposeImplementation();\r\n\r\n            _disposed = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Newtonsoft.Json;\r\nusing Newtonsoft.Json.Linq;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// EntityToken that represents a C1 Data item. EntityToken is used through out C1 CMS to describe artifacts that can have security settings and be navigated and this class make it easy\r\n    /// to move between data items and EntityToken.\r\n    /// </summary>\r\n    [SecurityAncestorProvider(typeof(DataSecurityAncestorProvider))]\r\n    [JsonObject(MemberSerialization.OptIn)]\r\n    public sealed class DataEntityToken : EntityToken\r\n    {\r\n        private IData _data;\r\n        private bool _dataInitialized;\r\n        private string _serializedDataSourceId;\r\n        private string _serializedId; \r\n        private string _serializedVersionId;\r\n        private string _serializedInterfaceType;\r\n        private Type _interfaceType;\r\n        private DataSourceId _dataSourceId;\r\n\r\n\r\n        internal DataEntityToken(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            _data = data;\r\n            _dataInitialized = true;\r\n            _serializedDataSourceId = null;\r\n            _dataSourceId = _data.DataSourceId;\r\n            Verify.ArgumentCondition(_dataSourceId != null, \"data\", \"DataSourceId can not be null\");\r\n\r\n            _interfaceType = _dataSourceId.InterfaceType;\r\n        }\r\n\r\n\r\n        private DataEntityToken(string serializedDataSourceId)\r\n        {\r\n            _data = null;\r\n            _dataInitialized = false;\r\n            _serializedDataSourceId = serializedDataSourceId;\r\n            _dataSourceId = null;\r\n        }\r\n\r\n        [JsonConstructor]\r\n        private DataEntityToken(JRaw dataSourceId)\r\n        {\r\n            _data = null;\r\n            _dataInitialized = false;\r\n            _serializedDataSourceId = dataSourceId.Value.ToString();\r\n            _dataSourceId = null;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get\r\n            {\r\n                if (_serializedInterfaceType == null)\r\n                {\r\n                    _serializedInterfaceType = TypeManager.SerializeType(this.DataSourceId.InterfaceType);\r\n                }\r\n\r\n                return _serializedInterfaceType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source => this.DataSourceId.ProviderName;\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id => this.SerializedId;\r\n\r\n        /// <exclude />\r\n        public override string VersionId => this.SerializedVersionId;\r\n\r\n        /// <exclude />\r\n        public override bool IsValid() => this.Data != null;\r\n\r\n\r\n        /// <exclude />\r\n        public Type InterfaceType\r\n        {\r\n            get\r\n            {\r\n                if (_interfaceType == null)\r\n                {\r\n                    _interfaceType = _dataSourceId != null \r\n                        ? _dataSourceId.InterfaceType \r\n                        : TypeManager.TryGetType(this.Type);\r\n                }\r\n\r\n                return _interfaceType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The <see cref=\"Composite.Data.DataSourceId\"/> for the data object. \r\n        /// </summary>\r\n        public DataSourceId DataSourceId\r\n        {\r\n            get\r\n            {\r\n                if (_dataSourceId == null)\r\n                {\r\n                    var dataSourceId = DataSourceId.Deserialize(_serializedDataSourceId);\r\n                    _dataSourceId = dataSourceId;\r\n                    _interfaceType = dataSourceId.InterfaceType;\r\n                }\r\n\r\n                return _dataSourceId;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return this.SerializedDataSourceId;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            return new DataEntityToken(serializedData);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Retrieve the data object. Cast this to the expected IData interface to access the data fields.\r\n        /// </summary>\r\n        public IData Data\r\n        {\r\n            get\r\n            {\r\n                if (!_dataInitialized)\r\n                {\r\n                    try\r\n                    {\r\n                        DataSourceId dataSourceId;\r\n                        if (!DataSourceId.TryDeserialize(this.SerializedDataSourceId, out dataSourceId))\r\n                        {\r\n                            return null;\r\n                        }\r\n\r\n                        _data = DataFacade.GetDataFromDataSourceId(dataSourceId);\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        // Ignore exception - invalid data source id == no data\r\n                    }\r\n                    finally\r\n                    {\r\n                        _dataInitialized = true;\r\n                    }\r\n                }\r\n\r\n                return _data;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void OnGetPrettyHtml(EntityTokenHtmlPrettyfier prettifier)\r\n        {\r\n            prettifier.OnWriteId = (token, helper) =>\r\n            {\r\n                IDataId dataId = DataIdSerializer.Deserialize(this.Id, this.VersionId);\r\n\r\n                var sb = new StringBuilder()\r\n                        .Append(\"<b>DataId</b><br />\")\r\n                        .Append($\"<b>Type:</b> {dataId.GetType()}<br />\");\r\n\r\n                foreach (PropertyInfo propertyInfo in dataId.GetType().GetPropertiesRecursively())\r\n                {\r\n                    sb.Append($\"<b>{propertyInfo.Name}:</b> {propertyInfo.GetValue(dataId, null)}<br />\");\r\n                }\r\n\r\n                helper.AddFullRow(new [] { \"<b>Id</b>\", sb.ToString() });\r\n            };\r\n        }\r\n\r\n        [JsonProperty(PropertyName = \"dataSourceId\")]\r\n        private JRaw rawSerializedDataSourceId => new JRaw(_serializedDataSourceId);\r\n\r\n        private string SerializedDataSourceId\r\n        {\r\n            get\r\n            {\r\n                if (_serializedDataSourceId == null)\r\n                {\r\n                    _serializedDataSourceId = this.Data.DataSourceId.Serialize();\r\n                }\r\n\r\n                return _serializedDataSourceId;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private string SerializedId\r\n        {\r\n            get\r\n            {\r\n                if (_serializedId == null)\r\n                {\r\n                    var keyPropertyNames = GetVersionKeyPropertyNames().Any() ? GetKeyPropertyNames() : null;\r\n\r\n                    _serializedId = this.DataSourceId.DataId.Serialize(keyPropertyNames);\r\n                }\r\n\r\n                return _serializedId;\r\n            }\r\n        }\r\n\r\n        private string SerializedVersionId\r\n        {\r\n            get\r\n            {\r\n                if (_serializedVersionId == null)\r\n                {\r\n                    var versionKeyPropertyNames = GetVersionKeyPropertyNames();\r\n\r\n                    _serializedVersionId = versionKeyPropertyNames.Any() \r\n                        ? this.DataSourceId.DataId.Serialize(versionKeyPropertyNames)\r\n                        : string.Empty;\r\n                }\r\n\r\n                return _serializedVersionId;\r\n            }\r\n        }\r\n\r\n        private IEnumerable<string> GetKeyPropertyNames()\r\n        {\r\n            return this.InterfaceType.GetCustomAttributesRecursively<KeyPropertyNameAttribute>()\r\n                .Select(f => f.KeyPropertyName);\r\n        }\r\n\r\n\r\n        private IEnumerable<string> GetVersionKeyPropertyNames()\r\n        {\r\n            return this.InterfaceType.GetCustomAttributesRecursively<VersionKeyPropertyNameAttribute>()\r\n                .Select(f => f.VersionKeyPropertyName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataEntityTokenExtensions.cs",
    "content": "using System;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DataEntityTokenExtensions\r\n    {\r\n        /// <exclude />\r\n        public static DataEntityToken GetDataEntityToken(this IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            return new DataEntityToken(data);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataEventArgs.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// This class contains information for data events. See also <see cref=\"Composite.Data.StoreEventArgs\"/>.\r\n    /// </summary>\r\n    public class DataEventArgs : EventArgs\r\n    {\r\n        private readonly Type _dataType;\r\n        private readonly IData _data;\r\n\r\n\r\n\r\n        /// <summary>        \r\n        /// </summary>\r\n        /// <param name=\"dataType\"></param>\r\n        /// <param name=\"data\"></param>\r\n        /// <exclude />\r\n        internal DataEventArgs(Type dataType, IData data)\r\n        {\r\n            _dataType = dataType;\r\n            _data = data;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is the data item that is the subject of the event fired.\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;().OnBeforeAdd += new DataEventHandler(DataEvents_OnBeforeAdd);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n        ///       myDataType.Name = \"Foo\";\r\n        ///       \r\n        ///       connection.Add&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnBeforeAdd(object sender, DataEventArgs dataEventArgs)\r\n        /// {        \r\n        ///    IData myData = dataEventArgs.Data; // This will be the myDataType instance just created\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1721:PropertyNamesShouldNotMatchGetMethods\", Justification = \"We had to be backwards compatible\")]\r\n        public IData Data\r\n        {\r\n            get { return _data; }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is the type of the data item that is the subject of the event fired.\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;().OnBeforeAdd += new DataEventHandler(DataEvents_OnBeforeAdd);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n        ///       myDataType.Name = \"Foo\";\r\n        ///       \r\n        ///       connection.Add&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnBeforeAdd(object sender, DataEventArgs dataEventArgs)\r\n        /// {        \r\n        ///    Type type = dataEventArgs.DataType; // This will be the type of myDataType instance. E.i. IMyDataType\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        public Type DataType\r\n        {\r\n            get { return _dataType; }\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is the data item that is the subject of the event fired.\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;().OnBeforeAdd += new DataEventHandler(DataEvents_OnBeforeAdd);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n        ///       myDataType.Name = \"Foo\";\r\n        ///       \r\n        ///       connection.Add&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnBeforeAdd(DataEventArgs dataEventArgs)\r\n        /// {        \r\n        ///    IMyDataType myDataType = dataEventArgs.GetData&lt;IMyDataType&gt;(); // This will be the myDataType instance just created\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        /// <typeparam name=\"TData\">An IData interface</typeparam>\r\n        /// <returns>Returns a casted version of the data item that is the suvject of the event fired.</returns>\r\n        public TData GetData<TData>()\r\n            where TData : IData\r\n        {\r\n            if (_dataType.IsAssignableFrom(typeof(TData)) == false)\r\n            {\r\n                throw new ArgumentException(\"TData is of wrong type ('{0}'). Data type is '{1}'\".FormatWith(typeof(TData), _dataType));\r\n            }\r\n\r\n            return (TData)_data;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataEventHandler.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// The event handle type for detailed data change events which fire in-process. See also \r\n    /// </summary>\r\n    /// <param name=\"sender\"></param>\r\n    /// <param name=\"dataEventArgs\"></param>    \r\n    [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1003:UseGenericEventHandlerInstances\", Justification = \"We had to be backwards compatible\")]\r\n    public delegate void DataEventHandler(object sender, DataEventArgs dataEventArgs);\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataEventSystemFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Subscription = Composite.Core.Types.Pair<System.Delegate, bool>;\r\nusing Subscriptions = Composite.Core.Collections.Generic.Hashtable<System.Type, System.Collections.Generic.List<Composite.Core.Types.Pair<System.Delegate, bool>>>;\r\n\r\n\r\nnamespace Composite.Data\r\n{   \r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class DataMoveEventArgs : DataEventArgs\r\n    {\r\n        internal DataMoveEventArgs(Type dataType, IData data, DataScopeIdentifier targetDataScopeIdentifier)\r\n            : base(dataType, data)\r\n        {\r\n            this.TargetDataScopeIdentifier = targetDataScopeIdentifier;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataScopeIdentifier TargetDataScopeIdentifier\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DataEventSystemFacade\r\n    {        \r\n        /// <exclude />\r\n        public delegate void DataAfterMoveDelegate(object sender, DataMoveEventArgs dataMoveEventArgs);\r\n\r\n        private static readonly Subscriptions _dataBeforeAddEventDictionary = new Subscriptions();\r\n        private static readonly Subscriptions _dataAfterAddEventDictionary = new Subscriptions();\r\n        private static readonly Subscriptions _dataBeforeUpdateEventDictionary = new Subscriptions();\r\n        private static readonly Subscriptions _dataAfterUpdateEventDictionary = new Subscriptions();\r\n        private static readonly Subscriptions _dataDeletedEventDictionary = new Subscriptions();\r\n        private static readonly Subscriptions _dataAfterBuildNewEventDictionary = new Subscriptions();\r\n        private static readonly Subscriptions _storeChangedEventDictionary = new Subscriptions();\r\n\r\n        private static readonly object _collectionAccesslock = new object();\r\n\r\n\r\n        /// <exclude />\r\n        static DataEventSystemFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        private static void Add(this Subscriptions collection, Type dataType, Delegate callback, bool flushPersistent)\r\n        {\r\n            Verify.ArgumentNotNull(callback, \"callback\");\r\n\r\n            Add(collection, dataType, new Subscription(callback, flushPersistent));\r\n        }\r\n\r\n\r\n        private static void Add(this Subscriptions collection, Type dataType, Subscription subscription)\r\n        {\r\n            Verify.ArgumentNotNull(collection, \"collection\");\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(subscription, \"subscription\");\r\n\r\n            Verify.ArgumentCondition(typeof (IData).IsAssignableFrom(dataType), \"dataType\",\r\n                                     \"dataType does not inherit the type '{0}'\".FormatWith(typeof (IData)));\r\n\r\n            lock(_collectionAccesslock)\r\n            {\r\n                if(!collection.ContainsKey(dataType))\r\n                {\r\n                    collection.Add(dataType, new List<Subscription>());\r\n                }\r\n                collection[dataType].Add(subscription);\r\n            }\r\n        }\r\n\r\n        private static void Remove(this Subscriptions collection, Type dataType, Delegate callback)\r\n        {\r\n            Verify.ArgumentCondition(typeof (IData).IsAssignableFrom(dataType), \"dataType\",\r\n                                     \"dataType does not inherit the type '{0}'\".FormatWith(typeof (IData)));\r\n\r\n            if(!collection.ContainsKey(dataType))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var list = collection[dataType];\r\n\r\n            lock (_collectionAccesslock)\r\n            {\r\n                for (int i = list.Count - 1; i >= 0; i--)\r\n                {\r\n                    if (list[i].First == callback)\r\n                    {\r\n                        list.RemoveAt(i);\r\n                        return;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private delegate void ExecuteCallback<T>(T callback);\r\n\r\n        private static void Fire<DelegateType>(this Subscriptions collection, Type dataType, ExecuteCallback<DelegateType> runner) where DelegateType : class\r\n        {\r\n            Verify.ArgumentNotNull(collection, \"collection\");\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(runner, \"runner\");\r\n\r\n            if (SuppressEventScope.IsEnabled)\r\n            {\r\n                return;\r\n            }\r\n\r\n            List<Type> types = GetTypesToFire(dataType);\r\n\r\n            foreach (Type type in types)\r\n            {\r\n                Pair<Delegate, bool>[] subscriptions = null;\r\n\r\n                if (collection.ContainsKey(type))\r\n                {\r\n                    lock (_collectionAccesslock)\r\n                    {\r\n                        if (collection.ContainsKey(type))\r\n                        {\r\n                            subscriptions = collection[type].ToArray();\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (subscriptions == null) continue;\r\n\r\n                foreach (Pair<Delegate, bool> subscription in subscriptions)\r\n                {\r\n                    var callback = subscription.First as DelegateType;\r\n                    Verify.That(callback != null, \"Wrong delegate type\");\r\n\r\n                    runner(callback);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataBeforeAdd<T>(DataEventHandler dataBeforeAddDelegate, bool flushPersistent)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataBeforeAdd(typeof(T), dataBeforeAddDelegate, flushPersistent);\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataBeforeAdd<T>(DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataBeforeAdd<T>(DataEventHandler dataBeforeAddDelegate)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataBeforeAdd(typeof(T), dataBeforeAddDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataBeforeAdd(Type, DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataBeforeAdd(Type dataType, DataEventHandler dataBeforeAddDelegate) {\r\n            SubscribeToDataBeforeAdd(dataType, dataBeforeAddDelegate, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataBeforeAdd(Type dataType, DataEventHandler dataBeforeAddDelegate, bool flushPersistent)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(dataBeforeAddDelegate, \"dataBeforeAddDelegate\");\r\n\r\n            _dataBeforeAddEventDictionary.Add(dataType, new Subscription(dataBeforeAddDelegate, flushPersistent));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToDataBeforeAdd(Type dataType, DataEventHandler dataBeforeAddDelegate)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(dataBeforeAddDelegate, \"dataBeforeAddDelegate\");\r\n\r\n            _dataBeforeAddEventDictionary.Remove(dataType, dataBeforeAddDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataAfterAdd(Type dataType, DataEventHandler dataAfterAddDelegate, bool flushPersistent)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(dataAfterAddDelegate, \"dataAfterAddDelegate\");\r\n\r\n            _dataAfterAddEventDictionary.Add(dataType, dataAfterAddDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataAfterAdd(Type, DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataAfterAdd(Type dataType, DataEventHandler dataAfterAddDelegate)\r\n        {\r\n            SubscribeToDataAfterAdd(dataType, dataAfterAddDelegate, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataAfterAdd<T>(DataEventHandler dataAfterAddDelegate, bool flushPersistent)\r\n        {\r\n            SubscribeToDataAfterAdd(typeof(T), dataAfterAddDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataAfterAdd<T>(DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataAfterAdd<T>(DataEventHandler dataAfterAddDelegate)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataAfterAdd(typeof(T), dataAfterAddDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToStoreChanged(Type dataType, StoreEventHandler storeChangeDelegate, bool flushPersistent)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(storeChangeDelegate, \"storeChangeDelegate\");\r\n\r\n            _storeChangedEventDictionary.Add(dataType, storeChangeDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToStoreChanged<T>(StoreEventHandler storeChangeDelegate, bool flushPersistent)\r\n        {\r\n            SubscribeToStoreChanged(typeof(T), storeChangeDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToDataAfterAdd(Type dataType, DataEventHandler dataAfterAddDelegate)\r\n        {\r\n            if (dataType == null) throw new ArgumentNullException(\"dataType\");\r\n            if (dataAfterAddDelegate == null) throw new ArgumentNullException(\"dataAfterAddDelegate\");\r\n\r\n            _dataAfterAddEventDictionary.Remove(dataType, dataAfterAddDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToStoreChanged(Type dataType, StoreEventHandler storeChangeDelegate)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(storeChangeDelegate, \"storeChangeDelegate\");\r\n\r\n            _storeChangedEventDictionary.Remove(dataType, storeChangeDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataBeforeUpdate(Type, DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataBeforeUpdate(Type dataType, DataEventHandler dataBeforeUpdateDelegate)\r\n        {\r\n            SubscribeToDataBeforeUpdate(dataType, dataBeforeUpdateDelegate, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataBeforeUpdate(Type dataType, DataEventHandler dataBeforeUpdateDelegate, bool flushPersistent)\r\n        {\r\n            _dataBeforeUpdateEventDictionary.Add(dataType, dataBeforeUpdateDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataBeforeUpdate<T>(DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataBeforeUpdate<T>(DataEventHandler dataBeforeUpdateDelegate)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataBeforeUpdate(typeof(T), dataBeforeUpdateDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataBeforeUpdate<T>(DataEventHandler dataBeforeUpdateDelegate, bool flushPersistent)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataBeforeUpdate(typeof(T), dataBeforeUpdateDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToDataBeforeUpdate(Type dataType, DataEventHandler dataBeforeUpdateDelegate)\r\n        {\r\n            _dataBeforeUpdateEventDictionary.Remove(dataType, dataBeforeUpdateDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataAfterUpdate(Type, DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataAfterUpdate(Type dataType, DataEventHandler dataAfterUpdateDelegate)\r\n        {\r\n            SubscribeToDataAfterUpdate(dataType, dataAfterUpdateDelegate, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataAfterUpdate(Type dataType, DataEventHandler dataAfterUpdateDelegate, bool flushPersistent)\r\n        {\r\n            _dataAfterUpdateEventDictionary.Add(dataType, dataAfterUpdateDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataAfterUpdate<T>(DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataAfterUpdate<T>(DataEventHandler dataAfterUpdateDelegate)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataAfterUpdate(typeof(T), dataAfterUpdateDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataAfterUpdate<T>(DataEventHandler dataAfterUpdateDelegate, bool flushPersistent)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataAfterUpdate(typeof(T), dataAfterUpdateDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToDataAfterUpdate(Type dataType, DataEventHandler dataAfterUpdateDelegate)\r\n        {\r\n            _dataAfterUpdateEventDictionary.Remove(dataType, dataAfterUpdateDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataDeleted(Type, DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataDeleted(Type dataType, DataEventHandler dataDeletedDelegate)\r\n        {\r\n            SubscribeToDataDeleted(dataType, dataDeletedDelegate, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataDeleted(Type dataType, DataEventHandler dataDeletedDelegate, bool flushPersistent)\r\n        {\r\n            _dataDeletedEventDictionary.Add(dataType, dataDeletedDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataDeleted<T>(DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataDeleted<T>(DataEventHandler dataDeletedDelegate)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataDeleted(typeof(T), dataDeletedDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataDeleted<T>(DataEventHandler dataDeletedDelegate, bool flushPersistent)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataDeleted(typeof(T), dataDeletedDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToDataDeleted(Type dataType, DataEventHandler dataDeletedDelegate)\r\n        {\r\n            _dataDeletedEventDictionary.Remove(dataType, dataDeletedDelegate);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataAfterBuildNew(Type, DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataAfterBuildNew(Type dataType, DataEventHandler dataAfterBuildNewDelegate)\r\n        {\r\n            SubscribeToDataAfterBuildNew(dataType, dataAfterBuildNewDelegate, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataAfterBuildNew(Type dataType, DataEventHandler dataAfterBuildNewDelegate, bool flushPersistent)\r\n        {\r\n            _dataAfterBuildNewEventDictionary.Add(dataType, dataAfterBuildNewDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use SubscribeToDataAfterBuildNew<T>(DataEventHandler, bool)\")]\r\n        public static void SubscribeToDataAfterBuildNew<T>(DataEventHandler dataAfterBuildNewDelegate)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataAfterBuildNew(typeof(T), dataAfterBuildNewDelegate);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDataAfterBuildNew<T>(DataEventHandler dataAfterBuildNewDelegate, bool flushPersistent)\r\n            where T : IData\r\n        {\r\n            SubscribeToDataAfterBuildNew(typeof(T), dataAfterBuildNewDelegate, flushPersistent);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToDataAfterBuildNew(Type dataType, DataEventHandler dataAfterBuildNewDelegate)\r\n        {\r\n            _dataAfterBuildNewEventDictionary.Remove(dataType, dataAfterBuildNewDelegate);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Fire this when an external store has changed outside the process to notify subscribers to the StoreChangeEvent.  \r\n        /// </summary>\r\n        /// <param name=\"dataType\"></param>\r\n        /// <param name=\"publicationScope\"></param>\r\n        /// <param name=\"locale\"></param>\r\n        public static void FireExternalStoreChangedEvent(Type dataType, PublicationScope publicationScope, CultureInfo locale)\r\n        {\r\n            FireStoreChangedEvent(dataType, publicationScope, locale, false);\r\n        }\r\n\r\n\r\n        internal static void FireDataBeforeAddEvent(Type dataType, IData data)\r\n        {\r\n            var args = new DataEventArgs(dataType, data);\r\n            _dataBeforeAddEventDictionary.Fire <DataEventHandler>(dataType, callback => callback(null, args));\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataBeforeAddEvent<T>(IData data)\r\n            where T : IData\r\n        {\r\n            FireDataBeforeAddEvent(typeof(T), data);\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataAfterAddEvent(Type dataType, IData data)\r\n        {\r\n            var args = new DataEventArgs(dataType, data);\r\n\r\n            _dataAfterAddEventDictionary.Fire<DataEventHandler>(dataType, callback => callback(null, args));\r\n\r\n            FireStoreChangedEvent(dataType, data);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Follow up event for intally fired events\r\n        /// </summary>\r\n        private static void FireStoreChangedEvent(Type dataType, IData data)\r\n        {\r\n            FireStoreChangedEvent(dataType, data.DataSourceId.DataScopeIdentifier.ToPublicationScope(), data.DataSourceId.LocaleScope, true);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Call this indirectly. Use FireStoreChangedEvent or FireExternalStoreChangedEvent above.\r\n        /// </summary>\r\n        private static void FireStoreChangedEvent(Type dataType, PublicationScope publicationScope, CultureInfo locale, bool dataEventsFired)\r\n        {\r\n            var args = new StoreEventArgs(dataType, publicationScope, locale, dataEventsFired);\r\n\r\n            // switch to the scope where event is happening\r\n            using (new DataConnection(publicationScope, locale))\r\n            {\r\n                _storeChangedEventDictionary.Fire<StoreEventHandler>(dataType, callback => callback(null, args));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataAfterAddEvent<T>(IData data)\r\n            where T : IData\r\n        {\r\n            FireDataAfterAddEvent(typeof(T), data);\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataBeforeUpdateEvent(Type dataType, IData data)\r\n        {\r\n            var args = new DataEventArgs(dataType, data);\r\n\r\n            _dataBeforeUpdateEventDictionary.Fire<DataEventHandler>(dataType, callback => callback(null, args));\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataBeforeUpdateEvent<T>(IData data)\r\n            where T : IData\r\n        {\r\n            FireDataBeforeUpdateEvent(typeof(T), data);\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataAfterUpdateEvent(Type dataType, IData data)\r\n        {\r\n            var args = new DataEventArgs(dataType, data);\r\n\r\n            _dataAfterUpdateEventDictionary.Fire<DataEventHandler>(dataType, callback => callback(null, args));\r\n\r\n            FireStoreChangedEvent(dataType, data);\r\n\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataAfterUpdateEvent<T>(IData data)\r\n            where T : IData\r\n        {\r\n            FireDataAfterUpdateEvent(typeof(T), data);\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataDeletedEvent(Type dataType, IData data)\r\n        {\r\n            var args = new DataEventArgs(dataType, data);\r\n            _dataDeletedEventDictionary.Fire<DataEventHandler>(dataType, callback => callback(null, args));\r\n\r\n            FireStoreChangedEvent(dataType, data);\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataDeletedEvent<T>(IData data)\r\n            where T : IData\r\n        {\r\n            FireDataDeletedEvent(typeof(T), data);\r\n        }\r\n\r\n\r\n\r\n        internal static void FireDataAfterBuildNewEvent(Type dataType, IData data)\r\n        {\r\n            var args = new DataEventArgs(dataType, data);\r\n            _dataAfterBuildNewEventDictionary.Fire<DataEventHandler>(dataType, callback => callback(null, args));\r\n        }\r\n\r\n\r\n        internal static void FireDataAfterBuildNewEvent<T>(IData data)\r\n            where T : IData\r\n        {\r\n            FireDataAfterBuildNewEvent(typeof(T), data);\r\n        }\r\n\r\n\r\n        private static List<Type> GetTypesToFire(Type type)\r\n        {\r\n            var types = new List<Type>();\r\n\r\n            types.Add(type);\r\n\r\n            foreach (Type superInterface in type.GetInterfaces())\r\n            {\r\n                if (typeof(IData).IsAssignableFrom(superInterface))\r\n                {\r\n                    types.Add(superInterface);\r\n                }\r\n            }\r\n\r\n            return types;\r\n        }\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            // Removing all non flush-persistent subscriptions\r\n            var dictionaries = new[]\r\n                                  {\r\n                                      _dataBeforeAddEventDictionary,\r\n                                      _dataAfterAddEventDictionary,\r\n                                      _dataBeforeUpdateEventDictionary,\r\n                                      _dataAfterUpdateEventDictionary,\r\n                                      _dataDeletedEventDictionary,\r\n                                      _dataAfterBuildNewEventDictionary,\r\n                                      _storeChangedEventDictionary\r\n                                  };\r\n\r\n            foreach (var dictionary in dictionaries)\r\n            {\r\n                foreach (var subscrList in dictionary.GetValues())\r\n                {\r\n                    for (int i = subscrList.Count - 1; i >= 0; i--)\r\n                    {\r\n                        if (!subscrList[i].Second)\r\n                        {\r\n                            subscrList.RemoveAt(i);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private class SuppressEventScope: IDisposable\r\n        {\r\n            private readonly bool _active;\r\n\r\n            public SuppressEventScope(bool active)\r\n            {\r\n               if (!active) return;\r\n\r\n               _active = true;\r\n               Counter(1);\r\n            }\r\n\r\n            private sealed class CounterContainer\r\n            {\r\n                public CounterContainer()\r\n                {\r\n                    this.Counter = 0;\r\n                }\r\n\r\n                public int Counter { get; set; }\r\n            }\r\n\r\n\r\n            private static CounterContainer SuppressEventScopeCounter\r\n            {\r\n                get\r\n                {\r\n                    return RequestLifetimeCache.GetCachedOrNew<CounterContainer>(\"SuppressEventScope:Counter\");\r\n                }\r\n            }\r\n\r\n            public static bool IsEnabled\r\n            {\r\n                get { return Counter(0) > 0; }\r\n            }\r\n\r\n            /// <summary>\r\n            /// Adds a value to counter, and  returns result value.\r\n            /// </summary>\r\n            /// <param name=\"incrementValue\">Value to be added.</param>\r\n            /// <returns></returns>\r\n            private static int Counter(int incrementValue)\r\n            {\r\n                CounterContainer counter = SuppressEventScopeCounter;\r\n                counter.Counter += incrementValue;\r\n\r\n                return counter.Counter;\r\n            }\r\n\r\n            #region IDisposable Members\r\n\r\n            public void Dispose()\r\n            {\r\n                if(!_active) return;\r\n\r\n                Counter(-1);\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~SuppressEventScope()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n            #endregion\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IDisposable SuppressEvents\r\n        {\r\n            get\r\n            {\r\n                return new SuppressEventScope(true);\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/DataEvents.cs",
    "content": "﻿using Composite.Core.Implementation;\r\nusing System;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// This class contains all the event fired by C1 CMS when changes are made to data items. \r\n    /// \r\n    /// Use <see cref=\"Composite.Data.DataEvents&lt;TData&gt;.OnStoreChanged\"/> to catch any data change event, including events originating from other servers in a load balance setup\r\n    /// or changes made directly to a store (which C1 CMS can detect). This event do not contain details about the specific data item changed and is raised after the fact.\r\n    /// \r\n    /// Use the more detailed operations to catch data events that happen in the current website process. The 'OnBefore' events enable you to manipulate data before they are stored. \r\n    /// The 'OnAfter' events let you react to data changes in detail, for instance updating a cache.\r\n    /// \r\n    /// A combination of <see cref=\"Composite.Data.DataEvents&lt;TData&gt;.OnStoreChanged\"/> and the detailed data events can be used to create a highly optimized cache.\r\n    /// </summary>\r\n    /// <example>\r\n    /// <code>\r\n    /// void MyMethod()\r\n    /// {\r\n    ///    DataEvents&lt;IMyDataType&gt;.OnBeforeAdd += new DataEventHandler(DataEvents_OnBeforeAdd);\r\n    ///    DataEvents&lt;IMyDataType&gt;.OnStoreChanged += new StoreEventHandler(DataEvents_OnStoreChanged);\r\n    ///    \r\n    ///    using (DataConnection connection = new DataConnection())\r\n    ///    {\r\n    ///       IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n    ///       myDataType.Name = \"Foo\";\r\n    ///       \r\n    ///       connection.Add&lt;IMyDataType&gt;(myDataType); // This will fire both of the the events in the local process!\r\n    ///       // if other servers share data store with this site they will see OnStoreChanged fire.\r\n    ///    }\r\n    /// }\r\n    /// \r\n    /// \r\n    /// void DataEvents_OnBeforeAdd(object sender, DataEventArgs dataEventArgs)\r\n    /// {        \r\n    ///     // here a minor update to the cache could be done (like adding info about the new element only).\r\n    /// }\r\n    /// \r\n    /// \r\n    /// void DataEvents_OnStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n    /// {        \r\n    ///     if (!storeEventArgs.DataEventsFired)\r\n    ///     {\r\n    ///         // an external update event happened - DataEvents_OnBeforeAdd not fired\r\n    ///         // here a complete cache flush could be done\r\n    ///     }\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    /// <typeparam name=\"TData\">Data type to attach events to</typeparam>\r\n    public static class DataEvents<TData>\r\n        where TData : class, IData\r\n    {\r\n        /// <summary>\r\n        /// This event is fired just before a data item is added to the C1 CMS data store.\r\n        /// See <see cref=\"Composite.Data.DataConnection.Add&lt;TData&gt;(TData)\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;.OnBeforeAdd += new DataEventHandler(DataEvents_OnBeforeAdd);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n        ///       myDataType.Name = \"Foo\";\r\n        ///       \r\n        ///       connection.Add&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnBeforeAdd(object sender, DataEventArgs dataEventArgs)\r\n        /// {        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1000:DoNotDeclareStaticMembersOnGenericTypes\", Justification = \"We had to be backwards compatible\")]\r\n        public static event DataEventHandler OnBeforeAdd\r\n        {\r\n            add\r\n            {                \r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnBeforeAdd += value;\r\n            }\r\n            remove\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnBeforeAdd -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This event is fired just after a data item has been added to the C1 CMS data store.\r\n        /// See <see cref=\"Composite.Data.DataConnection.Add&lt;TData&gt;(TData)\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;.OnAfterAdd += new DataEventHandler(DataEvents_OnAfterAdd);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n        ///       myDataType.Name = \"Foo\";\r\n        ///       \r\n        ///       connection.Add&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnAfterAdd(object sender, DataEventArgs dataEventArgs)\r\n        /// {        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1000:DoNotDeclareStaticMembersOnGenericTypes\", Justification = \"We had to be backwards compatible\")]\r\n        public static event DataEventHandler OnAfterAdd\r\n        {\r\n            add\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnAfterAdd += value;\r\n            }\r\n            remove\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnAfterAdd -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This event is fired just before a data item is updated in the C1 CMS data store.\r\n        /// See <see cref=\"Composite.Data.DataConnection.Update&lt;TData&gt;(TData)\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;.OnBeforeUpdate += new DataEventHandler(DataEvents_OnBeforeUpdate);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = \r\n        ///          (from item in connection.get&lt;IMyDataType&gt;()\r\n        ///           where item.Id == 1\r\n        ///           select item).First();\r\n        ///           \r\n        ///       myDataType.Name = \"Foo\";\r\n        ///       \r\n        ///       connection.Update&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnBeforeUpdate(object sender, DataEventArgs dataEventArgs)\r\n        /// {        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1000:DoNotDeclareStaticMembersOnGenericTypes\", Justification = \"We had to be backwards compatible\")]\r\n        public static event DataEventHandler OnBeforeUpdate\r\n        {\r\n            add\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnBeforeUpdate += value;\r\n            }\r\n            remove\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnBeforeUpdate -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This event is fired just after a data item has been updated in the C1 CMS data store.\r\n        /// See <see cref=\"Composite.Data.DataConnection.Update&lt;TData&gt;(TData)\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;.OnAfterUpdate += new DataEventHandler(DataEvents_OnAfterUpdate);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = \r\n        ///          (from item in connection.get&lt;IMyDataType&gt;()\r\n        ///           where item.Id == 1\r\n        ///           select item).First();\r\n        ///           \r\n        ///       myDataType.Name = \"Foo\";\r\n        ///       \r\n        ///       connection.Update&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnAfterUpdate(object sender, DataEventArgs dataEventArgs)\r\n        /// {        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1000:DoNotDeclareStaticMembersOnGenericTypes\", Justification = \"We had to be backwards compatible\")]\r\n        public static event DataEventHandler OnAfterUpdate\r\n        {\r\n            add\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnAfterUpdate += value;\r\n            }\r\n            remove\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnAfterUpdate -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This event is fired after a data item has been deleted from the C1 CMS data store.\r\n        /// See <see cref=\"Composite.Data.DataConnection.Delete&lt;TData&gt;(TData)\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;.OnDeleted+= new DataEventHandler(DataEvents_OnDeleted);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = \r\n        ///          (from item in connection.get&lt;IMyDataType&gt;()\r\n        ///           where item.Id == 1\r\n        ///           select item).First();\r\n        ///           \r\n        ///       connection.Delete&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnDeleted(object sender, DataEventArgs dataEventArgs)\r\n        /// {        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1000:DoNotDeclareStaticMembersOnGenericTypes\", Justification = \"We had to be backwards compatible\")]\r\n        public static event DataEventHandler OnDeleted\r\n        {\r\n            add\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnDeleted += value;\r\n            }\r\n            remove\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnDeleted -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This event is fired after changes has happened to the C1 CMS data store. This may be atomic actions or a larger change to the underlying\r\n        /// data store. The <see cref=\"Composite.Data.StoreEventArgs\"/> class describe the change in broad terms, including a flag indicating is detailed data\r\n        /// event have been raised or not. \r\n        /// \r\n        /// You can use this event as a simple way to react to data changes (like clearing a cache) or you can mix this with atomic data events (add, delete, update)\r\n        /// to make a build a more advanced cache.\r\n        /// \r\n        /// You should listen to this event in order to support scale out across multiple servers, since this event is meant to be signaled when changes happen\r\n        /// on another server. In such situations detailed data events will not fire on other machines.\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;.OnStoreChanged+= new StoreEventHandler(DataEvents_OnStoreChanged);\r\n        ///    \r\n        ///    using (DataConnection connection = new DataConnection())\r\n        ///    {\r\n        ///       IMyDataType myDataType = \r\n        ///          (from item in connection.get&lt;IMyDataType&gt;()\r\n        ///           where item.Id == 1\r\n        ///           select item).First();\r\n        ///           \r\n        ///       connection.Delete&lt;IMyDataType&gt;(myDataType); // This will fire the event!\r\n        ///    }\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        /// {        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1000:DoNotDeclareStaticMembersOnGenericTypes\", Justification = \"We had to be backwards compatible\")]\r\n        public static event StoreEventHandler OnStoreChanged\r\n        {\r\n            add\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnStoreChanged += value;\r\n            }\r\n            remove\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnStoreChanged -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This event is fired just after a new data item is created.\r\n        /// See <see cref=\"Composite.Data.DataConnection.New&lt;TData&gt;()\"/>\r\n        /// </summary>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;.OnNew += new DataEventHandler(DataEvents_OnNew);\r\n        ///    \r\n        ///    IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;(); // This will fire the event!\r\n        /// }\r\n        /// \r\n        /// \r\n        /// void DataEvents_OnNew(object sender, DataEventArgs dataEventArgs)\r\n        /// {        \r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1009:DeclareEventHandlersCorrectly\", Justification = \"We had to be backwards compatible\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1000:DoNotDeclareStaticMembersOnGenericTypes\", Justification = \"We had to be backwards compatible\")]\r\n        public static event DataEventHandler OnNew\r\n        {\r\n            add\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnNew += value;\r\n            }\r\n            remove\r\n            {\r\n                ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().OnNew -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Fire the event that signals that data in an external store has changed. \r\n        /// </summary>\r\n        /// <remarks>\r\n        /// You should NOT fire this event if you do data changes through the C1 CMS data API since events will already be handled for you in this case.\r\n        /// \r\n        /// Use this method if you are responsible for flushing cached data originating from a store not fully managed by the local website process.\r\n        /// \r\n        /// This could be data stored in a central database, where updates happened on another webserver and you wish to signal update events to other webservers running \r\n        /// in a farm. This could also be a situation where you have a custom data provider reading data from some 3rd party system or data store.\r\n        /// \r\n        /// Calling this event will result in cache invalidation on all data of this particular type. \r\n        /// \r\n        /// Handlers listening to the <see cref=\"Composite.Data.DataEvents&lt;TData&gt;.OnStoreChanged\"/> event will be called with a <see cref=\"Composite.Data.StoreEventArgs\"/> \r\n        /// instance indicating that data events has not been fired. This signals that detail cache management is not possible and a complete cache flush is required on structures \r\n        /// depending on this data type.\r\n        /// </remarks>\r\n        /// <example>\r\n        /// <code>\r\n        /// void MyMethod()\r\n        /// {\r\n        ///    DataEvents&lt;IMyDataType&gt;.FireExternalStoreChangeEvent(PublicationScope.Published, new CultureInfo(\"da-DK\"));\r\n        /// }\r\n        /// </code>\r\n        /// </example>\r\n        public static void FireExternalStoreChangeEvent(PublicationScope publicationScope, CultureInfo locale)\r\n        {\r\n            ImplementationFactory.CurrentFactory.CreateStatelessDataEvents<TData>().FireExternalStoreChangeEvent(publicationScope, locale);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataFacade.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Threading;\r\nusing System.Transactions;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Foundation;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum CascadeDeleteType\r\n    {\r\n        /// <exclude />\r\n        Allow = 0, // Cascade delete are performed if the references allows it, if referees dont allow it and exception is thrown\r\n\r\n        /// <exclude />\r\n        Disallow = 1, // Cascade deletes are not performed and if referees exists an exception is thrown\r\n\r\n        /// <exclude />\r\n        Disable = 2// No check on existens of referees is done. This might result in foreign key violation\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataMoveResult\r\n    {\r\n        internal DataMoveResult(IData movedData, IEnumerable<IData> movedRefereeDatas)\r\n        {\r\n            this.MovedData = movedData;\r\n            this.MovedRefereeDatas = movedRefereeDatas;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IData MovedData\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<IData> MovedRefereeDatas\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DataFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitializeResources);\r\n\r\n        private static IDataFacade _dataFacade = new DataFacadeImpl();\r\n\r\n        static DataFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n        \r\n        internal static IDataFacade Implementation { get { return _dataFacade; } set { _dataFacade = value; } }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets an empty predicate (f => true)\r\n        /// </summary>\r\n        public static Expression<Func<T, bool>> GetEmptyPredicate<T>() where T : class\r\n        {\r\n            return EmptyPredicate<T>.Instance;\r\n        }\r\n\r\n\r\n        #region Data interception methods\r\n\r\n        /// <exclude />\r\n        public static void SetDataInterceptor<T>(DataInterceptor dataInterceptor)\r\n            where T : class, IData\r\n        {\r\n            _dataFacade.SetDataInterceptor<T>(dataInterceptor);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void SetDataInterceptor(Type interfaceType, DataInterceptor dataInterceptor)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            MethodInfo methodInfo = GetSetDataInterceptorMethodInfo(interfaceType);\r\n\r\n            methodInfo.Invoke(null, new object[] { dataInterceptor });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool HasDataInterceptor<T>()\r\n            where T : class, IData\r\n        {\r\n            return _dataFacade.HasDataInterceptor<T>();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        internal static IEnumerable<DataInterceptor> GetDataInterceptors(Type interfaceType)\r\n        {\r\n            return _dataFacade.GetDataInterceptors(interfaceType);\r\n        }\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void HasDataInterceptor(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            MethodInfo methodInfo = GetHasDataInterceptorMethodInfo(interfaceType);\r\n\r\n            methodInfo.Invoke(null, new object[] { });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ClearDataInterceptor<T>()\r\n            where T : class, IData\r\n        {\r\n            _dataFacade.ClearDataInterceptor<T>();\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void ClearDataInterceptor(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            MethodInfo methodInfo = GetClearDataInterceptorMethodInfo(interfaceType);\r\n\r\n            methodInfo.Invoke(null, new object[] { });\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void SetGlobalDataInterceptor<T>(DataInterceptor dataInterceptor)\r\n            where T : class, IData\r\n        {\r\n            _dataFacade.SetGlobalDataInterceptor<T>(dataInterceptor);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool HasGlobalDataInterceptor<T>()\r\n            where T : class, IData\r\n        {\r\n            return _dataFacade.HasGlobalDataInterceptor<T>();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ClearGlobalDataInterceptor<T>()\r\n            where T : class, IData\r\n        {\r\n            _dataFacade.ClearGlobalDataInterceptor<T>();\r\n        }\r\n\r\n\r\n\r\n        \r\n        #endregion\r\n\r\n\r\n\r\n        #region GetData methods\r\n\r\n        /// <exclude />\r\n        public static IQueryable<T> GetData<T>(bool useCaching, IEnumerable<string> providerNames)\r\n            where T : class, IData\r\n        {\r\n            return _dataFacade.GetData<T>(useCaching, providerNames);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IQueryable<T> GetData<T>(bool useCaching)\r\n            where T : class, IData\r\n        {\r\n            return _dataFacade.GetData<T>(useCaching, null);\r\n        }\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IQueryable<T> GetData<T>()\r\n            where T : class, IData\r\n        {\r\n            return GetData<T>(true, null);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IQueryable<T> GetData<T>(Expression<Func<T, bool>> predicate)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(predicate, \"predicate\");\r\n\r\n            IQueryable<T> result = GetData<T>(true, null);\r\n\r\n            if (object.Equals(predicate, EmptyPredicate<T>.Instance))\r\n            {\r\n                return result;\r\n            }\r\n\r\n            return result.Where(predicate);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IQueryable<T> GetData<T>(Expression<Func<T, bool>> predicate, bool useCaching)\r\n            where T : class, IData\r\n        {\r\n            if (predicate == null) throw new ArgumentNullException(\"predicate\");\r\n\r\n            IQueryable<T> result = GetData<T>(useCaching, null);\r\n\r\n            if (object.Equals(predicate, EmptyPredicate<T>.Instance))\r\n            {\r\n                return result;\r\n            }\r\n\r\n            return result.Where(predicate);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IQueryable GetData(Type interfaceType)\r\n        {\r\n            return GetData(interfaceType, true);\r\n        }\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IQueryable GetData(Type interfaceType, bool useCaching)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            MethodInfo methodInfo = GetGetDataMethodInfo(interfaceType);\r\n\r\n            return methodInfo.Invoke(null, new object[] { useCaching, null }) as IQueryable;\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IQueryable GetData(Type interfaceType, string providerName)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n\r\n            MethodInfo methodInfo = GetGetDataMethodInfo(interfaceType);\r\n\r\n            return methodInfo.Invoke(null, new object[] { false, new string[] { providerName } }) as IQueryable;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region GetDataFromDataSourceId methods\r\n\r\n        /// <exclude />\r\n        public static T GetDataFromDataSourceId<T>(DataSourceId dataSourceId, bool useCaching)\r\n            where T : class, IData\r\n        {\r\n            if (null == dataSourceId) throw new ArgumentNullException(\"dataSourceId\");\r\n\r\n            return _dataFacade.GetDataFromDataSourceId<T>(dataSourceId, useCaching);\r\n        }\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static T GetDataFromDataSourceId<T>(DataSourceId dataSourceId)\r\n            where T : class, IData\r\n        {\r\n            if (null == dataSourceId) throw new ArgumentNullException(\"dataSourceId\");\r\n\r\n            return GetDataFromDataSourceId<T>(dataSourceId, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IData GetDataFromDataSourceId(DataSourceId dataSourceId)\r\n        {\r\n            if (null == dataSourceId) throw new ArgumentNullException(\"dataSourceId\");\r\n\r\n            MethodInfo methodInfo = GetGetDataFromDataSourceIdMethodInfo(dataSourceId.InterfaceType);\r\n\r\n            IData data = (IData)methodInfo.Invoke(null, new object[] { dataSourceId, true });\r\n\r\n            return data;\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IData GetDataFromDataSourceId(DataSourceId dataSourceId, bool useCaching)\r\n        {\r\n            if (null == dataSourceId) throw new ArgumentNullException(\"dataSourceId\");\r\n\r\n            MethodInfo methodInfo = GetGetDataFromDataSourceIdMethodInfo(dataSourceId.InterfaceType);\r\n\r\n            IData data = (IData)methodInfo.Invoke(null, new object[] { dataSourceId, useCaching });\r\n\r\n            return data;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region GetDataFromOtherScope methods (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static IQueryable<T> GetDataFromOtherScope<T>(T data, DataScopeIdentifier dataScopeIdentifier)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            if (dataScopeIdentifier == null) throw new ArgumentNullException(\"dataScopeIdentifier\");\r\n\r\n            if (GetSupportedDataScopes(data.DataSourceId.InterfaceType).Contains(dataScopeIdentifier) == false) throw new ArgumentException(string.Format(\"The data type '{0}' does not support the data scope '{1}'\", data.DataSourceId.InterfaceType, dataScopeIdentifier));\r\n\r\n            using (new DataScope(dataScopeIdentifier))\r\n            {\r\n                return DataExpressionBuilder.GetQueryableByData<T>(data);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IQueryable<T> GetDataFromOtherLocale<T>(T data, CultureInfo cultureInfo)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            if (cultureInfo == null) throw new ArgumentNullException(\"cultureInfo\");\r\n\r\n            using (new DataScope(cultureInfo))\r\n            {\r\n                return DataExpressionBuilder.GetQueryableByData<T>(data);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IData> GetDataFromOtherScope(IData data, DataScopeIdentifier dataScopeIdentifier)\r\n        {\r\n            return GetDataFromOtherScope(data, dataScopeIdentifier, false);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IData> GetDataFromOtherScope(\r\n            IData data, DataScopeIdentifier dataScopeIdentifier, bool useCaching)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            Verify.ArgumentNotNull(dataScopeIdentifier, nameof(dataScopeIdentifier));\r\n\r\n            if (!GetSupportedDataScopes(data.DataSourceId.InterfaceType).Contains(dataScopeIdentifier))\r\n            {\r\n                throw new ArgumentException($\"The data type '{data.DataSourceId.InterfaceType}' does not support the data scope '{dataScopeIdentifier}'\");\r\n            }\r\n\r\n            if (useCaching)\r\n            {\r\n                DataSourceId sourceId = data.DataSourceId;\r\n                var newDataSource = new DataSourceId(sourceId.DataId, sourceId.ProviderName, sourceId.InterfaceType)\r\n                {\r\n                    DataScopeIdentifier = dataScopeIdentifier\r\n                };\r\n\r\n\r\n                IData fromDataSource = GetDataFromDataSourceId(newDataSource, true);\r\n                return fromDataSource == null ? new IData[0] : new[] { fromDataSource };\r\n            }\r\n\r\n            var result = new List<IData>();\r\n\r\n            using (new DataScope(dataScopeIdentifier))\r\n            {\r\n                IQueryable table = GetData(data.DataSourceId.InterfaceType, false);\r\n\r\n                IQueryable queryable = DataExpressionBuilder.GetQueryableByData(data, table);\r\n\r\n                foreach (object obj in queryable)\r\n                {\r\n                    result.Add((IData)obj);\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region GetPredicateExpressionByUniqueKey methods (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static Expression<Func<T, bool>> GetPredicateExpressionByUniqueKey<T>(DataKeyPropertyCollection dataKeyPropertyCollection)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataKeyPropertyCollection, nameof(dataKeyPropertyCollection));\r\n\r\n            var keyProperties = typeof(T).GetKeyProperties();\r\n\r\n            ParameterExpression parameterExpression = Expression.Parameter(typeof(T), \"data\");\r\n\r\n            Expression currentExpression = GetPredicateExpressionByUniqueKeyFilterExpression(keyProperties, dataKeyPropertyCollection, parameterExpression);\r\n\r\n            return Expression.Lambda<Func<T, bool>>(currentExpression, parameterExpression);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static Expression<Func<T, bool>> GetPredicateExpressionByUniqueKey<T>(object dataKeyValue)\r\n            where T : class, IData\r\n        {\r\n            return GetPredicateExpressionByUniqueKey<T>(ToKeyCollection(typeof(T), dataKeyValue));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static LambdaExpression GetPredicateExpressionByUniqueKey(Type interfaceType, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (dataKeyPropertyCollection == null) throw new ArgumentNullException(\"dataKeyPropertyCollection\");\r\n\r\n            var keyProperties = DataAttributeFacade.GetKeyProperties(interfaceType);\r\n\r\n            ParameterExpression parameterExpression = Expression.Parameter(interfaceType, \"data\");\r\n\r\n            Expression currentExpression = GetPredicateExpressionByUniqueKeyFilterExpression(keyProperties, dataKeyPropertyCollection, parameterExpression);\r\n\r\n            Type delegateType = typeof(Func<,>).MakeGenericType(interfaceType, typeof(bool));\r\n\r\n            return Expression.Lambda(delegateType, currentExpression, parameterExpression);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static LambdaExpression GetPredicateExpressionByUniqueKey(Type interfaceType, object dataKeyValue)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            return GetPredicateExpressionByUniqueKey(interfaceType, ToKeyCollection(interfaceType, dataKeyValue));\r\n        }\r\n\r\n\r\n\r\n        // Private helper\r\n        private static Expression GetPredicateExpressionByUniqueKeyFilterExpression(IReadOnlyList<PropertyInfo> keyProperties, DataKeyPropertyCollection dataKeyPropertyCollection, ParameterExpression parameterExpression)\r\n        {\r\n            if (keyProperties.Count != dataKeyPropertyCollection.Count) throw new ArgumentException(\"Missing or too many key properties\");\r\n\r\n            var propertiesWithValues = new List<Tuple<PropertyInfo, object>>();\r\n            foreach (var kvp in dataKeyPropertyCollection.KeyProperties)\r\n            {\r\n                PropertyInfo keyPropertyInfo = keyProperties.Single(f => f.Name == kvp.Key);\r\n                object castedDataKey = ValueTypeConverter.Convert(kvp.Value, keyPropertyInfo.PropertyType);\r\n\r\n                propertiesWithValues.Add(new Tuple<PropertyInfo, object>(keyPropertyInfo, castedDataKey));\r\n            }\r\n\r\n            return ExpressionHelper.CreatePropertyPredicate(parameterExpression, propertiesWithValues);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region GetDataByUniqueKey methods (Only helpers)\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static T TryGetDataByUniqueKey<T>(object dataKeyValue)\r\n            where T : class, IData\r\n        {\r\n            return TryGetDataByUniqueKey<T>(ToKeyCollection(typeof(T), dataKeyValue));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static T TryGetDataByUniqueKey<T>(DataKeyPropertyCollection dataKeyPropertyCollection)\r\n            where T : class, IData\r\n        {\r\n            return (T) TryGetDataByUniqueKey(typeof(T), dataKeyPropertyCollection);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static T GetDataByUniqueKey<T>(object dataKeyValue)\r\n            where T : class, IData\r\n        {\r\n            IData data = TryGetDataByUniqueKey<T>(dataKeyValue);\r\n\r\n            if (data == null) throw new InvalidOperationException(\"No data exist given the data key value\");\r\n\r\n            return (T)data;\r\n        }\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IData TryGetDataByUniqueKey(Type interfaceType, object dataKeyValue)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, nameof(interfaceType));\r\n\r\n            return TryGetDataByUniqueKey(interfaceType, ToKeyCollection(interfaceType, dataKeyValue));\r\n        }\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IEnumerable<IData> TryGetDataVersionsByUniqueKey(Type interfaceType, object dataKeyValue)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            return TryGetDataVersionsByUniqueKey(interfaceType, ToKeyCollection(interfaceType, dataKeyValue));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IData TryGetDataByUniqueKey(Type interfaceType, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (dataKeyPropertyCollection == null) throw new ArgumentNullException(\"dataKeyPropertyCollection\");\r\n\r\n            if (dataKeyPropertyCollection.Count == 1 && DataCachingFacade.IsDataAccessCacheEnabled(interfaceType))\r\n            {\r\n                var query = GetData(interfaceType);\r\n                if (query is ICachingQueryable_CachedByKey cachedByKey)\r\n                {\r\n                    return cachedByKey.GetCachedValueByKey(GetConvertedUniqueKey(interfaceType, dataKeyPropertyCollection));\r\n                }\r\n            }\r\n\r\n            LambdaExpression lambdaExpression = GetPredicateExpressionByUniqueKey(interfaceType, dataKeyPropertyCollection);\r\n\r\n            MethodInfo methodInfo = GetGetDataWithPredicatMethodInfo(interfaceType);\r\n\r\n            IQueryable queryable = (IQueryable)methodInfo.Invoke(null, new object[] { lambdaExpression });\r\n\r\n            var dataList = queryable.OfType<IData>().ToList();\r\n            if (dataList.Count > 1)\r\n                throw new InvalidOperationException($\"More than one data item of type '{interfaceType}' is matching the key: {dataKeyPropertyCollection}\");\r\n\r\n            return dataList.SingleOrDefault();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns all data items of the given type, which matches the provided dataPropertyCollection (property/value pairs)\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The data type to query - type is expected to implement a subinterface of IData</param>\r\n        /// <param name=\"dataPropertyCollection\">The properties and values to use for filtering</param>\r\n        /// <returns>Data matching the provided property values</returns>\r\n        public static IEnumerable<IData> TryGetDataByLookupKeys(Type interfaceType, DataPropertyValueCollection dataPropertyCollection)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, nameof(interfaceType));\r\n            Verify.ArgumentNotNull(dataPropertyCollection, nameof(dataPropertyCollection));\r\n\r\n            LambdaExpression lambdaExpression = GetPredicateExpression(interfaceType, dataPropertyCollection);\r\n\r\n            MethodInfo methodInfo = GetGetDataWithPredicatMethodInfo(interfaceType);\r\n\r\n            var queryable = (IQueryable)methodInfo.Invoke(null, new object[] { lambdaExpression });\r\n\r\n            return ((IEnumerable)queryable).Cast<IData>();\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IData> TryGetDataVersionsByUniqueKey(Type interfaceType, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, nameof(interfaceType));\r\n            Verify.ArgumentNotNull(dataKeyPropertyCollection, nameof(dataKeyPropertyCollection));\r\n\r\n            if (dataKeyPropertyCollection.Count == 1 && DataCachingFacade.IsDataAccessCacheEnabled(interfaceType))\r\n            {\r\n                var query = GetData(interfaceType);\r\n                if (query is ICachingQueryable_CachedByKey cachedByKey)\r\n                {\r\n                    return cachedByKey.GetCachedVersionValuesByKey(GetConvertedUniqueKey(interfaceType, dataKeyPropertyCollection));\r\n                }\r\n            }\r\n\r\n            LambdaExpression lambdaExpression = GetPredicateExpressionByUniqueKey(interfaceType, dataKeyPropertyCollection);\r\n\r\n            MethodInfo methodInfo = GetGetDataWithPredicatMethodInfo(interfaceType);\r\n\r\n            var queryable = (IQueryable)methodInfo.Invoke(null, new object[] { lambdaExpression });\r\n\r\n            return ((IEnumerable) queryable).Cast<IData>();\r\n        }\r\n\r\n\r\n        private static object GetConvertedUniqueKey(Type interfaceType, DataKeyPropertyCollection keyCollection)\r\n        {\r\n            var keyPropertyInfo = interfaceType.GetKeyProperties().Single();\r\n            var kvp = keyCollection.KeyProperties.Single();\r\n\r\n            if (keyPropertyInfo.Name != kvp.Key)\r\n            {\r\n                throw new InvalidOperationException($\"Expected value for key '{keyPropertyInfo.Name}' but found '{kvp.Key}'\");\r\n            }\r\n\r\n\r\n            var result = ValueTypeConverter.TryConvert(kvp.Value, keyPropertyInfo.PropertyType, out var conversionException);\r\n            if (conversionException != null)\r\n            {\r\n                throw conversionException;\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IData GetDataByUniqueKey(Type interfaceType, object dataKeyValue)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, nameof(interfaceType));\r\n\r\n            IData data = TryGetDataByUniqueKey(interfaceType, dataKeyValue);\r\n\r\n            Verify.IsNotNull(data, \"No data exist given the data key value\");\r\n\r\n            return data;\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IData GetDataByUniqueKey(Type interfaceType, DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (dataKeyPropertyCollection == null) throw new ArgumentNullException(\"dataKeyPropertyCollection\");\r\n\r\n            IData data = TryGetDataByUniqueKey(interfaceType, dataKeyPropertyCollection);\r\n\r\n            if (data == null) throw new InvalidOperationException(\"No data exist given the data key values\");\r\n\r\n            return data;\r\n        }\r\n\r\n\r\n        private static DataKeyPropertyCollection ToKeyCollection(Type interfaceType, object dataKeyValue)\r\n        {\r\n            var keyPropertyInfo = interfaceType.GetKeyProperties().Single();\r\n            return ToKeyCollection(keyPropertyInfo, dataKeyValue);\r\n        }\r\n\r\n\r\n        private static DataKeyPropertyCollection ToKeyCollection(PropertyInfo keyPropertyInfo, object dataKeyValue)\r\n        {\r\n            var dataKeyPropertyCollection = new DataKeyPropertyCollection();\r\n            dataKeyPropertyCollection.AddKeyProperty(keyPropertyInfo, dataKeyValue);\r\n            return dataKeyPropertyCollection;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region GetDataOrderedBy methods (Only helpers)\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IEnumerable<IData> GetDataOrderedBy(Type interfaceType, PropertyInfo propertyInfo)\r\n        {\r\n            return GetDataOrderedByQueryable(interfaceType, propertyInfo).ToDataEnumerable();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IQueryable GetDataOrderedByQueryable(Type interfaceType, PropertyInfo propertyInfo)\r\n        {\r\n            IQueryable source = DataFacade.GetData(interfaceType);\r\n\r\n            ParameterExpression parameter = Expression.Parameter(interfaceType, \"f\");\r\n            LambdaExpression lambdaExpression = Expression.Lambda(Expression.Property(parameter, propertyInfo), parameter);\r\n\r\n            MethodCallExpression methodCallExpression = Expression.Call\r\n            (\r\n                typeof(Queryable),\r\n                \"OrderBy\",\r\n                new Type[] { interfaceType, propertyInfo.PropertyType },\r\n                source.Expression,\r\n                Expression.Quote(lambdaExpression)\r\n            );\r\n\r\n            return source.Provider.CreateQuery(methodCallExpression);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region GetPredicateExpression methods (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static LambdaExpression GetPredicateExpression(Type interfaceType, DataPropertyValueCollection dataPropertyValueCollection)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (dataPropertyValueCollection == null) throw new ArgumentNullException(\"dataPropertyValueCollection\");\r\n\r\n            ParameterExpression parameterExpression = Expression.Parameter(interfaceType, \"data\");\r\n\r\n            Expression currentExpression = GetPredicateExpressionFilterExpression(dataPropertyValueCollection, parameterExpression);\r\n\r\n            Type delegateType = typeof(Func<,>).MakeGenericType(new Type[] { interfaceType, typeof(bool) });\r\n\r\n            LambdaExpression lambdaExpression = Expression.Lambda(delegateType, currentExpression, new ParameterExpression[] { parameterExpression });\r\n\r\n            return lambdaExpression;\r\n        }\r\n\r\n\r\n        // Private helper\r\n        private static Expression GetPredicateExpressionFilterExpression(DataPropertyValueCollection dataPropertyValueCollection, ParameterExpression parameterExpression)\r\n        {\r\n            Expression currentExpression = null;\r\n            foreach (var kvp in dataPropertyValueCollection.PropertyValues)\r\n            {\r\n                Expression left = LambdaExpression.Property(parameterExpression, kvp.Key);\r\n                object castedValue = ValueTypeConverter.Convert(kvp.Value, kvp.Key.PropertyType);\r\n                Expression right = Expression.Constant(castedValue);\r\n\r\n                Expression filter = Expression.Equal(left, right);\r\n\r\n                if (currentExpression == null)\r\n                {\r\n                    currentExpression = filter;\r\n                }\r\n                else\r\n                {\r\n                    currentExpression = Expression.And(currentExpression, filter);\r\n                }\r\n            }\r\n\r\n            return currentExpression;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region WillUpdateSucceed methods (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static bool WillUpdateSucceed(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return data.TryValidateForeignKeyIntegrity();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool WillUpdateSucceed(IEnumerable<IData> datas)\r\n        {\r\n            if (null == datas) throw new ArgumentNullException(\"datas\");\r\n\r\n            foreach (IData data in datas)\r\n            {\r\n                if (data == null) throw new ArgumentException(\"datas may not contain nulls\");\r\n\r\n                if (data.TryValidateForeignKeyIntegrity() == false) return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region Update methods\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void Update(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            Verify.ArgumentCondition(data.DataSourceId != null, \"data\", \"DataSourceId isn't defined\");\r\n            Verify.ArgumentCondition(data.DataSourceId.ProviderName != null, \"data\", \r\n                \"Data provider isn't defined. Use method AddNew() for instances created with BuildNew()\");\r\n\r\n            Update(new[] { data });\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void Update(IData data, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation)\r\n        {\r\n            if (null == data) throw new ArgumentNullException(\"data\");\r\n\r\n            Update(new[] { data }, suppressEventing, performForeignKeyIntegrityCheck, performeValidation);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void Update(IEnumerable<IData> dataset)\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            _dataFacade.Update(dataset, false, true, true);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void Update(IEnumerable<IData> dataset, bool suppressEventing, bool performForeignKeyIntegrityCheck)\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            _dataFacade.Update(dataset, suppressEventing, performForeignKeyIntegrityCheck, true);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void Update(IEnumerable<IData> dataset, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation)\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            _dataFacade.Update(dataset, suppressEventing, performForeignKeyIntegrityCheck, performeValidation);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region BuildNew methods (Only helpers)\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static T BuildNew<T>()\r\n            where T : class, IData\r\n        {\r\n            return BuildNew<T>(false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static T BuildNew<T>(bool suppressEventing)\r\n            where T : class, IData\r\n        {\r\n            return _dataFacade.BuildNew<T>(suppressEventing);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IData BuildNew(Type interfaceType)\r\n        {\r\n            return BuildNew(interfaceType, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IData BuildNew(Type interfaceType, bool suppressEventling)\r\n        {\r\n            return _dataFacade.BuildNew(interfaceType, suppressEventling);\r\n        }\r\n\r\n\r\n\r\n        \r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region WillAddNewSucceed (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static bool WillAddNewSucceed(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return data.TryValidateForeignKeyIntegrity();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool WillAddNewSucceed<T>(T data)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return data.TryValidateForeignKeyIntegrity();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool WillAddNewSucceed<T>(IEnumerable<T> datas)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            foreach (T data in datas)\r\n            {\r\n                if (data == null) throw new ArgumentException(\"datas may not contain nulls\");\r\n\r\n                if (data.TryValidateForeignKeyIntegrity() == false) return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region AddNew methods\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static T AddNew<T>(T data)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            List<T> result = AddNew<T>(new T[] { data }, true, false, true, true, null);\r\n\r\n            return result[0];\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static T AddNew<T>(T data, string providerName)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n\r\n            List<T> result = AddNew<T>(new T[] { data }, true, false, true, true, new List<string> { providerName });\r\n\r\n            return result[0];\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static List<T> AddNew<T>(IEnumerable<T> datas)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            return AddNew<T>(datas, true, false, true, true, null);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static List<T> AddNew<T>(IEnumerable<T> datas, string providerName)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n\r\n            return AddNew<T>(datas, true, false, true, true, new List<string> { providerName });\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can \r\n        /// cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>\r\n        /// <returns></returns>\r\n        public static T AddNew<T>(T data, bool performForeignKeyIntegrityCheck)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            List<T> result = AddNew<T>(new T[] { data }, true, false, performForeignKeyIntegrityCheck, true, null);\r\n\r\n            return result[0];\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can \r\n        /// cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>\r\n        /// <returns></returns>\r\n        public static T AddNew<T>(T data, bool suppressEventing, bool performForeignKeyIntegrityCheck)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            List<T> result = AddNew<T>(new T[] { data }, true, suppressEventing, performForeignKeyIntegrityCheck, true, null);\r\n\r\n            return result[0];\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can \r\n        /// cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"performeValidation\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>\r\n        /// <returns></returns>\r\n        public static T AddNew<T>(T data, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            List<T> result = AddNew<T>(new T[] { data }, true, suppressEventing, performForeignKeyIntegrityCheck, performeValidation, null);\r\n\r\n            return result[0];\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static IData AddNew(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            MethodInfo methodInfo = GetAddNewMethodInfo(data.DataSourceId.InterfaceType);\r\n\r\n            IData resultData = (IData)methodInfo.Invoke(null, new object[] { data, true, false, true, true, null });\r\n\r\n            return resultData;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <returns></returns>\r\n        public static IData AddNew(IData data, bool suppressEventing, bool performForeignKeyIntegrityCheck, string providerName)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            MethodInfo methodInfo = GetAddNewMethodInfo(data.DataSourceId.InterfaceType);\r\n\r\n            IData resultData = (IData)methodInfo.Invoke(null, new object[] { data, true, suppressEventing, performForeignKeyIntegrityCheck, true, new List<string> { providerName } });\r\n\r\n            return resultData;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <returns></returns>\r\n        public static IData AddNew(IData data, Type interfaceType, bool suppressEventing, bool performForeignKeyIntegrityCheck, string providerName)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            MethodInfo methodInfo = GetAddNewMethodInfo(interfaceType);\r\n\r\n            IData resultData = (IData)methodInfo.Invoke(null, new object[] { data, true, suppressEventing, performForeignKeyIntegrityCheck, true, new List<string> { providerName } });\r\n\r\n            return resultData;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>        \r\n        /// <param name=\"performeValidation\"></param>\r\n        /// <returns></returns>\r\n        public static IData AddNew(IData data, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            MethodInfo methodInfo = GetAddNewMethodInfo(data.DataSourceId.InterfaceType);\r\n\r\n            IData resultData = (IData)methodInfo.Invoke(null, new object[] { data, true, suppressEventing, performForeignKeyIntegrityCheck, performeValidation, null });\r\n\r\n            return resultData;\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>        \r\n        /// <param name=\"performeValidation\"></param>\r\n        /// <returns></returns>\r\n        public static IData AddNew(IData data, Type interfaceType, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            MethodInfo methodInfo = GetAddNewMethodInfo(interfaceType);\r\n\r\n            IData resultData = (IData)methodInfo.Invoke(null, new object[] { data, true, suppressEventing, performForeignKeyIntegrityCheck, performeValidation, null });\r\n\r\n            return resultData;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>\r\n        /// <param name=\"performeValidation\"></param>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <returns></returns>\r\n        public static IData AddNew(IData data, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation, string providerName)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            MethodInfo methodInfo = GetAddNewMethodInfo(data.DataSourceId.InterfaceType);\r\n\r\n            IData resultData = (IData)methodInfo.Invoke(null, new object[] { data, true, suppressEventing, performForeignKeyIntegrityCheck, performeValidation, new List<string> { providerName } });\r\n\r\n            return resultData;\r\n        }\r\n\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// WARNING: Setting <paramref name=\"performForeignKeyIntegrityCheck\"/> to 'false' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>\r\n        /// <returns></returns>\r\n        public static IData AddNew(IData data, bool performForeignKeyIntegrityCheck)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            MethodInfo methodInfo = GetAddNewMethodInfo(data.DataSourceId.InterfaceType);\r\n\r\n            IData resultData = (IData)methodInfo.Invoke(null, new object[] { data, true, false, performForeignKeyIntegrityCheck, true, null });\r\n\r\n            return resultData;\r\n        }\r\n\r\n\r\n\r\n        private static T AddNew<T>(T data, bool allowStoreCreation, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation, List<string> writeableProviders)\r\n            where T : class, IData\r\n        {\r\n            List<T> result = _dataFacade.AddNew<T>(new T[] { data }, allowStoreCreation, suppressEventing, performForeignKeyIntegrityCheck, performeValidation, writeableProviders);\r\n\r\n            return result[0];\r\n        }\r\n\r\n\r\n\r\n        private static List<T> AddNew<T>(IEnumerable<T> collection, bool allowStoreCreation, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation, List<string> writeableProviders)\r\n            where T : class, IData\r\n        {\r\n            return _dataFacade.AddNew<T>(collection, allowStoreCreation, suppressEventing, performForeignKeyIntegrityCheck, performeValidation, writeableProviders);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region WillDeleteSucceed methods (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static bool WillDeleteSucceed<T>(T data)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return data.TryValidateDeleteSuccess();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool WillDeleteSucceed(IEnumerable<IData> datas)\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            return WillDeleteSucceed<IData>(datas);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool WillDeleteSucceed(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return data.TryValidateDeleteSuccess();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool WillDeleteSucceed<T>(IEnumerable<T> dataset)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            foreach (T data in dataset)\r\n            {\r\n                Verify.ArgumentCondition(data != null, \"dataset\", \"The dataset may not contain null values\");\r\n\r\n                if (!data.TryValidateDeleteSuccess())\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region Delete methods\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void Delete<T>(T data)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            Delete<T>(new T[] { data }, false, CascadeDeleteType.Allow, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"referencesFromAllScopes\">\r\n        /// If this is true then cascade delete is performed on all data scopes.\r\n        /// If this is false then cascade delete is only performed in the same scope as <paramref name=\"data\"/>\r\n        /// </param>\r\n        public static void Delete<T>(T data, bool referencesFromAllScopes)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            Delete<T>(new T[] { data }, false, CascadeDeleteType.Allow, referencesFromAllScopes);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"datas\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"referencesFromAllScopes\">\r\n        /// If this is true then cascade delete is performed on all data scopes.\r\n        /// If this is false then cascade delete is only performed in the same scope as <paramref name=\"datas\"/>\r\n        /// </param>\r\n        public static void Delete<T>(IEnumerable<T> datas, bool suppressEventing, bool referencesFromAllScopes)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            Delete<T>(datas, suppressEventing, CascadeDeleteType.Allow, referencesFromAllScopes);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void Delete<T>(IEnumerable<T> datas)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            Delete<T>(datas, false, CascadeDeleteType.Allow, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// Deletes the given datas. WARNING: Setting <paramref name=\"cascadeDeleteType\"/> \r\n        /// to 'Disable' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"datas\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"cascadeDeleteType\"></param>\r\n        public static void Delete<T>(IEnumerable<T> datas, bool suppressEventing, CascadeDeleteType cascadeDeleteType)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            Delete<T>(datas, suppressEventing, cascadeDeleteType, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// Deletes the given datas. WARNING: Setting <paramref name=\"cascadeDeleteType\"/> \r\n        /// to 'Disable' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"datas\"></param>\r\n        /// <param name=\"cascadeDeleteType\"></param>\r\n        public static void Delete<T>(IEnumerable<T> datas, CascadeDeleteType cascadeDeleteType)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            Delete<T>(datas, false, cascadeDeleteType, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void Delete<T>(Expression<Func<T, bool>> predicate)\r\n            where T : class, IData\r\n        {\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IEnumerable<T> datasToDelete = DataFacade.GetData<T>(predicate, false);\r\n\r\n                Delete<T>(datasToDelete, false, CascadeDeleteType.Allow, true);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void Delete(IEnumerable<IData> datas)\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            Delete<IData>(datas, false, CascadeDeleteType.Allow, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// Deletes the given datas. WARNING: Setting <paramref name=\"cascadeDeleteType\"/> \r\n        /// to 'Disable' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"cascadeDeleteType\"></param>\r\n        public static void Delete(IData data, CascadeDeleteType cascadeDeleteType)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            Delete<IData>(new IData[] { data }, false, cascadeDeleteType, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// Deletes the given datas. WARNING: Setting <paramref name=\"cascadeDeleteType\"/> \r\n        /// to 'Disable' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"datas\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"cascadeDeleteType\"></param>\r\n        public static void Delete(IEnumerable<IData> datas, bool suppressEventing, CascadeDeleteType cascadeDeleteType)\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            Delete<IData>(datas, suppressEventing, cascadeDeleteType, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// Deletes the given datas. WARNING: Setting <paramref name=\"cascadeDeleteType\"/> \r\n        /// to 'Disable' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"datas\"></param>\r\n        /// <param name=\"cascadeDeleteType\"></param>\r\n        public static void Delete(IEnumerable<IData> datas, CascadeDeleteType cascadeDeleteType)\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            Delete<IData>(datas, false, cascadeDeleteType, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// Deletes the given datas. WARNING: Setting <paramref name=\"cascadeDeleteType\"/> \r\n        /// to 'Disable' can cause serious foreign key corruption.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"cascadeDeleteType\"></param>\r\n        public static void Delete<T>(T data, bool suppressEventing, CascadeDeleteType cascadeDeleteType)\r\n          where T : class, IData\r\n        {\r\n            if (null == data) throw new ArgumentNullException(\"data\");\r\n\r\n            Delete<T>(new T[] { data }, suppressEventing, cascadeDeleteType, true);\r\n        }\r\n\r\n\r\n\r\n        private static void Delete<T>(IEnumerable<T> datas, bool suppressEventing, CascadeDeleteType cascadeDeleteType, bool referencesFromAllScopes)\r\n            where T : class, IData\r\n        {\r\n            _dataFacade.Delete<T>(datas, suppressEventing, cascadeDeleteType, referencesFromAllScopes);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n        #region ValidatePath methods\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static bool ValidatePath<TFile>(TFile file, string providerName)\r\n            where TFile : IFile\r\n        {\r\n            string errorMessage;\r\n\r\n            return ValidatePath(file, providerName, out errorMessage);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool ValidatePath<TFile>(TFile file, string providerName, out string errorMessage) \r\n            where TFile : IFile\r\n        {\r\n            return _dataFacade.ValidatePath(file, providerName, out errorMessage);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n        #region GetDataProviderNames method (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetDataProviderNames()\r\n        {\r\n            return DataProviderRegistry.DataProviderNames;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetDynamicDataProviderNames()\r\n        {\r\n            return DataProviderRegistry.DynamicDataProviderNames;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region GetInterfaces methods (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static List<Type> GetAllInterfaces()\r\n        {\r\n            return DataProviderRegistry.AllInterfaces.ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<Type> GetAllInterfaces(UserType relevantToUserType)\r\n        {\r\n            return (from dataInterface in DataProviderRegistry.AllInterfaces\r\n                    where dataInterface.GetCustomInterfaceAttributes<RelevantToUserTypeAttribute>().Any(a => (a.UserType & relevantToUserType) == relevantToUserType)\r\n                    select dataInterface).ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<Type> GetAllKnownInterfaces()\r\n        {\r\n            return DataProviderRegistry.AllKnownInterfaces.ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<Type> GetAllKnownInterfaces(UserType relevantToUserType)\r\n        {\r\n            return (from dataInterface in DataProviderRegistry.AllKnownInterfaces\r\n                    where dataInterface.GetCustomInterfaceAttributes<RelevantToUserTypeAttribute>().Any(a => (a.UserType & relevantToUserType) == relevantToUserType)\r\n                    select dataInterface).ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<Type> GetGeneratedInterfaces()\r\n        {\r\n            return DataProviderRegistry.GeneratedInterfaces.ToList();\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region DataTag methods (Only helpers)\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void SetDataTag(IData data, string id, object value)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(\"id\");\r\n\r\n            SetDataTag(data.DataSourceId, id, value);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetDataTag(DataSourceId dataSourceId, string id, object value)\r\n        {\r\n            if (dataSourceId == null) throw new ArgumentNullException(\"dataSourceId\");\r\n            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(\"id\");\r\n\r\n            dataSourceId.SetTag(id, value);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static bool TryGetDataTag<T>(IData data, string id, out T tag)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(\"id\");\r\n\r\n            return TryGetDataTag<T>(data.DataSourceId, id, out tag);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetDataTag<T>(DataSourceId dataSourceId, string id, out T tag)\r\n        {\r\n            if (dataSourceId == null) throw new ArgumentNullException(\"dataSourceId\");\r\n            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(\"id\");\r\n\r\n            object tagValue = null;\r\n            bool result = dataSourceId.TryGetTag(id, out tagValue);\r\n\r\n            if (result)\r\n            {\r\n                tag = (T)tagValue;\r\n            }\r\n            else\r\n            {\r\n                tag = default(T);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static T GetDataTag<T>(IData data, string id)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(\"id\");\r\n\r\n            return GetDataTag<T>(data.DataSourceId, id);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static T GetDataTag<T>(DataSourceId dataSourceId, string id)\r\n        {\r\n            if (dataSourceId == null) throw new ArgumentNullException(\"dataSourceId\");\r\n            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(\"id\");\r\n\r\n            object value;\r\n            if (dataSourceId.TryGetTag(id, out value) == false)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"The tag '{0}' has not been set on the data source id\", id));\r\n            }\r\n\r\n            return (T)value;\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void RemoveDataTag(IData data, string id)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(\"id\");\r\n\r\n            RemoveDataTag(data.DataSourceId, id);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveDataTag(DataSourceId dataSourceId, string id)\r\n        {\r\n            if (dataSourceId == null) throw new ArgumentNullException(\"dataSourceId\");\r\n            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(\"id\");\r\n\r\n            dataSourceId.RemoveTag(id);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region Mics methods (Only helpers)\r\n\r\n        /// <exclude />\r\n        internal static void ForEachDataScope(Type interfaceType, ThreadStart action) \r\n        {\r\n            IEnumerable<DataScopeIdentifier> supportedDataScopes = interfaceType.GetSupportedDataScopes();\r\n\r\n            CultureInfo[] cultures = DataLocalizationFacade.IsLocalized(interfaceType)\r\n                                         ? DataLocalizationFacade.ActiveLocalizationCultures.ToArray()\r\n                                         : new[] { DataLocalizationFacade.DefaultLocalizationCulture };\r\n\r\n            foreach (DataScopeIdentifier dataScopeIdentifier in supportedDataScopes)\r\n            {\r\n                foreach (CultureInfo culture in cultures)\r\n                {\r\n                    using (new DataScope(dataScopeIdentifier, culture))\r\n                    {\r\n                        action();\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<DataScopeIdentifier> GetSupportedDataScopes(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            IReadOnlyCollection<DataScopeIdentifier> supportedDataScope = interfaceType.GetSupportedDataScopes();\r\n\r\n            if (supportedDataScope.Count == 0)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"The data type '{0}' does not support any data scopes, use the '{1}' attribute\", interfaceType, typeof(DataScopeAttribute)));\r\n            }\r\n\r\n            return supportedDataScope;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool HasDataInAnyScope(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            foreach (var dataScopeIdentifier in GetSupportedDataScopes(interfaceType))\r\n            {\r\n                using (new DataScope(dataScopeIdentifier))\r\n                {\r\n                    IData data = GetData(interfaceType).ToDataEnumerable().FirstOrDefault();\r\n\r\n                    if (data != null)\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool ExistsInAnyLocale<T>(IEnumerable<CultureInfo> excludedCultureInfoes)\r\n            where T : class, IData\r\n        {\r\n            return _dataFacade.ExistsInAnyLocale<T>(excludedCultureInfoes);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static bool ExistsInAnyLocale<T>(CultureInfo excludedCultureInfo)\r\n            where T : class, IData\r\n        {\r\n            return ExistsInAnyLocale<T>(new CultureInfo[] { excludedCultureInfo });\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static bool ExistsInAnyLocale<T>()\r\n            where T : class, IData\r\n        {\r\n            return ExistsInAnyLocale<T>(Enumerable.Empty<CultureInfo>());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool ExistsInAnyLocale(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            MethodInfo methodInfo = GetExistsInAnyLocaleMethodInfo(interfaceType);\r\n\r\n            bool result = (bool)methodInfo.Invoke(null, null);\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static bool ExistsInAnyLocale(Type interfaceType, CultureInfo excludedCultureInfo)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            MethodInfo methodInfo = GetExistsInAnyLocaleWithParamMethodInfo(interfaceType);\r\n\r\n            bool result = (bool)methodInfo.Invoke(null, new object[] { new CultureInfo[] { excludedCultureInfo } });\r\n\r\n            return result;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region GetXXXMethodInfo methods (Only helpers)\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetSetDataInterceptorMethodInfo(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (typeof(IData).IsAssignableFrom(interfaceType) == false) throw new ArgumentException(\"The provided type must implement IData\", \"interfaceType\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.GenericSetDataInterceptorMethodInfo.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    MethodInfo nonGenericMethod = typeof(DataFacade).GetMethod(\r\n                        nameof(SetDataInterceptor),\r\n                        BindingFlags.Static | BindingFlags.Public,\r\n                        null,\r\n                        new Type[] { typeof(DataInterceptor) },\r\n                        null);\r\n\r\n                    methodInfo = nonGenericMethod.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericSetDataInterceptorMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetHasDataInterceptorMethodInfo(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) throw new ArgumentException(\"The provided type must implement IData\", \"interfaceType\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.GenericHasDataInterceptorMethodInfo.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    MethodInfo nonGenericMethod = typeof(DataFacade).GetMethod(\r\n                        nameof(HasDataInterceptor),\r\n                        BindingFlags.Static | BindingFlags.Public,\r\n                        null,\r\n                        new Type[] { },\r\n                        null);\r\n\r\n                    methodInfo = nonGenericMethod.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericHasDataInterceptorMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetClearDataInterceptorMethodInfo(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) throw new ArgumentException(\"The provided type must implement IData\", \"interfaceType\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.GenericClearDataInterceptorMethodInfo.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    MethodInfo nonGenericMethod = typeof(DataFacade).GetMethod(\r\n                        nameof(ClearDataInterceptor),\r\n                        BindingFlags.Static | BindingFlags.Public,\r\n                        null,\r\n                        new Type[] { },\r\n                        null);\r\n\r\n                    methodInfo = nonGenericMethod.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericClearDataInterceptorMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetGetDataMethodInfo(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) throw new ArgumentException(\"The provided type must implement IData\", \"interfaceType\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.GenericGetDataFromTypeMethodInfo.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    MethodInfo nonGenericMethod = typeof(DataFacade).GetMethod(\r\n                        nameof(GetData),\r\n                        BindingFlags.Static | BindingFlags.Public,\r\n                        null,\r\n                        new[] { typeof(bool), typeof(IEnumerable<string>) },\r\n                        null);\r\n\r\n                    methodInfo = nonGenericMethod.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericGetDataFromTypeMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetGetDataFromDataSourceIdMethodInfo(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) throw new ArgumentException(\"The provided type must implement IData\", \"interfaceType\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.GenericGetDataFromDataSourceIdMethodInfo.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    MethodInfo nonGenericMethod =\r\n                        (from m in typeof(DataFacade).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                         where m.Name == nameof(GetDataFromDataSourceId) &&\r\n                               m.IsGenericMethodDefinition &&\r\n                               m.GetParameters().Length == 2\r\n                         select m).Single();\r\n\r\n                    methodInfo = nonGenericMethod.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericGetDataFromDataSourceIdMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetGetDataWithPredicatMethodInfo(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) throw new ArgumentException(\"The provided type must implement IData\", \"interfaceType\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.GenericGetDataFromTypeWithPredicateMethodInfo.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    MethodInfo genericMethod =\r\n                        (from m in typeof(DataFacade).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                         where m.Name == nameof(GetData) &&\r\n                               m.IsGenericMethodDefinition &&\r\n                               m.GetParameters().Length == 1 &&\r\n                               m.GetParameters()[0].ParameterType.IsGenericType &&\r\n                               m.GetParameters()[0].ParameterType.GetGenericTypeDefinition() == typeof(Expression<>)\r\n                         select m).Single();\r\n\r\n                    methodInfo = genericMethod.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericGetDataFromTypeWithPredicateMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetAddNewMethodInfo(Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n            Verify.ArgumentCondition(typeof(IData).IsAssignableFrom(interfaceType), \"interfaceType\", \"The provided type must implement IData\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (!_resourceLocker.Resources.GenericAddNewFromTypeMethodInfo.TryGetValue(interfaceType, out methodInfo))\r\n                {\r\n                    MethodInfo genericMethodInfo = StaticReflection.GetGenericMethodInfo(data => AddNew((IData) null, true, true, true, true, null));\r\n\r\n                    methodInfo = genericMethodInfo.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericAddNewFromTypeMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetExistsInAnyLocaleMethodInfo(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (typeof(IData).IsAssignableFrom(interfaceType) == false) throw new ArgumentException(\"The provided type must implement IData\", \"interfaceType\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.GenericExistsInAnyLocaleMethodInfo.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    methodInfo =\r\n                        (from method in typeof(DataFacade).GetMethods(BindingFlags.Static | BindingFlags.NonPublic)\r\n                         where method.Name == nameof(ExistsInAnyLocale) &&\r\n                               typeof(IEnumerable).IsAssignableFrom(method.GetParameters()[0].ParameterType) == false\r\n                         select method).First();\r\n\r\n                    methodInfo = methodInfo.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericExistsInAnyLocaleMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static MethodInfo GetExistsInAnyLocaleWithParamMethodInfo(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) throw new ArgumentException(\"The provided type must implement IData\", \"interfaceType\");\r\n\r\n            MethodInfo methodInfo;\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.GenericExistsInAnyLocaleWithParamMethodInfo.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    methodInfo =\r\n                        (from method in typeof(DataFacade).GetMethods(BindingFlags.Static | BindingFlags.Public)\r\n                         where\r\n                            method.Name == nameof(ExistsInAnyLocale) &&\r\n                            method.GetParameters().Length == 1 &&\r\n                            typeof(IEnumerable).IsAssignableFrom(method.GetParameters()[0].ParameterType)\r\n                         select method).First();\r\n\r\n                    methodInfo = methodInfo.MakeGenericMethod(interfaceType);\r\n\r\n                    _resourceLocker.Resources.GenericExistsInAnyLocaleWithParamMethodInfo.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n        private static class EmptyPredicate<T> where T : class\r\n        {\r\n            public static readonly Expression<Func<T, bool>> Instance = f => true;\r\n        }\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Dictionary<Type, MethodInfo> GenericSetDataInterceptorMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericHasDataInterceptorMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericClearDataInterceptorMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericGetDataFromTypeMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericGetDataFromDataSourceIdMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericGetDataFromTypeWithPredicateMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericAddNewFromTypeMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericMoveFromTypeMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericExistsInAnyLocaleMethodInfo { get; set; }\r\n            public Dictionary<Type, MethodInfo> GenericExistsInAnyLocaleWithParamMethodInfo { get; set; }\r\n\r\n\r\n            public static void DoInitializeResources(Resources resources)\r\n            {\r\n                resources.GenericSetDataInterceptorMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericHasDataInterceptorMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericClearDataInterceptorMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericGetDataFromTypeMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericGetDataFromDataSourceIdMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericGetDataFromTypeWithPredicateMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericAddNewFromTypeMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericMoveFromTypeMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericExistsInAnyLocaleMethodInfo = new Dictionary<Type, MethodInfo>();\r\n                resources.GenericExistsInAnyLocaleWithParamMethodInfo = new Dictionary<Type, MethodInfo>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    internal class DataFacadeImpl : IDataFacade\r\n    {\r\n        private static readonly string LogTitle = nameof(DataFacade);\r\n\r\n        internal Dictionary<Type, DataInterceptor> GlobalDataInterceptors = new Dictionary<Type, DataInterceptor>();\r\n\r\n        static readonly Cache<string, IData> _dataBySourceIdCache = new Cache<string, IData>(\"Data by sourceId\", 2000);\r\n        private static readonly object _storeCreationLock = new object();\r\n\r\n        static DataFacadeImpl()\r\n        {\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IData>(OnDataChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<IData>(OnDataChanged, true);\r\n\r\n            DataEventSystemFacade.SubscribeToDataBeforeAdd<ICreationHistory>(SetCreationHistoryInformation, true);\r\n            DataEventSystemFacade.SubscribeToDataBeforeAdd<IChangeHistory>(SetChangeHistoryInformation, true);\r\n            DataEventSystemFacade.SubscribeToDataBeforeUpdate<IChangeHistory>(SetChangeHistoryInformation, true);\r\n        }\r\n\r\n        public IQueryable<T> GetData<T>(bool useCaching, IEnumerable<string> providerNames)\r\n            where T : class, IData\r\n        {\r\n            IQueryable<T> resultQueryable;\r\n\r\n            if (DataProviderRegistry.AllInterfaces.Contains(typeof (T)))\r\n            {\r\n                if (useCaching \r\n                    && providerNames == null\r\n                    && DataCachingFacade.IsDataAccessCacheEnabled(typeof (T)))\r\n                {\r\n                    resultQueryable = DataCachingFacade.GetDataFromCache<T>(\r\n                        () => BuildQueryFromProviders<T>(null));\r\n                }\r\n                else\r\n                {\r\n                    resultQueryable = BuildQueryFromProviders<T>(providerNames);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                DataProviderRegistry.CheckInitializationErrors(typeof(T));\r\n\r\n                if (!typeof(T).GetCustomInterfaceAttributes<AutoUpdatebleAttribute>().Any())\r\n                {\r\n                    throw new ArgumentException($\"The given interface type ({typeof (T)}) is not supported by any data providers\");\r\n                    \r\n                }\r\n\r\n                resultQueryable = new List<T>().AsQueryable();\r\n            }\r\n\r\n            foreach (var dataInterceptor in GetDataInterceptors(typeof(T)))\r\n            {\r\n                try\r\n                {\r\n                    resultQueryable = dataInterceptor.InterceptGetData<T>(resultQueryable);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n\r\n            return resultQueryable;\r\n        }\r\n\r\n\r\n        private IQueryable<T> BuildQueryFromProviders<T>(IEnumerable<string> providerNames) where T : class, IData\r\n        {\r\n            if (providerNames == null)\r\n            {\r\n                providerNames = DataProviderRegistry.GetDataProviderNamesByInterfaceType(typeof(T));\r\n            }\r\n\r\n            var queries = new List<IQueryable<T>>();\r\n            foreach (string providerName in providerNames)\r\n            {\r\n                IQueryable<T> query = DataProviderPluginFacade.GetData<T>(providerName);\r\n\r\n                queries.Add(query);\r\n            }\r\n\r\n            bool resultIsCached = queries.Count == 1 && queries[0] is ICachedQuery;\r\n\r\n            if (resultIsCached)\r\n            {\r\n                return queries[0];\r\n            }\r\n            \r\n            return  new DataFacadeQueryable<T>(queries);\r\n        }\r\n\r\n\r\n        public T GetDataFromDataSourceId<T>(DataSourceId dataSourceId, bool useCaching)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataSourceId, nameof(dataSourceId));\r\n\r\n            useCaching = useCaching && DataCachingFacade.IsTypeCacheable(typeof(T));\r\n\r\n            using (new DataScope(dataSourceId.DataScopeIdentifier, dataSourceId.LocaleScope))\r\n            {\r\n                T resultData = null;\r\n\r\n                string cacheKey = string.Empty;\r\n                if (useCaching)\r\n                {\r\n                    cacheKey = dataSourceId.ToString();\r\n                    resultData = (T)_dataBySourceIdCache.Get(cacheKey);\r\n                }\r\n\r\n                if (resultData == null)\r\n                {\r\n                    resultData = DataProviderPluginFacade.GetData<T>(dataSourceId.ProviderName, dataSourceId.DataId);\r\n\r\n                    if (useCaching && resultData != null && _dataBySourceIdCache.Enabled)\r\n                    {\r\n                        _dataBySourceIdCache.Add(cacheKey, resultData);\r\n                    }\r\n                }\r\n\r\n                if (useCaching && resultData != null)\r\n                {\r\n                    resultData = DataWrappingFacade.Wrap(resultData);\r\n                }\r\n                \r\n                foreach (var dataInterceptor in GetDataInterceptors(typeof(T)))\r\n                {\r\n                    try\r\n                    {\r\n                        resultData = dataInterceptor.InterceptGetDataFromDataSourceId<T>(resultData);\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(LogTitle, ex);\r\n                    }\r\n                }\r\n\r\n                return resultData;\r\n            }\r\n        }\r\n\r\n\r\n        public IEnumerable<DataInterceptor> GetDataInterceptors(Type dataType)\r\n        {\r\n            DataInterceptor globalDataInterceptor = GlobalDataInterceptors\r\n                .FirstOrDefault(kvp => kvp.Key.IsAssignableFrom(dataType)).Value;\r\n\r\n            DataInterceptor threadedDataInterceptor = null;\r\n            var threadData = ThreadDataManager.Current;\r\n            if (threadData != null)\r\n            {\r\n                GetDataInterceptors(threadData).TryGetValue(dataType, out threadedDataInterceptor);\r\n            }\r\n\r\n            if (threadedDataInterceptor == null && globalDataInterceptor == null)\r\n            {\r\n                return Enumerable.Empty<DataInterceptor>();\r\n            }\r\n\r\n            var dataInterceptors = new List<DataInterceptor> { threadedDataInterceptor, globalDataInterceptor };\r\n\r\n            return dataInterceptors.Where(d => d != null);\r\n        } \r\n\r\n\r\n        public void SetDataInterceptor<T>(DataInterceptor dataInterceptor) where T : class, IData\r\n        {\r\n            if (this.DataInterceptors.ContainsKey(typeof(T))) throw new InvalidOperationException(\"A data interceptor has already been set\");\r\n\r\n            this.DataInterceptors.Add(typeof(T), dataInterceptor);\r\n\r\n            Log.LogVerbose(LogTitle, $\"Data interception added to the data type '{typeof (T)}' with interceptor type '{dataInterceptor.GetType()}'\");\r\n        }\r\n\r\n\r\n\r\n        public bool HasDataInterceptor<T>() where T : class, IData\r\n        {\r\n            return this.DataInterceptors.ContainsKey(typeof(T));\r\n        }\r\n\r\n\r\n\r\n        public void ClearDataInterceptor<T>() where T : class, IData\r\n        {\r\n            if (this.DataInterceptors.ContainsKey(typeof(T)))\r\n            {\r\n                this.DataInterceptors.Remove(typeof(T));\r\n\r\n                Log.LogVerbose(LogTitle, $\"Data interception cleared for the data type '{typeof (T)}'\");\r\n            }\r\n        }\r\n\r\n        public void SetGlobalDataInterceptor<T>(DataInterceptor dataInterceptor) where T : class, IData\r\n        {\r\n            if (GlobalDataInterceptors.ContainsKey(typeof(T))) throw new InvalidOperationException(\"A data interceptor has already been set\");\r\n\r\n            GlobalDataInterceptors.Add(typeof(T), dataInterceptor);\r\n\r\n            Log.LogVerbose(LogTitle,\r\n                $\"Global Data interception added to the data type '{typeof (T)}' with interceptor type '{dataInterceptor.GetType()}'\");\r\n        }\r\n\r\n        public bool HasGlobalDataInterceptor<T>() where T : class, IData\r\n        {\r\n            return GlobalDataInterceptors.ContainsKey(typeof(T));\r\n        }\r\n\r\n\r\n\r\n        public void ClearGlobalDataInterceptor<T>() where T : class, IData\r\n        {\r\n            if (GlobalDataInterceptors.ContainsKey(typeof(T)))\r\n            {\r\n                GlobalDataInterceptors.Remove(typeof(T));\r\n\r\n                Log.LogVerbose(LogTitle, $\"Global Data interception cleared for the data type '{typeof (T)}'\");\r\n            }\r\n        }\r\n\r\n        private Dictionary<Type, DataInterceptor> GetDataInterceptors(ThreadDataManagerData threadData)\r\n        {\r\n            Verify.ArgumentNotNull(threadData, nameof(threadData));\r\n            const string threadDataKey = \"DataFacade:DataInterceptors\";\r\n\r\n            var dataInterceptors = threadData.GetValue(threadDataKey) as Dictionary<Type, DataInterceptor>;\r\n\r\n            if (dataInterceptors == null)\r\n            {\r\n                dataInterceptors = new Dictionary<Type, DataInterceptor>();\r\n                threadData.SetValue(threadDataKey, dataInterceptors);\r\n            }\r\n\r\n            return dataInterceptors;\r\n        }\r\n\r\n        private Dictionary<Type, DataInterceptor> DataInterceptors \r\n            => GetDataInterceptors(ThreadDataManager.Current);\r\n\r\n\r\n        public void Update(IEnumerable<IData> dataset, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performValidation)\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            var sortedDataset = dataset.ToDataProviderAndInterfaceTypeSortedDictionary();\r\n\r\n            if (!suppressEventing)\r\n            {\r\n                foreach (IData data in dataset)\r\n                {\r\n                    DataEventSystemFacade.FireDataBeforeUpdateEvent(data.DataSourceId.InterfaceType, data);\r\n                }\r\n            }\r\n\r\n\r\n            foreach (IData data in dataset)\r\n            {\r\n                if (performValidation)\r\n                {\r\n                    CheckValidationResult(ValidationFacade.Validate(data), data.DataSourceId.InterfaceType);\r\n                }\r\n\r\n                if (performForeignKeyIntegrityCheck)\r\n                {\r\n                    data.ValidateForeignKeyIntegrity();\r\n                }\r\n            }\r\n\r\n\r\n            foreach (KeyValuePair<string, Dictionary<Type, List<IData>>> providerPair in sortedDataset)\r\n            {\r\n                foreach (KeyValuePair<Type, List<IData>> interfaceTypePair in providerPair.Value)\r\n                {\r\n                    List<IData> dataToUpdate = interfaceTypePair.Value;\r\n\r\n                    if (DataCachingFacade.IsTypeCacheable(interfaceTypePair.Key))\r\n                    {\r\n                        var newDataToUpdate = new List<IData>();\r\n\r\n                        foreach (IData d in interfaceTypePair.Value)\r\n                        {\r\n                            newDataToUpdate.Add(DataWrappingFacade.UnWrap(d));\r\n                        }\r\n\r\n                        dataToUpdate = newDataToUpdate;\r\n                    }\r\n\r\n                    DataProviderPluginFacade.Update(providerPair.Key, dataToUpdate);\r\n\r\n                    if (DataCachingFacade.IsTypeCacheable(interfaceTypePair.Key))\r\n                    {\r\n                        DataCachingFacade.UpdateCachedData(dataToUpdate);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            if (!suppressEventing)\r\n            {\r\n                foreach (IData data in dataset)\r\n                {\r\n                    DataEventSystemFacade.FireDataAfterUpdateEvent(data.DataSourceId.InterfaceType, data);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private List<string> GetWritableDataProviders(Type type)\r\n        {\r\n            var dataProviders = DataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(type);\r\n            if (dataProviders.Count > 1 && dataProviders.Contains(DataProviderRegistry.DefaultDynamicTypeDataProviderName))\r\n            {\r\n                dataProviders = new List<string> { DataProviderRegistry.DefaultDynamicTypeDataProviderName };\r\n            }\r\n\r\n            return dataProviders;\r\n        }\r\n\r\n        public List<T> AddNew<T>(IEnumerable<T> datas, bool allowStoreCreation, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performValidation, List<string> writeableProviders)\r\n            where T : class, IData\r\n        {\r\n            if (writeableProviders == null)\r\n            {\r\n                writeableProviders = GetWritableDataProviders(typeof (T));\r\n            }\r\n\r\n            if (writeableProviders.Count == 0\r\n                && typeof(T).GetCustomInterfaceAttributes<AutoUpdatebleAttribute>().Any()\r\n                && allowStoreCreation)\r\n            {\r\n                if (!DataTypeTypesManager.IsAllowedDataTypeAssembly(typeof(T)))\r\n                {\r\n                    string message = $\"The data interface '{typeof(T)}' is not located in an assembly in the website Bin folder. Please move it to that location\";\r\n                    Log.LogError(LogTitle, message);\r\n                    throw new InvalidOperationException(message);\r\n                }\r\n\r\n                lock (_storeCreationLock)\r\n                {\r\n                    writeableProviders = GetWritableDataProviders(typeof (T));\r\n\r\n                    if (writeableProviders.Count == 0)\r\n                    {\r\n                        Log.LogVerbose(LogTitle, $\"Type data interface '{typeof(T)}' is marked auto updateble and is not supported by any providers. Adding it to the default dynamic type data provider\");\r\n\r\n                        DynamicTypeManager.EnsureCreateStore(typeof(T));\r\n\r\n                        return AddNew<T>(datas, false, suppressEventing, performForeignKeyIntegrityCheck, performValidation, null);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (writeableProviders.Count == 1)\r\n            {\r\n                return AddNew_AddingMethod<T>(writeableProviders[0], datas, suppressEventing, performForeignKeyIntegrityCheck, performValidation);\r\n            }\r\n\r\n            throw new InvalidOperationException($\"{writeableProviders.Count} writeable data providers exists for data '{typeof(T)}'.\");\r\n        }\r\n        \r\n\r\n\r\n\r\n        private static List<T> AddNew_AddingMethod<T>(string providerName, IEnumerable<T> dataset, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performValidation)\r\n             where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n            Verify.ArgumentCondition(!dataset.Contains(null), \"dataset\", \"The enumeration may not contain null values\");\r\n\r\n\r\n            List<string> writeableProviders = DataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(typeof(T));\r\n            if (!writeableProviders.Contains(providerName))\r\n            {\r\n                Log.LogVerbose(LogTitle, $\"Type data interface '{typeof(T)}' is marked auto updateable and is not supported by the provider '{providerName}', adding it\");\r\n\r\n                DynamicTypeManager.EnsureCreateStore(typeof(T), providerName);\r\n            }\r\n\r\n            writeableProviders = DataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(typeof(T));\r\n            if (!writeableProviders.Contains(providerName))\r\n            {\r\n                throw new InvalidOperationException($\"The writeable data providers '{providerName}' does not support the interface '{typeof(T)}'.\");\r\n            }\r\n\r\n\r\n            foreach (T data in dataset)\r\n            {\r\n                if (performValidation)\r\n                {\r\n                    CheckValidationResult(ValidationFacade.Validate<T>(data), typeof (T));\r\n                }\r\n\r\n                if (performForeignKeyIntegrityCheck)\r\n                {\r\n                    data.ValidateForeignKeyIntegrity();\r\n                }\r\n            }\r\n\r\n\r\n            if (!suppressEventing)\r\n            {\r\n                foreach (T data in dataset)\r\n                {\r\n                    DataEventSystemFacade.FireDataBeforeAddEvent<T>(data);\r\n                }\r\n            }\r\n\r\n            List<T> addedDataset = DataProviderPluginFacade.AddNew<T>(providerName, dataset);\r\n\r\n            DataCachingFacade.AddDataToCache(addedDataset);\r\n\r\n            if (!suppressEventing)\r\n            {\r\n                foreach (T data in addedDataset)\r\n                {\r\n                    DataEventSystemFacade.FireDataAfterAddEvent<T>(data);\r\n                }\r\n            }\r\n\r\n\r\n            return addedDataset;\r\n        }\r\n\r\n\r\n        public void Delete<T>(IEnumerable<T> dataset, bool suppressEventing, CascadeDeleteType cascadeDeleteType, bool referencesFromAllScopes)\r\n            where T : class, IData\r\n        {\r\n            Delete(dataset, suppressEventing, cascadeDeleteType, referencesFromAllScopes, new HashSet<DataSourceId>());\r\n        }\r\n\r\n\r\n\r\n        private void Delete<T>(IEnumerable<T> dataset, bool suppressEventing, CascadeDeleteType cascadeDeleteType, bool referencesFromAllScopes, HashSet<DataSourceId> dataPendingDeletion)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataset, nameof(dataset));\r\n\r\n            dataset = dataset.Evaluate();\r\n\r\n            foreach(var data in dataset)\r\n            {\r\n                var dataSourceId = data.DataSourceId;\r\n                if(!dataPendingDeletion.Contains(dataSourceId))\r\n                {\r\n                    dataPendingDeletion.Add(dataSourceId);\r\n                }\r\n            }\r\n\r\n            if (cascadeDeleteType != CascadeDeleteType.Disable)\r\n            {\r\n                foreach (IData data in dataset)\r\n                {\r\n                    Verify.ArgumentCondition(data != null, nameof(dataset), \"dataset may not contain nulls\");\r\n\r\n                    Type interfaceType = data.DataSourceId.InterfaceType;\r\n\r\n                    // Not deleting references if the data is versioned and not all of the \r\n                    // versions of the element are to be deleted\r\n                    if (data is IVersioned && interfaceType.GetKeyProperties().Count == 1)\r\n                    {\r\n                        var key = data.GetUniqueKey();\r\n                        var versions = DataFacade.TryGetDataVersionsByUniqueKey(interfaceType, key).ToList();\r\n\r\n                        if (versions.Count > 1 \r\n                            && (dataset.Count() < versions.Count\r\n                                || !versions.All(v => dataPendingDeletion.Contains(v.DataSourceId))))\r\n                        {\r\n                            continue;\r\n                        }\r\n                    }\r\n\r\n                    using (new DataScope(data.DataSourceId.DataScopeIdentifier))\r\n                    {\r\n                        var allReferences = DataReferenceFacade.GetRefereesInt(data, referencesFromAllScopes, (a, b) => true);\r\n\r\n                        if (allReferences.Count == 0) continue;\r\n\r\n                        Verify.IsTrue(cascadeDeleteType != CascadeDeleteType.Disallow, \"One of the given datas is referenced by one or more datas\");\r\n\r\n                        var optionalReferences = allReferences.Where(kvp => kvp.Item2.IsOptionalReference);\r\n                        var notOptionalReferences = allReferences.Where(kvp => !kvp.Item2.IsOptionalReference \r\n                            && !dataPendingDeletion.Contains(kvp.Item1.DataSourceId)).Evaluate();\r\n\r\n                        foreach (var reference in optionalReferences)\r\n                        {\r\n                            var referee = reference.Item1;\r\n                            reference.Item2.SourcePropertyInfo.SetValue(referee, null, null);\r\n                            DataFacade.Update(referee, false, true, false);\r\n                        }\r\n\r\n                        foreach (var refereeInfo in notOptionalReferences)\r\n                        {\r\n                            if (!refereeInfo.Item2.AllowCascadeDeletes)\r\n                            {\r\n                                throw new InvalidOperationException(\"One of the given data items is referenced by one or more data items that do not allow cascade delete.\");\r\n                            }\r\n                        }\r\n\r\n                        var toDelete = notOptionalReferences.Select(_ => _.Item1);\r\n                        Delete<IData>(toDelete, suppressEventing, cascadeDeleteType, referencesFromAllScopes);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            Dictionary<string, Dictionary<Type, List<IData>>> sortedDatas = dataset.ToDataProviderAndInterfaceTypeSortedDictionary();\r\n\r\n            foreach (KeyValuePair<string, Dictionary<Type, List<IData>>> providerPair in sortedDatas)\r\n            {\r\n                foreach (KeyValuePair<Type, List<IData>> interfaceTypePair in providerPair.Value)\r\n                {\r\n                    DataProviderPluginFacade.Delete(providerPair.Key, interfaceTypePair.Value.Select(d => d.DataSourceId));\r\n\r\n                    if (DataCachingFacade.IsTypeCacheable(interfaceTypePair.Key))\r\n                    {\r\n                        DataCachingFacade.RemoveDataFromCache(interfaceTypePair.Value);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            if (!suppressEventing)\r\n            {\r\n                foreach (IData element in dataset)\r\n                {\r\n                    DataEventSystemFacade.FireDataDeletedEvent(element.DataSourceId.InterfaceType, element);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public T BuildNew<T>(bool suppressEventing)\r\n            where T : class, IData\r\n        {\r\n            ValidateBuildNewType(typeof(T));\r\n\r\n            Type generatedType = DataTypeTypesManager.GetDataTypeEmptyClass(typeof(T));            \r\n\r\n            IData data = (IData)Activator.CreateInstance(generatedType, new object[] { });\r\n\r\n            SetNewInstanceFieldDefaultValues(data);\r\n\r\n            if (suppressEventing == false)\r\n            {\r\n                DataEventSystemFacade.FireDataAfterBuildNewEvent<T>(data);\r\n            }\r\n\r\n            return (T)data;\r\n        }\r\n\r\n\r\n\r\n        public IData BuildNew(Type interfaceType, bool suppressEventling)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            ValidateBuildNewType(interfaceType);\r\n\r\n            Type generatedType = DataTypeTypesManager.GetDataTypeEmptyClass(interfaceType);\r\n\r\n            IData data = (IData)Activator.CreateInstance(generatedType, new object[] { });\r\n\r\n            SetNewInstanceFieldDefaultValues(data);\r\n\r\n            if (!suppressEventling)\r\n            {\r\n                DataEventSystemFacade.FireDataAfterBuildNewEvent(generatedType, data);\r\n            }\r\n\r\n            return data;\r\n        }\r\n\r\n\r\n\r\n        private void ValidateBuildNewType(Type interfaceType)\r\n        {\r\n            string errorMessage;\r\n\r\n            if(!DataTypeValidationRegistry.Validate(interfaceType, null, out errorMessage))\r\n            {\r\n                Log.LogCritical(LogTitle, errorMessage);\r\n                throw new InvalidOperationException(errorMessage);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void SetNewInstanceFieldDefaultValues(IData data)\r\n        {\r\n            Type interfaceType = data.DataSourceId.InterfaceType;\r\n            List<PropertyInfo> properties = interfaceType.GetPropertiesRecursively();\r\n            foreach (PropertyInfo propertyInfo in properties)\r\n            {\r\n                try\r\n                {\r\n                    var attribute = propertyInfo.GetCustomAttributesRecursively<NewInstanceDefaultFieldValueAttribute>().SingleOrDefault();\r\n                    if (attribute == null || !attribute.HasValue) continue;\r\n                    if (!propertyInfo.CanWrite)\r\n                    {\r\n                        Log.LogError(LogTitle, string.Format(\"The property '{0}' on the interface '{1}' has defined a standard value, but no setter\", propertyInfo.Name, interfaceType));\r\n                        continue;\r\n                    }\r\n\r\n                    object value = attribute.GetValue();\r\n                    value = ValueTypeConverter.Convert(value, propertyInfo.PropertyType);\r\n\r\n                    PropertyInfo targetPropertyInfo = data.GetType().GetProperties().Single(f => f.Name == propertyInfo.Name);\r\n                    targetPropertyInfo.SetValue(data, value, null);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, string.Format(\"Failed to set the standard value on the property '{0}' on the interface '{1}'\", propertyInfo.Name, interfaceType));\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public bool ExistsInAnyLocale<T>(IEnumerable<CultureInfo> excludedCultureInfoes)\r\n            where T : class, IData\r\n        {\r\n            foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures.Except(excludedCultureInfoes))\r\n            {\r\n                using (new DataScope(cultureInfo))\r\n                {\r\n                    bool exists = DataFacade.GetData<T>().Any();\r\n                    if (exists)\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        public bool ValidatePath<TFile>(TFile file, string providerName, out string errorMessage) \r\n            where TFile : IFile\r\n        {\r\n            return DataProviderPluginFacade.ValidatePath<TFile>(file, providerName, out errorMessage);\r\n        }\r\n\r\n\r\n        private static void CheckValidationResult(ValidationResults validationResults, Type interfaceType)\r\n        {\r\n            if (validationResults.IsValid)\r\n            {\r\n                return;\r\n            }\r\n\r\n            System.Text.StringBuilder sb = new System.Text.StringBuilder();\r\n\r\n            foreach (ValidationResult result in validationResults)\r\n            {\r\n                sb.AppendLine(\"Field: '{0}' Error: {1}\".FormatWith(result.Key, result.Message));\r\n            }\r\n\r\n            string msg = \"The data of type '{0}' did not validate, with the following errors:\\r\\n{1}\".FormatWith(interfaceType, sb);\r\n            throw new InvalidOperationException(msg);\r\n        }\r\n\r\n\r\n        private static void OnDataChanged(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            _dataBySourceIdCache.Remove(dataEventArgs.Data.DataSourceId.ToString());\r\n        }\r\n\r\n\r\n\r\n        private static void SetChangeHistoryInformation(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            IChangeHistory data = dataEventArgs.Data as IChangeHistory;\r\n            if (data != null)\r\n            {\r\n                data.ChangeDate = DateTime.Now;\r\n\r\n                try\r\n                {\r\n                    if (UserValidationFacade.IsLoggedIn())\r\n                    {\r\n                        data.ChangedBy = UserValidationFacade.GetUsername();\r\n                    }\r\n                }\r\n                catch\r\n                {\r\n                    // silent\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void SetCreationHistoryInformation(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            ICreationHistory data = dataEventArgs.Data as ICreationHistory;\r\n            if (data != null)\r\n            {\r\n                if (data.CreationDate == DateTime.MinValue)\r\n                {\r\n                    data.CreationDate = DateTime.Now;\r\n                }\r\n\r\n                try\r\n                {\r\n                    if (string.IsNullOrEmpty(data.CreatedBy) && UserValidationFacade.IsLoggedIn())\r\n                    {\r\n                        data.CreatedBy = UserValidationFacade.GetUsername();\r\n                    }\r\n                }\r\n                catch\r\n                {\r\n                    // silent\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataIconFacade.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\n\r\nnamespace Composite.Data\r\n{\r\n    internal static class DataIconFacade\r\n    {\r\n        public static ResourceHandle DataIcon = GetIconHandle(\"data\");\r\n        public static ResourceHandle DataDraftIcon { get { return GetIconHandle(\"data-draft\"); } }\r\n        public static ResourceHandle DataAwaitingApprovalIcon { get { return GetIconHandle(\"data-awaiting-approval\"); } }\r\n        public static ResourceHandle DataAwaitingPublicationIcon { get { return GetIconHandle(\"data-awaiting-publication\"); } }\r\n        public static ResourceHandle DataPublishedIcon { get { return GetIconHandle(\"data-published\"); } }\r\n        public static ResourceHandle DataGhostedIcon { get { return GetIconHandle(\"data-ghosted\"); } }\r\n        public static ResourceHandle DataDisabledIcon { get { return GetIconHandle(\"data-disabled\"); } }\r\n        \r\n\r\n\r\n        public static ResourceHandle GetIcon(this IData data)\r\n        {\r\n            IPublishControlled publishControlled = data as IPublishControlled;\r\n\r\n            if (publishControlled == null)\r\n            {\r\n                return DataIcon;\r\n            }\r\n\r\n            switch (publishControlled.PublicationStatus)\r\n            {\r\n                case GenericPublishProcessController.Draft:\r\n                    return DataDraftIcon;\r\n\r\n                case GenericPublishProcessController.AwaitingApproval:\r\n                    return DataAwaitingApprovalIcon;\r\n\r\n                case GenericPublishProcessController.AwaitingPublication:\r\n                    return DataAwaitingPublicationIcon;\r\n\r\n                case GenericPublishProcessController.Published:\r\n                    return DataPublishedIcon;\r\n\r\n                default:\r\n                    var allowedPublicationStatuses = new[] {\r\n                        GenericPublishProcessController.Draft, \r\n                        GenericPublishProcessController.AwaitingApproval,\r\n                        GenericPublishProcessController.AwaitingPublication, \r\n                        GenericPublishProcessController.Published \r\n                    };\r\n\r\n                    string allowedValues = string.Join(\", \", allowedPublicationStatuses.Select(status => \"'\" + status + \"'\"));\r\n\r\n                    throw new InvalidOperationException(\"Unexpected publication status '{0}'. Allowed values: {1}\"\r\n                                                         .FormatWith(publishControlled.PublicationStatus ?? \"(null)\", allowedValues));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static ResourceHandle GetForeignIcon(this IData data)\r\n        {\r\n            return data.IsTranslatable() ? DataGhostedIcon : DataDisabledIcon;\r\n        }\r\n\r\n\r\n        [Obsolete(\"Use !data.IsTranslatable() instead\")]\r\n        public static bool IsLocaleDisabled(this IData data)\r\n        {\r\n            return !IsTranslatable(data);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Checks whether the specified data item can be translated.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsTranslatable(this IData data)\r\n        {\r\n            IPublishControlled publishControlled = data as IPublishControlled;\r\n\r\n            if (!GlobalSettingsFacade.OnlyTranslateWhenApproved || publishControlled == null)\r\n            {\r\n                return true;\r\n            }\r\n            \r\n            switch (publishControlled.PublicationStatus)\r\n            {\r\n                case GenericPublishProcessController.Draft:\r\n                case GenericPublishProcessController.AwaitingApproval:\r\n                    using (new DataScope(data.DataSourceId.LocaleScope))\r\n                    {\r\n                        return DataFacade.GetDataFromOtherScope(data, DataScopeIdentifier.Public).Any();\r\n                    }\r\n\r\n                case GenericPublishProcessController.AwaitingPublication:\r\n                case GenericPublishProcessController.Published:\r\n                    return true;\r\n\r\n                default:\r\n                    throw new InvalidOperationException(\"Unexpected publication status: \" + (publishControlled.PublicationStatus ?? \"(null)\"));\r\n            }\r\n            \r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns the data item either from \"Administrated\" or from \"Public\" scope depending on, which has to be used as translation source.\r\n        /// If onlyTranslateWhenApproved=\"true\" or publication status is not \"awaiting publishion\" - item from the public scope will be returned.\r\n        /// </summary>\r\n        /// <param name=\"dataFromAdministratedScope\">The data item</param>\r\n        /// <returns></returns>\r\n        public static T GetTranslationSource<T>(this T dataFromAdministratedScope) where T: class, IData\r\n        {\r\n            IPublishControlled publishControlled = dataFromAdministratedScope as IPublishControlled;\r\n\r\n            if (!GlobalSettingsFacade.OnlyTranslateWhenApproved \r\n                || publishControlled == null \r\n                || publishControlled.PublicationStatus == GenericPublishProcessController.AwaitingPublication)\r\n            {\r\n                return dataFromAdministratedScope;\r\n            }\r\n\r\n            using (new DataScope(dataFromAdministratedScope.DataSourceId.LocaleScope))\r\n            {\r\n                return (DataFacade.GetDataFromOtherScope(dataFromAdministratedScope as IData, DataScopeIdentifier.Public)\r\n                                  .FirstOrDefault()\r\n                        ?? dataFromAdministratedScope) as T;\r\n            }\r\n        }\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataIdKeyFacade.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DataIdKeyFacade\r\n    {\r\n        private static IDataIdKeyFacade _implementation = new DataIdKeyFacadeImpl();\r\n\r\n        /// <exclude />\r\n        static DataIdKeyFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n              \r\n        // Overload\r\n        /// <exclude />\r\n        public static T GetKeyValue<T>(this DataSourceId dataSourceId, string keyName = null)\r\n        {\r\n            if (keyName == null)\r\n            {\r\n                keyName = dataSourceId.InterfaceType.GetSingleKeyProperty().Name;\r\n            }\r\n\r\n            return (T)_implementation.GetKeyValue(dataSourceId.DataId, keyName);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static T GetKeyValue<T>(IDataId dataId, string keyName = null)\r\n        {\r\n            return (T)_implementation.GetKeyValue(dataId, keyName);\r\n        }\r\n\r\n\r\n       \r\n        // Overload\r\n        /// <exclude />\r\n        public static object GetKeyValue(this DataSourceId dataSourceId, string keyName = null)\r\n        {\r\n            Verify.ArgumentNotNull(dataSourceId, nameof(dataSourceId));\r\n\r\n            if (keyName == null)\r\n            {\r\n                keyName = dataSourceId.InterfaceType.GetSingleKeyProperty().Name;\r\n            }\r\n\r\n            return _implementation.GetKeyValue(dataSourceId.DataId, keyName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static object GetKeyValue(IDataId dataId, string keyName = null)\r\n        {\r\n            return _implementation.GetKeyValue(dataId, keyName);\r\n        }\r\n\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static string GetDefaultKeyName(IDataId dataId)\r\n        {\r\n            return _implementation.GetDefaultKeyName(dataId.GetType());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetDefaultKeyName(Type dataIdType)\r\n        {\r\n            return _implementation.GetDefaultKeyName(dataIdType);\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataIdKeyFacadeImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    internal class DataIdKeyFacadeImpl : IDataIdKeyFacade\r\n    {\r\n        private ConcurrentDictionary<Type, string> _defaultKeyNameCache = new ConcurrentDictionary<Type, string>();\r\n        private ConcurrentDictionary<Type, PropertyInfo> _keyPropertyInfoCache = new ConcurrentDictionary<Type, PropertyInfo>();\r\n\r\n\r\n\r\n        public object GetKeyValue(IDataId dataId, string keyName)\r\n        {\r\n            if (keyName == null)\r\n            {\r\n                keyName = this.GetDefaultKeyName(dataId.GetType());\r\n                if (keyName == null) throw new InvalidOperationException(\"Could not find default key for the type: \" + dataId.GetType());\r\n            }\r\n\r\n\r\n            Func<Type, PropertyInfo> valueFactory = f => f.GetProperty(keyName);\r\n\r\n            PropertyInfo keyPropertyInfo = _keyPropertyInfoCache.GetOrAdd(dataId.GetType(), valueFactory);\r\n\r\n            object keyValue = keyPropertyInfo.GetValue(dataId, null);\r\n\r\n            return keyValue;\r\n        }\r\n\r\n\r\n\r\n        public string GetDefaultKeyName(Type dataIdType)\r\n        {\r\n            Func<Type, string> valueFactory = f =>\r\n            {\r\n                PropertyInfo[] propertyInfoes = f.GetProperties();\r\n\r\n                if (propertyInfoes.Length != 1) return null;\r\n\r\n                return propertyInfoes[0].Name;\r\n            };\r\n\r\n            string defaultKeyName = _defaultKeyNameCache.GetOrAdd(dataIdType, valueFactory);\r\n\r\n            return defaultKeyName;\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _defaultKeyNameCache = new ConcurrentDictionary<Type, string>();\r\n            _keyPropertyInfoCache = new ConcurrentDictionary<Type, PropertyInfo>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataIdSerializer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing static Composite.Core.Serialization.StringConversionServices;\r\n\r\nnamespace Composite.Data\r\n{\r\n\tinternal static class DataIdSerializer\r\n\t{\r\n        public static string Serialize(this IDataId dataId, IEnumerable<string> propertyNames)\r\n        {\r\n            if (dataId == null) throw new ArgumentNullException(nameof(dataId));\r\n\r\n            return CompositeJsonSerializer.SerializePartial(dataId,propertyNames);\r\n        }\r\n\r\n        public static IDataId Deserialize(string serializedId, string serializedVersionId)\r\n        {\r\n            var serializedIdIsJson = CompositeJsonSerializer.IsJsonSerialized(serializedId);\r\n            var serializedVersionIdIsJson = CompositeJsonSerializer.IsJsonSerialized(serializedVersionId);\r\n\r\n            if (serializedIdIsJson)\r\n            {\r\n                if (string.IsNullOrWhiteSpace(serializedVersionId))\r\n                    return CompositeJsonSerializer.Deserialize<IDataId>(serializedId);\r\n\r\n                if (serializedVersionIdIsJson)\r\n                    return CompositeJsonSerializer.Deserialize<IDataId>(serializedId, serializedVersionId);\r\n            }\r\n            else if (!serializedVersionIdIsJson)\r\n            {\r\n                return DeserializeLegacy(serializedId, serializedVersionId);\r\n            }\r\n\r\n            throw new ArgumentException($\"{nameof(IDataId)} is not serialized properly.\", nameof(serializedId) + \" and \" + nameof(serializedVersionId));\r\n        }\r\n\r\n        public static IDataId DeserializeLegacy(string serializedId, string serializedVersionId)\r\n\t    {\r\n\t        Dictionary<string, string> dataIdValues = ParseKeyValueCollection(serializedId);\r\n\r\n\t        if (!dataIdValues.ContainsKey(\"_dataIdType_\") ||\r\n\t            !dataIdValues.ContainsKey(\"_dataId_\"))\r\n\t        {\r\n\t            throw new ArgumentException(\"The serializedId is not a serialized id\", nameof(serializedId));\r\n\t        }\r\n\r\n\t        string dataIdType = DeserializeValueString(dataIdValues[\"_dataIdType_\"]);\r\n\t        string serializedIdString = DeserializeValueString(dataIdValues[\"_dataId_\"]);\r\n\r\n\t        string serializedVersionIdString = \"\";\r\n\r\n\t        if (!string.IsNullOrEmpty(serializedVersionId))\r\n\t        {\r\n\t            Dictionary<string, string> versionValues = ParseKeyValueCollection(serializedVersionId);\r\n\r\n\t            if (!versionValues.ContainsKey(\"_dataIdType_\") ||\r\n\t                !versionValues.ContainsKey(\"_dataId_\"))\r\n\t            {\r\n\t                throw new ArgumentException(\"The serializedVersionId is not a serialized version id\", nameof(serializedVersionId));\r\n\t            }\r\n\r\n\t            if (dataIdValues[\"_dataIdType_\"] != versionValues[\"_dataIdType_\"])\r\n\t            {\r\n\t                throw new ArgumentException(\"Serialized id and version id have different types\", nameof(serializedId));\r\n\t            }\r\n\r\n\t            serializedVersionIdString = DeserializeValueString(versionValues[\"_dataId_\"]);\r\n\t        }\r\n\r\n\t        Type type = TypeManager.TryGetType(dataIdType);\r\n\t        if (type == null)\r\n\t        {\r\n\t            throw new InvalidOperationException($\"The type {dataIdType} could not be found\");\r\n\t        }\r\n\r\n\t        IDataId dataId = SerializationFacade.Deserialize<IDataId>(type, string.Join(\"\", serializedIdString, serializedVersionIdString));\r\n\r\n\t        return dataId;\r\n\t    }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataInterceptor.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Let you transform queries before data providers. Enable you to augment queries from alternate sources.\r\n    /// </summary>\r\n    public abstract class DataInterceptor\r\n    {\r\n        /// <summary>\r\n        /// Let you transform queries before data providers. Enable you to augment queries from alternate sources.\r\n        /// </summary>\r\n        public virtual IQueryable<T> InterceptGetData<T>(IQueryable<T> dataset)\r\n            where T : class, IData\r\n        {\r\n            return dataset;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Let you transform an in-memory result-set. \r\n        /// This transformation should behave exactly as the IQueryable equivalent.\r\n        /// </summary>\r\n        public virtual IEnumerable<T> InterceptGetData<T>(IEnumerable<T> dataset)\r\n            where T : class, IData\r\n        {\r\n            return InterceptGetData(dataset.AsQueryable());\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Enable you to intercept queries for a single data item.\r\n        /// </summary>\r\n        public virtual T InterceptGetDataFromDataSourceId<T>(T data)\r\n            where T : class, IData\r\n        {\r\n            return data;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataKeyPropertyCollection.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataKeyPropertyCollection\r\n    {\r\n        private readonly Dictionary<string, object> _keyProperties = new Dictionary<string, object>();\r\n\r\n\r\n        /// <exclude />\r\n        public void AddKeyProperty(PropertyInfo propertyInfo, object value)\r\n        {\r\n            if (propertyInfo == null) throw new ArgumentNullException(\"propertyInfo\");\r\n            if (value == null) throw new ArgumentNullException(\"value\");\r\n\r\n            AddKeyProperty(propertyInfo.Name, value);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddKeyProperty(string keyPropertyName, object value)\r\n        {\r\n            if (keyPropertyName == null) throw new ArgumentNullException(\"keyPropertyName\");\r\n            if (value == null) throw new ArgumentNullException(\"value\");\r\n\r\n            if (_keyProperties.ContainsKey(keyPropertyName)) throw new ArgumentException(string.Format(\"The key property name '{0}' has already been added\", keyPropertyName));\r\n\r\n            _keyProperties.Add(keyPropertyName, value);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool TryGetKeyValue(string keyPropertyName, out object value)\r\n        {\r\n            return _keyProperties.TryGetValue(keyPropertyName, out value);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<KeyValuePair<string, object>> KeyProperties\r\n        {\r\n            get \r\n            { \r\n                return _keyProperties;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public int Count\r\n        {\r\n            get\r\n            {\r\n                return _keyProperties.Count;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as DataKeyPropertyCollection);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(DataKeyPropertyCollection dataKeyPropertyCollection)\r\n        {\r\n            if (dataKeyPropertyCollection == null || dataKeyPropertyCollection.Count != Count) return false;\r\n\r\n            foreach (var kvp in this.KeyProperties)\r\n            {\r\n                object value;\r\n                if (!dataKeyPropertyCollection.TryGetKeyValue(kvp.Key, out value)\r\n                    || !kvp.Value.Equals(value))\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            int hashCode = 0;\r\n            foreach (var kvp in _keyProperties)\r\n            {\r\n\r\n                hashCode ^= kvp.Key.GetHashCode();\r\n                hashCode ^= kvp.Value.GetHashCode();\r\n            }\r\n\r\n            return hashCode;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            var sb = new StringBuilder();\r\n\r\n            foreach (var kvp in _keyProperties)\r\n            {\r\n                if (sb.Length > 0) sb.Append(\", \");\r\n\r\n                sb.AppendFormat(\"{0} = '{1}'\", kvp.Key, kvp.Value);\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataKeyPropertyCollectionExtensionMethods.cs",
    "content": "﻿using System.Reflection;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n\tinternal static class DataKeyPropertyCollectionExtensionMethods\r\n\t{\r\n        public static DataKeyPropertyCollection CreateDataKeyPropertyCollection(this IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            var dataKeyPropertyCollection = new DataKeyPropertyCollection();\r\n\r\n            foreach (PropertyInfo propertyInfo in data.GetKeyProperties())\r\n            {\r\n                object value = propertyInfo.GetValue(data, null);\r\n\r\n                dataKeyPropertyCollection.AddKeyProperty(propertyInfo, value);\r\n            }\r\n\r\n            return dataKeyPropertyCollection;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataLocalizationFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.ProcessControlled;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DataLocalizationFacade\r\n    {\r\n        private static IDataLocalizationFacade _dataLocalizationFacade = new DataLocalizationFacadeImpl();\r\n\r\n\r\n        internal static IDataLocalizationFacade Implementation { get { return _dataLocalizationFacade; } set { _dataLocalizationFacade = value; } }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool UseLocalization \r\n        {\r\n            get\r\n            {\r\n                return _dataLocalizationFacade.UseLocalization;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<CultureInfo> WhiteListedLocales\r\n        {\r\n            get\r\n            {\r\n                return _dataLocalizationFacade.WhiteListedLocales;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo DefaultUrlMappingCulture\r\n        {\r\n            get\r\n            {\r\n                return _dataLocalizationFacade.DefaultUrlMappingCulture;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo DefaultLocalizationCulture\r\n        {\r\n            get\r\n            {\r\n                return _dataLocalizationFacade.DefaultLocalizationCulture;\r\n            }\r\n            internal set\r\n            {\r\n                _dataLocalizationFacade.DefaultLocalizationCulture = value;\r\n            }\r\n        }\r\n\r\n\r\n        // Overload to ActiveLocalizationNames\r\n        /// <exclude />\r\n        public static IEnumerable<CultureInfo> ActiveLocalizationCultures\r\n        {\r\n            get\r\n            {\r\n                foreach (string cultureName in _dataLocalizationFacade.ActiveLocalizationNames)\r\n                {\r\n                    yield return CultureInfo.CreateSpecificCulture(cultureName);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> ActiveLocalizationNames\r\n        {\r\n            get\r\n            {\r\n                return _dataLocalizationFacade.ActiveLocalizationNames;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetUrlMappingName(CultureInfo cultureInfo)\r\n        {\r\n            return _dataLocalizationFacade.GetUrlMappingName(cultureInfo);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo GetCultureInfoByUrlMappingName(string urlMappingName)\r\n        {\r\n            return _dataLocalizationFacade.GetCultureInfoByUrlMappingName(urlMappingName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> UrlMappingNames\r\n        {\r\n            get\r\n            {\r\n                return _dataLocalizationFacade.UrlMappingNames;\r\n            }\r\n        }\r\n\r\n\r\n        // Overlaod\r\n        /// <summary>\r\n        /// Tells if a IData is currently localized or not\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsLocalized(this IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n            \r\n            return IsLocalized(data.DataSourceId.InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Tells if a IData is currently localized or not\r\n        /// </summary>\r\n        /// <param name=\"type\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsLocalized(Type type)\r\n        {\r\n            if (type == null) throw new ArgumentNullException(\"type\");\r\n\r\n            return _dataLocalizationFacade.IsLocalized(type);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <summary>\r\n        /// Tells if a type can be localized. Currently is dynamic types and IPage that\r\n        /// can be localized. This does not tell if the given type IS currently localized.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsLocalizable(this IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            return IsLocalizable(data.DataSourceId.InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Tells if a type can be localized. Currently is dynamic types and IPage that\r\n        /// can be localized. This does not tell if the given type IS currently localized.\r\n        /// </summary>\r\n        /// <param name=\"type\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsLocalizable(Type type)\r\n        {\r\n            if (type == null) throw new ArgumentNullException(\"type\");\r\n\r\n            return _dataLocalizationFacade.IsLocalizable(type);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<ReferenceFailingPropertyInfo> GetReferencingLocalizeFailingProperties(ILocalizedControlled data)\r\n        {\r\n            return _dataLocalizationFacade.GetReferencingLocalizeFailingProperties(data);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetCultureTitle(CultureInfo culture)\r\n        {\r\n            return _dataLocalizationFacade.GetCultureTitle(culture);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataLocalizationFacadeImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Threading;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Logging;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    internal class DataLocalizationFacadeImpl : IDataLocalizationFacade\r\n    {\r\n        private static readonly string LogTitle = \"LocalizationFacade\";\r\n\r\n        private static readonly Cache<string, CultureInfo> _urlMappingCache = new Cache<string, CultureInfo>(\"UrlCultureMapping\", 70);\r\n        private static readonly Cache<string, string> _cultureUrlCache = new Cache<string, string>(\"CultureUrlMapping\", 70);\r\n        private static ReadOnlyCollection<string> _urlMappings;\r\n        private static ReadOnlyCollection<string> _activeCultureNames;\r\n        private static ExtendedNullable<CultureInfo> _defaultCulture;\r\n        private static ExtendedNullable<CultureInfo> _defaultUrlMappingCulture;\r\n        private static readonly object _syncRoot = new object();\r\n\r\n        static DataLocalizationFacadeImpl()\r\n        {\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<ISystemActiveLocale>(OnSystemActiveLocaleChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd<ISystemActiveLocale>(OnSystemActiveLocaleChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<ISystemActiveLocale>(OnSystemActiveLocaleChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<ISystemActiveLocale>(OnSystemActiveLocaleStoreChanged, true);\r\n        }\r\n\r\n\r\n        private static void OnSystemActiveLocaleStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                _urlMappingCache.Clear();\r\n                _cultureUrlCache.Clear();\r\n\r\n                lock (_syncRoot)\r\n                {\r\n                    _urlMappings = null;\r\n                    _activeCultureNames = null;\r\n                    _defaultUrlMappingCulture = null;\r\n                    _defaultCulture = null;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnSystemActiveLocaleChanged(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            var locale = dataEventArgs.Data as ISystemActiveLocale;\r\n            \r\n            if (locale != null)\r\n            {\r\n                _urlMappingCache.Remove(locale.UrlMappingName);\r\n                _cultureUrlCache.Remove(locale.CultureName);\r\n\r\n                lock (_syncRoot)\r\n                {\r\n                    _urlMappings = null;\r\n                    _activeCultureNames = null;\r\n                    _defaultUrlMappingCulture = null;\r\n                    _defaultCulture = null;\r\n                }\r\n            }\r\n        }\r\n\r\n        public bool UseLocalization\r\n        {\r\n            get\r\n            {\r\n                return DataFacade.GetData<ISystemActiveLocale>().Count() > 1;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<CultureInfo> WhiteListedLocales\r\n        {\r\n            get\r\n            {\r\n                return CultureInfo.GetCultures(CultureTypes.SpecificCultures);\r\n            }\r\n        }\r\n\r\n\r\n        public CultureInfo DefaultUrlMappingCulture\r\n        {\r\n            get\r\n            {\r\n                ExtendedNullable<CultureInfo> result = _defaultUrlMappingCulture;\r\n\r\n                if (result == null)\r\n                {\r\n                    lock (_syncRoot)\r\n                    {\r\n                        if (_defaultUrlMappingCulture == null)\r\n                        {\r\n                            ISystemActiveLocale systemActiveLocale =\r\n                                (from data in DataFacade.GetData<ISystemActiveLocale>()\r\n                                 where data.UrlMappingName == \"\"\r\n                                 select data).FirstOrDefault();\r\n\r\n                            CultureInfo cultureInfo = systemActiveLocale == null \r\n                                ? null \r\n                                : CultureInfo.CreateSpecificCulture(systemActiveLocale.CultureName);\r\n\r\n                            _defaultUrlMappingCulture = new ExtendedNullable<CultureInfo> {Value = cultureInfo};\r\n                        }\r\n                        result = _defaultUrlMappingCulture;\r\n                    }\r\n                }\r\n                return result.Value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public CultureInfo DefaultLocalizationCulture\r\n        {\r\n            get\r\n            {\r\n                ExtendedNullable<CultureInfo> result = _defaultCulture;\r\n\r\n                if (result == null)\r\n                {\r\n                    lock (_syncRoot)\r\n                    {\r\n                        if (_defaultCulture == null)\r\n                        {\r\n                            List<string> culturesMarkedAsDefault;\r\n\r\n                            using (ThreadDataManager.EnsureInitialize())\r\n                            {\r\n                                culturesMarkedAsDefault =\r\n                                    (from data in DataFacade.GetData<ISystemActiveLocale>()\r\n                                     where data.IsDefault\r\n                                     select data.CultureName).ToList();\r\n                            }\r\n\r\n                            CultureInfo cultureInfo = null;\r\n\r\n                            if (culturesMarkedAsDefault.Count > 0)\r\n                            {\r\n                                if (culturesMarkedAsDefault.Count > 1)\r\n                                {\r\n                                    LoggingService.LogWarning(LogTitle, \"There's more than one culture marked as 'default'\");\r\n                                }\r\n\r\n                                cultureInfo = CultureInfo.CreateSpecificCulture(culturesMarkedAsDefault[0]);\r\n                            }\r\n\r\n                            _defaultCulture = new ExtendedNullable<CultureInfo> { Value = cultureInfo };\r\n                        }\r\n                        result = _defaultCulture;\r\n                    }\r\n                }\r\n                return result.Value;\r\n            }\r\n            set\r\n            {\r\n                Verify.ArgumentNotNull(value, \"value\");\r\n\r\n                string cultureName = value.Name;\r\n\r\n                lock (_syncRoot)\r\n                {\r\n                    using(var transactionScope = Data.Transactions.TransactionsFacade.CreateNewScope())\r\n                    {\r\n                        List<ISystemActiveLocale> systemLocalesMarkedAsDefault =\r\n                        (from data in DataFacade.GetData<ISystemActiveLocale>()\r\n                         where data.IsDefault\r\n                         select data).ToList();\r\n\r\n                        bool alreadyMarkedAsDefault = false;\r\n                        foreach(ISystemActiveLocale locale in systemLocalesMarkedAsDefault)\r\n                        {\r\n                            if(locale.CultureName == cultureName)\r\n                            {\r\n                                alreadyMarkedAsDefault = true;\r\n                                continue;\r\n                            }\r\n\r\n                            locale.IsDefault = false;\r\n                            DataFacade.Update(locale);\r\n                        }\r\n\r\n                        if(!alreadyMarkedAsDefault)\r\n                        {\r\n                            ISystemActiveLocale newDefaultCulture =\r\n                            (from data in DataFacade.GetData<ISystemActiveLocale>()\r\n                             where data.CultureName == cultureName\r\n                             select data).FirstOrDefault();\r\n\r\n                            if (newDefaultCulture == null)\r\n                            {\r\n                                LoggingService.LogError(LogTitle, \"Failed to get a locale by culture name '{0}'\".FormatWith(cultureName));\r\n                                return;\r\n                            }\r\n\r\n                            newDefaultCulture.IsDefault = true;\r\n                            DataFacade.Update(newDefaultCulture);\r\n                        }\r\n                        \r\n                        transactionScope.Complete();\r\n                    }\r\n                }\r\n\r\n                LoggingService.LogVerbose(LogTitle, \"Default localization culture changed to '{0}'\".FormatWith(cultureName));\r\n            }\r\n        }\r\n\r\n        public IEnumerable<string> ActiveLocalizationNames\r\n        {\r\n            get\r\n            {\r\n                ReadOnlyCollection<string> _result = _activeCultureNames;\r\n\r\n                if (_result == null)\r\n                {\r\n                    lock (_syncRoot)\r\n                    {\r\n                        if (_activeCultureNames == null)\r\n                        {\r\n                            _activeCultureNames = new ReadOnlyCollection<string>(\r\n                                (from d in DataFacade.GetData<ISystemActiveLocale>()\r\n                                 select d.CultureName).ToList());\r\n                        }\r\n                        _result = _activeCultureNames;\r\n\r\n                    }\r\n                }\r\n                return _result;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string GetUrlMappingName(CultureInfo cultureInfo)\r\n        {\r\n            string urlMappingName = _cultureUrlCache.Get(cultureInfo.Name);\r\n\r\n            if (urlMappingName == null)\r\n            {\r\n                urlMappingName =\r\n                (from sal in DataFacade.GetData<ISystemActiveLocale>() as IEnumerable<ISystemActiveLocale>\r\n                 where sal.CultureName == cultureInfo.Name\r\n                 select sal.UrlMappingName).SingleOrDefault();\r\n\r\n                _cultureUrlCache.Add(cultureInfo.Name, urlMappingName);\r\n            }\r\n\r\n            return urlMappingName;\r\n        }\r\n\r\n\r\n\r\n        public CultureInfo GetCultureInfoByUrlMappingName(string urlMappingName)\r\n        {\r\n            CultureInfo cultureInfo = _urlMappingCache.Get(urlMappingName);\r\n\r\n            if (cultureInfo == null)\r\n            {\r\n                string cultureName = (from sal in DataFacade.GetData<ISystemActiveLocale>()\r\n                                      where string.Compare(sal.UrlMappingName, urlMappingName, StringComparison.OrdinalIgnoreCase) == 0\r\n                                      select sal.CultureName).Single();\r\n\r\n                cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);\r\n\r\n                _urlMappingCache.Add(urlMappingName, cultureInfo);\r\n            }\r\n\r\n            return cultureInfo;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> UrlMappingNames\r\n        {\r\n            get\r\n            {\r\n                ReadOnlyCollection<string> _result = _urlMappings;\r\n\r\n                if (_result == null)\r\n                {\r\n                    lock (_syncRoot)\r\n                    {\r\n                        if (_urlMappings == null)\r\n                        {\r\n                            List<string> mappings = (from sal in DataFacade.GetData<ISystemActiveLocale>()\r\n                                                     select sal.UrlMappingName).ToList();\r\n\r\n                            // Adding lower cased values\r\n                            for(int i=0; i<mappings.Count; i++)\r\n                            {\r\n                                string loweredValue = mappings[i].ToLowerInvariant();\r\n                                if (mappings[i] != loweredValue)\r\n                                {\r\n                                    mappings.Add(mappings[i].ToLowerInvariant());\r\n                                }\r\n                            }\r\n\r\n                            _urlMappings = new ReadOnlyCollection<string>(mappings);\r\n                        }\r\n                        _result = _urlMappings;\r\n                    }\r\n                }\r\n                return _result;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool IsLocalized(Type type)\r\n        {\r\n            if (type == null) throw new ArgumentNullException(\"type\");\r\n\r\n            if (type == typeof(IPage)) return true;\r\n            if (type == typeof(IPagePlaceholderContent)) return true;\r\n\r\n            return typeof(ILocalizedControlled).IsAssignableFrom(type);\r\n        }\r\n\r\n\r\n\r\n        public bool IsLocalizable(Type type)\r\n        {\r\n            if (type == null) throw new ArgumentNullException(\"type\");\r\n\r\n            if (type == typeof(IPage)) return true;\r\n            if (type == typeof(IPagePlaceholderContent)) return true;\r\n            if (type.IsGenerated()) return true;\r\n\r\n            return typeof(ILocalizedControlled).IsAssignableFrom(type);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<ReferenceFailingPropertyInfo> GetReferencingLocalizeFailingProperties(ILocalizedControlled data)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(data.DataSourceId.InterfaceType);\r\n\r\n            IEnumerable<DataFieldDescriptor> requiredDataFieldDescriptors = dataTypeDescriptor.Fields.Where(f => f.ForeignKeyReferenceTypeName != null);\r\n\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in requiredDataFieldDescriptors)\r\n            {\r\n                Type referencedType = TypeManager.GetType(dataFieldDescriptor.ForeignKeyReferenceTypeName);\r\n                if (!DataLocalizationFacade.IsLocalized(referencedType)) continue; // No special handling for not localized data.\r\n\r\n                IData referencedData = data.GetReferenced(dataFieldDescriptor.Name);\r\n                if (referencedData != null) continue; // Data has already been localized               \r\n\r\n                bool optionalReferenceWithValue = false;\r\n                if (dataFieldDescriptor.IsNullable)\r\n                {\r\n                    PropertyInfo propertyInfo = data.DataSourceId.InterfaceType.GetPropertiesRecursively().Single(f => f.Name == dataFieldDescriptor.Name);\r\n                    object value = propertyInfo.GetValue(data, null);\r\n\r\n                    if (value == null || object.Equals(value, dataFieldDescriptor.DefaultValue))\r\n                    {\r\n                        continue; // Optional reference is null;\r\n                    }\r\n\r\n                    optionalReferenceWithValue = true;\r\n                }\r\n\r\n                CultureInfo locale = data.DataSourceId.LocaleScope;\r\n\r\n                using (new DataScope(locale))\r\n                {\r\n                    referencedData = data.GetReferenced(dataFieldDescriptor.Name);\r\n                }\r\n\r\n                ReferenceFailingPropertyInfo referenceFailingPropertyInfo = new ReferenceFailingPropertyInfo\r\n                (\r\n                    dataFieldDescriptor,\r\n                    referencedType,\r\n                    referencedData,\r\n                    optionalReferenceWithValue\r\n                );\r\n\r\n                yield return referenceFailingPropertyInfo;\r\n            }\r\n        }\r\n\r\n        public string GetCultureTitle(CultureInfo culture)\r\n        {\r\n            return StringResourceSystemFacade.GetCultureTitle(culture);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ReferenceFailingPropertyInfo\r\n    {\r\n        /// <exclude />\r\n        public ReferenceFailingPropertyInfo(DataFieldDescriptor dataFieldDescriptor, Type referencedType, IData originLocaleDataValue, bool optionalReferenceWithValue)\r\n        {\r\n            this.DataFieldDescriptor = dataFieldDescriptor;\r\n            this.ReferencedType = referencedType;\r\n            this.OriginLocaleDataValue = originLocaleDataValue;\r\n            this.OptionalReferenceWithValue = optionalReferenceWithValue;\r\n        }\r\n\r\n        /// <summary>\r\n        /// DataFieldDescriptor of the property that are the reference\r\n        /// </summary>\r\n        public DataFieldDescriptor DataFieldDescriptor { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Data type that are refernced\r\n        /// </summary>\r\n        public Type ReferencedType { get; private set; }\r\n\r\n        /// <summary>\r\n        /// This holds the value of the reference in the same locale\r\n        /// as the IData value given to the call to\r\n        /// GetReferencingLocalizeFailingProperties\r\n        /// This may be null in case of optional references\r\n        /// </summary>\r\n        public IData OriginLocaleDataValue { get; private set; }\r\n\r\n        /// <summary>\r\n        /// This is true if the reference is optional and \r\n        /// if the referenced item is existing in the old locale.\r\n        /// </summary>\r\n        public bool OptionalReferenceWithValue { get; private set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataMetaDataFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class DataMetaDataFacade\r\n    {\r\n        private static readonly string LogTitle = \"DataMetaDataFacade\";\r\n\r\n        private static Dictionary<Guid, DataTypeDescriptor> _dataTypeDescriptorCache;\r\n        private static Dictionary<Guid, string> _dataTypeDescriptorFilesnamesCache;\r\n        private static readonly object _lock = new object();\r\n\r\n        private static readonly string _metaDataPath;\r\n\r\n\r\n\r\n        static DataMetaDataFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n\r\n            _metaDataPath = PathUtil.Resolve(GlobalSettingsFacade.DataMetaDataDirectory);\r\n            if (!C1Directory.Exists(_metaDataPath))\r\n            {\r\n                C1Directory.CreateDirectory(_metaDataPath);\r\n            }\r\n\r\n            UpdateFilenames();\r\n        }\r\n\r\n\r\n\r\n        private static void Initialize()\r\n        {\r\n            if (_dataTypeDescriptorCache != null) return;\r\n\r\n            lock (_lock)\r\n            {\r\n                _dataTypeDescriptorCache = new Dictionary<Guid, DataTypeDescriptor>();\r\n                _dataTypeDescriptorFilesnamesCache = new Dictionary<Guid, string>();\r\n\r\n\r\n                string[] filepaths = C1Directory.GetFiles(_metaDataPath, \"*.xml\");\r\n\r\n                foreach (string filepath in filepaths)\r\n                {\r\n                    var dataTypeDescriptor = LoadFromFile(filepath);\r\n\r\n                    Verify.That(!_dataTypeDescriptorCache.ContainsKey(dataTypeDescriptor.DataTypeId),\r\n                        \"Data type with id '{0}' is already added. File: '{1}'\", dataTypeDescriptor.DataTypeId, filepath);\r\n\r\n                    _dataTypeDescriptorCache.Add(dataTypeDescriptor.DataTypeId, dataTypeDescriptor);\r\n                    _dataTypeDescriptorFilesnamesCache.Add(dataTypeDescriptor.DataTypeId, filepath);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static DataTypeDescriptor LoadFromFile(string filePath)\r\n        {\r\n            XDocument doc;\r\n\r\n            try\r\n            {\r\n                doc = XDocumentUtils.Load(filePath, LoadOptions.SetBaseUri | LoadOptions.SetLineInfo);\r\n            }\r\n            catch (XmlException e)\r\n            {\r\n                throw new ConfigurationErrorsException(\"Error loading meta data file '{0}': {1}\".FormatWith(filePath, e.Message), e, filePath, e.LineNumber);\r\n            }\r\n\r\n            return DataTypeDescriptor.FromXml(doc.Root);\r\n        }\r\n\r\n        private static void UpdateFilenames()\r\n        {\r\n            List<string> filepaths = C1Directory.GetFiles(_metaDataPath, \"*.xml\").ToList();\r\n\r\n            var ids = new Dictionary<Guid, string>();\r\n            foreach (string filepath in filepaths)\r\n            {\r\n                Guid id = GetGuidFromFilename(filepath);\r\n                if (!ids.ContainsKey(id))\r\n                {\r\n                    ids.Add(id, filepath);\r\n                }\r\n                else // This should never happen, but is here to be robust\r\n                {\r\n                    if (!IsMetaDataFileName(Path.GetFileNameWithoutExtension(filepath))) // Old version of the file, delete it\r\n                    {\r\n                        FileUtils.Delete(filepath);\r\n                    }\r\n                    else // Old version is stored in ids, delete it and change the value to new version\r\n                    {\r\n                        FileUtils.Delete(ids[id]);\r\n                        ids[id] = filepath;\r\n                    }\r\n                }\r\n            }\r\n\r\n            foreach (var kvp in ids)\r\n            {\r\n                string filepath = kvp.Value;\r\n                if (!IsMetaDataFileName(Path.GetFileNameWithoutExtension(filepath)))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var dataTypeDescriptor = LoadFromFile(filepath);\r\n                string newFilepath = CreateFilename(dataTypeDescriptor);\r\n\r\n                FileUtils.RemoveReadOnly(filepath);\r\n\r\n                Func<string, string> normalizeFileName = f => f.Replace('_', ' ').ToLowerInvariant();\r\n                if (normalizeFileName(filepath) != normalizeFileName(newFilepath))\r\n                {\r\n                    C1File.Move(filepath, newFilepath);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static bool IsMetaDataFileName(string fileNameWithoutExtension)\r\n        {\r\n            return fileNameWithoutExtension.Contains(\"_\") || fileNameWithoutExtension.Contains(\" \");\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<DataTypeDescriptor> AllDataTypeDescriptors\r\n        {\r\n            get\r\n            {\r\n                Initialize();\r\n\r\n                return _dataTypeDescriptorCache.Values.Evaluate();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<DataTypeDescriptor> GeneratedTypeDataTypeDescriptors\r\n        {\r\n            get\r\n            {\r\n                return AllDataTypeDescriptors.Where(d => d.IsCodeGenerated);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will return the data type descriptor for the given data type id.\r\n        /// If the data type descriptor has not yet been created (file not existing) and\r\n        /// the <paramref name=\"allowTypeMetaDataCreation\"/> is set to true,\r\n        /// this method will try getting it through the <see cref=\"Composite.Data.DynamicTypes.Foundation.ReflectionBasedDescriptorBuilder\"/>\r\n        /// that will try locating the type from the data type id using reflection\r\n        /// going through know assemblies.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeId\">The id of the data type.</param>\r\n        /// <param name=\"allowTypeMetaDataCreation\">\r\n        /// If this is <value>true</value> and the data type descriptor does not exists, the method will try to create it.\r\n        /// </param>\r\n        /// <returns></returns>\r\n        public static DataTypeDescriptor GetDataTypeDescriptor(Guid dataTypeId, bool allowTypeMetaDataCreation = false)\r\n        {\r\n            Initialize();\r\n\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n\r\n            _dataTypeDescriptorCache.TryGetValue(dataTypeId, out dataTypeDescriptor);\r\n\r\n            if (dataTypeDescriptor != null) return dataTypeDescriptor;\r\n\r\n\r\n            if (!allowTypeMetaDataCreation) return null;\r\n\r\n            foreach (Assembly assembly in AssemblyFacade.GetLoadedAssembliesFromBin())\r\n            {\r\n                if (!AssemblyFacade.AssemblyPotentiallyUsesType(assembly, typeof(IData)))\r\n                {\r\n                    // Ignoring assemblies that aren't referencing Composite.dll\r\n                    continue;\r\n                }\r\n\r\n                Type[] types;\r\n                try\r\n                {\r\n                    types = assembly.GetTypes();\r\n                }\r\n                catch(ReflectionTypeLoadException ex)\r\n                {\r\n                    if (assembly == typeof (IData).Assembly)\r\n                    {\r\n                        // It is critical to be able to load types from Composite.dll\r\n                        Log.LogError(LogTitle, ex.LoaderExceptions.FirstOrDefault());\r\n                        throw new InvalidOperationException($\"Failed to load '{typeof(IData).Assembly.FullName}', check log file for the details\", ex);\r\n                    }\r\n                    Log.LogWarning($\"Failed to get types from assembly '{assembly.FullName}'\", ex);\r\n                    continue;\r\n                }\r\n\r\n                foreach (Type type in types)\r\n                {\r\n                    if (type.GetInterfaces().Contains(typeof(IData)))\r\n                    {\r\n                        ImmutableTypeIdAttribute attribute = type.GetCustomAttributes(false).OfType<ImmutableTypeIdAttribute>().SingleOrDefault();\r\n                        if (attribute == null || attribute.ImmutableTypeId != dataTypeId) continue;\r\n\r\n                        DataTypeDescriptor newDataTypeDescriptor = ReflectionBasedDescriptorBuilder.Build(type);\r\n                        PersistMetaData(newDataTypeDescriptor);\r\n\r\n                        return newDataTypeDescriptor;\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            Log.LogError(LogTitle, $\"No data type found with the given data type id '{dataTypeId}'\");\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This method will return the data type descriptor for the given data type id.\r\n        /// If the data type descriptor has not yet been created (file not existing) and\r\n        /// the <paramref name=\"allowTypeMetaDataCreation\"/> is set to true,\r\n        /// this method will try getting it through the <see cref=\"Composite.Data.DynamicTypes.Foundation.ReflectionBasedDescriptorBuilder\"/>\r\n        /// based on <paramref name=\"interfaceType\"/>.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The data type.</param>\r\n        /// <param name=\"allowTypeMetaDataCreation\">\r\n        /// If this is true and the data type descriptor does not exists, it will be created.\r\n        /// </param>\r\n        /// <returns></returns>\r\n        public static DataTypeDescriptor GetDataTypeDescriptor(Type interfaceType, bool allowTypeMetaDataCreation = false)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, nameof(interfaceType));\r\n\r\n            Initialize();\r\n\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n\r\n            Guid dataTypeId = interfaceType.GetImmutableTypeId();\r\n\r\n            _dataTypeDescriptorCache.TryGetValue(dataTypeId, out dataTypeDescriptor);\r\n\r\n            if (dataTypeDescriptor != null) return dataTypeDescriptor;\r\n\r\n            if (!allowTypeMetaDataCreation) return null;\r\n\r\n            var newDataTypeDescriptor = ReflectionBasedDescriptorBuilder.Build(interfaceType);\r\n            PersistMetaData(newDataTypeDescriptor);\r\n\r\n            return newDataTypeDescriptor;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void PersistMetaData(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                Initialize();\r\n\r\n                string filepath = CreateFilename(dataTypeDescriptor);\r\n\r\n                XElement rootElement = dataTypeDescriptor.ToXml();\r\n                XDocument doc = new XDocument(rootElement);\r\n                XDocumentUtils.Save(doc, filepath);\r\n\r\n                _dataTypeDescriptorCache[dataTypeDescriptor.DataTypeId] = dataTypeDescriptor;\r\n\r\n                if ((_dataTypeDescriptorFilesnamesCache.ContainsKey(dataTypeDescriptor.DataTypeId)) &&\r\n                    (_dataTypeDescriptorFilesnamesCache[dataTypeDescriptor.DataTypeId] != filepath))\r\n                {\r\n                    FileUtils.Delete(_dataTypeDescriptorFilesnamesCache[dataTypeDescriptor.DataTypeId]);\r\n                    _dataTypeDescriptorFilesnamesCache[dataTypeDescriptor.DataTypeId] = filepath;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void DeleteMetaData(Guid dataTypeId)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                Initialize();\r\n\r\n                if (_dataTypeDescriptorFilesnamesCache.ContainsKey(dataTypeId))\r\n                {\r\n                    FileUtils.Delete(_dataTypeDescriptorFilesnamesCache[dataTypeId]);\r\n\r\n                    _dataTypeDescriptorCache.Remove(dataTypeId);\r\n                    _dataTypeDescriptorFilesnamesCache.Remove(dataTypeId);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static string CreateFilename(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return Path.Combine(_metaDataPath, string.Format(\"{0} {1}.xml\", dataTypeDescriptor.Name, dataTypeDescriptor.DataTypeId));\r\n        }\r\n\r\n\r\n\r\n        private static Guid GetGuidFromFilename(string filepath)\r\n        {\r\n            string tmp = Path.GetFileNameWithoutExtension(filepath);\r\n            int index = Math.Max(tmp.LastIndexOf('_'), tmp.LastIndexOf(' '));\r\n\r\n            if (index == -1)\r\n            {\r\n                return new Guid(tmp);\r\n            }\r\n\r\n            Guid result;\r\n            string guidStr = tmp.Substring(index + 1);\r\n\r\n            if (!Guid.TryParse(guidStr, out result))\r\n            {\r\n                throw new InvalidOperationException(\"Failed to extract ID from file '{0}'\".FormatWith(filepath));\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Used for processing xml/sql data providers configuration build by C1 vesrion older than 3.0\r\n        /// </summary>\r\n        internal static Dictionary<string, Guid> GetTypeManagerTypeNameToTypeIdMap()\r\n        {\r\n            string metaDataFolderPath = PathUtil.Resolve(GlobalSettingsFacade.DataMetaDataDirectory);\r\n\r\n            List<string> filepaths = C1Directory.GetFiles(metaDataFolderPath, \"*.xml\").ToList();\r\n\r\n            var result = new Dictionary<string, Guid>();\r\n\r\n            foreach (string filepath in filepaths)\r\n            {\r\n                try\r\n                {\r\n                    XDocument doc = XDocumentUtils.Load(filepath);\r\n\r\n                    XAttribute dataTypeIdAttr = doc.Root.Attribute(\"dataTypeId\");\r\n                    XAttribute typeManagerTypeNameAttr = doc.Root.Attribute(\"typeManagerTypeName\");\r\n\r\n                    if (dataTypeIdAttr == null || typeManagerTypeNameAttr == null) continue;\r\n\r\n                    string typeManagerTypeName = typeManagerTypeNameAttr.Value;\r\n                    Guid dataTypeId = new Guid(dataTypeIdAttr.Value);\r\n\r\n                    const string redundantSuffix = \",Composite.Generated\";\r\n                    if (typeManagerTypeName.EndsWith(redundantSuffix, StringComparison.OrdinalIgnoreCase))\r\n                    {\r\n                        typeManagerTypeName = typeManagerTypeName.Substring(0, typeManagerTypeName.Length - redundantSuffix.Length);\r\n                    }\r\n\r\n                    if (!result.ContainsKey(typeManagerTypeName))\r\n                    {\r\n                        result.Add(typeManagerTypeName, dataTypeId);\r\n                    }\r\n\r\n                    if(!typeManagerTypeName.Contains(\",\") && !typeManagerTypeName.StartsWith(\"DynamicType:\"))\r\n                    {\r\n                        string fixedTypeManagerTypeName = \"DynamicType:\" + typeManagerTypeName;\r\n\r\n                        if (!result.ContainsKey(fixedTypeManagerTypeName))\r\n                        {\r\n                            result.Add(fixedTypeManagerTypeName, dataTypeId);\r\n                        }\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogWarning(LogTitle, \"Error while parsing meta data file '{0}'\".FormatWith(filepath));\r\n                    Log.LogWarning(LogTitle, ex);\r\n                }\r\n            }\r\n\r\n            // Backward compatibility for configuraiton files. (Breaking change C1 3.2 -> C1 4.0)\r\n            result[\"Composite.Data.Types.IPageTemplate,Composite\"] = new Guid(\"7b54d7d2-6be6-48a6-9ae1-2e0373073d1d\");\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _dataTypeDescriptorCache = null;\r\n            _dataTypeDescriptorFilesnamesCache = null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataPropertyValueCollection.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class DataPropertyValueCollection\r\n\t{\r\n        private Dictionary<PropertyInfo, object> _propertyValues = new Dictionary<PropertyInfo, object>();\r\n\r\n\r\n        /// <exclude />\r\n        public void AddKeyProperty(PropertyInfo propertyInfo, object value)\r\n        {\r\n            if (propertyInfo == null) throw new ArgumentNullException(\"keyPropertyName\");\r\n            if (value == null) throw new ArgumentNullException(\"value\");\r\n\r\n            if (_propertyValues.ContainsKey(propertyInfo)) throw new ArgumentException(string.Format(\"The key property name '{0}' has already been added\", propertyInfo.Name));\r\n\r\n            _propertyValues.Add(propertyInfo, value);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<KeyValuePair<PropertyInfo, object>> PropertyValues\r\n        {\r\n            get\r\n            {\r\n                foreach (KeyValuePair<PropertyInfo, object> kvp in _propertyValues)\r\n                {\r\n                    yield return kvp;\r\n                }\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataProviderCopier.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Transactions;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Transactions;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Class used for copying data from one data provider to another\r\n    /// </summary>\r\n    public sealed class DataProviderCopier\r\n    {\r\n        private delegate void HandleSpecialTypeDelegate(List<IData> datas, string sourceProviderName, string targetProviderName);\r\n        private static readonly string LogTitle = \"Database copying\";\r\n        private static readonly Dictionary<Type, HandleSpecialTypeDelegate> _specialHandleInterfaces = new Dictionary<Type, HandleSpecialTypeDelegate>();\r\n\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"DataProviderCopier\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"sourceProviderName\">Name of the source data provider.</param>\r\n        /// <param name=\"targetProviderName\">Name of the target data provider.</param>\r\n        public DataProviderCopier(string sourceProviderName, string targetProviderName)\r\n        {\r\n            this.SourceProviderName = sourceProviderName;\r\n            this.TargetProviderName = targetProviderName;\r\n\r\n            UseTransaction = true;\r\n            IgnorePrimaryKeyViolation = true;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the name of the source data provider.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The name of the source data provider.\r\n        /// </value>\r\n        public string SourceProviderName { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the name of the target data provider.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The name of the target data provider.\r\n        /// </value>\r\n        public string TargetProviderName { get; private set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets a value indicating whether transaction should be used.\r\n        /// Disabling transaction may help to ignore transaction timeout limitation which is limited to 20 minutes in machine.config\r\n        /// </summary>\r\n        /// <value>\r\n        ///   <c>true</c> if transaction should be used; otherwise, <c>false</c>.\r\n        /// </value>\r\n        public bool UseTransaction { get; set; }\r\n\r\n        /// <summary>\r\n        /// If set to <c>true</c>, records with already used primary keys will be skipped and the copying process will continue.\r\n        /// </summary>\r\n        /// <value>\r\n        /// \t<c>true</c> if [ignore primary key violation]; otherwise, <c>false</c>.\r\n        /// </value>\r\n        public bool IgnorePrimaryKeyViolation { get; set; }\r\n\r\n        /// <summary>\r\n        /// Copies all the types that the query returns.\r\n        /// </summary>\r\n        public void Copy(IEnumerable<Type> queryToTypes)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (GlobalInitializerFacade.CoreLockScope)\r\n                {\r\n                    TransactionScope transactionScope = null;\r\n                    try\r\n                    {\r\n                        if (UseTransaction)\r\n                        {\r\n                            transactionScope = TransactionsFacade.CreateNewScope(TimeSpan.FromHours(6.0));\r\n                        }\r\n\r\n                        Log.LogVerbose(LogTitle, \"Full copy started\");\r\n\r\n                        IEnumerable<Type> allInterfacesToEnsure = queryToTypes.ToList();\r\n\r\n                        Log.LogVerbose(LogTitle, \"Ensuring interfaces...\");\r\n                        EnsureInterfaces(allInterfacesToEnsure);\r\n\r\n                        Log.LogVerbose(LogTitle, \"Done insuring interfaces!\");\r\n\r\n                        IEnumerable<Type> allInterfaces = queryToTypes.ToList();\r\n\r\n                        List<Type> handleLastInterfaceTypes = new List<Type>();\r\n\r\n                        foreach (Type interfaceType in allInterfaces)\r\n                        {\r\n                            if (_specialHandleInterfaces.ContainsKey(interfaceType) == false)\r\n                            {\r\n                                CopyData(interfaceType);\r\n                            }\r\n                            else\r\n                            {\r\n                                handleLastInterfaceTypes.Add(interfaceType);\r\n                            }\r\n                        }\r\n\r\n                        foreach (Type interfaceType in handleLastInterfaceTypes)\r\n                        {\r\n                            CopyData(interfaceType);\r\n                        }\r\n\r\n                        if (transactionScope != null)\r\n                        {\r\n                            transactionScope.Complete();\r\n                        }\r\n                    }\r\n                    finally\r\n                    {\r\n                        if (transactionScope != null)\r\n                        {\r\n                            transactionScope.Dispose();\r\n                        }\r\n                    }\r\n\r\n                    Log.LogVerbose(LogTitle, \"Full copy done!\");\r\n                }\r\n            }\r\n        }\r\n        /// <summary>\r\n        /// Copies all the data from the source data provider to the target data provider.\r\n        /// </summary>\r\n        public void FullCopy()\r\n        {\r\n            var allTypes =  from type in DataFacade.GetAllInterfaces()\r\n                            where DataProviderRegistry.GetDataProviderNamesByInterfaceType(type).Contains(this.SourceProviderName)\r\n                            select type;\r\n            Copy(allTypes);\r\n        }\r\n\r\n\r\n\r\n        private void EnsureInterfaces(IEnumerable<Type> allInterfaces)\r\n        {\r\n            var dataTypeDescriptors = new List<DataTypeDescriptor>();\r\n\r\n            foreach (Type interfaceType in allInterfaces)\r\n            {\r\n                if (!DataProviderRegistry.GetDataProviderNamesByInterfaceType(interfaceType).Contains(this.TargetProviderName))\r\n                {\r\n                    var dataTypeDescriptor = DynamicTypeManager.BuildNewDataTypeDescriptor(interfaceType);\r\n\r\n                    dataTypeDescriptor.Validate();\r\n\r\n                    dataTypeDescriptors.Add(dataTypeDescriptor);\r\n                }\r\n            }\r\n\r\n            DataProviderPluginFacade.CreateStores(this.TargetProviderName, dataTypeDescriptors);\r\n        }\r\n\r\n\r\n\r\n        private CultureInfo[] GetSupportedCultures(Type interfaceType)\r\n        {\r\n            if (DataLocalizationFacade.IsLocalized(interfaceType))\r\n            {\r\n                return DataLocalizationFacade.ActiveLocalizationCultures.ToArray();\r\n            }\r\n            return new[] { CultureInfo.InvariantCulture };\r\n        }\r\n\r\n\r\n\r\n        private void CopyData(Type interfaceType)\r\n        {\r\n            IWritableDataProvider targetDataProvider = DataProviderPluginFacade.GetDataProvider(TargetProviderName) as IWritableDataProvider;\r\n            Verify.IsNotNull(targetDataProvider, \"Failed to get target data provider, probably it's not writeable.\");\r\n\r\n            foreach (DataScopeIdentifier dataScopeIdentifier in interfaceType.GetSupportedDataScopes())\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Copying scope '{0}' data for type '{1}'\".FormatWith(dataScopeIdentifier.Name, interfaceType.FullName));\r\n\r\n                foreach (CultureInfo cultureInfo in GetSupportedCultures(interfaceType))\r\n                {\r\n                    using (new DataScope(dataScopeIdentifier, cultureInfo))\r\n                    {\r\n                        List<IData> dataset;\r\n                        try\r\n                        {\r\n                            dataset = DataFacade.GetData(interfaceType, SourceProviderName).ToDataList();\r\n\r\n                            if (_specialHandleInterfaces.ContainsKey(interfaceType))\r\n                            {\r\n                                _specialHandleInterfaces[interfaceType](dataset, this.SourceProviderName,\r\n                                                                        this.TargetProviderName);\r\n                            }\r\n                        }\r\n                        catch (Exception)\r\n                        {\r\n                            Log.LogCritical(LogTitle,\"Failed to read data from type '{0}'. See the log for the details.\"\r\n                                                     .FormatWith(interfaceType.FullName));\r\n                            throw;\r\n                        }\r\n\r\n\r\n                        List<IData> filteredDataset = null;\r\n                        HashSet<string> dataIDs = null;\r\n\r\n                        if (IgnorePrimaryKeyViolation)\r\n                        {\r\n                            filteredDataset = new List<IData>();\r\n                            dataIDs = new HashSet<string>();\r\n                        }\r\n\r\n                        foreach (var data in dataset)\r\n                        {\r\n                            if (IgnorePrimaryKeyViolation)\r\n                            {\r\n                                string dataId = data.DataSourceId.ToString();\r\n                                if (dataIDs.Contains(dataId))\r\n                                {\r\n                                    LoggingService.LogWarning(LogTitle, \"Cannot insert a data row, since it's data ID is already used. DataID: '{0}'\".FormatWith(dataId));\r\n                                    continue;\r\n                                }\r\n                                dataIDs.Add(dataId);\r\n\r\n                                filteredDataset.Add(data);\r\n                            }\r\n                            FixData(data);\r\n                        }\r\n\r\n                        if (IgnorePrimaryKeyViolation)\r\n                        {\r\n                            dataIDs = null;\r\n                            dataset = filteredDataset;\r\n                        }\r\n\r\n                        try\r\n                        {\r\n                            AddData(interfaceType, dataset, targetDataProvider);\r\n                        }\r\n                        catch (Exception e)\r\n                        {\r\n                            Log.LogError(LogTitle, $\"Adding failed while adding {interfaceType.Namespace}.{interfaceType.Name} because {e.Message}\");\r\n                            Log.LogError(LogTitle,e.InnerException);\r\n                            throw;\r\n                        }\r\n                    }\r\n\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void AddData(Type type, IEnumerable<IData> dataset, IWritableDataProvider dataProvider)\r\n        {\r\n            // TODO: check if adding in groups of ~1000 records may improve the performance\r\n            MethodInfo genericMethod = StaticReflection.GetGenericMethodInfo((a) => AddData<IData>(null, null)); \r\n            genericMethod.MakeGenericMethod(new[] { type }).Invoke(null, new object[] { dataset, dataProvider });\r\n        }\r\n\r\n        private static void AddData<T>(IEnumerable<IData> dataset, IWritableDataProvider dataProvider) where T : class, IData\r\n        {\r\n            dataProvider.AddNew(dataset.Cast<T>());\r\n        }\r\n\r\n        private static void FixData(IData data)\r\n        {\r\n            if (data is ILocalizedControlled)\r\n            {\r\n                var localizedData = data as ILocalizedControlled;\r\n\r\n                if (localizedData.SourceCultureName == null)\r\n                {\r\n                    localizedData.SourceCultureName = LocalizationScopeManager.CurrentLocalizationScope.Name;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataReference.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Core.Types;\r\nusing System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Represents a reference to a C1 CMS IData item. Unlike <see cref=\"DataReference{T}\"/> this class signals\r\n    /// that a data reference need not be set for this to be in a valid state.\r\n    /// </summary>\r\n    /// <typeparam name=\"T\">The C1 Data Type (<see cref=\"IData\"/>) being referenced</typeparam>\r\n    [DataReferenceConverter]\r\n    public class NullableDataReference<T> : DataReference<T> where T : class, IData\r\n    {\r\n        /// <exclude />\r\n        public NullableDataReference()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public NullableDataReference(object keyValue)\r\n            : base(keyValue)\r\n        {\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// Represents a reference to a C1 CMS IData item. \r\n    /// </summary>\r\n    /// <typeparam name=\"T\">The C1 Data Type (<see cref=\"IData\"/>) being referenced</typeparam>\r\n    [DataReferenceConverter]\r\n    public class DataReference<T> : IDataReference where T : class, IData\r\n    {\r\n        private readonly object _keyValue;\r\n        private T _cachedValue;\r\n            \r\n        /// <summary>\r\n        /// Constructs a 'empty' DataReference.\r\n        /// </summary>\r\n        public DataReference()\r\n        {\r\n            _keyValue = null;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a DataReference using a key value.\r\n        /// </summary>\r\n        /// <param name=\"keyValue\">The key value, like the Guid for a page's Id.</param>\r\n        public DataReference(object keyValue)\r\n        {\r\n            if (keyValue != null)\r\n            {\r\n                Type realKeyType = typeof(T).GetSingleKeyProperty().PropertyType;\r\n                if (keyValue.GetType() != realKeyType)\r\n                {\r\n                    _keyValue = ValueTypeConverter.Convert(keyValue, realKeyType);\r\n                }\r\n                else\r\n                {\r\n                    _keyValue = keyValue;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                _keyValue = null;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a DataReference using an instance of the data item.\r\n        /// </summary>\r\n        /// <param name=\"data\">The data item to reference.</param>\r\n        public DataReference(T data)\r\n        {\r\n            if (data != null)\r\n            {\r\n                _keyValue = data.GetUniqueKey();\r\n                _cachedValue = data;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The type of the data item. This type inherits from IData.\r\n        /// </summary>\r\n        public Type ReferencedType => typeof(T);\r\n\r\n\r\n        /// <summary>\r\n        /// If the reference has not been set this is false.\r\n        /// </summary>\r\n        public bool IsSet\r\n        {\r\n            get \r\n            {\r\n                if (_keyValue is Guid)\r\n                    return (Guid)_keyValue != Guid.Empty;\r\n\r\n                return _keyValue != null; \r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The key value of the data item being referenced, like the Guid for a page id.\r\n        /// </summary>\r\n        public object KeyValue => _keyValue;\r\n\r\n\r\n        /// <summary>\r\n        /// The data item being referenced.\r\n        /// </summary>\r\n        IData IDataReference.Data => this.Data;\r\n\r\n\r\n        /// <summary>\r\n        /// The data item being referenced.\r\n        /// </summary>\r\n        public T Data\r\n        {\r\n            get\r\n            {\r\n                if (!IsSet)\r\n                {\r\n                    return default(T);\r\n                }\r\n\r\n                if (_cachedValue != null)\r\n                {\r\n                    return _cachedValue;\r\n                }\r\n\r\n                return _cachedValue = DataFacade.GetDataByUniqueKey<T>(_keyValue);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// A linq predicate that select the data item being referenced. You can use this when filtering data on the <see cref=\"DataConnection\"/>.\r\n        /// </summary>\r\n        /// <returns>Predicate for referenced data.</returns>\r\n        public Expression<Func<T, bool>> GetPredicateExpression()\r\n        {\r\n            if (!IsSet)\r\n            {\r\n                return f => false;\r\n            }\r\n            \r\n            return DataFacade.GetPredicateExpressionByUniqueKey<T>(_keyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            if (_keyValue == null) return \"\";\r\n\r\n            return Composite.Core.Types.ValueTypeConverter.Convert<string>(_keyValue);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return this.Serialize();\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataReferenceConverterAttribute : ValueTypeConverterHelperAttribute\r\n    {\r\n        /// <exclude />\r\n        public override bool TryConvert(object value, Type targetType, out object targetValue)\r\n        {\r\n            Verify.ArgumentNotNull(value, \"value\");\r\n\r\n            IDataReference valueCasted = value as IDataReference;\r\n            if (valueCasted != null)\r\n            {\r\n                if (!valueCasted.IsSet)\r\n                {\r\n                    targetValue = null;\r\n                    return true;\r\n                }\r\n                \r\n                if (targetType == typeof (string))\r\n                {\r\n                    targetValue = valueCasted.KeyValue.ToString();\r\n                    return true;\r\n                }\r\n\r\n                if (targetType.IsInstanceOfType(valueCasted.KeyValue))\r\n                {\r\n                    targetValue = valueCasted.KeyValue;\r\n                    return true;\r\n                }\r\n            }\r\n\r\n\r\n            if (typeof(IDataReference).IsAssignableFrom(targetType))\r\n            {\r\n                if (value is string && string.IsNullOrEmpty((string) value))\r\n                {\r\n                    value = null;\r\n                }\r\n\r\n                object[] activationParameters = { value };\r\n\r\n                var dataReference = (IDataReference)Activator.CreateInstance(targetType, activationParameters);\r\n\r\n                targetValue = dataReference;\r\n\r\n                return true;\r\n            }\r\n\r\n\r\n            targetValue = null;\r\n            return false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataReferenceFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Referenced type: The type that is \"pointed\" to by another type\r\n    /// Referee type: The type that is \"pointing\" to a nother type\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class DataReferenceFacade\r\n    {\r\n        private static readonly Dictionary<PropertyInfo, Type> _propertyReferenceTargetTypeLookup = new Dictionary<PropertyInfo, Type>();\r\n\r\n        private static readonly object _lock = new object();\r\n\r\n        private static readonly MethodInfo HasReferenceMethodInfo = StaticReflection.GetGenericMethodInfo(() => HasReference<IData>(null, null, null));\r\n        private static readonly MethodInfo GetReferencesMethodInfo = StaticReflection.GetGenericMethodInfo(() => GetReferences<IData>(null, null, null, false));\r\n\r\n\r\n        /// <exclude />\r\n        public static List<Type> GetRefereeTypes(this Type referencedType)\r\n        {\r\n            Verify.ArgumentNotNull(referencedType, \"referencedType\");\r\n\r\n            return DataReferenceRegistry.GetRefereeTypes(referencedType).ToList();\r\n        }\r\n\r\n\r\n\r\n        internal static bool TryValidateDeleteSuccess(this IData dataToDelete)\r\n        {\r\n            var foundDataset = new Dictionary<DataSourceId, Tuple<IData, ForeignPropertyInfo>>();\r\n\r\n            GetRefereesRecursively(dataToDelete, true,\r\n                (type, foreignKey) => !foreignKey.IsOptionalReference\r\n                    && (!foreignKey.AllowCascadeDeletes || DataReferenceRegistry.GetRefereeTypes(type).Count > 0), foundDataset);\r\n\r\n            return foundDataset.All(kvp => kvp.Value.Item2.AllowCascadeDeletes);\r\n        }\r\n\r\n\r\n\r\n        internal static void ValidateForeignKeyIntegrity(this IData refereeData)\r\n        {\r\n            Verify.ArgumentNotNull(refereeData, \"refereeData\");\r\n\r\n            var invalidForeignKeyPropertyNames = new List<string>();\r\n\r\n            if (!TryValidateForeignKeyIntegrity(refereeData, invalidForeignKeyPropertyNames))\r\n            {\r\n                var sb = new StringBuilder();\r\n\r\n                sb.Append(\"The following foreign keys integrity did not validate: \");\r\n\r\n                bool isFirst = true;\r\n                foreach (string propertyName in invalidForeignKeyPropertyNames)\r\n                {\r\n                    if (!isFirst)\r\n                    {\r\n                        sb.Append(\", \");\r\n                    }\r\n                    else\r\n                    {\r\n                        isFirst = false;\r\n                    }\r\n\r\n                    sb.Append(propertyName);\r\n\r\n                    PropertyInfo invalidProperty = refereeData.GetType().GetAllProperties().FirstOrDefault(f => f.Name == propertyName);\r\n                    if (invalidProperty != null)\r\n                    {\r\n                        object propertyValue = invalidProperty.GetValue(refereeData, null);\r\n                        if (propertyValue != null)\r\n                        {\r\n                            string propertyStringValue = propertyValue.ToString();\r\n                            if (propertyStringValue.Length > 50) propertyStringValue = propertyStringValue.Substring(0, 40) + \"...\";\r\n                            sb.AppendFormat(\" ['{0}']\", propertyStringValue);\r\n                        }\r\n                        else\r\n                        {\r\n                            sb.Append(\" [null]\");\r\n                        }\r\n                    }\r\n                }\r\n                sb.Append(\"; DataType: \").Append(refereeData.DataSourceId.InterfaceType.FullName);\r\n\r\n                throw new InvalidOperationException(sb.ToString());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidateForeignKeyIntegrity(this IData refereeData)\r\n        {\r\n            Verify.ArgumentNotNull(refereeData, \"refereeData\");\r\n\r\n            return TryValidateForeignKeyIntegrity(refereeData, null);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidateForeignKeyIntegrity(this IData refereeData, List<string> invalidForeignKeyPropertyNames)\r\n        {\r\n            Verify.ArgumentNotNull(refereeData, \"refereeData\");\r\n\r\n            bool totalValidity = true;\r\n\r\n            foreach (ForeignPropertyInfo foreignPropertyInfo in DataReferenceRegistry.GetForeignKeyProperties(refereeData.DataSourceId.InterfaceType))\r\n            {\r\n                // If Nullable references are allowed, a check for SourcePropertyInfo.PropertyType.GetGenericDef == typeof(Nullable<?>)\r\n                // If it is a nullable and has no value, then all is ok and continue\r\n                // If it is a nullable and has a value, assign the value to refereeForeignKeyValue\r\n                // Else change nothing /MRJ\r\n                object refereeForeignKeyValue = foreignPropertyInfo.SourcePropertyInfo.GetValue(refereeData, null);\r\n\r\n                // Handling Nullable<>\r\n                if (refereeForeignKeyValue == null && (foreignPropertyInfo.SourcePropertyInfo.PropertyType.IsGenericType))\r\n                {\r\n                    Type type = foreignPropertyInfo.SourcePropertyInfo.PropertyType.GetGenericTypeDefinition();\r\n                    if (type == typeof(Nullable<>))\r\n                    {\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                // Handling null of type string where the reference should be handled as a non-reference\r\n                if (refereeForeignKeyValue == null && foreignPropertyInfo.IsNullableString)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                if (foreignPropertyInfo.IsNullReferenceValueSet)\r\n                {\r\n                    object nullReferenceKeyValue = foreignPropertyInfo.NullReferenceValue;\r\n\r\n                    if (foreignPropertyInfo.NullReferenceValueType != null)\r\n                    {\r\n                        nullReferenceKeyValue = ValueTypeConverter.Convert(nullReferenceKeyValue, foreignPropertyInfo.NullReferenceValueType);\r\n                    }\r\n\r\n                    if (object.Equals(nullReferenceKeyValue, refereeForeignKeyValue))\r\n                    {\r\n                        continue; // The foreign key is a null reference\r\n                    }\r\n                }\r\n\r\n                bool valid = false;\r\n\r\n                if (refereeForeignKeyValue != null)\r\n                {\r\n                    foreach (DataScopeIdentifier dataScopeIdentifier in DataFacade.GetSupportedDataScopes(foreignPropertyInfo.TargetType))\r\n                    {\r\n                        using (new DataScope(dataScopeIdentifier))\r\n                        {\r\n                            IQueryable scopeData = DataFacade.GetData(foreignPropertyInfo.TargetType);\r\n\r\n                            if (HasReference(scopeData, foreignPropertyInfo, refereeForeignKeyValue))\r\n                            {\r\n                                valid = true;\r\n\r\n                                break;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (!valid)\r\n                {\r\n                    totalValidity = false;\r\n\r\n                    if (invalidForeignKeyPropertyNames != null)\r\n                    {\r\n                        invalidForeignKeyPropertyNames.Add(foreignPropertyInfo.SourcePropertyName);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return totalValidity;\r\n        }\r\n\r\n\r\n\r\n        private static bool HasReference(IQueryable queryable, ForeignPropertyInfo foreignPropertyInfo, object propertyValue)\r\n        {\r\n            var targetType = foreignPropertyInfo.TargetType;\r\n\r\n            var methodInfo = HasReferenceMethodInfo.MakeGenericMethod(new[] { targetType });\r\n            return (bool)methodInfo.Invoke(null, new[] { queryable, foreignPropertyInfo.TargetKeyPropertyInfo, propertyValue });\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable GetReferences(IQueryable queryable, Type dataType, PropertyInfo propertyInfo, object keyValue, bool justOne)\r\n        {\r\n            var methodInfo = GetReferencesMethodInfo.MakeGenericMethod(new[] { dataType });\r\n            return (IEnumerable)methodInfo.Invoke(null, new[] { queryable, propertyInfo, keyValue, justOne });\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable GetReferences(IQueryable queryable, ForeignPropertyInfo foreignPropertyInfo, object keyValue, bool justOne)\r\n        {\r\n            Type sourceType = foreignPropertyInfo.SourcePropertyInfo.DeclaringType;\r\n            return GetReferences(queryable, sourceType, foreignPropertyInfo.SourcePropertyInfo, keyValue, justOne);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// To be run through reflection\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"queryable\"></param>\r\n        /// <param name=\"propertyInfo\"></param>\r\n        /// <param name=\"keyValue\"></param>\r\n        /// <param name=\"justOne\"></param>\r\n        /// <returns></returns>\r\n        private static IEnumerable GetReferences<T>(IQueryable<T> queryable, PropertyInfo propertyInfo, object keyValue, bool justOne)\r\n        {\r\n            Verify.ArgumentNotNull(queryable, \"queryable\");\r\n            Verify.ArgumentNotNull(propertyInfo, \"propertyInfo\");\r\n            Verify.ArgumentNotNull(keyValue, \"keyValue\");\r\n\r\n            // Building query:\r\n            //   select record from queryable\r\n            //   where record.'ForeingIdColumn' = 'keyValue'\r\n            //   [Take(1)]\r\n\r\n            ParameterExpression parameter = Expression.Parameter(typeof(T), \"record\");\r\n            var propertyExpression = Expression.Property(parameter, propertyInfo);\r\n\r\n            var constantExpression = GetConstantExpression(keyValue, propertyInfo);\r\n            var equalExpression = Expression.Equal(propertyExpression, constantExpression);\r\n\r\n            var lambdaFunc = Expression.Lambda<Func<T, bool>>(equalExpression, new[] { parameter });\r\n\r\n            IQueryable<T> resultQuery = queryable.Where(lambdaFunc);\r\n\r\n            return justOne ? resultQuery.Take(1) : resultQuery;\r\n        }\r\n\r\n\r\n\r\n        private static ConstantExpression GetConstantExpression(object keyValue, PropertyInfo propertyInfo)\r\n        {\r\n            // Property foreingPropertyInfo could have type System.Nullable<T> when keyValue have type T.\r\n\r\n            if(propertyInfo.PropertyType.FullName.StartsWith(typeof(System.Nullable<>).FullName))\r\n            {\r\n                return Expression.Constant(keyValue, propertyInfo.PropertyType);\r\n            }\r\n\r\n            return Expression.Constant(keyValue);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// To be run through reflection\r\n        /// </summary>\r\n        private static bool HasReference<T>(IQueryable queryable, PropertyInfo propertyInfo, object propertyValue)\r\n        {\r\n            Verify.ArgumentNotNull(queryable, \"queryable\");\r\n            Verify.ArgumentNotNull(propertyInfo, \"propertyInfo\");\r\n            Verify.ArgumentNotNull(propertyValue, \"propertyValue\");\r\n\r\n            // Building query:\r\n            //   select record from queryable\r\n            //   where record.'ForeingIdColumn' = 'propertyValue'\r\n            //   any;\r\n\r\n            var typedQueryable = queryable as IQueryable<T>;\r\n            Verify.ArgumentCondition(typedQueryable != null, \"queryable\", \"The argument should implement '{0}' interface.\".FormatWith(typeof(IQueryable<T>)));\r\n\r\n            ParameterExpression parameter = Expression.Parameter(typeof(T), \"record\");\r\n            var propertyExpression = Expression.Property(parameter, propertyInfo);\r\n            var constantExpression = GetConstantExpression(propertyValue, propertyInfo);\r\n            var equalExpression = Expression.Equal(propertyExpression, constantExpression);\r\n\r\n            var lambdaFunc = Expression.Lambda<Func<T, bool>>(equalExpression, new[] { parameter });\r\n\r\n            return typedQueryable.Where(lambdaFunc).Any();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static List<IData> GetNotOptionalReferences<T>(T data) where T : IData\r\n        {\r\n            return GetNotOptionalReferences(data, false);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static List<IData> GetNotOptionalReferences<T>(T data, bool allScopes) where T : IData\r\n        {\r\n            return GetRefereesInt(data, allScopes, (type, fp) => !fp.IsOptionalReference)\r\n                    .Select(t => t.Item1).ToList();\r\n        }\r\n\r\n        /// <exclude />\r\n        internal static List<IData> GetReferences(IData data, bool allScopes, Func<Type, ForeignPropertyInfo, bool> foreignKeyFilter)\r\n        {\r\n            return GetRefereesInt(data, allScopes, foreignKeyFilter)\r\n                    .Select(t => t.Item1).ToList();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        internal static IList<Tuple<IData, ForeignPropertyInfo>> GetRefereesInt(\r\n            IData data, bool allScopes, Func<Type, ForeignPropertyInfo, bool> propertyFilter)\r\n        {\r\n            Verify.ArgumentNotNull(data, nameof(data));\r\n\r\n            var result = new List<Tuple<IData, ForeignPropertyInfo>>();\r\n\r\n            Type dataType = data.DataSourceId.InterfaceType;\r\n            var referencedTypes = DataReferenceRegistry.GetRefereeTypes(dataType);\r\n\r\n            foreach (var referencedType in referencedTypes)\r\n            {\r\n                foreach (var foreignKeyProperty in GetForeignKeyProperties(referencedType, dataType))\r\n                {\r\n                    if (!propertyFilter(referencedType, foreignKeyProperty))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    IEnumerable<IData> references = data.GetReferees(referencedType, new[] { foreignKeyProperty.SourcePropertyInfo }, allScopes);\r\n\r\n                    result.AddRange(references.Select(r => new Tuple<IData, ForeignPropertyInfo>(r, foreignKeyProperty)));\r\n                }\r\n            }\r\n\r\n            // IData may contain a self-reference field, so we're removing references to original IData item from the result set\r\n            result.RemoveAll(reference => reference.Item1.DataSourceId.Equals(data.DataSourceId));\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetReferenceType(this PropertyInfo propertyInfo, out Type typeBeingReferenced)\r\n        {\r\n            Verify.ArgumentNotNull(propertyInfo, \"propertyInfo\");\r\n\r\n            typeBeingReferenced = null;\r\n\r\n            lock (_lock)\r\n            {\r\n                if (_propertyReferenceTargetTypeLookup.TryGetValue(propertyInfo, out typeBeingReferenced) == false)\r\n                {\r\n                    IEnumerable<ForeignPropertyInfo> foreignKeysOnType = DataReferenceRegistry.GetForeignKeyProperties(propertyInfo.DeclaringType);\r\n                    ForeignPropertyInfo match = foreignKeysOnType.FirstOrDefault(f => f.SourcePropertyName == propertyInfo.Name);\r\n\r\n                    typeBeingReferenced = (match != null ? match.TargetType : null);\r\n\r\n                    _propertyReferenceTargetTypeLookup.Add(propertyInfo, typeBeingReferenced);\r\n                }\r\n            }\r\n\r\n            return (typeBeingReferenced != null);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static DataReference<T> BuildDataReference<T>(object keyValue) where T : class, IData\r\n        {\r\n            return new DataReference<T>(keyValue);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IDataReference BuildDataReference(Type referencedType, object keyValue)\r\n        {\r\n            Verify.ArgumentNotNull(keyValue, \"keyValue\");\r\n            Verify.ArgumentNotNull(referencedType, \"referencedType\");\r\n            Verify.ArgumentCondition(typeof(IData).IsAssignableFrom(referencedType), \"referencedType\", \"The referenced type must implement IData\");\r\n\r\n            Type genericReferenceType = typeof(DataReference<>).MakeGenericType(new Type[] { referencedType });\r\n\r\n            return (IDataReference)Activator.CreateInstance(genericReferenceType, new object[] { keyValue });\r\n        }\r\n\r\n\r\n\r\n        internal static IEnumerable<ForeignPropertyInfo> GetForeignKeyProperties(Type refereeType)\r\n        {\r\n            Verify.ArgumentNotNull(refereeType, \"refereeType\");\r\n\r\n            return DataReferenceRegistry.GetForeignKeyProperties(refereeType);\r\n        }\r\n\r\n\r\n\r\n        internal static IEnumerable<ForeignPropertyInfo> GetForeignKeyProperties(Type refereeType, Type referencedType)\r\n        {\r\n            Verify.ArgumentNotNull(refereeType, \"refereeType\");\r\n            Verify.ArgumentNotNull(referencedType, \"referencedType\");\r\n\r\n            return\r\n                from fk in DataReferenceRegistry.GetForeignKeyProperties(refereeType)\r\n                where fk.TargetType == referencedType\r\n                      || referencedType.IsAssignableFrom(fk.TargetType)\r\n                select fk;\r\n        }\r\n\r\n\r\n\r\n        internal static ForeignPropertyInfo GetForeignKeyPropertyInfo(Type refereeType, string refereePropertyName)\r\n        {\r\n            Verify.ArgumentNotNull(refereeType, \"refereeType\");\r\n\r\n            return DataReferenceRegistry.GetForeignKeyProperties(refereeType).Single(fk => fk.SourcePropertyName == refereePropertyName);\r\n        }\r\n\r\n\r\n\r\n        internal static IEnumerable<string> GetForeignKeyPropertyNames(Type refereeType, Type referencedType)\r\n        {\r\n            Verify.ArgumentNotNull(refereeType, \"refereeType\");\r\n            Verify.ArgumentNotNull(referencedType, \"referencedType\");\r\n\r\n            return\r\n                from fk in DataReferenceRegistry.GetForeignKeyProperties(refereeType)\r\n                where fk.TargetType == referencedType\r\n                select fk.SourcePropertyName;\r\n        }\r\n\r\n\r\n\r\n        internal static bool CascadeDeleteAllowed(this IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return DataReferenceRegistry.GetForeignKeyProperties(data.DataSourceId.InterfaceType)\r\n                                        .All(_ => _.AllowCascadeDeletes);\r\n        }\r\n\r\n\r\n\r\n        internal static bool CascadeDeleteAllowed(this IData data, Type referencedType)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            Verify.ArgumentNotNull(referencedType, \"referencedType\");\r\n\r\n            return GetForeignKeyProperties(data.DataSourceId.InterfaceType, referencedType)\r\n                   .All(_ => _.AllowCascadeDeletes);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the refereeType has a foreign key to the referencedType\r\n        /// </summary>\r\n        /// <param name=\"refereeType\"></param>\r\n        /// <param name=\"referencedType\"></param>\r\n        /// <returns></returns>\r\n        internal static bool ReferenceExists(Type refereeType, Type referencedType)\r\n        {\r\n            return DataReferenceRegistry.GetRefereeTypes(referencedType).Contains(refereeType);\r\n        }\r\n\r\n\r\n\r\n        internal static bool IsDataReferred(this IData referencedData)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, \"referencedData\");\r\n\r\n            return GetReferees(referencedData, true, null, null, true).Any();\r\n        }\r\n\r\n\r\n\r\n        internal static bool IsDataReferred(this IData referencedData, Type refereeType, IEnumerable<PropertyInfo> foreignKeyProperties, bool allScopes)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, \"referencedData\");\r\n\r\n            return GetReferees(referencedData, true, refereeType, foreignKeyProperties, allScopes).Any();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public static List<IData> GetReferees(this IData referencedData)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, \"referencedData\");\r\n\r\n            return GetReferees(referencedData, false, null, null, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public static List<IData> GetReferees(this IData referencedData, Type refereeType)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, \"referencedData\");\r\n\r\n            return GetReferees(referencedData, false, refereeType, null, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public static List<IData> GetReferees(this IData referencedData, bool allScopes)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, \"referencedData\");\r\n\r\n            return GetReferees(referencedData, false, null, null, allScopes);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public static List<IData> GetReferees(this IData referencedData, Type refereeType, IEnumerable<PropertyInfo> foreignKeyProperties, bool allScopes)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, \"referencedData\");\r\n\r\n            return GetReferees(referencedData, false, refereeType, foreignKeyProperties, allScopes);\r\n        }\r\n\r\n\r\n\r\n        internal static IEnumerable<Tuple<IData, ForeignPropertyInfo>> GetNotOptionalRefereesRecursively(\r\n            this IData referencedData, bool allScopes = true)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, \"referencedData\");\r\n\r\n            var foundDataset = new Dictionary<DataSourceId, Tuple<IData, ForeignPropertyInfo>>();\r\n\r\n            GetRefereesRecursively(referencedData, allScopes, (t, f) => !f.IsOptionalReference, foundDataset);\r\n\r\n            return foundDataset.Values;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IData GetReferenced(this IData refereeData, string foreignKeyPropertyName)\r\n        {\r\n            Verify.ArgumentNotNull(refereeData, \"refereeData\");\r\n            Verify.ArgumentNotNullOrEmpty(foreignKeyPropertyName, \"foreignKeyPropertyName\");\r\n\r\n            ForeignPropertyInfo foreignPropertyInfo =\r\n                (from fkpi in DataReferenceRegistry.GetForeignKeyProperties(refereeData.DataSourceId.InterfaceType)\r\n                 where fkpi.SourcePropertyName == foreignKeyPropertyName\r\n                 select fkpi).Single();\r\n\r\n            object sourceKeyValue = foreignPropertyInfo.SourcePropertyInfo.GetValue(refereeData, null);\r\n\r\n            // Handling of Nullable<>\r\n            if (sourceKeyValue == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            Type targetType = foreignPropertyInfo.TargetType;\r\n            var dataset = DataFacade.GetData(targetType);\r\n\r\n            IEnumerable queryResult = GetReferences(dataset, targetType, foreignPropertyInfo.TargetKeyPropertyInfo, sourceKeyValue, true);\r\n            foreach(var result in queryResult)\r\n            {\r\n                Verify.That(result is IData, \"Query result should implement '{0}' interface\", typeof (IData).FullName);\r\n                return result as IData;\r\n            }\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private static void GetRefereesRecursively(IData referencedData, bool allScopes,\r\n            Func<Type, ForeignPropertyInfo, bool> foreignKeyPredicate,\r\n            Dictionary<DataSourceId, Tuple<IData, ForeignPropertyInfo>> foundDataset)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, nameof(foundDataset));\r\n            Verify.ArgumentNotNull(foundDataset, nameof(referencedData));\r\n\r\n            IList<Tuple<IData, ForeignPropertyInfo>> referees = GetRefereesInt(referencedData, allScopes, foreignKeyPredicate);\r\n\r\n            foreach (var data in referees)\r\n            {\r\n                if (!foundDataset.ContainsKey(data.Item1.DataSourceId))\r\n                {\r\n                    foundDataset.Add(data.Item1.DataSourceId, data);\r\n\r\n                    GetRefereesRecursively(data.Item1, allScopes, foreignKeyPredicate, foundDataset);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static List<IData> GetReferees(IData referencedData, IQueryable dataset, IEnumerable<ForeignPropertyInfo> foreignKeyProperyInfos, bool returnOnFirstFound)\r\n        {\r\n            List<IData> result = new List<IData>();\r\n\r\n            foreach (ForeignPropertyInfo foreignKeyPropertyInfo in foreignKeyProperyInfos)\r\n            {\r\n                if (!referencedData.DataSourceId.InterfaceType.IsAssignableFrom(foreignKeyPropertyInfo.TargetType))\r\n                {\r\n                    continue;\r\n                }\r\n                object sourceKeyValue = foreignKeyPropertyInfo.TargetKeyPropertyInfo.GetValue(referencedData, null);\r\n\r\n                result.AddRange(GetReferences(dataset, foreignKeyPropertyInfo, sourceKeyValue, returnOnFirstFound).Cast<IData>());\r\n                if (returnOnFirstFound && result.Count > 0)\r\n                {\r\n                    break;\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static List<IData> GetReferees(IData referencedData, bool returnOnFirstFound, Type refereeType, IEnumerable<PropertyInfo> propertiesToSearchBy, bool allScopes)\r\n        {\r\n            Verify.ArgumentNotNull(referencedData, \"referencedData\");\r\n\r\n            IEnumerable<Type> refereeTypes;\r\n            if (refereeType == null)\r\n            {\r\n                refereeTypes = DataReferenceRegistry.GetRefereeTypes(referencedData.DataSourceId.InterfaceType).Distinct();\r\n            }\r\n            else\r\n            {\r\n                if (!DataReferenceRegistry.GetRefereeTypes(referencedData.DataSourceId.InterfaceType).Contains(refereeType))\r\n                {\r\n                    throw new ArgumentException($\"The referencedData of type '{referencedData.DataSourceId.InterfaceType}' is not referenced by the given refereeType '{refereeType}'\");\r\n                }\r\n\r\n                refereeTypes = new List<Type> { refereeType };\r\n            }\r\n\r\n            var referees = new List<IData>();\r\n\r\n            foreach (Type refType in refereeTypes)\r\n            {\r\n                var foreignKeyProperties = DataReferenceRegistry.GetForeignKeyProperties(refType);\r\n\r\n                if (propertiesToSearchBy != null)\r\n                {\r\n                    foreignKeyProperties =\r\n                        (from fkpi in foreignKeyProperties\r\n                         from pi in propertiesToSearchBy\r\n                         where fkpi.SourcePropertyInfo == pi\r\n                         select fkpi).ToList();\r\n                }\r\n\r\n                if (allScopes)\r\n                {\r\n                    foreach (DataScopeIdentifier dataScopeIdentifier in DataFacade.GetSupportedDataScopes(refType))\r\n                    {\r\n                        using (new DataScope(dataScopeIdentifier))\r\n                        {\r\n                            IQueryable dataset = DataFacade.GetData(refType);\r\n                            List<IData> refs = GetReferees(referencedData, dataset, foreignKeyProperties, returnOnFirstFound);\r\n                            referees.AddRange(refs.KeyDistinct()); // KeyDistinct is used here if a type has more than one reference to a nother time\r\n\r\n                            if (returnOnFirstFound && referees.Count > 0)\r\n                            {\r\n                                return referees;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    IQueryable dataset = DataFacade.GetData(refType);\r\n                    List<IData> refs = GetReferees(referencedData, dataset, foreignKeyProperties, returnOnFirstFound);\r\n                    referees.AddRange(refs.KeyDistinct()); // KeyDistinct is used here if a type has more than one reference to a nother time\r\n\r\n                    if (returnOnFirstFound && referees.Count > 0)\r\n                    {\r\n                        return referees;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return referees;\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetBrokenReferencesReport(List<IData> brokenReferences)\r\n        {\r\n            var sb = new StringBuilder();\r\n\r\n            const int maximumLinesToShow = 6;\r\n\r\n            int toDisplay = brokenReferences.Count > maximumLinesToShow ? maximumLinesToShow - 1 : brokenReferences.Count;\r\n            for (int i = 0; i < toDisplay; i++)\r\n            {\r\n                IData brokenReference = brokenReferences[i];\r\n                Type type = brokenReference.DataSourceId.InterfaceType;\r\n\r\n\r\n                string typeTitle = DynamicTypeReflectionFacade.GetTitle(type);\r\n                if (string.IsNullOrEmpty(typeTitle))\r\n                {\r\n                    typeTitle = type.FullName;\r\n                }\r\n\r\n                string labelPropertyName = DynamicTypeReflectionFacade.GetLabelPropertyName(type);\r\n                if (string.IsNullOrEmpty(labelPropertyName))\r\n                {\r\n                    labelPropertyName = \"Id\"; // This is a nasty fallback, but will work in most cases and all the time with generated types.\r\n                }\r\n\r\n                PropertyInfo labelPropertyInfo = brokenReference.GetType().GetProperty(labelPropertyName, BindingFlags.Instance | BindingFlags.Public);\r\n                string dataLabel;\r\n\r\n                if (labelPropertyInfo != null)\r\n                {\r\n                    object propertyFieldValue = labelPropertyInfo.GetValue(brokenReference, null);\r\n                    dataLabel = (propertyFieldValue ?? \"NULL\").ToString();\r\n                }\r\n                else\r\n                {\r\n                    dataLabel = \"'Failed to resolve ({0}) field'\".FormatWith(labelPropertyName);\r\n                }\r\n\r\n\r\n                sb.Append(\"{0}, {1}\".FormatWith(typeTitle, dataLabel));\r\n                sb.Append(\"\\n\\r\");\r\n            }\r\n\r\n            if (brokenReferences.Count > maximumLinesToShow)\r\n            {\r\n                sb.Append(\"...\");\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Data/DataScope.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataScope : IDisposable\r\n    {\r\n        private readonly bool _dataScopePushed;\r\n        private readonly bool _cultureInfoPushed;\r\n        private bool _dataServicePushed;\r\n        private bool _disposed;\r\n        private bool _servicesDisabled;\r\n\r\n        /// <exclude />\r\n        public void AddService(object service)\r\n        {\r\n            if (!_dataServicePushed)\r\n            {\r\n                DataServiceScopeManager.PushDataServiceScope();\r\n                _dataServicePushed = true;\r\n            }\r\n            DataServiceScopeManager.AddService(service);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void AddDefaultService(object service)\r\n        {\r\n            DataServiceScopeManager.AddDefaultService(service);\r\n        }\r\n\r\n        /// <exclude />\r\n        public DataScope(DataScopeIdentifier dataScope)\r\n            : this(dataScope, null)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public DataScope(PublicationScope publicationScope)\r\n            : this(DataScopeIdentifier.FromPublicationScope(publicationScope), null)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataScope(CultureInfo cultureInfo)\r\n        {\r\n            if (cultureInfo != null)\r\n            {\r\n                LocalizationScopeManager.PushLocalizationScope(cultureInfo);\r\n                _cultureInfoPushed = true;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"dataScope\"></param>\r\n        /// <param name=\"cultureInfo\">null for default culture</param>\r\n        public DataScope(DataScopeIdentifier dataScope, CultureInfo cultureInfo)\r\n        {\r\n            DataScopeManager.PushDataScope(dataScope);\r\n            _dataScopePushed = true;\r\n\r\n\r\n            if (cultureInfo != null)\r\n            {\r\n                LocalizationScopeManager.PushLocalizationScope(cultureInfo);\r\n                _cultureInfoPushed = true;\r\n            }\r\n            else if (LocalizationScopeManager.IsEmpty)\r\n            {\r\n                LocalizationScopeManager.PushLocalizationScope(DataLocalizationFacade.DefaultLocalizationCulture);\r\n                _cultureInfoPushed = true;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"publicationScope\">Publication scope</param>\r\n        /// <param name=\"cultureInfo\">null for default culture</param>\r\n        public DataScope(PublicationScope publicationScope, CultureInfo cultureInfo)\r\n            : this(DataScopeIdentifier.FromPublicationScope(publicationScope), cultureInfo)\r\n        {\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~DataScope()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n\r\n        /// <exclude />\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n        void Dispose(bool disposing)\r\n        {\r\n            if (!disposing)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (_disposed)\r\n            {\r\n                throw new ObjectDisposedException(nameof(DataScope));\r\n            }\r\n\r\n            if (_servicesDisabled)\r\n            {\r\n                EnableServices();\r\n            }\r\n\r\n            if (_dataScopePushed)\r\n            {\r\n                DataScopeManager.PopDataScope();\r\n            }\r\n\r\n            if (_cultureInfoPushed)\r\n            {\r\n                LocalizationScopeManager.PopLocalizationScope();\r\n            }\r\n\r\n            if (_dataServicePushed)\r\n            {\r\n                DataServiceScopeManager.PopDataServiceScope();\r\n            }\r\n\r\n            _disposed = true;\r\n        }\r\n\r\n        internal void DisableServices()\r\n        {\r\n            DataServiceScopeManager.DisableServices();\r\n\r\n            _servicesDisabled = true;\r\n        }\r\n\r\n        internal void EnableServices()\r\n        {\r\n            DataServiceScopeManager.EnableServices();\r\n\r\n            _servicesDisabled = false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataScopeAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Assigns data scopes to a data type. By default data types will live in the public data scope (only) and you use this\r\n    /// attribute to specify aditional scopes.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the DataScope attribute along with related interfaces and attributes:\r\n    /// <code>\r\n    /// // (other IData attributes)\r\n    /// [DataScope(DataScopeIdentifier.PublicName)]\r\n    /// [DataScope(DataScopeIdentifier.AdministratedName)]\r\n    /// [PublishProcessControllerType(typeof(GenericPublishProcessController))]\r\n    /// interface IMyDataType : IData, IPublishControlled\r\n    /// {\r\n    ///     // data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]\r\n    public sealed class DataScopeAttribute : Attribute\r\n    {\r\n\r\n\r\n        /// <exclude />\r\n        public DataScopeAttribute(string dataScope)\r\n        {\r\n            this.Identifier = Composite.Data.DataScopeIdentifier.Deserialize(dataScope);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataScopeIdentifier Identifier\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataScopeIdentifier.cs",
    "content": "﻿using System;\r\nusing System.Diagnostics;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DebuggerDisplay(\"Name = {Name}\")]\r\n    public sealed class DataScopeIdentifier\r\n    {\r\n        /// <exclude />\r\n        public const string PublicName = \"public\";\r\n\r\n        /// <exclude />\r\n        public const string AdministratedName = \"administrated\";\r\n\r\n        /// <exclude />\r\n        public static DataScopeIdentifier Public { get; } = new DataScopeIdentifier(PublicName);\r\n\r\n        /// <exclude />\r\n        public static DataScopeIdentifier Administrated { get; } = new DataScopeIdentifier(AdministratedName);\r\n\r\n        /// <exclude />\r\n        public static DataScopeIdentifier GetDefault()\r\n        {\r\n            return DataScopeIdentifier.Public;\r\n        }\r\n\r\n        [JsonConstructor]\r\n        private DataScopeIdentifier(string name)\r\n        {\r\n            this.Name = name;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Name\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            return this.Name;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static DataScopeIdentifier Deserialize(string serializedData)\r\n        {\r\n            Verify.ArgumentNotNull(serializedData, nameof(serializedData));\r\n\r\n            switch (serializedData)\r\n            {\r\n                case PublicName:\r\n                    return DataScopeIdentifier.Public;\r\n\r\n                case AdministratedName:\r\n                    return DataScopeIdentifier.Administrated;\r\n\r\n                default:\r\n                    throw new InvalidOperationException(\"The serializedData argument was not a serialized DataScope\");\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PublicationScope ToPublicationScope()\r\n        {\r\n            return Name == PublicName ? PublicationScope.Published : PublicationScope.Unpublished;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static DataScopeIdentifier FromPublicationScope(PublicationScope publicationScope)\r\n        {\r\n            return publicationScope == PublicationScope.Published ? Public : Administrated;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsLegasyDataScope(string name)\r\n        {\r\n            name = name.ToLowerInvariant();\r\n            return name == \"deleted\" || name == \"versioned\";\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return obj != null && Equals(obj as DataScopeIdentifier);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(DataScopeIdentifier dataScope)\r\n        {\r\n            return !ReferenceEquals(dataScope, null) && this.Name == dataScope.Name;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool operator==(DataScopeIdentifier a, DataScopeIdentifier b)\r\n        {\r\n            return (object)a == null ? (object)b == null : a.Equals(b);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool operator!=(DataScopeIdentifier a, DataScopeIdentifier b)\r\n        {\r\n            return !(a == b);\r\n        }\r\n        \r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return this.Name.GetHashCode();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return this.Serialize();\r\n        }       \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataScopeManager.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Caching;\r\nusing System.Threading;\r\nusing System.Runtime.Remoting.Messaging;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DataScopeManager\r\n    {\r\n        /// <exclude />\r\n        public static DataScopeIdentifier CurrentDataScope\r\n        {\r\n            get\r\n            {\r\n                var stack = DataScopeStack;\r\n\r\n                if (stack.Count != 0)\r\n                {\r\n                    return stack.Peek();\r\n                }\r\n                \r\n                return DataScopeIdentifier.GetDefault();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static DataScopeIdentifier MapByType(IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            return MapByType(data.DataSourceId.InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static DataScopeIdentifier MapByType(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n\r\n            var currentScope = CurrentDataScope;\r\n\r\n            if (DataFacade.GetSupportedDataScopes(interfaceType).Any(f => f.Equals(currentScope)))\r\n            {\r\n                return currentScope;\r\n            }\r\n            return DataScopeIdentifier.GetDefault();\r\n        }\r\n\r\n\r\n\r\n        internal static void PushDataScope(DataScopeIdentifier dataScope)\r\n        {\r\n            DataScopeStack.Push(dataScope);\r\n        }\r\n\r\n\r\n\r\n        internal static void PopDataScope()\r\n        {\r\n            var stack = DataScopeStack;\r\n\r\n            if (stack.Count > 0)\r\n            {\r\n                stack.Pop();\r\n            }\r\n        }\r\n\r\n\r\n        private const string _threadLocalCacheKey = \"DataScopeManager:ThreadLocal\";\r\n\r\n\r\n        /// <summary>\r\n        /// Move the stack handling scope to a thread local store, enabling simultaneous threads to mutate (their own) scope. This will be in effect untill the thread has completed.\r\n        /// </summary>\r\n        public static void EnterThreadLocal()\r\n        {\r\n            if( CallContext.GetData(_threadLocalCacheKey) == null)\r\n            {\r\n                var threadLocalStack = new Stack<DataScopeIdentifier>( DataScopeStack );\r\n                CallContext.SetData( _threadLocalCacheKey, threadLocalStack );\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Move the stack handling to request scope.\r\n        /// </summary>\r\n        public static void ExitThreadLocal()\r\n        {\r\n            if (CallContext.GetData(_threadLocalCacheKey) != null)\r\n            {\r\n                CallContext.SetData(_threadLocalCacheKey, null);\r\n            }\r\n        }\r\n\r\n\r\n        private static Stack<DataScopeIdentifier> DataScopeStack\r\n        {\r\n            get\r\n            {\r\n                var threadLocalStack = CallContext.GetData(_threadLocalCacheKey) as Stack<DataScopeIdentifier>;\r\n                if (threadLocalStack!=null)\r\n                {\r\n                    return threadLocalStack;\r\n                }\r\n\r\n                return RequestLifetimeCache.GetCachedOrNew<Stack<DataScopeIdentifier>>(\"DataScopeManager:Stack\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataScopeServicesFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Facade for added services to data scope\r\n    /// </summary>\r\n    public static class DataScopeServicesFacade\r\n    {\r\n        /// <summary>\r\n        /// Adds a default service to data scope manager. All DataScopes created after this point will include the service you provide.\r\n        /// </summary>\r\n        /// <param name=\"service\"></param>\r\n        public static void RegisterDefaultService(object service)\r\n        {\r\n            DataServiceScopeManager.AddDefaultService(service);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataSerializerHandler.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    internal sealed class DataSerilizationException : Exception\r\n    {\r\n        public DataSerilizationException(string message)\r\n            : base(message)\r\n        {\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class DataSerializerHandler : ISerializerHandler\r\n    {\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            if (objectToSerialize == null) throw new ArgumentNullException(\"objectToSerialize\");\r\n\r\n            IData data = objectToSerialize as IData;\r\n            if (data == null) throw new ArgumentException(\"data\");\r\n\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            if (data.DataSourceId.ExistsInStore == false)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_IsNew_\", true);\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_Type_\", TypeManager.SerializeType(data.DataSourceId.InterfaceType));\r\n            }\r\n            else\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_IsNew_\", false);\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"_DataSourceId_\", data.DataSourceId.Serialize());\r\n            }\r\n\r\n            Type dataType = data.DataSourceId.InterfaceType;\r\n            SerializePropertiesFromInterface(data, data.DataSourceId.InterfaceType, false, sb);\r\n\r\n            foreach(var inheritedInterface in dataType.GetInterfaces())\r\n            {\r\n                if (inheritedInterface == typeof(IData)) continue; // DataSourceId is already serialized so we're skipping it here\r\n\r\n                SerializePropertiesFromInterface(data, inheritedInterface, true, sb);\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n        private static IEnumerable<PropertyInfo> GetSerializableProperties(Type @interface)\r\n        {\r\n            return\r\n                from prop in @interface.GetProperties(BindingFlags.Public | BindingFlags.Instance)\r\n                where prop.CanRead && prop.CanWrite \r\n                select prop;\r\n        }\r\n\r\n\r\n        private static void SerializePropertiesFromInterface(object objectToSerialize, Type @interface, bool includeInterfaceName, StringBuilder stringBuilder)\r\n        {\r\n            string fieldPrefix = includeInterfaceName ? GetTypeSerializationPrefix(@interface) : string.Empty;\r\n\r\n            foreach (PropertyInfo propertyInfo in GetSerializableProperties(@interface))\r\n            {\r\n                MethodInfo methodInfo =\r\n                        (from mi in typeof(StringConversionServices).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                         where mi.Name == \"SerializeKeyValuePair\" &&\r\n                               mi.IsGenericMethodDefinition &&\r\n                               mi.GetParameters().Length == 3 &&\r\n                               mi.GetParameters()[2].ParameterType.IsGenericParameter \r\n                         select mi).SingleOrDefault();\r\n\r\n                methodInfo = methodInfo.MakeGenericMethod(new Type[] { propertyInfo.PropertyType });\r\n\r\n                object propertyValue = propertyInfo.GetValue(objectToSerialize, null);\r\n\r\n                string fieldKey = fieldPrefix + propertyInfo.Name;\r\n\r\n                methodInfo.Invoke(null, new object[] { stringBuilder, fieldKey, propertyValue });\r\n            }\r\n        }\r\n\r\n        private static void DeserializePropertiesFromInterface(Dictionary<string, string> serializedData, Type @interface, bool includeInterfaceName, object targetObject)\r\n        {\r\n            string fieldPrefix = includeInterfaceName ? GetTypeSerializationPrefix(@interface) : string.Empty;\r\n\r\n            foreach (PropertyInfo propertyInfo in GetSerializableProperties(@interface))\r\n            {\r\n                string fieldKey = fieldPrefix + propertyInfo.Name;\r\n\r\n                if (serializedData.ContainsKey(fieldKey) == false) throw new DataSerilizationException(string.Format(\"The data type '{0}' does not contain a property named '{1}', type might have changed sinse this serialized data was created\", @interface, propertyInfo.Name));\r\n\r\n                MethodInfo methodInfo =\r\n                        (from mi in typeof(StringConversionServices).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                         where mi.Name == \"DeserializeValue\" &&\r\n                               mi.IsGenericMethodDefinition &&\r\n                               mi.GetParameters().Length == 2 &&\r\n                               mi.GetParameters()[1].ParameterType.IsGenericParameter \r\n                         select mi).SingleOrDefault();\r\n\r\n                object defaultValue;\r\n\r\n                if (propertyInfo.PropertyType == typeof(Guid)) defaultValue = default(Guid);\r\n                else if (propertyInfo.PropertyType == typeof(string)) defaultValue = default(string);\r\n                else if (propertyInfo.PropertyType == typeof(int)) defaultValue = default(int);\r\n                else if (propertyInfo.PropertyType == typeof(DateTime)) defaultValue = default(DateTime);\r\n                else if (propertyInfo.PropertyType == typeof(bool)) defaultValue = default(bool);\r\n                else if (propertyInfo.PropertyType == typeof(decimal)) defaultValue = default(decimal);\r\n                else if (propertyInfo.PropertyType == typeof(long)) defaultValue = default(long);\r\n                else defaultValue = null;\r\n\r\n                methodInfo = methodInfo.MakeGenericMethod(new Type[] { propertyInfo.PropertyType });\r\n\r\n\r\n                /*  string methodName;\r\n\r\n                  if (propertyInfo.PropertyType == typeof(Guid)) methodName = \"DeserializeValueGuid\";\r\n                  else if (propertyInfo.PropertyType == typeof(string)) methodName = \"DeserializeValueString\";\r\n                  else if (propertyInfo.PropertyType == typeof(int)) methodName = \"DeserializeValueInt\";\r\n                  else if (propertyInfo.PropertyType == typeof(DateTime)) methodName = \"DeserializeValueDateTime\";\r\n                  else if (propertyInfo.PropertyType == typeof(DateTime?)) methodName = \"DeserializeValueDateTimeNullable\";                    \r\n                  else if (propertyInfo.PropertyType == typeof(bool)) methodName = \"DeserializeValueBool\";\r\n                  else if (propertyInfo.PropertyType == typeof(decimal)) methodName = \"DeserializeValueDecimal\";\r\n                  else if (propertyInfo.PropertyType == typeof(long)) methodName = \"DeserializeValueLong\";\r\n                  else methodName = null;\r\n\r\n                  if (methodName == null) throw new InvalidOperationException(string.Format(\"StringConversionServices does not support the type '{0}'\", propertyInfo.PropertyType));\r\n                  */\r\n\r\n                object propertyValue = methodInfo.Invoke(null, new object[] { serializedData[fieldKey], defaultValue });\r\n\r\n                propertyInfo.SetValue(targetObject, propertyValue, null);\r\n            }\r\n        }\r\n\r\n        private static string GetTypeSerializationPrefix(Type type)\r\n        {\r\n            return type.FullName.Replace(\".\", \"-\") + \".\";\r\n        }\r\n\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            Dictionary<string, string> serializationData = StringConversionServices.ParseKeyValueCollection(serializedObject);\r\n\r\n            if (serializationData.ContainsKey(\"_IsNew_\") == false) throw new ArgumentException(\"serializedObject is of wrong format\");\r\n\r\n            IData data = null;\r\n\r\n            bool isNew = StringConversionServices.DeserializeValueBool(serializationData[\"_IsNew_\"]);\r\n            if (isNew)\r\n            {\r\n                if (serializationData.ContainsKey(\"_Type_\") == false) throw new ArgumentException(\"serializedObject is of wrong format\");\r\n\r\n                string typeString = StringConversionServices.DeserializeValueString(serializationData[\"_Type_\"]);\r\n                Type interfaceType = TypeManager.GetType(typeString);\r\n\r\n                data = DataFacade.BuildNew(interfaceType);\r\n            }\r\n            else\r\n            {\r\n                if (serializationData.ContainsKey(\"_DataSourceId_\") == false) throw new ArgumentException(\"serializedObject is of wrong format\");\r\n\r\n                string dataSourceIdString = StringConversionServices.DeserializeValueString(serializationData[\"_DataSourceId_\"]);\r\n                DataSourceId dataSourceId = DataSourceId.Deserialize(dataSourceIdString);\r\n\r\n                data = DataFacade.GetDataFromDataSourceId(dataSourceId);\r\n\r\n                if (data == null) throw new DataSerilizationException(string.Format(\"Failed to get the '{0}' with the given data source '{1}', data might have been deleted sinse this serialized data was created\", dataSourceId.InterfaceType, dataSourceId));\r\n            }\r\n\r\n            Type dataType = data.DataSourceId.InterfaceType;\r\n\r\n            DeserializePropertiesFromInterface(serializationData, dataType, false, data);\r\n\r\n            foreach (var inheritedInterface in dataType.GetInterfaces())\r\n            {\r\n                if (inheritedInterface == typeof(IData)) continue; // DataSourceId is already deserialized so we're skipping it here\r\n\r\n                DeserializePropertiesFromInterface(serializationData, inheritedInterface, true, data);\r\n            }\r\n\r\n            return data;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataServiceScopeManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Runtime.Remoting.Messaging;\r\nusing Composite.Core.Caching;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class DataServiceScopeManager\r\n    {\r\n        internal static void AddService(object service)\r\n        {\r\n            var serviceStack = DataServiceScopeStack?.Peek();\r\n            Verify.IsNotNull(serviceStack, \"The data service stack was not pushed before use\");\r\n\r\n            serviceStack.Add(service);\r\n        }\r\n\r\n        internal static void AddDefaultService(object service)\r\n        {\r\n            DataServiceDefaultList.Add(service);\r\n        }\r\n\r\n        internal static void DisableServices()\r\n        {\r\n            CallContext.SetData(DisableServicesCacheKey, true);\r\n        }\r\n\r\n        internal static void EnableServices()\r\n        {\r\n            CallContext.SetData(DisableServicesCacheKey,false);\r\n        }\r\n\r\n        internal static object GetService(Type t)\r\n        {\r\n            if (DisableServicesFlag.HasValue && DisableServicesFlag.Value)\r\n                return null;\r\n\r\n            foreach(var serviceList in DataServiceScopeStack)\r\n            {\r\n                var match = serviceList?.FindLast(f => f.GetType() == t);\r\n                if (match != null)\r\n                {\r\n                    return match;\r\n                }\r\n            }\r\n\r\n            return DataServiceDefaultList.Last(f => f.GetType() == t);\r\n        }\r\n\r\n        private static readonly List<object> DataServiceDefaultList = new List<object>();\r\n\r\n        private static Stack<List<object>> DataServiceScopeStack\r\n        {\r\n            get\r\n            {\r\n                return CallContext.GetData(ServiceStackCacheKey) as Stack<List<object>>\r\n                    ?? RequestLifetimeCache.GetCachedOrNew<Stack<List<object>>>(\"DataServiceScopeManager:Stack\");\r\n            }\r\n        }\r\n\r\n        private static bool? DisableServicesFlag\r\n        {\r\n            get\r\n            {\r\n                return CallContext.GetData(DisableServicesCacheKey) as bool?\r\n                    ?? RequestLifetimeCache.GetCachedOrNew<bool?>(\"DataServiceScopeManagerServiceDisabled:Bool\");\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Move the stack handling scope to a thread local store, enabling simultaneous threads to mutate (their own) scope. This will be in effect untill the thread has completed.\r\n        /// </summary>\r\n        public static void EnterThreadLocal()\r\n        {\r\n            if (CallContext.GetData(ServiceStackCacheKey) == null)\r\n            {\r\n                var threadLocalStack = new Stack<List<object>>(DataServiceScopeStack);\r\n                CallContext.SetData(ServiceStackCacheKey, threadLocalStack);\r\n            }\r\n\r\n            if (CallContext.GetData(DisableServicesCacheKey) == null)\r\n            {\r\n                var threadLocalStackFlag = DisableServicesFlag;\r\n                CallContext.SetData(DisableServicesCacheKey, threadLocalStackFlag);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Move the stack handling to request scope.\r\n        /// </summary>\r\n        public static void ExitThreadLocal()\r\n        {\r\n            if (CallContext.GetData(ServiceStackCacheKey) != null)\r\n            {\r\n                CallContext.SetData(ServiceStackCacheKey, null);\r\n            }\r\n\r\n            if (CallContext.GetData(DisableServicesCacheKey) != null)\r\n            {\r\n                CallContext.SetData(DisableServicesCacheKey, null);\r\n            }\r\n        }\r\n\r\n        private const string ServiceStackCacheKey = \"DataServiceScopeManager:ThreadLocal\";\r\n        private const string DisableServicesCacheKey = \"DataServiceScopeManagerDisableServiceFlag:ThreadLocal\";\r\n\r\n\r\n\r\n\r\n        internal static void PopDataServiceScope()\r\n        {\r\n            Verify.That(DataServiceScopeStack.Count > 0, nameof(DataServiceScopeStack) + \" underflow\");\r\n\r\n            DataServiceScopeStack.Pop().ForEach(f => (f as IDisposable)?.Dispose());\r\n        }\r\n\r\n        internal static void PushDataServiceScope()\r\n        {\r\n            DataServiceScopeStack.Push(new List<object>());\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/DataSourceId.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Types;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Uniquely identify a data element (table record in sql speak), its type and what provider it came from.\r\n    /// </summary>\r\n    public sealed class DataSourceId\r\n    {\r\n        private string _serializedData;\r\n        private Dictionary<string, object> _tagInformation;\r\n\r\n        /// <summary>\r\n        /// This is for internal use only!\r\n        /// </summary>\r\n        public DataSourceId(IDataId dataId, string providerName, Type interfaceType)\r\n        {\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(nameof(providerName));\r\n            this.DataId = dataId ?? throw new ArgumentNullException(nameof(dataId));\r\n            ProviderName = providerName;\r\n            InterfaceType = interfaceType ?? throw new ArgumentNullException(nameof(interfaceType));\r\n            DataScopeIdentifier = DataScopeManager.MapByType(interfaceType);\r\n            LocaleScope = LocalizationScopeManager.MapByType(interfaceType);\r\n            this.ExistsInStore = true;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is for internal use only!\r\n        /// </summary>\r\n        public DataSourceId(IDataId dataId, string providerName, Type interfaceType, DataScopeIdentifier dataScopeIdentifier, CultureInfo localeScope)\r\n        {\r\n            // This constructor has to be extremely fast, we have up to 100.000 objects related while some requests\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(nameof(providerName));\r\n            this.DataId = dataId ?? throw new ArgumentNullException(nameof(dataId));\r\n            ProviderName = providerName;\r\n            InterfaceType = interfaceType ?? throw new ArgumentNullException(nameof(interfaceType));\r\n            DataScopeIdentifier = dataScopeIdentifier ?? throw new ArgumentNullException(nameof(dataScopeIdentifier));\r\n            LocaleScope = localeScope ?? throw new ArgumentNullException(nameof(localeScope));\r\n            this.ExistsInStore = true;\r\n        }\r\n\r\n        [JsonConstructor]\r\n        private DataSourceId(IDataId dataId, string providerName, Type interfaceType, DataScopeIdentifier dataScopeIdentifier, string localeScope)\r\n        {\r\n            // This constructor has to be extremely fast, we have up to 100.000 objects related while some requests\r\n            \r\n            this.DataId = dataId ?? throw new ArgumentNullException(nameof(dataId));\r\n            ProviderName = providerName ?? DataProviderRegistry.DefaultDynamicTypeDataProviderName;\r\n            InterfaceType = interfaceType ?? throw new ArgumentNullException(nameof(interfaceType));\r\n            DataScopeIdentifier = dataScopeIdentifier ?? throw new ArgumentNullException(nameof(dataScopeIdentifier));\r\n            LocaleScope = CultureInfo.CreateSpecificCulture(localeScope);\r\n            this.ExistsInStore = true;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This is for internal use only!\r\n        /// </summary>\r\n        internal DataSourceId(Type interfaceType)\r\n        {\r\n            this.InterfaceType = interfaceType;\r\n            this.ExistsInStore = false;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Object which the data provider can use to uniquely identify the 'table record' in its own store matching a data element. \r\n        /// </summary>\r\n        public IDataId DataId { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Name of the data provider responsible for the data element.\r\n        /// </summary>\r\n        public string ProviderName { get; }\r\n\r\n        /// <exclude />\r\n        public bool ShouldSerializeProviderName()\r\n        {\r\n            // don't serialize ProviderName if it is default \r\n            return ProviderName != DataProviderRegistry.DefaultDynamicTypeDataProviderName;\r\n        }\r\n\r\n        /// <summary>\r\n        /// The interface used for the data element. This is expected to be implementing IData.\r\n        /// </summary>\r\n        public Type InterfaceType { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// The data scope (language and published/unpublished) from which the data element originate.\r\n        /// </summary>\r\n        public DataScopeIdentifier DataScopeIdentifier { get; internal set; }\r\n\r\n        /// <summary>\r\n        /// The publication scope (published or unpublished) from which the data element originate.\r\n        /// </summary>\r\n        [JsonIgnore]\r\n        public PublicationScope PublicationScope => DataScopeIdentifier.ToPublicationScope();\r\n\r\n\r\n        /// <summary>\r\n        /// The language from which the data element originate.\r\n        /// </summary>\r\n        [JsonIgnore]\r\n        public CultureInfo LocaleScope { get; internal set; }\r\n\r\n        [JsonProperty(PropertyName = \"localeScope\")]\r\n        private string LocalScopeName => (LocaleScope !=null ? LocaleScope.Name : null);\r\n\r\n        /// <summary>\r\n        /// True when the data element represents a physically stored element\r\n        /// </summary>\r\n        [JsonIgnore]\r\n        public bool ExistsInStore\r\n        {\r\n            get;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Serialize to string\r\n        /// </summary>\r\n        /// <returns>Serialized as string</returns>\r\n        public string Serialize()\r\n        {\r\n            return _serializedData ?? (_serializedData = CompositeJsonSerializer.Serialize(this));\r\n        }\r\n\r\n\r\n        \r\n\r\n        /// <summary>\r\n        /// Recreate a DataSourceId based on a serialized string representation of it.\r\n        /// </summary>\r\n        /// <param name=\"serializedDataSourceId\">A serialized DataSourceId</param>\r\n        /// <returns>The DataSourceId deserialized</returns>\r\n        public static DataSourceId Deserialize(string serializedDataSourceId)\r\n        {\r\n            DataSourceId dataSourceId;\r\n\r\n            Deserialize(serializedDataSourceId, out dataSourceId, true);\r\n\r\n            return dataSourceId;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Tries to deserialize a string as a DataSourceId.\r\n        /// </summary>\r\n        /// <param name=\"serializedDataSourceId\">A serialized DataSourceId</param>\r\n        /// <param name=\"dataSourceId\">DataSourceId reference to set, if deserialization succeeded</param>\r\n        /// <returns>True if the deserialization succeeded, otherwise false</returns>\r\n        public static bool TryDeserialize(string serializedDataSourceId, out DataSourceId dataSourceId)\r\n        {\r\n            return Deserialize(serializedDataSourceId, out dataSourceId, false);\r\n        }\r\n\r\n\r\n\r\n        private static bool Deserialize(string serializedDataSourceId, out DataSourceId dataSourceId, bool throwException)\r\n        {\r\n            if(CompositeJsonSerializer.IsJsonSerialized(serializedDataSourceId))\r\n            {\r\n                dataSourceId = CompositeJsonSerializer.Deserialize<DataSourceId>(serializedDataSourceId);\r\n                return true;\r\n            }\r\n\r\n            return DeserializeLegacy(serializedDataSourceId, out dataSourceId, throwException);\r\n        }\r\n\r\n        private static bool DeserializeLegacy(string serializedDataSourceId, out DataSourceId dataSourceId, bool throwException)\r\n        {\r\n            dataSourceId = null;\r\n\r\n            var dic = StringConversionServices.ParseKeyValueCollection(serializedDataSourceId);\r\n\r\n            if (!dic.ContainsKey(\"_dataIdType_\") ||\r\n                !dic.ContainsKey(\"_dataId_\") ||\r\n                !dic.ContainsKey(\"_interfaceType_\") ||\r\n                !dic.ContainsKey(\"_dataScope_\") ||\r\n                !dic.ContainsKey(\"_localeScope_\"))\r\n            {\r\n                if (throwException)\r\n                {\r\n                    throw new ArgumentException(\"The argument is not a serialized \" + nameof(DataSourceId), nameof(serializedDataSourceId));\r\n                }\r\n                return false;\r\n            }\r\n\r\n            string serializedDataId = StringConversionServices.DeserializeValueString(dic[\"_dataId_\"]);\r\n            string dataIdTypeName = StringConversionServices.DeserializeValueString(dic[\"_dataIdType_\"]);\r\n\r\n            string providerName = dic.ContainsKey(\"_providerName_\")\r\n                ? StringConversionServices.DeserializeValueString(dic[\"_providerName_\"])\r\n                : DataProviderRegistry.DefaultDynamicTypeDataProviderName;\r\n\r\n            string interfaceTypeName = StringConversionServices.DeserializeValueString(dic[\"_interfaceType_\"]);\r\n            string dataScope = StringConversionServices.DeserializeValueString(dic[\"_dataScope_\"]);\r\n            string localeScope = StringConversionServices.DeserializeValueString(dic[\"_localeScope_\"]);\r\n\r\n            Type interfaceType = TypeManager.TryGetType(interfaceTypeName);\r\n            if (interfaceType == null)\r\n            {\r\n                if (throwException)\r\n                {\r\n                    throw new InvalidOperationException($\"The type '{interfaceTypeName}' could not be found\");\r\n                }\r\n                return false;\r\n            }\r\n\r\n            Type dataIdType = TypeManager.TryGetType(dataIdTypeName);\r\n            if (dataIdType == null)\r\n            {\r\n                if (throwException)\r\n                {\r\n                    throw new InvalidOperationException($\"The type '{dataIdTypeName}' could not be found\");\r\n                }\r\n                return false;\r\n            }\r\n\r\n            serializedDataId = FixSerializedDataId(serializedDataId, interfaceType);\r\n\r\n            IDataId dataId = SerializationFacade.Deserialize<IDataId>(dataIdType, serializedDataId);\r\n\r\n            CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(localeScope);\r\n\r\n            dataSourceId = new DataSourceId(dataId, providerName, interfaceType, DataScopeIdentifier.Deserialize(dataScope), cultureInfo);\r\n\r\n            return true;\r\n        }\r\n\r\n        private static string FixSerializedDataId(string serializedDataId, Type interfaceType)\r\n        {\r\n            if (interfaceType == typeof(IPage) && !serializedDataId.Contains(nameof(IPage.VersionId)))\r\n            {\r\n                return serializedDataId + \",\" + serializedDataId.Replace(nameof(IPage.Id), nameof(IPage.VersionId));\r\n            }\r\n\r\n            return serializedDataId;\r\n        }\r\n        /// <exclude />\r\n        public override string ToString() => Serialize();\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return obj is DataSourceId dataSourceId && Equals(dataSourceId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(DataSourceId dataSourceId)\r\n        {\r\n            return dataSourceId != null\r\n                && dataSourceId.ProviderName == ProviderName\r\n                && dataSourceId.DataId.Equals(DataId)\r\n                && dataSourceId.InterfaceType == InterfaceType\r\n                && dataSourceId.DataScopeIdentifier.Equals(DataScopeIdentifier)\r\n                && dataSourceId.LocaleScope.Name.Equals(LocaleScope.Name);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n            => DataId.GetHashCode() ^ InterfaceType.GetHashCode() ^ ProviderName.GetHashCode()\r\n               ^ DataScopeIdentifier.GetHashCode() ^ LocaleScope.GetHashCode();\r\n\r\n\r\n\r\n        internal void SetTag(string id, object value)\r\n        {\r\n            InitializeTagInformation();\r\n\r\n            _tagInformation[id] = value;\r\n        }\r\n\r\n\r\n\r\n        internal void RemoveTag(string id)\r\n        {\r\n            if(_tagInformation == null) return;\r\n\r\n            InitializeTagInformation();\r\n\r\n            _tagInformation.Remove(id);\r\n        }\r\n\r\n\r\n\r\n        internal bool TryGetTag(string id, out object value)\r\n        {\r\n            if(_tagInformation == null)\r\n            {\r\n                value = null;\r\n                return false;\r\n            }\r\n\r\n            InitializeTagInformation();\r\n\r\n            return _tagInformation.TryGetValue(id, out value);\r\n        }\r\n\r\n\r\n\r\n        private void InitializeTagInformation()\r\n        {\r\n             if(_tagInformation == null)\r\n             {\r\n                 _tagInformation = new Dictionary<string, object>();\r\n             }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DataTypeTypesManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.GeneratedTypes;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// This class handles data type specific types:\r\n    /// - Getting a data type from dataTypeId or data type descriptor\r\n    /// - Getting a data type empty class from type or data type descriptor\r\n    /// </summary>\r\n    /// <exclude />\r\n    internal static class DataTypeTypesManager\r\n    {\r\n        private static readonly string LogTitle = typeof(DataTypeTypesManager).Name;\r\n        private static List<Type> _LoadedDataTypes = new List<Type>();\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the runtime data type for the given data type id.\r\n        /// In case of generated types, this call might result in a interface code compilation.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeId\">The id of the data type.</param>\r\n        /// <returns>Returns the data type. Never null.</returns>\r\n        public static Type GetDataType(Guid dataTypeId)\r\n        {\r\n            var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(dataTypeId);\r\n            if (dataTypeDescriptor == null) throw new InvalidOperationException(\"No data type exists with the given data type id: \" + dataTypeId);\r\n\r\n            return GetDataType(dataTypeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the runtime data type for the given data type id.\r\n        /// In case of generated types, this call might result in a interface code compilation.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\">\r\n        /// The DataTypeDescriptor for the data type.\r\n        /// </param>\r\n        /// <returns>Returns the data type. Never null.</returns>\r\n        public static Type GetDataType(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Verify.ArgumentNotNull(dataTypeDescriptor, \"dataTypeDescriptor\");\r\n\r\n            Type loadedDataType = _LoadedDataTypes.FirstOrDefault(f => f.FullName == dataTypeDescriptor.GetFullInterfaceName());\r\n            if (loadedDataType != null) return loadedDataType;\r\n\r\n            Type type = InterfaceCodeManager.GetType(dataTypeDescriptor);\r\n\r\n            return type;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the runtime empty data type for the given data type.\r\n        /// </summary>\r\n        /// <param name=\"dataType\"></param>\r\n        /// <param name=\"forceReCompilation\">\r\n        /// If this is true a new empty class will be \r\n        /// compiled at runtime regardless if it exists or not.\r\n        /// Use with caution!\r\n        /// </param>\r\n        /// <returns></returns>\r\n        public static Type GetDataTypeEmptyClass(Type dataType, bool forceReCompilation = false)\r\n        {\r\n            return EmptyDataClassTypeManager.GetEmptyDataClassType(dataType, forceReCompilation);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the runtime empty data type for the given data type descriptor.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        /// <returns></returns>\r\n        public static Type GetDataTypeEmptyClass(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return EmptyDataClassTypeManager.GetEmptyDataClassType(dataTypeDescriptor, false);\r\n        }\r\n\r\n\r\n\r\n        public static void AddNewAssembly(Assembly assembly)\r\n        {\r\n            AddNewAssembly(assembly, true);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Call this method whan a new assembly is load/added into the app domain.\r\n        /// </summary>\r\n        /// <param name=\"assembly\"></param>\r\n        /// <param name=\"logTypeLoadErrors\"></param>\r\n        public static void AddNewAssembly(Assembly assembly, bool logTypeLoadErrors)\r\n        {\r\n            if (!AssemblyFacade.AssemblyPotentiallyUsesType(assembly, typeof (IData)))\r\n            {\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                var types = assembly.GetTypes();\r\n\r\n                _LoadedDataTypes.AddRange(types.Where(typeof(IData).IsAssignableFrom));\r\n            }\r\n            catch (ReflectionTypeLoadException exception)\r\n            {\r\n                if (logTypeLoadErrors)\r\n                {\r\n                    var exceptionToLog = exception.LoaderExceptions != null ? exception.LoaderExceptions.First() : exception;\r\n\r\n                    Log.LogError(LogTitle, new Exception($\"Failed to load assembly '{assembly.FullName}'\", exceptionToLog));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static bool IsAllowedDataTypeAssembly(Type dataType)\r\n        {\r\n            string assemblyPath = dataType.Assembly.Location;\r\n\r\n            if (assemblyPath.StartsWith(CodeGenerationManager.TempAssemblyFolderPath, StringComparison.InvariantCultureIgnoreCase)) return true;\r\n            if (assemblyPath.StartsWith(CodeGenerationManager.BinFolder, StringComparison.InvariantCultureIgnoreCase)) return true;\r\n\r\n            string assemblyFileName = Path.GetFileName(assemblyPath);\r\n            bool locatedInBinFolder = C1Directory.GetFiles(CodeGenerationManager.BinFolder).Any(f => Path.GetFileName(f).Equals(assemblyFileName, StringComparison.InvariantCultureIgnoreCase));\r\n            if (locatedInBinFolder) return true;\r\n\r\n\r\n            return false;\r\n        }\r\n\r\n        internal static Dictionary<Guid, Type> GetDataTypes(IReadOnlyCollection<DataTypeDescriptor> dataTypeDescriptors)\r\n        {\r\n            var result = new Dictionary<Guid, Type>();\r\n            var toCompile = new List<DataTypeDescriptor>();\r\n\r\n            foreach (var dataTypeDescriptor in dataTypeDescriptors)\r\n            {\r\n                string typeFullName = dataTypeDescriptor.GetFullInterfaceName();\r\n                Type type = _LoadedDataTypes.FirstOrDefault(f => f.FullName == typeFullName);\r\n                if (type == null)\r\n                {\r\n                    bool compilationNeeded;\r\n                    type = InterfaceCodeManager.TryGetType(dataTypeDescriptor, false, out compilationNeeded);\r\n\r\n                    if (compilationNeeded)\r\n                    {\r\n                        toCompile.Add(dataTypeDescriptor);\r\n                    }\r\n                }\r\n\r\n                if (type != null)\r\n                {\r\n                    result[dataTypeDescriptor.DataTypeId] = type;\r\n                }\r\n            }\r\n\r\n            if (toCompile.Any())\r\n            {\r\n                var codeGenerationBuilder = new CodeGenerationBuilder(\"DataTypeTypesManager:compiling missing interfaces\");\r\n\r\n                foreach (var dataTypeDescriptor in toCompile)\r\n                {\r\n                    InterfaceCodeGenerator.AddAssemblyReferences(codeGenerationBuilder, dataTypeDescriptor);\r\n                    InterfaceCodeGenerator.AddInterfaceTypeCode(codeGenerationBuilder, dataTypeDescriptor);\r\n                }\r\n\r\n                var types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder);\r\n                var typesMap = types.ToDictionary(type => type.FullName);\r\n\r\n                foreach (var dataTypeDescriptor in toCompile)\r\n                {\r\n                    var type = typesMap[dataTypeDescriptor.GetFullInterfaceName()];\r\n                    result[dataTypeDescriptor.DataTypeId] = type;\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DefaultFieldRandomStringValueAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data.DynamicTypes;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Sets the field's value to a random base64 string value of the specified length.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class DefaultFieldRandomStringValueAttribute : DefaultFieldValueAttribute\r\n    {\r\n        private static readonly ConcurrentDictionary<Type, IEnumerable<RandomStringValueProperty>> ReflectionCache =\r\n            new ConcurrentDictionary<Type, IEnumerable<RandomStringValueProperty>>();\r\n\r\n        internal int Length { get; private set; }\r\n        internal bool CheckCollisions { get; private set; }\r\n\r\n        private class RandomStringValueProperty\r\n        {\r\n            public PropertyInfo Property;\r\n            public DefaultFieldRandomStringValueAttribute Attribute;\r\n            public bool IsKey;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Sets the field's value to a random base64 string value of the specified length.\r\n        /// </summary>\r\n        /// <param name=\"length\">The length of a generated random string. Allowed range is [3..22].</param>\r\n        /// <param name=\"checkCollisions\">When set to 2, the inserted value will be checked for a collision.</param>\r\n        public DefaultFieldRandomStringValueAttribute(int length = 8, bool checkCollisions = false)\r\n        {\r\n            Verify.ArgumentCondition(length >= 3, \"length\", \"Minimum allowed length is 3 characters\");\r\n            Verify.ArgumentCondition(length <= 22, \"length\", \"Maximum allowed length is 22 characters, which is an equivalent to a Guid value\");\r\n\r\n            Length = length;\r\n            CheckCollisions = checkCollisions;\r\n        }\r\n\r\n        static DefaultFieldRandomStringValueAttribute()\r\n        {\r\n            DataEvents<IData>.OnNew += (sender, arguments) => SetRandomStringFieldValues(arguments.Data, false);\r\n            DataEvents<IData>.OnBeforeAdd += (sender, arguments) => SetRandomStringFieldValues(arguments.Data, true);\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(a => ReflectionCache.Clear());\r\n        }\r\n\r\n        private static void SetRandomStringFieldValues(IData data, bool checkCollisions)\r\n        {\r\n            var interfaceType = data.DataSourceId.InterfaceType;\r\n\r\n            var fieldsToFill = GetRandomStringProperties(interfaceType);\r\n\r\n            foreach (var field in fieldsToFill)\r\n            {\r\n                var value = field.Property.GetValue(data, null);\r\n                if (value != null\r\n                    && (!(checkCollisions && field.Attribute.CheckCollisions)\r\n                        || !ValueIsInUse(interfaceType, field.Property, (string)value, field.IsKey))) continue;\r\n\r\n                string randomString = GenerateNewUniqueValue(interfaceType, field);\r\n\r\n                field.Property.SetValue(data, randomString);\r\n            }\r\n        }\r\n\r\n        private static string GenerateNewUniqueValue(Type interfaceType, RandomStringValueProperty field)\r\n        {\r\n            string randomString = GenerateRandomString(field.Attribute.Length);\r\n\r\n            if (field.Attribute.CheckCollisions)\r\n            {\r\n                bool uniqueValueFound = false;\r\n\r\n                const int tries = 2;\r\n                for (int i = 0; i < tries; i++)\r\n                {\r\n                    if (!ValueIsInUse(interfaceType, field.Property, randomString, field.IsKey))\r\n                    {\r\n                        uniqueValueFound = true;\r\n                        break;\r\n                    }\r\n\r\n                    randomString = GenerateRandomString(field.Attribute.Length);\r\n                }\r\n\r\n                if (!uniqueValueFound)\r\n                {\r\n                    Verify.That(uniqueValueFound, \"Failed to generate a unique random string value after {0} tries. Field name: {1}, random value length: {2}\",\r\n                        tries, field.Property.Name, field.Attribute.Length);\r\n                }\r\n            }\r\n\r\n            return randomString;\r\n        }\r\n\r\n        private static bool ValueIsInUse(Type interfaceType, PropertyInfo property, string value, bool isKeyField)\r\n        {\r\n            if (isKeyField)\r\n            {\r\n                var keyCollection = new DataKeyPropertyCollection();\r\n                keyCollection.AddKeyProperty(property, value);\r\n\r\n                return DataFacade.TryGetDataByUniqueKey(interfaceType, keyCollection) != null;\r\n            }\r\n\r\n            var parameter = Expression.Parameter(interfaceType, \"data\");\r\n            var predicateExpression = ExpressionHelper.CreatePropertyPredicate(parameter, new[]\r\n            {\r\n                new Tuple<PropertyInfo, object>(property, value)\r\n            });\r\n\r\n            Type delegateType = typeof(Func<,>).MakeGenericType(new [] { interfaceType, typeof(bool) });\r\n\r\n            LambdaExpression lambdaExpression = Expression.Lambda(delegateType, predicateExpression, new [] { parameter });\r\n\r\n            MethodInfo methodInfo = DataFacade.GetGetDataWithPredicatMethodInfo(interfaceType);\r\n\r\n            var queryable = (IQueryable)methodInfo.Invoke(null, new object[] { lambdaExpression });\r\n\r\n            return queryable.OfType<IData>().Any();\r\n        }\r\n\r\n        private static string GenerateRandomString(int length)\r\n        {\r\n            return UrlUtils.CompressGuid(Guid.NewGuid()).Substring(0, length);\r\n        }\r\n\r\n        private static IEnumerable<RandomStringValueProperty> GetRandomStringProperties(Type interfaceType)\r\n        {\r\n            return ReflectionCache.GetOrAdd(interfaceType, type =>\r\n            {\r\n                List<RandomStringValueProperty> result = null;\r\n\r\n                var stringProperties = type.GetPropertiesRecursively().Where(property => property.PropertyType == typeof(string));\r\n                foreach (var property in stringProperties)\r\n                {\r\n                    var attribute = property.GetCustomAttribute<DefaultFieldRandomStringValueAttribute>(true);\r\n                    if (attribute == null) continue;\r\n\r\n                    result = result ?? new List<RandomStringValueProperty>();\r\n\r\n                    var keyPropertyNames = type.GetKeyPropertyNames();\r\n\r\n                    bool isKey = keyPropertyNames.Count == 1 && keyPropertyNames[0] == property.Name;\r\n\r\n                    result.Add(new RandomStringValueProperty { Attribute = attribute, Property = property, IsKey = isKey});\r\n                }\r\n\r\n                return result ?? Enumerable.Empty<RandomStringValueProperty>();\r\n            });\r\n        }\r\n\r\n        /// <exclude />\r\n        public override DefaultValue GetDefaultValue()\r\n        {\r\n            return DefaultValue.RandomString(Length, CheckCollisions);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DefaultFieldValueAttribute.cs",
    "content": "using System;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// This abstract class is used by data providers when a new column is added to a table. Extend this class to create your own.\r\n    /// </summary>\r\n    public abstract class DefaultFieldValueAttribute : Attribute\r\n\t{\r\n        internal DefaultFieldValueAttribute() { }\r\n\r\n        /// <exclude />\r\n        public abstract DefaultValue GetDefaultValue();        \r\n\t}\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Associate a static default value to a string property on a data type.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class DefaultFieldStringValueAttribute : DefaultFieldValueAttribute\r\n    {\r\n        private readonly string _defaultValue;\r\n\r\n\r\n        /// <summary>    \r\n        /// Associate a static default value to a string property on a data type.\r\n        /// </summary>\r\n        public DefaultFieldStringValueAttribute(string defaultValue)\r\n        {\r\n            if (defaultValue == null) throw new ArgumentNullException(\"defaultValue\");\r\n            _defaultValue = defaultValue;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override DefaultValue GetDefaultValue()\r\n        {\r\n            return DefaultValue.String(_defaultValue);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Associate a static default value to an integer property on a data type.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class DefaultFieldIntValueAttribute : DefaultFieldValueAttribute\r\n    {\r\n        private readonly int _defaultValue;\r\n\r\n\r\n        /// <summary>    \r\n        /// Associate a static default value to an integer property on a data type.\r\n        /// </summary>\r\n        public DefaultFieldIntValueAttribute(int defaultValue)\r\n        {\r\n            _defaultValue = defaultValue;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override DefaultValue GetDefaultValue()\r\n        {\r\n            return DefaultValue.Integer(_defaultValue);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Associate a static default value to a decimal property on a data type.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class DefaultFieldDecimalValueAttribute : DefaultFieldValueAttribute\r\n    {\r\n        private readonly decimal _defaultValue;\r\n\r\n        /// <summary>\r\n        /// Decimals are not allowed as attribute parameter values. They are structs.\r\n        /// Use int value.\r\n        /// </summary>\r\n        /// <param name=\"defaultValue\"></param>\r\n        public DefaultFieldDecimalValueAttribute(int defaultValue)\r\n        {\r\n            _defaultValue = defaultValue;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override DefaultValue GetDefaultValue()\r\n        {\r\n            return DefaultValue.Decimal(_defaultValue);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Associate a static default value to a boolean property on a data type.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class DefaultFieldBoolValueAttribute : DefaultFieldValueAttribute\r\n    {\r\n        private readonly bool _defaultValue;\r\n\r\n\r\n        /// <summary>    \r\n        /// Associate a static default value to a boolean property on a data type.\r\n        /// </summary>\r\n        public DefaultFieldBoolValueAttribute(bool defaultValue)\r\n        {\r\n            _defaultValue = defaultValue;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override DefaultValue GetDefaultValue()\r\n        {\r\n            return DefaultValue.Boolean(_defaultValue);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Associate a static default value to a GUID property on a data type.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class DefaultFieldGuidValueAttribute : DefaultFieldValueAttribute\r\n    {\r\n        private readonly Guid _defaultValue;\r\n\r\n\r\n        /// <summary>    \r\n        /// Associate a static default value to a GUID property on a data type.\r\n        /// </summary>\r\n        public DefaultFieldGuidValueAttribute(string guidString)\r\n        {\r\n            _defaultValue = new Guid(guidString);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override DefaultValue GetDefaultValue()\r\n        {\r\n            return DefaultValue.Guid(_defaultValue);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Associate a random new GUID to a GUID property on a data type.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class DefaultFieldNewGuidValueAttribute : DefaultFieldValueAttribute\r\n    {\r\n        /// <exclude />\r\n        public override DefaultValue GetDefaultValue()\r\n        {\r\n            return DefaultValue.NewGuid;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// Associate the current date and time to a DateTime property on a data type.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class DefaultFieldNowDateTimeValueAttribute : DefaultFieldValueAttribute\r\n    {\r\n        /// <exclude />\r\n        public override DefaultValue GetDefaultValue()\r\n        {\r\n            return DefaultValue.Now;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/Configuration/XmlConfigurationExtensionMethods.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Data.DynamicTypes.Configuration\r\n{\r\n    internal static class XmlConfigurationExtensionMethods\r\n    {\r\n        public static XAttribute GetRequiredAttribute(this XElement configurationElement, XName attributeName)\r\n        {\r\n            XAttribute result = configurationElement.Attribute(attributeName);\r\n\r\n            if (result == null)\r\n            {\r\n                ThrowConfigurationError(\"Missing required attribute '{0}'\".FormatWith(attributeName), configurationElement);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        public static XElement GetRequiredElement(this XElement configurationElement, XName elementName)\r\n        {\r\n            var element = configurationElement.Element(elementName);\r\n\r\n            if (element == null)\r\n            {\r\n                ThrowConfigurationError(\"Missing required element <{0}>\".FormatWith(elementName), configurationElement);\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n        public static string GetRequiredAttributeValue(this XElement configurationElement, XName attributeName)\r\n        {\r\n            string result = (string)configurationElement.Attribute(attributeName);\r\n\r\n            if (string.IsNullOrEmpty(result))\r\n            {\r\n                ThrowConfigurationError(\"Required attribute '{0}' is missing or empty\".FormatWith(attributeName), configurationElement);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        public static void ThrowConfigurationError(string message, XObject configurationXObject)\r\n        {\r\n            var document = configurationXObject.Document;\r\n            if (document != null && !string.IsNullOrEmpty(document.BaseUri) && (configurationXObject as IXmlLineInfo).HasLineInfo())\r\n            {\r\n                string fileName = GetFileName(document);\r\n                int lineNumber = (configurationXObject as IXmlLineInfo).LineNumber;\r\n\r\n                throw new ConfigurationErrorsException(message, fileName, lineNumber);\r\n            }\r\n\r\n            throw new InvalidOperationException(message);\r\n        }\r\n\r\n        public static Exception GetConfigurationException(string message, Exception innerException, XObject configurationXObject)\r\n        {\r\n            var document = configurationXObject.Document;\r\n            if (document != null && !string.IsNullOrEmpty(document.BaseUri) && (configurationXObject as IXmlLineInfo).HasLineInfo())\r\n            {\r\n                string fileName = GetFileName(document);\r\n                int lineNumber = (configurationXObject as IXmlLineInfo).LineNumber;\r\n\r\n                throw new ConfigurationErrorsException(message, innerException, fileName, lineNumber);\r\n            }\r\n\r\n            throw new InvalidOperationException(message, innerException);\r\n        }\r\n\r\n        private static string GetFileName(XDocument document)\r\n        {\r\n            const string fileUriPrefix = \"file:///\";\r\n            string baseUri = document.BaseUri;\r\n\r\n            return baseUri.StartsWith(fileUriPrefix, StringComparison.Ordinal)\r\n                ? baseUri.Substring(fileUriPrefix.Length)\r\n                : baseUri;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataAssociationDescriptor.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class DataTypeAssociationDescriptor\r\n\t{\r\n        /// <exclude />\r\n        public DataTypeAssociationDescriptor(Type associatedInterfaceType, string foreignKeyPropertyName, DataAssociationType dataAssociationType)\r\n        {\r\n            this.AssociatedInterfaceType = associatedInterfaceType;\r\n            this.ForeignKeyPropertyName = foreignKeyPropertyName;\r\n            this.AssociationType = dataAssociationType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type AssociatedInterfaceType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ForeignKeyPropertyName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataAssociationType AssociationType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement ToXml()\r\n        {\r\n            return new XElement(\"DataTypeAssociationDescriptor\",\r\n                new XAttribute(\"associatedInterfaceType\", TypeManager.SerializeType(this.AssociatedInterfaceType)),\r\n                new XAttribute(\"foreignKeyPropertyName\", this.ForeignKeyPropertyName),\r\n                new XAttribute(\"associationType\", this.AssociationType));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static DataTypeAssociationDescriptor FromXml(XElement element)\r\n        {\r\n            if (element.Name != \"DataTypeAssociationDescriptor\") throw new ArgumentException(\"The xml is not correctly formattet\");\r\n\r\n            XAttribute associatedInterfaceTypeAttribute = element.Attribute(\"associatedInterfaceType\");\r\n            XAttribute foreignKeyPropertyNameAttribute = element.Attribute(\"foreignKeyPropertyName\");\r\n            XAttribute associationTypeAttribute = element.Attribute(\"associationType\");\r\n\r\n            if ((associatedInterfaceTypeAttribute == null) || (foreignKeyPropertyNameAttribute == null) || (associatedInterfaceTypeAttribute == null)) throw new ArgumentException(\"The xml is not correctly formattet\");\r\n\r\n            Type associatedInterfaceType = TypeManager.GetType(associatedInterfaceTypeAttribute.Value);\r\n            string foreignKeyPropertyName = foreignKeyPropertyNameAttribute.Value;\r\n            DataAssociationType dataAssociationType = (DataAssociationType)Enum.Parse(typeof(DataAssociationType), associationTypeAttribute.Value);\r\n\r\n            return new DataTypeAssociationDescriptor(associatedInterfaceType, foreignKeyPropertyName, dataAssociationType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as DataTypeAssociationDescriptor);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(DataTypeAssociationDescriptor dataTypeAssociationDescriptor)\r\n        {\r\n            if (dataTypeAssociationDescriptor == null) return false;\r\n\r\n            return\r\n                this.AssociatedInterfaceType == dataTypeAssociationDescriptor.AssociatedInterfaceType &&\r\n                this.ForeignKeyPropertyName == dataTypeAssociationDescriptor.ForeignKeyPropertyName &&\r\n                this.AssociationType == dataTypeAssociationDescriptor.AssociationType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataTypeAssociationDescriptor Clone()\r\n        {\r\n            return new DataTypeAssociationDescriptor(AssociatedInterfaceType, ForeignKeyPropertyName, AssociationType);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return\r\n                this.AssociatedInterfaceType.GetHashCode() ^\r\n                this.ForeignKeyPropertyName.GetHashCode() ^\r\n                this.AssociationType.GetHashCode();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataFieldDescriptor.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes.Configuration;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>\r\n    /// Describe a field on a <see cref=\"DataTypeDescriptor\"/>.\r\n    /// </summary>\r\n    [Serializable]\r\n    [DebuggerDisplay(\"Name = {Name}, Inherited = {Inherited}\")]\r\n    public sealed class DataFieldDescriptor\r\n    {\r\n        private bool _isNullable;\r\n        private StoreFieldType _storeType;\r\n        private DefaultValue _defaultValue;\r\n        private string _name;\r\n\r\n        private readonly Guid _id;\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance.\r\n        /// </summary>\r\n        /// <param name=\"id\">Permanent unique id for this field. This should never change.</param>\r\n        /// <param name=\"name\">Name (programmatic) of field.</param>\r\n        /// <param name=\"storeType\">Type to use when storing field.</param>\r\n        /// <param name=\"instanceType\">Type to use when field is exposed to .NET.</param>\r\n        public DataFieldDescriptor(Guid id, string name, StoreFieldType storeType, Type instanceType)\r\n            : this(id, name, storeType, instanceType, false)\r\n        {\r\n            _id = id;\r\n            _name = NameValidation.ValidateName(name);\r\n            this.StoreType = storeType;\r\n            this.InstanceType = instanceType;            \r\n            this.FormRenderingProfile = new DataFieldFormRenderingProfile();\r\n            this.TreeOrderingProfile = new DataFieldTreeOrderingProfile();\r\n            this.IsReadOnly = false;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Constructs a new instance.\r\n        /// </summary>\r\n        /// <param name=\"id\">Permanent unique id for this field. This should never change.</param>\r\n        /// <param name=\"name\">Name (programmatic) of field </param>\r\n        /// <param name=\"storeType\">Type to use when storing field</param>\r\n        /// <param name=\"instanceType\">Type to use when field is exposed to .NET</param>\r\n        /// <param name=\"inherited\">True when this field is inherited from a super interface.</param>\r\n        public DataFieldDescriptor(Guid id, string name, StoreFieldType storeType, Type instanceType, bool inherited)\r\n        {\r\n            _id = id;\r\n            _name = NameValidation.ValidateName(name);\r\n            this.StoreType = storeType;\r\n            this.InstanceType = instanceType;\r\n            this.FormRenderingProfile = new DataFieldFormRenderingProfile();\r\n            this.TreeOrderingProfile = new DataFieldTreeOrderingProfile();\r\n            this.Inherited = inherited;\r\n            this.IsReadOnly = false;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Position, relative to other fields.\r\n        /// </summary>\r\n        public int Position { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// For grouping (ex. tree views), the priority of this field, relative to other fields. Lowest number gets grouped first. \r\n        /// 0 means no grouping on this field.\r\n        /// </summary>\r\n        public int GroupByPriority { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Describe how this field should be edited in a form view\r\n        /// </summary>\r\n        public DataFieldFormRenderingProfile FormRenderingProfile { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Describe how this field should be part of a URL\r\n        /// </summary>\r\n        public DataUrlProfile DataUrlProfile { get; set; }\r\n\r\n        /// <summary>\r\n        /// Describe whether the field should be a part of search index.\r\n        /// </summary>\r\n        public SearchProfile SearchProfile { get; set; }\r\n\r\n        /// <summary>\r\n        /// Describe how this field should influence ordering of items in a tree view\r\n        /// </summary>\r\n        public DataFieldTreeOrderingProfile TreeOrderingProfile { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Specify the TypeManager type name for the type this field references. Null if this is not a reference field.\r\n        /// </summary>\r\n        public string ForeignKeyReferenceTypeName { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The CLR type of the field.\r\n        /// </summary>\r\n        public Type InstanceType { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Programmatic name of the field.\r\n        /// </summary>\r\n        public string Name\r\n        {\r\n            get { return _name; }\r\n            set { _name = NameValidation.ValidateName(value); }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Permanent unique id for the field. This should never change.\r\n        /// </summary>\r\n        public Guid Id => _id;\r\n\r\n\r\n        /// <summary>\r\n        /// Describe how this field should be sored physically.\r\n        /// </summary>\r\n        public StoreFieldType StoreType\r\n        {\r\n            get { return _storeType; }\r\n            set\r\n            {\r\n                _storeType = value;\r\n                if (_defaultValue != null && !_defaultValue.IsAssignableTo(_storeType))\r\n                {\r\n                    _defaultValue = null;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Default value for the field, to be used for the physical store. See also <see cref=\"NewInstanceDefaultFieldValue\"/>\r\n        /// </summary>\r\n        public DefaultValue DefaultValue\r\n        {\r\n            get\r\n            {\r\n                return _defaultValue;\r\n            }\r\n            set\r\n            {\r\n                if (value != null && !value.IsAssignableTo(_storeType))\r\n                {\r\n                    throw new InvalidOperationException(\"The DefaultValue must be assignable to the StoreType\");\r\n                }\r\n\r\n                _defaultValue = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// True when this field can be NULL\r\n        /// </summary>\r\n        public bool IsNullable\r\n        {\r\n            get { return _isNullable; }\r\n            set\r\n            {\r\n                if (value)\r\n                {\r\n                    var type = InstanceType;\r\n\r\n                    if (type.IsEnum) throw new InvalidOperationException(\"The associated instance type is an enum, which is not nullable\");\r\n                    if (type.IsValueType && (!type.IsGenericType || type.GetGenericTypeDefinition() != typeof(Nullable<>)))\r\n                    {\r\n                        throw new InvalidOperationException(string.Format(\"The associated instante type '{0}' is a value type, which is not nullable\", type.Name));\r\n                    }\r\n                }\r\n                _isNullable = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// True when this field is inherited from a super interface.\r\n        /// </summary>\r\n        public bool Inherited\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// True when data in this field can not be changed.\r\n        /// </summary>\r\n        public bool IsReadOnly\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Function markup that can deliver validators for this field. They will execute and validate if values set on this field is valid.\r\n        /// </summary>\r\n        public List<string> ValidationFunctionMarkup\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Default value to set on new instances of this field.\r\n        /// </summary>\r\n        public string NewInstanceDefaultFieldValue\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Create a clone of this field.\r\n        /// </summary>\r\n        /// <returns>The clone.</returns>\r\n        public DataFieldDescriptor Clone()\r\n        {\r\n            return new DataFieldDescriptor(this.Id, this.Name, this.StoreType, this.InstanceType)\r\n            {\r\n                ForeignKeyReferenceTypeName = this.ForeignKeyReferenceTypeName,\r\n                FormRenderingProfile = new DataFieldFormRenderingProfile\r\n                {\r\n                    HelpText = this.FormRenderingProfile.HelpText,\r\n                    Label = this.FormRenderingProfile.Label,\r\n                    WidgetFunctionMarkup = this.FormRenderingProfile.WidgetFunctionMarkup\r\n                },\r\n                TreeOrderingProfile = new DataFieldTreeOrderingProfile\r\n                {\r\n                    OrderPriority = this.TreeOrderingProfile.OrderPriority,\r\n                    OrderDescending = this.TreeOrderingProfile.OrderDescending\r\n                },\r\n                GroupByPriority = this.GroupByPriority,\r\n                Inherited = this.Inherited,\r\n                IsNullable = this.IsNullable,\r\n                Position = this.Position,\r\n                ValidationFunctionMarkup = this.ValidationFunctionMarkup != null ? new List<string>(this.ValidationFunctionMarkup) : null,\r\n                NewInstanceDefaultFieldValue = this.NewInstanceDefaultFieldValue,\r\n                DataUrlProfile = this.DataUrlProfile?.Clone(),\r\n                SearchProfile = this.SearchProfile?.Clone(),\r\n                DefaultValue = this.DefaultValue?.Clone()\r\n            };\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Serialize this field description XML.\r\n        /// </summary>\r\n        /// <returns>Serialized field descriptor.</returns>\r\n        public XElement ToXml()\r\n        {\r\n            var element = new XElement(\"DataFieldDescriptor\",\r\n                new XAttribute(\"id\", this.Id),\r\n                new XAttribute(\"name\", this.Name),\r\n                new XAttribute(\"isNullable\", this.IsNullable),\r\n                new XAttribute(\"position\", this.Position),\r\n                new XAttribute(\"groupByPriority\", this.GroupByPriority),\r\n                new XAttribute(\"inherited\", this.Inherited),\r\n                new XAttribute(\"instanceType\", TypeManager.SerializeType(this.InstanceType)),\r\n                new XAttribute(\"storeType\", this.StoreType.Serialize()),\r\n                new XAttribute(\"isReadOnly\", this.IsReadOnly));\r\n            \r\n            if (this.NewInstanceDefaultFieldValue != null)\r\n            {\r\n                element.Add(new XAttribute(\"newInstanceDefaultFieldValue\", this.NewInstanceDefaultFieldValue));\r\n            }\r\n\r\n            if (this.DefaultValue != null)\r\n            {\r\n                element.Add(new XAttribute(\"defaultValue\", this.DefaultValue.Serialize()));\r\n            }\r\n\r\n            if (this.ForeignKeyReferenceTypeName != null)\r\n            {\r\n                element.Add(new XAttribute(\"foreignKeyReferenceTypeName\", this.ForeignKeyReferenceTypeName));\r\n            }\r\n\r\n            if (this.FormRenderingProfile != null)\r\n            {\r\n                XElement formRenderingProfileElement = new XElement(\"FormRenderingProfile\");\r\n                if (this.FormRenderingProfile.Label != null)\r\n                {\r\n                    formRenderingProfileElement.Add(new XAttribute(\"label\", this.FormRenderingProfile.Label));\r\n                }\r\n                if (this.FormRenderingProfile.HelpText != null)\r\n                {\r\n                    formRenderingProfileElement.Add(new XAttribute(\"helpText\", this.FormRenderingProfile.HelpText));\r\n                }\r\n                if (this.FormRenderingProfile.WidgetFunctionMarkup != null)\r\n                {\r\n                    formRenderingProfileElement.Add(new XAttribute(\"widgetFunctionMarkup\", this.FormRenderingProfile.WidgetFunctionMarkup));\r\n                }\r\n                element.Add(formRenderingProfileElement);\r\n            }\r\n\r\n            if (this.DataUrlProfile != null)\r\n            {\r\n                element.Add(new XElement(\"DataUrlProfile\",\r\n                    new XAttribute(\"Order\", this.DataUrlProfile.Order),\r\n                    this.DataUrlProfile.Format != null ? new XAttribute(\"Format\", this.DataUrlProfile.Format) : null));\r\n            }\r\n\r\n            if (this.SearchProfile != null)\r\n            {\r\n                element.Add(new XElement(nameof(SearchProfile),\r\n                    new XAttribute(CamelCase(nameof(SearchProfile.IndexText)), this.SearchProfile.IndexText),\r\n                    new XAttribute(CamelCase(nameof(SearchProfile.EnablePreview)), this.SearchProfile.EnablePreview),\r\n                    new XAttribute(CamelCase(nameof(SearchProfile.IsFacet)), this.SearchProfile.IsFacet)));\r\n            }\r\n\r\n            if (this.TreeOrderingProfile?.OrderPriority != null)\r\n            {\r\n                element.Add(new XElement(\"TreeOrderingProfile\", \r\n                    new XAttribute(\"orderPriority\", this.TreeOrderingProfile.OrderPriority),\r\n                    new XAttribute(\"orderDescending\", this.TreeOrderingProfile.OrderDescending)));\r\n            }\r\n\r\n            if (this.ValidationFunctionMarkup != null)\r\n            {\r\n                XElement elementValidationFunctionMarkup = new XElement(\"ValidationFunctionMarkups\");\r\n                foreach (string validationFunctionMarkup in this.ValidationFunctionMarkup)\r\n                {\r\n                    elementValidationFunctionMarkup.Add(new XElement(\"ValidationFunctionMarkup\", new XAttribute(\"markup\", validationFunctionMarkup)));\r\n                }\r\n                element.Add(elementValidationFunctionMarkup);\r\n            }\r\n\r\n\r\n            return element;\r\n        }\r\n\r\n        private static string CamelCase(string str)\r\n        {\r\n            return char.ToLowerInvariant(str[0]) + str.Substring(1);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Deserialize a <see cref=\"DataFieldDescriptor\"/>.\r\n        /// </summary>\r\n        /// <param name=\"element\">Deserialized DataFieldDescriptor</param>\r\n        /// <returns></returns>\r\n        public static DataFieldDescriptor FromXml(XElement element)\r\n        {\r\n            if (element.Name != \"DataFieldDescriptor\") throw new ArgumentException(\"The xml is not correctly formatted\");\r\n\r\n            Guid id = (Guid)element.GetRequiredAttribute(\"id\");\r\n            string name = element.GetRequiredAttributeValue(\"name\");\r\n            bool isNullable = (bool)element.GetRequiredAttribute(\"isNullable\");\r\n            int position = (int)element.GetRequiredAttribute(\"position\");\r\n            bool inherited = (bool)element.GetRequiredAttribute(\"inherited\");\r\n            XAttribute groupByPriorityAttribute = element.Attribute(\"groupByPriority\");\r\n            XAttribute instanceTypeAttribute = element.GetRequiredAttribute(\"instanceType\");\r\n            XAttribute storeTypeAttribute = element.GetRequiredAttribute(\"storeType\");\r\n            XAttribute isReadOnlyAttribute = element.Attribute(\"isReadOnly\");\r\n            XAttribute newInstanceDefaultFieldValueAttribute = element.Attribute(\"newInstanceDefaultFieldValue\");\r\n\r\n\r\n            bool isReadOnly = isReadOnlyAttribute != null && (bool) isReadOnlyAttribute;\r\n            int groupByPriority = groupByPriorityAttribute != null ? (int)groupByPriorityAttribute : 0;\r\n\r\n            XAttribute defaultValueAttribute = element.Attribute(\"defaultValue\");\r\n            XAttribute foreignKeyReferenceTypeNameAttribute = element.Attribute(\"foreignKeyReferenceTypeName\");\r\n            XElement formRenderingProfileElement = element.Element(\"FormRenderingProfile\");\r\n            XElement treeOrderingProfileElement = element.Element(\"TreeOrderingProfile\");\r\n            XElement validationFunctionMarkupsElement = element.Element(\"ValidationFunctionMarkups\");\r\n            XElement dataUrlProfileElement = element.Element(\"DataUrlProfile\");\r\n            XElement searchProfileElement = element.Element(nameof(SearchProfile));\r\n            \r\n            \r\n            \r\n            Type instanceType = TypeManager.GetType(instanceTypeAttribute.Value);\r\n            StoreFieldType storeType = StoreFieldType.Deserialize(storeTypeAttribute.Value);\r\n\r\n            var dataFieldDescriptor = new DataFieldDescriptor(id, name, storeType, instanceType, inherited)\r\n            {\r\n                IsNullable = isNullable,\r\n                Position = position,\r\n                GroupByPriority = groupByPriority,\r\n                IsReadOnly = isReadOnly\r\n            };\r\n\r\n            if (newInstanceDefaultFieldValueAttribute != null)\r\n            {\r\n                dataFieldDescriptor.NewInstanceDefaultFieldValue = newInstanceDefaultFieldValueAttribute.Value;\r\n            }\r\n\r\n            if (defaultValueAttribute != null)\r\n            {\r\n                DefaultValue defaultValue = DefaultValue.Deserialize(defaultValueAttribute.Value);\r\n                dataFieldDescriptor.DefaultValue = defaultValue;\r\n            }\r\n\r\n            if (foreignKeyReferenceTypeNameAttribute != null)\r\n            {\r\n                string typeName = foreignKeyReferenceTypeNameAttribute.Value;\r\n\r\n                typeName = TypeManager.FixLegasyTypeName(typeName);\r\n\r\n                dataFieldDescriptor.ForeignKeyReferenceTypeName = typeName;\r\n            }\r\n\r\n            if (formRenderingProfileElement != null)\r\n            {\r\n                XAttribute labelAttribute = formRenderingProfileElement.Attribute(\"label\");\r\n                XAttribute helpTextAttribute = formRenderingProfileElement.Attribute(\"helpText\");\r\n                XAttribute widgetFunctionMarkupAttribute = formRenderingProfileElement.Attribute(\"widgetFunctionMarkup\");\r\n\r\n                var dataFieldFormRenderingProfile = new DataFieldFormRenderingProfile();\r\n\r\n                if (labelAttribute != null)\r\n                {\r\n                    dataFieldFormRenderingProfile.Label = labelAttribute.Value;\r\n                }\r\n\r\n                if (helpTextAttribute != null)\r\n                {\r\n                    dataFieldFormRenderingProfile.HelpText = helpTextAttribute.Value;\r\n                }\r\n\r\n                if (widgetFunctionMarkupAttribute != null)\r\n                {\r\n                    dataFieldFormRenderingProfile.WidgetFunctionMarkup = widgetFunctionMarkupAttribute.Value;\r\n                }\r\n\r\n                dataFieldDescriptor.FormRenderingProfile = dataFieldFormRenderingProfile;\r\n            }\r\n\r\n            if (dataUrlProfileElement != null)\r\n            {\r\n                int order = (int)dataUrlProfileElement.GetRequiredAttribute(\"Order\");\r\n                var formatStr = (string)dataUrlProfileElement.Attribute(\"Format\");\r\n                DataUrlSegmentFormat? format = null;\r\n\r\n                if (formatStr != null)\r\n                {\r\n                    format = (DataUrlSegmentFormat) Enum.Parse(typeof(DataUrlSegmentFormat), formatStr);\r\n                }\r\n\r\n                dataFieldDescriptor.DataUrlProfile = new DataUrlProfile {Order = order, Format = format};\r\n            }\r\n\r\n            if (searchProfileElement != null)\r\n            {\r\n                Func<string, bool> getAttr = fieldName => (bool)searchProfileElement.GetRequiredAttribute(CamelCase(fieldName));\r\n\r\n                dataFieldDescriptor.SearchProfile = new SearchProfile\r\n                {\r\n                    IndexText = getAttr(nameof(DynamicTypes.SearchProfile.IndexText)),\r\n                    EnablePreview = getAttr(nameof(DynamicTypes.SearchProfile.EnablePreview)),\r\n                    IsFacet = getAttr(nameof(DynamicTypes.SearchProfile.IsFacet))\r\n                };\r\n            }\r\n\r\n            if (treeOrderingProfileElement != null)\r\n            {\r\n                int? orderPriority = (int?)treeOrderingProfileElement.Attribute(\"orderPriority\");\r\n                bool orderDescending = (bool)treeOrderingProfileElement.Attribute(\"orderDescending\");\r\n\r\n                dataFieldDescriptor.TreeOrderingProfile = new DataFieldTreeOrderingProfile\r\n                {\r\n                    OrderPriority = orderPriority, \r\n                    OrderDescending = orderDescending\r\n                };\r\n            }\r\n\r\n            dataFieldDescriptor.ValidationFunctionMarkup = new List<string>();\r\n            if (validationFunctionMarkupsElement != null)\r\n            {                \r\n                foreach (XElement validationFunctionMarkupElement in validationFunctionMarkupsElement.Elements(\"ValidationFunctionMarkup\"))\r\n                {\r\n                    string markup = validationFunctionMarkupElement.GetRequiredAttributeValue(\"markup\");\r\n\r\n                    dataFieldDescriptor.ValidationFunctionMarkup.Add(markup);\r\n                }\r\n            }\r\n\r\n            return dataFieldDescriptor;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as DataFieldDescriptor);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            return dataFieldDescriptor != null && dataFieldDescriptor.Id == Id;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return this.Id.GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataFieldDescriptorCollection.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataFieldDescriptorCollection : IEnumerable<DataFieldDescriptor>\r\n    {\r\n        private readonly DataTypeDescriptor _parent;\r\n        private readonly List<DataFieldDescriptor> _descriptors = new List<DataFieldDescriptor>();\r\n\r\n\r\n        internal DataFieldDescriptorCollection(DataTypeDescriptor parent) \r\n        {\r\n            _parent = parent;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int Count\r\n        {\r\n            get { return _descriptors.Count; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Add(DataFieldDescriptor descriptor)\r\n        {\r\n            Verify.ArgumentNotNull(descriptor, \"descriptor\");\r\n\r\n            if (_descriptors.Contains(descriptor))\r\n            {\r\n                throw new ArgumentException(\"The specifed DataFieldDescriptor with ID '{0}' has already been added. \".FormatWith(descriptor.Id) +\r\n                                            \"Developers should ensure that the Immutable Field Id is unique on all fields.\");\r\n            }\r\n\r\n            if (this[descriptor.Name] != null)\r\n            {\r\n                throw new InvalidOperationException(\"The specified field name '{0}' is in use by another DataFieldDescriptor\".FormatWith(descriptor.Name));\r\n            }\r\n            if (this[descriptor.Id] != null)\r\n            {\r\n                throw new InvalidOperationException(\"The specified field Id '{0}' is in use by another DataFieldDescriptor\".FormatWith(descriptor.Id));\r\n            }\r\n\r\n            _descriptors.Add(descriptor);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Insert(int index, DataFieldDescriptor descriptor)\r\n        {\r\n            Verify.ArgumentNotNull(descriptor, \"descriptor\");\r\n\r\n            if (_descriptors.Contains(descriptor)) throw new ArgumentException(\"The specified DataFieldDescriptor with ID '{0}' has already been added\".FormatWith(descriptor.Id));\r\n\r\n            if (this[descriptor.Name] != null)\r\n            {\r\n                throw new InvalidOperationException(\"The specified field name '{0}' is in use by another DataFieldDescriptor\".FormatWith(descriptor.Name));\r\n            }\r\n\r\n            if (this[descriptor.Id] != null)\r\n            {\r\n                throw new InvalidOperationException(\"The specified field Id '{0}' is in use by another DataFieldDescriptor\".FormatWith(descriptor.Id));\r\n            }\r\n\r\n            _descriptors.Insert(index, descriptor);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Remove(DataFieldDescriptor descriptor)\r\n        {\r\n            Verify.ArgumentNotNull(descriptor, \"descriptor\");\r\n            if (!_descriptors.Contains(descriptor)) throw new ArgumentException(\"The specified DataFieldDescriptor was not found\");\r\n            if (_parent.KeyPropertyNames.Contains(descriptor.Name)) throw new ArgumentException(\"The DataFieldDescriptor can not be removed while it is a member of the key field list.\");\r\n            if (_parent.StoreSortOrderFieldNames.Contains(descriptor.Name)) throw new ArgumentException(\"The DataFieldDescriptor can not be removed while it is a member of the physical sort order field list.\");\r\n\r\n            _descriptors.Remove(descriptor);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Contains(DataFieldDescriptor descriptor)\r\n        {\r\n            Verify.ArgumentNotNull(descriptor, \"descriptor\");\r\n\r\n            return _descriptors.Contains(descriptor);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataFieldDescriptor this[string name]\r\n        {\r\n            get { return _descriptors.SingleOrDefault(d => d.Name == name); }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataFieldDescriptor this[Guid id]\r\n        {\r\n            get { return _descriptors.SingleOrDefault(d => d.Id == id); }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerator<DataFieldDescriptor> GetEnumerator()\r\n        {\r\n            return _descriptors.OrderBy(f => f.Position).GetEnumerator();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            return _descriptors.OrderBy(f => f.Position).GetEnumerator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataFieldDescriptorValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Core.Serialization;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    internal sealed class DataFieldDescriptorValueXmlSerializer : IValueXmlSerializer\r\n\t{\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n\r\n            serializedObject = null;\r\n\r\n            if (objectToSerializeType != typeof(DataFieldDescriptor)) return false;\r\n\r\n            if (objectToSerialize == null)\r\n            {\r\n                serializedObject = new XElement(\"DataFieldDescriptor\");\r\n            }\r\n            else\r\n            {\r\n                DataFieldDescriptor dataFieldDescriptor = (DataFieldDescriptor)objectToSerialize;\r\n\r\n                serializedObject = dataFieldDescriptor.ToXml();\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject.Name.LocalName != \"DataFieldDescriptor\") return false;\r\n\r\n            if (!serializedObject.Elements().Any())\r\n            {\r\n                deserializedObject = null;\r\n            }\r\n            else\r\n            {\r\n                deserializedObject = DataFieldDescriptor.FromXml(serializedObject);\r\n            }\r\n\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataFieldFormRenderingProfile.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable()]\r\n    public class DataFieldFormRenderingProfile\r\n    {\r\n        /// <exclude />\r\n        public virtual string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public virtual string HelpText { get; set; }\r\n\r\n        /// <exclude />\r\n        public virtual string WidgetFunctionMarkup { get; set; }\r\n    }\r\n\r\n\r\n\r\n    [Serializable()]\r\n    internal class LazyDataFieldFormRenderingProfile : DataFieldFormRenderingProfile\r\n    {\r\n        [NonSerialized]\r\n        private string _widgetFunctionMarkup = null;\r\n\r\n        [NonSerialized]\r\n        private Func<string> _widgetFunctionMarkupFunc;\r\n\r\n\r\n        public Func<string> WidgetFunctionMarkupFunc { get { return _widgetFunctionMarkupFunc; } set { _widgetFunctionMarkupFunc = value; } }\r\n\r\n\r\n        public override string WidgetFunctionMarkup\r\n        {\r\n            get\r\n            {\r\n                if (_widgetFunctionMarkup == null)\r\n                {\r\n                    _widgetFunctionMarkup = WidgetFunctionMarkupFunc();\r\n                }\r\n\r\n                return _widgetFunctionMarkup;\r\n            }\r\n            set\r\n            {\r\n                _widgetFunctionMarkup = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataFieldIdEqualityComparer.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    internal sealed class DataFieldIdEqualityComparer : EqualityComparer<DataFieldDescriptor>\r\n    {\r\n        public override bool Equals(DataFieldDescriptor x, DataFieldDescriptor y)\r\n        {\r\n            return x.Id.Equals(y.Id); \r\n        }\r\n\r\n        public override int GetHashCode(DataFieldDescriptor obj)\r\n        {\r\n            return obj.Id.GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataFieldNameCollection.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataFieldNameCollection : IEnumerable<string>\r\n    {\r\n        private readonly List<string> _dataFieldNames = new List<string>();\r\n        private readonly DataFieldDescriptorCollection _validDataFieldDescriptions;\r\n        private readonly bool _allowNullableFields;\r\n        private readonly bool _allowListFields;\r\n        private readonly bool _allowLargeStringFields;\r\n\r\n\r\n        internal DataFieldNameCollection(DataFieldDescriptorCollection validDataFieldDescriptions, bool allowNullableFields, bool allowListFields, bool allowLargeStringFields)\r\n        {\r\n            _validDataFieldDescriptions = validDataFieldDescriptions;\r\n            _allowNullableFields = allowNullableFields;\r\n            _allowListFields = allowListFields;\r\n            _allowLargeStringFields = allowLargeStringFields;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Add(string dataFieldName)\r\n        {\r\n            Add(dataFieldName, true);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Add(string dataFieldName, bool validateFieldMemberShip)\r\n        {\r\n            if (validateFieldMemberShip)\r\n            {\r\n                ValidateFieldMembership(dataFieldName);\r\n            }\r\n\r\n            _dataFieldNames.Add(dataFieldName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Remove(string dataFieldName)\r\n        {\r\n            _dataFieldNames.Remove(dataFieldName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Clear()\r\n        {\r\n            _dataFieldNames.Clear();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Contains(string fieldName)\r\n        {\r\n            return _dataFieldNames.Contains(fieldName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int Count\r\n        {\r\n            get { return _dataFieldNames.Count; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string this[int index]\r\n        {\r\n            get { return _dataFieldNames[index]; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerator<string> GetEnumerator()\r\n        {\r\n            return _dataFieldNames.GetEnumerator();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()\r\n        {\r\n            return _dataFieldNames.GetEnumerator();\r\n        }\r\n\r\n\r\n        internal void ValidateMembers()\r\n        {\r\n            foreach (string fieldName in _dataFieldNames)\r\n            {\r\n                ValidateFieldMembership(fieldName);\r\n            }\r\n        }\r\n\r\n\r\n        private void ValidateFieldMembership(string dataFieldName)\r\n        {\r\n            DataFieldDescriptor dataFieldDescriptor = _validDataFieldDescriptions[dataFieldName];\r\n            if (dataFieldDescriptor == null) throw new ArgumentException(string.Format(\"Unknown data field name '{0}'\", dataFieldName));\r\n            if (_allowNullableFields == false && dataFieldDescriptor.IsNullable) throw new ArgumentException(\"Can not add nullable fields to this list\");\r\n            if (dataFieldDescriptor.StoreType.PhysicalStoreType == PhysicalStoreFieldType.LargeString && _allowLargeStringFields == false) throw new ArgumentException(\"Can not add large string fields to this list\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataFieldTreeOrderingProfile.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Serializable()]\r\n    public class DataFieldTreeOrderingProfile\r\n    {\r\n        /// <exclude />\r\n        public DataFieldTreeOrderingProfile()\r\n        {\r\n            OrderPriority = null;\r\n            OrderDescending = false;\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual int? OrderPriority { get; set; }\r\n\r\n        /// <exclude />\r\n        public virtual bool OrderDescending { get; set; }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return String.Format(\"{0},{1}\", OrderPriority, OrderDescending);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static DataFieldTreeOrderingProfile FromString(string str)\r\n        {\r\n            var parts = str.Split(',');\r\n            int priority;\r\n            bool order;\r\n\r\n            DataFieldTreeOrderingProfile treeOrderingProfile = new DataFieldTreeOrderingProfile();\r\n\r\n            if (int.TryParse(parts[0], out priority))\r\n                treeOrderingProfile.OrderPriority = priority;\r\n\r\n            if (parts.Length > 1 && bool.TryParse(parts[1], out order))\r\n                treeOrderingProfile.OrderDescending = order;\r\n\r\n            return treeOrderingProfile;\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataTypeChangeDescriptor.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class DataTypeChangeDescriptor\r\n    {\r\n        private readonly DataTypeDescriptor _original;\r\n        private readonly DataTypeDescriptor _altered;\r\n        private readonly bool _originalTypeDataExists;\r\n\r\n\r\n        /// <exclude />\r\n        public DataTypeChangeDescriptor(DataTypeDescriptor originalTypeDescriptor, DataTypeDescriptor alteredTypeDescriptor)\r\n            : this(originalTypeDescriptor, alteredTypeDescriptor, true)\r\n        {\r\n        }\r\n\r\n\r\n        internal DataTypeChangeDescriptor(DataTypeDescriptor originalTypeDescriptor, DataTypeDescriptor alteredTypeDescriptor, bool originalTypeDataExists)\r\n        {\r\n            if (originalTypeDescriptor.DataTypeId != alteredTypeDescriptor.DataTypeId) throw new ArgumentException(\"The original and current data type descriptors must have the same data type id\");\r\n\r\n            _original = originalTypeDescriptor;\r\n            _altered = alteredTypeDescriptor;\r\n            _originalTypeDataExists = originalTypeDataExists;\r\n\r\n            ValidateTypeChanges();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool AlteredTypeHasChanges\r\n        {\r\n            get\r\n            {\r\n                bool alteredTypeHasChanges = false;\r\n                alteredTypeHasChanges |= this.AlteredType.IsCodeGenerated != this.OriginalType.IsCodeGenerated;\r\n                alteredTypeHasChanges |= this.AlteredType.Name != this.OriginalType.Name;\r\n                alteredTypeHasChanges |= this.AlteredType.Namespace != this.OriginalType.Namespace;\r\n                // Do we really need to regenerated the type if it has a new type manager type name?\r\n                //alteredTypeHasChanges |= (this.AlteredType.TypeManagerTypeName != this.OriginalType.TypeManagerTypeName);\r\n                alteredTypeHasChanges |= this.AddedFields.Any();\r\n                alteredTypeHasChanges |= this.DeletedFields.Any();\r\n                alteredTypeHasChanges |= this.AddedKeyFields.Any();\r\n                alteredTypeHasChanges |= this.DeletedKeyFields.Any();\r\n                alteredTypeHasChanges |= this.KeyFieldsOrderChanged;\r\n                alteredTypeHasChanges |= this.ExistingFields.Any(f => f.AlteredFieldHasChanges);\r\n                alteredTypeHasChanges |= this.AddedDataScopes.Any();\r\n                alteredTypeHasChanges |= this.DeletedDataScopes.Any();\r\n                alteredTypeHasChanges |= IndexesChanged;\r\n                alteredTypeHasChanges |= VersionKeyFieldsChanged;\r\n                return alteredTypeHasChanges;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicates if type's metadata should be updated.\r\n        /// </summary>\r\n        internal bool TypeHasMetaDataChanges =>\r\n            !OriginalType.IsCodeGenerated\r\n            && (OriginalType.Title != AlteredType.Title\r\n                || OriginalType.LabelFieldName != AlteredType.LabelFieldName\r\n                || OriginalType.Cachable != AlteredType.Cachable\r\n                || OriginalType.Searchable != AlteredType.Searchable\r\n                || OriginalType.InternalUrlPrefix != AlteredType.InternalUrlPrefix);\r\n\r\n\r\n        /// <exclude />\r\n        public DataTypeDescriptor OriginalType => _original;\r\n\r\n\r\n        /// <exclude />\r\n        public DataTypeDescriptor AlteredType => _altered;\r\n\r\n\r\n        /// <summary>\r\n        /// True when the system contains data of the original type. Allowable schema changes can be limited when data exists.\r\n        /// </summary>\r\n        public bool OriginalTypeDataExists => _originalTypeDataExists;\r\n\r\n\r\n        /// <summary>\r\n        /// Returns original fields that are no longer part of the altered type.\r\n        /// </summary>\r\n        public IEnumerable<DataFieldDescriptor> DeletedFields\r\n        {\r\n            get\r\n            {\r\n                return _original.Fields.Except(_altered.Fields, new DataFieldIdEqualityComparer());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns added fields that were not part of the original type.\r\n        /// </summary>\r\n        public IEnumerable<DataFieldDescriptor> AddedFields\r\n        {\r\n            get\r\n            {\r\n                return _altered.Fields.Except(_original.Fields, new DataFieldIdEqualityComparer());\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns fields that exists in both the original and altered type. Fields may have changed name or type.\r\n        /// </summary>\r\n        public IEnumerable<ExistingFieldInfo> ExistingFields\r\n        {\r\n            get\r\n            {\r\n                var existingFields =\r\n                    from altered in _altered.Fields\r\n                    join original in _original.Fields on altered.Id equals original.Id\r\n                    select new ExistingFieldInfo(original, altered);\r\n\r\n                return existingFields;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns original DataScopes that are no longer part of the altered type.\r\n        /// </summary>\r\n        public IEnumerable<DataScopeIdentifier> DeletedDataScopes\r\n        {\r\n            get\r\n            {\r\n                return _original.DataScopes.Where(f => _altered.DataScopes.Count(g => g.Name == f.Name) == 0);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns new DataScopes that was not part of the original type.\r\n        /// </summary>\r\n        public IEnumerable<DataScopeIdentifier> AddedDataScopes\r\n        {\r\n            get\r\n            {\r\n                return _altered.DataScopes.Where(f => _original.DataScopes.Count(g => g.Name == f.Name) == 0);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns new DataScopes that was not part of the original type.\r\n        /// </summary>\r\n        public IEnumerable<DataScopeIdentifier> ExistingDataScopes\r\n        {\r\n            get\r\n            {\r\n                return _altered.DataScopes.Where(f => _original.DataScopes.Count(g => g.Name == f.Name) == 1);\r\n            }\r\n        }\r\n\r\n\r\n        IEnumerable<DataFieldDescriptor> GetKeyProperties_Original()\r\n        {\r\n            return _original.KeyPropertyNames\r\n                .Select(name => _original.Fields.Where(fld => fld.Name == name)\r\n                    .FirstOrException(\"Key property name {0} is not defined in the <Fields> section\", name)).ToList();\r\n        }\r\n\r\n        IEnumerable<DataFieldDescriptor> GetKeyProperties_Altered()\r\n        {\r\n            return _altered.KeyPropertyNames.Select(name => _altered.Fields.Where(fld => fld.Name == name)\r\n                .FirstOrException(\"Key property name {0} is not defined in the <Fields> section\", name)).ToList();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns original key fields that are not part of the altered types key. Fields may have been deleted or demoted to normal fields.\r\n        /// </summary>\r\n        public IEnumerable<DataFieldDescriptor> DeletedKeyFields\r\n        {\r\n            get\r\n            {\r\n                return GetKeyProperties_Original().Except(GetKeyProperties_Altered(), new DataFieldIdEqualityComparer());\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns added key fields that were not part of the original types key. Fields may be new or promoted from normal fields.\r\n        /// </summary>\r\n        public IEnumerable<DataFieldDescriptor> AddedKeyFields\r\n        {\r\n            get\r\n            {\r\n                return GetKeyProperties_Altered().Except(GetKeyProperties_Original(), new DataFieldIdEqualityComparer());\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns true if order of key properties have been changed\r\n        /// </summary>\r\n        public bool KeyFieldsOrderChanged\r\n        {\r\n            get\r\n            {\r\n                return !GetKeyProperties_Original().SequenceEqual(GetKeyProperties_Altered(), new DataFieldIdEqualityComparer());\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns <value>true</value> if indexes have changed\r\n        /// </summary>\r\n        public bool IndexesChanged\r\n        {\r\n            get\r\n            {\r\n                var originalIndexes = OriginalType.Indexes;\r\n                var newIndexes = AlteredType.Indexes;\r\n\r\n                Func<IReadOnlyCollection<DataTypeIndex>, string> serializeIndexes =\r\n                    indexes => string.Join(\"|\", indexes.Select(i => i.ToString()).OrderBy(a => a));\r\n\r\n                return serializeIndexes(originalIndexes) != serializeIndexes(newIndexes);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns <value>true</value> if version key fields have changed\r\n        /// </summary>\r\n        public bool VersionKeyFieldsChanged\r\n            => !_original.VersionKeyPropertyNames.SequenceEqual(_altered.VersionKeyPropertyNames);\r\n        \r\n\r\n\r\n        /// <summary>\r\n        /// Returns key fields that exists in both the original and altered type. Fields may have changed name or type.\r\n        /// </summary>\r\n        public IEnumerable<ExistingFieldInfo> ExistingKeyFields\r\n        {\r\n            get\r\n            {\r\n                var existingFields =\r\n                    from altered in _altered.Fields\r\n                    join original in _original.Fields on altered.Id equals original.Id\r\n                    where _altered.KeyPropertyNames.Contains(altered.Name) && _original.KeyPropertyNames.Contains(original.Name)\r\n                    select new ExistingFieldInfo(original, altered);\r\n\r\n                return existingFields;\r\n            }\r\n        }\r\n\r\n\r\n        private void ValidateTypeChanges()\r\n        {\r\n            if (this.OriginalTypeDataExists)\r\n            {\r\n                foreach (var existingField in this.ExistingFields)\r\n                {\r\n                    if (existingField.OriginalField.StoreType.IsConvertibleTo(existingField.AlteredField.StoreType) == false)\r\n                    {\r\n                        throw new InvalidOperationException(string.Format(\"Data type change description is invalid. Requested convertion for field {0} is not allowed.\", existingField.AlteredField.Name));\r\n                    }\r\n                }\r\n            }\r\n\r\n            foreach (string keyFieldName in this.AlteredType.KeyPropertyNames)\r\n            {\r\n                if (this.AlteredType.Fields[keyFieldName] == null)\r\n                {\r\n                    throw new InvalidOperationException(\"Data type change description is invalid. Key field list contains an unknown field name.\");\r\n                }\r\n            }\r\n\r\n            foreach (string sortOrderFieldName in this.AlteredType.StoreSortOrderFieldNames)\r\n            {\r\n                if (this.AlteredType.Fields[sortOrderFieldName] == null)\r\n                {\r\n                    throw new InvalidOperationException(\"Data type change description is invalid. Sort order field list contains an unknown field name.\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public class ExistingFieldInfo\r\n        {\r\n            private readonly DataFieldDescriptor _originalField;\r\n            private DataFieldDescriptor _alteredField;\r\n\r\n            internal ExistingFieldInfo(DataFieldDescriptor originalField, DataFieldDescriptor alteredField)\r\n            {\r\n                _originalField = originalField;\r\n                _alteredField = alteredField;\r\n            }\r\n\r\n            /// <exclude />\r\n            public DataFieldDescriptor OriginalField => _originalField;\r\n\r\n\r\n            /// <exclude />\r\n            public DataFieldDescriptor AlteredField\r\n            {\r\n                get { return _alteredField; }\r\n                set { _alteredField = value; }\r\n            }\r\n\r\n            /// <exclude />\r\n            public bool AlteredFieldHasChanges\r\n            {\r\n                get\r\n                {\r\n                    bool hasChanged = false;\r\n                    hasChanged |= ((_originalField.DefaultValue == null) != (_alteredField.DefaultValue == null));\r\n                    if (_originalField.DefaultValue != null && _alteredField.DefaultValue != null)\r\n                    {\r\n                        hasChanged |= (_originalField.DefaultValue.CompareTo(_alteredField.DefaultValue) != 0);\r\n                    }\r\n                    hasChanged |= (_originalField.InstanceType != _alteredField.InstanceType);\r\n                    hasChanged |= (_originalField.IsNullable != _alteredField.IsNullable);\r\n                    hasChanged |= (_originalField.Name != _alteredField.Name);\r\n                    hasChanged |= (_originalField.StoreType.Serialize() != _alteredField.StoreType.Serialize());\r\n                    return hasChanged;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataTypeDescriptor.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes.Configuration;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>\r\n    /// Describes a data type in C1 CMS\r\n    /// </summary>\r\n    [DebuggerDisplay(\"Type name = {Namespace + '.' + Name}\")]\r\n    public class DataTypeDescriptor\r\n    {\r\n        private const string LogTitle = nameof(DataTypeDescriptor);\r\n\r\n        private string _name;\r\n        private Guid _dataTypeId;\r\n        private string _namespace;\r\n        private List<Type> _superInterfaces = new List<Type>();\r\n        private List<DataTypeAssociationDescriptor> _dataTypeAssociationDescriptors = new List<DataTypeAssociationDescriptor>();\r\n        private IReadOnlyCollection<DataTypeIndex> _indexes = new DataTypeIndex[0];\r\n\r\n\r\n        /// <summary>\r\n        /// Instantiates an instance of <see cref=\"DataTypeDescriptor\"/> with default settings.\r\n        /// </summary>\r\n        public DataTypeDescriptor()\r\n        {\r\n            this.Fields = new DataFieldDescriptorCollection(this);\r\n            this.KeyPropertyNames = new DataFieldNameCollection(this.Fields, false, false, false);\r\n            this.VersionKeyPropertyNames = new DataFieldNameCollection(this.Fields, false, false, false);\r\n            this.StoreSortOrderFieldNames = new DataFieldNameCollection(this.Fields, true, false, false);\r\n            this.IsCodeGenerated = false;\r\n            this.DataScopes = new List<DataScopeIdentifier>();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Instantiates an instance of <see cref=\"DataTypeDescriptor\"/>.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeId\">The permanent Guid which should represent this data type.</param>\r\n        /// <param name=\"dataTypeNamespace\">Namespace of the type.</param>\r\n        /// <param name=\"dataTypeName\">Name of the type.</param>\r\n        /// <param name=\"isCodeGenerated\">True if this type is dynamically compiled.</param>\r\n        public DataTypeDescriptor(Guid dataTypeId, string dataTypeNamespace, string dataTypeName, bool isCodeGenerated)\r\n            : this()\r\n        {\r\n            this.DataTypeId = dataTypeId;\r\n            this.Namespace = dataTypeNamespace;\r\n            this.Name = dataTypeName;\r\n            this.IsCodeGenerated = isCodeGenerated;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Instantiates an instance of <see cref=\"DataTypeDescriptor\"/> with a custom Type Manager.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeId\">The permanent Guid which should represent this data type.</param>\r\n        /// <param name=\"dataTypeNamespace\">Namespace of the type.</param>\r\n        /// <param name=\"dataTypeName\">Name of the type.</param>\r\n        /// <param name=\"typeManagerTypeName\">If this data type has a custom type manager</param>\r\n        public DataTypeDescriptor(Guid dataTypeId, string dataTypeNamespace, string dataTypeName, string typeManagerTypeName)\r\n            : this()\r\n        {\r\n            this.DataTypeId = dataTypeId;\r\n            this.Namespace = dataTypeNamespace;\r\n            this.Name = dataTypeName;\r\n            this.TypeManagerTypeName = typeManagerTypeName;\r\n            this.IsCodeGenerated = false;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Instantiates an instance of <see cref=\"DataTypeDescriptor\"/> with a custom Type Manager.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeId\">The permanent Guid which should represent this data type.</param>\r\n        /// <param name=\"dataTypeNamespace\">Namespace of the type.</param>\r\n        /// <param name=\"dataTypeName\">Name of the type.</param>\r\n        /// <param name=\"typeManagerTypeName\">If this data type has a custom type manager</param>\r\n        /// <param name=\"isCodeGenerated\">True if this type is dynamically compiled.</param>\r\n        public DataTypeDescriptor(Guid dataTypeId, string dataTypeNamespace, string dataTypeName, string typeManagerTypeName, bool isCodeGenerated)\r\n            : this()\r\n        {\r\n            this.DataTypeId = dataTypeId;\r\n            this.Namespace = dataTypeNamespace;\r\n            this.Name = dataTypeName;\r\n            this.TypeManagerTypeName = typeManagerTypeName;\r\n            this.IsCodeGenerated = isCodeGenerated;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The data types permant id.\r\n        /// </summary>\r\n        public Guid DataTypeId\r\n        {\r\n            get\r\n            {\r\n                return _dataTypeId;\r\n            }\r\n            set\r\n            {\r\n                if (value == Guid.Empty) throw new ArgumentException(\"DataTypeId must be a non-empty Guid\");\r\n\r\n                _dataTypeId = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Primary keys.\r\n        /// </summary>\r\n        public DataFieldNameCollection KeyPropertyNames { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Version keys, appear in the physical order but not included in data references.\r\n        /// </summary>\r\n        public DataFieldNameCollection VersionKeyPropertyNames { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Version keys, appear in the physical order but not included in data references.\r\n        /// </summary>\r\n        internal IEnumerable<string> PhysicalKeyPropertyNames => KeyPropertyNames.Concat(VersionKeyPropertyNames);\r\n\r\n        /// <summary>\r\n        /// Returns the CLT Type for this data type description.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public Type GetInterfaceType()\r\n        {\r\n            if (this.TypeManagerTypeName == null)\r\n            {\r\n                throw new InvalidOperationException(\"The TypeManagerTypeName has not been set\");\r\n            }\r\n\r\n            return DataTypeTypesManager.GetDataType(this);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Type name of the Type Manager responsible for this data type.\r\n        /// </summary>\r\n        public string TypeManagerTypeName { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// A list of field names that the provider should use when physically storing data. \r\n        /// Select ordering is not (necessarily) influenced by this setting.\r\n        /// </summary>\r\n        public DataFieldNameCollection StoreSortOrderFieldNames { get; set; }\r\n\r\n\r\n        /// <summary>The fields (aka properties or columns) of the type.</summary>\r\n        public DataFieldDescriptorCollection Fields { get; set; }\r\n\r\n        /// <summary>\r\n        /// Physical key fields. Note that the order of the fields is important.\r\n        /// The physical key ensure that storage identity is unique across different versions of data with shared id.\r\n        /// </summary>\r\n        internal IEnumerable<DataFieldDescriptor> PhysicalKeyFields\r\n        {\r\n            get\r\n            {\r\n                Func<string, DataFieldDescriptor> getField = fieldName =>\r\n                    this.Fields.Where(field => field.Name == fieldName)\r\n                        .SingleOrException(\"Missing a field '{0}'\", \"Multiple fields with name '{0}'\", fieldName);\r\n\r\n                return PhysicalKeyPropertyNames.Select(getField);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indexes.\r\n        /// </summary>\r\n        public IReadOnlyCollection<DataTypeIndex> Indexes\r\n        {\r\n            get { return _indexes; }\r\n            set\r\n            {\r\n                Verify.That(value.Count(idx => idx.Clustered) < 2, \"It is not allowed to have more than one clustered index\");\r\n\r\n                _indexes = value;\r\n            }\r\n        }\r\n\r\n        internal bool PrimaryKeyIsClusteredIndex\r\n        {\r\n            get\r\n            {\r\n                return !HasCustomPhysicalSortOrder && !Indexes.Any(i => i.Clustered);\r\n            }\r\n        }\r\n\r\n        /// <summary>The short name of the type, without namespace and assembly info</summary>\r\n        public string Name\r\n        {\r\n            get { return _name; }\r\n            set { _name = NameValidation.ValidateName(value); }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The data types namespace \r\n        /// </summary>\r\n        public string Namespace\r\n        {\r\n            get\r\n            {\r\n                return _namespace;\r\n            }\r\n            set\r\n            {\r\n                _namespace = NameValidation.ValidateNamespace(value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The data types title\r\n        /// </summary>\r\n        public string Title { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The name of field to use when labeling data of this type.\r\n        /// </summary>\r\n        public string LabelFieldName { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The internal url name\r\n        /// </summary>\r\n        public string InternalUrlPrefix { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// True if the interface code for this type is created via code generation. False for statically compiled types.\r\n        /// </summary>\r\n        public bool IsCodeGenerated { get; private set; }\r\n\r\n        /// <summary>\r\n        /// When <value>true</value> data of this type may be cached.\r\n        /// </summary>\r\n        public bool Cachable { get; internal set; }\r\n\r\n        /// <summary>\r\n        /// When <value>true</value> the data of this type is searchable.\r\n        /// </summary>\r\n        public bool Searchable { get; internal set; }\r\n\r\n        /// <summary>\r\n        /// When true this type has a physical sortorder specified.\r\n        /// </summary>\r\n        public bool HasCustomPhysicalSortOrder\r\n        {\r\n            get\r\n            {\r\n                if (this.StoreSortOrderFieldNames.Count == 0) return false;\r\n                if (this.StoreSortOrderFieldNames.Count != this.KeyPropertyNames.Count) return true;\r\n                for (int i = 0; i < this.StoreSortOrderFieldNames.Count; i++)\r\n                {\r\n                    if (this.StoreSortOrderFieldNames[i] != this.KeyPropertyNames[i]) return true;\r\n                }\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The data scopes this data type exist in. Typically always \"public\". Also \"administrated\" if this type supports publishing.\r\n        /// </summary>\r\n        public List<DataScopeIdentifier> DataScopes { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// When true data can be localized.\r\n        /// </summary>\r\n        public bool Localizeable => SuperInterfaces.Contains(typeof(ILocalizedControlled));\r\n\r\n\r\n        /// <summary>\r\n        /// Type name for custom handler to use when building new instances of the data type.\r\n        /// </summary>\r\n        public string BuildNewHandlerTypeName\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Adds an interface the data type should inherit from\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        public void AddSuperInterface(Type interfaceType)\r\n        {\r\n            AddSuperInterface(interfaceType, true);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Adds an interface the data type should inherit from\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"addInheritedFields\"></param>\r\n        internal void AddSuperInterface(Type interfaceType, bool addInheritedFields)\r\n        {\r\n            if (_superInterfaces.Contains(interfaceType) || interfaceType == typeof (IData))\r\n            {\r\n                return;\r\n            }\r\n\r\n            _superInterfaces.Add(interfaceType);\r\n\r\n            if (addInheritedFields)\r\n            {\r\n                foreach (PropertyInfo propertyInfo in interfaceType.GetProperties())\r\n                {\r\n                    if (propertyInfo.Name == nameof(IPageData.PageId) && interfaceType == typeof (IPageData))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    DataFieldDescriptor dataFieldDescriptor = ReflectionBasedDescriptorBuilder.BuildFieldDescriptor(propertyInfo, true);\r\n\r\n                    this.Fields.Add(dataFieldDescriptor);\r\n                }\r\n            }\r\n\r\n            foreach (string propertyName in interfaceType.GetKeyPropertyNames())\r\n            {\r\n                if (KeyPropertyNames.Contains(propertyName)) continue;\r\n\r\n                PropertyInfo property = ReflectionBasedDescriptorBuilder.FindProperty(interfaceType, propertyName);\r\n\r\n                if (DynamicTypeReflectionFacade.IsKeyField(property))\r\n                {\r\n                    this.KeyPropertyNames.Add(propertyName, false);\r\n                }\r\n            }\r\n\r\n            foreach (var dataScopeIdentifier in DynamicTypeReflectionFacade.GetDataScopes(interfaceType))\r\n            {\r\n                if (!this.DataScopes.Contains(dataScopeIdentifier))\r\n                {\r\n                    this.DataScopes.Add(dataScopeIdentifier);\r\n                }\r\n            }\r\n\r\n            var superInterfaces = interfaceType.GetInterfaces().Where(t => typeof (IData).IsAssignableFrom(t));\r\n            foreach (Type superSuperInterfaceType in superInterfaces)\r\n            {\r\n                AddSuperInterface(superSuperInterfaceType, addInheritedFields);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Removes a super interface\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">Type to remove</param>\r\n        public void RemoveSuperInterface(Type interfaceType)\r\n        {\r\n            if (interfaceType == typeof(IData))\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (_superInterfaces.Contains(interfaceType))\r\n            {\r\n                _superInterfaces.Remove(interfaceType);\r\n            }\r\n\r\n            foreach (PropertyInfo propertyInfo in interfaceType.GetProperties())\r\n            {\r\n                var dataFieldDescriptor = ReflectionBasedDescriptorBuilder.BuildFieldDescriptor(propertyInfo, true);\r\n\r\n                if (this.Fields.Contains(dataFieldDescriptor))\r\n                {\r\n                    this.Fields.Remove(dataFieldDescriptor);\r\n                }\r\n\r\n                if (DynamicTypeReflectionFacade.IsKeyField(propertyInfo) &&\r\n                    this.KeyPropertyNames.Contains(propertyInfo.Name))\r\n                {\r\n                    this.KeyPropertyNames.Remove(propertyInfo.Name);\r\n                }\r\n            }\r\n\r\n\r\n            foreach (var dataScopeIdentifier in DynamicTypeReflectionFacade.GetDataScopes(interfaceType))\r\n            {\r\n                if (this.DataScopes.Contains(dataScopeIdentifier))\r\n                {\r\n                    this.DataScopes.Remove(dataScopeIdentifier);\r\n                }\r\n            }\r\n\r\n            var superInterfaces = interfaceType.GetInterfaces().Where(t => typeof (IData).IsAssignableFrom(t));\r\n            foreach (Type superInterfaceType in superInterfaces)\r\n            {\r\n                RemoveSuperInterface(superInterfaceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// All interfaces this data type inherit from\r\n        /// </summary>\r\n        public IEnumerable<Type> SuperInterfaces => _superInterfaces;\r\n\r\n\r\n        /// <summary>\r\n        /// Attached a associated to another data type, like page meta data or page folder data.\r\n        /// </summary>\r\n        public List<DataTypeAssociationDescriptor> DataAssociations\r\n        {\r\n            get\r\n            {\r\n                return _dataTypeAssociationDescriptors;\r\n            }\r\n            set\r\n            {\r\n                if (value == null) throw new ArgumentNullException();\r\n\r\n                _dataTypeAssociationDescriptors = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// True when the data type is associated to C1 CMS pages as an agregation\r\n        /// </summary>\r\n        public bool IsPageFolderDataType\r\n        {\r\n            get\r\n            {\r\n                return\r\n                    this.DataAssociations.Any(f => f.AssociatedInterfaceType == typeof(IPage) && f.AssociationType == DataAssociationType.Aggregation);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// True when the data type is associated to C1 CMS pages as an composition\r\n        /// </summary>\r\n        public bool IsPageMetaDataType\r\n        {\r\n            get\r\n            {\r\n                return this.DataAssociations.Any(f => f.AssociatedInterfaceType == typeof(IPage) \r\n                                                   && f.AssociationType == DataAssociationType.Composition);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Resets the list of interfaces this data type inherit from\r\n        /// </summary>\r\n        /// <param name=\"superInterfaces\"></param>\r\n        internal void SetSuperInterfaces(List<Type> superInterfaces)\r\n        {\r\n            _superInterfaces = superInterfaces;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Validate the data type description or throw an exception.\r\n        /// </summary>\r\n        public void Validate()\r\n        {\r\n            try\r\n            {\r\n                if (this.DataTypeId == Guid.Empty) throw new InvalidOperationException(\"The type descriptor property DataTypeId can not be empty\");\r\n                if (string.IsNullOrEmpty(this.Namespace)) throw new InvalidOperationException(\"The type descriptor property Namespace can not be empty\");\r\n                if (string.IsNullOrEmpty(this.Name)) throw new InvalidOperationException(\"The type descriptor property Name can not be empty\");\r\n                if (string.IsNullOrEmpty(this.TypeManagerTypeName)) throw new InvalidOperationException(\"The type descriptor property TypeManagerTypeName can not be empty\");\r\n                if (this.Fields.Count == 0) throw new InvalidOperationException(\"The type descriptors Fields collection may not be empty\");\r\n                if (this.KeyPropertyNames.Count == 0) throw new InvalidOperationException(\"The type descriptors KeyFieldNames collection may not be empty\");\r\n                if (this.DataScopes.Count == 0) throw new InvalidOperationException(\"The DataScopes list containing the list of data scopes this type must support can not be empty. Please provide at least one data scopes.\");\r\n                if (this.DataScopes.Select(f => f.Name).Distinct().Count() != this.DataScopes.Count) throw new InvalidOperationException(\"The DataScopes list contains redundant data scopes\");\r\n\r\n                this.KeyPropertyNames.ValidateMembers();\r\n                this.StoreSortOrderFieldNames.ValidateMembers();\r\n\r\n                if (this.LabelFieldName != null)\r\n                {\r\n                    if (!this.Fields.Any(f => f.Name == this.LabelFieldName))\r\n                    {\r\n                        throw new InvalidOperationException($\"The label field name '{this.LabelFieldName}' is not an existing field\");\r\n                    }\r\n                }\r\n\r\n                int distinctForeignKeyPropertyNames =\r\n                    (from assDec in this.DataAssociations\r\n                     select assDec.ForeignKeyPropertyName).Distinct().Count();\r\n\r\n                if (distinctForeignKeyPropertyNames != this.DataAssociations.Count)\r\n                {\r\n                    throw new InvalidOperationException(\"Two or more data associations are using the same foreign key field\");\r\n                }\r\n\r\n                int distinctAssociatedInterfaceType =\r\n                    (from assDec in this.DataAssociations\r\n                     select assDec.AssociatedInterfaceType).Distinct().Count();\r\n\r\n                if (distinctAssociatedInterfaceType != this.DataAssociations.Count)\r\n                {\r\n                    throw new InvalidOperationException(\"Two or more data associations are associated to the same interface type\");\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                string typeName = string.IsNullOrEmpty(this.TypeManagerTypeName) ? this.Name : this.TypeManagerTypeName;\r\n                throw new InvalidOperationException($\"Failed to validate data type description for '{typeName}'.\", ex);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Clones the data type description.\r\n        /// </summary>\r\n        /// <returns>A clone</returns>\r\n        public DataTypeDescriptor Clone()\r\n        {\r\n            var dataTypeDescriptor = new DataTypeDescriptor(this.DataTypeId, this.Namespace, this.Name, this.TypeManagerTypeName, this.IsCodeGenerated)\r\n            {\r\n                Title = this.Title,\r\n                BuildNewHandlerTypeName = this.BuildNewHandlerTypeName,\r\n                LabelFieldName = this.LabelFieldName,\r\n                InternalUrlPrefix = this.InternalUrlPrefix,\r\n                Cachable = this.Cachable,\r\n                Searchable = this.Searchable\r\n            };\r\n\r\n            foreach (DataTypeAssociationDescriptor dataTypeAssociationDescriptor in this.DataAssociations)\r\n            {\r\n                dataTypeDescriptor.DataAssociations.Add(dataTypeAssociationDescriptor.Clone());\r\n            }\r\n\r\n            dataTypeDescriptor.DataScopes = new List<DataScopeIdentifier>(this.DataScopes);\r\n\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in this.Fields)\r\n            {\r\n                if (!dataFieldDescriptor.Inherited)\r\n                {\r\n                    dataTypeDescriptor.Fields.Add(dataFieldDescriptor.Clone());\r\n                }\r\n            }\r\n\r\n\r\n            foreach (string keyPropertyName in this.KeyPropertyNames)\r\n            {\r\n                dataTypeDescriptor.KeyPropertyNames.Add(keyPropertyName, false);\r\n            }\r\n\r\n            foreach (string storeSortOrderFieldNames in this.StoreSortOrderFieldNames)\r\n            {\r\n                dataTypeDescriptor.StoreSortOrderFieldNames.Add(storeSortOrderFieldNames, false);\r\n            }\r\n\r\n            foreach (Type superInterface in this.SuperInterfaces)\r\n            {\r\n                dataTypeDescriptor.AddSuperInterface(superInterface);\r\n            }\r\n\r\n            return dataTypeDescriptor;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Serialize the data type description to XML\r\n        /// </summary>\r\n        /// <returns>Serialized data type descriptor</returns>\r\n        public XElement ToXml()\r\n        {\r\n            var element = new XElement(\"DataTypeDescriptor\",\r\n                new XAttribute(\"dataTypeId\", this.DataTypeId),\r\n                new XAttribute(\"name\", this.Name),\r\n                new XAttribute(\"namespace\", this.Namespace),\r\n                this.Title != null ? new XAttribute(\"title\", this.Title) : null,\r\n                new XAttribute(\"isCodeGenerated\", this.IsCodeGenerated),\r\n                new XAttribute(\"cachable\", this.Cachable),\r\n                new XAttribute(\"searchable\", this.Searchable),\r\n                this.LabelFieldName != null ? new XAttribute(\"labelFieldName\", this.LabelFieldName) : null,\r\n                !string.IsNullOrEmpty(this.InternalUrlPrefix) ? new XAttribute(\"internalUrlPrefix\", this.InternalUrlPrefix) : null,\r\n                this.TypeManagerTypeName != null ? new XAttribute(\"typeManagerTypeName\", this.TypeManagerTypeName) : null,\r\n                !string.IsNullOrEmpty(this.BuildNewHandlerTypeName) ? new XAttribute(\"buildNewHandlerTypeName\", this.BuildNewHandlerTypeName) : null);\r\n\r\n\r\n            element.Add(new[]\r\n            {\r\n                new XElement(\"DataAssociations\",\r\n                              DataAssociations.Select(da => da.ToXml())),\r\n                new XElement(\"DataScopes\", \r\n                              DataScopes.Select(dsi => new XElement(\"DataScopeIdentifier\", new XAttribute(\"name\", dsi)))),\r\n                new XElement(\"KeyPropertyNames\",\r\n                              KeyPropertyNames.Select(name => new XElement(\"KeyPropertyName\", new XAttribute(\"name\", name)))),\r\n                VersionKeyPropertyNames.Any() \r\n                    ? new XElement(\"VersionKeyPropertyNames\",\r\n                            VersionKeyPropertyNames.Select(name => new XElement(\"VersionKeyPropertyName\", new XAttribute(\"name\", name))))\r\n                    : null,\r\n                new XElement(\"SuperInterfaces\", \r\n                              SuperInterfaces.Select(su => new XElement(\"SuperInterface\", new XAttribute(\"type\", TypeManager.SerializeType(su))))),\r\n                new XElement(\"Fields\", Fields.Select(f => f.ToXml()))\r\n            });\r\n            \r\n            if (Indexes.Any())\r\n            {\r\n                element.Add(new XElement(\"Indexes\", Indexes.Select(i => i.ToXml())));   \r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Deserializes a data type descriptor\r\n        /// </summary>\r\n        /// <param name=\"element\">A serialized (XML) data type descriptor</param>\r\n        /// <returns>De-serialized data type descriptor</returns>\r\n        public static DataTypeDescriptor FromXml(XElement element)\r\n        {\r\n            return FromXml(element, true);\r\n        }\r\n\r\n        internal static DataTypeDescriptor FromXml(XElement element, bool inheritedFieldsIncluded)\r\n        {\r\n            Verify.ArgumentNotNull(element, \"element\");\r\n            if (element.Name != \"DataTypeDescriptor\") throw new ArgumentException(\"The xml is not correctly formatted.\");\r\n\r\n\r\n            Guid dataTypeId = (Guid) element.GetRequiredAttribute(\"dataTypeId\");\r\n            string name = element.GetRequiredAttributeValue(\"name\");\r\n            string @namespace = element.GetRequiredAttributeValue(\"namespace\");\r\n\r\n            bool isCodeGenerated = (bool) element.GetRequiredAttribute(\"isCodeGenerated\");\r\n            XAttribute cachableAttribute = element.Attribute(\"cachable\");\r\n            XAttribute searchableAttribute = element.Attribute(\"searchable\");\r\n            XAttribute buildNewHandlerTypeNameAttribute = element.Attribute(\"buildNewHandlerTypeName\");\r\n            XElement dataAssociationsElement = element.GetRequiredElement(\"DataAssociations\");\r\n            XElement dataScopesElement = element.GetRequiredElement(\"DataScopes\");\r\n            XElement keyPropertyNamesElement = element.GetRequiredElement(\"KeyPropertyNames\");\r\n            XElement versionKeyPropertyNamesElement = element.Element(\"VersionKeyPropertyNames\");\r\n            XElement superInterfacesElement = element.GetRequiredElement(\"SuperInterfaces\");\r\n            XElement fieldsElement = element.GetRequiredElement(\"Fields\");\r\n            XElement indexesElement = element.Element(\"Indexes\");\r\n\r\n            XAttribute titleAttribute = element.Attribute(\"title\");\r\n            XAttribute labelFieldNameAttribute = element.Attribute(\"labelFieldName\");\r\n            XAttribute internalUrlPrefixAttribute = element.Attribute(\"internalUrlPrefix\");\r\n            string typeManagerTypeName = (string) element.Attribute(\"typeManagerTypeName\");\r\n\r\n            bool cachable = cachableAttribute != null && (bool)cachableAttribute;\r\n            bool searchable = searchableAttribute != null && (bool)searchableAttribute;\r\n            \r\n\r\n            var dataTypeDescriptor = new DataTypeDescriptor(dataTypeId, @namespace, name, isCodeGenerated)\r\n            {\r\n                Cachable = cachable,\r\n                Searchable = searchable\r\n            };\r\n\r\n            if (titleAttribute != null) dataTypeDescriptor.Title = titleAttribute.Value;\r\n            if (labelFieldNameAttribute != null) dataTypeDescriptor.LabelFieldName = labelFieldNameAttribute.Value;\r\n            if (internalUrlPrefixAttribute != null) dataTypeDescriptor.InternalUrlPrefix = internalUrlPrefixAttribute.Value;\r\n            if (typeManagerTypeName != null)\r\n            {\r\n                typeManagerTypeName = TypeManager.FixLegasyTypeName(typeManagerTypeName);\r\n                dataTypeDescriptor.TypeManagerTypeName = typeManagerTypeName;\r\n            }\r\n            if (buildNewHandlerTypeNameAttribute != null) dataTypeDescriptor.BuildNewHandlerTypeName = buildNewHandlerTypeNameAttribute.Value;\r\n\r\n\r\n            foreach (XElement elm in dataAssociationsElement.Elements())\r\n            {\r\n                var dataTypeAssociationDescriptor = DataTypeAssociationDescriptor.FromXml(elm);\r\n\r\n                dataTypeDescriptor.DataAssociations.Add(dataTypeAssociationDescriptor);\r\n            }\r\n\r\n            foreach (XElement elm in dataScopesElement.Elements(\"DataScopeIdentifier\"))\r\n            {\r\n                string dataScopeName = elm.GetRequiredAttributeValue(\"name\");\r\n                if (DataScopeIdentifier.IsLegasyDataScope(dataScopeName))\r\n                {\r\n                    Log.LogWarning(LogTitle, \"Ignored legacy data scope '{0}' on type '{1}.{2}' while deserializing DataTypeDescriptor. The '{0}' data scope is no longer supported.\".FormatWith(dataScopeName, @namespace, name));\r\n                    continue;\r\n                }\r\n\r\n                DataScopeIdentifier dataScopeIdentifier = DataScopeIdentifier.Deserialize(dataScopeName);\r\n\r\n                dataTypeDescriptor.DataScopes.Add(dataScopeIdentifier);\r\n            }\r\n\r\n            foreach (XElement elm in superInterfacesElement.Elements(\"SuperInterface\"))\r\n            {\r\n                string superInterfaceTypeName = elm.GetRequiredAttributeValue(\"type\");\r\n\r\n                if (superInterfaceTypeName.StartsWith(\"Composite.Data.ProcessControlled.IDeleteControlled\"))\r\n                {\r\n                    Log.LogWarning(LogTitle, $\"Ignored legacy super interface '{superInterfaceTypeName}' on type '{@namespace}.{name}' while deserializing DataTypeDescriptor. This super interface is no longer supported.\");\r\n                    continue;\r\n                }\r\n                \r\n                Type superInterface;\r\n\r\n                try\r\n                {\r\n                    superInterface = TypeManager.GetType(superInterfaceTypeName);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw XmlConfigurationExtensionMethods.GetConfigurationException($\"Failed to load super interface '{superInterfaceTypeName}'\", ex, elm);\r\n                }\r\n\r\n                dataTypeDescriptor.AddSuperInterface(superInterface, !inheritedFieldsIncluded);\r\n            }\r\n\r\n            foreach (XElement elm in fieldsElement.Elements())\r\n            {\r\n                var dataFieldDescriptor = DataFieldDescriptor.FromXml(elm);\r\n\r\n                try\r\n                {\r\n                    dataTypeDescriptor.Fields.Add(dataFieldDescriptor);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw XmlConfigurationExtensionMethods.GetConfigurationException(\"Failed to add a data field: \" + ex.Message, ex, elm);\r\n                }\r\n            }\r\n\r\n            foreach (XElement elm in keyPropertyNamesElement.Elements(\"KeyPropertyName\"))\r\n            {\r\n                var propertyName = elm.GetRequiredAttributeValue(\"name\");\r\n\r\n                bool isDefinedOnSuperInterface = dataTypeDescriptor.SuperInterfaces.Any(f => f.GetProperty(propertyName) != null);\r\n                if (!isDefinedOnSuperInterface)\r\n                {\r\n                    dataTypeDescriptor.KeyPropertyNames.Add(propertyName);\r\n                }\r\n            }\r\n\r\n            if (versionKeyPropertyNamesElement != null)\r\n            {\r\n                foreach (XElement elm in versionKeyPropertyNamesElement.Elements(\"VersionKeyPropertyName\"))\r\n                {\r\n                    var propertyName = elm.GetRequiredAttributeValue(\"name\");\r\n\r\n                    dataTypeDescriptor.VersionKeyPropertyNames.Add(propertyName);\r\n                }\r\n            }\r\n\r\n            if (indexesElement != null)\r\n            {\r\n                dataTypeDescriptor.Indexes = indexesElement.Elements(\"Index\").Select(DataTypeIndex.FromXml).ToList();\r\n            }\r\n\r\n            // Loading field rendering profiles for static data types\r\n            if (!isCodeGenerated && typeManagerTypeName != null)\r\n            {\r\n                Type type = Type.GetType(typeManagerTypeName);\r\n                if (type != null)\r\n                {\r\n                    foreach (var fieldDescriptor in dataTypeDescriptor.Fields)\r\n                    {\r\n                        var property = type.GetProperty(fieldDescriptor.Name);\r\n\r\n                        if (property != null)\r\n                        {\r\n                            var formRenderingProfile = DynamicTypeReflectionFacade.GetFormRenderingProfile(property);\r\n                            if (formRenderingProfile != null)\r\n                            {\r\n                                fieldDescriptor.FormRenderingProfile = formRenderingProfile;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            \r\n\r\n            return dataTypeDescriptor;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return this.DataTypeId.GetHashCode();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as DataTypeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return dataTypeDescriptor != null && dataTypeDescriptor.DataTypeId == this.DataTypeId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            if (this.Namespace == \"\")\r\n            {\r\n                return this.Name;\r\n            }\r\n\r\n            return this.Namespace + \".\" + this.Name;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    public static class DataTypeDescriptorExtensions\r\n    {\r\n        /// <summary>\r\n        /// This method returns the full interface name. F.e. \"Composite.Data.Types.IPage\"\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        /// <returns></returns>\r\n        public static string GetFullInterfaceName(this DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return dataTypeDescriptor.Namespace + \".\" + dataTypeDescriptor.Name;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This method will return false if the type is not code generated and does exists\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        /// <returns></returns>\r\n        public static bool ValidateRuntimeType(this DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Verify.ArgumentNotNull(dataTypeDescriptor, \"dataTypeDescriptor\");\r\n\r\n            if (dataTypeDescriptor.IsCodeGenerated) return true;\r\n\r\n            Type dataType = TypeManager.TryGetType(dataTypeDescriptor.TypeManagerTypeName);\r\n            return dataType != null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataTypeDescriptorFormsHelper.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.PublishScheduling;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Foundation;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_GeneratedDataTypesElementProvider;\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    public sealed class DataTypeDescriptorFormsHelper\r\n    {\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;\r\n        private readonly List<string> _readOnlyFields = new List<string>();\r\n        private readonly bool _showPublicationStatusSelector;\r\n        private readonly string _bindingNamesPrefix;\r\n\r\n        private XDocument _customFormDefinition;\r\n        private bool _customFormDefinitionInitialized;\r\n        private string _generatedForm;\r\n        private XElement _bindingsXml;\r\n        private XElement _panelXml;\r\n\r\n        private const string PublicationStatusPostFixBindingName = \"PublicationStatus\";\r\n        private const string PublicationStatusOptionsPostFixBindingName = \"PublicationStatusOptions\";\r\n\r\n        private static readonly XElement CmsFormElementTemplate;\r\n        private static readonly XElement CmsBindingsElementTemplate;\r\n        private static readonly XElement CmsLayoutElementTemplate;\r\n\r\n\r\n        /// <exclude />\r\n        static DataTypeDescriptorFormsHelper()\r\n        {\r\n            CmsFormElementTemplate = XElement.Parse(string.Format(@\"<cms:{0} xmlns:cms=\"\"{1}\"\" xmlns=\"\"{2}\"\" xmlns:ff=\"\"{3}\"\" xmlns:f=\"\"{4}\"\" />\", FormKeyTagNames.FormDefinition, Namespaces.BindingForms10, Namespaces.BindingFormsStdUiControls10, Namespaces.BindingFormsStdFuncLib10, FunctionTreeConfigurationNames.NamespaceName));\r\n            CmsBindingsElementTemplate = new XElement(Namespaces.BindingForms10 + FormKeyTagNames.Bindings);\r\n            CmsLayoutElementTemplate = new XElement(Namespaces.BindingForms10 + FormKeyTagNames.Layout);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates an instance of <see cref=\"DataTypeDescriptorFormsHelper\"/>\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        /// <param name=\"showPublicationStatusSelector\"></param>\r\n        /// <param name=\"entityToken\">EntityToken is used for resolving to which publication states, current user has access to.</param>\r\n        public DataTypeDescriptorFormsHelper(DataTypeDescriptor dataTypeDescriptor, bool showPublicationStatusSelector, EntityToken entityToken)\r\n            : this(dataTypeDescriptor, null, showPublicationStatusSelector, entityToken)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataTypeDescriptorFormsHelper(DataTypeDescriptor dataTypeDescriptor)\r\n            : this(dataTypeDescriptor, null, false, null)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataTypeDescriptorFormsHelper(DataTypeDescriptor dataTypeDescriptor, string bindingNamesPrefix)\r\n            : this(dataTypeDescriptor, bindingNamesPrefix, false, null)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataTypeDescriptorFormsHelper(DataTypeDescriptor dataTypeDescriptor, string bindingNamesPrefix, bool showPublicationStatusSelector, EntityToken entityToken)\r\n        {\r\n            if (dataTypeDescriptor == null) throw new ArgumentNullException(\"dataTypeDescriptor\");\r\n\r\n            _dataTypeDescriptor = dataTypeDescriptor;\r\n            _bindingNamesPrefix = bindingNamesPrefix;\r\n            _showPublicationStatusSelector = showPublicationStatusSelector;\r\n            EntityToken = entityToken;\r\n            LayoutIconHandle = null;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataTypeDescriptor DataTypeDescriptor\r\n        {\r\n            get\r\n            {\r\n                return _dataTypeDescriptor;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public XDocument CustomFormDefinition\r\n        {\r\n            get\r\n            {\r\n                if (!_customFormDefinitionInitialized)\r\n                {\r\n                    _customFormDefinition = DynamicTypesCustomFormFacade.GetCustomFormMarkup(_dataTypeDescriptor);\r\n\r\n                    _customFormDefinitionInitialized = true;\r\n                }\r\n\r\n                return _customFormDefinition;\r\n            }\r\n            set\r\n            {\r\n                _customFormDefinition = value;\r\n                _customFormDefinitionInitialized = true;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public void AddReadOnlyField(string fieldName)\r\n        {\r\n            _readOnlyFields.Add(fieldName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddReadOnlyFields(IEnumerable<string> fieldNames)\r\n        {\r\n            _readOnlyFields.AddRange(fieldNames);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string GetForm()\r\n        {\r\n            if (_generatedForm == null)\r\n            {\r\n                GenerateForm();\r\n            }\r\n\r\n            return _generatedForm;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement BindingXml\r\n        {\r\n            get\r\n            {\r\n                if (_bindingsXml == null)\r\n                {\r\n                    GenerateForm();\r\n                }\r\n\r\n                return _bindingsXml;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement PanelXml\r\n        {\r\n            get\r\n            {\r\n                if (_panelXml == null)\r\n                {\r\n                    GenerateForm();\r\n                }\r\n\r\n                return _panelXml;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string BindingNamesPrefix\r\n        {\r\n            get\r\n            {\r\n                return _bindingNamesPrefix;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateWithNewBindings(Dictionary<string, object> bindings)\r\n        {\r\n            var newBindings = GetNewBindings();\r\n\r\n            foreach (var kvp in newBindings)\r\n            {\r\n                bindings[kvp.Key] = kvp.Value;\r\n            }\r\n        }\r\n\r\n        private static object GetDefaultValue(Type type)\r\n        {\r\n            if (type == typeof(int)) return 0;\r\n            if (type == typeof(decimal)) return (decimal)0.0;\r\n            if (type == typeof(DateTime)) return DateTime.Now;\r\n            if (type == typeof(bool)) return false;\r\n            if (type == typeof(Guid)) return Guid.Empty;\r\n\r\n            return null;\r\n        }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> GetNewBindings()\r\n        {\r\n            var newBindings = new Dictionary<string, object>();\r\n\r\n            foreach (var fieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                var fieldType = fieldDescriptor.InstanceType;\r\n\r\n                object value;\r\n                if (fieldDescriptor.IsNullable\r\n                    || (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(Nullable<>)))\r\n                {\r\n                    value = null;\r\n                }\r\n                else\r\n                {\r\n                    if (fieldType == typeof(string) && fieldDescriptor.ForeignKeyReferenceTypeName == null)\r\n                    {\r\n                        value = \"\";\r\n                    }\r\n                    else\r\n                    {\r\n                        value = GetDefaultValue(fieldType);\r\n                    }\r\n                }\r\n\r\n                newBindings.Add(GetBindingName(fieldDescriptor), value);\r\n            }\r\n\r\n            if (_showPublicationStatusSelector &&\r\n                _dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)))\r\n            {\r\n                newBindings[PublicationStatusBindingName] = GenericPublishProcessController.Draft;\r\n                newBindings.Add(PublicationStatusOptionsBindingName, GetAvailablePublishingFlowTransitions(EntityToken));\r\n            }\r\n\r\n\r\n            return newBindings;\r\n        }\r\n\r\n        private static Dictionary<string, string> GetAvailablePublishingFlowTransitions(EntityToken entityToken)\r\n        {\r\n            if(UserValidationFacade.IsLoggedIn())\r\n            {\r\n                var transitionNames = new Dictionary<string, string>\r\n                {\r\n                    {GenericPublishProcessController.Draft, LocalizationFiles.Composite_Management.PublishingStatus_draft},\r\n                    {GenericPublishProcessController.AwaitingApproval,  LocalizationFiles.Composite_Management.PublishingStatus_awaitingApproval}\r\n                };\r\n\r\n                var username = UserValidationFacade.GetUsername();\r\n                var userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(username);\r\n                var userGroupPermissionDefinition = PermissionTypeFacade.GetUserGroupPermissionDefinitions(username);\r\n                var currentPermissionTypes = PermissionTypeFacade.GetCurrentPermissionTypes(UserValidationFacade.GetUserToken(), entityToken, userPermissionDefinitions, userGroupPermissionDefinition);\r\n                foreach (var permissionType in currentPermissionTypes)\r\n                {\r\n                    if (GenericPublishProcessController.AwaitingPublicationActionPermissionType.Contains(permissionType))\r\n                    {\r\n                        transitionNames.Add(GenericPublishProcessController.AwaitingPublication,\r\n                            LocalizationFiles.Composite_Management.PublishingStatus_awaitingPublication);\r\n                        break;\r\n                    }\r\n                }\r\n\r\n                return transitionNames;\r\n            }\r\n            else\r\n            {\r\n                return new Dictionary<string, string>();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateWithBindings(IData dataObject, Dictionary<string, object> bindings)\r\n        {\r\n            var newBindings = GetBindings(dataObject);\r\n\r\n            foreach (var kvp in newBindings)\r\n            {\r\n                bindings[kvp.Key] = kvp.Value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> GetBindings(IData dataObject)\r\n        {\r\n            return GetBindings(dataObject, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> GetBindings(IData dataObject, bool allowMandatoryNonDefaultingProperties)\r\n        {\r\n            if (dataObject == null) throw new ArgumentNullException(\"dataObject\");\r\n\r\n            var bindings = new Dictionary<string, object>();\r\n\r\n            foreach (var fieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                var propertyInfo = dataObject.GetType().GetProperty(fieldDescriptor.Name);\r\n\r\n                if (propertyInfo.CanRead)\r\n                {\r\n                    var value = propertyInfo.GetGetMethod().Invoke(dataObject, null);\r\n\r\n                    if (value == null && !fieldDescriptor.IsNullable)\r\n                    {\r\n                        if (fieldDescriptor.IsNullable)\r\n                        {\r\n                            // Ignore, null is allowed\r\n                        }\r\n                        else if (fieldDescriptor.InstanceType.IsGenericType\r\n                                 && fieldDescriptor.InstanceType.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n                        {\r\n                            // Ignore, null is allowed\r\n                        }\r\n                        else if (allowMandatoryNonDefaultingProperties)\r\n                        {\r\n                            if (propertyInfo.PropertyType == typeof(string) && fieldDescriptor.ForeignKeyReferenceTypeName == null) //FK fields stay NULL\r\n                            {\r\n                                value = \"\";\r\n                            }\r\n                            else\r\n                            {\r\n                                value = GetDefaultValue(propertyInfo.PropertyType);\r\n                            }\r\n                        }\r\n                        else\r\n                        {\r\n                            throw new InvalidOperationException(string.Format(\"Field '{0}' on type '{1}' is null, does not allow null and does not have a default value\", fieldDescriptor.Name, _dataTypeDescriptor.TypeManagerTypeName));\r\n                        }\r\n                    }\r\n\r\n                    bindings.Add(GetBindingName(fieldDescriptor), value);\r\n                }\r\n            }\r\n\r\n            if (_showPublicationStatusSelector &&\r\n                _dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)))\r\n            {\r\n                bindings[PublicationStatusBindingName] = ((IPublishControlled)dataObject).PublicationStatus;\r\n                bindings.Add(PublicationStatusOptionsBindingName, GetAvailablePublishingFlowTransitions(EntityToken));\r\n\r\n                var interfaceType = dataObject.DataSourceId.InterfaceType;\r\n                var stringKey = dataObject.GetUniqueKey().ToString();\r\n                var locale = dataObject.DataSourceId.LocaleScope.Name;\r\n\r\n                var existingPublishSchedule = PublishScheduleHelper.GetPublishSchedule(interfaceType, stringKey, locale);\r\n                bindings.Add(\"PublishDate\", existingPublishSchedule?.PublishDate);\r\n\r\n                var existingUnpublishSchedule = PublishScheduleHelper.GetUnpublishSchedule(interfaceType, stringKey, locale);\r\n                bindings.Add(\"UnpublishDate\", existingUnpublishSchedule?.UnpublishDate);\r\n            }\r\n\r\n            return bindings;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, List<ClientValidationRule>> GetBindingsValidationRules(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            var result = new Dictionary<string, List<ClientValidationRule>>();\r\n\r\n            foreach (var fieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                var rules = ClientValidationRuleFacade.GetClientValidationRules(data, fieldDescriptor.Name);\r\n\r\n                result.Add(GetBindingName(fieldDescriptor), rules);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> BindingsToObject(Dictionary<string, object> bindings, IData dataObject)\r\n        {\r\n            var errorMessages = new Dictionary<string, string>();\r\n\r\n            foreach (var fieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                if (_readOnlyFields.Contains(fieldDescriptor.Name))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var bindingName = GetBindingName(fieldDescriptor);\r\n\r\n                if (!bindings.ContainsKey(bindingName))\r\n                {\r\n                    Verify.That(fieldDescriptor.IsNullable, \"Missing value for field '{0}'\", fieldDescriptor.Name);\r\n                    continue;\r\n                }\r\n\r\n                var propertyInfo = dataObject.GetType().GetProperty(fieldDescriptor.Name);\r\n\r\n                if (propertyInfo.CanWrite)\r\n                {\r\n                    var newValue = bindings[bindingName];\r\n\r\n                    if (newValue is string && (newValue as string) == \"\" && IsNullableStringReference(propertyInfo))\r\n                    {\r\n                        newValue = null;\r\n                    }\r\n\r\n                    try\r\n                    {\r\n                        newValue = ValueTypeConverter.Convert(newValue, propertyInfo.PropertyType);\r\n\r\n                        propertyInfo.GetSetMethod().Invoke(dataObject, new[] { newValue });\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        errorMessages.Add(bindingName, ex.Message);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (_showPublicationStatusSelector &&\r\n                _dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)))\r\n            {\r\n                var publishControlled = dataObject as IPublishControlled;\r\n\r\n                publishControlled.PublicationStatus = (string)bindings[PublicationStatusBindingName];\r\n            }\r\n\r\n            if (errorMessages.Count > 0)\r\n            {\r\n                return errorMessages;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        private static bool IsNullableStringReference(PropertyInfo propertyInfo)\r\n        {\r\n            var dataType = propertyInfo.DeclaringType;\r\n            return DataAttributeFacade.GetDataReferenceProperties(dataType)\r\n                                      .Any(foreignKey => foreignKey.SourcePropertyName == propertyInfo.Name && foreignKey.IsNullableString);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> ObjectToBindings(IData dataObject, Dictionary<string, object> bindings)\r\n        {\r\n            var errorMessages = new Dictionary<string, string>();\r\n\r\n            foreach (var fieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                var bindingName = GetBindingName(fieldDescriptor);\r\n\r\n                if (bindings.ContainsKey(bindingName))\r\n                {\r\n                    var propertyInfo = dataObject.GetType().GetProperty(fieldDescriptor.Name);\r\n\r\n                    Verify.IsNotNull(propertyInfo, \"Missing property type '{0}' does not contain property '{1}'\", dataObject.GetType(), fieldDescriptor.Name);\r\n\r\n                    if (propertyInfo.CanRead)\r\n                    {\r\n                        var newValue = propertyInfo.GetValue(dataObject, null);\r\n\r\n                        if (newValue == null && !fieldDescriptor.IsNullable)\r\n                        {\r\n                            var fieldType = fieldDescriptor.InstanceType;\r\n\r\n                            if (fieldType == typeof(string) && fieldDescriptor.ForeignKeyReferenceTypeName == null)\r\n                            {\r\n                                newValue = \"\";\r\n                            }\r\n                            else\r\n                            {\r\n                                newValue = GetDefaultValue(fieldType);\r\n                            }\r\n                        }\r\n\r\n                        try\r\n                        {\r\n                            bindings[bindingName] = newValue;\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            errorMessages.Add(bindingName, ex.Message);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (_showPublicationStatusSelector &&\r\n                _dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)))\r\n            {\r\n                var publishControlled = dataObject as IPublishControlled;\r\n\r\n                bindings[PublicationStatusBindingName] = publishControlled.PublicationStatus;\r\n            }\r\n\r\n            return errorMessages.Count > 0 ? errorMessages : null;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string LayoutIconHandle\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XNamespace MainNamespace => Namespaces.BindingFormsStdUiControls10;\r\n\r\n\r\n        /// <exclude />\r\n        public static XNamespace CmsNamespace => Namespaces.BindingForms10;\r\n\r\n\r\n        /// <exclude />\r\n        public static XNamespace FunctionNamespace => Namespaces.BindingFormsStdFuncLib10;\r\n\r\n\r\n        /// <exclude />\r\n        public string FieldGroupLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string LayoutLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        private Type GetFieldBindingType(DataFieldDescriptor fieldDescriptor)\r\n        {\r\n            var bindingType = fieldDescriptor.InstanceType;\r\n\r\n            // Nullable<T> handling. Allowed types: Nullable<Guid>, Nullable<int>, Nullable<decimal>\r\n            if (bindingType != typeof(Guid?)\r\n                && bindingType != typeof(int?)\r\n                && bindingType != typeof(decimal?)\r\n                && bindingType.IsGenericType && bindingType.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n            {\r\n                return bindingType.GetGenericArguments()[0];\r\n            }\r\n\r\n            return bindingType;\r\n        }\r\n\r\n\r\n        private EntityToken EntityToken\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        private void GenerateForm()\r\n        {\r\n            var fieldNameToBindingNameMapper = new Dictionary<string, string>();\r\n\r\n            _bindingsXml = new XElement(CmsBindingsElementTemplate);\r\n            var layout = new XElement(CmsLayoutElementTemplate);\r\n\r\n            if (!string.IsNullOrEmpty(LayoutIconHandle))\r\n            {\r\n                layout.Add(new XAttribute(\"iconhandle\", LayoutIconHandle));\r\n            }\r\n\r\n            // Add a read binding as the layout label\r\n            if (!string.IsNullOrEmpty(LayoutLabel))\r\n            {\r\n                var labelAttribute = new XAttribute(\"label\", LayoutLabel);\r\n                layout.Add(labelAttribute);\r\n            }\r\n            else if (!string.IsNullOrEmpty(_dataTypeDescriptor.LabelFieldName))\r\n            {\r\n                layout.Add((new XElement(CmsNamespace + \"layout.label\", new XElement(CmsNamespace + \"read\", new XAttribute(\"source\", _dataTypeDescriptor.LabelFieldName)))));\r\n            }\r\n\r\n\r\n            _panelXml = new XElement(MainNamespace + \"FieldGroup\");\r\n\r\n            string formLabel = !string.IsNullOrEmpty(FieldGroupLabel) ? FieldGroupLabel : _dataTypeDescriptor.Title;\r\n            if (!string.IsNullOrEmpty(formLabel))\r\n            {\r\n                _panelXml.Add(new XAttribute(\"Label\", formLabel));\r\n            }\r\n            \r\n            layout.Add(_panelXml);\r\n\r\n            foreach (var fieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                var bindingType = GetFieldBindingType(fieldDescriptor);\r\n                var bindingName = GetBindingName(fieldDescriptor);\r\n\r\n                fieldNameToBindingNameMapper.Add(fieldDescriptor.Name, bindingName);\r\n\r\n                var binding = new XElement(CmsNamespace + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", bindingName),\r\n                    new XAttribute(\"type\", bindingType));\r\n\r\n                if (fieldDescriptor.IsNullable)\r\n                {\r\n                    binding.Add(new XAttribute(\"optional\", \"true\"));\r\n                }\r\n\r\n                _bindingsXml.Add(binding);\r\n\r\n                if (!_readOnlyFields.Contains(fieldDescriptor.Name))\r\n                {\r\n                    XElement widgetFunctionMarkup;\r\n                    var label = fieldDescriptor.FormRenderingProfile.Label;\r\n                    if (label.IsNullOrEmpty())\r\n                    {\r\n                        label = fieldDescriptor.Name;\r\n                    }\r\n\r\n                    var helptext = fieldDescriptor.FormRenderingProfile.HelpText ?? \"\";\r\n\r\n                    if (!string.IsNullOrEmpty(fieldDescriptor.FormRenderingProfile.WidgetFunctionMarkup))\r\n                    {\r\n                        widgetFunctionMarkup = XElement.Parse(fieldDescriptor.FormRenderingProfile.WidgetFunctionMarkup);\r\n                    }\r\n                    else if (!DataTypeDescriptor.IsCodeGenerated && fieldDescriptor.FormRenderingProfile.WidgetFunctionMarkup == null)\r\n                    {\r\n                        // Auto generating a widget for not code generated data types\r\n                        Type fieldType;\r\n\r\n                        if (!fieldDescriptor.ForeignKeyReferenceTypeName.IsNullOrEmpty())\r\n                        {\r\n                            Type foreignKeyType;\r\n\r\n                            try\r\n                            {\r\n                                foreignKeyType = Type.GetType(fieldDescriptor.ForeignKeyReferenceTypeName, true);\r\n                            }\r\n                            catch (Exception ex)\r\n                            {\r\n                                throw new InvalidOperationException(\"Failed to get referenced foreign key type '{0}'\".FormatWith(fieldDescriptor.ForeignKeyReferenceTypeName), ex);\r\n                            }\r\n\r\n                            var referenceTemplateType = fieldDescriptor.IsNullable ? typeof(NullableDataReference<>) : typeof(DataReference<>);\r\n\r\n                            fieldType = referenceTemplateType.MakeGenericType(foreignKeyType);\r\n                        }\r\n                        else\r\n                        {\r\n                            fieldType = fieldDescriptor.InstanceType;\r\n                        }\r\n\r\n                        var widgetFunctionProvider = StandardWidgetFunctions.GetDefaultWidgetFunctionProviderByType(fieldType);\r\n                        if (widgetFunctionProvider != null)\r\n                        {\r\n                            widgetFunctionMarkup = widgetFunctionProvider.SerializedWidgetFunction;\r\n                        }\r\n                        else\r\n                        {\r\n                            continue;\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    var widgetRuntimeTreeNode = (WidgetFunctionRuntimeTreeNode)FunctionTreeBuilder.Build(widgetFunctionMarkup);\r\n                    widgetRuntimeTreeNode.Label = label;\r\n                    widgetRuntimeTreeNode.HelpDefinition = new HelpDefinition(helptext);\r\n                    widgetRuntimeTreeNode.BindingSourceName = bindingName;\r\n\r\n                    var element = (XElement)widgetRuntimeTreeNode.GetValue();\r\n                    _panelXml.Add(element);\r\n                }\r\n            }\r\n\r\n            if (_showPublicationStatusSelector && _dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)))\r\n            {\r\n                var placeholder = new XElement(MainNamespace + \"PlaceHolder\");\r\n                _panelXml.Remove();\r\n\r\n                placeholder.Add(_panelXml);\r\n                layout.Add(placeholder);\r\n                \r\n                var publishFieldsXml = new XElement(MainNamespace + \"FieldGroup\", new XAttribute(\"Label\", Texts.PublicationSettings_FieldGroupLabel));\r\n                placeholder.Add(publishFieldsXml);\r\n\r\n                var publicationStatusOptionsBinding = new XElement(CmsNamespace + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", PublicationStatusOptionsBindingName),\r\n                    new XAttribute(\"type\", typeof(object)));\r\n\r\n                _bindingsXml.Add(publicationStatusOptionsBinding);\r\n\r\n                var element =\r\n                    new XElement(MainNamespace + \"KeySelector\",\r\n                        new XAttribute(\"OptionsKeyField\", \"Key\"),\r\n                        new XAttribute(\"OptionsLabelField\", \"Value\"),\r\n                        new XAttribute(\"Label\", Texts.PublicationStatus_Label),\r\n                        new XAttribute(\"Help\", Texts.PublicationStatus_Help),\r\n                        new XElement(MainNamespace + \"KeySelector.Selected\",\r\n                            new XElement(CmsNamespace + \"bind\", new XAttribute(\"source\", PublicationStatusBindingName))),\r\n                        new XElement(MainNamespace + \"KeySelector.Options\",\r\n                            new XElement(CmsNamespace + \"read\", new XAttribute(\"source\", PublicationStatusOptionsBindingName)))\r\n                    );\r\n\r\n\r\n                publishFieldsXml.Add(element);\r\n                \r\n\r\n                var publishDateBinding = new XElement(CmsNamespace + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", \"PublishDate\"),\r\n                    new XAttribute(\"type\", typeof(DateTime)),\r\n                    new XAttribute(\"optional\", \"true\"));\r\n\r\n                _bindingsXml.Add(publishDateBinding);\r\n\r\n                publishFieldsXml.Add(\r\n                    new XElement(MainNamespace + \"DateTimeSelector\",\r\n                        new XAttribute(\"Label\", Texts.PublishDate_Label),\r\n                        new XAttribute(\"Help\", Texts.PublishDate_Help),\r\n                        new XElement(CmsNamespace + \"bind\",\r\n                            new XAttribute(\"source\", \"PublishDate\"))));\r\n\r\n                var unpublishDateBinding = new XElement(CmsNamespace + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", \"UnpublishDate\"),\r\n                    new XAttribute(\"type\", typeof(DateTime)),\r\n                    new XAttribute(\"optional\", \"true\"));\r\n\r\n                _bindingsXml.Add(unpublishDateBinding);\r\n\r\n                publishFieldsXml.Add(\r\n                    new XElement(MainNamespace + \"DateTimeSelector\",\r\n                        new XAttribute(\"Label\", Texts.UnpublishDate_Label),\r\n                        new XAttribute(\"Help\", Texts.UnpublishDate_Help),\r\n                        new XElement(CmsNamespace + \"bind\",\r\n                                new XAttribute(\"source\", \"UnpublishDate\"))));\r\n            }\r\n\r\n            var formDefinition = new XElement(CmsFormElementTemplate);\r\n            formDefinition.Add(_bindingsXml);\r\n            formDefinition.Add(layout);\r\n\r\n            if (CustomFormDefinition == null)\r\n            {\r\n                _generatedForm = formDefinition.ToString();\r\n            }\r\n            else\r\n            {\r\n                if (_showPublicationStatusSelector && _dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)))\r\n                {\r\n                    fieldNameToBindingNameMapper.Add(nameof(IPublishSchedule.PublishDate), nameof(IPublishSchedule.PublishDate));\r\n                    fieldNameToBindingNameMapper.Add(nameof(IUnpublishSchedule.UnpublishDate), nameof(IUnpublishSchedule.UnpublishDate));\r\n                }\r\n\r\n                Func<XElement, IEnumerable<XAttribute>> getBindingsFunc =\r\n                    doc => doc.Descendants(CmsNamespace + \"binding\").Attributes(\"name\")\r\n                           .Concat(doc.Descendants(CmsNamespace + \"bind\").Attributes(\"source\"))\r\n                           .Concat(doc.Descendants(CmsNamespace + \"read\").Attributes(\"source\"));\r\n\r\n                // Validation\r\n                foreach (var bindingNameAttribute in getBindingsFunc(CustomFormDefinition.Root))\r\n                {\r\n                    var bindingName = bindingNameAttribute.Value;\r\n\r\n                    if (!IsNotFieldBinding(bindingName) && !fieldNameToBindingNameMapper.ContainsKey(bindingName))\r\n                    {\r\n                        throw new ParseDefinitionFileException(\"Invalid binding name '{0}'\".FormatWith(bindingName), bindingNameAttribute);\r\n                    }\r\n                }\r\n\r\n                var formDefinitionElement = new XElement(CustomFormDefinition.Root);\r\n\r\n                foreach (var bindingNameAttribute in getBindingsFunc(formDefinitionElement).Where(attr => !IsNotFieldBinding(attr.Value)))\r\n                {\r\n                    bindingNameAttribute.Value = fieldNameToBindingNameMapper[bindingNameAttribute.Value];\r\n                }\r\n\r\n                if (!string.IsNullOrEmpty(FieldGroupLabel))\r\n                {\r\n                    foreach (var fieldGroupElement in formDefinitionElement.Descendants(MainNamespace + \"FieldGroup\"))\r\n                    {\r\n                        if (fieldGroupElement.Attribute(\"Label\") == null)\r\n                        {\r\n                            fieldGroupElement.Add(new XAttribute(\"Label\", FieldGroupLabel));\r\n                        }\r\n                    }\r\n                }\r\n\r\n                _generatedForm = formDefinitionElement.ToString();\r\n                _panelXml = formDefinitionElement.Elements().Last().Elements().LastOrDefault();\r\n            }\r\n        }\r\n\r\n\r\n        private bool IsNotFieldBinding(string bindingName)\r\n        {\r\n            return bindingName == PublicationStatusOptionsBindingName;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetBindingName(string prefix, string bindingName)\r\n        {\r\n            return string.Format(\"{0}{1}\", prefix, bindingName).Replace('.', '_');\r\n        }\r\n\r\n\r\n        private string GetBindingName(DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            if (string.IsNullOrEmpty(_bindingNamesPrefix))\r\n            {\r\n                return dataFieldDescriptor.Name;\r\n            }\r\n\r\n            return GetBindingName(_bindingNamesPrefix, dataFieldDescriptor.Name);\r\n        }\r\n\r\n\r\n\r\n        private string PublicationStatusBindingName\r\n        {\r\n            get\r\n            {\r\n                return GetBindingName(_bindingNamesPrefix, PublicationStatusPostFixBindingName);\r\n            }\r\n        }\r\n\r\n\r\n        private string PublicationStatusOptionsBindingName\r\n        {\r\n            get\r\n            {\r\n                return GetBindingName(_bindingNamesPrefix, PublicationStatusOptionsPostFixBindingName);\r\n            }\r\n        }\r\n\r\n        internal bool BindingIsOptional(string bindingName)\r\n        {\r\n            var customFormDefinition = CustomFormDefinition;\r\n\r\n            XElement bindingsXml;\r\n\r\n            if (customFormDefinition?.Root != null)\r\n            {\r\n                bindingsXml = customFormDefinition.Root;\r\n            }\r\n            else if (!_generatedForm.IsNullOrEmpty())\r\n            {\r\n                bindingsXml = XElement.Parse(_generatedForm);\r\n            }\r\n            else\r\n            {\r\n                bindingsXml = BindingXml;\r\n            }\r\n\r\n            var binding = bindingsXml\r\n                .Descendants(CmsNamespace + \"binding\")\r\n                .FirstOrDefault(e => (string)e.Attribute(\"name\") == bindingName);\r\n\r\n            return binding != null && string.Equals((string)binding.Attribute(\"optional\"), \"true\", StringComparison.OrdinalIgnoreCase);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataTypeDescriptorValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    internal sealed class DataTypeDescriptorValueXmlSerializer : IValueXmlSerializer\r\n\t{\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n\r\n            serializedObject = null;\r\n\r\n            if (objectToSerializeType != typeof(DataTypeDescriptor)) return false;\r\n\r\n            if (objectToSerialize == null)\r\n            {\r\n                serializedObject = new XElement(\"DataTypeDescriptor\");\r\n            }\r\n            else\r\n            {\r\n                DataTypeDescriptor dataTypeDescriptor = (DataTypeDescriptor)objectToSerialize;\r\n\r\n                serializedObject = dataTypeDescriptor.ToXml();\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject.Name.LocalName != \"DataTypeDescriptor\") return false;\r\n\r\n            if (serializedObject.Elements().Count() == 0)\r\n            {\r\n                deserializedObject = null;\r\n            }\r\n            else\r\n            {\r\n                deserializedObject = DataTypeDescriptor.FromXml(serializedObject);\r\n            }\r\n\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataTypeIndex.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Data.DynamicTypes.Configuration;\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class DataTypeIndex\r\n    {\r\n        private string _toString;\r\n\r\n        /// <exclude />\r\n        public DataTypeIndex(IReadOnlyCollection<Tuple<string, IndexDirection>> fields)\r\n        {\r\n            Fields = fields;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the list of fields\r\n        /// </summary>\r\n        public IReadOnlyCollection<Tuple<string, IndexDirection>> Fields\r\n        {\r\n            get; private set;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Defines whether current index is clustered. Only one index per data type can be choosen as clustered.\r\n        /// </summary>\r\n        public bool Clustered { get; set; }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            if (_toString == null)\r\n            {\r\n                var sb = new StringBuilder().Append(\"Index\");\r\n                if (Clustered)\r\n                {\r\n                    sb.Append(\", Clustered\");\r\n                }\r\n                sb.Append(\": \");\r\n\r\n                bool first = true;\r\n                foreach (var field in Fields)\r\n                {\r\n                    if (!first)\r\n                    {\r\n                        sb.Append(\", \");\r\n                    }\r\n\r\n                    sb.Append(\"{\").Append(field.Item1).Append(\", \").Append(field.Item2).Append(\"}\");\r\n\r\n                    first = false;\r\n                }\r\n                _toString = sb.ToString();\r\n            }\r\n\r\n            return _toString;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Serializes data type index into an XElement\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public XElement ToXml()\r\n        {\r\n            return new XElement(\"Index\",\r\n                Clustered ? new XAttribute(\"clustered\", true) : null,\r\n                new XElement(\"Fields\", \r\n                                Fields.Select(f => new XElement(\"Field\",\r\n                                    new XAttribute(\"name\", f.Item1),\r\n                                    new XAttribute(\"direction\", f.Item2)))));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Deserializes a <see cref=\"DataTypeIndex\"/>\r\n        /// </summary>\r\n        /// <param name=\"element\"></param>\r\n        /// <returns></returns>\r\n        public static DataTypeIndex FromXml(XElement element)\r\n        {\r\n            var clusteredAttribute = element.Attribute(\"clustered\");\r\n            bool isClustered = clusteredAttribute != null && (bool) clusteredAttribute;\r\n\r\n            var fieldsElement = element.Element(\"Fields\");\r\n            Verify.IsNotNull(fieldsElement, \"'Fields' element is missing\");\r\n\r\n            var fields = new List<Tuple<string, IndexDirection>>();\r\n            foreach (var field in fieldsElement.Elements(\"Field\"))\r\n            {\r\n                string fieldName = field.GetRequiredAttributeValue(\"name\");\r\n                var direction = (IndexDirection)Enum.Parse(typeof(IndexDirection), field.GetRequiredAttributeValue(\"direction\"));\r\n                fields.Add(new Tuple<string, IndexDirection>(fieldName, direction));\r\n            }\r\n\r\n            return new DataTypeIndex(fields) { Clustered = isClustered };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataTypeValidationRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.ComponentModel;\r\nusing System.Text;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// Used to keep information about the validation state of data types.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal static class DataTypeValidationRegistry\r\n    {\r\n        private static readonly ConcurrentDictionary<Type, string> _typeSpecificValidations = new ConcurrentDictionary<Type, string>();\r\n        private static readonly ConcurrentDictionary<string, ConcurrentDictionary<Type, string>> _providerSpecificValidations = new ConcurrentDictionary<string, ConcurrentDictionary<Type, string>>();\r\n\r\n\r\n        static DataTypeValidationRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"existingDataTypeDescriptor\">Use null to get existing data type descriptor</param>\r\n        /// <returns></returns>\r\n        public static bool Validate(Type interfaceType, DataTypeDescriptor existingDataTypeDescriptor)\r\n        {\r\n            string errorMessage;\r\n\r\n            return Validate(interfaceType, existingDataTypeDescriptor, out errorMessage);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"existingDataTypeDescriptor\">Use null to get existing data type descriptor</param>\r\n        /// <param name=\"errorMessage\"></param>\r\n        /// <returns></returns>\r\n        public static bool Validate(Type interfaceType, DataTypeDescriptor existingDataTypeDescriptor, out string errorMessage)\r\n        {\r\n            if (existingDataTypeDescriptor == null)\r\n            {\r\n                existingDataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(interfaceType.GetImmutableTypeId());\r\n\r\n                if (existingDataTypeDescriptor == null)\r\n                {\r\n                    errorMessage = null;\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            errorMessage = _typeSpecificValidations.GetOrAdd(\r\n                interfaceType,\r\n                f =>\r\n                {\r\n                    string message;\r\n                    bool isValid = DataTypeValidator.Validate(interfaceType, existingDataTypeDescriptor, out message);\r\n\r\n                    if (isValid) return null;\r\n\r\n                    var sb = new StringBuilder();\r\n                    sb.AppendLine(string.Format(\"The data type interface '{0}' did not validate and can't be used at the moment.\", interfaceType));\r\n                    sb.AppendLine(message);\r\n\r\n                    return sb.ToString();\r\n                }\r\n            );\r\n\r\n            return errorMessage == null;\r\n        }\r\n\r\n\r\n\r\n        public static bool IsValidForProvider(Type interfaceType, string providerName)\r\n        {\r\n            string errorMessage;\r\n\r\n            return IsValidForProvider(interfaceType, providerName, out errorMessage);\r\n        }\r\n\r\n        public static bool IsValidForProvider(Type interfaceType, string providerName, out string errorMessage)\r\n        {\r\n            return !_providerSpecificValidations\r\n                .GetOrAdd(providerName, s => new ConcurrentDictionary<Type, string>())\r\n                .TryGetValue(interfaceType, out errorMessage);\r\n        }\r\n\r\n\r\n        public static void ClearValidationError(Type interfaceType, string providerName)\r\n        {\r\n            ConcurrentDictionary<Type, string> cd;\r\n            if (!_providerSpecificValidations.TryGetValue(providerName, out cd))\r\n            {\r\n                return;\r\n            }\r\n\r\n            string error;\r\n            cd.TryRemove(interfaceType, out error);\r\n        }\r\n\r\n\r\n        public static void AddValidationError(Type interfaceType, string providerName, string errorMessage)\r\n        {\r\n            var providerErrors = _providerSpecificValidations\r\n                .GetOrAdd(providerName, s => new ConcurrentDictionary<Type, string>());\r\n\r\n            providerErrors.AddOrUpdate(interfaceType, t => errorMessage, (type, s) => s + errorMessage);\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _typeSpecificValidations.Clear();\r\n            _providerSpecificValidations.Clear();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataTypeValidator.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.ComponentModel;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal static class DataTypeValidator\r\n    {\r\n        /// <summary>\r\n        /// This method validates if the existing .NET runtime type match the recorded meta data (DataTypeDescriptor).\r\n        /// In case there is a mismatch, changes might have been done to the runtime type and an update on \r\n        /// the existing store(s)could not be performed.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"existingDataTypeDescriptor\"></param>\r\n        /// <param name=\"errorMessage\"></param>\r\n        /// <returns></returns>\r\n        public static bool Validate(Type interfaceType, DataTypeDescriptor existingDataTypeDescriptor, out string errorMessage)\r\n        {\r\n            DataTypeDescriptor newDataTypeDescriptor;\r\n            \r\n            try\r\n            {\r\n                newDataTypeDescriptor  = DynamicTypeManager.BuildNewDataTypeDescriptor(interfaceType);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                errorMessage = null;\r\n                return true;\r\n            }\r\n\r\n            try\r\n            {\r\n                new DataTypeChangeDescriptor(existingDataTypeDescriptor, newDataTypeDescriptor);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                errorMessage = ex.Message;\r\n                return false;\r\n            }\r\n\r\n            errorMessage = null;\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DataUrlProfile.cs",
    "content": "﻿using System;\nusing System.CodeDom;\nusing Composite.Core.Extensions;\n\nnamespace Composite.Data.DynamicTypes\n{\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n    [Serializable]\n    public class DataUrlProfile\n    {\n        /// <exclude />\n        public int Order { get; set; }\n\n        /// <exclude />\n        public DataUrlSegmentFormat? Format { get; set; }\n\n        /// <exclude />\n        public DataUrlProfile Clone()\n        {\n            return new DataUrlProfile {Order = Order, Format = Format};\n        }\n\n        /// <exclude />\n        internal CodeAttributeDeclaration GetCodeAttributeDeclaration()\n        {\n            if (Format == null || Format.Value == DataUrlSegmentFormat.Undefined)\n            {\n                return new CodeAttributeDeclaration(\n                            typeof(RouteSegmentAttribute).FullName,\n                                new CodeAttributeArgument( \n                                    new CodePrimitiveExpression(Order)));\n            }\n\n            var dateSegment = GetDateSegmentFormat();\n            return new CodeAttributeDeclaration(typeof (RouteDateSegmentAttribute).FullName,\n                new CodeAttributeArgument(new CodePrimitiveExpression(Order)),\n                new CodeAttributeArgument(new CodeFieldReferenceExpression(\n                    // Referencing an enum value\n                    new CodeTypeReferenceExpression(typeof(DateSegmentFormat)), dateSegment.ToString())));\n        }\n\n        private DateSegmentFormat GetDateSegmentFormat()\n        {\n            switch (Format.Value)\n            {\n                case DataUrlSegmentFormat.DateTime_Year: return DateSegmentFormat.Year;\n                case DataUrlSegmentFormat.DateTime_YearMonth: return DateSegmentFormat.YearMonth;\n                case DataUrlSegmentFormat.DateTime_YearMonthDay: return DateSegmentFormat.YearMonthDay;\n            }\n\n            throw new InvalidOperationException(\"Failed to convert '{0}' to DateSegmentFormat\".FormatWith(Format.Value));\n        }\n    }\n\n    \n\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n    public enum DataUrlSegmentFormat\n    {\n        /// <exclude />\n        Undefined = 0,\n        /// <exclude />\n        DateTime_Year = 1,\n        /// <exclude />\n        DateTime_YearMonth = 2,\n        /// <exclude />\n        DateTime_YearMonthDay = 3\n    }\n}\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/Debug/DynamicTempTypeCreator.cs",
    "content": "﻿#define USE_TEMPTYPECREATOR\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.ExtendedDataType.Debug\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DynamicTempTypeCreator\r\n    {\r\n        private readonly string _namePrefix;\r\n        private List<DataFieldDescriptor> _dataFieldDescriptors;\r\n\r\n\r\n        /// <exclude />\r\n        public DynamicTempTypeCreator(string namePrefix)\r\n        {\r\n            _namePrefix = namePrefix;\r\n\r\n            Initialize();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool UseTempTypeCreator\r\n        {\r\n            get\r\n            {\r\n#if USE_TEMPTYPECREATOR\r\n                return true;\r\n#else\r\n                return false;\r\n#endif\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string TypeName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string TypeTitle\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public List<DataFieldDescriptor> DataFieldDescriptors => _dataFieldDescriptors;\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            int counter = 1;\r\n            while (true)\r\n            {\r\n                string typeName = $\"{_namePrefix}{counter++}\";\r\n\r\n                if (!DataMetaDataFacade.GeneratedTypeDataTypeDescriptors.Any(d => d.Name == typeName))\r\n                {\r\n                    TypeName = TypeTitle = typeName;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            \r\n            _dataFieldDescriptors = new List<DataFieldDescriptor>\r\n            {\r\n                new DataFieldDescriptor(Guid.NewGuid(), \"MyStringField\", StoreFieldType.String(64), typeof(string))\r\n                {\r\n                    Position = 10,\r\n                    IsNullable = true,\r\n                    DataUrlProfile = new DataUrlProfile\r\n                    {\r\n                        Format = DataUrlSegmentFormat.DateTime_Year,\r\n                        Order = 1\r\n                    },\r\n                    FormRenderingProfile = new DataFieldFormRenderingProfile\r\n                    {\r\n                        Label = \"MyStringField\",\r\n                        HelpText = \"This is an auto-generated field.\",\r\n                        WidgetFunctionMarkup = GetWidgetFunctionMarkup(\"Composite.Widgets.String.TextBox\")\r\n                    },\r\n                    TreeOrderingProfile = new DataFieldTreeOrderingProfile\r\n                    {\r\n                        OrderPriority = 1,\r\n                        OrderDescending = false,\r\n                    },\r\n                    SearchProfile = new SearchProfile\r\n                    {\r\n                        IndexText = true\r\n                    }\r\n                }, \r\n                new DataFieldDescriptor(Guid.NewGuid(), \"MyIntField\", StoreFieldType.Integer, typeof(int))\r\n                {\r\n                    Position = 11,\r\n                    FormRenderingProfile = new DataFieldFormRenderingProfile\r\n                    {\r\n                        Label = \"MyIntField\",\r\n                        HelpText = \"This is an auto-generated field.\",\r\n                        WidgetFunctionMarkup = GetWidgetFunctionMarkup(\"Composite.Widgets.String.TextBox\")\r\n                    },\r\n                    TreeOrderingProfile = new DataFieldTreeOrderingProfile\r\n                    {\r\n                        OrderPriority = 2,\r\n                        OrderDescending = true,\r\n                    }\r\n                },\r\n                new DataFieldDescriptor(Guid.NewGuid(), \"MyDateTimeField\", StoreFieldType.DateTime, typeof(DateTime?))\r\n                {\r\n                    IsNullable = true,\r\n                    Position = 12,\r\n                    FormRenderingProfile = new DataFieldFormRenderingProfile\r\n                    {\r\n                        Label = \"MyDateTimeField\",\r\n                        HelpText = \"This is an auto-generated field.\",\r\n                        WidgetFunctionMarkup = GetWidgetFunctionMarkup(\"Composite.Widgets.Date.DateSelector\")\r\n                    },\r\n                    TreeOrderingProfile = new DataFieldTreeOrderingProfile\r\n                    {\r\n                        OrderPriority = null,\r\n                    }\r\n                }\r\n            };\r\n        }\r\n\r\n        private static string GetWidgetFunctionMarkup(string widgetFunctionName)\r\n        {\r\n            return @\"<f:widgetfunction xmlns:f=\"\"http://www.composite.net/ns/function/1.0\"\" name=\"\"{Name}\"\" label=\"\"\"\" bindingsourcename=\"\"\"\">\r\n                         <f:helpdefinition xmlns:f=\"\"http://www.composite.net/ns/function/1.0\"\" helptext=\"\"\"\" />\r\n                     </f:widgetfunction>\".Replace(\"{Name}\", widgetFunctionName);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/DynamicTypes/DefaultValue.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Text;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>\r\n    /// Represents a default value for a data type field\r\n    /// </summary>\r\n    [Serializable]\r\n    public sealed class DefaultValue : IComparable\r\n    {\r\n        private readonly object _value;\r\n        private readonly DefaultValueType _valueType;\r\n\r\n        private readonly RandomStringSettings _randomStringSettings;\r\n\r\n        /// <summary>\r\n        /// String default value\r\n        /// </summary>\r\n        /// <param name=\"defaultValue\">value</param>\r\n        /// <returns></returns>\r\n        public static DefaultValue String(string defaultValue) { return new DefaultValue(defaultValue); }\r\n\r\n        /// <summary>\r\n        /// Int default value\r\n        /// </summary>\r\n        /// <param name=\"defaultValue\">value</param>\r\n        /// <returns></returns>\r\n        public static DefaultValue Integer(int defaultValue) { return new DefaultValue(defaultValue); }\r\n\r\n        /// <summary>\r\n        /// Decimal default value\r\n        /// </summary>\r\n        /// <param name=\"defaultValue\">value</param>\r\n        /// <returns></returns>\r\n        public static DefaultValue Decimal(decimal defaultValue) { return new DefaultValue(defaultValue); }\r\n\r\n        /// <summary>\r\n        /// Bool default value\r\n        /// </summary>\r\n        /// <param name=\"defaultValue\">value</param>\r\n        /// <returns></returns>\r\n        public static DefaultValue Boolean(bool defaultValue) { return new DefaultValue(defaultValue); }\r\n\r\n        /// <summary>\r\n        /// DateTime default value\r\n        /// </summary>\r\n        /// <param name=\"defaultValue\">value</param>\r\n        /// <returns></returns>\r\n        public static DefaultValue DateTime(DateTime defaultValue) { return new DefaultValue(defaultValue); }\r\n\r\n        /// <summary>\r\n        /// Guid default value\r\n        /// </summary>\r\n        /// <param name=\"defaultValue\">value</param>\r\n        /// <returns></returns>\r\n        public static DefaultValue Guid(Guid defaultValue) { return new DefaultValue(defaultValue); }\r\n\r\n        /// <summary>\r\n        /// 'Now' as a default value (time stamp)\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static DefaultValue Now { get { return new DefaultValue(DefaultValueType.DateTimeNow); } }\r\n\r\n        /// <summary>\r\n        /// New Guid as default value. Generate a new unique Guid.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static DefaultValue NewGuid { get { return new DefaultValue(DefaultValueType.NewGuid); } }\r\n\r\n\r\n        /// <summary>\r\n        /// A new value is a new random string\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static DefaultValue RandomString(int length, bool checkCollisions)\r\n        {\r\n            return new DefaultValue(new RandomStringSettings(length, checkCollisions)); \r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The default value.\r\n        /// </summary>\r\n        public object Value\r\n        {\r\n            get\r\n            {\r\n                switch (_valueType)\r\n                {\r\n                    case DefaultValueType.DateTimeNow:\r\n                        return System.DateTime.Now;\r\n\r\n                    case DefaultValueType.NewGuid:\r\n                        return System.Guid.NewGuid();\r\n\r\n                    case DefaultValueType.RandomString:\r\n                        return null; // A new value is generated and set in an \"OnBeforeAdd\" event handler.\r\n\r\n                    default:\r\n                        return _value;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Type of the default value\r\n        /// </summary>\r\n        public DefaultValueType ValueType { get { return _valueType; } }\r\n\r\n\r\n        /// <exclude />\r\n        public DefaultValue Clone()\r\n        {\r\n            switch (_valueType)\r\n            {\r\n                case DefaultValueType.Boolean:\r\n                    return DefaultValue.Boolean((bool)_value);\r\n\r\n                case DefaultValueType.DateTime:\r\n                    return DefaultValue.DateTime((DateTime)_value);\r\n\r\n                case DefaultValueType.DateTimeNow:\r\n                    return DefaultValue.Now;\r\n\r\n                case DefaultValueType.Decimal:\r\n                    return DefaultValue.Decimal((decimal)_value);\r\n\r\n                case DefaultValueType.Guid:\r\n                    return DefaultValue.Guid((Guid)_value);\r\n\r\n                case DefaultValueType.Integer:\r\n                    return DefaultValue.Integer((int)_value);\r\n\r\n                case DefaultValueType.NewGuid:\r\n                    return DefaultValue.NewGuid;\r\n\r\n                case DefaultValueType.String:\r\n                    return DefaultValue.String((string)_value);\r\n\r\n                case DefaultValueType.RandomString:\r\n                    return new DefaultValue(_randomStringSettings);\r\n\r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            var sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"ValueType\", this.ValueType.ToString());\r\n            \r\n            if (!IsDynamicValue && this.Value != null)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"Value\", SerializeDefaultValue(ValueType, this.Value));\r\n            }\r\n\r\n            if (_randomStringSettings != null)\r\n            {\r\n                _randomStringSettings.Serialize(sb);\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n        private static string SerializeDefaultValue(DefaultValueType type, object value)\r\n        {\r\n            Verify.ArgumentNotNull(value, \"value\");\r\n\r\n            switch (type)\r\n                {\r\n                    case DefaultValueType.Boolean:\r\n                        return ((bool)value).ToString(CultureInfo.InvariantCulture);\r\n\r\n                    case DefaultValueType.DateTime:\r\n                        return ((DateTime)value).ToString(CultureInfo.InvariantCulture);\r\n\r\n                    case DefaultValueType.Decimal:\r\n                        return ((Decimal)value).ToString(CultureInfo.InvariantCulture);\r\n\r\n                    case DefaultValueType.Guid:\r\n                        return value.ToString();\r\n\r\n                    case DefaultValueType.Integer:\r\n                        return ((Int32)value).ToString(CultureInfo.InvariantCulture);\r\n\r\n                    case DefaultValueType.String:\r\n                        return (string)value;\r\n\r\n                    case DefaultValueType.RandomString:\r\n                    case DefaultValueType.NewGuid:\r\n                    case DefaultValueType.DateTimeNow:\r\n                        return string.Empty;\r\n\r\n                    default:\r\n                        throw new NotImplementedException(\"DefaultValueType = \" + type);\r\n                }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static DefaultValue Deserialize(string serializedData)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(serializedData, \"serializedData\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n                Verify.That(dic.ContainsKey(\"ValueType\"), \"Wrong serialized format\");\r\n\r\n                string valueTypeString = StringConversionServices.DeserializeValue<string>(dic[\"ValueType\"]);\r\n                var valueType = (DefaultValueType)Enum.Parse(typeof(DefaultValueType), valueTypeString);\r\n\r\n                bool hasValue = dic.ContainsKey(\"Value\");\r\n\r\n                switch (valueType)\r\n                {\r\n                    case DefaultValueType.Boolean:\r\n                        Verify.That(hasValue, \"Wrong serialized format\");\r\n                        bool boolValue = StringConversionServices.DeserializeValueBool(dic[\"Value\"]);\r\n                        return DefaultValue.Boolean(boolValue);\r\n\r\n                    case DefaultValueType.DateTime:\r\n                        Verify.That(hasValue, \"Wrong serialized format\");\r\n                        DateTime dateTimeValue = StringConversionServices.DeserializeValueDateTime(dic[\"Value\"]);\r\n                        return DefaultValue.DateTime(dateTimeValue);\r\n\r\n                    case DefaultValueType.DateTimeNow:\r\n                        return DefaultValue.Now;\r\n\r\n                    case DefaultValueType.Decimal:\r\n                        Verify.That(hasValue, \"Wrong serialized format\");\r\n                        decimal decimalValue = StringConversionServices.DeserializeValueDecimal(dic[\"Value\"]);\r\n                        return DefaultValue.Decimal(decimalValue);\r\n\r\n                    case DefaultValueType.Guid:\r\n                        Verify.That(hasValue, \"Wrong serialized format\");\r\n                        Guid guidValue = StringConversionServices.DeserializeValueGuid(dic[\"Value\"]);\r\n                        return DefaultValue.Guid(guidValue);\r\n\r\n                    case DefaultValueType.Integer:\r\n                        Verify.That(hasValue, \"Wrong serialized format\");\r\n                        int intValue = StringConversionServices.DeserializeValueInt(dic[\"Value\"]);\r\n                        return DefaultValue.Integer(intValue);\r\n\r\n                    case DefaultValueType.NewGuid:\r\n                        return DefaultValue.NewGuid;\r\n\r\n                    case DefaultValueType.String:\r\n                        string stringValue = null;\r\n                        if (hasValue)\r\n                        {\r\n                            stringValue = StringConversionServices.DeserializeValueString(dic[\"Value\"]);\r\n                        }\r\n                        return DefaultValue.String(stringValue);\r\n\r\n                    case DefaultValueType.RandomString:\r\n                        var settings = RandomStringSettings.Deserialize(dic);\r\n\r\n                        return new DefaultValue(settings);\r\n\r\n                    default:\r\n                        throw new NotImplementedException(\"DefaultValueType = \" + valueType);\r\n                }\r\n            }                    \r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return Serialize();\r\n        }\r\n\r\n\r\n\r\n        internal CodeAttributeDeclaration GetCodeAttributeDeclaration()\r\n        {\r\n            CodeAttributeDeclaration codeAttributeDeclaration;\r\n\r\n            switch (this.ValueType)\r\n            {\r\n                case DefaultValueType.DateTimeNow:\r\n                    codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DefaultFieldNowDateTimeValueAttribute)));\r\n                    break;\r\n\r\n                case DefaultValueType.Guid:\r\n                    codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DefaultFieldGuidValueAttribute)),\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(this.Value.ToString())));\r\n                    break;\r\n\r\n                case DefaultValueType.Integer :\r\n                    codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DefaultFieldIntValueAttribute)),\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(this.Value)));\r\n                    break;\r\n\r\n                case DefaultValueType.Decimal:\r\n                    codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DefaultFieldDecimalValueAttribute)),\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(decimal.ToInt32((decimal)this.Value))));\r\n                    break;\r\n\r\n                case DefaultValueType.NewGuid:\r\n                    codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DefaultFieldNewGuidValueAttribute)));\r\n                    break;\r\n\r\n                case DefaultValueType.String:\r\n                    codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DefaultFieldStringValueAttribute)),\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(this.Value)));\r\n                    break;\r\n\r\n                case DefaultValueType.RandomString:\r\n                    codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DefaultFieldRandomStringValueAttribute)),\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(_randomStringSettings.Length)),\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(_randomStringSettings.CheckCollisions)));\r\n                    break;\r\n\r\n                case DefaultValueType.Boolean:\r\n                    codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DefaultFieldBoolValueAttribute)),\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(this.Value)));\r\n                    break;\r\n\r\n                    \r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n\r\n            return codeAttributeDeclaration;\r\n        }\r\n\r\n        internal bool IsAssignableTo(StoreFieldType storeType)\r\n        {\r\n            switch (this.ValueType)\r\n            {\r\n                case DefaultValueType.DateTime:\r\n                case DefaultValueType.DateTimeNow:\r\n                    return storeType.IsDateTime || storeType.IsString;\r\n                case DefaultValueType.String:\r\n                    if (!storeType.IsString) return false;\r\n                    return this.Value == null || storeType.MaximumLength >= this.Value.ToString().Length;\r\n                case DefaultValueType.RandomString:\r\n                    return storeType.IsString && storeType.MaximumLength >= _randomStringSettings.Length;\r\n                case DefaultValueType.Integer:\r\n                    return storeType.IsNumeric || storeType.IsString;\r\n                case DefaultValueType.Decimal:\r\n                    return storeType.IsDecimal;\r\n                case DefaultValueType.Boolean:\r\n                    return storeType.IsBoolean || storeType.IsString;\r\n                case DefaultValueType.Guid:\r\n                case DefaultValueType.NewGuid:\r\n                    return storeType.IsGuid || storeType.IsString;\r\n            }\r\n\r\n            throw new ArgumentException(\"Unknown store type\");\r\n        }\r\n\r\n        private DefaultValue(RandomStringSettings randomStringSettings)\r\n        {\r\n            _valueType = DefaultValueType.RandomString;\r\n            _randomStringSettings = randomStringSettings;\r\n        }\r\n\r\n\r\n        private DefaultValue(string defaultValue)\r\n        {\r\n            _valueType = DefaultValueType.String;\r\n            _value = defaultValue;\r\n        }\r\n\r\n\r\n        private DefaultValue(int defaultValue)\r\n        {\r\n            _valueType = DefaultValueType.Integer;\r\n            _value = defaultValue;\r\n        }\r\n\r\n\r\n        private DefaultValue(decimal defaultValue)\r\n        {\r\n            _valueType = DefaultValueType.Decimal;\r\n            _value = defaultValue;\r\n        }\r\n\r\n\r\n        private DefaultValue(bool defaultValue)\r\n        {\r\n            _valueType = DefaultValueType.Boolean;\r\n            _value = defaultValue;\r\n        }\r\n\r\n\r\n        private DefaultValue(DateTime defaultValue)\r\n        {\r\n            _valueType = DefaultValueType.DateTime;\r\n            _value = defaultValue;\r\n        }\r\n\r\n\r\n        private DefaultValue(Guid defaultValue)\r\n        {\r\n            _valueType = DefaultValueType.Guid;\r\n            _value = defaultValue;\r\n        }\r\n\r\n\r\n        private DefaultValue(DefaultValueType defaultValueType)\r\n        {\r\n            switch (defaultValueType)\r\n            {\r\n                case DefaultValueType.DateTimeNow:\r\n                case DefaultValueType.NewGuid:\r\n                    _valueType = defaultValueType;\r\n                    return;\r\n            }\r\n\r\n            throw new ArgumentException(\"Provided value type can not be constructed using this constructor. Use other constructor.\");\r\n        }\r\n\r\n        private bool IsDynamicValue\r\n        {\r\n            get\r\n            {\r\n                return ValueType == DefaultValueType.DateTimeNow \r\n                    || ValueType == DefaultValueType.NewGuid\r\n                    || ValueType == DefaultValueType.RandomString;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int CompareTo(object obj)\r\n        {\r\n            if (obj == null) throw new ArgumentNullException();\r\n            if (obj.GetType() != typeof(DefaultValue)) throw new ArithmeticException(string.Format(\"Expected object of type {0}\", typeof(DefaultValue)));\r\n\r\n            var compareTo = (DefaultValue)obj;\r\n\r\n            if (this.ValueType != compareTo.ValueType) return -1;\r\n\r\n            switch (_valueType)\r\n            {\r\n                case DefaultValueType.DateTimeNow:\r\n                case DefaultValueType.NewGuid:\r\n                    return 0;\r\n\r\n                case DefaultValueType.String:\r\n                    if (this.Value == null)\r\n                    {\r\n                        return compareTo.Value == null ? 0 : -1;\r\n                    }\r\n\r\n                    return string.Compare(this.Value.ToString(), compareTo.Value.ToString(), StringComparison.Ordinal);\r\n\r\n                case DefaultValueType.Integer:\r\n                    return ((int)this.Value).CompareTo((int)compareTo.Value);\r\n\r\n                case DefaultValueType.Decimal:\r\n                    return ((Decimal)this.Value).CompareTo((Decimal)compareTo.Value);\r\n\r\n                case DefaultValueType.Boolean:\r\n                    return ((bool)this.Value).CompareTo((bool)compareTo.Value);\r\n\r\n                case DefaultValueType.DateTime:\r\n                    return ((DateTime)this.Value).CompareTo((DateTime)compareTo.Value);\r\n\r\n                case DefaultValueType.Guid:\r\n                    return string.Compare(this.Value.ToString(), compareTo.Value.ToString(), StringComparison.OrdinalIgnoreCase);\r\n\r\n                case DefaultValueType.RandomString:\r\n                    return string.Compare(_randomStringSettings.ToString(), compareTo._randomStringSettings.ToString(), StringComparison.OrdinalIgnoreCase);\r\n\r\n                default:\r\n                    throw new NotImplementedException(\"Unable to compare DefaultValue objects - unknown case of DefaultValueType\");\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return obj is DefaultValue && CompareTo(obj) == 0;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return ToString().GetHashCode();\r\n        }\r\n\r\n\r\n        [Serializable]\r\n        private class RandomStringSettings\r\n        {\r\n            public RandomStringSettings(int length, bool checkCollisions)\r\n            {\r\n                Length = length;\r\n                CheckCollisions = checkCollisions;\r\n            }\r\n\r\n            public void Serialize(StringBuilder sb)\r\n            {\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"Length\", Length);\r\n                StringConversionServices.SerializeKeyValuePair(sb, \"CheckCollisions\", CheckCollisions);\r\n            }\r\n\r\n            public static RandomStringSettings Deserialize(Dictionary<string, string> values)\r\n            {\r\n                return new RandomStringSettings(\r\n                    StringConversionServices.DeserializeValueInt(values[\"Length\"]),\r\n                    StringConversionServices.DeserializeValueBool(values[\"CheckCollisions\"]));\r\n            }\r\n\r\n\r\n\r\n            public int Length { get; private set; }\r\n            public bool CheckCollisions { get; private set; }\r\n\r\n            public override string ToString()\r\n            {\r\n                return string.Format(\"{0},{1}\", Length, CheckCollisions);\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum DefaultValueType\r\n    {\r\n        /// <exclude />\r\n        DateTimeNow = 0,\r\n\r\n        /// <exclude />\r\n        String = 1,\r\n\r\n        /// <exclude />\r\n        Integer = 2,\r\n\r\n        /// <exclude />\r\n        Decimal = 3,\r\n\r\n        /// <exclude />\r\n        Boolean = 4,\r\n\r\n        /// <exclude />\r\n        DateTime = 5,\r\n\r\n        /// <exclude />\r\n        Guid = 6,\r\n\r\n        /// <exclude />\r\n        NewGuid = 7,\r\n\r\n        /// <exclude />\r\n        RandomString = 8,\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DynamicTypeManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>\r\n    /// This class is used for handling DataTypeDescriptors for all C1 data types. \r\n    /// Building new from reflection and getting already stored.\r\n    /// \r\n    /// This class is also used for handling stores for a given data type. \r\n    /// Including creating/altering/dropping and locales. So through this class\r\n    /// you can create/alter/drop stores in a specific data provider for a given\r\n    /// data type.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public static class DynamicTypeManager\r\n    {\r\n        private static IDynamicTypeManager _dynamicTypeManager = new DynamicTypeManagerImpl();\r\n\r\n        /// <exclude />\r\n        public static IDynamicTypeManager Implementation { get { return _dynamicTypeManager; } set { _dynamicTypeManager = value; } }\r\n\r\n\r\n        internal delegate void DataStoreEventHandler(DataTypeDescriptor dataTypeDescriptor);\r\n        internal delegate void DataStoreChangedEventHandler(UpdateDataTypeDescriptor updateDataTypeDescriptor);\r\n        internal delegate void LocalizationEventHandler(CultureInfo culture);\r\n\r\n        /// <summary>\r\n        /// Raised after data stores are created for a data type.\r\n        /// </summary>\r\n        internal static event DataStoreEventHandler OnStoreCreated;\r\n\r\n        /// <summary>\r\n        /// Raised after a data type is removed from the system.\r\n        /// </summary>\r\n        internal static event DataStoreEventHandler OnStoreDropped;\r\n\r\n        /// <summary>\r\n        /// Raised after a data type is updated.\r\n        /// </summary>\r\n        internal static event DataStoreChangedEventHandler OnStoreUpdated;\r\n\r\n        /// <summary>\r\n        /// Raised after the data stores created for a new locale.\r\n        /// </summary>\r\n        internal static event LocalizationEventHandler OnLocaleAdded;\r\n        /// <summary>\r\n        /// Raised after the data stores related to a locale are removed.\r\n        /// </summary>\r\n        internal static event LocalizationEventHandler OnLocaleRemoved;\r\n\r\n\r\n        /// <exclude />\r\n        public static DataTypeDescriptor BuildNewDataTypeDescriptor(Type typeToDescript)\r\n        {\r\n            return _dynamicTypeManager.BuildNewDataTypeDescriptor(typeToDescript);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static DataTypeDescriptor GetDataTypeDescriptor(Type typeToDescript)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n\r\n            if (!TryGetDataTypeDescriptor(typeToDescript.GetImmutableTypeId(), out dataTypeDescriptor))\r\n            {\r\n                dataTypeDescriptor = BuildNewDataTypeDescriptor(typeToDescript);\r\n            }\r\n\r\n            return dataTypeDescriptor;\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static DataTypeDescriptor GetDataTypeDescriptor(Guid immutableTypeId)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n            TryGetDataTypeDescriptor(immutableTypeId, out dataTypeDescriptor);\r\n\r\n            return dataTypeDescriptor;\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static bool TryGetDataTypeDescriptor(Type interfaceType, out DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return _dynamicTypeManager.TryGetDataTypeDescriptor(interfaceType.GetImmutableTypeId(), out dataTypeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetDataTypeDescriptor(Guid immutableTypeId, out DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return _dynamicTypeManager.TryGetDataTypeDescriptor(immutableTypeId, out dataTypeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void UpdateDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            UpdateDataTypeDescriptor(dataTypeDescriptor, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void UpdateDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor, bool flushTheSystem)\r\n        {\r\n            _dynamicTypeManager.UpdateDataTypeDescriptor(dataTypeDescriptor, flushTheSystem);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void CreateStore(DataTypeDescriptor typeDescriptor)\r\n        {\r\n            CreateStore(DataProviderRegistry.DefaultDynamicTypeDataProviderName, typeDescriptor, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void CreateStore(DataTypeDescriptor typeDescriptor, bool doFlush)\r\n        {\r\n            CreateStore(DataProviderRegistry.DefaultDynamicTypeDataProviderName, typeDescriptor, doFlush);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void CreateStores(IReadOnlyCollection<DataTypeDescriptor> typeDescriptors, bool doFlush)\r\n        {\r\n            CreateStores(DataProviderRegistry.DefaultDynamicTypeDataProviderName, typeDescriptors, doFlush);\r\n        }\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void CreateStore(string providerName, DataTypeDescriptor typeDescriptor)\r\n        {\r\n            CreateStore(providerName, typeDescriptor, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void CreateStore(string providerName, DataTypeDescriptor typeDescriptor, bool doFlush)\r\n        {\r\n            _dynamicTypeManager.CreateStores(providerName, new[] { typeDescriptor }, doFlush);\r\n\r\n            OnStoreCreated?.Invoke(typeDescriptor);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void CreateStores(string providerName, IReadOnlyCollection<DataTypeDescriptor> typeDescriptors, bool doFlush)\r\n        {\r\n            _dynamicTypeManager.CreateStores(providerName, typeDescriptors, doFlush);\r\n\r\n            typeDescriptors.ForEach(td => OnStoreCreated?.Invoke(td));\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor)\r\n        {\r\n            AlterStore(updateDataTypeDescriptor, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, bool forceRecompile)\r\n        {\r\n            _dynamicTypeManager.AlterStore(updateDataTypeDescriptor, forceRecompile);\r\n\r\n            OnStoreUpdated?.Invoke(updateDataTypeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void DropStore(DataTypeDescriptor typeDescriptor)\r\n        {\r\n            DropStore(null, typeDescriptor, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void DropStore(string providerName, DataTypeDescriptor typeDescriptor)\r\n        {\r\n            DropStore(providerName, typeDescriptor, true);\r\n        }\r\n\r\n\r\n\r\n        internal static void DropStore(string providerName, DataTypeDescriptor typeDescriptor, bool makeAFlush)\r\n        {\r\n            if (providerName == null)\r\n            {\r\n                providerName = DataProviderRegistry.DefaultDynamicTypeDataProviderName;\r\n            }\r\n\r\n            _dynamicTypeManager.DropStore(providerName, typeDescriptor, makeAFlush);\r\n\r\n            var interfaceType = typeDescriptor.GetInterfaceType();\r\n            if (interfaceType != null)\r\n            {\r\n                DataProviderRegistry.UnregisterDataType(interfaceType, providerName);\r\n            }\r\n\r\n            OnStoreDropped?.Invoke(typeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void AddLocale(CultureInfo cultureInfo)\r\n        {\r\n            AddLocale(DataProviderRegistry.DefaultDynamicTypeDataProviderName, cultureInfo);\r\n        }\r\n       \r\n\r\n\r\n        /// <exclude />\r\n        public static void AddLocale(string providerName, CultureInfo cultureInfo)\r\n        {\r\n            _dynamicTypeManager.AddLocale(providerName, cultureInfo);\r\n\r\n            OnLocaleAdded?.Invoke(cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void RemoveLocale(CultureInfo cultureInfo)\r\n        {\r\n            RemoveLocale(DataProviderRegistry.DefaultDynamicTypeDataProviderName, cultureInfo);\r\n        }\r\n       \r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveLocale(string providerName, CultureInfo cultureInfo)\r\n        {\r\n            _dynamicTypeManager.RemoveLocale(providerName, cultureInfo);\r\n\r\n            OnLocaleRemoved?.Invoke(cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// For internal use only!!!\r\n        /// This method will create the store if the interfaceType has not been configured.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        public static void EnsureCreateStore(Type interfaceType)\r\n        {\r\n            EnsureCreateStore(interfaceType, null);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// For internal use only!!!\r\n        /// This method will create the store if the interfaceType has not been configured.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"providerName\"></param>\r\n        // Helper\r\n        public static void EnsureCreateStore(Type interfaceType, string providerName)\r\n        {\r\n            IEnumerable<string> dynamicProviderNames;\r\n\r\n            if (providerName == null)\r\n            {\r\n                // Checking if any of existing dynamic data providers already has a store for the specified interface type\r\n                providerName = DataProviderRegistry.DefaultDynamicTypeDataProviderName;\r\n                dynamicProviderNames = DataProviderRegistry.DynamicDataProviderNames;\r\n            }\r\n            else\r\n            {\r\n                dynamicProviderNames = new[] {providerName};\r\n            }\r\n\r\n            var possibleMatches = dynamicProviderNames\r\n                .Select(DataProviderPluginFacade.GetDataProvider)\r\n                .Cast<IDynamicDataProvider>()\r\n                .SelectMany(dynamicDataProvider => dynamicDataProvider.GetKnownInterfaces())\r\n                .Where(i => i.FullName == interfaceType.FullName);\r\n\r\n            foreach(var match in possibleMatches)\r\n            {\r\n                if(match == interfaceType) return;\r\n\r\n                if (match.GetImmutableTypeId() == interfaceType.GetImmutableTypeId())\r\n                {\r\n                    throw new InvalidOperationException($\"The same type '{match.FullName}' is loaded in memory twice. Location 1: '{match.Assembly.Location}', location 2: {interfaceType.Assembly.Location}\");\r\n                }\r\n            }\r\n\r\n            var dataTypeDescriptor = BuildNewDataTypeDescriptor(interfaceType);\r\n\r\n            CreateStore(providerName, dataTypeDescriptor, true);\r\n\r\n            if (!SystemSetupFacade.SetupIsRunning)\r\n            {\r\n                CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);\r\n            }\r\n        }\r\n        \r\n\r\n\r\n        // Helper\r\n        internal static bool IsEnsureUpdateStoreNeeded(Type interfaceType)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                DataTypeDescriptor newDataTypeDescriptor;\r\n                if (!TryGetDataTypeDescriptor(interfaceType, out newDataTypeDescriptor))\r\n                {\r\n                    newDataTypeDescriptor = BuildNewDataTypeDescriptor(interfaceType);\r\n                }\r\n\r\n                var oldDataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(newDataTypeDescriptor.DataTypeId);\r\n\r\n                if (oldDataTypeDescriptor == null)\r\n                {\r\n                    DataMetaDataFacade.PersistMetaData(newDataTypeDescriptor);\r\n\r\n                    return false;\r\n                }\r\n\r\n                var dataTypeChangeDescriptor = new DataTypeChangeDescriptor(oldDataTypeDescriptor, newDataTypeDescriptor);\r\n\r\n                if (!dataTypeChangeDescriptor.AlteredTypeHasChanges)\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                return dataTypeChangeDescriptor.AlteredTypeHasChanges;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        // Helper\r\n        internal static bool EnsureUpdateStore(Type interfaceType, string providerName, bool makeAFlush)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler(interfaceType.ToString()))\r\n            {\r\n                var newDataTypeDescriptor = BuildNewDataTypeDescriptor(interfaceType);\r\n\r\n                var oldDataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(newDataTypeDescriptor.DataTypeId);\r\n\r\n                if (interfaceType.IsGenerated())\r\n                {\r\n                    var customFields = oldDataTypeDescriptor.Fields.Where(f => !f.Inherited &&\r\n                                                                               !oldDataTypeDescriptor.KeyPropertyNames\r\n                                                                                   .Contains(f.Name));\r\n                    foreach (var field in customFields)\r\n                    {\r\n                        var fieldDescriptor = newDataTypeDescriptor.Fields[field.Name];\r\n\r\n                        if (fieldDescriptor != null)\r\n                        {\r\n                            newDataTypeDescriptor.Fields.Remove(fieldDescriptor);\r\n                        }\r\n                        else\r\n                        {\r\n                            Log.LogWarning(nameof(DynamicTypeManager), $\"Property '{field.Name}' was missing in the generated interface type '{interfaceType.FullName}'\");\r\n                        }\r\n\r\n                        newDataTypeDescriptor.Fields.Add(field);\r\n                    }\r\n                }\r\n\r\n                if (oldDataTypeDescriptor == null)\r\n                {\r\n                    DataMetaDataFacade.PersistMetaData(newDataTypeDescriptor);\r\n                    return false;\r\n                }\r\n\r\n                var dataTypeChangeDescriptor = new DataTypeChangeDescriptor(oldDataTypeDescriptor, newDataTypeDescriptor);\r\n\r\n                if (!dataTypeChangeDescriptor.AlteredTypeHasChanges)\r\n                {\r\n                    if (dataTypeChangeDescriptor.TypeHasMetaDataChanges)\r\n                    {\r\n                        Log.LogInformation(nameof(DynamicTypeManager), $\"Updating data type descriptor for type '{newDataTypeDescriptor.GetFullInterfaceName()}'\");\r\n                        DataMetaDataFacade.PersistMetaData(newDataTypeDescriptor);\r\n                    }\r\n\r\n                    return false;\r\n                }\r\n\r\n                Log.LogVerbose(nameof(DynamicTypeManager),\r\n                    \"Updating the store for interface type '{0}' on the '{1}' data provider\", interfaceType,\r\n                    providerName);\r\n\r\n                var updateDataTypeDescriptor = new UpdateDataTypeDescriptor(oldDataTypeDescriptor, newDataTypeDescriptor,\r\n                    providerName);\r\n\r\n                AlterStore(updateDataTypeDescriptor, makeAFlush);\r\n\r\n                return true;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DynamicTypeManagerImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DynamicTypeManagerImpl : IDynamicTypeManager\r\n    {\r\n        /// <exclude />\r\n        public DataTypeDescriptor BuildNewDataTypeDescriptor(Type typeToDescript)\r\n        {\r\n            if (typeToDescript == null) throw new ArgumentNullException(\"typeToDescript\");\r\n\r\n            return ReflectionBasedDescriptorBuilder.Build(typeToDescript);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool TryGetDataTypeDescriptor(Guid immutableTypeId, out DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(immutableTypeId);\r\n\r\n            return dataTypeDescriptor != null;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor, bool flushTheSystem)\r\n        {\r\n            dataTypeDescriptor.Validate();\r\n\r\n            DataMetaDataFacade.PersistMetaData(dataTypeDescriptor);\r\n\r\n            if (flushTheSystem)\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void CreateStores(string providerName, IReadOnlyCollection<DataTypeDescriptor> typeDescriptors, bool doFlush)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentNotNull(typeDescriptors, \"typeDescriptors\");\r\n\r\n            typeDescriptors.ForEach(d => d.Validate());\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                foreach (var typeDescriptor in typeDescriptors)\r\n                {\r\n                    DataMetaDataFacade.PersistMetaData(typeDescriptor);\r\n                }\r\n\r\n                DataProviderPluginFacade.CreateStores(providerName, typeDescriptors);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            if (doFlush)\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, bool forceCompile)\r\n        {\r\n            DataTypeChangeDescriptor dataTypeChangeDescriptor = updateDataTypeDescriptor.CreateDataTypeChangeDescriptor(); \r\n\r\n            dataTypeChangeDescriptor.AlteredType.Validate();\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataMetaDataFacade.PersistMetaData(dataTypeChangeDescriptor.AlteredType);\r\n\r\n                if (dataTypeChangeDescriptor.AlteredTypeHasChanges)\r\n                {\r\n                    DataProviderPluginFacade.AlterStore(updateDataTypeDescriptor, forceCompile);\r\n                }                \r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void DropStore(string providerName, DataTypeDescriptor typeDescriptor, bool makeAFlush)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentNotNull(typeDescriptor, \"typeDescriptor\");\r\n\r\n            typeDescriptor.Validate();\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataProviderPluginFacade.DropStore(providerName, typeDescriptor);\r\n                DataMetaDataFacade.DeleteMetaData(typeDescriptor.DataTypeId);\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            if (makeAFlush)\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddLocale(string providerName, CultureInfo cultureInfo)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNull(cultureInfo, nameof(cultureInfo));\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataProviderPluginFacade.AddLocale(providerName, cultureInfo);\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            if (!SystemSetupFacade.SetupIsRunning)\r\n            {\r\n                CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void RemoveLocale(string providerName, CultureInfo cultureInfo)\r\n        {\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n            if (cultureInfo == null) throw new ArgumentNullException(\"cultureInfo\");\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataProviderPluginFacade.RemoveLocale(providerName, cultureInfo);\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/DynamicTypeMarkupServices.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class DynamicTypeMarkupServices\r\n\t{\r\n        private static readonly XName _fieldReferenceElementName = Namespaces.DynamicData10 + \"fieldreference\";\r\n        private static readonly XName _fieldReferenceTypeAttributeName = \"typemanagername\";\r\n        private static readonly XName _fieldReferenceFieldAttributeName = \"fieldname\";\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement GetReferenceElement(this DataFieldDescriptor fieldToReference, DataTypeDescriptor ownerTypeDescriptor)\r\n        {\r\n            return GetReferenceElement(fieldToReference.Name,ownerTypeDescriptor.TypeManagerTypeName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement GetReferenceElement(string fieldName, string typeManagerName)\r\n        {\r\n            // ensure \"data:\" prefix in markup:\r\n            XElement element = XElement.Parse(string.Format(\"<data:{0} xmlns:data='{1}' />\", _fieldReferenceElementName.LocalName, _fieldReferenceElementName.NamespaceName));\r\n\r\n            element.Add(\r\n                new XAttribute(_fieldReferenceFieldAttributeName, fieldName),\r\n                new XAttribute(_fieldReferenceTypeAttributeName, typeManagerName));\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetDescriptors(XElement fieldReferenceElement, out DataTypeDescriptor typeDescriptor, out DataFieldDescriptor fieldDescriptor)\r\n        {\r\n            typeDescriptor = null;\r\n            fieldDescriptor = null;\r\n\r\n            if (fieldReferenceElement.Name != _fieldReferenceElementName)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Unexpected element name '{0}'. Expected '{1}'\",\r\n                                                                  fieldReferenceElement.Name, _fieldReferenceElementName));\r\n            }\r\n\r\n            string typeManagerName = fieldReferenceElement.Attribute(_fieldReferenceTypeAttributeName).Value;\r\n            string fieldName = fieldReferenceElement.Attribute(_fieldReferenceFieldAttributeName).Value;\r\n\r\n            Type t = TypeManager.TryGetType(typeManagerName);\r\n            if (t == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(t.GetImmutableTypeId());\r\n            if (typeDescriptor == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if(fieldName == \"DataSourceId\")\r\n            {\r\n                fieldDescriptor = new DataFieldDescriptor(Guid.Empty, \"DataSourceId\", StoreFieldType.LargeString, typeof (string));\r\n                return true;\r\n            }\r\n\r\n            fieldDescriptor = typeDescriptor.Fields.Where(f => f.Name == fieldName).FirstOrDefault();\r\n            if (fieldDescriptor == null)\r\n            {\r\n                return false;\r\n            }\r\n            \r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n\t    public static IEnumerable<FieldReferenceDefinition> GetFieldReferenceDefinitions(XContainer container, string typeManagerName)\r\n        {\r\n            Type type = null;\r\n\r\n            foreach (XElement referenceElement in container.Descendants(_fieldReferenceElementName))\r\n            {\r\n                string referencedTypeName = referenceElement.Attribute(_fieldReferenceTypeAttributeName).Value;\r\n\r\n                if(referencedTypeName != typeManagerName)\r\n                {\r\n                    type = type ?? TypeManager.TryGetType(typeManagerName);\r\n                    if(type == null) continue;\r\n\r\n                    Type referencedType = TypeManager.TryGetType(referencedTypeName);\r\n                    if(referencedType == null || !referencedType.Equals(type))\r\n                    {\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                string fieldName = referenceElement.Attribute(_fieldReferenceFieldAttributeName).Value;\r\n\r\n                yield return new FieldReferenceDefinition { FieldName = fieldName, FieldReferenceElement = referenceElement };\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public class FieldReferenceDefinition\r\n        {\r\n            /// <exclude />\r\n            public string FieldName { get; set; }\r\n\r\n            /// <exclude />\r\n            public XElement FieldReferenceElement { get; set; }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/Foundation/DynamicTypeReflectionFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes.Foundation\r\n{\r\n    internal static class DynamicTypeReflectionFacade\r\n    {\r\n        public static Guid GetImmutableTypeId(Type type)\r\n        {\r\n            List<ImmutableTypeIdAttribute> immutableTypeIdAttributes = type.GetCustomInterfaceAttributes<ImmutableTypeIdAttribute>().ToList();\r\n\r\n            if (immutableTypeIdAttributes.Count == 0) throw new InvalidOperationException(string.Format(\"{0} is missing the {1} definition.\", type, typeof(ImmutableTypeIdAttribute)));\r\n\r\n            Guid immutableTypeId = immutableTypeIdAttributes[0].ImmutableTypeId;\r\n\r\n            if (immutableTypeId.Equals(Guid.Empty)) throw new InvalidOperationException(string.Format(\"{0} has an invalid {1} definition. A unique Guid is expected.\", type, typeof(ImmutableTypeIdAttribute).Name));\r\n\r\n            return immutableTypeId;\r\n        }      \r\n\r\n\r\n\r\n        public static Guid GetImmutableFieldId(PropertyInfo propertyInfo)\r\n        {\r\n            object[] immutableFieldIdAttributes = propertyInfo.GetCustomAttributes(typeof(ImmutableFieldIdAttribute), true);\r\n\r\n            if (immutableFieldIdAttributes.Length == 0) throw new InvalidOperationException(string.Format(\"The {0} property of type {1} is missing its {2} definition.\", propertyInfo.Name, propertyInfo.DeclaringType.FullName, typeof(ImmutableFieldIdAttribute)));\r\n\r\n            Guid immutableFieldId = ((ImmutableFieldIdAttribute)immutableFieldIdAttributes[0]).ImmutableFieldId;\r\n\r\n            if (immutableFieldId.Equals(Guid.Empty)) throw new InvalidOperationException(string.Format(\"{0} has an invalid {1} definition. A unique Guid is expected.\", propertyInfo.DeclaringType, typeof(ImmutableFieldIdAttribute).Name));\r\n\r\n            return immutableFieldId;\r\n        }\r\n\r\n\r\n\r\n        public static StoreFieldType GetStoreFieldType(PropertyInfo fieldInfo)\r\n        {\r\n            var storeFieldTypeAttribute = GetCustomAttribute<StoreFieldTypeAttribute>(fieldInfo);\r\n\r\n            Verify.IsNotNull(storeFieldTypeAttribute, \"Missing [{0}] on field '{1}.{2}'\", typeof(StoreFieldTypeAttribute), fieldInfo.DeclaringType.FullName, fieldInfo.Name);\r\n\r\n            return storeFieldTypeAttribute.StoreFieldType;\r\n        }\r\n\r\n\r\n\r\n        public static bool TryGetFieldPosition(PropertyInfo fieldInfo, out int position)\r\n        {\r\n            var fieldPositionAttribute = GetCustomAttribute<FieldPositionAttribute>(fieldInfo);\r\n\r\n            if (fieldPositionAttribute == null)\r\n            {\r\n                position = 0;\r\n                return false;\r\n            }\r\n            \r\n            position = fieldPositionAttribute.Position;\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public static int GetGroupByPriority(PropertyInfo fieldInfo)\r\n        {\r\n            var groupByPriorityAttribute = GetCustomAttribute<GroupByPriorityAttribute>(fieldInfo);\r\n\r\n            return groupByPriorityAttribute != null ? groupByPriorityAttribute.Priority : 0;\r\n        }\r\n\r\n\r\n        public static DataFieldTreeOrderingProfile GetTreeOrderingProfile(PropertyInfo fieldInfo)\r\n        {\r\n            var attribute = GetCustomAttribute<TreeOrderingAttribute>(fieldInfo);\r\n\r\n            if (attribute == null)\r\n            {\r\n                return new DataFieldTreeOrderingProfile { OrderPriority = null };\r\n            }\r\n\r\n            return new DataFieldTreeOrderingProfile { OrderPriority = attribute.Priority, OrderDescending = attribute.Descending };\r\n        }\r\n\r\n        public static DataFieldFormRenderingProfile GetFormRenderingProfile(PropertyInfo propertyInfo)\r\n        {\r\n            var attr = GetCustomAttribute<FormRenderingProfileAttribute>(propertyInfo);\r\n\r\n            return attr != null ? new DataFieldFormRenderingProfile\r\n                {\r\n                    Label = attr.Label, \r\n                    HelpText = attr.HelpText, \r\n                    WidgetFunctionMarkup = attr.WidgetFunctionMarkup\r\n                } : null;\r\n        }\r\n\r\n        private static T GetCustomAttribute<T>(PropertyInfo propertyInfo) where T: Attribute\r\n        {\r\n            object[] attributes = propertyInfo.GetCustomAttributes(typeof(T), true);\r\n\r\n            Verify.That(attributes.Length < 2, \"Multiple [{0}] attributes defined on field {1}.{2}\", typeof(T).Name, propertyInfo.DeclaringType.FullName, propertyInfo.Name);\r\n\r\n            return attributes.Length > 0 ? (T)attributes[0] : null;\r\n        }\r\n\r\n        public static string GetTitle(Type type)\r\n        {\r\n            List<TitleAttribute> titleAttributes = type.GetCustomInterfaceAttributes<TitleAttribute>().ToList();\r\n\r\n            if (titleAttributes.Count > 0)\r\n            {\r\n                return titleAttributes[0].Title;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        public static string GetLabelPropertyName(Type type)\r\n        {\r\n            List<LabelPropertyNameAttribute> labelPropertyNameAttributes = type.GetCustomInterfaceAttributes<LabelPropertyNameAttribute>().ToList();\r\n\r\n            if (labelPropertyNameAttributes.Count > 0)\r\n            {\r\n                return labelPropertyNameAttributes[0].PropertyName;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        public static string GetInternalUrlPrefix(Type type)\r\n        {\r\n            var internalUrlAttributes = type.GetCustomInterfaceAttributes<InternalUrlAttribute>().Evaluate();\r\n\r\n            return internalUrlAttributes.Count > 0 ? internalUrlAttributes.First().InternalUrlPrefix : null;\r\n        }\r\n        \r\n\r\n\r\n        public static IEnumerable<DataScopeIdentifier> GetDataScopes(Type interfaceType)\r\n        {\r\n            List<DataScopeAttribute> attributes = interfaceType.GetCustomInterfaceAttributes<DataScopeAttribute>().ToList();\r\n\r\n            var dataScopeIdentifiers = new List<DataScopeIdentifier>();\r\n            foreach (DataScopeAttribute attribute in attributes)\r\n            {\r\n                if (dataScopeIdentifiers.Contains(attribute.Identifier) == false)\r\n                {\r\n                    dataScopeIdentifiers.Add(attribute.Identifier);\r\n                }\r\n            }\r\n\r\n            return dataScopeIdentifiers;\r\n        }\r\n\r\n\r\n\r\n        public static DefaultValue GetDefaultValue(PropertyInfo propertyInfo)\r\n        {\r\n            List<DefaultFieldValueAttribute> defaultValueAttributes = propertyInfo.GetCustomAttributesRecursively<DefaultFieldValueAttribute>().ToList();\r\n\r\n            if (defaultValueAttributes.Count > 1) throw new InvalidOperationException(string.Format(\"The field '{0}' on the interface '{1}' may only have zero or one default value attribute\", propertyInfo.Name, propertyInfo.DeclaringType));\r\n\r\n            if (defaultValueAttributes.Count == 0) return null;\r\n\r\n            return defaultValueAttributes[0].GetDefaultValue();\r\n        }\r\n\r\n\r\n\r\n        public static string[] GetSortOrder(Type interfaceType)\r\n        {\r\n            List<StoreSortOrderAttribute> attributes = interfaceType.GetCustomInterfaceAttributes<StoreSortOrderAttribute>().ToList();\r\n\r\n            if (attributes.Count == 0) return null;\r\n\r\n            return attributes[0].SortOrder;\r\n        }\r\n\r\n\r\n\r\n        public static bool IsNullable(PropertyInfo fieldInfo)\r\n        {\r\n            object[] storeFieldTypeAttributes = fieldInfo.GetCustomAttributes(typeof(StoreFieldTypeAttribute), false);\r\n\r\n            if (storeFieldTypeAttributes.Length == 0) throw new InvalidOperationException(\"Missing PhysicalStoreFieldTypeAttribute on field \" + fieldInfo.Name);\r\n\r\n            var storeAttribute = (StoreFieldTypeAttribute)storeFieldTypeAttributes[0];\r\n            return storeAttribute.IsNullable;\r\n        }\r\n\r\n\r\n\r\n        public static bool IsKeyField(PropertyInfo fieldInfo)\r\n        {\r\n            List<KeyPropertyNameAttribute> typeKeys = fieldInfo.DeclaringType.GetCustomInterfaceAttributes<KeyPropertyNameAttribute>().ToList();\r\n\r\n            int thisPropertyMatchCount = typeKeys.Count(f => f.KeyPropertyName == fieldInfo.Name);\r\n\r\n            Verify.That(thisPropertyMatchCount < 2, \"{0} contains multiple {1} declarations with the property name '{2}'\", fieldInfo.MemberType, typeof(KeyPropertyNameAttribute), fieldInfo.Name);\r\n\r\n            return thisPropertyMatchCount == 1;\r\n        }\r\n\r\n\r\n\r\n        public static string ForeignKeyReferenceTypeName(PropertyInfo propertyInfo)\r\n        {\r\n            object[] attributes = propertyInfo.GetCustomAttributes(typeof(ForeignKeyAttribute), false);\r\n\r\n            if (attributes.Length == 0) return null;\r\n\r\n            return TypeManager.SerializeType(((ForeignKeyAttribute)attributes[0]).InterfaceType);\r\n        }\r\n\r\n\r\n\r\n        public static string NewInstanceDefaultFieldValue(PropertyInfo propertyInfo)\r\n        {\r\n            var attribute = GetCustomAttribute<FunctionBasedNewInstanceDefaultFieldValueAttribute>(propertyInfo);\r\n\r\n            return attribute != null ? attribute.FunctionDescription : null;\r\n        }\r\n\r\n\r\n        public static List<DataTypeAssociationDescriptor> GetDataTypeAssociationDescriptors(Type interfaceType)\r\n        {\r\n            var result = new List<DataTypeAssociationDescriptor>();\r\n\r\n            var attributes = interfaceType.GetCustomAttributes(typeof(DataAssociationAttribute), false).OfType<DataAssociationAttribute>().ToList();\r\n\r\n            foreach (DataAssociationAttribute attribute in attributes)\r\n            {\r\n                var dataTypeAssociationDescriptor = new DataTypeAssociationDescriptor(attribute.AssociatedInterfaceType, attribute.ForeignKeyPropertyName, attribute.AssociationType);\r\n                if (!result.Contains(dataTypeAssociationDescriptor))\r\n                {\r\n                    result.Add(dataTypeAssociationDescriptor);\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        public static List<DataTypeAssociationDescriptor> GetDataTypeAssociationDescriptorsRecursively(Type interfaceType)\r\n        {\r\n            var result = new List<DataTypeAssociationDescriptor>();\r\n\r\n            List<DataAssociationAttribute> attributes = interfaceType.GetCustomAttributesRecursively<DataAssociationAttribute>().ToList();\r\n\r\n            foreach (DataAssociationAttribute attribute in attributes)\r\n            {\r\n                var dataTypeAssociationDescriptor = new DataTypeAssociationDescriptor(attribute.AssociatedInterfaceType, attribute.ForeignKeyPropertyName, attribute.AssociationType);\r\n                if (!result.Contains(dataTypeAssociationDescriptor))\r\n                {\r\n                    result.Add(dataTypeAssociationDescriptor);\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// If no BuildNewHandlerAttribute is used on the data type interface\r\n        /// null is returned.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static Type GetBuildNewHandlerType(Type interfaceType)\r\n        {\r\n            var attributes = interfaceType.GetCustomAttributesRecursively<BuildNewHandlerAttribute>().Evaluate();\r\n\r\n            if (!attributes.Any()) return null;\r\n\r\n            if (attributes.Count() > 1) throw new InvalidOperationException(string.Format(\"Only one '{0}' allowed on the interface '{1}'\", typeof(BuildNewHandlerAttribute).FullName, interfaceType.FullName));\r\n\r\n            return attributes.Single().BuildNewHandlerType;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/Foundation/DynamicTypesAlternateFormFacade.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Obsolete(\"User DynamicTypesCustomFormFacade instead\")]\r\n    public static class DynamicTypesAlternateFormFacade\r\n    {\r\n        \r\n        /// <summary>\r\n        /// Returns null if no alternate form exists.\r\n        /// </summary>\r\n        /// <exclude />\r\n        public static string GetAlternateFormMarkup(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            var file = GetAlternateFormMarkupFile(dataTypeDescriptor.Namespace, dataTypeDescriptor.Name);\r\n\r\n            return file != null ? file.ReadAllText() : null;\r\n        }\r\n\r\n        internal static IFile GetAlternateFormMarkupFile(string @namespace, string typeName)\r\n        {\r\n            string dynamicDataFormFolderPath = GetFolderPath(@namespace);\r\n            string dynamicDataFormFileName = GetFilename(typeName);\r\n\r\n            IDynamicTypeFormDefinitionFile formOverride =\r\n                DataFacade.GetData<IDynamicTypeFormDefinitionFile>()\r\n                          .FirstOrDefault(f => f.FolderPath.Equals(dynamicDataFormFolderPath, StringComparison.OrdinalIgnoreCase)\r\n                                            && f.FileName.Equals(dynamicDataFormFileName, StringComparison.OrdinalIgnoreCase));\r\n\r\n            return formOverride;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetAlternateForm(DataTypeDescriptor dataTypeDescriptor, string newFormMarkup)\r\n        {\r\n            string dynamicDataFormFolderPath = GetFolderPath(dataTypeDescriptor.Namespace);\r\n            string dynamicDataFormFileName = GetFilename(dataTypeDescriptor.Name);\r\n\r\n            // Parsing for assertion\r\n            XDocument.Parse(newFormMarkup);\r\n\r\n            IDynamicTypeFormDefinitionFile formDefinitionFile =\r\n                DataFacade.GetData<IDynamicTypeFormDefinitionFile>()\r\n                  .FirstOrDefault(f => f.FolderPath.Equals(dynamicDataFormFolderPath, StringComparison.OrdinalIgnoreCase) \r\n                                    && f.FileName.Equals(dynamicDataFormFileName, StringComparison.OrdinalIgnoreCase));\r\n\r\n            if (formDefinitionFile == null)\r\n            {\r\n                var newFile = DataFacade.BuildNew<IDynamicTypeFormDefinitionFile>();\r\n                newFile.FolderPath = dynamicDataFormFolderPath;\r\n                newFile.FileName = dynamicDataFormFileName;\r\n                newFile.SetNewContent(newFormMarkup);\r\n                formDefinitionFile = DataFacade.AddNew<IDynamicTypeFormDefinitionFile>(newFile);\r\n            }\r\n            else\r\n            {\r\n                formDefinitionFile.SetNewContent(newFormMarkup);\r\n                DataFacade.Update(formDefinitionFile);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static string GetFilename(string typeName)\r\n        {\r\n            return string.Format(\"{0}.xml\", typeName);\r\n        }\r\n\r\n\r\n\r\n        private static string GetFolderPath(string @namespace)\r\n        {\r\n            return \"\\\\\" + @namespace.Replace('.', '\\\\');\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/Foundation/DynamicTypesCustomFormFacade.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Data.DataProviders.FileSystemDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class DynamicTypesCustomFormFacade\r\n    {\r\n        /// <summary>\r\n        /// Returns custom form markup. \r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\">A data type descriptor</param>\r\n        /// <returns></returns>\r\n        public static XDocument GetCustomFormMarkup(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            var file = GetCustomFormMarkupFile(dataTypeDescriptor.Namespace, dataTypeDescriptor.Name);\r\n\r\n            if (file == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var markupFilePath = (file as FileSystemFile).SystemPath;\r\n\r\n            return XDocumentUtils.Load(markupFilePath, LoadOptions.SetBaseUri | LoadOptions.SetLineInfo);\r\n        }\r\n\r\n        internal static IFile GetCustomFormMarkupFile(string @namespace, string typeName)\r\n        {\r\n            string dynamicDataFormFolderPath = GetFolderPath(@namespace);\r\n            string dynamicDataFormFileName = GetFilename(typeName);\r\n\r\n            IDynamicTypeFormDefinitionFile formOverride =\r\n                DataFacade.GetData<IDynamicTypeFormDefinitionFile>()\r\n                          .FirstOrDefault(f => f.FolderPath.Equals(dynamicDataFormFolderPath, StringComparison.OrdinalIgnoreCase)\r\n                                            && f.FileName.Equals(dynamicDataFormFileName, StringComparison.OrdinalIgnoreCase));\r\n\r\n            return formOverride;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetCustomForm(DataTypeDescriptor dataTypeDescriptor, string newFormMarkup)\r\n        {\r\n            string dynamicDataFormFolderPath = GetFolderPath(dataTypeDescriptor.Namespace);\r\n            string dynamicDataFormFileName = GetFilename(dataTypeDescriptor.Name);\r\n\r\n            // Parsing for assertion\r\n            XDocument.Parse(newFormMarkup);\r\n\r\n            IDynamicTypeFormDefinitionFile formDefinitionFile =\r\n                DataFacade.GetData<IDynamicTypeFormDefinitionFile>()\r\n                  .FirstOrDefault(f => f.FolderPath.Equals(dynamicDataFormFolderPath, StringComparison.OrdinalIgnoreCase) \r\n                                    && f.FileName.Equals(dynamicDataFormFileName, StringComparison.OrdinalIgnoreCase));\r\n\r\n            if (formDefinitionFile == null)\r\n            {\r\n                var newFile = DataFacade.BuildNew<IDynamicTypeFormDefinitionFile>();\r\n                newFile.FolderPath = dynamicDataFormFolderPath;\r\n                newFile.FileName = dynamicDataFormFileName;\r\n                newFile.SetNewContent(newFormMarkup);\r\n                formDefinitionFile = DataFacade.AddNew<IDynamicTypeFormDefinitionFile>(newFile);\r\n            }\r\n            else\r\n            {\r\n                formDefinitionFile.SetNewContent(newFormMarkup);\r\n                DataFacade.Update(formDefinitionFile);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static string GetFilename(string typeName)\r\n        {\r\n            return string.Format(\"{0}.xml\", typeName);\r\n        }\r\n\r\n\r\n\r\n        private static string GetFolderPath(string @namespace)\r\n        {\r\n            return \"\\\\\" + @namespace.Replace('.', '\\\\');\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/Foundation/ReflectionBasedDataTypeDescriptorBuilder.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ReflectionBasedDescriptorBuilder\r\n    {\r\n        /// <exclude />\r\n        public static DataTypeDescriptor Build(Type type)\r\n        {\r\n            Verify.ArgumentNotNull(type, \"type\");\r\n            Verify.ArgumentCondition(typeof(IData).IsAssignableFrom(type), \"type\", \"{0} does not implement {1}\".FormatWith(type.FullName, typeof(IData).FullName));\r\n\r\n            Guid dataTypeId = DynamicTypeReflectionFacade.GetImmutableTypeId(type);\r\n\r\n            bool isCodeGenerated = type.GetCustomInterfaceAttributes<CodeGeneratedAttribute>().Any();\r\n\r\n            var typeDescriptor = new DataTypeDescriptor(dataTypeId, type.Namespace, type.Name, TypeManager.SerializeType(type), isCodeGenerated)\r\n            {\r\n                Title = DynamicTypeReflectionFacade.GetTitle(type),\r\n                LabelFieldName = DynamicTypeReflectionFacade.GetLabelPropertyName(type),\r\n                InternalUrlPrefix = DynamicTypeReflectionFacade.GetInternalUrlPrefix(type),\r\n                DataAssociations = DynamicTypeReflectionFacade.GetDataTypeAssociationDescriptors(type)\r\n            };\r\n            \r\n            List<Type> superInterfaces = type.GetInterfacesRecursively(t => typeof(IData).IsAssignableFrom(t) && t != typeof(IData));\r\n            typeDescriptor.SetSuperInterfaces(superInterfaces);\r\n            \r\n            Type buildNewHandlerType = DynamicTypeReflectionFacade.GetBuildNewHandlerType(type);\r\n            if (buildNewHandlerType != null) typeDescriptor.BuildNewHandlerTypeName = TypeManager.SerializeType(buildNewHandlerType);\r\n\r\n\r\n            foreach (PropertyInfo propertyInfo in type.GetProperties())\r\n            {\r\n                DataFieldDescriptor fieldDescriptor = BuildFieldDescriptor(propertyInfo, false);\r\n\r\n                typeDescriptor.Fields.Add(fieldDescriptor);\r\n            }\r\n\r\n            foreach (Type superInterfaceType in superInterfaces)\r\n            {\r\n                foreach (PropertyInfo propertyInfo in superInterfaceType.GetProperties())\r\n                {\r\n                    if (propertyInfo.Name == nameof(IPageData.PageId) && propertyInfo.DeclaringType == typeof(IPageData))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    DataFieldDescriptor fieldDescriptor = BuildFieldDescriptor(propertyInfo, true);\r\n\r\n                    typeDescriptor.Fields.Add(fieldDescriptor);\r\n                }\r\n            }\r\n\r\n            ValidateAndAddKeyProperties(typeDescriptor.KeyPropertyNames, typeDescriptor.VersionKeyPropertyNames, type);\r\n\r\n            string[] storeSortOrder = DynamicTypeReflectionFacade.GetSortOrder(type);\r\n            if (storeSortOrder != null)\r\n            {\r\n                foreach (string name in storeSortOrder)\r\n                {\r\n                    typeDescriptor.StoreSortOrderFieldNames.Add(name);\r\n                }\r\n            }\r\n\r\n            CheckSortOrder(typeDescriptor);\r\n\r\n            foreach (var dataScopeIdentifier in DynamicTypeReflectionFacade.GetDataScopes(type))\r\n            {\r\n                if (!typeDescriptor.DataScopes.Contains(dataScopeIdentifier))\r\n                {\r\n                    typeDescriptor.DataScopes.Add(dataScopeIdentifier);\r\n                }\r\n            }\r\n\r\n            foreach (string keyPropertyName in type.GetKeyPropertyNames())\r\n            {\r\n                if (typeDescriptor.Fields[keyPropertyName] == null)\r\n                {\r\n                    throw new InvalidOperationException(\r\n                        $\"The type '{type}' has a non existing key property specified by the attribute '{typeof (KeyPropertyNameAttribute)}'\");\r\n                }\r\n            }\r\n\r\n            var indexes = new List<DataTypeIndex>();\r\n            foreach (var indexAttribute in type.GetCustomAttributesRecursively<IndexAttribute>())\r\n            {\r\n                foreach (var field in indexAttribute.Fields)\r\n                {\r\n                    if (typeDescriptor.Fields[field.Item1] == null)\r\n                    {\r\n                        throw new InvalidOperationException($\"Index field '{field.Item1}' is not defined\");\r\n                    }\r\n                }\r\n\r\n                indexes.Add(new DataTypeIndex(indexAttribute.Fields) { Clustered = indexAttribute.Clustered });\r\n            }\r\n\r\n            indexes.Sort((a,b) => string.Compare(a.ToString(), b.ToString(), StringComparison.Ordinal));\r\n\r\n            typeDescriptor.Indexes = indexes;\r\n\r\n            return typeDescriptor;\r\n        }\r\n\r\n        static void ValidateAndAddKeyProperties(\r\n            DataFieldNameCollection keyProperties,\r\n            DataFieldNameCollection versionKeyProperties, \r\n            Type interfaceType)\r\n        {\r\n            foreach (string propertyName in interfaceType.GetKeyPropertyNames())\r\n            {\r\n                PropertyInfo property = FindProperty(interfaceType, propertyName);\r\n\r\n                if (DynamicTypeReflectionFacade.IsKeyField(property))\r\n                {\r\n                    keyProperties.Add(propertyName, false);\r\n                }\r\n            }\r\n\r\n            foreach (string propertyName in interfaceType.GetVersionKeyPropertyNames())\r\n            {\r\n                FindProperty(interfaceType, propertyName);\r\n\r\n                versionKeyProperties.Add(propertyName, false);\r\n            }\r\n        }\r\n\r\n\r\n        internal static PropertyInfo FindProperty(Type interfaceType, string propertyName)\r\n        {\r\n            PropertyInfo property = interfaceType.GetProperty(propertyName);\r\n            if (property == null)\r\n            {\r\n                List<Type> superInterfaces = interfaceType.GetInterfacesRecursively(t => typeof(IData).IsAssignableFrom(t) && t != typeof(IData));\r\n\r\n                foreach (Type superInterface in superInterfaces)\r\n                {\r\n                    property = superInterface.GetProperty(propertyName);\r\n                    if (property != null) break;\r\n                }\r\n            }\r\n\r\n            Verify.IsNotNull(property, $\"Missing property '{propertyName}' on type '{interfaceType}' or one of its interfaces\");\r\n\r\n            return property;\r\n        }\r\n\r\n        internal static DataFieldDescriptor BuildFieldDescriptor(PropertyInfo propertyInfo, bool inherited)\r\n        {\r\n            string fieldName = propertyInfo.Name;\r\n            Type fieldType = propertyInfo.PropertyType;\r\n            Guid fieldId = DynamicTypeReflectionFacade.GetImmutableFieldId(propertyInfo);\r\n\r\n            StoreFieldType storeFieldType = DynamicTypeReflectionFacade.GetStoreFieldType(propertyInfo);\r\n\r\n\r\n            var fieldDescriptor = new DataFieldDescriptor(fieldId, fieldName, storeFieldType, fieldType, inherited)\r\n            {\r\n                DefaultValue = DynamicTypeReflectionFacade.GetDefaultValue(propertyInfo),\r\n                IsNullable = DynamicTypeReflectionFacade.IsNullable(propertyInfo),\r\n                ForeignKeyReferenceTypeName = DynamicTypeReflectionFacade.ForeignKeyReferenceTypeName(propertyInfo),\r\n                GroupByPriority = DynamicTypeReflectionFacade.GetGroupByPriority(propertyInfo),\r\n                TreeOrderingProfile = DynamicTypeReflectionFacade.GetTreeOrderingProfile(propertyInfo),\r\n                NewInstanceDefaultFieldValue = DynamicTypeReflectionFacade.NewInstanceDefaultFieldValue(propertyInfo),\r\n                IsReadOnly = !propertyInfo.CanWrite\r\n            };\r\n\r\n            var formRenderingProfile = DynamicTypeReflectionFacade.GetFormRenderingProfile(propertyInfo);\r\n            if (formRenderingProfile != null)\r\n            {\r\n                fieldDescriptor.FormRenderingProfile = formRenderingProfile;\r\n            }\r\n\r\n            // These auto added widget functions does not work on a empty system.\r\n            // This code could have added widgets for data types that does not have any widgets attached to them\r\n            //WidgetFunctionProvider widgetFunctionProvider = GetWidgetFunctionMarkup(propertyInfo.PropertyType);            \r\n            //if (widgetFunctionProvider != null)\r\n            //{\r\n            //    LazyDataFieldFormRenderingProfile lazyDataFieldFormRenderingProfile = new LazyDataFieldFormRenderingProfile();\r\n            //    lazyDataFieldFormRenderingProfile.Label = propertyInfo.Name;\r\n            //    lazyDataFieldFormRenderingProfile.HelpText = propertyInfo.Name;\r\n            //    lazyDataFieldFormRenderingProfile.WidgetFunctionMarkupFunc = () => widgetFunctionProvider.SerializedWidgetFunction.ToString();\r\n\r\n            //    fieldDescriptor.FormRenderingProfile = lazyDataFieldFormRenderingProfile;\r\n            //}\r\n\r\n            int position;\r\n            fieldDescriptor.Position = DynamicTypeReflectionFacade.TryGetFieldPosition(propertyInfo, out position) \r\n                ? position : 1000;\r\n\r\n            return fieldDescriptor;\r\n        }\r\n\r\n\r\n\r\n        //private static WidgetFunctionProvider GetWidgetFunctionMarkup(Type propertyType)\r\n        //{\r\n        //    if (propertyType == typeof(string))\r\n        //    {\r\n        //        return StandardWidgetFunctions.TextBoxWidget;\r\n        //    }\r\n        //    if (propertyType == typeof(Guid))\r\n        //    {\r\n        //        return StandardWidgetFunctions.GuidTextBoxWidget;\r\n        //    }\r\n        //    if (propertyType == typeof(int))\r\n        //    {\r\n        //        return StandardWidgetFunctions.IntegerTextBoxWidget;\r\n        //    }\r\n        //    if (propertyType == typeof(DateTime))\r\n        //    {\r\n        //        return StandardWidgetFunctions.DateTimeSelectorWidget;\r\n        //    }\r\n        //    if (propertyType == typeof(decimal))\r\n        //    {\r\n        //        return StandardWidgetFunctions.DecimalTextBoxWidget;\r\n        //    }\r\n        //    return null;\r\n        //}\r\n\r\n\r\n\r\n        private static void CheckSortOrder(DataTypeDescriptor typeDescriptor)\r\n        {\r\n            if (typeDescriptor.StoreSortOrderFieldNames.Count == 0) return;\r\n\r\n\r\n            if (typeDescriptor.StoreSortOrderFieldNames.Count != typeDescriptor.Fields.Count)\r\n            {\r\n                throw new InvalidOperationException(\"The store sort order attribute should list all the fields of the interface\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/IDynamicTypeManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IDynamicTypeManager\r\n\t{\r\n        /// <exclude />\r\n        DataTypeDescriptor BuildNewDataTypeDescriptor(Type typeToDescript);\r\n\r\n        /// <exclude />\r\n        bool TryGetDataTypeDescriptor(Guid immutableTypeId, out DataTypeDescriptor dataTypeDescriptor);\r\n\r\n        /// <exclude />\r\n        void UpdateDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor, bool flushTheSystem);\r\n\r\n        /// <exclude />\r\n        void CreateStores(string providerName, IReadOnlyCollection<DataTypeDescriptor> typeDescriptor, bool doFlush);\r\n\r\n        /// <exclude />\r\n        void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, bool makeAFlush);\r\n\r\n        /// <exclude />\r\n        void DropStore(string providerName, DataTypeDescriptor typeDescriptor, bool makeAFlush);\r\n\r\n        /// <exclude />\r\n        void AddLocale(string providerName, CultureInfo cultureInfo);\r\n\r\n        /// <exclude />\r\n        void RemoveLocale(string providerName, CultureInfo cultureInfo);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/NameValidation.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class NameValidation\r\n    {\r\n        /// <exclude />\r\n        public static string ValidateNamespace(string namespaceString)\r\n        {\r\n            string errorMessage;\r\n            if (TryValidateNamespace(namespaceString, out errorMessage) == false)\r\n            {\r\n                throw new ArgumentException(errorMessage);\r\n            }\r\n\r\n            return namespaceString;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidateNamespace(string namespaceString)\r\n        {\r\n            string errorMessage;\r\n\r\n            return TryValidateNamespace(namespaceString, out errorMessage);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidateNamespace(string namespaceString, out string errorMessage)\r\n        {\r\n            errorMessage = \"\";\r\n\r\n            if (string.IsNullOrEmpty(namespaceString))\r\n            {\r\n                errorMessage = StringResourceSystemFacade.GetString(\"Composite.NameValidation\", \"EmptyNamespace\");\r\n                return false;\r\n            }\r\n\r\n\r\n            string[] namespaceElements = namespaceString.Split('.');\r\n\r\n            foreach (string namespaceElement in namespaceElements)\r\n            {\r\n                if (NameValidation.TryValidateName(namespaceElement, out errorMessage) == false)\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            if (namespaceElements.Distinct().Count() < namespaceElements.Count())\r\n            {\r\n                errorMessage = StringResourceSystemFacade.GetString(\"Composite.NameValidation\", \"DuplicateElementNamespace\");\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the name if all characters are valid in a type and field name. Invalid characters generate an exception.\r\n        /// </summary>\r\n        /// <param name=\"name\">The name to validate</param>\r\n        /// <returns>The name that was validated</returns>\r\n        public static string ValidateName(string name)\r\n        {\r\n            string errorMessage;\r\n\r\n            if (TryValidateName(name, out errorMessage) == false)\r\n            {\r\n                throw new ArgumentException(errorMessage);\r\n            }\r\n\r\n            return name;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidateName(string name)\r\n        {\r\n            string errorMessage;\r\n\r\n            return TryValidateName(name, out errorMessage);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidateName(string name, out string errorMessage)\r\n        {\r\n            errorMessage = \"\";\r\n\r\n            if (string.IsNullOrEmpty(name))\r\n            {\r\n                errorMessage = StringResourceSystemFacade.GetString(\"Composite.NameValidation\", \"EmptyName\");\r\n                return false;\r\n            }\r\n\r\n            for (int i = 0; i < name.Length; i++)\r\n            {\r\n                char ch = name[i];\r\n                UnicodeCategory uc = Char.GetUnicodeCategory(ch);\r\n\r\n                if (ch > 127)\r\n                {\r\n                    errorMessage = string.Format(StringResourceSystemFacade.GetString(\"Composite.NameValidation\", \"InvalidIdentifier\"), name);\r\n                    return false;\r\n                }\r\n\r\n                if (i == 0 && uc == UnicodeCategory.DecimalDigitNumber)\r\n                {\r\n                    errorMessage = string.Format(StringResourceSystemFacade.GetString(\"Composite.NameValidation\", \"InvalidIdentifierDigit\"), name);\r\n                    return false;\r\n                }\r\n\r\n                switch (uc)\r\n                {\r\n                    case UnicodeCategory.UppercaseLetter:\r\n                    case UnicodeCategory.LowercaseLetter:\r\n                    case UnicodeCategory.TitlecaseLetter:\r\n                    case UnicodeCategory.DecimalDigitNumber:\r\n                        break;\r\n                    default:\r\n                        if (ch == 95)\r\n                            break;\r\n\r\n                        errorMessage = string.Format(StringResourceSystemFacade.GetString(\"Composite.NameValidation\", \"InvalidIdentifier\"), name);\r\n                        return false;\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/ParseDefinitionFileException.cs",
    "content": "﻿using System;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    [Serializable]\r\n    internal class ParseDefinitionFileException : Exception\r\n    {\r\n        private readonly XObject _source;\r\n\r\n        public ParseDefinitionFileException(string message, XObject source) \r\n            : base(GetMessage(message, source))\r\n        {\r\n            _source = source;\r\n            Line = (source as IXmlLineInfo).LineNumber;\r\n            Position = (source as IXmlLineInfo).LinePosition;\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get\r\n            {\r\n                return _source.BaseUri;\r\n            }\r\n        }\r\n\r\n        public int Line { get; private set; }\r\n        public int Position { get; private set; }\r\n\r\n        private static string GetMessage(string message, XObject source)\r\n        {\r\n            var lineInfo = source as IXmlLineInfo;\r\n\r\n            return string.Format(\"{0} ({1}:{2}): {3}\", source.BaseUri, lineInfo.LineNumber, lineInfo.LinePosition, message);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/SearchProfile.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Serializable]\r\n    public class SearchProfile\r\n    {\r\n        /// <exclude />\r\n        public bool IndexText { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool EnablePreview { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsFacet { get; set; }\r\n\r\n        /// <exclude />\r\n        public SearchProfile Clone()\r\n        {\r\n            return new SearchProfile\r\n            {\r\n                IndexText = IndexText,\r\n                EnablePreview = EnablePreview,\r\n                IsFacet = IsFacet\r\n            };\r\n        }\r\n\r\n        /// <exclude />\r\n        internal CodeAttributeDeclaration GetCodeAttributeDeclaration()\r\n        {\r\n            if (!IndexText && !EnablePreview && !IsFacet)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new CodeAttributeDeclaration(\r\n                typeof(SearchableFieldAttribute).FullName,\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(IndexText)),\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(EnablePreview)),\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(IsFacet)));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/StoreFieldType.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// Describe a field on a C1 CMS data type, see <see cref=\"DataTypeDescriptor\"/>.\r\n    /// </summary>\r\n    [Serializable()]\r\n    public sealed class StoreFieldType\r\n    {\r\n        private int? _maximumLength;\r\n        private int? _numericPrecision;\r\n        private int? _numericScale;\r\n\r\n        /// <summary>The maximum number of characters allowed in a string (2048). For larger strings use the LargeString type.</summary>\r\n        public static int StringMaximumLength { get { return 2048; } }\r\n\r\n        /// <summary>The maximum number of digits a decimal may contain (28).</summary>\r\n        public static int NumericPrecisionMaximum { get { return 28; } }\r\n\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"StoreFieldType\"/> describing a string.\r\n        /// </summary>\r\n        /// <param name=\"maximumLength\">String maximum length</param>\r\n        /// <returns></returns>\r\n        public static StoreFieldType String(int maximumLength) { return new StoreFieldType(PhysicalStoreFieldType.String, maximumLength); }\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"StoreFieldType\"/> describing a int.\r\n        /// </summary>\r\n        public static StoreFieldType Integer { get { return new StoreFieldType(PhysicalStoreFieldType.Integer); } }\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"StoreFieldType\"/> describing a long.\r\n        /// </summary>\r\n        public static StoreFieldType Long { get { return new StoreFieldType(PhysicalStoreFieldType.Long); } }\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"StoreFieldType\"/> describing a decimal.\r\n        /// </summary>\r\n        /// <param name=\"precision\">precision</param>\r\n        /// <param name=\"scale\">scale</param>\r\n        /// <returns></returns>\r\n        public static StoreFieldType Decimal(int precision, int scale) { return new StoreFieldType(PhysicalStoreFieldType.Decimal, precision, scale); }\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"StoreFieldType\"/> describing a DateTime.\r\n        /// </summary>\r\n        public static StoreFieldType DateTime { get { return new StoreFieldType(PhysicalStoreFieldType.DateTime); } }\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"StoreFieldType\"/> describing a string with unlimited length.\r\n        /// </summary>\r\n        public static StoreFieldType LargeString { get { return new StoreFieldType(PhysicalStoreFieldType.LargeString); } }\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"StoreFieldType\"/> describing a bool.\r\n        /// </summary>\r\n        public static StoreFieldType Boolean { get { return new StoreFieldType(PhysicalStoreFieldType.Boolean); } }\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"StoreFieldType\"/> describing a Guid.\r\n        /// </summary>\r\n        public static StoreFieldType Guid { get { return new StoreFieldType(PhysicalStoreFieldType.Guid); } }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The type of physical store for this field\r\n        /// </summary>\r\n        public PhysicalStoreFieldType PhysicalStoreType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// True when this field is a string.\r\n        /// </summary>\r\n        public bool IsString { get { return this.PhysicalStoreType == PhysicalStoreFieldType.String || this.PhysicalStoreType == PhysicalStoreFieldType.LargeString; } }\r\n\r\n        /// <summary>\r\n        /// True when this field is a string of unlimited length.\r\n        /// </summary>\r\n        public bool IsLargeString { get { return this.PhysicalStoreType == PhysicalStoreFieldType.LargeString; } }\r\n\r\n        /// <summary>\r\n        /// True when this field is a decimal.\r\n        /// </summary>\r\n        public bool IsDecimal { get { return this.PhysicalStoreType == PhysicalStoreFieldType.Decimal; } }\r\n\r\n        /// <summary>\r\n        /// True when this field is a DateTime.\r\n        /// </summary>\r\n        public bool IsDateTime { get { return this.PhysicalStoreType == PhysicalStoreFieldType.DateTime; } }\r\n\r\n        /// <summary>\r\n        /// True when this field is a Guid.\r\n        /// </summary>\r\n        public bool IsGuid { get { return this.PhysicalStoreType == PhysicalStoreFieldType.Guid; } }\r\n\r\n        /// <exclude />\r\n        public bool IsNumeric { get { return this.PhysicalStoreType == PhysicalStoreFieldType.Decimal || this.PhysicalStoreType == PhysicalStoreFieldType.Long || this.PhysicalStoreType == PhysicalStoreFieldType.Integer; } }\r\n\r\n        /// <summary>\r\n        /// True when this field is a boolean.\r\n        /// </summary>\r\n        public bool IsBoolean { get { return this.PhysicalStoreType == PhysicalStoreFieldType.Boolean; } }\r\n\r\n\r\n        /// <summary>\r\n        /// Maximum length of string. This field is only used for string.\r\n        /// </summary>\r\n        public int MaximumLength\r\n        {\r\n            get\r\n            {\r\n                if (_maximumLength.HasValue)\r\n                {\r\n                    return _maximumLength.Value;\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException(\"The maximum length is not valid for this store field type\");\r\n                }\r\n            }\r\n            private set\r\n            {\r\n                _maximumLength = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Numeric precision of decimal. This field is only used for decimal.\r\n        /// </summary>\r\n        public int NumericPrecision\r\n        {\r\n            get\r\n            {\r\n                if (_numericPrecision.HasValue)\r\n                {\r\n                    return _numericPrecision.Value;\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException(\"The numeric precision is not valid for this store field type\");\r\n                }\r\n            }\r\n            private set\r\n            {\r\n                _numericPrecision = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Numeric scale of decimal. This field is only used for decimal.\r\n        /// </summary>\r\n        public int NumericScale\r\n        {\r\n            get\r\n            {\r\n                if (_numericScale.HasValue)\r\n                {\r\n                    return _numericScale.Value;\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException(\"The numeric scale is not valid for this store field type\");\r\n                }\r\n            }\r\n            private set\r\n            {\r\n                _numericScale = value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Evaluate if one field type can safely change to another type.\r\n        /// </summary>\r\n        /// <param name=\"newStoreFieldType\">New store field type</param>\r\n        /// <returns>True is conversion is allowed.</returns>\r\n        public bool IsConvertibleTo(StoreFieldType newStoreFieldType)\r\n        {\r\n            if (this.PhysicalStoreType == newStoreFieldType.PhysicalStoreType) return true;\r\n            if (this.IsNumeric && newStoreFieldType.IsDecimal) return true;\r\n\r\n            // String and LargeString are convertable to each other\r\n            if ((PhysicalStoreType == PhysicalStoreFieldType.String && newStoreFieldType.PhysicalStoreType == PhysicalStoreFieldType.LargeString)\r\n                || (newStoreFieldType.PhysicalStoreType == PhysicalStoreFieldType.String && PhysicalStoreType == PhysicalStoreFieldType.LargeString))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            switch (this.PhysicalStoreType)\r\n            {\r\n                case PhysicalStoreFieldType.Integer:\r\n                case PhysicalStoreFieldType.Long:\r\n                case PhysicalStoreFieldType.LargeString:\r\n                case PhysicalStoreFieldType.DateTime:\r\n                case PhysicalStoreFieldType.Guid:\r\n                case PhysicalStoreFieldType.Boolean:\r\n                    return this.PhysicalStoreType.ToString();\r\n                case PhysicalStoreFieldType.String:\r\n                    return string.Format(\"{0}({1})\", this.PhysicalStoreType, this.MaximumLength);\r\n                case PhysicalStoreFieldType.Decimal:\r\n                    return string.Format(\"{0}({1},{2})\", this.PhysicalStoreType, this.NumericPrecision, this.NumericScale);\r\n            }\r\n\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"PhysicalStoreType\", this.PhysicalStoreType.ToString());\r\n\r\n            switch (this.PhysicalStoreType)\r\n            {\r\n                case PhysicalStoreFieldType.String:\r\n                    StringConversionServices.SerializeKeyValuePair(sb, \"Length\", this.MaximumLength);\r\n                    break;\r\n\r\n                case PhysicalStoreFieldType.Decimal:\r\n                    StringConversionServices.SerializeKeyValuePair(sb, \"Precision\", this.NumericPrecision);\r\n                    StringConversionServices.SerializeKeyValuePair(sb, \"Scale\", this.NumericScale);\r\n                    break;\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static StoreFieldType Deserialize(string serializedData)\r\n        {\r\n            using (TimerProfiler timerProfiler = TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                if (string.IsNullOrEmpty(serializedData)) throw new ArgumentNullException(\"serializedData\");\r\n\r\n                Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n                if (dic.ContainsKey(\"PhysicalStoreType\") == false) throw new ArgumentException(\"Wrong serialized format\");\r\n\r\n                string physicalStoreFieldTypeString = StringConversionServices.DeserializeValue<string>(dic[\"PhysicalStoreType\"]);\r\n                PhysicalStoreFieldType physicalStoreFieldType = (PhysicalStoreFieldType)Enum.Parse(typeof(PhysicalStoreFieldType), physicalStoreFieldTypeString);\r\n\r\n                switch (physicalStoreFieldType)\r\n                {\r\n                    case PhysicalStoreFieldType.String:\r\n                        if (dic.ContainsKey(\"Length\") == false) throw new ArgumentException(\"Wrong serialized format\");\r\n                        int length = StringConversionServices.DeserializeValueInt(dic[\"Length\"]);\r\n                        return new StoreFieldType(physicalStoreFieldType, length);\r\n\r\n                    case PhysicalStoreFieldType.Decimal:\r\n                        if (dic.ContainsKey(\"Precision\") == false) throw new ArgumentException(\"Wrong serialized format\");\r\n                        if (dic.ContainsKey(\"Scale\") == false) throw new ArgumentException(\"Wrong serialized format\");\r\n\r\n                        int precision = StringConversionServices.DeserializeValueInt(dic[\"Precision\"]);\r\n                        int scale = StringConversionServices.DeserializeValueInt(dic[\"Scale\"]);\r\n\r\n                        return new StoreFieldType(physicalStoreFieldType, precision, scale);\r\n\r\n                    case PhysicalStoreFieldType.Boolean:\r\n                    case PhysicalStoreFieldType.DateTime:\r\n                    case PhysicalStoreFieldType.Guid:\r\n                    case PhysicalStoreFieldType.Integer:\r\n                    case PhysicalStoreFieldType.LargeString:\r\n                    case PhysicalStoreFieldType.Long:\r\n                        return new StoreFieldType(physicalStoreFieldType);\r\n\r\n                }\r\n\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private StoreFieldType(PhysicalStoreFieldType storeType)\r\n        {\r\n            this.PhysicalStoreType = storeType;\r\n            if (storeType == PhysicalStoreFieldType.LargeString) this.MaximumLength = int.MaxValue;\r\n        }\r\n\r\n\r\n\r\n        private StoreFieldType(PhysicalStoreFieldType storeType, int precision, int scale)\r\n        {\r\n            switch (storeType)\r\n            {\r\n                case PhysicalStoreFieldType.Decimal:\r\n                    if (precision < 1) throw new ArgumentException(\"Precision must be 1 or greater\");\r\n                    if (precision > NumericPrecisionMaximum) throw new ArgumentException(\"Precision may not be greater than \" + NumericPrecisionMaximum.ToString());\r\n                    if (scale < 0) throw new ArgumentException(\"Scale must be 0 or greater\");\r\n                    if (scale > precision) throw new ArgumentException(\"Scale can not be larger than precision\");\r\n                    this.PhysicalStoreType = storeType;\r\n                    this.NumericPrecision = precision;\r\n                    this.NumericScale = scale;\r\n                    return;\r\n            }\r\n            throw new ArgumentException(\"Specified PhysicalStoreType is not associated with a presision and scale\");\r\n        }\r\n\r\n\r\n\r\n        private StoreFieldType(PhysicalStoreFieldType storeType, int maxLength)\r\n        {\r\n            switch (storeType)\r\n            {\r\n                case PhysicalStoreFieldType.String:\r\n                    if (maxLength < 1) throw new ArgumentException(\"Maximum lenght must be 1 or greater\", \"maxLength\");\r\n                    if (maxLength > StringMaximumLength) throw new ArgumentException(\"Maximum lenght must be 2048 or less\", \"maxLength\");\r\n                    this.PhysicalStoreType = storeType;\r\n                    this.MaximumLength = maxLength;\r\n                    return;\r\n            }\r\n            throw new ArgumentException(\"Specified PhysicalStoreType is not associated with a maximum length\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/TypeUpdateVersionException.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n\tinternal sealed class TypeUpdateVersionException : Exception\r\n\t{\r\n        public TypeUpdateVersionException(string message)\r\n            : base(message)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/DynamicTypes/UpdateDataTypeDescriptor.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.Data.DynamicTypes\r\n{\r\n    /// <summary>    \r\n    /// This is a helper class to use when making changes to a data type descriptor.\r\n    /// It is mainly used by data providers when they have to update the under laying stores.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    public class UpdateDataTypeDescriptor\r\n    {\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"oldDataTypeDescriptor\"></param>\r\n        /// <param name=\"newDataTypeDescriptor\"></param>\r\n        /// <param name=\"originalTypeHasData\"></param>\r\n        public UpdateDataTypeDescriptor(DataTypeDescriptor oldDataTypeDescriptor, DataTypeDescriptor newDataTypeDescriptor, bool originalTypeHasData = true)\r\n        {\r\n            OldDataTypeDescriptor = oldDataTypeDescriptor;\r\n            NewDataTypeDescriptor = newDataTypeDescriptor;\r\n\r\n            var interfaceType = oldDataTypeDescriptor.GetInterfaceType();\r\n\r\n            ProviderName = interfaceType != null \r\n                ? DataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(interfaceType)\r\n                                      .SingleOrException(\"Failed to get data provider by type '{0}'\",\r\n                                                         \"Multiple data providers for type '{0}'\", interfaceType.FullName)\r\n                : DataProviderRegistry.DefaultDynamicTypeDataProviderName;\r\n        }\r\n\r\n        internal UpdateDataTypeDescriptor(DataTypeDescriptor oldDataTypeDescriptor,\r\n            DataTypeDescriptor newDataTypeDescriptor, \r\n            string providerName)\r\n        {\r\n            OldDataTypeDescriptor = oldDataTypeDescriptor;\r\n            NewDataTypeDescriptor = newDataTypeDescriptor;\r\n\r\n            ProviderName = providerName;\r\n        }\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public DataTypeDescriptor OldDataTypeDescriptor { get; private set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public DataTypeDescriptor NewDataTypeDescriptor { get; private set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public DataTypeChangeDescriptor CreateDataTypeChangeDescriptor()\r\n        {\r\n            return new DataTypeChangeDescriptor(OldDataTypeDescriptor, NewDataTypeDescriptor, OriginalTypeHasData);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// If this is true, extra validation on what things are changed on \r\n        /// the data type. Some operation are not allowed if data exists.\r\n        /// </summary>\r\n        public bool OriginalTypeHasData { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public string ProviderName { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is only used when enabling localization for the data type in question\r\n        /// If this empty or contains any cultues, data from existing locale(s) (published/unpublished)\r\n        /// will be copied to these locales.\r\n        /// </summary>\r\n        public IEnumerable<CultureInfo> LocalesToCopyTo { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is only used when disabling localization for the data type in question\r\n        /// Data from this locale (published/unpublished) will be copied to the non-localized store(s).\r\n        /// </summary>\r\n        public CultureInfo LocaleToCopyFrom { get; set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        public IEnumerable<DataScopeIdentifier> OldSupportedDataScopeIdentifiers\r\n        {\r\n            get\r\n            {\r\n                yield return DataScopeIdentifier.Administrated;\r\n\r\n                if (OldDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled))) yield return DataScopeIdentifier.Public;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is true if publication is added from the data type (IPublishControlled added).\r\n        /// </summary>\r\n        public bool PublicationAdded\r\n        {\r\n            get\r\n            {\r\n                return (OldDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)) == false) &&\r\n                       (NewDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is true if publication is removed from the data type (IPublishControlled removed).\r\n        /// </summary>\r\n        public bool PublicationRemoved\r\n        {\r\n            get\r\n            {\r\n                return (OldDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled))) &&\r\n                       (NewDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)) == false);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This is true if the new data type description has publication.\r\n        /// </summary>\r\n        public bool NewHasPublication\r\n        {\r\n            get\r\n            {\r\n                return NewDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/FieldPositionAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Specify the posution of a field as they should be listed by default\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the FieldPosition attribute. \r\n    /// <code>\r\n    /// // data interface attributes ...\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n    ///     [ImmutableFieldId(\"{D75EA67F-AD14-4BAB-8547-6D87002709F3}\")]\r\n    ///     [FieldPosition(1)]\r\n    ///     string Title { get; set; }\r\n    ///     \r\n    ///     // more data properties ...\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n\tpublic sealed class FieldPositionAttribute : Attribute\r\n\t{\r\n        /// <exclude />\r\n        public FieldPositionAttribute(int position)\r\n        {\r\n            this.Position = position;\r\n        }\r\n\r\n        /// <exclude />\r\n        public int Position { get; private set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ForeignKeyAttribute.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// The attribute will tell the system that a data property is a reference (foreign key) to another IData.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the ForeignKey attribute. \r\n    /// <code>\r\n    /// // data interface attributes ...\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n    ///     [ImmutableFieldId(\"{D75EA67F-AD14-4BAB-8547-6D87002809F2}\")]\r\n    ///     [ForeignKey(typeof(IPage), \"Id\", AllowCascadeDeletes = true)]\r\n    ///     Guid PageId { get; set; }\r\n    ///     \r\n    ///     // more data properties ...\r\n    ///     \r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class ForeignKeyAttribute : Attribute\r\n    {\r\n        private string _interfaceTypeManagerName;\r\n\r\n        private Type _interfaceType;\r\n        private string _keyPropertyName;\r\n\r\n        private object _nullReferenceValue;\r\n        private bool _isNullReferenceValueSet;\r\n\r\n        private readonly object _lock = new object();\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Tell the system that this data property is a reference (foreign key) to another IData.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The type being referenced</param>\r\n        /// <param name=\"keyPropertyName\">The field being referenced</param>\r\n        public ForeignKeyAttribute(Type interfaceType, string keyPropertyName)\r\n        {\r\n            _interfaceType = interfaceType;\r\n            _keyPropertyName = keyPropertyName;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Only use this constructor for types that are registred with the DynamicTypeManager. Primary key field is infered.\r\n        /// </summary>\r\n        /// <param name=\"interfaceTypeManagerName\">A string that will yield a type from the TypeManager.</param>\r\n        public ForeignKeyAttribute(string interfaceTypeManagerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(interfaceTypeManagerName, nameof(interfaceTypeManagerName));\r\n\r\n            _interfaceTypeManagerName = interfaceTypeManagerName;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// If the \"parent\" data is deleted and this is set to true, then the data that \r\n        /// refer to the parent is also deleted.\r\n        /// </summary>\r\n        public bool AllowCascadeDeletes { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// This value is used when foreign key integrity is performed.\r\n        /// If this is not set, the data that the foreign key is pointing to must always exists.\r\n        /// </summary>\r\n        public object NullReferenceValue\r\n        {\r\n            get\r\n            {\r\n                return _nullReferenceValue;\r\n            }\r\n            set\r\n            {\r\n                _nullReferenceValue = value;\r\n                _isNullReferenceValueSet = true;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The NullReferenceValue will be converted to the the type specifed with the property\r\n        /// </summary>\r\n        public Type NullReferenceValueType\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Use this if non-reference is allowed with strings foreign keys\r\n        /// </summary>\r\n        public bool NullableString\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsNullReferenceValueSet => _isNullReferenceValueSet;\r\n\r\n\r\n        /// <exclude />\r\n        public Type InterfaceType\r\n        {\r\n            get\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_interfaceType == null)\r\n                    {\r\n                        _interfaceType = TypeManager.GetType(_interfaceTypeManagerName);\r\n                    }\r\n                }\r\n\r\n                return _interfaceType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsValid\r\n        {\r\n            get\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_interfaceType == null)\r\n                    {\r\n                        _interfaceType = TypeManager.TryGetType(_interfaceTypeManagerName);\r\n                    }\r\n                }\r\n\r\n                return _interfaceType != null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string TypeManagerName\r\n        {\r\n            get\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (string.IsNullOrEmpty(_interfaceTypeManagerName))\r\n                    {\r\n                        _interfaceTypeManagerName = TypeManager.TrySerializeType(_interfaceType);\r\n                    }\r\n                }\r\n\r\n                return _interfaceTypeManagerName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string KeyPropertyName\r\n        {\r\n            get\r\n            {\r\n                if (_keyPropertyName == null)\r\n                {\r\n                    lock (_lock)\r\n                    {\r\n                        if (_keyPropertyName == null)\r\n                        {\r\n                            _keyPropertyName = InterfaceType.GetSingleKeyProperty().Name;\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return _keyPropertyName;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ForeignPropertyInfo.cs",
    "content": "using Composite.Core.Types;\r\nusing System;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class ForeignPropertyInfo\r\n\t{\r\n        internal ForeignPropertyInfo(PropertyInfo sourcePropertyInfo, Type targetType, string targetKeyPropertyName, bool allowCascadeDeletes, object nullReferenceValue, Type nullReferenceValueType, bool isNullableString)\r\n            : this(sourcePropertyInfo, targetType, targetKeyPropertyName, allowCascadeDeletes, isNullableString)\r\n        {\r\n            this.NullReferenceValue = ValueTypeConverter.Convert( nullReferenceValue, sourcePropertyInfo.PropertyType);\r\n            this.NullReferenceValueType = nullReferenceValueType;\r\n            this.IsNullReferenceValueSet = true;\r\n        }\r\n\r\n\r\n\r\n        internal ForeignPropertyInfo(PropertyInfo sourcePropertyInfo, Type targetType, string targetKeyPropertyName, bool allowCascadeDeletes, bool isNullableString)\r\n        {\r\n            this.SourcePropertyName = sourcePropertyInfo.Name;\r\n            this.SourcePropertyInfo = sourcePropertyInfo;\r\n            this.TargetType = targetType;\r\n            this.TargetKeyPropertyName = targetKeyPropertyName;\r\n            this.AllowCascadeDeletes = allowCascadeDeletes;\r\n            this.IsNullableString = isNullableString;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string SourcePropertyName\r\n        {\r\n            get;\r\n            private set;\r\n        }        \r\n\r\n\r\n        internal PropertyInfo SourcePropertyInfo\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type TargetType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string TargetKeyPropertyName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool AllowCascadeDeletes\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public object NullReferenceValue\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type NullReferenceValueType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsNullReferenceValueSet\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsNullableString\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsOptionalReference\r\n        {\r\n            get { return IsNullableString || SourcePropertyInfo.PropertyType == typeof (Guid?); }\r\n        }\r\n\r\n\r\n        internal PropertyInfo TargetKeyPropertyInfo\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/FormRenderingProfileAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Assign this to properties on your IData interfaces to control how a data field whould be viewed and edited in a form view.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]\r\n\tpublic sealed class FormRenderingProfileAttribute : Attribute\r\n\t{\r\n        /// <summary>\r\n        /// Defines the field's label\r\n        /// </summary>\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// Defines the field's help text.\r\n        /// </summary>\r\n        public string HelpText { get; set; }\r\n\r\n        /// <summary>\r\n        /// Defines the widget function markup\r\n        /// </summary>\r\n        public string WidgetFunctionMarkup { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/CodeGeneratedAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class CodeGeneratedAttribute : Attribute\r\n\t{\r\n        public CodeGeneratedAttribute()\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/CodeGeneration/DataWrapperClassCodeProvider.cs",
    "content": "﻿using Composite.Core;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.Foundation.CodeGeneration\r\n{\r\n    internal class DataWrapperClassCodeProvider : ICodeProvider\r\n    {\r\n        public void GetCodeToCompile(CodeGenerationBuilder builder)\r\n        {\r\n            foreach (DataTypeDescriptor dataTypeDescriptor in DataMetaDataFacade.AllDataTypeDescriptors)\r\n            {\r\n                if (!dataTypeDescriptor.ValidateRuntimeType())\r\n                {\r\n                    Log.LogError(\"DataWrapperClassCodeProvider\", string.Format(\"The non code generated interface type '{0}' was not found, skipping code generation for that type\", dataTypeDescriptor));\r\n                    continue;\r\n                }\r\n\r\n                DataWrapperCodeGenerator.AddDataWrapperClassCode(builder, dataTypeDescriptor);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/CodeGeneration/DataWrapperCodeGenerator.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\n\r\n\r\nnamespace Composite.Data.Foundation.CodeGeneration\r\n{\r\n    /// <summary>\r\n    /// This class genereated code for data wrapper classes.\r\n    /// </summary>\r\n    internal static class DataWrapperCodeGenerator\r\n    {\r\n        private const string NamespaceName = \"CompositeGenerated.DataWrappers\";\r\n        private const string WrappedObjectName = \"_wrappedData\";\r\n\r\n\r\n\r\n        internal static void AddDataWrapperClassCode(CodeGenerationBuilder codeGenerationBuilder, Type interfaceType)\r\n        {\r\n            codeGenerationBuilder.AddReference(interfaceType.Assembly);\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = ReflectionBasedDescriptorBuilder.Build(interfaceType);\r\n\r\n            AddDataWrapperClassCode(codeGenerationBuilder, dataTypeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        internal static void AddDataWrapperClassCode(CodeGenerationBuilder codeGenerationBuilder, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n            if (interfaceType == null) return;\r\n\r\n            codeGenerationBuilder.AddReference(typeof(IDataWrapper).Assembly);\r\n            codeGenerationBuilder.AddReference(typeof(EditorBrowsableAttribute).Assembly);\r\n\r\n            CodeTypeDeclaration codeTypeDeclaration = CreateCodeTypeDeclaration(dataTypeDescriptor);\r\n\r\n            codeGenerationBuilder.AddType(NamespaceName, codeTypeDeclaration);\r\n        }\r\n\r\n\r\n\r\n        internal static string CreateWrapperClassFullName(string interfaceTypeFullName)\r\n        {\r\n            return NamespaceName + \".\" + CreateWrapperClassName(interfaceTypeFullName);\r\n        }\r\n\r\n\r\n\r\n        private static string CreateWrapperClassName(string interfaceTypeFullName)\r\n        {\r\n            return string.Format(\"{0}Wrapper\", interfaceTypeFullName.Replace('.', '_').Replace('+', '_'));\r\n        }\r\n\r\n\r\n\r\n        private static CodeTypeDeclaration CreateCodeTypeDeclaration(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            string interfaceTypeFullName = dataTypeDescriptor.GetFullInterfaceName();\r\n\r\n            var debugDisplayText = $\"Data wrapper for '{interfaceTypeFullName}'\";\r\n            foreach (var keyPropertyName in dataTypeDescriptor.KeyPropertyNames)\r\n            {\r\n                debugDisplayText += $\", {keyPropertyName} = {{{keyPropertyName}}}\";\r\n            }\r\n\r\n            var labelFieldName = dataTypeDescriptor.LabelFieldName;\r\n            if (!string.IsNullOrEmpty(labelFieldName) && !dataTypeDescriptor.KeyPropertyNames.Contains(labelFieldName))\r\n            {\r\n                debugDisplayText += $\", {labelFieldName} = {{{labelFieldName}}}\";\r\n            }\r\n\r\n            IEnumerable<Tuple<string, Type, bool>> properties =\r\n                dataTypeDescriptor.Fields.\r\n                    Select(f => new Tuple<string, Type, bool>(f.Name, f.InstanceType, f.IsReadOnly)).\r\n                    Concat(new[] { new Tuple<string, Type, bool>(\"DataSourceId\", typeof(DataSourceId), true) });\r\n\r\n            var declaration = new CodeTypeDeclaration\r\n            {\r\n                Name = CreateWrapperClassName(interfaceTypeFullName),\r\n                IsClass = true,\r\n                TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed\r\n            };\r\n            declaration.BaseTypes.Add(interfaceTypeFullName);\r\n            declaration.BaseTypes.Add(typeof(IDataWrapper));\r\n            declaration.CustomAttributes.AddRange(new[]\r\n            {\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(EditorBrowsableAttribute)),\r\n                    new CodeAttributeArgument(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeTypeReferenceExpression(typeof(EditorBrowsableState)),\r\n                            EditorBrowsableState.Never.ToString()\r\n                        )\r\n                    )\r\n                ),\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(DebuggerDisplayAttribute)),\r\n                    new CodeAttributeArgument(\r\n                        new CodePrimitiveExpression(debugDisplayText)\r\n                    )\r\n                )\r\n            });\r\n\r\n            declaration.Members.Add(new CodeMemberField(interfaceTypeFullName, WrappedObjectName));\r\n\r\n            AddConstructor(declaration, interfaceTypeFullName);\r\n            AddInterfaceProperties(declaration, properties);\r\n\r\n            AddMethods(declaration, properties);\r\n\r\n            return declaration;\r\n        }\r\n\r\n\r\n\r\n        private static void AddConstructor(CodeTypeDeclaration declaration, string interfaceTypeFullName)\r\n        {\r\n            const string parameterName = \"data\";\r\n\r\n            CodeConstructor codeConstructor = new CodeConstructor();\r\n            codeConstructor.Attributes = MemberAttributes.Public;\r\n            codeConstructor.Parameters.Add(new CodeParameterDeclarationExpression(interfaceTypeFullName, parameterName));\r\n\r\n            codeConstructor.Statements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), WrappedObjectName),\r\n                    new CodeVariableReferenceExpression(parameterName)\r\n                ));\r\n\r\n            declaration.Members.Add(codeConstructor);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"declaration\"></param>\r\n        /// <param name=\"properties\">Tuple(string propertyName, Type propertyType, bool readOnly)</param>\r\n        private static void AddInterfaceProperties(CodeTypeDeclaration declaration, IEnumerable<Tuple<string, Type, bool>> properties)\r\n        {\r\n            foreach (var property in properties)\r\n            {\r\n                string propertyName = property.Item1;\r\n                Type propertyType = property.Item2;\r\n                bool readOnly = property.Item3;\r\n\r\n                string fieldName = CreateFieldName(propertyName);\r\n\r\n                CodeTypeReference nullableType = new CodeTypeReference(\r\n                        typeof(ExtendedNullable<>).FullName,\r\n                        new [] { new CodeTypeReference(propertyType) }\r\n                    );\r\n\r\n                CodeMemberField codeField = new CodeMemberField();\r\n                codeField.Name = fieldName;\r\n                codeField.Type = nullableType;\r\n\r\n                declaration.Members.Add(codeField);\r\n\r\n                CodeMemberProperty codeProperty = new CodeMemberProperty();\r\n                codeProperty.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n                codeProperty.Name = propertyName;\r\n                codeProperty.HasGet = true;\r\n                codeProperty.HasSet = !readOnly;\r\n                codeProperty.Type = new CodeTypeReference(propertyType);\r\n\r\n\r\n                codeProperty.GetStatements.Add(\r\n                    new CodeConditionStatement(\r\n                        new CodeBinaryOperatorExpression(\r\n                            new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(),\r\n                                    fieldName\r\n                                ),\r\n                            CodeBinaryOperatorType.IdentityInequality,\r\n                            new CodePrimitiveExpression(null)\r\n                        ),\r\n                        new CodeStatement[] {\r\n                            new CodeMethodReturnStatement(\r\n                                new CodePropertyReferenceExpression(\r\n                                    new CodeFieldReferenceExpression(\r\n                                        new CodeThisReferenceExpression(),\r\n                                        fieldName\r\n                                    ),\r\n                                    \"Value\"\r\n                                )\r\n                            )\r\n                        },\r\n                        new CodeStatement[] {\r\n                            new CodeMethodReturnStatement(\r\n                                new CodePropertyReferenceExpression(\r\n                                    new CodeFieldReferenceExpression(\r\n                                        new CodeThisReferenceExpression(),\r\n                                        WrappedObjectName\r\n                                    ),\r\n                                    propertyName\r\n                                )\r\n                            )\r\n                        }\r\n                    ));\r\n\r\n\r\n                if (!readOnly)\r\n                {\r\n\r\n                    // CODEGEN:\r\n                    // if(this.[fieldName] == null) {\r\n                    //   this.[fieldName] = new ExtendedNullable<...>(); \r\n                    // }\r\n\r\n                    codeProperty.SetStatements.Add(\r\n                        new CodeConditionStatement(\r\n                            new CodeBinaryOperatorExpression(\r\n                                new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(),\r\n                                    fieldName\r\n                                    ),\r\n                                CodeBinaryOperatorType.IdentityEquality,\r\n                                new CodePrimitiveExpression(null)\r\n                                ),\r\n                            new CodeAssignStatement(\r\n                                new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(),\r\n                                    fieldName\r\n                                    ),\r\n                                new CodeObjectCreateExpression(nullableType, new CodeExpression[] {}))));\r\n\r\n                    // CODEGEN:\r\n                    // this.[fieldName] = value;\r\n                    codeProperty.SetStatements.Add(\r\n                    new CodeAssignStatement(\r\n                        new CodePropertyReferenceExpression(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                fieldName\r\n                            ),\r\n                            \"Value\"\r\n                        ),\r\n                        new CodePropertySetValueReferenceExpression()\r\n                    ));\r\n                }\r\n\r\n                declaration.Members.Add(codeProperty);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"declaration\"></param>\r\n        /// <param name=\"properties\">Tuple(string propertyName, Type propertyType, bool readOnly)</param>\r\n        private static void AddMethods(CodeTypeDeclaration declaration, IEnumerable<Tuple<string, Type, bool>> properties)\r\n        {\r\n            CodeMemberProperty codeMemberProperty = new CodeMemberProperty();\r\n\r\n            codeMemberProperty.Name = \"WrappedData\";\r\n            codeMemberProperty.HasGet = true;\r\n            codeMemberProperty.HasSet = false;\r\n            codeMemberProperty.Type = new CodeTypeReference(typeof(IData));\r\n            codeMemberProperty.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n\r\n\r\n            codeMemberProperty.GetStatements.Add(\r\n                new CodeMethodReturnStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        WrappedObjectName\r\n                    )\r\n                ));\r\n\r\n            declaration.Members.Add(codeMemberProperty);\r\n\r\n\r\n            CodeMemberMethod codeMemberMethod = new CodeMemberMethod();\r\n            codeMemberMethod.Name = \"CommitData\";\r\n            codeMemberMethod.ReturnType = new CodeTypeReference(typeof(void));\r\n            codeMemberMethod.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n\r\n\r\n            foreach (var property in properties)\r\n            {\r\n                string propertyName = property.Item1;\r\n                bool readOnly = property.Item3;\r\n\r\n                if (readOnly) continue;\r\n\r\n                string fieldName = CreateFieldName(propertyName);\r\n\r\n                List<CodeStatement> statements = new List<CodeStatement>();\r\n\r\n                statements.Add(new CodeAssignStatement(\r\n                        new CodePropertyReferenceExpression(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                WrappedObjectName\r\n                            ),\r\n                            propertyName\r\n                        ),\r\n                        new CodePropertyReferenceExpression(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                fieldName\r\n                            ),\r\n                            \"Value\"\r\n                        )\r\n                    ));\r\n\r\n\r\n                codeMemberMethod.Statements.Add(new CodeConditionStatement(\r\n                        new CodeBinaryOperatorExpression(\r\n                            new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(),\r\n                                    fieldName\r\n                                ),\r\n                            CodeBinaryOperatorType.IdentityInequality,\r\n                            new CodePrimitiveExpression(null)\r\n                        ),\r\n                        statements.ToArray()\r\n                    ));\r\n            }\r\n\r\n            declaration.Members.Add(codeMemberMethod);\r\n        }\r\n\r\n\r\n\r\n\r\n        private static string CreateFieldName(string propertyName)\r\n        {\r\n            return string.Format(\"_{0}Nullable\", propertyName.ToLowerInvariant());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/CodeGeneration/DataWrapperGenerator.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.Foundation.CodeGeneration\r\n{\r\n    /// <summary>\r\n    /// This class handles data wrapper types and cashing.\r\n    /// It will through <see cref=\"DataWrapperCodeGenerator\"/> generated\r\n    /// data wrapper class types if needed.\r\n    /// </summary>\r\n    internal static class DataWrapperTypeManager\r\n    {\r\n        private static readonly object _compilationLock = new object();\r\n\r\n        private static readonly ConcurrentDictionary<Type, Type> _dataWrappersCache\r\n            = new ConcurrentDictionary<Type, Type>();\r\n\r\n        delegate T ObjectActivator<T>(T param);\r\n\r\n        private static readonly ConcurrentDictionary<Type, object> _dataWrappersActivatorCache\r\n            = new ConcurrentDictionary<Type, object>();\r\n\r\n        public static Func<T, T> GetWrapperConstructor<T>()\r\n        {\r\n            return (Func < T, T >)_dataWrappersActivatorCache.GetOrAdd(typeof (T), type =>\r\n            {\r\n                var wrapperType = GetDataWrapperType(typeof (T));\r\n\r\n                var param = Expression.Parameter(typeof (T));\r\n\r\n                var constructor = wrapperType.GetConstructors().Single();\r\n                var ctrExpression = Expression.New(constructor, param);\r\n\r\n                var lambda = Expression.Lambda(typeof (ObjectActivator<T>), ctrExpression, param);\r\n                var activator = (ObjectActivator<T>) lambda.Compile();\r\n\r\n                Func<T, T> func = obj => activator(obj);\r\n\r\n                return func;\r\n            });\r\n        }\r\n\r\n\r\n        public static Type GetDataWrapperType(Type interfaceType)\r\n        {\r\n            return _dataWrappersCache.GetOrAdd(interfaceType, type =>\r\n            {\r\n                Type wrapperType = TryGetWrapperType(type.FullName);\r\n                if (wrapperType != null) return wrapperType;\r\n\r\n                lock (_compilationLock)\r\n                {\r\n                    wrapperType = TryGetWrapperType(type.FullName);\r\n                    if (wrapperType != null) return wrapperType;\r\n\r\n                    var codeGenerationBuilder = new CodeGenerationBuilder(\"DataWrapper:\" + type.FullName);\r\n\r\n                    DataWrapperCodeGenerator.AddDataWrapperClassCode(codeGenerationBuilder, type);\r\n\r\n                    IEnumerable<Type> types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder);\r\n\r\n                    return types.Single();\r\n                }\r\n            });\r\n        }\r\n\r\n\r\n\r\n        public static Type GetDataWrapperType(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Type wrapperType = TryGetWrapperType(dataTypeDescriptor.GetFullInterfaceName());\r\n            if (wrapperType != null) return wrapperType;\r\n\r\n            lock (_compilationLock)\r\n            {\r\n                wrapperType = TryGetWrapperType(dataTypeDescriptor.GetFullInterfaceName());\r\n                if (wrapperType != null) return wrapperType;\r\n\r\n                var codeGenerationBuilder = new CodeGenerationBuilder(\"DataWrapper:\" + dataTypeDescriptor.GetFullInterfaceName());\r\n\r\n                DataWrapperCodeGenerator.AddDataWrapperClassCode(codeGenerationBuilder, dataTypeDescriptor);\r\n\r\n                IEnumerable<Type> types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder);\r\n\r\n                return types.Single();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a wrapper type, if it already exists.\r\n        /// </summary>\r\n        public static Type TryGetWrapperType(string fullName)\r\n        {\r\n            string dataWrapperFullName = DataWrapperCodeGenerator.CreateWrapperClassFullName(fullName);\r\n\r\n            Type wrapperType = TypeManager.TryGetType(dataWrapperFullName);\r\n\r\n            return wrapperType;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/CodeGeneration/EmptyDataClassBase.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data.Foundation.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public abstract class EmptyDataClassBase : IData\r\n    {\r\n        [NonSerialized]\r\n        private DataSourceId _dataSourceId = null;\r\n\r\n\r\n        /// <exclude />\r\n        public DataSourceId DataSourceId\r\n        {\r\n            get \r\n            {\r\n                if (_dataSourceId == null)\r\n                {\r\n                    _dataSourceId = new DataSourceId(this._InterfaceType);\r\n                }\r\n\r\n                return _dataSourceId;\r\n            }\r\n            internal set\r\n            {\r\n                _dataSourceId = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected abstract Type _InterfaceType { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/CodeGeneration/EmptyDataClassCodeGenerator.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.Foundation.CodeGeneration\r\n{\r\n    internal static class EmptyDataClassCodeGenerator\r\n    {\r\n        public static readonly string NamespaceName = \"Composite.Data.GeneratedTypes\";\r\n\r\n\r\n\r\n        internal static void AddEmptyDataClassTypeCode(CodeGenerationBuilder codeGenerationBuilder, DataTypeDescriptor dataTypeDescriptor, Type baseClassType = null, CodeAttributeDeclaration codeAttributeDeclaration = null)\r\n        {\r\n            Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n            if (interfaceType == null) return;\r\n\r\n            if (baseClassType == null) baseClassType = typeof(EmptyDataClassBase);\r\n\r\n            CodeTypeDeclaration codeTypeDeclaration = CreateCodeTypeDeclaration(dataTypeDescriptor, baseClassType, codeAttributeDeclaration);\r\n\r\n            codeGenerationBuilder.AddType(NamespaceName, codeTypeDeclaration);\r\n        }\r\n\r\n\r\n\r\n        internal static void AddAssemblyReferences(CodeGenerationBuilder codeGenerationBuilder, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n            if (interfaceType == null) return;\r\n\r\n            codeGenerationBuilder.AddReference(typeof(EmptyDataClassBase).Assembly);\r\n            codeGenerationBuilder.AddReference(typeof(EditorBrowsableAttribute).Assembly);\r\n            codeGenerationBuilder.AddReference(interfaceType.Assembly);\r\n\r\n            if (!string.IsNullOrEmpty(dataTypeDescriptor.BuildNewHandlerTypeName))\r\n            {\r\n                Type buildeNewHandlerType = TypeManager.GetType(dataTypeDescriptor.BuildNewHandlerTypeName);\r\n                codeGenerationBuilder.AddReference(buildeNewHandlerType.Assembly);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static CodeTypeDeclaration CreateCodeTypeDeclaration(DataTypeDescriptor dataTypeDescriptor, Type baseClass, CodeAttributeDeclaration codeAttributeDeclaration)\r\n        {\r\n            Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n\r\n            string interfaceTypeFullName = interfaceType.FullName;\r\n            CodeTypeDeclaration declaration = new CodeTypeDeclaration();\r\n\r\n            declaration.Name = CreateClassName(interfaceTypeFullName);\r\n            declaration.IsClass = true;\r\n            declaration.TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed;\r\n            declaration.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(SerializableAttribute))));\r\n            declaration.CustomAttributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(EditorBrowsableAttribute)),\r\n                    new CodeAttributeArgument(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeTypeReferenceExpression(typeof(EditorBrowsableState)),\r\n                            EditorBrowsableState.Never.ToString()\r\n                        )\r\n                    )\r\n                )\r\n            );\r\n\r\n            if (baseClass != null)\r\n            {\r\n                declaration.BaseTypes.Add(baseClass);\r\n            }\r\n            declaration.BaseTypes.Add(new CodeTypeReference(interfaceType, CodeTypeReferenceOptions.GlobalReference));\r\n\r\n\r\n            if (codeAttributeDeclaration != null)\r\n            {\r\n                declaration.CustomAttributes.Add(codeAttributeDeclaration);\r\n            }\r\n\r\n\r\n            AddConstructor(declaration);\r\n            AddInterfaceProperties(declaration, dataTypeDescriptor.Fields);\r\n\r\n            AddInterfaceTypeProperty(declaration, interfaceTypeFullName);\r\n\r\n            return declaration;\r\n        }\r\n\r\n\r\n\r\n        private static void AddConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeConstructor codeConstructor = new CodeConstructor();\r\n\r\n            codeConstructor.Attributes = MemberAttributes.Public;\r\n\r\n            declaration.Members.Add(codeConstructor);\r\n        }\r\n\r\n\r\n\r\n        private static void AddInterfaceProperties(CodeTypeDeclaration declaration, IEnumerable<DataFieldDescriptor> dataFieldDescriptors)\r\n        {\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in dataFieldDescriptors)\r\n            {\r\n                string fieldName = CreateFieldName(dataFieldDescriptor);\r\n\r\n                CodeMemberField codeField = new CodeMemberField(new CodeTypeReference(dataFieldDescriptor.InstanceType), fieldName);\r\n\r\n                declaration.Members.Add(codeField);\r\n\r\n                CodeMemberProperty property = new CodeMemberProperty();\r\n                property.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n                property.Name = dataFieldDescriptor.Name;\r\n                property.HasGet = true;\r\n                property.HasSet = !dataFieldDescriptor.IsReadOnly;\r\n                property.Type = new CodeTypeReference(dataFieldDescriptor.InstanceType);\r\n\r\n                property.GetStatements.Add(\r\n                        new CodeMethodReturnStatement(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                fieldName\r\n                            )\r\n                        )\r\n                    );\r\n\r\n\r\n                if (!dataFieldDescriptor.IsReadOnly)\r\n                {\r\n                    property.SetStatements.Add(\r\n                    new CodeAssignStatement(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            fieldName\r\n                        ),\r\n                        new CodePropertySetValueReferenceExpression()\r\n                    ));\r\n                }\r\n\r\n                declaration.Members.Add(property);\r\n            }\r\n        }\r\n\r\n\r\n        private static void AddInterfaceTypeProperty(CodeTypeDeclaration declaration, string interfaceTypeFullName)\r\n        {\r\n            CodeMemberProperty codeMemberProperty = new CodeMemberProperty();\r\n            codeMemberProperty.Name = \"_InterfaceType\";\r\n\r\n            codeMemberProperty.Type = new CodeTypeReference(typeof(Type));\r\n            codeMemberProperty.Attributes = MemberAttributes.Family | MemberAttributes.Override;\r\n            codeMemberProperty.HasSet = false;\r\n            codeMemberProperty.HasGet = true;\r\n            codeMemberProperty.GetStatements.Add(\r\n                    new CodeMethodReturnStatement(\r\n                        new CodeTypeOfExpression(new CodeTypeReference(interfaceTypeFullName, CodeTypeReferenceOptions.GlobalReference))\r\n                    )\r\n                );\r\n\r\n            declaration.Members.Add(codeMemberProperty);\r\n        }\r\n\r\n\r\n\r\n        internal static string GetEmptyClassTypeFullName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return NamespaceName + \".\" + CreateClassName(dataTypeDescriptor.GetFullInterfaceName());\r\n        }\r\n\r\n\r\n\r\n        private static string CreateClassName(string fullname)\r\n        {\r\n            return string.Format(\"{0}EmptyClass\", fullname.Replace('.', '_').Replace('+', '_'));\r\n        }\r\n\r\n\r\n\r\n        private static string CreateFieldName(DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            return string.Format(\"_{0}\", dataFieldDescriptor.Name.ToLowerInvariant());\r\n        }\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/CodeGeneration/EmptyDataClassCodeProvider.cs",
    "content": "﻿using Composite.Core;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.Foundation.CodeGeneration\r\n{\r\n    internal class EmptyDataClassCodeProvider : ICodeProvider\r\n    {\r\n        public void GetCodeToCompile(CodeGenerationBuilder builder)\r\n        {\r\n            foreach (DataTypeDescriptor dataTypeDescriptor in DataMetaDataFacade.AllDataTypeDescriptors)\r\n            {\r\n                if (!dataTypeDescriptor.ValidateRuntimeType())\r\n                {\r\n                    Log.LogError(\"EmptyDataClassCodeProvider\", \"The non code generated interface type '{0}' was not found, skipping code generation for that type\", dataTypeDescriptor);\r\n                    continue;\r\n                }\r\n\r\n                if (string.IsNullOrEmpty(dataTypeDescriptor.BuildNewHandlerTypeName))\r\n                {\r\n                    EmptyDataClassCodeGenerator.AddAssemblyReferences(builder, dataTypeDescriptor);\r\n                    EmptyDataClassCodeGenerator.AddEmptyDataClassTypeCode(builder, dataTypeDescriptor);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataAssociationRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    /// <summary>\r\n    /// Associated type: The type that is \"pointed\" to by another type\r\n    /// Association type: The type that is \"pointing\" to a nother type\r\n    /// </summary>\r\n    internal static class DataAssociationRegistry\r\n    {\r\n        // Associated type -> Association type\r\n        private static Dictionary<Type, List<Type>> _associatedTypes;\r\n\r\n        // Association type -> Associated type -> DataAssociationInfo\r\n        // As long as only one association is allowed for a given type, this dictionary is over kill /MRJ\r\n        private static Dictionary<Type, Dictionary<Type, DataAssociationInfo>> _dataAssociations;\r\n\r\n\r\n\r\n        static DataAssociationRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static bool IsAssociationType(Type associationType)\r\n        {\r\n            Verify.ArgumentNotNull(associationType, \"associationType\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                return _dataAssociations.ContainsKey(associationType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static DataAssociationType GetAssociationType(Type associationType)\r\n        {\r\n            Verify.ArgumentNotNull(associationType, \"associationType\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                Dictionary<Type, DataAssociationInfo> dataAssociationInfo;\r\n\r\n                if (!_dataAssociations.TryGetValue(associationType, out dataAssociationInfo))\r\n                {\r\n                    return DataAssociationType.None;\r\n                }\r\n                    \r\n                return dataAssociationInfo.Single().Value.AssociationType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> GetForeignKeyPropertyNames(this Type associationType, DataAssociationType dataAssociationType)\r\n        {\r\n            Verify.ArgumentNotNull(associationType, \"associationType\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                Dictionary<Type, DataAssociationInfo> dataAssociationInfos;\r\n\r\n                if (!_dataAssociations.TryGetValue(associationType, out dataAssociationInfos))\r\n                {\r\n                    return Enumerable.Empty<string>();\r\n                }\r\n\r\n                return from info in dataAssociationInfos.Values\r\n                        where info.AssociationType == dataAssociationType\r\n                        select info.ForeignKeyPropertyName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static List<Type> GetAssociationTypes(Type associatedType, DataAssociationType dataAssociationType)\r\n        {\r\n            if (associatedType == null) throw new ArgumentNullException(\"associatedType\");\r\n            if (dataAssociationType == DataAssociationType.None) throw new ArgumentException(string.Format(\"dataAssociationType may not be '{0}\", DataAssociationType.None));\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                List<Type> associationTypes;\r\n                if (!_associatedTypes.TryGetValue(associatedType, out associationTypes))\r\n                {\r\n                    return new List<Type>();\r\n                }\r\n\r\n                return\r\n                    (from t1 in associationTypes\r\n                     from info in _dataAssociations[t1].Values\r\n                     where info.AssociationType == dataAssociationType\r\n                     select t1).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static List<Type> GetAssociatedTypes(Type associationType, DataAssociationType dataAssociationType)\r\n        {\r\n            Verify.ArgumentNotNull(associationType, \"associationType\");\r\n            if (dataAssociationType == DataAssociationType.None) throw new ArgumentException(string.Format(\"dataAssociationType may not be '{0}\", DataAssociationType.None));\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                Dictionary<Type, DataAssociationInfo> dataAssociations;\r\n\r\n                if (!_dataAssociations.TryGetValue(associationType, out dataAssociations))\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Type type '{0}' is not an association type\", associationType));\r\n                }\r\n\r\n                return\r\n                    (from info in dataAssociations\r\n                     where info.Value.AssociationType == dataAssociationType\r\n                     select info.Key).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static string GetForeignKeyPropertyName(Type associatedType, Type associationType)\r\n        {\r\n            if (associatedType == null) throw new ArgumentNullException(\"associatedType\");\r\n            if (associationType == null) throw new ArgumentNullException(\"associationType\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                Dictionary<Type, DataAssociationInfo> dataAssociationInfos;\r\n\r\n                if (!_dataAssociations.TryGetValue(associationType, out dataAssociationInfos)) throw new ArgumentException(string.Format(\"The type '{0}' is not associated to any types\", associationType));\r\n\r\n                DataAssociationInfo dataAssociationInfo;\r\n                if (!dataAssociationInfos.TryGetValue(associatedType, out dataAssociationInfo)) throw new ArgumentException(string.Format(\"The type '{0}' is not associated to the type '{1}'\", associationType, associatedType));\r\n\r\n                return dataAssociationInfo.ForeignKeyPropertyName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static PropertyInfo GetForeignKeyPropertyInfo(Type associatedType, Type associationType)\r\n        {\r\n            if (associatedType == null) throw new ArgumentNullException(\"associatedType\");\r\n            if (associationType == null) throw new ArgumentNullException(\"associationType\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                Dictionary<Type, DataAssociationInfo> dataAssociationInfos;\r\n\r\n                if (!_dataAssociations.TryGetValue(associationType, out dataAssociationInfos)) throw new ArgumentException(string.Format(\"The type '{0}' is not associated to any types\", associationType));\r\n\r\n                DataAssociationInfo dataAssociationInfo;\r\n                if (!dataAssociationInfos.TryGetValue(associatedType, out dataAssociationInfo)) throw new ArgumentException(string.Format(\"The type '{0}' is not associated to the type '{1}'\", associationType, associatedType));\r\n\r\n                return dataAssociationInfo.ForeignKeyPropertyInfo;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void Initialize_PostDataTypes()\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                GlobalInitializerFacade.ValidateIsOnlyCalledFromGlobalInitializerFacade(new StackTrace());\r\n            }\r\n\r\n            _associatedTypes = new Dictionary<Type, List<Type>>();\r\n            _dataAssociations = new Dictionary<Type, Dictionary<Type, DataAssociationInfo>>();\r\n\r\n            foreach (Type type in DataProviderRegistry.AllInterfaces)\r\n            {\r\n                AddNewType(type);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddNewType(Type interfaceType)\r\n        {\r\n            List<DataAssociationAttribute> attributes = interfaceType.GetCustomAttributesRecursively<DataAssociationAttribute>().ToList();\r\n\r\n            if (attributes.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var dataAssociationInfos = new Dictionary<Type, DataAssociationInfo>();\r\n\r\n            foreach (DataAssociationAttribute attribute in attributes)\r\n            {\r\n                if (attribute.AssociationType == DataAssociationType.None) throw new ArgumentException(string.Format(\"The associationType on the attribute '{0}' on the interface type '{1}' may not be '{2}'\", typeof(DataAssociationAttribute), interfaceType, DataAssociationType.None));\r\n                if (attribute.AssociatedInterfaceType == null) throw new ArgumentNullException(string.Format(\"The associatedInterfaceType on the attribute '{0}' on the interface type '{1}' is null\", typeof(DataAssociationAttribute), interfaceType));\r\n\r\n                List<Type> associatedTypes;\r\n\r\n                Type associatedInterface = attribute.AssociatedInterfaceType;\r\n\r\n                if (_associatedTypes.TryGetValue(associatedInterface, out associatedTypes) == false)\r\n                {\r\n                    associatedTypes = new List<Type>();\r\n\r\n                    _associatedTypes.Add(associatedInterface, associatedTypes);\r\n\r\n                    DataEventSystemFacade.SubscribeToDataAfterUpdate(associatedInterface, OnAfterDataUpdated, false);\r\n                }\r\n\r\n                associatedTypes.Add(interfaceType);\r\n\r\n\r\n                PropertyInfo propertyInfo =\r\n                    (from pi in interfaceType.GetAllProperties()\r\n                     where pi.Name == attribute.ForeignKeyPropertyName\r\n                     select pi).FirstOrDefault();\r\n\r\n                if (propertyInfo == null) throw new ArgumentException(string.Format(\"The foreign key property name '{0}' set on the attribute '{1}' does not exist on the interface '{2}'\", attribute.ForeignKeyPropertyName, typeof(DataAssociationAttribute), interfaceType));\r\n\r\n                \r\n\r\n                var dataAssociationInfo = new DataAssociationInfo\r\n                {\r\n                    AssociatedInterfaceType = associatedInterface,\r\n                    ForeignKeyPropertyName = attribute.ForeignKeyPropertyName,\r\n                    ForeignKeyPropertyInfo = propertyInfo,\r\n                    AssociationType = attribute.AssociationType,\r\n                };\r\n\r\n                Verify.IsFalse(dataAssociationInfos.ContainsKey(associatedInterface), \"Failed to register interface '{0}'. Data association already exist, type: '{1}'\".FormatWith(interfaceType, associatedInterface));\r\n                dataAssociationInfos.Add(associatedInterface, dataAssociationInfo);\r\n\r\n                if (!DataProviderRegistry.AllInterfaces.Contains(associatedInterface))\r\n                {\r\n                    Log.LogCritical(\"DataReferenceRegistry\", string.Format(\"The one type '{0}' is associated to the non supported data type '{1}'\", interfaceType, associatedInterface));\r\n                }\r\n            }\r\n\r\n            _dataAssociations.Add(interfaceType, dataAssociationInfos);\r\n        }\r\n\r\n\r\n\r\n        private static void OnAfterDataUpdated(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            IPublishControlled publishControlled = dataEventArgs.Data as IPublishControlled;\r\n            if (publishControlled == null) return;\r\n\r\n            IPage page = dataEventArgs.Data as IPage;\r\n\r\n            if (page == null) return;\r\n\r\n            var metaDataToBeUpdated = page.GetMetaData().Evaluate();\r\n\r\n            foreach (IData data in metaDataToBeUpdated)\r\n            {\r\n                IPublishControlled pc = data as IPublishControlled;\r\n\r\n                if (pc.PublicationStatus != publishControlled.PublicationStatus)\r\n                {\r\n                    pc.PublicationStatus = publishControlled.PublicationStatus;\r\n\r\n                    // THIS UPDATE WAS ALWAYS EXECUTED - OUTSIDE THE versionControlled CHECK - WAS THIS NEEDED?\r\n                    DataFacade.Update(data, false, false, false);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _associatedTypes = null;\r\n            _dataAssociations = null;\r\n        }\r\n\r\n\r\n\r\n        private sealed class DataAssociationInfo\r\n        {\r\n            public Type AssociatedInterfaceType { get; set; }\r\n            public string ForeignKeyPropertyName { get; set; }\r\n            public PropertyInfo ForeignKeyPropertyInfo { get; set; }\r\n\r\n            public DataAssociationType AssociationType { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataExpressionBuilder.cs",
    "content": "using System.Linq.Expressions;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Collections.Generic;\r\nusing System;\r\nusing Composite.Core.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data.ProcessControlled;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal static class DataExpressionBuilder\r\n    {\r\n        private static object _lock = new object();\r\n\r\n\r\n\r\n        static DataExpressionBuilder()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method returns a queryable containing data with the same keys\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>        \r\n        /// <returns></returns>\r\n        public static IQueryable GetQueryableByData(IData data)\r\n        {\r\n            return GetQueryableByData(data, null);\r\n        }\r\n\r\n\r\n\r\n        public static IQueryable GetQueryableByData(IData data, IQueryable sourceQueryable)\r\n        {\r\n            LambdaExpression whereLambdaExpression = GetWhereLambdaExpression(data);\r\n\r\n            if (sourceQueryable == null)\r\n            {\r\n                sourceQueryable = DataFacade.GetData(data.DataSourceId.InterfaceType);\r\n            }\r\n\r\n            Expression whereExpression = ExpressionCreator.Where(sourceQueryable.Expression, whereLambdaExpression);\r\n\r\n            IQueryable newQueryable = sourceQueryable.Provider.CreateQuery(whereExpression);\r\n\r\n            return newQueryable;\r\n        }\r\n\r\n\r\n\r\n        public static IQueryable<T> GetQueryableByData<T>(T data)\r\n            where T : class, IData\r\n        {\r\n            LambdaExpression whereLambdaExpression = GetWhereLambdaExpression(data);\r\n\r\n            IQueryable queryable = DataFacade.GetData(data.DataSourceId.InterfaceType);\r\n\r\n            Expression whereExpression = ExpressionCreator.Where(queryable.Expression, whereLambdaExpression);\r\n\r\n            MethodInfo methodInfo = DataFacadeReflectionCache.GetCreateQueryMethodInfo(data.DataSourceId.InterfaceType);\r\n\r\n            return (IQueryable<T>)methodInfo.Invoke(queryable.Provider, new object[] { whereExpression });\r\n        }\r\n\r\n\r\n\r\n        public static Delegate GetWherePredicateDelegate(IData data)\r\n        {\r\n            LambdaExpression whereLambdaExpression = GetWhereLambdaExpression(data);\r\n\r\n            Delegate resultDelegate = whereLambdaExpression.Compile();\r\n\r\n            return resultDelegate;\r\n        }\r\n\r\n\r\n\r\n        private static LambdaExpression GetWhereLambdaExpression(IData data)\r\n        {\r\n            var propertyInfoes = data.DataSourceId.InterfaceType.GetPhysicalKeyProperties();\r\n\r\n            if (propertyInfoes.Count == 0)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"The data type '{0}' does not have any keys specified\", data.DataSourceId.InterfaceType));\r\n            }\r\n\r\n            ParameterExpression parameterExpression = Expression.Parameter(data.DataSourceId.InterfaceType, \"parameter\");\r\n\r\n            Expression whereBodyExpression = null;\r\n            foreach (PropertyInfo propertyInfo in propertyInfoes)\r\n            {\r\n                object value = propertyInfo.GetGetMethod().Invoke(data, new object[] { });\r\n\r\n                Expression expression =\r\n                    Expression.Equal(\r\n                        Expression.Property(parameterExpression, propertyInfo),\r\n                        Expression.Constant(value)\r\n                    );\r\n\r\n                if (whereBodyExpression == null)\r\n                {\r\n                    whereBodyExpression = expression;\r\n                }\r\n                else\r\n                {\r\n                    whereBodyExpression = Expression.And(whereBodyExpression, expression);\r\n                }\r\n            }\r\n\r\n            LambdaExpression whereLambdaExpression = Expression.Lambda(whereBodyExpression, new ParameterExpression[] { parameterExpression });\r\n\r\n            return whereLambdaExpression;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataFacadeQueryable.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Data.Linq;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Data.Caching;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal sealed class DataFacadeQueryable<T> : IQueryable<T>, IOrderedQueryable<T>, IDataFacadeQueryable, IQueryProvider\r\n    {\r\n        private readonly List<IQueryable> _sources;\r\n        private readonly Expression _currentExpression;\r\n        private readonly Expression _initialExpression;\r\n\r\n\r\n\r\n        public DataFacadeQueryable(IEnumerable<IQueryable<T>> sources)\r\n        {\r\n            Verify.ArgumentNotNull(sources, \"sources\");\r\n\r\n            _sources = new List<IQueryable>();\r\n            foreach (IQueryable<T> source in sources)\r\n            {\r\n                _sources.Add(source);\r\n            }\r\n\r\n            _initialExpression = Expression.Constant(this);\r\n            _currentExpression = _initialExpression;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Invoked via reflection\r\n        /// </summary>\r\n        public DataFacadeQueryable(List<IQueryable> sources, Expression currentExpression)\r\n        {\r\n            _sources = sources;\r\n            _currentExpression = currentExpression;\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<S> CreateQuery<S>(Expression expression)\r\n        {\r\n            Verify.ArgumentNotNull(expression, \"expression\");\r\n            Verify.ArgumentCondition(typeof(IQueryable<S>).IsAssignableFrom(expression.Type), \"expression\", \"Incorrect expression type\");\r\n\r\n            return new DataFacadeQueryable<S>(_sources, expression);\r\n        }\r\n\r\n\r\n\r\n        public S Execute<S>(Expression expression)\r\n        {\r\n            IQueryable source;\r\n            var newExpression = BuildSqlCompatibleExpression(expression, out source);\r\n\r\n            return (S)source.Provider.Execute(newExpression);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerator<T> GetEnumerator()\r\n        {\r\n            if(object.Equals(_currentExpression, _initialExpression))\r\n            {\r\n                if(_sources.Count == 1 && _sources[0] is IEnumerable<T>)\r\n                {\r\n                    return (_sources[0] as IEnumerable<T>).GetEnumerator();\r\n                }\r\n\r\n                if (_sources.Count == 0)\r\n                {\r\n                    return new List<T>().GetEnumerator();\r\n                }\r\n            }\r\n\r\n            IQueryable source;\r\n            var newExpression = BuildSqlCompatibleExpression(_currentExpression, out source);\r\n\r\n            IQueryable<T> queryable = (IQueryable<T>)source.Provider.CreateQuery(newExpression);\r\n\r\n            return queryable.GetEnumerator();\r\n        }\r\n\r\n\r\n        private static Expression BuildSqlCompatibleExpression(Expression expression, out IQueryable source)\r\n        {\r\n            bool pullIntoMemory = ShouldBePulledIntoMemory(expression);\r\n\r\n            var handleInProviderVisitor = new DataFacadeQueryableExpressionVisitor(pullIntoMemory);\r\n\r\n            var newExpression = handleInProviderVisitor.Visit(expression);\r\n\r\n            // Checking if the source contains queries both from SQL and Composite.Data.Caching.CachingQueryable in-memory queries. \r\n            // In this case, we can replace CachingQueryable instances with sql queries which allows building correct sql statements.\r\n            var analyzer = new QueryableAnalyzerVisitor();\r\n            analyzer.Visit(newExpression);\r\n\r\n            if (analyzer.CachedSqlQueries > 1\r\n               || (analyzer.SqlQueries > 0 && analyzer.CachedSqlQueries > 0))\r\n            {\r\n                newExpression = new CachedQueryExtractorVisitor().Visit(newExpression);\r\n                newExpression = handleInProviderVisitor.Visit(newExpression);\r\n            }\r\n\r\n            source = handleInProviderVisitor.Queryable;\r\n\r\n            return newExpression;\r\n        }\r\n\r\n\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            MethodInfo methodInfo = DataFacadeReflectionCache.GetDataFacadeQueryableGetEnumeratorMethodInfo(typeof(T));         \r\n\r\n            return (IEnumerator)methodInfo.Invoke(this, null);\r\n        }\r\n\r\n\r\n\r\n        public IQueryable CreateQuery(Expression expression)\r\n        {\r\n            if (_currentExpression == expression) return this;\r\n\r\n            Type elementType = TypeHelpers.FindElementType(expression);\r\n\r\n            Type multipleSourceQueryableType = typeof(DataFacadeQueryable<>).MakeGenericType(new Type[] { elementType });\r\n\r\n            return Activator.CreateInstance(\r\n                multipleSourceQueryableType,\r\n                new object[] { _sources, expression }) as IQueryable;\r\n        }\r\n\r\n\r\n\r\n        public Type ElementType => typeof(T);\r\n\r\n\r\n        public object Execute(Expression expression)\r\n        {\r\n            MethodInfo methodInfo = DataFacadeReflectionCache.GetDataFacadeQueryableExecuteMethodInfo(typeof(T), expression.Type);\r\n\r\n            return methodInfo.Invoke(this, new object[] { expression });\r\n        }\r\n\r\n\r\n\r\n        public Expression Expression => _currentExpression ?? Expression.Constant(this);\r\n\r\n\r\n        public ICollection<IQueryable> Sources => _sources;\r\n\r\n        public Type InterfaceType => typeof (T);\r\n\r\n\r\n        private static bool ShouldBePulledIntoMemory(Expression expression)\r\n        {\r\n            var analyzer = new QueryableAnalyzerVisitor();\r\n            analyzer.Visit(expression);\r\n\r\n            return analyzer.MethodsNotSupportedBySql > 0;\r\n        }\r\n\r\n\r\n        public bool IsEnumerableQuery\r\n        {\r\n            get\r\n            {\r\n                return _sources.All(source => (source as IQueryable<T>).IsEnumerableQuery());\r\n            }\r\n        }\r\n\r\n        public IQueryProvider Provider => this;\r\n\r\n\r\n        private class QueryableAnalyzerVisitor : ExpressionVisitor\r\n        {\r\n            public int SqlQueries { get; private set; }\r\n            public int CachedSqlQueries { get; private set; }\r\n            public int InMemoryQueries { get; private set; }\r\n            public int MethodsNotSupportedBySql { get; private set; }\r\n            public int Other { get; private set; }\r\n\r\n            protected override Expression VisitConstant(ConstantExpression node)\r\n            {\r\n                var value = node.Value;\r\n                if (value is IQueryable)\r\n                {\r\n                    if (value is ITable)\r\n                    {\r\n                        SqlQueries++;\r\n                    }\r\n                    else if (value is ICachedQuery)\r\n                    {\r\n                        CachedSqlQueries++;\r\n                    }\r\n                    else if (value is EnumerableQuery)\r\n                    {\r\n                        InMemoryQueries++;\r\n                    }\r\n                    else\r\n                    {\r\n                        Other++;\r\n                    }\r\n                }\r\n\r\n                return base.VisitConstant(node);\r\n            }\r\n\r\n            protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression)\r\n            {\r\n                // Checking for C# anonymous functions\r\n                if(methodCallExpression.Method.ReflectedType.FullName.Contains(\"+<>\"))\r\n                {\r\n                    MethodsNotSupportedBySql++;\r\n                }\r\n\r\n                return base.VisitMethodCall(methodCallExpression);\r\n            }\r\n        }\r\n\r\n        private class CachedQueryExtractorVisitor : ExpressionVisitor\r\n        {\r\n            protected override Expression VisitConstant(ConstantExpression node)\r\n            {\r\n                object value = node.Value;\r\n                if(value is ICachedQuery)\r\n                {\r\n                    IQueryable originalQuery = (value as ICachedQuery).GetOriginalQuery();\r\n\r\n                    return Expression.Constant(originalQuery);\r\n                }\r\n\r\n                return base.VisitConstant(node);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataFacadeQueryableExpressionVisitor.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Data.Linq;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    /// <summary>\r\n    /// Pulls queries into the memory if needed. Handles multiple source IQueryable-s\r\n    /// </summary>\r\n    internal sealed class DataFacadeQueryableExpressionVisitor : ExpressionVisitor\r\n    {\r\n        private static readonly MethodInfo _dataFacadeGetDataMethodInfo = typeof(DataFacade).GetMethods().First(x => x.Name == \"GetData\" && x.IsGenericMethod);\r\n        private static readonly MethodInfo _dataConnectionGetDataMethodInfo = typeof(DataConnection).GetMethods().First(x => x.Name == \"Get\" && x.IsGenericMethod);\r\n\r\n        private static readonly MethodInfo Queryable_Where = StaticReflection.GetGenericMethodInfo(() => System.Linq.Queryable.Where(null, (Expression<Func<int, bool>>)null));\r\n        private static readonly MethodInfo Queryable_Any = typeof(Queryable).GetMethods().Single(x => x.Name == \"Any\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n        private static readonly MethodInfo Queryable_All = typeof(Queryable).GetMethods().Single(x => x.Name == \"All\" && x.IsGenericMethod && x.GetParameters().Count() == 2);\r\n        private static readonly MethodInfo Queryable_Count = typeof(Queryable).GetMethods().Single(x => x.Name == \"Count\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n        private static readonly MethodInfo Queryable_FirstOrDefault = typeof(Queryable).GetMethods().Single(x => x.Name == \"FirstOrDefault\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n        private static readonly MethodInfo Queryable_SingleOrDefault = typeof(Queryable).GetMethods().Single(x => x.Name == \"SingleOrDefault\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n        private static readonly MethodInfo Queryable_Take = typeof(Queryable).GetMethods().Single(x => x.Name == \"Take\" && x.IsGenericMethod && x.GetParameters().Count() == 2);\r\n\r\n        private readonly bool _pullAllToMemory;\r\n        private IQueryable _queryable;\r\n\r\n\r\n\r\n        public DataFacadeQueryableExpressionVisitor(bool pullAllToMemeory)\r\n        {\r\n            _pullAllToMemory = pullAllToMemeory;\r\n        }\r\n\r\n\r\n\r\n        protected override Expression VisitConstant(ConstantExpression c)\r\n        {\r\n            if (c.Value is IDataFacadeQueryable)\r\n            {\r\n                IQueryable queryable = HandleMultipleSourceQueryable(c.Value);\r\n\r\n                return queryable.Expression;\r\n            }\r\n            \r\n            return base.VisitConstant(c);\r\n        }\r\n\r\n\r\n\r\n\r\n        protected override Expression VisitMember(MemberExpression m)\r\n        {\r\n            if (m.Member.DeclaringType.IsCompilerGeneratedType())\r\n            {\r\n                if (m.Member.MemberType == MemberTypes.Field)\r\n                {\r\n                    Type fieldType = ((FieldInfo)m.Member).FieldType;\r\n\r\n                    if ((fieldType.IsGenericType) &&\r\n                        (fieldType.GetGenericTypeDefinition() == typeof(IQueryable<>)) &&\r\n                        (m.Expression.NodeType == ExpressionType.Constant))\r\n                    {\r\n                        // Container for holding a IQueryable<TARGET_TYPE>\r\n\r\n                        ConstantExpression constatntExpression = (ConstantExpression)m.Expression;\r\n                        FieldInfo fieldInfo = (FieldInfo)m.Member;\r\n\r\n                        object value = fieldInfo.GetValue(constatntExpression.Value);\r\n\r\n                        IQueryable queryable = HandleMultipleSourceQueryable(value);\r\n\r\n                        if (queryable != null)\r\n                        {\r\n                            fieldInfo.SetValue(constatntExpression.Value, queryable);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            return base.VisitMember(m);\r\n        }\r\n\r\n\r\n\r\n        protected override Expression VisitMethodCall(MethodCallExpression m)\r\n        {\r\n            if (m.Method.DeclaringType == typeof (DataFacade))\r\n            {\r\n                if (m.Method.IsGenericMethod &&\r\n                    m.Method.GetGenericMethodDefinition() == _dataFacadeGetDataMethodInfo)\r\n                {\r\n                    object result = m.Method.Invoke(null, null);\r\n\r\n                    return Expression.Constant(result is IDataFacadeQueryable ? HandleMultipleSourceQueryable(result) : result);\r\n                }\r\n\r\n                // Handling some of the overloads of GetData()\r\n                if (m.Method.Name == _dataFacadeGetDataMethodInfo.Name && m.Arguments.All(arg => (arg as ConstantExpression) != null))\r\n                {\r\n                    object[] parameters = m.Arguments.Select(arg => (arg as ConstantExpression).Value).ToArray();\r\n\r\n                    object result = m.Method.Invoke(null, parameters);\r\n\r\n                    return Expression.Constant(result is IDataFacadeQueryable ? HandleMultipleSourceQueryable(result) : result);\r\n                }\r\n            \r\n                throw new NotSupportedException(\"Supporing for DataFacade method '{0}' or one of it's overloads not yet implemented\".FormatWith(m.Method.Name));\r\n            }\r\n\r\n            if (m.Method.DeclaringType == typeof (DataConnection))\r\n            {\r\n                if (m.Method.IsGenericMethod \r\n                    && m.Method.GetGenericMethodDefinition() == _dataConnectionGetDataMethodInfo)\r\n                {\r\n                    var dataConnection = EvaluateExpression<DataConnection>(m.Object);\r\n                    object result = m.Method.Invoke(dataConnection, null);\r\n\r\n                    return Expression.Constant(result is IDataFacadeQueryable ? HandleMultipleSourceQueryable(result) : result);\r\n                }\r\n\r\n                throw new NotSupportedException(\"Supporing for DataConnection method '{0}' or one of it's overloads not yet implemented\".FormatWith(m.Method.Name));\r\n            }\r\n\r\n            // Replacing Guid.NewGuid() call with \"newid()\" sql statement\r\n            if (m.Method.IsStatic && m.Method.DeclaringType == typeof(Guid) && m.Method.Name == \"NewGuid\"\r\n                && _queryable != null)\r\n            {\r\n                var dataContext = GetContext(_queryable) as DataContextBase;\r\n                if(dataContext != null)\r\n                {\r\n                    return Expression.Call(Expression.Constant(dataContext), DataContextBase.GetNewIdMethodInfo());\r\n                }\r\n            }\r\n\r\n            // Processing queries that have multiple IQueryable sources \r\n\r\n            // Processing queries like\r\n            //\r\n            // multipleSourceQueryable.METHOD()\r\n            // multipleSourceQueryable.METHOD(predicate)\r\n            // multipleSourceQueryable(.Where(predicate))*.METHOD()\r\n            // multipleSourceQueryable(.Where(predicate))*.METHOD(predicate)\r\n            //\r\n            // Where the supported METHOD options are: \"Where\", \"Any\", \"Count\", \"First\" and \"FirstOrDefault\"\r\n\r\n            IQueryable[] sources = null;\r\n            List<Expression> predicates = null;\r\n\r\n            if (m.Method.IsStatic\r\n                && (m.Method.Name == \"Where\"\r\n                    || m.Method.Name == \"Any\"\r\n                    || m.Method.Name == \"All\"\r\n                    || m.Method.Name == \"Count\"\r\n                    || m.Method.Name == \"First\"\r\n                    || m.Method.Name == \"FirstOrDefault\"\r\n                    || m.Method.Name == \"Single\"\r\n                    || m.Method.Name == \"SingleOrDefault\")\r\n                && (m.Arguments.Count == 1\r\n                    || (m.Arguments.Count == 2 \r\n                        && m.Arguments[1] is UnaryExpression))\r\n                && ExtractMultipleSourceQueryable(m.Arguments[0], ref sources, ref predicates))\r\n            {\r\n                Expression operationPredicate = m.Arguments.Count == 2 ? (m.Arguments[1] as UnaryExpression).Operand : null;\r\n\r\n                if (m.Method.Name == \"All\")\r\n                {\r\n                    _queryable = _queryable ?? new bool[0].AsQueryable(); \r\n\r\n                    return Expression.Constant(All(sources, predicates, operationPredicate));\r\n                }\r\n\r\n                if (operationPredicate != null)\r\n                {\r\n                    predicates.Add(operationPredicate);\r\n                }\r\n\r\n                if (m.Method.Name == \"Where\")\r\n                {\r\n                    IQueryable loadedSet = LoadToMemory(sources, predicates);\r\n\r\n                    _queryable = _queryable ?? loadedSet;\r\n\r\n                    return Expression.Constant(loadedSet);\r\n                }\r\n\r\n                _queryable = _queryable ?? new bool[0].AsQueryable();\r\n\r\n                if (m.Method.Name == \"Any\")\r\n                {\r\n                    return Expression.Constant(Any(sources, predicates));\r\n                }\r\n\r\n                if (m.Method.Name == \"Count\")\r\n                {\r\n                    return Expression.Constant(Count(sources, predicates));\r\n                }\r\n\r\n                if (m.Method.Name == \"First\")\r\n                {\r\n                    return Expression.Constant(First(sources, predicates));\r\n                }\r\n                \r\n                if (m.Method.Name == \"FirstOrDefault\")\r\n                {\r\n                    return Expression.Constant(FirstOrDefault(sources, predicates));\r\n                }\r\n\r\n                if (m.Method.Name == \"Single\")\r\n                {\r\n                    return Expression.Constant(Single(sources, predicates));\r\n                }\r\n\r\n                if (m.Method.Name == \"SingleOrDefault\")\r\n                {\r\n                    return Expression.Constant(SingleOrDefault(sources, predicates));\r\n                }\r\n                \r\n                throw new InvalidOperationException(\"This code should not be reachable. Current expression: \" + m);\r\n            }\r\n\r\n            // Processing queries like\r\n            //\r\n            // multipleSourceQueryable(.Where(predicate))*.Take(N)\r\n            if (m.Method.IsStatic\r\n                && m.Method.Name == \"Take\"\r\n                && (m.Arguments.Count == 2\r\n                    && m.Arguments[1] is ConstantExpression\r\n                    && (m.Arguments[1] as ConstantExpression).Value is int)\r\n                && ExtractMultipleSourceQueryable(m.Arguments[0], ref sources, ref predicates))\r\n            {\r\n                int count = (int) (m.Arguments[1] as ConstantExpression).Value;\r\n\r\n                var result = Take(sources, count, predicates);\r\n\r\n                _queryable = _queryable ?? result;\r\n\r\n                return Expression.Constant(result);\r\n            }\r\n\r\n            return base.VisitMethodCall(m);\r\n        }\r\n\r\n\r\n        private static DataContext GetContext(IQueryable q)\r\n        {\r\n            string typeName = q.GetType().FullName;\r\n\r\n            if (!typeName.StartsWith(\"System.Data.Linq.DataQuery`1\", StringComparison.Ordinal)\r\n                && !typeName.StartsWith(\"System.Data.Linq.Table`1\", StringComparison.Ordinal))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var field = q.GetType().GetField(\"context\", BindingFlags.NonPublic | BindingFlags.Instance);\r\n\r\n            return field == null ? null : field.GetValue(q) as DataContext;\r\n        }\r\n\r\n\r\n\r\n        private TResultType EvaluateExpression<TResultType>(Expression expression)\r\n        {\r\n            return Expression.Lambda<Func<TResultType>>(expression).Compile().Invoke();\r\n        }\r\n\r\n        public IQueryable Queryable\r\n        {\r\n            get { return _queryable; }\r\n        }\r\n\r\n\r\n        private static Type GetElementType(IQueryable[] sources)\r\n        {\r\n            // Choosing element type which is the \"highest\" in hierarhy. F.e. if we have IQueryable<IPage> and IQueryable<IData>, \r\n            // the \"highest\" element type would be IData\r\n            Type elementType = sources[0].ElementType;\r\n            for(int i=1; i<sources.Length; i++)\r\n            {\r\n                if(elementType != sources[i].ElementType && sources[i].ElementType.IsAssignableFrom(elementType))\r\n                {\r\n                    elementType = sources[i].ElementType;\r\n                }\r\n            }\r\n\r\n            return elementType;\r\n        }\r\n\r\n        private static bool Any(IQueryable[] sources, IEnumerable<Expression> predicates = null)\r\n        {\r\n            Type elementType = GetElementType(sources);\r\n\r\n            foreach (IQueryable query in sources)\r\n            {\r\n                IQueryable filteredQuery = ApplyPredicates(query, elementType, predicates);\r\n\r\n                bool any = (bool) Queryable_Any.MakeGenericMethod(elementType).Invoke(null, new object[] { filteredQuery });\r\n\r\n                if (any) return true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        private static bool All(IQueryable[] sources, IEnumerable<Expression> predicates, Expression operationPredicate)\r\n        {\r\n            Type elementType = GetElementType(sources);\r\n\r\n            foreach (IQueryable query in sources)\r\n            {\r\n                IQueryable filteredQuery = ApplyPredicates(query, elementType, predicates);\r\n\r\n                bool all = (bool)Queryable_All.MakeGenericMethod(elementType).Invoke(null, new object[] { filteredQuery, operationPredicate });\r\n\r\n                if (!all) return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        private static int Count(IQueryable[] sources, IEnumerable<Expression> predicates = null)\r\n        {\r\n            Type elementType = GetElementType(sources);\r\n\r\n            int result = 0;\r\n\r\n            foreach (IQueryable query in sources)\r\n            {\r\n                IQueryable filteredQuery = ApplyPredicates(query, elementType, predicates);\r\n\r\n                int count = (int) Queryable_Count.MakeGenericMethod(elementType).Invoke(null, new object[] { filteredQuery });\r\n\r\n                result += count;\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static object First(IQueryable[] sources, IEnumerable<Expression> predicates = null)\r\n        {\r\n            var result = FirstOrDefault(sources, predicates);\r\n\r\n            if (result == null)\r\n            {\r\n                string predicateInfo = predicates != null ? string.Join(\" ANDALSO \", predicates.Select(p => p.ToString())) : \"\";\r\n                throw new InvalidOperationException(\"Sequence contains no elements. \" + predicateInfo);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static object FirstOrDefault(IQueryable[] sources, IEnumerable<Expression> predicates = null)\r\n        {\r\n            Type elementType = GetElementType(sources);\r\n\r\n\r\n            foreach (IQueryable query in sources)\r\n            {\r\n                IQueryable filteredQuery = ApplyPredicates(query, elementType, predicates);\r\n\r\n                object result = Queryable_FirstOrDefault.MakeGenericMethod(elementType).Invoke(null, new object[] { filteredQuery });\r\n\r\n                // Result can't be value type, so null is always the default value\r\n                if (result != null)\r\n                {\r\n                    return result;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        private static object Single(IQueryable[] sources, IEnumerable<Expression> predicates = null)\r\n        {\r\n            var result = SingleOrDefault(sources, predicates);\r\n\r\n            if (result == null)\r\n            {\r\n                string predicateInfo = predicates != null ? string.Join(\" ANDALSO \", predicates.Select(p => p.ToString())) : \"\";\r\n                throw new InvalidOperationException(\"Sequence contains no elements. \" + predicateInfo);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static object SingleOrDefault(IQueryable[] sources, IEnumerable<Expression> predicates = null)\r\n        {\r\n            Type elementType = GetElementType(sources);\r\n\r\n            object result = null;\r\n\r\n            foreach (IQueryable query in sources)\r\n            {\r\n                IQueryable filteredQuery = ApplyPredicates(query, elementType, predicates);\r\n\r\n                object subqueryResult = Queryable_SingleOrDefault.MakeGenericMethod(elementType).Invoke(null, new object[] { filteredQuery });\r\n\r\n                if (subqueryResult != null)\r\n                {\r\n                    if (result != null)\r\n                    {\r\n                        string predicateInfo = predicates != null ? string.Join(\" ANDALSO \", predicates.Select(p => p.ToString())) : \"\";\r\n                        throw new InvalidOperationException(\"More than one value returned. \" + predicateInfo);\r\n                    }\r\n\r\n                    result = subqueryResult;\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        private static IQueryable Take(IQueryable[] sources, int count, IEnumerable<Expression> predicates = null)\r\n        {\r\n            Type elementType = GetElementType(sources);\r\n\r\n            MethodInfo addRangeToListMethodInfo = DataFacadeReflectionCache.List_AddRangeMethodInfo(elementType);\r\n\r\n            Type listType = typeof(List<>).MakeGenericType(elementType);\r\n            var List_Count = listType.GetProperty(\"Count\");\r\n            var list = Activator.CreateInstance(listType);\r\n\r\n            int taken = 0;\r\n\r\n            foreach (IQueryable query in sources)\r\n            {\r\n                IQueryable filteredQuery = ApplyPredicates(query, elementType, predicates);\r\n\r\n                int elementsToTake = count - taken;\r\n\r\n                var subList = Queryable_Take.MakeGenericMethod(elementType).Invoke(null, new object[] { filteredQuery, elementsToTake });\r\n\r\n                addRangeToListMethodInfo.Invoke(list, new object[] { subList });\r\n\r\n                taken = (int) List_Count.GetValue(list, null);\r\n\r\n                if(taken == count) break;\r\n            }\r\n\r\n            MethodInfo asQueryableMethodInfo = DataFacadeReflectionCache.Queryable_AsQueryableMethodInfo(elementType);\r\n\r\n            object listedDataAsQueryable = asQueryableMethodInfo.Invoke(null, new [] { list });\r\n\r\n            return (IQueryable)listedDataAsQueryable;\r\n        }\r\n\r\n        private static IQueryable LoadToMemory(IQueryable[] sources, IEnumerable<Expression> predicates = null)\r\n        {\r\n            Type elementType = GetElementType(sources);\r\n\r\n            return LoadToMemory(elementType, sources, predicates);\r\n        }\r\n\r\n        private static IQueryable LoadToMemory(Type elementType, IQueryable[] sources, IEnumerable<Expression> predicates = null)\r\n        {\r\n            MethodInfo addRangeToListMethodInfo = DataFacadeReflectionCache.List_AddRangeMethodInfo(elementType);\r\n            MethodInfo toListMethodInfo = DataFacadeReflectionCache.Enumerable_ToList(elementType);\r\n\r\n            IList list = DataFacadeReflectionCache.List_New(elementType);\r\n\r\n            foreach (IQueryable query in sources)\r\n            {\r\n                IQueryable filteredQuery = ApplyPredicates(query, elementType, predicates);\r\n\r\n                var subList = toListMethodInfo.Invoke(null, new object[] { filteredQuery });\r\n\r\n                addRangeToListMethodInfo.Invoke(list, new object[] { subList });\r\n            }\r\n\r\n            MethodInfo asQueryableMethodInfo = DataFacadeReflectionCache.Queryable_AsQueryableMethodInfo(elementType);\r\n\r\n            object listedDataAsQueryable = asQueryableMethodInfo.Invoke(null, new object[] { list });\r\n\r\n\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                if (list.Count > 500)\r\n                {\r\n                    Log.LogInformation(\"DataFacadeQuery\", list.Count + \" rows in a single query. Element type:\" + elementType.FullName);\r\n                }\r\n            }\r\n\r\n            return (IQueryable)listedDataAsQueryable;\r\n        }\r\n\r\n        private static IQueryable ApplyPredicates(IQueryable queryable, Type elementType,\r\n                                                  IEnumerable<Expression> predicates)\r\n        {\r\n            if (predicates != null)\r\n            {\r\n                foreach (var predicate in predicates)\r\n                {\r\n                    queryable = (IQueryable) Queryable_Where.MakeGenericMethod(elementType).Invoke(null, new object[] {queryable, predicate});\r\n                }\r\n            }\r\n\r\n            return queryable;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Extracts multiple source queryable with predicates defined in WHERE statements\r\n        /// </summary>\r\n        private static bool ExtractMultipleSourceQueryable(Expression expression, ref IQueryable[] sources, ref List<Expression> predicates)\r\n        {\r\n            if (expression is ConstantExpression)\r\n            {\r\n                var constantExpression = expression as ConstantExpression;\r\n\r\n                if (constantExpression.Value is IDataFacadeQueryable \r\n                    && (constantExpression.Value as IDataFacadeQueryable).Sources.Count() > 1)\r\n                {\r\n                    predicates = new List<Expression>();\r\n                    sources = (constantExpression.Value as IDataFacadeQueryable).Sources.ToArray();\r\n                    return true;\r\n                }\r\n                \r\n                return false;\r\n            }\r\n\r\n            if (expression is MethodCallExpression)\r\n            {\r\n                var methodCallExpression = (expression as MethodCallExpression);\r\n\r\n                if (methodCallExpression.Method.Name == \"Where\"\r\n                    && methodCallExpression.Arguments[1] is UnaryExpression\r\n                    && ExtractMultipleSourceQueryable(methodCallExpression.Arguments[0], ref sources, ref predicates))\r\n                {\r\n                    predicates.Add((methodCallExpression.Arguments[1] as UnaryExpression).Operand);\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        private IQueryable HandleMultipleSourceQueryable(object multipleSourceQueryableCandidate)\r\n        {\r\n            IDataFacadeQueryable multipleSourceQueryable = multipleSourceQueryableCandidate as IDataFacadeQueryable;\r\n\r\n            if (multipleSourceQueryable == null) return null;\r\n\r\n            IQueryable queryable;\r\n\r\n            if (!_pullAllToMemory && multipleSourceQueryable.Sources.Count == 1)\r\n            {\r\n                queryable = multipleSourceQueryable.Sources.First();\r\n            }\r\n            else\r\n            {\r\n                IQueryable[] sources = multipleSourceQueryable.Sources.ToArray();\r\n\r\n                queryable = LoadToMemory(multipleSourceQueryable.InterfaceType, sources);\r\n            }\r\n\r\n            if (_queryable == null)\r\n            {\r\n                _queryable = queryable;\r\n            }\r\n\r\n            return queryable;\r\n        }\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataFacadeQueryableGathererExpressionVisitor.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal sealed class DataFacadeQueryableGathererExpressionVisitor : ExpressionVisitor\r\n    {\r\n        private List<IDataFacadeQueryable> _multibleSourceQueryables = new List<IDataFacadeQueryable>();\r\n        private int _sourceCount = 0;\r\n\r\n        protected override Expression VisitConstant(ConstantExpression c)\r\n        {\r\n            if (c.Value is IDataFacadeQueryable)\r\n            {\r\n                IDataFacadeQueryable multibleSourceQueryable = (IDataFacadeQueryable)c.Value;\r\n\r\n                _sourceCount += multibleSourceQueryable.Sources.Count();\r\n\r\n                IDataFacadeQueryable found = _multibleSourceQueryables.Find(delegate(IDataFacadeQueryable queryable) { return object.ReferenceEquals(multibleSourceQueryable, queryable); });\r\n\r\n                if (found == null)\r\n                {\r\n                    _multibleSourceQueryables.Add(multibleSourceQueryable);\r\n                }\r\n            }\r\n\r\n            return base.VisitConstant(c);\r\n        }\r\n\r\n\r\n        public List<IDataFacadeQueryable> MultibleSourceQueryables\r\n        {\r\n            get { return _multibleSourceQueryables; }\r\n        }\r\n\r\n\r\n        public int SourceCount\r\n        {\r\n            get { return _sourceCount; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataFacadeReflectionCache.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal static class DataFacadeReflectionCache\r\n    {\r\n        private static Hashtable<Type, Type> _listTypeCache = new Hashtable<Type, Type>();\r\n        private static Hashtable<Type, MethodInfo> _addRangeToListMethodInfoCache = new Hashtable<Type, MethodInfo>();\r\n        private static Hashtable<Type, MethodInfo> _toListMethodInfo = new Hashtable<Type, MethodInfo>();\r\n        private static Hashtable<Type, MethodInfo> _asQueryableMethodInfo = new Hashtable<Type, MethodInfo>();\r\n        private static Hashtable<Type, Hashtable<Type, MethodInfo>> _dataFacadeQueryableExecuteMethodInfoCache = new Hashtable<Type, Hashtable<Type, MethodInfo>>();\r\n        private static Hashtable<Type, MethodInfo> _dataFacadeQueryableGetEnumeratorMethodInfoCache = new Hashtable<Type, MethodInfo>();\r\n        private static Hashtable<Type, MethodInfo> _createQueryMethodInfo = new Hashtable<Type, MethodInfo>();\r\n\r\n        private static readonly MethodInfo IQueryProvider_CreateQuery;\r\n        private static readonly MethodInfo Queryable_AsQueryable;\r\n        private static readonly object _lock = new object();\r\n\r\n\r\n        static DataFacadeReflectionCache()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n\r\n            IQueryProvider_CreateQuery = typeof (IQueryProvider).GetMethods().First(m => m.Name == \"CreateQuery\" && m.IsGenericMethod);\r\n            Queryable_AsQueryable = typeof (Queryable).GetMethods().First(m => m.Name == \"AsQueryable\" && m.IsGenericMethod);\r\n        }\r\n\r\n\r\n        private static Type List_GetType(Type type)\r\n        {\r\n            Type listType;\r\n\r\n            if (!_listTypeCache.TryGetValue(type, out listType))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_listTypeCache.TryGetValue(type, out listType))\r\n                    {\r\n                        listType = typeof(List<>);\r\n                        listType = listType.MakeGenericType(new Type[] { type });\r\n\r\n                        _listTypeCache.Add(type, listType);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return listType;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a new instance of List &lt;<paramref name=\"type\"/>&gt;\r\n        /// </summary>\r\n        public static IList List_New(Type type)\r\n        {\r\n            var listType = List_GetType(type);\r\n\r\n            return Activator.CreateInstance(listType) as IList;\r\n        }\r\n\r\n\r\n        public static MethodInfo List_AddRangeMethodInfo(Type type)\r\n        {\r\n            MethodInfo addRangeToListMethodInfo;\r\n\r\n            if (!_addRangeToListMethodInfoCache.TryGetValue(type, out addRangeToListMethodInfo))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_addRangeToListMethodInfoCache.TryGetValue(type, out addRangeToListMethodInfo))\r\n                    {\r\n                        Type listType = List_GetType(type);\r\n\r\n                        addRangeToListMethodInfo = listType.GetMethod(\"AddRange\");\r\n\r\n                        _addRangeToListMethodInfoCache.Add(type, addRangeToListMethodInfo);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return addRangeToListMethodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo Enumerable_ToList(Type type)\r\n        {\r\n            MethodInfo toListMethodInfo;\r\n\r\n            if (!_toListMethodInfo.TryGetValue(type, out toListMethodInfo))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_toListMethodInfo.TryGetValue(type, out toListMethodInfo))\r\n                    {\r\n                        toListMethodInfo = typeof (Enumerable).GetMethod(\"ToList\");\r\n                        toListMethodInfo = toListMethodInfo.MakeGenericMethod(new Type[] {type});\r\n\r\n                        _toListMethodInfo.Add(type, toListMethodInfo);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return toListMethodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo Queryable_AsQueryableMethodInfo(Type type)\r\n        {\r\n            MethodInfo asQueryableMethodInfo;\r\n\r\n            if (!_asQueryableMethodInfo.TryGetValue(type, out asQueryableMethodInfo))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_asQueryableMethodInfo.TryGetValue(type, out asQueryableMethodInfo))\r\n                    {\r\n                        asQueryableMethodInfo = Queryable_AsQueryable.MakeGenericMethod(new[] { type });\r\n\r\n                        _asQueryableMethodInfo.Add(type, asQueryableMethodInfo);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return asQueryableMethodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetDataFacadeQueryableExecuteMethodInfo(Type genericType, Type expressionType)\r\n        {\r\n            MethodInfo methodInfo;\r\n            Hashtable<Type, MethodInfo> methodInfoes;\r\n\r\n            if (!_dataFacadeQueryableExecuteMethodInfoCache.TryGetValue(genericType, out methodInfoes)\r\n                || !methodInfoes.TryGetValue(expressionType, out methodInfo))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_dataFacadeQueryableExecuteMethodInfoCache.TryGetValue(genericType, out methodInfoes))\r\n                    {\r\n                        methodInfoes = new Hashtable<Type, MethodInfo>();\r\n\r\n                        _dataFacadeQueryableExecuteMethodInfoCache.Add(genericType, methodInfoes);\r\n                    }\r\n\r\n                    if (!methodInfoes.TryGetValue(expressionType, out methodInfo))\r\n                    {\r\n                        Type type = typeof (DataFacadeQueryable<>).MakeGenericType(new Type[] {genericType});\r\n\r\n                        methodInfo = type.GetMethods().First(m => m.Name == \"Execute\" && m.IsGenericMethod);\r\n\r\n                        methodInfo = methodInfo.MakeGenericMethod(new Type[] {expressionType});\r\n\r\n                        methodInfoes.Add(expressionType, methodInfo);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetDataFacadeQueryableGetEnumeratorMethodInfo(Type genericType)\r\n        {\r\n            MethodInfo methodInfo;\r\n\r\n            if (!_dataFacadeQueryableGetEnumeratorMethodInfoCache.TryGetValue(genericType, out methodInfo))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_dataFacadeQueryableGetEnumeratorMethodInfoCache.TryGetValue(genericType, out methodInfo))\r\n                    {\r\n                        Type type = typeof (DataFacadeQueryable<>).MakeGenericType(new Type[] {genericType});\r\n\r\n                        methodInfo = type.GetMethods().First(m => m.Name == \"GetEnumerator\");\r\n\r\n                        _dataFacadeQueryableGetEnumeratorMethodInfoCache.Add(genericType, methodInfo);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetCreateQueryMethodInfo(Type genericType)\r\n        {\r\n            MethodInfo methodInfo;\r\n\r\n            if (!_createQueryMethodInfo.TryGetValue(genericType, out methodInfo))\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (!_createQueryMethodInfo.TryGetValue(genericType, out methodInfo))\r\n                    {\r\n                        methodInfo = IQueryProvider_CreateQuery.MakeGenericMethod(genericType);\r\n\r\n                        _createQueryMethodInfo.Add(genericType, methodInfo);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _listTypeCache = new Hashtable<Type, Type>();\r\n                _addRangeToListMethodInfoCache = new Hashtable<Type, MethodInfo>();\r\n                _toListMethodInfo = new Hashtable<Type, MethodInfo>();\r\n                _asQueryableMethodInfo = new Hashtable<Type, MethodInfo>();\r\n                _dataFacadeQueryableExecuteMethodInfoCache = new Hashtable<Type, Hashtable<Type, MethodInfo>>();\r\n                _dataFacadeQueryableGetEnumeratorMethodInfoCache = new Hashtable<Type, MethodInfo>();\r\n                _createQueryMethodInfo = new Hashtable<Type, MethodInfo>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataInterfaceAutoUpdater.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Application;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Core.Instrumentation;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal static class DataInterfaceAutoUpdater\r\n    {\r\n        private static readonly string LogTitle = typeof (DataInterfaceAutoUpdater).Name;\r\n\r\n        internal static bool EnsureUpdateAllInterfaces()\r\n        {\r\n            using (AppDomainLocker.NewLock())\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                bool doFlush = false;\r\n\r\n                var knownInterfaces = DataProviderRegistry.AllKnownInterfaces.ToList();\r\n\r\n                foreach (Type interfaceType in knownInterfaces)\r\n                {\r\n                    if (!interfaceType.IsAutoUpdateble())\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    foreach (string providerName in DataProviderRegistry.GetDataProviderNamesByInterfaceType(interfaceType))\r\n                    {\r\n                        try\r\n                        {\r\n                            if (DynamicTypeManager.EnsureUpdateStore(interfaceType, providerName, true))\r\n                            {\r\n                                doFlush = true;\r\n                            }\r\n                        }\r\n                        catch (TypeUpdateVersionException)\r\n                        {\r\n                            throw;\r\n                        }\r\n                        catch (TypeInitializationException tiex)\r\n                        {\r\n                            throw new InvalidOperationException(\"The data type meta stored did not initialize. Check configuration\", tiex);\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            Log.LogCritical(LogTitle, \"Update failed for the interface '{0}' on the '{1}' data provider\", interfaceType, providerName);\r\n                            Log.LogCritical(LogTitle, ex);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return doFlush;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void TestEnsureUpdateAllInterfaces()\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                foreach (Type interfaceType in DataProviderRegistry.AllInterfaces)\r\n                {\r\n                    if (!interfaceType.IsAutoUpdateble() || interfaceType.IsGenerated())\r\n                    {\r\n                        continue;\r\n                    }\r\n                    \r\n\r\n                    foreach (string providerName in DataProviderRegistry.GetDataProviderNamesByInterfaceType(interfaceType))\r\n                    {\r\n                        try\r\n                        {\r\n                            if (DynamicTypeManager.IsEnsureUpdateStoreNeeded(interfaceType))\r\n                            {\r\n                                Log.LogError(LogTitle, \"Autoupdating the data interface '{0}' on the '{1}' data provider failed!\", interfaceType, providerName);\r\n                            }\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            Log.LogCritical(LogTitle, \"Update failed for the interface '{0}' on the '{1}' data provider\", interfaceType, providerName);\r\n                            Log.LogCritical(LogTitle, ex);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataProviderRegistry.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    /// <summary>\r\n    /// This should only be used intern in the Composite.Data namespace!\r\n    /// </summary>\r\n    internal sealed class DataProviderRegistry\r\n    {\r\n        private static IDataProviderRegistry _dataProviderRegistry = new DataProviderRegistryImpl();\r\n\r\n\r\n\r\n        static DataProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        internal static IDataProviderRegistry Implementation { get { return _dataProviderRegistry; } set { _dataProviderRegistry = value; } }\r\n\r\n\r\n\r\n        public static string DefaultDynamicTypeDataProviderName\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _dataProviderRegistry.DefaultDynamicTypeDataProviderName;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Type> AllInterfaces\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _dataProviderRegistry.AllInterfaces;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This will include currently non-supported interfaces.\r\n        /// That is, interfaces that exists, but for some reason\r\n        /// does nok work as a data type.\r\n        /// </summary>\r\n        public static IEnumerable<Type> AllKnownInterfaces\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _dataProviderRegistry.AllKnownInterfaces;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Type> GeneratedInterfaces\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _dataProviderRegistry.GeneratedInterfaces;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> DataProviderNames\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _dataProviderRegistry.DataProviderNames;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> DynamicDataProviderNames\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    return _dataProviderRegistry.DynamicDataProviderNames;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static List<string> GetDataProviderNamesByInterfaceType(Type interfaceType)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                return _dataProviderRegistry.GetDataProviderNamesByInterfaceType(interfaceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static List<string> GetWriteableDataProviderNamesByInterfaceType(Type interfaceType)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                return _dataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(interfaceType);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// This method adds a new supported data type to the registry.\r\n        /// This should be used if a data provider has extended the\r\n        /// number of supported interfaces at runtime.\r\n        /// </summary>\r\n        /// <param name=\"interaceType\"></param>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <param name=\"isWritableProvider\"></param>\r\n        public static void AddNewDataType(Type interaceType, string providerName, bool isWritableProvider = true)\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                _dataProviderRegistry.AddNewDataType(interaceType, providerName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void AddKnownDataType(Type interaceType, string providerName)\r\n        {\r\n            _dataProviderRegistry.AddKnownDataType(interaceType, providerName);\r\n        }\r\n\r\n        public static void UnregisterDataType(Type interfaceType, string providerName)\r\n        {\r\n            _dataProviderRegistry.UnregisterDataType(interfaceType, providerName);\r\n        }\r\n\r\n\r\n        public static void RegisterDataTypeInitializationError(Type interfaceType, Exception exception)\r\n        {\r\n            _dataProviderRegistry.RegisterDataTypeInitializationError(interfaceType, exception);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Checks whether the data store for the specified data type was created without errors.\r\n        /// If any errors occurred, an exception will be thrown.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The interface type</param>\r\n        public static void CheckInitializationErrors(Type interfaceType)\r\n        {\r\n            _dataProviderRegistry.CheckInitializationErrors(interfaceType);\r\n        }\r\n\r\n\r\n        internal static void InitializeDataTypes()\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                GlobalInitializerFacade.ValidateIsOnlyCalledFromGlobalInitializerFacade(new StackTrace());\r\n            }\r\n\r\n            _dataProviderRegistry.InitializeDataTypes();\r\n        }\r\n\r\n\r\n\r\n        public static void Flush()\r\n        {\r\n            _dataProviderRegistry.Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataProviderRegistryImpl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Data.Plugins.DataProvider.Runtime;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal sealed class DataProviderRegistryImpl : IDataProviderRegistry\r\n    {\r\n        private string _defaultDynamicTypeDataProviderName;\r\n        private List<string> _dataProviderNames;\r\n        private Dictionary<Type, List<string>> _interfaceTypeToReadableProviderNames;\r\n        private Dictionary<Type, List<string>> _interfaceTypeToWriteableProviderNames;\r\n        private Dictionary<Type, List<string>> _knownInterfaceTypeToDynamicProviderNames;\r\n        private List<Type> _generatedInterfaceTypes;\r\n\r\n        private Hashtable<Type, Exception> _initializationErrors;\r\n\r\n\r\n        public string DefaultDynamicTypeDataProviderName\r\n        {\r\n            get\r\n            {\r\n                if (_defaultDynamicTypeDataProviderName == null || !_dataProviderNames.Contains(_defaultDynamicTypeDataProviderName))\r\n                {\r\n                    throw new InvalidOperationException(\"Failed to locate the default provider name for dynamic types. Please check the configuration.\");\r\n                }\r\n\r\n                return _defaultDynamicTypeDataProviderName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> AllInterfaces\r\n        {\r\n            get\r\n            {\r\n                return _interfaceTypeToReadableProviderNames.Keys.ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> AllKnownInterfaces\r\n        {\r\n            get\r\n            {\r\n                return _interfaceTypeToReadableProviderNames.Keys.\r\n                                Concat(_knownInterfaceTypeToDynamicProviderNames.Keys).\r\n                                ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> GeneratedInterfaces\r\n        {\r\n            get\r\n            {\r\n                return _generatedInterfaceTypes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> DataProviderNames\r\n        {\r\n            get\r\n            {\r\n                return _dataProviderNames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> DynamicDataProviderNames\r\n        {\r\n            get\r\n            {\r\n                return DataProviderRegistry.DataProviderNames.Where(DataProviderPluginFacade.IsDynamicProvider);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public List<string> GetDataProviderNamesByInterfaceType(Type interfaceType)\r\n        {\r\n            List<string> providerNames = new List<string>();\r\n\r\n            if (_interfaceTypeToReadableProviderNames.ContainsKey(interfaceType))\r\n            {\r\n                providerNames.AddRange(_interfaceTypeToReadableProviderNames[interfaceType]);\r\n            }\r\n            else if (_knownInterfaceTypeToDynamicProviderNames.ContainsKey(interfaceType))\r\n            {\r\n                providerNames.AddRange(_knownInterfaceTypeToDynamicProviderNames[interfaceType]);\r\n            }\r\n\r\n            return providerNames;\r\n        }\r\n\r\n\r\n\r\n        public List<string> GetWriteableDataProviderNamesByInterfaceType(Type interfaceType)\r\n        {\r\n            if (!_interfaceTypeToWriteableProviderNames.ContainsKey(interfaceType))\r\n            {\r\n                return new List<string>();\r\n            }\r\n            \r\n            return _interfaceTypeToWriteableProviderNames[interfaceType];\r\n        }\r\n\r\n\r\n        public void AddNewDataType(Type interaceType, string providerName, bool isWritableProvider = true)\r\n        {\r\n            AddType(interaceType, providerName, isWritableProvider);\r\n        }\r\n\r\n\r\n\r\n        public void AddKnownDataType(Type interaceType, string providerName)\r\n        {\r\n            List<string> providers;\r\n            if (!_knownInterfaceTypeToDynamicProviderNames.TryGetValue(interaceType, out providers))\r\n            {\r\n                providers = new List<string>();\r\n                _knownInterfaceTypeToDynamicProviderNames.Add(interaceType, providers);\r\n            }\r\n\r\n            providers.Add(providerName);\r\n        }\r\n\r\n        public void UnregisterDataType(Type interfaceType, string providerName)\r\n        {\r\n            List<string> providerNames;\r\n            if (!_interfaceTypeToReadableProviderNames.TryGetValue(interfaceType, out providerNames))\r\n            {\r\n                return;\r\n            }\r\n\r\n            providerNames.Remove(providerName);\r\n        }\r\n\r\n\r\n        public void RegisterDataTypeInitializationError(Type interfaceType, Exception exception)\r\n        {\r\n            _initializationErrors[interfaceType] = exception;\r\n        }\r\n\r\n        public void CheckInitializationErrors(Type interfaceType)\r\n        {\r\n            if (_initializationErrors.ContainsKey(interfaceType))\r\n            {\r\n                var ex = _initializationErrors[interfaceType];\r\n                throw new InvalidOperationException(\"Failed to initialize data type '{0}'\".FormatWith(interfaceType.FullName), ex);\r\n            }\r\n        }\r\n\r\n        public void InitializeDataTypes()\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                _dataProviderNames = new List<string>();\r\n                _interfaceTypeToReadableProviderNames = new Dictionary<Type, List<string>>();\r\n                _interfaceTypeToWriteableProviderNames = new Dictionary<Type, List<string>>();\r\n                _knownInterfaceTypeToDynamicProviderNames = new Dictionary<Type, List<string>>();\r\n                _initializationErrors = new Hashtable<Type, Exception>();\r\n                _generatedInterfaceTypes = new List<Type>();\r\n\r\n                if (DataProviderPluginFacade.HasConfiguration())\r\n                {\r\n                    BuildDataProviderNames();\r\n                    BuildDictionaries();\r\n                }\r\n                else if (RuntimeInformation.IsDebugBuild)\r\n                {\r\n                    Log.LogError(\"DataProviderRegistry\", string.Format(\"Failed to load the configuration section '{0}' from the configuration\", DataProviderSettings.SectionName));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _defaultDynamicTypeDataProviderName = null;\r\n            _dataProviderNames = null;\r\n            _interfaceTypeToReadableProviderNames = null;\r\n            _interfaceTypeToWriteableProviderNames = null;\r\n            _knownInterfaceTypeToDynamicProviderNames = null;\r\n            _generatedInterfaceTypes = null;\r\n        }\r\n\r\n\r\n\r\n        private void AddType(Type typeToAdd, string providerName, bool writeableProvider)\r\n        {\r\n            Verify.That(typeToAdd.IsInterface, \"The data provider {0} returned an non-interface ({1})\", providerName, typeToAdd);\r\n            Verify.That(typeof(IData).IsAssignableFrom(typeToAdd), \"The data provider {0} returned an non IData interface ({1})\", providerName, typeToAdd);\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                List<DataScopeIdentifier> supportedDataScopes = typeToAdd.GetSupportedDataScopes().ToList();\r\n\r\n                if (supportedDataScopes.Count == 0)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"The data provider {0} returned an IData interface ({1}) with no data scopes defined. Use the {2} attribute to define scopes.\", providerName, typeToAdd, typeof(DataScopeAttribute)));\r\n                }\r\n\r\n                foreach (PropertyInfo propertyInfo in typeToAdd.GetPropertiesRecursively())\r\n                {\r\n                    bool containsBadAttribute = propertyInfo.GetCustomAttributesRecursively<Microsoft.Practices.EnterpriseLibrary.Validation.Validators.StringLengthValidatorAttribute>().Any();\r\n                    if (!containsBadAttribute) continue;\r\n\r\n#pragma warning disable 0612\r\n                    Log.LogWarning(\"DataProviderRegistry\", string.Format(\"The property named '{0}' on the type '{1}' has an attribute of type '{2}' wich is not supported, use '{3}'\", typeToAdd, propertyInfo.Name, typeof(Microsoft.Practices.EnterpriseLibrary.Validation.Validators.StringLengthValidatorAttribute), typeof(Composite.Data.Validation.Validators.StringLengthValidatorAttribute)));\r\n#pragma warning restore 0612\r\n                }\r\n\r\n                var readableList = _interfaceTypeToReadableProviderNames.GetOrAdd(typeToAdd, () => new List<string>());\r\n                if (!readableList.Contains(providerName))\r\n                {\r\n                    readableList.Add(providerName);\r\n                }\r\n\r\n\r\n                if (writeableProvider)\r\n                {\r\n                    var writableList = _interfaceTypeToWriteableProviderNames.GetOrAdd(typeToAdd, () => new List<string>());\r\n                    if (!writableList.Contains(providerName))\r\n                    {\r\n                        writableList.Add(providerName);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void BuildDataProviderNames()\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                var dataProviderSettings = ConfigurationServices.ConfigurationSource.GetSection(DataProviderSettings.SectionName) as DataProviderSettings;\r\n\r\n                _defaultDynamicTypeDataProviderName = dataProviderSettings.DefaultDynamicTypeDataProviderName;\r\n\r\n                foreach (DataProviderData data in dataProviderSettings.DataProviderPlugins)\r\n                {\r\n                    _dataProviderNames.Add(data.Name);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private void BuildDictionaries()\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler(\"Adding supported types\"))\r\n            {\r\n                foreach (string providerName in _dataProviderNames)\r\n                {\r\n                    IEnumerable<Type> types = DataProviderPluginFacade.GetSupportedInterfaces(providerName);\r\n\r\n                    bool writeableProvider = DataProviderPluginFacade.IsWriteableProvider(providerName);\r\n\r\n                    foreach (Type type in types)\r\n                    {\r\n                        AddType(type, providerName, writeableProvider);\r\n                    }\r\n\r\n\r\n                    if (DataProviderPluginFacade.IsGeneratedTypesProvider(providerName))\r\n                    {\r\n                        IEnumerable<Type> generatedTypes = DataProviderPluginFacade.GetGeneratedInterfaces(providerName);\r\n\r\n                        foreach (Type type in generatedTypes)\r\n                        {\r\n                            AddType(type, providerName, writeableProvider);\r\n\r\n                            if (!_generatedInterfaceTypes.Contains(type))\r\n                            {\r\n                                _generatedInterfaceTypes.Add(type);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler(\"Adding known interfaces\"))\r\n            {\r\n                foreach (string providerName in _dataProviderNames)\r\n                {\r\n                    if (DataProviderPluginFacade.IsDynamicProvider(providerName))\r\n                    {\r\n                        IEnumerable<Type> knownTypes = DataProviderPluginFacade.GetKnownInterfaces(providerName);\r\n\r\n                        foreach (Type knownType in knownTypes)\r\n                        {\r\n                            if (!_interfaceTypeToReadableProviderNames.Keys.Contains(knownType))\r\n                            {\r\n                                List<string> providerNames;\r\n\r\n                                if (!_knownInterfaceTypeToDynamicProviderNames.TryGetValue(knownType, out providerNames))\r\n                                {\r\n                                    providerNames = new List<string>();\r\n\r\n                                    _knownInterfaceTypeToDynamicProviderNames.Add(knownType, providerNames);\r\n\r\n                                    if (RuntimeInformation.IsDebugBuild)\r\n                                    {\r\n                                        Log.LogVerbose(\"DataProviderRegistry\", \"Adding known IData interface: {0}\", knownType);\r\n                                    }\r\n                                }\r\n\r\n                                providerNames.Add(providerName);\r\n                            }\r\n                        }\r\n                    }                    \r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataReferenceRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\n\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal static class DataReferenceRegistry\r\n    {\r\n        private static readonly string LogTitle = \"DataReferenceRegistry\";\r\n\r\n        private static Dictionary<Type, List<Type>> _referencedToReferees = new Dictionary<Type, List<Type>>();\r\n        private static Dictionary<Type, IReadOnlyList<ForeignPropertyInfo>> _foreignKeyProperties = new Dictionary<Type, IReadOnlyList<ForeignPropertyInfo>>();\r\n\r\n\r\n\r\n        static DataReferenceRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static IReadOnlyCollection<Type> GetRefereeTypes(Type referencedType)\r\n        {\r\n            Verify.ArgumentNotNull(referencedType, \"referencedType\");\r\n\r\n            List<Type> refereeTypes = new List<Type>();\r\n\r\n            // TODO: rewrite using concurrent dictionaries\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                foreach (var key in _referencedToReferees.Keys)\r\n                {\r\n                    if (referencedType.IsAssignableFrom(key))\r\n                    {\r\n                        _referencedToReferees[key].ForEach(refereeTypes.Add);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return refereeTypes;\r\n        }\r\n\r\n        [Obsolete(\"Use 'GetForeignKeyProperties' instead\")]\r\n        public static List<ForeignPropertyInfo> GetForeignKeyPropertyInfos(Type refereeType)\r\n        {\r\n            return GetForeignKeyProperties(refereeType).ToList();\r\n        }\r\n\r\n        public static IReadOnlyCollection<ForeignPropertyInfo> GetForeignKeyProperties(Type refereeType)\r\n        {\r\n            Verify.ArgumentNotNull(refereeType, \"refereeType\");\r\n\r\n            IReadOnlyList<ForeignPropertyInfo> foreignKeyProperties;\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                if (!_foreignKeyProperties.TryGetValue(refereeType, out foreignKeyProperties))\r\n                {\r\n                    return Array.Empty<ForeignPropertyInfo>();\r\n                }\r\n            }\r\n\r\n            return foreignKeyProperties;\r\n        }\r\n\r\n\r\n\r\n        internal static void Initialize_PostDataTypes()\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                GlobalInitializerFacade.ValidateIsOnlyCalledFromGlobalInitializerFacade(new StackTrace());\r\n            }\r\n\r\n            _referencedToReferees = new Dictionary<Type, List<Type>>();\r\n            _foreignKeyProperties = new Dictionary<Type, IReadOnlyList<ForeignPropertyInfo>>();\r\n\r\n            foreach (Type type in DataProviderRegistry.AllInterfaces)\r\n            {\r\n                AddNewType(type);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddNewType(Type interfaceType)\r\n        {\r\n            var foreignKeyProperties = DataAttributeFacade.GetDataReferenceProperties(interfaceType);\r\n            \r\n            foreach (ForeignPropertyInfo foreignKeyPropertyInfo in foreignKeyProperties)\r\n            {\r\n                if (!foreignKeyPropertyInfo.SourcePropertyInfo.CanRead) throw new InvalidOperationException(\r\n                    $\"The property '{foreignKeyPropertyInfo.SourcePropertyInfo}' shoud have a getter\");\r\n                if (foreignKeyPropertyInfo.TargetType.IsNotReferenceable()) throw new InvalidOperationException(\r\n                    $\"The referenced type '{foreignKeyPropertyInfo.TargetType}' is marked NotReferenceable and can not be referenced by the interfaceType '{interfaceType}'\");\r\n\r\n                PropertyInfo propertyInfo = foreignKeyPropertyInfo.TargetType.GetDataPropertyRecursively(foreignKeyPropertyInfo.TargetKeyPropertyName);\r\n\r\n                Verify.IsNotNull(propertyInfo, \"The data type '{0}' does not contain a property named '{1}' as specified by the '{2}' attribute on the data type '{3}'\", foreignKeyPropertyInfo.TargetType, foreignKeyPropertyInfo.TargetKeyPropertyName, typeof(ForeignKeyAttribute), foreignKeyPropertyInfo.SourcePropertyInfo.DeclaringType);\r\n                Verify.That(propertyInfo.CanRead, \"The property '{0}' should have a getter\", propertyInfo);\r\n                if (foreignKeyPropertyInfo.IsNullableString && (propertyInfo.PropertyType != typeof(string))) throw new InvalidOperationException(\"NullableString can only be used when the foreign key is of type string\");\r\n\r\n                Type sourcePropertyType = foreignKeyPropertyInfo.SourcePropertyInfo.PropertyType;\r\n                if (sourcePropertyType.IsGenericType &&\r\n                    (sourcePropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)))\r\n                {\r\n                    // Handling og Nullable<>\r\n                    sourcePropertyType = sourcePropertyType.GetGenericArguments()[0];\r\n                }\r\n\r\n                if (propertyInfo.PropertyType != sourcePropertyType) throw new InvalidOperationException(\r\n                    $\"Type mismatch '{propertyInfo.PropertyType}' and '{foreignKeyPropertyInfo.SourcePropertyInfo.PropertyType}' does not match from the two properties '{propertyInfo}' and '{foreignKeyPropertyInfo.SourcePropertyInfo}'\");\r\n                \r\n                foreignKeyPropertyInfo.TargetKeyPropertyInfo = propertyInfo;\r\n            }\r\n\r\n\r\n            _foreignKeyProperties.Add(interfaceType, foreignKeyProperties);\r\n\r\n            foreach (ForeignPropertyInfo foreignKeyPropertyInfo in foreignKeyProperties)\r\n            {\r\n                List<Type> referees;\r\n\r\n                if (!_referencedToReferees.TryGetValue(foreignKeyPropertyInfo.TargetType, out referees))\r\n                {\r\n                    referees = new List<Type>();\r\n\r\n                    _referencedToReferees.Add(foreignKeyPropertyInfo.TargetType, referees);\r\n                } \r\n                else\r\n                {\r\n                    if(referees.Contains(interfaceType))\r\n                    {\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                referees.Add(interfaceType);\r\n\r\n                if (!DataProviderRegistry.AllInterfaces.Contains(foreignKeyPropertyInfo.TargetType))\r\n                {\r\n                    Log.LogCritical(LogTitle, $\"The one type '{interfaceType}' is referring the non supported data type '{foreignKeyPropertyInfo.TargetType}'\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _referencedToReferees = new Dictionary<Type, List<Type>>();\r\n            _foreignKeyProperties = new Dictionary<Type, IReadOnlyList<ForeignPropertyInfo>>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataStoreExistenceVerifier.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal static class DataStoreExistenceVerifier\r\n    {\r\n        private static IDataStoreExistenceVerifier _dataStoreExistenceVerifier = new DataStoreExistenceVerifierImpl();\r\n\r\n\r\n        internal static IDataStoreExistenceVerifier Implementation { get { return _dataStoreExistenceVerifier; } set { _dataStoreExistenceVerifier = value; } }\r\n\r\n\r\n\r\n        public static IEnumerable<Type> InterfaceTypes\r\n        {\r\n            get\r\n            {\r\n                return _dataStoreExistenceVerifier.InterfaceTypes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static bool EnsureDataStores()\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                GlobalInitializerFacade.ValidateIsOnlyCalledFromGlobalInitializerFacade(new StackTrace());\r\n            }\r\n\r\n            return _dataStoreExistenceVerifier.EnsureDataStores();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataStoreExistenceVerifierImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.Data.Plugins.DataProvider.Runtime;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.WebClient.SessionStateProviders.DefaultSessionStateProvider;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{   \r\n    internal sealed class DataStoreExistenceVerifierImpl : IDataStoreExistenceVerifier\r\n    {\r\n        private const string LogTitle = \"DataStoreExistenceVerifier\";\r\n\r\n        // Interfaces in this list will have a store created on system start if they do not exists\r\n        private static readonly List<Type> _interfaceTypes = new List<Type>\r\n                {\r\n                    typeof(ICompositionContainer),\r\n                    typeof(ICustomFunctionCallEditorMapping),\r\n                    typeof(IDataItemTreeAttachmentPoint),\r\n                    typeof(IFlowInformation),\r\n                    typeof(IFolderWhiteList),\r\n                    typeof(IGeneratedTypeWhiteList),\r\n                    typeof(IHostnameBinding),\r\n                    typeof(IInlineFunction),\r\n                    typeof(IInlineFunctionAssemblyReference),\r\n                    typeof(ILockingInformation),\r\n                    typeof(IMediaFile),\r\n                    typeof(IMediaFileData),\r\n                    typeof(IMediaFileFolder),\r\n                    typeof(IMediaFolderData),\r\n                    typeof(IMethodBasedFunctionInfo),\r\n                    typeof(INamedFunctionCall),\r\n                    typeof(IPackageServerSource),\r\n                    typeof(IPage),\r\n                    typeof(IPageFolderDefinition),\r\n                    typeof(IPageMetaDataDefinition),\r\n                    typeof(IPagePlaceholderContent),\r\n                    typeof(IPageStructure),\r\n                    typeof(IXmlPageTemplate),\r\n                    typeof(IPageType),\r\n                    typeof(IPageTypeDataFolderTypeLink),\r\n                    typeof(IPageTypeDefaultPageContent),\r\n                    typeof(IPageTypeMetaDataTypeLink),\r\n                    typeof(IPageTypePageTemplateRestriction),\r\n                    typeof(IPageTypeParentRestriction),\r\n                    typeof(IPageTypeTreeLink),\r\n                    typeof(IPublishSchedule),\r\n                    typeof(IUnpublishSchedule),                    \r\n                    typeof(IParameter),\r\n                    typeof(ISearchEngineOptimizationKeyword),\r\n                    typeof(ISessionStateEntry),\r\n                    typeof(ISqlConnection),\r\n                    typeof(ISqlFunctionInfo),\r\n                    typeof(ISystemActiveLocale),\r\n                    typeof(ITaskItem),\r\n                    typeof(IUrlConfiguration),\r\n                    typeof(IUser),\r\n                    typeof(IUserPasswordHistory),\r\n                    typeof(IUserActiveLocale),\r\n                    typeof(IUserActivePerspective),\r\n                    typeof(IUserConsoleInformation),\r\n                    typeof(IUserDeveloperSettings),\r\n                    typeof(IUserFormLogin),\r\n                    typeof(IUserGroup),\r\n                    typeof(IUserGroupActiveLocale),\r\n                    typeof(IUserGroupActivePerspective),\r\n                    typeof(IUserGroupPermissionDefinition),\r\n                    typeof(IUserGroupPermissionDefinitionPermissionType),\r\n                    typeof(IUserPermissionDefinition),\r\n                    typeof(IUserPermissionDefinitionPermissionType),\r\n                    typeof(IUserSettings),\r\n                    typeof(IUserUserGroupRelation),\r\n                    typeof(IVisualFunction),\r\n                    typeof(IXsltFunction)\r\n                };        \r\n\r\n\r\n        public IEnumerable<Type> InterfaceTypes\r\n        {\r\n            get { return _interfaceTypes; }\r\n        }\r\n\r\n\r\n\r\n        public bool EnsureDataStores()\r\n        {\r\n            if (!DataProviderPluginFacade.HasConfiguration())\r\n            {\r\n                Log.LogError(LogTitle, \"Failed to load the configuration section '{0}' from the configuration\", DataProviderSettings.SectionName);\r\n                return false;\r\n            }\r\n\r\n            var typeDescriptors = new List<DataTypeDescriptor>();\r\n\r\n            foreach (Type type in _interfaceTypes)\r\n            {\r\n                try\r\n                {\r\n                    if (!DataProviderRegistry.AllKnownInterfaces.Contains(type))\r\n                    {\r\n                        var dataTypeDescriptor = DynamicTypeManager.BuildNewDataTypeDescriptor(type);\r\n\r\n                        dataTypeDescriptor.Validate();\r\n\r\n                        typeDescriptors.Add(dataTypeDescriptor);\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Failed to validate type '{0}'\", type), ex);\r\n                }\r\n            }\r\n\r\n            if (typeDescriptors.Any())\r\n            {\r\n                DataProviderPluginFacade.CreateStores(DataProviderRegistry.DefaultDynamicTypeDataProviderName, typeDescriptors);\r\n\r\n                string typeNames = string.Join(\", \", typeDescriptors.Select(t => t.GetFullInterfaceName()));\r\n                Log.LogVerbose(LogTitle, \"Stores for the following data types were created: \" + typeNames);\r\n            }\r\n\r\n            return typeDescriptors.Count > 0;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/DataWrappingFacade.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Foundation.CodeGeneration;\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    /// <summary>    \r\n    /// Wraps data object, so changes to the original object won't be applied until the object is saved. Used for wrapping cached data.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class DataWrappingFacade\r\n    {\r\n        /// <exclude />\r\n\t    public static T Wrap<T>(T value) where T: class, IData\r\n        {\r\n            if (value is IDataWrapper) return value;\r\n\r\n            Type wrapperType = WrapperSingleton<T>.WrapperType;\r\n\r\n            return (T)Activator.CreateInstance(wrapperType, new object[] { value });\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static T UnWrap<T>(T value) where T: class, IData\r\n        {\r\n            while (value is IDataWrapper)\r\n            {\r\n                var wrappedItem = value as IDataWrapper;\r\n                wrappedItem.CommitData();\r\n                value = (T)wrappedItem.WrappedData;\r\n            }\r\n            return value;\r\n        }\r\n\r\n        private static class WrapperSingleton<T>\r\n        {\r\n            private static readonly Type _wrapperType;\r\n\r\n            static WrapperSingleton()\r\n            {\r\n                _wrapperType = DataWrapperTypeManager.GetDataWrapperType(typeof(T));\r\n            }\r\n\r\n            public static Type WrapperType { get { return _wrapperType; } }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/EmptyDataClassTypeManager.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation.CodeGeneration;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    /// <summary>\r\n    /// This class caches and if needed creates data empty classes runtime.\r\n    /// </summary>\r\n    internal static class EmptyDataClassTypeManager\r\n    {\r\n        private static readonly object _lock = new object();\r\n        private static readonly ResourceLocker<Resources> ResourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n        static EmptyDataClassTypeManager()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will return the type of the empty data class type.\r\n        /// If the type does not exist, one will be runtime code generated\r\n        /// using the type to get a data type descriptor.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The data interface type to get the empty class type for.</param>\r\n        /// <param name=\"forceReCompilation\">\r\n        /// If this is true a new empty class will be \r\n        /// compiled at runtime regardless if it exists or not.\r\n        /// Use with caution!\r\n        /// </param>\r\n        /// <returns>The empty class type for the given data interface type.</returns>\r\n        public static Type GetEmptyDataClassType(Type interfaceType, bool forceReCompilation = false)\r\n        {\r\n            VerifyAssemblyLocation(interfaceType);\r\n\r\n            var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(interfaceType, true);\r\n\r\n            return GetEmptyDataClassType(dataTypeDescriptor, forceReCompilation);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will return the type of the empty data class type.\r\n        /// If the type does not exist, one will be runtime code generated\r\n        /// using the <paramref name=\"dataTypeDescriptor\"/>. \r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\">\r\n        /// The data type descriptor for the data type to get \r\n        /// the empty class type for.\r\n        /// </param>\r\n        /// <param name=\"forceReCompilation\">\r\n        /// If this is true a new empty class will be \r\n        /// compiled at runtime regardless if it exists or not.\r\n        /// Use with caution!\r\n        /// </param>\r\n        /// <returns>The empty class type for the given data interface type.</returns>\r\n        public static Type GetEmptyDataClassType(DataTypeDescriptor dataTypeDescriptor, bool forceReCompilation = false)\r\n        {\r\n            if (!string.IsNullOrEmpty(dataTypeDescriptor.BuildNewHandlerTypeName))\r\n            {\r\n                return GetEmptyClassFromBuildNewHandler(dataTypeDescriptor);\r\n            }\r\n\r\n\r\n            if (forceReCompilation)\r\n            {\r\n                return CreateEmptyDataClassType(dataTypeDescriptor);\r\n            }\r\n\r\n            Type interfaceType = TypeManager.TryGetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            string emptyClassFullName = EmptyDataClassCodeGenerator.GetEmptyClassTypeFullName(dataTypeDescriptor);\r\n            Type emptyClassType = TypeManager.TryGetType(emptyClassFullName);\r\n\r\n            bool isRecompileNeeded = true;\r\n            if (interfaceType != null)\r\n            {\r\n                isRecompileNeeded = CodeGenerationManager.IsRecompileNeeded(interfaceType, new[] { emptyClassType });\r\n            }\r\n\r\n            if (isRecompileNeeded)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    interfaceType = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());\r\n                    emptyClassType = TypeManager.TryGetType(emptyClassFullName);\r\n                    if (interfaceType != null)\r\n                    {\r\n                        isRecompileNeeded = CodeGenerationManager.IsRecompileNeeded(interfaceType, new[] { emptyClassType });\r\n                    }\r\n\r\n                    if (isRecompileNeeded)\r\n                    {\r\n                        emptyClassType = CreateEmptyDataClassType(dataTypeDescriptor);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return emptyClassType;\r\n        }\r\n\r\n\r\n\r\n        private static Type GetEmptyClassFromBuildNewHandler(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Type buildNewHandlerType = TypeManager.GetType(dataTypeDescriptor.BuildNewHandlerTypeName);\r\n            IBuildNewHandler buildNewHandler = (IBuildNewHandler)Activator.CreateInstance(buildNewHandlerType);\r\n\r\n            Type dataType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n\r\n            VerifyAssemblyLocation(dataType);\r\n\r\n            return buildNewHandler.GetTypeToBuild(dataType);\r\n        }\r\n\r\n\r\n        private static void VerifyAssemblyLocation(Type interfaceType)\r\n        {\r\n            if (!DataTypeTypesManager.IsAllowedDataTypeAssembly(interfaceType))\r\n            {\r\n                string message = $\"The data interface '{interfaceType}' is not located in an assembly in the website Bin folder. Please move it to that location\";\r\n                Log.LogError(nameof(EmptyDataClassTypeManager), message);\r\n                throw new InvalidOperationException(message);\r\n            }\r\n        }\r\n\r\n\r\n        internal static Type CreateEmptyDataClassType(DataTypeDescriptor dataTypeDescriptor, Type baseClassType = null, CodeAttributeDeclaration codeAttributeDeclaration = null)\r\n        {\r\n            var codeGenerationBuilder = new CodeGenerationBuilder(\"EmptyDataClass: \" + dataTypeDescriptor.Name);\r\n            EmptyDataClassCodeGenerator.AddAssemblyReferences(codeGenerationBuilder, dataTypeDescriptor);\r\n            EmptyDataClassCodeGenerator.AddEmptyDataClassTypeCode(codeGenerationBuilder, dataTypeDescriptor, baseClassType, codeAttributeDeclaration);\r\n\r\n            IEnumerable<Type> types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder);\r\n\r\n            return types.Single();\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            ResourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            internal Dictionary<Guid, Type> DataEmptyClassTypes { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.DataEmptyClassTypes = new Dictionary<Guid, Type>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/IDataFacadeQueryable.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal interface IDataFacadeQueryable\r\n    {\r\n        ICollection<IQueryable> Sources { get; }\r\n        Type InterfaceType { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/IDataProviderRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal interface IDataProviderRegistry\r\n    {\r\n        string DefaultDynamicTypeDataProviderName { get; }\r\n        IEnumerable<Type> AllInterfaces { get; }\r\n        IEnumerable<Type> AllKnownInterfaces { get; }\r\n        IEnumerable<Type> GeneratedInterfaces { get; }\r\n        IEnumerable<string> DataProviderNames { get; }\r\n        IEnumerable<string> DynamicDataProviderNames { get; }\r\n        List<string> GetDataProviderNamesByInterfaceType(Type interfaceType);\r\n        List<string> GetWriteableDataProviderNamesByInterfaceType(Type interfaceType);\r\n\r\n        void AddNewDataType(Type interaceType, string providerName, bool isWritableProvider = true);\r\n        void AddKnownDataType(Type interaceType, string providerName);\r\n        void UnregisterDataType(Type interfaceType, string providerName);\r\n        void RegisterDataTypeInitializationError(Type interfaceType, Exception exception);\r\n        void CheckInitializationErrors(Type interfaceType);\r\n        void InitializeDataTypes();\r\n        void Flush();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/IDataStoreExistenceVerifier.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System;\r\nnamespace Composite.Data.Foundation\r\n{\r\n\tinternal interface IDataStoreExistenceVerifier\r\n\t{\r\n        IEnumerable<Type> InterfaceTypes { get; }\r\n\r\n        /// <summary>\r\n        /// Return true if any types was \"created\"\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        bool EnsureDataStores();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/PluginFacades/DataProviderPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Data.Plugins.DataProvider.Runtime;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider;\r\n\r\n\r\nnamespace Composite.Data.Foundation.PluginFacades\r\n{\r\n    internal static class DataProviderPluginFacade\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n        internal static Func<IDataProviderFactory> DataProviderFactoryCreationDelegate = () => new ConfigurationDataProviderFactory();\r\n\r\n\r\n        static DataProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        public static bool HasConfiguration()\r\n        {\r\n            return ConfigurationServices.ConfigurationSource?.GetSection(DataProviderSettings.SectionName) != null;\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Type> GetSupportedInterfaces(string providerName)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler(providerName))\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    IDataProvider provider = GetDataProvider(providerName);\r\n\r\n                    return provider.GetSupportedInterfaces();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static IEnumerable<Type> GetKnownInterfaces(string providerName)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    var provider = GetDataProvider<IDynamicDataProvider>(providerName);\r\n\r\n                    List<Type> knownInterfaces = provider.GetKnownInterfaces().ToList();\r\n\r\n                    if (knownInterfaces.Contains(null))\r\n                    {\r\n                        Log.LogWarning(nameof(DataProviderPluginFacade), $\"Data Provider '{providerName}' returned (null) as a known interface type. Value is ignored.\");\r\n                        knownInterfaces.RemoveAll(f => f == null);\r\n                    }\r\n\r\n                    return knownInterfaces;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static IEnumerable<Type> GetGeneratedInterfaces(string providerName)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    var provider = GetDataProvider<IGeneratedTypesDataProvider>(providerName);\r\n\r\n                    return provider.GetGeneratedInterfaces();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static IQueryable<T> GetData<T>(string providerName)\r\n            where T : class, IData\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                return Call<IDataProvider, IQueryable<T>>(providerName, provider => provider.GetData<T>());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static T GetData<T>(string providerName, IDataId dataId)\r\n             where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataId, \"dataId\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                return Call<IDataProvider, T>(providerName, provider => provider.GetData<T>(dataId));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void Update(string providerName, IEnumerable<IData> dataset)\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                SyncronizedCall<IWritableDataProvider>(providerName, provider => provider.Update(dataset));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static List<T> AddNew<T>(string providerName, IEnumerable<T> dataset)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                return SyncronizedCall<IWritableDataProvider, List<T>>(providerName, provider => provider.AddNew<T>(dataset));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void Delete(string providerName, IEnumerable<DataSourceId> dataSourceIds)\r\n        {\r\n            Verify.ArgumentNotNull(dataSourceIds, \"dataSourceIds\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                SyncronizedCall<IWritableDataProvider>(providerName, provider => provider.Delete(dataSourceIds));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static bool ValidatePath<TFile>(TFile file, string providerName, out string errorMessage)\r\n            where TFile : IFile\r\n        {\r\n            Verify.ArgumentNotNull(file, \"dataSourceIds\");\r\n\r\n            string message = null;\r\n            bool result = false;\r\n            SyncronizedCall<IFileSystemDataProvider>(providerName, provider => result = provider.ValidatePath<TFile>(file, out message));\r\n\r\n            errorMessage = message;\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        public static void CreateStore(string providerName, DataTypeDescriptor typeDescriptor)\r\n        {\r\n            CreateStores(providerName, new[] { typeDescriptor });\r\n        }\r\n\r\n        public static void CreateStores(string providerName, IReadOnlyCollection<DataTypeDescriptor> typeDescriptors)\r\n        {\r\n            Verify.ArgumentNotNull(typeDescriptors, \"typeDescriptors\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    var provider = GetDataProvider<IDynamicDataProvider>(providerName);\r\n\r\n                    provider.CreateStores(typeDescriptors);\r\n                }\r\n            }\r\n\r\n        }\r\n\r\n\r\n        public static void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, bool forceCompile)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    var provider = GetDataProvider<IDynamicDataProvider>(updateDataTypeDescriptor.ProviderName);\r\n\r\n                    provider.AlterStore(updateDataTypeDescriptor, forceCompile);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static void DropStore(string providerName, DataTypeDescriptor typeDescriptor)\r\n        {\r\n            Verify.ArgumentNotNull(typeDescriptor, \"typeDescriptor\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    var provider = GetDataProvider<IDynamicDataProvider>(providerName);\r\n\r\n                    provider.DropStore(typeDescriptor);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static void AddLocale(string providerName, CultureInfo cultureInfo)\r\n        {\r\n            Verify.ArgumentNotNull(cultureInfo, \"cultureInfo\");\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                var provider = GetDataProvider<ILocalizedDataProvider>(providerName);\r\n\r\n                provider.AddLocale(cultureInfo);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void RemoveLocale(string providerName, CultureInfo cultureInfo)\r\n        {\r\n            Verify.ArgumentNotNull(cultureInfo, \"cultureInfo\");\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                var provider = GetDataProvider<ILocalizedDataProvider>(providerName);\r\n\r\n                provider.RemoveLocale(cultureInfo);\r\n            }\r\n        }\r\n\r\n        private static TResult Call<TProvider, TResult>(string providerName, Func<TProvider, TResult> func)\r\n            where TProvider : class, IDataProvider\r\n            where TResult : class\r\n        {\r\n            var provider = GetDataProvider(providerName) as TProvider\r\n                ?? throw new InvalidOperationException($\"The data provider '{providerName}' does not implement the interface '{typeof(TProvider).FullName}'\");\r\n\r\n            return func(provider);\r\n        }\r\n\r\n        private static void SyncronizedCall<TProvider>(string providerName, Action<TProvider> func) where TProvider : class, IDataProvider\r\n        {\r\n            SyncronizedCall<TProvider, object>(providerName, provider =>\r\n            {\r\n                func(provider);\r\n                return null;\r\n            });\r\n        }\r\n\r\n        private static TResult SyncronizedCall<TProvider, TResult>(string providerName, Func<TProvider, TResult> func)\r\n            where TProvider : class, IDataProvider\r\n            where TResult : class\r\n        {\r\n            var provider = GetDataProvider(providerName) as TProvider\r\n                ?? throw new InvalidOperationException($\"The data provider '{providerName}' does not implement the interface '{typeof(TProvider).FullName}'\");\r\n\r\n            // DDZ: hardcoded for now, to be fixed\r\n            bool syncDisabled = provider is SqlDataProvider;\r\n\r\n            IDisposable scope = null;\r\n            try\r\n            {\r\n                if (!syncDisabled)\r\n                {\r\n                    scope = _resourceLocker.Locker;\r\n                }\r\n\r\n                return func(provider);\r\n            }\r\n            finally\r\n            {\r\n                scope?.Dispose();\r\n            }\r\n        }\r\n\r\n        public static bool IsWriteableProvider(string providerName)\r\n        {\r\n            return GetDataProvider(providerName) is IWritableDataProvider;\r\n        }\r\n\r\n\r\n        public static bool IsDynamicProvider(string providerName)\r\n        {\r\n            return GetDataProvider(providerName) is IDynamicDataProvider;\r\n        }\r\n\r\n\r\n        public static bool IsGeneratedTypesProvider(string providerName)\r\n        {\r\n            return GetDataProvider(providerName) is IGeneratedTypesDataProvider;\r\n        }\r\n\r\n\r\n        public static bool IsLocalizedDataProvider(string providerName)\r\n        {\r\n            return GetDataProvider(providerName) is ILocalizedDataProvider;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether it has sense to cache the query results.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static bool AllowsResultsWrapping(string providerName)\r\n        {\r\n            var dataProvider = GetDataProvider(providerName);\r\n\r\n            return (dataProvider as ISupportCachingDataProvider)?.AllowResultsWrapping ?? true;\r\n        }\r\n\r\n\r\n        private static T GetDataProvider<T>(string providerName) where T : class, IDataProvider\r\n        {\r\n            var provider = GetDataProvider(providerName) as T;\r\n\r\n            return provider ?? throw new InvalidOperationException($\"The data provider '{providerName}' does not implement the interface '{typeof(T)}'\"); ;\r\n        }\r\n\r\n\r\n        internal static IDataProvider GetDataProvider(string providerName)\r\n        {\r\n            IDataProvider dataProvider = _resourceLocker.Resources.ProviderCache[providerName];\r\n\r\n            if (dataProvider != null)\r\n            {\r\n                return dataProvider;\r\n            }\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                dataProvider = _resourceLocker.Resources.ProviderCache[providerName];\r\n\r\n                if (dataProvider != null)\r\n                {\r\n                    return dataProvider;\r\n                }\r\n\r\n                try\r\n                {\r\n                    dataProvider = _resourceLocker.Resources.Factory.Create(providerName);\r\n\r\n                    dataProvider.Context = new DataProviderContext(providerName);\r\n\r\n                    _resourceLocker.Resources.ProviderCache.Add(providerName, dataProvider);\r\n                }\r\n                catch (Exception ex) when (ex is ArgumentException || ex is ConfigurationErrorsException)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n            }\r\n\r\n            return dataProvider;\r\n        }\r\n\r\n\r\n        internal static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException($\"Failed to load the configuration section '{DataProviderSettings.SectionName}' from the configuration.\", ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public IDataProviderFactory Factory { get; private set; }\r\n            public Hashtable<string, IDataProvider> ProviderCache { get; private set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = DataProviderFactoryCreationDelegate();\r\n                }\r\n                catch (Exception ex) when (ex is NullReferenceException || ex is ConfigurationErrorsException)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Hashtable<string, IDataProvider>();\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Foundation/ProcessControllerRegistry.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal static class ProcessControllerRegistry\r\n    {\r\n        private static readonly ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n        static ProcessControllerRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        public static IEnumerable<Type> ProcessControllerTypes\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.ProcessControllerTypes.ToList();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static IEnumerable<Type> DataTypesWithProcessControllers\r\n        {\r\n            get\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    return _resourceLocker.Resources.TypeToProcessControllerTypes.GetKeys().ToList();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static Dictionary<Type, Type> GetProcessControllerTypes(Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            var resourceLocker = _resourceLocker;\r\n            var resources = _resourceLocker.Resources;\r\n\r\n            Dictionary<Type, Type> processControllerTypes;\r\n\r\n            if (!resources.TypeToProcessControllerTypes.TryGetValue(interfaceType, out processControllerTypes))\r\n            {\r\n                using (resourceLocker.Locker)\r\n                {\r\n                    if (!resources.TypeToProcessControllerTypes.TryGetValue(interfaceType, out processControllerTypes))\r\n                    {\r\n                        processControllerTypes = resources.ProcessInterfaceType(_resourceLocker.Resources, interfaceType);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return processControllerTypes;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public List<Type> ProcessControllerTypes { get; set; }\r\n\r\n            public List<Type> ProcessedInterfaceTypes { get; set; }\r\n\r\n            // interfaceType -> IProcessController subinterface -> process controller type            \r\n            public Hashtable<Type, Dictionary<Type, Type>> TypeToProcessControllerTypes { get; set; }\r\n\r\n            private ProcessControllerSettings _settings;\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                var configurationSource = GetConfiguration();\r\n                ProcessControllerSettings settings = configurationSource.GetSection(ProcessControllerSettings.SectionName) as ProcessControllerSettings;\r\n                if (settings == null)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration\", ProcessControllerSettings.SectionName));\r\n                }\r\n\r\n                resources._settings = settings;\r\n                resources.ProcessControllerTypes = new List<Type>();\r\n                resources.ProcessedInterfaceTypes = new List<Type>();\r\n                resources.TypeToProcessControllerTypes = new Hashtable<Type, Dictionary<Type, Type>>();\r\n\r\n                foreach (Type interfaceType in DataFacade.GetAllInterfaces())\r\n                {\r\n                    resources.ProcessInterfaceType(resources, interfaceType);\r\n                }\r\n            }\r\n\r\n\r\n\r\n            internal Dictionary<Type, Type> ProcessInterfaceType(Resources resources, Type interfaceType)\r\n            {\r\n                Dictionary<Type, Type> processControllerTypes = new Dictionary<Type, Type>();\r\n\r\n                foreach (var controllerData in _settings.ProcessControllers)\r\n                {\r\n                    AddProcessController(resources, interfaceType, controllerData.InterfaceType, controllerData.AttributeType, processControllerTypes);\r\n                }\r\n\r\n                resources.TypeToProcessControllerTypes.Add(interfaceType, processControllerTypes);\r\n\r\n                return processControllerTypes;\r\n            }\r\n\r\n\r\n            private static IConfigurationSource GetConfiguration()\r\n            {\r\n                IConfigurationSource source = ConfigurationServices.ConfigurationSource;\r\n\r\n                if (null == source)\r\n                {\r\n                    throw new ConfigurationErrorsException(string.Format(\"No configuration source specified\"));\r\n\r\n                }\r\n                return source;\r\n            }\r\n\r\n            private static void AddProcessController(Resources resources, Type interfaceType, Type superProcessControllerInterfaceType, Type attributeType, Dictionary<Type, Type> processControllerTypes)\r\n            {\r\n                var publishAttributes = interfaceType.GetCustomAttributesRecursively(attributeType).Cast<ProcessControllerTypeAttribute>().ToList();\r\n\r\n                if (publishAttributes.Count == 0) return;\r\n\r\n                Type processControllerType = publishAttributes[0].ProcessControllerType;\r\n\r\n                foreach (ProcessControllerTypeAttribute attribute in publishAttributes.Skip(1))\r\n                {\r\n                    Verify.That(attribute.ProcessControllerType != processControllerType,\r\n                        \"Only one '{0}' is allowed on the data type '{1}' or all attributes should have same process controller type\", \r\n                        processControllerType, interfaceType);\r\n                }\r\n\r\n                processControllerTypes.Add(superProcessControllerInterfaceType, processControllerType);\r\n\r\n                if (!resources.ProcessControllerTypes.Contains(processControllerType))\r\n                {\r\n                    resources.ProcessControllerTypes.Add(processControllerType);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Foundation/ProcessControllerSettings.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Data.ProcessControlled;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal class ProcessControllerSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Data.Foundation.ProcessControllerConfiguration\";\r\n\r\n        private const string ProcessControllersPropertyName = \"ProcessControllers\";\r\n        [ConfigurationProperty(ProcessControllersPropertyName)]\r\n        public NamedElementCollection<ProcessControllerData> ProcessControllers\r\n        {\r\n            get\r\n            {\r\n                return (NamedElementCollection<ProcessControllerData>)base[ProcessControllersPropertyName];\r\n            }\r\n        }\r\n    }\r\n\r\n    internal class ProcessControllerData : NamedConfigurationElement\r\n    {\r\n        private const string InterfaceTypePropertyName = \"interfaceType\";\r\n        private const string AttributeTypePropertyName = \"attributeType\";\r\n\r\n        /// <summary>\r\n        /// The interface type for the <see cref=\"IProcessController\"/> that will\r\n        /// do the processing\r\n        /// </summary>\r\n        [ConfigurationProperty(InterfaceTypePropertyName, IsRequired = true)]\r\n        [TypeConverter(typeof(TypeManagerTypeNameConverter))]\r\n        public Type InterfaceType\r\n        {\r\n            get { return (Type)this[InterfaceTypePropertyName]; }\r\n            set { this[InterfaceTypePropertyName] = value; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// The <see cref=\"ProcessControllerTypeAttribute\"/> attached to the IData\r\n        /// object\r\n        /// </summary>\r\n        [ConfigurationProperty(AttributeTypePropertyName, IsRequired = true)]\r\n        [TypeConverter(typeof(TypeManagerTypeNameConverter))]\r\n        public Type AttributeType\r\n        {\r\n            get { return (Type)this[AttributeTypePropertyName]; }\r\n            set { this[AttributeTypePropertyName] = value; }\r\n        }\r\n\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Foundation/SelectMethodInfoCache.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data.Foundation\r\n{\r\n    internal sealed class SelectMethodInfoCache\r\n    {\r\n        private static Dictionary<CacheEntry, MethodInfo> _methodInfoCache = new Dictionary<CacheEntry, MethodInfo>();\r\n\r\n        \r\n        public static MethodInfo GetSelectMethod(Type sourceType, Type targetType)\r\n        {\r\n            CacheEntry entry = new CacheEntry(sourceType, targetType);\r\n            \r\n            if ( false == _methodInfoCache.ContainsKey(entry))\r\n            {\r\n                MethodInfo genericSelectMethod = \r\n                    (from method in typeof(Queryable).GetMethods(BindingFlags.Static | BindingFlags.Public)\r\n                     where method.Name == \"Select\" && \r\n                           method.IsGenericMethod && \r\n                           method.GetGenericArguments().Length == 2\r\n                     select method).First();\r\n\r\n                MethodInfo selectMethod = genericSelectMethod.MakeGenericMethod(new Type[] { sourceType, targetType });\r\n\r\n                _methodInfoCache.Add(entry, selectMethod);\r\n            }\r\n\r\n            return _methodInfoCache[entry];\r\n        }\r\n\r\n\r\n        private sealed class CacheEntry\r\n        {\r\n            private Type _sourceType;\r\n            private Type _targetType;\r\n\r\n            public CacheEntry(Type sourceType, Type targetType)\r\n            {\r\n                _sourceType = sourceType;\r\n                _targetType = targetType;\r\n            }\r\n\r\n            public override bool Equals(object obj)\r\n            {\r\n                CacheEntry entry = obj as CacheEntry;\r\n                \r\n                if (null == entry) return false;\r\n\r\n                return entry._sourceType == _sourceType && entry._targetType == _targetType;\r\n            }\r\n\r\n            public override int GetHashCode()\r\n            {\r\n                return _sourceType.GetHashCode() ^ _targetType.GetHashCode();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GeneratedTypes/GeneratedTypesFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\n\r\n\r\nnamespace Composite.Data.GeneratedTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public class GenerateNewTypeEventArgs : EventArgs\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public class UpdateTypeEventArgs : EventArgs\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public class DeleteTypeEventArgs : EventArgs\r\n    {\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// This class is used to create/update/delete generated types. That is, types\r\n    /// that is not defined in code, but designed through the UI and is dynamicly\r\n    /// compiled. \r\n    /// When a data type is created/updated/deleted the interface is (re)code-generated/deleted \r\n    /// and the store is created/updated/deleted through <see cref=\"Composite.Data.DynamicTypes.DynamicTypeManager\"/>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public static class GeneratedTypesFacade\r\n    {\r\n        /// <exclude />\r\n        public delegate void GenerateNewTypeDelegate(GenerateNewTypeEventArgs args);\r\n\r\n        /// <exclude />\r\n        public delegate void UpdateTypeDelegate(UpdateTypeEventArgs args);\r\n\r\n        /// <exclude />\r\n        public delegate void DeleteTypeDelegate(DeleteTypeEventArgs args);\r\n\r\n\r\n        private static event GenerateNewTypeDelegate _generateNewTypeDelegate;\r\n        private static event UpdateTypeDelegate _updateTypeDelegate;\r\n        private static event DeleteTypeDelegate _deleteTypeDelegate;\r\n\r\n\r\n        private static IGeneratedTypesFacade _generatedTypesFacade = new GeneratedTypesFacadeImpl();\r\n\r\n\r\n        internal static IGeneratedTypesFacade Implementation { get { return _generatedTypesFacade; } set { _generatedTypesFacade = value; } }\r\n        \r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void GenerateNewType(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            GenerateNewType(DataProviderRegistry.DefaultDynamicTypeDataProviderName, dataTypeDescriptor, true);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void GenerateNewType(DataTypeDescriptor dataTypeDescriptor, bool makeAFlush)\r\n        {\r\n            GenerateNewType(DataProviderRegistry.DefaultDynamicTypeDataProviderName, dataTypeDescriptor, makeAFlush);\r\n        }\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static void GenerateNewTypes(IReadOnlyCollection<DataTypeDescriptor> dataTypeDescriptor, bool makeAFlush)\r\n        {\r\n            GenerateNewTypes(DataProviderRegistry.DefaultDynamicTypeDataProviderName, dataTypeDescriptor, makeAFlush);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void GenerateNewType(string providerName, DataTypeDescriptor dataTypeDescriptor, bool makeAFlush)\r\n        {\r\n            GenerateNewTypes(providerName, new[] {dataTypeDescriptor}, makeAFlush);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void GenerateNewTypes(string providerName, IReadOnlyCollection<DataTypeDescriptor> dataTypeDescriptors, bool makeAFlush)\r\n        {\r\n            using (GlobalInitializerFacade.CoreLockScope)\r\n            {\r\n                _generatedTypesFacade.GenerateNewTypes(providerName, dataTypeDescriptors, makeAFlush);\r\n\r\n                if (_generateNewTypeDelegate != null)\r\n                {\r\n                    GenerateNewTypeDelegate generateNewTypeDelegate = _generateNewTypeDelegate;\r\n                    generateNewTypeDelegate(new GenerateNewTypeEventArgs());\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool CanDeleteType(DataTypeDescriptor dataTypeDescriptor, out string errorMessage)\r\n        {\r\n            return _generatedTypesFacade.CanDeleteType(dataTypeDescriptor, out errorMessage);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void DeleteType(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            DeleteType(DataProviderRegistry.DefaultDynamicTypeDataProviderName, dataTypeDescriptor, true);\r\n        }\r\n\r\n\r\n\r\n        internal static void DeleteType(DataTypeDescriptor dataTypeDescriptor, bool makeAFlush)\r\n        {\r\n            DeleteType(DataProviderRegistry.DefaultDynamicTypeDataProviderName, dataTypeDescriptor, makeAFlush);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void DeleteType(string providerName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            DeleteType(providerName, dataTypeDescriptor, true);\r\n        }\r\n\r\n\r\n\r\n        internal static void DeleteType(string providerName, DataTypeDescriptor dataTypeDescriptor, bool makeAFlush)\r\n        {\r\n            using (GlobalInitializerFacade.CoreLockScope)\r\n            {\r\n                PageFolderFacade.RemoveAllFolderDefinitions(dataTypeDescriptor.DataTypeId, false);\r\n                PageMetaDataFacade.RemoveAllDefinitions(dataTypeDescriptor.DataTypeId, false);\r\n\r\n                _generatedTypesFacade.DeleteType(providerName, dataTypeDescriptor, makeAFlush);\r\n\r\n                if (_deleteTypeDelegate != null)\r\n                {\r\n                    DeleteTypeDelegate deleteDelegate = _deleteTypeDelegate;\r\n                    deleteDelegate(new DeleteTypeEventArgs());\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        ///// <exclude />\r\n        //public static void UpdateType(DataTypeDescriptor oldDataTypeDescriptor, DataTypeDescriptor newDataTypeDescriptor, bool originalTypeHasData)\r\n        //{\r\n        //    UpdateType(DataProviderRegistry.DefaultDynamicTypeDataProviderName, oldDataTypeDescriptor, newDataTypeDescriptor, originalTypeHasData);\r\n        //}\r\n\r\n\r\n\r\n        ///// <exclude />\r\n        //public static void UpdateType(DataTypeDescriptor oldDataTypeDescriptor, DataTypeDescriptor newDataTypeDescriptor)\r\n        //{\r\n        //    UpdateType(DataProviderRegistry.DefaultDynamicTypeDataProviderName, oldDataTypeDescriptor, newDataTypeDescriptor, true);\r\n        //}\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void UpdateType(UpdateDataTypeDescriptor updateDataTypeDescriptor)\r\n        {\r\n            using (GlobalInitializerFacade.CoreLockScope)\r\n            {                \r\n                _generatedTypesFacade.UpdateType(updateDataTypeDescriptor);\r\n\r\n                if (_updateTypeDelegate != null)\r\n                {\r\n                    UpdateTypeDelegate updateDelegate = _updateTypeDelegate;\r\n                    updateDelegate(new UpdateTypeEventArgs());\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToGenerateNewTypeEvent(GenerateNewTypeDelegate eventDelegate)\r\n        {\r\n            _generateNewTypeDelegate += eventDelegate;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToUpdateTypeEvent(UpdateTypeDelegate eventDelegate)\r\n        {\r\n            _updateTypeDelegate += eventDelegate;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeToDeleteTypeEvent(DeleteTypeDelegate eventDelegate)\r\n        {\r\n            _deleteTypeDelegate += eventDelegate;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToGenerateNewTypeEvent(GenerateNewTypeDelegate eventDelegate)\r\n        {\r\n            _generateNewTypeDelegate -= eventDelegate;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToUpdateTypeEvent(UpdateTypeDelegate eventDelegate)\r\n        {\r\n            _updateTypeDelegate -= eventDelegate;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void UnsubscribeToDeleteTypeEvent(DeleteTypeDelegate eventDelegate)\r\n        {\r\n            _deleteTypeDelegate -= eventDelegate;\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GeneratedTypes/GeneratedTypesFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing Composite.Core;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data.GeneratedTypes\r\n{\r\n    internal sealed class GeneratedTypesFacadeImpl : IGeneratedTypesFacade\r\n    {\r\n        public void GenerateNewTypes(string providerName, IReadOnlyCollection<DataTypeDescriptor> dataTypeDescriptors, bool makeAFlush)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentNotNull(dataTypeDescriptors, \"dataTypeDescriptors\");\r\n\r\n            foreach (var dataTypeDescriptor in dataTypeDescriptors)\r\n            {\r\n                UpdateWithNewMetaDataForeignKeySystem(dataTypeDescriptor);\r\n                UpdateWithNewPageFolderForeignKeySystem(dataTypeDescriptor, false);\r\n            }\r\n\r\n            var types = DataTypeTypesManager.GetDataTypes(dataTypeDescriptors);\r\n            \r\n            foreach (var dataTypeDescriptor in dataTypeDescriptors)\r\n            {\r\n                dataTypeDescriptor.TypeManagerTypeName = TypeManager.SerializeType(types[dataTypeDescriptor.DataTypeId]);\r\n            }\r\n\r\n            DynamicTypeManager.CreateStores(providerName, dataTypeDescriptors, makeAFlush);\r\n\r\n            if (makeAFlush && dataTypeDescriptors.Any(d => d.IsCodeGenerated))\r\n            {\r\n                CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);\r\n            }\r\n        }\r\n\r\n\r\n        public void DeleteType(string providerName, DataTypeDescriptor dataTypeDescriptor, bool makeAFlush)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n            Verify.ArgumentNotNull(dataTypeDescriptor, \"dataTypeDescriptor\");\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {                \r\n                DynamicTypeManager.DropStore(providerName, dataTypeDescriptor, makeAFlush);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            if (makeAFlush && dataTypeDescriptor.IsCodeGenerated)\r\n            {\r\n                CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool CanDeleteType(DataTypeDescriptor dataTypeDescriptor, out string errorMessage)\r\n        {\r\n            CompatibilityCheckResult compatibilityCheckResult = CodeCompatibilityChecker.CheckIfAppCodeDependsOnInterface(dataTypeDescriptor);\r\n\r\n            if (!compatibilityCheckResult.Successful)\r\n            {\r\n                errorMessage = \"Cannot delete the type since it will cause a build error for App_Code files. \" + compatibilityCheckResult.ErrorMessage;\r\n\r\n                return false;\r\n            }\r\n            errorMessage = string.Empty;\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        \r\n        public void UpdateType(UpdateDataTypeDescriptor updateDataTypeDescriptor)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(updateDataTypeDescriptor.ProviderName, \"providerName\");\r\n            Verify.ArgumentNotNull(updateDataTypeDescriptor.OldDataTypeDescriptor, \"oldDataTypeDescriptor\");\r\n            Verify.ArgumentNotNull(updateDataTypeDescriptor.NewDataTypeDescriptor, \"newDataTypeDescriptor\");\r\n\r\n            Type interfaceType = null;\r\n            if (updateDataTypeDescriptor.OldDataTypeDescriptor.IsCodeGenerated)\r\n            {\r\n                interfaceType = InterfaceCodeManager.GetType(updateDataTypeDescriptor.NewDataTypeDescriptor, true);\r\n            }\r\n            else\r\n            {\r\n                interfaceType = DataTypeTypesManager.GetDataType(updateDataTypeDescriptor.NewDataTypeDescriptor);\r\n            }\r\n\r\n            updateDataTypeDescriptor.NewDataTypeDescriptor.TypeManagerTypeName = TypeManager.SerializeType(interfaceType);\r\n\r\n            DynamicTypeManager.AlterStore(updateDataTypeDescriptor, false);\r\n\r\n            CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);            \r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will remove a foreign key (if any exists) that is no longer possible with the\r\n        /// new meta data system (IPageMetaDataDefinition)\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        /// <param name=\"dataStoreExists\"></param>\r\n        private void UpdateWithNewPageFolderForeignKeySystem(DataTypeDescriptor dataTypeDescriptor, bool dataStoreExists)\r\n        {            \r\n            if (dataTypeDescriptor.IsPageFolderDataType == false)\r\n            {\r\n                return;\r\n            }\r\n\r\n            DataFieldDescriptor dataFieldDescriptor = dataTypeDescriptor.Fields[\"IAggregationDescriptionIdForeignKey\"];\r\n            if (dataFieldDescriptor == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            Log.LogVerbose(\"GeneratedTypesFacade\", string.Format(\"Removing the property {0} on the type {1}.{2}\", dataFieldDescriptor.Name, dataTypeDescriptor.Namespace, dataTypeDescriptor.Name));\r\n\r\n            if(!dataStoreExists)\r\n            {\r\n                dataTypeDescriptor.Fields.Remove(dataFieldDescriptor);\r\n                DynamicTypeManager.UpdateDataTypeDescriptor(dataTypeDescriptor, false);\r\n                return;\r\n            }\r\n\r\n            DataTypeDescriptor oldDataTypeDescriptor = dataTypeDescriptor.Clone();\r\n            dataTypeDescriptor.Fields.Remove(dataFieldDescriptor);\r\n\r\n            var dataTypeChangeDescriptor = new DataTypeChangeDescriptor(oldDataTypeDescriptor, dataTypeDescriptor);\r\n\r\n            var updateDataTypeDescriptor = new UpdateDataTypeDescriptor(oldDataTypeDescriptor, dataTypeDescriptor);\r\n\r\n            DynamicTypeManager.AlterStore(updateDataTypeDescriptor, false);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will remove a foreign key (if any exists) that is no longer possible with the\r\n        /// new meta data system (IPageMetaDataDefinition)\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        private void UpdateWithNewMetaDataForeignKeySystem(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            if (dataTypeDescriptor.IsPageMetaDataType)\r\n            {\r\n                var dataFieldDescriptor = dataTypeDescriptor.Fields[nameof(IPageMetaData.FieldName)];\r\n                if (dataFieldDescriptor?.ForeignKeyReferenceTypeName != null) // This should never fail, but want to be sure\r\n                {\r\n                    dataFieldDescriptor.ForeignKeyReferenceTypeName = null;\r\n                    \r\n                    DynamicTypeManager.UpdateDataTypeDescriptor(dataTypeDescriptor, false);\r\n\r\n                    Log.LogVerbose(\"GeneratedTypesFacade\", string.Format(\"Removing foreign on the property {0} on the type {1}.{2}\", dataFieldDescriptor.Name, dataTypeDescriptor.Namespace, dataTypeDescriptor.Name));\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GeneratedTypes/GeneratedTypesHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_GeneratedTypes;\r\n\r\nnamespace Composite.Data.GeneratedTypes\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class GeneratedTypesHelper\r\n    {\r\n        /// <exclude />\r\n        public enum KeyFieldType\r\n        {\r\n            /// <exclude />\r\n            Undefined = 0,\r\n            /// <exclude />\r\n            Guid = 1,\r\n            /// <exclude />\r\n            RandomString4 = 2,\r\n            /// <exclude />\r\n            RandomString8 = 3\r\n        }\r\n\r\n\r\n        private static readonly string[] ReservedNamespaces = { \"System\", \"Composite.Data.GeneratedTypes\", \"GeneratedTypes\" };\r\n        private const string CompositeNamespace = \"Composite\";\r\n\r\n        private Type _associatedType;\r\n        private readonly Type _oldType;\r\n        private readonly DataTypeDescriptor _oldDataTypeDescriptor;\r\n        private DataTypeDescriptor _newDataTypeDescriptor;\r\n\r\n        private string _newTypeName;\r\n        private string _newTypeNamespace;\r\n        private string _newTypeTitle;\r\n        private bool _cacheable;\r\n        private bool _searchable;\r\n        private bool _publishControlled;\r\n        private bool _localizedControlled;\r\n\r\n        private IEnumerable<DataFieldDescriptor> _newDataFieldDescriptors;\r\n        private string _newKeyFieldName;\r\n        private string _newLabelFieldName;\r\n        private string _newInternalUrlPrefix;\r\n\r\n        private DataAssociationType _dataAssociationType = DataAssociationType.None;\r\n        private DataFieldDescriptor _foreignKeyDataFieldDescriptor;\r\n        private DataFieldDescriptor _pageMetaDataDescriptionForeignKeyDataFieldDescriptor;\r\n        private DataTypeAssociationDescriptor _dataTypeAssociationDescriptor;\r\n\r\n        private bool _typeCreated;\r\n\r\n        private const string IdFieldName = \"Id\";\r\n        private const string PageReferenceFieldName = \"PageId\";\r\n        private const string CompositionDescriptionFieldName = \"FieldName\";\r\n\r\n        //private KeyFieldType _keyFieldType = KeyFieldType.Guid;\r\n\r\n        /// <exclude />\r\n        public GeneratedTypesHelper() { }\r\n\r\n        /// <exclude />\r\n        public GeneratedTypesHelper(Type oldType)\r\n        {\r\n            Verify.ArgumentNotNull(oldType, \"oldType\");\r\n\r\n            _oldType = oldType;\r\n            _oldDataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(oldType);\r\n\r\n            Initialize();\r\n        }\r\n\r\n        /// <exclude />\r\n        public GeneratedTypesHelper(DataTypeDescriptor oldDataTypeDescriptor)\r\n        {\r\n            Verify.ArgumentNotNull(oldDataTypeDescriptor, \"oldDataTypeDescriptor\");\r\n\r\n            _oldType = oldDataTypeDescriptor.GetInterfaceType();\r\n            _oldDataTypeDescriptor = oldDataTypeDescriptor;\r\n\r\n            Initialize();\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool AllowForeignKeyEditing { get; set; }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use EditableOwnDataFieldDescriptors which does not return inherited fields\", true)]\r\n        public IEnumerable<DataFieldDescriptor> EditableDataFieldDescriptors\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_oldDataTypeDescriptor, \"No old data type specified\");\r\n\r\n                var fields = _oldDataTypeDescriptor.Fields;\r\n\r\n                return fields.Where(field => IsDataFieldBindable(_oldDataTypeDescriptor, field));\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<DataFieldDescriptor> EditableInDesignerOwnDataFields\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_oldDataTypeDescriptor, \"No old data type specified\");\r\n\r\n                var fields = _oldDataTypeDescriptor.Fields;\r\n\r\n                return fields.Where(field => IsDataFieldBindable(_oldDataTypeDescriptor, field) && !field.Inherited);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<string> NotEditableDataFieldDescriptorNames\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_oldDataTypeDescriptor, \"No old data type specified\");\r\n\r\n                return from field in _oldDataTypeDescriptor.Fields\r\n                       where !IsDataFieldBindable(_oldDataTypeDescriptor, field) || _oldDataTypeDescriptor.KeyPropertyNames.FirstOrDefault() == field.Name\r\n                       select field.Name;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use IsCacheable\")]\r\n        public bool IsCachable => IsCacheable;\r\n\r\n        /// <exclude />\r\n        public bool IsCacheable\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_oldDataTypeDescriptor, \"No old data type specified\");\r\n\r\n                return _oldDataTypeDescriptor.Cachable;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsSearchable\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_oldDataTypeDescriptor, \"No old data type specified\");\r\n\r\n                return _oldDataTypeDescriptor.Searchable;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsPublishControlled\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_oldDataTypeDescriptor, \"No old data type specified\");\r\n\r\n                return _oldDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled));\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsLocalizedControlled\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_oldDataTypeDescriptor, \"No old data type specified\");\r\n\r\n                return _oldDataTypeDescriptor.SuperInterfaces.Contains(typeof(ILocalizedControlled));\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns <value>true</value> if the date type is a page meta data type.\r\n        /// </summary>\r\n        public bool IsEditProcessControlledAllowed => _pageMetaDataDescriptionForeignKeyDataFieldDescriptor == null;\r\n\r\n        /// <exclude />\r\n        public bool ValidateNewTypeName(string typeName, out string message)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(typeName, \"typeName\");\r\n\r\n            return NameValidation.TryValidateName(typeName, out message);\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool ValidateNewTypeNamespace(string typeNamespace, out string message)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(typeNamespace, \"typeNamespace\");\r\n\r\n            return NameValidation.TryValidateNamespace(typeNamespace, out message);\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool ValidateNewTypeFullName(string typeName, string typeNamespace, out string message)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(typeName, \"typeName\");\r\n            Verify.ArgumentNotNullOrEmpty(typeNamespace, \"typeNamespace\");\r\n\r\n            message = null;\r\n\r\n            if (typeNamespace.Split('.').Contains(typeName))\r\n            {\r\n                message = Texts.TypeNameInNamespace(typeName, typeNamespace);\r\n                return false;\r\n            }\r\n\r\n            if (_oldDataTypeDescriptor != null)\r\n            {\r\n                if (_oldDataTypeDescriptor.Name == typeName &&\r\n                    _oldDataTypeDescriptor.Namespace == typeNamespace)\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                var interfaceType = _oldDataTypeDescriptor.GetInterfaceType();\r\n\r\n                if (interfaceType.GetRefereeTypes().Count > 0)\r\n                {\r\n                    message = Texts.TypesAreReferencing;\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            var typeFullname = StringExtensionMethods.CreateNamespace(typeNamespace, typeName, '.');\r\n            foreach (var dtd in DataMetaDataFacade.GeneratedTypeDataTypeDescriptors)\r\n            {\r\n                var fullname = StringExtensionMethods.CreateNamespace(dtd.Namespace, dtd.Name, '.');\r\n                if (typeFullname == fullname)\r\n                {\r\n                    message = Texts.TypesNameClash;\r\n\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            var partNames = typeFullname.Split('.');\r\n            var sb = new StringBuilder(partNames[0]);\r\n\r\n            for (var i = 1; i < partNames.Length; i++)\r\n            {\r\n                var exists = TypeManager.HasTypeWithName(sb.ToString());\r\n                if (exists)\r\n                {\r\n                    message = Texts.NameSpaceIsTypeTypeName(sb.ToString());\r\n\r\n                    return false;\r\n                }\r\n\r\n                sb.Append(\".\");\r\n                sb.Append(partNames[i]);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool ValidateByCompile(out string errorMessage)\r\n        {\r\n            var dataTypeDescriptor = _oldDataTypeDescriptor == null ? CreateNewDataTypeDescriptor() : CreateUpdatedDataTypeDescriptor();\r\n\r\n            var classFullName = (dataTypeDescriptor.Namespace + \".\" + dataTypeDescriptor.Name).Replace(\" \", string.Empty);\r\n            var classFullNameWithDot = classFullName + \".\";\r\n            foreach (var reservedNamespace in ReservedNamespaces)\r\n            {\r\n                if (classFullNameWithDot.StartsWith(reservedNamespace + \".\", StringComparison.InvariantCultureIgnoreCase))\r\n                {\r\n                    errorMessage = Texts.NamespaceIsReserved;\r\n\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            foreach (var namePart in classFullName.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries))\r\n            {\r\n                if (!IsCSharpValidIdentifier(namePart))\r\n                {\r\n                    errorMessage = Texts.TypeNameIsInvalidIdentifier(classFullName);\r\n\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            foreach (var dataField in dataTypeDescriptor.Fields)\r\n            {\r\n                if (!IsCSharpValidIdentifier(dataField.Name))\r\n                {\r\n                    errorMessage = Texts.FieldNameCannotBeUsed(dataField.Name);\r\n\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            // Checking for name collisions with Composite.dll\r\n            if (classFullName.StartsWith(CompositeNamespace + \".\", StringComparison.InvariantCultureIgnoreCase))\r\n            {\r\n                foreach (var type in typeof(IData).Assembly.GetTypes())\r\n                {\r\n                    var typeNameWithDot = type.FullName + \".\";\r\n\r\n                    if (classFullNameWithDot.StartsWith(typeNameWithDot, StringComparison.InvariantCultureIgnoreCase) || typeNameWithDot.StartsWith(classFullNameWithDot, StringComparison.InvariantCultureIgnoreCase))\r\n                    {\r\n                        errorMessage = Texts.CompileErrorWhileAddingType;\r\n\r\n                        return false;\r\n                    }\r\n                }\r\n            }\r\n\r\n            var compatibilityCheckResult = CodeCompatibilityChecker.CheckCompatibilityWithAppCodeFolder(dataTypeDescriptor);\r\n            if (!compatibilityCheckResult.Successful)\r\n            {\r\n                errorMessage = _oldDataTypeDescriptor == null ? Texts.CompileErrorWhileAddingType : Texts.CompileErrorWhileChangingType;\r\n\r\n                errorMessage += compatibilityCheckResult.ErrorMessage;\r\n\r\n                return false;\r\n            }\r\n\r\n            errorMessage = string.Empty;\r\n\r\n            return true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool ValidateNewFieldDescriptors(IEnumerable<DataFieldDescriptor> newDataFieldDescriptors, string keyFieldName, out string message)\r\n        {\r\n            Verify.ArgumentNotNull(newDataFieldDescriptors, \"newDataFieldDescriptors\");\r\n\r\n            newDataFieldDescriptors = newDataFieldDescriptors.Evaluate();\r\n\r\n            message = null;\r\n\r\n            if (newDataFieldDescriptors.All(f => f.Name == keyFieldName))\r\n            {\r\n                message = Texts.MissingFields;\r\n\r\n                return false;\r\n            }\r\n\r\n            if (keyFieldName != IdFieldName && newDataFieldDescriptors.Any(dfd => dfd.Name == IdFieldName))\r\n            {\r\n                message = Texts.FieldNameCannotBeUsed(IdFieldName);\r\n\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetCompositionDescriptionPropertyName(Type compositionType)\r\n        {\r\n            return CompositionDescriptionFieldName;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static PropertyInfo GetCompositionDescriptionPropertyInfo(Type compositionType)\r\n        {\r\n            return compositionType.GetPropertiesRecursively().Single(f => f.Name == CompositionDescriptionFieldName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static PropertyInfo GetPageReferencePropertyInfo(Type compositionType)\r\n        {\r\n            return compositionType.GetPropertiesRecursively().Single(f => f.Name == PageReferenceFieldName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetNewTypeFullName(string typeName, string typeNamespace)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(typeName, \"typeName\");\r\n            Verify.ArgumentNotNullOrEmpty(typeNamespace, \"typeNamespace\");\r\n\r\n            _newTypeName = typeName;\r\n            _newTypeNamespace = typeNamespace;\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetNewTypeTitle(string typeTitle)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(typeTitle, \"typeTitle\");\r\n\r\n            _newTypeTitle = typeTitle;\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetNewInternalUrlPrefix(string internalUrlPrefix)\r\n        {\r\n            _newInternalUrlPrefix = internalUrlPrefix;\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"SetCacheable\")]\r\n        public void SetCachable(bool cacheable)\r\n        {\r\n            SetCacheable(cacheable);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetCacheable(bool cacheable)\r\n        {\r\n            _cacheable = cacheable;\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetSearchable(bool searchable)\r\n        {\r\n            _searchable = searchable;\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetPublishControlled(bool isPublishControlled)\r\n        {\r\n            Verify.That(IsEditProcessControlledAllowed, \"Not allowed to change this value\");\r\n\r\n            _publishControlled = isPublishControlled;\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetLocalizedControlled(bool isLocalizedControlled)\r\n        {\r\n            Verify.That(IsEditProcessControlledAllowed, \"Not allowed to change this value\");\r\n\r\n            _localizedControlled = isLocalizedControlled;\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Left for backward compatibility\")]\r\n        public void SetNewFieldDescriptors(IEnumerable<DataFieldDescriptor> newDataFieldDescriptors, string labelFieldName)\r\n        {\r\n            var idField = BuildIdField();\r\n\r\n            var fields = new[] { idField };\r\n\r\n            SetNewFieldDescriptors(fields.Concat(newDataFieldDescriptors), IdFieldName, labelFieldName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetNewFieldDescriptors(IEnumerable<DataFieldDescriptor> newDataFieldDescriptors, string keyFieldName, string labelFieldName)\r\n        {\r\n            Verify.ArgumentNotNull(newDataFieldDescriptors, \"newDataFieldDescriptors\");\r\n\r\n            _newDataFieldDescriptors = newDataFieldDescriptors;\r\n            _newKeyFieldName = keyFieldName;\r\n            _newLabelFieldName = labelFieldName;\r\n\r\n            if (_newLabelFieldName == \"\")\r\n            {\r\n                _newLabelFieldName = null;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetForeignKeyReference(Type targetDataType, DataAssociationType dataAssociationType)\r\n        {\r\n            if (dataAssociationType == DataAssociationType.None)\r\n            {\r\n                throw new ArgumentException(\"dataAssociationType\");\r\n            }\r\n\r\n            var targetDataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(targetDataType);\r\n\r\n            SetForeignKeyReference(targetDataTypeDescriptor, dataAssociationType);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetForeignKeyReference(DataTypeDescriptor targetDataTypeDescriptor, DataAssociationType dataAssociationType)\r\n        {\r\n            if (dataAssociationType == DataAssociationType.None)\r\n            {\r\n                throw new ArgumentException(\"dataAssociationType\");\r\n            }\r\n\r\n            if ((dataAssociationType == DataAssociationType.Aggregation || dataAssociationType == DataAssociationType.Composition) && _pageMetaDataDescriptionForeignKeyDataFieldDescriptor != null)\r\n            {\r\n                throw new InvalidOperationException(\"The type already has a foreign key reference\");\r\n            }\r\n\r\n            string fieldName = null;\r\n\r\n            var targetType = TypeManager.GetType(targetDataTypeDescriptor.TypeManagerTypeName);\r\n            if (targetType == typeof(IPage))\r\n            {\r\n                fieldName = PageReferenceFieldName;\r\n\r\n                _dataAssociationType = dataAssociationType;\r\n            }\r\n\r\n            _foreignKeyDataFieldDescriptor = CreateReferenceDataFieldDescriptor(targetDataTypeDescriptor, out var foreignKeyFieldName, fieldName);\r\n\r\n            if (dataAssociationType != DataAssociationType.None)\r\n            {\r\n                _dataTypeAssociationDescriptor = new DataTypeAssociationDescriptor(targetType, foreignKeyFieldName, dataAssociationType);\r\n            }\r\n\r\n            if (dataAssociationType == DataAssociationType.Composition)\r\n            {\r\n                var compositionRuleDataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeof(IPageMetaDataDefinition));\r\n\r\n                _pageMetaDataDescriptionForeignKeyDataFieldDescriptor = CreateWeakReferenceDataFieldDescriptor(compositionRuleDataTypeDescriptor, compositionRuleDataTypeDescriptor.Fields[\"Name\"], CompositionDescriptionFieldName);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool TryValidateUpdate(bool originalTypeDataExists, out string errorMessage)\r\n        {\r\n            if (_oldDataTypeDescriptor != null)\r\n            {\r\n                if (_newLabelFieldName == null)\r\n                {\r\n                    _newLabelFieldName = KeyFieldName;\r\n                }\r\n\r\n                if (_newTypeTitle == null)\r\n                {\r\n                    _newTypeTitle = _newTypeName;\r\n                }\r\n\r\n                if (!UpdateOldType(true, originalTypeDataExists, out errorMessage))\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            return ValidateByCompile(out errorMessage);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void CreateType(bool originalTypeHasData)\r\n        {\r\n            if (_typeCreated)\r\n            {\r\n                throw new InvalidOperationException(\"The type can only be created once\");\r\n            }\r\n\r\n            try\r\n            {\r\n                if (_newLabelFieldName == null)\r\n                {\r\n                    _newLabelFieldName = KeyFieldName;\r\n                }\r\n\r\n                if (_newTypeTitle == null)\r\n                {\r\n                    _newTypeTitle = _newTypeName;\r\n                }\r\n\r\n                if (_oldDataTypeDescriptor == null)\r\n                {\r\n                    Verify.IsNotNull(_newTypeName, \"Type name not set\");\r\n                    Verify.IsNotNull(_newTypeNamespace, \"Type namespace not set\");\r\n                    Verify.IsNotNull(_newDataFieldDescriptors, \"Type field descriptors not set\");\r\n\r\n                    CreateNewType();\r\n                }\r\n                else\r\n                {\r\n                    UpdateOldType(false, originalTypeHasData, out _);\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                _typeCreated = true;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public Type InterfaceType\r\n        {\r\n            get\r\n            {\r\n                Verify.That(_typeCreated, \"The type has to be created first\");\r\n\r\n                return _newDataTypeDescriptor.GetInterfaceType();\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void SetNewIdFieldValue(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            var keyProperties = data.GetType().GetKeyProperties();\r\n\r\n            foreach (var keyProperty in keyProperties)\r\n            {\r\n                var hasDefaultFieldValueAttribute = keyProperty.GetCustomAttributesRecursively<DefaultFieldValueAttribute>().Any();\r\n                var hasNewInstanceDefaultFieldValueAttribute = keyProperty.GetCustomAttributesRecursively<NewInstanceDefaultFieldValueAttribute>().Any();\r\n\r\n                if (!hasDefaultFieldValueAttribute && !hasNewInstanceDefaultFieldValueAttribute)\r\n                {\r\n                    if (keyProperty.PropertyType == typeof(Guid))\r\n                    {\r\n                        // Assigning a guid key a value because its not part of the generated UI\r\n                        keyProperty.SetValue(data, Guid.NewGuid(), null);\r\n                    }\r\n                    else\r\n                    {\r\n                        // For now, do nothing. This would fix auto increment issue for int key properties\r\n                        // throw new InvalidOperationException(string.Format(\"The property '{0}' on the data interface '{1}' does not a DefaultFieldValueAttribute or NewInstanceDefaultFieldValueAttribute and no default value could be created\", propertyInfo.Name, data.GetType());\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private void Initialize()\r\n        {\r\n            if (_oldDataTypeDescriptor.DataAssociations.Count > 0)\r\n            {\r\n                var dataTypeAssociationDescriptor = _oldDataTypeDescriptor.DataAssociations.Single();\r\n\r\n                _associatedType = dataTypeAssociationDescriptor.AssociatedInterfaceType;\r\n            }\r\n\r\n            foreach (var dataFieldDescriptor in _oldDataTypeDescriptor.Fields)\r\n            {\r\n                if (dataFieldDescriptor.ForeignKeyReferenceTypeName != null)\r\n                {\r\n                    if (_associatedType != null)\r\n                    {\r\n                        var associatedTypeTypeName = TypeManager.SerializeType(_associatedType);\r\n\r\n                        if (dataFieldDescriptor.ForeignKeyReferenceTypeName == associatedTypeTypeName)\r\n                        {\r\n                            _foreignKeyDataFieldDescriptor = dataFieldDescriptor;\r\n                        }\r\n                    }\r\n                }\r\n\r\n\r\n                if (dataFieldDescriptor.Name == CompositionDescriptionFieldName)\r\n                {\r\n                    _pageMetaDataDescriptionForeignKeyDataFieldDescriptor = dataFieldDescriptor;\r\n                }\r\n            }\r\n\r\n            _publishControlled = IsPublishControlled;\r\n            _localizedControlled = IsLocalizedControlled;\r\n        }\r\n\r\n        private void CreateNewType()\r\n        {\r\n            _newDataTypeDescriptor = CreateNewDataTypeDescriptor();\r\n\r\n            GeneratedTypesFacade.GenerateNewType(_newDataTypeDescriptor);\r\n        }\r\n\r\n        private static bool IsCSharpValidIdentifier(string name)\r\n        {\r\n            return CSharpCodeProviderFactory.CreateCompiler().IsValidIdentifier(name);\r\n        }\r\n\r\n        private bool UpdateOldType(bool validateOnly, bool originalTypeDataExists, out string errorMessage)\r\n        {\r\n            errorMessage = \"\";\r\n            _newDataTypeDescriptor = CreateUpdatedDataTypeDescriptor();\r\n\r\n            try\r\n            {\r\n                new DataTypeChangeDescriptor(_oldDataTypeDescriptor, _newDataTypeDescriptor, originalTypeDataExists);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                errorMessage = ex.Message;\r\n                return false;\r\n            }\r\n\r\n            if (validateOnly)\r\n            {\r\n                return true;\r\n            }\r\n\r\n            GeneratedTypesFacade.UpdateType(new UpdateDataTypeDescriptor(_oldDataTypeDescriptor, _newDataTypeDescriptor, originalTypeDataExists));\r\n\r\n            return true;\r\n        }\r\n\r\n        private DataTypeDescriptor CreateNewDataTypeDescriptor()\r\n        {\r\n            return CreateNewDataTypeDescriptor(\r\n                _newTypeNamespace,\r\n                _newTypeName,\r\n                _newTypeTitle,\r\n                _newLabelFieldName,\r\n                _newInternalUrlPrefix,\r\n                _cacheable,\r\n                _searchable,\r\n                _publishControlled,\r\n                _localizedControlled,\r\n                _newDataFieldDescriptors,\r\n                _foreignKeyDataFieldDescriptor,\r\n                _dataTypeAssociationDescriptor,\r\n                _pageMetaDataDescriptionForeignKeyDataFieldDescriptor);\r\n        }\r\n\r\n        private DataTypeDescriptor CreateNewDataTypeDescriptor(\r\n            string typeNamespace,\r\n            string typeName,\r\n            string typeTitle,\r\n            string labelFieldName,\r\n            string internalUrlPrefix,\r\n            bool cachable,\r\n            bool searchable,\r\n            bool publishControlled,\r\n            bool localizedControlled,\r\n            IEnumerable<DataFieldDescriptor> dataFieldDescriptors,\r\n            DataFieldDescriptor foreignKeyDataFieldDescriptor,\r\n            DataTypeAssociationDescriptor dataTypeAssociationDescriptor,\r\n            DataFieldDescriptor compositionRuleForeignKeyDataFieldDescriptor)\r\n        {\r\n            var id = Guid.NewGuid();\r\n            var dataTypeDescriptor = new DataTypeDescriptor(id, typeNamespace, typeName, true)\r\n            {\r\n                Cachable = cachable,\r\n                Searchable = searchable,\r\n                Title = typeTitle,\r\n                LabelFieldName = labelFieldName,\r\n                InternalUrlPrefix = internalUrlPrefix\r\n            };\r\n\r\n            dataTypeDescriptor.DataScopes.Add(DataScopeIdentifier.Public);\r\n\r\n            if (publishControlled && _dataAssociationType != DataAssociationType.Composition)\r\n            {\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPublishControlled));\r\n            }\r\n\r\n            if (localizedControlled)\r\n            {\r\n                dataTypeDescriptor.AddSuperInterface(typeof(ILocalizedControlled));\r\n            }\r\n\r\n            //bool addKeyField = true;\r\n            if (_dataAssociationType == DataAssociationType.Aggregation)\r\n            {\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPageDataFolder));\r\n            }\r\n            else if (_dataAssociationType == DataAssociationType.Composition)\r\n            {\r\n                //addKeyField = false;\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPageData));\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPageRelatedData));\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPageMetaData));\r\n            }\r\n\r\n            //if (addKeyField)\r\n            //{\r\n            //    var idDataFieldDescriptor = BuildKeyFieldDescriptor();\r\n\r\n            //    dataTypeDescriptor.Fields.Add(idDataFieldDescriptor);\r\n            //    dataTypeDescriptor.KeyPropertyNames.Add(IdFieldName);\r\n            //}\r\n\r\n            foreach (var dataFieldDescriptor in dataFieldDescriptors)\r\n            {\r\n                dataTypeDescriptor.Fields.Add(dataFieldDescriptor);\r\n            }\r\n\r\n            if (_newKeyFieldName != null)\r\n            {\r\n                dataTypeDescriptor.KeyPropertyNames.Add(_newKeyFieldName);\r\n            }\r\n\r\n            var position = 100;\r\n            if (_foreignKeyDataFieldDescriptor != null)\r\n            {\r\n                _foreignKeyDataFieldDescriptor.Position = position++;\r\n\r\n                if (foreignKeyDataFieldDescriptor.Name != PageReferenceFieldName)\r\n                {\r\n                    dataTypeDescriptor.Fields.Add(foreignKeyDataFieldDescriptor);\r\n                    dataTypeDescriptor.DataAssociations.Add(dataTypeAssociationDescriptor);\r\n                }\r\n            }\r\n\r\n            return dataTypeDescriptor;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds a default \"Id\" field.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static DataFieldDescriptor BuildIdField()\r\n        {\r\n            var idFieldDescriptor = new DataFieldDescriptor(Guid.NewGuid(), IdFieldName, StoreFieldType.Guid, typeof(Guid))\r\n            {\r\n                DataUrlProfile = new DataUrlProfile { Order = 0 }\r\n            };\r\n\r\n            return idFieldDescriptor;\r\n        }\r\n\r\n        private string KeyFieldName => _newKeyFieldName ?? IdFieldName;\r\n\r\n        //private DataFieldDescriptor BuildKeyFieldDescriptor()\r\n        //{\r\n        //    DataFieldDescriptor result;\r\n\r\n        //    switch (_keyFieldType)\r\n        //    {\r\n        //        case KeyFieldType.Guid:\r\n        //            result = BuildIdField();\r\n        //            break;\r\n        //        case KeyFieldType.RandomString4:\r\n        //            result = new DataFieldDescriptor(Guid.NewGuid(), IdFieldName, StoreFieldType.String(22), typeof (string))\r\n        //            {\r\n        //                DefaultValue = DefaultValue.RandomString(4, true)\r\n        //            };\r\n        //            break;\r\n        //        case KeyFieldType.RandomString8:\r\n        //            result = new DataFieldDescriptor(Guid.NewGuid(), IdFieldName, StoreFieldType.String(22), typeof (string))\r\n        //            {\r\n        //                DefaultValue = DefaultValue.RandomString(8, false)\r\n        //            };\r\n        //            break;\r\n        //        default: throw new InvalidOperationException(\"Not supported key field type value\");\r\n        //    }\r\n\r\n        //    result.Position = -1;\r\n\r\n        //    return result;\r\n        //}\r\n\r\n        private DataTypeDescriptor CreateUpdatedDataTypeDescriptor()\r\n        {\r\n            var dataTypeDescriptor = new DataTypeDescriptor(_oldDataTypeDescriptor.DataTypeId, _newTypeNamespace, _newTypeName, true)\r\n            {\r\n                Cachable = _cacheable,\r\n                Searchable = _searchable\r\n            };\r\n\r\n            dataTypeDescriptor.DataScopes.Add(DataScopeIdentifier.Public);\r\n\r\n            Type[] indirectlyInheritedInterfaces =\r\n            {\r\n                typeof(IPublishControlled), typeof(ILocalizedControlled),\r\n                typeof(IPageData), typeof(IPageFolderData), typeof(IPageMetaData)\r\n            };\r\n\r\n            // Foreign interfaces should stay inherited\r\n            foreach (var superInterface in _oldDataTypeDescriptor.SuperInterfaces)\r\n            {\r\n                if (!indirectlyInheritedInterfaces.Contains(superInterface))\r\n                {\r\n                    dataTypeDescriptor.AddSuperInterface(superInterface);\r\n                }\r\n            }\r\n\r\n            if (_publishControlled && _dataAssociationType != DataAssociationType.Composition)\r\n            {\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPublishControlled));\r\n            }\r\n\r\n            if (_localizedControlled && _dataAssociationType != DataAssociationType.Composition)\r\n            {\r\n                dataTypeDescriptor.AddSuperInterface(typeof(ILocalizedControlled));\r\n            }\r\n\r\n            if (_oldDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPageFolderData)))\r\n            {\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPageData));\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPageFolderData));\r\n            }\r\n            else if (_oldDataTypeDescriptor.SuperInterfaces.Contains(typeof(IPageMetaData)))\r\n            {\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPageData));\r\n                dataTypeDescriptor.AddSuperInterface(typeof(IPageMetaData));\r\n            }\r\n            else\r\n            {\r\n                //DataFieldDescriptor idDataFieldDescriptor =\r\n                //    (from dfd in _oldDataTypeDescriptor.Fields\r\n                //     where dfd.Name == KeyFieldName\r\n                //     select dfd).Single();\r\n\r\n                //dataTypeDescriptor.Fields.Add(idDataFieldDescriptor);\r\n                //dataTypeDescriptor.KeyPropertyNames.Add(KeyFieldName);\r\n\r\n            }\r\n\r\n            dataTypeDescriptor.Title = _newTypeTitle;\r\n\r\n            foreach (var dataFieldDescriptor in _newDataFieldDescriptors)\r\n            {\r\n                dataTypeDescriptor.Fields.Add(dataFieldDescriptor);\r\n            }\r\n\r\n            if (KeyFieldName != null && !dataTypeDescriptor.KeyPropertyNames.Contains(KeyFieldName))\r\n            {\r\n                dataTypeDescriptor.KeyPropertyNames.Add(KeyFieldName);\r\n            }\r\n\r\n            dataTypeDescriptor.LabelFieldName = _newLabelFieldName;\r\n            dataTypeDescriptor.InternalUrlPrefix = _newInternalUrlPrefix;\r\n\r\n            dataTypeDescriptor.DataAssociations.AddRange(_oldDataTypeDescriptor.DataAssociations);\r\n\r\n            var position = 100;\r\n\r\n            if (_foreignKeyDataFieldDescriptor != null)\r\n            {\r\n                _foreignKeyDataFieldDescriptor.Position = position++;\r\n\r\n                if (_foreignKeyDataFieldDescriptor.Name != PageReferenceFieldName)\r\n                {\r\n                    dataTypeDescriptor.Fields.Add(_foreignKeyDataFieldDescriptor);\r\n                }\r\n            }\r\n\r\n            return dataTypeDescriptor;\r\n        }\r\n\r\n        private static DataFieldDescriptor CreateWeakReferenceDataFieldDescriptor(DataTypeDescriptor targetDataTypeDescriptor, DataFieldDescriptor targetDataFieldDescriptor, string fieldName)\r\n        {\r\n            TypeManager.GetType(targetDataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            var widgetFunctionProvider = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n            return new DataFieldDescriptor(Guid.NewGuid(), fieldName, targetDataFieldDescriptor.StoreType, targetDataFieldDescriptor.InstanceType)\r\n            {\r\n                IsNullable = targetDataFieldDescriptor.IsNullable,\r\n                DefaultValue = targetDataFieldDescriptor.DefaultValue,\r\n                ValidationFunctionMarkup = targetDataFieldDescriptor.ValidationFunctionMarkup,\r\n                FormRenderingProfile = new DataFieldFormRenderingProfile\r\n                {\r\n                    Label = fieldName,\r\n                    HelpText = fieldName,\r\n                    WidgetFunctionMarkup = widgetFunctionProvider.SerializedWidgetFunction.ToString(SaveOptions.DisableFormatting)\r\n                }\r\n            };\r\n        }\r\n\r\n        private static DataFieldDescriptor CreateReferenceDataFieldDescriptor(DataTypeDescriptor targetDataTypeDescriptor, out string foreignKeyFieldName, string fieldName = null)\r\n        {\r\n            var targetType = TypeManager.GetType(targetDataTypeDescriptor.TypeManagerTypeName);\r\n            var targetKeyFieldName = targetDataTypeDescriptor.KeyPropertyNames.First();\r\n\r\n            var targetKeyDataFieldDescriptor = targetDataTypeDescriptor.Fields[targetKeyFieldName];\r\n\r\n            foreignKeyFieldName = fieldName ?? $\"{targetDataTypeDescriptor.Name}{targetKeyFieldName}ForeignKey\";\r\n\r\n            var widgetFunctionProvider = StandardWidgetFunctions.GetDataReferenceWidget(targetType);\r\n\r\n            return new DataFieldDescriptor(Guid.NewGuid(), foreignKeyFieldName, targetKeyDataFieldDescriptor.StoreType, targetKeyDataFieldDescriptor.InstanceType)\r\n            {\r\n                IsNullable = targetKeyDataFieldDescriptor.IsNullable,\r\n                DefaultValue = targetKeyDataFieldDescriptor.DefaultValue,\r\n                ValidationFunctionMarkup = targetKeyDataFieldDescriptor.ValidationFunctionMarkup,\r\n                ForeignKeyReferenceTypeName = targetDataTypeDescriptor.TypeManagerTypeName,\r\n                FormRenderingProfile = new DataFieldFormRenderingProfile\r\n                {\r\n                    Label = foreignKeyFieldName,\r\n                    HelpText = foreignKeyFieldName,\r\n                    WidgetFunctionMarkup = widgetFunctionProvider.SerializedWidgetFunction.ToString(SaveOptions.DisableFormatting)\r\n                }\r\n            };\r\n        }\r\n\r\n        private bool IsDataFieldBindable(DataTypeDescriptor dataTypeDescriptor, DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            if (dataFieldDescriptor.Inherited)\r\n            {\r\n                var superInterface = dataTypeDescriptor.SuperInterfaces.FirstOrDefault(type => type.GetProperty(dataFieldDescriptor.Name) != null);\r\n                if (superInterface != null && superInterface.Assembly == typeof(IData).Assembly)\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            if ((dataFieldDescriptor.Name == IdFieldName || dataFieldDescriptor.Name == CompositionDescriptionFieldName) && dataTypeDescriptor.IsPageMetaDataType)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (PageFolderFacade.GetAllFolderTypes().Contains(_oldType) && dataFieldDescriptor.Name == PageReferenceFieldName)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (dataFieldDescriptor.ForeignKeyReferenceTypeName != null)\r\n            {\r\n                var dataTypeAssociationDescriptor = dataTypeDescriptor.DataAssociations.FirstOrDefault();\r\n                if (dataTypeAssociationDescriptor != null)\r\n                {\r\n                    if (!AllowForeignKeyEditing && dataFieldDescriptor.Name == dataTypeAssociationDescriptor.ForeignKeyPropertyName)\r\n                    {\r\n                        return false;\r\n                    }\r\n\r\n                    if (dataFieldDescriptor.Name == CompositionDescriptionFieldName && dataTypeDescriptor.IsPageMetaDataType)\r\n                    {\r\n                        return false;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GeneratedTypes/IGeneratedTypesFacade.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.GeneratedTypes\r\n{\r\n    internal interface IGeneratedTypesFacade\r\n    {\r\n        void GenerateNewTypes(string providerName, IReadOnlyCollection<DataTypeDescriptor> dataTypeDescriptors, bool makeAFlush);\r\n        bool CanDeleteType(DataTypeDescriptor dataTypeDescriptor, out string errorMessage);\r\n        void DeleteType(string providerName, DataTypeDescriptor dataTypeDescriptor, bool makeAFlush);\r\n        void UpdateType(UpdateDataTypeDescriptor updateDataTypeDescriptor);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GeneratedTypes/InterfaceCodeGenerator.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.Renderings.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Validation.Validators;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Data.GeneratedTypes\r\n{\r\n    /// <summary>\r\n    /// Will generate data interfaces given <see cref=\"DataTypeDescriptor\"/>.\r\n    /// </summary>\r\n    public static class InterfaceCodeGenerator\r\n    {\r\n        /// <summary>\r\n        /// Adds the assembly references required by the supplied <see cref=\"DataTypeDescriptor\"/> to the supplied  <see cref=\"CodeGenerationBuilder\"/>\r\n        /// </summary>\r\n        /// <param name=\"codeGenerationBuilder\">Assembly refences is added to this builder</param>\r\n        /// <param name=\"dataTypeDescriptor\">Data type descriptor which may contain references to assemblies</param>\r\n        public static void AddAssemblyReferences(CodeGenerationBuilder codeGenerationBuilder, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            foreach (Assembly assembly in GetReferencedAssemblies(dataTypeDescriptor))\r\n            {\r\n                codeGenerationBuilder.AddReference(assembly);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Adds the source code defined by <see cref=\"DataTypeDescriptor\"/> to the supplied  <see cref=\"CodeGenerationBuilder\"/>\r\n        /// </summary>\r\n        /// <param name=\"codeGenerationBuilder\">Source code is added to this builder</param>\r\n        /// <param name=\"dataTypeDescriptor\">Data type descriptor to convert into source code</param>\r\n        public static void AddInterfaceTypeCode(CodeGenerationBuilder codeGenerationBuilder, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            var codeTypeDeclaration = CreateCodeTypeDeclaration(dataTypeDescriptor);\r\n\r\n            var codeNamespace = new CodeNamespace(dataTypeDescriptor.Namespace);\r\n            codeNamespace.Types.Add(codeTypeDeclaration);\r\n            codeGenerationBuilder.AddNamespace(codeNamespace);\r\n        }\r\n\r\n\r\n\r\n        internal static IEnumerable<Assembly> GetReferencedAssemblies(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            yield return typeof(ImmutableTypeIdAttribute).Assembly;\r\n            yield return  typeof(Microsoft.Practices.EnterpriseLibrary.Validation.Validators.NotNullValidatorAttribute).Assembly;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Given a <see cref=\"DataTypeDescriptor\"/> creates a interface declaration inheriting from IData, a valid C1 Datatype.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\">A description of the data type to generate interface for</param>\r\n        /// <returns>The generated interface</returns>\r\n        public static CodeTypeDeclaration CreateCodeTypeDeclaration(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            try\r\n            {\r\n                var codeTypeDeclaration = new CodeTypeDeclaration(dataTypeDescriptor.Name)\r\n                {\r\n                    IsInterface = true\r\n                };\r\n\r\n                codeTypeDeclaration.BaseTypes.Add(new CodeTypeReference(typeof(IData)));\r\n\r\n                var propertyNamesToSkip = new List<string>();\r\n\r\n                foreach (Type superInterface in dataTypeDescriptor.SuperInterfaces)\r\n                {\r\n                    codeTypeDeclaration.BaseTypes.Add(new CodeTypeReference(superInterface));\r\n\r\n                    propertyNamesToSkip.AddRange(superInterface.GetAllProperties().Select(p => p.Name));\r\n                }\r\n\r\n                AddInterfaceAttributes(codeTypeDeclaration.CustomAttributes, dataTypeDescriptor);\r\n                AddInterfaceProperties(codeTypeDeclaration, dataTypeDescriptor, propertyNamesToSkip);\r\n\r\n                return codeTypeDeclaration;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException($\"Failed to generate interface for type '{dataTypeDescriptor.TypeManagerTypeName}'\", ex);\r\n            }\r\n        }\r\n\r\n\r\n        private static void AddInterfaceAttributes(CodeAttributeDeclarationCollection attributes, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            attributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(AutoUpdatebleAttribute).FullName,\r\n                    new CodeAttributeArgument[] {\r\n                    }\r\n                ));\r\n\r\n\r\n            attributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(DataScopeAttribute).FullName,\r\n                    new [] { \r\n                        new CodeAttributeArgument(\r\n                            new CodePrimitiveExpression( DataScopeIdentifier.GetDefault().Name ))\r\n                    }\r\n                ));\r\n\r\n\r\n            attributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(RelevantToUserTypeAttribute).FullName,\r\n                    new [] { \r\n                        new CodeAttributeArgument(\r\n                            new CodePrimitiveExpression( nameof(UserType.Developer) ))\r\n                    }\r\n                ));\r\n\r\n\r\n            attributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(CodeGeneratedAttribute).FullName,\r\n                    new CodeAttributeArgument[] {\r\n                    }\r\n                ));\r\n\r\n\r\n            attributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(DataAncestorProviderAttribute).FullName,\r\n                    new [] {\r\n                        new CodeAttributeArgument(\r\n                            new CodeTypeOfExpression(typeof(NoAncestorDataAncestorProvider))\r\n                        )\r\n                    }\r\n                ));\r\n\r\n            attributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(ImmutableTypeIdAttribute).FullName,\r\n                    new [] {\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(dataTypeDescriptor.DataTypeId.ToString()))\r\n                    }\r\n                ));\r\n\r\n\r\n            var xhtmlEmbedableEnumRef =\r\n             new CodeFieldReferenceExpression(\r\n             new CodeTypeReferenceExpression(\r\n              typeof(XhtmlRenderingType)\r\n              ),\r\n              XhtmlRenderingType.Embedable.ToString());\r\n\r\n            attributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(KeyTemplatedXhtmlRendererAttribute).FullName,\r\n                    new [] {\r\n                            new CodeAttributeArgument(xhtmlEmbedableEnumRef),\r\n                            new CodeAttributeArgument(new CodePrimitiveExpression(\"<span>{label}</span>\"))\r\n                        }\r\n                ));\r\n\r\n\r\n\r\n            foreach (string keyFieldName in dataTypeDescriptor.KeyPropertyNames)\r\n            {\r\n                bool isDefinedOnSuperInterface = dataTypeDescriptor.SuperInterfaces.Any(f => f.GetProperty(keyFieldName) != null);\r\n\r\n                if (!isDefinedOnSuperInterface)\r\n                {\r\n                    attributes.Add(\r\n                        new CodeAttributeDeclaration(\r\n                            typeof(KeyPropertyNameAttribute).FullName,\r\n                            new [] {\r\n                            new CodeAttributeArgument(new CodePrimitiveExpression(keyFieldName))\r\n                        }\r\n                        ));\r\n                }\r\n            }\r\n\r\n            if (dataTypeDescriptor.StoreSortOrderFieldNames.Count > 0)\r\n            {\r\n                attributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(StoreSortOrderAttribute).FullName,\r\n                    dataTypeDescriptor.StoreSortOrderFieldNames.Select(name => new CodeAttributeArgument(new CodePrimitiveExpression(name))).ToArray()\r\n                ));\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(dataTypeDescriptor.Title))\r\n            {\r\n                attributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(TitleAttribute).FullName,\r\n                        new CodeAttributeArgument(\r\n                            new CodePrimitiveExpression(dataTypeDescriptor.Title)\r\n                        )\r\n                    ));\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(dataTypeDescriptor.LabelFieldName))\r\n            {\r\n                attributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(LabelPropertyNameAttribute).FullName,\r\n                        new CodeAttributeArgument(\r\n                            new CodePrimitiveExpression(dataTypeDescriptor.LabelFieldName)\r\n                        )\r\n                    ));\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(dataTypeDescriptor.InternalUrlPrefix))\r\n            {\r\n                attributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof (InternalUrlAttribute).FullName,\r\n                        new CodeAttributeArgument(\r\n                            new CodePrimitiveExpression(dataTypeDescriptor.InternalUrlPrefix)\r\n                            )\r\n                        ));\r\n            }\r\n\r\n\r\n            foreach (var dataTypeAssociationDescriptor in dataTypeDescriptor.DataAssociations)\r\n            {\r\n                attributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(DataAssociationAttribute).FullName,\r\n                        new CodeAttributeArgument(new CodeTypeOfExpression(dataTypeAssociationDescriptor.AssociatedInterfaceType)),\r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(dataTypeAssociationDescriptor.ForeignKeyPropertyName)),\r\n                        new CodeAttributeArgument(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(DataAssociationType)),dataTypeAssociationDescriptor.AssociationType.ToString()))\r\n                    ));\r\n            }\r\n\r\n\r\n            if (!dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPageMetaData)))\r\n            {\r\n                if (dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)))\r\n                {\r\n                    attributes.Add(\r\n                        new CodeAttributeDeclaration(\r\n                            typeof(PublishProcessControllerTypeAttribute).FullName, \r\n                            new CodeAttributeArgument(new CodeTypeOfExpression(typeof(GenericPublishProcessController)))));\r\n                }\r\n            }\r\n\r\n\r\n            if (dataTypeDescriptor.Cachable)\r\n            {\r\n                // [CachingAttribute(CachingType.Full)]\r\n                attributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(CachingAttribute).FullName, \r\n                        new CodeAttributeArgument(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeTypeReferenceExpression(typeof(CachingType)),\r\n                                nameof(CachingType.Full)\r\n                                )\r\n                            )));\r\n            }\r\n\r\n            if (dataTypeDescriptor.Searchable)\r\n            {\r\n                // [SearchableTypeAttribute]\r\n                attributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(SearchableTypeAttribute).FullName\r\n                    ));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddInterfaceProperties(CodeTypeDeclaration codeTypeDeclaration, DataTypeDescriptor dataTypeDescriptor, List<string> propertyNamesToSkip)\r\n        {\r\n            foreach (var dataFieldDescriptor in dataTypeDescriptor.Fields.Where(dfd => !dfd.Inherited))\r\n            {\r\n                if (propertyNamesToSkip.Contains(dataFieldDescriptor.Name)) continue;\r\n\r\n                var codeMemberProperty = new CodeMemberProperty\r\n                {\r\n                    Name = dataFieldDescriptor.Name,\r\n                    Type = new CodeTypeReference(dataFieldDescriptor.InstanceType),\r\n                    HasGet = true,\r\n                    HasSet = true\r\n                };\r\n\r\n                AddPropertyAttributes(codeMemberProperty.CustomAttributes, dataFieldDescriptor, \r\n                    dataTypeDescriptor.KeyPropertyNames.Contains(dataFieldDescriptor.Name));\r\n\r\n                codeTypeDeclaration.Members.Add(codeMemberProperty);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddPropertyAttributes(CodeAttributeDeclarationCollection customAttributes, DataFieldDescriptor dataFieldDescriptor, bool isKeyField)\r\n        {\r\n            customAttributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(ImmutableFieldIdAttribute).FullName, \r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.Id.ToString()))));\r\n\r\n            if (isKeyField && dataFieldDescriptor.InstanceType == typeof(Guid) && dataFieldDescriptor.NewInstanceDefaultFieldValue == null)\r\n            {\r\n                customAttributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(FunctionBasedNewInstanceDefaultFieldValueAttribute).FullName, \r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(@\"<f:function name=\"\"Composite.Utils.Guid.NewGuid\"\" xmlns:f=\"\"http://www.composite.net/ns/function/1.0\"\" />\"))));\r\n            }\r\n            else if (dataFieldDescriptor.NewInstanceDefaultFieldValue != null)\r\n            {\r\n                customAttributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(FunctionBasedNewInstanceDefaultFieldValueAttribute).FullName, \r\n                        new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.NewInstanceDefaultFieldValue))));\r\n            }\r\n\r\n\r\n            var arguments = new List<CodeAttributeArgument>\r\n            {\r\n                new CodeAttributeArgument(\r\n                    new CodePropertyReferenceExpression(\r\n                        new CodeTypeReferenceExpression(typeof (PhysicalStoreFieldType)),\r\n                        dataFieldDescriptor.StoreType.PhysicalStoreType.ToString()\r\n                        ))\r\n            };\r\n\r\n\r\n            switch (dataFieldDescriptor.StoreType.PhysicalStoreType)\r\n            {\r\n                case PhysicalStoreFieldType.String:\r\n                    arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.StoreType.MaximumLength)));\r\n                    break;\r\n\r\n                case PhysicalStoreFieldType.Decimal:\r\n                    arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.StoreType.NumericPrecision)));\r\n                    arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.StoreType.NumericScale)));\r\n                    break;\r\n            }\r\n\r\n\r\n            if (dataFieldDescriptor.IsNullable)\r\n            {\r\n                arguments.Add(new CodeAttributeArgument(nameof(StoreFieldTypeAttribute.IsNullable), new CodePrimitiveExpression(true)));\r\n            }\r\n\r\n\r\n            customAttributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    typeof(StoreFieldTypeAttribute).FullName,\r\n                    arguments.ToArray()\r\n                ));\r\n\r\n\r\n            if (dataFieldDescriptor.ValidationFunctionMarkup != null)\r\n            {\r\n                foreach (string functionMarkup in dataFieldDescriptor.ValidationFunctionMarkup)\r\n                {\r\n                    var codeAttributeDeclaration =\r\n                        new CodeAttributeDeclaration(\r\n                            new CodeTypeReference(typeof(LazyFunctionProviedPropertyAttribute)),\r\n                            new CodeAttributeArgument(\r\n                                new CodePrimitiveExpression(functionMarkup)\r\n                            )\r\n                        );\r\n\r\n                    customAttributes.Add(codeAttributeDeclaration);\r\n                }\r\n            }\r\n\r\n            if (!dataFieldDescriptor.IsNullable)\r\n            {\r\n                if (!dataFieldDescriptor.InstanceType.IsValueType)\r\n                {\r\n                    var notNullAttribute = new CodeAttributeDeclaration(new CodeTypeReference(typeof(Microsoft.Practices.EnterpriseLibrary.Validation.Validators.NotNullValidatorAttribute)));\r\n                    customAttributes.Add(notNullAttribute);\r\n                }\r\n\r\n                if (dataFieldDescriptor.StoreType.IsDateTime)\r\n                {\r\n                    var dateRangeAttribute = new CodeAttributeDeclaration(new CodeTypeReference(typeof(Microsoft.Practices.EnterpriseLibrary.Validation.Validators.DateTimeRangeValidatorAttribute)));\r\n\r\n                    // 1753 is what sql server has as minimum date...\r\n                    dateRangeAttribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(\"1753-01-01T00:00:00\")));\r\n                    dateRangeAttribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(\"9999-12-31T23:59:59\")));\r\n                    customAttributes.Add(dateRangeAttribute);\r\n                }\r\n                else if (dataFieldDescriptor.ForeignKeyReferenceTypeName != null && dataFieldDescriptor.InstanceType == typeof(Guid))\r\n                {\r\n                    customAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(GuidNotEmptyAttribute))));\r\n                }\r\n            }\r\n\r\n\r\n            if (dataFieldDescriptor.Position < 1000) // Hmm, 1000 is kinda random\r\n            {\r\n                var fieldPositionAttribute = new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(FieldPositionAttribute)),\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.Position))\r\n                );\r\n\r\n                customAttributes.Add(fieldPositionAttribute);\r\n            }\r\n\r\n\r\n            if (dataFieldDescriptor.StoreType.IsString && !dataFieldDescriptor.StoreType.IsLargeString)\r\n            {\r\n                var attributeType = dataFieldDescriptor.IsNullable\r\n                    ? typeof (NullStringLengthValidatorAttribute)\r\n                    : typeof (StringSizeValidatorAttribute);\r\n\r\n                int max = dataFieldDescriptor.StoreType.MaximumLength;\r\n\r\n                var stringLengthAttribute = new CodeAttributeDeclaration(new CodeTypeReference(attributeType),\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(0)),\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(max)));\r\n\r\n                customAttributes.Add(stringLengthAttribute);\r\n            }\r\n\r\n            if (dataFieldDescriptor.StoreType.PhysicalStoreType == PhysicalStoreFieldType.Integer)\r\n            {\r\n                Type validatorAttributeType = dataFieldDescriptor.IsNullable ? typeof(NullIntegerRangeValidatorAttribute) : typeof(IntegerRangeValidatorAttribute);\r\n\r\n                var integerRangeValidatorAttribute = new CodeAttributeDeclaration(new CodeTypeReference(validatorAttributeType), \r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(Int32.MinValue)),\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(Int32.MaxValue)));\r\n\r\n                customAttributes.Add(integerRangeValidatorAttribute);\r\n            }\r\n\r\n            if (dataFieldDescriptor.StoreType.IsDecimal)\r\n            {\r\n                var decimalPrecisionAttribute = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DecimalPrecisionValidatorAttribute)));\r\n\r\n                int precision = dataFieldDescriptor.StoreType.NumericScale;\r\n\r\n                decimalPrecisionAttribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(precision)));\r\n                customAttributes.Add(decimalPrecisionAttribute);\r\n            }\r\n\r\n            if (dataFieldDescriptor.DefaultValue != null)\r\n            {\r\n                CodeAttributeDeclaration codeAttributeDeclaration = dataFieldDescriptor.DefaultValue.GetCodeAttributeDeclaration();\r\n\r\n                if (codeAttributeDeclaration != null)\r\n                {\r\n                    customAttributes.Add(codeAttributeDeclaration);\r\n                }\r\n            }\r\n\r\n            if (dataFieldDescriptor.ForeignKeyReferenceTypeName != null)\r\n            {\r\n                var codeAttributeArgument = new List<CodeAttributeArgument> \r\n                {\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.ForeignKeyReferenceTypeName)),\r\n                    new CodeAttributeArgument(nameof(ForeignKeyAttribute.AllowCascadeDeletes), new CodePrimitiveExpression(true))\r\n                };\r\n\r\n                if (!dataFieldDescriptor.IsNullable)\r\n                {\r\n                    CodeExpression defaultValue;\r\n\r\n                    if (dataFieldDescriptor.InstanceType == typeof(Guid))\r\n                    {\r\n                        defaultValue = new CodePrimitiveExpression(\"{00000000-0000-0000-0000-000000000000}\");\r\n                    }\r\n                    else if (dataFieldDescriptor.InstanceType == typeof(string))\r\n                    {\r\n                        defaultValue = new CodePrimitiveExpression(null);\r\n                    }\r\n                    else if (dataFieldDescriptor.InstanceType == typeof(int))\r\n                    {\r\n                        defaultValue = new CodePrimitiveExpression(0);\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n\r\n                    codeAttributeArgument.Add(new CodeAttributeArgument(nameof(ForeignKeyAttribute.NullReferenceValue), defaultValue));\r\n                }\r\n                else if (dataFieldDescriptor.InstanceType == typeof(string))\r\n                {\r\n                    codeAttributeArgument.Add(new CodeAttributeArgument(nameof(ForeignKeyAttribute.NullableString), new CodePrimitiveExpression(true)));\r\n                }\r\n\r\n                customAttributes.Add(\r\n                    new CodeAttributeDeclaration(\r\n                        typeof(ForeignKeyAttribute).FullName,\r\n                        codeAttributeArgument.ToArray()\r\n                    ));\r\n            }\r\n\r\n\r\n            if (dataFieldDescriptor.TreeOrderingProfile.OrderPriority.HasValue)\r\n            {\r\n                var args = new List<CodeAttributeArgument> {\r\n                    new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.TreeOrderingProfile.OrderPriority))\r\n                };\r\n\r\n                if (dataFieldDescriptor.TreeOrderingProfile.OrderDescending)\r\n                {\r\n                    args.Add( new CodeAttributeArgument(new CodePrimitiveExpression(dataFieldDescriptor.TreeOrderingProfile.OrderDescending)));\r\n                }\r\n\r\n                customAttributes.Add(\r\n                        new CodeAttributeDeclaration(\r\n                            typeof(TreeOrderingAttribute).FullName, \r\n                            args.ToArray()\r\n                        ));\r\n                \r\n            }\r\n\r\n\r\n            if (dataFieldDescriptor.DataUrlProfile != null)\r\n            {\r\n                customAttributes.Add(dataFieldDescriptor.DataUrlProfile.GetCodeAttributeDeclaration());\r\n            }\r\n\r\n            var attribute = dataFieldDescriptor.SearchProfile?.GetCodeAttributeDeclaration();\r\n            if (attribute != null)\r\n            {\r\n                customAttributes.Add(attribute);\r\n            }\r\n\r\n\r\n            if (dataFieldDescriptor.GroupByPriority != 0)\r\n            {\r\n                customAttributes.Add(\r\n                        new CodeAttributeDeclaration(\r\n                            typeof(GroupByPriorityAttribute).FullName,\r\n                                new CodeAttributeArgument( new CodePrimitiveExpression( dataFieldDescriptor.GroupByPriority ) )\r\n                        ));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GeneratedTypes/InterfaceCodeManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.GeneratedTypes\r\n{\r\n    /// <summary>\r\n    /// This class handles the caching of code generated data interface.\r\n    /// It also through <see cref=\"InterfaceCodeGenerator\"/> generated data interfaces,\r\n    /// that does not exist.    \r\n    /// </summary>\r\n    internal static class InterfaceCodeManager\r\n    {\r\n        private static readonly object _lock = new object();\r\n\r\n        /// <summary>\r\n        /// This method will return type given by the dataTypeDescriptor.\r\n        /// If the data type does not exist, one will be dynamically\r\n        /// runtime code generated.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        /// <param name=\"forceReCompilation\">If this is true a new type will be compiled regardless if one already exists.</param>\r\n        /// <returns></returns>\r\n        public static Type GetType(DataTypeDescriptor dataTypeDescriptor, bool forceReCompilation = false)\r\n        {\r\n            bool codeGenerationNeeded;\r\n\r\n            Type type = TryGetType(dataTypeDescriptor, forceReCompilation, out codeGenerationNeeded);\r\n            if (type != null)\r\n            {\r\n                return type;\r\n            }\r\n\r\n            if (codeGenerationNeeded)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    type = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());\r\n                    if (type != null) return type;\r\n\r\n                    var codeGenerationBuilder = new CodeGenerationBuilder(\"DataInterface: \" + dataTypeDescriptor.Name);\r\n                    InterfaceCodeGenerator.AddAssemblyReferences(codeGenerationBuilder, dataTypeDescriptor);\r\n                    InterfaceCodeGenerator.AddInterfaceTypeCode(codeGenerationBuilder, dataTypeDescriptor);\r\n\r\n                    IEnumerable<Type> types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder);\r\n\r\n                    return types.Single();\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        internal static Type TryGetType(DataTypeDescriptor dataTypeDescriptor, bool forceReCompilation, out bool codeGenerationNeeded)\r\n        {\r\n            Verify.ArgumentNotNull(dataTypeDescriptor, \"dataTypeDescriptor\");\r\n            codeGenerationNeeded = false;\r\n\r\n            Type type;\r\n\r\n            if (!forceReCompilation)\r\n            {\r\n                type = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());\r\n                if (type != null) return type;\r\n\r\n                if (!dataTypeDescriptor.IsCodeGenerated)\r\n                {\r\n                    type = TypeManager.TryGetType(dataTypeDescriptor.TypeManagerTypeName);\r\n                    if (type != null) return type;\r\n                }\r\n            }\r\n\r\n            if (!dataTypeDescriptor.IsCodeGenerated)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (forceReCompilation)\r\n            {\r\n                type = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());\r\n                if (type != null) return type;\r\n            }\r\n\r\n            codeGenerationNeeded = true;\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GeneratedTypes/InterfaceCodeProvider.cs",
    "content": "﻿using System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.GeneratedTypes\r\n{\r\n    internal class InterfaceCodeProvider : ICodeProvider\r\n    {\r\n        public void GetCodeToCompile(CodeGenerationBuilder builder)\r\n        {\r\n            foreach (DataTypeDescriptor dataTypeDescriptor in DataMetaDataFacade.GeneratedTypeDataTypeDescriptors)\r\n            {\r\n                InterfaceCodeGenerator.AddAssemblyReferences(builder, dataTypeDescriptor);\r\n                InterfaceCodeGenerator.AddInterfaceTypeCode(builder, dataTypeDescriptor);                \r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GlobalDataTypeFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// This facade is used for handlign genereted/dynamic global data types\r\n    /// </summary>\r\n    internal static class GlobalDataTypeFacade\r\n    {\r\n        public static IEnumerable<Type> GetAllGlobalDataTypes()\r\n        {\r\n            return\r\n                DataFacade.GetGeneratedInterfaces().\r\n                Except(PageFolderFacade.GetAllFolderTypes()).\r\n                Except(PageMetaDataFacade.GetAllMetaDataTypes());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/GroupByPriorityAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Assign this to properties on your IData interfaces to control default page foldering of tree items.\r\n    /// </summary>\r\n\tpublic sealed class GroupByPriorityAttribute : Attribute\r\n\t{\r\n        /// <summary>\r\n        /// Specify that this field should be used for default tree foldering.\r\n        /// Multiple fields on a data type may create foldering. In that case the priority has importance.\r\n        /// </summary>\r\n        /// <param name=\"priority\">Priority controls which fields are used first when foldering. Low number win.</param>\r\n        public GroupByPriorityAttribute(int priority)\r\n        {\r\n            this.Priority = priority;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Priority for foldering.\r\n        /// </summary>\r\n        public int Priority { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Hierarchy/DataAncestorFacade.cs",
    "content": "using System;\r\nusing Composite.Data.Hierarchy.Foundation;\r\n\r\n\r\nnamespace Composite.Data.Hierarchy\r\n{\r\n    internal static class DataAncestorFacade\r\n    {\r\n        public static IData GetParent(this IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            IDataAncestorProvider provider = DataAncestorProviderCache.GetDataAncestorProvider(data);\r\n\r\n            return provider.GetParent(data);;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Hierarchy/DataAncestorProviderAttribute.cs",
    "content": "using System;\r\n\r\nnamespace Composite.Data.Hierarchy\r\n{\r\n    /// <summary> \r\n    /// This attribute is requried if data items of this type is used as elements in a tree view.\r\n    /// This attribute points to a type that can resolve parent relations. \r\n    /// See <see cref=\"Composite.Data.Hierarchy.IDataAncestorProvider\"/> for more information on parent relations.\r\n    /// In case that the data items do not have natural parents, use the default implementaion <see cref=\"Composite.Data.Hierarchy.DataAncestorProviders.NoAncestorDataAncestorProvider\"/>\r\n    /// </summary>\r\n    [AttributeUsageAttribute(AttributeTargets.Interface, Inherited = true, AllowMultiple = false)]\r\n    public sealed class DataAncestorProviderAttribute : Attribute\r\n    {\r\n        private Type _dataAncestorProviderType;\r\n\r\n\r\n        /// <summary>\r\n        /// Create a instance of <see cref=\"DataAncestorProviderAttribute\"/> given the <paramref name=\"dataAncestorProviderType\"/> type.\r\n        /// </summary>\r\n        /// <param name=\"dataAncestorProviderType\">The type that can resolve parent relations. See <see cref=\"Composite.Data.Hierarchy.IDataAncestorProvider\"/>.</param>\r\n        public DataAncestorProviderAttribute(Type dataAncestorProviderType)\r\n        {\r\n            _dataAncestorProviderType = dataAncestorProviderType;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// The type that can resolve parent relations. See <see cref=\"Composite.Data.Hierarchy.IDataAncestorProvider\"/>.\r\n        /// </summary>\r\n        public Type DataAncestorProviderType\r\n        {\r\n            get { return _dataAncestorProviderType; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Hierarchy/DataAncestorProviders/NoAncestorDataAncestorProvider.cs",
    "content": "namespace Composite.Data.Hierarchy.DataAncestorProviders\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class NoAncestorDataAncestorProvider : IDataAncestorProvider\r\n\t{\r\n        /// <exclude />\r\n        public IData GetParent(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Hierarchy/DataAncestorProviders/PageDataAncestorProvider.cs",
    "content": "using System;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Data.Hierarchy.DataAncestorProviders\r\n{\r\n    internal sealed class PageDataAncestorProvider : IDataAncestorProvider\r\n    {\r\n        public IData GetParent(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            IPage page = data as IPage;\r\n\r\n            Verify.IsNotNull(page, \"Only '{0}' type is supported.\".FormatWith(typeof(IPage).FullName));\r\n\r\n            Guid parentId = PageManager.GetParentId(page.Id);\r\n            if (parentId == Guid.Empty)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            using (new DataScope(data.DataSourceId.LocaleScope))\r\n            {\r\n                return PageManager.GetPageById(parentId);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Hierarchy/DataAncestorProviders/PropertyDataAncestorProvider.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data.Hierarchy.DataAncestorProviders\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PropertyDataAncestorProviderAttribute : Attribute\r\n    {\r\n        private string _idPropertyName;\r\n        private string _parentIdPropertyName;\r\n        private Type _parentDataType;\r\n        private object _nullValue;\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"idPropertyName\">The name of the property that contains the value of the parent id property</param>\r\n        /// <param name=\"parentDataType\">The type of the parent</param>\r\n        /// <param name=\"parentIdPropertyName\">The name of the id property on the parent</param>\r\n        /// <param name=\"nullValue\"></param>\r\n        public PropertyDataAncestorProviderAttribute(string idPropertyName, Type parentDataType, string parentIdPropertyName, object nullValue)\r\n        {\r\n            _idPropertyName = idPropertyName;            \r\n            _parentDataType = parentDataType;\r\n            _parentIdPropertyName = parentIdPropertyName;\r\n            _nullValue = nullValue;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string IdPropertyName\r\n        {\r\n            get { return _idPropertyName; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ParentIdPropertyName\r\n        {\r\n            get { return _parentIdPropertyName; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type ParentDataType\r\n        {\r\n            get { return _parentDataType; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public object NullValue\r\n        {\r\n            get { return _nullValue; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PropertyDataAncestorProvider : IDataAncestorProvider\r\n    {\r\n        private Dictionary<Type, Entry> _methodInfoCache = new Dictionary<Type, Entry>();\r\n\r\n\r\n        /// <exclude />\r\n        public IData GetParent(IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            Entry entry = GetEntry(data.GetType());\r\n            object propertyValue = entry.PropertyValueMethodInfo.Invoke(data, null);\r\n\r\n            if (entry.PropertyValueMethodInfo.ReturnType == typeof(Guid))\r\n            {\r\n                if (Equals(propertyValue, Guid.Empty)) return null;\r\n            }\r\n            else\r\n            {\r\n                if (Equals(propertyValue, entry.NullValue)) return null;\r\n            }\r\n\r\n            using (DataScope dataScope = new DataScope(data.DataSourceId.DataScopeIdentifier))\r\n            {\r\n                List<object> queryResult = GetQueryResult(entry.ParentDataType, entry.ParentIdPropertyName, propertyValue);\r\n\r\n                if (queryResult.Count == 0) throw new InvalidOperationException(string.Format(\"The parent of the type {0} with the id ({1}) value of {2} was not found\", entry.ParentDataType, entry.ParentIdPropertyName, propertyValue));\r\n                if (queryResult.Count > 1) throw new InvalidOperationException(string.Format(\"More than one parent of the type {0} with the id ({1}) value of {2} was found\", entry.ParentDataType, entry.ParentIdPropertyName, propertyValue));\r\n\r\n                return (IData)queryResult[0];\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Entry GetEntry(Type dataType)\r\n        {\r\n            Entry entry;\r\n\r\n            if (_methodInfoCache.TryGetValue(dataType, out entry) == false)\r\n            {\r\n                List<PropertyDataAncestorProviderAttribute> attributes = dataType.GetCustomInterfaceAttributes<PropertyDataAncestorProviderAttribute>().ToList();\r\n\r\n                if (attributes.Count == 0) throw new InvalidOperationException(string.Format(\"Missing {0} attribute on the data type {1}\", typeof(PropertyDataAncestorProviderAttribute), dataType));\r\n                if (attributes.Count > 1) throw new InvalidOperationException(string.Format(\"Only one {0} attribute is allowed on the data type {1}\", typeof(PropertyDataAncestorProviderAttribute), dataType));\r\n\r\n                PropertyDataAncestorProviderAttribute attribute = attributes[0];\r\n\r\n                PropertyInfo propertyInfo = dataType.GetProperty(attribute.IdPropertyName);\r\n                if (propertyInfo == null) throw new InvalidOperationException(string.Format(\"No property named {0} (as specified on the PropertyDataAncestorProivder) on the type {1}\", attribute.IdPropertyName, dataType));\r\n\r\n                MethodInfo methodInfo = propertyInfo.GetGetMethod();\r\n                if (methodInfo == null) throw new InvalidOperationException(string.Format(\"Missing get property named {0} (as specified on the PropertyDataAncestorProivder) on the type {1}\", attribute.IdPropertyName, dataType));\r\n\r\n                if (typeof(IData).IsAssignableFrom(attribute.ParentDataType) == false) throw new InvalidOperationException(string.Format(\"The parent type ({0}) should be of type {1}\", attribute.ParentDataType, typeof(IData)));\r\n                if (attribute.ParentDataType.GetProperty(attribute.ParentIdPropertyName) == null) throw new InvalidOperationException(string.Format(\"The id property named {0} is missing from the parent type {1}\", attribute.IdPropertyName, attribute.ParentDataType));\r\n\r\n                entry = new Entry\r\n                    {\r\n                        PropertyValueMethodInfo = methodInfo,                        \r\n                        ParentDataType = attribute.ParentDataType,\r\n                        ParentIdPropertyName = attribute.ParentIdPropertyName,\r\n                        NullValue = attribute.NullValue,\r\n                    };\r\n\r\n                _methodInfoCache.Add(dataType, entry);\r\n            }\r\n\r\n            return entry;\r\n        }\r\n\r\n\r\n\r\n        private List<object> GetQueryResult(Type dataType, string idPropertyName, object value)\r\n        {\r\n            ParameterExpression parameter = Expression.Parameter(dataType, \"parameter\");\r\n            Expression body = Expression.Equal(Expression.Property(parameter, idPropertyName), Expression.Constant(value));\r\n            LambdaExpression lambda = Expression.Lambda(body, parameter);\r\n\r\n            MethodInfo getDataMethod = DataFacade.GetGetDataMethodInfo(dataType);\r\n\r\n            IQueryable queryable = (IQueryable)getDataMethod.Invoke(null, new object[] { true, null });\r\n\r\n            Expression whereExpression = ExpressionCreator.Where(queryable.Expression, lambda);\r\n\r\n            IEnumerable enumerable = (IEnumerable)queryable.Provider.CreateQuery(whereExpression);\r\n\r\n            return enumerable.ToListOfObjects();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Entry\r\n        {\r\n            public MethodInfo PropertyValueMethodInfo { get; set; }            \r\n            public Type ParentDataType { get; set; }\r\n            public string ParentIdPropertyName { get; set; }\r\n            public object NullValue { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Hierarchy/Foundation/DataAncestorProviderCache.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Data.Hierarchy.Foundation\r\n{\r\n    internal static class DataAncestorProviderCache\r\n    {\r\n        private static Hashtable<Type, IDataAncestorProvider> _dataAncestorProviderCache = new Hashtable<Type, IDataAncestorProvider>();\r\n\r\n        private static readonly object _syncRoot = new object();\r\n\r\n\r\n\r\n        static DataAncestorProviderCache()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n        public static IDataAncestorProvider GetDataAncestorProvider(IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            Type dataType = data.GetType();\r\n\r\n            var cache = _dataAncestorProviderCache;\r\n\r\n            IDataAncestorProvider dataAncestorProvider = cache[dataType];\r\n\r\n            if (dataAncestorProvider != null)\r\n            {\r\n                return dataAncestorProvider;\r\n            }\r\n\r\n            lock (_syncRoot)\r\n            {\r\n                dataAncestorProvider = cache[dataType];\r\n\r\n                if (dataAncestorProvider != null)\r\n                {\r\n                    return dataAncestorProvider;\r\n                }\r\n\r\n                List<DataAncestorProviderAttribute> attributes = dataType.GetCustomInterfaceAttributes<DataAncestorProviderAttribute>().ToList();\r\n\r\n\r\n                if (attributes.Count == 0) throw new InvalidOperationException(string.Format(\"Missing {0} attribute on the data type {1}\", typeof(DataAncestorProviderAttribute), dataType));\r\n                if (attributes.Count > 1) throw new InvalidOperationException(string.Format(\"Only one {0} attribute is allowed on the data type {1}\", typeof(DataAncestorProviderAttribute), dataType));\r\n\r\n                DataAncestorProviderAttribute attribute = attributes[0];\r\n\r\n                if (attribute.DataAncestorProviderType == null) throw new InvalidOperationException(string.Format(\"Data ancestor provider type can not be null on the data type {0}\", data));\r\n                if (typeof(IDataAncestorProvider).IsAssignableFrom(attribute.DataAncestorProviderType) == false) throw new InvalidOperationException(string.Format(\"Data ancestor provider {0} should implement the interface {1}\", attribute.DataAncestorProviderType, typeof(IDataAncestorProvider)));\r\n\r\n                dataAncestorProvider = (IDataAncestorProvider)Activator.CreateInstance(attribute.DataAncestorProviderType);\r\n\r\n                cache.Add(dataType, dataAncestorProvider);\r\n\r\n                return dataAncestorProvider;\r\n            }\r\n        }\r\n\r\n        private static void Flush()\r\n        {\r\n            _dataAncestorProviderCache = new Hashtable<Type, IDataAncestorProvider>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Hierarchy/IDataAncestorProvider.cs",
    "content": "using Composite.Data;\r\n\r\n\r\nnamespace Composite.Data.Hierarchy\r\n{\r\n    /// <summary>    \r\n    /// Implementations of this interface is used for determining hierarchy when\r\n    /// data items are used as elements in trees. \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IDataAncestorProvider\r\n    {\r\n        /// <exclude />\r\n        IData GetParent(IData data);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IBuildNewHandler.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// This interface is used togehter with the attribute <see cref=\"BuildNewHandlerAttribute\"/>.\r\n    /// It is possible to overwrite the default behavior when a new data item is created through the method <see cref=\"DataConnection.New\"/>\r\n    /// To do this, you have to implement this interface and attach it to your <see cref=\"IData\"/> type by using the attribute <see cref=\"BuildNewHandlerAttribute\"/>\r\n    /// <example>\r\n    /// <code>\r\n    /// [BuildNewHandlerAttribute(typeof(MyBuildNewHandler))\r\n    /// [AutoUpdateble]\r\n    /// [KeyPropertyName(\"Id\")]\r\n    /// [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    /// [ImmutableTypeId(\"{10D6CA29-5B01-45EE-9405-9B027F4C949C}\")]    \r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n    ///     [ImmutableFieldId(\"{B99F4AF2-859D-4235-887B-E5A06BBB9892}\")]\r\n    ///     Guid Id { get; set; }\r\n    ///         \r\n    ///     [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n    ///     [ImmutableFieldId(\"{A8127C77-5083-4409-9EA6-1E3BB696310D}\")]\r\n    ///     string Name { get; set; }\r\n    /// }\r\n    /// \r\n    /// class MyBuildNewHandler : IBuildNewHandler\r\n    /// {\r\n    ///     public Type GetTypeToBuild(Type dataType)\r\n    ///     {\r\n    ///         /* dataType will always be typeof(IMyDataType) */\r\n    ///         \r\n    ///         return typeof(MyDataType);\r\n    ///     }\r\n    /// }\r\n    /// \r\n    /// \r\n    /// class MyDataType : IMyDataType\r\n    /// {\r\n    ///     puglic MyDataType()\r\n    ///     {\r\n    ///         /* All new instances of IMyDataType will becrated through this constructor */\r\n    ///         this.Id = Guid.NewGuid();\r\n    ///         this.Name = \"RandomName\";\r\n    ///     }\r\n    ///     \r\n    ///     public Id { get; set; }\r\n    ///     \r\n    ///     public Name { get; set; }\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    /// </summary>\r\n    public interface IBuildNewHandler\r\n    {\r\n        /// <summary>\r\n        /// The method should return a type with parameterless constructor that will be used to create a new <see cref=\"IData\"/> instance.\r\n        /// The returned type is used by C1 to construct a new object when <see cref=\"DataConnection.New\"/> is called.\r\n        /// </summary>\r\n        /// <param name=\"dataType\">\r\n        /// The data interface type in question. This interface type is inheriting <see cref=\"IData\"/>.\r\n        /// And the interface type is also decorated with the attribute <see cref=\"BuildNewHandlerAttribute\"/>.\r\n        /// </param>\r\n        /// <returns>Should return a type that will be used to create an object that implements the given <paramref name=\"dataType\"/> interface.</returns>\r\n        Type GetTypeToBuild(Type dataType);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IChangeHistory.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IChangeHistory: IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{59E10FE8-EC55-4b10-B17A-FDE3EB4690F0}\")]\r\n        [DefaultFieldNowDateTimeValue]\r\n        [FieldPosition(502)]\r\n        [SearchableField(false, true, true)]\r\n        DateTime ChangeDate { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64, IsNullable = true)]\r\n        [ImmutableFieldId(\"{617E34B5-E035-4107-9109-DB0B33078B2A}\")]\r\n        [DefaultFieldStringValue(\"\")]\r\n        [FieldPosition(503)]\r\n        [SearchableField(false, true, true)]\r\n        string ChangedBy { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ICreationHistory.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface ICreationHistory: IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{59E10FE8-EC55-4b10-B17A-FDE3EB4690F1}\")]\r\n        [DefaultFieldNowDateTimeValue()]\r\n        [FunctionBasedNewInstanceDefaultFieldValue(\"<f:function xmlns:f=\\\"http://www.composite.net/ns/function/1.0\\\" name=\\\"Composite.Utils.Date.Now\\\" />\")]\r\n        [FieldPosition(502)]\r\n        DateTime CreationDate { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64, IsNullable = true)]\r\n        [ImmutableFieldId(\"{617E34B5-E035-4107-9109-DB0B33078B2B}\")]\r\n        [DefaultFieldStringValue(\"\")]\r\n        [FieldPosition(503)]\r\n        string CreatedBy { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IData.cs",
    "content": "using Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Base interface for data types in C1 CMS.\r\n    /// </summary>\r\n    [SerializerHandler(typeof(DataSerializerHandler))]\r\n    public interface IData\r\n    {\r\n        /// <summary>\r\n        /// Uniquely identify this data element, its type and what provider it came from.\r\n        /// </summary>\r\n        DataSourceId DataSourceId { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IDataExtensions.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IDataExtensions\r\n    {\r\n        private static ConcurrentDictionary<Type, IReadOnlyCollection<DataScopeIdentifier>> _supportedDataScopes\r\n            = new ConcurrentDictionary<Type, IReadOnlyCollection<DataScopeIdentifier>>();\r\n\r\n        private static MethodInfo ToDataReferenceMethodInfo =\r\n            StaticReflection.GetGenericMethodInfo(() => ToDataReference<IData>(null));\r\n\r\n        /// <summary>\r\n        /// Copies all changed properties from sourceData to targetData.\r\n        /// </summary>\r\n        /// <param name=\"sourceData\"></param>\r\n        /// <param name=\"targetData\"></param>\r\n        public static void FullCopyChangedTo(this IData sourceData, IData targetData)\r\n        {\r\n            FullCopyChangedTo(sourceData, targetData, null);\r\n        }\r\n\r\n\r\n        \r\n        /// <summary>\r\n        /// Copies all changed properties from sourceData to targetData.\r\n        /// </summary>\r\n        /// <param name=\"sourceData\"></param>\r\n        /// <param name=\"targetData\"></param>\r\n        /// <param name=\"propertyNamesToIgnore\"></param>\r\n        public static void FullCopyChangedTo(this IData sourceData, IData targetData, IEnumerable<string> propertyNamesToIgnore)\r\n        {\r\n            foreach (PropertyInfo targetPropertyInfo in targetData.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))\r\n            {\r\n                if (targetPropertyInfo.Name == \"DataSourceId\") continue;\r\n                if ((propertyNamesToIgnore != null) && (propertyNamesToIgnore.Contains(targetPropertyInfo.Name))) continue;\r\n\r\n                if (targetPropertyInfo.CanWrite)\r\n                {\r\n                    PropertyInfo sourcePropertyInfo = sourceData.GetType().GetProperty(targetPropertyInfo.Name, BindingFlags.Public | BindingFlags.Instance);\r\n\r\n                    if (sourcePropertyInfo == null) throw new InvalidOperationException(string.Format(\"Missing source property '{0}' on the data type '{1}'\", targetPropertyInfo.Name, sourceData.DataSourceId.InterfaceType));\r\n\r\n                    object newValue = sourcePropertyInfo.GetValue(sourceData, null);\r\n                    object oldValue = targetPropertyInfo.GetValue(targetData, null);\r\n\r\n                    if (Equals(newValue, oldValue) == false)\r\n                    {\r\n                        targetPropertyInfo.SetValue(targetData, newValue, null);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Copies all properties that exists on the targetData from the sourceData except the DataSourceId\r\n        /// If the targetData has a property that does not exist on the sourceData, the default value is used.\r\n        /// </summary>\r\n        /// <param name=\"sourceData\"></param>\r\n        /// <param name=\"targetData\"></param>\r\n        public static void ProjectedCopyTo(this IData sourceData, IData targetData)\r\n        {\r\n            ProjectedCopyTo(sourceData, targetData, true);\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Copies all properties that exists on the targetData from the sourceData except the DataSourceId\r\n        /// </summary>\r\n        /// <param name=\"sourceData\"></param>\r\n        /// <param name=\"targetData\"></param>\r\n        /// <param name=\"useDefaultValues\"></param>\r\n        public  static void ProjectedCopyTo(this IData sourceData, IData targetData, bool useDefaultValues)\r\n        {\r\n            foreach (PropertyInfo targetPropertyInfo in targetData.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))\r\n            {\r\n                if (targetPropertyInfo.Name == \"DataSourceId\") continue;\r\n\r\n                if (targetPropertyInfo.CanWrite)\r\n                {\r\n                    PropertyInfo sourcePropertyInfo = sourceData.GetType().GetProperty(targetPropertyInfo.Name, BindingFlags.Public | BindingFlags.Instance);\r\n\r\n                    if (sourcePropertyInfo != null)\r\n                    {\r\n                        object value = sourcePropertyInfo.GetValue(sourceData, null);\r\n\r\n                        targetPropertyInfo.SetValue(targetData, value, null);\r\n                    }\r\n                    else if (useDefaultValues)\r\n                    {\r\n                        object oldValue = targetPropertyInfo.GetValue(targetData, null);\r\n\r\n                        if (oldValue == null)\r\n                        {\r\n                            DefaultValue defaultValue = DynamicTypeReflectionFacade.GetDefaultValue(targetPropertyInfo);\r\n\r\n                            if (defaultValue != null)\r\n                            {\r\n                                targetPropertyInfo.SetValue(targetData, defaultValue.Value, null);\r\n                            }\r\n                            else\r\n                            {\r\n                                // Do something here ?? /MRJ\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Compares the value of the key properties of leftData and rightData\r\n        /// and if all the values are equals then it returns true. Otherwise false.\r\n        /// </summary>\r\n        /// <param name=\"leftData\"></param>\r\n        /// <param name=\"rightData\"></param>\r\n        /// <returns></returns>\r\n        internal static bool KeyEquals(this IData leftData, IData rightData)\r\n        {\r\n            Verify.ArgumentNotNull(leftData, \"leftData\");\r\n            Verify.ArgumentNotNull(rightData, \"rightData\");\r\n\r\n            if (leftData.DataSourceId.InterfaceType != rightData.DataSourceId.InterfaceType) return false;\r\n\r\n            foreach (PropertyInfo propertyInfo in DataAttributeFacade.GetKeyProperties(leftData.DataSourceId.InterfaceType))\r\n            {\r\n                object leftValue = propertyInfo.GetValue(leftData, null);\r\n                object rightValue = propertyInfo.GetValue(rightData, null);\r\n\r\n                if (!leftValue.Equals(rightValue)) return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This returns an enumerable where no two data elements has the same key value.\r\n        /// </summary>\r\n        /// <param name=\"datas\"></param>\r\n        /// <returns></returns>\r\n        internal static List<IData> KeyDistinct(this IEnumerable<IData> datas)\r\n        {\r\n            var result = new List<IData>();\r\n            foreach (IData data in datas)\r\n            {\r\n                if (!result.Any(f => f.KeyEquals(data)))\r\n                {\r\n                    result.Add(data);\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the data item's key field's value. If the key is compound, an exeption will be thrown.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>        \r\n        /// <returns></returns>\r\n        /// <exclude />\r\n        // Made public for Base site in App_Code/Composite/BasicSearch.cs\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public static object GetUniqueKey(this IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return data.DataSourceId.InterfaceType.GetSingleKeyProperty().GetValue(data, null);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the data item's key field's value. If the key is compound, an exception will be thrown.\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>       \r\n        /// <returns></returns>\r\n        public static T GetUniqueKey<T>(this IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            return (T)data.GetUniqueKey();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Converts a data item into a data reference\r\n        /// </summary>\r\n        /// <param name=\"data\">The data item</param>\r\n        /// <returns></returns>\r\n        public static IDataReference ToDataReference(this IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            var interfaceType = data.DataSourceId.InterfaceType;\r\n\r\n            return (IDataReference) ToDataReferenceMethodInfo\r\n                .MakeGenericMethod(new[] {interfaceType}).Invoke(null, new object[] {data});\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Converts a data item into a data reference\r\n        /// </summary>\r\n        /// <param name=\"data\">The data item</param>\r\n        /// <returns></returns>\r\n        public static DataReference<T> ToDataReference<T>(T data) where T : class, IData\r\n        {\r\n            return new DataReference<T>(data);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the child has ancestor as one of its ancestors\r\n        /// </summary>\r\n        /// <param name=\"child\"></param>\r\n        /// <param name=\"parent\"></param>\r\n        /// <returns></returns>\r\n        internal static bool HasAncestor(this IData child, IData parent)\r\n        {\r\n            return HasAncestor(child, parent, int.MaxValue);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the child has ancestor as one of its ancestors\r\n        /// in max maxLevels ancestors\r\n        /// </summary>\r\n        /// <param name=\"child\"></param>\r\n        /// <param name=\"parent\"></param>\r\n        /// <param name=\"maxLevels\"></param>\r\n        /// <returns></returns>        \r\n        internal static bool HasAncestor(this IData child, IData parent, int maxLevels)\r\n        {\r\n            Verify.ArgumentNotNull(child, \"child\");\r\n            Verify.ArgumentNotNull(parent, \"parent\");\r\n\r\n            if (maxLevels < 0) return false;\r\n            if (child.KeyEquals(parent))\r\n            {\r\n                return true;\r\n            }\r\n            \r\n            IData childParent = child.GetParent();\r\n\r\n            if (childParent == null) return false;\r\n\r\n            return HasAncestor(childParent, parent, maxLevels - 1);\r\n        }\r\n\r\n\r\n        internal static IReadOnlyCollection<DataScopeIdentifier> GetSupportedDataScopes(this Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) throw new ArgumentException(string.Format(\"The specified type must inherit from '{0}'\", typeof(IData)), \"interfaceType\");\r\n\r\n            return _supportedDataScopes.GetOrAdd(interfaceType, GetSupportedDataScopesInt);\r\n        }\r\n\r\n        private static IReadOnlyCollection<DataScopeIdentifier> GetSupportedDataScopesInt(Type interfaceType)\r\n        {\r\n            IEnumerable<DataScopeAttribute> attributes = interfaceType.GetCustomInterfaceAttributes<DataScopeAttribute>();\r\n\r\n            return attributes.Select(attribute => attribute.Identifier).Distinct().ToList();\r\n        }\r\n\r\n        /// <summary>    \r\n        /// </summary>\r\n        /// <exclude />\r\n        // Made public for Base site in App_Code/Composite/BasicSearch.cs\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n        public static List<IData> ToDataList(this IQueryable queryable)\r\n        {\r\n            Verify.ArgumentNotNull(queryable, \"queryable\");\r\n\r\n            return Enumerable.Cast<IData>(queryable).ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IData> ToDataEnumerable(this IQueryable queryable)\r\n        {\r\n            Verify.ArgumentNotNull(queryable, \"queryable\");\r\n\r\n            return Enumerable.Cast<IData>(queryable);\r\n        }\r\n\r\n\r\n        internal static IEnumerable ToCastedDataEnumerable(this IEnumerable<IData> datas, Type interfaceType)\r\n        {\r\n            MethodInfo methodInfo = typeof(Enumerable).GetMethods().Single(f => f.Name == \"Cast\");\r\n            methodInfo = methodInfo.MakeGenericMethod(interfaceType);\r\n\r\n            return (IEnumerable)methodInfo.Invoke(null, new object[] { datas });\r\n        }\r\n\r\n\r\n\r\n        internal static IDictionary<string, List<T>> ToDataProviderSortedDictionary<T>(this IEnumerable<T> datas)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            var result = new Dictionary<string, List<T>>();\r\n\r\n            foreach (T data in datas)\r\n            {\r\n                List<T> dataList;\r\n\r\n                if (result.TryGetValue(data.DataSourceId.ProviderName, out dataList) == false)\r\n                {\r\n                    dataList = new List<T>();\r\n\r\n                    result.Add(data.DataSourceId.ProviderName, dataList);\r\n                }\r\n\r\n                dataList.Add(data);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        internal static Dictionary<string, Dictionary<Type, List<IData>>> ToDataProviderAndInterfaceTypeSortedDictionary<T>(this IEnumerable<T> datas)\r\n            where T : class, IData\r\n        {\r\n            if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n            var result = new Dictionary<string, Dictionary<Type, List<IData>>>();\r\n\r\n            foreach (IData data in datas)\r\n            {\r\n                Dictionary<Type, List<IData>> dictionary;\r\n                if (!result.TryGetValue(data.DataSourceId.ProviderName, out dictionary))\r\n                {\r\n                    dictionary = new Dictionary<Type, List<IData>>();\r\n\r\n                    result.Add(data.DataSourceId.ProviderName, dictionary);\r\n                }\r\n\r\n                List<IData> dataList;\r\n                if (!dictionary.TryGetValue(data.DataSourceId.InterfaceType, out dataList))\r\n                {\r\n                    dataList = new List<IData>();\r\n\r\n                    dictionary.Add(data.DataSourceId.InterfaceType, dataList);\r\n                }\r\n\r\n                dataList.Add(data);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use GetDataPropertyRecursively instead\")]\r\n        public static PropertyInfo GetDataPropertyRecursivly(this Type dataType, string propertyName)\r\n        {\r\n            return GetDataPropertyRecursively(dataType, propertyName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static PropertyInfo GetDataPropertyRecursively(this Type dataType, string propertyName)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n\r\n            PropertyInfo propertyInfo = dataType.GetProperty(propertyName);\r\n\r\n            if (propertyInfo != null) return propertyInfo;\r\n\r\n            foreach (Type superInterface in dataType.GetInterfaces())\r\n            {\r\n                if (superInterface != typeof(IData) &&\r\n                    typeof(IData).IsAssignableFrom(superInterface))\r\n                {\r\n                    PropertyInfo propInfo = superInterface.GetDataPropertyRecursivly(propertyName);\r\n\r\n                    if (propInfo != null)\r\n                    {\r\n                        return propInfo;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        internal static List<PropertyInfo> GetAllProperties(this Type dataType)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n\r\n            var result = new List<PropertyInfo>();\r\n\r\n            result.AddRange(dataType.GetProperties());\r\n\r\n            foreach (Type superInterface in dataType.GetInterfacesRecursively())\r\n            {\r\n                if (superInterface != typeof(IData) &&\r\n                    typeof(IData).IsAssignableFrom(superInterface))\r\n                {\r\n                    result.AddRange(superInterface.GetProperties());\r\n                }\r\n            }\r\n\r\n            // A compatibility fix, returning the same \"PageId\" property twice usually leads to an error\r\n            if (typeof(IPageData).IsAssignableFrom(dataType))\r\n            {\r\n                result.RemoveAll(p => p.Name == \"PageId\" && p.DeclaringType == typeof(IPageData));\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SetValues(this IData data, Dictionary<string, string> values)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            Verify.ArgumentNotNull(values, \"values\");\r\n\r\n            List<PropertyInfo> properties = data.DataSourceId.InterfaceType.GetPropertiesRecursively();\r\n\r\n            foreach (var kvp in values)\r\n            {\r\n                PropertyInfo propertyInfo = properties.Single(f => f.Name == kvp.Key);\r\n\r\n                object convertedValue = ValueTypeConverter.Convert(kvp.Value, propertyInfo.PropertyType);\r\n\r\n                propertyInfo.SetValue(data, convertedValue, null);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IDataFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n\r\n    internal interface IDataFacade\r\n    {\r\n        void SetDataInterceptor<T>(DataInterceptor dataInterceptor) where T : class, IData;\r\n        bool HasDataInterceptor<T>() where T : class, IData;\r\n        void ClearDataInterceptor<T>() where T : class, IData;\r\n        IEnumerable<DataInterceptor> GetDataInterceptors(Type interfaceType);\r\n\r\n\r\n        IQueryable<T> GetData<T>(bool useCaching, IEnumerable<string> providerNames) where T : class, IData;\r\n        T GetDataFromDataSourceId<T>(DataSourceId dataSourceId, bool useCaching) where T : class, IData;\r\n\r\n\r\n        void Update(IEnumerable<IData> datas, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation);\r\n\r\n        /// <summary>\r\n        /// This method will add the given data.\r\n        /// This method will also create a store if no data provider supports the given data interface T\r\n        /// and allowStoreCreation is true.\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"datas\"></param>\r\n        /// <param name=\"allowStoreCreation\"></param>\r\n        /// <param name=\"suppressEventing\"></param>\r\n        /// <param name=\"performForeignKeyIntegrityCheck\"></param>\r\n        /// <param name=\"performeValidation\"></param>\r\n        /// <param name=\"writeableProviders\">null is allowed</param>\r\n        /// <returns></returns>\r\n        List<T> AddNew<T>(IEnumerable<T> datas, bool allowStoreCreation, bool suppressEventing, bool performForeignKeyIntegrityCheck, bool performeValidation, List<string> writeableProviders) where T : class, IData;\r\n\r\n        void Delete<T>(IEnumerable<T> datas, bool suppressEventing, CascadeDeleteType cascadeDeleteType, bool referencesFromAllScopes) where T : class, IData;\r\n\r\n        T BuildNew<T>(bool suppressEventing) where T : class, IData;\r\n        IData BuildNew(Type interfaceType, bool suppressEventling);\r\n\r\n        bool ExistsInAnyLocale<T>(IEnumerable<CultureInfo> excludedCultureInfoes) where T : class, IData;\r\n\r\n\r\n        /// <summary>\r\n        /// See <see cref=\"Composite.Data.Plugins.DataProvider.IFileSystemDataProvider\"/>\r\n        /// </summary>\r\n        /// <typeparam name=\"TFile\"></typeparam>\r\n        /// <param name=\"file\"></param>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <param name=\"errorMessage\"></param>\r\n        /// <returns></returns>\r\n        bool ValidatePath<TFile>(TFile file, string providerName, out string errorMessage) where TFile : IFile;\r\n\r\n        void SetGlobalDataInterceptor<T>(DataInterceptor dataInterceptor) where T : class, IData;\r\n        bool HasGlobalDataInterceptor<T>() where T : class, IData;\r\n        void ClearGlobalDataInterceptor<T>() where T : class, IData;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IDataId.cs",
    "content": "namespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IDataId\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IDataIdExtensions.cs",
    "content": "using System.Reflection;\r\nusing System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IDataIdExtensions\r\n    {\r\n        /// <exclude />\r\n        public static void FullCopyTo(this IDataId sourceDataId, IDataId targetDataId)\r\n        {\r\n            if (sourceDataId == null) throw new ArgumentNullException(\"sourceDataId\");\r\n            if (targetDataId == null) throw new ArgumentNullException(\"targetDataId\");\r\n\r\n            foreach (PropertyInfo sourcePropertyInfo in sourceDataId.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))\r\n            {\r\n                PropertyInfo targetPropertyInfo = targetDataId.GetType().GetProperty(sourcePropertyInfo.Name, BindingFlags.Public | BindingFlags.Instance);\r\n\r\n                object value = sourcePropertyInfo.GetValue(sourceDataId, null);\r\n\r\n                targetPropertyInfo.SetValue(targetDataId, value, null);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool CompareTo(this IDataId sourceDataId, IDataId targetDataId)\r\n        {\r\n            return CompareTo(sourceDataId, targetDataId, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static bool CompareTo(this IDataId sourceDataId, IDataId targetDataId, bool throwExceptionOnTypeMismathc)\r\n        {\r\n            if (sourceDataId == null) throw new ArgumentNullException(\"sourceDataId\");\r\n            if (targetDataId == null) throw new ArgumentNullException(\"targetDataId\");\r\n\r\n\r\n            if (sourceDataId.GetType() != targetDataId.GetType())\r\n            {\r\n                if (throwExceptionOnTypeMismathc) throw new ArgumentException(string.Format(\"Type mismatch {0} and {1}\", sourceDataId.GetType(), targetDataId.GetType()));\r\n                return false;\r\n            }\r\n\r\n            bool equal = true;\r\n            foreach (PropertyInfo sourcePropertyInfo in sourceDataId.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))\r\n            {\r\n                PropertyInfo targetPropertyInfo = targetDataId.GetType().GetProperty(sourcePropertyInfo.Name, BindingFlags.Public | BindingFlags.Instance);\r\n\r\n                object sourceValue = sourcePropertyInfo.GetValue(sourceDataId, null);\r\n                object targetValue = targetPropertyInfo.GetValue(targetDataId, null);\r\n\r\n                if (object.Equals(sourceValue, targetValue) == false)\r\n                {\r\n                    equal = false;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            return equal;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IDataIdKeyFacade.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    internal interface IDataIdKeyFacade\r\n    {\r\n        object GetKeyValue(IDataId dataId, string keyName);\r\n        string GetDefaultKeyName(Type dataIdType);\r\n        void OnFlush();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IDataLocalizationFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Data.ProcessControlled;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n\tinternal interface IDataLocalizationFacade\r\n\t{\r\n        /// <summary>\r\n        /// This method return true if the system should use localization functionallity.\r\n        /// In ohter words, if there are two or more languages added then localization functionallity\r\n        /// should be used.\r\n        /// </summary>\r\n        bool UseLocalization { get; }\r\n\r\n        IEnumerable<CultureInfo> WhiteListedLocales { get; }\r\n\r\n        CultureInfo DefaultLocalizationCulture { get; set; }\r\n        CultureInfo DefaultUrlMappingCulture { get; }\r\n        IEnumerable<string> ActiveLocalizationNames { get; }\r\n\r\n        string GetUrlMappingName(CultureInfo cultureInfo);\r\n        CultureInfo GetCultureInfoByUrlMappingName(string urlMappingName);\r\n        IEnumerable<string> UrlMappingNames { get; }\r\n\r\n        bool IsLocalized(Type type);\r\n        bool IsLocalizable(Type type);\r\n\r\n        IEnumerable<ReferenceFailingPropertyInfo> GetReferencingLocalizeFailingProperties(ILocalizedControlled data);\r\n\r\n\t    string GetCultureTitle(CultureInfo culture);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IDataReference.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Represents a reference to a C1 CMS IData item. See <see cref=\"DataReference{T}\"/>.\r\n    /// </summary>\r\n    public interface IDataReference\r\n\t{\r\n        /// <summary>\r\n        /// The type of the data item. This type inherits from IData.\r\n        /// </summary>\r\n        Type ReferencedType { get; }\r\n\r\n        /// <summary>\r\n        /// If the reference has not been set this is false.\r\n        /// </summary>\r\n        bool IsSet { get; }\r\n\r\n        /// <summary>\r\n        /// The key value of the data item being referenced, like the Guid for a page id.\r\n        /// </summary>\r\n        object KeyValue { get; }\r\n\r\n        /// <summary>\r\n        /// The data item being referenced.\r\n        /// </summary>\r\n        IData Data { get; }\r\n\r\n        /// <exclude />\r\n        string Serialize();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IDataWrapper.cs",
    "content": "﻿namespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IDataWrapper\r\n\t{\r\n        /// <exclude />\r\n        IData WrappedData { get; }\r\n\r\n        /// <exclude />\r\n        void CommitData();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IPageData.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Serialization;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [SerializerHandler(typeof(DataSerializerHandler))]\r\n    [KeyPropertyName(\"Id\")]\r\n    public interface IPageData : IPageRelatedData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{F6DF85E4-C577-49E5-ACD9-8BE8958736D6}\")]\r\n        Guid Id { get; set; }\r\n\r\n        /// <exclude />\r\n        new Guid PageId { get; set; } // Field is left in this interface for backward compatibility\r\n    }\r\n\r\n    /// <exclude />\r\n    public interface IPageRelatedData : IData\r\n    {\r\n        /// <exclude />\r\n        [ForeignKey(typeof(Composite.Data.Types.IPage), \"Id\", AllowCascadeDeletes = true)]\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{F641EC01-75BB-49EC-B02A-969D6BE59A5F}\")]\r\n        Guid PageId { get; set; }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/IPageFolderData.cs",
    "content": "﻿\r\n\r\nusing System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [Obsolete(\"Use IPageDataFolder instead and remember to define key fields\")]\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public interface IPageFolderData : IPageDataFolder, IPageData\r\n    {\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [DataAssociationAttribute(typeof(Composite.Data.Types.IPage), \"PageId\", DataAssociationType.Aggregation)]\r\n    public interface IPageDataFolder : IPageRelatedData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IPageMetaData.cs",
    "content": "﻿using Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n    [PublishProcessControllerType(typeof(GenericPublishProcessController))]\r\n    [DataAssociationAttribute(typeof(Composite.Data.Types.IPage), \"PageId\", DataAssociationType.Composition)]\r\n    public interface IPageMetaData : IPageData, IPublishControlled, IVersioned\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{B2A5EE23-848D-4D0B-A801-FDF68F9F899E}\")]\r\n        string FieldName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ImmutableFieldIdAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Assigns an immutable id to this property. The id must be unique and is used to identify the property even if \r\n    /// the name should change. The Dynamic Type system uses this value to detect data schema changes.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the ImmutableFieldId attribute:\r\n    /// <code>\r\n    /// // (IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     [ImmutableFieldId(\"b3bada55-0e7e-4195-86e6-92770c381df4\")]\r\n    ///     string Title { get; set; }\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public class ImmutableFieldIdAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Specify the immutable id of this data type. This value must be unique among types and should not change.\r\n        /// </summary>\r\n        /// <param name=\"immutableFieldId\">Unique GUID string</param>\r\n        public ImmutableFieldIdAttribute(string immutableFieldId)\r\n        {\r\n            this.ImmutableFieldId = new Guid(immutableFieldId);\r\n        }\r\n\r\n        /// <exclude />\r\n        public Guid ImmutableFieldId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ImmutableTypeIdAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Assigns an immutable id to this type. The id must be unique and is used to identify the type even if \r\n    /// the type name, namespace or version should change. The Dynamic Type system uses this value to detect data schema changes.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the ImmutableTypeId attribute:\r\n    /// <code>\r\n    /// [ImmutableTypeId(\"b3bada55-0e7e-4195-86e6-92770c381df3\")]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     // data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]\r\n    public class ImmutableTypeIdAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Specify the immutable id of this data type. This value must be unique among types and should not change.\r\n        /// </summary>\r\n        /// <param name=\"immutableTypeId\">Unique GUID string</param>\r\n        public ImmutableTypeIdAttribute(string immutableTypeId)\r\n        {\r\n            this.ImmutableTypeId = new Guid(immutableTypeId);\r\n        }\r\n\r\n        /// <exclude />\r\n        public Guid ImmutableTypeId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IndexAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Add this attribute to define an additional index to a tables representing the data type.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the KeyPropertyName attribute:\r\n    /// <code>\r\n    /// [KeyPropertyName(\"Id\")] \r\n    /// [Index(\"FolderName\", IndexDirection.Ascending, \"FileName\", IndexDirection.Descending)]\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     Guid Id { get; set; }\r\n    ///     string FolderName { get; set; }\r\n    ///     string FileName { get; set; }\r\n    ///     \r\n    ///     // other data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>  \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]\r\n    public sealed class IndexAttribute: Attribute\r\n    {\r\n        private readonly IReadOnlyCollection<Tuple<string, IndexDirection>> _fields;\r\n\r\n        /// <exclude />\r\n        public IndexAttribute(string fieldName, IndexDirection indexDirection)\r\n        {\r\n            _fields = new List<Tuple<string, IndexDirection>>\r\n            {\r\n                new Tuple<string, IndexDirection>(fieldName, indexDirection)\r\n            };\r\n        }\r\n\r\n        /// <exclude />\r\n        public IndexAttribute(string field1Name, IndexDirection indexDirection1,\r\n                              string field2Name, IndexDirection indexDirection2)\r\n        {\r\n            _fields = new List<Tuple<string, IndexDirection>>\r\n            {\r\n                new Tuple<string, IndexDirection>(field1Name, indexDirection1),\r\n                new Tuple<string, IndexDirection>(field2Name, indexDirection2)\r\n            };\r\n        }\r\n\r\n        /// <exclude />\r\n        public IndexAttribute(string field1Name, IndexDirection indexDirection1,\r\n                              string field2Name, IndexDirection indexDirection2,\r\n                              string field3Name, IndexDirection indexDirection3)\r\n        {\r\n            _fields = new List<Tuple<string, IndexDirection>>\r\n            {\r\n                new Tuple<string, IndexDirection>(field1Name, indexDirection1),\r\n                new Tuple<string, IndexDirection>(field2Name, indexDirection2),\r\n                new Tuple<string, IndexDirection>(field3Name, indexDirection3)\r\n            };\r\n        }\r\n\r\n        /// <exclude />\r\n        public IndexAttribute(string field1Name, IndexDirection indexDirection1,\r\n                              string field2Name, IndexDirection indexDirection2,\r\n                              string field3Name, IndexDirection indexDirection3,\r\n                              string field4Name, IndexDirection indexDirection4)\r\n        {\r\n            _fields = new List<Tuple<string, IndexDirection>>\r\n            {\r\n                new Tuple<string, IndexDirection>(field1Name, indexDirection1),\r\n                new Tuple<string, IndexDirection>(field2Name, indexDirection2),\r\n                new Tuple<string, IndexDirection>(field3Name, indexDirection3),\r\n                new Tuple<string, IndexDirection>(field4Name, indexDirection4)\r\n            };\r\n        }\r\n\r\n        /// <exclude />\r\n        public IndexAttribute(string field1Name, IndexDirection indexDirection1,\r\n                              string field2Name, IndexDirection indexDirection2,\r\n                              string field3Name, IndexDirection indexDirection3,\r\n                              string field4Name, IndexDirection indexDirection4,\r\n                              string field5Name, IndexDirection indexDirection5)\r\n        {\r\n            _fields = new List<Tuple<string, IndexDirection>>\r\n            {\r\n                new Tuple<string, IndexDirection>(field1Name, indexDirection1),\r\n                new Tuple<string, IndexDirection>(field2Name, indexDirection2),\r\n                new Tuple<string, IndexDirection>(field3Name, indexDirection3),\r\n                new Tuple<string, IndexDirection>(field4Name, indexDirection4),\r\n                new Tuple<string, IndexDirection>(field5Name, indexDirection5)\r\n            };\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the list of fields\r\n        /// </summary>\r\n        public IReadOnlyCollection<Tuple<string, IndexDirection>> Fields\r\n        {\r\n            get { return _fields; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Defines whether current index is clustered. Only one index per data type can be choosen as clustered.\r\n        /// </summary>\r\n        public bool Clustered { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/IndexDirection.cs",
    "content": "﻿namespace Composite.Data\r\n{\r\n\r\n    /// <summary>\r\n    /// Index direction\r\n    /// </summary>\r\n    public enum IndexDirection\r\n    {\r\n        /// <summary>\r\n        /// Arranged from smallest to largest.\r\n        /// </summary>\r\n        Ascending = 0,\r\n        /// <summary>\r\n        /// Arranged from largest to smallest.\r\n        /// </summary>\r\n        Descending = 1\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/InternalUrlAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// When specified, defines a short type name for generating internal urls.\r\n    /// F.e.: [InternalUrl(\"news\")] for \"~/news(id)\" internal links.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]\r\n    public class InternalUrlAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Specify a short type name, to be used in internal urls.\r\n        /// </summary>\r\n        /// <param name=\"internalUrlPrefix\">The internal url prefix.</param>\r\n        public InternalUrlAttribute(string internalUrlPrefix)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(internalUrlPrefix, \"InternalUrlPrefix\");\r\n\r\n            InternalUrlPrefix = internalUrlPrefix;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string InternalUrlPrefix { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/KeyPropertyNameAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Add this attribute to your data interface to specify one or more primary key fields.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the KeyPropertyName attribute:\r\n    /// <code>\r\n    /// [KeyPropertyName(\"Id\")]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     Guid Id { get; set; }\r\n    ///     \r\n    ///     // other data type properties\r\n    /// }\r\n    /// </code>\r\n    /// \r\n    /// This example shows how to specify a compound key. :\r\n    /// <code>\r\n    /// [KeyPropertyName(0, \"FolderName\")]\r\n    /// [KeyPropertyName(1, \"FileName\")]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     string FolderName { get; set; }\r\n    ///     string FileName { get; set; }\r\n    ///     \r\n    ///     // other data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]\r\n    public sealed class KeyPropertyNameAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Specify the name of a data property to be used as primary key.\r\n        /// </summary>\r\n        /// <param name=\"compoundKeyIndex\">The index of the field in a multi part key.</param>\r\n        /// <param name=\"propertyName\">Name of data property</param>\r\n        public KeyPropertyNameAttribute(int compoundKeyIndex, string propertyName)\r\n        {\r\n            Index = compoundKeyIndex;\r\n            KeyPropertyName = propertyName;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Specify the name of a data property to be used as primary key.\r\n        /// </summary>\r\n        /// <param name=\"propertyName\">Name of data property</param>\r\n        public KeyPropertyNameAttribute(string propertyName)\r\n        {\r\n            this.KeyPropertyName = propertyName;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the name of the key property.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The name of the key property.\r\n        /// </value>\r\n        /// <exclude />\r\n        public string KeyPropertyName { get; private set; }\r\n\r\n        /// <summary>\r\n        /// An index of the field in a multi part primary key.\r\n        /// </summary>\r\n        public int Index { get; private set; }\r\n\r\n        // TODO: implement support for sort order\r\n\r\n        ///// <summary>\r\n        ///// A sort order for indexing.\r\n        ///// </summary>\r\n        //public SortOrder SortOrder { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/LabelPropertyNameAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Add this attribute to your data interface to select what property should be used as label when enumerating data.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the LabelPropertyName attribute.\r\n    /// <code>\r\n    /// [LabelPropertyName(\"Title\")]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     string Title { get; set; }\r\n    ///     \r\n    ///     // other data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]\r\n\tpublic sealed class LabelPropertyNameAttribute : Attribute\r\n\t{\r\n        /// <exclude />\r\n        public LabelPropertyNameAttribute(string propertyName)\r\n        {\r\n            this.PropertyName = propertyName;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string PropertyName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/LocalizationScopeManager.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.Caching;\r\nusing System.Runtime.Remoting.Messaging;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class LocalizationScopeManager\r\n    {\r\n        /// <exclude />\r\n        public static CultureInfo CurrentLocalizationScope\r\n        {\r\n            get\r\n            {\r\n                var stack = LocalizationScopeStack;\r\n\r\n                if (stack.Count != 0)\r\n                {\r\n                    return stack.Peek();\r\n                }\r\n                \r\n                return CultureInfo.InvariantCulture;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static CultureInfo MapByType(Type type)\r\n        {\r\n            if (DataLocalizationFacade.IsLocalized(type))\r\n            {\r\n                return CurrentLocalizationScope;\r\n            }\r\n            \r\n            return CultureInfo.InvariantCulture;\r\n        }\r\n\r\n\r\n\r\n        internal static void PushLocalizationScope(CultureInfo cultureInfo)\r\n        {\r\n            LocalizationScopeStack.Push(cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        internal static void PopLocalizationScope()\r\n        {\r\n            var stack = LocalizationScopeStack;\r\n\r\n            if (stack.Count > 0)\r\n            {\r\n                stack.Pop();\r\n            }\r\n        }\r\n\r\n\r\n        internal static bool IsEmpty\r\n        {\r\n            get\r\n            {\r\n                return (LocalizationScopeStack.Count == 0);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private const string _threadLocalCacheKey = \"LocalizationScopeManager:ThreadLocal\";\r\n\r\n\r\n        /// <summary>\r\n        /// Move the stack handling scope to a thread local store, enabling simultaneous threads to mutate (their own) scope. This will be in effect untill the thread has completed.\r\n        /// </summary>\r\n        public static void EnterThreadLocal()\r\n        {\r\n            if( CallContext.GetData(_threadLocalCacheKey) == null)\r\n            {\r\n                var threadLocalStack = new Stack<CultureInfo>(LocalizationScopeStack);\r\n                CallContext.SetData( _threadLocalCacheKey, threadLocalStack );\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Move the stack handling to request scope.\r\n        /// </summary>\r\n        public static void ExitThreadLocal()\r\n        {\r\n            if (CallContext.GetData(_threadLocalCacheKey) != null)\r\n            {\r\n                CallContext.SetData(_threadLocalCacheKey, null);\r\n            }\r\n        }\r\n\r\n\r\n        private static Stack<CultureInfo> LocalizationScopeStack\r\n        {\r\n            get\r\n            {\r\n                var threadLocalStack = CallContext.GetData(_threadLocalCacheKey) as Stack<CultureInfo>;\r\n                if (threadLocalStack != null)\r\n                {\r\n                    return threadLocalStack;\r\n                }\r\n\r\n                return RequestLifetimeCache.GetCachedOrNew<Stack<CultureInfo>>(\"LocalizationScopeManager:Stack\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/NewInstanceDefaultFieldValueAttribute.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\n\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public abstract class NewInstanceDefaultFieldValueAttribute : Attribute\r\n    {\r\n        /// <exclude />\r\n        public abstract bool HasValue { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public abstract object GetValue();\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// Assign this attribute to a data type property to enforce a default value for the property on newly created instanced of your data type.\r\n    /// You specify a serialized C1 Function - this C1 Function will be executed and the result will be written to this property.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the FunctionBasedNewInstanceDefaultFieldValue attribute.\r\n    /// Here the current date and time is set on the Created property through the use of the C1 Function Composite.Utils.Date.Now.\r\n    /// <code>\r\n    /// // data interface attributes ...\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     [FunctionBasedNewInstanceDefaultFieldValue(@\"&lt;f:function name='Composite.Utils.Date.Now' xmlns:f='http://www.composite.net/ns/function/1.0' /&gt;\")]\r\n    ///     [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n    ///     [ImmutableFieldId(\"{D75EA67F-AD14-4BAB-8547-6D87002809F1}\")]\r\n    ///     DateTime Created { get; set; }\r\n    ///     \r\n    ///     // more data properties ...\r\n    ///     \r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class FunctionBasedNewInstanceDefaultFieldValueAttribute : NewInstanceDefaultFieldValueAttribute\r\n    {\r\n        /// <summary>\r\n        /// Specify a C1 Function call that will provide a default value for this field. The function call is expressed as XML.\r\n        /// Example: &lt;f:function name='Composite.Utils.Date.Now' xmlns:f='http://www.composite.net/ns/function/1.0' /&gt;\r\n        /// </summary>\r\n        /// <param name=\"functionDescription\">Serialized C1 Function call</param>\r\n        public FunctionBasedNewInstanceDefaultFieldValueAttribute(string functionDescription)\r\n        {\r\n            this.FunctionDescription = functionDescription;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string FunctionDescription { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool HasValue\r\n        {\r\n            get { return (string.IsNullOrEmpty(this.FunctionDescription) == false); }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Execute the C1 Function defined for this attribute and return the result.\r\n        /// </summary>\r\n        /// <returns>Result of C1 Function call</returns>\r\n        public override object GetValue()\r\n        {\r\n            BaseRuntimeTreeNode node = FunctionFacade.BuildTree(XElement.Parse(this.FunctionDescription));\r\n\r\n            return node.GetValue();\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Data/NotReferenceable.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Add this attribute to your data interface to prevent it from being referenced by other data types\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the NotReferenceable attribute.\r\n    /// <code>\r\n    /// [NotReferenceable()]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     // data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]    \r\n    public sealed class NotReferenceableAttribute : Attribute\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PageDataConnection.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.Implementation;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    ///// <summary>    \r\n    ///// </summary>\r\n    ///// <exclude />\r\n    //[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    //public class PageDataConnection : ImplementationContainer<PageDataConnectionImplementation>, IDisposable\r\n    //{\r\n    //    ImplementationContainer<DataConnection> _dataConnection;\r\n    //    ImplementationContainer<SitemapNavigator> _sitemapNavigator;\r\n\r\n\r\n\r\n    //    public PageDataConnection()\r\n    //        : base(() => ImplementationFactory.CurrentFactory.CreatePageDataConnection(null, null))\r\n    //    {\r\n    //        _dataConnection = new ImplementationContainer<DataConnection>(() => new DataConnection());\r\n    //        _sitemapNavigator = new ImplementationContainer<SitemapNavigator>(() => new SitemapNavigator(this.DataConnection));\r\n    //    }\r\n\r\n\r\n\r\n    //    public PageDataConnection(PublicationScope scope)\r\n    //        : base(() => ImplementationFactory.CurrentFactory.CreatePageDataConnection(scope, null))\r\n    //    {\r\n    //        if ((scope < PublicationScope.Unpublished) || (scope > PublicationScope.Published)) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n    //        _dataConnection = new ImplementationContainer<DataConnection>(() => new DataConnection(scope));\r\n    //        _sitemapNavigator = new ImplementationContainer<SitemapNavigator>(() => new SitemapNavigator(this.DataConnection));\r\n    //    }\r\n\r\n\r\n\r\n    //    public PageDataConnection(CultureInfo locale)\r\n    //        : base(() => ImplementationFactory.CurrentFactory.CreatePageDataConnection(null, locale))\r\n    //    {\r\n    //        _dataConnection = new ImplementationContainer<DataConnection>(() => new DataConnection(locale));\r\n    //        _sitemapNavigator = new ImplementationContainer<SitemapNavigator>(() => new SitemapNavigator(this.DataConnection));\r\n    //    }\r\n\r\n\r\n\r\n    //    public PageDataConnection(PublicationScope scope, CultureInfo locale)\r\n    //        : base(() => ImplementationFactory.CurrentFactory.CreatePageDataConnection(scope, locale))\r\n    //    {\r\n    //        if ((scope < PublicationScope.Unpublished) || (scope > PublicationScope.Published)) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n    //        _dataConnection = new ImplementationContainer<DataConnection>(() => new DataConnection(scope, locale));\r\n    //        _sitemapNavigator = new ImplementationContainer<SitemapNavigator>(() => new SitemapNavigator(this.DataConnection));\r\n    //    }\r\n\r\n\r\n\r\n    //    public TData GetPageMetaData<TData>(string fieldName)\r\n    //        where TData : IPageMetaData\r\n    //    {\r\n    //        if (string.IsNullOrWhiteSpace(fieldName)) throw new ArgumentNullException(\"fieldName\");\r\n\r\n    //        return this.Implementation.GetPageMetaData<TData>(fieldName);\r\n    //    }\r\n\r\n\r\n\r\n    //    public TData GetPageMetaData<TData>(string fieldName, Guid pageId)\r\n    //        where TData : IPageMetaData\r\n    //    {\r\n    //        if (string.IsNullOrWhiteSpace(fieldName)) throw new ArgumentNullException(\"fieldName\");\r\n\r\n    //        return this.Implementation.GetPageMetaData<TData>(fieldName, pageId);\r\n    //    }\r\n\r\n\r\n\r\n    //    public IQueryable<TData> GetPageMetaData<TData>(string fieldName, SitemapScope scope)\r\n    //        where TData : IPageMetaData\r\n    //    {\r\n    //        if (string.IsNullOrWhiteSpace(fieldName)) throw new ArgumentNullException(\"fieldName\");\r\n    //        if ((scope < SitemapScope.Current) || (scope > SitemapScope.SiblingsAndSelf)) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n    //        return this.Implementation.GetPageMetaData<TData>(fieldName, scope);\r\n    //    }\r\n\r\n\r\n\r\n    //    public IQueryable<TData> GetPageMetaData<TData>(string fieldName, SitemapScope scope, Guid pageId)\r\n    //        where TData : IPageMetaData\r\n    //    {\r\n    //        if (string.IsNullOrWhiteSpace(fieldName)) throw new ArgumentNullException(\"fieldName\");\r\n    //        if ((scope < SitemapScope.Current) || (scope > SitemapScope.SiblingsAndSelf)) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n    //        return this.Implementation.GetPageMetaData<TData>(fieldName, scope, pageId);\r\n    //    }\r\n\r\n\r\n\r\n    //    public IQueryable<TData> GetPageData<TData>()\r\n    //        where TData : IPageData\r\n    //    {\r\n    //        return this.Implementation.GetPageData<TData>();\r\n    //    }\r\n\r\n\r\n\r\n    //    public IQueryable<TData> GetPageData<TData>(SitemapScope scope)\r\n    //        where TData : IPageData\r\n    //    {\r\n    //        if ((scope < SitemapScope.Current) || (scope > SitemapScope.SiblingsAndSelf)) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n    //        return this.Implementation.GetPageData<TData>(scope);\r\n    //    }\r\n\r\n\r\n\r\n    //    public IQueryable<TData> GetPageData<TData>(SitemapScope scope, Guid sourcePageId)\r\n    //        where TData : IPageData\r\n    //    {\r\n    //        if ((scope < SitemapScope.Current) || (scope > SitemapScope.SiblingsAndSelf)) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n    //        return this.Implementation.GetPageData<TData>(scope, sourcePageId);\r\n    //    }\r\n\r\n\r\n\r\n    //    public SitemapNavigator SitemapNavigator\r\n    //    {\r\n    //        get\r\n    //        {\r\n    //            return _sitemapNavigator.Implementation;\r\n    //        }\r\n    //    }\r\n\r\n\r\n\r\n    //    public DataConnection DataConnection\r\n    //    {\r\n    //        get\r\n    //        {\r\n    //            return _dataConnection.Implementation;\r\n    //        }\r\n    //    }\r\n\r\n\r\n\r\n    //    public void Dispose()\r\n    //    {\r\n    //        Dispose(true);\r\n    //        GC.SuppressFinalize(this);\r\n    //    }\r\n\r\n\r\n\r\n    //    ~PageDataConnection()\r\n    //    {\r\n    //        Dispose(false);\r\n    //    }\r\n\r\n\r\n\r\n    //    protected virtual void Dispose(bool disposing)\r\n    //    {\r\n    //        if (disposing)\r\n    //        {\r\n    //            if (_dataConnection != null)\r\n    //            {\r\n    //                _dataConnection.DisposeImplementation();\r\n    //                _sitemapNavigator.DisposeImplementation();\r\n    //            }\r\n    //        }\r\n    //    }\r\n    //}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PageFolderFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Transactions;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PageFolderFacade\r\n    {\r\n        private static readonly string PageFolderType_PageIdFieldName = \"PageId\";\r\n        private static readonly string PageFolderType_IdFieldName = \"Id\";\r\n        \r\n\r\n\r\n        /// <summary>\r\n        /// Returns all possible page folder types. This is NOT all types that only have been defined on any pages\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static IEnumerable<Type> GetAllFolderTypes()\r\n        {\r\n            return DataAssociationRegistry.GetAssociationTypes(typeof(IPage), DataAssociationType.Aggregation);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given page has any folder definitions defined on it\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <returns></returns>\r\n        public static bool HasFolderDefinitions(this IPage page)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n\r\n            Guid pageId = page.Id;\r\n\r\n            var definitions = DataFacade.GetData<IPageFolderDefinition>();\r\n\r\n            return definitions.IsEnumerableQuery() \r\n                ? definitions.AsEnumerable().Any(f => f.PageId == pageId)\r\n                : definitions.Any(f => f.PageId == pageId);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns (if any) folder types that are defined on the given page\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<Type> GetDefinedFolderTypes(this IPage page)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n\r\n            var folderDefinitions = DataFacade.GetData<IPageFolderDefinition>();\r\n\r\n            IEnumerable<Guid> typeIds;\r\n\r\n            if (folderDefinitions.IsEnumerableQuery())\r\n            {\r\n                typeIds = folderDefinitions\r\n                            .Evaluate()\r\n                            .Where(f => f.PageId == page.Id)\r\n                            .Select(f => f.FolderTypeId);\r\n            }\r\n            else\r\n            {\r\n                typeIds = folderDefinitions\r\n                            .Where(f => f.PageId == page.Id)\r\n                            .Select(f => f.FolderTypeId)\r\n                            .Evaluate();\r\n            }\r\n\r\n            foreach (Guid typeId in typeIds)\r\n            {\r\n                var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeId);\r\n                Verify.IsNotNull(dataTypeDescriptor, \"Missing a page data folder type with id '{0}', referenced by a IPageFolderDefinition record\", typeId);\r\n                \r\n                yield return TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the id of a folder definition given the page and folder type\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <param name=\"folderType\"></param>\r\n        /// <returns></returns>\r\n        public static Guid GetFolderDefinitionId(this IPage page, Type folderType)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n\r\n            return GetFolderDefinitionId(page, folderType.GetImmutableTypeId());\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the id (or empty guid if non exists) of a folder definition given the page and folder type id\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <param name=\"folderTypeId\"></param>\r\n        /// <returns></returns>\r\n        public static Guid GetFolderDefinitionId(this IPage page, Guid folderTypeId)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n\r\n            return\r\n                DataFacade.GetData<IPageFolderDefinition>().\r\n                Where(f => f.PageId == page.Id && f.FolderTypeId == folderTypeId).\r\n                Select(f => f.Id).\r\n                SingleOrDefault();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool HasFolderData(this IPage page, Type pageFolderType)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n\r\n            //TODO: Consider caching here            \r\n            ParameterExpression parameterExpression = Expression.Parameter(pageFolderType);\r\n\r\n            LambdaExpression lambdaExpression = Expression.Lambda(\r\n                Expression.Equal(\r\n                    Expression.Property(\r\n                        parameterExpression,\r\n                        PageMetaDataFacade.GetDefinitionPageReferencePropertyInfo(pageFolderType)\r\n                    ),\r\n                    Expression.Constant(\r\n                        page.Id,\r\n                        typeof(Guid)\r\n                    )\r\n                ),\r\n                parameterExpression\r\n            );\r\n\r\n            Expression whereExpression = ExpressionCreator.Where(DataFacade.GetData(pageFolderType).Expression, lambdaExpression);\r\n\r\n            //TODO: Possible optimization here\r\n            return DataFacade.GetData(pageFolderType).Provider.CreateQuery(whereExpression).ToEnumerableOfObjects().Any();\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns all folder data given the page and folder data type\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <param name=\"pageFolderType\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<IData> GetFolderData(this IPage page, Type pageFolderType)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n\r\n            return GetFolderData(page.Id, pageFolderType);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns all folder data given the page id and folder data type\r\n        /// </summary>\r\n        /// <param name=\"pageId\"></param>\r\n        /// <param name=\"pageFolderType\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<IData> GetFolderData(Guid pageId, Type pageFolderType)\r\n        {\r\n            //TODO: Consider caching here            \r\n            ParameterExpression parameterExpression = Expression.Parameter(pageFolderType);\r\n\r\n            LambdaExpression lambdaExpression = Expression.Lambda(\r\n                Expression.Equal(\r\n                    Expression.Property(\r\n                        parameterExpression,\r\n                        PageMetaDataFacade.GetDefinitionPageReferencePropertyInfo(pageFolderType)\r\n                    ),\r\n                    Expression.Constant(\r\n                        pageId,\r\n                        typeof(Guid)\r\n                    )\r\n                ),\r\n                parameterExpression\r\n            );\r\n\r\n            Expression whereExpression = ExpressionCreator.Where(DataFacade.GetData(pageFolderType).Expression, lambdaExpression);\r\n\r\n            IEnumerable<IData> dataset = ExpressionHelper.GetCastedObjects<IData>(pageFolderType, whereExpression);\r\n\r\n            return dataset;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns all folder data for all defined folder types for the given page\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<IData> GetFolderData(this IPage page)\r\n        {\r\n            foreach (Type folderType in page.GetDefinedFolderTypes())\r\n            {\r\n                foreach (IData data in page.GetFolderData(folderType))\r\n                {\r\n                    yield return data;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the referenced page\r\n        /// </summary>\r\n        /// <param name=\"folderData\"></param>\r\n        /// <returns></returns>\r\n        public static IPage GetReferencedPage(IData folderData)\r\n        {\r\n            Guid pageId = (Guid)GetDefinitionPageReferencePropertyInfo(folderData.DataSourceId.InterfaceType).GetValue(folderData, null);\r\n\r\n            return Composite.Data.PageManager.GetPageById(pageId);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a data folder type to the given page\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <param name=\"dataFolderType\"></param>\r\n        // Overload\r\n        public static void AddFolderDefinition(this IPage page, Type dataFolderType)\r\n        {\r\n            AddFolderDefinition(page, dataFolderType.GetImmutableTypeId());\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a data folder type to the given page\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <param name=\"dataFolderTypeId\"></param>\r\n        public static void AddFolderDefinition(this IPage page, Guid dataFolderTypeId)\r\n        {\r\n            var pageFolderDefinition = DataFacade.BuildNew<IPageFolderDefinition>();\r\n            pageFolderDefinition.Id = Guid.NewGuid();\r\n            pageFolderDefinition.PageId = page.Id;\r\n            pageFolderDefinition.FolderTypeId = dataFolderTypeId;\r\n\r\n            DataFacade.AddNew<IPageFolderDefinition>(pageFolderDefinition);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Removes a data folder type for the given page\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <param name=\"dataFolderType\"></param>\r\n        /// <param name=\"deleteExistingFolderData\"></param>\r\n        public static void RemoveFolderDefinition(this IPage page, Type dataFolderType, bool deleteExistingFolderData = true)\r\n        {\r\n            Guid dataFolderTypeId = dataFolderType.GetImmutableTypeId();\r\n\r\n            if (!deleteExistingFolderData)\r\n            {\r\n                RemoveFolderDefinitionInternal(page.Id, dataFolderTypeId);\r\n                return;\r\n            }\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataFacade.ForEachDataScope(dataFolderType, () =>\r\n                {\r\n                    IEnumerable<IData> dataset = page.GetFolderData(dataFolderType);\r\n                    DataFacade.Delete(dataset);\r\n                });\r\n\r\n\r\n                RemoveFolderDefinitionInternal(page.Id, dataFolderTypeId);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Removes a data folder type for the given page\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <param name=\"dataFolderTypeId\"></param>\r\n        /// <param name=\"deleteExistingFolderData\"></param>\r\n        public static void RemoveFolderDefinition(this IPage page, Guid dataFolderTypeId, bool deleteExistingFolderData = true)\r\n        {\r\n            var interfaceType = DynamicTypeManager.GetDataTypeDescriptor(dataFolderTypeId).GetInterfaceType();\r\n\r\n            RemoveFolderDefinition(page, interfaceType, deleteExistingFolderData);\r\n        }\r\n\r\n        private static void RemoveFolderDefinitionInternal(Guid pageId, Guid dataFolderTypeId)\r\n        {\r\n            IPageFolderDefinition pageFolderDefinition =\r\n                    DataFacade.GetData<IPageFolderDefinition>()\r\n                    .FirstOrDefault(f => f.PageId == pageId && f.FolderTypeId == dataFolderTypeId);\r\n\r\n            Verify.IsNotNull(pageFolderDefinition, \"Page folder definition does not exist\");\r\n\r\n            DataFacade.Delete<IPageFolderDefinition>(pageFolderDefinition);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Removes all data folder definitions given the folder type id\r\n        /// </summary>\r\n        /// <param name=\"dataFolderTypeId\"></param>\r\n        /// <param name=\"deleteExistingFolderData\"></param>\r\n        public static void RemoveAllFolderDefinitions(Guid dataFolderTypeId, bool deleteExistingFolderData = true)\r\n        {\r\n            if (deleteExistingFolderData)\r\n            {\r\n                IEnumerable<IPageFolderDefinition> pageFolderDefinitions =\r\n                    DataFacade.GetData<IPageFolderDefinition>().\r\n                    Where(f => f.FolderTypeId == dataFolderTypeId);\r\n\r\n                foreach (IPageFolderDefinition pageFolderDefinition in pageFolderDefinitions)\r\n                {\r\n                    IPage page = Composite.Data.PageManager.GetPageById(pageFolderDefinition.Id);\r\n\r\n                    page.RemoveFolderDefinition(pageFolderDefinition.FolderTypeId);\r\n                }\r\n\r\n                DataFacade.Delete<IPageFolderDefinition>(pageFolderDefinitions);\r\n            }\r\n            else\r\n            {\r\n                IEnumerable<IPageFolderDefinition> pageFolderDefinitions =\r\n                    DataFacade.GetData<IPageFolderDefinition>().\r\n                    Where(f => f.FolderTypeId == dataFolderTypeId);\r\n\r\n                DataFacade.Delete<IPageFolderDefinition>(pageFolderDefinitions);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Updates the given page folder item with new Id and setting the page folder definition id and defining item id\r\n        /// </summary>\r\n        /// <param name=\"pageFolderData\"></param>        \r\n        /// <param name=\"definingPage\"></param>\r\n        [Obsolete(\"Use an overload accepting a page Id\")]\r\n        public static void AssignFolderDataSpecificValues(IData pageFolderData, IPage definingPage)\r\n        {\r\n            AssignFolderDataSpecificValues(pageFolderData, definingPage.Id);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Updates the given page folder item with new Id and setting the page folder definition id and defining item id\r\n        /// </summary>\r\n        /// <param name=\"pageFolderData\"></param>        \r\n        /// <param name=\"pageId\"></param>\r\n        public static void AssignFolderDataSpecificValues(IData pageFolderData, Guid pageId)\r\n        {\r\n            var pageRelatedData = pageFolderData as IPageRelatedData;\r\n            if (pageRelatedData != null)\r\n            {\r\n                pageRelatedData.PageId = pageId;\r\n            }\r\n            else\r\n            {\r\n                // Backward compatibility\r\n                Type interfaceType = pageFolderData.DataSourceId.InterfaceType;\r\n                PropertyInfo pageReferencePropertyInfo = GetDefinitionPageReferencePropertyInfo(interfaceType);\r\n                pageReferencePropertyInfo.SetValue(pageFolderData, pageId, null);\r\n            }\r\n\r\n            var pageData = pageFolderData as IPageData;\r\n            if (pageData != null)\r\n            {\r\n                pageData.Id = Guid.NewGuid();\r\n            }\r\n            else\r\n            {\r\n                // Backward compatibility\r\n                Type interfaceType = pageFolderData.DataSourceId.InterfaceType;\r\n                PropertyInfo idPropertyInfo = interfaceType.GetPropertiesRecursively()\r\n                    .FirstOrDefault(f => f.Name == PageFolderType_IdFieldName);\r\n\r\n                if (idPropertyInfo != null && idPropertyInfo.PropertyType == typeof(Guid))\r\n                {\r\n                    idPropertyInfo.SetValue(pageFolderData, Guid.NewGuid(), null);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static PropertyInfo GetDefinitionPageReferencePropertyInfo(Type pageFolderType)\r\n        {\r\n            return pageFolderType.GetPropertiesRecursively().Last(f => f.Name == PageFolderType_PageIdFieldName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PageManager.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Provides basic data access to IPage and IPageStructure data\r\n    /// </summary>\r\n    /// <exclude />\r\n    // Made public for Base site in App_Code/Composite/BasicSearch.cs\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PageManager\r\n    {\r\n        private static readonly string LogTitle = \"PageManager\";\r\n\r\n        private class PageStructureRecord\r\n        {\r\n            public PageStructureRecord() { }\r\n\r\n            public PageStructureRecord(IPageStructure ps)\r\n            {\r\n                ParentId = ps.ParentId;\r\n                LocalOrdering = ps.LocalOrdering;\r\n            } \r\n\r\n            public Guid ParentId { get; set; }\r\n            public int LocalOrdering { get; set; }\r\n        }\r\n\r\n        private static readonly int PageCacheSize = 5000;\r\n        private static readonly int PageStructureCacheSize = 3000;\r\n        private static readonly int ChildrenCacheSize = 2000;\r\n        private static readonly int PagePlaceholderCacheSize = 10000;\r\n\r\n        private static readonly Cache<string, IReadOnlyCollection<IPage>> _pageCache = new Cache<string, IReadOnlyCollection<IPage>>(\"Pages\", PageCacheSize);\r\n        private static readonly Cache<string, ReadOnlyCollection<IPagePlaceholderContent>> _placeholderCache = new Cache<string, ReadOnlyCollection<IPagePlaceholderContent>>(\"Page placeholders\", PagePlaceholderCacheSize);\r\n        private static readonly Cache<Guid, ExtendedNullable<PageStructureRecord>> _pageStructureCache = new Cache<Guid, ExtendedNullable<PageStructureRecord>>(\"Page structure\", PageStructureCacheSize);\r\n        private static readonly Cache<Guid, ReadOnlyCollection<Guid>> _childrenCache = new Cache<Guid, ReadOnlyCollection<Guid>>(\"Child pages\", ChildrenCacheSize);\r\n\r\n        private static readonly object _preloadingSyncRoot = new object();\r\n        private static bool _pageStructurePreloaded;\r\n        private static readonly HashSet<string> _preloadedPageDataScopes = new HashSet<string>();\r\n\r\n\r\n        static PageManager()\r\n        {\r\n            SubscribeToEvents();\r\n        }\r\n\r\n        #region Public methods\r\n\r\n        /// <exclude />\r\n        public static IPage GetPageById(Guid id)\r\n        {\r\n            return GetPageById(id, false);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IPage GetPageById(Guid id, bool readonlyValue)\r\n        {\r\n            var versions = GetAllPageVersions(id);\r\n            if (versions == null || versions.Count == 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            IEnumerable<IPage> filteredVersions = versions;\r\n            foreach (var dataInterceptor in DataFacade.GetDataInterceptors(typeof(IPage)))\r\n            {\r\n                filteredVersions = dataInterceptor.InterceptGetData(filteredVersions);\r\n            }\r\n\r\n            var result = filteredVersions.FirstOrDefault();\r\n            if (result == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return readonlyValue ? result : CreateWrapper(result);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IPage GetPageById(Guid id, Guid versionId, bool readonlyValue = false)\r\n        {\r\n            var versions = GetAllPageVersions(id);\r\n            if (versions == null || versions.Count == 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var result = versions.FirstOrDefault(v => v.VersionId == versionId);\r\n            if (result == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return readonlyValue ? result : CreateWrapper(result);\r\n        }\r\n\r\n        private static IReadOnlyCollection<IPage> GetAllPageVersions(Guid pageId)\r\n        {\r\n            string cacheKey = GetCacheKey<IPage>(pageId, Guid.Empty);\r\n            IReadOnlyCollection<IPage> allPageVersions = _pageCache.Get(cacheKey);\r\n\r\n            if (allPageVersions == null)\r\n            {\r\n                using (var conn = new DataConnection())\r\n                {\r\n                    conn.DisableServices();\r\n\r\n                    allPageVersions = new ReadOnlyCollection<IPage>(\r\n                        conn.Get<IPage>().Where(p => p.Id == pageId).ToList()\r\n                    );\r\n                }\r\n\r\n                _pageCache.Add(cacheKey, allPageVersions);\r\n            }\r\n            \r\n            return allPageVersions;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use GetParentId(..)\", true)]\r\n        public static Guid GetParentID(Guid pageId)\r\n        {\r\n            return GetParentId(pageId);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Guid GetParentId(Guid pageId)\r\n        {\r\n            PageStructureRecord pageStructure = GetPageStructureRecord(pageId);\r\n            return pageStructure?.ParentId ?? Guid.Empty;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static int GetLocalOrdering(Guid pageId)\r\n        {\r\n            PageStructureRecord pageStructure = GetPageStructureRecord(pageId);\r\n            return pageStructure?.LocalOrdering ?? 0;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"parentPageId\">Empty guild will yield all root pages</param>\r\n        /// <returns></returns>\r\n        public static ReadOnlyCollection<Guid> GetChildrenIDs(Guid parentPageId)\r\n        {\r\n            var cacheKey = parentPageId;\r\n            var cachedValue = _childrenCache.Get(cacheKey);\r\n\r\n            if (cachedValue != null)\r\n            {\r\n                return cachedValue;\r\n            }\r\n\r\n            // TODO: put children's page structure records into cache\r\n            List<Guid> children = (from ps in DataFacade.GetData<IPageStructure>()\r\n                                   where ps.ParentId == parentPageId\r\n                                   orderby ps.LocalOrdering\r\n                                   select ps.Id).ToList();\r\n\r\n            var readonlyList = new ReadOnlyCollection<Guid>(children);\r\n\r\n            _childrenCache.Add(cacheKey, readonlyList);\r\n\r\n            return readonlyList;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use an overload also accepting a version id\")]\r\n        public static ReadOnlyCollection<IPagePlaceholderContent> GetPlaceholderContent(Guid pageId)\r\n        {\r\n            IPage page = GetPageById(pageId);\r\n\r\n            return GetPlaceholderContent(pageId, page.VersionId);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static ReadOnlyCollection<IPagePlaceholderContent> GetPlaceholderContent(Guid pageId, Guid versionId)\r\n        {\r\n            string cacheKey = GetCacheKey<IPagePlaceholderContent>(pageId, versionId);\r\n            var result = _placeholderCache.Get(cacheKey);\r\n\r\n            if (result == null)\r\n            {\r\n                using (var conn = new DataConnection())\r\n                {\r\n                    conn.DisableServices();\r\n\r\n                    var list = DataFacade.GetData<IPagePlaceholderContent>(false)\r\n                        .Where(f => f.PageId == pageId && f.VersionId == versionId).ToList();\r\n\r\n                    result = new ReadOnlyCollection<IPagePlaceholderContent>(list);\r\n                }\r\n\r\n                _placeholderCache.Add(cacheKey, result);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        #endregion Public\r\n\r\n        internal static void PreloadPageCaching()\r\n        {\r\n            string key = DataScopeManager.CurrentDataScope.ToString() + LocalizationScopeManager.CurrentLocalizationScope;\r\n\r\n            if (!_preloadedPageDataScopes.Contains(key))\r\n            {\r\n                lock (_preloadingSyncRoot)\r\n                {\r\n                    if (!_preloadedPageDataScopes.Contains(key))\r\n                    {\r\n                        using (var conn = new DataConnection())\r\n                        {\r\n                            conn.DisableServices();\r\n\r\n                            var pages = DataFacade.GetData<IPage>().GroupBy(p => p.Id).Evaluate();\r\n                            if (pages.Count > 0)\r\n                            {\r\n                                var dataSourceId = pages.First().First().DataSourceId;\r\n\r\n                                foreach (var pageVersionsGroup in pages)\r\n                                {\r\n                                    string pageKey = GetCacheKey(pageVersionsGroup.Key, dataSourceId);\r\n                                    _pageCache.Add(pageKey, new ReadOnlyCollection<IPage>(pageVersionsGroup.ToList()));\r\n                                }\r\n                            }\r\n                        }\r\n\r\n                        _preloadedPageDataScopes.Add(key);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (!_pageStructurePreloaded)\r\n            {\r\n                lock (_preloadingSyncRoot)\r\n                {\r\n                    if (!_pageStructurePreloaded)\r\n                    {\r\n                        var pageStructures = DataFacade.GetData<IPageStructure>().Evaluate();\r\n\r\n                        foreach (var str in pageStructures)\r\n                        {\r\n                            _pageStructureCache.Add(str.Id, new ExtendedNullable<PageStructureRecord> {Value = new PageStructureRecord(str)});\r\n                        }\r\n\r\n                        foreach (var pair in pageStructures.GroupBy(ps => ps.ParentId))\r\n                        {\r\n                            _childrenCache.Add(pair.Key, new ReadOnlyCollection<Guid>(\r\n                                pair\r\n                                .OrderBy(p => p.LocalOrdering)\r\n                                .Select(v => v.Id).ToList()));\r\n                        }\r\n\r\n                        _pageStructurePreloaded = true;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        #region Private\r\n\r\n        private static PageStructureRecord GetPageStructureRecord(Guid pageId)\r\n        {\r\n            var cacheKey = pageId;\r\n            ExtendedNullable<PageStructureRecord> cachedValue = _pageStructureCache.Get(cacheKey);\r\n\r\n            if (cachedValue != null)\r\n            {\r\n                Verify.That(cachedValue.HasValue, \"Incorrect usage of cache.\");\r\n                return cachedValue.Value;\r\n            }\r\n\r\n            PageStructureRecord result =\r\n                         (from ps in DataFacade.GetData<IPageStructure>(false)\r\n                          where ps.Id == pageId\r\n                          select new PageStructureRecord\r\n                          {\r\n                              ParentId = ps.ParentId,\r\n                              LocalOrdering = ps.LocalOrdering\r\n                          }).FirstOrDefault();\r\n\r\n            if (result == null)\r\n            {\r\n                Log.LogWarning(LogTitle, $\"No IPageStructure entries found for Page with Id '{pageId}'\");\r\n            }\r\n\r\n            _pageStructureCache.Add(cacheKey, result);\r\n\r\n            return result;\r\n        }\r\n\r\n        private static string GetCacheKey<T>(Guid id, Guid versionId)\r\n        {\r\n            var cultureInfo = LocalizationScopeManager.MapByType(typeof (T));\r\n            Verify.IsNotNull(cultureInfo, \"Localization culture is not set\");\r\n\r\n            var dataScope = DataScopeManager.MapByType(typeof (T));\r\n            Verify.IsNotNull(dataScope, \"Publication scope is not set\");\r\n\r\n            return id + dataScope.Name + cultureInfo + (versionId != Guid.Empty ? versionId.ToString() : \"\");\r\n        }\r\n\r\n        private static string GetCacheKey(Guid id, DataSourceId dataSourceId)\r\n        {\r\n            return GetCacheKey(id, Guid.Empty, dataSourceId);\r\n        }\r\n\r\n        private static string GetCacheKey(Guid id, Guid versionId, DataSourceId dataSourceId)\r\n        {\r\n            string localizationInfo = dataSourceId.LocaleScope.ToString();\r\n            string dataScope = dataSourceId.DataScopeIdentifier.Name;\r\n            string versionIdStr = versionId != Guid.Empty ? versionId.ToString() : \"\";\r\n            return id + dataScope + localizationInfo + versionIdStr;\r\n        }\r\n\r\n        private static void OnPageStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                _pageCache.Clear();\r\n\r\n                lock (_preloadingSyncRoot)\r\n                {\r\n                    _preloadedPageDataScopes.Clear();\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void OnPageChanged(object sender, DataEventArgs args)\r\n        {\r\n            if (args.Data is IPage page)\r\n            {\r\n                _pageCache.Remove(GetCacheKey(page.Id, page.DataSourceId));\r\n            }\r\n        }\r\n\r\n\r\n        private static void OnPagePlaceholderStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                _placeholderCache.Clear();\r\n            }\r\n        }\r\n\r\n        private static void OnPagePlaceholderChanged(object sender, DataEventArgs args)\r\n        {\r\n            if (args.Data is IPagePlaceholderContent placeHolder)\r\n            {\r\n                _placeholderCache.Remove(GetCacheKey(placeHolder.PageId, placeHolder.VersionId, placeHolder.DataSourceId));\r\n            }\r\n        }\r\n\r\n\r\n        private static void OnPageStructureStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                _pageStructureCache.Clear();\r\n                _childrenCache.Clear();\r\n                _pageStructurePreloaded = false;\r\n            }\r\n        }\r\n\r\n        private static void OnPageStructureChanged(object sender, DataEventArgs args)\r\n        {\r\n            if (args.Data is IPageStructure pageStructure)\r\n            {\r\n                _pageStructureCache.Remove(pageStructure.Id);\r\n                _childrenCache.Remove(pageStructure.ParentId);\r\n            }\r\n        }\r\n\r\n        private static IPage CreateWrapper(IPage page)\r\n        {\r\n            return DataWrappingFacade.Wrap(page);\r\n        }\r\n\r\n        private static void SubscribeToEvents()\r\n        {\r\n            DataEventSystemFacade.SubscribeToDataDeleted<IPagePlaceholderContent>(OnPagePlaceholderChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IPagePlaceholderContent>(OnPagePlaceholderChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd<IPagePlaceholderContent>(OnPagePlaceholderChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IPagePlaceholderContent>(OnPagePlaceholderStoreChanged, true);\r\n\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IPage>(OnPageChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd<IPage>(OnPageChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<IPage>(OnPageChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IPage>(OnPageStoreChanged, true);\r\n\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd<IPageStructure>(OnPageStructureChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IPageStructure>(OnPageStructureChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<IPageStructure>(OnPageStructureChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IPageStructure>(OnPageStructureStoreChanged, true);\r\n        }\r\n\r\n       #endregion Private\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PageMetaDataDescription.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    internal sealed class PageMetaDataDescriptionSerializerHandler : ISerializerHandler\r\n    {\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            PageMetaDataDescription dataAssociationVisabilityRule = (PageMetaDataDescription)objectToSerialize;\r\n\r\n            return dataAssociationVisabilityRule.Serialize();\r\n        }\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            return PageMetaDataDescription.Deserialize(serializedObject);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// This class is used when adding a new page metadata type to a given page. In other words, in workflow only.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SerializerHandler(typeof(PageMetaDataDescriptionSerializerHandler))]\r\n    public sealed class PageMetaDataDescription\r\n    {\r\n        /// <exclude />\r\n        public static PageMetaDataDescription OneToOne() { return new PageMetaDataDescription(PageMetaDataDescriptionType.OneToOne); }\r\n\r\n        /// <exclude />\r\n        public static PageMetaDataDescription Branch() { return new PageMetaDataDescription(PageMetaDataDescriptionType.Branch, 0, 100000); }\r\n\r\n        /// <exclude />\r\n        public static PageMetaDataDescription Branch(int startLevel) { return new PageMetaDataDescription(PageMetaDataDescriptionType.Branch, startLevel, int.MaxValue); }\r\n\r\n        /// <exclude />\r\n        public static PageMetaDataDescription Branch(int startLevel, int levels) { return new PageMetaDataDescription(PageMetaDataDescriptionType.Branch, startLevel, levels); }\r\n\r\n\r\n\r\n        internal PageMetaDataDescription(PageMetaDataDescriptionType dataAssociationVisabilityRuleType)\r\n            : this(dataAssociationVisabilityRuleType, 0, 0)\r\n        {\r\n        }\r\n        \r\n       \r\n\r\n        internal PageMetaDataDescription(PageMetaDataDescriptionType dataAssociationVisabilityRuleType, int startLevel, int levels)\r\n        {\r\n            this.PageMetaDataDescriptionType = dataAssociationVisabilityRuleType;\r\n            this.StartLevel = startLevel;\r\n            this.Levels = levels;            \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PageMetaDataDescriptionType PageMetaDataDescriptionType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int StartLevel\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int Levels\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Serialize()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"_PageMetaDataDescriptionType_\", this.PageMetaDataDescriptionType.ToString());\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"_StartLevel_\", this.StartLevel.ToString());\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"_Levels_\", this.Levels.ToString());           \r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        internal static PageMetaDataDescription Deserialize(string serializedData)\r\n        {\r\n            // DataAssociationVisabilityRuleType is here for backwards compatibility - after 1.3 its not used any more\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n            if (((dic.ContainsKey(\"DataAssociationVisabilityRuleType\") == false) && (dic.ContainsKey(\"_PageMetaDataDescriptionType_\") == false)) ||\r\n                (dic.ContainsKey(\"_StartLevel_\") == false) ||\r\n                (dic.ContainsKey(\"_Levels_\") == false))\r\n            {\r\n                throw new ArgumentException(string.Format(\"The serializedData is not a serialized '{0}'\", typeof(PageMetaDataDescription)), \"serializedData\");\r\n            }\r\n\r\n            string serializedDataAssociationVisabilityRuleType;\r\n            if (dic.ContainsKey(\"_PageMetaDataDescriptionType_\"))\r\n            {\r\n                serializedDataAssociationVisabilityRuleType = StringConversionServices.DeserializeValueString(dic[\"_PageMetaDataDescriptionType_\"]);\r\n            }\r\n            else\r\n            {\r\n                serializedDataAssociationVisabilityRuleType = StringConversionServices.DeserializeValueString(dic[\"DataAssociationVisabilityRuleType\"]);\r\n            }\r\n\r\n            PageMetaDataDescriptionType type = (PageMetaDataDescriptionType)Enum.Parse(typeof(PageMetaDataDescriptionType), serializedDataAssociationVisabilityRuleType);            \r\n\r\n            string serializedStartLevel = StringConversionServices.DeserializeValueString(dic[\"_StartLevel_\"]);\r\n            string serializedLevels = StringConversionServices.DeserializeValueString(dic[\"_Levels_\"]);\r\n            \r\n            int startLevel = int.Parse(serializedStartLevel);\r\n            int levels = int.Parse(serializedLevels);\r\n\r\n            return new PageMetaDataDescription(type, startLevel, levels);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as PageMetaDataDescription);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool Equals(PageMetaDataDescription dataAssociationVisabilityRule)\r\n        {\r\n            if (dataAssociationVisabilityRule == null) return false;\r\n\r\n            return\r\n                this.PageMetaDataDescriptionType == dataAssociationVisabilityRule.PageMetaDataDescriptionType &&\r\n                this.StartLevel == dataAssociationVisabilityRule.StartLevel &&\r\n                this.Levels == dataAssociationVisabilityRule.Levels;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return\r\n                this.PageMetaDataDescriptionType.GetHashCode() ^\r\n                this.StartLevel.GetHashCode() ^\r\n                this.Levels.GetHashCode();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum PageMetaDataDescriptionType\r\n    {\r\n        /// <exclude />\r\n        OneToOne = 0,\r\n\r\n        /// <exclude />\r\n        Branch = 1,\r\n\r\n        /// <exclude />\r\n        PageType = 2\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PageMetaDataFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Transactions;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Using the same name for a metadata definition is allowed iff metadata type and label are the same\r\n    /// on all instances.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PageMetaDataFacade\r\n    {\r\n        private static readonly Guid DefaultCompositionContainerId = new Guid(\"eb210a75-be25-401f-b0d4-b3787bce36fa\");\r\n\r\n        /// <summary>\r\n        /// Returns all possible meta data types. This is NOT types that only have been defined on any pages or page type\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static IEnumerable<Type> GetAllMetaDataTypes()\r\n        {\r\n            return DataAssociationRegistry.GetAssociationTypes(typeof(IPage), DataAssociationType.Composition);\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns all meta data types that are defined on the given page.\r\n        /// </summary>\r\n        /// <param name=\"page\">If this is null, Guid.Empty is assumed as defining item id</param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<Type> GetDefinedMetaDataTypes(this IPage page)\r\n        {\r\n            Guid pageId = page.GetPageIdOrNull();\r\n\r\n            IEnumerable<Guid> metaDataTypeIds =\r\n                DataFacade.GetData<IPageMetaDataDefinition>().\r\n                Where(f => f.DefiningItemId == pageId).\r\n                Select(f => f.MetaDataTypeId).\r\n                Distinct();\r\n\r\n            foreach (Guid metaDataTypeId in metaDataTypeIds)\r\n            {\r\n                var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(metaDataTypeId);\r\n\r\n                yield return TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Tuple<Type, string>> GetDefinedMetaDataTypeAndNames(this IPage page)\r\n        {\r\n            Guid pageId = page.GetPageIdOrNull();\r\n\r\n            IEnumerable<Tuple<Guid, string>> metaDataTypeIdAndNames =\r\n                DataFacade.GetData<IPageMetaDataDefinition>().\r\n                Where(f => f.DefiningItemId == pageId).\r\n                Select(f => new Tuple<Guid, string>(f.MetaDataTypeId, f.Name)).\r\n                Distinct();\r\n\r\n            foreach (Tuple<Guid, string> metaDataTypeIdAndName in metaDataTypeIdAndNames)\r\n            {\r\n                var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(metaDataTypeIdAndName.Item1);\r\n\r\n                yield return new Tuple<Type, string>(TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName), metaDataTypeIdAndName.Item2);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns a pagemeta data definition given the defining item id or null if none exists.\r\n        /// </summary>\r\n        /// <param name=\"definingItemId\"></param>\r\n        /// <param name=\"name\"></param>\r\n        /// <returns></returns>\r\n        public static IPageMetaDataDefinition GetMetaDataDefinition(Guid definingItemId, string name)\r\n        {\r\n            return DataFacade.GetData<IPageMetaDataDefinition>().\r\n                   Where(f => f.DefiningItemId == definingItemId && f.Name == name).\r\n                   SingleOrDefaultOrException(\"Multiple metadata definitions on the same item. Name: '{0}', ItemId: '{1}'\", name, definingItemId);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the composition container given the page metadata definition name\r\n        /// </summary>\r\n        /// <param name=\"name\"></param>\r\n        /// <returns></returns>\r\n        [Obsolete()]\r\n        public static ICompositionContainer GetMetaDataContainerByDefinitionName(string name)\r\n        {\r\n            return  DataFacade.GetData<IPageMetaDataDefinition>()\r\n                    .Join(DataFacade.GetData<ICompositionContainer>(), o => o.MetaDataContainerId, i => i.Id, (def, con) => new { def, con })\r\n                    .Where(f => f.def.Name == name)\r\n                    .Select(f => f.con)\r\n                    .Distinct()\r\n                    .SingleOrDefaultOrException(\"Multiple metadata containers with the same name '{0}'\", name);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets all meta data containers ordered. If none exists in the system, a default is created\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static List<KeyValuePair<Guid, string>> GetAllMetaDataContainers()\r\n        {\r\n            List<KeyValuePair<Guid, string>> containers;\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                bool anyExists = DataFacade.GetData<ICompositionContainer>().Any();\r\n\r\n                if (!anyExists)\r\n                {\r\n                    ICompositionContainer defaultContainer = DataFacade.BuildNew<ICompositionContainer>();\r\n\r\n                    defaultContainer.Id = DefaultCompositionContainerId;\r\n                    defaultContainer.Label = \"${Composite.Management, DataCompositionVisabilityFacade.DefaultContainerLabel}\";\r\n\r\n                    DataFacade.AddNew<ICompositionContainer>(defaultContainer);\r\n                }\r\n\r\n                containers =\r\n                    DataFacade.GetData<ICompositionContainer>().\r\n                    OrderBy(f => f.Label).\r\n                    Select(f => new KeyValuePair<Guid, string>(f.Id, f.Label)).\r\n                    ToList();\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            return containers;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns all allowed metadata containers on the given page\r\n        /// </summary>\r\n        /// <param name=\"page\">If null, empty guid is used (whole website)</param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<ICompositionContainer> GetAllowedMetaDataContainers(this IPage page)\r\n        {\r\n            foreach (Guid metaDataContainerId in GetAllowedMetaDataDefinitions(page).Select(f => f.MetaDataContainerId).Distinct())\r\n            {\r\n                Guid containerId = metaDataContainerId; // moving Guid to a local variable to build a correct linq expression\r\n\r\n                yield return DataFacade.GetData<ICompositionContainer>().\r\n                             Where(f => f.Id == containerId).\r\n                             SingleOrException(\"Cannot find ICompositionContainer by ID: '{0}'\", \r\n                                               \"More than one ICompositionContainer object for the same ID: '{0}'\", containerId);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Return all allowed metadata types on the given page\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<Type> GetAllowedMetaDataTypes(this IPage page)\r\n        {\r\n            foreach (Guid metaDataTypeId in GetAllowedMetaDataDefinitions(page).Select(f => f.MetaDataTypeId).Distinct())\r\n            {\r\n                var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(metaDataTypeId);\r\n\r\n                yield return TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns all allowed metadata definitions on the given page\r\n        /// </summary>\r\n        /// <param name=\"page\">If null, empty guid is used (whole website)</param>\r\n        /// <returns></returns>\r\n        public static List<IPageMetaDataDefinition> GetAllowedMetaDataDefinitions(this IPage page)\r\n        {\r\n            IEnumerable<IPageMetaDataDefinition> pageMetaDataDefinitions =\r\n                DataFacade.\r\n                GetData<IPageMetaDataDefinition>().OrderBy(f => f.Label).\r\n                Evaluate();\r\n\r\n            List<IPageMetaDataDefinition> resultPageMetaDataDefinitions = new List<IPageMetaDataDefinition>();\r\n\r\n            foreach (IPageMetaDataDefinition pageMetaDataDefinition in pageMetaDataDefinitions)\r\n            {\r\n                if (IsDefinitionAllowed(pageMetaDataDefinition, page))\r\n                {\r\n                    if (!resultPageMetaDataDefinitions.Any(f => f.Name == pageMetaDataDefinition.Name))\r\n                    {\r\n                        resultPageMetaDataDefinitions.Add(pageMetaDataDefinition);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return resultPageMetaDataDefinitions;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given page metadata definition is allowed for the given page\r\n        /// </summary>\r\n        /// <param name=\"pageMetaDataDefinition\"></param>\r\n        /// <param name=\"page\">If null, empty guid is used (whole website)</param>\r\n        /// <returns></returns>\r\n        public static bool IsDefinitionAllowed(IPageMetaDataDefinition pageMetaDataDefinition, IPage page)\r\n        {\r\n            if (page != null && pageMetaDataDefinition.DefiningItemId == page.PageTypeId) return true;\r\n\r\n            Guid pageId = page.GetPageIdOrNull();\r\n\r\n            // Its not a pagetype attached meta data definitions, check page attacked\r\n            int levelsToParent = CountLevelsToParent(pageMetaDataDefinition.DefiningItemId, pageId);\r\n\r\n            if (pageMetaDataDefinition.StartLevel > levelsToParent) return false;\r\n            if (pageMetaDataDefinition.StartLevel + pageMetaDataDefinition.Levels < levelsToParent) return false;\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private static int CountLevelsToParent(Guid definingPageId, Guid pageId)\r\n        {\r\n            int count = 0;\r\n\r\n            while (definingPageId != pageId)\r\n            {\r\n                Guid parentPageId = Composite.Data.PageManager.GetParentId(pageId);\r\n\r\n                if (definingPageId != Guid.Empty && parentPageId == Guid.Empty) return -1; // Page is not a (sub)child of _pageId\r\n\r\n                pageId = parentPageId;\r\n                count++;\r\n            }\r\n\r\n            return count;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IData> GetMetaData(string definitionName, Type metaDataType)\r\n        {\r\n            Verify.ArgumentNotNull(definitionName, nameof(definitionName));\r\n            Verify.ArgumentNotNull(metaDataType, nameof(metaDataType));\r\n\r\n            var parameterExpression = Expression.Parameter(metaDataType);\r\n\r\n            var lambdaExpression = Expression.Lambda(\r\n                Expression.Equal(\r\n                    Expression.Property(\r\n                        parameterExpression,\r\n                        PageMetaDataFacade.GetDefinitionNamePropertyInfo(metaDataType)\r\n                    ),\r\n                    Expression.Constant(\r\n                        definitionName,\r\n                        typeof(string)\r\n                    )\r\n                ),\r\n                parameterExpression\r\n            );\r\n\r\n            var whereExpression = ExpressionCreator.Where(DataFacade.GetData(metaDataType).Expression, lambdaExpression);\r\n\r\n            IEnumerable<IData> datas = ExpressionHelper.GetCastedObjects<IData>(metaDataType, whereExpression);\r\n\r\n            return datas;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IData> GetMetaData(this IPage page)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n\r\n            return GetMetaData(page, DataScopeManager.CurrentDataScope);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IData> GetMetaData(this IPage page, DataScopeIdentifier dataScopeIdentifier)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n\r\n            using (new DataScope(dataScopeIdentifier))\r\n            {\r\n                foreach (IPageMetaDataDefinition pageMetaDataDefinition in page.GetAllowedMetaDataDefinitions())\r\n                {\r\n                    IData data = page.GetMetaData(pageMetaDataDefinition.Name, pageMetaDataDefinition.MetaDataTypeId);\r\n\r\n                    if (data != null)\r\n                    {\r\n                        yield return data;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IData GetMetaData(this IPage page, string definitionName, Guid metaDataTypeId)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(metaDataTypeId);\r\n            Type metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            return GetMetaData(page, definitionName, metaDataType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IData GetMetaData(this IPage page, string definitionName, Type metaDataType)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n\r\n            return GetMetaData(page.Id, page.VersionId, definitionName, metaDataType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IData GetMetaData(Guid pageId, Guid pageVersionId, string definitionName, Type metaDataType)\r\n        {\r\n            Verify.ArgumentNotNull(definitionName, nameof(definitionName));\r\n            Verify.ArgumentNotNull(metaDataType, nameof(metaDataType));\r\n\r\n            //TODO: Consider caching here\r\n            var parameterExpression = Expression.Parameter(metaDataType);\r\n\r\n            var lambdaExpression = Expression.Lambda(\r\n                Expression.And(\r\n                    Expression.And(\r\n                        Expression.Equal(\r\n                            Expression.Property(\r\n                                parameterExpression,\r\n                                GetDefinitionPageReferencePropertyInfo(metaDataType)\r\n                            ),\r\n                            Expression.Constant(pageId, typeof(Guid))\r\n                        ),\r\n                        Expression.Equal(\r\n                            Expression.Property(\r\n                                parameterExpression,\r\n                                GetDefinitionPageReferencePropertyVersionInfo(metaDataType)\r\n                            ),\r\n                            Expression.Constant(pageVersionId, typeof(Guid))\r\n                        )\r\n                    ),\r\n                    Expression.Equal(\r\n                        Expression.Property(\r\n                            parameterExpression,\r\n                            GetDefinitionNamePropertyInfo(metaDataType)\r\n                        ),\r\n                        Expression.Constant(definitionName, typeof(string))\r\n                    )),\r\n                parameterExpression\r\n            );\r\n\r\n            using (var conn = new DataConnection())\r\n            {\r\n                conn.DisableServices();\r\n\r\n                var whereExpression = ExpressionCreator.Where(DataFacade.GetData(metaDataType).Expression, lambdaExpression);\r\n\r\n                IEnumerable<IData> dataset = ExpressionHelper.GetCastedObjects<IData>(metaDataType, whereExpression);\r\n\r\n                return dataset.SingleOrDefaultOrException(\"There're multiple meta data on a page. Page '{0}', definition name '{1}', meta type '{2}'\",\r\n                                                          pageId, definitionName, metaDataType.FullName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets all existing pages that are affected by the given meta data definition\r\n        /// </summary>\r\n        /// <param name=\"definingPage\">If null, empty guid is used</param>\r\n        /// <param name=\"definitionName\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<IPage> GetMetaDataAffectedPages(this IPage definingPage, string definitionName)\r\n        {\r\n            Guid pageId = definingPage.GetPageIdOrNull();\r\n\r\n            IPageMetaDataDefinition pageMetaDataDefinition = GetMetaDataDefinition(pageId, definitionName);\r\n\r\n            return GetMetaDataAffectedPages(definingPage, pageMetaDataDefinition.StartLevel, pageMetaDataDefinition.Levels);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets all existing pages that are affected by the given meta data definition\r\n        /// </summary>\r\n        /// <param name=\"definingPage\"></param>\r\n        /// <param name=\"startLevel\"></param>\r\n        /// <param name=\"levels\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<IPage> GetMetaDataAffectedPages(this IPage definingPage, int startLevel, int levels)\r\n        {\r\n            List<IPage> pages;\r\n            if (definingPage != null)\r\n            {\r\n                pages = new List<IPage> { definingPage };\r\n            }\r\n            else\r\n            {\r\n                pages = new List<IPage>();\r\n\r\n                foreach (Guid pageId in Composite.Data.PageManager.GetChildrenIDs(Guid.Empty))\r\n                {\r\n                    pages.Add(Composite.Data.PageManager.GetPageById(pageId));\r\n                }\r\n                                        \r\n                startLevel--; // We have just taken one level\r\n            }\r\n\r\n            for (int i = 0; i < startLevel; i++)\r\n            {\r\n                pages = pages.SelectMany(page => page.GetChildren()).ToList();\r\n            }\r\n\r\n\r\n            for (int i = 0; i <= levels; i++)\r\n            {\r\n                if (pages.Count == 0) yield break;\r\n\r\n                foreach (IPage p in pages)\r\n                {\r\n                    yield return p;\r\n                }\r\n\r\n                pages = pages.SelectMany(page => page.GetChildren()).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IPage> GetMetaDataAffectedPagesByPageTypeId(Guid definingPageTypeId)\r\n        {\r\n            return DataFacade.GetData<IPage>().Where(f => f.PageTypeId == definingPageTypeId);\r\n        }\r\n\r\n\r\n\r\n        //public static bool IsDefinitionAllowed(string name, string label, Guid metaDataTypeId)\r\n        //{\r\n        //    return\r\n        //        DataFacade.GetData<IPageMetaDataDefinition>().\r\n        //        Where(f => (f.Name == name) && ((f.Label != label) || (f.MetaDataTypeId != metaDataTypeId))).\r\n        //        Any() == false;\r\n        //}\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsDefinitionAllowed(Guid definingItemId, string name, string label, Guid metaDataTypeId)\r\n        {\r\n            var pageMetaDataDefinitions = DataFacade.GetData<IPageMetaDataDefinition>().Where(f => f.Name == name).Evaluate();\r\n            \r\n            foreach (IPageMetaDataDefinition pageMetaDataDefinition in pageMetaDataDefinitions)\r\n            {\r\n                if (pageMetaDataDefinition.DefiningItemId == definingItemId &&\r\n                    pageMetaDataDefinition.MetaDataTypeId == metaDataTypeId && \r\n                    pageMetaDataDefinition.Label != label &&\r\n                    pageMetaDataDefinitions.Count == 1)\r\n                {\r\n                    return true; // Allow renaming of label\r\n                }\r\n\r\n                if (pageMetaDataDefinition.Label != label\r\n                    || pageMetaDataDefinition.MetaDataTypeId != metaDataTypeId\r\n                    || pageMetaDataDefinition.DefiningItemId == definingItemId)\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsNewContainerIdAllowed(Guid definingItemId, string name, Guid newMetaDataContainerName)\r\n        {\r\n            var pageMetaDataDefinitions = DataFacade.GetData<IPageMetaDataDefinition>().Where(f => f.Name == name).Evaluate();\r\n\r\n            var pageMetaDataDefinition = pageMetaDataDefinitions.SingleOrDefault(f => f.DefiningItemId == definingItemId);\r\n            if (pageMetaDataDefinition != null && pageMetaDataDefinition.MetaDataContainerId == newMetaDataContainerName) \r\n            {\r\n                return true; // Return true if no changes are made\r\n            }\r\n\r\n            return pageMetaDataDefinitions.Count <= 1;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a new metadata definition to the given page\r\n        /// </summary>\r\n        /// <param name=\"definingPage\"></param>\r\n        /// <param name=\"name\"></param>\r\n        /// <param name=\"label\"></param>\r\n        /// <param name=\"metaDataTypeId\"></param>\r\n        /// <param name=\"metaDataContainerId\"></param>\r\n        /// <param name=\"startLevel\"></param>\r\n        /// <param name=\"levels\"></param>        \r\n        public static void AddMetaDataDefinition(this IPage definingPage, string name, string label, Guid metaDataTypeId, Guid metaDataContainerId, int startLevel = 0, int levels = 100000)\r\n        {\r\n            AddDefinition(definingPage.GetPageIdOrNull(), name, label, metaDataTypeId, metaDataContainerId, startLevel, levels);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a new metadata definition to the given pagetype\r\n        /// </summary>\r\n        /// <param name=\"definingPageType\"></param>\r\n        /// <param name=\"name\"></param>\r\n        /// <param name=\"label\"></param>\r\n        /// <param name=\"metaDataTypeId\"></param>\r\n        /// <param name=\"metaDataContainerId\"></param>\r\n        public static void AddMetaDataDefinition(this IPageType definingPageType, string name, string label, Guid metaDataTypeId, Guid metaDataContainerId)\r\n        {\r\n            Verify.ArgumentNotNull(definingPageType, nameof(definingPageType));\r\n\r\n            AddDefinition(definingPageType.Id, name, label, metaDataTypeId, metaDataContainerId, 0, 0);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a new metadata definition to the given definingItemId. Guid.Empty is the whole website\r\n        /// </summary>\r\n        /// <param name=\"definingItemId\"></param>\r\n        /// <param name=\"name\"></param>\r\n        /// <param name=\"label\"></param>\r\n        /// <param name=\"metaDataTypeId\"></param>\r\n        /// <param name=\"metaDataContainerId\"></param>\r\n        /// <param name=\"startLevel\"></param>\r\n        /// <param name=\"levels\"></param>        \r\n        public static void AddDefinition(Guid definingItemId, string name, string label, Guid metaDataTypeId, Guid metaDataContainerId, int startLevel = 0, int levels = 100000)\r\n        {\r\n            IPageMetaDataDefinition pageMetaDataDefinition = DataFacade.BuildNew<IPageMetaDataDefinition>();\r\n            pageMetaDataDefinition.Id = Guid.NewGuid();\r\n            pageMetaDataDefinition.DefiningItemId = definingItemId;\r\n            pageMetaDataDefinition.Name = name;\r\n            pageMetaDataDefinition.Label = label;\r\n            pageMetaDataDefinition.MetaDataContainerId = metaDataContainerId;\r\n            pageMetaDataDefinition.MetaDataTypeId = metaDataTypeId;\r\n            pageMetaDataDefinition.StartLevel = startLevel;\r\n            pageMetaDataDefinition.Levels = levels;\r\n\r\n            DataFacade.AddNew<IPageMetaDataDefinition>(pageMetaDataDefinition);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Using the given page this methods adds meta data instances that are missing\r\n        /// </summary>\r\n        /// <param name=\"definingPage\">If null, empty guid is used</param>\r\n        /// <param name=\"metaDataDefinitionName\"></param>\r\n        /// <param name=\"newDataTemplate\"></param>\r\n        public static void AddNewMetaDataToExistingPages(this IPage definingPage, string metaDataDefinitionName, IData newDataTemplate)\r\n        {\r\n            Guid pageId = definingPage.GetPageIdOrNull();\r\n\r\n            IPageMetaDataDefinition pageMetaDataDefinition = GetMetaDataDefinition(pageId, metaDataDefinitionName);\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(pageMetaDataDefinition.MetaDataTypeId);\r\n            Type metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            IEnumerable<IPage> affectedPages = definingPage.GetMetaDataAffectedPages(metaDataDefinitionName);\r\n\r\n            foreach (IPage affectedPage in affectedPages)\r\n            {\r\n                AddNewMetaDataToExistingPage(affectedPage, metaDataDefinitionName, metaDataType, newDataTemplate);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void AddNewMetaDataToExistingPage(this IPage page, string metaDataDefinitionName, Type metaDataType, IData newDataTemplate)\r\n        {\r\n            IData data = page.GetMetaData(metaDataDefinitionName, metaDataType);\r\n            if (data != null) return;\r\n\r\n            var newData = (IPublishControlled) DataFacade.BuildNew(metaDataType);\r\n            newDataTemplate.FullCopyChangedTo(newData);\r\n            newData.PublicationStatus = GenericPublishProcessController.Draft;\r\n\r\n            AssignMetaDataSpecificValues(newData, metaDataDefinitionName, page);\r\n\r\n            if (newData is ILocalizedControlled localizedData)\r\n            {\r\n                localizedData.SourceCultureName = page.SourceCultureName;\r\n            }\r\n\r\n            newData = (IPublishControlled)DataFacade.AddNew((IData)newData); // Cast is needed for the DataFacade to work correctly\r\n\r\n            if (newData.PublicationStatus != page.PublicationStatus)\r\n            {\r\n                newData.PublicationStatus = page.PublicationStatus;\r\n                DataFacade.Update(newData);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Using the given pageType this methods adds meta data instances that are missing\r\n        /// </summary>\r\n        /// <param name=\"definingPageType\"></param>\r\n        /// <param name=\"metaDataDefinitionName\"></param>\r\n        /// <param name=\"newDataTemplate\"></param>\r\n        public static void AddNewMetaDataToExistingPages(this IPageType definingPageType, string metaDataDefinitionName, IData newDataTemplate)\r\n        {\r\n            IPageMetaDataDefinition pageMetaDataDefinition = GetMetaDataDefinition(definingPageType.Id, metaDataDefinitionName);\r\n\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(pageMetaDataDefinition.MetaDataTypeId);\r\n            Type metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            IEnumerable<IPage> affectedPages = PageMetaDataFacade.GetMetaDataAffectedPagesByPageTypeId(definingPageType.Id);\r\n\r\n            AddNewMetaDataToExistingPages(affectedPages, metaDataDefinitionName, metaDataType, newDataTemplate);\r\n        }\r\n\r\n\r\n\r\n        private static void AddNewMetaDataToExistingPages(IEnumerable<IPage> affectedPages, string metaDataDefinitionName, Type metaDataType, IData newDataTemplate)\r\n        {\r\n            foreach (IPage affectedPage in affectedPages)\r\n            {\r\n                IData data = affectedPage.GetMetaData(metaDataDefinitionName, metaDataType);\r\n                if (data != null) continue;\r\n\r\n                var newData = (IPublishControlled) DataFacade.BuildNew(metaDataType);\r\n                newDataTemplate.FullCopyChangedTo(newData);\r\n                newData.PublicationStatus = GenericPublishProcessController.Draft;\r\n                PageMetaDataFacade.AssignMetaDataSpecificValues(newData, metaDataDefinitionName, affectedPage);\r\n\r\n                if(newData is ILocalizedControlled localizedData)\r\n                {\r\n                    localizedData.SourceCultureName = UserSettings.ActiveLocaleCultureInfo.Name;\r\n                }\r\n\r\n                newData = (IPublishControlled) DataFacade.AddNew((IData) newData);\r\n\r\n                if (newData.PublicationStatus != affectedPage.PublicationStatus)\r\n                {\r\n                    newData.PublicationStatus = affectedPage.PublicationStatus;\r\n                    DataFacade.Update(newData);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Update an existing metadata definition with possible new label and container id\r\n        /// </summary>\r\n        /// <param name=\"definingItemId\"></param>\r\n        /// <param name=\"definitionName\"></param>\r\n        /// <param name=\"newLabel\"></param>\r\n        /// <param name=\"newMetaDataContainerId\"></param>\r\n        public static void UpdateDefinition(Guid definingItemId, string definitionName, string newLabel, Guid newMetaDataContainerId)\r\n        {\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IPageMetaDataDefinition pageMetaDataDefinition = GetMetaDataDefinition(definingItemId, definitionName);\r\n                pageMetaDataDefinition.Label = newLabel;\r\n                pageMetaDataDefinition.MetaDataContainerId = newMetaDataContainerId;\r\n\r\n\r\n                // Update all data\r\n                // PageDataAssociationVisabilityWrapper wrapper = new PageDataAssociationVisabilityWrapper(pageAssociationVisability);\r\n                // Make join expression tree with compositionType and IPage on compositionType ref to IPage \r\n                // and test those pages against the PageDataAssociationVisabilityWrapper (IsAllowed) and\r\n                // Change compositionType composition description name to new name\r\n\r\n\r\n                DataFacade.Update(pageMetaDataDefinition);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Update an existing metadata definition with possible new label and container id\r\n        /// </summary>\r\n        /// <param name=\"definingItemId\"></param>\r\n        /// <param name=\"definitionName\"></param>\r\n        /// <param name=\"newLabel\"></param>\r\n        /// <param name=\"newLevels\"></param>\r\n        /// <param name=\"newStartLevel\"></param>\r\n        /// <param name=\"newMetaDataContainerId\"></param>\r\n        public static void UpdateDefinition(Guid definingItemId, string definitionName, string newLabel, int newStartLevel, int newLevels, Guid newMetaDataContainerId)\r\n        {\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IPageMetaDataDefinition pageMetaDataDefinition = GetMetaDataDefinition(definingItemId, definitionName);\r\n                pageMetaDataDefinition.Label = newLabel;\r\n                pageMetaDataDefinition.MetaDataContainerId = newMetaDataContainerId;\r\n                pageMetaDataDefinition.StartLevel = newStartLevel;\r\n                pageMetaDataDefinition.Levels = newLevels;\r\n\r\n                // Update all data\r\n                // PageDataAssociationVisabilityWrapper wrapper = new PageDataAssociationVisabilityWrapper(pageAssociationVisability);\r\n                // Make join expression tree with compositionType and IPage on compositionType ref to IPage \r\n                // and test those pages against the PageDataAssociationVisabilityWrapper (IsAllowed) and\r\n                // Change compositionType composition description name to new name\r\n\r\n\r\n                DataFacade.Update(pageMetaDataDefinition);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Removes a metadata definition and possibly deletes all data items that are defined by it\r\n        /// </summary>\r\n        /// <param name=\"definingPage\"></param>\r\n        /// <param name=\"definitionName\"></param>        \r\n        /// <param name=\"deleteExistingMetaData\"></param>\r\n        public static void RemoveMetaDataDefinition(this IPage definingPage, string definitionName, bool deleteExistingMetaData = true)\r\n        {\r\n            RemoveDefinition(definingPage.GetPageIdOrNull(), definitionName, deleteExistingMetaData);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Removes a metadata definition and possibly deletes all data items that are defined by it\r\n        /// </summary>\r\n        /// <param name=\"definingPageType\"></param>\r\n        /// <param name=\"definitionName\"></param>        \r\n        /// <param name=\"deleteExistingMetaData\"></param>\r\n        public static void RemoveMetaDataDefinition(this IPageType definingPageType, string definitionName, bool deleteExistingMetaData = true)\r\n        {\r\n            RemoveDefinition(definingPageType.Id, definitionName, deleteExistingMetaData);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Removes a metadata definition and possibly deletes all data items that are defined by it\r\n        /// </summary>\r\n        /// <param name=\"definingItemId\"></param>\r\n        /// <param name=\"definitionName\"></param>        \r\n        /// <param name=\"deleteExistingMetaData\"></param>\r\n        public static void RemoveDefinition(Guid definingItemId, string definitionName, bool deleteExistingMetaData = true)\r\n        {\r\n            IPageMetaDataDefinition pageMetaDataDefinition = GetMetaDataDefinition(definingItemId, definitionName);\r\n\r\n            IEnumerable<IPageMetaDataDefinition> otherPageMetaDataDefinitions =\r\n                DataFacade.GetData<IPageMetaDataDefinition>().\r\n                Where(f => f.Name == definitionName && f.Id != pageMetaDataDefinition.Id).\r\n                Evaluate();\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(pageMetaDataDefinition.MetaDataTypeId);\r\n            Type metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            if (deleteExistingMetaData)\r\n            {\r\n                using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n                {\r\n                    foreach (CultureInfo localeCultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n                    {\r\n                        using (new DataScope(localeCultureInfo))\r\n                        {\r\n                            using (new DataScope(DataScopeIdentifier.Public))\r\n                            {\r\n                                RemoveDefinitionDeleteData(definitionName, metaDataType, otherPageMetaDataDefinitions);\r\n                            }\r\n\r\n                            using (new DataScope(DataScopeIdentifier.Administrated))\r\n                            {\r\n                                RemoveDefinitionDeleteData(definitionName, metaDataType, otherPageMetaDataDefinitions);\r\n                            }\r\n                        }\r\n                    }\r\n\r\n                    DataFacade.Delete(pageMetaDataDefinition);\r\n\r\n                    transactionScope.Complete();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                DataFacade.Delete(pageMetaDataDefinition);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void RemoveDefinitionDeleteData(string definitionName, Type metaDataType, IEnumerable<IPageMetaDataDefinition> otherPageMetaDataDefinitions)\r\n        {\r\n            IEnumerable<IData> dataToDelete = PageMetaDataFacade.GetMetaData(definitionName, metaDataType).Evaluate();\r\n\r\n            List<IData> datasNotToDelete = new List<IData>();\r\n            foreach (IData data in dataToDelete)\r\n            {\r\n                IPage page = data.GetMetaDataReferencedPage();\r\n                if(page == null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                bool existsInOtherScope = ExistInOtherScope(page, otherPageMetaDataDefinitions);\r\n                if (existsInOtherScope)\r\n                {\r\n                    datasNotToDelete.Add(data);\r\n                }\r\n            }\r\n\r\n            dataToDelete = dataToDelete.Except(datasNotToDelete);\r\n\r\n            DataFacade.Delete(dataToDelete);\r\n        }\r\n\r\n\r\n\r\n        private static bool ExistInOtherScope(IPage page, IEnumerable<IPageMetaDataDefinition> otherPageMetaDataDefinitions)\r\n        {\r\n            return otherPageMetaDataDefinitions.Any(\r\n                definition => IsDefinitionAllowed(definition, page));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void RemoveAllDefinitions(Guid metaDataTypeId, bool deleteExistingMetaData = true)\r\n        {\r\n            IEnumerable<IPageMetaDataDefinition> pageMetaDataDefinitions =\r\n                DataFacade.GetData<IPageMetaDataDefinition>().\r\n                Where(f => f.MetaDataTypeId == metaDataTypeId).\r\n                Evaluate();\r\n\r\n            foreach (IPageMetaDataDefinition pageMetaDataDefinition in pageMetaDataDefinitions)\r\n            {\r\n                RemoveDefinition(pageMetaDataDefinition.DefiningItemId, pageMetaDataDefinition.Name, deleteExistingMetaData);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Updates the given metadata item with new Id and setting the metadata definition name and defining item id\r\n        /// </summary>\r\n        /// <param name=\"metaData\"></param>\r\n        /// <param name=\"metaDataDefinitionName\"></param>\r\n        /// <param name=\"definingPage\"></param>\r\n        public static void AssignMetaDataSpecificValues(IData metaData, string metaDataDefinitionName, IPage definingPage)\r\n        {\r\n            Type interfaceType = metaData.DataSourceId.InterfaceType;\r\n\r\n            PropertyInfo idPropertyInfo = interfaceType.GetPropertiesRecursively().SingleOrDefault(f => f.Name == nameof(IPageMetaData.Id));\r\n            idPropertyInfo.SetValue(metaData, Guid.NewGuid(), null);\r\n\r\n            PropertyInfo namePropertyInfo = GetDefinitionNamePropertyInfo(interfaceType);\r\n            namePropertyInfo.SetValue(metaData, metaDataDefinitionName, null);\r\n\r\n            PropertyInfo pageReferencePropertyInfo = GetDefinitionPageReferencePropertyInfo(interfaceType);\r\n            pageReferencePropertyInfo.SetValue(metaData, definingPage.Id, null);\r\n\r\n            PropertyInfo pageReferencePropertyVersionInfo = GetDefinitionPageReferencePropertyVersionInfo(interfaceType);\r\n            pageReferencePropertyVersionInfo.SetValue(metaData, definingPage.VersionId, null);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static PropertyInfo GetDefinitionNamePropertyInfo(Type metaDataType)\r\n        {\r\n            return typeof (IPageMetaData).GetProperty(nameof(IPageMetaData.FieldName));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static PropertyInfo GetDefinitionPageReferencePropertyInfo(Type metaDataType)\r\n        {\r\n            return typeof(IPageRelatedData).GetProperty(nameof(IPageRelatedData.PageId));\r\n        }\r\n\r\n        /// <exclude />\r\n        public static PropertyInfo GetDefinitionPageReferencePropertyVersionInfo(Type metaDataType)\r\n        {\r\n            return typeof(IVersioned).GetProperty(nameof(IVersioned.VersionId));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static Guid GetMetaDataReferencedPageId(IData metaData)\r\n        {\r\n            PropertyInfo propertyInfo = PageMetaDataFacade.GetDefinitionPageReferencePropertyInfo(metaData.DataSourceId.InterfaceType);\r\n\r\n            Guid pageId = (Guid)propertyInfo.GetValue(metaData, null);\r\n\r\n            return pageId;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IPage GetMetaDataReferencedPage(this IData metaData)\r\n        {\r\n            Guid pageId = GetMetaDataReferencedPageId(metaData);\r\n\r\n            return Composite.Data.PageManager.GetPageById(pageId);\r\n        }\r\n\r\n\r\n\r\n        private static Guid GetPageIdOrNull(this IPage page) => page?.Id ?? Guid.Empty;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PageNode.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Implementation;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Represents a page in the C1 CMS sitemap hierarchy.\r\n    /// </summary>\r\n    public class PageNode\r\n    {\r\n        private readonly IPage _page;\r\n        private readonly SitemapNavigatorImplementation _sitemapNavigator;\r\n        \r\n        private XElement _pageElement;\r\n        private int? _level;\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of <see cref=\"PageNode\"/>.\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        /// <param name=\"sitemapNavigator\">The site map navigator.</param>\r\n        public PageNode(IPage page, SitemapNavigatorImplementation sitemapNavigator)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n\r\n            _page = page;\r\n            _sitemapNavigator = sitemapNavigator;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The Id of the page\r\n        /// </summary>\r\n        public virtual Guid Id => _page.Id;\r\n\r\n\r\n        /// <summary>\r\n        /// The Title of the page\r\n        /// </summary>\r\n        public virtual string Title => _page.Title;\r\n\r\n\r\n        /// <summary>\r\n        /// The Menu Title of the page\r\n        /// </summary>\r\n        public virtual string MenuTitle => string.IsNullOrEmpty(_page.MenuTitle) ? null : _page.MenuTitle;\r\n\r\n\r\n        /// <summary>\r\n        /// The time the page was changed last\r\n        /// </summary>\r\n        public virtual DateTime ChangedDate => _page.ChangeDate;\r\n\r\n\r\n        /// <summary>\r\n        /// The Description of the page\r\n        /// </summary>\r\n        public virtual string Description => _page.Description;\r\n\r\n\r\n        /// <summary>\r\n        /// Url to this page.\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1056:UriPropertiesShouldNotBeStrings\")]\r\n        public virtual string Url => PageUrls.BuildUrl(_page);\r\n\r\n\r\n        /// <summary>\r\n        /// The level this page is placed at in the sitemap. Level 1 is a homepage, level 2 are children of the homepage and so on.\r\n        /// </summary>\r\n        public virtual int Level\r\n        {\r\n            get\r\n            {\r\n                if (_level == null)\r\n                {\r\n                    PageNode parent = ParentPage;\r\n\r\n                    _level = parent?.Level + 1 ?? 1;\r\n                }\r\n\r\n                return _level.Value;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the parent <see cref=\"PageNode\"/>.\r\n        /// </summary>\r\n        public virtual PageNode ParentPage\r\n        {\r\n            get\r\n            {\r\n                var parentPageId = PageManager.GetParentId(_page.Id);\r\n\r\n                if (parentPageId == Guid.Empty) return null;\r\n\r\n                var page = PageManager.GetPageById(parentPageId);\r\n\r\n                return page != null ? new PageNode(page, _sitemapNavigator) : null;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns <see cref=\"PageNode\"/> elements that represent the immediate children of this page.\r\n        /// </summary>\r\n        public virtual IEnumerable<PageNode> ChildPages\r\n        {\r\n            get\r\n            {\r\n                foreach (Guid childId in PageManager.GetChildrenIDs(_page.Id))\r\n                {\r\n                    var page = PageManager.GetPageById(childId);\r\n\r\n                    if (page != null)\r\n                    {\r\n                        yield return new PageNode(page, _sitemapNavigator);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Returns <see cref=\"PageNode\"/> elements that is with the <see cref=\"SitemapScope\"/> of this page-\r\n        /// </summary>\r\n        /// <param name=\"scope\">The scope.</param>\r\n        /// <returns></returns>\r\n        public virtual IEnumerable<PageNode> GetPageNodes(SitemapScope scope) \r\n        {\r\n            if (scope < SitemapScope.Current || scope > SitemapScope.SiblingsAndSelf) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n            foreach (Guid pageId in GetPageIds(scope))\r\n\t        {\r\n                var page = PageManager.GetPageById(pageId);\r\n\r\n\t            if (page != null)\r\n\t            {\r\n                    yield return new PageNode(page, _sitemapNavigator);\r\n\t            }\r\n\t        }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Return the Page Id's that is with the <see cref=\"SitemapScope\"/> of this page-\r\n        /// </summary>\r\n        /// <param name=\"scope\">The scope.</param>\r\n        /// <returns></returns>\r\n        public virtual IEnumerable<Guid> GetPageIds(SitemapScope scope) \r\n        {\r\n            if (scope < SitemapScope.Current || scope > SitemapScope.SiblingsAndSelf) throw new ArgumentOutOfRangeException(\"scope\");\r\n\r\n            return PageStructureInfo.GetAssociatedPageIds(_page.Id, scope);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// XML representing the page and it's decendants. Do NOT modify this structure. To do modifications, clone this first.\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\")]\r\n        public virtual XElement SitemapXml\r\n        {\r\n            get\r\n            {\r\n                if (_pageElement == null)\r\n                {\r\n                    _pageElement = _sitemapNavigator.GetElementByPageId(_page.Id);\r\n                }\r\n\r\n                return _pageElement;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the page.\r\n        /// </summary>\r\n        /// <returns>The page</returns>\r\n        public virtual IPage Page => _page;\r\n\r\n\r\n        /// <summary>\r\n        /// Serialize the page specific state to a string for reading.\r\n        /// </summary>\r\n        /// <returns>\r\n        /// A <see cref=\"System.String\"/> that represents this instance.\r\n        /// </returns>\r\n        public override string ToString()\r\n        {\r\n            return string.Format(CultureInfo.InvariantCulture, \"PageNode(Id:'{0}', Title:'{1}', Description:'{2}', MenuTitle:'{3}', Url:'{4}', Level:'{5}')\",\r\n                this.Id,\r\n                this.Title,\r\n                this.Description,\r\n                this.MenuTitle,\r\n                this.Url,\r\n                this.Level);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/PageRenderingHistory.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.IO;\r\nusing System.Net;\r\nusing System.Threading;\r\nusing System.Web;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Preserves list of pages that has been rendered since last content/function change\r\n    /// </summary>\r\n    public static class PageRenderingHistory\r\n    {\r\n        private static readonly string LogTitle = nameof(PageRenderingHistory);\r\n\r\n        private const int MaxRenderErrorsToLog = 10;\r\n        private const int PageRenderingTimeout = 7000;\r\n        private const int PageRenderingQueueWaitingTimeout = 15000;\r\n\r\n        private static readonly ConcurrentDictionary<string, object> _renderedPages = new ConcurrentDictionary<string, object>();\r\n        private static int _errorCounter;\r\n\r\n        private static readonly object _pageRenderingLock = new object();\r\n\r\n        static PageRenderingHistory()\r\n        {\r\n            GlobalEventSystemFacade.OnDesignChange += () => _renderedPages.Clear();\r\n\r\n            DataEvents<IPage>.OnAfterUpdate += (sender, args) => PageUpdated((IPage) args.Data);\r\n            DataEvents<IPage>.OnDeleted += (sender, args) => PageUpdated((IPage)args.Data);\r\n            DataEvents<IPage>.OnStoreChanged += (sender, args) =>\r\n            {\r\n                if (!args.DataEventsFired)\r\n                {\r\n                    _renderedPages.Clear();\r\n                }\r\n            };\r\n        }\r\n\r\n        private static string GetCacheKey(IPage page)\r\n        {\r\n            var dataSourceId = page.DataSourceId;\r\n            string localizationInfo = dataSourceId.LocaleScope.ToString();\r\n            string dataScope = dataSourceId.DataScopeIdentifier.Name;\r\n            return page.Id + dataScope + localizationInfo;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether the page was rendered since the last \r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        /// <returns></returns>\r\n        public static bool IsPageRendered(IPage page)\r\n        {\r\n            var key = GetCacheKey(page);\r\n            return _renderedPages.ContainsKey(key);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Marks page as rendered.\r\n        /// </summary>\r\n        /// <param name=\"page\">The pages.</param>\r\n        public static void MarkPageAsRendered(IPage page)\r\n        {\r\n            var key = GetCacheKey(page);\r\n            _renderedPages[key] = null;\r\n        }\r\n\r\n        private static void PageUpdated(IPage page)\r\n        {\r\n            object temp;\r\n            _renderedPages.TryRemove(GetCacheKey(page), out temp);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void RenderPageIfNotRendered(IPage page)\r\n        {\r\n            if (IsPageRendered(page) || PageRenderer.CurrentPageId == page.Id) return;\r\n\r\n            bool lockTaken = false;\r\n            try\r\n            {\r\n                Monitor.TryEnter(_pageRenderingLock, PageRenderingQueueWaitingTimeout, ref lockTaken);\r\n\r\n                if (IsPageRendered(page)) return;\r\n\r\n                try\r\n                {\r\n                    RenderPage(page);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    string pageUrl = PageUrls.BuildUrl(page) ?? \"(no url)\";\r\n                    Log.LogError(LogTitle, \"Failed to render page '{0}', Id: {1}\", pageUrl, page.Id);\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                if (lockTaken)\r\n                {\r\n                    Monitor.Exit(_pageRenderingLock);\r\n                }\r\n\r\n                if (!lockTaken)\r\n                {\r\n                    if (!IsPageRendered(page))\r\n                    {\r\n                        Log.LogWarning(\"DataUrls\", \"Timeout on page rendering waiting queue\");\r\n                    }\r\n                }\r\n\r\n                MarkPageAsRendered(page);\r\n            }\r\n        }\r\n\r\n        private static void RenderPage(IPage page)\r\n        {\r\n            var context = HttpContext.Current;\r\n            if (context == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var urlSpace = new UrlSpace(context) { ForceRelativeUrls = false };\r\n            var url = PageUrls.BuildUrl(page, UrlKind.Public, urlSpace)\r\n                ?? PageUrls.BuildUrl(page, UrlKind.Renderer, urlSpace);\r\n\r\n            if (string.IsNullOrEmpty(url))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var requestUrl = context.Request.Url;\r\n            string hostName = requestUrl.Host;\r\n\r\n            if (!url.StartsWith(\"http\", StringComparison.InvariantCultureIgnoreCase))\r\n            {\r\n                string serverUrl = new UrlBuilder(requestUrl.ToString()).ServerUrl;\r\n\r\n                url = UrlUtils.Combine(serverUrl, url);\r\n            }\r\n\r\n            string cookies = context.Request.Headers[\"Cookie\"];\r\n\r\n            string responseBody, errorMessage;\r\n            var result = RenderPage(hostName, url, cookies, out responseBody, out errorMessage);\r\n\r\n            if (result != PageRenderingResult.Successful && Interlocked.Increment(ref _errorCounter) <= MaxRenderErrorsToLog)\r\n            {\r\n                Log.LogWarning(LogTitle, $\"Failed to render page '{url}' with the goal of collecting dymanic url providers. Result: {result}; Error: {errorMessage}\");\r\n            }\r\n        }\r\n\r\n\r\n        enum PageRenderingResult\r\n        {\r\n            Failed = 0,\r\n            Successful = 1,\r\n            Redirect = 2,\r\n            NotFound = 3\r\n        }\r\n\r\n        private static PageRenderingResult RenderPage(string hostname, string url, string cookies, out string responseBody, out string errorMessage)\r\n        {\r\n            try\r\n            {\r\n                var request = WebRequest.Create(url) as HttpWebRequest;\r\n\r\n                request.UserAgent = @\"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5\";\r\n                request.Timeout = PageRenderingTimeout;\r\n                request.AllowAutoRedirect = false; // Some pages may contain redirects to other pages/different websites\r\n                request.Method = \"GET\";\r\n                request.Headers.Add(\"Cookie\", cookies);\r\n                request.Host = hostname;\r\n\r\n\r\n                int statusCode;\r\n                using (var response = request.GetResponse() as HttpWebResponse)\r\n                {\r\n                    statusCode = (int)response.StatusCode;\r\n\r\n                    if (statusCode == 200)\r\n                    {\r\n                        using (var responseStream = response.GetResponseStream())\r\n                        {\r\n                            responseBody = new StreamReader(responseStream).ReadToEnd();\r\n                        }\r\n                        errorMessage = null;\r\n                        return PageRenderingResult.Successful;\r\n                    }\r\n\r\n                    if (statusCode == 301 || statusCode == 302)\r\n                    {\r\n                        responseBody = null;\r\n                        errorMessage = null;\r\n                        return PageRenderingResult.Redirect;\r\n                    }\r\n                }\r\n\r\n                errorMessage = \"Http status: \" + statusCode;\r\n            }\r\n            catch (WebException ex)\r\n            {\r\n                var webResponse = ex.Response as HttpWebResponse;\r\n                if (webResponse != null && webResponse.StatusCode != HttpStatusCode.OK)\r\n                {\r\n                    if (webResponse.StatusCode == HttpStatusCode.NotFound)\r\n                    {\r\n                        errorMessage = responseBody = null;\r\n                        return PageRenderingResult.NotFound;\r\n                    }\r\n                    errorMessage = \"Http status: \" + ((int)webResponse.StatusCode + \" \" + webResponse.StatusCode);\r\n                }\r\n                else\r\n                {\r\n                    errorMessage = ex.ToString();\r\n                }\r\n            }\r\n\r\n            responseBody = null;\r\n            return PageRenderingResult.Failed;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PageUrl.cs",
    "content": "﻿using System;\r\nusing System.Collections.Specialized;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Page url type\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Obsolete(\"Use Composite.Core.Routing.PageUrls\", true)]\r\n    public enum PageUrlType\r\n    {\r\n        /// <exclude />\r\n        Undefined = 0,\r\n\r\n        /// <summary>\r\n        /// A main url by with a C1 page is accessed. F.e. \"/Home/About.aspx\"\r\n        /// </summary>\r\n        Public = 1,\r\n        /// <summary>\r\n        /// A main url by with a C1 page is accessed. F.e. \"/Home/About.aspx\"\r\n        /// </summary>\r\n        [Obsolete(\"Use 'Public' instead\")]\r\n        Published = 1,\r\n\r\n        /// <summary>\r\n        /// Unpublihed reference to a page. F.e. \"/Renderers/Page.aspx?id=7446ceda-df90-49f0-a183-4e02ed6f6eec\"\r\n        /// </summary>\r\n        Internal = 2,\r\n        /// <summary>\r\n        /// Unpublihed reference to a page. F.e. \"/Renderers/Page.aspx?id=7446ceda-df90-49f0-a183-4e02ed6f6eec\"\r\n        /// </summary>\r\n        [Obsolete(\"Use 'Internal' instead\")]\r\n        Unpublished = 2,\r\n\r\n        /// <summary>\r\n        /// Friendly url. A short url, by accessing which C1 will make a redirect to related \"public\" url\r\n        /// </summary>\r\n        Friendly = 3\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// Represents a page url\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Obsolete(\"Use Composite.Core.Routing.PageUrls\")]\r\n    public sealed class PageUrl\r\n    {\r\n        /// <exclude />\r\n        public PageUrl(PublicationScope publicationScope, CultureInfo locale, Guid pageId) :\r\n            this(publicationScope, locale, pageId, PageUrlType.Undefined)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PageUrl(PublicationScope publicationScope, CultureInfo locale, Guid pageId, PageUrlType urlType)\r\n        {\r\n            Verify.ArgumentNotNull(locale, \"locale\");\r\n            Verify.ArgumentCondition(pageId != Guid.Empty, \"pageId\", \"PageId should not be an empty guid.\");\r\n\r\n            this.PublicationScope = publicationScope;\r\n            Locale = locale;\r\n            PageId = pageId;\r\n            UrlType = urlType;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the type of the URL.\r\n        /// </summary>\r\n        /// <value>The type of the URL.</value>\r\n        public PageUrlType UrlType { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the publication scope.\r\n        /// </summary>\r\n        /// <value>The publication scope.</value>\r\n        public PublicationScope PublicationScope { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the locale.\r\n        /// </summary>\r\n        /// <value>The locale.</value>\r\n        public CultureInfo Locale { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the page id.\r\n        /// </summary>\r\n        /// <value>The page id.</value>\r\n        public Guid PageId { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the page.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public IPage GetPage()\r\n        {\r\n            using(new DataConnection(PublicationScope, Locale))\r\n            {\r\n                return Data.PageManager.GetPageById(PageId);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds a url.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public UrlBuilder Build()\r\n        {\r\n            Verify.That(UrlType != PageUrlType.Undefined, \"Url type is undefined\");\r\n\r\n            return Build(UrlType);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds a url of the the specified URL type.\r\n        /// </summary>\r\n        /// <param name=\"urlType\">Type of the URL.</param>\r\n        /// <returns></returns>\r\n        public UrlBuilder Build(PageUrlType urlType)\r\n        {\r\n            IPage page = GetPage();\r\n            if(page == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            PageUrlData pageUrlData = new PageUrlData(page);\r\n\r\n            string url = PageUrls.BuildUrl(pageUrlData, ToUrlKind(urlType), new UrlSpace());\r\n            return url != null ? new UrlBuilder(url) : null;\r\n        }\r\n\r\n        private static UrlKind ToUrlKind(PageUrlType pageUrlType)\r\n        {\r\n            switch (pageUrlType)\r\n            {\r\n                case PageUrlType.Public:\r\n                    return UrlKind.Public;\r\n                case PageUrlType.Internal:\r\n                    return UrlKind.Internal;\r\n                case PageUrlType.Friendly:\r\n                    return UrlKind.Friendly;\r\n            }\r\n            return UrlKind.Undefined;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parses the specified URL.\r\n        /// </summary>\r\n        /// <param name=\"url\">The URL.</param>\r\n        public static PageUrl Parse(string url)\r\n        {\r\n            NameValueCollection queryParameters;\r\n\r\n            return Parse(url, out queryParameters);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parses the specified URL.\r\n        /// </summary>\r\n        /// <param name=\"url\">The URL.</param>\r\n        /// <param name=\"queryParameters\">The query parameters that weren't used to define which page was accessed.</param>\r\n        /// <returns></returns>\r\n        [SuppressMessage(\"Microsoft.Globalization\", \"CA1304:SpecifyCultureInfo\", MessageId = \"System.String.Compare(System.String,System.String,System.Boolean)\")]\r\n        [SuppressMessage(\"Microsoft.Design\", \"CA1021:AvoidOutParameters\", MessageId = \"1#\")]\r\n        public static PageUrl Parse(string url, out NameValueCollection queryParameters)\r\n        {\r\n            Verify.ArgumentNotNull(url, \"url\");\r\n\r\n            var urlBuilder = new UrlBuilder(url);\r\n            return IsInternalUrl(urlBuilder)\r\n                       ? ParseInternalUrl(urlBuilder, out queryParameters)\r\n                       : ParsePublicUrl(urlBuilder, out queryParameters);\r\n        }\r\n\r\n\r\n        internal static PageUrl ParsePublicUrl(UrlBuilder urlBuilder, out NameValueCollection notUsedQueryParameters)\r\n        {\r\n            UrlKind urlKind;\r\n            PageUrlData pageUrlData = PageUrls.ParseUrl(urlBuilder.ToString(), out urlKind);\r\n\r\n            if (pageUrlData == null || urlKind != UrlKind.Public)\r\n            {\r\n                notUsedQueryParameters = null;\r\n                return null;\r\n            }\r\n\r\n            notUsedQueryParameters = pageUrlData.QueryParameters;\r\n\r\n            return new PageUrl(pageUrlData.PublicationScope, pageUrlData.LocalizationScope, pageUrlData.PageId, PageUrlType.Public);\r\n        }\r\n\r\n        internal static CultureInfo GetCultureInfo(string requestPath, out string requestPathWithoutUrlMappingName)\r\n        {\r\n            requestPathWithoutUrlMappingName = requestPath;\r\n\r\n            int startIndex = requestPath.IndexOf('/', UrlUtils.PublicRootPath.Length) + 1;\r\n            if (startIndex >= 0 && requestPath.Length > startIndex)\r\n            {\r\n                int endIndex = requestPath.IndexOf('/', startIndex + 1) - 1;\r\n                if (endIndex >= 0)\r\n                {\r\n                    string urlMappingName = requestPath.Substring(startIndex, endIndex - startIndex + 1);\r\n\r\n                    if (DataLocalizationFacade.UrlMappingNames.Contains(urlMappingName))\r\n                    {\r\n                        CultureInfo cultureInfo = DataLocalizationFacade.GetCultureInfoByUrlMappingName(urlMappingName);\r\n\r\n                        bool exists = DataLocalizationFacade.ActiveLocalizationNames.Contains(cultureInfo.Name);\r\n\r\n                        if (exists)\r\n                        {\r\n                            requestPathWithoutUrlMappingName = requestPath.Remove(startIndex - 1, endIndex - startIndex + 2);\r\n\r\n                            return cultureInfo;\r\n                        }\r\n\r\n                        return null;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return DataLocalizationFacade.DefaultUrlMappingCulture;\r\n        }\r\n\r\n        internal static PageUrl ParseInternalUrl(UrlBuilder urlBuilder, out NameValueCollection notUsedQueryStringParameters)\r\n        {\r\n            return ParseQueryString(urlBuilder.GetQueryParameters(), out notUsedQueryStringParameters);\r\n        }\r\n\r\n        /// <summary>\r\n        /// To be used for handling 'internal' links.\r\n        /// </summary>\r\n        /// <param name=\"queryString\">Query string.</param>\r\n        /// <param name=\"notUsedQueryParameters\">Query string parameters that were not used.</param>\r\n        /// <returns></returns>\r\n        internal static PageUrl ParseQueryString(NameValueCollection queryString, out NameValueCollection notUsedQueryParameters)\r\n        {\r\n            if (string.IsNullOrEmpty(queryString[\"pageId\"])) throw new InvalidOperationException(\"Invalid query string. The 'pageId' parameter of the GUID type is expected.\");\r\n\r\n            string dataScopeName = queryString[\"dataScope\"];\r\n\r\n            PublicationScope publicationScope = PublicationScope.Published;\r\n\r\n            if(dataScopeName != null \r\n                && string.Compare(dataScopeName, DataScopeIdentifier.AdministratedName, StringComparison.OrdinalIgnoreCase) == 0)\r\n            {\r\n                publicationScope = PublicationScope.Unpublished;\r\n            }\r\n            \r\n\r\n            string cultureInfoStr = queryString[\"cultureInfo\"];\r\n            if (cultureInfoStr.IsNullOrEmpty())\r\n            {\r\n                cultureInfoStr = queryString[\"CultureInfo\"];\r\n            }\r\n\r\n            CultureInfo cultureInfo;\r\n            if (!cultureInfoStr.IsNullOrEmpty())\r\n            {\r\n                cultureInfo = new CultureInfo(cultureInfoStr);\r\n            }\r\n            else\r\n            {\r\n                cultureInfo = LocalizationScopeManager.CurrentLocalizationScope;\r\n                if (cultureInfo == CultureInfo.InvariantCulture)\r\n                {\r\n                    cultureInfo = DataLocalizationFacade.DefaultLocalizationCulture;\r\n                }\r\n            }\r\n\r\n            Guid pageId = new Guid(queryString[\"pageId\"]);\r\n\r\n            notUsedQueryParameters = new NameValueCollection();\r\n\r\n            var queryKeys = new[] { \"pageId\", \"dataScope\", \"cultureInfo\", \"CultureInfo\" };\r\n\r\n            var notUsedKeys = queryString.AllKeys.Where(key => !queryKeys.Contains(key, StringComparer.OrdinalIgnoreCase));\r\n\r\n            foreach (string key in notUsedKeys)\r\n            {\r\n                notUsedQueryParameters.Add(key, queryString[key]);\r\n            }\r\n\r\n            return new PageUrl(publicationScope, cultureInfo, pageId, PageUrlType.Internal);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Looks for a friendly URL and set pageUrl if found.\r\n        /// </summary>\r\n        /// <param name=\"relativeUrl\">The string to match to a friendly URL</param>\r\n        /// <param name=\"pageUrl\">The matching page, if a match was found. Otherwise null.</param>\r\n        /// <returns>True if a friendly URL match was found</returns>\r\n        public static bool TryParseFriendlyUrl(string relativeUrl, out PageUrl pageUrl)\r\n        {\r\n            UrlKind urlKind;\r\n            PageUrlData pageUrlData = PageUrls.ParseUrl(relativeUrl, new UrlSpace(), out urlKind);\r\n\r\n            if (pageUrlData == null || urlKind != UrlKind.Friendly)\r\n            {\r\n                pageUrl = null;\r\n                return false;\r\n            }\r\n\r\n            pageUrl = new PageUrl(pageUrlData.PublicationScope, pageUrlData.LocalizationScope, pageUrlData.PageId, PageUrlType.Friendly);\r\n            return true;\r\n        }\r\n\r\n        internal static bool IsInternalUrl(string url)\r\n        {\r\n            return IsInternalUrl(new UrlBuilder(url));\r\n        }\r\n\r\n        internal static bool IsInternalUrl(UrlBuilder url)\r\n        {\r\n            return url.FilePath.EndsWith(\"Renderers/Page.aspx\", true);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PhysicalStoreFieldType.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum PhysicalStoreFieldType\r\n    {\r\n        /// <exclude />\r\n        Integer = 1,\r\n\r\n        /// <exclude />\r\n        Long = 2,\r\n\r\n        /// <exclude />\r\n        String = 3,\r\n\r\n        /// <exclude />\r\n        LargeString = 4,\r\n\r\n        /// <exclude />\r\n        DateTime = 5,\r\n\r\n        /// <exclude />\r\n        Decimal = 6,\r\n\r\n        /// <exclude />\r\n        Guid = 7,\r\n\r\n        /// <exclude />\r\n        Boolean = 8\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/DataInterfaceValidator.cs",
    "content": "using System;\r\nusing System.Text;\r\nusing System.Reflection;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class DataInterfaceValidator\r\n    {\r\n        /// <exclude />\r\n        public static bool TryValidate(Type interfaceType, out IEnumerable<string> errorMessages)\r\n        {\r\n            List<string> errors = new List<string>();\r\n            errorMessages = errors;\r\n\r\n\r\n            if (interfaceType.IsInterface == false)\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Management\", \"DataInterfaceValidator.TypeNotAnInterface\");\r\n                errors.Add(string.Format(errorMessage, interfaceType));\r\n            }\r\n\r\n\r\n            if (typeof(IData).IsAssignableFrom(interfaceType) == false)\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Management\", \"DataInterfaceValidator.TypeDoesNotImplementInterface\");\r\n                errors.Add(string.Format(errorMessage, interfaceType, typeof(IData)));\r\n            }\r\n\r\n\r\n            PropertyInfo[] properties = interfaceType.GetProperties();\r\n            foreach (PropertyInfo propertyInfo in properties)\r\n            {\r\n                bool acceptedType = PrimitiveTypes.IsPrimitiveOrNullableType(propertyInfo.PropertyType);                \r\n\r\n                if (acceptedType == false)\r\n                {\r\n                    string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Management\", \"DataInterfaceValidator.NotAcceptedType\");\r\n                    errors.Add(string.Format(errorMessage, propertyInfo.PropertyType, interfaceType));\r\n                }\r\n            }\r\n\r\n            return errors.Count == 0;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidate(Type interfaceType)\r\n        {\r\n            IEnumerable<string> errorMessages;\r\n\r\n            return TryValidate(interfaceType, out errorMessages);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidate<T>(out IEnumerable<string> errorMessages)\r\n            where T : class, IData\r\n        {\r\n            return TryValidate(typeof(T), out errorMessages);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryValidate<T>()\r\n            where T : class, IData\r\n        {\r\n            IEnumerable<string> errors;\r\n\r\n            return TryValidate(typeof(T), out errors);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void Validate(Type interfaceType)\r\n        {\r\n            IEnumerable<string> errors;\r\n            bool res = TryValidate(interfaceType, out errors);\r\n\r\n            if (res == false)\r\n            {\r\n                StringBuilder sb = new StringBuilder();\r\n\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Management\", \"DataInterfaceValidator.NotValidIDataInterface\");\r\n                sb.AppendLine(string.Format(errorMessage, interfaceType));\r\n\r\n                foreach (string error in errors)\r\n                {\r\n                    sb.AppendLine(error);\r\n                }\r\n\r\n                throw new ArgumentException(sb.ToString());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void Validate<T>()\r\n            where T : class, IData\r\n        {\r\n            Validate(typeof(T));\r\n        }      \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/DataProviderConfigurationServices.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Data.Plugins.DataProvider.Runtime;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{    \r\n    internal static class DataProviderConfigurationServices\r\n    {\r\n        public static DataProviderData GetDataProviderConfiguration(string providerName)\r\n        {\r\n            DataProviderSettings settings = (DataProviderSettings)ConfigurationServices.ConfigurationSource.GetSection(DataProviderSettings.SectionName);\r\n            if (settings.DataProviderPlugins.Contains(providerName) == false) throw new ArgumentException(\"Unknown provider name\", \"providerName\");\r\n            return settings.DataProviderPlugins.Get(providerName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/DataProviderContext.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.Foundation.CodeGeneration;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataProviderContext\r\n    {\r\n        private readonly string _providerName;\r\n\r\n        /// <exclude />\r\n        public DataProviderContext(string providerName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, \"providerName\");\r\n\r\n            _providerName = providerName;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ProviderName\r\n        {\r\n            get { return _providerName; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public DataSourceId CreateDataSourceId(IDataId dataId, Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(dataId, \"dataId\");\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n            Verify.ArgumentCondition(typeof(IData).IsAssignableFrom(interfaceType), \"interfaceType\", \"The interface type '{0}' does not inherit the interface '{1}'\".FormatWith(interfaceType, typeof(IData)));\r\n\r\n            return new DataSourceId(dataId, _providerName, interfaceType, DataScopeManager.MapByType(interfaceType), LocalizationScopeManager.MapByType(interfaceType));\r\n        }\r\n\r\n        /// <exclude />\r\n        public DataSourceId CreateDataSourceId(IDataId dataId, Type interfaceType, DataScopeIdentifier dataScopeIdentifier, CultureInfo cultureInfo)\r\n        {\r\n            Verify.ArgumentNotNull(dataId, \"dataId\");\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n            Verify.ArgumentNotNull(dataScopeIdentifier, \"dataScopeIdentifier\");\r\n            Verify.ArgumentNotNull(cultureInfo, \"cultureInfo\");\r\n            Verify.ArgumentCondition(typeof(IData).IsAssignableFrom(interfaceType), \"interfaceType\", \"The interface type '{0}' does not inherit the interface '{1}'\".FormatWith(interfaceType, typeof(IData)));\r\n\r\n            return new DataSourceId(dataId, _providerName, interfaceType, dataScopeIdentifier, cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateDataSourceId(IData data, IDataId dataId, Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n            Verify.ArgumentNotNull(dataId, \"dataId\");\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n            Verify.ArgumentCondition(typeof(IData).IsAssignableFrom(interfaceType), \"interfaceType\", \"The interface type '{0}' does not inherit the interface '{1}'\".FormatWith(interfaceType, typeof(IData)));\r\n\r\n            var emptyDataClassBase = data as EmptyDataClassBase;\r\n            if (emptyDataClassBase == null)\r\n            {\r\n                throw new InvalidOperationException(\"Updates on DataSourceIds can only be done on objects that are returned by the DataFacade.BuildNew<T>() method\");\r\n            }\r\n\r\n            if (emptyDataClassBase.DataSourceId.ExistsInStore)\r\n            {\r\n                throw new InvalidOperationException(\"Updates on DataSourceIds can only be done once\");\r\n            }\r\n\r\n            emptyDataClassBase.DataSourceId = CreateDataSourceId(dataId, interfaceType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateDataSourceIdDataScope(IData data)\r\n        {\r\n            Verify.ArgumentNotNull(data, \"data\");\r\n\r\n            data.DataSourceId.DataScopeIdentifier = DataScopeManager.MapByType(data);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/DataProviderData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(NonConfigurableDataProvider))]\r\n    public class DataProviderData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/IDataProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data.Plugins.DataProvider.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [CustomFactory(typeof(DataProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(DataProviderDefaultNameRetriever))]\r\n    public interface IDataProvider\r\n    {\r\n        /// <summary>\r\n        /// This is set by the system and is used to create DataSourceId's\r\n        /// </summary>\r\n        DataProviderContext Context { set; }\r\n\r\n        /// <summary>\r\n        /// This method should return all supported data interfaces. \r\n        /// That is, all data interfaces that this provider is currently handling.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        IEnumerable<Type> GetSupportedInterfaces();\r\n\r\n        /// <exclude />\r\n        IQueryable<T> GetData<T>() where T : class, IData;\r\n\r\n        /// <summary>\r\n        /// This method should return null if the given dataId does not correspond to an IData\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"dataId\"></param>\r\n        /// <returns></returns>\r\n        T GetData<T>(IDataId dataId) where T : class, IData;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/IDynamicDataProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IDynamicDataProvider : IDataProvider\r\n    {\r\n        /// <summary>\r\n        /// This method should return ALL data interface that the provider knows. Including\r\n        /// currently not supported interface due to configuratoion and/or store errors.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        IEnumerable<Type> GetKnownInterfaces();\r\n\r\n        /// <exclude />\r\n        void CreateStores(IReadOnlyCollection<DataTypeDescriptor> typeDescriptor);\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"updateDataTypeDescriptor\"></param>\r\n        /// <param name=\"forceCompile\">If this is true and the provider uses dynamic compilations. It should compile its helper regardless.</param>\r\n        void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, bool forceCompile);\r\n\r\n        /// <exclude />\r\n        void DropStore(DataTypeDescriptor typeDescriptor);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/IFileSystemDataProvider.cs",
    "content": "﻿using Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// This should be implemented by DataProviders that provies IFile data items.    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public interface IFileSystemDataProvider : IDataProvider\r\n    {\r\n        /// <summary>\r\n        /// This method is called when the absolute file path needs validation.\r\n        /// Only the data provider knows the base path, so its responsible for \r\n        /// creating the full absolute path from an IFile.\r\n        /// </summary>\r\n        /// <typeparam name=\"TFile\">An IFile or an sub interface</typeparam>\r\n        /// <param name=\"file\">The IFile instance</param>\r\n        /// <param name=\"errorMessage\">Will contain the error message, if any</param>\r\n        /// <returns>Returns false if something is wrong with the path and <paramref name=\"errorMessage\"/> will contain the error message. Otherwice true.</returns>\r\n        bool ValidatePath<TFile>(TFile file, out string errorMessage) where TFile : IFile;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/IGeneratedTypesDataProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IGeneratedTypesDataProvider : IDataProvider, IDynamicDataProvider, IWritableDataProvider\r\n\t{\r\n        /// <summary>\r\n        /// This method should return all genereted data interface types that the provider supports,\r\n        /// and nothing more.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        IEnumerable<Type> GetGeneratedInterfaces();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/ILocalizedDataProvider.cs",
    "content": "﻿using System.Globalization;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface ILocalizedDataProvider : IDataProvider\r\n\t{\r\n        /// <exclude />\r\n        void AddLocale(CultureInfo cultureInfo);\r\n\r\n        /// <exclude />\r\n        void RemoveLocale(CultureInfo cultureInfo);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/ISupportCaching.cs",
    "content": "﻿namespace Composite.Data.Plugins.DataProvider\r\n{\r\n\tinternal interface ISupportCachingDataProvider: IDataProvider\r\n\t{\r\n        bool AllowResultsWrapping { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/IWritableDataProvider.cs",
    "content": "using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IWritableDataProvider : IDataProvider\r\n    {\r\n        /// <exclude />\r\n        void Update(IEnumerable<IData> datas);\r\n\r\n        /// <exclude />\r\n        List<T> AddNew<T>(IEnumerable<T> datas) where T : class, IData;\r\n\r\n        /// <exclude />\r\n        void Delete(IEnumerable<DataSourceId> dataSourceIds);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/NonConfigurableDataProvider.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Assembler(typeof(NonConfigurableDataProviderAssembler))]\r\n    public sealed class NonConfigurableDataProvider : DataProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NonConfigurableDataProviderAssembler : IAssembler<IDataProvider, DataProviderData>\r\n    {\r\n        /// <exclude />\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IDataProvider Assemble(IBuilderContext context, DataProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IDataProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/Runtime/DataProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.Runtime\r\n{\r\n    internal sealed class DataProviderCustomFactory : AssemblerBasedCustomFactory<IDataProvider, DataProviderData>\r\n    {\r\n        protected override DataProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            DataProviderSettings settings = configurationSource.GetSection(DataProviderSettings.SectionName) as DataProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", DataProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.DataProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/Runtime/DataProviderDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.Runtime\r\n{\r\n    internal sealed class DataProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/Runtime/DataProviderFactory.cs",
    "content": "using System;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.Runtime\r\n{\r\n    internal interface IDataProviderFactory \r\n    {\r\n        IDataProvider Create(string dataProviderName);\r\n    }\r\n\r\n    \r\n\r\n    internal sealed class ConfigurationDataProviderFactory : NameTypeFactoryBase<IDataProvider>, IDataProviderFactory\r\n    {\r\n        public ConfigurationDataProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\r\n        IDataProvider IDataProviderFactory.Create(string dataProviderName)\r\n        {\r\n            return base.Create(dataProviderName);\r\n        }\r\n    }\r\n    \r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/Runtime/DataProviderSettings.cs",
    "content": "using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.Runtime\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataProviderSettings : SerializableConfigurationSection\r\n    {\r\n        /// <exclude />\r\n        public const string SectionName = \"Composite.Data.Plugins.DataProviderConfiguration\";\r\n\r\n\r\n        private const string _defaultDynamicTypeDataProviderNameProperty = \"defaultDynamicTypeDataProviderName\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_defaultDynamicTypeDataProviderNameProperty, IsRequired = true)]\r\n        public string DefaultDynamicTypeDataProviderName\r\n        {\r\n            get { return (string)base[_defaultDynamicTypeDataProviderNameProperty]; }\r\n            set { base[_defaultDynamicTypeDataProviderNameProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _dataProviderPluginsProperty = \"DataProviderPlugins\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_dataProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<DataProviderData> DataProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<DataProviderData>)base[_dataProviderPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/Streams/FileChangeNotificator.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Threading;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Streams;\r\nusing System.IO;\r\nusing Composite.Core;\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.Streams\r\n{\r\n\tinternal static class FileChangeNotificator\r\n\t{\r\n        private static readonly object _syncRoot = new object();\r\n        private static C1FileSystemWatcher _fileWatcher;\r\n\r\n        private static int _counter;\r\n\r\n        // We're holding only weak reference to subscriber objects, in order to avoid memory leaks\r\n        private static readonly Hashtable<string, ReadOnlyCollection<Pair<MethodInfo, WeakReference>>> _subscribers = new Hashtable<string, ReadOnlyCollection<Pair<MethodInfo, WeakReference>>>();\r\n\r\n\r\n        private static void EnsureInitialization()\r\n        {\r\n            if (_fileWatcher != null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            lock (_syncRoot)\r\n            {\r\n                if (_fileWatcher != null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                _fileWatcher = new C1FileSystemWatcher(AppDomain.CurrentDomain.BaseDirectory)\r\n                {\r\n                    IncludeSubdirectories = true,\r\n                    NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite,\r\n                    InternalBufferSize = 32768\r\n                };\r\n\r\n                // _fileWatcher.Created += FileWatcher_Created;\r\n                _fileWatcher.Changed += FileWatcher_Changed;\r\n                _fileWatcher.Deleted += FileWatcher_Deleted;\r\n\r\n                _fileWatcher.EnableRaisingEvents = true;\r\n            }\r\n        }\r\n\r\n\r\n        static void FileWatcher_Deleted(object sender, FileSystemEventArgs e)\r\n        {\r\n            FireFileChangedEvent(e.FullPath, FileChangeType.Deleted);\r\n        }\r\n\r\n        static void FileWatcher_Changed(object sender, FileSystemEventArgs e)\r\n        {\r\n            FileChangeType changeType = e.ChangeType == WatcherChangeTypes.Renamed\r\n                                            ? FileChangeType.Renamed\r\n                                            : FileChangeType.Modified;\r\n            FireFileChangedEvent(e.FullPath, changeType);\r\n        }\r\n\r\n        //static void FileWatcher_Created(object sender, FileSystemEventArgs e)\r\n        //{\r\n        //    // Do nothing...\r\n        //}\r\n\r\n        private static void FireFileChangedEvent(string filePath, FileChangeType changeType)\r\n        {\r\n            filePath = filePath.ToLowerInvariant();\r\n\r\n            ReadOnlyCollection<Pair<MethodInfo, WeakReference>> weakInvocationList;\r\n\r\n            if (!_subscribers.TryGetValue(filePath.ToLowerInvariant(), out weakInvocationList))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var parameters = new object[] { filePath, changeType };\r\n\r\n            foreach (var callInfo in weakInvocationList)\r\n            {\r\n                try\r\n                {\r\n                    if (callInfo.Second == null) // Call to a static method\r\n                    {\r\n                        callInfo.First.Invoke(null, parameters);\r\n                    }\r\n                    else\r\n                    {\r\n                        object target = callInfo.Second.Target;\r\n                        if (target != null) // Checking if object is alive\r\n                        {\r\n                            callInfo.First.Invoke(target, parameters);\r\n                        }\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(nameof(FileChangeNotificator), ex);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public static void Subscribe(FileSystemFileBase file, OnFileChangedDelegate handler)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n\r\n            Subscribe(file.SystemPath, handler);\r\n        }\r\n\r\n\r\n\t    public static void Subscribe(string filePath, OnFileChangedDelegate handler)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(filePath, \"filePath\");\r\n            Verify.ArgumentNotNull(handler, \"handler\");\r\n\r\n            EnsureInitialization();\r\n\r\n            int counterValue = Interlocked.Increment(ref _counter);\r\n            if (counterValue % 100 == 0)\r\n            {\r\n                ClearDeadReferences();\r\n            }\r\n\r\n            var weakInvocationList = new List<Pair<MethodInfo, WeakReference>>();\r\n            foreach (Delegate func in handler.GetInvocationList())\r\n            {\r\n                var targetObject = func.Target;\r\n                if (targetObject == null)\r\n                {\r\n                    weakInvocationList.Add(new Pair<MethodInfo, WeakReference>(func.Method, null));\r\n                }\r\n                else\r\n                {\r\n                    weakInvocationList.Add(new Pair<MethodInfo, WeakReference>(func.Method, new WeakReference(handler.Target)));\r\n                }\r\n            }\r\n\r\n            string key = filePath.ToLowerInvariant();\r\n            lock (_syncRoot)\r\n            {\r\n                if (_subscribers.ContainsKey(key))\r\n                {\r\n                    ReadOnlyCollection<Pair<MethodInfo, WeakReference>> oldList = _subscribers[key];\r\n\r\n                    var newList = new ReadOnlyCollection<Pair<MethodInfo, WeakReference>>(\r\n                        new List<Pair<MethodInfo, WeakReference>>(oldList.Concat(weakInvocationList)));\r\n\r\n                    _subscribers[key] = newList;\r\n                }\r\n                else\r\n                {\r\n                    _subscribers.Add(key, new ReadOnlyCollection<Pair<MethodInfo, WeakReference>>(weakInvocationList));\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void ClearDeadReferences()\r\n        {\r\n            lock(_syncRoot)\r\n            {\r\n                ICollection<string> keys = _subscribers.GetKeys();\r\n\r\n                foreach(string key in keys)\r\n                {\r\n                    ReadOnlyCollection<Pair<MethodInfo, WeakReference>> currentList = _subscribers[key];\r\n\r\n                    int countOfAlive = currentList.Count(pair => pair.Second == null || pair.Second.IsAlive);\r\n                    if(countOfAlive == 0)\r\n                    {\r\n                        _subscribers.Remove(key);\r\n                        continue;\r\n                    }\r\n\r\n                    if (countOfAlive == currentList.Count)\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    var newList = new List<Pair<MethodInfo, WeakReference>>(\r\n                        currentList.Where(pair => pair.Second == null || pair.Second.IsAlive));\r\n\r\n                    _subscribers[key] = new ReadOnlyCollection<Pair<MethodInfo, WeakReference>>(newList);\r\n                }\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/Streams/FileSystemFileBase.cs",
    "content": "﻿using System;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.IO;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.Streams\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class FileSystemFileBase\r\n    {\r\n        /// <exclude />\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        protected FileStream TemporaryFileStream { get; set; }\r\n\r\n        /// <exclude />\r\n        protected string TemporaryFilePath { get; set; }\r\n\r\n        /// <exclude />\r\n        public virtual string SystemPath { get; set; }\r\n\r\n        /// <exclude />\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public FileStream GetNewWriteStream()\r\n        {\r\n            if (TemporaryFileStream != null)\r\n            {\r\n                Verify.That(!TemporaryFileStream.CanWrite, \"Stream for writing has not been closed.\");\r\n\r\n                TemporaryFileStream = null;\r\n                File.Delete(TemporaryFilePath);\r\n            }\r\n\r\n            string tempFile = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory),  \"upload\" + Path.GetRandomFileName());\r\n\r\n            this.TemporaryFilePath = tempFile;\r\n            this.TemporaryFileStream = File.Open(tempFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None);\r\n\r\n            return TemporaryFileStream;\r\n        }\r\n\r\n        /// <exclude />\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public Stream GetReadStream()\r\n        {\r\n            string filePath;\r\n\r\n            if (this.TemporaryFileStream != null)\r\n            {\r\n                Verify.That(!TemporaryFileStream.CanWrite, \"Stream for writing has not been closed.\");\r\n\r\n                filePath = this.TemporaryFilePath;\r\n            }\r\n            else\r\n            {\r\n                filePath = this.SystemPath;\r\n            }\r\n\r\n            return new FileStream(filePath, FileMode.Open, FileAccess.Read);\r\n        }\r\n\r\n        /// <exclude />\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void CommitChanges()\r\n        {\r\n            if (this.TemporaryFileStream == null) return;\r\n\r\n            Verify.That(!TemporaryFileStream.CanWrite, \"Stream for writing has not been closed.\");\r\n\r\n            DirectoryUtils.EnsurePath(this.SystemPath);\r\n\r\n            if (!this.SystemPath.IsNullOrEmpty())\r\n            {\r\n                File.Delete(this.SystemPath);\r\n            }\r\n\r\n            File.Move(this.TemporaryFilePath, this.SystemPath);\r\n\r\n            this.TemporaryFileStream = null;\r\n            this.TemporaryFilePath = null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/Streams/FileSystemFileStreamManager.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Data.Streams;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.Streams\r\n{\r\n    internal sealed class FileSystemFileStreamManager : IFileStreamManager\r\n    {\r\n        public Stream GetReadStream(IFile file)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n            Verify.ArgumentCondition(file is FileSystemFileBase, \"file\", \"The type '{0}' does not inherit the class '{1}'\".FormatWith(file.GetType(), typeof(FileSystemFileBase)));\r\n\r\n            var baseFile = file as FileSystemFileBase;\r\n\r\n            return baseFile.GetReadStream();\r\n        }\r\n\r\n\r\n\r\n        public Stream GetNewWriteStream(IFile file)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n            Verify.ArgumentCondition(file is FileSystemFileBase, \"file\", \"The type '{0}' does not inherit the class '{1}'\".FormatWith(file.GetType(), typeof(FileSystemFileBase)));\r\n\r\n            var baseFile = file as FileSystemFileBase;\r\n\r\n            return baseFile.GetNewWriteStream();\r\n        }\r\n\r\n\r\n\r\n        internal static void DeleteFile(string filename)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(filename, \"filename\");\r\n\r\n            DirectoryUtils.DeleteFile(filename, true);\r\n        }\r\n\r\n\r\n\r\n        internal static void DeleteFile(IFile file)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n            Verify.ArgumentCondition(file is FileSystemFileBase, \"file\", \"The type '{0}' does not inherit the class '{1}'\".FormatWith(file.GetType(), typeof(FileSystemFileBase)));\r\n\r\n            var baseFile = file as FileSystemFileBase;\r\n\r\n            DeleteFile(baseFile.SystemPath);\r\n        }\r\n\r\n\r\n\r\n        internal static void WriteFileToDisk(IFile file)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n            Verify.ArgumentCondition(file is FileSystemFileBase, \"file\", \"The type '{0}' does not inherit the class '{1}'\".FormatWith(file.GetType(), typeof(FileSystemFileBase)));\r\n\r\n            var baseFile = file as FileSystemFileBase;\r\n\r\n            baseFile.CommitChanges();\r\n        }\r\n\r\n        public void SubscribeOnFileChanged(IFile file, OnFileChangedDelegate handler)\r\n        {\r\n            FileChangeNotificator.Subscribe(file as FileSystemFileBase, handler);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/Streams/TransactionFileSystemFileStreamManager.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Transactions;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Data.Streams;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.Streams\r\n{\r\n    internal sealed class TransactionFileSystemFileStreamManager : IFileStreamManager\r\n    {\r\n        public Stream GetReadStream(IFile file)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n            Verify.ArgumentCondition(file is FileSystemFileBase, \"file\", \"The type '{0}' does not inherit the class '{1}'\".FormatWith(file.GetType(), typeof(FileSystemFileBase)));\r\n\r\n            var baseFile = file as FileSystemFileBase;\r\n\r\n            return baseFile.GetReadStream();\r\n        }\r\n\r\n\r\n\r\n        public Stream GetNewWriteStream(IFile file)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n            Verify.ArgumentCondition(file is FileSystemFileBase, \"file\", \"The type '{0}' does not inherit the class '{1}'\".FormatWith(file.GetType(), typeof(FileSystemFileBase)));\r\n\r\n            var baseFile = file as FileSystemFileBase;\r\n\r\n            return baseFile.GetNewWriteStream();\r\n        }\r\n\r\n\r\n\r\n        internal static void DeleteFile(string filename)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(filename, \"filename\");\r\n\r\n            DirectoryUtils.DeleteFile(filename, true);\r\n        }\r\n\r\n\r\n\r\n\r\n        internal static void DeleteFile(IFile file)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n\r\n            FileSystemFileBase baseFile = file as FileSystemFileBase;\r\n\r\n            Verify.ArgumentCondition(baseFile != null, \"file\", \"The type '{0}' does not inherit the class '{1}'\"\r\n                                                       .FormatWith(file.GetType(), typeof(FileSystemFileBase)));\r\n\r\n            if (Transaction.Current == null)\r\n            {\r\n                LogNoTransaction();\r\n\r\n                DeleteFile(baseFile.SystemPath);\r\n            }\r\n            else\r\n            {\r\n                Transaction.Current.EnlistVolatile(new DeleteEnlistment(baseFile), EnlistmentOptions.None);\r\n            }\r\n        }\r\n\r\n\r\n        internal static void WriteFileToDisk(IFile file)\r\n        {\r\n            Verify.ArgumentNotNull(file, \"file\");\r\n\r\n            FileSystemFileBase baseFile = file as FileSystemFileBase;\r\n\r\n            Verify.ArgumentCondition(baseFile != null, \"file\", \"The type '{0}' does not inherit the class '{1}'\"\r\n                                                       .FormatWith(file.GetType(), typeof(FileSystemFileBase)));\r\n\r\n            if (Transaction.Current == null)\r\n            {\r\n                LogNoTransaction();\r\n\r\n                baseFile.CommitChanges();\r\n            }\r\n            else\r\n            {\r\n                Transaction.Current.EnlistVolatile(new WriteToDiskEnlistment(file, baseFile), EnlistmentOptions.None);\r\n            }\r\n        }\r\n\r\n\r\n        private static void LogNoTransaction()\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                Log.LogWarning(\"Transaction not active\", \"There is no current transaction that the File System File Stream manager can attach to.\");\r\n            }\r\n        }\r\n\r\n\r\n        public void SubscribeOnFileChanged(IFile file, OnFileChangedDelegate handler)\r\n        {\r\n            FileChangeNotificator.Subscribe(file as FileSystemFileBase, handler);\r\n        }\r\n\r\n\r\n        private class WriteToDiskEnlistment : IEnlistmentNotification\r\n        {\r\n            private IFile file;\r\n            private FileSystemFileBase baseFile;\r\n\r\n            public WriteToDiskEnlistment(IFile file, FileSystemFileBase baseFile)\r\n            {\r\n                this.file = file;\r\n                this.baseFile = baseFile;\r\n            }\r\n\r\n\r\n\r\n            public void Commit(Enlistment enlistment)\r\n            {\r\n                baseFile.CommitChanges();\r\n\r\n                enlistment.Done();\r\n            }\r\n\r\n\r\n\r\n            public void InDoubt(Enlistment enlistment)\r\n            {\r\n                enlistment.Done();\r\n            }\r\n\r\n\r\n\r\n            public void Prepare(PreparingEnlistment preparingEnlistment)\r\n            {\r\n                preparingEnlistment.Prepared();\r\n            }\r\n\r\n\r\n\r\n            public void Rollback(Enlistment enlistment)\r\n            {\r\n                enlistment.Done();\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        private class DeleteEnlistment : IEnlistmentNotification\r\n        {\r\n            private FileSystemFileBase baseFile;\r\n\r\n            public DeleteEnlistment(FileSystemFileBase baseFile)\r\n            {\r\n                this.baseFile = baseFile;\r\n            }\r\n\r\n\r\n\r\n            public void Commit(Enlistment enlistment)\r\n            {\r\n                DeleteFile(baseFile.SystemPath);\r\n                enlistment.Done();\r\n            }\r\n\r\n\r\n\r\n            public void InDoubt(Enlistment enlistment)\r\n            {\r\n                enlistment.Done();\r\n            }\r\n\r\n\r\n\r\n            public void Prepare(PreparingEnlistment preparingEnlistment)\r\n            {\r\n                preparingEnlistment.Prepared();\r\n            }\r\n\r\n\r\n\r\n            public void Rollback(Enlistment enlistment)\r\n            {\r\n                enlistment.Done();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Plugins/DataProvider/TransformQueryable/TransformQueryable.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Data.Plugins.DataProvider.TransformQueryable.Foundation;\r\nusing Composite.Linq;\r\n\r\n\r\nnamespace Composite.Data.Plugins.DataProvider.TransformQueryable\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class TransformQueryable<T> : IOrderedQueryable<T>, ITransformQueryable, IQueryProvider\r\n    {\r\n        private IQueryable _source;\r\n        private TypeMappings _typeMappings;\r\n        private PropertyMappings _propertyMappings;\r\n        private SelectParameterMappings _selectParameterMappings;\r\n        private ContainerClassMappings _containerClassMappings;\r\n\r\n        private Expression _currentExpression;\r\n\r\n\r\n\r\n        public TransformQueryable(IQueryable source, TypeMappings typeMappings, PropertyMappings propertyMappings, SelectParameterMappings selectParameterMappings, ContainerClassMappings containerClassMappings)\r\n        {\r\n            if (source == null) throw new ArgumentNullException(\"source\");\r\n            if (typeMappings == null) throw new ArgumentNullException(\"typeMappings\");\r\n            if (propertyMappings == null) throw new ArgumentNullException(\"propertyMappings\");\r\n            if (selectParameterMappings == null) throw new ArgumentNullException(\"selectParameterMappings\");\r\n            if (containerClassMappings == null) throw new ArgumentNullException(\"containerClassFieldMappings\");\r\n\r\n            _source = source;\r\n            _typeMappings = typeMappings;\r\n            _propertyMappings = propertyMappings;\r\n            _selectParameterMappings = selectParameterMappings;\r\n            _containerClassMappings = containerClassMappings;\r\n\r\n            _currentExpression = Expression.Constant(this);\r\n        }\r\n\r\n\r\n\r\n        public TransformQueryable(IQueryable source, TypeMappings typeMappings, PropertyMappings propertyMappings, SelectParameterMappings selectParameterMappings, ContainerClassMappings containerClassMappings, Expression currentExpression)\r\n        {\r\n            if (source == null) throw new ArgumentNullException(\"source\");\r\n            if (typeMappings == null) throw new ArgumentNullException(\"typeMappings\");\r\n            if (propertyMappings == null) throw new ArgumentNullException(\"propertyMappings\");\r\n            if (selectParameterMappings == null) throw new ArgumentNullException(\"selectParameterMappings\");\r\n            if (containerClassMappings == null) throw new ArgumentNullException(\"containerClassFieldMappings\");\r\n            if (currentExpression == null) throw new ArgumentNullException(\"currentExpression\");\r\n\r\n            _source = source;\r\n            _typeMappings = typeMappings;\r\n            _propertyMappings = propertyMappings;\r\n            _selectParameterMappings = selectParameterMappings;\r\n            _containerClassMappings = containerClassMappings;\r\n\r\n            _currentExpression = currentExpression;\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<S> CreateQuery<S>(Expression expression)\r\n        {\r\n            return new TransformQueryable<S>(_source, _typeMappings, _propertyMappings, _selectParameterMappings, _containerClassMappings, expression);\r\n        }\r\n\r\n\r\n\r\n        public S Execute<S>(Expression expression)\r\n        {\r\n            TransformMappingsMergerExpressionVisitor mergerVisitor = new TransformMappingsMergerExpressionVisitor();\r\n            mergerVisitor.Visit(expression);\r\n\r\n\r\n            TransformSelectInserterExpressionVisitor selectInserterVisitor = new TransformSelectInserterExpressionVisitor(mergerVisitor.TypeMappings);\r\n            expression = selectInserterVisitor.Visit(expression);\r\n\r\n\r\n            TransformExpressionVisitor visitor = new TransformExpressionVisitor(\r\n                                                     _source,\r\n                                                     mergerVisitor.TypeMappings,\r\n                                                     mergerVisitor.PropertyMappings,\r\n                                                     mergerVisitor.SelectParameterMappings,\r\n                                                     mergerVisitor.ContainerClassMappings);\r\n\r\n            Expression newExpression = visitor.Visit(expression);\r\n\r\n            return (S)_source.Provider.Execute(newExpression);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerator<T> GetEnumerator()\r\n        {\r\n            TransformMappingsMergerExpressionVisitor mergerVisitor = new TransformMappingsMergerExpressionVisitor();\r\n            mergerVisitor.Visit(_currentExpression);\r\n\r\n\r\n            TransformSelectInserterExpressionVisitor selectInserterVisitor = new TransformSelectInserterExpressionVisitor(mergerVisitor.TypeMappings);\r\n            Expression newExpression = selectInserterVisitor.Visit(_currentExpression);\r\n\r\n\r\n            TransformExpressionVisitor visitor = new TransformExpressionVisitor(\r\n                                                     _source,\r\n                                                     mergerVisitor.TypeMappings,\r\n                                                     mergerVisitor.PropertyMappings,\r\n                                                     mergerVisitor.SelectParameterMappings,\r\n                                                     mergerVisitor.ContainerClassMappings);\r\n\r\n            newExpression = visitor.Visit(newExpression);\r\n\r\n            IQueryable<T> queryable = (IQueryable<T>)_source.Provider.CreateQuery(newExpression);\r\n\r\n            return queryable.GetEnumerator();\r\n        }\r\n\r\n\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            MethodInfo methodInfo = TransformQueryableCache.GetTransformQueryableGetEnumeratorMethodInfo(typeof(T));\r\n\r\n            return (IEnumerator)methodInfo.Invoke(this, null);\r\n        }\r\n\r\n\r\n\r\n        public IQueryable CreateQuery(Expression expression)\r\n        {\r\n            if (_currentExpression == expression) return this;\r\n\r\n            Type elementType = TypeHelpers.FindElementType(expression);\r\n\r\n            Type queryableType = TransformQueryableCache.GetTransformQueryableType(elementType);\r\n\r\n            return (IQueryable)Activator.CreateInstance(\r\n                queryableType,\r\n                new object[] { _source, _typeMappings, _propertyMappings, _selectParameterMappings, _containerClassMappings, expression });\r\n        }\r\n\r\n\r\n\r\n        public Type ElementType\r\n        {\r\n            get { return typeof(T); }\r\n        }\r\n\r\n\r\n\r\n        public object Execute(Expression expression)\r\n        {\r\n            MethodInfo methodInfo = TransformQueryableCache.GetTransformQueryableExecuteMethodInfo(typeof(T), expression.Type);\r\n\r\n            return methodInfo.Invoke(this, new object[] { expression });\r\n        }\r\n\r\n\r\n\r\n        public Expression Expression\r\n        {\r\n            get\r\n            {\r\n                return _currentExpression;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        IQueryable ITransformQueryable.Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n\r\n\r\n        TypeMappings ITransformQueryable.TypeMappings\r\n        {\r\n            get { return _typeMappings; }\r\n        }\r\n\r\n\r\n\r\n        PropertyMappings ITransformQueryable.PropertyMappings\r\n        {\r\n            get { return _propertyMappings; }\r\n        }\r\n\r\n\r\n\r\n        SelectParameterMappings ITransformQueryable.SelectParameterMappings\r\n        {\r\n            get { return _selectParameterMappings; }\r\n        }\r\n\r\n\r\n\r\n        ContainerClassMappings ITransformQueryable.ContainerClassMappings\r\n        {\r\n            get { return _containerClassMappings; }\r\n        }\r\n\r\n\r\n\r\n        public IQueryProvider Provider\r\n        {\r\n            get { return this; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ActionIconResourceHandleAttribute.cs",
    "content": "﻿using System;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]\r\n    internal sealed class ActionResourceHandleAttribute : Attribute\r\n    {\r\n        public ActionResourceHandleAttribute(string actionTypeName, string resourceNamespace, string resourceName)\r\n        {\r\n            this.ActionTypeName = actionTypeName;\r\n            this.ActionResourceHandle = new ResourceHandle(resourceNamespace, resourceName);\r\n        }\r\n\r\n\r\n        public string ActionTypeName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        public ResourceHandle ActionResourceHandle\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ActionRoleProviderAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]\r\n    internal sealed class ActionPermissionTypeProviderAttribute : Attribute\r\n    {\r\n        public ActionPermissionTypeProviderAttribute(string actionTypeName, Type actionPermissionTypeProviderType)\r\n        {\r\n            this.ActionTypeName = actionTypeName;\r\n            this.ActionPermissionTypeProviderType = actionPermissionTypeProviderType;\r\n        }\r\n\r\n\r\n        public string ActionTypeName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        public Type ActionPermissionTypeProviderType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ActionTokenProviderAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]\r\n    internal sealed class ActionTokenProviderAttribute : Attribute\r\n    {\r\n        public ActionTokenProviderAttribute(string actionTypeName, Type actionTokenProviderType)\r\n        {\r\n            this.ActionTypeName = actionTypeName;\r\n            this.ActionTokenProviderType = actionTokenProviderType;\r\n        }\r\n\r\n\r\n        public string ActionTypeName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        public Type ActionTokenProviderType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/IActionRoleProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n\tinternal interface IActionPermissionTypeProvider\r\n\t{\r\n        IEnumerable<PermissionType> GetActionPermissionTypes(string actionTypeName, IData data);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/IActionTokenProvider.cs",
    "content": "﻿using Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n\tinternal interface IActionTokenProvider\r\n\t{\r\n        ActionToken GetActionToken(string actionTypeName, IData data);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ILocalizeProcessController.cs",
    "content": "﻿using Composite.Data.ProcessControlled.ProcessControllers.GenericLocalizeProcessController;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{    \r\n\tinternal interface ILocalizeProcessController : IProcessController\r\n\t{\r\n        bool OnAfterBuildNew(IData data);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ILocalizedControlled.cs",
    "content": "﻿using Composite.Data.ProcessControlled.ProcessControllers.GenericLocalizeProcessController;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    /// <summary>\r\n    /// Implement this interface to allow your data type to exist in multiple language scopes (i.e. enable localizing of data).\r\n    /// </summary>\r\n    [LocalizeProcessControllerType(typeof(GenericLocalizeProcessController))]\r\n    public interface ILocalizedControlled : IProcessControlled\r\n    {\r\n        /// <summary>\r\n        /// The locale data originaled from. This field is automatically maintaned, do not set it unless implementing localization logic.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\r\n        [ImmutableFieldId(\"{0456EBB0-7FB1-46cd-9A23-4AE9AA3337FA}\")]\r\n        [NotNullValidator]\r\n        [DefaultFieldStringValue(\"\")] // Invariant\r\n        string SourceCultureName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/IProcessControlled.cs",
    "content": "﻿namespace Composite.Data.ProcessControlled\r\n{\r\n    /// <summary>\r\n    /// This interface is for internal use. DO NOT INHERIT\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IProcessControlled : IData\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/IProcessController.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    /// <summary>    \r\n    /// Providers element actions for data types that have attributes inherited from <see cref=\"Composite.Data.ProcessControllerTypeAttribute\"/>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IProcessController\r\n\t{\r\n        /// <exclude />\r\n        List<ElementAction> GetActions(IData data, Type elementProviderType);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/IPublishControlled.cs",
    "content": "﻿namespace Composite.Data.ProcessControlled\r\n{\r\n    /// <summary>\r\n    /// Add this interface to your data type to support publication workflow.\r\n    /// </summary>\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]    \r\n\tpublic interface IPublishControlled : IProcessControlled\r\n\t{\r\n        /// <summary>\r\n        /// The workflow status of data.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64, IsNullable = false)]\r\n        [ImmutableFieldId(\"{FAB1CF0C-66B0-11DC-A47E-CF6356D89593}\")]\r\n        [DefaultFieldStringValue(\"\")]\r\n        [FieldPosition(50)]\r\n        [SearchableField(false, true, true)]\r\n        string PublicationStatus { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/IPublishControlledAuxiliary.cs",
    "content": "﻿\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n\tinternal interface IPublishControlledAuxiliary\r\n\t{\r\n        /// <summary>\r\n        /// This method will be called after the IPublishProcessController.OnAfterDataUpdated has been called\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        void OnAfterDataUpdated(IData data);\r\n\r\n\r\n        /// <summary>\r\n        /// This method will be called after the IPublishProcessController.OnAfterBuildNew has been called\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        void OnAfterBuildNew(IData data);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/IPublishProcessController.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    internal interface IPublishProcessController : IProcessController\r\n\t{\r\n        void SetStartStatus(IData data);\r\n\r\n        IDictionary<string, string> GetValidTransitions(IData data);\r\n\r\n        /// <summary>\r\n        /// Returns true if auxilaries should be called, false if they should not be called\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <returns></returns>\r\n        bool OnAfterDataUpdated(IData data);\r\n\r\n        /// <summary>\r\n        /// Returns true if auxilaries should be called, false if they should not be called\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        /// <returns></returns>\r\n        bool OnAfterBuildNew(IData data);\r\n\r\n        void ValidateTransition(IData data, string status);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/IgnoreActionAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{   \r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]\r\n    internal sealed class IgnoreActionAttribute : Attribute\r\n\t{\r\n        public IgnoreActionAttribute(string actionTypeName)\r\n        {\r\n            this.ActionTypeName = actionTypeName;\r\n        }\r\n\r\n\r\n        public string ActionTypeName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ProcessControllerAttributesFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    internal static class ProcessControllerAttributesFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitialize);\r\n\r\n\r\n        static ProcessControllerAttributesFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static bool IsActionIgnored(Type elementProviderType, string actionTypeName)\r\n        {\r\n            List<string> ignoredActionTypes;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.IgnoreActionCache.TryGetValue(elementProviderType, out ignoredActionTypes) == false)\r\n                {\r\n                    ignoredActionTypes =\r\n                        (from t in elementProviderType.GetCustomAttributesRecursively<IgnoreActionAttribute>()\r\n                         select t.ActionTypeName).Distinct().ToList();\r\n\r\n                    _resourceLocker.Resources.IgnoreActionCache.Add(elementProviderType, ignoredActionTypes);\r\n                }\r\n            }\r\n\r\n            return ignoredActionTypes.Contains(actionTypeName);\r\n        }\r\n\r\n\r\n\r\n        public static IActionTokenProvider GetActionTokenProvider(Type elementProviderType, string actionTypeName)\r\n        {\r\n            Dictionary<string, IActionTokenProvider> actionTokenProviders;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.ActionTokenProviderCache.TryGetValue(elementProviderType, out actionTokenProviders) == false)\r\n                {\r\n                    actionTokenProviders = new Dictionary<string, IActionTokenProvider>();\r\n\r\n                    var pairs =\r\n                        (from t in elementProviderType.GetCustomAttributesRecursively<ActionTokenProviderAttribute>()\r\n                         select new { ActionTypeName = t.ActionTypeName, ActionTokenProviderType = t.ActionTokenProviderType });\r\n\r\n                    foreach (var pair in pairs)\r\n                    {\r\n                        if (actionTokenProviders.ContainsKey(pair.ActionTypeName) == false)\r\n                        {\r\n                            IActionTokenProvider newActionTokenProvider = (IActionTokenProvider)Activator.CreateInstance(pair.ActionTokenProviderType);\r\n\r\n                            actionTokenProviders.Add(pair.ActionTypeName, newActionTokenProvider);\r\n                        }\r\n                    }\r\n\r\n                    _resourceLocker.Resources.ActionTokenProviderCache.Add(elementProviderType, actionTokenProviders);\r\n                }\r\n\r\n                IActionTokenProvider actionTokenProvider;\r\n\r\n                actionTokenProviders.TryGetValue(actionTypeName, out actionTokenProvider);\r\n\r\n                return actionTokenProvider;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static ResourceHandle GetActionResourceHandle(Type elementProviderType, string actionTypeName)\r\n        {\r\n            Dictionary<string, ResourceHandle> actionResourceHandles;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.ActionResourceHandleCache.TryGetValue(elementProviderType, out actionResourceHandles) == false)\r\n                {\r\n                    actionResourceHandles = new Dictionary<string, ResourceHandle>();\r\n\r\n                    var pairs =\r\n                        (from t in elementProviderType.GetCustomAttributesRecursively<ActionResourceHandleAttribute>()\r\n                         select new { ActionTypeName = t.ActionTypeName, ActionResourceHandle = t.ActionResourceHandle });\r\n\r\n                    foreach (var pair in pairs)\r\n                    {\r\n                        if (actionResourceHandles.ContainsKey(pair.ActionTypeName) == false)\r\n                        {\r\n                            actionResourceHandles.Add(pair.ActionTypeName, pair.ActionResourceHandle);\r\n                        }\r\n                    }\r\n\r\n                    _resourceLocker.Resources.ActionResourceHandleCache.Add(elementProviderType, actionResourceHandles);\r\n                }\r\n\r\n                ResourceHandle actionResourceHandle;\r\n\r\n                actionResourceHandles.TryGetValue(actionTypeName, out actionResourceHandle);\r\n\r\n                return actionResourceHandle;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IActionPermissionTypeProvider GetActionPermissionTypeProvider(Type elementProviderType, string actionTypeName)\r\n        {\r\n            Dictionary<string, IActionPermissionTypeProvider> actionPermissionTypeProviders;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.ActionPermissionTypeProviderCache.TryGetValue(elementProviderType, out actionPermissionTypeProviders) == false)\r\n                {\r\n                    actionPermissionTypeProviders = new Dictionary<string, IActionPermissionTypeProvider>();\r\n\r\n                    var pairs =\r\n                        (from t in elementProviderType.GetCustomAttributesRecursively<ActionPermissionTypeProviderAttribute>()\r\n                         select new { ActionTypeName = t.ActionTypeName, ActionPermissionProviderType = t.ActionPermissionTypeProviderType });\r\n\r\n                    foreach (var pair in pairs)\r\n                    {\r\n                        if (actionPermissionTypeProviders.ContainsKey(pair.ActionTypeName) == false)\r\n                        {\r\n                            IActionPermissionTypeProvider newActionPermissionTypeProvider = (IActionPermissionTypeProvider)Activator.CreateInstance(pair.ActionPermissionProviderType);\r\n\r\n                            actionPermissionTypeProviders.Add(pair.ActionTypeName, newActionPermissionTypeProvider);\r\n                        }\r\n                    }\r\n\r\n                    _resourceLocker.Resources.ActionPermissionTypeProviderCache.Add(elementProviderType, actionPermissionTypeProviders);\r\n                }\r\n\r\n                IActionPermissionTypeProvider actionPermissionTypeProvider;\r\n\r\n                actionPermissionTypeProviders.TryGetValue(actionTypeName, out actionPermissionTypeProvider);\r\n\r\n                return actionPermissionTypeProvider;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Dictionary<Type, List<string>> IgnoreActionCache;\r\n            public Dictionary<Type, Dictionary<string, IActionTokenProvider>> ActionTokenProviderCache;\r\n            public Dictionary<Type, Dictionary<string, IActionPermissionTypeProvider>> ActionPermissionTypeProviderCache;\r\n            public Dictionary<Type, Dictionary<string, ResourceHandle>> ActionResourceHandleCache;\r\n\r\n\r\n            public static void DoInitialize(Resources resources)\r\n            {\r\n                resources.IgnoreActionCache = new Dictionary<Type, List<string>>();\r\n                resources.ActionTokenProviderCache = new Dictionary<Type, Dictionary<string, IActionTokenProvider>>();\r\n                resources.ActionPermissionTypeProviderCache = new Dictionary<Type, Dictionary<string, IActionPermissionTypeProvider>>();\r\n                resources.ActionResourceHandleCache = new Dictionary<Type, Dictionary<string, ResourceHandle>>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ProcessControllerFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Data.Foundation;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ProcessControllerFacade\r\n    {\r\n        private static readonly Dictionary<Type, Type> _controlledTypes = new Dictionary<Type, Type>();\r\n\r\n        private static Dictionary<Type, IProcessController> _processControllers;\r\n        private static Hashtable<Type, List<IPublishControlledAuxiliary>> _publishControlledAuxiliaries = new Hashtable<Type, List<IPublishControlledAuxiliary>>();\r\n\r\n\r\n        static ProcessControllerFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n\r\n            _controlledTypes.Add(typeof(IPublishControlled), typeof(IPublishProcessController));\r\n            _controlledTypes.Add(typeof(ILocalizedControlled), typeof(ILocalizeProcessController));\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will delete the data, and its if the exists its versions and publications\r\n        /// </summary>\r\n        /// <param name=\"data\"></param>\r\n        public static void FullDelete(IData data)\r\n        {\r\n            FullDelete(new[] {data});\r\n        }\r\n\r\n\r\n        internal static void FullDelete(IEnumerable<IData> dataset)\r\n        {\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                foreach (var data in dataset)\r\n                {\r\n                    if (data is IPublishControlled)\r\n                    {\r\n                        using (new DataScope(DataScopeIdentifier.Public))\r\n                        {\r\n                            IEnumerable<IData> datasDelete = DataFacade.GetDataFromOtherScope(data, DataScopeIdentifier.Public).Evaluate();\r\n\r\n                            DataFacade.Delete(datasDelete, CascadeDeleteType.Disable);\r\n                        }\r\n                    }\r\n\r\n                    using (new DataScope(DataScopeIdentifier.Administrated))\r\n                    {\r\n                        DataFacade.Delete(data);\r\n                    }\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method return the types that implements the same IProcessControlled interfaces as\r\n        /// the targetType.\r\n        /// </summary>\r\n        /// <param name=\"targetType\"></param>\r\n        /// <param name=\"types\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<Type> GetProcessControlledTypes(Type targetType, IEnumerable<Type> types)\r\n        {\r\n            if (targetType == null) throw new ArgumentNullException(\"targetType\");\r\n            if (types == null) throw new ArgumentNullException(\"types\");\r\n\r\n            List<Type> compatibleTypes = new List<Type>();\r\n\r\n            foreach (Type type in types)\r\n            {\r\n                foreach (Type processControledType in _controlledTypes.Keys)\r\n                {\r\n                    if (!compatibleTypes.Contains(type) &&\r\n                        processControledType.IsAssignableFrom(targetType) &&\r\n                        processControledType.IsAssignableFrom(type))\r\n                    {\r\n                        compatibleTypes.Add(type);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return compatibleTypes;\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<ElementAction> GetActions(IData data, Type elementProviderType)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n            if (elementProviderType == null) throw new ArgumentNullException(\"elementProviderType\");\r\n\r\n            var actions = new List<ElementAction>();\r\n\r\n            Dictionary<Type, Type> processControllerTypes = ProcessControllerRegistry.GetProcessControllerTypes(data.DataSourceId.InterfaceType);\r\n\r\n            foreach (Type processControllerType in processControllerTypes.Values)\r\n            {\r\n                IProcessController processController = _processControllers[processControllerType];\r\n\r\n                List<ElementAction> acts = processController.GetActions(data, elementProviderType);\r\n\r\n                if (acts != null)\r\n                {\r\n                    actions.AddRange(acts);\r\n                }\r\n            }\r\n\r\n            return actions;\r\n        }\r\n\r\n\r\n        #region IPublishControlled methods\r\n        /// <exclude />\r\n        public static void SetStartStatus(IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            IPublishProcessController controller = GetProcessController<IPublishProcessController>(data.DataSourceId.InterfaceType);\r\n\r\n            if (controller == null) throw new ArgumentException(string.Format(\"The type '{0}' is not registred process controller\", data.DataSourceId.InterfaceType));\r\n\r\n            controller.SetStartStatus(data);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IDictionary<string, string> GetValidTransitions(IData data)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            IPublishProcessController controller = GetProcessController<IPublishProcessController>(data.DataSourceId.InterfaceType);\r\n\r\n            if (controller == null) throw new ArgumentException(string.Format(\"The type '{0}' is not registred process controller\", data.DataSourceId.InterfaceType));\r\n\r\n            return controller.GetValidTransitions(data);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ValidateTransition(IData data, string status)\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            IPublishProcessController controller = GetProcessController<IPublishProcessController>(data.DataSourceId.InterfaceType);\r\n\r\n            if (controller == null) throw new ArgumentException(string.Format(\"The type '{0}' is not registred process controller\", data.DataSourceId.InterfaceType));\r\n\r\n            controller.ValidateTransition(data, status);\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Type GetProcessControllerType<T>(IData data)\r\n            where T : class, IProcessController\r\n        {\r\n            if (data == null) throw new ArgumentNullException(\"data\");\r\n\r\n            T controller = GetProcessController<T>(data.DataSourceId.InterfaceType);\r\n\r\n            if (controller == null) throw new ArgumentException(string.Format(\"The type '{0}' is not registred process controller\", data.DataSourceId.InterfaceType));\r\n\r\n            return controller.GetType();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IDisposable NoProcessControllers\r\n        {\r\n            get\r\n            {\r\n                return new NoProcessControllersDisposable();\r\n            }\r\n        }\r\n\r\n\r\n        private static void OnAfterDataUpdated(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            if (GetProcessControllersCounter() > 0) return;\r\n\r\n            if (dataEventArgs.Data is IPublishControlled)\r\n            {\r\n                IPublishProcessController controller = GetProcessController<IPublishProcessController>(dataEventArgs.Data.DataSourceId.InterfaceType);\r\n\r\n                if (controller != null)\r\n                {\r\n                    bool callAuxilaries = controller.OnAfterDataUpdated(dataEventArgs.Data);\r\n\r\n                    if (callAuxilaries)\r\n                    {\r\n                        IEnumerable<IPublishControlledAuxiliary> publishControlledAuxiliaries = GetPublishControlledAuxiliaries(dataEventArgs.DataType);\r\n\r\n                        foreach (IPublishControlledAuxiliary publishControlledAuxiliary in publishControlledAuxiliaries)\r\n                        {\r\n                            publishControlledAuxiliary.OnAfterDataUpdated(dataEventArgs.Data);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnDataBuildNew(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            if (GetProcessControllersCounter() > 0) return;\r\n\r\n            if (dataEventArgs.Data is IPublishControlled)\r\n            {\r\n                IPublishProcessController controller = GetProcessController<IPublishProcessController>(dataEventArgs.Data.DataSourceId.InterfaceType);\r\n\r\n                if (controller != null)\r\n                {\r\n                    bool callAuxilaries = controller.OnAfterBuildNew(dataEventArgs.Data);\r\n\r\n                    if (callAuxilaries)\r\n                    {\r\n                        IEnumerable<IPublishControlledAuxiliary> publishControlledAuxiliaries = GetPublishControlledAuxiliaries(dataEventArgs.DataType);\r\n\r\n                        foreach (IPublishControlledAuxiliary publishControlledAuxiliary in publishControlledAuxiliaries)\r\n                        {\r\n                            publishControlledAuxiliary.OnAfterBuildNew(dataEventArgs.Data);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (dataEventArgs.Data is ILocalizedControlled)\r\n            {\r\n                ILocalizeProcessController controller = GetProcessController<ILocalizeProcessController>(dataEventArgs.Data.DataSourceId.InterfaceType);\r\n\r\n                if (controller != null)\r\n                {\r\n                    controller.OnAfterBuildNew(dataEventArgs.Data);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static T GetProcessController<T>(Type dataType)\r\n            where T : class, IProcessController\r\n        {\r\n            Dictionary<Type, Type> processControllerTypes = ProcessControllerRegistry.GetProcessControllerTypes(dataType);\r\n\r\n            Type type;\r\n            if (processControllerTypes.TryGetValue(typeof(T), out type) == false)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return (T)_processControllers[type];\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<IPublishControlledAuxiliary> GetPublishControlledAuxiliaries(Type dataType)\r\n        {\r\n            List<IPublishControlledAuxiliary> publishControlledAuxiliaries;\r\n\r\n            if (!_publishControlledAuxiliaries.TryGetValue(dataType, out publishControlledAuxiliaries))\r\n            {\r\n                lock (_publishControlledAuxiliaries)\r\n                {\r\n                    if (!_publishControlledAuxiliaries.TryGetValue(dataType, out publishControlledAuxiliaries))\r\n                    {\r\n                        List<PublishControlledAuxiliaryAttribute> attributes = dataType.GetCustomAttributesRecursively<PublishControlledAuxiliaryAttribute>().ToList();\r\n\r\n                        publishControlledAuxiliaries = new List<IPublishControlledAuxiliary>();\r\n\r\n                        foreach (PublishControlledAuxiliaryAttribute attribute in attributes)\r\n                        {\r\n                            if (attribute.PublishControlledAuxiliaryType == null) throw new InvalidOperationException(string.Format(\"The PublishControlledAuxiliaryType may not be null on the {0}\", typeof(PublishControlledAuxiliaryAttribute)));\r\n                            if (typeof(IPublishControlledAuxiliary).IsAssignableFrom(attribute.PublishControlledAuxiliaryType) == false) throw new InvalidOperationException(string.Format(\"The {0} does not inheret the interface {1} the {2}\", attribute.PublishControlledAuxiliaryType, typeof(IPublishControlledAuxiliary), typeof(PublishControlledAuxiliaryAttribute)));\r\n\r\n                            ConstructorInfo constructorInfo = attribute.PublishControlledAuxiliaryType.GetConstructor(new Type[] { });\r\n                            if (constructorInfo == null) throw new InvalidOperationException(string.Format(\"The type {0} used by the {1} does not have a default contructor\", attribute.PublishControlledAuxiliaryType, typeof(PublishControlledAuxiliaryAttribute)));\r\n\r\n                            IPublishControlledAuxiliary publishControlledAuxiliary = (IPublishControlledAuxiliary)Activator.CreateInstance(attribute.PublishControlledAuxiliaryType, new object[] { });\r\n\r\n                            publishControlledAuxiliaries.Add(publishControlledAuxiliary);\r\n                        }\r\n\r\n                        _publishControlledAuxiliaries.Add(dataType, publishControlledAuxiliaries);\r\n                    }\r\n                }\r\n            }\r\n\r\n            foreach (IPublishControlledAuxiliary publishControlledAuxiliary in publishControlledAuxiliaries)\r\n            {\r\n                yield return publishControlledAuxiliary;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void Initialize_PostDataTypes()\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                GlobalInitializerFacade.ValidateIsOnlyCalledFromGlobalInitializerFacade(new StackTrace());\r\n            }\r\n\r\n            DoInitialize();\r\n        }\r\n\r\n\r\n\r\n        private static void DoInitialize()\r\n        {\r\n            _processControllers = new Dictionary<Type, IProcessController>();\r\n\r\n            foreach (Type processControllerType in ProcessControllerRegistry.ProcessControllerTypes)\r\n            {\r\n                IProcessController processController = (IProcessController)Activator.CreateInstance(processControllerType);\r\n\r\n                _processControllers.Add(processControllerType, processController);\r\n            }\r\n\r\n            if (!RuntimeInformation.IsUnittest)\r\n            {\r\n                foreach (Type dataType in DataFacade.GetAllInterfaces())\r\n                {\r\n                    Dictionary<Type, Type> processControllerTypes = ProcessControllerRegistry.GetProcessControllerTypes(dataType);\r\n\r\n                    foreach (var kvp in _controlledTypes)\r\n                    {\r\n                        if (kvp.Key.IsAssignableFrom(dataType))\r\n                        {\r\n                            if (!processControllerTypes.ContainsKey(kvp.Value))\r\n                            {\r\n                                throw new InvalidOperationException(string.Format(\"The data type {0} is inheriting the interface {1} but has not been assigned a {2} process controller\", dataType, kvp.Key, kvp.Value));\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IProcessControlled>(OnAfterDataUpdated, false);\r\n            DataEventSystemFacade.SubscribeToDataAfterBuildNew<IProcessControlled>(OnDataBuildNew, false);\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _processControllers = null;\r\n            _publishControlledAuxiliaries = new Hashtable<Type, List<IPublishControlledAuxiliary>>();\r\n        }\r\n\r\n\r\n\r\n        private static int GetProcessControllersCounter()\r\n        {\r\n            return ProcessControllersCounter.Counter;\r\n        }\r\n\r\n\r\n\r\n        private sealed class NoProcessControllersDisposable : IDisposable\r\n        {\r\n            public NoProcessControllersDisposable()\r\n            {\r\n                ProcessControllersCounter.Counter++;\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                ProcessControllersCounter.Counter--;\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~NoProcessControllersDisposable()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n\r\n\r\n\r\n        private sealed class CounterContainer\r\n        {\r\n            public CounterContainer()\r\n            {\r\n                this.Counter = 0;\r\n            }\r\n\r\n            public int Counter { get; set; }\r\n        }\r\n\r\n\r\n        private static CounterContainer ProcessControllersCounter\r\n        {\r\n            get\r\n            {\r\n                return RequestLifetimeCache.GetCachedOrNew<CounterContainer>(\"ProcessControllerFacade:ProcessControllersCounter\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ProcessControllers/DummyProcessControllers/PublishDummyProcessController.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\n\r\nnamespace Composite.Data.ProcessControlled.ProcessControllers.DummyProcessControllers\r\n{\r\n\tinternal sealed class PublishDummyProcessController : IPublishProcessController\r\n\t{\r\n        public void SetStartStatus(IData data)\r\n        {\r\n        }\r\n\r\n        public IDictionary<string, string> GetValidTransitions(IData data)\r\n        {\r\n            return new Dictionary<string, string>();\r\n        }\r\n\r\n        public bool OnAfterDataUpdated(IData data)\r\n        {\r\n            return true;\r\n        }\r\n\r\n        public bool OnAfterBuildNew(IData data)\r\n        {\r\n            return true;\r\n        }\r\n\r\n        public void ValidateTransition(IData data, string status)\r\n        {\r\n        }\r\n\r\n        public List<ElementAction> GetActions(IData data, Type elementProviderType)\r\n        {\r\n            return new List<ElementAction>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ProcessControllers/GenericLocalizeProcessController/GenericLocalizeProcessController.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Users;\r\nusing System.Globalization;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled.ProcessControllers.GenericLocalizeProcessController\r\n{\r\n\tinternal sealed class GenericLocalizeProcessController : ILocalizeProcessController\r\n\t{\r\n        public bool OnAfterBuildNew(IData data)\r\n        {\r\n            ILocalizedControlled localizedData = data as ILocalizedControlled;\r\n            if (localizedData != null)\r\n            {\r\n                if (!LocalizationScopeManager.IsEmpty)\r\n                {\r\n                    localizedData.SourceCultureName = LocalizationScopeManager.CurrentLocalizationScope.Name;\r\n                }\r\n                else\r\n                {\r\n                    CultureInfo cultureInfo = null;\r\n\r\n                    if (UserValidationFacade.IsLoggedIn())\r\n                    {\r\n                        cultureInfo = UserSettings.ActiveLocaleCultureInfo;\r\n                    }\r\n\r\n                    if (cultureInfo == null)\r\n                    {\r\n                        cultureInfo = DataLocalizationFacade.DefaultLocalizationCulture;\r\n                    }\r\n\r\n                    if (cultureInfo != null)\r\n                    {\r\n                        localizedData.SourceCultureName = cultureInfo.Name;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        public List<ElementAction> GetActions(IData data, Type elementProviderType)\r\n        {\r\n            // TODO: Add Localize action here?????\r\n            return new List<ElementAction>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ProcessControllers/GenericPublishProcessController/GenericPublishProcessController.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Transactions;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data.Transactions;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Data.Validation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Composite.Data.Types;\r\n\r\n\r\nusing ManagementStrings = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Management;\r\n\r\nnamespace Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class GenericPublishProcessController : IPublishProcessController\r\n    {\r\n        private static readonly string _oldPublishedStatusTag = \"OldPublishedStatus\";\r\n\r\n        /// <exclude />\r\n        public const string Draft = \"draft\";\r\n\r\n        /// <exclude />\r\n        public const string AwaitingApproval = \"awaitingApproval\";\r\n\r\n        /// <exclude />\r\n        public const string AwaitingPublication = \"awaitingPublication\";\r\n\r\n        /// <exclude />\r\n        public const string Published = \"published\";\r\n\r\n        /// <exclude />\r\n        public static string BulkPublishingCommandsTag { get; } = \"BulkPublishingCommands\";\r\n\r\n        private static readonly string _backToAwaitingApproval = \"awaitingApprovalBack\";\r\n        private static readonly string _forwardToAwaitingApproval = \"awaitingApprovalForward\";\r\n        private static readonly string _backToAwaitingPublication = \"awaitingPublicationBack\";\r\n        private static readonly string _forwardToAwaitingPublication = \"awaitingPublicationForward\";\r\n\r\n        private static readonly string _draftDisabled = \"draftDisabled\";\r\n        private static readonly string _awaitingApprovalDisabled = \"awaitingApprovalDisabled\";\r\n        private static readonly string _awaitingPublicationDisabled = \"awaitingPublicationDisabled\";\r\n        private static readonly string _publishedDisabled = \"publishedDisabled\";\r\n\r\n        private readonly IDictionary<string, IList<string>> _transitions;\r\n        private readonly IDictionary<string, IList<string>> _visualTransitions;\r\n        private readonly IDictionary<string, string> _transitionNames;\r\n        private readonly IDictionary<string, Func<ElementAction>> _visualTransitionsActions;  // Using visual transition names as keys\r\n\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle SendForwardForApproval { get { return GetIconHandle(\"item-send-forward-for-approval\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle SendForwardForPublication { get { return GetIconHandle(\"item-send-forward-for-publication\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle Publish { get { return GetIconHandle(\"item-publish\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle Unpublish { get { return GetIconHandle(\"item-unpublish\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle UndoUnpublishedChanges { get { return GetIconHandle(\"item-undo-unpublished-changes\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle SendBackToDraft { get { return GetIconHandle(\"item-send-back-to-draft\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle SendBackForApproval { get { return GetIconHandle(\"item-send-back-for-approval\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle SendBackForPublication { get { return GetIconHandle(\"item-send-back-for-publication\"); } }\r\n\r\n        /// <exclude />\r\n        public static readonly ActionGroup WorkflowActionGroup = new ActionGroup(\"Workflow\", ActionGroupPriority.PrimaryMedium);\r\n\r\n        /// <exclude />\r\n        public static readonly IEnumerable<PermissionType> AwaitingPublicationActionPermissionType = new PermissionType[] { PermissionType.Approve };\r\n\r\n        /// <exclude />\r\n        public GenericPublishProcessController()\r\n        {\r\n            _transitions = new Dictionary<string, IList<string>>\r\n            {\r\n                {Draft, new List<string> {AwaitingApproval, AwaitingPublication, Published}},\r\n                {AwaitingApproval, new List<string> {Draft, AwaitingPublication, Published}},\r\n                {AwaitingPublication, new List<string> {Draft, AwaitingApproval, Published}},\r\n                {Published, new List<string> {Draft, AwaitingApproval, AwaitingPublication}}\r\n            };\r\n\r\n            _visualTransitions = new Dictionary<string, IList<string>>\r\n            {\r\n                {Draft, new List<string> { _draftDisabled, _forwardToAwaitingApproval, _forwardToAwaitingPublication, Published }},\r\n                {AwaitingApproval, new List<string> { Draft, _awaitingApprovalDisabled, _forwardToAwaitingPublication, Published }},\r\n                {AwaitingPublication, new List<string> { Draft, _backToAwaitingApproval, _awaitingPublicationDisabled, Published }},\r\n                {Published, new List<string>()} // when public, no \"send to\" available.\r\n            };\r\n\r\n            _transitionNames = new Dictionary<string, string>\r\n            {\r\n                {Draft, ManagementStrings.PublishingStatus_draft},\r\n                {AwaitingApproval, ManagementStrings.PublishingStatus_awaitingApproval},\r\n                {AwaitingPublication, ManagementStrings.PublishingStatus_awaitingPublication},\r\n                {Published, ManagementStrings.PublishingStatus_published}\r\n            };\r\n\r\n            Func<ElementAction> sendBackToDraftAction = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.SendToDraft) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendToDraft\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendToDraftToolTip\"),\r\n                    Icon = GenericPublishProcessController.SendBackToDraft,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n\r\n            Func<ElementAction> sendForwardToAwaitingApprovalAction = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.SendForApproval) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForApproval\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForApprovalToolTip\"),\r\n                    Icon = GenericPublishProcessController.SendForwardForApproval,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n\r\n            Func<ElementAction> sendForwardToAwaitingPublicationAction = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.SendForPublication) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForPublication\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForPublicationToolTip\"),\r\n                    Icon = GenericPublishProcessController.SendForwardForPublication,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n\r\n            Func<ElementAction> publishAction = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Publish) {DoIgnoreEntityTokenLocking = true}))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"Publish\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"PublishToolTip\"),\r\n                    Icon = GenericPublishProcessController.Publish,\r\n                    Disabled = false,\r\n                    BulkExecutionDialog = new DialogStrings\r\n                    {\r\n                        Title = LocalizationFiles.Composite_Plugins_PageElementProvider.ViewUnpublishedItems_PublishConfirmTitle,\r\n                        Text = LocalizationFiles.Composite_Plugins_PageElementProvider.ViewUnpublishedItems_PublishConfirmText\r\n                    },\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup,\r\n                        ActionBundle = \"Publish\"\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n\r\n            // \"arrow pointing left when state change is going backwards\" actions\r\n            Func<ElementAction> sendBackToAwaitingApprovalAction = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.SendForApproval) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForApproval\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForApprovalToolTip\"),\r\n                    Icon = GenericPublishProcessController.SendForwardForApproval,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n\r\n            Func<ElementAction> sendBackToAwaitingPublicationAction = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.SendForPublication) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForPublication\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForPublicationToolTip\"),\r\n                    Icon = GenericPublishProcessController.SendForwardForApproval,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag,\r\n            };\r\n\r\n\r\n            // disabled actions\r\n            Func<ElementAction> draftActionDisabled = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.SendToDraft) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendToDraft\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendToDraftToolTip\"),\r\n                    Icon = GenericPublishProcessController.SendBackToDraft,\r\n                    Disabled = true,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n\r\n            Func<ElementAction> awaitingApprovalActionDisabled = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.SendForApproval) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForApproval\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForApprovalToolTip\"),\r\n                    Icon = GenericPublishProcessController.SendForwardForApproval,\r\n                    Disabled = true,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n\r\n            Func<ElementAction> awaitingPublicationActionDisabled = () => new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.SendForPublication) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForPublication\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"SendForPublicationToolTip\"),\r\n                    Icon = GenericPublishProcessController.SendBackForPublication,\r\n                    Disabled = true,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n\r\n\r\n            Func<ElementAction> publishActionDisabled = () => new ElementAction(new ActionHandle(new DisabledActionToken()))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"Publish\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"PublishToolTip\"),\r\n                    Icon = GenericPublishProcessController.Publish,\r\n                    Disabled = true,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = WorkflowActionGroup\r\n                    }\r\n                },\r\n                TagValue = BulkPublishingCommandsTag\r\n            };\r\n\r\n            _visualTransitionsActions = new Dictionary<string, Func<ElementAction>>\r\n            {\r\n                {Draft, sendBackToDraftAction},\r\n                {_backToAwaitingApproval, sendBackToAwaitingApprovalAction},\r\n                {_backToAwaitingPublication, sendBackToAwaitingPublicationAction},\r\n\r\n                {_forwardToAwaitingApproval, sendForwardToAwaitingApprovalAction},\r\n                {_forwardToAwaitingPublication, sendForwardToAwaitingPublicationAction},\r\n                {Published, publishAction},\r\n\r\n                {_draftDisabled, draftActionDisabled},\r\n                {_awaitingApprovalDisabled, awaitingApprovalActionDisabled},\r\n                {_awaitingPublicationDisabled, awaitingPublicationActionDisabled},\r\n                {_publishedDisabled, publishActionDisabled}\r\n            };\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public List<ElementAction> GetActions(IData data, Type elementProviderType)\r\n        {\r\n            if (!(data is IPublishControlled) ||\r\n                !data.DataSourceId.DataScopeIdentifier.Equals(DataScopeIdentifier.Administrated))\r\n            {\r\n                return new List<ElementAction>();\r\n            }\r\n\r\n            if (UserSettings.ActiveLocaleCultureInfo == null || data is ILocalizedControlled && !UserSettings.ActiveLocaleCultureInfo.Equals(data.DataSourceId.LocaleScope))\r\n            {\r\n                return new List<ElementAction>();\r\n            }\r\n\r\n            var publishControlled = (IPublishControlled)data;\r\n\r\n            IList<string> visualTrans;\r\n            if (!_visualTransitions.TryGetValue(publishControlled.PublicationStatus, out visualTrans))\r\n            {\r\n                throw new InvalidOperationException($\"Unknown publication state '{publishControlled.PublicationStatus}'\");\r\n            }\r\n\r\n            var clientActions = visualTrans.Select(newState => _visualTransitionsActions[newState]()).ToList();\r\n\r\n\r\n            IData publicData = DataFacade.GetDataFromOtherScope(data, DataScopeIdentifier.Public, true).FirstOrDefault();\r\n            if (publicData != null)\r\n            {\r\n                var unpublishAction = new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Unpublish) { DoIgnoreEntityTokenLocking = true }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"Unpublish\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"UnpublishToolTip\"),\r\n                        Icon = GenericPublishProcessController.Unpublish,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Other,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = WorkflowActionGroup\r\n                        }\r\n                    }\r\n                };\r\n\r\n                clientActions.Add(unpublishAction);\r\n\r\n\r\n\r\n                if (publishControlled.PublicationStatus == Draft)\r\n                {\r\n                    if (!ProcessControllerAttributesFacade.IsActionIgnored(elementProviderType, GenericPublishProcessControllerActionTypeNames.UndoUnpublishedChanges))\r\n                    {\r\n                        IActionTokenProvider actionTokenProvider = ProcessControllerAttributesFacade.GetActionTokenProvider(elementProviderType, GenericPublishProcessControllerActionTypeNames.UndoUnpublishedChanges);\r\n\r\n                        var actionToken = actionTokenProvider?.GetActionToken(GenericPublishProcessControllerActionTypeNames.UndoUnpublishedChanges, data)\r\n                                                             ?? new UndoPublishedChangesActionToken();\r\n\r\n                        var undoPublishedChangesAction = new ElementAction(new ActionHandle(actionToken))\r\n                        {\r\n                            VisualData = new ActionVisualizedData\r\n                            {\r\n                                Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"UndoPublishedChanges\"),\r\n                                ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"UndoPublishedChangesToolTip\"),\r\n                                Icon = GenericPublishProcessController.UndoUnpublishedChanges,\r\n                                Disabled = false,\r\n                                ActionLocation = new ActionLocation\r\n                                {\r\n                                    ActionType = ActionType.Other,\r\n                                    IsInFolder = false,\r\n                                    IsInToolbar = true,\r\n                                    ActionGroup = WorkflowActionGroup\r\n                                }\r\n                            }\r\n                        };\r\n\r\n                        clientActions.Add(undoPublishedChangesAction);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return clientActions;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void SetStartStatus(IData data)\r\n        {\r\n            if (!(data is IPublishControlled) ||\r\n                !data.DataSourceId.DataScopeIdentifier.Equals(DataScopeIdentifier.Administrated))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var publishControlled = (IPublishControlled)data;\r\n            publishControlled.PublicationStatus = Draft;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IDictionary<string, string> GetValidTransitions(IData data)\r\n        {\r\n            if (!(data is IPublishControlled) ||\r\n                !data.DataSourceId.DataScopeIdentifier.Equals(DataScopeIdentifier.Administrated))\r\n            {\r\n                return new Dictionary<string, string>();\r\n            }\r\n\r\n            return _transitionNames;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool OnAfterBuildNew(IData data)\r\n        {\r\n            var publishControlled = (IPublishControlled)data;\r\n\r\n            publishControlled.PublicationStatus = Draft;\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool OnAfterDataUpdated(IData data)\r\n        {\r\n            DataFacade.RemoveDataTag(data, _oldPublishedStatusTag);\r\n\r\n            if (!data.DataSourceId.DataScopeIdentifier.Equals(DataScopeIdentifier.Administrated)) return false;\r\n\r\n            var publishControlled = (IPublishControlled)data;\r\n\r\n            if (publishControlled.PublicationStatus == Published)\r\n            {\r\n                using (new DataScope(DataScopeIdentifier.Public))\r\n                {\r\n                    var existing = DataFacade.GetDataFromOtherScope((IData)publishControlled, DataScopeIdentifier.Public).Evaluate();\r\n\r\n                    if (existing.Any())\r\n                    {\r\n                        DataFacade.Delete(existing, CascadeDeleteType.Disable);\r\n                    }\r\n\r\n                    DataFacade.AddNew(data);\r\n                }\r\n\r\n                return true;\r\n            }\r\n\r\n            // Check when do we have this situation\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void ValidateTransition(IData data, string status)\r\n        {\r\n            var publishControlled = (IPublishControlled)data;\r\n            string oldTag;\r\n            if (DataFacade.TryGetDataTag<string>(publishControlled, _oldPublishedStatusTag, out oldTag))\r\n            {\r\n                if (status != oldTag)\r\n                {\r\n                    if (!_transitions[oldTag].Contains(status))\r\n                    {\r\n                        throw new ArgumentException(\"Invalid transition\");\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (!String.IsNullOrEmpty(publishControlled.PublicationStatus) && status != publishControlled.PublicationStatus)\r\n                {\r\n                    if (_transitions[publishControlled.PublicationStatus].Contains(status) == false)\r\n                    {\r\n                        throw new ArgumentException(\"Invalid transition\");\r\n                    }\r\n                }\r\n            }\r\n\r\n            DataFacade.SetDataTag(data, _oldPublishedStatusTag, status);\r\n        }\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n\r\n\r\n        internal sealed class PublishActionExecutor : IActionExecutor\r\n        {\r\n            public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n            {\r\n                DataEntityToken token = (DataEntityToken)entityToken;\r\n\r\n                IPublishControlled publishControlled = (IPublishControlled)DataFacade.GetDataFromDataSourceId(token.DataSourceId);\r\n\r\n                ValidationResults validationResults = ValidationFacade.Validate((IData)publishControlled);\r\n\r\n                if (validationResults.IsValid)\r\n                {\r\n                    UpdateTreeRefresher treeRefresher = new UpdateTreeRefresher(token.Data.GetDataEntityToken(), flowControllerServicesContainer);\r\n\r\n                    if (actionToken is PublishActionToken)\r\n                    {\r\n                        publishControlled.PublicationStatus = Published;\r\n                    }\r\n                    else if (actionToken is DraftActionToken)\r\n                    {\r\n                        publishControlled.PublicationStatus = Draft;\r\n                    }\r\n                    else if (actionToken is AwaitingApprovalActionToken)\r\n                    {\r\n                        publishControlled.PublicationStatus = AwaitingApproval;\r\n                    }\r\n                    else if (actionToken is AwaitingPublicationActionToken)\r\n                    {\r\n                        publishControlled.PublicationStatus = AwaitingPublication;\r\n                    }\r\n                    else if (actionToken is UnpublishActionToken)\r\n                    {\r\n                        publishControlled.PublicationStatus = Draft;\r\n\r\n                        using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n                        {\r\n                            IData data = DataFacade.GetDataFromOtherScope(token.Data, DataScopeIdentifier.Public).SingleOrDefault();\r\n\r\n                            if (data != null)\r\n                            {\r\n                                IPage page = data as IPage;\r\n                                if (page != null)\r\n                                {\r\n                                    IEnumerable<IData> referees;\r\n                                    using (new DataScope(DataScopeIdentifier.Public))\r\n                                    {\r\n                                        referees = page.GetMetaData();\r\n                                    }\r\n\r\n                                    DataFacade.Delete(referees, CascadeDeleteType.Disable);\r\n                                }\r\n\r\n\r\n                                DataFacade.Delete(data, CascadeDeleteType.Disable);\r\n                            }\r\n\r\n                            transactionScope.Complete();\r\n                        }\r\n                    }\r\n                    else if (actionToken is UndoPublishedChangesActionToken)\r\n                    {\r\n                        using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n                        {\r\n                            using (ProcessControllerFacade.NoProcessControllers)\r\n                            {\r\n                                var administrativeData = (IPublishControlled)token.Data;\r\n                                IData publishedData = DataFacade.GetDataFromOtherScope(token.Data, DataScopeIdentifier.Public).Single();\r\n\r\n                                publishedData.FullCopyChangedTo(administrativeData);\r\n                                administrativeData.PublicationStatus = Draft;\r\n\r\n                                DataFacade.Update(administrativeData);\r\n                            }\r\n\r\n                            transactionScope.Complete();\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new ArgumentException(\"Unknown action token\", \"actionToken\");\r\n                    }\r\n\r\n                    DataFacade.Update(publishControlled);\r\n\r\n                    treeRefresher.PostRefreshMesseges(publishControlled.GetDataEntityToken());\r\n                }\r\n                else\r\n                {\r\n                    var managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n                    StringBuilder sb = new System.Text.StringBuilder();\r\n                    sb.AppendLine(StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"ValidationErrorMessage\"));\r\n                    foreach (ValidationResult result in validationResults)\r\n                    {\r\n                        sb.AppendLine(result.Message);\r\n                    }\r\n\r\n                    managementConsoleMessageService.ShowMessage(DialogType.Error, StringResourceSystemFacade.GetString(\"Composite.Plugins.GenericPublishProcessController\", \"ValidationErrorTitle\"), sb.ToString());\r\n                }\r\n\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal sealed class DisabledActionToken : ActionToken\r\n        {\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get { yield break; }\r\n            }\r\n\r\n\r\n            public override string Serialize()\r\n            {\r\n                return \"\";\r\n            }\r\n\r\n\r\n            public static ActionToken Deserialize(string serializedData)\r\n            {\r\n                return new DisabledActionToken();\r\n            }\r\n        }\r\n\r\n\r\n        [ActionExecutor(typeof(PublishActionExecutor))]\r\n        internal sealed class PublishActionToken : ActionToken\r\n        {\r\n            private static IEnumerable<PermissionType> _permissionTypes = new [] { PermissionType.Publish };\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get { return _permissionTypes; }\r\n            }\r\n\r\n            public override bool IgnoreEntityTokenLocking => true;\r\n\r\n            public override string Serialize()\r\n            {\r\n                return Published;\r\n            }\r\n\r\n\r\n            public static ActionToken Deserialize(string serializedData)\r\n            {\r\n                return new PublishActionToken();\r\n            }\r\n        }\r\n\r\n\r\n        [ActionExecutor(typeof(PublishActionExecutor))]\r\n        internal sealed class UnpublishActionToken : ActionToken\r\n        {\r\n            private static IEnumerable<PermissionType> _permissionTypes = new PermissionType[] { PermissionType.Publish };\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get { return _permissionTypes; }\r\n            }\r\n\r\n            public override bool IgnoreEntityTokenLocking => true;\r\n\r\n            public override string Serialize()\r\n            {\r\n                return Published;\r\n            }\r\n\r\n\r\n            public static ActionToken Deserialize(string serializedData)\r\n            {\r\n                return new ProxyDataActionToken(ActionIdentifier.Unpublish);\r\n            }\r\n        }\r\n\r\n\r\n        [ActionExecutor(typeof(PublishActionExecutor))]\r\n        internal sealed class UndoPublishedChangesActionToken : ActionToken\r\n        {\r\n            private static IEnumerable<PermissionType> _permissionTypes = new [] { PermissionType.Edit, PermissionType.Publish };\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get { return _permissionTypes; }\r\n            }\r\n\r\n            public override bool IgnoreEntityTokenLocking => true;\r\n\r\n            public override string Serialize()\r\n            {\r\n                return \"\";\r\n            }\r\n\r\n\r\n            public static ActionToken Deserialize(string serializedData)\r\n            {\r\n                return new UndoPublishedChangesActionToken();\r\n            }\r\n        }\r\n\r\n\r\n        [ActionExecutor(typeof(PublishActionExecutor))]\r\n        internal sealed class DraftActionToken : ActionToken\r\n        {\r\n            private static IEnumerable<PermissionType> _permissionTypes = new [] { PermissionType.Edit, PermissionType.Approve, PermissionType.Publish };\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get { return _permissionTypes; }\r\n            }\r\n\r\n            public override bool IgnoreEntityTokenLocking => true;\r\n\r\n            public override string Serialize()\r\n            {\r\n                return Draft;\r\n            }\r\n\r\n\r\n            public static ActionToken Deserialize(string serializedData)\r\n            {\r\n                return new DraftActionToken();\r\n            }\r\n        }\r\n\r\n\r\n        [ActionExecutor(typeof(PublishActionExecutor))]\r\n        internal sealed class AwaitingApprovalActionToken : ActionToken\r\n        {\r\n            private static IEnumerable<PermissionType> _permissionTypes = new [] { PermissionType.Edit };\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get { return _permissionTypes; }\r\n            }\r\n\r\n            public override bool IgnoreEntityTokenLocking => true;\r\n\r\n            public override string Serialize()\r\n            {\r\n                return _forwardToAwaitingApproval;\r\n            }\r\n\r\n\r\n            public static Composite.C1Console.Security.ActionToken Deserialize(string serializedData)\r\n            {\r\n                return new AwaitingApprovalActionToken();\r\n            }\r\n        }\r\n\r\n\r\n        [ActionExecutor(typeof(PublishActionExecutor))]\r\n        internal sealed class AwaitingPublicationActionToken : ActionToken\r\n        {\r\n            private static IEnumerable<PermissionType> _permissionTypes = new [] { PermissionType.Approve };\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get { return _permissionTypes; }\r\n            }\r\n\r\n            public override bool IgnoreEntityTokenLocking => true;\r\n\r\n            public override string Serialize()\r\n            {\r\n                return _forwardToAwaitingApproval;\r\n            }\r\n\r\n\r\n            public static Composite.C1Console.Security.ActionToken Deserialize(string serializedData)\r\n            {\r\n                return new AwaitingPublicationActionToken();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ProcessControllers/GenericPublishProcessController/GenericPublishProcessControllerActionType.cs",
    "content": "﻿namespace Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController\r\n{\r\n    internal static class GenericPublishProcessControllerActionTypeNames\r\n    {\r\n        public const string UndoUnpublishedChanges = \"UndoUnpublishedChanges\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/ProcessControllers/GenericPublishProcessController/GenericPublishProcessDynamicActionTokens.cs",
    "content": "﻿using Composite.C1Console.Actions.Data;\r\nusing Composite.Core.Application;\r\n\r\nnamespace Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController\r\n{\r\n    [ApplicationStartup]\r\n    class GenericPublishProcessDynamicActionTokens\r\n    {\r\n        public static void OnBeforeInitialize()\r\n        {\r\n        }\r\n\r\n        public static void OnInitialized(DataActionTokenResolver resolver)\r\n        {\r\n            resolver.RegisterDefault<IData>(ActionIdentifier.SendForPublication, f => new GenericPublishProcessController.AwaitingPublicationActionToken());\r\n            resolver.RegisterDefault<IData>(ActionIdentifier.Publish, f => new GenericPublishProcessController.PublishActionToken());\r\n            resolver.RegisterDefault<IData>(ActionIdentifier.SendForApproval, f => new GenericPublishProcessController.AwaitingApprovalActionToken());\r\n            resolver.RegisterDefault<IData>(ActionIdentifier.SendToDraft, f => new GenericPublishProcessController.DraftActionToken());\r\n            resolver.RegisterDefault<IData>(ActionIdentifier.Unpublish, f => new GenericPublishProcessController.UnpublishActionToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControlled/PublishControlledAuxiliaryAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.ProcessControlled\r\n{\r\n    internal class PublishControlledAuxiliaryAttribute : Attribute\r\n    {\r\n        public PublishControlledAuxiliaryAttribute(Type publishControlledAuxiliaryType)\r\n        {\r\n            this.PublishControlledAuxiliaryType = publishControlledAuxiliaryType;\r\n        }\r\n\r\n\r\n\r\n        public Type PublishControlledAuxiliaryType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/ProcessControllerTypeAttribute.cs",
    "content": "﻿using System;\r\nusing Composite.Data.ProcessControlled;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary> \r\n    /// Binds imlementations of <see cref=\"IProcessController\"/> to data types\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class ProcessControllerTypeAttribute : Attribute\r\n    {\r\n        /// <exclude />\r\n        protected ProcessControllerTypeAttribute(Type processControllerType)\r\n        {\r\n            this.ProcessControllerType = processControllerType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Type ProcessControllerType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// Add this attribute to your data interface to specify what controller to use for publishing.\r\n    /// Your data type is expected to implement <see cref=\"Composite.Data.ProcessControlled.IPublishControlled\"/> when this attribute is used.\r\n    /// The type you specify is expected to implement <see cref=\"Composite.Data.ProcessControlled.IPublishProcessController\"/>.\r\n    /// For default publishing behaviour use the type <see cref=\"Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController.GenericPublishProcessController\"/>\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the PublishProcessControllerType attribute.\r\n    /// <code>\r\n    /// [PublishProcessControllerType(typeof(GenericPublishProcessController))]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData, IPublishControlled\r\n    /// {\r\n    ///     // data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]\r\n    public sealed class PublishProcessControllerTypeAttribute : ProcessControllerTypeAttribute\r\n    {\r\n        /// <summary>\r\n        /// Specify what controller to use for publishing.\r\n        /// For default publishing behaviour use the type <see cref=\"Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController.GenericPublishProcessController\"/>\r\n        /// </summary>\r\n        /// <param name=\"processControllerType\">Controller to use in publishing flow</param>\r\n        public PublishProcessControllerTypeAttribute(Type processControllerType)\r\n            : base(processControllerType)\r\n        {\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]\r\n    public sealed class LocalizeProcessControllerTypeAttribute : ProcessControllerTypeAttribute\r\n    {\r\n        /// <exclude />\r\n        public LocalizeProcessControllerTypeAttribute(Type processControllerType)\r\n            : base(processControllerType)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PublicationScope.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Define the scope of data in relation to publication status. Data which support publication should always be maintained \r\n    /// in the “Unpublihed” scope, while reading data on the public website should always be done in the “Published” scope. \r\n    /// Correct setting of the PublicationScope is typically handled by C1 CMS and should in general not be changed by developers. \r\n    /// Setting an explicit PublicationScope is typically only needed on new service end-points or \r\n    /// if specific features relating to data updating / publication is desired.\r\n    /// See <see cref=\"Composite.Data.DataConnection\"/>    \r\n    /// </summary>\r\n    ///// <seealso cref=\"Composite.Data.PageDataConnection\"/>\r\n    public enum PublicationScope\r\n    {\r\n        /// <summary>\r\n        /// Only show data that has been published.\r\n        /// </summary>\r\n        Published = 1,\r\n\r\n        /// <summary>\r\n        /// Show / update unpublished data.\r\n        /// </summary>\r\n        Unpublished = 0\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/PublishScheduling/PublishScheduleHelper.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Workflow.Runtime;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Data.PublishScheduling\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PublishScheduleHelper\r\n    {\r\n        /// <exclude />\r\n        public static void CreatePublishSchedule(Type dataType, string id, string cultureName, DateTime date, WorkflowInstance workflow)\r\n        {\r\n            var publishSchedule = DataFacade.BuildNew<IPublishSchedule>();\r\n\r\n            publishSchedule.Id = Guid.NewGuid();\r\n            publishSchedule.DataTypeId = dataType.GetImmutableTypeId();\r\n            publishSchedule.DataId = id;\r\n            publishSchedule.PublishDate = date;\r\n            publishSchedule.WorkflowInstanceId = workflow.InstanceId;\r\n            publishSchedule.LocaleCultureName = DataLocalizationFacade.IsLocalized(dataType) ? cultureName : \"\";\r\n\r\n            DataFacade.AddNew(publishSchedule);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void CreateUnpublishSchedule(Type dataType, string id, string cultureName, DateTime date, WorkflowInstance workflow)\r\n        {\r\n            var unpublishSchedule = DataFacade.BuildNew<IUnpublishSchedule>();\r\n\r\n            unpublishSchedule.Id = Guid.NewGuid();\r\n            unpublishSchedule.DataTypeId = dataType.GetImmutableTypeId();\r\n            unpublishSchedule.DataId = id;\r\n            unpublishSchedule.UnpublishDate = date;\r\n            unpublishSchedule.WorkflowInstanceId = workflow.InstanceId;\r\n            unpublishSchedule.LocaleCultureName = DataLocalizationFacade.IsLocalized(dataType) ? cultureName : \"\";\r\n\r\n            DataFacade.AddNew(unpublishSchedule);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IPublishSchedule GetPublishSchedule(Type dataType, string id, string cultureName)\r\n        {\r\n            Guid dataTypeId = dataType.GetImmutableTypeId();\r\n            var query = DataFacade.GetData<IPublishSchedule>().Where(ps => ps.DataId == id && ps.DataTypeId == dataTypeId);\r\n\r\n            if (DataLocalizationFacade.IsLocalized(dataType))\r\n            {\r\n                query = query.Where(ps => ps.LocaleCultureName == cultureName);\r\n            }\r\n\r\n            return query.FirstOrDefault();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IUnpublishSchedule GetUnpublishSchedule(Type dataType, string id, string cultureName)\r\n        {\r\n            Guid dataTypeId = dataType.GetImmutableTypeId();\r\n            var query = DataFacade.GetData<IUnpublishSchedule>().Where(ps => ps.DataId == id && ps.DataTypeId == dataTypeId);\r\n\r\n            if (DataLocalizationFacade.IsLocalized(dataType))\r\n            {\r\n                query = query.Where(ps => ps.LocaleCultureName == cultureName);\r\n            }\r\n\r\n            return query.FirstOrDefault();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/RelevantToUserTypeAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Add this attribute to your data interface to make it visible in the C1 Console developer UI.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the RelevantToUserType attribute.\r\n    /// <code>\r\n    /// [RelevantToUserType(UserType.Developer)]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     // data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]\r\n    public sealed class RelevantToUserTypeAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Make your data interface visible in the C1 Console developer UI.\r\n        /// </summary>\r\n        /// <param name=\"relevantToUserType\">The <see cref=\"Composite.Data.UserType\"/> this data type is relevant to. Only 'Developer' is available.</param>\r\n        public RelevantToUserTypeAttribute(UserType relevantToUserType)\r\n        {\r\n            this.UserType = relevantToUserType;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public RelevantToUserTypeAttribute(string relevantToUserTypeString)\r\n        {\r\n            this.UserType = (UserType)Enum.Parse( typeof(UserType), relevantToUserTypeString );\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public UserType UserType\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/RouteDateSegmentAttribute.cs",
    "content": "﻿using System;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Routing;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Describes which data format should be used while building a data url segment\r\n    /// </summary>\r\n    public enum DateSegmentFormat\r\n    {\r\n        /// <exclude />\r\n        Undefined = 0,\r\n        /// <summary>\r\n        /// Date url segment: '/Year'\r\n        /// </summary>\r\n        Year = 1,\r\n        /// <summary>\r\n        /// Date url segments: '/Year/Month'\r\n        /// </summary>\r\n        YearMonth = 2,\r\n        /// <summary>\r\n        /// Date url segments: '/Year/Month/Day'\r\n        /// </summary>\r\n        YearMonthDay = 3\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Makes the data type property of type <see cref=\"DateTime\"/> field appear in data url.\r\n    /// </summary>\r\n    public sealed class RouteDateSegmentAttribute : RouteSegmentAttribute\r\n    {\r\n        private readonly DateSegmentFormat _format;\r\n\r\n        /// <summary>\r\n        /// Makes the data type property of type <see cref=\"DateTime\"/> field appear in data url.\r\n        /// </summary>\r\n        public RouteDateSegmentAttribute(int order, DateSegmentFormat format = DateSegmentFormat.YearMonthDay)\r\n            : base(order)\r\n        {\r\n            if (format == DateSegmentFormat.Undefined)\r\n            {\r\n                format = DateSegmentFormat.YearMonthDay;\r\n            }\r\n\r\n            _format = format;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override IRelativeRouteToPredicateMapper BuildMapper(PropertyInfo propertyInfo)\r\n        {\r\n            Verify.That(propertyInfo.PropertyType == typeof(DateTime), \r\n                \"Property '{0}' of type '{1}' has attribute [{2}] with is applicable only for properties of type System.DateTime\",\r\n                propertyInfo.Name, propertyInfo.DeclaringType.FullName, typeof(RouteDateSegmentAttribute).Name);\r\n\r\n            return new DateUrlSegmentMapper(_format);\r\n        }\r\n\r\n        internal class DateUrlSegmentMapper : IRelativeRouteToPredicateMapper<DateTime>\r\n        {\r\n            private readonly DateSegmentFormat _format;\r\n\r\n            public DateUrlSegmentMapper(DateSegmentFormat format)\r\n            {\r\n                _format = format;\r\n            }\r\n\r\n            public int PathSegmentsCount\r\n            {\r\n                get\r\n                {\r\n                    switch (_format)\r\n                    {\r\n                        case DateSegmentFormat.Year:\r\n                            return 1;\r\n                        case DateSegmentFormat.YearMonth:\r\n                            return 2;\r\n                        case DateSegmentFormat.YearMonthDay:\r\n                            return 3;\r\n                    }\r\n\r\n                    throw new InvalidOperationException(\"Not supported DateSegmentFormat value: \" + _format);\r\n                }\r\n            }\r\n\r\n            public Expression<Func<DateTime, bool>> GetPredicate(Guid pageId, RelativeRoute route)\r\n            {\r\n                int year, month, day;\r\n\r\n                if (!int.TryParse(route.PathSegments[0], out year) || year < 0 || year > 10000)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                if (_format == DateSegmentFormat.Year)\r\n                {\r\n                    return date => date.Year == year;\r\n                }\r\n\r\n                if (!int.TryParse(route.PathSegments[1], out month) || month < 1 || month > 12)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                if (_format == DateSegmentFormat.YearMonth)\r\n                {\r\n                    return date => date.Year == year && date.Month == month;\r\n                }\r\n\r\n                if (!int.TryParse(route.PathSegments[2], out day) || day < 1 || day > DateTime.DaysInMonth(year, month))\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                return date => date.Year == year && date.Month == month && date.Day == day;\r\n            }\r\n\r\n            public RelativeRoute GetRoute(DateTime fieldValue, bool searchSignificant)\r\n            {\r\n                switch (_format)\r\n                {\r\n                    case DateSegmentFormat.Year:\r\n                        return new RelativeRoute\r\n                        {\r\n                            PathSegments = new[]\r\n                            {\r\n                                fieldValue.Year.ToString(),\r\n                            }\r\n                        };\r\n                    case DateSegmentFormat.YearMonth:\r\n                        return new RelativeRoute\r\n                        {\r\n                            PathSegments = new[]\r\n                            {\r\n                                fieldValue.Year.ToString(),\r\n                                fieldValue.Month.ToString(),\r\n                            }\r\n                        };\r\n                    case DateSegmentFormat.YearMonthDay:\r\n                        return new RelativeRoute\r\n                        {\r\n                            PathSegments = new[]\r\n                            {\r\n                                fieldValue.Year.ToString(),\r\n                                fieldValue.Month.ToString(),\r\n                                fieldValue.Day.ToString()\r\n                            }\r\n                        };\r\n                }\r\n\r\n                throw new InvalidOperationException(\"Not supported DateSegmentFormat value: \" + _format);\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/RouteSegmentAttribute.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Routing;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Indicates that the current property has to be used for building data url.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property)]\r\n    public class RouteSegmentAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Creates an instance of <see cref=\"RouteSegmentAttribute\"/>\r\n        /// </summary>\r\n        /// <param name=\"order\">The order. The fields with the lowest order will appear earlier in the path info part of the url.</param>\r\n        public RouteSegmentAttribute(int order)\r\n        {\r\n            Order = order;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Return the order of the segment. Segments with the lower number will appear in url path earlier.\r\n        /// </summary>\r\n        public int Order { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Build a segment to predicate mapper\r\n        /// </summary>\r\n        /// <param name=\"propertyInfo\"></param>\r\n        /// <returns></returns>\r\n        public virtual IRelativeRouteToPredicateMapper BuildMapper(PropertyInfo propertyInfo)\r\n        {\r\n            if (propertyInfo.PropertyType == typeof (DateTime))\r\n            {\r\n                return new RouteDateSegmentAttribute.DateUrlSegmentMapper(DateSegmentFormat.YearMonthDay);\r\n            }\r\n\r\n            if (propertyInfo.GetCustomAttributes<ForeignKeyAttribute>().Any())\r\n            {\r\n                var foreignKeyInfo = DataReferenceFacade.GetForeignKeyProperties(propertyInfo.DeclaringType)\r\n                    .FirstOrDefault(p => p.SourcePropertyName == propertyInfo.Name);\r\n\r\n                if (foreignKeyInfo != null)\r\n                {\r\n                    var targetType = foreignKeyInfo.TargetType;\r\n                    var dataTypeMapper = AttributeBasedRoutingHelper.GetPredicateMapper(targetType);\r\n                    if (dataTypeMapper != null)\r\n                    {\r\n                        var typeConst = typeof (DataReferenceRelativeRouteToPredicateMapper<,>)\r\n                            .MakeGenericType(targetType, foreignKeyInfo.SourcePropertyInfo.PropertyType)\r\n                            .GetConstructors().Single();\r\n\r\n                        return (IRelativeRouteToPredicateMapper) typeConst.Invoke(new object[] { dataTypeMapper });\r\n                    }\r\n                }\r\n            }\r\n\r\n            var type = typeof (DefaultRelativeRouteToPredicateMapper<>).MakeGenericType(propertyInfo.PropertyType);\r\n            var constructor = type.GetConstructor(new Type[0]);\r\n\r\n            return constructor.Invoke(null) as IRelativeRouteToPredicateMapper;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/SearchFacetAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Indicates that the field should be used as a search facet\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property)]\r\n    public class SearchFacetAttribute: Attribute\r\n    {\r\n        public SearchFacetAttribute()\r\n        {\r\n            \r\n        }\r\n\r\n        public int MinCount { get; set; } = int.MinValue;\r\n        public int Limit { get; set; } = int.MaxValue;\r\n\r\n        public virtual IEnumerable<string> GetTokens(object fieldValue)\r\n        {\r\n            if (fieldValue == null) return Enumerable.Empty<string>();\r\n            \r\n            var value = fieldValue.ToString();\r\n\r\n            if (string.IsNullOrEmpty(value)) return Enumerable.Empty<string>();\r\n\r\n            return new[] { value };\r\n        }\r\n\r\n        public string GetLabel(string stringValue)\r\n        {\r\n            return stringValue;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/SearchableFieldAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Indicates whether the field.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class SearchableFieldAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Indicates whether the field should be a part of the search index.\r\n        /// </summary>\r\n        /// <param name=\"indexText\">Indicates whether the field will be a part of the text index.</param>\r\n        /// <param name=\"previewable\">Indicates whether the field will will appear in search results.</param>\r\n        /// <param name=\"faceted\">Indicates whether the field will appear as a facet in search results.</param>\r\n        public SearchableFieldAttribute(bool indexText, bool previewable, bool faceted)\r\n        {\r\n            IndexText = indexText;\r\n            Previewable = previewable;\r\n            Faceted = faceted;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether the field will be a part of the text index.\r\n        /// </summary>\r\n        public bool IndexText { get; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether the field value will appear in search results.\r\n        /// </summary>\r\n        public bool Previewable { get; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether the field will appear as a facet in search results.\r\n        /// </summary>\r\n        public bool Faceted { get; }\r\n\r\n        //public int PreviewOrder { get; }= 1000;\r\n        //public int FacetFieldOrder { get; } = 1000;\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/SearchableTypeAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Indicates that the data of the given data type should be searchable.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Interface)]\r\n    public class SearchableTypeAttribute: Attribute\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/SitemapNavigator.cs",
    "content": "﻿using System;\r\nusing System.Collections.ObjectModel;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Implementation;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Provide access to the C1 CMS sitemap structure and primary page attributes.\r\n    /// </summary>\r\n    [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\")]\r\n    public class SitemapNavigator : ImplementationContainer<SitemapNavigatorImplementation>\r\n    {\r\n        /// <summary>\r\n        /// Initialize a new instance of the <see cref=\"SitemapNavigator\"/> class using sitemap data from the provided <see cref=\"DataConnection\"/>.\r\n        /// </summary>\r\n        /// <example>\r\n        /// using (DataConnection dataConnection = new DataConnection())\r\n        /// {\r\n        ///     SitemapNavigator sitemapNavigator = new SitemapNavigator(dataConnection);\r\n        ///     string thisPageTitle = sitemapNavigator.CurrentPageNode.Title;\r\n        /// }\r\n        /// </example>\r\n        /// <param name=\"connection\">The <see cref=\"DataConnection\"/> to read sitemap data from</param>\r\n        public SitemapNavigator(DataConnection connection)\r\n            : base(() => ImplementationFactory.CurrentFactory.CreateSitemapNavigator(connection))\r\n        {\r\n            if (connection == null) throw new ArgumentNullException(\"connection\");\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a <see cref=\"PageNode\"/> for a specific page id.\r\n        /// </summary>\r\n        /// <param name=\"id\">Id of page to find.</param>\r\n        /// <returns><see cref=\"PageNode\"/> for the page or null if no page was found with the given id.</returns>\r\n        public PageNode GetPageNodeById(Guid id)\r\n        {\r\n            return this.Implementation.GetPageNodeById(id);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets <see cref=\"PageNode\"/>'s for all homepages.\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"HomePage\")]\r\n        public IEnumerable<PageNode> HomePageNodes\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.HomePageNodes;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the Id's for all homepages.\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"HomePage\")]\r\n        public IEnumerable<Guid> HomePageIds\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.HomePageIds;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the <see cref=\"PageNode\"/> for the current page.\r\n        /// </summary>\r\n        public PageNode CurrentPageNode\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.CurrentPageNode;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the <see cref=\"PageNode\"/> for the current homepage.\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"HomePage\")]\r\n        public PageNode CurrentHomePageNode\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.CurrentHomePageNode;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the <see cref=\"PageNode\"/> relating to the hostname.\r\n        /// </summary>\r\n        /// <param name=\"hostname\">Hostname string to resolve to a <see cref=\"PageNode\"/>.</param>\r\n        /// <returns>The homepage <see cref=\"PageNode\"/> element matching the specified hostname or the default homepage.</returns>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Hostname\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"hostname\")]\r\n        public PageNode GetPageNodeByHostname(string hostname)\r\n        {\r\n            return this.Implementation.GetPageNodeByHostname(hostname);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the sitemaps for all sites. Do not modify this structure. To do modifications new up XElements taking sitemap root elements as parameter. \r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemaps\")]\r\n        public ReadOnlyCollection<XElement> AllSitemapsXml\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.AllSitemapsXml;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the sitemap for the current site. Do not modify this structure. To do modifications new up XElements taking sitemap root elements as parameter. \r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\")]\r\n        public XElement SitemapXml\r\n        {\r\n            get\r\n            {\r\n                return this.Implementation.SitemapXml;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the Id of the page currently being rendered\r\n        /// </summary>\r\n        public static Guid CurrentPageId\r\n        {\r\n            get\r\n            {\r\n                return ImplementationFactory.CurrentFactory.StatelessSitemapNavigator.CurrentPageId;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the Id of the top level page (homepage) for the page currently being rendered\r\n        /// </summary>\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"HomePage\")]\r\n        public static Guid CurrentHomePageId\r\n        {\r\n            get\r\n            {\r\n                return ImplementationFactory.CurrentFactory.StatelessSitemapNavigator.CurrentHomePageId;\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/SitemapScope.cs",
    "content": "﻿namespace Composite.Data\r\n{\r\n\r\n    /// <summary>\r\n    /// Define a set of elements in a tree structure, relative to a particular node.\r\n    /// </summary>\r\n    [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Sitemap\")]\r\n    public enum SitemapScope\r\n    {\r\n        /// <summary>\r\n        /// This page.\r\n        /// </summary>\r\n        Current = 0,\r\n\r\n        /// <summary>\r\n        /// Children of this page.\r\n        /// </summary>\r\n        Children = 2,\r\n\r\n        /// <summary>\r\n        /// All descendants of this page.\r\n        /// </summary>\r\n        Descendants = 20,\r\n\r\n        /// <summary>\r\n        /// All descendants of this page and this page.\r\n        /// </summary>\r\n        DescendantsAndCurrent = 1,\r\n\r\n        /// <summary>\r\n        /// Pages sharing the same parent as this page, excluding this page.\r\n        /// </summary>\r\n        Siblings = 15,\r\n\r\n        /// <summary>\r\n        /// Pages sharing the same parent as this page, including this page.\r\n        /// </summary>\r\n        SiblingsAndSelf = 21,\r\n\r\n        /// <summary>\r\n        /// All ancestor pages\r\n        /// </summary>\r\n        Ancestors = 3,\r\n\r\n        /// <exclude />\r\n        AncestorsAndCurrent = 4,\r\n\r\n        /// <exclude />\r\n        Parent = 5,\r\n\r\n        /// <exclude />\r\n        Level1 = 6,\r\n\r\n        /// <exclude />\r\n        Level1AndSiblings = 16,\r\n\r\n        /// <exclude />\r\n        Level1AndDescendants = 10,\r\n\r\n        /// <exclude />\r\n        Level2 = 7,\r\n\r\n        /// <exclude />\r\n        Level2AndSiblings = 17,\r\n\r\n        /// <exclude />\r\n        Level2AndDescendants = 11,\r\n\r\n        /// <exclude />\r\n        Level3 = 8,\r\n\r\n        /// <exclude />\r\n        Level3AndSiblings = 18,\r\n\r\n        /// <exclude />\r\n        Level3AndDescendants = 12,\r\n\r\n        /// <exclude />\r\n        Level4 = 9,\r\n\r\n        /// <exclude />\r\n        Level4AndSiblings = 19,\r\n\r\n        /// <exclude />\r\n        Level4AndDescendants = 13,\r\n\r\n        /// <exclude />\r\n        All = 14\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/StoreEventArgs.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// This class contains information for store change events. No specifics will be given as to which data item(s) were changed, \r\n    /// but the store (type, scope, language) is available. \r\n    /// \r\n    /// Property DataEventsFired indicate if detailed data events have already been fired for the data store change. In situations where data\r\n    /// was changed in the physical store by another process, detailed events cannot be fired and you need to rely on the StoreChange event to do cache flushed etc.\r\n    /// </summary>\r\n    /// <example>\r\n    /// <code>\r\n    /// void MyMethod()\r\n    /// {\r\n    ///    DataEvents&lt;IMyDataType&gt;().OnStoreChange += new StoreEventHandler(DataEvents_StoreChanged);\r\n    ///    \r\n    ///    using (DataConnection connection = new DataConnection())\r\n    ///    {\r\n    ///       IMyDataType myDataType = DataConnection.New&lt;IMyDataType&gt;();\r\n    ///       myDataType.Name = \"Foo\";\r\n    ///       \r\n    ///       connection.Add&lt;IMyDataType&gt;(myDataType); // This will fire the event - changes are made to the store!\r\n    ///    }\r\n    /// }\r\n    /// \r\n    /// \r\n    /// void DataEvents_StoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n    /// {        \r\n    ///    Type dataType = storeEventArgs.DataType; // This will be the type that changed\r\n    ///    PublicationScope scope = storeEventArgs.PublicationScope; // The scope the event happened in - published vs. administrated\r\n    ///    CultureInfo locale = storeEventArgs.Locale; // The culture (language) the event happened in\r\n    ///    bool dataEventsFired = storeEventArgs.DataEventsFired; // True is detailed data item events have fired. False if a store reload happened and detailed events cannot be fired.\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    public class StoreEventArgs : EventArgs\r\n    {\r\n        private readonly Type _dataType;\r\n        private readonly PublicationScope _publicationScope;\r\n        private readonly CultureInfo _locale;\r\n        private readonly bool _dataEventsFired;\r\n\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"StoreEventArgs\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"dataType\">Type of the data.</param>\r\n        /// <param name=\"publicationScope\">The publication scope.</param>\r\n        /// <param name=\"locale\">The locale.</param>\r\n        /// <param name=\"dataEventsFired\">Value indicating whether detailed data events have been fired for this change event. \r\n        /// When <c>false</c> the change happened outside the current process \r\n        /// (in the physical store, perhaps done by another running instance). </param>\r\n        /// <exclude/>\r\n        internal StoreEventArgs(Type dataType, PublicationScope publicationScope, CultureInfo locale, bool dataEventsFired)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentNotNull(publicationScope, \"publicationScope\");\r\n\r\n            _dataType = dataType;\r\n            _publicationScope = publicationScope;\r\n            _locale = locale;\r\n            _dataEventsFired = dataEventsFired;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the data type that is the subject of the event fired.\r\n        /// </summary>\r\n        public Type DataType\r\n        {\r\n            get { return _dataType; }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the data scope that is the subject of the event fired.\r\n        /// </summary>\r\n        public PublicationScope PublicationScope\r\n        {\r\n            get\r\n            {\r\n                return _publicationScope;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the locale that is the subject of the event fired.\r\n        /// </summary>\r\n        public CultureInfo Locale\r\n        {\r\n            get\r\n            {\r\n                return _locale;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a value indicating if detailed data events have been fired for this change event. When false the change happened outside the current process \r\n        /// (in the physical store, perhaps done by another running instance). You can rely on detailed data events to do precise cache management and use the StoreChange event\r\n        /// when DataEventsFired is false to do a complete cache flush.\r\n        /// </summary>\r\n        public bool DataEventsFired\r\n        {\r\n            get\r\n            {\r\n                return _dataEventsFired;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/StoreEventHandler.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// The event handle type for data store change events. These events may be both internally and externally provoked.\r\n    /// </summary>\r\n    /// <param name=\"sender\"></param>\r\n    /// <param name=\"storeEventArgs\"></param>    \r\n    [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1003:UseGenericEventHandlerInstances\", Justification = \"We keep handler in line tiwh DataEventHandler\")]\r\n    public delegate void StoreEventHandler(object sender, StoreEventArgs storeEventArgs);\r\n}\r\n"
  },
  {
    "path": "Composite/Data/StoreFieldTypeAttribute.cs",
    "content": "﻿using System;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Specifies what physical store type should be used to store this property.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the StoreFieldType attribute. \r\n    /// Here a string field with a maximum of 40 characters.\r\n    /// <code>\r\n    /// // data interface attributes ...\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     [StoreFieldType(PhysicalStoreFieldType.String, 40)]\r\n    ///     [ImmutableFieldId(\"{D75EA67F-AD14-4BAB-8547-6D87002809F1}\")]\r\n    ///     string ProductName { get; set; }\r\n    ///     \r\n    ///     // more data properties ...\r\n    ///     \r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n    public sealed class StoreFieldTypeAttribute : Attribute\r\n    {\r\n        private StoreFieldTypeAttribute()\r\n        {\r\n            this.IsNullable = false;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Specifies what physical store type should be used to store this property.\r\n        /// This overload is intended for int, long, large string, date time, guid and bool.\r\n        /// For decimal and string, use other overload where you can specify length values also.\r\n        /// </summary>\r\n        /// <param name=\"physicalStoreFieldType\">PhysicalStoreFieldType to use</param>\r\n        public StoreFieldTypeAttribute(PhysicalStoreFieldType physicalStoreFieldType)\r\n            : this()\r\n        {\r\n            switch (physicalStoreFieldType)\r\n            {\r\n                case PhysicalStoreFieldType.Integer:\r\n                    this.StoreFieldType = StoreFieldType.Integer;\r\n                    return;\r\n                case PhysicalStoreFieldType.Long:\r\n                    this.StoreFieldType = StoreFieldType.Long;\r\n                    return;\r\n                case PhysicalStoreFieldType.LargeString:\r\n                    this.StoreFieldType = StoreFieldType.LargeString;\r\n                    return;\r\n                case PhysicalStoreFieldType.DateTime:\r\n                    this.StoreFieldType = StoreFieldType.DateTime;\r\n                    return;\r\n                case PhysicalStoreFieldType.Guid:\r\n                    this.StoreFieldType = StoreFieldType.Guid;\r\n                    return;\r\n                case PhysicalStoreFieldType.Boolean:\r\n                    this.StoreFieldType = StoreFieldType.Boolean;\r\n                    return;\r\n            }\r\n\r\n            throw new ArgumentException(string.Format(\"[{0}] - field type {1}.{2} require some aditional arguments in the attribute constructor.\",\r\n                this.GetType().Name, typeof(PhysicalStoreFieldType).Name, physicalStoreFieldType));\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Specifies what physical store type should be used to store this property.\r\n        /// This overload is intended for string.\r\n        /// </summary>\r\n        /// <param name=\"physicalStoreFieldType\">PhysicalStoreFieldType to use - PhysicalStoreFieldType.String expected</param>\r\n        /// <param name=\"maxLength\">Number of characters to reserve in physical store</param>\r\n        public StoreFieldTypeAttribute(PhysicalStoreFieldType physicalStoreFieldType, int maxLength)\r\n            : this()\r\n        {\r\n            switch (physicalStoreFieldType)\r\n            {\r\n                case PhysicalStoreFieldType.String:\r\n                    this.StoreFieldType = StoreFieldType.String(maxLength);\r\n                    return;\r\n            }\r\n\r\n            throw new ArgumentException(string.Format(\"[{0}] - field type {1}.{2} does not take an int argument in the attribute constructor.\",\r\n                this.GetType().Name, typeof(PhysicalStoreFieldType).Name, physicalStoreFieldType));\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Specifies what physical store type should be used to store this property.\r\n        /// This overload is intended for decimal.\r\n        /// </summary>\r\n        /// <param name=\"physicalStoreFieldType\">PhysicalStoreFieldType to use - PhysicalStoreFieldType.Decimal expected</param>\r\n        /// <param name=\"numericPrecision\">Numeric precision for decimal</param>\r\n        /// <param name=\"numericScale\">Numeric scale for decimal</param>\r\n        public StoreFieldTypeAttribute(PhysicalStoreFieldType physicalStoreFieldType, int numericPrecision, int numericScale)\r\n            : this()\r\n        {\r\n            switch (physicalStoreFieldType)\r\n            {\r\n                case PhysicalStoreFieldType.Decimal:\r\n                    this.StoreFieldType = StoreFieldType.Decimal(numericPrecision, numericScale);\r\n                    return;\r\n            }\r\n\r\n            throw new ArgumentException(string.Format(\"[{0}] - field type {1}.{2} does not take two 'int' arguments in the attribute constructor.\",\r\n                this.GetType().Name, typeof(PhysicalStoreFieldType).Name, physicalStoreFieldType));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public StoreFieldType StoreFieldType { get; private set; }\r\n\r\n\r\n        /// <summary>\r\n        /// When true the data store can allow null values. Default is false.\r\n        /// </summary>\r\n        public bool IsNullable { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/StoreSortOrderAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Add this attribute to your data interface to control the physical store sort order of data.\r\n    /// This concept is known as the clustered index on SQL Server.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the StoreSortOrder attribute.\r\n    /// <code>\r\n    /// [StoreSortOrderAttribute(\"Date\", \"Title\")]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     // data type properties, must include Date and Title since we ref them above\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = true)]\r\n    public sealed class StoreSortOrderAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Sprcify the names of properties to order data by in the physical store. The specified names must exist as properties on your data type.\r\n        /// </summary>\r\n        /// <param name=\"sortOrder\">Names of properties to order data by in the physical store.</param>\r\n        public StoreSortOrderAttribute(params string[] sortOrder)\r\n        {\r\n            this.SortOrder = sortOrder;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string[] SortOrder\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Streams/CachedMemoryStream.cs",
    "content": "using System.IO;\r\n\r\n\r\nnamespace Composite.Data.Streams\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class CachedMemoryStream : MemoryStream\r\n    {\r\n        private byte[] _data = null;\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public byte[] Data\r\n        {\r\n            get { return _data; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override void Close()\r\n        {\r\n            SaveData();\r\n\r\n            base.Close();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override void Dispose(bool disposing)\r\n        {\r\n            SaveData();\r\n\r\n            base.Dispose(disposing);\r\n        }\r\n\r\n\r\n\r\n        private void SaveData()\r\n        {\r\n            if (_data == null)\r\n            {\r\n                this.Seek(0, SeekOrigin.Begin);\r\n\r\n                _data = new byte[this.Length];\r\n\r\n                this.Read(_data, 0, (int)this.Length);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Streams/FileStreamManagerAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data.Streams\r\n{\r\n    /// <summary>\r\n    /// Expected on <see cref=\"Composite.Data.Types.IFile\"/> classes to identify what <see cref=\"IFileStreamManager\"/> can provide read/write and monitoring access to files.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]\r\n    public class FileStreamManagerAttribute : Attribute\r\n    {\r\n        private Type _fileStreamManagerType;\r\n\r\n\r\n        /// <summary>\r\n        /// Identify the <see cref=\"IFileStreamManager\"/> that provide read/write and monitoring access to the file represented by the <see cref=\"Composite.Data.Types.IFile\"/> this \r\n        /// <see cref=\"FileStreamManagerAttribute\"/> is attached to.\r\n        /// </summary>\r\n        /// <param name=\"fileStreamManagerType\">the type of the class implementing <see cref=\"IFileStreamManager\"/> for this file.</param>\r\n        public FileStreamManagerAttribute(Type fileStreamManagerType)\r\n        {\r\n            _fileStreamManagerType = fileStreamManagerType;\r\n        }\r\n\r\n\r\n        internal Type FileStreamManagerResolverType\r\n        {\r\n            get { return _fileStreamManagerType; }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Streams/FileStreamManagerLocator.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Data.Streams\r\n{\r\n    internal static class FileStreamManagerLocator\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static FileStreamManagerLocator()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IFileStreamManager GetFileStreamManager(Type fileType)\r\n        {\r\n            if (fileType == null) throw new ArgumentNullException(\"fileType\");\r\n\r\n            IFileStreamManager fileStreamManager;\r\n\r\n            if (_resourceLocker.Resources.FileStreamManagerCache.TryGetValue(fileType, out fileStreamManager) == false)\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    if (_resourceLocker.Resources.FileStreamManagerCache.TryGetValue(fileType, out fileStreamManager) == false)\r\n                    {\r\n                        object[] attributes = fileType.GetCustomAttributes(typeof (FileStreamManagerAttribute), true);\r\n\r\n                        if (attributes.Length == 0) throw new InvalidOperationException(string.Format(\"The type '{0}' is missing the attribute '{1}'\", fileType, typeof (FileStreamManagerAttribute)));\r\n                        FileStreamManagerAttribute fileStreamManagerResolverAttribute = (FileStreamManagerAttribute) attributes[0];\r\n\r\n                        Type fileStreamManagerType = fileStreamManagerResolverAttribute.FileStreamManagerResolverType;\r\n\r\n                        if (fileStreamManagerType == null) throw new InvalidOperationException(string.Format(\"The constructor argument of '{0}' may not be null\", typeof (FileStreamManagerAttribute)));\r\n                        if (typeof (IFileStreamManager).IsAssignableFrom(fileStreamManagerType) == false) throw new InvalidOperationException( string.Format(\"The type '{0}' does not implement the interface '{1}'\", fileStreamManagerType, typeof (IFileStreamManager)));\r\n\r\n                        fileStreamManager = (IFileStreamManager) Activator.CreateInstance(fileStreamManagerType);\r\n\r\n                        _resourceLocker.Resources.FileStreamManagerCache.Add(fileType, fileStreamManager);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return fileStreamManager;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Hashtable<Type, IFileStreamManager> FileStreamManagerCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.FileStreamManagerCache = new Hashtable<Type, IFileStreamManager>();\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Streams/IFileStreamManager.cs",
    "content": "﻿using System.IO;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Data.Streams\r\n{\r\n    /// <summary>\r\n    /// Declare what type of change happened to a file.\r\n    /// </summary>\r\n    public enum FileChangeType\r\n    {\r\n        /// <exclude />\r\n        Undefined = 0,\r\n\r\n        /// <exclude />\r\n        Modified = 1,\r\n\r\n        /// <exclude />\r\n        Renamed = 2,\r\n\r\n        /// <exclude />\r\n        Deleted = 3\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Delegate used to signal changes to a file.\r\n    /// </summary>\r\n    public delegate void OnFileChangedDelegate(string filePath, FileChangeType changeType);\r\n\r\n\r\n    /// <summary>\r\n    /// Data Providers which expose <see cref=\"Composite.Data.Types.IFile\"/> elements \r\n    /// (like <see cref=\"Composite.Data.Types.IMediaFile\"/> for a custom Media File Provider) expose access to stream reads/writes by annotating \r\n    /// the class implementing <see cref=\"Composite.Data.Types.IFile\"/> with the <see cref=\"FileStreamManagerAttribute\"/> attribute, \r\n    /// passing the type of a <see cref=\"IFileStreamManager\"/> as attribute parameter.\r\n    /// C1 CMS will, via the attribute on the <see cref=\"Composite.Data.Types.IFile\"/>, get the type responsible for stream reads/writes.\r\n    /// \r\n    /// The class implementing this interface is expected to provide read/write access to the file store being introduced by a file oriented File Provider.\r\n    /// </summary>\r\n    /// <example>\r\n    /// Here is an example of how to inform C1 CMS about IFileStreamManager\r\n    /// <code>\r\n    /// [FileStreamManager(typeof(MyFileStreamManager))]\r\n    /// public abstract class SomeFile : IFile\r\n    /// {\r\n    ///    /// ....\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    public interface IFileStreamManager\r\n    {\r\n        /// <summary>\r\n        /// Returns the stream for the given file, represented as IFile. The stream is for reading.\r\n        /// </summary>\r\n        /// <param name=\"file\">The data element representing the file for which a read stream is desired.</param>\r\n        /// <returns>Stream for reading</returns>\r\n        Stream GetReadStream(IFile file);\r\n\r\n        /// <summary>\r\n        /// Returns the stream for the given file, represented as IFile. This may be a new file, in which case the file stream manager is expected to create the file.\r\n        /// </summary>\r\n        /// <param name=\"file\">The data element representing the file for which a write stream is desired.</param>\r\n        /// <returns>Stream for writing</returns>\r\n        Stream GetNewWriteStream(IFile file);\r\n\r\n        /// <summary>\r\n        /// The provided handler should be invoked if the file, represented as IFile, changes in the concrete store this IFileStreamManager represents.\r\n        /// </summary>\r\n        /// <param name=\"file\">The file to monitor for file changes</param>\r\n        /// <param name=\"handler\">The handler to be invoked on changes</param>\r\n        void SubscribeOnFileChanged(IFile file, OnFileChangedDelegate handler);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/TitleAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Add this attribute to your data interface to give it a human readable title to be used in the C1 Console\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the Title attribute.\r\n    /// <code>\r\n    /// [Title(\"My Data Type\")]\r\n    /// // (other IData attributes)\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     // data type properties\r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]\r\n\tpublic sealed class TitleAttribute : Attribute\r\n\t{\r\n        /// <summary>\r\n        /// Set the title\r\n        /// </summary>\r\n        /// <param name=\"title\">The (human readable) title to give the data type</param>\r\n        public TitleAttribute(string title)\r\n        {\r\n            this.Title = title;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Title\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Transactions/TransactionsFacade.cs",
    "content": "using System.Transactions;\r\nusing System;\r\n\r\nnamespace Composite.Data.Transactions\r\n{\r\n    /// <summary>\r\n    /// Ensures C1 compiant System.Transactions.TransactionScope services.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class TransactionsFacade\r\n\t{\r\n        /// <exclude />\r\n        public static TimeSpan DefaultTransactionTimeout { get { return TimeSpan.FromMinutes(3); } }\r\n\r\n        /// <exclude />\r\n        public static IsolationLevel DefaultTransactionIsolationLevel { get { return IsolationLevel.RepeatableRead; } }\r\n\r\n\r\n        /// <exclude />\r\n        public static TransactionScope CreateNewScope()\r\n        {\r\n            return Create(false, DefaultTransactionTimeout);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static TransactionScope Create(bool requiresNew)\r\n        {\r\n            return Create(requiresNew, DefaultTransactionTimeout);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static TransactionScope Create(bool requiresNew, TimeSpan timeSpan)\r\n        {\r\n            IsolationLevel isolationLevel = (Transaction.Current != null ? Transaction.Current.IsolationLevel : DefaultTransactionIsolationLevel);\r\n            \r\n            var transOptions = new TransactionOptions\r\n            {\r\n                IsolationLevel = isolationLevel,\r\n                Timeout = timeSpan\r\n            };\r\n\r\n\r\n            return new TransactionScope(requiresNew ? TransactionScopeOption.RequiresNew : TransactionScopeOption.Required, transOptions);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static TransactionScope CreateNewScope(TimeSpan timeSpan)\r\n        {\r\n            return Create(false, timeSpan);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static TransactionScope SuppressTransactionScope()\r\n        {\r\n            return new TransactionScope(TransactionScopeOption.Suppress);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/TreeOrderingProfileAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>\r\n    /// Assign this to properties on your IData interfaces to control default ordering of tree items.\r\n    /// </summary>\r\n    /// <example> This sample shows how to use the TreeOrdering attribute.\r\n    /// <code>\r\n    /// // data interface attributes ...\r\n    /// interface IMyDataType : IData\r\n    /// {\r\n    ///     [TreeOrdering(1)]\r\n    ///     [StoreFieldType(PhysicalStoreFieldType.String, 40)]\r\n    ///     [ImmutableFieldId(\"{D75EA67F-AD14-4BAB-8547-6D87002809F1}\")]\r\n    ///     string ProductName { get; set; }\r\n    ///     \r\n    ///     // more data properties ...\r\n    ///     \r\n    /// }\r\n    /// </code>\r\n    /// </example>    \r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]\r\n\tpublic sealed class TreeOrderingAttribute : Attribute\r\n\t{\r\n        /// <summary>\r\n        /// Specify that this field should be used for default tree node ordering. Order is by default ascending.\r\n        /// Multiple fields on a data type may have ordering. In that case the orderPriority has importance.\r\n        /// </summary>\r\n        /// <param name=\"orderPriority\">Priority controls which fields are used first when ordering. Low number win.</param>\r\n        public TreeOrderingAttribute(int orderPriority)\r\n        {\r\n            this.Priority = orderPriority;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Specify that this field should be used for default tree node ordering. Order is by default ascending.\r\n        /// Multiple fields on a data type may have ordering. In that case the orderPriority has importance.\r\n        /// </summary>\r\n        /// <param name=\"orderPriority\">Priority controls which fields are used first when ordering. Low number win.</param>\r\n        /// <param name=\"orderDescending\">When true this field will be used in descending (Z-A) order.</param>\r\n        public TreeOrderingAttribute(int orderPriority, bool orderDescending)\r\n        {\r\n            this.Priority = orderPriority;\r\n            this.Descending = orderDescending;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Priority for ordering. When multiple fields have this attribute attached this field is used. Low number win.\r\n        /// </summary>\r\n        public int Priority { get; set; }\r\n\r\n        /// <summary>\r\n        /// When true descending order (Z-A) will be used.\r\n        /// </summary>\r\n        public bool Descending { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ExtensionMethods/IFileExtensions.cs",
    "content": "using System.IO;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.IO;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Streams;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>\r\n    /// Extension methods for IFile\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IFileExtensions\r\n    {\r\n        /// <exclude />\r\n        public static Stream GetReadStream(this IFile file)\r\n        {\r\n            IFileStreamManager manager = FileStreamManagerLocator.GetFileStreamManager(file.GetType());\r\n\r\n            return manager.GetReadStream(file);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static Stream GetNewWriteStream(this IFile file)\r\n        {\r\n            IFileStreamManager manager = FileStreamManagerLocator.GetFileStreamManager(file.GetType());\r\n\r\n            return manager.GetNewWriteStream(file);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void SubscribeOnChanged(this IFile file, OnFileChangedDelegate handler)\r\n        {\r\n            IFileStreamManager manager = FileStreamManagerLocator.GetFileStreamManager(file.GetType());\r\n\r\n            manager.SubscribeOnFileChanged(file, handler);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns all text from the stream associated with the provided IFile\r\n        /// </summary>\r\n        public static string ReadAllText(this IFile file)\r\n        {\r\n            using (Stream fileStream = GetReadStream(file))\r\n            {\r\n                using (C1StreamReader sr = new C1StreamReader(fileStream))\r\n                {\r\n                    return sr.ReadToEnd();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Replaces the all files content with some new content\r\n        /// </summary>\r\n        /// <param name=\"file\"></param>\r\n        /// <param name=\"newContent\"></param>\r\n        public static void SetNewContent(this IFile file, string newContent)\r\n        {\r\n            using (C1StreamWriter sw = new C1StreamWriter(GetNewWriteStream(file)))\r\n            {\r\n                sw.Write(newContent);\r\n            }\r\n        }\r\n\r\n        internal static string GetFilePath(this IFile file)\r\n        {\r\n            return (file is FileSystemFileBase) ? (file as FileSystemFileBase).SystemPath : null;\r\n        }\r\n\r\n        internal static string GetRelativeFilePath(this IFile file)\r\n        {\r\n            string filePath = GetFilePath(file);\r\n            if (filePath == null) return null;\r\n\r\n            return filePath.StartsWith(PathUtil.BaseDirectory) ? filePath.Substring(PathUtil.BaseDirectory.Length) : filePath;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Types/ExtensionMethods/IMediaFileExtensions.cs",
    "content": "﻿namespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class IMediaFileExtensions\r\n\t{\r\n        /// <exclude />\r\n        public static string GetKeyPath(this IMediaFile mediaFile)\r\n        {\r\n            return mediaFile.StoreId + \":\" + mediaFile.Id;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetCompositePath(this IMediaFile mediaFile)\r\n        {\r\n            return GetCompositePath(mediaFile.StoreId, mediaFile.FolderPath, mediaFile.FileName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetCompositePath(string storeId, string folderPath, string filename)\r\n        {\r\n            if (folderPath != \"/\")\r\n            {\r\n                return storeId + \":\" + folderPath + \"/\" + filename;\r\n            }\r\n            return storeId + \":/\" + filename;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ExtensionMethods/IMediaFileFolderExtensions.cs",
    "content": "﻿namespace Composite.Data.Types\r\n{\r\n\tinternal static class IMediaFileFolderExtensions\r\n\t{\r\n        public static string GetKeyPath(this IMediaFileFolder mediaFileFolder)\r\n        {\r\n            return mediaFileFolder.StoreId + \":\" + mediaFileFolder.Id;\r\n        }\r\n\r\n        public static string GetCompositePath(this IMediaFileFolder mediaFileFolder)\r\n        {\r\n            return string.Format(\"{0}:{1}\", mediaFileFolder.StoreId, mediaFileFolder.Path);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ExtensionMethods/Use_parent_namespace.txt",
    "content": "﻿\r\n\r\nuse \"Composite.Data.Types\" as namespace in this folder."
  },
  {
    "path": "Composite/Data/Types/Foundation/ExceptingSerializerHandler.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Data.Types.Foundation\r\n{\r\n    /// <summary>\r\n    /// This is for forcing the developer to implement thier own ISerializerHandler\r\n    /// </summary>\r\n    internal sealed class ExceptingSerializerHandler : ISerializerHandler\r\n\t{\r\n        public string Serialize(object objectToSerialize)\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/Foundation/PagePublishControlledAuxiliary.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.PublishScheduling;\r\nusing Composite.Data.Transactions;\r\n\r\nnamespace Composite.Data.Types.Foundation\r\n{\r\n    internal sealed class PagePublishControlledAuxiliary : IPublishControlledAuxiliary\r\n    {\r\n        public void OnAfterDataUpdated(IData data)\r\n        {\r\n            var page = (IPage)data;\r\n\r\n            IEnumerable<IPagePlaceholderContent> pagePlaceholderContents;\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                pagePlaceholderContents =\r\n                    (from content in DataFacade.GetData<IPagePlaceholderContent>(false)\r\n                     where content.PageId == page.Id && content.VersionId == page.VersionId\r\n                     select content).ToList();\r\n            }\r\n\r\n            if (page.PublicationStatus == GenericPublishProcessController.Published)\r\n            {\r\n                using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n                {\r\n                    using (new DataScope(DataScopeIdentifier.Public))\r\n                    {\r\n                        DataFacade.Delete<IPagePlaceholderContent>(\r\n                            f => f.PageId == page.Id && f.VersionId == page.VersionId);\r\n                    }\r\n\r\n                    foreach (var pagePlaceholderContent in pagePlaceholderContents)\r\n                    {\r\n                        pagePlaceholderContent.PublicationStatus = page.PublicationStatus;\r\n\r\n                        DataFacade.Update(pagePlaceholderContent);\r\n                    }\r\n\r\n                    using (new DataScope(DataScopeIdentifier.Administrated))\r\n                    {\r\n                        var publishSchedule = PublishScheduleHelper.GetPublishSchedule(typeof (IPage),\r\n                            page.Id.ToString(), page.DataSourceId.LocaleScope.Name);\r\n\r\n                        if (publishSchedule != null)\r\n                        {\r\n                            DataFacade.Delete(publishSchedule);\r\n                        }\r\n                    }\r\n\r\n                    transactionScope.Complete();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                foreach (var pagePlaceholderContent in pagePlaceholderContents)\r\n                {\r\n                    if (pagePlaceholderContent.PublicationStatus != page.PublicationStatus)\r\n                    {\r\n                        pagePlaceholderContent.PublicationStatus = page.PublicationStatus;\r\n\r\n                        DataFacade.Update(pagePlaceholderContent);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public void OnAfterBuildNew(IData data)\r\n        {\r\n            // Noop\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Types/ICompositionContainer.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// Allows assigning meta data fields to different tabs in UI. \r\n    /// There's always one default instance with label \"Metadata\".\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [ImmutableTypeId(\"{ECE41A30-0FC4-4902-B5C5-A607D8A9B298}\")]\r\n    [CachingAttribute(CachingType.Full)]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n\tpublic interface ICompositionContainer : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{B9E34D3F-C8C0-4692-8EE4-31B174C96477}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [ImmutableFieldId(\"{572769B5-89CA-4ee8-9CD1-DE9D61702CA0}\")]\r\n        string Label { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ICustomFunctionCallEditorMapping.cs",
    "content": "﻿namespace Composite.Data.Types\r\n{\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{67cf4b4d-1376-4589-abd4-5cfa9966670b}\")]\r\n    [KeyPropertyName(\"FunctionName\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface ICustomFunctionCallEditorMapping: IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{1145f17b-c93b-443f-917e-88b7cc4e85c5}\")]\r\n        string FunctionName { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{96671d53-4657-439b-8abd-4e01f3c80fd7}\")]\r\n        string CustomEditorPath { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer, IsNullable = true)]\r\n        [ImmutableFieldId(\"{3af4e226-c06d-448d-a93e-3457cd4e9bf6}\")]\r\n        int? Width { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer, IsNullable = true)]\r\n        [ImmutableFieldId(\"{7bd25407-193b-42e5-ae59-26a99bdee2c1}\")]\r\n        int? Height { get; set; }\r\n    }\r\n}\r\n "
  },
  {
    "path": "Composite/Data/Types/IDataItemTreeAttachmentPoint.cs",
    "content": "using System;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>\r\n    /// Represents a link between a tree definition and a data item.\r\n    /// F.e. a tree that shows navigation elements, attached to a specific C1 page.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{24CDC117-4510-41C4-8A73-D1B4CD85FE2A}\")]\r\n    [KeyPropertyName(nameof(Id))]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    public interface IDataItemTreeAttachmentPoint : IData\r\n    {\r\n        /// <summary>\r\n        /// The Id value for the attachment point.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{BEB44A8E-37FD-4FA6-A420-B252B8590AD6}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The Id of the tree that is attached.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{FA9A44E0-9D41-491A-86C0-BC5189FFC023}\")]\r\n        string TreeId { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The position in which the tree elements should be shown, f.e. \"Top\" or \"Bottom\". See <see cref=\"ElementAttachingProviderPosition\"/>\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{6624A6CF-29DC-4E6A-8B88-25514BC00758}\")]\r\n        string Position { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The data type of the data item, to which a tree is attached.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{F08DB525-2218-4379-A6F6-A9A904DEF6FE}\")]\r\n        string InterfaceType { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The key value of the data item to which a tree is attached.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{8A50C365-586D-45F5-8881-EC3878E16593}\")]\r\n        string KeyValue { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IDynamicTypeFormDefinitionFile.cs",
    "content": "﻿namespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{42f4ca9a-b18b-4d62-a4f5-5f04c06109ed}\")]\r\n    public interface IDynamicTypeFormDefinitionFile : IFile\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IFile.cs",
    "content": "using Composite.Data.Types.Foundation;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [BuildNewHandler(typeof(IFileBuildNewHandler))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [SerializerHandler(typeof(ExceptingSerializerHandler))]\r\n    public interface IFile : IData\r\n    {\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{B9B50947-EE78-4744-9128-0832A66243D5}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        string FolderPath { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{4FD98564-6077-4c6d-86E1-9C7F44B65E50}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [SearchableField(true, false, false)]\r\n        string FileName { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IFileUtils\r\n    {\r\n        /// <exclude />\r\n        public static bool ValidateValueLengths(this IFile file)\r\n        {\r\n            if ((file.FolderPath != null) && (file.FolderPath.Length > DataTypeDescriptor.Fields[\"FolderPath\"].StoreType.MaximumLength)) return false;\r\n            if ((file.FileName != null) && (file.FileName.Length > DataTypeDescriptor.Fields[\"FileName\"].StoreType.MaximumLength)) return false;\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private static DataTypeDescriptor _dataTypeDescriptor = null;\r\n        private static DataTypeDescriptor DataTypeDescriptor\r\n        {\r\n            get\r\n            {\r\n                if (_dataTypeDescriptor == null)\r\n                {\r\n                    _dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeof(IFile));\r\n                }\r\n\r\n                return _dataTypeDescriptor;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Types/IFileBuildNewHandler.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Foundation.CodeGeneration;\r\nusing Composite.Data.Streams;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    internal static class FileBuildNewHandlerTypesManager\r\n    {\r\n        private static readonly object _lock = new object();\r\n        private static Dictionary<Type, Type> _fileBuildNewHandlerTypes = new Dictionary<Type, Type>();\r\n        \r\n        \r\n        static FileBuildNewHandlerTypesManager()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        internal static Type GetFileBuilderNewHandler(Type dataType)\r\n        {\r\n            Type result;\r\n            if (!_fileBuildNewHandlerTypes.TryGetValue(dataType, out result))\r\n            {\r\n                lock(_lock)\r\n                {\r\n                    if (!_fileBuildNewHandlerTypes.TryGetValue(dataType, out result))\r\n                    {\r\n                        DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(dataType);\r\n\r\n                        string fullName = EmptyDataClassCodeGenerator.GetEmptyClassTypeFullName(dataTypeDescriptor);\r\n\r\n                        result = TypeManager.TryGetType(fullName);\r\n\r\n                        if (result == null)\r\n                        {\r\n                            CodeAttributeDeclaration codeAttributeDeclaration = new CodeAttributeDeclaration(\r\n                                new CodeTypeReference(typeof(FileStreamManagerAttribute)),\r\n                                new [] {\r\n                                new CodeAttributeArgument(new CodeTypeOfExpression(typeof(IFileEmptyDataClassFileStreamManager)))\r\n                            });\r\n\r\n                            result = EmptyDataClassTypeManager.CreateEmptyDataClassType(dataTypeDescriptor, typeof(IFileEmptyDataClassBase), codeAttributeDeclaration);\r\n                        }\r\n\r\n                        _fileBuildNewHandlerTypes.Add(dataType, result);\r\n                    }\r\n                }         \r\n            }\r\n\r\n            return result;\r\n        }\r\n        \r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _fileBuildNewHandlerTypes = new Dictionary<Type, Type>();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class IFileBuildNewHandler : IBuildNewHandler\r\n    {\r\n        public Type GetTypeToBuild(Type dataType)\r\n        {\r\n            return FileBuildNewHandlerTypesManager.GetFileBuilderNewHandler(dataType);\r\n        }       \r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class IFileEmptyDataClassBase : EmptyDataClassBase\r\n    {\r\n        private CachedMemoryStream _currentWriteStream;\r\n        private Type _interfaceType;\r\n\r\n        /// <exclude />\r\n        public IFileEmptyDataClassBase()\r\n        {\r\n            _interfaceType = typeof(IFile);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public CachedMemoryStream CurrentWriteStream\r\n        {\r\n            get { return _currentWriteStream; }\r\n            set { _currentWriteStream = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Type _InterfaceType\r\n        {\r\n            get { return _interfaceType; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class IFileEmptyDataClassFileStreamManager : IFileStreamManager\r\n    {\r\n        /// <exclude />\r\n        public Stream GetReadStream(IFile file)\r\n        {\r\n            IFileEmptyDataClassBase castedFile = (IFileEmptyDataClassBase)file;\r\n\r\n            if (castedFile.CurrentWriteStream == null)\r\n            {\r\n                return new MemoryStream(new byte[] { });\r\n            }\r\n            else\r\n            {\r\n                return new MemoryStream(castedFile.CurrentWriteStream.Data);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Stream GetNewWriteStream(IFile file)\r\n        {\r\n            IFileEmptyDataClassBase castedFile = (IFileEmptyDataClassBase)file;\r\n\r\n            castedFile.CurrentWriteStream = new CachedMemoryStream();\r\n\r\n            return castedFile.CurrentWriteStream;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void SubscribeOnFileChanged(IFile file, OnFileChangedDelegate handler)\r\n        {\r\n            // Do nothing...\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IFileServices.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IFileServices\r\n    {\r\n        /// <exclude />\r\n        public static T GetFile<T>(string filePath)\r\n            where T : class, IFile\r\n        {\r\n            string folderPath = Path.GetDirectoryName(filePath);\r\n            string fileName = Path.GetFileName(filePath);\r\n\r\n            var foundFile =\r\n                (from file in DataFacade.GetData<T>()\r\n                 where string.Compare(file.FolderPath, folderPath, StringComparison.OrdinalIgnoreCase) == 0\r\n                    && string.Compare(file.FileName, fileName, StringComparison.OrdinalIgnoreCase) == 0\r\n                 select file).ToList();\r\n\r\n            if (foundFile.Count == 0) throw new InvalidOperationException(string.Format(\"Missing file '{0}'\", filePath));\r\n            if (foundFile.Count > 1) throw new InvalidOperationException(string.Format(\"More than one file named '{0}'\", filePath));\r\n\r\n            return foundFile[0];\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static T TryGetFile<T>(string filePath)\r\n            where T : class, IFile\r\n        {\r\n            string folderPath = Path.GetDirectoryName(filePath);\r\n            string fileName = Path.GetFileName(filePath);\r\n\r\n            var foundFile =\r\n                (from file in DataFacade.GetData<T>()\r\n                 where file.FolderPath.Equals(folderPath, StringComparison.OrdinalIgnoreCase) \r\n                    && file.FileName.Equals(fileName, StringComparison.OrdinalIgnoreCase)\r\n                 select file).ToList();\r\n\r\n            if (foundFile.Count == 0) return null;\r\n            if (foundFile.Count > 1) return null;\r\n\r\n            return foundFile[0];\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IFlowInformation.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{40063ED1-D547-4aff-AD58-F0BB68D571AC}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [LabelPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]    \r\n    public interface IFlowInformation : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{375703F5-33AA-45c7-B3B1-401726A9A98C}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{829CC401-E0D0-427b-9DCD-4AD19E6FBCB3}\")]\r\n        [NotNullValidator()]\r\n        [ForeignKey(typeof(IUser), \"Username\", AllowCascadeDeletes = true)]\r\n        string Username { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{57AF5100-F625-4640-A418-BC149A22B718}\")]\r\n        [NotNullValidator()]\r\n        string ConsoleId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{5C389A14-B2C6-494e-A14B-1E1E38ECFFDD}\")]        \r\n        string SerializedFlowToken { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{9432E3D8-8C66-47dd-B71D-A9D5C84E855C}\")]\r\n        string SerializedEntityToken { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{D2AE7893-4C3B-419a-8BC3-5387457AA9E4}\")]\r\n        string SerializedActionToken { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{AF38EF8B-34FA-4d42-B49B-E427259E00F3}\")]\r\n        DateTime TimeStamp { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IFolderWhiteList.cs",
    "content": "using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// Reference to a folder to be shown in the 'Layout' perspective.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{b831fee3-fb55-44be-b00d-034bbd83574f}\")]\r\n    [KeyPropertyName(0, \"KeyName\")]\r\n    [KeyPropertyName(1, \"TildeBasedPath\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n    public interface IFolderWhiteList : IData\r\n    {\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{cb0bb5a7-c1fe-47a1-bfb4-6565bc9ffd4d}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        string KeyName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{d03415bd-ec41-4a57-8072-59e0a761f113}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        string TildeBasedPath { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IFolderWhiteListExtensions\r\n    {\r\n        /// <exclude />\r\n        public static string GetTildePath(string fullPath)\r\n        {\r\n            try\r\n            {\r\n                if (PathUtil.BaseDirectory.StartsWith(fullPath))\r\n                {\r\n                    return \"~\\\\\";\r\n                }\r\n\r\n                string withoutBase = fullPath.Substring(PathUtil.BaseDirectory.Length);\r\n                if (withoutBase.StartsWith(\"\\\\\") == false)\r\n                {\r\n                    withoutBase = \"\\\\\" + withoutBase;\r\n                }\r\n\r\n                return \"~\" + withoutBase;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Failed to get tilde based path from '{0}'\", fullPath), ex);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetFullPath(this IFolderWhiteList folderWhiteList)\r\n        {\r\n            return PathUtil.Resolve(folderWhiteList.TildeBasedPath);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Types/IHostnameBinding.cs",
    "content": "using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]  \r\n    [Title(\"Hostname mapping\")]\r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{2B0B1268-7237-4482-97A3-1BD4CAD6A08C}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [LabelPropertyName(\"Hostname\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface IHostnameBinding : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{405A7A25-6E53-4DDF-A6C2-26714D26D1F5}\")]\r\n        Guid Id { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255, IsNullable = false)]\r\n        [ImmutableFieldId(\"{36E7E803-178A-4453-9B5B-BF7148BA077B}\")]\r\n        [RegexValidator(@\"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$\")]\r\n        [NotNullValidator]\r\n        string Hostname { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64, IsNullable = false)]\r\n        [ImmutableFieldId(\"{A9C79722-D62A-481A-B1DE-CFB37A68EB9A}\")]\r\n        [NotNullValidator]\r\n        string Culture { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{2C2AEBF7-2CFC-4B6B-9199-991E4ABD8FFC}\")]\r\n        [DefaultFieldGuidValue(\"{00000000-0000-0000-0000-000000000000}\")]\r\n        Guid HomePageId { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255, IsNullable = true)]\r\n        [ImmutableFieldId(\"{B0ADBBBF-15C9-4902-B202-BD4A1014725D}\")]\r\n        string PageNotFoundUrl { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString, IsNullable = true)]\r\n        [ImmutableFieldId(\"{80C298F2-F493-465D-9F28-4F50DD0C03D5}\")]\r\n        string Aliases { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{3ED674CC-24C2-2DDB-C53D-71421AA03127}\")]\r\n        bool IncludeHomePageInUrl { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{A554BD68-C2F5-6F6F-4D3B-1FC2760BDE38}\")]\r\n        bool IncludeCultureInUrl { get; set; }\r\n\r\n        /// <summary>\r\n        /// When set to <value>true</value>, the system will generate HTTPS links to the hostname and \r\n        /// will make automatic redirects from HTTP to HTTPS for the given hostname.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [DefaultFieldBoolValue(false)]\r\n        [ImmutableFieldId(\"{1F45F2E7-2FAF-4F33-ACCA-BFF32EF7818A}\")]\r\n        bool EnforceHttps { get; set; }\r\n\r\n        /// <summary>\r\n        /// When set to <value>true</value>, the system will use \"HTTP 301 Permanent Redirect\" when  \r\n        /// redirecting from an alias to the hostname.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [DefaultFieldBoolValue(true)]\r\n        [ImmutableFieldId(\"{d933184a-19c1-4292-8e2e-f4a1a163f087}\")]\r\n        bool UsePermanentRedirect { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IImageFile.cs",
    "content": "﻿using Composite.Core.WebClient.Renderings.Data;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// This data interface represents a image media file in C1 CMS. This can be used to query images through a <see cref=\"Composite.Data.DataConnection\"/>. \r\n    /// </summary>\r\n    [Title(\"C1 Image File\")]\r\n    [ImmutableTypeId(\"{BF54E59A-0EBC-4162-95B9-C46EE271C7A9}\")]\r\n    [KeyTemplatedXhtmlRenderer(XhtmlRenderingType.Embedable, XhtmlRenderingEncoding.AttributeContent, \"<img src='~/media({field:StoreId}:{field:Id})' alt='{field:Title}' />\")]\r\n    public interface IImageFile : IMediaFile\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IInlineFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{8CCA4975-8FE0-464A-A806-A098E9138FAE}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    public interface IInlineFunction : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{720643FF-9743-414B-AE2C-88A8CC4DADBB}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{A3710B8F-BD8E-4A9A-BB7B-A796198C55B9}\")]\r\n        [Composite.Data.Validation.Validators.StringSizeValidator(1, 128)]\r\n        [NotNullValidator()]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{8C5BA3EE-FE14-4346-8CF2-8A0BEDAF94FB}\")]\r\n        [Composite.Data.Validation.Validators.StringSizeValidator(1, 128)]\r\n        string Namespace { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{935757BE-4959-4CBD-92BC-2ABD40C2969B}\")]\r\n        string Description { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        [ImmutableFieldId(\"{623358E0-506A-463F-A0D5-C6B6B8F916C3}\")]\r\n        string CodePath { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IInlineFunctionAssemblyReference.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{D3AC39D8-1FE6-4BB3-BFEA-2DAFECACF0FC}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    public interface IInlineFunctionAssemblyReference : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{9F7C1C30-E115-479D-9471-AEB83A9AAF63}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{E08E79F6-ED40-447D-A2B6-592704FE7B96}\")]\r\n        Guid Function { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{30DA8550-252A-4EBB-A9D4-78DA26784E4B}\")]\r\n        [NotNullValidator()]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// This could be either Bin or System\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{221D7E98-3859-49BF-AEED-57C580396680}\")]\r\n        string Location { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ILockingInformation.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{306F78E9-CA7B-429b-8D7F-CB4B4DD44E5A}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [LabelPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]    \r\n    public interface ILockingInformation : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{C0A019A4-33BE-46a3-B27C-ED7AF010976C}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{34BD5C80-C5FD-4932-A1E6-3459E2D7802D}\")]\r\n        [NotNullValidator()]\r\n        string LockKey { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{9B13A361-9CCD-4dfc-97E5-8D9CA3C54660}\")]\r\n        [NotNullValidator()]\r\n        string SerializedOwnerId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{CADF7240-45C0-43a6-A6A1-D60887CC2D51}\")]\r\n        [NotNullValidator()]\r\n        string Username { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IMediaFile.cs",
    "content": "using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Core.WebClient.Renderings.Data;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// This data interface represents a media file in C1 CMS. This can be used to query media through a <see cref=\"Composite.Data.DataConnection\"/>. \r\n    /// </summary>\r\n    [Title(\"C1 Media File\")]\r\n    [KeyPropertyName(\"KeyPath\")]\r\n    [DataAncestorProviderAttribute(typeof(MediaFileDataAncesorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{A8716C78-1499-4155-875B-2545006385B2}\")]\r\n    [LabelPropertyName(\"CompositePath\")]\r\n    [RelevantToUserType(UserType.Developer)]\r\n    [KeyTemplatedXhtmlRenderer(XhtmlRenderingType.Embedable, \"<a href='~/media({field:StoreId}:{field:Id})'>{label}</a>\")]\r\n    public interface IMediaFile : IFile\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{a85bb1d0-1413-44e2-9b78-92ecd3fd1f77}\")]\r\n        Guid Id { get; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048)]\r\n        [ImmutableFieldId(\"{46024846-b43c-4675-9a6e-ed16ffd29420}\")]\r\n        string KeyPath { get; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048)]\r\n        [ImmutableFieldId(\"{9DAC181A-DA51-455e-BE73-55719FA2CC9C}\")]\r\n        string CompositePath { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{D595E909-7E32-4dd0-90AE-63C2DAE0E7BF}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 32)]\r\n        string StoreId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{22FB743F-1731-426e-BB22-78A08F956749}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [SearchableField(true, false, false)]\r\n        string Title { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{FA75B9B1-82D3-47ce-80F8-BAEF4CDE43FD}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [SearchableField(true, true, false)]\r\n        string Description { get; set; }\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{016372B5-9692-4C2D-B64D-8FC6594BBCFF}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [SearchableField(true, true, true)]\r\n        string Tags { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{D4B7D47E-49CF-43c9-AC36-4134B136860A}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        string Culture { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{EBF481B7-7A5D-4678-93E9-1FF189311404}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [SearchableField(false, true, true)]\r\n        string MimeType { get; }\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{BCD0C1A2-9769-4209-8D43-DB7DDBABBB8B}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer, IsNullable=true)]\r\n        int? Length { get; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{6BBE4326-998A-4111-BA6F-CC05A518CF6A}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime, IsNullable = true)]\r\n        [SearchableField(false, true, true)]\r\n        DateTime? CreationTime { get; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{564952B9-C95F-4408-BD00-206DF0CD45C6}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime, IsNullable = true)]\r\n        DateTime? LastWriteTime { get; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{72C36EED-15DC-44a8-98D5-EE828D3B6AB8}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        bool IsReadOnly { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IMediaFileData.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{56916e07-6e3c-4488-8b46-78f6cb74ac2e}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [NotReferenceable]\r\n    [CachingAttribute(CachingType.Full)]    \r\n    public interface IMediaFileData : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{04f39c14-7243-4152-9e05-f28e496feba1}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048, IsNullable = false)]\r\n        [ImmutableFieldId(\"{f832f793-be88-418e-b134-1a72558643d0}\")]\r\n        [NotNullValidator]\r\n        string FolderPath { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048, IsNullable = false)]\r\n        [ImmutableFieldId(\"{00e64f23-aec9-4527-b964-4accd4cef548}\")]\r\n        [NotNullValidator]\r\n        string FileName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256, IsNullable = true)]\r\n        [ImmutableFieldId(\"{aac2be13-e487-49b9-90f9-1afc495ea844}\")]\r\n        string Title { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString, IsNullable = true)]\r\n        [ImmutableFieldId(\"{6993c337-88c6-4e90-a1c2-64aeb73f0650}\")]\r\n        string Description { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString, IsNullable = true)]\r\n        [ImmutableFieldId(\"{ef096303-74b9-4b90-9626-2cefecd0a3ce}\")]\r\n        string Tags { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128, IsNullable = true)]\r\n        [ImmutableFieldId(\"{068b92aa-3f46-43ab-b258-fa80dbb56fd6}\")]\r\n        string CultureInfo { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256, IsNullable = true)]\r\n        [ImmutableFieldId(\"{fdd38995-b933-44ba-9ad5-d5235ef0e402}\")]\r\n        string MimeType { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer, IsNullable = true)]\r\n        [ImmutableFieldId(\"{cbab34f8-deaa-45cd-915c-dbe027110b25}\")]\r\n        [DefaultFieldIntValue(-1)]\r\n        int? Length { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime, IsNullable = true)]\r\n        [ImmutableFieldId(\"{d9095572-6a08-4115-999a-b70a449c827e}\")]\r\n        [DefaultFieldNowDateTimeValue]\r\n        DateTime? CreationTime { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime, IsNullable = true)]\r\n        [ImmutableFieldId(\"{d3b83ba0-35e0-4168-98a7-80cc4ebfc891}\")]\r\n        [DefaultFieldNowDateTimeValue]\r\n        DateTime? LastWriteTime { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IMediaFileFolder.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Data.Hierarchy;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// This data interface represents a media folder in C1 CMS. This can be used to query media folders through a <see cref=\"Composite.Data.DataConnection\"/>. \r\n    /// </summary>\r\n    [Title(\"C1 Media Folder\")]\r\n    [KeyPropertyName(\"KeyPath\")]\r\n    [DataAncestorProviderAttribute(typeof(MediaFileDataAncesorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{76C4D9D8-2558-4475-801B-FB56C5E923A3}\")]\r\n    [LabelPropertyName(\"CompositePath\")]\r\n    [RelevantToUserType(UserType.Developer)]\r\n    public interface IMediaFileFolder : IData\r\n    {\r\n        /// <summary>\r\n        /// Gets the id.\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{84c8046c-a53c-42dd-bd54-b64c6f7511c1}\")]\r\n        Guid Id { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the key path. Should contain StoreId as well as Id. Used for identifying a media file within the system.\r\n        /// Example: 'MediaArchive:63e1480c-1b8a-4ca1-ba02-792437e654ec'\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048)]\r\n        [ImmutableFieldId(\"{e03e1acb-b5bd-4354-bfd4-5e2626381d82}\")]\r\n        string KeyPath { get; }\r\n\r\n\r\n        /// <summary>\r\n        /// Used for labels in widgets. Example: 'MediaArchive:/Folder1/Folder2'\r\n        /// </summary>\r\n        [ImmutableFieldId(\"{ADB2660D-BAB3-499a-AE12-50AA703FA3B0}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048)]\r\n        string CompositePath { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{814D45C9-D424-4420-8DBB-3F93E4EF24E2}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 32)]\r\n        string StoreId { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the path. F.e. '/', '/Folder1', '/Folder1/Folder2'\r\n        /// </summary>\r\n        [ImmutableFieldId(\"{A71332BC-F6E5-4e1b-8BB6-7C6AA57BECC6}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048)]\r\n        string Path { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the title.\r\n        /// </summary>\r\n        [ImmutableFieldId(\"{E4DBB69F-B1F6-46a1-A8A6-BDDD4CB344D6}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        string Title { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the description.\r\n        /// </summary>\r\n        [ImmutableFieldId(\"{51CF6EFA-66C3-413e-9FCD-06EA52871182}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        string Description { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a value indicating whether this media file is read only.\r\n        /// </summary>\r\n        [ImmutableFieldId(\"{FA03F9D5-C8AF-469c-BC02-F11118D21A0F}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        bool IsReadOnly { get; }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IMediaFileFolderUtils\r\n    {\r\n        /// <summary>\r\n        /// Creates a folder path given folder path and the name of the folder\r\n        /// </summary>\r\n        /// <param name=\"parentMediaFolder\"></param>\r\n        /// <param name=\"folderName\"></param>\r\n        /// <returns></returns>\r\n        public static string CreateFolderPath(this IMediaFileFolder parentMediaFolder, string folderName)\r\n        {\r\n            return CreateFolderPath(parentMediaFolder.Path, folderName);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a folder path given folder path and the name of the folder\r\n        /// </summary>\r\n        /// <param name=\"parentFolderPath\"></param>\r\n        /// <param name=\"folderName\"></param>\r\n        /// <returns></returns>\r\n        public static string CreateFolderPath(string parentFolderPath, string folderName)\r\n        {\r\n            string folderPath;\r\n            if (parentFolderPath == \"/\")\r\n            {\r\n                folderPath = parentFolderPath + folderName;\r\n            }\r\n            else\r\n            {\r\n                folderPath = parentFolderPath + \"/\" + folderName;\r\n            }\r\n\r\n            folderPath = folderPath.Replace('\\\\', '/');\r\n            while (folderPath.Contains(\"//\"))\r\n            {\r\n                folderPath = folderPath.Replace(\"//\", \"/\");\r\n            }\r\n\r\n            if (!folderPath.StartsWith(\"/\"))\r\n            {\r\n                folderPath = \"/\" + folderPath;\r\n            }\r\n\r\n            if (folderPath.EndsWith(\"/\"))\r\n            {\r\n                folderPath = folderPath.Remove(folderPath.Length - 1);\r\n            }\r\n\r\n            return folderPath;\r\n        }        \r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the parent folder for the given media folder\r\n        /// </summary>\r\n        /// <param name=\"mediaFileFolder\"></param>\r\n        /// <returns></returns>\r\n        public static string GetParentFolderPath(this IMediaFileFolder mediaFileFolder)\r\n        {\r\n            return GetParentFolderPath(mediaFileFolder.Path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the parent folder for the given media folder path\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public static string GetParentFolderPath(string path)\r\n        {\r\n            if (path == \"/\")\r\n            {\r\n                return path;\r\n            }\r\n\r\n            string parentPath = path.Substring(0, path.LastIndexOf(\"/\"));\r\n            if (parentPath == \"\")\r\n            {\r\n                return \"/\";\r\n            }\r\n\r\n            return parentPath;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given media folder exists\r\n        /// </summary>\r\n        /// <param name=\"mediaFileFolder\"></param>\r\n        /// <returns></returns>\r\n        public static bool DoesFolderExists(this IMediaFileFolder mediaFileFolder)\r\n        {\r\n            return DoesFolderExists(mediaFileFolder.Path);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given media folder path exists\r\n        /// </summary>\r\n        /// <param name=\"path\"></param>\r\n        /// <returns></returns>\r\n        public static bool DoesFolderExists(string path)\r\n        {\r\n            if (path == \"/\")\r\n            {\r\n                return true;\r\n            }\r\n\r\n            using (DataConnection dataConnection = new DataConnection())\r\n            {\r\n                return (from item in dataConnection.Get<IMediaFileFolder>()\r\n                              where item.Path == path\r\n                              select item).Any();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns true if the given media folders parent folder exists\r\n        /// </summary>\r\n        /// <param name=\"mediaFileFolder\"></param>\r\n        /// <returns></returns>\r\n        public static bool DoesParentFolderExists(this IMediaFileFolder mediaFileFolder)\r\n        {\r\n            return DoesFolderExists(mediaFileFolder.GetParentFolderPath());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IMediaFileStore.cs",
    "content": "﻿namespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [KeyPropertyName(\"Id\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    public interface IMediaFileStore : IData\r\n    {\r\n        /// <exclude />\r\n        string Id { get; }\r\n\r\n\r\n        /// <exclude />\r\n        string Title { get; }\r\n\r\n\r\n        /// <exclude />\r\n        string Description { get; }\r\n\r\n        /// <exclude />\r\n        bool IsReadOnly { get; }\r\n\r\n\r\n        /// <exclude />\r\n        bool ProvidesMetadata { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IMediaFolderData.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{cb22316c-4e41-4fe5-a30d-5abc35af124a}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [NotReferenceable]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IMediaFolderData : IData\r\n\t{\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{aa5d40be-d250-4794-b517-bd6977658273}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]        \r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{cd4f0524-3bfd-4110-bc93-e99713a7a5b7}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048, IsNullable = false)]        \r\n        string Path { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{4df0e07f-24c0-4d62-bdc7-d50620a530db}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256, IsNullable = true)]\r\n        string Title { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{65e42128-8580-4898-a2fd-0e35cf771c24}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString, IsNullable = true)]\r\n        string Description { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IMethodBasedFunctionInfo.cs",
    "content": "using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{0DE2844A-6B26-4566-B1D6-A460C68B1E3B}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    public interface IMethodBasedFunctionInfo : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{131D6F2F-01A8-40b5-882B-CCC03AF8C986}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        [ImmutableFieldId(\"{36460984-0281-485b-985B-D9686697D3D4}\")]        \r\n        string Type { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{5CC73160-98FF-4d13-A5AB-FB20946C9064}\")]\r\n        string MethodName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        [ImmutableFieldId(\"{62C8BC67-B0A6-4cd6-9694-AD55460C5C90}\")]\r\n        string Namespace { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{D8108EA4-0E3D-49d1-8687-1E1FFEB69029}\")]\r\n        string UserMethodName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/INamedFunctionCall.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// A named function call for an xslt function\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{7eccf947-1abd-43d5-b28b-551a44a3fe96}\")]\r\n    [KeyPropertyName(0, \"XsltFunctionId\")]\r\n    [KeyPropertyName(1, \"Name\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    [NotReferenceable]\r\n    public interface INamedFunctionCall : IData\r\n    {\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{f60e9cda-a461-4234-b225-5ea3eb51a1fb}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        Guid XsltFunctionId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{4c042ad7-9bf5-4875-a369-3720c1b79380}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{cfc67bfa-2252-4642-91dc-623ca9e1d027}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        string SerializedFunction { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPackageServerSource.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [CachingAttribute(CachingType.Full)]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{BAB5A2C3-880F-4b1b-AFEE-D1058015B9ED}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n\tpublic interface IPackageServerSource : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{7B151CE0-F094-4610-BDF8-8EE4F07003E5}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{93E401CE-1AEE-4ba7-AE5B-C7FE0A872A1A}\")]\r\n        [NotNullValidator()]\r\n        string Url { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPage.cs",
    "content": "using System;\r\nusing Composite.Core.WebClient.Renderings.Data;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>\r\n    /// This data interface represents a page in C1 CMS. This can be used to query pages through a <see cref=\"Composite.Data.DataConnection\"/>. \r\n    /// Note that a lot of page related tasks can be done with a <see cref=\"Composite.Data.SitemapNavigator\"/>. \r\n    /// And any changes done through this interface and a <see cref=\"Composite.Data.DataConnection\"/> should be done with care. \r\n    /// </summary>\r\n    [Title(\"C1 Page\")]\r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{C046F704-D3E4-4b3d-8CB9-77564FB0B9E7}\")]\r\n    [KeyPropertyName(nameof(Id))]\r\n    [DataAncestorProvider(typeof(PageDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n    [LabelPropertyName(nameof(Title))]\r\n    [RelevantToUserType(UserType.Developer)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    [PublishControlledAuxiliary(typeof(PagePublishControlledAuxiliary))]\r\n    [PublishProcessControllerTypeAttribute(typeof(GenericPublishProcessController))]\r\n    [KeyTemplatedXhtmlRenderer(XhtmlRenderingType.Embedable, \"<a href='~/page({id})'>{label}</a>\")]\r\n    public interface IPage : IData, IChangeHistory, ICreationHistory, IPublishControlled, ILocalizedControlled, IVersioned\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{FA2691BB-191E-4520-BF60-F3B7D1762CE0}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{46D0EBCD-B604-4cc2-B0B0-C0F589172680}\")]\r\n        Guid TemplateId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{69303D16-F681-4C2F-BA73-AF8B2B94AAB2}\")]\r\n        [ForeignKey(typeof(IPageType), \"Id\", NullReferenceValue = \"{00000000-0000-0000-0000-000000000000}\", NullReferenceValueType = typeof(Guid))]\r\n        [DefaultFieldGuidValue(\"{00000000-0000-0000-0000-000000000000}\")]\r\n        [SearchableField(false, true, true)]\r\n        Guid PageTypeId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{8A06D28E-DAD9-438d-9570-0C0120ADD560}\")]\r\n        [NotNullValidator]\r\n        [SearchableField(true, false, false)]\r\n        string Title { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 192, IsNullable = true)]\r\n        [ImmutableFieldId(\"{3E398FA5-7961-4a75-A6CE-C147B7F4B90A}\")]\r\n        [SearchableField(true, false, false)]\r\n        string MenuTitle { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 192)]\r\n        [ImmutableFieldId(\"{C9A81ADE-DAD5-4740-A891-DF1CE2FAB498}\")]\r\n        [Composite.Data.Validation.Validators.RegexValidator(@\"^[\\s-\\p{Ll}\\p{Lu}\\p{Lt}\\p{Lo}\\p{Nd}\\p{Pc}\\p{Lm}]*$\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1056:UriPropertiesShouldNotBeStrings\", Justification = \"We want a string here\")]\r\n        string UrlTitle { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 192, IsNullable = true)]\r\n        [ImmutableFieldId(\"{22787AD0-349A-432f-89C7-3D532B613BB7}\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1056:UriPropertiesShouldNotBeStrings\", Justification = \"We want a string here\")]\r\n        [SearchableField(true, false, false)]\r\n        string FriendlyUrl { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 1024, IsNullable = true)]\r\n        [ImmutableFieldId(\"{3EECB770-1D8F-45e0-9B4D-2CA67A278FA3}\")]\r\n        [SearchableField(true, true, false)]\r\n        string Description { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageFolderDefinition.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [ImmutableTypeId(\"{1488334F-2AB6-4D8D-9E1B-7EE4A990469D}\")]\r\n    [CachingAttribute(CachingType.Full)]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    public interface IPageFolderDefinition : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [DefaultFieldNewGuidValue()]\r\n        [ImmutableFieldId(\"{383F3019-60AD-4E16-8ACF-6568A4A13B2A}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]        \r\n        [ImmutableFieldId(\"{3FF30313-C5C0-49CB-A8E6-1875864F8EAC}\")]\r\n        Guid PageId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{619E698B-9D3B-4DFA-BA1C-A591446FF1A2}\")]\r\n        Guid FolderTypeId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageMetaDataDefinition.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    \r\n    /// <summary>    \r\n    /// Page meta data definition. \r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Using the same name for a metadata definition is allowed if metadata type and label are the same\r\n    /// on all instances.\r\n    /// </remarks>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [ImmutableTypeId(\"{F0101D4E-2EC2-4D24-B0BD-BE367DC7C3E1}\")]\r\n    [CachingAttribute(CachingType.Full)]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    public interface IPageMetaDataDefinition : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [DefaultFieldNewGuidValue()]\r\n        [ImmutableFieldId(\"{C30E50F4-64BF-46A8-B8C9-A8F8CA62C74D}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// This is an id of a page or pagetype item and a reference to the\r\n        /// elemen where this description is defined.\r\n        /// This should be an id of a page or pagetype og Guid.Empty for \r\n        /// the whole website\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{5C8A6831-8B94-424c-90C7-7C9385E5DB7C}\")]\r\n        Guid DefiningItemId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{8B421E9F-F0B5-4D27-B1E9-87D6814EAC0F}\")]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [ImmutableFieldId(\"{3838006A-88D1-485F-8ED6-46E14E6A738B}\")]\r\n        string Label { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{9EA6FEA8-B2E7-4F44-A5F5-0169123CEC77}\")]\r\n        [ForeignKey(typeof(ICompositionContainer), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid MetaDataContainerId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{1AD2B5F6-F5AE-496A-B9FA-47BF5E90F5F2}\")]\r\n        Guid MetaDataTypeId { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Start level number relativ to the page where this is defined.\r\n        /// 0 will include the page it self\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer)]\r\n        [ImmutableFieldId(\"{8AC8520E-97B9-4F58-B9A4-D5ED33C482EC}\")]\r\n        int StartLevel { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// The number of levels this definition affects\r\n        /// Use int.Max for branch\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer)]\r\n        [ImmutableFieldId(\"{C76C80E0-C8DF-4A7B-8931-D3C3B229F44E}\")]\r\n        int Levels { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PageMetaDataDefinitionEqualityComparer : IEqualityComparer<IPageMetaDataDefinition>\r\n    {\r\n        /// <exclude />\r\n        public bool Equals(IPageMetaDataDefinition x, IPageMetaDataDefinition y)\r\n        {\r\n            return x.Name == y.Name && x.MetaDataTypeId == y.MetaDataTypeId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int GetHashCode(IPageMetaDataDefinition obj)\r\n        {\r\n            return obj.Name.GetHashCode() ^ obj.MetaDataTypeId.GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPagePlaceholderContent.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{3EAA3814-04E6-4c7f-8F1A-004A89BB0848}\")]\r\n    [KeyPropertyName(0, nameof(PageId))]\r\n    [KeyPropertyName(1, nameof(PlaceHolderId))]\r\n    [DataAncestorProvider(typeof(PropertyDataAncestorProvider))]\r\n    [PropertyDataAncestorProvider(nameof(PageId), typeof(IPage), nameof(IPage.Id), null)]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    [PublishProcessControllerTypeAttribute(typeof(GenericPublishProcessController))]\r\n    [Title(\"C1 Page Content\")]\r\n    public interface IPagePlaceholderContent : IData, IChangeHistory, ICreationHistory, IPublishControlled, ILocalizedControlled, IVersioned\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{19DFF302-F089-4900-8B64-35F88C82EC45}\")]\r\n        [ForeignKey(typeof(IPage), nameof(IPage.Id), AllowCascadeDeletes = true)]\r\n        Guid PageId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{D8243AA6-A02A-4383-9ED1-2A7C1A8841E2}\")]\r\n        [NotNullValidator]\r\n        string PlaceHolderId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{DB0C7557-8C56-4924-A199-3A1E984BE2E8}\")]\r\n        [SearchableField(true, false, false)]\r\n        string Content { get; set; }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPagePublishSchedule.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\nusing Composite.Data.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [Obsolete]\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [ImmutableTypeId(\"{545F5E10-31A2-40df-9FE8-DBAD1CFB9824}\")]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n\tpublic interface IPagePublishSchedule : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{3C0EF006-85BE-4761-BAEB-A785AFB805A2}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{38A48198-F4F6-4bcd-8499-74FAB902CB44}\")]\r\n        Guid PageId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{AEE4442E-2778-470f-9822-8CCAB99DC54F}\")]\r\n        Guid WorkflowInstanceId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{F8B01277-1887-4f58-9AEE-396D38210D8F}\")]\r\n        DateTime PublishDate { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 16)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\r\n        [DefaultFieldStringValue(\"\")]\r\n        [ImmutableFieldId(\"{9D62C8D3-E42F-4926-8E45-5B465A59C8A6}\")]\r\n        string LocaleCultureName { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageStructure.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{797A1A98-6E5C-4a1e-B346-AE547A1F4E90}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]    \r\n\tpublic interface IPageStructure : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{CBB49E56-A05C-4a33-9F8B-9253C2EDB9C2}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{57AF0FDA-BA4F-4281-ACAF-A56C28FEF2E6}\")]\r\n        Guid ParentId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer)]\r\n        [ImmutableFieldId(\"{87BD6871-CF25-48f2-9ED5-BF41B272551F}\")]\r\n        int LocalOrdering { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageTemplateFile.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"E98E754B-4616-4ACF-A2B5-CDA5F250B95E\")]\r\n    public interface IPageTemplateFile : IFile\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageType.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum PageTypeHomepageRelation\r\n    {\r\n        /// <exclude />\r\n        NoRestriction = 1,\r\n\r\n        /// <exclude />\r\n        OnlySubPages = 2,\r\n\r\n        /// <exclude />\r\n        OnlyHomePages = 3\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PageTypeHomepageRelationExtensionMethods\r\n    {\r\n        /// <exclude />\r\n        public static PageTypeHomepageRelation GetPageTypeHomepageRelation(this string value)\r\n        {\r\n            if (string.IsNullOrEmpty(value)) throw new ArgumentNullException(nameof(value));\r\n\r\n            PageTypeHomepageRelation result;\r\n            if (!Enum.TryParse<PageTypeHomepageRelation>(value, out result))\r\n            {\r\n                throw new ArgumentException(\"The argument is wrongly formatted\");\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use nameof() keyword instead\", true)]\r\n        public static string ToPageTypeHomepageRelationString(this PageTypeHomepageRelation pageTypeHomepageRelation)\r\n        {\r\n            return pageTypeHomepageRelation.ToString();\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class PageTypeExtensionMethods\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<IPageType> GetChildPageSelectablePageTypes(this IPage parentPage, IPage childPage = null)\r\n        {\r\n            var pageTypes = DataFacade.GetData<IPageType>().AsEnumerable()\r\n                .Where(pt => pt.Available);\r\n\r\n            pageTypes = pageTypes.OrderBy(f => f.Name);\r\n\r\n            if (parentPage == null)\r\n            {\r\n                return pageTypes\r\n                    .Where(f => f.HomepageRelation != nameof(PageTypeHomepageRelation.OnlySubPages))\r\n                    .Evaluate();\r\n            }\r\n\r\n            pageTypes = pageTypes\r\n                        .Where(f => f.HomepageRelation != nameof(PageTypeHomepageRelation.OnlyHomePages)\r\n                                    || (childPage != null && f.Id == childPage.PageTypeId))\r\n                        .Evaluate();\r\n\r\n            ICollection<IPageTypeParentRestriction> allParentRestrictions = null;\r\n\r\n            var result = new List<IPageType>();\r\n            foreach (IPageType pageType in pageTypes)\r\n            {\r\n                if (childPage != null && pageType.Id == childPage.PageTypeId)\r\n                {\r\n                    result.Add(pageType);\r\n                    continue;\r\n                }\r\n\r\n                allParentRestrictions = allParentRestrictions ?? DataFacade.GetData<IPageTypeParentRestriction>().ToList();\r\n\r\n                var parentRestrictions = allParentRestrictions.Where(f => f.PageTypeId == pageType.Id).ToList();\r\n\r\n                if (parentRestrictions.Count == 0 \r\n                    || parentRestrictions.Any(f => f.AllowedParentPageTypeId == parentPage.PageTypeId))\r\n                {\r\n                    result.Add(pageType);\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{867BE4ED-9C6C-49B9-AC30-35D65066BA4C}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [LabelPropertyName(\"Name\")]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IPageType : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{333BFEA0-ACD2-4500-A258-5305DFC72DC7}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [ImmutableFieldId(\"{0170DD8F-D44D-4F84-BD79-296E75885FDD}\")]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{CCAA5F15-63E4-42BF-8CDA-3AD0407520A7}\")]\r\n        string Description { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{51DEADD0-7E5C-43F4-ADF5-5E092798B8DE}\")]\r\n        [DefaultFieldBoolValue(true)]\r\n        bool Available { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{A489FFEB-6D65-4ED6-84E2-3FECB8F3733D}\")]\r\n        [DefaultFieldBoolValue(true)]\r\n        bool PresetMenuTitle { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{5C5A5B74-992C-4587-86C3-667B9BE22B36}\")]\r\n        Guid DefaultTemplateId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{5924B690-F7CC-4110-A3AB-227BD0E87289}\")]        \r\n        string HomepageRelation { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{4F9B76CB-5389-487C-92E3-A6DB4F1E5EFC}\")]\r\n        Guid DefaultChildPageType { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageTypeDateFolderTypeLink.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{A68C989B-2ECC-4C9C-8ACD-08B07BF52CF0}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IPageTypeDataFolderTypeLink : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{C94F9A58-2A0E-4A3E-BF22-570B223BD26E}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{62C9069C-5A42-4F72-AA06-D44A7AA63AA3}\")]\r\n        [ForeignKey(typeof(IPageType), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid PageTypeId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{76CC0DE4-B093-4EB1-8846-E8C8DE0D1620}\")]\r\n        Guid DataTypeId { get; set; }        \r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IPageTypeDataFolderTypeLinkExtensionMethods\r\n    {\r\n        /// <summary>\r\n        /// Removes data items that refer to data types that are not registered, and returns an enumeration of valid links.\r\n        /// </summary>\r\n        /// <param name=\"pageTypeDataFolderTypeLinks\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<IPageTypeDataFolderTypeLink> RemoveDeadLinks(this IEnumerable<IPageTypeDataFolderTypeLink> pageTypeDataFolderTypeLinks)\r\n        {\r\n            foreach (IPageTypeDataFolderTypeLink pageTypeDataFolderTypeLink in pageTypeDataFolderTypeLinks)\r\n            {\r\n                DataTypeDescriptor dataTypeDescriptor;\r\n                if (!DynamicTypeManager.TryGetDataTypeDescriptor(pageTypeDataFolderTypeLink.DataTypeId, out dataTypeDescriptor))\r\n                {\r\n                    DataFacade.Delete<IPageTypeDataFolderTypeLink>(pageTypeDataFolderTypeLink);\r\n                }\r\n                else\r\n                {\r\n                    yield return pageTypeDataFolderTypeLink;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageTypeDefaultPageContent.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{C326C3F7-81C4-47BD-9C17-83BE2CF980BA}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [LabelPropertyName(\"PlaceHolderId\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IPageTypeDefaultPageContent : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{0EB4D9D3-32BB-4850-AAB7-B20CFBA4F571}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{B2CD7FDA-1CF5-4461-A6DB-1F188B28B054}\")]\r\n        [ForeignKey(typeof(IPageType), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid PageTypeId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{122F2047-B01E-4F67-BBA3-CA67E50D985E}\")]\r\n        [NotNullValidator()]        \r\n        string PlaceHolderId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{0D1DEE90-220D-4741-AFD6-E18DB982A673}\")]\r\n        string Content { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64, IsNullable = true)]\r\n        [ImmutableFieldId(\"{68880B4B-437F-4041-BF44-FB77ADCE75AA}\")]\r\n        string ContainerClasses { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageTypeMetaDataTypeLink.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{37A346A5-8776-4765-9D57-A3F2CD8E459D}\")]\r\n    [LabelPropertyName(\"Name\")]\r\n    [KeyPropertyName(\"Id\")]    \r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IPageTypeMetaDataTypeLink : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{B186C166-9EA7-489A-BEFE-E576FE7E3FF9}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{6F0FD511-FA79-486E-A371-AFC7A3E6C614}\")]\r\n        [ForeignKey(typeof(IPageType), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid PageTypeId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{BCD3927D-D166-431D-936F-1B6843B91E82}\")]\r\n        Guid DataTypeId { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// This should match the name of the ICompositionDescription\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{8BD9BEDF-9677-4415-A3DD-E7BBD0A14286}\")]\r\n        [NotNullValidator()]\r\n        string Name { get; set; }       \r\n    }\r\n\r\n\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IPageTypeMetaDataTypeLinkExtensionMethods\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<IPageTypeMetaDataTypeLink> RemoveDeadLinks(this IEnumerable<IPageTypeMetaDataTypeLink> pageTypeMetaDataTypeLinks)\r\n        {\r\n            foreach (IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink in pageTypeMetaDataTypeLinks)\r\n            {\r\n                DataTypeDescriptor dataTypeDescriptor;\r\n                if (DynamicTypeManager.TryGetDataTypeDescriptor(pageTypeMetaDataTypeLink.DataTypeId, out dataTypeDescriptor) == false)\r\n                {\r\n                    DataFacade.Delete<IPageTypeMetaDataTypeLink>(pageTypeMetaDataTypeLink);\r\n                }\r\n                else\r\n                {\r\n                    yield return pageTypeMetaDataTypeLink;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageTypePageTemplateRestriction.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{A7F15FD7-2175-42A9-8210-DB30BD45A1C1}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IPageTypePageTemplateRestriction : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{00695FA5-E6BC-492C-B519-6188131CED03}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{5B97F19B-C18B-4470-85BE-193E9208BB49}\")]\r\n        [ForeignKey(typeof(IPageType), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid PageTypeId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{29A3D441-66EB-484D-A15D-077B5F070F42}\")]\r\n        Guid PageTemplateId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageTypeParentRestriction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.Hierarchy;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{776694C8-0074-45FD-9358-41D61113EA34}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IPageTypeParentRestriction : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{E0595ABC-1207-49D2-BA53-8055E8F4D851}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{42E5C8E5-9528-4C6F-94BD-DFA77F8D5FB7}\")]\r\n        [ForeignKey(typeof(IPageType), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid PageTypeId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{4668D87F-245D-4DBB-BFD0-2F09DDB7CD64}\")]\r\n        [ForeignKey(typeof(IPageType), \"Id\", AllowCascadeDeletes=true)]\r\n        Guid AllowedParentPageTypeId  { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageTypeTreeLink.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.C1Console.Trees;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{5B4A6EF1-B3AF-4862-AA21-DAC96EAE300B}\")]\r\n    [KeyPropertyName(\"Id\")]    \r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IPageTypeTreeLink : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{AAD20063-DB23-4F54-93FA-C3E4092DF54A}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{FAB31A74-D71F-4C30-8FF9-8D053682E8E4}\")]\r\n        [ForeignKey(typeof(IPageType), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid PageTypeId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048)]\r\n        [ImmutableFieldId(\"{A343ED1C-0298-4119-A56B-174F45106CFC}\")]\r\n        string TreeId { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class IPageTypeTreeLinkExtensionMethods\r\n    {\r\n        /// <summary>\r\n        /// Removes data items that refer to trees that are not registered.\r\n        /// </summary>\r\n        /// <param name=\"pageTypeTreeLinks\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<IPageTypeTreeLink> RemoveDeadLinks(this IEnumerable<IPageTypeTreeLink> pageTypeTreeLinks)\r\n        {\r\n            foreach (IPageTypeTreeLink pageTypeTreeLink in pageTypeTreeLinks)\r\n            {\r\n                if (TreeFacade.GetTree(pageTypeTreeLink.TreeId) == null)\r\n                {\r\n                    DataFacade.Delete<IPageTypeTreeLink>(pageTypeTreeLink);\r\n                }\r\n                else\r\n                {\r\n                    yield return pageTypeTreeLink;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPageUnpublishSchedule.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\nusing Composite.Data.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [Obsolete]\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [ImmutableTypeId(\"{20040E85-B2DE-40a8-A2BD-58ADA19DA2E4}\")]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n\tpublic interface IPageUnpublishSchedule : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{247BD023-54DC-44ab-BB2A-3044FE94A75B}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{43E1F55C-7CBE-4000-BDA7-B91EDEE9093A}\")]\r\n        Guid PageId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{D8E2C07B-F8F3-4312-8630-68DEBAA0D2B7}\")]\r\n        Guid WorkflowInstanceId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{B6091456-8BAC-4caf-B692-C5F14E5C10DB}\")]\r\n        DateTime UnpublishDate { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 16)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\r\n        [DefaultFieldStringValue(\"\")]\r\n        [ImmutableFieldId(\"{9D62C8D3-E42F-4926-8E45-5B465A59C8A6}\")]\r\n        string LocaleCultureName { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IParameter.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{13A37602-A8D6-4b31-B3FE-4F20F038BE10}\")]\r\n    [KeyPropertyName(0, \"OwnerId\")]\r\n    [KeyPropertyName(1, \"ParameterId\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    [NotReferenceable]\r\n    public interface IParameter : IData\r\n\t{\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{77C42214-8CAC-41ea-A1F9-7570E2549235}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        Guid OwnerId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{8610C316-4F7E-4d70-B42A-73F4D5568BE9}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        Guid ParameterId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{6B1CFEEA-2C07-4bf2-BAFD-187EDAA7E453}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{57BA2948-A336-472f-A635-4B5A1D636707}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        string Label { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{853D0AE0-DB10-4791-8624-3EEC027D0EF8}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        string HelpText { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{5D983115-86BA-4bd6-86C9-90474E0C77B5}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer)]\r\n        int Position { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{08098E61-5BCC-4b0d-AB9B-8636CC45EC0A}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        string TypeManagerName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{21DADDA0-BFAE-4f9d-A3BC-9099771DE73A}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString, IsNullable = true)]\r\n        string WidgetFunctionMarkup { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{16D47452-7933-46fd-A192-C2D10B695C0A}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString, IsNullable = true)]\r\n        string DefaultValueFunctionMarkup { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{11E5E571-8927-414c-8528-40E6876B0613}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString, IsNullable = true)]\r\n        string TestValueFunctionMarkup { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IPublishSchedule.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ImmutableTypeId(\"db542d7e-5cba-42e1-8a67-ad129941215c\")]\r\n    public interface IPublishSchedule : ISchedule\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"d829eec8-76b0-46c7-9fdc-e93716451c91\")]\r\n        DateTime PublishDate { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ISchedule.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\nusing Composite.Data.Validation.Validators;\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>\r\n    /// A base interface for <see cref=\"Composite.Data.Types.IPublishSchedule\"/> and <see cref=\"Composite.Data.Types.IUnpublishSchedule\"/> interfaces.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n    public interface ISchedule : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"d617415e-a233-4dc4-b0b7-2b18668616cd\")]\r\n        Guid Id { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"e6c8bd27-e3ea-4d0d-bbeb-e6a7a5200447\")]\r\n        Guid DataTypeId { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        [ImmutableFieldId(\"6a137199-8985-4721-93f4-d1a7ef305c22\")]\r\n        string DataId { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"3814914a-5ac9-4e84-bb0e-47be3224991f\")]\r\n        Guid WorkflowInstanceId { get; set; }\r\n\r\n        /// <exclude />\r\n        [NotNullValidator]\r\n        [StringSizeValidator(0, 16)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\r\n        [DefaultFieldStringValue(\"\")]\r\n        [ImmutableFieldId(\"8bfc68ee-8f63-4674-b1c8-d1ab1f1489f5\")]\r\n        string LocaleCultureName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ISearchEngineOptimizationKeyword.cs",
    "content": "﻿using Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [Caching(CachingType.Full)]\r\n    [KeyPropertyName(\"Keyword\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{895F967D-EEAA-437a-9463-E1F95C214ED6}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface ISearchEngineOptimizationKeyword : IData, ILocalizedControlled\r\n    {\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(1, 128)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{87EE9B0E-3212-472b-8FDB-2984798CDB79}\")]\r\n        string Keyword { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ISqlConnection.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{EEA30040-5B54-46c6-826A-4633E563AB70}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    [NotReferenceable]\r\n    public interface ISqlConnection : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{37861406-C595-4c16-8845-B77DCF1B4EAB}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{0887CB9C-1FC6-4d18-A288-CC6D8A44CCC8}\")]\r\n        bool IsMsSql { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 1024)]\r\n        [ImmutableFieldId(\"{82F89ADD-060D-4f09-B69A-16509CB2E730}\")]\r\n        string EncryptedConnectionString { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{9CBA57D7-6EA8-45da-BC0B-AFD929212B73}\")]\r\n        string Name { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ISqlFunctionInfo.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{2D78129F-863F-4c5a-B126-1405628351AC}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    [NotReferenceable]\r\n    public interface ISqlFunctionInfo : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{8C69D7E7-D36D-4d0a-AD6F-C17C13C84F0F}\")]\r\n        Guid Id { get; set;}\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{CACA9F21-97CC-4b6d-8901-893F376E9F54}\")]\r\n        [NotNullValidator()]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{3352125A-456D-41e9-9431-6701FCA1010D}\")]\r\n        Guid ConnectionId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{776C9FF2-ED3C-4d9f-867D-15062B392714}\")]\r\n        bool IsStoredProcedure { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{A1586CD5-6006-494a-A638-BFAA209D817B}\")]\r\n        bool ReturnsXml { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{7DDDDAAA-D1A6-4a98-8B34-426125001A35}\")]\r\n        bool IsQuery { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{BE436E9F-A199-436a-911D-2E6B5C2A4A6E}\")]\r\n        string Command { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{B6686738-1485-49b1-95D5-944C72D1897C}\")]\r\n        [NotNullValidator()]\r\n        string Namespace { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        [ImmutableFieldId(\"{89609E03-AFA4-42b6-90AA-FC5CFBAA2136}\")]\r\n        string Description { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ISystemActiveLocale.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [Caching(CachingType.Full)]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{13A5FCB2-1481-4443-866D-8976B4789B6C}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n\tpublic interface ISystemActiveLocale : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{ABFBC594-8EE2-4578-9414-34713F1E9A39}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 16)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\r\n        [ImmutableFieldId(\"{4A1AEACC-846F-49d4-A0AE-A870AC2D840B}\")]\r\n        string CultureName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [StringSizeValidator(0, 64)]\r\n        [ImmutableFieldId(\"{85009F2B-EB00-4d9f-AC43-36D6BEB99181}\")]\r\n        string UrlMappingName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [ImmutableFieldId(\"{3CF887A9-44FB-4193-A070-67E4324F9206}\")]\r\n        bool IsDefault { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/ITaskItem.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{08BAFC6D-841B-4ad7-B565-F3F5A962952A}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]    \r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [CachingAttribute(CachingType.Full)]    \r\n    public interface ITaskItem : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{EE312CF7-AB0A-4b4c-B524-4C92E475F08E}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{C800E783-7C68-4b3d-B839-56685104DC65}\")]\r\n        [NotNullValidator()]\r\n        string TaskId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 2048)]\r\n        [ImmutableFieldId(\"{28474560-8CE3-4f6f-A83D-C4F996228BF2}\")]\r\n        [NotNullValidator()]\r\n        string TaskManagerType { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{F7B9A678-B0BD-4ba5-8805-C8C2B52921AB}\")]\r\n        [NotNullValidator()]\r\n        string SerializedFlowToken { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{34E4FC09-6FFF-4fcc-BB40-59F437B2FAB6}\")]\r\n        DateTime StartTime { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUnpublishSchedule.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ImmutableTypeId(\"e0ec4c0f-31d9-42af-ba1a-65b102945a51\")]\r\n    public interface IUnpublishSchedule : ISchedule\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"024666a4-7c22-4fb5-8ddd-3fc248ce15ac\")]\r\n        DateTime UnpublishDate { get; set; }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Data/Types/IUrlConfiguration.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]  \r\n    [Title(\"Hostname configuration\")]\r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{5552C35A-A72A-55F1-9630-ACC66FE44BBE}\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [KeyPropertyName(\"Id\")]\r\n    [CachingAttribute(CachingType.Full)]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface IUrlConfiguration : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{D0C48D08-1318-7441-D2C0-425D31894C1F}\")]\r\n        Guid Id { get; set; }\r\n        \r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255, IsNullable = false)]\r\n        [ImmutableFieldId(\"{C0504E0C-B487-3951-AA18-DBF28DD681B5}\")]\r\n        [RegexValidator(@\"^((\\.([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\\-]*[a-zA-Z0-9]))*)$\")]\r\n        string PageUrlSuffix { get; set; }\r\n    } \r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUser.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// This data interface represents a administrative user in C1 CMS. This can be used to query users through a <see cref=\"Composite.Data.DataConnection\"/>. \r\n    /// </summary>\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(nameof(Id))]\r\n    [LabelPropertyName(nameof(Username))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{AA086DC1-E5F6-4568-8BED-460D3275380F}\")]\r\n    [Caching(CachingType.Full)]    \r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [Title(\"C1 Console User\")]\r\n    public interface IUser : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{480CF63A-A2E9-43e7-8034-778E55A0B6ED}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 64)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{C36F8A02-4F7E-437c-A3D9-AADE8A531EFA}\")]\r\n        string Username { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128, IsNullable = true)]\r\n        [ImmutableFieldId(\"{20F756AD-F03D-453E-B464-D2C13051A647}\")]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128, IsNullable = true)]\r\n        [ImmutableFieldId(\"{C0929E14-3FB8-4CE5-8374-997A7508DF80}\")]\r\n        string Email { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64, IsNullable = true)]\r\n        [ImmutableFieldId(\"{C7A7D63C-EA87-48ac-B009-5D4050A2F248}\")]\r\n        [Obsolete(\"Use IUserFormLogin data type instead (new name is 'IUserFormLogin.Folder'). Will be removed in future releases.\")]\r\n        string Group { get; set; }\r\n\r\n        /// <summary>\r\n        /// Determines whether the user is locked\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [DefaultFieldBoolValue(false)]\r\n        [ImmutableFieldId(\"{72BFFBDC-E4FF-4BD4-9BB1-B86FAEA39468}\")]\r\n        [Obsolete(\"Use IUserFormLogin data type instead. Will be removed in future releases.\")]\r\n        bool IsLocked { get; set; }\r\n\r\n        /// <summary>\r\n        /// Contains a code describing lockout reason (f.e. locked by an administrator or automatically after X failed login attempts)\r\n        /// For possible values, see enumeration <see cref=\"UserLockoutReason\"/>\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer)]\r\n        [DefaultFieldIntValue(0)]\r\n        [ImmutableFieldId(\"{39CBCCFA-CFB2-4E79-9204-C9596A3FC0E9}\")]\r\n        [Obsolete(\"Use IUserFormLogin data type instead. Will be removed in future releases.\")]\r\n        int LockoutReason { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256, IsNullable = true)]\r\n        [ImmutableFieldId(\"{C0230DEB-5394-4819-BE18-A60CF5FA69F0}\")]\r\n        [Obsolete(\"Use IUserFormLogin data type instead. Will be removed in future releases.\")]\r\n        string EncryptedPassword { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128, IsNullable = true)]\r\n        [ImmutableFieldId(\"{CA2CF6F8-489B-4D60-B3C3-AF46D1259647}\")]\r\n        [Obsolete(\"Use IUserFormLogin data type instead. Will be removed in future releases.\")]\r\n        string PasswordHashSalt { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{35457DA7-A13E-4A6C-9008-3D619A519F2B}\")]\r\n        [DefaultFieldNowDateTimeValue]\r\n        [Obsolete(\"Use IUserFormLogin data type instead. Will be removed in future releases.\")]\r\n        DateTime LastPasswordChangeDate { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserActiveLocale.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [Caching(CachingType.Full)]\r\n    [KeyPropertyName(\"Id\")]    \r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{9187ABF1-DDD6-4470-A29E-766FABD5BA53}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n\tpublic interface IUserActiveLocale : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{65638F6C-0610-4563-8552-EF26FDCC7FF3}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{DA8843CA-C550-4b73-93F8-5CB8C40C086C}\")]\r\n        [ForeignKey(typeof(IUser), \"Username\", AllowCascadeDeletes = true)]\r\n        string Username { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 16)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\r\n        [ImmutableFieldId(\"{D11E77B2-459B-43e4-9F98-CB5A9F44A812}\")]\r\n        string CultureName { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserActivePerspective.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [KeyPropertyName(nameof(Id))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{A7C6D249-1A71-4486-A252-706D8E1981D8}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [Caching(CachingType.Full)]\r\n    public interface IUserActivePerspective : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{9BB04474-DB50-4df1-8EF1-562DE7F58B1A}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{2D5BC444-377A-4337-9486-8210630E6E09}\")]\r\n        [ForeignKey(typeof(IUser), \"Username\", AllowCascadeDeletes = true)]\r\n        string Username { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{5AC5A7E4-4A75-4926-AB53-1A736732A9D4}\")]\r\n        string SerializedEntityToken { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserConsoleInformation.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{7630098C-CF7B-4e16-A86F-E455FA871ABF}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [LabelPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]    \r\n\tpublic interface IUserConsoleInformation : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{2F91C083-A3BB-4226-B229-66FE2D653A35}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{11154624-8574-48c0-97B0-E1AFFEAC7AD4}\")]\r\n        [NotNullValidator()]\r\n        [ForeignKey(typeof(IUser), \"Username\", AllowCascadeDeletes = true)]\r\n        string Username { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{A955C07B-9FDC-40b2-8C18-87D097E94329}\")]\r\n        [NotNullValidator()]\r\n        string ConsoleId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{39567CE9-C85F-439e-871D-EC97F3F79016}\")]\r\n        DateTime TimeStamp { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserDeveloperSettings.cs",
    "content": "﻿using Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [Caching(CachingType.Full)]\r\n    [KeyPropertyName(\"Username\")]\r\n    [LabelPropertyName(\"Username\")]    \r\n    [DataScope(DataScopeIdentifier.PublicName)]    \r\n    [ImmutableTypeId(\"{10ECFF01-0590-4b9a-9FD0-EE7BD1EC0CD8}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n\tpublic interface IUserDeveloperSettings : IData\r\n\t{\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 64)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{F2425F85-5B41-4f73-8F9A-54CAAAE266FC}\")]\r\n        [ForeignKey(typeof(IUser), \"Username\", AllowCascadeDeletes = true)]\r\n        string Username { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [ImmutableFieldId(\"{303F58C7-5F51-4b53-BDEF-ED8025E6EA1A}\")]\r\n        string LastSpecifiedNamespace { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserFormLogin.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>\r\n    /// Contains information about console user's password and login status (whether it is locked)\r\n    /// </summary>\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"UserId\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{137a4e25-3b97-4c41-9ca2-2bea99fc2a2c}\")]\r\n    [Caching(CachingType.Full)]\r\n    public interface IUserFormLogin: IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{3576f435-1ca4-4e22-94e8-1a5165ee9d60}\")]\r\n        [ForeignKey(typeof(IUser), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid UserId { get; set; }\r\n\r\n        /// <exclude />\r\n        [NotNullValidator]\r\n        [StringSizeValidator(1, 64)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{dbfb9790-ec68-44fc-bab7-f46517c5abcf}\")]\r\n        string Folder { get; set; }\r\n\r\n        /// <summary>\r\n        /// Determines whether the user is locked\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [DefaultFieldBoolValue(false)]\r\n        [ImmutableFieldId(\"{43df4e85-383d-47f1-8396-6d4bbfcf7d22}\")]\r\n        bool IsLocked { get; set; }\r\n\r\n        /// <summary>\r\n        /// Contains a code describing lockout reason (f.e. locked by an administrator or automatically after X failed login attempts)\r\n        /// For possible values, see enumeration <see cref=\"UserLockoutReason\"/>\r\n        /// </summary>\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer)]\r\n        [DefaultFieldIntValue(0)]\r\n        [ImmutableFieldId(\"{10651e29-e64f-4550-a123-7c24a38dc97b}\")]\r\n        int LockoutReason { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [ImmutableFieldId(\"{fd51ed7d-5b4d-4abc-a682-6d01047e496a}\")]\r\n        string PasswordHash { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{ff1d3308-3822-4bd9-bf04-7c7b8cf6142b}\")]\r\n        string PasswordHashSalt { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{bc2fb04a-802d-4c69-ac0c-9a71e95a8c97}\")]\r\n        [DefaultFieldNowDateTimeValue]\r\n        DateTime LastPasswordChangeDate { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserGroup.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// This data interface represents a user group in C1 CMS. This can be used to query user groups through a <see cref=\"Composite.Data.DataConnection\"/>. \r\n    /// </summary>\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [LabelPropertyName(\"Name\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{F32B2CBB-92A1-473c-99D6-5D0C20A7480E}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface IUserGroup : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{93EA801A-AA0D-4cac-BE31-EDF9A8345D29}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [Composite.Data.Validation.Validators.StringSizeValidator(2, 64)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{86C65F7F-64EA-4fcc-980D-AAF79C32CEC6}\")]\r\n        string Name { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserGroupActiveLocale.cs",
    "content": "using System;\nusing Composite.Data.Hierarchy;\nusing Composite.Data.Hierarchy.DataAncestorProviders;\nusing Composite.Data.Validation.Validators;\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\n\n\nnamespace Composite.Data.Types\n{\n    /// <summary>    \n    /// </summary>\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \n    [AutoUpdateble]\n    [Caching(CachingType.Full)]\n    [KeyPropertyName(\"Id\")]    \n    [DataScope(DataScopeIdentifier.PublicName)]\n    [ImmutableTypeId(\"{f60f4da8-59df-460f-84bf-5bf20700036b}\")]\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\n\tpublic interface IUserGroupActiveLocale : IData\n\t{\n        /// <exclude />\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\n        [ImmutableFieldId(\"{80c5cc7c-bf23-4c7d-bfe0-d168eda41d50}\")]\n        Guid Id { get; set; }\n\n\n        /// <exclude />\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\n        [ImmutableFieldId(\"{f28ada6a-12bd-43bf-aef8-1b693ee3d390}\")]\n        Guid UserGroupId { get; set; }\n\n\n        /// <exclude />\n        [NotNullValidator()]\n        [StringSizeValidator(2, 16)]\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\n        [ImmutableFieldId(\"{ddc38768-16e8-444c-a982-80f2a55b0b75}\")]\n        [ForeignKey(typeof(ISystemActiveLocale), nameof(ISystemActiveLocale.CultureName), AllowCascadeDeletes = true)]\n        string CultureName { get; set; }\n\t}\n}\n"
  },
  {
    "path": "Composite/Data/Types/IUserGroupActivePerspective.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(nameof(Id))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{13FBE551-DC00-4ad4-8720-7FF66264C002}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [Caching(CachingType.Full)]\r\n    public interface IUserGroupActivePerspective : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{2BC54612-C92E-4cc4-8B6B-2B4C9EABADC5}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{45B9D62A-6DDC-4bdf-BFE3-4D4CD0D6A658}\")]\r\n        Guid UserGroupId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{56CAEDCB-600D-476c-B085-617CA773721F}\")]\r\n        string SerializedEntityToken { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserGroupPermissionDefinition.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [Caching(CachingType.Full)]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{72786B98-C6B6-4192-9438-A4DFB72CF086}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface IUserGroupPermissionDefinition : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{EE4DD9A0-F0EB-43b7-82DE-7B6B81C02913}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{E2F41EFE-70CA-448f-86DD-C41FD19E6274}\")]\r\n        Guid UserGroupId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{03FB7549-1C6E-401a-983C-9C0793102A7A}\")]\r\n        string SerializedEntityToken { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserGroupPermissionDefinitionPermissionType.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [Caching(CachingType.Full)]\r\n    [LabelPropertyName(\"PermissionTypeName\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{21FA38B5-7B45-4f2d-9F40-2BDDA80724B8}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface IUserGroupPermissionDefinitionPermissionType : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{DCEDF510-8742-431b-B10C-66ADCCC6A71F}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{32D99BCA-1DD2-4b52-9887-5089B5EAA055}\")]\r\n        [ForeignKey(typeof(IUserGroupPermissionDefinition), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid UserGroupPermissionDefinitionId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{63A05B43-EF86-4e8c-801B-A80D4D0202AA}\")]\r\n        string PermissionTypeName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserPasswordHistory.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// Contains information about a password previously used by a user.  \r\n    /// </summary>\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{63651A11-0D1B-4ADC-99E7-C2B71B5A26B1}\")]\r\n    public interface IUserPasswordHistory : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{F71AFE78-EED8-4BCC-BFBE-C1BDE5B792E0}\")]\r\n        Guid Id { get; set; }\r\n        \r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{2B266EF3-AD8C-4CFD-8407-211A2CF3044E}\")]\r\n        [ForeignKey(typeof(IUser), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid UserId { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [ImmutableFieldId(\"{B75CD57F-73E5-4C63-9DFE-11380825E37F}\")]\r\n        string PasswordHash { get; set; }\r\n        \r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 128)]\r\n        [ImmutableFieldId(\"{2A789CF6-6E29-40F5-9462-D8CA39953C33}\")]\r\n        string PasswordSalt { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.DateTime)]\r\n        [ImmutableFieldId(\"{0D7D5E71-521C-456F-A6ED-577DE68B58C8}\")]\r\n        [DefaultFieldNowDateTimeValue]\r\n        DateTime SetDate { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserPermissionDefinition.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [Caching(CachingType.Full)]\r\n    [LabelPropertyName(\"Username\")]    \r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{0E4BEF62-6C11-4029-B2F5-4BCC8E46F051}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]    \r\n\tpublic interface IUserPermissionDefinition : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{95D7C9BF-F9E0-41aa-8EEB-8B3336390856}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{8BBE4B23-1B04-452b-B9A3-83EA3B2E52DB}\")]\r\n        [ForeignKey(typeof(IUser), \"Username\", AllowCascadeDeletes = true)]\r\n        string Username { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        [ImmutableFieldId(\"{15D09268-1119-47d6-A004-99DEABFEF886}\")]\r\n        string SerializedEntityToken { get; set; }\r\n\t}    \r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserPermissionDefinitionPermissionType.cs",
    "content": "using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [KeyPropertyName(\"Id\")]\r\n    [Caching(CachingType.Full)]\r\n    [LabelPropertyName(\"PermissionTypeName\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{4169D18C-8445-4419-8863-F26955AA66D1}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface IUserPermissionDefinitionPermissionType : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{945834C0-32B8-4ad6-89D9-396415A6D938}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{EF4BB677-6BCF-4f3a-B416-76C3DCD174CB}\")]\r\n        [ForeignKey(typeof(IUserPermissionDefinition), \"Id\", AllowCascadeDeletes = true)]\r\n        Guid UserPermissionDefinitionId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{E7512410-3FD4-4d3b-9D8A-45734A21CB1D}\")]\r\n        string PermissionTypeName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserSettings.cs",
    "content": "﻿using Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [Caching(CachingType.Full)]\r\n    [KeyPropertyName(\"Username\")]\r\n    [LabelPropertyName(\"Username\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{F89054CB-C0E0-41ad-948D-4AEA4055C3A3}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface IUserSettings : IData\r\n    {\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 64)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        [ImmutableFieldId(\"{A7BEC71E-0CA9-4b33-A1E7-F2B5B5744647}\")]\r\n        [ForeignKey(typeof(IUser), \"Username\", AllowCascadeDeletes = true)]\r\n        string Username { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 16)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\r\n        [ImmutableFieldId(\"{9D62C8D3-E42F-4926-8E45-5B465A59C8A6}\")]\r\n        string CultureName { get; set; }\r\n\r\n        /// <exclude />\r\n        [NotNullValidator()]\r\n        [StringSizeValidator(2, 16)]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16)]\r\n        [ImmutableFieldId(\"{F1BC3D80-AD86-4730-A6EE-65E19BEFD443}\")]\r\n        [DefaultFieldStringValue(\"en-US\")] //for easy upgrade\r\n        string C1ConsoleUiLanguage { get; set; }\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16, IsNullable = true)]\r\n        [ImmutableFieldId(\"{931130A1-5CDD-487a-B51F-76A0396D3216}\")]\r\n        string CurrentActiveLocaleCultureName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 16, IsNullable = true)]\r\n        [ImmutableFieldId(\"{0D354A92-461D-4ff8-B797-F2897119CD3B}\")]\r\n        string ForeignLocaleCultureName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IUserUserGroupRelation.cs",
    "content": "using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// This data interface represents a user relation to a user group in C1 CMS. This can be used to query user group members through a <see cref=\"Composite.Data.DataConnection\"/>. \r\n    /// </summary>\r\n    [AutoUpdateble]\r\n    [Caching(CachingType.Full)]\r\n    [KeyPropertyName(0, \"UserId\")]\r\n    [KeyPropertyName(1, \"UserGroupId\")]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"{956BC414-4612-4a8a-A673-B82695F322DD}\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    public interface IUserUserGroupRelation : IData\r\n\t{\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ForeignKey(typeof(IUser), \"Id\", AllowCascadeDeletes = true)]\r\n        [ImmutableFieldId(\"{529E233A-0386-4cca-8A32-69FE156EAEE1}\")]\r\n        Guid UserId { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ForeignKey(typeof(IUserGroup), \"Id\", AllowCascadeDeletes = true)]\r\n        [ImmutableFieldId(\"{9BB13E81-3125-45eb-87A8-D0DE671A3102}\")]\r\n        Guid UserGroupId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IVersioned.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>\r\n    /// Represents a data type that supports multiple versions of the same data item\r\n    /// </summary>\r\n    [VersionKeyPropertyName(nameof(VersionId))]\r\n    public interface IVersioned : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{f42d511b-1d76-4c05-a895-99f23b757e1e}\")]\r\n        [DefaultFieldNewGuidValue]\r\n        Guid VersionId { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IVisualFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{FB2EAE51-1214-491d-8174-3A99DF90DFFA}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [Caching(CachingType.Full)]\r\n    [NotReferenceable]\r\n    public interface IVisualFunction : IData\r\n\t{\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{F8678EC3-FA5A-4141-9C93-130C93A49413}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{6CED428C-6190-4176-9E6D-C6DBCF9BD4C3}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{D6E1D464-1343-4f08-AB97-759D7DD1EB80}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        string Namespace { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{A40492CA-BEB9-43cb-83CA-082889575A36}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        string Description { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{4737CCE8-9302-438a-87B0-DF28C974DC57}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String,256)]\r\n        string TypeManagerName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{FE3D5717-8F42-48e8-A089-AD431BEA1708}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.LargeString)]\r\n        string XhtmlTemplate { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{92479348-53B0-410d-8200-B3C6D7AFE54E}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Integer)]\r\n        int MaximumItemsToList { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{3E41CE01-166F-41fb-A0FA-93EB5E3391DA}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 64)]\r\n        string OrderbyFieldName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{790B0F2E-CAB7-4eea-9EB2-5E49C8DE7575}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Boolean)]\r\n        [DefaultFieldBoolValue(true)]\r\n        bool OrderbyAscending { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IXmlPageTemplate.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{7B54D7D2-6BE6-48a6-9AE1-2E0373073D1D}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [LabelPropertyName(\"Title\")]\r\n    [CachingAttribute(CachingType.Full)]\r\n    public interface IXmlPageTemplate : IData\r\n    {\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        [ImmutableFieldId(\"{E94FDE4D-7FDB-4b0e-A320-83EE73A73397}\")]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 249)]\r\n        [ImmutableFieldId(\"{BF377CD5-A96F-44f1-91AF-CF2E6F530E61}\")]\r\n        [NotNullValidator()]\r\n        string Title { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 255)]\r\n        [ImmutableFieldId(\"{0F654E1F-1453-428f-9EC9-7CC9CFBD59DC}\")]\r\n        string PageTemplateFilePath { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IXsltFile.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    [ImmutableTypeId(\"AE2DCD1A-D68F-45CC-8F0A-A2D1775FC098\")]\r\n    public interface IXsltFile : IFile\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/IXsltFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Data;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{F6F0B424-0AFA-4d9a-9DF1-C57F2B7F7C8D}\")]\r\n    [KeyPropertyName(\"Id\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.PublicName)]\r\n    public interface IXsltFunction : IData\r\n    {\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{25E73650-E7F8-4a4b-8510-9BDA1C1B2D61}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.Guid)]\r\n        Guid Id { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{8DD6A2E7-CDCE-46b9-B517-36D633B98311}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        [Composite.Data.Validation.Validators.StringSizeValidator(1, 256)]\r\n        string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{DC241562-2B30-4d06-852D-12E5CFF81EE8}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        [Composite.Data.Validation.Validators.StringSizeValidator(1, 512)]\r\n        string Namespace { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{2670BEEE-4A6A-4f0f-83E6-8103EEA25D09}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 512)]\r\n        string Description { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{1B695E1A-9EBD-4ce8-BA36-711D1E84D8AF}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 32)]\r\n        string OutputXmlSubType { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{271AEA09-75CC-45d5-9D7F-C96B1177D046}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 1024)]\r\n        string XslFilePath { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/MediaFileDataAncesorProvider.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Data.Hierarchy;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    internal sealed class MediaFileDataAncesorProvider : IDataAncestorProvider\r\n\t{\r\n        public IData GetParent(IData data)\r\n        {\r\n            string parentFolderPath;\r\n            string storeId;\r\n\r\n            if (data is IMediaFile)\r\n            {\r\n                var file = (IMediaFile)data;\r\n\r\n                parentFolderPath = file.FolderPath;\r\n                storeId = file.StoreId;\r\n            }\r\n            else if (data is IMediaFileFolder)\r\n            {\r\n                var folder = (IMediaFileFolder) data;\r\n\r\n                int lastIndex = folder.Path.LastIndexOf('/');\r\n                if (lastIndex == 0)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                parentFolderPath = folder.Path.Substring(0, lastIndex);\r\n                storeId = folder.StoreId;\r\n            }\r\n            else\r\n            {\r\n                throw new ArgumentException(\"Must be either of type IMediaFile or IMediaFileFolder\", nameof(data));\r\n            }\r\n\r\n            var queryable = DataFacade.GetData<IMediaFileFolder>();\r\n\r\n            return queryable.IsEnumerableQuery()\r\n                ? queryable.AsEnumerable()\r\n                           .FirstOrDefault(item => item.Path == parentFolderPath && item.StoreId == storeId)\r\n                : queryable.FirstOrDefault(item => item.Path == parentFolderPath && item.StoreId == storeId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/PageInsertPosition.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Composite.C1Console.Users;\n\nnamespace Composite.Data.Types\n{\n    /// <summary>    \n    /// </summary>\n    /// <exclude />\n    public interface IPageInsertionPosition\n    {\n        /// <exclude />\n        void CreatePageStructure(IPage page, Guid parentPageId);\n    }\n\n    /// <summary>\n    /// Contains awailable page insertion positions\n    /// </summary>\n    public static class PageInsertPosition\n    {\n        /// <summary>\n        /// The page will be added as the last page in the list of child pages.\n        /// </summary>\n        public static IPageInsertionPosition Bottom => new BottomPageInsertPosition();\n\n        /// <summary>\n        /// The page will be added as the first page in the list of child pages.\n        /// </summary>\n        public static IPageInsertionPosition Top => new TopPageInsertPosition();\n\n        /// <summary>\n        /// A page will be added with respect to the aplhabetic order.\n        /// </summary>\n        public static IPageInsertionPosition Alphabetic => new AlphabeticPageInsertPosition();\n\n        /// <summary>\n        /// The page will appear after a given page\n        /// </summary>\n        /// <param name=\"existingPageId\">An existing page after which a new page should be inserted</param>\n        /// <returns></returns>\n        public static IPageInsertionPosition After(Guid existingPageId) => new AfterPageInsertPosition(existingPageId);\n\n\n        internal class BottomPageInsertPosition : IPageInsertionPosition\n        {\n            public void CreatePageStructure(IPage page, Guid parentPageId)\n            {\n                if (DataFacade.GetData<IPageStructure>(f => f.Id == page.Id).Any())\n                    return;\n\n                int siblingPageCount =\n                        (from ps in DataFacade.GetData<IPageStructure>()\n                         where ps.ParentId == parentPageId\n                         select ps).Count();\n\n                IPageStructure newPageStructure = DataFacade.BuildNew<IPageStructure>();\n                newPageStructure.ParentId = parentPageId;\n                newPageStructure.Id = page.Id;\n                newPageStructure.LocalOrdering = siblingPageCount;\n                DataFacade.AddNew<IPageStructure>(newPageStructure);\n            }\n        }\n\n\n        internal class TopPageInsertPosition : IPageInsertionPosition\n        {\n            public void CreatePageStructure(IPage page, Guid parentPageId)\n            {\n                if (DataFacade.GetData<IPageStructure>(f => f.Id == page.Id).Any())\n                    return;\n\n                PageServices.InsertIntoPositionInternal(page.Id, parentPageId, 0);\n            }\n        }\n\n        internal class AlphabeticPageInsertPosition : IPageInsertionPosition\n        {\n            public void CreatePageStructure(IPage newPage, Guid parentPageId)\n            {\n                if (DataFacade.GetData<IPageStructure>(f => f.Id == newPage.Id).Any())\n                    return;\n\n                List<IPageStructure> pageStructures =\n                        (from ps in DataFacade.GetData<IPageStructure>()\n                         where ps.ParentId == parentPageId\n                         orderby ps.LocalOrdering\n                         select ps).ToList();\n\n                var cultureInfo = UserSettings.CultureInfo;\n\n                int targetLocalOrdering = pageStructures.Any() ? -1 : 0;\n\n                foreach (IPageStructure pageStructure in pageStructures)\n                {\n                    if (targetLocalOrdering != -1)\n                    {\n                        pageStructure.LocalOrdering++;\n                        continue;\n                    }\n\n                    IPage page =\n                        (from p in DataFacade.GetData<IPage>()\n                         where p.Id == pageStructure.Id\n                         select p).SingleOrDefault();\n\n                    if (page == null)\n                    {\n                        continue;\n                    }\n\n                    if (string.Compare(page.Title, newPage.Title, true, cultureInfo) > 0)\n                    {\n                        targetLocalOrdering = pageStructure.LocalOrdering;\n                        pageStructure.LocalOrdering++;\n                    }\n                }\n\n                if (targetLocalOrdering == -1)\n                {\n                    targetLocalOrdering = pageStructures.Last().LocalOrdering + 1;\n                }\n                else\n                {\n                    DataFacade.Update(pageStructures.Where(page => page.LocalOrdering > targetLocalOrdering));\n                }\n\n                var newPageStructure = DataFacade.BuildNew<IPageStructure>();\n                newPageStructure.ParentId = parentPageId;\n                newPageStructure.Id = newPage.Id;\n                newPageStructure.LocalOrdering = targetLocalOrdering;\n                DataFacade.AddNew(newPageStructure);\n            }\n        }\n\n        internal class AfterPageInsertPosition : IPageInsertionPosition\n        {\n            private readonly Guid _existingPageId;\n\n            public AfterPageInsertPosition(Guid existingPageId)\n            {\n                _existingPageId = existingPageId;\n            }\n\n            public void CreatePageStructure(IPage newPage, Guid parentPageId)\n            {\n                if (DataFacade.GetData<IPageStructure>(f => f.Id == newPage.Id).Any())\n                    return;\n\n                var pageStructures =\n                    (from ps in DataFacade.GetData<IPageStructure>()\n                     where ps.ParentId == parentPageId\n                     orderby ps.LocalOrdering\n                     select ps).ToList();\n\n                bool pageInserted = false;\n                foreach (IPageStructure pageStructure in pageStructures)\n                {\n                    if (!pageInserted)\n                    {\n                        if (pageStructure.Id == _existingPageId)\n                        {\n                            IPageStructure newPageStructure = DataFacade.BuildNew<IPageStructure>();\n                            newPageStructure.ParentId = parentPageId;\n                            newPageStructure.Id = newPage.Id;\n                            newPageStructure.LocalOrdering = pageStructure.LocalOrdering + 1;\n                            DataFacade.AddNew<IPageStructure>(newPageStructure);\n\n                            pageInserted = true;\n                        }\n                    }\n                    else\n                    {\n                        pageStructure.LocalOrdering += 1;\n                    }\n                }\n\n                DataFacade.Update(pageStructures);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Data/Types/PageServices.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Transactions;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class PageServices\r\n    {\r\n        private static readonly object _lock = new object();\r\n\r\n        /// <exclude />\r\n        public static Guid GetParentId(this IPage page)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n            Verify.ArgumentCondition(page.DataSourceId.ExistsInStore, nameof(page),\r\n                \"The given data have not been added yet\");\r\n\r\n            return PageManager.GetParentId(page.Id);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static int GetLocalOrdering(this IPage page)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n            Verify.ArgumentCondition(page.DataSourceId.ExistsInStore, nameof(page),\r\n                \"The given data have not been added yet\");\r\n\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                return PageManager.GetLocalOrdering(page.Id);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IQueryable<IPage> GetChildren(this IPage page)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n            Verify.ArgumentCondition(page.DataSourceId.ExistsInStore, nameof(page),\r\n                \"The given data have not been added yet\");\r\n\r\n            return GetChildren(page.Id);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IQueryable<IPage> GetChildren(Guid parentId)\r\n        {\r\n            var structure = DataFacade.GetData<IPageStructure>();\r\n            var pages = DataFacade.GetData<IPage>();\r\n\r\n            if (structure.IsEnumerableQuery() && pages.IsEnumerableQuery())\r\n            {\r\n                return (from ps in structure.AsEnumerable()\r\n                        where ps.ParentId == parentId\r\n                        join p in pages.AsEnumerable() on ps.Id equals p.Id\r\n                        orderby ps.LocalOrdering\r\n                        select p).AsQueryable();\r\n            }\r\n\r\n            return from ps in structure\r\n                   where ps.ParentId == parentId\r\n                   join p in pages on ps.Id equals p.Id\r\n                   orderby ps.LocalOrdering\r\n                   select p;\r\n\r\n#warning revisit this - we return all versions (by design so far). Any ordering on page versions? - check history for original intent\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static int GetChildrenCount(Guid parentId)\r\n        {\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                return PageManager.GetChildrenIDs(parentId).Count;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static ReadOnlyCollection<Guid> GetChildrenIDs(Guid parentId)\r\n        {\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                return PageManager.GetChildrenIDs(parentId);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static bool IsChildrenAlphabeticOrdered(Guid parentId)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                var pageIds = PageManager.GetChildrenIDs(parentId);\r\n\r\n                if (pageIds.Count == 0) return true;\r\n\r\n                IPage firstPage = PageManager.GetPageById(pageIds[0], true);\r\n\r\n                for (int i = 1; i < pageIds.Count; i++)\r\n                {\r\n                    IPage currentPage = PageManager.GetPageById(pageIds[i], true);\r\n\r\n                    if (((firstPage != null) && (currentPage != null)) &&\r\n                        (string.Compare(firstPage.Title, currentPage.Title, true, UserSettings.CultureInfo) > 0))\r\n                    {\r\n                        return false;\r\n                    }\r\n\r\n                    if (currentPage != null)\r\n                    {\r\n                        firstPage = currentPage;\r\n                    }\r\n                }\r\n\r\n                return true;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IPage GetPageFromLocalOrder(Guid parentId, int localOrder)\r\n        {\r\n            Guid pageId;\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n// FirstOrDefault used here because local ordering could be \"corrupt\"\r\n                IPageStructure pageStructure =\r\n                    (from ps in DataFacade.GetData<IPageStructure>()\r\n                        where ps.ParentId == parentId &&\r\n                              ps.LocalOrdering == localOrder\r\n                        select ps).FirstOrDefault();\r\n\r\n                if (pageStructure == null) return null;\r\n\r\n                pageId = pageStructure.Id;\r\n            }\r\n\r\n            return DataFacade.GetData<IPage>(f => f.Id == pageId).FirstOrDefault();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Add() method instead\")]\r\n        public static IPage AddPageAtTop(this IPage newPage, Guid parentId)\r\n        {\r\n            return AddPageAtTop(newPage, parentId, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Add() method instead\")]\r\n        public static IPage AddPageAtTop(this IPage newPage, Guid parentId, bool addNewPage)\r\n        {\r\n            return newPage.InsertIntoPosition(parentId, 0, addNewPage);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Add() method instead\")]\r\n        public static IPage AddPageAtBottom(this IPage newPage, Guid parentId)\r\n        {\r\n            return AddPageAtBottom(newPage, parentId, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Add() method instead\")]\r\n        public static IPage AddPageAtBottom(this IPage newPage, Guid parentId, bool addNewPage)\r\n        {\r\n            Verify.ArgumentNotNull(newPage, nameof(newPage));\r\n\r\n            lock (_lock)\r\n            {\r\n                PageInsertPosition.Bottom.CreatePageStructure(newPage, parentId);\r\n\r\n                return addNewPage ? DataFacade.AddNew<IPage>(newPage) : newPage;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Adds a page to the specified position.\r\n        /// </summary>\r\n        /// <param name=\"newPage\">The new page to be added.</param>\r\n        /// <param name=\"parentId\">The parent id.</param>\r\n        /// <param name=\"pageInsertionPosition\">The page insertion position</param>\r\n        /// <returns></returns>\r\n        public static IPage Add(this IPage newPage, Guid parentId, IPageInsertionPosition pageInsertionPosition)\r\n        {\r\n            Verify.ArgumentNotNull(newPage, nameof(newPage));\r\n            Verify.ArgumentNotNull(pageInsertionPosition, nameof(pageInsertionPosition));\r\n\r\n            lock (_lock)\r\n            {\r\n                pageInsertionPosition.CreatePageStructure(newPage, parentId);\r\n\r\n                newPage = DataFacade.AddNew<IPage>(newPage);\r\n\r\n                AddPageTypeRelatedData(newPage);\r\n            }\r\n\r\n            return newPage;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Add() method instead\")]\r\n        public static IPage AddPageAlphabetic(this IPage newPage, Guid parentId)\r\n        {\r\n            Verify.ArgumentNotNull(newPage, nameof(newPage));\r\n\r\n            lock (_lock)\r\n            {\r\n                PageInsertPosition.Alphabetic.CreatePageStructure(newPage, parentId);\r\n\r\n                return DataFacade.AddNew<IPage>(newPage);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Add() method instead\")]\r\n        public static IPage AddPageAfter(this IPage newPage, Guid parentId, Guid existingPageId)\r\n        {\r\n            return AddPageAfter(newPage, parentId, existingPageId, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IPage MoveTo(this IPage page, Guid parentId, int localOrder, bool addNewPage)\r\n        {\r\n            Verify.ArgumentNotNull(page, nameof(page));\r\n\r\n            lock (_lock)\r\n            {\r\n                IPageStructure pageStructure = DataFacade.GetData<IPageStructure>(f => f.Id == page.Id).FirstOrDefault();\r\n\r\n                if (pageStructure != null)\r\n                {\r\n                    if (pageStructure.ParentId == parentId)\r\n                    {\r\n                        if (localOrder == pageStructure.LocalOrdering)\r\n                        {\r\n                            // If page is already has the right order - don't do anything\r\n                            return page;\r\n                        }\r\n                        if (localOrder > pageStructure.LocalOrdering)\r\n                        {\r\n                            localOrder--;\r\n                        }\r\n                    }\r\n                    DataFacade.Delete(pageStructure);\r\n\r\n                    if (pageStructure.ParentId != parentId)\r\n                    {\r\n                        FixOrder(pageStructure.ParentId);\r\n                    }\r\n                }\r\n\r\n                return InsertIntoPosition(page, parentId, localOrder, addNewPage);\r\n            }\r\n        }\r\n\r\n        private static void FixOrder(Guid parentId)\r\n        {\r\n            List<IPageStructure> pageStructures =\r\n                DataFacade.GetData<IPageStructure>(ps => ps.ParentId == parentId).ToList();\r\n\r\n            pageStructures = pageStructures.OrderBy(ps => ps.LocalOrdering).ToList();\r\n\r\n            for (int i = pageStructures.Count - 1; i >= 0; i--)\r\n            {\r\n                if (pageStructures[i].LocalOrdering == i) // If order is correct, skipping the page structure object\r\n                {\r\n                    pageStructures.RemoveAt(i);\r\n                    continue;\r\n                }\r\n\r\n                pageStructures[i].LocalOrdering = i;\r\n            }\r\n\r\n            if (pageStructures.Count == 0) return;\r\n\r\n            DataFacade.Update(pageStructures);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IPage InsertIntoPosition(this IPage newPage, Guid parentId, int localOrder, bool addNewPage)\r\n        {\r\n            Verify.ArgumentNotNull(newPage, nameof(newPage));\r\n\r\n            lock (_lock)\r\n            {\r\n                InsertIntoPositionInternal(newPage.Id, parentId, localOrder);\r\n\r\n                return addNewPage ? DataFacade.AddNew(newPage) : newPage;\r\n            }\r\n        }\r\n\r\n\r\n        internal static void InsertIntoPositionInternal(Guid newPageId, Guid parentId, int localOrder)\r\n        {\r\n            List<IPageStructure> pageStructures =\r\n                (from ps in DataFacade.GetData<IPageStructure>(false)\r\n                    where ps.ParentId == parentId\r\n                    orderby ps.LocalOrdering\r\n                    select ps).ToList();\r\n\r\n            var toBeUpdated = new List<IData>();\r\n            for (int i = 0; i < pageStructures.Count; i++)\r\n            {\r\n                int newSortOrder = i < localOrder ? i : i + 1;\r\n                if (pageStructures[i].LocalOrdering != newSortOrder)\r\n                {\r\n                    pageStructures[i].LocalOrdering = newSortOrder;\r\n                    toBeUpdated.Add(pageStructures[i]);\r\n                }\r\n            }\r\n\r\n            DataFacade.Update(toBeUpdated);\r\n\r\n            if (localOrder > pageStructures.Count)\r\n            {\r\n                localOrder = pageStructures.Count;\r\n            }\r\n\r\n            var newPageStructure = DataFacade.BuildNew<IPageStructure>();\r\n            newPageStructure.Id = newPageId;\r\n            newPageStructure.ParentId = parentId;\r\n            newPageStructure.LocalOrdering = localOrder;\r\n\r\n            DataFacade.AddNew(newPageStructure);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IPage AddPageAfter(this IPage newPage, Guid parentId, Guid existingPageId, bool addNewPage)\r\n        {\r\n            Verify.ArgumentNotNull(newPage, nameof(newPage));\r\n\r\n            lock (_lock)\r\n            {\r\n                PageInsertPosition.After(existingPageId).CreatePageStructure(newPage, parentId);\r\n\r\n                if (addNewPage)\r\n                {\r\n                    return DataFacade.AddNew<IPage>(newPage);\r\n                }\r\n                return newPage;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IPage> GetSubChildren(this IPage parentPage)\r\n        {\r\n            Verify.ArgumentNotNull(parentPage, nameof(parentPage));\r\n\r\n            lock (_lock)\r\n            {\r\n                foreach (IPage childPage in parentPage.GetChildren())\r\n                {\r\n                    yield return childPage;\r\n\r\n                    foreach (IPage subPage in childPage.GetSubChildren())\r\n                    {\r\n                        yield return subPage;\r\n                    }\r\n                }\r\n\r\n                if (GlobalSettingsFacade.AllowChildPagesTranslationWithoutParent)\r\n                {\r\n                    var pagesLookup = DataFacade.GetData<IPage>(true).ToLookup(p => p.Id);\r\n                    foreach (Guid emptyPageId in GetEmptyChildren(parentPage.Id, pagesLookup))\r\n                    {\r\n                        foreach (var page in GetSubChildrenInEmptyParent(emptyPageId, pagesLookup))\r\n                        {\r\n                            yield return page;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private static IEnumerable<IPage> GetSubChildrenInEmptyParent(Guid emptyParentId, ILookup<Guid, IPage> pages)\r\n        {\r\n            foreach (IPage childPage in GetChildren(emptyParentId))\r\n            {\r\n                yield return childPage;\r\n\r\n                foreach (IPage subPage in childPage.GetSubChildren())\r\n                {\r\n                    yield return subPage;\r\n                }\r\n            }\r\n\r\n            foreach (Guid emptyPageId in GetEmptyChildren(emptyParentId, pages))\r\n            {\r\n                foreach (IPage subPage in GetSubChildrenInEmptyParent(emptyPageId, pages))\r\n                {\r\n                    yield return subPage;\r\n                }\r\n\r\n            }\r\n        }\r\n\r\n        private static IQueryable<Guid> GetEmptyChildren(Guid parentId, ILookup<Guid, IPage> pages)\r\n        {\r\n            var structure = DataFacade.GetData<IPageStructure>(true);\r\n\r\n            if (structure.IsEnumerableQuery())\r\n            {\r\n                return (from ps in structure.AsEnumerable()\r\n                        where ps.ParentId == parentId && !pages[ps.Id].Any()\r\n                        select ps.Id).AsQueryable();\r\n            }\r\n\r\n            return from ps in structure\r\n                   where ps.ParentId == parentId && !pages[ps.Id].Any()\r\n                   select ps.Id;\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method will delete the pagestructure corresponding to the given page if this \r\n        /// page is the last page.\r\n        /// </summary>\r\n        /// <param name=\"page\">The page that is about to be deleted.</param>\r\n        public static void DeletePageStructure(this IPage page)\r\n        {\r\n            DeletePageStructure(page, true);\r\n        }\r\n\r\n        \r\n        internal static void DeletePageStructure(this IPage page, bool updateSiblingsOrder)\r\n        {\r\n            if (ExistsInOtherLocale(page))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var structureInfo = DataFacade.GetData<IPageStructure>(false).SingleOrDefault(f => f.Id == page.Id);\r\n            if (structureInfo == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            int localOrdering = structureInfo.LocalOrdering;\r\n            DataFacade.Delete<IPageStructure>(structureInfo);\r\n\r\n            if (!updateSiblingsOrder) return;\r\n\r\n            List<IPageStructure> siblings =\r\n                DataFacade.GetData<IPageStructure>(\r\n                    f => f.ParentId == structureInfo.ParentId && f.LocalOrdering >= localOrdering).ToList();\r\n\r\n            // If there's a page with the same local ordering - we're not changing anything\r\n            if (siblings.Count == 0\r\n                || siblings.Any(ps => ps.LocalOrdering == localOrdering))\r\n            {\r\n                return;\r\n            }\r\n\r\n            foreach (IPageStructure sibling in siblings)\r\n            {\r\n                sibling.LocalOrdering--;\r\n                DataFacade.Update(sibling);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        private static bool ExistsInOtherLocale(IPage page)\r\n        {\r\n            var otherLocales =\r\n                DataLocalizationFacade.ActiveLocalizationCultures.Except(new[] {page.DataSourceId.LocaleScope});\r\n            foreach (CultureInfo cultureInfo in otherLocales)\r\n            {\r\n                using (new DataScope(cultureInfo))\r\n                {\r\n                    bool exists = DataFacade.GetData<IPage>(f => f.Id == page.Id).Any();\r\n                    if (exists)\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a default page type id for a given page type, if available.\r\n        /// </summary>\r\n        /// <param name=\"pageTypeId\"></param>\r\n        public static Guid? GetDefaultPageTemplateId(Guid pageTypeId)\r\n        {\r\n            IPageType pageType = DataFacade.GetData<IPageType>().Single(f => f.Id == pageTypeId);\r\n\r\n            if (pageType.DefaultTemplateId != Guid.Empty)\r\n            {\r\n                return pageType.DefaultTemplateId;\r\n            }\r\n            var templateRestrictions = DataFacade.GetData<IPageTypePageTemplateRestriction>()\r\n                .Where(f => f.PageTypeId == pageTypeId);\r\n\r\n            return templateRestrictions.FirstOrDefault()?.PageTemplateId;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates page type related data for a newly created IPage, based on a given page type id.\r\n        /// Including: default placeholder content, page folders, page applications.\r\n        /// </summary>\r\n        /// <param name=\"page\"></param>\r\n        public static void AddPageTypeRelatedData(IPage page)\r\n        {\r\n            Guid pageTypeId = page.PageTypeId;\r\n\r\n            Verify.That(pageTypeId != Guid.Empty, \"PageTypeId field should not be Guid.Empty\");\r\n\r\n            // Adding default page content\r\n            IEnumerable<IPageTypeDefaultPageContent> pageTypeDefaultPageContents =\r\n                DataFacade.GetData<IPageTypeDefaultPageContent>().\r\n                    Where(f => f.PageTypeId == pageTypeId).\r\n                    Evaluate();\r\n\r\n            foreach (IPageTypeDefaultPageContent pageTypeDefaultPageContent in pageTypeDefaultPageContents)\r\n            {\r\n                IPagePlaceholderContent pagePlaceholderContent = DataFacade.BuildNew<IPagePlaceholderContent>();\r\n                pagePlaceholderContent.PageId = page.Id;\r\n                pagePlaceholderContent.VersionId = page.VersionId;\r\n                pagePlaceholderContent.PlaceHolderId = pageTypeDefaultPageContent.PlaceHolderId;\r\n                pagePlaceholderContent.Content = pageTypeDefaultPageContent.Content;\r\n                DataFacade.AddNew<IPagePlaceholderContent>(pagePlaceholderContent);\r\n            }\r\n\r\n            AddPageTypePageFoldersAndApplications(page);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Deletes the versions of the given page in its current localization scope.\r\n        /// </summary>\r\n        public static void DeletePage(IPage page)\r\n        {\r\n            DeletePage(page, true);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Deletes the versions of the given page in its current localization scope.\r\n        /// </summary>\r\n        public static void DeletePage(IPage page, bool deleteChildPages)\r\n        {\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                using (var conn = new DataConnection())\r\n                {\r\n                    conn.DisableServices();\r\n\r\n                    var cultures = DataLocalizationFacade.ActiveLocalizationCultures.ToList();\r\n                    cultures.Remove(page.DataSourceId.LocaleScope);\r\n\r\n                    if (deleteChildPages)\r\n                    {\r\n                        List<IPage> pagesToDelete = page.GetSubChildren().ToList();\r\n\r\n                        foreach (IPage childPage in pagesToDelete)\r\n                        {\r\n                            if (!ExistInOtherLocale(cultures, childPage))\r\n                            {\r\n                                RemoveAllFolderAndMetaDataDefinitions(childPage);\r\n                            }\r\n\r\n                            childPage.DeletePageStructure(false);\r\n                            ProcessControllerFacade.FullDelete(childPage);\r\n                        }\r\n                    }\r\n\r\n                    if (!ExistInOtherLocale(cultures, page))\r\n                    {\r\n                        RemoveAllFolderAndMetaDataDefinitions(page);\r\n                    }\r\n\r\n                    page.DeletePageStructure();\r\n\r\n                    Guid pageId = page.Id;\r\n                    var pageVersions = DataFacade.GetData<IPage>(p => p.Id == pageId).ToList();\r\n\r\n                    ProcessControllerFacade.FullDelete(pageVersions);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n        private static bool ExistInOtherLocale(List<CultureInfo> cultures, IPage page)\r\n        {\r\n            foreach (CultureInfo localeCultureInfo in cultures)\r\n            {\r\n                using (new DataScope(localeCultureInfo))\r\n                {\r\n                    if (Composite.Data.PageManager.GetPageById(page.Id) != null)\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n        private static void RemoveAllFolderAndMetaDataDefinitions(IPage page)\r\n        {\r\n            foreach (Type folderType in page.GetDefinedFolderTypes())\r\n            {\r\n                page.RemoveFolderDefinition(folderType, true);\r\n            }\r\n\r\n            foreach (Tuple<Type, string> metaDataTypeAndName in page.GetDefinedMetaDataTypeAndNames())\r\n            {\r\n                page.RemoveMetaDataDefinition(metaDataTypeAndName.Item2, true);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Delete the specific version of the page in the current localization scope.\r\n        /// </summary>\r\n        /// <param name=\"pageId\"></param>\r\n        /// <param name=\"versionId\"></param>\r\n        /// <param name=\"locale\"></param>\r\n        public static void DeletePage(Guid pageId, Guid versionId, CultureInfo locale)\r\n        {\r\n            DeletePage(pageId, versionId, locale, true);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Delete the specific version of the page in the current localization scope.\r\n        /// </summary>\r\n        /// <param name=\"pageId\"></param>\r\n        /// <param name=\"versionId\"></param>\r\n        /// <param name=\"locale\"></param>\r\n        /// <param name=\"deleteChildPages\"></param>\r\n        public static void DeletePage(Guid pageId, Guid versionId, CultureInfo locale, bool deleteChildPages)\r\n        {\r\n            Verify.ArgumentNotNull(locale, nameof(locale));\r\n\r\n            using (var conn = new DataConnection(PublicationScope.Unpublished, locale))\r\n            {\r\n                var pages = conn.Get<IPage>().Where(p => p.Id == pageId).ToList();\r\n                if (pages.Count == 1 && pages[0].VersionId == versionId)\r\n                {\r\n                    DeletePage(pages[0], deleteChildPages);\r\n                    return;\r\n                }\r\n            }\r\n\r\n            var publicationScopes = new[] {PublicationScope.Published, PublicationScope.Unpublished};\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                foreach (var publicationScope in publicationScopes)\r\n                {\r\n                    using (var conn = new DataConnection(publicationScope, locale))\r\n                    {\r\n                        var pageToDelete = conn.Get<IPage>()\r\n                            .SingleOrDefault(p => p.Id == pageId && p.VersionId == versionId);\r\n\r\n                        var placeholders = conn.Get<IPagePlaceholderContent>()\r\n                            .Where(p => p.PageId == pageId && p.VersionId == versionId).ToList();\r\n\r\n                        if (placeholders.Any())\r\n                        {\r\n                            DataFacade.Delete(placeholders, false, false);\r\n                        }\r\n\r\n                        if (pageToDelete != null)\r\n                        {\r\n                            // References should be retained if another version of the page exists; hence, the use of CascadeDeleteType.Disable is justified.\r\n                            DataFacade.Delete(pageToDelete, CascadeDeleteType.Disable);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n        internal static bool AddPageTypePageFoldersAndApplications(IPage page)\r\n        {\r\n#warning Validate that having a page type with associated PageType PageFolders or Applications does not break on 2nd add for same page id\r\n\r\n            Guid pageTypeId = page.PageTypeId;\r\n\r\n            bool treeRefreshindNeeded = false;\r\n\r\n            // Adding page folders\r\n            IEnumerable<IPageTypeDataFolderTypeLink> pageTypeDataFolderTypeLinks =\r\n                DataFacade.GetData<IPageTypeDataFolderTypeLink>().\r\n                    Where(f => f.PageTypeId == pageTypeId).\r\n                    Evaluate().\r\n                    RemoveDeadLinks();\r\n\r\n            foreach (IPageTypeDataFolderTypeLink pageTypeDataFolderTypeLink in pageTypeDataFolderTypeLinks)\r\n            {\r\n                page.AddFolderDefinition(pageTypeDataFolderTypeLink.DataTypeId);\r\n                treeRefreshindNeeded = true;\r\n            }\r\n\r\n\r\n            // Adding applications\r\n            IEnumerable<IPageTypeTreeLink> pageTypeTreeLinks =\r\n                DataFacade.GetData<IPageTypeTreeLink>().\r\n                    Where(f => f.PageTypeId == pageTypeId).\r\n                    Evaluate().\r\n                    RemoveDeadLinks();\r\n\r\n\r\n            var entityToken = page.GetDataEntityToken();\r\n            foreach (IPageTypeTreeLink pageTypeTreeLink in pageTypeTreeLinks)\r\n            {\r\n                var tree = TreeFacade.GetTree(pageTypeTreeLink.TreeId);\r\n                if (tree.HasAttachmentPoints(entityToken)) continue;\r\n\r\n                TreeFacade.AddPersistedAttachmentPoint(pageTypeTreeLink.TreeId, typeof(IPage), page.Id);\r\n                treeRefreshindNeeded = true;\r\n            }\r\n\r\n            return treeRefreshindNeeded;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/StoreIdFilter/Foundation/IStoreIdFilterQueryable.cs",
    "content": "using System.Linq;\r\n\r\n\r\nnamespace Composite.Data.Types.StoreIdFilter.Foundation\r\n{\r\n    internal interface IStoreIdFilterQueryable\r\n    {\r\n        IQueryable Source { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/StoreIdFilter/Foundation/StoreIdFilterQueryableCache.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Data.Types.StoreIdFilter.Foundation\r\n{\r\n    internal static class StoreIdFilterQueryableCache\r\n    {\r\n        private static Dictionary<Type, Dictionary<Type, MethodInfo>> _storeIdFilterQueryableCreateQueryCache = new Dictionary<Type, Dictionary<Type, MethodInfo>>();\r\n        private static Dictionary<Type, Dictionary<Type, MethodInfo>> _storeIdFilterQueryableExecuteMethodInfoCache = new Dictionary<Type, Dictionary<Type, MethodInfo>>();\r\n        private static Dictionary<Type, MethodInfo> _storeIdFilterQueryableGetEnumeratorMethodInfoCache = new Dictionary<Type, MethodInfo>();\r\n\r\n\r\n        static StoreIdFilterQueryableCache()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlush);\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetStoreIdFilterQueryableCreateQueryMethodInfo(Type genericType, Type expressionType)\r\n        {\r\n            Dictionary<Type, MethodInfo> methodInfoes;\r\n\r\n            if (_storeIdFilterQueryableExecuteMethodInfoCache.TryGetValue(genericType, out methodInfoes) == false)\r\n            {\r\n                methodInfoes = new Dictionary<Type, MethodInfo>();\r\n\r\n                _storeIdFilterQueryableExecuteMethodInfoCache.Add(genericType, methodInfoes);\r\n            }\r\n\r\n\r\n            MethodInfo methodInfo;\r\n\r\n            if (methodInfoes.TryGetValue(expressionType, out methodInfo) == false)\r\n            {\r\n                Type type = typeof(StoreIdFilterQueryable<>).MakeGenericType(new Type[] { genericType });\r\n\r\n                methodInfo =\r\n                    (from method in type.GetMethods()\r\n                     where method.Name == \"CreateQuery\" &&\r\n                           method.IsGenericMethod \r\n                     select method).First();\r\n\r\n                methodInfo = methodInfo.MakeGenericMethod(new Type[] { expressionType });\r\n\r\n                methodInfoes.Add(expressionType, methodInfo);\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetStoreIdFilterQueryableExecuteMethodInfo(Type genericType, Type expressionType)\r\n        {\r\n            Dictionary<Type, MethodInfo> methodInfoes;\r\n\r\n            if (_storeIdFilterQueryableExecuteMethodInfoCache.TryGetValue(genericType, out methodInfoes) == false)\r\n            {\r\n                methodInfoes = new Dictionary<Type, MethodInfo>();\r\n\r\n                _storeIdFilterQueryableExecuteMethodInfoCache.Add(genericType, methodInfoes);\r\n            }\r\n\r\n\r\n            MethodInfo methodInfo;\r\n\r\n            if (methodInfoes.TryGetValue(expressionType, out methodInfo) == false)\r\n            {\r\n                Type type = typeof(StoreIdFilterQueryable<>).MakeGenericType(new Type[] { genericType });\r\n\r\n                methodInfo =\r\n                    (from method in type.GetMethods()\r\n                     where method.Name == \"Execute\" &&\r\n                           method.IsGenericMethod \r\n                     select method).First();\r\n\r\n                methodInfo = methodInfo.MakeGenericMethod(new Type[] { expressionType });\r\n\r\n                methodInfoes.Add(expressionType, methodInfo);\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetStoreIdFilterQueryableGetEnumeratorMethodInfo(Type genericType)\r\n        {\r\n            MethodInfo methodInfo;\r\n\r\n            if (_storeIdFilterQueryableGetEnumeratorMethodInfoCache.TryGetValue(genericType, out methodInfo) == false)\r\n            {\r\n                Type type = typeof(StoreIdFilterQueryable<>).MakeGenericType(new Type[] { genericType });\r\n\r\n                methodInfo =\r\n                    (from method in type.GetMethods()\r\n                     where method.Name == \"GetEnumerator\"\r\n                     select method).First();\r\n\r\n                _storeIdFilterQueryableGetEnumeratorMethodInfoCache.Add(genericType, methodInfo);\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _storeIdFilterQueryableCreateQueryCache = new Dictionary<Type, Dictionary<Type, MethodInfo>>();\r\n            _storeIdFilterQueryableGetEnumeratorMethodInfoCache = new Dictionary<Type, MethodInfo>();\r\n            _storeIdFilterQueryableExecuteMethodInfoCache = new Dictionary<Type, Dictionary<Type, MethodInfo>>();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlush(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/StoreIdFilter/Foundation/StoreIdFilterQueryableChangeSourceExpressionVisitor.cs",
    "content": "using System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.Data.Types.StoreIdFilter.Foundation\r\n{\r\n    internal sealed class StoreIdFilterQueryableChangeSourceExpressionVisitor : ExpressionVisitor\r\n    {\r\n        private readonly Expression _newSourceExpression;\r\n\r\n\r\n        public StoreIdFilterQueryableChangeSourceExpressionVisitor()\r\n        {\r\n        }\r\n\r\n\r\n        public StoreIdFilterQueryableChangeSourceExpressionVisitor(Expression newSourceExpression)\r\n        {\r\n            _newSourceExpression = newSourceExpression;\r\n        }\r\n\r\n\r\n        protected override Expression VisitConstant(ConstantExpression c)\r\n        {\r\n            var storeIdFilterQueryable = c.Value as IStoreIdFilterQueryable;\r\n\r\n            if (storeIdFilterQueryable == null)\r\n            {\r\n                return base.VisitConstant(c);\r\n            }\r\n            \r\n            return _newSourceExpression ?? storeIdFilterQueryable.Source.Expression;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/StoreIdFilter/Foundation/StoreIdFilterQueryableExpressionVisitor.cs",
    "content": "using System;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Data.Types.StoreIdFilter.Foundation\r\n{\r\n    /// <summary>\r\n    /// Searches for a \"StoreId\" filtering in an expression tree.\r\n    /// </summary>\r\n    internal sealed class StoreIdFilterQueryableExpressionVisitor : ExpressionVisitor\r\n    {\r\n        private static readonly MemberInfo _mediaFileStoreIdMemberInfo = typeof(IMediaFile).GetMember(\"StoreId\")[0];\r\n        private static readonly MemberInfo _mediaFileFolderStoreIdMemberInfo = typeof(IMediaFileFolder).GetMember(\"StoreId\")[0];\r\n\r\n\r\n\r\n        public StoreIdFilterQueryableExpressionVisitor()\r\n        {\r\n            this.FoundStoreId = null;\r\n        }\r\n\r\n        protected override Expression VisitConstant(ConstantExpression c)\r\n        {\r\n            if (c.Value is IStorageFilter)\r\n            {\r\n                FoundStoreId = (c.Value as IStorageFilter).StoreId;\r\n            }\r\n\r\n            return base.VisitConstant(c);\r\n        }\r\n\r\n        protected override Expression VisitBinary(BinaryExpression b)\r\n        {\r\n            if (b.Method != null && b.Method.Name == \"op_Equality\")\r\n            {\r\n                bool hasStoreIdMemberExpression = IsStoreIdMemberExpression(b.Left) || IsStoreIdMemberExpression(b.Right);\r\n\r\n                if (hasStoreIdMemberExpression)\r\n                {\r\n                    string storeId = GetStoreId(b.Left) ?? GetStoreId(b.Right);\r\n\r\n                    if (storeId != null)\r\n                    {\r\n                        this.FoundStoreId = storeId;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return base.VisitBinary(b);\r\n        }\r\n\r\n\r\n\r\n        public string FoundStoreId\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        private bool IsStoreIdMemberExpression(Expression expression)\r\n        {\r\n            MemberExpression memberExpression = expression as MemberExpression;\r\n\r\n            if (memberExpression == null) return false;\r\n\r\n            if (memberExpression.Expression.Type != typeof(IMediaFile) &&\r\n                memberExpression.Expression.Type != typeof(IMediaFileFolder))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (memberExpression.Member != _mediaFileStoreIdMemberInfo &&\r\n                memberExpression.Member != _mediaFileFolderStoreIdMemberInfo)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private string GetStoreId(Expression expression)\r\n        {\r\n            if (expression is ConstantExpression)\r\n            {\r\n                var constantExpression = expression as ConstantExpression;\r\n\r\n                if (constantExpression.Value == null || constantExpression.Type != typeof (string)) return null;\r\n\r\n                return (string)constantExpression.Value;\r\n            }\r\n\r\n            if (expression is MemberExpression) \r\n            {\r\n                var memberExpression = expression as MemberExpression;\r\n\r\n                if (memberExpression.Expression.NodeType != ExpressionType.Constant) return null;\r\n\r\n                object obj = ((ConstantExpression)memberExpression.Expression).Value;\r\n\r\n                FieldInfo fieldInfo = memberExpression.Member as FieldInfo;\r\n\r\n                if (fieldInfo == null) return null;\r\n\r\n                return (string)fieldInfo.GetValue(obj);\r\n            }\r\n            \r\n            throw new InvalidOperationException(\"This line should not be reachable\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/StoreIdFilter/StoreIdFilterQueryable.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Data.Types.StoreIdFilter.Foundation;\r\n\r\n\r\nnamespace Composite.Data.Types.StoreIdFilter\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IStorageFilter \r\n    {\r\n        /// <exclude />\r\n        string StoreId { get; }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class StoreIdFilterQueryable<T> : IStoreIdFilterQueryable, IOrderedQueryable<T>, IQueryProvider, IStorageFilter\r\n    {\r\n        private readonly IQueryable<T> _originalQueryable;\r\n        private readonly string _storeId;\r\n        private readonly Expression _currentExpression;\r\n\r\n\r\n        private static readonly PropertyInfo _mediaFileStoreIdPropertyInfo = typeof(IMediaFile).GetProperty(\"StoreId\");\r\n        private static readonly PropertyInfo _mediaFileFolderStoreIdPropertyInfo = typeof(IMediaFileFolder).GetProperty(\"StoreId\");\r\n\r\n        /// <exclude />\r\n        public StoreIdFilterQueryable(IQueryable<T> originalQueryable, string storeId)\r\n        {\r\n            _originalQueryable = originalQueryable;\r\n            _storeId = storeId;\r\n            _currentExpression = Expression.Constant(this);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public StoreIdFilterQueryable(IQueryable<T> originalQueryable, string storeId, Expression currentExpression)\r\n        {\r\n            _originalQueryable = originalQueryable;\r\n            _storeId = storeId;\r\n            _currentExpression = currentExpression;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IQueryable<S> CreateQuery<S>(Expression expression)\r\n        {\r\n            var visitor = new StoreIdFilterQueryableChangeSourceExpressionVisitor();\r\n\r\n            Expression newExpression = visitor.Visit(expression);\r\n\r\n            IQueryable<S> newOriginalQueryable = _originalQueryable.Provider.CreateQuery<S>(newExpression);\r\n\r\n            return new StoreIdFilterQueryable<S>(newOriginalQueryable, _storeId, expression);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IQueryable CreateQuery(Expression expression)\r\n        {\r\n            if (_currentExpression == expression) return this;\r\n\r\n            MethodInfo methodInfo = StoreIdFilterQueryableCache.GetStoreIdFilterQueryableCreateQueryMethodInfo(typeof(T), expression.Type);\r\n\r\n            return (IQueryable)methodInfo.Invoke(this, new object[] { expression });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public S Execute<S>(Expression expression)\r\n        {\r\n            var visitor = new StoreIdFilterQueryableExpressionVisitor();\r\n\r\n            visitor.Visit(_currentExpression);\r\n\r\n            if (visitor.FoundStoreId == _storeId)\r\n            {\r\n                var sourceChangingVisitor = new StoreIdFilterQueryableChangeSourceExpressionVisitor();\r\n\r\n                Expression newExpression = sourceChangingVisitor.Visit(expression);\r\n\r\n                return _originalQueryable.Provider.Execute<S>(newExpression);\r\n            }\r\n            else\r\n            {\r\n                List<T> emptyList = new List<T>();\r\n\r\n                var sourceChangingVisitor = new StoreIdFilterQueryableChangeSourceExpressionVisitor(emptyList.AsQueryable().Expression);\r\n\r\n                Expression newExpression = sourceChangingVisitor.Visit(expression);\r\n\r\n                return emptyList.AsQueryable().Provider.Execute<S>(newExpression);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public object Execute(Expression expression)\r\n        {\r\n            MethodInfo methodInfo = StoreIdFilterQueryableCache.GetStoreIdFilterQueryableExecuteMethodInfo(typeof(T), expression.Type);\r\n\r\n            return methodInfo.Invoke(this, new object[] { expression });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerator<T> GetEnumerator()\r\n        {\r\n            var visitor = new StoreIdFilterQueryableExpressionVisitor();\r\n\r\n            visitor.Visit(_currentExpression);\r\n\r\n            if (visitor.FoundStoreId == null)\r\n            {\r\n                throw new InvalidOperationException(\"Missing storeId test found in where\");\r\n            }\r\n\r\n            if (visitor.FoundStoreId != _storeId)\r\n            {\r\n                return new List<T>().GetEnumerator();\r\n            }\r\n\r\n            return FilterByStoreId(_originalQueryable).GetEnumerator();\r\n        }\r\n\r\n\r\n        IEnumerable<T> FilterByStoreId(IEnumerable<T> enumeration)\r\n        {\r\n            foreach (T item in enumeration)\r\n            {\r\n                if (GetStoreId(item) == _storeId)\r\n                {\r\n                    yield return item;\r\n                }\r\n            }\r\n        }\r\n\r\n        static string GetStoreId(T item)\r\n        {\r\n            if (item is IMediaFile)\r\n            {\r\n                return (string) _mediaFileStoreIdPropertyInfo.GetValue(item, null);\r\n            }\r\n\r\n            if (item is IMediaFileFolder)\r\n            {\r\n                return (string)_mediaFileFolderStoreIdPropertyInfo.GetValue(item, null);\r\n            }\r\n\r\n            throw new InvalidOperationException(\"This line should not be reachable\");\r\n        }\r\n\r\n        /// <exclude />\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            MethodInfo methodInfo = StoreIdFilterQueryableCache.GetStoreIdFilterQueryableGetEnumeratorMethodInfo(typeof(T));\r\n\r\n            return (IEnumerator)methodInfo.Invoke(this, null);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Expression Expression\r\n        {\r\n            get { return _currentExpression; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Type ElementType\r\n        {\r\n            get { return typeof(T); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IQueryProvider Provider\r\n        {\r\n            get { return this; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IQueryable Source\r\n        {\r\n            get { return _originalQueryable; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string StoreId\r\n        {\r\n            get { return _storeId; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/TypeVersionAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [Obsolete(\"This is no longer used in C1. From version 3.0\", true)]\r\n    public sealed class TypeVersionAttribute : Attribute\r\n    {\r\n        /// <exclude />\r\n        public TypeVersionAttribute(int version)\r\n        {\r\n            this.Version = version;\r\n        }\r\n\r\n        /// <exclude />\r\n        public int Version { get; private set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Types/VersionedDataHelperContract.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>\r\n    /// Contract for defining IVersioned extra methods and helper functions\r\n    /// </summary>\r\n    public abstract class VersionedDataHelperContract\r\n    {\r\n        /// <summary>\r\n        /// Returns version name for the IVersioned data if it could otherwise returns null\r\n        /// </summary>\r\n        public abstract string LocalizedVersionName<T>(T data) where T : IVersioned;\r\n\r\n        /// <summary>\r\n        /// Returns currently live version name for the IVersioned data if it could otherwise returns null\r\n        /// </summary>\r\n        public abstract string GetLiveVersionName<T>(T data) where T : IVersioned;\r\n\r\n        /// <summary>\r\n        /// Returns column name and tooltip for the extra fields in publication overview, if no extra fields needed returns null\r\n        /// </summary>\r\n        public abstract List<VersionedExtraPropertiesColumnInfo> GetExtraPropertiesNames();\r\n\r\n        /// <summary>\r\n        /// Returns values for the extra fields in publication overview, if no extra fields needed returns null\r\n        /// </summary>\r\n        public abstract List<VersionedExtraProperties> GetExtraProperties<T>(T data) where T : IVersioned;\r\n\r\n        /// <summary>\r\n        /// Orders the selected data.\r\n        /// </summary>\r\n        /// <typeparam name=\"T\"></typeparam>\r\n        /// <param name=\"dataset\"></param>\r\n        /// <returns></returns>\r\n        public virtual IEnumerable<T> Order<T>(IEnumerable<T> dataset) where T : IVersioned\r\n        {\r\n            return dataset;\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// This class should be used in every versioning package to register it's naming and detecting of live versions\r\n    /// </summary>\r\n    public static class VersionedDataHelper\r\n    {\r\n        private static readonly List<VersionedDataHelperContract> _services = new List<VersionedDataHelperContract>();\r\n\r\n        static VersionedDataHelper()\r\n        {\r\n            DataEvents<IPage>.OnBeforeAdd += (sender, args) =>\r\n            {\r\n                var page = (IPage) args.Data;\r\n                if (page.VersionId == Guid.Empty)\r\n                {\r\n                    page.VersionId = Guid.NewGuid();\r\n                }\r\n            };\r\n        }\r\n\r\n        internal static void Initialize()\r\n        {\r\n            // The initialization code is in the static constructor\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns if there are any versioning package instances available\r\n        /// </summary>\r\n        public static bool IsThereAnyVersioningServices => _services.Any();\r\n\r\n        /// <summary>\r\n        /// Registers instances of versioning packages\r\n        /// </summary>\r\n        public static void RegisterVersionHelper(VersionedDataHelperContract vpc)\r\n        {\r\n            _services.Add(vpc);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns version name for the IVersioned data\r\n        /// </summary>\r\n        public static string LocalizedVersionName<T>(this T str) where T : IVersioned\r\n        {\r\n            var defaultVersionName =\r\n                Core.ResourceSystem.LocalizationFiles.Composite_Management.DefaultVersionName;\r\n\r\n            if (_services.Count == 0)\r\n            {\r\n                return defaultVersionName;\r\n            }\r\n\r\n            var versionNames = _services\r\n                .Select(p => p.LocalizedVersionName(str))\r\n                .Where(name => name != null).ToList();\r\n\r\n            return versionNames.Any() ? string.Join(\",\", versionNames) : defaultVersionName;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns column name and tooltip for the extra fields in publication overview\r\n        /// </summary>\r\n        public static IEnumerable<VersionedExtraPropertiesColumnInfo> GetExtraPropertyNames()\r\n        {\r\n            return _services?.SelectMany(p => p.GetExtraPropertiesNames() ?? Enumerable.Empty<VersionedExtraPropertiesColumnInfo>()).ToList();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns values for the extra fields in publication overview\r\n        /// </summary>\r\n        public static IEnumerable<VersionedExtraProperties> GetExtraProperties<T>(this T str) where T : IVersioned\r\n        {\r\n            return _services.SelectMany(p => p.GetExtraProperties(str) ?? Enumerable.Empty<VersionedExtraProperties>()).ToList();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns currently live version name for the IVersioned data\r\n        /// </summary>\r\n        public static string GetLiveVersionName<T>(this T data) where T : IVersioned\r\n        {\r\n            if (!_services.Any())\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var versionNames = _services.Select(p => p.GetLiveVersionName(data)).Where(name => name != null).ToList();\r\n            return versionNames.Any() ? string.Join(\",\", versionNames) : null;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Orders the data given in the dataset.\r\n        /// </summary>\r\n        /// <typeparam name=\"TDataType\">The data type.</typeparam>\r\n        /// <param name=\"dataset\">The data set to be ordered.</param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<TDataType> OrderByVersions<TDataType>(this IEnumerable<TDataType> dataset) where TDataType : IVersioned\r\n        {\r\n            if (dataset is ICollection<TDataType> collection && collection.Count < 2)\r\n            {\r\n                return collection;\r\n            }\r\n\r\n            var result = dataset;\r\n            foreach (var service in _services)\r\n            {\r\n                result = service.Order(result);\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Represents Extra fields that a Versioning package needs to insert to the publication overview\r\n    /// </summary>\r\n    public class VersionedExtraProperties\r\n    {\r\n        /// <exclude />\r\n        public string ColumnName;\r\n        /// <exclude />\r\n        public string Value;\r\n        /// <exclude />\r\n        public string SortableValue;\r\n    }\r\n\r\n    /// <summary>\r\n    /// Represents column title and tooltip for the Extra fields that a Versioning package needs to insert to the publication overview\r\n    /// </summary>\r\n    public class VersionedExtraPropertiesColumnInfo\r\n    {\r\n        /// <exclude />\r\n        public string ColumnName;\r\n        /// <exclude />\r\n        public string ColumnTooltip;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/UserTypeEnum.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <summary>    \r\n    /// Used by the <see cref=\"Composite.Data.RelevantToUserTypeAttribute\"/> attribute.\r\n    /// </summary>\r\n    public enum UserType\r\n    {\r\n        /// <summary>\r\n        /// Signals relevance to developers, making the data type visible when selecting data types in the C1 Console\r\n        /// </summary>\r\n        Developer = 1\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ClientValidationRuleFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ClientValidationRuleFacade\r\n    {\r\n        private static IClientValidationRuleFacade _implementation = new ClientValidationRuleFacadeImpl();\r\n\r\n        internal static IClientValidationRuleFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n        /// <exclude />\r\n        public static List<ClientValidationRule> GetClientValidationRules(object objectForValidation, string propertyName)\r\n        {\r\n            Verify.ArgumentNotNull(objectForValidation, \"objectForValidation\");\r\n\r\n            return _implementation.GetClientValidationRules(objectForValidation.GetType(), propertyName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static List<ClientValidationRule> GetClientValidationRules(Type type, string propertyName)\r\n        {\r\n            return _implementation.GetClientValidationRules(type, propertyName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ClientValidationRuleFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Data.Validation.Foundation;\r\nusing Composite.Data.Validation.Foundation.PluginFacades;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n    internal sealed class ClientValidationRuleFacadeImpl : IClientValidationRuleFacade\r\n    {\r\n        public List<ClientValidationRule> GetClientValidationRules(Type type, string propertyName)\r\n        {\r\n            Verify.ArgumentNotNull(type, \"type\");\r\n            Verify.ArgumentNotNullOrEmpty(propertyName, \"propertyName\");\r\n\r\n            PropertyInfo propertyInfo = type.GetProperty(propertyName);\r\n\r\n            Verify.IsNotNull(propertyInfo, \"The property named '{0}' not found on the type '{1}'\", propertyName, type);\r\n\r\n            List<ValidatorAttribute> attributes = propertyInfo.GetCustomAttributesRecursively<ValidatorAttribute>().ToList();\r\n\r\n            var rules = new List<ClientValidationRule>();\r\n            foreach (ValidatorAttribute attribute in attributes)\r\n            {\r\n                string translatorName = ClientValidationRuleTranslatorRegistry.GetTranslatorName(attribute.GetType());\r\n\r\n                if (translatorName != null)\r\n                {\r\n                    ClientValidationRule rule = ClientValidationRuleTranslatorPluginFacade.Translate(translatorName, attribute);\r\n\r\n                    rules.Add(rule);\r\n                }\r\n            }\r\n\r\n            return rules;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ClientValidationRuleSerializerHandler.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization.Formatters.Binary;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n    internal sealed class ClientValidationRuleSerializerHandler : ISerializerHandler\r\n\t{\r\n        public string Serialize(object objectToSerialize)\r\n        {            \r\n            using (MemoryStream ms = new MemoryStream())\r\n            {\r\n                BinaryFormatter binaryFormatter = new BinaryFormatter();\r\n                binaryFormatter.Serialize(ms, objectToSerialize);\r\n\r\n                ms.Seek(0, SeekOrigin.Begin);\r\n\r\n                using (BinaryReader br = new BinaryReader(ms))\r\n                {\r\n                    byte[] bytes = br.ReadBytes((int)ms.Length);\r\n\r\n                    string result = Convert.ToBase64String(bytes);\r\n\r\n                    return result;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public object Deserialize(string serializedObject)\r\n        {\r\n            byte[] bytes = Convert.FromBase64String(serializedObject);\r\n            using (MemoryStream ms = new MemoryStream(bytes))\r\n            {\r\n                BinaryFormatter binaryFormatter = new BinaryFormatter();\r\n                \r\n                object result = binaryFormatter.Deserialize(ms);\r\n\r\n                return result;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ClientValidationRules/ClientValidationRule.cs",
    "content": "using System;\r\nusing Composite.Core.Serialization;\r\n\r\nnamespace Composite.Data.Validation.ClientValidationRules\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    [SerializerHandler(typeof(ClientValidationRuleSerializerHandler))]\r\n\tpublic abstract class ClientValidationRule\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ClientValidationRules/NotNullClientValidationRule.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.ClientValidationRules\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class NotNullClientValidationRule : ClientValidationRule\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ClientValidationRules/RegexClientValidationRule.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.ClientValidationRules\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class RegexClientValidationRule : ClientValidationRule\r\n\t{\r\n        /// <exclude />\r\n        public RegexClientValidationRule(string expression)\r\n        {\r\n            this.Expression = expression;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Expression\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ClientValidationRules/StringLengthClientValidationRule.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.ClientValidationRules\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable]\r\n    public sealed class StringLengthClientValidationRule : ClientValidationRule\r\n\t{\r\n        /// <exclude />\r\n        public StringLengthClientValidationRule(int lowerBound, int upperBound)\r\n        {\r\n            this.LowerBound = lowerBound;\r\n            this.UpperBound = upperBound;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int LowerBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int UpperBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ConstructorBasedPropertyValidatorBuilder.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n    internal sealed class ConstructorBasedPropertyValidatorBuilder<T> : PropertyValidatorBuilder<T>\r\n    {\r\n        private readonly CodeAttributeDeclaration _codeAttributeDeclaration;\r\n        private readonly Attribute _attribute;\r\n\r\n\r\n        public ConstructorBasedPropertyValidatorBuilder(CodeAttributeDeclaration codeAttributeDeclaration, Attribute attribute)\r\n        {\r\n            _codeAttributeDeclaration = codeAttributeDeclaration;\r\n            _attribute = attribute;\r\n        }\r\n\r\n\r\n        public override CodeAttributeDeclaration GetCodeAttributeDeclaration()\r\n        {\r\n            return _codeAttributeDeclaration;\r\n        }\r\n\r\n\r\n        public override Attribute GetAttribute()\r\n        {\r\n            return _attribute;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/DataValidationResult.cs",
    "content": "using Composite.Data;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n\tinternal sealed class DataValidationResult\r\n\t{\r\n        internal DataValidationResult(IData data, ValidationResults validationResults)\r\n        {\r\n            this.Data = data;\r\n            this.ValidationResults = validationResults;\r\n        }\r\n\r\n\r\n        public IData Data\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        public ValidationResults ValidationResults\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        public T GetData<T>()\r\n            where T : class, IData\r\n        {\r\n            return (T)this.Data;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/DataValidationResults.cs",
    "content": "using Composite.Data;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n\tinternal sealed class DataValidationResults\r\n\t{\r\n        internal DataValidationResults()\r\n        {\r\n        }\r\n\r\n        internal void AddResult(IData data, ValidationResults validationResults)\r\n        {\r\n\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Foundation/ClientValidationRuleTranslatorRegistry.cs",
    "content": "using System;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Data.Validation.Foundation\r\n{\r\n    internal static class ClientValidationRuleTranslatorRegistry\r\n    {\r\n        private static IClientValidationRuleTranslatorRegistry _implementation = new ClientValidationRuleTranslatorRegistryImpl();\r\n\r\n        internal static IClientValidationRuleTranslatorRegistry Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        static ClientValidationRuleTranslatorRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static string GetTranslatorName(Type attributeType)\r\n        {\r\n            return _implementation.GetTranslatorName(attributeType);\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Foundation/ClientValidationRuleTranslatorRegistryImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Data.Validation.Foundation.PluginFacades;\r\nusing Composite.Data.Validation.Plugins.ClientValidationRuleTranslator;\r\nusing Composite.Data.Validation.Plugins.ClientValidationRuleTranslator.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Validation.Foundation\r\n{\r\n    internal class ClientValidationRuleTranslatorRegistryImpl : IClientValidationRuleTranslatorRegistry\r\n    {\r\n        private ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        public string GetTranslatorName(Type attributeType)\r\n        {\r\n            if (attributeType == null) throw new ArgumentNullException(\"attributeType\");\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                string name = null;\r\n\r\n                _resourceLocker.Resources.AttributeTypeToTranslatorName.TryGetValue(attributeType, out name);\r\n\r\n                return name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Dictionary<Type, string> AttributeTypeToTranslatorName { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.AttributeTypeToTranslatorName = new Dictionary<Type, string>();\r\n\r\n                if (ConfigurationServices.ConfigurationSource == null) throw new ConfigurationErrorsException(string.Format(\"No configuration source specified\"));\r\n\r\n                ClientValidationRuleTranslatorSettings settings = ConfigurationServices.ConfigurationSource.GetSection(ClientValidationRuleTranslatorSettings.SectionName) as ClientValidationRuleTranslatorSettings;\r\n                if (settings == null) throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", ClientValidationRuleTranslatorSettings.SectionName));\r\n\r\n                foreach (ClientValidationRuleTranslatorData data in settings.ClientValidationRuleTranslatorPlugins)\r\n                {\r\n                    IEnumerable<Type> types = ClientValidationRuleTranslatorPluginFacade.GetSupportedAttributeTypes(data.Name);\r\n\r\n                    foreach (Type type in types)\r\n                    {\r\n                        if (resources.AttributeTypeToTranslatorName.ContainsKey(type)) throw new InvalidOperationException(string.Format(\"The attribute type '{0}' is already handle by a nother translator\", type));\r\n                        if (typeof(ValidatorAttribute).IsAssignableFrom(type) == false) throw new InvalidOperationException(string.Format(\"The type '{0}' is not an {1}\", type, typeof(ValidatorAttribute)));\r\n\r\n                        resources.AttributeTypeToTranslatorName.Add(type, data.Name);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Foundation/IClientValidationRuleTranslatorRegistry.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.Foundation\r\n{\r\n\tinternal interface IClientValidationRuleTranslatorRegistry\r\n\t{\r\n        string GetTranslatorName(Type attributeType);\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Foundation/PluginFacades/ClientValidationRuleTranslatorPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.Data.Validation.Foundation.PluginFacades\r\n{\r\n    internal static class ClientValidationRuleTranslatorPluginFacade\r\n    {\r\n        private static IClientValidationRuleTranslatorPluginFacade _implementation = new ClientValidationRuleTranslatorPluginFacadeImpl();\r\n\r\n        internal static IClientValidationRuleTranslatorPluginFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        static ClientValidationRuleTranslatorPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Type> GetSupportedAttributeTypes(string translatorName)\r\n        {\r\n            return _implementation.GetSupportedAttributeTypes(translatorName);\r\n        }\r\n\r\n\r\n\r\n        public static ClientValidationRule Translate(string translatorName, Attribute attribute)\r\n        {\r\n            return _implementation.Translate(translatorName, attribute);\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Foundation/PluginFacades/ClientValidationRuleTranslatorPluginFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Data.Validation.Plugins.ClientValidationRuleTranslator;\r\nusing Composite.Data.Validation.Plugins.ClientValidationRuleTranslator.Runtime;\r\n\r\n\r\nnamespace Composite.Data.Validation.Foundation.PluginFacades\r\n{\r\n    internal sealed class ClientValidationRuleTranslatorPluginFacadeImpl : IClientValidationRuleTranslatorPluginFacade\r\n    {\r\n        private ResourceLocker<Resources> _resourceLocker;\r\n\r\n\r\n        public ClientValidationRuleTranslatorPluginFacadeImpl()\r\n        {\r\n            _resourceLocker = new ResourceLocker<Resources>(new Resources { Owner = this }, Resources.Initialize);\r\n        }\r\n\r\n\r\n        public IEnumerable<Type> GetSupportedAttributeTypes(string translatorName)\r\n        {\r\n            if (string.IsNullOrEmpty(translatorName)) throw new ArgumentNullException(\"translatorName\");\r\n\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    IClientValidationRuleTranslator provider = GetClientValidationRuleTranslator(translatorName);\r\n\r\n                    return provider.GetSupportedAttributeTypes();\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public ClientValidationRule Translate(string translatorName, Attribute attribute)\r\n        {\r\n            if (string.IsNullOrEmpty(translatorName)) throw new ArgumentNullException(\"translatorName\");\r\n            if (attribute == null) throw new ArgumentNullException(\"attribute\");\r\n\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    IClientValidationRuleTranslator provider = GetClientValidationRuleTranslator(translatorName);\r\n\r\n                    return provider.Translate(attribute);\r\n                }\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private IClientValidationRuleTranslator GetClientValidationRuleTranslator(string providerName)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                IClientValidationRuleTranslator provider;\r\n\r\n                if (_resourceLocker.Resources.TranslatorCache.TryGetValue(providerName, out provider) == false)\r\n                {\r\n                    try\r\n                    {\r\n                        provider = _resourceLocker.Resources.Factory.Create(providerName);\r\n\r\n                        _resourceLocker.Resources.TranslatorCache.Add(providerName, provider);\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n\r\n                return provider;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void HandleConfigurationError(Exception ex)\r\n        {\r\n            OnFlush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", ClientValidationRuleTranslatorSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public ClientValidationRuleTranslatorFactory Factory { get; set; }\r\n            public Dictionary<string, IClientValidationRuleTranslator> TranslatorCache { get; set; }\r\n            public ClientValidationRuleTranslatorPluginFacadeImpl Owner { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new ClientValidationRuleTranslatorFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    resources.Owner.HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    resources.Owner.HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.TranslatorCache = new Dictionary<string, IClientValidationRuleTranslator>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Foundation/PluginFacades/IClientValidationRuleTranslatorPluginFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.Data.Validation.Foundation.PluginFacades\r\n{\r\n\tinternal interface IClientValidationRuleTranslatorPluginFacade\r\n\t{\r\n        IEnumerable<Type> GetSupportedAttributeTypes(string translatorName);\r\n        ClientValidationRule Translate(string translatorName, Attribute attribute);\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/IClientValidationRuleFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n\tinternal interface IClientValidationRuleFacade\r\n\t{\r\n        List<ClientValidationRule> GetClientValidationRules(Type type, string propertyName);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/IPropertyValidatorBuilder.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n\tinternal interface IPropertyValidatorBuilder\r\n\t{\r\n        /// <summary>\r\n        /// This method should return a CodeAttributeDeclaration that will beused for \r\n        /// code genereting the correct attribute this class represents.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n//MRJ: Data module refac: Change this to return something else: AttributeType and List of strings for making CodeSnippitExpression\r\n        CodeAttributeDeclaration GetCodeAttributeDeclaration();\r\n\r\n\r\n        Attribute GetAttribute();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/IValidationFacade.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n\tinternal interface IValidationFacade\r\n\t{\r\n        ValidationResults Validate<T>(T data) where T : class, IData;\r\n        ValidationResults Validate(Type interfaceType, IData data);\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Plugins/ClientValidationRuleTranslator/ClientValidationRuleTranslatorData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Data.Validation.Plugins.ClientValidationRuleTranslator\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableClientValidationRuleTranslator))]\r\n    internal class ClientValidationRuleTranslatorData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Plugins/ClientValidationRuleTranslator/IClientValidationRuleTranslator.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Data.Validation.Plugins.ClientValidationRuleTranslator.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Validation.Plugins.ClientValidationRuleTranslator\r\n{\r\n    [CustomFactory(typeof(ClientValidationRuleTranslatorCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(ClientValidationRuleTranslatorDefaultNameRetriever))]\r\n\tinternal interface IClientValidationRuleTranslator\r\n\t{\r\n        IEnumerable<Type> GetSupportedAttributeTypes();\r\n\r\n        ClientValidationRule Translate(Attribute attribute);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Plugins/ClientValidationRuleTranslator/NonConfigurableClientValidationRuleTranslator.cs",
    "content": "using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Validation.Plugins.ClientValidationRuleTranslator\r\n{\r\n    [Assembler(typeof(NonConfigurableClientValidationRuleTranslatorAssembler))]\r\n    internal class NonConfigurableClientValidationRuleTranslator : ClientValidationRuleTranslatorData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableClientValidationRuleTranslatorAssembler : IAssembler<IClientValidationRuleTranslator, ClientValidationRuleTranslatorData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IClientValidationRuleTranslator Assemble(IBuilderContext context, ClientValidationRuleTranslatorData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IClientValidationRuleTranslator)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Plugins/ClientValidationRuleTranslator/Runtime/ClientValidationRuleTranslatorCustomFactory.cs",
    "content": "using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Validation.Plugins.ClientValidationRuleTranslator.Runtime\r\n{\r\n    internal sealed class ClientValidationRuleTranslatorCustomFactory : AssemblerBasedCustomFactory<IClientValidationRuleTranslator, ClientValidationRuleTranslatorData>\r\n\t{\r\n        protected override ClientValidationRuleTranslatorData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            ClientValidationRuleTranslatorSettings settings = configurationSource.GetSection(ClientValidationRuleTranslatorSettings.SectionName) as ClientValidationRuleTranslatorSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", ClientValidationRuleTranslatorSettings.SectionName));\r\n            }\r\n\r\n            return settings.ClientValidationRuleTranslatorPlugins.Get(name);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Plugins/ClientValidationRuleTranslator/Runtime/ClientValidationRuleTranslatorDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Validation.Plugins.ClientValidationRuleTranslator.Runtime\r\n{\r\n    internal sealed class ClientValidationRuleTranslatorDefaultNameRetriever : IConfigurationNameMapper\r\n\t{\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Plugins/ClientValidationRuleTranslator/Runtime/ClientValidationRuleTranslatorFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Data.Validation.Plugins.ClientValidationRuleTranslator.Runtime\r\n{\r\n    internal sealed class ClientValidationRuleTranslatorFactory : NameTypeFactoryBase<IClientValidationRuleTranslator>\r\n\t{\r\n        public ClientValidationRuleTranslatorFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Plugins/ClientValidationRuleTranslator/Runtime/ClientValidationRuleTranslatorSettings.cs",
    "content": "using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Data.Validation.Plugins.ClientValidationRuleTranslator.Runtime\r\n{\r\n    internal sealed class ClientValidationRuleTranslatorSettings : SerializableConfigurationSection\r\n\t{\r\n        public const string SectionName = \"Composite.Data.Validation.Plugins.ClientValidationRuleTranslatorConfiguration\";\r\n\r\n\r\n        private const string _clientValidationRuleTranslatorProperty = \"ClientValidationRuleTranslatorPlugins\";\r\n        [ConfigurationProperty(_clientValidationRuleTranslatorProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<ClientValidationRuleTranslatorData> ClientValidationRuleTranslatorPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<ClientValidationRuleTranslatorData>)base[_clientValidationRuleTranslatorProperty];\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/PropertyValidatorBuilder.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic abstract class PropertyValidatorBuilder<T> : IPropertyValidatorBuilder\r\n\t{\r\n        /// <summary>\r\n        /// This method should return a CodeAttributeDeclaration that will beused for \r\n        /// code generating the correct attribute this class represents.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public abstract CodeAttributeDeclaration GetCodeAttributeDeclaration();\r\n\r\n\r\n        /// <exclude />\r\n        public abstract Attribute GetAttribute();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ValidationFacade.cs",
    "content": "using System;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Events;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ValidationFacade\r\n    {\r\n        private static IValidationFacade _implementation = new ValidationFacadeImpl();\r\n\r\n        internal static IValidationFacade Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        static ValidationFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ValidationResults Validate<T>(T data)\r\n            where T : class, IData\r\n        {\r\n            return _implementation.Validate<T>(data);\r\n        }\r\n\r\n\r\n\r\n        // Overload\r\n        /// <exclude />\r\n        public static ValidationResults Validate(IData data)\r\n        {\r\n            return Validate(data.DataSourceId.InterfaceType, data);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ValidationResults Validate(Type interfaceType, IData data)\r\n        {\r\n            return _implementation.Validate(interfaceType, data);\r\n        }\r\n\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/ValidationFacadeImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Data.Validation\r\n{\r\n    internal class ValidationFacadeImpl : IValidationFacade\r\n    {\r\n        private ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n        public ValidationResults Validate<T>(T data)\r\n            where T : class, IData\r\n        {\r\n            ValidationResults validationResults = Microsoft.Practices.EnterpriseLibrary.Validation.Validation.ValidateFromAttributes<T>(data);\r\n\r\n            return validationResults;\r\n        }\r\n\r\n\r\n\r\n        public ValidationResults Validate(Type interfaceType, IData data)\r\n        {\r\n            MethodInfo methodInfo;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.MethodCache.TryGetValue(interfaceType, out methodInfo) == false)\r\n                {\r\n                    methodInfo =\r\n                        (from mi in typeof(ValidationFacade).GetMethods()\r\n                         where (mi.Name == \"Validate\") &&\r\n                               (mi.ContainsGenericParameters)\r\n                         select mi).First();\r\n\r\n                    methodInfo = methodInfo.MakeGenericMethod(new Type[] { interfaceType });\r\n\r\n                    _resourceLocker.Resources.MethodCache.Add(interfaceType, methodInfo);\r\n                }\r\n            }\r\n\r\n            ValidationResults validationResults;\r\n\r\n            try\r\n            {\r\n                validationResults = (ValidationResults)methodInfo.Invoke(null, new object[] { data });\r\n            }\r\n            catch (TargetInvocationException ex)\r\n            {\r\n                Log.LogError(\"ValidationFacade\", ex);\r\n                validationResults = new ValidationResults();\r\n                validationResults.AddResult(new ValidationResult(\"Exception thrown while validating. Please check field values.\", data, \"\", \"\", null));\r\n            }\r\n\r\n            return validationResults;\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public Dictionary<Type, MethodInfo> MethodCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.MethodCache = new Dictionary<Type, MethodInfo>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/DecimalPrecisionValidator.cs",
    "content": "﻿using System.Globalization;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing System.Collections.Generic;\r\nusing System;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    internal sealed class DecimalPrecisionValidator : Validator\r\n    {\r\n        public DecimalPrecisionValidator()\r\n            : base(\"To many digits\", \"decimal\")\r\n        {\r\n        }\r\n\r\n\r\n        protected override string DefaultMessageTemplate\r\n        {\r\n            get { return \"To many digits\"; }\r\n        }\r\n\r\n\r\n        protected override void DoValidate(object objectToValidate, object currentTarget, string key, ValidationResults validationResults)\r\n        {\r\n            if(objectToValidate == null)\r\n            {\r\n                // Skipping valudation if optional decimal is a null\r\n                return;\r\n            }\r\n\r\n            var number = (decimal)objectToValidate;\r\n\r\n            List<DecimalPrecisionValidatorAttribute> attributes = currentTarget.GetType().GetProperty(key).GetCustomAttributesRecursively<DecimalPrecisionValidatorAttribute>().ToList();\r\n            var validatiorAttribute = attributes[0];\r\n\r\n            if (number != Decimal.Round(number, validatiorAttribute.Scale))\r\n            {\r\n\r\n                LogValidationResult(validationResults, GetString(\"Validation.Decimal.SymbolsAfterPointAllowed\").FormatWith(validatiorAttribute.Scale), currentTarget, key);\r\n                return;\r\n            }\r\n\r\n            string str = number.ToString(CultureInfo.InvariantCulture);\r\n            int separatorIndex = str.IndexOf('.');\r\n            if(separatorIndex > 0)\r\n            {\r\n                str = str.Substring(0, separatorIndex);\r\n            }\r\n\r\n            if (str.StartsWith(\"-\")) str = str.Substring(1);\r\n\r\n            int allowedDigitsBeforeSeparator = validatiorAttribute.Precision - validatiorAttribute.Scale;\r\n            if (str.Length > allowedDigitsBeforeSeparator)\r\n            {\r\n                LogValidationResult(validationResults, GetString(\"Validation.Decimal.SymbolsBeforePointAllowed\").FormatWith(allowedDigitsBeforeSeparator), currentTarget, key);\r\n            }\r\n        }\r\n\r\n        private static string GetString(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Management\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/DecimalPrecisionValidatorAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class DecimalPrecisionValidatorAttribute : Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValueValidatorAttribute\r\n    {\r\n        /// <exclude />\r\n        [Obsolete(\"Use constructor that allow for both precision and scale\")]\r\n        public DecimalPrecisionValidatorAttribute(int digits)\r\n        {\r\n            this.Precision = digits + 10; // uneducated guess\r\n            this.Scale = digits;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a decimal precision validator\r\n        /// </summary>\r\n        /// <param name=\"precision\">Digits in total</param>\r\n        /// <param name=\"scale\">Digits after decimal point</param>\r\n        public DecimalPrecisionValidatorAttribute(int precision, int scale)\r\n        {\r\n            if (precision < scale) throw new ArgumentException(\"Precision cannot be less than scale\", \"precision\");\r\n\r\n            this.Precision = precision;\r\n            this.Scale = scale;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Number of digits after decimal point - normally you would call this scale.\r\n        /// </summary>\r\n        [Obsolete(\"Use 'Scale'\")]\r\n        public int Digits\r\n        {\r\n            get { return this.Scale; }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Number of digits after the separator\r\n        /// </summary>\r\n        public int Scale\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Number of digits in total\r\n        /// </summary>\r\n        public int Precision\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new DecimalPrecisionValidator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/DecimalRangeValidatorAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Validate that a decimal field has a value than falls within a minimum and maximum value. \r\n    /// </summary>    \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class DecimalRangeValidatorAttribute : Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValueValidatorAttribute\r\n    {\r\n        /// <summary>\r\n        /// Validator rule for data type properties.\r\n        /// Validate that a decimal field has a value than falls within a minimum and maximum value. \r\n        /// </summary>    \r\n        public DecimalRangeValidatorAttribute(decimal lowerBound, decimal upperBound)\r\n        {\r\n            this.LowerBound = lowerBound;\r\n            this.UpperBound = upperBound;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public decimal LowerBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public decimal UpperBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeValidator<decimal>(\r\n                this.LowerBound,\r\n                Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeBoundaryType.Inclusive,\r\n                this.UpperBound,\r\n                Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeBoundaryType.Inclusive);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/GuidNotEmptyAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Validate that a Guid is not Guid.Empty. \r\n    /// </summary>    \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class GuidNotEmptyAttribute : Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValueValidatorAttribute\r\n\t{\r\n        /// <summary>\r\n        /// Validator rule for data type properties.\r\n        /// Validate that a Guid is not Guid.Empty. \r\n        /// </summary>    \r\n        public GuidNotEmptyAttribute()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new GuidNotEmptyValidator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/GuidNotEmptyValidator.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    internal class GuidNotEmptyValidator : Validator\r\n\t{\r\n        public GuidNotEmptyValidator()\r\n            : base(\"Empty guid value not allowed\", \"value\")\r\n        {\r\n        }\r\n\r\n\r\n        protected override string DefaultMessageTemplate\r\n        {\r\n            get { return \"Empty guid value not allowed\"; }\r\n        }\r\n\r\n\r\n        protected override void DoValidate(object objectToValidate, object currentTarget, string key, ValidationResults validationResults)\r\n        {\r\n            Guid guid = (Guid)objectToValidate;\r\n\r\n            if (guid == Guid.Empty)\r\n            {\r\n                LogValidationResult(validationResults, \"Empty value not allowed\", currentTarget, key);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/IntegerRangeValidatorAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Validate that an integer has a value than falls within a minimum and maximum value. \r\n    /// </summary>    \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class IntegerRangeValidatorAttribute : Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValueValidatorAttribute\r\n    {\r\n        /// <summary>\r\n        /// Validator rule for data type properties.\r\n        /// Validate that an integer has a value than falls within a minimum and maximum value. \r\n        /// </summary>    \r\n        public IntegerRangeValidatorAttribute(int lowerBound, int upperBound)\r\n        {\r\n            this.LowerBound = lowerBound;\r\n            this.UpperBound = upperBound;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int LowerBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int UpperBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeValidator<int>(\r\n                this.LowerBound,\r\n                Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeBoundaryType.Inclusive,\r\n                this.UpperBound,\r\n                Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeBoundaryType.Inclusive);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/LazyFunctionProviedPropertyAttribute.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Functions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// This is for internal use only! It is a work around to function providing\r\n    /// a IPropertyValidatorBuilder that provides CodeDOM when the data type\r\n    /// interface is code generated. This means that the functions should\r\n    /// be loaded BEFORE the interface is code generated, which is bad architecture.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public class LazyFunctionProviedPropertyAttribute : ValueValidatorAttribute\r\n    {\r\n        private static MethodInfo _doCreateValidatorMethodInfo;\r\n        private string FunctionMarkup { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"functionMarkup\"></param>\r\n        /// <exclude />\r\n        public LazyFunctionProviedPropertyAttribute(string functionMarkup)\r\n        {\r\n            FunctionMarkup = functionMarkup;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"targetType\"></param>\r\n        /// <returns></returns>\r\n        /// <exclude />\r\n        protected override Validator DoCreateValidator(Type targetType)\r\n        {\r\n            try\r\n            {\r\n                BaseRuntimeTreeNode node = FunctionFacade.BuildTree(XElement.Parse(FunctionMarkup));\r\n                \r\n                IPropertyValidatorBuilder propertyValidatorBuilder = node.GetValue<IPropertyValidatorBuilder>();\r\n\r\n                ValidatorAttribute validatorAttribute = (ValidatorAttribute)propertyValidatorBuilder.GetAttribute();\r\n\r\n                Validator validator = (Validator)DoCreateValidatorMethodInfo.Invoke(validatorAttribute, new object[] { targetType });\r\n\r\n                return validator;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                string message = string.Format(\"Validator function markup parse / execution failed with the following error: '{0}'. The validator attribute is dropped.\", ex.Message);\r\n                Log.LogError(\"LazyFunctionProviedPropertyAttribute\", message);\r\n            }\r\n\r\n            return new LazyFunctionProviedPropertyValidator();\r\n        }\r\n\r\n\r\n\r\n        private static MethodInfo DoCreateValidatorMethodInfo\r\n        {\r\n            get\r\n            {\r\n                if (_doCreateValidatorMethodInfo == null)\r\n                {\r\n                    _doCreateValidatorMethodInfo = \r\n                        typeof(ValidatorAttribute).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance).\r\n                        Where(f => f.Name == \"DoCreateValidator\" && f.GetParameters().Length == 1).\r\n                        Single();\r\n                }\r\n\r\n                return _doCreateValidatorMethodInfo;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/LazyFunctionProviedPropertyValidator.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    internal class LazyFunctionProviedPropertyValidator : Validator\r\n    {\r\n        public LazyFunctionProviedPropertyValidator()\r\n            : base(\"\", \"\")\r\n        {                    \r\n        }\r\n\r\n\r\n        protected override string DefaultMessageTemplate\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n        protected override void DoValidate(object objectToValidate, object currentTarget, string key, ValidationResults validationResults)\r\n        {            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/NullDateTimeRangeValidatorAttribute.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Validate that a Nullable&lt;DateTime&gt; - when not null - has a value than falls within a minimum and maximum value. \r\n    /// </summary>    \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class NullDateTimeRangeValidatorAttribute : ValueValidatorAttribute\r\n    {\r\n        private readonly DateTime _lowerBound;\r\n        private readonly DateTime _upperBound;\r\n        private readonly RangeBoundaryType _upperBoundType;\r\n        private readonly RangeBoundaryType _lowerBoundType;\r\n\r\n\r\n        /// <exclude />\r\n        public NullDateTimeRangeValidatorAttribute(string upperBound)\r\n            : this(ConvertToISO8601Date(upperBound))\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public NullDateTimeRangeValidatorAttribute(DateTime upperBound)\r\n            : this(DateTime.MinValue, RangeBoundaryType.Ignore, upperBound, RangeBoundaryType.Inclusive)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public NullDateTimeRangeValidatorAttribute(string lowerBound, string upperBound)\r\n            : this(ConvertToISO8601Date(lowerBound), ConvertToISO8601Date(upperBound))\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public NullDateTimeRangeValidatorAttribute(DateTime lowerBound, DateTime upperBound)\r\n            : this(lowerBound, RangeBoundaryType.Inclusive, upperBound, RangeBoundaryType.Inclusive)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public NullDateTimeRangeValidatorAttribute(string lowerBound, RangeBoundaryType lowerBoundType, string upperBound, RangeBoundaryType upperBoundType)\r\n            : this(ConvertToISO8601Date(lowerBound), lowerBoundType, ConvertToISO8601Date(upperBound), upperBoundType)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public NullDateTimeRangeValidatorAttribute(DateTime lowerBound, RangeBoundaryType lowerBoundType, DateTime upperBound, RangeBoundaryType upperBoundType)\r\n        {\r\n            _lowerBound = lowerBound;\r\n            _lowerBoundType = lowerBoundType;\r\n            _upperBound = upperBound;\r\n            _upperBoundType = upperBoundType;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new NullableDateTimeRangeValidator(new RangeValidator<DateTime>(\r\n                _lowerBound, _lowerBoundType,\r\n                _upperBound, _upperBoundType));\r\n        }\r\n\r\n        private static DateTime ConvertToISO8601Date(string iso8601DateString)\r\n        {\r\n            if (string.IsNullOrEmpty(iso8601DateString))\r\n            {\r\n                return new DateTime();\r\n            }\r\n\r\n            return DateTime.ParseExact(iso8601DateString, \"s\", CultureInfo.InvariantCulture);\r\n        }\r\n\r\n\r\n        private class NullableDateTimeRangeValidator : Validator<DateTime?>\r\n        {\r\n            private readonly RangeValidator<DateTime> _innerValidator;\r\n\r\n            public NullableDateTimeRangeValidator(RangeValidator<DateTime> innerValidator)\r\n                : base(null, null)\r\n            {\r\n                _innerValidator = innerValidator;\r\n            }\r\n\r\n            protected override string DefaultMessageTemplate\r\n            {\r\n                get { return _innerValidator.MessageTemplate; }\r\n            }\r\n\r\n            protected override void DoValidate(DateTime? objectToValidate, object currentTarget, string key, ValidationResults validationResults)\r\n            {\r\n                if (objectToValidate == null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                validationResults.AddAllResults(_innerValidator.Validate(objectToValidate.Value));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/NullDecimalRangeValidatorAttribute.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Validate that an nullable decimal - when not null - has a value than falls within a minimum and maximum value. \r\n    /// </summary>    \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class NullDecimalRangeValidatorAttribute : ValueValidatorAttribute\r\n    {\r\n        /// <summary>\r\n        /// Validator rule for data type properties.\r\n        /// Validate that an nullable decimal - when not null - has a value than falls within a minimum and maximum value. \r\n        /// </summary>    \r\n        public NullDecimalRangeValidatorAttribute(decimal lowerBound, decimal upperBound)\r\n        {\r\n            this.LowerBound = lowerBound;\r\n            this.UpperBound = upperBound;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public decimal LowerBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public decimal UpperBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new NullableDecimalRangeValidator(new RangeValidator<decimal>(\r\n                this.LowerBound, RangeBoundaryType.Inclusive,\r\n                this.UpperBound, RangeBoundaryType.Inclusive));\r\n        }\r\n\r\n        private class NullableDecimalRangeValidator : Validator<decimal?>\r\n        {\r\n            private readonly RangeValidator<decimal> _innerValidator;\r\n\r\n            public NullableDecimalRangeValidator(RangeValidator<decimal> innerValidator)\r\n                : base(null, null)\r\n            {\r\n                _innerValidator = innerValidator;\r\n            }\r\n\r\n            protected override string DefaultMessageTemplate\r\n            {\r\n                get { return _innerValidator.MessageTemplate; }\r\n            }\r\n\r\n            protected override void DoValidate(decimal? objectToValidate, object currentTarget, string key, ValidationResults validationResults)\r\n            {\r\n                if (objectToValidate == null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                validationResults.AddAllResults(_innerValidator.Validate(objectToValidate.Value));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/NullIntegerRangeValidatorAttribute.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Validate that an nullable integer - when not null - has a value than falls within a minimum and maximum value. \r\n    /// </summary>    \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class NullIntegerRangeValidatorAttribute : ValueValidatorAttribute\r\n    {\r\n        /// <summary>\r\n        /// Validator rule for data type properties.\r\n        /// Validate that an nullable integer - when not null - has a value than falls within a minimum and maximum value. \r\n        /// </summary>    \r\n        public NullIntegerRangeValidatorAttribute(int lowerBound, int upperBound)\r\n        {\r\n            this.LowerBound = lowerBound;\r\n            this.UpperBound = upperBound;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int LowerBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int UpperBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new NullableIntRangeValidator(new RangeValidator<int>(\r\n                this.LowerBound, RangeBoundaryType.Inclusive,\r\n                this.UpperBound, RangeBoundaryType.Inclusive));\r\n        }\r\n\r\n        private class NullableIntRangeValidator : Validator<int?>\r\n        {\r\n            private readonly RangeValidator<int> _innerValidator;\r\n\r\n            public NullableIntRangeValidator(RangeValidator<int> innerValidator)\r\n                : base(null, null)\r\n            {\r\n                _innerValidator = innerValidator;\r\n            }\r\n\r\n            protected override string DefaultMessageTemplate\r\n            {\r\n                get { return _innerValidator.MessageTemplate; }\r\n            }\r\n\r\n            protected override void DoValidate(int? objectToValidate, object currentTarget, string key, ValidationResults validationResults)\r\n            {\r\n                if (objectToValidate == null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                validationResults.AddAllResults(_innerValidator.Validate(objectToValidate.Value));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/NullStringLengthValidator.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    internal sealed class NullStringLengthValidator : Validator\r\n    {\r\n        private int _lowerBound;\r\n        private int _upperBound;\r\n\r\n\r\n        public NullStringLengthValidator(int lowerBound, int upperBound)\r\n            : base(\"The string is either too long or too short\", \"string\")\r\n        {\r\n            _lowerBound = lowerBound;\r\n            _upperBound = upperBound;\r\n        }        \r\n\r\n\r\n        protected override string DefaultMessageTemplate\r\n        {\r\n            get { return \"The string is either too long or too short\"; }\r\n        }\r\n\r\n\r\n        protected override void DoValidate(object objectToValidate, object currentTarget, string key, ValidationResults validationResults)\r\n        {\r\n            if (objectToValidate != null)\r\n            {\r\n                string theString = (string)objectToValidate;\r\n\r\n                if ((theString.Length < _lowerBound) ||\r\n                    (theString.Length > _upperBound))\r\n                {\r\n                    LogValidationResult(validationResults, string.Format(\"The length of the string should be in the range {0} to {1} or null\", _lowerBound, _upperBound), currentTarget, key);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/NullStringLengthValidatorAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Validate that a string - when not null - has a length than falls within a minimum and maximum length. \r\n    /// </summary>    \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class NullStringLengthValidatorAttribute : Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValueValidatorAttribute\r\n\t{\r\n        /// <summary>\r\n        /// Validator rule for data type properties.\r\n        /// Validate that a string - when not null - has a length than falls within a minimum and maximum length. \r\n        /// </summary>    \r\n        public NullStringLengthValidatorAttribute(int lowerBound, int upperBound)\r\n        {\r\n            this.LowerBound = lowerBound;\r\n            this.UpperBound = upperBound;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int LowerBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int UpperBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new NullStringLengthValidator(this.LowerBound, this.UpperBound);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/PasswordValidator.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    [Obsolete(\"No longer used\")]\r\n    internal class PasswordValidator : Validator\r\n\t{\r\n        public PasswordValidator()\r\n            : base(\"The password is not good enough\", \"password\")\r\n        {\r\n        }\r\n\r\n\r\n        protected override string DefaultMessageTemplate\r\n        {\r\n            get { return \"The password is not good enough\"; }\r\n        }\r\n\r\n\r\n        protected override void DoValidate(object objectToValidate, object currentTarget, string key, ValidationResults validationResults)\r\n        {\r\n            string password = objectToValidate as string;\r\n\r\n            if (password != null)\r\n            {\r\n                if (password.Length < 6)\r\n                {\r\n                    LogValidationResult(validationResults, \"The password should have a minimum length of 6\", currentTarget, key);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/PasswordValidatorAttribute.cs",
    "content": "using System;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class PasswordValidatorAttribute : Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValueValidatorAttribute\r\n\t{\r\n        /// <exclude />\r\n        public PasswordValidatorAttribute()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new PasswordValidator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/RegexValidatorAttribute.cs",
    "content": "using System;\r\nusing System.Text.RegularExpressions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Represents a <see cref=\"RegexValidator\"/>.\r\n    /// </summary>    \r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class RegexValidatorAttribute : Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValueValidatorAttribute\r\n    {\r\n        /// <summary>\r\n        /// Validator rule for data type properties.\r\n        /// Represents a <see cref=\"RegexValidator\"/>.\r\n        /// </summary>    \r\n        public RegexValidatorAttribute(string pattern)\r\n        {\r\n            this.Pattern = pattern;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Pattern\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            return new Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RegexValidator(\r\n                this.Pattern,\r\n                null,\r\n                null, \r\n                RegexOptions.None,\r\n                this.MessageTemplate,\r\n                Negated);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/StringLengthValidatorAttribute.cs",
    "content": "using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Obsolete]\r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class StringLengthValidatorAttribute : ValueValidatorAttribute\r\n\t{\r\n        /// <exclude />\r\n        public StringLengthValidatorAttribute(int lowerBound, int upperBound)\r\n        {\r\n            this.LowerBound = lowerBound;\r\n            this.UpperBound = upperBound;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int LowerBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int UpperBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            int lowerBound = Math.Min(LowerBound, UpperBound);\r\n            int upperBound = Math.Max(LowerBound, UpperBound);\r\n\r\n            return new StringLengthValidator(\r\n                lowerBound, RangeBoundaryType.Inclusive,\r\n                upperBound, RangeBoundaryType.Inclusive,\r\n\t\t\t\tNegated);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/Validation/Validators/StringSizeValidatorAttribute.cs",
    "content": "using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Data.Validation.Validators\r\n{\r\n    /// <summary>\r\n    /// Validator rule for data type properties.\r\n    /// Validate that a string has a length than falls within a minimum and maximum length. \r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]\r\n    public sealed class StringSizeValidatorAttribute : ValueValidatorAttribute\r\n\t{\r\n        /// <summary>\r\n        /// Validator rule for data type properties.\r\n        /// Validate that a string has a length than falls within a minimum and maximum length. \r\n        /// </summary>\r\n        /// <param name=\"lowerBound\">minimum</param>\r\n        /// <param name=\"upperBound\">maximum</param>\r\n        public StringSizeValidatorAttribute(int lowerBound, int upperBound)\r\n        {\r\n            this.LowerBound = lowerBound;\r\n            this.UpperBound = upperBound;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int LowerBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public int UpperBound\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override Microsoft.Practices.EnterpriseLibrary.Validation.Validator DoCreateValidator(Type targetType)\r\n        {\r\n            int lowerBound = Math.Min(LowerBound, UpperBound);\r\n            int upperBound = Math.Max(LowerBound, UpperBound);\r\n\r\n            return new StringLengthValidator(\r\n                lowerBound, RangeBoundaryType.Inclusive,\r\n                upperBound, RangeBoundaryType.Inclusive,\r\n\t\t\t\tNegated);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Data/VersionKeyPropertyName.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Data\r\n{\r\n    /// <exclude />\r\n    [AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]\r\n    public sealed class VersionKeyPropertyNameAttribute : Attribute\r\n    {\r\n        /// <exclude />\r\n        public VersionKeyPropertyNameAttribute(string propertyName)\r\n        {\r\n            this.VersionKeyPropertyName = propertyName;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string VersionKeyPropertyName { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/AttributeBasedRoutedDataUrlMapper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    internal class AttributeBasedRoutedDataUrlMapper : IRoutedDataUrlMapper\r\n    {\r\n        private readonly Guid _pageId;\r\n        private readonly Type _dataType;\r\n        private static readonly MethodInfo _getFilteredDataMethodInfo;\r\n        private static readonly MethodInfo _getFilteredDataQueryableMethodInfo;\r\n        private readonly IRelativeRouteToPredicateMapper _mapper;\r\n\r\n        static AttributeBasedRoutedDataUrlMapper()\r\n        {\r\n            _getFilteredDataMethodInfo = StaticReflection.GetGenericMethodInfo(() => GetFilteredData<IData>(null));\r\n            _getFilteredDataQueryableMethodInfo =\r\n                StaticReflection.GetGenericMethodInfo(a => GetFilteredDataQueryable<IPageRelatedData>(Guid.Empty));\r\n        }\r\n\r\n        protected AttributeBasedRoutedDataUrlMapper(Type dataType, Guid pageId, IRelativeRouteToPredicateMapper mapper)\r\n        {\r\n            _pageId = pageId;\r\n            _mapper = mapper;\r\n            _dataType = dataType;\r\n        }\r\n\r\n\r\n\r\n        public static AttributeBasedRoutedDataUrlMapper GetDataUrlMapper(Type dataType, Guid pageId)\r\n        {\r\n            var mapper = AttributeBasedRoutingHelper.GetPredicateMapper(dataType);\r\n            if (mapper == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new AttributeBasedRoutedDataUrlMapper(dataType, pageId, mapper);\r\n        }\r\n\r\n        public RoutedDataModel GetRouteDataModel(PageUrlData pageUrlData)\r\n        {\r\n            if (pageUrlData.PageId != _pageId) return null;\r\n\r\n            string pathInfo = pageUrlData.PathInfo;\r\n            bool pathIsEmpty = string.IsNullOrEmpty(pathInfo);\r\n\r\n            int pathInfoSegmentsExpected = _mapper.PathSegmentsCount;\r\n\r\n            if (pathIsEmpty && (pathInfoSegmentsExpected > 0 || !pageUrlData.HasQueryParameters))\r\n            {\r\n                return new RoutedDataModel(GetDataQueryable);\r\n            }\r\n\r\n            if (pathIsEmpty != (pathInfoSegmentsExpected == 0))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string[] segments = !pathIsEmpty\r\n                ? pathInfo.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries)\r\n                : Array.Empty<string>();\r\n\r\n            if (segments.Length != pathInfoSegmentsExpected)\r\n            {\r\n                return null;\r\n            }\r\n\r\n\r\n            var relativeRoute = new RelativeRoute\r\n            {\r\n                PathSegments = segments,\r\n                QueryString = pageUrlData.QueryParameters\r\n            };\r\n\r\n            var valueProvider = _mapper as AttributeBasedRoutingHelper.IRelativeRouteResover;\r\n            if (valueProvider != null)\r\n            {\r\n                var data = valueProvider.TryGetData(pageUrlData.PageId, relativeRoute);\r\n                return data != null ? new RoutedDataModel(data) : null;\r\n            }\r\n\r\n            var filterExpression = GetPredicate(_pageId, relativeRoute);\r\n            if (filterExpression == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var dataSet = (IReadOnlyCollection<IData>) _getFilteredDataMethodInfo.MakeGenericMethod(_dataType)\r\n                .Invoke(null, new object[] {filterExpression});\r\n\r\n            if (dataSet.Count == 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (dataSet.Count > 1)\r\n            {\r\n                throw new DataUrlCollisionException(_dataType, relativeRoute);\r\n            }\r\n            \r\n\r\n            return new RoutedDataModel(dataSet.First());\r\n        }\r\n\r\n        private IQueryable GetDataQueryable()\r\n        {\r\n            IQueryable unorderedQuery;\r\n\r\n            if (typeof (IPageRelatedData).IsAssignableFrom(_dataType))\r\n            {\r\n                unorderedQuery = (IQueryable)_getFilteredDataQueryableMethodInfo.MakeGenericMethod(_dataType)\r\n                                                                                .Invoke(null, new object[] {_pageId});\r\n            }\r\n            else\r\n            {\r\n                unorderedQuery = DataFacade.GetData(_dataType);\r\n            }\r\n\r\n            return DataGroupingProviderHelper.OrderData(unorderedQuery, _dataType);\r\n        }\r\n\r\n        private static IQueryable GetFilteredDataQueryable<TDataType>(Guid pageId) where TDataType: class, IPageRelatedData\r\n        {\r\n            return DataFacade.GetData<TDataType>().Where(data => data.PageId == pageId);\r\n        }\r\n\r\n        private static IReadOnlyCollection<IData> GetFilteredData<T>(Expression<Func<T, bool>> lambdaExpression)\r\n            where T : class, IData\r\n        {\r\n            return DataFacade.GetData<T>().Where(lambdaExpression).Take(2).ToList();\r\n        }\r\n\r\n        public PageUrlData BuildItemUrl(IData item)\r\n        {\r\n            var page = PageManager.GetPageById(_pageId);\r\n            if (page == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var route = GetRoute(item);\r\n            if (route == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string pathInfo = route.PathSegments.Any() ? \"/\" + string.Join(\"/\", route.PathSegments) : null;\r\n\r\n            if (pathInfo == null && (route.QueryString == null || route.QueryString.Count == 0))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new PageUrlData(page)\r\n            {\r\n                PathInfo = pathInfo,\r\n                QueryParameters = route.QueryString\r\n            };\r\n        }\r\n\r\n        private RelativeRoute GetRoute(IData data)\r\n        {\r\n            var @interface = typeof(IRelativeRouteToPredicateMapper<>).MakeGenericType(_dataType);\r\n            return @interface.GetMethod(\"GetRoute\").Invoke(_mapper, new object[] { data, true }) as RelativeRoute;\r\n        }\r\n\r\n\r\n        private Expression GetPredicate(Guid pageId, RelativeRoute relativeRoute)\r\n        {\r\n            var @interface = typeof (IRelativeRouteToPredicateMapper<>).MakeGenericType(_dataType);\r\n            return @interface.GetMethod(\"GetPredicate\").Invoke(_mapper, new object[] {pageId, relativeRoute}) as Expression;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/BaseFunctionRuntimeTreeNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class BaseFunctionRuntimeTreeNode : BaseRuntimeTreeNode\r\n    {\r\n        /// <exclude />\r\n        protected List<BaseParameterRuntimeTreeNode> Parameters { get; set; }\r\n\r\n        /// <exclude />\r\n        public void SetParameter(BaseParameterRuntimeTreeNode parameterRuntimeTreeNode)\r\n        {\r\n            if (parameterRuntimeTreeNode == null) throw new ArgumentNullException(\"parameterRuntimeTreeNode\");\r\n\r\n            BaseParameterRuntimeTreeNode node = this.Parameters.Find(n => n.Name == parameterRuntimeTreeNode.Name);\r\n\r\n            if (node != null)\r\n            {\r\n                this.Parameters.Remove(node);\r\n            }\r\n\r\n            this.Parameters.Add(parameterRuntimeTreeNode);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void RemoveParameter(string parameterName)\r\n        {\r\n            if (string.IsNullOrEmpty(parameterName)) throw new ArgumentException(\"parameterName can not be null or an empty string\");\r\n\r\n            BaseParameterRuntimeTreeNode toRemove = this.Parameters.Where(f => f.Name == parameterName).FirstOrDefault();\r\n\r\n            if (toRemove != null)\r\n            {\r\n                this.Parameters.Remove(toRemove);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns information about parameters that have been set.\r\n        /// </summary>\r\n        public IEnumerable<BaseParameterRuntimeTreeNode> GetSetParameters()\r\n        {\r\n            return this.Parameters;\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool ContainsNestedFunctions\r\n        {\r\n            get\r\n            {\r\n                foreach (var parameter in this.Parameters)\r\n                {\r\n\r\n                    if (parameter.GetAllSubFunctionNames().Count() > 0)\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        abstract protected IMetaFunction HostedFunction { get; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the composite name of the hosted function\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public string GetCompositeName()\r\n        {\r\n            return this.HostedFunction.CompositeName();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the name (without namespace) of the hosted function\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public string GetName()\r\n        {\r\n            return this.HostedFunction.Name;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the namespace of the hosted function\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public string GetNamespace()\r\n        {\r\n            return this.HostedFunction.Namespace;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Returns the description of the hosted function\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public string GetDescription()\r\n        {\r\n            return this.HostedFunction.Description;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected void ValidateNotSelfCalling()\r\n        {\r\n            var function = HostedFunction;\r\n            if (function is ICompoundFunction\r\n                && (function as ICompoundFunction).AllowRecursiveCall)\r\n            {\r\n                return;\r\n            }\r\n\r\n            string functionName = GetCompositeName();\r\n\r\n            foreach (BaseParameterRuntimeTreeNode parameterRuntimeTreeNode in Parameters)\r\n            {\r\n                if (IsSelfCalling(functionName, parameterRuntimeTreeNode))\r\n                {\r\n                    throw new InvalidOperationException(\"The function '{0}' is calling itself. A function should implement '{1}' interface in order not to be affected by that limitation.\"\r\n                        .FormatWith(functionName, typeof(ICompoundFunction).FullName));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static bool IsSelfCalling(string functionName, BaseRuntimeTreeNode runtimeTreeNode)\r\n        {            \r\n            if (runtimeTreeNode is FunctionParameterRuntimeTreeNode)\r\n            {\r\n                FunctionParameterRuntimeTreeNode functionParameterRuntimeTreeNode = runtimeTreeNode as FunctionParameterRuntimeTreeNode;\r\n\r\n                if (functionParameterRuntimeTreeNode.GetHostedFunction().GetCompositeName() == functionName)\r\n                {\r\n                    return true;\r\n                }\r\n                return IsSelfCalling(functionName, functionParameterRuntimeTreeNode.GetHostedFunction());\r\n            }\r\n\r\n            if (runtimeTreeNode is BaseFunctionRuntimeTreeNode)\r\n            {\r\n                BaseFunctionRuntimeTreeNode functionRuntimeTreeNode = runtimeTreeNode as BaseFunctionRuntimeTreeNode;\r\n\r\n                if (functionName == functionRuntimeTreeNode.GetCompositeName())\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                foreach (BaseParameterRuntimeTreeNode parameterRuntimeTreeNode in functionRuntimeTreeNode.Parameters)\r\n                {\r\n                    if (IsSelfCalling(functionName, parameterRuntimeTreeNode))\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n\r\n                return false;\r\n            }\r\n\r\n            return false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/BaseParameterRuntimeTreeNode.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class BaseParameterRuntimeTreeNode : BaseRuntimeTreeNode\r\n    {\r\n        /// <exclude />\r\n        protected BaseParameterRuntimeTreeNode(string name)\r\n        {\r\n            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(\"name\");\r\n\r\n            this.Name = name;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Name\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/BaseRuntimeTreeNode.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class BaseRuntimeTreeNode\r\n    {\r\n        internal BaseRuntimeTreeNode() { }\r\n\r\n        /// <exclude />\r\n        public object GetValue()\r\n        {\r\n            FunctionContextContainer internalContextContainer = new FunctionContextContainer();\r\n            return GetValue(internalContextContainer);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public abstract object GetValue(FunctionContextContainer contextContainer);\r\n\r\n\r\n        /// <exclude />\r\n        public T GetValue<T>()\r\n        {\r\n            FunctionContextContainer internalContextContainer = new FunctionContextContainer();\r\n            return GetValue<T>(internalContextContainer);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public virtual object GetValue(FunctionContextContainer contextContainer, Type type)\r\n        {\r\n            Verify.ArgumentNotNull(contextContainer, \"contextContainer\");\r\n\r\n            object value = this.GetValue(contextContainer);\r\n\r\n            if (value == null || type.IsInstanceOfType(value))\r\n            {\r\n                return value;\r\n            }\r\n            \r\n            return ValueTypeConverter.Convert(value, type);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public T GetValue<T>(FunctionContextContainer contextContainer)\r\n        {\r\n            return (T) GetValue(contextContainer, typeof(T));\r\n        }\r\n\r\n        /// <exclude />\r\n        public object GetCachedValue()\r\n        {\r\n            FunctionContextContainer internalContextContainer = new FunctionContextContainer();\r\n            return GetValue(internalContextContainer);\r\n        }\r\n\r\n        /// <exclude />\r\n        public abstract IEnumerable<string> GetAllSubFunctionNames();\r\n\r\n        /// <exclude />\r\n        public abstract bool ContainsNestedFunctions { get; }\r\n\r\n        /// <exclude />\r\n        public abstract XElement Serialize();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/BaseRuntimeTreeNodeValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    internal sealed class BaseRuntimeTreeNodeValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n\r\n            serializedObject = null;\r\n\r\n            if (typeof(BaseRuntimeTreeNode).IsAssignableFrom(objectToSerializeType))\r\n            {\r\n                serializedObject = new XElement(\"BaseRuntimeTreeNode\");\r\n\r\n                if (objectToSerialize != null)\r\n                {\r\n                    BaseRuntimeTreeNode baseRuntimeTreeNode = objectToSerialize as BaseRuntimeTreeNode;\r\n\r\n                    serializedObject.Add(new XElement(\"Value\", baseRuntimeTreeNode.Serialize()));\r\n                }\r\n\r\n                return true;\r\n            }\r\n            else\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject.Name.LocalName != \"BaseRuntimeTreeNode\") return false;\r\n\r\n            XElement valueElement = serializedObject.Element(\"Value\");\r\n            if (valueElement != null)\r\n            {\r\n                if (valueElement.Elements().Count() != 1) return false;\r\n\r\n                deserializedObject = FunctionFacade.BuildTree(valueElement.Elements().Single());\r\n            }\r\n\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/BaseValueProvider.cs",
    "content": "using System.Xml.Linq;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public abstract class BaseValueProvider\r\n    {\r\n        /// <exclude />\r\n        public BaseValueProvider() { }\r\n\r\n        /// <exclude />\r\n        public object GetValue()\r\n        {\r\n            var internalContextContainer = new FunctionContextContainer();\r\n\r\n            return GetValue(internalContextContainer);\r\n        }\r\n\r\n        /// <exclude />\r\n        public abstract object GetValue(FunctionContextContainer contextContainer);\r\n\r\n        /// <exclude />\r\n        public virtual T GetValue<T>(FunctionContextContainer contextContainer)\r\n        {\r\n            object value = this.GetValue(contextContainer);\r\n\r\n            if (value == null || value is T)\r\n            {\r\n                return (T)value;\r\n            }\r\n            else\r\n            {\r\n                return ValueTypeConverter.Convert<T>(value);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public abstract XObject Serialize();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/ConstantObjectParameterRuntimeTreeNode.cs",
    "content": "using System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions.Foundation;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class ConstantObjectParameterRuntimeTreeNode : BaseParameterRuntimeTreeNode\r\n    {\r\n        private readonly object _constantValue;\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ConstantObjectParameterRuntimeTreeNode(string name, object constantValue)\r\n            : base(name)\r\n        {\r\n            _constantValue = constantValue;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            return _constantValue;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<string> GetAllSubFunctionNames()\r\n        {\r\n            return new string[0];\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool ContainsNestedFunctions\r\n        {\r\n            get\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override XElement Serialize()\r\n        {\r\n            var element = new XElement(FunctionTreeConfigurationNames.ParamTag, \r\n                new XAttribute(FunctionTreeConfigurationNames.NameAttribute, this.Name));\r\n\r\n            if (_constantValue is IEnumerable && !(_constantValue is string))\r\n            {\r\n                foreach (object obj in (IEnumerable)_constantValue)\r\n                {\r\n                    element.Add(new XElement(FunctionTreeConfigurationNames.ParamElementTag,\r\n                            new XAttribute(FunctionTreeConfigurationNames.ValueAttribute, \r\n                                           XmlSerializationHelper.GetSerializableObject(obj))));\r\n                }\r\n\r\n                return element;\r\n            }\r\n\r\n            object xValue;\r\n            if (_constantValue is XNode)\r\n            {\r\n                if (_constantValue is XDocument)\r\n                {\r\n                    xValue = ((XDocument) _constantValue).Root;\r\n                }\r\n                else\r\n                {\r\n                    xValue = _constantValue;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                xValue = new XAttribute(FunctionTreeConfigurationNames.ValueAttributeName, \r\n                        XmlSerializationHelper.GetSerializableObject(_constantValue) ?? string.Empty);\r\n            }\r\n\r\n            element.Add(xValue);\r\n\r\n            return element;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/ConstantParameterRuntimeTreeNode.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions.Foundation;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    internal sealed class ConstantParameterRuntimeTreeNode : BaseParameterRuntimeTreeNode\r\n    {\r\n        private readonly object _constantValue;\r\n        private readonly bool _isEnumerable;\r\n        private readonly XAttribute _attribute;\r\n\r\n\r\n        public ConstantParameterRuntimeTreeNode(string name, string constantValue)\r\n            : base(name)\r\n        {\r\n            _constantValue = constantValue;\r\n        }\r\n\r\n        public ConstantParameterRuntimeTreeNode(string name, XAttribute valueAttribute)\r\n            : base(name)\r\n        {\r\n            _attribute = valueAttribute;\r\n        }\r\n\r\n\r\n        public ConstantParameterRuntimeTreeNode(string name, IEnumerable<string> constantValue)\r\n            : base(name)\r\n        {\r\n            _constantValue = constantValue;\r\n            _isEnumerable = true;\r\n        }\r\n\r\n\r\n\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            Verify.ArgumentNotNull(contextContainer, \"contextContainer\");\r\n\r\n            return _attribute != null ? _attribute.Value : _constantValue;\r\n        }\r\n\r\n        public override object GetValue(FunctionContextContainer contextContainer, Type type)\r\n        {\r\n            Verify.ArgumentNotNull(contextContainer, \"contextContainer\");\r\n            Verify.ArgumentNotNull(type, \"type\");\r\n\r\n            if (_attribute != null)\r\n            {\r\n                return XmlSerializationHelper.Deserialize(_attribute, type);\r\n            }\r\n\r\n            return ValueTypeConverter.Convert(_constantValue, type);\r\n        }\r\n\r\n\r\n        public override IEnumerable<string> GetAllSubFunctionNames()\r\n        {\r\n            yield break;\r\n        }\r\n\r\n\r\n        public override bool ContainsNestedFunctions\r\n        {\r\n            get\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override XElement Serialize()\r\n        {\r\n            var element = new XElement(FunctionTreeConfigurationNames.ParamTag,\r\n                        new XAttribute(FunctionTreeConfigurationNames.NameAttribute, this.Name));\r\n\r\n            if (_isEnumerable)\r\n            {\r\n                var strings = (IEnumerable<string>) _constantValue;\r\n                foreach (string s in strings)\r\n                {\r\n                    element.Add(new XElement(FunctionTreeConfigurationNames.ParamElementTag,\r\n                            new XAttribute(FunctionTreeConfigurationNames.ValueAttribute, s)));\r\n                }\r\n\r\n                return element;\r\n            }\r\n\r\n            if (_attribute != null)\r\n            {\r\n                element.Add(new XAttribute(FunctionTreeConfigurationNames.ValueAttribute, _attribute.Value));\r\n            }\r\n\r\n            if (_constantValue != null)\r\n            {\r\n                element.Add(new XAttribute(FunctionTreeConfigurationNames.ValueAttribute, _constantValue));\r\n            }\r\n\r\n            return element;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/ConstantValueProvider.cs",
    "content": "using System.Xml.Linq;\r\nusing Composite.Functions.Foundation;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class ConstantValueProvider : BaseValueProvider\r\n    {\r\n        private object _value;\r\n\r\n\r\n        /// <exclude />\r\n        public ConstantValueProvider(object value)\r\n        {\r\n            _value = value;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            return _value;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override XObject Serialize()\r\n        {\r\n            if (_value != null)\r\n            {\r\n                return new XAttribute(FunctionTreeConfigurationNames.ValueAttributeName, _value);\r\n            }\r\n            else\r\n            {\r\n                return null;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/DynamicMethodHelper.cs",
    "content": "﻿using System;\r\nusing System.Reflection;\r\nusing System.Reflection.Emit;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    internal class DynamicMethodHelper\r\n    {\r\n        public delegate object FunctionCall(Func<object> body);\r\n\r\n        private static readonly MethodInfo FuncObject_InvokeMethodInfo = typeof(Func<object>).GetMethod(\"Invoke\");\r\n\r\n        /// <summary>\r\n        /// Creates a dynamic method with the specified name. To be used for adding information into StackTrace.\r\n        /// </summary>\r\n        public static FunctionCall GetDynamicMethod(string methodName)\r\n        {\r\n            var wrapper = new DynamicMethod(\r\n                methodName,\r\n                typeof(object),\r\n                new[] { typeof(Func<object>) },\r\n                typeof(FunctionFacade).Module);\r\n\r\n            var wrapperBody = wrapper.GetILGenerator();\r\n\r\n            wrapperBody.Emit(OpCodes.Ldarg_0);\r\n            wrapperBody.EmitCall(OpCodes.Callvirt, FuncObject_InvokeMethodInfo, null);\r\n            wrapperBody.Emit(OpCodes.Ret);\r\n\r\n            return (FunctionCall)wrapper.CreateDelegate(typeof(FunctionCall));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Forms/FunctionParameterElementProducer.cs",
    "content": "﻿using Composite.C1Console.Forms;\r\n\r\n\r\nnamespace Composite.Functions.Forms\r\n{\r\n    [ControlValueProperty(\"Producers\")]\r\n    internal class FunctionParameterElementProducer : IFunctionProducer\r\n    {\r\n        [RequiredValue]\r\n        public string value { get; set; }\r\n\r\n        public object GetResult()\r\n        {\r\n            return new ConstantParameterRuntimeTreeNode(\"_HHH_\", this.value);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Forms/FunctionParameterProducer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Forms;\r\n\r\n\r\nnamespace Composite.Functions.Forms\r\n{\r\n    [ControlValueProperty(\"Producers\")]\r\n\tinternal sealed class FunctionParameterProducer : IFunctionProducer \r\n\t{\r\n        public FunctionParameterProducer()\r\n        {\r\n            this.Producers = new List<BaseRuntimeTreeNode>();\r\n        }\r\n\r\n\r\n        [RequiredValue]\r\n        public string name { get; set; }\r\n\r\n        \r\n        public object value { get; set; }\r\n\r\n\r\n        [FormsProperty]\r\n        public List<BaseRuntimeTreeNode> Producers { get; private set; }\r\n\r\n\r\n\r\n        public object GetResult()\r\n        {\r\n            if (this.value != null)\r\n            {\r\n                if (this.value is FunctionRuntimeTreeNode)\r\n                {\r\n                    return new FunctionParameterRuntimeTreeNode(this.name, this.value as FunctionRuntimeTreeNode);\r\n                }\r\n                if (this.value is string)\r\n                {\r\n                    return new ConstantParameterRuntimeTreeNode(this.name, this.value as string);\r\n                }\r\n\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n            if (Producers.Count == 1)\r\n            {\r\n                var functionNode = Producers[0] as FunctionRuntimeTreeNode;\r\n                if (functionNode != null)\r\n                {\r\n                    return new FunctionParameterRuntimeTreeNode(this.name, functionNode);\r\n                }\r\n\r\n                var constantObjectNode = Producers[0] as ConstantObjectParameterRuntimeTreeNode;\r\n                if (constantObjectNode != null)\r\n                {\r\n                    return new ConstantObjectParameterRuntimeTreeNode(this.name, constantObjectNode.GetValue());\r\n                }\r\n            }\r\n\r\n            if (Producers.All(p => p is ConstantParameterRuntimeTreeNode))\r\n            {\r\n                IEnumerable<string> values = Producers.OfType<ConstantParameterRuntimeTreeNode>().Select(f => (string)f.GetValue());\r\n\r\n                return new ConstantParameterRuntimeTreeNode(this.name, values);                \r\n            }\r\n\r\n            throw new NotImplementedException();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Forms/FunctionProducer.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Forms;\r\n\r\n\r\nnamespace Composite.Functions.Forms\r\n{\r\n    [ControlValueProperty(\"Producers\")]\r\n    internal sealed class FunctionProducer : IFunctionProducer\r\n    {\r\n        public FunctionProducer()\r\n        {\r\n            this.Producers = new List<BaseParameterRuntimeTreeNode>();\r\n        }\r\n\r\n\r\n        [RequiredValue]\r\n        public string name { get; set; }\r\n\r\n\r\n        [FormsProperty()]\r\n        public List<BaseParameterRuntimeTreeNode> Producers { get; private set; }\r\n\r\n\r\n\r\n        public object GetResult()\r\n        {            \r\n            IFunction function = FunctionFacade.GetFunction(this.name);\r\n\r\n            FunctionRuntimeTreeNode functionNode = new FunctionRuntimeTreeNode(function, this.Producers);\r\n\r\n            return functionNode;    \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Forms/FunctionProducerMediator.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.Plugins.ProducerMediator;\r\nusing Composite.Core.Extensions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Functions.Forms\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableProducerMediator))]\r\n    internal sealed class FunctionProducerMediator : IProducerMediator\r\n    {\r\n        public object CreateProducer(IFormChannelIdentifier channel, string namespaceName, string name)\r\n        {\r\n            switch (name)\r\n            {\r\n                case \"function\":\r\n                    return new FunctionProducer();\r\n\r\n                case \"param\":\r\n                    return new FunctionParameterProducer();\r\n\r\n                case \"paramelement\":\r\n                    return new FunctionParameterElementProducer();\r\n\r\n                default:\r\n                    throw new NotSupportedException(\"Not supported producer tag. Check whether the namespace or the tag name is correct. {{ {0} }} {1}\".FormatWith(namespaceName, name));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public object EvaluateProducer(object producer)\r\n        {\r\n            IFunctionProducer functionProducer = (IFunctionProducer)producer;\r\n\r\n            return functionProducer.GetResult();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Forms/IFunctionProducer.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Functions.Forms\r\n{\r\n    internal interface IFunctionProducer\r\n\t{\r\n        object GetResult();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/FunctionContainer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Functions.Foundation.PluginFacades;\r\nusing Composite.Functions.Plugins.FunctionProvider.Runtime;\r\n\r\n\r\nnamespace Composite.Functions.Foundation\r\n{\r\n    internal sealed class FunctionContainer : MetaFunctionContainer\r\n    {\r\n        internal FunctionContainer(List<string> excludedFunctionNames)\r\n            : base(excludedFunctionNames)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<string> OnGetProviderNames()\r\n        {\r\n            if ((ConfigurationServices.ConfigurationSource == null) ||\r\n                (ConfigurationServices.ConfigurationSource.GetSection(FunctionProviderSettings.SectionName) == null))\r\n            {\r\n                Log.LogError(\"FunctionProviderRegistry\", \"Failed to load the configuration section '{0}' from the configuration\", FunctionProviderSettings.SectionName);\r\n\r\n                return new List<string>();\r\n            }\r\n\r\n            var functionProviderSettings = ConfigurationServices.ConfigurationSource.GetSection(FunctionProviderSettings.SectionName) as FunctionProviderSettings;\r\n\r\n            return functionProviderSettings.FunctionProviderPlugins.Select(plugin => plugin.Name);\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<IMetaFunction> OnGetFunctionsFromProvider(string providerName, FunctionTypesToReturn functionTypesToReturn)\r\n        {\r\n            switch (functionTypesToReturn)\r\n            {\r\n                case FunctionTypesToReturn.StaticDependentFunctions:\r\n                    return FunctionProviderPluginFacade.Functions(providerName);\r\n                    \r\n                case FunctionTypesToReturn.DynamicDependentOnlyFunctions:\r\n                    return FunctionProviderPluginFacade.DynamicTypeDependentFunctions(providerName);\r\n                    \r\n                case FunctionTypesToReturn.AllFunctions:\r\n                    IEnumerable<IMetaFunction> functions = FunctionProviderPluginFacade.Functions(providerName);\r\n                    return functions.Concat(FunctionProviderPluginFacade.DynamicTypeDependentFunctions(providerName));\r\n            }\r\n\r\n            throw new NotImplementedException(string.Format(\"Unexpected FunctionTypesToReturn enumeration value '{0}' from provider '{1}'\", functionTypesToReturn, providerName));\r\n        }\r\n\r\n        protected override void OnFunctionsAdded(List<string> functionNames, bool fireEvents)\r\n        {\r\n            if (fireEvents)\r\n            {\r\n                FunctionEventSystemFacade.FireFunctionAddedEvent(new FunctionsAddedEventArgs(functionNames));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected override void OnFunctionsRemoved(List<string> functionNames)\r\n        {\r\n            FunctionEventSystemFacade.FireFunctionRemovedEvent(new FunctionsRemovedEventArgs(functionNames));\r\n        }\r\n\r\n\r\n\r\n        protected override string FunctionType\r\n        {\r\n            get { return \"Function\"; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/FunctionTreeConfigurationNames.cs",
    "content": "using System.ComponentModel;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Functions.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public static class FunctionTreeConfigurationNames\r\n    {\r\n        private static readonly XName _paramTag = (XNamespace) NamespaceName + ParamTagName;\r\n        private static readonly XName _paramElementTag = (XNamespace) NamespaceName + ParamElementTagName;\r\n        private static readonly XName _valueAttribute = ValueAttributeName;\r\n        private static readonly XName _nameAttribute = NameAttributeName;\r\n\r\n        /// <exclude />\r\n        public static XName ParamTag { get { return _paramTag; } }\r\n\r\n        /// <exclude />\r\n        public static XName ParamElementTag { get { return _paramElementTag; } }\r\n\r\n        /// <exclude />\r\n        public static XName NameAttribute { get { return _nameAttribute; } }\r\n\r\n        /// <exclude />\r\n        public static XName ValueAttribute { get { return _valueAttribute; } }\r\n\r\n        /// <exclude />\r\n        public static string NamespaceName { get { return \"http://www.composite.net/ns/function/1.0\"; } }\r\n\r\n        /// <exclude />\r\n        public static string ParamTagName { get { return \"param\"; } }\r\n\r\n        /// <exclude />\r\n        public static string ParamElementTagName { get { return \"paramelement\"; } }\r\n\r\n        /// <exclude />\r\n        public static string FunctionTagName { get { return \"function\"; } }\r\n\r\n        /// <exclude />\r\n        public static string WidgetFunctionTagName { get { return \"widgetfunction\"; } }\r\n\r\n        /// <exclude />\r\n        public static string HelpDefinitionTagName { get { return \"helpdefinition\"; } }\r\n\r\n        /// <exclude />\r\n        public static string NameAttributeName { get { return \"name\"; } }\r\n\r\n        /// <exclude />\r\n        public static string ValueAttributeName { get { return \"value\"; } }\r\n\r\n        /// <exclude />\r\n        public static string LabelAttributeName { get { return \"label\"; } }\r\n\r\n        /// <exclude />\r\n        public static string BindingSourceNameAttributeName { get { return \"bindingsourcename\"; } }\r\n\r\n        /// <exclude />\r\n        public static string HelpTextAttributeName { get { return \"helptext\"; } }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/IMetaFunctionProviderRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Functions.Foundation\r\n{\r\n    internal interface IMetaFunctionProviderRegistry\r\n    {\r\n        List<string> FunctionNames { get; }\r\n        List<string> WidgetFunctionNames { get; }\r\n        IEnumerable<string> FunctionNamesByProviderName(string providerName);\r\n        IEnumerable<string> WidgetFunctionNamesByProviderName(string providerName);\r\n        IEnumerable<string> GetFunctionNamesByType(Type supportedType);\r\n        IEnumerable<string> GetWidgetFunctionNamesByType(Type supportedType);\r\n        IFunction GetFunction(string name);\r\n        IWidgetFunction GetWidgetFunction(string name);\r\n        IEnumerable<Type> FunctionSupportedTypes { get; }\r\n        IEnumerable<Type> WidgetFunctionSupportedTypes { get; }\r\n\r\n        void ReinitializeFunctionFromProvider(string providerName);\r\n        void ReinitializeWidgetFunctionFromProvider(string providerName);\r\n\r\n        void Initialize_PostDataTypes();\r\n        void Flush();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/MetaFunctionContainer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing System.Collections;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.Functions.Foundation\r\n{\r\n    internal abstract class MetaFunctionContainer\r\n    {\r\n        private static readonly string LogTitle = typeof (MetaFunctionContainer).Name;\r\n        private readonly List<string> _excludedFunctionNames;\r\n\r\n        private readonly Dictionary<string, IMetaFunction> _functionByNameDictionary = new Dictionary<string, IMetaFunction>();\r\n        private readonly Dictionary<Type, List<string>> _functionNamesByTypeDictionary = new Dictionary<Type, List<string>>();\r\n        private readonly Dictionary<Type, List<string>> _downcastableFunctionNamesByTypeDictionary = new Dictionary<Type, List<string>>();\r\n\r\n        private readonly Dictionary<string, List<string>> _functionNamesByProviderName = new Dictionary<string, List<string>>();\r\n\r\n\r\n        protected abstract IEnumerable<string> OnGetProviderNames();\r\n        protected abstract IEnumerable<IMetaFunction> OnGetFunctionsFromProvider(string providerName, FunctionTypesToReturn functionTypesToReturn);\r\n        protected abstract void OnFunctionsAdded(List<string> functionNames, bool fireEvents);\r\n        protected abstract void OnFunctionsRemoved(List<string> functionNames);\r\n        protected abstract string FunctionType { get; }\r\n\r\n\r\n\r\n        protected MetaFunctionContainer(List<string> excludedFunctionNames)\r\n        {\r\n            _excludedFunctionNames = excludedFunctionNames;\r\n        }\r\n\r\n\r\n\r\n        public void Initialize(bool dynamicTypes)\r\n        {\r\n            if (dynamicTypes)\r\n            {\r\n                InitializeAllFunctions(FunctionTypesToReturn.DynamicDependentOnlyFunctions, false);\r\n            }\r\n            else\r\n            {\r\n                InitializeAllFunctions(FunctionTypesToReturn.StaticDependentFunctions, false);\r\n            }\r\n        }\r\n\r\n\r\n        public IEnumerable<string> FunctionNames\r\n        {\r\n            get\r\n            {\r\n                return _functionByNameDictionary.Keys;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> FunctionNamesByProviderName(string providerName)\r\n        {\r\n            List<string> functionNames;\r\n\r\n            if (_functionNamesByProviderName.TryGetValue(providerName, out functionNames) == false)\r\n            {\r\n                functionNames = new List<string>();\r\n            }\r\n\r\n            return functionNames;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> GetFunctionNamesByType(Type supportedType)\r\n        {\r\n            List<string> functionNames = new List<string>();\r\n\r\n            foreach (var typeMappedFunctions in _functionNamesByTypeDictionary)\r\n            {\r\n                bool useableType = supportedType.IsAssignableFrom(typeMappedFunctions.Key);\r\n\r\n                if (useableType)\r\n                {\r\n                    // Negate that string is an IEnumerable - thats just plain stupid.\r\n                    if ((supportedType is IEnumerable && typeMappedFunctions.Key == typeof(string)) == false)\r\n                    {\r\n                        functionNames.AddRange(typeMappedFunctions.Value);\r\n                    }\r\n                }\r\n            }\r\n\r\n            foreach (var typeMappedFunctions in _downcastableFunctionNamesByTypeDictionary)\r\n            {\r\n                bool useableType = typeMappedFunctions.Key.IsAssignableFrom(supportedType);\r\n\r\n                if (useableType)\r\n                {\r\n                    functionNames.AddRange(typeMappedFunctions.Value.Where(f => functionNames.Contains(f)==false));\r\n                }\r\n            }\r\n\r\n            return functionNames;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> FunctionSupportedTypes\r\n        {\r\n            get\r\n            {\r\n                return _functionNamesByTypeDictionary.Keys;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IMetaFunction GetFunction(string functionName)\r\n        {\r\n            IMetaFunction function;\r\n\r\n            if (_functionByNameDictionary.TryGetValue(functionName, out function) == false)\r\n            {\r\n                throw new ArgumentException(string.Format(\"The {0} named '{1}' is not known. Ensure it exists with the exact spelling and casing you provided.\", this.FunctionType, functionName));\r\n            }\r\n\r\n            return function;\r\n        }\r\n\r\n\r\n\r\n        public void ReInitializeFunctionsFromProvider(string providerName)\r\n        {\r\n            RemoveFunctionsByProvider(providerName);\r\n\r\n            InitializeFunctionsFromProvider(providerName, FunctionTypesToReturn.AllFunctions, true);\r\n        }\r\n\r\n\r\n\r\n        private void InitializeAllFunctions(FunctionTypesToReturn functionTypesToReturn, bool fireUpdateEvents)\r\n        {\r\n            foreach (string providerName in OnGetProviderNames())\r\n            {\r\n                InitializeFunctionsFromProvider(providerName, functionTypesToReturn, fireUpdateEvents);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void InitializeFunctionsFromProvider(string providerName, FunctionTypesToReturn functionTypesToReturn,bool fireEvents)\r\n        {\r\n            List<string> loadedFunctionNames = new List<string>();\r\n\r\n            foreach (IMetaFunction function in OnGetFunctionsFromProvider(providerName, functionTypesToReturn).OrderBy(f => f.CompositeName()))\r\n            {\r\n                if (function.IsNamespaceCorrectFormat() == false)\r\n                {\r\n                    Log.LogWarning(LogTitle, string.Format(\"{0} named '{1}' has an invalid namespace '{2}'\", this.FunctionType, function.Name, function.Namespace));\r\n                    continue;\r\n                }\r\n\r\n                string combinedName = StringExtensionMethods.CreateNamespace(function.Namespace, function.Name, '.');\r\n                if (_excludedFunctionNames.Contains(combinedName))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n\r\n                if (FunctionExists(combinedName))\r\n                {\r\n                    RemoveFunction(combinedName);\r\n                    _excludedFunctionNames.Add(combinedName);\r\n\r\n                    Log.LogWarning(LogTitle, \"Function name clash: '{0}'\", combinedName);\r\n                    continue;\r\n                }\r\n\r\n                try\r\n                {\r\n                    AddFunction(providerName, function);\r\n                    loadedFunctionNames.Add(function.CompositeName());\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, \"Error adding  function '{0}'. Function type {0}\", combinedName, this.FunctionType);\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n\r\n            if (_functionNamesByProviderName.ContainsKey(providerName))\r\n            {\r\n                //foreach (string functionName in _functionNamesByProviderName[providerName])\r\n                //{\r\n                //    if (loadedFunctionNames.Contains(functionName))\r\n                //    {\r\n                //        Log.LogVerbose(\"FunctionProviderRegistry\", string.Format(\"{0} loaded: '{1}' from provider '{2}'\", this.FunctionType, functionName, providerName));\r\n                //    }\r\n                //}\r\n\r\n                OnFunctionsAdded(_functionNamesByProviderName[providerName].ToList(), fireEvents);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AddFunction(string providerName, IMetaFunction function)\r\n        {\r\n            string compositeName = function.CompositeName();\r\n\r\n            _functionByNameDictionary.Add(compositeName, function);\r\n\r\n\r\n            List<string> functionNamesByProviderNameList;\r\n            if (_functionNamesByProviderName.TryGetValue(providerName, out functionNamesByProviderNameList) == false)\r\n            {\r\n                functionNamesByProviderNameList = new List<string>();\r\n                _functionNamesByProviderName.Add(providerName, functionNamesByProviderNameList);\r\n            }\r\n\r\n            functionNamesByProviderNameList.Add(compositeName);\r\n\r\n\r\n            List<string> functionNamesByType;\r\n            if (_functionNamesByTypeDictionary.TryGetValue(function.ReturnType, out functionNamesByType) == false)\r\n            {\r\n                functionNamesByType = new List<string>();\r\n                _functionNamesByTypeDictionary.Add(function.ReturnType, functionNamesByType);\r\n            }\r\n\r\n            functionNamesByType.Add(compositeName);\r\n\r\n            if (function is IDowncastableFunction && ((IDowncastableFunction)function).ReturnValueIsDowncastable)\r\n            {\r\n                List<string> downcastableFunctionNamesByType;\r\n                if (_downcastableFunctionNamesByTypeDictionary.TryGetValue(function.ReturnType, out downcastableFunctionNamesByType) == false)\r\n                {\r\n                    downcastableFunctionNamesByType = new List<string>();\r\n                    _downcastableFunctionNamesByTypeDictionary.Add(function.ReturnType, downcastableFunctionNamesByType);\r\n                }\r\n                downcastableFunctionNamesByType.Add(compositeName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void RemoveFunctionsByProvider(string providerName)\r\n        {\r\n            if (_functionNamesByProviderName.ContainsKey(providerName) == false) return;\r\n\r\n            List<string> functionNames = _functionNamesByProviderName[providerName];\r\n\r\n            foreach (string functionName in functionNames)\r\n            {\r\n                _functionByNameDictionary.Remove(functionName);\r\n\r\n                foreach (List<string> functionNamesByType in _functionNamesByTypeDictionary.Values)\r\n                {\r\n                    functionNamesByType.Remove(functionName);\r\n                }\r\n\r\n                foreach (List<string> functionNamesByType in _downcastableFunctionNamesByTypeDictionary.Values)\r\n                {\r\n                    functionNamesByType.Remove(functionName);\r\n                }\r\n\r\n                Log.LogVerbose(LogTitle, \"{0} unloaded: '{1}'\", this.FunctionType, functionName);\r\n            }\r\n\r\n            _functionNamesByProviderName.Remove(providerName);\r\n\r\n            OnFunctionsRemoved(functionNames);\r\n        }\r\n\r\n\r\n\r\n        private void RemoveFunction(string functionName)\r\n        {\r\n            _functionByNameDictionary.Remove(functionName);\r\n\r\n            foreach (List<string> functionNamesByProvder in _functionNamesByProviderName.Values)\r\n            {\r\n                functionNamesByProvder.Remove(functionName);\r\n            }\r\n\r\n            foreach (List<string> functionNamesByType in _functionNamesByTypeDictionary.Values)\r\n            {\r\n                functionNamesByType.Remove(functionName);\r\n            }\r\n\r\n            foreach (List<string> functionNamesByType in _downcastableFunctionNamesByTypeDictionary.Values)\r\n            {\r\n                functionNamesByType.Remove(functionName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private bool FunctionExists(string functionName)\r\n        {\r\n            return _functionByNameDictionary.ContainsKey(functionName);\r\n        }\r\n\r\n\r\n\r\n        protected enum FunctionTypesToReturn\r\n        {\r\n            /// <summary>\r\n            /// Only functions that DOES NOT relay on dynamic types may be returned\r\n            /// IFunctionProvider.Functions\r\n            /// </summary>\r\n            StaticDependentFunctions,\r\n\r\n            /// <summary>\r\n            /// Only functions that DOES relay on dynamic types may be return\r\n            /// IDynamicTypeFunctionProvider.DynamicTypeDependentFunctions\r\n            /// </summary>\r\n            DynamicDependentOnlyFunctions,\r\n\r\n            /// <summary>\r\n            /// All functions may be returned\r\n            /// IFunctionProvider.Functions \r\n            /// AND\r\n            /// IDynamicTypeFunctionProvider.DynamicTypeDependentFunctions\r\n            /// </summary>\r\n            AllFunctions\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/MetaFunctionProviderRegistry.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Functions.Foundation\r\n{\r\n\tinternal static class MetaFunctionProviderRegistry\r\n\t{\r\n        private static IMetaFunctionProviderRegistry _metaFunctionProviderRegistry = new MetaFunctionProviderRegistryImpl();\r\n        \r\n\r\n        static MetaFunctionProviderRegistry()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n        internal static IMetaFunctionProviderRegistry Implementation { get { return _metaFunctionProviderRegistry; } set { _metaFunctionProviderRegistry = value; } }\r\n\r\n\r\n\r\n        public static List<string> FunctionNames\r\n        {\r\n            get\r\n            {\r\n                return _metaFunctionProviderRegistry.FunctionNames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static List<string> WidgetFunctionNames\r\n        {\r\n            get\r\n            {\r\n                return _metaFunctionProviderRegistry.WidgetFunctionNames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> FunctionNamesByProviderName(string providerName)\r\n        {\r\n            return _metaFunctionProviderRegistry.FunctionNamesByProviderName(providerName);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> WidgetFunctionNamesByProviderName(string providerName)\r\n        {\r\n            return _metaFunctionProviderRegistry.WidgetFunctionNamesByProviderName(providerName);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> GetFunctionNamesByType(Type supportedType)\r\n        {\r\n            return _metaFunctionProviderRegistry.GetFunctionNamesByType(supportedType);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<string> GetWidgetFunctionNamesByType(Type supportedType)\r\n        {\r\n            return _metaFunctionProviderRegistry.GetWidgetFunctionNamesByType(supportedType);\r\n        }\r\n\r\n\r\n\r\n        public static IFunction GetFunction(string name)\r\n        {\r\n            return _metaFunctionProviderRegistry.GetFunction(name);\r\n        }\r\n\r\n\r\n\r\n        public static IWidgetFunction GetWidgetFunction(string name)\r\n        {\r\n            return _metaFunctionProviderRegistry.GetWidgetFunction(name);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Type> FunctionSupportedTypes\r\n        {\r\n            get\r\n            {\r\n                return _metaFunctionProviderRegistry.FunctionSupportedTypes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<Type> WidgetFunctionSupportedTypes\r\n        {\r\n            get\r\n            {\r\n                return _metaFunctionProviderRegistry.WidgetFunctionSupportedTypes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void ReinitializeFunctionFromProvider(string providerName)\r\n        {\r\n            _metaFunctionProviderRegistry.ReinitializeFunctionFromProvider(providerName);\r\n        }\r\n\r\n\r\n\r\n        internal static void ReinitializeWidgetFunctionFromProvider(string providerName)\r\n        {\r\n            _metaFunctionProviderRegistry.ReinitializeWidgetFunctionFromProvider(providerName);\r\n        }\r\n\r\n\r\n\r\n        internal static void Initialize_PostDataTypes()\r\n        {\r\n            if (RuntimeInformation.IsDebugBuild)\r\n            {\r\n                GlobalInitializerFacade.ValidateIsOnlyCalledFromGlobalInitializerFacade(new StackTrace());\r\n            }\r\n\r\n            _metaFunctionProviderRegistry.Initialize_PostDataTypes();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _metaFunctionProviderRegistry.Flush();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/MetaFunctionProviderRegistryImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Functions.Foundation\r\n{\r\n    internal sealed class MetaFunctionProviderRegistryImpl : IMetaFunctionProviderRegistry\r\n    {\r\n        private ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.DoInitialize);\r\n\r\n\r\n\r\n        public List<string> FunctionNames\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    using (_resourceLocker.ReadLocker)\r\n                    {\r\n                        return _resourceLocker.Resources.FunctionContainer.FunctionNames.ToList();\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public List<string> WidgetFunctionNames\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    using (_resourceLocker.ReadLocker)\r\n                    {\r\n                        return _resourceLocker.Resources.WidgetFunctionContainer.FunctionNames.ToList();\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> FunctionNamesByProviderName(string providerName)\r\n        {\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.FunctionContainer.FunctionNamesByProviderName(providerName);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> WidgetFunctionNamesByProviderName(string providerName)\r\n        {\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.WidgetFunctionContainer.FunctionNamesByProviderName(providerName);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> GetFunctionNamesByType(Type supportedType)\r\n        {\r\n            if (supportedType == null) throw new ArgumentNullException(\"supportedType\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.FunctionContainer.GetFunctionNamesByType(supportedType);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<string> GetWidgetFunctionNamesByType(Type supportedType)\r\n        {\r\n            if (supportedType == null) throw new ArgumentNullException(\"supportedType\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return _resourceLocker.Resources.WidgetFunctionContainer.GetFunctionNamesByType(supportedType);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IFunction GetFunction(string name)\r\n        {\r\n            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(\"name\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return (IFunction)_resourceLocker.Resources.FunctionContainer.GetFunction(name);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IWidgetFunction GetWidgetFunction(string name)\r\n        {\r\n            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(\"name\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (_resourceLocker.ReadLocker)\r\n                {\r\n                    return (IWidgetFunction)_resourceLocker.Resources.WidgetFunctionContainer.GetFunction(name);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> FunctionSupportedTypes\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    using (_resourceLocker.ReadLocker)\r\n                    {\r\n                        return _resourceLocker.Resources.FunctionContainer.FunctionSupportedTypes;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> WidgetFunctionSupportedTypes\r\n        {\r\n            get\r\n            {\r\n                using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n                {\r\n                    using (_resourceLocker.ReadLocker)\r\n                    {\r\n                        return _resourceLocker.Resources.WidgetFunctionContainer.FunctionSupportedTypes;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void ReinitializeFunctionFromProvider(string providerName)\r\n        {\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    _resourceLocker.Resources.FunctionContainer.ReInitializeFunctionsFromProvider(providerName);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void ReinitializeWidgetFunctionFromProvider(string providerName)\r\n        {\r\n            if (string.IsNullOrEmpty(providerName)) throw new ArgumentNullException(\"providerName\");\r\n\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                using (_resourceLocker.Locker)\r\n                {\r\n                    _resourceLocker.Resources.WidgetFunctionContainer.ReInitializeFunctionsFromProvider(providerName);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Initialize_PostDataTypes()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                // Keeping static/dynamic function initialization order for backward compatibility\r\n                _resourceLocker.Resources.FunctionContainer.Initialize(false);\r\n                _resourceLocker.Resources.WidgetFunctionContainer.Initialize(false);\r\n                _resourceLocker.Resources.FunctionContainer.Initialize(true);\r\n                _resourceLocker.Resources.WidgetFunctionContainer.Initialize(true);\r\n            }\r\n        }       \r\n\r\n\r\n\r\n        public void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public static void DoInitialize(Resources resources)\r\n            {\r\n                resources.ExcludedFunctionNames = new List<string>();\r\n                resources.FunctionContainer = new FunctionContainer(resources.ExcludedFunctionNames);\r\n                resources.WidgetFunctionContainer = new WidgetFunctionContainer(resources.ExcludedFunctionNames);\r\n            }\r\n\r\n            public FunctionContainer FunctionContainer { get; set; }\r\n            public WidgetFunctionContainer WidgetFunctionContainer { get; set; }\r\n            public List<string> ExcludedFunctionNames { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/PluginFacades/FunctionProviderPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Composite.Functions.Plugins.FunctionProvider.Runtime;\r\n\r\n\r\nnamespace Composite.Functions.Foundation.PluginFacades\r\n{\r\n    internal static class FunctionProviderPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static FunctionProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<IFunction> Functions(string providerName)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                List<IFunction> functions = new List<IFunction>();\r\n\r\n                IFunctionProvider provider = GetFunctionProvider(providerName);\r\n                var functionsFromProvider = provider.Functions;\r\n\r\n                Verify.IsNotNull(functionsFromProvider, \"Provider '{0}' has returned null function colleciton\", providerName);\r\n\r\n                foreach (IFunction function in functionsFromProvider)\r\n                {\r\n                    functions.Add(new FunctionWrapper(function));\r\n                }\r\n\r\n                return functions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<IFunction> DynamicTypeDependentFunctions(string providerName)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                List<IFunction> functions = new List<IFunction>();\r\n\r\n                IDynamicTypeFunctionProvider provider = GetFunctionProvider(providerName) as IDynamicTypeFunctionProvider;\r\n\r\n                if (provider != null)\r\n                {\r\n                    foreach (IFunction function in provider.DynamicTypeDependentFunctions)\r\n                    {\r\n                        functions.Add(new FunctionWrapper(function));\r\n                    }\r\n                }\r\n\r\n                return functions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static IFunctionProvider GetFunctionProvider(string providerName)\r\n        {\r\n            IFunctionProvider functionProvider;\r\n\r\n            var resources = _resourceLocker;\r\n\r\n            using (resources.Locker)\r\n            {\r\n                if (resources.Resources.ProviderCache.TryGetValue(providerName, out functionProvider) == false)\r\n                {\r\n                    try\r\n                    {\r\n                        functionProvider = resources.Resources.Factory.Create(providerName);\r\n\r\n                        functionProvider.FunctionNotifier = new FunctionNotifier(providerName);\r\n\r\n                        resources.Resources.ProviderCache.Add(providerName, functionProvider);\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return functionProvider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", FunctionProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public FunctionProviderFactory Factory { get; set; }\r\n            public Dictionary<string, IFunctionProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new FunctionProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n                resources.ProviderCache = new Dictionary<string, IFunctionProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/PluginFacades/FunctionWrapper.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Web;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\n\r\nnamespace Composite.Functions.Foundation.PluginFacades\r\n{\r\n    /// <summary>\r\n    /// This class is used for catching exceptions from plugins and handling them correctly\r\n    /// </summary>\r\n    [DebuggerDisplay(\"Name = {Name}, Namespace = {Namespace}\")]\r\n    internal sealed class FunctionWrapper : IDowncastableFunction, ICompoundFunction, IFunctionInitializationInfo, IDynamicFunction\r\n    {\r\n        private static readonly string LogTitle = typeof (FunctionWrapper).Name;\r\n        private readonly IFunction _functionToWrap;\r\n\r\n\r\n        internal FunctionWrapper(IFunction functionToWrap)\r\n        {\r\n            _functionToWrap = functionToWrap;\r\n        }\r\n\r\n\r\n        public IFunction InnerFunction\r\n        {\r\n            get { return _functionToWrap; }\r\n        }\r\n\r\n\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _functionToWrap.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string Namespace\r\n        {\r\n            get\r\n            {\r\n                return _functionToWrap.Namespace;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string Description\r\n        {\r\n            get\r\n            {\r\n                return _functionToWrap.Description;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Type ReturnType\r\n        {\r\n            get\r\n            {\r\n                return _functionToWrap.ReturnType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<ParameterProfile> ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                if (_functionToWrap.ParameterProfiles == null)\r\n                {\r\n                    return new ParameterProfile[0];\r\n                }\r\n\r\n                return _functionToWrap.ParameterProfiles;\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        public object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            try\r\n            {\r\n                var dynamicMethod = DynamicMethodHelper.GetDynamicMethod(\"<C1 function> \" + _functionToWrap.CompositeName());\r\n\r\n                return dynamicMethod(() => _functionToWrap.Execute(parameters, context));\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                if (_functionToWrap.ReturnType == typeof(XhtmlDocument) || (_functionToWrap.ReturnType == typeof(void) && ex is HttpCompileException))\r\n                {\r\n                    XElement errorBoxHtml;\r\n                    if (context.ProcessException(_functionToWrap.CompositeName(), ex, LogTitle, out errorBoxHtml))\r\n                    {\r\n                        XhtmlDocument errorInfoDocument = new XhtmlDocument();\r\n                        errorInfoDocument.Body.Add(errorBoxHtml);\r\n                        return errorInfoDocument;\r\n                    }\r\n                }\r\n                \r\n                throw;\r\n            }\r\n        }\r\n\r\n        public EntityToken EntityToken\r\n        {\r\n            get\r\n            {\r\n                return _functionToWrap.EntityToken;\r\n            }\r\n        }\r\n\r\n        public bool ReturnValueIsDowncastable\r\n        {\r\n            get\r\n            {\r\n                if (_functionToWrap is IDowncastableFunction)\r\n                {\r\n                    return ((IDowncastableFunction)_functionToWrap).ReturnValueIsDowncastable;\r\n                }\r\n                \r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n        public bool AllowRecursiveCall\r\n        {\r\n            get\r\n            {\r\n                return _functionToWrap is ICompoundFunction compoundFunction\r\n                     && compoundFunction.AllowRecursiveCall;\r\n            }\r\n        }\r\n\r\n\r\n        bool IFunctionInitializationInfo.FunctionInitializedCorrectly\r\n        {\r\n            get\r\n            {\r\n                if(!(_functionToWrap is IFunctionInitializationInfo))\r\n                {\r\n                    return true;\r\n                }\r\n                return ((IFunctionInitializationInfo) _functionToWrap).FunctionInitializedCorrectly;\r\n            }\r\n        }\r\n\r\n        public bool PreventFunctionOutputCaching => _functionToWrap is IDynamicFunction df && df.PreventFunctionOutputCaching;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/PluginFacades/WidgetFunctionProviderPluginFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions.Plugins.WidgetFunctionProvider;\r\nusing Composite.Functions.Plugins.WidgetFunctionProvider.Runtime;\r\n\r\n\r\nnamespace Composite.Functions.Foundation.PluginFacades\r\n{\r\n    internal static class WidgetFunctionProviderPluginFacade\r\n    {\r\n        private static ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize);\r\n\r\n\r\n\r\n        static WidgetFunctionProviderPluginFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<IWidgetFunction> Functions(string providerName)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                var widgetFunctions = new List<IWidgetFunction>();\r\n\r\n                var provider = GetFunctionProvider(providerName);\r\n\r\n                provider.Functions?.ForEach(func => widgetFunctions.Add(new WidgetFunctionWrapper(func)));\r\n\r\n                return widgetFunctions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<IWidgetFunction> DynamicTypeDependentFunctions(string providerName)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                var widgetFunctions = new List<IWidgetFunction>();\r\n\r\n                var provider = GetFunctionProvider(providerName);\r\n\r\n                if (provider is IDynamicTypeWidgetFunctionProvider dtProvider)\r\n                {\r\n                    dtProvider.DynamicTypeDependentFunctions?.ForEach(func => widgetFunctions.Add(new WidgetFunctionWrapper(func)));\r\n                }\r\n\r\n                return widgetFunctions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IWidgetFunctionProvider GetFunctionProvider(string providerName)\r\n        {\r\n            IWidgetFunctionProvider widgetFunctionProvider;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.ProviderCache.TryGetValue(providerName, out widgetFunctionProvider) == false)\r\n                {\r\n                    try\r\n                    {\r\n                        widgetFunctionProvider = _resourceLocker.Resources.Factory.Create(providerName);\r\n\r\n                        widgetFunctionProvider.WidgetFunctionNotifier = new WidgetFunctionNotifier(providerName);\r\n\r\n                        _resourceLocker.Resources.ProviderCache.Add(providerName, widgetFunctionProvider);\r\n                    }\r\n                    catch (ArgumentException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                    catch (ConfigurationErrorsException ex)\r\n                    {\r\n                        HandleConfigurationError(ex);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return widgetFunctionProvider;\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            _resourceLocker.ResetInitialization();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n\r\n\r\n\r\n        private static void HandleConfigurationError(Exception ex)\r\n        {\r\n            Flush();\r\n\r\n            throw new ConfigurationErrorsException(string.Format(\"Failed to load the configuration section '{0}' from the configuration.\", WidgetFunctionProviderSettings.SectionName), ex);\r\n        }\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public WidgetFunctionProviderFactory Factory { get; set; }\r\n            public Dictionary<string, IWidgetFunctionProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                try\r\n                {\r\n                    resources.Factory = new WidgetFunctionProviderFactory();\r\n                }\r\n                catch (NullReferenceException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n                catch (ConfigurationErrorsException ex)\r\n                {\r\n                    HandleConfigurationError(ex);\r\n                }\r\n\r\n\r\n                resources.ProviderCache = new Dictionary<string, IWidgetFunctionProvider>();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/PluginFacades/WidgetFunctionWrapper.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Functions.Foundation.PluginFacades\r\n{\r\n    /// <summary>\r\n    /// This class is used for caching exceptions from plugins and hadling them correcty\r\n    /// </summary>\r\n    internal sealed class WidgetFunctionWrapper : IWidgetFunction, IFunctionInitializationInfo\r\n    {\r\n        private IWidgetFunction _widgetFunctionToWrap;\r\n\r\n\r\n        internal WidgetFunctionWrapper(IWidgetFunction widgetFunctionToWrap)\r\n        {\r\n            _widgetFunctionToWrap = widgetFunctionToWrap;\r\n        }\r\n\r\n\r\n\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _widgetFunctionToWrap.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string Namespace\r\n        {\r\n            get\r\n            {\r\n                return _widgetFunctionToWrap.Namespace;\r\n            }\r\n        }\r\n\r\n\r\n        public string Description { get { return _widgetFunctionToWrap.Description; } }\r\n\r\n\r\n        public Type ReturnType\r\n        {\r\n            get\r\n            {\r\n                return _widgetFunctionToWrap.ReturnType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<ParameterProfile> ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                if (_widgetFunctionToWrap.ParameterProfiles != null)\r\n                {\r\n                    return _widgetFunctionToWrap.ParameterProfiles;\r\n                }\r\n\r\n                return new ParameterProfile[] { };\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            return _widgetFunctionToWrap.GetWidgetMarkup(parameters, label, help, bindingSourceName);\r\n        }\r\n\r\n\r\n\r\n        public EntityToken EntityToken\r\n        {\r\n            get\r\n            {\r\n                return _widgetFunctionToWrap.EntityToken;\r\n            }\r\n        }\r\n\r\n\r\n        bool IFunctionInitializationInfo.FunctionInitializedCorrectly\r\n        {\r\n            get\r\n            {\r\n                if (!(_widgetFunctionToWrap is IFunctionInitializationInfo))\r\n                {\r\n                    return true;\r\n                }\r\n                return ((IFunctionInitializationInfo)_widgetFunctionToWrap).FunctionInitializedCorrectly;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/PluginFacades/XslExtensionsProviderPluginFacade.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Functions.Foundation.PluginFacades.Runtime;\r\nusing Composite.Functions.Plugins.XslExtensionsProvider;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Functions.Foundation.PluginFacades\r\n{\r\n\tinternal static class XslExtensionsProviderPluginFacade\r\n\t{\r\n        static Resources _resources = new Resources();\r\n\r\n        static XslExtensionsProviderPluginFacade()\r\n        {\r\n            Resources.Initialize(_resources);\r\n        }\r\n\r\n\r\n\t    public static List<Pair<string, object>> CreateExtensions(string providerName)\r\n\t    {\r\n\t        return GetProvider(providerName).CreateExtensions();\r\n\t    }\r\n\r\n        private static IXslExtensionsProvider GetProvider(string providerName)\r\n        {\r\n            Resources resources = _resources;\r\n\r\n            IXslExtensionsProvider provider = resources.ProviderCache[providerName];\r\n            if(provider != null)\r\n            {\r\n                return provider;\r\n            }\r\n\r\n            lock(resources.SyncRoot)\r\n            {\r\n                provider = resources.ProviderCache[providerName];\r\n                if (provider != null)\r\n                {\r\n                    return provider;\r\n                }\r\n\r\n                provider = resources.Factory.Create(providerName);\r\n                resources.ProviderCache[providerName] = provider;\r\n            }\r\n\r\n            return provider;\r\n        }\r\n\r\n        private sealed class Resources\r\n        {\r\n            public readonly object SyncRoot = new object();\r\n            public readonly XslExtensionsProviderFactory Factory = new XslExtensionsProviderFactory();\r\n            public Hashtable<string, IXslExtensionsProvider> ProviderCache { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.ProviderCache = new Hashtable<string, IXslExtensionsProvider>();\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/WidgetFunctionContainer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Functions.Foundation.PluginFacades;\r\nusing Composite.Functions.Plugins.WidgetFunctionProvider.Runtime;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Functions.Foundation\r\n{\r\n    internal sealed class WidgetFunctionContainer : MetaFunctionContainer\r\n    {\r\n        internal WidgetFunctionContainer(List<string> excludedFunctionNames)\r\n            : base(excludedFunctionNames)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<string> OnGetProviderNames()\r\n        {\r\n            if ((ConfigurationServices.ConfigurationSource != null) &&\r\n                (ConfigurationServices.ConfigurationSource.GetSection(WidgetFunctionProviderSettings.SectionName) != null))\r\n            {\r\n                WidgetFunctionProviderSettings functionProviderSettings = ConfigurationServices.ConfigurationSource.GetSection(WidgetFunctionProviderSettings.SectionName) as WidgetFunctionProviderSettings;\r\n\r\n                return functionProviderSettings.WidgetFunctionProviderPlugins.Select(plugin => plugin.Name);\r\n            }\r\n            else\r\n            {\r\n                LoggingService.LogError(\"FunctionProviderRegistry\", string.Format(\"Failed to load the configuration section '{0}' from the configuration\", WidgetFunctionProviderSettings.SectionName));\r\n\r\n                return new List<string>();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<IMetaFunction> OnGetFunctionsFromProvider(string providerName, FunctionTypesToReturn functionTypesToReturn)\r\n        {\r\n            IEnumerable<IMetaFunction> functions = new List<IMetaFunction>();\r\n\r\n            switch (functionTypesToReturn)\r\n            {\r\n                case FunctionTypesToReturn.StaticDependentFunctions:\r\n                    try\r\n                    {\r\n                        functions = WidgetFunctionProviderPluginFacade.Functions(providerName).Cast<IMetaFunction>();\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        LoggingService.LogCritical(\"FunctionProviderRegistry\", ex);\r\n                    }\r\n                    break;\r\n                case FunctionTypesToReturn.DynamicDependentOnlyFunctions:\r\n                    try\r\n                    {\r\n                        functions = WidgetFunctionProviderPluginFacade.DynamicTypeDependentFunctions(providerName).Cast<IMetaFunction>();\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        LoggingService.LogCritical(\"FunctionProviderRegistry\", ex);\r\n                    }\r\n                    break;\r\n                case FunctionTypesToReturn.AllFunctions:\r\n                    try\r\n                    {\r\n                        functions = WidgetFunctionProviderPluginFacade.Functions(providerName).Cast<IMetaFunction>();\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        LoggingService.LogCritical(\"FunctionProviderRegistry\", ex);\r\n                    }\r\n\r\n                    try\r\n                    {\r\n                        functions = functions.Concat(WidgetFunctionProviderPluginFacade.DynamicTypeDependentFunctions(providerName).Cast<IMetaFunction>());\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        LoggingService.LogCritical(\"FunctionProviderRegistry\", ex);\r\n                    }\r\n                    break;\r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n\r\n            return functions;\r\n        }\r\n\r\n\r\n\r\n        protected override void OnFunctionsAdded(List<string> functionNames, bool fireEvents)\r\n        {\r\n            if (fireEvents)\r\n            {\r\n                FunctionEventSystemFacade.FireWidgetFunctionAddedEvent(new WidgetFunctionsAddedEventArgs(functionNames));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected override void OnFunctionsRemoved(List<string> functionNames)\r\n        {\r\n            FunctionEventSystemFacade.FireWidgetFunctionRemovedEvent(new WidgetFunctionsRemovedEventArgs(functionNames));\r\n        }\r\n\r\n\r\n\r\n        protected override string FunctionType\r\n        {\r\n            get { return \"WidgetFunction\"; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Foundation/XslExtensionsProviderRegistry.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Functions.Plugins.XslExtensionsProvider.Runtime;\r\n\r\nnamespace Composite.Functions.Foundation\r\n{\r\n\tinternal static class XslExtensionsProviderRegistry\r\n\t{\r\n        public static IEnumerable<string> XslExtensionsProviderNames \r\n        { \r\n            get\r\n            {\r\n                XslExtensionsProviderSettings settings = \r\n                    ConfigurationServices.ConfigurationSource.GetSection(XslExtensionsProviderSettings.SectionName) \r\n                    as XslExtensionsProviderSettings;\r\n\r\n                return settings.XslExtensionProviders.Select(provider => provider.Name);\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>\r\n    /// Adds a desctiotion about a C1 Function.\r\n    /// \r\n    /// Different C1 Function providers let developers create new C1 Functions by creating artifacts like static funtions in C#,\r\n    /// Razor Web Pages, User Controls etc. These C1 Functions can have descriptions and this attribute let you control this\r\n    /// description.\r\n    /// \r\n    /// The use of this attribute is relative to the C1 Function provider being used.\r\n    /// </summary>\r\n    /// <example>\r\n    /// Here is an example of how to use <see cref=\"FunctionAttribute\" />:\r\n    /// <code>\r\n    /// [Function(Description=\"The description goes here\")]\r\n    /// public static int GetItemCount() \r\n    /// { \r\n    ///     // more code here\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    /// <example>\r\n    /// Here is an example of how to use <see cref=\"FunctionAttribute\" /> to annotate a class:\r\n    /// <code>\r\n    /// [FunctionParameter(Label=\"Item count\", DefaultValue=10)]\r\n    /// public int ItemCount { get; set; } \r\n    /// </code>\r\n    /// Note that <see cref=\"P:Composite.Functions.FunctionParameterAttribute.Name\" /> is not expected when <see cref=\"FunctionParameterAttribute\" /> is used this way.\r\n    /// </example>\r\n    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]\r\n\tpublic sealed class FunctionAttribute : Attribute\r\n\t{\r\n        /// <summary>\r\n        /// Describe a function for use in the C1 Function system. \r\n        /// </summary>\r\n        public FunctionAttribute()\r\n        {\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The description of the function.\r\n        /// </summary>\r\n        public string Description\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionCallEditorManager.cs",
    "content": "﻿using System.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class FunctionCallEditorManager\r\n    {\r\n        private static readonly Hashtable<string, FunctionCallEditorSettings> _customEditorSettings = new Hashtable<string, FunctionCallEditorSettings>();\r\n\r\n        /// <summary>\r\n        /// Returns a relative path a to a custom funtion call editor for the specified function.\r\n        /// </summary>\r\n        /// <param name=\"functionName\">The function name</param>\r\n        /// <returns>A relative path to a custom call editor, or <value>null</value> if no custom editor was defined.</returns>\r\n        public static FunctionCallEditorSettings GetCustomEditorSettings(string functionName)\r\n        {\r\n            var settings = _customEditorSettings[functionName];\r\n            if (settings != null)\r\n            {\r\n                return settings;\r\n            }\r\n\r\n            using (var c = new DataConnection())\r\n            {\r\n                var mapping = c.Get<ICustomFunctionCallEditorMapping>().FirstOrDefault(e => e.FunctionName == functionName);\r\n\r\n                if (mapping != null)\r\n                {\r\n                    return new FunctionCallEditorSettings\r\n                    {\r\n                        Url = UrlUtils.ResolvePublicUrl(mapping.CustomEditorPath),\r\n                        Width = mapping.Width,\r\n                        Height = mapping.Height\r\n                    };\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers the custom call editor.\r\n        /// </summary>\r\n        /// <param name=\"functionName\">Name of the function.</param>\r\n        /// <param name=\"tildeBasedPath\">A tilde based website path, like ~/Composite/custom.aspx</param>\r\n        public static void RegisterCustomCallEditor(string functionName, string tildeBasedPath)\r\n        {\r\n            RegisterCustomCallEditor(functionName, tildeBasedPath, null, null);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Registers the custom call editor.\r\n        /// </summary>\r\n        /// <param name=\"functionName\">Name of the function.</param>\r\n        /// <param name=\"tildeBasedPath\">A tilde based website path, like ~/Composite/custom.aspx</param>\r\n        /// <param name=\"width\">The width.</param>\r\n        /// <param name=\"height\">The height.</param>\r\n        public static void RegisterCustomCallEditor(string functionName, string tildeBasedPath, int? width, int? height)\r\n        {\r\n            Verify.ArgumentCondition(tildeBasedPath.StartsWith(\"~\"), \"tildeBasedPath\", \"Must start with tilde (~)\");\r\n\r\n            lock (_customEditorSettings)\r\n            {\r\n                _customEditorSettings[functionName] = new FunctionCallEditorSettings\r\n                    {\r\n                        Url = UrlUtils.ResolvePublicUrl(tildeBasedPath),\r\n                        Width = width,\r\n                        Height = height\r\n                    };\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionCallEditorSettings.cs",
    "content": "﻿namespace Composite.Functions\r\n{\r\n    /// <summary>\r\n    /// Settings for custom function call editor\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class FunctionCallEditorSettings\r\n    {\r\n        /// <summary>\r\n        /// Gets the URL.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The URL.\r\n        /// </value>\r\n        public string Url { get; internal set; }\r\n\r\n        /// <summary>\r\n        /// Gets the height.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The height.\r\n        /// </value>\r\n        public int? Height { get; internal set; }\r\n\r\n        /// <summary>\r\n        /// Gets the width.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The width.\r\n        /// </value>\r\n        public int? Width { get; internal set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionContextContainer.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Threading;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// Context for evaluating function calls. Functions:\r\n    /// 1) Container for embedded <see cref=\"Control\"/>-s \r\n    /// 2) Passing parameters into nested function calls. Applicable in xml template rendering logic.\r\n    /// 3) Suppressing exceptions from XHTML functions.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class FunctionContextContainer\r\n    {\r\n        private readonly ParameterList _parameterList;\r\n        private readonly Dictionary<string, object> _parameterDictionary;\r\n\r\n        internal bool ExceptionsSuppressed { get; private set; }\r\n\r\n        #region constructors\r\n        /// <exclude />\r\n        public FunctionContextContainer()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public FunctionContextContainer(ParameterList parameterList)\r\n        {\r\n            _parameterList = parameterList;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public FunctionContextContainer(Dictionary<string, object> parameterDictionary)\r\n        {\r\n            _parameterDictionary = parameterDictionary;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public FunctionContextContainer(FunctionContextContainer inheritFromContainer, Dictionary<string, object> parameterDictionary)\r\n        {\r\n            _parameterDictionary = parameterDictionary;\r\n            this.XEmbedableMapper = inheritFromContainer.XEmbedableMapper;\r\n            this.SuppressXhtmlExceptions = inheritFromContainer.SuppressXhtmlExceptions;\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Used for embedding ASP.NET controls into xhtml markup.\r\n        /// </summary>\r\n        public IFunctionResultToXEmbedableMapper XEmbedableMapper { get; set; }\r\n\r\n        /// <summary>\r\n        /// When set to <value>True</value>, exceptions from C1 functions which results are rendered into xhtml will \r\n        /// be caught, logged and the result xhtml  will contain an error description element.\r\n        /// </summary>\r\n        public bool SuppressXhtmlExceptions { get; set; }\r\n\r\n        /// <exclude />\r\n        public object GetParameterValue(string parameterName, Type targetType)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(parameterName, \"parameterName\");\r\n\r\n            if (_parameterList != null)\r\n            {\r\n                return _parameterList.GetParameter(parameterName, targetType);\r\n            }\r\n\r\n            if (_parameterDictionary != null)\r\n            {\r\n                Verify.That(_parameterDictionary.ContainsKey(parameterName), \"Parameter '{0}' hasn't been defined.\", parameterName);\r\n\r\n                object value = _parameterDictionary[parameterName];\r\n\r\n                if (value != null && !targetType.IsInstanceOfType(value))\r\n                {\r\n                    return ValueTypeConverter.Convert(value, targetType);\r\n                }\r\n\r\n                return value;\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Unable to get parameter values. This context has been constructed without parameters.\");\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public object MakeXEmbedable(object resultObject)\r\n        {\r\n            if (this.XEmbedableMapper != null)\r\n            {\r\n                XNode resultElement;\r\n                if (this.XEmbedableMapper.TryMakeXEmbedable(this, resultObject, out resultElement))\r\n                {\r\n                    return resultElement;\r\n                }\r\n            }\r\n\r\n            if (resultObject is XDocument)\r\n            {\r\n                return ((XDocument)resultObject).Root;\r\n            }\r\n\r\n            return resultObject;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Checks whether an exception has to be re-thrown, if not - writes it to the log \r\n        /// and returns markup that should be inserted as function's result.\r\n        /// </summary>\r\n        /// <param name=\"functionName\">The name of the function</param>\r\n        /// <param name=\"exception\">The exception</param>\r\n        /// <param name=\"logTitle\">The log entry title.</param>\r\n        /// <param name=\"errorBoxHtml\">The markup that should be inserted instead of the function call</param>\r\n        /// <returns><value>True</value> if the exception has to be re-thrown, <value>False</value> otherwise.</returns>\r\n        public bool ProcessException(string functionName, Exception exception, string logTitle, out XElement errorBoxHtml)\r\n        {\r\n            if (!SuppressXhtmlExceptions\r\n                || exception is ThreadAbortException \r\n                || exception is ThreadInterruptedException \r\n                || exception is AppDomainUnloadedException\r\n                || exception is OutOfMemoryException\r\n                || IsHttpException(exception))\r\n            {\r\n                errorBoxHtml = null;\r\n                return false;\r\n            }\r\n\r\n            Log.LogError(\"Function: \" + functionName, exception);\r\n\r\n            errorBoxHtml = XhtmlErrorFormatter.GetErrorDescriptionHtmlElement(exception, functionName);\r\n            ExceptionsSuppressed = true;\r\n\r\n            return true;\r\n        }\r\n\r\n        private bool IsHttpException(Exception exception)\r\n        {\r\n            return (!(exception is HttpCompileException) && exception is HttpException) || (exception.InnerException != null && IsHttpException(exception.InnerException));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionEventSystemFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    internal static class FunctionEventSystemFacade\r\n    {\r\n        internal delegate void FunctionsAddedEventDelegate(FunctionsAddedEventArgs args);\r\n        internal delegate void FunctionsRemovedEventDelegate(FunctionsRemovedEventArgs args);\r\n        internal delegate void WidgetFunctionsAddedEventDelegate(WidgetFunctionsAddedEventArgs args);\r\n        internal delegate void WidgetFunctionsRemovedEventDelegate(WidgetFunctionsRemovedEventArgs args);\r\n\r\n        private static event FunctionsAddedEventDelegate _functionsAddedEvent;\r\n        private static event FunctionsRemovedEventDelegate _functionsRemovedEvent;\r\n        private static event WidgetFunctionsAddedEventDelegate _widgetFunctionsAddedEvent;\r\n        private static event WidgetFunctionsRemovedEventDelegate _widgetFunctionsRemovedEvent;\r\n\r\n        private static object _lock = new object();\r\n\r\n\r\n        static FunctionEventSystemFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        public static void SubscribeToFunctionsAddedEvent(FunctionsAddedEventDelegate functionsAddedEventDelegate)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _functionsAddedEvent += functionsAddedEventDelegate;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void SubscribeToFunctionsRemovedEvent(FunctionsRemovedEventDelegate functionsRemovedEventDelegate)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _functionsRemovedEvent += functionsRemovedEventDelegate;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void SubscribeToWidgetFunctionsAddedEvent(WidgetFunctionsAddedEventDelegate widgetFunctionsAddedEventDelegate)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _widgetFunctionsAddedEvent += widgetFunctionsAddedEventDelegate;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void SubscribeToWidgetFunctionsRemovedEvent(WidgetFunctionsRemovedEventDelegate widgetFunctionsRemovedEventDelegate)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _widgetFunctionsRemovedEvent += widgetFunctionsRemovedEventDelegate;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void FireFunctionAddedEvent(FunctionsAddedEventArgs functionsAddedEventArgs)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (_functionsAddedEvent != null)\r\n                {\r\n                    FunctionsAddedEventDelegate functionsAddedEvent = _functionsAddedEvent;\r\n\r\n                    functionsAddedEvent(functionsAddedEventArgs);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void FireFunctionRemovedEvent(FunctionsRemovedEventArgs functionsRemovedEventArgs)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (_functionsRemovedEvent != null)\r\n                {\r\n                    FunctionsRemovedEventDelegate functionsRemovedEvent = _functionsRemovedEvent;\r\n\r\n                    functionsRemovedEvent(functionsRemovedEventArgs);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void FireWidgetFunctionAddedEvent(WidgetFunctionsAddedEventArgs widgetFunctionsAddedEventArgs)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (_widgetFunctionsAddedEvent != null)\r\n                {\r\n                    WidgetFunctionsAddedEventDelegate widgetFunctionsAddedEvent = _widgetFunctionsAddedEvent;\r\n\r\n                    widgetFunctionsAddedEvent(widgetFunctionsAddedEventArgs);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void FireWidgetFunctionRemovedEvent(WidgetFunctionsRemovedEventArgs widgetFunctionsRemovedEventArgs)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (_widgetFunctionsRemovedEvent != null)\r\n                {\r\n                    WidgetFunctionsRemovedEventDelegate widgetFunctionsRemovedEvent = _widgetFunctionsRemovedEvent;\r\n\r\n                    widgetFunctionsRemovedEvent(widgetFunctionsRemovedEventArgs);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void Flush()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _functionsAddedEvent = null;\r\n                _functionsRemovedEvent = null;\r\n                _widgetFunctionsAddedEvent = null;\r\n                _widgetFunctionsRemovedEvent = null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            Flush();\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n    internal sealed class FunctionsAddedEventArgs : EventArgs\r\n    {\r\n        internal FunctionsAddedEventArgs(List<string> functionsAdded)\r\n        {\r\n            this.FunctionsAdded = functionsAdded;\r\n        }\r\n\r\n\r\n        public List<string> FunctionsAdded\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class FunctionsRemovedEventArgs : EventArgs\r\n    {\r\n        internal FunctionsRemovedEventArgs(List<string> functionsRemoved)\r\n        {\r\n            this.FunctionsRemoved = functionsRemoved;\r\n        }\r\n\r\n\r\n        public List<string> FunctionsRemoved\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class WidgetFunctionsAddedEventArgs : EventArgs\r\n    {\r\n        internal WidgetFunctionsAddedEventArgs(List<string> widgetFunctionsAdded)\r\n        {\r\n            this.WidgetFunctionsAdded = widgetFunctionsAdded;\r\n        }\r\n\r\n\r\n        public List<string> WidgetFunctionsAdded\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class WidgetFunctionsRemovedEventArgs : EventArgs\r\n    {\r\n        internal WidgetFunctionsRemovedEventArgs(List<string> widgetFunctionsRemoved)\r\n        {\r\n            this.WidgetFunctionsRemoved = widgetFunctionsRemoved;\r\n        }\r\n\r\n\r\n        public List<string> WidgetFunctionsRemoved\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionFacade.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class FunctionFacade\r\n    {\r\n        /// <exclude />\r\n        public static List<string> FunctionNames\r\n        {\r\n            get\r\n            {\r\n                return MetaFunctionProviderRegistry.FunctionNames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<string> WidgetFunctionNames\r\n        {\r\n            get\r\n            {\r\n                return MetaFunctionProviderRegistry.WidgetFunctionNames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IFunction GetFunction(string name)\r\n        {\r\n            return MetaFunctionProviderRegistry.GetFunction(name);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetFunction(out IMetaFunction foundFunction, string name, Type functionType)\r\n        {\r\n            if (functionType == typeof(IFunction))\r\n            {\r\n                if (MetaFunctionProviderRegistry.FunctionNames.Contains(name))\r\n                {\r\n                    foundFunction = GetFunction(name);\r\n                    return true;\r\n                }\r\n\r\n                foundFunction = null;\r\n                return false;\r\n            }\r\n\r\n\r\n            if (functionType == typeof(IWidgetFunction))\r\n            {\r\n                if (MetaFunctionProviderRegistry.WidgetFunctionNames.Contains(name))\r\n                {\r\n                    foundFunction = GetWidgetFunction(name);\r\n                    return true;\r\n                }\r\n\r\n                foundFunction = null;\r\n                return false;\r\n            }\r\n\r\n            throw new ArgumentException(\"Type of function must be IFunction or IWidgetFunction\");\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetFunction(out IFunction foundFunction, string name)\r\n        {\r\n            if (MetaFunctionProviderRegistry.FunctionNames.Contains(name))\r\n            {\r\n                foundFunction = GetFunction(name);\r\n                return true;\r\n            }\r\n            \r\n            foundFunction = null;\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool TryGetWidgetFunction(out IWidgetFunction foundFunction, string name)\r\n        {\r\n            if (MetaFunctionProviderRegistry.WidgetFunctionNames.Contains(name))\r\n            {\r\n                foundFunction = GetWidgetFunction(name);\r\n                return true;\r\n            }\r\n            \r\n            foundFunction = null;\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IWidgetFunction GetWidgetFunction(string name)\r\n        {\r\n            return MetaFunctionProviderRegistry.GetWidgetFunction(name);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<IFunction> GetFunctionsByProvider(string providerName)\r\n        {\r\n            foreach (string functionName in MetaFunctionProviderRegistry.FunctionNamesByProviderName(providerName))\r\n            {\r\n                yield return MetaFunctionProviderRegistry.GetFunction(functionName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetFunctionNamesByProvider(string providerName)\r\n        {\r\n            return MetaFunctionProviderRegistry.FunctionNamesByProviderName(providerName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetFunctionNamesByType(Type supportedType)\r\n        {\r\n            return MetaFunctionProviderRegistry.GetFunctionNamesByType(supportedType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetWidgetFunctionNamesByType(Type supportedType)\r\n        {\r\n            return MetaFunctionProviderRegistry.GetWidgetFunctionNamesByType(supportedType);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Type> FunctionSupportedTypes\r\n        {\r\n            get\r\n            {\r\n                return MetaFunctionProviderRegistry.FunctionSupportedTypes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<Type> WidgetFunctionSupportedTypes\r\n        {\r\n            get\r\n            {\r\n                return MetaFunctionProviderRegistry.WidgetFunctionSupportedTypes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool FunctionExists(string namespaceName, string name)\r\n        {\r\n            IFunction fun;\r\n            \r\n            bool exists = FunctionFacade.TryGetFunction(out fun, StringExtensionMethods.CreateNamespace(namespaceName, name));\r\n\r\n            return exists;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static BaseRuntimeTreeNode BuildTree(IFunction function, IDictionary<string, object> parameters)\r\n        {\r\n            List<BaseParameterRuntimeTreeNode> parameterNodes = new List<BaseParameterRuntimeTreeNode>();\r\n\r\n            if (parameters != null)\r\n            {\r\n                foreach (KeyValuePair<string, object> kvp in parameters)\r\n                {\r\n                    parameterNodes.Add(new ConstantObjectParameterRuntimeTreeNode(kvp.Key, kvp.Value));\r\n                }\r\n            }\r\n\r\n            return new FunctionRuntimeTreeNode(function, parameterNodes);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static BaseRuntimeTreeNode BuildTree(XElement element)\r\n        {\r\n            return FunctionTreeBuilder.Build(element);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static T Execute<T>(IFunction function, IDictionary<string, object> parameters)\r\n        {\r\n            var functionContextContainer = new FunctionContextContainer();\r\n\r\n            return Execute<T>(function, parameters, functionContextContainer);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static T Execute<T>(IFunction function, IDictionary<string, object> parameters, FunctionContextContainer functionContextContainer)\r\n        {\r\n            BaseRuntimeTreeNode node = BuildTree(function, parameters);\r\n\r\n            return (T)node.GetValue(functionContextContainer);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static T Execute<T>(IFunction function)\r\n        {\r\n            Dictionary<string, object> parameters = new Dictionary<string, object>();\r\n            FunctionContextContainer container = new FunctionContextContainer();\r\n            return Execute<T>(function, parameters, container);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static T Execute<T>(IFunction function, System.Collections.Specialized.NameValueCollection parameterValues)\r\n        {\r\n            Dictionary<string, object> parameters = new Dictionary<string, object>();\r\n\r\n            foreach (var parameterName in parameterValues.AllKeys)\r\n            {\r\n                if (parameterName != null && parameterValues[parameterName] != null)\r\n                {\r\n                    parameters.Add(parameterName, parameterValues[parameterName]);\r\n                }\r\n            }\r\n\r\n            FunctionContextContainer container = new FunctionContextContainer();\r\n            return Execute<T>(function, parameters, container);\r\n        }\r\n\r\n\r\n\r\n        //public static XElement GetWidgetMarkup(IWidgetFunction widgetFunction, Type targetType, IDictionary<string, object> parameters, string label, HelpDefinition helpDefinition, string bindingSourceName, FunctionContextContainer functionContextContainer)\r\n        //{\r\n        //    List<BaseParameterRuntimeTreeNode> parameterNodes = new List<BaseParameterRuntimeTreeNode>();\r\n\r\n        //    if (parameters != null)\r\n        //    {\r\n        //        foreach (KeyValuePair<string, object> kvp in parameters)\r\n        //        {\r\n        //            parameterNodes.Add(new ConstantObjectParameterRuntimeTreeNode(kvp.Key, kvp.Value));\r\n        //        }\r\n        //    }\r\n\r\n        //    BaseRuntimeTreeNode node = new WidgetFunctionRuntimeTreeNode(widgetFunction, label, helpDefinition, bindingSourceName, parameterNodes);\r\n\r\n        //    return (XElement)node.GetValue(functionContextContainer);\r\n        //}\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement GetWidgetMarkup(IWidgetFunction widgetFunction, Type targetType, IEnumerable<BaseParameterRuntimeTreeNode> parameters, string label, HelpDefinition helpDefinition, string bindingSourceName, FunctionContextContainer functionContextContainer)\r\n        {\r\n            List<BaseParameterRuntimeTreeNode> parameterNodes = new List<BaseParameterRuntimeTreeNode>();\r\n\r\n            if (parameters != null)\r\n            {\r\n                foreach (BaseParameterRuntimeTreeNode parameterNode in parameters)\r\n                {\r\n                    parameterNodes.Add(parameterNode);\r\n                }\r\n            }\r\n\r\n            BaseRuntimeTreeNode node = new WidgetFunctionRuntimeTreeNode(widgetFunction, label, helpDefinition, bindingSourceName, parameterNodes);\r\n\r\n            return (XElement)node.GetValue(functionContextContainer);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string BuildUniqueFunctionName(string functionNamespace, string nameStem)\r\n        {\r\n            string nameCandidate = nameStem;\r\n            int i = 1;\r\n            while (FunctionFacade.FunctionNames.Contains(string.Format(\"{0}.{1}\", functionNamespace, nameCandidate)))\r\n            {\r\n                i++;\r\n                nameCandidate = string.Format(\"{0}{1}\", nameStem, i);\r\n            }\r\n\r\n            return nameCandidate;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetFunctionCompositionName(string functionNamespace, string name)\r\n        {\r\n            return StringExtensionMethods.CreateNamespace(functionNamespace, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionParameterAttribute.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>\r\n    /// Adds information about C1 Function parameters like label, help text, default value and custom widget markup.\r\n    /// \r\n    /// Different C1 Function providers let developers create new C1 Functions by creating artifacts like static funtions in C#,\r\n    /// Razor Web Pages, User Controls etc. These C1 Functions can have parameters, typically defined as actual parameters (for\r\n    /// static functions) or as public get/set propeties. This attribute signal that a C1 Function parameter is being defined and\r\n    /// add label, help etc.\r\n    /// \r\n    /// The use of this attribute is relative to the C1 Function provider being used.\r\n    /// </summary>\r\n    /// <example>\r\n    /// Here is an example of how to use <see cref=\"FunctionParameterAttribute\" /> to annotate multiple parameters of a function:\r\n    /// <code>\r\n    /// [FunctionParameter(Name=\"searchTerm\", Label=\"Search term\", Help=\"One or more keywords to search for\")]\r\n    /// [FunctionParameter(Name=\"filter\", Label=\"Filter\", Help=\"Filter to apply to data before searching for search term\", DefaultValue=null)]    \r\n    /// public static int GetItemCount( string searchTerm, Expression&lt;Func&lt;IMyDataType,bool&gt;&gt; filter ) \r\n    /// { \r\n    ///     if (filter == null ) filter = _defaultFilter;\r\n    ///     // more code here\r\n    /// }\r\n    /// </code>\r\n    /// Note that <see cref=\"P:Composite.Functions.FunctionParameterAttribute.Name\" /> is required when <see cref=\"FunctionParameterAttribute\" /> is used this way.\r\n    /// </example>\r\n    /// <example>\r\n    /// Here is an example of how to use <see cref=\"FunctionParameterAttribute\" /> to annotate a property:\r\n    /// <code>\r\n    /// [FunctionParameter(Label=\"Item count\", DefaultValue=10)]\r\n    /// public int ItemCount { get; set; } \r\n    /// </code>\r\n    /// Note that <see cref=\"P:Composite.Functions.FunctionParameterAttribute.Name\" /> is not expected when <see cref=\"FunctionParameterAttribute\" /> is used this way.\r\n    /// </example>\r\n    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true)]\r\n\tpublic sealed class FunctionParameterAttribute : Attribute\r\n\t{\r\n        private object _defaultValue;\r\n\r\n        /// <summary>\r\n        /// Describe a function parameter for use in the C1 Function system. \r\n        /// </summary>\r\n        public FunctionParameterAttribute()\r\n        {\r\n            this.Name = null;\r\n            this.HasDefaultValue = false;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The name of the function parameter being described. This should match the parameter name in the method.\r\n        /// </summary>\r\n        public string Name\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Human readable label for this parameter\r\n        /// </summary>\r\n        public string Label\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Human readable help for this parameter\r\n        /// </summary>\r\n        public string Help\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Set this property to control the form input field used to set the parameters value. \r\n        /// </summary>\r\n        public string WidgetMarkup\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the name of the widget function.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The name of the widget function.\r\n        /// </value>\r\n        public string WidgetFunctionName\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the widget factory method.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The widget factory method.\r\n        /// </value>\r\n        public string WidgetFactoryMethod\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets or sets the widget factory class.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The widget factory class.\r\n        /// </value>\r\n        public Type WidgetFactoryClass\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Optional. Default value that should be assigned to the parameter if not specified by the caller. You can use 'null' for complex objects that can not be expressed in attribute code and the check for null in the code.\r\n        /// </summary>\r\n        public object DefaultValue\r\n        {\r\n            get\r\n            {\r\n                return _defaultValue;\r\n            }\r\n            set\r\n            {\r\n                _defaultValue = value;\r\n                HasDefaultValue = true;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Allows to hide the parameter in the \"simple view\" mode of function call editing.\r\n        /// Will be ignored is the field is requires and does not have a value or a default value.\r\n        /// </summary>\r\n        public bool HideInSimpleView { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicate if this parameter definition has a default value or not.\r\n        /// </summary>\r\n        public bool HasDefaultValue\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicate if Name is defined for this attribute.\r\n        /// </summary>\r\n        public bool HasName\r\n        {\r\n            get { return !string.IsNullOrWhiteSpace(this.Name); }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicate if Label is defined for this attribute.\r\n        /// </summary>\r\n        public bool HasLabel\r\n        {\r\n            get { return !string.IsNullOrWhiteSpace(this.Label); }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicate if Help is defined for this attribute.\r\n        /// </summary>\r\n        public bool HasHelp\r\n        {\r\n            get { return !string.IsNullOrWhiteSpace(this.Help); }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicate if WidgetMarkup is defined for this attribute.\r\n        /// </summary>\r\n        public bool HasWidgetMarkup\r\n        {\r\n            get\r\n            {\r\n                return !string.IsNullOrWhiteSpace(this.WidgetMarkup)\r\n                       || !string.IsNullOrWhiteSpace(this.WidgetFunctionName)\r\n                       || !string.IsNullOrWhiteSpace(this.WidgetFactoryMethod);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the widget markup\r\n        /// </summary>\r\n        /// <param name=\"owner\">Class that contains</param>\r\n        /// <param name=\"parameterProperty\">The parameter property.</param>\r\n        /// <returns></returns>\r\n        public WidgetFunctionProvider GetWidgetFunctionProvider(Type owner, PropertyInfo parameterProperty)\r\n        {\r\n            if(!HasWidgetMarkup)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if(!WidgetMarkup.IsNullOrEmpty())\r\n            {\r\n                var markup = XElement.Parse(WidgetMarkup);\r\n\r\n                return new WidgetFunctionProvider(markup);\r\n            }\r\n\r\n            if(!WidgetFunctionName.IsNullOrEmpty())\r\n            {\r\n                return new WidgetFunctionProvider(WidgetFunctionName);\r\n            }\r\n\r\n            if(!WidgetFactoryMethod.IsNullOrEmpty())\r\n            {\r\n                Type factoryType = WidgetFactoryClass ?? owner;\r\n                Verify.IsNotNull(factoryType, \"WidgetFactoryClass isn't defined\");\r\n\r\n                var methodInfo = factoryType.GetMethod(WidgetFactoryMethod, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);\r\n                Verify.IsNotNull(methodInfo,  \"Failed to get static method '{0}' on type '{1}'\", WidgetFactoryMethod, factoryType.FullName);\r\n\r\n                object result = null;\r\n\r\n                var parameters = methodInfo.GetParameters();\r\n\r\n                if(parameters.Length == 0)\r\n                {\r\n                    result = methodInfo.Invoke(null, new object[0]);\r\n                } \r\n                else if(parameters.Length == 1 && parameters[0].ParameterType == typeof(string))\r\n                {\r\n                    result = methodInfo.Invoke(null, new object[] { Name });\r\n                } \r\n                else if (parameters.Length == 1 && parameters[0].ParameterType == typeof(PropertyInfo))\r\n                {\r\n                    Verify.IsNotNull(parameterProperty, \"parameterProperty isn't defined\");\r\n\r\n                    result = methodInfo.Invoke(null, new object[] { parameterProperty });\r\n                } else\r\n                {\r\n                    throw new InvalidOperationException(\"Unknown method signature\");\r\n                }\r\n\r\n                if (result == null) return null;\r\n\r\n                if(result is XElement)\r\n                {\r\n                    return new WidgetFunctionProvider(result as XElement);\r\n                }\r\n\r\n                if(result is IWidgetFunction)\r\n                {\r\n                    return new WidgetFunctionProvider(result as IWidgetFunction);\r\n                }\r\n\r\n                if(result is WidgetFunctionProvider)\r\n                {\r\n                    return result as WidgetFunctionProvider;\r\n                }\r\n                \r\n                throw new InvalidOperationException(\"Unexpected widget type '{0}'\".FormatWith(result.GetType()));\r\n            }\r\n\r\n            throw new InvalidOperationException(\"This line should not be reachable\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionParameterDescriptionAttribute.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>\r\n    /// Add information about parameters to functions callable via the \"C# Function\" feature. \r\n    /// </summary>\r\n    /// <remarks>\r\n    /// This class has been marked as obsolete. Use <see cref=\"FunctionParameterAttribute\" />.\r\n    /// </remarks>\r\n    /// <example>\r\n    /// Here is an example of how to use <see cref=\"FunctionParameterDescriptionAttribute\" />\r\n    /// <code>\r\n    /// [FunctionParameterDescription(\"searchTerm\", \"Search term\", \"One or more keywords to search for\")]\r\n    /// [FunctionParameterDescription(\"filter\", \"Filter\", \"Filter to apply to data before searching for search term\", null)]\r\n    /// public static int GetItemCount( string searchTerm, Expression&lt;Func&lt;IMyDataType,bool&gt;&gt; filter ) \r\n    /// { \r\n    ///     if (filter == null ) filter = _defaultFilter;\r\n    ///     // more code here\r\n    /// }\r\n    /// </code>\r\n    /// </example>\r\n    /// <exclude />\r\n    [Obsolete(\"Use FunctionParameterAttribute instead ...\", false)]\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]\r\n\tpublic sealed class FunctionParameterDescriptionAttribute : Attribute\r\n\t{\r\n        /// <summary>\r\n        /// Describe a function parameter for use in the C1 Function system.\r\n        /// </summary>\r\n        /// <param name=\"parameterName\">The programmatic name of the parameter</param>\r\n        /// <param name=\"parameterLabel\">Human readable label</param>\r\n        /// <param name=\"parameterHelpText\">Human readable help text</param>\r\n        public FunctionParameterDescriptionAttribute(string parameterName, string parameterLabel, string parameterHelpText)\r\n        {\r\n            this.ParameterName = parameterName;\r\n            this.ParameterLabel = parameterLabel;\r\n            this.ParameterHelpText = parameterHelpText;\r\n            this.HasDefaultValue = false;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Describe a function parameter for use in the C1 Function system.\r\n        /// </summary>\r\n        /// <param name=\"parameterName\">The programmatic name of the parameter</param>\r\n        /// <param name=\"parameterLabel\">Human readable label</param>\r\n        /// <param name=\"parameterHelpText\">Human readable help text</param>\r\n        /// <param name=\"defaultValue\">Optional. Default value that should be assigned to the parameter if not specified by the caller. You can use 'null' for complex objects that can not be expressed in attribute code and the check for null in the code.</param>\r\n        public FunctionParameterDescriptionAttribute(string parameterName, string parameterLabel, string parameterHelpText, object defaultValue)\r\n            : this(parameterName, parameterLabel, parameterHelpText)\r\n        {\r\n            this.DefaultValue = defaultValue;\r\n            this.HasDefaultValue = true;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// The name of the function parameter being described. This should match the parameter name in the method.\r\n        /// </summary>\r\n        public string ParameterName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Optional. Default value that should be assigned to the parameter if not specified by the caller. You can use 'null' for complex objects that can not be expressed in attribute code and the check for null in the code.\r\n        /// </summary>\r\n        public object DefaultValue\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Human readable label for this parameter\r\n        /// </summary>\r\n        public string ParameterLabel\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Human readable help for this parameter\r\n        /// </summary>\r\n        public string ParameterHelpText\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Indicate if this parameter definition has a default value or not.\r\n        /// </summary>\r\n        public bool HasDefaultValue\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionParameterIgnoreAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>\r\n    /// Put this attribute on properties to make C1 CMS skip them when infering C1 Function parameters from a class.\r\n    /// \r\n    /// If you need a property on your class, but do not want this property to be part of the C1 Function signature use this attrobute.\r\n    /// </summary>\r\n    /// <example>\r\n    /// Here is an example of how to use <see cref=\"FunctionParameterIgnoreAttribute\" /> to make C1 CMS skip a property when infering parameters:\r\n    /// <code>\r\n    /// [FunctionParameterIgnore()]\r\n    /// public int ItemCount { get; set; } \r\n    /// </code>\r\n    /// </example>\r\n    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]\r\n\tpublic sealed class FunctionParameterIgnoreAttribute : Attribute\r\n\t{\r\n        /// <summary>\r\n        /// Declare that a property should be ignored as a C1 Function parameter. \r\n        /// </summary>\r\n        public FunctionParameterIgnoreAttribute()\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionParameterRuntimeTreeNode.cs",
    "content": "using System;\r\nusing System.Threading;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions.Foundation;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FunctionParameterRuntimeTreeNode : BaseParameterRuntimeTreeNode\r\n    {\r\n        private FunctionRuntimeTreeNode _functionNode;\r\n\r\n        /// <exclude />\r\n        public FunctionParameterRuntimeTreeNode(string name, FunctionRuntimeTreeNode functionNode)\r\n            : base(name)\r\n        {\r\n            _functionNode = functionNode;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public FunctionRuntimeTreeNode GetHostedFunction()\r\n        {\r\n            return _functionNode;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override bool ContainsNestedFunctions\r\n        {\r\n            get\r\n            {\r\n                return _functionNode.ContainsNestedFunctions;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            Verify.ArgumentNotNull(contextContainer, \"contextContainer\");\r\n\r\n            return _functionNode.GetValue(contextContainer);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<string> GetAllSubFunctionNames()\r\n        {\r\n            return _functionNode.GetAllSubFunctionNames();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override XElement Serialize()\r\n        {\r\n            // ensure \"f:function\" naming:\r\n            XElement element = XElement.Parse(string.Format(@\"<f:{0} xmlns:f=\"\"{1}\"\" />\", FunctionTreeConfigurationNames.ParamTagName, FunctionTreeConfigurationNames.NamespaceName));\r\n\r\n            element.Add(new XAttribute(FunctionTreeConfigurationNames.NameAttributeName, this.Name));\r\n\r\n            element.Add(_functionNode.Serialize());\r\n\r\n            return element;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionRuntimeTreeNode.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [DebuggerDisplay(\"FunctionRuntimeTreeNode: {_function.Namespace + '.' + _function.Name}\")]\r\n    public sealed class FunctionRuntimeTreeNode : BaseFunctionRuntimeTreeNode\r\n    {\r\n        private readonly IFunction _function;\r\n\r\n        /// <exclude />\r\n        protected override IMetaFunction HostedFunction\r\n        {\r\n            get { return _function; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public FunctionRuntimeTreeNode(IFunction function)\r\n        {\r\n            _function = function;\r\n            this.Parameters = new List<BaseParameterRuntimeTreeNode>();\r\n        }\r\n\r\n\r\n\r\n        internal FunctionRuntimeTreeNode(IFunction function, List<BaseParameterRuntimeTreeNode> parameters)\r\n        {\r\n            _function = function;\r\n            this.Parameters = parameters;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            if (contextContainer == null) throw new ArgumentNullException(\"contextContainer\");\r\n\r\n            string functionName = _function.CompositeName() ?? \"<unknown function>\";\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler(functionName))\r\n            {\r\n                ValidateNotSelfCalling();\r\n\r\n                try\r\n                {\r\n                    var parameters = new ParameterList(contextContainer);\r\n\r\n                    foreach (ParameterProfile parameterProfile in _function.ParameterProfiles)\r\n                    {\r\n                        List<BaseParameterRuntimeTreeNode> parameterTreeNodes = this.Parameters.Where(ptn => ptn.Name == parameterProfile.Name).ToList();\r\n\r\n                        if (parameterTreeNodes.Count > 0)\r\n                        {\r\n                            parameters.AddLazyParameter(parameterProfile.Name, parameterTreeNodes[0], parameterProfile.Type);\r\n                            continue;\r\n                        }\r\n\r\n                        if (parameterProfile.Type.IsGenericType\r\n                            && parameterProfile.Type.GetGenericTypeDefinition() == typeof(NullableDataReference<>))\r\n                        {\r\n                            parameters.AddConstantParameter(parameterProfile.Name, null, parameterProfile.Type);\r\n                            continue;\r\n                        }\r\n\r\n                        if (parameterProfile.IsRequired)\r\n                        {\r\n                            var injectedValue = TryGetInjectedValue(parameterProfile.Type);\r\n\r\n                            if (injectedValue == null)\r\n                            {\r\n                                throw new ArgumentException(\"Missing parameter '{0}' (type of {1})\".FormatWith(parameterProfile.Name, parameterProfile.Type.FullName));\r\n                            }\r\n\r\n                            parameters.AddConstantParameter(parameterProfile.Name, injectedValue, parameterProfile.Type);\r\n                            continue;\r\n                        }\r\n\r\n                        BaseValueProvider valueProvider = parameterProfile.FallbackValueProvider;\r\n\r\n                        object value;\r\n                        try\r\n                        {\r\n                            value = valueProvider.GetValue(contextContainer);\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            throw new InvalidOperationException($\"Failed to get value for parameter '{parameterProfile.Name}' in function '{functionName}'.\", ex);\r\n                        }\r\n                        parameters.AddConstantParameter(parameterProfile.Name, value, parameterProfile.Type, true);\r\n                    }\r\n\r\n                    object result;\r\n\r\n                    IDisposable measurement = null;\r\n                    try\r\n                    {\r\n                        if (functionName != \"Composite.Utils.GetInputParameter\")\r\n                        {\r\n                            var nodeToLog = functionName;\r\n\r\n                            if (_function is IDynamicFunction df && df.PreventFunctionOutputCaching)\r\n                            {\r\n                                nodeToLog += \" (PreventCaching)\";\r\n                            }\r\n\r\n                            measurement = Profiler.Measure(nodeToLog, () => _function.EntityToken);\r\n                        }\r\n\r\n                        result = _function.Execute(parameters, contextContainer);\r\n                    }\r\n                    finally\r\n                    {\r\n                        measurement?.Dispose();\r\n                    }\r\n\r\n                    return result;\r\n                }\r\n                catch(ThreadAbortException)\r\n                {\r\n                    return null; // Nothing will be returned as ThreadAbort will propagate\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw new InvalidOperationException($\"Failed to get value for function '{functionName}'\", ex);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static object TryGetInjectedValue(Type type)\r\n        {\r\n            return ServiceLocator.GetService(type);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<string> GetAllSubFunctionNames()\r\n        {\r\n            var names = new List<string> { _function.CompositeName() };\r\n\r\n            foreach (BaseParameterRuntimeTreeNode parameter in this.Parameters)\r\n            {\r\n                names.AddRange(parameter.GetAllSubFunctionNames());\r\n            }\r\n\r\n            return names.Distinct();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override XElement Serialize()\r\n        {\r\n            // ensure \"f:function\" naming:\r\n            XElement element = XElement.Parse(string.Format(@\"<f:{0} xmlns:f=\"\"{1}\"\" />\", FunctionTreeConfigurationNames.FunctionTagName, FunctionTreeConfigurationNames.NamespaceName));\r\n\r\n            element.Add(new XAttribute(FunctionTreeConfigurationNames.NameAttributeName, _function.CompositeName()));\r\n\r\n            foreach (ParameterProfile parameterProfile in _function.ParameterProfiles)\r\n            {\r\n                BaseParameterRuntimeTreeNode parameterRuntimeTreeNode = this.Parameters.FirstOrDefault(ptn => ptn.Name == parameterProfile.Name);\r\n\r\n                if (parameterRuntimeTreeNode != null)\r\n                {\r\n                    element.Add(parameterRuntimeTreeNode.Serialize());\r\n                }\r\n            }\r\n\r\n            return element;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionTreeBuilder.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions.Foundation;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class FunctionTreeBuilder\r\n    {\r\n        /// <exclude />\r\n        public static BaseRuntimeTreeNode Build(XElement element)\r\n        {\r\n            return Build(element, false);\r\n        }\r\n\r\n        internal static BaseRuntimeTreeNode Build(XElement element, bool ignoreUnusedParameters)\r\n        {\r\n            if (element == null) throw new ArgumentNullException(\"element\");\r\n\r\n            if (element.Name.Namespace != FunctionTreeConfigurationNames.NamespaceName) throw new InvalidOperationException(string.Format(\"The namespace '{0}' is not supported\", element.Name.Namespace));\r\n\r\n\r\n            if (element.Name.LocalName == FunctionTreeConfigurationNames.FunctionTagName)\r\n            {\r\n                return BuildFunctionRuntimeNode(element, ignoreUnusedParameters);\r\n            }\r\n\r\n            if (element.Name.LocalName == FunctionTreeConfigurationNames.WidgetFunctionTagName)\r\n            {\r\n                return BuildWidgetFunctionRuntimeNode(element);\r\n            }\r\n\r\n            if (element.Name.LocalName == FunctionTreeConfigurationNames.ParamTagName)\r\n            {\r\n                return BuildParameterFunctionRuntimeNode(element);\r\n            }\r\n\r\n            throw new InvalidOperationException(string.Format(\"The tag named '{0}' is not supported\", element.Name.LocalName));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static FunctionRuntimeTreeNode BuildFunction(string functionName, Dictionary<string, string> parameters)\r\n        {\r\n            var functionParams = new List<BaseParameterRuntimeTreeNode>();\r\n            foreach (var parameter in parameters)\r\n            {\r\n                functionParams.Add(new ConstantParameterRuntimeTreeNode(parameter.Key, parameter.Value));\r\n            }\r\n\r\n            IFunction function = FunctionFacade.GetFunction(functionName);\r\n\r\n            return new FunctionRuntimeTreeNode(function, functionParams);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionRuntimeTreeNode BuildWidgetFunction(string widgetFunctionName, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n        {\r\n            IWidgetFunction widgetFunction = FunctionFacade.GetWidgetFunction(widgetFunctionName);\r\n\r\n            return new WidgetFunctionRuntimeTreeNode(widgetFunction, label, helpDefinition, bindingSourceName);\r\n        }\r\n\r\n\r\n\r\n        private static FunctionRuntimeTreeNode BuildFunctionRuntimeNode(XElement element, bool ignoreUnusedParameters)\r\n        {\r\n            XAttribute nameAttribute = element.Attribute(FunctionTreeConfigurationNames.NameAttributeName);\r\n            if (nameAttribute == null) throw new InvalidOperationException(string.Format(\"Missing attribute named '{0}'\", FunctionTreeConfigurationNames.NameAttributeName));\r\n\r\n            var parameters = new List<BaseParameterRuntimeTreeNode>();\r\n\r\n            foreach (XElement childElement in element.Elements())\r\n            {\r\n                if (childElement.Name.LocalName == FunctionTreeConfigurationNames.ParamTagName)\r\n                {\r\n                    BaseParameterRuntimeTreeNode parameterTreeNode = BuildParameterFunctionRuntimeNode(childElement);\r\n\r\n                    parameters.Add(parameterTreeNode);\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Only '{0}' tags allowed inside '{1}' tags\", FunctionTreeConfigurationNames.ParamTagName, FunctionTreeConfigurationNames.FunctionTagName));\r\n                }\r\n            }\r\n\r\n\r\n            IFunction function = FunctionFacade.GetFunction(nameAttribute.Value);\r\n\r\n\r\n            if (FunctionInitializedCorrectly(function))\r\n            {\r\n                for (int index = parameters.Count - 1; index >= 0 ; index--)\r\n                {\r\n                    BaseParameterRuntimeTreeNode parameter = parameters[index];\r\n                    if (function.ParameterProfiles.All(pp => pp.Name != parameter.Name))\r\n                    {\r\n                        string message = \"The parameter '{0}' is not defined in the function named '{1}' parameter profiles\"\r\n                            .FormatWith(parameter.Name, function.CompositeName());\r\n\r\n                        if (ignoreUnusedParameters)\r\n                        {\r\n                            Log.LogWarning(typeof(FunctionTreeBuilder).Name, message);\r\n\r\n                            parameters.RemoveAt(index);\r\n                            continue;\r\n                        }\r\n\r\n                        throw new InvalidOperationException(message);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return new FunctionRuntimeTreeNode(function, parameters);\r\n        }\r\n\r\n\r\n        private static bool FunctionInitializedCorrectly(IFunction function)\r\n        {\r\n            return !(function is IFunctionInitializationInfo) ||\r\n                   (function as IFunctionInitializationInfo).FunctionInitializedCorrectly;\r\n        }\r\n\r\n        private static string AttributeValueOrEmpty(XElement element, string attributeName)\r\n        {\r\n            var attribute = element.Attribute(attributeName);\r\n            return (attribute == null ? \"\" : attribute.Value);\r\n        }\r\n\r\n\r\n        private static WidgetFunctionRuntimeTreeNode BuildWidgetFunctionRuntimeNode(XElement element)\r\n        {\r\n            XAttribute nameAttribute = element.Attribute(FunctionTreeConfigurationNames.NameAttributeName);\r\n            if (nameAttribute == null)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Missing attribute named '{0}'\", FunctionTreeConfigurationNames.NameAttributeName));\r\n            }\r\n\r\n            string label = AttributeValueOrEmpty(element, FunctionTreeConfigurationNames.LabelAttributeName);\r\n            string bindingSourceName = AttributeValueOrEmpty(element, FunctionTreeConfigurationNames.BindingSourceNameAttributeName);\r\n\r\n            HelpDefinition helpDefinition = null;\r\n            var parameters = new List<BaseParameterRuntimeTreeNode>();\r\n\r\n            foreach (XElement childElement in element.Elements())\r\n            {\r\n                if (childElement.Name.LocalName == FunctionTreeConfigurationNames.HelpDefinitionTagName)\r\n                {\r\n                    helpDefinition = HelpDefinition.Deserialize(childElement);\r\n                }\r\n                else if (childElement.Name.LocalName == FunctionTreeConfigurationNames.ParamTagName)\r\n                {\r\n                    BaseParameterRuntimeTreeNode parameterTreeNode = BuildParameterFunctionRuntimeNode(childElement);\r\n\r\n                    parameters.Add(parameterTreeNode);\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Only '{0}' tags allowed inside '{1}' tags\", FunctionTreeConfigurationNames.ParamTagName, FunctionTreeConfigurationNames.FunctionTagName));\r\n                }\r\n            }\r\n\r\n            if (helpDefinition == null) helpDefinition = new HelpDefinition(\"\");\r\n\r\n            IWidgetFunction widgetFunction = FunctionFacade.GetWidgetFunction(nameAttribute.Value);\r\n\r\n            foreach (BaseParameterRuntimeTreeNode parameter in parameters)\r\n            {\r\n                if (widgetFunction.ParameterProfiles.All(pp => pp.Name != parameter.Name))\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"The parameter '{0}' is not defined in the function named '{1}' parameter profiles\", parameter.Name, widgetFunction.CompositeName()));\r\n                }\r\n            }\r\n\r\n            return new WidgetFunctionRuntimeTreeNode(widgetFunction, label, helpDefinition, bindingSourceName, parameters);\r\n        }\r\n\r\n\r\n\r\n        private static BaseParameterRuntimeTreeNode BuildParameterFunctionRuntimeNode(XElement element)\r\n        {\r\n            XAttribute nameAttribute = element.Attribute(FunctionTreeConfigurationNames.NameAttribute);\r\n            Verify.IsNotNull(nameAttribute, \"Missing attribute named '{0}'\", FunctionTreeConfigurationNames.NameAttributeName);\r\n\r\n            string parameterName = nameAttribute.Value;\r\n\r\n\r\n            XAttribute valueAttribute = element.Attribute(FunctionTreeConfigurationNames.ValueAttribute);\r\n            if (valueAttribute != null)\r\n            {\r\n                return new ConstantParameterRuntimeTreeNode(parameterName, valueAttribute);\r\n            }\r\n\r\n            if (!element.Elements().Any())\r\n            {\r\n                if (string.IsNullOrWhiteSpace(element.Value))\r\n                {\r\n                    return new ConstantParameterRuntimeTreeNode(parameterName, (string)null);\r\n                }\r\n\r\n                return new ConstantParameterRuntimeTreeNode(parameterName, element.Value);\r\n            }\r\n\r\n            if ((element.Elements().Count() == 1) &&\r\n                     (element.Elements().First().Name.LocalName == FunctionTreeConfigurationNames.FunctionTagName))\r\n            {\r\n                XElement childElement = element.Elements().First();\r\n\r\n                if (childElement.Name.LocalName != FunctionTreeConfigurationNames.FunctionTagName)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Missing '{0}' child element (found '{1}')\", FunctionTreeConfigurationNames.FunctionTagName, childElement.Name.LocalName));\r\n                }\r\n\r\n                FunctionRuntimeTreeNode functionNode = BuildFunctionRuntimeNode(childElement, false);\r\n\r\n                return new FunctionParameterRuntimeTreeNode(parameterName, functionNode);\r\n            }\r\n\r\n            if ((element.Elements().Count() == 1) &&\r\n                     (element.Elements().First().Name.LocalName != FunctionTreeConfigurationNames.ParamElementTagName))\r\n            {\r\n                return new XElementParameterRuntimeTreeNode(parameterName, element.Elements().First());\r\n            }\r\n\r\n            if (element.Elements().All(f => f.Name.LocalName == FunctionTreeConfigurationNames.ParamElementTagName))\r\n            {\r\n                var strings = new List<string>();\r\n\r\n                foreach(XElement elm in element.Elements())\r\n                {\r\n                    XAttribute attr = elm.Attribute(FunctionTreeConfigurationNames.ValueAttribute);\r\n                    Verify.IsNotNull(attr, \"One or more {0} are missing the attribute {1}\", FunctionTreeConfigurationNames.ParamElementTagName, FunctionTreeConfigurationNames.ValueAttributeName);\r\n\r\n                    strings.Add(attr.Value);\r\n                }\r\n\r\n                return new ConstantParameterRuntimeTreeNode(parameterName, strings);\r\n            }\r\n\r\n            if (element.Nodes().Any())\r\n            {\r\n                object value = element.Nodes().All(f => f is XElement) ? element.Elements() : element.Nodes();\r\n\r\n                return new ConstantObjectParameterRuntimeTreeNode(parameterName, value);\r\n            }\r\n\r\n            throw new InvalidProgramException(\"Wrong xml format in parameter '{0}'\".FormatWith(parameterName));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/FunctionValueProvider.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    internal sealed class FunctionValueProvider : BaseValueProvider\r\n    {\r\n        private FunctionRuntimeTreeNode _functionFunctionRuntimeNode = null;\r\n\r\n        private string _functionName = null;\r\n        private List<BaseParameterRuntimeTreeNode> _parameters = null;\r\n\r\n        private XElement _serializedFunction = null;\r\n\r\n        private object _lock = new object();\r\n\r\n\r\n        public FunctionValueProvider(FunctionRuntimeTreeNode functionFunctionRuntimeNode)\r\n        {\r\n            if (functionFunctionRuntimeNode == null) throw new ArgumentNullException(\"functionFunctionRuntimeNode\");\r\n\r\n            _functionFunctionRuntimeNode = functionFunctionRuntimeNode;\r\n        }\r\n\r\n\r\n        public FunctionValueProvider(string functionName, List<BaseParameterRuntimeTreeNode> parameters)\r\n        {\r\n            if (string.IsNullOrEmpty(functionName)) throw new ArgumentException(\"functionName may not be null or empty\");\r\n            if (parameters == null) throw new ArgumentNullException(\"parameters\");\r\n\r\n            _functionName = functionName;\r\n            _parameters = parameters;\r\n        }\r\n\r\n\r\n        public FunctionValueProvider(XElement serializedFunction)\r\n        {\r\n            if (serializedFunction == null) throw new ArgumentNullException(\"serializedFunction\");\r\n\r\n            _serializedFunction = serializedFunction;\r\n        }\r\n\r\n\r\n\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            if (contextContainer == null) throw new ArgumentNullException(\"contextContainer\");\r\n\r\n            Initialize();\r\n\r\n            return _functionFunctionRuntimeNode.GetValue(contextContainer);\r\n        }\r\n\r\n\r\n\r\n        public override XObject Serialize()\r\n        {\r\n            Initialize();\r\n\r\n            return _functionFunctionRuntimeNode.Serialize();\r\n        }\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            if (_functionFunctionRuntimeNode == null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_functionFunctionRuntimeNode == null)\r\n                    {\r\n                        if (_serializedFunction == null)\r\n                        {\r\n                            IFunction function = FunctionFacade.GetFunction(_functionName);\r\n                            _functionFunctionRuntimeNode = new FunctionRuntimeTreeNode(function, _parameters);\r\n                        }\r\n                        else\r\n                        {\r\n                            _functionFunctionRuntimeNode = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(_serializedFunction);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/HelpDefinition.cs",
    "content": "using System.Xml.Linq;\r\nusing System;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class HelpDefinition\r\n\t{\r\n        /// <exclude />\r\n        public HelpDefinition GetLocalized()\r\n        {\r\n            if (this.HelpText.StartsWith(\"${\"))\r\n            {\r\n                return new HelpDefinition(StringResourceSystemFacade.ParseString(this.HelpText));\r\n            }\r\n            else\r\n            {\r\n                return new HelpDefinition(this.HelpText);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public HelpDefinition(string helpText)\r\n        {\r\n            this.HelpText = helpText;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string HelpText\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement Serialize()\r\n        {\r\n            XElement element = XElement.Parse(string.Format(@\"<f:{0} xmlns:f=\"\"{1}\"\" />\", FunctionTreeConfigurationNames.HelpDefinitionTagName, FunctionTreeConfigurationNames.NamespaceName));\r\n\r\n            element.Add(new XAttribute(FunctionTreeConfigurationNames.HelpTextAttributeName, this.HelpText));\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static HelpDefinition Deserialize(XElement serializedHelpDefinition)\r\n        {\r\n            if (serializedHelpDefinition == null) throw new ArgumentNullException(\"serializedHelpDefinition\");\r\n\r\n            if (serializedHelpDefinition.Name.LocalName != FunctionTreeConfigurationNames.HelpDefinitionTagName) throw new ArgumentException(\"Wrong serialized format\");\r\n\r\n            XAttribute helpTextAttribute = serializedHelpDefinition.Attribute(FunctionTreeConfigurationNames.HelpTextAttributeName);\r\n            if (helpTextAttribute == null) throw new ArgumentException(\"Wrong serialized format\");\r\n\r\n            return new HelpDefinition(helpTextAttribute.Value);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/ICompoundFunction.cs",
    "content": "﻿namespace Composite.Functions\r\n{\r\n    /// <summary>\r\n    /// Indicates that a function is allowed to have recursive calls.\r\n    /// </summary>\r\n\tinternal interface ICompoundFunction: IMetaFunction\r\n\t{\r\n        bool AllowRecursiveCall { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/IDowncastableFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Composite.Functions\r\n{\r\n\tinternal interface IDowncastableFunction : IFunction\r\n\t{\r\n        bool ReturnValueIsDowncastable { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/IDynamicFunction.cs",
    "content": "﻿namespace Composite.Functions\r\n{\r\n    /// <summary>\r\n    /// Allows defining whether function results should be cached during the donut caching.\r\n    /// </summary>\r\n    public interface IDynamicFunction : IFunction\r\n    {\r\n        /// <summary>\r\n        /// Indicates whether the function output can be cached.\r\n        /// </summary>\r\n        bool PreventFunctionOutputCaching { get; }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Functions/IFunction.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public interface IFunction : IMetaFunction\r\n\t{\r\n        /// <exclude />\r\n        object Execute(ParameterList parameters, FunctionContextContainer context);\r\n\t}\r\n\r\n\r\n    internal static class IFunctionOverloads\r\n    {\r\n        public static T Execute<T>(this IFunction function, NameValueCollection parameters)\r\n        {\r\n            return FunctionFacade.Execute<T>(function, parameters); ;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/IFunctionInitializationInfo.cs",
    "content": "﻿namespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFunctionInitializationInfo: IMetaFunction\r\n    {\r\n        /// <exclude />\r\n        bool FunctionInitializedCorrectly { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/IFunctionResultToXEmbedableMapper.cs",
    "content": "﻿using System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IFunctionResultToXEmbedableMapper\r\n\t{\r\n        /// <exclude />\r\n        bool TryMakeXEmbedable(FunctionContextContainer contextContainer, object resultObject, out XNode resultElement);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/IMetaFunction.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IMetaFunction\r\n\t{\r\n        /// <exclude />\r\n        string Name { get; }\r\n\r\n        /// <exclude />\r\n        string Namespace { get; }\r\n\r\n        /// <exclude />\r\n        string Description { get; }\r\n\r\n        /// <exclude />\r\n        Type ReturnType { get; }\r\n\r\n        /// <exclude />\r\n        IEnumerable<ParameterProfile> ParameterProfiles { get; }\r\n\r\n        /// <exclude />\r\n        EntityToken EntityToken { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/IMetaFunctionExtensionMethods.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class IMetaFunctionExtensionMethods\r\n\t{\r\n        /// <exclude />\r\n        public static string CompositeName(this IMetaFunction metaFunction)\r\n        {\r\n            return CompositeName(metaFunction.Namespace, metaFunction.Name);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string CompositeName(string namespaceName, string name)\r\n        {\r\n            return StringExtensionMethods.CreateNamespace(namespaceName, name, '.');\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsNamespaceCorrectFormat(this IMetaFunction metaFunction)\r\n        {\r\n            if (metaFunction.Namespace == \"\") return true;\r\n\r\n            if (metaFunction.Namespace.StartsWith(\".\")\r\n                || metaFunction.Namespace.EndsWith(\".\"))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            string[] splits = metaFunction.Namespace.Split('.');\r\n            foreach (string split in splits)\r\n            {\r\n                if (split == \"\") return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static bool ValidateParameterProfiles(this IMetaFunction metaFunction)\r\n        {\r\n            List<string> names = new List<string>();\r\n\r\n            foreach (ParameterProfile parameterProfile in metaFunction.ParameterProfiles)\r\n            {\r\n                if (names.Contains(parameterProfile.Name))\r\n                {\r\n                    return false;\r\n                }\r\n                names.Add(parameterProfile.Name);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string DescriptionLocalized(this IMetaFunction function)\r\n        {\r\n            if (function.Description != null && function.Description.Contains(\"${\"))\r\n            {\r\n                return StringResourceSystemFacade.ParseString(function.Description);\r\n            }\r\n            \r\n            return function.Description;\r\n        }\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/IRoutedDataUrlMapper.cs",
    "content": "﻿using Composite.Core.Routing;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <exclude />\r\n    public interface IRoutedDataUrlMapper\r\n    {\r\n        /// <exclude />\r\n        RoutedDataModel GetRouteDataModel(PageUrlData pageUrlData);\r\n        /// <exclude />\r\n        PageUrlData BuildItemUrl(IData item);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/IWidgetFunction.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic interface IWidgetFunction : IMetaFunction\r\n\t{\r\n        /// <exclude />\r\n        XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName); \r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Inline/InlineFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions.ManagedParameters;\r\n\r\n\r\nnamespace Composite.Functions.Inline\r\n{\r\n    internal class InlineFunction : IFunction, IFunctionInitializationInfo\r\n    {\r\n        protected readonly IInlineFunction _function;\r\n        private IEnumerable<ParameterProfile> _parameterProfile;\r\n\r\n\r\n        protected InlineFunction(IInlineFunction info, MethodInfo methodInfo)\r\n        {\r\n            Verify.ArgumentNotNull(info, \"info\");\r\n\r\n            _function = info; \r\n            MethodInfo = methodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static IFunction Create(IInlineFunction info)\r\n        {\r\n            var errors = new StringInlineFunctionCreateMethodErrorHandler();\r\n\r\n            MethodInfo methodInfo = InlineFunctionHelper.Create(info, null, errors);\r\n\r\n            if (methodInfo == null) return new NotLoadedInlineFunction(info, errors);\r\n\r\n            return new InlineFunction(info, methodInfo);\r\n        }\r\n\r\n\r\n\r\n        public virtual object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            IList<object> arguments = new List<object>();\r\n            foreach (ParameterProfile paramProfile in ParameterProfiles)\r\n            {\r\n                arguments.Add(parameters.GetParameter(paramProfile.Name, paramProfile.Type));\r\n            }\r\n\r\n            return this.MethodInfo.Invoke(null, arguments.ToArray());\r\n        }\r\n\r\n\r\n\r\n        public string Name\r\n        {\r\n            get { return _function.Name; }\r\n        }\r\n\r\n\r\n\r\n        public string Namespace\r\n        {\r\n            get { return _function.Namespace; }\r\n        }\r\n\r\n\r\n\r\n        public string Description \r\n        { \r\n            get \r\n            {\r\n                return _function.Description;\r\n            } \r\n        }\r\n\r\n\r\n\r\n        public virtual Type ReturnType\r\n        {\r\n            get { return MethodInfo.ReturnType; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<ParameterProfile> ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                if (_parameterProfile == null)\r\n                {\r\n                    _parameterProfile = ManagedParameterManager.GetParameterProfiles(_function.Id).Evaluate();\r\n                }\r\n\r\n                return _parameterProfile;\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        virtual protected  MethodInfo MethodInfo\r\n        {\r\n            get; set;\r\n        }\r\n\r\n\r\n\r\n        public EntityToken EntityToken\r\n        {\r\n            get\r\n            {\r\n                return _function.GetDataEntityToken();\r\n            }\r\n        }\r\n    \r\n        bool IFunctionInitializationInfo.FunctionInitializedCorrectly\r\n        {\r\n\t        get { return true; }\r\n        }\r\n}\r\n\r\n    internal class LazyInitializedInlineFunction : InlineFunction, IFunctionInitializationInfo\r\n    {\r\n        private readonly Type _cachedReturnType;\r\n\r\n        private bool _initialized;\r\n        private NotLoadedInlineFunction _notLoadedInlineFunction;\r\n        \r\n        public LazyInitializedInlineFunction(IInlineFunction inlineFunction)\r\n            : base(inlineFunction, null)\r\n        {\r\n        }\r\n\r\n        public LazyInitializedInlineFunction(IInlineFunction inlineFunction, Type cachedReturnType)\r\n            : base(inlineFunction, null)\r\n        {\r\n            this._cachedReturnType = cachedReturnType;\r\n        }\r\n\r\n        public override Type ReturnType\r\n        {\r\n            get\r\n            {\r\n                return _initialized ? base.ReturnType : _cachedReturnType;\r\n            }\r\n        }\r\n\r\n        private void EnsureInitialized()\r\n        {\r\n            if (!_initialized)\r\n                lock (this)\r\n                    if (!_initialized)\r\n                    {\r\n                        Initialize();\r\n\r\n                        _initialized = true;\r\n                    }\r\n        }\r\n\r\n        private void Initialize()\r\n        {\r\n            var errors = new StringInlineFunctionCreateMethodErrorHandler();\r\n\r\n            MethodInfo methodInfo = InlineFunctionHelper.Create(_function, null, errors);\r\n\r\n            if (methodInfo == null) \r\n            {\r\n                _notLoadedInlineFunction = new NotLoadedInlineFunction(_function, errors);\r\n            }\r\n            else\r\n            {\r\n                MethodInfo = methodInfo;\r\n            }\r\n        }\r\n\r\n        protected override MethodInfo MethodInfo\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialized();\r\n\r\n                if (_notLoadedInlineFunction != null)\r\n                {\r\n                    throw new InvalidOperationException(\"Function hasn't been initialized\");\r\n                }\r\n\r\n                return base.MethodInfo;\r\n            }\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (_notLoadedInlineFunction != null)\r\n            {\r\n                return (_notLoadedInlineFunction as IFunction).Execute(parameters, context);\r\n            }\r\n\r\n            return base.Execute(parameters, context);\r\n        }\r\n\r\n        bool IFunctionInitializationInfo.FunctionInitializedCorrectly\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialized();\r\n\r\n                return _notLoadedInlineFunction == null;\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Inline/InlineFunctionCreateMethodErrorHandler.cs",
    "content": "﻿\r\n\r\nusing System;\r\n\r\nnamespace Composite.Functions.Inline\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class InlineFunctionCreateMethodErrorHandler\r\n    {\r\n        /// <exclude />\r\n        public virtual bool HasErrors { get { return false; } }\r\n\r\n        /// <exclude />\r\n        public virtual void OnCompileError(int line, string errorNumber, string message) { }\r\n\r\n        /// <exclude />\r\n        public virtual void OnMissingContainerType(string message) { }\r\n\r\n        /// <exclude />\r\n        public virtual void OnNamespaceMismatch(string message) { }\r\n\r\n        /// <exclude />\r\n        public virtual void OnMissionMethod(string message) { }\r\n\r\n        /// <exclude />\r\n        public virtual void OnLoadSourceError(Exception exception) { }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Inline/InlineFunctionHelper.cs",
    "content": "﻿using System;\r\nusing System.CodeDom.Compiler;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Threading;\r\nusing System.Web.Hosting;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_MethodBasedFunctionProviderElementProvider;\r\n\r\nnamespace Composite.Functions.Inline\r\n{\r\n    /// <summary />\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    public static class InlineFunctionHelper\r\n    {\r\n        private static readonly string LogTitle = typeof(InlineFunctionHelper).Name;\r\n\r\n        /// <exclude />\r\n        public static string MethodClassContainerName => \"InlineMethodFunction\";\r\n\r\n        /// <exclude />\r\n        public static MethodInfo Create(IInlineFunction function, string code = null, InlineFunctionCreateMethodErrorHandler createMethodErrorHandler = null, List<string> selectedAssemblies = null)\r\n        {\r\n            if (string.IsNullOrWhiteSpace(code))\r\n            {\r\n                try\r\n                {\r\n                    code = GetFunctionCode(function);\r\n                }\r\n                catch (ThreadAbortException)\r\n                {\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    if (createMethodErrorHandler != null)\r\n                    {\r\n                        createMethodErrorHandler.OnLoadSourceError(ex);\r\n                    }\r\n                    else\r\n                    {\r\n                        LogMessageIfNotShuttingDown(function, ex.Message);\r\n                    }\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            var compilerParameters = new CompilerParameters\r\n            {\r\n                GenerateExecutable = false,\r\n                GenerateInMemory = true\r\n            };\r\n\r\n            if (selectedAssemblies == null)\r\n            {\r\n                IEnumerable<IInlineFunctionAssemblyReference> assemblyReferences = DataFacade.GetData<IInlineFunctionAssemblyReference>(f => f.Function == function.Id).Evaluate();\r\n\r\n                foreach (var assemblyReference in assemblyReferences)\r\n                {\r\n                    var assemblyPath = GetAssemblyFullPath(assemblyReference.Name, assemblyReference.Location);\r\n\r\n                    compilerParameters.ReferencedAssemblies.Add(assemblyPath);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                foreach (var reference in selectedAssemblies)\r\n                {\r\n                    compilerParameters.ReferencedAssemblies.Add(reference);\r\n                }\r\n            }\r\n\r\n            var appCodeAssembly = AssemblyFacade.GetAppCodeAssembly();\r\n            if (appCodeAssembly != null)\r\n            {\r\n                compilerParameters.ReferencedAssemblies.Add(appCodeAssembly.Location);\r\n            }\r\n\r\n            var compiler = CSharpCodeProviderFactory.CreateCompiler();\r\n\r\n            var results = compiler.CompileAssemblyFromSource(compilerParameters, code);\r\n            if (results.Errors.HasErrors)\r\n            {\r\n                foreach (CompilerError error in results.Errors)\r\n                {\r\n                    if (createMethodErrorHandler != null)\r\n                    {\r\n                        createMethodErrorHandler.OnCompileError(error.Line, error.ErrorNumber, error.ErrorText);\r\n                    }\r\n                    else\r\n                    {\r\n                        LogMessageIfNotShuttingDown(function, error.ErrorText);\r\n                    }\r\n                }\r\n\r\n                return null;\r\n            }\r\n\r\n            var type = results.CompiledAssembly.GetTypes().SingleOrDefault(f => f.Name == MethodClassContainerName);\r\n            if (type == null)\r\n            {\r\n                var message = Texts.CSharpInlineFunction_OnMissingContainerType(MethodClassContainerName);\r\n\r\n                if (createMethodErrorHandler != null)\r\n                {\r\n                    createMethodErrorHandler.OnMissingContainerType(message);\r\n                }\r\n                else\r\n                {\r\n                    LogMessageIfNotShuttingDown(function, message);\r\n                }\r\n\r\n                return null;\r\n            }\r\n\r\n            if (type.Namespace != function.Namespace)\r\n            {\r\n                var message = Texts.CSharpInlineFunction_OnNamespaceMismatch(type.Namespace, function.Namespace);\r\n\r\n                if (createMethodErrorHandler != null)\r\n                {\r\n                    createMethodErrorHandler.OnNamespaceMismatch(message);\r\n                }\r\n                else\r\n                {\r\n                    LogMessageIfNotShuttingDown(function, message);\r\n                }\r\n\r\n                return null;\r\n            }\r\n\r\n            var methodInfo = type.GetMethods(BindingFlags.Public | BindingFlags.Static).SingleOrDefault(f => f.Name == function.Name);\r\n            if (methodInfo == null)\r\n            {\r\n                var message = Texts.CSharpInlineFunction_OnMissionMethod(function.Name, MethodClassContainerName);\r\n\r\n                if (createMethodErrorHandler != null)\r\n                {\r\n                    createMethodErrorHandler.OnMissionMethod(message);\r\n                }\r\n                else\r\n                {\r\n                    LogMessageIfNotShuttingDown(function, message);\r\n                }\r\n\r\n                return null;\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n        private static void LogMessageIfNotShuttingDown(IInlineFunction function, string message)\r\n        {\r\n            if (!HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n            {\r\n                Log.LogWarning(LogTitle, $\"{function.Namespace}.{function.Name} : {message}\");\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> DefaultAssemblies\r\n        {\r\n            get\r\n            {\r\n                var systemPath = Path.GetDirectoryName(typeof(String).Assembly.Location);\r\n\r\n                yield return Path.Combine(systemPath, \"System.dll\");\r\n                yield return Path.Combine(systemPath, \"System.Core.dll\");\r\n                yield return Path.Combine(systemPath, \"System.Xml.dll\");\r\n                yield return Path.Combine(systemPath, \"System.Xml.Linq.dll\");\r\n                yield return Path.Combine(systemPath, \"System.Web.dll\");\r\n\r\n                yield return Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.BinDirectory), \"Composite.dll\");\r\n\r\n                var compositeGeneretedPath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.BinDirectory), \"Composite.Generated.dll\");\r\n                if (C1File.Exists(compositeGeneretedPath))\r\n                {\r\n                    yield return compositeGeneretedPath;\r\n                }\r\n\r\n                var compositeWorkflowsPath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.BinDirectory), \"Composite.Workflows.dll\");\r\n                if (C1File.Exists(compositeWorkflowsPath))\r\n                {\r\n                    yield return compositeWorkflowsPath;\r\n                }\r\n            }\r\n        }\r\n\r\n        internal static string GetSourceFilePath(this IInlineFunction function)\r\n        {\r\n            return Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.InlineCSharpFunctionDirectory), function.CodePath);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetFunctionCode(this IInlineFunction function)\r\n        {\r\n            var filepath = GetSourceFilePath(function);\r\n\r\n            // Making 5 attempts to read the file\r\n            for (var i = 5; i > 0; i--)\r\n            {\r\n                try\r\n                {\r\n                    return C1File.ReadAllText(filepath);\r\n                }\r\n                catch (FileNotFoundException)\r\n                {\r\n                    throw;\r\n                }\r\n                catch (IOException)\r\n                {\r\n                    if (i == 1) throw;\r\n\r\n                    Thread.Sleep(100);\r\n                }\r\n            }\r\n            throw new InvalidOperationException(\"This line should not be reachable\");\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void DeleteFunctionCode(this IInlineFunction function)\r\n        {\r\n            var filepath = GetSourceFilePath(function);\r\n\r\n            FileUtils.Delete(filepath);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void SetFunctionCode(this IInlineFunction function, string content)\r\n        {\r\n            var directoryPath = PathUtil.Resolve(GlobalSettingsFacade.InlineCSharpFunctionDirectory);\r\n            if (C1Directory.Exists(directoryPath) == false)\r\n            {\r\n                C1Directory.CreateDirectory(directoryPath);\r\n            }\r\n\r\n            var filepath = Path.Combine(directoryPath, function.CodePath);\r\n\r\n            C1File.WriteAllText(filepath, content);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void FunctionRenamed(IInlineFunction newFunction, IInlineFunction oldFunction)\r\n        {\r\n            newFunction.UpdateCodePath();\r\n\r\n            var directoryPath = PathUtil.Resolve(GlobalSettingsFacade.InlineCSharpFunctionDirectory);\r\n\r\n            var oldFilepath = Path.Combine(directoryPath, oldFunction.CodePath);\r\n            var newFilepath = Path.Combine(directoryPath, newFunction.CodePath);\r\n\r\n            C1File.Move(oldFilepath, newFilepath);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void UpdateCodePath(this IInlineFunction function)\r\n        {\r\n            function.CodePath = function.Namespace;\r\n            if (string.IsNullOrEmpty(function.CodePath) == false)\r\n            {\r\n                function.CodePath += \".\";\r\n            }\r\n\r\n            function.CodePath += function.Name + \".cs\";\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetReferencableAssemblies()\r\n        {\r\n            var path = Path.GetDirectoryName(typeof(String).Assembly.Location);\r\n            foreach (var file in Directory.GetFiles(path, \"System*.dll\"))\r\n            {\r\n                yield return file;\r\n            }\r\n\r\n            foreach (var file in AssemblyFacade.GetAssembliesFromBin(true))\r\n            {\r\n                yield return file;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetAssemblyLocation(string fullPath)\r\n        {\r\n            var systemPath = Path.GetDirectoryName(typeof(String).Assembly.Location).ToLowerInvariant();\r\n            if (fullPath.ToLowerInvariant().StartsWith(systemPath))\r\n            {\r\n                return \"System\";\r\n            }\r\n\r\n\r\n            var binPath = PathUtil.Resolve(GlobalSettingsFacade.BinDirectory).ToLowerInvariant();\r\n            if (fullPath.ToLowerInvariant().StartsWith(binPath))\r\n            {\r\n                return \"Bin\";\r\n            }\r\n\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static string GetAssemblyFullPath(string filename, string location)\r\n        {\r\n            location = location.ToLowerInvariant();\r\n\r\n            switch (location)\r\n            {\r\n                case \"system\":\r\n                    return Path.Combine(Path.GetDirectoryName(typeof(String).Assembly.Location), filename);\r\n\r\n                case \"bin\":\r\n                    return Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.BinDirectory), filename);\r\n\r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Functions/Inline/NotLoadedInlineFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Functions.Inline\r\n{\r\n    internal class NotLoadedInlineFunction : IFunction, IFunctionInitializationInfo\r\n    {\r\n        private readonly IInlineFunction _function;\r\n        private string[] _sourceCode;\r\n\r\n        private readonly StringInlineFunctionCreateMethodErrorHandler _errors;\r\n\r\n        public NotLoadedInlineFunction(IInlineFunction functionInfo, StringInlineFunctionCreateMethodErrorHandler errors)\r\n        {\r\n            Verify.ArgumentCondition(errors.HasErrors, \"errors\", \"No errors information provided\");\r\n\r\n            _function = functionInfo;\r\n            _errors = errors;\r\n        }\r\n\r\n        object IFunction.Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (_errors.CompileErrors.Count > 0)\r\n            {\r\n                var error = _errors.CompileErrors[0];\r\n                var exception = new InvalidOperationException(\"{1} Line {0}: {2}\".FormatWith(error.Item1, error.Item2, error.Item3));\r\n\r\n                if (_sourceCode == null)\r\n                {\r\n                    string filepath = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.InlineCSharpFunctionDirectory), _function.CodePath);\r\n\r\n                    if (C1File.Exists(filepath))\r\n                    {\r\n                        _sourceCode = C1File.ReadAllLines(filepath);\r\n                    }\r\n                    else\r\n                    {\r\n                        _sourceCode = new string[0];\r\n                    }\r\n                }\r\n                \r\n                if (_sourceCode.Length > 0)\r\n                {\r\n                    XhtmlErrorFormatter.EmbedSourceCodeInformation(exception, _sourceCode, error.Item1);\r\n                }\r\n\r\n                throw exception;\r\n            }\r\n\r\n            if (_errors.LoadingException != null)\r\n            {\r\n                throw _errors.LoadingException;\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Function wasn't loaded due to compilation errors\");\r\n        }\r\n\r\n        public string Name\r\n        {\r\n            get { return _function.Name; }\r\n        }\r\n\r\n\r\n        public string Namespace\r\n        {\r\n            get { return _function.Namespace; }\r\n        }\r\n\r\n        public string Description\r\n        {\r\n            get\r\n            {\r\n                if (_errors.CompileErrors.Count > 0)\r\n                {\r\n                    var error = _errors.CompileErrors[0];\r\n                    return \"{1} Line {0}: {2}\".FormatWith(error.Item1, error.Item2, error.Item3);\r\n                }\r\n\r\n                if (_errors.LoadingException != null)\r\n                {\r\n                    return _errors.LoadingException.Message;\r\n                }\r\n\r\n                return _function.Description;\r\n            }\r\n        }\r\n\r\n        Type IMetaFunction.ReturnType\r\n        {\r\n            get { return typeof(void); }\r\n        }\r\n\r\n        IEnumerable<ParameterProfile> IMetaFunction.ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                return new ParameterProfile[0];\r\n            }\r\n        }\r\n\r\n        bool IFunctionInitializationInfo.FunctionInitializedCorrectly\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n\r\n        public C1Console.Security.EntityToken EntityToken\r\n        {\r\n            get { return _function.GetDataEntityToken(); }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Inline/StringInlineFunctionCreateMethodErrorHandler.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Functions.Inline\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class StringInlineFunctionCreateMethodErrorHandler : InlineFunctionCreateMethodErrorHandler\r\n    {\r\n        bool _hasErrors;\r\n\r\n        /// <exclude />\r\n        public StringInlineFunctionCreateMethodErrorHandler()\r\n        {\r\n            _hasErrors = false;\r\n            this.CompileErrors = new List<Tuple<int, string, string>>();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<Tuple<int, string, string>> CompileErrors { get; set; }\r\n\r\n        /// <exclude />\r\n        public string MissingContainerType { get; set; }\r\n\r\n        /// <exclude />\r\n        public string NamespaceMismatch { get; set; }\r\n\r\n        /// <exclude />\r\n        public string MissionMethod { get; set; }\r\n\r\n        /// <exclude />\r\n        public Exception LoadingException { get; set; }\r\n\r\n        /// <exclude />\r\n        public override bool HasErrors { get { return _hasErrors; } }\r\n\r\n\r\n        /// <exclude />\r\n        public override void OnCompileError(int line, string errorNumber, string message)\r\n        {\r\n            _hasErrors = true;\r\n            this.CompileErrors.Add(new Tuple<int, string, string>(line, errorNumber, message));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void OnMissingContainerType(string message)\r\n        {\r\n            _hasErrors = true;\r\n            this.MissingContainerType = message;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void OnNamespaceMismatch(string message)\r\n        {\r\n            _hasErrors = true;\r\n            this.NamespaceMismatch = message;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void OnMissionMethod(string message)\r\n        {\r\n            _hasErrors = true;\r\n            this.MissionMethod = message;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void OnLoadSourceError(Exception exception)\r\n        {\r\n            _hasErrors = true;\r\n            LoadingException = exception;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/ManagedParameters/ManagedParameterDefinition.cs",
    "content": "﻿using System;\r\n\r\n\r\nnamespace Composite.Functions.ManagedParameters\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Serializable()]    \r\n    public sealed class ManagedParameterDefinition\r\n    {\r\n        /// <exclude />\r\n        public ManagedParameterDefinition()\r\n        {\r\n            this.Id = Guid.NewGuid();\r\n            this.HelpText = \"\";\r\n            this.Position = -1;\r\n        }\r\n\r\n        /// <exclude />\r\n        public Guid Id { get; set; }\r\n        \r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public string HelpText { get; set; }\r\n\r\n        /// <exclude />\r\n        public int Position { get; set; }\r\n\r\n        /// <exclude />\r\n        public Type Type { get; set; }\r\n\r\n        /// <exclude />\r\n        public string WidgetFunctionMarkup { get; set; }\r\n\r\n        /// <exclude />\r\n        public string DefaultValueFunctionMarkup { get; set; }\r\n\r\n        /// <exclude />\r\n        public string TestValueFunctionMarkup { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/ManagedParameters/ManagedParameterManager.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Functions.ManagedParameters\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class ManagedParameterManager\r\n    {\r\n        /// <exclude />\r\n        public static IEnumerable<ManagedParameterDefinition> Load(Guid ownerId)\r\n        {\r\n            return (from parameter in DataFacade.GetData<IParameter>().AsEnumerable()\r\n                    where parameter.OwnerId == ownerId\r\n                    orderby parameter.Position\r\n                    select BuildParameterDefinition(parameter)).ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void Save(Guid ownerId, IEnumerable<ManagedParameterDefinition> parameterDefinitions)\r\n        {\r\n            var dataParams = new List<IParameter>();\r\n\r\n            foreach (ManagedParameterDefinition paramDef in parameterDefinitions)\r\n            {\r\n                ValidateParameter(paramDef);\r\n\r\n                dataParams.Add(BuildIParameter(ownerId, paramDef));\r\n\r\n\r\n            }\r\n\r\n            using (TransactionScope transationScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataFacade.Delete<IParameter>(f => f.OwnerId == ownerId);                \r\n\r\n                foreach (IParameter param in dataParams)\r\n                {\r\n                    DataFacade.AddNew<IParameter>(param);\r\n                }\r\n                transationScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<ParameterProfile> GetParameterProfiles(Guid ownerId)\r\n        {\r\n            return new ManagedParameterProfiles(ownerId);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<ParameterProfile> GetParameterProfiles(IEnumerable<ManagedParameterDefinition> parameterDefinitions)\r\n        {\r\n            var dataParams = new List<IParameter>();\r\n\r\n            foreach (ManagedParameterDefinition paramDef in parameterDefinitions)\r\n            {\r\n                ValidateParameter(paramDef);\r\n\r\n                dataParams.Add(BuildIParameter(Guid.Empty, paramDef));\r\n            }\r\n\r\n            return new ManagedParameterProfiles(dataParams);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ParameterList GetParametersListForTest(IEnumerable<ManagedParameterDefinition> parameterDefinitions)\r\n        {\r\n            ParameterList parameterList = new ParameterList(null);\r\n\r\n            foreach (var parameterDefinition in parameterDefinitions)\r\n            {\r\n                if (!parameterDefinition.TestValueFunctionMarkup.IsNullOrEmpty())\r\n                {\r\n                    FunctionRuntimeTreeNode functionNode = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(XElement.Parse(parameterDefinition.TestValueFunctionMarkup));\r\n                    FunctionValueProvider valueProvider = new FunctionValueProvider(functionNode);\r\n\r\n                    object value = valueProvider.GetValue();\r\n                    parameterList.AddConstantParameter(parameterDefinition.Name, value, parameterDefinition.Type);\r\n                }\r\n                else if (!parameterDefinition.DefaultValueFunctionMarkup.IsNullOrEmpty())\r\n                {\r\n                    FunctionRuntimeTreeNode functionNode = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(XElement.Parse(parameterDefinition.DefaultValueFunctionMarkup));\r\n                    FunctionValueProvider valueProvider = new FunctionValueProvider(functionNode);\r\n\r\n                    object value = valueProvider.GetValue();\r\n                    parameterList.AddConstantParameter(parameterDefinition.Name, value, parameterDefinition.Type);\r\n                }\r\n                else throw new InvalidOperationException(\"Parameter '{0}' have neigther 'test value' nor 'default value' specified.\".FormatWith(parameterDefinition.Name));\r\n            }\r\n\r\n\r\n            return parameterList;\r\n        }\r\n\r\n\r\n\r\n        private static void ValidateParameter(ManagedParameterDefinition parameterDefinition)\r\n        {\r\n            if (string.IsNullOrEmpty(parameterDefinition.Name)) throw new InvalidOperationException(\"Name property can not be null or an empty string\");\r\n            if (parameterDefinition.Type == null) throw new InvalidOperationException(\"Type property can not be null\");\r\n            if (string.IsNullOrEmpty(parameterDefinition.Label)) throw new InvalidOperationException(\"Parameter '{0}' has an empty 'Label' field\".FormatWith(parameterDefinition.Name));\r\n        }\r\n\r\n\r\n\r\n        private static IParameter BuildIParameter(Guid ownerId, ManagedParameterDefinition parameterDefinition)\r\n        {\r\n            IParameter newParam = DataFacade.BuildNew<IParameter>();\r\n\r\n            newParam.OwnerId = ownerId;\r\n            newParam.ParameterId = parameterDefinition.Id;\r\n            newParam.Name = parameterDefinition.Name;\r\n            newParam.TypeManagerName = TypeManager.SerializeType( parameterDefinition.Type);\r\n            newParam.Label = parameterDefinition.Label;\r\n            newParam.HelpText = parameterDefinition.HelpText;\r\n            newParam.Position = parameterDefinition.Position;\r\n            newParam.WidgetFunctionMarkup = parameterDefinition.WidgetFunctionMarkup;\r\n            newParam.DefaultValueFunctionMarkup = parameterDefinition.DefaultValueFunctionMarkup;\r\n            newParam.TestValueFunctionMarkup = parameterDefinition.TestValueFunctionMarkup;\r\n\r\n            return newParam;\r\n        }\r\n\r\n\r\n\r\n        private static ManagedParameterDefinition BuildParameterDefinition(IParameter parameterData)\r\n        {\r\n            ManagedParameterDefinition paramDef = new ManagedParameterDefinition();\r\n\r\n            paramDef.Id = parameterData.ParameterId;\r\n            paramDef.Name = parameterData.Name;\r\n            paramDef.Type = TypeManager.GetType(parameterData.TypeManagerName);\r\n            paramDef.Label = parameterData.Label;\r\n            paramDef.HelpText = parameterData.HelpText;\r\n            paramDef.Position = parameterData.Position;\r\n            paramDef.WidgetFunctionMarkup = parameterData.WidgetFunctionMarkup;\r\n            paramDef.DefaultValueFunctionMarkup = parameterData.DefaultValueFunctionMarkup;\r\n            paramDef.TestValueFunctionMarkup = parameterData.TestValueFunctionMarkup;\r\n\r\n            return paramDef;\r\n        }\r\n\r\n\r\n\r\n        private class ManagedParameterProfiles : IEnumerable<ParameterProfile>\r\n        {\r\n            private readonly Guid _ownerId;\r\n            private List<ParameterProfile> _parameterProfiles;\r\n\r\n            private static readonly object _syncRoot = new object();\r\n            private static List<IParameter> _parameterCache;\r\n\r\n            static ManagedParameterProfiles()\r\n            {\r\n                DataEventSystemFacade.SubscribeToStoreChanged<IParameter>((a, b) => ClearParametersCache(), true);\r\n            }\r\n\r\n            public ManagedParameterProfiles(Guid ownerId)\r\n            {\r\n                _ownerId = ownerId;\r\n            }\r\n\r\n            public ManagedParameterProfiles(IEnumerable<IParameter> parameters)\r\n            {\r\n                _parameterProfiles = new List<ParameterProfile>();\r\n\r\n                foreach (var parameter in parameters)\r\n                {\r\n                    ParameterProfile pp = BuildParameterProfile(parameter);\r\n\r\n                    _parameterProfiles.Add(pp);\r\n                }\r\n            }\r\n\r\n\r\n            public IEnumerator<ParameterProfile> GetEnumerator()\r\n            {\r\n                Initialize();\r\n                return _parameterProfiles.GetEnumerator();\r\n            }\r\n\r\n\r\n            IEnumerator IEnumerable.GetEnumerator()\r\n            {\r\n                Initialize();\r\n                return _parameterProfiles.GetEnumerator();\r\n            }\r\n\r\n\r\n\r\n            private void Initialize()\r\n            {\r\n                if (_parameterProfiles == null)\r\n                {\r\n                    lock (this)\r\n                    {\r\n                        if (_parameterProfiles == null)\r\n                        {\r\n                            _parameterProfiles = GetParameters();\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            private List<ParameterProfile> GetParameters()\r\n            {\r\n                var result =  new List<ParameterProfile>();\r\n\r\n                var parameters =\r\n                    from parameter in GetParametersCached()\r\n                    where parameter.OwnerId == _ownerId\r\n                    orderby parameter.Position\r\n                    select parameter;\r\n\r\n                foreach (var parameter in parameters)\r\n                {\r\n                    result.Add(BuildParameterProfile(parameter));\r\n                }\r\n\r\n                return result;\r\n            }\r\n\r\n            private static void ClearParametersCache()\r\n            {\r\n                lock(_syncRoot)\r\n                {\r\n                    _parameterCache = null;\r\n                }\r\n            }\r\n\r\n            private static IEnumerable<IParameter> GetParametersCached()\r\n            {\r\n                var parameters = _parameterCache;\r\n\r\n                if (parameters != null) return parameters;\r\n\r\n                lock(_syncRoot)\r\n                {\r\n                    if (_parameterCache == null)\r\n                    {\r\n                        _parameterCache = DataFacade.GetData<IParameter>().ToList();\r\n                    }\r\n\r\n                    parameters = _parameterCache;\r\n                }\r\n\r\n                return parameters;\r\n            }\r\n\r\n\r\n            private ParameterProfile BuildParameterProfile(IParameter parameter)\r\n            {\r\n                Type parameterType = TypeManager.GetType(parameter.TypeManagerName);\r\n                bool isRequired = false;\r\n                BaseValueProvider defaultValueProvider;\r\n\r\n                if (string.IsNullOrEmpty(parameter.DefaultValueFunctionMarkup))\r\n                {\r\n                    defaultValueProvider = new NoValueValueProvider();\r\n                    isRequired = true;\r\n                }\r\n                else\r\n                {\r\n                    defaultValueProvider = new FunctionValueProvider(XElement.Parse(parameter.DefaultValueFunctionMarkup));\r\n                }\r\n\r\n                WidgetFunctionProvider widgetFunctionProvider;\r\n                if (string.IsNullOrEmpty(parameter.WidgetFunctionMarkup) == false)\r\n                {\r\n                    widgetFunctionProvider = new WidgetFunctionProvider(XElement.Parse(parameter.WidgetFunctionMarkup));\r\n                }\r\n                else\r\n                {\r\n                    widgetFunctionProvider = WidgetFunctionProvider.BuildNoWidgetProvider();\r\n                }\r\n\r\n                return new ParameterProfile(parameter.Name, parameterType, isRequired, defaultValueProvider, widgetFunctionProvider, parameter.Label, new HelpDefinition(parameter.HelpText));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/NamedFunctionCall.cs",
    "content": "﻿namespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class NamedFunctionCall\r\n    {\r\n        /// <exclude />\r\n        public NamedFunctionCall(string name, BaseFunctionRuntimeTreeNode functionCall)\r\n        {\r\n            this.Name = name;\r\n            this.FunctionCall = functionCall;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        public BaseFunctionRuntimeTreeNode FunctionCall { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/NamedFunctionCallValueXmlSerializer.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    internal sealed class NamedFunctionCallValueXmlSerializer : IValueXmlSerializer\r\n    {\r\n        public bool TrySerialize(Type objectToSerializeType, object objectToSerialize, IXmlSerializer xmlSerializer, out XElement serializedObject)\r\n        {\r\n            if (objectToSerializeType == null) throw new ArgumentNullException(\"objectToSerializeType\");\r\n            if (xmlSerializer == null) throw new ArgumentNullException(\"xmlSerializer\");\r\n\r\n            serializedObject = null;\r\n            if (objectToSerializeType != typeof(NamedFunctionCall)) return false;\r\n\r\n            NamedFunctionCall namedFunctionCall = objectToSerialize as NamedFunctionCall;\r\n\r\n            serializedObject = new XElement(\"NamedFunctionCall\");\r\n\r\n            if (namedFunctionCall != null)\r\n            {\r\n                serializedObject.Add(new XElement(\"Name\", xmlSerializer.Serialize(typeof(string), namedFunctionCall.Name)));\r\n\r\n                if (namedFunctionCall.FunctionCall != null)\r\n                {\r\n                    serializedObject.Add(new XElement(\"Value\", namedFunctionCall.FunctionCall.Serialize()));\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        public bool TryDeserialize(XElement serializedObject, IXmlSerializer xmlSerializer, out object deserializedObject)\r\n        {\r\n            if (serializedObject == null) throw new ArgumentNullException(\"serializedObject\");\r\n            if (xmlSerializer == null) throw new ArgumentNullException(\"xmlSerializer\");\r\n\r\n            deserializedObject = null;\r\n\r\n            if (serializedObject.Name.LocalName != \"NamedFunctionCall\") return false;\r\n\r\n            NamedFunctionCall namedFunctionCall = new NamedFunctionCall(null, null);\r\n\r\n            XElement nameElement = serializedObject.Element(\"Name\");\r\n            if (nameElement != null)\r\n            {\r\n                if (nameElement.Elements().Count() != 1) return false;\r\n\r\n                namedFunctionCall.Name = (string)xmlSerializer.Deserialize(nameElement.Elements().Single());\r\n            }\r\n\r\n            XElement valueElement = serializedObject.Element(\"Value\");\r\n            if (valueElement != null)\r\n            {\r\n                if (valueElement.Elements().Count() != 1) return false;\r\n\r\n                object result;\r\n                try\r\n                {\r\n                    result = FunctionFacade.BuildTree(valueElement.Elements().Single());\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    return false;\r\n                }\r\n                if ((result is BaseFunctionRuntimeTreeNode) == false) return false;\r\n\r\n                namedFunctionCall.FunctionCall = (BaseFunctionRuntimeTreeNode)result;\r\n            }\r\n\r\n            deserializedObject = namedFunctionCall;\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/NoValueValueProvider.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NoValueValueProvider : BaseValueProvider\r\n\t{\r\n        /// <exclude />\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            throw new InvalidOperationException(\"No value exists\");\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override XObject Serialize()\r\n        {\r\n            throw new InvalidOperationException(\"No value exists\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/ParameterList.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [DebuggerDisplay(\"Count = {_parameters.Count}\")]\r\n    public sealed class ParameterList\r\n    {\r\n        [DebuggerDisplay(\"{ValueObject}\")]\r\n        private class StoredParameterReturnValue\r\n        {\r\n            public object ValueObject { get; set; }\r\n            public Type ValueType { get; set; }\r\n            public bool IsDefaultValue { get; set; }\r\n        }\r\n\r\n\r\n        private readonly FunctionContextContainer _functionContextContainer;\r\n        private readonly Dictionary<string, StoredParameterReturnValue> _parameters = new Dictionary<string, StoredParameterReturnValue>();\r\n\r\n        private static readonly MethodInfo NewLazyObjectMethodInfo = StaticReflection.GetGenericMethodInfo(() => NewLazyObject<object>(null));\r\n\r\n\r\n        /// <exclude />\r\n        public ParameterList(FunctionContextContainer functionContextContainer)\r\n        {\r\n            _functionContextContainer = functionContextContainer;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<string> AllParameterNames\r\n        {\r\n            get { return _parameters.Keys; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public T GetParameter<T>(string parameterName)\r\n        {\r\n            object value = GetParameter(parameterName);\r\n\r\n            if (value == null || value is T)\r\n            {\r\n                return (T)value;\r\n            }\r\n            \r\n            return ValueTypeConverter.Convert<T>(value);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n\r\n        public bool TryGetParameter<T>(string parameterName, out T value)\r\n        {\r\n            object objectValue;\r\n            bool found = TryGetParameter(parameterName, out objectValue);\r\n\r\n            if (!found)\r\n            {\r\n                value = default(T);\r\n                return false;\r\n            }\r\n\r\n            if (objectValue == null || objectValue is T)\r\n            {\r\n                value = (T)objectValue;\r\n            }\r\n            else\r\n            {\r\n                value = ValueTypeConverter.Convert<T>(objectValue);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public object GetParameter(string parameterName, Type targetType)\r\n        {\r\n            object value = GetParameter(parameterName);\r\n\r\n            if (value != null && !targetType.IsInstanceOfType(value))\r\n            {\r\n                return ValueTypeConverter.Convert(value, targetType);\r\n            }\r\n\r\n            return value;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public object GetParameter(string parameterName)\r\n        {\r\n            object value;\r\n            if (!TryGetParameter(parameterName, out value)) throw new ArgumentException(string.Format(\"No parameter named '{0}' exists\", parameterName));\r\n            return value;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Fetches the tree node object of a parameter, if available. In contrast to the TryGetValue() function\r\n        /// this will give you the 'value definition' rather than the result of calling it.\r\n        /// </summary>\r\n        /// <param name=\"parameterName\">Name of the parameter</param>\r\n        /// <param name=\"runtimeTreeNode\"></param>\r\n        /// <returns></returns>\r\n        public bool TryGetParameterRuntimeTreeNode(string parameterName, out BaseRuntimeTreeNode runtimeTreeNode)\r\n        {\r\n            StoredParameterReturnValue storedParameterReturnValue;\r\n            bool paramFound = _parameters.TryGetValue(parameterName, out storedParameterReturnValue);\r\n\r\n            bool valueIsTreeNode = paramFound && storedParameterReturnValue.ValueObject is BaseRuntimeTreeNode;\r\n\r\n            if (!valueIsTreeNode)\r\n            {\r\n                runtimeTreeNode = null;\r\n                return false;\r\n            }\r\n            \r\n            runtimeTreeNode = (BaseRuntimeTreeNode) storedParameterReturnValue.ValueObject;\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool TryGetParameter(string parameterName, out object value)\r\n        {\r\n            StoredParameterReturnValue storedParameterReturnValue;\r\n            bool parameterFound = _parameters.TryGetValue(parameterName, out storedParameterReturnValue);\r\n\r\n            if (!parameterFound)\r\n            {\r\n                value = null;\r\n                return false;\r\n            }\r\n\r\n            object valueObject = storedParameterReturnValue.ValueObject;\r\n            var parameterType = storedParameterReturnValue.ValueType;\r\n\r\n            if (parameterType.IsGenericType && parameterType.GetGenericTypeDefinition() == typeof (Lazy<>))\r\n            {\r\n                Type genericArgument = parameterType.GetGenericArguments()[0];\r\n\r\n                value = CreateLazyObject(() => EvaluateTreeNode(valueObject, genericArgument, _functionContextContainer), genericArgument);\r\n            }\r\n            else\r\n            {\r\n                value = EvaluateTreeNode(valueObject, parameterType, _functionContextContainer);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        private static object EvaluateTreeNode(object node, Type type, FunctionContextContainer functionContextContainer)\r\n        {\r\n            if (node is BaseRuntimeTreeNode)\r\n            {\r\n                node = ((BaseRuntimeTreeNode)node).GetValue(functionContextContainer, type);\r\n            }\r\n\r\n            if (node != null && !type.IsInstanceOfType(node))\r\n            {\r\n                node = ValueTypeConverter.Convert(node, type);\r\n            }\r\n\r\n            return node;\r\n        }\r\n\r\n        private static object CreateLazyObject(Func<object> func, Type type)\r\n        {\r\n            return NewLazyObjectMethodInfo.MakeGenericMethod(type).Invoke(null, new object[] { func });\r\n        }\r\n\r\n        private static Lazy<T> NewLazyObject<T>(Func<object> func)\r\n        {\r\n            return new Lazy<T>(() => (T) func(), true);\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsDefaultValue(string parameterName)\r\n        {\r\n            return _parameters[parameterName].IsDefaultValue;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void AddConstantParameter(string parameterName, object value, Type parameterType, bool isDefaultValue = false)\r\n        {\r\n            Verify.That(!_parameters.ContainsKey(parameterName), \"Parameter '{0}' has already been assigned\", parameterName);\r\n\r\n            _parameters.Add(parameterName, new StoredParameterReturnValue { ValueObject = value, ValueType = parameterType, IsDefaultValue = isDefaultValue});\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void AddLazyParameter(string parameterName, BaseRuntimeTreeNode runtimeTreeNode, Type parameterType)\r\n        {\r\n            Verify.That(!_parameters.ContainsKey(parameterName), \"Parameter '{0}' has already been assigned\", parameterName);\r\n\r\n            _parameters.Add(parameterName, new StoredParameterReturnValue { ValueObject = runtimeTreeNode, ValueType = parameterType, IsDefaultValue = false });\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/ParameterProfile.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class ParameterProfile\r\n\t{\r\n        private readonly WidgetFunctionProvider _widgetFunctionProvider;\r\n        private Dictionary<string, object> _widgetFunctionRuntimeParameters;\r\n\r\n        private bool? _isInjectedValue;\r\n\r\n        /// <exclude />\r\n        public ParameterProfile(string name, Type type, bool isRequired, BaseValueProvider fallbackValueProvider, WidgetFunctionProvider widgetFunctionProvider, string label, HelpDefinition helpDefinition)\r\n            : this(name, type, isRequired, fallbackValueProvider, widgetFunctionProvider, label, helpDefinition, false)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public ParameterProfile(\r\n            string name, \r\n            Type type, \r\n            bool isRequired, \r\n            BaseValueProvider fallbackValueProvider, \r\n            WidgetFunctionProvider widgetFunctionProvider, \r\n            string label, \r\n            HelpDefinition helpDefinition, \r\n            bool hideInSimpleView)\r\n        {\r\n            Verify.ArgumentNotNull(name, \"name\");\r\n            Verify.ArgumentNotNull(type, \"type\");\r\n            Verify.ArgumentNotNull(fallbackValueProvider, \"fallbackValueProvider\");\r\n            Verify.ArgumentCondition(!label.IsNullOrEmpty(), \"label\", \"label may not be null or an empty string\");\r\n            Verify.ArgumentNotNull(helpDefinition, \"helpDefinition\");\r\n\r\n            this.Name = name;\r\n            this.Type = type;\r\n            this.IsRequired = isRequired && (!type.IsGenericType || type.GetGenericTypeDefinition() != typeof(NullableDataReference<>));\r\n            this.FallbackValueProvider = fallbackValueProvider;\r\n            _widgetFunctionProvider = widgetFunctionProvider;\r\n            this.Label = label;\r\n            this.HelpDefinition = helpDefinition;\r\n            this.HideInSimpleView = hideInSimpleView;\r\n        }\r\n\r\n        /// <exclude />\r\n        public ParameterProfile(\r\n            string name, Type type, bool isRequired, BaseValueProvider fallbackValueProvider, WidgetFunctionProvider widgetFunctionProvider, \r\n            Dictionary<string,object> widgetFunctionRuntimeParameters, string label, HelpDefinition helpDefinition)\r\n            : this( name, type, isRequired, fallbackValueProvider, widgetFunctionProvider, label, helpDefinition )\r\n        {\r\n            _widgetFunctionRuntimeParameters = widgetFunctionRuntimeParameters;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Shows whether the value for the parameter can be dynamically provided.\r\n        /// </summary>\r\n        public bool IsInjectedValue\r\n        {\r\n            get\r\n            {\r\n                if (_isInjectedValue == null)\r\n                {\r\n                    var type = Type;\r\n                    _isInjectedValue = !type.IsPrimitive && ServiceLocator.HasService(type);\r\n                }\r\n\r\n                return _isInjectedValue.Value;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Name { get; private set; }\r\n\r\n        /// <exclude />\r\n        public Type Type { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsRequired { get; private set; }\r\n\r\n        /// <exclude />\r\n        public BaseValueProvider FallbackValueProvider { get; private set; }\r\n\r\n        /// <exclude />\r\n        public bool HideInSimpleView { get; internal set; }\r\n\r\n        /// <exclude />\r\n        public IWidgetFunction WidgetFunction \r\n        {\r\n            get\r\n            {\r\n                return _widgetFunctionProvider != null ? _widgetFunctionProvider.WidgetFunction : null;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<BaseParameterRuntimeTreeNode> WidgetFunctionParameters\r\n        {\r\n            get\r\n            {\r\n                return _widgetFunctionProvider.WidgetFunctionParameters;\r\n            }\r\n        }\r\n\r\n//#warning Kill this?\r\n//        public Dictionary<string,object> WidgetFunctionRuntimeParameters \r\n//        {\r\n//            get\r\n//            {\r\n//                if (_widgetFunctionRuntimeParameters == null) return null;\r\n\r\n//                Dictionary<string, object> parameters = new Dictionary<string, object>(_widgetFunctionRuntimeParameters);\r\n//                foreach (BaseParameterRuntimeTreeNode param in _widgetFunctionProvider.WidgetFunctionParameters)\r\n//                {\r\n//                    if (parameters.ContainsKey(param.Name) == false)\r\n//                    {\r\n//                        parameters.Add(param.Name, param.GetValue());\r\n//                    }\r\n//                }\r\n\r\n//                return parameters;\r\n//            }\r\n//        }\r\n\r\n        /// <exclude />\r\n        public string Label{ get; private set; }\r\n\r\n        /// <exclude />\r\n        public HelpDefinition HelpDefinition { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public object GetDefaultValue()\r\n        {\r\n            // Initializing the binding\r\n            object value = null;\r\n\r\n            try\r\n            {\r\n                var fallbackValueProvider = FallbackValueProvider;\r\n\r\n                if (!(fallbackValueProvider is NoValueValueProvider))\r\n                {\r\n                    object defaultValue = fallbackValueProvider.GetValue();\r\n\r\n                    if (defaultValue != null)\r\n                    {\r\n                        value = ValueTypeConverter.Convert(defaultValue, this.Type);\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogWarning(typeof(ParameterProfile).Name, ex);\r\n            }\r\n\r\n            if (value == null)\r\n            {\r\n                if (this.Type == typeof(bool))\r\n                {\r\n                    value = false;\r\n                }\r\n            }\r\n            return value;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string LabelLocalized\r\n        {\r\n            get\r\n            {\r\n                return this.Label.StartsWith(\"${\") ? StringResourceSystemFacade.ParseString(this.Label) : this.Label;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/PathInfoRoutedDataUrlMapper.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Foundation.PluginFacades;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\n\r\nusing DataRouteKind = Composite.Functions.RoutedData.DataRouteKind;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    internal class PathInfoRoutedDataUrlMapper<T> : IRoutedDataUrlMapper where T : class, IData\r\n    {\r\n        private readonly Guid _pageId;\r\n        private readonly DataRouteKind _dataRouteKind;\r\n\r\n        private static PropertyInfo _keyPropertyInfo;\r\n        private static PropertyInfo _labelPropertyInfo;\r\n\r\n        public PathInfoRoutedDataUrlMapper(Guid pageId, DataRouteKind dataRouteKind)\r\n        {\r\n            _pageId = pageId;\r\n            _dataRouteKind = dataRouteKind;\r\n\r\n            if ((dataRouteKind & DataRouteKind.Key) > 0 && _keyPropertyInfo == null)\r\n            {\r\n                // TODO: support for compound keys\r\n                _keyPropertyInfo = typeof(T).GetKeyProperties()\r\n                .SingleOrException(\"No key fields found on data type '{0}''\",\r\n                                   \"Data type '{0}' should have a single key field\", typeof(T).FullName);\r\n            }\r\n\r\n            if ((dataRouteKind & DataRouteKind.Label) > 0 && _labelPropertyInfo == null)\r\n            {\r\n                var labelPropertyInfo = typeof(T).GetLabelPropertyInfo();\r\n                Verify.IsNotNull(labelPropertyInfo, \"No label property defined for type '{0}'\", typeof(T));\r\n\r\n                Verify.That(labelPropertyInfo.PropertyType == typeof(string), \r\n                    \"Not string label fields aren't supported. Label property '{0}', data type '{1}'\",\r\n                    labelPropertyInfo.Name, typeof(T));\r\n\r\n                _labelPropertyInfo = labelPropertyInfo;\r\n            }\r\n        }\r\n\r\n        public RoutedDataModel GetRouteDataModel(PageUrlData pageUrlData)\r\n        {\r\n            string pathInfo = pageUrlData.PathInfo;\r\n            if (pathInfo.IsNullOrEmpty())\r\n            {\r\n                return new RoutedDataModel(GetListQueryable);\r\n            }\r\n\r\n            switch (_dataRouteKind)\r\n            {\r\n                case DataRouteKind.Key:\r\n                case DataRouteKind.KeyAndLabel:\r\n                    {\r\n                        string key;\r\n                        string label = null;\r\n \r\n                        if (_dataRouteKind == DataRouteKind.KeyAndLabel)\r\n                        {\r\n                            string[] parts = pathInfo.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);\r\n                            if (parts.Length > 2)\r\n                            {\r\n                                return new RoutedDataModel();\r\n                            }\r\n                            key = parts[0];\r\n                            label = parts.Length == 2 ? parts[1] : null;\r\n                        }\r\n                        else\r\n                        {\r\n                            if (pathInfo.Length < 2 || pathInfo.LastIndexOf('/') > 0)\r\n                            {\r\n                                return new RoutedDataModel();\r\n                            }\r\n\r\n                            key = pathInfo.Substring(1);\r\n                        }\r\n\r\n                        var keyType = _keyPropertyInfo.PropertyType;\r\n\r\n                        bool keyParsed;\r\n                        object keyValue;\r\n                        if (keyType == typeof (Guid))\r\n                        {\r\n                            Guid guid;\r\n                            keyParsed = UrlUtils.TryExpandGuid(key, out guid) && guid != Guid.Empty;\r\n                            keyValue = guid;\r\n                        }\r\n                        else\r\n                        {\r\n                            keyValue = ValueTypeConverter.Convert(key, keyType);\r\n                            keyParsed = keyValue != null;\r\n                        }\r\n                        \r\n                        if(!keyParsed)\r\n                        {\r\n                            return new RoutedDataModel();\r\n                        }\r\n\r\n                        var data = DataFacade.TryGetDataByUniqueKey<T>(keyValue);\r\n\r\n                        return new RoutedDataModel(data);\r\n                    }\r\n\r\n                case DataRouteKind.Label:\r\n                    {\r\n                        if (pathInfo.Length < 2 || pathInfo.LastIndexOf('/') > 0)\r\n                        {\r\n                            return new RoutedDataModel();\r\n                        }\r\n\r\n                        string label = UrlUtils.DecodeUrlInvalidCharacters(pathInfo.Substring(1));\r\n\r\n                        var data = GetDataByLabel(label);\r\n                        return new RoutedDataModel(data);\r\n                    }\r\n                default:\r\n                    throw new InvalidOperationException(\"Not supported data url kind: \" + _dataRouteKind);\r\n            }\r\n        }\r\n\r\n        private IQueryable GetListQueryable()\r\n        {\r\n            IQueryable<T> unorderedQuery = DataFacade.GetData<T>();\r\n\r\n            if (typeof (IPageRelatedData).IsAssignableFrom(typeof (T)))\r\n            {\r\n                unorderedQuery = unorderedQuery.Where(t => (t as IPageRelatedData).PageId == _pageId);\r\n            }\r\n\r\n            return DataGroupingProviderHelper.OrderData(unorderedQuery, typeof(T));\r\n        }\r\n\r\n        public PageUrlData BuildItemUrl(IData dataItem)\r\n        {\r\n            Verify.ArgumentNotNull(dataItem, \"dataItem\");\r\n\r\n            string keyUrlPart = null;\r\n            string labelUrlPart = null;\r\n\r\n            if ((_dataRouteKind & DataRouteKind.Key) > 0)\r\n            {\r\n                keyUrlPart = GetUrlKey(dataItem);\r\n            }\r\n\r\n            if ((_dataRouteKind & DataRouteKind.Label) > 0)\r\n            {\r\n                labelUrlPart = GetUrlLabel(dataItem, _dataRouteKind == DataRouteKind.KeyAndLabel);\r\n            }\r\n\r\n            string pathInfo;\r\n            switch (_dataRouteKind)\r\n            {\r\n                case DataRouteKind.Key:\r\n                    pathInfo = \"/\" + keyUrlPart;\r\n                    break;\r\n                case DataRouteKind.KeyAndLabel:\r\n                    pathInfo = \"/\" + keyUrlPart + \"/\" + labelUrlPart;\r\n                    break;\r\n                case DataRouteKind.Label:\r\n                    pathInfo = \"/\" + labelUrlPart;\r\n                    break;\r\n                default:\r\n                    throw new InvalidOperationException(\"Not supported data url kind: \" + _dataRouteKind);\r\n            }\r\n\r\n            var culture = LocalizationScopeManager.CurrentLocalizationScope;\r\n            var publicationScope = DataScopeManager.CurrentDataScope.ToPublicationScope();\r\n            return new PageUrlData(_pageId, publicationScope, culture) { PathInfo = pathInfo };\r\n        }\r\n\r\n        private static T GetDataByLabel(string label)\r\n        {\r\n            var query = DataFacade.GetData<T>();\r\n\r\n            var parameterExpression = Expression.Parameter(typeof (T));\r\n            var labelPropertyExpression = Expression.Property(parameterExpression, _labelPropertyInfo);\r\n            var equalsExpression = Expression.Equal(labelPropertyExpression, Expression.Constant(label));\r\n\r\n            var lambdaExpression = Expression.Lambda<Func<T, bool>>(equalsExpression, parameterExpression);\r\n\r\n            var list = query.Where(lambdaExpression).Take(2).ToList();\r\n\r\n            if (list.Count == 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (list.Count > 1)\r\n            {\r\n                throw new DataUrlCollisionException(typeof(T), new RelativeRoute {PathSegments = new []{label}});\r\n            }\r\n\r\n            return list[0];\r\n        }\r\n\r\n        private static string LabelToUrlPart(string label, bool allowDataLoss)\r\n        {\r\n            return allowDataLoss \r\n                ? UrlFormattersPluginFacade.FormatUrl(label, true)\r\n                : UrlUtils.EncodeUrlInvalidCharacters(label);\r\n        }\r\n\r\n        private static string GetUrlLabel(IData data, bool allowDataLoss)\r\n        {\r\n            object labelValue = _labelPropertyInfo.GetValue(data);\r\n            if (labelValue == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string label = ValueTypeConverter.Convert<string>(labelValue);\r\n\r\n            return string.IsNullOrEmpty(label) ? null : LabelToUrlPart(label, allowDataLoss);\r\n        }\r\n\r\n        private static string GetUrlKey(IData data)\r\n        {\r\n            object keyValue = _keyPropertyInfo.GetValue(data);\r\n\r\n            if (keyValue == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (keyValue is Guid)\r\n            {\r\n                return UrlUtils.CompressGuid((Guid) keyValue);\r\n            }\r\n\r\n            string urlKey = keyValue.ToString();\r\n            return string.IsNullOrEmpty(urlKey) ? null : urlKey;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/FunctionNotifier.cs",
    "content": "﻿using Composite.C1Console.Events;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Functions.Foundation;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider\r\n{\r\n    /// <summary>\r\n    /// A function provider can use this class to notify if the providers list of functions\r\n    /// has been changed.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FunctionNotifier\r\n\t{        \r\n        internal FunctionNotifier(string providerName)\r\n        {\r\n            this.ProviderName = providerName;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void FunctionsUpdated()\r\n        {\r\n            if (SystemSetupFacade.SetupIsRunning)\r\n            {\r\n                return;\r\n            }\r\n\r\n            MetaFunctionProviderRegistry.ReinitializeFunctionFromProvider(this.ProviderName);\r\n\r\n            GlobalEventSystemFacade.FireDesignChangeEvent();\r\n        }\r\n\r\n\r\n\r\n        private string ProviderName\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/FunctionProviderData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(NonConfigurableFunctionProvider))]\r\n    public class FunctionProviderData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/IDynamicTypeFunctionProvider.cs",
    "content": "using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IDynamicTypeFunctionProvider : IFunctionProvider\r\n\t{\r\n        /// <exclude />\r\n        IEnumerable<IFunction> DynamicTypeDependentFunctions { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/IFunctionProvider.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.Functions.Plugins.FunctionProvider.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [CustomFactory(typeof(FunctionProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(FunctionProviderDefaultNameRetriever))]\r\n\tpublic interface IFunctionProvider\r\n\t{\r\n        /// <exclude />\r\n        FunctionNotifier FunctionNotifier { set; }\r\n\r\n        /// <exclude />\r\n        IEnumerable<IFunction> Functions { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/NonConfigurableFunctionProvider.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableFunctionProviderAssembler))]\r\n    internal sealed class NonConfigurableFunctionProvider : FunctionProviderData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableFunctionProviderAssembler : IAssembler<IFunctionProvider, FunctionProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IFunctionProvider Assemble(IBuilderContext context, FunctionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IFunctionProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/Runtime/FunctionProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider.Runtime\r\n{\r\n    internal sealed class FunctionProviderCustomFactory : AssemblerBasedCustomFactory<IFunctionProvider, FunctionProviderData>\r\n    {\r\n        protected override FunctionProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            FunctionProviderSettings settings = configurationSource.GetSection(FunctionProviderSettings.SectionName) as FunctionProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", FunctionProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.FunctionProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/Runtime/FunctionProviderDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider.Runtime\r\n{\r\n    internal sealed class FunctionProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/Runtime/FunctionProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider.Runtime\r\n{\r\n    internal sealed class FunctionProviderFactory : NameTypeFactoryBase<IFunctionProvider>\r\n    {\r\n        public FunctionProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/FunctionProvider/Runtime/FunctionProviderSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.Core.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.FunctionProvider.Runtime\r\n{\r\n    internal sealed class FunctionProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Functions.Plugins.FunctionProviderConfiguration\";\r\n\r\n\r\n        private const string _dataProviderPluginsProperty = \"FunctionProviderPlugins\";\r\n        [ConfigurationProperty(_dataProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<FunctionProviderData> FunctionProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<FunctionProviderData>)base[_dataProviderPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/IDynamicTypeWidgetFunctionProvider.cs",
    "content": "using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IDynamicTypeWidgetFunctionProvider : IWidgetFunctionProvider\r\n\t{\r\n        /// <exclude />\r\n        IEnumerable<IWidgetFunction> DynamicTypeDependentFunctions { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/IWidgetFunctionProvider.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.Functions.Plugins.WidgetFunctionProvider.Runtime;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [CustomFactory(typeof(WidgetFunctionProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(WidgetFunctionProviderDefaultNameRetriever))]\r\n\tpublic interface IWidgetFunctionProvider\r\n\t{\r\n        /// <exclude />\r\n        WidgetFunctionNotifier WidgetFunctionNotifier { set; }\r\n\r\n        /// <exclude />\r\n        IEnumerable<IWidgetFunction> Functions { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/NonConfigurableWidgetFunctionProvider.cs",
    "content": "using System;\r\n\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableWidgetFunctionProviderAssembler))]\r\n    internal sealed class NonConfigurableWidgetFunctionProvider : WidgetFunctionProviderData\r\n    {\r\n    }\r\n\r\n    internal sealed class NonConfigurableWidgetFunctionProviderAssembler : IAssembler<IWidgetFunctionProvider, WidgetFunctionProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IWidgetFunctionProvider Assemble(IBuilderContext context, WidgetFunctionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return (IWidgetFunctionProvider)Activator.CreateInstance(objectConfiguration.Type);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/Runtime/WidgetFunctionProviderCustomFactory.cs",
    "content": "using System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider.Runtime\r\n{\r\n    internal sealed class WidgetFunctionProviderCustomFactory : AssemblerBasedCustomFactory<IWidgetFunctionProvider, WidgetFunctionProviderData>\r\n    {\r\n        protected override WidgetFunctionProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            WidgetFunctionProviderSettings settings = configurationSource.GetSection(WidgetFunctionProviderSettings.SectionName) as WidgetFunctionProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(string.Format(\"The configuration section '{0}' was not found in the configuration\", WidgetFunctionProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.WidgetFunctionProviderPlugins.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/Runtime/WidgetFunctionProviderDefaultNameRetriever.cs",
    "content": "using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider.Runtime\r\n{\r\n    internal sealed class WidgetFunctionProviderDefaultNameRetriever : IConfigurationNameMapper\r\n    {\r\n        public string MapName(string name, IConfigurationSource configSource)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/Runtime/WidgetFunctionProviderFactory.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider.Runtime\r\n{\r\n    internal sealed class WidgetFunctionProviderFactory : NameTypeFactoryBase<IWidgetFunctionProvider>\r\n    {\r\n        public WidgetFunctionProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/Runtime/WidgetFunctionProviderSettings.cs",
    "content": "using System.Configuration;\r\n\r\nusing Composite.Core.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider.Runtime\r\n{\r\n    internal sealed class WidgetFunctionProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Functions.Plugins.WidgetFunctionProviderConfiguration\";\r\n\r\n\r\n        private const string _dataProviderPluginsProperty = \"WidgetFunctionProviderPlugins\";\r\n        [ConfigurationProperty(_dataProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<WidgetFunctionProviderData> WidgetFunctionProviderPlugins\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<WidgetFunctionProviderData>)base[_dataProviderPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/WidgetFunctionNotifier.cs",
    "content": "using Composite.Functions.Foundation;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider\r\n{\r\n    /// <summary>\r\n    /// A widget function provider can use this class to notify if the providers list of functions\r\n    /// has been changed.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class WidgetFunctionNotifier\r\n    {\r\n        internal WidgetFunctionNotifier(string providerName)\r\n        {\r\n            this.ProviderName = providerName;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void WidgetFunctionsUpdated()\r\n        {\r\n            MetaFunctionProviderRegistry.ReinitializeWidgetFunctionFromProvider(this.ProviderName);\r\n        }\r\n\r\n\r\n\r\n        private string ProviderName\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/WidgetFunctionProvider/WidgetFunctionProviderData.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.WidgetFunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(NonConfigurableWidgetFunctionProvider))]\r\n    public class WidgetFunctionProviderData : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/XslExtensionsProvider/IXslExtensionsProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Functions.Plugins.FunctionProvider.Runtime;\r\nusing Composite.Functions.Plugins.XslExtensionsProvider.Runtime;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Functions.Plugins.XslExtensionsProvider\r\n{\r\n    [CustomFactory(typeof(XslExtensionsProviderCustomFactory))]\r\n    [ConfigurationNameMapper(typeof(FunctionProviderDefaultNameRetriever))]\r\n\tinternal interface IXslExtensionsProvider\r\n\t{\r\n\t    List<Pair<string, object>> CreateExtensions();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/XslExtensionsProvider/Runtime/XslExtensionsProviderCustomFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Functions.Plugins.XslExtensionsProvider.Runtime\r\n{\r\n    internal sealed class XslExtensionsProviderCustomFactory : AssemblerBasedCustomFactory<IXslExtensionsProvider, XslExtensionsProviderData>\r\n    {\r\n        protected override XslExtensionsProviderData GetConfiguration(string name, IConfigurationSource configurationSource)\r\n        {\r\n            XslExtensionsProviderSettings settings =\r\n                configurationSource.GetSection(XslExtensionsProviderSettings.SectionName) as XslExtensionsProviderSettings;\r\n\r\n            if (null == settings)\r\n            {\r\n                throw new ConfigurationErrorsException(\r\n                    string.Format(\"The configuration section '{0}' was not found in the configuration\",\r\n                                  XslExtensionsProviderSettings.SectionName));\r\n            }\r\n\r\n            return settings.XslExtensionProviders.Get(name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/XslExtensionsProvider/Runtime/XslExtensionsProviderFactory.cs",
    "content": "﻿using Composite.Core.Configuration;\r\nusing Composite.Functions.Plugins.XslExtensionsProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Functions.Foundation.PluginFacades.Runtime\r\n{\r\n    internal sealed class XslExtensionsProviderFactory : NameTypeFactoryBase<IXslExtensionsProvider>\r\n    {\r\n        public XslExtensionsProviderFactory()\r\n            : base(ConfigurationServices.ConfigurationSource)\r\n        {\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/Plugins/XslExtensionsProvider/Runtime/XslExtensionsProviderSettings.cs",
    "content": "﻿using System.Configuration;\r\n\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Functions.Plugins.XslExtensionsProvider.Runtime\r\n{\r\n    internal sealed class XslExtensionsProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Functions.Plugins.XslExtensionsProviderConfiguration\";\r\n\r\n        private const string _dataProviderPluginsProperty = \"XslExtensionProviders\";\r\n        [ConfigurationProperty(_dataProviderPluginsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<XslExtensionsProviderData> XslExtensionProviders\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<XslExtensionsProviderData>)base[_dataProviderPluginsProperty];\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Functions/Plugins/XslExtensionsProvider/XslExtensionsProviderData.cs",
    "content": "﻿using Composite.Core.Configuration;\r\n\r\nnamespace Composite.Functions.Plugins.XslExtensionsProvider\r\n{\r\n    internal class XslExtensionsProviderData : NameTypeManagerTypeConfigurationElement\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/RoutedData.cs",
    "content": "﻿using System;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Pages;\r\nusing System.Web;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Functions\r\n{\r\n\r\n    /// <summary>\r\n    /// Parameter return type for functions handling data references passed via url format, defined with attribute on the data types.\r\n    /// If none defined, it the url format will be the same as in <see cref=\"RoutedData.ById{T}\"/>\r\n    /// </summary>\r\n    /// <typeparam name=\"T\"></typeparam>\r\n    public class RoutedData<T> : PathInfoRoutedData<T> where T : class, IData\r\n    {\r\n        /// <exclude />\r\n        protected override IRoutedDataUrlMapper GetUrlMapper()\r\n        {\r\n            var pageId = PageRenderer.CurrentPageId;\r\n            Verify.That(pageId != Guid.Empty, \"The current page is not set\");\r\n\r\n            IRoutedDataUrlMapper mapper = AttributeBasedRoutedDataUrlMapper.GetDataUrlMapper(typeof(T), pageId);\r\n\r\n            return mapper ?? new PathInfoRoutedDataUrlMapper<T>(pageId, RoutedData.DataRouteKind.Key);\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Contains subclasses that can be used as function parameters that provide data routing.\r\n    /// </summary>\r\n    public static class RoutedData\r\n    {\r\n        [Flags]\r\n        internal enum DataRouteKind\r\n        {\r\n            Key = 1,\r\n            Label = 2,\r\n            KeyAndLabel = 3,\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Registers function parameter types that enable data url routing.\r\n        /// </summary>\r\n        /// <param name=\"serviceCollection\"></param>\r\n        public static void AddRoutedData(this IServiceCollection serviceCollection)\r\n        {\r\n            Action<Type> registerType = type => serviceCollection.Add(new ServiceDescriptor(type, type, ServiceLifetime.Scoped));\r\n\r\n            registerType(typeof(ById<>));\r\n            registerType(typeof(ByIdAndLabel<>));\r\n            registerType(typeof(ByLabel<>));\r\n            registerType(typeof(RoutedData<>));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parameter return type for functions handling data references passed via url {pageUrl}/{DataId}\r\n        /// </summary>\r\n        /// <typeparam name=\"T\">The data type.</typeparam>\r\n        public class ById<T> : PathInfoRoutedData<T> where T : class, IData\r\n        {\r\n            /// <exclude />\r\n            protected override IRoutedDataUrlMapper GetUrlMapper()\r\n            {\r\n                var page = PageRenderer.CurrentPage;\r\n                Verify.IsNotNull(page, \"The current page is not set\");\r\n\r\n                return new PathInfoRoutedDataUrlMapper<T>(page.Id, DataRouteKind.Key);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parameter return type for functions handling data references passed via url {pageUrl}/{DataId}/{data label}\r\n        /// </summary>\r\n        /// <typeparam name=\"T\">The data type.</typeparam>\r\n        public class ByIdAndLabel<T> : PathInfoRoutedData<T> where T : class, IData\r\n        {\r\n            /// <exclude />\r\n            protected override IRoutedDataUrlMapper GetUrlMapper()\r\n            {\r\n                var page = PageRenderer.CurrentPage;\r\n                Verify.IsNotNull(page, \"The current page is not set\");\r\n\r\n                return new PathInfoRoutedDataUrlMapper<T>(page.Id, DataRouteKind.KeyAndLabel);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parameter return type for functions handling data references passed via url {pageUrl}/{data label}\r\n        /// </summary>\r\n        /// <typeparam name=\"T\">The data type.</typeparam>\r\n        public class ByLabel<T> : PathInfoRoutedData<T> where T : class, IData\r\n        {\r\n            /// <exclude />\r\n            protected override IRoutedDataUrlMapper GetUrlMapper()\r\n            {\r\n                var page = PageRenderer.CurrentPage;\r\n                Verify.IsNotNull(page, \"The current page is not set\");\r\n\r\n                // return new LabelDataUrlMapper(page);\r\n                return new PathInfoRoutedDataUrlMapper<T>(page.Id, DataRouteKind.Label);\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Gets a instance of a <see cref=\"IDataUrlMapper\"/> that can map data references to URLs of with the following format &quot;/{page URL}/{data ID}&quot;\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <returns></returns>\r\n        public static IDataUrlMapper GetRoutedByIdDataUrlMapper(Guid pageId, Type dataType)\r\n        {\r\n            return GetMapperByType(dataType, pageId, DataRouteKind.Key);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a instance of a <see cref=\"IDataUrlMapper\"/> that can map data references to URLs of with the following format &quot;/{page URL}/{data item label}&quot;\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <returns></returns>\r\n        public static IDataUrlMapper GetRoutedByLabelDataUrlMapper(Guid pageId, Type dataType)\r\n        {\r\n            return GetMapperByType(dataType, pageId, DataRouteKind.Label);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a instance of a <see cref=\"IDataUrlMapper\"/> that can map data references to URLs of with the following format &quot;/{page URL}/{data ID}/{data item label}&quot;\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <returns></returns>\r\n        public static IDataUrlMapper GetRoutedByIdAndLabelDataUrlMapper(Guid pageId, Type dataType)\r\n        {\r\n            return GetMapperByType(dataType, pageId, DataRouteKind.KeyAndLabel);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Get a default <see cref=\"IDataUrlMapper\"/>  for the given data type.\r\n        /// </summary>\r\n        /// <param name=\"pageId\">The page id.</param>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <returns></returns>\r\n        public static IDataUrlMapper GetDefaultDataUrlMapper(Guid pageId, Type dataType)\r\n        {\r\n            IRoutedDataUrlMapper mapper = AttributeBasedRoutedDataUrlMapper.GetDataUrlMapper(dataType, pageId);\r\n            if (mapper == null)\r\n            {\r\n                return GetRoutedByIdDataUrlMapper(pageId, dataType);\r\n            }\r\n\r\n            return new RoutedDataUrlMapperAdapter(mapper);\r\n        }\r\n\r\n\r\n        private static IDataUrlMapper GetMapperByType(Type dataType, Guid pageId, DataRouteKind routeKind)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, \"dataType\");\r\n            Verify.ArgumentCondition(pageId != Guid.Empty, \"pageId\", \"An empty guid is not allowed here\");\r\n\r\n            // TODO: use static reflection here\r\n            var constructor = typeof (PathInfoRoutedDataUrlMapper<>)\r\n                .MakeGenericType(dataType)\r\n                .GetConstructor(new [] {typeof (Guid), typeof (DataRouteKind)});\r\n\r\n            Verify.IsNotNull(constructor, \"Failed to get PathInfoRoutedDataUrlMapper constructor\");\r\n            var routedDataUrlMapper = (IRoutedDataUrlMapper) constructor.Invoke(new object[] {pageId, routeKind});\r\n\r\n            return new RoutedDataUrlMapperAdapter(routedDataUrlMapper);\r\n        }\r\n\r\n        internal class RoutedDataUrlMapperAdapter : IDataUrlMapper\r\n        {\r\n            private readonly IRoutedDataUrlMapper _mapper;\r\n\r\n            public RoutedDataUrlMapperAdapter(IRoutedDataUrlMapper mapper)\r\n            {\r\n                _mapper = mapper;\r\n            }\r\n\r\n            public IDataReference GetData(PageUrlData pageUrlData)\r\n            {\r\n                var model = _mapper.GetRouteDataModel(pageUrlData);\r\n                return model.IsRouteResolved && model.IsItem ? model.Item.ToDataReference() : null;\r\n            }\r\n\r\n            public PageUrlData GetPageUrlData(IDataReference instance)\r\n            {\r\n                var data = instance.Data;\r\n                return data != null ? _mapper.BuildItemUrl(data) : null;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    /// <exclude />\r\n    public class RoutedDataModel\r\n    {\r\n        /// <exclude />\r\n        public RoutedDataModel()\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public RoutedDataModel(IData item)\r\n        {\r\n            Item = item;\r\n            IsItem = item != null;\r\n            IsRouteResolved = item != null;\r\n        }\r\n\r\n        /// <exclude />\r\n        public RoutedDataModel(Func<IQueryable> getQueryable)\r\n        {\r\n            QueryableBuilder = getQueryable;\r\n            IsRouteResolved = true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsRouteResolved { get; protected set; }\r\n\r\n        /// <exclude />\r\n        public bool IsItem { get; protected set; }\r\n\r\n        /// <exclude />\r\n        public IData Item { get; protected set; }\r\n\r\n        /// <exclude />\r\n        public Func<IQueryable> QueryableBuilder { get; protected set; }\r\n    }\r\n \r\n\r\n\r\n    /// <summary>\r\n    /// Base class for return type of a data parameter. \r\n    /// </summary>\r\n    /// <typeparam name=\"T\"></typeparam>\r\n    public abstract class PathInfoRoutedData<T> where T : class, IData\r\n    {\r\n        private RoutedDataModel _model;\r\n\r\n        /// <summary>\r\n        /// Creates an instace of <see cref=\"PathInfoRoutedData{T}\"/>\r\n        /// </summary>\r\n        protected PathInfoRoutedData()\r\n        {\r\n            var urlMapper = GetUrlMapper();\r\n            Verify.IsNotNull(urlMapper, \"UrlMapper is null\");\r\n\r\n            DataUrls.RegisterDynamicDataUrlMapper(PageRenderer.CurrentPageId, typeof(T), new RoutedData.RoutedDataUrlMapperAdapter(urlMapper));\r\n\r\n            var pageUrlData = C1PageRoute.PageUrlData;\r\n\r\n            RoutedDataModel model;\r\n\r\n            try\r\n            {\r\n                model = urlMapper.GetRouteDataModel(pageUrlData) ?? new RoutedDataModel();\r\n            }\r\n            catch (DataUrlCollisionException)\r\n            {\r\n                C1PageRoute.RegisterPathInfoUsage();\r\n                throw;\r\n            }\r\n\r\n            SetModel(model);\r\n\r\n            if (!string.IsNullOrEmpty(pageUrlData.PathInfo) && model.IsRouteResolved)\r\n            {\r\n                if (model.IsItem)\r\n                {\r\n                    var canonicalUrlData = urlMapper.BuildItemUrl(model.Item);\r\n                    if (canonicalUrlData.PathInfo != pageUrlData.PathInfo)\r\n                    {\r\n                        string newUrl = PageUrls.BuildUrl(canonicalUrlData);\r\n                        if (newUrl != null)\r\n                        {\r\n                            PermanentRedirect(newUrl);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                C1PageRoute.RegisterPathInfoUsage();\r\n            }\r\n        }\r\n\r\n        private static void PermanentRedirect(string url)\r\n        {\r\n            var response = HttpContext.Current.Response;\r\n\r\n            response.AddHeader(\"Location\", url);\r\n            response.StatusCode = 301; //  \"Moved Permanently\"\r\n            response.End();\r\n        }\r\n\r\n        /// <exclude />\r\n        protected abstract IRoutedDataUrlMapper GetUrlMapper();\r\n\r\n        /// <summary>\r\n        /// Sets the data model.\r\n        /// </summary>\r\n        /// <param name=\"model\">The data model.</param>\r\n        protected virtual void SetModel(RoutedDataModel model)\r\n        {\r\n            _model = model;\r\n        }\r\n\r\n        /// <summary>\r\n        /// A data item to be shown in a detail view.\r\n        /// </summary>\r\n        public virtual T Item\r\n        {\r\n            get\r\n            {\r\n                var model = Model;\r\n                Verify.That(model.IsItem, \"This property should not be called when IsDetailView is false\");\r\n                return (T)model.Item;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether the route has been resolved.\r\n        /// </summary>\r\n        public bool IsRouteResolved\r\n        {\r\n            get { return Model.IsRouteResolved; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether a detail view should be shown\r\n        /// </summary>\r\n        public bool IsItem\r\n        {\r\n            get { return Model.IsItem; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Indicates whether a list view should be shown\r\n        /// </summary>\r\n        public bool IsList\r\n        {\r\n            get { return Model.IsRouteResolved && !Model.IsItem; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a filtered list of data items.\r\n        /// </summary>\r\n        public virtual IQueryable<T> List\r\n        {\r\n            get\r\n            {\r\n                var model = Model;\r\n\r\n                if (!model.IsRouteResolved)\r\n                {\r\n                    return Enumerable.Empty<T>().AsQueryable();\r\n                }\r\n\r\n                return model.IsItem ? (new[] { (T)model.Item }).AsQueryable() : (IQueryable<T>)model.QueryableBuilder();\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a public url to the specified data item.\r\n        /// </summary>\r\n        /// <param name=\"data\">The data item.</param>\r\n        /// <returns></returns>\r\n        public virtual string ItemUrl(IData data)\r\n        {\r\n            var mapper = GetUrlMapper();\r\n            return PageUrls.BuildUrl(mapper.BuildItemUrl(data));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a public url to the specified data item key.\r\n        /// </summary>\r\n        /// <param name=\"key\">The key value.</param>\r\n        /// <returns></returns>\r\n        public virtual string ItemUrl(object key)\r\n        {\r\n            var data = DataFacade.GetDataByUniqueKey<T>(key);\r\n            if (data == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var mapper = GetUrlMapper();\r\n            return PageUrls.BuildUrl(mapper.BuildItemUrl(data));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a url link to the current page\r\n        /// </summary>\r\n        public virtual string ListUrl\r\n        {\r\n            get\r\n            {\r\n                return PageUrls.BuildUrl(PageRenderer.CurrentPage) ??\r\n                       PageUrls.BuildUrl(PageRenderer.CurrentPage, UrlKind.Internal);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns a currently resolved model.\r\n        /// </summary>\r\n        protected virtual RoutedDataModel Model\r\n        {\r\n            get\r\n            {\r\n                Verify.IsNotNull(_model, \"The model object is not set\");\r\n\r\n                return _model;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/StandardFunctionSecurityAncestorProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>\r\n    /// Use this security ancestor provider for custom functions that\r\n    /// will be an element under the 'All Functions' section in the C1 console.\r\n    /// This provider assumes that the full name of the function, including namespace,\r\n    /// is stored in the Id property of the entity token.   \r\n    /// Example:\r\n    /// entityToken.Id = \"Composite.Forms.Renderer\"    \r\n    /// NOTE: That this might have changed if someone changes this in the provider code!\r\n    /// </summary>\r\n    public class StandardFunctionSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        /// <summary>\r\n        /// Returns a parent entity token for the given function entity token.\r\n        /// </summary>\r\n        /// <param name=\"entityToken\"></param>\r\n        /// <returns></returns>\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            string fullname = entityToken.Id;\r\n            string providerName = entityToken.Source;\r\n\r\n            if (fullname.Contains('.'))\r\n            {\r\n                fullname = fullname.Remove(fullname.LastIndexOf('.'));\r\n            }\r\n\r\n            string id = BaseFunctionProviderElementProvider.CreateId(fullname, \"AllFunctionsElementProvider\");\r\n\r\n            yield return new BaseFunctionFolderElementEntityToken(id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/StandardFunctions.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Constant;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Functions\r\n{\r\n\t/// <summary>    \r\n\t/// </summary>\r\n\t/// <exclude />\r\n\t[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n\tpublic static class StandardFunctions\r\n\t{\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic static IFunction GetDefaultFunctionByType(Type type)\r\n\t\t{\r\n\t\t\tif (type == typeof (string)) return StandardFunctions.StringFunction;\r\n\t\t\tif (type == typeof (int) || type == typeof (int?)) return StandardFunctions.IntegerFunction;\r\n\t\t\tif (type == typeof (Decimal) || type == typeof (Decimal?)) return StandardFunctions.DecimalFunction;\r\n\t\t\tif (type == typeof (DateTime) || type == typeof (DateTime?)) return StandardFunctions.DateTimeFunction;\r\n\t\t\tif (type == typeof (Guid) || type == typeof (Guid?)) return StandardFunctions.GuidFunction;\r\n\t\t\tif (type == typeof (bool) || type == typeof (bool?)) return StandardFunctions.BooleanFunction;\r\n\r\n\t\t\tif (type == typeof (XhtmlDocument)) return StandardFunctions.XhtmlDocumentFunction;\r\n\r\n\t\t\tif (type.IsGenericType)\r\n\t\t\t{\r\n\t\t\t\tif (type.GetGenericTypeDefinition() == typeof (NullableDataReference<>))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar referenceType = type.GetGenericArguments().First();\r\n\t\t\t\t\tvar functionName = StringExtensionMethods.CreateNamespace(referenceType.FullName, \"GetNullableDataReference\");\r\n\t\t\t\t\tIFunction function;\r\n\t\t\t\t\tif (FunctionFacade.TryGetFunction(out function, functionName))\r\n\t\t\t\t\t\treturn function;\r\n\t\t\t\t}\r\n\t\t\t\telse if (type.GetGenericTypeDefinition() == typeof (DataReference<>))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar referenceType = type.GetGenericArguments().First();\r\n\t\t\t\t\tvar functionName = StringExtensionMethods.CreateNamespace(referenceType.FullName, \"GetDataReference\");\r\n\t\t\t\t\tIFunction function;\r\n\t\t\t\t\tif (FunctionFacade.TryGetFunction(out function, functionName))\r\n\t\t\t\t\t\treturn function;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic static IFunction StringFunction { get { return FunctionFacade.GetFunction(\"Composite.Constant.String\"); } }\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic static IFunction DateTimeFunction { get { return FunctionFacade.GetFunction(\"Composite.Utils.Date.Now\"); } }\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic static IFunction BooleanFunction { get { return FunctionFacade.GetFunction(\"Composite.Constant.Boolean\"); } }\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic static IFunction DecimalFunction { get { return FunctionFacade.GetFunction(\"Composite.Constant.Decimal\"); } }\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic static IFunction IntegerFunction { get { return FunctionFacade.GetFunction(\"Composite.Constant.Integer\"); } }\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic static IFunction GuidFunction { get { return FunctionFacade.GetFunction(\"Composite.Constant.Guid\"); } }\r\n\r\n\t\t/// <exclude />\r\n\t\tpublic static IFunction XhtmlDocumentFunction { get { return FunctionFacade.GetFunction(\"Composite.Constant.XhtmlDocument\"); } }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/StandardWidgetFunctions.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Bool;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataType;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Date;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Decimal;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.GuidWidgetFunctions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Integer;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class StandardWidgetFunctions\r\n    {\r\n        /// <exclude />\r\n        public static string GetDefaultWidgetFunctionNameByType(Type type)\r\n        {\r\n            WidgetFunctionProvider provider = GetDefaultWidgetFunctionProviderByType(type);\r\n\r\n            if (provider == null) return null;\r\n\r\n            return provider.WidgetFunctionCompositeName;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GetDefaultWidgetFunctionProviderByType(Type type)\r\n        {\r\n            return GetDefaultWidgetFunctionProviderByType(type, true);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GetDefaultWidgetFunctionProviderByType(Type type, bool required)\r\n        {\r\n            if (type == typeof(string)) return StandardWidgetFunctions.TextBoxWidget;\r\n            if (type == typeof(int) || type == typeof(int?)) return StandardWidgetFunctions.IntegerTextBoxWidget;\r\n            if (type == typeof(Decimal) || type == typeof(Decimal?)) return StandardWidgetFunctions.DecimalTextBoxWidget;\r\n            if (type == typeof(DateTime) || type == typeof(DateTime?)) return StandardWidgetFunctions.DateSelectorWidget;\r\n            if (type == typeof(Guid) || type == typeof(Guid?)) return StandardWidgetFunctions.GuidTextBoxWidget;\r\n            if (type == typeof(bool) || type == typeof(bool?)) return StandardWidgetFunctions.CheckBoxWidget;\r\n\r\n            if (type == typeof(DataReference<IImageFile>)) return StandardWidgetFunctions.GetImageSelectorWidget(required);\r\n            if (type == typeof(NullableDataReference<IImageFile>)) return StandardWidgetFunctions.GetImageSelectorWidget(false);\r\n            if (type == typeof(DataReference<IMediaFile>)) return StandardWidgetFunctions.GetMediaFileSelectorWidget(required);\r\n            if (type == typeof(NullableDataReference<IMediaFile>)) return StandardWidgetFunctions.GetMediaFileSelectorWidget(false);\r\n\r\n            if (type == typeof(XhtmlDocument)) return StandardWidgetFunctions.VisualXhtmlDocumentEditorWidget;\r\n\r\n            IEnumerable<string> functionNames = FunctionFacade.GetWidgetFunctionNamesByType(type);\r\n            foreach (string functionName in functionNames)\r\n            {\r\n                IWidgetFunction widgetFunction = FunctionFacade.GetWidgetFunction(functionName);\r\n                bool sameType = widgetFunction.ReturnType == type;\r\n\r\n                if (!sameType \r\n                    && !required \r\n                    && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(DataReference<>)\r\n                    && type.IsAssignableFrom(widgetFunction.ReturnType)\r\n                    && widgetFunction.ReturnType == typeof(NullableDataReference<>).MakeGenericType(type.GetGenericArguments()))\r\n                {\r\n                    sameType = true;\r\n                }\r\n\r\n                if (sameType && !widgetFunction.ParameterProfiles.Any(p => p.IsRequired))\r\n                {\r\n                    return new WidgetFunctionProvider(widgetFunction);\r\n                }\r\n            }\r\n\r\n            if (type.IsLazyGenericType())\r\n            {\r\n                var lazyType = type.GetGenericArguments().First();\r\n\r\n                var provider = GetDefaultWidgetFunctionProviderByType(lazyType, required);\r\n\r\n                if (provider!=null)\r\n                {\r\n                    return provider;\r\n                }\r\n            }\r\n\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider DateSelectorWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(DateSelectorWidgetFunction.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider DateTimeSelectorWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(DateTimeSelectorWidgetFunction.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider TextBoxWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(TextBoxWidgetFuntion.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GuidTextBoxWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(GuidTextBoxWidgetFuntion.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider DataTypeSelectorWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(DataTypeSelectorWidgetFunction.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider TextAreaWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(TextAreaWidgetFuntion.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider UrlComboBoxWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(UrlComboBoxWidgetFunction.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider VisualXhtmlDocumentEditorWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.XhtmlDocument.VisualXhtmlEditorFuntion.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider IntegerTextBoxWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(IntegerTextBoxWidgetFuntion.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider DecimalTextBoxWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(DecimalTextBoxWidgetFuntion.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider CheckBoxWidget\r\n        {\r\n            get\r\n            {\r\n                return new WidgetFunctionProvider(CheckBoxWidgetFuntion.CompositeName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GetDataReferenceWidget(Type interfaceType)\r\n        {\r\n            if (interfaceType == null) throw new ArgumentNullException(\"interfaceType\");\r\n            if (typeof(IData).IsAssignableFrom(interfaceType) == false) throw new ArgumentException(string.Format(\"The interface type '{0}' does not inherit the interface '{1}\", interfaceType, typeof(IData)));\r\n\r\n            MethodInfo methodInfo =\r\n                (from mi in typeof(StandardWidgetFunctions).GetMethods(BindingFlags.Public | BindingFlags.Static)\r\n                 where mi.Name == \"GetDataReferenceWidget\" &&\r\n                       mi.GetParameters().Length == 0\r\n                 select mi).Single();\r\n\r\n            methodInfo = methodInfo.MakeGenericMethod(new Type[] { interfaceType });\r\n\r\n            return (WidgetFunctionProvider)methodInfo.Invoke(null, null);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GetDataReferenceWidget<T>()\r\n            where T : class, IData\r\n        {\r\n            if (typeof(T) == typeof(IPage))\r\n            {\r\n                return new WidgetFunctionProvider(PageReferenceSelectorWidgetFunction.CompositeName);\r\n            }\r\n            if (typeof(T) == typeof(IMediaFile))\r\n            {\r\n                return GetMediaFileSelectorWidget(true);\r\n            }\r\n            if (typeof(T) == typeof(IImageFile))\r\n            {\r\n                return GetImageSelectorWidget(true);\r\n            }\r\n\r\n            return new WidgetFunctionProvider(DataReferenceSelectorWidgetFunction<T>.CompositeName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GetNullableDataReferenceWidget<T>()\r\n            where T : class, IData\r\n        {\r\n            if (typeof(T) == typeof(IPage))\r\n            {\r\n                return new WidgetFunctionProvider(NullablePageReferenceSelectorWidgetFunction.CompositeName);\r\n            }\r\n            if (typeof(T) == typeof(IMediaFile))\r\n            {\r\n                return GetMediaFileSelectorWidget(false);\r\n            }\r\n            if (typeof(T) == typeof(IImageFile))\r\n            {\r\n                return GetImageSelectorWidget(false);\r\n            }\r\n\r\n            return new WidgetFunctionProvider(NullableDataReferenceSelectorWidgetFunction<T>.CompositeName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GetImageSelectorWidget(bool selectionRequired)\r\n        {\r\n            List<BaseParameterRuntimeTreeNode> widgetParams = new List<BaseParameterRuntimeTreeNode>();\r\n            widgetParams.Add( new ConstantObjectParameterRuntimeTreeNode(ImageSelectorWidgetFunction.RequiredParameterName, selectionRequired));\r\n\r\n            return new WidgetFunctionProvider(ImageSelectorWidgetFunction.CompositeName, widgetParams); \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GetMediaFileSelectorWidget(bool selectionRequired)\r\n        {\r\n            List<BaseParameterRuntimeTreeNode> widgetParams = new List<BaseParameterRuntimeTreeNode>();\r\n            widgetParams.Add(new ConstantObjectParameterRuntimeTreeNode(MediaFileSelectorWidgetFunction.RequiredParameterName, selectionRequired));\r\n\r\n            return new WidgetFunctionProvider(MediaFileSelectorWidgetFunction.CompositeName, widgetParams);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider GetBoolSelectorWidget(string trueLabel, string falseLabel)\r\n        {\r\n            return new WidgetFunctionProvider(new BoolSelectorWidgetFuntion(null, trueLabel, falseLabel));\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement BuildBasicFormsMarkup(XNamespace uiControlNamespace, string uiControlName, string bindingPropertyName, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XNamespace forms10Space = Namespaces.BindingForms10;\r\n\r\n            XElement widgetMarkup =\r\n                new XElement(uiControlNamespace + uiControlName,\r\n                    new XAttribute(\"Label\", label),\r\n                    new XAttribute(\"Help\", help.HelpText),\r\n                    new XElement(uiControlNamespace + string.Format(\"{0}.{1}\", uiControlName, bindingPropertyName),\r\n                        new XElement(forms10Space + \"bind\",\r\n                            new XAttribute(\"source\", bindingSourceName))));\r\n\r\n            return widgetMarkup;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static XElement BuildStaticCallPopulatedSelectorFormsMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName, Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, object optionsGeneratingStaticMethodParameterValue, string optionsObjectKeyPropertyName, string optionsObjectLabelPropertyName, bool multiSelect, bool compactMode, bool required, bool bindToString)\r\n        {\r\n            string tagName = (multiSelect==true? \"MultiKeySelector\": \"KeySelector\");\r\n            string bindingPropertyName = (multiSelect && bindToString ? \"SelectedAsString\" : \"Selected\");\r\n\r\n            XElement selector = StandardWidgetFunctions.BuildBasicFormsMarkup(Namespaces.BindingFormsStdUiControls10, tagName, bindingPropertyName, label, helpDefinition, bindingSourceName);\r\n            XNamespace f = Namespaces.BindingFormsStdFuncLib10;\r\n\r\n            selector.Add(\r\n                new XAttribute(\"OptionsKeyField\", optionsObjectKeyPropertyName),\r\n                new XAttribute(\"OptionsLabelField\", optionsObjectLabelPropertyName),\r\n                new XAttribute(\"Required\", required),\r\n                ( multiSelect ? new XAttribute(\"CompactMode\", compactMode) : null),\r\n                new XElement(selector.Name.Namespace + (tagName + \".Options\"),\r\n                    new XElement(f + \"StaticMethodCall\",\r\n                       new XAttribute(\"Type\", TypeManager.SerializeType(optionsGeneratingStaticType)),\r\n                       new XAttribute(\"Method\", optionsGeneratingStaticMethodName))));\r\n\r\n            if (optionsGeneratingStaticMethodParameterValue != null) selector.Descendants(f + \"StaticMethodCall\").First().Add(\r\n                  new XAttribute(\"Parameters\", optionsGeneratingStaticMethodParameterValue));\r\n\r\n            return selector;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a WidgetFunctionProvider that yields a drop down list populated with options from a static method call. You can return anonymous types.\r\n        /// </summary>\r\n        /// <param name=\"optionsGeneratingStaticType\">The type containing the static method to call</param>\r\n        /// <param name=\"optionsGeneratingStaticMethodName\">The name of the static method to call. The method should take no parameters and return an IEnumerable.</param>\r\n        /// <param name=\"optionsObjectKeyPropertyName\">The name of the property on the return item type to use as key in the drop down</param>\r\n        /// <param name=\"optionsObjectLabelPropertyName\">The name of the property on the return item type to use as label in the drop down</param>\r\n        /// <param name=\"multiSelector\"></param>\r\n        /// <param name=\"required\"></param>\r\n        /// <returns></returns>\r\n        public static WidgetFunctionProvider DropDownList(Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, string optionsObjectKeyPropertyName, string optionsObjectLabelPropertyName, bool multiSelector, bool required)\r\n        {\r\n            return new WidgetFunctionProvider(\r\n                new AdHocDropDownListWidgetFunction(optionsGeneratingStaticType, optionsGeneratingStaticMethodName, optionsObjectKeyPropertyName, optionsObjectLabelPropertyName, multiSelector, true, required));\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Creates a WidgetFunctionProvider that yields a drop down list populated with options from a static method call. You can return anonymous types.\r\n        /// </summary>\r\n        /// <param name=\"optionsGeneratingStaticType\">The type containing the static method to call</param>\r\n        /// <param name=\"optionsGeneratingStaticMethodName\">The name of the static method to call. The method should take no parameters and return an IEnumerable.</param>\r\n        /// <param name=\"optionsObjectKeyPropertyName\">The name of the property on the return item type to use as key in the drop down</param>\r\n        /// <param name=\"optionsObjectLabelPropertyName\">The name of the property on the return item type to use as label in the drop down</param>\r\n        /// <param name=\"multiSelector\"></param>\r\n        /// <returns></returns>\r\n        public static WidgetFunctionProvider DropDownList(Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, string optionsObjectKeyPropertyName, string optionsObjectLabelPropertyName, bool multiSelector)\r\n        {\r\n            return DropDownList(optionsGeneratingStaticType, optionsGeneratingStaticMethodName, optionsObjectKeyPropertyName, optionsObjectLabelPropertyName, multiSelector, true);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider DropDownList(Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, bool multiSelector, bool required)\r\n        {\r\n            return new WidgetFunctionProvider(\r\n                new AdHocDropDownListWidgetFunction(optionsGeneratingStaticType, optionsGeneratingStaticMethodName, \".\", \".\", multiSelector, true, required));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider DropDownList(Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, object optionsGeneratingStaticMethodParameterValue, string optionsObjectKeyPropertyName, string optionsObjectLabelPropertyName, bool multiSelector, bool required)\r\n        {\r\n            return new WidgetFunctionProvider(\r\n                new AdHocDropDownListWidgetFunction(optionsGeneratingStaticType, optionsGeneratingStaticMethodName, optionsGeneratingStaticMethodParameterValue, optionsObjectKeyPropertyName, optionsObjectLabelPropertyName, multiSelector, true, required));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider DropDownList(Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, object optionsGeneratingStaticMethodParameterValue, bool multiSelector, bool compact, bool required)\r\n        {\r\n            return new WidgetFunctionProvider(\r\n                new AdHocDropDownListWidgetFunction(optionsGeneratingStaticType, optionsGeneratingStaticMethodName, optionsGeneratingStaticMethodParameterValue, \".\", \".\", multiSelector, compact, required));\r\n        }\r\n\r\n\r\n\r\n        private class AdHocDropDownListWidgetFunction : IWidgetFunction\r\n        {\r\n            private readonly Type _type;\r\n            private readonly string _methodName;\r\n            private readonly string _keyPropertyName;\r\n            private readonly string _labelPropertyName;\r\n            private readonly object _parameterValue;\r\n            private readonly bool _multiSelector;\r\n            private readonly bool _compact;\r\n            private readonly bool _required;\r\n\r\n            public AdHocDropDownListWidgetFunction(Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, string optionsObjectKeyPropertyName, string optionsObjectLabelPropertyName, bool multiSelector, bool compact, bool required)\r\n            {\r\n                _type = optionsGeneratingStaticType;\r\n                _methodName = optionsGeneratingStaticMethodName;\r\n                _keyPropertyName = optionsObjectKeyPropertyName;\r\n                _labelPropertyName = optionsObjectLabelPropertyName;\r\n                _multiSelector = multiSelector;\r\n                _compact = compact;\r\n                _required = required;\r\n            }\r\n\r\n\r\n\r\n            public AdHocDropDownListWidgetFunction(Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, object parameterValue, string optionsObjectKeyPropertyName, string optionsObjectLabelPropertyName, bool multiSelector, bool compact, bool required)\r\n                : this(optionsGeneratingStaticType, optionsGeneratingStaticMethodName, optionsObjectKeyPropertyName, optionsObjectLabelPropertyName, multiSelector, compact, required)\r\n            {\r\n                if (parameterValue == null) throw new ArgumentNullException(\"parameterValue\");\r\n                _parameterValue = parameterValue;\r\n            }\r\n\r\n\r\n\r\n            public XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n            {\r\n                return StandardWidgetFunctions.BuildStaticCallPopulatedSelectorFormsMarkup(\r\n                    parameters,\r\n                    label,\r\n                    helpDefinition,\r\n                    bindingSourceName,\r\n                    _type,\r\n                    _methodName,\r\n                    _parameterValue,\r\n                    _keyPropertyName,\r\n                    _labelPropertyName,\r\n                    _multiSelector,\r\n                    _compact,\r\n                    _required,\r\n                    false);\r\n            }\r\n\r\n\r\n            public string Name\r\n            {\r\n                get { return \"AdHocDropDownListWidget\"; }\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get { return \"Composite.AdHoc\"; }\r\n            }\r\n\r\n            public virtual string Description { get { return \"\"; } }\r\n\r\n            public Type ReturnType\r\n            {\r\n                get { return typeof(object); }\r\n            }\r\n\r\n            public IEnumerable<ParameterProfile> ParameterProfiles\r\n            {\r\n                get { yield break; }\r\n            }\r\n\r\n            public Composite.C1Console.Security.EntityToken EntityToken\r\n            {\r\n                get { throw new NotImplementedException(); }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/WidgetFunctionProvider.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class WidgetFunctionProvider\r\n\t{\r\n        /// <exclude />\r\n        public static WidgetFunctionProvider BuildNoWidgetProvider()\r\n        {\r\n            return new WidgetFunctionProvider();\r\n        }\r\n\r\n        private string _widgetFunctionName = null;\r\n        private IWidgetFunction _widgetFunction = null;\r\n        private IEnumerable<BaseParameterRuntimeTreeNode> _setParameters = null;\r\n        private XElement _serializedWidgetFunction = null;\r\n        private object _lock = new object();\r\n\r\n        private WidgetFunctionProvider()\r\n        {\r\n        }\r\n\r\n\r\n\r\n        internal WidgetFunctionProvider(string widgetName)\r\n        {\r\n            if (string.IsNullOrEmpty(widgetName)) throw new ArgumentNullException(\"widgetName\");\r\n\r\n            _widgetFunctionName = widgetName;\r\n        }\r\n\r\n\r\n\r\n        internal WidgetFunctionProvider(string widgetName, IEnumerable<BaseParameterRuntimeTreeNode> parameters)\r\n        {\r\n            if (string.IsNullOrEmpty(widgetName)) throw new ArgumentNullException(\"widgetName\");\r\n            if (parameters == null) throw new ArgumentNullException(\"parameters\");\r\n\r\n            _widgetFunctionName = widgetName;\r\n            _setParameters = parameters;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public WidgetFunctionProvider(IWidgetFunction widgetFunction)\r\n        {\r\n            if (widgetFunction == null) throw new ArgumentNullException(\"widgetFunction\");\r\n\r\n            _widgetFunction = widgetFunction;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public WidgetFunctionProvider(XElement serializedWidgetFunction)\r\n        {\r\n            _serializedWidgetFunction = serializedWidgetFunction;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string WidgetFunctionCompositeName\r\n        {\r\n            get\r\n            {\r\n                if (string.IsNullOrEmpty(_widgetFunctionName) == false)\r\n                {\r\n                    return _widgetFunctionName;\r\n                }\r\n\r\n                EnsureWidgetFunction();\r\n\r\n                if (_widgetFunction != null)\r\n                {\r\n                    return _widgetFunction.CompositeName();\r\n                }\r\n\r\n                throw new InvalidOperationException(\"Neither name nor IWidgetFunction found\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IWidgetFunction WidgetFunction\r\n        {\r\n            get\r\n            {\r\n                EnsureWidgetFunction();\r\n\r\n                if (_widgetFunction == null)\r\n                {\r\n                    if (string.IsNullOrEmpty(_widgetFunctionName) == false)\r\n                    {\r\n                        _widgetFunction = FunctionFacade.GetWidgetFunction(_widgetFunctionName);\r\n                    }\r\n                }\r\n\r\n                \r\n                return _widgetFunction;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<BaseParameterRuntimeTreeNode> WidgetFunctionParameters\r\n        {\r\n            get\r\n            {\r\n                if (_setParameters == null)\r\n                {\r\n                    yield break;\r\n                }\r\n                else\r\n                {\r\n                    foreach (BaseParameterRuntimeTreeNode param in _setParameters)\r\n                    {\r\n                        yield return param;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement SerializedWidgetFunction\r\n        {\r\n            get \r\n            {\r\n                EnsureWidgetFunction();\r\n\r\n                WidgetFunctionRuntimeTreeNode widgetRuntimeTreeNode = new WidgetFunctionRuntimeTreeNode(this.WidgetFunction, this.WidgetFunctionParameters.ToList());\r\n\r\n                return widgetRuntimeTreeNode.Serialize();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void EnsureWidgetFunction()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (_widgetFunction == null && _serializedWidgetFunction != null)\r\n                {\r\n                    WidgetFunctionRuntimeTreeNode functionNode = (WidgetFunctionRuntimeTreeNode)FunctionFacade.BuildTree(_serializedWidgetFunction);\r\n                    _setParameters = functionNode.GetSetParameters().ToList();\r\n                    _widgetFunction = functionNode.GetWidgetFunction();\r\n                }\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/WidgetFunctionRuntimeTreeNode.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Threading;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions.Foundation;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class WidgetFunctionRuntimeTreeNode : BaseFunctionRuntimeTreeNode\r\n    {\r\n        private IWidgetFunction _widgetFunction;\r\n\r\n\r\n        /// <exclude />\r\n        public WidgetFunctionRuntimeTreeNode(IWidgetFunction widgetFunction)\r\n            : this(widgetFunction, \"\", new HelpDefinition(\"\"), \"\", new List<BaseParameterRuntimeTreeNode>())\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public WidgetFunctionRuntimeTreeNode(IWidgetFunction widgetFunction, List<BaseParameterRuntimeTreeNode> parameters)\r\n            : this(widgetFunction, \"\", new HelpDefinition(\"\"), \"\", parameters)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public WidgetFunctionRuntimeTreeNode(IWidgetFunction widgetFunction, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n            : this(widgetFunction, label, helpDefinition, bindingSourceName, new List<BaseParameterRuntimeTreeNode>())\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public HelpDefinition HelpDefinition { get; set; }\r\n\r\n        /// <exclude />\r\n        public string BindingSourceName { get; set; }\r\n\r\n\r\n        internal WidgetFunctionRuntimeTreeNode(IWidgetFunction widgetFunction, string label, HelpDefinition helpDefinition, string bindingSourceName, List<BaseParameterRuntimeTreeNode> parameters)\r\n        {\r\n            _widgetFunction = widgetFunction;\r\n            this.Label = label;\r\n            this.HelpDefinition = helpDefinition;\r\n            this.BindingSourceName = bindingSourceName;\r\n            this.Parameters = parameters;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override IMetaFunction HostedFunction\r\n        {\r\n            get { return _widgetFunction; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IWidgetFunction GetWidgetFunction()\r\n        {\r\n            return _widgetFunction;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            if (contextContainer == null) throw new ArgumentNullException(\"contextContainer\");\r\n\r\n            ValidateNotSelfCalling();\r\n\r\n            ParameterList parameters = new ParameterList(contextContainer);\r\n\r\n            foreach (ParameterProfile parameterProfile in _widgetFunction.ParameterProfiles)\r\n            {\r\n                BaseParameterRuntimeTreeNode parameterTreeNode = this.Parameters.Where(ptn => ptn.Name == parameterProfile.Name).SingleOrDefault();\r\n\r\n                if (parameterTreeNode == null)\r\n                {\r\n                    BaseValueProvider valueProvider = parameterProfile.FallbackValueProvider;\r\n\r\n                    object value = valueProvider.GetValue(contextContainer);\r\n\r\n                    parameters.AddConstantParameter(parameterProfile.Name, value, parameterProfile.Type);\r\n                }\r\n                else\r\n                {\r\n                    parameters.AddLazyParameter(parameterProfile.Name, parameterTreeNode, parameterProfile.Type);\r\n                }\r\n            }\r\n\r\n            return _widgetFunction.GetWidgetMarkup(parameters, this.Label, this.HelpDefinition, this.BindingSourceName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<string> GetAllSubFunctionNames()\r\n        {\r\n            List<string> names = new List<string>();\r\n\r\n            foreach (BaseParameterRuntimeTreeNode parameter in this.Parameters)\r\n            {\r\n                names.AddRange(parameter.GetAllSubFunctionNames());\r\n            }\r\n\r\n            return names.Distinct();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool ContainsNestedFunctions\r\n        {\r\n            get\r\n            {\r\n                foreach (var parameter in this.Parameters)\r\n                {\r\n                    if (parameter.ContainsNestedFunctions)\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override XElement Serialize()\r\n        {\r\n            XElement element = XElement.Parse(string.Format(@\"<f:{0} xmlns:f=\"\"{1}\"\" />\", FunctionTreeConfigurationNames.WidgetFunctionTagName, FunctionTreeConfigurationNames.NamespaceName));\r\n\r\n            element.Add(new XAttribute(FunctionTreeConfigurationNames.NameAttributeName, _widgetFunction.CompositeName()));\r\n\r\n            if (!string.IsNullOrEmpty(this.Label))\r\n                element.Add(new XAttribute(FunctionTreeConfigurationNames.LabelAttributeName, this.Label));\r\n\r\n            if (!string.IsNullOrEmpty(this.BindingSourceName))\r\n                element.Add(new XAttribute(FunctionTreeConfigurationNames.BindingSourceNameAttributeName, this.BindingSourceName));\r\n\r\n            if (this.HelpDefinition != null && !string.IsNullOrEmpty(this.HelpDefinition.HelpText))\r\n            {\r\n                element.Add(this.HelpDefinition.Serialize());\r\n            }\r\n\r\n            foreach (ParameterProfile parameterProfile in _widgetFunction.ParameterProfiles)\r\n            {\r\n                BaseParameterRuntimeTreeNode parameterRuntimeTreeNode = this.Parameters.Where(ptn => ptn.Name == parameterProfile.Name).FirstOrDefault();\r\n\r\n                if (parameterRuntimeTreeNode != null)\r\n                {\r\n                    element.Add(parameterRuntimeTreeNode.Serialize());\r\n                }\r\n            }\r\n\r\n            return element;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/XElementParameterRuntimeTreeNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing System.Linq;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Functions\r\n{\r\n\tinternal sealed class XElementParameterRuntimeTreeNode : BaseParameterRuntimeTreeNode\r\n    {\r\n        private XElement _element;\r\n\r\n        private XElement ExecuteInnerFunctions(FunctionContextContainer contextContainer)\r\n        {\r\n            XElement resultRoot = new XElement(_element);\r\n            int loopCount = 0;\r\n\r\n            while (true)\r\n            {\r\n                XName functionXName = Namespaces.Function10 + FunctionTreeConfigurationNames.FunctionTagName;\r\n                IEnumerable<XElement> nestedFunctionCalls = resultRoot.Descendants(functionXName).Where(f => !f.Ancestors(functionXName).Any());\r\n                var evaluatedListOfInnerFunctions = nestedFunctionCalls.ToList();\r\n\r\n                if (!evaluatedListOfInnerFunctions.Any())\r\n                {\r\n                    break;\r\n                }\r\n\r\n                if (loopCount++ > 1000)\r\n                {\r\n                    throw new InvalidOperationException(\"One or more function seems to be returning markup generating endless recursion. The following markup seems to generate the problem: \" + evaluatedListOfInnerFunctions.First().ToString());\r\n                }\r\n\r\n                var functionCallResults = new object[evaluatedListOfInnerFunctions.Count];\r\n\r\n                \r\n                for(int i=0; i<evaluatedListOfInnerFunctions.Count; i++)\r\n                {\r\n                    XElement functionCallDefinition = evaluatedListOfInnerFunctions[i];\r\n\r\n                    BaseRuntimeTreeNode runtimeTreeNode = FunctionTreeBuilder.Build(functionCallDefinition);\r\n\r\n                    functionCallResults[i] = runtimeTreeNode.GetValue(contextContainer);\r\n                };\r\n\r\n                for (int i = 0; i < evaluatedListOfInnerFunctions.Count; i++)\r\n                {\r\n                    object embedableResult = contextContainer.MakeXEmbedable(functionCallResults[i]);\r\n\r\n                    if (embedableResult is XAttribute)\r\n                    {\r\n                        evaluatedListOfInnerFunctions[i].Parent.Add(embedableResult);\r\n                        evaluatedListOfInnerFunctions[i].Remove();\r\n                    }\r\n                    else\r\n                    {\r\n                        evaluatedListOfInnerFunctions[i].ReplaceWith(embedableResult);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return resultRoot;\r\n        }\r\n\r\n\r\n        public XElementParameterRuntimeTreeNode(string name, XElement element)\r\n            : base(name)\r\n        {\r\n            _element = element;\r\n        }\r\n\r\n\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            Verify.ArgumentNotNull(contextContainer, \"contextContainer\");\r\n\r\n            return ExecuteInnerFunctions(contextContainer);\r\n        }\r\n\r\n\r\n        public override IEnumerable<string> GetAllSubFunctionNames()\r\n        {\r\n            return\r\n                from nameAttribute in _element.Elements(Namespaces.Function10 + FunctionTreeConfigurationNames.FunctionTagName).Attributes( FunctionTreeConfigurationNames.NameAttributeName )\r\n                select nameAttribute.Value;\r\n        }\r\n\r\n\r\n\r\n        public override bool ContainsNestedFunctions\r\n        {\r\n            get\r\n            {\r\n                return GetAllSubFunctionNames().Any();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public XElement GetHostedXElement()\r\n        {\r\n            return _element;\r\n        }\r\n\r\n        public override XElement Serialize()\r\n        {\r\n            XElement element =\r\n                new XElement(XName.Get(FunctionTreeConfigurationNames.ParamTagName, FunctionTreeConfigurationNames.NamespaceName),\r\n                    new XAttribute(FunctionTreeConfigurationNames.NameAttributeName, this.Name),\r\n                    _element\r\n                );\r\n\r\n            return element;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Functions/XslExtensionsManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Xsl;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Functions.Foundation.PluginFacades;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Functions\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class XslExtensionsManager\r\n\t{\r\n        /// <exclude />\r\n        public static void Register(XsltArgumentList argumentList)\r\n        {\r\n            foreach(string providerName in XslExtensionsProviderRegistry.XslExtensionsProviderNames)\r\n            {\r\n                List<Pair<string, object>> extensions;\r\n                try\r\n                {\r\n                    extensions = XslExtensionsProviderPluginFacade.CreateExtensions(providerName);\r\n                }\r\n                catch(Exception ex)\r\n                {\r\n                    string message = \"Failed to get xsl extensions from provider '{0}'\".FormatWith(providerName);\r\n                    LoggingService.LogError(\"XslExtensionsManager\", new InvalidOperationException(message, ex));\r\n                    continue;\r\n                }\r\n\r\n                if(extensions != null)\r\n                {\r\n                    foreach (Pair<string, object> pair in extensions)\r\n                    {\r\n                        argumentList.AddExtensionObject(pair.First, pair.Second);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/GlobalInitializerFacade.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Threading;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Functions.Foundation;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql;\r\n\r\n\r\nnamespace Composite\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class GlobalInitializerFacade\r\n    {\r\n        private static readonly string LogTitle = \"RGB(194, 252, 131)\" + nameof(GlobalInitializerFacade);\r\n        private static readonly string LogTitleNormal = nameof(GlobalInitializerFacade);\r\n\r\n        private static bool _coreInitialized;\r\n        private static bool _initializing;\r\n        private static bool _typesAutoUpdated;\r\n        private static bool _unhandledExceptionLoggingInitialized;\r\n        private static bool _preInitHandlersRunning;\r\n        private static Exception _exceptionThrownDuringInitialization;\r\n        private static DateTime _exceptionThrownDuringInitializationTimeStamp;\r\n        private static int _fatalErrorFlushCount;\r\n        private static readonly ReaderWriterLock _readerWriterLock = new ReaderWriterLock();\r\n        private static Thread _hookingFacadeThread; // This is used to wait on the the thread if a reinitialize is issued\r\n        private static Exception _hookingFacadeException; // This will hold the exception from the before the reinitialize was issued\r\n\r\n        private static readonly ThreadLockingInformation _threadLocking = new ThreadLockingInformation();\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Not used\")]\r\n        public static bool DynamicTypesGenerated => false;\r\n\r\n        /// <exclude />\r\n        public static bool SystemCoreInitializing => _initializing;\r\n\r\n        /// <exclude />\r\n        public static bool SystemCoreInitialized => _coreInitialized;\r\n\r\n        /// <summary>\r\n        /// This is true during a total flush of the system (re-initialize).\r\n        /// </summary>\r\n        public static bool IsReinitializingTheSystem { get; private set; }\r\n\r\n\r\n\r\n        static GlobalInitializerFacade()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will initialize the system (if it has not been initialized).\r\n        /// </summary>\r\n        public static void EnsureSystemIsInitialized()\r\n        {\r\n            InitializeTheSystem();\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method will initialize the system (if it has not been initialized).\r\n        /// </summary>\r\n        public static void InitializeTheSystem()\r\n        {\r\n            Verify.That(!_preInitHandlersRunning, \"DataFacade related methods should not be called in OnBeforeInitialize() method of a startup handler. Please move the code to OnInitialized() instead.\");\r\n\r\n            if (_exceptionThrownDuringInitialization != null)\r\n            {\r\n                TimeSpan timeSpan = DateTime.Now - _exceptionThrownDuringInitializationTimeStamp;\r\n                if (timeSpan < TimeSpan.FromMinutes(5.0))\r\n                {\r\n                    Log.LogCritical(LogTitleNormal, $\"Exception recorded: {timeSpan} ago\");\r\n\r\n                    throw new Exception(\"Failed to initialize the system\", _exceptionThrownDuringInitialization);\r\n                }\r\n\r\n                _exceptionThrownDuringInitialization = null;\r\n            }\r\n\r\n            if (!_initializing && !_coreInitialized)\r\n            {\r\n                using (CoreLockScope)\r\n                {\r\n                    if (!_initializing && !_coreInitialized)\r\n                    {\r\n                        try\r\n                        {\r\n                            _initializing = true;\r\n\r\n                            if (!SystemSetupFacade.IsSystemFirstTimeInitialized && RuntimeInformation.IsDebugBuild)\r\n                            {\r\n                                Log.LogWarning(LogTitleNormal, new InvalidOperationException(\"System is initializing, yet missing first time initialization\"));\r\n                            }\r\n\r\n                            using (ThreadDataManager.EnsureInitialize())\r\n                            {\r\n                                DoInitialize();\r\n                            }\r\n\r\n                            GC.Collect(); // Collecting generation 2 after initialization\r\n\r\n                            _fatalErrorFlushCount = 0;\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            _exceptionThrownDuringInitialization = ex;\r\n                            _exceptionThrownDuringInitializationTimeStamp = DateTime.Now;\r\n\r\n                            var shutdownReason = HostingEnvironment.ShutdownReason;\r\n\r\n                            if (shutdownReason != ApplicationShutdownReason.None)\r\n                            {\r\n                                Log.LogCritical(LogTitleNormal, \"Shutdown reason: \" + HostingEnvironment.ShutdownReason);\r\n                            }\r\n                            \r\n                            Log.LogCritical(LogTitleNormal, ex);\r\n                            throw;\r\n                        }\r\n                        finally\r\n                        {\r\n                            _coreInitialized = true;\r\n                            _initializing = false;\r\n                        }\r\n                    }\r\n\r\n                    EnabledUnhandledExceptionsLogging();\r\n                }\r\n            }\r\n        }\r\n\r\n        private static void EnabledUnhandledExceptionsLogging()\r\n        {\r\n            if (_unhandledExceptionLoggingInitialized) return;\r\n\r\n            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>\r\n            {\r\n                var ex = (Exception)args.ExceptionObject;\r\n\r\n                Log.LogCritical(\"Unhandled exception\", ex);\r\n\r\n                LogManager.Flush();\r\n            };\r\n\r\n            _unhandledExceptionLoggingInitialized = true;\r\n        }\r\n\r\n        private static void DoInitialize()\r\n        {\r\n            int startTime = Environment.TickCount;\r\n\r\n            Guid installationId = InstallationInformationFacade.InstallationId;\r\n\r\n            Log.LogVerbose(LogTitle, \"Initializing the system core - installation id = \" +  installationId);\r\n\r\n            using (new LogExecutionTime(LogTitle, \"Initialization of the static data types\"))\r\n            {\r\n                DataProviderRegistry.InitializeDataTypes();\r\n            }\r\n\r\n\r\n            using (new LogExecutionTime(LogTitle, \"Auto update of static data types\"))\r\n            {\r\n                bool typesUpdated = AutoUpdateDataTypes();\r\n                if (typesUpdated)\r\n                {\r\n                    using (new LogExecutionTime(LogTitle, \"Reinitialization of the static data types\"))\r\n                    {\r\n                        SqlTableInformationStore.Flush();\r\n                        DataProviderRegistry.Flush();\r\n                        DataProviderPluginFacade.Flush();\r\n                        \r\n                    \r\n                        DataProviderRegistry.InitializeDataTypes();\r\n                    }\r\n\r\n                    CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);                 \r\n                }\r\n            }\r\n\r\n\r\n            using (new LogExecutionTime(LogTitle, \"Ensure data stores\"))\r\n            {\r\n                bool dataStoresCreated = DataStoreExistenceVerifier.EnsureDataStores();\r\n\r\n                if (dataStoresCreated)\r\n                {\r\n                    Log.LogVerbose(LogTitle, \"Initialization of the system was halted, performing a flush\");\r\n                    _initializing = false;\r\n                    GlobalEventSystemFacade.FlushTheSystem();\r\n                    return;\r\n                }\r\n            }\r\n\r\n\r\n\r\n            using (new LogExecutionTime(LogTitle, \"Initializing data process controllers\"))\r\n            {\r\n                ProcessControllerFacade.Initialize_PostDataTypes();\r\n            }\r\n\r\n\r\n            using (new LogExecutionTime(LogTitle, \"Initializing data type references\"))\r\n            {\r\n                DataReferenceRegistry.Initialize_PostDataTypes();\r\n            }\r\n\r\n\r\n            using (new LogExecutionTime(LogTitle, \"Initializing data type associations\"))\r\n            {\r\n                DataAssociationRegistry.Initialize_PostDataTypes();\r\n            }\r\n\r\n\r\n            using (new LogExecutionTime(LogTitle, \"Initializing internal urls\"))\r\n            {\r\n                InternalUrls.Initialize_PostDataTypes();\r\n            }\r\n            \r\n\r\n            using (new LogExecutionTime(LogTitle, \"Initializing functions\"))\r\n            {\r\n                MetaFunctionProviderRegistry.Initialize_PostDataTypes();\r\n            }\r\n\r\n\r\n            Log.LogVerbose(LogTitle, \"Starting initialization of administrative secondaries\");\r\n\r\n\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized && !SystemSetupFacade.SetupIsRunning && HostingEnvironment.IsHosted)\r\n            {\r\n                using (new LogExecutionTime(LogTitle, \"Initializing workflow runtime\"))\r\n                {\r\n                    WorkflowFacade.EnsureInitialization();\r\n                }\r\n            }\r\n\r\n\r\n            using (new LogExecutionTime(LogTitle, \"Auto installing packages\"))\r\n            {\r\n                DoAutoInstallPackages();\r\n            }\r\n\r\n\r\n            int executionTime = Environment.TickCount - startTime;\r\n\r\n            Log.LogVerbose(LogTitle, $\"Done initializing of the system core. ({executionTime} ms)\");\r\n        }\r\n\r\n\r\n\r\n        private static bool AutoUpdateDataTypes()\r\n        {\r\n            if (!GlobalSettingsFacade.EnableDataTypesAutoUpdate)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (_typesAutoUpdated)\r\n            {\r\n                // This is here to catch update -> failed -> update -> failed -> ... loop\r\n                DataInterfaceAutoUpdater.TestEnsureUpdateAllInterfaces();\r\n                return false;\r\n            }\r\n\r\n            bool flushTheSystem = DataInterfaceAutoUpdater.EnsureUpdateAllInterfaces();\r\n\r\n            _typesAutoUpdated = true;\r\n\r\n            return flushTheSystem;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)\r\n        {\r\n            ReinitializeTheSystem(runInWriterLockScopeDelegate, false);\r\n        }\r\n\r\n\r\n\r\n        internal static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate, bool initializeHooksInTheSameThread)\r\n        {\r\n            if (_hookingFacadeThread != null)\r\n            {\r\n                _hookingFacadeThread.Join(TimeSpan.FromSeconds(30));\r\n                if (_hookingFacadeException != null)\r\n                {\r\n                    throw new InvalidOperationException(\"The initialization of the HookingFacade failed before this reinitialization was issued\", _hookingFacadeException);\r\n                }\r\n            }\r\n\r\n            using (CoreLockScope)\r\n            {\r\n                IsReinitializingTheSystem = true;\r\n\r\n                runInWriterLockScopeDelegate();\r\n\r\n                _coreInitialized = false;\r\n                _initializing = false;\r\n                _exceptionThrownDuringInitialization = null;\r\n\r\n                Verify.That(_fatalErrorFlushCount <= 1, \"Failed to reload the system. See the log for the details.\");\r\n\r\n                InitializeTheSystem();\r\n\r\n                IsReinitializingTheSystem = false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void EnsureHookingFacade(object timeSpanToDelayStart)\r\n        {\r\n            // NOTE: Condition is  made for unit-testing\r\n            if (HostingEnvironment.IsHosted)\r\n            {\r\n                var kvp = (KeyValuePair<TimeSpan, StackTrace>)timeSpanToDelayStart;\r\n                _hookingFacadeException = null;\r\n\r\n                Thread.Sleep(kvp.Key);\r\n\r\n                try\r\n                {\r\n                    using (CoreIsInitializedScope)\r\n                    {\r\n                        using (ThreadDataManager.EnsureInitialize())\r\n                        {\r\n                            HookingFacade.EnsureInitialization();\r\n                        }\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    _hookingFacadeException = ex;\r\n                }\r\n            }\r\n\r\n            _hookingFacadeThread = null;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void WaitUntilAllIsInitialized()\r\n        {\r\n            using (CoreIsInitializedScope)\r\n            {\r\n                _hookingFacadeThread?.Join();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void FatalResetTheSystem()\r\n        {\r\n            Log.LogWarning(LogTitle, \"Unhandled error occurred, reinitializing the system!\");\r\n\r\n            ReinitializeTheSystem(delegate { _fatalErrorFlushCount++; GlobalEventSystemFacade.FlushTheSystem(); });\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void UninitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)\r\n        {\r\n            using (CoreLockScope)\r\n            {\r\n                using (new LogExecutionTime(LogTitle, \"Uninitializing the system\"))\r\n                {\r\n                    runInWriterLockScopeDelegate();\r\n                }\r\n\r\n                _coreInitialized = false;\r\n                _initializing = false;\r\n                _exceptionThrownDuringInitialization = null;\r\n            }\r\n        }\r\n\r\n\r\n        internal static IDisposable GetPreInitHandlersScope()\r\n        {\r\n            return new PreInitHandlersScope();\r\n        }\r\n\r\n\r\n        private class PreInitHandlersScope : IDisposable\r\n        {\r\n            public PreInitHandlersScope()\r\n            {\r\n                _preInitHandlersRunning = true;\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                _preInitHandlersRunning = false;\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~PreInitHandlersScope()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n\r\n\r\n        #region Package installation\r\n\r\n        private class AutoInstallPackageInfo\r\n        {\r\n            public bool ToBeDeleted { get; set; }\r\n            public string FilePath { get; set; }\r\n        }\r\n\r\n        private static void DoAutoInstallPackages()\r\n        {\r\n            if (IsReinitializingTheSystem) return;\r\n\r\n            try\r\n            {\r\n                // This is not so good, unittests run and normal runs should have same semantic behavior.\r\n                // But if this is not here, some unittests will start failing. /MRJ\r\n                if (RuntimeInformation.IsUnittest) return;\r\n\r\n                var zipFiles = new List<AutoInstallPackageInfo>();\r\n\r\n                string directory = PathUtil.Resolve(GlobalSettingsFacade.AutoPackageInstallDirectory);\r\n                if (C1Directory.Exists(directory))\r\n                {\r\n                    Log.LogVerbose(LogTitle, $\"Installing packages from: {directory}\");\r\n                    zipFiles.AddRange(C1Directory.GetFiles(directory, \"*.zip\")\r\n                                      .OrderBy(f => f)\r\n                                      .Select(f => new AutoInstallPackageInfo { FilePath = f, ToBeDeleted = true }));\r\n                }\r\n                else\r\n                {\r\n                    Log.LogVerbose(LogTitle, $\"Auto install directory not found: {directory}\");\r\n                }\r\n\r\n                if (RuntimeInformation.IsDebugBuild)\r\n                {\r\n                    string workflowTestDir = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.AutoPackageInstallDirectory), \"WorkflowTesting\");\r\n                    if (C1Directory.Exists(workflowTestDir))\r\n                    {\r\n                        Log.LogVerbose(LogTitle, $\"Installing packages from: {workflowTestDir}\");\r\n                        zipFiles.AddRange(C1Directory.GetFiles(workflowTestDir, \"*.zip\")\r\n                                          .OrderBy(f => f)\r\n                                          .Select(f => new AutoInstallPackageInfo { FilePath = f, ToBeDeleted = false }));\r\n                    }\r\n                }\r\n\r\n\r\n                foreach (var zipFile in zipFiles)\r\n                {\r\n                    try\r\n                    {\r\n                        using (Stream zipFileStream = C1File.OpenRead(zipFile.FilePath))\r\n                        {\r\n                            Log.LogVerbose(LogTitle, $\"Installing package: {zipFile.FilePath}\");\r\n\r\n                            PackageManagerInstallProcess packageManagerInstallProcess = PackageManager.Install(zipFileStream, true);\r\n\r\n                            if (packageManagerInstallProcess.PreInstallValidationResult.Count > 0)\r\n                            {\r\n                                Log.LogError(LogTitleNormal, \"Package installation failed! (Pre install validation error)\");\r\n                                LogErrors(packageManagerInstallProcess.PreInstallValidationResult);\r\n\r\n                                continue;\r\n                            }\r\n\r\n\r\n                            List<PackageFragmentValidationResult> validationResults = packageManagerInstallProcess.Validate();\r\n                            if (validationResults.Count > 0)\r\n                            {\r\n                                Log.LogError(LogTitleNormal, \"Package installation failed! (Validation error)\");\r\n                                LogErrors(validationResults);\r\n\r\n                                continue;\r\n                            }\r\n\r\n\r\n                            List<PackageFragmentValidationResult> installResult = packageManagerInstallProcess.Install();\r\n                            if (installResult.Count > 0)\r\n                            {\r\n                                Log.LogError(LogTitleNormal, \"Package installation failed! (Installation error)\");\r\n                                LogErrors(installResult);\r\n\r\n                                continue;\r\n                            }\r\n                        }\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogWarning(LogTitleNormal, ex);\r\n                    }\r\n\r\n                    if (zipFile.ToBeDeleted)\r\n                    {\r\n                        FileUtils.Delete(zipFile.FilePath);\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitleNormal, ex);\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region Utilities\r\n\r\n\r\n        /// <exclude />\r\n        public static void ValidateIsOnlyCalledFromGlobalInitializerFacade(StackTrace stackTrace)\r\n        {\r\n            MethodBase methodInfo = stackTrace.GetFrame(1).GetMethod();\r\n\r\n            if (methodInfo.DeclaringType != typeof(GlobalInitializerFacade))\r\n            {\r\n                throw new SystemException($\"The method {methodInfo} may only be called by the {typeof(GlobalInitializerFacade)}\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void LogErrors(IEnumerable<PackageFragmentValidationResult> packageErrors)\r\n        {\r\n            foreach (PackageFragmentValidationResult packageFragmentValidationResult in packageErrors)\r\n            {\r\n                Log.LogError(LogTitleNormal, packageFragmentValidationResult.Message);\r\n                if (packageFragmentValidationResult.Exception != null)\r\n                {\r\n                    Log.LogError(LogTitleNormal, \"With following exception:\");\r\n                    Log.LogError(LogTitleNormal, packageFragmentValidationResult.Exception);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            using (CoreLockScope)\r\n            {\r\n                _coreInitialized = false;\r\n            }\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        #region Locking\r\n\r\n        /// <exclude />\r\n        public delegate void RunInWriterLockScopeDelegate();\r\n\r\n        /// <exclude />\r\n        public static void RunInWriterLockScope(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)\r\n        {\r\n            using (CoreLockScope)\r\n            {\r\n                runInWriterLockScopeDelegate();\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Locks the initialization token until disposed. Use this in a using {} statement. \r\n        /// </summary>\r\n        internal static IDisposable CoreLockScope\r\n        {\r\n            get\r\n            {\r\n                var stackTrace = new StackTrace();\r\n                var method = stackTrace.GetFrame(1).GetMethod();\r\n\r\n                return new LockerToken(true, $\"{method.DeclaringType.Name}.{method.Name}\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Using this in a using-statement will ensure that the code are \r\n        /// executed AFTER the system has been initialized.\r\n        /// </summary>\r\n        public static IDisposable CoreIsInitializedScope\r\n        {\r\n            get\r\n            {\r\n                // This line ensures that the system is always initialized. \r\n                // Even if the InitializeTheSystem method is NOT called during\r\n                // application startup.\r\n                InitializeTheSystem();\r\n\r\n                return new LockerToken();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Using this in a using-statement will ensure that the code is \r\n        /// executed AFTER any existing locks has been released.\r\n        /// </summary>\r\n        public static IDisposable CoreNotLockedScope => new LockerToken();\r\n\r\n\r\n        private static void AcquireReaderLock()\r\n        {\r\n            _readerWriterLock.AcquireReaderLock(GlobalSettingsFacade.DefaultReaderLockWaitTimeout);\r\n        }\r\n\r\n\r\n\r\n        private static void AcquireWriterLock()\r\n        {\r\n            int threadId = Thread.CurrentThread.ManagedThreadId;\r\n\r\n            if (_readerWriterLock.IsReaderLockHeld)\r\n            {\r\n                LockCookie lockCookie = _readerWriterLock.UpgradeToWriterLock(GlobalSettingsFacade.DefaultWriterLockWaitTimeout);\r\n\r\n                lock(_threadLocking)\r\n                {\r\n                    _threadLocking.LockCookiesPerThreadId.Add(threadId, lockCookie);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                _readerWriterLock.AcquireWriterLock(GlobalSettingsFacade.DefaultWriterLockWaitTimeout);\r\n            }\r\n\r\n            lock (_threadLocking)\r\n            {\r\n                if (_threadLocking.WriterLocksPerThreadId.ContainsKey(threadId))\r\n                {\r\n                    _threadLocking.WriterLocksPerThreadId[threadId] = _threadLocking.WriterLocksPerThreadId[threadId] + 1;\r\n                }\r\n                else\r\n                {\r\n                    _threadLocking.WriterLocksPerThreadId.Add(threadId, 1);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static void ReleaseReaderLock()\r\n        {\r\n            _readerWriterLock.ReleaseReaderLock();\r\n        }\r\n\r\n\r\n        private static void ReleaseWriterLock()\r\n        {\r\n            int threadId = Thread.CurrentThread.ManagedThreadId;\r\n\r\n            if (_threadLocking.WriterLocksPerThreadId[threadId] == 1 &&\r\n                _threadLocking.LockCookiesPerThreadId.ContainsKey(threadId))\r\n            {\r\n                LockCookie lockCookie = _threadLocking.LockCookiesPerThreadId[threadId];\r\n\r\n                lock(_threadLocking)\r\n                {\r\n                    _threadLocking.LockCookiesPerThreadId.Remove(threadId);\r\n                }\r\n\r\n                _readerWriterLock.DowngradeFromWriterLock(ref lockCookie);\r\n            }\r\n            else\r\n            {\r\n                _readerWriterLock.ReleaseWriterLock();\r\n            }\r\n\r\n            lock (_threadLocking)\r\n            {\r\n                _threadLocking.WriterLocksPerThreadId[threadId] = _threadLocking.WriterLocksPerThreadId[threadId] - 1;\r\n\r\n                if (_threadLocking.WriterLocksPerThreadId[threadId] == 0)\r\n                {\r\n                    _threadLocking.WriterLocksPerThreadId.Remove(threadId);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Encapsulates calls to [Acquire|Release][Reader|Writer]Lock(), keeps log of writer locks\r\n        /// </summary>\r\n        private sealed class LockerToken : IDisposable\r\n        {\r\n            private readonly bool _isWriterLock;\r\n            private readonly string _lockSource;\r\n\r\n            /// <summary>\r\n            /// Creates a read lock\r\n            /// </summary>\r\n            internal LockerToken()\r\n                : this(false, null)\r\n            {\r\n            }\r\n\r\n            internal LockerToken(bool writerLock, string lockSource)\r\n            {\r\n                _isWriterLock = writerLock;\r\n                _lockSource = lockSource;\r\n\r\n                if (!writerLock)\r\n                {\r\n                    AcquireReaderLock();\r\n                    return;\r\n                }\r\n\r\n                Verify.ArgumentCondition(!lockSource.IsNullOrEmpty(), nameof(lockSource), \"Write locks must be obtained with a string identifying the source\");\r\n\r\n                #region Logging the action\r\n\r\n                string methodInfo = string.Empty;\r\n                if (RuntimeInformation.IsUnittest)\r\n                {\r\n                    var stackTrace = new StackTrace();\r\n\r\n                    StackFrame stackFrame =\r\n                        (from sf in stackTrace.AsQueryable()\r\n                         where sf.GetMethod().DeclaringType.Assembly.FullName.Contains(\"Composite.Test\")\r\n                         select sf).FirstOrDefault();\r\n\r\n                    if (stackFrame != null)\r\n                    {\r\n                        methodInfo = \", Method:\" + stackFrame.GetMethod().Name;\r\n                    }\r\n                }\r\n                Log.LogVerbose(LogTitle, $\"Writer Lock Acquired (Managed Thread ID: {Thread.CurrentThread.ManagedThreadId}, Source: {lockSource}{methodInfo})\");\r\n\r\n                #endregion Logging the action\r\n\r\n                AcquireWriterLock();\r\n            }\r\n\r\n\r\n\r\n            public void Dispose()\r\n            {\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n                if (!_isWriterLock)\r\n                {\r\n                    ReleaseReaderLock();\r\n                    return;\r\n                }\r\n\r\n                #region Logging the action\r\n\r\n                string methodInfo = string.Empty;\r\n                if (RuntimeInformation.IsUnittest)\r\n                {\r\n                    var stackTrace = new StackTrace();\r\n\r\n                    StackFrame stackFrame =\r\n                        (from sf in stackTrace.AsQueryable()\r\n                         where sf.GetMethod().DeclaringType.Assembly.FullName.Contains(\"Composite.Test\")\r\n                         select sf).FirstOrDefault();\r\n\r\n\r\n                    if (stackFrame != null)\r\n                    {\r\n                        methodInfo = \", Method: \" + stackFrame.GetMethod().Name;\r\n                    }\r\n                }\r\n                Log.LogVerbose(LogTitle, $\"Writer Lock Releasing (Managed Thread ID: {Thread.CurrentThread.ManagedThreadId}, Source: {_lockSource}{methodInfo})\");\r\n\r\n                #endregion\r\n\r\n                ReleaseWriterLock();\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~LockerToken()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n        #endregion\r\n\r\n\r\n        private sealed class ThreadLockingInformation\r\n        {\r\n            public readonly Hashtable<int, int> WriterLocksPerThreadId = new Hashtable<int, int>();\r\n            public readonly Hashtable<int, LockCookie> LockCookiesPerThreadId = new Hashtable<int, LockCookie>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Application/ApplicationOnlineHandlers/AspNetApplicationOnlineHandler/AspNetApplicationOnlineHandler.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.IO;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Application.Plugins.ApplicationOnlineHandler;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Application.ApplicationOnlineHandlers.AspNetApplicationOnlineHandler\r\n{\r\n    [ConfigurationElementType(typeof(AspNetApplicationOnlineHandlerData))]\r\n    internal sealed class AspNetApplicationOnlineHandler : IApplicationOnlineHandler\r\n    {\r\n        private readonly string _sourceFilename;\r\n\r\n\r\n        public AspNetApplicationOnlineHandler(string appOfflineFilename)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(appOfflineFilename, \"appOfflineFilename\");\r\n\r\n            _sourceFilename = Path.Combine(PathUtil.BaseDirectory, PathUtil.Resolve(appOfflineFilename));\r\n        }\r\n\r\n\r\n        public void TurnApplicationOffline()\r\n        {\r\n            ApplicationOfflineCheckHttpModule.FilePath = _sourceFilename;\r\n            ApplicationOfflineCheckHttpModule.IsOffline = true;\r\n        }\r\n        \r\n\r\n        public void TurnApplicationOnline()\r\n        {\r\n            ApplicationOfflineCheckHttpModule.IsOffline = false;\r\n        }\r\n\r\n        public bool IsApplicationOnline()\r\n        {\r\n            return !ApplicationOfflineCheckHttpModule.IsOffline;\r\n        }\r\n\r\n\r\n        public bool CanPutApplicationOffline(out string errorMessage)\r\n        {\r\n            if(!C1File.Exists(_sourceFilename))\r\n            {\r\n                errorMessage = \"AspNetApplicationOnlineHandler: Template file '{0}' is missing\".FormatWith(_sourceFilename);\r\n                return false;\r\n            }\r\n\r\n            string websiteRoot = PathUtil.BaseDirectory;\r\n            if (!PathUtil.WritePermissionGranted(websiteRoot))\r\n            {\r\n                errorMessage = StringResourceSystemFacade.GetString(\r\n                    \"Composite.Core.PackageSystem.PackageFragmentInstallers\", \"NotEnoughNtfsPermissions\")\r\n                    .FormatWith(websiteRoot);\r\n\r\n                return false;\r\n            }\r\n\r\n            errorMessage = null;\r\n            return true;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(AspNetApplicationOnlineHandlerAssembler))]\r\n    internal class AspNetApplicationOnlineHandlerData : ApplicationOnlineHandlerData\r\n    {\r\n        private const string _appOfflineFilenamePropertyName = \"appOfflineFilename\";\r\n        [ConfigurationProperty(_appOfflineFilenamePropertyName, IsRequired = true)]\r\n        public string AppOfflineFilename\r\n        {\r\n            get { return (string)base[_appOfflineFilenamePropertyName]; }\r\n            set { base[_appOfflineFilenamePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class AspNetApplicationOnlineHandlerAssembler : IAssembler<IApplicationOnlineHandler, ApplicationOnlineHandlerData>\r\n    {\r\n        public IApplicationOnlineHandler Assemble(IBuilderContext context, ApplicationOnlineHandlerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            AspNetApplicationOnlineHandlerData data = (AspNetApplicationOnlineHandlerData)objectConfiguration;\r\n\r\n            return new AspNetApplicationOnlineHandler(data.AppOfflineFilename);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Application/ApplicationStartupHandlers/AttributeBasedApplicationStartupHandler/AttributeBasedApplicationStartupHandler.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Runtime.Serialization;\r\nusing System.Security;\r\nusing System.Xml;\r\nusing System.Xml.Serialization;\r\nusing Composite.Core;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Application.Plugins.ApplicationStartupHandler;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Core.Application\r\n{\r\n    /// <summary>    \r\n    /// Using this attribute on a class will cause the CMS to call methods on it at startup. \r\n    /// The following methods will be called, if they exist:\r\n    /// \r\n    /// <code>\r\n    /// /* This handler will be called first, before C1 initialization, and allow you to register services exposed by <see cref=\"Composite.Core.ServiceLocator\"/>\r\n    /// public void ConfigureServices(<see cref=\"Microsoft.Extensions.DependencyInjection.IServiceCollection\"/> serviceCollection) {}\r\n    /// /* This handler will be called before C1 initialization. The data layer cannot be used here. */\r\n    /// public void OnBeforeInitialize() {}\r\n    /// /* This handler will be called after initialization of C1 core. */\r\n    /// public void OnInitialized() {}\r\n    /// </code>\r\n    /// </summary>\r\n    /// <example>\r\n    /// To register a service on <see cref=\"Composite.Core.ServiceLocator\"/>:\r\n    /// <code>\r\n    /// [ApplicationStartup]\r\n    /// public class MyServiceRegistration\r\n    /// {\r\n    ///     public void ConfigureServices(IServiceCollection serviceCollection)\r\n    ///     {\r\n    ///         // Register a singleton service that will be retrievable via Composite.Core.ServiceLocator\r\n    ///         serviceCollection.AddSingleton(typeof(ITestStuff), typeof(TestStuff));\r\n    ///     }\r\n    /// } \r\n    /// </code>\r\n    /// \r\n    /// If OnBeforeInitialize() or OnInitialized() has any parameters, they will be provided via the ServiceLocator.\r\n    /// \r\n    /// <code>\r\n    /// [ApplicationStartup]\r\n    /// public class MyAppStartupHandler\r\n    /// {\r\n    ///     public void OnBeforeInitialize()\r\n    ///     {\r\n    ///     }\r\n    ///     \r\n    ///     public void OnInitialized(Composite.Core.Logging.ILog log)\r\n    ///     {\r\n    ///         log.LogInformation(\"Dependency Injection supported here\");\r\n    ///     }\r\n    /// } \r\n    /// </code>\r\n    /// </example>\r\n    /// <notes>\r\n    /// Class and method can be static, but do not need to be. \r\n    /// </notes>\r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]\r\n    public sealed class ApplicationStartupAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// If set to <value>True</value>, the exceptions will not be muted and the website will fail to start.\r\n        /// </summary>\r\n        public bool AbortStartupOnException { get; set; }\r\n    }\r\n}\r\n\r\n\r\nnamespace Composite.Plugins.Application.ApplicationStartupHandlers.AttributeBasedApplicationStartupHandler\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(NonConfigurableApplicationStartupHandler))]\r\n    public sealed class AttributeBasedApplicationStartupHandler : IApplicationStartupHandler\r\n    {\r\n        /// <exclude />\r\n        public void ConfigureServices(IServiceCollection serviceCollection)\r\n        {\r\n            var serviceCollectionParameter = new object[] { serviceCollection };\r\n            foreach (var startupHandler in _startupHandlers)\r\n            {\r\n                var methodInfo = startupHandler.ConfigureServicesMethod;\r\n\r\n                try\r\n                {\r\n                    if (methodInfo != null)\r\n                    {\r\n                        if (methodInfo.IsStatic)\r\n                        {\r\n                            methodInfo.Invoke(null, serviceCollectionParameter);\r\n                        }\r\n                        else\r\n                        {\r\n                            var instance = Activator.CreateInstance(methodInfo.DeclaringType);\r\n                            methodInfo.Invoke(instance, serviceCollectionParameter);\r\n                        }\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    ProcessHandlerException(startupHandler, methodInfo, ex);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void OnBeforeInitialize(IServiceProvider serviceProvider)\r\n        {\r\n            ExecuteEventHandlers(serviceProvider, handler => handler.OnBeforeInitializeMethod);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void OnInitialized(IServiceProvider serviceProvider)\r\n        {\r\n            ExecuteEventHandlers(serviceProvider, handler => handler.OnInitializedMethod);\r\n        }\r\n\r\n\r\n        private class StartupHandlerInfo\r\n        {\r\n            public StartupHandlerInfo(Type type, ApplicationStartupAttribute attribute)\r\n            {\r\n                Type = type;\r\n                Attribute = attribute;\r\n            }\r\n\r\n            public Type Type { get; }\r\n            public ApplicationStartupAttribute Attribute { get; }\r\n\r\n            public MethodInfo OnBeforeInitializeMethod { get; set; }\r\n            public MethodInfo OnInitializedMethod { get; set; }\r\n            public MethodInfo ConfigureServicesMethod { get; set; }\r\n        }\r\n\r\n        private static readonly string LogTitle = typeof (AttributeBasedApplicationStartupHandler).Name;\r\n        private static readonly string CacheFileName = \"StartupHandlersCache.xml\";\r\n\r\n        private static readonly string OnBeforeInitializeMethodName = nameof(IApplicationStartupHandler.OnBeforeInitialize);\r\n        private static readonly string OnInitializedMethodName = nameof(IApplicationStartupHandler.OnInitialized);\r\n        private static readonly string ConfigureServicesMethodName = nameof(IApplicationStartupHandler.ConfigureServices);\r\n\r\n        private readonly List<StartupHandlerInfo> _startupHandlers = new List<StartupHandlerInfo>();\r\n\r\n        private static readonly string[] AssembliesToIgnore =\r\n            {\r\n                \"Composite.Workflows\", \r\n                \"Composite.Generated\", \r\n                \"ICSharpCode.SharpZipLib\", \r\n                \"TidyNet\",\r\n                \"System.\",\r\n                \"Microsoft.\",\r\n                \"Newtonsoft.Json\"\r\n            };\r\n        private static XmlSerializer _xmlSerializer;\r\n\r\n        private string _cacheFilePath;\r\n\r\n\r\n        /// <exclude />\r\n        public AttributeBasedApplicationStartupHandler()\r\n        {\r\n            List<AssemblyInfo> cachedTypesInfo = GetCachedAssemblyInfo();\r\n            bool cacheHasBeenUpdated = false;\r\n\r\n            \r\n            foreach(string filePath in AssemblyFacade.GetAssembliesFromBin())\r\n            {\r\n                StartupHandlerInfo[] types = null;\r\n                try\r\n                {\r\n                    types = GetSubscribedTypes(filePath, cachedTypesInfo, ref cacheHasBeenUpdated);\r\n                }\r\n                catch (Exception e)\r\n                {\r\n                    LogAssemblyLoadException(filePath, e);\r\n                }\r\n\r\n                if(types != null)\r\n                {\r\n                    Subscribe(types);\r\n                }\r\n            }\r\n\r\n            Assembly appCodeAsm = AssemblyFacade.GetAppCodeAssembly();\r\n            if (appCodeAsm != null)\r\n            {\r\n                Subscribe(GetSubscribedTypes(appCodeAsm.GetTypes()));\r\n            }\r\n\r\n            if (cacheHasBeenUpdated)\r\n            {\r\n                SaveTypesCache(cachedTypesInfo);\r\n            }\r\n        }\r\n\r\n        private void Subscribe(StartupHandlerInfo[] startupHandlers)\r\n        {\r\n            foreach (StartupHandlerInfo startupHandler in startupHandlers)\r\n            {\r\n                var type = startupHandler.Type;\r\n\r\n                var methods = type.GetMethods();\r\n\r\n                startupHandler.ConfigureServicesMethod = methods.FirstOrDefault(m => m.Name == ConfigureServicesMethodName && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(IServiceCollection));\r\n                startupHandler.OnBeforeInitializeMethod = methods.FirstOrDefault(m => m.Name == OnBeforeInitializeMethodName);\r\n                startupHandler.OnInitializedMethod = methods.FirstOrDefault(m => m.Name == OnInitializedMethodName);\r\n\r\n                _startupHandlers.Add(startupHandler);\r\n            }\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is a temp file, do not go through IO layer\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\", Justification = \"This is a temp file, do not go through IO layer\")]\r\n        private List<AssemblyInfo> GetCachedAssemblyInfo()\r\n        {\r\n            var result = new List<AssemblyInfo>();\r\n            if (!File.Exists(CacheFilePath))\r\n            {\r\n                return result;\r\n            }\r\n\r\n            SubscribedTypesCache cached;\r\n            try\r\n            {\r\n                using (var fileStream = File.Open(CacheFilePath, FileMode.Open))\r\n                {\r\n                    cached = GetSerializer().Deserialize(fileStream) as SubscribedTypesCache;\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                if(ex is IOException || ex is UnauthorizedAccessException)\r\n                {\r\n                    Log.LogWarning(LogTitle, $\"Failed to open file '{CacheFilePath}'\");\r\n                    Log.LogError(LogTitle, ex);\r\n                    return result;\r\n                }\r\n\r\n                Exception innerEx = ex;\r\n                if(ex is InvalidOperationException && ex.InnerException != null)\r\n                {\r\n                    innerEx = ex.InnerException;\r\n                }\r\n\r\n                if(innerEx is XmlException || innerEx is SerializationException)\r\n                {\r\n                    Log.LogWarning(LogTitle, $\"Failed to deserialize file '{CacheFilePath}'\");\r\n                    Log.LogError(LogTitle, ex);\r\n                    return result;\r\n                }\r\n\r\n                throw;\r\n            }\r\n\r\n            if (cached?.Assemblies != null && cached.Assemblies.Length != 0)\r\n            {\r\n                result.AddRange(cached.Assemblies);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static StartupHandlerInfo[] GetSubscribedTypes(\r\n            string filePath, List<AssemblyInfo> cachedTypesInfo, ref bool cacheHasBeenUpdated)\r\n        {\r\n            string assemblyName = Path.GetFileNameWithoutExtension(filePath);\r\n\r\n            foreach (string assemblyToIgnore in AssembliesToIgnore)\r\n            {\r\n                if (assemblyName == assemblyToIgnore || assemblyName.StartsWith(assemblyToIgnore + \",\")\r\n                    || (assemblyToIgnore.EndsWith(\".\") && assemblyName.StartsWith(assemblyToIgnore)))\r\n                {\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            DateTime modificationDate = C1File.GetLastWriteTime(filePath);\r\n\r\n            var cachedInfo = cachedTypesInfo.FirstOrDefault(asm => asm.AssemblyName == assemblyName);\r\n            if (cachedInfo != null)\r\n            {\r\n                if (cachedInfo.LastModified == modificationDate)\r\n                {\r\n                    string[] subscribedTypesNames = cachedInfo.SubscribedTypes;\r\n                    if(subscribedTypesNames.Length == 0)\r\n                    {\r\n                        return new StartupHandlerInfo[0];\r\n                    }\r\n\r\n                    var asm = Assembly.LoadFrom(filePath);\r\n                    return (from typeName in subscribedTypesNames\r\n                           let type = asm.GetType(typeName)\r\n                           where  type != null\r\n                           let attribute = type.GetCustomAttributes(false)\r\n                                               .OfType<ApplicationStartupAttribute>()\r\n                                               .FirstOrDefault()\r\n                           where attribute != null\r\n                           select new StartupHandlerInfo(type, attribute)).ToArray();\r\n                }\r\n\r\n                // Removing cache entry if it is obsolete\r\n                cachedTypesInfo.Remove(cachedInfo);\r\n            }\r\n\r\n            Assembly assembly;\r\n            try\r\n            {\r\n                assembly = Assembly.LoadFrom(filePath);\r\n            }\r\n            catch (ReflectionTypeLoadException ex)\r\n            {\r\n                Log.LogWarning(LogTitle, $\"Failed to load assembly '{filePath}'\");\r\n                if(ex.LoaderExceptions != null && ex.LoaderExceptions.Length > 0)\r\n                {\r\n                    Log.LogError(LogTitle, ex.LoaderExceptions[0]);\r\n                }\r\n\r\n                return null;\r\n            }\r\n\r\n            if (!AssemblyFacade.AssemblyPotentiallyUsesType(assembly, typeof (ApplicationStartupAttribute)))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            Type[] types;\r\n\r\n            if (!TryGetTypes(assembly, out types))\r\n            {\r\n                return new StartupHandlerInfo[0];\r\n            }\r\n\r\n            var result = GetSubscribedTypes(types);\r\n\r\n            var newCacheEntry = new AssemblyInfo\r\n            {\r\n                AssemblyName = assembly.GetName().Name,\r\n                LastModified = modificationDate,\r\n                SubscribedTypes = result.Select(sh => sh.Type.FullName).ToArray()\r\n            };\r\n\r\n            cachedTypesInfo.Add(newCacheEntry);\r\n\r\n            cacheHasBeenUpdated = true;\r\n\r\n            return result;\r\n        }\r\n\r\n        private static StartupHandlerInfo[] GetSubscribedTypes(Type[] types)\r\n        {\r\n            var result = new List<StartupHandlerInfo>();\r\n            foreach (Type type in types)\r\n            {\r\n                try\r\n                {\r\n                    var attribute = type.GetCustomAttributes(false)\r\n                            .OfType<ApplicationStartupAttribute>()\r\n                            .FirstOrDefault();\r\n\r\n                    if (attribute != null)\r\n                    {\r\n                        result.Add(new StartupHandlerInfo(type, attribute));\r\n                    }\r\n                }\r\n                catch(SecurityException)\r\n                {\r\n                    // While running under \"medium trust\" getting attributes may throw SecurityException while getting attributes for some classes\r\n                }\r\n            }\r\n            return result.ToArray();\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is a temp file, do not go through IO layer\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\", Justification = \"This is a temp file, do not go through IO layer\")]\r\n        private void SaveTypesCache(List<AssemblyInfo> cachedTypesInfo)\r\n        {\r\n            SubscribedTypesCache root = null;\r\n\r\n            if(cachedTypesInfo.Count > 0)\r\n            {\r\n                root = new SubscribedTypesCache {Assemblies = cachedTypesInfo.ToArray()};\r\n            }\r\n\r\n            try\r\n            {\r\n                if(root == null)\r\n                {\r\n                    File.Delete(CacheFilePath);\r\n                }\r\n                else\r\n                {\r\n                    if (!C1Directory.Exists(CacheDirectoryPath))\r\n                    {\r\n                        C1Directory.CreateDirectory(CacheDirectoryPath);\r\n                    }\r\n\r\n                    using (var fileStream = File.Open(CacheFilePath, FileMode.Create))\r\n                    {\r\n                        GetSerializer().Serialize(fileStream, root);\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception)\r\n            {\r\n                Log.LogWarning(LogTitle, $\"Failed to open file '{CacheFilePath}' for writing - this may lead to slower start up times, if this issue persist. In that case, check that this file is accessible to the web application for writes.\");\r\n            }\r\n        }\r\n\r\n        [DebuggerStepThrough]\r\n        private static bool TryGetTypes(Assembly assembly, out Type[] types)\r\n        {\r\n            try\r\n            {\r\n                types = assembly.GetTypes();\r\n                return true;\r\n            }\r\n            catch (TypeLoadException exception)\r\n            {\r\n                Log.LogError(LogTitle, new Exception($\"Failed to load assembly '{assembly.FullName}'\", exception));\r\n                types = null;\r\n                return false;\r\n            }\r\n            catch(ReflectionTypeLoadException exception)\r\n            {\r\n                var exceptionToLog = exception.LoaderExceptions != null\r\n                    ? exception.LoaderExceptions.First()\r\n                    : exception;\r\n                \r\n                Log.LogError(LogTitle, new Exception($\"Failed to load assembly '{assembly.FullName}'\", exceptionToLog));\r\n\r\n                types = null;\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use Composite.Core.Types.AssemblyFacade.IsAppCodeDll(assembly)\", true)]\r\n        public static bool IsAppCodeDll(Assembly assembly)\r\n        {\r\n            return AssemblyFacade.IsAppCodeDll(assembly);\r\n        }\r\n\r\n\r\n        private static XmlSerializer GetSerializer()\r\n        {\r\n            // NOTE: Performance critical to have serializer inside Composite.Core.XmlSerializers.dll\r\n            if (_xmlSerializer == null)\r\n            {\r\n                _xmlSerializer = new XmlSerializer(typeof(SubscribedTypesCache), new [] {typeof(AssemblyInfo)});\r\n            }\r\n\r\n            return _xmlSerializer;\r\n        }\r\n\r\n\r\n        private static string CacheDirectoryPath => PathUtil.Resolve(GlobalSettingsFacade.CacheDirectory);\r\n\r\n\r\n        private string CacheFilePath\r\n        {\r\n            get\r\n            {\r\n                if (_cacheFilePath == null)\r\n                {\r\n                    _cacheFilePath = Path.Combine(CacheDirectoryPath, CacheFileName);\r\n                }\r\n                \r\n                return _cacheFilePath;\r\n            }\r\n        }\r\n\r\n\r\n        private void ExecuteEventHandlers(IServiceProvider serviceProvider, Func<StartupHandlerInfo,MethodInfo> methodLocator)\r\n        {\r\n            foreach (var startupHandler in _startupHandlers.Where(h => methodLocator(h) != null))\r\n            {\r\n                MethodInfo methodInfo = methodLocator(startupHandler);\r\n\r\n                try\r\n                {\r\n                    InvokeWithServices(serviceProvider, methodInfo);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    ProcessHandlerException(startupHandler, methodInfo, ex);\r\n                }\r\n            }\r\n        }\r\n\r\n        private void ProcessHandlerException(StartupHandlerInfo startupHandler, MethodInfo methodInfo, Exception ex)\r\n        {\r\n            var type = methodInfo.DeclaringType;\r\n            var message = $\"Failed to execute startup handler. Type: '{type.FullName}', Assembly: '{type.Assembly.FullName}'\";\r\n\r\n            if (startupHandler.Attribute.AbortStartupOnException)\r\n            {\r\n                throw new InvalidOperationException(message, ex);\r\n            }\r\n\r\n            Log.LogError(LogTitle, message);\r\n\r\n            Log.LogError(LogTitle, ex is TargetInvocationException ? ex.InnerException : ex);\r\n        }\r\n\r\n\r\n        private static void InvokeWithServices(IServiceProvider serviceProvider, MethodInfo methodInfo)\r\n        {\r\n            object[] methodArguments = methodInfo.GetParameters().Select(p => serviceProvider.GetRequiredService(p.ParameterType)).ToArray();\r\n            object methodClass = methodInfo.IsStatic ? null : ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider, methodInfo.DeclaringType);\r\n\r\n            methodInfo.Invoke(methodClass, methodArguments);\r\n        }\r\n\r\n\r\n        private static void LogAssemblyLoadException(string filePath, Exception e)\r\n        {\r\n            var logEx = new InvalidOperationException($\"Failed to load types from file '{filePath}'\", e);\r\n            Log.LogError(LogTitle, logEx);\r\n\r\n            Exception toExamine = e;\r\n            while (toExamine != null)\r\n            {\r\n                ReflectionTypeLoadException reflectionTypeLoadException = toExamine as ReflectionTypeLoadException;\r\n                if (reflectionTypeLoadException != null)\r\n                {\r\n                    Exception[] loaderExceptions = reflectionTypeLoadException.LoaderExceptions;\r\n                    foreach (Exception loaderException in loaderExceptions)\r\n                    {\r\n                        Log.LogError(LogTitle + \" | LOADEREXCEPTION\", loaderException.Message);\r\n                    }\r\n                }\r\n\r\n                toExamine = toExamine.InnerException;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Serializable]\r\n        public class SubscribedTypesCache\r\n        {\r\n            /// <exclude />\r\n            public AssemblyInfo[] Assemblies { get; set; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [Serializable]\r\n        public class AssemblyInfo\r\n        {\r\n            /// <exclude />\r\n            public string AssemblyName { get; set; }\r\n\r\n            /// <exclude />\r\n            public DateTime LastModified { get; set; }\r\n\r\n            /// <exclude />\r\n            public string[] SubscribedTypes; \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Commands/ConsoleCommandHandlers/BrowseUrl.cs",
    "content": "﻿using Composite.C1Console.Commands;\r\nusing Composite.C1Console.Commands.Plugins.ConsoleCommandHandler;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Commands.ConsoleCommandHandlers\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableConsoleCommandHandler))]\r\n    internal class BrowseUrl : IConsoleCommandHandler\r\n    {\r\n        public void HandleConsoleCommand(string consoleId, string commandPayload)\r\n        {\r\n            string url = commandPayload;\r\n\r\n            var entityToken = UrlToEntityTokenFacade.TryGetEntityToken(url);\r\n\r\n            if (entityToken == null)\r\n            {\r\n                PageUrlData pageUrlData = PageUrls.ParseUrl(url);\r\n\r\n                var page = pageUrlData?.GetPage();\r\n                if (page == null)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                entityToken = page.GetDataEntityToken();\r\n            }\r\n            \r\n            ConsoleCommandHelper.SelectConsoleElement(consoleId, entityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Commands/ConsoleCommandHandlers/ConsoleCommandHelper.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.WebClient.FlowMediators;\r\nusing Composite.Core.WebClient.Services.TreeServiceObjects;\r\n\r\nnamespace Composite.Plugins.Commands.ConsoleCommandHandlers\r\n{\r\n    static class ConsoleCommandHelper\r\n    {\r\n        /// <summary>\r\n        /// Selects the specified element in the console\r\n        /// </summary>\r\n        /// <param name=\"consoleId\">The console id.</param>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        public static void SelectConsoleElement(string consoleId, EntityToken entityToken)\r\n        {\r\n            var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);\r\n\r\n            var rootEntityToken = AttachingPoint.PerspectivesRoot.EntityToken;\r\n\r\n            var refreshInfo = TreeServicesFacade.FindEntityToken(rootEntityToken, entityToken,\r\n                new List<RefreshChildrenParams>(new[]\r\n                {\r\n                    new RefreshChildrenParams\r\n                    {\r\n                        ProviderName = rootEntityToken.Source,\r\n                        EntityToken = EntityTokenSerializer.Serialize(rootEntityToken, true)\r\n                    }\r\n                }));\r\n\r\n            if (refreshInfo == null || refreshInfo.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            string perspectiveElementKey = refreshInfo.Count > 1 ? refreshInfo[1].ElementKey : refreshInfo[0].ElementKey;\r\n\r\n            var selectItem = new SelectElementQueueItem\r\n            {\r\n                EntityToken = serializedEntityToken,\r\n                PerspectiveElementKey = perspectiveElementKey\r\n            };\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(selectItem, consoleId);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Selects the specified element in the console, doesn't change the perspective\r\n        /// </summary>\r\n        /// <param name=\"consoleId\">The console id.</param>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        public static void SelectConsoleElementWithoutPerspectiveChange(string consoleId, EntityToken entityToken)\r\n        {\r\n            var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);\r\n\r\n            var selectItem = new SelectElementQueueItem\r\n            {\r\n                EntityToken = serializedEntityToken,\r\n            };\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(selectItem, consoleId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Commands/ConsoleCommandHandlers/FocusData.cs",
    "content": "﻿using System.Linq;\r\nusing Composite.C1Console.Commands;\r\nusing Composite.C1Console.Commands.Plugins.ConsoleCommandHandler;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Commands.ConsoleCommandHandlers\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableConsoleCommandHandler))]\r\n    internal class FocusData : IConsoleCommandHandler\r\n    {\r\n        public void HandleConsoleCommand(string consoleId, string commandPayload)\r\n        {\r\n            string[] parts = commandPayload.Split(':');\r\n            if (parts.Length < 2)\r\n            {\r\n                return;\r\n            }\r\n\r\n            string typeName = parts[0];\r\n            string keyString = string.Join(\":\", parts.Skip(1));\r\n\r\n            var supportedInterfaces = DataFacade.GetAllInterfaces();\r\n\r\n            var type = supportedInterfaces.FirstOrDefault(t => t.Name == typeName || t.FullName == typeName);\r\n            if (type == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var keyProperty = type.GetSingleKeyProperty();\r\n\r\n            object key = ValueTypeConverter.Convert(keyString, keyProperty.PropertyType);\r\n\r\n            IData data;\r\n\r\n            using (new DataConnection())\r\n            {\r\n                data = DataFacade.TryGetDataByUniqueKey(type, key);\r\n                if (data == null)\r\n                {\r\n                    return;\r\n                }\r\n            }\r\n\r\n            var entityToken = data.GetDataEntityToken();\r\n            ConsoleCommandHelper.SelectConsoleElement(consoleId, entityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Commands/ConsoleCommandHandlers/FocusElement.cs",
    "content": "﻿using Composite.C1Console.Commands;\r\nusing Composite.C1Console.Commands.Plugins.ConsoleCommandHandler;\r\nusing Composite.C1Console.Security;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Commands.ConsoleCommandHandlers\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableConsoleCommandHandler))]\r\n    internal class FocusElement : IConsoleCommandHandler\r\n    {\r\n        public void HandleConsoleCommand(string consoleId, string commandPayload)\r\n        {\r\n            var serializedEntityToken = commandPayload.Replace(\"%5C\", \"\\\\\");\r\n\r\n            var entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            ConsoleCommandHelper.SelectConsoleElement(consoleId, entityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Components/ComponentProviderSettings.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\nusing Composite.Core.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Components\r\n{\r\n    internal class ComponentProviderSettings : SerializableConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Plugins.Components.ComponentProviderConfiguration\";\r\n\r\n        private const string ComponentProvidersProperty = \"ComponentProviders\";\r\n        [ConfigurationProperty(ComponentProvidersProperty, IsRequired = true)]\r\n        public NameTypeConfigurationElementCollection<ComponentProviderData, ComponentProviderData>\r\n            ComponentProviders => (NameTypeConfigurationElementCollection<ComponentProviderData, ComponentProviderData>)base[ComponentProvidersProperty];\r\n\r\n        internal static ComponentProviderData GetProviderPath(string name)\r\n        {\r\n            var settings = ConfigurationServices.ConfigurationSource.GetSection(ComponentProviderSettings.SectionName)\r\n                               as ComponentProviderSettings;\r\n\r\n            return settings?.ComponentProviders.FirstOrDefault(provider => provider.Name.Equals(name));\r\n        }\r\n    }\r\n\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    internal class ComponentProviderData : NameTypeConfigurationElement\r\n    {\r\n        [ConfigurationProperty(\"directory\", IsRequired = false, DefaultValue = \"~/App_Data/Components\")]\r\n        public string Directory\r\n        {\r\n            get { return (string)base[\"directory\"]; }\r\n            set { base[\"directory\"] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(\"fileSearchPattern\", IsRequired = false, DefaultValue = \"*.xml\")]\r\n        public string FileSearchPattern\r\n        {\r\n            get { return (string)base[\"fileSearchPattern\"]; }\r\n            set { base[\"fileSearchPattern\"] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(\"topDirectoryOnly\", IsRequired = false, DefaultValue = false)]\r\n        public bool TopDirectoryOnly\r\n        {\r\n            get { return (bool)base[\"topDirectoryOnly\"]; }\r\n            set { base[\"topDirectoryOnly\"] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Components/ComponentTags/TagManager.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.RichContent.Components;\r\nusing Composite.Core;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Composite.Plugins.Components.ComponentTags\r\n{\r\n    /// <exclude />\r\n    [ApplicationStartup]\r\n    public class TagManagerRegistrar\r\n    {\r\n        /// <exclude />\r\n        public void ConfigureServices(IServiceCollection serviceCollection)\r\n        {\r\n            serviceCollection.Add(ServiceDescriptor.Singleton(new TagManager()));\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Service for working with component tags\r\n    /// </summary>\r\n    public class TagManager\r\n    {\r\n        private static Dictionary<string, string> _tagToTitleMap;\r\n        private const string TagConfigurationsRelativePath = \"~/App_Data/Composite/Configuration/ComponentTags.xml\";\r\n\r\n        internal TagManager()\r\n        {\r\n            var doc = XDocumentUtils.Load(PathUtil.Resolve(TagConfigurationsRelativePath));\r\n\r\n            _tagToTitleMap = (from element in doc.Root?.Elements()\r\n                select new {Name = element.GetAttributeValue(\"name\"), Value = element.GetAttributeValue(\"title\")})\r\n                .ToDictionary(o => o.Name, o => o.Value);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Tries to find a locale title for given tag\r\n        /// </summary>\r\n        /// <param name=\"tag\"></param>\r\n        /// <returns></returns>\r\n        public string GetTagTitle(string tag)\r\n        {\r\n            if (_tagToTitleMap.ContainsKey(tag))\r\n            {\r\n                return StringResourceSystemFacade.ParseString(_tagToTitleMap[tag]);\r\n            }\r\n\r\n            return tag;\r\n        }\r\n\r\n        /// <summary>\r\n        /// return a list of tags based on their ordering in configuration file\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public IEnumerable<string> GetRegisteredTagOrdering()\r\n        {\r\n            return _tagToTitleMap.Select(f => GetTagTitle(f.Key));\r\n        }\r\n        /// <summary>\r\n        /// return a list of all tags based on their ordering in configuration file\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public IEnumerable<string> GetAllTags()\r\n        {\r\n            var componentManager = ServiceLocator.GetRequiredService<ComponentManager>();\r\n            return GetRegisteredTagOrdering().Union(componentManager.GetComponents().SelectMany(f=>f.GroupingTags));\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Components/ComponentsEndpoint/ComponentsEndpoint.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Castle.Core.Internal;\r\nusing Composite.C1Console.RichContent.Components;\r\nusing Composite.C1Console.RichContent.ContainerClasses;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.WebClient.Services.WampRouter;\r\nusing WampSharp.V2.Rpc;\r\n\r\nnamespace Composite.Plugins.Components.ComponentsEndpoint\r\n{\r\n    [ApplicationStartup]\r\n    internal class ComponentsEndpoint\r\n    {\r\n        public static void OnInitialized(ComponentManager componentManager, ComponentChangeNotifier componentChangeNotifier)\r\n        {\r\n            WampRouterFacade.RegisterCallee(new ComponentsRpcService(componentManager));\r\n            WampRouterFacade.RegisterPublisher(new ComponentPublisher(componentChangeNotifier));\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Rpc service collection for interaction with components\r\n    /// </summary>\r\n    public class ComponentsRpcService : IRpcService\r\n    {\r\n        private static ComponentManager _componentManager;\r\n\r\n        internal ComponentsRpcService(ComponentManager componentManager)\r\n        {\r\n            _componentManager = componentManager;\r\n        }\r\n\r\n        /// <summary>\r\n        /// To get all components\r\n        /// </summary>\r\n        /// <returns>list of Components</returns>\r\n        [WampProcedure(\"components.get\")]\r\n        public IEnumerable<Component> GetComponents(string containerclass = null)\r\n        {\r\n            var sepratedContainerClass = ContainerClassManager.ParseToList(containerclass).ToList();\r\n\r\n            if (!sepratedContainerClass.IsNullOrEmpty())\r\n            {\r\n                return\r\n                    _componentManager.GetComponents()\r\n                        .Where(\r\n                            f =>\r\n                                (f.ContainerClasses.IsNullOrEmpty() ||\r\n                                 f.ContainerClasses.Intersect(sepratedContainerClass).Any()) &&\r\n                                (f.AntiTags.IsNullOrEmpty() || \r\n                                !f.AntiTags.Intersect(sepratedContainerClass).Any()));\r\n            }\r\n            return _componentManager.GetComponents();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Select a component for use, signal that dialog is finished\r\n        /// </summary>\r\n        /// <returns>list of Components</returns>\r\n        [WampProcedure(\"components.pick\")]\r\n        public void FinishProvider()\r\n        {\r\n        }\r\n\r\n        /// <summary>\r\n        /// Close dialog without changes\r\n        /// </summary>\r\n        /// <returns>list of Components</returns>\r\n        [WampProcedure(\"structure.dialog.cancel\")]\r\n        public void CancelProvider()\r\n        {\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Publisher for interaction with components\r\n    /// </summary>\r\n    public class ComponentPublisher : IWampEventHandler<ComponentChange,bool>\r\n    {\r\n        private readonly ComponentChangeNotifier _componentChangeNotifier;\r\n\r\n        /// <summary>\r\n        /// Change in components topic\r\n        /// </summary>\r\n        public static string Topic => \"components.new\";\r\n\r\n        string IWampEventHandler<ComponentChange, bool>.Topic => Topic;\r\n\r\n        /// <summary>\r\n        /// Event to observe when there is any change in components\r\n        /// </summary>\r\n        public IObservable<ComponentChange> Event => _componentChangeNotifier;\r\n\r\n        internal ComponentPublisher(ComponentChangeNotifier componentChangeNotifier)\r\n        {\r\n            _componentChangeNotifier = componentChangeNotifier;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Data returning after any change happens in components\r\n        /// </summary>\r\n        public bool GetNewData()\r\n        {\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Components/ComponentsEndpoint/ComponentsResponseMessage.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.Services.WampRouter;\r\nusing Composite.Plugins.Components.ComponentTags;\r\nusing WampSharp.V2.Rpc;\r\n\r\nnamespace Composite.Plugins.Components.ComponentsEndpoint\r\n{\r\n    /// <exclude />\r\n    public class ComponentsResponseMessage\r\n    {\r\n        /// <exclude />\r\n        public string Name => \"component-selector-shim\";\r\n        /// <exclude />\r\n        public string Type => \"dialogPageShim\";\r\n        /// <exclude />\r\n        public Dialog Dialog => new Dialog();\r\n    }\r\n\r\n    /// <exclude />\r\n    public class Dialog\r\n    {\r\n        /// <exclude />\r\n        public string Name => \"component-selector\";\r\n        /// <exclude />\r\n        public string SearchPlaceholder => StringResourceSystemFacade.GetString(\"Composite.Web.VisualEditor\",\r\n                    \"Components.Window.DialogFilterPlaceholder\");\r\n        /// <exclude />\r\n        public List<Pane> Panes => new List<Pane>() { new Pane() };\r\n    }\r\n\r\n    /// <exclude />\r\n    public class Pane\r\n    {\r\n        /// <exclude />\r\n        public Pane()\r\n        {\r\n            var tagManager = ServiceLocator.GetRequiredService<TagManager>();\r\n            Categories = tagManager.GetAllTags();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Name => \"component-list\";\r\n        /// <exclude />\r\n        public string Type => \"palette\";\r\n\r\n        /// <exclude />\r\n        public string Headline => StringResourceSystemFacade.GetString(\"Composite.Web.VisualEditor\",\r\n                    \"Components.Window.Headline\");\r\n        /// <exclude />\r\n        public string Context => \"left-aside\";\r\n        /// <exclude />\r\n        public string NoItemsText => StringResourceSystemFacade.GetString(\"Composite.Web.VisualEditor\",\r\n                    \"Components.Window.NoItems\");\r\n        /// <exclude />\r\n        public IEnumerable<string> Categories { get; }\r\n        /// <exclude />\r\n        public Provider Provider => new Provider();\r\n        /// <exclude />\r\n        public FinishButton FinishButton => new FinishButton();\r\n        /// <exclude />\r\n        public FinishProvider FinishProvider => new FinishProvider();\r\n        /// <exclude />\r\n        public CancelButton CancelButton => new CancelButton();\r\n        /// <exclude />\r\n        public CancelProvider CancelProvider => new CancelProvider();\r\n        /// <exclude />\r\n        public UpdateProvider UpdateTopic => new UpdateProvider();\r\n    }\r\n\r\n    /// <exclude />\r\n    public class Provider : ProviderResponse\r\n    {\r\n        /// <exclude />\r\n        public override string Name => \"elementSource\";\r\n        /// <exclude />\r\n        public override string Uri => ResponseMessageHelper.GetProcedureName<ComponentsRpcService>(\r\n            nameof(ComponentsRpcService.GetComponents));\r\n    }\r\n\r\n    /// <exclude />\r\n    public class FinishButton : ButtonResponse\r\n    {\r\n        /// <exclude />\r\n        public override string Label => StringResourceSystemFacade.GetString(\"Composite.Web.VisualEditor\",\r\n                    \"Components.Window.Ok\");\r\n        /// <exclude />\r\n        public override string Style => \"main\";\r\n    }\r\n\r\n    /// <exclude />\r\n    public class FinishProvider : ProviderResponse\r\n    {\r\n        /// <exclude />\r\n        public override string Name => \"elementInsert\";\r\n        /// <exclude />\r\n        public override string Protocol => \"post\";\r\n        /// <exclude />\r\n        public string Response => \"Dialog.RESPONSE_ACCEPT\";\r\n        /// <exclude />\r\n        public string Action => \"DialogPageBinding.ACTION_RESPONSE\";\r\n        /// <exclude />\r\n        public List<string> Markup => new List<string>() { \"selectedComponentDefinition\" };\r\n        /// <exclude />\r\n        public override string Uri => \"\";\r\n    }\r\n\r\n    /// <exclude />\r\n    public class CancelButton : ButtonResponse\r\n    {\r\n        /// <exclude />\r\n        public override string Label => StringResourceSystemFacade.GetString(\"Composite.Web.VisualEditor\",\r\n                    \"Components.Window.Cancel\");\r\n        /// <exclude />\r\n        public override string Style => \"dialog\";\r\n    }\r\n\r\n    /// <exclude />\r\n    public class CancelProvider : ProviderResponse\r\n    {\r\n        /// <exclude />\r\n        public override string Name => \"componentListCancel\";\r\n        /// <exclude />\r\n        public override string Protocol => \"post\";\r\n        /// <exclude />\r\n        public string Action => \"DialogPageBinding.ACTION_RESPONSE\";\r\n        /// <exclude />\r\n        public string Response => \"Dialog.RESPONSE_CANCEL\";\r\n        /// <exclude />\r\n        public override string Uri => \"\";\r\n\r\n    }\r\n\r\n    /// <exclude />\r\n    public class UpdateProvider : ProviderResponse\r\n    {\r\n        /// <exclude />\r\n        public override string Name => \"updateTopic\";\r\n        /// <exclude />\r\n        public override string Uri => ComponentPublisher.Topic;\r\n    }\r\n\r\n    internal static class ResponseMessageHelper\r\n    {\r\n        internal static string GetProcedureName<T>(string methodName) where T : IRpcService\r\n        {\r\n            return ((WampProcedureAttribute)MethodBase.GetMethodFromHandle(\r\n                typeof(T).GetMethod(methodName).MethodHandle)\r\n                .GetCustomAttributes(typeof(WampProcedureAttribute), true)[0]).Procedure;\r\n        }\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Page structure provider contract\r\n    /// </summary>\r\n    public abstract class ProviderResponse\r\n    {\r\n        /// <summary>\r\n        /// provider's name\r\n        /// </summary>\r\n        public abstract string Name { get; }\r\n\r\n        /// <summary>\r\n        /// provider's protocol\r\n        /// </summary>\r\n        public virtual string Protocol => \"wamp\";\r\n        /// <summary>\r\n        /// provider's uri\r\n        /// </summary>\r\n        public abstract string Uri { get; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// page structure button contract\r\n    /// </summary>\r\n    public abstract class ButtonResponse\r\n    {\r\n        /// <summary>\r\n        /// button label\r\n        /// </summary>\r\n        public abstract string Label { get; }\r\n\r\n        /// <summary>\r\n        /// button style\r\n        /// </summary>\r\n        public abstract string Style { get; }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Components/FileBasedComponentProvider/FileBasedComponentProvider.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.RichContent.Components;\r\nusing Composite.Core.Application;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reactive.Linq;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Castle.Core.Internal;\r\nusing Composite.C1Console.RichContent.ContainerClasses;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\nusing Composite.Plugins.Components.ComponentTags;\r\n\r\nnamespace Composite.Plugins.Components.FileBasedComponentProvider\r\n{\r\n    /// <exclude />\r\n    [ApplicationStartup()]\r\n    public class FileBasedComponentProviderRegistrator\r\n    {\r\n        /// <exclude />\r\n        public void ConfigureServices(IServiceCollection serviceCollection)\r\n        {\r\n            serviceCollection.AddSingleton(typeof(IComponentProvider), typeof(FileBasedComponentProvider));\r\n        }\r\n    }\r\n\r\n    /// <exclude />\r\n    public class FileBasedComponentProvider : IComponentProvider\r\n    {\r\n        private const string Title = \"title\";\r\n        private const string Description = \"description\";\r\n        private const string Tags = \"tags\";\r\n        private const string ContainerClasses = \"container-classes\";\r\n        private const string Image = \"image\";\r\n        private const string Icon = \"icon\";\r\n        private const string AntiTags = \"container-anti-classes\";\r\n\r\n        private readonly ComponentChangeNotifier _changeNotifier;\r\n        private readonly string _providerDirectory;\r\n        private readonly string _searchPattern;\r\n        private readonly SearchOption _searchOption;\r\n\r\n        /// <exclude />\r\n        public FileBasedComponentProvider(ComponentChangeNotifier changeNotifier)\r\n        {\r\n            _changeNotifier = changeNotifier;\r\n\r\n            var componentProviderSetting = ComponentProviderSettings.GetProviderPath(nameof(FileBasedComponentProvider));\r\n            Verify.IsNotNull(componentProviderSetting, \"No components configuration found for the provider \" + nameof(FileBasedComponentProvider));\r\n            \r\n            _providerDirectory = componentProviderSetting.Directory;\r\n            _searchPattern = componentProviderSetting.FileSearchPattern;\r\n            _searchOption = componentProviderSetting.TopDirectoryOnly\r\n                ? SearchOption.TopDirectoryOnly\r\n                : SearchOption.AllDirectories;\r\n\r\n            Directory.CreateDirectory(PathUtil.Resolve(_providerDirectory));\r\n\r\n            FileBasedComponentObservable().Subscribe( x => _changeNotifier.ProviderChange(x.ProviderId));\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ProviderId => nameof(FileBasedComponentProvider);\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Component> GetComponents()\r\n        {\r\n            return GetAllComponents();\r\n        }\r\n\r\n        private IEnumerable<Component> GetAllComponents()\r\n        {\r\n            return C1Directory.GetFiles(\r\n                PathUtil.Resolve(_providerDirectory), _searchPattern, _searchOption)\r\n                .Select(GetComponentsFromFile).Where(f => f != null);\r\n        }\r\n\r\n        private Component GetComponentsFromFile(string componentFile)\r\n        {\r\n            XDocument document =null;\r\n\r\n            try\r\n            {\r\n                document = XDocumentUtils.Load(componentFile);\r\n            }\r\n            catch (XmlException exception)\r\n            {\r\n                Log.LogError(nameof(FileBasedComponentProvider),$\"Error in reading component file: {exception}\");\r\n                return null;\r\n            }\r\n\r\n            var xElement = document.Descendants().FirstOrDefault();\r\n\r\n            if (xElement != null)\r\n            {\r\n#warning making id based on file location, check again once function based provider come alive\r\n                var xmlBytes = new UnicodeEncoding().GetBytes(componentFile);\r\n                var hashedXmlBytes = ((HashAlgorithm)CryptoConfig.CreateFromName(\"MD5\")).ComputeHash(xmlBytes);\r\n                var id = new Guid(hashedXmlBytes);\r\n\r\n                var title = StringResourceSystemFacade.ParseString(xElement.GetAttributeValue(Namespaces.Components + Title)) ??\r\n                            Path.GetFileNameWithoutExtension(componentFile);\r\n\r\n                var description = StringResourceSystemFacade.ParseString(xElement.GetAttributeValue(Namespaces.Components + Description)) ?? \"\";\r\n\r\n                var groupingTagsRaw = StringResourceSystemFacade.ParseString(xElement.GetAttributeValue(Namespaces.Components + Tags)) ??\r\n                                        GuessGroupingTagsBasedOnPath(componentFile);\r\n\r\n                List<string> groupingTags = new List<string>();\r\n\r\n                if (!groupingTagsRaw.IsNullOrEmpty())\r\n                {\r\n                    var tagManager = ServiceLocator.GetRequiredService<TagManager>();\r\n                    groupingTags.AddRange(\r\n                        groupingTagsRaw.ToLower()\r\n                            .Split(',')\r\n                            .Select(f => f.Trim())\r\n                            .Select(tagManager.GetTagTitle)\r\n                            .ToList());\r\n                }\r\n\r\n                var containerClasses =\r\n                    ContainerClassManager.ParseToList(xElement.GetAttributeValue(Namespaces.Components + ContainerClasses));\r\n\r\n                var antiTags =\r\n                    ContainerClassManager.ParseToList(xElement.GetAttributeValue(Namespaces.Components + AntiTags));\r\n\r\n                var componentImage = new ComponentImage()\r\n                {\r\n                    CustomImageUri = xElement.GetAttributeValue(Namespaces.Components + Image),\r\n                    IconName = xElement.GetAttributeValue(Namespaces.Components + Icon)\r\n                };\r\n\r\n                xElement.Attributes().Where(f=>f.Name.Namespace == Namespaces.Components).Remove();\r\n\r\n                return new Component\r\n                {\r\n                    Id = id,\r\n                    Title = title,\r\n                    Description = description,\r\n                    GroupingTags = groupingTags,\r\n                    ContainerClasses = containerClasses,\r\n                    AntiTags = antiTags,\r\n                    ComponentImage = componentImage,\r\n                    ComponentDefinition = xElement.Document.GetDocumentAsString()\r\n                };\r\n            }\r\n\r\n            return null;\r\n\r\n        }\r\n\r\n        private string GuessGroupingTagsBasedOnPath(string componentFile)\r\n        {\r\n            var componentPath = Path.GetDirectoryName(componentFile);\r\n\r\n            var cleanedProviderDirectory = _providerDirectory.Replace('/', '\\\\').Replace(\"~\", \"\");\r\n\r\n            var componentPathfromComponentFolder =\r\n                componentPath?.Substring(\r\n                    componentPath.IndexOf(cleanedProviderDirectory,\r\n                        StringComparison.Ordinal) + cleanedProviderDirectory.Length);\r\n\r\n            return componentPathfromComponentFolder?.Replace('\\\\', ',').Trim(',');\r\n        }\r\n\r\n        private IObservable<ComponentChange> FileBasedComponentObservable()\r\n        {\r\n            var fileSystemWatcher = new FileSystemWatcher\r\n            {\r\n                Path = PathUtil.Resolve(_providerDirectory),\r\n                IncludeSubdirectories = _searchOption == SearchOption.AllDirectories,\r\n                EnableRaisingEvents = true,\r\n                Filter = _searchPattern\r\n            };\r\n\r\n            return Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(\r\n                        h => fileSystemWatcher.Deleted += h,\r\n                        h => fileSystemWatcher.Deleted -= h)\r\n                        .Select(e => new ComponentChange() { ProviderId = nameof(FileBasedComponentProvider) })\r\n                      .Merge(Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(\r\n                        h => fileSystemWatcher.Changed += h,\r\n                        h => fileSystemWatcher.Changed -= h)\r\n                        .Select(e => new ComponentChange() { ProviderId = nameof(FileBasedComponentProvider) }))\r\n                      .Merge(Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(\r\n                        h => fileSystemWatcher.Created += h,\r\n                        h => fileSystemWatcher.Created -= h)\r\n                        .Select(e => new ComponentChange() { ProviderId = nameof(FileBasedComponentProvider) }))\r\n                      .Merge(Observable.FromEventPattern<RenamedEventHandler, RenamedEventArgs>(\r\n                        h => fileSystemWatcher.Renamed += h,\r\n                        h => fileSystemWatcher.Renamed -= h)\r\n                        .Select(e => new ComponentChange() { ProviderId = nameof(FileBasedComponentProvider) }));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/Common/PropertyNameMappingConfigurationElement.cs",
    "content": "using System.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.Common\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class PropertyNameMappingConfigurationElement : ConfigurationElement\r\n    {\r\n        private const string _propertyNamePropertyName = \"propertyName\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_propertyNamePropertyName, IsRequired=true)]\r\n        public string PropertyName\r\n        {\r\n            get { return (string)base[_propertyNamePropertyName]; }\r\n            set { base[_propertyNamePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _sourcePropertyNamePropertyName = \"sourcePropertyName\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_sourcePropertyNamePropertyName, IsRequired=true)]\r\n        public string SourcePropertyName\r\n        {\r\n            get { return (string)base[_sourcePropertyNamePropertyName]; }\r\n            set { base[_sourcePropertyNamePropertyName] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/Common/PropertyNameMappingConfigurationElementCollection.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.Common\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class PropertyNameMappingConfigurationElementCollection : ConfigurationElementCollection, IEnumerable<PropertyNameMappingConfigurationElement>\r\n    {\r\n        /// <exclude />\r\n        public void Add(string propertyName, string sourcePropertyName)\r\n        {\r\n            var element = new PropertyNameMappingConfigurationElement();\r\n            element.PropertyName = propertyName;\r\n            element.SourcePropertyName = sourcePropertyName;\r\n\r\n            BaseAdd(element);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {                        \r\n            return new PropertyNameMappingConfigurationElement();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            return string.Format(\"{0}{1}\", \r\n                                 ((PropertyNameMappingConfigurationElement)element).PropertyName,\r\n                                 ((PropertyNameMappingConfigurationElement)element).SourcePropertyName);\r\n        }\r\n\r\n\r\n\r\n        IEnumerator<PropertyNameMappingConfigurationElement> IEnumerable<PropertyNameMappingConfigurationElement>.GetEnumerator()\r\n        {\r\n            return this.OfType<PropertyNameMappingConfigurationElement>().GetEnumerator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/FileSystemDataProvider/FileSystemDataProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Configuration;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Data.DataProviders.FileSystemDataProvider.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.FileSystemDataProvider\r\n{\r\n    [ConfigurationElementType(typeof(FileSystemDataProviderData))]\r\n    internal class FileSystemDataProvider : IWritableDataProvider, IFileSystemDataProvider\r\n    {\r\n        private DataProviderContext _context;\r\n\r\n        private string _resolvedRootDirectory;\r\n        private Type _fileInterfaceType;\r\n        private string _fileSearchPattern;\r\n        private SearchOption _fileSearchOptions;\r\n        private int _resolvedRootDirectoryPathLength;\r\n        private Type _fileSystemFileTypeWithInterface;\r\n\r\n        private object _lock = new object();\r\n\r\n\r\n\r\n        internal FileSystemDataProvider(string resolvedRootDirectory, Type fileInterfaceType, string fileSearchPattern, bool topDirectoryOnly)\r\n        {\r\n            if (string.IsNullOrEmpty(resolvedRootDirectory)) throw new ArgumentNullException(\"resolvedRootDirectory\");\r\n            if (fileInterfaceType == null) throw new ArgumentNullException(\"fileInterfaceType\");\r\n            if (string.IsNullOrEmpty(fileSearchPattern)) throw new ArgumentNullException(\"fileSearchPattern\");\r\n\r\n            if (typeof(IFile).IsAssignableFrom(fileInterfaceType) == false) throw new ArgumentException(string.Format(\"The interface '{0}' does not implement the interface '{1}'\", fileInterfaceType, typeof(IFile)));\r\n            if (typeof(IFile).GetPropertiesRecursively().Count < fileInterfaceType.GetPropertiesRecursively().Count) throw new ArgumentException(string.Format(\"The interface '{0}' may not have any properties\", fileInterfaceType));\r\n\r\n            resolvedRootDirectory = resolvedRootDirectory.Replace(\"/\", @\"\\\");\r\n\r\n            if (Path.IsPathRooted(resolvedRootDirectory) == false) throw new ArgumentException(\"Path must be rooted\", \"resolvedRootDirectory\");\r\n\r\n            if (resolvedRootDirectory.EndsWith(\"/\") || resolvedRootDirectory.EndsWith(@\"\\\")) resolvedRootDirectory = resolvedRootDirectory.Substring(0, resolvedRootDirectory.Length - 1);\r\n\r\n            _resolvedRootDirectory = resolvedRootDirectory;\r\n            _fileInterfaceType = fileInterfaceType;\r\n            _fileSearchPattern = fileSearchPattern;\r\n\r\n            _resolvedRootDirectoryPathLength = _resolvedRootDirectory.Length;\r\n            _fileSearchOptions = (topDirectoryOnly ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories);\r\n\r\n            _fileSystemFileTypeWithInterface = FileSystemFileGenerator.GenerateFileSystemFileWithInterface(fileInterfaceType);\r\n        }\r\n\r\n\r\n\r\n        public DataProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> GetSupportedInterfaces()\r\n        {\r\n            List<Type> supportedInterfaces = new List<Type>();\r\n\r\n            supportedInterfaces.Add(_fileInterfaceType);\r\n\r\n            return supportedInterfaces;\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<T> GetData<T>() where T : class, IData\r\n        {\r\n            CheckInterface(typeof(T));\r\n\r\n            return GetFiles<T>();\r\n        }\r\n\r\n\r\n\r\n        public T GetData<T>(IDataId dataId) where T : class, IData\r\n        {\r\n            CheckInterface(typeof(T));\r\n\r\n            FileSystemFileDataId fileSystemFileDataId = dataId as FileSystemFileDataId;\r\n\r\n            if (fileSystemFileDataId == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return BuildNewFileSystemFile<T>(fileSystemFileDataId.FullPath);\r\n        }\r\n\r\n\r\n\r\n        public void Update(IEnumerable<IData> datas)\r\n        {\r\n            foreach (IData data in datas)\r\n            {\r\n                CheckInterface(data.GetType());\r\n\r\n                FileSystemFileDataId id = (FileSystemFileDataId)data.DataSourceId.DataId;\r\n                string oldPath = id.FullPath;\r\n\r\n                FileSystemFile file = (FileSystemFile)data;\r\n\r\n                file.SystemPath = CreateSystemPath(file.Path);\r\n\r\n                FileSystemFileStreamManager.WriteFileToDisk(file);\r\n\r\n                if (file.SystemPath != oldPath)\r\n                {\r\n                    C1File.Delete(oldPath);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public List<T> AddNew<T>(IEnumerable<T> datas) where T : class, IData\r\n        {\r\n            List<T> result = new List<T>();\r\n\r\n            foreach (IData data in datas)\r\n            {\r\n                CheckInterface(data.GetType());\r\n\r\n                IFile file = (IFile)data;\r\n\r\n                string filename = CreateSystemPath( Path.Combine(file.FolderPath, file.FileName));\r\n\r\n                FileSystemFile fileSystemFile = Activator.CreateInstance(_fileSystemFileTypeWithInterface) as FileSystemFile;\r\n                fileSystemFile.SetDataSourceId(_context.CreateDataSourceId(new FileSystemFileDataId(filename), _fileInterfaceType));\r\n                fileSystemFile.FolderPath = file.FolderPath;\r\n                fileSystemFile.FileName = file.FileName;\r\n                fileSystemFile.SystemPath = filename;\r\n\r\n                using (C1StreamReader streamReader = new C1StreamReader(file.GetReadStream()))\r\n                {\r\n                    using (C1StreamWriter streamWriter = new C1StreamWriter(fileSystemFile.GetNewWriteStream()))\r\n                    {\r\n                        streamWriter.Write(streamReader.ReadToEnd());\r\n                    }\r\n                }\r\n\r\n                FileSystemFileStreamManager.WriteFileToDisk(fileSystemFile);\r\n\r\n                result.Add(fileSystemFile as T);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        public void Delete(IEnumerable<DataSourceId> dataSourceIds)\r\n        {\r\n            foreach (DataSourceId dataSourceId in dataSourceIds)\r\n            {\r\n                FileSystemFileDataId dataId = (FileSystemFileDataId)dataSourceId.DataId;\r\n\r\n                FileSystemFileStreamManager.DeleteFile(dataId.FullPath);\r\n\r\n                C1File.Delete(dataId.FullPath);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [DebuggerStepThrough]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        public bool ValidatePath<TFile>(TFile file, out string errorMessage) \r\n            where TFile: IFile\r\n        {\r\n            errorMessage = \"\";\r\n\r\n            string filename = CreateSystemPath(Path.Combine(file.FolderPath, file.FileName));\r\n\r\n            if (filename.Length > 250) return false;\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private IQueryable<T> GetFiles<T>() where T : class, IData\r\n        {\r\n            var result =\r\n                from file in C1Directory.GetFiles(_resolvedRootDirectory, _fileSearchPattern, _fileSearchOptions)\r\n                select BuildNewFileSystemFile<T>(file);\r\n\r\n            return result.AsQueryable();\r\n        }\r\n\r\n\r\n\r\n        private void CheckInterface(Type interfaceType)\r\n        {\r\n            if (_fileInterfaceType.IsAssignableFrom(interfaceType) == false) throw new ArgumentException(string.Format(\"Unexpected interface '{0}' - only '{1}' is supported\", interfaceType, _fileInterfaceType));\r\n        }\r\n\r\n\r\n\r\n        private T BuildNewFileSystemFile<T>(string fullPath) where T : class, IData\r\n        {\r\n            string localPath = fullPath.Substring(_resolvedRootDirectoryPathLength).Replace('/', '\\\\');\r\n\r\n            return BuildNewFileSystemFile<T>(_context.CreateDataSourceId(new FileSystemFileDataId(fullPath), _fileInterfaceType), localPath, fullPath);\r\n        }\r\n\r\n\r\n\r\n        private T BuildNewFileSystemFile<T>(DataSourceId dataSourceId, string localPath, string fullPath) where T : class, IData\r\n        {\r\n            FileSystemFile fileSystemFile = Activator.CreateInstance(_fileSystemFileTypeWithInterface) as FileSystemFile;\r\n            fileSystemFile.SetDataSourceId(dataSourceId);\r\n            fileSystemFile.FolderPath = Path.GetDirectoryName(localPath);\r\n            fileSystemFile.FileName = Path.GetFileName(localPath);\r\n            fileSystemFile.SystemPath = fullPath;\r\n\r\n            return fileSystemFile as T;\r\n        }\r\n\r\n\r\n\r\n        private string CreateSystemPath(string localPath)\r\n        {\r\n            localPath = localPath.Replace('/', '\\\\');\r\n            if (localPath.StartsWith(\"\\\\\") == false) throw new InvalidOperationException(string.Format(\"The path '{0}' should start with a '\\\\'\", localPath));\r\n\r\n            string lPath = localPath.Remove(0, 1);\r\n\r\n            string s = Path.Combine(_resolvedRootDirectory, lPath);\r\n\r\n            return Path.Combine(_resolvedRootDirectory, lPath);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(FileSystemDataProviderAssembler))]\r\n    internal sealed class FileSystemDataProviderData : DataProviderData\r\n    {\r\n        private const string _rootDirectoryProperty = \"rootDirectory\";\r\n        [ConfigurationProperty(_rootDirectoryProperty, IsRequired = true)]\r\n        public string RootDirectory\r\n        {\r\n            get { return (string)base[_rootDirectoryProperty]; }\r\n            set { base[_rootDirectoryProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _fileSearchPatternProperty = \"fileSearchPattern\";\r\n        [ConfigurationProperty(_fileSearchPatternProperty, IsRequired = false, DefaultValue = \"*\")]\r\n        public string FileSearchPattern\r\n        {\r\n            get { return (string)base[_fileSearchPatternProperty]; }\r\n            set { base[_fileSearchPatternProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _topDirectoryOnlyProperty = \"topDirectoryOnly\";\r\n        [ConfigurationProperty(_topDirectoryOnlyProperty, IsRequired = false, DefaultValue = false)]\r\n        public bool TopDirectoryOnly\r\n        {\r\n            get { return (bool)base[_topDirectoryOnlyProperty]; }\r\n            set { base[_topDirectoryOnlyProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _fileInterfaceTypeProperty = \"fileInterfaceType\";\r\n        [ConfigurationProperty(_fileInterfaceTypeProperty, IsRequired = false, DefaultValue = typeof(IFile))]\r\n        [TypeConverter(typeof(TypeManagerTypeNameConverter))]\r\n        public Type FileInterfaceType\r\n        {\r\n            get { return (Type)base[_fileInterfaceTypeProperty]; }\r\n            set { base[_fileInterfaceTypeProperty] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class FileSystemDataProviderAssembler : IAssembler<IDataProvider, DataProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IDataProvider Assemble(IBuilderContext context, DataProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            FileSystemDataProviderData configuration = objectConfiguration as FileSystemDataProviderData;\r\n\r\n            if (configuration == null) throw new ArgumentException(\"Expected configuration to be of type FileSystemDataProviderData\", \"objectConfiguration\");\r\n\r\n            string resolvedRootDirectory = PathUtil.Resolve(configuration.RootDirectory);\r\n\r\n            if (typeof(IFile).IsAssignableFrom(configuration.FileInterfaceType) == false)\r\n            {\r\n                string invalidInterfaceSelectionMsg = string.Format(\"The supplied fileInterfaceType '{0}' does not implement '{1}'\", configuration.FileInterfaceType, typeof(IFile));\r\n                throw new ConfigurationErrorsException(invalidInterfaceSelectionMsg, configuration.ElementInformation.Source, configuration.ElementInformation.LineNumber);\r\n            }\r\n\r\n            if (string.IsNullOrEmpty(configuration.FileSearchPattern))\r\n            {\r\n                string invalidFileSearchPatternMsg = \"The file search pattern can not be empty. Use '*' for all files.\";\r\n                throw new ConfigurationErrorsException(invalidFileSearchPatternMsg, configuration.ElementInformation.Source, configuration.ElementInformation.LineNumber);\r\n            }\r\n\r\n            return new FileSystemDataProvider(resolvedRootDirectory, configuration.FileInterfaceType, configuration.FileSearchPattern, configuration.TopDirectoryOnly);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/FileSystemDataProvider/Foundation/FileSystemFile.cs",
    "content": "using Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Streams;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.FileSystemDataProvider.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [FileStreamManager(typeof(FileSystemFileStreamManager))]\r\n    public abstract class FileSystemFile : FileSystemFileBase, IFile\r\n    {\r\n        private DataSourceId _dataSourceId;\r\n\r\n\r\n        /// <exclude />\r\n        public FileSystemFile()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataSourceId DataSourceId\r\n        {\r\n            get { return _dataSourceId; }\r\n            set { _dataSourceId = value; }\r\n        }\r\n\r\n        internal void SetDataSourceId(DataSourceId dataSourceId)\r\n        {\r\n            _dataSourceId = dataSourceId;\r\n        }\r\n\r\n\r\n        internal string Path \r\n        {\r\n            get\r\n            {\r\n                return System.IO.Path.Combine(this.FolderPath, this.FileName);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string FolderPath { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string FileName { get; set; }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/FileSystemDataProvider/Foundation/FileSystemFileDataId.cs",
    "content": "﻿using System;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.FileSystemDataProvider.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class FileSystemFileDataId : IDataId\r\n    {\r\n        private string _fullPath;\r\n\r\n\r\n        /// <exclude />\r\n        public FileSystemFileDataId() {}\r\n\r\n\r\n        internal FileSystemFileDataId(string fullPath)\r\n        {\r\n            _fullPath = fullPath;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string FullPath\r\n        {\r\n            get \r\n            {\r\n                if (string.IsNullOrEmpty(_fullPath)) throw new InvalidOperationException(\"RelativePath has not been initialized or has an invalid value\");\r\n                return _fullPath; \r\n            }\r\n            set { _fullPath = value; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode() => _fullPath.GetHashCode();\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj) => obj is FileSystemFileDataId dataId && dataId.FullPath == _fullPath;\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/FileSystemDataProvider/Foundation/FileSystemFileGenerator.cs",
    "content": "﻿using System;\r\nusing System.Reflection;\r\nusing System.Reflection.Emit;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.FileSystemDataProvider.Foundation\r\n{\r\n    internal static class FileSystemFileGenerator\r\n    {\r\n        internal static Type GenerateFileSystemFileWithInterface(Type interfaceType)\r\n        {\r\n            var asm = new AssemblyName(typeof(FileSystemFileGenerator).Name);\r\n\r\n            AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(asm, AssemblyBuilderAccess.Run);\r\n            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(\"MainModule\");\r\n\r\n            var typeSignature = typeof (FileSystemFileGenerator).Namespace + \".Generated.\" + interfaceType.FullName.Replace(\".\", \"_\");\r\n\r\n            TypeBuilder tb = moduleBuilder.DefineType(typeSignature,\r\n                TypeAttributes.Public |\r\n                TypeAttributes.Class |\r\n                TypeAttributes.AutoClass |\r\n                TypeAttributes.AnsiClass |\r\n                TypeAttributes.BeforeFieldInit |\r\n                TypeAttributes.AutoLayout,\r\n                typeof(FileSystemFile),\r\n                new [] { interfaceType });\r\n\r\n            return tb.CreateType();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/FileSystemMediaFileProvider/FileSystemMediaFile.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Streams;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.FileSystemMediaFileProvider\r\n{\r\n    [FileStreamManager(typeof(FileSystemFileStreamManager))]\r\n    internal sealed class FileSystemMediaFile : FileSystemFileBase, IMediaFile\r\n    {\r\n        public FileSystemMediaFile(string systemPath, string fileName, string folderName, string storeId, DataSourceId dataSourceId)\r\n        {\r\n            Id = CalculateId(folderName, fileName);\r\n            SystemPath = systemPath;\r\n            FileName = fileName;\r\n            FolderPath = folderName;\r\n            StoreId = storeId;\r\n            DataSourceId = dataSourceId;\r\n        }\r\n\r\n        private static Guid CalculateId(string folderName, string fileName)\r\n        {\r\n            return GetHashValue(folderName + \"/\" + fileName);\r\n        }\r\n\r\n        private static Guid GetHashValue(string value)\r\n        {\r\n            return HashingHelper.ComputeMD5Hash(value, Encoding.ASCII);\r\n        }\r\n\r\n\r\n        public Guid Id\r\n        {\r\n            get; internal set;\r\n        }\r\n\r\n        public string KeyPath\r\n        {\r\n            get { return this.GetKeyPath();  }\r\n        }\r\n\r\n\r\n        public string CompositePath\r\n        {\r\n            get { return this.GetCompositePath(); }\r\n            set { throw new NotImplementedException(); }\r\n        }\r\n\r\n\r\n        public string StoreId\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        \r\n        public string Title\r\n        {\r\n            get\r\n            {\r\n                return this.FileName;\r\n            }\r\n            set\r\n            {\r\n                this.FileName = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string Description\r\n        {\r\n            get\r\n            {\r\n                return \"\";\r\n            }\r\n            set\r\n            {\r\n            }\r\n        }\r\n\r\n        public string Tags\r\n        {\r\n            get\r\n            {\r\n                return \"\";\r\n            }\r\n            set\r\n            {\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string Culture\r\n        {\r\n            get\r\n            {\r\n                return CultureInfo.InvariantCulture.Name;\r\n            }\r\n            set\r\n            {\r\n                ;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string MimeType\r\n        {\r\n            get { return MimeTypeInfo.GetCanonicalFromExtension(Path.GetExtension(this.FileName)); }\r\n        }\r\n\r\n\r\n\r\n\r\n        public int? Length\r\n        {\r\n            get \r\n            {\r\n                C1FileInfo fileInfo = new C1FileInfo(this.SystemPath);\r\n\r\n                return (int)fileInfo.Length;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public DateTime? CreationTime\r\n        {\r\n            get \r\n            {\r\n                return C1File.GetCreationTime(this.SystemPath);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public DateTime? LastWriteTime\r\n        {\r\n            get \r\n            {\r\n                return C1File.GetLastWriteTime(this.SystemPath);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool IsReadOnly\r\n        {\r\n            get\r\n            {\r\n                return (C1File.GetAttributes(this.SystemPath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly;\r\n            }\r\n            set\r\n            {\r\n                ;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string FolderPath\r\n        {\r\n            get; \r\n            set;\r\n        }\r\n\r\n\r\n\r\n        public string FileName\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        public DataSourceId DataSourceId\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/FileSystemMediaFileProvider/FileSystemMediaFileFolder.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.FileSystemMediaFileProvider\r\n{\r\n\tinternal sealed class FileSystemMediaFileFolder : IMediaFileFolder\r\n\t{\r\n        private string _path;\r\n        private string _storeId;\r\n        private readonly DataSourceId _dataSourceId;\r\n\r\n        public FileSystemMediaFileFolder(string path, string storeId, DataSourceId dataSourceId)\r\n        {\r\n            Id = Guid.NewGuid();\r\n            _path = path;\r\n            _storeId = storeId;\r\n            _dataSourceId = dataSourceId;\r\n            IsReadOnly = false;\r\n        }\r\n\r\n\t    public Guid Id\r\n\t    {\r\n\t        get; private set;\r\n        }\r\n\r\n        public string KeyPath\r\n        {\r\n            get { return this.GetKeyPath(); }\r\n        }\r\n\r\n\r\n        public string CompositePath\r\n        {\r\n            get { return this.GetCompositePath(); }\r\n            set { throw new NotImplementedException(); }\r\n        }\r\n\r\n\r\n        public string StoreId\r\n        {\r\n            get\r\n            {\r\n                return _storeId;\r\n            }\r\n            set\r\n            {\r\n                _storeId = value; ;\r\n            }\r\n        }\r\n\r\n        public string Path\r\n        {\r\n            get\r\n            {\r\n                return _path;\r\n            }\r\n            set\r\n            {\r\n                _path = value;\r\n            }\r\n        }\r\n\r\n        public string Title\r\n        {\r\n            get\r\n            {\r\n                return \"\";\r\n            }\r\n            set\r\n            {\r\n                ;\r\n            }\r\n        }\r\n\r\n        public string Description\r\n        {\r\n            get\r\n            {\r\n                return \"\";\r\n            }\r\n            set\r\n            {\r\n                ;\r\n            }\r\n        }\r\n\r\n        public bool IsReadOnly\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        public DataSourceId DataSourceId\r\n        {\r\n            get { return _dataSourceId; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/FileSystemMediaFileProvider/FileSystemMediaFileProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.FileSystemMediaFileProvider\r\n{\r\n    [ConfigurationElementType(typeof(MediaArchiveDataProviderData))]\r\n    internal sealed class FileSystemMediaFileProvider : IWritableDataProvider\r\n    {\r\n        private readonly string _storeId;\r\n        private readonly string _storeDescription;\r\n        private readonly string _storeTitle;\r\n        private readonly string _rootDir;\r\n        private readonly string[] _excludedDirs;\r\n        private MediaArchiveStore _store;\r\n        private DataProviderContext _context;\r\n        private static readonly int _folderType = 1;\r\n        private static readonly int _fileType = 2;\r\n        private static readonly int _storeType = 3;\r\n\r\n        public FileSystemMediaFileProvider(string rootDir, string[] excludedDirs, string storeId, string storeDesc, string storeTitle)\r\n        {\r\n            _rootDir = rootDir;\r\n            _excludedDirs = excludedDirs;\r\n            _storeId = storeId;\r\n            _storeDescription = storeDesc;\r\n            _storeTitle = storeTitle;\r\n        }\r\n\r\n\r\n\r\n        private IMediaFileStore Store\r\n        {\r\n            get\r\n            {\r\n                if (_store == null)\r\n                {\r\n                    _store = new MediaArchiveStore(_storeId, _storeTitle, _storeDescription, \r\n                        _context.CreateDataSourceId(new MediaDataId(_storeType), typeof(IMediaFileStore)));\r\n                }\r\n                return _store;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public DataProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> GetSupportedInterfaces()\r\n        {\r\n            return new List<Type> { typeof(IMediaFile), typeof(IMediaFileFolder), typeof(IMediaFileStore) };\r\n        }\r\n\r\n\r\n\r\n        public void Update(IEnumerable<IData> datas)\r\n        {\r\n            foreach (IData data in datas)\r\n            {\r\n                if (data == null)\r\n                {\r\n                    throw new ArgumentException(\"Data in list to update must be non-null\");\r\n                }\r\n            }\r\n\r\n            foreach (IData data in datas)\r\n            {\r\n                MediaDataId dataId = data.DataSourceId.DataId as MediaDataId;\r\n                if (dataId == null)\r\n                {\r\n                    throw new ArgumentException(\"Invalid IData\");\r\n                }\r\n\r\n                if (dataId.MediaType == _fileType)\r\n                {\r\n                    IMediaFile updatedFile = (IMediaFile)data;\r\n\r\n                    if (updatedFile.StoreId != this.Store.Id)\r\n                    {\r\n                        continue;\r\n                    }\r\n                    if (updatedFile.IsReadOnly)\r\n                    {\r\n                        throw new ArgumentException(\"Cannot update read only media file \" + dataId.FileName);\r\n                    }\r\n\r\n                    if (updatedFile.FileName != dataId.FileName || updatedFile.FolderPath != dataId.Path)\r\n                    {\r\n                        string oldPos = GetAbsolutePath(dataId);\r\n                        string newPos = GetAbsolutePath(updatedFile);\r\n                        C1File.Move(oldPos, newPos);                        \r\n                    }\r\n\r\n                    using (Stream readStream = updatedFile.GetReadStream())\r\n                    {\r\n                        using (Stream writeStream = C1File.Open(GetAbsolutePath(updatedFile), FileMode.Create))\r\n                        {\r\n                            readStream.CopyTo(writeStream);\r\n                        }\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    IMediaFileFolder updatedFolder = (IMediaFileFolder)data;\r\n                    if (updatedFolder.StoreId != this.Store.Id)\r\n                    {\r\n                        continue;\r\n                    }\r\n                    if (updatedFolder.IsReadOnly)\r\n                    {\r\n                        throw new ArgumentException(\"Cannot update read only media folder \" + dataId.Path);\r\n                    }\r\n                    C1Directory.Move(GetAbsolutePath(dataId), GetAbsolutePath(updatedFolder));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public List<T> AddNew<T>(IEnumerable<T> datas) where T : class, IData\r\n        {\r\n            var result = new List<T>();\r\n\r\n            foreach (IData data in datas)\r\n            {\r\n                if (data == null)\r\n                {\r\n                    throw new ArgumentException(\"Data in list to add must be non-null\");\r\n                }\r\n                CheckInterface(typeof(T));\r\n            }\r\n\r\n            foreach (IData data in datas)\r\n            {\r\n                if (typeof(T) == typeof(IMediaFile))\r\n                {\r\n                    IMediaFile file = (IMediaFile) data;\r\n                    string fullPath = Path.Combine(Path.Combine(_rootDir, file.FolderPath.Remove(0, 1)), file.FileName);\r\n\r\n                    using (Stream readStream = file.GetReadStream())\r\n                    {\r\n                        using (Stream writeStream = C1File.Open(fullPath, FileMode.CreateNew))\r\n                        {\r\n                            readStream.CopyTo(writeStream);\r\n                        }\r\n                    }\r\n                    \r\n                    result.Add(CreateFile(fullPath) as T);\r\n                }\r\n                else if (typeof(T) == typeof(IMediaFileFolder))\r\n                {\r\n                    IMediaFileFolder folder = (IMediaFileFolder)data;\r\n                    string fullPath = Path.Combine(_rootDir, folder.Path.Remove(0, 1));\r\n\r\n                    C1Directory.CreateDirectory(fullPath);\r\n                    result.Add(CreateFolder(fullPath) as T);\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        public void Delete(IEnumerable<DataSourceId> dataSourceIds)\r\n        {\r\n            foreach (DataSourceId dataSourceId in dataSourceIds)\r\n            {\r\n                if (dataSourceId == null)\r\n                {\r\n                    throw new ArgumentException(\"DataSourceIds must me non-null\");\r\n                }\r\n            }\r\n\r\n            foreach (DataSourceId dataSourceId in dataSourceIds)\r\n            {\r\n                MediaDataId dataId = dataSourceId.DataId as MediaDataId;\r\n                \r\n                if (dataId.MediaType == _fileType)\r\n                {\r\n                    if(IsReadOnlyFolder(dataId.Path))\r\n                    {\r\n                        throw new ArgumentException(\"Cannot delete read only file \" + dataId.FileName);\r\n                    }\r\n                    C1File.Delete(GetAbsolutePath(dataId));\r\n                }\r\n                else\r\n                {\r\n                    if (IsReadOnlyFolder(dataId.Path))\r\n                    {\r\n                        throw new ArgumentException(\"Cannot delete read only folder \" + dataId.Path);\r\n                    }\r\n                    C1Directory.Delete(GetAbsolutePath(dataId), true);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<T> GetData<T>() where T : class, IData\r\n        {\r\n            CheckInterface(typeof(T));\r\n\r\n            if (typeof(T) == typeof(IMediaFile))\r\n            {\r\n                var excludePaths =\r\n                    (from dir in _excludedDirs\r\n                     select PathUtil.Resolve(_rootDir + dir.Replace('/', '\\\\')) + @\"\\\").ToList();\r\n\r\n                var matches =\r\n                    from filePath in C1Directory.GetFiles( _rootDir, \"*\", SearchOption.AllDirectories)\r\n                    where !excludePaths.Where( filePath.StartsWith ).Any()\r\n                    select CreateFile( filePath );\r\n\r\n                return matches.Cast<T>().AsQueryable();\r\n            }\r\n\r\n            if (typeof(T) == typeof(IMediaFileFolder))\r\n            {\r\n                var excludePaths =\r\n                    (from dir in _excludedDirs\r\n                     select PathUtil.Resolve(_rootDir + dir.Replace('/','\\\\')) + @\"\\\").ToList();\r\n\r\n                var matches =\r\n                    from dirPath in C1Directory.GetDirectories(_rootDir, \"*\", SearchOption.AllDirectories)\r\n                    where !excludePaths.Any(f => (dirPath + @\"\\\").StartsWith(f))\r\n                    select CreateFolder(dirPath);\r\n\r\n                return matches.Cast<T>().AsQueryable();\r\n            }\r\n\r\n            return new List<T> { Store as T}.AsQueryable<T>();\r\n        }\r\n\r\n\r\n\r\n        public T GetData<T>(IDataId dataId) where T : class, IData\r\n        {\r\n            if (dataId == null)\r\n            {\r\n                throw new ArgumentNullException(\"dataId\");\r\n            }\r\n            CheckInterface(typeof(T));\r\n            MediaDataId mediaDataId = dataId as MediaDataId;\r\n            if (mediaDataId == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (mediaDataId.MediaType == _folderType)\r\n            {\r\n                if (typeof(T) != typeof(IMediaFileFolder))\r\n                {\r\n                    throw new ArgumentException(\"The dataId specifies a IMediaFileFolder, but the generic method was invoked with different type\");\r\n                }\r\n\r\n                FileSystemMediaFileFolder folder = (from dirInfo in C1Directory.GetDirectories(_rootDir, \"*\", SearchOption.AllDirectories)\r\n                                                    where GetRelativePath(dirInfo) == mediaDataId.Path\r\n                                                    select CreateFolder(dirInfo)).FirstOrDefault();\r\n                return folder as T;\r\n            }\r\n\r\n            if (mediaDataId.MediaType == _fileType)\r\n            {\r\n                if (typeof(T) != typeof(IMediaFile))\r\n                {\r\n                    throw new ArgumentException(\"The dataId specifies a IMediaFile, but the generic method was invoked with different type\");\r\n                }\r\n\r\n                FileSystemMediaFile file = (from fileInfo in C1Directory.GetFiles(_rootDir, \"*\", SearchOption.AllDirectories)\r\n                                            where GetRelativePath(Path.GetDirectoryName(fileInfo)) == mediaDataId.Path && Path.GetFileName(fileInfo) == mediaDataId.FileName\r\n                                            select CreateFile(fileInfo)).FirstOrDefault();\r\n\r\n                return file as T;\r\n            }\r\n\r\n            return Store as T;\r\n        }\r\n\r\n\r\n\r\n        internal sealed class MediaDataId : IDataId\r\n        {\r\n            public MediaDataId(int type, string path = null, string fileName = null)\r\n            {\r\n                MediaType = type;\r\n                Path = path;\r\n                FileName = fileName;\r\n            }\r\n\r\n            public int MediaType { get; }\r\n            public string Path { get; }\r\n            public string FileName { get; }\r\n\r\n            public override int GetHashCode() => MediaType ^ (Path ?? \"\").GetHashCode() ^ (FileName ?? \"\").GetHashCode();\r\n        }\r\n\r\n\r\n\r\n        private string GetAbsolutePath(IMediaFile file)\r\n        {\r\n            return Path.Combine(Path.Combine(_rootDir, file.FolderPath.Remove(0, 1)), file.FileName);\r\n        }\r\n\r\n\r\n\r\n        private string GetAbsolutePath(IMediaFileFolder folder)\r\n        {\r\n            return Path.Combine(_rootDir, folder.Path.Remove(0, 1));\r\n        }\r\n\r\n\r\n\r\n        private string GetAbsolutePath(MediaDataId mediaData)\r\n        {\r\n            string folderPath = Path.Combine(_rootDir, mediaData.Path.Remove(0, 1));\r\n\r\n            if (mediaData.MediaType == _fileType)\r\n            {\r\n                return Path.Combine(folderPath, mediaData.FileName);\r\n            }\r\n\r\n            return folderPath;\r\n        }\r\n        \r\n        \r\n        \r\n        private bool IsReadOnlyFolder(string folder)\r\n        {\r\n            var folders = from item in _excludedDirs\r\n                          where folder == item || (item.StartsWith(folder) && item[folder.Length] == '/')\r\n                          select item;\r\n            return folders.Any();\r\n        }\r\n\r\n\r\n\r\n        private bool IsExcludedFolder(string folder)\r\n        {\r\n            var folders = from item in _excludedDirs\r\n                          where folder == item || (folder.StartsWith(item) && folder[item.Length] == '/')\r\n                          select item;\r\n            return folders.Any();\r\n        }\r\n\r\n\r\n\r\n        private string GetRelativePath(string path)\r\n        {\r\n            string result = path.Substring(_rootDir.Length).Replace(\"\\\\\", @\"/\");\r\n            return result == string.Empty ? \"/\" : result;\r\n        }\r\n\r\n\r\n\r\n        private FileSystemMediaFileFolder CreateFolder(string dir)\r\n        {\r\n            string relativeDir = GetRelativePath(dir);\r\n            var folder = new FileSystemMediaFileFolder(relativeDir, Store.Id,\r\n                _context.CreateDataSourceId(new MediaDataId(_folderType, relativeDir), typeof(IMediaFileFolder)));\r\n            folder.IsReadOnly = IsReadOnlyFolder(folder.Path);\r\n            return folder;\r\n        }\r\n\r\n\r\n        private FileSystemMediaFile CreateFile(string filePath)\r\n        {\r\n            string relativeDir = GetRelativePath(Path.GetDirectoryName(filePath));\r\n            string fileName = Path.GetFileName(filePath);\r\n\r\n            DataSourceId dataSourceId = _context.CreateDataSourceId(new MediaDataId (_fileType , relativeDir, fileName), typeof(IMediaFile));\r\n            return new FileSystemMediaFile(filePath, fileName, relativeDir, this.Store.Id, dataSourceId);\r\n        }\r\n\r\n\r\n\r\n        private void CheckInterface(Type interfaceType)\r\n        {\r\n            if (!typeof(IMediaFile).IsAssignableFrom(interfaceType) &&\r\n                !typeof(IMediaFileFolder).IsAssignableFrom(interfaceType) &&\r\n                !typeof(IMediaFileStore).IsAssignableFrom(interfaceType))\r\n            {\r\n                throw new ArgumentException($\"Unexpected interface '{interfaceType}' - only '{typeof(IMediaFile)}, {typeof(IMediaFileFolder)} and {typeof(IMediaFileStore)}' are supported\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private sealed class MediaArchiveStore : IMediaFileStore\r\n        {\r\n            public MediaArchiveStore(string id, string title, string description, DataSourceId dataSourceId)\r\n            {\r\n                Id = id;\r\n                Title = title;\r\n                Description = description;\r\n                DataSourceId = dataSourceId;\r\n            }\r\n\r\n            public string Id { get; }\r\n\r\n            public string Title { get; }\r\n\r\n            public string Description { get; }\r\n\r\n            //public string Tags { get; set; }\r\n\r\n            public bool IsReadOnly => false;\r\n\r\n            public bool ProvidesMetadata => false;\r\n\r\n            public DataSourceId DataSourceId { get; }\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(FileSystemMediaFileProviderAssembler))]\r\n    internal sealed class MediaArchiveDataProviderData : DataProviderData\r\n    {\r\n        private const string _rootDirectoryProperty = \"rootDirectory\";\r\n        [ConfigurationProperty(_rootDirectoryProperty, IsRequired = true)]\r\n        public string RootDirectory\r\n        {\r\n            get { return (string)base[_rootDirectoryProperty]; }\r\n            set { base[_rootDirectoryProperty] = value; }\r\n        }\r\n        \r\n        \r\n        \r\n        private const string _excludedDirectoriesProperty = \"excludedDirectories\";\r\n        [ConfigurationProperty(_excludedDirectoriesProperty, IsRequired = true)]\r\n        public string ExcludedDirectories\r\n        {\r\n            get { return (string)base[_excludedDirectoriesProperty]; }\r\n            set { base[_excludedDirectoriesProperty] = value; }\r\n        }\r\n\r\n        \r\n        \r\n        private const string _storeIdProperty = \"storeId\";\r\n        [ConfigurationProperty(_storeIdProperty, IsRequired = true)]\r\n        public string StoreId\r\n        {\r\n            get { return (string)base[_storeIdProperty]; }\r\n            set { base[_storeIdProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _storeDescriptionProperty = \"storeDescription\";\r\n        [ConfigurationProperty(_storeDescriptionProperty, IsRequired = true)]\r\n        public string StoreDescription\r\n        {\r\n            get { return (string)base[_storeDescriptionProperty]; }\r\n            set { base[_storeDescriptionProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _storeTitleProperty = \"storeTitle\";\r\n        [ConfigurationProperty(_storeTitleProperty, IsRequired = true)]\r\n        public string StoreTitle\r\n        {\r\n            get { return (string)base[_storeTitleProperty]; }\r\n            set { base[_storeTitleProperty] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class FileSystemMediaFileProviderAssembler : IAssembler<IDataProvider, DataProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IDataProvider Assemble(IBuilderContext context, DataProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            MediaArchiveDataProviderData configuration = objectConfiguration as MediaArchiveDataProviderData;\r\n\r\n            if (configuration == null) throw new ArgumentException(\"Expected configuration to be of type MediaFileDataProviderData\", \"objectConfiguration\");\r\n\r\n            string resolvedRootDirectory = PathUtil.Resolve(configuration.RootDirectory);\r\n            if (!C1Directory.Exists(resolvedRootDirectory))\r\n            {\r\n                string directoryNotFoundMsg = $\"Directory '{configuration.RootDirectory}' not found\";\r\n                throw new ConfigurationErrorsException(directoryNotFoundMsg, configuration.ElementInformation.Source, configuration.ElementInformation.LineNumber);\r\n            }\r\n            if (resolvedRootDirectory.EndsWith(\"\\\\\"))\r\n            {\r\n                resolvedRootDirectory = Path.GetDirectoryName(resolvedRootDirectory);\r\n            }\r\n\r\n            string[] excludedDirs;\r\n            if (configuration.ExcludedDirectories == null)\r\n            {\r\n                excludedDirs = Array.Empty<string>();\r\n            }\r\n            else\r\n            {\r\n                excludedDirs = configuration.ExcludedDirectories.Split(';');\r\n            }\r\n\r\n            return new FileSystemMediaFileProvider(resolvedRootDirectory, excludedDirs, configuration.StoreId, configuration.StoreDescription, configuration.StoreTitle);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/DataContextAssembler.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Data.Linq;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Reflection.Emit;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal static class DataContextAssembler\r\n    {\r\n        private static int VersionNumber;\r\n\r\n        public static Type EmitDataContextClass(IEnumerable<SqlDataProvider.StoreTypeInfo> fields)\r\n        {\r\n            return EmitDataContextClass(fields.Select(f => new Tuple<string, Type>(f.FieldName, f.FieldType)));\r\n        }\r\n\r\n        public static Type EmitDataContextClass(IEnumerable<Tuple<string, Type>> fields)\r\n        {\r\n            var aName = new AssemblyName(\"SqlDataProvider.DataContext\");\r\n            var appDomain = System.Threading.Thread.GetDomain();\r\n            var aBuilder = appDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.Run);\r\n            var module = aBuilder.DefineDynamicModule(aName.Name);\r\n\r\n            TypeBuilder type = module.DefineType(\"DynamicDataContext\" + (VersionNumber++), \r\n                TypeAttributes.Public, typeof(DataContextBase), new []{ typeof(ISqlDataContext) } );\r\n\r\n            FieldInfo helperClassFieldInfo = BuildField_sqlDataContextHelperClass(type);\r\n\r\n            BuildConstructor(type, helperClassFieldInfo);\r\n            BuildMethod_Add(type, helperClassFieldInfo);\r\n            BuildMethod_Remove(type, helperClassFieldInfo);\r\n\r\n            foreach (var field in fields)\r\n            {\r\n                type.DefineField(field.Item1, field.Item2, FieldAttributes.Public);\r\n            }\r\n\r\n            return type.CreateType();\r\n        }\r\n\r\n        private static ConstructorInfo BuildConstructor(TypeBuilder type, FieldInfo helperClassFieldInfo)\r\n        {\r\n            // Declaring method builder\r\n            // Method attributes\r\n            ConstructorBuilder method = type.DefineConstructor(MethodAttributes.Public, 0, new[] { typeof(IDbConnection) });\r\n            // Preparing Reflection instances\r\n            ConstructorInfo ctor1 = typeof(DebuggerNonUserCodeAttribute).GetConstructor(\r\n                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,\r\n                null,\r\n                new Type[]{\r\n            },\r\n                null\r\n                );\r\n            ConstructorInfo ctor2 = typeof(DataContextBase).GetConstructor(\r\n                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,\r\n                null,\r\n                new Type[]{\r\n            typeof(IDbConnection)\r\n            },\r\n                null\r\n                );\r\n            ConstructorInfo ctor3 = typeof(SqlDataContextHelperClass).GetConstructor(\r\n                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,\r\n                null,\r\n                new Type[]{\r\n            typeof(DataContext)\r\n            },\r\n                null\r\n                );\r\n            FieldInfo field4 = helperClassFieldInfo;\r\n            // Adding custom attributes to method\r\n            // [DebuggerNonUserCodeAttribute]\r\n            method.SetCustomAttribute(\r\n                new CustomAttributeBuilder(\r\n                    ctor1,\r\n                    new Type[] { }\r\n                    )\r\n                );\r\n            // Parameter connection\r\n            //ParameterBuilder connection = method.DefineParameter(0, ParameterAttributes.None, \"connection\");\r\n            ILGenerator gen = method.GetILGenerator();\r\n            // Writing body\r\n            gen.Emit(OpCodes.Ldarg_0);\r\n            gen.Emit(OpCodes.Ldarg_1);\r\n            gen.Emit(OpCodes.Call, ctor2);\r\n            gen.Emit(OpCodes.Ldarg_0);\r\n            gen.Emit(OpCodes.Ldarg_0);\r\n            gen.Emit(OpCodes.Newobj, ctor3);\r\n            gen.Emit(OpCodes.Stfld, field4);\r\n            gen.Emit(OpCodes.Ret);\r\n            // finished\r\n            return method;\r\n        }\r\n\r\n\r\n        private static FieldBuilder BuildField_sqlDataContextHelperClass(TypeBuilder type)\r\n        {\r\n            FieldBuilder field = type.DefineField(\r\n                \"_sqlDataContextHelperClass\",\r\n                typeof(SqlDataContextHelperClass),\r\n                  FieldAttributes.Private\r\n                );\r\n            return field;\r\n        }\r\n\r\n        private static MethodBuilder BuildMethod_Add(TypeBuilder type, FieldInfo helperClassFieldInfo)\r\n        {\r\n            // Declaring method builder\r\n            // Method attributes\r\n            System.Reflection.MethodAttributes methodAttributes =\r\n                  System.Reflection.MethodAttributes.Public\r\n                | System.Reflection.MethodAttributes.Virtual\r\n                | System.Reflection.MethodAttributes.Final\r\n                | System.Reflection.MethodAttributes.HideBySig\r\n                | System.Reflection.MethodAttributes.NewSlot;\r\n            MethodBuilder method = type.DefineMethod(\"Add\", methodAttributes);\r\n            // Preparing Reflection instances\r\n            FieldInfo field1 = helperClassFieldInfo;\r\n            MethodInfo method2 = typeof(SqlDataContextHelperClass).GetMethod(\r\n                \"Add\",\r\n                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,\r\n                null,\r\n                new Type[]{\r\n            typeof(Object),\r\n            typeof(String)\r\n            },\r\n                null\r\n                );\r\n            // Setting return type\r\n            method.SetReturnType(typeof(void));\r\n            // Adding parameters\r\n            method.SetParameters(\r\n                typeof(Object),\r\n                typeof(String)\r\n                );\r\n            // Parameter entity\r\n            ParameterBuilder entity = method.DefineParameter(1, ParameterAttributes.None, \"entity\");\r\n            // Parameter fieldName\r\n            ParameterBuilder fieldName = method.DefineParameter(2, ParameterAttributes.None, \"fieldName\");\r\n            ILGenerator gen = method.GetILGenerator();\r\n            // Writing body\r\n            gen.Emit(OpCodes.Ldarg_0);\r\n            gen.Emit(OpCodes.Ldfld, field1);\r\n            gen.Emit(OpCodes.Ldarg_1);\r\n            gen.Emit(OpCodes.Ldarg_2);\r\n            gen.Emit(OpCodes.Callvirt, method2);\r\n            gen.Emit(OpCodes.Ret);\r\n            // finished\r\n            return method;\r\n        }\r\n\r\n        private static MethodBuilder BuildMethod_Remove(TypeBuilder type, FieldInfo helperClassFieldInfo)\r\n        {\r\n            // Declaring method builder\r\n            // Method attributes\r\n            System.Reflection.MethodAttributes methodAttributes =\r\n                  System.Reflection.MethodAttributes.Public\r\n                | System.Reflection.MethodAttributes.Virtual\r\n                | System.Reflection.MethodAttributes.Final\r\n                | System.Reflection.MethodAttributes.HideBySig\r\n                | System.Reflection.MethodAttributes.NewSlot;\r\n            MethodBuilder method = type.DefineMethod(\"Remove\", methodAttributes);\r\n            // Preparing Reflection instances\r\n            FieldInfo field1 = helperClassFieldInfo;\r\n            MethodInfo method2 = typeof(SqlDataContextHelperClass).GetMethod(\r\n                \"Remove\",\r\n                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,\r\n                null,\r\n                new Type[]{\r\n            typeof(Object),\r\n            typeof(String)\r\n            },\r\n                null\r\n                );\r\n            // Setting return type\r\n            method.SetReturnType(typeof(void));\r\n            // Adding parameters\r\n            method.SetParameters(\r\n                typeof(Object),\r\n                typeof(String)\r\n                );\r\n            // Parameter entity\r\n            ParameterBuilder entity = method.DefineParameter(1, ParameterAttributes.None, \"entity\");\r\n            // Parameter fieldName\r\n            ParameterBuilder fieldName = method.DefineParameter(2, ParameterAttributes.None, \"fieldName\");\r\n            ILGenerator gen = method.GetILGenerator();\r\n            // Writing body\r\n            gen.Emit(OpCodes.Ldarg_0);\r\n            gen.Emit(OpCodes.Ldfld, field1);\r\n            gen.Emit(OpCodes.Ldarg_1);\r\n            gen.Emit(OpCodes.Ldarg_2);\r\n            gen.Emit(OpCodes.Callvirt, method2);\r\n            gen.Emit(OpCodes.Ret);\r\n            // finished\r\n            return method;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/DataContextBase.cs",
    "content": "﻿using System;\r\nusing System.Data;\r\nusing System.Data.Linq;\r\nusing System.Diagnostics;\r\nusing System.Data.Linq.Mapping;\r\nusing System.Reflection;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public class DataContextBase : DataContext\r\n    {\r\n        private static readonly MethodInfo NewIdMethodInfo = typeof (DataContextBase).GetMethod(\"NewId\");\r\n\r\n        /// <exclude />\r\n        [DebuggerNonUserCode]\r\n        public DataContextBase(IDbConnection connection)\r\n            : base(connection)\r\n        {\r\n            \r\n        }\r\n\r\n        /// <exclude />\r\n        [Function(Name = \"NEWID\", IsComposable = true)]\r\n        public Guid NewId()\r\n        {\r\n            return Guid.NewGuid();\r\n        }\r\n\r\n        internal static MethodInfo GetNewIdMethodInfo()\r\n        {\r\n            return NewIdMethodInfo;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/DataContextClassGenerator.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Diagnostics;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal class DataContextClassGenerator\r\n    {\r\n        private const string SqlDataContextHelperClassName = \"_sqlDataContextHelperClass\";\r\n\r\n        private readonly string _dataContextClassName;\r\n        private readonly IEnumerable<Tuple<string, string>> _entityClassNamesAndDataContextFieldNames;\r\n\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"dataContextClassName\"></param>\r\n        /// <param name=\"entityClassNamesAndDataContextFieldNames\">For all datatypes datacopes. (EntityClassName, DataContextFieldName)</param>\r\n        public DataContextClassGenerator(string dataContextClassName, IEnumerable<Tuple<string, string>> entityClassNamesAndDataContextFieldNames)\r\n        {\r\n            _dataContextClassName = dataContextClassName;\r\n            _entityClassNamesAndDataContextFieldNames = entityClassNamesAndDataContextFieldNames;\r\n        }\r\n\r\n\r\n\r\n        public CodeTypeDeclaration CreateClass()\r\n        {\r\n            CodeTypeDeclaration declaration = new CodeTypeDeclaration();\r\n            declaration.Name = _dataContextClassName;\r\n            declaration.IsClass = true;\r\n            declaration.TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed;\r\n            declaration.BaseTypes.Add(typeof(DataContextBase));\r\n            declaration.BaseTypes.Add(typeof(ISqlDataContext));\r\n\r\n            CodeMemberField codeMemberField = new CodeMemberField(typeof(SqlDataContextHelperClass), SqlDataContextHelperClassName);\r\n            declaration.Members.Add(codeMemberField);\r\n\r\n            AddConstructor(declaration);\r\n            AddEntityFields(declaration);\r\n            AddSqlDataContextMethods(declaration);\r\n\r\n            return declaration;\r\n        }\r\n\r\n\r\n\r\n        private static void AddConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeConstructor constructor = new CodeConstructor();\r\n            constructor.Attributes = MemberAttributes.Public;\r\n\r\n            constructor.Parameters.Add(\r\n                new CodeParameterDeclarationExpression(\r\n                    typeof(IDbConnection), \"connection\"));\r\n\r\n            constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(\"connection\"));\r\n\r\n            constructor.CustomAttributes.Add(new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(DebuggerNonUserCodeAttribute))\r\n                ));\r\n\r\n\r\n            constructor.Statements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeVariableReferenceExpression(SqlDataContextHelperClassName),\r\n                    new CodeObjectCreateExpression(\r\n                        typeof(SqlDataContextHelperClass),\r\n                        new CodeExpression[] {\r\n                            new CodeThisReferenceExpression()\r\n                        }\r\n                    )\r\n                ));\r\n\r\n            declaration.Members.Add(constructor);\r\n        }\r\n\r\n\r\n\r\n        private void AddEntityFields(CodeTypeDeclaration declaration)\r\n        {\r\n            foreach (Tuple<string, string> value in _entityClassNamesAndDataContextFieldNames)\r\n            {\r\n                string entityClassName = value.Item1;\r\n                string dataContextFieldName = value.Item2;\r\n\r\n                CodeMemberField codeMemberField = new CodeMemberField(new CodeTypeReference(entityClassName), dataContextFieldName);\r\n                codeMemberField.Attributes = MemberAttributes.Public;\r\n\r\n                declaration.Members.Add(codeMemberField);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddSqlDataContextMethods(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeMemberMethod codeMemberMethodAdd = new CodeMemberMethod();\r\n            codeMemberMethodAdd.Name = \"Add\";\r\n            codeMemberMethodAdd.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n            codeMemberMethodAdd.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), \"entity\"));\r\n            codeMemberMethodAdd.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), \"fieldName\"));\r\n\r\n            codeMemberMethodAdd.Statements.Add(\r\n                new CodeMethodInvokeExpression(\r\n                    new CodeVariableReferenceExpression(SqlDataContextHelperClassName),\r\n                    \"Add\",\r\n                    new CodeExpression[] {\r\n                        new CodeVariableReferenceExpression(\"entity\"),\r\n                        new CodeVariableReferenceExpression(\"fieldName\")\r\n                    }\r\n                ));\r\n\r\n            declaration.Members.Add(codeMemberMethodAdd);\r\n\r\n\r\n\r\n            CodeMemberMethod codeMemberMethodRemove = new CodeMemberMethod();\r\n            codeMemberMethodRemove.Name = \"Remove\";\r\n            codeMemberMethodRemove.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n            codeMemberMethodRemove.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), \"entity\"));\r\n            codeMemberMethodRemove.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), \"fieldName\"));\r\n\r\n            codeMemberMethodRemove.Statements.Add(\r\n                new CodeMethodInvokeExpression(\r\n                    new CodeVariableReferenceExpression(SqlDataContextHelperClassName),\r\n                    \"Remove\",\r\n                    new CodeExpression[] {\r\n                        new CodeVariableReferenceExpression(\"entity\"),\r\n                        new CodeVariableReferenceExpression(\"fieldName\")\r\n                    }\r\n                ));\r\n\r\n            declaration.Members.Add(codeMemberMethodRemove);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/DataIdClassGenerator.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal sealed class DataIdClassGenerator\r\n    {\r\n        private readonly string _dataIdClassName;\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;\r\n\r\n\r\n        public DataIdClassGenerator(DataTypeDescriptor dataTypeDescriptor, string dataIdClassName)\r\n        {\r\n            _dataTypeDescriptor = dataTypeDescriptor;\r\n            _dataIdClassName = dataIdClassName;\r\n        }\r\n\r\n\r\n        public CodeTypeDeclaration CreateClass()\r\n        {\r\n            var codeTypeDeclaration = new CodeTypeDeclaration(_dataIdClassName)\r\n            {\r\n                IsClass = true,\r\n                TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed\r\n            };\r\n            codeTypeDeclaration.BaseTypes.Add(typeof(IDataId));\r\n\r\n            AddDefaultConstructor(codeTypeDeclaration);\r\n            AddConstructor(codeTypeDeclaration);\r\n            AddProperties(codeTypeDeclaration);\r\n            AddEqualsMethod(codeTypeDeclaration);\r\n            AddGetHashCodeMethod(codeTypeDeclaration);\r\n\r\n            return codeTypeDeclaration;\r\n        }\r\n\r\n\r\n\r\n        private static void AddDefaultConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            var defaultConstructor = new CodeConstructor {Attributes = MemberAttributes.Public | MemberAttributes.Final};\r\n\r\n            declaration.Members.Add(defaultConstructor);\r\n        }\r\n\r\n\r\n\r\n        private void AddConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            var constructor = new CodeConstructor { Attributes = MemberAttributes.Public | MemberAttributes.Final };\r\n\r\n            foreach (var keyField in _dataTypeDescriptor.PhysicalKeyFields)\r\n            {\r\n                Type keyPropertyType = keyField.InstanceType;\r\n\r\n                constructor.Parameters.Add(new CodeParameterDeclarationExpression(keyPropertyType, MakeParamName(keyField.Name)));\r\n\r\n                AddAsignment(constructor, keyField.Name);\r\n            }\r\n\r\n            declaration.Members.Add(constructor);\r\n        }\r\n\r\n\r\n\r\n        private void AddProperties(CodeTypeDeclaration declaration)\r\n        {\r\n            foreach (var keyProperty in _dataTypeDescriptor.PhysicalKeyFields)\r\n            {\r\n                string keyPropertyName = keyProperty.Name;\r\n                Type keyPropertyType = keyProperty.InstanceType;\r\n                string propertyFieldName = MakePropertyFieldName(keyPropertyName);\r\n\r\n                declaration.Members.Add(new CodeMemberField(keyPropertyType, propertyFieldName));\r\n\r\n                var property = new CodeMemberProperty\r\n                {\r\n                    Name = keyPropertyName,\r\n                    Attributes = MemberAttributes.Public | MemberAttributes.Final,\r\n                    HasSet = true,\r\n                    HasGet = true,\r\n                    Type = new CodeTypeReference(keyPropertyType)\r\n                };\r\n                property.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), propertyFieldName)));\r\n                property.SetStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), propertyFieldName), new CodeArgumentReferenceExpression(\"value\")));\r\n\r\n                declaration.Members.Add(property);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddAsignment(CodeConstructor constructor, string name)\r\n        {\r\n            string paramName = MakeParamName(name);\r\n            string propertyFieldName = MakePropertyFieldName(name);\r\n\r\n            constructor.Statements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        propertyFieldName\r\n                    ),\r\n                    new CodeArgumentReferenceExpression(paramName)\r\n                )\r\n            );\r\n        }\r\n\r\n\r\n        private void AddEqualsMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            Verify.That(_dataTypeDescriptor.KeyPropertyNames.Count > 0, \"A dynamic type should have at least one key property\");\r\n\r\n            //Generates code like\r\n\r\n            // public override bool Equals(object obj)\r\n            // {\r\n            //     return obj != null && typeof(TestDataId).IsAssignableFrom(obj.GetType())\r\n            //            && object.Equals(this.Id, (obj as TestDataId).Id) && .....;\r\n            // }\r\n\r\n            const string argumentName = \"obj\";\r\n\r\n            var method = new CodeMemberMethod\r\n            {\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Override,\r\n                Name = nameof(object.Equals),\r\n                ReturnType = new CodeTypeReference(typeof(bool))\r\n            };\r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), argumentName));\r\n\r\n\r\n            var argument = new CodeArgumentReferenceExpression(argumentName);\r\n\r\n            // CODEGEN: obj != null && typeof(TestDataId).IsAssignableFrom(obj.GetType())\r\n\r\n            CodeExpression condition =\r\n                new CodeBinaryOperatorExpression(\r\n                    new CodeBinaryOperatorExpression(\r\n                        argument,\r\n                        CodeBinaryOperatorType.IdentityInequality,\r\n                        new CodePrimitiveExpression(null)),\r\n                    CodeBinaryOperatorType.BooleanAnd,\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeTypeOfExpression(new CodeTypeReference(_dataIdClassName)),\r\n                            nameof(Type.IsAssignableFrom),\r\n                            new CodeMethodInvokeExpression(argument, nameof(GetType))));\r\n\r\n\r\n            foreach (string keyPropertyName in _dataTypeDescriptor.PhysicalKeyPropertyNames)\r\n            {\r\n                string propertyFieldName = MakePropertyFieldName(_dataTypeDescriptor.Fields[keyPropertyName].Name);\r\n\r\n                CodeExpression newCondition =\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), propertyFieldName),\r\n                        nameof(object.Equals), new CodeFieldReferenceExpression(\r\n                            new CodeCastExpression(this._dataIdClassName, argument),\r\n                            propertyFieldName));\r\n\r\n                condition = new CodeBinaryOperatorExpression(\r\n                    condition, \r\n                    CodeBinaryOperatorType.BooleanAnd, \r\n                    newCondition);\r\n            }\r\n\r\n            method.Statements.Add(new CodeMethodReturnStatement(condition));\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n\r\n        private void AddGetHashCodeMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            // CODEGEN: private int _hashcode; \r\n            var hashcodeField = new CodeMemberField(typeof(int), \"_hashcode\");\r\n\r\n            // CODEGEN:\r\n            // public override int GetHashCode()\r\n            // {\r\n            //     if(_hashcode == 0)\r\n            //     {\r\n            //         _hashcode = _fullPath.GetHashCode() ^ ....;\r\n            //         if(_hashcode == 0)\r\n            //         {\r\n            //              _hashCode = -1;\r\n            //         }\r\n            //     }\r\n            //\r\n            //     return _hashcode;\r\n            // }\r\n\r\n            var method = new CodeMemberMethod\r\n            {\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Override,\r\n                Name = nameof(GetHashCode),\r\n                ReturnType = new CodeTypeReference(typeof(int))\r\n            };\r\n\r\n            Verify.That(_dataTypeDescriptor.KeyPropertyNames.Count > 0, \"A dynamic type should have at least one key property\");\r\n\r\n            CodeExpression hashCodeExpression = null;\r\n\r\n#warning We DO want IDataId classes to reflect both id and VersionId for data, right?\r\n            foreach (string keyPropertyName in _dataTypeDescriptor.PhysicalKeyFields.Select(f => f.Name))\r\n            {\r\n                string propertyFieldName = MakePropertyFieldName(_dataTypeDescriptor.Fields[keyPropertyName].Name);\r\n\r\n                CodeExpression hashCodePart =\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), propertyFieldName),\r\n                        nameof(GetHashCode));\r\n\r\n                if (hashCodeExpression == null)\r\n                {\r\n                    hashCodeExpression = hashCodePart;\r\n                }\r\n                else\r\n                {\r\n                    hashCodeExpression = new CodeMethodInvokeExpression(\r\n                        new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(typeof(DataProviderHelperBase)),\r\n                            nameof(DataProviderHelperBase.Xor)),\r\n                        hashCodeExpression, hashCodePart);\r\n                }\r\n            }\r\n\r\n            // \"this.__hashcode\"\r\n            var hashCodeFieldReference =\r\n                new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), \"_hashcode\");\r\n\r\n            method.Statements.Add(new CodeConditionStatement(\r\n                new CodeBinaryOperatorExpression(\r\n                    hashCodeFieldReference,\r\n                    CodeBinaryOperatorType.ValueEquality,\r\n                    new CodePrimitiveExpression(0)),\r\n                new CodeAssignStatement(hashCodeFieldReference, hashCodeExpression),\r\n                new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        hashCodeFieldReference,\r\n                        CodeBinaryOperatorType.ValueEquality,\r\n                        new CodePrimitiveExpression(0)),\r\n                    new CodeAssignStatement(hashCodeFieldReference, new CodePrimitiveExpression(-1)))));\r\n\r\n            // \"return __hashcode\"\r\n            method.Statements.Add(new CodeMethodReturnStatement(hashCodeFieldReference));\r\n\r\n            declaration.Members.Add(hashcodeField);\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n        private static string MakeParamName(string name) => $\"parm{name}\";\r\n\r\n\r\n        private static string MakePropertyFieldName(string name) => $\"_property{name}\";\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/EntityBaseClassGenerator.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal class EntityBaseClassGenerator\r\n    {\r\n        private readonly string _entityBaseClassName;\r\n        private readonly string _dataIdClassName;\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;\r\n        private readonly string _providerName;\r\n\r\n        public EntityBaseClassGenerator(DataTypeDescriptor dataTypeDescriptor, string entityBaseClassName, string dataIdClassName, string providerName)\r\n        {\r\n            _entityBaseClassName = entityBaseClassName;\r\n            _dataIdClassName = dataIdClassName;\r\n            _dataTypeDescriptor = dataTypeDescriptor;\r\n            _providerName = providerName;\r\n        }\r\n\r\n\r\n        public CodeTypeDeclaration CreateClass()\r\n        {\r\n            var codeTypeDeclaration = new CodeTypeDeclaration(_entityBaseClassName)\r\n            {\r\n                IsClass = true,\r\n                TypeAttributes = TypeAttributes.Public | TypeAttributes.Abstract\r\n            };\r\n\r\n            codeTypeDeclaration.BaseTypes.Add(typeof(INotifyPropertyChanged));\r\n            codeTypeDeclaration.BaseTypes.Add(typeof(INotifyPropertyChanging));\r\n            codeTypeDeclaration.BaseTypes.Add(typeof(IEntity));\r\n            codeTypeDeclaration.BaseTypes.Add(_dataTypeDescriptor.GetFullInterfaceName());\r\n\r\n            codeTypeDeclaration.Members.Add(new CodeMemberField(new CodeTypeReference(typeof(DataSourceId).FullName), EntityClassesFieldNames.DataSourceIdFieldName));\r\n            codeTypeDeclaration.Members.Add(new CodeMemberField(new CodeTypeReference(typeof(DataScopeIdentifier).FullName), EntityClassesFieldNames.DataSourceIdScopeFieldName) { Attributes = MemberAttributes.Family });\r\n            codeTypeDeclaration.Members.Add(new CodeMemberField(new CodeTypeReference(typeof(CultureInfo).FullName), EntityClassesFieldNames.DataSourceIdCultureFieldName) { Attributes = MemberAttributes.Family });\r\n\r\n            AddConstructor(codeTypeDeclaration);\r\n            AddIEntityImplementation(codeTypeDeclaration);\r\n            AddIDataSourceProperty(codeTypeDeclaration);\r\n\r\n            AddProperties(codeTypeDeclaration);\r\n\r\n            EntityCodeGeneratorHelper.AddPropertyChanging(codeTypeDeclaration);\r\n            EntityCodeGeneratorHelper.AddPropertyChanged(codeTypeDeclaration);\r\n\r\n            return codeTypeDeclaration;\r\n        }\r\n\r\n\r\n\r\n        private static void AddConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            var constructor = new CodeConstructor\r\n            {\r\n                Attributes = MemberAttributes.Public\r\n            };\r\n\r\n            constructor.Statements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        EntityClassesFieldNames.DataSourceIdFieldName\r\n                    ),\r\n                    new CodePrimitiveExpression(null)\r\n                )\r\n            );\r\n\r\n            declaration.Members.Add(constructor);\r\n        }\r\n\r\n\r\n\r\n        private void AddIEntityImplementation(CodeTypeDeclaration declaration)\r\n        {\r\n            var method = new CodeMemberMethod\r\n            {\r\n                Name = \"Commit\",\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Final\r\n            };\r\n\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                string propertyName = dataFieldDescriptor.Name;\r\n\r\n                string fieldName = $\"_{propertyName}\";\r\n                string nullableFieldName = $\"_{propertyName}Nullable\";\r\n\r\n                method.Statements.Add(\r\n                    new CodeConditionStatement(\r\n                        new CodeBinaryOperatorExpression(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                nullableFieldName\r\n                            ),\r\n                            CodeBinaryOperatorType.IdentityInequality,\r\n                            new CodePrimitiveExpression(null)\r\n                        ),\r\n                        new CodeExpressionStatement(\r\n                            new CodeMethodInvokeExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                \"OnPropertyChanging\",\r\n                                new CodePrimitiveExpression(propertyName)\r\n                            )\r\n                        ),\r\n                        new CodeAssignStatement(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                fieldName\r\n                            ),\r\n                            new CodePropertyReferenceExpression(\r\n                                new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(),\r\n                                    nullableFieldName\r\n                                ),\r\n                                \"Value\"\r\n                            )\r\n                        ),\r\n                        new CodeExpressionStatement(\r\n                            new CodeMethodInvokeExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                \"OnPropertyChanged\",\r\n                                new CodePrimitiveExpression(propertyName)\r\n                            )\r\n                        ),\r\n                        new CodeAssignStatement(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                nullableFieldName\r\n                            ),\r\n                            new CodePrimitiveExpression(null)\r\n                        )\r\n                    )\r\n                );\r\n            }\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n\r\n        private void AddIDataSourceProperty(CodeTypeDeclaration declaration)\r\n        {\r\n            PropertyInfo propertyInfo = typeof(IData).GetProperty(nameof(IData.DataSourceId));\r\n\r\n            var codeProperty = new CodeMemberProperty\r\n            {\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Final,\r\n                Name = propertyInfo.Name,\r\n                HasGet = true,\r\n                HasSet = false,\r\n                Type = new CodeTypeReference(propertyInfo.PropertyType)\r\n            };\r\n\r\n            var dataIdConstructorParms = new List<CodeExpression>();\r\n            foreach (string propertyName in _dataTypeDescriptor.PhysicalKeyFields.Select(f=>f.Name))\r\n            {\r\n                dataIdConstructorParms.Add(\r\n                    new CodePropertyReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        propertyName\r\n                    ));\r\n            }\r\n\r\n            codeProperty.GetStatements.Add(\r\n                new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            EntityClassesFieldNames.DataSourceIdFieldName\r\n                        ),\r\n                        CodeBinaryOperatorType.IdentityEquality,\r\n                        new CodePrimitiveExpression(null)\r\n                    ),\r\n                    new CodeAssignStatement(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            EntityClassesFieldNames.DataSourceIdFieldName\r\n                        ),\r\n                        new CodeObjectCreateExpression(\r\n                            new CodeTypeReference(typeof(DataSourceId)),\r\n                            new CodeObjectCreateExpression(\r\n                                new CodeTypeReference(_dataIdClassName),\r\n                                dataIdConstructorParms.ToArray()\r\n                            ),\r\n                            new CodePrimitiveExpression(_providerName),\r\n                            new CodeTypeOfExpression(_dataTypeDescriptor.GetFullInterfaceName()),\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                EntityClassesFieldNames.DataSourceIdScopeFieldName\r\n                            ),\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                EntityClassesFieldNames.DataSourceIdCultureFieldName\r\n                            )\r\n                        )\r\n                    )\r\n                )\r\n            );\r\n\r\n\r\n\r\n            codeProperty.GetStatements.Add(\r\n                new CodeMethodReturnStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                            EntityClassesFieldNames.DataSourceIdFieldName\r\n                        )\r\n                    ));\r\n\r\n            declaration.Members.Add(codeProperty);\r\n        }\r\n\r\n\r\n\r\n        private void AddProperties(CodeTypeDeclaration declaration)\r\n        {\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                string propertyName = dataFieldDescriptor.Name;\r\n                Type propertyType = dataFieldDescriptor.InstanceType;\r\n\r\n                string fieldName = $\"_{propertyName}\";\r\n                string nullableFieldName = $\"_{propertyName}Nullable\";\r\n\r\n                AddPropertiesAddField(declaration, propertyType, fieldName);\r\n                AddPropertiesAddNullableField(declaration, propertyType, nullableFieldName);\r\n                AddPropertiesAddProperty(declaration, propertyName, propertyType, fieldName, nullableFieldName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddPropertiesAddField(CodeTypeDeclaration declaration, Type propertyType, string fieldName)\r\n        {\r\n            var fieldMember = new CodeMemberField\r\n            {\r\n                Name = fieldName,\r\n                Type = new CodeTypeReference(propertyType),\r\n                Attributes = MemberAttributes.Family\r\n            };\r\n\r\n            declaration.Members.Add(fieldMember);\r\n        }\r\n\r\n\r\n\r\n        private static void AddPropertiesAddNullableField(CodeTypeDeclaration declaration, Type propertyType, string fieldName)\r\n        {\r\n            var fieldMember = new CodeMemberField\r\n            {\r\n                Name = fieldName,\r\n                Type = new CodeTypeReference(typeof (ExtendedNullable<>).FullName, new CodeTypeReference(propertyType)),\r\n                Attributes = MemberAttributes.Family,\r\n                InitExpression = new CodePrimitiveExpression(null)\r\n            };\r\n\r\n\r\n            declaration.Members.Add(fieldMember);\r\n        }\r\n\r\n\r\n\r\n        private static void AddPropertiesAddProperty(CodeTypeDeclaration declaration, string propertyName, Type propertyType, string fieldName, string nullableFieldName)\r\n        {\r\n            var propertyMember = new CodeMemberProperty\r\n            {\r\n                Name = propertyName,\r\n                Type = new CodeTypeReference(propertyType),\r\n                Attributes = MemberAttributes.Public,\r\n                HasSet = true,\r\n                HasGet = true\r\n            };\r\n\r\n\r\n            propertyMember.GetStatements.Add(\r\n                new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            nullableFieldName\r\n                        ),\r\n                        CodeBinaryOperatorType.IdentityInequality,\r\n                        new CodePrimitiveExpression(null)\r\n                    ),\r\n                    new CodeStatement[] {\r\n                        new CodeMethodReturnStatement(\r\n                            new CodePropertyReferenceExpression(\r\n                                new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(), \r\n                                    nullableFieldName\r\n                                ), \r\n                                \"Value\"\r\n                            )\r\n                        )\r\n                    },\r\n                    new CodeStatement[] {\r\n                        new CodeMethodReturnStatement(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(), \r\n                                fieldName\r\n                            )\r\n                        )\r\n                    }\r\n                )\r\n            );\r\n\r\n\r\n            propertyMember.SetStatements.Add(\r\n                new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            nullableFieldName\r\n                        ),\r\n                        CodeBinaryOperatorType.IdentityEquality,\r\n                        new CodePrimitiveExpression(null)\r\n                    ),\r\n                    new CodeAssignStatement(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            nullableFieldName\r\n                        ),\r\n                        new CodeObjectCreateExpression(\r\n                            new CodeTypeReference(typeof(ExtendedNullable<>).FullName, new CodeTypeReference(propertyType))\r\n                        )\r\n                    )\r\n                )\r\n            );\r\n\r\n            propertyMember.SetStatements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        nullableFieldName\r\n                    ),\r\n                    new CodeArgumentReferenceExpression(\"value\")\r\n                )\r\n            );\r\n\r\n\r\n            declaration.Members.Add(propertyMember);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/EntityClassGenerator.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.Data.Linq.Mapping;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    /// <summary>\r\n    /// There exists an entity class per { datacope, locale } mutation and only one base entity class.\r\n    /// <example>\r\n    /// The data type is publishable and localized and there exists two locales (EN, DK).\r\n    /// This would result in 4 entity classes:\r\n    /// unpublished+en, enpublished+dk, published+en, published+dk\r\n    /// </example>\r\n    /// </summary>\r\n    internal sealed class EntityClassGenerator\r\n    {\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;\r\n        private readonly string _entityClassName;\r\n        private readonly string _entityBaseClassName;\r\n        private readonly string _tableName;\r\n        private readonly string _dataScopeIdentifierName;\r\n        private readonly string _localeCultureName;\r\n\r\n\r\n        public EntityClassGenerator(DataTypeDescriptor dataTypeDescriptor, string entityClassName, string entityBaseClassName, string tableName, string dataScopeIdentifierName, string localeCultureName)\r\n        {\r\n            _dataTypeDescriptor = dataTypeDescriptor;\r\n            _entityClassName = entityClassName;\r\n            _entityBaseClassName = entityBaseClassName;\r\n            _tableName = tableName;\r\n            _dataScopeIdentifierName = dataScopeIdentifierName;\r\n            _localeCultureName = localeCultureName;\r\n        }\r\n\r\n\r\n\r\n        public CodeTypeDeclaration CreateClass()\r\n        {\r\n            var debugDisplayText = $\"SQL entity for '{_dataTypeDescriptor.GetFullInterfaceName()}', culture = '{_localeCultureName}', scope = '{_dataScopeIdentifierName}'\";\r\n            foreach (var keyPropertyName in _dataTypeDescriptor.KeyPropertyNames)\r\n            {\r\n                debugDisplayText += $\", {keyPropertyName} = {{{keyPropertyName}}}\";\r\n            }\r\n\r\n            var labelFieldName = _dataTypeDescriptor.LabelFieldName;\r\n            if (!string.IsNullOrEmpty(labelFieldName) && !_dataTypeDescriptor.KeyPropertyNames.Contains(labelFieldName))\r\n            {\r\n                debugDisplayText += $\", {labelFieldName} = {{{labelFieldName}}}\";\r\n            }\r\n\r\n            var codeTypeDeclaration = new CodeTypeDeclaration(_entityClassName)\r\n            {\r\n                IsClass = true,\r\n                TypeAttributes = TypeAttributes.Public\r\n            };\r\n\r\n            codeTypeDeclaration.BaseTypes.Add(new CodeTypeReference(_entityBaseClassName));\r\n            codeTypeDeclaration.CustomAttributes.AddRange(new []\r\n            {\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(TableAttribute)),\r\n                    new CodeAttributeArgument(\"Name\", new CodePrimitiveExpression(_tableName))\r\n                ),\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(DebuggerDisplayAttribute)),\r\n                    new CodeAttributeArgument(\r\n                        new CodePrimitiveExpression(debugDisplayText)\r\n                    )\r\n                )\r\n            });\r\n\r\n\r\n            string propertyName =\r\n                typeof(DataScopeIdentifier).GetProperties(BindingFlags.Static | BindingFlags.Public).\r\n                Where(f => f.Name.Equals(_dataScopeIdentifierName, StringComparison.OrdinalIgnoreCase)).\r\n                Select(f => f.Name).\r\n                Single();\r\n\r\n\r\n            CodeMemberField constDataSourceIdCodeMemberField = new CodeMemberField(\r\n                    new CodeTypeReference(typeof(DataScopeIdentifier).FullName),\r\n                    EntityClassesFieldNames.DataSourceIdScopeConstFieldName\r\n                );\r\n            constDataSourceIdCodeMemberField.Attributes = MemberAttributes.Static;\r\n            constDataSourceIdCodeMemberField.InitExpression =\r\n                new CodePropertyReferenceExpression(\r\n                    new CodeTypeReferenceExpression(typeof(DataScopeIdentifier)),\r\n                    propertyName\r\n                );\r\n            codeTypeDeclaration.Members.Add(constDataSourceIdCodeMemberField);\r\n            \r\n            \r\n\r\n            CodeMemberField constCultureCodeMemberField = new CodeMemberField(\r\n                new CodeTypeReference(typeof(CultureInfo).FullName), \r\n                EntityClassesFieldNames.DataSourceIdCultureConstFieldName\r\n                );\r\n            constCultureCodeMemberField.Attributes = MemberAttributes.Static;\r\n            constCultureCodeMemberField.InitExpression =\r\n                new CodeObjectCreateExpression(\r\n                        new CodeTypeReference(typeof(CultureInfo)),\r\n                        new CodePrimitiveExpression(_localeCultureName)\r\n                    );\r\n\r\n            codeTypeDeclaration.Members.Add(constCultureCodeMemberField);\r\n\r\n            AddEntityClassConstructor(codeTypeDeclaration);\r\n            AddProperties(codeTypeDeclaration);\r\n\r\n            return codeTypeDeclaration;\r\n        }\r\n\r\n\r\n\r\n\r\n        private static void AddEntityClassConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeConstructor constructor = new CodeConstructor();\r\n            constructor.Attributes = MemberAttributes.Public;\r\n\r\n            constructor.Statements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        EntityClassesFieldNames.DataSourceIdScopeFieldName\r\n                    ),\r\n                    new CodeFieldReferenceExpression(\r\n                        null,\r\n                        EntityClassesFieldNames.DataSourceIdScopeConstFieldName\r\n                    )\r\n                )\r\n            );\r\n\r\n            constructor.Statements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        EntityClassesFieldNames.DataSourceIdCultureFieldName\r\n                    ),\r\n                    new CodeFieldReferenceExpression(\r\n                        null,\r\n                        EntityClassesFieldNames.DataSourceIdCultureConstFieldName\r\n                    )\r\n                )\r\n            );\r\n\r\n            declaration.Members.Add(constructor);\r\n        }\r\n\r\n\r\n\r\n        private void AddProperties(CodeTypeDeclaration declaration)\r\n        {\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                string propertyName = dataFieldDescriptor.Name;\r\n                Type propertyType = dataFieldDescriptor.InstanceType;\r\n\r\n                string fieldName = string.Format(\"_{0}\", propertyName);\r\n                string nullableFieldName = string.Format(\"_{0}Nullable\", propertyName);\r\n\r\n                AddPropertiesAddProperty(declaration, propertyName, propertyType, fieldName, nullableFieldName);\r\n            }            \r\n        }\r\n\r\n\r\n\r\n        private void AddPropertiesAddProperty(CodeTypeDeclaration declaration, string propertyName, Type propertyType, string fieldName, string nullableFieldName)\r\n        {\r\n            SqlColumnInformation columnInformation = _dataTypeDescriptor.CreateSqlColumnInformation(propertyName);\r\n\r\n            string name = propertyName;\r\n            Type type = propertyType;\r\n            string dbName = propertyName; \r\n            string dbType = EntityCodeGeneratorHelper.GetDbType(columnInformation.SqlDbType, columnInformation.IsNullable);\r\n            bool isNullable = columnInformation.IsNullable;\r\n            bool isId = columnInformation.IsPrimaryKey;\r\n            bool isAutoGen = columnInformation.IsIdentity;\r\n\r\n\r\n            CodeMemberProperty propertyMember = new CodeMemberProperty();\r\n            propertyMember.Name = name;\r\n            propertyMember.Type = new CodeTypeReference(type);\r\n            propertyMember.Attributes = MemberAttributes.Public;\r\n            propertyMember.HasSet = true;\r\n            propertyMember.HasGet = true;\r\n\r\n\r\n            propertyMember.GetStatements.Add(\r\n                new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            nullableFieldName\r\n                        ),\r\n                        CodeBinaryOperatorType.IdentityInequality,\r\n                        new CodePrimitiveExpression(null)\r\n                    ),\r\n                    new CodeStatement[] {\r\n                        new CodeMethodReturnStatement(\r\n                            new CodePropertyReferenceExpression(\r\n                                new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(), \r\n                                    nullableFieldName\r\n                                ), \r\n                                \"Value\"\r\n                            )\r\n                        )\r\n                    },\r\n                    new CodeStatement[] {\r\n                        new CodeMethodReturnStatement(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(), \r\n                                fieldName\r\n                            )\r\n                        )\r\n                    }\r\n                )\r\n            );\r\n\r\n\r\n\r\n            propertyMember.SetStatements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodePropertyReferenceExpression(\r\n                        new CodeBaseReferenceExpression(),\r\n                        name\r\n                    ),\r\n                    new CodeArgumentReferenceExpression(\"value\")\r\n                )\r\n            );\r\n\r\n\r\n\r\n            propertyMember.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(DebuggerNonUserCodeAttribute))));\r\n\r\n            var codeAttributeArguments = new List<CodeAttributeArgument>\r\n            {\r\n                new CodeAttributeArgument(\"Name\", new CodePrimitiveExpression(dbName)),\r\n                new CodeAttributeArgument(\"Storage\", new CodePrimitiveExpression(fieldName)),\r\n                new CodeAttributeArgument(\"DbType\", new CodePrimitiveExpression(dbType)),\r\n                new CodeAttributeArgument(\"CanBeNull\", new CodePrimitiveExpression(isNullable)),\r\n                new CodeAttributeArgument(\"IsPrimaryKey\", new CodePrimitiveExpression(isId)),\r\n                new CodeAttributeArgument(\"IsDbGenerated\", new CodePrimitiveExpression(isAutoGen)),\r\n                new CodeAttributeArgument(\"UpdateCheck\",\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeTypeReferenceExpression(typeof (UpdateCheck)), nameof(UpdateCheck.Never))\r\n                    )\r\n            };\r\n\r\n\r\n\r\n            propertyMember.CustomAttributes.Add(new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(ColumnAttribute)),\r\n                    codeAttributeArguments.ToArray()\r\n                ));\r\n\r\n\r\n            declaration.Members.Add(propertyMember);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/EntityClassesFieldNames.cs",
    "content": "﻿\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal static class EntityClassesFieldNames\r\n    {\r\n        public const string DataSourceIdFieldName = \"_dataSourceId\";\r\n        public const string DataSourceIdScopeFieldName = \"_dataScopeIdentifier\";\r\n        public const string DataSourceIdCultureFieldName = \"_locale\";\r\n\r\n        public const string DataSourceIdScopeConstFieldName = \"DataScope\";\r\n        public const string DataSourceIdCultureConstFieldName = \"Locale\";\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/EntityCodeGeneratorHelper.cs",
    "content": "using System.CodeDom;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal static class EntityCodeGeneratorHelper\r\n    {\r\n        public static string GetDbType(SqlDbType dbType, bool isNullable)\r\n        {\r\n            string s = dbType.ToString().ToLowerInvariant();\r\n            if (s == \"varchar\") s = \"nvarchar\";\r\n\r\n            return string.Format(\"{0}{1}\", s, isNullable ? \"\" : \" NOT NULL\");\r\n        }\r\n\r\n\r\n\r\n        public static void AddPropertyChanging(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeMemberEvent changingEvent = new CodeMemberEvent();\r\n            changingEvent.Name = \"PropertyChanging\";\r\n            changingEvent.Type = new CodeTypeReference(typeof(PropertyChangingEventHandler));\r\n            changingEvent.Attributes = MemberAttributes.Public;\r\n\r\n            declaration.Members.Add(changingEvent);\r\n\r\n\r\n            CodeMemberMethod changingMethod = new CodeMemberMethod();\r\n            changingMethod.Name = \"OnPropertyChanging\";\r\n            changingMethod.ReturnType = new CodeTypeReference(typeof(void));\r\n            changingMethod.Attributes = MemberAttributes.Family;\r\n            changingMethod.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), \"propertyName\"));\r\n            changingMethod.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(DebuggerNonUserCodeAttribute))));\r\n\r\n\r\n\r\n            changingMethod.Statements.Add(new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), \"PropertyChanging\"),\r\n                        CodeBinaryOperatorType.IdentityInequality,\r\n                        new CodePrimitiveExpression(null)\r\n                    ),\r\n                    new CodeStatement[] {\r\n                        new CodeExpressionStatement(\r\n                            new CodeMethodInvokeExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                \"PropertyChanging\",\r\n                                new CodeExpression[] {\r\n                                    new CodeThisReferenceExpression(),\r\n                                    new CodeObjectCreateExpression(\r\n                                        typeof(PropertyChangingEventArgs),\r\n                                        new CodeExpression[] {\r\n                                            new CodeArgumentReferenceExpression(\"propertyName\")\r\n                                        }\r\n                                    )\r\n                                }\r\n                            )\r\n                        )\r\n                    }\r\n                ));\r\n\r\n            declaration.Members.Add(changingMethod);\r\n        }\r\n\r\n\r\n\r\n        public static void AddPropertyChanged(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeMemberEvent changingEvent = new CodeMemberEvent();\r\n            changingEvent.Name = \"PropertyChanged\";\r\n            changingEvent.Type = new CodeTypeReference(typeof(PropertyChangedEventHandler));\r\n            changingEvent.Attributes = MemberAttributes.Public;\r\n\r\n            declaration.Members.Add(changingEvent);\r\n\r\n\r\n            CodeMemberMethod changingMethod = new CodeMemberMethod();\r\n            changingMethod.Name = \"OnPropertyChanged\";\r\n            changingMethod.ReturnType = new CodeTypeReference(typeof(void));\r\n            changingMethod.Attributes = MemberAttributes.Family;\r\n            changingMethod.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), \"propertyName\"));\r\n            changingMethod.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(DebuggerNonUserCodeAttribute))));\r\n\r\n\r\n            changingMethod.Statements.Add(new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), \"PropertyChanged\"),\r\n                        CodeBinaryOperatorType.IdentityInequality,\r\n                        new CodePrimitiveExpression(null)\r\n                    ),\r\n                    new CodeStatement[] {\r\n                        new CodeExpressionStatement(\r\n                            new CodeMethodInvokeExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                \"PropertyChanged\",\r\n                                new CodeExpression[] {\r\n                                    new CodeThisReferenceExpression(),\r\n                                    new CodeObjectCreateExpression(\r\n                                        typeof(PropertyChangedEventArgs),\r\n                                        new CodeExpression[] {\r\n                                            new CodeArgumentReferenceExpression(\"propertyName\")\r\n                                        }\r\n                                    )\r\n                                }\r\n                            )\r\n                        )\r\n                    }\r\n                ));\r\n\r\n\r\n            declaration.Members.Add(changingMethod);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/IEntity.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public interface IEntity\r\n    {\r\n        /// <exclude />\r\n        void Commit();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/ISqlDataContext.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public interface ISqlDataContext\r\n\t{\r\n        /// <exclude />\r\n        void Add(object entity, string tableName);\r\n\r\n        /// <exclude />\r\n        void Remove(object entity, string tableName);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/SqlDataContextHelperClass.cs",
    "content": "﻿using System;\r\nusing System.Data.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// Provides an api to work with generated tables of a DataContext object.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class SqlDataContextHelperClass\r\n    {\r\n        readonly DataContext _dataContext;\r\n\r\n        private readonly Hashtable<string, ITable> _tables = new Hashtable<string, ITable>();\r\n        private readonly object _syncRoot = new object();\r\n\r\n\r\n        /// <exclude />\r\n        public SqlDataContextHelperClass(DataContext dataContext)\r\n        {\r\n            _dataContext = dataContext;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Add(object entity, string tableName)\r\n        {\r\n            EnsureTableInitialized(tableName);\r\n\r\n            _tables[tableName].InsertOnSubmit(entity);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void Remove(object entity, string tableName)\r\n        {\r\n            EnsureTableInitialized(tableName);\r\n\r\n            ITable table = _tables[tableName]; \r\n\r\n            table.Attach(entity);\r\n            table.DeleteOnSubmit(entity);\r\n        }\r\n\r\n\r\n        private void EnsureTableInitialized(string tableName)\r\n        {\r\n            if(_tables.ContainsKey(tableName))\r\n            {\r\n                return;\r\n            }\r\n\r\n            lock(_syncRoot)\r\n            {\r\n                if (_tables.ContainsKey(tableName))\r\n                {\r\n                    return;\r\n                }\r\n\r\n                Type dataContextType = _dataContext.GetType();\r\n\r\n                FieldInfo fi = dataContextType.GetField(tableName);\r\n                Verify.IsNotNull(fi, \"DataContext class should have a field with name '{0}'\", tableName);\r\n\r\n                Type entityType = fi.FieldType;\r\n\r\n                // Operation takes 3 ms every request :(\r\n                ITable table = _dataContext.GetTable(entityType);\r\n\r\n                _tables.Add(tableName, table);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        internal static ITable GetTable(DataContext _dataContext, SqlDataTypeStoreTable storeInformation)\r\n        {\r\n            FieldInfo fi = storeInformation.DataContextQueryableFieldInfo;\r\n            Verify.IsNotNull(fi, \"Missing FieldInfo for a DataContext field.\");\r\n\r\n            object value = fi.GetValue(_dataContext);\r\n            if(value == null)\r\n            {\r\n                var helperClassFieldInfo =_dataContext.GetType().GetField(\"_sqlDataContextHelperClass\", BindingFlags.NonPublic | BindingFlags.Instance);\r\n                Verify.IsNotNull(helperClassFieldInfo, \"Helper field isn't exist in DataContext object.\");\r\n\r\n                var helper = helperClassFieldInfo.GetValue(_dataContext) as SqlDataContextHelperClass;\r\n                Verify.That(helper != null, \"Helper object has not been set\");\r\n\r\n                helper.EnsureTableInitialized(fi.Name);\r\n\r\n                value = helper._tables[fi.Name];\r\n            }\r\n            return Verify.ResultNotNull(value as ITable);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/SqlDataProviderCodeBuilder.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Data.Linq.Mapping;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Serialization.CodeGeneration;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal class SqlDataProviderCodeBuilder\r\n    {\r\n        private readonly CodeGenerationBuilder _codeGenerationBuilder;\r\n        private readonly string _providerName;\r\n        private readonly List<Tuple<string, string>> _entityClassNamesAndDataContextFieldNames = new List<Tuple<string, string>>();\r\n        private readonly string _namespaceName;\r\n\r\n\r\n        public SqlDataProviderCodeBuilder(string providerName, CodeGenerationBuilder codeGenerationBuilder)\r\n        {\r\n            _codeGenerationBuilder = codeGenerationBuilder;\r\n            _providerName = providerName;\r\n\r\n            _namespaceName = NamesCreator.MakeNamespaceName(providerName);\r\n\r\n            AddCodeNamespaces();\r\n        }\r\n\r\n\r\n\r\n        internal void AddDataType(DataTypeDescriptor dataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope> sqlDataTypeStoreDataScopes)\r\n        {\r\n            Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n            if (interfaceType == null) return;\r\n\r\n            IEnumerable<Tuple<string, string>> names;\r\n\r\n            SqlProviderCodeGenerator codeGenerator = new SqlProviderCodeGenerator(_providerName);\r\n            IEnumerable<CodeTypeDeclaration> codeTypeDeclarations = codeGenerator.CreateCodeDOMs(dataTypeDescriptor, sqlDataTypeStoreDataScopes, out names);\r\n            codeTypeDeclarations.ForEach(f => _codeGenerationBuilder.AddType(_namespaceName, f));\r\n\r\n            _entityClassNamesAndDataContextFieldNames.AddRange(names);\r\n            \r\n            _codeGenerationBuilder.AddReference(interfaceType.Assembly);\r\n\r\n            // Property serializer for entity tokens and more\r\n            string dataIdClassFullName = NamesCreator.MakeDataIdClassFullName(dataTypeDescriptor, _providerName);\r\n\r\n            var keyPropertiesDictionary = new Dictionary<string, Type>();\r\n            var keyPropertiesList = new List<Tuple<string, Type>>();\r\n            foreach (var keyField in dataTypeDescriptor.PhysicalKeyFields)\r\n            {\r\n                Verify.That(!keyPropertiesDictionary.ContainsKey(keyField.Name), \"Key field with name '{0}' already present. Data type: {1}. Check for multiple [KeyPropertyName(...)] attributes\", keyField.Name, dataTypeDescriptor.Namespace + \".\" + dataTypeDescriptor.Name);\r\n\r\n                keyPropertiesDictionary.Add(keyField.Name, keyField.InstanceType);\r\n                keyPropertiesList.Add(new Tuple<string, Type>(keyField.Name, keyField.InstanceType));\r\n            }\r\n\r\n            PropertySerializerTypeCodeGenerator.AddPropertySerializerTypeCode(_codeGenerationBuilder, dataIdClassFullName, keyPropertiesList);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This will not add needed entity class and data context field names if the data entity class does not exist\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        /// <param name=\"sqlDataTypeStoreDataScopes\"></param>\r\n        internal void AddExistingDataType(DataTypeDescriptor dataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope> sqlDataTypeStoreDataScopes)\r\n        {\r\n            SqlProviderCodeGenerator codeGenerator = new SqlProviderCodeGenerator(_providerName);\r\n\r\n            IEnumerable<Tuple<string, string>> names = codeGenerator.CreateEntityClassNamesAndDataContextFieldNames(dataTypeDescriptor, sqlDataTypeStoreDataScopes);\r\n\r\n            foreach (Tuple<string, string> name in names)\r\n            {\r\n                Type type = TypeManager.TryGetType(NamesCreator.MakeNamespaceName(_providerName) + \".\" + name.Item1);\r\n\r\n                if (type != null)\r\n                {\r\n                    \r\n                    _codeGenerationBuilder.AddReference(type.Assembly.Location);\r\n                    _entityClassNamesAndDataContextFieldNames.Add(name);\r\n\r\n                    foreach (Type interfaceType in type.GetInterfaces())\r\n                    {\r\n                        _codeGenerationBuilder.AddReference(interfaceType.Assembly);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal void AddDataContext()\r\n        {\r\n            SqlProviderCodeGenerator codeGenerator = new SqlProviderCodeGenerator(_providerName);\r\n            IEnumerable<CodeTypeDeclaration> codeTypeDeclarations = codeGenerator.CreateDataContextCodeDOMs(_entityClassNamesAndDataContextFieldNames);\r\n            codeTypeDeclarations.ForEach(f => _codeGenerationBuilder.AddType(_namespaceName, f));\r\n        }\r\n\r\n\r\n\r\n        private void AddCodeNamespaces()\r\n        {\r\n            _codeGenerationBuilder.AddReference(typeof(Exception).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(DbType).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(IQueryable).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(TableAttribute).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(IContainer).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(ExpressionCreator).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(ExtendedNullable<>).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(DataSourceId).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(IProcessControlled).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(SqlDataProvider).Assembly);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/SqlDataProviderCodeProvider.cs",
    "content": "﻿using System.ComponentModel;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal class SqlDataProviderCodeProvider : ICodeProvider\r\n    {\r\n        public string ProviderName { get; private set; }\r\n\r\n        public SqlDataProviderCodeProvider(string providerName)\r\n        {\r\n            ProviderName = providerName;\r\n        }\r\n\r\n\r\n        public void GetCodeToCompile(CodeGenerationBuilder builder)\r\n        {\r\n            var sqlDataProvider = (SqlDataProvider)DataProviderPluginFacade.GetDataProvider(ProviderName);\r\n\r\n            sqlDataProvider.BuildAllCode(builder);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/SqlDataProviderHelperGenerator.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Plugins.DataProvider;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal class SqlDataProviderHelperGenerator\r\n    {\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;        \r\n        private readonly string _sqlDataProviderHelperClassName;\r\n        private readonly string _dataIdClassName;\r\n        private readonly string _entityClassName;\r\n        private readonly string _dataContextFieldName;\r\n\r\n\r\n\r\n        public SqlDataProviderHelperGenerator(DataTypeDescriptor dataTypeDescriptor, string sqlDataProviderHelperClassName, string dataIdClassName, string entityClassName, string dataContextFieldName)\r\n        {\r\n            _dataTypeDescriptor = dataTypeDescriptor;            \r\n            _sqlDataProviderHelperClassName = sqlDataProviderHelperClassName;\r\n            _dataIdClassName = dataIdClassName;\r\n            _entityClassName = entityClassName;\r\n            _dataContextFieldName = dataContextFieldName;\r\n        }\r\n\r\n\r\n\r\n        public CodeTypeDeclaration CreateClass()\r\n        {\r\n            var declaration = new CodeTypeDeclaration(_sqlDataProviderHelperClassName)\r\n            {\r\n                IsClass = true,\r\n                TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed\r\n            };\r\n\r\n            declaration.BaseTypes.Add(typeof(ISqlDataProviderHelper));\r\n\r\n            foreach (string keyFieldName in _dataTypeDescriptor.PhysicalKeyPropertyNames)\r\n            {\r\n                string fieldName = CreateDataIdPropertyInfoFieldName(keyFieldName);\r\n\r\n                CodeMemberField codeField = new CodeMemberField(new CodeTypeReference(typeof (PropertyInfo)), fieldName)\r\n                {\r\n                    InitExpression = new CodeMethodInvokeExpression(\r\n                        new CodeMethodReferenceExpression(\r\n                            new CodeTypeReferenceExpression(typeof (IDataExtensions)),\r\n                            nameof(IDataExtensions.GetDataPropertyRecursively)\r\n                        ),\r\n                        new CodeExpression[]\r\n                        {\r\n                            new CodeTypeOfExpression(_entityClassName),\r\n                            new CodePrimitiveExpression(keyFieldName)\r\n                        }\r\n                    )\r\n                };\r\n\r\n                declaration.Members.Add(codeField);\r\n            }\r\n\r\n            AddGetDataByIdMethod(declaration);\r\n            AddAddDataMethod(declaration);\r\n            AddRemoveDataMethod(declaration);\r\n\r\n            return declaration;\r\n        }\r\n\r\n\r\n\r\n        private void AddGetDataByIdMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            const string queryableVariableName = \"queryable\";\r\n            const string dataIdVariableName = \"dataId\";\r\n            const string dataProivderContextVariableName = \"dataProivderContext\";\r\n            const string castedDataIdVariableName = \"castedDataId\";\r\n            const string castedQueryableVariableName = \"castedQueryable\";\r\n            const string paramterExpressionVariableName = \"paramter\";\r\n            const string whereBodyExpressionVariableName = \"whereBody\";\r\n            const string whereLambdaExpressionVariableName = \"whereLambda\";\r\n            const string whereExpressionVariableName = \"whereExpression\";\r\n            const string resultVariableName = \"result\";\r\n\r\n            CodeMemberMethod codeMethod = new CodeMemberMethod();\r\n            codeMethod.Name = \"GetDataById\";\r\n            codeMethod.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n            codeMethod.ReturnType = new CodeTypeReference(typeof(IData));\r\n            codeMethod.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(IQueryable)), queryableVariableName));\r\n            codeMethod.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(IDataId)), dataIdVariableName));\r\n            codeMethod.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(DataProviderContext)), dataProivderContextVariableName));\r\n\r\n\r\n            // casted dataid variable\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(_dataIdClassName),\r\n                    castedDataIdVariableName,\r\n                    new CodeCastExpression(\r\n                        new CodeTypeReference(_dataIdClassName),\r\n                        new CodeVariableReferenceExpression(dataIdVariableName)\r\n                    )\r\n                ));\r\n\r\n\r\n            // casted queryable variable\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(typeof(IQueryable<>).FullName, new [] { new CodeTypeReference(_entityClassName) }),\r\n                    castedQueryableVariableName,\r\n                    new CodeCastExpression(\r\n                        new CodeTypeReference(typeof(IQueryable<>).FullName, new [] { new CodeTypeReference(_entityClassName) }),\r\n                        new CodeVariableReferenceExpression(queryableVariableName)\r\n                    )\r\n                ));\r\n\r\n\r\n            // parameter expression variable\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(typeof(ParameterExpression)),\r\n                    paramterExpressionVariableName,\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeTypeReferenceExpression(typeof(Expression)),\r\n                        \"Parameter\",\r\n                        new CodeExpression[] {\r\n                            new CodeTypeOfExpression(new CodeTypeReference(_entityClassName)),\r\n                            new CodePrimitiveExpression(\"_getDataByIdParameter_\")\r\n                        }\r\n                    )\r\n                ));\r\n\r\n\r\n            // where body variable\r\n            CodeExpression currentExpression = null;\r\n            foreach (string propertyName in _dataTypeDescriptor.PhysicalKeyPropertyNames)\r\n            {\r\n                CodeExpression newExpression = new CodeMethodInvokeExpression(\r\n                    new CodeTypeReferenceExpression(typeof(Expression)),\r\n                    \"Equal\",\r\n                    new CodeExpression[] {\r\n                        new CodeMethodInvokeExpression(\r\n                            new CodeTypeReferenceExpression(typeof(Expression)),\r\n                            \"Property\",\r\n                            new CodeExpression[] {\r\n                                new CodeVariableReferenceExpression(paramterExpressionVariableName),\r\n                                new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(),\r\n                                    CreateDataIdPropertyInfoFieldName(propertyName)\r\n                                )\r\n                            }\r\n                        ),\r\n                        new CodeMethodInvokeExpression(\r\n                            new CodeTypeReferenceExpression(typeof(Expression)),\r\n                            \"Constant\",\r\n                            new CodeExpression[] {\r\n                                new CodePropertyReferenceExpression(\r\n                                    new CodeVariableReferenceExpression(castedDataIdVariableName),\r\n                                    propertyName\r\n                                )\r\n                            }\r\n                        )\r\n                    }\r\n                );\r\n\r\n                if (currentExpression == null)\r\n                {\r\n                    currentExpression = newExpression;\r\n                }\r\n                else\r\n                {\r\n                    currentExpression = new CodeMethodInvokeExpression(\r\n                            new CodeTypeReferenceExpression(typeof(Expression)),\r\n                            \"And\",\r\n                            new [] {\r\n                                currentExpression,\r\n                                newExpression\r\n                            }\r\n                        );\r\n                }\r\n            }\r\n\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(typeof(Expression)),\r\n                    whereBodyExpressionVariableName,\r\n                    currentExpression\r\n                ));\r\n\r\n\r\n            // where lambda variable\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(typeof(LambdaExpression)),\r\n                    whereLambdaExpressionVariableName,\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeTypeReferenceExpression(typeof(Expression)),\r\n                        \"Lambda\",\r\n                        new CodeExpression[] {\r\n                            new CodeVariableReferenceExpression(whereBodyExpressionVariableName),\r\n                            new CodeArrayCreateExpression(\r\n                                new CodeTypeReference(typeof(ParameterExpression)),\r\n                                new CodeExpression[] {\r\n                                    new CodeVariableReferenceExpression(paramterExpressionVariableName)\r\n                                }\r\n                            )\r\n                        }\r\n                    )\r\n                ));\r\n\r\n\r\n            // where expression variable\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(typeof(Expression)),\r\n                    whereExpressionVariableName,\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeTypeReferenceExpression(typeof(ExpressionCreator)),\r\n                        \"Where\",\r\n                        new CodeExpression[] {\r\n                            new CodePropertyReferenceExpression(\r\n                                new CodeVariableReferenceExpression(castedQueryableVariableName),\r\n                                \"Expression\"\r\n                            ),\r\n                            new CodeVariableReferenceExpression(whereLambdaExpressionVariableName),\r\n                        }\r\n                    )\r\n                ));\r\n\r\n\r\n            // get result and store en list variable\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(typeof(List<>).FullName, new [] { new CodeTypeReference(_entityClassName) }),\r\n                    resultVariableName,\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeTypeReferenceExpression(typeof(Enumerable)),\r\n                        \"ToList\",\r\n                        new CodeExpression[] {\r\n                            new CodeMethodInvokeExpression(\r\n                                new CodeMethodReferenceExpression(\r\n                                    new CodePropertyReferenceExpression(\r\n                                        new CodeVariableReferenceExpression(castedQueryableVariableName),\r\n                                        \"Provider\"\r\n                                    ),                                    \r\n                                    \"CreateQuery\",\r\n                                    new [] { new CodeTypeReference(_entityClassName) }\r\n                                ),\r\n                                new CodeExpression[] { \r\n                                    new CodeVariableReferenceExpression(whereExpressionVariableName)\r\n                                }\r\n                            )\r\n                        }\r\n                    )\r\n                ));\r\n\r\n\r\n            // test result and return null on empty, wrappe result and return on one, else except\r\n            codeMethod.Statements.Add(\r\n                new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        new CodePropertyReferenceExpression(\r\n                            new CodeVariableReferenceExpression(resultVariableName),\r\n                            \"Count\"\r\n                        ),\r\n                        CodeBinaryOperatorType.IdentityEquality,\r\n                        new CodePrimitiveExpression(1)\r\n                    ),\r\n                    new CodeStatement[] {\r\n                        new CodeMethodReturnStatement(                            \r\n                            new CodeArrayIndexerExpression(\r\n                                new CodeVariableReferenceExpression(resultVariableName),\r\n                                new CodeExpression[] {\r\n                                    new CodePrimitiveExpression(0)\r\n                                }\r\n                            )\r\n                        )                        \r\n                    },\r\n                    new CodeStatement[] {\r\n                        new CodeConditionStatement(\r\n                            new CodeBinaryOperatorExpression(\r\n                                new CodePropertyReferenceExpression(\r\n                                    new CodeVariableReferenceExpression(resultVariableName),\r\n                                    \"Count\"\r\n                                ),\r\n                                CodeBinaryOperatorType.IdentityEquality,\r\n                                new CodePrimitiveExpression(0)\r\n                            ),\r\n                            new CodeStatement[] {\r\n                                new CodeMethodReturnStatement(\r\n                                    new CodePrimitiveExpression(null)\r\n                                )       \r\n                            },\r\n                            new CodeStatement[] {\r\n                            }\r\n                        )\r\n                    }\r\n                ));\r\n\r\n\r\n            codeMethod.Statements.Add(\r\n                new CodeThrowExceptionStatement(\r\n                    new CodeObjectCreateExpression(\r\n                        new CodeTypeReference(typeof(InvalidOperationException)),\r\n                        new CodePrimitiveExpression(\"More than one data item matched the given data id\")\r\n                    )\r\n                ));\r\n\r\n            declaration.Members.Add(codeMethod);\r\n        }\r\n\r\n\r\n\r\n        private void AddAddDataMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            const string dataContextVariableName = \"dataContext\";\r\n            const string dataToAddVariableName = \"dataToAdd\";\r\n            const string dataProivderContextVariableName = \"dataProivderContext\";\r\n            const string castedDataToAddVariableName = \"castedDataToAdd\";\r\n            const string entityClassVariableName = \"entity\";\r\n\r\n\r\n            CodeMemberMethod codeMethod = new CodeMemberMethod();\r\n            codeMethod.Name = \"AddData\";\r\n            codeMethod.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n            codeMethod.ReturnType = new CodeTypeReference(typeof(IData));\r\n            codeMethod.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(ISqlDataContext)), dataContextVariableName));\r\n            codeMethod.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(IData)), dataToAddVariableName));\r\n            codeMethod.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(DataProviderContext)), dataProivderContextVariableName));\r\n\r\n\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(_dataTypeDescriptor.GetFullInterfaceName()),\r\n                    castedDataToAddVariableName,\r\n                    new CodeCastExpression(\r\n                        new CodeTypeReference(_dataTypeDescriptor.GetFullInterfaceName()),\r\n                        new CodeVariableReferenceExpression(dataToAddVariableName)\r\n                    )\r\n                ));\r\n\r\n\r\n            codeMethod.Statements.Add(\r\n                new CodeVariableDeclarationStatement(\r\n                    new CodeTypeReference(_entityClassName),\r\n                    entityClassVariableName,\r\n                    new CodeObjectCreateExpression(\r\n                        new CodeTypeReference(_entityClassName),\r\n                        new CodeExpression[] { }\r\n                    )\r\n                ));\r\n\r\n\r\n            foreach (string propertyName in _dataTypeDescriptor.Fields.Select(f => f.Name))\r\n            {\r\n                codeMethod.Statements.Add(new CodeCommentStatement(string.Format(\"Interface property {0}\", propertyName)));\r\n\r\n                codeMethod.Statements.Add(\r\n                    new CodeAssignStatement(\r\n                        new CodePropertyReferenceExpression(\r\n                            new CodeVariableReferenceExpression(entityClassVariableName),\r\n                            propertyName\r\n                        ),\r\n                        new CodePropertyReferenceExpression(\r\n                            new CodeVariableReferenceExpression(castedDataToAddVariableName),\r\n                            propertyName\r\n                        )\r\n                    ));\r\n            }\r\n\r\n\r\n            codeMethod.Statements.Add(new CodeCommentStatement(\"Done with properties\"));\r\n\r\n            codeMethod.Statements.Add(\r\n                new CodeExpressionStatement(\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeVariableReferenceExpression(dataContextVariableName),\r\n                        \"Add\",\r\n                        new CodeExpression[] {\r\n                            new CodeVariableReferenceExpression(entityClassVariableName),\r\n                            new CodePrimitiveExpression(_dataContextFieldName)\r\n                        }\r\n                    )\r\n                ));\r\n\r\n\r\n            codeMethod.Statements.Add(\r\n                new CodeMethodReturnStatement(\r\n                    new CodeVariableReferenceExpression(entityClassVariableName)\r\n                ));\r\n\r\n            declaration.Members.Add(codeMethod);\r\n        }\r\n\r\n\r\n\r\n        private void AddRemoveDataMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            const string dataContextVariableName = \"dataContext\";\r\n            const string dataToRemoveVariableName = \"dataToRemove\";\r\n\r\n            CodeMemberMethod codeMethod = new CodeMemberMethod();\r\n            codeMethod.Name = \"RemoveData\";\r\n            codeMethod.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n            codeMethod.ReturnType = new CodeTypeReference(typeof(void));\r\n            codeMethod.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(ISqlDataContext)), dataContextVariableName));\r\n            codeMethod.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(IData)), dataToRemoveVariableName));\r\n\r\n            codeMethod.Statements.Add(\r\n                new CodeExpressionStatement(\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeVariableReferenceExpression(dataContextVariableName),\r\n                        \"Remove\",\r\n                        new CodeExpression[] {                            \r\n                            new CodeVariableReferenceExpression(dataToRemoveVariableName),\r\n                            new CodePrimitiveExpression(_dataContextFieldName)\r\n                        }\r\n                    )\r\n                ));\r\n\r\n\r\n\r\n\r\n            declaration.Members.Add(codeMethod);\r\n        }\r\n\r\n\r\n\r\n        private static string CreateDataIdPropertyInfoFieldName(string propertyName)\r\n        {\r\n            return $\"_dataIdEntityPropertyInfo{propertyName}\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/CodeGeneration/SqlProviderCodeGenerator.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration\r\n{\r\n    internal class SqlProviderCodeGenerator\r\n    {\r\n        private readonly string _providerName;\r\n\r\n\r\n        public SqlProviderCodeGenerator(string providerName)\r\n        {\r\n            _providerName = providerName;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<CodeTypeDeclaration> CreateCodeDOMs(DataTypeDescriptor dataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope> sqlDataTypeStoreDataScopes, out IEnumerable<Tuple<string, string>> entityClassNamesAndDataContextFieldNames)\r\n        {\r\n            List<CodeTypeDeclaration> result = new List<CodeTypeDeclaration>();\r\n\r\n            string dataIdClassName = NamesCreator.MakeDataIdClassName(dataTypeDescriptor);\r\n            string entityBaseClassName = NamesCreator.MakeEntityBaseClassName(dataTypeDescriptor);            \r\n\r\n            DataIdClassGenerator dataIdClassGenerator = new DataIdClassGenerator(dataTypeDescriptor, dataIdClassName);\r\n            CodeTypeDeclaration dataIdClassCodeTypeDeclaration = dataIdClassGenerator.CreateClass();\r\n            result.Add(dataIdClassCodeTypeDeclaration);\r\n\r\n\r\n            EntityBaseClassGenerator entityBaseClassGenerator = new EntityBaseClassGenerator(dataTypeDescriptor, entityBaseClassName, dataIdClassName, _providerName);\r\n            CodeTypeDeclaration entityBaseClassCodeTypeDeclaration = entityBaseClassGenerator.CreateClass();\r\n            result.Add(entityBaseClassCodeTypeDeclaration);\r\n\r\n            List<Tuple<string, string>> outResult = new List<Tuple<string, string>>();\r\n            foreach (SqlDataTypeStoreDataScope dataScope in sqlDataTypeStoreDataScopes)\r\n            {\r\n                string entityClassName = NamesCreator.MakeEntityClassName(dataTypeDescriptor, dataScope.DataScopeName, dataScope.CultureName);\r\n\r\n                EntityClassGenerator entityClassGenerator = new EntityClassGenerator(dataTypeDescriptor, entityClassName, entityBaseClassName, dataScope.TableName, dataScope.DataScopeName, dataScope.CultureName);\r\n                CodeTypeDeclaration entityClassCodeTypeDeclaration = entityClassGenerator.CreateClass();\r\n                result.Add(entityClassCodeTypeDeclaration);\r\n\r\n                string sqlDataProviderHelperClassName = NamesCreator.MakeSqlDataProviderHelperClassName(dataTypeDescriptor, dataScope.DataScopeName, dataScope.CultureName);\r\n                string dataContextFieldName = NamesCreator.MakeDataContextFieldName(dataScope.TableName);\r\n\r\n                SqlDataProviderHelperGenerator sqlDataProviderHelperGenerator = new SqlDataProviderHelperGenerator(dataTypeDescriptor, sqlDataProviderHelperClassName, dataIdClassName, entityClassName, dataContextFieldName);\r\n                CodeTypeDeclaration sqlDataProviderHelperTypeDeclaration = sqlDataProviderHelperGenerator.CreateClass();\r\n                result.Add(sqlDataProviderHelperTypeDeclaration);\r\n\r\n                outResult.Add(new Tuple<string, string>(entityClassName, dataContextFieldName));\r\n            }\r\n\r\n            entityClassNamesAndDataContextFieldNames = outResult;\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Tuple<string, string>> CreateEntityClassNamesAndDataContextFieldNames(DataTypeDescriptor dataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope> sqlDataTypeStoreDataScopes)\r\n        {\r\n            List<Tuple<string, string>> entityClassNamesAndDataContextFieldNames = new List<Tuple<string, string>>();\r\n\r\n            foreach (SqlDataTypeStoreDataScope dataScope in sqlDataTypeStoreDataScopes)\r\n            {\r\n                string entityClassName = NamesCreator.MakeEntityClassName(dataTypeDescriptor, dataScope.DataScopeName, dataScope.CultureName);\r\n                string dataContextFieldName = NamesCreator.MakeDataContextFieldName(dataScope.TableName);\r\n\r\n                entityClassNamesAndDataContextFieldNames.Add(new Tuple<string, string>(entityClassName, dataContextFieldName));\r\n            }\r\n\r\n            return entityClassNamesAndDataContextFieldNames;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<CodeTypeDeclaration> CreateDataContextCodeDOMs(IEnumerable<Tuple<string, string>> entityClassNamesAndDataContextFieldNames)\r\n        {\r\n            string dataContextClassName = NamesCreator.MakeDataContextClassName(_providerName);\r\n\r\n            DataContextClassGenerator dataContextClassGenerator = new DataContextClassGenerator(dataContextClassName, entityClassNamesAndDataContextFieldNames);\r\n            CodeTypeDeclaration dataContextTypeDeclaration = dataContextClassGenerator.CreateClass();\r\n            yield return dataContextTypeDeclaration;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/DynamicTypesCommon.cs",
    "content": "﻿using System;\r\nusing System.Data;\r\nusing System.Globalization;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation\r\n{\r\n\tinternal static class DynamicTypesCommon\r\n\t{\r\n\t\tinternal static string GenerateTableName(DataTypeDescriptor dataTypeDescriptor)\r\n\t\t{\r\n\t\t    return dataTypeDescriptor.GetFullInterfaceName().Replace('.', '_');\r\n\t\t}\r\n\r\n\t\tinternal static string GenerateTableName(DataTypeDescriptor dataTypeDescriptor, DataScopeIdentifier dataScope, CultureInfo cultureInfo)\r\n\t\t{\r\n\t\t    string tableName = dataTypeDescriptor.GetFullInterfaceName().Replace('.', '_');\r\n\r\n\t\t\tswitch (dataScope.Name)\r\n\t\t\t{\r\n\t\t\t\tcase DataScopeIdentifier.PublicName:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DataScopeIdentifier.AdministratedName:\r\n\t\t\t        tableName += \"_Unpublished\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tthrow new InvalidOperationException(\"Unsupported data scope identifier: '{0}'\".FormatWith(dataScope.Name));\r\n\t\t\t}\r\n\r\n            if (!cultureInfo.Name.IsNullOrEmpty())\r\n            {\r\n                tableName += \"_\" + cultureInfo.Name.Replace('-', '_').Replace(' ', '_');\r\n            }\r\n\r\n            return tableName;\r\n\t\t}\r\n\r\n\r\n\t\tinternal static string GenerateListTableName(DataTypeDescriptor typeDescriptor, DataFieldDescriptor fieldDescriptor)\r\n\t\t{\r\n\t\t\treturn string.Format(\"{0}_{1}\", GenerateTableName(typeDescriptor), fieldDescriptor.Name);\r\n\t\t}\r\n\r\n\t\tinternal static string MapStoreTypeToSqlDataType(StoreFieldType storeType)\r\n\t\t{\r\n\t\t\tstring result = string.Format(\" [{0}]\", GetStoreTypeToSqlDataTypeMapping(storeType));\r\n\r\n\t\t\tswitch (storeType.PhysicalStoreType)\r\n\t\t\t{\r\n\t\t\t\tcase PhysicalStoreFieldType.String:\r\n\t\t\t\t\treturn string.Format(\"{0}({1})\", result, storeType.MaximumLength);\r\n\t\t\t\tcase PhysicalStoreFieldType.LargeString:\r\n\t\t\t\t\treturn string.Format(\"{0}({1})\", result, \"max\");\r\n\t\t\t\tcase PhysicalStoreFieldType.Decimal:\r\n\t\t\t\t\treturn string.Format(\"{0}({1},{2})\", result, storeType.NumericPrecision, storeType.NumericScale);\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tinternal static SqlDbType GetStoreTypeToSqlDataTypeMapping(StoreFieldType storeType)\r\n\t\t{\r\n\t\t\tswitch (storeType.PhysicalStoreType)\r\n\t\t\t{\r\n\t\t\t\tcase PhysicalStoreFieldType.Integer:\r\n\t\t\t\t\treturn SqlDbType.Int;\r\n\t\t\t\tcase PhysicalStoreFieldType.Long:\r\n\t\t\t\t\treturn SqlDbType.BigInt;\r\n\t\t\t\tcase PhysicalStoreFieldType.String:\r\n\t\t\t\t\treturn SqlDbType.NVarChar;\r\n\t\t\t\tcase PhysicalStoreFieldType.LargeString:\r\n\t\t\t\t\treturn SqlDbType.NVarChar;\r\n\t\t\t\tcase PhysicalStoreFieldType.DateTime:\r\n\t\t\t\t\treturn SqlDbType.DateTime;\r\n\t\t\t\tcase PhysicalStoreFieldType.Decimal:\r\n\t\t\t\t\treturn SqlDbType.Decimal;\r\n\t\t\t\tcase PhysicalStoreFieldType.Boolean:\r\n\t\t\t\t\treturn SqlDbType.Bit;\r\n\t\t\t\tcase PhysicalStoreFieldType.Guid:\r\n\t\t\t\t\treturn SqlDbType.UniqueIdentifier;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tthrow new ArgumentException(\"Unknown store type on field\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tinternal static bool AreSame(DataFieldDescriptor a, DataFieldDescriptor b)\r\n\t\t{\r\n\t\t\treturn a.ToXml().ToString() == b.ToXml().ToString();\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/InterfaceConfigurationManipulator.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.Common;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation\r\n{\r\n    /// <summary>\r\n    /// Add, change and remove type-to-table mapping information\r\n    /// </summary>\r\n    internal static class InterfaceConfigurationManipulator\r\n    {\r\n        private static readonly string LogTitle = typeof(InterfaceConfigurationManipulator).Name;\r\n\r\n        static readonly object _syncRoot = new object();\r\n\r\n        internal static InterfaceConfigurationElement AddNew(string providerName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            lock (_syncRoot)\r\n            {\r\n                var configuration = new SqlDataProviderConfiguration(providerName);\r\n\r\n                if (configuration.Section.Interfaces.ContainsInterfaceType(dataTypeDescriptor.DataTypeId))\r\n                {\r\n                    Log.LogWarning(LogTitle, \r\n                        \"Configuration file '{0}' already contains an interface with data type ID '{1}', type name '{2}'. \"\r\n                         + \"Possibly there are multiple AppDomain-s running.\",\r\n                            configuration.ConfigurationFilePath,\r\n                            dataTypeDescriptor.DataTypeId,\r\n                            dataTypeDescriptor);\r\n\r\n                    return configuration.Section.Interfaces.Get(dataTypeDescriptor);\r\n                }\r\n\r\n                InterfaceConfigurationElement interfaceConfig = BuildInterfaceConfigurationElement(dataTypeDescriptor);\r\n\r\n                configuration.Section.Interfaces.Add(interfaceConfig);\r\n\r\n                configuration.Save();\r\n\r\n                return interfaceConfig;\r\n            }\r\n        }\r\n\r\n        internal static InterfaceConfigurationElement RefreshLocalizationInfo(string providerName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            var changeDescriptor = new DataTypeChangeDescriptor(dataTypeDescriptor, dataTypeDescriptor);\r\n\r\n            return Change(providerName, changeDescriptor, true);\r\n        }\r\n\r\n        internal static bool ConfigurationExists( string providerName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            lock (_syncRoot)\r\n            {\r\n                var configuration = new SqlDataProviderConfiguration(providerName);\r\n\r\n                InterfaceConfigurationElement interfaceConfig = BuildInterfaceConfigurationElement(dataTypeDescriptor);\r\n\r\n                return configuration.Section.Interfaces.ContainsInterfaceType(interfaceConfig);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static InterfaceConfigurationElement Change(string providerName, DataTypeChangeDescriptor changeDescriptor, bool localeChanges)\r\n        {\r\n            lock (_syncRoot)\r\n            {\r\n                var originalType = changeDescriptor.OriginalType;\r\n                var alteredType = changeDescriptor.AlteredType;\r\n\r\n                bool typeNameChanged = originalType.Namespace != alteredType.Namespace ||\r\n                                       originalType.Name != alteredType.Name;\r\n\r\n                if (!localeChanges &&\r\n                    !changeDescriptor.AddedDataScopes.Any() &&\r\n                    !changeDescriptor.DeletedDataScopes.Any() &&\r\n                    !changeDescriptor.AddedKeyFields.Any() &&\r\n                    !changeDescriptor.DeletedKeyFields.Any() &&\r\n                    !changeDescriptor.KeyFieldsOrderChanged &&\r\n                    !typeNameChanged)\r\n                {\r\n                    // No changes to the config is needed, lets not touch the file.\r\n                    return null;\r\n                }\r\n\r\n                var configuration = new SqlDataProviderConfiguration(providerName);\r\n\r\n                Guid dataTypeId = originalType.DataTypeId;\r\n\r\n                var existingElement = configuration.Section.Interfaces.Get(originalType);\r\n\r\n                Verify.IsNotNull(existingElement, \"Configuration does not contain the original interface with id '{0}'\", dataTypeId);\r\n\r\n                configuration.Section.Interfaces.Remove(originalType);\r\n\r\n                InterfaceConfigurationElement newInterfaceConfig = BuildInterfaceConfigurationElement(alteredType, existingElement, typeNameChanged);\r\n\r\n                configuration.Section.Interfaces.Add(newInterfaceConfig);\r\n\r\n                configuration.Save();\r\n\r\n                return newInterfaceConfig;\r\n            }\r\n        }\r\n\r\n\r\n        internal static void Remove(string providerName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            lock (_syncRoot)\r\n            {\r\n                var configuration = new SqlDataProviderConfiguration(providerName);\r\n\r\n                if (configuration.Section.Interfaces.ContainsInterfaceType(dataTypeDescriptor))\r\n                {\r\n                    configuration.Section.Interfaces.Remove(dataTypeDescriptor);\r\n                    configuration.Save();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static InterfaceConfigurationElement BuildInterfaceConfigurationElement(\r\n            DataTypeDescriptor dataTypeDescriptor, \r\n            InterfaceConfigurationElement existingElement = null,\r\n            bool updateTableNames = false)\r\n        {\r\n            var propertyMappings = new PropertyNameMappingConfigurationElementCollection();\r\n            //foreach (DataFieldDescriptor field in dataTypeDescriptor.Fields)\r\n            //{\r\n            //    propertyMappings.Add(field.Name, field.Name);\r\n            //}\r\n\r\n            var keyInfo = new SimpleNameTypeConfigurationElementCollection();\r\n            foreach (DataFieldDescriptor field in dataTypeDescriptor.PhysicalKeyFields)\r\n            {\r\n                keyInfo.Add(field.Name, field.InstanceType);\r\n            }\r\n\r\n            var stores = new StoreConfigurationElementCollection();\r\n            // Fix logic for the case of a localized interface without languages\r\n            foreach (DataScopeIdentifier dataScope in dataTypeDescriptor.DataScopes)\r\n            {\r\n                foreach (var culture in SqlDataProviderStoreManipulator.GetCultures(dataTypeDescriptor))\r\n                {\r\n                    string tableName = null;\r\n\r\n                    if (!updateTableNames && existingElement != null)\r\n                    {\r\n                        foreach (StoreConfigurationElement table  in existingElement.ConfigurationStores)\r\n                        {\r\n                            if (table.DataScope == dataScope.Name && table.CultureName == culture.Name)\r\n                            {\r\n                                tableName = table.TableName;\r\n                                break;\r\n                            }\r\n                        }\r\n                        \r\n                    }\r\n\r\n                    tableName = tableName ?? DynamicTypesCommon.GenerateTableName(dataTypeDescriptor, dataScope, culture);\r\n\r\n                    stores.Add(new StoreConfigurationElement {TableName = tableName, DataScope = dataScope.Name, CultureName = culture.Name});\r\n                }\r\n            }\r\n\r\n            return new InterfaceConfigurationElement\r\n            {\r\n                DataTypeId = dataTypeDescriptor.DataTypeId,\r\n                IsGeneratedType = dataTypeDescriptor.IsCodeGenerated,\r\n                ConfigurationStores = stores,\r\n                ConfigurationPropertyNameMappings = propertyMappings,\r\n                ConfigurationDataIdProperties = keyInfo,\r\n                ConfigurationPropertyInitializers = new SimpleNameTypeConfigurationElementCollection()\r\n            };\r\n        }\r\n\r\n        internal static string GetConfigurationFilePath(string dataProviderName)\r\n        {\r\n            return Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.ConfigurationDirectory), \r\n                                $\"{dataProviderName}.config\");\r\n        }\r\n\r\n\r\n        private sealed class SqlDataProviderConfiguration\r\n        {\r\n            readonly string _configurationFilePath;\r\n            readonly C1Configuration _configuration;\r\n\r\n            public SqlDataProviderConfiguration(string providerName)\r\n            {\r\n                _configurationFilePath = GetConfigurationFilePath(providerName);\r\n                _configuration = new C1Configuration(_configurationFilePath);\r\n\r\n                Section = _configuration.GetSection(SqlDataProviderConfigurationSection.SectionName) as SqlDataProviderConfigurationSection;\r\n\r\n                if (Section == null)\r\n                {\r\n                    Section = new SqlDataProviderConfigurationSection();\r\n                    _configuration.Sections.Add(SqlDataProviderConfigurationSection.SectionName, Section);\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public SqlDataProviderConfigurationSection Section\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public string ConfigurationFilePath\r\n            {\r\n                get { return _configurationFilePath; }\r\n            }\r\n\r\n\r\n            public void Save()\r\n            {\r\n                _configuration.Save();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/NamesCreator.cs",
    "content": "﻿using Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation\r\n{\r\n    internal static class NamesCreator\r\n    {\r\n        internal static string MakeDataIdClassName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return $\"{MakeNiceTypeFullName(dataTypeDescriptor)}DataId\";\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeDataIdClassFullName(DataTypeDescriptor dataTypeDescriptor, string providerName)\r\n        {\r\n            return $\"{MakeNamespaceName(providerName)}.{MakeDataIdClassName(dataTypeDescriptor)}\";\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeEntityBaseClassName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return $\"{MakeNiceTypeFullName(dataTypeDescriptor)}EntityBase\";\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeEntityBaseClassFullName(DataTypeDescriptor dataTypeDescriptor, string providerName)\r\n        {\r\n            return $\"{MakeNamespaceName(providerName)}.{MakeEntityBaseClassName(dataTypeDescriptor)}\";\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeEntityClassName(DataTypeDescriptor dataTypeDescriptor, string dataScopeIdentifierName, string localeCultureName)\r\n        {\r\n            var typeName = MakeNiceTypeFullName(dataTypeDescriptor);\r\n\r\n            if (string.IsNullOrEmpty(localeCultureName))\r\n            {\r\n                return $\"{typeName}_{dataScopeIdentifierName}Entity\";\r\n            }\r\n\r\n\r\n            return $\"{typeName}_{dataScopeIdentifierName}_{localeCultureName.Replace(\"-\", \"\")}Entity\";\r\n        }\r\n\r\n\r\n        internal static string MakeEntityClassFullName(DataTypeDescriptor dataTypeDescriptor, string dataScopeIdentifierName, string localeCultureName, string providerName)\r\n        {\r\n            return $\"{MakeNamespaceName(providerName)}.{MakeEntityClassName(dataTypeDescriptor, dataScopeIdentifierName, localeCultureName)}\";\r\n        }\r\n\r\n\r\n        internal static string MakeSqlDataProviderHelperClassName(DataTypeDescriptor dataTypeDescriptor, string dataScopeIdentifierName, string localeCultureName)\r\n        {\r\n            var typeName = MakeNiceTypeFullName(dataTypeDescriptor);\r\n\r\n            if (string.IsNullOrEmpty(localeCultureName))\r\n                return $\"{typeName}_{dataScopeIdentifierName}SqlDataProviderHelper\";\r\n\r\n            return  $\"{typeName}_{dataScopeIdentifierName}_{localeCultureName.Replace(\"-\", \"\")}SqlDataProviderHelper\";\r\n        }\r\n\r\n\r\n        internal static string MakeSqlDataProviderHelperClassFullName(DataTypeDescriptor dataTypeDescriptor, string dataScopeIdentifierName, string localeCultureName, string providerName)\r\n        {\r\n            var className = MakeSqlDataProviderHelperClassName(dataTypeDescriptor, dataScopeIdentifierName, localeCultureName);\r\n            return $\"{MakeNamespaceName(providerName)}.{className}\";\r\n        }\r\n\r\n\r\n        internal static string MakeDataContextFieldName(string tableName)\r\n        {\r\n            return tableName;\r\n        }\r\n\r\n\r\n        internal static string MakeDataContextClassName(string providerName)\r\n        {\r\n            return $\"{providerName}DataContext\";\r\n        }\r\n\r\n\r\n        internal static string MakeDataContextClassFullName(string providerName)\r\n        {\r\n            return $\"{MakeNamespaceName(providerName)}.{MakeDataContextClassName(providerName)}\";\r\n        }\r\n\r\n\r\n        internal static string MakeNamespaceName(string providerName)\r\n        {\r\n            return \"CompositeGenerated.\" + providerName;\r\n        }\r\n\r\n\r\n\r\n        private static string MakeNiceTypeFullName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return dataTypeDescriptor.GetFullInterfaceName().Replace('.', '_').Replace('+', '_');\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/RequireTransactionScope.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Transactions;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal class RequireTransactionScope : IDisposable\r\n    {\r\n        private TransactionScope _scope;\r\n\r\n        public RequireTransactionScope()\r\n        {\r\n            if (Transaction.Current == null)\r\n            {\r\n                _scope = new TransactionScope();\r\n            }\r\n        }\r\n\r\n        public void Complete()\r\n        {\r\n            if (_scope != null)\r\n            {\r\n                _scope.Complete();\r\n            }\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n            if (_scope != null)\r\n            {\r\n                _scope.Dispose();\r\n            }\r\n\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~RequireTransactionScope()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/SqlDataProviderStoreManipulator.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Data.SqlClient;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Sql;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation\r\n{\r\n    internal sealed class SqlDataProviderStoreManipulator\r\n    {\r\n        private static readonly object _lock = new object();\r\n\r\n        private readonly string _connectionString;\r\n        private readonly IEnumerable<InterfaceConfigurationElement> _generatedInterfaces;\r\n\r\n        internal SqlDataProviderStoreManipulator(string connectionString, IEnumerable<InterfaceConfigurationElement> generatedInterfaces)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(connectionString, \"connectionString\");\r\n            Verify.ArgumentNotNull(generatedInterfaces, \"generatedInterfaces\");\r\n\r\n            _connectionString = connectionString;\r\n            _generatedInterfaces = generatedInterfaces;\r\n        }\r\n\r\n        internal void CreateStoresForType(DataTypeDescriptor typeDescriptor, Action<string> existingTablesValidator)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                foreach (DataScopeIdentifier dataScope in typeDescriptor.DataScopes)\r\n                {\r\n                    foreach (var culture in GetCultures(typeDescriptor))\r\n                    {\r\n                        CreateStore(typeDescriptor, dataScope, culture, existingTablesValidator);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        internal void AddLocale(DataTypeDescriptor typeDescriptor, CultureInfo cultureInfo)\r\n        {\r\n            foreach (DataScopeIdentifier dataScope in typeDescriptor.DataScopes)\r\n            {\r\n                CreateStore(typeDescriptor, dataScope, cultureInfo);\r\n            }\r\n        }\r\n\r\n        internal void RemoveLocale(string providerName, DataTypeDescriptor typeDescriptor, CultureInfo cultureInfo)\r\n        {\r\n            foreach (DataScopeIdentifier dataScope in typeDescriptor.DataScopes)\r\n            {\r\n                DropStore(typeDescriptor, dataScope, cultureInfo);\r\n            }\r\n        }\r\n\r\n        internal static IEnumerable<CultureInfo> GetCultures(DataTypeDescriptor typeDescriptor)\r\n        {\r\n            if (typeDescriptor.Localizeable)\r\n            {\r\n                return DataLocalizationFacade.ActiveLocalizationCultures;\r\n            }\r\n            \r\n            return new [] { CultureInfo.InvariantCulture };\r\n        }\r\n\r\n        private void CreateScopeData(DataTypeDescriptor typeDescriptor, DataScopeIdentifier dataScope)\r\n        {\r\n            foreach (var cultureInfo in GetCultures(typeDescriptor))\r\n            {\r\n                CreateStore(typeDescriptor, dataScope, cultureInfo);\r\n            }\r\n        }\r\n\r\n        internal void CreateStore(DataTypeDescriptor typeDescriptor, DataScopeIdentifier dataScope, CultureInfo cultureInfo,\r\n                                  Action<string> existingTablesValidator = null)\r\n        {\r\n            string tableName = DynamicTypesCommon.GenerateTableName(typeDescriptor, dataScope, cultureInfo);\r\n            var tables = GetTablesList();\r\n\r\n            if (tables.Contains(tableName))\r\n            {\r\n                if (existingTablesValidator != null)\r\n                {\r\n                    existingTablesValidator(tableName);\r\n                    return;\r\n                }\r\n\r\n                throw new InvalidOperationException($\"Database already contains a table named {tableName}\");\r\n            }\r\n\r\n            var sql = new StringBuilder();\r\n            var sqlColumns = typeDescriptor.Fields.Select(fieldDescriptor \r\n                => GetColumnInfo(tableName, fieldDescriptor.Name, typeDescriptor, fieldDescriptor, true, false)\r\n                ).ToList();\r\n\r\n            sql.AppendFormat(\"CREATE TABLE dbo.[{0}]({1});\", tableName, string.Join(\",\", sqlColumns));\r\n            sql.Append(SetPrimaryKey(tableName, typeDescriptor.PhysicalKeyPropertyNames, typeDescriptor.PrimaryKeyIsClusteredIndex));\r\n\r\n            try\r\n            {\r\n                ExecuteNonQuery(sql.ToString());\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw MakeVerboseException(ex);\r\n            }\r\n\r\n            foreach (var index in typeDescriptor.Indexes)\r\n            {\r\n                CreateIndex(tableName, index);\r\n            }\r\n\r\n            SqlTableInformationStore.ClearCache(_connectionString, tableName);\r\n        }\r\n\r\n        internal List<string> GetTablesList()\r\n        {\r\n            string sql = @\"\r\n\t\t\t\tSELECT t.Name FROM sysobjects s\r\n\t\t\t\tINNER JOIN sysobjects t ON s.parent_obj = t.id\r\n\t\t\t\tWHERE t.xtype = 'U'\";\r\n            DataTable dt = ExecuteReader(sql);\r\n            List<string> tables = (from DataRow dr in dt.Rows select dr[\"Name\"].ToString()).ToList();\r\n\r\n            return tables;\r\n        }\r\n\r\n        #region Db helpers\r\n        public DataTable ExecuteReader(string commandText)\r\n        {\r\n            var conn = SqlConnectionManager.GetConnection(_connectionString);\r\n\r\n            using (var cmd = new SqlCommand(commandText, conn))\r\n            {\r\n                using (var dt = new DataTable())\r\n                {\r\n                    using (var rdr = cmd.ExecuteReader())\r\n                    {\r\n                        if (rdr != null) dt.Load(rdr);\r\n                        return dt;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        public void ExecuteNonQuery(string commandText)\r\n        {\r\n            if (string.IsNullOrEmpty(commandText))\r\n            {\r\n                return;\r\n            }\r\n\r\n            Log.LogInformation(\"SqlDataProvider\", commandText);\r\n\r\n            var conn = SqlConnectionManager.GetConnection(_connectionString);\r\n            using (var cmd = new SqlCommand(commandText, conn))\r\n            {\r\n                cmd.ExecuteNonQuery();\r\n            }\r\n        }\r\n\r\n        public void ExecuteNonQuery(SqlCommand cmd)\r\n        {\r\n            var conn = SqlConnectionManager.GetConnection(_connectionString);\r\n            cmd.Connection = conn;\r\n            cmd.ExecuteNonQuery();\r\n        }\r\n\r\n        public void ExecuteStoredProcedure(string spName, string[] spParams)\r\n        {\r\n            string sql = string.Format(\"{0} {1}\", spName, string.Join(\",\", spParams));\r\n\r\n            ExecuteNonQuery(sql);\r\n        }\r\n\r\n        #endregion\r\n\r\n\r\n        private string GetConfiguredTableName(DataTypeDescriptor dataTypeDescriptor, DataScopeIdentifier dataScope, string cultureName)\r\n        {\r\n            var stores =\r\n                (from dataInterface in _generatedInterfaces\r\n                 where dataInterface.DataTypeId == dataTypeDescriptor.DataTypeId\r\n                 select dataInterface.Stores).FirstOrDefault();\r\n\r\n            if (stores == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var tableName = (from store in stores\r\n                             where store.CultureName == cultureName && store.DataScope == dataScope.Name\r\n                             select store.TableName).FirstOrDefault();\r\n            return tableName;\r\n        }\r\n\r\n\r\n        internal string TryNormalizeTypeFullName(string typeName)\r\n        {\r\n            Type type = TypeManager.TryGetType(typeName);\r\n\r\n            if (type != null)\r\n            {\r\n                return TypeManager.TrySerializeType(type);\r\n            }\r\n            return typeName;\r\n        }\r\n\r\n\r\n        internal void AlterStoresForType(UpdateDataTypeDescriptor updateDataTypeDescriptor)\r\n        {\r\n            DataTypeChangeDescriptor changeDescriptor = updateDataTypeDescriptor.CreateDataTypeChangeDescriptor();\r\n\r\n            lock (_lock)\r\n            {\r\n                foreach (DataScopeIdentifier dataScope in changeDescriptor.AddedDataScopes)\r\n                {\r\n                    CreateScopeData(changeDescriptor.AlteredType, dataScope);\r\n                }\r\n\r\n                foreach (DataScopeIdentifier dataScope in changeDescriptor.ExistingDataScopes)\r\n                {\r\n                    AlterScopeData(updateDataTypeDescriptor, changeDescriptor, dataScope);\r\n                }\r\n\r\n\r\n                if (updateDataTypeDescriptor.PublicationAdded)\r\n                {\r\n                    HandleEnablingOfPublication(changeDescriptor);\r\n                }\r\n\r\n                if (updateDataTypeDescriptor.PublicationRemoved)\r\n                {\r\n                    HandleDisablingOfPublication(changeDescriptor);\r\n                }\r\n\r\n                foreach (DataScopeIdentifier dataScope in changeDescriptor.DeletedDataScopes)\r\n                {\r\n                    DropScopeData(changeDescriptor.AlteredType, dataScope);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void HandleDisablingOfPublication(DataTypeChangeDescriptor changeDescriptor)\r\n        {\r\n            IEnumerable<CultureInfo> locales = GetCultures(changeDescriptor.OriginalType);\r\n\r\n            foreach (CultureInfo locale in locales)\r\n            {\r\n                string oldTableName = GetConfiguredTableName(changeDescriptor.OriginalType, DataScopeIdentifier.Administrated, locale.Name);\r\n                string newTableName = DynamicTypesCommon.GenerateTableName(changeDescriptor.AlteredType, DataScopeIdentifier.Public, locale);\r\n\r\n                StringBuilder fieldList = GetCommonFields(changeDescriptor);\r\n\r\n                string removeCommandText = string.Format(@\"DELETE FROM [{0}];\", newTableName);\r\n                ExecuteNonQuery(removeCommandText);\r\n\r\n                string copyCommandText = string.Format(@\"\r\n                            INSERT INTO [{0}] ({2})\r\n                            SELECT {2}                             \r\n                            FROM [{1}];\", newTableName, oldTableName, fieldList);\r\n                ExecuteNonQuery(copyCommandText);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static StringBuilder GetCommonFields(DataTypeChangeDescriptor changeDescriptor)\r\n        {\r\n            var fieldList = new StringBuilder();\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in changeDescriptor.OriginalType.Fields)\r\n            {\r\n                if (!changeDescriptor.AlteredType.Fields.Any(f => f.Id == dataFieldDescriptor.Id)) continue;\r\n\r\n                if (fieldList.Length > 0) fieldList.Append(\", \");\r\n\r\n                fieldList.Append(\"[\" + dataFieldDescriptor.Name + \"]\");\r\n            }\r\n            return fieldList;\r\n        }\r\n\r\n\r\n\r\n        private void HandleEnablingOfPublication(DataTypeChangeDescriptor changeDescriptor)\r\n        {\r\n            IEnumerable<CultureInfo> locales = GetCultures(changeDescriptor.OriginalType);\r\n\r\n            foreach (CultureInfo locale in locales)\r\n            {\r\n                string oldTableName = GetConfiguredTableName(changeDescriptor.OriginalType, DataScopeIdentifier.Public, locale.Name);\r\n                string newTableName = DynamicTypesCommon.GenerateTableName(changeDescriptor.AlteredType, DataScopeIdentifier.Administrated, locale);\r\n\r\n                StringBuilder fieldList = GetCommonFields(changeDescriptor);\r\n\r\n                string copyCommandText = string.Format(@\"\r\n                            INSERT INTO [{0}] ({2})\r\n                            SELECT {2}                             \r\n                            FROM [{1}];\", newTableName, oldTableName, fieldList);\r\n                ExecuteNonQuery(copyCommandText);\r\n\r\n                string updateOldCommandText = string.Format(\"UPDATE [{0}] SET [{1}] = '{2}'\", oldTableName, \"PublicationStatus\", GenericPublishProcessController.Published);\r\n                ExecuteNonQuery(updateOldCommandText);\r\n\r\n                string updateNewCommandText = string.Format(\"UPDATE [{0}] SET [{1}] = '{2}'\", newTableName, \"PublicationStatus\", GenericPublishProcessController.Published);\r\n                ExecuteNonQuery(updateNewCommandText);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AlterScopeData(UpdateDataTypeDescriptor updateDataTypeDescriptor, DataTypeChangeDescriptor changeDescriptor, DataScopeIdentifier dataScope)\r\n        {\r\n            var culturesToDelete = new List<CultureInfo>();\r\n            var culturesToChange = new List<CultureInfo>();\r\n\r\n            var oldCultures = GetCultures(changeDescriptor.OriginalType).Evaluate();\r\n            var newCultures = GetCultures(changeDescriptor.AlteredType).Evaluate();\r\n\r\n            foreach (var culture in oldCultures)\r\n            {\r\n                if (newCultures.Contains(culture))\r\n                {\r\n                    culturesToChange.Add(culture);\r\n                }\r\n                else\r\n                {\r\n                    culturesToDelete.Add(culture);\r\n                }\r\n            }\r\n\r\n            var culturesToAdd = newCultures.Where(culture => !oldCultures.Contains(culture)).ToList();\r\n\r\n\r\n            culturesToAdd.ForEach(culture => CreateStore(changeDescriptor.AlteredType, dataScope, culture));\r\n            culturesToChange.ForEach(culture => AlterStore(updateDataTypeDescriptor, changeDescriptor, dataScope, culture));\r\n\r\n            if (updateDataTypeDescriptor.LocalesToCopyTo != null)\r\n            {\r\n                StringBuilder fieldList = GetCommonFields(changeDescriptor);\r\n\r\n                string fromTableName = GetConfiguredTableName(changeDescriptor.OriginalType, dataScope, \"\");\r\n\r\n                foreach (CultureInfo locale in updateDataTypeDescriptor.LocalesToCopyTo)\r\n                {\r\n                    string toTableName = DynamicTypesCommon.GenerateTableName(changeDescriptor.AlteredType, dataScope, locale);\r\n\r\n                    string copyCommandText = string.Format(@\"\r\n                            INSERT INTO [{0}] ({2})\r\n                            SELECT {2}                             \r\n                            FROM [{1}];\", toTableName, fromTableName, fieldList);\r\n                    ExecuteNonQuery(copyCommandText);\r\n\r\n                    string updateCommandText = string.Format(\"UPDATE [{0}] SET [{1}] = '{2}'\", toTableName, \"SourceCultureName\", locale.Name);\r\n                    ExecuteNonQuery(updateCommandText);\r\n                }\r\n\r\n                string removeCommandText = string.Format(@\"DELETE FROM [{0}];\", fromTableName);\r\n                ExecuteNonQuery(removeCommandText);\r\n            }\r\n\r\n            if (updateDataTypeDescriptor.LocaleToCopyFrom != null)\r\n            {\r\n                StringBuilder fieldList = GetCommonFields(changeDescriptor);\r\n\r\n                string fromTableName = GetConfiguredTableName(changeDescriptor.OriginalType, dataScope, updateDataTypeDescriptor.LocaleToCopyFrom.Name);\r\n                string toTableName = DynamicTypesCommon.GenerateTableName(changeDescriptor.AlteredType, dataScope, CultureInfo.InvariantCulture);\r\n\r\n                string copyCommandText = string.Format(@\"\r\n                            INSERT INTO [{0}] ({2})\r\n                            SELECT {2}                             \r\n                            FROM [{1}];\", toTableName, fromTableName, fieldList);\r\n                ExecuteNonQuery(copyCommandText);\r\n            }\r\n\r\n\r\n            culturesToDelete.ForEach(culture => DropStore(changeDescriptor.OriginalType, dataScope, culture));\r\n        }\r\n\r\n\r\n\r\n        private void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, DataTypeChangeDescriptor changeDescriptor, DataScopeIdentifier dataScope, CultureInfo culture)\r\n        {\r\n            try\r\n            {\r\n                string originalTableName = GetConfiguredTableName(changeDescriptor.OriginalType, dataScope, culture.Name);\r\n                string alteredTableName = originalTableName;\r\n\r\n                // This could be done more nicely! But only give the table a new name if the type has changed its name and not because we changed the naming scheme\r\n                if (updateDataTypeDescriptor.OldDataTypeDescriptor.Name != updateDataTypeDescriptor.NewDataTypeDescriptor.Name ||\r\n                    updateDataTypeDescriptor.OldDataTypeDescriptor.Namespace != updateDataTypeDescriptor.NewDataTypeDescriptor.Namespace)\r\n                {\r\n                    alteredTableName = DynamicTypesCommon.GenerateTableName(changeDescriptor.AlteredType, dataScope, culture);\r\n                }\r\n\r\n                var tables = GetTablesList();\r\n\r\n                if (!tables.Contains(originalTableName))\r\n                {\r\n                    throw new InvalidOperationException(\r\n                        $\"Unable to alter data type store for type '{changeDescriptor.AlteredType.GetFullInterfaceName()}'. The database does not contain expected table '{originalTableName}'\");\r\n                }\r\n\r\n\r\n                bool primaryKeyChanged = changeDescriptor.AddedKeyFields.Any() \r\n                                         || changeDescriptor.DeletedKeyFields.Any() \r\n                                         || changeDescriptor.KeyFieldsOrderChanged\r\n                                         || changeDescriptor.VersionKeyFieldsChanged\r\n                                         || changeDescriptor.OriginalType.PrimaryKeyIsClusteredIndex != changeDescriptor.AlteredType.PrimaryKeyIsClusteredIndex;\r\n\r\n                DropConstraints(originalTableName, primaryKeyChanged);\r\n\r\n                if (originalTableName != alteredTableName)\r\n                {\r\n                    if (tables.Contains(alteredTableName))\r\n                        throw new InvalidOperationException(\r\n                            $\"Can not rename table '{originalTableName}' to '{alteredTableName}'. A table with that name already exists\");\r\n                    RenameTable(originalTableName, alteredTableName);\r\n                }\r\n\r\n                var newIndexes = changeDescriptor.AlteredType.Indexes.Select(i => i.ToString()).ToList();\r\n                foreach (var oldIndex in changeDescriptor.OriginalType.Indexes)\r\n                {\r\n                    if (!newIndexes.Contains(oldIndex.ToString()))\r\n                    {\r\n                        DropIndex(alteredTableName, oldIndex);\r\n                    }\r\n                }\r\n\r\n                DropFields(alteredTableName, changeDescriptor.DeletedFields, changeDescriptor.OriginalType.Fields);\r\n                ImplementFieldChanges(alteredTableName, changeDescriptor.AlteredType, changeDescriptor.ExistingFields);\r\n\r\n\r\n                Dictionary<string, object> defaultValues = null;\r\n                if (updateDataTypeDescriptor.PublicationAdded)\r\n                {\r\n                    defaultValues = new Dictionary<string, object>\r\n                    {\r\n                        {\"PublicationStatus\", GenericPublishProcessController.Draft}\r\n                    };\r\n                }\r\n\r\n                AppendFields(alteredTableName, changeDescriptor, changeDescriptor.AddedFields, defaultValues);\r\n\r\n                // Clustered index has to be created first.\r\n                var createIndexActions = new List<Tuple<bool, Action>>();\r\n                \r\n                if (primaryKeyChanged)\r\n                {\r\n                    bool isClusteredIndex = changeDescriptor.AlteredType.PrimaryKeyIsClusteredIndex;\r\n\r\n                    createIndexActions.Add(new Tuple<bool, Action>(isClusteredIndex,\r\n                        () => ExecuteNonQuery(SetPrimaryKey(alteredTableName, changeDescriptor.AlteredType.PhysicalKeyPropertyNames, isClusteredIndex))\r\n                    ));\r\n                }\r\n\r\n                var oldIndexes = changeDescriptor.OriginalType.Indexes.Select(i => i.ToString()).ToList();\r\n                foreach (var newIndex in changeDescriptor.AlteredType.Indexes)\r\n                {\r\n                    if (!oldIndexes.Contains(newIndex.ToString()))\r\n                    {\r\n                        var index = newIndex;\r\n\r\n                        createIndexActions.Add(new Tuple<bool, Action>(newIndex.Clustered, \r\n                            () => CreateIndex(alteredTableName, index)));\r\n                    }\r\n                }\r\n\r\n                createIndexActions.Sort((a, b) => b.Item1.CompareTo(a.Item1));\r\n\r\n                foreach (var createIndex in createIndexActions)\r\n                {\r\n                    createIndex.Item2();\r\n                }\r\n\r\n                SqlTableInformationStore.ClearCache(_connectionString, originalTableName);\r\n                SqlTableInformationStore.ClearCache(_connectionString, alteredTableName);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw MakeVerboseException(ex);\r\n            }\r\n\r\n        }\r\n\r\n\r\n\r\n        internal void RenameTable(string oldTableName, string newTableName)\r\n        {\r\n            ExecuteStoredProcedure(\"sp_rename\", new[] { SqlQuoted(oldTableName), SqlQuoted(newTableName) });\r\n        }\r\n\r\n\r\n\r\n        internal void DropStoresForType(string providerName, DataTypeDescriptor typeDescriptor)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                foreach (DataScopeIdentifier dataScope in typeDescriptor.DataScopes)\r\n                {\r\n                    DropScopeData(typeDescriptor, dataScope);\r\n                }\r\n            }\r\n        }\r\n\r\n        private void DropScopeData(DataTypeDescriptor typeDescriptor, DataScopeIdentifier dataScope)\r\n        {\r\n            foreach (var culture in GetCultures(typeDescriptor))\r\n            {\r\n                DropStore(typeDescriptor, dataScope, culture);\r\n            }\r\n        }\r\n\r\n        private void DropStore(DataTypeDescriptor dataTypeDescriptor, DataScopeIdentifier dataScope, CultureInfo cultureInfo)\r\n        {\r\n            string tableName = GetConfiguredTableName(dataTypeDescriptor, dataScope, cultureInfo.Name);\r\n\r\n            if (string.IsNullOrEmpty(tableName))\r\n            {\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                var tables = GetTablesList();\r\n\r\n                if (tables.Contains(tableName))\r\n                {\r\n                    ExecuteNonQuery($\"DROP TABLE [{tableName}];\");\r\n\r\n                    SqlTableInformationStore.ClearCache(_connectionString, tableName);\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw MakeVerboseException(ex);\r\n            }\r\n        }\r\n\r\n        private void ImplementFieldChanges(\r\n            string tableName, \r\n            DataTypeDescriptor typeDescriptor,\r\n            IEnumerable<DataTypeChangeDescriptor.ExistingFieldInfo> existingFieldDescription)\r\n        {\r\n            foreach (var changedFieldDescriptor in existingFieldDescription)\r\n            {\r\n                // Recreating deleted constraints, if necessary - renaming the column/changing its type\r\n                bool changes = changedFieldDescriptor.AlteredFieldHasChanges;\r\n                var columnName = changedFieldDescriptor.OriginalField.Name;\r\n\r\n                ConfigureColumn(tableName, columnName, \r\n                    typeDescriptor,\r\n                    changedFieldDescriptor.AlteredField, changedFieldDescriptor.OriginalField, changes);\r\n            }\r\n        }\r\n\r\n\r\n        internal void RenameColumn(string tableName, string oldColumnName, string newColumnName)\r\n        {\r\n            string oldName = \"{0}.{1}\".FormatWith(tableName, oldColumnName);\r\n            ExecuteStoredProcedure(\"sp_rename\", new[] { SqlQuoted(oldName), SqlQuoted(newColumnName), \"'COLUMN'\" });\r\n        }\r\n\r\n        private void DropFields(string tableName, IEnumerable<DataFieldDescriptor> fieldsToDrop, IEnumerable<DataFieldDescriptor> fields)\r\n        {\r\n            var sql = new StringBuilder();\r\n\r\n            foreach (var deletedFieldDescriptor in fieldsToDrop)\r\n            {\r\n                var columnExists = fields.Any(f => f.Name.Equals(deletedFieldDescriptor.Name));\r\n\r\n                if (columnExists)\r\n                {\r\n                    sql.AppendFormat(\"ALTER TABLE [{0}] DROP COLUMN [{1}];\", tableName, deletedFieldDescriptor.Name);\r\n                }\r\n                else\r\n                {\r\n                    Log.LogWarning(typeof(SqlDataProvider).FullName, \"Column '{0}' on table '{1}' has already been dropped\", deletedFieldDescriptor.Name, tableName);\r\n                }\r\n            }\r\n\r\n            ExecuteNonQuery(sql.ToString());\r\n        }\r\n\r\n\r\n\r\n        private void AppendFields(string tableName, \r\n            DataTypeChangeDescriptor changeDescriptor,\r\n            IEnumerable<DataFieldDescriptor> addedFieldDescriptions, \r\n            Dictionary<string, object> defaultValues = null)\r\n        {\r\n            foreach (var addedFieldDescriptor in addedFieldDescriptions)\r\n            {\r\n                string fieldName = addedFieldDescriptor.Name;\r\n                object defaultValue = null;\r\n                if (defaultValues != null && defaultValues.ContainsKey(fieldName))\r\n                {\r\n                    defaultValue = defaultValues[addedFieldDescriptor.Name];\r\n                }\r\n\r\n\r\n\r\n                CreateColumn(tableName, changeDescriptor.AlteredType, addedFieldDescriptor, defaultValue);\r\n\r\n                // Updating VersionId field\r\n                if (addedFieldDescriptor.Name == nameof(IVersioned.VersionId)\r\n                    && changeDescriptor.AlteredType.SuperInterfaces.Contains(typeof (IVersioned)))\r\n                {\r\n                    string sourceField;\r\n\r\n                    if (changeDescriptor.AlteredType.DataTypeId == typeof (IPage).GetImmutableTypeId())\r\n                    {\r\n                        sourceField = nameof(IPage.Id);\r\n                    }\r\n                    else\r\n                    {\r\n                        sourceField = changeDescriptor.AlteredType.Fields\r\n                            .Where(f => f.InstanceType == typeof(Guid) \r\n                                        && (f.ForeignKeyReferenceTypeName?.Contains(typeof (IPage).FullName) ?? false))\r\n                            .OrderByDescending(f => f.Name == nameof(IPageData.PageId))\r\n                            .Select(f => f.Name)\r\n                            .FirstOrDefault();\r\n                    }\r\n\r\n                    if (sourceField != null)\r\n                    {\r\n                        string updateVersionIdCommandText =\r\n                            $\"UPDATE [{tableName}] SET [{nameof(IVersioned.VersionId)}] = [{sourceField}]\";\r\n                        ExecuteNonQuery(updateVersionIdCommandText);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<string> GetConstraints(string tableName, string constraintType = null)\r\n        {\r\n            /*\r\n                This is the list of all possible values for this column (xtype):\r\n                C = CHECK constraint \r\n                D = Default or DEFAULT constraint \r\n                F = FOREIGN KEY constraint \r\n                L = Log \r\n                P = Stored procedure \r\n                PK = PRIMARY KEY constraint (type is K) \r\n                RF = Replication filter stored procedure \r\n                S = System table \r\n                TR = Trigger \r\n                U = User table \r\n                UQ = UNIQUE constraint (type is K) \r\n                V = View \r\n                X = Extended stored procedure\r\n            */\r\n            string type = string.IsNullOrEmpty(constraintType) ? string.Empty : string.Format(\" AND s.xtype = '{0}'\", constraintType);\r\n\r\n            string commandText = string.Format(@\"\r\n\t\t\t\tSELECT * FROM sysobjects s\r\n\t\t\t\tINNER JOIN sysobjects t ON s.parent_obj = t.id\r\n\t\t\t\tWHERE t.name = '{0}'{1}\", tableName, type);\r\n\r\n            var dt = ExecuteReader(commandText);\r\n            var constraints = (from DataRow dr in dt.Rows select dr[\"Name\"].ToString()).ToList();\r\n\r\n            return constraints;\r\n        }\r\n\r\n        private void DropConstraints(string tableName, bool includingPrimaryKey)\r\n        {\r\n            var sql = new StringBuilder();\r\n            var constraints = GetConstraints(tableName);\r\n\r\n            foreach (var constraint in constraints)\r\n            {\r\n                if (includingPrimaryKey || !IsPrimaryKeyContraint(constraint))\r\n                {\r\n                    sql.AppendFormat(\"ALTER TABLE [{0}] DROP CONSTRAINT [{1}];\", tableName, constraint);\r\n                }\r\n            }\r\n\r\n            ExecuteNonQuery(sql.ToString());\r\n        }\r\n\r\n        internal string SetPrimaryKey(string tableName, IEnumerable<string> fieldNames, bool createAsClustered)\r\n        {\r\n            if (!fieldNames.Any())\r\n            {\r\n                return string.Empty;\r\n            }\r\n\r\n            string primaryKeyIndexName = GeneratePrimaryKeyContraintName(tableName);\r\n\r\n            return string.Format(\"ALTER TABLE [{0}] ADD CONSTRAINT [{1}] PRIMARY KEY{2}({3});\", tableName, primaryKeyIndexName,\r\n                                    createAsClustered ? \" CLUSTERED \" : \" NONCLUSTERED \", string.Join(\",\", fieldNames.Distinct().Select(field => \"[\" + field + \"]\")));\r\n        }\r\n\r\n        private Exception MakeVerboseException(Exception ex)\r\n        {\r\n            var message = new StringBuilder();\r\n            Exception nested = ex;\r\n            while (nested != null)\r\n            {\r\n                message.Append(nested.Message);\r\n                message.Append(\" \");\r\n                nested = nested.InnerException;\r\n            }\r\n            return new InvalidOperationException(message.ToString(), ex);\r\n        }\r\n\r\n\r\n\r\n        private void CreateColumn(string tableName, DataTypeDescriptor typeDescriptor, DataFieldDescriptor fieldDescriptor, object defaultValue = null)\r\n        {\r\n            if (defaultValue == null && !fieldDescriptor.IsNullable && fieldDescriptor.DefaultValue != null)\r\n            {\r\n                ExecuteNonQuery(\"ALTER TABLE [{0}] ADD {1};\"\r\n                            .FormatWith(tableName, GetColumnInfo(tableName, fieldDescriptor.Name, typeDescriptor, fieldDescriptor, true, false)));\r\n                return;\r\n            }\r\n\r\n            // Creating a column, making it nullable\r\n            ExecuteNonQuery(\"ALTER TABLE [{0}] ADD {1};\"\r\n                            .FormatWith(tableName, GetColumnInfo(tableName, fieldDescriptor.Name, typeDescriptor, fieldDescriptor, true, true)));\r\n\r\n            // Setting default value with \"UPDATE\" statement\r\n            if (defaultValue != null || (!fieldDescriptor.IsNullable && fieldDescriptor.DefaultValue == null))\r\n            {\r\n                string defaultValueStr;\r\n\r\n                if(defaultValue != null)\r\n                {\r\n                    Type typeOfDefaultValue = defaultValue.GetType();\r\n                    defaultValueStr = (typeOfDefaultValue == typeof(string) || typeOfDefaultValue == typeof(Guid))\r\n                                    ? (\"'\" + defaultValue + \"'\")\r\n                                    : defaultValue.ToString();\r\n                }\r\n                else\r\n                {\r\n                    defaultValueStr = GetDefaultValueText(fieldDescriptor.StoreType);\r\n                }\r\n\r\n                ExecuteNonQuery(\"UPDATE [{0}] SET [{1}] = {2};\"\r\n                                .FormatWith(tableName, fieldDescriptor.Name, defaultValueStr));\r\n            }\r\n\r\n            // Making column not nullable if necessary\r\n            if(!fieldDescriptor.IsNullable)\r\n            {\r\n                AlterColumn(tableName, GetColumnInfo(tableName, fieldDescriptor.Name, typeDescriptor, fieldDescriptor, false, false));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ConfigureColumn(string tableName, string columnName, \r\n            DataTypeDescriptor typeDescriptor,\r\n            DataFieldDescriptor fieldDescriptor, DataFieldDescriptor originalFieldDescriptor, bool changes)\r\n        {\r\n            string fieldName = fieldDescriptor.Name;\r\n\r\n            if (columnName != fieldName)\r\n            {\r\n                RenameColumn(tableName, columnName, fieldName);\r\n            }\r\n\r\n            if(changes)\r\n            {\r\n                bool fieldBecameRequired = !fieldDescriptor.IsNullable && originalFieldDescriptor.IsNullable;\r\n\r\n                if(fieldBecameRequired)\r\n                {\r\n                    if (fieldDescriptor.StoreType.ToString() != originalFieldDescriptor.StoreType.ToString())\r\n                    {\r\n                        AlterColumn(tableName, GetColumnInfo(tableName, fieldName, typeDescriptor, fieldDescriptor, false, true));\r\n                    }\r\n\r\n                    string defaultValue = TranslatesIntoDefaultConstraint(fieldDescriptor.DefaultValue)\r\n                                              ? GetDefaultValueText(fieldDescriptor.DefaultValue)\r\n                                              : GetDefaultValueText(fieldDescriptor.StoreType); \r\n\r\n                    ExecuteNonQuery(\"UPDATE [{0}] SET [{1}] = {2} WHERE [{1}] IS NULL\"\r\n                                    .FormatWith(tableName, fieldDescriptor.Name, defaultValue));\r\n                }\r\n\r\n                AlterColumn(tableName, GetColumnInfo(tableName, fieldDescriptor.Name, typeDescriptor, fieldDescriptor, false, false));\r\n            }\r\n\r\n            ExecuteNonQuery(SetDefaultValue(tableName, fieldDescriptor.Name, fieldDescriptor.DefaultValue));\r\n        }\r\n\r\n        private void AlterColumn(string tableName, string columnInfo)\r\n        {\r\n            ExecuteNonQuery(string.Format(\"ALTER TABLE [{0}] ALTER COLUMN {1};\", tableName, columnInfo));\r\n        }\r\n\r\n        internal string GetColumnInfo(string tableName, string columnName, \r\n            DataTypeDescriptor dataTypeDescriptor,\r\n            DataFieldDescriptor fieldDescriptor, bool includeDefault, bool forceNullable)\r\n        {\r\n            string defaultInfo = string.Empty;\r\n            string fieldName = fieldDescriptor.Name;\r\n            bool isKeyField = dataTypeDescriptor.KeyPropertyNames.Contains(fieldName)\r\n                || fieldDescriptor.ForeignKeyReferenceTypeName != null;\r\n\r\n            if (TranslatesIntoDefaultConstraint(fieldDescriptor.DefaultValue))\r\n            {\r\n                if (includeDefault)\r\n                {\r\n                    defaultInfo = string.Format(\"CONSTRAINT [{0}] DEFAULT {1}\", SqlSafeName(\"DF\", tableName, columnName), GetDefaultValueText(fieldDescriptor.DefaultValue));\r\n                }\r\n            }\r\n\r\n            // Enabling case sensitive comparison for the random string fields\r\n            \r\n            var defaultValue = fieldDescriptor.DefaultValue;\r\n\r\n            string collation = string.Empty;\r\n            if (defaultValue?.ValueType == DefaultValueType.RandomString\r\n                || (isKeyField && fieldDescriptor.StoreType.IsString))\r\n            {\r\n                collation = \"COLLATE Latin1_General_CS_AS\";\r\n            }\r\n            \r\n            return string.Format(\r\n                \"[{0}] {1} {2} {3} {4}\",\r\n                fieldDescriptor.Name,\r\n                DynamicTypesCommon.MapStoreTypeToSqlDataType(fieldDescriptor.StoreType),\r\n                collation,\r\n                fieldDescriptor.IsNullable || forceNullable ? \"NULL\" : \"NOT NULL\",\r\n                defaultInfo);\r\n        }\r\n\r\n        private string SetDefaultValue(string tableName, string columnName, DefaultValue defaultValue)\r\n        {\r\n            if (!TranslatesIntoDefaultConstraint(defaultValue))\r\n                return string.Empty;\r\n\r\n            string constraintName = SqlSafeName(\"DF\", tableName, columnName);\r\n            return string.Format(\"ALTER TABLE [{0}] ADD CONSTRAINT [{1}] DEFAULT {2} FOR [{3}];\", tableName, constraintName, GetDefaultValueText(defaultValue), columnName);\r\n        }\r\n\r\n        private string GetDefaultValueText(StoreFieldType storeFieldType)\r\n        {\r\n            Verify.ArgumentNotNull(storeFieldType, \"storeFieldType\");\r\n\r\n            switch (storeFieldType.PhysicalStoreType)\r\n            {\r\n                case PhysicalStoreFieldType.String:\r\n                case PhysicalStoreFieldType.LargeString:\r\n                    return \"N''\";\r\n                case PhysicalStoreFieldType.Guid:\r\n                    return \"'00000000-0000-0000-0000-000000000000'\";\r\n                case PhysicalStoreFieldType.Integer:\r\n                case PhysicalStoreFieldType.Long:\r\n                case PhysicalStoreFieldType.Decimal:\r\n                    return \"0\";\r\n                case PhysicalStoreFieldType.Boolean:\r\n                    return \"0\";\r\n                case PhysicalStoreFieldType.DateTime:\r\n                    return \"getdate()\";\r\n            }\r\n\r\n            throw new NotImplementedException(\"Supplied StoreFieldType contains an unsupported PhysicalStoreType '{0}'.\"\r\n                                              .FormatWith(storeFieldType.PhysicalStoreType));\r\n        }\r\n\r\n        private bool TranslatesIntoDefaultConstraint(DefaultValue defaultValue)\r\n        {\r\n            return defaultValue != null && defaultValue.ValueType != DefaultValueType.RandomString;\r\n        }\r\n\r\n        private string GetDefaultValueText(DefaultValue defaultValue)\r\n        {\r\n            Verify.ArgumentNotNull(defaultValue, \"defaultValue\");\r\n\r\n            switch (defaultValue.ValueType)\r\n            {\r\n                case DefaultValueType.DateTimeNow:\r\n                    return \"getdate()\";\r\n                case DefaultValueType.String:\r\n                case DefaultValueType.Guid:\r\n                    return \"N\" + SqlQuoted(defaultValue.Value);\r\n                case DefaultValueType.NewGuid:\r\n                    return \"newid()\";\r\n                case DefaultValueType.Integer:\r\n                    return defaultValue.Value.ToString();\r\n                case DefaultValueType.Boolean:\r\n                    return ((bool)defaultValue.Value ? \"1\" : \"0\");\r\n                case DefaultValueType.DateTime:\r\n                    return SqlQuoted(((DateTime)defaultValue.Value).ToString(\"yyyy-MM-dd HH:mm:ss\"));\r\n                case DefaultValueType.Decimal:\r\n                    return ((decimal)defaultValue.Value).ToString(\"F\", CultureInfo.InvariantCulture);\r\n            }\r\n\r\n            throw new NotImplementedException(\"Supplied DefaultValue contains an unsupported DefaultValueType '{0}'.\"\r\n                                              .FormatWith(defaultValue.ValueType));\r\n        }\r\n\r\n        private void CreateIndex(string tableName, DataTypeIndex index)\r\n        {\r\n            string indexName = GetIndexName(index);\r\n\r\n            var fields = new StringBuilder();\r\n            foreach (var field in index.Fields)\r\n            {\r\n                if (fields.Length > 0)\r\n                {\r\n                    fields.Append(\", \");\r\n                }\r\n                fields.Append('[').Append(field.Item1).Append(']');\r\n                if (field.Item2 == IndexDirection.Descending)\r\n                {\r\n                    fields.Append(\" DESC\");\r\n                }\r\n            }\r\n\r\n            var sql = string.Format(\"CREATE {0}CLUSTERED INDEX [{1}] ON [{2}] ({3})\",\r\n                            !index.Clustered ? \"NON\" : \"\",\r\n                            indexName, \r\n                            tableName, \r\n                            fields);\r\n\r\n            ExecuteNonQuery(sql);\r\n        }\r\n\r\n        private void DropIndex(string tableName, DataTypeIndex index)\r\n        {\r\n             string indexName = GetIndexName(index);\r\n\r\n            var sql = string.Format(\"DROP INDEX [{0}] ON [{1}]\", indexName,  tableName);\r\n\r\n            ExecuteNonQuery(sql);\r\n        }\r\n\r\n        private string GetIndexName(DataTypeIndex index)\r\n        {\r\n            var result = new StringBuilder().Append(\"IX_\");\r\n            foreach (var field in index.Fields)\r\n            {\r\n                result.Append('_').Append(field.Item1);\r\n            }\r\n            return result.ToString();\r\n        }\r\n\r\n        private string SqlQuoted(object obj)\r\n        {\r\n            return SqlQuoted(obj.ToString());\r\n        }\r\n\r\n        private static string SqlQuoted(string theString)\r\n        {\r\n            return string.Format(\"'{0}'\", theString.Replace(\"'\", \"''\"));\r\n        }\r\n\r\n        private static bool IsPrimaryKeyContraint(string contraintName)\r\n        {\r\n            return contraintName.StartsWith(\"PK_\");\r\n        }\r\n\r\n        private static string GeneratePrimaryKeyContraintName(string tableName)\r\n        {\r\n            return SqlSafeName(\"PK\", tableName);\r\n        }\r\n\r\n        private static string SqlSafeName(string prefix, string elementName)\r\n        {\r\n            string name = string.Format(\"{0}_{1}\", prefix, elementName);\r\n\r\n            if (name.Length > 128)\r\n            {\r\n\r\n                string random = System.IO.Path.GetRandomFileName();\r\n                name = name.Substring(0, 128 - random.Length) + random;\r\n            }\r\n\r\n            return name;\r\n        }\r\n\r\n        private static string SqlSafeName(string prefix, string parentName, string subName)\r\n        {\r\n            string stem = string.Format(\"{0}_{1}_\", prefix, parentName);\r\n\r\n            if (stem.Length + subName.Length > 128)\r\n            {\r\n                stem = stem.Substring(0, 127 - subName.Length) + \"_\";\r\n            }\r\n\r\n            return stem + subName;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/SqlDataTypeStoreTable.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal sealed class SqlDataTypeStoreTable\r\n    {\r\n        public SqlDataTypeStoreTable(\r\n            Guid dataTypeId,\r\n            FieldInfo dataContextQueryableFieldInfo, ISqlDataProviderHelper sqlDataProviderHelper,\r\n            string dataContextFieldName, Type dataContextFieldType)\r\n        {\r\n            DataTypeId = dataTypeId;\r\n            DataContextQueryableFieldInfo = dataContextQueryableFieldInfo;\r\n            SqlDataProviderHelper = sqlDataProviderHelper;\r\n            DataContextFieldName = dataContextFieldName;\r\n            DataContextFieldType = dataContextFieldType;\r\n        }\r\n\r\n        public Guid DataTypeId { get; set; }\r\n\r\n        public FieldInfo DataContextQueryableFieldInfo { get; set; }\r\n\r\n        public ISqlDataProviderHelper SqlDataProviderHelper { get; set; }\r\n\r\n        public string DataContextFieldName { get; set; }\r\n\r\n        public Type DataContextFieldType { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/SqlDataTypeStoreTableKey.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)]\r\n    internal class SqlDataTypeStoreTableKey : Tuple<string, string>\r\n    {\r\n        public SqlDataTypeStoreTableKey(string dataScopeIdentifierName, string localeCultureName)\r\n            : base(dataScopeIdentifierName, localeCultureName)\r\n        {\r\n\r\n        }\r\n\r\n\r\n        public string DataScopeIdentifierName\r\n        {\r\n            get\r\n            {\r\n                return Item1;\r\n            }\r\n        }\r\n\r\n\r\n        public string LocaleCultureName\r\n        {\r\n            get\r\n            {\r\n                return Item2;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/SqlLoggerTextWriter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Threading;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation\r\n{\r\n    internal sealed class SqlLoggerTextWriter : System.IO.TextWriter\r\n    {\r\n        private static readonly Regex ContainsParamRegex = new Regex(@\"@(p|x)[0-9]+\", RegexOptions.Compiled);\r\n        private static readonly Regex ParamRegex = new Regex(@\"-- (?<param>@(p|x)[0-9]+):\", RegexOptions.Compiled);\r\n\r\n        private readonly SqlLoggingContext _sqlLoggingContext;\r\n\r\n        private readonly ConcurrentDictionary<int, Tuple<string, Dictionary<string, string>>> _threadData \r\n            = new ConcurrentDictionary<int, Tuple<string, Dictionary<string, string>>>();\r\n\r\n        public SqlLoggerTextWriter(SqlLoggingContext sqlLoggingContext)\r\n        {\r\n            _sqlLoggingContext = sqlLoggingContext;\r\n            if (_sqlLoggingContext.TablesToIgnore == null) _sqlLoggingContext.TablesToIgnore = new List<string>();\r\n        }\r\n\r\n\r\n\r\n        public override Encoding Encoding => Encoding.UTF8;\r\n\r\n\r\n        public override void WriteLine(string value)\r\n        {\r\n            if (!value.StartsWith(\"--\"))\r\n            {\r\n                HandleNewQuery(value);\r\n            }\r\n            else if (!value.StartsWith(\"-- Context:\"))\r\n            {\r\n                HandleParameter(value);\r\n            }\r\n            else\r\n            {\r\n                HandleEndQuery();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void HandleNewQuery(string value)\r\n        {\r\n            if (_sqlLoggingContext.TablesToIgnore.Any(value.Contains))\r\n            {\r\n                return;\r\n            }\r\n\r\n\r\n            int parameterCount = ContainsParamRegex.Matches(value).Count;\r\n\r\n            if (parameterCount == 0)\r\n            {\r\n                AddLogEntry(value);\r\n                return;\r\n            }\r\n\r\n            var entry = new Tuple<string, Dictionary<string, string>>(value, new Dictionary<string, string>());\r\n\r\n            _threadData[Thread.CurrentThread.ManagedThreadId] = entry;\r\n        }\r\n\r\n\r\n\r\n        private void HandleParameter(string value)\r\n        {\r\n            Tuple<string, Dictionary<string, string>> entry;\r\n\r\n            if (!_threadData.TryGetValue(Thread.CurrentThread.ManagedThreadId, out entry))\r\n            {\r\n                return;\r\n            }\r\n\r\n            Match match = ParamRegex.Match(value);\r\n\r\n            string paramId = match.Groups[\"param\"].Value;\r\n            if (string.IsNullOrEmpty(paramId))\r\n            {\r\n                Log.LogWarning(nameof(SqlLoggerTextWriter), \"Failed to parse parameter line: \" + value);\r\n                return;\r\n            }\r\n\r\n            string paramValue = value.Substring(value.IndexOf('['));\r\n            entry.Item2.Add(paramId, paramValue);\r\n        }\r\n\r\n\r\n\r\n        public void HandleEndQuery()\r\n        {\r\n            Tuple<string, Dictionary<string, string>> entry;\r\n\r\n            var threadId = Thread.CurrentThread.ManagedThreadId;\r\n\r\n            if (_threadData.TryRemove(threadId, out entry))\r\n            {\r\n                string value = entry.Item1;\r\n                foreach (var kvp in entry.Item2)\r\n                {\r\n                    value = value.Replace(kvp.Key, kvp.Value);\r\n                }\r\n\r\n                AddLogEntry(value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void AddLogEntry(string value)\r\n        {\r\n            if (_sqlLoggingContext.IncludeStack)\r\n            {\r\n                var sb = new StringBuilder();\r\n                sb.AppendLine(value);\r\n                sb.AppendLine(\"Stack trace:\");\r\n\r\n                var trace = new StackTrace(8, true);\r\n                foreach (StackFrame stackFrame in trace.GetFrames())\r\n                {\r\n                    MemberInfo methodInfo = stackFrame.GetMethod();\r\n\r\n                    string type = \"\";\r\n                    if (methodInfo.DeclaringType != null)\r\n                    {\r\n                        type = methodInfo.DeclaringType.FullName;\r\n                    }\r\n\r\n                    sb.AppendLine($\"   at {type}.{methodInfo.Name} line {stackFrame.GetFileLineNumber()}\");\r\n                }\r\n\r\n                value = sb.ToString();\r\n            }\r\n\r\n            Log.LogVerbose(\"RGB(0, 128, 192)SqlQuery\", value);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/ISqlDataProviderHelper.cs",
    "content": "using System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public interface ISqlDataProviderHelper\r\n    {\r\n        /// <exclude />\r\n        IData GetDataById(IQueryable queryable, IDataId dataId, DataProviderContext dataProviderContext);\r\n\r\n        /// <exclude />\r\n        IData AddData(ISqlDataContext dataContext, IData dataToAdd, DataProviderContext dataProviderContext);\r\n\r\n        /// <exclude />\r\n        void RemoveData(ISqlDataContext dataContext, IData dataToRemove);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Sql/ISqlTableInformation.cs",
    "content": "using System.Collections.Generic;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface ISqlTableInformation\r\n    {\r\n        /// <exclude />\r\n        string TableName { get; }\r\n\r\n        /// <exclude />\r\n        bool HasIdentityColumn { get; }\r\n\r\n        /// <exclude />\r\n        string IdentityColumnName { get; }\r\n\r\n        /// <exclude />\r\n        SqlColumnInformation this[string columnName] { get; }\r\n\r\n        /// <exclude />\r\n        IEnumerable<SqlColumnInformation> ColumnInformations { get; }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Sql/ISqlTableInformationStore.cs",
    "content": "﻿namespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql\r\n{\r\n\tinternal interface ISqlTableInformationStore\r\n\t{\r\n        ISqlTableInformation GetTableInformation(string connectionString, string tableName);\r\n        void ClearCache(string connectionString, string tableName);\r\n        void OnFlush();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Sql/SqlColumnInformation.cs",
    "content": "using System;\r\nusing System.Data;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql\r\n{\r\n    internal static class SqlColumnInformationExtensions\r\n    {\r\n        public static SqlColumnInformation CreateSqlColumnInformation(this DataTypeDescriptor dataTypeDescriptor, string fieldName)\r\n        {\r\n            DataFieldDescriptor dataFieldDescriptor = dataTypeDescriptor.Fields[fieldName];\r\n\r\n            return new SqlColumnInformation(\r\n                dataFieldDescriptor.Name,\r\n                dataTypeDescriptor.PhysicalKeyPropertyNames.Contains(dataFieldDescriptor.Name),\r\n                false,\r\n                false,\r\n                dataFieldDescriptor.IsNullable,\r\n                dataFieldDescriptor.InstanceType,\r\n                DynamicTypesCommon.GetStoreTypeToSqlDataTypeMapping(dataFieldDescriptor.StoreType)\r\n            );\r\n       }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    public sealed class SqlColumnInformation\r\n    {\r\n        private readonly string _columnName;\r\n        private readonly string _trimmedColumnName;\r\n        private readonly bool _isPrimaryKey;\r\n        private readonly bool _isIdentity;\r\n        private readonly bool _isComputed;\r\n        private readonly bool _isNullable;\r\n        private readonly Type _type;\r\n        private readonly SqlDbType _sqlDbType;\r\n\r\n        private int? _hashCode;\r\n\r\n        internal SqlColumnInformation(\r\n            string columnName,\r\n            bool isPrimaryKey,\r\n            bool isIdentity,\r\n            bool isComputed,\r\n            bool isNullable,\r\n            Type type,\r\n            SqlDbType sqlDbType)\r\n        {\r\n            _columnName = columnName;\r\n            _trimmedColumnName = _columnName.Replace(\" \", \"\");\r\n            _isPrimaryKey = isPrimaryKey;\r\n            _isIdentity = isIdentity;\r\n            _isComputed = isComputed;\r\n            _isNullable = isNullable;\r\n            _type = type;\r\n            _sqlDbType = sqlDbType;\r\n        }        \r\n\r\n\r\n        /// <exclude />\r\n        public string ColumnName => _columnName;\r\n\r\n\r\n        /// <exclude />\r\n        public string TrimmedColumnName => _trimmedColumnName;\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsPrimaryKey => _isPrimaryKey;\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsIdentity => _isIdentity;\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsComputed => _isComputed;\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsNullable => _isNullable;\r\n\r\n\r\n        /// <exclude />\r\n        public Type Type => _type;\r\n\r\n\r\n        /// <exclude />\r\n        public SqlDbType SqlDbType => _sqlDbType;\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            if (!_hashCode.HasValue)\r\n            {\r\n                _hashCode = _columnName.GetHashCode() ^\r\n                           _trimmedColumnName.GetHashCode() ^\r\n                           _isPrimaryKey.GetHashCode() ^\r\n                           _isIdentity.GetHashCode() ^\r\n                           _isComputed.GetHashCode() ^\r\n                           _isNullable.GetHashCode() ^\r\n                           _type.GetHashCode() ^\r\n                           _sqlDbType.GetHashCode();\r\n            }\r\n\r\n            return _hashCode.Value;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Sql/SqlTableInformation.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql\r\n{\r\n    internal sealed class SqlTableInformation : ISqlTableInformation\r\n    {\r\n        private readonly string _tableName;\r\n        private bool _hasIdentityColumn;\r\n        private string _identityColumnName;\r\n\r\n        private readonly Dictionary<string, SqlColumnInformation> _columns = new Dictionary<string, SqlColumnInformation>();\r\n        private int? _hashCode;\r\n\r\n        internal SqlTableInformation(string tableName)\r\n        {\r\n            _tableName = tableName;\r\n        }\r\n\r\n\r\n        public string TableName\r\n        {\r\n            get { return _tableName; }\r\n        }\r\n\r\n\r\n        public bool HasIdentityColumn\r\n        {\r\n            get { return _hasIdentityColumn; }\r\n        }\r\n\r\n\r\n        public string IdentityColumnName\r\n        {\r\n            get { return _identityColumnName; }\r\n        }\r\n\r\n\r\n        public SqlColumnInformation this[string columnName]\r\n        {\r\n            get\r\n            {\r\n                return _columns[columnName];\r\n            }\r\n        }\r\n\r\n\r\n        public IEnumerable<SqlColumnInformation> ColumnInformations\r\n        {\r\n            get\r\n            {\r\n                foreach(SqlColumnInformation column in _columns.Values)\r\n                {\r\n                    yield return column;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        internal void AddColumnInformation(SqlColumnInformation columnInformation)\r\n        {\r\n            if (columnInformation.IsIdentity)\r\n            {\r\n                _hasIdentityColumn = true;\r\n                _identityColumnName = columnInformation.ColumnName;\r\n            }\r\n\r\n            _columns.Add(columnInformation.ColumnName, columnInformation);\r\n\r\n            _hashCode = null;\r\n        }\r\n\r\n\r\n        public override int GetHashCode()\r\n        {\r\n            if (!_hashCode.HasValue)\r\n            {\r\n                int calculatedHashCode =_tableName.GetHashCode() ^\r\n                                        _hasIdentityColumn.GetHashCode() ^\r\n                                        _columns.GetContentHashCode();\r\n\r\n                if (_hasIdentityColumn)\r\n                {\r\n                    calculatedHashCode  ^= _identityColumnName.GetHashCode();\r\n                }\r\n\r\n                _hashCode = calculatedHashCode;\r\n            }\r\n\r\n            return _hashCode.Value;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Sql/SqlTableInformationStore.cs",
    "content": "﻿using Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class SqlTableInformationStore\r\n    {\r\n        private static ISqlTableInformationStore _implementation = new SqlTableInformationStoreImpl();\r\n\r\n        internal static ISqlTableInformationStore Implementation { get { return _implementation; } set { _implementation = value; } }\r\n\r\n\r\n        static SqlTableInformationStore()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static ISqlTableInformation GetTableInformation(string connectionString, string tableName)\r\n        {\r\n            return _implementation.GetTableInformation(connectionString, tableName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static void ClearCache(string connectionString, string tableName)\r\n        {\r\n            _implementation.ClearCache(connectionString, tableName);\r\n        }\r\n\r\n\r\n        internal static void Flush()\r\n        {\r\n            _implementation.OnFlush();\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Sql/SqlTableInformationStoreImpl.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Data.Common;\r\nusing System.Data.SqlClient;\r\nusing System.Data.SqlTypes;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Sql;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql\r\n{\r\n    internal class SqlTableInformationStoreImpl : ISqlTableInformationStore\r\n    {\r\n        private static Dictionary<string, ISqlTableInformation> _tableInformationCache = new Dictionary<string, ISqlTableInformation>();\r\n        private static Dictionary<string, Dictionary<string, ColumnInfo>> _columnsInformationCache;\r\n        \r\n        public ISqlTableInformation GetTableInformation(string connectionString, string tableName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(connectionString, \"connectionString\");\r\n            Verify.ArgumentNotNullOrEmpty(tableName, \"tableName)\");\r\n\r\n            string key = GetTableCacheKey(connectionString, tableName);\r\n\r\n            if (!_tableInformationCache.ContainsKey(key))\r\n            {\r\n                SqlTableInformation sqlTableInformation = CreateSqlTableInformation(connectionString, tableName);\r\n                _tableInformationCache.Add(key, sqlTableInformation);\r\n            }\r\n\r\n            return _tableInformationCache[key];\r\n        }\r\n\r\n\r\n\r\n        public void OnFlush()\r\n        {\r\n            _tableInformationCache = new Dictionary<string, ISqlTableInformation>();\r\n            _columnsInformationCache = null;\r\n        }\r\n\r\n        public void ClearCache(string connectionString, string tableName)\r\n        {\r\n            _tableInformationCache.Remove(GetTableCacheKey(connectionString, tableName));\r\n            _columnsInformationCache = null;\r\n        }\r\n\r\n        private static string GetTableCacheKey(string connectionString, string tableName)\r\n        {\r\n            return tableName + \" \" + connectionString.GetHashCode();\r\n        }\r\n\r\n        private static Dictionary<string, ColumnInfo> GetColumnsInfo(SqlConnection connection, string tableName)\r\n        {\r\n            var columnsCache = _columnsInformationCache;\r\n            if(columnsCache == null)\r\n            {\r\n                columnsCache = new Dictionary<string, Dictionary<string, ColumnInfo>>();\r\n\r\n                const string queryString =\r\n                @\"SELECT tableName = obj.name,\r\n                       columnName = col.name,\r\n                       isPrimaryKey = CASE WHEN tc.CONSTRAINT_TYPE = 'PRIMARY KEY' THEN 1 ELSE 0 END,\r\n                       isIdentity = CASE WHEN col.status & 0x80 = 0 THEN 0 ELSE 1 END,\r\n                       isComputed = col.iscomputed,\r\n                       isNullable = col.isnullable\r\n                  FROM SysObjects obj\r\n                  INNER JOIN\r\n                       SysColumns col\r\n                  ON obj.id = col.id\r\n                  LEFT OUTER JOIN\r\n                       (INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu\r\n\t                   INNER JOIN\r\n                            INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc\r\n  \t                 ON tc.TABLE_NAME = kcu.TABLE_NAME AND tc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME AND tc.CONSTRAINT_TYPE = 'PRIMARY KEY')\r\n                  ON obj.name = kcu.TABLE_NAME AND col.name = kcu.COLUMN_NAME\r\n                  where obj.xtype = 'U' AND exists(select * from INFORMATION_SCHEMA.TABLES t where t.TABLE_NAME = obj.name AND t.TABLE_SCHEMA = SCHEMA_NAME()) \r\n                  ORDER BY col.colorder\";\r\n\r\n                using (var command = new SqlCommand(queryString, connection))\r\n                {\r\n                    using (var reader = command.ExecuteReader())\r\n                    {\r\n                        foreach (DbDataRecord record in reader)\r\n                        {\r\n                            string tblName = record.GetString(0);\r\n\r\n                            if (!columnsCache.ContainsKey(tblName))\r\n                            {\r\n                                columnsCache.Add(tblName, new Dictionary<string, ColumnInfo>());\r\n                            }\r\n\r\n                            string fieldName = record.GetString(1);\r\n                            columnsCache[tblName].Add(fieldName, new ColumnInfo\r\n                            {\r\n                                TableName = tblName,\r\n                                Name = fieldName,\r\n                                IsPrimaryKey = record.GetInt32(2) == 1,\r\n                                IsIdentity = record.GetInt32(3) == 1,\r\n                                IsComputed = record.GetInt32(4) == 1,\r\n                                IsNullable = record.GetInt32(5) == 1\r\n                            });\r\n                        }\r\n                    }\r\n                }\r\n\r\n                string[] tableNames = columnsCache.Keys.ToArray();\r\n\r\n                if (tableNames.Any())\r\n                {\r\n                    // Performing a query with will get no rows but provide us with columns' types information\r\n                    var fieldTypesQuery = string.Join(\";\", tableNames.Select(t => \"SELECT * FROM [{0}] WHERE 1 = 2\".FormatWith(t)));\r\n\r\n                    int index = 0;\r\n\r\n                    using (var command = new SqlCommand(fieldTypesQuery, connection))\r\n                    using (var reader = command.ExecuteReader())\r\n                    {\r\n                        do\r\n                        {\r\n                            Verify.That(index < tableNames.Length, \"Too many results received\");\r\n\r\n                            for (int i = 0; i < reader.FieldCount; ++i)\r\n                            {\r\n                                string name = reader.GetName(i);\r\n                                Type type = reader.GetProviderSpecificFieldType(i);\r\n\r\n                                var fieldsInfo = columnsCache[tableNames[index]];\r\n                                fieldsInfo[name].Type = type;\r\n                            }\r\n\r\n                            index++;\r\n                        } while (reader.NextResult());\r\n                    }\r\n                }\r\n\r\n                _columnsInformationCache = columnsCache;\r\n            }\r\n\r\n            return columnsCache.ContainsKey(tableName) ? columnsCache[tableName] : new Dictionary<string, ColumnInfo>();\r\n        }\r\n\r\n\r\n        private static SqlTableInformation CreateSqlTableInformation(string connectionString, string tableName)\r\n        {\r\n            var connection = SqlConnectionManager.GetConnection(connectionString);\r\n\r\n            var columns = GetColumnsInfo(connection, tableName);\r\n\r\n            // Checking if the necessary table exists\r\n            if(columns.Count == 0)\r\n            {\r\n                return null;\r\n            }\r\n            \r\n            var tableInformation = new SqlTableInformation(tableName);\r\n\r\n            foreach(var column in columns.Values)\r\n            {\r\n                tableInformation.AddColumnInformation(\r\n                        new SqlColumnInformation(\r\n                            column.Name,\r\n                            column.IsPrimaryKey,\r\n                            column.IsIdentity,\r\n                            column.IsComputed,\r\n                            column.IsNullable,\r\n                            ConvertSqlTypeToSystemType(column.Type),\r\n                            ConvertSqlTypeToSqlDbType(column.Type)\r\n                        ));\r\n            }\r\n\r\n            return tableInformation;\r\n        }\r\n\r\n\r\n        private static SqlDbType ConvertSqlTypeToSqlDbType(Type type)\r\n        {\r\n            //if (type == typeof(SqlBinary)) return SqlDbType.Binary;\r\n            if (type == typeof(SqlBoolean)) return SqlDbType.Bit;\r\n            if (type == typeof(SqlByte)) return SqlDbType.TinyInt;\r\n            //if (type == typeof(SqlChars)) return SqlDbType.NVarChar;\r\n            if (type == typeof(SqlDateTime)) return SqlDbType.DateTime;\r\n            if (type == typeof(SqlDecimal)) return SqlDbType.Decimal;\r\n            if (type == typeof(SqlSingle)) return SqlDbType.Real;\r\n            if (type == typeof(SqlGuid)) return SqlDbType.UniqueIdentifier;\r\n            if (type == typeof(SqlInt16)) return SqlDbType.SmallInt;\r\n            if (type == typeof(SqlInt32)) return SqlDbType.Int;\r\n            if (type == typeof(SqlInt64)) return SqlDbType.BigInt;\r\n            if (type == typeof(SqlMoney)) return SqlDbType.Money;\r\n            if (type == typeof(SqlString)) return SqlDbType.NVarChar;\r\n            // else if (type == typeof(SqlXml)) return SqlDbType.Xml;\r\n\r\n            throw new NotImplementedException(string.Format(\"The sql type {0} not supported\", type.FullName));\r\n        }\r\n\r\n\r\n        private static Type ConvertSqlTypeToSystemType(Type type)\r\n        {\r\n            //if (type == typeof(SqlBinary)) return SqlDbType.Binary;\r\n            if (type == typeof(SqlBoolean)) return typeof(bool);\r\n            if (type == typeof(SqlByte)) return typeof(byte);\r\n            //if (type == typeof(SqlChars)) return SqlDbType.NVarChar;\r\n            if (type == typeof(SqlDateTime)) return typeof(DateTime);\r\n            if (type == typeof(SqlDecimal)) return typeof(decimal);\r\n            if (type == typeof(SqlSingle)) return typeof(Single);\r\n            if (type == typeof(SqlGuid)) return typeof(Guid);\r\n            if (type == typeof(SqlInt16)) return typeof(Int16);\r\n            if (type == typeof(SqlInt32)) return typeof(Int32);\r\n            if (type == typeof(SqlInt64)) return typeof(Int64);\r\n            if (type == typeof(SqlMoney)) return typeof(double);\r\n            if (type == typeof(SqlString)) return typeof(string);\r\n            //if (type == typeof(SqlXml)) return SqlDbType.Xml;\r\n\r\n            throw new NotImplementedException(string.Format(\"The sql type {0} not supported\", type.FullName));\r\n        }\r\n\r\n        private class ColumnInfo\r\n        {\r\n            public string TableName;\r\n            public string Name;\r\n            public bool IsPrimaryKey;\r\n            public bool IsIdentity;\r\n            public bool IsComputed;\r\n            public bool IsNullable;\r\n            public Type Type;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/SqlDataProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Plugins.Data.DataProviders.Common;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider\r\n{\r\n    [ConfigurationElementType(typeof(SqlDataProviderData))]\r\n    internal partial class SqlDataProvider : IGeneratedTypesDataProvider, ILocalizedDataProvider\r\n    {\r\n        private readonly string _connectionString;\r\n        private readonly List<InterfaceConfigurationElement> _interfaceConfigurationElements;\r\n        private SqlDataTypeStoresContainer _sqlDataTypeStoresContainer;\r\n        private readonly SqlLoggingContext _sqlLoggingContext;\r\n        private DataProviderContext _dataProviderContext;\r\n        private SqlDataProviderStoreManipulator _sqlDataProviderStoreManipulator;\r\n\r\n        private readonly object _lock = new object();\r\n\r\n        \r\n\r\n\r\n        public SqlDataProvider(string connectionString, IEnumerable<InterfaceConfigurationElement> interfaceConfigurationElement, SqlLoggingContext sqlLoggingContext = null)\r\n        {\r\n            _connectionString = connectionString;\r\n            _interfaceConfigurationElements = interfaceConfigurationElement.ToList();\r\n            _sqlLoggingContext = sqlLoggingContext;\r\n        }\r\n\r\n\r\n\r\n        public DataProviderContext Context\r\n        {\r\n            set\r\n            {\r\n                _dataProviderContext = value;\r\n\r\n                CodeGenerationManager.AddAssemblyCodeProvider(new SqlDataProviderCodeProvider(_dataProviderContext.ProviderName));\r\n\r\n                InitializeExistingStores();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> GetSupportedInterfaces()\r\n        {\r\n            return _sqlDataTypeStoresContainer.SupportedInterfaces;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> GetKnownInterfaces()\r\n        {\r\n            return _sqlDataTypeStoresContainer.KnownInterfaces;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> GetGeneratedInterfaces()\r\n        {\r\n            return _sqlDataTypeStoresContainer.GeneratedInterfaces;            \r\n        }\r\n\r\n\r\n\r\n        public IQueryable<T> GetData<T>()\r\n            where T : class, IData\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler(typeof(T).ToString()))\r\n            {\r\n                string errorMessage;\r\n                if (!DataTypeValidationRegistry.IsValidForProvider(typeof(T), _dataProviderContext.ProviderName, out errorMessage))\r\n                {\r\n                    throw new InvalidOperationException(errorMessage);\r\n                }\r\n\r\n                SqlDataTypeStore result = _sqlDataTypeStoresContainer.GetDataTypeStore(typeof(T));\r\n\r\n                return (IQueryable<T>)result.GetQueryable();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public T GetData<T>(IDataId dataId)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataId, \"dataId\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler(string.Format(\"dataId ({0})\", typeof(T))))\r\n            {\r\n                string errorMessage;\r\n                if (!DataTypeValidationRegistry.IsValidForProvider(typeof(T), _dataProviderContext.ProviderName, out errorMessage))\r\n                {\r\n                    throw new InvalidOperationException(errorMessage);\r\n                }\r\n\r\n                SqlDataTypeStore result = _sqlDataTypeStoresContainer.GetDataTypeStore(typeof(T));\r\n\r\n                IData data = result.GetDataByDataId(dataId, _dataProviderContext);\r\n\r\n                return (T)data;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Update(IEnumerable<IData> datas)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                if (datas == null) throw new ArgumentNullException(\"datas\");\r\n\r\n                Type interfaceType = null;\r\n                foreach (IData data in datas)\r\n                {\r\n                    if (data == null) throw new ArgumentException(\"datas enumeration may not contain nulls\");\r\n                    if (data.DataSourceId == null) throw new ArgumentException(\"data in datas enumeration may not contain null DataSourceIds\");\r\n\r\n                    if (interfaceType == null)\r\n                    {\r\n                        interfaceType = data.DataSourceId.InterfaceType;\r\n                    }\r\n                    else if (interfaceType != data.DataSourceId.InterfaceType)\r\n                    {\r\n                        throw new ArgumentException(string.Format(\"Only one data interface per enumerable type supported\"));\r\n                    }\r\n                }\r\n\r\n                string errorMessage;\r\n                if (!DataTypeValidationRegistry.IsValidForProvider(interfaceType, _dataProviderContext.ProviderName, out errorMessage))\r\n                {\r\n                    throw new InvalidOperationException(errorMessage);\r\n                }\r\n\r\n                _sqlDataTypeStoresContainer.Update(datas);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public List<T> AddNew<T>(IEnumerable<T> dataset)\r\n            where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                string errorMessage;\r\n                if (!DataTypeValidationRegistry.IsValidForProvider(typeof(T), _dataProviderContext.ProviderName, out errorMessage))\r\n                {\r\n                    throw new InvalidOperationException(errorMessage);\r\n                }\r\n\r\n                using (var scope = new RequireTransactionScope())\r\n                {\r\n                    var result = _sqlDataTypeStoresContainer.AddNew<T>(dataset, _dataProviderContext);\r\n\r\n                    scope.Complete();\r\n\r\n                    return result;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Delete(IEnumerable<DataSourceId> dataSourceIds)\r\n        {\r\n            Verify.ArgumentNotNull(dataSourceIds, \"dataSourceIds\");\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                \r\n\r\n                Type interfaceType = null;\r\n                foreach (DataSourceId dataSourceId in dataSourceIds)\r\n                {\r\n                    if (dataSourceId == null) throw new ArgumentException(\"datas enumeration may not contain nulls\");\r\n\r\n                    if (interfaceType == null)\r\n                    {\r\n                        interfaceType = dataSourceId.InterfaceType;\r\n                    }\r\n                    else if (interfaceType != dataSourceId.InterfaceType)\r\n                    {\r\n                        throw new ArgumentException(string.Format(\"Only one data interface per enumerable type supported\"));\r\n                    }\r\n                }\r\n\r\n                string errorMessage;\r\n                if (!DataTypeValidationRegistry.IsValidForProvider(interfaceType, _dataProviderContext.ProviderName, out errorMessage))\r\n                {\r\n                    throw new InvalidOperationException(errorMessage);\r\n                }\r\n\r\n                _sqlDataTypeStoresContainer.Delete(dataSourceIds, _dataProviderContext);\r\n            }\r\n        }        \r\n       \r\n\r\n\r\n        public void AddLocale(CultureInfo cultureInfo)\r\n        {\r\n            var supportedInterfaces = GetSupportedInterfaces();\r\n            foreach (var type in supportedInterfaces)\r\n            {\r\n                if (!DataLocalizationFacade.IsLocalized(type))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var typeDesrciptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n                SqlStoreManipulator.AddLocale(typeDesrciptor, cultureInfo);\r\n\r\n                InterfaceConfigurationElement oldElement = _interfaceConfigurationElements.Single(f => f.DataTypeId == typeDesrciptor.DataTypeId);\r\n\r\n                InterfaceConfigurationElement newElement = InterfaceConfigurationManipulator.RefreshLocalizationInfo(_dataProviderContext.ProviderName, typeDesrciptor);\r\n                \r\n                _interfaceConfigurationElements.Remove(oldElement);\r\n                _interfaceConfigurationElements.Add(newElement);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void RemoveLocale(CultureInfo cultureInfo)\r\n        {\r\n            var supportedInterfaces = GetSupportedInterfaces();\r\n            foreach (var type in supportedInterfaces)\r\n            {\r\n                if (!DataLocalizationFacade.IsLocalized(type))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var typeDesrciptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n                SqlStoreManipulator.RemoveLocale(_dataProviderContext.ProviderName, typeDesrciptor, cultureInfo);\r\n\r\n                InterfaceConfigurationElement oldElement = _interfaceConfigurationElements.Where(f => f.DataTypeId == typeDesrciptor.DataTypeId).Single();\r\n\r\n                InterfaceConfigurationElement newElement = InterfaceConfigurationManipulator.RefreshLocalizationInfo(_dataProviderContext.ProviderName, typeDesrciptor);\r\n                                \r\n                _interfaceConfigurationElements.Remove(oldElement);\r\n                _interfaceConfigurationElements.Add(newElement);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal void BuildAllCode(CodeGenerationBuilder codeGenerationBuilder)\r\n        {\r\n            var codeBuilder = new SqlDataProviderCodeBuilder(_dataProviderContext.ProviderName, codeGenerationBuilder);\r\n\r\n            foreach (InterfaceConfigurationElement element in _interfaceConfigurationElements)\r\n            {\r\n                if (element.DataTypeId == Guid.Empty) continue;\r\n\r\n                var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(element.DataTypeId);\r\n\r\n                if (!dataTypeDescriptor.ValidateRuntimeType())\r\n                {\r\n                    Log.LogError(LogTitle, string.Format(\"The non code generated interface type '{0}' was not found, skipping code generation for that type\", dataTypeDescriptor));\r\n                    continue;\r\n                }\r\n\r\n                var sqlDataTypeStoreDataScopes = new List<SqlDataTypeStoreDataScope>();\r\n\r\n                foreach (StorageInformation storageInformation in element.Stores)\r\n                {\r\n                    var sqlDataTypeStoreDataScope = new SqlDataTypeStoreDataScope\r\n                    {\r\n                        DataScopeName = storageInformation.DataScope,\r\n                        CultureName = storageInformation.CultureName,\r\n                        TableName = storageInformation.TableName\r\n                    };\r\n\r\n                    sqlDataTypeStoreDataScopes.Add(sqlDataTypeStoreDataScope);\r\n                }\r\n\r\n                codeBuilder.AddDataType(dataTypeDescriptor, sqlDataTypeStoreDataScopes);\r\n            }\r\n\r\n            codeBuilder.AddDataContext();\r\n        }\r\n\r\n\r\n\r\n        private SqlDataProviderStoreManipulator SqlStoreManipulator\r\n        {\r\n            get\r\n            {\r\n                if (_sqlDataProviderStoreManipulator == null)\r\n                {\r\n                    lock (_lock)\r\n                    {\r\n                        if (_sqlDataProviderStoreManipulator == null)\r\n                        {\r\n                            _sqlDataProviderStoreManipulator = new SqlDataProviderStoreManipulator(_connectionString, _interfaceConfigurationElements);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return _sqlDataProviderStoreManipulator;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n    internal sealed class SqlDataProviderAssembler : IAssembler<IDataProvider, DataProviderData>\r\n    {\r\n        private static readonly string LogTitle = typeof (SqlDataProviderAssembler).Name;\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IDataProvider Assemble(IBuilderContext context, DataProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var sqlDataProviderData = (SqlDataProviderData)objectConfiguration;\r\n\r\n            string  configFilePath = InterfaceConfigurationManipulator.GetConfigurationFilePath(sqlDataProviderData.Name);\r\n            var configuration = new C1Configuration(configFilePath);\r\n\r\n            var section = configuration.GetSection(SqlDataProviderConfigurationSection.SectionName) as SqlDataProviderConfigurationSection;\r\n            if (section == null)\r\n            {\r\n                section = new SqlDataProviderConfigurationSection();\r\n                configuration.Sections.Add(SqlDataProviderConfigurationSection.SectionName, section);\r\n                configuration.Save();\r\n            }\r\n\r\n\r\n            var interfaceConfigurationElements = new List<InterfaceConfigurationElement>();\r\n            foreach (InterfaceConfigurationElement table in section.Interfaces)\r\n            {\r\n                interfaceConfigurationElements.Add(table);\r\n            }\r\n\r\n            var sqlLoggingContext = new SqlLoggingContext\r\n            {\r\n                Enabled = sqlDataProviderData.SqlQueryLoggingEnabled,\r\n                IncludeStack = sqlDataProviderData.SqlQueryLoggingIncludeStack,\r\n                TypesToIgnore = new List<Type>(),\r\n                TablesToIgnore = new List<string>()\r\n            };\r\n\r\n            if (sqlDataProviderData.SqlQueryLoggingEnabled)\r\n            {\r\n                foreach (LoggingIgnoreInterfacesConfigurationElement element in sqlDataProviderData.LoggingIgnoreInterfaces)\r\n                {\r\n                    Type interfaceType = TypeManager.TryGetType(element.InterfaceType);\r\n                    if (interfaceType != null)\r\n                    {\r\n                        sqlLoggingContext.TypesToIgnore.Add(interfaceType);\r\n\r\n                        InterfaceConfigurationElement interfaceElement = interfaceConfigurationElements.SingleOrDefault(f => f.DataTypeId == interfaceType.GetImmutableTypeId());\r\n                        if (interfaceElement == null) continue;\r\n\r\n                        foreach (StoreConfigurationElement store in interfaceElement.ConfigurationStores)\r\n                        {\r\n                            sqlLoggingContext.TablesToIgnore.Add(store.TableName);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            string connectionString = sqlDataProviderData.ConnectionString;\r\n\r\n            if (string.IsNullOrEmpty(connectionString))\r\n            {\r\n                string connectionStringName = sqlDataProviderData.ConnectionStringName;\r\n\r\n                if (string.IsNullOrEmpty(connectionStringName))\r\n                {\r\n                    throw new ConfigurationErrorsException(\"SqlDataProvider requires one of the following properties to be specified: 'connectionString', 'connectionStringName'\");\r\n                }\r\n\r\n                var connStringConfigNode = System.Web.Configuration.WebConfigurationManager.ConnectionStrings[connectionStringName];\r\n                Verify.IsNotNull(connStringConfigNode, \"Failed to find an SQL connection string by name '{0}'\", connectionStringName);\r\n\r\n                connectionString = connStringConfigNode.ConnectionString;\r\n            }\r\n\r\n            return new SqlDataProvider(connectionString, interfaceConfigurationElements, sqlLoggingContext);\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class SqlLoggingContext\r\n    {\r\n        public bool Enabled { get; set; }\r\n        public bool IncludeStack { get; set; }\r\n        public List<Type> TypesToIgnore { get; set; }\r\n        public List<string> TablesToIgnore { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(SqlDataProviderAssembler))]\r\n    internal sealed class SqlDataProviderData : DataProviderData\r\n    {\r\n        private const string _connectionStringPropertyName = \"connectionString\";\r\n        [System.Configuration.ConfigurationProperty(_connectionStringPropertyName, IsRequired = false)]\r\n        public string ConnectionString\r\n        {\r\n            get { return (string)base[_connectionStringPropertyName]; }\r\n            set { base[_connectionStringPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _connectionStringNamePropertyName = \"connectionStringName\";\r\n        [System.Configuration.ConfigurationProperty(_connectionStringNamePropertyName, IsRequired = false)]\r\n        public string ConnectionStringName\r\n        {\r\n            get { return (string)base[_connectionStringNamePropertyName]; }\r\n            set { base[_connectionStringNamePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _sqlQueryLoggingEnabledPropertyName = \"sqlQueryLoggingEnabled\";\r\n        [System.Configuration.ConfigurationProperty(_sqlQueryLoggingEnabledPropertyName, IsRequired = false, DefaultValue = false)]\r\n        public bool SqlQueryLoggingEnabled\r\n        {\r\n            get { return (bool)base[_sqlQueryLoggingEnabledPropertyName]; }\r\n            set { base[_sqlQueryLoggingEnabledPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _sqlQueryLoggingIncludeStackPropertyName = \"sqlQueryLoggingIncludeStack\";\r\n        [System.Configuration.ConfigurationProperty(_sqlQueryLoggingIncludeStackPropertyName, IsRequired = false, DefaultValue = false)]\r\n        public bool SqlQueryLoggingIncludeStack\r\n        {\r\n            get { return (bool)base[_sqlQueryLoggingIncludeStackPropertyName]; }\r\n            set { base[_sqlQueryLoggingIncludeStackPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _logginIgnoreInterfacesNamePropertyName = \"LoggingIgnoreInterfaces\";\r\n        [System.Configuration.ConfigurationProperty(_logginIgnoreInterfacesNamePropertyName, IsRequired = false)]\r\n        public LoggingIgnoreInterfacesConfigurationElementCollection LoggingIgnoreInterfaces\r\n        {\r\n            get { return (LoggingIgnoreInterfacesConfigurationElementCollection)base[_logginIgnoreInterfacesNamePropertyName]; }\r\n            set { base[_logginIgnoreInterfacesNamePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class LoggingIgnoreInterfacesConfigurationElementCollection : System.Configuration.ConfigurationElementCollection\r\n    {\r\n        protected override System.Configuration.ConfigurationElement CreateNewElement()\r\n        {\r\n            return new LoggingIgnoreInterfacesConfigurationElement();\r\n        }\r\n\r\n\r\n\r\n        protected override object GetElementKey(System.Configuration.ConfigurationElement element)\r\n        {\r\n            return ((LoggingIgnoreInterfacesConfigurationElement)element).InterfaceType;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class LoggingIgnoreInterfacesConfigurationElement : System.Configuration.ConfigurationElement\r\n    {\r\n        private const string _interfaceTypePropertyName = \"interfaceType\";\r\n        [System.Configuration.ConfigurationProperty(_interfaceTypePropertyName, IsRequired = true)]\r\n        public string InterfaceType\r\n        {\r\n            get { return (string)base[_interfaceTypePropertyName]; }\r\n            set { base[_interfaceTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    internal sealed class SqlDataProviderConfigurationSection : System.Configuration.ConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Data.Plugins.SqlDataProviderConfiguration\";\r\n\r\n        private const string _InterfacesNamePropertyName = \"Interfaces\";\r\n        [System.Configuration.ConfigurationProperty(_InterfacesNamePropertyName, IsRequired = false)]\r\n        public InterfaceConfigurationElementCollection Interfaces\r\n        {\r\n            get { return (InterfaceConfigurationElementCollection)base[_InterfacesNamePropertyName]; }\r\n            set { base[_InterfacesNamePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class StorageInformation\r\n    {\r\n        public StorageInformation(string dataScope, string cultureName, string tableName)\r\n        {\r\n            DataScope = dataScope;\r\n            CultureName = cultureName;\r\n            TableName = tableName;\r\n        }\r\n\r\n        public string DataScope { get; private set; }\r\n        public string CultureName { get; private set; }\r\n        public string TableName { get; private set; }\r\n    }\r\n\r\n    internal sealed class InterfaceConfigurationElement : System.Configuration.ConfigurationElement\r\n    {\r\n        public IEnumerable<StorageInformation> Stores\r\n        {\r\n            get\r\n            {\r\n                var stores = new List<StorageInformation>();\r\n\r\n                foreach (StoreConfigurationElement element in ConfigurationStores)\r\n                {\r\n                    stores.Add(new StorageInformation(element.DataScope, element.CultureName, element.TableName));\r\n                }\r\n\r\n                return stores;\r\n            }\r\n        }\r\n\r\n        public Dictionary<string, Type> DataIdProperties\r\n        {\r\n            get\r\n            {\r\n                var dic = new Dictionary<string, Type>();\r\n\r\n                foreach (SimpleNameTypeConfigurationElement element in ConfigurationDataIdProperties)\r\n                {\r\n                    dic.Add(element.Name, element.Type);\r\n                }\r\n\r\n                return dic;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<string, string> PropertyNameMappings\r\n        {\r\n            get\r\n            {\r\n                var dic = new Dictionary<string, string>();\r\n\r\n                foreach (PropertyNameMappingConfigurationElement element in ConfigurationPropertyNameMappings)\r\n                {\r\n                    dic.Add(element.PropertyName, element.SourcePropertyName);\r\n                }\r\n\r\n                return dic;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<string, Type> PropertyInitializers\r\n        {\r\n            get\r\n            {\r\n                var dic = new Dictionary<string, Type>();\r\n\r\n                if (ConfigurationPropertyInitializers != null)\r\n                {\r\n                    foreach (SimpleNameTypeConfigurationElement element in ConfigurationPropertyInitializers)\r\n                    {\r\n                        dic.Add(element.Name, element.Type);\r\n                    }\r\n                }\r\n\r\n                return dic;\r\n            }\r\n        }\r\n\r\n\r\n        private const string _storesPropertyName = \"Stores\";\r\n        [System.Configuration.ConfigurationProperty(_storesPropertyName, IsRequired = false)]\r\n        public StoreConfigurationElementCollection ConfigurationStores\r\n        {\r\n            get\r\n            {\r\n                var baseValue = (StoreConfigurationElementCollection)base[_storesPropertyName];\r\n                return baseValue ?? new StoreConfigurationElementCollection();\r\n            }\r\n            set { base[_storesPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _dataTypeIdName = \"dataTypeId\";\r\n        [System.Configuration.ConfigurationProperty(_dataTypeIdName, IsRequired = true)]\r\n        public Guid DataTypeId\r\n        {\r\n            get { return (Guid)base[_dataTypeIdName]; }\r\n            set { base[_dataTypeIdName] = value; }\r\n        }\r\n\r\n\r\n        private const string _isGeneratedTypePropertyName = \"isGeneratedType\";\r\n        [System.Configuration.ConfigurationProperty(_isGeneratedTypePropertyName, IsRequired = true)]\r\n        public bool IsGeneratedType\r\n        {\r\n            get { return (bool)base[_isGeneratedTypePropertyName]; }\r\n            set { base[_isGeneratedTypePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _dataIdPropertiesPropertyName = \"DataIdProperties\";\r\n        [System.Configuration.ConfigurationProperty(_dataIdPropertiesPropertyName, IsRequired = true)]\r\n        public SimpleNameTypeConfigurationElementCollection ConfigurationDataIdProperties\r\n        {\r\n            get { return (SimpleNameTypeConfigurationElementCollection)base[_dataIdPropertiesPropertyName]; }\r\n            set { base[_dataIdPropertiesPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _propertyNameMappingsPropertyName = \"PropertyNameMappings\";\r\n        [System.Configuration.ConfigurationProperty(_propertyNameMappingsPropertyName, IsRequired = false)]\r\n        public PropertyNameMappingConfigurationElementCollection ConfigurationPropertyNameMappings\r\n        {\r\n            get { return (PropertyNameMappingConfigurationElementCollection)base[_propertyNameMappingsPropertyName]; }\r\n            set { base[_propertyNameMappingsPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _propertyInitializersPropertyName = \"PropertyInitializers\";\r\n        [System.Configuration.ConfigurationProperty(_propertyInitializersPropertyName, IsRequired = false)]\r\n        public SimpleNameTypeConfigurationElementCollection ConfigurationPropertyInitializers\r\n        {\r\n            get { return (SimpleNameTypeConfigurationElementCollection)base[_propertyInitializersPropertyName]; }\r\n            set { base[_propertyInitializersPropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class InterfaceConfigurationElementCollection : System.Configuration.ConfigurationElementCollection\r\n    {\r\n        public void Add(InterfaceConfigurationElement element)\r\n        {\r\n            BaseAdd(element);\r\n        }\r\n\r\n        protected override System.Configuration.ConfigurationElement CreateNewElement()\r\n        {\r\n            return new InterfaceConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(System.Configuration.ConfigurationElement element)\r\n        {\r\n            Guid? dataTypeId = ((InterfaceConfigurationElement) element).DataTypeId;\r\n            Verify.IsNotNull(dataTypeId, \"Configuration element is missing attribute 'dataTypeId'\");\r\n\r\n            return dataTypeId;\r\n        }\r\n\r\n        internal bool ContainsInterfaceType(InterfaceConfigurationElement interfaceConfigurationElement)\r\n        {\r\n            return ContainsInterfaceType(interfaceConfigurationElement.DataTypeId);\r\n        }\r\n\r\n        internal bool ContainsInterfaceType(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return ContainsInterfaceType(dataTypeDescriptor.DataTypeId);\r\n        }\r\n\r\n        internal InterfaceConfigurationElement Get(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            foreach (InterfaceConfigurationElement element in this)\r\n            {\r\n                object key = GetElementKey(element);\r\n\r\n                if ((Guid)key == dataTypeDescriptor.DataTypeId)\r\n                {\r\n                    return element;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        internal bool ContainsInterfaceType(Guid dataTypeId)\r\n        {\r\n            object[] allKeys = BaseGetAllKeys();\r\n\r\n            return allKeys.Contains(dataTypeId);\r\n        }\r\n\r\n        internal void Remove(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Remove(dataTypeDescriptor.DataTypeId);\r\n        }\r\n\r\n        internal void Remove(Guid dataTypeId)\r\n        {\r\n            this.BaseRemove(dataTypeId);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class StoreConfigurationElement : System.Configuration.ConfigurationElement\r\n    {\r\n        private const string _tableNamePropertyName = \"tableName\";\r\n        [System.Configuration.ConfigurationProperty(_tableNamePropertyName, IsKey = true, IsRequired = true)]\r\n        public string TableName\r\n        {\r\n            get { return (string)base[_tableNamePropertyName]; }\r\n            set { base[_tableNamePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _dataScopePropertyName = \"dataScope\";\r\n        [System.Configuration.ConfigurationProperty(_dataScopePropertyName, IsRequired = true)]\r\n        public string DataScope\r\n        {\r\n            get { return (string)base[_dataScopePropertyName]; }\r\n            set { base[_dataScopePropertyName] = value; }\r\n        }\r\n\r\n        private const string _culturePropertyName = \"cultureName\";\r\n        [System.Configuration.ConfigurationProperty(_culturePropertyName, DefaultValue = \"\")]\r\n        public string CultureName\r\n        {\r\n            get { return (string)base[_culturePropertyName]; }\r\n            set { base[_culturePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class StoreConfigurationElementCollection : System.Configuration.ConfigurationElementCollection\r\n    {\r\n        public void Add(StoreConfigurationElement element)\r\n        {\r\n            BaseAdd(element);\r\n        }\r\n\r\n        protected override System.Configuration.ConfigurationElement CreateNewElement()\r\n        {\r\n            return new StoreConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(System.Configuration.ConfigurationElement element)\r\n        {\r\n            return ((StoreConfigurationElement)element).TableName;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/SqlDataProvider_Stores.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Data.Linq;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Sql;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Foundation.CodeGeneration;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql;\r\nusing System.Text;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider\r\n{\r\n    internal partial class SqlDataProvider\r\n    {\r\n        private static readonly string LogTitle = typeof(SqlDataProvider).Name;\r\n        private readonly List<SqlDataTypeStoreTable> _createdSqlDataTypeStoreTables = new List<SqlDataTypeStoreTable>();\r\n        private Assembly _compositeGeneratedAssembly;\r\n\r\n        private static readonly Hashtable<Type, bool> _typeLoadResults = new Hashtable<Type, bool>();\r\n\r\n        public void CreateStores(IReadOnlyCollection<DataTypeDescriptor> dataTypeDescriptors)\r\n        {\r\n            var types = DataTypeTypesManager.GetDataTypes(dataTypeDescriptors);\r\n\r\n            foreach (var dataTypeDescriptor in dataTypeDescriptors)\r\n            {\r\n                if (InterfaceConfigurationManipulator.ConfigurationExists(_dataProviderContext.ProviderName, dataTypeDescriptor))\r\n                {\r\n                    var filePath = InterfaceConfigurationManipulator.GetConfigurationFilePath(_dataProviderContext.ProviderName);\r\n\r\n                    throw new InvalidOperationException(\r\n                        $\"SqlDataProvider configuration already contains a interface named '{dataTypeDescriptor.TypeManagerTypeName}', Id: '{dataTypeDescriptor.DataTypeId}'. Remove it from the configuration file '{filePath}' and restart the application.\");\r\n                }\r\n            }\r\n\r\n            // Creating Sql tables and adding to the configuration\r\n            var configElements = new Dictionary<DataTypeDescriptor, InterfaceConfigurationElement>();\r\n\r\n            foreach (var dataTypeDescriptor in dataTypeDescriptors)\r\n            {\r\n                Type type = types[dataTypeDescriptor.DataTypeId];\r\n\r\n                Action<string> existingTablesValidator = tableName =>\r\n                {\r\n                    var errors = new StringBuilder();\r\n                    var interfaceType = type;\r\n                    if (!ValidateTable(interfaceType, tableName, errors))\r\n                    {\r\n                        throw new InvalidOperationException($\"Table '{tableName}' already exists but isn't valid: {errors.ToString()}\");\r\n                    }\r\n                };\r\n\r\n                SqlStoreManipulator.CreateStoresForType(dataTypeDescriptor, existingTablesValidator);\r\n\r\n                InterfaceConfigurationElement element = InterfaceConfigurationManipulator.AddNew(_dataProviderContext.ProviderName, dataTypeDescriptor);\r\n                _interfaceConfigurationElements.Add(element);\r\n\r\n                configElements.Add(dataTypeDescriptor, element);\r\n            }\r\n\r\n\r\n            // Generating necessary classes and performing validation\r\n            Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>> allSqlDataTypeStoreDataScopes = BuildAllExistingDataTypeStoreDataScopes();\r\n\r\n            bool dataContextRecompilationNeeded = false;\r\n\r\n            var toCompileList = new List<HelperClassesGenerationInfo>();\r\n            var generatedClassesInfo = new Dictionary<DataTypeDescriptor, InterfaceGeneratedClassesInfo>();\r\n\r\n            Type dataContextClass = _sqlDataTypeStoresContainer.DataContextClass;\r\n\r\n            foreach (var dataTypeDescriptor in dataTypeDescriptors)\r\n            {\r\n                var element = configElements[dataTypeDescriptor];\r\n\r\n                // InitializeStoreResult initializeStoreResult = InitializeStore(element, allSqlDataTypeStoreDataScopes);\r\n\r\n                HelperClassesGenerationInfo toCompile = null;\r\n\r\n                var classesInfo = InitializeStoreTypes(element, allSqlDataTypeStoreDataScopes, dataContextClass, null, false, ref dataContextRecompilationNeeded, ref toCompile);\r\n\r\n                if (classesInfo != null && toCompile != null)\r\n                {\r\n                    toCompileList.Add(toCompile);\r\n\r\n                    generatedClassesInfo[dataTypeDescriptor] = classesInfo;\r\n                }\r\n            }\r\n\r\n            // Compiling missing classes\r\n            if (toCompileList.Any())\r\n            {\r\n                var codeGenerationBuilder = new CodeGenerationBuilder(_dataProviderContext.ProviderName + \":CreateStores\");\r\n\r\n                foreach (var toCompile in toCompileList)\r\n                {\r\n                    toCompile.GenerateCodeAction(codeGenerationBuilder);\r\n                }\r\n\r\n                var generatedHelperClasses = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder, false).ToArray();\r\n\r\n                foreach (var toCompile in toCompileList)\r\n                {\r\n                    toCompile.PopulateFieldsAction(generatedHelperClasses);\r\n                }\r\n            }\r\n\r\n            // Emitting a new DataContext class\r\n            if (dataContextRecompilationNeeded)\r\n            {\r\n                var newDataTypeIds = new HashSet<Guid>(dataTypeDescriptors.Select(d => d.DataTypeId));\r\n\r\n                _createdSqlDataTypeStoreTables.RemoveAll(f => newDataTypeIds.Contains(f.DataTypeId));\r\n\r\n                var fields = _createdSqlDataTypeStoreTables.Select(s => new Tuple<string, Type>(s.DataContextFieldName, s.DataContextFieldType)).ToList();\r\n\r\n                foreach (var classesInfo in generatedClassesInfo.Values)\r\n                {\r\n                    fields.AddRange(classesInfo.Fields.Select(f => new Tuple<string, Type>(f.Value.FieldName, f.Value.FieldType)));\r\n                }\r\n\r\n                dataContextClass = DataContextAssembler.EmitDataContextClass(fields);\r\n\r\n                UpdateCreatedSqlDataTypeStoreTables(dataContextClass);\r\n            }\r\n\r\n            _sqlDataTypeStoresContainer.DataContextClass = dataContextClass;\r\n\r\n            // Registering the new type/tables\r\n            foreach (var dataTypeDescriptor in dataTypeDescriptors)\r\n            {\r\n                InterfaceGeneratedClassesInfo classesInfo;\r\n\r\n                if (!generatedClassesInfo.TryGetValue(dataTypeDescriptor, out classesInfo))\r\n                {\r\n                    throw new InvalidOperationException($\"No generated classes for data type '{dataTypeDescriptor.Name}' found\");\r\n                }\r\n                InitializeStoreResult initInfo = EmbedDataContextInfo(classesInfo, dataContextClass);\r\n\r\n                AddDataTypeStore(initInfo, false);\r\n            }\r\n        }\r\n\r\n\r\n        public void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, bool forceCompile)\r\n        {\r\n            var dataTypeChangeDescriptor = updateDataTypeDescriptor.CreateDataTypeChangeDescriptor();\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                SqlStoreManipulator.AlterStoresForType(updateDataTypeDescriptor);\r\n\r\n                bool localizationChanged = dataTypeChangeDescriptor.AlteredType.Localizeable !=\r\n                                           dataTypeChangeDescriptor.OriginalType.Localizeable;\r\n\r\n                var oldElement = _interfaceConfigurationElements.Single(f => f.DataTypeId == updateDataTypeDescriptor.OldDataTypeDescriptor.DataTypeId);\r\n\r\n                var newElement = InterfaceConfigurationManipulator.Change(_dataProviderContext.ProviderName, dataTypeChangeDescriptor, localizationChanged);\r\n                if (newElement != null)\r\n                {\r\n                    _interfaceConfigurationElements.Remove(oldElement);\r\n                    _interfaceConfigurationElements.Add(newElement);\r\n                }\r\n\r\n                if (forceCompile)\r\n                {\r\n                    Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>> allSqlDataTypeStoreDataScopes = BuildAllExistingDataTypeStoreDataScopes();\r\n\r\n                    InitializeStoreResult initializeStoreResult = InitializeStore(newElement ?? oldElement, allSqlDataTypeStoreDataScopes, true);\r\n\r\n                    if (!updateDataTypeDescriptor.NewDataTypeDescriptor.IsCodeGenerated)\r\n                    {\r\n                        var interfaceType = updateDataTypeDescriptor.NewDataTypeDescriptor.GetInterfaceType();\r\n\r\n                        if (!DataTypeValidationRegistry.IsValidForProvider(interfaceType, _dataProviderContext.ProviderName))\r\n                        {\r\n                            // Revalidating alternated static data type\r\n                            _sqlDataTypeStoresContainer.RemoveKnownInterface(interfaceType);\r\n\r\n                            DataTypeValidationRegistry.ClearValidationError(interfaceType, _dataProviderContext.ProviderName);\r\n\r\n                            AddDataTypeStore(initializeStoreResult);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void DropStore(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            using (TimerProfilerFacade.CreateTimerProfiler())\r\n            {\r\n                SqlStoreManipulator.DropStoresForType(_dataProviderContext.ProviderName, dataTypeDescriptor);\r\n\r\n                InterfaceConfigurationManipulator.Remove(_dataProviderContext.ProviderName, dataTypeDescriptor);\r\n                InterfaceConfigurationElement oldElement = _interfaceConfigurationElements.FirstOrDefault(f => f.DataTypeId == dataTypeDescriptor.DataTypeId);\r\n                if (oldElement != null)\r\n                {\r\n                    _interfaceConfigurationElements.Remove(oldElement);\r\n                }\r\n\r\n                Guid dataTypeId = dataTypeDescriptor.DataTypeId;\r\n                int storesRemoved = _createdSqlDataTypeStoreTables.RemoveAll(item => item.DataTypeId == dataTypeId);\r\n\r\n                if (storesRemoved > 0)\r\n                {\r\n                    Type interfaceType = dataTypeDescriptor.GetInterfaceType();\r\n\r\n                    _sqlDataTypeStoresContainer.ForgetInterface(interfaceType);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void InitializeExistingStores()\r\n        {\r\n            _compositeGeneratedAssembly = _compositeGeneratedAssembly ?? AssemblyFacade.GetGeneratedAssemblyFromBin();\r\n            _sqlDataTypeStoresContainer = new SqlDataTypeStoresContainer(_dataProviderContext.ProviderName, _connectionString, _sqlLoggingContext);\r\n\r\n            Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>> allSqlDataTypeStoreDataScopes = BuildAllExistingDataTypeStoreDataScopes();\r\n\r\n            var initializedStores = new List<InterfaceGeneratedClassesInfo>();\r\n\r\n            bool dataContextRecompilationNeeded = false;\r\n\r\n            Type dataContextClass = TryLoadDataContext(ref dataContextRecompilationNeeded);\r\n\r\n\r\n            var dataTypes = LoadDataTypes(_interfaceConfigurationElements);\r\n\r\n            var compilationData = new List<HelperClassesGenerationInfo>();\r\n            foreach (InterfaceConfigurationElement element in _interfaceConfigurationElements)\r\n            {\r\n                HelperClassesGenerationInfo toCompile = null;\r\n\r\n                var generatedClassesInfo = InitializeStoreTypes(element, allSqlDataTypeStoreDataScopes,\r\n                    dataContextClass, dataTypes, false, ref dataContextRecompilationNeeded, ref toCompile);\r\n\r\n                if (generatedClassesInfo == null) continue;\r\n                if (toCompile != null)\r\n                {\r\n                    compilationData.Add(toCompile);\r\n                }\r\n\r\n                initializedStores.Add(generatedClassesInfo);\r\n            }\r\n\r\n            if (compilationData.Any())\r\n            {\r\n                var codeGenerationBuilder = new CodeGenerationBuilder(_dataProviderContext.ProviderName + \" : compiling missing classes\");\r\n\r\n                foreach (var toCompile in compilationData)\r\n                {\r\n                    toCompile.GenerateCodeAction(codeGenerationBuilder);\r\n                }\r\n\r\n                // Precompiling DataWrapper classes as well to improve loading time\r\n                foreach (var interfaceType in dataTypes.Values)\r\n                {\r\n                    if (DataWrapperTypeManager.TryGetWrapperType(interfaceType.FullName) == null)\r\n                    {\r\n                        DataWrapperCodeGenerator.AddDataWrapperClassCode(codeGenerationBuilder, interfaceType);\r\n                    }\r\n                }\r\n\r\n                Type[] types = null;\r\n                try\r\n                {\r\n                    types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder, false).ToArray();\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogWarning(LogTitle, ex);\r\n                }\r\n\r\n                if (types != null)\r\n                {\r\n                    foreach (var toCompile in compilationData)\r\n                    {\r\n                        toCompile.PopulateFieldsAction(types);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (dataContextRecompilationNeeded)\r\n            {\r\n                dataContextClass = DataContextAssembler.EmitDataContextClass(\r\n                    initializedStores\r\n                    .Where(s => s.Fields != null)\r\n                    .SelectMany(s => s.Fields.Values).Evaluate());\r\n            }\r\n\r\n            _sqlDataTypeStoresContainer.DataContextClass = dataContextClass;\r\n\r\n            foreach (var typeInfo in initializedStores)\r\n            {\r\n                var store = EmbedDataContextInfo(typeInfo, dataContextClass);\r\n\r\n                AddDataTypeStore(store, true, true);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Loads all the data types referenced in the provider's configuration file.\r\n        /// </summary>\r\n        private static Dictionary<Guid, Type> LoadDataTypes(IEnumerable<InterfaceConfigurationElement> configurationElements)\r\n        {\r\n            var dataTypeDescriptors = new List<DataTypeDescriptor>();\r\n\r\n            foreach (InterfaceConfigurationElement element in configurationElements)\r\n            {\r\n                Guid dataTypeId = element.DataTypeId;\r\n\r\n                var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(dataTypeId, true);\r\n                if (dataTypeDescriptor == null)\r\n                {\r\n                    throw NewConfigurationException(element, \"Failed to get a DataTypeDescriptor by id '{dataTypeId}'\");\r\n                }\r\n\r\n                dataTypeDescriptors.Add(dataTypeDescriptor);\r\n            }\r\n\r\n            return DataTypeTypesManager.GetDataTypes(dataTypeDescriptors);\r\n        }\r\n\r\n        private static Exception NewConfigurationException(ConfigurationElement element, string message)\r\n        {\r\n            return new ConfigurationErrorsException(message, element.ElementInformation.Source, element.ElementInformation.LineNumber);\r\n        }\r\n\r\n\r\n        private InitializeStoreResult InitializeStore(InterfaceConfigurationElement element,\r\n            Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>> allSqlDataTypeStoreDataScopes,\r\n            bool forceCompile = false)\r\n        {\r\n            bool dataContextRecompilationNeeded = false;\r\n\r\n            Type dataContextClass = _sqlDataTypeStoresContainer.DataContextClass;\r\n\r\n            var initInfo = InitializeStoreTypes(element, allSqlDataTypeStoreDataScopes, dataContextClass, forceCompile, ref dataContextRecompilationNeeded);\r\n\r\n            if (initInfo.InterfaceType == null)\r\n            {\r\n                return new InitializeStoreResult();\r\n            }\r\n\r\n            if (dataContextRecompilationNeeded)\r\n            {\r\n                _createdSqlDataTypeStoreTables.RemoveAll(f => f.DataTypeId == initInfo.DataTypeDescriptor.DataTypeId);\r\n\r\n                var existingFields = _createdSqlDataTypeStoreTables.Select(\r\n                                      s => new Tuple<string, Type>(s.DataContextFieldName, s.DataContextFieldType));\r\n                var newFields = initInfo.Fields.Select(f => new Tuple<string, Type>(f.Value.FieldName, f.Value.FieldType));\r\n\r\n                dataContextClass = DataContextAssembler.EmitDataContextClass(existingFields.Concat(newFields).Evaluate());\r\n\r\n                UpdateCreatedSqlDataTypeStoreTables(dataContextClass);\r\n            }\r\n\r\n            _sqlDataTypeStoresContainer.DataContextClass = dataContextClass;\r\n\r\n            return EmbedDataContextInfo(initInfo, dataContextClass);\r\n        }\r\n\r\n\r\n        private Type TryLoadDataContext(ref bool forceCompile)\r\n        {\r\n            string dataContextClassFullName = NamesCreator.MakeDataContextClassFullName(_dataProviderContext.ProviderName);\r\n            Type dataContextClass = TryGetGeneratedType(dataContextClassFullName);\r\n\r\n            // Trying to instantiate a data context object\r\n            if (dataContextClass != null && !TryLoadDataContextClass(dataContextClass))\r\n            {\r\n                forceCompile = true;\r\n                return null;\r\n            }\r\n\r\n            return dataContextClass;\r\n        }\r\n\r\n        private InitializeStoreResult EmbedDataContextInfo(InterfaceGeneratedClassesInfo initInfo, Type dataContextType)\r\n        {\r\n            var result = new InitializeStoreResult();\r\n\r\n            if (initInfo.InterfaceType == null)\r\n            {\r\n                return result;\r\n            }\r\n\r\n            result.InterfaceType = initInfo.InterfaceType;\r\n\r\n            var sqlDataTypeStoreTables = new Dictionary<SqlDataTypeStoreTableKey, SqlDataTypeStoreTable>();\r\n            foreach (SqlDataTypeStoreDataScope storeDataScope in initInfo.DataScopes)\r\n            {\r\n                var key = new SqlDataTypeStoreTableKey(storeDataScope.DataScopeName, storeDataScope.CultureName);\r\n\r\n                result.TableNames.Add(key, storeDataScope.TableName);\r\n\r\n                Verify.IsNotNull(initInfo.Fields, \"Fields collection is null\");\r\n\r\n                StoreTypeInfo fieldInfo;\r\n                if (!initInfo.Fields.TryGetValue(key, out fieldInfo))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                Verify.IsNotNull(fieldInfo, \"Field info is missing\");\r\n\r\n\r\n                FieldInfo dataContextFieldInfo = dataContextType != null\r\n                    ? dataContextType.GetField(fieldInfo.FieldName)\r\n                    : fieldInfo.DataContextField;\r\n\r\n                Type sqlDataProvdierHelperType = fieldInfo.SqlHelperClass;\r\n\r\n                var sqlDataProviderHelper = (ISqlDataProviderHelper)Activator.CreateInstance(sqlDataProvdierHelperType);\r\n\r\n                var sqlDataTypeStoreTable = new SqlDataTypeStoreTable(\r\n                    initInfo.DataTypeDescriptor.DataTypeId,\r\n                    dataContextFieldInfo,\r\n                    sqlDataProviderHelper,\r\n                    fieldInfo.FieldName,\r\n                    fieldInfo.FieldType);\r\n                _createdSqlDataTypeStoreTables.Add(sqlDataTypeStoreTable);\r\n\r\n                sqlDataTypeStoreTables.Add(key, sqlDataTypeStoreTable);\r\n            }\r\n\r\n\r\n            var sqlDataTypeStore = new SqlDataTypeStore(result.InterfaceType,\r\n                sqlDataTypeStoreTables,\r\n                initInfo.DataTypeDescriptor.IsCodeGenerated,\r\n                _sqlDataTypeStoresContainer);\r\n\r\n            result.SqlDataTypeStore = sqlDataTypeStore;\r\n\r\n            return result;\r\n        }\r\n\r\n        private InterfaceGeneratedClassesInfo InitializeStoreTypes(InterfaceConfigurationElement element,\r\n            Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>> allSqlDataTypeStoreDataScopes,\r\n            Type dataContextClass,\r\n            bool forceCompile,\r\n            ref bool dataContextRecompilationNeeded)\r\n        {\r\n            HelperClassesGenerationInfo toCompile = null;\r\n\r\n            var result = InitializeStoreTypes(element, allSqlDataTypeStoreDataScopes, dataContextClass, null, forceCompile, ref dataContextRecompilationNeeded, ref toCompile);\r\n\r\n            if (result != null && toCompile != null)\r\n            {\r\n                var codeGenerationBuilder = new CodeGenerationBuilder(_dataProviderContext.ProviderName + \":\" + result.InterfaceType.FullName);\r\n\r\n                toCompile.GenerateCodeAction(codeGenerationBuilder);\r\n\r\n                var types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder, false).ToArray();\r\n\r\n                toCompile.PopulateFieldsAction(types);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private InterfaceGeneratedClassesInfo InitializeStoreTypes(InterfaceConfigurationElement element,\r\n            Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>> allSqlDataTypeStoreDataScopes,\r\n            Type dataContextClass,\r\n            Dictionary<Guid, Type> dataTypes,\r\n            bool forceCompile,\r\n            ref bool dataContextRecompilationNeeded,\r\n            ref HelperClassesGenerationInfo helperClassesGenerationInfo)\r\n        {\r\n            var result = new InterfaceGeneratedClassesInfo();\r\n\r\n            var dataScopes = new List<SqlDataTypeStoreDataScope>();\r\n\r\n            foreach (StorageInformation storageInformation in element.Stores)\r\n            {\r\n                var sqlDataTypeStoreDataScope = new SqlDataTypeStoreDataScope\r\n                {\r\n                    DataScopeName = storageInformation.DataScope,\r\n                    CultureName = storageInformation.CultureName,\r\n                    TableName = storageInformation.TableName\r\n                };\r\n\r\n                dataScopes.Add(sqlDataTypeStoreDataScope);\r\n            }\r\n\r\n            result.DataScopes = dataScopes;\r\n\r\n            Guid dataTypeId = element.DataTypeId;\r\n\r\n            var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(dataTypeId, true);\r\n            if (dataTypeDescriptor == null)\r\n            {\r\n                throw NewConfigurationException(element, $\"Failed to get a DataTypeDescriptor by id '{dataTypeId}'\");\r\n            }\r\n\r\n            result.DataTypeDescriptor = dataTypeDescriptor;\r\n\r\n            Type interfaceType = null;\r\n\r\n            try\r\n            {\r\n                if (dataTypes == null\r\n                    || !dataTypes.TryGetValue(dataTypeId, out interfaceType)\r\n                    || interfaceType == null)\r\n                {\r\n                    interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n                }\r\n\r\n                if (interfaceType == null)\r\n                {\r\n                    Log.LogWarning(LogTitle, \"The data interface type '{0}' does not exists and is not code generated. It will not be unusable\", dataTypeDescriptor.TypeManagerTypeName);\r\n                    return result;\r\n                }\r\n\r\n                result.InterfaceType = interfaceType;\r\n\r\n                string validationMessage;\r\n                bool isValid = DataTypeValidationRegistry.Validate(interfaceType, dataTypeDescriptor, out validationMessage);\r\n                if (!isValid)\r\n                {\r\n                    Log.LogCritical(LogTitle, validationMessage);\r\n                    throw new InvalidOperationException(validationMessage);\r\n                }\r\n\r\n                Dictionary<SqlDataTypeStoreTableKey, StoreTypeInfo> fields;\r\n                helperClassesGenerationInfo = EnsureNeededTypes(dataTypeDescriptor,\r\n                    dataScopes, allSqlDataTypeStoreDataScopes, dataContextClass,\r\n                    out fields, ref dataContextRecompilationNeeded, forceCompile);\r\n\r\n                result.Fields = fields;\r\n                return result;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                if (interfaceType != null)\r\n                {\r\n                    DataProviderRegistry.RegisterDataTypeInitializationError(interfaceType, ex);\r\n                    DataProviderRegistry.AddKnownDataType(interfaceType, _dataProviderContext.ProviderName);\r\n\r\n                    Log.LogError(LogTitle, \"Failed initialization for the datatype {0}\", dataTypeDescriptor.TypeManagerTypeName);\r\n                }\r\n                Log.LogError(LogTitle, ex);\r\n\r\n                result.Fields = new Dictionary<SqlDataTypeStoreTableKey, StoreTypeInfo>();\r\n\r\n                return result;\r\n            }\r\n        }\r\n\r\n\r\n        private class InitializeStoreResult\r\n        {\r\n            public InitializeStoreResult()\r\n            {\r\n                TableNames = new Dictionary<SqlDataTypeStoreTableKey, string>();\r\n            }\r\n\r\n            public Type InterfaceType { get; set; }\r\n            public SqlDataTypeStore SqlDataTypeStore { get; set; }\r\n            public Dictionary<SqlDataTypeStoreTableKey, string> TableNames { get; set; }\r\n        }\r\n\r\n\r\n        private class InterfaceGeneratedClassesInfo\r\n        {\r\n            public Type InterfaceType { get; set; }\r\n            public List<SqlDataTypeStoreDataScope> DataScopes { get; set; }\r\n            public DataTypeDescriptor DataTypeDescriptor { get; set; }\r\n            public Dictionary<SqlDataTypeStoreTableKey, StoreTypeInfo> Fields { get; set; }\r\n        }\r\n\r\n\r\n        private void AddDataTypeStore(InitializeStoreResult initializeStoreResult, bool doValidate = true, bool isInitialization = false)\r\n        {\r\n            if (initializeStoreResult.InterfaceType == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            bool isValid = initializeStoreResult.SqlDataTypeStore != null;\r\n\r\n            if (isValid && doValidate)\r\n            {\r\n                isValid = ValidateTables(initializeStoreResult, isInitialization);\r\n            }\r\n\r\n            if (!isValid)\r\n            {\r\n                _sqlDataTypeStoresContainer.AddKnownInterface(initializeStoreResult.InterfaceType);\r\n                return;\r\n            }\r\n\r\n            _sqlDataTypeStoresContainer.AddSupportedDataTypeStore(initializeStoreResult.InterfaceType, initializeStoreResult.SqlDataTypeStore);\r\n            DataProviderRegistry.AddNewDataType(initializeStoreResult.InterfaceType, _dataProviderContext.ProviderName);\r\n        }\r\n\r\n\r\n\r\n        private bool ValidateTables(InitializeStoreResult initializeStoreResult, bool isInitialization)\r\n        {\r\n            var errors = new StringBuilder();\r\n\r\n            bool isValid = true;\r\n\r\n            var interfaceType = initializeStoreResult.InterfaceType;\r\n            foreach (string tableName in initializeStoreResult.TableNames.Values)\r\n            {\r\n                bool isTableValid = ValidateTable(interfaceType, tableName, errors);\r\n                if (!isTableValid) isValid = false;\r\n            }\r\n\r\n            if (!isValid)\r\n            {\r\n                DataTypeValidationRegistry.AddValidationError(initializeStoreResult.InterfaceType, _dataProviderContext.ProviderName, errors.ToString());\r\n\r\n                if (isInitialization\r\n                    && GlobalSettingsFacade.EnableDataTypesAutoUpdate\r\n                    && interfaceType.IsAutoUpdateble()\r\n                    && !interfaceType.IsGenerated())\r\n                {\r\n                    Log.LogInformation(LogTitle, \"Data schema for the data interface '{0}' on the SqlDataProvider '{1}' is not matching and will be updated.\",\r\n                                        initializeStoreResult.InterfaceType, _dataProviderContext.ProviderName);\r\n                    Log.LogInformation(LogTitle, errors.ToString());\r\n                }\r\n                else\r\n                {\r\n                    Log.LogCritical(LogTitle, \"The data interface '{0}' will not work for the SqlDataProvider '{1}'\",\r\n                                     initializeStoreResult.InterfaceType, _dataProviderContext.ProviderName);\r\n                    Log.LogCritical(LogTitle, errors.ToString());\r\n                }\r\n\r\n            }\r\n\r\n            return isValid;\r\n        }\r\n\r\n\r\n\r\n        private bool ValidateTable(Type interfaceType, string tableName, StringBuilder errors)\r\n        {\r\n            ISqlTableInformation sqlTableInformation = SqlTableInformationStore.GetTableInformation(_connectionString, tableName);\r\n\r\n            if (sqlTableInformation == null)\r\n            {\r\n                errors.AppendLine($\"Table '{tableName}' does not exist\");\r\n                return false;\r\n            }\r\n\r\n            int primaryKeyCount = sqlTableInformation.ColumnInformations.Count(column => column.IsPrimaryKey);\r\n\r\n            if (primaryKeyCount == 0)\r\n            {\r\n                errors.AppendLine($\"The table '{tableName}' is missing a primary key\");\r\n                return false;\r\n            }\r\n\r\n\r\n            var columns = new List<SqlColumnInformation>(sqlTableInformation.ColumnInformations);\r\n            var properties = interfaceType.GetPropertiesRecursively();\r\n\r\n            foreach (PropertyInfo property in properties)\r\n            {\r\n                if (property.Name == nameof(IData.DataSourceId)) continue;\r\n\r\n                SqlColumnInformation column = columns.Find(col => col.ColumnName == property.Name);\r\n                if (column == null)\r\n                {\r\n                    errors.AppendLine($\"The interface property named '{property.Name}' does not exist in the table '{sqlTableInformation.TableName}' as a column.\");\r\n                    return false;\r\n                }\r\n\r\n                if (!column.IsNullable || column.Type == typeof(string))\r\n                {\r\n                    if (column.Type != property.PropertyType)\r\n                    {\r\n                        errors.AppendLine($\"Type mismatch for property '{property.Name}'. Type '{property.PropertyType}' does not match the database column type '{column.Type}'.\");\r\n                        return false;\r\n                    }\r\n                }\r\n            }\r\n\r\n            // Updating schema from C1 4.1, to be removed in future versions.\r\n//            if (typeof (ILocalizedControlled).IsAssignableFrom(interfaceType)\r\n//                && !properties.Any(p => p.Name == \"CultureName\")\r\n//                && columns.Any(c => c.ColumnName == \"CultureName\"))\r\n//            {\r\n//                Log.LogInformation(LogTitle, \"Removing obsolete 'CultureName' column from table '{0}'\", tableName);\r\n\r\n\r\n//                string selectConstraintName = string.Format(\r\n//                    @\"SELECT df.name 'ConstraintName'\r\n//                    FROM sys.default_constraints df\r\n//                    INNER JOIN sys.tables t ON df.parent_object_id = t.object_id\r\n//                    INNER JOIN sys.columns c ON df.parent_object_id = c.object_id AND df.parent_column_id = c.column_id\r\n//                    where t.name = '{0}'\r\n//                    and c.name = 'CultureName'\", tableName);\r\n\r\n\r\n//                var dt = ExecuteReader(selectConstraintName);\r\n//                List<string> constraints = (from DataRow dr in dt.Rows select dr[\"ConstraintName\"].ToString()).ToList();\r\n\r\n//                foreach (var constrainName in constraints)\r\n//                {\r\n//                    ExecuteSql(\"ALTER TABLE [{0}] DROP CONSTRAINT [{1}]\".FormatWith(tableName, constrainName));\r\n//                }\r\n\r\n//                string sql = \"ALTER TABLE [{0}] DROP COLUMN [CultureName]\".FormatWith(tableName);\r\n\r\n//                ExecuteSql(sql);\r\n//            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n        //private void ExecuteSql(string sql)\r\n        //{\r\n        //    var conn = SqlConnectionManager.GetConnection(_connectionString);\r\n\r\n        //    Log.LogInformation(LogTitle, sql);\r\n\r\n        //    using (var cmd = new SqlCommand(sql, conn))\r\n        //    {\r\n        //        cmd.ExecuteNonQuery();\r\n        //    }\r\n        //}\r\n\r\n        //private DataTable ExecuteReader(string commandText)\r\n        //{\r\n        //    var conn = SqlConnectionManager.GetConnection(_connectionString);\r\n\r\n        //    using (var cmd = new SqlCommand(commandText, conn))\r\n        //    {\r\n        //        using (var dt = new DataTable())\r\n        //        {\r\n        //            using (var rdr = cmd.ExecuteReader())\r\n        //            {\r\n        //                if (rdr != null) dt.Load(rdr);\r\n        //                return dt;\r\n        //            }\r\n        //        }\r\n        //    }\r\n        //}\r\n\r\n        internal class StoreTypeInfo\r\n        {\r\n            public StoreTypeInfo(string fieldName, Type fieldType, Type sqlHelperType)\r\n            {\r\n                FieldName = fieldName;\r\n                FieldType = fieldType;\r\n                SqlHelperClass = sqlHelperType;\r\n            }\r\n\r\n            public string FieldName;\r\n            public Type FieldType;\r\n            public Type SqlHelperClass;\r\n\r\n            public FieldInfo DataContextField;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Checks that tables related to specified data type included in current DataContext class, if not - compiles a new version of DataContext that contains them\r\n        /// </summary>\r\n        private HelperClassesGenerationInfo EnsureNeededTypes(\r\n            DataTypeDescriptor dataTypeDescriptor,\r\n            IEnumerable<SqlDataTypeStoreDataScope> sqlDataTypeStoreDataScopes,\r\n            Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>> allSqlDataTypeStoreDataScopes,\r\n            Type dataContextClassType,\r\n            out Dictionary<SqlDataTypeStoreTableKey, StoreTypeInfo> fields,\r\n            ref bool dataContextRecompileNeeded, bool forceCompile = false)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                // Getting the interface (ensuring that it exists)\r\n                Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n\r\n                var storeDataScopesToCompile = new List<SqlDataTypeStoreDataScope>();\r\n                var storeDataScopesAlreadyCompiled = new List<SqlDataTypeStoreDataScope>();\r\n\r\n                fields = new Dictionary<SqlDataTypeStoreTableKey, StoreTypeInfo>();\r\n\r\n                foreach (SqlDataTypeStoreDataScope storeDataScope in sqlDataTypeStoreDataScopes)\r\n                {\r\n                    string dataContextFieldName = NamesCreator.MakeDataContextFieldName(storeDataScope.TableName);\r\n\r\n                    FieldInfo dataContextFieldInfo = null;\r\n                    if (dataContextClassType != null)\r\n                    {\r\n                        dataContextFieldInfo = dataContextClassType.GetFields(BindingFlags.Public | BindingFlags.Instance)\r\n                                                                   .SingleOrDefault(f => f.Name == dataContextFieldName);\r\n                    }\r\n\r\n\r\n                    string sqlDataProviderHelperClassFullName = NamesCreator.MakeSqlDataProviderHelperClassFullName(dataTypeDescriptor, storeDataScope.DataScopeName, storeDataScope.CultureName, _dataProviderContext.ProviderName);\r\n\r\n                    string entityClassName = NamesCreator.MakeEntityClassFullName(dataTypeDescriptor, storeDataScope.DataScopeName, storeDataScope.CultureName, _dataProviderContext.ProviderName);\r\n\r\n                    Type sqlDataProviderHelperClass = null, entityClass = null;\r\n\r\n                    try\r\n                    {\r\n                        sqlDataProviderHelperClass = TryGetGeneratedType(sqlDataProviderHelperClassFullName);\r\n                        entityClass = TryGetGeneratedType(entityClassName);\r\n\r\n                        forceCompile = forceCompile\r\n                            || CodeGenerationManager.IsRecompileNeeded(interfaceType, new[] { sqlDataProviderHelperClass, entityClass });\r\n                    }\r\n                    catch (TypeLoadException)\r\n                    {\r\n                        forceCompile = true;\r\n                    }\r\n\r\n                    if (!forceCompile)\r\n                    {\r\n                        var storeTypeInfo = new StoreTypeInfo(dataContextFieldName, entityClass, sqlDataProviderHelperClass)\r\n                        {\r\n                            DataContextField = dataContextFieldInfo\r\n                        };\r\n\r\n                        fields.Add(new SqlDataTypeStoreTableKey(storeDataScope.DataScopeName, storeDataScope.CultureName), storeTypeInfo);\r\n                    }\r\n\r\n                    if (dataContextFieldInfo == null)\r\n                    {\r\n                        dataContextRecompileNeeded = true;\r\n                    }\r\n\r\n                    if (forceCompile)\r\n                    {\r\n                        storeDataScopesToCompile.Add(storeDataScope);\r\n                    }\r\n                    else\r\n                    {\r\n                        storeDataScopesAlreadyCompiled.Add(storeDataScope);\r\n                    }\r\n                }\r\n\r\n\r\n                if (storeDataScopesToCompile.Any())\r\n                {\r\n                    dataContextRecompileNeeded = true;\r\n\r\n                    if (!dataTypeDescriptor.IsCodeGenerated)\r\n                    {\r\n                        // Building a new descriptor so generated classes take in account field changes\r\n                        dataTypeDescriptor = DynamicTypeManager.BuildNewDataTypeDescriptor(interfaceType);\r\n                    }\r\n\r\n                    return CompileMissingClasses(dataTypeDescriptor, allSqlDataTypeStoreDataScopes, fields,\r\n                        storeDataScopesToCompile, storeDataScopesAlreadyCompiled);\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private bool TryLoadDataContextClass(Type dataContextClassType)\r\n        {\r\n            if (_typeLoadResults.ContainsKey(dataContextClassType))\r\n            {\r\n                return _typeLoadResults[dataContextClassType];\r\n            }\r\n\r\n            bool success = true;\r\n\r\n            var connection = SqlConnectionManager.GetConnection(_connectionString);\r\n\r\n            try\r\n            {\r\n                var dataContext = (DataContext)Activator.CreateInstance(dataContextClassType, connection);\r\n                dataContext.Dispose();\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                var innerEx = ex;\r\n\r\n                while (innerEx is TargetInvocationException)\r\n                {\r\n                    innerEx = innerEx.InnerException;\r\n                }\r\n\r\n                if (!(innerEx is TypeLoadException || innerEx is FileNotFoundException))\r\n                {\r\n                    throw;\r\n                }\r\n\r\n                Log.LogWarning(LogTitle, \"Failed to load DataContext class, creating a new one.\");\r\n                Log.LogWarning(LogTitle, innerEx.Message);\r\n\r\n                success = false;\r\n            }\r\n\r\n\r\n            lock (_typeLoadResults)\r\n            {\r\n                _typeLoadResults[dataContextClassType] = success;\r\n            }\r\n\r\n            return success;\r\n        }\r\n\r\n\r\n        private class HelperClassesGenerationInfo\r\n        {\r\n            public Action<CodeGenerationBuilder> GenerateCodeAction;\r\n            public Action<Type[]> PopulateFieldsAction;\r\n        }\r\n\r\n\r\n\r\n        private HelperClassesGenerationInfo CompileMissingClasses(DataTypeDescriptor dataTypeDescriptor, Dictionary<DataTypeDescriptor,\r\n                                           IEnumerable<SqlDataTypeStoreDataScope>> allSqlDataTypeStoreDataScopes,\r\n                                           Dictionary<SqlDataTypeStoreTableKey, StoreTypeInfo> fields,\r\n                                           List<SqlDataTypeStoreDataScope> storeDataScopesToCompile,\r\n                                           List<SqlDataTypeStoreDataScope> storeDataScopesAlreadyCompiled)\r\n        {\r\n            return new HelperClassesGenerationInfo\r\n            {\r\n                GenerateCodeAction = codeGenerationBuilder =>\r\n                {\r\n                    var sqlDataProviderCodeBuilder = new SqlDataProviderCodeBuilder(_dataProviderContext.ProviderName, codeGenerationBuilder);\r\n                    sqlDataProviderCodeBuilder.AddDataType(dataTypeDescriptor, storeDataScopesToCompile);\r\n\r\n                    sqlDataProviderCodeBuilder.AddExistingDataType(dataTypeDescriptor, storeDataScopesAlreadyCompiled);\r\n                },\r\n                PopulateFieldsAction = types =>\r\n                {\r\n                    foreach (SqlDataTypeStoreDataScope storeDataScope in storeDataScopesToCompile)\r\n                    {\r\n                        string dataContextFieldName = NamesCreator.MakeDataContextFieldName(storeDataScope.TableName);\r\n\r\n                        string helperClassFullName = NamesCreator.MakeSqlDataProviderHelperClassFullName(\r\n                            dataTypeDescriptor, storeDataScope.DataScopeName, storeDataScope.CultureName, _dataProviderContext.ProviderName);\r\n                        Type helperClass = types.Single(f => f.FullName == helperClassFullName);\r\n\r\n                        string entityClassFullName = NamesCreator.MakeEntityClassFullName(\r\n                            dataTypeDescriptor, storeDataScope.DataScopeName, storeDataScope.CultureName, _dataProviderContext.ProviderName);\r\n                        Type entityClass = types.Single(f => f.FullName == entityClassFullName);\r\n\r\n                        var storeTableKey = new SqlDataTypeStoreTableKey(storeDataScope.DataScopeName, storeDataScope.CultureName);\r\n                        fields[storeTableKey] = new StoreTypeInfo(dataContextFieldName, entityClass, helperClass);\r\n                    }\r\n\r\n                    foreach (SqlDataTypeStoreDataScope storeDataScope in storeDataScopesAlreadyCompiled)\r\n                    {\r\n                        string dataContextFieldName = NamesCreator.MakeDataContextFieldName(storeDataScope.TableName);\r\n\r\n                        string helperClassFullName = NamesCreator.MakeSqlDataProviderHelperClassFullName(\r\n                            dataTypeDescriptor, storeDataScope.DataScopeName, storeDataScope.CultureName, _dataProviderContext.ProviderName);\r\n                        Type helperClass = TryGetGeneratedType(helperClassFullName);\r\n\r\n                        string entityClassFullName = NamesCreator.MakeEntityClassFullName(\r\n                            dataTypeDescriptor, storeDataScope.DataScopeName, storeDataScope.CultureName, _dataProviderContext.ProviderName);\r\n                        Type entityClass = TryGetGeneratedType(entityClassFullName);\r\n\r\n                        var storeTableKey = new SqlDataTypeStoreTableKey(storeDataScope.DataScopeName, storeDataScope.CultureName);\r\n                        fields[storeTableKey] = new StoreTypeInfo(dataContextFieldName, entityClass, helperClass);\r\n                    }\r\n                }\r\n            };\r\n        }\r\n\r\n        private Type TryGetGeneratedType(string typeName)\r\n        {\r\n            Type compiledType = CodeGenerationManager.GetCompiledType(typeName);\r\n            if (compiledType != null) return compiledType;\r\n\r\n            if (_compositeGeneratedAssembly != null)\r\n            {\r\n                Type result = _compositeGeneratedAssembly.GetType(typeName, false);\r\n                if (result != null) return result;\r\n            }\r\n\r\n            return TypeManager.TryGetType(typeName);\r\n        }\r\n\r\n        /// <summary>\r\n        /// This method updates the DataContextQueryableFieldInfo property on all existing store tables.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// This is needed due to the fact that all data stores share the same\r\n        /// DataContext class and the DataContext class is code generated everytime\r\n        /// a new store is code generated.\r\n        /// </remarks>\r\n        /// <param name=\"newDataContextClassType\"></param>\r\n        private void UpdateCreatedSqlDataTypeStoreTables(Type newDataContextClassType)\r\n        {\r\n            foreach (SqlDataTypeStoreTable dataTypeStoreTable in _createdSqlDataTypeStoreTables)\r\n            {\r\n                Verify.IsNotNull(dataTypeStoreTable.DataContextQueryableFieldInfo, \"Missing field info\");\r\n\r\n                string fieldName = dataTypeStoreTable.DataContextQueryableFieldInfo.Name;\r\n\r\n                FieldInfo newFieldInfo = newDataContextClassType.GetFields(BindingFlags.Public | BindingFlags.Instance).SingleOrDefault(f => f.Name == fieldName);\r\n\r\n                if (newFieldInfo != null)\r\n                {\r\n                    dataTypeStoreTable.DataContextQueryableFieldInfo = newFieldInfo;\r\n                }\r\n                else\r\n                {\r\n                    Log.LogWarning(LogTitle, $\"DataContext missing field newly created field '{fieldName}'\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>> BuildAllExistingDataTypeStoreDataScopes()\r\n        {\r\n            var allSqlDataTypeStoreDataScopes = new Dictionary<DataTypeDescriptor, IEnumerable<SqlDataTypeStoreDataScope>>();\r\n\r\n            foreach (InterfaceConfigurationElement element in _interfaceConfigurationElements)\r\n            {\r\n                Guid dataTypeId = element.DataTypeId;\r\n                var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(dataTypeId, true);\r\n                if (dataTypeDescriptor == null)\r\n                {\r\n                    Log.LogWarning(LogTitle, $\"Failed to get data type descriptor by id '{dataTypeId}'\");\r\n                    continue;\r\n                }\r\n\r\n                var sqlDataTypeStoreDataScopes = new List<SqlDataTypeStoreDataScope>();\r\n\r\n                foreach (StorageInformation storageInformation in element.Stores)\r\n                {\r\n                    var sqlDataTypeStoreDataScope = new SqlDataTypeStoreDataScope\r\n                    {\r\n                        DataScopeName = storageInformation.DataScope,\r\n                        CultureName = storageInformation.CultureName,\r\n                        TableName = storageInformation.TableName\r\n                    };\r\n\r\n                    sqlDataTypeStoreDataScopes.Add(sqlDataTypeStoreDataScope);\r\n                }\r\n\r\n                allSqlDataTypeStoreDataScopes.Add(dataTypeDescriptor, sqlDataTypeStoreDataScopes);\r\n            }\r\n\r\n            return allSqlDataTypeStoreDataScopes;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/SqlDataTypeStore.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Data.Linq;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider\r\n{\r\n    internal sealed class SqlDataTypeStore\r\n    {\r\n        private readonly SqlDataTypeStoresContainer _sqlDataTypeStoresContainer;\r\n        private Type _listOfInterfaceType = null;\r\n\r\n\r\n        internal SqlDataTypeStore(Type interfaceType, Dictionary<SqlDataTypeStoreTableKey, SqlDataTypeStoreTable> sqlDataTypeStoreTables, bool isGeneretedDataType, SqlDataTypeStoresContainer sqlDataTypeStoresContainer)\r\n        {\r\n            _sqlDataTypeStoresContainer = sqlDataTypeStoresContainer;\r\n\r\n            InterfaceType = interfaceType;\r\n            StoreTables = sqlDataTypeStoreTables;\r\n            IsGeneretedDataType = isGeneretedDataType;\r\n        }\r\n\r\n                \r\n        public Type InterfaceType { get; private set; }\r\n\r\n\r\n        public bool IsGeneretedDataType { get; private set; }\r\n\r\n        \r\n        internal Dictionary<SqlDataTypeStoreTableKey, SqlDataTypeStoreTable> StoreTables { get; private set; }\r\n\r\n        \r\n        public IQueryable GetQueryable()\r\n        {\r\n            SqlDataTypeStoreTableKey tableKey = GetTableKey();\r\n                \r\n\r\n            IQueryable queryable;\r\n            if (StoreTables.ContainsKey(tableKey))\r\n            {\r\n                queryable = SqlDataContextHelperClass.GetTable(_sqlDataTypeStoresContainer.GetDataContext(), StoreTables[tableKey]);\r\n            }\r\n            else\r\n            {\r\n                if (_listOfInterfaceType == null)\r\n                {\r\n                    _listOfInterfaceType = typeof(List<>);\r\n                    _listOfInterfaceType = _listOfInterfaceType.MakeGenericType(InterfaceType);\r\n                }\r\n\r\n                IEnumerable list = (IEnumerable)Activator.CreateInstance(_listOfInterfaceType, null);\r\n\r\n                return list.AsQueryable();\r\n            }\r\n\r\n\r\n            return queryable;\r\n        }\r\n\r\n\r\n       \r\n        public IData GetDataByDataId(IDataId dataId, DataProviderContext dataProivderContext)\r\n        {\r\n            SqlDataTypeStoreTable storage = GetCurrentTable();\r\n\r\n            return storage.SqlDataProviderHelper.GetDataById(GetQueryable(), dataId, dataProivderContext);\r\n        }\r\n\r\n\r\n        \r\n        public IData AddNew(IData dataToAdd, DataProviderContext dataProivderContext, DataContext dataContext)\r\n        {\r\n            SqlDataTypeStoreTable storeTable = GetCurrentTable();\r\n\r\n            return storeTable.SqlDataProviderHelper.AddData((ISqlDataContext)dataContext, dataToAdd, dataProivderContext);\r\n        }\r\n\r\n\r\n\r\n        public void RemoveData(IData dataToRemove, DataContext dataContext)\r\n        {\r\n            SqlDataTypeStoreTable storeTable = GetCurrentTable();\r\n\r\n            storeTable.SqlDataProviderHelper.RemoveData((ISqlDataContext)dataContext, dataToRemove);\r\n        }\r\n\r\n\r\n\r\n        private SqlDataTypeStoreTableKey GetTableKey()\r\n        {\r\n            string dataScope = DataScopeManager.MapByType(InterfaceType).Name;\r\n            string cultureInfo = LocalizationScopeManager.MapByType(InterfaceType).Name;\r\n\r\n            return new SqlDataTypeStoreTableKey(dataScope, cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        private SqlDataTypeStoreTable GetCurrentTable()\r\n        {\r\n            SqlDataTypeStoreTableKey tableKey = GetTableKey();\r\n\r\n            if (StoreTables.ContainsKey(tableKey) == false) throw new InvalidOperationException(string.Format(\"No SQL table defined for the interface type '{0}' in the data scope '{1}' and locale '{2}'\", InterfaceType.FullName, tableKey.DataScopeIdentifierName, tableKey.LocaleCultureName));\r\n\r\n            return StoreTables[tableKey];\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/SqlDataTypeStoreDataScope.cs",
    "content": "﻿\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider\r\n{\r\n    internal class SqlDataTypeStoreDataScope\r\n    {\r\n        internal string DataScopeName { get; set; }\r\n        internal string CultureName { get; set; }\r\n        internal string TableName { get; set; }\r\n\r\n\r\n        public override bool Equals(object obj)\r\n        {\r\n            return Equals(obj as SqlDataTypeStoreDataScope);\r\n        }\r\n\r\n\r\n\r\n        public bool Equals(SqlDataTypeStoreDataScope sqlDataTypeStoreDataScope)\r\n        {\r\n            if (sqlDataTypeStoreDataScope == null) return false;\r\n\r\n            return\r\n                sqlDataTypeStoreDataScope.DataScopeName == DataScopeName &&\r\n                sqlDataTypeStoreDataScope.CultureName == CultureName &&\r\n                sqlDataTypeStoreDataScope.TableName == TableName;\r\n        }\r\n\r\n\r\n\r\n        public override int GetHashCode()\r\n        {\r\n            return \r\n                DataScopeName.GetHashCode() ^\r\n                CultureName.GetHashCode() ^\r\n                TableName.GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/SqlDataTypeStoresContainer.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Data.Linq;\r\nusing System.Data.SqlTypes;\r\nusing System.Reflection;\r\nusing Composite.Core.Sql;\r\nusing Composite.Core.Threading;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.CodeGeneration;\r\nusing Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider\r\n{\r\n    internal sealed class SqlDataTypeStoresContainer\r\n    {\r\n        private static readonly ConcurrentDictionary<Type, List<PropertyInfo>> _dateTimeProperties = new ConcurrentDictionary<Type, List<PropertyInfo>>();\r\n\r\n\r\n        private readonly Dictionary<Type, SqlDataTypeStore> _sqlDataTypeStores = new Dictionary<Type, SqlDataTypeStore>();\r\n        private readonly List<Type> _supportedInterfaces = new List<Type>();\r\n        private readonly List<Type> _knownInterfaces = new List<Type>();\r\n        private readonly List<Type> _generatedInterfaces = new List<Type>();\r\n\r\n\r\n        private readonly string _providerName;\r\n        private readonly SqlLoggingContext _sqlLoggingContext;\r\n        \r\n        \r\n        internal SqlDataTypeStoresContainer(string providerName, string connectionString, SqlLoggingContext sqlLoggingContext = null)\r\n        {\r\n            _providerName = providerName;\r\n            ConnectionString = connectionString;\r\n            _sqlLoggingContext = sqlLoggingContext;\r\n        }\r\n\r\n\r\n\r\n        public string ConnectionString { get; internal set; }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// All working data types \r\n        /// </summary>\r\n        public IEnumerable<Type> SupportedInterfaces => _supportedInterfaces;\r\n\r\n\r\n        /// <summary>\r\n        /// All data types, including non working due to config error or something else\r\n        /// </summary>\r\n        public IEnumerable<Type> KnownInterfaces => _knownInterfaces;\r\n\r\n\r\n        /// <summary>\r\n        /// All working generated data types\r\n        /// </summary>\r\n        public IEnumerable<Type> GeneratedInterfaces => _generatedInterfaces;\r\n\r\n\r\n        internal Type DataContextClass { get; set; }\r\n\r\n\r\n\r\n        public SqlDataTypeStore GetDataTypeStore(Type interfaceType)\r\n        {\r\n            SqlDataTypeStore store;\r\n            if (!_sqlDataTypeStores.TryGetValue(interfaceType, out store))\r\n            {\r\n                throw new InvalidOperationException($\"Interface '{interfaceType}' is not supported\");\r\n            }\r\n            \r\n            return store;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method adds the support of the given data interface type to the xml data provider.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"sqlDataTypeStore\"></param>\r\n        internal void AddSupportedDataTypeStore(Type interfaceType, SqlDataTypeStore sqlDataTypeStore)\r\n        {\r\n            Verify.That(!_sqlDataTypeStores.ContainsKey(interfaceType), \"Type {0} is registered in the SqlDataProvider configuration multiple types\", interfaceType);\r\n            _sqlDataTypeStores.Add(interfaceType, sqlDataTypeStore);\r\n\r\n            _supportedInterfaces.Add(interfaceType);\r\n            AddKnownInterface(interfaceType);\r\n\r\n            if (sqlDataTypeStore.IsGeneretedDataType)\r\n            {\r\n                _generatedInterfaces.Add(interfaceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal void AddKnownInterface(Type interfaceType)\r\n        {\r\n            _knownInterfaces.Add(interfaceType);\r\n        }\r\n\r\n\r\n        internal void RemoveKnownInterface(Type interfaceType)\r\n        {\r\n            _knownInterfaces.Remove(interfaceType);\r\n        }\r\n\r\n\r\n        #region CRUD methos\r\n\r\n\r\n        public List<T> AddNew<T>(IEnumerable<T> dataset, DataProviderContext dataProviderContext)\r\n            where T : class, IData\r\n        {\r\n            SqlDataTypeStore sqlDataTypeStore = TryGetsqlDataTypeStore(typeof(T));\r\n            if (sqlDataTypeStore == null) throw new InvalidOperationException($\"The interface '{typeof(T).FullName}' has not been configured\");\r\n\r\n            var resultDataset = new List<T>();\r\n\r\n            using (var dataContext = CreateDataContext())\r\n            {\r\n                foreach (IData data in dataset)\r\n                {\r\n                    Verify.ArgumentCondition(data != null, \"dataset\", \"Data set may not contain null values\");\r\n\r\n                    IData newData = sqlDataTypeStore.AddNew(data, dataProviderContext, dataContext);\r\n\r\n                    ((IEntity) newData).Commit();\r\n\r\n                    CheckConstraints(newData);\r\n\r\n                    resultDataset.Add((T)newData);\r\n                }\r\n\r\n                SubmitChanges(dataContext);\r\n            }\r\n\r\n            return resultDataset;\r\n        }\r\n\r\n\r\n\r\n        public void Update(IEnumerable<IData> dataset)\r\n        {\r\n            using (DataContext dataContext = CreateDataContext())\r\n            {\r\n                foreach (IData data in dataset)\r\n                {\r\n                    Verify.ArgumentCondition(data != null, \"dataset\", \"The data set shouldn't contain any null values.\");\r\n\r\n                    // TODO: Check if it's necessury to make an optimization here\r\n                    ITable table = GetTable(dataContext, data);\r\n                    table.Attach(data);\r\n\r\n                    IEntity entity = (IEntity)data;\r\n                    entity.Commit();\r\n                }\r\n\r\n                SubmitChanges(dataContext);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void Delete(IEnumerable<DataSourceId> dataSourceIds, DataProviderContext dataProivderContext)\r\n        {\r\n            DataContext dataContext = null;\r\n            try\r\n            {\r\n                foreach (DataSourceId dataSourceId in dataSourceIds)\r\n                {\r\n                    if (dataSourceId == null) throw new ArgumentException(\"dataSourceIds contains null values\");\r\n\r\n                    using (new DataScope(dataSourceId.DataScopeIdentifier, dataSourceId.LocaleScope))\r\n                    {\r\n                        SqlDataTypeStore sqlDataTypeStore = TryGetsqlDataTypeStore(dataSourceId.InterfaceType);\r\n                        if (sqlDataTypeStore == null) throw new InvalidOperationException($\"The interface '{dataSourceId.InterfaceType.FullName}' has not been configured\");\r\n\r\n                        IData data = sqlDataTypeStore.GetDataByDataId(dataSourceId.DataId, dataProivderContext);\r\n\r\n                        Verify.That(data != null, \"Row has already been deleted\");\r\n\r\n                        if (dataContext == null) dataContext = CreateDataContext();\r\n\r\n                        sqlDataTypeStore.RemoveData(data, dataContext);\r\n                    }\r\n                }\r\n\r\n                if (dataContext != null)\r\n                {\r\n                    SubmitChanges(dataContext);\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                dataContext?.Dispose();\r\n            }\r\n        }\r\n\r\n\r\n        #endregion\r\n\r\n\r\n\r\n        private SqlDataTypeStore TryGetsqlDataTypeStore(Type interfaceType)\r\n        {\r\n            Verify.ArgumentNotNull(interfaceType, \"interfaceType\");\r\n\r\n            SqlDataTypeStore result;\r\n            return _sqlDataTypeStores.TryGetValue(interfaceType, out result) ? result : null;\r\n        }\r\n\r\n\r\n\r\n        private static ITable GetTable(DataContext dataContext, Object entity)\r\n        {\r\n            Verify.ArgumentNotNull(dataContext, \"dataContext\");\r\n            Verify.ArgumentNotNull(entity, \"entity\");\r\n\r\n            Type entityType = entity.GetType();\r\n\r\n            ITable table = dataContext.GetTable(entityType);\r\n            Verify.IsNotNull(table, \"Failed to find a table, related to '{0}' type\", entityType.FullName);\r\n            return table;\r\n        }\r\n\r\n\r\n\r\n        private static void CheckConstraints(IData data)\r\n        {\r\n            // DateTime.MinValue is not supported by SQL, since it has a different minimal value for a date\r\n            if (data is IChangeHistory changeHistory\r\n                && changeHistory.ChangeDate == DateTime.MinValue)\r\n            {\r\n                changeHistory.ChangeDate = DateTime.Now;\r\n            }\r\n\r\n            foreach(PropertyInfo dateTimeProperty in GetDateTimeProperties(data.DataSourceId.InterfaceType))\r\n            {\r\n                object value = dateTimeProperty.GetValue(data, null);\r\n                if(value == null) continue;\r\n\r\n                DateTime dateTime = (DateTime) value;\r\n                if(dateTime == DateTime.MinValue)\r\n                {\r\n                    dateTimeProperty.SetValue(data, SqlDateTime.MinValue.Value, null);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IEnumerable<PropertyInfo> GetDateTimeProperties(Type interfaceType)\r\n        {\r\n            return \r\n                _dateTimeProperties.GetOrAdd(interfaceType, type =>\r\n                {\r\n                    List<PropertyInfo> result = new List<PropertyInfo>();\r\n\r\n                    foreach (PropertyInfo property in interfaceType.GetProperties())\r\n                    {\r\n                        if ((property.PropertyType != typeof(DateTime) && property.PropertyType != typeof(DateTime?))\r\n                            || property.GetSetMethod() == null)\r\n                        {\r\n                            continue;\r\n                        }\r\n\r\n                        result.Add(property);\r\n                    }\r\n\r\n                    foreach(Type baseInterface in interfaceType.GetInterfaces())\r\n                    {\r\n                        if (baseInterface == typeof(IChangeHistory)) continue;\r\n                        \r\n\r\n                        result.AddRange(GetDateTimeProperties(baseInterface));\r\n                    }\r\n\r\n                    return result;\r\n                });\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets an instance of a DataContext.\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        internal DataContext GetDataContext()\r\n        {\r\n            string threadDataKey = \"SqlDataContext\" + _providerName;\r\n\r\n            var threadData = ThreadDataManager.GetCurrentNotNull();\r\n            if (threadData.HasValue(threadDataKey))\r\n            {\r\n                DataContext result = Verify.ResultNotNull(threadData[threadDataKey] as DataContext);\r\n\r\n                // In a result of a flush, data context type can be changed\r\n               if(result.GetType().GUID == DataContextClass.GUID)\r\n               {\r\n                   return result;\r\n               }\r\n            }\r\n\r\n            DataContext dataContext = CreateDataContext();\r\n            dataContext.ObjectTrackingEnabled = false;\r\n\r\n            threadData.OnDispose += dataContext.Dispose;\r\n        \r\n            threadData.SetValue(threadDataKey, dataContext);\r\n\r\n            if (_sqlLoggingContext.Enabled)\r\n            {\r\n                dataContext.Log = new SqlLoggerTextWriter(_sqlLoggingContext);\r\n            }\r\n            \r\n            return dataContext;\r\n        }\r\n\r\n\r\n\r\n        private DataContext CreateDataContext()\r\n        {\r\n            IDbConnection connection = SqlConnectionManager.GetConnection(ConnectionString);\r\n\r\n            DataContext dataContext = (DataContext)Activator.CreateInstance(DataContextClass, connection);\r\n\r\n            if (_sqlLoggingContext.Enabled)\r\n            {\r\n                dataContext.Log = new SqlLoggerTextWriter(_sqlLoggingContext);\r\n            }\r\n\r\n            return dataContext;\r\n        }\r\n\r\n\r\n\r\n        internal static void SubmitChanges(DataContext dataContext)\r\n        {\r\n            dataContext.SubmitChanges();\r\n        }\r\n\r\n\r\n        public void ForgetInterface(Type interfaceType)\r\n        {\r\n            _sqlDataTypeStores.Remove(interfaceType);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MediaFileProvider/MediaFile.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Streams;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MediaFileProvider\r\n{\r\n    [FileStreamManager(typeof(FileSystemFileStreamManager))]\r\n    internal class MediaFile : FileSystemFileBase, IMediaFile \r\n\t{\r\n\t    private string _keyPath;\r\n\r\n        public MediaFile(IMediaFileData file, string storeId, DataSourceId dataSourceId, string filePath)\r\n        {\r\n            DataSourceId = dataSourceId;\r\n            StoreId = storeId;\r\n\r\n            this.Id = file.Id;\r\n            this.FileName = file.FileName;\r\n            this.FolderPath = file.FolderPath;\r\n            this.Title = file.Title;\r\n            this.Description = file.Description;\r\n            this.Tags = file.Tags;\r\n            this.MimeType = file.MimeType;\r\n            this.Length = file.Length;\r\n            this.IsReadOnly = false;\r\n            this.Culture = file.CultureInfo;\r\n            this.CreationTime = file.CreationTime;\r\n            this.LastWriteTime = file.LastWriteTime;\r\n\r\n            this.SystemPath = filePath;\r\n        }\r\n\r\n\t    [JsonConstructor]\r\n\t    private MediaFile(Guid id,string fileName,string folderPath,string title,string description,\r\n            string tags,string mimeType,int? length,bool isReadOnly,string culture,DateTime creationTime,\r\n            DateTime lastWriteTime,string storeId, DataSourceId dataSourceId, string filePath)\r\n\t    {\r\n\t        DataSourceId = dataSourceId;\r\n\t        StoreId = storeId;\r\n\r\n\t        this.Id = id;\r\n\t        this.FileName = fileName;\r\n\t        this.FolderPath = folderPath;\r\n\t        this.Title = title;\r\n\t        this.Description = description;\r\n\t        this.Tags = tags;\r\n\t        this.MimeType = mimeType;\r\n\t        this.Length = length;\r\n\t        this.IsReadOnly = isReadOnly;\r\n\t        this.Culture = culture;\r\n\t        this.CreationTime = creationTime;\r\n\t        this.LastWriteTime = lastWriteTime;\r\n\r\n\t        this.SystemPath = filePath;\r\n\t        \r\n        }\r\n\r\n\t    public Guid Id\r\n        {\r\n            get; internal set;\r\n        }\r\n\r\n        public string KeyPath => _keyPath ?? (_keyPath = this.GetKeyPath());\r\n\r\n\t    public string CompositePath\r\n        {\r\n            get { return this.GetCompositePath(); }\r\n            set { /* Do nothing. Used for deserialization purpouses */ }\r\n        }\r\n\r\n        public string StoreId\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string FolderPath\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string FileName\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string Title\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string Description\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string Tags { get; set; }\r\n\r\n        public string Culture\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string MimeType\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public int? Length\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public DateTime? CreationTime\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public DateTime? LastWriteTime\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public bool IsReadOnly\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n        public DataSourceId DataSourceId { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MediaFileProvider/MediaFileFolder.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MediaFileProvider\r\n{\r\n    internal sealed class MediaFileFolder : IMediaFileFolder\r\n    {\r\n        public MediaFileFolder(IMediaFolderData folder, string storeId, DataSourceId dataSourceId)\r\n        {\r\n            DataSourceId = dataSourceId;\r\n\r\n            Id = folder.Id;\r\n            Description = folder.Description;\r\n            Title = folder.Title;\r\n            StoreId = storeId;\r\n            Path = folder.Path;\r\n        }\r\n\r\n        [JsonConstructor]\r\n        private MediaFileFolder(Guid id,string description,string title,string path, string storeId, DataSourceId dataSourceId)\r\n        {\r\n            DataSourceId = dataSourceId;\r\n\r\n            Id = id;\r\n            Description = description;\r\n            Title = title;\r\n            StoreId = storeId;\r\n            Path = path;\r\n        }\r\n\r\n        public Guid Id\r\n        {\r\n            get; private set;\r\n        }\r\n\r\n        public string KeyPath => this.GetKeyPath();\r\n\r\n        [JsonIgnore]\r\n        public string CompositePath\r\n        {\r\n            get => this.GetCompositePath();\r\n            set => throw new NotImplementedException();\r\n        }\r\n\r\n        public string StoreId\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string Path\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string Title\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public string Description\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public bool IsReadOnly\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        public DataSourceId DataSourceId { get; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/MediaFileProvider/MediaFileProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Routing.MediaUrlProviders;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.MediaFileProvider\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [ConfigurationElementType(typeof(MediaFileDataProviderData))]\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class MediaFileProvider : IWritableDataProvider\r\n    {\r\n        /// <exclude />\r\n        public enum MediaElementType\r\n        {\r\n            /// <exclude />\r\n            File = 1,\r\n            /// <exclude />\r\n            Folder = 2,\r\n            /// <exclude />\r\n            Store = 3\r\n        }\r\n\r\n        private DataProviderContext _context;\r\n        private IMediaFileStore _store;\r\n        private readonly string _storeId;\r\n        private readonly string _storeTitle;\r\n        private readonly string _storeDescription;\r\n        internal static string _workingDirectory; // NOTE: this field is accessed via reflection as well.\r\n\r\n\r\n        private readonly object _syncRoot = new object();\r\n        private IQueryable<IMediaFile> _mediaFilesCachedQuery;\r\n        private IQueryable<IMediaFileFolder> _mediaFoldersCachedQuery;\r\n        private readonly DefaultMediaUrlProvider _mediaUrlProvider;\r\n\r\n        internal MediaFileProvider(string rootDirectory, string storeId, string storeDescription, string storeTitle)\r\n        {\r\n            _workingDirectory = PathUtil.Resolve(rootDirectory);\r\n            if (!C1Directory.Exists(_workingDirectory))\r\n            {\r\n                C1Directory.CreateDirectory(_workingDirectory);\r\n            }\r\n\r\n            _storeId = storeId;\r\n            _storeTitle = storeTitle;\r\n            _storeDescription = storeDescription;\r\n\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IMediaFileData>(ClearQueryCache, false);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IMediaFolderData>(ClearQueryCache, false);\r\n\r\n            _mediaUrlProvider = new DefaultMediaUrlProvider(storeId);\r\n            MediaUrls.RegisterMediaUrlProvider(storeId, _mediaUrlProvider);\r\n        }\r\n\r\n        private void ClearQueryCache(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            lock (_syncRoot)\r\n            {\r\n                _mediaFilesCachedQuery = null;\r\n                _mediaFoldersCachedQuery = null;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DataProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void Update(IEnumerable<IData> dataset)\r\n        {\r\n            if (dataset.Any(data => data == null))\r\n            {\r\n                throw new ArgumentException(\"Data in list to update must be non-null\");\r\n            }\r\n\r\n            foreach (IData data in dataset)\r\n            {\r\n                MediaDataId dataId = data.DataSourceId.DataId as MediaDataId;\r\n                if (dataId == null)\r\n                {\r\n                    throw new ArgumentException(\"Invalid IData\");\r\n                }\r\n\r\n                if (dataId.MediaType == MediaElementType.File)\r\n                {\r\n                    UpdateMediaFile((IMediaFile) data);\r\n                }\r\n                else if (dataId.MediaType == MediaElementType.Folder)\r\n                {\r\n                    UpdateMediaFileFolder((IMediaFileFolder) data);\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException($\"Unexpected media type '{dataId.MediaType}'\");\r\n                }\r\n            }\r\n        }\r\n\r\n        private void UpdateMediaFile(IMediaFile updatedFile)\r\n        {\r\n            Guid id = updatedFile.Id;\r\n\r\n            IMediaFileData currentFileData = DataFacade.GetData<IMediaFileData>(x => x.Id == id).First();\r\n            if (updatedFile.FolderPath != currentFileData.FolderPath || updatedFile.FileName != currentFileData.FileName)\r\n            {\r\n                ValidateMediaFileData(updatedFile);\r\n            }\r\n            CopyFileData(updatedFile, currentFileData);\r\n            currentFileData.LastWriteTime = DateTime.Now;\r\n            using (Stream stream = updatedFile.GetReadStream())\r\n            {\r\n                currentFileData.Length = (int)stream.Length;\r\n            }\r\n            TransactionFileSystemFileStreamManager.WriteFileToDisk(updatedFile);\r\n            DataFacade.Update(currentFileData);\r\n        }\r\n\r\n        private void UpdateMediaFileFolder(IMediaFileFolder updatedFolder)\r\n        {\r\n            Guid mediaFolderId = updatedFolder.Id;\r\n            IMediaFolderData currentFolderData = DataFacade.GetData<IMediaFolderData>(x => x.Id == mediaFolderId).First();\r\n\r\n            if (updatedFolder.Path != currentFolderData.Path)\r\n            {\r\n                ValidateFolderData(updatedFolder);\r\n            }\r\n\r\n            string oldPath = currentFolderData.Path;\r\n            string oldPathWithSlash = oldPath + \"/\";\r\n            List<IMediaFolderData> foldersToUpdatePath =\r\n                (from item in DataFacade.GetData<IMediaFolderData>()\r\n                 where item.Path.StartsWith(oldPathWithSlash) && item.Id != currentFolderData.Id\r\n                 select item).ToList();\r\n\r\n            if (foldersToUpdatePath.Count > 0)\r\n            {\r\n                foreach (IMediaFolderData item in foldersToUpdatePath)\r\n                {\r\n                    item.Path = updatedFolder.Path + item.Path.Substring(oldPath.Length);\r\n                }\r\n\r\n                DataFacade.Update(foldersToUpdatePath);\r\n            }\r\n\r\n\r\n            List<IMediaFileData> filesToUpdatePath =\r\n                (from item in DataFacade.GetData<IMediaFileData>()\r\n                 where item.FolderPath == oldPath\r\n                    || item.FolderPath.StartsWith(oldPathWithSlash)\r\n                 select item).ToList();\r\n\r\n            if (filesToUpdatePath.Count > 0)\r\n            {\r\n                foreach (IMediaFileData mediaFileData in filesToUpdatePath)\r\n                {\r\n                    mediaFileData.FolderPath = updatedFolder.Path + mediaFileData.FolderPath.Substring(oldPath.Length);\r\n                }\r\n                DataFacade.Update(filesToUpdatePath);\r\n            }\r\n\r\n\r\n            CopyFolderData(updatedFolder, currentFolderData);\r\n            DataFacade.Update(currentFolderData);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<T> AddNew<T>(IEnumerable<T> dataset) where T : class, IData\r\n        {\r\n            var result = new List<T>();\r\n\r\n            if (dataset.Any(data => data == null))\r\n            {\r\n                throw new ArgumentException(\"Data in list to add must be non-null\");\r\n            }\r\n\r\n            CheckInterface(typeof(T));\r\n\r\n            foreach (IData data in dataset)\r\n            {\r\n                if (typeof(T) == typeof(IMediaFile))\r\n                {\r\n                    result.Add(AddMediaFile((IMediaFile) data) as T);\r\n                }\r\n                else if (typeof(T) == typeof(IMediaFileFolder))\r\n                {\r\n                    result.Add(AddMediaFileFolder( (IMediaFileFolder)data) as T);\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n        private IMediaFile AddMediaFile(IMediaFile mediaFile)\r\n        {\r\n            ValidateMediaFileData(mediaFile);\r\n\r\n            IMediaFileData fileData = DataFacade.BuildNew<IMediaFileData>();\r\n            fileData.Id = Guid.NewGuid();\r\n            CopyFileData(mediaFile, fileData);\r\n\r\n            fileData.LastWriteTime = fileData.CreationTime = DateTime.Now;\r\n\r\n            IMediaFile internalMediaFile;\r\n\r\n            using (Stream readStream = mediaFile.GetReadStream())\r\n            {\r\n                Verify.IsNotNull(readStream, \"GetReadStream returned null for type '{0}'\", mediaFile.GetType());\r\n                fileData.Length = (int)readStream.Length;\r\n            \r\n                string internalPath = GetFilePath(fileData.Id);\r\n                internalMediaFile = new MediaFile(fileData, Store.Id, _context.CreateDataSourceId(\r\n                    new MediaDataId\r\n                    {\r\n                        MediaType = MediaElementType.File, \r\n                        Id = fileData.Id\r\n                    }, \r\n                    typeof(IMediaFile)), internalPath);\r\n            \r\n                using (Stream writeStream = internalMediaFile.GetNewWriteStream())\r\n                {\r\n                    readStream.CopyTo(writeStream);\r\n                }\r\n            }\r\n            TransactionFileSystemFileStreamManager.WriteFileToDisk(internalMediaFile);\r\n            fileData = DataFacade.AddNew<IMediaFileData>(fileData);\r\n\r\n            return internalMediaFile;\r\n        }\r\n\r\n\r\n        private MediaFileFolder AddMediaFileFolder(IMediaFileFolder mediaFolder)\r\n        {\r\n            ValidateFolderData(mediaFolder);\r\n\r\n            var folderData = DataFacade.BuildNew<IMediaFolderData>();\r\n            folderData.Id = Guid.NewGuid();\r\n            CopyFolderData(mediaFolder, folderData);\r\n            folderData = DataFacade.AddNew<IMediaFolderData>(folderData);\r\n\r\n            return new MediaFileFolder(folderData, Store.Id, _context.CreateDataSourceId(\r\n                new MediaDataId\r\n                {\r\n                    MediaType = MediaElementType.Folder, \r\n                    Id = folderData.Id\r\n                }, \r\n                typeof(IMediaFileFolder)));\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Delete(IEnumerable<DataSourceId> dataSourceIds)\r\n        {\r\n            if (dataSourceIds.Any(f => f == null)) throw new ArgumentException(\"DataSourceIds must be non-null\");\r\n\r\n            foreach (DataSourceId dataSourceId in dataSourceIds)\r\n            {\r\n                MediaDataId dataId = dataSourceId.DataId as MediaDataId;\r\n                if (dataId.MediaType == MediaElementType.Folder)\r\n                {\r\n                    DeleteMediaFolder(dataId.Id);\r\n                }\r\n                else if (dataId.MediaType == MediaElementType.File)\r\n                {\r\n                    DeleteMediaFile(dataId.Id);\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException($\"Unexpected media type '{dataId.MediaType}'\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private void DeleteMediaFolder(Guid mediaFolderId)\r\n        {\r\n            IMediaFolderData folder = DataFacade.GetData<IMediaFolderData>(x => x.Id == mediaFolderId).First();\r\n\r\n            string folderPath = folder.Path;\r\n            string innerElementsPathPrefix = $\"{folderPath}/\";\r\n\r\n            var files = (from item in DataFacade.GetData<IMediaFileData>()\r\n                         where item.FolderPath.StartsWith(innerElementsPathPrefix) || item.FolderPath == folderPath\r\n                         select item).ToList();\r\n\r\n            DeleteMediaFiles(files);\r\n\r\n            DataFacade.Delete<IMediaFolderData>(x => x.Path.StartsWith(innerElementsPathPrefix));\r\n            DataFacade.Delete(folder);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Type> GetSupportedInterfaces()\r\n        {\r\n            return new [] { typeof(IMediaFile), typeof(IMediaFileFolder), typeof(IMediaFileStore) };\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IQueryable<T> GetData<T>() where T : class, IData\r\n        {\r\n            CheckInterface(typeof(T));\r\n\r\n            if (typeof(T) == typeof(IMediaFile))\r\n            {\r\n                return GetMediaFiles() as IQueryable<T>;\r\n            }\r\n\r\n\r\n            if (typeof(T) == typeof(IMediaFileFolder))\r\n            {\r\n                return GetMediaFileFolders() as IQueryable<T>;\r\n            }\r\n\r\n            // an IMediaFileStore query\r\n            return new[] { Store as T }.AsQueryable();\r\n        }\r\n\r\n\r\n        private IQueryable<IMediaFile> GetMediaFiles()\r\n        {\r\n            IQueryable<IMediaFile> mediaFilesQuery = _mediaFilesCachedQuery;\r\n            if (mediaFilesQuery == null)\r\n            {\r\n                lock (_syncRoot)\r\n                {\r\n                    if (_mediaFilesCachedQuery == null)\r\n                    {\r\n                        var fileItems = new List<IMediaFile>();\r\n\r\n                        IQueryable<IMediaFileData> files = DataFacade.GetData<IMediaFileData>();\r\n\r\n                        // DDZ: now the whole list of media files is loaded to memory, should be rewritten to return \r\n                        // a proper IQueryable, similar to our VirtualImageFileQueryable\r\n\r\n                        var publicDataScope = DataScopeIdentifier.Public;\r\n                        foreach (IMediaFileData file in files)\r\n                        {\r\n                            string internalPath = GetFilePath(file.Id);\r\n                            fileItems.Add(new MediaFile(file, Store.Id, _context.CreateDataSourceId(\r\n                                new MediaDataId\r\n                                {\r\n                                    MediaType = MediaElementType.File, Id = file.Id\r\n                                }, \r\n                                typeof(IMediaFile), publicDataScope, CultureInfo.InvariantCulture), internalPath));\r\n                        }\r\n                        _mediaFilesCachedQuery = fileItems.AsQueryable();\r\n                    }\r\n                    mediaFilesQuery = _mediaFilesCachedQuery;\r\n                }\r\n            }\r\n            return mediaFilesQuery;\r\n        }\r\n\r\n        private IQueryable<IMediaFileFolder> GetMediaFileFolders()\r\n        {\r\n            IQueryable<IMediaFileFolder> mediaFoldersQuery = _mediaFoldersCachedQuery;\r\n            if (mediaFoldersQuery == null)\r\n            {\r\n                lock (_syncRoot)\r\n                {\r\n                    if (_mediaFoldersCachedQuery == null)\r\n                    {\r\n                        var mediaFolderItems = new List<IMediaFileFolder>();\r\n\r\n                        IQueryable<IMediaFolderData> folders = DataFacade.GetData<IMediaFolderData>();\r\n\r\n                        var publicDataScope = DataScopeIdentifier.Public;\r\n                        foreach (IMediaFolderData folder in folders)\r\n                        {\r\n                            var dataId = new MediaDataId { MediaType = MediaElementType.Folder, Id = folder.Id };\r\n                            var dataSourceId = _context.CreateDataSourceId(dataId, typeof(IMediaFileFolder), publicDataScope, CultureInfo.InvariantCulture);\r\n                            mediaFolderItems.Add(new MediaFileFolder(folder, Store.Id, dataSourceId));\r\n                        }\r\n\r\n                        _mediaFoldersCachedQuery = mediaFolderItems.AsQueryable();\r\n                    }\r\n                    mediaFoldersQuery = _mediaFoldersCachedQuery;\r\n                }\r\n            }\r\n\r\n            return mediaFoldersQuery;\r\n        }\r\n\r\n        /// <exclude />\r\n        public T GetData<T>(IDataId dataId) where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataId, nameof(dataId));\r\n\r\n            CheckInterface(typeof(T));\r\n\r\n            MediaDataId mediaDataId = dataId as MediaDataId;\r\n            if (mediaDataId == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n\r\n            if (mediaDataId.MediaType == MediaElementType.Folder)\r\n            {\r\n                if (typeof(T) != typeof(IMediaFileFolder))\r\n                {\r\n                    throw new ArgumentException(\"The dataId specifies a IMediaFileFolder, but the generic method was invoked with different type\");\r\n                }\r\n\r\n                var folder = DataFacade.GetData<IMediaFolderData>().FirstOrDefault(x => x.Id == mediaDataId.Id);\r\n                if (folder == null)\r\n                {\r\n                    return null;\r\n                }\r\n                return new MediaFileFolder(folder, Store.Id,\r\n                        _context.CreateDataSourceId(new MediaDataId { MediaType = MediaElementType.Folder, Id = folder.Id }, typeof(IMediaFileFolder))) as T;\r\n            }\r\n\r\n            if (mediaDataId.MediaType == MediaElementType.File)\r\n            {\r\n                if (typeof(T) != typeof(IMediaFile))\r\n                {\r\n                    throw new ArgumentException(\"The dataId specifies a IMediaFile, but the generic method was invoked with different type\");\r\n                }\r\n\r\n                IMediaFileData file = DataFacade.GetData<IMediaFileData>().FirstOrDefault(x => x.Id == mediaDataId.Id);\r\n                if (file == null)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                string internalPath = GetFilePath(file.Id);\r\n                return new MediaFile(file, Store.Id,\r\n                       _context.CreateDataSourceId(new MediaDataId { MediaType = MediaElementType.File, Id = file.Id }, typeof(IMediaFile)), internalPath) as T;\r\n\r\n            }\r\n            \r\n            return Store as T;\r\n        }\r\n\r\n\r\n\r\n        private IMediaFileStore Store\r\n        {\r\n            get\r\n            {\r\n                if (_store == null)\r\n                {\r\n                    _store = new MediaFileStore(_storeId, _storeTitle, _storeDescription, _context.CreateDataSourceId(\r\n                        new MediaDataId { MediaType = MediaElementType.Store }, typeof(IMediaFileStore)));\r\n                }\r\n                return _store;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void CheckInterface(Type interfaceType)\r\n        {\r\n            if (!typeof(IMediaFile).IsAssignableFrom(interfaceType) &&\r\n                !typeof(IMediaFileFolder).IsAssignableFrom(interfaceType) &&\r\n                !typeof(IMediaFileStore).IsAssignableFrom(interfaceType))\r\n            {\r\n                throw new ArgumentException($\"Unexpected interface '{interfaceType}' - only '{typeof(IMediaFile)}, {typeof(IMediaFileFolder)} and {typeof(IMediaFileStore)}' are supported\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DeleteMediaFile(Guid id)\r\n        {\r\n            string fullPath = GetFilePath(id);\r\n            if (C1File.Exists(fullPath))\r\n            {\r\n                C1File.Delete(fullPath);\r\n            }\r\n\r\n            DataFacade.Delete<IMediaFileData>(x => x.Id == id);\r\n        }\r\n\r\n\r\n        private void DeleteMediaFiles(IList<IMediaFileData> mediaFiles)\r\n        {\r\n            foreach (var mediaFile in mediaFiles)\r\n            {\r\n                string fullPath = GetFilePath(mediaFile.Id);\r\n                if (C1File.Exists(fullPath))\r\n                {\r\n                    C1File.Delete(fullPath);\r\n                }\r\n            }\r\n\r\n            DataFacade.Delete<IMediaFileData>(mediaFiles);\r\n        }\r\n\r\n\r\n\r\n        private bool DoesFolderExists(string path)\r\n        {\r\n            return path == \"/\" || GetData<IMediaFileFolder>().Any(item => item.Path == path);\r\n        }\r\n\r\n\r\n\r\n        private bool DoesFileExists(string path, string name)\r\n        {\r\n            return GetData<IMediaFile>().Any(item => item.FolderPath == path && item.FileName == name);\r\n        }\r\n\r\n\r\n\r\n        private void CopyFileData(IMediaFile from, IMediaFileData to)\r\n        {\r\n            to.CultureInfo = from.Culture;\r\n            to.Description = from.Description;\r\n            to.FileName = from.FileName;\r\n            to.Tags = from.Tags;\r\n            to.FolderPath = from.FolderPath;\r\n            to.Length = from.Length;\r\n            to.MimeType = MimeTypeInfo.GetCanonical(from.MimeType);\r\n            to.Title = from.Title;\r\n        }\r\n\r\n\r\n\r\n        private void CopyFolderData(IMediaFileFolder from, IMediaFolderData to)\r\n        {\r\n            to.Description = from.Description;\r\n            to.Path = from.Path;\r\n            to.Title = from.Title;\r\n        }\r\n\r\n\r\n\r\n        private void ValidateMediaFileData(IMediaFile mediaFile)\r\n        {\r\n            if (!mediaFile.FolderPath.IsCorrectFolderName('/'))\r\n            {\r\n                throw new ArgumentException(\"Invalid folder name\");\r\n            }\r\n            if (!DoesFolderExists(mediaFile.FolderPath))\r\n            {\r\n                throw new ArgumentException(\"Could not find any parents folders on path \" + mediaFile.FolderPath);\r\n            }\r\n            if (DoesFileExists(mediaFile.FolderPath, mediaFile.FileName))\r\n            {\r\n                throw new ArgumentException(\"File \" + mediaFile.FileName + \" already exists on path \" + mediaFile.FolderPath);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ValidateFolderData(IMediaFileFolder mediaFolder)\r\n        {\r\n            if (!mediaFolder.Path.IsCorrectFolderName('/'))\r\n            {\r\n                throw new ArgumentException(\"Invalid folder name\");\r\n            }\r\n            if (!DoesFolderExists(mediaFolder.GetParentFolderPath()))\r\n            {\r\n                throw new ArgumentException(\"Could not find any parents folders on path \" + mediaFolder.GetParentFolderPath());\r\n            }\r\n            if (DoesFolderExists(mediaFolder.Path))\r\n            {\r\n                throw new ArgumentException(\"Folder already exists on path \" + mediaFolder.Path);\r\n            }\r\n        }\r\n\r\n\r\n        private string GetFilePath(Guid mediaId) => Path.Combine(_workingDirectory, mediaId.ToString());\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <exclude />\r\n        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n        public sealed class MediaDataId : IDataId\r\n        {\r\n            /// <exclude />\r\n            public MediaElementType MediaType { get; set; }\r\n\r\n            /// <exclude />\r\n            public Guid Id { get; set; }\r\n\r\n            /// <exclude />\r\n            public override bool Equals(object obj) => obj is MediaDataId mediaId && mediaId.Id == Id;\r\n\r\n            /// <exclude />\r\n            public override int GetHashCode() => Id.GetHashCode();\r\n        }\r\n\r\n\r\n\r\n        private sealed class MediaFileStore : IMediaFileStore\r\n        {\r\n            private readonly DataSourceId _dataSourceId;\r\n\r\n\r\n\r\n            public MediaFileStore(string id, string title, string description, DataSourceId dataSourceId)\r\n            {\r\n                Id = id;\r\n                Title = title;\r\n                Description = description;\r\n                _dataSourceId = dataSourceId;\r\n            }\r\n\r\n\r\n\r\n            public string Id { get; }\r\n\r\n            public string Title { get;  }\r\n\r\n            public string Description { get; }\r\n\r\n            public bool IsReadOnly => false;\r\n\r\n            public bool ProvidesMetadata => true;\r\n\r\n            public DataSourceId DataSourceId => _dataSourceId;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(MediaFileProviderAssembler))]\r\n    internal sealed class MediaFileDataProviderData : DataProviderData\r\n    {\r\n        private const string _rootDirectoryProperty = \"rootDirectory\";\r\n        [ConfigurationProperty(_rootDirectoryProperty, IsRequired = true)]\r\n        public string RootDirectory\r\n        {\r\n            get { return (string)base[_rootDirectoryProperty]; }\r\n            set { base[_rootDirectoryProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _dataProviderProperty = \"dataProvider\";\r\n        [ConfigurationProperty(_dataProviderProperty, IsRequired = false, DefaultValue = \"\")]\r\n        public string DataProvider\r\n        {\r\n            get { return (string)base[_dataProviderProperty]; }\r\n            set { base[_dataProviderProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _storeIdProperty = \"storeId\";\r\n        [ConfigurationProperty(_storeIdProperty, IsRequired = true)]\r\n        public string StoreId\r\n        {\r\n            get { return (string)base[_storeIdProperty]; }\r\n            set { base[_storeIdProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _storeDescriptionProperty = \"storeDescription\";\r\n        [ConfigurationProperty(_storeDescriptionProperty, IsRequired = true)]\r\n        public string StoreDescription\r\n        {\r\n            get { return (string)base[_storeDescriptionProperty]; }\r\n            set { base[_storeDescriptionProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _storeTitleProperty = \"storeTitle\";\r\n        [ConfigurationProperty(_storeTitleProperty, IsRequired = true)]\r\n        public string StoreTitle\r\n        {\r\n            get { return (string)base[_storeTitleProperty]; }\r\n            set { base[_storeTitleProperty] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class MediaFileProviderAssembler : IAssembler<IDataProvider, DataProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IDataProvider Assemble(IBuilderContext context, DataProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var configuration = objectConfiguration as MediaFileDataProviderData;\r\n\r\n            if (configuration == null) throw new ArgumentException(\"Expected configuration to be of type MediaFileDataProviderData\", \"objectConfiguration\");\r\n\r\n            return new MediaFileProvider(configuration.RootDirectory, configuration.StoreId, configuration.StoreDescription, configuration.StoreTitle);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/VirtualImageFileProvider/VirtualImageFile.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.VirtualImageFileProvider\r\n{\r\n\tinternal sealed class VirtualImageFile : IImageFile\r\n\t{\r\n        private IMediaFile _sourceFile;\r\n\r\n        internal VirtualImageFile(IMediaFile sourceFile)\r\n        {\r\n            _sourceFile = sourceFile;\r\n        }\r\n\r\n\r\n\r\n        public string CompositePath\r\n        {\r\n            get { return this.GetCompositePath(); }\r\n            set { throw new NotImplementedException(); }\r\n        }\r\n\r\n\r\n\r\n        public string FolderPath\r\n        {\r\n            get\r\n            {\r\n                return _sourceFile.FolderPath;\r\n            }\r\n            set\r\n            {\r\n                _sourceFile.FolderPath = value; ;\r\n            }\r\n        }\r\n\r\n        public string FileName\r\n        {\r\n            get\r\n            {\r\n                return _sourceFile.FileName;\r\n            }\r\n            set\r\n            {\r\n                _sourceFile.FileName = value; ;\r\n            }\r\n        }\r\n\r\n        public DataSourceId DataSourceId\r\n        {\r\n            get { return _sourceFile.DataSourceId; }\r\n        }\r\n\r\n        public string StoreId\r\n        {\r\n            get\r\n            {\r\n                return _sourceFile.StoreId;\r\n            }\r\n            set\r\n            {\r\n                _sourceFile.StoreId = value;;\r\n            }\r\n        }\r\n\r\n        public string Title\r\n        {\r\n            get\r\n            {\r\n                return _sourceFile.Title;\r\n            }\r\n            set\r\n            {\r\n                _sourceFile.Title = value;;\r\n            }\r\n        }\r\n\r\n        public string Description\r\n        {\r\n            get\r\n            {\r\n                return _sourceFile.Description;\r\n            }\r\n            set\r\n            {\r\n                _sourceFile.Description = value;;\r\n            }\r\n        }\r\n\r\n        public string Tags\r\n        {\r\n            get\r\n            {\r\n                return _sourceFile.Tags;\r\n            }\r\n            set\r\n            {\r\n                _sourceFile.Tags = value; ;\r\n            }\r\n        }\r\n\r\n       \r\n        public string Culture\r\n        {\r\n            get\r\n            {\r\n                return _sourceFile.Culture;\r\n            }\r\n            set\r\n            {\r\n                _sourceFile.Culture = value;;\r\n            }\r\n        }\r\n\r\n        public string MimeType\r\n        {\r\n            get { return _sourceFile.MimeType; }\r\n        }\r\n\r\n        public int? Length\r\n        {\r\n            get { return _sourceFile.Length; }\r\n        }\r\n\r\n        public DateTime? CreationTime\r\n        {\r\n            get { return _sourceFile.CreationTime; }\r\n        }\r\n\r\n        public DateTime? LastWriteTime\r\n        {\r\n            get { return _sourceFile.LastWriteTime; }\r\n        }\r\n\r\n        public bool IsReadOnly\r\n        {\r\n            get { return _sourceFile.IsReadOnly; }\r\n        }\r\n\r\n        public Guid Id\r\n        {\r\n            get { return _sourceFile.Id; }\r\n        }\r\n\r\n        public string KeyPath\r\n        {\r\n            get { return _sourceFile.KeyPath; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/VirtualImageFileProvider/VirtualImageFileProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.VirtualImageFileProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableDataProvider))]\r\n    internal sealed class VirtualImageFileProvider : IDataProvider\r\n\t{\r\n        public DataProviderContext Context\r\n        {\r\n            set { ; }\r\n        }\r\n\r\n        public IEnumerable<Type> GetSupportedInterfaces()\r\n        {\r\n            return new List<Type> { typeof(IImageFile) };\r\n        }\r\n\r\n        public IQueryable<T> GetData<T>() where T : class, IData\r\n        {\r\n            if (typeof(T) != typeof(IImageFile)) throw new InvalidOperationException( \"Unsupported data interface\" );\r\n\r\n            return new VirtualImageFileQueryable<T>(\r\n                from mediaFile in DataFacade.GetData<IMediaFile>()\r\n                where mediaFile.MimeType != null && mediaFile.MimeType.StartsWith(\"image\")\r\n                select new VirtualImageFile(mediaFile) as T);\r\n        }\r\n\r\n        public T GetData<T>(IDataId dataId) where T : class, IData\r\n        {\r\n            throw new NotImplementedException(\"Unexpected call. This provider does not produce its own data source id's\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/VirtualImageFileProvider/VirtualImageFileQueryable.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Text;\r\nusing Composite.Core.Linq;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.VirtualImageFileProvider\r\n{\r\n    internal interface IVirtualImageFileQueryable\r\n    {\r\n        IQueryable Source { get; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Moves the IMediaFile -> IImageFile convertion up in the tree, allowing data providers to handle IMedia queries more effectively\r\n    /// </summary>\r\n    internal class VirtualImageFileQueryable<T> : IQueryable<T>, IQueryProvider, IVirtualImageFileQueryable\r\n    {\r\n        private readonly IQueryable _source;\r\n        private readonly Expression _currentExpression;\r\n        private readonly Expression _initialExpression;\r\n\r\n        public VirtualImageFileQueryable(IQueryable source)\r\n        {\r\n            _source = source;\r\n            _initialExpression = Expression.Constant(this);\r\n            _currentExpression = _initialExpression;\r\n        }\r\n\r\n        public VirtualImageFileQueryable(IQueryable source, Expression expression)\r\n        {\r\n            _source = source;\r\n            _currentExpression = expression;\r\n        }\r\n\r\n        public IEnumerator<T> GetEnumerator()\r\n        {\r\n            foreach (var file in (this as IEnumerable))\r\n            {\r\n                yield return (T)file;\r\n            }\r\n        }\r\n\r\n        IEnumerator IEnumerable.GetEnumerator()\r\n        {\r\n            if (_currentExpression == _initialExpression)\r\n            {\r\n                return _source.GetEnumerator();\r\n            }\r\n\r\n            var processedExpression = ProcessExpression(_currentExpression);\r\n\r\n            IQueryable<T> queryable = (IQueryable<T>)_source.Provider.CreateQuery(processedExpression);\r\n\r\n            return queryable.GetEnumerator();\r\n        }\r\n\r\n        public Expression Expression\r\n        {\r\n            get { return _currentExpression ?? _initialExpression; }\r\n        }\r\n\r\n        public Type ElementType\r\n        {\r\n            get { return typeof(T); }\r\n        }\r\n\r\n        public IQueryProvider Provider { get { return this; } }\r\n\r\n        public IQueryable<S> CreateQuery<S>(Expression expression)\r\n        {\r\n            Verify.ArgumentNotNull(expression, \"expression\");\r\n            Verify.ArgumentCondition(typeof(IQueryable<S>).IsAssignableFrom(expression.Type), \"expression\", \"Incorrect expression type\");\r\n\r\n            return new VirtualImageFileQueryable<S>(_source, expression);\r\n        }\r\n\r\n        public IQueryable CreateQuery(Expression expression)\r\n        {\r\n            if (_currentExpression == expression) return this;\r\n\r\n            Type elementType = TypeHelpers.FindElementType(expression);\r\n\r\n            Type multibleSourceQueryableType = typeof(VirtualImageFileQueryable<>).MakeGenericType(new[] { elementType });\r\n\r\n            return Activator.CreateInstance(\r\n                multibleSourceQueryableType,\r\n                new object[] { _source, expression }) as IQueryable;\r\n        }\r\n\r\n        public TResult Execute<TResult>(Expression expression)\r\n        {\r\n            var processedExpression = ProcessExpression(expression);\r\n\r\n            return _source.Provider.Execute<TResult>(processedExpression);\r\n        }\r\n\r\n        public object Execute(Expression expression)\r\n        {\r\n            var processedExpression = ProcessExpression(expression);\r\n\r\n            return _source.Provider.Execute(processedExpression);\r\n        }\r\n\r\n        private Expression ProcessExpression(Expression expression)\r\n        {\r\n            var visitor = new VirtualImageFileQueryableVisitor();\r\n\r\n            return visitor.Visit(expression);\r\n        }\r\n\r\n        public IQueryable Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/VirtualImageFileProvider/VirtualImageFileQueryableVisitor.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.VirtualImageFileProvider\r\n{\r\n    internal class VirtualImageFileQueryableVisitor: ExpressionVisitor\r\n    {\r\n        private static readonly MethodInfo Queryable_Count = typeof(Queryable).GetMethods().Single(x => x.Name == \"Count\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n        private static readonly MethodInfo Queryable_Where = StaticReflection.GetGenericMethodInfo(() => System.Linq.Queryable.Where(null, (Expression<Func<int, bool>>)null));\r\n        private static readonly MethodInfo Queryable_Take = typeof(Queryable).GetMethods().Single(x => x.Name == \"Take\" && x.IsGenericMethod && x.GetParameters().Count() == 2);\r\n        private static readonly MethodInfo Queryable_First = typeof(Queryable).GetMethods().Single(x => x.Name == \"First\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n        private static readonly MethodInfo Queryable_FirstOrDefault = typeof(Queryable).GetMethods().Single(x => x.Name == \"FirstOrDefault\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n        private static readonly MethodInfo Queryable_Single = typeof(Queryable).GetMethods().Single(x => x.Name == \"Single\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n        private static readonly MethodInfo Queryable_SingleOrDefault = typeof(Queryable).GetMethods().Single(x => x.Name == \"SingleOrDefault\" && x.IsGenericMethod && x.GetParameters().Count() == 1);\r\n\r\n        protected override Expression VisitConstant(ConstantExpression node)\r\n        {\r\n            if (node.Value is IVirtualImageFileQueryable)\r\n            {\r\n                return Visit((node.Value as IVirtualImageFileQueryable).Source.Expression);\r\n            }\r\n\r\n            return base.VisitConstant(node);\r\n        }\r\n\r\n        protected override Expression VisitMethodCall(MethodCallExpression m)\r\n        {\r\n            // Trying to convert trees like\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => (new VirtualImageFile(mediaFile) As IImageFile)).METHOD([Condition])\r\n            // to\r\n            //      IQueryable<IMediaFile>.METHOD([Condition])[.Select(mediaFile => (new VirtualImageFile(mediaFile) As IImageFile)]\r\n\r\n            if (m.Method.DeclaringType != typeof(Queryable)\r\n                || !m.Method.IsGenericMethod\r\n                || m.Method.GetGenericArguments()[0] != typeof(IImageFile))\r\n            {\r\n                return base.VisitMethodCall(m);\r\n            }\r\n\r\n            var firstArgument = Visit(m.Arguments[0]);\r\n\r\n            if (!(firstArgument is MethodCallExpression\r\n                  && (firstArgument as MethodCallExpression).Method.Name == \"Select\"\r\n                  && (firstArgument as MethodCallExpression).Method.GetGenericArguments()[0] == typeof(IMediaFile)\r\n                  && (firstArgument as MethodCallExpression).Method.GetGenericArguments()[1] == typeof(IImageFile)))\r\n            {\r\n                return base.VisitMethodCall(m);\r\n            }\r\n\r\n            var mediaFileExpression = (firstArgument as MethodCallExpression).Arguments[0];\r\n            var selectorMethod = (firstArgument as MethodCallExpression).Method;\r\n            var selectorLambdaExpression = (firstArgument as MethodCallExpression).Arguments[1];\r\n\r\n            // Converting\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ...).Count([condition])\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ...).Any([condition])\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ...).All([condition])\r\n            // to\r\n            //     IQueryable<IMediaFile>.Count([condition])\r\n            //     IQueryable<IMediaFile>.Any([condition])\r\n            //     IQueryable<IMediaFile>.All([condition])\r\n            \r\n            if (m.Method.Name == \"Count\" || m.Method.Name == \"Any\" || m.Method.Name == \"All\")\r\n            {\r\n                var mediaFileMethod = m.Method.GetGenericMethodDefinition().MakeGenericMethod(typeof (IMediaFile));\r\n\r\n                if (m.Arguments.Count == 1)\r\n                {\r\n                    return base.Visit(Expression.Call(mediaFileMethod, mediaFileExpression));\r\n                }\r\n\r\n                var condition = new ParameterTypeReplacer().Visit(m.Arguments[1]);\r\n\r\n                return base.Visit(Expression.Call(mediaFileMethod, mediaFileExpression, condition));\r\n            }\r\n\r\n\r\n            // Converting\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ....).Where(CONDITION)\r\n            // to\r\n            //     IQueryable<IMediaFile>.Where(CONDITION).Select(mediaFile => ....)\r\n\r\n            if (m.Method.Name == \"Where\" && m.Arguments[1] is UnaryExpression)\r\n            {\r\n                var Where_mediaFile = m.Method.GetGenericMethodDefinition().MakeGenericMethod(typeof(IMediaFile));\r\n\r\n                var convertedCondition = new ParameterTypeReplacer().Visit(m.Arguments[1]);\r\n\r\n                //     IQueryable<IMediaFile>.Where(CONDITION)\r\n                var whereExpression = Expression.Call(Where_mediaFile, mediaFileExpression, convertedCondition);\r\n\r\n                //     IQueryable<IMediaFile>.Where(CONDITION).Select(mediaFile => ....)\r\n                return base.Visit(Expression.Call(selectorMethod, whereExpression, selectorLambdaExpression));\r\n            }\r\n\r\n\r\n            // Converting\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ....).Take(count)\r\n            // to\r\n            //     IQueryable<IMediaFile>.Take(count).Select(mediaFile => ....)\r\n\r\n            if (m.Method.Name == \"Take\"\r\n                && m.Arguments[1] is ConstantExpression\r\n                && (m.Arguments[1] as ConstantExpression).Value is int)\r\n            {\r\n                var Take_mediaFile = m.Method.GetGenericMethodDefinition().MakeGenericMethod(typeof(IMediaFile));\r\n\r\n                //     IQueryable<IMediaFile>.Take(count)\r\n                var takeExpression = Expression.Call(Take_mediaFile, mediaFileExpression, m.Arguments[1]);\r\n\r\n                //     IQueryable<IMediaFile>.Take(count).Select(mediaFile => ....)\r\n                return base.Visit(Expression.Call(selectorMethod, takeExpression, selectorLambdaExpression));\r\n            }\r\n\r\n\r\n            // Converting\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ....).First([predicate])\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ....).FirstOrDefault([predicate])\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ....).Single([predicate])\r\n            //     IQueryable<IMediaFile>.Select(mediaFile => ....).SingleOrDefault([predicate])\r\n            // to\r\n            //     IQueryable<IMediaFile>[.Where(predicate)].Take(1).Select(mediaFile => ....).First()\r\n            //     IQueryable<IMediaFile>[.Where(predicate)].Take(1).Select(mediaFile => ....).FirstOrDefault()\r\n            //     IQueryable<IMediaFile>[.Where(predicate)].Take(2).Select(mediaFile => ....).Single()\r\n            //     IQueryable<IMediaFile>[.Where(predicate)].Take(2).Select(mediaFile => ....).SingleOrDefault()\r\n\r\n            if ((m.Method.Name == \"First\" \r\n                || m.Method.Name == \"FirstOrDefault\"\r\n                || m.Method.Name == \"Single\"\r\n                || m.Method.Name == \"SingleOrDefault\")\r\n                && (m.Arguments.Count == 1\r\n                    || (m.Arguments.Count == 2\r\n                        && m.Arguments[1] is UnaryExpression)))\r\n            {\r\n                var predicate = m.Arguments.Count == 2 ? (m.Arguments[1] as UnaryExpression).Operand : null;\r\n\r\n                // IQueryable<IMediaFile>[.Where(predicate)]\r\n                var filteredMediaExpression = predicate != null \r\n                    ? Expression.Call(Queryable_Where.MakeGenericMethod(typeof (IMediaFile)), mediaFileExpression, ConvertPredicate(predicate))\r\n                    : mediaFileExpression;\r\n\r\n                bool isSingleQuery = m.Method.Name == \"Single\" || m.Method.Name == \"SingleOrDefault\";\r\n\r\n                //     IQueryable<IMediaFile>[.Where(predicate)].Take(1)\r\n                var takeExpression = Expression.Call(Queryable_Take.MakeGenericMethod(typeof (IMediaFile)),\r\n                    filteredMediaExpression, Expression.Constant(isSingleQuery ? 2 : 1));\r\n\r\n                //     IQueryable<IMediaFile>[.Where(predicate)].Take(1).Select(mediaFile => ....)\r\n                //     IQueryable<IMediaFile>[.Where(predicate)].Take(2).Select(mediaFile => ....)\r\n                var selector = Expression.Call(selectorMethod, takeExpression, selectorLambdaExpression);\r\n\r\n\r\n                var method = isSingleQuery\r\n                    ? (m.Method.Name == \"Single\" ? Queryable_Single : Queryable_SingleOrDefault).MakeGenericMethod(typeof(IMediaFile))\r\n                    : (m.Method.Name == \"First\" ? Queryable_First : Queryable_FirstOrDefault).MakeGenericMethod(typeof(IMediaFile));\r\n\r\n                //     IQueryable<IMediaFile>[.Where(predicate)].Take(1).Select(mediaFile => ....).First()\r\n                //     IQueryable<IMediaFile>[.Where(predicate)].Take(1).Select(mediaFile => ....).FirstOrDefault()\r\n                //     IQueryable<IMediaFile>[.Where(predicate)].Take(2).Select(mediaFile => ....).Single()\r\n                //     IQueryable<IMediaFile>[.Where(predicate)].Take(2).Select(mediaFile => ....).SingleOrDefault()\r\n                return base.Visit(Expression.Call(method, selector));\r\n            }\r\n\r\n            return base.VisitMethodCall(m);\r\n\r\n        }\r\n\r\n        /// <summary>\r\n        /// Converts predicates Expression&lt;Func&lt;IImage, bool&gt;&gt; to Expression&lt;Func&lt;IMediaFile, bool&gt;&gt;\r\n        /// </summary>\r\n        private static Expression ConvertPredicate(Expression predicate)\r\n        {\r\n            return new ParameterTypeReplacer().Visit(predicate);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Replace parameters of type <see cref=\"IImageFile\" /> with parameters of type <see cref=\"IMediaFile\" />\r\n        /// </summary>\r\n        private sealed class ParameterTypeReplacer : ExpressionVisitor\r\n        {\r\n            readonly Dictionary<ParameterExpression, ParameterExpression> ParameterMap = new Dictionary<ParameterExpression, ParameterExpression>();\r\n\r\n            protected override Expression VisitParameter(ParameterExpression parameter)\r\n            {\r\n                if (parameter.Type == typeof (IImageFile))\r\n                {\r\n                    if (!ParameterMap.ContainsKey(parameter))\r\n                    {\r\n                        ParameterMap.Add(parameter, Expression.Parameter(typeof (IMediaFile), parameter.Name));\r\n                    }\r\n\r\n                    return base.VisitParameter(ParameterMap[parameter]);\r\n                }\r\n\r\n                return base.VisitParameter(parameter);\r\n            }\r\n\r\n            protected override Expression VisitLambda<T>(Expression<T> node)\r\n            {\r\n                if (typeof (T) != typeof (Func<IImageFile, bool>))\r\n                {\r\n                    return base.VisitLambda<T>(node);\r\n                }\r\n\r\n                return Expression.Lambda<Func<IMediaFile, bool>>(Visit(node.Body), Visit(node.Parameters[0]) as ParameterExpression);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/CodeGeneration/DataIdClassGenerator.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration\r\n{\r\n    internal sealed class DataIdClassGenerator\r\n    {\r\n        private readonly string _className;\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;\r\n\r\n\r\n\r\n        public DataIdClassGenerator(string className, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            _className = className;\r\n            _dataTypeDescriptor = dataTypeDescriptor;\r\n        }\r\n\r\n\r\n\r\n        public CodeTypeDeclaration CreateClass()\r\n        {\r\n            var declaration = new CodeTypeDeclaration(_className)\r\n            {\r\n                IsClass = true,\r\n                TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed\r\n            };\r\n\r\n            declaration.BaseTypes.Add(typeof(IDataId));\r\n            declaration.CustomAttributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(EditorBrowsableAttribute)),\r\n                    new CodeAttributeArgument(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeTypeReferenceExpression(typeof(EditorBrowsableState)),\r\n                            EditorBrowsableState.Never.ToString()\r\n                        )\r\n                    )\r\n                )\r\n            );\r\n\r\n\r\n            AddDefaultConstructor(declaration);\r\n\r\n            AddConstructor(declaration);\r\n\r\n            AddEqualsMethod(declaration);\r\n\r\n            AddGetHashCodeMethod(declaration);\r\n\r\n\r\n            foreach (DataFieldDescriptor field in _dataTypeDescriptor.PhysicalKeyFields)\r\n            {\r\n                AddProperty(declaration, field.Name, field.InstanceType);\r\n            }\r\n\r\n\r\n            return declaration;\r\n        }\r\n\r\n\r\n\r\n        internal Dictionary<string, Type> Properties\r\n        {\r\n            get\r\n            {\r\n                return _dataTypeDescriptor.PhysicalKeyFields.ToDictionary(field => field.Name, field => field.InstanceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void AddDefaultConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            var defaultConstructor = new CodeConstructor {Attributes = MemberAttributes.Public | MemberAttributes.Final};\r\n            declaration.Members.Add(defaultConstructor);\r\n        }\r\n\r\n\r\n\r\n        private void AddConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            var constructor = new CodeConstructor {Attributes = MemberAttributes.Public | MemberAttributes.Final};\r\n\r\n            constructor.Parameters.Add(new CodeParameterDeclarationExpression(\r\n                    typeof(XElement),\r\n                    \"element\"\r\n                ));\r\n\r\n\r\n\r\n            foreach (var keyField in _dataTypeDescriptor.PhysicalKeyFields)\r\n            {\r\n                string propertyFieldName = MakePropertyFieldName(keyField.Name);\r\n                string attributeVariableName = \"attr\" + keyField.Name;\r\n\r\n                // CODEGEN:\r\n                // XAttribute attr{fieldName} = element.Attribute(_{fieldName}XName);\r\n\r\n                constructor.Statements.Add(\r\n                    new CodeVariableDeclarationStatement(\r\n                        typeof(XAttribute), attributeVariableName,\r\n                        new CodeMethodInvokeExpression(\r\n                            new CodeVariableReferenceExpression(\"element\"),\r\n                            \"Attribute\",\r\n                            new CodeFieldReferenceExpression(null, MakeXNameFieldName(keyField.Name))\r\n                            )));\r\n\r\n\r\n                // CODEGEN:\r\n                // if(attr{fieldName} == null) {\r\n                //   throw new InvalidOperationException(\"Missing '{fieldName}' attribute in a data store file.\");\r\n                // }\r\n\r\n                constructor.Statements.Add(new CodeConditionStatement(\r\n                        new CodeBinaryOperatorExpression(\r\n                            new CodeVariableReferenceExpression(attributeVariableName),\r\n                            CodeBinaryOperatorType.IdentityEquality,\r\n                            new CodePrimitiveExpression(null)\r\n                        ), \r\n                        new CodeThrowExceptionStatement(\r\n                            new CodeObjectCreateExpression(\r\n                                typeof(InvalidOperationException), \r\n                                new CodePrimitiveExpression(\r\n                                    $\"Missing '{keyField.Name}' attribute in a data store file.\"\r\n                                ))\r\n                        )));\r\n\r\n                // CODEGEN: \r\n                // _propertyId = (Guid) attrId;\r\n\r\n                constructor.Statements.Add(new CodeAssignStatement(\r\n                        new CodeVariableReferenceExpression(propertyFieldName),\r\n                        new CodeCastExpression(\r\n                            keyField.InstanceType,\r\n                            new CodeVariableReferenceExpression(attributeVariableName)\r\n                        )\r\n                    ));\r\n            }\r\n\r\n            declaration.Members.Add(constructor);\r\n        }\r\n\r\n\r\n\r\n        private static void AddProperty(CodeTypeDeclaration declaration, string name, Type type)\r\n        {\r\n            // CODEGEN:\r\n            // public Guid Email\r\n            // {\r\n            //     get {  return this._propertyEmail;  }\r\n            //     set {  this._propertyEmail = value; }\r\n            // }\r\n            \r\n            string propertyFieldName = MakePropertyFieldName(name);\r\n\r\n            declaration.Members.Add(new CodeMemberField(type, propertyFieldName));\r\n\r\n            var property = new CodeMemberProperty\r\n            {\r\n                Name = name,\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Final,\r\n                HasSet = true,\r\n                HasGet = true,\r\n                Type = new CodeTypeReference(type)\r\n            };\r\n            property.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), propertyFieldName)));\r\n            property.SetStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), propertyFieldName), new CodeArgumentReferenceExpression(\"value\")));\r\n\r\n            declaration.Members.Add(property);\r\n\r\n            // CODEGEN:\r\n            // private static readonly XName _EmailXName = \"Email\";\r\n\r\n            var xNameField = new CodeMemberField\r\n            {\r\n                Name = MakeXNameFieldName(name),\r\n                Type = new CodeTypeReference(typeof (XName)),\r\n                Attributes = MemberAttributes.Static | MemberAttributes.Private,\r\n                InitExpression = new CodePrimitiveExpression(name)\r\n            };\r\n            declaration.Members.Add(xNameField);\r\n        }\r\n\r\n\r\n        private void AddEqualsMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            //Generates code like\r\n\r\n            // public override bool Equals(object obj)\r\n            // {\r\n            //     return obj != null \r\n            //            && typeof(TestDataId).IsAssignableFrom(obj.GetType())\r\n            //            && obj.Equals(this.FullPath, (obj as FileSystemFileDataId1).FullPath) && .....;\r\n            // }\r\n\r\n            const string argumentName = \"obj\";\r\n            var argument = new CodeArgumentReferenceExpression(argumentName);\r\n\r\n            var method = new CodeMemberMethod\r\n            {\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Override,\r\n                Name = nameof(object.Equals),\r\n                ReturnType = new CodeTypeReference(typeof (bool))\r\n            };\r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), argumentName));\r\n\r\n\r\n            Verify.That(_dataTypeDescriptor.KeyPropertyNames.Count > 0, \"A dynamic type should have at least one key property\");\r\n\r\n            // CODEGEN: obj != null && typeof(TestDataId).IsAssignableFrom(obj.GetType())\r\n\r\n            CodeExpression condition =\r\n                new CodeBinaryOperatorExpression(\r\n                    new CodeBinaryOperatorExpression(\r\n                        argument,\r\n                        CodeBinaryOperatorType.IdentityInequality,\r\n                        new CodePrimitiveExpression(null)),\r\n                    CodeBinaryOperatorType.BooleanAnd,\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeTypeOfExpression(new CodeTypeReference(_className)),\r\n                        nameof(Type.IsAssignableFrom),\r\n                        new CodeMethodInvokeExpression(argument, nameof(GetType))));\r\n\r\n            foreach (string keyPropertyName in _dataTypeDescriptor.PhysicalKeyFields.Select(f => f.Name))\r\n            {\r\n                string propertyFieldName = MakePropertyFieldName(_dataTypeDescriptor.Fields[keyPropertyName].Name);\r\n\r\n                CodeExpression newCondition =\r\n                    new CodeMethodInvokeExpression(\r\n                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), propertyFieldName),\r\n                    nameof(object.Equals), new CodeFieldReferenceExpression(\r\n                                  new CodeCastExpression(this._className, argument),\r\n                                  propertyFieldName));\r\n\r\n                condition = new CodeBinaryOperatorExpression(\r\n                    condition, \r\n                    CodeBinaryOperatorType.BooleanAnd, \r\n                    newCondition);\r\n            }\r\n\r\n            method.Statements.Add(new CodeMethodReturnStatement(condition));\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n        private void AddGetHashCodeMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            // Generates code like like\r\n\r\n            // private int _hashcode; \r\n            //\r\n            // public override int GetHashCode()\r\n            // {\r\n            //     if(_hashcode == 0)\r\n            //     {\r\n            //         _hashcode = _fullPath.GetHashCode() ^ ....;\r\n            //         if(_hashcode == 0)\r\n            //         {\r\n            //              _hashcode == -1;\r\n            //         }\r\n            //\r\n            //     return _hashcode;\r\n            // }\r\n\r\n            const string HashCodeFieldName = \"_hashcode\";\r\n            declaration.Members.Add(new CodeMemberField(typeof(int), HashCodeFieldName));\r\n\r\n            var method = new CodeMemberMethod\r\n            {\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Override,\r\n                Name = nameof(GetHashCode),\r\n                ReturnType = new CodeTypeReference(typeof (int))\r\n            };\r\n\r\n            Verify.That(_dataTypeDescriptor.KeyPropertyNames.Count > 0, \"A dynamic type should have at least one key property\");\r\n\r\n            CodeExpression hashCodeExpression = null;\r\n\r\n            foreach (string keyPropertyName in _dataTypeDescriptor.PhysicalKeyFields.Select(f=>f.Name))\r\n            {\r\n                string propertyFieldName = MakePropertyFieldName(_dataTypeDescriptor.Fields[keyPropertyName].Name);\r\n\r\n                CodeExpression hashCodePart =\r\n                    new CodeMethodInvokeExpression(\r\n                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), propertyFieldName),\r\n                    nameof(GetHashCode));\r\n\r\n                if (hashCodeExpression == null)\r\n                {\r\n                    hashCodeExpression = hashCodePart;\r\n                }\r\n                else\r\n                {\r\n                    hashCodeExpression = new CodeMethodInvokeExpression(\r\n                        new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(typeof(DataProviderHelperBase)),\r\n                        nameof(DataProviderHelperBase.Xor)),\r\n                        hashCodeExpression, hashCodePart);\r\n                }\r\n            }\r\n\r\n            // \"this.__hashcode\"\r\n            var hashCodeFieldReference =\r\n                new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), HashCodeFieldName);\r\n\r\n            method.Statements.Add(\r\n                new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(hashCodeFieldReference,\r\n                                                 CodeBinaryOperatorType.ValueEquality,\r\n                                                 new CodePrimitiveExpression(0)),\r\n                    new CodeAssignStatement(hashCodeFieldReference, hashCodeExpression),\r\n                    new CodeConditionStatement(\r\n                        new CodeBinaryOperatorExpression(hashCodeFieldReference,\r\n                            CodeBinaryOperatorType.ValueEquality,\r\n                            new CodePrimitiveExpression(0)),\r\n                        new CodeAssignStatement(\r\n                            hashCodeFieldReference,\r\n                            new CodePrimitiveExpression(-1)))));\r\n\r\n            // \"return __hashcode;\"\r\n            method.Statements.Add(new CodeMethodReturnStatement(hashCodeFieldReference));\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n        private static string MakePropertyFieldName(string name) => $\"_property{name}\";\r\n\r\n        private static string MakeXNameFieldName(string name) => $\"_{name}XName\";\r\n    }    \r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/CodeGeneration/DataProviderHelperBase.cs",
    "content": "﻿using System;\r\nusing System.Globalization;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Data;\r\nusing System.Threading;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class DataProviderHelperBase : IXmlDataProviderHelper\r\n    {\r\n        /// <exclude />\r\n        protected ConstructorInfo _idClassConstructor;\r\n\r\n        /// <exclude />\r\n        protected ConstructorInfo _wrapperClassConstructor;\r\n\r\n        /// <exclude />\r\n        protected Hashtable<Type, Hashtable<string, Delegate>> _selectFunctionCache = new Hashtable<Type, Hashtable<string, Delegate>>();\r\n\r\n        /// <exclude />\r\n        public abstract Type _InterfaceType { get; }\r\n\r\n        /// <exclude />\r\n        public abstract Type _DataIdType { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public Func<XElement, T> CreateSelectFunction<T>(string providerName) where T : IData\r\n        {\r\n            Type type = typeof(T);\r\n\r\n            var cache = _selectFunctionCache[typeof(T)];\r\n\r\n            if (cache == null)\r\n            {\r\n                lock (_selectFunctionCache)\r\n                {\r\n                    cache = _selectFunctionCache[type];\r\n\r\n                    if (cache == null)\r\n                    {\r\n                        cache = new Hashtable<string, Delegate>();\r\n                        _selectFunctionCache.Add(type, cache);\r\n                    }\r\n                }\r\n            }\r\n\r\n            CultureInfo cultureInfo = LocalizationScopeManager.MapByType(type);\r\n            DataScopeIdentifier dataScopeIdentifier = DataScopeManager.MapByType(type);\r\n\r\n            string cacheKey = cultureInfo + \"|\" + dataScopeIdentifier.Name;\r\n\r\n            Delegate result = cache[cacheKey];\r\n\r\n            if (result == null)\r\n            {\r\n                lock (this)\r\n                {\r\n                    result = cache[cacheKey];\r\n                    if (result == null)\r\n                    {\r\n                        // element => new [WrapperClass](element, new DataSourceId(new [DataIdClass](element), providerName, type, dataScope, localizationScope)), element\r\n                        ParameterExpression parameterExpression = Expression.Parameter(typeof(XElement), \"element\");\r\n                        result = Expression.Lambda<Func<XElement, T>>(\r\n                            Expression.New(_wrapperClassConstructor,\r\n                            new Expression[]\r\n                                {\r\n                                    parameterExpression,\r\n                                    Expression.New(GeneretedClassesMethodCache.DataSourceIdConstructor2,\r\n                                    new Expression[]\r\n                                        {\r\n                                            Expression.New(_idClassConstructor, new Expression[] { parameterExpression }), \r\n                                            Expression.Constant(providerName, typeof(string)), \r\n                                            Expression.Constant(type, typeof(Type)), \r\n                                            Expression.Constant(dataScopeIdentifier, typeof(DataScopeIdentifier)), \r\n                                            Expression.Constant(cultureInfo, typeof(CultureInfo))\r\n                                        })\r\n                                }), new[] { parameterExpression }).Compile();\r\n                        cache.Add(cacheKey, result);\r\n                    }\r\n                }\r\n            }\r\n            return (Func<XElement, T>)result;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public abstract IDataId CreateDataId(XElement xElement);\r\n\r\n\r\n        /// <exclude />\r\n        public abstract void ValidateDataType(IData data);\r\n\r\n\r\n        /// <exclude />\r\n        public abstract T CreateNewElement<T>(IData data, out XElement newElement, string elementName, string providerName) where T : IData;\r\n\r\n\r\n        /// <summary>\r\n        /// CodeDom does not support '^' operatior, so this method is used instead\r\n        /// </summary>\r\n        public static Int32 Xor(int a, int b)\r\n        {\r\n            return a ^ b;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Parses a decimal value, sets the correct precision.\r\n        /// </summary>\r\n        public static Decimal ParseDecimal(string value, int precision)\r\n        {\r\n            if(precision >= 1 || precision <= 4)\r\n            {\r\n                // DDZ: check if has to be done in \"chinese\" style for optimal permormance\r\n                int comaIndex = value.IndexOf(\".\");\r\n                if(comaIndex < 0)\r\n                {\r\n                    value += \".\" + new string('0', precision);\r\n                }\r\n                else\r\n                {\r\n                    int zerosToAdd = precision - (value.Length - comaIndex - 1);\r\n                    if(zerosToAdd > 0)\r\n                    {\r\n                        value += new string('0', zerosToAdd);\r\n                    }\r\n                }\r\n            }\r\n\r\n            value = value.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\r\n\r\n            return Decimal.Parse(value);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/CodeGeneration/DataProviderHelperClassGenerator.cs",
    "content": "using System;\r\nusing System.CodeDom;\r\nusing System.ComponentModel;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration\r\n{\r\n    /// <summary>\r\n    /// Creates a implementation of DataProviderHelperBase\r\n    /// It does NOT depend on the data type to exist\r\n    /// </summary>\r\n    internal sealed class DataProviderHelperClassGenerator\r\n    {\r\n        private const string WrapperClassConstructorFieldName = \"_wrapperClassConstructor\";\r\n        private const string DataIdClassConstructorFieldName = \"_idClassConstructor\";\r\n\r\n        private readonly string _helperClassName;\r\n        private readonly string _wrapperClassName;\r\n        private readonly string _dataIdClassName;\r\n        private string _interfaceName;\r\n\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;\r\n\r\n\r\n        public DataProviderHelperClassGenerator(\r\n                string helperClassName,\r\n                string wrapperClassName,\r\n                string dataIdClassName,\r\n                DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            _helperClassName = helperClassName;\r\n            _wrapperClassName = wrapperClassName;\r\n            _dataIdClassName = dataIdClassName;\r\n            _dataTypeDescriptor = dataTypeDescriptor;\r\n        }\r\n\r\n\r\n\r\n        public CodeTypeDeclaration CreateClass()\r\n        {\r\n            CodeTypeDeclaration declaration = new CodeTypeDeclaration(_helperClassName);\r\n\r\n            declaration.IsClass = true;\r\n            declaration.TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed;\r\n            declaration.BaseTypes.Add(typeof(DataProviderHelperBase));\r\n            declaration.CustomAttributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(EditorBrowsableAttribute)),\r\n                    new CodeAttributeArgument(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeTypeReferenceExpression(typeof(EditorBrowsableState)),\r\n                            EditorBrowsableState.Never.ToString()\r\n                        )\r\n                    )\r\n                )\r\n            );\r\n\r\n            AddConstructor(declaration);\r\n            AddInterfaceTypeProperty(declaration);\r\n            AddDataIdTypeProperty(declaration);\r\n            AddCreateDataIdFunctionMethod(declaration);\r\n            AddValidateDataTypeMethod(declaration);\r\n            AddCreateNewElementMethod(declaration);\r\n\r\n            return declaration;\r\n        }\r\n\r\n\r\n\r\n        private void AddConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeConstructor constructor = new CodeConstructor();\r\n            constructor.Attributes = MemberAttributes.Public | MemberAttributes.Final;\r\n\r\n            constructor.Statements.Add(new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        WrapperClassConstructorFieldName\r\n                    ),\r\n                    new CodeArrayIndexerExpression(\r\n                        new CodeMethodInvokeExpression(\r\n                            new CodeTypeOfExpression(\r\n                                _wrapperClassName\r\n                            ),\r\n                            \"GetConstructors\",\r\n                            new CodeExpression[] {\r\n                                new CodeBinaryOperatorExpression(\r\n                                    new CodeFieldReferenceExpression(\r\n                                        new CodeTypeReferenceExpression(typeof(BindingFlags)),\r\n                                        \"Instance\"\r\n                                    ),\r\n                                    CodeBinaryOperatorType.BitwiseOr,\r\n                                    new CodeFieldReferenceExpression(\r\n                                        new CodeTypeReferenceExpression(typeof(BindingFlags)),\r\n                                        \"Public\"\r\n                                    )\r\n                                )        \r\n                            }\r\n                        ),\r\n                        new CodeExpression[] { new CodePrimitiveExpression(0) }\r\n                    )\r\n                ));\r\n\r\n\r\n            constructor.Statements.Add(new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        DataIdClassConstructorFieldName\r\n                    ),\r\n                    new CodeArrayIndexerExpression(\r\n                        new CodeMethodInvokeExpression(\r\n                            new CodeTypeOfExpression(\r\n                                _dataIdClassName\r\n                            ),\r\n                            \"GetConstructors\",\r\n                            new CodeExpression[] {\r\n                                new CodeBinaryOperatorExpression(\r\n                                    new CodeFieldReferenceExpression(\r\n                                        new CodeTypeReferenceExpression(typeof(BindingFlags)),\r\n                                        \"Instance\"\r\n                                    ),\r\n                                    CodeBinaryOperatorType.BitwiseOr,\r\n                                    new CodeFieldReferenceExpression(\r\n                                        new CodeTypeReferenceExpression(typeof(BindingFlags)),\r\n                                        \"Public\"\r\n                                    )\r\n                                )        \r\n                            }\r\n                        ),\r\n                        new CodeExpression[] { new CodePrimitiveExpression(1) }\r\n                    )\r\n                ));\r\n\r\n\r\n            declaration.Members.Add(constructor);\r\n        }\r\n\r\n\r\n\r\n        private void AddInterfaceTypeProperty(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeMemberProperty property = new CodeMemberProperty();\r\n            property.Name = \"_InterfaceType\";\r\n            property.HasGet = true;\r\n            property.HasSet = false;\r\n            property.Type = new CodeTypeReference(typeof(Type));\r\n            property.Attributes = MemberAttributes.Public | MemberAttributes.Override;\r\n\r\n            property.GetStatements.Add(new CodeMethodReturnStatement(\r\n                    new CodeTypeOfExpression(_dataTypeDescriptor.GetFullInterfaceName())\r\n                ));\r\n\r\n\r\n            declaration.Members.Add(property);\r\n        }\r\n\r\n\r\n\r\n        private void AddDataIdTypeProperty(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeMemberProperty property = new CodeMemberProperty();\r\n            property.Name = \"_DataIdType\";\r\n            property.HasGet = true;\r\n            property.HasSet = false;\r\n            property.Type = new CodeTypeReference(typeof(Type));\r\n            property.Attributes = MemberAttributes.Public | MemberAttributes.Override;\r\n\r\n            property.GetStatements.Add(new CodeMethodReturnStatement(\r\n                    new CodeTypeOfExpression(_dataIdClassName)\r\n                ));\r\n\r\n\r\n            declaration.Members.Add(property);\r\n        }\r\n\r\n\r\n\r\n        private void AddCreateDataIdFunctionMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeMemberMethod method = new CodeMemberMethod();\r\n            method.Name = \"CreateDataId\";\r\n            method.ReturnType = new CodeTypeReference(typeof(IDataId));\r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(XElement), \"xElement\"));\r\n            method.Attributes = MemberAttributes.Public | MemberAttributes.Override;\r\n\r\n            method.Statements.Add(new CodeMethodReturnStatement(\r\n                new CodeObjectCreateExpression(this._dataIdClassName,\r\n                new CodeArgumentReferenceExpression(\"xElement\"))));\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n        private static void AddValidateDataTypeMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeMemberMethod method = new CodeMemberMethod();\r\n            method.Name = \"ValidateDataType\";\r\n            method.ReturnType = new CodeTypeReference(typeof(void));\r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(IData), \"data\"));\r\n            method.Attributes = MemberAttributes.Public | MemberAttributes.Override;\r\n\r\n\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n\r\n        private void AddCreateNewElementMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            CodeMemberMethod method = new CodeMemberMethod();\r\n            method.Name = \"CreateNewElement\";\r\n\r\n            CodeTypeParameter genericParameter = new CodeTypeParameter(\"T\");\r\n            genericParameter.HasConstructorConstraint = false;\r\n\r\n            method.TypeParameters.Add(genericParameter);\r\n\r\n            method.ReturnType = new CodeTypeReference(genericParameter);\r\n            method.ImplementationTypes.Add(typeof(IXmlDataProviderHelper));\r\n\r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(IData), \"data\"));\r\n            CodeParameterDeclarationExpression parameter = new CodeParameterDeclarationExpression(typeof(XElement), \"newElement\");\r\n            parameter.Direction = FieldDirection.Out;\r\n            method.Parameters.Add(parameter);\r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), \"elementName\"));\r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), \"providerName\"));\r\n\r\n            method.Attributes = MemberAttributes.Public | MemberAttributes.Override;\r\n\r\n\r\n            method.Statements.Add(new CodeVariableDeclarationStatement(\r\n                InterfaceName,\r\n                \"xmlData\"));\r\n\r\n\r\n            method.Statements.Add(new CodeTryCatchFinallyStatement(\r\n                    new CodeStatement[] {\r\n                            new CodeAssignStatement(\r\n                                new CodeVariableReferenceExpression(\"xmlData\"),\r\n                                new CodeCastExpression(\r\n                                    InterfaceName,\r\n                                    new CodeVariableReferenceExpression(\"data\"))\r\n                            )\r\n                    },\r\n                    new CodeCatchClause[] {\r\n                         new CodeCatchClause(\"e\", new CodeTypeReference(typeof(Exception)), new CodeStatement[] {\r\n                            new CodeThrowExceptionStatement(\r\n                                new CodeObjectCreateExpression(\r\n                                    new CodeTypeReference(typeof(ArgumentException)),\r\n                                    new CodeExpression[] {\r\n                                        new CodeMethodInvokeExpression(\r\n                                            new CodeTypeReferenceExpression(typeof(string)), \r\n                                            \"Format\",\r\n                                            new CodeExpression[] {\r\n                                                new CodePrimitiveExpression(\"The type ({0}) of the given data parameter does not match the type {1}\"),\r\n                                                new CodeMethodInvokeExpression(\r\n                                                    new CodeVariableReferenceExpression(\"data\"),\r\n                                                    \"GetType\",\r\n                                                    new CodeExpression[] {}\r\n                                                ),\r\n                                                new CodeTypeOfExpression(InterfaceName)\r\n                                            }\r\n                                        ),\r\n                                        new CodeVariableReferenceExpression(\"e\")\r\n                                    }                                    \r\n                                )\r\n                            )\r\n                        })\r\n                    }\r\n                ));\r\n\r\n\r\n            const string newElementVariableName = \"newElement\";\r\n\r\n            method.Statements.Add(new CodeAssignStatement(\r\n                new CodeVariableReferenceExpression(newElementVariableName),\r\n                new CodeObjectCreateExpression(\r\n                        typeof(XElement),\r\n                        new CodeVariableReferenceExpression(\"elementName\")\r\n                    )\r\n            ));\r\n\r\n\r\n\r\n            foreach (DataFieldDescriptor field in _dataTypeDescriptor.Fields)\r\n            {\r\n                method.Statements.Add(new CodeCommentStatement(string.Format(\"Interface Property {0}\", field.Name)));\r\n\r\n                CodeMethodInvokeExpression codeExpression = new CodeMethodInvokeExpression(\r\n                            new CodeVariableReferenceExpression(newElementVariableName),\r\n                            \"Add\",\r\n                            new CodeExpression[] {\r\n                                    new CodeObjectCreateExpression(\r\n                                        typeof(XAttribute),\r\n                                        new CodeExpression[] {\r\n                                            new CodePrimitiveExpression(field.Name),\r\n                                            new CodePropertyReferenceExpression(\r\n                                                new CodeVariableReferenceExpression(\"xmlData\"),\r\n                                                field.Name\r\n                                            )\r\n                                        }\r\n                                    )\r\n                                }\r\n                        );\r\n\r\n                if ((field.InstanceType.IsGenericType) &&\r\n                    (field.InstanceType.GetGenericTypeDefinition() == typeof(Nullable<>)))\r\n                {\r\n                    method.Statements.Add(\r\n                        new CodeConditionStatement(\r\n                            new CodeBinaryOperatorExpression(\r\n                                new CodePropertyReferenceExpression(\r\n                                    new CodePropertyReferenceExpression(\r\n                                        new CodeVariableReferenceExpression(\"xmlData\"),\r\n                                        field.Name\r\n                                    ),\r\n                                    \"HasValue\"\r\n                                ),\r\n                                CodeBinaryOperatorType.IdentityEquality,\r\n                                new CodePrimitiveExpression(true)\r\n                            ),\r\n                            new CodeStatement[] {\r\n                                    new CodeExpressionStatement(\r\n                                        codeExpression\r\n                                    )\r\n                                }\r\n                        ));\r\n                }\r\n                else if (field.InstanceType == typeof(string))\r\n                {\r\n                    method.Statements.Add(\r\n                        new CodeConditionStatement(\r\n                            new CodeBinaryOperatorExpression(\r\n                                new CodePropertyReferenceExpression(\r\n                                    new CodeVariableReferenceExpression(\"xmlData\"),\r\n                                    field.Name\r\n                                ),\r\n                                CodeBinaryOperatorType.IdentityInequality,\r\n                                new CodePrimitiveExpression(null)\r\n                            ),\r\n                            new CodeStatement[] {\r\n                                    new CodeExpressionStatement(\r\n                                        codeExpression\r\n                                    )\r\n                                }\r\n                        ));\r\n                }\r\n                else\r\n                {\r\n                    method.Statements.Add(codeExpression);\r\n                }                \r\n            }\r\n\r\n\r\n            method.Statements.Add(new CodeCommentStatement(\"Done with properties\"));\r\n\r\n\r\n            method.Statements.Add(new CodeVariableDeclarationStatement(\r\n                    typeof(IData),\r\n                    \"newData\",\r\n                    new CodeObjectCreateExpression(\r\n                        _wrapperClassName,\r\n                        new CodeExpression[] {\r\n                            new CodeVariableReferenceExpression(\"newElement\"),\r\n                            new CodeObjectCreateExpression(\r\n                                typeof(DataSourceId),\r\n                                new CodeExpression[] {\r\n                                    new CodeObjectCreateExpression(\r\n                                        _dataIdClassName,\r\n                                        new CodeVariableReferenceExpression(\"newElement\")\r\n                                    ),\r\n                                    new CodeVariableReferenceExpression(\"providerName\"),\r\n                                    new CodeTypeOfExpression(InterfaceName)\r\n                                }\r\n                            )\r\n                        }\r\n                    )\r\n                ));\r\n\r\n\r\n            method.Statements.Add(new CodeMethodReturnStatement(\r\n                    new CodeCastExpression(\r\n                        new CodeTypeReference(genericParameter),\r\n                        new CodeVariableReferenceExpression(\"newData\")\r\n                    )\r\n                ));\r\n\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n        private string InterfaceFullName { get { return TypeManager.GetRuntimeFullName(_dataTypeDescriptor.TypeManagerTypeName); } }\r\n\r\n        \r\n        private string InterfaceName\r\n        {\r\n            get\r\n            {\r\n                if (_interfaceName == null)\r\n                {\r\n                    _interfaceName = InterfaceFullName;\r\n                    if (_interfaceName.IndexOf(',') >= 0)\r\n                    {\r\n                        _interfaceName = _interfaceName.Remove(_interfaceName.IndexOf(','));\r\n                    }\r\n                }\r\n\r\n                return _interfaceName;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/CodeGeneration/DataWrapperClassGenerator.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration\r\n{\r\n    internal sealed class DataWrapperClassGenerator\r\n    {\r\n        private readonly string _wrapperClassName;\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;\r\n        private string _interfaceName;\r\n\r\n        private const string WrappedElementFieldName = \"_element\";\r\n        private const string DataSourceIdFieldName = \"_dataSourceId\";\r\n        private const string ElementMethodInfoFieldName = \"_elementMethodInfo\";\r\n\r\n        public DataWrapperClassGenerator(string wrapperClassName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            _wrapperClassName = wrapperClassName;\r\n            _dataTypeDescriptor = dataTypeDescriptor;\r\n        }\r\n\r\n\r\n\r\n        public CodeTypeDeclaration CreateClass()\r\n        {\r\n            var declaration = new CodeTypeDeclaration(_wrapperClassName)\r\n            {\r\n                IsClass = true,\r\n                TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed\r\n            };\r\n\r\n            declaration.BaseTypes.Add(InterfaceName);\r\n            declaration.BaseTypes.Add(typeof(IXElementWrapper));\r\n\r\n            declaration.CustomAttributes.Add(\r\n                new CodeAttributeDeclaration(\r\n                    new CodeTypeReference(typeof(EditorBrowsableAttribute)),\r\n                    new CodeAttributeArgument(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeTypeReferenceExpression(typeof(EditorBrowsableState)),\r\n                            EditorBrowsableState.Never.ToString()\r\n                        )\r\n                    )\r\n                )\r\n            );\r\n            declaration.Members.Add(new CodeMemberField(new CodeTypeReference(typeof(XElement)), WrappedElementFieldName));\r\n            declaration.Members.Add(new CodeMemberField(typeof(DataSourceId), DataSourceIdFieldName));\r\n\r\n            var elementMethodInfoField = new CodeMemberField(typeof(MethodInfo), ElementMethodInfoFieldName)\r\n            {\r\n                Attributes = MemberAttributes.Static | MemberAttributes.Private\r\n            };\r\n            declaration.Members.Add(elementMethodInfoField);\r\n            elementMethodInfoField.InitExpression = new CodeMethodInvokeExpression(\r\n                    new CodeTypeOfExpression(typeof(XElement)),\r\n                    \"GetMethod\",\r\n                    new CodeExpression[] {\r\n                        new CodePrimitiveExpression(\"Element\")\r\n                    }\r\n                );\r\n\r\n\r\n\r\n            AddConstructor(declaration);\r\n            AddCommitDataMethod(declaration);\r\n            AddIDataSourceProperty(declaration);\r\n            AddInterfaceProperties(declaration);\r\n\r\n            return declaration;\r\n        }\r\n\r\n\r\n\r\n        private static void AddConstructor(CodeTypeDeclaration declaration)\r\n        {\r\n            const string parameterName = \"element\";\r\n\r\n            // CODEGEN:\r\n            // public .ctor(XElement element, DataSourceId dataSourceId) { ... }\r\n            var constructor = new CodeConstructor { Attributes = MemberAttributes.Public };\r\n\r\n            constructor.Parameters.Add(new CodeParameterDeclarationExpression(\r\n                    new CodeTypeReference(typeof(XElement)),\r\n                    parameterName\r\n                ));\r\n\r\n            constructor.Parameters.Add(new CodeParameterDeclarationExpression(\r\n                typeof(DataSourceId),\r\n                \"dataSourceId\"\r\n                ));\r\n\r\n\r\n            // CODEGEN:\r\n            // this._element = element;\r\n\r\n            constructor.Statements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        WrappedElementFieldName\r\n                        ),\r\n                        new CodeArgumentReferenceExpression(parameterName)\r\n                    ));\r\n\r\n            // CODEGEN:\r\n            // this._dataSourceId = dataSourceId;\r\n\r\n            constructor.Statements.Add(\r\n                new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        DataSourceIdFieldName\r\n                        ),\r\n                    new CodeArgumentReferenceExpression(\"dataSourceId\")\r\n                    ));\r\n\r\n\r\n            declaration.Members.Add(constructor);\r\n        }\r\n\r\n\r\n\r\n        private void AddCommitDataMethod(CodeTypeDeclaration declaration)\r\n        {\r\n            // CODEGEN: \r\n            // public void CommitData(XElement wrappedElement) { ... }\r\n\r\n            var method = new CodeMemberMethod\r\n            {\r\n                Name = nameof(IXElementWrapper.CommitData),\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Final,\r\n                ReturnType = new CodeTypeReference(typeof (void))\r\n            };\r\n            \r\n            method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(XElement), \"wrappedElement\"));\r\n\r\n            // CODEGEN:\r\n            // this._element = wrappedElement;\r\n\r\n            method.Statements.Add(new CodeAssignStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        WrappedElementFieldName\r\n                    ),\r\n                    new CodeVariableReferenceExpression(\"wrappedElement\")\r\n                ));\r\n\r\n            var statments = new List<CodeStatement>();\r\n\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                string fieldName = CreateNullableFieldName(dataFieldDescriptor);\r\n\r\n                var newStatements = AddCommitDataMethodHelper(\r\n                    \"attribute\",\r\n                    new CodeFieldReferenceExpression(null, CreateXNameFieldName(dataFieldDescriptor)),\r\n                    new CodePropertyReferenceExpression(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            fieldName\r\n                        ),\r\n                        nameof(ExtendedNullable<string>.Value)\r\n                    ));\r\n\r\n                statments.Add(AddCommitDataMethodFinalHelper(dataFieldDescriptor, newStatements));\r\n            }\r\n\r\n\r\n            method.Statements.AddRange(statments.ToArray());\r\n\r\n            declaration.Members.Add(method);\r\n        }\r\n\r\n\r\n\r\n        private static CodeStatement AddCommitDataMethodFinalHelper(DataFieldDescriptor dataFieldDescriptor, IEnumerable<CodeStatement> statements)\r\n        {\r\n            // CODEGEN:\r\n            // if (this._isSet_email && this._emailNullable != null) {\r\n            //     [statements]\r\n            //     _isSet_email = false;\r\n            // }\r\n\r\n            string fieldName = CreateNullableFieldName(dataFieldDescriptor);\r\n\r\n            // this._isSet_email\r\n            var fieldIsSetFieldReference = \r\n                new CodeFieldReferenceExpression(\r\n                    new CodeThisReferenceExpression(),\r\n                    IsSetFieldName(dataFieldDescriptor)\r\n                );\r\n\r\n            // this._emailNullable != null\r\n            var expression2 = new CodeBinaryOperatorExpression(\r\n                new CodeFieldReferenceExpression(\r\n                    new CodeThisReferenceExpression(),\r\n                    fieldName\r\n                ),\r\n                CodeBinaryOperatorType.IdentityInequality,\r\n                new CodePrimitiveExpression(null)\r\n            );\r\n\r\n            return new CodeConditionStatement(\r\n                new CodeBinaryOperatorExpression(\r\n                    fieldIsSetFieldReference, CodeBinaryOperatorType.BooleanAnd, expression2),\r\n                    statements.Concat(new [] {\r\n                        // CODEGEN:\r\n                        // this._isSetEmail = false;\r\n                        new CodeAssignStatement(\r\n                            fieldIsSetFieldReference,\r\n                            new CodePrimitiveExpression(false)\r\n                        )}).ToArray()\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private static CodeStatement[] AddCommitDataMethodHelper(string elementVariableName, CodeExpression attributeNameExpression, CodeExpression valueExpression)\r\n        {\r\n            var elementVariable = new CodeVariableReferenceExpression(elementVariableName);\r\n\r\n            return new CodeStatement[] {\r\n                new CodeVariableDeclarationStatement(\r\n                    typeof(XAttribute),\r\n                    elementVariableName,\r\n                    new CodeMethodInvokeExpression(\r\n                        new CodeFieldReferenceExpression(\r\n                            new CodeThisReferenceExpression(),\r\n                            WrappedElementFieldName\r\n                        ),\r\n                        \"Attribute\",\r\n                        attributeNameExpression)\r\n                ),\r\n                new CodeConditionStatement(\r\n                    new CodeBinaryOperatorExpression(\r\n                        valueExpression,\r\n                        CodeBinaryOperatorType.IdentityInequality,\r\n                        new CodePrimitiveExpression(null)\r\n                    ),\r\n                    new CodeStatement[] {\r\n                        new CodeConditionStatement(\r\n                            new CodeBinaryOperatorExpression(\r\n                                elementVariable,\r\n                                CodeBinaryOperatorType.IdentityEquality,\r\n                                new CodePrimitiveExpression(null)\r\n                            ),\r\n                            new CodeStatement[] {\r\n                                new CodeAssignStatement(\r\n                                    elementVariable,\r\n                                    new CodeObjectCreateExpression(\r\n                                        typeof(XAttribute),\r\n                                        attributeNameExpression,\r\n                                        valueExpression\r\n                                    )\r\n                                ),\r\n                                new CodeExpressionStatement(\r\n                                    new CodeMethodInvokeExpression(\r\n                                        new CodeFieldReferenceExpression(\r\n                                            new CodeThisReferenceExpression(),\r\n                                            WrappedElementFieldName\r\n                                        ),\r\n                                        \"Add\",\r\n                                        elementVariable)\r\n                                )\r\n                            },\r\n                            new CodeStatement[] {\r\n                                new CodeExpressionStatement(\r\n                                    new CodeMethodInvokeExpression(\r\n                                        elementVariable,\r\n                                        \"SetValue\", \r\n                                        valueExpression)\r\n                                ),\r\n                            }\r\n                        )\r\n                    },\r\n                    // CODEGEN:\r\n                    // else if (attribute != null)\r\n                    // {\r\n                    //   attribute.Remove();\r\n                    // }\r\n                    new CodeStatement[] {\r\n                        new CodeConditionStatement(\r\n                            new CodeBinaryOperatorExpression(\r\n                                elementVariable,\r\n                                CodeBinaryOperatorType.IdentityInequality,\r\n                                new CodePrimitiveExpression(null)\r\n                            ),\r\n                            new CodeExpressionStatement(\r\n                                new CodeMethodInvokeExpression(\r\n                                    elementVariable,\r\n                                    \"Remove\"\r\n                                )\r\n                            )\r\n                        )\r\n                    }\r\n                )\r\n            };\r\n        }\r\n\r\n\r\n\r\n\r\n        private static void AddIDataSourceProperty(CodeTypeDeclaration declaration)\r\n        {\r\n            PropertyInfo info = typeof(IData).GetProperty(\"DataSourceId\");\r\n\r\n            var property = new CodeMemberProperty\r\n            {\r\n                Attributes = MemberAttributes.Public | MemberAttributes.Final,\r\n                Name = info.Name,\r\n                HasGet = true,\r\n                HasSet = false,\r\n                Type = new CodeTypeReference(info.PropertyType)\r\n            };\r\n\r\n            property.GetStatements.Add(\r\n                new CodeMethodReturnStatement(\r\n                    new CodeFieldReferenceExpression(\r\n                        new CodeThisReferenceExpression(),\r\n                        \"_dataSourceId\"\r\n                        )\r\n                    ));\r\n\r\n\r\n            declaration.Members.Add(property);\r\n        }\r\n\r\n\r\n\r\n        private void AddInterfaceProperties(CodeTypeDeclaration declaration)\r\n        {\r\n            foreach (DataFieldDescriptor dataFieldDescriptor in _dataTypeDescriptor.Fields)\r\n            {\r\n                string nullableFieldName = CreateNullableFieldName(dataFieldDescriptor);\r\n\r\n                var nullableFieldReference = new CodeFieldReferenceExpression(\r\n                    new CodeThisReferenceExpression(),\r\n                    nullableFieldName\r\n                );\r\n\r\n                var nullableFieldValueReference = new CodePropertyReferenceExpression(\r\n                    nullableFieldReference,\r\n                    nameof(ExtendedNullable<string>.Value)\r\n                );\r\n\r\n                // CODEGEN:\r\n                // private ExtendedNullable<string> _emailNullable;\r\n\r\n                var nullableType = new CodeTypeReference(\r\n                    typeof(ExtendedNullable<>).FullName,\r\n                    new[] { new CodeTypeReference(dataFieldDescriptor.InstanceType) }\r\n                );\r\n\r\n                declaration.Members.Add(new CodeMemberField\r\n                {\r\n                    Name = nullableFieldName,\r\n                    Type = nullableType\r\n                });\r\n\r\n                // CODEGEN:\r\n                // private bool _isSet_email;\r\n\r\n                declaration.Members.Add(new CodeMemberField\r\n                {\r\n                    Name = IsSetFieldName(dataFieldDescriptor),\r\n                    Type = new CodeTypeReference(typeof(bool))\r\n                });\r\n\r\n                // CODEGEN:\r\n                // private static XName _pointsXName = \"Points\";\r\n\r\n                var xNameField = new CodeMemberField\r\n                {\r\n                    Name = CreateXNameFieldName(dataFieldDescriptor),\r\n                    Type = new CodeTypeReference(typeof(XName)),\r\n                    Attributes = MemberAttributes.Static | MemberAttributes.Private,\r\n                    InitExpression = new CodePrimitiveExpression(dataFieldDescriptor.Name)\r\n                };\r\n                declaration.Members.Add(xNameField);\r\n\r\n                // CODEGEN: \r\n                // public string Email { get {...} set { ...} } \r\n\r\n                var property = new CodeMemberProperty\r\n                {\r\n                    Attributes = MemberAttributes.Public | MemberAttributes.Final,\r\n                    Name = dataFieldDescriptor.Name,\r\n                    HasGet = true,\r\n                    HasSet = true,\r\n                    Type = new CodeTypeReference(dataFieldDescriptor.InstanceType)\r\n                };\r\n\r\n                // CODEGEN:\r\n                // if(this._emailNullable != null) {\r\n                //     return this._emailNullable.Value;\r\n                // }\r\n                property.GetStatements.Add(\r\n                    new CodeConditionStatement(\r\n                        new CodeBinaryOperatorExpression(\r\n                            nullableFieldReference,\r\n                            CodeBinaryOperatorType.IdentityInequality,\r\n                            new CodePrimitiveExpression(null)\r\n                            ),\r\n                        new CodeMethodReturnStatement(\r\n                            nullableFieldValueReference\r\n                            )\r\n                        ));\r\n\r\n                // XAttribute attribute = _element.Attribute(_{fieldName}XName);\r\n                property.GetStatements.Add(\r\n                    new CodeVariableDeclarationStatement(\r\n                        typeof (XAttribute), \"attribute\",\r\n                        new CodeMethodInvokeExpression(\r\n                            new CodeFieldReferenceExpression(\r\n                                new CodeThisReferenceExpression(),\r\n                                WrappedElementFieldName\r\n                                ),\r\n                            \"Attribute\",\r\n                            new CodeFieldReferenceExpression(null, CreateXNameFieldName(dataFieldDescriptor))\r\n                            )));\r\n\r\n\r\n                // CODEGEN: \r\n                // if (attribute == null) {\r\n                //    return null; \r\n                // }\r\n                //\r\n                // or\r\n                //\r\n                // if (attribute == null) {\r\n                //    throw new InvalidOperationException(\"The element attribute 'Email' is missing from the xml file\");\r\n                // }\r\n\r\n                CodeStatement noAttributeReturnStatement;\r\n                if (dataFieldDescriptor.InstanceType == typeof(string)\r\n                    || (dataFieldDescriptor.InstanceType.IsGenericType\r\n                        && dataFieldDescriptor.InstanceType.GetGenericTypeDefinition() == typeof(Nullable<>)))\r\n                {\r\n                    noAttributeReturnStatement = new CodeMethodReturnStatement(new CodePrimitiveExpression(null));\r\n                }\r\n                else\r\n                {\r\n                    noAttributeReturnStatement = \r\n                        new CodeThrowExceptionStatement(\r\n                            new CodeObjectCreateExpression(\r\n                                typeof(InvalidOperationException), \r\n                                new CodePrimitiveExpression(\r\n                                    $\"The element attribute '{dataFieldDescriptor.Name}' is missing from the xml file\"\r\n                                ))\r\n                        );\r\n                }\r\n\r\n                property.GetStatements.Add(\r\n                    new CodeConditionStatement(\r\n                            new CodeBinaryOperatorExpression(\r\n                                new CodeVariableReferenceExpression(\"attribute\"), \r\n                                CodeBinaryOperatorType.IdentityEquality,\r\n                                new CodePrimitiveExpression(null)\r\n                            ),\r\n                            \r\n                            noAttributeReturnStatement\r\n                        ));\r\n\r\n\r\n                CodeExpression valueExpression;\r\n\r\n\r\n                if (!dataFieldDescriptor.StoreType.IsDecimal)\r\n                {\r\n                    // ({Type}) attribute;\r\n                    valueExpression = new CodeCastExpression(dataFieldDescriptor.InstanceType, \r\n                                                              new CodeVariableReferenceExpression(\"attribute\"));\r\n                }\r\n                else\r\n                {\r\n                    // FixDecimal(attribute.Value, {decimal precision});\r\n                    valueExpression = new CodeMethodInvokeExpression(\r\n                        new CodeMethodReferenceExpression(\r\n                            new CodeTypeReferenceExpression(typeof(DataProviderHelperBase)),\r\n                            nameof(DataProviderHelperBase.ParseDecimal)), \r\n                            new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(\"attribute\"), \"Value\"),\r\n                            new CodePrimitiveExpression(dataFieldDescriptor.StoreType.NumericScale)\r\n                    );\r\n                }\r\n\r\n                // CODEGEN:\r\n                // Type value = ({Type}) attribute;\r\n                property.GetStatements.Add(\r\n                    new CodeVariableDeclarationStatement(\r\n                        dataFieldDescriptor.InstanceType, \r\n                        \"value\",\r\n                        valueExpression));\r\n\r\n\r\n                // CODEGEN:\r\n                // this._emailNullable = value; // Using the implicit cast to ExtendedEnumerable<>\r\n\r\n                property.GetStatements.Add(\r\n                    new CodeAssignStatement(\r\n                        nullableFieldReference,\r\n                        new CodeVariableReferenceExpression(\"value\")));\r\n\r\n                // CODEGEN:\r\n                // return value;\r\n                property.GetStatements.Add(\r\n                    new CodeMethodReturnStatement(\r\n                        new CodeVariableReferenceExpression(\"value\")));\r\n\r\n\r\n                if (!dataFieldDescriptor.IsReadOnly)\r\n                {\r\n                    // CODEGEN:\r\n                    // if(this.[fieldName] == null) {\r\n                    //   this.[fieldName] = value; \r\n                    // }\r\n                    // else \r\n                    // {\r\n                    //    // this._emailNullable.Value = value;\r\n                    // }\r\n                    property.SetStatements.Add(\r\n                       new CodeConditionStatement(\r\n                           new CodeBinaryOperatorExpression(\r\n                               nullableFieldReference,\r\n                               CodeBinaryOperatorType.IdentityEquality,\r\n                               new CodePrimitiveExpression(null)\r\n                               ),\r\n                           new CodeStatement[]\r\n                           {\r\n                               new CodeAssignStatement(\r\n                                   nullableFieldReference,\r\n                                   new CodePropertySetValueReferenceExpression())\r\n                           },\r\n                           new CodeStatement[]\r\n                           {\r\n                               new CodeAssignStatement(\r\n                                   nullableFieldValueReference,\r\n                                   new CodePropertySetValueReferenceExpression()\r\n                               )\r\n                           }));\r\n\r\n                    // CODEGEN:\r\n                    // this._isSet_email = true;\r\n\r\n                    property.SetStatements.Add(\r\n                        new CodeAssignStatement(\r\n                            new CodeFieldReferenceExpression(\r\n                                    new CodeThisReferenceExpression(),\r\n                                    IsSetFieldName(dataFieldDescriptor)\r\n                            ),\r\n                            new CodePrimitiveExpression(true)\r\n                        ));\r\n                }\r\n\r\n                declaration.Members.Add(property);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static string CreateNullableFieldName(DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            return $\"_{dataFieldDescriptor.Name.ToLowerInvariant()}Nullable\";\r\n        }\r\n\r\n        private static string CreateXNameFieldName(DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            return $\"_{dataFieldDescriptor.Name.ToLowerInvariant()}XName\";\r\n        }\r\n\r\n        private static string IsSetFieldName(DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            return $\"_isSet_{dataFieldDescriptor.Name.ToLowerInvariant()}\";\r\n        }\r\n\r\n\r\n        private string InterfaceFullName => TypeManager.GetRuntimeFullName(_dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n\r\n        private string InterfaceName\r\n        {\r\n            get\r\n            {\r\n                if (_interfaceName == null)\r\n                {\r\n                    _interfaceName = InterfaceFullName;\r\n                    int commaOffset = _interfaceName.IndexOf(',');\r\n                    if (commaOffset >= 0)\r\n                    {\r\n                        _interfaceName = _interfaceName.Remove(commaOffset);\r\n                    }\r\n                }\r\n\r\n                return _interfaceName;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/CodeGeneration/GeneretedClassesMethodCache.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing System.Reflection;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration\r\n{\r\n    internal static class GeneretedClassesMethodCache\r\n    {\r\n        private static MethodInfo _xElementElementMethod = typeof(XElement).GetMethod(\"Element\");\r\n        private static MethodInfo _xElementAttributeMethod = typeof(XElement).GetMethod(\"Attribute\");\r\n        private static ConstructorInfo _dataSourceIdConstructor = typeof(DataSourceId).GetConstructors(BindingFlags.Instance | BindingFlags.Public)[0];\r\n        private static ConstructorInfo _dataSourceIdConstructor2 = typeof(DataSourceId).GetConstructors(BindingFlags.Instance | BindingFlags.Public)[1];\r\n        private static MethodInfo _guidCompareToMethod = null;\r\n        private static Dictionary<Type, MethodInfo> _explicitCastXElementMethodInfoCache = new Dictionary<Type, MethodInfo>();\r\n        private static Dictionary<Type, MethodInfo> _explicitCastXAttributeMethodInfoCache = new Dictionary<Type, MethodInfo>();\r\n\r\n\r\n\r\n        public static MethodInfo XElementElementMethod\r\n        {\r\n            get\r\n            {\r\n                return _xElementElementMethod;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo XElementAttributeMethod\r\n        {\r\n            get\r\n            {\r\n                return _xElementAttributeMethod;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static ConstructorInfo DataSourceIdConstructor\r\n        {\r\n            get\r\n            {\r\n                return _dataSourceIdConstructor;\r\n            }\r\n        }\r\n\r\n        public static ConstructorInfo DataSourceIdConstructor2\r\n        {\r\n            get\r\n            {\r\n                return _dataSourceIdConstructor2;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GuidCompareTo\r\n        {\r\n            get\r\n            {\r\n                if (null == _guidCompareToMethod)\r\n                {\r\n                    _guidCompareToMethod =\r\n                        (from mi in typeof(Guid).GetMethods()\r\n                         where mi.Name == \"CompareTo\" && mi.GetParameters()[0].ParameterType == typeof(Guid)\r\n                         select mi).First();\r\n                }\r\n\r\n                return _guidCompareToMethod;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetExplicitCastXElement(Type type)\r\n        {\r\n            if (null == type) throw new ArgumentNullException(\"type\");\r\n\r\n            MethodInfo methodInfo;\r\n\r\n            if (false == _explicitCastXElementMethodInfoCache.TryGetValue(type, out methodInfo))\r\n            {\r\n                methodInfo =\r\n                    (from member in typeof(XElement).GetMethods()\r\n                     where member.Name == \"op_Explicit\" && member.ReturnType == type\r\n                     select member).FirstOrDefault();\r\n\r\n                if (null == methodInfo)\r\n                {\r\n                    if (null == methodInfo) throw new InvalidOperationException(string.Format(\"No explicit cast from {0} to {1} exists\", typeof(XElement), type));\r\n                }\r\n\r\n                _explicitCastXElementMethodInfoCache.Add(type, methodInfo);\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodInfo GetExplicitCastXAttribute(Type type)\r\n        {\r\n            if (null == type) throw new ArgumentNullException(\"type\");\r\n\r\n            MethodInfo methodInfo;\r\n\r\n            if (false == _explicitCastXAttributeMethodInfoCache.TryGetValue(type, out methodInfo))\r\n            {\r\n                methodInfo =\r\n                    (from member in typeof(XAttribute).GetMethods()\r\n                     where member.Name == \"op_Explicit\" && member.ReturnType == type\r\n                     select member).FirstOrDefault();\r\n\r\n                if (null == methodInfo)\r\n                {\r\n                    if (null == methodInfo) throw new InvalidOperationException(string.Format(\"No explicit cast from {0} to {1} exists\", typeof(XElement), type));\r\n                }\r\n\r\n                _explicitCastXAttributeMethodInfoCache.Add(type, methodInfo);\r\n            }\r\n\r\n            return methodInfo;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/CodeGeneration/XmlDataProviderCodeBuilder.cs",
    "content": "﻿using System;\r\nusing System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Serialization.CodeGeneration;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration\r\n{\r\n    internal class XmlDataProviderCodeBuilder\r\n    {\r\n        private readonly CodeGenerationBuilder _codeGenerationBuilder;\r\n        private readonly string _namespaceName;\r\n\r\n\r\n        public XmlDataProviderCodeBuilder(string providerName, CodeGenerationBuilder codeGenerationBuilder)\r\n        {\r\n            _codeGenerationBuilder = codeGenerationBuilder;\r\n\r\n            _namespaceName = NamesCreator.MakeNamespaceName(providerName);\r\n\r\n            AddCodeNamespaces();\r\n        }\r\n\r\n\r\n\r\n        internal void AddDataType(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n            if (interfaceType == null) return;\r\n\r\n            XmlProviderCodeGenerator codeGenerator = new XmlProviderCodeGenerator(dataTypeDescriptor, _namespaceName);\r\n            IEnumerable<CodeTypeDeclaration> codeTypeDeclarations = codeGenerator.CreateCodeDOMs();\r\n            codeTypeDeclarations.ForEach(f => _codeGenerationBuilder.AddType(_namespaceName, f));\r\n\r\n            // Property serializer for entity tokens and more\r\n            var keyPropertiesDictionary = new Dictionary<string, Type>();\r\n            var keyPropertiesList = new List<Tuple<string, Type>>();\r\n            foreach (var keyField in dataTypeDescriptor.PhysicalKeyFields)\r\n            {\r\n                Verify.That(!keyPropertiesDictionary.ContainsKey(keyField.Name), \"Key field with name '{0}' already present. Data type: {1}. Check for multiple [KeyPropertyName(...)] attributes.\", keyField.Name, dataTypeDescriptor.Namespace + \".\" + dataTypeDescriptor.Name);\r\n\r\n                keyPropertiesDictionary.Add(keyField.Name, keyField.InstanceType);\r\n                keyPropertiesList.Add(new Tuple<string, Type>(keyField.Name, keyField.InstanceType));\r\n            }\r\n\r\n            PropertySerializerTypeCodeGenerator.AddPropertySerializerTypeCode(_codeGenerationBuilder, codeGenerator.DataIdClassFullName, keyPropertiesList);\r\n            \r\n            _codeGenerationBuilder.AddReference(interfaceType.Assembly);\r\n        }\r\n\r\n\r\n\r\n        private void AddCodeNamespaces()\r\n        {\r\n            _codeGenerationBuilder.AddReference(typeof(XElement).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(Exception).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(IQueryable).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(XName).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(XmlReader).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(EditorBrowsableAttribute).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(ExpressionCreator).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(ExtendedNullable<>).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(DataSourceId).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(IProcessControlled).Assembly);\r\n            _codeGenerationBuilder.AddReference(typeof(XmlDataProvider).Assembly);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/CodeGeneration/XmlDataProviderCodeProvider.cs",
    "content": "﻿using System.ComponentModel;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Foundation.PluginFacades;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    internal class XmlDataProviderCodeProvider : ICodeProvider\r\n    {\r\n        public string ProviderName { get; private set; }\r\n\r\n        public XmlDataProviderCodeProvider(string providerName)\r\n        {\r\n            ProviderName = providerName;\r\n        }\r\n\r\n\r\n        public void GetCodeToCompile(CodeGenerationBuilder builder)\r\n        {\r\n            XmlDataProvider xmlDataProvider = (XmlDataProvider)DataProviderPluginFacade.GetDataProvider(ProviderName);\r\n\r\n            xmlDataProvider.BuildAllCode(builder);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/CodeGeneration/XmlProviderCodeGenerator.cs",
    "content": "﻿using System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    internal class XmlProviderCodeGenerator\r\n    {\r\n        private readonly DataTypeDescriptor _dataTypeDescriptor;\r\n\r\n        public string DataProviderHelperClassFullName { get; private set; }\r\n        public string WrapperClassFullName { get; private set; }\r\n        public string DataIdClassFullName { get; private set; }\r\n\r\n\r\n        public XmlProviderCodeGenerator(DataTypeDescriptor dataTypeDescriptor, string namespaceName)\r\n        {\r\n            _dataTypeDescriptor = dataTypeDescriptor;\r\n\r\n            DataProviderHelperClassFullName = namespaceName + \".\" + NamesCreator.MakeDataProviderHelperClassName(dataTypeDescriptor);\r\n            WrapperClassFullName = namespaceName + \".\" + NamesCreator.MakeWrapperClassName(dataTypeDescriptor);\r\n            DataIdClassFullName = namespaceName + \".\" + NamesCreator.MakeDataIdClassName(dataTypeDescriptor);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<CodeTypeDeclaration> CreateCodeDOMs()\r\n        {\r\n            string dataProviderHelperClassName = NamesCreator.MakeDataProviderHelperClassName(_dataTypeDescriptor);\r\n            string wrapperClassName = NamesCreator.MakeWrapperClassName(_dataTypeDescriptor);\r\n            string dataIdClassName = NamesCreator.MakeDataIdClassName(_dataTypeDescriptor);\r\n\r\n\r\n            DataProviderHelperClassGenerator classGenerator = new DataProviderHelperClassGenerator(\r\n                dataProviderHelperClassName,\r\n                wrapperClassName,\r\n                dataIdClassName,\r\n                _dataTypeDescriptor                \r\n            );\r\n            CodeTypeDeclaration dataHelperClassCodeTypeDeclaration = classGenerator.CreateClass();\r\n            yield return dataHelperClassCodeTypeDeclaration;\r\n\r\n\r\n            DataIdClassGenerator dataIdClassGenerator = new DataIdClassGenerator(dataIdClassName, _dataTypeDescriptor);\r\n            CodeTypeDeclaration dataIdClassCodeTypeDeclaration = dataIdClassGenerator.CreateClass();\r\n            yield return dataIdClassCodeTypeDeclaration;\r\n\r\n\r\n            DataWrapperClassGenerator dataWrapperClassGenerator = new DataWrapperClassGenerator(wrapperClassName, _dataTypeDescriptor);\r\n            CodeTypeDeclaration dataWrapperClassCodeTypeDeclaration = dataWrapperClassGenerator.CreateClass();\r\n            yield return dataWrapperClassCodeTypeDeclaration;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/FileRecord.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation\r\n{\r\n    internal class FileRecord\r\n    {\r\n        internal FileRecord()\r\n        {\r\n            _randomTempFileKey = Path.GetFileNameWithoutExtension(Path.GetRandomFileName());\r\n        }\r\n\r\n        private readonly string _randomTempFileKey;\r\n\r\n        public string FilePath;\r\n        public string ElementName;\r\n        public RecordSet RecordSet;\r\n        public ICollection<XElement> ReadOnlyElementsList;\r\n        public DateTime LastModified;\r\n        public DateTime FileModificationDate;\r\n        public CachedTable CachedTable;\r\n        public bool Dirty = false; // Determines whether the inner XElement list is dirty\r\n\r\n\r\n        public string TempFilePath\r\n        {\r\n            get\r\n            {\r\n                return string.Format(\"{0}.{1}.tmp\", FilePath, _randomTempFileKey);\r\n            }\r\n        }\r\n    }\r\n\r\n    internal class RecordSet\r\n    {\r\n        public Hashtable<IDataId, XElement> Index;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/InterfaceConfigurationManipulator.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.Common;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation\r\n{\r\n    internal static class InterfaceConfigurationManipulator\r\n    {\r\n        private static readonly string LogTitle = typeof(InterfaceConfigurationManipulator).Name;\r\n\r\n        /// <summary>\r\n        /// Create an invariant store\r\n        /// </summary>\r\n        /// <param name=\"providerName\"></param>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        public static void AddNew(string providerName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            var xmlDataProviderConfiguration = new XmlDataProviderConfiguration(providerName);\r\n\r\n            string interfaceType = dataTypeDescriptor.TypeManagerTypeName;\r\n\r\n            if (interfaceType != null)\r\n            {\r\n                object key = xmlDataProviderConfiguration.Section.Interfaces.GetKey(dataTypeDescriptor);\r\n\r\n                if (key != null)\r\n                {\r\n                    Log.LogWarning(LogTitle, \r\n                        \"Configuration file '{0}' already contains an interface type '{1} 'with id '{2}'. \"\r\n                        + \"Possibly there are multiple AppDomain-s running.\",\r\n                        xmlDataProviderConfiguration.ConfigurationFilePath, dataTypeDescriptor, dataTypeDescriptor.DataTypeId);\r\n                    return;\r\n                }\r\n            }\r\n\r\n            XmlProviderInterfaceConfigurationElement configurationElement = BuildXmlProviderInterfaceConfigurationElement(dataTypeDescriptor);\r\n\r\n            XmlDataProviderStoreManipulator.CreateStore(providerName, configurationElement);\r\n\r\n            xmlDataProviderConfiguration.Section.Interfaces.Add(configurationElement);\r\n\r\n            xmlDataProviderConfiguration.Save();\r\n        }\r\n\r\n\r\n\r\n        public static XmlProviderInterfaceConfigurationElement Change(UpdateDataTypeDescriptor updateDataTypeDescriptor)\r\n        {\r\n            DataTypeChangeDescriptor changeDescriptor = updateDataTypeDescriptor.CreateDataTypeChangeDescriptor();\r\n\r\n            var xmlDataProviderConfiguration = new XmlDataProviderConfiguration(updateDataTypeDescriptor.ProviderName);\r\n\r\n            object key = xmlDataProviderConfiguration.Section.Interfaces.GetKey(changeDescriptor.OriginalType);\r\n\r\n            var oldConfigurationElement = xmlDataProviderConfiguration.Section.Interfaces.Get(key);\r\n            var newConfigurationElement = BuildXmlProviderInterfaceConfigurationElement(changeDescriptor.AlteredType, oldConfigurationElement);\r\n\r\n            XmlDataProviderStoreManipulator.AlterStore(updateDataTypeDescriptor, oldConfigurationElement, newConfigurationElement);\r\n\r\n            xmlDataProviderConfiguration.Section.Interfaces.Remove(key);\r\n            xmlDataProviderConfiguration.Section.Interfaces.Add(newConfigurationElement);\r\n\r\n            xmlDataProviderConfiguration.Save();\r\n\r\n            return newConfigurationElement;\r\n        }\r\n\r\n\r\n\r\n        public static void Remove(string providerName, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            XmlDataProviderConfiguration xmlDataProviderConfiguration = new XmlDataProviderConfiguration(providerName);\r\n\r\n            object key = xmlDataProviderConfiguration.Section.Interfaces.GetKey(dataTypeDescriptor);\r\n\r\n            if (key != null)\r\n            {\r\n                XmlProviderInterfaceConfigurationElement element = xmlDataProviderConfiguration.Section.Interfaces.Get(key);\r\n\r\n                xmlDataProviderConfiguration.Section.Interfaces.Remove(key);\r\n                xmlDataProviderConfiguration.Save();\r\n\r\n                XmlDataProviderStoreManipulator.DropStore(providerName, element);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void AddLocale(string providerName, IEnumerable<Type> interfaceTypes, CultureInfo cultureInfo)\r\n        {\r\n            XmlDataProviderConfiguration xmlDataProviderConfiguration = new XmlDataProviderConfiguration(providerName);\r\n\r\n            foreach (Type type in interfaceTypes)\r\n            {\r\n                if (!DataLocalizationFacade.IsLocalized(type))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n\r\n                object key = xmlDataProviderConfiguration.Section.Interfaces.GetKey(dataTypeDescriptor);\r\n\r\n                var oldConfigurationElement = xmlDataProviderConfiguration.Section.Interfaces.Get(key);\r\n                var newConfigurationElement = BuildXmlProviderInterfaceConfigurationElement(dataTypeDescriptor, cultureInfo, null, oldConfigurationElement);\r\n\r\n                xmlDataProviderConfiguration.Section.Interfaces.Remove(key);\r\n                xmlDataProviderConfiguration.Section.Interfaces.Add(newConfigurationElement);\r\n\r\n                foreach (Dictionary<string, DataScopeConfigurationElement> filesByCulture in newConfigurationElement.DataScopes.Values)\r\n                {\r\n                    XmlDataProviderStoreManipulator.CreateStore(providerName, filesByCulture[cultureInfo.Name]);\r\n                }\r\n            }\r\n\r\n            xmlDataProviderConfiguration.Save();\r\n        }\r\n\r\n\r\n\r\n        public static void RemoveLocale(string providerName, IEnumerable<Type> interfaceTypes, CultureInfo cultureInfo)\r\n        {\r\n            XmlDataProviderConfiguration xmlDataProviderConfiguration = new XmlDataProviderConfiguration(providerName);\r\n\r\n            foreach (Type type in interfaceTypes)\r\n            {\r\n                if (DataLocalizationFacade.IsLocalizable(type))\r\n                {\r\n                    DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n\r\n                    object key = xmlDataProviderConfiguration.Section.Interfaces.GetKey(dataTypeDescriptor);\r\n\r\n                    bool configurationChanged = false;\r\n\r\n                    var oldConfigurationElement = xmlDataProviderConfiguration.Section.Interfaces.Get(key);\r\n                    foreach (Dictionary<string, DataScopeConfigurationElement> scopesByLanguage in oldConfigurationElement.DataScopes.Values)\r\n                    {\r\n                        if (scopesByLanguage.ContainsKey(cultureInfo.Name))\r\n                        {\r\n                            XmlDataProviderStoreManipulator.DropStore(providerName, scopesByLanguage[cultureInfo.Name]);\r\n                            configurationChanged = true;\r\n                        }\r\n                    }\r\n\r\n                    if (configurationChanged)\r\n                    {\r\n                        var newConfigurationElement = BuildXmlProviderInterfaceConfigurationElement(dataTypeDescriptor, null, cultureInfo, oldConfigurationElement);\r\n\r\n                        xmlDataProviderConfiguration.Section.Interfaces.Remove(key);\r\n                        xmlDataProviderConfiguration.Section.Interfaces.Add(newConfigurationElement);\r\n                    }\r\n                }\r\n            }\r\n\r\n            xmlDataProviderConfiguration.Save();\r\n        }\r\n\r\n\r\n\r\n        private static XmlProviderInterfaceConfigurationElement BuildXmlProviderInterfaceConfigurationElement(\r\n            DataTypeDescriptor dataTypeDescriptor,\r\n            XmlProviderInterfaceConfigurationElement existingElement = null)\r\n        {\r\n            return BuildXmlProviderInterfaceConfigurationElement(dataTypeDescriptor, null, null, existingElement);\r\n        }\r\n\r\n\r\n        private static XmlProviderInterfaceConfigurationElement BuildXmlProviderInterfaceConfigurationElement(\r\n            DataTypeDescriptor dataTypeDescriptor, \r\n            CultureInfo addedCultureInfo, \r\n            CultureInfo removedCultureInfo,\r\n            XmlProviderInterfaceConfigurationElement existingElement)\r\n        {\r\n            var configurationElement = new XmlProviderInterfaceConfigurationElement\r\n            {\r\n                DataTypeId = dataTypeDescriptor.DataTypeId,\r\n                IsGeneratedType = dataTypeDescriptor.IsCodeGenerated\r\n            };\r\n\r\n            bool isLocalized = dataTypeDescriptor.Localizeable;\r\n            foreach (DataScopeIdentifier dataScopeIdentifier in dataTypeDescriptor.DataScopes)\r\n            {\r\n                if (!isLocalized)\r\n                {\r\n                    configurationElement.ConfigurationStores.Add(new DataScopeConfigurationElement\r\n                    {\r\n                        DataScope = dataScopeIdentifier.Name,\r\n                        CultureName = CultureInfo.InvariantCulture.Name,\r\n                        Filename = NamesCreator.MakeFileName(dataTypeDescriptor, dataScopeIdentifier, CultureInfo.InvariantCulture.Name),\r\n                        ElementName = NamesCreator.MakeElementName(dataTypeDescriptor)\r\n                    });\r\n                }\r\n\r\n                if (isLocalized)\r\n                {\r\n                    List<string> localizationNames = DataLocalizationFacade.ActiveLocalizationNames.ToList();\r\n                    foreach (string cultureName in localizationNames)\r\n                    {\r\n                        if (removedCultureInfo != null && removedCultureInfo.Name == cultureName) continue;\r\n\r\n                        string existingFileName = null;\r\n                        string existingElementName = null;\r\n\r\n                        if (existingElement != null)\r\n                        {\r\n                            foreach (DataScopeConfigurationElement store in existingElement.ConfigurationStores)\r\n                            {\r\n                                if (store.DataScope == dataScopeIdentifier.Name && store.CultureName == cultureName)\r\n                                {\r\n                                    existingFileName = store.Filename;\r\n                                    existingElementName = store.ElementName;\r\n                                    break;\r\n                                }\r\n                            }\r\n                        }\r\n\r\n                        configurationElement.ConfigurationStores.Add(new DataScopeConfigurationElement\r\n                            {\r\n                                DataScope = dataScopeIdentifier.Name,\r\n                                CultureName = cultureName,\r\n                                Filename = existingFileName ?? NamesCreator.MakeFileName(dataTypeDescriptor, dataScopeIdentifier, cultureName),\r\n                                ElementName = existingElementName ?? NamesCreator.MakeElementName(dataTypeDescriptor)\r\n                            });\r\n                    }\r\n\r\n\r\n                    if (addedCultureInfo != null && !localizationNames.Contains(addedCultureInfo.Name))\r\n                    {\r\n                        configurationElement.ConfigurationStores.Add(new DataScopeConfigurationElement\r\n                        {\r\n                            DataScope = dataScopeIdentifier.Name,\r\n                            CultureName = addedCultureInfo.Name,\r\n                            Filename = NamesCreator.MakeFileName(dataTypeDescriptor, dataScopeIdentifier, addedCultureInfo.Name),\r\n                            ElementName = NamesCreator.MakeElementName(dataTypeDescriptor)\r\n                        });\r\n                    }\r\n                }\r\n            }\r\n\r\n            configurationElement.ConfigurationDataIdProperties = new SimpleNameTypeConfigurationElementCollection();\r\n            foreach (DataFieldDescriptor field in dataTypeDescriptor.PhysicalKeyFields)\r\n            {\r\n                configurationElement.ConfigurationDataIdProperties.Add(field.Name, field.InstanceType);\r\n            }\r\n\r\n            configurationElement.ConfigurationPropertyNameMappings = new PropertyNameMappingConfigurationElementCollection();\r\n            configurationElement.ConfigurationPropertyInitializers = new SimpleNameTypeConfigurationElementCollection();\r\n\r\n            return configurationElement;\r\n        }\r\n\r\n\r\n\r\n        private sealed class XmlDataProviderConfiguration\r\n        {\r\n            readonly string _configurationFilePath;\r\n            readonly C1Configuration _configuration;\r\n\r\n            public XmlDataProviderConfiguration(string providerName)\r\n            {\r\n                _configurationFilePath =\r\n                    Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.ConfigurationDirectory),\r\n                                 string.Format(\"{0}.config\", providerName));\r\n\r\n                _configuration = new C1Configuration(_configurationFilePath);\r\n\r\n                this.Section = _configuration.GetSection(XmlDataProviderConfigurationSection.SectionName) as XmlDataProviderConfigurationSection;\r\n\r\n                if (this.Section == null)\r\n                {\r\n                    this.Section = new XmlDataProviderConfigurationSection();\r\n                    _configuration.Sections.Add(XmlDataProviderConfigurationSection.SectionName, this.Section);\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public XmlDataProviderConfigurationSection Section\r\n            {\r\n                get;\r\n                private set;\r\n            }\r\n\r\n\r\n            public string ConfigurationFilePath\r\n            {\r\n                get { return _configurationFilePath; }\r\n            }\r\n\r\n\r\n            public void Save()\r\n            {\r\n                _configuration.Save();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/NamesCreator.cs",
    "content": "﻿using System;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation\r\n{\r\n    internal static class NamesCreator\r\n    {\r\n        internal static string MakeFileName(DataTypeDescriptor dataTypeDescriptor, DataScopeIdentifier dataScopeIdentifier, string cultureName)\r\n        {\r\n            string typeFullName = StringExtensionMethods.CreateNamespace(dataTypeDescriptor.Namespace, dataTypeDescriptor.Name, '.');\r\n\r\n            string publicationScopePart = \"\";\r\n\r\n            switch (dataScopeIdentifier.Name)\r\n            {\r\n                case DataScopeIdentifier.PublicName:\r\n                    break;\r\n                case DataScopeIdentifier.AdministratedName:\r\n                    publicationScopePart = \"_\" + PublicationScope.Unpublished;\r\n                    break;\r\n                default:\r\n                    throw new InvalidOperationException($\"Unsupported data scope identifier: '{dataScopeIdentifier.Name}'\");\r\n            }\r\n\r\n            string cultureNamePart = \"\";\r\n\r\n            if (cultureName != \"\")\r\n            {\r\n                cultureNamePart = \"_\" + cultureName;\r\n            }\r\n                \r\n            return typeFullName + publicationScopePart + cultureNamePart + \".xml\";\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeElementName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            string name = dataTypeDescriptor.Name;\r\n\r\n            if (name.StartsWith(\"I\"))\r\n            {\r\n                name = name.Remove(0, 1);\r\n                name = $\"{name.Substring(0, 1).ToUpper()}{name.Remove(0, 1)}Elements\";\r\n            }\r\n\r\n            return name;\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeWrapperClassName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return $\"{MakeNiceTypeFullName(dataTypeDescriptor)}Wrapper\";\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeDataIdClassName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return $\"{MakeNiceTypeFullName(dataTypeDescriptor)}DataId\";\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeDataProviderHelperClassName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return $\"{MakeNiceTypeFullName(dataTypeDescriptor)}DataProviderHelper\";\r\n        }\r\n\r\n\r\n\r\n        internal static string MakeNamespaceName(string providerName)\r\n        {\r\n            return \"CompositeGenerated.\" + providerName;\r\n        }\r\n\r\n        private static string MakeNiceTypeFullName(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            return dataTypeDescriptor.GetFullInterfaceName().Replace('.', '_').Replace('+', '_');\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/TransactionRollbackHandler.cs",
    "content": "﻿using System.Threading;\r\nusing System.Transactions;\r\nusing Composite.Core.Logging;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation\r\n{\r\n    internal class TransactionRollbackHandler : IEnlistmentNotification\r\n    {\r\n        private ThreadStart _onRollback;\r\n\r\n        public TransactionRollbackHandler(ThreadStart onRollback)\r\n        {\r\n            _onRollback = onRollback;\r\n        }\r\n\r\n        public void Commit(Enlistment enlistment)\r\n        {\r\n            enlistment.Done();\r\n        }\r\n\r\n\r\n        public void InDoubt(Enlistment enlistment)\r\n        {\r\n            enlistment.Done();\r\n        }\r\n\r\n\r\n        public void Prepare(PreparingEnlistment preparingEnlistment)\r\n        {\r\n            preparingEnlistment.Prepared();\r\n        }\r\n\r\n\r\n        public void Rollback(Enlistment enlistment)\r\n        {\r\n            _onRollback();\r\n\r\n            enlistment.Done();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/ValidationHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation\r\n{\r\n    internal static class ValidationHelper\r\n    {\r\n        private class ValidationInfo\r\n        {\r\n            public List<Pair<PropertyInfo, int>> MaxStringLengthByField;\r\n        }\r\n\r\n        private static readonly Cache<Type, ValidationInfo> _validationInfoCache = new Cache<Type, ValidationInfo>(\"XmlDataProvider.ValidationInfo\", 200);\r\n        private static readonly object[] EmptyParameterList = new object[0];\r\n\r\n        public static void Validate(IData datum)\r\n        {\r\n            Type type = datum.DataSourceId.InterfaceType;\r\n\r\n            ValidationInfo info = _validationInfoCache.Get(type);\r\n            if(info == null)\r\n            {\r\n                lock(_validationInfoCache)\r\n                {\r\n                    info = _validationInfoCache.Get(type);\r\n                    if(info == null)\r\n                    {\r\n                        info = new ValidationInfo { MaxStringLengthByField = new List<Pair<PropertyInfo, int>>() };\r\n\r\n                        foreach(PropertyInfo propertyInfo in type.GetProperties())\r\n                        {\r\n                            if(propertyInfo.PropertyType != typeof(string)) continue;\r\n\r\n                            object[] attributes = propertyInfo.GetCustomAttributes(typeof(StoreFieldTypeAttribute), false);\r\n                            if(attributes.Length > 1)\r\n                            {\r\n                                LoggingService.LogError(typeof(ValidationHelper).Name, \"Encoutered more than one '{0}' attrubute\".FormatWith(typeof(StoreFieldTypeAttribute).FullName));\r\n                                continue;\r\n                            }\r\n\r\n                            if (attributes.Length == 0) continue;\r\n\r\n\r\n                            var storeFieldTypeAttr = attributes[0] as StoreFieldTypeAttribute;\r\n                            StoreFieldType storeFieldType = storeFieldTypeAttr.StoreFieldType;\r\n\r\n                            if (storeFieldType.IsLargeString || !storeFieldType.IsString) \r\n                            {\r\n                                continue;\r\n                            }\r\n\r\n                            info.MaxStringLengthByField.Add(new Pair<PropertyInfo, int>(propertyInfo, storeFieldType.MaximumLength));\r\n                        }\r\n\r\n                        _validationInfoCache.Add(type, info);\r\n                    }\r\n                }\r\n            }\r\n\r\n            foreach(Pair<PropertyInfo, int> pair in info.MaxStringLengthByField)\r\n            {\r\n                string fieldValue = pair.First.GetValue(datum, EmptyParameterList) as string;\r\n                if (fieldValue != null && fieldValue.Length > pair.Second)\r\n                {\r\n                    Verify.ThrowInvalidOperationException(\"Constraint violation. Value for field '{0}' on data type '{1}' is longer than {2} symbols.\".FormatWith(pair.First.Name, type.FullName, pair.Second));\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/XmlDataProviderDocumentCache.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Streams;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation\r\n{\r\n    internal static class XmlDataProviderDocumentCache\r\n    {\r\n        private static readonly string LogTitle = \"XmlDataProvider\";\r\n\r\n        private static readonly Hashtable<string, FileRecord> _cache = new Hashtable<string, FileRecord>();\r\n        private static HashSet<string> _watchedFiles = new HashSet<string>();\r\n        private static readonly object _cacheSyncRoot = new object();\r\n        private static readonly object _documentEditingSyncRoot = new object();\r\n        private static readonly List<KeyValuePair<string, Action>> _externalFileChangeActions = new List<KeyValuePair<string, Action>>();\r\n\r\n        static XmlDataProviderDocumentCache()\r\n        {\r\n            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Register an action that will be invoked on external file changes (new file copied in or file edited by external process).\r\n        /// On Flush system event registrations are cleared and you should reregister.\r\n        /// </summary>\r\n        /// <param name=\"filename\">File path</param>\r\n        /// <param name=\"action\">Action to execute on external changes</param>\r\n        internal static void RegisterExternalFileChangeAction(string filename, Action action)\r\n        {\r\n            string key = filename.ToLowerInvariant();\r\n\r\n            _externalFileChangeActions.Add(new KeyValuePair<string, Action>(key, action));\r\n        }\r\n\r\n\r\n        public static object SyncRoot => _documentEditingSyncRoot;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is what we want, handle broken saves\")]\r\n        public static FileRecord GetFileRecord(string filePath, string elementName, Func<XElement, IDataId> keyGetter)\r\n        {\r\n            string cacheKey = filePath.ToLowerInvariant();\r\n\r\n            FileRecord cachedData = _cache[cacheKey];\r\n\r\n            if (cachedData == null)\r\n            {\r\n                lock (_cacheSyncRoot)\r\n                {\r\n                    cachedData = _cache[cacheKey];\r\n\r\n                    if (cachedData == null)\r\n                    {\r\n                        cachedData = LoadFileRecordFromDisk(filePath, elementName, keyGetter);\r\n\r\n                        EnsureFileChangesSubscription(filePath);\r\n\r\n                        _cache.Add(cacheKey, cachedData);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return cachedData;\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<XElement> GetElements(string filePath, string elementName, IXmlDataProviderHelper helper)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(filePath, \"filename\");\r\n            Verify.ArgumentNotNullOrEmpty(elementName, \"elementName\");\r\n\r\n            return GetFileRecord(filePath, elementName, helper.CreateDataId).ReadOnlyElementsList;\r\n        }\r\n\r\n\r\n\r\n        public static void SaveChanges()\r\n        {\r\n            lock (_cacheSyncRoot)\r\n            {\r\n                var dirtyRecords = _cache.GetValues().Where(f => f.Dirty);\r\n                if (!dirtyRecords.Any()) return;\r\n\r\n                foreach (FileRecord record in dirtyRecords)\r\n                {\r\n                    SaveChanges(record);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void ClearCache()\r\n        {\r\n            XmlDataProviderDocumentWriter.Flush();\r\n            _cache.Clear();\r\n        }\r\n\r\n\r\n\r\n        public static IDisposable CreateEditingContext()\r\n        {\r\n            return new EditingContext();\r\n        }\r\n\r\n\r\n\r\n        private static List<XElement> ExtractElements(XDocument xDocument)\r\n        {\r\n            IEnumerable<XElement> elements = xDocument.Root.Elements();\r\n\r\n            var result = new List<XElement>(elements.Count());\r\n            result.AddRange(elements);\r\n\r\n            xDocument.Root.RemoveNodes();\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static void SaveChanges(FileRecord fileRecord)\r\n        {\r\n            fileRecord.LastModified = DateTime.Now;\r\n            fileRecord.ReadOnlyElementsList = fileRecord.RecordSet.Index.GetValues();\r\n            fileRecord.CachedTable = null;\r\n            fileRecord.Dirty = false;\r\n\r\n            XmlDataProviderDocumentWriter.Save(fileRecord);\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Fetches a list of files that contain data - both the stable file and tmp files.\r\n        /// List is ordered with newest files first.\r\n        /// </summary>\r\n        /// <param name=\"filePath\"></param>\r\n        /// <returns></returns>\r\n        private static IList<C1FileInfo> GetCandidateFiles(string filePath)\r\n        {\r\n            var files = new List<C1FileInfo>();\r\n            if (C1File.Exists(filePath))\r\n            {\r\n                files.Add(new C1FileInfo(filePath));\r\n            }\r\n\r\n            var tmpFilePaths = C1Directory.GetFiles(\r\n                Path.GetDirectoryName(filePath), \r\n                $\"{Path.GetFileName(filePath)}.*.tmp\");\r\n\r\n            foreach (string tmpFilePath in tmpFilePaths)\r\n            {\r\n                files.Add(new C1FileInfo(tmpFilePath));\r\n            }\r\n\r\n            return files.OrderByDescending(f => f.LastWriteTime).ToList();\r\n        }\r\n\r\n\r\n\r\n        private static void OnFlushEvent(FlushEventArgs args)\r\n        {\r\n            _externalFileChangeActions.Clear();\r\n        }\r\n\r\n\r\n\r\n        private static void EnsureFileChangesSubscription(string filePath)\r\n        {\r\n            filePath = filePath.ToLowerInvariant();\r\n\r\n            if (_watchedFiles.Contains(filePath))\r\n            {\r\n                return;\r\n            }\r\n\r\n            lock (_cacheSyncRoot)\r\n            {\r\n                if (_watchedFiles.Contains(filePath))\r\n                {\r\n                    return;\r\n                }\r\n\r\n                _watchedFiles.Add(filePath);\r\n\r\n                FileChangeNotificator.Subscribe(filePath, OnFileExternallyChanged);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnFileExternallyChanged(string filePath, FileChangeType changeType)\r\n        {\r\n            filePath = filePath.ToLowerInvariant();\r\n\r\n            var fileRecord = _cache[filePath];\r\n\r\n            if (fileRecord == null\r\n                || fileRecord.FileModificationDate == DateTime.MinValue\r\n                || C1File.GetLastWriteTime(filePath) == fileRecord.FileModificationDate)\r\n            {\r\n                // Ignoring this notification since it's very very probably caused by XmlDataProvider itself\r\n                return;\r\n            }\r\n\r\n            lock (_documentEditingSyncRoot)\r\n            {\r\n                lock (_cacheSyncRoot)\r\n                {\r\n                    fileRecord = _cache[filePath];\r\n\r\n                    if (fileRecord == null\r\n                        || fileRecord.FileModificationDate == DateTime.MinValue\r\n                        || C1File.GetLastWriteTime(filePath) == fileRecord.FileModificationDate)\r\n                    {\r\n                        // Ignoring this notification since it's very very probably caused by XmlDataProvider itself\r\n                        return;\r\n                    }\r\n\r\n                    _cache.Remove(filePath);\r\n\r\n                    Log.LogVerbose(LogTitle, \"File '{0}' changed by another process. Flushing cache.\", filePath);\r\n\r\n                    if (_externalFileChangeActions.Any(f => f.Key == filePath))\r\n                    {\r\n                        var actions = _externalFileChangeActions.Where(f => f.Key == filePath).Select(f => f.Value).ToList();\r\n                        foreach (var action in actions)\r\n                        {\r\n                            action.Invoke();\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        Log.LogWarning(LogTitle, \"File '{0}' has not been related to a scope - unable to raise store change event\", filePath);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Will pull up most recent from disk - if no good file is found an empty store will be constructed anyway\r\n        /// </summary>\r\n        /// <param name=\"filePath\"></param>\r\n        /// <param name=\"elementName\"></param>\r\n        /// <param name=\"keyGetter\"></param>\r\n        /// <returns></returns>\r\n        private static FileRecord LoadFileRecordFromDisk(string filePath, string elementName, Func<XElement, IDataId> keyGetter)\r\n        {\r\n            XDocument dataDocument = null;\r\n            C1FileInfo usedFile = null;\r\n\r\n            IList<C1FileInfo> candidateFiles = GetCandidateFiles(filePath);\r\n\r\n            string errorCause = \"\";\r\n\r\n            foreach (C1FileInfo candidateFile in candidateFiles)\r\n            {\r\n                bool tryLoad = true;\r\n                bool retriedLoad = false;\r\n\r\n                while (tryLoad && dataDocument == null)\r\n                {\r\n                    dataDocument = TryLoad(candidateFile, ref errorCause);\r\n\r\n                    if (dataDocument == null)\r\n                    {\r\n                        if (retriedLoad && (DateTime.Now - candidateFile.LastWriteTime).TotalSeconds > 30)\r\n                        {\r\n                            tryLoad = false; \r\n                        }\r\n                        else\r\n                        {\r\n                            Thread.Sleep(250); // other processes/servers may be writing to this file at the moment. Patience young padawan!\r\n                        }\r\n                        retriedLoad = true;\r\n                    }\r\n                }\r\n\r\n                if (dataDocument != null)\r\n                {\r\n                    usedFile = candidateFile;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            if (dataDocument == null)\r\n            {\r\n                dataDocument = new XDocument(new XElement(\"fallback\"));\r\n                Log.LogWarning(LogTitle, \"Did not find a healthy XML document for '{0}' - creating an empty store. {1}\", filePath, errorCause);\r\n            }\r\n\r\n            List<XElement> elements = ExtractElements(dataDocument);\r\n\r\n            var index = new Hashtable<IDataId, XElement>(elements.Count);\r\n            foreach (var element in elements)\r\n            {\r\n                IDataId id = keyGetter(element);\r\n                if (!index.ContainsKey(id))\r\n                {\r\n                    index.Add(id, element);\r\n                }\r\n                else\r\n                {\r\n                    Log.LogWarning(LogTitle, \"Found multiple elements in '{0}' sharing same key - duplicates ignored.\", filePath);\r\n                }\r\n            }\r\n\r\n            if (usedFile != null)\r\n            {\r\n                // clean up old and unused files\r\n                foreach (C1FileInfo file in candidateFiles.Where(f => f.LastWriteTime < usedFile.LastWriteTime))\r\n                {\r\n                    try\r\n                    {\r\n                        C1File.Move(file.FullName, file.FullName + \".ghost\");\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        Log.LogWarning(LogTitle, $\"Failed to clean up ghost file '{filePath}'.\");\r\n                    }\r\n                }\r\n            }\r\n\r\n            DateTime lastModifiedFileDate = usedFile?.LastWriteTime ?? DateTime.Now;\r\n\r\n            return new FileRecord\r\n            {\r\n                FilePath = filePath,\r\n                ElementName = elementName,\r\n                RecordSet = new RecordSet { Index = index },\r\n                ReadOnlyElementsList = elements,\r\n                LastModified = DateTime.Now,\r\n                FileModificationDate = lastModifiedFileDate\r\n            };\r\n        }\r\n\r\n\r\n\r\n        private static XDocument TryLoad(C1FileInfo candidateFile, ref string errorCause)\r\n        {\r\n            XDocument dataDocument = null;\r\n            try\r\n            {\r\n                var xmlReaderSettings = new XmlReaderSettings { CheckCharacters = false };\r\n\r\n                using (XmlReader xmlReader = XmlReaderUtils.Create(candidateFile.FullName, xmlReaderSettings))\r\n                {\r\n                    dataDocument = XDocument.Load(xmlReader);\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                errorCause = ex.Message;\r\n                // broken file - should not stop us...\r\n            }\r\n\r\n            return dataDocument;\r\n        }\r\n\r\n\r\n\r\n        private class EditingContext : IDisposable\r\n        {\r\n            private readonly bool _entered;\r\n\r\n            public EditingContext()\r\n            {\r\n                Monitor.Enter(SyncRoot, ref _entered);\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                if (_entered)\r\n                {\r\n                    Monitor.Exit(SyncRoot);\r\n                }\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~EditingContext()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/XmlDataProviderDocumentWriter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing System.IO;\r\nusing System.Threading;\r\nusing System.Xml;\r\nusing Composite.C1Console.Events;\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation\r\n{\r\n    internal static class XmlDataProviderDocumentWriter\r\n    {\r\n        private static readonly ConcurrentQueue<FileRecord> _dirtyRecords = new ConcurrentQueue<FileRecord>();\r\n        private static readonly Dictionary<string, Func<IEnumerable<XElement>, IOrderedEnumerable<XElement>>> _fileOrderers = new Dictionary<string, Func<IEnumerable<XElement>, IOrderedEnumerable<XElement>>>();\r\n        private static readonly object _flushEnterLock = new object();\r\n        private static readonly object _flushExecuteLock = new object();\r\n        private static DateTime _activeFlushActivityStart = DateTime.MinValue;\r\n        private static readonly System.Timers.Timer _autoCommitTimer;\r\n\r\n        private static readonly TimeSpan _updateFrequency = TimeSpan.FromMilliseconds(1000);\r\n        private static readonly TimeSpan _fileIoDelay = TimeSpan.FromMilliseconds(10); // small pause between io operations to reduce asp.net appPool recycles due to FileWatcher buffer fills - edge case, but highly annoying\r\n        private const int NumberOfRetries = 30;\r\n        private static readonly string LogTitle = nameof(XmlDataProvider);\r\n        private static bool _forceImmediateWrite;\r\n\r\n\r\n        static XmlDataProviderDocumentWriter()\r\n        {\r\n            _autoCommitTimer = new System.Timers.Timer(_updateFrequency.TotalMilliseconds)\r\n            {\r\n                AutoReset = true\r\n            };\r\n            _autoCommitTimer.Elapsed += OnAutoCommitTimer;\r\n            _autoCommitTimer.Start();\r\n\r\n            GlobalEventSystemFacade.SubscribeToShutDownEvent(OnShutDownEvent);\r\n        }\r\n\r\n\r\n        private static void OnShutDownEvent(ShutDownEventArgs args)\r\n        {\r\n            _forceImmediateWrite = true;\r\n            Flush();\r\n        }\r\n\r\n\r\n        internal static void Save(FileRecord fileRecord)\r\n        {\r\n            _dirtyRecords.Enqueue(fileRecord);\r\n\r\n            if (_forceImmediateWrite)\r\n            {\r\n                Flush();\r\n            }\r\n        }\r\n\r\n\r\n        internal static void RegisterFileOrderer(string filename, Func<IEnumerable<XElement>, IOrderedEnumerable<XElement>> orderer)\r\n        {\r\n            string key = filename.ToLowerInvariant();\r\n\r\n            if (_fileOrderers.ContainsKey(key))\r\n            {\r\n                _fileOrderers.Remove(key);\r\n            }\r\n\r\n            _fileOrderers.Add(key, orderer);\r\n        }\r\n\r\n\r\n        private static bool TryGetFileOrderer(out Func<IEnumerable<XElement>, IOrderedEnumerable<XElement>> orderer, string filename)\r\n        {\r\n            string key = filename.ToLowerInvariant();\r\n\r\n            if (_fileOrderers.ContainsKey(key))\r\n            {\r\n                orderer = _fileOrderers[key];\r\n                return true;\r\n            }\r\n\r\n            orderer = null;\r\n            return false;\r\n        }\r\n\r\n\r\n        internal static void Flush()\r\n        {\r\n            lock (_flushEnterLock)\r\n            {\r\n                if (!_forceImmediateWrite && (DateTime.Now - _activeFlushActivityStart).TotalSeconds < 30)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                _activeFlushActivityStart = DateTime.Now;\r\n            }\r\n\r\n            FileRecord dirtyFileRecord;\r\n            List<FileRecord> fileRecords = new List<FileRecord>();\r\n\r\n            lock (_flushExecuteLock)\r\n            {\r\n                while (_dirtyRecords.TryDequeue(out dirtyFileRecord))\r\n                {\r\n                    if (!fileRecords.Any(f => f.FilePath == dirtyFileRecord.FilePath))\r\n                    {\r\n                        fileRecords.Add(dirtyFileRecord);\r\n                    }\r\n                }\r\n\r\n                foreach (var fileRecord in fileRecords)\r\n                {\r\n                    try\r\n                    {\r\n                        DoSave(fileRecord);\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        if (ex is DirectoryNotFoundException)\r\n                        {\r\n                            Log.LogWarning(LogTitle, $\"Failed to save file '{fileRecord.FilePath}' as the underlying directory does not exist.\");\r\n                            continue;\r\n                        }\r\n\r\n                        Log.LogCritical(LogTitle, $\"Failed to save data to the file: '{fileRecord.FilePath}'\");\r\n                        Log.LogError(LogTitle, ex);\r\n\r\n                        _dirtyRecords.Enqueue(fileRecord);\r\n                    }\r\n                }\r\n            }\r\n\r\n            _activeFlushActivityStart = DateTime.MinValue;\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is what we want, to handle broken saves\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotCallXmlWriterCreateWithPath:DoNotCallXmlWriterCreateWithPath\", Justification = \"This is what we want, to handle broken saves\")]\r\n        private static void DoSave(FileRecord fileRecord)\r\n        {\r\n            var root = new XElement(GetRootElementName(fileRecord.ElementName));\r\n            var xDocument = new XDocument(root);\r\n\r\n            var recordSet = fileRecord.RecordSet;\r\n            var elements = new List<XElement>(recordSet.Index.GetValues());\r\n\r\n            Func<IEnumerable<XElement>, IOrderedEnumerable<XElement>> orderer;\r\n            if (TryGetFileOrderer(out orderer, fileRecord.FilePath))\r\n            {\r\n                var orderedElements = orderer(elements);\r\n\r\n                orderedElements.ForEach(root.Add);\r\n            }\r\n            else\r\n            {\r\n                elements.ForEach(root.Add);\r\n            }\r\n\r\n            Exception thrownException = null;\r\n\r\n            // Writing the file in the \"catch\" block in order to prevent chance of corrupting the file by experiencing ThreadAbortException.\r\n            try\r\n            {\r\n            }\r\n            finally\r\n            {\r\n                try\r\n                {\r\n                    // Saving to temp file and file move to prevent broken saves\r\n                    var xmlWriterSettings = new XmlWriterSettings\r\n                    {\r\n                        CheckCharacters = false,\r\n                        Indent = true\r\n                    };\r\n\r\n                    using (XmlWriter xmlWriter = XmlWriter.Create(fileRecord.TempFilePath, xmlWriterSettings))\r\n                    {\r\n                        xDocument.Save(xmlWriter);\r\n                    }\r\n                    Thread.Sleep(_fileIoDelay);\r\n\r\n                    bool failed = true;\r\n                    Exception lastException = null;\r\n                    for (int i = 0; i < NumberOfRetries; i++)\r\n                    {\r\n                        DateTime lastSuccessfulFileChange = fileRecord.FileModificationDate; \r\n                        try\r\n                        {\r\n\r\n                            fileRecord.FileModificationDate = DateTime.MinValue;\r\n                            File.Copy(fileRecord.TempFilePath, fileRecord.FilePath, true);\r\n                            failed = false;\r\n                            break;\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            fileRecord.FileModificationDate = lastSuccessfulFileChange;\r\n                            lastException = ex;\r\n                            Thread.Sleep(10 * (i + 1));\r\n                        }\r\n                    }\r\n\r\n                    if (!failed)\r\n                    {\r\n                        Thread.Sleep(_fileIoDelay);\r\n                        File.Delete(fileRecord.TempFilePath);\r\n                    }\r\n                    else\r\n                    {\r\n                        Log.LogCritical(LogTitle, \"Failed deleting the file: \" + fileRecord.FilePath);\r\n                        if (lastException != null) throw lastException;\r\n\r\n                        throw new InvalidOperationException(\"Failed to delete a file, this code shouldn't be reachable\");\r\n                    }\r\n\r\n                    fileRecord.FileModificationDate = C1File.GetLastWriteTime(fileRecord.FilePath);\r\n                }\r\n                catch (Exception exception)\r\n                {\r\n                    thrownException = exception;\r\n                }\r\n            }\r\n            // ThreadAbortException should have a higher priority, and therefore we're doing rethrow in a separate block\r\n            if (thrownException != null) throw thrownException;\r\n        }\r\n\r\n        internal static string GetRootElementName(string elementName)\r\n        {\r\n            return elementName + \"Elements\";\r\n        }\r\n\r\n\r\n        private static void OnAutoCommitTimer(object sender, System.Timers.ElapsedEventArgs e)\r\n        {\r\n            Flush();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/XmlDataProviderStoreManipulator.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation\r\n{\r\n    internal static class XmlDataProviderStoreManipulator\r\n    {\r\n        public static void CreateStore(string providerName, XmlProviderInterfaceConfigurationElement configurationElement)\r\n        {\r\n            foreach (DataScopeConfigurationElement scopeElement in configurationElement.ConfigurationStores)\r\n            {\r\n                CreateStore(providerName, scopeElement);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static void AlterStore(UpdateDataTypeDescriptor updateDescriptor, XmlProviderInterfaceConfigurationElement oldConfigurationElement, XmlProviderInterfaceConfigurationElement newConfigurationElement)\r\n        {\r\n            DataTypeChangeDescriptor dataTypeChangeDescriptor = updateDescriptor.CreateDataTypeChangeDescriptor();\r\n\r\n            foreach (KeyValuePair<string, Type> kvp in oldConfigurationElement.PropertyInitializers)\r\n            {\r\n                newConfigurationElement.AddPropertyInitializer(kvp.Key, kvp.Value);\r\n            }\r\n\r\n            Dictionary<string, object> newFieldValues = new Dictionary<string, object>();\r\n\r\n            foreach (DataScopeIdentifier scopeIdentifier in dataTypeChangeDescriptor.AddedDataScopes)\r\n            {\r\n                foreach (DataScopeConfigurationElement dataScopeConfigurationElement in newConfigurationElement.DataScopes[scopeIdentifier.Name].Values)\r\n                {\r\n                    CreateStore(updateDescriptor.ProviderName, dataScopeConfigurationElement);\r\n                }\r\n            }\r\n           \r\n\r\n\r\n            foreach (DataScopeIdentifier scopeIdentifier in dataTypeChangeDescriptor.ExistingDataScopes)\r\n            {\r\n                foreach (KeyValuePair<string, DataScopeConfigurationElement> fileForLanguage in oldConfigurationElement.DataScopes[scopeIdentifier.Name])\r\n                {\r\n                    string cultureName = fileForLanguage.Key;\r\n\r\n                    if (!newConfigurationElement.DataScopes[scopeIdentifier.Name].ContainsKey(cultureName))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    var oldDataScopeConfigurationElement = fileForLanguage.Value;\r\n                    var newDataScopeConfigurationElement = newConfigurationElement.DataScopes[scopeIdentifier.Name][cultureName];\r\n\r\n                    newFieldValues = new Dictionary<string, object>\r\n                    {\r\n                        {\"PublicationStatus\", GenericPublishProcessController.Published}\r\n                    };\r\n\r\n                    CopyData(updateDescriptor.ProviderName, dataTypeChangeDescriptor, oldDataScopeConfigurationElement, newDataScopeConfigurationElement, newFieldValues);\r\n                }\r\n            }\r\n\r\n\r\n            if (updateDescriptor.PublicationAdded)\r\n            {\r\n                foreach (var fileByLanguage in oldConfigurationElement.DataScopes[DataScopeIdentifier.PublicName])\r\n                {\r\n                    var oldDataScopeConfigurationElement = fileByLanguage.Value;\r\n                    var newDataScopeConfigurationElement = newConfigurationElement.DataScopes[DataScopeIdentifier.AdministratedName][fileByLanguage.Key];\r\n\r\n                    newFieldValues = new Dictionary<string, object>\r\n                    {\r\n                        {\"PublicationStatus\", GenericPublishProcessController.Published}\r\n                    };\r\n\r\n                    CopyData(updateDescriptor.ProviderName, dataTypeChangeDescriptor, oldDataScopeConfigurationElement, newDataScopeConfigurationElement, newFieldValues, false);\r\n                }\r\n            }\r\n\r\n            if (updateDescriptor.PublicationRemoved)\r\n            {\r\n                foreach (var fileByLanguage in oldConfigurationElement.DataScopes[DataScopeIdentifier.AdministratedName])\r\n                {\r\n                    var oldDataScopeConfigurationElement = fileByLanguage.Value;\r\n                    var newDataScopeConfigurationElement = newConfigurationElement.DataScopes[DataScopeIdentifier.PublicName][fileByLanguage.Key];\r\n\r\n                    CopyData(updateDescriptor.ProviderName, dataTypeChangeDescriptor, oldDataScopeConfigurationElement, newDataScopeConfigurationElement, newFieldValues, false);\r\n                }\r\n            }\r\n\r\n\r\n            bool oldTypeLocalized = updateDescriptor.OldDataTypeDescriptor.Localizeable;\r\n            bool newTypeLocalized = updateDescriptor.NewDataTypeDescriptor.Localizeable;\r\n\r\n            if (!oldTypeLocalized && newTypeLocalized)\r\n            {\r\n                foreach (var newStore in newConfigurationElement.DataScopes.Values.SelectMany(kvp => kvp.Values))\r\n                {\r\n                    CreateStore(updateDescriptor.ProviderName, newStore);\r\n                }\r\n\r\n                foreach (string dataScopeIdentifier in oldConfigurationElement.DataScopes.Keys)\r\n                {\r\n                    var oldFilesByCulture = oldConfigurationElement.DataScopes[dataScopeIdentifier];\r\n\r\n                    string invariantCultureKey = \"\";\r\n\r\n                    if (oldFilesByCulture.ContainsKey(invariantCultureKey))\r\n                    {\r\n                        var oldDataScopeConfigurationElement = oldFilesByCulture[invariantCultureKey];\r\n\r\n                        if (updateDescriptor.LocalesToCopyTo != null)\r\n                        {\r\n                            foreach (CultureInfo locale in updateDescriptor.LocalesToCopyTo)\r\n                            {\r\n                                var newDataScopeConfigurationElement = newConfigurationElement.DataScopes[dataScopeIdentifier][locale.Name];\r\n\r\n                                var nfv = new Dictionary<string, object>(newFieldValues)\r\n                                {\r\n                                    {\"SourceCultureName\", locale.Name}\r\n                                };\r\n\r\n                                CopyData(updateDescriptor.ProviderName, dataTypeChangeDescriptor, oldDataScopeConfigurationElement, newDataScopeConfigurationElement, nfv, false);\r\n                            }\r\n                        }\r\n\r\n                        DropStore(updateDescriptor.ProviderName, oldDataScopeConfigurationElement);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (oldTypeLocalized && !newTypeLocalized)\r\n            {\r\n                foreach (var newStore in newConfigurationElement.DataScopes.Values.SelectMany(kvp => kvp.Values))\r\n                {\r\n                    CreateStore(updateDescriptor.ProviderName, newStore);\r\n                }\r\n\r\n                if (updateDescriptor.LocaleToCopyFrom != null)\r\n                {\r\n                    foreach (string dataScopeIdentifier in oldConfigurationElement.DataScopes.Keys)\r\n                    {\r\n                        var oldDataScopeConfigurationElement = oldConfigurationElement.DataScopes[dataScopeIdentifier][updateDescriptor.LocaleToCopyFrom.Name];\r\n                        var newDataScopeConfigurationElement = newConfigurationElement.DataScopes[dataScopeIdentifier][\"\"];\r\n\r\n                        CopyData(updateDescriptor.ProviderName, dataTypeChangeDescriptor, oldDataScopeConfigurationElement, newDataScopeConfigurationElement, newFieldValues, false);\r\n                    }\r\n                }\r\n\r\n                foreach (var oldStore in oldConfigurationElement.DataScopes.SelectMany(d => d.Value).Where(f => f.Key != \"\").Select(f => f.Value))\r\n                {\r\n                    DropStore(updateDescriptor.ProviderName, oldStore);\r\n                }\r\n            }\r\n\r\n            foreach (DataScopeIdentifier scopeIdentifier in dataTypeChangeDescriptor.DeletedDataScopes)\r\n            {\r\n                foreach (DataScopeConfigurationElement dataScopeConfigurationElement in oldConfigurationElement.DataScopes[scopeIdentifier.Name].Values)\r\n                {\r\n                    DropStore(updateDescriptor.ProviderName, dataScopeConfigurationElement);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void CopyData(string providerName, DataTypeChangeDescriptor dataTypeChangeDescriptor, DataScopeConfigurationElement oldDataScopeConfigurationElement, DataScopeConfigurationElement newDataScopeConfigurationElement, Dictionary<string, object> newFieldValues, bool deleteOldFile = true)\r\n        {\r\n            string oldFilename = ResolvePath(oldDataScopeConfigurationElement.Filename, providerName);\r\n            string newFilename = ResolvePath(newDataScopeConfigurationElement.Filename, providerName);\r\n\r\n            XDocument oldDocument = XDocumentUtils.Load(PathUtil.Resolve(oldFilename));\r\n\r\n            List<XElement> newElements = new List<XElement>();\r\n\r\n            bool addingVersionId = dataTypeChangeDescriptor.AddedFields.Any(f => f.Name == nameof(IVersioned.VersionId))\r\n                                   && dataTypeChangeDescriptor.AlteredType.SuperInterfaces.Any(s => s == typeof (IVersioned));\r\n\r\n            string versionIdSourceFieldName = null;\r\n            if (addingVersionId)\r\n            {\r\n                if (dataTypeChangeDescriptor.AlteredType.DataTypeId == typeof(IPage).GetImmutableTypeId())\r\n                {\r\n                    versionIdSourceFieldName = nameof(IPage.Id);\r\n                }\r\n                else\r\n                {\r\n                    versionIdSourceFieldName = dataTypeChangeDescriptor.AlteredType.Fields\r\n                        .Where(f => f.InstanceType == typeof(Guid)\r\n                                    && (f.ForeignKeyReferenceTypeName?.Contains(typeof(IPage).FullName) ?? false))\r\n                        .OrderByDescending(f => f.Name == nameof(IPageData.PageId))\r\n                        .Select(f => f.Name)\r\n                        .FirstOrDefault();\r\n                }\r\n            }\r\n\r\n\r\n            foreach (XElement oldElement in oldDocument.Root.Elements())\r\n            {\r\n                List<XAttribute> newChildAttributes = new List<XAttribute>();\r\n\r\n                foreach (XAttribute oldChildAttribute in oldElement.Attributes())\r\n                {\r\n                    var existingFieldInfo = GetExistingFieldInfo(dataTypeChangeDescriptor, oldChildAttribute.Name.LocalName);\r\n\r\n                    if (existingFieldInfo != null)\r\n                    {\r\n                        if (existingFieldInfo.OriginalField.Name != existingFieldInfo.AlteredField.Name)\r\n                        {\r\n                            XAttribute newChildAttribute = new XAttribute(existingFieldInfo.AlteredField.Name, oldChildAttribute.Value);\r\n\r\n                            newChildAttributes.Add(newChildAttribute);\r\n                        }\r\n                        else\r\n                        {\r\n                            newChildAttributes.Add(oldChildAttribute);\r\n                        }\r\n                    }\r\n                    // It may happen that some data were added before data descriptors are updated, in the case of using \r\n                    // [AutoUpdateable] attribute. \r\n                    else if (dataTypeChangeDescriptor.AddedFields.Any(addedField => addedField.Name == oldChildAttribute.Name))\r\n                    {\r\n                        newChildAttributes.Add(oldChildAttribute);\r\n                    }\r\n                }\r\n\r\n                // Adding default value for fields that are NULL and become required\r\n                foreach (var existingFieldInfo in dataTypeChangeDescriptor.ExistingFields)\r\n                {\r\n                    bool fieldBecomeRequired = existingFieldInfo.OriginalField.IsNullable && !existingFieldInfo.AlteredField.IsNullable;\r\n\r\n                    string fieldName = existingFieldInfo.AlteredField.Name;\r\n\r\n                    if (fieldBecomeRequired && !newChildAttributes.Any(attr => attr.Name.LocalName == fieldName))\r\n                    {\r\n                        newChildAttributes.Add(new XAttribute(fieldName, GetDefaultValue(existingFieldInfo.AlteredField)));\r\n                    }\r\n                }\r\n\r\n                foreach (DataFieldDescriptor fieldDescriptor in dataTypeChangeDescriptor.AddedFields)\r\n                {\r\n                    if (addingVersionId && fieldDescriptor.Name == nameof(IVersioned.VersionId) && versionIdSourceFieldName != null)\r\n                    {\r\n                        if (!oldElement.Attributes().Any(a => a.Name.LocalName == nameof(IVersioned.VersionId)))\r\n                        {\r\n                            var sourceFieldValue = (Guid)oldElement.Attribute(versionIdSourceFieldName);\r\n\r\n                            newChildAttributes.Add(new XAttribute(fieldDescriptor.Name, sourceFieldValue));\r\n                        }\r\n\r\n                        continue;\r\n                    }\r\n\r\n                    if (!fieldDescriptor.IsNullable\r\n                        && !newChildAttributes.Any(attr => attr.Name == fieldDescriptor.Name))\r\n                    {\r\n                        object value;\r\n                        if (!newFieldValues.TryGetValue(fieldDescriptor.Name, out value))\r\n                        {\r\n                            value = GetDefaultValue(fieldDescriptor);\r\n                        }\r\n\r\n                        newChildAttributes.Add(new XAttribute(fieldDescriptor.Name, value));\r\n                    }\r\n                    else if (newFieldValues.ContainsKey(fieldDescriptor.Name))\r\n                    {\r\n                        XAttribute attribute = newChildAttributes.SingleOrDefault(attr => attr.Name == fieldDescriptor.Name);\r\n\r\n                        attribute?.SetValue(newFieldValues[fieldDescriptor.Name]);\r\n                    }\r\n                }\r\n\r\n                XElement newElement = new XElement(newDataScopeConfigurationElement.ElementName, newChildAttributes);\r\n\r\n                newElements.Add(newElement);\r\n            }\r\n\r\n            if (deleteOldFile)\r\n            {\r\n                C1File.Delete(oldFilename);\r\n            }\r\n\r\n            var newDocument = new XDocument(\r\n                new XElement(XmlDataProviderDocumentWriter.GetRootElementName(newDataScopeConfigurationElement.ElementName),\r\n                    newElements));\r\n\r\n            XDocumentUtils.Save(newDocument, newFilename);\r\n        }\r\n\r\n\r\n        private static object GetDefaultValue(DataFieldDescriptor fieldDescriptor)\r\n        {\r\n            Verify.ArgumentNotNull(fieldDescriptor, \"fieldDescriptor\");\r\n\r\n            if (fieldDescriptor.DefaultValue != null)\r\n            {\r\n                return fieldDescriptor.DefaultValue.Value;\r\n            }\r\n\r\n            switch (fieldDescriptor.StoreType.PhysicalStoreType)\r\n            {\r\n                case PhysicalStoreFieldType.Boolean:\r\n                    return false;\r\n                case PhysicalStoreFieldType.DateTime:\r\n                    return DateTime.Now;\r\n                case PhysicalStoreFieldType.Integer:\r\n                case PhysicalStoreFieldType.Long:\r\n                case PhysicalStoreFieldType.Decimal:\r\n                    return 0m;\r\n                case PhysicalStoreFieldType.Guid:\r\n                    return Guid.Empty;\r\n                case PhysicalStoreFieldType.String:\r\n                case PhysicalStoreFieldType.LargeString:\r\n                    return string.Empty;\r\n            }\r\n\r\n            throw new NotImplementedException(\"Supplied StoreFieldType contains an unsupported PhysicalStoreType '{0}'.\"\r\n                                              .FormatWith(fieldDescriptor.StoreType.PhysicalStoreType));\r\n        }\r\n\r\n        public static void DropStore(string providerName, XmlProviderInterfaceConfigurationElement configurationElement)\r\n        {\r\n            foreach (DataScopeConfigurationElement scopeElement in configurationElement.ConfigurationStores)\r\n            {\r\n                DropStore(providerName, scopeElement);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void CreateStore(string providerName, DataScopeConfigurationElement scopeElement)\r\n        {\r\n            string filename = ResolvePath(scopeElement.Filename, providerName);\r\n\r\n            string directoryPath = Path.GetDirectoryName(filename);\r\n            if (!C1Directory.Exists(directoryPath))\r\n            {\r\n                C1Directory.CreateDirectory(directoryPath);\r\n            }\r\n\r\n            bool keepExistingFile = false;\r\n            string rootLocalName = XmlDataProviderDocumentWriter.GetRootElementName(scopeElement.ElementName);\r\n            string obsoleteRootElementName = scopeElement.ElementName + \"s\";\r\n\r\n            if (C1File.Exists(filename))\r\n            {\r\n                try\r\n                {\r\n                    XDocument existingDocument = XDocumentUtils.Load(filename);\r\n                    if (existingDocument.Root.Name.LocalName == rootLocalName\r\n                        || existingDocument.Root.Name.LocalName == obsoleteRootElementName)\r\n                    {\r\n                        keepExistingFile = true;\r\n                    }\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    keepExistingFile = false;\r\n                }\r\n\r\n                if (!keepExistingFile)\r\n                {\r\n                    C1File.Delete(filename);\r\n                }\r\n            }\r\n\r\n            if (!keepExistingFile)\r\n            {\r\n                var document = new XDocument();\r\n                document.Add(new XElement(rootLocalName));\r\n                XDocumentUtils.Save(document, filename);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal static void DropStore(string providerName, DataScopeConfigurationElement scopeElement)\r\n        {\r\n            string filename = ResolvePath(scopeElement.Filename, providerName);\r\n\r\n            if (C1File.Exists(filename))\r\n            {\r\n                C1File.Delete(filename);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static DataTypeChangeDescriptor.ExistingFieldInfo GetExistingFieldInfo(DataTypeChangeDescriptor dataTypeChangeDescriptor, string name)\r\n        {\r\n            return dataTypeChangeDescriptor.ExistingFields.FirstOrDefault(f => f.OriginalField.Name == name);\r\n        }\r\n\r\n\r\n\r\n        private static string ResolvePath(string filename, string providerName)\r\n        {\r\n            XmlDataProviderData providerConfiguration = GetProviderSettings(providerName);\r\n\r\n            return PathUtil.Resolve(Path.Combine(providerConfiguration.StoreDirectory, filename));\r\n        }\r\n\r\n\r\n\r\n        private static XmlDataProviderData GetProviderSettings(string providerName)\r\n        {\r\n            return (XmlDataProviderData)DataProviderConfigurationServices.GetDataProviderConfiguration(providerName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/IXElementWrapper.cs",
    "content": "using System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IXElementWrapper\r\n    {\r\n        /// <exclude />\r\n        void CommitData(XElement element);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/IXmlDataProviderHelper.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n    internal interface IXmlDataProviderHelper\r\n    {\r\n        Type _InterfaceType { get; }\r\n        Type _DataIdType { get; }        \r\n        Func<XElement, T> CreateSelectFunction<T>(string providerName) where T : IData;\r\n        IDataId CreateDataId(XElement xElement);\r\n        void ValidateDataType(IData data);        \r\n        T CreateNewElement<T>(IData data, out XElement newElement, string elementName, string providerName) where T : IData;\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/XmlDataProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Plugins.DataProvider;\r\nusing Composite.Plugins.Data.DataProviders.Common;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(XmlDataProviderData))]\r\n    internal partial class XmlDataProvider : IWritableDataProvider, IDynamicDataProvider, IGeneratedTypesDataProvider, ILocalizedDataProvider, ISupportCachingDataProvider\r\n    {\r\n        private static readonly string LogTitle = typeof(XmlDataProvider).Name;\r\n\r\n        private readonly string _fileStoreDirectory;\r\n        private IEnumerable<XmlProviderInterfaceConfigurationElement> _dataTypeConfigurationElements;\r\n        private XmlDataTypeStoresContainer _xmlDataTypeStoresContainer;\r\n        private DataProviderContext _dataProviderContext;        \r\n        private readonly object _lock = new object();\r\n\r\n\r\n        public XmlDataProvider(string storeDirectory, IEnumerable<XmlProviderInterfaceConfigurationElement> dataTypeConfigurationElements)\r\n        {\r\n            if (storeDirectory == null) throw new ArgumentNullException(\"storeDirectory\");\r\n            if (dataTypeConfigurationElements == null) throw new ArgumentNullException(\"dataTypeConfigurationElements\");\r\n\r\n            _fileStoreDirectory = storeDirectory;\r\n            _dataTypeConfigurationElements = dataTypeConfigurationElements;            \r\n        }\r\n\r\n\r\n\r\n        public DataProviderContext Context\r\n        {\r\n            set\r\n            {\r\n                _dataProviderContext = value;\r\n\r\n                CodeGenerationManager.AddAssemblyCodeProvider(new XmlDataProviderCodeProvider(_dataProviderContext.ProviderName));\r\n\r\n                InitializeExistingStores();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> GetSupportedInterfaces()\r\n        {\r\n            return _xmlDataTypeStoresContainer.SupportedInterfaces;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Type> GetKnownInterfaces()\r\n        {\r\n            return _xmlDataTypeStoresContainer.KnownInterfaces;\r\n        }\r\n\r\n\r\n        public IEnumerable<Type> GetGeneratedInterfaces()\r\n        {\r\n            return _xmlDataTypeStoresContainer.GeneratedInterfaces;\r\n        }\r\n\r\n\r\n\r\n        public bool AllowResultsWrapping\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n\r\n\r\n        internal void BuildAllCode(CodeGenerationBuilder codeGenerationBuilder)\r\n        {\r\n            var codeBuilder = new XmlDataProviderCodeBuilder(_dataProviderContext.ProviderName, codeGenerationBuilder);\r\n\r\n            foreach (XmlProviderInterfaceConfigurationElement element in _dataTypeConfigurationElements)\r\n            {\r\n                if (element.DataTypeId == Guid.Empty)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                Guid dataTypeId = element.DataTypeId;\r\n\r\n                DataTypeDescriptor dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(dataTypeId);\r\n\r\n                if (dataTypeDescriptor == null)\r\n                {\r\n                    Log.LogError(LogTitle, \"Failed to find interface by id '{0}'. Skipping code generation for that type\", dataTypeId);\r\n                    continue;\r\n                }\r\n\r\n                if (!dataTypeDescriptor.ValidateRuntimeType())\r\n                {\r\n                    Log.LogError(LogTitle, \"The non code generated interface type '{0}' was not found, skipping code generation for that type\", dataTypeDescriptor);\r\n                    continue;\r\n                }\r\n\r\n                codeBuilder.AddDataType(dataTypeDescriptor);\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class XmlDataProviderAssembler : IAssembler<IDataProvider, DataProviderData>\r\n    {\r\n        private static readonly string LogTitle = typeof (XmlDataProviderAssembler).Name;\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IDataProvider Assemble(IBuilderContext context, DataProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            string pathToConfigFile = PathUtil.Resolve(GlobalSettingsFacade.ConfigurationDirectory);\r\n            return Assemble(context, objectConfiguration, configurationSource, reflectionCache, pathToConfigFile);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        internal IDataProvider Assemble(IBuilderContext context, DataProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache, string configurationFolderPath)\r\n        {\r\n            var data = (XmlDataProviderData)objectConfiguration;\r\n\r\n            var configuration = new C1Configuration(Path.Combine(configurationFolderPath, string.Format(\"{0}.config\", data.Name)));\r\n\r\n            var section = configuration.GetSection(XmlDataProviderConfigurationSection.SectionName) as XmlDataProviderConfigurationSection;\r\n            if (section == null)\r\n            {\r\n                section = new XmlDataProviderConfigurationSection();\r\n                configuration.Sections.Add(XmlDataProviderConfigurationSection.SectionName, section);\r\n                configuration.Save();\r\n            }\r\n\r\n\r\n            var dataTypeConfigurationElements = section.Interfaces.Cast<XmlProviderInterfaceConfigurationElement>().ToList();\r\n\r\n            return new XmlDataProvider(PathUtil.Resolve(data.StoreDirectory), dataTypeConfigurationElements);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(XmlDataProviderAssembler))]\r\n    internal sealed class XmlDataProviderData : DataProviderData\r\n    {\r\n        private const string _storeDirectoryPropertyName = \"storeDirectory\";\r\n        [System.Configuration.ConfigurationProperty(_storeDirectoryPropertyName, IsRequired = true)]\r\n        public string StoreDirectory\r\n        {\r\n            get { return (string)base[_storeDirectoryPropertyName]; }\r\n            set { base[_storeDirectoryPropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class XmlDataProviderConfigurationSection : System.Configuration.ConfigurationSection\r\n    {\r\n        public const string SectionName = \"Composite.Data.Plugins.XmlDataProviderConfiguration\";\r\n\r\n\r\n        private const string _interfacesPropertyName = \"Interfaces\";\r\n        [System.Configuration.ConfigurationProperty(_interfacesPropertyName)]\r\n        public XmlProviderInterfaceConfigurationElementCollection Interfaces\r\n        {\r\n            get { return (XmlProviderInterfaceConfigurationElementCollection)base[_interfacesPropertyName]; }\r\n            set { base[_interfacesPropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class XmlProviderInterfaceConfigurationElementCollection : System.Configuration.ConfigurationElementCollection\r\n    {\r\n        internal void Add(XmlProviderInterfaceConfigurationElement element)\r\n        {\r\n            BaseAdd(element);\r\n        }\r\n\r\n\r\n        internal void Remove(object key)\r\n        {\r\n            BaseRemove(key);\r\n        }\r\n\r\n        protected override System.Configuration.ConfigurationElement CreateNewElement()\r\n        {\r\n            return new XmlProviderInterfaceConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(System.Configuration.ConfigurationElement element)\r\n        {\r\n            return ((XmlProviderInterfaceConfigurationElement)element).DataTypeId;\r\n        }\r\n\r\n        internal object GetKey(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            Guid dataTypeId = dataTypeDescriptor.DataTypeId;\r\n            object[] allKeys = BaseGetAllKeys();\r\n\r\n            return allKeys.Contains(dataTypeId) ? dataTypeId : (object)null;\r\n        }\r\n\r\n        internal XmlProviderInterfaceConfigurationElement Get(object key)\r\n        {\r\n            return (XmlProviderInterfaceConfigurationElement)BaseGet(key);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class XmlProviderInterfaceConfigurationElement : System.Configuration.ConfigurationElement\r\n    {\r\n        public Dictionary<string, Dictionary<string, DataScopeConfigurationElement>> DataScopes\r\n        {\r\n            get\r\n            {\r\n                var scopes = new Dictionary<string, Dictionary<string, DataScopeConfigurationElement>>();\r\n\r\n                foreach (DataScopeConfigurationElement scopeElement in this.ConfigurationStores)\r\n                {\r\n                    Dictionary<string, DataScopeConfigurationElement> dic;\r\n                    if (!scopes.TryGetValue(scopeElement.DataScope, out dic))\r\n                    {\r\n                        dic = new Dictionary<string, DataScopeConfigurationElement>();\r\n                        scopes.Add(scopeElement.DataScope, dic);\r\n                    }\r\n\r\n                    dic.Add(scopeElement.CultureName, scopeElement);\r\n                }\r\n\r\n                return scopes;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<string, Type> DataIdProperties\r\n        {\r\n            get\r\n            {\r\n                return ConfigurationDataIdProperties.ToDictionary(e => e.Name, e => e.Type);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<string, string> PropertyNameMappings\r\n        {\r\n            get\r\n            {\r\n                return ConfigurationPropertyNameMappings.ToDictionary(e => e.PropertyName, e => e.SourcePropertyName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<string, Type> PropertyInitializers\r\n        {\r\n            get\r\n            {\r\n                return ConfigurationPropertyInitializers.ToDictionary(e => e.Name, e => e.Type);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void AddPropertyInitializer(string name, Type type)\r\n        {\r\n            ConfigurationPropertyInitializers.Add(name, type);\r\n        }\r\n\r\n\r\n        private const string _dataTypeIdName = \"dataTypeId\";\r\n        [System.Configuration.ConfigurationProperty(_dataTypeIdName, IsRequired = true)]\r\n        public Guid DataTypeId\r\n        {\r\n            get { return (Guid)base[_dataTypeIdName]; }\r\n            set { base[_dataTypeIdName] = value; }\r\n        }\r\n\r\n\r\n        private const string _isGeneratedTypePropertyName = \"isGeneratedType\";\r\n        [System.Configuration.ConfigurationProperty(_isGeneratedTypePropertyName, IsRequired = true)]\r\n        public bool IsGeneratedType\r\n        {\r\n            get { return (bool)base[_isGeneratedTypePropertyName]; }\r\n            set { base[_isGeneratedTypePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _storesPropertyName = \"Stores\";\r\n        [System.Configuration.ConfigurationProperty(_storesPropertyName, IsRequired = false)]\r\n        public DataScopeConfigurationElementCollection ConfigurationStores\r\n        {\r\n            get { return (DataScopeConfigurationElementCollection)base[_storesPropertyName]; }\r\n            set { base[_storesPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _dataIdPropertiesPropertyName = \"DataIdProperties\";\r\n        [System.Configuration.ConfigurationProperty(_dataIdPropertiesPropertyName, IsRequired = true)]\r\n        public SimpleNameTypeConfigurationElementCollection ConfigurationDataIdProperties\r\n        {\r\n            get { return (SimpleNameTypeConfigurationElementCollection)base[_dataIdPropertiesPropertyName]; }\r\n            set { base[_dataIdPropertiesPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _propertyNameMappingsPropertyName = \"PropertyNameMappings\";\r\n        [System.Configuration.ConfigurationProperty(_propertyNameMappingsPropertyName)]\r\n        public PropertyNameMappingConfigurationElementCollection ConfigurationPropertyNameMappings\r\n        {\r\n            get { return (PropertyNameMappingConfigurationElementCollection)base[_propertyNameMappingsPropertyName]; }\r\n            set { base[_propertyNameMappingsPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _propertyInitializersPropertyName = \"PropertyInitializers\";\r\n        [System.Configuration.ConfigurationProperty(_propertyInitializersPropertyName)]\r\n        public SimpleNameTypeConfigurationElementCollection ConfigurationPropertyInitializers\r\n        {\r\n            get { return (SimpleNameTypeConfigurationElementCollection)base[_propertyInitializersPropertyName]; }\r\n            set { base[_propertyInitializersPropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class DataScopeConfigurationElement : System.Configuration.ConfigurationElement\r\n    {\r\n        private const string _dataScopePropertyName = \"dataScope\";\r\n        [System.Configuration.ConfigurationProperty(_dataScopePropertyName, IsRequired = true)]\r\n        public string DataScope\r\n        {\r\n            get { return (string)base[_dataScopePropertyName]; }\r\n            set { base[_dataScopePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _cultureNamePropertyName = \"cultureName\";\r\n        [System.Configuration.ConfigurationProperty(_cultureNamePropertyName, IsRequired = false, DefaultValue = \"\")]\r\n        public string CultureName\r\n        {\r\n            get { return (string)base[_cultureNamePropertyName]; }\r\n            set { base[_cultureNamePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _filenamePropertyName = \"filename\";\r\n        [System.Configuration.ConfigurationProperty(_filenamePropertyName, IsRequired = true)]\r\n        public string Filename\r\n        {\r\n            get { return (string)base[_filenamePropertyName]; }\r\n            set { base[_filenamePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _elementNamePropertyName = \"elementName\";\r\n        [System.Configuration.ConfigurationProperty(_elementNamePropertyName, IsRequired = true)]\r\n        public string ElementName\r\n        {\r\n            get { return (string)base[_elementNamePropertyName]; }\r\n            set { base[_elementNamePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class DataScopeConfigurationElementCollection : System.Configuration.ConfigurationElementCollection, IEnumerable<DataScopeConfigurationElement>\r\n    {\r\n        internal void Add(DataScopeConfigurationElement element)\r\n        {\r\n            BaseAdd(element);\r\n        }\r\n\r\n        protected override System.Configuration.ConfigurationElement CreateNewElement()\r\n        {\r\n            return new DataScopeConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(System.Configuration.ConfigurationElement element)\r\n        {\r\n            DataScopeConfigurationElement castedElement = (DataScopeConfigurationElement)element;\r\n            return string.Format(\"{0}.{1}\", castedElement.DataScope, castedElement.CultureName);\r\n        }\r\n\r\n        IEnumerator<DataScopeConfigurationElement> IEnumerable<DataScopeConfigurationElement>.GetEnumerator()\r\n        {\r\n            return this.OfType<DataScopeConfigurationElement>().GetEnumerator();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/XmlDataProvider_CRUD.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Transactions;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Threading;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n    internal partial class XmlDataProvider\r\n    {\r\n        public IQueryable<T> GetData<T>()\r\n            where T : class, IData\r\n        {\r\n            CheckTransactionNotInAbortedState();\r\n\r\n            XmlDataTypeStore dataTypeStore = _xmlDataTypeStoresContainer.GetDataTypeStore(typeof(T));\r\n\r\n            var currentDataScope = DataScopeManager.MapByType(typeof(T));\r\n            if (!dataTypeStore.HasDataScopeName(currentDataScope)) return Enumerable.Empty<T>().AsQueryable();\r\n\r\n            var dataTypeStoreScope = dataTypeStore.GetDataScopeForType(typeof(T));\r\n\r\n            var fileRecord = XmlDataProviderDocumentCache.GetFileRecord(\r\n                dataTypeStoreScope.Filename,\r\n                dataTypeStoreScope.ElementName, \r\n                dataTypeStore.Helper.CreateDataId);\r\n\r\n            if (fileRecord.CachedTable == null)\r\n            {\r\n                ICollection<XElement> elements = fileRecord.ReadOnlyElementsList;\r\n\r\n                Func<XElement, T> fun = dataTypeStore.Helper.CreateSelectFunction<T>(_dataProviderContext.ProviderName);\r\n\r\n                var list = new List<T>(elements.Count);\r\n                list.AddRange(elements.Select(fun));\r\n\r\n                fileRecord.CachedTable = new CachedTable<T>(list);\r\n            }\r\n\r\n            return new CachingQueryable<T>(fileRecord.CachedTable, () => fileRecord.CachedTable.Queryable);\r\n        }\r\n\r\n\r\n\r\n        public T GetData<T>(IDataId dataId)\r\n            where T : class, IData\r\n        {\r\n            if (dataId == null) throw new ArgumentNullException(\"dataId\");\r\n\r\n            XmlDataTypeStore dataTypeStore = _xmlDataTypeStoresContainer.GetDataTypeStore(typeof(T));\r\n            var dataTypeStoreScope = dataTypeStore.GetDataScopeForType(typeof(T));\r\n\r\n            var fileRecord = GetFileRecord(dataTypeStore, dataTypeStoreScope);\r\n\r\n            XElement element = fileRecord.RecordSet.Index[dataId];\r\n\r\n            if (element == null) return null;\r\n\r\n            Func<XElement, T> selectFun = dataTypeStore.Helper.CreateSelectFunction<T>(_dataProviderContext.ProviderName);\r\n\r\n            return selectFun(element);\r\n        }\r\n\r\n\r\n\r\n        public void Update(IEnumerable<IData> dataset)\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            CheckTransactionNotInAbortedState();\r\n\r\n            using (XmlDataProviderDocumentCache.CreateEditingContext())\r\n            {\r\n                var validatedFileRecords = new Dictionary<DataSourceId, FileRecord>();\r\n                var validatedElements = new Dictionary<DataSourceId, XElement>();\r\n\r\n                // verify phase\r\n                foreach (IData wrappedData in dataset)\r\n                {\r\n                    var data = DataWrappingFacade.UnWrap(wrappedData);\r\n\r\n                    Verify.ArgumentCondition(data != null, \"dataset\", \"Collection contains a null element.\");\r\n                    Verify.ArgumentCondition(data.DataSourceId != null, \"dataset\", \"Collection contains a data item with DataSourceId null property.\");\r\n\r\n                    ValidationHelper.Validate(data);\r\n\r\n                    XmlDataTypeStore dataTypeStore = _xmlDataTypeStoresContainer.GetDataTypeStore(data.DataSourceId.InterfaceType);\r\n\r\n\r\n                    var dataScope = data.DataSourceId.DataScopeIdentifier;\r\n                    var culture = data.DataSourceId.LocaleScope;\r\n                    var type = data.DataSourceId.InterfaceType;\r\n\r\n                    var dataTypeStoreScope = dataTypeStore.GetDataScope(dataScope, culture, type);\r\n\r\n                    dataTypeStore.Helper.ValidateDataType(data);\r\n\r\n                    if (null == data.DataSourceId) throw new ArgumentException(\"The DataSourceId property of the data argument must not be null\", \"data\");\r\n                    if (data.DataSourceId.ProviderName != _dataProviderContext.ProviderName) throw new ArgumentException(\"The data element does not belong to this provider\", \"data\");\r\n\r\n                    var fileRecord = GetFileRecord(dataTypeStore, dataTypeStoreScope);\r\n\r\n                    var index = fileRecord.RecordSet.Index;\r\n\r\n                    IDataId dataId = data.DataSourceId.DataId;\r\n\r\n                    XElement element = index[dataId];\r\n\r\n                    if (element == null)\r\n                    {\r\n                        throw new ArgumentException($\"Cannot update a data item, no data element corresponds to the given data id: '{dataId.Serialize(null)}'; Type: '{type}'; DataScope: '{dataScope}'; Culture: '{culture}'\", nameof(dataset));\r\n                    }\r\n\r\n                    IXElementWrapper wrapper = data as IXElementWrapper;\r\n                    Verify.ArgumentCondition(wrapper != null, nameof(dataset), $\"The type of data was expected to be of type {typeof(IXElementWrapper)}\");\r\n\r\n                    XElement updatedElement = CreateUpdatedXElement(wrapper, element);\r\n\r\n                    validatedFileRecords.Add(data.DataSourceId, fileRecord);\r\n                    validatedElements.Add(data.DataSourceId, updatedElement);\r\n                }\r\n\r\n                foreach (var key in validatedElements.Keys)\r\n                {\r\n                    FileRecord fileRecord = validatedFileRecords[key];\r\n                    fileRecord.Dirty = true;\r\n                    fileRecord.RecordSet.Index[key.DataId] = validatedElements[key];\r\n                }\r\n\r\n                XmlDataProviderDocumentCache.SaveChanges();\r\n\r\n                SubscribeToTransactionRollbackEvent();\r\n            }\r\n        }        \r\n\r\n\r\n\r\n        public List<T> AddNew<T>(IEnumerable<T> dataset) where T : class, IData\r\n        {\r\n            Verify.ArgumentNotNull(dataset, \"dataset\");\r\n\r\n            CheckTransactionNotInAbortedState();\r\n\r\n            var resultList = new List<T>();\r\n\r\n            using (XmlDataProviderDocumentCache.CreateEditingContext())\r\n            {\r\n                XmlDataTypeStore dataTypeStore = _xmlDataTypeStoresContainer.GetDataTypeStore(typeof(T));\r\n                var dataTypeStoreScope = dataTypeStore.GetDataScopeForType(typeof(T));\r\n\r\n                var fileRecord = GetFileRecord(dataTypeStore, dataTypeStoreScope);\r\n\r\n                var validatedElements = new Dictionary<DataSourceId, XElement>();\r\n\r\n                // validating phase\r\n                foreach (IData data in dataset)\r\n                {\r\n                    Verify.ArgumentCondition(data != null, nameof(dataset), \"The enumeration dataset may not contain nulls\");\r\n                    ValidationHelper.Validate(data);\r\n\r\n                    XElement newElement;\r\n\r\n                    T newData = dataTypeStore.Helper.CreateNewElement<T>(data, out newElement, dataTypeStoreScope.ElementName, _dataProviderContext.ProviderName);\r\n                    IDataId dataId = dataTypeStore.Helper.CreateDataId(newElement);\r\n                    XElement violatingElement = fileRecord.RecordSet.Index[dataId];\r\n\r\n                    if (violatingElement != null)\r\n                    {\r\n                        throw new ArgumentException(nameof(dataset), \"Key violation error. A data element with the same dataId is already added. Type: \" + typeof(T).FullName);\r\n                    }\r\n\r\n                    validatedElements.Add(newData.DataSourceId, newElement);\r\n                    resultList.Add(newData);\r\n                }\r\n\r\n                // commit validated elements \r\n                foreach (var key in validatedElements.Keys)\r\n\t            {\r\n                    fileRecord.RecordSet.Index.Add(key.DataId, validatedElements[key]);\r\n                    fileRecord.Dirty = true;\r\n                }\r\n\r\n                XmlDataProviderDocumentCache.SaveChanges();\r\n\r\n                SubscribeToTransactionRollbackEvent();\r\n            }\r\n\r\n            return resultList;\r\n        }\r\n\r\n\r\n\r\n        public void Delete(IEnumerable<DataSourceId> dataSourceIds)\r\n        {\r\n            Verify.ArgumentNotNull(dataSourceIds, \"dataSourceIds\");\r\n\r\n            CheckTransactionNotInAbortedState();\r\n\r\n            using (XmlDataProviderDocumentCache.CreateEditingContext())\r\n            {\r\n                var validated = new Dictionary<DataSourceId, FileRecord>();\r\n\r\n                // verify phase\r\n                foreach (DataSourceId dataSourceId in dataSourceIds)\r\n                {\r\n                    Verify.ArgumentCondition(dataSourceId != null, nameof(dataSourceIds), \"The enumeration may not contain null values\");\r\n\r\n                    XmlDataTypeStore dataTypeStore = _xmlDataTypeStoresContainer.GetDataTypeStore(dataSourceId.InterfaceType);\r\n\r\n                    var dataScope = dataSourceId.DataScopeIdentifier;\r\n                    var culture = dataSourceId.LocaleScope;\r\n                    var type = dataSourceId.InterfaceType;\r\n                    var dataId = dataSourceId.DataId;\r\n\r\n                    var dataTypeStoreScope = dataTypeStore.GetDataScope(dataScope, culture, type);\r\n\r\n                    if (dataTypeStore.Helper._DataIdType != dataId.GetType())\r\n                    {\r\n                        throw new ArgumentException(\"Only data ids from this provider is allowed to be deleted on on the provider\");\r\n                    }\r\n\r\n                    var fileRecord = GetFileRecord(dataTypeStore, dataTypeStoreScope);\r\n\r\n                    var index = fileRecord.RecordSet.Index;\r\n\r\n                    if (!index.ContainsKey(dataId))\r\n                    {\r\n                        throw new ArgumentException($\"Cannot delete a data item, no data element corresponds to the given data id: '{dataId.Serialize(null)}'; Type: '{type}'; DataScope: '{dataScope}'; Culture: '{culture}'\", nameof(dataSourceIds));\r\n                    }\r\n\r\n                    validated.Add(dataSourceId, fileRecord);\r\n                }\r\n\r\n                // commit phase\r\n                foreach (var dataSourceId in validated.Keys)\r\n                {\r\n                    FileRecord fileRecord = validated[dataSourceId];\r\n                    fileRecord.RecordSet.Index.Remove(dataSourceId.DataId);\r\n                    fileRecord.Dirty = true;\r\n                }\r\n\r\n                XmlDataProviderDocumentCache.SaveChanges();\r\n\r\n                SubscribeToTransactionRollbackEvent();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void CheckTransactionNotInAbortedState()\r\n        {\r\n            var transaction = Transaction.Current;\r\n\r\n            if (transaction?.TransactionInformation.Status == TransactionStatus.Aborted)\r\n            {\r\n                Log.LogWarning(LogTitle, new TransactionException(\"Transaction is in aborted state\"));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void SubscribeToTransactionRollbackEvent()\r\n        {\r\n            var transaction = Transaction.Current;\r\n\r\n            if (transaction == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var currentThreadData = ThreadDataManager.GetCurrentNotNull();\r\n\r\n            Hashset<string> transactions;\r\n\r\n            const string tlsKey = \"XmlDataProvider enlisted transactions\";\r\n            if (!currentThreadData.HasValue(tlsKey))\r\n            {\r\n                transactions = new Hashset<string>();\r\n                currentThreadData.SetValue(tlsKey, transactions);\r\n            }\r\n            else\r\n            {\r\n                transactions = (Hashset<string>)currentThreadData[tlsKey];\r\n            }\r\n\r\n            string transactionId = transaction.TransactionInformation.LocalIdentifier;\r\n\r\n            if (transactions.Contains(transactionId))\r\n            {\r\n                return;\r\n            }\r\n\r\n            transactions.Add(transactionId);\r\n\r\n\r\n            ThreadStart logging = () =>\r\n            {\r\n                var exception = new TransactionException(\"XML data provider does not support transaction's API, changes were not rolled back.\");\r\n                Log.LogWarning(LogTitle, exception);\r\n            };\r\n\r\n            transaction.EnlistVolatile(new TransactionRollbackHandler(logging), EnlistmentOptions.None);\r\n        }\r\n\r\n\r\n\r\n        private static FileRecord GetFileRecord(XmlDataTypeStore dataTypeStore, XmlDataTypeStoreDataScope dataTypeStoreDataScope)\r\n        {\r\n            return XmlDataProviderDocumentCache.GetFileRecord(dataTypeStoreDataScope.Filename, dataTypeStoreDataScope.ElementName, dataTypeStore.Helper.CreateDataId);\r\n        }\r\n\r\n\r\n\r\n        private static XElement CreateUpdatedXElement(IXElementWrapper wrapper, XElement originalElement)\r\n        {\r\n            XElement result = new XElement(originalElement.Name);\r\n            foreach (XAttribute attribute in originalElement.Attributes())\r\n            {\r\n                result.Add(new XAttribute(attribute.Name, attribute.Value));\r\n            }\r\n\r\n            wrapper.CommitData(result);\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/XmlDataProvider_Stores.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Foundation.CodeGeneration;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n    internal partial class XmlDataProvider\r\n    {\r\n        public void CreateStores(IReadOnlyCollection<DataTypeDescriptor> dataTypeDescriptors)\r\n        {\r\n            var dataTypes = DataTypeTypesManager.GetDataTypes(dataTypeDescriptors);\r\n\r\n            var storesToCreate = new List<GeneratedTypesInfo>();\r\n\r\n            foreach (var dataTypeDescriptor in dataTypeDescriptors)\r\n            {\r\n                Type interfaceType = dataTypes[dataTypeDescriptor.DataTypeId];\r\n\r\n                storesToCreate.Add(BuildGeneratedTypesInfo(dataTypeDescriptor, interfaceType));\r\n            }\r\n\r\n            CompileMissingTypes(storesToCreate);\r\n\r\n            foreach (var storeToCreate in storesToCreate)\r\n            {\r\n                var dataTypeDescriptor = storeToCreate.DataTypeDescriptor;\r\n\r\n                InterfaceConfigurationManipulator.AddNew(_dataProviderContext.ProviderName, dataTypeDescriptor);\r\n\r\n                var xmlDataTypeStoreCreator = new XmlDataTypeStoreCreator(_fileStoreDirectory);\r\n\r\n                XmlDataTypeStore xmlDateTypeStore = xmlDataTypeStoreCreator.CreateStoreResult(\r\n                    dataTypeDescriptor, \r\n                    storeToCreate.DataProviderHelperClass, \r\n                    storeToCreate.DataIdClass, null);\r\n\r\n                Type interfaceType = storeToCreate.InterfaceType;\r\n\r\n                AddDataTypeStore(dataTypeDescriptor, interfaceType, xmlDateTypeStore);\r\n            }\r\n        }\r\n\r\n\r\n        public void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, bool forceCompile)\r\n        {\r\n            XmlDataProviderDocumentCache.ClearCache();\r\n\r\n            XmlProviderInterfaceConfigurationElement element = InterfaceConfigurationManipulator.Change(updateDataTypeDescriptor);\r\n\r\n            if (forceCompile)\r\n            {\r\n                DataTypeDescriptor dataTypeDescriptor = updateDataTypeDescriptor.NewDataTypeDescriptor;\r\n\r\n                Type dataProviderHelperType;\r\n                Type dataIdClassType;\r\n                bool typesExists = EnsureNeededTypes(dataTypeDescriptor, out dataProviderHelperType, out dataIdClassType, true);\r\n                Verify.That(typesExists, \"Could not find or code generated the type '{0}' or one of the needed helper types\", dataTypeDescriptor.GetFullInterfaceName());\r\n\r\n                var xmlDataTypeStoreDataScopes = new List<XmlDataTypeStoreDataScope>();\r\n                foreach (DataScopeConfigurationElement dataScopeConfigurationElement in element.ConfigurationStores)\r\n                {\r\n                    var xmlDataTypeStoreDataScope = new XmlDataTypeStoreDataScope\r\n                    {\r\n                        DataScopeName = dataScopeConfigurationElement.DataScope,\r\n                        CultureName = dataScopeConfigurationElement.CultureName,\r\n                        ElementName = dataScopeConfigurationElement.ElementName,\r\n                        Filename = Path.Combine(_fileStoreDirectory, dataScopeConfigurationElement.Filename)\r\n                    };\r\n\r\n                    xmlDataTypeStoreDataScopes.Add(xmlDataTypeStoreDataScope);\r\n                }\r\n\r\n                var xmlDataTypeStoreCreator = new XmlDataTypeStoreCreator(_fileStoreDirectory);\r\n                \r\n                XmlDataTypeStore xmlDateTypeStore = xmlDataTypeStoreCreator.CreateStoreResult(dataTypeDescriptor, dataProviderHelperType, dataIdClassType, xmlDataTypeStoreDataScopes);\r\n\r\n                Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n\r\n                UpdateDataTypeStore(dataTypeDescriptor, interfaceType, xmlDateTypeStore);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void DropStore(DataTypeDescriptor typeDescriptor)\r\n        {\r\n            XmlDataProviderDocumentCache.ClearCache();\r\n\r\n            InterfaceConfigurationManipulator.Remove(_dataProviderContext.ProviderName, typeDescriptor);\r\n\r\n            _dataTypeConfigurationElements = _dataTypeConfigurationElements.Where(s => s.DataTypeId != typeDescriptor.DataTypeId).Evaluate();\r\n        }\r\n\r\n\r\n\r\n        public void AddLocale(CultureInfo cultureInfo)\r\n        {\r\n            XmlDataProviderDocumentCache.ClearCache();\r\n\r\n            InterfaceConfigurationManipulator.AddLocale(_dataProviderContext.ProviderName, this.GetSupportedInterfaces(), cultureInfo);\r\n        }\r\n\r\n\r\n        public void RemoveLocale(CultureInfo cultureInfo)\r\n        {\r\n            XmlDataProviderDocumentCache.ClearCache();\r\n\r\n            InterfaceConfigurationManipulator.RemoveLocale(_dataProviderContext.ProviderName, this.GetSupportedInterfaces(), cultureInfo);\r\n        }\r\n\r\n\r\n        private static Exception NewConfigurationException(ConfigurationElement element, string message)\r\n        {\r\n            return new ConfigurationErrorsException(message, element.ElementInformation.Source, element.ElementInformation.LineNumber);\r\n        }\r\n\r\n        private void InitializeExistingStores()\r\n        {\r\n            var xmlDataTypeStoreCreator = new XmlDataTypeStoreCreator(_fileStoreDirectory);\r\n            _xmlDataTypeStoresContainer = new XmlDataTypeStoresContainer(_dataProviderContext.ProviderName);\r\n\r\n            var dataTypes = LoadDataTypes(_dataTypeConfigurationElements);\r\n\r\n            var storesToLoad = new List<GeneratedTypesInfo>();\r\n\r\n            foreach (XmlProviderInterfaceConfigurationElement element in _dataTypeConfigurationElements)\r\n            {\r\n                var dataTypeDescriptor = GetDataTypeDescriptorNotNull(element);\r\n\r\n                Type interfaceType = null;\r\n\r\n                try\r\n                {\r\n                    if (!dataTypes.TryGetValue(dataTypeDescriptor.DataTypeId, out interfaceType) || interfaceType == null)\r\n                    {\r\n                        Log.LogWarning(LogTitle, \"The data interface type '{0}' does not exist and is not code generated. It will not be usable\", dataTypeDescriptor.TypeManagerTypeName);\r\n                        continue;\r\n                    }\r\n\r\n                    storesToLoad.Add(BuildGeneratedTypesInfo(dataTypeDescriptor, interfaceType, element));\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    if (interfaceType != null)\r\n                    {\r\n                        DataProviderRegistry.AddKnownDataType(interfaceType, _dataProviderContext.ProviderName);\r\n                    }\r\n                    Log.LogError(LogTitle, \"Failed initialization for the datatype {{{0}}}, {1}\", dataTypeDescriptor.DataTypeId, dataTypeDescriptor.TypeManagerTypeName);\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n\r\n            CompileMissingTypes(storesToLoad);\r\n\r\n            foreach (var storeToLoad in storesToLoad)\r\n            {\r\n                try\r\n                {\r\n                    var xmlDataTypeStoreDataScopes = new List<XmlDataTypeStoreDataScope>();\r\n                    foreach (DataScopeConfigurationElement dataScopeConfigurationElement in storeToLoad.Element.ConfigurationStores)\r\n                    {\r\n                        var xmlDataTypeStoreDataScope = new XmlDataTypeStoreDataScope\r\n                        {\r\n                            DataScopeName = dataScopeConfigurationElement.DataScope,\r\n                            CultureName = dataScopeConfigurationElement.CultureName,\r\n                            ElementName = dataScopeConfigurationElement.ElementName,\r\n                            Filename = Path.Combine(_fileStoreDirectory, dataScopeConfigurationElement.Filename)\r\n                        };\r\n\r\n                        xmlDataTypeStoreDataScopes.Add(xmlDataTypeStoreDataScope);\r\n                    }\r\n\r\n                    XmlDataTypeStore xmlDateTypeStore = xmlDataTypeStoreCreator.CreateStoreResult(storeToLoad.DataTypeDescriptor,\r\n                        storeToLoad.DataProviderHelperClass, storeToLoad.DataIdClass, xmlDataTypeStoreDataScopes);\r\n\r\n                    AddDataTypeStore(storeToLoad.DataTypeDescriptor, storeToLoad.InterfaceType, xmlDateTypeStore);\r\n\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    DataProviderRegistry.AddKnownDataType(storeToLoad.InterfaceType, _dataProviderContext.ProviderName);\r\n\r\n                    Log.LogError(LogTitle, \"Failed initialization for the datatype {{{0}}}, {1}\", storeToLoad.DataTypeDescriptor.DataTypeId, storeToLoad.DataTypeDescriptor.TypeManagerTypeName);\r\n                    Log.LogError(LogTitle, ex);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Loads all the data types referenced in the provider's configuration file.\r\n        /// </summary>\r\n        private static Dictionary<Guid, Type> LoadDataTypes(IEnumerable<XmlProviderInterfaceConfigurationElement> configurationElements)\r\n        {\r\n            var dataTypeDescriptors = new List<DataTypeDescriptor>();\r\n\r\n            foreach (XmlProviderInterfaceConfigurationElement element in configurationElements)\r\n            {\r\n                var dataTypeDescriptor = GetDataTypeDescriptorNotNull(element);\r\n\r\n                dataTypeDescriptors.Add(dataTypeDescriptor);\r\n            }\r\n\r\n            return DataTypeTypesManager.GetDataTypes(dataTypeDescriptors);\r\n        }\r\n\r\n\r\n        private static DataTypeDescriptor GetDataTypeDescriptorNotNull(XmlProviderInterfaceConfigurationElement element)\r\n        {\r\n            Guid dataTypeId = element.DataTypeId;\r\n\r\n            var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(dataTypeId, true);\r\n            if (dataTypeDescriptor == null)\r\n            {\r\n                throw NewConfigurationException(element, \"Failed to get a DataTypeDescriptor by id '{0}'\".FormatWith(dataTypeId));\r\n            }\r\n\r\n            return dataTypeDescriptor;\r\n        }\r\n\r\n        private void AddDataTypeStore(DataTypeDescriptor dataTypeDescriptor, Type interfaceType, XmlDataTypeStore xmlDateTypeStore)\r\n        {\r\n            bool interfaceValidated = DataTypeValidationRegistry.Validate(interfaceType, dataTypeDescriptor);\r\n\r\n            if (xmlDateTypeStore != null && interfaceValidated)\r\n            {\r\n                _xmlDataTypeStoresContainer.AddSupportedDataTypeStore(interfaceType, xmlDateTypeStore);\r\n                DataProviderRegistry.AddNewDataType(interfaceType, _dataProviderContext.ProviderName);\r\n            }\r\n            else\r\n            {\r\n                _xmlDataTypeStoresContainer.AddKnownInterface(interfaceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void UpdateDataTypeStore(DataTypeDescriptor dataTypeDescriptor, Type interfaceType, XmlDataTypeStore xmlDateTypeStore)\r\n        {\r\n            _xmlDataTypeStoresContainer.UpdateSupportedDataTypeStore(interfaceType, xmlDateTypeStore);\r\n        }\r\n\r\n\r\n\r\n        private bool EnsureNeededTypes(DataTypeDescriptor dataTypeDescriptor, out Type dataProviderHelperType, out Type dataIdClassType, bool forceCompile = false)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                // Getting the interface (ensuring that it exists)\r\n                Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor);\r\n                if (interfaceType == null)\r\n                {\r\n                    dataProviderHelperType = null;\r\n                    dataIdClassType = null;\r\n                    return false;\r\n                }\r\n\r\n                string dataProviderHelperClassFullName, dataIdClassFullName;\r\n\r\n                GetGeneratedClassNames(dataTypeDescriptor, out dataProviderHelperClassFullName, out dataIdClassFullName);\r\n\r\n                dataProviderHelperType = TypeManager.TryGetType(dataProviderHelperClassFullName);\r\n                dataIdClassType = TypeManager.TryGetType(dataIdClassFullName);\r\n\r\n                if (!forceCompile)\r\n                {\r\n                    forceCompile = CodeGenerationManager.IsRecompileNeeded(interfaceType, new[] { dataProviderHelperType, dataIdClassType });\r\n                }\r\n\r\n                if (forceCompile)\r\n                {\r\n                    var codeGenerationBuilder = new CodeGenerationBuilder(_dataProviderContext.ProviderName + \":\" + dataTypeDescriptor.Name);\r\n\r\n                    // XmlDataProvider types                \r\n                    var codeBuilder = new XmlDataProviderCodeBuilder(_dataProviderContext.ProviderName, codeGenerationBuilder);\r\n                    codeBuilder.AddDataType(dataTypeDescriptor);\r\n\r\n                    DataWrapperCodeGenerator.AddDataWrapperClassCode(codeGenerationBuilder, dataTypeDescriptor);\r\n\r\n                    IEnumerable<Type> types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder, false);\r\n\r\n                    dataProviderHelperType = types.Single(f => f.FullName == dataProviderHelperClassFullName);\r\n                    dataIdClassType = types.Single(f => f.FullName == dataIdClassFullName);\r\n                }\r\n\r\n                return true;\r\n            }\r\n        }\r\n\r\n        private void GetGeneratedClassNames(DataTypeDescriptor dataTypeDescriptor, out string dataProviderHelperClassFullName, out string dataIdClassFullName)\r\n        {\r\n            string namespaceName = NamesCreator.MakeNamespaceName(_dataProviderContext.ProviderName);\r\n\r\n            dataProviderHelperClassFullName = namespaceName + \".\" + NamesCreator.MakeDataProviderHelperClassName(dataTypeDescriptor);\r\n            dataIdClassFullName = namespaceName + \".\" + NamesCreator.MakeDataIdClassName(dataTypeDescriptor);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds a <see cref=\"GeneratedTypesInfo\"/> object that describes information about helper types generation\r\n        /// </summary>\r\n        private GeneratedTypesInfo BuildGeneratedTypesInfo(DataTypeDescriptor dataTypeDescriptor, Type interfaceType, XmlProviderInterfaceConfigurationElement element = null)\r\n        {\r\n            string dataProviderHelperClassFullName, dataIdClassFullName;\r\n\r\n            GetGeneratedClassNames(dataTypeDescriptor, out dataProviderHelperClassFullName, out dataIdClassFullName);\r\n\r\n            Type dataProviderHelperClass = TypeManager.TryGetType(dataProviderHelperClassFullName);\r\n            Type dataIdClass = TypeManager.TryGetType(dataIdClassFullName);\r\n\r\n            bool compilationNeeded = CodeGenerationManager.IsRecompileNeeded(interfaceType, new[] { dataProviderHelperClass, dataIdClass });\r\n\r\n            return new GeneratedTypesInfo\r\n            {\r\n                Element = element,\r\n                DataTypeDescriptor = dataTypeDescriptor,\r\n                InterfaceType = interfaceType,\r\n                DataIdClass = dataIdClass,\r\n                DataIdClassName = dataIdClassFullName,\r\n                DataProviderHelperClass = dataProviderHelperClass,\r\n                DataProviderHelperClassName = dataProviderHelperClassFullName,\r\n                CompilationNeeded = compilationNeeded\r\n            };\r\n        }\r\n\r\n        private void CompileMissingTypes(IList<GeneratedTypesInfo> typesInfo)\r\n        {\r\n            // Compiling missing classes\r\n            if (typesInfo.Any(s => s.CompilationNeeded))\r\n            {\r\n                var codeGenerationBuilder = new CodeGenerationBuilder(_dataProviderContext.ProviderName + \":DataId and helper classes\");\r\n                var codeBuilder = new XmlDataProviderCodeBuilder(_dataProviderContext.ProviderName, codeGenerationBuilder);\r\n\r\n                foreach (var storeToLoad in typesInfo.Where(s => s.CompilationNeeded))\r\n                {\r\n                    codeBuilder.AddDataType(storeToLoad.DataTypeDescriptor);\r\n\r\n                    // Compiling some other classes for optimization\r\n                    DataWrapperCodeGenerator.AddDataWrapperClassCode(codeGenerationBuilder, storeToLoad.DataTypeDescriptor);\r\n                    EmptyDataClassCodeGenerator.AddEmptyDataClassTypeCode(codeGenerationBuilder, storeToLoad.DataTypeDescriptor);\r\n                }\r\n\r\n                var types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder, false).ToDictionary(type => type.FullName);\r\n\r\n                foreach (var storeToLoad in typesInfo.Where(s => s.CompilationNeeded))\r\n                {\r\n                    storeToLoad.DataIdClass = types[storeToLoad.DataIdClassName];\r\n                    storeToLoad.DataProviderHelperClass = types[storeToLoad.DataProviderHelperClassName];\r\n                }\r\n            }\r\n        }\r\n        \r\n        private class GeneratedTypesInfo\r\n        {\r\n            public XmlProviderInterfaceConfigurationElement Element;\r\n            public DataTypeDescriptor DataTypeDescriptor;\r\n            public Type InterfaceType;\r\n            public Type DataProviderHelperClass;\r\n            public Type DataIdClass;\r\n\r\n            public string DataProviderHelperClassName;\r\n            public string DataIdClassName;\r\n\r\n            public bool CompilationNeeded;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/XmlDataTypeStore.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n    /// <summary>\r\n    /// This class contains information used by the XmlDataProvider \r\n    /// when handling CRUD operations.\r\n    /// There exists one of these per data type. \r\n    /// This class contains one entry per data-scope/locale-scope that contains\r\n    /// the filename and element name.\r\n    /// </summary>\r\n    [DebuggerDisplay(\"{\" + nameof(DataTypeDescriptor) + \"}\")]\r\n    internal sealed class XmlDataTypeStore\r\n    {\r\n        private IXmlDataProviderHelper _helper;\r\n\r\n        private readonly IEnumerable<XmlDataTypeStoreDataScope> _xmlDateTypeStoreDataScopes;\r\n\r\n\r\n        public XmlDataTypeStore(DataTypeDescriptor dataTypeDescriptor, Type dataProviderHelperType, Type dataIdClassType, IEnumerable<XmlDataTypeStoreDataScope> xmlDateTypeStoreDataScopes, bool isGeneratedDataType)\r\n        {\r\n            DataTypeDescriptor =  dataTypeDescriptor ?? throw new ArgumentNullException(nameof(dataTypeDescriptor));\r\n            DataProviderHelperType = dataProviderHelperType ?? throw new ArgumentNullException(nameof(dataProviderHelperType));\r\n            DataIdClassType = dataIdClassType ?? throw new ArgumentNullException(nameof(dataIdClassType));\r\n            IsGeneratedDataType = isGeneratedDataType;\r\n\r\n            _xmlDateTypeStoreDataScopes = xmlDateTypeStoreDataScopes.Evaluate();\r\n\r\n            var ordering = new List<Func<XElement, IComparable>>();\r\n            foreach (string key in dataTypeDescriptor.KeyPropertyNames)\r\n            {\r\n                XName localKey = key;\r\n                ordering.Add(f => (string)f.Attribute(localKey) ?? \"\");\r\n            }\r\n            Func<IEnumerable<XElement>, IOrderedEnumerable<XElement>> orderer = f => ordering.Skip(1).Aggregate(f.OrderBy(ordering.First()), Enumerable.ThenBy); \r\n\r\n            foreach (XmlDataTypeStoreDataScope xmlDataTypeStoreDataScope in _xmlDateTypeStoreDataScopes)\r\n            {\r\n                DataScopeIdentifier dataScopeIdentifier = DataScopeIdentifier.Deserialize(xmlDataTypeStoreDataScope.DataScopeName);\r\n                CultureInfo culture = CultureInfo.CreateSpecificCulture(xmlDataTypeStoreDataScope.CultureName);\r\n                Type dataType = dataTypeDescriptor.GetInterfaceType();\r\n\r\n                Action cacheFlush = () => DataEventSystemFacade.FireExternalStoreChangedEvent(dataType, dataScopeIdentifier.ToPublicationScope(), culture);\r\n                XmlDataProviderDocumentCache.RegisterExternalFileChangeAction(xmlDataTypeStoreDataScope.Filename, cacheFlush);\r\n\r\n                XmlDataProviderDocumentWriter.RegisterFileOrderer(xmlDataTypeStoreDataScope.Filename, orderer);\r\n            }\r\n        }\r\n\r\n\r\n        public DataTypeDescriptor DataTypeDescriptor { get; }\r\n\r\n        /// <summary>\r\n        /// This is a implementation of <see cref=\"IXmlDataProviderHelper\"/> and <see cref=\"Composite.Plugins.Data.DataProviders.XmlDataProvider.CodeGeneration.DataProviderHelperBase\"/>\r\n        /// </summary>\r\n        public Type DataProviderHelperType { get; }\r\n\r\n        public Type DataIdClassType { get; }\r\n\r\n        public bool IsGeneratedDataType { get; }\r\n\r\n\r\n        public bool HasDataScopeName(DataScopeIdentifier dataScopeIdentifier)\r\n        {\r\n            return _xmlDateTypeStoreDataScopes.Any(f => f.DataScopeName == dataScopeIdentifier.Name);\r\n        }\r\n\r\n\r\n        public XmlDataTypeStoreDataScope GetDataScopeForType(Type type)\r\n        {\r\n            var currentDataScope = DataScopeManager.MapByType(type);\r\n            var culture = LocalizationScopeManager.MapByType(type);\r\n\r\n            return GetDataScope(currentDataScope, culture, type);\r\n        }\r\n\r\n        public XmlDataTypeStoreDataScope GetDataScope(DataScopeIdentifier dataScope, CultureInfo culture, Type type)\r\n        {\r\n            string dataScopeName = dataScope.Name;\r\n            Verify.That(HasDataScopeName(dataScope), \"The store named '{0}' is not supported for data type '{1}'\", dataScopeName, type);\r\n\r\n            string cultureName = culture.Name;\r\n\r\n            XmlDataTypeStoreDataScope dateTypeStoreDataScope =\r\n                _xmlDateTypeStoreDataScopes.SingleOrDefault(f => f.DataScopeName == dataScopeName && f.CultureName == cultureName);\r\n\r\n            if (dateTypeStoreDataScope == null)\r\n            {\r\n                if (culture.Equals(CultureInfo.InvariantCulture) && DataLocalizationFacade.IsLocalized(type))\r\n                {\r\n                    throw new InvalidOperationException($\"Failed to get data for type '{type.FullName}', no localization scope is provided for a localized type.\");\r\n                }\r\n\r\n                throw new InvalidOperationException(\"Failed to get '{0}' data for data scope ({1}, {2})\"\r\n                    .FormatWith(type.FullName, dataScopeName, culture.Equals(CultureInfo.InvariantCulture) ? \"invariant\" : cultureName));\r\n            }\r\n\r\n            return dateTypeStoreDataScope;\r\n        }\r\n\r\n\r\n        internal IEnumerable<XmlDataTypeStoreDataScope> XmlDataTypeStoreDataScopes => _xmlDateTypeStoreDataScopes;\r\n\r\n\r\n        public IXmlDataProviderHelper Helper\r\n        {\r\n            get\r\n            {\r\n                if (_helper == null)\r\n                {\r\n                    _helper = (IXmlDataProviderHelper)Activator.CreateInstance(this.DataProviderHelperType);\r\n                }\r\n\r\n                return _helper;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/XmlDataTypeStoreCreator.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Plugins.Data.DataProviders.XmlDataProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n    internal class XmlDataTypeStoreCreator\r\n    {\r\n        private readonly string _fileStoreDirectory;\r\n\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <param name=\"fileStoreDirectory\"></param>\r\n        public XmlDataTypeStoreCreator(string fileStoreDirectory)\r\n        {\r\n            _fileStoreDirectory = fileStoreDirectory;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This class is used to create <see cref=\"XmlDataTypeStore\"/>.\r\n        /// Either for existing stores or for just newly created/added stores.\r\n        /// There exist one store for each data type that the provider handles.\r\n        /// While the <see cref=\"XmlDataTypeStore\"/> is created, the input and \r\n        /// configuration is validated.\r\n        /// </summary>\r\n        /// <param name=\"dataTypeDescriptor\"></param>\r\n        /// <param name=\"dataProviderHelperClassType\">The runtime type for the generated implementation of <see cref=\"IXmlDataProviderHelper\"/></param>\r\n        /// <param name=\"dataIdClassType\">The runtime type for the generated data id class.</param>\r\n        /// <param name=\"xmlDataTypeStoreDataScopes\">If this is null, default values will be created.</param>\r\n        /// <returns>\r\n        /// Returns a <see cref=\"XmlDataTypeStore\"/> if it is valid, else null \r\n        /// </returns>\r\n        public XmlDataTypeStore CreateStoreResult(DataTypeDescriptor dataTypeDescriptor, Type dataProviderHelperClassType, Type dataIdClassType, IEnumerable<XmlDataTypeStoreDataScope> xmlDataTypeStoreDataScopes)\r\n        {\r\n            if (xmlDataTypeStoreDataScopes == null)\r\n            {\r\n                var defaultDataScopes = new List<XmlDataTypeStoreDataScope>();\r\n\r\n                IEnumerable<string> cultureNames;\r\n                if (dataTypeDescriptor.Localizeable)\r\n                {\r\n                    cultureNames = DataLocalizationFacade.ActiveLocalizationNames;\r\n                }\r\n                else\r\n                {\r\n                    cultureNames = new[] { CultureInfo.InvariantCulture.Name };\r\n                }\r\n\r\n                foreach (DataScopeIdentifier dataScopeIdentifier in dataTypeDescriptor.DataScopes.Distinct())\r\n                {\r\n                    foreach (string cultureName in cultureNames)\r\n                    {\r\n                        var defaultXmlDataTypeStoreDataScope = new XmlDataTypeStoreDataScope\r\n                        {\r\n                            DataScopeName = dataScopeIdentifier.Name,\r\n                            CultureName = cultureName,\r\n                            ElementName = NamesCreator.MakeElementName(dataTypeDescriptor),\r\n                            Filename = Path.Combine(_fileStoreDirectory, NamesCreator.MakeFileName(dataTypeDescriptor, dataScopeIdentifier, cultureName))\r\n                        };\r\n\r\n                        var document = new XDocument(new XElement(defaultXmlDataTypeStoreDataScope.ElementName));\r\n                        document.SaveToFile(defaultXmlDataTypeStoreDataScope.Filename);\r\n\r\n                        defaultDataScopes.Add(defaultXmlDataTypeStoreDataScope);\r\n                    }\r\n                }\r\n\r\n                xmlDataTypeStoreDataScopes = defaultDataScopes;\r\n            }\r\n            \r\n            return new XmlDataTypeStore(dataTypeDescriptor, dataProviderHelperClassType, dataIdClassType, xmlDataTypeStoreDataScopes, dataTypeDescriptor.IsCodeGenerated);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/XmlDataTypeStoreDataScope.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n    internal sealed class XmlDataTypeStoreDataScope\r\n    {\r\n        internal string DataScopeName { get; set; }\r\n        internal string CultureName { get; set; }\r\n        internal string Filename { get; set; }\r\n        internal string ElementName { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Data/DataProviders/XmlDataProvider/XmlDataTypeStoresContainer.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Plugins.Data.DataProviders.XmlDataProvider\r\n{\r\n    internal sealed class XmlDataTypeStoresContainer\r\n    {\r\n        private readonly string _providerName;\r\n\r\n        private readonly List<Type> _supportedInterfaces = new List<Type>();\r\n        private readonly List<Type> _knownInterfaces = new List<Type>();\r\n        private readonly List<Type> _generatedInterfaces = new List<Type>();\r\n\r\n        // Data type -> XmlDataTypeStore\r\n        private readonly Dictionary<Type, XmlDataTypeStore> _dataTypeStores = new Dictionary<Type, XmlDataTypeStore>();\r\n\r\n\r\n        public XmlDataTypeStoresContainer(string providerName)\r\n        {\r\n            _providerName = providerName;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// All working data types \r\n        /// </summary>\r\n        public IEnumerable<Type> SupportedInterfaces => _supportedInterfaces;\r\n\r\n\r\n        /// <summary>\r\n        /// All data types, including non working due to config error or something else\r\n        /// </summary>\r\n        public IEnumerable<Type> KnownInterfaces => _knownInterfaces;\r\n\r\n\r\n        /// <summary>\r\n        /// All working generated data types\r\n        /// </summary>\r\n        public IEnumerable<Type> GeneratedInterfaces => _generatedInterfaces;\r\n\r\n\r\n        public XmlDataTypeStore GetDataTypeStore(Type interfaceType)\r\n        {\r\n            XmlDataTypeStore result;\r\n\r\n            if (!_dataTypeStores.TryGetValue(interfaceType, out result))\r\n            {\r\n                throw new ArgumentException($\"The interface type '{interfaceType}' is not supported by the XmlDataProvider named '{_providerName}\");\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// This method adds the support of the given data interface type to the xml data provider.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"xmlDataTypeStore\"></param>\r\n        internal void AddSupportedDataTypeStore(Type interfaceType, XmlDataTypeStore xmlDataTypeStore)\r\n        {\r\n            Verify.That(!_dataTypeStores.ContainsKey(interfaceType), $\"Interface type {interfaceType.FullName} has already been registered\");\r\n\r\n            _dataTypeStores.Add(interfaceType, xmlDataTypeStore);\r\n\r\n            _supportedInterfaces.Add(interfaceType);\r\n            AddKnownInterface(interfaceType);\r\n\r\n            if (xmlDataTypeStore.IsGeneratedDataType)\r\n            {\r\n                _generatedInterfaces.Add(interfaceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal void UpdateSupportedDataTypeStore(Type interfaceType, XmlDataTypeStore xmlDataTypeStore)\r\n        {\r\n            Guid typeId = interfaceType.GetImmutableTypeId();\r\n            Type type = _dataTypeStores.Where(f => f.Value.DataTypeDescriptor.DataTypeId == typeId).Select(f => f.Key).Single();\r\n\r\n            _dataTypeStores.Remove(type);\r\n            _dataTypeStores.Add(interfaceType, xmlDataTypeStore);\r\n\r\n            _supportedInterfaces.Remove(type);\r\n            _supportedInterfaces.Add(interfaceType);\r\n\r\n            _knownInterfaces.Remove(type);\r\n            _knownInterfaces.Add(interfaceType);\r\n        }\r\n\r\n\r\n\r\n        internal void AddKnownInterface(Type interfaceType)\r\n        {\r\n            _knownInterfaces.Add(interfaceType);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/AllFunctionsElementProvider.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.Types;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ConfigurationElementType(typeof(AllFunctionsElementProviderData))]\r\n#pragma warning disable 612\r\n    internal sealed class AllFunctionsElementProvider : BaseFunctionProviderElementProvider.BaseFunctionProviderElementProvider, ICustomSearchElementProvider\r\n#pragma warning restore 612\r\n    {\r\n        private const string FunctionsProviderType = \"functions\";\r\n        private const string WidgetFunctionsProviderType = \"widgetFunctions\";\r\n\r\n        public static readonly ResourceHandle DocumentFunctionsIcon = GetIconHandle(\"all-functions-generatedocumentation\");\r\n        private static readonly ResourceHandle TestFunctionIcon = GetIconHandle(\"base-function-function\");\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        private readonly string _providerType;\r\n\r\n\r\n\r\n        public AllFunctionsElementProvider(string providerType)\r\n        {\r\n            _providerType = providerType;\r\n\r\n            if ((_providerType != FunctionsProviderType) && (_providerType != WidgetFunctionsProviderType))\r\n            {\r\n                throw new ArgumentException(string.Format(\"The provider type should be 'functions' or 'widgetFunctions'\"), providerType);\r\n            }\r\n        }\r\n\r\n\r\n        protected override void OnContextSetted()\r\n        {\r\n            string providerName = GetContext().ProviderName;\r\n\r\n            if (_providerType == FunctionsProviderType)\r\n            {\r\n                AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider(typeof(StandardFunctionProviderEntityToken), new StandardFunctionAuxiliarySecurityAncestorProvider(providerName));\r\n            }\r\n            else\r\n            {\r\n                AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider(typeof(StandardWidgetFunctionProviderEntityToken), new StandardFunctionAuxiliarySecurityAncestorProvider(providerName));\r\n            }\r\n        }\r\n\r\n\r\n        protected override string RootFolderLabel\r\n        {\r\n            get\r\n            {\r\n                if (_providerType == FunctionsProviderType)\r\n                {\r\n                    return StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"Plugins.AllFunctionsElementProvider.FunctionRootFolderLabel\");\r\n                }\r\n                else if (_providerType == WidgetFunctionsProviderType)\r\n                {\r\n                    return StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"Plugins.AllFunctionsElementProvider.WidgetFunctionRootFolderLabel\");\r\n                }\r\n                else\r\n                {\r\n                    throw new NotImplementedException();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        protected override string RootFolderToolTip\r\n        {\r\n            get\r\n            {\r\n                if (_providerType == FunctionsProviderType)\r\n                {\r\n                    return StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"Plugins.AllFunctionsElementProvider.FunctionRootFolderToolTip\");\r\n                }\r\n                if (_providerType == WidgetFunctionsProviderType)\r\n                {\r\n                    return StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"Plugins.AllFunctionsElementProvider.WidgetFunctionRootFolderToolTip\");\r\n                }\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n\r\n        protected override IEnumerable<IFunctionTreeBuilderLeafInfo> OnGetFunctionInfos(SearchToken searchToken)\r\n        {\r\n            var castedSearchToken = (AllFunctionsElementProviderSearchToken)searchToken;\r\n\r\n            string loweredKeyword = null;\r\n            if (searchToken != null)\r\n            {\r\n                loweredKeyword = (searchToken.Keyword ?? string.Empty).ToLowerInvariant();\r\n            }\r\n\r\n            foreach (string metaFunctionName in this.MetaFunctionNames.OrderBy(f => f))\r\n            {\r\n                IMetaFunction metaFunction = this.GetMetaFunction(metaFunctionName);\r\n\r\n                if (castedSearchToken == null)\r\n                {\r\n                    yield return\r\n                        new AllFunctionsTreeBuilderLeafInfo\r\n                        {\r\n                            Name = metaFunction.Name,\r\n                            Namespace = metaFunction.Namespace,\r\n                            EntityToken = metaFunction.EntityToken\r\n                        };\r\n                    continue;\r\n                }\r\n\r\n                if (!string.IsNullOrEmpty(loweredKeyword))\r\n                {\r\n                    if (!metaFunction.CompositeName().ToLowerInvariant().Contains(loweredKeyword))\r\n                    {\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                bool shouldBeIncluded = true;\r\n\r\n                if (!string.IsNullOrEmpty(castedSearchToken.AcceptableTypes) &&\r\n                    castedSearchToken.AcceptableTypes != \"__None__\")\r\n                {\r\n                    shouldBeIncluded = false;\r\n\r\n                    foreach (string typeKey in castedSearchToken.AcceptableTypes.Split(';'))\r\n                    {\r\n                        Type type = TypeManager.GetType(typeKey);\r\n\r\n                        // MAW: Negate that string is an IEnumerable - thats just plain stupid.\r\n                        if (type == typeof(IEnumerable) && metaFunction.ReturnType == typeof(String))\r\n                        {\r\n                            continue;\r\n                        }\r\n\r\n                        if (type.IsAssignableFrom(metaFunction.ReturnType)\r\n                            || (metaFunction is IDowncastableFunction\r\n                                && (metaFunction as IDowncastableFunction).ReturnValueIsDowncastable\r\n                                && metaFunction.ReturnType.IsAssignableFrom(type)))\r\n                        {\r\n                            shouldBeIncluded = true;\r\n                            break;\r\n                        }\r\n\r\n\r\n                        if (metaFunction is IWidgetFunction\r\n                                && metaFunction.ReturnType.IsAssignableFrom(type))\r\n                        {\r\n                            shouldBeIncluded = true;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n\r\n                if (shouldBeIncluded)\r\n                {\r\n                    yield return\r\n                        new AllFunctionsTreeBuilderLeafInfo\r\n                        {\r\n                            Name = metaFunction.Name,\r\n                            Namespace = metaFunction.Namespace,\r\n                            EntityToken = metaFunction.EntityToken\r\n                        };\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        protected override IEnumerable<ElementAction> OnGetFunctionActions(IFunctionTreeBuilderLeafInfo function)\r\n        {\r\n            string functionName = function.Namespace + \".\" + function.Name;\r\n\r\n            IMetaFunction metaFunction = GetMetaFunction(functionName);\r\n\r\n            bool isWidget = !(metaFunction is IFunction);\r\n\r\n            if (!isWidget)\r\n            {\r\n                yield return CreateFunctionTesterAction(functionName);\r\n            }\r\n\r\n            yield return new ElementAction(new ActionHandle(new FunctionInfoActionToken(functionName, isWidget)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"AllFunctionsElementProvider.ViewFunctionInformation\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"AllFunctionsElementProvider.ViewFunctionInformationTooltip\"),\r\n                    Disabled = false,\r\n                    Icon = CommonElementIcons.Search,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        ActionGroup = PrimaryActionGroup,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true\r\n                    }\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<ElementAction> OnGetFolderActions()\r\n        {\r\n            yield return new ElementAction(new ActionHandle(new DocumentFunctionsActionToken()))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"AllFunctionsElementProvider.GenerateDocumentation\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"AllFunctionsElementProvider.GenerateDocumentationTooltip\"),\r\n                    Icon = AllFunctionsElementProvider.DocumentFunctionsIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n\r\n        private static ElementAction CreateFunctionTesterAction(string functionName = \"\")\r\n        {\r\n            WorkflowActionToken actionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Workflows.Plugins.Elements.ElementProviders.AllFunctionsElementProvider.FunctionTesterWorkflow\"))\r\n            {\r\n                Payload = functionName\r\n            };\r\n\r\n            return new ElementAction(new ActionHandle(actionToken))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"AllFunctionsElementProvider.FunctionTester.Label\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"AllFunctionsElementProvider.FunctionTester.ToolTip\"),\r\n                    Icon = TestFunctionIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<Type> OnGetEntityTokenTypes()\r\n        {\r\n            yield break;\r\n        }\r\n\r\n\r\n\r\n        protected override IFunctionTreeBuilderLeafInfo OnIsEntityOwner(EntityToken entityToken)\r\n        {\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n\t\t//protected override TreeLockBehavior OnGetTreeLockBehavior()\r\n\t\t//{\r\n\t\t//\treturn TreeLockBehavior.None;\r\n\t\t//}\r\n\r\n\r\n\r\n        private sealed class AllFunctionsTreeBuilderLeafInfo : IFunctionTreeBuilderLeafInfo\r\n        {\r\n            public EntityToken EntityToken\r\n            {\r\n                get;\r\n                internal set;\r\n            }\r\n\r\n            public string Name\r\n            {\r\n                get;\r\n                internal set;\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get;\r\n                internal set;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public SearchToken GetNewSearchToken(EntityToken entityToken)\r\n        {\r\n            return new AllFunctionsElementProviderSearchToken();\r\n        }\r\n\r\n\r\n\r\n        public XmlReader GetSearchFormDefinition(EntityToken entityToken)\r\n        {\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(\"/Administrative/AllFunctionsElementProviderSearchForm.xml\");\r\n\r\n            return markupProvider.GetReader();\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<string, object> GetSearchFormBindings(EntityToken entityToken)\r\n        {\r\n            Dictionary<string, object> bindings = new Dictionary<string, object>();\r\n\r\n            Dictionary<string, string> types = new Dictionary<string, string>();\r\n\r\n            types.Add(\"__None__\", \"None\");\r\n\r\n            foreach (Type type in this.MetaFunctionSupprtedTypes)\r\n            {\r\n                types.Add(TypeManager.SerializeType(type), type.Name);\r\n            }\r\n\r\n            bindings.Add(\"Types\", types);\r\n\r\n            return bindings;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<string> MetaFunctionNames\r\n        {\r\n            get\r\n            {\r\n                switch (_providerType)\r\n                {\r\n                    case FunctionsProviderType:\r\n                        return FunctionFacade.FunctionNames;\r\n\r\n                    case WidgetFunctionsProviderType:\r\n                        return FunctionFacade.WidgetFunctionNames;\r\n\r\n                    default:\r\n                        throw new NotImplementedException();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IMetaFunction GetMetaFunction(string metaFunctionName)\r\n        {\r\n            switch (_providerType)\r\n            {\r\n                case FunctionsProviderType:\r\n                    return FunctionFacade.GetFunction(metaFunctionName);\r\n\r\n                case WidgetFunctionsProviderType:\r\n                    return FunctionFacade.GetWidgetFunction(metaFunctionName);\r\n\r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Type> MetaFunctionSupprtedTypes\r\n        {\r\n            get\r\n            {\r\n                switch (_providerType)\r\n                {\r\n                    case FunctionsProviderType:\r\n                        return FunctionFacade.FunctionSupportedTypes;\r\n\r\n                    case WidgetFunctionsProviderType:\r\n                        return FunctionFacade.WidgetFunctionSupportedTypes;\r\n\r\n                    default:\r\n                        throw new NotImplementedException();\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class AllFunctionsElementProviderSearchToken : SearchToken\r\n    {\r\n        /// <exclude />\r\n        public static AllFunctionsElementProviderSearchToken Build(Type[] functionReturnValueAccetableTypes)\r\n        {\r\n            var token = new AllFunctionsElementProviderSearchToken();\r\n\r\n            var sb = new StringBuilder();\r\n            for (int i = 0; i < functionReturnValueAccetableTypes.Length; i++)\r\n            {\r\n                Type type = functionReturnValueAccetableTypes[i];\r\n                if (i > 0)\r\n                {\r\n                    sb.Append(\";\");\r\n                }\r\n                sb.Append(TypeManager.SerializeType(type));\r\n            }\r\n\r\n            token.AcceptableTypes = sb.ToString();\r\n            return token;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string AcceptableTypes { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(AllFunctionsElementProviderAssembler))]\r\n#pragma warning disable 612\r\n    internal sealed class AllFunctionsElementProviderData : HooklessElementProviderData\r\n#pragma warning restore 612\r\n    {\r\n        private const string _providerTypePropertyName = \"providerType\";\r\n        [ConfigurationProperty(_providerTypePropertyName, IsRequired = true)]\r\n        public string ProviderType\r\n        {\r\n            get { return (string)base[_providerTypePropertyName]; }\r\n            set { base[_providerTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n#pragma warning disable 612\r\n    internal sealed class AllFunctionsElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n#pragma warning restore 612\r\n            AllFunctionsElementProviderData data = (AllFunctionsElementProviderData)objectConfiguration;\r\n\r\n            AllFunctionsElementProvider provider = new AllFunctionsElementProvider(data.ProviderType);\r\n\r\n            return provider;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/AllFunctionsProviderActionExecutor.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.Core.Collections;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider\r\n{\r\n    internal sealed class AllFunctionsProviderActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            string functionNamePrefix = \"\";\r\n            if (entityToken.Id.IndexOf('.') > -1)\r\n            {\r\n                functionNamePrefix = entityToken.Id.Substring(entityToken.Id.IndexOf('.') + 1);\r\n            }\r\n\r\n            bool widgets = entityToken.Id.ToLower().Contains(\"widget\");\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n            string url = UrlUtils.ResolveAdminUrl(string.Format(\"content/views/functiondoc/FunctionDocumentation.aspx?functionPrefix={0}&widgets={1}\", functionNamePrefix, widgets)); \r\n\r\n            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem\r\n                {\r\n                    Url = url,\r\n                    EntityToken = EntityTokenSerializer.Serialize(entityToken, true),\r\n                    ViewId = Guid.NewGuid().ToString(),\r\n                    ViewType = ViewType.Main,\r\n                    Label = \"Documentation\"\r\n                }, currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/DocumentFunctionsActionToken.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.C1Console.Actions;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider\r\n{\r\n    [ActionExecutor(typeof(AllFunctionsProviderActionExecutor))]\r\n\tinternal sealed class DocumentFunctionsActionToken : ActionToken\r\n\t{\r\n        private IEnumerable<PermissionType> _permissionTypes = new PermissionType[] { PermissionType.Read };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return \"\";\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new DocumentFunctionsActionToken();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/FunctionInfoActionExecutor.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.WebClient;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider\r\n{\r\n    internal sealed class FunctionInfoActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            FunctionInfoActionToken urlActionToken = (FunctionInfoActionToken)actionToken;\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n\r\n            string url = UrlUtils.ResolveAdminUrl(@\"content/views/functioninfo/ShowFunctionInfo.aspx\");\r\n            url += \"?Name=\" + urlActionToken.FunctionName + \"&IsWidget=\" + urlActionToken.IsWidgetFunction;\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem\r\n            {\r\n                Url = url,\r\n                Label = urlActionToken.FunctionName,\r\n                ViewId = Guid.NewGuid().ToString(),\r\n                ViewType = ViewType.Main\r\n            }, currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/FunctionInfoActionToken.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider\r\n{\r\n    [ActionExecutor(typeof(FunctionInfoActionExecutor))]\r\n    internal sealed class FunctionInfoActionToken : ActionToken\r\n    {\r\n        private readonly IEnumerable<PermissionType> _permissionTypes = new[] { PermissionType.Add, PermissionType.Edit, PermissionType.Delete, PermissionType.Read, PermissionType.Administrate };\r\n\r\n        public string FunctionName { get; private set; }\r\n        public bool IsWidgetFunction { get; private set; }\r\n\r\n        public FunctionInfoActionToken(string functionName, bool isWidgetFunction = false)\r\n        {\r\n            this.FunctionName = functionName;\r\n            this.IsWidgetFunction = isWidgetFunction;\r\n        }\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"Name\", this.FunctionName);\r\n            StringConversionServices.SerializeKeyValuePair(sb, \"IsWidget\", this.IsWidgetFunction);\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n            string name = StringConversionServices.DeserializeValueString(dic[\"Name\"]);\r\n            bool isWidget = StringConversionServices.DeserializeValueBool(dic[\"IsWidget\"]);\r\n\r\n            return new FunctionInfoActionToken(name, isWidget);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/StandardFunctionAuxiliarySecurityAncestorProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider\r\n{\r\n    internal class StandardFunctionAuxiliarySecurityAncestorProvider : IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private readonly string _providerName;\r\n\r\n\r\n        public StandardFunctionAuxiliarySecurityAncestorProvider(string providerName)\r\n        {\r\n            _providerName = providerName;\r\n        }\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            Dictionary<EntityToken, IEnumerable<EntityToken>> result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                string functionName = entityToken.Id;\r\n\r\n                int index = functionName.LastIndexOf('.');\r\n\r\n                string folderName = functionName.Remove(index);\r\n                string id = BaseFunctionProviderElementProvider.BaseFunctionProviderElementProvider.CreateId(folderName, _providerName);\r\n\r\n                EntityToken resultEntityToken = new BaseFunctionFolderElementEntityToken(id);\r\n\r\n\r\n                if (!result.TryGetValue(entityToken, out IEnumerable<EntityToken> resultEntityTokens))\r\n                {\r\n                    resultEntityTokens = new List<EntityToken>();\r\n                    result.Add(entityToken, resultEntityTokens);\r\n                }\r\n\r\n                (resultEntityTokens as List<EntityToken>).Add(resultEntityToken);\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/BaseFunctionProviderElementProvider/BaseFunctionFolderElementEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(BaseFunctionFolderElementEntityTokenSecurityAncestorProvider))]\r\n\tpublic sealed class BaseFunctionFolderElementEntityToken : EntityToken\r\n\t{\r\n        private readonly string _id;\r\n        private string _elementProviderName;\r\n        private string _functionNamespace;\r\n\r\n        /// <exclude />\r\n        public BaseFunctionFolderElementEntityToken(string elementProviderName, string functionNamespace)\r\n        {\r\n            Verify.ArgumentCondition(!elementProviderName.Contains('.'), \"elementProviderName\", \"Function element provider name can't contain '.' symbol in its name\");\r\n\r\n            if (functionNamespace == \"\")\r\n            {\r\n                _id = \"ROOT:\" + elementProviderName;\r\n            }\r\n            else\r\n            {\r\n                _id = \"ROOT:{0}.{1}\".FormatWith(elementProviderName, functionNamespace);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public BaseFunctionFolderElementEntityToken(string id)\r\n        {\r\n            _id = id;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the function namespace.\r\n        /// </summary>\r\n        [JsonIgnore]\r\n        public string FunctionNamespace\r\n        {\r\n            get\r\n            {\r\n                ParseId();\r\n                return _functionNamespace;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the name of the function provider.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The name of the function provider.\r\n        /// </value>\r\n        [JsonIgnore]\r\n        public string ElementProviderName\r\n        {\r\n            get\r\n            {\r\n                ParseId();\r\n                return _elementProviderName;\r\n            }\r\n        }\r\n\r\n        private void ParseId()\r\n        {\r\n            if(_elementProviderName != null) return;\r\n\r\n            const string prefix = \"ROOT:\";\r\n\r\n            Verify.That(_id.StartsWith(prefix), \"Id should start with prefix '{0}'\", prefix);\r\n\r\n            string providerAndNamespace = _id.Substring(prefix.Length);\r\n            int pointOffset = providerAndNamespace.IndexOf('.');\r\n\r\n            if(pointOffset == -1)\r\n            {\r\n                _functionNamespace = null;\r\n                Thread.MemoryBarrier();\r\n                _elementProviderName = providerAndNamespace;\r\n            }\r\n            else\r\n            {\r\n                _functionNamespace = providerAndNamespace.Substring(pointOffset + 1);\r\n                Thread.MemoryBarrier();\r\n                _elementProviderName = providerAndNamespace.Substring(0, pointOffset);\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            string type, source, id;\r\n\r\n            EntityToken.DoDeserialize(serializedData, out type, out source, out id);\r\n\r\n            return new BaseFunctionFolderElementEntityToken(id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/BaseFunctionProviderElementProvider/BaseFunctionFolderElementEntityTokenExtensions.cs",
    "content": "namespace Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider\r\n{\r\n    internal static class BaseFunctionFolderElementEntityTokenExtensions\r\n\t{\r\n        public static string GetNamespace(this BaseFunctionFolderElementEntityToken entityToken)\r\n        {\r\n            int index = entityToken.Id.IndexOf('.');\r\n\r\n            if (index != -1)\r\n            {\r\n                return entityToken.Id.Remove(0, index + 1);\r\n            }\r\n            else\r\n            {\r\n                return entityToken.Id;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/BaseFunctionProviderElementProvider/BaseFunctionFolderElementEntityTokenSecurityAncestorProvider.cs",
    "content": "using System.Text;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider\r\n{\r\n    internal sealed class BaseFunctionFolderElementEntityTokenSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            BaseFunctionFolderElementEntityToken token = (BaseFunctionFolderElementEntityToken)entityToken;\r\n\r\n            int index = token.Id.LastIndexOf('.');\r\n            if (index != -1)\r\n            {\r\n                return new EntityToken[] { new BaseFunctionFolderElementEntityToken(token.Id.Remove(index)) };\r\n            }\r\n            else\r\n            {\r\n                return new EntityToken[] { };\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/BaseFunctionProviderElementProvider/BaseFunctionProviderElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Collections;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Functions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing SR = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public abstract class BaseFunctionProviderElementProvider : IHooklessElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle Function { get { return GetIconHandle(\"base-function-function\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle FunctionError { get { return GetIconHandle(\"error\"); } }\r\n\r\n        /// <exclude />\r\n        protected virtual void OnContextSetted() { }\r\n\r\n        /// <exclude />\r\n        protected abstract IEnumerable<IFunctionTreeBuilderLeafInfo> OnGetFunctionInfos(SearchToken searchToken);\r\n\r\n        /// <exclude />\r\n        protected abstract IEnumerable<Type> OnGetEntityTokenTypes();\r\n\r\n        /// <exclude />\r\n        protected abstract IFunctionTreeBuilderLeafInfo OnIsEntityOwner(EntityToken entityToken);\r\n\r\n        /// <exclude />\r\n        protected abstract string RootFolderLabel { get; }\r\n\r\n        /// <exclude />\r\n        protected abstract string RootFolderToolTip { get; }\r\n\r\n        /// <exclude />\r\n        protected virtual ResourceHandle FolderIcon { get { return CommonElementIcons.Folder; } }\r\n\r\n        /// <exclude />\r\n        protected virtual ResourceHandle OpenFolderIcon { get { return CommonElementIcons.FolderOpen; } }\r\n\r\n        /// <exclude />\r\n        protected virtual ResourceHandle EmptyFolderIcon { get { return CommonElementIcons.Folder; } }\r\n\r\n        /// <exclude />\r\n        protected virtual ResourceHandle FunctionIcon { get { return CommonElementIcons.Data; } }\r\n\r\n        /// <exclude />\r\n        protected virtual IEnumerable<ElementAction> OnGetFolderActions() { return null; }\r\n\r\n        /// <exclude />\r\n        protected virtual IEnumerable<ElementAction> OnGetFunctionActions(IFunctionTreeBuilderLeafInfo function) { return null; }\r\n\r\n        /// <exclude />\r\n        protected virtual TreeLockBehavior OnGetTreeLockBehavior() { return TreeLockBehavior.Normal; }\r\n\r\n\r\n        /// <exclude />\r\n        public BaseFunctionProviderElementProvider()\r\n        {\r\n            foreach (Type entityTokenType in OnGetEntityTokenTypes())\r\n            {\r\n                AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider(entityTokenType, this);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ElementProviderContext Context\r\n        {\r\n            set\r\n            {\r\n                _context = value;\r\n\r\n                OnContextSetted();\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected ElementProviderContext GetContext()\r\n        {\r\n            return _context;\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets the name of the function provider.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The name of the function provider.\r\n        /// </value>\r\n        /// <exclude />\r\n        /// <exception cref=\"System.NotImplementedException\"></exception>\r\n        public virtual string FunctionProviderName\r\n        {\r\n            get { throw new NotImplementedException(); }\r\n        }\r\n\r\n\r\n        #region Element methods\r\n        /// <exclude />\r\n        public IEnumerable<Element> GetRoots(SearchToken searchToken)\r\n        {\r\n            NamespaceTreeBuilder builder = new NamespaceTreeBuilder(OnGetFunctionInfos(searchToken).Cast<INamespaceTreeBuilderLeafInfo>());\r\n\r\n            bool hasChildren = (builder.RootFolder.SubFolders.Count != 0) || (builder.RootFolder.Leafs.Count != 0);\r\n\r\n            Element element = new Element(_context.CreateElementHandle(new BaseFunctionFolderElementEntityToken(CreateId(\"\", _context.ProviderName))))\r\n                {\r\n                    VisualData = new ElementVisualizedData()\r\n                        {\r\n                            Label = RootFolderLabel,\r\n                            ToolTip = RootFolderToolTip,\r\n                            HasChildren = hasChildren,\r\n                            Icon = hasChildren ? this.FolderIcon : this.EmptyFolderIcon,\r\n                            OpenedIcon = OpenFolderIcon\r\n                        }\r\n                };\r\n            element.TreeLockBehavior = OnGetTreeLockBehavior();\r\n\r\n            IEnumerable<ElementAction> actions = OnGetFolderActions();\r\n            if (actions != null)\r\n            {\r\n                foreach (ElementAction action in actions)\r\n                {\r\n                    element.AddAction(action);\r\n                }\r\n            }\r\n\r\n            return new List<Element> { element };\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            BaseFunctionFolderElementEntityToken castedEntityToken = (BaseFunctionFolderElementEntityToken)entityToken;\r\n\r\n            string id = castedEntityToken.Id;\r\n\r\n            int index = castedEntityToken.Id.IndexOf('.');\r\n            if (index != -1)\r\n            {\r\n                id = id.Remove(0, index + 1);\r\n            }\r\n\r\n            NamespaceTreeBuilder builder = new NamespaceTreeBuilder(OnGetFunctionInfos(searchToken).Cast<INamespaceTreeBuilderLeafInfo>());\r\n\r\n            NamespaceTreeBuilderFolder folderNode;\r\n\r\n            if (castedEntityToken.Id == CreateId(\"\", _context.ProviderName))\r\n            {\r\n                folderNode = builder.RootFolder;\r\n            }\r\n            else\r\n            {\r\n                folderNode = builder.GetFolder(id);\r\n            }\r\n\r\n            List<Element> result = new List<Element>();\r\n            if (searchToken == null)\r\n            {\r\n                if (folderNode != null)\r\n                {\r\n                    foreach (NamespaceTreeBuilderFolder node in folderNode.SubFolders.OrderBy(f => f.Name))\r\n                    {\r\n                        Element element = CreateFolderElement(node);\r\n                        result.Add(element);\r\n                    }\r\n\r\n                    foreach (IFunctionTreeBuilderLeafInfo function in folderNode.Leafs)\r\n                    {\r\n                        Element element = CreateFunctionElement(function);\r\n\r\n                        element.PropertyBag.Add(\"ElementType\", \"application/x-composite-function\");\r\n                        element.PropertyBag.Add(\"ElementId\", IMetaFunctionExtensionMethods.CompositeName(function.Namespace, function.Name));\r\n\r\n                        result.Add(element);\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (folderNode != null)\r\n                {\r\n                    foreach (NamespaceTreeBuilderFolder node in folderNode.SubFolders.OrderBy(f => f.Name))\r\n                    {\r\n                        if (SubTreeContainsToken(node, searchToken))\r\n                        {\r\n                            Element element = CreateFolderElement(node);\r\n                            result.Add(element);\r\n                        }\r\n                    }\r\n\r\n                    foreach (IFunctionTreeBuilderLeafInfo function in folderNode.Leafs)\r\n                    {\r\n                        if (searchToken.Keyword == null || function.Name.Contains(searchToken.Keyword))\r\n                        {\r\n                            Element element = CreateFunctionElement(function);\r\n\r\n                            element.PropertyBag.Add(\"ElementType\", \"application/x-composite-function\");\r\n                            element.PropertyBag.Add(\"ElementId\", IMetaFunctionExtensionMethods.CompositeName(function.Namespace, function.Name));\r\n\r\n                            result.Add(element);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private bool SubTreeContainsToken(NamespaceTreeBuilderFolder folder, SearchToken searchToken)\r\n        {\r\n            if (string.IsNullOrEmpty(searchToken.Keyword))\r\n            {\r\n                return true;\r\n\r\n            }\r\n\r\n            if (folder.Name.Contains(searchToken.Keyword))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            foreach (INamespaceTreeBuilderLeafInfo leaf in folder.Leafs)\r\n            {\r\n                if (leaf.Name.Contains(searchToken.Keyword))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n            foreach (NamespaceTreeBuilderFolder subFolder in folder.SubFolders)\r\n            {\r\n                if (SubTreeContainsToken(subFolder, searchToken))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        private Element CreateFolderElement(NamespaceTreeBuilderFolder node)\r\n        {\r\n            bool hasChildren = (node.SubFolders.Count != 0) || (node.Leafs.Count != 0);\r\n\r\n            var element = new Element(_context.CreateElementHandle(new BaseFunctionFolderElementEntityToken(CreateId(node, _context.ProviderName))))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = node.Name,\r\n                    ToolTip = node.Name,\r\n                    HasChildren = (node.SubFolders.Count != 0) || (node.Leafs.Count != 0),\r\n                    Icon = hasChildren ? this.FolderIcon : this.EmptyFolderIcon,\r\n                    OpenedIcon = this.OpenFolderIcon\r\n                },\r\n                TreeLockBehavior = OnGetTreeLockBehavior()\r\n            };\r\n\r\n            IEnumerable<ElementAction> actions = OnGetFolderActions();\r\n            if (actions != null)\r\n            {\r\n                foreach (ElementAction action in actions)\r\n                {\r\n                    element.AddAction(action);\r\n                }\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        private Element CreateFunctionElement(IFunctionTreeBuilderLeafInfo function)\r\n        {\r\n            IMetaFunction functionDetails;\r\n\r\n            if (FunctionFacade.TryGetFunction(out functionDetails, string.Format(\"{0}.{1}\", function.Namespace, function.Name), typeof(IFunction)) == false)\r\n            {\r\n                FunctionFacade.TryGetFunction(out functionDetails, string.Format(\"{0}.{1}\", function.Namespace, function.Name), typeof(IWidgetFunction));\r\n            }\r\n\r\n            string functionTooltip = (functionDetails == null || string.IsNullOrEmpty(functionDetails.Description) ? function.Name : StringResourceSystemFacade.ParseString(functionDetails.Description));\r\n\r\n            var intitializationInfo = functionDetails as IFunctionInitializationInfo;\r\n            bool functionWerentLoadedCorrectly = intitializationInfo != null && !intitializationInfo.FunctionInitializedCorrectly;\r\n\r\n            Element element = new Element(_context.CreateElementHandle(function.EntityToken))\r\n            {\r\n                VisualData = new ElementVisualizedData()\r\n                {\r\n                    Label = function.Name,\r\n                    ToolTip = functionTooltip,\r\n                    HasChildren = false,\r\n                    Icon = functionWerentLoadedCorrectly ? BaseFunctionProviderElementProvider.FunctionError : BaseFunctionProviderElementProvider.Function\r\n                }\r\n            };\r\n\r\n            element.TreeLockBehavior = OnGetTreeLockBehavior();\r\n\r\n            IEnumerable<ElementAction> actions = OnGetFunctionActions(function);\r\n            if (actions != null)\r\n            {\r\n                foreach (ElementAction action in actions)\r\n                {\r\n                    element.AddAction(action);\r\n                }\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string CreateId(NamespaceTreeBuilderFolder folderNode, string providerName)\r\n        {\r\n            if (folderNode.Namespace == \"\")\r\n            {\r\n                return CreateId(folderNode.Name, providerName);\r\n            }\r\n            \r\n            return CreateId(string.Format(\"{0}.{1}\", folderNode.Namespace, folderNode.Name), providerName);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string CreateId(string namespaceName, string providerName)\r\n        {\r\n            if (namespaceName == \"\")\r\n            {\r\n                return string.Format(\"ROOT:{0}\", providerName);\r\n            }\r\n            \r\n            return string.Format(\"ROOT:{0}.{1}\", providerName, namespaceName);\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            Dictionary<EntityToken, IEnumerable<EntityToken>> result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                IFunctionTreeBuilderLeafInfo functionTreeBuilderLeafInfo = OnIsEntityOwner(entityToken);\r\n                if (functionTreeBuilderLeafInfo == null) continue;\r\n\r\n                BaseFunctionFolderElementEntityToken parentEntityToken = new BaseFunctionFolderElementEntityToken(CreateId(functionTreeBuilderLeafInfo.Namespace, _context.ProviderName));\r\n\r\n                result.Add(entityToken, new EntityToken[] { parentEntityToken });\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/BaseFunctionProviderElementProvider/IFunctionTreeBuilderLeafInfo.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.Core.Collections;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public interface IFunctionTreeBuilderLeafInfo : INamespaceTreeBuilderLeafInfo\r\n\t{\r\n        /// <exclude />\r\n        EntityToken EntityToken { get; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/DeveloperApplicationProvider/DeveloperApplicationProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.DeveloperApplicationProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableHooklessElementProvider))]\r\n    internal sealed class DeveloperApplicationProvider : IHooklessElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n\r\n\r\n        private static ResourceHandle TreeDefinitionsRootIcon = GetIconHandle(\"developerapplication-treedefinitionroot\");\r\n        private static ResourceHandle TreeDefinitionIcon = GetIconHandle(\"developerapplication-treedefinition\");\r\n        private static ResourceHandle TreeDefinitionIconAdd = GetIconHandle(\"developerapplication-treedefinition-add\");\r\n        private static ResourceHandle TreeDefinitionIconEdit = GetIconHandle(\"developerapplication-treedefinition-edit\");\r\n        private static ResourceHandle TreeDefinitionIconDelete = GetIconHandle(\"developerapplication-treedefinition-delete\");\r\n\r\n\r\n        public DeveloperApplicationProvider()\r\n        {\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DeveloperApplicationProviderEntityToken>(this);\r\n\r\n            foreach (string treeDefinitionFilename in this.TreeDefinitionFilenames)\r\n            {\r\n                string filename = Path.GetFileName(treeDefinitionFilename);\r\n\r\n                DeveloperApplicationProviderEntityToken entityToken = new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeDefinitionId, filename);\r\n\r\n                TreeFacade.AddCustomAttachmentPoint(filename, entityToken);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            Element treeRootFolderElement = new Element(_context.CreateElementHandle(new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeRootFolderId)))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = \"Tree Definitions\",\r\n                    ToolTip = \"Tree Definitions\",\r\n                    HasChildren = this.TreeDefinitionFilenames.Count() > 0,\r\n                    Icon = TreeDefinitionsRootIcon\r\n                }\r\n            };\r\n\r\n            treeRootFolderElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.AddTreeDefinitionWorkflow\"), PermissionTypePredefined.Add)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeAddTreeDefinitionWorkflow.AddNew.Label\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeAddTreeDefinitionWorkflow.AddNew.ToolTip\"),\r\n                    Icon = TreeDefinitionIconAdd,\r\n                    Disabled = false,\r\n                    ActionLocation = ActionLocation.AddPrimaryActionLocation\r\n                }\r\n            });\r\n\r\n\r\n\r\n            yield return treeRootFolderElement;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            if (entityToken.Id == DeveloperApplicationProviderEntityToken.TreeRootFolderId)\r\n            {\r\n                foreach (string treeDefinitionFilename in this.TreeDefinitionFilenames)\r\n                {\r\n                    string filename = Path.GetFileName(treeDefinitionFilename);\r\n\r\n                    Element treeDefintionElement = new Element(_context.CreateElementHandle(\r\n                        new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeDefinitionId, filename)))\r\n                    {\r\n                        VisualData = new ElementVisualizedData\r\n                        {\r\n                            Label = filename,\r\n                            ToolTip = filename,\r\n                            Icon = TreeDefinitionIcon\r\n                        }\r\n                    };\r\n\r\n                    treeDefintionElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.DeleteTreeDefinitionWorkflow\"), PermissionTypePredefined.Delete)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeDeleteTreeDefinitionWorkflow.Delete.Label\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeDeleteTreeDefinitionWorkflow.Delete.ToolTip\"),\r\n                            Icon = TreeDefinitionIconDelete,\r\n                            Disabled = false,\r\n                            ActionLocation = ActionLocation.DeletePrimaryActionLocation\r\n                        }\r\n                    });\r\n\r\n                    treeDefintionElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Trees.Workflows.EditTreeDefinitionWorkflow\"), PermissionTypePredefined.Edit)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeDeleteTreeDefinitionWorkflow.Edit.Label\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeDeleteTreeDefinitionWorkflow.Edit.ToolTip\"),\r\n                            Icon = TreeDefinitionIconEdit,\r\n                            Disabled = false,\r\n                            ActionLocation = ActionLocation.EditPrimaryActionLocation\r\n                        }\r\n                    });\r\n\r\n                    yield return treeDefintionElement;\r\n                }\r\n\r\n                yield break;\r\n            }\r\n            else if (entityToken.Id == DeveloperApplicationProviderEntityToken.TreeDefinitionId)\r\n            {\r\n                //DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)entityToken;\r\n\r\n                //foreach (Element element in TreeFacade.GetElementsByTreeId(castedEntityToken.Filename, entityToken, new Dictionary<string, string>()))\r\n                //{\r\n                //    yield return element;\r\n                //}\r\n            }\r\n\r\n            yield break;\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            Dictionary<EntityToken, IEnumerable<EntityToken>> result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                if (entityToken is DeveloperApplicationProviderEntityToken)\r\n                {\r\n                    switch (entityToken.Id)\r\n                    {\r\n                        case DeveloperApplicationProviderEntityToken.TreeDefinitionId:\r\n                            result.Add(entityToken, new EntityToken[] { new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeRootFolderId) });\r\n                            break;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<string> TreeDefinitionFilenames\r\n        {\r\n            get\r\n            {\r\n                return C1Directory.GetFiles(PathUtil.Resolve(GlobalSettingsFacade.TreeDefinitionsDirectory), \"*.xml\");\r\n            }\r\n        }\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/DeveloperApplicationProvider/DeveloperApplicationProviderEntityToken.cs",
    "content": "﻿using System.IO;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.DeveloperApplicationProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    public sealed class DeveloperApplicationProviderEntityToken : EntityToken\r\n    {        \r\n        private string _id;\r\n        private string _source;\r\n\r\n\r\n        /// <exclude />\r\n        public const string TreeRootFolderId = \"TreeFolder\";\r\n\r\n        /// <exclude />\r\n        public const string TreeDefinitionId = \"TreeDefinition\";\r\n\r\n\r\n        /// <exclude />\r\n        public DeveloperApplicationProviderEntityToken(string id)\r\n            :this(id, \"\")\r\n        {                        \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public DeveloperApplicationProviderEntityToken(string id, string source)\r\n        {\r\n            _id = id;\r\n            _source = source;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public string Filename\r\n        {\r\n            get { return this.Source; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public string FullTreePath\r\n        {\r\n            get\r\n            {                \r\n                return Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TreeDefinitionsDirectory), this.Filename);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            \r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new DeveloperApplicationProviderEntityToken(id, source);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteDataWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteDataWorkflow\" Location=\"30; 30\" Size=\"1164; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteDataWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteDataWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"911\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"911\" Y=\"527\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initialstateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initialstateActivity\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"361\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"361\" Y=\"292\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"finializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finializeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"742\" Y=\"492\" />\r\n\t\t\t\t<ns0:Point X=\"911\" Y=\"492\" />\r\n\t\t\t\t<ns0:Point X=\"911\" Y=\"527\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finializeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finializeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1SventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"459\" Y=\"357\" />\r\n\t\t\t\t<ns0:Point X=\"643\" Y=\"357\" />\r\n\t\t\t\t<ns0:Point X=\"643\" Y=\"451\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"463\" Y=\"381\" />\r\n\t\t\t\t<ns0:Point X=\"911\" Y=\"381\" />\r\n\t\t\t\t<ns0:Point X=\"911\" Y=\"527\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialstateActivity\" Location=\"63; 105\" Size=\"197; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initialStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"81; 198\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finializeStateActivity\" Location=\"541; 451\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"537; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"547; 210\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"547; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"547; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"831; 527\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"256; 292\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"264; 323\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"274; 385\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1SventDrivenActivity_Finish\" Location=\"264; 347\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"274; 409\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"274; 469\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"264; 371\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"274; 433\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"274; 493\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditFormWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditFormWorkflow\" Location=\"30; 30\" Size=\"1160; 645\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditFormWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditFormWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"613\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"613\" Y=\"103\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"247\" />\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"247\" />\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"259\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"262\" Y=\"324\" />\r\n\t\t\t\t<ns0:Point X=\"293\" Y=\"324\" />\r\n\t\t\t\t<ns0:Point X=\"293\" Y=\"289\" />\r\n\t\t\t\t<ns0:Point X=\"461\" Y=\"289\" />\r\n\t\t\t\t<ns0:Point X=\"461\" Y=\"297\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"570\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"570\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"259\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"63; 105\" Size=\"197; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initialStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"92; 259\" Size=\"189; 94\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"359; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"369; 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Save\" Location=\"351; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"361; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"361; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"359; 297\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"367; 328\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"377; 390\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"377; 450\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"533; 103\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/GeneratedDataTypesElementDynamicActionTokens.cs",
    "content": "﻿using Composite.C1Console.Actions;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Application;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    /// <summary>\r\n    /// Here we register default actions for generated data type elements\r\n    /// </summary>\r\n    [ApplicationStartup]\r\n    public static class GeneratedDataTypesElementDynamicActionTokens\r\n    {\r\n        /// <exclude />\r\n        public static void OnBeforeInitialize()\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void OnInitialized(DataActionTokenResolver resolver)\r\n        {\r\n            resolver.RegisterDefault<IData>(ActionIdentifier.Edit, f => new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.EditDataWorkflow\")));\r\n            resolver.RegisterDefault<IData>(ActionIdentifier.Delete, f => new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.DeleteDataWorkflow\")));\r\n            resolver.RegisterDefault<IData>(ActionIdentifier.Duplicate, f => new DuplicateActionToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/GeneratedDataTypesElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_GeneratedDataTypesElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    #region ToXml\r\n    internal sealed class DataTypeDescriptorToXmlActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            GeneratedDataTypesElementProviderTypeEntityToken castedEntityToken = (GeneratedDataTypesElementProviderTypeEntityToken)entityToken;\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            string url = string.Format(\"{0}?TypeName={1}\", UrlUtils.ResolveAdminUrl(\"content/views/datatypedescriptor/ToXml.aspx\"), System.Web.HttpUtility.UrlEncode(castedEntityToken.SerializedTypeName));\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(\r\n                new OpenViewMessageQueueItem\r\n                {\r\n                    EntityToken = EntityTokenSerializer.Serialize(entityToken, true),\r\n                    Url = url,\r\n                    ViewId = Guid.NewGuid().ToString(),\r\n                    ViewType = ViewType.Main,\r\n                    Label = GeneratedDataTypesElementProvider.GetText(\"DataTypeDescriptorToXmlLabel\")\r\n                },\r\n                currentConsoleId\r\n            );\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ActionExecutor(typeof(DataTypeDescriptorToXmlActionExecutor))]\r\n    public sealed class DataTypeDescriptorToXmlActionToken : ActionToken\r\n    {\r\n        private static readonly PermissionType[] _permissionTypes = { PermissionType.Administrate };\r\n\r\n        /// <exclude />\r\n        public override IEnumerable<PermissionType> PermissionTypes => _permissionTypes;\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return \"DataTypeDescriptorToXml\";\r\n        }\r\n\r\n        /// <exclude />\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new DataTypeDescriptorToXmlActionToken();\r\n        }\r\n    }\r\n    #endregion\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(GeneratedDataTypesElementProviderData))]\r\n    internal sealed class GeneratedDataTypesElementProvider : IHooklessElementProvider, ILocaleAwareElementProvider\r\n    {\r\n        private static readonly string LogTitle = typeof (GeneratedDataTypesElementProvider).Name;\r\n\r\n        private ElementProviderContext _providerContext;\r\n        private readonly bool _websiteItemsView;\r\n        private DataGroupingProviderHelper _dataGroupingProviderHelper;\r\n\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle RootOpen => GetIconHandle(\"generated-root-open\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle RootClosed => GetIconHandle(\"generated-root-closed\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle DynamicDataTypeIconOpen => GetIconHandle(\"generated-type-open\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle DynamicDataTypeIconClosed => GetIconHandle(\"generated-type-closed\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle InterfaceOpen => GetIconHandle(\"data-interface-open\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle InterfaceClosed => GetIconHandle(\"data-interface-closed\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle AddDataTypeIcon => GetIconHandle(\"generated-type-add\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle EditDataTypeIcon => GetIconHandle(\"generated-type-edit\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle DeleteDataTypeIcon => GetIconHandle(\"generated-type-delete\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle LocalizeDataTypeIcon => GetIconHandle(\"generated-type-localize\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle DelocalizeDataTypeIcon => GetIconHandle(\"generated-type-delocalize\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle AddDataIcon => GetIconHandle(\"generated-type-data-add\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle DuplicateDataIcon => GetIconHandle(\"copy\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle EditDataIcon => GetIconHandle(\"generated-type-data-edit\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle DeleteDataIcon => GetIconHandle(\"generated-type-data-delete\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle LocalizeDataIcon => GetIconHandle(\"generated-type-data-localize\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle ListUnpublishedItemsIcon = GetIconHandle(\"generated-type-list-unpublished-items\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle ShowincontentareaIcon = GetIconHandle(\"generated-type-showincontentarea\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle EditFormMarkupIcon => GetIconHandle(\"generated-type-form-markup-edit\");\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle ToXmlIcon => GetIconHandle(\"generated-type-to-xml\");\r\n\r\n        /// <exclude />\r\n        public static readonly Dictionary<string, ResourceHandle> DataIconLookup;\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle ErrorIcon => GetIconHandle(\"error\");\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n        private static readonly ActionGroup ViewActionGroup = new ActionGroup(\"View\", ActionGroupPriority.PrimaryLow);\r\n        private static readonly ActionGroup AppendedActionGroup = new ActionGroup(\"Develop\", ActionGroupPriority.GeneralAppendMedium);\r\n\r\n        private static readonly PermissionType[] _addNewInterfaceTypePermissionTypes = { PermissionType.Add };\r\n        private static readonly PermissionType[] _editInterfaceTypePermissionTypes = { PermissionType.Edit };\r\n        private static readonly PermissionType[] _editFormMarkupPermissionTypes = { PermissionType.Edit };\r\n        private static readonly PermissionType[] _deleteInterfaceTypePermissionTypes = { PermissionType.Delete };\r\n\r\n        private static readonly PermissionType[] _addNewDataPermissionTypes = { PermissionType.Add };\r\n        private static readonly PermissionType[] _editDataPermissionTypes = { PermissionType.Edit };\r\n        private static readonly PermissionType[] _deleteDataPermissionTypes = { PermissionType.Delete };\r\n        private static readonly PermissionType[] _localizeDataPermissionTypes = { PermissionType.Add };\r\n\r\n\r\n\r\n        /// <exclude />\r\n        static GeneratedDataTypesElementProvider()\r\n        {\r\n            DataIconLookup = new Dictionary<string, ResourceHandle>\r\n            {\r\n                {GenericPublishProcessController.Draft, DataIconFacade.DataDraftIcon},\r\n                {GenericPublishProcessController.AwaitingApproval, DataIconFacade.DataAwaitingApprovalIcon},\r\n                {GenericPublishProcessController.AwaitingPublication, DataIconFacade.DataAwaitingPublicationIcon},\r\n                {GenericPublishProcessController.Published, DataIconFacade.DataPublishedIcon}\r\n            };\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public GeneratedDataTypesElementProvider(bool onlyShowGlobalDatas)\r\n        {\r\n            _websiteItemsView = onlyShowGlobalDatas;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ElementProviderContext Context\r\n        {\r\n            set\r\n            {\r\n                _providerContext = value;\r\n                _dataGroupingProviderHelper = new DataGroupingProviderHelper(_providerContext)\r\n                {\r\n                    FolderOpenIcon = InterfaceOpen,\r\n                    FolderClosedIcon = InterfaceClosed,\r\n                    OnCreateLeafElement = GetElementFromData,\r\n                    OnCreateGhostedLeafElement = GetGhostedElementFromData,\r\n                    OnCreateDisabledLeafElement = GetDisabledElementFromData,\r\n                    OnAddActions = AddGroupFolderActions,\r\n                    OnGetRootParentEntityToken = GetRootParentEntityToken,\r\n                    OnOwnsType = type =>\r\n                    {\r\n                        if (!type.IsGenerated() && !type.IsStaticDataType()) return false;\r\n                        if (PageFolderFacade.GetAllFolderTypes().Contains(type)) return false;\r\n                        if (PageMetaDataFacade.GetAllMetaDataTypes().Contains(type)) return false;\r\n\r\n                        return !_websiteItemsView || IsTypeWhiteListed(type);\r\n                    },\r\n                    OnGetPayload = token => null\r\n                };\r\n            }\r\n        }\r\n        \r\n\r\n\r\n        /// <exclude />\r\n        public bool ContainsLocalizedData\r\n        {\r\n            get\r\n            {\r\n                return DataFacade.GetGeneratedInterfaces().Any(DataLocalizationFacade.IsLocalized);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            List<Element> roots = new List<Element>();\r\n\r\n            Element globalDataElement;\r\n            if (_websiteItemsView)\r\n            {\r\n                globalDataElement = new Element(_providerContext.CreateElementHandle(new GeneratedDataTypesElementProviderRootEntityToken(_providerContext.ProviderName, GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = Texts.GlobalDataFolderLabel_OnlyGlobalData,\r\n                        ToolTip = Texts.GlobalDataFolderToolTip_OnlyGlobalData,\r\n                        HasChildren = true,\r\n                        Icon = GeneratedDataTypesElementProvider.InterfaceClosed,\r\n                        OpenedIcon = GeneratedDataTypesElementProvider.InterfaceOpen\r\n                    }\r\n                };\r\n            }\r\n            else\r\n            {\r\n                globalDataElement = new Element(_providerContext.CreateElementHandle(new GeneratedDataTypesElementProviderRootEntityToken(_providerContext.ProviderName, GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId)))\r\n                    {\r\n                        VisualData = new ElementVisualizedData\r\n                        {\r\n                            Label = Texts.GlobalDataFolderLabel,\r\n                            ToolTip = Texts.GlobalDataFolderToolTip,\r\n                            HasChildren = GlobalDataTypeFacade.GetAllGlobalDataTypes().Any() || DataFacade.GetAllKnownInterfaces().Any(t => t.IsStaticDataType()),\r\n                            Icon = GeneratedDataTypesElementProvider.RootClosed,\r\n                            OpenedIcon = GeneratedDataTypesElementProvider.RootOpen\r\n                        }\r\n                    };\r\n            }\r\n\r\n            if (!_websiteItemsView)\r\n            {\r\n                globalDataElement.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.AddNewInterfaceTypeWorkflow\"), _addNewInterfaceTypePermissionTypes) { Payload = _providerContext.ProviderName }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"Add\"),\r\n                            ToolTip = GetText(\"AddToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.AddDataTypeIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n            }\r\n\r\n            if (_websiteItemsView)\r\n            {\r\n                globalDataElement.AddAction(\r\n                new ElementAction(new ActionHandle(new ViewUnpublishedItemsActionToken()))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = GetText(\"ViewUnpublishedItems\"),\r\n                        ToolTip = GetText(\"ViewUnpublishedItemsToolTip\"),\r\n                        Icon = GeneratedDataTypesElementProvider.ListUnpublishedItemsIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Other,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = ViewActionGroup\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n\r\n\r\n            roots.Add(globalDataElement);\r\n\r\n\r\n            if (!_websiteItemsView)\r\n            {\r\n                bool pageDataFolderHasChildren = PageFolderFacade.GetAllFolderTypes().Any();\r\n\r\n                var pageDataFolderElement = new Element(_providerContext.CreateElementHandle(new GeneratedDataTypesElementProviderRootEntityToken(_providerContext.ProviderName, GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = GetText(\"PageDataFolderDataFolderLabel\"),\r\n                        ToolTip = GetText(\"PageDataFolderDataFolderToolTip\"),\r\n                        HasChildren = pageDataFolderHasChildren,\r\n                        Icon = GeneratedDataTypesElementProvider.RootClosed,\r\n                        OpenedIcon = GeneratedDataTypesElementProvider.RootOpen\r\n                    }\r\n                };\r\n\r\n                pageDataFolderElement.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.AddNewInterfaceTypeWorkflow\"), _addNewInterfaceTypePermissionTypes) { Payload = TypeManager.SerializeType(typeof(IPage)) }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"AddDataFolder\"),\r\n                            ToolTip = GetText(\"AddDataFolderToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.AddDataTypeIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                roots.Add(pageDataFolderElement);\r\n\r\n\r\n                bool pageMetaDataHasChildren = PageMetaDataFacade.GetAllMetaDataTypes().Any();\r\n\r\n\r\n                var pageMetaDataElement = new Element(_providerContext.CreateElementHandle(new GeneratedDataTypesElementProviderRootEntityToken(_providerContext.ProviderName, GeneratedDataTypesElementProviderRootEntityToken.PageMetaDataTypeFolderId)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = GetText(\"PageMetaDataFolderLabel\"),\r\n                        ToolTip = GetText(\"PageMetaDataFolderToolTip\"),\r\n                        HasChildren = pageMetaDataHasChildren,\r\n                        Icon = GeneratedDataTypesElementProvider.RootClosed,\r\n                        OpenedIcon = GeneratedDataTypesElementProvider.RootOpen\r\n                    }\r\n                };\r\n\r\n                pageMetaDataElement.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.AddNewCompositionTypeWorkflow\"), _addNewInterfaceTypePermissionTypes) { Payload = TypeManager.SerializeType(typeof(IPage)) }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"AddMetaDataLabel\"),\r\n                            ToolTip = GetText(\"AddMetaDataToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.AddDataTypeIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                roots.Add(pageMetaDataElement);\r\n            }\r\n\r\n\r\n            return roots;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Element> GetForeignRoots(SearchToken searchToken)\r\n        {\r\n            return GetRoots(searchToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            return GetChildren(entityToken, searchToken, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Element> GetForeignChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            return GetChildren(entityToken, searchToken, true);\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken searchToken, bool showForeignChildren)\r\n        {\r\n            if (entityToken is GeneratedDataTypesElementProviderRootEntityToken rootEntityToken)\r\n            {\r\n                return GetRootChildren(searchToken, rootEntityToken);\r\n            }\r\n\r\n            if (entityToken is GeneratedDataTypesElementProviderTypeEntityToken castedEntityToken)\r\n            {\r\n                string typeManagerName = castedEntityToken.SerializedTypeName;\r\n\r\n                Type type = TypeManager.TryGetType(typeManagerName);\r\n\r\n                if (type == null)\r\n                {\r\n                    return Enumerable.Empty<Element>();\r\n                }\r\n\r\n                // These are never shown in the tree\r\n                if (typeof(IPageMetaData).IsAssignableFrom(type))\r\n                {\r\n                    return Enumerable.Empty<Element>();\r\n                }\r\n\r\n                IEnumerable<Element> elements = _dataGroupingProviderHelper.GetRootGroupFolders(type, entityToken, showForeignChildren);\r\n\r\n                return elements.ToList();\r\n            }\r\n\r\n            if (entityToken is DataGroupingProviderHelperEntityToken dataGroupingEntityToken)\r\n            {\r\n                List<Element> elements = _dataGroupingProviderHelper\r\n                    .GetGroupChildren(dataGroupingEntityToken, showForeignChildren).ToList();\r\n\r\n                return elements;\r\n            }\r\n\r\n            if (entityToken is DataEntityToken)\r\n            {\r\n                return Enumerable.Empty<Element>();\r\n            }\r\n\r\n            throw new InvalidOperationException(\"This code should not be reachable\");\r\n        }\r\n\r\n\r\n\r\n        private List<Element> GetRootChildren(SearchToken searchToken, GeneratedDataTypesElementProviderRootEntityToken entityToken)\r\n        {\r\n            if (entityToken.Id == GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId)\r\n            {\r\n                return GetGlobalDataTypesElements(searchToken).OrderBy(f => f.VisualData.Label).ToList();\r\n            }\r\n            if (entityToken.Id == GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId)\r\n            {\r\n                return GetPageFolderDataTypesElements(searchToken).OrderBy(f => f.VisualData.Label).ToList();\r\n            }\r\n            if (entityToken.Id == GeneratedDataTypesElementProviderRootEntityToken.PageMetaDataTypeFolderId)\r\n            {\r\n                return GetPageMetaDataTypesElements(searchToken).OrderBy(f => f.VisualData.Label).ToList();\r\n            }\r\n\r\n            throw new InvalidOperationException(\"This code should not be reachable\");\r\n        }\r\n\r\n\r\n\r\n        private List<Element> GetGlobalDataTypesElements(SearchToken searchToken)\r\n        {\r\n            List<Element> elements = new List<Element>();\r\n\r\n            IEnumerable<Type> interfaceList = DataFacade.GetAllInterfaces(UserType.Developer).Where(i => i.IsStaticDataType() || i.IsGenerated());\r\n\r\n            interfaceList = interfaceList.OrderBy(t => t.FullName);\r\n            interfaceList = interfaceList.Except(PageFolderFacade.GetAllFolderTypes());\r\n            interfaceList = interfaceList.Except(PageMetaDataFacade.GetAllMetaDataTypes());\r\n\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                interfaceList = interfaceList.Where(x => x.FullName.ToLower().Contains(searchToken.Keyword.ToLower())).ToList();\r\n            }\r\n\r\n\r\n            var interfaces = new Dictionary<Type, DataTypeDescriptor>();\r\n            foreach (var type in interfaceList)\r\n            {\r\n                DataTypeDescriptor dataTypeDescriptor;\r\n                try\r\n                {\r\n                    dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, ex);\r\n                    continue;\r\n                }\r\n\r\n                if (dataTypeDescriptor != null)\r\n                {\r\n                    interfaces.Add(type, dataTypeDescriptor);\r\n                }\r\n            }\r\n\r\n            IEnumerable<KeyValuePair<Type, DataTypeDescriptor>> sortedInterfaces = interfaces;\r\n            if (_websiteItemsView)\r\n            {\r\n                sortedInterfaces = interfaces.OrderBy(f => f.Value.Title);\r\n            }\r\n\r\n            List<string> whiteList = DataFacade.GetData<IGeneratedTypeWhiteList>().Select(element => element.TypeManagerTypeName).ToList();\r\n\r\n            foreach (var kvp in sortedInterfaces)\r\n            {\r\n                Type type = kvp.Key;\r\n                DataTypeDescriptor dataTypeDescriptor = kvp.Value;\r\n\r\n                DataTypeDescriptor tempDescriptor;\r\n\r\n                bool storeCreated = DynamicTypeManager.TryGetDataTypeDescriptor(type.GetImmutableTypeId(), out tempDescriptor);\r\n\r\n                string typeName = TypeManager.SerializeType(type);\r\n\r\n                if (_websiteItemsView && !whiteList.Contains(typeName))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                DataScopeIdentifier dataScopeIdentifier = DataScopeIdentifier.Public;\r\n                if (typeof(IPublishControlled).IsAssignableFrom(type))\r\n                {\r\n                    dataScopeIdentifier = DataScopeIdentifier.Administrated;\r\n                }\r\n\r\n                Exception queryDataException = null;\r\n\r\n                bool hasChildren = false;\r\n                try\r\n                {\r\n                    using (new DataScope(dataScopeIdentifier))\r\n                    {\r\n                        hasChildren = storeCreated && DataFacade.GetData(type).Any();\r\n\r\n                        if (!hasChildren && storeCreated && DataLocalizationFacade.IsLocalized(type))\r\n                        {\r\n                            using (new DataScope(UserSettings.ForeignLocaleCultureInfo))\r\n                            {\r\n                                hasChildren |= DataFacade.GetData(type).Any();\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(LogTitle, ex);\r\n                    queryDataException = ex;\r\n                }\r\n                \r\n                string label = type.FullName;\r\n                if (_websiteItemsView)\r\n                {\r\n                    label = dataTypeDescriptor.Title;\r\n                }\r\n\r\n                bool failedToLoad = queryDataException != null;\r\n                bool isStaticType = type.IsStaticDataType();\r\n\r\n                var openIcon = _websiteItemsView || isStaticType ? InterfaceOpen : DynamicDataTypeIconOpen;\r\n                var closedIcon = _websiteItemsView ||isStaticType ? InterfaceClosed : DynamicDataTypeIconClosed;\r\n\r\n                var element = new Element(_providerContext.CreateElementHandle(\r\n                    new GeneratedDataTypesElementProviderTypeEntityToken(typeName, _providerContext.ProviderName,\r\n                        GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = label,\r\n                        ToolTip = !failedToLoad ? label : GetNestedExceptionMessage(queryDataException),\r\n                        HasChildren = hasChildren,\r\n                        Icon = !failedToLoad ? closedIcon : ErrorIcon,\r\n                        OpenedIcon = !failedToLoad ? openIcon : ErrorIcon\r\n                    }\r\n                };\r\n\r\n\r\n                if (storeCreated && !_websiteItemsView)\r\n                {\r\n                    AddNonShowOnlyGlobalActions(type, typeName, element);\r\n                }\r\n\r\n                if (storeCreated)\r\n                {\r\n                    element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.AddNewDataWorkflow\"), _addNewDataPermissionTypes) { DoIgnoreEntityTokenLocking = true }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"AddData\"),\r\n                            ToolTip = GetText(\"AddDataToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.AddDataIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n                }\r\n\r\n                if (RuntimeInformation.IsDebugBuild)\r\n                {\r\n                    element.AddAction(\r\n                    new ElementAction(new ActionHandle(new DataTypeDescriptorToXmlActionToken()))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"ToXmlLabel\"),\r\n                            ToolTip = GetText(\"ToXmlToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.ToXmlIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = AppendedActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n                }\r\n\r\n                // TODO: add \"Create store\" action\r\n                elements.Add(element);\r\n            }\r\n\r\n            return elements;\r\n        }\r\n\r\n        private string GetNestedExceptionMessage(Exception queryDataException)\r\n        {\r\n            var ex = queryDataException;\r\n\r\n            while (ex is TargetInvocationException)\r\n            {\r\n                ex = ex.InnerException;\r\n            }\r\n\r\n            return ex.Message;\r\n        }\r\n\r\n        \r\n        private void AddNonShowOnlyGlobalActions(Type type, string typeName, Element element)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type.GetImmutableTypeId());\r\n            bool isEditable = dataTypeDescriptor.IsCodeGenerated;\r\n\r\n            if (DataLocalizationFacade.UseLocalization)\r\n            {\r\n                element.AddAction(GetChangeLocalizationElementAction(type, isEditable));\r\n            }\r\n\r\n            element.AddAction(\r\n                new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.EditInterfaceTypeWorkflow\"), _editInterfaceTypePermissionTypes) { Payload = _providerContext.ProviderName }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = GetText(\"Edit\"),\r\n                        ToolTip = GetText(\"EditToolTip\"),\r\n                        Icon = GeneratedDataTypesElementProvider.EditDataTypeIcon,\r\n                        Disabled = !isEditable,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n            element.AddAction(\r\n                new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.DeleteInterfaceTypeWorkflow\"), _deleteInterfaceTypePermissionTypes) { Payload = _providerContext.ProviderName }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = GetText(\"Delete\"),\r\n                        ToolTip = GetText(\"DeleteToolTip\"),\r\n                        Icon = GeneratedDataTypesElementProvider.DeleteDataTypeIcon,\r\n                        Disabled = !isEditable,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Delete,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n            element.AddAction(\r\n                new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.EditFormWorkflow\"), _editFormMarkupPermissionTypes) { Payload = _providerContext.ProviderName, DoIgnoreEntityTokenLocking = true }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = GetText(\"EditFormMarkup\"),\r\n                        ToolTip = GetText(\"EditFormMarkupToolTip\"),\r\n                        Icon = GeneratedDataTypesElementProvider.EditFormMarkupIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n\r\n            bool exists = DataFacade.GetData<IGeneratedTypeWhiteList>().Any(f => f.TypeManagerTypeName == typeName);\r\n\r\n\r\n            element.AddAction(\r\n                new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\r\n                    exists == false ?\r\n                        \"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.AddTypeToWhiteListWorkflow\" :\r\n                        \"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.RemoveTypeFromWhiteListWorkflow\"\r\n                    ), _addNewInterfaceTypePermissionTypes) { DoIgnoreEntityTokenLocking = true }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = GetText(\"ShowInContent\"),\r\n                        ToolTip = GetText(\"ShowInContentToolTip\"),\r\n                        Icon = GeneratedDataTypesElementProvider.ShowincontentareaIcon,\r\n                        Disabled = false,\r\n                        ActionCheckedStatus = exists == false ? ActionCheckedStatus.Unchecked : ActionCheckedStatus.Checked,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Add,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = false,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n        }\r\n\r\n        private static ElementAction GetChangeLocalizationElementAction(Type type, bool isEditable)\r\n        {\r\n            if (!DataLocalizationFacade.IsLocalized(type))\r\n            {\r\n                return\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.EnableTypeLocalizationWorkflow\"), _editInterfaceTypePermissionTypes)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"EnableLocalization\"),\r\n                            ToolTip = GetText(\"EnableLocalizationToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.LocalizeDataTypeIcon,\r\n                            Disabled = !DataLocalizationFacade.ActiveLocalizationCultures.Any() || !isEditable,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Other,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    };\r\n            }\r\n\r\n\r\n            return\r\n                new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.DisableTypeLocalizationWorkflow\"), _editInterfaceTypePermissionTypes)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = GetText(\"DisableLocalization\"),\r\n                        ToolTip = GetText(\"DisableLocalizationToolTip\"),\r\n                        Icon = GeneratedDataTypesElementProvider.DelocalizeDataTypeIcon,\r\n                        Disabled = !isEditable,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Other,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                };\r\n        }\r\n        \r\n\r\n        private List<Element> GetPageFolderDataTypesElements(SearchToken searchToken)\r\n        {\r\n            var elements = new List<Element>();\r\n\r\n            IEnumerable<Type> types = PageFolderFacade.GetAllFolderTypes();\r\n\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                types = types.Where(x => x.FullName.ToLower().Contains(searchToken.Keyword.ToLower()));\r\n            }\r\n\r\n            foreach (Type type in types)\r\n            {\r\n                DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type.GetImmutableTypeId());\r\n                bool isEditable = dataTypeDescriptor.IsCodeGenerated;\r\n\r\n                string typeName = TypeManager.SerializeType(type);\r\n\r\n                var element = new Element(_providerContext.CreateElementHandle(new GeneratedDataTypesElementProviderTypeEntityToken(typeName, _providerContext.ProviderName, GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = type.FullName,\r\n                        ToolTip = type.FullName,\r\n                        HasChildren = false,\r\n                        Icon = isEditable ? DynamicDataTypeIconClosed : InterfaceClosed,\r\n                        OpenedIcon = isEditable ? DynamicDataTypeIconOpen : InterfaceOpen\r\n                    }\r\n                };\r\n\r\n                if (DataLocalizationFacade.UseLocalization)\r\n                {\r\n                    element.AddAction(GetChangeLocalizationElementAction(type, true));\r\n                }\r\n\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(\r\n                        WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.EditInterfaceTypeWorkflow\"), _editInterfaceTypePermissionTypes) { Payload = typeName }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"EditDataFolderTypeLabel\"),\r\n                            ToolTip = GetText(\"EditDataFolderTypeToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.EditDataTypeIcon,\r\n                            Disabled = !isEditable,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.DeleteAggregationTypeWorkflow\"), _deleteInterfaceTypePermissionTypes) { Payload = typeName }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"DeleteDataFolderTypeLabel\"),\r\n                            ToolTip = GetText(\"DeleteDataFolderTypeToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.DeleteDataTypeIcon,\r\n                            Disabled = !isEditable,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.EditFormWorkflow\"), _editFormMarkupPermissionTypes) { Payload = _providerContext.ProviderName, DoIgnoreEntityTokenLocking = true }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"EditFormMarkup\"),\r\n                            ToolTip = GetText(\"EditFormMarkupToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.EditFormMarkupIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                elements.Add(element);\r\n            }\r\n\r\n            return elements;\r\n        }\r\n\r\n\r\n\r\n        private List<Element> GetPageMetaDataTypesElements(SearchToken searchToken)\r\n        {\r\n            List<Element> elements = new List<Element>();\r\n\r\n            IEnumerable<Type> types = PageMetaDataFacade.GetAllMetaDataTypes();\r\n\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                types = types.Where(x => x.FullName.ToLower().Contains(searchToken.Keyword.ToLower()));\r\n            }\r\n\r\n            foreach (Type type in types)\r\n            {\r\n                DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type.GetImmutableTypeId());\r\n                bool isEditable = dataTypeDescriptor.IsCodeGenerated;\r\n\r\n                string typeName = TypeManager.SerializeType(type);\r\n\r\n                Element element = new Element(_providerContext.CreateElementHandle(new GeneratedDataTypesElementProviderTypeEntityToken(typeName, _providerContext.ProviderName, GeneratedDataTypesElementProviderRootEntityToken.PageMetaDataTypeFolderId)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = type.FullName,\r\n                        ToolTip = type.FullName,\r\n                        HasChildren = false,\r\n                        Icon = isEditable ? DynamicDataTypeIconClosed : InterfaceClosed,\r\n                        OpenedIcon = isEditable ? DynamicDataTypeIconOpen : InterfaceOpen\r\n                    }\r\n                };\r\n\r\n\r\n                if (DataLocalizationFacade.UseLocalization)\r\n                {\r\n                    element.AddAction(GetChangeLocalizationElementAction(type, isEditable));\r\n                }\r\n\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.EditCompositionTypeWorkflow\"), _editInterfaceTypePermissionTypes) { Payload = typeName }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"EditMetaDataTypeLabel\"),\r\n                            ToolTip = GetText(\"EditMetaDataTypeToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.EditDataTypeIcon,\r\n                            Disabled = !isEditable,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.DeleteCompositionTypeWorkflow\"), _deleteInterfaceTypePermissionTypes) { Payload = typeName }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"DeleteMetaDataTypeLabel\"),\r\n                            ToolTip = GetText(\"DeleteMetaDataTypeToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.DeleteDataTypeIcon,\r\n                            Disabled = !isEditable,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.EditFormWorkflow\"), _editFormMarkupPermissionTypes) { DoIgnoreEntityTokenLocking = true }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"EditFormMarkup\"),\r\n                            ToolTip = GetText(\"EditFormMarkupToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.EditFormMarkupIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                elements.Add(element);\r\n            }\r\n\r\n            return elements;\r\n        }\r\n\r\n\r\n\r\n        private Element GetElementFromData(IData data)\r\n        {\r\n            Type type = data.DataSourceId.InterfaceType;\r\n\r\n            string label = data.GetLabel(true);\r\n\r\n            Element element = new Element(_providerContext.CreateElementHandle(data.GetDataEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = label,\r\n                    ToolTip = label,\r\n                    HasChildren = false,\r\n                    Icon = (data is IPublishControlled ? DataIconLookup[((IPublishControlled)data).PublicationStatus] : DataIconFacade.DataPublishedIcon)\r\n                }\r\n            };\r\n\r\n\r\n\r\n            if (PageMetaDataFacade.GetAllMetaDataTypes().Contains(type) == false)\r\n            {\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Edit, _editDataPermissionTypes)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"EditData\"),\r\n                            ToolTip = GetText(\"EditDataToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.EditDataIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Delete,_deleteDataPermissionTypes)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"DeleteData\"),\r\n                            ToolTip = GetText(\"DeleteDataToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.DeleteDataIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Duplicate, _addNewDataPermissionTypes)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"DuplicateData\"),\r\n                            ToolTip = GetText(\"DuplicateDataToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.DuplicateDataIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        private Element GetGhostedElementFromData(IData data)\r\n        {\r\n            string label = string.Format(\"{0} ({1})\", data.GetLabel(true), DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo));\r\n\r\n            Element element = new Element(_providerContext.CreateElementHandle(data.GetDataEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = label,\r\n                    ToolTip = label,\r\n                    HasChildren = false,\r\n                    Icon = DataIconFacade.DataGhostedIcon,\r\n                    IsDisabled = false\r\n                }\r\n            };\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.LocalizeDataWorkflow\"), _localizeDataPermissionTypes) { Payload = \"Global\" }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = GetText(\"LocalizeData\"),\r\n                    ToolTip = GetText(\"LocalizeDataToolTip\"),\r\n                    Icon = GeneratedDataTypesElementProvider.LocalizeDataIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        private Element GetDisabledElementFromData(IData data)\r\n        {\r\n            string label = string.Format(\"{0} ({1})\", data.GetLabel(true), DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo));\r\n\r\n            Element element = new Element(_providerContext.CreateElementHandle(data.GetDataEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = label,\r\n                    ToolTip = GetText(\"DisabledData\"),\r\n                    HasChildren = false,\r\n                    Icon = DataIconFacade.DataDisabledIcon,\r\n                    IsDisabled = true\r\n                }\r\n            };\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        private Element AddGroupFolderActions(Element element, PropertyInfoValueCollection propertyInfoValueCollection)\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n            foreach (var kvp in propertyInfoValueCollection.PropertyValues)\r\n            {\r\n                string value = ValueTypeConverter.Convert<string>(kvp.Value);\r\n                StringConversionServices.SerializeKeyValuePair<string>(sb, kvp.Key.Name, value);\r\n            }\r\n\r\n            element.AddAction(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider.AddNewDataWorkflow\"), _addNewDataPermissionTypes) { DoIgnoreEntityTokenLocking = true, Payload = sb.ToString() }))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetText(\"AddData\"),\r\n                            ToolTip = GetText(\"AddDataToolTip\"),\r\n                            Icon = GeneratedDataTypesElementProvider.AddDataIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n        private static bool IsTypeWhiteListed(Type type)\r\n        {\r\n            string typeManagerTypeName = TypeManager.SerializeType(type);\r\n\r\n            IEnumerable<IGeneratedTypeWhiteList> whileList = DataFacade.GetData<IGeneratedTypeWhiteList>(true);\r\n\r\n            return whileList.Any(f => f.TypeManagerTypeName == typeManagerTypeName);\r\n        }\r\n\r\n\r\n\r\n        private EntityToken GetRootParentEntityToken(Type type, EntityToken entityToken)\r\n        {\r\n            bool isPageFolder = PageFolderFacade.GetAllFolderTypes().Contains(type);\r\n\r\n            if (!isPageFolder)\r\n            {\r\n                if (_websiteItemsView && !IsTypeWhiteListed(type)) return null;\r\n\r\n                return new GeneratedDataTypesElementProviderTypeEntityToken(\r\n                    TypeManager.SerializeType(type),\r\n                    _providerContext.ProviderName,\r\n                    GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId\r\n                );\r\n            }\r\n\r\n            if (_websiteItemsView) return null;\r\n\r\n            var groupingEntityToken = entityToken as DataGroupingProviderHelperEntityToken;\r\n            if (groupingEntityToken != null && !groupingEntityToken.Payload.IsNullOrEmpty())\r\n            {\r\n                // Grouping entity tokens with payload aren't attached to the data type folder in the 'Data' perspective\r\n                return null;\r\n            }\r\n\r\n            return new GeneratedDataTypesElementProviderTypeEntityToken(\r\n                    TypeManager.SerializeType(type),\r\n                    _providerContext.ProviderName,\r\n                    GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n        internal static string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", key);\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(GeneratedDataTypesElementProviderAssembler))]\r\n    internal sealed class GeneratedDataTypesElementProviderData : HooklessElementProviderData\r\n    {\r\n        private const string _onlyShowGlobalDatasPropertyName = \"onlyShowGlobalDatas\";\r\n        /// <exclude />\r\n        [ConfigurationProperty(_onlyShowGlobalDatasPropertyName, IsRequired = false, DefaultValue = false)]\r\n        public bool OnlyShowGlobalDatas\r\n        {\r\n            get { return (bool)base[_onlyShowGlobalDatasPropertyName]; }\r\n            set { base[_onlyShowGlobalDatasPropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class GeneratedDataTypesElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var data = (GeneratedDataTypesElementProviderData)objectConfiguration;\r\n\r\n            return new GeneratedDataTypesElementProvider(data.OnlyShowGlobalDatas);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/GeneratedDataTypesElementProviderRootEntityToken.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n\tpublic sealed class GeneratedDataTypesElementProviderRootEntityToken : EntityToken\r\n\t{\r\n        private string _source;\r\n        private string _id;\r\n\r\n\r\n        /// <exclude />\r\n        public GeneratedDataTypesElementProviderRootEntityToken(string providerName, string id)\r\n        {\r\n            _source = providerName;\r\n            _id = id;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedData, out type, out source, out id);\r\n\r\n            return new GeneratedDataTypesElementProviderRootEntityToken(source, id);\r\n        }\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public static string GlobalDataTypeFolderId { get { return \"GlobalDataTypeFolder\"; } }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Not used any more\")]\r\n        [JsonIgnore]\r\n        public static string StaticGlobalDataTypeFolderId { get { return \"StaticGlobalDataTypeFolder\"; } }\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public static string PageDataFolderTypeFolderId { get { return \"PageDataFolderTypeFolder\"; } }\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public static string PageMetaDataTypeFolderId { get { return \"PageMetaDataTypeFolder\"; } }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/GeneratedDataTypesElementProviderSecurityAncestorProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    internal sealed class GeneratedDataTypesElementProviderSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken is GeneratedDataTypesElementProviderRootEntityToken)\r\n            {\r\n                yield break;\r\n            }\r\n            else if (entityToken is GeneratedDataTypesElementProviderTypeEntityToken)\r\n            {\r\n                GeneratedDataTypesElementProviderTypeEntityToken castedToken = entityToken as GeneratedDataTypesElementProviderTypeEntityToken;\r\n\r\n                Type type = TypeManager.TryGetType(castedToken.SerializedTypeName);\r\n\r\n                if (type != null)\r\n                {\r\n                    yield return new GeneratedDataTypesElementProviderRootEntityToken(entityToken.Source, castedToken.Id);\r\n                }\r\n                else\r\n                {\r\n                    yield return null;\r\n                }\r\n            }            \r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/GeneratedDataTypesElementProviderTypeEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Serialization;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(GeneratedDataTypesElementProviderSecurityAncestorProvider))]\r\n    public sealed class GeneratedDataTypesElementProviderTypeEntityToken : EntityToken\r\n    {\r\n        private readonly string _providerName;\r\n\r\n\r\n        /// <exclude />\r\n        [JsonConstructor]\r\n        public GeneratedDataTypesElementProviderTypeEntityToken(string serializedTypeName, string source, string id)\r\n        {\r\n            Id = id;\r\n            _providerName = source;\r\n            this.SerializedTypeName = serializedTypeName;\r\n        }\r\n\r\n        \r\n        /// <exclude />\r\n        public override string Type => \"GeneratedDataTypesElementProvider\";\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source => _providerName;\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public string SerializedTypeName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(this);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                entityToken = CompositeJsonSerializer\r\n                    .Deserialize<GeneratedDataTypesElementProviderTypeEntityToken>(serializedEntityToken);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedEntityToken);\r\n                Log.LogVerbose(nameof(GeneratedDataTypesElementProviderTypeEntityToken), entityToken.GetType().FullName);\r\n            }\r\n            return entityToken;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken DeserializeLegacy(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            Dictionary<string, string> dic;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id, out dic);\r\n\r\n            if (dic.ContainsKey(\"_SerializedTypeName_\") == false)\r\n            {\r\n                throw new ArgumentException(\"The serializedEntityToken is not a serialized entity token\", \"serializedEntityToken\");\r\n            }\r\n\r\n            string serializedTypeName = StringConversionServices.DeserializeValueString(dic[\"_SerializedTypeName_\"]);\r\n\r\n            return new GeneratedDataTypesElementProviderTypeEntityToken(serializedTypeName, source, id);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return base.Equals(obj) &&\r\n                   (obj as GeneratedDataTypesElementProviderTypeEntityToken).SerializedTypeName == this.SerializedTypeName;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            if (this.HashCode == 0)\r\n            {\r\n                this.HashCode = GetType().GetHashCode() ^ this.Type.GetHashCode() ^ this.Source.GetHashCode() ^ this.Id.GetHashCode() ^ this.SerializedTypeName.GetHashCode();\r\n            }\r\n            return this.HashCode;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/IGeneratedTypeWhiteList.cs",
    "content": "﻿using Composite.Data.Hierarchy;\r\nusing Composite.Data.Hierarchy.DataAncestorProviders;\r\n\r\n\r\nnamespace Composite.Data.Types\r\n{\r\n    /// <summary>  \r\n    /// Reference to a generated/static data type that has to be shown in the 'Content' perspective, under 'Website Items' element\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AutoUpdateble]\r\n    [ImmutableTypeId(\"{C447589F-B6DE-4f52-A520-F20E05BA2DB5}\")]\r\n    [KeyPropertyName(\"TypeManagerTypeName\")]\r\n    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]\r\n    [DataScope(DataScopeIdentifier.AdministratedName)]\r\n    [Caching(CachingType.Full)]\r\n\tpublic interface IGeneratedTypeWhiteList : IData\r\n\t{\r\n        /// <exclude />\r\n        [ImmutableFieldId(\"{60243CA2-7B4A-4982-A7CF-D7557FFE611E}\")]\r\n        [StoreFieldType(PhysicalStoreFieldType.String, 256)]\r\n        string TypeManagerTypeName { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/ViewUnpublishedItemsActionToken.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [ActionExecutor(typeof(ViewUnpublishedItemsActionExecutor))]\r\n    internal sealed class ViewUnpublishedItemsActionToken : ActionToken\r\n    {\r\n        private static IEnumerable<PermissionType> _permissionType = new PermissionType[] { PermissionType.Read };\r\n\r\n        public ViewUnpublishedItemsActionToken()\r\n        {\r\n        }\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionType; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return \"ViewUnpublishedGlobalItems\";\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new ViewUnpublishedItemsActionToken();\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class ViewUnpublishedItemsActionExecutor : Composite.C1Console.Actions.IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            string documentTitle = StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"ViewUnpublishedItems-document-title\");\r\n            string description = StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"ViewUnpublishedItems-document-description\");\r\n            string emptyLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"ViewUnpublishedItems-document-empty-label\");\r\n            string url = string.Format(\"{0}?showglobaldata=true&title={1}&description={2}&emptyLabel={3}\",\r\n                UrlUtils.ResolveAdminUrl(string.Format(\"content/views/publishworkflowstatus/ViewUnpublishedItems.aspx\")),\r\n                HttpUtility.UrlEncode(documentTitle, Encoding.UTF8),\r\n                HttpUtility.UrlEncode(description, Encoding.UTF8),\r\n                HttpUtility.UrlEncode(emptyLabel, Encoding.UTF8));\r\n\r\n            IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n            OpenViewMessageQueueItem openViewMsg = new OpenViewMessageQueueItem\r\n            {\r\n                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),\r\n                ViewId = \"ViewUnpublishedGlobalItems\",\r\n                Label = documentTitle,\r\n                Url = url,\r\n                ViewType = ViewType.Main\r\n            };\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/LocalizationElementProvider/LocalizationElementProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Localization;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableHooklessElementProvider))]\r\n    internal sealed class LocalizationElementProvider : IHooklessElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n\r\n\r\n        private static ResourceHandle RootClosedIcon = GetIconHandle(\"localization-element-closed-root\");\r\n        private static ResourceHandle RootOpenedIcon = GetIconHandle(\"localization-element-opened-root\");\r\n        private static ResourceHandle LocaleItemIcon = GetIconHandle(\"localization-element-localeitem\");\r\n        private static ResourceHandle DefaultLocaleItemIcon = GetIconHandle(\"localization-element-defaultlocaleitem\");\r\n        private static ResourceHandle AddSystemLocaleIcon = GetIconHandle(\"localization-addsystemlocale\");\r\n        private static ResourceHandle EditSystemLocaleIcon = GetIconHandle(\"localization-editsystemlocale\");                \r\n        private static ResourceHandle SetAsDefaultIcon = GetIconHandle(\"localization-setasdefault\");\r\n        private static ResourceHandle RemoveSystemLocaleIcon = GetIconHandle(\"localization-removesystemlocale\");\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n\r\n\r\n        public LocalizationElementProvider()\r\n        {\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            Element element = new Element(_context.CreateElementHandle(new LocalizationElementProviderRootEntityToken()));\r\n            element.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"ElementProvider.RootFolderLabel\"),\r\n                ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"ElementProvider.RootFolderToolTip\"),\r\n                HasChildren = true,\r\n                Icon = RootClosedIcon,\r\n                OpenedIcon = RootOpenedIcon\r\n            };\r\n\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(\r\n                new WorkflowActionToken(\r\n                    WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider.AddSystemLocaleWorkflow\"),\r\n                    new PermissionType[] { PermissionType.Administrate }\r\n                )))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"AddSystemLocaleWorkflow.AddElementActionLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"AddSystemLocaleWorkflow.AddElementActionToolTip\"),\r\n                    Icon = AddSystemLocaleIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            yield return element;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            if ((entityToken is LocalizationElementProviderRootEntityToken) == false) throw new InvalidOperationException();\r\n\r\n            IEnumerable<ISystemActiveLocale> locales = DataFacade.GetData<ISystemActiveLocale>().ToList();\r\n\r\n            List<Element> elements = new List<Element>();\r\n\r\n            foreach (ISystemActiveLocale locale in locales)\r\n            {\r\n                bool isDefault = LocalizationFacade.IsDefaultLocale(locale.CultureName);\r\n\r\n                ResourceHandle iconHandle = LocaleItemIcon;\r\n                if (isDefault)\r\n                {\r\n                    //lable = string.Format(\"{0} ({1})\", lable, StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"ElementProvider.DefaultLabel\"));\r\n                    iconHandle = DefaultLocaleItemIcon;\r\n                }\r\n\r\n                Element element = new Element(_context.CreateElementHandle(locale.GetDataEntityToken()));\r\n                element.VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = DataLocalizationFacade.GetCultureTitle(new CultureInfo(locale.CultureName)),\r\n                    ToolTip = DataLocalizationFacade.GetCultureTitle(new CultureInfo(locale.CultureName)),\r\n                    HasChildren = false,\r\n                    Icon = iconHandle\r\n                };\r\n\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(\r\n                    new WorkflowActionToken(\r\n                        WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider.EditSystemLocaleWorkflow\"),\r\n                        new PermissionType[] { PermissionType.Administrate }\r\n                    )))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"EditSystemLocaleWorkflow.EditElementActionLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"EditSystemLocaleWorkflow.EditElementActionToolTip\"),\r\n                        Icon = EditSystemLocaleIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n\r\n                if (isDefault == false)\r\n                {\r\n                    element.AddAction(new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider.DefineDefaultActiveLocaleWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Administrate }\r\n                        )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"DefineDefaultActiveLocaleWorkflow.ElementActionLabel\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"DefineDefaultActiveLocaleWorkflow.ElementActionToolTip\"),\r\n                            Icon = SetAsDefaultIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n\r\n                    element.AddAction(new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider.RemoveSystemLocaleWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Administrate }\r\n                        )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"RemoveSystemLocaleWorkflow.RemoveElementActionLabel\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"RemoveSystemLocaleWorkflow.RemoveElementActionToolTip\"),\r\n                            Icon = RemoveSystemLocaleIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n                }\r\n\r\n                elements.Add(element);\r\n            }\r\n\r\n            return elements.OrderBy(f => f.VisualData.Label);\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            Dictionary<EntityToken, IEnumerable<EntityToken>> result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n\r\n                Type type = dataEntityToken.InterfaceType;\r\n                if (type != typeof(ISystemActiveLocale)) continue;\r\n\r\n                LocalizationElementProviderRootEntityToken newEntityToken = new LocalizationElementProviderRootEntityToken();\r\n\r\n                result.Add(entityToken, new EntityToken[] { newEntityToken });\r\n            }\r\n\r\n            return result;\r\n        }        \r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/LocalizationElementProvider/LocalizationElementProviderRootEntityToken.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n\tinternal sealed class LocalizationElementProviderRootEntityToken : EntityToken\r\n\t{\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return \"LocalizationElementProviderRootEntityToken\"; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new LocalizationElementProviderRootEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileTextContentWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditMediaFileTextContentWorkflow\" Location=\"30; 30\" Size=\"1132; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditMediaFileTextContentWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditMediaFileTextContentWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"613\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"613\" Y=\"103\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"247\" />\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"247\" />\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"259\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"262\" Y=\"324\" />\r\n\t\t\t\t<ns0:Point X=\"293\" Y=\"324\" />\r\n\t\t\t\t<ns0:Point X=\"293\" Y=\"289\" />\r\n\t\t\t\t<ns0:Point X=\"461\" Y=\"289\" />\r\n\t\t\t\t<ns0:Point X=\"461\" Y=\"297\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"570\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"570\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"259\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"63; 105\" Size=\"197; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initialStateInitializationActivity\" Location=\"521; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"531; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"531; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"92; 259\" Size=\"189; 94\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"100; 290\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"110; 352\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Save\" Location=\"100; 314\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"110; 376\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"110; 436\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"359; 297\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"367; 328\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"377; 390\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"377; 450\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"533; 103\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/MediaFileProviderElementProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Drawing;\r\nusing System.Drawing.Imaging;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Foundation.PluginFacades;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Types.StoreIdFilter;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(MediaFileElementProviderData))]\r\n    internal sealed class MediaFileProviderElementProvider : IHooklessElementProvider, IDragAndDropElementProvider, ILabeledPropertiesElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n        private readonly bool _showOnlyImages;\r\n        private string _rootLabel;\r\n        private ResourceHandle FolderIcon => CommonElementIcons.Folder;\r\n        private ResourceHandle OpenFolderIcon => CommonElementIcons.FolderOpen;\r\n        private ResourceHandle EmptyFolderIcon => CommonElementIcons.FolderOpen;\r\n        private static ResourceHandle ReadOnlyFolderOpen => GetIconHandle(\"media-read-only-folder-open\");\r\n        private static ResourceHandle ReadOnlyFolderClosed => GetIconHandle(\"media-read-only-folder-closed\");\r\n        public static ResourceHandle AddMediaFolder => GetIconHandle(\"media-add-media-folder\");\r\n        public static ResourceHandle AddMediaFile => GetIconHandle(\"media-add-media-file\");\r\n        public static ResourceHandle DownloadFile => GetIconHandle(\"media-download-file\");\r\n        public static ResourceHandle ReplaceMediaFile => GetIconHandle(\"media-replace-media-file\");\r\n        public static ResourceHandle UploadZipFile => GetIconHandle(\"media-upload-zip-file\");\r\n        public static ResourceHandle EditImageFile => GetIconHandle(\"media-edit-image-file\");\r\n        public static ResourceHandle EditMediaFolder => GetIconHandle(\"media-edit-media-folder\");\r\n        public static ResourceHandle EditMediaFile => GetIconHandle(\"media-edit-media-file\");\r\n        public static ResourceHandle DeleteMediaFolder => GetIconHandle(\"media-delete-media-folder\");\r\n        public static ResourceHandle DeleteMediaFile => GetIconHandle(\"media-delete-media-file\");\r\n\r\n        private static readonly ActionGroup PrimaryFolderActionGroup = new ActionGroup(\"Folder\", ActionGroupPriority.PrimaryMedium);\r\n        private static readonly ActionGroup PrimaryFileActionGroup = new ActionGroup(\"File\", ActionGroupPriority.PrimaryMedium);\r\n        private static readonly ActionGroup PrimaryFileToolsActionGroup = new ActionGroup(\"FileTools\", ActionGroupPriority.PrimaryMedium);\r\n\r\n        private static readonly Expression IgnoreCaseConstantExpression = Expression.Constant(StringComparison.OrdinalIgnoreCase, typeof(StringComparison));\r\n        private static readonly MethodInfo EndsWithMethodInfo = typeof(string).GetMethod(\"EndsWith\", new[] { typeof(string), typeof(StringComparison) });\r\n        \r\n\r\n        public MediaFileProviderElementProvider(MediaFileElementProviderData data)\r\n        {\r\n            _showOnlyImages = data.ShowOnlyImages;\r\n            _rootLabel = data.RootLabel;            \r\n\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            var mediaStores = DataFacade.GetData<IMediaFileStore>();\r\n\r\n            var elements = new List<Element>();\r\n            foreach (IMediaFileStore store in mediaStores)\r\n            {\r\n\r\n                var element = new Element(_context.CreateElementHandle(new MediaRootFolderProviderEntityToken(store.Id)))\r\n                {\r\n                    VisualData = new ElementVisualizedData()\r\n                    {\r\n                        Label = store.Title,\r\n                        ToolTip = GetResourceString(\"MediaFileProviderElementProvider.RootToolTip\"),\r\n                        HasChildren = true,\r\n                        Icon = FolderIcon,\r\n                        OpenedIcon = OpenFolderIcon\r\n                    }\r\n                };\r\n\r\n                element.PropertyBag.Add(\"ReadOnly\", store.IsReadOnly.ToString());\r\n                element.PropertyBag.Add(\"ElementId\", store.Id + \":/\");\r\n\r\n                if(!store.IsReadOnly)\r\n                {\r\n                    element.MovabilityInfo.AddDropType(typeof(IMediaFileFolder), store.Id);\r\n                    element.MovabilityInfo.AddDropType(typeof(IMediaFile), store.Id);\r\n                    element.MovabilityInfo.DragType = typeof(IMediaFileStore);\r\n\r\n                    element.AddAction(\r\n                       new ElementAction(new ActionHandle(\r\n                           new WorkflowActionToken(\r\n                               WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.AddNewMediaFolderWorkflow\"),\r\n                               new PermissionType[] { PermissionType.Add }\r\n                            )))\r\n                       {\r\n                           VisualData = new ActionVisualizedData\r\n                           {\r\n                               Label = GetResourceString(\"MediaFileProviderElementProvider.AddMediaFolder\"),\r\n                               ToolTip = GetResourceString(\"MediaFileProviderElementProvider.AddMediaFolderToolTip\"),\r\n                               Icon = MediaFileProviderElementProvider.AddMediaFolder,\r\n                               Disabled = false,\r\n                               ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                               ActionLocation = new ActionLocation\r\n                               {\r\n                                   ActionType = ActionType.Add,\r\n                                   IsInFolder = false,\r\n                                   IsInToolbar = true,\r\n                                   ActionGroup = PrimaryFolderActionGroup\r\n                               }\r\n                           }\r\n                       });\r\n\r\n                    element.AddAction(\r\n                     new ElementAction(new ActionHandle(\r\n                         new WorkflowActionToken(\r\n                             WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.AddNewMediaFileWorkflow\"),\r\n                             new PermissionType[] { PermissionType.Add }\r\n                        )))\r\n                     {\r\n                         VisualData = new ActionVisualizedData\r\n                         {\r\n                             Label = GetResourceString(\"MediaFileProviderElementProvider.AddMediaFile\"),\r\n                             ToolTip = GetResourceString(\"MediaFileProviderElementProvider.AddMediaFileToolTip\"),\r\n                             Icon = MediaFileProviderElementProvider.AddMediaFile,\r\n                             Disabled = false,\r\n                             ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                             ActionLocation = new ActionLocation\r\n                             {\r\n                                 ActionType = ActionType.Add,\r\n                                 IsInFolder = false,\r\n                                 IsInToolbar = true,\r\n                                 ActionGroup = PrimaryFileActionGroup\r\n                             }\r\n                         }\r\n                     });\r\n\r\n                    element.AddAction(\r\n                       new ElementAction(new ActionHandle(\r\n                           new WorkflowActionToken(\r\n                               WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.AddMediaZipFileWorkflow\"),\r\n                               new PermissionType[] { PermissionType.Add }\r\n                            ) { DoIgnoreEntityTokenLocking = true }))\r\n                       {\r\n                           VisualData = new ActionVisualizedData\r\n                           {\r\n                               Label = GetResourceString(\"MediaFileProviderElementProvider.UploadZipFile\"),\r\n                               ToolTip = GetResourceString(\"MediaFileProviderElementProvider.UploadZipFileToolTip\"),\r\n                               Icon = MediaFileProviderElementProvider.UploadZipFile,\r\n                               Disabled = false,\r\n                               ActionLocation = new ActionLocation\r\n                               {\r\n                                   ActionType = ActionType.Add,\r\n                                   IsInFolder = false,\r\n                                   IsInToolbar = true,\r\n                                   ActionGroup = PrimaryFileActionGroup\r\n                               }\r\n                           }\r\n                       });\r\n                }\r\n\r\n                elements.Add(element);\r\n            }\r\n            return elements;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            if (entityToken is MediaRootFolderProviderEntityToken)\r\n            {\r\n                return GetChildrenOnPath(\"/\", entityToken.Id, searchToken);\r\n            }\r\n            \r\n            var dataEntityToken = (DataEntityToken)entityToken;\r\n            Verify.IsNotNull(dataEntityToken, \"Unexpected entity token type '{0}'\", entityToken.GetType());\r\n\r\n            if (dataEntityToken.InterfaceType == typeof (IMediaFile))\r\n            {\r\n                return null;\r\n            }\r\n\r\n\r\n            if (dataEntityToken.InterfaceType == typeof (IMediaFileFolder))\r\n            {\r\n                object data = dataEntityToken.Data;\r\n                if (data == null)\r\n                {\r\n                    return Enumerable.Empty<Element>();\r\n                }\r\n\r\n                var folder = (IMediaFileFolder)data;\r\n                return GetChildrenOnPath(folder.Path, folder.StoreId, searchToken);\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Unexpected data entity token's interface type '{0}'\".FormatWith(dataEntityToken.InterfaceType));\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<LabeledProperty> GetLabeledProperties(EntityToken entityToken)\r\n        {\r\n            if (!(entityToken is DataEntityToken))\r\n            {\r\n                throw new ArgumentException($\"Got '{typeof (EntityToken)}' expected '{typeof (DataEntityToken)}'\");\r\n            }\r\n            \r\n            var token = (DataEntityToken) entityToken;\r\n\r\n            if (token.Data is IMediaFileFolder)\r\n            {\r\n                return GetFolderProperties((IMediaFileFolder) token.Data);\r\n            }\r\n            \r\n            if (token.Data is IMediaFile)\r\n            {\r\n                return GetFileProperties((IMediaFile) token.Data);\r\n            }\r\n                \r\n            throw new ArgumentException($\"Unexpected type of data '{token.Data.GetType()}' in token\");\r\n        }\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            var result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                var dataEntityToken = entityToken as DataEntityToken;\r\n\r\n                Type type = dataEntityToken.InterfaceType;\r\n                if (type != typeof(IMediaFile) && type != typeof(IMediaFileFolder)) continue;\r\n\r\n                string storeId = null;\r\n\r\n                IMediaFile mediaFile = dataEntityToken.Data as IMediaFile;\r\n                if (mediaFile != null)\r\n                {\r\n                    if (mediaFile.FolderPath != \"/\") continue;\r\n\r\n                    storeId = mediaFile.StoreId;\r\n                }\r\n\r\n                IMediaFileFolder mediaFileFolder = dataEntityToken.Data as IMediaFileFolder;\r\n                if (mediaFileFolder != null)\r\n                {\r\n                    if (!mediaFileFolder.Path.IsDirectChildOf(\"/\", '/')) continue;\r\n\r\n                    storeId = mediaFileFolder.StoreId;\r\n                }\r\n\r\n                if(storeId == null) continue;\r\n\r\n                var newEntityToken = new MediaRootFolderProviderEntityToken(storeId);\r\n\r\n                result.Add(entityToken, new EntityToken[] { newEntityToken });\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<LabeledProperty> GetFileProperties(IMediaFile file)\r\n        {\r\n            var propertyList = new LabeledPropertyList\r\n            {\r\n                {\"StoreId\", \"Store ID\", file.StoreId},\r\n                {\"FolderPath\", \"Folder path\", file.FolderPath},\r\n                {\"FileName\", \"File name\", file.FileName},\r\n                {\"Title\", \"Description\", file.Title},\r\n                {\"Description\", \"Description\", file.Description},\r\n                {\"IsReadOnly\", \"Read only\", file.IsReadOnly}\r\n            };\r\n\r\n            if (file.Length.HasValue) propertyList.Add(\"Length\", \"Length (bytes)\", file.Length.Value);\r\n            if (file.LastWriteTime.HasValue) propertyList.Add(\"LastWriteTime\", \"Last write time\", file.LastWriteTime.Value);\r\n            if (file.CreationTime.HasValue) propertyList.Add(\"CreationTime\", \"Creation time\", file.CreationTime.Value);\r\n            if (file.MimeType.Length > 0) propertyList.Add(\"MimeType\", \"MIME type\", file.MimeType);\r\n            propertyList.Add(\"Culture\", \"Culture\", file.Culture);\r\n\r\n            if (file.MimeType.StartsWith(\"image\"))\r\n            {\r\n                if (file.MimeType == MimeTypeInfo.Svg)\r\n                {\r\n                    propertyList.Add(\"ImageFormat\", \"Image format\", \"svg\");\r\n                }\r\n                else\r\n                {\r\n                    using (Stream fileStream = file.GetReadStream())\r\n                    {\r\n                        var bitmap = new Bitmap(fileStream);\r\n                        propertyList.Add(\"ImageWidth\", \"Image width\", bitmap.Width);\r\n                        propertyList.Add(\"ImageHeight\", \"Image height\", bitmap.Height);\r\n\r\n                        string formatString = null;\r\n                        if (bitmap.RawFormat.Guid.CompareTo(ImageFormat.Gif.Guid) == 0) formatString = \"gif\";\r\n                        if (bitmap.RawFormat.Guid.CompareTo(ImageFormat.Jpeg.Guid) == 0) formatString = \"jpeg\";\r\n                        if (bitmap.RawFormat.Guid.CompareTo(ImageFormat.Png.Guid) == 0) formatString = \"png\";\r\n                        if (bitmap.RawFormat.Guid.CompareTo(ImageFormat.Tiff.Guid) == 0) formatString = \"tiff\";\r\n                        if (formatString != null) propertyList.Add(\"ImageFormat\", \"Image format\", formatString);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return propertyList;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<LabeledProperty> GetFolderProperties(IMediaFileFolder folder)\r\n        {\r\n            return new LabeledPropertyList\r\n            {\r\n                {\"StoreId\", \"Store ID\", folder.StoreId},\r\n                {\"Path\", \"Path\", folder.Path},\r\n                {\"Title\", \"Title\", folder.Title},\r\n                {\"Description\", \"Description\", folder.Description},\r\n                {\"IsReadOnly\", \"Read only\", folder.IsReadOnly}\r\n            };\r\n        }\r\n\r\n\r\n        private static bool DoesFileExist(string path, string name)\r\n        {\r\n            return (from item in DataFacade.GetData<IMediaFile>()\r\n                    where item.FolderPath == path && item.FileName == name\r\n                    select item).Any();\r\n        }\r\n\r\n\r\n        public bool OnElementDraggedAndDropped(EntityToken draggedEntityToken, EntityToken newParentEntityToken, int dropIndex, DragAndDropType dragAndDropType, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            IData draggedData = ((DataEntityToken)draggedEntityToken).Data;\r\n\r\n            string path;\r\n            if (newParentEntityToken is DataEntityToken)\r\n            {\r\n                path = ((IMediaFileFolder)((DataEntityToken)newParentEntityToken).Data).Path;\r\n            }\r\n            else if (newParentEntityToken is MediaRootFolderProviderEntityToken)\r\n            {\r\n                path = \"/\";\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n\r\n            IMediaFile draggedFile = draggedData as IMediaFile;\r\n            IMediaFileFolder draggedFolder = draggedData as IMediaFileFolder;\r\n\r\n            string oldPath = null;\r\n            string storeId = null;\r\n\r\n            if (dragAndDropType == DragAndDropType.Move)\r\n            {\r\n                if (draggedFile != null)\r\n                {\r\n                    if (DoesFileExist(path, draggedFile.FileName))\r\n                    {\r\n                        var messageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n                        messageService.ShowMessage(DialogType.Error, \r\n                            GetResourceString(\"MediaFileProviderElementProvider.ErrorMessageTitle\"),\r\n                            GetResourceString(\"MediaFileProviderElementProvider.FileAlreadyExistsMessage\").FormatWith(draggedFile.FileName, path));\r\n                        return false;\r\n                    }\r\n                    \r\n                    oldPath = draggedFile.FolderPath;\r\n                    storeId = draggedFile.StoreId;\r\n\r\n                    draggedFile.FolderPath = path;\r\n                    DataFacade.Update(draggedFile);\r\n                }\r\n                else if (draggedFolder != null)\r\n                {\r\n                    int index = draggedFolder.Path.LastIndexOf('/');\r\n\r\n                    oldPath = draggedFolder.Path.Remove(index);\r\n                    storeId = draggedFolder.StoreId;\r\n\r\n                    string draggedFolderName = draggedFolder.Path.Remove(0, index + 1);\r\n\r\n                    string newPath = path;\r\n                    if (!path.EndsWith(\"/\"))\r\n                    {\r\n                        newPath = $\"{path}/\";\r\n                    }\r\n\r\n                    string targetPath = $\"{newPath}{draggedFolderName}\";\r\n\r\n                    using (var scope = Composite.Data.Transactions.TransactionsFacade.CreateNewScope())\r\n                    {\r\n                        draggedFolder.Path = targetPath;\r\n                        DataFacade.Update(draggedFolder);\r\n\r\n                        scope.Complete();\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    Verify.ThrowInvalidOperationException(\"Unexpected media data type.\");\r\n                }\r\n            }\r\n            else if (dragAndDropType == DragAndDropType.Copy)\r\n            {\r\n                if (draggedFile != null)\r\n                {\r\n                    storeId = draggedFile.StoreId;\r\n\r\n                    IMediaFileStore store = DataFacade.GetData<IMediaFileStore>(x => x.Id == storeId).First();\r\n\r\n                    StoreIdFilterQueryable<IMediaFile> fileQueryable = new StoreIdFilterQueryable<IMediaFile>(DataFacade.GetData<IMediaFile>(), storeId);\r\n\r\n                    List<string> fileNames =\r\n                        (from f in fileQueryable\r\n                         where f.StoreId == storeId &&\r\n                               f.FolderPath == path\r\n                         select f.FileName).ToList();\r\n\r\n                    var newWorkflowMediaFile = new WorkflowMediaFile(draggedFile)\r\n                    {\r\n                        FolderPath = path\r\n                    };\r\n\r\n\r\n                    string draggedFilenamePre = draggedFile.FileName;\r\n                    string draggedFilenamePost = \"\";\r\n\r\n                    int index = draggedFile.FileName.LastIndexOf('.');\r\n                    if (index != -1)\r\n                    {\r\n                        draggedFilenamePre = draggedFile.FileName.Remove(index);\r\n                        draggedFilenamePost = draggedFile.FileName.Remove(0, index);\r\n                    }\r\n\r\n                    string newFilename = draggedFile.FileName;\r\n                    int counter = 1;\r\n                    while (fileNames.Contains(newFilename))\r\n                    {\r\n                        newFilename = $\"{draggedFilenamePre}({counter++}){draggedFilenamePost}\";\r\n                    }\r\n\r\n                    newWorkflowMediaFile.FileName = newFilename;\r\n\r\n                    using (Stream readStream = draggedFile.GetReadStream())\r\n                    {\r\n                        using (Stream writeStream = newWorkflowMediaFile.GetNewWriteStream())\r\n                        {\r\n                            readStream.CopyTo(writeStream);\r\n                        }\r\n                    }\r\n\r\n                    DataFacade.AddNew<IMediaFile>(newWorkflowMediaFile, store.DataSourceId.ProviderName);\r\n                }\r\n                else if (draggedFolder != null)\r\n                {\r\n                    return false;\r\n                }\r\n                else\r\n                {\r\n                    Verify.ThrowInvalidOperationException(\"Unexpected media data type.\");\r\n                }\r\n            }\r\n            else\r\n            {\r\n                Verify.ThrowInvalidOperationException(\"Unexpected copying mode.\");\r\n            }\r\n\r\n\r\n            if (oldPath != null)\r\n            {\r\n                EntityToken entityToken = GetFolderByPath(oldPath, storeId);\r\n\r\n                if (entityToken != null)\r\n                {\r\n                    var oldFolderSpecificTreeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);\r\n                    oldFolderSpecificTreeRefresher.PostRefreshMesseges(entityToken);\r\n                }\r\n            }\r\n\r\n            if (path != oldPath)\r\n            {\r\n                EntityToken entityToken = GetFolderByPath(path, storeId);\r\n\r\n                if (entityToken != null)\r\n                {\r\n                    var oldFolderSpecificTreeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);\r\n                    oldFolderSpecificTreeRefresher.PostRefreshMesseges(entityToken);\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n       \r\n        private static StoreIdFilterQueryable<T> GetQuery<T>(string storeId) where T : class, IData\r\n        {\r\n            return new StoreIdFilterQueryable<T>(DataFacade.GetData<T>(), storeId);\r\n        }\r\n\r\n        private static EntityToken GetFolderByPath(string path, string storeId)\r\n        {\r\n            Verify.ArgumentNotNull(path, \"path\");\r\n\r\n            if (path == string.Empty || path == \"/\")\r\n            {\r\n                return new MediaRootFolderProviderEntityToken(storeId);\r\n            }\r\n\r\n            var queryable = new StoreIdFilterQueryable<IMediaFileFolder>(DataFacade.GetData<IMediaFileFolder>(), storeId);\r\n\r\n            var folder = (from folderInfo in queryable\r\n                          where folderInfo.StoreId == storeId &&\r\n                            folderInfo.Path == path\r\n                          select folderInfo).FirstOrDefault();\r\n\r\n            return folder?.GetDataEntityToken();\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetChildrenOnPath(string parentPath, string storeId, SearchToken searchToken)\r\n        {\r\n            bool showFiles = true;\r\n            bool showFolders = true;\r\n            string folderChainToShow = null;\r\n\r\n            if(searchToken is MediaFileSearchToken)\r\n            {\r\n                var mediaSearchToken = searchToken as MediaFileSearchToken;\r\n                string folderPath = mediaSearchToken.Folder;\r\n                if(folderPath != null)\r\n                {\r\n                    bool isUnderTargetFolder = parentPath.Length >= folderPath.Length;\r\n                    showFiles = isUnderTargetFolder;\r\n\r\n                    if (!isUnderTargetFolder)\r\n                    {\r\n                        // Filtering folders so we can see only ancestors \"chain\"\r\n                        folderChainToShow = folderPath + \"/\";\r\n                    }\r\n\r\n                    showFolders = !(mediaSearchToken.HideSubfolders && parentPath == folderPath);\r\n                }\r\n            }\r\n\r\n            IEnumerable<Element> result = null;\r\n            if (showFolders)\r\n            {\r\n                var folderQueryable = GetQuery<IMediaFileFolder>(storeId);\r\n\r\n                string parentPathPrefix = parentPath + (parentPath.EndsWith(\"/\") ? \"\" : \"/\");\r\n                int parentPathPrefixLength = parentPath.Length;\r\n\r\n                var childFolders = folderQueryable.Where(item => item.Path.StartsWith(parentPathPrefix)\r\n                                    && item.Path.LastIndexOf('/') <= parentPathPrefixLength).Evaluate();\r\n\r\n                result =\r\n                   (from item in childFolders\r\n                    where folderChainToShow == null || folderChainToShow.StartsWith(item.Path + '/')\r\n                    orderby item.Path\r\n                    select CreateFolderElement(item)).ToList();\r\n\r\n            }\r\n\r\n            if(showFiles)\r\n            {\r\n                Expression<Func<IMediaFile, bool>> predicate = BuildFilePredicate(searchToken);\r\n\r\n                var fileQueryable = GetQuery<IMediaFile>(storeId);\r\n\r\n                var files = (from item in fileQueryable\r\n                             where item.FolderPath == parentPath\r\n                             orderby item.FileName\r\n                             select item).Where(predicate).Evaluate().Select(CreateFileElement).ToList();\r\n\r\n                result = result?.Concat(files) ?? files;\r\n            }\r\n\r\n            return result != null ? result.Evaluate() : Enumerable.Empty<Element>();\r\n        }\r\n\r\n\r\n        private Expression<Func<IMediaFile, bool>> BuildFilePredicate(SearchToken searchToken)\r\n        {\r\n            var predicates = new List<Expression<Func<IMediaFile, bool>>>();\r\n\r\n            if (_showOnlyImages)\r\n            {\r\n                predicates.Add(x => x.MimeType != null && x.MimeType.StartsWith(\"image\"));\r\n            }\r\n\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                string keyword = searchToken.Keyword.ToLower();\r\n\r\n                predicates.Add(x =>\r\n                    (x.Description != null && x.Description.ToLower().Contains(keyword)) ||\r\n                     (x.FileName != null && x.FileName.ToLower().Contains(keyword)) ||\r\n                     (x.Title != null && x.Title.ToLower().Contains(keyword)));\r\n            }\r\n\r\n            var mediaFileSearchToken = searchToken as MediaFileSearchToken;\r\n            if (mediaFileSearchToken != null)\r\n            {\r\n                if (mediaFileSearchToken.MimeTypes != null && mediaFileSearchToken.MimeTypes.Length > 0)\r\n                {\r\n                    var mimeTypes = new List<string>(mediaFileSearchToken.MimeTypes);\r\n                    predicates.Add(x => mimeTypes.Contains(x.MimeType));\r\n                }\r\n\r\n                if (mediaFileSearchToken.Extensions != null && mediaFileSearchToken.Extensions.Length > 0)\r\n                {\r\n                    ParameterExpression fileParameter = Expression.Parameter(typeof(IMediaFile), \"file\");\r\n\r\n                    Expression body = null;\r\n\r\n                    foreach (string extension in mediaFileSearchToken.Extensions)\r\n                    {\r\n                        string suffix = extension.StartsWith(\".\") ? extension : \".\" + extension;\r\n\r\n                        // \"file.FileName\"\r\n                        Expression fileName = Expression.Property(fileParameter, typeof(IFile), \"FileName\");\r\n\r\n                        // Building \"file.FileName.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)\"\r\n                        MethodCallExpression predicate = Expression.Call(fileName,\r\n                                                                         EndsWithMethodInfo,\r\n                                                                         Expression.Constant(suffix),\r\n                                                                         IgnoreCaseConstantExpression);\r\n\r\n                        if (body == null)\r\n                        {\r\n                            // file => file.FileName.EndsWith(extension, StringComparison.OrdinalIgnoreCase);\r\n                            body = predicate;\r\n                        }\r\n                        else\r\n                        {\r\n                            // body = (.....) || file.FileName.EndsWith(extension, StringComparison.OrdinalIgnoreCase;\r\n                            body = Expression.OrElse(body, predicate);\r\n                        }\r\n                    }\r\n\r\n                    predicates.Add(Expression.Lambda<Func<IMediaFile, bool>>(body, fileParameter));\r\n                }\r\n            }\r\n\r\n            if (predicates.Count == 0)\r\n            {\r\n                return (x => true);\r\n            }\r\n            \r\n            return AndPredicates(predicates);\r\n        }\r\n\r\n        private static Expression<Func<T, bool>> AndPredicates<T>(IEnumerable<Expression<Func<T, bool>>> predicates) where T: IData\r\n        {\r\n            var p = Expression.Parameter(typeof(IMediaFile));\r\n\r\n            Expression andBody = null;\r\n\r\n            foreach (Expression<Func<T, bool>> predicate in predicates)\r\n            {\r\n                var conditionPart = Expression.Invoke(predicate, p);\r\n\r\n                andBody = andBody == null\r\n                            ? conditionPart as Expression\r\n                            : Expression.And(andBody, conditionPart);\r\n            }\r\n\r\n            return Expression.Lambda<Func<T, bool>>(andBody, p);\r\n        }\r\n\r\n       \r\n\r\n        private Element CreateFileElement(IMediaFile file)\r\n        {\r\n            var element = new Element(_context.CreateElementHandle(file.GetDataEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = file.FileName,\r\n                    ToolTip = GetResourceString(\"MediaFileProviderElementProvider.MediaFileItemToolTip\"),\r\n                    HasChildren = false,\r\n                    Icon = this.MediaFileIcon(file.MimeType),\r\n                    OpenedIcon = this.MediaFileIcon(file.MimeType)\r\n                }\r\n            };\r\n\r\n            if (DataProviderPluginFacade.IsWriteableProvider(file.DataSourceId.ProviderName))\r\n            {\r\n                element.MovabilityInfo.DragType = typeof(IMediaFile);\r\n                element.MovabilityInfo.DragSubType = file.StoreId;\r\n            }\r\n            \r\n            Verify.IsNotNull(file.FileName, \"file.FileName is null. Media ID: {0}\", file.Id);\r\n            Verify.IsNotNull(file.FolderPath, \"file.FolderPath is null. Media ID: {0}\", file.Id);\r\n\r\n            element.PropertyBag.Add(\"ElementId\", file.StoreId + \":\" + file.FolderPath.Combine(file.FileName, '/'));\r\n\r\n            element.PropertyBag.Add(\"Uri\", GetMediaUrl(file, true, false));\r\n            element.PropertyBag.Add(\"ElementType\", file.MimeType);\r\n\r\n            if (file.MimeType.StartsWith(\"image/\"))\r\n            {\r\n                string previewImageUrl =  UrlUtils.ResolvePublicUrl(MediaUrls.BuildUrl(file, UrlKind.Internal) + \"?mw={width}&mh={height}\");\r\n\r\n                DateTime? modificationTime = file.LastWriteTime ?? file.CreationTime;\r\n                if (modificationTime != null)\r\n                {\r\n                    previewImageUrl += \"&timestamp=\" + modificationTime.GetHashCode();\r\n                }\r\n\r\n                element.PropertyBag.Add(\"ListViewImage\", previewImageUrl);\r\n                element.PropertyBag.Add(\"DetailViewImage\", previewImageUrl);\r\n            }\r\n\r\n            GetFileActions(file).ForEach(element.AddAction);\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        internal static string GetMediaUrl(IMediaFile file, bool isInternal, bool downloadable)\r\n        {\r\n            return MediaUrlHelper.GetUrl(file, isInternal, downloadable);\r\n        }\r\n\r\n\r\n\r\n        private Element CreateFolderElement(IMediaFileFolder folder)\r\n        {\r\n            bool hasFolders = DataFacade.GetData<IMediaFileFolder>().Any(f => f.Path.StartsWith(folder.Path));\r\n\r\n            bool hasChildren = hasFolders;\r\n\r\n            if(!hasChildren)\r\n            {\r\n                bool hasFiles = DataFacade.GetData<IMediaFile>().Any(file => file.FolderPath == folder.Path);\r\n                hasChildren = hasFiles;\r\n            }\r\n\r\n            ResourceHandle icon = this.EmptyFolderIcon;\r\n            ResourceHandle openIcon = this.OpenFolderIcon;\r\n            if (hasChildren)\r\n            {\r\n                icon = this.FolderIcon;\r\n            }\r\n            if (folder.IsReadOnly)\r\n            {\r\n                icon = MediaFileProviderElementProvider.ReadOnlyFolderClosed;\r\n                openIcon = MediaFileProviderElementProvider.ReadOnlyFolderOpen;\r\n            }\r\n\r\n            Element element = new Element(_context.CreateElementHandle(folder.GetDataEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = folder.Path.GetFolderName('/'),\r\n                    ToolTip = GetResourceString(\"MediaFileProviderElementProvider.OrganizedFilesAndFoldersToolTip\"),\r\n                    HasChildren = hasChildren,\r\n                    Icon = icon,\r\n                    OpenedIcon = openIcon\r\n                },\r\n            };\r\n\r\n            if (DataProviderPluginFacade.IsWriteableProvider(folder.DataSourceId.ProviderName))\r\n            {\r\n                element.MovabilityInfo.AddDropType(typeof(IMediaFileFolder), folder.StoreId);\r\n                element.MovabilityInfo.AddDropType(typeof(IMediaFile), folder.StoreId);\r\n                element.MovabilityInfo.DragType = typeof(IMediaFileFolder);\r\n                element.MovabilityInfo.DragSubType = folder.StoreId;\r\n            }\r\n\r\n            element.PropertyBag.Add(\"ReadOnly\", folder.IsReadOnly.ToString());\r\n            element.PropertyBag.Add(\"ElementId\", folder.StoreId + \":\" + folder.Path);\r\n\r\n            foreach (ElementAction action in GetFolderActions(folder))\r\n            {\r\n                element.AddAction(action);\r\n            }\r\n            return element;\r\n        }\r\n\r\n        private IEnumerable<ElementAction> GetFileActions(IMediaFile file)\r\n        {\r\n            IList<ElementAction> fileActions = new List<ElementAction>();\r\n            //if (!file.IsReadOnly)\r\n            //{\r\n            fileActions.Add(\r\n             new ElementAction(new ActionHandle(\r\n                 new WorkflowActionToken(\r\n                     WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.DeleteMediaFileWorkflow\"),\r\n                     new PermissionType[] { PermissionType.Delete }\r\n                )))\r\n             {\r\n                 VisualData = new ActionVisualizedData\r\n                 {\r\n                     Label = GetResourceString(\"MediaFileProviderElementProvider.DeleteMediaFile\"),\r\n                     ToolTip = GetResourceString(\"MediaFileProviderElementProvider.DeleteMediaFileToolTip\"),\r\n                     Icon = DeleteMediaFile,\r\n                     Disabled = file.IsReadOnly,\r\n                     ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                     ActionLocation = new ActionLocation\r\n                     {\r\n                         ActionType = ActionType.Delete,\r\n                         IsInFolder = false,\r\n                         IsInToolbar = true,\r\n                         ActionGroup = PrimaryFileActionGroup\r\n                     }\r\n                 }\r\n             });\r\n\r\n            fileActions.Add(\r\n             new ElementAction(new ActionHandle(\r\n                 new WorkflowActionToken(\r\n                     WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.EditMediaFileWorkflow\"),\r\n                     new PermissionType[] { PermissionType.Edit }\r\n                )))\r\n             {\r\n                 VisualData = new ActionVisualizedData\r\n                 {\r\n                     Label = GetResourceString(\"MediaFileProviderElementProvider.EditMediaFile\"),\r\n                     ToolTip = GetResourceString(\"MediaFileProviderElementProvider.EditMediaFileToolTip\"),\r\n                     Icon = EditMediaFile,\r\n                     Disabled = file.IsReadOnly,\r\n                     ActionLocation = new ActionLocation\r\n                     {\r\n                         ActionType = ActionType.Edit,\r\n                         IsInFolder = false,\r\n                         IsInToolbar = true,\r\n                         ActionGroup = PrimaryFileActionGroup\r\n                     }\r\n                 }\r\n             });\r\n\r\n            if (file.MimeType != null && MimeTypeInfo.IsTextFile(file.MimeType))\r\n            {\r\n                fileActions.Add(\r\n                 new ElementAction(new ActionHandle(\r\n                     new WorkflowActionToken(\r\n                         WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.EditMediaFileTextContentWorkflow\"),\r\n                         new PermissionType[] { PermissionType.Edit }\r\n                    )))\r\n                 {\r\n                     VisualData = new ActionVisualizedData\r\n                     {\r\n                         Label = GetResourceString(\"MediaFileProviderElementProvider.EditMediaFileTextContent\"),\r\n                         ToolTip = GetResourceString(\"MediaFileProviderElementProvider.EditMediaFileTextContentToolTip\"),\r\n                         Icon = CommonCommandIcons.Edit,\r\n                         Disabled = file.IsReadOnly,\r\n                         ActionLocation = new ActionLocation\r\n                         {\r\n                             ActionType = ActionType.Edit,\r\n                             IsInFolder = false,\r\n                             IsInToolbar = true,\r\n                             ActionGroup = PrimaryFileToolsActionGroup\r\n                         }\r\n                     }\r\n                 });\r\n            }\r\n\r\n            if (file.MimeType != null && file.MimeType.StartsWith(\"image\"))\r\n            {\r\n                fileActions.Add(\r\n                    new ElementAction(new ActionHandle(new EditImageActionToken()))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = GetResourceString(\"MediaFileProviderElementProvider.EditImage\"),\r\n                        ToolTip = GetResourceString(\"MediaFileProviderElementProvider.EditImageToolTip\"),\r\n                        Icon = MediaFileProviderElementProvider.EditImageFile,\r\n                        Disabled = file.IsReadOnly,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryFileToolsActionGroup\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n\r\n            if (file.MimeType != null)\r\n            {\r\n                fileActions.Add(\r\n                    new ElementAction(new ActionHandle(new DownloadFileActionToken()))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetResourceString(\"MediaFileProviderElementProvider.Download\"),\r\n                            ToolTip = GetResourceString(\"MediaFileProviderElementProvider.DownloadToolTip\"),\r\n                            Icon = DownloadFile,\r\n                            Disabled = file.Length == 0,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Other,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryFileToolsActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n            }\r\n\r\n            fileActions.Add(\r\n          new ElementAction(new ActionHandle(\r\n              new WorkflowActionToken(\r\n                  WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.UploadNewMediaFileWorkflow\"),\r\n                  new PermissionType[] { PermissionType.Edit }\r\n                )))\r\n          {\r\n              VisualData = new ActionVisualizedData\r\n              {\r\n                  Label = GetResourceString(\"MediaFileProviderElementProvider.ChangeMediaFile\"),\r\n                  ToolTip = GetResourceString(\"MediaFileProviderElementProvider.ChangeMediaFileToolTip\"),\r\n                  Icon = MediaFileProviderElementProvider.ReplaceMediaFile,\r\n                  Disabled = file.IsReadOnly,\r\n                  ActionLocation = new ActionLocation\r\n                  {\r\n                      ActionType = ActionType.Edit,\r\n                      IsInFolder = false,\r\n                      IsInToolbar = true,\r\n                      ActionGroup = PrimaryFileActionGroup\r\n                  }\r\n              }\r\n          });\r\n            //}\r\n\r\n            return fileActions;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<ElementAction> GetFolderActions(IMediaFileFolder folder)\r\n        {\r\n            IList<ElementAction> folderActions = new List<ElementAction>();\r\n            if (!folder.IsReadOnly)\r\n            {\r\n                folderActions.Add(\r\n                 new ElementAction(new ActionHandle(\r\n                     new WorkflowActionToken(\r\n                         WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.AddNewMediaFolderWorkflow\"),\r\n                         new PermissionType[] { PermissionType.Add }\r\n                    )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetResourceString(\"MediaFileProviderElementProvider.AddMediaFolder\"),\r\n                            ToolTip = GetResourceString(\"MediaFileProviderElementProvider.AddMediaFolderToolTip\"),\r\n                            Icon = MediaFileProviderElementProvider.AddMediaFolder,\r\n                            Disabled = false,\r\n                            ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryFolderActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                folderActions.Add(\r\n                     new ElementAction(new ActionHandle(\r\n                         new WorkflowActionToken(\r\n                             WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.DeleteMediaFolderWorkflow\"),\r\n                             new PermissionType[] { PermissionType.Delete }\r\n                        )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetResourceString(\"MediaFileProviderElementProvider.DeleteMediaFolder\"),\r\n                            ToolTip = GetResourceString(\"MediaFileProviderElementProvider.DeleteMediaFolderToolTip\"),\r\n                            Icon = DeleteMediaFolder,\r\n                            Disabled = false,\r\n                            ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryFolderActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                folderActions.Add(\r\n                        new ElementAction(new ActionHandle(\r\n                            new WorkflowActionToken(\r\n                                WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.EditMediaFolderWorkflow\"),\r\n                                new PermissionType[] { PermissionType.Edit }\r\n                            )))\r\n                       {\r\n                           VisualData = new ActionVisualizedData\r\n                           {\r\n                               Label = GetResourceString(\"MediaFileProviderElementProvider.EditMediaFolder\"),\r\n                               ToolTip = GetResourceString(\"MediaFileProviderElementProvider.EditMediaFolderToolTip\"),\r\n                               Icon = EditMediaFolder,\r\n                               Disabled = false,\r\n                               ActionLocation = new ActionLocation\r\n                               {\r\n                                   ActionType = ActionType.Edit,\r\n                                   IsInFolder = false,\r\n                                   IsInToolbar = true,\r\n                                   ActionGroup = PrimaryFolderActionGroup\r\n                               }\r\n                           }\r\n                       });\r\n\r\n                folderActions.Add(\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.AddNewMediaFileWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Add }\r\n                        )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = GetResourceString(\"MediaFileProviderElementProvider.AddMediaFile\"),\r\n                            ToolTip = GetResourceString(\"MediaFileProviderElementProvider.AddMediaFileToolTip\"),\r\n                            Icon = MediaFileProviderElementProvider.AddMediaFile,\r\n                            Disabled = false,\r\n                            ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryFileActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                folderActions.Add(\r\n                     new ElementAction(new ActionHandle(\r\n                         new WorkflowActionToken(\r\n                             WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider.AddMediaZipFileWorkflow\"),\r\n                             new PermissionType[] { PermissionType.Add }\r\n                         )))\r\n                     {\r\n                         VisualData = new ActionVisualizedData\r\n                         {\r\n                             Label = GetResourceString(\"MediaFileProviderElementProvider.UploadZipFile\"),\r\n                             ToolTip = GetResourceString(\"MediaFileProviderElementProvider.UploadZipFileToolTip\"),\r\n                             Icon = MediaFileProviderElementProvider.UploadZipFile,\r\n                             Disabled = false,\r\n                             ActionLocation = new ActionLocation\r\n                             {\r\n                                 ActionType = ActionType.Add,\r\n                                 IsInFolder = false,\r\n                                 IsInToolbar = true,\r\n                                 ActionGroup = PrimaryFileActionGroup\r\n                             }\r\n                         }\r\n                     });\r\n            }\r\n\r\n            return folderActions;\r\n        }\r\n\r\n        private static string GetResourceString(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Management\", key);\r\n        }\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n\r\n\r\n        private ResourceHandle MediaFileIcon(string mimeType)\r\n        {\r\n            return MimeTypeInfo.GetResourceHandleFromMimeType(MimeTypeInfo.GetCanonical(mimeType));\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class EditImageActionExecutor : Composite.C1Console.Actions.IActionExecutor\r\n    {\r\n        public Composite.C1Console.Actions.FlowToken Execute(Composite.C1Console.Security.EntityToken entityToken, Composite.C1Console.Security.ActionToken actionToken, Composite.C1Console.Actions.FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            DataEntityToken token = (DataEntityToken)entityToken;\r\n            IMediaFile mediaFile = (IMediaFile)token.Data;\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n            string url = UrlUtils.ResolveAdminUrl(string.Format(\"content/views/editors/imageeditor/ImageEditor.aspx?src={0}&lastWriteTime={1}\", System.Web.HttpUtility.UrlEncode(mediaFile.CompositePath), System.Web.HttpUtility.UrlEncode(mediaFile.LastWriteTime.ToString())));\r\n\r\n            Composite.C1Console.Events.ConsoleMessageQueueFacade.Enqueue(\r\n                new Composite.C1Console.Events.OpenViewMessageQueueItem \r\n                { \r\n                    EntityToken = EntityTokenSerializer.Serialize(entityToken, true),\r\n                    Url = url, \r\n                    ViewId = Guid.NewGuid().ToString(), \r\n                    ViewType = Composite.C1Console.Events.ViewType.Main \r\n                }, \r\n            currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class DownloadFileActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            DataEntityToken token = (DataEntityToken)entityToken;\r\n            IMediaFile mediaFile = (IMediaFile)token.Data;\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            string url = MediaFileProviderElementProvider.GetMediaUrl(mediaFile, false, true);\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(url), currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n    [ActionExecutor(typeof(EditImageActionExecutor))]\r\n    internal sealed class EditImageActionToken : ActionToken\r\n    {\r\n        private static readonly IEnumerable<PermissionType> _permissionTypes = new [] { PermissionType.Edit };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes => _permissionTypes;\r\n\r\n\r\n        public override string Serialize() => \"EditImage\";\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new EditImageActionToken();\r\n        }\r\n    }\r\n\r\n    [ActionExecutor(typeof(DownloadFileActionExecutor))]\r\n    internal sealed class DownloadFileActionToken : ActionToken\r\n    {\r\n        private static readonly IEnumerable<PermissionType> _permissionTypes = new [] { PermissionType.Read };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes => _permissionTypes;\r\n\r\n\r\n        public override string Serialize() => \"DownloadFile\";\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new DownloadFileActionToken();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(MediaFileElementProviderAssembler))]\r\n    internal sealed class MediaFileElementProviderData : HooklessElementProviderData\r\n    {\r\n        private const string _showOnlyImagesProperty = \"showOnlyImages\";\r\n        [ConfigurationProperty(_showOnlyImagesProperty, IsRequired = true)]\r\n        public bool ShowOnlyImages\r\n        {\r\n            get { return (bool)base[_showOnlyImagesProperty]; }\r\n            set { base[_showOnlyImagesProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _rootLabel = \"rootLabel\";\r\n        [ConfigurationProperty(_rootLabel, IsRequired = true)]\r\n        public string RootLabel\r\n        {\r\n            get { return (string)base[_rootLabel]; }\r\n            set { base[_rootLabel] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class MediaFileElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new MediaFileProviderElementProvider(objectConfiguration as MediaFileElementProviderData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/MediaFileProviderEntityTokenSecurityAncestorProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    internal sealed class MediaFileProviderEntityTokenSecurityAncestorProvider : ISecurityAncestorProvider\r\n\t{\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            // ok since the only hook is on the root folder\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/MediaFileSearchToken.cs",
    "content": "﻿using Composite.C1Console.Elements;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic class MediaFileSearchToken : SearchToken\r\n\t{\r\n        /// <exclude />\r\n        public string[] MimeTypes { get; set; }\r\n\r\n        /// <exclude />\r\n        public string[] Extensions { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Folder { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool HideSubfolders { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/MediaRootFolderProviderEntityToken.cs",
    "content": "﻿using Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(MediaFileProviderEntityTokenSecurityAncestorProvider))]\r\n    public sealed class MediaRootFolderProviderEntityToken : EntityToken\r\n\t{\r\n        /// <exclude />\r\n        public MediaRootFolderProviderEntityToken(string parentFolder)\r\n        {\r\n            Verify.ArgumentNotNull(parentFolder, nameof(parentFolder));\r\n\r\n            Id = parentFolder;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type => \"\";\r\n\r\n        /// <exclude />\r\n        public override string Source => \"\";\r\n\r\n        /// <exclude />\r\n        public override string Id { get; }\r\n\r\n        /// <exclude />\r\n        public override string  Serialize() => DoSerialize();\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            string type, source, id;\r\n\r\n            EntityToken.DoDeserialize(serializedData, out type, out source, out id);\r\n\r\n            return new MediaRootFolderProviderEntityToken(id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/WorkflowMediaFile.cs",
    "content": "﻿using System;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Streams;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [FileStreamManager(typeof(FileSystemFileStreamManager))]\r\n    public sealed class WorkflowMediaFile : FileSystemFileBase, IMediaFile\r\n    {\r\n        /// <exclude />\r\n        public WorkflowMediaFile()\r\n        {\r\n            Title = string.Empty;\r\n            Description = string.Empty;\r\n            MimeType = string.Empty;\r\n            Tags = string.Empty;\r\n            DataSourceId = new DataSourceId(typeof(IMediaFile));\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public WorkflowMediaFile(IMediaFile file)\r\n        {\r\n            Id = file.Id;\r\n            StoreId = file.StoreId;\r\n            Title = file.Title;\r\n            Culture = file.Culture;\r\n            CreationTime = file.CreationTime;\r\n            DataSourceId = file.DataSourceId;\r\n            Description = file.Description;\r\n            Tags = file.Tags;\r\n            FileName = file.FileName;\r\n            FolderPath = file.FolderPath;\r\n            IsReadOnly = file.IsReadOnly;\r\n            LastWriteTime = file.LastWriteTime;\r\n            Length = file.Length;\r\n            MimeType = file.MimeType;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Guid Id\r\n        {\r\n            get; internal set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string KeyPath\r\n        {\r\n            get { return this.GetKeyPath(); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string CompositePath\r\n        {\r\n            get { return this.GetCompositePath(); }\r\n            set { throw new InvalidOperationException(); }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string StoreId\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Title\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Description\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Tags { get; set; }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Culture\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MimeType\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public int? Length\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        \r\n        /// <exclude />\r\n        public DateTime? CreationTime\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public DateTime? LastWriteTime\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsReadOnly\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FolderPath\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FileName\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public DataSourceId DataSourceId\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/ZipMediaFileExtractor.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.IO.Compression;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    /// <summary>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class ZipMediaFileExtractor\r\n    {\r\n        private static readonly TimeSpan ExtrationTimeout = TimeSpan.FromMinutes(15);\r\n\r\n\r\n        /// <exclude />\r\n        public static void AddZip(string providerName, string parentPath, Stream compressedStream, bool recreateDirStructure, bool overwrite)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(providerName, nameof(providerName));\r\n            Verify.ArgumentNotNullOrEmpty(parentPath, nameof(parentPath));\r\n\r\n            IList<IMediaFile> files;\r\n            IList<IMediaFileFolder> folders;\r\n\r\n            Extract(parentPath, compressedStream, out folders, out files);\r\n\r\n            if (recreateDirStructure)\r\n            {\r\n                var folderComparer = new FolderComparer();\r\n                var currentDirs = DataFacade.GetData<IMediaFileFolder>().Where(x => x.Path.StartsWith(parentPath));\r\n                folders = folders.Except(currentDirs, folderComparer).ToList();\r\n\r\n                DataFacade.AddNew<IMediaFileFolder>(folders, providerName);\r\n                AddFiles(providerName, files, overwrite);\r\n            }\r\n            else\r\n            {\r\n                foreach (IMediaFile file in files)\r\n                {\r\n                    file.FolderPath = parentPath;\r\n                }\r\n                AddFiles(providerName, files, overwrite);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static bool Exists(IMediaFile file)\r\n        {\r\n            return DataFacade.GetData<IMediaFile>().Any(x => x.FolderPath == file.FolderPath && x.FileName == file.FileName);\r\n        }\r\n\r\n\r\n\r\n        private static void AddFiles(string providerName, IEnumerable<IMediaFile> files, bool overwrite)\r\n        {\r\n            foreach (IMediaFile file in files)\r\n            {\r\n                using (var transactionScope = TransactionsFacade.CreateNewScope(ExtrationTimeout))\r\n                {\r\n                    EnsureFolderExistence(file.FolderPath);\r\n\r\n                    if (overwrite)\r\n                    {\r\n                        if (Exists(file))\r\n                        {\r\n                            IMediaFile currentFile = DataFacade.GetData<IMediaFile>()\r\n                                                    .First(x => x.FolderPath == file.FolderPath && x.FileName == file.FileName);\r\n                            using (Stream readStream = file.GetReadStream())\r\n                            {\r\n                                using (Stream writeStream = currentFile.GetNewWriteStream())\r\n                                {\r\n                                    readStream.CopyTo(writeStream);\r\n                                }\r\n                            }\r\n                            DataFacade.Update(currentFile);\r\n                        }\r\n                        else\r\n                        {\r\n                            DataFacade.AddNew<IMediaFile>(file, providerName);\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        int counter = 0;\r\n                        string extension = Path.GetExtension(file.FileName);\r\n                        string name = file.FileName.GetNameWithoutExtension();\r\n                        while (Exists(file))\r\n                        {\r\n                            counter++;\r\n                            file.FileName = name + counter.ToString() + extension;\r\n                        }\r\n                        DataFacade.AddNew<IMediaFile>(file, providerName);\r\n                    }\r\n\r\n                    transactionScope.Complete();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void EnsureFolderExistence(string folderPath)\r\n        {\r\n            // TODO: Implement\r\n        }\r\n\r\n\r\n\r\n        private static void Extract(string parentPath, Stream compressedStream,\r\n            out IList<IMediaFileFolder> folders, out IList<IMediaFile> files)\r\n        {\r\n            folders = new List<IMediaFileFolder>();\r\n            files = new List<IMediaFile>();\r\n\r\n            using (var zipArchive = new ZipArchive(compressedStream))\r\n            {\r\n                foreach (var entry in zipArchive.Entries)\r\n                {\r\n                    if (entry.FullName.EndsWith(\"/\"))\r\n                    {\r\n                        CreateFoldersRec(folders, parentPath, entry.FullName);\r\n                    }\r\n                    else\r\n                    {\r\n                        var directory = entry.FullName.GetDirectory('/');\r\n\r\n                        string fileName = entry.Name;\r\n\r\n                        var mediaFile = new WorkflowMediaFile\r\n                        {\r\n                            FileName = fileName,\r\n                            Title = fileName.GetNameWithoutExtension(),\r\n                            FolderPath = parentPath.Combine(directory, '/'),\r\n                            CreationTime = DateTime.Now,\r\n                            Culture = C1Console.Users.UserSettings.ActiveLocaleCultureInfo.Name,\r\n                            LastWriteTime = DateTime.Now,\r\n                            MimeType = MimeTypeInfo.GetCanonicalFromExtension(Path.GetExtension(fileName))\r\n                        };\r\n\r\n                        int length = CopyZipData(entry.Open(), mediaFile);\r\n                        mediaFile.Length = length;\r\n\r\n                        files.Add(mediaFile);\r\n\r\n                        if (directory != \"\")\r\n                        {\r\n                            CreateFoldersRec(folders, parentPath, directory);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            folders = folders.Distinct(new FolderComparer()).Where(x => x.Path != string.Empty).OrderBy(x => x.Path.Length).ToList();\r\n        }\r\n\r\n        private static void CreateFoldersRec(IList<IMediaFileFolder> folders, string parentPath, string directoryEntryName)\r\n        {\r\n            do\r\n            {\r\n                CreateFolder(folders, parentPath, directoryEntryName);\r\n\r\n                directoryEntryName = ReduceFolderPath(directoryEntryName);\r\n            }\r\n            while (directoryEntryName != null);\r\n        }\r\n\r\n        private static void CreateFolder(IList<IMediaFileFolder> folders, string parentPath, string directoryEntryName)\r\n        {\r\n            IMediaFileFolder folder = DataFacade.BuildNew<IMediaFileFolder>();\r\n            folder.Title = directoryEntryName.GetFolderName('/');\r\n            folder.Path = parentPath.Combine(directoryEntryName, '/');\r\n\r\n            folders.Add(folder);\r\n        }\r\n\r\n        private static string ReduceFolderPath(string folderPath)\r\n        {\r\n            var offset = folderPath.LastIndexOf(\"/\", folderPath.Length - 2, StringComparison.Ordinal);\r\n\r\n            return (offset > 0) ? folderPath.Substring(0, offset) : null;\r\n        }\r\n\r\n        private static int CopyZipData(Stream from, WorkflowMediaFile mediaFile)\r\n        {\r\n            var fileSize = 0;\r\n\r\n            using (var streamWriter = mediaFile.GetNewWriteStream())\r\n            {\r\n                var data = new byte[2048];\r\n                while (true)\r\n                {\r\n                    var size = @from.Read(data, 0, data.Length);\r\n                    if (size > 0)\r\n                    {\r\n                        streamWriter.Write(data, 0, size);\r\n                        fileSize += size;\r\n                    }\r\n                    else\r\n                    {\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return fileSize;\r\n        }\r\n\r\n\r\n\r\n        private class FolderComparer : IEqualityComparer<IMediaFileFolder>\r\n        {\r\n            public bool Equals(IMediaFileFolder x, IMediaFileFolder y)\r\n            {\r\n                return x.Path == y.Path;\r\n            }\r\n\r\n            public int GetHashCode(IMediaFileFolder obj)\r\n            {\r\n                return obj.Path.GetHashCode();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/MethodBasedFunctionAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]\r\n    [Obsolete(\"The MethodBasedFunction attribute is no longer required and will be removed. Please remove this attribute from your class.\", true)]\r\n    public sealed class MethodBasedFunctionAttribute : Attribute\r\n\t{\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/MethodBasedFunctionProviderElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.C1Console.Workflow;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(MethodBasedFunctionProviderElementProviderData))]\r\n    internal sealed class MethodBasedFunctionProviderElementProvider : BaseFunctionProviderElementProvider.BaseFunctionProviderElementProvider\r\n    {\r\n        private string _providerName;\r\n\r\n        public static ResourceHandle AddIcon { get { return GetIconHandle(\"method-based-function-add\"); } }\r\n        public static ResourceHandle EditIcon { get { return GetIconHandle(\"method-based-function-edit\"); } }\r\n        public static ResourceHandle DeleteIcon { get { return GetIconHandle(\"method-based-function-delete\"); } }\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        public MethodBasedFunctionProviderElementProvider(string providerName)\r\n        {\r\n            _providerName = providerName;\r\n        }\r\n\r\n\r\n        protected override string RootFolderLabel\r\n        {\r\n            get\r\n            {\r\n                return StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"RootFolderLabel\");\r\n            }\r\n        }\r\n\r\n\r\n        protected override string RootFolderToolTip\r\n        {\r\n            get\r\n            {\r\n                return StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"RootFolderToolTip\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<IFunctionTreeBuilderLeafInfo> OnGetFunctionInfos(SearchToken searchToken)\r\n        {\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                string keyword = searchToken.Keyword.ToLowerInvariant();\r\n\r\n                return\r\n                    from function in DataFacade.GetData<IMethodBasedFunctionInfo>()\r\n                    where function.MethodName.ToLowerInvariant().Contains(keyword) ||\r\n                          function.Namespace.ToLowerInvariant().Contains(keyword) ||\r\n                          function.UserMethodName.ToLowerInvariant().Contains(keyword)\r\n                    select (IFunctionTreeBuilderLeafInfo)new MethodFunctionTreeBuilderLeafInfo(function);\r\n            }\r\n            else\r\n            {\r\n                IEnumerable<IFunctionTreeBuilderLeafInfo> methodBasedFunctions =\r\n                    from function in DataFacade.GetData<IMethodBasedFunctionInfo>()\r\n                    select (IFunctionTreeBuilderLeafInfo)new MethodFunctionTreeBuilderLeafInfo(function);\r\n\r\n                IEnumerable<IFunctionTreeBuilderLeafInfo> editableMethodBasedFunctions =\r\n                     from function in DataFacade.GetData<IInlineFunction>()\r\n                     select (IFunctionTreeBuilderLeafInfo)new EditableMethodFunctionTreeBuilderLeafInfo(function);\r\n\r\n                return methodBasedFunctions.Concat(editableMethodBasedFunctions).OrderBy(f => f.Name);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<Type> OnGetEntityTokenTypes()\r\n        {\r\n            yield return typeof(DataEntityToken);\r\n        }\r\n\r\n\r\n\r\n        protected override IFunctionTreeBuilderLeafInfo OnIsEntityOwner(EntityToken entityToken)\r\n        {\r\n            DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n            if (dataEntityToken == null) return null;\r\n\r\n            if (dataEntityToken.InterfaceType == typeof(IMethodBasedFunctionInfo))\r\n            {\r\n                return new MethodFunctionTreeBuilderLeafInfo(dataEntityToken.Data as IMethodBasedFunctionInfo);\r\n            }\r\n            else if (dataEntityToken.InterfaceType == typeof(IInlineFunction))\r\n            {\r\n                return new EditableMethodFunctionTreeBuilderLeafInfo(dataEntityToken.Data as IInlineFunction);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<ElementAction> OnGetFolderActions()\r\n        {\r\n            return new ElementAction[]\r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider.AddInlineFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Add }\r\n                        ))) {\r\n                         VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"Create\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"CreateToolTip\"),\r\n                            Icon = MethodBasedFunctionProviderElementProvider.AddIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    },\r\n\r\n\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider.AddNewMethodBasedFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Add }\r\n                        ))) {\r\n                         VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"Add\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"AddToolTip\"),\r\n                            Icon = MethodBasedFunctionProviderElementProvider.AddIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }                    \r\n                };\r\n        }\r\n\r\n\r\n        protected override IEnumerable<ElementAction> OnGetFunctionActions(IFunctionTreeBuilderLeafInfo function)\r\n        {\r\n            if (function is MethodFunctionTreeBuilderLeafInfo)\r\n            {\r\n                return new ElementAction[] \r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider.EditMethodBasedFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Edit }\r\n                        ))) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"Edit\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"EditToolTip\"),\r\n                            Icon = MethodBasedFunctionProviderElementProvider.EditIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    },\r\n\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider.DeleteMethodBasedFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Delete }\r\n                        ) { \r\n                            Payload = GetContext().ProviderName\r\n                        })) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"Delete\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"DeleteToolTip\"),\r\n                            Icon = MethodBasedFunctionProviderElementProvider.DeleteIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n            }\r\n            else if (function is EditableMethodFunctionTreeBuilderLeafInfo)\r\n            {\r\n                return new ElementAction[] \r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider.EditInlineFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Edit }\r\n                        ))) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"Edit\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"EditToolTip\"),\r\n                            Icon = MethodBasedFunctionProviderElementProvider.EditIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    },\r\n\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider.DeleteInlineFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Delete }\r\n                        ) { \r\n                            Payload = GetContext().ProviderName\r\n                        })) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"Delete\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"DeleteToolTip\"),\r\n                            Icon = MethodBasedFunctionProviderElementProvider.DeleteIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n            }\r\n\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        private sealed class MethodFunctionTreeBuilderLeafInfo : IFunctionTreeBuilderLeafInfo\r\n        {\r\n            private IMethodBasedFunctionInfo _function;\r\n\r\n            public MethodFunctionTreeBuilderLeafInfo(IMethodBasedFunctionInfo function)\r\n            {\r\n                _function = function;\r\n            }\r\n\r\n            public string Name\r\n            {\r\n                get { return _function.UserMethodName; }\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get { return _function.Namespace; }\r\n            }\r\n\r\n            public EntityToken EntityToken\r\n            {\r\n                get { return _function.GetDataEntityToken(); }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private sealed class EditableMethodFunctionTreeBuilderLeafInfo : IFunctionTreeBuilderLeafInfo\r\n        {\r\n            private IInlineFunction _function;\r\n\r\n            public EditableMethodFunctionTreeBuilderLeafInfo(IInlineFunction function)\r\n            {\r\n                _function = function;\r\n            }\r\n\r\n            public string Name\r\n            {\r\n                get { return _function.Name; }\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get { return _function.Namespace; }\r\n            }\r\n\r\n            public EntityToken EntityToken\r\n            {\r\n                get { return _function.GetDataEntityToken(); }\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(MethodBasedFunctionProviderElementProviderAssembler))]\r\n    internal sealed class MethodBasedFunctionProviderElementProviderData : HooklessElementProviderData\r\n    {\r\n        private const string _methodBasedFunctionProviderNameProperty = \"methodBasedFunctionProviderName\";\r\n        [ConfigurationProperty(_methodBasedFunctionProviderNameProperty, IsRequired = true)]\r\n        public string MethodBasedFunctionProviderName\r\n        {\r\n            get { return (string)base[_methodBasedFunctionProviderNameProperty]; }\r\n            set { base[_methodBasedFunctionProviderNameProperty] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class MethodBasedFunctionProviderElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            MethodBasedFunctionProviderElementProviderData data = (MethodBasedFunctionProviderElementProviderData)objectConfiguration;\r\n\r\n            return new MethodBasedFunctionProviderElementProvider(data.MethodBasedFunctionProviderName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/ClearServerCacheActionExecutor.cs",
    "content": "﻿using Composite.C1Console.Actions;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class ClearServerCacheActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            PackageServerFacade.ClearServerCache();\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/ClearServerCacheActionToken.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    [ActionExecutor(typeof(ClearServerCacheActionExecutor))]\r\n    internal sealed class ClearServerCacheActionToken : ActionToken\r\n    {\r\n        private static PermissionType[] _permissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return \"PackageElementProvider.ClearServerCache\";\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new ClearServerCacheActionToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/InstallLocalPackageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    /// <exclude />\r\n    [Obsolete(\"Is used while processing upgrade packages from C1 3.1 and older. To be removed once lower requirement for upgrade package is at least v3.2\")]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class InstallLocalPackageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        /// <exclude />\r\n        public InstallLocalPackageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void WasFileSelected(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n            e.Result = uploadedFile.HasFile;\r\n        }\r\n\r\n\r\n\r\n        private void DidValidate(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"Errors\") == false;\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.UpdateBinding(\"LayoutLabel\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackage.ShowError.LayoutLabel\"));\r\n            this.UpdateBinding(\"TableCaption\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackage.ShowError.InfoTableCaption\"));\r\n\r\n            this.Bindings.Add(\"UploadedFile\", new UploadedFile());\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_ValidateInstallation_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n                PackageManagerInstallProcess packageManagerInstallProcess = PackageManager.Install(uploadedFile.FileStream, true);\r\n\r\n                if (packageManagerInstallProcess.PreInstallValidationResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(packageManagerInstallProcess.PreInstallValidationResult));\r\n                }\r\n                else\r\n                {\r\n                    List<PackageFragmentValidationResult> validationResult = packageManagerInstallProcess.Validate();\r\n\r\n                    if (validationResult.Count > 0)\r\n                    {\r\n                        this.UpdateBinding(\"LayoutLabel\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackage.ShowWarning.LayoutLabel\"));\r\n                        this.UpdateBinding(\"TableCaption\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackage.ShowWarning.InfoTableCaption\"));\r\n                        this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(validationResult));\r\n                    }\r\n                    else\r\n                    {\r\n                        this.Bindings.Add(\"PackageManagerInstallProcess\", packageManagerInstallProcess);\r\n\r\n                        this.Bindings.Add(\"FlushOnCompletion\", packageManagerInstallProcess.FlushOnCompletion);\r\n                        this.Bindings.Add(\"ReloadConsoleOnCompletion\", packageManagerInstallProcess.ReloadConsoleOnCompletion);\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_Install_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                PackageManagerInstallProcess packageManagerInstallProcess = this.GetBinding<PackageManagerInstallProcess>(\"PackageManagerInstallProcess\");\r\n\r\n                List<PackageFragmentValidationResult> installResult = packageManagerInstallProcess.Install();\r\n                if (installResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(installResult));\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void cleanupCodeActivity_Cleanup_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageManagerInstallProcess packageManagerInstallProcess;\r\n            if (this.TryGetBinding<PackageManagerInstallProcess>(\"PackageManagerInstallProcess\", out packageManagerInstallProcess))\r\n            {\r\n                packageManagerInstallProcess.CancelInstallation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step3CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (this.GetBinding<bool>(\"ReloadConsoleOnCompletion\"))\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);\r\n            }\r\n\r\n            if (this.GetBinding<bool>(\"FlushOnCompletion\"))\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());\r\n        }\r\n\r\n\r\n\r\n        private void showErrorCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<string> rowHeader = new List<string>();\r\n            rowHeader.Add(StringResourceSystemFacade.ParseString(\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.ShowError.MessageTitle}\"));\r\n\r\n            this.UpdateBinding(\"ErrorHeader\", rowHeader);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/InstallLocalPackageWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class InstallLocalPackageWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.step1If_DidValidate = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity2 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.cleanupCodeActivity_Cleanup = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step3CodeActivity_RefreshTree = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step3WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.showErrorWizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.showErrorCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step2IfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step2CodeActivity_Install = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.step1CodeActivity_ValidateInstallation = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.cleanupStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step3EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showErrorEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.cleanupStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step3StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showErrorStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity4.Condition = codecondition1;\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // step1If_DidValidate\r\n            // \r\n            this.step1If_DidValidate.Activities.Add(this.setStateActivity3);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.step1If_DidValidate.Condition = codecondition2;\r\n            this.step1If_DidValidate.Name = \"step1If_DidValidate\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity2\r\n            // \r\n            this.closeCurrentViewActivity2.Name = \"closeCurrentViewActivity2\";\r\n            // \r\n            // cleanupCodeActivity_Cleanup\r\n            // \r\n            this.cleanupCodeActivity_Cleanup.Name = \"cleanupCodeActivity_Cleanup\";\r\n            this.cleanupCodeActivity_Cleanup.ExecuteCode += new System.EventHandler(this.cleanupCodeActivity_Cleanup_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // step3CodeActivity_RefreshTree\r\n            // \r\n            this.step3CodeActivity_RefreshTree.Name = \"step3CodeActivity_RefreshTree\";\r\n            this.step3CodeActivity_RefreshTree.ExecuteCode += new System.EventHandler(this.step3CodeActivity_RefreshTree_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step3WizardFormActivity\r\n            // \r\n            this.step3WizardFormActivity.ContainerLabel = null;\r\n            this.step3WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallLocalPackageStep3.xml\";\r\n            this.step3WizardFormActivity.Name = \"step3WizardFormActivity\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // showErrorWizardFormActivity\r\n            // \r\n            this.showErrorWizardFormActivity.ContainerLabel = null;\r\n            this.showErrorWizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallLocalPackageShowError.xml\";\r\n            this.showErrorWizardFormActivity.Name = \"showErrorWizardFormActivity\";\r\n            // \r\n            // showErrorCodeActivity_Initialize\r\n            // \r\n            this.showErrorCodeActivity_Initialize.Name = \"showErrorCodeActivity_Initialize\";\r\n            this.showErrorCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.showErrorCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // step2IfElseActivity_DidValidate\r\n            // \r\n            this.step2IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity4);\r\n            this.step2IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity5);\r\n            this.step2IfElseActivity_DidValidate.Name = \"step2IfElseActivity_DidValidate\";\r\n            // \r\n            // step2CodeActivity_Install\r\n            // \r\n            this.step2CodeActivity_Install.Name = \"step2CodeActivity_Install\";\r\n            this.step2CodeActivity_Install.ExecuteCode += new System.EventHandler(this.step2CodeActivity_Install_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallLocalPackageStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.step1If_DidValidate);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // step1CodeActivity_ValidateInstallation\r\n            // \r\n            this.step1CodeActivity_ValidateInstallation.Name = \"step1CodeActivity_ValidateInstallation\";\r\n            this.step1CodeActivity_ValidateInstallation.ExecuteCode += new System.EventHandler(this.step1CodeActivity_ValidateInstallation_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallLocalPackageStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // cleanupStateInitializationActivity\r\n            // \r\n            this.cleanupStateInitializationActivity.Activities.Add(this.cleanupCodeActivity_Cleanup);\r\n            this.cleanupStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity2);\r\n            this.cleanupStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.cleanupStateInitializationActivity.Name = \"cleanupStateInitializationActivity\";\r\n            // \r\n            // step3EventDrivenActivity_Finish\r\n            // \r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.step3CodeActivity_RefreshTree);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.setStateActivity7);\r\n            this.step3EventDrivenActivity_Finish.Name = \"step3EventDrivenActivity_Finish\";\r\n            // \r\n            // step3StateInitializationActivity\r\n            // \r\n            this.step3StateInitializationActivity.Activities.Add(this.step3WizardFormActivity);\r\n            this.step3StateInitializationActivity.Name = \"step3StateInitializationActivity\";\r\n            // \r\n            // showErrorEventDrivenActivity_Finish\r\n            // \r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.setStateActivity8);\r\n            this.showErrorEventDrivenActivity_Finish.Name = \"showErrorEventDrivenActivity_Finish\";\r\n            // \r\n            // showErrorStateInitializationActivity\r\n            // \r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorCodeActivity_Initialize);\r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorWizardFormActivity);\r\n            this.showErrorStateInitializationActivity.Name = \"showErrorStateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity11);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Next\r\n            // \r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2CodeActivity_Install);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2IfElseActivity_DidValidate);\r\n            this.step2EventDrivenActivity_Next.Name = \"step2EventDrivenActivity_Next\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2WizardFormActivity);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity10);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.step1CodeActivity_ValidateInstallation);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // cleanupStateActivity\r\n            // \r\n            this.cleanupStateActivity.Activities.Add(this.cleanupStateInitializationActivity);\r\n            this.cleanupStateActivity.Name = \"cleanupStateActivity\";\r\n            // \r\n            // step3StateActivity\r\n            // \r\n            this.step3StateActivity.Activities.Add(this.step3StateInitializationActivity);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Finish);\r\n            this.step3StateActivity.Name = \"step3StateActivity\";\r\n            // \r\n            // showErrorStateActivity\r\n            // \r\n            this.showErrorStateActivity.Activities.Add(this.showErrorStateInitializationActivity);\r\n            this.showErrorStateActivity.Activities.Add(this.showErrorEventDrivenActivity_Finish);\r\n            this.showErrorStateActivity.Name = \"showErrorStateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Next);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // InstallLocalPackageWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.showErrorStateActivity);\r\n            this.Activities.Add(this.step3StateActivity);\r\n            this.Activities.Add(this.cleanupStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"InstallLocalPackageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private CodeActivity step1CodeActivity_ValidateInstallation;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity step1If_DidValidate;\r\n        private IfElseActivity ifElseActivity1;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n        private StateActivity showErrorStateActivity;\r\n        private StateActivity step2StateActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private CodeActivity step2CodeActivity_Install;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Next;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step3WizardFormActivity;\r\n        private StateInitializationActivity step3StateInitializationActivity;\r\n        private StateActivity step3StateActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private EventDrivenActivity step3EventDrivenActivity_Finish;\r\n        private EventDrivenActivity showErrorEventDrivenActivity_Finish;\r\n        private StateInitializationActivity showErrorStateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity showErrorWizardFormActivity;\r\n        private SetStateActivity setStateActivity8;\r\n        private CodeActivity step3CodeActivity_RefreshTree;\r\n        private SetStateActivity setStateActivity9;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseActivity step2IfElseActivity_DidValidate;\r\n        private CodeActivity showErrorCodeActivity_Initialize;\r\n        private SetStateActivity setStateActivity5;\r\n        private CodeActivity cleanupCodeActivity_Cleanup;\r\n        private StateInitializationActivity cleanupStateInitializationActivity;\r\n        private StateActivity cleanupStateActivity;\r\n        private SetStateActivity setStateActivity11;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity10;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/InstallRemotePackageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    /// <exclude />\r\n    [Obsolete(\"Is used while processing upgrade packages from C1 3.1 and older. To be removed once lower requirement for upgrade package is at least v3.2\")]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class InstallRemotePackageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        bool _packageIsFree = false;\r\n\r\n        /// <exclude />\r\n        public InstallRemotePackageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private PackageDescription GetPackageDescription()\r\n        {\r\n            PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;\r\n\r\n            PackageDescription packageDescription =\r\n                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()\r\n                 where description.Id == castedEntityToken.PackageId\r\n                 select description).SingleOrDefault();\r\n\r\n            if (packageDescription == null)\r\n            {\r\n                this.UpdateBinding(\"ServerError\", true);\r\n            }\r\n\r\n            return packageDescription;\r\n        }\r\n\r\n\r\n\r\n        private void IsPackageFree(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = _packageIsFree;\r\n        }\r\n\r\n\r\n\r\n        private void EulaAccepted(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.GetBinding<bool>(\"EulaAccepted\");\r\n        }\r\n\r\n\r\n\r\n        private void DidValidate(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"Errors\") == false;\r\n        }\r\n\r\n\r\n\r\n        private void initializeStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.UpdateBinding(\"LayoutLabel\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallRemotePackage.ShowError.LayoutLabel\"));\r\n            this.UpdateBinding(\"TableCaption\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallRemotePackage.ShowError.InfoTableCaption\"));\r\n\r\n            try\r\n            {\r\n                _packageIsFree = GetPackageDescription().IsFree;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogVerbose(\"InstallRemotePackageWorkflowRGB(100, 100, 255)\", ex.Message);\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step2StateStepcodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                if (this.BindingExist(\"EulaText\") == false)\r\n                {\r\n                    PackageDescription packageDescription = GetPackageDescription();\r\n                    string eulaText = PackageSystemServices.GetEulaText(packageDescription);\r\n                    this.Bindings.Add(\"EulaText\", eulaText);\r\n                }\r\n\r\n                if (this.BindingExist(\"EulaAccepted\") == false)\r\n                {\r\n                    this.Bindings.Add(\"EulaAccepted\", false);\r\n                }\r\n\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step3CodeActivity_DownloadAndValidate_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                PackageDescription packageDescription = GetPackageDescription();\r\n\r\n                string packageServerSource = PackageSystemServices.GetPackageSourceNameByPackageId(packageDescription.Id, InstallationInformationFacade.InstallationId, UserSettings.CultureInfo);\r\n\r\n                System.IO.Stream installFileStream = PackageServerFacade.GetInstallFileStream(packageDescription.PackageFileDownloadUrl);\r\n\r\n                PackageManagerInstallProcess packageManagerInstallProcess = PackageManager.Install(installFileStream, false, packageServerSource);\r\n                this.Bindings.Add(\"PackageManagerInstallProcess\", packageManagerInstallProcess);\r\n\r\n                this.Bindings.Add(\"FlushOnCompletion\", packageManagerInstallProcess.FlushOnCompletion);\r\n                this.Bindings.Add(\"ReloadConsoleOnCompletion\", packageManagerInstallProcess.ReloadConsoleOnCompletion);\r\n\r\n                if (packageManagerInstallProcess.PreInstallValidationResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(packageManagerInstallProcess.PreInstallValidationResult));\r\n                }\r\n                else\r\n                {\r\n                    List<PackageFragmentValidationResult> validationResult = packageManagerInstallProcess.Validate();\r\n\r\n                    if (validationResult.Count > 0)\r\n                    {\r\n                        this.UpdateBinding(\"LayoutLabel\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallRemotePackage.ShowWarning.LayoutLabel\"));\r\n                        this.UpdateBinding(\"TableCaption\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallRemotePackage.ShowWarning.InfoTableCaption\"));\r\n                        this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(validationResult));\r\n                    }\r\n                    else\r\n                    {\r\n                        this.UpdateBinding(\"Uninstallable\", packageManagerInstallProcess.CanBeUninstalled == false);\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void showErrorCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<string> rowHeader = new List<string>();\r\n            rowHeader.Add(StringResourceSystemFacade.ParseString(\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.ShowError.MessageTitle}\"));\r\n\r\n            this.UpdateBinding(\"ErrorHeader\", rowHeader);\r\n        }\r\n\r\n\r\n\r\n        private void step4CodeActivity_Install_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageDescription packageDescription = GetPackageDescription();\r\n\r\n            PackageManagerInstallProcess packageManagerInstallProcess = this.GetBinding<PackageManagerInstallProcess>(\"PackageManagerInstallProcess\");\r\n\r\n            bool installOk = false;\r\n            string packageServerUrl = null;\r\n            Exception exception = null;\r\n            try\r\n            {\r\n                packageServerUrl = PackageSystemServices.GetPackageSourceNameByPackageId(packageDescription.Id, InstallationInformationFacade.InstallationId, UserSettings.CultureInfo);\r\n\r\n                List<PackageFragmentValidationResult> installResult = packageManagerInstallProcess.Install();\r\n                if (installResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(installResult));\r\n                }\r\n                else\r\n                {\r\n                    installOk = true;\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                exception = ex;\r\n\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n\r\n            try\r\n            {\r\n                if (installOk)\r\n                {\r\n                    PackageServerFacade.RegisterPackageInstallationCompletion(packageServerUrl, InstallationInformationFacade.InstallationId, packageDescription.Id, UserSettings.Username, UserSettings.UserIPAddress.ToString());\r\n                }\r\n                else\r\n                {\r\n                    StringBuilder sb = new StringBuilder();\r\n                    if (exception != null)\r\n                    {\r\n                        sb.Append(exception.ToString());\r\n                    }\r\n                    else\r\n                    {\r\n                        List<List<string>> errors = this.GetBinding<List<List<string>>>(\"Errors\");\r\n                        foreach (List<string> list in errors)\r\n                        {\r\n                            sb.AppendLine(list[0]);\r\n                        }\r\n                    }\r\n\r\n                    PackageServerFacade.RegisterPackageInstallationFailure(packageServerUrl, InstallationInformationFacade.InstallationId, packageDescription.Id, UserSettings.Username, UserSettings.UserIPAddress.ToString(), sb.ToString());\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogWarning(\"InstallRemotePackageWorkflow\", ex);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void cleanupCodeActivity_Cleanup_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageManagerInstallProcess packageManagerInstallProcess;\r\n            if (this.TryGetBinding<PackageManagerInstallProcess>(\"PackageManagerInstallProcess\", out packageManagerInstallProcess))\r\n            {\r\n                packageManagerInstallProcess.CancelInstallation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step5CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (this.GetBinding<bool>(\"ReloadConsoleOnCompletion\"))\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);\r\n            }\r\n\r\n            if (this.GetBinding<bool>(\"FlushOnCompletion\"))\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());\r\n\r\n            if (this.GetBinding<bool>(\"ReloadConsoleOnCompletion\") == false)\r\n            {\r\n\r\n                PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;\r\n\r\n                InstalledPackageInformation installedPackage = PackageManager.GetInstalledPackages().FirstOrDefault(f => f.Id == castedEntityToken.PackageId);\r\n\r\n                var installedPackageEntityToken = new PackageElementProviderInstalledPackageItemEntityToken(\r\n                    installedPackage.Id,\r\n                    installedPackage.GroupName,\r\n                    installedPackage.IsLocalInstalled,\r\n                    installedPackage.CanBeUninstalled);\r\n\r\n                ExecuteWorklow(installedPackageEntityToken, WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewInstalledPackageInfoWorkflow\"));\r\n            }\r\n\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/InstallRemotePackageWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class InstallRemotePackageWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition5 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition6 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showFieldMessageActivity1 = new Composite.C1Console.Workflow.Activities.ShowFieldMessageActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity17 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity18 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeIfElseActivity_IsAddOnFree = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity12 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity11 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity8 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity7 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity10 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity9 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cleanupCodeActivity_Cleanup = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step5CodeActivity_RefreshTree = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step5WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity16 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity5 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step4IfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step4CodeActivity_Install = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step4WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.showErrorWizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.showErrorCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity15 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step3IfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step3CodeActivity_DownloadAndValidate = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step3WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity14 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.step2StateStepcodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity13 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.initializeIfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.initializeStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.cleanupStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step5EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step5StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step4EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step4EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step4StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showErrorEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step3EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.cleanupStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step5StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step4StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showErrorStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step3StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsPackageFree);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"step5StateActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step4StateActivity\";\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // showFieldMessageActivity1\r\n            // \r\n            this.showFieldMessageActivity1.FieldBindingPath = \"EulaAccepted\";\r\n            this.showFieldMessageActivity1.Message = \"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step2.AcceptMissin\" +\r\n                \"g}\";\r\n            this.showFieldMessageActivity1.Name = \"showFieldMessageActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // setStateActivity17\r\n            // \r\n            this.setStateActivity17.Name = \"setStateActivity17\";\r\n            this.setStateActivity17.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // setStateActivity18\r\n            // \r\n            this.setStateActivity18.Name = \"setStateActivity18\";\r\n            this.setStateActivity18.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // initializeIfElseActivity_IsAddOnFree\r\n            // \r\n            this.initializeIfElseActivity_IsAddOnFree.Activities.Add(this.ifElseBranchActivity1);\r\n            this.initializeIfElseActivity_IsAddOnFree.Activities.Add(this.ifElseBranchActivity2);\r\n            this.initializeIfElseActivity_IsAddOnFree.Name = \"initializeIfElseActivity_IsAddOnFree\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity10);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity9);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity5.Condition = codecondition2;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity6);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity3.Condition = codecondition3;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseBranchActivity12\r\n            // \r\n            this.ifElseBranchActivity12.Activities.Add(this.showFieldMessageActivity1);\r\n            this.ifElseBranchActivity12.Activities.Add(this.setStateActivity19);\r\n            this.ifElseBranchActivity12.Name = \"ifElseBranchActivity12\";\r\n            // \r\n            // ifElseBranchActivity11\r\n            // \r\n            this.ifElseBranchActivity11.Activities.Add(this.setStateActivity5);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.EulaAccepted);\r\n            this.ifElseBranchActivity11.Condition = codecondition4;\r\n            this.ifElseBranchActivity11.Name = \"ifElseBranchActivity11\";\r\n            // \r\n            // ifElseBranchActivity8\r\n            // \r\n            this.ifElseBranchActivity8.Activities.Add(this.setStateActivity17);\r\n            this.ifElseBranchActivity8.Name = \"ifElseBranchActivity8\";\r\n            // \r\n            // ifElseBranchActivity7\r\n            // \r\n            this.ifElseBranchActivity7.Activities.Add(this.step2WizardFormActivity);\r\n            codecondition5.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity7.Condition = codecondition5;\r\n            this.ifElseBranchActivity7.Name = \"ifElseBranchActivity7\";\r\n            // \r\n            // ifElseBranchActivity10\r\n            // \r\n            this.ifElseBranchActivity10.Activities.Add(this.setStateActivity18);\r\n            this.ifElseBranchActivity10.Name = \"ifElseBranchActivity10\";\r\n            // \r\n            // ifElseBranchActivity9\r\n            // \r\n            this.ifElseBranchActivity9.Activities.Add(this.initializeIfElseActivity_IsAddOnFree);\r\n            codecondition6.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity9.Condition = codecondition6;\r\n            this.ifElseBranchActivity9.Name = \"ifElseBranchActivity9\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cleanupCodeActivity_Cleanup\r\n            // \r\n            this.cleanupCodeActivity_Cleanup.Name = \"cleanupCodeActivity_Cleanup\";\r\n            this.cleanupCodeActivity_Cleanup.ExecuteCode += new System.EventHandler(this.cleanupCodeActivity_Cleanup_ExecuteCode);\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // step5CodeActivity_RefreshTree\r\n            // \r\n            this.step5CodeActivity_RefreshTree.Name = \"step5CodeActivity_RefreshTree\";\r\n            this.step5CodeActivity_RefreshTree.ExecuteCode += new System.EventHandler(this.step5CodeActivity_RefreshTree_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // step5WizardFormActivity\r\n            // \r\n            this.step5WizardFormActivity.ContainerLabel = null;\r\n            this.step5WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep5.xml\";\r\n            this.step5WizardFormActivity.Name = \"step5WizardFormActivity\";\r\n            // \r\n            // setStateActivity16\r\n            // \r\n            this.setStateActivity16.Name = \"setStateActivity16\";\r\n            this.setStateActivity16.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity5\r\n            // \r\n            this.cancelHandleExternalEventActivity5.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity5.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity5.Name = \"cancelHandleExternalEventActivity5\";\r\n            // \r\n            // step4IfElseActivity_DidValidate\r\n            // \r\n            this.step4IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity5);\r\n            this.step4IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity6);\r\n            this.step4IfElseActivity_DidValidate.Name = \"step4IfElseActivity_DidValidate\";\r\n            // \r\n            // step4CodeActivity_Install\r\n            // \r\n            this.step4CodeActivity_Install.Name = \"step4CodeActivity_Install\";\r\n            this.step4CodeActivity_Install.ExecuteCode += new System.EventHandler(this.step4CodeActivity_Install_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity4\r\n            // \r\n            this.nextHandleExternalEventActivity4.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity4.Name = \"nextHandleExternalEventActivity4\";\r\n            // \r\n            // step4WizardFormActivity\r\n            // \r\n            this.step4WizardFormActivity.ContainerLabel = null;\r\n            this.step4WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep4.xml\";\r\n            this.step4WizardFormActivity.Name = \"step4WizardFormActivity\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // showErrorWizardFormActivity\r\n            // \r\n            this.showErrorWizardFormActivity.ContainerLabel = null;\r\n            this.showErrorWizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageShowError.xml\";\r\n            this.showErrorWizardFormActivity.Name = \"showErrorWizardFormActivity\";\r\n            // \r\n            // showErrorCodeActivity_Initialize\r\n            // \r\n            this.showErrorCodeActivity_Initialize.Name = \"showErrorCodeActivity_Initialize\";\r\n            this.showErrorCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.showErrorCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity15\r\n            // \r\n            this.setStateActivity15.Name = \"setStateActivity15\";\r\n            this.setStateActivity15.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity4\r\n            // \r\n            this.cancelHandleExternalEventActivity4.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity4.Name = \"cancelHandleExternalEventActivity4\";\r\n            // \r\n            // step3IfElseActivity_DidValidate\r\n            // \r\n            this.step3IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity3);\r\n            this.step3IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity4);\r\n            this.step3IfElseActivity_DidValidate.Name = \"step3IfElseActivity_DidValidate\";\r\n            // \r\n            // step3CodeActivity_DownloadAndValidate\r\n            // \r\n            this.step3CodeActivity_DownloadAndValidate.Name = \"step3CodeActivity_DownloadAndValidate\";\r\n            this.step3CodeActivity_DownloadAndValidate.ExecuteCode += new System.EventHandler(this.step3CodeActivity_DownloadAndValidate_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity3\r\n            // \r\n            this.nextHandleExternalEventActivity3.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity3.Name = \"nextHandleExternalEventActivity3\";\r\n            // \r\n            // step3WizardFormActivity\r\n            // \r\n            this.step3WizardFormActivity.ContainerLabel = null;\r\n            this.step3WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep3.xml\";\r\n            this.step3WizardFormActivity.Name = \"step3WizardFormActivity\";\r\n            // \r\n            // setStateActivity14\r\n            // \r\n            this.setStateActivity14.Name = \"setStateActivity14\";\r\n            this.setStateActivity14.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity11);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity12);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity7);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity8);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // step2StateStepcodeActivity_Initialize\r\n            // \r\n            this.step2StateStepcodeActivity_Initialize.Name = \"step2StateStepcodeActivity_Initialize\";\r\n            this.step2StateStepcodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.step2StateStepcodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity13\r\n            // \r\n            this.setStateActivity13.Name = \"setStateActivity13\";\r\n            this.setStateActivity13.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // initializeIfElseActivity_DidValidate\r\n            // \r\n            this.initializeIfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity9);\r\n            this.initializeIfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity10);\r\n            this.initializeIfElseActivity_DidValidate.Name = \"initializeIfElseActivity_DidValidate\";\r\n            // \r\n            // initializeStateCodeActivity_Initialize\r\n            // \r\n            this.initializeStateCodeActivity_Initialize.Name = \"initializeStateCodeActivity_Initialize\";\r\n            this.initializeStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // cleanupStateInitializationActivity\r\n            // \r\n            this.cleanupStateInitializationActivity.Activities.Add(this.cleanupCodeActivity_Cleanup);\r\n            this.cleanupStateInitializationActivity.Activities.Add(this.setStateActivity12);\r\n            this.cleanupStateInitializationActivity.Name = \"cleanupStateInitializationActivity\";\r\n            // \r\n            // step5EventDrivenActivity_Finish\r\n            // \r\n            this.step5EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.step5EventDrivenActivity_Finish.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.step5EventDrivenActivity_Finish.Activities.Add(this.step5CodeActivity_RefreshTree);\r\n            this.step5EventDrivenActivity_Finish.Activities.Add(this.setStateActivity11);\r\n            this.step5EventDrivenActivity_Finish.Name = \"step5EventDrivenActivity_Finish\";\r\n            // \r\n            // step5StateInitializationActivity\r\n            // \r\n            this.step5StateInitializationActivity.Activities.Add(this.step5WizardFormActivity);\r\n            this.step5StateInitializationActivity.Name = \"step5StateInitializationActivity\";\r\n            // \r\n            // step4EventDrivenActivity_Cancel\r\n            // \r\n            this.step4EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity5);\r\n            this.step4EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity16);\r\n            this.step4EventDrivenActivity_Cancel.Name = \"step4EventDrivenActivity_Cancel\";\r\n            // \r\n            // step4EventDrivenActivity_Next\r\n            // \r\n            this.step4EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity4);\r\n            this.step4EventDrivenActivity_Next.Activities.Add(this.step4CodeActivity_Install);\r\n            this.step4EventDrivenActivity_Next.Activities.Add(this.step4IfElseActivity_DidValidate);\r\n            this.step4EventDrivenActivity_Next.Name = \"step4EventDrivenActivity_Next\";\r\n            // \r\n            // step4StateInitializationActivity\r\n            // \r\n            this.step4StateInitializationActivity.Activities.Add(this.step4WizardFormActivity);\r\n            this.step4StateInitializationActivity.Name = \"step4StateInitializationActivity\";\r\n            // \r\n            // showErrorEventDrivenActivity_Finish\r\n            // \r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.setStateActivity8);\r\n            this.showErrorEventDrivenActivity_Finish.Name = \"showErrorEventDrivenActivity_Finish\";\r\n            // \r\n            // showErrorStateInitializationActivity\r\n            // \r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorCodeActivity_Initialize);\r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorWizardFormActivity);\r\n            this.showErrorStateInitializationActivity.Name = \"showErrorStateInitializationActivity\";\r\n            // \r\n            // step3EventDrivenActivity_Cancel\r\n            // \r\n            this.step3EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity4);\r\n            this.step3EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity15);\r\n            this.step3EventDrivenActivity_Cancel.Name = \"step3EventDrivenActivity_Cancel\";\r\n            // \r\n            // step3EventDrivenActivity_Next\r\n            // \r\n            this.step3EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity3);\r\n            this.step3EventDrivenActivity_Next.Activities.Add(this.step3CodeActivity_DownloadAndValidate);\r\n            this.step3EventDrivenActivity_Next.Activities.Add(this.step3IfElseActivity_DidValidate);\r\n            this.step3EventDrivenActivity_Next.Name = \"step3EventDrivenActivity_Next\";\r\n            // \r\n            // step3StateInitializationActivity\r\n            // \r\n            this.step3StateInitializationActivity.Activities.Add(this.step3WizardFormActivity);\r\n            this.step3StateInitializationActivity.Name = \"step3StateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity14);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Next\r\n            // \r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.ifElseActivity2);\r\n            this.step2EventDrivenActivity_Next.Name = \"step2EventDrivenActivity_Next\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2StateStepcodeActivity_Initialize);\r\n            this.step2StateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity13);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeStateCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_DidValidate);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // cleanupStateActivity\r\n            // \r\n            this.cleanupStateActivity.Activities.Add(this.cleanupStateInitializationActivity);\r\n            this.cleanupStateActivity.Name = \"cleanupStateActivity\";\r\n            // \r\n            // step5StateActivity\r\n            // \r\n            this.step5StateActivity.Activities.Add(this.step5StateInitializationActivity);\r\n            this.step5StateActivity.Activities.Add(this.step5EventDrivenActivity_Finish);\r\n            this.step5StateActivity.Name = \"step5StateActivity\";\r\n            // \r\n            // step4StateActivity\r\n            // \r\n            this.step4StateActivity.Activities.Add(this.step4StateInitializationActivity);\r\n            this.step4StateActivity.Activities.Add(this.step4EventDrivenActivity_Next);\r\n            this.step4StateActivity.Activities.Add(this.step4EventDrivenActivity_Cancel);\r\n            this.step4StateActivity.Name = \"step4StateActivity\";\r\n            // \r\n            // showErrorStateActivity\r\n            // \r\n            this.showErrorStateActivity.Activities.Add(this.showErrorStateInitializationActivity);\r\n            this.showErrorStateActivity.Activities.Add(this.showErrorEventDrivenActivity_Finish);\r\n            this.showErrorStateActivity.Name = \"showErrorStateActivity\";\r\n            // \r\n            // step3StateActivity\r\n            // \r\n            this.step3StateActivity.Activities.Add(this.step3StateInitializationActivity);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Next);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Cancel);\r\n            this.step3StateActivity.Name = \"step3StateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Next);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // InstallRemotePackageWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.step3StateActivity);\r\n            this.Activities.Add(this.showErrorStateActivity);\r\n            this.Activities.Add(this.step4StateActivity);\r\n            this.Activities.Add(this.step5StateActivity);\r\n            this.Activities.Add(this.cleanupStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"InstallRemotePackageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private CodeActivity initializeStateCodeActivity_Initialize;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity initializeIfElseActivity_IsAddOnFree;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateActivity step2StateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Next;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n\r\n        private CodeActivity step2StateStepcodeActivity_Initialize;\r\n\r\n        private StateActivity showErrorStateActivity;\r\n\r\n        private StateActivity step3StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity3;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step3WizardFormActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private EventDrivenActivity step3EventDrivenActivity_Next;\r\n\r\n        private StateInitializationActivity step3StateInitializationActivity;\r\n\r\n        private CodeActivity step3CodeActivity_DownloadAndValidate;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity step3IfElseActivity_DidValidate;\r\n\r\n        private StateActivity step4StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step4WizardFormActivity;\r\n\r\n        private StateInitializationActivity step4StateInitializationActivity;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity4;\r\n\r\n        private EventDrivenActivity step4EventDrivenActivity_Next;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity showErrorWizardFormActivity;\r\n\r\n        private StateInitializationActivity showErrorStateInitializationActivity;\r\n\r\n        private CodeActivity showErrorCodeActivity_Initialize;\r\n\r\n        private CodeActivity step4CodeActivity_Install;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n\r\n        private SetStateActivity setStateActivity11;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private IfElseActivity step4IfElseActivity_DidValidate;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity step5EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step5StateInitializationActivity;\r\n\r\n        private EventDrivenActivity showErrorEventDrivenActivity_Finish;\r\n\r\n        private StateActivity step5StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step5WizardFormActivity;\r\n\r\n        private CodeActivity step5CodeActivity_RefreshTree;\r\n\r\n        private SetStateActivity setStateActivity12;\r\n\r\n        private CodeActivity cleanupCodeActivity_Cleanup;\r\n\r\n        private StateInitializationActivity cleanupStateInitializationActivity;\r\n\r\n        private StateActivity cleanupStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private SetStateActivity setStateActivity14;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private SetStateActivity setStateActivity13;\r\n\r\n        private EventDrivenActivity step3EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n\r\n        private SetStateActivity setStateActivity16;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity5;\r\n\r\n        private SetStateActivity setStateActivity15;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity4;\r\n\r\n        private EventDrivenActivity step4EventDrivenActivity_Cancel;\r\n\r\n        private SetStateActivity setStateActivity17;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity8;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity7;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private SetStateActivity setStateActivity18;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity10;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity9;\r\n\r\n        private IfElseActivity initializeIfElseActivity_DidValidate;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity12;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity11;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private SetStateActivity setStateActivity19;\r\n\r\n        private C1Console.Workflow.Activities.ShowFieldMessageActivity showFieldMessageActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(PackageElementProviderData))]\r\n    internal sealed class PackageElementProvider : IHooklessElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n\r\n        private static ResourceHandle RootClosedIcon = GetIconHandle(\"package-element-closed-root\");\r\n        private static ResourceHandle RootOpenedIcon = GetIconHandle(\"package-element-opened-root\");\r\n        private static ResourceHandle AvailablePackagesClosedIcon = GetIconHandle(\"package-element-closed-available\");\r\n        private static ResourceHandle AvailablePackagesOpenedIcon = GetIconHandle(\"package-element-opened-available\");\r\n        private static ResourceHandle InstalledPackagesClosedIcon = GetIconHandle(\"package-element-closed-installed\");\r\n        private static ResourceHandle InstalledPackagesOpenedIcon = GetIconHandle(\"package-element-opened-installed\");\r\n        private static ResourceHandle PackageSourcesClosedIcon = GetIconHandle(\"package-element-closed-sources\");\r\n        private static ResourceHandle PackageSourcesOpenedIcon = GetIconHandle(\"package-element-opened-sources\");\r\n        private static ResourceHandle PackageSourceItemClosedIcon = GetIconHandle(\"package-element-closed-sourceitem\");\r\n        private static ResourceHandle AvailablePackagesGroupClosedIcon = GetIconHandle(\"package-element-closed-availablegroup\");\r\n        private static ResourceHandle AvailablePackagesGroupOpenedIcon = GetIconHandle(\"package-element-opened-availablegroup\");\r\n        private static ResourceHandle LocalPackagesClosedIcon = GetIconHandle(\"package-element-closed-local\");\r\n        private static ResourceHandle LocalPackagesOpenedIcon = GetIconHandle(\"package-element-opened-local\");\r\n        private static ResourceHandle InstalledPackagesGroupClosedIcon = GetIconHandle(\"package-element-closed-installedgroup\");\r\n        private static ResourceHandle InstalledPackagesGroupOpenedIcon = GetIconHandle(\"package-element-opened-installedgroup\");\r\n        private static ResourceHandle AvailablePackageItemIcon = GetIconHandle(\"package-element-closed-availableitem\");\r\n        private static ResourceHandle AvailableCommercialPackageItemIcon = GetIconHandle(\"package-element-item-commercial\");\r\n        private static ResourceHandle InstalledPackageItemIcon = GetIconHandle(\"package-element-closed-installeditem\");\r\n        private static ResourceHandle InstalledCommercialPackageItemIcon = GetIconHandle(\"package-element-item-commercial\");\r\n\r\n        private static ResourceHandle ClearServerCacheIcon = GetIconHandle(\"package-clear-servercache\");\r\n        private static ResourceHandle ViewAvailableInformationIcon = GetIconHandle(\"package-view-availableinfo\");\r\n        private static ResourceHandle ViewInstalledInformationIcon = GetIconHandle(\"package-view-installedinfo\");\r\n        private static ResourceHandle InstallIcon = GetIconHandle(\"package-install-package\");\r\n        \r\n        private static ResourceHandle InstallLocalPackageIcon = GetIconHandle(\"package-install-local-package\");\r\n        private static ResourceHandle AddPackageSourceIcon = GetIconHandle(\"package-add-source\");\r\n        private static ResourceHandle DeletePackageSourceIcon = GetIconHandle(\"package-delete-source\");\r\n\r\n        private static PermissionType[] ActionPermissions = { PermissionType.Administrate, PermissionType.Configure };\r\n        \r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n\r\n        public PackageElementProvider()\r\n        {\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n        }\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            Element element = new Element(_context.CreateElementHandle(new PackageElementProviderRootEntityToken()));\r\n            element.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"RootFolderLabel\"),\r\n                ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"RootFolderToolTip\"),\r\n                HasChildren = true,\r\n                Icon = RootClosedIcon,\r\n                OpenedIcon = RootOpenedIcon\r\n            };\r\n\r\n            AddInstallLocalPackageAction(element);\r\n\r\n            yield return element;\r\n        }\r\n\r\n\r\n\r\n        private static void AddInstallLocalPackageAction(Element element)\r\n        {\r\n            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PackageElementProvider.InstallLocalPackageWorkflow\"), ActionPermissions)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackageLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackageToolTip\"),\r\n                    Disabled = false,\r\n                    Icon = InstallLocalPackageIcon,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            if (entityToken is PackageElementProviderRootEntityToken)\r\n            {\r\n                return GetRootChildren(seachToken);\r\n            }\r\n            if (entityToken is PackageElementProviderAvailablePackagesFolderEntityToken)\r\n            {\r\n                return GetAvailablePackagesFolderChildren(seachToken);\r\n            }\r\n            if (entityToken is PackageElementProviderAvailablePackagesGroupFolderEntityToken availableGroupEntityToken)\r\n            {\r\n                return GetAvailablePackageGroupFolderChildren(availableGroupEntityToken.GroupName, seachToken);\r\n            }\r\n            if (entityToken is PackageElementProviderInstalledPackageFolderEntityToken)\r\n            {\r\n                return GetInstalledPackageFolderChildren(seachToken);\r\n            }\r\n            if (entityToken is PackageElementProviderPackageSourcesFolderEntityToken)\r\n            {\r\n                return GetPackageSourcesFolderChildren(seachToken);\r\n            }\r\n            if (entityToken is PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken)\r\n            {\r\n                return GetInstalledLocalPackagesFolderChildren(seachToken);\r\n            }\r\n            if (entityToken is PackageElementProviderInstalledPackageGroupFolderEntityToken installedGroupEntityToken)\r\n            {\r\n                return GetInstalledPackageGroupFolderChildren(installedGroupEntityToken.GroupName, seachToken);\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Unexpected entity token type: \" + entityToken.GetType());\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            var result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                var dataEntityToken = (DataEntityToken) entityToken ;\r\n\r\n                Type type = dataEntityToken.InterfaceType;\r\n                if (type != typeof(IPackageServerSource)) continue;\r\n\r\n                var newEntityToken = new PackageElementProviderPackageSourcesFolderEntityToken();\r\n\r\n                result.Add(entityToken, new EntityToken[] { newEntityToken });\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetRootChildren(SearchToken seachToken)\r\n        {\r\n            Element availablePackagesElement = new Element(_context.CreateElementHandle(new PackageElementProviderAvailablePackagesFolderEntityToken()));\r\n            availablePackagesElement.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"AvailablePackagesFolderLabel\"),\r\n                ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"AvailablePackagesFolderToolTip\"),\r\n                HasChildren = true,\r\n                Icon = AvailablePackagesClosedIcon,\r\n                OpenedIcon = AvailablePackagesOpenedIcon\r\n            };\r\n            availablePackagesElement.AddAction(new ElementAction(new ActionHandle(new ClearServerCacheActionToken()))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"ClearServerCacheLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"ClearServerCacheToolTip\"),\r\n                    Disabled = false,\r\n                    Icon = ClearServerCacheIcon,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });            \r\n            yield return availablePackagesElement;\r\n\r\n\r\n\r\n            Element installedPackagesElement = new Element(_context.CreateElementHandle(new PackageElementProviderInstalledPackageFolderEntityToken()));\r\n            installedPackagesElement.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstalledPackageFolderLabel\"),\r\n                ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstalledPackageFolderToolTip\"),\r\n                HasChildren = true,\r\n                Icon = InstalledPackagesClosedIcon,\r\n                OpenedIcon = InstalledPackagesOpenedIcon\r\n            };\r\n            yield return installedPackagesElement;\r\n\r\n\r\n\r\n            Element packageSourcesElement = new Element(_context.CreateElementHandle(new PackageElementProviderPackageSourcesFolderEntityToken()));\r\n            packageSourcesElement.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"PackageSourcesFolderLabel\"),\r\n                ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"PackageSourcesFolderToolTip\"),\r\n                HasChildren = DataFacade.GetData<IPackageServerSource>().Any(),\r\n                Icon = PackageSourcesClosedIcon,\r\n                OpenedIcon = PackageSourcesOpenedIcon\r\n            };\r\n            packageSourcesElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PackageElementProvider.AddPackageSourceWorkflow\"), new PermissionType[] { PermissionType.Administrate })))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"AddPackageSourceLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"AddPackageSourceToolTip\"),\r\n                    Disabled = false,\r\n                    Icon = AddPackageSourceIcon,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n            yield return packageSourcesElement;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetAvailablePackagesFolderChildren(SearchToken seachToken)\r\n        {\r\n            IEnumerable<string> groupNames =\r\n                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()\r\n                 select description.GroupName).Distinct();\r\n\r\n            foreach (string groupName in groupNames.OrderBy(f=>f))\r\n            {\r\n                Element element = new Element(_context.CreateElementHandle(new PackageElementProviderAvailablePackagesGroupFolderEntityToken(groupName)));\r\n                element.VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = groupName,\r\n                    ToolTip = groupName,\r\n                    HasChildren = true,\r\n                    Icon = AvailablePackagesGroupClosedIcon,\r\n                    OpenedIcon = AvailablePackagesGroupOpenedIcon\r\n                };                \r\n\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetAvailablePackageGroupFolderChildren(string groupName, SearchToken seachToken)\r\n        {\r\n            IEnumerable<PackageDescription> packageDescriptions =\r\n                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()\r\n                 where description.GroupName == groupName\r\n                 orderby description.Name\r\n                 select description);\r\n\r\n            foreach (PackageDescription packageDescription in packageDescriptions)\r\n            {\r\n                ResourceHandle packageIcon = (packageDescription.PriceAmmount > 0 || packageDescription.AvailableInSubscriptions.Any( f=>f.Purchasable )\r\n                    ? AvailableCommercialPackageItemIcon : AvailablePackageItemIcon);\r\n\r\n                Element element = new Element(_context.CreateElementHandle(new PackageElementProviderAvailablePackagesItemEntityToken(\r\n                    packageDescription.Id.ToString(),\r\n                    packageDescription.GroupName)));\r\n                element.VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = packageDescription.Name,\r\n                    ToolTip = packageDescription.Name,\r\n                    HasChildren = false,\r\n                    Icon = packageIcon,\r\n                };\r\n\r\n                if (!string.IsNullOrEmpty(packageDescription.ConsoleBrowserUrl))\r\n                {\r\n                    element.PropertyBag.Add(\"BrowserUrl\", packageDescription.ConsoleBrowserUrl);\r\n                    element.PropertyBag.Add(\"BrowserToolingOn\", \"false\");\r\n                }\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewAvailablePackageInfoWorkflowWorkflow\"), ActionPermissions)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"ViewAvailableInformationLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"ViewAvailableInformationToolTip\"),\r\n                        Icon = ViewAvailableInformationIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n\r\n                    }\r\n                });\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PackageElementProvider.InstallRemotePackageWorkflow\"), ActionPermissions)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallToolTip\"),\r\n                        Icon = InstallIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Add,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n\r\n                    }\r\n                });\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetInstalledPackageFolderChildren(SearchToken seachToken)\r\n        {\r\n            bool hasLocalPackageChildren =\r\n                (from info in PackageManager.GetInstalledPackages()\r\n                 where info.IsLocalInstalled \r\n                 select info.Name).FirstOrDefault() != null;\r\n\r\n            Element localPackagesElement = new Element(_context.CreateElementHandle(new PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken()));\r\n            localPackagesElement.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"LocalPackagesFolderLabel\"),\r\n                ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"LocalPackagesFolderToolTip\"),\r\n                HasChildren = hasLocalPackageChildren,\r\n                Icon = LocalPackagesClosedIcon,\r\n                OpenedIcon = LocalPackagesOpenedIcon\r\n            };\r\n\r\n            AddInstallLocalPackageAction(localPackagesElement);\r\n\r\n            yield return localPackagesElement;\r\n\r\n\r\n            IEnumerable<string> groupNames =\r\n                (from info in PackageManager.GetInstalledPackages()\r\n                 where info.IsLocalInstalled == false\r\n                 orderby info.GroupName\r\n                 select info.GroupName).Distinct();\r\n\r\n            foreach (string groupName in groupNames)\r\n            {\r\n                Element element = new Element(_context.CreateElementHandle(new PackageElementProviderInstalledPackageGroupFolderEntityToken(groupName)));\r\n                element.VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = groupName,\r\n                    ToolTip = groupName,\r\n                    HasChildren = true,\r\n                    Icon = InstalledPackagesGroupClosedIcon,\r\n                    OpenedIcon = InstalledPackagesGroupOpenedIcon\r\n                };\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetPackageSourcesFolderChildren(SearchToken seachToken)\r\n        {\r\n            List<IPackageServerSource> packageServerSources = \r\n                (from a in DataFacade.GetData<IPackageServerSource>()\r\n                 orderby a.Url\r\n                 select a).ToList();\r\n\r\n            foreach (IPackageServerSource packageServerSource in packageServerSources)\r\n            {\r\n                var element = new Element(_context.CreateElementHandle(packageServerSource.GetDataEntityToken()))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = packageServerSource.Url,\r\n                        ToolTip = packageServerSource.Url,\r\n                        HasChildren = false,\r\n                        Icon = PackageSourceItemClosedIcon\r\n                    }\r\n                };\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PackageElementProvider.DeletePackageSourceWorkflow\"), new PermissionType[] { PermissionType.Administrate })))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"DeletePackageSourceLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"DeletePackageSourceToolTip\"),\r\n                        Icon = DeletePackageSourceIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Delete,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n\r\n                    }\r\n                });\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n        private IEnumerable<Element> GetInstalledLocalPackagesFolderChildren(SearchToken seachToken)\r\n        {\r\n            return GetInstalledPackagesElements(package => package.IsLocalInstalled);\r\n        }\r\n\r\n        private IEnumerable<Element> GetInstalledPackageGroupFolderChildren(string groupName, SearchToken seachToken)\r\n        {\r\n            return GetInstalledPackagesElements(package => package.GroupName == groupName && !package.IsLocalInstalled);\r\n        }\r\n\r\n\r\n        private IEnumerable<Element> GetInstalledPackagesElements(Predicate<InstalledPackageInformation> filter)\r\n        {\r\n            IEnumerable<InstalledPackageInformation> installedPackageInformations =\r\n                from info in PackageManager.GetInstalledPackages()\r\n                where filter(info)\r\n                orderby info.Name\r\n                select info;\r\n\r\n            var serverPackagesPreviewUrls = PackageSystemServices.GetAllAvailablePackages()\r\n                .Where(p => !string.IsNullOrEmpty(p.ConsoleBrowserUrl))\r\n                .GroupBy(p => p.Id)\r\n                .ToDictionary(group => group.Key, group => group.First().ConsoleBrowserUrl);\r\n\r\n            foreach (var installedPackageInformation in installedPackageInformations)\r\n            {\r\n                var element = new Element(_context.CreateElementHandle(new PackageElementProviderInstalledPackageItemEntityToken(\r\n                    installedPackageInformation.Id,\r\n                    installedPackageInformation.GroupName,\r\n                    installedPackageInformation.IsLocalInstalled,\r\n                    installedPackageInformation.CanBeUninstalled)));\r\n\r\n                if (serverPackagesPreviewUrls.TryGetValue(installedPackageInformation.Id, out var previewUrl))\r\n                {\r\n                    element.PropertyBag.Add(\"BrowserUrl\", previewUrl);\r\n                    element.PropertyBag.Add(\"BrowserToolingOn\", \"false\");\r\n                }\r\n\r\n                element.VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = installedPackageInformation.Name,\r\n                    ToolTip = installedPackageInformation.Name,\r\n                    HasChildren = false,\r\n                    Icon = GetIconForPackageItem(installedPackageInformation.Id),\r\n                };\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewInstalledPackageInfoWorkflow\"), ActionPermissions)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"ViewInstalledInformationLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"ViewInstalledInformationToolTip\"),\r\n                        Icon = ViewInstalledInformationIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n\r\n                    }\r\n                });\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n        private ResourceHandle GetIconForPackageItem(Guid packageId)\r\n        {\r\n\r\n            ResourceHandle icon = InstalledPackageItemIcon;\r\n            PackageLicenseDefinition licenseDef = PackageLicenseHelper.GetLicenseDefinition(packageId);\r\n            if (licenseDef != null && !licenseDef.Permanent)\r\n            {\r\n                icon = InstalledCommercialPackageItemIcon;\r\n            }\r\n            return icon;\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }        \r\n    }\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableHooklessElementProviderAssembler))]\r\n    internal sealed class PackageElementProviderData : HooklessElementProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderAvailablePackagesFolderEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderAvailablePackagesFolderEntityTokenAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            yield return new PackageElementProviderRootEntityToken();\r\n        }\r\n    }\r\n\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(PackageElementProviderAvailablePackagesFolderEntityTokenAncestorProvider))]\r\n    public sealed class PackageElementProviderAvailablePackagesFolderEntityToken : EntityToken\r\n\t{\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return \"PackageElementProviderAvailablePackagesFolderEntityToken\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new PackageElementProviderAvailablePackagesFolderEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderAvailablePackagesGroupFolderEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderAvailablePackagesGroupFolderEntityTokenAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            yield return new PackageElementProviderAvailablePackagesFolderEntityToken();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [SecurityAncestorProvider(typeof(PackageElementProviderAvailablePackagesGroupFolderEntityTokenAncestorProvider))]\r\n    internal sealed class PackageElementProviderAvailablePackagesGroupFolderEntityToken : EntityToken\r\n\t{        \r\n        public PackageElementProviderAvailablePackagesGroupFolderEntityToken(string groupName)\r\n        {\r\n            this.GroupName = groupName;\r\n        }\r\n\r\n\t    [JsonIgnore]\r\n        public string GroupName { get; private set; }\r\n        \r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return this.GroupName; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new PackageElementProviderAvailablePackagesGroupFolderEntityToken(id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderAvailablePackagesItemEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Serialization;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderAvailablePackagesItemEntityTokenAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            var castedToken = (PackageElementProviderAvailablePackagesItemEntityToken) entityToken;\r\n\r\n            yield return new PackageElementProviderAvailablePackagesGroupFolderEntityToken(castedToken.GroupName);\r\n        }\r\n    }\r\n\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(PackageElementProviderAvailablePackagesItemEntityTokenAncestorProvider))]\r\n    public sealed class PackageElementProviderAvailablePackagesItemEntityToken : EntityToken\r\n    {\r\n        /// <exclude />\r\n        [JsonConstructor]\r\n        public PackageElementProviderAvailablePackagesItemEntityToken(string id, string groupName)\r\n        {\r\n            Id = id;\r\n            this.GroupName = groupName;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string GroupName { get; private set; }\r\n\r\n        /// <exclude />\r\n        public Guid PackageId => new Guid(this.Id);\r\n\r\n        /// <exclude />\r\n        public override string Type => \"\";\r\n\r\n        /// <exclude />\r\n        public override string Source => \"\";\r\n\r\n        /// <exclude />\r\n        public override string Id { get; }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(this);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                entityToken = CompositeJsonSerializer.Deserialize<PackageElementProviderAvailablePackagesItemEntityToken>(serializedEntityToken);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedEntityToken);\r\n                Log.LogVerbose(nameof(PackageElementProviderAvailablePackagesItemEntityToken), entityToken.GetType().FullName);\r\n            }\r\n            return entityToken;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken DeserializeLegacy(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            Dictionary<string, string> dic;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id, out dic);\r\n\r\n            if (!dic.ContainsKey(\"_GroupName_\")) throw new ArgumentException(\"serializedEntityToken is of wrong format\");\r\n\r\n            string groupName = StringConversionServices.DeserializeValueString(dic[\"_GroupName_\"]);\r\n\r\n            return new PackageElementProviderAvailablePackagesItemEntityToken(id, groupName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderInstalledPackageFolderEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderInstalledPackageFolderAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            yield return new PackageElementProviderRootEntityToken();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [SecurityAncestorProvider(typeof(PackageElementProviderInstalledPackageFolderAncestorProvider))]\r\n    internal sealed class PackageElementProviderInstalledPackageFolderEntityToken : EntityToken\r\n\t{        \r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return \"PackageElementProviderInstalledPackageFolderEntityToken\"; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new PackageElementProviderInstalledPackageFolderEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderInstalledPackageGroupFolderEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderInstalledPackageGroupFolderEntityTokenAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            yield return new PackageElementProviderInstalledPackageFolderEntityToken();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [SecurityAncestorProvider(typeof(PackageElementProviderInstalledPackageGroupFolderEntityTokenAncestorProvider))]\r\n    internal sealed class PackageElementProviderInstalledPackageGroupFolderEntityToken : EntityToken\r\n\t{        \r\n        public PackageElementProviderInstalledPackageGroupFolderEntityToken(string groupName)\r\n        {\r\n            this.GroupName = groupName;\r\n        }\r\n\r\n\t    [JsonIgnore]\r\n        public string GroupName { get; private set; }\r\n        \r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return this.GroupName; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new PackageElementProviderInstalledPackageGroupFolderEntityToken(id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderInstalledPackageItemEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderInstalledPackageItemEntityTokenAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(nameof(entityToken));\r\n\r\n            var castedEntityToken = (PackageElementProviderInstalledPackageItemEntityToken)entityToken;\r\n\r\n            if (castedEntityToken.IsLocalInstalled)\r\n            {\r\n                yield return new PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken();\r\n            }\r\n            else\r\n            {\r\n                yield return new PackageElementProviderInstalledPackageGroupFolderEntityToken(castedEntityToken.GroupName);\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(PackageElementProviderInstalledPackageItemEntityTokenAncestorProvider))]\r\n    public sealed class PackageElementProviderInstalledPackageItemEntityToken : EntityToken\r\n    {\r\n        /// <exclude />\r\n        public PackageElementProviderInstalledPackageItemEntityToken(Guid packageId, string groupName, bool isLocalInstalled, bool canBeUninstalled)\r\n        {\r\n            this.PackageId = packageId;\r\n            this.GroupName = groupName;\r\n            this.IsLocalInstalled = isLocalInstalled;\r\n            this.CanBeUninstalled = canBeUninstalled;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Guid PackageId { get; private set; }\r\n\r\n        /// <exclude />\r\n        public string GroupName { get; private set; }\r\n\r\n        /// <exclude />\r\n        public bool IsLocalInstalled { get; private set; }\r\n\r\n        /// <exclude />\r\n        public bool CanBeUninstalled { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Type => \"\";\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source => \"\";\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id => this.PackageId.ToString();\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(this);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return CompositeJsonSerializer\r\n                .Deserialize<PackageElementProviderInstalledPackageItemEntityToken>(serializedEntityToken);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return base.GetHashCode() ^ this.GroupName.GetHashCode() ^ this.CanBeUninstalled.GetHashCode();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderInstalledPackageLocalPackagesFolderEntityTokenAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            yield return new PackageElementProviderInstalledPackageFolderEntityToken();\r\n        }\r\n    }\r\n\r\n\r\n    \r\n    [SecurityAncestorProvider(typeof(PackageElementProviderInstalledPackageLocalPackagesFolderEntityTokenAncestorProvider))]\r\n    internal sealed class PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken : EntityToken\r\n\t{\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return \"PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken\"; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new PackageElementProviderInstalledPackageLocalPackagesFolderEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderPackageSourcesFolderEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderPackageSourcesFolderEntityTokenAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            yield return new PackageElementProviderRootEntityToken();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [SecurityAncestorProvider(typeof(PackageElementProviderPackageSourcesFolderEntityTokenAncestorProvider))]\r\n    internal sealed class PackageElementProviderPackageSourcesFolderEntityToken : EntityToken\r\n    {\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return \"PackageElementProviderPackageSourcesFolderEntityToken\"; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new PackageElementProviderPackageSourcesFolderEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderPackageSourcesItemEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    internal sealed class PackageElementProviderPackageSourcesItemEntityTokenAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if (entityToken == null) throw new ArgumentNullException(\"entityToken\");\r\n\r\n            yield return new PackageElementProviderPackageSourcesFolderEntityToken();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [SecurityAncestorProvider(typeof(PackageElementProviderPackageSourcesItemEntityTokenAncestorProvider))]\r\n    internal sealed class PackageElementProviderPackageSourcesItemEntityToken : EntityToken\r\n    {\r\n        string _id;\r\n\r\n        public PackageElementProviderPackageSourcesItemEntityToken(Guid id)\r\n        {\r\n            _id = id.ToString();\r\n        }\r\n\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new PackageElementProviderPackageSourcesItemEntityToken(new Guid(id));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/PackageElementProviderRootEntityToken.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    public sealed class PackageElementProviderRootEntityToken : EntityToken\r\n\t{\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return \"PackageElementProviderRootEntityToken\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new PackageElementProviderRootEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PackageElementProvider/WorkflowHelper.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.Core.PackageSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class WorkflowHelper\r\n\t{\r\n        /// <exclude />\r\n        public static object ValidationResultToBinding(List<PackageFragmentValidationResult> packageFragmentValidationResults)\r\n        {\r\n            List<List<string>> rows = new List<List<string>>();\r\n            \r\n            foreach (PackageFragmentValidationResult packageFragmentValidationResult in packageFragmentValidationResults)\r\n            {\r\n                StringBuilder sb = new StringBuilder();\r\n\r\n                if (packageFragmentValidationResult.XPath != null)\r\n                {\r\n                    sb.AppendLine(packageFragmentValidationResult.Message);\r\n                    //sb.Append(\"XPath: \");\r\n                    //sb.Append(packageFragmentValidationResult.XPath);\r\n                }\r\n                else\r\n                {\r\n                    sb.Append(packageFragmentValidationResult.Message);\r\n                }\r\n\r\n                List<string> row = new List<string>();\r\n                row.Add(sb.ToString());\r\n\r\n                rows.Add(row);\r\n            }\r\n\r\n            return rows;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/LocalOrdering/DisplayLocalOrderingActionExecutor.cs",
    "content": "using System;\r\nusing System.Web;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider.LocalOrdering\r\n{\r\n    internal sealed class DisplayLocalOrderingActionExecutor : IActionExecutor\r\n\t{\r\n        private static string BaseUrl = \"/Website/Spikes/PageLocalOrdering/ShowLocalOrdering.aspx\";\r\n\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<Composite.C1Console.Events.IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            DisplayLocalOrderingActionToken castedActionToken = (DisplayLocalOrderingActionToken)actionToken;\r\n\r\n            string url = string.Format(\"{0}?ParentPageId={1}\", BaseUrl, HttpUtility.UrlEncode(castedActionToken.ParentPageId.ToString()));\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(\r\n                new OpenViewMessageQueueItem \r\n                    { \r\n                        EntityToken = EntityTokenSerializer.Serialize(entityToken, true),\r\n                        Url = url, \r\n                        ViewId = Guid.NewGuid().ToString(), \r\n                        ViewType = ViewType.Main, \r\n                        Label = \"Pages local orderings\" \r\n                    }, \r\n                currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/LocalOrdering/DisplayLocalOrderingActionToken.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider.LocalOrdering\r\n{\r\n    [ActionExecutor(typeof(DisplayLocalOrderingActionExecutor))]\r\n    internal sealed class DisplayLocalOrderingActionToken : ActionToken\r\n\t{\r\n        private static PermissionType[] _permissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n\r\n\r\n        public DisplayLocalOrderingActionToken(Guid parentPageId)\r\n        {\r\n            this.ParentPageId = parentPageId;\r\n        }\r\n\r\n\r\n        public Guid ParentPageId\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        public override bool IgnoreEntityTokenLocking => true;\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionTypes; }\r\n        }\r\n\r\n\r\n        public override string Serialize()\r\n        {\r\n            return this.ParentPageId.ToString();\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            Guid parentPageId = new Guid(serializedData);\r\n\r\n            return new DisplayLocalOrderingActionToken(parentPageId);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/PageAddActionExecuter.cs",
    "content": "﻿using Composite.C1Console.Actions;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    /// <exclude />\r\n    public class PageAddActionExecuter : IActionExecutorSerializedParameters\r\n    {\r\n        /// <exclude />\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            return Execute(EntityTokenSerializer.Serialize(entityToken), ActionTokenSerializer.Serialize(actionToken), actionToken, flowControllerServicesContainer);\r\n        }\r\n        /// <exclude />\r\n        public FlowToken Execute(string serializedEntityToken, string serializedActionToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            PageAddActionToken pageAddActionToken = (PageAddActionToken)actionToken;\r\n\r\n            var newPage = DataFacade.BuildNew<IPage>();\r\n            newPage.PageTypeId = pageAddActionToken.PageTypeId;\r\n\r\n            var action = DataActionTokenResolverFacade.Resolve(newPage, ((PageAddActionToken)actionToken).ActionIdentifier);\r\n\r\n            return ActionExecutorFacade.Execute(EntityTokenSerializer.Deserialize(serializedEntityToken), action, flowControllerServicesContainer);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/PageAddActionToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    [ActionExecutor(typeof(PageAddActionExecuter))]\r\n    class PageAddActionToken : ProxyDataActionToken\r\n    {\r\n        private readonly Guid _pageTypeId;\r\n        /// <exclude />\r\n        public PageAddActionToken(Guid pageTypeId, ActionIdentifier actionIdentifier) : base(actionIdentifier)\r\n        {\r\n            _pageTypeId = pageTypeId;\r\n        }\r\n        /// <exclude />\r\n        public PageAddActionToken(Guid pageTypeId, ActionIdentifier actionIdentifier, IEnumerable<PermissionType> permissionTypes) : base(actionIdentifier,permissionTypes)\r\n        {\r\n            _pageTypeId = pageTypeId;\r\n        }\r\n        /// <exclude />\r\n        public Guid PageTypeId => _pageTypeId;\r\n\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder stringBuilder = new StringBuilder(base.Serialize());\r\n\r\n            StringConversionServices.SerializeKeyValuePair(stringBuilder, \"_PageTypeId_\", _pageTypeId);\r\n            \r\n            return stringBuilder.ToString();\r\n        }\r\n        /// <exclude />\r\n        public new static ActionToken Deserialize(string serializedData)\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n            Guid pageTypeId = StringConversionServices.DeserializeValueGuid(dic[\"_PageTypeId_\"]);\r\n\r\n            var baseProxyDataActionToken = (ProxyDataActionToken)ProxyDataActionToken.Deserialize(serializedData);\r\n\r\n            var result = new PageAddActionToken(pageTypeId, baseProxyDataActionToken.ActionIdentifier, baseProxyDataActionToken.PermissionTypes) { DoIgnoreEntityTokenLocking = baseProxyDataActionToken.IgnoreEntityTokenLocking };\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/PageElementDynamicActionTokens.cs",
    "content": "using Composite.C1Console.Actions;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    /// <summary>\r\n    /// Here we register default actions for page element providers\r\n    /// </summary>\r\n    [ApplicationStartup]\r\n    public static class PageElementDynamicActionTokens\r\n    {\r\n        /// <exclude />\r\n        public static void OnBeforeInitialize()\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public static void OnInitialized(DataActionTokenResolver resolver)\r\n        {\r\n            resolver.RegisterDefault<IPage>(ActionIdentifier.Add, f => new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageElementProvider.AddNewPageWorkflow\")) { DoIgnoreEntityTokenLocking = true, Payload = SerializerHandlerFacade.Serialize(f) });\r\n            resolver.RegisterDefault<IPage>(ActionIdentifier.Edit, f => new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageElementProvider.EditPageWorkflow\")));\r\n            resolver.RegisterDefault<IPage>(ActionIdentifier.Delete, f => new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageElementProvider.DeletePageWorkflow\")));\r\n            resolver.RegisterDefault<IPage>(ActionIdentifier.Duplicate, f => new DuplicateActionToken());\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/PageElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Actions.Data;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Parallelization;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    [ActionTokenProvider(GenericPublishProcessControllerActionTypeNames.UndoUnpublishedChanges, typeof(PageElementProviderActionTokenProvider))]\r\n    [ConfigurationElementType(typeof(PageElementProviderData))]\r\n    internal class PageElementProvider : IHooklessElementProvider, IDataExchangingElementProvider, IDragAndDropElementProvider, ILocaleAwareElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n        private AssociatedDataElementProviderHelper<IPage> _pageAssociatedHelper;\r\n\r\n\r\n        public static ResourceHandle DuplicatePage = GetIconHandle(\"copy\");\r\n        public static ResourceHandle EditPage = GetIconHandle(\"page-edit-page\");\r\n        public static ResourceHandle LocalizePage = GetIconHandle(\"page-localize-page\");\r\n        public static ResourceHandle ManageHostNames = GetIconHandle(\"page-manage-host-names\");\r\n        public static ResourceHandle AddPage = GetIconHandle(\"page-add-page\");\r\n        public static ResourceHandle ListUnpublishedItems = GetIconHandle(\"page-list-unpublished-items\");\r\n        public static ResourceHandle AddSubPage = GetIconHandle(\"page-add-sub-page\");\r\n        public static ResourceHandle DeletePage = GetIconHandle(\"page-delete-page\");\r\n        public static ResourceHandle PageDraft = GetIconHandle(\"page-draft\");\r\n        public static ResourceHandle PageAwaitingApproval = GetIconHandle(\"page-awaiting-approval\");\r\n        public static ResourceHandle PageAwaitingPublication = GetIconHandle(\"page-awaiting-publication\");\r\n        public static ResourceHandle PagePublication = GetIconHandle(\"page-publication\");\r\n        public static ResourceHandle PageGhosted = GetIconHandle(\"page-ghosted\");\r\n        public static ResourceHandle PageDisabled = GetIconHandle(\"page-disabled\");\r\n        public static ResourceHandle RootOpen = GetIconHandle(\"page-root-open\");\r\n        public static ResourceHandle RootClosed = GetIconHandle(\"page-root-closed\");\r\n        public static ResourceHandle ActivateLocalization = GetIconHandle(\"page-activatelocalization\");\r\n        public static ResourceHandle DeactivateLocalization = GetIconHandle(\"page-deactivatelocalization\");\r\n        public static ResourceHandle AddDataAssociationTypeIcon = GetIconHandle(\"dataassociation-add-association\");\r\n        public static ResourceHandle EditDataAssociationTypeIcon = GetIconHandle(\"dataassociation-edit-association\");\r\n        public static ResourceHandle RemoveDataAssociationTypeIcon = GetIconHandle(\"dataassociation-remove-association\");\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n        private static readonly ActionGroup ViewActionGroup = new ActionGroup(\"View\", ActionGroupPriority.PrimaryLow);\r\n        private static readonly ActionGroup AppendedActionGroup = new ActionGroup(\"Common tasks\", ActionGroupPriority.GeneralAppendMedium);\r\n        private static readonly ActionGroup MetaDataAppendedActionGroup = new ActionGroup(\"Associated data\", ActionGroupPriority.PrimaryMedium);\r\n        internal static readonly List<PermissionType> AddWebsitePermissionTypes = new List<PermissionType> { PermissionType.Configure, PermissionType.Administrate };\r\n        internal static readonly List<PermissionType> EditPermissionTypes = new List<PermissionType> { PermissionType.Edit };\r\n        internal static readonly List<PermissionType> DuplicatePermissionTypes = new List<PermissionType> { PermissionType.Add };\r\n        internal static readonly List<PermissionType> LocalizePermissionTypes = new List<PermissionType> { PermissionType.Edit };\r\n        internal static readonly List<PermissionType> AddPermissionTypes = new List<PermissionType> { PermissionType.Add };\r\n        internal static readonly List<PermissionType> DeletePermissionTypes = new List<PermissionType> { PermissionType.Delete };\r\n\r\n        internal static readonly string DefaultConfigurationName = \"PageElementProvider\";\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n\r\n        public PageElementProvider()\r\n        {\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n            DataEvents<IPageType>.OnStoreChanged += DataEvents_IPageType_OnStoreChanged;\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set\r\n            {\r\n                _context = value;\r\n\r\n                _pageAssociatedHelper = new AssociatedDataElementProviderHelper<IPage>(\r\n                    _context,\r\n                    new PageElementProviderEntityToken(_context.ProviderName),\r\n                    true);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool ContainsLocalizedData => true;\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken searchToken)\r\n        {\r\n            EntityToken entityToken = new PageElementProviderEntityToken(_context.ProviderName);\r\n\r\n            if (UserValidationFacade.IsLoggedIn() \r\n                && !DataLocalizationFacade.ActiveLocalizationCultures.Contains(UserSettings.ActiveLocaleCultureInfo))\r\n            {\r\n                yield return new Element(_context.CreateElementHandle(entityToken))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = \"No website access: Missing permissions to any Data Language\",\r\n                        Icon = PageElementProvider.DeactivateLocalization\r\n                    }\r\n                };\r\n                yield break;\r\n            }\r\n\r\n            ICollection<Guid> pageIds = PageServices.GetChildrenIDs(Guid.Empty);\r\n            \r\n            var homePageIdFilter = (searchToken as PageSearchToken)?.HomePageId ?? Guid.Empty;\r\n            if (homePageIdFilter != Guid.Empty)\r\n            {\r\n                pageIds = pageIds.Where(p => p == homePageIdFilter).ToList();\r\n            }\r\n\r\n            var dragAndDropInfo = new ElementDragAndDropInfo();\r\n            dragAndDropInfo.AddDropType(typeof(IPage));\r\n            dragAndDropInfo.SupportsIndexedPosition = true;\r\n\r\n            var element = new Element(_context.CreateElementHandle(entityToken), dragAndDropInfo)\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.RootLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.RootLabelToolTip\"),\r\n                    HasChildren = pageIds.Count != 0,\r\n                    Icon = PageElementProvider.RootClosed,\r\n                    OpenedIcon = PageElementProvider.RootOpen\r\n                }\r\n            };\r\n\r\n            var allPageTypes = DataFacade.GetData<IPageType>().AsEnumerable();\r\n\r\n            foreach (\r\n                var pageType in\r\n                    allPageTypes.Where(f => f.HomepageRelation != nameof(PageTypeHomepageRelation.OnlySubPages))\r\n                        .OrderByDescending(f=>f.Id))\r\n            {\r\n                element.AddAction(\r\n                    new ElementAction(\r\n                        new ActionHandle(new PageAddActionToken(pageType.Id, ActionIdentifier.Add, AddPermissionTypes) {DoIgnoreEntityTokenLocking = true} ))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = string.Format(StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\",\r\n                                    \"PageElementProvider.AddPageAtRootFormat\"), pageType.Name),\r\n                            ToolTip =\r\n                                StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\",\r\n                                    \"PageElementProvider.AddPageAtRootToolTip\"),\r\n                            Icon = PageElementProvider.AddPage,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup,\r\n                                ActionBundle = \"AddWebsite\"\r\n                            }\r\n                        }\r\n\r\n                    });\r\n            }\r\n\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new ViewUnpublishedItemsActionToken()))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    //Label = \"List unpublished Content\",\r\n                    //ToolTip = \"Get an overview of pages and page folder data that haven't been published yet.\",\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.ViewUnpublishedItems\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.ViewUnpublishedItemsToolTip\"),\r\n                    Icon = PageElementProvider.ListUnpublishedItems,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = ViewActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AddMetaDataWorkflow\"), AssociatedDataElementProviderHelper<IPage>.AddAssociatedTypePermissionTypes) { DoIgnoreEntityTokenLocking = true }))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataTypeLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataTypeToolTip\"),\r\n                    Icon = AddDataAssociationTypeIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = MetaDataAppendedActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.EditMetaDataWorkflow\"), AssociatedDataElementProviderHelper<IPage>.EditAssociatedTypePermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditMetaDataTypeLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditMetaDataTypeToolTip\"),\r\n                    Icon = EditDataAssociationTypeIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = MetaDataAppendedActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow\"), AssociatedDataElementProviderHelper<IPage>.RemoveAssociatedTypePermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.RemoveMetaDataTypeLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.RemoveMetaDataTypeToolTip\"),\r\n                    Icon = RemoveDataAssociationTypeIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Delete,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = MetaDataAppendedActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            // Creates a problem for the front-end \"toolbar caching\" mechanism - dont re-introduce this right befroe a release\r\n            // Reason: ActionTokin is always unique for a page, making the ActionKey (hash) unique\r\n            //if (RuntimeInformation.IsDebugBuild)\r\n            //{\r\n            //    element.AddAction(new ElementAction(new ActionHandle(new DisplayLocalOrderingActionToken(Guid.Empty)))\r\n            //    {\r\n            //        VisualData = new ActionVisualizedData\r\n            //        {\r\n            //            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.DisplayLocalOrderingLabel\"),\r\n            //            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.DisplayLocalOrderingToolTip\"),\r\n            //            Icon = CommonElementIcons.Nodes,\r\n            //            Disabled = false,\r\n            //            ActionLocation = new ActionLocation\r\n            //            {\r\n            //                ActionType = ActionType.DeveloperMode,\r\n            //                IsInFolder = false,\r\n            //                IsInToolbar = false,\r\n            //                ActionGroup = AppendedActionGroup\r\n            //            }\r\n            //        }\r\n            //    });\r\n            //}\r\n\r\n            yield return element;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            if (UserValidationFacade.IsLoggedIn() \r\n                && !DataLocalizationFacade.ActiveLocalizationCultures.Contains(UserSettings.ActiveLocaleCultureInfo)) \r\n            {\r\n                return Enumerable.Empty<Element>();\r\n            }\r\n\r\n            if (entityToken is AssociatedDataElementProviderHelperEntityToken associatedData)\r\n            {\r\n                return _pageAssociatedHelper.GetChildren(associatedData, false);\r\n            }\r\n\r\n            if (entityToken is DataGroupingProviderHelperEntityToken dataGrouping)\r\n            {\r\n                return _pageAssociatedHelper.GetChildren(dataGrouping, false);\r\n            }\r\n\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                var allChildPages = GetChildrenPages(entityToken, searchToken);\r\n                List<KeyValuePair<PageLocaleState, IPage>> childPages = IEnumerableExtensionMethods.ToList(allChildPages, f => new KeyValuePair<PageLocaleState, IPage>(PageLocaleState.Own, f));\r\n\r\n                List<Element> childPageElements = GetElements(childPages, entityToken is PageElementProviderEntityToken);\r\n\r\n                return GetChildElements(entityToken, childPageElements);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetForeignRoots(SearchToken searchToken)\r\n        {\r\n            return GetRoots(searchToken);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetForeignChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            if (entityToken is DataEntityToken dataEntityToken && dataEntityToken.Data == null) return Array.Empty<Element>();\r\n            if (UserValidationFacade.IsLoggedIn()\r\n                && !DataLocalizationFacade.ActiveLocalizationCultures.Contains(UserSettings.ActiveLocaleCultureInfo))\r\n            {\r\n                return Enumerable.Empty<Element>();\r\n            }\r\n\r\n            if (entityToken is AssociatedDataElementProviderHelperEntityToken associatedData)\r\n            {\r\n                return _pageAssociatedHelper.GetChildren(associatedData, true);\r\n            }\r\n\r\n            if (entityToken is DataGroupingProviderHelperEntityToken dataGrouping)\r\n            {\r\n                return _pageAssociatedHelper.GetChildren(dataGrouping, true);\r\n            }\r\n\r\n            IEnumerable<IPage> pages;\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                pages = GetChildrenPages(entityToken, searchToken).ToList();\r\n            }\r\n\r\n\r\n            IEnumerable<IPage> foreignAdministratedPages;\r\n            using (new DataScope(DataScopeIdentifier.Administrated, UserSettings.ForeignLocaleCultureInfo))\r\n            {\r\n                foreignAdministratedPages = GetChildrenPages(entityToken, searchToken).ToList();\r\n            }\r\n\r\n            IEnumerable<IPage> foreignPublicPages;\r\n            using (new DataScope(DataScopeIdentifier.Public, UserSettings.ForeignLocaleCultureInfo))\r\n            {\r\n                foreignPublicPages = GetChildrenPages(entityToken, searchToken).ToList();\r\n            }\r\n\r\n\r\n            Guid? itemId = GetParentPageId(entityToken);\r\n            if (itemId.HasValue == false) return new Element[] { };\r\n\r\n            IEnumerable<Guid> childPageIds =\r\n              (from ps in DataFacade.GetData<IPageStructure>()\r\n               where ps.ParentId == itemId.Value\r\n               orderby ps.LocalOrdering\r\n               select ps.Id).ToList();\r\n\r\n\r\n            var resultPages = new List<KeyValuePair<PageLocaleState, IPage>>();\r\n            foreach (Guid pageId in childPageIds)\r\n            {\r\n                if (pages.Any(f => f.Id == pageId))\r\n                {\r\n                    resultPages.AddRange(\r\n                        pages.Where(f => f.Id == pageId)\r\n                            .Select(p => new KeyValuePair<PageLocaleState, IPage>(PageLocaleState.Own, p)));\r\n                }\r\n                else if (foreignAdministratedPages.Any(f => f.Id == pageId && f.IsTranslatable()))\r\n                {\r\n                    resultPages.AddRange(\r\n                        foreignAdministratedPages.Where(f => f.Id == pageId && f.IsTranslatable())\r\n                            .Select(p => new KeyValuePair<PageLocaleState, IPage>(PageLocaleState.ForeignActive, p)));\r\n                }\r\n                else if (foreignPublicPages.Any(f => f.Id == pageId))\r\n                {\r\n                    resultPages.AddRange(\r\n                        foreignPublicPages.Where(f => f.Id == pageId)\r\n                            .Select(p => new KeyValuePair<PageLocaleState, IPage>(PageLocaleState.ForeignActive, p)));\r\n                }\r\n                else if (foreignAdministratedPages.Any(f => f.Id == pageId))\r\n                {\r\n                    resultPages.AddRange(\r\n                        foreignAdministratedPages.Where(f => f.Id == pageId)\r\n                            .Select(p => new KeyValuePair<PageLocaleState, IPage>(PageLocaleState.ForeignDisabled, p)));\r\n                }\r\n\r\n            }\r\n\r\n            List<Element> childPageElements = GetElements(resultPages, entityToken is PageElementProviderEntityToken, true);\r\n\r\n            return GetChildElements(entityToken, childPageElements);\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            var result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                var dataEntityToken = (DataEntityToken) entityToken;\r\n                Type type = dataEntityToken.InterfaceType;\r\n\r\n                if (type != typeof(IPage)) continue;\r\n\r\n                Guid pageId = (Guid) dataEntityToken.DataSourceId.GetKeyValue(nameof(IPage.Id));\r\n                Guid parentPageId = PageManager.GetParentId(pageId);\r\n\r\n                if (parentPageId != Guid.Empty)\r\n                {\r\n                    if (!GlobalSettingsFacade.AllowChildPagesTranslationWithoutParent)\r\n                        continue;\r\n\r\n                    using (new DataScope(dataEntityToken.DataSourceId.LocaleScope))\r\n                    {\r\n                        var parentPage = PageManager.GetPageById(parentPageId);\r\n                        if (parentPage != null)\r\n                            continue;\r\n                    }\r\n                }\r\n\r\n                result.Add(entityToken, new EntityToken[] { new PageElementProviderEntityToken(_context.ProviderName) });\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        private IEnumerable<Element> GetChildElements(EntityToken entityToken, IEnumerable<Element> childPageElements)\r\n        {\r\n            Guid? itemId = GetParentPageId(entityToken);\r\n            if (!itemId.HasValue) return new Element[] { };\r\n\r\n            List<Element> associatedChildElements;\r\n            if (itemId.Value != Guid.Empty)\r\n            {\r\n                using (new DataScope(DataScopeIdentifier.Administrated))\r\n                {\r\n                    IPage page = PageManager.GetPageById(itemId.Value);\r\n\r\n                    if (page != null) // null => Foreign page\r\n                    {\r\n                        associatedChildElements = _pageAssociatedHelper.GetChildren(page, entityToken);\r\n                    }\r\n                    else\r\n                    {\r\n                        associatedChildElements = new List<Element>();\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                associatedChildElements = new List<Element>();\r\n            }\r\n\r\n            associatedChildElements.AddRange(childPageElements);\r\n\r\n            return associatedChildElements;\r\n        }\r\n\r\n\r\n\r\n        private static Guid? GetParentPageId(EntityToken entityToken)\r\n        {\r\n            if (entityToken is PageElementProviderEntityToken)\r\n            {\r\n                return Guid.Empty;\r\n            }\r\n\r\n            if (entityToken is DataEntityToken dataEntityToken)\r\n            {\r\n                IPage parentPage = dataEntityToken.Data as IPage;\r\n\r\n                return parentPage?.Id;\r\n            }\r\n\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<IPage> GetChildrenPages(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            var itemId = GetParentPageId(entityToken);\r\n\r\n            if (!itemId.HasValue)\r\n                return Enumerable.Empty<IPage>();\r\n\r\n            var parentPageId = itemId.Value;\r\n\r\n            ICollection<IPage> pages;\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                var keyword = searchToken.Keyword.ToLowerInvariant();\r\n                pages = GetPagesByKeyword(keyword, parentPageId);\r\n            }\r\n            else\r\n            {\r\n                pages = PageServices.GetChildren(parentPageId).Evaluate();\r\n            }\r\n\r\n            if (parentPageId == Guid.Empty)\r\n            {\r\n                var homePageIdFilter = (searchToken as PageSearchToken)?.HomePageId ?? Guid.Empty;\r\n                if (homePageIdFilter != Guid.Empty)\r\n                {\r\n                    pages = pages.Where(p => p.Id == homePageIdFilter).ToList();\r\n                }\r\n            }\r\n\r\n            return OrderByVersions(pages);\r\n        }\r\n\r\n        private ICollection<IPage> GetPagesByKeyword(string keyword, Guid parentId)\r\n        {\r\n            var predicateItems =\r\n                from page in DataFacade.GetData<IPage>()\r\n                where (page.Description != null && page.Description.ToLowerInvariant().Contains(keyword)) ||\r\n                      (page.Title != null && page.Title.ToLowerInvariant().Contains(keyword))\r\n                select new TreeNode { Key = page.Id, ParentKey = page.GetParentId() };\r\n\r\n\r\n            List<TreeNode> keyTree =\r\n                DataFacade.GetData<IPage>().Select(x => new TreeNode { Key = x.Id, ParentKey = x.GetParentId() }).ToList();\r\n\r\n            IEnumerable<TreeNode> nodes = new List<TreeNode>();\r\n            foreach (TreeNode node in predicateItems)\r\n            {\r\n                nodes = nodes.Concat(GetAncestorPath(node, keyTree)).ToList();\r\n            }\r\n\r\n            List<Guid> pageIds = nodes.Where(x => x.ParentKey == parentId).Select(x => x.Key).Distinct().ToList();\r\n\r\n            var pages = new List<IPage>();\r\n\r\n            foreach (var page in DataFacade.GetData<IPage>())\r\n            {\r\n                if (pageIds.Contains(page.Id))\r\n                {\r\n                    pages.Add(page);\r\n                }\r\n            }\r\n\r\n            return pages;\r\n        }\r\n\r\n        private IEnumerable<IPage> OrderByVersions(IEnumerable<IPage> pages)\r\n        {\r\n            return (from page in pages\r\n                group page by page.Id\r\n                into pageVersionGroups\r\n                let versions = pageVersionGroups.ToList()\r\n                let liveVersionName = versions.Count == 1 ? null : versions[0].GetLiveVersionName()\r\n                select versions\r\n                    .OrderByVersions()\r\n                    .OrderByDescending(v => v.LocalizedVersionName() == liveVersionName))\r\n                .SelectMany(v => v);\r\n        }\r\n\r\n\r\n        private class TreeNode\r\n        {\r\n            public Guid Key { get; set; }\r\n            public Guid ParentKey { get; set; }\r\n\r\n        }\r\n\r\n\r\n        private IList<TreeNode> GetAncestorPath(TreeNode key, IList<TreeNode> keys)\r\n        {\r\n            if (key.ParentKey == Guid.Empty)\r\n            {\r\n                return new List<TreeNode>() { key };\r\n            }\r\n\r\n            var parent = keys.First(x => x.Key == key.ParentKey);\r\n\r\n            IList<TreeNode> ancestors = GetAncestorPath(parent, keys);\r\n            ancestors.Add(key);\r\n            return ancestors;\r\n        }\r\n\r\n\r\n\r\n        public bool OnElementDraggedAndDropped(EntityToken draggedEntityToken, EntityToken newParentEntityToken, int dropIndex, DragAndDropType dragAndDropType, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            IPage draggedPage = (IPage)((DataEntityToken)draggedEntityToken).Data;\r\n            Verify.IsNotNull(draggedPage, \"Dragged page does not exist\");\r\n\r\n            Guid newParentPageId;\r\n            if (newParentEntityToken is PageElementProviderEntityToken)\r\n            {\r\n                newParentPageId = Guid.Empty;\r\n            }\r\n            else if (newParentEntityToken is DataEntityToken dataEntityToken)\r\n            {\r\n                IPage newParentPage = (IPage)dataEntityToken.Data;\r\n                newParentPageId = newParentPage.Id;\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n            IPage oldParent = null;\r\n            Guid oldParentId = draggedPage.GetParentId();\r\n            if (oldParentId != Guid.Empty)\r\n            {\r\n                oldParent = DataFacade.GetData<IPage>(f => f.Id == oldParentId).FirstOrDefault();\r\n            }\r\n\r\n            if (dragAndDropType == DragAndDropType.Move)\r\n            {\r\n                using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n                {\r\n                    string urlTitle = draggedPage.UrlTitle;\r\n                    int counter = 1;\r\n\r\n                    while (true)\r\n                    {\r\n                        bool urlTitleClash =\r\n                            (from p in PageServices.GetChildren(newParentPageId).AsEnumerable()\r\n                             where p.UrlTitle == urlTitle && p.Id != draggedPage.Id\r\n                             select p).Any();\r\n\r\n\r\n                        if (!urlTitleClash)\r\n                        {\r\n                            break;\r\n                        }\r\n\r\n                        urlTitle = $\"{draggedPage.UrlTitle}{counter++}\";\r\n                    }\r\n\r\n                    draggedPage.UrlTitle = urlTitle;\r\n\r\n                    // Real drop index takes into account pages from other locales\r\n                    int realDropIndex = GetRealDropIndex(draggedPage, newParentPageId, dropIndex);\r\n\r\n                    draggedPage.MoveTo(newParentPageId, realDropIndex, false);\r\n                    \r\n                    DataFacade.Update(draggedPage, false, false, true);\r\n\r\n                    EntityTokenCacheFacade.ClearCache(draggedPage.GetDataEntityToken());\r\n\r\n                    transactionScope.Complete();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n\r\n            if (oldParent != null)\r\n            {\r\n                var oldParentParentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);\r\n                oldParentParentTreeRefresher.PostRefreshMesseges(oldParent.GetDataEntityToken());\r\n            }\r\n            else\r\n            {\r\n                var oldParentspecificTreeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);\r\n                oldParentspecificTreeRefresher.PostRefreshMesseges(new PageElementProviderEntityToken(_context.ProviderName));\r\n            }\r\n\r\n            var newParentParentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);\r\n            newParentParentTreeRefresher.PostRefreshMesseges(newParentEntityToken);\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n        private static int GetRealDropIndex(IPage draggedPage, Guid newParentPageId, int dropIndex)\r\n        {\r\n            if (dropIndex == 0)\r\n            {\r\n                return 0;\r\n            }\r\n\r\n            List<Guid> childPageIDs = PageManager.GetChildrenIDs(newParentPageId).ToList();\r\n\r\n            // Removing pages that does not belong to the same locale\r\n            using (new DataScope(draggedPage.DataSourceId.PublicationScope, draggedPage.DataSourceId.LocaleScope))\r\n            {\r\n                childPageIDs.RemoveAll(pageId => PageManager.GetPageById(pageId) == null);\r\n            }\r\n\r\n            if (childPageIDs.Count == 0)\r\n            {\r\n                return 0;\r\n            }\r\n\r\n            childPageIDs = childPageIDs.OrderBy(PageManager.GetLocalOrdering).ToList();\r\n\r\n            return PageManager.GetLocalOrdering(childPageIDs[Math.Min(childPageIDs.Count - 1, dropIndex - 1)]) + 1;\r\n        }\r\n\r\n\r\n        private enum PageLocaleState\r\n        {\r\n            Own,\r\n            ForeignActive,\r\n            ForeignDisabled\r\n        }\r\n\r\n\r\n        private List<Element> GetElements(List<KeyValuePair<PageLocaleState, IPage>> pages, bool rootPages, bool useForeign = false)\r\n        {\r\n            //ElementDragAndDropInfo dragAndDropInfo = new ElementDragAndDropInfo(typeof(IPage));\r\n            //dragAndDropInfo.AddDropType(typeof(IPage));\r\n            //dragAndDropInfo.SupportsIndexedPosition = true;\r\n\r\n            string editPageLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.EditPage\");\r\n            string editPageToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.EditPageToolTip\");\r\n            string localizePageLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.LocalizePage\");\r\n            string localizePageToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.LocalizePageToolTip\");\r\n            string addNewPageLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.AddSubPageFormat\");\r\n            //string addNewPageToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.AddSubPageToolTip\");\r\n            string deletePageLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.Delete\");\r\n            string deletePageToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.DeleteToolTip\");\r\n            string duplicatePageLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.Duplicate\");\r\n            string duplicatePageToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.DuplicateToolTip\");\r\n            string unLocalizePageLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.UnLocalizePage\");\r\n            string unLocalizePageToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.UnLocalizePageToolTip\");\r\n\r\n            string urlMappingName = null;\r\n            if (UserSettings.ForeignLocaleCultureInfo != null)\r\n            {\r\n                urlMappingName = DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo);\r\n            }\r\n\r\n            var elements = new Element[pages.Count];\r\n            var allPageTypes = DataFacade.GetData<IPageType>().AsEnumerable();\r\n\r\n            ParallelFacade.For(\"PageElementProvider. Getting elements\", 0, pages.Count, i =>\r\n            {\r\n                var kvp = pages[i];\r\n                IPage page = kvp.Value;\r\n\r\n                EntityToken entityToken = page.GetDataEntityToken();\r\n\r\n                var dragAndDropInfo = new ElementDragAndDropInfo(typeof(IPage));\r\n                dragAndDropInfo.AddDropType(typeof(IPage));\r\n                dragAndDropInfo.SupportsIndexedPosition = true;\r\n\r\n                var element = new Element(_context.CreateElementHandle(entityToken), MakeVisualData(page, kvp.Key, urlMappingName, rootPages), dragAndDropInfo);\r\n\r\n                element.PropertyBag.Add(\"Uri\", $\"~/page({page.Id})\");\r\n                element.PropertyBag.Add(\"ElementType\", \"application/x-composite-page\");\r\n                element.PropertyBag.Add(\"DataId\", page.Id.ToString());\r\n\r\n                if (kvp.Key == PageLocaleState.Own)\r\n                {\r\n                    // Normal actions\r\n                    element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Edit,EditPermissionTypes)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = editPageLabel,\r\n                            ToolTip = editPageToolTip,\r\n                            Icon = PageElementProvider.EditPage,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                    IPageType parentPageType = allPageTypes.FirstOrDefault(f => f.Id == page.PageTypeId);\r\n                    Verify.IsNotNull(parentPageType, \"Failed to find page type by id '{0}'\", page.PageTypeId);\r\n                    element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Duplicate, DuplicatePermissionTypes)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = duplicatePageLabel,\r\n                            ToolTip = duplicatePageToolTip,\r\n                            Icon = PageElementProvider.DuplicatePage,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                    foreach (var pageType in page.GetChildPageSelectablePageTypes().OrderByDescending(pt => pt.Id == parentPageType.DefaultChildPageType))\r\n                    {\r\n                        element.AddAction(new ElementAction(new ActionHandle(new PageAddActionToken(pageType.Id,ActionIdentifier.Add, AddPermissionTypes) { DoIgnoreEntityTokenLocking = true }))\r\n                        {\r\n                            VisualData = new ActionVisualizedData\r\n                            {\r\n                                Label = string.Format(addNewPageLabel, pageType.Name),\r\n                                ToolTip = pageType.Description,\r\n                                Icon = PageElementProvider.AddPage,\r\n                                Disabled = false,\r\n                                ActionLocation = new ActionLocation\r\n                                {\r\n                                    ActionType = ActionType.Add,\r\n                                    IsInFolder = false,\r\n                                    IsInToolbar = true,\r\n                                    ActionGroup = PrimaryActionGroup,\r\n                                    ActionBundle = \"AddPage\"\r\n                                }\r\n                            }\r\n                        });\r\n                    }\r\n\r\n                    element.AddAction(new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Delete,DeletePermissionTypes)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = deletePageLabel,\r\n                            ToolTip = deletePageToolTip,\r\n                            Icon = DeletePage,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                    if (useForeign && GlobalSettingsFacade.AllowChildPagesTranslationWithoutParent)\r\n                    {\r\n                        // Delete Translation for the Page without deleting child pages and only displaying for foreign pages\r\n                        element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageElementProvider.UnLocalizePageWorkflow\"), LocalizePermissionTypes)))\r\n                        {\r\n                            VisualData = new ActionVisualizedData\r\n                            {\r\n                                Label = unLocalizePageLabel,\r\n                                ToolTip = unLocalizePageToolTip,\r\n                                Icon = PageElementProvider.LocalizePage,\r\n                                Disabled = false,\r\n                                ActionLocation = new ActionLocation\r\n                                {\r\n                                    ActionType = ActionType.Delete,\r\n                                    IsInFolder = false,\r\n                                    IsInToolbar = true,\r\n                                    ActionGroup = PrimaryActionGroup\r\n                                }\r\n                            }\r\n                        });\r\n                    }\r\n\r\n                    _pageAssociatedHelper.AttachElementActions(element, page);\r\n                }\r\n                else if (kvp.Key == PageLocaleState.ForeignActive)\r\n                {\r\n                    // Localized actions\r\n                    bool addAction = false;\r\n\r\n                    Guid parentId = page.GetParentId();\r\n                    if (parentId == Guid.Empty)\r\n                    {\r\n                        addAction = true;\r\n                    }\r\n                    else\r\n                    {\r\n                        if (GlobalSettingsFacade.AllowChildPagesTranslationWithoutParent)\r\n                        {\r\n                            addAction = true;\r\n                        }\r\n                        else\r\n                        {\r\n                            using (new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo))\r\n                            {\r\n                                bool exists = DataFacade.GetData<IPage>(f => f.Id == parentId).Any();\r\n                                if (exists)\r\n                                {\r\n                                    addAction = true;\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n\r\n\r\n                    if (addAction)\r\n                    {\r\n                        element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageElementProvider.LocalizePageWorkflow\"), LocalizePermissionTypes)))\r\n                        {\r\n                            VisualData = new ActionVisualizedData\r\n                            {\r\n                                Label = localizePageLabel,\r\n                                ToolTip = localizePageToolTip,\r\n                                Icon = PageElementProvider.LocalizePage,\r\n                                Disabled = false,\r\n                                ActionLocation = new ActionLocation\r\n                                {\r\n                                    ActionType = ActionType.Edit,\r\n                                    IsInFolder = false,\r\n                                    IsInToolbar = true,\r\n                                    ActionGroup = PrimaryActionGroup\r\n                                }\r\n                            }\r\n                        });\r\n                    }\r\n                }\r\n\r\n                elements[i] = element;\r\n            }); \r\n\r\n            return new List<Element>(elements);\r\n        }\r\n\r\n\r\n\r\n        private ElementVisualizedData MakeVisualData(IPage page, PageLocaleState pageLocaleState, string urlMappingName, bool isRootPage)\r\n        {\r\n            bool hasChildren = PageServices.GetChildrenCount(page.Id) > 0 || _pageAssociatedHelper.HasChildren(page);\r\n\r\n            var visualizedElement = new ElementVisualizedData\r\n            {\r\n                HasChildren = hasChildren,\r\n                Label = (isRootPage || string.IsNullOrWhiteSpace(page.MenuTitle)) ? page.Title : page.MenuTitle,\r\n                ToolTip = page.Description,\r\n                ElementBundle = page.Id.ToString(),\r\n                BundleElementName = page.LocalizedVersionName()\r\n            };\r\n\r\n            if (pageLocaleState == PageLocaleState.Own)\r\n            {\r\n                if (page.PublicationStatus == GenericPublishProcessController.Draft)\r\n                {\r\n                    visualizedElement.Icon = PageElementProvider.PageDraft;\r\n                    visualizedElement.OpenedIcon = PageElementProvider.PageDraft;\r\n                }\r\n                else if (page.PublicationStatus == GenericPublishProcessController.AwaitingApproval)\r\n                {\r\n                    visualizedElement.Icon = PageElementProvider.PageAwaitingApproval;\r\n                    visualizedElement.OpenedIcon = PageElementProvider.PageAwaitingApproval;\r\n                }\r\n                else if (page.PublicationStatus == GenericPublishProcessController.AwaitingPublication)\r\n                {\r\n                    visualizedElement.Icon = PageElementProvider.PageAwaitingPublication;\r\n                    visualizedElement.OpenedIcon = PageElementProvider.PageAwaitingPublication;\r\n                }\r\n                else\r\n                {\r\n                    visualizedElement.Icon = PageElementProvider.PagePublication;\r\n                    visualizedElement.OpenedIcon = PageElementProvider.PagePublication;\r\n                }\r\n            }\r\n            else if (pageLocaleState == PageLocaleState.ForeignActive)\r\n            {\r\n                visualizedElement.Icon = PageElementProvider.PageGhosted;\r\n                visualizedElement.OpenedIcon = PageElementProvider.PageGhosted;\r\n                visualizedElement.IsDisabled = false;\r\n                visualizedElement.Label = $\"{visualizedElement.Label} ({urlMappingName})\";\r\n            }\r\n            else\r\n            {\r\n                visualizedElement.Icon = PageElementProvider.PageDisabled;\r\n                visualizedElement.OpenedIcon = PageElementProvider.PageDisabled;\r\n                visualizedElement.IsDisabled = true;\r\n                visualizedElement.ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.DisabledPage\");\r\n                visualizedElement.Label = $\"{visualizedElement.Label} ({urlMappingName})\";\r\n            }\r\n\r\n            return visualizedElement;\r\n        }\r\n\r\n\r\n\r\n\r\n        private void DataEvents_IPageType_OnStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            EntityToken entityToken = new PageElementProviderEntityToken(_context.ProviderName);\r\n\r\n            var parents = HookingFacade.GetHookies(entityToken);\r\n\r\n            if (parents != null)\r\n            {\r\n                foreach (var parentEntityToken in parents)\r\n                {\r\n                    ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem { EntityToken = parentEntityToken }, null);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        #region IDataExchangingElementProvider Members\r\n\r\n        public object GetData(string name)\r\n        {\r\n            return \"The page element provider here - you asked me for '\" + name + \"'\";\r\n        }\r\n\r\n        #endregion\r\n    }\r\n\r\n    // Not to used on elements. This is only for determin drag'n'drop security\r\n    internal sealed class DragAndDropActionToken : ActionToken\r\n    {\r\n        private static readonly PermissionType[] _permissionTypes = { PermissionType.Administrate, PermissionType.Edit };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes => _permissionTypes;\r\n    }\r\n\r\n\r\n\r\n    internal sealed class PageElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new PageElementProvider();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(PageElementProviderAssembler))]\r\n    internal sealed class PageElementProviderData : HooklessElementProviderData\r\n    {\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/PageElementProviderActionTokenProvider.cs",
    "content": "﻿using Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    internal sealed class PageElementProviderActionTokenProvider : IActionTokenProvider\r\n    {\r\n        public ActionToken GetActionToken(string actionTypeName, IData data)\r\n        {\r\n            switch (actionTypeName)\r\n            {\r\n                case GenericPublishProcessControllerActionTypeNames.UndoUnpublishedChanges:\r\n                    return data is IPage\r\n                        ? new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageElementProvider.UndoUnpublishedChangesWorkflow\"), PageElementProvider.EditPermissionTypes)\r\n                        : null;\r\n\r\n                default:\r\n                    return null;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/PageElementProviderEntityToken.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    public sealed class PageElementProviderEntityToken : EntityToken\r\n\t{\r\n        private string _source;\r\n\r\n        /// <exclude />\r\n        public PageElementProviderEntityToken(string source)\r\n        {\r\n            _source = source;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedData, out type, out source, out id);\r\n\r\n            return new PageElementProviderEntityToken(source);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/PageSearchToken.cs",
    "content": "using System;\nusing Composite.C1Console.Elements;\n\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\n{\n    /// <summary>    \n    /// </summary>\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \n\tpublic class PageSearchToken : SearchToken\n\t{\n        /// <exclude />\n        public Guid? HomePageId { get; set; }\n\t}\n}\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageElementProvider/ViewUnpublishedItemsActionToken.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    [ActionExecutor(typeof(ViewUnpublishedItemsActionExecutor))]\r\n    internal sealed class ViewUnpublishedItemsActionToken : ActionToken\r\n    {\r\n        private static IEnumerable<PermissionType> _permissionType = new PermissionType[] { PermissionType.Read };\r\n\r\n        public ViewUnpublishedItemsActionToken()\r\n        {\r\n        }\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes\r\n        {\r\n            get { return _permissionType; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return \"ViewUnpublishedPageItems\";\r\n        }\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData)\r\n        {\r\n            return new ViewUnpublishedItemsActionToken();\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class ViewUnpublishedItemsActionExecutor : Composite.C1Console.Actions.IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            //string documentTitle = \"Unpublished Pages and Page Folder Data\";\r\n            //string description = \"The list below display pages and page data which are currently being edited or are ready to be approved / published.\";\r\n            string documentTitle = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.ViewUnpublishedItems-document-title\");\r\n            string description = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", \"PageElementProvider.ViewUnpublishedItems-document-description\");\r\n            string emptyLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"ViewUnpublishedItems-document-empty-label\");\r\n            string url = string.Format(\"{0}?showpagedata=true&title={1}&description={2}&emptyLabel={3}\",\r\n                UrlUtils.ResolveAdminUrl(string.Format(\"content/views/publishworkflowstatus/ViewUnpublishedItems.aspx\")),\r\n                HttpUtility.UrlEncode(documentTitle, Encoding.UTF8),\r\n                HttpUtility.UrlEncode(description, Encoding.UTF8),\r\n                HttpUtility.UrlEncode(emptyLabel, Encoding.UTF8));\r\n\r\n            IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n            OpenViewMessageQueueItem openViewMsg = new OpenViewMessageQueueItem\r\n            {\r\n                EntityToken = EntityTokenSerializer.Serialize(entityToken, true),\r\n                ViewId = \"ViewUnpublishedPageItems\",\r\n                Label = documentTitle,\r\n                Url = url,\r\n                ViewType = ViewType.Main\r\n            };\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageTemplateElementProvider/PageTemplateElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.PageTemplates.Foundation.PluginFacade;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nusing SR = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\nusing FileElementProvider = Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.WebsiteFileElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(PageTemplateElementProviderData))]\r\n    internal sealed class PageTemplateElementProvider : IHooklessElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n\r\n        public static ResourceHandle RootOpen { get { return GetIconHandle(\"page-template-root-open\"); } }\r\n        public static ResourceHandle RootClosed { get { return GetIconHandle(\"page-template-root-closed\"); } }\r\n        public static ResourceHandle DesignTemplate { get { return GetIconHandle(\"page-template-template\"); } }\r\n        public static ResourceHandle TemplateWithError { get { return GetIconHandle(\"error\"); } }\r\n\r\n        public static ResourceHandle AddTemplate { get { return GetIconHandle(\"page-template-add\"); } }\r\n        public static ResourceHandle EditTemplate { get { return GetIconHandle(\"page-template-edit\"); } }\r\n        public static ResourceHandle DeleteTemplate { get { return GetIconHandle(\"page-template-delete\"); } }\r\n\r\n        public static ResourceHandle FolderIcon { get { return GetIconHandle(\"folder\"); } }\r\n\r\n        private static readonly ActionGroup EditCodeFileActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        \r\n        internal static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n        public PageTemplateElementProvider()\r\n        {\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken searchToken)\r\n        {\r\n            Element element = new Element(_context.CreateElementHandle(new PageTemplateRootEntityToken()));\r\n\r\n            bool hasChildren = PageTemplateFacade.GetPageTemplates().Any();\r\n\r\n            element.VisualData = new ElementVisualizedData\r\n                         {\r\n                             Label = SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", \"PageTemplateElementProvider.RootLabel\"),\r\n                             ToolTip = SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", \"PageTemplateElementProvider.RootLabelToolTip\"),\r\n                             HasChildren = hasChildren,\r\n                             Icon = PageTemplateElementProvider.RootClosed,\r\n                             OpenedIcon = PageTemplateElementProvider.RootOpen\r\n                         };\r\n\r\n            const string addTemplateWorkflowType = \"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.AddNewPageTemplateWorkflow\";\r\n\r\n            element.AddWorkflowAction(addTemplateWorkflowType, new[] { PermissionType.Add },\r\n                                      new ActionVisualizedData\r\n            {\r\n                Label = SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", \"PageTemplateElementProvider.AddTemplate\"),\r\n                ToolTip = SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", \"PageTemplateElementProvider.AddTemplateToolTip\"),\r\n                Icon = PageTemplateElementProvider.AddTemplate,\r\n                Disabled = false,\r\n                ActionLocation = new ActionLocation\r\n                {\r\n                    ActionType = ActionType.Add,\r\n                    IsInFolder = false,\r\n                    IsInToolbar = true,\r\n                    ActionGroup = PrimaryActionGroup\r\n                }\r\n            });\r\n\r\n            foreach(var pageTemplateProviderName in PageTemplateProviderRegistry.ProviderNames)\r\n            {\r\n                var provider = PageTemplateProviderPluginFacade.GetProvider(pageTemplateProviderName);\r\n\r\n                Verify.IsNotNull(provider, \"Failed to get provider by name '{0}'\", pageTemplateProviderName);\r\n\r\n                IEnumerable<ElementAction> actions = provider.GetRootActions();\r\n\r\n                element.AddAction(actions);\r\n            }\r\n\r\n            return new [] { element };\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            if (entityToken is SharedCodeFolderEntityToken)\r\n            {\r\n                return GetSharedCodeElements(searchToken);\r\n            }\r\n\r\n            if ((entityToken is PageTemplateRootEntityToken) == false) return new Element[] { };\r\n\r\n            bool sharedFilesExist = PageTemplateFacade.GetSharedFiles().Any();\r\n\r\n            IEnumerable<Element> result = sharedFilesExist \r\n                ? new [] { GetSharedCodeElement()}\r\n                : new Element[0];\r\n\r\n            var pageTemplates = PageTemplateFacade.GetPageTemplates();\r\n\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                string keyword = searchToken.Keyword.ToLowerInvariant();\r\n\r\n                pageTemplates = pageTemplates\r\n                    .Where(t => t.Title.IndexOf(keyword, StringComparison.InvariantCultureIgnoreCase) > 0);\r\n            }\r\n\r\n            pageTemplates = pageTemplates.OrderBy(template => template.Title).ToList();\r\n\r\n            return result.Concat( GetElements(pageTemplates) );\r\n        }\r\n\r\n        private IEnumerable<Element> GetSharedCodeElements(SearchToken searchToken)\r\n        {\r\n            var result = new List<Element>();\r\n\r\n            foreach(SharedFile sharedFile in PageTemplateFacade.GetSharedFiles())\r\n            {\r\n                string relativeFilePath = sharedFile.RelativeFilePath;\r\n\r\n                string fullPath = relativeFilePath.StartsWith(\"~\") ? PathUtil.Resolve(relativeFilePath) : relativeFilePath;\r\n                var websiteFile = new WebsiteFile(fullPath);\r\n\r\n                Element element = new Element(_context.CreateElementHandle(new SharedCodeFileEntityToken(relativeFilePath)))\r\n                {\r\n                    VisualData = new ElementVisualizedData()\r\n                    {\r\n                        Label = websiteFile.FileName,\r\n                        ToolTip = websiteFile.FileName,\r\n                        HasChildren = false,\r\n                        Icon = FileElementProvider.WebsiteFileIcon(websiteFile.MimeType),\r\n                        OpenedIcon = FileElementProvider.WebsiteFileIcon(websiteFile.MimeType)\r\n                    }\r\n                };\r\n\r\n                element.PropertyBag.Add(\"Uri\", PathUtil.GetWebsitePath(websiteFile.FullPath));\r\n                element.PropertyBag.Add(\"ElementType\", websiteFile.MimeType);\r\n\r\n                // Adding \"Edit\" action for text-editable files\r\n                if (sharedFile.DefaultEditAction && MimeTypeInfo.IsTextFile(websiteFile.MimeType))\r\n                {\r\n                    element.AddWorkflowAction(\r\n                        \"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.EditSharedCodeFileWorkflow\",\r\n                        new[] {PermissionType.Edit},\r\n                        new ActionVisualizedData\r\n                            {\r\n                                Label = GetResourceString(\"EditSharedCodeFile.Label\"),\r\n                                ToolTip = GetResourceString(\"EditSharedCodeFile.ToolTip\"),\r\n                                Icon = CommonCommandIcons.Edit,\r\n                                Disabled = websiteFile.IsReadOnly,\r\n                                ActionLocation = new ActionLocation\r\n                                                        {\r\n                                                            ActionType = ActionType.Edit,\r\n                                                            IsInFolder = false,\r\n                                                            IsInToolbar = true,\r\n                                                            ActionGroup = EditCodeFileActionGroup\r\n                                                        }\r\n                            });\r\n                }\r\n\r\n                var customActions = sharedFile.GetActions();\r\n                foreach(var action in customActions)\r\n                {\r\n                    element.AddAction(action);\r\n                }\r\n                \r\n                result.Add(element);\r\n            }\r\n\r\n            return result;\r\n        } \r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            Dictionary<EntityToken, IEnumerable<EntityToken>> result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n\r\n                Type type = dataEntityToken.InterfaceType;\r\n                if (type != typeof(IXmlPageTemplate)) continue;\r\n\r\n                PageTemplateRootEntityToken newEntityToken = new PageTemplateRootEntityToken();\r\n\r\n                result.Add(entityToken, new EntityToken[] { newEntityToken });\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        private Element GetSharedCodeElement()\r\n        {\r\n            Element element = new Element(_context.CreateElementHandle(new SharedCodeFolderEntityToken()));\r\n\r\n            element.VisualData = new ElementVisualizedData\r\n            {\r\n                Label = GetResourceString(\"PageTemplateElementProvider.SharedCodeFolder.Title\"),\r\n                ToolTip = GetResourceString(\"PageTemplateElementProvider.SharedCodeFolder.ToolTip\"),\r\n                HasChildren = true,\r\n                Icon = FolderIcon,\r\n            };\r\n\r\n            return element;\r\n        }\r\n\r\n        private static string GetResourceString(string key)\r\n        {\r\n            return SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", key);\r\n        }\r\n\r\n        private IEnumerable<Element> GetElements(IEnumerable<PageTemplateDescriptor> pageTemplates)\r\n        {\r\n            List<Element> elements = new List<Element>();\r\n\r\n            foreach (PageTemplateDescriptor pageTemplate in pageTemplates)\r\n            {\r\n                var entityToken = pageTemplate.GetEntityToken();\r\n\r\n                Element element = new Element(_context.CreateElementHandle(entityToken));\r\n\r\n                element.VisualData = new ElementVisualizedData\r\n                                     {\r\n                                         Label = pageTemplate.Title,\r\n                                         ToolTip = pageTemplate.Title,\r\n                                         HasChildren = false,\r\n                                         Icon = pageTemplate.IsValid ? DesignTemplate : TemplateWithError,\r\n                                     };\r\n\r\n                IEnumerable<ElementAction> actions = pageTemplate.GetActions();\r\n\r\n                element.AddAction(actions);\r\n\r\n                elements.Add(element);\r\n            }\r\n\r\n            return elements;\r\n        }   \r\n    }\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableHooklessElementProviderAssembler))]\r\n    internal sealed class PageTemplateElementProviderData : HooklessElementProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageTemplateElementProvider/PageTemplateRootEntityToken.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    internal class PageTemplateRootEntityToken : EntityToken\r\n    {\r\n        public override string Type { get { return \"\"; } }\r\n        public override string Source { get { return \"\"; } }\r\n        public override string Id { get { return \"PageTemplateRootEntityToken\"; } }\r\n        public override string Serialize() { return \"\"; }\r\n\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            return new PageTemplateRootEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageTemplateElementProvider/SharedCodeFileEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    /// <summary>\r\n    /// Represents an entity token for a shared code file\r\n    /// </summary>\r\n    [SecurityAncestorProvider(typeof(SharedCodeFileEntityToken.SharedCodeFileSecurityAncestorProvider))]\r\n    public class SharedCodeFileEntityToken : EntityToken\r\n    {\r\n        private readonly string _virtualPath;\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"SharedCodeFileEntityToken\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"virtualPath\">The relative file path.</param>\r\n        public SharedCodeFileEntityToken(string virtualPath)\r\n        {\r\n            _virtualPath = virtualPath;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type { get { return \"_\"; } }\r\n        /// <exclude />\r\n        public override string Source { get { return \"_\"; } }\r\n        /// <exclude />\r\n        public override string Id { get { return \"_\"; } }\r\n        /// <exclude />\r\n        public override string Serialize() { return _virtualPath; }\r\n\r\n        /// <summary>\r\n        /// Gets the relative file path.\r\n        /// </summary>\r\n        public string VirtualPath\r\n        {\r\n            get { return _virtualPath; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            return new SharedCodeFileEntityToken(serializedData);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return base.Equals(obj) && (obj as SharedCodeFileEntityToken).VirtualPath == VirtualPath;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            return base.GetHashCode() ^ VirtualPath.GetHashCode();\r\n        }\r\n\r\n        internal class SharedCodeFileSecurityAncestorProvider : ISecurityAncestorProvider\r\n        {\r\n            public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n            {\r\n                return new[] { new SharedCodeFolderEntityToken() };\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageTemplateElementProvider/SharedCodeFolderEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [SecurityAncestorProvider(typeof(SharedCodeFolderEntityToken.SharedCodeFolderSecurityAncestorProvider))]\r\n    internal class SharedCodeFolderEntityToken : EntityToken\r\n    {\r\n        public override string Type { get { return \"_\"; } }\r\n        public override string Source { get { return \"_\"; } }\r\n        public override string Id { get { return \"_\"; } }\r\n        public override string Serialize() { return \"\"; }\r\n\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            return new SharedCodeFolderEntityToken();\r\n        }\r\n\r\n        internal class SharedCodeFolderSecurityAncestorProvider : ISecurityAncestorProvider\r\n        {\r\n            public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n            {\r\n                return new[] { new PageTemplateRootEntityToken() };\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/PageTemplateFeatureElementProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableHooklessElementProvider))]\r\n    internal sealed class PageTemplateFeatureElementProvider : IHooklessElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n\r\n\r\n        private static readonly ResourceHandle PageTemplateFeatureRootIcon = GetIconHandle(\"page-template-feature-root-closed\");\r\n        private static readonly ResourceHandle PageTemplateFeatureRootIconOpen = GetIconHandle(\"page-template-feature-root-open\");\r\n        private static readonly ResourceHandle PageTemplateFeatureIcon = GetIconHandle(\"page-template-feature-template\");\r\n        private static readonly ResourceHandle PageTemplateFeatureIconAdd = GetIconHandle(\"page-template-feature-add\");\r\n        private static readonly ResourceHandle PageTemplateFeatureIconEdit = GetIconHandle(\"page-template-feature-edit\");\r\n        private static readonly ResourceHandle PageTemplateFeatureIconDelete = GetIconHandle(\"page-template-feature-delete\");\r\n\r\n        private static readonly ActionGroup PrimaryFolderToolsActionGroup = new ActionGroup(\"FolderTools\", ActionGroupPriority.PrimaryMedium);\r\n\r\n\r\n        public PageTemplateFeatureElementProvider()\r\n        {\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<PageTemplateFeatureEntityToken>(this);\r\n\r\n            foreach (string pageTemplateFeratureFilename in this.PageTemplateFeatureFilenames)\r\n            {\r\n                string filename = Path.GetFileName(pageTemplateFeratureFilename);\r\n\r\n                PageTemplateFeatureEntityToken entityToken = new PageTemplateFeatureEntityToken(PageTemplateFeatureEntityToken.FeatureId, filename);\r\n\r\n                TreeFacade.AddCustomAttachmentPoint(filename, entityToken);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            Element rootFolderElement = new Element(_context.CreateElementHandle(new PageTemplateFeatureEntityToken(PageTemplateFeatureEntityToken.RootFolderId)))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.RootLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.RootToolTip\"),\r\n                    HasChildren = this.PageTemplateFeatureFilenames.Any(),\r\n                    Icon = PageTemplateFeatureRootIcon,\r\n                    OpenedIcon = PageTemplateFeatureRootIconOpen\r\n                }\r\n            };\r\n\r\n            rootFolderElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.AddPageTemplateFeatureWorkflow\"), PermissionTypePredefined.Add)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.AddTemplateFeature\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.AddTemplateFeatureToolTip\"),\r\n                    Icon = PageTemplateFeatureIconAdd,\r\n                    Disabled = false,\r\n                    ActionLocation = ActionLocation.AddPrimaryActionLocation\r\n                }\r\n            });\r\n\r\n            yield return rootFolderElement;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            if (entityToken.Id == PageTemplateFeatureEntityToken.RootFolderId)\r\n            {\r\n                foreach (string pageTemplateFeratureFilename in this.PageTemplateFeatureFilenames)\r\n                {\r\n                    string filename = Path.GetFileName(pageTemplateFeratureFilename);\r\n                    string featureName = Path.GetFileNameWithoutExtension(filename);\r\n\r\n                    bool isHtml = Path.GetExtension(filename) == \".html\";\r\n\r\n                    Element featureElement = new Element(_context.CreateElementHandle(\r\n                        PageTemplateFeatureEntityToken.BuildFeatureEntityToken(featureName)))\r\n                    {\r\n                        VisualData = new ElementVisualizedData\r\n                        {\r\n                            Label = featureName,\r\n                            ToolTip = filename,\r\n                            Icon = PageTemplateFeatureIcon\r\n                        }\r\n                    };\r\n\r\n                    featureElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.EditPageTemplateFeatureWorkflow\"), PermissionTypePredefined.Edit)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.EditTemplateFeature\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.EditTemplateFeatureToolTip\"),\r\n                            Icon = PageTemplateFeatureIconEdit,\r\n                            Disabled = false,\r\n                            ActionLocation = ActionLocation.EditPrimaryActionLocation\r\n                        }\r\n                    });\r\n\r\n                    featureElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.DeletePageTemplateFeatureWorkflow\"), PermissionTypePredefined.Delete)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.DeleteTemplateFeature\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.DeleteTemplateFeatureToolTip\"),\r\n                            Icon = PageTemplateFeatureIconDelete,\r\n                            Disabled = false,\r\n                            ActionLocation = ActionLocation.DeletePrimaryActionLocation\r\n                        }\r\n                    });\r\n\r\n                    featureElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider.TogglePageTemplateFeatureEditorWorkflow\"), PermissionTypePredefined.Edit)))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.EditVisually\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"ElementProvider.EditVisuallyToolTip\"),\r\n                            Icon = PageTemplateFeatureIconEdit,\r\n                            Disabled = false,\r\n                            ActionCheckedStatus = isHtml ? ActionCheckedStatus.Checked : ActionCheckedStatus.Unchecked,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Other,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = false,\r\n                                ActionGroup = PrimaryFolderToolsActionGroup\r\n                            },\r\n\r\n                        }\r\n                    });\r\n\r\n                    yield return featureElement;\r\n                }\r\n\r\n                yield break;\r\n            }\r\n\r\n            yield break;\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            Dictionary<EntityToken, IEnumerable<EntityToken>> result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                if (entityToken is PageTemplateFeatureEntityToken)\r\n                {\r\n                    switch (entityToken.Id)\r\n                    {\r\n                        case PageTemplateFeatureEntityToken.FeatureId:\r\n                            result.Add(entityToken, new EntityToken[] { new PageTemplateFeatureEntityToken(PageTemplateFeatureEntityToken.RootFolderId) });\r\n                            break;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<string> PageTemplateFeatureFilenames\r\n        {\r\n            get\r\n            {\r\n                string featureDir = PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory);\r\n\r\n                if (C1Directory.Exists(featureDir))\r\n                {\r\n                    var htmlFiles = C1Directory.GetFiles(featureDir, \"*.html\");\r\n                    var xmlFiles = C1Directory.GetFiles(featureDir, \"*.xml\");\r\n\r\n                    foreach (var fileName in htmlFiles.Concat(xmlFiles).OrderBy(f => f))\r\n                    {\r\n                        yield return fileName;\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    yield break;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/PageTemplateFeatureEntityToken.cs",
    "content": "﻿using System.IO;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    public sealed class PageTemplateFeatureEntityToken : EntityToken\r\n    {        \r\n        private string _id;\r\n        private string _source;\r\n\r\n\r\n        /// <exclude />\r\n        public const string RootFolderId = \"FeatureRoot\";\r\n\r\n        /// <exclude />\r\n        public const string FeatureId = \"FeatureElement\";\r\n\r\n\r\n        /// <exclude />\r\n        public PageTemplateFeatureEntityToken(string id)\r\n            :this(id, \"\")\r\n        {                        \r\n        }\r\n\r\n        /// <exclude />\r\n        public static PageTemplateFeatureEntityToken BuildFeatureEntityToken(string featureName)\r\n        {\r\n            return new PageTemplateFeatureEntityToken(FeatureId, featureName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public PageTemplateFeatureEntityToken(string id, string source)\r\n        {\r\n            _id = id;\r\n            _source = source;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public string FeatureName\r\n        {\r\n            get { return this.Source; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n            \r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new PageTemplateFeatureEntityToken(id, source);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/RazorFunctionElementProvider/RazorFunctionElementProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing SR = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.RazorFunctionElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(RazorFunctionProviderElementProviderData))]\r\n    internal class RazorFunctionElementProvider: BaseFunctionProviderElementProvider.BaseFunctionProviderElementProvider\r\n    {\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        protected static ResourceHandle AddFunctionIcon { get { return GetIconHandle(\"razor-function-add\"); } }\r\n        protected static ResourceHandle EditFunctionIcon { get { return GetIconHandle(\"razor-function-edit\"); } }\r\n        protected static ResourceHandle DeleteFunctionIcon { get { return GetIconHandle(\"razor-function-delete\"); } }\r\n\r\n        private readonly string _functionProviderName;\r\n        private readonly string _rootLabel;\r\n\r\n        public RazorFunctionElementProvider(string functionProvider, string rootLabel)\r\n        {\r\n            _functionProviderName = functionProvider;\r\n            _rootLabel = rootLabel;\r\n        }\r\n\r\n        public override string FunctionProviderName\r\n        {\r\n            get { return _functionProviderName; }\r\n        }\r\n\r\n        protected override IEnumerable<IFunctionTreeBuilderLeafInfo> OnGetFunctionInfos(SearchToken searchToken)\r\n        {\r\n            var functions = FunctionFacade.GetFunctionsByProvider(_functionProviderName);\r\n\r\n            if(searchToken != null && !string.IsNullOrEmpty(searchToken.Keyword))\r\n            {\r\n                string keyword = searchToken.Keyword.ToLowerInvariant();\r\n\r\n                functions = functions.Where(f => f.Namespace.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) > 0\r\n                                                 || f.Name.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) > 0);\r\n            }\r\n\r\n            return functions.Select(f => new RazorFunctionTreeBuilderLeafInfo(f));\r\n        }\r\n\r\n        protected override IEnumerable<Type> OnGetEntityTokenTypes()\r\n        {\r\n            return new [] { typeof(FileBasedFunctionEntityToken)};\r\n        }\r\n\r\n        protected override IFunctionTreeBuilderLeafInfo OnIsEntityOwner(EntityToken entityToken)\r\n        {\r\n            if(entityToken is FileBasedFunctionEntityToken && entityToken.Source == _functionProviderName)\r\n            {\r\n                string functionFullName = entityToken.Id;\r\n\r\n                IFunction function = FunctionFacade.GetFunctionsByProvider(_functionProviderName)\r\n                        .FirstOrDefault(func => func.Namespace + \".\" + func.Name == functionFullName);\r\n\r\n                return function == null ? null : new RazorFunctionTreeBuilderLeafInfo(function);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<ElementAction> OnGetFolderActions()\r\n        {\r\n            Type workflow = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider.AddNewRazorFunctionWorkflow\");\r\n\r\n            return new[] { new ElementAction(new ActionHandle(new WorkflowActionToken(workflow, new [] { PermissionType.Add }))) {\r\n                         VisualData = new ActionVisualizedData { \r\n                            Label = GetText(\"AddNewRazorFunction.Label\"), \r\n                            ToolTip = GetText(\"AddNewRazorFunction.ToolTip\"),\r\n                            Icon = AddFunctionIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<ElementAction> OnGetFunctionActions(IFunctionTreeBuilderLeafInfo function)\r\n        {\r\n            var editWorkflow = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider.EditRazorFunctionWorkflow\");\r\n            var deleteWorkflow = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider.DeleteRazorFunctionWorkflow\");\r\n\r\n            return new [] \r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            editWorkflow, new [] { PermissionType.Edit }\r\n                        ))) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = GetText(\"EditRazorFunction.Label\"), \r\n                            ToolTip = GetText(\"EditRazorFunction.ToolTip\"),\r\n                            Icon = EditFunctionIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    },\r\n\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            deleteWorkflow, new [] { PermissionType.Delete }\r\n                        ){Payload = GetContext().ProviderName})) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = GetText(\"DeleteRazorFunction.Label\"), \r\n                            ToolTip = GetText(\"DeleteRazorFunction.ToolTip\"),\r\n                            Icon = DeleteFunctionIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n        }    \r\n\r\n\r\n        private sealed class RazorFunctionTreeBuilderLeafInfo : IFunctionTreeBuilderLeafInfo\r\n        {\r\n            private readonly IFunction _function;\r\n\r\n            public RazorFunctionTreeBuilderLeafInfo(IFunction function)\r\n            {\r\n                _function = function;\r\n            }\r\n\r\n            public string Name\r\n            {\r\n                get { return _function.Name; }\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get { return _function.Namespace; }\r\n            }\r\n\r\n            public EntityToken EntityToken\r\n            {\r\n                get { return _function.EntityToken; }\r\n            }\r\n        }\r\n\r\n        #region Configuration\r\n\r\n        internal sealed class RazorFunctionElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n        {\r\n            [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n            public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n            {\r\n                var data = (RazorFunctionProviderElementProviderData)objectConfiguration;\r\n\r\n                return new RazorFunctionElementProvider(data.RazorFunctionProviderName, data.Label);\r\n            }\r\n        }\r\n\r\n        [Assembler(typeof(RazorFunctionElementProviderAssembler))]\r\n        internal sealed class RazorFunctionProviderElementProviderData : HooklessElementProviderData\r\n        {\r\n            private const string _razorFunctionProviderNameProperty = \"razorFunctionProviderName\";\r\n            [ConfigurationProperty(_razorFunctionProviderNameProperty, IsRequired = true)]\r\n            public string RazorFunctionProviderName\r\n            {\r\n                get { return (string)base[_razorFunctionProviderNameProperty]; }\r\n                set { base[_razorFunctionProviderNameProperty] = value; }\r\n            }\r\n\r\n            private const string _labelProperty = \"label\";\r\n            [ConfigurationProperty(_labelProperty, DefaultValue = null)]\r\n            public string Label\r\n            {\r\n                get { return (string)base[_labelProperty]; }\r\n                set { base[_labelProperty] = value; }\r\n            }\r\n        }\r\n\r\n        #endregion Configuration\r\n\r\n        protected override string RootFolderLabel\r\n        {\r\n            get { return !string.IsNullOrEmpty(_rootLabel) \r\n                        ? StringResourceSystemFacade.ParseString(_rootLabel) \r\n                        : GetText(\"RootElement.Label\"); }\r\n        }\r\n\r\n        protected override string RootFolderToolTip\r\n        {\r\n            get { return GetText(\"RootElement.ToolTip\"); }\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorFunction\", stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/SqlFunctionProviderElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing Composite.Core.Collections;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Cryptography;\r\nusing Composite.C1Console.Workflow;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(SqlFunctionElementProviderData))]\r\n    internal sealed class SqlFunctionElementProvider : IHooklessElementProvider, IDataExchangingElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n\r\n        private ResourceHandle FolderIcon { get { return CommonElementIcons.Folder; } }\r\n        private ResourceHandle OpenFolderIcon { get { return CommonElementIcons.FolderOpen; } }\r\n        private ResourceHandle EmptyFolderIcon { get { return CommonElementIcons.Folder; } }\r\n        private ResourceHandle XmlQueryInfoIcon { get { return CommonElementIcons.MimeTextXml; } }\r\n\r\n        public static ResourceHandle Function { get { return GetIconHandle(\"sql-based-function\"); } }\r\n        public static ResourceHandle Connection { get { return GetIconHandle(\"sql-based-connection\"); } }\r\n        public static ResourceHandle AddConnection { get { return GetIconHandle(\"sql-based-connection-add\"); } }\r\n        public static ResourceHandle DeleteConnection { get { return GetIconHandle(\"sql-based-connection-delete\"); } }\r\n        public static ResourceHandle EditConnection { get { return GetIconHandle(\"sql-based-connection-edit\"); } }\r\n        public static ResourceHandle AddFunction { get { return GetIconHandle(\"sql-based-function-add\"); } }\r\n        public static ResourceHandle EditFunction { get { return GetIconHandle(\"sql-based-function-edit\"); } }\r\n        public static ResourceHandle DeleteFunction { get { return GetIconHandle(\"sql-based-function-delete\"); } }\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n\r\n\r\n        public SqlFunctionElementProvider()\r\n        {            \r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        #region Element methods\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            var connections = DataFacade.GetData<ISqlConnection>();\r\n\r\n            List<Element> elements = new List<Element>();\r\n            bool hasChildren = connections.Any();\r\n\r\n            Element element = new Element(_context.CreateElementHandle(new SqlFunctionProviderRootEntityToken(_context.ProviderName, _context.ProviderName)))\r\n            {\r\n                VisualData = new ElementVisualizedData()\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.RootLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.RootLabelToolTip\"),\r\n                        HasChildren = hasChildren,\r\n                        Icon = hasChildren ? this.FolderIcon : this.EmptyFolderIcon,\r\n                        OpenedIcon = OpenFolderIcon\r\n                    }\r\n            };\r\n\r\n            element.AddAction(\r\n                new ElementAction(new ActionHandle(\r\n                    new WorkflowActionToken(\r\n                        WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider.AddNewSqlConnectionWorkflow\"),\r\n                        new PermissionType[] { PermissionType.Add }\r\n                    )))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                                 {\r\n                                     Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.AddConnection\"),\r\n                                     ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.AddConnectionToolTip\"),\r\n                                     Icon = AddConnection,\r\n                                     Disabled = false,\r\n                                     ActionLocation = new ActionLocation\r\n                                      {\r\n                                          ActionType = ActionType.Add,\r\n                                          IsInFolder = false,\r\n                                          IsInToolbar = true,\r\n                                          ActionGroup = PrimaryActionGroup\r\n                                      }\r\n                                 }\r\n                });\r\n\r\n            elements.Add(element);\r\n\r\n            return elements;\r\n\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            if ((entityToken is SqlFunctionProviderRootEntityToken))\r\n            {\r\n                return GetConnectionElements();\r\n            }\r\n            else\r\n            {\r\n                return GetFunctionElements(entityToken, searchToken);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private List<Element> GetConnectionElements()\r\n        {\r\n            var connections = DataFacade.GetData<ISqlConnection>();\r\n            var queries = DataFacade.GetData<ISqlFunctionInfo>();\r\n\r\n            List<Element> elements = new List<Element>();\r\n            foreach (ISqlConnection connection in connections)\r\n            {\r\n                int queryCount = queries.Where(x => x.ConnectionId == connection.Id).Count();\r\n                bool hasChildren = queryCount > 0;\r\n\r\n                Element element = new Element(_context.CreateElementHandle(connection.GetDataEntityToken()))\r\n                {\r\n                    VisualData = new ElementVisualizedData()\r\n                    {\r\n                        Label = connection.Name,\r\n                        ToolTip = connection.EncryptedConnectionString.Decrypt(),\r\n                        HasChildren = hasChildren,\r\n                        Icon = SqlFunctionElementProvider.Connection,\r\n                        OpenedIcon = SqlFunctionElementProvider.Connection\r\n                    }\r\n                };\r\n                elements.Add(element);\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider.EditSqlConnectionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Edit }\r\n                        )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.EditConnection\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.EditConnectionToolTip\"),\r\n                            Icon = EditConnection,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider.DeleteSqlConnectionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Delete }\r\n                        )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.DeleteConnection\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.DeleteConnectionToolTip\"),\r\n                            Icon = DeleteConnection,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n                element.AddAction(\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider.AddNewSqlFunctionProviderWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Add }\r\n                        )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.AddQuery\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.AddQueryToolTip\"),\r\n                            Icon = AddConnection,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    });\r\n\r\n            }\r\n\r\n            return elements;\r\n        }\r\n\r\n\r\n\r\n        private List<Element> GetFunctionElements(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            Guid connectionId;\r\n            string namespaceName;\r\n            if ((entityToken is DataEntityToken))\r\n            {\r\n                DataEntityToken dataEntityToken = (DataEntityToken)entityToken;\r\n\r\n                if (dataEntityToken.Data is ISqlConnection)\r\n                {\r\n                    connectionId = ((ISqlConnection)dataEntityToken.Data).Id;\r\n                    namespaceName = \"\";\r\n                }\r\n                else\r\n                {\r\n                    // stuff has been deleted and we are refreshed on a dead function folder\r\n                    return new List<Element>();\r\n                }\r\n            }\r\n            else if ((entityToken is SqlFunctionProviderFolderEntityToken))\r\n            {\r\n                SqlFunctionProviderFolderEntityToken sqlFunctionProviderFolderEntityToken = (SqlFunctionProviderFolderEntityToken)entityToken;\r\n\r\n                connectionId = new Guid(sqlFunctionProviderFolderEntityToken.ConnectionId);\r\n                namespaceName = sqlFunctionProviderFolderEntityToken.Id;\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n\r\n            IEnumerable<ISqlFunctionInfo> sqlFunctionInfoes;\r\n            if (searchToken.IsValidKeyword() == false)\r\n            {\r\n                sqlFunctionInfoes =\r\n                    from item in DataFacade.GetData<ISqlFunctionInfo>()\r\n                    where item.ConnectionId == connectionId\r\n                    select item;\r\n\r\n            }\r\n            else\r\n            {\r\n                string keyword = searchToken.Keyword.ToLower();\r\n\r\n                sqlFunctionInfoes =\r\n                    from item in DataFacade.GetData<ISqlFunctionInfo>()\r\n                    where item.ConnectionId == connectionId &&\r\n                          (((item.Name != null) && (item.Name.ToLower().Contains(keyword))) ||\r\n                           ((item.Namespace != null) && (item.Namespace.ToLower().Contains(keyword))) ||\r\n                           ((item.Command != null) && (item.Command.ToLower().Contains(keyword))))\r\n                    select item;\r\n            }\r\n\r\n            NamespaceTreeBuilder builder = new NamespaceTreeBuilder(sqlFunctionInfoes.Select(q => (INamespaceTreeBuilderLeafInfo)new SqlNamespaceTreeBuilderLeafInfo(q)));\r\n\r\n            NamespaceTreeBuilderFolder folderNode;\r\n            if (namespaceName == \"\")\r\n            {\r\n                folderNode = builder.RootFolder;\r\n            }\r\n            else\r\n            {\r\n                folderNode = builder.GetFolder(namespaceName);\r\n            }\r\n\r\n            List<Element> result = new List<Element>();\r\n\r\n            if (folderNode != null)\r\n            {\r\n                if (folderNode.SubFolders != null)\r\n                {\r\n                    foreach (NamespaceTreeBuilderFolder node in folderNode.SubFolders)\r\n                    {\r\n                        Element element = CreateFolderElement(node, connectionId.ToString());\r\n\r\n                        result.Add(element);\r\n                    }\r\n                }\r\n\r\n                if (folderNode.Leafs != null)\r\n                {\r\n                    foreach (INamespaceTreeBuilderLeafInfo leafInfo in folderNode.Leafs)\r\n                    {\r\n                        Element element = CreateXmlFunctionInfoElement(leafInfo, connectionId.ToString());\r\n\r\n                        result.Add(element);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private Element CreateFolderElement(NamespaceTreeBuilderFolder node, string connectionId)\r\n        {\r\n            bool hasChildren = (node.SubFolders.Count != 0) || (node.Leafs.Count != 0);\r\n\r\n            var element = new Element(_context.CreateElementHandle(new SqlFunctionProviderFolderEntityToken(StringExtensionMethods.CreateNamespace(node.Namespace, node.Name, '.'), _context.ProviderName, connectionId)))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = node.Name,\r\n                    ToolTip = node.Name,\r\n                    HasChildren = (node.SubFolders.Count != 0) || (node.Leafs.Count != 0),\r\n                    Icon = hasChildren ? this.FolderIcon : this.EmptyFolderIcon,\r\n                    OpenedIcon = this.OpenFolderIcon\r\n                }\r\n            };\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(\r\n                new WorkflowActionToken(\r\n                    WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider.AddNewSqlFunctionProviderWorkflow\"),\r\n                    new PermissionType[] { PermissionType.Add }\r\n                )))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.AddQuery\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.AddQueryToolTip\"),\r\n                    Icon = SqlFunctionElementProvider.AddFunction,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        private Element CreateXmlFunctionInfoElement(INamespaceTreeBuilderLeafInfo leafInfo, string connectionId)\r\n        {\r\n            var element = new Element(_context.CreateElementHandle(((SqlNamespaceTreeBuilderLeafInfo)leafInfo).EntityToken))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = leafInfo.Name,\r\n                    ToolTip = leafInfo.Name,\r\n                    HasChildren = false,\r\n                    Icon = SqlFunctionElementProvider.Function\r\n                }\r\n            };\r\n\r\n            element.AddAction(\r\n                new ElementAction(new ActionHandle(\r\n                    new WorkflowActionToken(\r\n                        WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider.EditSqlFunctionProviderWorkflow\"),\r\n                        new PermissionType[] { PermissionType.Edit }\r\n                    )))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.EditQuery\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.EditQueryToolTip\"),\r\n                        Icon = SqlFunctionElementProvider.EditFunction,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n            element.AddAction(\r\n                new ElementAction(new ActionHandle(\r\n                    new WorkflowActionToken(\r\n                        WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider.DeleteSqlFunctionProviderWorkflow\"),\r\n                        new PermissionType[] { PermissionType.Delete }\r\n                    )))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.DeleteQuery\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"SqlFunctionElementProvider.DeleteQueryToolTip\"),\r\n                        Icon = SqlFunctionElementProvider.DeleteFunction,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n            return element;\r\n        }\r\n        #endregion\r\n\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            var result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                var dataEntityToken = entityToken as DataEntityToken;\r\n\r\n                if (dataEntityToken.InterfaceType == typeof(ISqlFunctionInfo))\r\n                {\r\n                    ISqlFunctionInfo sqlFunctionInfo = dataEntityToken.Data as ISqlFunctionInfo;\r\n                    \r\n                    var parentEntityToken = new SqlFunctionProviderFolderEntityToken(sqlFunctionInfo.Namespace, _context.ProviderName, sqlFunctionInfo.ConnectionId.ToString());\r\n\r\n                    result.Add(entityToken, new EntityToken[] { parentEntityToken });\r\n                }\r\n                else if (dataEntityToken.InterfaceType == typeof(ISqlConnection))\r\n                {\r\n                    var parentEntityToken = new SqlFunctionProviderRootEntityToken(_context.ProviderName, _context.ProviderName);\r\n\r\n                    result.Add(entityToken, new EntityToken[] { parentEntityToken });\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n   \r\n\r\n\r\n        public object GetData(string name)\r\n        {\r\n            Guid connectionId = new Guid(name);\r\n\r\n            IEnumerable<ISqlFunctionInfo> sqlFunctionInfoes =\r\n                    from functionInfo in DataFacade.GetData<ISqlFunctionInfo>()\r\n                    where functionInfo.ConnectionId == connectionId\r\n                    select functionInfo;\r\n\r\n            return new NamespaceTreeBuilder(sqlFunctionInfoes.Select(q => (INamespaceTreeBuilderLeafInfo)new SqlNamespaceTreeBuilderLeafInfo(q)));\r\n        }\r\n\r\n\r\n\r\n\r\n        [DebuggerDisplay(\"Name = {Name}, Namespace = {Namespace}\")]\r\n        private sealed class SqlNamespaceTreeBuilderLeafInfo : INamespaceTreeBuilderLeafInfo\r\n        {\r\n            readonly ISqlFunctionInfo _sqlFunctionInfo;\r\n\r\n            public SqlNamespaceTreeBuilderLeafInfo(ISqlFunctionInfo sqlFunctionInfo)\r\n            {\r\n                _sqlFunctionInfo = sqlFunctionInfo;\r\n            }\r\n\r\n            public string Name\r\n            {\r\n                get { return _sqlFunctionInfo.Name; }\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get { return _sqlFunctionInfo.Namespace; }\r\n            }\r\n\r\n\r\n            public EntityToken EntityToken\r\n            {\r\n                get { return _sqlFunctionInfo.GetDataEntityToken(); }\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(SqlFunctionElementProviderAssembler))]\r\n    internal sealed class SqlFunctionElementProviderData : HooklessElementProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    internal sealed class SqlFunctionElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new SqlFunctionElementProvider();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/SqlFunctionProviderEntityTokenSecurityAncestorProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.Collections;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.Extensions;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    internal sealed class SqlFunctionProviderEntityTokenSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            if ((entityToken is SqlFunctionProviderRootEntityToken))\r\n            {\r\n                return new EntityToken[] { };\r\n            }\r\n            else if ((entityToken is SqlFunctionProviderFolderEntityToken))\r\n            {\r\n                SqlFunctionProviderFolderEntityToken token = entityToken as SqlFunctionProviderFolderEntityToken;\r\n\r\n                NamespaceTreeBuilder builder = (NamespaceTreeBuilder)ElementFacade.GetData(new ElementProviderHandle(token.Source), token.ConnectionId);\r\n\r\n                NamespaceTreeBuilderFolder folder = builder.FindFolder(f => StringExtensionMethods.CreateNamespace(f.Namespace, f.Name, '.') == token.Id);\r\n\r\n                if (folder == null)\r\n                {\r\n                    return null;\r\n                }\r\n                else\r\n                {\r\n                    int idx = token.Id.LastIndexOf('.');\r\n                    if (idx != -1)\r\n                    {\r\n                        return new EntityToken[] { new SqlFunctionProviderFolderEntityToken(token.Id.Remove(idx), token.Source, token.ConnectionId) };\r\n                    }\r\n                    else\r\n                    {\r\n                        Guid id = new Guid(token.ConnectionId);\r\n                        ISqlConnection sqlConnection = DataFacade.GetData<ISqlConnection>(f => f.Id == id).SingleOrDefault();\r\n\r\n                        if (sqlConnection == null)\r\n                        {\r\n                            return new EntityToken[] { };\r\n                        }\r\n\r\n                        return new EntityToken[] { sqlConnection.GetDataEntityToken() };\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/SqlFunctionProviderFolderEntityToken.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(SqlFunctionProviderEntityTokenSecurityAncestorProvider))]\r\n    public sealed class SqlFunctionProviderFolderEntityToken : EntityToken\r\n\t{\r\n        private string _id;\r\n        private string _source;\r\n        private string _connectionId;\r\n\r\n        internal SqlFunctionProviderFolderEntityToken(string id, string source, string connectionId)\r\n        {\r\n            _id = id;\r\n            _source = source;\r\n            _connectionId = connectionId;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ConnectionId\r\n        {\r\n            get { return _connectionId; }\r\n\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            StringBuilder builder = new StringBuilder();\r\n\r\n            StringConversionServices.SerializeKeyValuePair<string>(builder, \"id\", _id);\r\n            StringConversionServices.SerializeKeyValuePair<string>(builder, \"source\", _source);\r\n            StringConversionServices.SerializeKeyValuePair<string>(builder, \"connectionId\", _connectionId);\r\n\r\n            return builder.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            IDictionary<string, string> result = StringConversionServices.ParseKeyValueCollection(serializedData);\r\n\r\n            string id = StringConversionServices.DeserializeValueString(result[\"id\"]);\r\n            string source = StringConversionServices.DeserializeValueString(result[\"source\"]);\r\n            string connectionId = StringConversionServices.DeserializeValueString(result[\"connectionId\"]);\r\n\r\n            return new SqlFunctionProviderFolderEntityToken(id, source, connectionId);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return base.Equals(obj)\r\n                   && (obj as SqlFunctionProviderFolderEntityToken).ConnectionId == this.ConnectionId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            if (this.HashCode == 0)\r\n            {\r\n                this.HashCode = GetType().GetHashCode() ^ this.Type.GetHashCode() ^ this.Source.GetHashCode() ^ this.Id.GetHashCode() ^ this.ConnectionId.GetHashCode();\r\n            }\r\n            return this.HashCode;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/SqlFunctionProviderRootEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Serialization;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    [SecurityAncestorProvider(typeof(SqlFunctionProviderEntityTokenSecurityAncestorProvider))]\r\n    internal sealed class SqlFunctionProviderRootEntityToken : EntityToken\r\n    {\r\n        private string _id;\r\n        private string _source;\r\n\r\n        internal SqlFunctionProviderRootEntityToken(string id, string source)\r\n        {\r\n            _id = id;\r\n            _source = source;\r\n        }\r\n\r\n\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n        public override string Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            string type, source, id;\r\n\r\n            EntityToken.DoDeserialize(serializedData, out type, out source, out id);\r\n\r\n            return new SqlFunctionProviderRootEntityToken(id, source);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserControlFunctionElementProvider/UserControlFunctionElementProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.Linq;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_UserControlFunction;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserControlFunctionElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(UserControlFunctionProviderElementProviderData))]\r\n    internal class UserControlFunctionElementProvider : BaseFunctionProviderElementProvider.BaseFunctionProviderElementProvider\r\n    {\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        protected static ResourceHandle AddFunctionIcon { get { return GetIconHandle(\"usercontrol-function-add\"); } }\r\n        protected static ResourceHandle EditFunctionIcon { get { return GetIconHandle(\"usercontrol-function-edit\"); } }\r\n        protected static ResourceHandle DeleteFunctionIcon { get { return GetIconHandle(\"usercontrol-function-delete\"); } }\r\n\r\n        private readonly string _functionProviderName;\r\n        private readonly string _rootLabel;\r\n\r\n        public UserControlFunctionElementProvider(string functionProvider, string rootLabel)\r\n        {\r\n            _functionProviderName = functionProvider;\r\n            _rootLabel = rootLabel;\r\n        }\r\n\r\n        public override string FunctionProviderName\r\n        {\r\n            get { return _functionProviderName; }\r\n        }\r\n\r\n        protected override IEnumerable<IFunctionTreeBuilderLeafInfo> OnGetFunctionInfos(SearchToken searchToken)\r\n        {\r\n            var functions = FunctionFacade.GetFunctionsByProvider(_functionProviderName);\r\n\r\n            if (searchToken != null && !String.IsNullOrEmpty(searchToken.Keyword))\r\n            {\r\n                string keyword = searchToken.Keyword.ToLowerInvariant();\r\n\r\n                functions = functions.Where(f => f.Namespace.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) > 0\r\n                                                 || f.Name.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) > 0);\r\n            }\r\n\r\n            return functions.Select(f => new UserControlFunctionTreeBuilderLeafInfo(f));\r\n        }\r\n\r\n        protected override IEnumerable<Type> OnGetEntityTokenTypes()\r\n        {\r\n            return new[] { typeof(FileBasedFunctionEntityToken) };\r\n        }\r\n\r\n        protected override IFunctionTreeBuilderLeafInfo OnIsEntityOwner(EntityToken entityToken)\r\n        {\r\n            if (entityToken is FileBasedFunctionEntityToken && entityToken.Source == _functionProviderName)\r\n            {\r\n                string functionFullName = entityToken.Id;\r\n\r\n                IFunction function = FunctionFacade.GetFunctionsByProvider(_functionProviderName)\r\n                        .FirstOrDefault(func => func.Namespace + \".\" + func.Name == functionFullName);\r\n\r\n                return function == null ? null : new UserControlFunctionTreeBuilderLeafInfo(function);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private sealed class UserControlFunctionTreeBuilderLeafInfo : IFunctionTreeBuilderLeafInfo\r\n        {\r\n            private readonly IFunction _function;\r\n\r\n            public UserControlFunctionTreeBuilderLeafInfo(IFunction function)\r\n            {\r\n                _function = function;\r\n            }\r\n\r\n            public string Name\r\n            {\r\n                get { return _function.Name; }\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get { return _function.Namespace; }\r\n            }\r\n\r\n            public EntityToken EntityToken\r\n            {\r\n                get { return _function.EntityToken; }\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<ElementAction> OnGetFolderActions()\r\n        {\r\n            Type workflow = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider.AddNewUserControlFunctionWorkflow\");\r\n\r\n            return new [] { new ElementAction(new ActionHandle(new WorkflowActionToken(workflow, new [] { PermissionType.Add }))) {\r\n                         VisualData = new ActionVisualizedData { \r\n                            Label = Texts.AddNewUserControlFunction_Label, \r\n                            ToolTip = Texts.AddNewUserControlFunction_ToolTip,\r\n                            Icon = AddFunctionIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<ElementAction> OnGetFunctionActions(IFunctionTreeBuilderLeafInfo function)\r\n        {\r\n            var editWorkflow = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider.EditUserControlFunctionWorkflow\");\r\n            var deleteWorkflow = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider.DeleteUserControlFunctionWorkflow\");\r\n\r\n            return new ElementAction[] \r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            editWorkflow, new [] { PermissionType.Edit }\r\n                        ))) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = Texts.EditUserControlFunction_Label, \r\n                            ToolTip = Texts.EditUserControlFunction_ToolTip,\r\n                            Icon = EditFunctionIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    },\r\n\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            deleteWorkflow, new [] { PermissionType.Delete }\r\n                        ){Payload = GetContext().ProviderName})) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = Texts.DeleteUserControlFunction_Label, \r\n                            ToolTip = Texts.DeleteUserControlFunction_ToolTip,\r\n                            Icon = DeleteFunctionIcon,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n        }        \r\n\r\n\r\n        #region Configuration\r\n\r\n        internal sealed class UserControlFunctionElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n        {\r\n            [SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n            public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n            {\r\n                var data = (UserControlFunctionProviderElementProviderData)objectConfiguration;\r\n\r\n                return new UserControlFunctionElementProvider(data.UserControlFunctionProviderName, data.Label);\r\n            }\r\n        }\r\n\r\n        [Assembler(typeof(UserControlFunctionElementProviderAssembler))]\r\n        internal sealed class UserControlFunctionProviderElementProviderData : HooklessElementProviderData\r\n        {\r\n            private const string _UserControlFunctionProviderNameProperty = \"userControlFunctionProviderName\";\r\n            [ConfigurationProperty(_UserControlFunctionProviderNameProperty, IsRequired = true)]\r\n            public string UserControlFunctionProviderName\r\n            {\r\n                get { return (string)base[_UserControlFunctionProviderNameProperty]; }\r\n                set { base[_UserControlFunctionProviderNameProperty] = value; }\r\n            }\r\n\r\n            private const string _labelProperty = \"label\";\r\n            [ConfigurationProperty(_labelProperty, DefaultValue = null)]\r\n            public string Label\r\n            {\r\n                get { return (string)base[_labelProperty]; }\r\n                set { base[_labelProperty] = value; }\r\n            }\r\n        }\r\n\r\n        #endregion Configuration\r\n\r\n        protected override string RootFolderLabel\r\n        {\r\n            get\r\n            {\r\n                return !string.IsNullOrEmpty(_rootLabel)\r\n                        ? StringResourceSystemFacade.ParseString(_rootLabel)\r\n                        : Texts.RootElement_Label;\r\n            }\r\n        }\r\n\r\n        protected override string RootFolderToolTip\r\n        {\r\n            get { return Texts.RootElement_ToolTip; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserElementProvider/ActiveLocalesFormsHelper.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class ActiveLocalesFormsHelper\r\n\t{\r\n        private List<XElement> _bindingElements = null;\r\n        private XElement _fieldGroupElement = null;\r\n\r\n        private static readonly string MultiKeySelectorOptionsBindingName = \"ActiveLocalesFormsHelper_Options\";\r\n        private static readonly string MultiKeySelectorSelectedBindingName = \"ActiveLocalesFormsHelper_Selected\";\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ActiveLocalesFormsHelper(string fieldLabel, string multiSelectLabel, string multiSelectHelp)\r\n        {\r\n            this.FieldLabel = fieldLabel;\r\n            this.MultiSelectLabel = multiSelectLabel;\r\n            this.MultiSelectHelp = multiSelectHelp;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateWithNewBindings(Dictionary<string, object> bindings, IEnumerable<CultureInfo> userActiveLocales)\r\n        {\r\n            Dictionary<string, string> options = new Dictionary<string, string>();\r\n            foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n            {\r\n                options.Add(\r\n                    cultureInfo.Name,\r\n                    DataLocalizationFacade.GetCultureTitle(cultureInfo)\r\n                );\r\n            }\r\n\r\n            if (bindings.ContainsKey(MultiKeySelectorOptionsBindingName) == false)\r\n            {\r\n                bindings.Add(MultiKeySelectorOptionsBindingName, options);\r\n            }\r\n            else\r\n            {\r\n                bindings[MultiKeySelectorOptionsBindingName] = options;\r\n            }\r\n\r\n            if (bindings.ContainsKey(MultiKeySelectorSelectedBindingName) == false)\r\n            {\r\n                bindings.Add(MultiKeySelectorSelectedBindingName, userActiveLocales.Select(f => f.Name).ToList());\r\n            }\r\n            else\r\n            {\r\n                bindings[MultiKeySelectorSelectedBindingName] = userActiveLocales.Select(f => f.Name).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetFieldBindingPath()\r\n        {\r\n            return MultiKeySelectorSelectedBindingName;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<CultureInfo> GetSelectedLocalesTypes(Dictionary<string, object> bindings)\r\n        {\r\n            List<string> cultureNames = (List<string>)bindings[MultiKeySelectorSelectedBindingName];\r\n\r\n            foreach (string cultureName in cultureNames)\r\n            {\r\n                yield return CultureInfo.CreateSpecificCulture(cultureName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<XElement> GetBindingsMarkup()\r\n        {\r\n            if (_bindingElements == null)\r\n            {\r\n                CreateMarkup();\r\n            }\r\n\r\n            return _bindingElements;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement GetFormMarkup()\r\n        {\r\n            if (_fieldGroupElement == null)\r\n            {\r\n                CreateMarkup();\r\n            }\r\n\r\n            return _fieldGroupElement;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FieldLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MultiSelectLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MultiSelectHelp\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        private void CreateMarkup()\r\n        {\r\n            _bindingElements = new List<XElement>();\r\n\r\n            _bindingElements.Add(\r\n                new XElement(\r\n                    Namespaces.BindingForms10 + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", MultiKeySelectorOptionsBindingName),\r\n                    new XAttribute(\"type\", typeof(Dictionary<string, string>))\r\n                ));\r\n\r\n            _bindingElements.Add(\r\n                new XElement(\r\n                    Namespaces.BindingForms10 + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", MultiKeySelectorSelectedBindingName),\r\n                    new XAttribute(\"type\", typeof(List<string>))\r\n                ));\r\n\r\n\r\n\r\n            _fieldGroupElement = new XElement(\r\n                    Namespaces.BindingFormsStdUiControls10 + \"FieldGroup\",\r\n                    new XAttribute(\"Label\", this.FieldLabel));\r\n\r\n            XElement multiKeySelectorElement = new XElement(\r\n                    Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector\",\r\n                    new XAttribute(\"Label\", this.MultiSelectLabel),\r\n                    new XAttribute(\"Help\", this.MultiSelectHelp),\r\n                    new XAttribute(\"OptionsKeyField\", \"Key\"),\r\n                    new XAttribute(\"OptionsLabelField\", \"Value\"),\r\n                    new XElement(Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector.Options\",\r\n                        new XElement(Namespaces.BindingForms10 + \"read\",\r\n                            new XAttribute(\"source\", MultiKeySelectorOptionsBindingName)\r\n                        )\r\n                    ),\r\n                    new XElement(Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector.Selected\",\r\n                        new XElement(Namespaces.BindingForms10 + \"bind\",\r\n                            new XAttribute(\"source\", MultiKeySelectorSelectedBindingName)\r\n                        )\r\n                    )\r\n                );\r\n\r\n            _fieldGroupElement.Add(multiKeySelectorElement);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserElementProvider/ActivePerspectiveFormsHelper.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class ActivePerspectiveFormsHelper\r\n\t{\r\n        private readonly List<Element> _perspectiveElements;\r\n        private List<XElement> _bindingElements;\r\n        private XElement _fieldGroupElement;\r\n\r\n        private static readonly string MultiKeySelectorOptionsBindingName = \"ActivePerspectiveFormsHelper_Options\";\r\n        private static readonly string MultiKeySelectorSelectedBindingName = \"ActivePerspectiveFormsHelper_Selected\";\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public ActivePerspectiveFormsHelper(string fieldLabel, string multiSelectLabel, string multiSelectHelp)\r\n        {\r\n            this.FieldLabel = fieldLabel;\r\n            this.MultiSelectLabel = multiSelectLabel;\r\n            this.MultiSelectHelp = multiSelectHelp;\r\n\r\n            _perspectiveElements = ElementFacade.GetPerspectiveElementsWithNoSecurity().ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateWithNewBindings(Dictionary<string, object> bindings, IEnumerable<string> selectedSerializedEntityTokens)\r\n        {\r\n            var options = _perspectiveElements.ToDictionary(\r\n                perspectiveElement => EntityTokenSerializer.Serialize(perspectiveElement.ElementHandle.EntityToken),\r\n                perspectiveElement => perspectiveElement.VisualData.Label);\r\n\r\n            bindings[MultiKeySelectorOptionsBindingName] = options;\r\n\r\n            bindings[MultiKeySelectorSelectedBindingName] = selectedSerializedEntityTokens.ToList();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<string> GetSelectedSerializedEntityTokens(Dictionary<string, object> bindings)\r\n        {\r\n            return (List<string>)bindings[MultiKeySelectorSelectedBindingName];\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<XElement> GetBindingsMarkup()\r\n        {\r\n            if (_bindingElements == null)\r\n            {\r\n                CreateMarkup();\r\n            }\r\n\r\n            return _bindingElements;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement GetFormMarkup()\r\n        {\r\n            if (_fieldGroupElement == null)\r\n            {\r\n                CreateMarkup();\r\n            }\r\n\r\n            return _fieldGroupElement;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FieldLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MultiSelectLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MultiSelectHelp\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        private void CreateMarkup()\r\n        {\r\n            _bindingElements = new List<XElement>();\r\n\r\n            _bindingElements.Add(\r\n                new XElement(\r\n                    Namespaces.BindingForms10 + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", MultiKeySelectorOptionsBindingName),\r\n                    new XAttribute(\"type\", typeof(Dictionary<string, string>))\r\n                ));\r\n\r\n            _bindingElements.Add(\r\n                new XElement(\r\n                    Namespaces.BindingForms10 + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", MultiKeySelectorSelectedBindingName),\r\n                    new XAttribute(\"type\", typeof(List<string>))\r\n                ));\r\n\r\n\r\n\r\n            _fieldGroupElement = new XElement(\r\n                    Namespaces.BindingFormsStdUiControls10 + \"FieldGroup\",\r\n                    new XAttribute(\"Label\", this.FieldLabel));\r\n\r\n            XElement multiKeySelectorElement = new XElement(\r\n                    Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector\",\r\n                    new XAttribute(\"Label\", this.MultiSelectLabel),\r\n                    new XAttribute(\"Help\", this.MultiSelectHelp),\r\n                    new XAttribute(\"OptionsKeyField\", \"Key\"),\r\n                    new XAttribute(\"OptionsLabelField\", \"Value\"),\r\n                    new XElement(Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector.Options\",\r\n                        new XElement(Namespaces.BindingForms10 + \"read\",\r\n                            new XAttribute(\"source\", MultiKeySelectorOptionsBindingName)\r\n                        )\r\n                    ),\r\n                    new XElement(Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector.Selected\",\r\n                        new XElement(Namespaces.BindingForms10 + \"bind\",\r\n                            new XAttribute(\"source\", MultiKeySelectorSelectedBindingName)\r\n                        )\r\n                    )\r\n                );\r\n\r\n            _fieldGroupElement.Add(multiKeySelectorElement);            \r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserElementProvider/GlobalPermissionsFormsHelper.cs",
    "content": "using System.Linq;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing System;\r\nusing Composite.Core.Xml;\r\nusing Composite.C1Console.Forms;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class GlobalPermissionsFormsHelper\r\n\t{\r\n        private List<XElement> _bindingElements = null;\r\n        private XElement _fieldGroupElement = null;\r\n\r\n        private static readonly string MultiKeySelectorOptionsBindingName = \"GlobalPermissionsFormsHelper_Options\";\r\n        private static readonly string MultiKeySelectorSelectedBindingName = \"GlobalPermissionsFormsHelper_Selected\";\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public GlobalPermissionsFormsHelper(string fieldLabel, string multiSelectLabel, string multiSelectHelp)\r\n        {\r\n            this.FieldLabel = fieldLabel;\r\n            this.MultiSelectLabel = multiSelectLabel;\r\n            this.MultiSelectHelp = multiSelectHelp;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateWithNewBindings(Dictionary<string, object> bindings, IEnumerable<PermissionType> selectedPermissionTypes)\r\n        {\r\n            Dictionary<string, string> options = new Dictionary<string, string>();\r\n            foreach (PermissionDescriptor permissionDescriptor in PermissionTypeFacade.GrantingPermissionDescriptors)\r\n            {\r\n                options.Add(\r\n                    permissionDescriptor.PermissionType.ToString(),\r\n                    permissionDescriptor.Label \r\n                );\r\n            }\r\n\r\n            if (bindings.ContainsKey(MultiKeySelectorOptionsBindingName) == false)\r\n            {\r\n                bindings.Add(MultiKeySelectorOptionsBindingName, options);\r\n            }\r\n            else\r\n            {\r\n                bindings[MultiKeySelectorOptionsBindingName] = options;\r\n            }\r\n\r\n            if (bindings.ContainsKey(MultiKeySelectorSelectedBindingName) == false)\r\n            {\r\n                bindings.Add(MultiKeySelectorSelectedBindingName, selectedPermissionTypes.Where(f => f != PermissionType.ClearPermissions).Select(f => f.ToString()).ToList());\r\n            }\r\n            else\r\n            {\r\n                bindings[MultiKeySelectorSelectedBindingName] = selectedPermissionTypes.Where(f => f != PermissionType.ClearPermissions).Select(f => f.ToString()).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string GetFieldBindingPath()\r\n        {\r\n            return MultiKeySelectorSelectedBindingName;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<PermissionType> GetSelectedPermissionTypes(Dictionary<string, object> bindings)\r\n        {\r\n            List<string> serializedPermissionTypes = (List<string>)bindings[MultiKeySelectorSelectedBindingName];\r\n\r\n            foreach (string serializedPermissionType in serializedPermissionTypes)\r\n            {\r\n                yield return (PermissionType)Enum.Parse(typeof(PermissionType), serializedPermissionType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<XElement> GetBindingsMarkup()\r\n        {\r\n            if (_bindingElements == null)\r\n            {\r\n                CreateMarkup();\r\n            }\r\n\r\n            return _bindingElements;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement GetFormMarkup()\r\n        {\r\n            if (_fieldGroupElement == null)\r\n            {\r\n                CreateMarkup();\r\n            }\r\n\r\n            return _fieldGroupElement;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FieldLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MultiSelectLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MultiSelectHelp\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        private void CreateMarkup()\r\n        {\r\n            _bindingElements = new List<XElement>();\r\n\r\n            _bindingElements.Add(\r\n                new XElement(\r\n                    Namespaces.BindingForms10 + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", MultiKeySelectorOptionsBindingName),\r\n                    new XAttribute(\"type\", typeof(Dictionary<string, string>))\r\n                ));\r\n\r\n            _bindingElements.Add(\r\n                new XElement(\r\n                    Namespaces.BindingForms10 + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", MultiKeySelectorSelectedBindingName),\r\n                    new XAttribute(\"type\", typeof(List<string>))\r\n                ));\r\n\r\n\r\n\r\n            _fieldGroupElement = new XElement(\r\n                    Namespaces.BindingFormsStdUiControls10 + \"FieldGroup\",\r\n                    new XAttribute(\"Label\", this.FieldLabel));\r\n\r\n            XElement multiKeySelectorElement = new XElement(\r\n                    Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector\",\r\n                    new XAttribute(\"Label\", this.MultiSelectLabel),\r\n                    new XAttribute(\"Help\", this.MultiSelectHelp),\r\n                    new XAttribute(\"OptionsKeyField\", \"Key\"),\r\n                    new XAttribute(\"OptionsLabelField\", \"Value\"),\r\n                    new XElement(Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector.Options\",\r\n                        new XElement(Namespaces.BindingForms10 + \"read\",\r\n                            new XAttribute(\"source\", MultiKeySelectorOptionsBindingName)\r\n                        )\r\n                    ),\r\n                    new XElement(Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector.Selected\",\r\n                        new XElement(Namespaces.BindingForms10 + \"bind\",\r\n                            new XAttribute(\"source\", MultiKeySelectorSelectedBindingName)\r\n                        )\r\n                    )\r\n                );\r\n\r\n            _fieldGroupElement.Add(multiKeySelectorElement);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserElementProvider/UserElementProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Plugins.Security.LoginProviderPlugins.DataBasedFormLoginProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    internal sealed class UserElementProvider : IHooklessElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _elementProviderContext;\r\n\r\n        public static ResourceHandle RootOpenIcon { get { return GetIconHandle(\"users-rootfolder-open\"); } }\r\n        public static ResourceHandle RootClosedIcon { get { return GetIconHandle(\"users-rootfolder-closed\"); } }\r\n        public static ResourceHandle GroupOpenIcon { get { return GetIconHandle(\"users-group-open\"); } }\r\n        public static ResourceHandle GroupClosedIcon { get { return GetIconHandle(\"users-group-closed\"); } }\r\n        public static ResourceHandle UserIcon { get { return GetIconHandle(\"users-user\"); } }\r\n        public static ResourceHandle LockedUserIcon { get { return GetIconHandle(\"users-user-disabled\"); } }\r\n        public static ResourceHandle AddUserIcon { get { return GetIconHandle(\"users-adduser\"); } }\r\n        public static ResourceHandle EditUserIcon { get { return GetIconHandle(\"users-edituser\"); } }\r\n        public static ResourceHandle DeleteUserIcon { get { return GetIconHandle(\"users-deleteuser\"); } }\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        private static readonly PermissionType[] AddNewUserPermissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n\r\n\r\n        public UserElementProvider()\r\n        {\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _elementProviderContext = value; }\r\n        }\r\n\r\n        private class UserInfo\r\n        {\r\n            public IUser User { get; set; }\r\n            public IUserFormLogin UserFormLogin { get; set; }\r\n        }\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            int userCount =\r\n                (from user in DataFacade.GetData<IUser>()\r\n                 select user).Count();\r\n\r\n            Element element = new Element(_elementProviderContext.CreateElementHandle(new UserElementProviderEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.RootLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.RootToolTip\"),\r\n                    HasChildren = userCount > 0,\r\n                    Icon = UserElementProvider.RootClosedIcon,\r\n                    OpenedIcon = UserElementProvider.RootOpenIcon\r\n                }\r\n            };\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserElementProvider.AddNewUserWorkflow\"), AddNewUserPermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.AddUserLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.AddUserToolTip\"),\r\n                    Icon = UserElementProvider.AddUserIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            yield return element;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            if (entityToken is UserElementProviderEntityToken)\r\n            {\r\n                return GetGroupChildrenElements(seachToken);\r\n            }\r\n            if (entityToken is UserElementProviderGroupEntityToken)\r\n            {\r\n                return GetUsersChildrenElements(entityToken.Id, seachToken);\r\n            }\r\n            return new Element[] { };\r\n        }\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            var result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                var dataEntityToken = entityToken as DataEntityToken;\r\n\r\n                Type type = dataEntityToken.InterfaceType;\r\n                if (type != typeof(IUser)) continue;\r\n\r\n                IUser user = dataEntityToken.Data as IUser;\r\n                IUserFormLogin userFormLogin = user.GetUserFormLogin();\r\n\r\n                var newEntityToken = new UserElementProviderGroupEntityToken(userFormLogin.Folder);\r\n\r\n                result.Add(entityToken, new EntityToken[] { newEntityToken });\r\n            }\r\n\r\n            return result;\r\n        }        \r\n\r\n\r\n\r\n        private IEnumerable<Element> GetGroupChildrenElements(SearchToken seachToken)\r\n        {\r\n            IEnumerable<string> groups;\r\n\r\n            if (!seachToken.IsValidKeyword())\r\n            {\r\n                groups =\r\n                    (from user in DataFacade.GetData<IUserFormLogin>()\r\n                     orderby user.Folder\r\n                     select user.Folder).Distinct().ToList();\r\n            }\r\n            else\r\n            {\r\n                string keyword = seachToken.Keyword.ToLowerInvariant();\r\n\r\n                groups =\r\n                    (from userFormLogin in DataFacade.GetData<IUserFormLogin>().ToList()\r\n                     join user in DataFacade.GetData<IUser>().ToList() on userFormLogin.UserId equals user.Id\r\n                     where user.Username.ToLowerInvariant().Contains(keyword)\r\n                     orderby userFormLogin.Folder\r\n                     select userFormLogin.Folder).Distinct().ToList();\r\n            }\r\n\r\n            var children = new List<Element>();\r\n\r\n            foreach (string group in groups)\r\n            {\r\n                var element = new Element(_elementProviderContext.CreateElementHandle(new UserElementProviderGroupEntityToken(group)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = group,\r\n                        ToolTip = group,\r\n                        HasChildren = true,\r\n                        Icon = UserElementProvider.GroupClosedIcon,\r\n                        OpenedIcon = UserElementProvider.GroupOpenIcon\r\n                    }\r\n                };\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserElementProvider.AddNewUserWorkflow\"), AddNewUserPermissionTypes)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.AddUserLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.AddUserToolTip\"),\r\n                        Icon = UserElementProvider.AddUserIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Add,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n                children.Add(element);\r\n            }\r\n\r\n            return children;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetUsersChildrenElements(string folderName, SearchToken seachToken)\r\n        {\r\n            ICollection<UserInfo> users;\r\n\r\n\r\n\r\n            if (!seachToken.IsValidKeyword())\r\n            {\r\n                users =\r\n                    (from userFormLogin in DataFacade.GetData<IUserFormLogin>().ToList()\r\n                     join user in DataFacade.GetData<IUser>().ToList() on userFormLogin.UserId equals user.Id\r\n                     where userFormLogin.Folder == folderName\r\n                     orderby user.Username\r\n                     select new UserInfo { User = user, UserFormLogin = userFormLogin }).ToList();\r\n            }\r\n            else\r\n            {\r\n                string keyword = seachToken.Keyword.ToLowerInvariant();\r\n\r\n                users =\r\n                    (from userFormLogin in DataFacade.GetData<IUserFormLogin>().ToList()\r\n                     join user in DataFacade.GetData<IUser>().ToList() on userFormLogin.UserId equals user.Id\r\n                     where userFormLogin.Folder == folderName &&\r\n                           user.Username.ToLowerInvariant().Contains(keyword)\r\n                     orderby user.Username\r\n                     select new UserInfo { User = user, UserFormLogin = userFormLogin }).ToList();\r\n            }\r\n\r\n            var children = new List<Element>();\r\n\r\n            foreach (var userInfo in users)\r\n            {\r\n                string label = userInfo.User.GetLabel();\r\n\r\n                var element =\r\n                    new Element(_elementProviderContext.CreateElementHandle(userInfo.User.GetDataEntityToken()))\r\n                    {\r\n                        VisualData = new ElementVisualizedData\r\n                        {\r\n                            Label = label,\r\n                            ToolTip = label,\r\n                            HasChildren = false,\r\n                            Icon = !userInfo.UserFormLogin.IsLocked ? UserIcon : LockedUserIcon,\r\n\r\n                        }\r\n                    };\r\n\r\n                // Making \"Edit permissions\" not show up on user elements - it's confusing :)\r\n                element.ElementExternalActionAdding = ElementExternalActionAddingExtensions.Remove(element.ElementExternalActionAdding, ElementExternalActionAdding.AllowManageUserPermissions);\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserElementProvider.EditUserWorkflow\"), new PermissionType[] { PermissionType.Administrate })))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.EditUserLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.EditUserToolTip\"),\r\n                        Icon = UserElementProvider.EditUserIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserElementProvider.DeleteUserWorkflow\"), new PermissionType[] { PermissionType.Administrate })))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.DeleteUserLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UserElementProvider.DeleteUserToolTip\"),\r\n                        Icon = UserElementProvider.DeleteUserIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Delete,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n                children.Add(element);\r\n            }\r\n\r\n            return children;\r\n        }\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class UserElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new UserElementProvider();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserElementProvider/UserElementProviderEntityToken.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n\tinternal sealed class UserElementProviderEntityToken : EntityToken\r\n\t{\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return \"UserElementProviderEntityToken\"; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new UserElementProviderEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserElementProvider/UserElementProviderGroupEntityToken.cs",
    "content": "using Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(UserElementProviderGroupEntityTokenSecurityAncestorProvider))]\r\n    public sealed class UserElementProviderGroupEntityToken : EntityToken\r\n\t{\r\n        private string _id;\r\n\r\n        /// <exclude />\r\n        public UserElementProviderGroupEntityToken(string id)\r\n        {\r\n            _id = id;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return _id;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            return new UserElementProviderGroupEntityToken(serializedData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserElementProvider/UserElementProviderGroupEntityTokenSecurityAncestorProvider.cs",
    "content": "using Composite.C1Console.Security;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    internal sealed class UserElementProviderGroupEntityTokenSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            yield return new UserElementProviderEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserElementProvider/UserGroupsFormsHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class UserGroupsFormsHelper\r\n\t{\r\n        private List<XElement> _bindingElements = null;\r\n        private XElement _fieldGroupElement = null;\r\n\r\n\r\n        private static readonly string MultiKeySelectorOptionsBindingName = \"UserGroupsFormsHelper_Options\";\r\n        private static readonly string MultiKeySelectorSelectedBindingName = \"UserGroupsFormsHelper_Selected\";\r\n\r\n\r\n        /// <exclude />\r\n        public UserGroupsFormsHelper(string fieldLabel, string multiSelectHelp)\r\n        {\r\n            this.FieldLabel = fieldLabel;\r\n            this.MultiSelectHelp = multiSelectHelp;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void UpdateWithNewBindings(Dictionary<string, object> bindings, IEnumerable<Guid> selectedUserGroups)\r\n        {\r\n            Dictionary<Guid, string> options = new Dictionary<Guid, string>();\r\n\r\n            List<IUserGroup> userGroups = DataFacade.GetData<IUserGroup>().OrderBy(f => f.Name).ToList();\r\n\r\n            foreach (IUserGroup userGroup in userGroups)\r\n            {\r\n                options.Add(userGroup.Id, userGroup.Name);\r\n            }\r\n\r\n            if (bindings.ContainsKey(MultiKeySelectorOptionsBindingName) == false)\r\n            {\r\n                bindings.Add(MultiKeySelectorOptionsBindingName, options);\r\n            }\r\n            else\r\n            {\r\n                bindings[MultiKeySelectorOptionsBindingName] = options;\r\n            }\r\n\r\n            if (bindings.ContainsKey(MultiKeySelectorSelectedBindingName) == false)\r\n            {\r\n                bindings.Add(MultiKeySelectorSelectedBindingName, selectedUserGroups.ToList());\r\n            }\r\n            else\r\n            {\r\n                bindings[MultiKeySelectorSelectedBindingName] = selectedUserGroups.ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static List<Guid> GetSelectedUserGroupIds(Dictionary<string, object> bindings)\r\n        {\r\n            return (List<Guid>)bindings[MultiKeySelectorSelectedBindingName];\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<XElement> GetBindingsMarkup()\r\n        {\r\n            if (_bindingElements == null)\r\n            {\r\n                CreateMarkup();\r\n            }\r\n\r\n            return _bindingElements;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public XElement GetFormMarkup()\r\n        {\r\n            if (_fieldGroupElement == null)\r\n            {\r\n                CreateMarkup();\r\n            }\r\n\r\n            return _fieldGroupElement;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string FieldLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MultiSelectLabel\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string MultiSelectHelp\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n\r\n\r\n        private void CreateMarkup()\r\n        {\r\n            _bindingElements = new List<XElement>();\r\n\r\n            _bindingElements.Add(\r\n                new XElement(\r\n                    Namespaces.BindingForms10 + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", MultiKeySelectorOptionsBindingName),\r\n                    new XAttribute(\"type\", typeof(Dictionary<Guid, string>))\r\n                ));\r\n\r\n            _bindingElements.Add(\r\n                new XElement(\r\n                    Namespaces.BindingForms10 + FormKeyTagNames.Binding,\r\n                    new XAttribute(\"name\", MultiKeySelectorSelectedBindingName),\r\n                    new XAttribute(\"type\", typeof(List<Guid>))\r\n                ));\r\n\r\n\r\n\r\n            _fieldGroupElement = new XElement(\r\n                    Namespaces.BindingFormsStdUiControls10 + \"FieldGroup\",\r\n                    new XAttribute(\"Label\", this.FieldLabel));\r\n\r\n            XElement multiKeySelectorElement = new XElement(\r\n                    Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector\",\r\n                    new XAttribute(\"Help\", this.MultiSelectHelp),\r\n                    new XAttribute(\"OptionsKeyField\", \"Key\"),\r\n                    new XAttribute(\"OptionsLabelField\", \"Value\"),\r\n                    new XElement(Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector.Options\",\r\n                        new XElement(Namespaces.BindingForms10 + \"read\",\r\n                            new XAttribute(\"source\", MultiKeySelectorOptionsBindingName)\r\n                        )\r\n                    ),\r\n                    new XElement(Namespaces.BindingFormsStdUiControls10 + \"MultiKeySelector.Selected\",\r\n                        new XElement(Namespaces.BindingForms10 + \"bind\",\r\n                            new XAttribute(\"source\", MultiKeySelectorSelectedBindingName)\r\n                        )\r\n                    )\r\n                );\r\n\r\n            _fieldGroupElement.Add(multiKeySelectorElement);\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserGroupElementProvider/UserGroupElementProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableHooklessElementProvider))]\r\n    internal sealed class UserGroupElementProvider : IHooklessElementProvider, IAuxiliarySecurityAncestorProvider\r\n    {\r\n        private ElementProviderContext _elementProviderContext;\r\n\r\n        public static ResourceHandle RootOpenIcon { get { return GetIconHandle(\"usergroups-rootfolder-open\"); } }\r\n        public static ResourceHandle RootClosedIcon { get { return GetIconHandle(\"usergroups-rootfolder-closed\"); } }\r\n        public static ResourceHandle UserGroupIcon { get { return GetIconHandle(\"usergroups-usergroup\"); } }\r\n        public static ResourceHandle AddUserGroupIcon { get { return GetIconHandle(\"usergroups-addusergroup\"); } }\r\n        public static ResourceHandle EditUserGroupIcon { get { return GetIconHandle(\"usergroups-editusergroup\"); } }\r\n        public static ResourceHandle DeleteUserGroupIcon { get { return GetIconHandle(\"usergroups-deleteusergroup\"); } }\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n        private static readonly PermissionType[] AddNewUserGroupPermissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n        private static readonly PermissionType[] EditUserGroupPermissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n        private static readonly PermissionType[] DeleteUserGroupPermissionTypes = new PermissionType[] { PermissionType.Administrate };\r\n\r\n\r\n        public UserGroupElementProvider()\r\n        {\r\n            AuxiliarySecurityAncestorFacade.AddAuxiliaryAncestorProvider<DataEntityToken>(this);\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set\r\n            {\r\n                _elementProviderContext = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            int userGroupCount = DataFacade.GetData<IUserGroup>().Count();\r\n\r\n            Element element = new Element(_elementProviderContext.CreateElementHandle(new UserGroupElementProviderRootEntityToken()))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"UserGroupElementProvider.RootLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"UserGroupElementProvider.RootToolTip\"),\r\n                    HasChildren = userGroupCount > 0,\r\n                    Icon = UserGroupElementProvider.RootClosedIcon,\r\n                    OpenedIcon = UserGroupElementProvider.RootOpenIcon\r\n                }\r\n            };\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider.AddNewUserGroupWorkflow\"), AddNewUserGroupPermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"UserGroupElementProvider.AddNewUserGroupLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"UserGroupElementProvider.AddNewUserGroupToolTip\"),\r\n                    Icon = UserGroupElementProvider.AddUserGroupIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            yield return element;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            if ((entityToken is UserGroupElementProviderRootEntityToken) == false) return new Element[] { };\r\n\r\n            IEnumerable<IUserGroup> userGroups =\r\n                (from ug in DataFacade.GetData<IUserGroup>()\r\n                 orderby ug.Name\r\n                 select ug).Evaluate();\r\n\r\n            List<Element> elements = new List<Element>();\r\n\r\n            foreach (IUserGroup userGroup in userGroups)\r\n            {\r\n                Element element = new Element(_elementProviderContext.CreateElementHandle(userGroup.GetDataEntityToken()))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = userGroup.Name,\r\n                        ToolTip = userGroup.Name,\r\n                        HasChildren = false,\r\n                        Icon = UserGroupElementProvider.UserGroupIcon,\r\n                        OpenedIcon = UserGroupElementProvider.UserGroupIcon\r\n                    }\r\n                };\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider.EditUserGroupWorkflow\"), EditUserGroupPermissionTypes)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"UserGroupElementProvider.EditUserGroupLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"UserGroupElementProvider.EditUserGroupToolTip\"),\r\n                        Icon = UserGroupElementProvider.EditUserGroupIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Edit,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n                element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider.DeleteUserGroupWorkflow\"), DeleteUserGroupPermissionTypes)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"UserGroupElementProvider.DeleteUserGroupLabel\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"UserGroupElementProvider.DeleteUserGroupToolTip\"),\r\n                        Icon = UserGroupElementProvider.DeleteUserGroupIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Delete,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n                elements.Add(element);\r\n            }\r\n\r\n            return elements;\r\n        }\r\n\r\n\r\n\r\n        public Dictionary<EntityToken, IEnumerable<EntityToken>> GetParents(IEnumerable<EntityToken> entityTokens)\r\n        {\r\n            Dictionary<EntityToken, IEnumerable<EntityToken>> result = new Dictionary<EntityToken, IEnumerable<EntityToken>>();\r\n\r\n            foreach (EntityToken entityToken in entityTokens)\r\n            {\r\n                DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n\r\n                Type type = dataEntityToken.InterfaceType;\r\n                if (type != typeof(IUserGroup)) continue;\r\n\r\n                UserGroupElementProviderRootEntityToken newEntityToken = new UserGroupElementProviderRootEntityToken();\r\n\r\n                result.Add(entityToken, new EntityToken[] { newEntityToken });\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private List<EntityTokenHook> CreateHooks()\r\n        {\r\n            IEnumerable<EntityToken> userGroupsEntityTokens =\r\n                from ug in DataFacade.GetData<IUserGroup>()\r\n                select (EntityToken)ug.GetDataEntityToken();\r\n\r\n            EntityTokenHook hook = new EntityTokenHook(new UserGroupElementProviderRootEntityToken());\r\n            hook.AddHookies(userGroupsEntityTokens);\r\n\r\n            return new List<EntityTokenHook> { hook };\r\n        }\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/UserGroupElementProvider/UserGroupElementProviderRootEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider\r\n{\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    internal sealed class UserGroupElementProviderRootEntityToken : EntityToken\r\n\t{\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return \"UserGroupElementProviderRootEntityToken\"; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            return new UserGroupElementProviderRootEntityToken();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/AttachProviderVirtualElement.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(AttachProviderVirtualElement))]\r\n    internal class AttachProviderVirtualElement : VirtualElementConfigurationElement\r\n    {\r\n        private const string _providerNameProperty = \"providerName\";\r\n        [ConfigurationProperty(_providerNameProperty, IsRequired = true)]\r\n        public string ProviderName\r\n        {\r\n            get { return (string)base[_providerNameProperty]; }\r\n            set { base[_providerNameProperty] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/BaseElementConfigurationElement.cs",
    "content": "using System;\r\nusing System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    [Obsolete(\"Was replaced by VirtualElementConfigurationElement\")]\r\n    internal class BaseElementConfigurationElement : NameTypeConfigurationElement\r\n    {\r\n        private const string _idProperty = \"id\";\r\n        [ConfigurationProperty(_idProperty, IsRequired = true, IsKey = true)]\r\n        public string Id\r\n        {\r\n            get { return (string)base[_idProperty]; }\r\n            set { base[_idProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _orderProperty = \"order\";\r\n        [ConfigurationProperty(_orderProperty, IsRequired = true, IsKey = true)]\r\n        public int Order\r\n        {\r\n            get { return (int)base[_orderProperty]; }\r\n            set { base[_orderProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _parentIdProperty = \"parentId\";\r\n        [ConfigurationProperty(_parentIdProperty)]\r\n        public string ParentId\r\n        {\r\n            get { return (string)base[_parentIdProperty]; }\r\n            set { base[_parentIdProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _labelProperty = \"label\";\r\n        [ConfigurationProperty(_labelProperty, IsRequired = true)]\r\n        public string Label\r\n        {\r\n            get { return (string)base[_labelProperty]; }\r\n            set { base[_labelProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _tagProperty = \"tag\";\r\n        [ConfigurationProperty(_tagProperty, DefaultValue = null)]\r\n        public string Tag\r\n        {\r\n            get { return (string)base[_tagProperty]; }\r\n            set { base[_tagProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _closeFolderIconNameProperty = \"closeFolderIconName\";\r\n        [ConfigurationProperty(_closeFolderIconNameProperty)]\r\n        public string CloseFolderIconName\r\n        {\r\n            get { return (string)base[_closeFolderIconNameProperty]; }\r\n            set { base[_closeFolderIconNameProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _openFolderIconNameProperty = \"openFolderIconName\";\r\n        [ConfigurationProperty(_openFolderIconNameProperty)]\r\n        public string OpenFolderIconName\r\n        {\r\n            get { return (string)base[_openFolderIconNameProperty]; }\r\n            set { base[_openFolderIconNameProperty] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/BaseElementNode.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Diagnostics;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    [DebuggerDisplay(\"Id = {Id}, Label={Label}\")]\r\n    internal class BaseElementNode\r\n    {   \r\n        private List<BaseElementNode> _children = new List<BaseElementNode>();\r\n\r\n\r\n        public string Id { get; set; }\r\n        public string Label { get; set; }\r\n        public string Tag { get; set; }\r\n        public string OpenFolderIconName { get; set; }\r\n        public string CloseFolderIconName { get; set; }\r\n        \r\n        public List<BaseElementNode> Children\r\n        {\r\n            get { return _children; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/FolderElementConfigurationElement.cs",
    "content": "using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing System.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    [Obsolete()]\r\n    [ConfigurationElementType(typeof(FolderElementConfigurationElement))]\r\n    internal sealed class FolderElementConfigurationElement : BaseElementConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/FolderElementNode.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Elements;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    internal sealed class FolderElementNode : BaseElementNode\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/PlaceholderVirtualElement.cs",
    "content": "﻿using System.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\n\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\n{\n    [ConfigurationElementType(typeof(PlaceholderVirtualElement))]\n    internal class PlaceholderVirtualElement : SimpleVirtualElement\n    {\n        private const string _path = \"path\";\n        [ConfigurationProperty(_path)]\n        public string Path\n        {\n            get { return (string)base[_path]; }\n            set { base[_path] = value; }\n        }\n\n\n        private const string _IsTool = \"IsTool\";\n        [ConfigurationProperty(_IsTool)]\n        public string IsTool\n        {\n            get { return (string)base[_IsTool]; }\n            set { base[_IsTool] = value; }\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/ProviderHookingElementConfigurationElement.cs",
    "content": "using System;\r\nusing System.Configuration;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    [Obsolete()]\r\n    [ConfigurationElementType(typeof(ProviderHookingElementConfigurationElement))]\r\n    internal sealed class ProviderHookingElementConfigurationElement : BaseElementConfigurationElement\r\n    {\r\n        private const string _providerNameProperty = \"providerName\";\r\n        [ConfigurationProperty(_providerNameProperty, IsRequired = true)]\r\n        public string ProviderName\r\n        {\r\n            get { return (string)base[_providerNameProperty]; }\r\n            set { base[_providerNameProperty] = value; }\r\n        }\r\n    }\r\n\r\n    /*[ConfigurationElementType(typeof(ProviderHookingElementConfigurationElement))]\r\n    internal sealed class ProviderHookingElementConfigurationElement : BaseElementConfigurationElement\r\n    {                                                \r\n        private const string _providerNameProperty = \"providerName\";\r\n        [ConfigurationProperty(_providerNameProperty, IsRequired = true)]\r\n        public string ProviderName\r\n        {\r\n            get { return (string)base[_providerNameProperty]; }\r\n            set { base[_providerNameProperty] = value; }\r\n        }\r\n    }*/\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/ProviderHookingElementNode.cs",
    "content": "using System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    internal sealed class ProviderHookingElementNode : BaseElementNode\r\n    {\r\n        public ProviderHookingElementNode()\r\n        {\r\n            this.ProviderNames = new List<string>();\r\n        }\r\n        public List<string> ProviderNames { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/SimpleVirtualElement.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(SimpleVirtualElement))]\r\n    internal class SimpleVirtualElement : VirtualElementConfigurationElement\r\n    {\r\n        private const string _labelProperty = \"label\";\r\n        [ConfigurationProperty(_labelProperty, IsRequired = true)]\r\n        public string Label\r\n        {\r\n            get { return (string)base[_labelProperty]; }\r\n            set { base[_labelProperty] = value; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Used by the client js to filter perspective related elements\r\n        /// </summary>\r\n        private const string _tagProperty = \"tag\";\r\n        [ConfigurationProperty(_tagProperty, DefaultValue = null)]\r\n        public string Tag\r\n        {\r\n            get { return (string)base[_tagProperty]; }\r\n            set { base[_tagProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _closeFolderIconNameProperty = \"closeFolderIconName\";\r\n        [ConfigurationProperty(_closeFolderIconNameProperty, DefaultValue = null)]\r\n        public string CloseFolderIconName\r\n        {\r\n            get { return (string)base[_closeFolderIconNameProperty]; }\r\n            set { base[_closeFolderIconNameProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _openFolderIconNameProperty = \"openFolderIconName\";\r\n        [ConfigurationProperty(_openFolderIconNameProperty)]\r\n        public string OpenFolderIconName\r\n        {\r\n            get { return (string)base[_openFolderIconNameProperty]; }\r\n            set { base[_openFolderIconNameProperty] = value; }\r\n        }\r\n\r\n        private const string _elementsProperty = \"Elements\";\r\n        [ConfigurationProperty(_elementsProperty, IsRequired = true)]\r\n        public NameTypeConfigurationElementCollection<VirtualElementConfigurationElement, VirtualElementConfigurationElement> Elements\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeConfigurationElementCollection<VirtualElementConfigurationElement, VirtualElementConfigurationElement>)base[_elementsProperty];\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/VirtualElementConfigurationElement.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    internal class VirtualElementConfigurationElement : NameTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/VirtualElementProvider.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Web.Hosting;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Foundation;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Search;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nusing UserTexts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_C1Console_Users;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Management;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(VirtualElementProviderData))]\r\n\r\n#pragma warning disable 612 // There is no easy/fast way to make this hookless /MRJ\r\n    internal sealed class VirtualElementProvider : IElementProvider, IDataExchangingElementProvider, ILocaleAwareElementProvider\r\n#pragma warning restore 612\r\n    {\r\n        private static readonly string RootElementId = \"ID01\";\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        private ElementProviderContext _context;\r\n\r\n        private List<EntityTokenHook> _currentEntityTokenHooks;\r\n\r\n        public static ResourceHandle ChangeOwnPasswordIcon => GetIconHandle(\"users-changeownpassword\");\r\n        public static ResourceHandle ChangeOwnCultureIcon => GetIconHandle(\"users-changeownculture\");\r\n        public static ResourceHandle SendMessageIcon => GetIconHandle(\"balloon\");\r\n        public static ResourceHandle RebuildSearchIndexIcon => GetIconHandle(\"refresh\");\r\n        public static ResourceHandle RestartApplicationIcon => GetIconHandle(\"restart-application\");\r\n        public static ResourceHandle ManageSecurityIcon => GetIconHandle(\"security-manage-permissions\");\r\n        public static ResourceHandle ChangeOwnActiveAndForeignLocaleIcon => GetIconHandle(\"localization-changelocale\");\r\n\r\n        private static readonly string LogTitle = typeof (VirtualElementProvider).Name;\r\n        private static readonly HashSet<string> _notLoadedVirtualElements = new HashSet<string>();\r\n\r\n        private readonly VirtualElementProviderData _configuration;\r\n\r\n        public VirtualElementProvider(VirtualElementProviderData configuration)\r\n        {\r\n            _configuration = configuration;\r\n\r\n            HookingFacade.SubscribeToNewElementProviderRootEntitiesEvent(OnNewElementProviderRootEntitiesEvent);\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set { _context = value; }\r\n        }\r\n\r\n\r\n\r\n        public bool ContainsLocalizedData\r\n        {\r\n            get\r\n            {\r\n                return GetAttachedElementProviderNames(_configuration.Perspectives)\r\n                       .Any(providerName => ElementFacade.ContainsLocalizedData(new ElementProviderHandle(providerName)));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            EntityToken entityToken = new VirtualElementProviderEntityToken(_context.ProviderName, RootElementId);\r\n\r\n            var root = new Element(_context.CreateElementHandle(entityToken))\r\n            {\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = \"${Composite.Management, VirtualElementProviderElementProvider.ID01}\",\r\n                    Icon = CommonElementIcons.Folder,\r\n                    OpenedIcon = CommonElementIcons.FolderOpen,\r\n                    ToolTip = \"\"\r\n                },\r\n                TagValue = \"Root\"\r\n            };\r\n\r\n            root.ElementExternalActionAdding = root.ElementExternalActionAdding.Remove(ElementExternalActionAdding.AllowGlobal);\r\n\r\n            AddRootActions(root);\r\n\r\n            return new [] { root };\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetForeignRoots(SearchToken seachToken)\r\n        {\r\n            // Expected that root note is a foldernode\r\n            return GetRoots(seachToken);\r\n        }\r\n\r\n\r\n\r\n        private void AddRootActions(Element element)\r\n        {\r\n            // \"User\" actions\r\n            element.AddAction(new ElementAction(new ActionHandle(\r\n                new WorkflowActionToken(\r\n                    WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Users.Workflows.ChangeOwnForeignLocaleWorkflow\"),\r\n                    new PermissionType[] { }\r\n                )))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = UserTexts.ChangeForeignLocaleWorkflow_ActionLabel,\r\n                    ToolTip = UserTexts.ChangeForeignLocaleWorkflow_ActionToolTip,\r\n                    Icon = VirtualElementProvider.ChangeOwnActiveAndForeignLocaleIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                },\r\n                TagValue = \"User\"\r\n            });\r\n\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(\r\n                new WorkflowActionToken(\r\n                    WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Users.Workflows.ChangeOwnCultureWorkflow\"),\r\n                    new PermissionType[] { }\r\n                )))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = UserTexts.ChangeOwnCultureWorkflow_ElementActionLabel,\r\n                    ToolTip = UserTexts.ChangeOwnCultureWorkflow_ElementActionToolTip,\r\n                    Icon = VirtualElementProvider.ChangeOwnCultureIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Add,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                },\r\n                TagValue = \"User\"\r\n            });\r\n\r\n\r\n            if (UserValidationFacade.CanSetUserPassword)\r\n            {\r\n                element.AddAction(new ElementAction(new ActionHandle(\r\n                    new WorkflowActionToken(\r\n                        WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Users.Workflows.ChangeOwnPasswordWorkflow\"),\r\n                        new PermissionType[] { }\r\n                    )\r\n                    { DoIgnoreEntityTokenLocking = true }))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = UserTexts.ChangeOwnPasswordWorkflow_ElementActionLabel,\r\n                        ToolTip = UserTexts.ChangeOwnPasswordWorkflow_ElementActionToolTip,\r\n                        Icon = VirtualElementProvider.ChangeOwnPasswordIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Add,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    },\r\n                    TagValue = \"User\"\r\n                });\r\n            }\r\n\r\n            // Other actions\r\n\r\n            string manageGlobalUserPermissionsLabel = StringResourceSystemFacade.GetString(\"Composite.Management\", \"ManageUserPermissions.ManageGlobalUserPermissionsLabel\");\r\n            string manageUserPermissionsToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"ManageUserPermissions.ManageUserPermissionsToolTip\");\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new ManageUserPermissionsActionToken()))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = manageGlobalUserPermissionsLabel,\r\n                    ToolTip = manageUserPermissionsToolTip,\r\n                    Icon = ManageSecurityIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = PrimaryActionGroup,\r\n                        ActionBundle = StringResourceSystemFacade.GetString(\"Composite.Management\", \"VirtualElementProviderElementProvider.RootActions.GlobalSetting\")\r\n                    }\r\n                }\r\n            });\r\n\r\n            element.AddAction(\r\n                    new ElementAction(\r\n                        new ActionHandle(\r\n                            new WorkflowActionToken(\r\n                                WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Tools.SetTimeZoneWorkflow\"))))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"VirtualElementProviderElementProvider.RootActions.SetTimezoneLabel\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"VirtualElementProviderElementProvider.RootActions.SetTimezoneTooltip\"),\r\n                            Icon = VirtualElementProvider.ChangeOwnCultureIcon,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Other,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = false,\r\n                                ActionGroup = PrimaryActionGroup,\r\n                                ActionBundle = StringResourceSystemFacade.GetString(\"Composite.Management\", \"VirtualElementProviderElementProvider.RootActions.GlobalSetting\")\r\n                            }\r\n                        }\r\n                    });\r\n\r\n            element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Tools.SendMessageToConsolesWorkflow\"))))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"VirtualElementProviderElementProvider.RootActions.SendMessageLabel\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Management\", \"VirtualElementProviderElementProvider.RootActions.SendMessageTooltip\"),\r\n                    Icon = VirtualElementProvider.SendMessageIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            if (ServiceLocator.HasService(typeof (ISearchIndexUpdater)))\r\n            {\r\n                element.AddAction(new ElementAction(new RebuildSearchIndexActionToken())\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = Texts.VirtualElementProviderElementProvider_RootActions_RebuildSearchIndexLabel,\r\n                        ToolTip = Texts.VirtualElementProviderElementProvider_RootActions_RebuildSearchIndexTooltip,\r\n                        Icon = RebuildSearchIndexIcon,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Other,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = false,\r\n                            ActionGroup = PrimaryActionGroup\r\n                        }\r\n                    }\r\n                });\r\n            }\r\n\r\n            element.AddAction(new ElementAction(new RestartApplicationActionToken())\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = Texts.VirtualElementProviderElementProvider_RootActions_RestartApplicationLabel,\r\n                    ToolTip = Texts.VirtualElementProviderElementProvider_RootActions_RestartApplicationTooltip,\r\n                    Icon = RestartApplicationIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Other,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = false,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            return GetChildren(entityToken, seachToken, false);\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetForeignChildren(EntityToken entityToken, SearchToken seachToken)\r\n        {\r\n            return GetChildren(entityToken, seachToken, true);\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken, bool useForeign)\r\n        {\r\n            IEnumerable<VirtualElementConfigurationElement> elementNodes;\r\n\r\n            if(entityToken.Id == RootElementId)\r\n            {\r\n                elementNodes = _configuration.Perspectives;\r\n            }\r\n            else\r\n            {\r\n                SimpleVirtualElement node = FindElementNode(entityToken.Id, _configuration.Perspectives);\r\n\r\n                Verify.IsNotNull(node, \"No corresponding node was found with the id '{0}'\", entityToken.Id);\r\n\r\n                elementNodes = node.Elements;\r\n            }\r\n\r\n            var result = new List<Element>();\r\n\r\n            foreach (var elementNode in elementNodes)\r\n            {\r\n                if (elementNode is SimpleVirtualElement)\r\n                {\r\n                    Element createdElement;\r\n                    if(TryBuildElement(elementNode as SimpleVirtualElement, out createdElement))\r\n                    {\r\n                        result.Add(createdElement);\r\n                    }\r\n                    continue;\r\n                }\r\n\r\n                if (elementNode is AttachProviderVirtualElement)\r\n                {\r\n                    string providerName = (elementNode as AttachProviderVirtualElement).ProviderName;\r\n\r\n                    var providerHandle = new ElementProviderHandle(providerName);\r\n\r\n                    List<Element> elementsFromProvider;\r\n                    if (useForeign && ElementFacade.IsLocaleAwareElementProvider(providerHandle))\r\n                    {\r\n                        elementsFromProvider = ElementFacade.GetForeignRoots(providerHandle, seachToken).ToList();\r\n                    }\r\n                    else\r\n                    {\r\n                        elementsFromProvider = ElementFacade.GetRoots(providerHandle, seachToken).ToList();\r\n                    }\r\n\r\n                    foreach (Element element in elementsFromProvider)\r\n                    {\r\n                        element.ElementExternalActionAdding = element.ElementExternalActionAdding.Remove(ElementExternalActionAdding.AllowGlobal);\r\n                    }\r\n\r\n                    result.AddRange(elementsFromProvider);\r\n                    continue;\r\n                }\r\n\r\n                throw new NotSupportedException();\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private bool TryBuildElement(SimpleVirtualElement simpleVirtualElement, out Element result)\r\n        {\r\n            try\r\n            {\r\n                result = CreateElement(simpleVirtualElement);\r\n            }\r\n            catch (ConfigurationErrorsException exception)\r\n            {\r\n                string elementName = simpleVirtualElement.Name ?? \"\";\r\n\r\n                lock (_notLoadedVirtualElements)\r\n                {\r\n                    if (!_notLoadedVirtualElements.Contains(elementName))\r\n                    {\r\n                        Log.LogError(LogTitle, \"Failed to initialize virtual element/perspective. Label: '{0}', name: '{1}'\\n\" +\r\n                                               \"Remove the related configuration element from /App_Data/Composite/Composite.Config if it refers to a package that is no longer installed.\",\r\n                                               simpleVirtualElement.Label ?? \"\", elementName);\r\n\r\n                        Log.LogError(LogTitle, exception);\r\n\r\n                        _notLoadedVirtualElements.Add(elementName);\r\n                    }\r\n                }\r\n\r\n                result = null;\r\n            }\r\n\r\n            return result != null;\r\n        }\r\n\r\n        public List<EntityTokenHook> GetHooks()\r\n        {\r\n            return this.CurrentEntityTokenHooks;\r\n        }\r\n\r\n\r\n\r\n        public object GetData(string elementId)\r\n        {\r\n            string parentNodeId = GetParentNodeId(elementId, RootElementId, _configuration.Perspectives);\r\n\r\n            if (parentNodeId == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new VirtualElementProviderEntityToken(_context.ProviderName, parentNodeId);\r\n        }\r\n\r\n\r\n        private List<EntityTokenHook> CurrentEntityTokenHooks\r\n        {\r\n            get\r\n            {\r\n                if (_currentEntityTokenHooks == null)\r\n                {\r\n                    var result = new List<EntityTokenHook>();\r\n                    CreateHooks(result);\r\n\r\n                    _currentEntityTokenHooks = result;\r\n                }\r\n\r\n                return _currentEntityTokenHooks;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<string> GetAttachedElementProviderNames(IEnumerable<VirtualElementConfigurationElement> elements)\r\n        {\r\n            foreach (var virtualElement in elements)\r\n            {\r\n                if(virtualElement is AttachProviderVirtualElement)\r\n                {\r\n                    yield return (virtualElement as AttachProviderVirtualElement).ProviderName;\r\n                    continue;\r\n                }\r\n\r\n                if (virtualElement is SimpleVirtualElement)\r\n                {\r\n                    foreach (var providerName in GetAttachedElementProviderNames((virtualElement as SimpleVirtualElement).Elements))\r\n                    {\r\n                        yield return providerName;\r\n                    }\r\n                    continue;\r\n                }\r\n\r\n                throw new NotSupportedException(\"Not supported VirtualElementConfigurationElement type\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private SimpleVirtualElement FindElementNode(string name, IEnumerable<VirtualElementConfigurationElement> elements)\r\n        {\r\n            foreach (var element in elements.OfType<SimpleVirtualElement>())\r\n            {\r\n                if (element.Name == name) return element;\r\n\r\n                SimpleVirtualElement foundNode = FindElementNode(name, element.Elements);\r\n\r\n                if (foundNode != null) return foundNode;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private string GetParentNodeId(string name, string currentId, IEnumerable<VirtualElementConfigurationElement> elements)\r\n        {\r\n            foreach (var element in elements.OfType<SimpleVirtualElement>())\r\n            {\r\n                if (element.Name == name) return currentId;\r\n\r\n                string foundNode = GetParentNodeId(name, element.Name, element.Elements);\r\n\r\n                if (foundNode != null) return foundNode;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        private void CreateHooks(List<EntityTokenHook> foundHooks)\r\n        {\r\n            CreateHooks(RootElementId, _configuration.Perspectives, foundHooks);\r\n        }\r\n\r\n\r\n        private void CreateHooks(string parentId, IEnumerable<VirtualElementConfigurationElement> elements, List<EntityTokenHook> foundHooks)\r\n        {\r\n            var entityToken = new VirtualElementProviderEntityToken(_context.ProviderName, parentId);\r\n            var entityTokenHook = new EntityTokenHook(entityToken);\r\n\r\n            foreach (var attachProviderElement in elements.OfType<AttachProviderVirtualElement>())\r\n            {\r\n                lock (_notLoadedVirtualElements)\r\n                {\r\n                    if(_notLoadedVirtualElements.Contains(attachProviderElement.Name)) continue;\r\n                }\r\n\r\n\r\n                string providerName = attachProviderElement.ProviderName;\r\n                var childElements = ElementFacade.GetRootsWithNoSecurity(new ElementProviderHandle(providerName), null).ToList();\r\n\r\n                foreach (Element childElement in childElements)\r\n                {\r\n                    entityTokenHook.AddHookie(childElement.ElementHandle.EntityToken);\r\n                }\r\n            }\r\n\r\n            foundHooks.Add(entityTokenHook);\r\n\r\n            foreach (var simpleElement in elements.OfType<SimpleVirtualElement>())\r\n            {\r\n                CreateHooks(simpleElement.Name, simpleElement.Elements, foundHooks);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Element CreateElement(SimpleVirtualElement simpleElementNode)\r\n        {\r\n            EntityToken entityToken = new VirtualElementProviderEntityToken(_context.ProviderName, simpleElementNode.Name);\r\n\r\n            Element element = new Element(_context.CreateElementHandle(entityToken))\r\n            {\r\n                TagValue = simpleElementNode.Tag,\r\n                VisualData = new ElementVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.ParseString(simpleElementNode.Label),\r\n                    HasChildren = true // fixing refresh problem easy way... was: HasChildren(baseElementNode)\r\n                }\r\n            };\r\n\r\n\r\n\r\n            Action<IEnumerable> collectProviders = null;\r\n\r\n            // Recursively searching for attached providers\r\n            var attachedProviders = new List<AttachProviderVirtualElement>();\r\n            collectProviders = currentElements =>\r\n            {\r\n                attachedProviders.AddRange(currentElements.OfType<AttachProviderVirtualElement>());\r\n                currentElements.OfType<SimpleVirtualElement>().ForEach(e => collectProviders(e.Elements));\r\n            };\r\n            collectProviders(simpleElementNode.Elements);\r\n\r\n            element.IsLocaleAware = attachedProviders.Any(provider =>\r\n                ElementFacade.ContainsLocalizedData(new ElementProviderHandle(provider.ProviderName)));\r\n\r\n\r\n            if (element.VisualData.HasChildren)\r\n            {\r\n                ResourceHandle openHandle = IconResourceSystemFacade.GetResourceHandle(simpleElementNode.OpenFolderIconName);\r\n                ResourceHandle closeHandle = IconResourceSystemFacade.GetResourceHandle(simpleElementNode.CloseFolderIconName);\r\n\r\n                closeHandle = closeHandle ?? openHandle;\r\n                openHandle = openHandle ?? closeHandle;\r\n\r\n                if (openHandle == null)\r\n                {\r\n                    openHandle = CommonElementIcons.Folder;\r\n                    closeHandle = CommonElementIcons.FolderOpen;\r\n                }\r\n\r\n                element.VisualData.Icon = openHandle;\r\n                element.VisualData.OpenedIcon = closeHandle;\r\n            }\r\n            else\r\n            {\r\n                element.VisualData.Icon = CommonElementIcons.FolderDisabled;\r\n            }\r\n\r\n            var placeholderElementNode = simpleElementNode as PlaceholderVirtualElement;\r\n            if (placeholderElementNode != null)\r\n            {\r\n                element.PropertyBag[\"Path\"] = placeholderElementNode.Path;\r\n                element.PropertyBag[\"IsTool\"] = placeholderElementNode.IsTool;\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n\r\n        private bool HasChildren(BaseElementNode baseElementNode)\r\n        {\r\n            if (baseElementNode is FolderElementNode)\r\n            {\r\n                return baseElementNode.Children.Count != 0;\r\n            }\r\n\r\n            if (baseElementNode is ProviderHookingElementNode)\r\n            {\r\n                return true;\r\n\r\n                // Non-lazy check children\r\n                //ProviderHookingElementNode proivderNode = (ProviderHookingElementNode)baseElementNode;\r\n\r\n                //List<Element> children = ElementFacade.GetRoots(proivderNode.ProviderName);\r\n\r\n                //return children.Count != 0;\r\n            }\r\n\r\n            throw new NotSupportedException(string.Format(\"The element node type '{0}' is not supported\", baseElementNode.GetType()));\r\n        }\r\n\r\n\r\n\r\n        private void OnNewElementProviderRootEntitiesEvent(HookingFacadeEventArgs hookingFacadeEventArgs)\r\n        {\r\n            if (_currentEntityTokenHooks != null)\r\n            {\r\n                HookingFacade.RemoveHooks(this.CurrentEntityTokenHooks);\r\n            }\r\n\r\n            var newHooks = new List<EntityTokenHook>();\r\n            CreateHooks(newHooks);\r\n\r\n            _currentEntityTokenHooks = newHooks;\r\n\r\n            HookingFacade.AddHooks(this.CurrentEntityTokenHooks);\r\n        }\r\n\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n    }\r\n\r\n\r\n\r\n#pragma warning disable 612\r\n    internal sealed class VirtualElementProviderAssembler : IAssembler<IElementProvider, ElementProviderData>\r\n    {\r\n        public IElementProvider Assemble(IBuilderContext context, ElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n#pragma warning restore 612\r\n        {\r\n            var configuration = (VirtualElementProviderData)objectConfiguration;\r\n\r\n            return new VirtualElementProvider(configuration);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(VirtualElementProviderAssembler))]\r\n#pragma warning disable 612\r\n    internal sealed class VirtualElementProviderData : ElementProviderData\r\n#pragma warning restore 612\r\n    {\r\n        private const string _perspectivesProperty = \"Perspectives\";\r\n        [ConfigurationProperty(_perspectivesProperty, IsRequired = true)]\r\n        public NameTypeConfigurationElementCollection<VirtualElementConfigurationElement, VirtualElementConfigurationElement> Perspectives\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeConfigurationElementCollection<VirtualElementConfigurationElement, VirtualElementConfigurationElement>)base[_perspectivesProperty];\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [ActionExecutor(typeof(RebuildSearchIndexActionExecutor))]\r\n    internal sealed class RebuildSearchIndexActionToken : ActionToken\r\n    {\r\n        private static readonly IEnumerable<PermissionType> _permissionType = new [] { PermissionType.Administrate };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes => _permissionType;\r\n\r\n        public override string Serialize() => nameof(RebuildSearchIndexActionToken);\r\n\r\n        public static ActionToken Deserialize(string serializedData) => new RebuildSearchIndexActionToken();\r\n    }\r\n\r\n\r\n    [ActionExecutor(typeof(RestartApplicationActionExecutor))]\r\n    internal sealed class RestartApplicationActionToken : ActionToken\r\n    {\r\n        private static readonly IEnumerable<PermissionType> _permissionType = new [] { PermissionType.Administrate };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes => _permissionType;\r\n\r\n        public override string Serialize() => nameof(RestartApplicationActionToken);\r\n\r\n        public static ActionToken Deserialize(string serializedData) => new RestartApplicationActionToken();\r\n    }\r\n\r\n\r\n    internal sealed class RebuildSearchIndexActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            var service = ServiceLocator.GetService<ISearchIndexUpdater>();\r\n            service?.Rebuild();\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class RestartApplicationActionExecutor : IActionExecutor\r\n    {\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            HostingEnvironment.InitiateShutdown();\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/VirtualElementProviderEntityToken.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    /// <summary>\r\n    /// EntityTokon of elements created by <see cref=\"VirtualElementProvider\"/>\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(VirtualElementProviderSecurityAncestorProvider))]\r\n    public sealed class VirtualElementProviderEntityToken : EntityToken\r\n    {\r\n        private string _type;\r\n\r\n        /// <exclude />\r\n        public VirtualElementProviderEntityToken()\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [JsonConstructor]\r\n        public VirtualElementProviderEntityToken(string source, string id)\r\n        {\r\n            Source = source;\r\n            Id = id;            \r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        [JsonIgnore]\r\n        public override string Type\r\n        {\r\n            get\r\n            {\r\n                if (_type == null)\r\n                {\r\n                    _type= TypeManager.SerializeType(this.GetType());\r\n                }\r\n\r\n                return _type;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(this);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedEntityToken))\r\n            {\r\n                entityToken =\r\n                    CompositeJsonSerializer.Deserialize<VirtualElementProviderEntityToken>(serializedEntityToken);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedEntityToken);\r\n                Log.LogVerbose(nameof(VirtualElementProviderEntityToken), entityToken.GetType().FullName);\r\n            }\r\n            return entityToken;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken DeserializeLegacy(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n\r\n            EntityToken.DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new VirtualElementProviderEntityToken(source, id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VirtualElementProvider/VirtualElementProviderSecurityAncestorProvider.cs",
    "content": "using System.Collections.Generic;\r\n\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Elements;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VirtualElementProvider\r\n{\r\n    internal sealed class VirtualElementProviderSecurityAncestorProvider : ISecurityAncestorProvider\r\n\t{\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            VirtualElementProviderEntityToken virtualEntityToken = (VirtualElementProviderEntityToken)entityToken;\r\n\r\n            List<EntityToken> parentEntityTokens = new List<EntityToken>();\r\n\r\n            VirtualElementProviderEntityToken parentToken = (VirtualElementProviderEntityToken)ElementFacade.GetData(new ElementProviderHandle(virtualEntityToken.Source), virtualEntityToken.Id);\r\n\r\n            if (parentToken != null)\r\n            {\r\n                parentEntityTokens.Add(parentToken);\r\n            }\r\n\r\n            return parentEntityTokens;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/DeleteVisualFunctionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteWysiwygRenderingWorkflow\" Location=\"30; 30\" Size=\"1149; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity19\" SourceStateName=\"DeleteWysiwygRenderingWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"DeleteWysiwygRenderingWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"769\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"461\" Y=\"412\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"412\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"769\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"457\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"646\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"646\" Y=\"527\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"257\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"323\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"745\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"769\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finishState\" Location=\"978; 769\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"initializeActivity\" Location=\"51; 101\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"59; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"69; 194\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity19\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"254; 323\" Size=\"211; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"529; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"539; 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"521; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"531; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"531; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"521; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"531; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"531; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"544; 527\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"552; 558\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"562; 620\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"562; 680\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"562; 740\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/EditVisualFunctionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditVisualFunctionWorkflow\" Location=\"30; 30\" Size=\"876; 539\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditVisualFunctionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditVisualFunctionWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"761\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"761\" Y=\"118\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"268\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"268\" Y=\"276\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"276\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"288\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"353\" />\r\n\t\t\t\t<ns0:Point X=\"343\" Y=\"353\" />\r\n\t\t\t\t<ns0:Point X=\"343\" Y=\"315\" />\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"315\" />\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"323\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Bottom\" SetStateName=\"noSaveSetStateActivity\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"353\" />\r\n\t\t\t\t<ns0:Point X=\"340\" Y=\"353\" />\r\n\t\t\t\t<ns0:Point X=\"340\" Y=\"414\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"414\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"406\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity5\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Preview\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"327\" Y=\"377\" />\r\n\t\t\t\t<ns0:Point X=\"340\" Y=\"377\" />\r\n\t\t\t\t<ns0:Point X=\"340\" Y=\"414\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"414\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"406\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity4\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"659\" Y=\"364\" />\r\n\t\t\t\t<ns0:Point X=\"668\" Y=\"364\" />\r\n\t\t\t\t<ns0:Point X=\"668\" Y=\"414\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"414\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"406\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"63; 105\" Size=\"197; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initialStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"142; 288\" Size=\"189; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"150; 319\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"160; 381\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 435\" Name=\"eventDrivenActivity_Save\" Location=\"150; 343\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"275; 405\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 294\" Name=\"ifElseActivity1\" Location=\"160; 465\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 194\" Name=\"ifElseBranchActivity1\" Location=\"179; 536\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"189; 634\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 194\" Name=\"ifElseBranchActivity2\" Location=\"352; 536\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showFieldMessageActivity1\" Location=\"362; 598\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"noSaveSetStateActivity\" Location=\"362; 658\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 242\" Name=\"eventDrivenActivity_Preview\" Location=\"150; 367\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"previewHandleExternalEventActivity1\" Location=\"160; 429\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"editPreviewCodeActivity\" Location=\"160; 489\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"160; 549\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"458; 323\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"466; 354\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"476; 416\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"476; 476\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"681; 118\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/VisualFunctionProviderElementProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.C1Console.Workflow;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(VisualFunctionProviderElementProviderData))]\r\n    internal sealed class VisualFunctionProviderElementProvider : BaseFunctionProviderElementProvider.BaseFunctionProviderElementProvider\r\n    {\r\n        public static ResourceHandle AddFunction { get { return GetIconHandle(\"visual-function-add\"); } }\r\n        public static ResourceHandle EditFunction { get { return GetIconHandle(\"visual-function-edit\"); } }\r\n        public static ResourceHandle DeleteFunction { get { return GetIconHandle(\"visual-function-delete\"); } }\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        public VisualFunctionProviderElementProvider()\r\n        {\r\n        }\r\n\r\n        protected override string RootFolderLabel\r\n        {\r\n            get\r\n            {\r\n                return StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProvider.RootFolderLabel\");\r\n            }\r\n        }\r\n\r\n\r\n        protected override string RootFolderToolTip\r\n        {\r\n            get\r\n            {\r\n                return StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProvider.RootFolderToolTip\");\r\n            }\r\n        }\r\n\r\n\r\n        protected override IEnumerable<IFunctionTreeBuilderLeafInfo> OnGetFunctionInfos(SearchToken searchToken)\r\n        {\r\n            if (searchToken.IsValidKeyword() == false)\r\n            {\r\n                return\r\n                    from function in DataFacade.GetData<IVisualFunction>()\r\n                    select (IFunctionTreeBuilderLeafInfo)new VisualFunctionTreeBuilderLeafInfo(function);\r\n            }\r\n            else\r\n            {\r\n                string keyword = searchToken.Keyword.ToLowerInvariant();\r\n\r\n                return\r\n                    from function in DataFacade.GetData<IVisualFunction>()\r\n                    where function.Name.ToLowerInvariant().Contains(keyword) ||\r\n                          function.Namespace.ToLowerInvariant().Contains(keyword) ||\r\n                          function.TypeManagerName.ToLowerInvariant().Contains(keyword)\r\n                    select (IFunctionTreeBuilderLeafInfo)new VisualFunctionTreeBuilderLeafInfo(function);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<Type> OnGetEntityTokenTypes()\r\n        {\r\n            yield return typeof(DataEntityToken);\r\n        }\r\n\r\n\r\n\r\n        protected override IFunctionTreeBuilderLeafInfo OnIsEntityOwner(EntityToken entityToken)\r\n        {\r\n            DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n            if (dataEntityToken == null) return null;\r\n\r\n            if (dataEntityToken.InterfaceType != typeof(IVisualFunction)) return null;\r\n\r\n            return new VisualFunctionTreeBuilderLeafInfo(dataEntityToken.Data as IVisualFunction);\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<ElementAction> OnGetFolderActions()\r\n        {\r\n            return new ElementAction[]\r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider.AddNewVisualFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Add }\r\n                        )))\r\n                    {\r\n                        VisualData = new ActionVisualizedData\r\n                        {\r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProvider.AddNewLabel\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProvider.AddNewToolTip\"),\r\n                            Icon = VisualFunctionProviderElementProvider.AddFunction,\r\n                            Disabled = false,\r\n                            ActionLocation = new ActionLocation\r\n                            {\r\n                                ActionType = ActionType.Add,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<ElementAction> OnGetFunctionActions(IFunctionTreeBuilderLeafInfo function)\r\n        {\r\n            return new ElementAction[] \r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider.EditVisualFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Edit }\r\n                        ))) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProvider.EditLabel\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProvider.EditToolTip\"),\r\n                            Icon = VisualFunctionProviderElementProvider.EditFunction,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                               ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    },\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider.DeleteVisualFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Delete }\r\n                        ) { Payload = GetContext().ProviderName })) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProvider.DeleteLabel\"),\r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"VisualFunctionElementProvider.DeleteToolTip\"),\r\n                            Icon = VisualFunctionProviderElementProvider.DeleteFunction,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                               ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n        }\r\n\r\n\r\n\r\n\r\n        private sealed class VisualFunctionTreeBuilderLeafInfo : IFunctionTreeBuilderLeafInfo\r\n        {\r\n            private IVisualFunction _function;\r\n\r\n            public VisualFunctionTreeBuilderLeafInfo(IVisualFunction function)\r\n            {\r\n                _function = function;\r\n            }\r\n\r\n            public string Name\r\n            {\r\n                get { return _function.Name; }\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get { return _function.Namespace; }\r\n            }\r\n\r\n            public EntityToken EntityToken\r\n            {\r\n                get { return _function.GetDataEntityToken(); }\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(VisualFunctionProviderElementProviderAssembler))]\r\n    internal sealed class VisualFunctionProviderElementProviderData : HooklessElementProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class VisualFunctionProviderElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new VisualFunctionProviderElementProvider();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/WebsiteEntity.cs",
    "content": "﻿namespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic abstract class WebsiteEntity\r\n\t{\r\n        /// <exclude />\r\n        public WebsiteEntity(string fullPath, bool isFolder)\r\n        {\r\n            this.FullPath = fullPath;\r\n            this.IsFile = isFolder == false;\r\n            this.IsFolder = isFolder;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsFile\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsFolder\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FullPath\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/WebsiteFile.cs",
    "content": "﻿using System.IO;\r\nusing System.Text;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class WebsiteFile : WebsiteEntity\r\n\t{\r\n        private string _filename = null;\r\n        private string _mimeTypeInfo = null;\r\n        private bool? isReadOnly = null;\r\n\r\n\r\n        /// <exclude />\r\n        public WebsiteFile(string fullPath)\r\n            : base(fullPath, false)\r\n        {\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string FileName\r\n        {\r\n            get\r\n            {\r\n                if (_filename == null)\r\n                {\r\n                    _filename = Path.GetFileName(this.FullPath);\r\n                }\r\n\r\n                return _filename;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string MimeType\r\n        {\r\n            get \r\n            {\r\n                if (_mimeTypeInfo == null)\r\n                {\r\n                    _mimeTypeInfo = MimeTypeInfo.GetCanonicalFromExtension(Path.GetExtension(this.FullPath));\r\n                }\r\n\r\n                return _mimeTypeInfo;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string ReadAllText()\r\n        {\r\n            return C1File.ReadAllText(this.FullPath);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsReadOnly\r\n        {\r\n            get \r\n            {\r\n                if (isReadOnly.HasValue == false)\r\n                {\r\n                    isReadOnly = (C1File.GetAttributes(this.FullPath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly;\r\n                }\r\n\r\n                return isReadOnly.Value; \r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public void WriteAllText(string content)\r\n        {\r\n            // Default encode is Composite.Core.IO.StreamWriter.UTF8NoBOM, which is UTF8 without encoding signature\r\n            C1File.WriteAllText(this.FullPath, content, Encoding.UTF8);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/WebsiteFileElementProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    [ConfigurationElementType(typeof(WebsiteFileElementProviderData))]\r\n    internal sealed class WebsiteFileElementProvider : IHooklessElementProvider, IDataExchangingElementProvider\r\n    {\r\n        private ElementProviderContext _context;\r\n        private readonly string _rootPath;\r\n        private readonly string _rootLabel;\r\n        private readonly string _folderWhiteListKeyName;\r\n        private readonly List<string> _manageableKeyNames;\r\n        private readonly List<string> _manageableKeyNameLabels;\r\n\r\n        private static ResourceHandle FolderIcon => CommonElementIcons.Folder;\r\n        private static ResourceHandle OpenFolderIcon => CommonElementIcons.FolderOpen;\r\n        private static ResourceHandle EmptyFolderIcon => CommonElementIcons.FolderOpen;\r\n        private static ResourceHandle ReadOnlyFolderOpen => GetIconHandle(\"website-read-only-folder-open\");\r\n        private static ResourceHandle ReadOnlyFolderClosed => GetIconHandle(\"website-read-only-folder-closed\");\r\n        private static ResourceHandle AddWebsiteFolder => GetIconHandle(\"website-add-website-folder\");\r\n        private static ResourceHandle AddWebsiteFile => GetIconHandle(\"website-create-website-file\");\r\n        private static ResourceHandle DeleteWebsiteFolder => GetIconHandle(\"website-delete-website-folder\");\r\n        private static ResourceHandle DeleteWebsiteFile => GetIconHandle(\"website-delete-website-file\");\r\n        private static ResourceHandle EditWebsiteFile => GetIconHandle(\"website-edit-website-file\");\r\n        private static ResourceHandle UploadWebsiteFile => GetIconHandle(\"website-upload-website-file\");\r\n        private static ResourceHandle UploadAndExtractZipFile => GetIconHandle(\"website-upload-zip-file\");\r\n        private static ResourceHandle DownloadWebsiteFile => GetIconHandle(\"media-download-file\");\r\n        private static ResourceHandle AddFolderToWhiteList => GetIconHandle(\"website-add-folder-to-whitelist\");\r\n        private static ResourceHandle RemoveFolderFromWhiteList => GetIconHandle(\"website-remove-folder-from-whitelist\");\r\n\r\n\r\n        private static readonly ActionGroup PrimaryFolderActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n        private static readonly ActionGroup PrimaryFileActionGroup = new ActionGroup(\"File\", ActionGroupPriority.PrimaryMedium);\r\n//        private static readonly ActionGroup PrimaryFileToolsActionGroup = new ActionGroup(\"FileTools\", ActionGroupPriority.PrimaryMedium);\r\n        private static readonly ActionGroup PrimaryFolderToolsActionGroup = new ActionGroup(\"FolderTools\", ActionGroupPriority.PrimaryMedium);\r\n\r\n        private static readonly PermissionType[] _addNewWebsiteFolderPermissionTypes = { PermissionType.Add };\r\n        private static readonly PermissionType[] _addNewWebsiteFilePermissionTypes = { PermissionType.Add };\r\n        private static readonly PermissionType[] _uploadAndExtractZipFileWorkflow = { PermissionType.Add };\r\n        private static readonly PermissionType[] _deleteWebsiteFolderPermissionTypes = { PermissionType.Delete };\r\n        private static readonly PermissionType[] _deleteWebsiteFilePermissionTypes = { PermissionType.Delete };\r\n        private static readonly PermissionType[] _editWebsiteFilePermissionTypes = { PermissionType.Edit };\r\n        private static readonly PermissionType[] _uploadWebsiteFilePermissionTypes = { PermissionType.Add };\r\n        private static readonly PermissionType[] _changeWhiteListPermissionTypes = { PermissionType.Administrate };\r\n\r\n\r\n        public WebsiteFileElementProvider(WebsiteFileElementProviderData objectConfiguration)\r\n        {\r\n            _rootLabel = objectConfiguration.RootLabel;\r\n            _folderWhiteListKeyName = objectConfiguration.FolderWhiteListKeyName;\r\n\r\n            if (!string.IsNullOrEmpty(objectConfiguration.ManageableKeyNames))\r\n            {\r\n                _manageableKeyNames = objectConfiguration.ManageableKeyNames.Split(',').ToList();\r\n                _manageableKeyNameLabels = StringResourceSystemFacade.SplitParseableStrings(objectConfiguration.ManageableKeyNameLabels, ',').ToList();\r\n            }\r\n            else\r\n            {\r\n                _manageableKeyNames = new List<string>();\r\n            }\r\n\r\n            _rootPath = Path.GetDirectoryName(PathUtil.BaseDirectory);\r\n        }\r\n\r\n\r\n\r\n        public ElementProviderContext Context\r\n        {\r\n            set => _context = value;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetRoots(SearchToken seachToken)\r\n        {\r\n            Element element = new Element(_context.CreateElementHandle(new WebsiteFileElementProviderRootEntityToken(_context.ProviderName, _rootPath)))\r\n            {\r\n                VisualData = new ElementVisualizedData()\r\n                {\r\n                    Label = StringResourceSystemFacade.ParseString(_rootLabel),\r\n                    ToolTip = StringResourceSystemFacade.ParseString(_rootLabel),\r\n                    HasChildren = true,\r\n                    Icon = FolderIcon,\r\n                    OpenedIcon = OpenFolderIcon\r\n                }\r\n            };\r\n\r\n            //element.MovabilityInfo.AddDropType(typeof(WebsiteFolder));\r\n            //element.MovabilityInfo.AddDropType(typeof(WebsiteFile));\r\n\r\n            //List<IFolderWhiteList> myWhiteLists = DataFacade.GetData<IFolderWhiteList>(f => f.KeyName == _folderWhiteListKeyName).ToList();\r\n\r\n            if (string.IsNullOrEmpty(_folderWhiteListKeyName) || DataFacade.GetData<IFolderWhiteList>(f => f.KeyName == _folderWhiteListKeyName && f.TildeBasedPath == \"~\\\\\").Any())\r\n            {\r\n                element.AddAction(\r\n                   new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddNewWebsiteFolderWorkflow\"), _addNewWebsiteFolderPermissionTypes)))\r\n                   {\r\n                       VisualData = new ActionVisualizedData\r\n                       {\r\n                           Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddWebsiteFolderTitle\"),\r\n                           ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddWebsiteFolderToolTip\"),\r\n                           Icon = WebsiteFileElementProvider.AddWebsiteFolder,\r\n                           Disabled = false,\r\n                           ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                           ActionLocation = new ActionLocation\r\n                           {\r\n                               ActionType = ActionType.Add,\r\n                               IsInFolder = false,\r\n                               IsInToolbar = true,\r\n                               ActionGroup = PrimaryFolderActionGroup\r\n                           }\r\n                       }\r\n                   });\r\n\r\n                element.AddAction(\r\n                   new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddNewWebsiteFileWorkflow\"), _addNewWebsiteFilePermissionTypes)))\r\n                   {\r\n                       VisualData = new ActionVisualizedData\r\n                       {\r\n                           Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddWebsiteFileTitle\"),\r\n                           ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddWebsiteFileToolTip\"),\r\n                           Icon = WebsiteFileElementProvider.AddWebsiteFile,\r\n                           Disabled = false,\r\n                           ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                           ActionLocation = new ActionLocation\r\n                           {\r\n                               ActionType = ActionType.Add,\r\n                               IsInFolder = false,\r\n                               IsInToolbar = true,\r\n                               ActionGroup = PrimaryFolderActionGroup\r\n                           }\r\n                       }\r\n                   });\r\n\r\n                element.AddAction(\r\n                   new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.UploadWebsiteFileWorkflow\"), _uploadWebsiteFilePermissionTypes)))\r\n                   {\r\n                       VisualData = new ActionVisualizedData\r\n                       {\r\n                           Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"UploadWebsiteFileTitle\"),\r\n                           ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"UploadWebsiteFileToolTip\"),\r\n                           Icon = WebsiteFileElementProvider.UploadWebsiteFile,\r\n                           Disabled = false,\r\n                           ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                           ActionLocation = new ActionLocation\r\n                           {\r\n                               ActionType = ActionType.Add,\r\n                               IsInFolder = false,\r\n                               IsInToolbar = true,\r\n                               ActionGroup = PrimaryFolderActionGroup,\r\n                               ActionBundle = \"Upload\"\r\n                           }\r\n                       }\r\n                   });\r\n\r\n                element.AddAction(\r\n                   new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.UploadAndExtractZipFileWorkflow\"), _uploadAndExtractZipFileWorkflow)))\r\n                   {\r\n                       VisualData = new ActionVisualizedData\r\n                       {\r\n                           Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"UploadAndExtractZipFileTitle\"),\r\n                           ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"UploadAndExtractZipFileToolTip\"),\r\n                           Icon = WebsiteFileElementProvider.UploadAndExtractZipFile,\r\n                           Disabled = false,\r\n                           ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                           ActionLocation = new ActionLocation\r\n                           {\r\n                               ActionType = ActionType.Add,\r\n                               IsInFolder = false,\r\n                               IsInToolbar = true,\r\n                               ActionGroup = PrimaryFolderActionGroup,\r\n                               ActionBundle = \"Upload\"\r\n                           }\r\n                       }\r\n                   });\r\n\r\n                var actionsToAppend = new List<ElementAction>();\r\n                IEnumerable<IFolderWhiteList> manageableFolderWhiteLists = DataFacade.GetData<IFolderWhiteList>().ToList();\r\n                AppendFolderManagementActions( PathUtil.BaseDirectory, manageableFolderWhiteLists, actionsToAppend);\r\n\r\n                element.AddAction(actionsToAppend);\r\n            }\r\n\r\n            yield return element;\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken searchToken)\r\n        {\r\n            if (entityToken is WebsiteFileElementProviderRootEntityToken)\r\n            {\r\n                return GetChildrenOnPath(_rootPath, searchToken);\r\n            }\r\n\r\n            if (entityToken is WebsiteFileElementProviderEntityToken websiteFileEntityToken)\r\n            {\r\n                string path = websiteFileEntityToken.Path;\r\n\r\n                if (C1Directory.Exists(path))\r\n                {\r\n                    return GetChildrenOnPath(path, searchToken);\r\n                }\r\n\r\n                return new Element[] { };\r\n            }\r\n\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        public object GetData(string name)\r\n        {\r\n            return name == \"RootPath\" ? _rootPath : null;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> GetChildrenOnPath(string parentPath, SearchToken searchToken)\r\n        {\r\n            IEnumerable<WebsiteFolder> websiteFolders = GetFoldersOnPath(parentPath, searchToken);\r\n            IEnumerable<WebsiteFile> websiteFiles = GetFilesOnPath(parentPath, searchToken);\r\n\r\n            IEnumerable<Element> folders = CreateFolderElements(websiteFolders);\r\n            IEnumerable<Element> files = CreateFileElements(websiteFiles);\r\n\r\n            return folders.Concat(files).ToList();\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> CreateFileElements(IEnumerable<WebsiteFile> websiteFiles)\r\n        {\r\n            foreach (WebsiteFile websiteFile in websiteFiles)\r\n            {\r\n                var element = new Element(_context.CreateElementHandle(new WebsiteFileElementProviderEntityToken(_context.ProviderName, websiteFile.FullPath, _rootPath)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = websiteFile.FileName,\r\n                        ToolTip = websiteFile.FileName,\r\n                        HasChildren = false,\r\n                        Icon = WebsiteFileIcon(websiteFile.MimeType),\r\n                        OpenedIcon = WebsiteFileIcon(websiteFile.MimeType)\r\n                    }\r\n                };\r\n\r\n                element.PropertyBag.Add(\"Uri\", PathUtil.GetWebsitePath(websiteFile.FullPath));\r\n                element.PropertyBag.Add(\"ElementType\", websiteFile.MimeType);\r\n\r\n                //element.MovabilityInfo.DragType = typeof(WebsiteFile);\r\n\r\n                foreach (ElementAction action in GetFileActions(websiteFile))\r\n                {\r\n                    element.AddAction(action);\r\n                }\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Element> CreateFolderElements(IEnumerable<WebsiteFolder> websiteFolders)\r\n        {\r\n            IEnumerable<IFolderWhiteList> manageableFolderWhiteLists = DataFacade.GetData<IFolderWhiteList>().ToList();\r\n\r\n            IEnumerable<IFolderWhiteList> myWhiteLists = null;\r\n            if (!string.IsNullOrEmpty(_folderWhiteListKeyName))\r\n            {\r\n                myWhiteLists = DataFacade.GetData<IFolderWhiteList>(f=>f.KeyName==_folderWhiteListKeyName).ToList();\r\n            }\r\n\r\n            foreach (WebsiteFolder websiteFolder in websiteFolders)\r\n            {\r\n                var element = new Element(_context.CreateElementHandle(new WebsiteFileElementProviderEntityToken(_context.ProviderName, websiteFolder.FullPath, _rootPath)))\r\n                {\r\n                    VisualData = new ElementVisualizedData\r\n                    {\r\n                        Label = websiteFolder.FolderName,\r\n                        ToolTip = websiteFolder.FolderName,\r\n                        HasChildren = true,\r\n                        Icon = FolderIcon,\r\n                        OpenedIcon = OpenFolderIcon\r\n                    },\r\n                };\r\n\r\n                if (myWhiteLists == null || myWhiteLists.Any(f => websiteFolder.FullPath.StartsWith(f.GetFullPath())))\r\n                {\r\n                    foreach (ElementAction action in GetFolderActions(websiteFolder, manageableFolderWhiteLists))\r\n                    {\r\n                        element.AddAction(action);\r\n                    }\r\n                }\r\n\r\n                yield return element;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<WebsiteFolder> GetFoldersOnPath(string parentPath, SearchToken searchToken)\r\n        {\r\n            IEnumerable<WebsiteFolder> folders =\r\n                from folderPath in C1Directory.GetDirectories(parentPath)\r\n                orderby folderPath\r\n                select new WebsiteFolder(folderPath);\r\n\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                folders =\r\n                    from folder in folders\r\n                    where folder.FolderName.ToLowerInvariant().Contains(searchToken.Keyword.ToLowerInvariant()) \r\n                    select folder;\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(_folderWhiteListKeyName))\r\n            {\r\n                List<IFolderWhiteList> whiteList = DataFacade.GetData<IFolderWhiteList>().Where(f => f.KeyName == _folderWhiteListKeyName).ToList();\r\n\r\n                folders =\r\n                    from folder in folders.ToList()\r\n                    where whiteList.Any(f => folder.FullPath.StartsWith(f.GetFullPath()) || f.GetFullPath().StartsWith(folder.FullPath))\r\n                    select folder;\r\n            }\r\n\r\n            return folders;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<WebsiteFile> GetFilesOnPath(string parentPath, SearchToken searchToken)\r\n        {\r\n            if (!string.IsNullOrEmpty(_folderWhiteListKeyName))\r\n            {\r\n                string parentTildaPath = IFolderWhiteListExtensions.GetTildePath(parentPath);\r\n                // NOTE: linq2sql conversion doesn't support xxx.StartsWith(someParameter) construction, that's why we're using two ling statements to get the data\r\n                bool isWhitelisted = (from path in ((from item in DataFacade.GetData<IFolderWhiteList>()\r\n                                                     where item.KeyName == _folderWhiteListKeyName\r\n                                                     select item.TildeBasedPath) as IEnumerable<string>)\r\n                                      where parentTildaPath.StartsWith(path)\r\n                                      select path).Any();\r\n\r\n                if (!isWhitelisted)\r\n                {\r\n                    yield break;\r\n                }\r\n            }\r\n\r\n            IEnumerable<WebsiteFile> files =\r\n                from filename in Directory.GetFiles(parentPath)\r\n                orderby filename\r\n                select new WebsiteFile(filename);\r\n\r\n            if (searchToken.IsValidKeyword())\r\n            {\r\n                files =\r\n                    from file in files\r\n                    where file.FileName.ToLowerInvariant().Contains(searchToken.Keyword.ToLowerInvariant()) \r\n                    select file;\r\n            }\r\n\r\n            foreach (var file in files)\r\n                yield return file;\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<ElementAction> GetFolderActions(WebsiteFolder websiteFolder, IEnumerable<IFolderWhiteList> manageableFolderWhiteLists)\r\n        {\r\n            IList<ElementAction> folderActions = new List<ElementAction>();\r\n\r\n            folderActions.Add(\r\n                new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddNewWebsiteFolderWorkflow\"), _addNewWebsiteFolderPermissionTypes)))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddWebsiteFolderTitle\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddWebsiteFolderToolTip\"),\r\n                        Icon = WebsiteFileElementProvider.AddWebsiteFolder,\r\n                        Disabled = false,\r\n                        ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Add,\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryFolderActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n            folderActions.Add(\r\n               new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddNewWebsiteFileWorkflow\"), _addNewWebsiteFilePermissionTypes)))\r\n               {\r\n                   VisualData = new ActionVisualizedData\r\n                   {\r\n                       Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddWebsiteFileTitle\"),\r\n                       ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddWebsiteFileToolTip\"),\r\n                       Icon = WebsiteFileElementProvider.AddWebsiteFile,\r\n                       Disabled = false,\r\n                       ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                       ActionLocation = new ActionLocation\r\n                       {\r\n                           ActionType = ActionType.Add,\r\n                           IsInFolder = false,\r\n                           IsInToolbar = true,\r\n                           ActionGroup = PrimaryFolderActionGroup\r\n                       }\r\n                   }\r\n               });\r\n\r\n            folderActions.Add(\r\n               new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.UploadWebsiteFileWorkflow\"), _uploadWebsiteFilePermissionTypes)))\r\n               {\r\n                   VisualData = new ActionVisualizedData\r\n                   {\r\n                       Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"UploadWebsiteFileTitle\"),\r\n                       ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"UploadWebsiteFileToolTip\"),\r\n                       Icon = WebsiteFileElementProvider.UploadWebsiteFile,\r\n                       Disabled = false,\r\n                       ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                       ActionLocation = new ActionLocation\r\n                       {\r\n                           ActionType = ActionType.Add,\r\n                           IsInFolder = false,\r\n                           IsInToolbar = true,\r\n                           ActionGroup = PrimaryFolderActionGroup,\r\n                           ActionBundle = \"Upload\"\r\n\r\n                       }\r\n                   }\r\n               });\r\n\r\n            folderActions.Add(\r\n               new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.UploadAndExtractZipFileWorkflow\"), _uploadAndExtractZipFileWorkflow)))\r\n               {\r\n                   VisualData = new ActionVisualizedData\r\n                   {\r\n                       Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"UploadAndExtractZipFileTitle\"),\r\n                       ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"UploadAndExtractZipFileToolTip\"),\r\n                       Icon = WebsiteFileElementProvider.UploadAndExtractZipFile,\r\n                       Disabled = false,\r\n                       ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                       ActionLocation = new ActionLocation\r\n                       {\r\n                           ActionType = ActionType.Add,\r\n                           IsInFolder = false,\r\n                           IsInToolbar = true,\r\n                           ActionGroup = PrimaryFolderActionGroup,\r\n                           ActionBundle = \"Upload\"\r\n                       }\r\n                   }\r\n               });\r\n\r\n\r\n\r\n            if (IsDeleteActionAllowed(websiteFolder))\r\n            {\r\n                folderActions.Add(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.DeleteWebsiteFolderWorkflow\"), _deleteWebsiteFolderPermissionTypes)))\r\n                     {\r\n                         VisualData = new ActionVisualizedData\r\n                         {\r\n                             Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DeleteWebsiteFolderTitle\"),\r\n                             ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DeleteWebsiteFolderToolTip\"),\r\n                             Icon = DeleteWebsiteFolder,\r\n                             Disabled = false,\r\n                             ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                             ActionLocation = new ActionLocation\r\n                             {\r\n                                 ActionType = ActionType.Delete,\r\n                                 IsInFolder = false,\r\n                                 IsInToolbar = true,\r\n                                 ActionGroup = PrimaryFileActionGroup\r\n                             }\r\n                         }\r\n                     });\r\n            }\r\n\r\n\r\n            AppendFolderManagementActions(websiteFolder.FullPath, manageableFolderWhiteLists, folderActions);\r\n          \r\n            return folderActions;\r\n        }\r\n\r\n        private void AppendFolderManagementActions(string websiteFolderPath, IEnumerable<IFolderWhiteList> manageableFolderWhiteLists, IList<ElementAction> folderActions)\r\n        {\r\n            for (int i = 0; i < _manageableKeyNames.Count; i++)\r\n            {\r\n                string keyName = _manageableKeyNames[i];\r\n                string itemLabel = StringResourceSystemFacade.ParseString(_manageableKeyNameLabels[i]);\r\n\r\n                ResourceHandle icon;\r\n                string label;\r\n                string tooltip;\r\n                WorkflowActionToken workflowActionToken;\r\n\r\n                ActionCheckedStatus checkedStatus;\r\n                var tildeBasedPath = IFolderWhiteListExtensions.GetTildePath(websiteFolderPath);\r\n                if (manageableFolderWhiteLists.Any(f => f.KeyName == keyName && f.TildeBasedPath == tildeBasedPath))\r\n                {\r\n                    workflowActionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.RemoveWebsiteFolderFromWhiteListWorkflow\"), _changeWhiteListPermissionTypes);\r\n                    label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"RemoveFolderFromWhiteListTitle\");\r\n                    tooltip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"RemoveFolderFromWhiteListToolTip\");\r\n                    icon = WebsiteFileElementProvider.RemoveFolderFromWhiteList;\r\n                    checkedStatus = ActionCheckedStatus.Checked;\r\n                }\r\n                else\r\n                {\r\n                    workflowActionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddWebsiteFolderToWhiteListWorkflow\"), _changeWhiteListPermissionTypes);\r\n                    label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddFolderToWhiteListTitle\");\r\n                    tooltip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"AddFolderToWhiteListToolTip\");\r\n                    icon = WebsiteFileElementProvider.AddFolderToWhiteList;\r\n                    checkedStatus = ActionCheckedStatus.Unchecked;\r\n                }\r\n\r\n                label = string.Format(label, itemLabel);\r\n                tooltip = string.Format(tooltip, itemLabel);\r\n\r\n                workflowActionToken.Payload = keyName;\r\n\r\n                folderActions.Add(\r\n                   new ElementAction(new ActionHandle(workflowActionToken))\r\n                   {\r\n                       VisualData = new ActionVisualizedData\r\n                       {\r\n                           Label = label,\r\n                           ToolTip = tooltip,\r\n                           Icon = icon,\r\n                           Disabled = false,\r\n                           ActionLocation = new ActionLocation\r\n                           {\r\n                               ActionType = ActionType.Other,\r\n                               IsInFolder = false,\r\n                               IsInToolbar = false,\r\n                               ActionGroup = PrimaryFolderToolsActionGroup\r\n                           },\r\n                           ActionCheckedStatus = checkedStatus\r\n                       }\r\n                   });\r\n\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<ElementAction> GetFileActions(WebsiteFile websiteFile)\r\n        {\r\n            IList<ElementAction> fileActions = new List<ElementAction>();\r\n\r\n            if (IsDeleteActionAllowed(websiteFile))\r\n            {\r\n                fileActions.Add(\r\n                    new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.DeleteWebsiteFileWorkflow\"), _deleteWebsiteFilePermissionTypes)))\r\n                     {\r\n                         VisualData = new ActionVisualizedData\r\n                         {\r\n                             Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DeleteWebsiteFileTitle\"),\r\n                             ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DeleteWebsiteFileToolTip\"),\r\n                             Icon = DeleteWebsiteFile,\r\n                             Disabled = websiteFile.IsReadOnly,\r\n                             ActivePositions = ElementActionActivePosition.NavigatorTree | ElementActionActivePosition.SelectorTree,\r\n                             ActionLocation = new ActionLocation\r\n                             {\r\n                                 ActionType = ActionType.Delete,\r\n                                 IsInFolder = false,\r\n                                 IsInToolbar = true,\r\n                                 ActionGroup = PrimaryFileActionGroup\r\n                             }\r\n                         }\r\n                     });\r\n            }\r\n\r\n            // Download\r\n            fileActions.Add(\r\n                new ElementAction(new ActionHandle(new DownloadFileActionToken()))\r\n                {\r\n                    VisualData = new ActionVisualizedData\r\n                    {\r\n                        Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DownloadFileTitle\"),\r\n                        ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DownloadFileToolTip\"),\r\n                        Icon = DownloadWebsiteFile,\r\n                        Disabled = false,\r\n                        ActionLocation = new ActionLocation\r\n                        {\r\n                            ActionType = ActionType.Add, // For sorting purpose\r\n                            IsInFolder = false,\r\n                            IsInToolbar = true,\r\n                            ActionGroup = PrimaryFileActionGroup\r\n                        }\r\n                    }\r\n                });\r\n\r\n            if (IsEditActionAllowed(websiteFile))\r\n            {\r\n                fileActions.Add(\r\n                        new ElementAction(new ActionHandle(\r\n                            websiteFile.MimeType==MimeTypeInfo.Resx?\r\n                                (ActionToken) new UrlActionToken(websiteFile.FileName, EditWebsiteFile,\r\n                                    UrlUtils.ResolvePublicUrl($\"Composite/content/misc/editors/resxeditor/resxeditor.aspx?f={websiteFile.FullPath}\"), _editWebsiteFilePermissionTypes):\r\n                            new WorkflowActionToken(\r\n                                WorkflowFacade.GetWorkflowType(\r\n                                    \"Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.EditWebsiteFileTextContentWorkflow\"),\r\n                                _editWebsiteFilePermissionTypes)))\r\n                        {\r\n                            VisualData = new ActionVisualizedData\r\n                            {\r\n                                Label = StringResourceSystemFacade.GetString(\r\n                                    \"Composite.Plugins.WebsiteFileElementProvider\", \"EditWebsiteFileTitle\"),\r\n                                ToolTip = StringResourceSystemFacade.GetString(\r\n                                    \"Composite.Plugins.WebsiteFileElementProvider\", \"EditWebsiteFileToolTip\"),\r\n                                Icon = EditWebsiteFile,\r\n                                Disabled = websiteFile.IsReadOnly,\r\n                                ActionLocation = new ActionLocation\r\n                                {\r\n                                    ActionType = ActionType.Edit,\r\n                                    IsInFolder = false,\r\n                                    IsInToolbar = true,\r\n                                    ActionGroup = PrimaryFileActionGroup\r\n                                }\r\n                            }\r\n                        });\r\n\r\n                if (websiteFile.MimeType == MimeTypeInfo.Resx && \r\n                    !CultureInfo.GetCultures(CultureTypes.SpecificCultures).\r\n                    Any(f => f.Name != \"\" && \r\n                    websiteFile.FileName.EndsWith(\".\" + f.Name + \".Resx\", StringComparison.OrdinalIgnoreCase)))\r\n                {\r\n                    var files = Directory.GetFiles(Path.GetDirectoryName(websiteFile.FullPath));\r\n                    foreach (var cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n                    {\r\n                        if (!files.Any(f => cultureInfo.Name!=\"\" && f.EndsWith(\".\" + cultureInfo.Name + \".Resx\", StringComparison.OrdinalIgnoreCase)))\r\n                        {\r\n\r\n                        fileActions.Add(\r\n                            new ElementAction(new ActionHandle(\r\n                                new UrlActionToken(websiteFile.FileName, EditWebsiteFile,\r\n                                    UrlUtils.ResolvePublicUrl(\r\n                                        $\"Composite/content/misc/editors/resxeditor/resxeditor.aspx?f={websiteFile.FullPath}&t={cultureInfo.Name}\"),\r\n                                    _editWebsiteFilePermissionTypes)\r\n                            ))\r\n                            {\r\n                                VisualData = new ActionVisualizedData\r\n                                {\r\n                                    Label = string.Format(StringResourceSystemFacade.GetString(\r\n                                        \"Composite.Web.SourceEditor\", \"ResxEditor.TranslateTo.Label\"), cultureInfo.DisplayName),\r\n                                    ToolTip = string.Format(StringResourceSystemFacade.GetString(\r\n                                        \"Composite.Web.SourceEditor\", \"ResxEditor.TranslateTo.Tooltip\"), cultureInfo.DisplayName),\r\n                                    Icon = EditWebsiteFile,\r\n                                    Disabled = websiteFile.IsReadOnly,\r\n                                    ActionLocation = new ActionLocation\r\n                                    {\r\n                                        ActionType = ActionType.Add,\r\n                                        IsInFolder = false,\r\n                                        IsInToolbar = true,\r\n                                        ActionGroup = PrimaryFileActionGroup\r\n                                    }\r\n                                }\r\n                            });\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            \r\n\r\n            return fileActions;\r\n        }\r\n\r\n\r\n\r\n        private static bool IsDeleteActionAllowed(WebsiteEntity websiteEntity)\r\n        {\r\n            if (websiteEntity is WebsiteFile)\r\n            {\r\n                return true;\r\n                //WebsiteFile websiteFile = websiteEntity as WebsiteFile;\r\n\r\n                //string canonical = MimeTypeInfo.GetCanonical(websiteFile.MimeType);\r\n\r\n                //return _editableMimeTypes.Contains(canonical);\r\n            }\r\n            if (websiteEntity is WebsiteFolder)\r\n            {\r\n                //return false;\r\n                // Deleting a folder causes the webserver to restart...\r\n\r\n                //if (Directory.GetFiles(websiteEntity.FullPath).Length > 0) return false;\r\n                //if (Directory.GetDirectories(websiteEntity.FullPath).Length > 0) return false;\r\n\r\n                return true;\r\n            }\r\n\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n        private static bool IsEditActionAllowed(WebsiteEntity websiteEntity)\r\n        {\r\n            if (websiteEntity is WebsiteFile websiteFile)\r\n            {\r\n                return MimeTypeInfo.IsTextFile(websiteFile.MimeType);\r\n            }\r\n\r\n            if (websiteEntity is WebsiteFolder)\r\n            {\r\n                return false;\r\n            }\r\n            \r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        private static ResourceHandle GetIconHandle(string name)\r\n        {\r\n            return new ResourceHandle(BuildInIconProviderName.ProviderName, name);\r\n        }\r\n\r\n\r\n\r\n        internal static ResourceHandle WebsiteFileIcon(string mimeType)\r\n        {\r\n            return MimeTypeInfo.GetResourceHandleFromMimeType(MimeTypeInfo.GetCanonical(mimeType));\r\n        }\r\n    }\r\n\r\n    internal sealed class DownloadFileActionExecutor : IActionExecutor\r\n    {\r\n        public static string GetDownloadLink(WebsiteFileElementProviderEntityToken fileToken)\r\n        {\r\n            var urlString = new UrlBuilder(UrlUtils.AdminRootPath + \"/services/Admin/DownloadFile.ashx\");\r\n\r\n            string relativeFilePath = fileToken.Path.Substring(fileToken.RootPath.Length);\r\n\r\n            urlString[\"file\"] = relativeFilePath;\r\n            urlString[\"provider\"] = fileToken.Source;\r\n\r\n            return urlString.ToString();\r\n        }\r\n\r\n        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)\r\n        {\r\n            var fileToken = (WebsiteFileElementProviderEntityToken)entityToken;\r\n\r\n            string downloadLink = GetDownloadLink(fileToken);\r\n\r\n            string currentConsoleId = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>().CurrentConsoleId;\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(new DownloadFileMessageQueueItem(downloadLink), currentConsoleId);\r\n\r\n            return null;\r\n        }\r\n    }\r\n\r\n    [ActionExecutor(typeof(DownloadFileActionExecutor))]\r\n    internal sealed class DownloadFileActionToken : ActionToken\r\n    {\r\n        internal static readonly PermissionType[] RequiredPermissionTypes = { PermissionType.Administrate, PermissionType.Edit };\r\n\r\n        public override IEnumerable<PermissionType> PermissionTypes => RequiredPermissionTypes;\r\n\r\n        public override string Serialize() => \"DownloadFile\";\r\n\r\n\r\n        public static ActionToken Deserialize(string serializedData) => new DownloadFileActionToken();\r\n\r\n        public override bool IgnoreEntityTokenLocking => true;\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(WebsiteFileElementProviderAssembler))]\r\n    internal sealed class WebsiteFileElementProviderData : HooklessElementProviderData\r\n    {\r\n        private const string _rootLabel = \"rootLabel\";\r\n        [ConfigurationProperty(_rootLabel, IsRequired = true)]\r\n        public string RootLabel\r\n        {\r\n            get { return (string)base[_rootLabel]; }\r\n            set { base[_rootLabel] = value; }\r\n        }\r\n\r\n\r\n        private const string _folderWhiteListKeyName = \"folderWhiteListKeyName\";\r\n        /// <summary>\r\n        /// If specified, the key to use when localitng \"white listed\" folders for this provider.\r\n        /// When empty all folders are shown (no white-listing required)\r\n        /// </summary>\r\n        [ConfigurationProperty(_folderWhiteListKeyName, IsRequired = false, DefaultValue = \"\")]\r\n        public string FolderWhiteListKeyName\r\n        {\r\n            get { return (string)base[_folderWhiteListKeyName]; }\r\n            set { base[_folderWhiteListKeyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _manageableKeyNames = \"manageableKeyNames\";\r\n        /// <summary>\r\n        /// A comma seperated list of \"key names\" this provider should manage. In effect, this \r\n        /// controls the folders in other providers that have the specified key name.\r\n        /// </summary>\r\n        [ConfigurationProperty(_manageableKeyNames, IsRequired = false, DefaultValue = \"\")]\r\n        public string ManageableKeyNames\r\n        {\r\n            get { return (string)base[_manageableKeyNames]; }\r\n            set { base[_manageableKeyNames] = value; }\r\n        }\r\n\r\n\r\n        private const string _manageableKeyNameLabels = \"manageableKeyNameLabels\";\r\n        /// <summary>\r\n        /// A comma seperated list of strings that denote what is managed by the respective \"key name\"\r\n        /// specified for ManageableKeyNames (in the same order). Used for humans to build command labels.\r\n        /// </summary>\r\n        [ConfigurationProperty(_manageableKeyNameLabels, IsRequired = false, DefaultValue = \"\")]\r\n        public string ManageableKeyNameLabels\r\n        {\r\n            get { return (string)base[_manageableKeyNameLabels]; }\r\n            set { base[_manageableKeyNameLabels] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class WebsiteFileElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new WebsiteFileElementProvider(objectConfiguration as WebsiteFileElementProviderData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/WebsiteFileElementProviderEntityToken.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Serialization;\r\nusing Newtonsoft.Json;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(WebsiteFileProviderEntityTokenSecurityAncestorProvider))]\r\n    public sealed class WebsiteFileElementProviderEntityToken : EntityToken\r\n    {\r\n        private static readonly string BaseDirectory;\r\n        private readonly string _relativePath;\r\n\r\n        static WebsiteFileElementProviderEntityToken()\r\n        {\r\n            string baseDirectory = PathUtil.BaseDirectory;\r\n            if(baseDirectory.EndsWith(\"\\\\\"))\r\n            {\r\n                baseDirectory = baseDirectory.Substring(0, baseDirectory.Length - 1);\r\n            }\r\n\r\n            BaseDirectory = baseDirectory;\r\n        }\r\n\r\n        /// <exclude />\r\n        [JsonConstructor]\r\n        public WebsiteFileElementProviderEntityToken(string providerName, string path, string rootPath)\r\n        {\r\n            Verify.ArgumentNotNull(path, \"path\");\r\n            Verify.ArgumentNotNull(rootPath, \"rootPath\");\r\n            Verify.ArgumentCondition(path.StartsWith(rootPath, StringComparison.OrdinalIgnoreCase), \"path\", \"Path should start with root path\");\r\n\r\n            Verify.That(rootPath.StartsWith(BaseDirectory, StringComparison.OrdinalIgnoreCase), \"Path does not belong to the website\");\r\n\r\n            _relativePath = path.Substring(BaseDirectory.Length);\r\n\r\n            this.Path = path;\r\n            this.RootPath = rootPath;\r\n            ProviderName = providerName;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string ProviderName { get; }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Type => \"\";\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source => ProviderName;\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id => _relativePath;\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return CompositeJsonSerializer.Serialize(this);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            EntityToken entityToken;\r\n            if (CompositeJsonSerializer.IsJsonSerialized(serializedData))\r\n            {\r\n                entityToken = CompositeJsonSerializer.Deserialize<WebsiteFileElementProviderEntityToken>(serializedData);\r\n            }\r\n            else\r\n            {\r\n                entityToken = DeserializeLegacy(serializedData);\r\n                Log.LogVerbose(nameof(WebsiteFileElementProviderEntityToken), entityToken.GetType().FullName);\r\n            }\r\n            return entityToken;\r\n        }\r\n\r\n        /// <exclude />\r\n        public static EntityToken DeserializeLegacy(string serializedData)\r\n        {\r\n            Dictionary<string, string> dic;\r\n            string type, source, id;\r\n\r\n            EntityToken.DoDeserialize(serializedData, out type, out source, out id, out dic);\r\n\r\n            // Backward compatibility\r\n            if (dic.ContainsKey(\"RootPath\"))\r\n            {\r\n                string rootPath = StringConversionServices.DeserializeValueString(dic[\"RootPath\"]);\r\n\r\n                return new WebsiteFileElementProviderEntityToken(source, id, rootPath);\r\n            }\r\n\r\n            string relativeRootPath = StringConversionServices.DeserializeValueString(dic[\"root\"]);\r\n\r\n            return new WebsiteFileElementProviderEntityToken(source, BaseDirectory + id, BaseDirectory + relativeRootPath);\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Path\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        private string RelativeRootPath => RootPath.Substring(BaseDirectory.Length);\r\n\r\n        [JsonProperty]\r\n        internal string RootPath\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n\r\n        internal bool IsRoot => this.Path == this.RootPath;\r\n\r\n\r\n        /// <exclude />\r\n        public override bool Equals(object obj)\r\n        {\r\n            return base.Equals(obj) \r\n                   && (obj as WebsiteFileElementProviderEntityToken).RootPath == this.RootPath;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override int GetHashCode()\r\n        {\r\n            if (this.HashCode == 0)\r\n            {\r\n                this.HashCode = GetType().GetHashCode() ^ this.Type.GetHashCode() ^ this.Source.GetHashCode() ^ this.Id.GetHashCode() ^ this.RelativeRootPath.GetHashCode();\r\n            }\r\n            return this.HashCode;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/WebsiteFileElementProviderRootEntityToken.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    public sealed class WebsiteFileElementProviderRootEntityToken : EntityToken\r\n\t{\r\n        /// <exclude />\r\n        public WebsiteFileElementProviderRootEntityToken(string providerName, string rootPath)\r\n        {\r\n            ProviderName = providerName;\r\n            RootPath = rootPath;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        internal string ProviderName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        internal string RootPath\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Source\r\n        {\r\n            get { return ProviderName; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Id\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override string Serialize()\r\n        {\r\n            return string.Format(\"{0}${1}\", ProviderName, RootPath);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static EntityToken Deserialize(string serializedData)\r\n        {\r\n            if (serializedData.IndexOf('$')>0)\r\n            {\r\n                var parts = serializedData.Split('$');\r\n                return new WebsiteFileElementProviderRootEntityToken(parts[0], parts[1]);\r\n            }\r\n            else\r\n            {\r\n                return new WebsiteFileElementProviderRootEntityToken(serializedData, \"\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/WebsiteFileEntityTokenSecurityAncestorProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.IO;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    internal sealed class WebsiteFileProviderEntityTokenSecurityAncestorProvider : ISecurityAncestorProvider\r\n    {\r\n        public IEnumerable<EntityToken> GetParents(EntityToken entityToken)\r\n        {\r\n            WebsiteFileElementProviderEntityToken castedEntityToken = (WebsiteFileElementProviderEntityToken)entityToken;\r\n\r\n            if ((C1File.Exists(castedEntityToken.Path) == false) &&\r\n                (C1Directory.Exists(castedEntityToken.Path) == false))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string newFolderPath = Path.GetDirectoryName(castedEntityToken.Path);\r\n\r\n            string rootFolder = castedEntityToken.RootPath;\r\n\r\n            if (newFolderPath != rootFolder)\r\n            {\r\n                Verify.That(newFolderPath.Length > rootFolder.Length, \r\n                            \"File/folder path '{0}' does not much root folder '{1}'\",\r\n                            newFolderPath, rootFolder);\r\n\r\n                return new EntityToken[] { new WebsiteFileElementProviderEntityToken(castedEntityToken.Source, newFolderPath, castedEntityToken.RootPath) };\r\n            }\r\n            \r\n            return new EntityToken[] { new WebsiteFileElementProviderRootEntityToken(castedEntityToken.Source, castedEntityToken.RootPath) };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/WebsiteFileSearchToken.cs",
    "content": "﻿using Composite.C1Console.Elements;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n\tinternal class WebsiteFileSearchToken : SearchToken\r\n\t{\r\n        public string[] MimeTypes { get; set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/WebsiteFolder.cs",
    "content": "﻿using System.IO;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n\tinternal sealed class WebsiteFolder : WebsiteEntity\r\n\t{\r\n        private string _folderName = null;\r\n\r\n\r\n        public WebsiteFolder(string fullPath)\r\n            : base(fullPath, true)\r\n        {\r\n        }\r\n\r\n\r\n        public string FolderName\r\n        {\r\n            get\r\n            {\r\n                if (_folderName == null)\r\n                {\r\n                    _folderName = Path.GetFileName(this.FullPath);\r\n                }\r\n\r\n                return _folderName;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/DeleteXsltFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteXsltFunctionWorkflow\" Location=\"30; 30\" Size=\"1149; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"DeleteXsltFunctionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteXsltFunctionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"806\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"806\" Y=\"197\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity1\" SourceStateName=\"deleteStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"deleteStateActivity\" EventHandlerName=\"deleteStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"548\" Y=\"219\" />\r\n\t\t\t\t<ns0:Point X=\"564\" Y=\"219\" />\r\n\t\t\t\t<ns0:Point X=\"564\" Y=\"285\" />\r\n\t\t\t\t<ns0:Point X=\"806\" Y=\"285\" />\r\n\t\t\t\t<ns0:Point X=\"806\" Y=\"277\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"deleteStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity3\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"deleteStateActivity\" SourceActivity=\"confirmStateActivity\" EventHandlerName=\"confirm_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"195\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"451\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"451\" Y=\"258\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity4\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"confirmStateActivity\" EventHandlerName=\"confirm_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"199\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"806\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"806\" Y=\"277\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"deleteStateActivity\" Location=\"351; 178\" Size=\"201; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"deleteStateInitializationActivity\" Location=\"529; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity1\" Location=\"539; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"539; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"539; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"726; 197\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"confirmStateActivity\" Location=\"78; 241\" Size=\"175; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"stateInitializationActivity1\" Location=\"86; 272\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"96; 334\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"confirm_Finish\" Location=\"86; 296\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"96; 358\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"96; 418\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"confirm_Cancel\" Location=\"86; 320\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"96; 382\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"96; 442\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/EditXsltFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditXsltFunctionWorkflow\" Location=\"30; 30\" Size=\"1149; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"EditXsltFunctionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditXsltFunctionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"822\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"822\" Y=\"109\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"432\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"validateStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"validateStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"saveEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"406\" Y=\"497\" />\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"497\" />\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"319\" />\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"319\" />\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"327\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity4\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"editEventDrivenActivity_Preview\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"417\" Y=\"521\" />\r\n\t\t\t\t<ns0:Point X=\"429\" Y=\"521\" />\r\n\t\t\t\t<ns0:Point X=\"429\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"550\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"970\" Y=\"637\" />\r\n\t\t\t\t<ns0:Point X=\"981\" Y=\"637\" />\r\n\t\t\t\t<ns0:Point X=\"981\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"432\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"validateStateActivity\" EventHandlerName=\"validateInitializeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"669\" Y=\"368\" />\r\n\t\t\t\t<ns0:Point X=\"877\" Y=\"368\" />\r\n\t\t\t\t<ns0:Point X=\"877\" Y=\"596\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity7\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Left\" TargetActivity=\"editStateActivity\" SourceActivity=\"validateStateActivity\" EventHandlerName=\"validateInitializeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"487\" Y=\"368\" />\r\n\t\t\t\t<ns0:Point X=\"471\" Y=\"368\" />\r\n\t\t\t\t<ns0:Point X=\"471\" Y=\"560\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"560\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"550\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"63; 105\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"213; 432\" Size=\"208; 118\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"221; 463\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"231; 525\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"saveEventDrivenActivity_Save\" Location=\"221; 487\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"231; 549\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"231; 609\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 242\" Name=\"editEventDrivenActivity_Preview\" Location=\"221; 511\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"previewHandleExternalEventActivity1\" Location=\"231; 573\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"editPreviewActivity\" Location=\"231; 633\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"231; 693\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"781; 596\" Size=\"193; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveStateInitializationActivity\" Location=\"789; 627\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"799; 689\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"799; 749\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"742; 109\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"validateStateActivity\" Location=\"483; 327\" Size=\"190; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"validateInitializeStateActivity\" Location=\"491; 358\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity1\" Location=\"501; 420\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"520; 491\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"530; 553\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"693; 491\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"703; 553\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/FlowUiQueryMarkupHelper.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n\tinternal static class FlowUiQueryMarkupHelper\r\n\t{\r\n        private static readonly XNamespace ui = \"http://www.w3.org/1999/xhtml\";\r\n\r\n\r\n        public static void ParseXml(string theXml, out IEnumerable<KeyValuePair<string, string>> queries, out ILookup<string, KeyValuePair<string, string>> parameterLookup)\r\n        {\r\n            XDocument document = XDocument.Parse(theXml);\r\n\r\n            queries =\r\n                 from nodes in document.Descendants(ui + \"treenode\")\r\n                 where (string)nodes.Attribute(\"binding\") == \"QueryTreeNodeBinding\"\r\n                 select new KeyValuePair<string, string>((string)nodes.Attribute(\"localname\"), (string)nodes.Attribute(\"ElementId\"));\r\n\r\n            var paramList =\r\n                from nodes in document.Descendants(ui + \"treenode\")\r\n                where (string)nodes.Attribute(\"binding\") == \"QueryParamTreeNodeBinding\"\r\n                select new { QueryLocalName = (string)nodes.Parent.Attribute(\"localname\"), Name = (string)nodes.Attribute(\"paramname\"), Value = (string)nodes.Attribute(\"paramvalue\") };\r\n\r\n            parameterLookup = paramList.ToLookup(f => f.QueryLocalName, f => new KeyValuePair<string, string>(f.Name, f.Value));\r\n        }\r\n\r\n\r\n\r\n        public static string BuildXml(IEnumerable<KeyValuePair<string, string>> queries, ILookup<string, KeyValuePair<string, string>> parameters)\r\n        {\r\n            \r\n            var usedQueryInfos =\r\n                from query in queries\r\n                select new { LocalName = query.Key, QueryInfo = FunctionFacade.GetFunction(query.Value) };\r\n\r\n            var paramsDictionary = parameters.ToDictionary(f => f.Key);\r\n\r\n            XElement rootElement = new XElement(ui + \"treebody\");\r\n\r\n            foreach (var namedQueryInfo in usedQueryInfos.OrderBy(f => f.QueryInfo.Namespace + f.QueryInfo.Name + f.LocalName))\r\n            {\r\n                IFunction queryInfo = namedQueryInfo.QueryInfo;\r\n\r\n                XElement currentNamespaceFolder = rootElement;\r\n\r\n                if (string.IsNullOrEmpty(queryInfo.Namespace) == false)\r\n                {\r\n                    string piecemealNamespace = \"\";\r\n\r\n                    foreach (string namespaceSegment in queryInfo.Namespace.Split('.'))\r\n                    {\r\n                        if (string.IsNullOrEmpty(piecemealNamespace) == false) piecemealNamespace = piecemealNamespace + \".\";\r\n                        piecemealNamespace = piecemealNamespace + namespaceSegment;\r\n\r\n                        XElement existingFolder =\r\n                            (from folderElement in rootElement.Descendants(ui + \"treenode\")\r\n                             where (string)folderElement.Attribute(\"binding\") == \"QueryFolderTreeNodeBinding\" && (string)folderElement.Attribute(\"ElementId\") == piecemealNamespace\r\n                             select folderElement).FirstOrDefault();\r\n\r\n                        if (existingFolder == null)\r\n                        {\r\n                            XElement subFolder = new XElement(ui + \"treenode\",\r\n                                                     new XAttribute(\"binding\", \"QueryFolderTreeNodeBinding\"),\r\n                                                     new XAttribute(\"ElementId\", piecemealNamespace),\r\n                                                     new XAttribute(\"label\", namespaceSegment));\r\n                            currentNamespaceFolder.Add(subFolder);\r\n\r\n                            currentNamespaceFolder = subFolder;\r\n                        }\r\n                        else\r\n                        {\r\n                            currentNamespaceFolder = existingFolder;\r\n                        }\r\n                    }\r\n                }\r\n\r\n\r\n                IGrouping<string, KeyValuePair<string, string>> currentQueryParams;\r\n                bool hasParams = paramsDictionary.TryGetValue(namedQueryInfo.LocalName, out currentQueryParams);\r\n\r\n                currentNamespaceFolder.Add(\r\n                    new XElement(ui + \"treenode\",\r\n                        new XAttribute(\"binding\", \"QueryTreeNodeBinding\"),\r\n                        new XAttribute(\"queryname\", queryInfo.Name),\r\n                        new XAttribute(\"localname\", namedQueryInfo.LocalName),\r\n                        new XAttribute(\"ElementId\", queryInfo.CompositeName()),\r\n                        from parameter in queryInfo.ParameterProfiles\r\n                        orderby parameter.Name\r\n                        select new XElement(ui + \"treenode\",\r\n                            new XAttribute(\"binding\", \"QueryParamTreeNodeBinding\"),\r\n                            new XAttribute(\"paramname\", parameter.Name),\r\n                            new XAttribute(\"hasvalue\", hasParams && currentQueryParams.Count(f => f.Key == parameter.Name) == 1),\r\n                            (hasParams && currentQueryParams.Count(f => f.Key == parameter.Name && f.Value != null) == 1 ? new XAttribute(\"paramvalue\", currentQueryParams.First(f => f.Key == parameter.Name).Value) : null))));\r\n            }\r\n\r\n            XmlDocument output = new XmlDocument();\r\n            output.LoadXml(rootElement.ToString());\r\n            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(output.NameTable);\r\n            namespaceManager.AddNamespace(\"ui\", ui.ToString());\r\n            XmlNodeList allNodes = output.SelectNodes(\"//*\");\r\n            foreach (XmlNode node in allNodes)\r\n            {\r\n                node.Prefix = \"ui\";\r\n            }\r\n            output.DocumentElement.RemoveAttribute(\"xmlns\");\r\n            return IndentedOuterXml(output);\r\n\r\n        }\r\n\r\n\r\n        public static string IndentedOuterXml(XmlNode node)\r\n        {\r\n            StringWriter stringWriter = new StringWriter();\r\n            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);\r\n            xmlTextWriter.Formatting = Formatting.Indented;\r\n            node.WriteTo(xmlTextWriter);\r\n            return stringWriter.ToString();\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/XsltBasedFunctionProviderElementProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Elements.Plugins.ElementProvider;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.C1Console.Workflow;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(XsltBasedFunctionProviderElementProviderData))]\r\n    public sealed class XsltBasedFunctionProviderElementProvider : BaseFunctionProviderElementProvider.BaseFunctionProviderElementProvider\r\n    {\r\n        private string _providerName;\r\n\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle AddFunction { get { return GetIconHandle(\"xslt-based-function-add\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle EditFunction { get { return GetIconHandle(\"xslt-based-function-edit\"); } }\r\n\r\n        /// <exclude />\r\n        public static ResourceHandle DeleteFunction { get { return GetIconHandle(\"xslt-based-function-delete\"); } }\r\n\r\n\r\n        /// <exclude />\r\n        public XsltBasedFunctionProviderElementProvider(string providerName)\r\n        {\r\n            _providerName = providerName;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override string RootFolderLabel\r\n        {\r\n            get\r\n            {\r\n                return StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"Plugins.XsltBasedFunctionProviderElementProvider.RootFolderLabel\");\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override string RootFolderToolTip\r\n        {\r\n            get\r\n            {\r\n                return StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"Plugins.XsltBasedFunctionProviderElementProvider.RootFolderToolTip\");\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<IFunctionTreeBuilderLeafInfo> OnGetFunctionInfos(SearchToken searchToken)\r\n        {\r\n            if (searchToken.IsValidKeyword() == false)\r\n            {\r\n                return\r\n                    from function in DataFacade.GetData<IXsltFunction>()\r\n                    orderby function.Name\r\n                    select (IFunctionTreeBuilderLeafInfo)new XsltFunctionTreeBuilderLeafInfo(function);\r\n            }\r\n            else\r\n            {\r\n                string keyword = searchToken.Keyword.ToLowerInvariant();\r\n\r\n                return\r\n                    from function in DataFacade.GetData<IXsltFunction>()\r\n                    where function.Name.ToLowerInvariant().Contains(keyword) ||\r\n                          function.Namespace.ToLowerInvariant().Contains(keyword)\r\n                    orderby function.Name\r\n                    select (IFunctionTreeBuilderLeafInfo)new XsltFunctionTreeBuilderLeafInfo(function);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<Type> OnGetEntityTokenTypes()\r\n        {\r\n            yield return typeof(DataEntityToken);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override IFunctionTreeBuilderLeafInfo OnIsEntityOwner(EntityToken entityToken)\r\n        {\r\n            DataEntityToken dataEntityToken = entityToken as DataEntityToken;\r\n            if (dataEntityToken == null) return null;\r\n\r\n            if (dataEntityToken.InterfaceType != typeof(IXsltFunction)) return null;\r\n\r\n            return new XsltFunctionTreeBuilderLeafInfo(dataEntityToken.Data as IXsltFunction);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<ElementAction> OnGetFolderActions()\r\n        {\r\n            return new ElementAction[]\r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider.AddNewXsltFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Add }\r\n                        ))) {\r\n                         VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"XsltBasedFunctionProviderElementProvider.Add\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"XsltBasedFunctionProviderElementProvider.AddToolTip\"),\r\n                            Icon = XsltBasedFunctionProviderElementProvider.AddFunction,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected override IEnumerable<ElementAction> OnGetFunctionActions(IFunctionTreeBuilderLeafInfo function)\r\n        {\r\n            return new ElementAction[] \r\n                {\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider.EditXsltFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Edit }\r\n                        ))) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"XsltBasedFunctionProviderElementProvider.Edit\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"XsltBasedFunctionProviderElementProvider.EditToolTip\"),\r\n                            Icon = XsltBasedFunctionProviderElementProvider.EditFunction,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Edit,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    },\r\n\r\n                    new ElementAction(new ActionHandle(\r\n                        new WorkflowActionToken(\r\n                            WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider.DeleteXsltFunctionWorkflow\"),\r\n                            new PermissionType[] { PermissionType.Delete }\r\n                        ){Payload = GetContext().ProviderName})) {\r\n                        VisualData = new ActionVisualizedData { \r\n                            Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"XsltBasedFunctionProviderElementProvider.Delete\"), \r\n                            ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"XsltBasedFunctionProviderElementProvider.DeleteToolTip\"),\r\n                            Icon = XsltBasedFunctionProviderElementProvider.DeleteFunction,\r\n                            Disabled = false, \r\n                            ActionLocation = new ActionLocation { \r\n                                ActionType = ActionType.Delete,\r\n                                IsInFolder = false,\r\n                                IsInToolbar = true,\r\n                                ActionGroup = PrimaryActionGroup\r\n                            }\r\n                        }\r\n                    }\r\n                };\r\n        }        \r\n\r\n\r\n\r\n        private sealed class XsltFunctionTreeBuilderLeafInfo : IFunctionTreeBuilderLeafInfo\r\n        {\r\n            private IXsltFunction _function;\r\n\r\n            public XsltFunctionTreeBuilderLeafInfo(IXsltFunction function)\r\n            {\r\n                _function = function;\r\n            }\r\n\r\n            public string Name\r\n            {\r\n                get { return _function.Name; }\r\n            }\r\n\r\n            public string Namespace\r\n            {\r\n                get { return _function.Namespace; }\r\n            }\r\n\r\n            public EntityToken EntityToken\r\n            {\r\n                get { return _function.GetDataEntityToken(); }\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(XsltBasedFunctionProviderElementProviderAssembler))]\r\n    internal sealed class XsltBasedFunctionProviderElementProviderData : HooklessElementProviderData\r\n    {\r\n        private const string _codeDomQueryResultProviderNameProperty = \"XsltBasedFunctionProviderName\";\r\n        [ConfigurationProperty(_codeDomQueryResultProviderNameProperty, IsRequired = true)]\r\n        public string XsltBasedFunctionProviderName\r\n        {\r\n            get { return (string)base[_codeDomQueryResultProviderNameProperty]; }\r\n            set { base[_codeDomQueryResultProviderNameProperty] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class XsltBasedFunctionProviderElementProviderAssembler : IAssembler<IHooklessElementProvider, HooklessElementProviderData>\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:ValidateArgumentsOfPublicMethods\")]\r\n        public IHooklessElementProvider Assemble(IBuilderContext context, HooklessElementProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            XsltBasedFunctionProviderElementProviderData data = (XsltBasedFunctionProviderElementProviderData)objectConfiguration;\r\n\r\n            return new XsltBasedFunctionProviderElementProvider(data.XsltBasedFunctionProviderName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/UrlToEntityToken/DataUrlToEntityTokenMapper.cs",
    "content": "﻿using System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Elements.UrlToEntityToken\r\n{\r\n    internal class DataUrlToEntityTokenMapper : IUrlToEntityTokenMapper\r\n    {\r\n        public string TryGetUrl(EntityToken entityToken)\r\n        {\r\n            var dataEntityToken = entityToken as DataEntityToken;\r\n\r\n            var data = dataEntityToken?.Data;\r\n            if (data == null) \r\n            {\r\n                return null;\r\n            }\r\n\r\n\r\n            PageUrlData pageUrlData;\r\n\r\n            var page = data as IPage;\r\n            if (page != null)\r\n            {\r\n                pageUrlData = new PageUrlData(page);\r\n            }\r\n            else\r\n            {\r\n                pageUrlData = DataUrls.TryGetPageUrlData(data.ToDataReference());\r\n            }\r\n\r\n            return pageUrlData != null ? GetPagePreviewUrl(pageUrlData) : null;\r\n        }\r\n\r\n\r\n        public BrowserViewSettings TryGetBrowserViewSettings(EntityToken entityToken, bool showPublishedView)\r\n        {\r\n            var dataEntityToken = entityToken as DataEntityToken;\r\n            if (dataEntityToken == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            if (showPublishedView)\r\n            {\r\n                using (new DataScope(PublicationScope.Published))\r\n                {\r\n                    if (dataEntityToken.DataSourceId.PublicationScope == PublicationScope.Unpublished\r\n                    && DataFacade.GetSupportedDataScopes(dataEntityToken.InterfaceType)\r\n                        .Contains(DataScopeIdentifier.Public))\r\n                    {\r\n                        var data = dataEntityToken.Data;\r\n                        if (data != null)\r\n                        {\r\n                            var key = data.GetUniqueKey();\r\n                            var publicData = DataFacade.TryGetDataVersionsByUniqueKey(dataEntityToken.InterfaceType, key).FirstOrDefault();\r\n                            if (publicData != null)\r\n                            {\r\n                                entityToken = publicData.GetDataEntityToken();\r\n                            }\r\n                            else\r\n                            {\r\n                                return null;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n            }\r\n\r\n            string url = TryGetUrl(entityToken);\r\n            return url == null ? null : new BrowserViewSettings { Url = url, ToolingOn = true };\r\n        }\r\n\r\n        private static string GetPagePreviewUrl(PageUrlData pageUrlData)\r\n        {\r\n            var urlSpace = new UrlSpace {ForceRelativeUrls = true};\r\n\r\n            return PageUrls.BuildUrl(pageUrlData, UrlKind.Public, urlSpace)\r\n                      ?? PageUrls.BuildUrl(pageUrlData, UrlKind.Renderer, urlSpace);\r\n        }\r\n\r\n        public EntityToken TryGetEntityToken(string url)\r\n        {\r\n            UrlKind urlKind;\r\n\r\n            PageUrlData pageUrlData = PageUrls.ParseUrl(url, out urlKind);\r\n            if (pageUrlData == null) return null;\r\n\r\n            if (pageUrlData.PublicationScope == PublicationScope.Published)\r\n            {\r\n                pageUrlData.PublicationScope = PublicationScope.Unpublished;\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(pageUrlData.PathInfo) || pageUrlData.HasQueryParameters)\r\n            {\r\n                IData data;\r\n                var dataReference = DataUrls.TryGetData(pageUrlData);\r\n                if (dataReference != null && (data = dataReference.Data) != null)\r\n                {\r\n                    return data.GetDataEntityToken();\r\n                }\r\n            }\r\n\r\n            IPage page = pageUrlData.GetPage();\r\n\r\n            return page?.GetDataEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/UrlToEntityToken/MediaUrlToEntityTokenMapper.cs",
    "content": "﻿using Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Elements.UrlToEntityToken\r\n{\r\n    internal class MediaUrlToEntityTokenMapper : IUrlToEntityTokenMapper\r\n    {\r\n        public string TryGetUrl(EntityToken entityToken) => null;\r\n\r\n        public BrowserViewSettings TryGetBrowserViewSettings(EntityToken entityToken, bool showPublishedView)\r\n        {\r\n            if (!(entityToken is DataEntityToken dataEntityToken) || dataEntityToken.InterfaceType != typeof(IMediaFile))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var file = (IMediaFile) dataEntityToken.Data;\r\n\r\n            if(file == null || !MimeTypeInfo.IsBrowserPreviewableFile(file.MimeType)) {\r\n                return null;\r\n            }\r\n\r\n            string url = MediaUrls.BuildUrl(file);\r\n            var urlBuilder = new UrlBuilder(url)\r\n            {\r\n                [\"download\"] = \"false\"\r\n            };\r\n\r\n            return new BrowserViewSettings { Url = urlBuilder.ToString(), ToolingOn = false };\r\n        }\r\n\r\n        public EntityToken TryGetEntityToken(string url) => null;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/UrlToEntityToken/ServerLogUrlToEntityTokenMapper.cs",
    "content": "﻿using Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Plugins.Elements.UrlToEntityToken\r\n{\r\n    internal class ServerLogUrlToEntityTokenMapper: IUrlToEntityTokenMapper\r\n    {\r\n        public string TryGetUrl(EntityToken entityToken)\r\n        {\r\n            return null;\r\n        }\r\n\r\n        public BrowserViewSettings TryGetBrowserViewSettings(EntityToken entityToken, bool showPublishedView)\r\n        {\r\n            var castedEntityToken = entityToken as TreeSimpleElementEntityToken;\r\n            if (castedEntityToken == null || castedEntityToken.Id != \"system.server.log\")\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return new BrowserViewSettings { Url = UrlUtils.Combine(UrlUtils.AdminRootPath, \"/content/views/log/log.aspx?browserView=true\"), ToolingOn = false };\r\n        }\r\n\r\n        public EntityToken TryGetEntityToken(string url)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Elements/UrlToEntityToken/WebsiteFileUrlToEntityTokenMapper.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.UrlToEntityToken\r\n{\r\n    internal class WebsiteFileUrlToEntityTokenMapper : IUrlToEntityTokenMapper\r\n    {\r\n        public string TryGetUrl(EntityToken entityToken) => null;\r\n\r\n        public BrowserViewSettings TryGetBrowserViewSettings(EntityToken entityToken, bool showPublishedView)\r\n        {\r\n            if (!(entityToken is WebsiteFileElementProviderEntityToken fileEntityToken))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var filePath = fileEntityToken.RootPath +  fileEntityToken.Id;\r\n            if (!File.Exists(filePath) || !UserHasRightToDownload(entityToken)) return null;\r\n\r\n            var fileInfo = new FileInfo(filePath);\r\n\r\n            if(!FilePreviewable(fileInfo)) \r\n            {\r\n                return null;\r\n            }\r\n\r\n            var downloadLink = DownloadFileActionExecutor.GetDownloadLink(fileEntityToken);\r\n            var urlBuilder = new UrlBuilder(downloadLink)\r\n            {\r\n                [\"preview\"] = \"true\"\r\n            };\r\n\r\n            return new BrowserViewSettings { Url = urlBuilder, ToolingOn = false };\r\n        }\r\n\r\n        private bool UserHasRightToDownload(EntityToken file)\r\n        {\r\n            var userToken = UserValidationFacade.GetUserToken();\r\n            var userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username);\r\n            var userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username);\r\n\r\n            var requiredPermissions = DownloadFileActionToken.RequiredPermissionTypes;\r\n            return SecurityResolver.Resolve(userToken, requiredPermissions, file, userPermissionDefinitions, userGroupPermissionDefinitions)\r\n                   == SecurityResult.Allowed;\r\n        }\r\n\r\n        private bool FilePreviewable(FileInfo fileInfo)\r\n        {\r\n            if (string.IsNullOrEmpty(fileInfo.Extension)) return false;\r\n\r\n            string mimeType = MimeTypeInfo.GetCanonicalFromExtension(fileInfo.Extension);\r\n            if (string.IsNullOrEmpty(mimeType)) return false;\r\n\r\n            return MimeTypeInfo.IsBrowserPreviewableFile(mimeType)\r\n                   || (MimeTypeInfo.IsTextFile(mimeType) && fileInfo.Length < 1 << 20 /* 1 MB */)\r\n                   || fileInfo.Extension.Equals(\".dll\", StringComparison.OrdinalIgnoreCase);\r\n        }\r\n\r\n        public EntityToken TryGetEntityToken(string url) => null;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/CustomUiControls/TemplatedPageContentEditorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.CustomUiControls\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class PageContentEditorTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public Guid PageId { get; set; }\r\n\r\n        /// <exclude />\r\n        public Guid TemplateId { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<KeyValuePair<Guid, string>> SelectableTemplateIds { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> NamedXhtmlFragments { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ClassConfigurationName { get; set; }\r\n\r\n        /// <exclude />\r\n        public Guid PageTypeId { get; set; }\r\n    }\r\n\r\n    internal sealed class TemplatedPageContentEditorUiControl : UiControl, IWebUiControl\r\n    {\r\n        [FormsProperty()]\r\n        [BindableProperty()]\r\n        public Guid PageId { get; set; }\r\n\r\n        [FormsProperty()]\r\n        [BindableProperty()]\r\n        public Guid TemplateId { get; set; }\r\n\r\n        [FormsProperty()]\r\n        [BindableProperty()]\r\n        public List<KeyValuePair<Guid, string>> SelectableTemplateIds { get; set; }\r\n\r\n        [FormsProperty()]\r\n        [BindableProperty()]\r\n        public Dictionary<string, string> NamedXhtmlFragments { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public string ClassConfigurationName { get; set; }\r\n\r\n        [FormsProperty()]\r\n        public Guid PageTypeId { get; set; }\r\n\r\n        private Type _userControlType;\r\n        private PageContentEditorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedPageContentEditorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n            this.SelectableTemplateIds = new List<KeyValuePair<Guid, string>>();\r\n            this.NamedXhtmlFragments = new Dictionary<string, string>();\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.SelectableTemplateIds = new List<KeyValuePair<Guid, string>>();\r\n            this.NamedXhtmlFragments = _userControl.NamedXhtmlFragments;\r\n            this.TemplateId = _userControl.TemplateId;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<PageContentEditorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.TemplateId = this.TemplateId;\r\n            _userControl.SelectableTemplateIds = this.SelectableTemplateIds;\r\n            _userControl.NamedXhtmlFragments = this.NamedXhtmlFragments;\r\n            _userControl.ClassConfigurationName = this.ClassConfigurationName;\r\n            _userControl.PageId = this.PageId;\r\n            _userControl.PageTypeId = this.PageTypeId;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedPageContentEditorUiControlFactoryData))]\r\n    internal sealed class TemplatedPageContentEditorUiControlFactory : IUiControlFactory\r\n    {\r\n        private TemplatedPageContentEditorUiControlFactoryData _data;\r\n        private Type _cachedUserControlType = null;\r\n\r\n        public TemplatedPageContentEditorUiControlFactory(TemplatedPageContentEditorUiControlFactoryData data)\r\n        {\r\n            _data = data;\r\n\r\n            if (_data.CacheCompiledUserControlType)\r\n            {\r\n                _cachedUserControlType = BuildManagerHelper.GetCompiledType(_data.UserControlVirtualPath);\r\n            }\r\n        }\r\n\r\n        public IUiControl CreateControl()\r\n        {\r\n            Type userControlType = _cachedUserControlType;\r\n\r\n            if (userControlType == null && System.Web.HttpContext.Current != null)\r\n            {\r\n                userControlType = BuildManagerHelper.GetCompiledType(_data.UserControlVirtualPath);\r\n            }\r\n\r\n            TemplatedPageContentEditorUiControl control = new TemplatedPageContentEditorUiControl(userControlType);\r\n\r\n            control.ClassConfigurationName = _data.ClassConfigurationName;\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedPageContentEditorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedPageContentEditorUiControlFactoryData : UiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n\r\n        private const string _classConfigurationNamePropertyName = \"ClassConfigurationName\";\r\n        [ConfigurationProperty(_classConfigurationNamePropertyName, IsRequired = false, DefaultValue = \"common\")]\r\n        public string ClassConfigurationName\r\n        {\r\n            get { return (string)base[_classConfigurationNamePropertyName]; }\r\n            set { base[_classConfigurationNamePropertyName] = value; }\r\n        }\r\n\r\n    }\r\n\r\n    internal sealed class TemplatedPageContentEditorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedPageContentEditorUiControlFactory(objectConfiguration as TemplatedPageContentEditorUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/Foundation/UserControlUtils.cs",
    "content": "﻿using System.Web.UI;\r\nusing System;\r\nusing System.Web;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.Foundation\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class UserControlUtils\r\n    {\r\n        /// <exclude />\r\n        public static TBase ActivateAsUserControl<TBase>(this Type userControlType, string uniqueUserControlId)\r\n            where TBase : UserControl\r\n        {\r\n            if (userControlType == null) throw new ArgumentNullException(\"userControlType\");\r\n            if (typeof(TBase).IsAssignableFrom(userControlType) == false) throw new ArgumentException(\"The specified type '\" + userControlType.FullName + \"' must inherit from generic argument \" + typeof(TBase).FullName, \"userControlType\");\r\n\r\n            Page currentPage = HttpContext.Current.Handler as Page;\r\n            if (currentPage == null) throw new InvalidOperationException(\"The Current HttpContext Handler must be a System.Web.Ui.Page\");\r\n\r\n            Control templateControl = currentPage.LoadControl(userControlType, null);\r\n\r\n            templateControl.ID = uniqueUserControlId;\r\n\r\n            return (TBase)templateControl;\r\n        }\r\n    }\r\n\r\n}"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiContainerFactories/Base/BaseTemplatedUiContainerFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiContainerFactories.Base\r\n{\r\n    internal abstract class BaseTemplatedUiContainerFactory : IUiContainerFactory\r\n    {\r\n        private ITemplatedUiContainerFactoryData _data;\r\n        private Type _cachedUserControlType = null;\r\n        private object _lock = new object();\r\n\r\n        protected BaseTemplatedUiContainerFactory(ITemplatedUiContainerFactoryData data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n\r\n        protected Type UserControlType\r\n        {\r\n            get\r\n            {\r\n                return this.CachedUserControlType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Type CachedUserControlType\r\n        {\r\n            get\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_cachedUserControlType == null || _data.CacheCompiledUserControlType == false)\r\n                    {\r\n                        using (DebugLoggingScope.CompletionTime(this.GetType(), string.Format(\"getting compiled '{0}'\", _data.UserControlVirtualPath, TimeSpan.FromMilliseconds(25))))\r\n                        {\r\n                            _cachedUserControlType = BuildManagerHelper.GetCompiledType(_data.UserControlVirtualPath);\r\n                        }\r\n                    }\r\n\r\n                    return _cachedUserControlType;\r\n                }\r\n            }\r\n        }\r\n\r\n        public abstract IUiContainer CreateContainer();\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiContainerFactories/Base/ITemplatedUiContainerFactoryData.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Configuration;\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiContainerFactories.Base\r\n{\r\n    internal interface ITemplatedUiContainerFactoryData\r\n    {\r\n        string UserControlVirtualPath { get; set; }\r\n\r\n        bool CacheCompiledUserControlType { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiContainerFactories/TemplatedUiContainer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web.UI;\r\n\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.Foundation;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiContainerFactories\r\n{\r\n    internal class TemplatedUiContainer : IWebUiContainer\r\n    {\r\n        private readonly Type _templateUserControlType;\r\n        private readonly string _templateFormVirtualPath;\r\n        private TemplatedExecutionContainer _webDocument;\r\n\r\n        internal TemplatedUiContainer(Type templateUserControlType, string templateFormVirtualPath)\r\n        {\r\n            _templateUserControlType = templateUserControlType;\r\n            _templateFormVirtualPath = templateFormVirtualPath;\r\n        }\r\n\r\n\r\n        public IUiControl Render(\r\n            IUiControl innerForm, \r\n            IUiControl customToolbarItems, \r\n            IFormChannelIdentifier channel, \r\n            IDictionary<string, object> eventHandlerBindings, \r\n            string containerLabel,\r\n            string containerLabelField,\r\n            string containerTooltip,\r\n            ResourceHandle containerIcon)\r\n        {\r\n            if (!string.IsNullOrEmpty(_templateFormVirtualPath))\r\n            {\r\n                var document = new WebEmbeddedFormUiControl(channel)\r\n                {\r\n                    FormPath = _templateFormVirtualPath, \r\n                    Bindings = new Dictionary<string, object>(eventHandlerBindings) {{\"Form\", innerForm}}\r\n                };\r\n                \r\n\r\n                if (customToolbarItems != null)\r\n                {\r\n                    document.Bindings.Add(\"CustomToolbarItems\", customToolbarItems);\r\n                }\r\n\r\n                _webDocument = new TemplatedExecutionContainer(document, _templateUserControlType, containerLabel, containerLabelField, containerTooltip, containerIcon);\r\n            }\r\n            else\r\n            {\r\n                _webDocument = new TemplatedExecutionContainer((IWebUiControl)innerForm, _templateUserControlType, containerLabel, containerLabelField, containerTooltip, containerIcon);\r\n            }\r\n\r\n            return _webDocument;\r\n        }\r\n\r\n\r\n        public void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages)\r\n        {\r\n            _webDocument.ShowFieldMessages( clientIDPathedMessages);\r\n        }\r\n\r\n    }\r\n\r\n\r\n\r\n\r\n    internal class TemplatedExecutionContainer : UiControl, IWebUiControl\r\n    {\r\n        readonly IWebUiControl _form;\r\n        readonly Type _templateUserControlType;\r\n        readonly string _containerLabel;\r\n        readonly string _containerTooltip;\r\n        readonly string _containerLabelField;\r\n        readonly ResourceHandle _containerIcon;\r\n\r\n        Control _messagePlaceHolder;\r\n        TemplatedUiContainerBase _templateControl;\r\n\r\n\r\n        public TemplatedExecutionContainer(\r\n            IWebUiControl form, Type templateUserControlType, \r\n            string containerLabel, string containerLabelField, string containerTooltip,\r\n            ResourceHandle containerIcon)\r\n        {\r\n            _form = form;\r\n            _templateUserControlType = templateUserControlType;\r\n            _containerLabel = containerLabel;\r\n            _containerLabelField = containerLabelField;\r\n            _containerTooltip = containerTooltip;\r\n            _containerIcon = containerIcon;\r\n        }\r\n\r\n        internal Control GetMessagePlaceHolder()\r\n        {\r\n            if (_messagePlaceHolder == null) throw new InvalidOperationException(\"MessagePlaceHolder has not been initialized. The place holder will not exist before BuildWebControl() has been called\");\r\n            return _messagePlaceHolder;\r\n        }\r\n\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _form.BindStateToControlProperties();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _templateControl = _templateUserControlType.ActivateAsUserControl<TemplatedUiContainerBase>(this.UiControlID);\r\n\r\n            Control formPlaceHolder = _templateControl.GetFormPlaceHolder();\r\n            _messagePlaceHolder = _templateControl.GetMessagePlaceHolder();\r\n            _templateControl.SetContainerTitle(_containerLabel);\r\n            _templateControl.SetContainerTitleField(_containerLabelField);\r\n            _templateControl.SetContainerTooltip(_containerTooltip);\r\n            _templateControl.SetContainerIcon(_containerIcon);\r\n            _templateControl.SetWebUiControlRef(_form);\r\n\r\n            formPlaceHolder.Controls.Add(_form.BuildWebControl());\r\n\r\n            return _templateControl;\r\n        }\r\n\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _form.InitializeViewState();\r\n        }\r\n\r\n\r\n        public bool IsFullWidthControl\r\n        {\r\n            get { throw new Exception(\"I am the root page!\"); }\r\n        }\r\n\r\n        public string ClientName { get { return null; } }\r\n\r\n\r\n        internal void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages)\r\n        {\r\n            _templateControl.ShowFieldMessages(clientIDPathedMessages);;\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiContainerFactories/TemplatedUiContainerBase.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Forms.DataServices.UiControls;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiContainerFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class TemplatedUiContainerBase : UserControl\r\n    {\r\n        private IWebUiControl _webUiControl;\r\n        private string _titleField;\r\n\r\n        /// <exclude />\r\n        public abstract Control GetFormPlaceHolder();\r\n        \r\n        /// <exclude />\r\n        public abstract Control GetMessagePlaceHolder();\r\n\r\n        /// <exclude />\r\n        public abstract void SetContainerTitle(string title);\r\n\r\n        /// <exclude />\r\n        public virtual void SetContainerTooltip(string tooltip)\r\n        {\r\n        }\r\n\r\n        /// <exclude />\r\n        public void SetContainerTitleField(string titleField)\r\n        {\r\n            _titleField = titleField;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string GetTitleFieldControlId()\r\n        {\r\n            IWebUiControl container = GetContainer();\r\n\r\n            if (_titleField.IsNullOrEmpty() || container == null) return string.Empty;\r\n\r\n            var mappings = new Dictionary<string, string>();\r\n\r\n            FormFlowUiDefinitionRenderer.ResolveBindingPathToClientIDMappings(container, mappings);\r\n\r\n            string clientId = mappings.ContainsKey(_titleField) ? mappings[_titleField] : \"\";\r\n\r\n            return clientId;\r\n        }\r\n\r\n        /// <exclude />\r\n        public abstract void SetContainerIcon(ResourceHandle icon);\r\n\r\n\r\n        internal void SetWebUiControlRef(IWebUiControl webUiControl)\r\n        {\r\n            _webUiControl = webUiControl;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected override void OnInit(System.EventArgs e)\r\n        {\r\n            base.OnInit(e);\r\n\r\n            if (!this.IsPostBack)\r\n            {\r\n                _webUiControl.InitializeViewState();\r\n                return;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void OnPreRender(EventArgs e)\r\n        {\r\n            // Initializing lazy controls after PageLoad so the processed Post data will be overwritten\r\n            if (IsPostBack)\r\n            {\r\n                if (_webUiControl is EmbeddedFormUiControl)\r\n                {\r\n                    var container = GetContainer();\r\n                    container?.InitializeLazyBindedControls();\r\n                }\r\n            }\r\n\r\n            base.OnPreRender(e);\r\n        }\r\n\r\n        private TemplatedContainerUiControl GetContainer()\r\n        {\r\n            var container = (_webUiControl as EmbeddedFormUiControl).CompiledUiControl as TemplatedContainerUiControl;\r\n            return container;\r\n        }\r\n\r\n        /// <exclude />\r\n        public abstract void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiContainerFactories/TemplatedUiContainerFactory.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Forms.Flows.Plugins.UiContainerFactory;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiContainerFactories\r\n{\r\n    [ConfigurationElementType(typeof(TemplatedUiContainerFactoryData))]\r\n    internal sealed class TemplatedUiContainerFactory : Base.BaseTemplatedUiContainerFactory\r\n    {\r\n        private TemplatedUiContainerFactoryData _data;\r\n\r\n        public TemplatedUiContainerFactory(TemplatedUiContainerFactoryData data)\r\n            : base(data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n\r\n        public override IUiContainer CreateContainer()\r\n        {\r\n            return new TemplatedUiContainer(this.UserControlType, _data.TemplateFormVirtualPath);\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedUiContainerFactoryAssembler))]\r\n    internal sealed class TemplatedUiContainerFactoryData : UiContainerFactoryData, Base.ITemplatedUiContainerFactoryData\r\n    {\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedUiContainerFactoryAssembler : IAssembler<IUiContainerFactory, UiContainerFactoryData>\r\n    {\r\n        public IUiContainerFactory Assemble(IBuilderContext context, UiContainerFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedUiContainerFactory(objectConfiguration as TemplatedUiContainerFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/Base/BaseTemplatedUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories.Base\r\n{\r\n    internal abstract class BaseTemplatedUiControlFactory : IUiControlFactory\r\n    {\r\n        private ITemplatedUiControlFactoryData _data;\r\n        private Type _cachedUserControlType = null;\r\n        private object _lock = new object();\r\n\r\n        protected BaseTemplatedUiControlFactory(ITemplatedUiControlFactoryData data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n\r\n        protected Type UserControlType\r\n        {\r\n            get\r\n            {\r\n                return this.CachedUserControlType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Type CachedUserControlType\r\n        {\r\n            get\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_cachedUserControlType == null || _data.CacheCompiledUserControlType == false)\r\n                    {\r\n                        using (DebugLoggingScope.CompletionTime(this.GetType(), string.Format(\"getting compiled '{0}'\", _data.UserControlVirtualPath), TimeSpan.FromMilliseconds(25)))\r\n                        {\r\n                            _cachedUserControlType = BuildManagerHelper.GetCompiledType(_data.UserControlVirtualPath);\r\n                        }\r\n                    }\r\n\r\n                    return _cachedUserControlType;\r\n                }\r\n            }\r\n        }\r\n\r\n        public abstract IUiControl CreateControl();\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/Base/ITemplatedUiControlFactoryData.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing System.Configuration;\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories.Base\r\n{\r\n    internal interface ITemplatedUiControlFactoryData\r\n    {\r\n        string UserControlVirtualPath { get; set; }\r\n\r\n        bool CacheCompiledUserControlType { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/Base/UserControlBase.cs",
    "content": "﻿using System.Web.UI;\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories.Base\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class UserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedBoolSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Specialized;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class BoolSelectorTemplateUserControlBase : UserControl, IPostBackDataHandler\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsTrue { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public string TrueLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FalseLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public EventHandler SelectionChangedEventHandler { get; set; }\r\n\r\n        /// <summary>\r\n        /// When implemented by a class, processes postback data for an ASP.NET server control.\r\n        /// </summary>\r\n        /// <param name=\"postDataKey\"></param>\r\n        /// <param name=\"postCollection\"></param>\r\n        /// <returns></returns>\r\n        public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)\r\n        {\r\n            return false;\r\n        }\r\n\r\n        /// <summary>\r\n        /// When implemented by a class, signals the server control to notify the ASP.NET application that the state of the control has changed.\r\n        /// </summary>\r\n        public virtual void RaisePostDataChangedEvent()\r\n        {\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedBoolSelectorUiControl : BoolSelectorUiControl, IWebUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private BoolSelectorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedBoolSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.IsTrue = _userControl.IsTrue;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<BoolSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.IsTrue = this.IsTrue;\r\n            _userControl.TrueLabel = this.TrueLabel;\r\n            _userControl.FalseLabel = this.FalseLabel;\r\n            _userControl.SelectionChangedEventHandler += this.SelectionChangedEventHandler;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl => false;\r\n\r\n        public string ClientName => _userControl.GetDataFieldClientName();\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedBoolSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedBoolSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedBoolSelectorUiControlFactory(TemplatedBoolSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            var control = new TemplatedBoolSelectorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedBoolSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedBoolSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedBoolSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedBoolSelectorUiControlFactory(objectConfiguration as TemplatedBoolSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedButtonUiControlFactory.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ButtonTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n        private EventHandler _clickEventHandler;\r\n\r\n        /// <exclude />\r\n        public EventHandler FormControlClickEventHandler\r\n        {\r\n            get { return _clickEventHandler; }\r\n            set { _clickEventHandler = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n    }\r\n\r\n    internal sealed class TemplatedButtonUiControl : ButtonUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n\r\n        internal TemplatedButtonUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n        }\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            ButtonTemplateUserControlBase userControl = _userControlType.ActivateAsUserControl<ButtonTemplateUserControlBase>(this.UiControlID);\r\n\r\n            userControl.FormControlLabel = this.Label;\r\n            userControl.FormControlClickEventHandler += this.ClickEventHandler;\r\n\r\n            return userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedButtonUiControlFactoryData))]\r\n    internal sealed class TemplatedButtonUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedButtonUiControlFactory(TemplatedButtonUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedButtonUiControl control = new TemplatedButtonUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedButtonUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedButtonUiControlFactoryData : ButtonUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedButtonUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedButtonUiControlFactory(objectConfiguration as TemplatedButtonUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedCheckBoxUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Specialized;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class CheckBoxTemplateUserControlBase : UserControl, IPostBackDataHandler\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool Checked { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ItemLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public EventHandler CheckedChangedEventHandler { get; set; }\r\n\r\n        /// <summary>\r\n        /// When implemented by a class, processes postback data for an ASP.NET server control.\r\n        /// </summary>\r\n        /// <param name=\"postDataKey\"></param>\r\n        /// <param name=\"postCollection\"></param>\r\n        /// <returns></returns>\r\n        public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)\r\n        {\r\n            return false;\r\n        }\r\n\r\n        /// <summary>\r\n        /// When implemented by a class, signals the server control to notify the ASP.NET application that the state of the control has changed.\r\n        /// </summary>\r\n        public virtual void RaisePostDataChangedEvent()\r\n        {\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedCheckBoxUiControl : CheckBoxUiControl, IWebUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private CheckBoxTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedCheckBoxUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Checked = _userControl.Checked;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<CheckBoxTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Checked = this.Checked;\r\n            _userControl.ItemLabel = this.ItemLabel;\r\n            _userControl.CheckedChangedEventHandler += this.CheckedChangedEventHandler;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl => false;\r\n\r\n        public string ClientName => _userControl.GetDataFieldClientName();\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedCheckBoxUiControlFactoryData))]\r\n    internal sealed class TemplatedCheckBoxUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedCheckBoxUiControlFactory(TemplatedCheckBoxUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            var control = new TemplatedCheckBoxUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedCheckBoxUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedCheckBoxUiControlFactoryData : CheckBoxUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedCheckBoxUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedCheckBoxUiControlFactory(objectConfiguration as TemplatedCheckBoxUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedContainerUiControlFactory.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing Composite.Core;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>\r\n    /// Use this as base type for User Controls that render a Forms UiControl Container.\r\n    /// Access details about child elements through the FormControlDefinitions property.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ContainerTemplateUserControlBase : UserControl\r\n    {\r\n        private readonly List<FormControlDefinition> _formControlDefinitions = new List<FormControlDefinition>();\r\n        private readonly Dictionary<string, object> _settings = new Dictionary<string, object>();\r\n\r\n        internal List<LazyLoadedContainerInfo> LazyLoadedChildControlIDs { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Help { get; set; }\r\n\r\n        /// <exclude />\r\n        public int PreSelectedIndex { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, object> Settings { get { return _settings; } }\r\n\r\n        /// <exclude />\r\n        public List<FormControlDefinition> FormControlDefinitions\r\n        {\r\n            get { return _formControlDefinitions; }\r\n        }\r\n\r\n\r\n        internal void AddFormControlDefinition(string label, Control formControl, string help, bool isFullWidthControl)\r\n        {\r\n            if (label == null) label = \"\";\r\n\r\n            string toolTip = label;\r\n\r\n            var definition = new FormControlDefinition(label, toolTip, formControl, help, isFullWidthControl);\r\n\r\n            _formControlDefinitions.Add(definition);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected void RegisterLazyChildControl(int childIndex, string postBackName)\r\n        {\r\n            if (this.LazyLoadedChildControlIDs == null)\r\n            {\r\n                this.LazyLoadedChildControlIDs = new List<LazyLoadedContainerInfo>();\r\n            }\r\n\r\n            this.LazyLoadedChildControlIDs.Add(new LazyLoadedContainerInfo { ChildIndex = childIndex, PostBackName = postBackName });\r\n        }\r\n\r\n\r\n\r\n\r\n        #region support classes\r\n        /// <exclude />\r\n        public class FormControlDefinition\r\n        {\r\n            private string _label;\r\n            private string _toolTip;\r\n            private Control _formControl;\r\n            private string _help;\r\n            private bool _isFullWidthControl;\r\n\r\n            internal FormControlDefinition(string label, string toolTip, Control formControl, string help, bool isFullWidthControl)\r\n            {\r\n                _label = label ?? \"\";\r\n                _toolTip = toolTip;\r\n                _formControl = formControl;\r\n                _help = help;\r\n                _isFullWidthControl = isFullWidthControl;\r\n            }\r\n\r\n            /// <exclude />\r\n            public bool IsFullWidthControl\r\n            {\r\n                get { return _isFullWidthControl; }\r\n            }\r\n\r\n            /// <exclude />\r\n            public string Help\r\n            {\r\n                get { return _help; }\r\n            }\r\n\r\n            /// <exclude />\r\n            public string ToolTip\r\n            {\r\n                get { return _toolTip; }\r\n            }\r\n\r\n            /// <exclude />\r\n            public string Label\r\n            {\r\n                get { return _label; }\r\n            }\r\n\r\n            /// <exclude />\r\n            public Control FormControl\r\n            {\r\n                get { return _formControl; }\r\n            }\r\n        }\r\n\r\n\r\n        internal class LazyLoadedContainerInfo\r\n        {\r\n            public int ChildIndex { get; set; }\r\n            public string PostBackName { get; set; }\r\n        }\r\n#endregion\r\n\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedTabbedContainerUiControl : TemplatedContainerUiControl, ITabbedContainerUiControl\r\n    {\r\n        internal TemplatedTabbedContainerUiControl(Type userControlType)\r\n            : base( userControlType ) \r\n        {\r\n            this.PreSelectedIndex = 0;\r\n        }\r\n\r\n        [FormsProperty()]\r\n        public int PreSelectedIndex { get; set; }\r\n    }\r\n\r\n\r\n\r\n    internal class TemplatedContainerUiControl : ContainerUiControlBase, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private ContainerTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedContainerUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            int childIndex = 0;\r\n            foreach (IUiControl childControl in this.UiControls)\r\n            {\r\n                if (ControlIsActive(childIndex))\r\n                {\r\n                    childControl.BindStateToControlProperties();\r\n                }\r\n                else\r\n                {\r\n                    IWebUiControl childWebUIControl = (childControl as IWebUiControl);\r\n                    Verify.IsNotNull(childWebUIControl, \"Child control has to inherit '{0}' interface\", typeof(IWebUiControl).FullName);\r\n\r\n                    childWebUIControl.InitializeViewState();\r\n                }\r\n\r\n                childIndex++;\r\n            }\r\n        }\r\n\r\n        private bool ControlIsActive(int childIndex)\r\n        {\r\n            if (_userControl.LazyLoadedChildControlIDs != null)\r\n            {\r\n                var lazyInfo = _userControl.LazyLoadedChildControlIDs.FirstOrDefault(f => f.ChildIndex == childIndex);\r\n\r\n                if (lazyInfo != null)\r\n                {\r\n                    string lazyContainerActivated = _userControl.Request[lazyInfo.PostBackName];\r\n                    if (lazyContainerActivated == \"false\")\r\n                    {\r\n                        return false;\r\n                    }\r\n\r\n                    if (lazyContainerActivated != \"true\")\r\n                    {\r\n                        Log.LogWarning(\"UiControlContainer\", \"Posibility of data corruption detected. Unexpected lazy bound state information from client. Expected 'true' or 'false', got '{0}' for post back field '{1}'. Will try to bind on child controls.\", lazyContainerActivated, lazyInfo.PostBackName);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            foreach (IUiControl tab in this.UiControls)\r\n            {\r\n                IWebUiControl WebUiChild = tab as IWebUiControl;\r\n                WebUiChild.InitializeViewState();\r\n            }\r\n        }\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<ContainerTemplateUserControlBase>(this.UiControlID);\r\n            _userControl.Label = this.Label;\r\n            _userControl.Help = this.Help;\r\n\r\n            if (this is ITabbedContainerUiControl)\r\n            {\r\n                _userControl.PreSelectedIndex = ((ITabbedContainerUiControl)this).PreSelectedIndex;\r\n            }\r\n            else\r\n            {\r\n                _userControl.PreSelectedIndex = -1;\r\n            }\r\n\r\n            foreach (IUiControl tab in this.UiControls)\r\n            {\r\n                IWebUiControl WebUiChild = tab as IWebUiControl;\r\n                Control WebChild = WebUiChild.BuildWebControl();\r\n                _userControl.AddFormControlDefinition(tab.Label, WebChild, tab.Help, WebUiChild.IsFullWidthControl);\r\n            }\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get; internal set; }\r\n\r\n        public string ClientName { get { return null; } }\r\n\r\n        public override void InitializeLazyBindedControls()\r\n        {\r\n            int childIndex = 0;\r\n            foreach (IUiControl childControl in this.UiControls)\r\n            {\r\n                if (ControlIsActive(childIndex))\r\n                {\r\n                    if (childControl is TemplatedContainerUiControl)\r\n                    {\r\n                        (childControl as TemplatedContainerUiControl).InitializeLazyBindedControls();\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    IWebUiControl childWebUIControl = (childControl as IWebUiControl);\r\n                    Verify.IsNotNull(childWebUIControl, \"Child control has to inherit '{0}' interface\", typeof(IWebUiControl).FullName);\r\n\r\n                    childWebUIControl.InitializeViewState();\r\n                }\r\n\r\n                childIndex++;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedContainerUiControlFactoryData))]\r\n    internal sealed class TemplatedContainerUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        private TemplatedContainerUiControlFactoryData _data;\r\n\r\n        public TemplatedContainerUiControlFactory(TemplatedContainerUiControlFactoryData data)\r\n            : base(data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedContainerUiControl control;\r\n\r\n            if (_data.IsTabbedContainer)\r\n            {\r\n                control = new TemplatedTabbedContainerUiControl(this.UserControlType);\r\n            }\r\n            else\r\n            {\r\n                control = new TemplatedContainerUiControl(this.UserControlType);\r\n            }\r\n\r\n            control.IsFullWidthControl = _data.IsFullWidthControl;\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedContainerUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedContainerUiControlFactoryData : ContainerUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n        private const string _isTabbedContainerPropertyName = \"IsTabbedContainer\";\r\n        private const string _isFullWidthControlPropertyName = \"IsFullWidthControl\";\r\n        \r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_isTabbedContainerPropertyName, IsRequired = false, DefaultValue = false)]\r\n        public bool IsTabbedContainer\r\n        {\r\n            get { return (bool)base[_isTabbedContainerPropertyName]; }\r\n            set { base[_isTabbedContainerPropertyName] = value; }\r\n        }\r\n\r\n\r\n        [ConfigurationProperty(_isFullWidthControlPropertyName, IsRequired = false, DefaultValue = false)]\r\n        public bool IsFullWidthControl\r\n        {\r\n            get { return (bool)base[_isFullWidthControlPropertyName]; }\r\n            set { base[_isFullWidthControlPropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedContainerUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedContainerUiControlFactory(objectConfiguration as TemplatedContainerUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedDataReferenceSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories.Base;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class DataReferenceSelectorTemplateUserControlBase : UserControlBase\r\n    {\r\n        /// <exclude />\r\n        public IDataReference Selected { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public Type DataType { get; set; }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class TemplatedDataReferenceSelectorUiControl : DataReferenceSelectorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private DataReferenceSelectorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedDataReferenceSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Selected = _userControl.Selected;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<DataReferenceSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Selected = this.Selected as IDataReference;\r\n            _userControl.DataType = this.DataType;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedDataReferenceSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedDataReferenceSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedDataReferenceSelectorUiControlFactory(TemplatedDataReferenceSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedDataReferenceSelectorUiControl control = new TemplatedDataReferenceSelectorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedDataReferenceSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedDataReferenceSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedDataReferenceSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedDataReferenceSelectorUiControlFactory(objectConfiguration as TemplatedDataReferenceSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedDataReferenceTreeSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories.Base;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class DataReferenceTreeSelectorTemplateUserControlBase : UserControlBase\r\n    {\r\n        /// <exclude />\r\n        public string Selected { get; set; }\r\n\r\n        /// <exclude />\r\n        public Type DataType { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool NullValueAllowed { get; set; }\r\n\r\n        /// <summary>\r\n        /// Defines which kind of dialog and data provider elements are to be shown\r\n        /// </summary>\r\n        public string Handle { get; set; }\r\n\r\n        /// <exclude />\r\n        public string SearchToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public string RootEntityToken { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<ClientValidationRule> ClientValidationRules { get; set; }\r\n    }\r\n\r\n    internal sealed class TemplatedDataReferenceTreeSelectorUiControl : DataReferenceTreeSelectorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private DataReferenceTreeSelectorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedDataReferenceTreeSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Selected = _userControl.Selected;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<DataReferenceTreeSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Selected = this.Selected;\r\n            _userControl.NullValueAllowed = this.NullValueAllowed;\r\n            _userControl.DataType = this.DataType;\r\n            _userControl.Handle = this.Handle;\r\n            _userControl.SearchToken = this.SearchToken;\r\n            _userControl.RootEntityToken = this.RootEntityToken;\r\n            _userControl.ClientValidationRules = this.ClientValidationRules;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedDataReferenceTreeSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedDataReferenceTreeSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedDataReferenceTreeSelectorUiControlFactory(TemplatedDataReferenceTreeSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedDataReferenceTreeSelectorUiControl control = new TemplatedDataReferenceTreeSelectorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedDataReferenceTreeSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedDataReferenceTreeSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedDataReferenceTreeSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedDataReferenceTreeSelectorUiControlFactory(objectConfiguration as TemplatedDataReferenceTreeSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedDateTimeSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public abstract class DateTimeSelectorTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n        private DateTime? _date;\r\n\r\n        /// <exclude />\r\n        public abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        public abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public DateTime? Date\r\n        {\r\n            get { return _date; }\r\n            set { _date = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsValid\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ValidationError\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool ReadOnly\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool ShowHours\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool Required\r\n        {\r\n            get;\r\n            set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedDateTimeSelectorUiControl : DateTimeSelectorUiControl, IWebUiControl, IValidatingUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private DateTimeSelectorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedDateTimeSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Date = _userControl.Date;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<DateTimeSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Date = this.Date;\r\n            _userControl.ReadOnly = this.ReadOnly;\r\n            _userControl.ShowHours = this.ShowHours;\r\n            _userControl.IsValid = true;\r\n            _userControl.Required = this.Required;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl => false;\r\n\r\n        public string ClientName => _userControl.GetDataFieldClientName();\r\n\r\n        public bool IsValid => _userControl.IsValid;\r\n\r\n        public bool ShowHours\r\n        {\r\n            get; set;\r\n        }\r\n\r\n        public string ValidationError => _userControl.ValidationError;\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedDateTimeSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedDateTimeSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        private readonly bool _showHours;\r\n\r\n        public TemplatedDateTimeSelectorUiControlFactory(TemplatedDateTimeSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        {\r\n            _showHours = data.ShowHours;\r\n        }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            return new TemplatedDateTimeSelectorUiControl(this.UserControlType)\r\n            {\r\n                ShowHours = _showHours\r\n            };\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedDateTimeSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedDateTimeSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n        private const string _showHoursPropertyName = \"showHours\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_showHoursPropertyName, IsRequired = true)]\r\n        public bool ShowHours\r\n        {\r\n            get { return (bool)base[_showHoursPropertyName]; }\r\n            set { base[_showHoursPropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedDateTimeSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedDateTimeSelectorUiControlFactory(objectConfiguration as TemplatedDateTimeSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedDoubleSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Composite.C1Console.Forms.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public abstract class TemplatedDoubleKeySelectorUserControlBase : UserControl\r\n    {\r\n        private List<KeyLabelPair> _options = null;\r\n\r\n\r\n        /// <exclude />\r\n        public object FirstKey { get; set; }\r\n\r\n        /// <exclude />\r\n        public object SecondKey { get; set; }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Tuple<object, object, string>> Options { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool Required { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        /// <exclude />\r\n        protected List<KeyLabelPair> GetOptions()\r\n        {\r\n            if (_options == null)\r\n            {\r\n                _options = new List<KeyLabelPair>();\r\n\r\n                foreach (var tuple in Options)\r\n                {\r\n                    _options.Add(new KeyLabelPair(GetKey(tuple), tuple.Item3));\r\n                }\r\n            }\r\n\r\n            return _options;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected string GetKey(Tuple<object, object, string> tuple)\r\n        {\r\n            return GetKey(tuple.Item1, tuple.Item2);\r\n        }\r\n\r\n        /// <exclude />\r\n        protected string GetKey(object firstKey, object secondKey)\r\n        {\r\n            return (firstKey ?? \"null\") + \"|\" + (secondKey ?? \"null\");\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public sealed class TemplatedDoubleKeySelectorUiControl : UiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private TemplatedDoubleKeySelectorUserControlBase _userControl;\r\n\r\n\r\n        /// <exclude />\r\n        [BindableProperty]\r\n        public object FirstKey { get; set; }\r\n\r\n        /// <exclude />\r\n        [BindableProperty]\r\n        public object SecondKey { get; set; }\r\n\r\n        /// <exclude />\r\n        [FormsProperty]\r\n        public IEnumerable<Tuple<object, object, string>> Options { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        [FormsProperty]\r\n        public bool Required { get; set; }\r\n\r\n        /*[BindableProperty()]\r\n        [FormsProperty()]\r\n        public object Selected { get; set; }*/\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public TemplatedDoubleKeySelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n\r\n            FirstKey = _userControl.FirstKey;\r\n            SecondKey = _userControl.SecondKey;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<TemplatedDoubleKeySelectorUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FirstKey = this.FirstKey;\r\n            _userControl.SecondKey = this.SecondKey;\r\n            _userControl.Options = this.Options;\r\n            _userControl.Required = this.Required;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n\r\n        /// <exclude />\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedDoubleKeySelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedDoubleKeySelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {                     \r\n        private TemplatedDoubleKeySelectorUiControlFactoryData _data;\r\n\r\n        public TemplatedDoubleKeySelectorUiControlFactory(TemplatedDoubleKeySelectorUiControlFactoryData data)\r\n            : base(data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            return new TemplatedDoubleKeySelectorUiControl(this.UserControlType);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedDoubleKeySelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedDoubleKeySelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedDoubleKeySelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedDoubleKeySelectorUiControlFactory(objectConfiguration as TemplatedDoubleKeySelectorUiControlFactoryData);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedEnumSelectorUiControlFactory.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class EnumSelectorTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n        private string _selected;\r\n\r\n        private TemplatedEnumSelectorUiControl _typeOptionsProxy;\r\n\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        internal void SetTypeOptionsProxy(TemplatedEnumSelectorUiControl proxy)\r\n        {\r\n            _typeOptionsProxy = proxy;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Selected\r\n        {\r\n            get { return _selected; }\r\n            set { _selected = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<string> Options\r\n        {\r\n            get\r\n            {\r\n                return _typeOptionsProxy.FetchOptions();\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedEnumSelectorUiControl : EnumSelectorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private EnumSelectorTemplateUserControlBase _userControl;\r\n\r\n\r\n        internal TemplatedEnumSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Selected = _userControl.Selected;\r\n        }\r\n\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<EnumSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Selected = this.Selected;\r\n            _userControl.SetTypeOptionsProxy(this);\r\n\r\n            return _userControl;\r\n        }\r\n\r\n\r\n        internal IEnumerable<string> FetchOptions()\r\n        {\r\n            return Enum.GetNames(base.EnumType);\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedEnumSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedEnumSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedEnumSelectorUiControlFactory(TemplatedEnumSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedEnumSelectorUiControl control = new TemplatedEnumSelectorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedEnumSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedEnumSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedEnumSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedEnumSelectorUiControlFactory(objectConfiguration as TemplatedEnumSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedFileUploadUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class FileUploadTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public UploadedFile UploadedFile { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedFileUploadUiControl : FileUploadUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private FileUploadTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedFileUploadUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.UploadedFile = _userControl.UploadedFile;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<FileUploadTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.UploadedFile = this.UploadedFile;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n\r\n        /// <exclude />\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedFileUploadUiControlFactoryData))]\r\n    internal sealed class TemplatedFileUploadUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedFileUploadUiControlFactory(TemplatedFileUploadUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedFileUploadUiControl control = new TemplatedFileUploadUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedFileUploadUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedFileUploadUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedFileUploadUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedFileUploadUiControlFactory(objectConfiguration as TemplatedFileUploadUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedFontIconSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class FontIconSelectorTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string SelectedClassName { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string,string> ClassNameOptions { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ClassNamePrefix { get; set; }\r\n\r\n        /// <exclude />\r\n        public string StylesheetPath { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool Required { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<ClientValidationRule> ClientValidationRules { get; set; }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedFontIconSelectorUiControl : FontIconSelectorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private FontIconSelectorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedFontIconSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.SelectedClassName = _userControl.SelectedClassName;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<FontIconSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.SelectedClassName = this.SelectedClassName;\r\n            _userControl.ClientValidationRules = this.ClientValidationRules;\r\n            _userControl.StylesheetPath = this.StylesheetPath;\r\n            _userControl.ClassNamePrefix = this.ClassNamePrefix;\r\n            _userControl.Required = this.Required;\r\n\r\n            if (this.ClassNameOptions is string)\r\n            {\r\n                _userControl.ClassNameOptions = ((string)this.ClassNameOptions).Split(',').ToDictionary(f=>f);\r\n            }\r\n            else\r\n            {\r\n                if (this.ClassNameOptions is IEnumerable<string>)\r\n                {\r\n                    _userControl.ClassNameOptions = ((IEnumerable<string>)this.ClassNameOptions).ToDictionary(f => f);\r\n                }\r\n                else\r\n                {\r\n                    if (this.ClassNameOptions is Dictionary<string,string>)\r\n                    {\r\n                        _userControl.ClassNameOptions = (Dictionary<string, string>)this.ClassNameOptions;\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new NotImplementedException(\"ClassNameOptions should be either a (comma seperated) string, a IEnumerable<string> or a Dictionary<string,string>.\");\r\n                    }\r\n                }\r\n            }\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedFontIconSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedFontIconSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedFontIconSelectorUiControlFactory(TemplatedFontIconSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedFontIconSelectorUiControl control = new TemplatedFontIconSelectorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedFontIconSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedFontIconSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedFontIconSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedFontIconSelectorUiControlFactory(objectConfiguration as TemplatedFontIconSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedFunctionParameterDesignerUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class FunctionParameterDesignerTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        public abstract string SessionStateProvider { get; set; }\r\n\r\n        /// <exclude />\r\n        public abstract Guid SessionStateId { get; set; }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedFunctionParameterDesignerUiControl : FunctionParameterDesignerUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private FunctionParameterDesignerTemplateUserControlBase _userControl;\r\n        private string _sessionStateProvider;\r\n        private Guid _sessionStateId;\r\n\r\n        internal TemplatedFunctionParameterDesignerUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<FunctionParameterDesignerTemplateUserControlBase>(this.UiControlID);\r\n            _userControl.SessionStateProvider = _sessionStateProvider;\r\n            _userControl.SessionStateId = _sessionStateId;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public override string SessionStateProvider\r\n        {\r\n            get { return _sessionStateProvider; }\r\n            set { _sessionStateProvider = value; }\r\n        }\r\n\r\n        public override Guid SessionStateId\r\n        {\r\n            get { return _sessionStateId; }\r\n            set { _sessionStateId = value; }\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return null; /* _userControl.GetDataFieldClientName(); */ } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedFunctionParameterDesignerUiControlFactoryData))]\r\n    internal sealed class TemplatedFunctionParameterDesignerUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedFunctionParameterDesignerUiControlFactory(TemplatedFunctionParameterDesignerUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            return new TemplatedFunctionParameterDesignerUiControl(this.UserControlType);\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedFunctionParameterDesignerUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedFunctionParameterDesignerUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedFunctionParameterDesignerUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedFunctionParameterDesignerUiControlFactory(objectConfiguration as TemplatedFunctionParameterDesignerUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedHeadingUiControlFactory.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class HeadingTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public string Title { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string Description { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n    }\r\n\r\n    internal sealed class TemplatedHeadingUiControl : HeadingUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private HeadingTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedHeadingUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<HeadingTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Title = this.Title;\r\n            _userControl.Description = this.Description;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedHeadingUiControlFactoryData))]\r\n    internal sealed class TemplatedHeadingUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedHeadingUiControlFactory(TemplatedHeadingUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedHeadingUiControl control = new TemplatedHeadingUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedHeadingUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedHeadingUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedHeadingUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext conHeading, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedHeadingUiControlFactory(objectConfiguration as TemplatedHeadingUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedHierarchicalSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class HierarchicalSelectorTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<object> SelectedKeys { get; set; }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<SelectionTreeNode> TreeNodes { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool AutoSelectChildren { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool AutoSelectParents { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool Required { get; set; }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedHierarchicalSelectorUiControl : HierarchicalSelectorUiControl, IWebUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private HierarchicalSelectorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedHierarchicalSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n\r\n            this.SelectedKeys = _userControl.SelectedKeys;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<HierarchicalSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.SelectedKeys = this.SelectedKeys;\r\n            _userControl.TreeNodes = this.TreeNodes;\r\n            _userControl.AutoSelectChildren = this.AutoSelectChildren;\r\n            _userControl.AutoSelectParents = this.AutoSelectParents;\r\n            _userControl.Required = this.Required;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl => false;\r\n\r\n        public string ClientName => _userControl.GetDataFieldClientName();\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedHierarchicalSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedHierarchicalSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedHierarchicalSelectorUiControlFactory(TemplatedHierarchicalSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            var control = new TemplatedHierarchicalSelectorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedHierarchicalSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedHierarchicalSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedHierarchicalSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedHierarchicalSelectorUiControlFactory(\r\n                objectConfiguration as TemplatedHierarchicalSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedHtmlBlobUiControlFactory.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class HtmlBlobTemplateUserControlBase : UserControl\r\n    {\r\n        private string _html;\r\n\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Html\r\n        {\r\n            get { return _html; }\r\n            set { _html = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedHtmlBlobUiControl : HtmlBlobUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private HtmlBlobTemplateUserControlBase _userControl;\r\n\r\n\r\n        internal TemplatedHtmlBlobUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Html = _userControl.Html;\r\n        }\r\n\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<HtmlBlobTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.Html = this.Html;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedHtmlBlobUiControlFactoryData))]\r\n    internal sealed class TemplatedHtmlBlobUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedHtmlBlobUiControlFactory(TemplatedHtmlBlobUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedHtmlBlobUiControl control = new TemplatedHtmlBlobUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedHtmlBlobUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedHtmlBlobUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedHtmlBlobUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedHtmlBlobUiControlFactory(objectConfiguration as TemplatedHtmlBlobUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedInfoTableUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class InfoTableTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<string> Headers { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public List<List<string>> Rows { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string Caption { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public bool Border { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }        \r\n    }\r\n\r\n    internal sealed class TemplatedInfoTableUiControl : InfoTableUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private InfoTableTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedInfoTableUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<InfoTableTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Headers = this.Headers;\r\n            _userControl.Rows = this.Rows;\r\n            _userControl.Caption = this.Caption;\r\n            _userControl.Border = this.Border;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedInfoTableUiControlFactoryData))]\r\n    internal sealed class TemplatedInfoTableUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedInfoTableUiControlFactory(TemplatedInfoTableUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedInfoTableUiControl control = new TemplatedInfoTableUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedInfoTableUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedInfoTableUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedInfoTableUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedInfoTableUiControlFactory(objectConfiguration as TemplatedInfoTableUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedMultiContentXhtmlEditorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class MultiContentXhtmlEditorTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string DefaultPlaceholderId { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string, string> PlaceholderDefinitions { get; set; }\r\n        /// <exclude />\r\n        public Dictionary<string, string> PlaceholderContainerClasses { get; set; }\r\n\r\n        /// <exclude />\r\n        public Dictionary<string,string> NamedXhtmlFragments { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Type> EmbedableFieldsTypes { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ClassConfigurationName { get; set; }\r\n    }\r\n\r\n    internal sealed class TemplatedMultiContentXhtmlEditorUiControl : MultiContentXhtmlEditorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private MultiContentXhtmlEditorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedMultiContentXhtmlEditorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n            this.NamedXhtmlFragments = new Dictionary<string, string>();\r\n            this.PlaceholderDefinitions = new Dictionary<string, string>();\r\n            this.PlaceholderContainerClasses = new Dictionary<string, string>();\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.NamedXhtmlFragments = _userControl.NamedXhtmlFragments;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<MultiContentXhtmlEditorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.EmbedableFieldsTypes = this.EmbedableFieldsTypes;\r\n            _userControl.DefaultPlaceholderId = this.DefaultPlaceholderId;\r\n            _userControl.PlaceholderDefinitions = this.PlaceholderDefinitions;\r\n            _userControl.PlaceholderContainerClasses = this.PlaceholderContainerClasses;\r\n            _userControl.NamedXhtmlFragments = this.NamedXhtmlFragments;\r\n            _userControl.ClassConfigurationName = this.ClassConfigurationName;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedMultiContentXhtmlEditorUiControlFactoryData))]\r\n    internal sealed class TemplatedMultiContentXhtmlEditorUiControlFactory : IUiControlFactory\r\n    {\r\n        private TemplatedMultiContentXhtmlEditorUiControlFactoryData _data;\r\n        private Type _cachedUserControlType = null;\r\n\r\n        public TemplatedMultiContentXhtmlEditorUiControlFactory(TemplatedMultiContentXhtmlEditorUiControlFactoryData data)\r\n        {\r\n            _data = data;\r\n\r\n            if (_data.CacheCompiledUserControlType)\r\n            {\r\n                _cachedUserControlType = BuildManagerHelper.GetCompiledType(_data.UserControlVirtualPath);\r\n            }\r\n        }\r\n\r\n        public IUiControl CreateControl()\r\n        {\r\n            Type userControlType = _cachedUserControlType;\r\n\r\n            if (userControlType == null && System.Web.HttpContext.Current!=null)\r\n            {\r\n                userControlType = BuildManagerHelper.GetCompiledType(_data.UserControlVirtualPath);\r\n            }\r\n\r\n            TemplatedMultiContentXhtmlEditorUiControl control = new TemplatedMultiContentXhtmlEditorUiControl(userControlType);\r\n\r\n            control.ClassConfigurationName = _data.ClassConfigurationName;\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedMultiContentXhtmlEditorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedMultiContentXhtmlEditorUiControlFactoryData : UiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n\r\n        private const string _classConfigurationNamePropertyName = \"ClassConfigurationName\";\r\n        [ConfigurationProperty(_classConfigurationNamePropertyName, IsRequired = false, DefaultValue = \"common\")]\r\n        public string ClassConfigurationName\r\n        {\r\n            get { return (string)base[_classConfigurationNamePropertyName]; }\r\n            set { base[_classConfigurationNamePropertyName] = value; }\r\n        }\r\n\r\n    }\r\n\r\n    internal sealed class TemplatedMultiContentXhtmlEditorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedMultiContentXhtmlEditorUiControlFactory(objectConfiguration as TemplatedMultiContentXhtmlEditorUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedNamedFunctionCallsDesignerUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class FunctionCallsDesignerTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        public abstract string SessionStateProvider { get; set; }\r\n\r\n        /// <exclude />\r\n        public abstract Guid SessionStateId { get; set; }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedFunctionCallsDesignerUiControl : FunctionCallsDesignerUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private FunctionCallsDesignerTemplateUserControlBase _userControl;\r\n        private string _sessionStateProvider;\r\n        private Guid _sessionStateId;\r\n\r\n        internal TemplatedFunctionCallsDesignerUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<FunctionCallsDesignerTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.SessionStateProvider = _sessionStateProvider;\r\n            _userControl.SessionStateId = _sessionStateId;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public override string SessionStateProvider\r\n        {\r\n            get { return _sessionStateProvider; }\r\n            set { _sessionStateProvider = value; }\r\n        }\r\n\r\n        public override Guid SessionStateId\r\n        {\r\n            get { return _sessionStateId; }\r\n            set { _sessionStateId = value; }\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return null; /* _userControl.GetDataFieldClientName(); */ } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedFunctionCallsDesignerUiControlFactoryData))]\r\n    internal sealed class TemplatedFunctionCallsDesignerUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedFunctionCallsDesignerUiControlFactory(TemplatedFunctionCallsDesignerUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedFunctionCallsDesignerUiControl control = new TemplatedFunctionCallsDesignerUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedFunctionCallsDesignerUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedFunctionCallsDesignerUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedFunctionCallsDesignerUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedFunctionCallsDesignerUiControlFactory(objectConfiguration as TemplatedFunctionCallsDesignerUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedPageReferenceSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories.Base;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class PageReferenceSelectorTemplateUserControlBase : UserControlBase\r\n    {\r\n        private DataReference<IPage> _selected;\r\n\r\n        /// <exclude />\r\n        public DataReference<IPage> Selected\r\n        {\r\n            get { return _selected; }\r\n            set { _selected = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public List<ClientValidationRule> ClientValidationRules { get; set; }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedPageReferenceSelectorUiControl : PageReferenceSelectorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private PageReferenceSelectorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedPageReferenceSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Selected = _userControl.Selected;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<PageReferenceSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Selected = this.Selected;\r\n            _userControl.ClientValidationRules = this.ClientValidationRules;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n    [ConfigurationElementType(typeof(TemplatedPageReferenceSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedPageReferenceSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedPageReferenceSelectorUiControlFactory(TemplatedPageReferenceSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedPageReferenceSelectorUiControl control = new TemplatedPageReferenceSelectorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedPageReferenceSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedPageReferenceSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedPageReferenceSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedPageReferenceSelectorUiControlFactory(objectConfiguration as TemplatedPageReferenceSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedPreviewTabPanelUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>\r\n    /// Use this as base type for User Controls that render a Forms UiControl PreviewTabPanel.\r\n    /// Access details about child elements through the FormControlDefinitions property.\r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class PreviewTabPanelTemplateUserControlBase : UserControl, IClickableTabPanelControl\r\n    {\r\n        private string _formControlLabel;\r\n        private EventHandler _clickEventHandler;\r\n\r\n        /// <exclude />\r\n        public EventHandler FormControlClickEventHandler\r\n        {\r\n            get { return _clickEventHandler; }\r\n            set { _clickEventHandler = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string CustomTabId { get; set; }\r\n\r\n        /// <exclude />\r\n        public Control EventControl  { get; set; }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedPreviewTabPanelUiControl : ButtonUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private string _clientTabId;\r\n\r\n        internal TemplatedPreviewTabPanelUiControl(Type userControlType, string clientTabId)\r\n        {\r\n            _userControlType = userControlType;\r\n            _clientTabId = clientTabId;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n        }\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            PreviewTabPanelTemplateUserControlBase userControl = _userControlType.ActivateAsUserControl<PreviewTabPanelTemplateUserControlBase>(this.UiControlID);\r\n\r\n            userControl.FormControlLabel = this.Label;\r\n            userControl.FormControlClickEventHandler += this.ClickEventHandler;\r\n            userControl.CustomTabId = _clientTabId;\r\n            LinkButton shadowLinkButton = new LinkButton();\r\n            shadowLinkButton.Style.Add( \"display\", \"none\" );\r\n            shadowLinkButton.ID = \"Preview\";\r\n            shadowLinkButton.Text = \"Preview\";\r\n            shadowLinkButton.Click += this.ClickEventHandler;\r\n            userControl.EventControl = shadowLinkButton;\r\n\r\n            return userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedPreviewTabPanelUiControlFactoryData))]\r\n    internal sealed class TemplatedPreviewTabPanelUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        private TemplatedPreviewTabPanelUiControlFactoryData _data;\r\n\r\n        public TemplatedPreviewTabPanelUiControlFactory(TemplatedPreviewTabPanelUiControlFactoryData data)\r\n            : base(data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedPreviewTabPanelUiControl control = new TemplatedPreviewTabPanelUiControl(this.UserControlType,_data.ClientTabId);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedPreviewTabPanelUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedPreviewTabPanelUiControlFactoryData : ButtonUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _clientTabIdPropertyName = \"ClientTabId\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_clientTabIdPropertyName, IsRequired = true)]\r\n        public string ClientTabId\r\n        {\r\n            get { return (string)base[_clientTabIdPropertyName]; }\r\n            set { base[_clientTabIdPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedPreviewTabPanelUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedPreviewTabPanelUiControlFactory(objectConfiguration as TemplatedPreviewTabPanelUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedQueryCallDefinitionsEditorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class QueryCallDefinitionsEditorTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<KeyValuePair<string, Guid>> Queries { get; set; }\r\n\r\n        /// <exclude />\r\n        public ILookup<string, KeyValuePair<string, string>> Parameters { get; set; }\r\n\r\n        /// <exclude />\r\n        public string UserProvidedPreviewXml { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedQueryCallDefinitionsEditorUiControl : QueryCallDefinitionsEditorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private QueryCallDefinitionsEditorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedQueryCallDefinitionsEditorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Queries = _userControl.Queries;\r\n            this.Parameters = _userControl.Parameters;\r\n            this.UserProvidedPreviewXml = _userControl.UserProvidedPreviewXml;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<QueryCallDefinitionsEditorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Queries = this.Queries;\r\n            _userControl.Parameters = this.Parameters;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedQueryCallDefinitionsEditorUiControlFactoryData))]\r\n    internal sealed class TemplatedQueryCallDefinitionsEditorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedQueryCallDefinitionsEditorUiControlFactory(TemplatedQueryCallDefinitionsEditorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedQueryCallDefinitionsEditorUiControl control = new TemplatedQueryCallDefinitionsEditorUiControl(base.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedQueryCallDefinitionsEditorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedQueryCallDefinitionsEditorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedQueryCallDefinitionsEditorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedQueryCallDefinitionsEditorUiControlFactory(objectConfiguration as TemplatedQueryCallDefinitionsEditorUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedSaveButtonUiControlFactory.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class SaveButtonTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n        private EventHandler _saveEventHandler;\r\n        private EventHandler _saveAndPublishEventHandler;\r\n\r\n        /// <exclude />\r\n        public EventHandler SaveEventHandler\r\n        {\r\n            get { return _saveEventHandler; }\r\n            set { _saveEventHandler = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public EventHandler SaveAndPublishEventHandler\r\n        {\r\n            get { return _saveAndPublishEventHandler; }\r\n            set { _saveAndPublishEventHandler = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n    }\r\n\r\n    internal sealed class TemplatedSaveButtonUiControl : SaveButtonUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n\r\n        internal TemplatedSaveButtonUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n        }\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            SaveButtonTemplateUserControlBase userControl = _userControlType.ActivateAsUserControl<SaveButtonTemplateUserControlBase>(this.UiControlID);\r\n\r\n            userControl.FormControlLabel = this.Label;\r\n            userControl.SaveEventHandler += this.SaveEventHandler;\r\n            userControl.SaveAndPublishEventHandler += this.SaveAndPublishEventHandler;\r\n\r\n            return userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedSaveButtonUiControlFactoryData))]\r\n    internal sealed class TemplatedSaveButtonUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedSaveButtonUiControlFactory(TemplatedSaveButtonUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedSaveButtonUiControl control = new TemplatedSaveButtonUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedSaveButtonUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedSaveButtonUiControlFactoryData : ButtonUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedSaveButtonUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedSaveButtonUiControlFactory(objectConfiguration as TemplatedSaveButtonUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedSelectorUiControlFactory.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n\r\n    /// <exclude />\r\n    public class KeyLabelPair\r\n    {\r\n        /// <exclude />\r\n        public KeyLabelPair(string key, string label)\r\n        {\r\n            this.Key = key;\r\n            this.Label = label;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Key { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n    }\r\n\r\n\r\n\r\n    /////////////////////////////////\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public abstract class SelectorTemplateUserControlBase : UserControl\r\n    {\r\n        private Dictionary<string, object> _selectorObjects;\r\n        private List<KeyLabelPair> _keyLabelPairList;\r\n        private List<string> _selectedAsStrings;\r\n\r\n        private const string _noneSelectionKey = \"***C1.NONE***\";\r\n        private const string _noneSelectionLabel = \"<NONE>\";\r\n\r\n        /// <summary>\r\n        /// To be overridden in the controls\r\n        /// </summary>\r\n        public abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        public abstract void InitializeViewState();\r\n\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool Required { get; set; }\r\n\r\n        /// <summary>\r\n        /// When the selection is not required, the property will define if a \"no selection\" option should be added.\r\n        /// </summary>\r\n        public bool ProvideNoSelectionOption { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool CompactMode { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool ReadOnly { get; set; }\r\n\r\n        /// <exclude />\r\n        public string OptionsKeyField { get; set; }\r\n\r\n        /// <exclude />\r\n        public string OptionsLabelField { get; set; }\r\n\r\n        /// <exclude />\r\n        public IEnumerable Options { get; set; }\r\n\r\n        internal SelectorBindingType BindingType { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public EventHandler SelectedIndexChangedEventHandler { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public void BindStateToControlProperties()\r\n        {\r\n            InitializeSelectorElements();\r\n\r\n            this.BindStateToProperties();\r\n\r\n            if (_selectedAsStrings != null)\r\n            {\r\n                SetSelectedObjectsFromStringList(_selectedAsStrings);\r\n            }\r\n            else\r\n            {\r\n                this.SelectedObjects = new List<object>(); ;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        internal void SetSelectedObjectsFromStringList(IEnumerable<string> selectedAsStrings)\r\n        {\r\n            Verify.IsFalse(selectedAsStrings.Any(s => s == null), \"One of the selected keys is null\");\r\n\r\n            InitializeSelectorElements();\r\n\r\n\r\n            this.SelectedObjects = new List<object>();\r\n\r\n\r\n            bool bindToObject = (this.BindingType == SelectorBindingType.BindToObject)\r\n                                || (this.BindingType == SelectorBindingType.BindToKeyFieldValue \r\n                                    && (this.OptionsKeyField == \".\" || this.OptionsKeyField == \"\"));\r\n\r\n            if (bindToObject)\r\n            {\r\n                foreach (string selectedAsString in selectedAsStrings)\r\n                {\r\n                    if (_selectorObjects.ContainsKey(selectedAsString))\r\n                    {\r\n                        this.SelectedObjects.Add(_selectorObjects[selectedAsString]);\r\n                    }\r\n                    else if(selectedAsString != _noneSelectionKey)\r\n                    {\r\n                        // ComboBox\r\n                        this.SelectedObjects.Add(selectedAsString);\r\n                    }\r\n                }\r\n                return;\r\n            }\r\n\r\n            if (this.BindingType == SelectorBindingType.BindToKeyFieldValue)\r\n            {\r\n                foreach (string selectedAsString in selectedAsStrings)\r\n                {\r\n                    if (selectedAsString == _noneSelectionKey)\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    if (!_selectorObjects.ContainsKey(selectedAsString))\r\n                    {\r\n                        // ComboBox\r\n                        SelectedObjects.Add(selectedAsString);\r\n                        continue;\r\n                    }\r\n\r\n                    object key;\r\n\r\n                    var @object = _selectorObjects[selectedAsString];\r\n\r\n                    if (@object is XElement)\r\n                    {\r\n                        key = (@object as XElement).Attribute(this.OptionsKeyField).Value;\r\n                    }\r\n                    else\r\n                    {\r\n                        PropertyInfo keyPropertyInfo = @object.GetType().GetProperty(this.OptionsKeyField);\r\n                        key = keyPropertyInfo.GetValue(@object, null);\r\n                    }\r\n\r\n                    this.SelectedObjects.Add(key);\r\n                }\r\n\r\n                return;\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Unknown binding type\");\r\n        }\r\n\r\n        \r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<string> SelectedKeys\r\n        {\r\n            get\r\n            {\r\n                if (this.SelectedObjects != null && this.SelectedObjects.Count > 0)\r\n                {\r\n                    _selectedAsStrings = new List<string>();\r\n\r\n                    switch (this.BindingType)\r\n                    {\r\n                        case SelectorBindingType.BindToObject:\r\n                            if (this.OptionsKeyField == \".\" || this.OptionsKeyField == \"\")\r\n                            {\r\n                                foreach (object selectedObject in this.SelectedObjects)\r\n                                {\r\n                                    _selectedAsStrings.Add(selectedObject.ToString());\r\n                                }\r\n                            }\r\n                            else\r\n                            {\r\n                                var objectType = this.SelectedObjects.First().GetType();\r\n                                PropertyInfo keyPropertyInfo = objectType.GetProperty(this.OptionsKeyField);\r\n                                if (keyPropertyInfo == null) {\r\n                                    throw new InvalidOperationException($\"Malformed Selection configuration. The Selected binding type '{objectType}' does not have a property named '{this.OptionsKeyField}'\");\r\n                                }\r\n                                \r\n                                foreach (object selectedObject in this.SelectedObjects)\r\n                                {\r\n                                    string selectedObjectKey = keyPropertyInfo.GetValue(selectedObject, null).ToString();\r\n\r\n                                    if (_selectorObjects.ContainsKey(selectedObjectKey))\r\n                                    {\r\n                                        _selectedAsStrings.Add(selectedObjectKey);\r\n                                    }\r\n                                }\r\n                            }\r\n                            break;\r\n                        case SelectorBindingType.BindToKeyFieldValue:\r\n                            foreach (object selectedObject in this.SelectedObjects)\r\n                            {\r\n                                if (selectedObject != null)\r\n                                    _selectedAsStrings.Add(selectedObject.ToString());\r\n                            }\r\n                            break;\r\n                        default:\r\n                            throw new NotImplementedException(\"Unknown SelectorBindingType\");\r\n                    }\r\n\r\n                    return _selectedAsStrings;\r\n                }\r\n\r\n                return new List<string>();\r\n            }\r\n\r\n            set\r\n            {\r\n                _selectedAsStrings = new List<string>(value);\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public List<object> SelectedObjects { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        protected List<KeyLabelPair> GetOptions()\r\n        {\r\n            InitializeSelectorElements();\r\n\r\n            return _keyLabelPairList;\r\n        }\r\n\r\n\r\n        private void InitializeSelectorElements()\r\n        {\r\n            if (_selectorObjects != null) return;\r\n\r\n            if (Options is IEnumerable<XElement>)\r\n            {\r\n                Verify.That(OptionsKeyField != \"\" && OptionsKeyField != \".\", \"Key attribute name is not defined\");\r\n                Verify.That(OptionsLabelField != \"\" && OptionsLabelField != \".\", \"Label attribute name is not defined\");\r\n            }\r\n            else\r\n            {\r\n                Verify.IsNotNull(OptionsKeyField, $\"{nameof(OptionsKeyField)} is null\");\r\n                Verify.IsNotNull(OptionsLabelField, $\"{nameof(OptionsLabelField)} is null\");\r\n            }\r\n\r\n            _selectorObjects = new Dictionary<string, object>();\r\n            _keyLabelPairList = new List<KeyLabelPair>();\r\n\r\n            if (!Required && ProvideNoSelectionOption)\r\n            {\r\n                _keyLabelPairList.Add(new KeyLabelPair(_noneSelectionKey, _noneSelectionLabel));\r\n            }\r\n\r\n            PropertyInfo keyPropertyInfo = null;\r\n            PropertyInfo labelPropertyInfo = null;\r\n\r\n            Type lastOptionObjectType = null;\r\n\r\n            IEnumerator optionsEnumerator = Options.GetEnumerator();\r\n            while (optionsEnumerator.MoveNext())\r\n            {\r\n                object optionObject = optionsEnumerator.Current;\r\n\r\n                string label, uniqueKey;\r\n\r\n                if (Options is IEnumerable<XElement>)\r\n                {\r\n                    XElement element = (XElement) optionObject;\r\n\r\n                    var keyAttr = element.Attribute(this.OptionsKeyField);\r\n                    var labelAttr = element.Attribute(this.OptionsLabelField);\r\n\r\n                    Verify.IsNotNull(keyAttr, \"XElement missing attribute '{0}'\", this.OptionsKeyField);\r\n                    Verify.IsNotNull(labelAttr, \"XElement missing attribute '{0}'\", this.OptionsLabelField);\r\n\r\n                    uniqueKey = keyAttr.Value;\r\n                    label = labelAttr.Value;\r\n                }\r\n                else\r\n                {\r\n                    object keyObject = GetPropertyValue(optionObject, this.OptionsKeyField, ref lastOptionObjectType, ref keyPropertyInfo);\r\n                    object labelObject = GetPropertyValue(optionObject, this.OptionsLabelField, ref lastOptionObjectType, ref labelPropertyInfo);\r\n                    \r\n                    // TODO: ValueTypeConverter.Convert<string>(keyObject) should be used\r\n                    uniqueKey = (keyObject is Type) ? TypeManager.SerializeType((Type)keyObject) : keyObject.ToString();\r\n                    label = labelObject.ToString();\r\n                }\r\n\r\n                _keyLabelPairList.Add(new KeyLabelPair(uniqueKey, label));\r\n\r\n                Verify.IsFalse(_selectorObjects.ContainsKey(uniqueKey), \"Key '{0}' appears more than one time\".FormatWith(uniqueKey ?? string.Empty));\r\n\r\n                _selectorObjects.Add(uniqueKey, optionObject);\r\n            }\r\n        }\r\n\r\n        private object GetPropertyValue(object @object, string propertyName, ref Type lastOptionObjectType, ref PropertyInfo lastUsedPropertyInfo)\r\n        {\r\n            if (propertyName == \".\" || propertyName == \"\")\r\n            {\r\n                return @object;\r\n            }\r\n\r\n            if (@object.GetType() != lastOptionObjectType)\r\n            {\r\n                lastOptionObjectType = @object.GetType();\r\n                lastUsedPropertyInfo = null;\r\n            }\r\n\r\n            if (lastUsedPropertyInfo == null)\r\n            {\r\n                lastUsedPropertyInfo = lastOptionObjectType.GetProperty(propertyName);\r\n                Verify.IsNotNull(lastUsedPropertyInfo, \"Malformed Selection configuration. The Selected binding type '{0}' does not have a property named '{1}\", @object.GetType().FullName, propertyName);\r\n            }\r\n\r\n            return (lastUsedPropertyInfo.GetValue(@object, null) ?? \"(null)\").ToString();\r\n        }\r\n\r\n        /// <exclude />\r\n        public class KeyLabelPair\r\n        {\r\n            /// <exclude />\r\n            public KeyLabelPair(string key, string label)\r\n            {\r\n                this.Key = key;\r\n                this.Label = label;\r\n            }\r\n\r\n            /// <exclude />\r\n            public string Key { get; set; }\r\n\r\n            /// <exclude />\r\n            public string Label { get; set; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedSelectorUiControl : SelectorUiControl, IWebUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private SelectorTemplateUserControlBase _userControl;\r\n\r\n\r\n        internal TemplatedSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            if (_userControl.SelectedObjects.Any())\r\n            {\r\n                if (_userControl.SelectedObjects.Count() > 1) throw new InvalidOperationException(\"Multiple elements selected. This was not expedted.\");\r\n                this.Selected = _userControl.SelectedObjects.First();\r\n            }\r\n            else\r\n            {\r\n                this.Selected = null;\r\n            }\r\n        }\r\n\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<SelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.SelectedIndexChangedEventHandler += this.SelectedIndexChangedEventHandler;\r\n            _userControl.SelectedObjects = new List<object> { this.Selected };\r\n            _userControl.Options = this.Options;\r\n            _userControl.OptionsLabelField = this.OptionsLabelField;\r\n            _userControl.OptionsKeyField = this.OptionsKeyField;\r\n            _userControl.BindingType = this.BindingType;\r\n            _userControl.Required = this.Required;\r\n            _userControl.ReadOnly = this.ReadOnly;\r\n            _userControl.ProvideNoSelectionOption = true;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl => false;\r\n\r\n        public string ClientName => _userControl.GetDataFieldClientName();\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedMultiSelectorUiControl : MultiSelectorUiControl, IWebUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private SelectorTemplateUserControlBase _userControl;\r\n\r\n\r\n        internal TemplatedMultiSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n\r\n            if (this.Selected is IList)\r\n            {\r\n                IList listCopy = (IList)Activator.CreateInstance(this.Selected.GetType());\r\n                foreach (object selectedElement in _userControl.SelectedObjects)\r\n                {\r\n                    listCopy.Add(selectedElement);\r\n                }\r\n                this.Selected = listCopy;\r\n            }\r\n            else\r\n            {\r\n                this.Selected = _userControl.SelectedObjects;\r\n                this.SelectedAsString = string.Join(\",\", _userControl.SelectedKeys.ToArray());\r\n                // add code here that populate SelectedAsString \r\n            }\r\n        }\r\n\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<SelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Options = this.Options;\r\n            _userControl.OptionsLabelField = this.OptionsLabelField;\r\n            _userControl.OptionsKeyField = this.OptionsKeyField;\r\n            _userControl.BindingType = this.BindingType;\r\n            _userControl.Required = this.Required;\r\n            _userControl.CompactMode = this.CompactMode;\r\n\r\n            _userControl.SelectedObjects = new List<object>();\r\n\r\n            if (this.Selected != null)\r\n            {\r\n                if (!string.IsNullOrEmpty(this.SelectedAsString))\r\n                {\r\n                    throw new InvalidOperationException(\"Binding properties 'Selected' and 'SelectedAsString' can not be set at the same time.\");\r\n                }\r\n\r\n                foreach (object obj in this.Selected)\r\n                {\r\n                    _userControl.SelectedObjects.Add(obj);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (!string.IsNullOrEmpty(this.SelectedAsString))\r\n                {\r\n                    _userControl.SetSelectedObjectsFromStringList(this.SelectedAsString.Split(','));\r\n                }\r\n            }\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl => false;\r\n\r\n        public string ClientName => _userControl.GetDataFieldClientName();\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        private TemplatedSelectorUiControlFactoryData _data;\r\n\r\n        public TemplatedSelectorUiControlFactory(TemplatedSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            if (!_data.MultiSelector)\r\n            {\r\n                TemplatedSelectorUiControl control = new TemplatedSelectorUiControl(this.UserControlType);\r\n                control.BindingType = _data.BindingType;\r\n                return control;\r\n            }\r\n            else\r\n            {\r\n                TemplatedMultiSelectorUiControl control = new TemplatedMultiSelectorUiControl(this.UserControlType);\r\n                control.BindingType = _data.BindingType;\r\n                return control;\r\n            }\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedSelectorUiControlFactoryData : SelectorUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n        private const string _multiSelectorPropertyName = \"MultiSelector\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_multiSelectorPropertyName, IsRequired = false, DefaultValue = false)]\r\n        public bool MultiSelector\r\n        {\r\n            get { return (bool)base[_multiSelectorPropertyName]; }\r\n            set { base[_multiSelectorPropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedSelectorUiControlFactory(objectConfiguration as TemplatedSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedSvgIconSelectorUiControlFactory.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Configuration;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Web.UI;\nusing System.Xml.Linq;\nusing Composite.C1Console.Forms;\nusing Composite.C1Console.Forms.CoreUiControls;\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\nusing Composite.C1Console.Forms.WebChannel;\nusing Composite.Core;\nusing Composite.Core.IO;\nusing Composite.Plugins.Forms.WebChannel.Foundation;\nusing Composite.Data.Validation.ClientValidationRules;\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\nusing Microsoft.Practices.ObjectBuilder;\n\n\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\n{\n    /// <summary>    \n    /// </summary>\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \n    public abstract class SvgIconSelectorTemplateUserControlBase : UserControl\n    {\n        /// <exclude />\n        protected abstract void BindStateToProperties();\n\n        /// <exclude />\n        protected abstract void InitializeViewState();\n\n        /// <exclude />\n        public abstract string GetDataFieldClientName();\n\n        internal void BindStateToControlProperties()\n        {\n            this.BindStateToProperties();\n        }\n\n        internal void InitializeWebViewState()\n        {\n            this.InitializeViewState();\n        }\n\n        /// <exclude />\n        public string Selected { get; set; }\n\n        /// <exclude />\n        public Dictionary<string,string> SvgIdsOptions { get; set; }\n\n        /// <exclude />\n        public string SvgSpritePath { get; set; }\n\n        /// <exclude />\n        public string FormControlLabel { get; set; }\n\n        /// <exclude />\n        public bool Required { get; set; }\n\n        /// <exclude />\n        public List<ClientValidationRule> ClientValidationRules { get; set; }\n    }\n\n\n\n    internal sealed class TemplatedSvgIconSelectorUiControl : SvgIconSelectorUiControl, IWebUiControl\n    {\n        private Type _userControlType;\n        private SvgIconSelectorTemplateUserControlBase _userControl;\n\n        internal TemplatedSvgIconSelectorUiControl(Type userControlType)\n        {\n            _userControlType = userControlType;\n        }\n\n        public override void BindStateToControlProperties()\n        {\n            _userControl.BindStateToControlProperties();\n            this.Selected = _userControl.Selected;\n        }\n\n        public void InitializeViewState()\n        {\n            _userControl.InitializeWebViewState();\n        }\n\n\n        public Control BuildWebControl()\n        {\n            _userControl = _userControlType.ActivateAsUserControl<SvgIconSelectorTemplateUserControlBase>(this.UiControlID);\n\n            _userControl.FormControlLabel = this.Label;\n            _userControl.Selected = this.Selected;\n            _userControl.ClientValidationRules = this.ClientValidationRules;\n            _userControl.SvgSpritePath = this.SvgSpritePath;\n            _userControl.Required = this.Required;\n            _userControl.SvgIdsOptions = new Dictionary<string, string>();\n\n            var pathToSvg = System.Web.HttpContext.Current.Server.MapPath(this.SvgSpritePath);\n            if (C1File.Exists(pathToSvg))\n            {\n                var xd = XDocument.Load(pathToSvg);\n                XNamespace ns = \"http://www.w3.org/2000/svg\";\n                if (xd.Root != null)\n                {\n                    foreach (var el in xd.Root.Element(ns+ \"defs\").Elements(ns + \"g\"))\n                    {\n                        var idAttr = el.Attribute(\"id\");\n                        if (idAttr != null)\n                        {\n                            if (!_userControl.SvgIdsOptions.ContainsKey(idAttr.Value))\n                            {\n                                _userControl.SvgIdsOptions.Add(idAttr.Value, idAttr.Value);\n                            }\n                        }\n                    }\n                }\n            }\n\n            return _userControl;\n        }\n\n        public bool IsFullWidthControl { get { return false; } }\n\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\n    }\n\n\n\n    [ConfigurationElementType(typeof(TemplatedSvgIconSelectorUiControlFactoryData))]\n    internal sealed class TemplatedSvgIconSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\n    {\n        private string _configuredSvgSpritePath;\n\n        public TemplatedSvgIconSelectorUiControlFactory(TemplatedSvgIconSelectorUiControlFactoryData data)\n            : base(data)\n        {\n            _configuredSvgSpritePath = data.SvgSpritePath;\n        }\n\n        public override IUiControl CreateControl()\n        {\n            TemplatedSvgIconSelectorUiControl control = new TemplatedSvgIconSelectorUiControl(this.UserControlType);\n\n            control.SvgSpritePath = _configuredSvgSpritePath;\n\n            return control;\n        }\n    }\n\n\n\n    [Assembler(typeof(TemplatedSvgIconSelectorUiControlFactoryAssembler))]\n    internal sealed class TemplatedSvgIconSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\n    {\n        private const string _svgSpritePathPropertyName = \"svgSpritePath\";\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\n\n        [ConfigurationProperty(_svgSpritePathPropertyName, IsRequired = false)]\n        public string SvgSpritePath\n        {\n            get { return (string)base[_svgSpritePathPropertyName]; }\n            set { base[_svgSpritePathPropertyName] = value; }\n        }\n\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\n        public string UserControlVirtualPath\n        {\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\n            set { base[_userControlVirtualPathPropertyName] = value; }\n        }\n\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\n        public bool CacheCompiledUserControlType\n        {\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\n        }\n    }\n\n\n\n    internal sealed class TemplatedSvgIconSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\n    {\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\n        {\n            return new TemplatedSvgIconSelectorUiControlFactory(objectConfiguration as TemplatedSvgIconSelectorUiControlFactoryData);\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTextEditorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing System.Text.RegularExpressions;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class TextEditorTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n        private string _text;\r\n\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Text\r\n        {\r\n            get { return _text; }\r\n            set { _text = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string MimeType { get; set; }\r\n    }\r\n\r\n    internal sealed class TemplatedTextEditorUiControl : TextEditorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private TextEditorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedTextEditorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Text = NormalizeLineFeeds(_userControl.Text);\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<TextEditorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Text = NormalizeLineFeeds(this.Text);\r\n            _userControl.MimeType = this.MimeType;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n\r\n        private string NormalizeLineFeeds(string originalString)\r\n        {\r\n            return Regex.Replace(originalString, @\"\\r\\n|\\n\\r|\\n|\\r\", \"\\r\\n\");\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedTextEditorUiControlFactoryData))]\r\n    internal sealed class TemplatedTextEditorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedTextEditorUiControlFactory(TemplatedTextEditorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedTextEditorUiControl control = new TemplatedTextEditorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedTextEditorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedTextEditorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedTextEditorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedTextEditorUiControlFactory(objectConfiguration as TemplatedTextEditorUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTextInputUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public abstract class TextInputTemplateUserControlBase : UserControl, IPostBackDataHandler\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Text { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool Required\r\n        {\r\n            get; set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool SpellCheck { get; set; } = true;\r\n\r\n        /// <exclude />\r\n        public List<ClientValidationRule> ClientValidationRules { get; set; }\r\n\r\n        /// <exclude />\r\n        public TextBoxType Type { get; set; }\r\n\r\n\r\n        /// <summary>\r\n        /// When implemented by a class, processes postback data for an ASP.NET server control.\r\n        /// </summary>\r\n        /// <param name=\"postDataKey\"></param>\r\n        /// <param name=\"postCollection\"></param>\r\n        /// <returns></returns>\r\n        public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)\r\n        {\r\n            return false;\r\n        }\r\n\r\n        /// <summary>\r\n        /// When implemented by a class, signals the server control to notify the ASP.NET application that the state of the control has changed.\r\n        /// </summary>\r\n        public virtual void RaisePostDataChangedEvent()\r\n        {\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedTextInputUiControl : TextInputUiControl, IWebUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private TextInputTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedTextInputUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Text = _userControl.Text;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<TextInputTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Text = this.Text;\r\n            _userControl.ClientValidationRules = this.ClientValidationRules;\r\n            _userControl.Type = this.Type;\r\n            _userControl.Required = this.Required;\r\n            _userControl.SpellCheck = this.SpellCheck;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl => false;\r\n\r\n        public string ClientName => _userControl.GetDataFieldClientName();\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedTextInputUiControlFactoryData))]\r\n    internal sealed class TemplatedTextInputUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedTextInputUiControlFactory(TemplatedTextInputUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            var control = new TemplatedTextInputUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedTextInputUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedTextInputUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedTextInputUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedTextInputUiControlFactory(objectConfiguration as TemplatedTextInputUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTextUiControlFactory.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class TextTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n        private string _text;\r\n\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Text\r\n        {\r\n            get { return _text; }\r\n            set { _text = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n    }\r\n\r\n    internal sealed class TemplatedTextUiControl : TextUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private TextTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedTextUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Text = _userControl.Text;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<TextTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Text = this.Text;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedTextUiControlFactoryData))]\r\n    internal sealed class TemplatedTextUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedTextUiControlFactory(TemplatedTextUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedTextUiControl control = new TemplatedTextUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedTextUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedTextUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedTextUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedTextUiControlFactory(objectConfiguration as TemplatedTextUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedToolbarButtonUiControlFactory.cs",
    "content": "using System;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ToolbarButtonTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        public EventHandler FormControlClickEventHandler { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlHelp { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlIconHandle { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlDisabledIconHandle { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLaunchUrl { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool FormControlIsDisabled { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool FormControlSaveBehaviour { get; set; }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedToolbarButtonUiControl : ToolbarButtonUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n\r\n        internal TemplatedToolbarButtonUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n        }\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            ToolbarButtonTemplateUserControlBase userControl = _userControlType.ActivateAsUserControl<ToolbarButtonTemplateUserControlBase>(this.UiControlID);\r\n\r\n            userControl.FormControlLabel = this.Label;\r\n            userControl.FormControlClickEventHandler += this.ClickEventHandler;\r\n            userControl.FormControlHelp = this.Help;\r\n            userControl.FormControlIconHandle = this.IconHandle;\r\n            userControl.FormControlDisabledIconHandle = this.DisabledIconHandle;\r\n            userControl.FormControlLaunchUrl = this.LaunchUrl;\r\n            userControl.FormControlSaveBehaviour = this.SaveBehaviour;\r\n            userControl.FormControlIsDisabled = this.IsDisabled;\r\n\r\n            return userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedToolbarButtonUiControlFactoryData))]\r\n    internal sealed class TemplatedToolbarButtonUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedToolbarButtonUiControlFactory(TemplatedToolbarButtonUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedToolbarButtonUiControl control = new TemplatedToolbarButtonUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedToolbarButtonUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedToolbarButtonUiControlFactoryData : ToolbarButtonUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedToolbarButtonUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedToolbarButtonUiControlFactory(objectConfiguration as TemplatedToolbarButtonUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTreelSelectorUiControlFactory.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Configuration;\nusing System.Web.UI;\nusing Composite.C1Console.Forms;\nusing Composite.C1Console.Forms.CoreUiControls;\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\nusing Composite.C1Console.Forms.WebChannel;\nusing Composite.Plugins.Forms.WebChannel.Foundation;\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\nusing Microsoft.Practices.ObjectBuilder;\n\n\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\n{\n    /// <summary>    \n    /// </summary>\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \n    public abstract class TreeSelectorTemplateUserControlBase : UserControl, IPostBackDataHandler\n    {\n        /// <exclude />\n        protected abstract void BindStateToProperties();\n\n        /// <exclude />\n        protected abstract void InitializeViewState();\n\n        /// <exclude />\n        public abstract string GetDataFieldClientName();\n\n        internal void BindStateToControlProperties()\n        {\n            this.BindStateToProperties();\n        }\n\n        internal void InitializeWebViewState()\n        {\n            this.InitializeViewState();\n        }\n\n        /// <exclude />\n        public string SelectedKey { get; set; }\n\n        /// <exclude />\n        public string ElementProvider { get; set; }\n\n        /// <exclude />\n        public string SelectableElementPropertyName { get; set; }\n\n        /// <exclude />\n        public string SelectableElementPropertyValue { get; set; }\n\n        /// <exclude />\n        public string SelectableElementReturnValue { get; set; }\n\n        /// <exclude />\n        public string SerializedSearchToken { get; set; }\n\n        /// <exclude />\n        public bool Required { get; set; }\n\n        /// <summary>\n        /// When implemented by a class, processes postback data for an ASP.NET server control.\n        /// </summary>\n        /// <param name=\"postDataKey\"></param>\n        /// <param name=\"postCollection\"></param>\n        /// <returns></returns>\n        public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)\n        {\n            return false;\n        }\n\n        /// <summary>\n        /// When implemented by a class, signals the server control to notify the ASP.NET application that the state of the control has changed.\n        /// </summary>\n        public virtual void RaisePostDataChangedEvent()\n        {\n        }\n    }\n\n\n\n    internal sealed class TemplatedTreeSelectorUiControl : TreeSelectorUiControl, IWebUiControl\n    {\n        private readonly Type _userControlType;\n        private TreeSelectorTemplateUserControlBase _userControl;\n\n        internal TemplatedTreeSelectorUiControl(Type userControlType)\n        {\n            _userControlType = userControlType;\n        }\n\n        public override void BindStateToControlProperties()\n        {\n            _userControl.BindStateToControlProperties();\n\n            this.SelectedKey = _userControl.SelectedKey;\n        }\n\n        public void InitializeViewState()\n        {\n            _userControl.InitializeWebViewState();\n        }\n\n\n        public Control BuildWebControl()\n        {\n            _userControl = _userControlType.ActivateAsUserControl<TreeSelectorTemplateUserControlBase>(this.UiControlID);\n\n            _userControl.SelectedKey = this.SelectedKey;\n            _userControl.ElementProvider = this.ElementProvider;\n            _userControl.SelectableElementReturnValue = this.SelectableElementReturnValue;\n            _userControl.SelectableElementPropertyName = string.IsNullOrEmpty(this.SelectableElementPropertyName) ? this.SelectableElementReturnValue : this.SelectableElementPropertyName;\n            _userControl.SelectableElementPropertyValue = this.SelectableElementPropertyValue;\n            _userControl.SerializedSearchToken = this.SerializedSearchToken;\n            _userControl.Required = this.Required;\n\n            return _userControl;\n        }\n\n        public bool IsFullWidthControl => false;\n\n        public string ClientName => _userControl.GetDataFieldClientName();\n    }\n\n\n\n    [ConfigurationElementType(typeof(TemplatedTreeSelectorUiControlFactoryData))]\n    internal sealed class TemplatedTreeSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\n    {\n        public TemplatedTreeSelectorUiControlFactory(TemplatedTreeSelectorUiControlFactoryData data)\n            : base(data)\n        { }\n\n        public override IUiControl CreateControl()\n        {\n            var control = new TemplatedTreeSelectorUiControl(this.UserControlType);\n\n            return control;\n        }\n    }\n\n\n\n    [Assembler(typeof(TemplatedTreeSelectorUiControlFactoryAssembler))]\n    internal sealed class TemplatedTreeSelectorUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\n    {\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\n\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\n        public string UserControlVirtualPath\n        {\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\n            set { base[_userControlVirtualPathPropertyName] = value; }\n        }\n\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\n        public bool CacheCompiledUserControlType\n        {\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\n        }\n    }\n\n\n\n    internal sealed class TemplatedTreeSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\n    {\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\n        {\n            return new TemplatedTreeSelectorUiControlFactory(\n                objectConfiguration as TemplatedTreeSelectorUiControlFactoryData);\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTypeFieldDesignerUiControlFactory.cs.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class TypeFieldDesignerTemplateUserControlBase : UserControl\r\n    {\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<DataFieldDescriptor> Fields { get; set; }\r\n\r\n        /// <exclude />\r\n        public string KeyFieldName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string LabelFieldName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool KeyFieldReadOnly { get; set; }\r\n\r\n        /// <exclude />\r\n        public bool IsSearchable { get; set; }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedTypeFieldDesignerUiControl : TypeFieldDesignerUiControl, IWebUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private TypeFieldDesignerTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedTypeFieldDesignerUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Fields = _userControl.Fields;\r\n            this.KeyFieldName = _userControl.KeyFieldName;\r\n            this.LabelFieldName = _userControl.LabelFieldName;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<TypeFieldDesignerTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Fields = this.Fields;\r\n            _userControl.KeyFieldName = KeyFieldName;\r\n            _userControl.LabelFieldName = this.LabelFieldName;\r\n            _userControl.KeyFieldReadOnly = KeyFieldReadOnly;\r\n            _userControl.IsSearchable = IsSearchable;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedTypeFieldDesignerUiControlFactoryData))]\r\n    internal sealed class TemplatedTypeFieldDesignerUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedTypeFieldDesignerUiControlFactory(TemplatedTypeFieldDesignerUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            var control = new TemplatedTypeFieldDesignerUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(TemplatedTypeFieldDesignerUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedTypeFieldDesignerUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class TemplatedTypeFieldDesignerUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedTypeFieldDesignerUiControlFactory(objectConfiguration as TemplatedTypeFieldDesignerUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTypeSelectorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class TypeSelectorTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n        private Type _selectedType;\r\n        private TemplatedTypeSelectorUiControl _typeOptionsProxy;\r\n\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        internal void SetTypeOptionsProxy(TemplatedTypeSelectorUiControl proxy)\r\n        {\r\n            _typeOptionsProxy = proxy;\r\n        }\r\n\r\n        /// <exclude />\r\n        public Type SelectedType\r\n        {\r\n            get { return _selectedType; }\r\n            set { _selectedType = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Type> TypeOptions \r\n        {\r\n            get\r\n            {\r\n                return _typeOptionsProxy.FetchTypeOptions();\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class TemplatedTypeSelectorUiControl : TypeSelectorUiControl, IWebUiControl\r\n    {\r\n        private Type _userControlType;\r\n        private TypeSelectorTemplateUserControlBase _userControl;\r\n\r\n\r\n        internal TemplatedTypeSelectorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.SelectedType = _userControl.SelectedType;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<TypeSelectorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.SelectedType = this.SelectedType;\r\n            _userControl.SetTypeOptionsProxy(this);\r\n\r\n            return _userControl;\r\n        }\r\n\r\n\r\n        internal IEnumerable<Type> FetchTypeOptions()\r\n        {\r\n            return base.GetTypeOptions();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n\r\n        /// <exclude />\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedTypeSelectorUiControlFactoryData))]\r\n    internal sealed class TemplatedTypeSelectorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public TemplatedTypeSelectorUiControlFactory(TemplatedTypeSelectorUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedTypeSelectorUiControl control = new TemplatedTypeSelectorUiControl(this.UserControlType);\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(TemplatedTypeSelectorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedTypeSelectorUiControlFactoryData : TypeSelectorUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class TemplatedTypeSelectorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedTypeSelectorUiControlFactory(objectConfiguration as TemplatedTypeSelectorUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedXhtmlEditorUiControlFactory.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.C1Console.RichContent.ContainerClasses;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class XhtmlEditorTemplateUserControlBase : UserControl\r\n    {\r\n        private string _formControlLabel;\r\n        private string _xhtml;\r\n\r\n        /// <exclude />\r\n        protected abstract void BindStateToProperties();\r\n\r\n        /// <exclude />\r\n        protected abstract void InitializeViewState();\r\n\r\n        /// <exclude />\r\n        public abstract string GetDataFieldClientName();\r\n\r\n        internal void BindStateToControlProperties()\r\n        {\r\n            this.BindStateToProperties();\r\n        }\r\n\r\n        internal void InitializeWebViewState()\r\n        {\r\n            this.InitializeViewState();\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Xhtml\r\n        {\r\n            get { return _xhtml; }\r\n            set { _xhtml = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public string FormControlLabel\r\n        {\r\n            get { return _formControlLabel; }\r\n            set { _formControlLabel = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerable<Type> EmbedableFieldsTypes { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ClassConfigurationName { get; set; }\r\n\r\n        /// <exclude />\r\n        public string ContainerClasses { get; set; }\r\n\r\n        /// <exclude />\r\n        public Guid PreviewPageId { get; set; }\r\n\r\n        /// <exclude />\r\n        public Guid PreviewTemplateId { get; set; }\r\n\r\n        /// <exclude />\r\n        public string PreviewPlaceholder { get; set; }\r\n\r\n    }\r\n\r\n    internal sealed class TemplatedXhtmlEditorUiControl : XhtmlEditorUiControl, IWebUiControl\r\n    {\r\n        private readonly Type _userControlType;\r\n        private XhtmlEditorTemplateUserControlBase _userControl;\r\n\r\n        internal TemplatedXhtmlEditorUiControl(Type userControlType)\r\n        {\r\n            _userControlType = userControlType;\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            _userControl.BindStateToControlProperties();\r\n            this.Xhtml = _userControl.Xhtml;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            _userControl.InitializeWebViewState();\r\n        }\r\n\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _userControl = _userControlType.ActivateAsUserControl<XhtmlEditorTemplateUserControlBase>(this.UiControlID);\r\n\r\n            _userControl.FormControlLabel = this.Label;\r\n            _userControl.Xhtml = this.Xhtml;\r\n            _userControl.EmbedableFieldsTypes = this.EmbedableFieldsTypes;\r\n            _userControl.ClassConfigurationName = this.ClassConfigurationName;\r\n            _userControl.ContainerClasses = ContainerClassManager.NormalizeClassNamesString(this.ContainerClasses); \r\n            _userControl.PreviewPageId = PreviewPageId;\r\n            _userControl.PreviewTemplateId = PreviewTemplateId;\r\n            _userControl.PreviewPlaceholder = PreviewPlaceholder;\r\n\r\n            return _userControl;\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return true; } }\r\n\r\n        public string ClientName { get { return _userControl.GetDataFieldClientName(); } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(TemplatedXhtmlEditorUiControlFactoryData))]\r\n    internal sealed class TemplatedXhtmlEditorUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        private TemplatedXhtmlEditorUiControlFactoryData _data;\r\n\r\n        public TemplatedXhtmlEditorUiControlFactory(TemplatedXhtmlEditorUiControlFactoryData data)\r\n            : base(data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            TemplatedXhtmlEditorUiControl control = new TemplatedXhtmlEditorUiControl(this.UserControlType);\r\n\r\n            control.ClassConfigurationName = _data.ClassConfigurationName;\r\n            control.ContainerClasses = _data.ContainerClasses;\r\n\r\n            return control;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(TemplatedXhtmlEditorUiControlFactoryAssembler))]\r\n    internal sealed class TemplatedXhtmlEditorUiControlFactoryData : XhtmlEditorUiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class TemplatedXhtmlEditorUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new TemplatedXhtmlEditorUiControlFactory(objectConfiguration as TemplatedXhtmlEditorUiControlFactoryData);\r\n        }\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/UserControlBasedUiControlFactory.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Plugins.Forms.WebChannel.Foundation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public abstract class UserControlBasedUiControl : UserControl, IWebUiControl, IValidatingUiControl\r\n    {\r\n        private string _uiControlId = \"IdNotSet\";\r\n\r\n\r\n        /// <exclude />\r\n        public virtual Control BuildWebControl()\r\n        {\r\n            return this;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public abstract void InitializeViewState();\r\n\r\n\r\n        /// <exclude />\r\n        public abstract void BindStateToControlProperties();\r\n\r\n\r\n        /// <exclude />\r\n        public string ClientName { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsFullWidthControl { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string UiControlID \r\n        {\r\n            get\r\n            {\r\n                return _uiControlId;\r\n            }\r\n            set\r\n            {\r\n                _uiControlId = value;\r\n                this.ID = _uiControlId;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public IFormChannelIdentifier UiControlChannel { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n\r\n        /// <exclude />\r\n        public string Help { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<ClientValidationRule> ClientValidationRules { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<string> SourceBindingPaths { get; set; }\r\n\r\n        /// <exclude />\r\n        public virtual bool IsValid { get; set; }\r\n\r\n        /// <exclude />\r\n        public virtual string ValidationError { get; set; }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(UserControlBasedUiControlFactoryData))]\r\n    internal sealed class UserControlBasedUiControlFactory : Base.BaseTemplatedUiControlFactory\r\n    {\r\n        public UserControlBasedUiControlFactory(UserControlBasedUiControlFactoryData data)\r\n            : base(data)\r\n        { }\r\n\r\n        public override IUiControl CreateControl()\r\n        {\r\n            UserControlBasedUiControl userControlBasedUiControl = this.UserControlType.ActivateAsUserControl<UserControlBasedUiControl>(null);\r\n            userControlBasedUiControl.IsValid = true;\r\n\r\n            return userControlBasedUiControl;\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(UserControlBasedUiControlFactoryAssembler))]\r\n    internal sealed class UserControlBasedUiControlFactoryData : UiControlFactoryData, Base.ITemplatedUiControlFactoryData\r\n    {\r\n        private const string _userControlVirtualPathPropertyName = \"userControlVirtualPath\";\r\n        private const string _cacheCompiledUserControlTypePropertyName = \"cacheCompiledUserControlType\";\r\n\r\n        [ConfigurationProperty(_userControlVirtualPathPropertyName, IsRequired = true)]\r\n        public string UserControlVirtualPath\r\n        {\r\n            get { return (string)base[_userControlVirtualPathPropertyName]; }\r\n            set { base[_userControlVirtualPathPropertyName] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(_cacheCompiledUserControlTypePropertyName, IsRequired = false, DefaultValue = true)]\r\n        public bool CacheCompiledUserControlType\r\n        {\r\n            get { return (bool)base[_cacheCompiledUserControlTypePropertyName]; }\r\n            set { base[_cacheCompiledUserControlTypePropertyName] = value; }\r\n        }\r\n    }\r\n\r\n    internal sealed class UserControlBasedUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new UserControlBasedUiControlFactory(objectConfiguration as UserControlBasedUiControlFactoryData);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/WebDebugUiControlFactory.cs",
    "content": "using System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    internal sealed class WebDebugUiControl : DebugUiControl, IWebUiControl\r\n    {\r\n        private Panel _panel;\r\n\r\n        public Control BuildWebControl()\r\n        {\r\n            _panel = new Panel();\r\n\r\n            _panel.CssClass = \"debugPanel\";\r\n\r\n            Label xpathLabel = new Label();\r\n            xpathLabel.Text = string.Format(\"XPath: {0}\", this.SourceElementXPath);\r\n            xpathLabel.CssClass = \"debugPanelHeader\";\r\n            AddControl(xpathLabel);\r\n\r\n            Control control = (this.UiControl as IWebUiControl).BuildWebControl();\r\n\r\n            AddControl(control);\r\n\r\n\r\n            return _panel;\r\n        }\r\n\r\n        public void InitializeViewState()\r\n        {\r\n            (this.UiControl as IWebUiControl).InitializeViewState();\r\n        }\r\n\r\n        private void AddControl(Control control)\r\n        {\r\n            _panel.Controls.Add(control);\r\n\r\n        }\r\n\r\n        public override void BindStateToControlProperties()\r\n        {\r\n            this.UiControl.BindStateToControlProperties();\r\n        }\r\n\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(WebDebugUiControlFactoryData))]\r\n    internal sealed class WebDebugUiControlFactory : IUiControlFactory\r\n    {\r\n        public IUiControl CreateControl()\r\n        {\r\n            return new WebDebugUiControl();\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(WebDebugUiControlFactoryAssembler))]\r\n    internal sealed class WebDebugUiControlFactoryData : DebugUiControlFactoryData\r\n    {\r\n    }\r\n\r\n\r\n    internal sealed class WebDebugUiControlFactoryAssembler : IAssembler<IUiControlFactory, UiControlFactoryData>\r\n    {\r\n        public IUiControlFactory Assemble(IBuilderContext context, UiControlFactoryData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new WebDebugUiControlFactory();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Forms/WebChannel/UiControlFactories/WebEmbeddedFormUiControlFactory.cs",
    "content": "﻿using System.IO;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.DataServices.UiControls;\r\nusing Composite.C1Console.Forms.Plugins.UiControlFactory;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Forms.WebChannel.UiControlFactories\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Composite.C1Console.Forms.ControlValueProperty(\"Bindings\")]\r\n    public class WebEmbeddedFormUiControl : EmbeddedFormUiControl, IWebUiControl\r\n    {\r\n        internal WebEmbeddedFormUiControl()\r\n        { }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public WebEmbeddedFormUiControl(IFormChannelIdentifier channel)\r\n        {\r\n            this.UiControlChannel = channel;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public void InitializeViewState()\r\n        {\r\n            ((IWebUiControl)this.CompiledUiControl).InitializeViewState();\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public Control BuildWebControl()\r\n        {\r\n            Control _formControl = ((IWebUiControl)this.CompiledUiControl).BuildWebControl();\r\n\r\n\r\n            _formControl.ID = Path.GetFileNameWithoutExtension(this.FormPath); ;\r\n\r\n            return _formControl;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsFullWidthControl { get { return false; } }\r\n\r\n\r\n        /// <exclude />\r\n        public string ClientName { get { return null; } }\r\n    }\r\n\r\n\r\n\r\n    [ConfigurationElementType(typeof(WebEmbeddedFormUiControlFactoryData))]\r\n    internal sealed class WebEmbeddedFormUiControlFactory : IUiControlFactory\r\n    {\r\n        public IUiControl CreateControl()\r\n        {\r\n            return new WebEmbeddedFormUiControl();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableUiControlFactoryAssembler))]\r\n    internal sealed class WebEmbeddedFormUiControlFactoryData : UiControlFactoryData\r\n    {\r\n        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/CodeBasedFunctionProvider/CodeBasedFunction.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing Composite.C1Console.Security;\nusing Composite.Core;\nusing Composite.Functions;\nusing Composite.Plugins.Functions.FunctionProviders.MethodBasedFunctionProvider;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Composite.Plugins.Functions.FunctionProviders.CodeBasedFunctionProvider\n{\n    internal class CodeBasedFunction : MethodBasedFunction\n    {\n        public static CodeBasedFunction Create(Type type, string methodName, string userNamespace, string userMethodName, string description)\n        {\n            var methodInfo = GetMethodInfo(type, methodName, userNamespace, userMethodName, out _);\n\n            return methodInfo == null ? null : new CodeBasedFunction(type, methodInfo, userNamespace, userMethodName, description);\n        }\n\n        protected CodeBasedFunction(Type type, MethodInfo methodInfo, string userNamespace, string userMethodName, string description)\n            : base(typeof(CodeBasedFunction).Name)\n        {\n            Name = userMethodName;\n            Namespace = userNamespace;\n            Type = type;\n            MethodInfo = methodInfo;\n            Description = description;\n        }\n\n        public override string Description { get; }\n        protected override MethodInfo MethodInfo { get; }\n        public override string Name { get; }\n        public override string Namespace { get; }\n        private Type Type { get; }\n\n        public override EntityToken EntityToken => new CodeBasedFunctionEntityToken(this);\n\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\n        {\n            var arguments = new List<object>();\n            foreach (ParameterProfile paramProfile in ParameterProfiles)\n            {\n                arguments.Add(parameters.GetParameter(paramProfile.Name, paramProfile.Type));\n            }\n\n            var instance = MethodInfo.IsStatic ? null : ActivatorUtilities.GetServiceOrCreateInstance(ServiceLocator.ServiceProvider, Type);\n\n            return MethodInfo.Invoke(instance, arguments.ToArray());\n        }\n    }\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/CodeBasedFunctionProvider/CodeBasedFunctionEntityToken.cs",
    "content": "using Composite.C1Console.Security;\nusing Composite.Functions;\n\nnamespace Composite.Plugins.Functions.FunctionProviders.CodeBasedFunctionProvider\n{\n    [SecurityAncestorProvider(typeof(StandardFunctionSecurityAncestorProvider))]\n    internal class CodeBasedFunctionEntityToken : EntityToken\n    {\n        internal CodeBasedFunctionEntityToken(CodeBasedFunction function)\n        {\n            Id = $\"{function.Namespace}.{function.Name}\";\n        }\n\n        public CodeBasedFunctionEntityToken(string fullName)\n        {\n            Id = fullName;\n        }\n\n        public override string Id { get; }\n        public static EntityToken Deserialize(string serializedData)\n        {\n            DoDeserialize(serializedData, out _, out _, out var id);\n            return new CodeBasedFunctionEntityToken(id);\n        }\n        public override string Serialize() => DoSerialize();\n\n        public override string Source => string.Empty;\n\n        public override string Type => string.Empty;\n    }\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/CodeBasedFunctionProvider/CodeBasedFunctionProvider.cs",
    "content": "using System.Collections.Generic;\nusing Composite.Functions;\nusing Composite.Functions.Plugins.FunctionProvider;\n\nnamespace Composite.Plugins.Functions.FunctionProviders.CodeBasedFunctionProvider\n{\n    internal class CodeBasedFunctionProvider : IFunctionProvider\n    {\n        private static FunctionNotifier _functionNotifier;\n\n        public FunctionNotifier FunctionNotifier\n        {\n            set => _functionNotifier = value;\n        }\n\n        public IEnumerable<IFunction> Functions => CodeBasedFunctionRegistry.Functions;\n\n        internal static void Reload()\n        {\n            // Can be called before function provider initialization\n            _functionNotifier?.FunctionsUpdated();\n        }\n    }\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/CodeBasedFunctionProvider/CodeBasedFunctionRegistry.cs",
    "content": "using System.Collections.Concurrent;\nusing System.Linq;\nusing Composite.Functions;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Composite.Plugins.Functions.FunctionProviders.CodeBasedFunctionProvider\n{\n    /// <summary>\n    /// This class allows to register methods from external assemblies as C1 functions.\n    /// To register own method for C1 usage:\n    /// 1. Register a suitable dependency in an appropriate way in case it is needed\n    /// an object for a method call (recommended) <see cref=\"IServiceCollection\"/>\n    /// For example:\n    /// <code>\n    /// public static void ConfigureServices(IServiceCollection collection)\n    /// {\n    ///     collection.AddSingleTon(typeof(YourServiceType));\n    /// }\n    /// </code>\n    /// 2. Register needed method as C1 function with RegisterMethod call <see cref=\"RegisterMethod{T}(string, string, string)\"/>\n    /// </summary>\n    public static class CodeBasedFunctionRegistry\n    {\n        internal static readonly ConcurrentBag<IFunction> Functions = new ConcurrentBag<IFunction>();\n\n        /// <summary>\n        /// Provided to register methods from external assemblies as C1 functions\n        /// </summary>\n        /// <typeparam name=\"T\">Type of a class, which contains the needed method</typeparam>\n        /// <param name=\"methodName\">Name of the method to be registered</param>\n        /// <param name=\"userMethodFullName\">\n        /// Set up custom method full name for displaying in C1.\n        /// For example: TestNamespace.TestClassName.TestMethodName\n        /// </param>\n        /// <param name=\"description\">Can be provided a custom description for the method</param>\n        public static void RegisterMethod<T>(string methodName, string userMethodFullName = null, string description = null) where T : class\n        {\n            var type = typeof(T);\n\n            string userNamespace, userMethodName;\n\n            if (string.IsNullOrWhiteSpace(userMethodFullName))\n            {\n                userMethodName = methodName;\n                userNamespace = type.Namespace;\n            }\n            else\n            {\n                ParseFunctionName(userMethodFullName, out userNamespace, out userMethodName);\n            }\n\n            var function = CodeBasedFunction.Create(type, methodName, userNamespace, userMethodName, description);\n            Functions.Add(function);\n            CodeBasedFunctionProvider.Reload();\n        }\n\n        private static void ParseFunctionName(string userMethodFullName, out string userNamespace, out string userMethodName)\n        {\n            string[] parts = userMethodFullName.Split(new[] { '.' });\n\n            Verify.That(parts.Length > 1, \"Missing a function namespace in full function name '{0}'\", userMethodFullName);\n\n            Verify.IsFalse(parts.Any(string.IsNullOrWhiteSpace), \"Empty full name parts are not allowed\");\n\n            userNamespace = string.Join(\".\", parts.Take(parts.Length - 1));\n            userMethodName = parts.Last();\n        }\n    }\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/FileBasedFunctionProvider/FileBasedFunction.cs",
    "content": "﻿using System;\r\nusing System.CodeDom.Compiler;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider\r\n{\r\n\tinternal abstract class FileBasedFunction<T> : IFunction where T : FileBasedFunction<T>\r\n\t{\r\n\t\tprivate readonly FileBasedFunctionProvider<T> _provider;\r\n\r\n\t\tinternal string VirtualPath { get; private set; }\r\n\t\tprotected IDictionary<string, FunctionParameter> Parameters { get; set; }\r\n\r\n\t\tpublic string Namespace { get; private set; }\r\n\t\tpublic string Name { get; private set; }\r\n\t\tpublic Type ReturnType { get; private set; }\r\n\t\tpublic virtual string Description { get; private set; }\r\n\r\n\t\tpublic EntityToken EntityToken\r\n\t\t{\r\n\t\t\tget { return new FileBasedFunctionEntityToken(_provider.Name, String.Join(\".\", Namespace, Name)); }\r\n\t\t}\r\n\r\n\t    protected abstract void InitializeParameters();\r\n\r\n\t\tpublic virtual IEnumerable<ParameterProfile> ParameterProfiles\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n                if (Parameters == null)\r\n                {\r\n                    lock (this)\r\n                    {\r\n                        if (Parameters == null)\r\n                        {\r\n                            try\r\n                            {\r\n                                InitializeParameters();\r\n                            }\r\n                            catch (HttpException ex)\r\n                            {\r\n                                EmbedSourceCodeInformation(ex);\r\n                                throw;\r\n                            }\r\n                            \r\n                            Verify.IsNotNull(Parameters, \"Parameters collection is null\");\r\n                        }\r\n                    }\r\n\t\t\t    }\r\n\t\t\t    \r\n\t\t\t    foreach (var param in Parameters.Values)\r\n\t\t\t    {\r\n\t\t\t        BaseValueProvider defaultValueProvider = new NoValueValueProvider();\r\n\t\t\t        WidgetFunctionProvider widgetProvider = param.WidgetProvider;\r\n\t\t\t        string label = param.Name;\r\n\t\t\t        bool isRequired = true;\r\n\t\t\t        string helpText = String.Empty;\r\n\t\t\t        bool hideInSimpleView = false;\r\n\r\n\t\t\t        if (param.Attribute != null)\r\n\t\t\t        {\r\n\t\t\t            if (!param.Attribute.Label.IsNullOrEmpty())\r\n\t\t\t            {\r\n\t\t\t                label = param.Attribute.Label;\r\n\t\t\t            }\r\n\r\n\t\t\t            if (!param.Attribute.Help.IsNullOrEmpty())\r\n\t\t\t            {\r\n\t\t\t                helpText = param.Attribute.Help;\r\n\t\t\t            }\r\n\r\n\t\t\t            isRequired = !param.Attribute.HasDefaultValue;\r\n\t\t\t            if (!isRequired)\r\n\t\t\t            {\r\n\t\t\t                defaultValueProvider = new ConstantValueProvider(param.Attribute.DefaultValue);\r\n\t\t\t            }\r\n\r\n\t\t\t            hideInSimpleView = param.Attribute.HideInSimpleView;\r\n\t\t\t        }\r\n\r\n\t\t\t        if (widgetProvider == null)\r\n\t\t\t        {\r\n\t\t\t            widgetProvider = StandardWidgetFunctions.GetDefaultWidgetFunctionProviderByType(param.Type, isRequired);\r\n\t\t\t        }\r\n\r\n\t\t\t        yield return new ParameterProfile(param.Name, param.Type, isRequired, defaultValueProvider, widgetProvider, label,\r\n                        new HelpDefinition(helpText),\r\n                        hideInSimpleView);\r\n\t\t\t        \r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprotected FileBasedFunction(string ns, string name, string description, IDictionary<string, FunctionParameter> parameters, Type returnType, string virtualPath, FileBasedFunctionProvider<T> provider)\r\n            :this(ns, name, description, returnType, virtualPath, provider)\r\n\t\t{\r\n\t\t\tParameters = parameters;\r\n\t\t}\r\n\r\n        protected FileBasedFunction(string ns, string name, string description, Type returnType, string virtualPath, FileBasedFunctionProvider<T> provider)\r\n        {\r\n            _provider = provider;\r\n\r\n            Namespace = ns;\r\n            Name = name;\r\n            Description = description;\r\n            ReturnType = returnType;\r\n            VirtualPath = virtualPath;\r\n        }\r\n\r\n        protected void EmbedSourceCodeInformation(HttpException ex)\r\n        {\r\n            if (ex is HttpParseException)\r\n            {\r\n                EmbedSourceCodeInformation(ex as HttpParseException);\r\n            }\r\n            else if (ex is HttpCompileException)\r\n            {\r\n                EmbedSourceCodeInformation(ex as HttpCompileException);\r\n            }\r\n        }\r\n\t    \r\n        private void EmbedSourceCodeInformation(HttpParseException ex)\r\n\t    {\r\n            // Not showing source code of not related files\r\n\t        if (!ex.FileName.StartsWith(PathUtil.Resolve(VirtualPath), StringComparison.OrdinalIgnoreCase))\r\n\t        {\r\n\t            return;\r\n\t        }\r\n\r\n            string[] sourceCode = C1File.ReadAllLines(ex.FileName);\r\n\r\n            XhtmlErrorFormatter.EmbedSourceCodeInformation(ex, sourceCode, ex.Line);\r\n        }\r\n\r\n        private void EmbedSourceCodeInformation(HttpCompileException ex)\r\n        {\r\n            var compilationErrors = ex.Results.Errors;\r\n            if (!compilationErrors.HasErrors)\r\n            {\r\n                return;\r\n            }\r\n            \r\n            CompilerError firstError = null;\r\n            \r\n            for (int i = 0; i < compilationErrors.Count; i++)\r\n            {\r\n                if (!compilationErrors[i].IsWarning)\r\n                {\r\n                    firstError = compilationErrors[i];\r\n                    break;\r\n                }\r\n            }\r\n\r\n            Verify.IsNotNull(firstError, \"Failed to finding an error in the compiler results.\");\r\n\r\n            // Not showing source code of not related files\r\n\t        if (!firstError.FileName.StartsWith(PathUtil.Resolve(VirtualPath), StringComparison.OrdinalIgnoreCase))\r\n\t        {\r\n\t            return;\r\n\t        }\r\n\r\n\t        string[] sourceCode = C1File.ReadAllLines(firstError.FileName);\r\n\r\n\t        XhtmlErrorFormatter.EmbedSourceCodeInformation(ex, sourceCode, firstError.Line);\r\n        }\r\n\r\n\t\tpublic abstract object Execute(ParameterList parameters, FunctionContextContainer context);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/FileBasedFunctionProvider/FileBasedFunctionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Web.Hosting;\r\nusing Composite.Core;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider\r\n{\r\n    internal abstract class FileBasedFunctionProvider<FunctionType> : IFunctionProvider \r\n        where FunctionType : FileBasedFunction<FunctionType> \r\n\t{\r\n        static readonly FileRelatedDataCache<CachedFunctionInformation> _functionInfoCache =\r\n            new FileRelatedDataCache<CachedFunctionInformation>(\r\n                \"Functions\", \"fileBasedFunction\", CachedFunctionInformation.Serialize, CachedFunctionInformation.Deserialize);\r\n\r\n        private static readonly string LogTitle = \"FileBasedFunctionProvider\";\r\n\t\tprivate static readonly object _lock = new object();\r\n\r\n        private const int FunctionReloadDelayMilliseconds = 200;\r\n\r\n        private readonly C1FileSystemWatcher _watcher;\r\n\t\tprivate DateTime? _lastFunctionReloadTime = DateTime.Now;\r\n        private readonly string _name;\r\n\r\n\t\tprotected abstract string FileExtension { get; }\r\n        protected abstract string DefaultFunctionNamespace { get; }\r\n\r\n\t\tpublic FunctionNotifier FunctionNotifier { private get; set; }\r\n\t\tpublic string VirtualPath { get; private set; }\r\n\t\tpublic string PhysicalPath { get; private set; }\r\n\r\n        public string Name\r\n        {\r\n            get { return _name; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// </summary>\r\n        /// <exclude />\r\n\t\tpublic IEnumerable<IFunction> Functions\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n                var returnList = new List<IFunction>();\r\n\r\n                if (!C1Directory.Exists(PhysicalPath) || !(SystemSetupFacade.IsSystemFirstTimeInitialized && !SystemSetupFacade.SetupIsRunning))\r\n                {\r\n                    return returnList;\r\n                }\r\n\r\n\t\t\t\tvar files = new C1DirectoryInfo(PhysicalPath)\r\n                    .GetFiles(\"*.\" + FileExtension, SearchOption.AllDirectories)\r\n                    .Where(f => !f.Name.StartsWith(\"_\", StringComparison.Ordinal));\r\n\r\n\t\t\t\tforeach (var file in files)\r\n\t\t\t\t{\r\n\t\t\t\t    string filePath = file.FullName;\r\n                    string @namespace = ExtractFunctionNamespace(file.FullName);\r\n                    string name = Path.GetFileNameWithoutExtension(file.Name);\r\n\r\n                    var virtualPath = CombineVirtualPath(VirtualPath, \r\n                                                         @namespace.Replace(\".\", \"/\"), \r\n                                                         name + \".\" + FileExtension);\r\n\r\n                    if(@namespace == string.Empty)\r\n                    {\r\n                        @namespace = DefaultFunctionNamespace;\r\n                    }\r\n\r\n\t\t\t\t    string fullFunctionName = @namespace + \".\" + name;\r\n\r\n                    IFunction function;\r\n\r\n                    try\r\n                    {\r\n                        CachedFunctionInformation cachedFunctionInfo;\r\n\r\n                        if (!_functionInfoCache.Get(fullFunctionName, filePath, out cachedFunctionInfo))\r\n                        {\r\n                            function = InstantiateFunction(virtualPath, @namespace, name);\r\n\r\n                            // Not caching functions that failed to load\r\n                            var initializationInfo = function as IFunctionInitializationInfo;\r\n                            bool functionFailedToCompile = initializationInfo != null && !initializationInfo.FunctionInitializedCorrectly;\r\n\r\n                            if ((function == null && !HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                                || (function != null && !functionFailedToCompile))\r\n                            {\r\n                                _functionInfoCache.Add(fullFunctionName, filePath,\r\n                                    function != null ? new CachedFunctionInformation(function) : null);\r\n                            }\r\n                        }\r\n                        else\r\n                        {\r\n                            if (cachedFunctionInfo == null)\r\n                            {\r\n                                continue;\r\n                            }\r\n\r\n                            function = InstantiateFunctionFromCache(virtualPath, @namespace, name,\r\n                                                                    cachedFunctionInfo.ReturnType,\r\n                                                                    cachedFunctionInfo.Description,\r\n                                                                    cachedFunctionInfo.PreventCaching);\r\n                        }\r\n                    }\r\n                    catch (ThreadAbortException)\r\n                    {\r\n                        throw;\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        // supressing error messages while in offline mode - we are installing stuff here.\r\n                        if (ApplicationOnlineHandlerFacade.IsApplicationOnline && !HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                        {\r\n                            Log.LogError(LogTitle, \"Error instantiating function {0} \", @namespace + \".\" + name);\r\n                            Log.LogError(LogTitle, ex);\r\n                        }\r\n\r\n                        returnList.Add(new NotLoadedFileBasedFunction<FunctionType>(this, @namespace, name, virtualPath, ex));\r\n                        continue;\r\n                    }\r\n\r\n                    if (function == null)\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    returnList.Add(function);\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn returnList;\r\n\t\t\t}\r\n\t\t}\r\n\r\n        private static string CombineVirtualPath(params string[] parts)\r\n        {\r\n            return string.Join(\"/\", parts).Replace('\\\\', '/').Replace(\"///\", \"/\").Replace(\"//\", \"/\");\r\n        }\r\n\r\n        private string ExtractFunctionNamespace(string filePath)\r\n        {\r\n            Verify.That(filePath.StartsWith(PhysicalPath, StringComparison.OrdinalIgnoreCase), \"File path should start with folder path\");\r\n\r\n            string directoryPath = Path.GetDirectoryName(filePath);\r\n            string relativeDirectoryPath = directoryPath.Substring(PhysicalPath.Length);\r\n\r\n            return string.Join(\".\", relativeDirectoryPath.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries));\r\n        }\r\n\r\n\t\tprotected FileBasedFunctionProvider(string name, string folder)\r\n\t\t{\r\n\t\t\t_name = name;\r\n\r\n\t\t\tVirtualPath = folder;\r\n\t\t\tPhysicalPath = PathUtil.Resolve(VirtualPath);\r\n\r\n            if (!C1Directory.Exists(PhysicalPath))\r\n            {\r\n                return;\r\n            }\r\n\r\n\t\t    string folderToWatch = PhysicalPath;\r\n\r\n\t\t    try\r\n\t\t    {\r\n\t\t        if (ReparsePointUtils.DirectoryIsReparsePoint(folderToWatch))\r\n\t\t        {\r\n                    folderToWatch = ReparsePointUtils.GetDirectoryReparsePointTarget(folderToWatch);\r\n\t\t        }\r\n\r\n\t\t        _watcher = new C1FileSystemWatcher(folderToWatch, \"*\")\r\n\t\t        {\r\n\t\t            IncludeSubdirectories = true\r\n\t\t        };\r\n\r\n\t\t        _watcher.Created += Watcher_OnChanged;\r\n\t\t        _watcher.Deleted += Watcher_OnChanged;\r\n\t\t        _watcher.Changed += Watcher_OnChanged;\r\n\t\t        _watcher.Renamed += Watcher_OnChanged;\r\n\r\n\t\t        _watcher.EnableRaisingEvents = true;\r\n\t\t    }\r\n\t\t    catch (Exception ex)\r\n\t\t    {\r\n\t\t        Log.LogWarning(LogTitle, \"Failed to create a file system watcher for path '{0}'\", folderToWatch);\r\n\t\t        Log.LogWarning(LogTitle, ex);\r\n\t\t    }\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Instantiates the function from the file.\r\n        /// </summary>\r\n        /// <param name=\"virtualPath\">The virtual path.</param>\r\n        /// <param name=\"namespace\">The namespace.</param>\r\n        /// <param name=\"name\">The name.</param>\r\n        /// <returns></returns>\r\n\t\tprotected abstract IFunction InstantiateFunction(string virtualPath, string @namespace, string name);\r\n\r\n        /// <summary>\r\n        /// Instantiates the function from the file and additional cached information.\r\n        /// </summary>\r\n        /// <param name=\"virtualPath\">The virtual path.</param>\r\n        /// <param name=\"namespace\">The namespace.</param>\r\n        /// <param name=\"name\">The name.</param>\r\n        /// <param name=\"returnType\">Cached value of return type.</param>\r\n        /// <param name=\"cachedDescription\">Cached value of the description.</param>\r\n        /// <param name=\"preventCaching\">Cached PreventFunctionOutputCache property value.</param>\r\n        /// <returns></returns>\r\n        protected virtual IFunction InstantiateFunctionFromCache(\r\n            string virtualPath,\r\n            string @namespace,\r\n            string name,\r\n            Type returnType,\r\n            string cachedDescription,\r\n            bool preventCaching)\r\n        {\r\n            return InstantiateFunction(virtualPath, @namespace, name);\r\n        }\r\n\r\n\t\tprotected abstract bool HandleChange(string path);\r\n\r\n\r\n        public void ReloadFunctions()\r\n        {\r\n            Thread.Sleep(FunctionReloadDelayMilliseconds);\r\n\r\n            try\r\n            {\r\n                FunctionNotifier.FunctionsUpdated();\r\n            }\r\n            catch (ThreadAbortException)\r\n            {\r\n                throw;\r\n            }\r\n            catch(Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, \"Failed to reload functions\");\r\n                Log.LogError(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n\t\tprivate void Watcher_OnChanged(object sender, FileSystemEventArgs e)\r\n\t\t{\r\n\t\t    if (SystemSetupFacade.SetupIsRunning)\r\n\t\t    {\r\n\t\t        return;\r\n\t\t    }\r\n\r\n            // Reloading functions only after a certain delay as otherwise edited in VS function won't be loaded if files are accessed through a network drive\r\n\t\t\tif (FunctionNotifier != null && HandleChange(e.FullPath))\r\n\t\t\t{\r\n                var timeSpan = DateTime.Now - _lastFunctionReloadTime.Value;\r\n                if (timeSpan.TotalMilliseconds < FunctionReloadDelayMilliseconds) {\r\n                    return;\r\n                }\r\n\r\n                lock (_lock)\r\n                {\r\n                    var now = DateTime.Now;\r\n                    timeSpan = now - _lastFunctionReloadTime.Value;\r\n                    if (timeSpan.TotalMilliseconds < FunctionReloadDelayMilliseconds) {\r\n                        return;\r\n                    }\r\n\r\n                    _lastFunctionReloadTime = now;\r\n\r\n                    new Thread(ReloadFunctions).Start();\r\n                }\r\n\t\t\t}\r\n\t\t}\r\n\r\n        private class CachedFunctionInformation\r\n        {\r\n            public Type ReturnType { get; private set; }\r\n            public string Description { get; private set; }\r\n            public bool PreventCaching { get; private set; }\r\n\r\n            private CachedFunctionInformation() {}\r\n\r\n            public CachedFunctionInformation(IFunction function)\r\n            {\r\n                ReturnType = function.ReturnType;\r\n                Description = function.Description;\r\n                PreventCaching = function is IDynamicFunction dynamicFunction\r\n                                 && dynamicFunction.PreventFunctionOutputCaching;\r\n            }\r\n\r\n            public static void Serialize(CachedFunctionInformation data, string filePath)\r\n            {\r\n                var lines = new List<string>();\r\n\r\n                if (data != null)\r\n                {\r\n                    lines.Add(TypeManager.SerializeType(data.ReturnType));\r\n                    lines.Add(data.PreventCaching.ToString());\r\n                    lines.AddRange(data.Description.Split(new [] { Environment.NewLine }, StringSplitOptions.None));\r\n                }\r\n\r\n                C1File.WriteAllLines(filePath, lines);\r\n            }\r\n\r\n            public static CachedFunctionInformation Deserialize(string filePath)\r\n            {\r\n                var lines = C1File.ReadAllLines(filePath);\r\n                if (lines == null || lines.Length == 0)\r\n                {\r\n                    return null;\r\n                }\r\n                \r\n                Type type = TypeManager.TryGetType(lines[0]);\r\n                if (type == null) return null;\r\n\r\n                bool preventCaching = bool.Parse(lines[1]);\r\n                string description = string.Join(Environment.NewLine, lines.Skip(2));\r\n\r\n                return new CachedFunctionInformation\r\n                {\r\n                    Description = description,\r\n                    PreventCaching = preventCaching,\r\n                    ReturnType = type\r\n                };\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/FileBasedFunctionProvider/FunctionBasedFunctionProviderHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider\r\n{\r\n    /// <summary>\r\n    /// Helper class for developing implementations of FileBasedFunctionProvider\r\n    /// </summary>\r\n    public static class FunctionBasedFunctionProviderHelper\r\n    {\r\n        private static readonly string LogTitle = typeof(FunctionBasedFunctionProviderHelper).FullName;\r\n\r\n        /// <summary>\r\n        /// Gets the function description from the <see cref=\"FunctionAttribute\" />.\r\n        /// </summary>\r\n        /// <param name=\"functionName\">Name of the function.</param>\r\n        /// <param name=\"functionObject\">The object that represents a function.</param>\r\n        /// <returns></returns>\r\n        public static string GetDescription(string functionName, object functionObject)\r\n        {\r\n            var attr = functionObject.GetType()\r\n                                     .GetCustomAttributes(typeof(FunctionAttribute), false)\r\n                                     .Cast<FunctionAttribute>()\r\n                                     .FirstOrDefault();\r\n            if (attr != null)\r\n            {\r\n                return attr.Description;\r\n            }\r\n\r\n            return String.Format(\"A {0} function\", functionName);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Extracts the function paramteres from an object that represents a function.\r\n        /// </summary>\r\n        /// <param name=\"functionObject\">The object that represents a function.</param>\r\n        /// <param name=\"baseFunctionType\">Type of the base function.</param>\r\n        /// <param name=\"filePath\">Physical file location of the file behind the function, used for logging.</param>\r\n        /// <returns></returns>\r\n        public static IDictionary<string, FunctionParameter> GetParameters(object functionObject, Type baseFunctionType, string filePath)\r\n        {\r\n            var functionParameters = new Dictionary<string, FunctionParameter>();\r\n            IDictionary<string, WidgetFunctionProvider> parameterWidgets = GetParameterWidgets(functionObject);\r\n\r\n            var type = functionObject.GetType();\r\n            while (type != baseFunctionType && type != null)\r\n            {\r\n                var properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.DeclaredOnly);\r\n                foreach (var property in properties)\r\n                {\r\n                    // Skipping overriden base properties\r\n                    if (property.GetAccessors()[0].GetBaseDefinition().DeclaringType == baseFunctionType) continue;\r\n                    // Skipping private setters\r\n                    if (property.GetSetMethod(false) == null) continue;\r\n                    // Skipping explicitly ignored attributes\r\n                    if (property.GetCustomAttributes(typeof(FunctionParameterIgnoreAttribute), false).Any()) continue;\r\n\r\n                    var propType = property.PropertyType;\r\n                    var name = property.Name;\r\n\r\n                    FunctionParameterAttribute attr = null;\r\n                    var attributes = property.GetCustomAttributes(typeof(FunctionParameterAttribute), false).Cast<FunctionParameterAttribute>().ToList();\r\n\r\n                    if (attributes.Count > 1)\r\n                    {\r\n                        Log.LogWarning(LogTitle, \"More than one '{0}' attribute defined on property '{1}'. Location: '{2}'\"\r\n                                                 .FormatWith(typeof(FunctionParameterAttribute).Name, name, filePath));\r\n                    }\r\n                    else\r\n                    {\r\n                        attr = attributes.FirstOrDefault();\r\n                    }\r\n\r\n                    WidgetFunctionProvider attibuteBasedWidgetProvider = null;\r\n                    WidgetFunctionProvider methodBasedWidgetProvider = null;\r\n\r\n                    if (attr != null && attr.HasWidgetMarkup)\r\n                    {\r\n                        try\r\n                        {\r\n                            attibuteBasedWidgetProvider = attr.GetWidgetFunctionProvider(type, property);\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            Log.LogWarning(LogTitle, \"Failed to get widget function provider for parameter property {0}. Location: '{1}'\"\r\n                                                     .FormatWith(property.Name, filePath));\r\n                            Log.LogWarning(LogTitle, ex);\r\n                        }\r\n                    }\r\n\r\n                    parameterWidgets.TryGetValue(name, out methodBasedWidgetProvider);\r\n\r\n                    if (methodBasedWidgetProvider!=null && attibuteBasedWidgetProvider!=null)\r\n                    {\r\n                        Log.LogWarning(LogTitle, \"Widget for property {0} is defined in both {1} attribute and in {2}() method. Remove one of the definitions. Location: '{3}'\"\r\n                                                 .FormatWith(property.Name, nameof(FunctionParameterAttribute), nameof(IParameterWidgetsProvider.GetParameterWidgets), filePath));\r\n                    }\r\n\r\n                    if (!functionParameters.ContainsKey(name))\r\n                    {\r\n                        functionParameters.Add(name, new FunctionParameter(name, propType, attr, attibuteBasedWidgetProvider ?? methodBasedWidgetProvider));\r\n                    }\r\n                }\r\n\r\n                type = type.BaseType;\r\n            }\r\n\r\n            return functionParameters;\r\n        }\r\n\r\n        private static IDictionary<string, WidgetFunctionProvider> GetParameterWidgets(object functionObject)\r\n        {\r\n            var widgetsProvider = functionObject as IParameterWidgetsProvider;\r\n            IDictionary<string, WidgetFunctionProvider> parameterWidgets = widgetsProvider != null ? widgetsProvider.GetParameterWidgets() : null;\r\n\r\n            return parameterWidgets ?? new Dictionary<string, WidgetFunctionProvider>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/FileBasedFunctionProvider/FunctionParameter.cs",
    "content": "﻿using System;\r\nusing System.Reflection;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider\r\n{\r\n    /// <summary>\r\n    /// Represents a function parameter\r\n    /// </summary>\r\n\tpublic class FunctionParameter\r\n\t{\r\n        /// <summary>\r\n        /// Gets the parameter name.\r\n        /// </summary>\r\n\t\tpublic string Name { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the parameter type.\r\n        /// </summary>\r\n\t\tpublic Type Type { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the widget provider.\r\n        /// </summary>\r\n\t\tpublic WidgetFunctionProvider WidgetProvider { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets the function parameter attribute.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The attribute.\r\n        /// </value>\r\n\t\tpublic FunctionParameterAttribute Attribute { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"FunctionParameter\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"name\">The name.</param>\r\n        /// <param name=\"type\">The type.</param>\r\n        /// <param name=\"functionParameterAttribute\">The function parameter attribute.</param>\r\n        /// <param name=\"widgetProvider\">The widget provider.</param>\r\n\t\tpublic FunctionParameter(string name, Type type, FunctionParameterAttribute functionParameterAttribute, WidgetFunctionProvider widgetProvider)\r\n\t\t{\r\n\t\t\tName = name;\r\n\t\t\tType = type;\r\n            Attribute = functionParameterAttribute;\r\n\r\n\t\t\tWidgetProvider = widgetProvider;\r\n\t\t}\r\n\r\n        /// <summary>\r\n        /// Sets the parameter value.\r\n        /// </summary>\r\n        /// <param name=\"functionObject\">The function object.</param>\r\n        /// <param name=\"parameterValue\">The parameter value.</param>\r\n\t\tpublic void SetValue(object functionObject, object parameterValue)\r\n        {\r\n            GetParameterProperty(functionObject.GetType(), Name).SetValue(functionObject, parameterValue, null);\r\n\t\t}\r\n\r\n        private static PropertyInfo GetParameterProperty(Type type, string propertyName)\r\n        {\r\n            var bindingFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty | BindingFlags.DeclaredOnly;\r\n\r\n            Type currentType = type;\r\n\r\n            while (currentType != typeof(Type))\r\n            {\r\n                var property = currentType.GetProperty(propertyName, bindingFlags);\r\n\r\n                if (property != null) return property;\r\n\r\n                currentType = currentType.BaseType;\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Failed to find parameter property '{0}' on type '{1}'\".FormatWith(propertyName, type.FullName));\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/FileBasedFunctionProvider/IParameterWidgetsProvider.cs",
    "content": "﻿using System.Collections.Generic;\nusing Composite.Functions;\n\nnamespace Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider\n{\n    /// <exclude />\n    public interface IParameterWidgetsProvider\n    {\n        /// <exclude />\n        IDictionary<string, WidgetFunctionProvider> GetParameterWidgets();\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/FileBasedFunctionProvider/NotLoadedFileBasedFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider\r\n{\r\n    internal class NotLoadedFileBasedFunction<T> : FileBasedFunction<T>, IFunctionInitializationInfo where T : FileBasedFunction<T>\r\n    {\r\n        private readonly Exception _exception;\r\n\r\n        public NotLoadedFileBasedFunction(\r\n            FileBasedFunctionProvider<T> provider,\r\n            string @namespace, \r\n            string functionName,\r\n            string virtualPath,\r\n            Exception exception): \r\n            base(@namespace, functionName, string.Empty, null, typeof(void), virtualPath, provider)\r\n        {\r\n            _exception = exception;\r\n        }\r\n\r\n        public override string Description {\r\n            get {\r\n                return  (_exception != null) ? RemoveApplicationPath(_exception.Message) : base.Description;\r\n            }\r\n        }\r\n\r\n        private static string RemoveApplicationPath(string compilationErrorMessage)\r\n        {\r\n            if (compilationErrorMessage.StartsWith(HostingEnvironment.ApplicationPhysicalPath, StringComparison.OrdinalIgnoreCase))\r\n            {\r\n                return compilationErrorMessage.Substring(HostingEnvironment.ApplicationPhysicalPath.Length - 1);\r\n            }\r\n\r\n            return compilationErrorMessage;\r\n        }\r\n\r\n        override public object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (_exception is HttpException)\r\n            {\r\n                EmbedSourceCodeInformation(_exception as HttpException);\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Failed to load function '{0}'\".FormatWith(this.CompositeName()), _exception);\r\n        }\r\n\r\n        Type IMetaFunction.ReturnType\r\n        {\r\n            get { return typeof(void); }\r\n        }\r\n\r\n        protected override void InitializeParameters()\r\n        {\r\n            Parameters = new Dictionary<string, FunctionParameter>();\r\n        }\r\n\r\n        IEnumerable<ParameterProfile> IMetaFunction.ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                return new ParameterProfile[0];\r\n            }\r\n        }\r\n\r\n        bool IFunctionInitializationInfo.FunctionInitializedCorrectly\r\n        {\r\n            get { return false; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/MethodBasedFunctionProvider/MethodBasedDefaultValueAttribute.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.MethodBasedFunctionProvider\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]\r\n\tpublic sealed class MethodBasedDefaultValueAttribute : Attribute\r\n    {\r\n        /// <exclude />\r\n        public MethodBasedDefaultValueAttribute(string parameterName, object defaultValue)\r\n        {\r\n            this.ParameterName = parameterName;\r\n            this.DefaultValue = defaultValue;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string ParameterName\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n\r\n        /// <exclude />\r\n        public object DefaultValue\r\n        {\r\n            get;\r\n            private set;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/MethodBasedFunctionProvider/MethodBasedFunction.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Web.Hosting;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.MethodBasedFunctionProvider\r\n{\r\n    internal class MethodBasedFunction : IFunction\r\n    {\r\n        private static string LogTitle;\r\n\r\n        private readonly IMethodBasedFunctionInfo _methodBasedFunctionInfo;\r\n        private readonly Type _type;\r\n        private readonly MethodInfo _methodInfo;\r\n        private volatile IList<ParameterProfile> _parameterProfile;\r\n        private string _functionDescription;\r\n        private object _object;\r\n\r\n        protected MethodBasedFunction(string logTitle)\r\n        {\r\n            LogTitle = logTitle;\r\n        }\r\n\r\n        protected MethodBasedFunction(IMethodBasedFunctionInfo info, Type type, MethodInfo methodInfo) : this(typeof(MethodBasedFunction).Name)\r\n        {\r\n            _methodBasedFunctionInfo = info;\r\n            _type = type;\r\n            _methodInfo = methodInfo;\r\n        }\r\n\r\n\r\n\r\n        public static MethodBasedFunction Create(IMethodBasedFunctionInfo info)\r\n        {\r\n            Type type = TypeManager.TryGetType(info.Type);\r\n            string errorMessage;\r\n\r\n            if (type == null)\r\n            {\r\n                errorMessage = \"Could not find the type '{0}'\".FormatWith(info.Type);\r\n\r\n                // Skipping error log while package installation, the type/method may be available after restart\r\n                if (!HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                {\r\n                    Log.LogError(LogTitle, GetErrorMessage(info) + errorMessage);\r\n                }\r\n\r\n                return new NotLoadedMethodBasedFunction(info, errorMessage);\r\n            }\r\n\r\n            MethodInfo methodInfo = GetMethodInfo(type, info.MethodName, info.Namespace, info.UserMethodName, out errorMessage);\r\n            return methodInfo == null ? new NotLoadedMethodBasedFunction(info, errorMessage) : new MethodBasedFunction(info, type, methodInfo);\r\n        }\r\n\r\n        protected static MethodInfo GetMethodInfo(Type type, string methodName, string @namespace, string userMethodName, out string errorMessage)\r\n\t\t{\r\n            MethodInfo methodInfo = type.GetMethods().FirstOrDefault(mi => mi.Name == methodName);\r\n\r\n            errorMessage = null;\r\n            if (methodInfo == null)\r\n            {\r\n                errorMessage = \"Could not find the method '{0}' on the the type '{1}'\".FormatWith(methodName, type.Name);\r\n\r\n                // Skipping error log while package installation, the type/method may be available after restart\r\n                if (!HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                {\r\n                    Log.LogError(LogTitle, GetErrorMessage(@namespace, userMethodName) + errorMessage);\r\n                }\r\n            }\r\n            return methodInfo;\r\n        }\r\n\r\n        private static string GetErrorMessage(string @namespace, string userMethodName)\r\n        {\r\n            return \"Failed to initialize function '{0}.{1}'. \".FormatWith(@namespace, userMethodName);\r\n        }\r\n\r\n        private static string GetErrorMessage(IMethodBasedFunctionInfo info)\r\n        {\r\n            return \"Failed to initialize function '{0}.{1}'. \".FormatWith(info.Namespace, info.UserMethodName);\r\n        }\r\n\r\n        public virtual object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            IList<object> arguments = new List<object>();\r\n            foreach (ParameterProfile paramProfile in ParameterProfiles)\r\n            {\r\n                arguments.Add(parameters.GetParameter(paramProfile.Name, paramProfile.Type));\r\n            }\r\n\r\n            object @object = this.MethodInfo.IsStatic ? null : this.Object;\r\n            return this.MethodInfo.Invoke(@object, arguments.ToArray());\r\n        }\r\n\r\n\r\n\r\n        public virtual string Name\r\n        {\r\n            get { return _methodBasedFunctionInfo.UserMethodName; }\r\n        }\r\n\r\n\r\n\r\n        public virtual string Namespace\r\n        {\r\n            get { return _methodBasedFunctionInfo.Namespace; }\r\n        }\r\n\r\n\r\n\r\n        public virtual string Description \r\n        { \r\n            get\r\n            {\r\n                if (string.IsNullOrEmpty(_functionDescription))\r\n                {\r\n                    _functionDescription = this.MethodInfo.GetCustomAttributes(typeof(FunctionAttribute), true).Select(f => ((FunctionAttribute)f).Description).FirstOrDefault();\r\n                    if (string.IsNullOrEmpty(_functionDescription))\r\n                    {\r\n                        return string.Format(\"This is a static method call to the function '{0}' on '{1}'.\", _methodBasedFunctionInfo.MethodName, _methodBasedFunctionInfo.Type);\r\n                    }\r\n                }\r\n                return _functionDescription;\r\n            }\r\n        }\r\n\r\n\r\n        public Type ReturnType\r\n        {\r\n            get { return MethodInfo.ReturnType; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<ParameterProfile> ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                if (_parameterProfile == null)\r\n                {\r\n                    lock (this)\r\n                    {\r\n                        if (_parameterProfile == null)\r\n                        {\r\n                            _parameterProfile = InitializeParamteres();\r\n                        }\r\n                    }\r\n                }\r\n                return _parameterProfile;\r\n            }\r\n        }\r\n\r\n        private IList<ParameterProfile> InitializeParamteres()\r\n        {\r\n            ParameterInfo[] parameterInfos = this.MethodInfo.GetParameters();\r\n\r\n            var defaultValues = new Dictionary<string, object>();\r\n            var labels = new Dictionary<string, string>();\r\n            var helpTexts = new Dictionary<string, string>();\r\n            var widgetProviders = new Dictionary<string, WidgetFunctionProvider>();\r\n            var parametersToHideInSimpleView = new HashSet<string>();\r\n\r\n            foreach (object obj in this.MethodInfo.GetCustomAttributes(typeof (MethodBasedDefaultValueAttribute), true))\r\n            {\r\n                MethodBasedDefaultValueAttribute attribute = (MethodBasedDefaultValueAttribute) obj;\r\n                defaultValues.Add(attribute.ParameterName, attribute.DefaultValue);\r\n            }\r\n\r\n            // Run through obsolete FunctionParameterDescriptionAttribute\r\n#pragma warning disable 612,618\r\n            foreach (\r\n                object obj in this.MethodInfo.GetCustomAttributes(typeof (FunctionParameterDescriptionAttribute), true))\r\n            {\r\n                FunctionParameterDescriptionAttribute attribute = (FunctionParameterDescriptionAttribute) obj;\r\n                if (attribute.HasDefaultValue && !defaultValues.ContainsKey(attribute.ParameterName))\r\n                    defaultValues.Add(attribute.ParameterName, attribute.DefaultValue);\r\n\r\n                labels.Add(attribute.ParameterName, attribute.ParameterLabel);\r\n                helpTexts.Add(attribute.ParameterName, attribute.ParameterHelpText);\r\n            }\r\n#pragma warning restore 612,618\r\n\r\n            // Run trhough new and improved FunctionParameterAttribute. Many may exist for one parameter.\r\n            foreach (object obj in this.MethodInfo.GetCustomAttributes(typeof (FunctionParameterAttribute), true))\r\n            {\r\n                var attribute = (FunctionParameterAttribute) obj;\r\n\r\n                Verify.That(attribute.HasName,\r\n                            \"All [FunctionParameter(...)] definitions on the method '{0}' must have 'Name' specified.\",\r\n                            this.MethodInfo.Name);\r\n\r\n                string parameterName = attribute.Name;\r\n\r\n                if (attribute.HasDefaultValue && !defaultValues.ContainsKey(parameterName))\r\n                    defaultValues.Add(parameterName, attribute.DefaultValue);\r\n\r\n                if (attribute.HasLabel && !labels.ContainsKey(parameterName))\r\n                    labels.Add(parameterName, attribute.Label);\r\n\r\n                if (attribute.HasHelp && !helpTexts.ContainsKey(parameterName))\r\n                    helpTexts.Add(parameterName, attribute.Help);\r\n\r\n                if (attribute.HasWidgetMarkup && !widgetProviders.ContainsKey(parameterName))\r\n                {\r\n                    try\r\n                    {\r\n                        var widgetFunctionProvider = attribute.GetWidgetFunctionProvider(null, null);\r\n                        widgetProviders.Add(parameterName, widgetFunctionProvider);\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        string errText = \"Failed to set Widget Markup for parameter '{0}' on method '{1}'. {2}\"\r\n                            .FormatWith(parameterName, this.MethodInfo.Name, ex.Message);\r\n                        throw new InvalidOperationException(errText);\r\n                    }\r\n                }\r\n\r\n                if (attribute.HideInSimpleView)\r\n                {\r\n                    parametersToHideInSimpleView.Add(parameterName);\r\n                }\r\n            }\r\n\r\n            var result = new List<ParameterProfile>();\r\n\r\n            foreach (ParameterInfo parameterInfo in parameterInfos)\r\n            {\r\n                string parameterName = parameterInfo.Name;\r\n\r\n                BaseValueProvider valueProvider;\r\n                object defaultValue = null;\r\n                if (defaultValues.TryGetValue(parameterName, out defaultValue))\r\n                {\r\n                    valueProvider = new ConstantValueProvider(defaultValue);\r\n                }\r\n                else\r\n                {\r\n                    valueProvider = new NoValueValueProvider();\r\n                }\r\n\r\n                bool isRequired = !defaultValues.ContainsKey(parameterName);\r\n\r\n                string parameterLabel = parameterInfo.Name;\r\n                if (labels.ContainsKey(parameterName)) parameterLabel = labels[parameterName];\r\n\r\n                string parameterHelpText = \"\";\r\n                if (helpTexts.ContainsKey(parameterName)) parameterHelpText = helpTexts[parameterName];\r\n\r\n                WidgetFunctionProvider widgetFunctionProvider =\r\n                    (widgetProviders.ContainsKey(parameterName)\r\n                         ? widgetProviders[parameterName]\r\n                         : StandardWidgetFunctions.GetDefaultWidgetFunctionProviderByType(parameterInfo.ParameterType));\r\n\r\n                bool hideInSimpleView = parametersToHideInSimpleView.Contains(parameterName);\r\n\r\n                result.Add(new ParameterProfile(parameterName, parameterInfo.ParameterType, isRequired,\r\n                                             valueProvider, widgetFunctionProvider, parameterLabel,\r\n                                             new HelpDefinition(parameterHelpText),\r\n                                             hideInSimpleView));\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        protected virtual MethodInfo MethodInfo\r\n        {\r\n            get\r\n            {\r\n                return _methodInfo;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private object Object\r\n        {\r\n            get\r\n            {\r\n                if (_object == null)\r\n                {\r\n                    _object = Activator.CreateInstance(_type);\r\n                }\r\n\r\n                return _object;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public virtual EntityToken EntityToken\r\n        {\r\n            get\r\n            {\r\n                return _methodBasedFunctionInfo.GetDataEntityToken();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/MethodBasedFunctionProvider/MethodBasedFunctionProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Threading;\r\nusing Composite.Core;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Inline;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.MethodBasedFunctionProvider\r\n{\r\n    [ConfigurationElementType(typeof(MethodBasedFunctionProviderData))]\r\n    internal sealed class MethodBasedFunctionProvider : IFunctionProvider\r\n    {\r\n        static readonly FileRelatedDataCache<Type> _inlineFunctionReturnTypeCache = new FileRelatedDataCache<Type>(\r\n            \"Functions\",\r\n            \"inlineFuncReturnType\",\r\n            (type, filePath) => C1File.WriteAllText(filePath, TypeManager.SerializeType(type)),\r\n            (filePath) => TypeManager.TryGetType(C1File.ReadAllText(filePath)));\r\n\r\n        private static readonly string LogTitle = typeof (MethodBasedFunctionProvider).Name;\r\n\r\n        private FunctionNotifier _functionNotifier;\r\n\r\n        public MethodBasedFunctionProvider()\r\n        {\r\n            var events = ChangeEventsSingleton.Instance;\r\n\r\n            lock (events.SyncRoot)\r\n            {\r\n                events.DataChangedEvent += OnDataChanged;\r\n                events.FileChangedEvent += CodeFileDirectoryWatcher_Changed;\r\n            }\r\n        }\r\n\r\n\r\n        public FunctionNotifier FunctionNotifier\r\n        {\r\n            set { _functionNotifier = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<IFunction> Functions\r\n        {\r\n            get\r\n            {\r\n                IList<IFunction> result = new List<IFunction>();\r\n\r\n\r\n                var methodBasedFunctionInfos = DataFacade.GetData<IMethodBasedFunctionInfo>();\r\n\r\n                foreach (IMethodBasedFunctionInfo info in methodBasedFunctionInfos)\r\n                {\r\n                    IFunction methodBasedFunction = MethodBasedFunction.Create(info);\r\n\r\n                    if (methodBasedFunction == null) continue;\r\n\r\n                    result.Add(methodBasedFunction);\r\n                }\r\n\r\n\r\n                var editableMethodBasedFunctionInfos = DataFacade.GetData<IInlineFunction>();\r\n                    \r\n\r\n                foreach (IInlineFunction info in editableMethodBasedFunctionInfos)\r\n                {\r\n                    Type cachedReturnType = GetCachedReturnType(info);\r\n\r\n                    IFunction inlineFunction;\r\n                    \r\n                    if (cachedReturnType != null)\r\n                    {\r\n                        inlineFunction = new LazyInitializedInlineFunction(info, cachedReturnType);\r\n                    }\r\n                    else\r\n                    {\r\n                        inlineFunction = InlineFunction.Create(info);\r\n\r\n                        if (!(inlineFunction is NotLoadedInlineFunction))\r\n                        {\r\n                            AddReturnTypeToCache(info, inlineFunction.ReturnType);\r\n                        }\r\n                    }\r\n\r\n                    result.Add(inlineFunction);\r\n                }\r\n\r\n                return result;\r\n            }\r\n        }\r\n\r\n\r\n        private void AddReturnTypeToCache(IInlineFunction info, Type type)\r\n        {\r\n            string functionName = info.Namespace + \".\" + info.Name;\r\n            string filePath = info.GetSourceFilePath();\r\n\r\n            _inlineFunctionReturnTypeCache.Add(functionName, filePath, type);\r\n        }\r\n\r\n        private Type GetCachedReturnType(IInlineFunction info)\r\n        {\r\n            string functionName = info.Namespace + \".\" + info.Name;\r\n            string filePath = info.GetSourceFilePath();\r\n\r\n            Type type;\r\n            if(!_inlineFunctionReturnTypeCache.Get(functionName, filePath, out type))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return type;\r\n        }\r\n\r\n        private void OnDataChanged(object sender, EventArgs eventArgs)\r\n        {\r\n            // Checking for null since it is possible that event will be raised before the provider is fully initialized\r\n            if (_functionNotifier != null)\r\n            {\r\n                _functionNotifier.FunctionsUpdated();\r\n            }\r\n        }\r\n\r\n\r\n        void CodeFileDirectoryWatcher_Changed(object sender, FileSystemEventArgs e)\r\n        {\r\n            // Checking for null since it is possible that event will be raised before the provider is fully initialized\r\n            if (_functionNotifier != null)\r\n            {\r\n                _functionNotifier.FunctionsUpdated();\r\n            }\r\n        }\r\n\r\n\r\n        private sealed class ChangeEventsSingleton\r\n        {\r\n            public readonly object SyncRoot = new object();\r\n            public event EventHandler DataChangedEvent;\r\n            public event FileSystemEventHandler FileChangedEvent;\r\n\r\n            private readonly C1FileSystemWatcher _codeDirectoryFileSystemWatcher;\r\n            private DateTime _lastWriteHandleTime = DateTime.MinValue;\r\n            private object _fileUpdateLock = new object();\r\n\r\n            private ChangeEventsSingleton()\r\n            {\r\n                DataEventSystemFacade.SubscribeToStoreChanged<IMethodBasedFunctionInfo>(OnDataChanged, true);\r\n                DataEventSystemFacade.SubscribeToDataDeleted<IInlineFunction>(OnDataChanged, true);\r\n                DataEventSystemFacade.SubscribeToStoreChanged<IInlineFunction>(OnStoreChanged, true);\r\n\r\n                string folderToWatch = PathUtil.Resolve(GlobalSettingsFacade.InlineCSharpFunctionDirectory);\r\n\r\n                DirectoryUtils.EnsureDirectoryExists(folderToWatch);\r\n\r\n                _codeDirectoryFileSystemWatcher = new C1FileSystemWatcher(folderToWatch)\r\n                {\r\n                    NotifyFilter = NotifyFilters.LastWrite,\r\n                    EnableRaisingEvents = true,\r\n                    IncludeSubdirectories = true\r\n                };\r\n\r\n                _codeDirectoryFileSystemWatcher.Changed += OnFileWatcherEvent;\r\n            }\r\n\r\n            void OnFileWatcherEvent(object sender, FileSystemEventArgs e)\r\n            {\r\n                FileSystemEventHandler hander = FileChangedEvent;\r\n                if (hander != null)\r\n                {\r\n                    lock (_fileUpdateLock)\r\n                    {\r\n                        bool fileExists = true;\r\n                        if (fileExists)\r\n                        {\r\n                            // Supress multiple events fireing by observing last write time\r\n                            DateTime writeTime = C1File.GetLastWriteTime(e.FullPath);\r\n                            if (_lastWriteHandleTime < writeTime)\r\n                            {\r\n                                _lastWriteHandleTime = writeTime;\r\n\r\n                                try\r\n                                {\r\n                                    using (ThreadDataManager.EnsureInitialize())\r\n                                    {\r\n                                        hander(sender, e);\r\n                                    }\r\n                                }\r\n                                catch (ThreadAbortException)\r\n                                {\r\n                                }\r\n                                catch (Exception ex)\r\n                                {\r\n                                    Log.LogWarning(LogTitle, \"Failed to reload functions on file watcher event\");\r\n                                    Log.LogError(LogTitle, ex);\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            private void OnStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n            {\r\n                if (!storeEventArgs.DataEventsFired)\r\n                {\r\n                    EventHandler hander = DataChangedEvent;\r\n                    if (hander != null)\r\n                    {\r\n                        hander(sender, storeEventArgs);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            private void OnDataChanged(object sender, EventArgs eventArgs)\r\n            {\r\n                EventHandler hander = DataChangedEvent;\r\n                if (hander != null)\r\n                {\r\n                    hander(sender, eventArgs);\r\n                }\r\n            }\r\n\r\n\r\n            public static ChangeEventsSingleton Instance\r\n            {\r\n                get { return Nested.InstanceInt; }\r\n            }\r\n\r\n            class Nested\r\n            {\r\n\r\n                static Nested()\r\n                {\r\n                    // Explicit static constructor to tell C# compiler\r\n                    // not to mark type as beforefieldinit\r\n                }\r\n\r\n                internal static readonly ChangeEventsSingleton InstanceInt = new ChangeEventsSingleton();\r\n            }\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionProviderAssembler))]\r\n    internal sealed class MethodBasedFunctionProviderData : FunctionProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/MethodBasedFunctionProvider/NotLoadedMethodBasedFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.MethodBasedFunctionProvider\r\n{\r\n    internal class NotLoadedMethodBasedFunction : MethodBasedFunction, IFunction, IFunctionInitializationInfo\r\n    {\r\n        private readonly string _errorMessage;\r\n\r\n        public NotLoadedMethodBasedFunction(IMethodBasedFunctionInfo functionInfo, string errorMessage)\r\n            : base(functionInfo, null, null)\r\n        {\r\n            _errorMessage = errorMessage;\r\n        }\r\n\r\n        public override string Description {\r\n            get {\r\n                return _errorMessage;\r\n            }\r\n        }\r\n\r\n        object IFunction.Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            throw new InvalidOperationException(_errorMessage);\r\n        }\r\n\r\n        Type IMetaFunction.ReturnType\r\n        {\r\n            get { return typeof(void); }\r\n        }\r\n\r\n        IEnumerable<ParameterProfile> IMetaFunction.ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                return new ParameterProfile[0];\r\n            }\r\n        }\r\n\r\n        bool IFunctionInitializationInfo.FunctionInitializedCorrectly\r\n        {\r\n            get { return false; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/RazorFunctionProvider/RazorBasedFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Threading;\r\nusing System.Web.WebPages;\r\nusing Composite.AspNet.Razor;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.RazorFunctionProvider\r\n{\r\n    [DebuggerDisplay(\"Razor function: {Namespace + '.' + Name}\")]\r\n    internal class RazorBasedFunction : FileBasedFunction<RazorBasedFunction>, IDynamicFunction\r\n\t{\r\n\t\tpublic RazorBasedFunction(string ns, string name, string description, \r\n            IDictionary<string, FunctionParameter> parameters, Type returnType, string virtualPath, \r\n            bool preventCaching,\r\n            FileBasedFunctionProvider<RazorBasedFunction> provider)\r\n\t\t\t: base(ns, name, description, parameters, returnType, virtualPath, provider)\r\n\t\t{\r\n\t\t    PreventFunctionOutputCaching = preventCaching;\r\n        }\r\n\r\n        public RazorBasedFunction(string ns, string name, string description, Type returnType, string virtualPath, bool preventCaching, FileBasedFunctionProvider<RazorBasedFunction> provider)\r\n            : base(ns, name, description, returnType, virtualPath, provider)\r\n        {\r\n            PreventFunctionOutputCaching = preventCaching;\r\n        }\r\n\r\n        protected override void InitializeParameters()\r\n        {\r\n            WebPageBase razorPage = null;\r\n\r\n            try\r\n            {\r\n                using (BuildManagerHelper.DisableUrlMetadataCachingScope())\r\n                {\r\n                    razorPage = WebPage.CreateInstanceFromVirtualPath(VirtualPath);\r\n                }\r\n\r\n                var razorFunction = razorPage as RazorFunction;\r\n                if (razorFunction == null)\r\n                {\r\n                    throw new InvalidOperationException($\"Failed to initialize function from cache. Path: '{VirtualPath}'\");\r\n                }\r\n\r\n                Parameters = FunctionBasedFunctionProviderHelper.GetParameters(razorFunction, typeof (RazorFunction), VirtualPath);\r\n                PreventFunctionOutputCaching = razorFunction.PreventFunctionOutputCaching;\r\n            }\r\n            finally\r\n            {\r\n                (razorPage as IDisposable)?.Dispose();\r\n            }\r\n        }\r\n\r\n\t\tpublic override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n\t\t{\r\n\t\t    void SetParametersAction(WebPageBase webPageBase)\r\n\t\t    {\r\n\t\t        foreach (var param in parameters.AllParameterNames)\r\n\t\t        {\r\n\t\t            var parameter = Parameters[param];\r\n\r\n\t\t            object parameterValue = parameters.GetParameter(param);\r\n\r\n\t\t            parameter.SetValue(webPageBase, parameterValue);\r\n\t\t        }\r\n\t\t    }\r\n\r\n\t\t    try\r\n            {\r\n                return RazorHelper.ExecuteRazorPage(VirtualPath, SetParametersAction, ReturnType, context);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                EmbedExecutionExceptionSourceCode(ex);\r\n\r\n                throw;\r\n            }\r\n\t\t}\r\n\r\n        private void EmbedExecutionExceptionSourceCode(Exception ex)\r\n        {\r\n            if (ex is ThreadAbortException\r\n                   || ex is StackOverflowException\r\n                   || ex is OutOfMemoryException\r\n                   || ex is ThreadInterruptedException)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var stackTrace = new StackTrace(ex, true);\r\n\r\n            string fullFilePath = PathUtil.Resolve(VirtualPath);\r\n\r\n            foreach (var frame in stackTrace.GetFrames())\r\n            {\r\n                string fileName = frame.GetFileName();\r\n\r\n                if (fileName != null && fileName.StartsWith(fullFilePath, StringComparison.InvariantCultureIgnoreCase))\r\n                {\r\n                    var sourceCode = C1File.ReadAllLines(fileName);\r\n\r\n                    XhtmlErrorFormatter.EmbedSourceCodeInformation(ex, sourceCode, frame.GetFileLineNumber());\r\n                    return;\r\n                }\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n\t    public bool PreventFunctionOutputCaching { get; protected set; }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/RazorFunctionProvider/RazorFunctionProvider.cs",
    "content": "using System;\r\nusing System.Web.Hosting;\r\nusing System.Web.WebPages;\r\nusing Composite.AspNet.Razor;\r\nusing Composite.Core;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.RazorFunctionProvider\r\n{\r\n    [ConfigurationElementType(typeof(RazorFunctionProviderData))]\r\n    internal class RazorFunctionProvider : FileBasedFunctionProvider<RazorBasedFunction>\r\n    {\r\n        protected override string FileExtension => \"cshtml\";\r\n\r\n        protected override string DefaultFunctionNamespace => \"Razor\";\r\n\r\n\r\n        public RazorFunctionProvider(string name, string folder) : base(name, folder) { }\r\n\r\n\r\n        protected override IFunction InstantiateFunction(string virtualPath, string @namespace, string name)\r\n        {\r\n            if (!HostingEnvironment.IsHosted)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            WebPageBase razorPage;\r\n            using (BuildManagerHelper.DisableUrlMetadataCachingScope())\r\n            {\r\n                razorPage = WebPage.CreateInstanceFromVirtualPath(virtualPath);\r\n            }\r\n\r\n            if (!(razorPage is RazorFunction razorFunction))\r\n            {\r\n                Log.LogWarning(nameof(RazorFunctionProvider),\r\n                    $\"Razor page '{virtualPath}' does not inherit from the base class for razor functions '{typeof(RazorFunction).FullName}' and will be ignored\");\r\n                return null;\r\n            }\r\n\r\n            try\r\n            {\r\n                var functionParameters = FunctionBasedFunctionProviderHelper.GetParameters(\r\n                    razorFunction, typeof(RazorFunction), virtualPath);\r\n\r\n                return new RazorBasedFunction(@namespace, name, \r\n                    razorFunction.FunctionDescription, \r\n                    functionParameters,\r\n                    razorFunction.FunctionReturnType, \r\n                    virtualPath,\r\n                    razorFunction.PreventFunctionOutputCaching,\r\n                    this);\r\n            }\r\n            finally\r\n            {\r\n                razorFunction.Dispose();\r\n            }\r\n        }\r\n\r\n        protected override IFunction InstantiateFunctionFromCache(string virtualPath, string @namespace, string name, Type returnType, string cachedDescription, bool preventCaching)\r\n        {\r\n            if (returnType != null)\r\n            {\r\n                return new RazorBasedFunction(@namespace, name, cachedDescription, returnType, virtualPath, preventCaching, this);\r\n            }\r\n\r\n            return InstantiateFunction(virtualPath, @namespace, name);\r\n        }\r\n\r\n        protected override bool HandleChange(string path)\r\n        {\r\n            return path.EndsWith(FileExtension);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/RazorFunctionProvider/RazorFunctionProviderAssembler.cs",
    "content": "﻿using System;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.RazorFunctionProvider\r\n{\r\n\tinternal class RazorFunctionProviderAssembler : IAssembler<IFunctionProvider, FunctionProviderData>\r\n\t{\r\n\t\tIFunctionProvider IAssembler<IFunctionProvider, FunctionProviderData>.Assemble(IBuilderContext context, FunctionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n\t\t{\r\n\t\t\tvar data = objectConfiguration as RazorFunctionProviderData;\r\n\t\t\tif (data == null)\r\n\t\t\t{\r\n\t\t\t\tthrow new ArgumentException(\"Expected configuration to be of type RazorFunctionProviderData\", \"objectConfiguration\");\r\n\t\t\t}\r\n\r\n\t\t\treturn new RazorFunctionProvider(data.Name, data.Directory);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/RazorFunctionProvider/RazorFunctionProviderData.cs",
    "content": "﻿using System.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.RazorFunctionProvider\r\n{\r\n\t[Assembler(typeof(RazorFunctionProviderAssembler))]\r\n\tinternal class RazorFunctionProviderData : FunctionProviderData\r\n\t{\r\n\t\t[ConfigurationProperty(\"directory\", IsRequired = false, DefaultValue = \"~/App_Data/Razor\")]\r\n\t\tpublic string Directory\r\n\t\t{\r\n\t\t\tget { return (string)base[\"directory\"]; }\r\n\t\t\tset { base[\"directory\"] = value; }\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/SqlFunctionProvider/SqlFunction.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Data.OleDb;\r\nusing System.Data.SqlClient;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Cryptography;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Sql;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.ManagedParameters;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.SqlFunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class SqlFunction : IFunction\r\n    {\r\n        ISqlFunctionInfo _functionInfo;\r\n        IEnumerable<ParameterProfile> _parameterProfiles;\r\n        private object _lock = new object();\r\n\r\n\r\n        /// <exclude />\r\n        public SqlFunction(ISqlFunctionInfo functionInfo, IEnumerable<ParameterProfile> parameterProfiles)\r\n            : this(functionInfo)\r\n        {\r\n            _parameterProfiles = parameterProfiles;\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public SqlFunction(ISqlFunctionInfo functionInfo)\r\n        {\r\n            _functionInfo = functionInfo;\r\n            Updated = true;\r\n        }\r\n\r\n\r\n\r\n        private bool Updated\r\n        {\r\n            get\r\n            {\r\n                return RequestLifetimeCache.HasKey(this);\r\n            }\r\n            set\r\n            {\r\n                Verify.IsTrue(value, \"Only 'true' value can be assigned to this property.\");\r\n                RequestLifetimeCache.Add(this, true);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            EnsureUpdated();\r\n\r\n            Dictionary<string, object> sqlParameters = new Dictionary<string, object>();\r\n\r\n            foreach (ParameterProfile profile in ParameterProfiles)\r\n            {\r\n                object value = parameters.GetParameter(profile.Name);\r\n                sqlParameters.Add(profile.Name, value);\r\n            }\r\n\r\n            ISqlConnection sqlConnection = GetConnection();\r\n\r\n            string connectionString = sqlConnection.EncryptedConnectionString.Decrypt();\r\n            Verify.That(!connectionString.IsNullOrEmpty(), \"Connection string is empty\");\r\n\r\n            string result = null;\r\n            if (sqlConnection.IsMsSql)\r\n            {\r\n                result = RunSequel(connectionString, sqlParameters);\r\n            }\r\n            else\r\n            {\r\n                result = RunOleDbSequel(connectionString, sqlParameters);\r\n            }\r\n\r\n            return BuidlXElement(result);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _functionInfo.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Namespace\r\n        {\r\n            get\r\n            {\r\n                return _functionInfo.Namespace;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public string Description { get { return _functionInfo.Description; } }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public Type ReturnType\r\n        {\r\n            get\r\n            {\r\n                return typeof(XElement);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<ParameterProfile> ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_parameterProfiles == null)\r\n                    {\r\n                        _parameterProfiles = ManagedParameterManager.GetParameterProfiles(_functionInfo.Id);\r\n                    }\r\n                }\r\n                return _parameterProfiles;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private ISqlConnection GetConnection()\r\n        {\r\n            Guid connectionId = _functionInfo.ConnectionId;\r\n            var connection = (from item in DataFacade.GetData<ISqlConnection>()\r\n                              where item.Id == connectionId\r\n                              select item).FirstOrDefault();\r\n            if (connection == null)\r\n            {\r\n                throw new ArgumentException(\"Could not find connection information for query\", \"queryId\");\r\n            }\r\n            return connection;\r\n        }\r\n\r\n\r\n\r\n        private static XElement BuidlXElement(string item)\r\n        {\r\n            string result = \"<root>\" + item + \"</root>\";\r\n            StringReader reader = new StringReader(result);\r\n                \r\n            return XElement.Load(reader);\r\n        }\r\n\r\n\r\n\r\n        private ISqlFunctionInfo GetQuery(Guid xmlQueryId)\r\n        {\r\n            var sqlQuery = (from item in DataFacade.GetData<ISqlFunctionInfo>()\r\n                            where item.Id == xmlQueryId\r\n                            select item).FirstOrDefault();\r\n            return sqlQuery;\r\n        }\r\n\r\n\r\n\r\n        private class ConvertedQuery\r\n        {\r\n            public string Query { get; set; }\r\n            public IDictionary<string, object> Parameters { get; set; }\r\n        }\r\n\r\n\r\n\r\n        private static ConvertedQuery ConvertToMSSqlSyntax(ISqlFunctionInfo queryInfo, IDictionary<string, object> parameterNames)\r\n        {\r\n            ConvertedQuery convertedQuery = new ConvertedQuery();\r\n\r\n            StringBuilder builder = new StringBuilder();\r\n            foreach (string name in parameterNames.Keys)\r\n            {\r\n                builder.Append(name);\r\n                builder.Append(\"|\");\r\n            }\r\n            builder.Remove(builder.Length - 1, 1);\r\n            string regExp = builder.ToString();\r\n\r\n            MatchCollection collection = new Regex(regExp).Matches(queryInfo.Command);\r\n\r\n            IDictionary<string, object> oleDbParams = new Dictionary<string, object>();\r\n            int i = 1;\r\n            foreach (Match match in collection)\r\n            {\r\n                oleDbParams.Add(\"@sp\" + i, parameterNames[match.Value.Trim()]);\r\n                i++;\r\n            }\r\n\r\n            convertedQuery.Parameters = oleDbParams;\r\n            convertedQuery.Query = queryInfo.Command;\r\n\r\n            foreach (string name in parameterNames.Keys)\r\n            {\r\n                convertedQuery.Query = convertedQuery.Query.Replace(name, \"?\");\r\n            }\r\n\r\n            return convertedQuery;\r\n        }\r\n\r\n\r\n\r\n        private static bool ShouldConvert(ISqlFunctionInfo info, IDictionary<string, object> parameters)\r\n        {\r\n            if (info.IsStoredProcedure)\r\n            {\r\n                return false;\r\n            }\r\n            if (parameters.Count == 0)\r\n            {\r\n                return false;\r\n            }\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private string RunOleDbSequel(string connectionString, IDictionary<string, object> parameters)\r\n        {\r\n            string query = _functionInfo.Command;\r\n            IDictionary<string, object> queryParameters = parameters;\r\n\r\n            if (ShouldConvert(_functionInfo, parameters))\r\n            {\r\n                ConvertedQuery convertedQuery = ConvertToMSSqlSyntax(_functionInfo, parameters);\r\n                query = convertedQuery.Query;\r\n                queryParameters = convertedQuery.Parameters;\r\n            }\r\n\r\n\r\n            DataSet dataSet = null;\r\n            string result = string.Empty;\r\n            using (OleDbConnection connection = new OleDbConnection(connectionString))\r\n            {\r\n                using (OleDbCommand command = new OleDbCommand(query, connection))\r\n                {\r\n                    if (_functionInfo.IsStoredProcedure)\r\n                    {\r\n                        command.CommandType = CommandType.StoredProcedure;\r\n                    }\r\n                    else\r\n                    {\r\n                        command.CommandType = CommandType.Text;\r\n                    }\r\n                    foreach (KeyValuePair<string, object> parm in queryParameters)\r\n                    {\r\n                        command.Parameters.Add(new OleDbParameter(parm.Key, parm.Value));\r\n                    }\r\n\r\n                    connection.Open();\r\n                    if (_functionInfo.IsQuery)\r\n                    {\r\n                        dataSet = new DataSet();\r\n                        using (OleDbDataAdapter adapter = new OleDbDataAdapter())\r\n                        {\r\n                            adapter.SelectCommand = command;\r\n                            adapter.Fill(dataSet);\r\n                            if (dataSet != null && !dataSet.HasChanges())\r\n                            {\r\n                                StringWriter writer = new StringWriter();\r\n                                dataSet.WriteXml(writer);\r\n                                result = writer.ToString();\r\n                            }\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        command.ExecuteNonQuery();\r\n                    }\r\n                }\r\n            }           \r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private string RunSequel(string connectionString, IDictionary<string, object> parameters)\r\n        {\r\n            XmlReader reader = null;\r\n            DataSet dataSet = null;\r\n            string result = string.Empty;\r\n\r\n            var connection = SqlConnectionManager.GetConnection(connectionString);\r\n\r\n            using (SqlCommand command = new SqlCommand(_functionInfo.Command, connection))\r\n            {\r\n                if (_functionInfo.IsStoredProcedure)\r\n                {\r\n                    command.CommandType = CommandType.StoredProcedure;\r\n                }\r\n                else\r\n                {\r\n                    command.CommandType = CommandType.Text;\r\n                }\r\n\r\n                foreach (KeyValuePair<string, object> parm in parameters)\r\n                {\r\n                    command.Parameters.Add(new SqlParameter(parm.Key, parm.Value));\r\n                }\r\n\r\n                if (_functionInfo.IsQuery)\r\n                {\r\n                    if (_functionInfo.ReturnsXml)\r\n                    {\r\n                        reader = command.ExecuteXmlReader();\r\n                        StringBuilder builder = new StringBuilder();\r\n                        reader.Read();\r\n                        while (!reader.EOF)\r\n                        {\r\n                            builder.Append(reader.ReadOuterXml());\r\n                        }\r\n\r\n                        result = builder.ToString();\r\n                    }\r\n                    else\r\n                    {\r\n                        dataSet = new DataSet();\r\n                        using (SqlDataAdapter adapter = new SqlDataAdapter())\r\n                        {\r\n                            adapter.SelectCommand = command;\r\n                            adapter.Fill(dataSet);\r\n                            if (dataSet != null && !dataSet.HasChanges())\r\n                            {\r\n                                StringWriter writer = new StringWriter();\r\n                                dataSet.WriteXml(writer);\r\n                                result = writer.ToString();\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    command.ExecuteNonQuery();\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private void EnsureUpdated()\r\n        {\r\n            if (Updated) return;\r\n\r\n            ISqlFunctionInfo oldValue = _functionInfo;\r\n\r\n            _functionInfo = (ISqlFunctionInfo) DataFacade.GetDataFromDataSourceId(_functionInfo.DataSourceId, true);\r\n\r\n            Verify.That(_functionInfo != null, \"Failed to get function '{0}'\", oldValue.Name);\r\n\r\n            Updated = true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken\r\n        {\r\n            get \r\n            {\r\n                return _functionInfo.GetDataEntityToken();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/SqlFunctionProvider/SqlFunctionProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.SqlFunctionProvider\r\n{\r\n    [ConfigurationElementType(typeof(SqlFunctionProviderData))]\r\n    internal sealed class SqlFunctionProvider : IFunctionProvider\r\n    {\r\n        private FunctionNotifier _functionNotifier;\r\n\r\n\r\n        public SqlFunctionProvider()\r\n        {\r\n            DataEventSystemFacade.SubscribeToStoreChanged<ISqlFunctionInfo>(OnDataChanged, false);\r\n        }\r\n\r\n\r\n\r\n        public FunctionNotifier FunctionNotifier\r\n        {\r\n            set { _functionNotifier = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<IFunction> Functions\r\n        {\r\n            get \r\n            {\r\n                IEnumerable<ISqlFunctionInfo> functionInfos = DataFacade.GetData<ISqlFunctionInfo>();\r\n\r\n                IList<IFunction> functions = new List<IFunction>();\r\n                foreach (ISqlFunctionInfo function in functionInfos)\r\n                {\r\n                    functions.Add(new SqlFunction(function));\r\n                }\r\n                return functions;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void OnDataChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            _functionNotifier.FunctionsUpdated();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(SqlFunctionProviderAssembler))]\r\n    internal sealed class SqlFunctionProviderData : FunctionProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n    internal sealed class SqlFunctionProviderAssembler : IAssembler<IFunctionProvider, FunctionProviderData>\r\n    {\r\n        public IFunctionProvider Assemble(IBuilderContext context, FunctionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new SqlFunctionProvider();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/AspNet/LoadUserControlFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.AspNet\r\n{\r\n    internal sealed class LoadUserControlFunction : StandardFunctionBase\r\n    {\r\n        public LoadUserControlFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"LoadUserControl\", \"Composite.AspNet\", typeof(UserControl), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Path\", typeof(string), true, new NoValueValueProvider(), StandardWidgetFunctions.TextBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string path = parameters.GetParameter<string>(\"Path\");\r\n\r\n            Page currentPage = HttpContext.Current.Handler as Page;\r\n            if (currentPage == null) throw new InvalidOperationException(\"The Current HttpContext Handler must be a System.Web.Ui.Page\");\r\n\r\n            return currentPage.LoadControl(path);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Constant/BooleanFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Constant\r\n{\r\n    internal sealed class BooleanFunction : StandardFunctionBase\r\n    {\r\n        public BooleanFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Boolean\", \"Composite.Constant\", typeof(bool), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.GetBoolSelectorWidget(\"True\", \"False\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Constant\", typeof(bool), true, new ConstantValueProvider(false), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return parameters.GetParameter<bool>(\"Constant\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Constant/DateTimeFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Constant\r\n{\r\n    internal sealed class DateTimeFunction : StandardFunctionBase\r\n    {\r\n        public DateTimeFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DateTime\", \"Composite.Constant\", typeof(DateTime), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider dateSelectorWidget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Constant\", typeof(DateTime), true, new ConstantValueProvider(DateTime.Now), dateSelectorWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return parameters.GetParameter<DateTime>(\"Constant\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Constant/DecimalFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Constant\r\n{\r\n    internal sealed class DecimalFunction : StandardFunctionBase\r\n    {\r\n        public DecimalFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Decimal\", \"Composite.Constant\", typeof(decimal), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DecimalTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Constant\", typeof(decimal), true, new ConstantValueProvider(new decimal(0)), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return parameters.GetParameter<decimal>(\"Constant\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Constant/GuidFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Constant\r\n{\r\n    internal sealed class GuidFunction : StandardFunctionBase\r\n    {\r\n        public GuidFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Guid\", \"Composite.Constant\", typeof(Guid), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.GuidTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Constant\", typeof(Guid), true, new ConstantValueProvider(Guid.Empty), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return new Guid(parameters.GetParameter<string>(\"Constant\"));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Constant/IntegerFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Constant\r\n{\r\n    internal sealed class IntegerFunction : StandardFunctionBase\r\n    {\r\n        public IntegerFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Integer\", \"Composite.Constant\", typeof(int), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Constant\", typeof(int), true, new ConstantValueProvider(0), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return parameters.GetParameter<int>(\"Constant\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Constant/StringFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Constant\r\n{\r\n    internal sealed class StringFunction : StandardFunctionBase\r\n    {\r\n        public StringFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"String\", \"Composite.Constant\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextAreaWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\"Constant\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return parameters.GetParameter<string>(\"Constant\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Constant/XhtmlDocumentFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Constant\r\n{\r\n    internal sealed class XhtmlDocumentFunction : StandardFunctionBase\r\n    {\r\n        public XhtmlDocumentFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"XhtmlDocument\", \"Composite.Constant\", typeof(XhtmlDocument), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider editorWidget = StandardWidgetFunctions.VisualXhtmlDocumentEditorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\"Constant\", typeof(XhtmlDocument), true, new NoValueValueProvider(), editorWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return parameters.GetParameter<XhtmlDocument>(\"Constant\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Foundation/DowncastableStandardFunctionBase.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation\r\n{\r\n    internal abstract class DowncastableStandardFunctionBase : StandardFunctionBase, IDowncastableFunction\r\n\t{\r\n        public DowncastableStandardFunctionBase(string name, string namespaceName, Type returnType, EntityTokenFactory entityTokenFactory)\r\n            : base(name,namespaceName, returnType, entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public bool ReturnValueIsDowncastable\r\n        {\r\n            get \r\n            { \r\n                return true; \r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Foundation/EntityTokenFactory.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.Functions;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class EntityTokenFactory\r\n\t{\r\n        private readonly string _providerName;\r\n\r\n        /// <exclude />\r\n        public EntityTokenFactory(string providerName)\r\n        {\r\n            _providerName = providerName;\r\n        }\r\n\r\n        internal EntityToken CreateEntityToken(IMetaFunction function)\r\n        {\r\n            string id = StringExtensionMethods.CreateNamespace(function.Namespace, function.Name, '.');\r\n\r\n            return new StandardFunctionProviderEntityToken(_providerName, id );\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Foundation/StandardFunctionBase.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Logging;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation\r\n{\r\n    internal abstract class StandardFunctionBase : IFunction\r\n    {\r\n        private EntityTokenFactory _entityTokenFactory;\r\n\r\n        internal StandardFunctionBase(string name, string namespaceName, Type returnType, EntityTokenFactory entityTokenFactory)\r\n        {\r\n            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(\"name\");\r\n            if (string.IsNullOrEmpty(namespaceName)) throw new ArgumentNullException(\"namespaceName\");\r\n            if (entityTokenFactory == null) throw new ArgumentNullException(\"entityTokenFactory\");\r\n\r\n            this.Namespace = namespaceName;\r\n            this.Name = name;\r\n            this.ReturnType = returnType;\r\n            \r\n            _entityTokenFactory = entityTokenFactory;\r\n\r\n            this.ResourceHandleNameStem = string.Format(\"{0}.{1}\", this.Namespace, this.Name);\r\n        }\r\n\r\n\r\n\r\n        public string Name { get; private set; }\r\n\r\n        public string Namespace { get; protected set; }\r\n\r\n        public string Description\r\n        {\r\n            get\r\n            {\r\n                return LocalizationToken(\"description\");\r\n            }\r\n        }\r\n\r\n        public Type ReturnType { get; private set; }\r\n\r\n\r\n        public IEnumerable<ParameterProfile> ParameterProfiles\r\n        {\r\n            get\r\n            {\r\n\r\n                foreach (StandardFunctionParameterProfile param in this.StandardFunctionParameterProfiles)\r\n                {\r\n                    string labelString;\r\n                    string helpString;\r\n\r\n                    if (string.IsNullOrEmpty(param.CustomLabel) == false)\r\n                    {\r\n                        labelString = param.CustomLabel;\r\n                    }\r\n                    else\r\n                    {\r\n                        labelString = LocalizationToken(string.Format(\"param.{0}.label\", param.Name));\r\n                    }\r\n\r\n                    if (string.IsNullOrEmpty(param.CustomHelpText) == false)\r\n                    {\r\n                        helpString = param.CustomHelpText;\r\n                    }\r\n                    else\r\n                    {\r\n                        helpString = LocalizationToken(string.Format(\"param.{0}.help\", param.Name));\r\n                    }\r\n\r\n                    yield return new ParameterProfile(param.Name, param.Type, param.IsRequired, param.FallbackValueProvider,\r\n                        param.WidgetFunctionProvider, labelString, new HelpDefinition(helpString));\r\n                }\r\n            }\r\n        }\r\n\r\n        protected virtual IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles \r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n        public abstract object Execute(ParameterList parameters, FunctionContextContainer context);\r\n\r\n        public EntityToken EntityToken\r\n        {\r\n            get { return _entityTokenFactory.CreateEntityToken(this); }\r\n        }\r\n\r\n        private string LocalizationToken(string functionLocalPart)\r\n        {\r\n            return string.Format( \"${{Composite.Plugins.StandardFunctions,{0}.{1}}}\", this.ResourceHandleNameStem, functionLocalPart ); \r\n        }\r\n\r\n        public string ResourceHandleNameStem {get; protected set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Foundation/StandardFunctionParameterProfile.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation\r\n{\r\n\tinternal sealed class StandardFunctionParameterProfile\r\n\t{\r\n        public StandardFunctionParameterProfile(\r\n            string name, Type type, bool isRequired, BaseValueProvider fallbackValueProvider, \r\n            WidgetFunctionProvider widgetFunctionProvider)\r\n        {\r\n            this.Name = name;\r\n            this.Type = type;\r\n            this.IsRequired = isRequired;\r\n            this.FallbackValueProvider = fallbackValueProvider;\r\n            this.WidgetFunctionProvider = widgetFunctionProvider;\r\n        }\r\n\r\n        public StandardFunctionParameterProfile(\r\n            string name, Type type, bool isRequired, BaseValueProvider fallbackValueProvider,\r\n            WidgetFunctionProvider widgetFunctionProvider, string customResourceHandleNamespace)\r\n            : this( name,type,isRequired,fallbackValueProvider, widgetFunctionProvider)\r\n        {\r\n            this.CustomResourceHandleNamespace = customResourceHandleNamespace;\r\n        }\r\n\r\n\r\n        public string Name { get; private set; }\r\n        public Type Type{ get; private set; }\r\n        public bool IsRequired{ get; private set; }\r\n        public BaseValueProvider FallbackValueProvider{ get; private set; }\r\n        public WidgetFunctionProvider WidgetFunctionProvider{ get; private set; }\r\n\r\n        public string CustomLabel { get; set; }\r\n\r\n        public string CustomHelpText { get; set; }\r\n\r\n        public string CustomResourceHandleNamespace { get; private set; }\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/AddDataInstance.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated\r\n{\r\n    internal sealed class AddDataInstance<T> : StandardFunctionBase\r\n        where T : class, IData\r\n    {\r\n        private List<StandardFunctionParameterProfile> _parameterProfiles = null;\r\n\r\n\r\n        public AddDataInstance(EntityTokenFactory entityTokenFactory)\r\n            : base(\"AddDataInstance\", typeof(T).FullName, typeof(void), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.AddDataInstance\";\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                if (_parameterProfiles == null)\r\n                {\r\n                    _parameterProfiles = new List<StandardFunctionParameterProfile>();\r\n                    DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeof(T));\r\n\r\n                    foreach (DataFieldDescriptor dataFieldDescriptor in dataTypeDescriptor.Fields)\r\n                    {\r\n                        string helpText = dataFieldDescriptor.Name;\r\n                        if (dataFieldDescriptor.FormRenderingProfile != null && !string.IsNullOrWhiteSpace(dataFieldDescriptor.FormRenderingProfile.HelpText))\r\n                        {\r\n                            helpText = dataFieldDescriptor.FormRenderingProfile.HelpText;\r\n                        }\r\n\r\n                        bool isGuidKeyField = dataTypeDescriptor.KeyPropertyNames.Contains(dataFieldDescriptor.Name) && (dataFieldDescriptor.InstanceType == typeof(Guid));\r\n\r\n                        bool isRequried = dataFieldDescriptor.DefaultValue == null;\r\n                        if (isGuidKeyField)\r\n                        {\r\n                            isRequried = false;\r\n                        }\r\n\r\n                        _parameterProfiles.Add(new StandardFunctionParameterProfile(\r\n                            dataFieldDescriptor.Name,\r\n                            dataFieldDescriptor.InstanceType,\r\n                            isRequried,\r\n                            DataInstanceHelper.GetFallbackValueProvider(dataFieldDescriptor, isGuidKeyField),\r\n                            DataInstanceHelper.GetWidgetFunctionProvider(dataFieldDescriptor)\r\n                        )\r\n                        {\r\n                            CustomLabel = dataFieldDescriptor.Name,\r\n                            CustomHelpText = helpText\r\n                        });\r\n                    }                    \r\n                }\r\n\r\n                return _parameterProfiles;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            T data = DataFacade.BuildNew<T>();\r\n\r\n            List<PropertyInfo> typePropertites = typeof(T).GetPropertiesRecursively();\r\n\r\n            foreach (string parameterName in parameters.AllParameterNames)\r\n            {\r\n                PropertyInfo propertyInfo = typePropertites.Where(f => f.Name == parameterName).Single();\r\n\r\n                propertyInfo.SetValue(data, parameters.GetParameter(parameterName, propertyInfo.PropertyType), null);\r\n            }\r\n            \r\n            AssignMissingGuidKeyValues(parameters, data);\r\n\r\n            DataFacade.AddNew<T>(data);\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        private static void AssignMissingGuidKeyValues(ParameterList parameters, T data)\r\n        {\r\n            foreach (PropertyInfo keyPropertyInfo in typeof(T).GetKeyProperties())\r\n            {\r\n                if (keyPropertyInfo.PropertyType != typeof(Guid)) continue;\r\n\r\n                if (parameters.AllParameterNames.Contains(keyPropertyInfo.Name)) continue;\r\n\r\n                keyPropertyInfo.SetValue(data, Guid.NewGuid(), null);\r\n            }\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/DataInstanceHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Functions;\r\nusing Composite.Data.DynamicTypes;\r\nusing System.Xml.Linq;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated\r\n{\r\n    internal static class DataInstanceHelper\r\n    {\r\n        public static BaseValueProvider GetFallbackValueProvider(DataFieldDescriptor dataFieldDescriptor, bool isKeyProperty)\r\n        {\r\n            if (dataFieldDescriptor.DefaultValue != null)\r\n            {\r\n                return new ConstantValueProvider(dataFieldDescriptor.DefaultValue.Value);\r\n            }\r\n\r\n            Type instanceType = GetInstanceType(dataFieldDescriptor);\r\n            if (instanceType == typeof(int))\r\n            {\r\n                return new ConstantValueProvider(0);\r\n            }\r\n            else if (instanceType == typeof(decimal))\r\n            {\r\n                return new ConstantValueProvider(0.0);\r\n            }\r\n            else if (instanceType == typeof(bool))\r\n            {\r\n                return new ConstantValueProvider(false);\r\n            }\r\n            else if (instanceType == typeof(string))\r\n            {\r\n                return new ConstantValueProvider(\"\");\r\n            }\r\n            else if (instanceType == typeof(Guid))\r\n            {\r\n                if (isKeyProperty)\r\n                {\r\n                    return new ConstantValueProvider(Guid.NewGuid());\r\n                }\r\n                else\r\n                {\r\n                    return new ConstantValueProvider(Guid.Empty);\r\n                }\r\n            }\r\n            else if (instanceType == typeof(DateTime))\r\n            {\r\n                return new ConstantValueProvider(DateTime.Now);\r\n            }\r\n            else\r\n            {\r\n                return new ConstantValueProvider(\"\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static WidgetFunctionProvider GetWidgetFunctionProvider(DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            if ((dataFieldDescriptor.FormRenderingProfile != null) && (string.IsNullOrEmpty(dataFieldDescriptor.FormRenderingProfile.WidgetFunctionMarkup) == false))\r\n            {\r\n                WidgetFunctionProvider widgetFunctionProvider = new WidgetFunctionProvider(XElement.Parse(dataFieldDescriptor.FormRenderingProfile.WidgetFunctionMarkup));\r\n                return widgetFunctionProvider;\r\n            }\r\n            else\r\n            {\r\n                return StandardWidgetFunctions.GetDefaultWidgetFunctionProviderByType(dataFieldDescriptor.InstanceType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public static Type GetInstanceType(DataFieldDescriptor dataFieldDescriptor)\r\n        {\r\n            Type instanceType = dataFieldDescriptor.InstanceType;\r\n            if (instanceType.IsGenericType && instanceType.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n            {\r\n                instanceType = instanceType.GetGenericArguments().First();\r\n            }\r\n\r\n            return instanceType;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/DeleteDataInstance.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated\r\n{\r\n    internal sealed class DeleteDataInstance<T> : StandardFunctionBase\r\n        where T : class, IData\r\n    {\r\n        private List<StandardFunctionParameterProfile> _parameterProfiles = null;\r\n\r\n\r\n\r\n        public DeleteDataInstance(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DeleteDataInstance\", typeof(T).FullName, typeof(void), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.DeleteDataInstance\";\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                if (_parameterProfiles == null)\r\n                {\r\n                    _parameterProfiles = new List<StandardFunctionParameterProfile>();                    \r\n\r\n                    Expression<Func<T, bool>> defaultFilter = DataFacade.GetEmptyPredicate<T>();\r\n\r\n                    _parameterProfiles.Add(new StandardFunctionParameterProfile(\r\n                        \"Filter\",\r\n                        typeof(Expression<Func<T, bool>>),\r\n                        false,\r\n                        new ConstantValueProvider(defaultFilter),\r\n                        null\r\n                    ));\r\n                }\r\n\r\n                return _parameterProfiles;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<T, bool>> filter = parameters.GetParameter<Expression<Func<T, bool>>>(\"Filter\");\r\n\r\n            DataFacade.Delete<T>(filter);\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/Filter/ActivePageReferenceFilter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Foundation;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Core.Linq.ExpressionVisitors;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Data;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Pages;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated.Filter\r\n{\r\n\tinternal sealed class ActivePageReferenceFilter<T> : StandardFunctionBase\r\n\t{\r\n        private static readonly ParameterExpression _parameterExpression = Expression.Parameter(typeof(T), \"data\");\r\n        private static readonly Expression _foreignKeyPropertyExpression;\r\n\r\n        static ActivePageReferenceFilter()\r\n        {\r\n            PropertyInfo foreignKeyPropertyInfo = DataAssociationRegistry.GetForeignKeyPropertyInfo(typeof(IPage), typeof(T));\r\n            _foreignKeyPropertyExpression = Expression.Property(_parameterExpression, foreignKeyPropertyInfo);\r\n        }\r\n\r\n        public ActivePageReferenceFilter(EntityTokenFactory entityTokenFactory)\r\n            : base(\"ActivePageReferenceFilter\", typeof(T).FullName, typeof(Expression<Func<T, bool>>), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.Filter.ActivePageReferenceFilter\";\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider associationDropDown = StandardWidgetFunctions.DropDownList(\r\n                    this.GetType(), \"PageAssociationRestrictions\", \"Key\", \"Value\", false, true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"SitemapScope\",\r\n                    typeof(SitemapScope),\r\n                    false,\r\n                    new ConstantValueProvider(SitemapScope.Current),\r\n                    associationDropDown);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            SitemapScope SitemapScope;\r\n            Expression filter;\r\n\r\n            if (parameters.TryGetParameter<SitemapScope>(\"SitemapScope\", out SitemapScope) == false)\r\n            {\r\n                SitemapScope = SitemapScope.Current;\r\n            }\r\n\r\n            switch (SitemapScope)\r\n            {\r\n                case SitemapScope.Current:\r\n                    Guid currentPageId = PageRenderer.CurrentPageId;\r\n                    filter = Expression.Equal(_foreignKeyPropertyExpression, Expression.Constant(currentPageId));\r\n                    break;\r\n                case SitemapScope.All:\r\n                    filter = Expression.Constant(true);\r\n                    break;\r\n                default:\r\n                    Guid pageId = PageRenderer.CurrentPageId;\r\n\r\n                    IEnumerable<Guid> pageIds = new FilterWrapper(\r\n                        pageId, \r\n                        SitemapScope, TableVersion.Get(typeof(IPageStructure)),\r\n                        PageStructureInfo.GetAssociatedPageIds(pageId, SitemapScope));\r\n\r\n                    Expression<Func<Guid, bool>> containsExpression = f => pageIds.Contains(f);\r\n                    filter = Expression.Invoke(containsExpression, _foreignKeyPropertyExpression);\r\n                    break;\r\n            }\r\n\r\n            return Expression.Lambda<Func<T, bool>>(filter, new ParameterExpression[] { _parameterExpression });\r\n        }\r\n\r\n\r\n        public static IEnumerable<KeyValuePair<SitemapScope, string>> PageAssociationRestrictions()\r\n        {\r\n            return SitemapXmlFunction.PageAssociationRestrictions();\r\n        }\r\n\r\n\r\n        private class FilterWrapper : CacheKeyBuilderExpressionVisitor.ICacheKeyProvider, IEnumerable<Guid>\r\n        {\r\n            private Guid _pageId;\r\n            private SitemapScope _associationScope;\r\n            private int _tableVersion;\r\n            private IEnumerable<Guid> _innerEnumerator;\r\n\r\n            public FilterWrapper(Guid pageId, SitemapScope associationScope, int tableVersion, IEnumerable<Guid> innerEnumerator)\r\n            {\r\n                _pageId = pageId;\r\n                _associationScope = associationScope;\r\n                _tableVersion = tableVersion;\r\n                _innerEnumerator = innerEnumerator;\r\n            }\r\n\r\n            public string GetCacheKey()\r\n            {\r\n                return \"APRFilter\" + GetRootForSelectionScope() + _associationScope + _tableVersion;\r\n            }\r\n\r\n            private Guid GetRootForSelectionScope()\r\n            {\r\n                switch (_associationScope)\r\n                {\r\n                    case SitemapScope.All:\r\n                        return Guid.Empty;\r\n                    case SitemapScope.Parent:\r\n                        return PageManager.GetParentId(_pageId);\r\n                    case SitemapScope.Level1:\r\n                    case SitemapScope.Level1AndSiblings:\r\n                    case SitemapScope.Level1AndDescendants:\r\n                        return GetPageOnLevel(1);\r\n                    case SitemapScope.Level2:\r\n                    case SitemapScope.Level2AndSiblings:\r\n                    case SitemapScope.Level2AndDescendants:\r\n                        return GetPageOnLevel(2);\r\n                    case SitemapScope.Level3:\r\n                    case SitemapScope.Level3AndSiblings:\r\n                    case SitemapScope.Level3AndDescendants:\r\n                        return GetPageOnLevel(3);\r\n                    case SitemapScope.Level4:\r\n                    case SitemapScope.Level4AndSiblings:\r\n                    case SitemapScope.Level4AndDescendants:\r\n                        return GetPageOnLevel(4);\r\n                }\r\n                return _pageId;\r\n            }\r\n\r\n            private Guid GetPageOnLevel(int level)\r\n            {\r\n                var ancestorsChain = new List<Guid>();\r\n                Guid currentPage = _pageId;\r\n\r\n                while(currentPage != Guid.Empty && ancestorsChain.Count < 1000)\r\n                {\r\n                    ancestorsChain.Add(currentPage);\r\n                    currentPage = PageManager.GetParentId(currentPage);\r\n                }\r\n\r\n                if (level > ancestorsChain.Count) return Guid.Empty;\r\n\r\n                return ancestorsChain[ancestorsChain.Count - level];\r\n            }\r\n\r\n            public IEnumerator<Guid> GetEnumerator()\r\n            {\r\n                return _innerEnumerator.GetEnumerator();\r\n            }\r\n\r\n            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()\r\n            {\r\n                return _innerEnumerator.GetEnumerator();\r\n            }\r\n        }\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/Filter/CompoundFilter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Functions;\r\nusing Composite.Data;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated.Filter\r\n{\r\n\tinternal sealed class CompoundFilter<T> : StandardFunctionBase, ICompoundFunction\r\n        where T : class, IData\r\n\t{\r\n        private static readonly ParameterExpression _dataItem = Expression.Parameter(typeof(T), \"data\");\r\n\r\n        public CompoundFilter(EntityTokenFactory entityTokenFactory)\r\n            : base(\"CompoundFilter\", typeof(T).FullName, typeof(Expression<Func<T, bool>>), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.Filter.CompoundFilter\";\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider isAndQuerySelector = StandardWidgetFunctions.GetBoolSelectorWidget(\"And query\", \"Or Query\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"IsAndQuery\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(true),\r\n                    isAndQuerySelector);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Left\",\r\n                    typeof(Expression<Func<T, bool>>),\r\n                    true,\r\n                    new NoValueValueProvider(),\r\n                    null);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Right\",\r\n                    typeof(Expression<Func<T, bool>>),\r\n                    true,\r\n                    new NoValueValueProvider(),\r\n                    null);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            bool isAndQuery = parameters.GetParameter<bool>(\"IsAndQuery\");\r\n            Expression<Func<T, bool>> left = parameters.GetParameter<Expression<Func<T, bool>>>(\"Left\");\r\n            Expression<Func<T, bool>> right = parameters.GetParameter<Expression<Func<T, bool>>>(\"Right\");\r\n\r\n            Expression compound;\r\n\r\n            if (isAndQuery)\r\n            {\r\n                Expression leftFilter = Expression.Invoke(left, _dataItem);\r\n                Expression rightFilter = Expression.Invoke(right, _dataItem);\r\n                compound = Expression.And(leftFilter, rightFilter);\r\n            }\r\n            else\r\n            {\r\n                Expression leftFilter = Expression.Invoke(left, _dataItem);\r\n                Expression rightFilter = Expression.Invoke(right, _dataItem);\r\n                compound = Expression.Or(leftFilter, rightFilter);\r\n            }\r\n\r\n            Expression<Func<T, bool>> lambdaExpression = Expression.Lambda<Func<T, bool>>(compound, new ParameterExpression[] { _dataItem });\r\n\r\n            return lambdaExpression;\r\n        }\r\n\r\n        public bool AllowRecursiveCall\r\n        {\r\n            get { return true; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/Filter/DataReferenceFilter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated.Filter.Foundation;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Functions;\r\nusing Composite.Data;\r\nusing System.Reflection;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data.Types;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Linq;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated.Filter\r\n{\r\n\tinternal sealed class DataReferenceFilter<T> : StandardFunctionBase\r\n        where T : class, IData\r\n\t{\r\n        private static readonly ParameterExpression _dataItem = Expression.Parameter(typeof(T), \"data\");\r\n\r\n        public DataReferenceFilter(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DataReferenceFilter\", typeof(T).FullName, typeof(Expression<Func<T, bool>>), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.Filter.DataReferenceFilter\";\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider referenceSelector = StandardWidgetFunctions.GetDataReferenceWidget<T>();\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"DataReference\",\r\n                    typeof(DataReference<T>),\r\n                    true,\r\n                    new NoValueValueProvider(),\r\n                    referenceSelector);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            DataReference<T> dataReference = parameters.GetParameter<DataReference<T>>(\"DataReference\");\r\n\r\n            return dataReference.GetPredicateExpression();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/Filter/FieldPredicatesFilter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Functions;\r\nusing Composite.Data;\r\nusing System.Reflection;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.Linq;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated.Filter\r\n{\r\n    internal sealed class FieldPredicatesFilter<T> : StandardFunctionBase\r\n        where T : class, IData\r\n    {\r\n        //private static readonly ParameterExpression _dataItem = Expression.Parameter(typeof(T), \"data\");\r\n\r\n        public FieldPredicatesFilter(EntityTokenFactory entityTokenFactory)\r\n            : base(\"FieldPredicatesFilter\", typeof(T).FullName, typeof(Expression<Func<T, bool>>), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.Filter.FieldPredicatesFilter\";\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                foreach (PropertyInfo propertyInfo in typeof(T).GetAllProperties())\r\n                {\r\n                    if (propertyInfo.DeclaringType != typeof(IData) && propertyInfo.DeclaringType != typeof(object))\r\n                    {\r\n                        Type[] funcGenericArgs = new Type[] { propertyInfo.PropertyType, typeof(bool) };\r\n\r\n                        Type parameterType = typeof(Expression<>).MakeGenericType(typeof(Func<,>).MakeGenericType(funcGenericArgs));\r\n\r\n                        var param = new StandardFunctionParameterProfile(\r\n                            propertyInfo.Name,\r\n                            parameterType,\r\n                            false,\r\n                            new ConstantValueProvider(null),\r\n                            null);\r\n\r\n                        param.CustomLabel = propertyInfo.Name + \" filter\";\r\n                        param.CustomHelpText = \"Specify a criteria that this field must meet or use the default value (no criteria)\";\r\n\r\n                        yield return param;\r\n                    }\r\n                }\r\n\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            ParameterExpression parameterExpression = Expression.Parameter(typeof(T), \"data\");\r\n\r\n\r\n            Expression allRequirements = null;\r\n            foreach (string parameterName in parameters.AllParameterNames)\r\n            {\r\n                object predicateObject = parameters.GetParameter(parameterName);\r\n                if (predicateObject == null) continue;\r\n\r\n                Expression propertyExpression = Expression.Property(parameterExpression, GetProperty(parameterName));\r\n\r\n                LambdaExpression predicate = (LambdaExpression)predicateObject;\r\n\r\n                Expression predicateBody = predicate.Body;\r\n\r\n                ParameterExpressionSwitcher parameterExpressionSwitcher = new ParameterExpressionSwitcher(predicate.Parameters[0], propertyExpression);\r\n\r\n                Expression newPredicateBody = parameterExpressionSwitcher.Visit(predicateBody);\r\n\r\n                allRequirements = allRequirements.NestedAnd(newPredicateBody);\r\n            }\r\n\r\n            if (allRequirements == null)\r\n            {\r\n                allRequirements = Expression.Constant(true);\r\n            }\r\n\r\n            Expression lambdaExpression = Expression.Lambda<Func<T, bool>>(allRequirements, parameterExpression);\r\n\r\n            return lambdaExpression;\r\n        }\r\n\r\n\r\n        private PropertyInfo GetProperty(string fieldName)\r\n        {\r\n            PropertyInfo fieldPropertyInfo = typeof(T).GetAllProperties().Single(f => f.Name == fieldName);\r\n            return fieldPropertyInfo;\r\n        }\r\n\r\n\r\n\r\n        private sealed class ParameterExpressionSwitcher : ExpressionVisitor\r\n        {\r\n            private readonly Expression _oldParameter;\r\n            private readonly Expression _newParameterExpression;\r\n\r\n\r\n            public ParameterExpressionSwitcher(Expression oldParameter, Expression newParameterExpression)\r\n            {\r\n                _oldParameter = oldParameter;\r\n                _newParameterExpression = newParameterExpression;\r\n            }\r\n\r\n\r\n            protected override Expression VisitParameter(ParameterExpression node)\r\n            {\r\n                if(object.ReferenceEquals(node, _oldParameter))\r\n                {\r\n                    return _newParameterExpression;\r\n                }\r\n\r\n                return node;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/Filter/Foundation/ListPropertyNamesHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Reflection;\r\nusing System.Collections;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated.Filter.Foundation\r\n{\r\n    internal static class ListPropertyNamesHelper\r\n    {\r\n        public static IEnumerable GetOptionsWithReferences(string typeManagerName)\r\n        {\r\n            Type t = TypeManager.GetType(typeManagerName);\r\n            IEnumerable<ForeignPropertyInfo> foreignKeyProperties = DataReferenceFacade.GetForeignKeyProperties(t);\r\n            List<PropertyInfo> properties = t.GetPropertiesRecursively(f=>f.DeclaringType!=typeof(IData));\r\n\r\n            List<string> result = new List<string>();\r\n\r\n            foreach (PropertyInfo propertyInfo in properties)\r\n            {\r\n                result.Add( propertyInfo.Name);\r\n                ForeignPropertyInfo foreignKeyInfo = foreignKeyProperties.FirstOrDefault(f=>f.SourcePropertyName==propertyInfo.Name);\r\n\r\n                if (foreignKeyInfo!=null)\r\n                {\r\n                    List<PropertyInfo> foreignProperties = foreignKeyInfo.TargetType.GetPropertiesRecursively(f=>f.DeclaringType!=typeof(IData));\r\n\r\n                    foreach (PropertyInfo foreignPropertyInfo in foreignProperties)\r\n                    {\r\n                        string foreignKey = string.Format(\"{0}.{1}\", propertyInfo.Name, foreignPropertyInfo.Name );\r\n                        result.Add( foreignKey);\r\n                    }\r\n\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        public static IEnumerable GetOptions(string typeManagerName)\r\n        {\r\n            Type t = TypeManager.GetType(typeManagerName);\r\n\r\n            List<PropertyInfo> properties = t.GetPropertiesRecursively();\r\n\r\n            List<string> result = new List<string>();\r\n\r\n            result.AddRange(\r\n                from property in properties\r\n                where property.DeclaringType != typeof(IData)\r\n                select property.Name);\r\n\r\n            return result;\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/GetDataReference.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Functions;\r\nusing Composite.Data;\r\nusing System.Reflection;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data.Types;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Linq;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated\r\n{\r\n\tinternal sealed class GetDataReference<T> : StandardFunctionBase\r\n        where T : class, IData\r\n\t{\r\n        private static readonly ParameterExpression _dataItem = Expression.Parameter(typeof(T), \"data\");\r\n\r\n        public GetDataReference(EntityTokenFactory entityTokenFactory)\r\n            : base(\"GetDataReference\", typeof(T).FullName, typeof(DataReference<T>), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.GetDataReference\";\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                var keyPropertyInfo = DataAttributeFacade.GetKeyProperties(typeof(T)).Single();\r\n\r\n                WidgetFunctionProvider referenceSelector = StandardWidgetFunctions.GetDataReferenceWidget<T>();\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"KeyValue\",\r\n                    keyPropertyInfo.PropertyType,\r\n                    true,\r\n                    new NoValueValueProvider(),\r\n                    referenceSelector);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            object keyValue = parameters.GetParameter(\"KeyValue\");\r\n\r\n            return new DataReference<T>(keyValue);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/GetNullableDataReference.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing Composite.Data;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated\r\n{\r\n\tinternal sealed class GetNullableDataReference<T> : StandardFunctionBase\r\n        where T : class, IData\r\n\t{\r\n        private static readonly ParameterExpression _dataItem = Expression.Parameter(typeof(T), \"data\");\r\n\r\n        public GetNullableDataReference(EntityTokenFactory entityTokenFactory)\r\n            : base(\"GetNullableDataReference\", typeof(T).FullName, typeof(NullableDataReference<T>), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.GetNullableDataReference\";\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                var keyPropertyInfo = DataAttributeFacade.GetKeyProperties(typeof(T)).Single();\r\n\r\n                WidgetFunctionProvider referenceSelector = StandardWidgetFunctions.GetNullableDataReferenceWidget<T>();\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"KeyValue\",\r\n                    keyPropertyInfo.PropertyType,\r\n                    false,\r\n                    new ConstantValueProvider(new NullableDataReference<T>()),\r\n                    referenceSelector);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            object keyValue = parameters.GetParameter(\"KeyValue\");\r\n\r\n            return new NullableDataReference<T>(keyValue);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/GetXml.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Caching;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Functions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated.Filter.Foundation;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated\r\n{\r\n    internal class GetXmlCacheRecord\r\n    {\r\n        public int Version;\r\n        public IEnumerable<XElement> Result;\r\n    }\r\n\r\n    internal class QueryInfo\r\n    {\r\n        public IEnumerable<Type> ReferencedDataTypes;\r\n        public bool HasPublishableReference;\r\n        public bool HasLocalizableReference;\r\n    }\r\n\r\n\r\n    internal sealed class GetXml<T> : StandardFunctionBase\r\n        where T : class, IData\r\n    {\r\n        private static readonly ICache<string, GetXmlCacheRecord> ResultCache =\r\n            CacheManager.Get<string, GetXmlCacheRecord>(\"GetXml results\", new CacheSettings(CacheType.Mixed) { Size = 2500 });\r\n\r\n        private static readonly Hashtable<string, QueryInfo> _queryInfoTable = new Hashtable<string, QueryInfo>();\r\n\r\n        private List<string> _propertyNames;\r\n        private List<PropertyInfo> _propertyInfos;\r\n        private object _lock = new object();\r\n\r\n        public GetXml(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Get\" + typeof(T).Name + \"Xml\", typeof(T).FullName, typeof(IEnumerable<XElement>), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.GetXml\";\r\n        }\r\n\r\n\r\n        private List<PropertyInfo> GetPropertyInfos()\r\n        {\r\n            if (_propertyInfos == null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_propertyInfos == null)\r\n                    {\r\n                        var result = new List<PropertyInfo>(typeof (T).GetKeyProperties());\r\n\r\n                        PropertyInfo labelPropertyInfo = typeof (T).GetLabelPropertyInfo();\r\n\r\n                        if (!result.Any(f => f.Name == labelPropertyInfo.Name))\r\n                        {\r\n                            result.Add(labelPropertyInfo);\r\n                        }\r\n\r\n                        _propertyInfos = result;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return _propertyInfos;\r\n        }\r\n\r\n        private List<string> GetPropertyNames()\r\n        {\r\n            List<string> result = _propertyNames;\r\n\r\n            if (result == null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    result = _propertyNames;\r\n                    if (result == null)\r\n                    {\r\n                        result = GetPropertyInfos().Select(f => f.Name).ToList();\r\n                        _propertyNames = result;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider orderBySelector =\r\n                    StandardWidgetFunctions.DropDownList(\r\n                        typeof(ListPropertyNamesHelper),\r\n                        \"GetOptions\",\r\n                        TypeManager.SerializeType(typeof(T)),\r\n                        false,\r\n                        true,\r\n                        true);\r\n\r\n                WidgetFunctionProvider propertyNamesSelector =\r\n                    StandardWidgetFunctions.DropDownList(\r\n                        typeof(ListPropertyNamesHelper),\r\n                        \"GetOptionsWithReferences\",\r\n                        TypeManager.SerializeType(typeof(T)),\r\n                        true,\r\n                        true,\r\n                        true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"PropertyNames\",\r\n                    typeof(IEnumerable<string>),\r\n                    true,\r\n                    new ConstantValueProvider(GetPropertyNames()),\r\n                    propertyNamesSelector);\r\n\r\n                Expression<Func<T, bool>> defaultFilter = DataFacade.GetEmptyPredicate<T>();\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Filter\",\r\n                    typeof(Expression<Func<T, bool>>),\r\n                    false,\r\n                    new ConstantValueProvider(defaultFilter),\r\n                    null);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"OrderByField\",\r\n                    typeof(string),\r\n                    false,\r\n                    new ConstantValueProvider(\"\"),\r\n                    orderBySelector);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"OrderAscending\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(true),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Order ascending (a-z)\", \"Order descending (z-a)\"));\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"PageSize\",\r\n                    typeof(int),\r\n                    false,\r\n                    new ConstantValueProvider(1000),\r\n                    StandardWidgetFunctions.IntegerTextBoxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"PageNumber\",\r\n                    typeof(int),\r\n                    false,\r\n                    new ConstantValueProvider(1),\r\n                    StandardWidgetFunctions.IntegerTextBoxWidget);\r\n\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ShowReferencesInline\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(true),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, show reference type data as attributes\", \"No, show as XML elements\"));\r\n\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"IncludePagingInfo\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(false),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, add item/page count details\", \"No, do not calculate paging info\"));\r\n\r\n\r\n                var randomizedParam = new StandardFunctionParameterProfile(\r\n                    \"Randomized\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(false),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, randomize selection. Use the 'Page size' for number of random elements.\", \"No, behave consistently\"));\r\n                yield return randomizedParam;\r\n\r\n\r\n                var elementNameParam = new StandardFunctionParameterProfile(\r\n                    \"ElementName\",\r\n                    typeof(string),\r\n                    false,\r\n                    new ConstantValueProvider(typeof(T).Name),\r\n                    StandardWidgetFunctions.TextBoxWidget);\r\n                elementNameParam.CustomHelpText = string.Format(\"The name of the XML element. The detault is '{0}'\", typeof(T).Name);\r\n                yield return elementNameParam;\r\n\r\n\r\n                var elementNamespaceParam = new StandardFunctionParameterProfile(\r\n                    \"ElementNamespace\",\r\n                    typeof(XNamespace),\r\n                    false,\r\n                    new ConstantValueProvider(XNamespace.None),\r\n                    StandardWidgetFunctions.TextBoxWidget);\r\n                elementNamespaceParam.CustomHelpText = string.Format(\"The namespace the XML element belongs to. The detault is '{0}'\", XNamespace.None);\r\n                yield return elementNamespaceParam;\r\n\r\n                WidgetFunctionProvider cachePriorityDropDown = StandardWidgetFunctions.DropDownList(\r\n                    this.GetType(), \"GetCachePriorities\", \"Key\", \"Value\", false, true);\r\n\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"CachePriority\",\r\n                    typeof(GetXmlCachePriority),\r\n                    false,\r\n                    new ConstantValueProvider(GetXmlCachePriority.Default),\r\n                    cachePriorityDropDown);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// To be called though reflection\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static IEnumerable<KeyValuePair<GetXmlCachePriority, string>> GetCachePriorities()\r\n        {\r\n            yield return new KeyValuePair<GetXmlCachePriority, string>(GetXmlCachePriority.Disabled, \"Disabled\");\r\n            yield return new KeyValuePair<GetXmlCachePriority, string>(GetXmlCachePriority.Default, \"Default\");\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            List<string> propertyNames = parameters.GetParameter<IEnumerable<string>>(\"PropertyNames\").ToList();\r\n            Expression<Func<T, bool>> filter = parameters.GetParameter<Expression<Func<T, bool>>>(\"Filter\");\r\n\r\n            string elementName = parameters.GetParameter<string>(\"ElementName\");\r\n            string namespaceString = parameters.GetParameter<string>(\"ElementNamespace\");\r\n            string orderByField = parameters.GetParameter<string>(\"OrderByField\");\r\n            bool orderAscending = parameters.GetParameter<bool>(\"OrderAscending\");\r\n            int pageSize = parameters.GetParameter<int>(\"PageSize\");\r\n            int pageNumber = parameters.GetParameter<int>(\"PageNumber\");\r\n            bool showReferencesInline = parameters.GetParameter<bool>(\"ShowReferencesInline\");\r\n            bool includePagingInfo = parameters.GetParameter<bool>(\"IncludePagingInfo\");\r\n            bool randomized = parameters.GetParameter<bool>(\"Randomized\");\r\n            GetXmlCachePriority cachePriority = parameters.GetParameter<GetXmlCachePriority>(\"CachePriority\");\r\n\r\n            int queryVersion = 0;\r\n\r\n            bool cachingEnabled = cachePriority != GetXmlCachePriority.Disabled;\r\n            string cacheKey = null;\r\n\r\n            if (cachingEnabled)\r\n            {\r\n                cacheKey = GetCacheKey(propertyNames, filter, elementName, namespaceString, orderByField, orderAscending, pageSize, pageNumber, showReferencesInline, includePagingInfo, randomized);\r\n                if (cacheKey != null)\r\n                {\r\n                    queryVersion = GetQueryVersion(propertyNames);\r\n\r\n                    GetXmlCacheRecord cacheRecord = ResultCache.Get(cacheKey);\r\n                    if (cacheRecord != null && cacheRecord.Version == queryVersion)\r\n                    {\r\n                        return cacheRecord.Result;\r\n                    }\r\n                }\r\n            }\r\n\r\n            XNamespace elementNamespace = (string.IsNullOrEmpty(namespaceString) ? XNamespace.None : namespaceString);\r\n\r\n            LambdaExpression orderByExpression;\r\n\r\n            if (string.IsNullOrEmpty(orderByField))\r\n            {\r\n                orderByField = propertyNames.FirstOrDefault(f => f.Contains(\".\") == false);\r\n                if (!randomized && !orderByField.IsNullOrEmpty())\r\n                {\r\n                    orderByExpression = DataToXElements<T>.GetOrderByPropertyNameExpression(orderByField);\r\n                }\r\n                else\r\n                {\r\n                    orderByExpression = DataFacade.GetEmptyPredicate<T>();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                orderByExpression = DataToXElements<T>.GetOrderByPropertyNameExpression(orderByField);\r\n            }\r\n\r\n            IEnumerable<XElement> result = DataToXElements<T>.GetXElements(\r\n                filter,\r\n                orderByExpression,\r\n                orderAscending,\r\n                pageSize,\r\n                pageNumber,\r\n                propertyNames,\r\n                elementNamespace,\r\n                elementName,\r\n                showReferencesInline,\r\n                includePagingInfo,\r\n                randomized);\r\n\r\n            if (cachingEnabled && cacheKey != null)\r\n            {\r\n                result = result.ToList();\r\n                ResultCache.Add(cacheKey, new GetXmlCacheRecord { Result = result, Version = queryVersion });\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static QueryInfo GetQueryInfo(IEnumerable<string> propertyNames)\r\n        {\r\n            string key = string.Join(\"|\", propertyNames);\r\n\r\n            QueryInfo queryInfo = _queryInfoTable[key];\r\n\r\n            if (queryInfo != null) return queryInfo;\r\n\r\n\r\n            lock (_queryInfoTable)\r\n            {\r\n                queryInfo = _queryInfoTable[key];\r\n                if (queryInfo != null) return queryInfo;\r\n\r\n                queryInfo = new QueryInfo();\r\n                queryInfo.HasLocalizableReference = DataLocalizationFacade.IsLocalized(typeof(T));\r\n                queryInfo.HasPublishableReference = DataFacade.GetSupportedDataScopes(typeof(T)).Count() > 1;\r\n\r\n                List<Type> relatedTypesList = new List<Type>();\r\n\r\n                foreach (string propertyName in propertyNames.Where(f => f.Contains(\".\")))\r\n                {\r\n                    string foreignKeyPropertyName = propertyName.Substring(0, propertyName.IndexOf(\".\"));\r\n                    ForeignPropertyInfo keyInfo = DataReferenceFacade.GetForeignKeyPropertyInfo(typeof(T),\r\n                                                                                                foreignKeyPropertyName);\r\n\r\n                    Type targetType = keyInfo.TargetType;\r\n                    if (!relatedTypesList.Contains(targetType))\r\n                    {\r\n                        relatedTypesList.Add(targetType);\r\n                    }\r\n\r\n                    queryInfo.HasLocalizableReference = queryInfo.HasLocalizableReference || DataLocalizationFacade.IsLocalized(targetType);\r\n                    queryInfo.HasPublishableReference = queryInfo.HasPublishableReference || (DataFacade.GetSupportedDataScopes(targetType).Count() > 1);\r\n                }\r\n\r\n                queryInfo.ReferencedDataTypes = relatedTypesList;\r\n\r\n                _queryInfoTable.Add(key, queryInfo);\r\n                return queryInfo;\r\n            }\r\n        }\r\n\r\n        private static int GetQueryVersion(IEnumerable<string> propertyNames)\r\n        {\r\n            int result = TableVersion.Get(typeof(T));\r\n\r\n            QueryInfo queryInfo = GetQueryInfo(propertyNames);\r\n\r\n            foreach (Type t in queryInfo.ReferencedDataTypes)\r\n            {\r\n                result += TableVersion.Get(t);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static string GetCacheKey(List<string> propertyNames, Expression filter, string elementName, string namespaceString, string orderByField, bool orderAscending, int pageSize, int pageNumber, bool showReferencesInline, bool includePagingInfo, bool randomized)\r\n        {\r\n            if (randomized) return null;\r\n\r\n            string filterKey = string.Empty;\r\n\r\n            if (filter != null)\r\n            {\r\n                filterKey = filter.BuildCacheKey();\r\n                if (filterKey == null) return null;\r\n            }\r\n\r\n            var result = new StringBuilder();\r\n\r\n            result.Append(typeof(T).FullName).Append(',');\r\n\r\n            QueryInfo qi = GetQueryInfo(propertyNames);\r\n\r\n            if (qi.HasPublishableReference)\r\n            {\r\n                var currentDataScope = DataScopeManager.CurrentDataScope;\r\n                if (currentDataScope != null)\r\n                {\r\n                    result.Append(currentDataScope.ToString()).Append(',');\r\n                }\r\n            }\r\n\r\n            if (qi.HasLocalizableReference)\r\n            {\r\n                var languageScope = LocalizationScopeManager.CurrentLocalizationScope;\r\n                if (languageScope != null)\r\n                {\r\n                    result.Append(languageScope.ToString()).Append(',');\r\n                }\r\n            }\r\n\r\n            result.Append(string.Join(\"*\", propertyNames)).Append(\"|\");\r\n            result.Append(elementName ?? string.Empty).Append(',');\r\n            result.Append(namespaceString ?? string.Empty).Append(',');\r\n            result.Append(orderByField ?? string.Empty).Append(',');\r\n            result.Append(orderAscending ? '1' : '0').Append(',');\r\n            result.Append(pageSize).Append(',');\r\n            result.Append(pageNumber).Append(',');\r\n            result.Append(showReferencesInline ? '1' : '0');\r\n            result.Append(includePagingInfo ? '1' : '0').Append('|');\r\n            result.Append(filterKey);\r\n\r\n            return result.ToString();\r\n        }\r\n    }\r\n\r\n    internal static class DataToXElements<T> where T : class, IData\r\n    {\r\n        private static readonly Dictionary<Type, IOrderByTypeFixer<T>> __orderByTypeFixers = new Dictionary<Type, IOrderByTypeFixer<T>>();\r\n        private static readonly object _lock = new object();\r\n\r\n        public static LambdaExpression GetOrderByPropertyNameExpression(string propertyName)\r\n        {\r\n            PropertyInfo orderByPropertyInfo = typeof(T).GetDataPropertyRecursivly(propertyName);\r\n\r\n            IOrderByTypeFixer<T> orderByFixer = GetOrderByTypeFixer(orderByPropertyInfo);\r\n            return orderByFixer.GetOrderByPropertyNameExpression(orderByPropertyInfo);\r\n        }\r\n\r\n\r\n\r\n        public static IEnumerable<XElement> GetXElements(\r\n            Expression<Func<T, bool>> filter,\r\n            LambdaExpression orderBy,\r\n            bool orderAscending,\r\n            int coreElementItemsPerPage,\r\n            int coreElementPageNumber,\r\n            IEnumerable<string> propertyNames,\r\n            XNamespace elementNamespace,\r\n            string elementNameString,\r\n            bool showReferencesInline,\r\n            bool showPagingInfo,\r\n            bool randomized)\r\n        {\r\n            List<string> propertyNameList = new List<string>(propertyNames);\r\n            List<string> autoAppendedPropertyNames = new List<string>();\r\n            List<string> referencedIdAttrubuteNames = new List<string>();\r\n\r\n            XName coreElementName = elementNamespace + elementNameString;\r\n\r\n            Dictionary<string, List<string>> referencesLookup = new Dictionary<string, List<string>>();\r\n\r\n            foreach (string referencePropertyName in propertyNameList.Where(f => f.Contains(\".\")))\r\n            {\r\n                string[] referenceElements = referencePropertyName.Split('.');\r\n                if (referenceElements.Length != 2) throw new InvalidOperationException(string.Format(\"Property names with a dot must have exactly one dot - failed to parse '{0}'\", referencePropertyName));\r\n\r\n                if (referencesLookup.ContainsKey(referenceElements[0]) == false)\r\n                    referencesLookup.Add(referenceElements[0], new List<string>());\r\n\r\n                referencesLookup[referenceElements[0]].Add(referenceElements[1]);\r\n            }\r\n\r\n            // rewrite with linq\r\n            if (showReferencesInline)\r\n            {\r\n                // Ensure keys are included\r\n                foreach (string referencePropertyName in referencesLookup.Keys)\r\n                {\r\n                    if (propertyNameList.Contains(referencePropertyName) == false)\r\n                    {\r\n                        propertyNameList.Add(referencePropertyName);\r\n                        autoAppendedPropertyNames.Add(referencePropertyName);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            var result = new List<XElement>();\r\n\r\n            Expression<Func<T, XElement>> xelementSelector = XElementSelectHelper<T>.BuildXElementSelector(propertyNameList.Where(f => f.IndexOf('.') == -1).ToList(), coreElementName);\r\n\r\n            // TODO: handle case of the default sorting (by predicate element => true)\r\n            IOrderByTypeFixer<T> orderByTypeFixer = GetOrderByTypeFixer(orderBy);\r\n            IQueryable<T> coreDataItems = orderByTypeFixer.GetCastedIQueryable(filter, orderBy, orderAscending, coreElementItemsPerPage, coreElementPageNumber, randomized);\r\n\r\n            if (randomized && referencesLookup.Any())\r\n            {\r\n                // performance hit! make elegant when time permits.\r\n                coreDataItems = coreDataItems.ToList().AsQueryable();\r\n            }\r\n\r\n            // Perf. optimization\r\n            if (coreDataItems.IsEnumerableQuery())\r\n            {\r\n                Func<T, XElement> compiledExpression = XElementSelectHelper<T>.GetCompiledFunction(xelementSelector);\r\n                result.AddRange(Enumerable.Select(coreDataItems, compiledExpression));\r\n            }\r\n            else\r\n            {\r\n                result.AddRange(coreDataItems.Select(xelementSelector));\r\n            }\r\n\r\n            var referencedResults = new List<XElement>();\r\n\r\n            // int referencedCoreElementCount = (orderByIsDeterministic ? coreElementItemsPerPage : int.MaxValue);\r\n            foreach (string referencePropertyName in referencesLookup.Keys)\r\n            {\r\n                IReferencedDataHelper<T> fixer = ReferencedDataHelperBuilder<T>.Build(referencePropertyName);\r\n                string propertyNamePrefix = (showReferencesInline ? referencePropertyName + \".\" : \"\");\r\n                if (showReferencesInline)\r\n                {\r\n                    if (referencesLookup[referencePropertyName].Contains(fixer.TargetTypeKeyPropertyName) == false)\r\n                    {\r\n                        referencesLookup[referencePropertyName].Add(fixer.TargetTypeKeyPropertyName);\r\n                        autoAppendedPropertyNames.Add(propertyNamePrefix + fixer.TargetTypeKeyPropertyName);\r\n                    }\r\n                    referencedIdAttrubuteNames.Add(propertyNamePrefix + fixer.TargetTypeKeyPropertyName);\r\n                }\r\n                XName referenceElementName = elementNamespace + referencePropertyName;\r\n                IEnumerable<XElement> referencesXml = fixer.GetReferencedXElements(coreDataItems, referencesLookup[referencePropertyName], referenceElementName, propertyNamePrefix);\r\n                referencedResults.AddRange(referencesXml);\r\n            }\r\n\r\n            if (showReferencesInline)\r\n            {\r\n                Dictionary<string, IEnumerable<XElement>> referencedElementsLookup = new Dictionary<string, IEnumerable<XElement>>();\r\n                Dictionary<string, Func<string, XAttribute>> referencedElementLocatorLookup = new Dictionary<string, Func<string, XAttribute>>();\r\n\r\n                foreach (string referencePropertyName in referencesLookup.Keys)\r\n                {\r\n                    XName referenceElementName = elementNamespace + referencePropertyName;\r\n\r\n                    IEnumerable<XElement> referenceElements = referencedResults.Where(f => f.Name == referenceElementName);\r\n                    referencedElementsLookup.Add(referencePropertyName, referenceElements);\r\n\r\n                    string idPropertyName = referencedIdAttrubuteNames.First(g => g.StartsWith(referencePropertyName + \".\"));\r\n                    IEnumerable<XElement> referencedElements = referencedElementsLookup[referencePropertyName];\r\n                    Func<string, XAttribute> locateByKeyFunc = f => referencedElements.Attributes(idPropertyName).FirstOrDefault(g => g.Value == f);\r\n                    referencedElementLocatorLookup.Add(referencePropertyName, locateByKeyFunc);\r\n                }\r\n\r\n                foreach (XElement coreElement in result.Where(f => f.Name == coreElementName))\r\n                {\r\n                    foreach (string referencePropertyName in referencesLookup.Keys)\r\n                    {\r\n                        XAttribute referenceAttribute = coreElement.Attribute(referencePropertyName);\r\n                        if (referenceAttribute == null) continue; // Handles non-references\r\n\r\n                        string keyValue = referenceAttribute.Value;\r\n                        Func<string, XAttribute> fetcher = referencedElementLocatorLookup[referencePropertyName];\r\n                        XAttribute matchingKeyAttribute = fetcher(keyValue);\r\n                        if (matchingKeyAttribute != null)\r\n                        {\r\n                            XElement referenced = matchingKeyAttribute.Parent;\r\n                            coreElement.Add(referenced.Attributes());\r\n                        }\r\n                    }\r\n\r\n                    coreElement.Attributes().Where(f => autoAppendedPropertyNames.Contains(f.Name.LocalName)).Remove();\r\n\r\n                    yield return coreElement;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                foreach (XElement anyElement in result)\r\n                {\r\n                    yield return anyElement;\r\n                }\r\n\r\n                foreach (XElement anyElement in referencedResults)\r\n                {\r\n                    yield return anyElement;\r\n                }\r\n            }\r\n\r\n            if (showPagingInfo)\r\n            {\r\n                int totalItemCount = DataFacade.GetData<T>(filter).Count(); // TODO: there shoudn't be a query\r\n                int firstShownElementNumber = ((coreElementPageNumber - 1) * coreElementItemsPerPage) + 1;\r\n                int lastShownElementNumber = Math.Min(totalItemCount, firstShownElementNumber + (coreElementItemsPerPage - 1));\r\n                int shownItemsCount = Math.Max(0, (lastShownElementNumber - firstShownElementNumber) + 1);\r\n\r\n                int totelPageCount = (int)Math.Ceiling((((double)totalItemCount) / ((double)coreElementItemsPerPage)));\r\n\r\n                XElement pagingInfo = new XElement(elementNamespace + \"PagingInfo\",\r\n                    new XAttribute(\"CurrentPageNumber\", coreElementPageNumber),\r\n                    new XAttribute(\"TotalPageCount\", totelPageCount),\r\n                    new XAttribute(\"TotalItemCount\", totalItemCount),\r\n                    new XAttribute(\"ShownItemsCount\", shownItemsCount),\r\n                    new XAttribute(\"MaximumItemsPerPage\", coreElementItemsPerPage)\r\n                    );\r\n\r\n                if (shownItemsCount > 0)\r\n                {\r\n                    pagingInfo.Add(\r\n                        new XAttribute(\"CurrentItemNumberStart\", firstShownElementNumber),\r\n                        new XAttribute(\"CurrentItemNumberEnd\", lastShownElementNumber)\r\n                     );\r\n                }\r\n\r\n                yield return pagingInfo;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static IOrderByTypeFixer<T> GetOrderByTypeFixer(LambdaExpression orderByExpression)\r\n        {\r\n            Type expressionType = orderByExpression.GetType();\r\n            Type[] expressionTypeGenericArguments = expressionType.GetGenericArguments();\r\n            Type[] funcGenericArguments = expressionTypeGenericArguments[0].GetGenericArguments();\r\n            Type orderByT = funcGenericArguments[1];\r\n            return GetByTypeFixerImpl(orderByT);\r\n        }\r\n\r\n\r\n        private static DataToXElements<T>.IOrderByTypeFixer<T> GetByTypeFixerImpl(Type orderByT)\r\n        {\r\n            IOrderByTypeFixer<T> result;\r\n\r\n            lock (_lock)\r\n            {\r\n                if (__orderByTypeFixers.TryGetValue(orderByT, out result) == false)\r\n                {\r\n                    Type[] genericArgs = new Type[] { typeof(T), orderByT };\r\n                    result = (IOrderByTypeFixer<T>)Activator.CreateInstance(typeof(OrderByTypeFixer<>).MakeGenericType(genericArgs), null); ;\r\n                    __orderByTypeFixers.Add(orderByT, result);\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n        private static IOrderByTypeFixer<T> GetOrderByTypeFixer(PropertyInfo orderByPropertyInfo)\r\n        {\r\n            return GetByTypeFixerImpl(orderByPropertyInfo.PropertyType);\r\n        }\r\n\r\n\r\n        private interface IOrderByTypeFixer<T2>\r\n        {\r\n            IQueryable<T2> GetCastedIQueryable(Expression<Func<T2, bool>> filter, LambdaExpression orderBy, bool orderAscending, int coreElementItemsPerPage, int coreElementPageNumber, bool randomized);\r\n            LambdaExpression GetOrderByPropertyNameExpression(PropertyInfo orderByPropertyInfo);\r\n        }\r\n\r\n\r\n        private class OrderByTypeFixer<OrderKeyT> : IOrderByTypeFixer<T>\r\n        {\r\n            private static readonly Hashtable<object, object> _compiledExpressions = new Hashtable<object, object>();\r\n\r\n            private static Func<T, OrderKeyT> CompileExpression(Expression<Func<T, OrderKeyT>> expression)\r\n            {\r\n                object result;\r\n\r\n                if (!_compiledExpressions.TryGetValue(expression, out result))\r\n                {\r\n                    lock (_compiledExpressions)\r\n                    {\r\n                        if (!_compiledExpressions.TryGetValue(expression, out result))\r\n                        {\r\n                            result = expression.Compile();\r\n                            _compiledExpressions.Add(expression, result);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return result as Func<T, OrderKeyT>;\r\n            }\r\n\r\n            public IQueryable<T> GetCastedIQueryable(Expression<Func<T, bool>> filter, LambdaExpression orderBy, bool orderAscending, int coreElementItemsPerPage, int coreElementPageNumber, bool randomized)\r\n            {\r\n                // TODO: Handle the case when there's no sorting in a proper way\r\n                Expression<Func<T, OrderKeyT>> orderByCasted = (Expression<Func<T, OrderKeyT>>)orderBy;\r\n\r\n                IQueryable<T> allDataItemsOrdered = DataFacade.GetData<T>(filter);\r\n\r\n                if (randomized)\r\n                {\r\n                    // TODO: optimize for EnumerableQuery instances\r\n                    IQueryable<T> randomizedItems = allDataItemsOrdered.TakeRandom(coreElementItemsPerPage);\r\n\r\n                    if (orderBy != DataFacade.GetEmptyPredicate<T>())\r\n                    {\r\n                        randomizedItems = (orderAscending ? randomizedItems.OrderBy(orderByCasted) : randomizedItems.OrderByDescending(orderByCasted));\r\n                    }\r\n                    return randomizedItems;\r\n                }\r\n\r\n                if (allDataItemsOrdered.IsEnumerableQuery())\r\n                {\r\n                    Func<T, OrderKeyT> orderByFunc = CompileExpression(orderByCasted);\r\n                    allDataItemsOrdered = (orderAscending ? allDataItemsOrdered.OrderBy(orderByFunc) : allDataItemsOrdered.OrderByDescending(orderByFunc))\r\n                                          .AsQueryable();\r\n                }\r\n                else\r\n                {\r\n                    allDataItemsOrdered = (orderAscending ? allDataItemsOrdered.OrderBy(orderByCasted) : allDataItemsOrdered.OrderByDescending(orderByCasted));\r\n                }\r\n\r\n                IQueryable<T> coreDataItems = allDataItemsOrdered;\r\n                if (coreElementPageNumber > 1)\r\n                {\r\n                    coreDataItems = coreDataItems.Skip((coreElementPageNumber - 1) * coreElementItemsPerPage);\r\n                }\r\n                coreDataItems = coreDataItems.Take(coreElementItemsPerPage);\r\n                return coreDataItems;\r\n            }\r\n\r\n\r\n            public LambdaExpression GetOrderByPropertyNameExpression(PropertyInfo orderByPropertyInfo)\r\n            {\r\n                ParameterExpression sourceItem = Expression.Parameter(typeof(T), \"source\");\r\n                Expression propertySelector = Expression.Convert(LambdaExpression.Property(sourceItem, orderByPropertyInfo), typeof(OrderKeyT));\r\n                Expression<Func<T, OrderKeyT>> orderByExpression = Expression.Lambda<Func<T, OrderKeyT>>(propertySelector, new ParameterExpression[] { sourceItem });\r\n                return orderByExpression;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal static class ReferencedDataHelperBuilder<SOURCE>\r\n            where SOURCE : class, IData\r\n    {\r\n        private static readonly Hashtable<string, IReferencedDataHelper<SOURCE>> __preBuildHelpers = new Hashtable<string, IReferencedDataHelper<SOURCE>>();\r\n        private static readonly object _lock = new object();\r\n\r\n        public static IReferencedDataHelper<SOURCE> Build(string foreignKeyPropertyName)\r\n        {\r\n            IReferencedDataHelper<SOURCE> result;\r\n\r\n            if (__preBuildHelpers.TryGetValue(foreignKeyPropertyName, out result) == false)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (__preBuildHelpers.TryGetValue(foreignKeyPropertyName, out result) == false)\r\n                    {\r\n                        result = BuildImpl(foreignKeyPropertyName);\r\n                        __preBuildHelpers.Add(foreignKeyPropertyName, result);\r\n                    }\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n        private static IReferencedDataHelper<SOURCE> BuildImpl(string foreignKeyPropertyName)\r\n        {\r\n            Type sourceType = typeof(SOURCE);\r\n            ForeignPropertyInfo keyInfo = DataReferenceFacade.GetForeignKeyPropertyInfo(sourceType, foreignKeyPropertyName);\r\n            Type destinationType = keyInfo.TargetType;\r\n\r\n            PropertyInfo sourceKeyPropertyInfo = sourceType.GetDataPropertyRecursivly(foreignKeyPropertyName);\r\n            PropertyInfo destinationKeyPropertyInfo = destinationType.GetSingleKeyProperty();\r\n            Type keyFieldType = destinationKeyPropertyInfo.PropertyType;\r\n\r\n            Type[] genericArgs = new Type[] { typeof(SOURCE), destinationType, keyFieldType };\r\n\r\n            return (IReferencedDataHelper<SOURCE>)Activator.CreateInstance(typeof(ReferencedDataHelper<,,>).MakeGenericType(genericArgs), sourceKeyPropertyInfo, destinationKeyPropertyInfo);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    internal interface IReferencedDataHelper<SOURCE>\r\n        where SOURCE : class, IData\r\n    {\r\n        IEnumerable<XElement> GetReferencedXElements(IQueryable<SOURCE> sourceTypeIqueryable, List<string> destinationPropertyNames, XName elementName, string propertyNamePrefix);\r\n        string TargetTypeKeyPropertyName { get; }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    internal class ReferencedDataHelper<SOURCE, DEST, KEY> : IReferencedDataHelper<SOURCE>\r\n        where SOURCE : class, IData\r\n        where DEST : class, IData\r\n    {\r\n        private readonly ParameterExpression _sourceItem = Expression.Parameter(typeof(SOURCE), \"source\");\r\n        private readonly ParameterExpression _destinationItem = Expression.Parameter(typeof(DEST), \"destination\");\r\n\r\n        private readonly PropertyInfo _sourceKeyPropertyInfo;\r\n        private readonly PropertyInfo _destinationKeyPropertyInfo;\r\n\r\n        private Expression<Func<SOURCE, KEY>> SourceForeignKeyPropertySelector { get; set; }\r\n        private Expression<Func<SOURCE, bool>> SourceForeignWhereExpression { get; set; }\r\n\r\n        public ReferencedDataHelper(PropertyInfo sourceKeyPropertyInfo, PropertyInfo destinationKeyPropertyInfo)\r\n        {\r\n            _sourceKeyPropertyInfo = sourceKeyPropertyInfo;\r\n            _destinationKeyPropertyInfo = destinationKeyPropertyInfo;\r\n            this.TargetTypeKeyPropertyName = _destinationKeyPropertyInfo.Name;\r\n\r\n            Expression foreignKeyFieldSelect;\r\n            if ((_sourceKeyPropertyInfo.PropertyType.IsGenericType) && (_sourceKeyPropertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)))\r\n            {\r\n                PropertyInfo hasValuePropertyInfo = _sourceKeyPropertyInfo.PropertyType.GetProperty(\"HasValue\");\r\n                PropertyInfo valuePropertyInfo = _sourceKeyPropertyInfo.PropertyType.GetProperty(\"Value\");\r\n\r\n                Expression hasValuePropertyExpression = Expression.Property(Expression.Property(_sourceItem, _sourceKeyPropertyInfo), hasValuePropertyInfo);\r\n                Expression valuePropertyExpression = Expression.Property(Expression.Property(_sourceItem, _sourceKeyPropertyInfo), valuePropertyInfo);\r\n                Expression equalExpression = Expression.Equal(hasValuePropertyExpression, Expression.Constant(true));\r\n\r\n                foreignKeyFieldSelect = Expression.Property(Expression.Property(_sourceItem, _sourceKeyPropertyInfo), valuePropertyInfo);\r\n\r\n                this.SourceForeignWhereExpression = Expression.Lambda<Func<SOURCE, bool>>(equalExpression, new ParameterExpression[] { _sourceItem });\r\n            }\r\n            else\r\n            {\r\n                foreignKeyFieldSelect = LambdaExpression.Property(_sourceItem, _sourceKeyPropertyInfo);\r\n            }\r\n\r\n\r\n            this.SourceForeignKeyPropertySelector = Expression.Lambda<Func<SOURCE, KEY>>(foreignKeyFieldSelect, new ParameterExpression[] { _sourceItem });\r\n        }\r\n\r\n\r\n\r\n        public string TargetTypeKeyPropertyName { get; private set; }\r\n\r\n        public IEnumerable<XElement> GetReferencedXElements(IQueryable<SOURCE> sourceTypeIqueryable, List<string> destinationPropertyNames, XName elementName, string propertyNamePrefix)\r\n        {\r\n            IQueryable<DEST> data = GetReferencedQueryable(sourceTypeIqueryable);\r\n            Expression<Func<DEST, XElement>> xelementSelector = XElementSelectHelper<DEST>.BuildXElementSelector(destinationPropertyNames, elementName, propertyNamePrefix);\r\n\r\n            return data.Select(xelementSelector);\r\n        }\r\n\r\n\r\n\r\n        public IQueryable<DEST> GetReferencedQueryable(IQueryable<SOURCE> sourceTypeIqueryable)\r\n        {\r\n            if (this.SourceForeignWhereExpression != null)\r\n            {\r\n                // Handle Nullable<>\r\n                sourceTypeIqueryable = sourceTypeIqueryable.Where(this.SourceForeignWhereExpression);\r\n            }\r\n\r\n            List<KEY> keys = sourceTypeIqueryable.Select(this.SourceForeignKeyPropertySelector).Distinct().ToList();\r\n\r\n            // Build \"key is in list\" expression\r\n            Expression destinationKeyFieldSelect = LambdaExpression.Property(_destinationItem, _destinationKeyPropertyInfo);\r\n            Expression<Func<KEY, bool>> containsExpression = f => keys.Contains(f);\r\n            Expression destinationFilter = Expression.Invoke(containsExpression, destinationKeyFieldSelect);\r\n            var lambdaExpression = Expression.Lambda<Func<DEST, bool>>(destinationFilter, new ParameterExpression[] { _destinationItem });\r\n\r\n            // Return queryable\r\n            return DataFacade.GetData<DEST>(lambdaExpression);\r\n        }\r\n    }\r\n\r\n\r\n    internal static class XElementSelectHelper<T>\r\n    {\r\n        private static readonly Hashtable<string, Expression<Func<T, XElement>>> __preBuildSelectors = new Hashtable<string, Expression<Func<T, XElement>>>();\r\n        private static readonly Hashtable<Expression<Func<T, XElement>>, Func<T, XElement>> _compiledExpressions = new Hashtable<Expression<Func<T, XElement>>, Func<T, XElement>>();\r\n\r\n        public static readonly object _syncRoot = new object();\r\n\r\n        public static Func<T, XElement> GetCompiledFunction(Expression<Func<T, XElement>> xelementSelector)\r\n        {\r\n            Func<T, XElement> result;\r\n\r\n            if (!_compiledExpressions.TryGetValue(xelementSelector, out result))\r\n            {\r\n                lock (_syncRoot)\r\n                {\r\n                    if (!_compiledExpressions.TryGetValue(xelementSelector, out result))\r\n                    {\r\n                        result = xelementSelector.Compile();\r\n                        _compiledExpressions.Add(xelementSelector, result);\r\n                    }\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n        public static Expression<Func<T, XElement>> BuildXElementSelector(List<string> fieldNames, XName elementName)\r\n        {\r\n            return BuildXElementSelector(fieldNames, elementName, \"\");\r\n        }\r\n\r\n        public static Expression<Func<T, XElement>> BuildXElementSelector(List<string> fieldNames, XName elementName, string propertyNamePrefix)\r\n        {\r\n            Expression<Func<T, XElement>> result;\r\n\r\n            string lookupKey = string.Format(\"{0}//{1}//{2}\", string.Join(\",\", fieldNames.ToArray()), elementName, propertyNamePrefix);\r\n\r\n            if (__preBuildSelectors.TryGetValue(lookupKey, out result) == false)\r\n            {\r\n                lock (_syncRoot)\r\n                {\r\n                    if (__preBuildSelectors.TryGetValue(lookupKey, out result) == false)\r\n                    {\r\n                        result = BuildXElementSelectorImpl(fieldNames, elementName, propertyNamePrefix);\r\n                        __preBuildSelectors.Add(lookupKey, result);\r\n                    }\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n        private static Expression<Func<T, XElement>> BuildXElementSelectorImpl(List<string> fieldNames, XName elementName, string propertyNamePrefix)\r\n        {\r\n            ParameterExpression _sourceItem = Expression.Parameter(typeof(T), \"data\");\r\n\r\n            ConstructorInfo xElementConstructorInfo = typeof(XElement).GetConstructor(new Type[] { typeof(XName), typeof(object[]) });\r\n            ConstructorInfo xAttributeConstructorInfo = typeof(XAttribute).GetConstructor(new Type[] { typeof(XName), typeof(object) });\r\n\r\n            List<Expression> xattributeNewExpressions = new List<Expression>();\r\n\r\n            foreach (string fieldName in fieldNames)\r\n            {\r\n                PropertyInfo fieldPropertyInfo = typeof(T).GetPropertiesRecursively(f => f.DeclaringType != typeof(IData)).Where(prop => prop.Name == fieldName).SingleOrDefault();\r\n\r\n                if (fieldPropertyInfo == null) throw new InvalidOperationException(string.Format(\"The type '{0}' does have a property named '{1}'\", typeof(T), fieldName));\r\n\r\n                Expression attributeNameExpression = Expression.Constant(XName.Get(propertyNamePrefix + fieldName));\r\n                Expression attributeValueExpression = Expression.Convert(LambdaExpression.Property(_sourceItem, fieldPropertyInfo), typeof(object));\r\n\r\n                Expression xattributeNewExpression = Expression.New(xAttributeConstructorInfo, new Expression[] { attributeNameExpression, attributeValueExpression });\r\n\r\n                // Return \"null\" instead of \"new XAttribute( 'xxx', null )\"\r\n                Expression notNullCheck = Expression.NotEqual(attributeValueExpression, Expression.Constant(null));\r\n                Expression nullChecked = Expression.Condition(notNullCheck, Expression.Convert(xattributeNewExpression, typeof(object)), Expression.Constant(null));\r\n\r\n\r\n                xattributeNewExpressions.Add(nullChecked); //xattributeNewExpression);\r\n            }\r\n\r\n            Expression xattributeArrayExpression = Expression.NewArrayInit(typeof(object), xattributeNewExpressions);\r\n\r\n            Expression elementNameExpression = Expression.Constant(elementName);\r\n            Expression[] xelementConstructorArguments = new Expression[] { elementNameExpression, xattributeArrayExpression };\r\n            Expression xelementNewExpression = Expression.New(xElementConstructorInfo, xelementConstructorArguments);\r\n\r\n            Expression<Func<T, XElement>> lambdaExpression = Expression.Lambda<Func<T, XElement>>(xelementNewExpression, new ParameterExpression[] { _sourceItem });\r\n\r\n            return lambdaExpression;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/GetXmlCachePriority.cs",
    "content": "﻿namespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated\r\n{\r\n    internal enum GetXmlCachePriority\r\n    {\r\n        Disabled = 0,\r\n        Default = 1\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/IDataGenerated/UpdateDataInstance.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated\r\n{\r\n    internal sealed class UpdateDataInstance<T> : StandardFunctionBase\r\n        where T : class, IData\r\n    {\r\n        private List<StandardFunctionParameterProfile> _parameterProfiles = null;\r\n\r\n\r\n\r\n        public UpdateDataInstance(EntityTokenFactory entityTokenFactory)\r\n            : base(\"UpdateDataInstance\", typeof(T).FullName, typeof(void), entityTokenFactory)\r\n        {\r\n            this.ResourceHandleNameStem = \"Composite.IDataGenerated.UpdateDataInstance\";\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                if (_parameterProfiles == null)\r\n                {\r\n                    _parameterProfiles = new List<StandardFunctionParameterProfile>();\r\n                    DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeof(T));\r\n\r\n                    foreach (DataFieldDescriptor dataFieldDescriptor in dataTypeDescriptor.Fields)\r\n                    {\r\n                        if (dataTypeDescriptor.KeyPropertyNames.Contains(dataFieldDescriptor.Name)) continue;\r\n\r\n                        string helpText = dataFieldDescriptor.Name;\r\n                        if (dataFieldDescriptor.FormRenderingProfile != null && !string.IsNullOrWhiteSpace(dataFieldDescriptor.FormRenderingProfile.HelpText))\r\n                        {\r\n                            helpText = dataFieldDescriptor.FormRenderingProfile.HelpText;\r\n                        }\r\n                        \r\n\r\n                        _parameterProfiles.Add(new StandardFunctionParameterProfile(\r\n                            dataFieldDescriptor.Name,\r\n                            dataFieldDescriptor.InstanceType,\r\n                            false,\r\n                            DataInstanceHelper.GetFallbackValueProvider(dataFieldDescriptor, false),\r\n                            DataInstanceHelper.GetWidgetFunctionProvider(dataFieldDescriptor)\r\n                        )\r\n                        {\r\n                            CustomLabel = dataFieldDescriptor.Name,\r\n                            CustomHelpText = helpText\r\n                        });\r\n                    }\r\n\r\n                    Expression<Func<T, bool>> defaultFilter = DataFacade.GetEmptyPredicate<T>();\r\n\r\n                    _parameterProfiles.Add(new StandardFunctionParameterProfile(\r\n                        \"Filter\",\r\n                        typeof(Expression<Func<T, bool>>),\r\n                        false,\r\n                        new ConstantValueProvider(defaultFilter),\r\n                        null\r\n                    ));\r\n                }\r\n\r\n                return _parameterProfiles;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<T, bool>> filter = parameters.GetParameter<Expression<Func<T, bool>>>(\"Filter\");\r\n\r\n            List<PropertyInfo> typePropertites = typeof(T).GetPropertiesRecursively();\r\n\r\n            List<Tuple<PropertyInfo, object>> newValues = new List<Tuple<PropertyInfo, object>>();\r\n            foreach (string parameterName in parameters.AllParameterNames.Where(f => f != \"Filter\"))\r\n            {\r\n                if (parameters.IsDefaultValue(parameterName)) continue;\r\n\r\n                PropertyInfo propertyInfo = typePropertites.Where(f => f.Name == parameterName).Single();\r\n\r\n                object value = parameters.GetParameter(parameterName, propertyInfo.PropertyType);\r\n\r\n                newValues.Add(new Tuple<PropertyInfo, object>(propertyInfo, value));\r\n            }\r\n\r\n\r\n            IEnumerable<T> datas = DataFacade.GetData<T>(filter).Evaluate();\r\n            foreach (T data in datas)\r\n            {\r\n                foreach (Tuple<PropertyInfo, object> newValue in newValues)\r\n                {\r\n                    newValue.Item1.SetValue(data, newValue.Item2, null);\r\n                }\r\n            }\r\n\r\n            DataFacade.Update(datas);\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Mail/SendMailFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Net.Mail;\r\nusing System.Web;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Logging;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Mail\r\n{\r\n    internal class SendMailFunction : StandardFunctionBase\r\n\t{\r\n        private static readonly string LogTitle = \"SendMailFunction\";\r\n        private static readonly string CompositeMediaAttachmentPrefix = \"Composite/\";\r\n\r\n        public SendMailFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"SendMail\", \"Composite.Mail\", typeof(bool), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string from = parameters.GetParameter<string>(\"From\");\r\n            string to = parameters.GetParameter<string>(\"To\");\r\n            string subject = parameters.GetParameter<string>(\"Subject\");\r\n            string body = parameters.GetParameter<string>(\"Body\");\r\n            bool isHtml = parameters.GetParameter<bool>(\"IsHtml\");\r\n\r\n            string replyTo = parameters.GetParameter<string>(\"ReplyTo\");\r\n            string cc = parameters.GetParameter<string>(\"CC\");\r\n            string bcc = parameters.GetParameter<string>(\"BCC\");\r\n            string attachment = parameters.GetParameter<string>(\"Attachment\") ?? string.Empty;\r\n            string attachmentFromMedia = parameters.GetParameter<string>(\"AttachmentFromMedia\") ?? string.Empty;\r\n\r\n            if(!attachmentFromMedia.IsNullOrEmpty())\r\n            {\r\n                attachment += \"|\" + CompositeMediaAttachmentPrefix + attachmentFromMedia;\r\n            }\r\n\r\n            return SendMail(subject, body, isHtml, from, to, replyTo, cc, bcc, attachment);\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextAreaWidget;\r\n                WidgetFunctionProvider boolWidget = StandardWidgetFunctions.GetBoolSelectorWidget(\"True\", \"False\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\"From\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n                yield return new StandardFunctionParameterProfile(\"To\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n                yield return new StandardFunctionParameterProfile(\"Subject\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n                yield return new StandardFunctionParameterProfile(\"Body\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n                yield return new StandardFunctionParameterProfile(\"IsHtml\", typeof(bool), true, new ConstantValueProvider(false), boolWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\"ReplyTo\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);                \r\n                yield return new StandardFunctionParameterProfile(\"CC\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n                yield return new StandardFunctionParameterProfile(\"BCC\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\"Attachment\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n\r\n                WidgetFunctionProvider mediaSelectionWidget = StandardWidgetFunctions.GetDataReferenceWidget(typeof (IMediaFile));\r\n\r\n                yield return new StandardFunctionParameterProfile(\"AttachmentFromMedia\", typeof(string), false, new ConstantValueProvider(\"\"), mediaSelectionWidget);\r\n            }\r\n        }\r\n\r\n        public static bool SendMail(string subject, string body, bool isHtml, string from, string to)\r\n        {\r\n            return SendMail(subject, body, isHtml, from, to, null, null, null, null);\r\n        }\r\n\r\n        public static bool SendMail(string subject, string body, bool isHtml, string from, string to, string replyTo, string cc, string bcc, string attachmentsList)\r\n        {\r\n            var toDispose = new List<IDisposable>();\r\n\r\n            try\r\n            {\r\n                MailMessage mailMessage = new MailMessage(from, to)\r\n                {\r\n                    Body = body,\r\n                    Subject = subject,\r\n                    IsBodyHtml = isHtml\r\n                };\r\n\r\n                if (!cc.IsNullOrEmpty())\r\n                {\r\n                    mailMessage.CC.Add(cc);\r\n                }\r\n\r\n                if (!bcc.IsNullOrEmpty())\r\n                {\r\n                    mailMessage.Bcc.Add(bcc);\r\n                }\r\n\r\n                if (!replyTo.IsNullOrEmpty())\r\n                {\r\n                    mailMessage.ReplyToList.Add(new MailAddress(replyTo));\r\n                }\r\n\r\n                toDispose.Add(mailMessage);\r\n\r\n                if(!ParseAttachmentList(attachmentsList, mailMessage.Attachments, toDispose))\r\n                {\r\n                    return false;\r\n                }\r\n               \r\n\r\n\r\n                var mailer = ServiceLocator.GetService<IMailer>();\r\n\r\n                mailer.Send(mailMessage);\r\n\r\n                return true;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogWarning(LogTitle, ex);\r\n                return false;\r\n            }\r\n            finally\r\n            {\r\n                foreach (IDisposable obj in toDispose)\r\n                {\r\n                    obj.Dispose();\r\n                }\r\n            }\r\n        }\r\n\r\n        private static bool ParseAttachmentList(string attachmentList, AttachmentCollection result, IList<IDisposable> toDispose)\r\n        {\r\n            if (attachmentList.IsNullOrEmpty()) return true;\r\n\r\n            foreach (var atmStr in attachmentList.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))\r\n            {\r\n                string line = atmStr.Trim();\r\n                if (line.IsNullOrEmpty()) continue;\r\n\r\n                string attachmentName;\r\n                string filePath;\r\n                string mimeType;\r\n\r\n                if (line.Contains(\",\"))\r\n                {\r\n                    int comaIndex = line.IndexOf(',');\r\n                    mimeType = line.Substring(comaIndex + 1);\r\n                    line = line.Substring(0, comaIndex).Trim();\r\n                }\r\n                else\r\n                {\r\n                    mimeType = null;\r\n                }\r\n\r\n\r\n                if (line.Contains(\"=\"))\r\n                {\r\n                    int equalSignIndex = line.IndexOf('=');\r\n                    attachmentName = line.Substring(0, equalSignIndex).Trim();\r\n                    filePath = line.Substring(equalSignIndex + 1).Trim();\r\n                }\r\n                else\r\n                {\r\n                    attachmentName = null;\r\n                    filePath = line;\r\n                }\r\n\r\n                // Checking whether the file is from Composite media database\r\n                if (filePath.StartsWith(CompositeMediaAttachmentPrefix))\r\n                {\r\n                    string compositePath = filePath.Substring(CompositeMediaAttachmentPrefix.Length);\r\n                    string storeId = compositePath.Substring(0, compositePath.IndexOf(':'));\r\n                    IMediaFile mediaFile;\r\n                    try\r\n                    {\r\n                        mediaFile = DataFacade.GetData<IMediaFile>(f => f.StoreId == storeId && f.CompositePath == compositePath).FirstOrDefault();\r\n                    }\r\n                    catch (Exception e)\r\n                    {\r\n                        LoggingService.LogWarning(LogTitle, \"Media file '{0}' cannot be found.\".FormatWith(compositePath));\r\n                        LoggingService.LogError(LogTitle, e);\r\n                        return false;\r\n                    }\r\n\r\n                    Stream readStream = mediaFile.GetReadStream();\r\n\r\n                    result.Add(new Attachment(readStream, attachmentName ?? mediaFile.Title, mimeType ?? mediaFile.MimeType));\r\n\r\n                    continue;\r\n                } \r\n                \r\n                // File is a file on disk\r\n                if (!filePath.Contains(@\":\\\") && HttpContext.Current != null)\r\n                {\r\n                    filePath = HttpContext.Current.Server.MapPath(filePath);\r\n                }\r\n\r\n                if (!C1File.Exists(filePath))\r\n                {\r\n                    LoggingService.LogWarning(LogTitle,\r\n                                              \"Cannot create an attachment. File '{0}' does not exists\".\r\n                                                  FormatWith(filePath));\r\n                    return false;\r\n                }\r\n\r\n\r\n                Attachment attachment;\r\n                if (mimeType.IsNullOrEmpty())\r\n                {\r\n                    if (attachmentName.IsNullOrEmpty())\r\n                    {\r\n                        attachment = new Attachment(filePath);\r\n                    }\r\n                    else\r\n                    {\r\n                        attachment = new Attachment(C1File.OpenRead(filePath), attachmentName);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    if (attachmentName.IsNullOrEmpty())\r\n                    {\r\n                        attachment = new Attachment(filePath, mimeType);\r\n                    }\r\n                    else\r\n                    {\r\n                        attachment = new Attachment(C1File.OpenRead(filePath), attachmentName, mimeType);\r\n                    }\r\n                }\r\n\r\n                result.Add(attachment);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\t}\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Media/MediaFolderFilterFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Media\r\n{\r\n    internal sealed class MediaFolderFilterFunction<TMedia> : StandardFunctionBase where TMedia : IMediaFile\r\n    {\r\n        private static readonly MethodInfo MethodInfoGetFolderPath = typeof(IFile).GetProperty(\"FolderPath\").GetGetMethod();\r\n        private static readonly MethodInfo MethodInfoStringStartsWith = typeof(string).GetMethod(\"StartsWith\", new[] { typeof(string) });\r\n\r\n\r\n        public MediaFolderFilterFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"MediaFolderFilter\", typeof(TMedia).FullName, typeof(Expression<Func<TMedia, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"MediaFolder\",\r\n                    typeof(DataReference<IMediaFileFolder>),\r\n                    false,\r\n                    new ConstantValueProvider(null),\r\n                    StandardWidgetFunctions.GetDataReferenceWidget<IMediaFileFolder>());\r\n\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.GetBoolSelectorWidget(\"True\", \"False\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"IncludeSubfolders\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(false), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var mediaFolderReference = parameters.GetParameter<DataReference<IMediaFileFolder>>(\"MediaFolder\");\r\n            Verify.ArgumentNotNull(mediaFolderReference, \"mediaFolderReference\");\r\n\r\n            bool includeSubfolders = parameters.GetParameter<bool>(\"IncludeSubfolders\");\r\n\r\n            IMediaFileFolder mediaFolder = GetMediaFolder(mediaFolderReference);\r\n\r\n            if (mediaFolder == null)\r\n            {\r\n                return (Expression<Func<TMedia, bool>>)(f => false);\r\n            }\r\n\r\n            string mediaFolderPath = mediaFolder.Path;\r\n            string mediaFolderPathWithSlash = mediaFolder.Path + \"/\";\r\n\r\n            if (includeSubfolders)\r\n            {\r\n                //return (Expression<Func<TMedia, bool>>)\r\n                //       (image => image.FolderPath == mediaFolderPath\r\n                //            || image.FolderPath.StartsWith(mediaFolderPathWithSlash));\r\n\r\n                var imageParam = Expression.Parameter(typeof(TMedia), \"image\");\r\n\r\n                var orElse = Expression.OrElse(\r\n                    Expression.Equal(Expression.Property(imageParam, MethodInfoGetFolderPath),\r\n                                     Expression.Constant(mediaFolderPath)),\r\n                    Expression.Call(Expression.Property(imageParam, MethodInfoGetFolderPath),\r\n                                    MethodInfoStringStartsWith,\r\n                                    new Expression[] { Expression.Constant(mediaFolderPathWithSlash) }));\r\n\r\n                return Expression.Lambda<Func<TMedia, bool>>(orElse, imageParam);\r\n            }\r\n            // return (Expression<Func<TMedia, bool>>)(imageParam1 => imageParam1.FolderPath == mediaFolderPath);\r\n\r\n            var imageParam1 = Expression.Parameter(typeof(TMedia), \"image\");\r\n\r\n            return Expression.Lambda<Func<TMedia, bool>>(\r\n                 Expression.Equal(Expression.Property(imageParam1, MethodInfoGetFolderPath),\r\n                                  Expression.Constant(mediaFolderPath)),\r\n                imageParam1);\r\n        }\r\n\r\n        private static IMediaFileFolder GetMediaFolder(DataReference<IMediaFileFolder> mediaFolderReference)\r\n        {\r\n            string mediaFolderKeyPath = mediaFolderReference.KeyValue as string;\r\n\r\n            using (new DataScope(DataScopeIdentifier.Public))\r\n            {\r\n                var query = DataFacade.GetData<IMediaFileFolder>();\r\n\r\n                if (query.IsEnumerableQuery())\r\n                {\r\n                    return query.AsEnumerable().Where(mf => mf.KeyPath == mediaFolderKeyPath).FirstOrDefault();\r\n                }\r\n\r\n                return query.Where(mf => mf.KeyPath == mediaFolderKeyPath).FirstOrDefault();\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Pages/GetForeignPageInfoFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Threading;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Pages\r\n{\r\n    /// <summary>\r\n    /// Gets information about current page in all the languages.\r\n    /// </summary>\r\n\tinternal class GetForeignPageInfoFunction: StandardFunctionBase\r\n\t{\r\n        public GetForeignPageInfoFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"GetForeignPageInfo\", \"Composite.Pages\", typeof(IEnumerable<XElement>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return ExecuteInternal();\r\n        }\r\n\r\n        private static IEnumerable<XElement> ExecuteInternal()\r\n        {\r\n            // Grab all active languages...\r\n            foreach (CultureInfo culture in DataLocalizationFacade.ActiveLocalizationCultures)\r\n            {\r\n                XElement annotatedMatch;\r\n\r\n                // enter the 'data scope' of the next language\r\n                using (new DataScope(culture))\r\n                {\r\n                    // fetch sitemap element for current page - if any\r\n                    IPage match = PageManager.GetPageById(PageRenderer.CurrentPageId);\r\n\r\n                    if (match == null)\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    annotatedMatch = new XElement(\"LanguageVersion\"\r\n                            , new XAttribute(\"Culture\", culture.Name)\r\n                            , new XAttribute(\"CurrentCulture\", culture.Equals(Thread.CurrentThread.CurrentCulture))\r\n                            , new XAttribute(\"Id\", match.Id)\r\n                            , new XAttribute(\"Title\", match.Title)\r\n                            , (match.MenuTitle == null ? null : new XAttribute(\"MenuTitle\", match.MenuTitle))\r\n                            , new XAttribute(\"UrlTitle\", match.UrlTitle)\r\n                            , new XAttribute(\"Description\", match.Description)\r\n                            , new XAttribute(\"URL\", PageUrls.BuildUrl(match))\r\n                            );\r\n\r\n                }\r\n\r\n                yield return annotatedMatch;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Pages/GetPageIdFunction.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Pages\r\n{\r\n    internal sealed class GetPageIdFunction : StandardFunctionBase\r\n    {\r\n        public GetPageIdFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"GetPageId\", \"Composite.Pages\", typeof(Guid), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (!parameters.TryGetParameter<SitemapScope>(nameof(SitemapScope), out var sitemapScope))\r\n            {\r\n                sitemapScope = SitemapScope.Current;\r\n            }\r\n\r\n            var pageId = GetCurrentPageId();\r\n\r\n            switch (sitemapScope)\r\n            {\r\n                case SitemapScope.Current:\r\n                    return pageId;\r\n                case SitemapScope.Parent:\r\n                case SitemapScope.Level1:\r\n                case SitemapScope.Level2:\r\n                case SitemapScope.Level3:\r\n                case SitemapScope.Level4:\r\n                    var pageIds = PageStructureInfo.GetAssociatedPageIds(pageId, sitemapScope);\r\n                    return pageIds.FirstOrDefault();\r\n                default:\r\n                    throw new NotImplementedException(\"Unhandled SitemapScope type: \" + sitemapScope.ToString());\r\n            }\r\n        }\r\n\r\n        private Guid GetCurrentPageId()\r\n        {\r\n            return GetCurrentPageIdFromPageRenderer()\r\n                   ?? GetCurrentPageIdFromPageUrlData()\r\n                   ?? GetCurrentPageIdFromHttpContext()\r\n                   ?? GetCurrentPageIdFromFormFlow()\r\n                   ?? Guid.Empty;\r\n        }\r\n\r\n        private Guid? GetCurrentPageIdFromPageRenderer()\r\n        {\r\n            var pageId = PageRenderer.CurrentPageId;\r\n            return pageId == Guid.Empty ? (Guid?)null : pageId;\r\n        }\r\n\r\n        private Guid? GetCurrentPageIdFromPageUrlData()\r\n        {\r\n            var pageId = C1PageRoute.PageUrlData?.PageId;\r\n            return pageId == Guid.Empty ? null : pageId;\r\n        }\r\n\r\n        private Guid? GetCurrentPageIdFromHttpContext()\r\n        {\r\n            var entityToken = HttpContext.Current?.Items[ActionExecutorFacade.HttpContextItem_EntityToken];\r\n            return GetPageIdFromEntityToken(entityToken as EntityToken);\r\n        }\r\n\r\n        private Guid? GetCurrentPageIdFromFormFlow()\r\n        {\r\n            var currentFormTreeCompiler = FormFlowUiDefinitionRenderer.CurrentFormTreeCompiler;\r\n            if (currentFormTreeCompiler.BindingObjects.TryGetValue(FormsWorkflow.EntityTokenKey, out var entityToken))\r\n            {\r\n                return GetPageIdFromEntityToken(entityToken as EntityToken);\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private Guid? GetPageIdFromEntityToken(EntityToken entityToken)\r\n        {\r\n            if (entityToken is null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            Guid pageId = Guid.Empty;\r\n\r\n            if (entityToken is DataEntityToken dataEntityToken)\r\n            {\r\n                //appears while adding a metadata element\r\n                if (dataEntityToken.Data is IPage page)\r\n                {\r\n                    pageId = page.Id;\r\n                }\r\n                //appears while editing a datafolder element\r\n                else if (dataEntityToken.Data is IPageRelatedData pageRelatedData)\r\n                {\r\n                    pageId = pageRelatedData.PageId;\r\n                }\r\n            }\r\n            //appears while adding a datafolder element\r\n            else if (typeof(IPage).IsAssignableFrom(Type.GetType(entityToken.Type, throwOnError: false)))\r\n            {\r\n                Guid.TryParse(entityToken?.Id, out pageId);\r\n            }\r\n            return pageId == Guid.Empty ? null : (Guid?)pageId;\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider associationDropDown = StandardWidgetFunctions.DropDownList(\r\n                    this.GetType(), \"PageAssociationRestrictions\", \"Key\", \"Value\", false, true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    nameof(SitemapScope),\r\n                    typeof(SitemapScope),\r\n                    false,\r\n                    new ConstantValueProvider(SitemapScope.Current),\r\n                    associationDropDown);\r\n            }\r\n        }\r\n\r\n\r\n        public static IEnumerable<KeyValuePair<SitemapScope, string>> PageAssociationRestrictions()\r\n        {\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Current, \"Current page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Parent, \"Parent page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level1, \"Level 1 page (homepage)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level2, \"Level 2 page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level3, \"Level 3 page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level4, \"Level 4 page\");\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Pages/SitemapFunction.cs",
    "content": "﻿using System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Xsl;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Pages\r\n{\r\n\tinternal sealed class SitemapFunction : StandardFunctionBase\r\n    {\r\n        #region XSLT constants\r\n        const string _sitemapXslTemplate = @\"<?xml version=\"\"1.0\"\" encoding=\"\"UTF-8\"\"?>\r\n<xsl:stylesheet version=\"\"1.0\"\" xmlns:xsl=\"\"http://www.w3.org/1999/XSL/Transform\"\" exclude-result-prefixes=\"\"xsl\"\"\r\n\txmlns=\"\"http://www.w3.org/1999/xhtml\"\">\r\n\r\n\t<xsl:template match=\"\"/\"\">\r\n\t\t<html>\r\n\t\t\t<head>\r\n\t\t\t\t<style id=\"\"CompositePagesXhtmlSitemapStyle\"\">\r\n                    ul#Sitemap, ul#Sitemap ul {\r\n                        list-style: none;\r\n                        margin: 0;\r\n                        padding: 0;\r\n                    }\r\n\r\n\r\n                    ul#Sitemap ul {\r\n                        margin-left: 0.8em;\r\n                    }\r\n\r\n                    ul#Sitemap li {\r\n                        padding: 0;\r\n                    }\r\n\r\n                    #Sitemap a {\r\n                        text-decoration: none;\r\n                    }\r\n\r\n                    #Sitemap a.sitemapCurrentPage\r\n                    {\r\n                        font-weight: bold;\r\n                    }\r\n\r\n                    #Sitemap a.sitemapOpenPage\r\n                    {\r\n                        font-style: italic;\r\n                    }\r\n\t\t\t\t</style>\r\n\t\t\t</head>\r\n\t\t\t<body>\r\n\t\t\t\t<ul id=\"\"Sitemap\"\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"\"/sitemap/Page\"\" />\r\n\t\t\t\t</ul>\r\n\t\t\t</body>\r\n\t\t</html>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"\"Page[@MenuTitle]\"\">\r\n\t\t<li>\r\n\t\t\t<xsl:apply-templates mode=\"\"classAttribute\"\" select=\"\".\"\" />\r\n\t\t\t<a href=\"\"{@URL}\"\">\r\n\t\t\t\t<xsl:apply-templates mode=\"\"classAttribute\"\" select=\"\".\"\" />\r\n\t\t\t\t<xsl:value-of select=\"\"@MenuTitle\"\" />\r\n\t\t\t</a>\r\n\t\t\t<xsl:if test=\"\"count(Page)&gt;0\"\">\r\n\t\t\t\t<ul>\r\n\t\t\t\t\t<xsl:apply-templates select=\"\"Page\"\" />\r\n\t\t\t\t</ul>\r\n\t\t\t</xsl:if>\r\n\t\t</li>\r\n\t</xsl:template>\r\n\r\n\r\n\t<xsl:template mode=\"\"classAttribute\"\" match=\"\"Page\"\">\r\n\t\t<xsl:choose>\r\n\t\t\t<xsl:when test=\"\"@iscurrent='true'\"\">\r\n\t\t\t\t<xsl:attribute name=\"\"class\"\">sitemapCurrentPage</xsl:attribute>\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:when test=\"\"@isopen='true'\"\">\r\n\t\t\t\t<xsl:attribute name=\"\"class\"\">sitemapOpenPage</xsl:attribute>\r\n\t\t\t</xsl:when>\r\n\t\t</xsl:choose>\r\n\t</xsl:template>\r\n\r\n</xsl:stylesheet>\r\n\";\r\n\r\n        #endregion\r\n\r\n        private static object _lock = new object();\r\n        private static XslCompiledTransform xslt = null;\r\n\r\n        private static XslCompiledTransform GetCompiledXslt()\r\n        {\r\n            lock (_lock)\r\n            {\r\n                if (xslt == null)\r\n                {\r\n                    xslt = new XslCompiledTransform();\r\n\r\n                    XElement xsltSource = XElement.Parse(_sitemapXslTemplate);\r\n\r\n                    xslt.Load(xsltSource.CreateReader());\r\n\r\n                }\r\n                return xslt;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private EntityTokenFactory _entityTokenFactory;\r\n\r\n        public SitemapFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"QuickSitemap\", \"Composite.Pages\", typeof(XhtmlDocument), entityTokenFactory)\r\n        {\r\n            _entityTokenFactory = entityTokenFactory;\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            XDocument xmlSitemap = new XDocument( new XElement(\"sitemap\", PageStructureInfo.GetSiteMapWithActivePageAnnotations()));\r\n\r\n            XDocument xhtmlSitemap = new XDocument();\r\n            using (XmlWriter writer = xhtmlSitemap.CreateWriter())\r\n            {\r\n                GetCompiledXslt().Transform(xmlSitemap.CreateReader(), writer);\r\n            }\r\n\r\n            return new XhtmlDocument(xhtmlSitemap);\r\n        }\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Pages/SitemapXmlFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Pages\r\n{\r\n    internal sealed class SitemapXmlFunction : StandardFunctionBase\r\n    {\r\n        public SitemapXmlFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"SitemapXml\", \"Composite.Pages\", typeof(IEnumerable<XElement>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider associationDropDown = StandardWidgetFunctions.DropDownList(\r\n                    this.GetType(), \"PageAssociationRestrictions\", \"Key\", \"Value\", false, true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"SourcePage\",\r\n                    typeof(DataReference<IPage>),\r\n                    false,\r\n                    new ConstantValueProvider(null),\r\n                    StandardWidgetFunctions.GetDataReferenceWidget<IPage>());\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"SitemapScope\",\r\n                    typeof(SitemapScope),\r\n                    false,\r\n                    new ConstantValueProvider(SitemapScope.All),\r\n                    associationDropDown);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            SitemapScope SitemapScope = parameters.GetParameter<SitemapScope>(\"SitemapScope\");\r\n            DataReference<IPage> pageReference = parameters.GetParameter<DataReference<IPage>>(\"SourcePage\");\r\n\r\n            Guid pageId;\r\n            if (pageReference != null && pageReference.IsSet)\r\n            {\r\n                pageId = (Guid)pageReference.KeyValue;\r\n            }\r\n            else\r\n            {\r\n                pageId = PageRenderer.CurrentPageId;\r\n            }\r\n\r\n            return PageStructureInfo.GetSitemapByScope(SitemapScope, pageId);\r\n        }\r\n\r\n\r\n        public static IEnumerable<KeyValuePair<SitemapScope, string>> PageAssociationRestrictions()\r\n        {\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Current, \"Current page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.All, \"All pages (no filter)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.AncestorsAndCurrent, \"Ancestors and current (breadcrumb)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Ancestors, \"Ancestor pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Parent, \"Parent page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Descendants, \"Descendant pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.DescendantsAndCurrent, \"Current and descendant pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Children, \"Child pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Siblings, \"Sibling pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level1, \"Level 1 page (homepage)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level1AndDescendants, \"Level 1 and descendant pages (current site)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level1AndSiblings, \"Level 1 and sibling pages (all homepages)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level2, \"Level 2 page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level2AndDescendants, \"Level 2 and descendant pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level2AndSiblings, \"Level 2 and sibling pages (site main areas)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level3, \"Level 3 page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level3AndDescendants, \"Level 3 and descendant pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level3AndSiblings, \"Level 3 and sibling pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level4, \"Level 4 page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level4AndDescendants, \"Level 4 and descendant pages\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level4AndSiblings, \"Level 4 and sibling pages\");\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/StandardFunctionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.IDataGenerated.Filter;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing Composite.Data.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider\r\n{\r\n    [ConfigurationElementType(typeof(StandardFunctionProviderData))]\r\n    internal class StandardFunctionProvider : IDynamicTypeFunctionProvider\r\n\t{\r\n        private EntityTokenFactory _entityTokenFactory;\r\n        private List<IFunction> _standardStaticTypeFunctions = null;\r\n        private List<IFunction> _standardDynamicTypeFunctions = null;\r\n\r\n\r\n\r\n        public StandardFunctionProvider(string providerName)\r\n        {\r\n            _entityTokenFactory = new EntityTokenFactory(providerName);\r\n        }\r\n\r\n\r\n\r\n        public FunctionNotifier FunctionNotifier\r\n        {\r\n            set {} // List is static\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<IFunction> Functions\r\n        {\r\n            get \r\n            {\r\n                if (_standardStaticTypeFunctions == null)\r\n                {\r\n                    InitializeStaticTypeFunctions();\r\n                }\r\n\r\n                foreach (IFunction function in _standardStaticTypeFunctions)\r\n                {\r\n                    yield return function;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<IFunction> DynamicTypeDependentFunctions\r\n        {\r\n            get \r\n            {\r\n                if (_standardDynamicTypeFunctions == null)\r\n                {\r\n                    InitializeDynamicTypeFunctions();\r\n                }\r\n\r\n                foreach (IFunction function in _standardDynamicTypeFunctions)\r\n                {\r\n                    yield return function;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void InitializeStaticTypeFunctions()\r\n        {\r\n            _standardStaticTypeFunctions = new List<IFunction>();\r\n\r\n            // constant\r\n            _standardStaticTypeFunctions.Add(new Constant.StringFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Constant.DateTimeFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Constant.BooleanFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Constant.DecimalFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Constant.IntegerFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Constant.GuidFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Constant.XhtmlDocumentFunction(_entityTokenFactory));\r\n\r\n            // web\r\n            _standardStaticTypeFunctions.Add(new Web.Client.BrowserPlatformFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Client.BrowserStringFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Client.BrowserTypeFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Client.BrowserVersionFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Client.EcmaScriptVersionFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Client.IsCrawlerFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Client.IsMobileDeviceFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Html.Template.CommonMetaTagsFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Html.Template.LangAttributeFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Html.Template.PageTemplateFeatureFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Html.Template.HtmlTitleValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Html.Template.MetaDescriptionValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.CookieValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.SessionVariableFunction(_entityTokenFactory));\r\n\r\n            _standardStaticTypeFunctions.Add(new Web.Request.FormPostValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.FormPostBoolValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.FormPostDecimalValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.FormPostGuidValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.FormPostIntegerValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.FormPostXmlFormattedDateTimeValueFunction(_entityTokenFactory));\r\n\r\n            _standardStaticTypeFunctions.Add(new Web.Request.QueryStringValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.QueryStringBoolValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.QueryStringDecimalValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.QueryStringGuidValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.QueryStringIntegerValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.QueryStringXmlFormattedDateTimeValueFunction(_entityTokenFactory));\r\n\r\n            _standardStaticTypeFunctions.Add(new Web.Request.PathInfoFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.PathInfoIntFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.PathInfoGuidFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Request.RegisterPathInfoUsageFunction(_entityTokenFactory));\r\n\r\n            _standardStaticTypeFunctions.Add(new Web.Response.RedirectFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Response.SetCookieValueFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Response.SetServerPageCacheDuration(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Response.SetSessionVariableFunction(_entityTokenFactory));\r\n\r\n            _standardStaticTypeFunctions.Add(new Web.Server.ApplicationPath(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Server.ApplicationVariableFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Web.Server.ServerVariableFunction(_entityTokenFactory));\r\n\r\n            // date\r\n            _standardStaticTypeFunctions.Add(new Utils.Date.NowFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Date.AddDaysFunction(_entityTokenFactory));\r\n\r\n            // guid\r\n            _standardStaticTypeFunctions.Add(new Utils.GuidFunctions.NewGuid(_entityTokenFactory));\r\n\r\n            // globalization\r\n            _standardStaticTypeFunctions.Add(new Utils.Globalization.CurrentCulture(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Globalization.AllCultures(_entityTokenFactory));\r\n\r\n            // validation\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.RegexValidationFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.StringLengthValidationFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.NotNullValidationFunction<string>(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.NotNullValidationFunction<int>(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.NotNullValidationFunction<decimal>(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.NotNullValidationFunction<DateTime>(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.NotNullValidationFunction<Guid>(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.IntegerRangeValidationFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Validation.DecimalPrecisionValidationFunction(_entityTokenFactory));\r\n\r\n            // xml\r\n            _standardStaticTypeFunctions.Add(new Xml.LoadFileFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Xml.LoadXhtmlFileFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Xml.LoadUrlFunction(_entityTokenFactory));\r\n\r\n            // caching\r\n            _standardStaticTypeFunctions.Add(new Utils.Caching.PageObjectCacheFunction(_entityTokenFactory));\r\n\r\n            // compare\r\n            _standardStaticTypeFunctions.Add(new Utils.Compare.AreEqualFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Compare.IsLessThanFunction(_entityTokenFactory));\r\n\r\n            // configuration\r\n            _standardStaticTypeFunctions.Add(new Utils.Configuration.AppSettingsValueFunction(_entityTokenFactory));\r\n\r\n            // parameters\r\n            _standardStaticTypeFunctions.Add(new Utils.GetInputParameterFunction(_entityTokenFactory));\r\n\r\n            // parse string to object\r\n            _standardStaticTypeFunctions.Add(new Utils.ParseStringToObjectFunction(_entityTokenFactory));\r\n\r\n            // string\r\n            _standardStaticTypeFunctions.Add(new Utils.String.Join(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.String.JoinTwo(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.String.Split(_entityTokenFactory));\r\n\r\n            // int\r\n            _standardStaticTypeFunctions.Add(new Utils.Integer.Sum(_entityTokenFactory));\r\n\r\n            // XsltExtensions\r\n            _standardStaticTypeFunctions.Add(new Xslt.Extensions.DateFormattingXsltExtensionsFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Xslt.Extensions.GlobalizationXsltExtensionsFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Xslt.Extensions.MarkupParserXsltExtensionsFunction(_entityTokenFactory));\r\n\r\n            // AspNet\r\n            _standardStaticTypeFunctions.Add(new AspNet.LoadUserControlFunction(_entityTokenFactory));\r\n\r\n            // Mail\r\n            _standardStaticTypeFunctions.Add(new Mail.SendMailFunction(_entityTokenFactory));\r\n\r\n            // Media\r\n            _standardStaticTypeFunctions.Add(new Media.MediaFolderFilterFunction<IMediaFile>(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Media.MediaFolderFilterFunction<IImageFile>(_entityTokenFactory));\r\n\r\n            // Utils.Predicates\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.StringContainsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.StringEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.StringStartsWithPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.StringEndsWithPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.StringNoValuePredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.StringInListPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.StringInCommaSeparatedListPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.DateTimeLessThanPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.DateTimeGreaterThanPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.DateTimeEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.IntegerLessThanPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.IntegerGreaterThanPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.IntegerEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.DecimalLessThanPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.DecimalGreaterThanPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.DecimalEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.BoolEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.GuidEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.GuidInCommaSeparatedListPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableBoolEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableBoolNoValuePredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableDateTimeEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableDateTimeGreaterThanPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableDateTimeLessThanPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableDateTimeNoValuePredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableDecimalEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableDecimalNoValuePredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableGuidEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableGuidNoValuePredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableIntegerEqualsPredicateFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Predicates.NullableIntegerNoValuePredicateFunction(_entityTokenFactory));\r\n            \r\n            // Utils.Dictionary\r\n            _standardStaticTypeFunctions.Add(new Utils.Dictionary.XElementsToDictionaryFunction(_entityTokenFactory));\r\n            _standardStaticTypeFunctions.Add(new Utils.Dictionary.EnumerableToDictionary(_entityTokenFactory));\r\n        }\r\n\r\n\r\n\r\n        private void InitializeDynamicTypeFunctions()\r\n        {\r\n            _standardDynamicTypeFunctions = new List<IFunction>();\r\n\r\n            // pages\r\n            _standardDynamicTypeFunctions.Add(new Pages.SitemapXmlFunction(_entityTokenFactory));\r\n            _standardDynamicTypeFunctions.Add(new Pages.SitemapFunction(_entityTokenFactory));\r\n            _standardDynamicTypeFunctions.Add(new Pages.GetPageIdFunction(_entityTokenFactory));\r\n            _standardDynamicTypeFunctions.Add(new Pages.GetForeignPageInfoFunction(_entityTokenFactory));\r\n\r\n            // data.filter\r\n            List<Type> dataInterfaces = DataFacade.GetAllKnownInterfaces(UserType.Developer);\r\n            object[] args = new object[] { _entityTokenFactory };\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                where DataAssociationRegistry.IsAssociationType(t) \r\n                select (IFunction)Activator.CreateInstance(typeof(ActivePageReferenceFilter<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IFunction)Activator.CreateInstance(typeof(FieldPredicatesFilter<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IFunction)Activator.CreateInstance(typeof(CompoundFilter<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IFunction)Activator.CreateInstance(typeof(DataReferenceFilter<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IFunction)Activator.CreateInstance(typeof(GetXml<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                where DataAttributeFacade.GetKeyPropertyNames(t).Count == 1\r\n                select (IFunction)Activator.CreateInstance(typeof(GetDataReference<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                where DataAttributeFacade.GetKeyPropertyNames(t).Count == 1\r\n                select (IFunction)Activator.CreateInstance(typeof(GetNullableDataReference<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IFunction)Activator.CreateInstance(typeof(AddDataInstance<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IFunction)Activator.CreateInstance(typeof(UpdateDataInstance<>).MakeGenericType(t), args));\r\n\r\n            _standardDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IFunction)Activator.CreateInstance(typeof(DeleteDataInstance<>).MakeGenericType(t), args));\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(StandardFunctionProviderAssembler))]\r\n    internal sealed class StandardFunctionProviderData : FunctionProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class StandardFunctionProviderAssembler : IAssembler<IFunctionProvider, FunctionProviderData>\r\n    {\r\n        public IFunctionProvider Assemble(IBuilderContext context, FunctionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new StandardFunctionProvider(objectConfiguration.Name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/StandardFunctionProviderEntityToken.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider\r\n{\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n\tinternal sealed class StandardFunctionProviderEntityToken : EntityToken\r\n\t{\r\n        private string _id;\r\n        private string _source;\r\n\r\n        public StandardFunctionProviderEntityToken(string source, string id)\r\n        {\r\n            _source = source;\r\n            _id = id;\r\n        }\r\n\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new StandardFunctionProviderEntityToken(source, id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Caching/PageObjectCacheFunction.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Concurrent;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Data;\r\nusing System.Threading;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Caching\r\n{\r\n    internal sealed class PageObjectCacheFunction : DowncastableStandardFunctionBase\r\n    {\r\n        private static readonly XName FunctionXName = Namespaces.Function10 + \"function\";\r\n\r\n        private const string C1Name = \"PageObjectCache\";\r\n        private const string C1Namespace = \"Composite.Utils.Caching\";\r\n\r\n        public static string FunctionName { get; } = $\"{C1Namespace}.{C1Name}\";\r\n\r\n        public PageObjectCacheFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(C1Name, C1Namespace, typeof(object), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        public class ParameterNames\r\n        {\r\n            public static readonly string ObjectToCache = nameof(ObjectToCache);\r\n            public static readonly string ObjectCacheId = nameof(ObjectCacheId);\r\n            public static readonly string SitemapScope = nameof(SitemapScope);\r\n            public static readonly string SecondsToCache = nameof(SecondsToCache);\r\n            public static readonly string LanguageSpecific = nameof(LanguageSpecific);\r\n\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider associationDropDown = StandardWidgetFunctions.DropDownList(\r\n                    this.GetType(), nameof(PageAssociationRestrictions), \"Key\", \"Value\", false, true);\r\n\r\n                var textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    ParameterNames.ObjectToCache, typeof(object), true, new NoValueValueProvider(), null);\r\n                yield return new StandardFunctionParameterProfile(\r\n                    ParameterNames.ObjectCacheId, typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n                yield return new StandardFunctionParameterProfile(\r\n                    ParameterNames.SitemapScope,\r\n                    typeof(SitemapScope),\r\n                    false,\r\n                    new ConstantValueProvider(SitemapScope.Level1),\r\n                    associationDropDown);\r\n                yield return new StandardFunctionParameterProfile(\r\n                    ParameterNames.SecondsToCache, typeof(int), false, new ConstantValueProvider(60), textboxWidget);\r\n                yield return new StandardFunctionParameterProfile(\r\n                    ParameterNames.LanguageSpecific,\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(true),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Language specific content\", \"Share across all languages\"));\r\n            }\r\n        }\r\n\r\n\r\n        readonly ConcurrentDictionary<string, object> _lockCollection = new ConcurrentDictionary<string, object>();\r\n        static bool _potentialKeysLeakLogged = false;\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (DataScopeManager.CurrentDataScope.Name != DataScopeIdentifier.PublicName)\r\n            {\r\n                return parameters.GetParameter<object>(ParameterNames.ObjectToCache);\r\n            }\r\n\r\n            var cache = HttpRuntime.Cache;\r\n            string cacheKey = BuildCacheKey(parameters);\r\n\r\n            object result = cache.Get(cacheKey);\r\n            if (result == null)\r\n            {\r\n                var lockObject = _lockCollection.GetOrAdd(cacheKey, key => new object());\r\n\r\n                lock (lockObject)\r\n                {\r\n                    if(_lockCollection.Count > 50000 && !_potentialKeysLeakLogged)\r\n                    {\r\n                        _potentialKeysLeakLogged = true;\r\n                        Log.LogWarning(nameof(PageObjectCacheFunction), \"Potential memory leak in the locks collection\");\r\n                    }\r\n\r\n                    result = cache.Get(cacheKey);\r\n                    if (result == null)\r\n                    {\r\n                        result = parameters.GetParameter<object>(ParameterNames.ObjectToCache);\r\n\r\n                        if (result != null)\r\n                        {\r\n                            result = EvaluateLazyResult(result, context);\r\n\r\n                            int secondsToCache = parameters.GetParameter<int>(ParameterNames.SecondsToCache);\r\n\r\n                            cache.Add(\r\n                                cacheKey, \r\n                                result, \r\n                                null, \r\n                                DateTime.Now.AddSeconds(secondsToCache),\r\n                                TimeSpan.Zero, \r\n                                System.Web.Caching.CacheItemPriority.Default, \r\n                                null);\r\n                        }\r\n                    }\r\n                } \r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static object EvaluateLazyResult(object result, FunctionContextContainer context)\r\n        {\r\n            if (result is XDocument document)\r\n            {\r\n                PageRenderer.ExecuteEmbeddedFunctions(document.Root, context);\r\n                return result;\r\n            }\r\n\r\n            if (result is IEnumerable<XNode> xNodes)\r\n            {\r\n                return EvaluateLazyResult(xNodes, context);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static object EvaluateLazyResult(IEnumerable<XNode> xNodes, FunctionContextContainer context)\r\n        {\r\n            var resultList = new List<object>();\r\n\r\n            // Attaching the result to be cached to an XElement, so the cached XObject-s will not be later attached to \r\n            // an XDocument and causing a bigger memory leak.\r\n            var tempParent = new XElement(\"t\");\r\n\r\n            foreach (var node in xNodes.Evaluate())\r\n            {\r\n                node.Remove();\r\n\r\n                if (node is XElement element)\r\n                {\r\n                    if (element.Name == FunctionXName)\r\n                    {\r\n                        var functionTreeNode = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(element);\r\n\r\n                        var functionCallResult = functionTreeNode.GetValue(context);\r\n                        if (functionCallResult != null)\r\n                        {\r\n                            if (functionCallResult is XDocument document)\r\n                            {\r\n                                functionCallResult = document.Root;\r\n                            }\r\n\r\n                            resultList.Add(functionCallResult);\r\n\r\n                            if (functionCallResult is XObject || functionCallResult is IEnumerable<XObject>)\r\n                            {\r\n                                tempParent.Add(functionCallResult);\r\n                            }\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        PageRenderer.ExecuteEmbeddedFunctions(element, context);\r\n                        resultList.Add(element);\r\n                        tempParent.Add(element);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    resultList.Add(node);\r\n                    tempParent.Add(node);\r\n                }\r\n            }\r\n\r\n            return resultList.ToArray();\r\n        }\r\n\r\n        private static string BuildCacheKey(ParameterList parameters)\r\n        {\r\n            string cacheKey = parameters.GetParameter<string>(ParameterNames.ObjectCacheId);\r\n\r\n            bool languageSpecific = parameters.GetParameter<bool>(ParameterNames.LanguageSpecific);\r\n            if (languageSpecific)\r\n            {\r\n                cacheKey = $\"{cacheKey}:{Thread.CurrentThread.CurrentCulture}\";\r\n            }\r\n\r\n            SitemapScope SitemapScope = parameters.GetParameter<SitemapScope>(ParameterNames.SitemapScope);\r\n            if (SitemapScope != SitemapScope.All)\r\n            {\r\n                Guid associatedPageId = PageStructureInfo.GetAssociatedPageIds(PageRenderer.CurrentPageId, SitemapScope).FirstOrDefault();\r\n                associatedPageId = (associatedPageId == Guid.Empty ? PageRenderer.CurrentPageId : associatedPageId);\r\n                cacheKey = $\"{cacheKey}:{associatedPageId}\";\r\n            }\r\n            return cacheKey;\r\n        }\r\n\r\n        public static IEnumerable<KeyValuePair<SitemapScope, string>> PageAssociationRestrictions()\r\n        {\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Current, \"Current page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.All, \"All pages (use everywhere)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Parent, \"Parent page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level1, \"Level 1 page (this website)\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level2, \"Level 2 page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level3, \"Level 3 page\");\r\n            yield return new KeyValuePair<SitemapScope, string>(SitemapScope.Level4, \"Level 4 page\");\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Compare/AreEqualFunction.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Compare\r\n{\r\n\tinternal sealed class AreEqualFunction : StandardFunctionBase\r\n\t{\r\n        public AreEqualFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"AreEqual\", \"Composite.Utils.Compare\", typeof(bool), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            object valueA = parameters.GetParameter<object>(\"ValueA\");\r\n            object valueB = parameters.GetParameter<object>(\"ValueB\");\r\n\r\n            return valueA.Equals(valueB);\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get \r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ValueA\", typeof(object), true, new NoValueValueProvider(), null);\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ValueB\", typeof(object), true, new NoValueValueProvider(), null);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Compare/IsLessThanFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Compare\r\n{\r\n\tinternal sealed class IsLessThanFunction : StandardFunctionBase\r\n\t{\r\n        public IsLessThanFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"IsLessThan\", \"Composite.Utils.Compare\", typeof(bool), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            IComparable valueA = parameters.GetParameter<IComparable>(\"ValueA\");\r\n            IComparable valueB = parameters.GetParameter<IComparable>(\"ValueB\");\r\n\r\n            return valueA.CompareTo(valueB);\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ValueA\", typeof(object), true, new NoValueValueProvider(), null);\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ValueB\", typeof(object), true, new NoValueValueProvider(), null);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Configuration/AppSettingsValueFunction.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Configuration;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Configuration\r\n{\r\n    internal sealed class AppSettingsValueFunction : StandardFunctionBase\r\n    {\r\n        public AppSettingsValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"AppSettingsValue\", \"Composite.Utils.Configuration\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationManagerClass:DoNotUseConfigurationManagerClass\", Justification = \"This works for now, but might have to be fixed\")]\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string keyName = parameters.GetParameter<string>(\"KeyName\");\r\n\r\n            return ConfigurationManager.AppSettings[keyName];\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"KeyName\", typeof(string), true, new NoValueValueProvider(), StandardWidgetFunctions.TextBoxWidget);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Date/AddDaysFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Date\r\n{\r\n    internal sealed class AddDaysFunction : StandardFunctionBase\r\n    {\r\n        public AddDaysFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"AddDays\", \"Composite.Utils.Date\", typeof(DateTime), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"DaysToAdd\", typeof(double), true, new ConstantValueProvider((double)0), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            double daysToAdd = parameters.GetParameter<double>(\"DaysToAdd\");\r\n            return DateTime.Now.AddDays(daysToAdd); ;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Date/NowFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Date\r\n{\r\n    internal sealed class NowFunction : StandardFunctionBase\r\n    {\r\n        public NowFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Now\", \"Composite.Utils.Date\", typeof(DateTime), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return DateTime.Now;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Dictionary/EnumerableToDictionary.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing System.Collections;\r\nusing Composite.Functions;\r\nusing System.Reflection;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Dictionary\r\n{\r\n    internal class EnumerableToDictionary : StandardFunctionBase\r\n    {\r\n        public EnumerableToDictionary(EntityTokenFactory entityTokenFactory)\r\n            : base(\"EnumerableToDictionary\", \"Composite.Utils.Dictionary\", typeof(IDictionary), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            IEnumerable elements = parameters.GetParameter<IEnumerable>(\"Elements\");\r\n            string keyPropertyName = parameters.GetParameter<string>(\"KeyPropertyName\");\r\n            string valuePropertyName = parameters.GetParameter<string>(\"ValuePropertyName\");\r\n\r\n            Dictionary<string, string> resultDictionary = new Dictionary<string, string>();\r\n\r\n            PropertyInfo keyPropertyInfo = null;\r\n            PropertyInfo valuePropertyInfo = null;\r\n            foreach (object element in elements)\r\n            {\r\n                if (keyPropertyInfo == null)\r\n                {\r\n                    keyPropertyInfo = element.GetType().GetProperty(keyPropertyName);\r\n                }\r\n\r\n                if (valuePropertyInfo == null)\r\n                {\r\n                    valuePropertyInfo = element.GetType().GetProperty(valuePropertyName);\r\n                }\r\n\r\n                string keyValue = keyPropertyInfo.GetValue(element, null).ToString();\r\n                string valueValue = valuePropertyInfo.GetValue(element, null).ToString();\r\n\r\n                resultDictionary.Add(keyValue, valueValue);\r\n            }\r\n\r\n            return resultDictionary;\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Elements\", typeof(IEnumerable), true, new NoValueValueProvider(), null);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"KeyPropertyName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ValuePropertyName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Dictionary/XElementsToDictionaryFunction.cs",
    "content": "﻿using System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Dictionary\r\n{\r\n    internal class XElementsToDictionaryFunction : StandardFunctionBase\r\n    {\r\n        public XElementsToDictionaryFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"XElementsToDictionary\", \"Composite.Utils.Dictionary\", typeof(IDictionary), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            IEnumerable<XElement> elements = parameters.GetParameter<IEnumerable<XElement>>(\"XElements\");\r\n            string keyAttributeName = parameters.GetParameter<string>(\"KeyAttributeName\");\r\n            string valueAttributeName = parameters.GetParameter<string>(\"ValueAttributeName\");\r\n\r\n            Dictionary<string, string> resultDictionary = new Dictionary<string, string>();\r\n            foreach (XElement element in elements)\r\n            {\r\n                XAttribute keyAttribute = element.Attribute(keyAttributeName);\r\n                XAttribute valueAttribute = element.Attribute(valueAttributeName);\r\n\r\n                string keyValue = keyAttribute != null ? keyAttribute.Value : null;\r\n                string valueValue = valueAttribute != null ? valueAttribute.Value : null;\r\n\r\n                resultDictionary.Add(keyValue, valueValue);\r\n\r\n            }\r\n\r\n            return resultDictionary;\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                \r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"XElements\", typeof(IEnumerable<XElement>), true, new NoValueValueProvider(), null);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"KeyAttributeName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ValueAttributeName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/GetInputParameterFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils\r\n{\r\n    internal sealed class GetInputParameterFunction : DowncastableStandardFunctionBase\r\n    {\r\n        public GetInputParameterFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"GetInputParameter\", \"Composite.Utils\", typeof(object), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"InputParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string parameterName = parameters.GetParameter<string>(\"InputParameterName\");\r\n            return context.GetParameterValue(parameterName, typeof(object));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Globalization/AllCultures.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing System.Globalization;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Globalization\r\n{\r\n    internal sealed class AllCultures : StandardFunctionBase\r\n    {\r\n        public AllCultures(EntityTokenFactory entityTokenFactory)\r\n            : base(\"AllCultures\", \"Composite.Utils.Globalization\", typeof(IEnumerable<CultureInfo>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return GetCultures();\r\n        }\r\n\r\n\r\n        private IEnumerable<CultureInfo> GetCultures()\r\n        {\r\n            foreach (CultureInfo info in CultureInfo.GetCultures(CultureTypes.SpecificCultures).OrderBy( f=>f.DisplayName))\r\n            {\r\n                yield return info;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Globalization/CurrentCulture.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing System.Globalization;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Globalization\r\n{\r\n    internal sealed class CurrentCulture : StandardFunctionBase\r\n    {\r\n        public CurrentCulture(EntityTokenFactory entityTokenFactory)\r\n            : base(\"CurrentCulture\", \"Composite.Utils.Globalization\", typeof(CultureInfo), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return System.Threading.Thread.CurrentThread.CurrentCulture;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Guid/NewGuid.cs",
    "content": "﻿using Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.GuidFunctions\r\n{\r\n    internal sealed class NewGuid : StandardFunctionBase\r\n    {\r\n        public NewGuid(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NewGuid\", \"Composite.Utils.Guid\", typeof(System.Guid), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return System.Guid.NewGuid();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Integer/IntSum.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Integer\r\n{\r\n    internal sealed class Sum : StandardFunctionBase\r\n\t{\r\n        public Sum(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Sum\", \"Composite.Utils.Integer\", typeof(int), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            IEnumerable<int> ints = parameters.GetParameter<IEnumerable<int>>(\"Ints\");\r\n\r\n            return ints.Sum();\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get \r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Ints\", \r\n                    typeof(IEnumerable<int>), \r\n                    true, \r\n                    new NoValueValueProvider(),\r\n                    null);\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/ParseStringToObject.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils\r\n{\r\n    internal sealed class ParseStringToObjectFunction : DowncastableStandardFunctionBase\r\n    {\r\n        public ParseStringToObjectFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"ParseStringToObject\", \"Composite.Utils\", typeof(object), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"StringToParse\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string stringToParse = parameters.GetParameter<string>(\"StringToParse\");\r\n            return stringToParse;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/BoolEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class BoolEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public BoolEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"BoolEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<bool, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.GetBoolSelectorWidget(\"True\", \"False\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(bool), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            bool value = parameters.GetParameter<bool>(\"Value\");\r\n            Expression<Func<bool, bool>> predicate = f => f == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/DateTimeEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class DateTimeEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public DateTimeEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DateTimeEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<DateTime, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(DateTime), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            DateTime value = parameters.GetParameter<DateTime>(\"Value\");\r\n            Expression<Func<DateTime,bool>> predicate = f=>f == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/DateTimeGreaterThanPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class DateTimeGreaterThanPredicateFunction : StandardFunctionBase\r\n    {\r\n        public DateTimeGreaterThanPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DateTimeGreaterThan\", \"Composite.Utils.Predicates\", typeof(Expression<Func<DateTime, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(DateTime), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            DateTime value = parameters.GetParameter<DateTime>(\"Value\");\r\n            Expression<Func<DateTime,bool>> predicate = f=>f > value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/DateTimeLessThanPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class DateTimeLessThanPredicateFunction : StandardFunctionBase\r\n    {\r\n        public DateTimeLessThanPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DateTimeLessThan\", \"Composite.Utils.Predicates\", typeof(Expression<Func<DateTime, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(DateTime), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            DateTime value = parameters.GetParameter<DateTime>(\"Value\");\r\n            Expression<Func<DateTime,bool>> predicate = f=>f < value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/DecimalEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class DecimalEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public DecimalEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DecimalEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<decimal, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DecimalTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(decimal), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            decimal value = parameters.GetParameter<decimal>(\"Value\");\r\n            Expression<Func<decimal,bool>> predicate = f=>f == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/DecimalGreaterThanPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class DecimalGreaterThanPredicateFunction : StandardFunctionBase\r\n    {\r\n        public DecimalGreaterThanPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DecimalGreaterThan\", \"Composite.Utils.Predicates\", typeof(Expression<Func<decimal, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DecimalTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(decimal), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            decimal value = parameters.GetParameter<decimal>(\"Value\");\r\n            Expression<Func<decimal,bool>> predicate = f=>f > value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/DecimalLessThanPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class DecimalLessThanPredicateFunction : StandardFunctionBase\r\n    {\r\n        public DecimalLessThanPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DecimalLessThan\", \"Composite.Utils.Predicates\", typeof(Expression<Func<decimal, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DecimalTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(decimal), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            decimal value = parameters.GetParameter<decimal>(\"Value\");\r\n            Expression<Func<decimal, bool>> predicate = f => f < value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/GuidEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class GuidEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public GuidEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"GuidEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<Guid, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(Guid), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Guid value = parameters.GetParameter<Guid>(\"Value\");\r\n\r\n            // Expression<Func<Guid, bool>> predicate = f => f == value;\r\n            // DDZ: in order to get a correct debug information, not using labmda syntax while building an expression\r\n\r\n            ParameterExpression parameter = Expression.Parameter(typeof(Guid), \"f\");\r\n            return Expression.Lambda<Func<Guid, bool>>(Expression.Equal(parameter, Expression.Constant(value)), parameter);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/GuidInCommaSeparatedListPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class GuidInCommaSeparatedListPredicateFunction : StandardFunctionBase\r\n    {\r\n        public GuidInCommaSeparatedListPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"GuidInCommaSeparatedList\", \"Composite.Utils.Predicates\", typeof(Expression<Func<Guid, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"CommaSeparatedGuids\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string commaSeparatedSearchTerms = parameters.GetParameter<string>(\"CommaSeparatedGuids\");\r\n\r\n            if (!commaSeparatedSearchTerms.IsNullOrEmpty())\r\n            {\r\n                ParameterExpression parameter = Expression.Parameter(typeof(Guid), \"g\");\r\n\r\n                IEnumerable<string> guidStrings = commaSeparatedSearchTerms.Split(',');\r\n\r\n                Expression body = null;\r\n\r\n                foreach (string guidString in guidStrings)\r\n                {\r\n                    Guid temp = new Guid(guidString.Trim());\r\n\r\n                    Expression part = Expression.Equal(parameter, Expression.Constant(temp));\r\n\r\n                    body = body.NestedOr(part);\r\n                }\r\n\r\n                if(body != null)\r\n                {\r\n                    return Expression.Lambda<Func<Guid, bool>>(body, parameter);\r\n                }\r\n            }\r\n\r\n            return (Expression<Func<Guid, bool>>) (f => false);\r\n            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/IntegerEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class IntegerEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public IntegerEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"IntegerEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<int, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(int), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            int value = parameters.GetParameter<int>(\"Value\");\r\n            Expression<Func<int,bool>> predicate = f=>f == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/IntegerGreaterThanPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class IntegerGreaterThanPredicateFunction : StandardFunctionBase\r\n    {\r\n        public IntegerGreaterThanPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"IntegerGreaterThan\", \"Composite.Utils.Predicates\", typeof(Expression<Func<int, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(int), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            int value = parameters.GetParameter<int>(\"Value\");\r\n            Expression<Func<int,bool>> predicate = f=>f > value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/IntegerLessThanPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class IntegerLessThanPredicateFunction : StandardFunctionBase\r\n    {\r\n        public IntegerLessThanPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"IntegerLessThan\", \"Composite.Utils.Predicates\", typeof(Expression<Func<int, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(int), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            int value = parameters.GetParameter<int>(\"Value\");\r\n            Expression<Func<int,bool>> predicate = f=>f < value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableBoolEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableBoolEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableBoolEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableBoolEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<bool?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.GetBoolSelectorWidget(\"True\", \"False\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(bool), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            bool value = parameters.GetParameter<bool>(\"Value\");\r\n            Expression<Func<bool?, bool>> predicate = f => f.HasValue && f.Value == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableBoolNoValuePredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableBoolNoValuePredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableBoolNoValuePredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableBoolNoValue\", \"Composite.Utils.Predicates\", typeof(Expression<Func<bool?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<bool?, bool>> predicate = f => f.HasValue == false;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableDateTimeEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableDateTimeEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableDateTimeEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableDateTimeEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<DateTime?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(DateTime), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            DateTime value = parameters.GetParameter<DateTime>(\"Value\");\r\n            Expression<Func<DateTime?, bool>> predicate = f => f.HasValue && f.Value == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableDateTimeGreaterThanPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableDateTimeGreaterThanPredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableDateTimeGreaterThanPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableDateTimeGreaterThan\", \"Composite.Utils.Predicates\", typeof(Expression<Func<DateTime?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(DateTime), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            DateTime value = parameters.GetParameter<DateTime>(\"Value\");\r\n            Expression<Func<DateTime?, bool>> predicate = f => f.HasValue && f.Value > value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableDateTimeLessThanPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableDateTimeLessThanPredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableDateTimeLessThanPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableDateTimeLessThan\", \"Composite.Utils.Predicates\", typeof(Expression<Func<DateTime?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(DateTime), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            DateTime value = parameters.GetParameter<DateTime>(\"Value\");\r\n            Expression<Func<DateTime?, bool>> predicate = f => f.HasValue && f.Value < value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableDateTimeNoValuePredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableDateTimeNoValuePredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableDateTimeNoValuePredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableDateTimeNoValue\", \"Composite.Utils.Predicates\", typeof(Expression<Func<DateTime?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<DateTime?, bool>> predicate = f => f.HasValue == false;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableDecimalEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableDecimalEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableDecimalEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableDecimalEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<decimal?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.DecimalTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(decimal), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            decimal value = parameters.GetParameter<decimal>(\"Value\");\r\n            Expression<Func<decimal?, bool>> predicate = f => f.HasValue && f.Value == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableDecimalNoValuePredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableDecimalNoValuePredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableDecimalNoValuePredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableDecimalNoValue\", \"Composite.Utils.Predicates\", typeof(Expression<Func<decimal?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<decimal?, bool>> predicate = f => f.HasValue == false;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableGuidEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableGuidEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableGuidEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableGuidEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<Guid?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(Guid), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Guid? value = parameters.GetParameter<Guid?>(\"Value\");\r\n\r\n            // Expression<Func<Guid?, bool>> predicate = f => f == value;\r\n\r\n            var f = Expression.Parameter(typeof(Guid?), \"f\");\r\n            var body = Expression.Equal(f, Expression.Constant(value, typeof (Guid?)));\r\n\r\n            return Expression.Lambda(body, f);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableGuidNoValuePredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableGuidNoValuePredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableGuidNoValuePredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableGuidNoValue\", \"Composite.Utils.Predicates\", typeof(Expression<Func<Guid?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<Guid?, bool>> predicate = f => f.HasValue == false;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableIntegerEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableIntegerEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableIntegerEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableIntegerEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<int?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider widget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(int), true, new NoValueValueProvider(), widget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            int value = parameters.GetParameter<int>(\"Value\");\r\n            Expression<Func<int?, bool>> predicate = f => f.HasValue && f.Value == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/NullableIntegerNoValuePredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class NullableIntegerNoValuePredicateFunction : StandardFunctionBase\r\n    {\r\n        public NullableIntegerNoValuePredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"NullableIntegerNoValue\", \"Composite.Utils.Predicates\", typeof(Expression<Func<int?, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<int?, bool>> predicate = f => f.HasValue == false;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/StringContainsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class StringContainsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public StringContainsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"StringContains\", \"Composite.Utils.Predicates\", typeof(Expression<Func<string, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string valueToFind = parameters.GetParameter<string>(\"Value\");\r\n            Expression<Func<string,bool>> predicate = f=>f.Contains(valueToFind);\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/StringEndsWithPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class StringEndsWithPredicateFunction : StandardFunctionBase\r\n    {\r\n        public StringEndsWithPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"StringEndsWith\", \"Composite.Utils.Predicates\", typeof(Expression<Func<string, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                                    \"Value\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string valueToFind = parameters.GetParameter<string>(\"Value\");\r\n            Expression<Func<string,bool>> predicate = f=>f.EndsWith(valueToFind);\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/StringEqualsPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class StringEqualsPredicateFunction : StandardFunctionBase\r\n    {\r\n        public StringEqualsPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"StringEquals\", \"Composite.Utils.Predicates\", typeof(Expression<Func<string, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string value = parameters.GetParameter<string>(\"Value\");\r\n            Expression<Func<string, bool>> predicate = f => f == value;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/StringInCommaSeparatedListPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.Extensions;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class StringInCommaSeparatedListPredicateFunction : StandardFunctionBase\r\n    {\r\n        private static readonly MethodInfo _stringCompareMethodInfo;\r\n\r\n        static StringInCommaSeparatedListPredicateFunction()\r\n        {\r\n            _stringCompareMethodInfo = typeof(string).GetMethod(\"Compare\", new[] { typeof(string), typeof(string), typeof(StringComparison) });\r\n        }\r\n\r\n        public StringInCommaSeparatedListPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"StringInCommaSeparatedList\", \"Composite.Utils.Predicates\", typeof(Expression<Func<string, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"CommaSeparatedSearchTerms\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"IgnoreCase\", typeof(bool), false, new ConstantValueProvider(true), StandardWidgetFunctions.GetBoolSelectorWidget(\"Ignore case\", \"Match case\"));\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<string, bool>> emptyPredicate = f => false;\r\n\r\n            string commaSeparatedSearchTerms = parameters.GetParameter<string>(\"CommaSeparatedSearchTerms\");\r\n\r\n            if (commaSeparatedSearchTerms.IsNullOrEmpty())\r\n            {\r\n                return emptyPredicate;\r\n            }\r\n\r\n\r\n            bool ignoreCase = parameters.GetParameter<bool>(\"IgnoreCase\");\r\n            string[] searchTerms = commaSeparatedSearchTerms.Split(new [] {','}/*, StringSplitOptions.RemoveEmptyEntries*/);\r\n\r\n            if (searchTerms.Length == 0)\r\n            {\r\n                return emptyPredicate;\r\n            }\r\n\r\n            StringComparison stringComparison = (ignoreCase\r\n                                                     ? StringComparison.InvariantCultureIgnoreCase\r\n                                                     : StringComparison.InvariantCulture);\r\n\r\n\r\n            var parameterExpression = Expression.Parameter(typeof(string), \"p\");\r\n            Expression body = null;\r\n\r\n            foreach (string searchTerm in searchTerms)\r\n            {\r\n                string termTrimmed = searchTerm.Trim();\r\n\r\n                // string.Compare(p, termTrimmed, stringComparison) == 0 \r\n                // string.Compare() is supported by linq2sql\r\n                Expression condition = Expression.Equal(Expression.Call(\r\n                                                           _stringCompareMethodInfo,\r\n                                                           parameterExpression,\r\n                                                           Expression.Constant(termTrimmed),\r\n                                                           Expression.Constant(stringComparison)), \r\n                                                       Expression.Constant(0));\r\n\r\n                body = body == null ? condition : Expression.Or(body, condition);\r\n            }\r\n            Verify.IsNotNull(body, \"Expression body is null\");\r\n\r\n            return Expression.Lambda<Func<string, bool>>(body, parameterExpression);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/StringInListPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.Extensions;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class StringInListPredicateFunction : StandardFunctionBase\r\n    {\r\n        public StringInListPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"StringInList\", \"Composite.Utils.Predicates\", typeof(Expression<Func<string, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"SearchTerms\", typeof(IEnumerable<string>), true, new NoValueValueProvider(), null);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"IgnoreCase\", typeof(bool), false, new ConstantValueProvider(true), StandardWidgetFunctions.GetBoolSelectorWidget(\"Ignore case\", \"Match case\"));\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            IEnumerable<string> searchTerms = parameters.GetParameter<IEnumerable<string>>(\"SearchTerms\");\r\n            bool ignoreCase = parameters.GetParameter<bool>(\"IgnoreCase\");\r\n\r\n            StringComparison stringComparison = (ignoreCase\r\n                                                     ? StringComparison.CurrentCultureIgnoreCase\r\n                                                     : StringComparison.CurrentCulture);\r\n\r\n            Expression<Func<string, bool>> predicate = f => false;\r\n\r\n            foreach (string searchTerm in searchTerms)\r\n            {\r\n                string temp = searchTerm.Trim();\r\n                predicate = predicate.Or(c => c.Equals(temp, stringComparison));\r\n            }\r\n\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/StringNoValuePredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq.Expressions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class StringNoValuePredicateFunction : StandardFunctionBase\r\n    {\r\n        public StringNoValuePredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"StringNoValue\", \"Composite.Utils.Predicates\", typeof(Expression<Func<string, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            Expression<Func<string, bool>> predicate = f => f == null;\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Predicates/StringStartsWithPredicateFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\n\r\nusing Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Linq.Expressions;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Predicates\r\n{\r\n    internal sealed class StringStartsWithPredicateFunction : StandardFunctionBase\r\n    {\r\n        public StringStartsWithPredicateFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"StringStartsWith\", \"Composite.Utils.Predicates\", typeof(Expression<Func<string, bool>>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string valueToFind = parameters.GetParameter<string>(\"Value\");\r\n            Expression<Func<string, bool>> predicate = f => f.StartsWith(valueToFind);\r\n            return predicate;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/String/Format.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.String\r\n{\r\n    internal sealed class Format : StandardFunctionBase, ICompoundFunction\r\n    {\r\n        public Format(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Format\", \"Composite.Utils.String\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string format = parameters.GetParameter<string>(\"Format\");\r\n\r\n            var formatParameters = new object[5];\r\n\r\n            formatParameters[0] = parameters.GetParameter<string>(\"Parameter1\");\r\n\r\n            Verify.IsNotNull(formatParameters[0], \"Parameter1 is null\");\r\n\r\n            formatParameters[1] = parameters.GetParameter<string>(\"Parameter2\");\r\n            formatParameters[2] = parameters.GetParameter<string>(\"Parameter3\");\r\n            formatParameters[3] = parameters.GetParameter<string>(\"Parameter4\");\r\n            formatParameters[4] = parameters.GetParameter<string>(\"Parameter5\");\r\n\r\n            return string.Format(format, formatParameters);\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FormatString\", typeof(IEnumerable<string>), true, new NoValueValueProvider(), null);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Parameter1\", typeof(string), true, new ConstantValueProvider(null), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Parameter2\", typeof(string), false, new ConstantValueProvider(null), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Parameter3\", typeof(string), false, new ConstantValueProvider(null), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Parameter4\", typeof(string), false, new ConstantValueProvider(null), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Parameter5\", typeof(string), false, new ConstantValueProvider(null), textboxWidget);\r\n            }\r\n        }\r\n    \r\n        public bool  AllowRecursiveCall\r\n        {\r\n\t        get { return true; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/String/Join.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Linq;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.String\r\n{\r\n    internal sealed class Join : StandardFunctionBase\r\n\t{\r\n        public Join(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Join\", \"Composite.Utils.String\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            IEnumerable<string> strings = parameters.GetParameter<IEnumerable<string>>(\"Strings\");\r\n            string separator = parameters.GetParameter<string>(\"Separator\");\r\n\r\n            return string.Join(separator, strings.ToArray());\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get \r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Strings\", typeof(IEnumerable<string>), true, new NoValueValueProvider(),null);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Separator\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/String/JoinTwo.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.String\r\n{\r\n    internal sealed class JoinTwo : StandardFunctionBase, ICompoundFunction\r\n    {\r\n        public JoinTwo(EntityTokenFactory entityTokenFactory)\r\n            : base(\"JoinTwo\", \"Composite.Utils.String\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string stringA = parameters.GetParameter<string>(\"StringA\");\r\n            string stringB = parameters.GetParameter<string>(\"StringB\");\r\n            string separator = parameters.GetParameter<string>(\"Separator\");\r\n\r\n            return stringA + separator + stringB;\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"StringA\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"StringB\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Separator\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n        public bool AllowRecursiveCall\r\n        {\r\n            get { return true; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/String/Split.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.String\r\n{\r\n    internal sealed class Split : StandardFunctionBase\r\n    {\r\n        public Split(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Split\", \"Composite.Utils.String\", typeof(IEnumerable<string>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string stringToSplit = parameters.GetParameter<string>(\"String\");\r\n            string[] separator = new string[] { parameters.GetParameter<string>(\"Separator\") };\r\n\r\n\r\n\r\n            var resultArray = stringToSplit.Split(separator, StringSplitOptions.RemoveEmptyEntries);\r\n\r\n            return new List<string>(resultArray);\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"String\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Separator\", typeof(string), false, new ConstantValueProvider(\",\"), textboxWidget);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Validation/DecimalPrecisionValidationFunction.cs",
    "content": "﻿using System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Validation\r\n{\r\n    internal sealed class DecimalPrecisionValidationFunction : StandardFunctionBase\r\n\t{\r\n        public DecimalPrecisionValidationFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DecimalPrecisionValidation\", \"Composite.Utils.Validation\", typeof(PropertyValidatorBuilder<decimal>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"MaxDigits\", typeof(int), true, new NoValueValueProvider(), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DecimalPrecisionValidatorAttribute)));\r\n\r\n            int maxDigits = parameters.GetParameter<int>(\"MaxDigits\");\r\n\r\n            codeAttributeDeclaration.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(maxDigits)));\r\n\r\n            return new ConstructorBasedPropertyValidatorBuilder<decimal>(codeAttributeDeclaration, new DecimalPrecisionValidatorAttribute(28, maxDigits));\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Validation/IntegerRangeValidationFunction.cs",
    "content": "﻿using System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Validation\r\n{\r\n    internal sealed class IntegerRangeValidationFunction : StandardFunctionBase\r\n\t{\r\n        public IntegerRangeValidationFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"IntegerRangeValidation\", \"Composite.Utils.Validation\", typeof(PropertyValidatorBuilder<int>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"min\", typeof(int), true, new NoValueValueProvider(), StandardWidgetFunctions.IntegerTextBoxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"max\", typeof(int), true, new NoValueValueProvider(), StandardWidgetFunctions.IntegerTextBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(IntegerRangeValidatorAttribute)));\r\n\r\n            int min = parameters.GetParameter<int>(\"min\");\r\n            int max = parameters.GetParameter<int>(\"max\");\r\n\r\n            codeAttributeDeclaration.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(min)));\r\n            codeAttributeDeclaration.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(max)));\r\n\r\n            return new ConstructorBasedPropertyValidatorBuilder<int>(codeAttributeDeclaration, new IntegerRangeValidatorAttribute(min, max));\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Validation/NotNullValidationFunction.cs",
    "content": "using System.CodeDom;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Data.Validation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Validation\r\n{\r\n    internal sealed class NotNullValidationFunction<T> : StandardFunctionBase\r\n    {\r\n        public NotNullValidationFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(typeof(T).Name + \"NotNullValidation\", \"Composite.Utils.Validation\", typeof(PropertyValidatorBuilder<T>), entityTokenFactory)\r\n        {          \r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(Microsoft.Practices.EnterpriseLibrary.Validation.Validators.NotNullValidatorAttribute)));\r\n\r\n            return new ConstructorBasedPropertyValidatorBuilder<string>(codeAttributeDeclaration, new Microsoft.Practices.EnterpriseLibrary.Validation.Validators.NotNullValidatorAttribute());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Validation/PasswordValidationFunction.cs",
    "content": "using System.CodeDom;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Validation\r\n{\r\n    internal sealed class PasswordValidationValidationFunction : StandardFunctionBase\r\n\t{\r\n        public PasswordValidationValidationFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"PasswordValidation\", \"Composite.Utils.Validation\", typeof(PropertyValidatorBuilder<string>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(StringSizeValidatorAttribute)));\r\n\r\n            return new ConstructorBasedPropertyValidatorBuilder<string>(codeAttributeDeclaration, new PasswordValidatorAttribute());\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Validation/RegexValidationFunction.cs",
    "content": "using System.CodeDom;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Validation\r\n{\r\n    internal sealed class RegexValidationFunction : StandardFunctionBase\r\n    {\r\n        public RegexValidationFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"RegularExpressionValidation\", \"Composite.Utils.Validation\", typeof(PropertyValidatorBuilder<string>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"pattern\", typeof(string), true, new NoValueValueProvider(), StandardWidgetFunctions.TextBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(RegexValidatorAttribute)));\r\n            \r\n            string pattern = parameters.GetParameter<string>(\"pattern\");\r\n\r\n            codeAttributeDeclaration.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(pattern)));\r\n\r\n            return new ConstructorBasedPropertyValidatorBuilder<string>(codeAttributeDeclaration, new RegexValidatorAttribute(pattern));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Utils/Validation/StringLengthValidationFunction.cs",
    "content": "using Composite.Functions;\r\nusing System.Collections.Generic;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing System.CodeDom;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.Validators;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Utils.Validation\r\n{\r\n    internal sealed class StringLengthValidationFunction : StandardFunctionBase\r\n\t{\r\n        public StringLengthValidationFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"StringLengthValidation\", \"Composite.Utils.Validation\", typeof(PropertyValidatorBuilder<string>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"min\", typeof(int), true, new NoValueValueProvider(), StandardWidgetFunctions.IntegerTextBoxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"max\", typeof(int), true, new NoValueValueProvider(), StandardWidgetFunctions.IntegerTextBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var codeAttributeDeclaration = new CodeAttributeDeclaration(new CodeTypeReference(typeof(StringSizeValidatorAttribute)));\r\n\r\n            int min = parameters.GetParameter<int>(\"min\");\r\n            int max = parameters.GetParameter<int>(\"max\");\r\n\r\n            codeAttributeDeclaration.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(min)));\r\n            codeAttributeDeclaration.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(max)));\r\n\r\n            return new ConstructorBasedPropertyValidatorBuilder<string>(codeAttributeDeclaration, new StringSizeValidatorAttribute(min, max));\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Client/BrowserPlatformFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Client\r\n{\r\n\tinternal sealed class BrowserPlatformFunction  :  StandardFunctionBase\r\n\t{\r\n        public BrowserPlatformFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"BrowserPlatform\", \"Composite.Web.Client\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                return HttpContext.Current.Request.Browser.Platform;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Client/BrowserStringFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Functions;\r\nusing System.Web;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Client\r\n{\r\n    internal sealed class BrowserStringFunction :  StandardFunctionBase\r\n\t{\r\n        public BrowserStringFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"BrowserString\", \"Composite.Web.Client\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                return HttpContext.Current.Request.Browser.Browser;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Client/BrowserTypeFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Client\r\n{\r\n    internal sealed class BrowserTypeFunction :  StandardFunctionBase\r\n\t{\r\n        public BrowserTypeFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"BrowserType\", \"Composite.Web.Client\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                return HttpContext.Current.Request.Browser.Type;\r\n            }\r\n\r\n            return null;\r\n        }\r\n    \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Client/BrowserVersionFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Client\r\n{\r\n\tinternal sealed class BrowserVersionFunction  :  StandardFunctionBase\r\n\t{\r\n        public BrowserVersionFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"BrowserVersion\", \"Composite.Web.Client\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                return HttpContext.Current.Request.Browser.Version;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Client/EcmaScriptVersionFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Client\r\n{\r\n\tinternal sealed class EcmaScriptVersionFunction  :  StandardFunctionBase\r\n\t{\r\n        public EcmaScriptVersionFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"EcmaScriptVersion\", \"Composite.Web.Client\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                return HttpContext.Current.Request.Browser.EcmaScriptVersion;\r\n            }\r\n\r\n            return null;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Client/IsCrawlerFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Client\r\n{\r\n    internal sealed class IsCrawlerFunction :  StandardFunctionBase\r\n\t{\r\n        public IsCrawlerFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"IsCrawler\", \"Composite.Web.Client\", typeof(bool), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                return HttpContext.Current.Request.Browser.Crawler;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Client/IsMobileDeviceFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Client\r\n{\r\n\tinternal sealed class IsMobileDeviceFunction  :  StandardFunctionBase\r\n\t{\r\n        public IsMobileDeviceFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"IsMobileDevice\", \"Composite.Web.Client\", typeof(bool), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                return HttpContext.Current.Request.Browser.IsMobileDevice;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Html/Template/CommonMetaTagsFunction.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Threading;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Html.Template\r\n{\r\n    internal sealed class CommonMetaTagsFunction : StandardFunctionBase\r\n    {\r\n        public CommonMetaTagsFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"CommonMetaTags\", \"Composite.Web.Html.Template\", typeof(IEnumerable<XElement>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider showGeneratorWidget = StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, show C1 CMS Foundation support!\", \"No, please hide this...\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ContentType\",\r\n                    typeof(string),\r\n                    false,\r\n                    new ConstantValueProvider(\"text/html; charset=utf-8\"),\r\n                    StandardWidgetFunctions.TextBoxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Designer\",\r\n                    typeof(string),\r\n                    false,\r\n                    new ConstantValueProvider(\"\"),\r\n                    StandardWidgetFunctions.TextBoxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ShowGenerator\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(true),\r\n                    showGeneratorWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var metaTags = new List<XElement>();\r\n\r\n            string contentType = parameters.GetParameter<string>(\"ContentType\");\r\n            string designer = parameters.GetParameter<string>(\"Designer\");\r\n            bool showGenerator = parameters.GetParameter<bool>(\"ShowGenerator\");\r\n\r\n            if (!string.IsNullOrWhiteSpace(contentType))\r\n            {\r\n                metaTags.Add(new XElement(Namespaces.Xhtml + \"meta\",\r\n                    new XAttribute(\"http-equiv\", \"Content-Type\"),\r\n                    new XAttribute(\"content\", contentType)));\r\n            }\r\n\r\n            if (!string.IsNullOrWhiteSpace(designer))\r\n            {\r\n                metaTags.Add(new XElement(Namespaces.Xhtml + \"meta\",\r\n                    new XAttribute(\"name\", \"Designer\"),\r\n                    new XAttribute(\"content\", designer)));\r\n            }\r\n\r\n            if (showGenerator)\r\n            {\r\n                metaTags.Add(new XElement(Namespaces.Xhtml + \"meta\",\r\n                    new XAttribute(\"name\", \"Generator\"),\r\n                    new XAttribute(\"content\", \"C1 CMS Foundation - Free Open Source from Orckestra and https://github.com/Orckestra/C1-CMS-Foundation\")));\r\n            }\r\n\r\n            return metaTags;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Html/Template/HtmlTitleValueFunction.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Web;\r\nusing System.Web.UI;\r\n\r\nusing Composite.Data;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Html.Template\r\n{\r\n    internal sealed class HtmlTitleValueFunction : StandardFunctionBase\r\n    {\r\n        public HtmlTitleValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"HtmlTitleValue\", \"Composite.Web.Html.Template\", typeof(Control), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextAreaWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\"PrefixToRemove\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n                yield return new StandardFunctionParameterProfile(\"PostfixToRemove\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n        \r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return new TitleControl { \r\n                PrefixToRemove = parameters.GetParameter<string>(\"PrefixToRemove\"), \r\n                PostfixToRemove = parameters.GetParameter<string>(\"PostfixToRemove\") \r\n            };\r\n        }\r\n\r\n        private class TitleControl : Control\r\n        {\r\n            public string PrefixToRemove { get; set; }\r\n            public string PostfixToRemove { get; set; }\r\n\r\n            protected override void Render(HtmlTextWriter writer)\r\n            {\r\n                string pageTitle = this.Page.Title;\r\n\r\n                if (string.IsNullOrWhiteSpace(pageTitle) && SiteMap.CurrentNode != null)\r\n                {\r\n                    pageTitle = SiteMap.CurrentNode.Title;\r\n                }\r\n            \r\n                if (string.IsNullOrWhiteSpace(pageTitle))\r\n                {\r\n                    using (DataConnection connection = new DataConnection())\r\n                    {\r\n                        pageTitle = connection.SitemapNavigator.CurrentPageNode.Title;\r\n                    }\r\n                }\r\n\r\n                pageTitle = pageTitle.Trim();\r\n\r\n                if (!string.IsNullOrEmpty(this.PrefixToRemove) && pageTitle.StartsWith(this.PrefixToRemove))\r\n                {\r\n                    pageTitle = pageTitle.Remove(0, this.PrefixToRemove.Length);\r\n                }\r\n\r\n                if (!string.IsNullOrEmpty(this.PostfixToRemove) && pageTitle.EndsWith(this.PostfixToRemove))\r\n                {\r\n                    pageTitle = pageTitle.Remove(pageTitle.Length - PostfixToRemove.Length);\r\n                }\r\n\r\n                writer.Write(pageTitle);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Html/Template/LangAttributeFunction.cs",
    "content": "﻿using System.Threading;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Html.Template\r\n{\r\n    internal sealed class LangAttributeFunction : StandardFunctionBase\r\n    {\r\n        public LangAttributeFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"LangAttribute\", \"Composite.Web.Html.Template\", typeof(XAttribute), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return new XAttribute(\"lang\", Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Html/Template/MetaDescriptionValueFunction.cs",
    "content": "﻿using System.Web;\r\nusing System.Web.UI;\r\n\r\nusing Composite.Data;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Html.Template\r\n{\r\n    internal sealed class MetaDescriptionValueFunction : StandardFunctionBase\r\n    {\r\n        public MetaDescriptionValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"MetaDescriptionValue\", \"Composite.Web.Html.Template\", typeof(Control), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextAreaWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\"Element\", typeof(XElement), false, new ConstantValueProvider(null), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return new DescriptionControl(parameters.GetParameter<XElement>(\"Element\"));\r\n        }\r\n\r\n\r\n        private class DescriptionControl : Control\r\n        {\r\n            private XElement _element = null;\r\n\r\n            public DescriptionControl(XElement element)\r\n            {\r\n                _element = element;\r\n            }\r\n\r\n            protected override void Render(HtmlTextWriter writer)\r\n            {\r\n                string description = Page.Header.Description;\r\n\r\n                if (string.IsNullOrWhiteSpace(description) && SiteMap.CurrentNode != null)\r\n                {\r\n                    description = SiteMap.CurrentNode.Description;\r\n                }\r\n\r\n                if (string.IsNullOrWhiteSpace(description))\r\n                {\r\n                    using (DataConnection connection = new DataConnection())\r\n                    {\r\n                        description = connection.SitemapNavigator.CurrentPageNode.Description;\r\n                    }\r\n                }\r\n\r\n                if (string.IsNullOrWhiteSpace(description)) return;\r\n\r\n                if (_element != null)\r\n                {\r\n                    _element.Add(description);\r\n                    string commonNs = string.Format(\" xmlns=\\\"{0}\\\"\", Namespaces.Xhtml );\r\n                    string raw = _element.ToString().Replace(commonNs, \"\");\r\n                    writer.Write(raw);\r\n                }\r\n                else\r\n                {\r\n                    writer.WriteEncodedText(description);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Html/Template/PageTemplateFeatureFunction.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Html.Template\r\n{\r\n    internal sealed class PageTemplateFeatureFunction : StandardFunctionBase\r\n    {\r\n        public PageTemplateFeatureFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"PageTemplateFeature\", \"Composite.Web.Html.Template\", typeof(XhtmlDocument), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider featureNameSelector =\r\n                    StandardWidgetFunctions.DropDownList(\r\n                        this.GetType(),\r\n                        nameof(FeatureNames),\r\n                        false,\r\n                        true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FeatureName\",\r\n                    typeof(string),\r\n                    true,\r\n                    new NoValueValueProvider(),\r\n                    featureNameSelector);\r\n            }\r\n        }\r\n\r\n\r\n        public static IEnumerable<string> FeatureNames()\r\n        {\r\n            return PageTemplateFeatureFacade.FeatureNames;\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (PageRenderer.RenderingReason == RenderingReason.BuildSearchIndex)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string featureName = parameters.GetParameter<string>(\"FeatureName\");\r\n\r\n            return PageTemplateFeatureFacade.GetPageTemplateFeature(featureName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/CookieValueFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n    internal sealed class CookieValueFunction :  StandardFunctionBase\r\n\t{\r\n        public CookieValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"CookieValue\", \"Composite.Web.Request\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"CookieName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                HttpCookie cookie = HttpContext.Current.Request.Cookies[parameters.GetParameter<string>(\"CookieName\")];\r\n\r\n                if (cookie != null)\r\n                {\r\n                    string result = HttpContext.Current.Request.Cookies[parameters.GetParameter<string>(\"CookieName\")].Value;\r\n\r\n                    if (result != null) return result;\r\n                }\r\n            }\r\n\r\n            return parameters.GetParameter<string>(\"FallbackValue\");\r\n        }\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/FormPostBoolValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class FormPostBoolValueFunction :  StandardFunctionBase\r\n\t{\r\n        public FormPostBoolValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"FormPostBoolValue\", \"Composite.Web.Request\", typeof(bool), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                WidgetFunctionProvider fallbackWidget = StandardWidgetFunctions.GetBoolSelectorWidget(\"True\", \"False\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(bool), false, new ConstantValueProvider(false), fallbackWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.Form[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null)\r\n                {\r\n                    switch (result.ToLowerInvariant())\r\n                    {\r\n                        case \"0\":\r\n                        case \"false\":\r\n                            return false;\r\n                        case \"1\":\r\n                        case \"true\":\r\n                            return true;\r\n                        default:\r\n                            return bool.Parse(result);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return parameters.GetParameter<bool>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/FormPostDecimalValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class FormPostDecimalValueFunction :  StandardFunctionBase\r\n\t{\r\n        public FormPostDecimalValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"FormPostDecimalValue\", \"Composite.Web.Request\", typeof(decimal), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                WidgetFunctionProvider decimalTextboxWidget = StandardWidgetFunctions.DecimalTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(decimal), false, new ConstantValueProvider((decimal)0), decimalTextboxWidget);\r\n\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.Form[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null) return decimal.Parse(result);\r\n            }\r\n\r\n            return parameters.GetParameter<decimal>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/FormPostGuidValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class FormPostGuidValueFunction :  StandardFunctionBase\r\n\t{\r\n        public FormPostGuidValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"FormPostGuidValue\", \"Composite.Web.Request\", typeof(Guid), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(Guid), false, new ConstantValueProvider(Guid.Empty), textboxWidget);\r\n            }\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.Form[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null) return new Guid(result);\r\n            }\r\n\r\n            return parameters.GetParameter<Guid>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/FormPostIntegerValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class FormPostIntegerValueFunction :  StandardFunctionBase\r\n\t{\r\n        public FormPostIntegerValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"FormPostIntegerValue\", \"Composite.Web.Request\", typeof(int), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                WidgetFunctionProvider integerTextboxWidget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(int), false, new ConstantValueProvider(0), integerTextboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.Form[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null) return Int32.Parse(result);\r\n            }\r\n\r\n            return parameters.GetParameter<int>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/FormPostValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class FormPostValueFunction :  StandardFunctionBase\r\n\t{\r\n        public FormPostValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"FormPostValue\", \"Composite.Web.Request\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.Form[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null) return result;\r\n            }\r\n\r\n            return parameters.GetParameter<string>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/FormPostXmlFormattedDateTimeValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Functions.Foundation;\r\nusing System.Xml;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class FormPostXmlFormattedDateTimeValueFunction :  StandardFunctionBase\r\n\t{\r\n        public FormPostXmlFormattedDateTimeValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"FormPostXmlFormattedDateTimeValue\", \"Composite.Web.Request\", typeof(DateTime), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                WidgetFunctionProvider fallbackWidget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(DateTime), true, new NoValueValueProvider(), fallbackWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.Form[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                return XmlConvert.ToDateTime(result, XmlDateTimeSerializationMode.Local);\r\n            }\r\n\r\n            return parameters.GetParameter<DateTime>(\"FallbackValue\");\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/PathInfoFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n    internal sealed class PathInfoFunction : StandardFunctionBase\r\n    {\r\n        public PathInfoFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"PathInfo\", \"Composite.Web.Request\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider segmentDropDown = StandardWidgetFunctions.DropDownList(\r\n                    typeof(PathInfoFunction), \"SegmentSelectorOptionsFull\", \"Key\", \"Value\", false, true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Segment\", typeof(int), true, new ConstantValueProvider(\"-1\"), segmentDropDown);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"AutoApprove\", typeof(bool), false, new ConstantValueProvider(true), StandardWidgetFunctions.CheckBoxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(string), false, new ConstantValueProvider(\"\"), StandardWidgetFunctions.TextBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            int segment = (int)parameters.GetParameter(\"Segment\");\r\n            bool autoApprove = (bool)parameters.GetParameter(\"AutoApprove\");\r\n\r\n            string result = GetPathInfoSegment(segment);\r\n\r\n            if (autoApprove && !result.IsNullOrEmpty())\r\n            {\r\n                C1PageRoute.RegisterPathInfoUsage();\r\n            }\r\n\r\n            return result ?? parameters.GetParameter<string>(\"FallbackValue\");\r\n        }\r\n\r\n        public static IEnumerable<KeyValuePair<int, string>> SegmentSelectorOptions()\r\n        {\r\n            return new[]\r\n                       {\r\n                           new KeyValuePair<int, string>(0, \"0 \"), // Additional space is intentional \r\n                           new KeyValuePair<int, string>(1, \"1\"),\r\n                           new KeyValuePair<int, string>(2, \"2\"),\r\n                           new KeyValuePair<int, string>(3, \"3\"),\r\n                           new KeyValuePair<int, string>(4, \"4\"),\r\n                           new KeyValuePair<int, string>(5, \"5\")\r\n                       };\r\n        }\r\n\r\n        public static IEnumerable<KeyValuePair<int, string>> SegmentSelectorOptionsFull()\r\n        {\r\n            yield return new KeyValuePair<int, string>(-1, \"-1\");\r\n            foreach (var option in SegmentSelectorOptions())\r\n            {\r\n                yield return option;\r\n            }\r\n        }\r\n\r\n        internal static string GetPathInfoSegment(int segment)\r\n        {\r\n            string pathInfo = C1PageRoute.GetPathInfo();\r\n            if (segment == -1)\r\n            {\r\n                return pathInfo;\r\n            }\r\n\r\n            string[] segments = (pathInfo ?? string.Empty).Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);\r\n\r\n            if (segments.Length > segment)\r\n            {\r\n                return segments[segment];\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/PathInfoGuidFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n    internal sealed class PathInfoGuidFunction : StandardFunctionBase\r\n    {\r\n        public PathInfoGuidFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"PathInfoGuid\", \"Composite.Web.Request\", typeof(Guid), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider segmentDropDown = StandardWidgetFunctions.DropDownList(\r\n                    typeof(PathInfoFunction), \"SegmentSelectorOptions\", \"Key\", \"Value\", false, true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Segment\", typeof(int?), true, new ConstantValueProvider(0), segmentDropDown);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"AutoApprove\", typeof(bool), false, new ConstantValueProvider(true), StandardWidgetFunctions.CheckBoxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(Guid), false, new ConstantValueProvider(Guid.Empty), StandardWidgetFunctions.TextBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            int segment = (int)parameters.GetParameter(\"Segment\");\r\n            bool autoApprove = (bool)parameters.GetParameter(\"AutoApprove\");\r\n\r\n            string value = PathInfoFunction.GetPathInfoSegment(segment);\r\n\r\n            Guid guidValue;\r\n            if (string.IsNullOrEmpty(value) || !Guid.TryParse(value, out guidValue))\r\n            {\r\n                return parameters.GetParameter<Guid>(\"FallbackValue\");\r\n            }\r\n\r\n            if (autoApprove)\r\n            {\r\n                C1PageRoute.RegisterPathInfoUsage();\r\n            }\r\n\r\n            return guidValue;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/PathInfoIntFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n    internal sealed class PathInfoIntFunction : StandardFunctionBase\r\n    {\r\n        public PathInfoIntFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"PathInfoInt\", \"Composite.Web.Request\", typeof(int), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider segmentDropDown = StandardWidgetFunctions.DropDownList(\r\n                    typeof(PathInfoFunction), \"SegmentSelectorOptions\", \"Key\", \"Value\", false, true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Segment\", typeof(int), true, new ConstantValueProvider(0), segmentDropDown);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"AutoApprove\", typeof(bool), false, new ConstantValueProvider(true), StandardWidgetFunctions.CheckBoxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(int), false, new ConstantValueProvider(0), StandardWidgetFunctions.IntegerTextBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            int segment = (int)parameters.GetParameter(\"Segment\");\r\n            bool autoApprove = (bool)parameters.GetParameter(\"AutoApprove\");\r\n\r\n            string value = PathInfoFunction.GetPathInfoSegment(segment);\r\n\r\n            int intValue;\r\n            if(string.IsNullOrEmpty(value) || !int.TryParse(value, out intValue))\r\n            {\r\n                return parameters.GetParameter<int>(\"FallbackValue\");\r\n            }\r\n\r\n            if (autoApprove)\r\n            {\r\n                C1PageRoute.RegisterPathInfoUsage();\r\n            }\r\n\r\n            return intValue;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/QueryStringBoolValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class QueryStringBoolValueFunction :  StandardFunctionBase\r\n\t{\r\n        public QueryStringBoolValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"QueryStringBoolValue\", \"Composite.Web.Request\", typeof(bool), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                WidgetFunctionProvider fallbackWidget = StandardWidgetFunctions.GetBoolSelectorWidget(\"True\", \"False\");\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(bool), false, new ConstantValueProvider(false), fallbackWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.QueryString[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null)\r\n                {\r\n                    switch (result.ToLowerInvariant())\r\n                    {\r\n                        case \"0\":\r\n                        case \"false\":\r\n                            return false;\r\n                        case \"1\":\r\n                        case \"true\":\r\n                            return true;\r\n                        default:\r\n                            return bool.Parse(result);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return parameters.GetParameter<bool>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/QueryStringDecimalValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class QueryStringDecimalValueFunction :  StandardFunctionBase\r\n\t{\r\n        public QueryStringDecimalValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"QueryStringDecimalValue\", \"Composite.Web.Request\", typeof(decimal), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                WidgetFunctionProvider decimalTextboxWidget = StandardWidgetFunctions.DecimalTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(decimal), false, new ConstantValueProvider((decimal)0), decimalTextboxWidget);\r\n\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.QueryString[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null) return decimal.Parse(result);\r\n            }\r\n\r\n            return parameters.GetParameter<decimal>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/QueryStringGuidValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class QueryStringGuidValueFunction :  StandardFunctionBase\r\n\t{\r\n        public QueryStringGuidValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"QueryStringGuidValue\", \"Composite.Web.Request\", typeof(Guid), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(Guid), false, new ConstantValueProvider(Guid.Empty), textboxWidget);\r\n            }\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.QueryString[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null) return new Guid(result);\r\n            }\r\n\r\n            return parameters.GetParameter<Guid>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/QueryStringIntegerValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class QueryStringIntegerValueFunction :  StandardFunctionBase\r\n\t{\r\n        public QueryStringIntegerValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"QueryStringIntegerValue\", \"Composite.Web.Request\", typeof(int), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                WidgetFunctionProvider integerTextboxWidget = StandardWidgetFunctions.IntegerTextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(int), false, new ConstantValueProvider(0), integerTextboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Request.QueryString[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if (result != null) return Int32.Parse(result);\r\n            }\r\n\r\n            return parameters.GetParameter<int>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/QueryStringValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class QueryStringValueFunction :  StandardFunctionBase\r\n\t{\r\n        public QueryStringValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"QueryStringValue\", \"Composite.Web.Request\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if (httpContext != null && httpContext.Request != null)\r\n            {\r\n                string parameterName = parameters.GetParameter<string>(\"ParameterName\");\r\n\r\n                string result = httpContext.Request.QueryString[parameterName];\r\n\r\n                if (result != null) return result;\r\n            }\r\n\r\n            return parameters.GetParameter<string>(\"FallbackValue\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/QueryStringXmlFormattedDateTimeValueFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing System.Xml;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n\tinternal sealed class QueryStringXmlFormattedDateTimeValueFunction :  StandardFunctionBase\r\n\t{\r\n        public QueryStringXmlFormattedDateTimeValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"QueryStringXmlFormattedDateTimeValue\", \"Composite.Web.Request\", typeof(DateTime), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n                WidgetFunctionProvider fallbackWidget = StandardWidgetFunctions.DateTimeSelectorWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"ParameterName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(DateTime), true, new NoValueValueProvider(), fallbackWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if (httpContext != null && httpContext.Request != null)\r\n            {\r\n                string result = httpContext.Request.QueryString[parameters.GetParameter<string>(\"ParameterName\")];\r\n\r\n                if(!string.IsNullOrEmpty(result))\r\n                {\r\n                    return XmlConvert.ToDateTime(result, XmlDateTimeSerializationMode.Local);\r\n                }\r\n            }\r\n\r\n            return parameters.GetParameter<DateTime>(\"FallbackValue\");\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/RegisterPathInfoUsageFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n    internal sealed class RegisterPathInfoUsageFunction : StandardFunctionBase\r\n    {\r\n        public RegisterPathInfoUsageFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"RegisterPathInfoUsage\", \"Composite.Web.Request\", typeof(void), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            C1PageRoute.RegisterPathInfoUsage();\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Request/SessionVariableFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Request\r\n{\r\n    internal sealed class SessionVariableFunction :  StandardFunctionBase\r\n\t{\r\n        public SessionVariableFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"SessionVariable\", \"Composite.Web.Request\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"VariableName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                object result = HttpContext.Current.Session[parameters.GetParameter<string>(\"VariableName\")];\r\n\r\n                if (result != null) return result.ToString();\r\n            }\r\n\r\n            return parameters.GetParameter<string>(\"FallbackValue\");\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Response/RedirectFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\n\r\nusing Composite.Core.WebClient;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Response\r\n{\r\n    internal sealed class RedirectFunction : StandardFunctionBase\r\n    {\r\n        public RedirectFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Redirect\", \"Composite.Web.Response\", typeof(void), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                var urlComboBoxWidget = StandardWidgetFunctions.UrlComboBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Url\", typeof(string), true, new NoValueValueProvider(), urlComboBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n\r\n            if (httpContext == null)\r\n            {\r\n                return null;\r\n            }\r\n            \r\n            string url = parameters.GetParameter<string>(\"Url\");\r\n\r\n            if (!UrlUtils.IsAdminConsoleRequest(httpContext))\r\n            {\r\n                httpContext.Response.Redirect(url, false);\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Response/SetCookieValueFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Response\r\n{\r\n    internal sealed class SetCookieValueFunction : StandardFunctionBase\r\n    {\r\n        public SetCookieValueFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"SetCookieValue\", \"Composite.Web.Response\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"CookieName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Expires\", typeof(DateTime), false, new ConstantValueProvider(DateTime.MinValue), null);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string cookieName = parameters.GetParameter<string>(\"CookieName\");\r\n                string value = parameters.GetParameter<string>(\"Value\");\r\n                DateTime expires = parameters.GetParameter<DateTime>(\"Expires\");\r\n\r\n                HttpContext.Current.Response.Cookies[cookieName].Value = value;\r\n                HttpContext.Current.Response.Cookies[cookieName].Expires = expires; // DateTime.MinValue = session cookie\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Response/SetServerPageCacheDuration.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Response\r\n{\r\n    internal sealed class SetServerPageCacheDuration : StandardFunctionBase\r\n    {\r\n        private const string ParameterName_MaxSeconds = \"MaxSeconds\";\r\n\r\n        public SetServerPageCacheDuration(EntityTokenFactory entityTokenFactory)\r\n            : base(\"SetServerPageCacheDuration\", \"Composite.Web.Response\", typeof(void), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                yield return new StandardFunctionParameterProfile(\r\n                    ParameterName_MaxSeconds, typeof(int), true, new ConstantValueProvider(0), StandardWidgetFunctions.TextBoxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if (httpContext?.Response == null) return null;\r\n            var cache = httpContext.Response.Cache;\r\n\r\n            int maxSeconds = parameters.GetParameter<int>(ParameterName_MaxSeconds);\r\n\r\n            if (maxSeconds <= 0)\r\n            {\r\n                cache.SetCacheability(HttpCacheability.NoCache);\r\n                cache.SetNoServerCaching();\r\n                cache.SetNoStore();\r\n            }\r\n            else\r\n            {\r\n                cache.SetExpires(DateTime.Now.AddSeconds(maxSeconds));\r\n                cache.SetMaxAge(TimeSpan.FromSeconds(maxSeconds));\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Response/SetSessionVariableFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Response\r\n{\r\n    internal sealed class SetSessionVariableFunction :  StandardFunctionBase\r\n\t{\r\n        public SetSessionVariableFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"SetSessionVariable\", \"Composite.Web.Response\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"VariableName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Value\", typeof(string), true, new ConstantValueProvider(\"\"), textboxWidget );\r\n            }\r\n        }\r\n\r\n\r\n      public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n      {\r\n          if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n          {\r\n              HttpContext.Current.Session[parameters.GetParameter<string>(\"VariableName\")] = parameters.GetParameter<string>(\"Value\");\r\n          }\r\n\r\n          return null;\r\n      }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Server/ApplicationPath.cs",
    "content": "﻿using Composite.Functions;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing System.Web;\r\nusing System;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Server\r\n{\r\n    internal sealed class ApplicationPath : StandardFunctionBase\r\n    {\r\n        public ApplicationPath(EntityTokenFactory entityTokenFactory)\r\n            : base(\"ApplicationPath\", \"Composite.Web.Server\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if (httpContext == null || httpContext.Request == null)\r\n            {\r\n                throw new InvalidOperationException(\"Unable to access 'HttpContext.Current.Request' - object is null\");\r\n            }\r\n\r\n            string appPath = httpContext.Request.ApplicationPath;\r\n            if (appPath.EndsWith(\"/\"))\r\n            {\r\n                appPath = appPath.Substring(0, appPath.Length - 1);\r\n            }\r\n            return appPath;\r\n            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Server/ApplicationVariableFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Functions;\r\nusing System.Web;\r\n\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Server\r\n{\r\n    internal sealed class ApplicationVariableFunction :  StandardFunctionBase\r\n\t{\r\n        public ApplicationVariableFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"ApplicationVariable\", \"Composite.Web.Server\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"VariableName\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"FallbackValue\", typeof(string), false, new ConstantValueProvider(\"\"), textboxWidget);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                string result = HttpContext.Current.Application[parameters.GetParameter<string>(\"VariableName\")].ToString();\r\n\r\n                if (result != null) return result;\r\n            }\r\n\r\n            return parameters.GetParameter<string>(\"FallbackValue\");\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Web/Server/ServerVariableFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nusing Composite.Functions;\r\nusing System.Web;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Web.Server\r\n{\r\n\tinternal sealed class ServerVariableFunction :  StandardFunctionBase\r\n\t{\r\n        public ServerVariableFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"ServerVariable\", \"Composite.Web.Server\", typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider serverVariableNameSelector =\r\n                    StandardWidgetFunctions.DropDownList(\r\n                        this.GetType(),\r\n                        \"ServerVariableNames\",\r\n                        false,\r\n                        true);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"VariableName\", typeof(string), true, new ConstantValueProvider(\"PATH_INFO\"), serverVariableNameSelector);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            if (HttpContext.Current != null && HttpContext.Current.Request != null)\r\n            {\r\n                return HttpContext.Current.Request.ServerVariables[parameters.GetParameter<string>(\"VariableName\")];\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n\r\n        public static IEnumerable<string> ServerVariableNames()\r\n        {\r\n            yield return \"ALL_HTTP\";\r\n            yield return \"ALL_RAW\";\r\n            yield return \"APPL_MD_PATH\";\r\n            yield return \"APPL_PHYSICAL_PATH\";\r\n            yield return \"AUTH_PASSWORD\";\r\n            yield return \"AUTH_TYPE\";\r\n            yield return \"AUTH_USER\";\r\n            yield return \"CERT_COOKIE\";\r\n            yield return \"CERT_FLAGS\";\r\n            yield return \"CERT_ISSUER\";\r\n            yield return \"CERT_KEYSIZE\";\r\n            yield return \"CERT_SECRETKEYSIZE\";\r\n            yield return \"CERT_SERIALNUMBER\";\r\n            yield return \"CERT_SERVER_ISSUER\";\r\n            yield return \"CERT_SERVER_SUBJECT\";\r\n            yield return \"CERT_SUBJECT\";\r\n            yield return \"CONTENT_LENGTH\";\r\n            yield return \"CONTENT_TYPE\";\r\n            yield return \"GATEWAY_INTERFACE\";\r\n            yield return \"HTTP_ACCEPT\";\r\n            yield return \"HTTP_ACCEPT_LANGUAGE\";\r\n            yield return \"HTTP_COOKIE\";\r\n            yield return \"HTTP_HOST\";\r\n            yield return \"HTTP_REFERER\";\r\n            yield return \"HTTP_USER_AGENT\";\r\n            yield return \"HTTPS\";\r\n            yield return \"HTTPS_KEYSIZE\";\r\n            yield return \"HTTPS_SECRETKEYSIZE\";\r\n            yield return \"HTTPS_SERVER_ISSUER\";\r\n            yield return \"HTTPS_SERVER_SUBJECT\";\r\n            yield return \"INSTANCE_ID\";\r\n            yield return \"INSTANCE_META_PATH\";\r\n            yield return \"LOCAL_ADDR\";\r\n            yield return \"LOGON_USER\";\r\n            yield return \"PATH_INFO\";\r\n            yield return \"PATH_TRANSLATED\";\r\n            yield return \"QUERY_STRING\";\r\n            yield return \"REMOTE_ADDR\";\r\n            yield return \"REMOTE_HOST\";\r\n            yield return \"REMOTE_USER\";\r\n            yield return \"REQUEST_METHOD\";\r\n            yield return \"SCRIPT_NAME\";\r\n            yield return \"SERVER_NAME\";\r\n            yield return \"SERVER_PORT\";\r\n            yield return \"SERVER_PORT_SECURE\";\r\n            yield return \"SERVER_PROTOCOL\";\r\n            yield return \"SERVER_SOFTWARE\";\r\n            yield return \"URL\";\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Xml/LoadFileFunction.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing System.IO;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Xml\r\n{\r\n    internal sealed class LoadFileFunction : StandardFunctionBase\r\n    {\r\n        public LoadFileFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"LoadFile\", \"Composite.Xml\", typeof(XElement), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string relativePath = parameters.GetParameter<string>(\"RelativePath\");\r\n\r\n            string path = Path.Combine(PathUtil.Resolve(\"~\"), relativePath);\r\n            if (!C1File.Exists(path))\r\n            {\r\n                throw new FileNotFoundException(\"File not found. Ensure path is relative (that it does not start with '/').\", path);\r\n            }\r\n\r\n            using (var streamReader = new C1StreamReader(path))\r\n            {\r\n                using (var reader = XmlReader.Create(streamReader))\r\n                {\r\n                    return XElement.Load(reader);\r\n                }\r\n            }\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"RelativePath\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Xml/LoadUrlFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Xml\r\n{\r\n    internal sealed class LoadUrlFunction : StandardFunctionBase\r\n    {\r\n        public LoadUrlFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"LoadUrl\", \"Composite.Xml\", typeof(XElement), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string url = parameters.GetParameter<string>(\"Url\");\r\n\r\n            bool cachingEnabled = false;\r\n\r\n            int cachePeriod;\r\n            if (parameters.TryGetParameter(\"CacheTime\", out cachePeriod))\r\n            {\r\n                cachingEnabled = cachePeriod > 0;\r\n            }\r\n\r\n            string cacheKey = null;\r\n            if (cachingEnabled)\r\n            {\r\n                cacheKey = typeof(LoadUrlFunction).FullName + \"|\" + url;\r\n                var cachedValue = HttpRuntime.Cache.Get(cacheKey) as XElement;\r\n                if (cachedValue != null)\r\n                {\r\n                    return cachedValue;\r\n                }\r\n            }\r\n\r\n            using (TimerProfilerFacade.CreateTimerProfiler(url))\r\n            {\r\n                XElement value = XElementUtils.Load(url);\r\n\r\n                if (cachingEnabled)\r\n                {\r\n                    HttpRuntime.Cache.Add(cacheKey, value, null, DateTime.Now.AddSeconds(cachePeriod),\r\n                                          Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);\r\n                }\r\n\r\n                return value;\r\n            }\r\n        }\r\n\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"Url\", typeof(string), true, new NoValueValueProvider(),textboxWidget);\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"CacheTime\", typeof(int), false, new ConstantValueProvider(0), textboxWidget);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Xml/LoadXhtmlFileFunction.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Xml\r\n{\r\n    internal sealed class LoadXhtmlFileFunction : StandardFunctionBase\r\n    {\r\n        public LoadXhtmlFileFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"LoadXhtmlFile\", \"Composite.Xml\", typeof(XhtmlDocument), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            string relativePath = parameters.GetParameter<string>(\"RelativePath\");\r\n\r\n            string path = Path.Combine(PathUtil.Resolve(\"~\"), relativePath);\r\n            if (!C1File.Exists(path))\r\n            {\r\n                throw new FileNotFoundException(\"File not found. Ensure path is relative (that it does not start with '/').\", path);\r\n            }\r\n\r\n            using (var streamReader = new C1StreamReader(path))\r\n            {\r\n                using (var reader = XmlReader.Create(streamReader))\r\n                {\r\n                    return new XhtmlDocument(XDocument.Load(reader));\r\n                }\r\n            }\r\n        }\r\n\r\n        protected override IEnumerable<StandardFunctionParameterProfile> StandardFunctionParameterProfiles\r\n        {\r\n            get\r\n            {\r\n                WidgetFunctionProvider textboxWidget = StandardWidgetFunctions.TextBoxWidget;\r\n\r\n                yield return new StandardFunctionParameterProfile(\r\n                    \"RelativePath\", typeof(string), true, new NoValueValueProvider(), textboxWidget);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Xslt/Extensions/DateFormattingXsltExtensionsFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.Xml;\r\nusing System.Xml;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Xslt.Extensions\r\n{\r\n    internal sealed class DateFormattingXsltExtensionsFunction : StandardFunctionBase\r\n    {\r\n        public DateFormattingXsltExtensionsFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"DateFormatting\", \"Composite.Xslt.Extensions\", typeof(IXsltExtensionDefinition), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return new XsltExtensionDefinition<DateFormattingXsltExtensions>\r\n            {\r\n                EntensionObject = new DateFormattingXsltExtensions(),\r\n                ExtensionNamespace = \"#dateExtensions\"\r\n            };\r\n        }\r\n\r\n\r\n        internal class DateFormattingXsltExtensions\r\n        {\r\n            public string Now()\r\n            {\r\n                return XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Local);\r\n            }\r\n\r\n            public string LongDateFormat(string xmlFormattedDate)\r\n            {\r\n                DateTime date = XmlConvert.ToDateTime(xmlFormattedDate, XmlDateTimeSerializationMode.Local);\r\n                return date.ToLongDateString();\r\n            }\r\n\r\n            public string LongTimeFormat(string xmlFormattedDate)\r\n            {\r\n                DateTime date = XmlConvert.ToDateTime(xmlFormattedDate, XmlDateTimeSerializationMode.Local);\r\n                return date.ToLongTimeString();\r\n            }\r\n\r\n            public string ShortDateFormat(string xmlFormattedDate)\r\n            {\r\n                DateTime date = XmlConvert.ToDateTime(xmlFormattedDate, XmlDateTimeSerializationMode.Local);\r\n                return date.ToShortDateString();\r\n            }\r\n\r\n            public string ShortTimeFormat(string xmlFormattedDate)\r\n            {\r\n                DateTime date = XmlConvert.ToDateTime(xmlFormattedDate, XmlDateTimeSerializationMode.Local);\r\n                return date.ToShortTimeString();\r\n            }\r\n\r\n            public int Day(string xmlFormattedDate)\r\n            {\r\n                DateTime date = XmlConvert.ToDateTime(xmlFormattedDate, XmlDateTimeSerializationMode.Local);\r\n                return date.Day;\r\n            }\r\n\r\n            public int Month(string xmlFormattedDate)\r\n            {\r\n                DateTime date = XmlConvert.ToDateTime(xmlFormattedDate, XmlDateTimeSerializationMode.Local);\r\n                return date.Month;\r\n            }\r\n\r\n            public int Year(string xmlFormattedDate)\r\n            {\r\n                DateTime date = XmlConvert.ToDateTime(xmlFormattedDate, XmlDateTimeSerializationMode.Local);\r\n                return date.Year;\r\n            }\r\n\r\n\r\n            public string LongMonthName(int monthNumber)\r\n            {\r\n                if (monthNumber < 1 || monthNumber > 12) throw new ArgumentOutOfRangeException(\"monthNumber\");\r\n\r\n                DateTime date = new DateTime(1, monthNumber, 1);\r\n\r\n                return date.ToString(\"MMMM\");\r\n            }\r\n\r\n\r\n            public string ShortMonthName(int monthNumber)\r\n            {\r\n                if (monthNumber < 1 || monthNumber > 12) throw new ArgumentOutOfRangeException(\"monthNumber\");\r\n\r\n                DateTime date = new DateTime(1, monthNumber, 1);\r\n\r\n                return date.ToString(\"MMM\");\r\n            }\r\n\r\n            public string Format(string xmlFormattedDate, string DateFormat)\r\n            {\r\n                DateTime date = XmlConvert.ToDateTime(xmlFormattedDate, XmlDateTimeSerializationMode.Local);\r\n\r\n                return date.ToString(DateFormat);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Xslt/Extensions/GlobalizationXsltExtensionsFunction.cs",
    "content": "﻿using System;\r\nusing Composite.Functions;\r\n\r\nusing System.Collections.Generic;\r\nusing System.Data.SqlTypes;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\nusing Composite.Core.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Xslt.Extensions\r\n{\r\n    internal sealed class GlobalizationXsltExtensionsFunction : StandardFunctionBase\r\n    {\r\n        public GlobalizationXsltExtensionsFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"Globalization\", \"Composite.Xslt.Extensions\", typeof(IXsltExtensionDefinition), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return new XsltExtensionDefinition<GlobalizationXsltExtensions>\r\n            {\r\n                EntensionObject = new GlobalizationXsltExtensions(),\r\n                ExtensionNamespace = \"#globalizationExtensions\"\r\n            };\r\n        }\r\n\r\n\r\n        internal class GlobalizationXsltExtensions\r\n        {\r\n            public string GetGlobalResourceString(string resourceClassKey, string resourceKey)\r\n            {\r\n                return System.Web.HttpContext.GetGlobalResourceObject(resourceClassKey, resourceKey).ToString();\r\n            }\r\n\r\n\r\n            public string LongMonthName(int monthNumber)\r\n            {\r\n                if (monthNumber < 1 || monthNumber > 12) throw new ArgumentOutOfRangeException(\"monthNumber\");\r\n\r\n                DateTime date = new DateTime(1, monthNumber, 1);\r\n\r\n                return date.ToString(\"MMMM\");\r\n            }\r\n\r\n\r\n            public string ShortMonthName(int monthNumber)\r\n            {\r\n                if (monthNumber < 1 || monthNumber > 12) throw new ArgumentOutOfRangeException(\"monthNumber\");\r\n\r\n                DateTime date = new DateTime(1, monthNumber, 1);\r\n\r\n                return date.ToString(\"MMM\");\r\n            }\r\n\r\n\r\n\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/StandardFunctionProvider/Xslt/Extensions/MarkupParserXsltExtensionsFunction.cs",
    "content": "﻿using System.IO;\r\nusing System.Xml.XPath;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.StandardFunctionProvider.Xslt.Extensions\r\n{\r\n    internal sealed class MarkupParserXsltExtensionsFunction : StandardFunctionBase\r\n    {\r\n        public MarkupParserXsltExtensionsFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(\"MarkupParser\", \"Composite.Xslt.Extensions\", typeof(IXsltExtensionDefinition), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override object Execute(ParameterList parameters, FunctionContextContainer context)\r\n        {\r\n            return new XsltExtensionDefinition<MarkupParserXsltExtensions>\r\n            {\r\n                EntensionObject = new MarkupParserXsltExtensions(),\r\n                ExtensionNamespace = \"#MarkupParserExtensions\"\r\n            };\r\n        }\r\n\r\n\r\n        internal class MarkupParserXsltExtensions\r\n        {\r\n            public XPathNavigator ParseWellformedDocumentMarkup(string wellformedMarkupString)\r\n            {\r\n                using (StringReader sr = new StringReader(wellformedMarkupString))\r\n                {\r\n                    XPathDocument doc = new XPathDocument(sr);\r\n                    return doc.CreateNavigator();\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public XPathNavigator ParseXhtmlBodyFragment(string xhtmlBodyFragmentString)\r\n            {\r\n                using (StringReader sr = new StringReader(string.Format(\"<html xmlns='{0}'><head /><body>{1}</body></html>\", Namespaces.Xhtml, xhtmlBodyFragmentString)))\r\n                {\r\n                    XPathDocument doc = new XPathDocument(sr);\r\n                    return doc.CreateNavigator();\r\n                }\r\n            }\r\n\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/UserControlFunctionProvider/UserControlBasedFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing Composite.AspNet;\r\nusing Composite.Core.IO;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.UserControlFunctionProvider\r\n{\r\n    internal class UserControlBasedFunction : FileBasedFunction<UserControlBasedFunction>\r\n    {\r\n        public UserControlBasedFunction(\r\n            string @namespace, \r\n            string name, \r\n            string description,\r\n            IDictionary<string, FunctionParameter> parameters, \r\n            Type returnType,\r\n            string virtualPath, \r\n            FileBasedFunctionProvider<UserControlBasedFunction> provider)\r\n            : base(@namespace, name, description, parameters, returnType, virtualPath, provider)\r\n        {\r\n        }\r\n\r\n        public UserControlBasedFunction(\r\n            string @namespace, \r\n            string name, \r\n            string description, \r\n            string virtualPath, \r\n            FileBasedFunctionProvider<UserControlBasedFunction> provider)\r\n            : base(@namespace, name, description, typeof(UserControl), virtualPath, provider)\r\n        {\r\n        }\r\n\r\n        protected override void InitializeParameters()\r\n        {\r\n            UserControl userControl = UserControlFunctionProvider.CompileFile(VirtualPath);\r\n\r\n            Verify.IsNotNull(userControl, \"Failed to get UserControl from '{0}'\", VirtualPath);\r\n\r\n            Type baseControlType = userControl is UserControlFunction ? typeof(UserControlFunction) : typeof(UserControl);\r\n\r\n            Parameters = FunctionBasedFunctionProviderHelper.GetParameters(userControl, baseControlType, PathUtil.Resolve(VirtualPath));\r\n        }\r\n\r\n        public override object Execute(Composite.Functions.ParameterList parameters,\r\n                                       Composite.Functions.FunctionContextContainer context)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            Verify.IsNotNull(httpContext, \"HttpContext.Current is null\");\r\n\r\n            Page currentPage = httpContext.Handler as Page;\r\n            Verify.IsNotNull(currentPage, \"The Current HttpContext Handler must be a \" + typeof (Page).FullName);\r\n\r\n            var userControl = currentPage.LoadControl(VirtualPath);\r\n\r\n\r\n            foreach (var param in parameters.AllParameterNames)\r\n            {\r\n                var value = parameters.GetParameter(param);\r\n                Parameters[param].SetValue(userControl, value);\r\n            }\r\n\r\n            var userControlFunction = userControl as UserControlFunction;\r\n            if (userControlFunction != null)\r\n            {\r\n                userControlFunction.FunctionContextContainer = context;\r\n            }\r\n\r\n            return userControl;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/UserControlFunctionProvider/UserControlFunctionProvider.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing Composite.AspNet;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.UserControlFunctionProvider\r\n{\r\n    [ConfigurationElementType(typeof(UserControlFunctionProviderData))]\r\n    internal class UserControlFunctionProvider : FileBasedFunctionProvider.FileBasedFunctionProvider<UserControlBasedFunction>\r\n    {\r\n        public UserControlFunctionProvider(string name, string folder) : base(name, folder) { }\r\n\r\n        protected override string FileExtension\r\n        {\r\n            get { return \"ascx\"; }\r\n        }\r\n\r\n        protected override string DefaultFunctionNamespace\r\n        {\r\n            get { return \"UserControls\"; }\r\n        }\r\n\r\n        protected override bool HandleChange(string path)\r\n        {\r\n            return path.EndsWith(\".ascx\") || path.EndsWith(\".ascx.cs\");\r\n        }\r\n\r\n        public static UserControl CompileFile(string virtualPath)\r\n        { \r\n            var page = new Page();\r\n\r\n            using(BuildManagerHelper.DisableUrlMetadataCachingScope())\r\n            {\r\n                return page.LoadControl(virtualPath) as UserControl;\r\n            }\r\n        }\r\n\r\n        protected override IFunction InstantiateFunction(string virtualPath, string @namespace, string name)\r\n        {\r\n            UserControl userControl = CompileFile(virtualPath);\r\n\r\n            if(!(userControl is UserControl))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            Type baseControlType = userControl is UserControlFunction ? typeof(UserControlFunction) : typeof(UserControl);\r\n\r\n            string description = userControl is UserControlFunction \r\n                ? (userControl as UserControlFunction).FunctionDescription \r\n                : \"\";\r\n\r\n            var parameters = FunctionBasedFunctionProviderHelper.GetParameters(userControl, baseControlType, virtualPath);\r\n\r\n            return new UserControlBasedFunction(@namespace, name, description, parameters, typeof(UserControl), virtualPath, this);\r\n        }\r\n\r\n        protected override IFunction InstantiateFunctionFromCache(string virtualPath, string @namespace, string name, Type returnType, string cachedDescription, bool preventCaching)\r\n        {\r\n            return new UserControlBasedFunction(@namespace, name, cachedDescription, virtualPath, this);\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/UserControlFunctionProvider/UserControlFunctionProviderAssembler.cs",
    "content": "﻿using Composite.Functions.Plugins.FunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.UserControlFunctionProvider\r\n{\r\n    internal class UserControlFunctionProviderAssembler : IAssembler<IFunctionProvider, FunctionProviderData>\r\n    {\r\n        IFunctionProvider IAssembler<IFunctionProvider, FunctionProviderData>.Assemble(IBuilderContext context, FunctionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var data = objectConfiguration as UserControlFunctionProviderData;\r\n            Verify.ArgumentCondition(data != null, \"objectConfiguration\", \"Expected configuration to be of type \" + typeof(UserControlFunctionProviderData).Name);\r\n\r\n            return new UserControlFunctionProvider(data.Name, data.Directory);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/UserControlFunctionProvider/UserControlFunctionProviderData.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.UserControlFunctionProvider\r\n{\r\n    [Assembler(typeof(UserControlFunctionProviderAssembler))]\r\n    internal class UserControlFunctionProviderData : FunctionProviderData\r\n    {\r\n        [ConfigurationProperty(\"directory\", IsRequired = false, DefaultValue = \"~/App_Data/UserControls\")]\r\n        public string Directory\r\n        {\r\n            get { return (string)base[\"directory\"]; }\r\n            set { base[\"directory\"] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/VisualFunctionProvider/RenderingHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.Renderings.Data;\r\nusing Composite.Core.Xml;\r\nusing System.Web;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.VisualFunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class RenderingHelper\r\n    {\r\n        /// <exclude />\r\n        public static XhtmlDocument RenderCompleteDataList(IVisualFunction function, XhtmlDocument xhtmlDocument, DataTypeDescriptor typeDescriptor, FunctionContextContainer functionContextContainer)\r\n        {\r\n            Type typeofClassWithGenericStaticMethod = typeof(RenderingHelper);\r\n\r\n            // Grabbing the specific static method\r\n            MethodInfo methodInfo = typeofClassWithGenericStaticMethod.GetMethod(\"RenderCompleteDataListImpl\", System.Reflection.BindingFlags.Static | BindingFlags.NonPublic);\r\n\r\n            // Binding the method info to generic arguments\r\n            Type[] genericArguments = new Type[] { typeDescriptor.GetInterfaceType() };\r\n            MethodInfo genericMethodInfo = methodInfo.MakeGenericMethod(genericArguments);\r\n\r\n            // Simply invoking the method and passing parameters\r\n            // The null parameter is the object to call the method from. Since the method is\r\n            // static, pass null.\r\n            return (XhtmlDocument)genericMethodInfo.Invoke(null, new object[] { function, xhtmlDocument, typeDescriptor, functionContextContainer });\r\n        }\r\n\r\n\r\n        private static XhtmlDocument RenderCompleteDataListImpl<T>(IVisualFunction function, XhtmlDocument xhtmlDocument, DataTypeDescriptor typeDescriptor, FunctionContextContainer functionContextContainer)\r\n            where T : class, IData\r\n        {\r\n            Expression<Func<T, bool>> filter = f => true;\r\n\r\n            return RenderDataList<T>(function, xhtmlDocument, typeDescriptor, functionContextContainer, filter);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static XhtmlDocument RenderDataList<T>(IVisualFunction function, XhtmlDocument xhtmlDocument, DataTypeDescriptor typeDescriptor, FunctionContextContainer functionContextContainer, Expression<Func<T, bool>> filter)\r\n            where T : class, IData\r\n        {\r\n            if (function == null) throw new ArgumentNullException(\"function\");\r\n            if (xhtmlDocument == null) throw new ArgumentNullException(\"xhtmlDocument\");\r\n            if (typeDescriptor == null) throw new ArgumentNullException(\"typeDescriptor\");\r\n            if (functionContextContainer == null) throw new ArgumentNullException(\"functionContextContainer\");\r\n\r\n            Type dataType = typeDescriptor.GetInterfaceType();\r\n\r\n            if (dataType == null)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"'{0}' is not a known type manager type.\", typeDescriptor.TypeManagerTypeName));\r\n            }\r\n\r\n            List<T> allData = DataFacade.GetData<T>(filter).ToList();\r\n\r\n            List<T> itemsToList;\r\n\r\n            if (function.OrderbyFieldName == \"(random)\")\r\n            {\r\n                int itemsInList = allData.Count();\r\n                int itemsToFetch = Math.Min(itemsInList, function.MaximumItemsToList);\r\n\r\n                itemsToList = new List<T>();\r\n\r\n                while (itemsToFetch > 0)\r\n                {\r\n\r\n                    int itemToGet = (Math.Abs(Guid.NewGuid().GetHashCode()) % itemsInList); // (new Random()).Next(0, itemsInList);\r\n\r\n                    itemsToList.Add(allData[itemToGet]);\r\n                    allData.RemoveAt(itemToGet);\r\n\r\n                    itemsToFetch--;\r\n                    itemsInList--;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                IComparer<T> comparer = GenericComparer<T>.Build(typeDescriptor.GetInterfaceType(), function.OrderbyFieldName, function.OrderbyAscending);\r\n                allData.Sort(comparer);\r\n\r\n                itemsToList = allData.Take(function.MaximumItemsToList).ToList();\r\n            }\r\n\r\n            return RenderDataListImpl<T>(xhtmlDocument, typeDescriptor, itemsToList, functionContextContainer);\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        private static XhtmlDocument RenderDataListImpl<T>(XhtmlDocument templateDocument, DataTypeDescriptor typeDescriptor, List<T> dataList, FunctionContextContainer functionContextContainer)\r\n            where T : class, IData\r\n        {\r\n            XhtmlDocument outputDocument = new XhtmlDocument();\r\n\r\n            if (dataList.Count > 0)\r\n            {\r\n                Type interfaceType = typeDescriptor.GetInterfaceType();\r\n                XElement templateBody = new XElement(templateDocument.Body);\r\n\r\n                Dictionary<string, PropertyInfo> propertyInfoLookup =\r\n                    interfaceType.GetPropertiesRecursively(p => typeof(IData).IsAssignableFrom(p.DeclaringType)).ToList().ToDictionary(p => p.Name);\r\n\r\n                List<string> fieldsWithReferenceRendering = new List<string>();\r\n\r\n                foreach (PropertyInfo dataPropertyInfo in propertyInfoLookup.Values)\r\n                {\r\n                    Type referencedType = null;\r\n                    if (dataPropertyInfo.TryGetReferenceType(out referencedType))\r\n                    {\r\n                        bool canRender = DataXhtmlRenderingServices.CanRender(referencedType, XhtmlRenderingType.Embedable);\r\n\r\n                        if (canRender)\r\n                        {\r\n                            fieldsWithReferenceRendering.Add(dataPropertyInfo.Name);\r\n                        }\r\n                    }\r\n                }\r\n\r\n\r\n                // any optimization would do wonders\r\n                foreach (IData data in dataList)\r\n                {\r\n                    XElement currentRowElementsContainer = new XElement(templateBody);\r\n\r\n                    List<DynamicTypeMarkupServices.FieldReferenceDefinition> references =\r\n                        DynamicTypeMarkupServices.GetFieldReferenceDefinitions(currentRowElementsContainer, typeDescriptor.TypeManagerTypeName).ToList();\r\n\r\n                    // perf waste - if some props are not used;\r\n                    Dictionary<string, object> objectValues =\r\n                        propertyInfoLookup.ToDictionary(f => f.Key, f => f.Value.GetValue(data, new object[] { }));\r\n\r\n                    foreach (DynamicTypeMarkupServices.FieldReferenceDefinition reference in references)\r\n                    {\r\n                        object value = null;\r\n\r\n                        if (fieldsWithReferenceRendering.Contains(reference.FieldName))\r\n                        {\r\n                            // reference field with rendering...\r\n                            Type referencedType = null;\r\n                            if (propertyInfoLookup[reference.FieldName].TryGetReferenceType(out referencedType))\r\n                            {\r\n                                if (objectValues[reference.FieldName] != null)\r\n                                {\r\n                                    IDataReference dataReference = DataReferenceFacade.BuildDataReference(referencedType, objectValues[reference.FieldName]);\r\n                                    try\r\n                                    {\r\n                                        value = DataXhtmlRenderingServices.Render(dataReference, XhtmlRenderingType.Embedable).Root;\r\n                                    }\r\n                                    catch (Exception)\r\n                                    {\r\n                                        value = objectValues[reference.FieldName];\r\n                                    }\r\n                                }\r\n                            }\r\n                        }\r\n                        else\r\n                        {\r\n                            if (objectValues.ContainsKey(reference.FieldName)) // prevents unknown props from creating exceptions\r\n                            {\r\n                                value = objectValues[reference.FieldName];\r\n                            }\r\n                        }\r\n\r\n                        if (value!=null)\r\n                        {\r\n                            if (value.GetType() == typeof(DateTime))\r\n                            {\r\n                                DateTime dateTimeValue = (DateTime)value;\r\n\r\n                                if (dateTimeValue.TimeOfDay.TotalSeconds > 0)\r\n                                {\r\n                                    value = string.Format(\"{0} {1}\", dateTimeValue.ToShortDateString(), dateTimeValue.ToShortDateString());\r\n                                }\r\n                                else\r\n                                {\r\n                                    value = dateTimeValue.ToShortDateString();\r\n                                }\r\n                            }\r\n\r\n                            if (value.GetType() == typeof(string))\r\n                            {\r\n                                string stringValue = (string)value;\r\n\r\n                                if (stringValue.StartsWith(\"<html\") && stringValue.Contains(Namespaces.Xhtml.NamespaceName))\r\n                                {\r\n                                    try\r\n                                    {\r\n                                        value = XElement.Parse(stringValue);\r\n                                    }\r\n                                    catch { }\r\n                                }\r\n                                else if (stringValue.Contains('\\n'))\r\n                                {\r\n                                    string valueEncodedWithBr = HttpUtility.HtmlEncode(stringValue).Replace(\"\\n\", \"<br/>\");\r\n                                    value = XElement.Parse(string.Format(\"<body xmlns='{0}'>{1}</body>\", Namespaces.Xhtml, valueEncodedWithBr)).Nodes();\r\n                                }\r\n                            }\r\n                        }\r\n\r\n\r\n                        reference.FieldReferenceElement.ReplaceWith(value);\r\n                    }\r\n\r\n                    FunctionContextContainer fcc = new FunctionContextContainer(functionContextContainer, objectValues);\r\n\r\n                    PageRenderer.ExecuteEmbeddedFunctions(currentRowElementsContainer, fcc);\r\n\r\n                    outputDocument.Body.Add(currentRowElementsContainer.Elements());\r\n                }\r\n            }\r\n\r\n            return outputDocument;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/VisualFunctionProvider/VisualFunctionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.VisualFunctionProvider\r\n{\r\n    [ConfigurationElementType(typeof(VisualFunctionProviderData))]\r\n    internal sealed class VisualFunctionProvider : IDynamicTypeFunctionProvider\r\n    {\r\n        private FunctionNotifier _functionNotifier;\r\n\r\n        public VisualFunctionProvider()\r\n        {\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IVisualFunction>(OnDataChanged, false);\r\n        }\r\n\r\n\r\n\r\n        public FunctionNotifier FunctionNotifier\r\n        {\r\n            set { _functionNotifier = value; }\r\n        }\r\n\r\n\r\n        public IEnumerable<IFunction> Functions\r\n        {\r\n            get\r\n            {\r\n                yield break;\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        public IEnumerable<IFunction> DynamicTypeDependentFunctions\r\n        {\r\n            get\r\n            {\r\n                List<IVisualFunction> functions = DataFacade.GetData<IVisualFunction>().ToList();\r\n\r\n                var functionInfos =\r\n                    (from function in functions\r\n                     select new {\r\n                         DataType = TypeManager.TryGetType( function.TypeManagerName ),\r\n                         Function = function\r\n                     }).ToList();    \r\n\r\n                    foreach( var missingTypeFunctionInfo in functionInfos.Where( f=>f.DataType==null))\r\n                    {\r\n                        LoggingService.LogError(this.GetType().Name, string.Format(\"The function '{0}' in namespace '{1}' is dependant on an unknown type '{2}'. Function not loaded.\", missingTypeFunctionInfo.Function.Namespace, missingTypeFunctionInfo.Function.Name, missingTypeFunctionInfo.Function.TypeManagerName));\r\n                    }\r\n\r\n                return\r\n                    from fi in functionInfos\r\n                    where fi.DataType != null\r\n                    select (IFunction)Activator.CreateInstance(typeof(VisualFunction<>).MakeGenericType(fi.DataType), new object[] { fi.Function });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void OnDataChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            _functionNotifier.FunctionsUpdated();\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        private sealed class VisualFunction<T> : IFunction\r\n            where T : class, IData\r\n        {\r\n            private IVisualFunction _visualFunction;\r\n            private XhtmlDocument _templateDocument = null;\r\n            private DataTypeDescriptor _typeDescriptor = null;\r\n            private object _lock = new object();\r\n\r\n\r\n\r\n            public VisualFunction(IVisualFunction visualFunction)\r\n            {\r\n                _visualFunction = visualFunction;\r\n            }\r\n\r\n\r\n\r\n\r\n            public object Execute(ParameterList parameters, FunctionContextContainer context)\r\n            {\r\n                Initialize();\r\n                int maximumItemsToList = parameters.GetParameter<int>(\"MaximumItemsToList\");\r\n                string orderbyFieldName = parameters.GetParameter<string>(\"OrderbyFieldName\");\r\n                bool orderbyAscending = parameters.GetParameter<bool>(\"OrderbyAscending\");\r\n\r\n                Expression<Func<T, bool>> filter;\r\n                if (parameters.TryGetParameter<Expression<Func<T, bool>>>(\"Filter\", out filter) == false)\r\n                {\r\n                    filter = f => true;\r\n                }\r\n\r\n\r\n                var runtimeFunction = new RuntimeVisualFunction(_visualFunction, maximumItemsToList, orderbyFieldName, orderbyAscending);\r\n\r\n                return RenderingHelper.RenderDataList<T>(runtimeFunction, _templateDocument, _typeDescriptor, context, filter);\r\n            }\r\n\r\n\r\n\r\n\r\n            private void Initialize()\r\n            {\r\n                if (_templateDocument == null)\r\n                {\r\n                    lock (_lock)\r\n                    {\r\n                        if (_templateDocument == null)\r\n                        {\r\n                            Type interfaceType = TypeManager.GetType(_visualFunction.TypeManagerName);\r\n                            _typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n\r\n                            if (_typeDescriptor == null) throw new InvalidOperationException(string.Format(\"DataTypeDescriptor not found for type '{0}'\", interfaceType));\r\n\r\n                            _templateDocument = XhtmlDocument.Parse(_visualFunction.XhtmlTemplate);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public string Name\r\n            {\r\n                get\r\n                {\r\n                    return _visualFunction.Name;\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public string Namespace\r\n            {\r\n                get\r\n                {\r\n                    return _visualFunction.Namespace;\r\n                }\r\n            }\r\n\r\n\r\n            public string Description \r\n            { \r\n                get \r\n                {\r\n                    return _visualFunction.Description; \r\n                } \r\n            }\r\n\r\n\r\n            public Type ReturnType\r\n            {\r\n                get\r\n                {\r\n                    return typeof(XhtmlDocument);\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public IEnumerable<ParameterProfile> ParameterProfiles\r\n            {\r\n                get\r\n                {\r\n                    Initialize();\r\n\r\n                    //if (_typeDescriptor.DataAssociations.Where(f => f.AssociatedInterfaceType == typeof(IPage) && f.AssociationType == DataAssociationType.Aggregation).Any())\r\n                    //{\r\n                        Expression<Func<T, bool>> defaultFilter = f => true;\r\n\r\n                        yield return new ParameterProfile(\r\n                            \"Filter\",\r\n                            typeof(Expression<Func<T, bool>>),\r\n                            false,\r\n                            new ConstantValueProvider(defaultFilter),\r\n                            null,\r\n                            \"List Filter\",\r\n                            new HelpDefinition(\"The selection filter applied to the data to be shown. The default is no filtering.\"));\r\n                    //}\r\n\r\n                    WidgetFunctionProvider fieldsDropDown = StandardWidgetFunctions.DropDownList(\r\n                        this.GetType(), \"OrderByFieldNames\", _visualFunction.TypeManagerName, false, true, true);\r\n\r\n                    yield return new ParameterProfile(\"MaximumItemsToList\", typeof(int), false, new ConstantValueProvider(_visualFunction.MaximumItemsToList), StandardWidgetFunctions.IntegerTextBoxWidget, \"Item list length\", new HelpDefinition(\"The maximum number of items to show. Default value is \" + _visualFunction.MaximumItemsToList.ToString()));\r\n                    yield return new ParameterProfile(\"OrderbyFieldName\", typeof(string), false, new ConstantValueProvider(_visualFunction.OrderbyFieldName), fieldsDropDown, \"Item sorting\", new HelpDefinition(\"The field to use when sorting items. Use '(random)' to show random items. Default value is \" + _visualFunction.OrderbyFieldName));\r\n                    yield return new ParameterProfile(\"OrderbyAscending\", typeof(bool), false, new ConstantValueProvider(_visualFunction.OrderbyAscending), StandardWidgetFunctions.CheckBoxWidget, \"Sort ascending\", new HelpDefinition(\"When checked items are sorted in ascending order (alphabetically, chronological). This field is ignored when '(random)' sorting is active. Default value is \" + _visualFunction.OrderbyAscending.ToString()));\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public static IEnumerable<string> OrderByFieldNames(string typeManagerName)\r\n            {\r\n                yield return \"(random)\";\r\n\r\n                Type interfaceType = TypeManager.GetType(typeManagerName);\r\n                foreach (DataFieldDescriptor dataField in DynamicTypeManager.GetDataTypeDescriptor(interfaceType).Fields.OrderBy(f => f.Position))\r\n                {\r\n                    yield return dataField.Name;\r\n                }\r\n            }\r\n\r\n\r\n            public EntityToken EntityToken\r\n            {\r\n                get\r\n                {\r\n                    return _visualFunction.GetDataEntityToken();\r\n                }\r\n            }\r\n\r\n\r\n            private class RuntimeVisualFunction : IVisualFunction\r\n            {\r\n                private IVisualFunction _function;\r\n                private int _maximumItemsToList;\r\n                private string _orderbyFieldName;\r\n                private bool _orderbyAscending;\r\n\r\n                public RuntimeVisualFunction(IVisualFunction function, int maximumItemsToList, string orderbyFieldName, bool orderbyAscending)\r\n                {\r\n                    _function = function;\r\n                    _maximumItemsToList = maximumItemsToList;\r\n                    _orderbyFieldName = orderbyFieldName;\r\n                    _orderbyAscending = orderbyAscending;\r\n                }\r\n\r\n                public Guid Id \r\n                {\r\n                    get\r\n                    {\r\n                        return _function.Id;\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n                public string Name\r\n                {\r\n                    get\r\n                    {\r\n                        return _function.Name;\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n                public string Namespace\r\n                {\r\n                    get\r\n                    {\r\n                        return _function.Namespace;\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n                public string XhtmlTemplate\r\n                {\r\n                    get\r\n                    {\r\n                        return _function.XhtmlTemplate;\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n                public int MaximumItemsToList\r\n                {\r\n                    get\r\n                    {\r\n                        return _maximumItemsToList;\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n                public string OrderbyFieldName\r\n                {\r\n                    get\r\n                    {\r\n                        return _orderbyFieldName;\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n                public bool OrderbyAscending\r\n                {\r\n                    get\r\n                    {\r\n                        return _orderbyAscending;\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n\r\n                public DataSourceId DataSourceId\r\n                {\r\n                    get { throw new NotImplementedException(); }\r\n                }\r\n\r\n                public string TypeManagerName\r\n                {\r\n                    get\r\n                    {\r\n                        return _function.TypeManagerName;\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n\r\n                public string Description\r\n                {\r\n                    get\r\n                    {\r\n                        return _function.Description;\r\n\r\n                    }\r\n                    set\r\n                    {\r\n                        throw new NotImplementedException();\r\n                    }\r\n                }\r\n\r\n            }\r\n\r\n        }\r\n\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionProviderAssembler))]\r\n    internal sealed class VisualFunctionProviderData : FunctionProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/XsltBasedFunctionProvider/RenderHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\nusing Composite.Functions.ManagedParameters;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.Types;\r\nusing System.Reflection;\r\nusing System.Diagnostics;\r\nusing System.Collections;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.XsltBasedFunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class TransformationInputs\r\n    {\r\n        /// <exclude />\r\n        public XContainer InputDocument { get; set; }\r\n\r\n        /// <exclude />\r\n        public List<IXsltExtensionDefinition> ExtensionDefinitions { get; set; }\r\n    }\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public static class RenderHelper\r\n    {\r\n        /// <exclude />\r\n        public static readonly XNamespace XsltInput10 = \"http://www.composite.net/ns/transformation/input/1.0\";\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static TransformationInputs BuildInputDocument(IEnumerable<NamedFunctionCall> FunctionCalls, List<ManagedParameterDefinition> parameterDefinitions, bool addDetailedComments)\r\n        {\r\n            Dictionary<string, object> inputParameters = BuildTestParameterInput(parameterDefinitions);\r\n            return BuildInputDocument(FunctionCalls.ToList(), inputParameters, addDetailedComments);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static TransformationInputs BuildInputDocument(IEnumerable<NamedFunctionCall> FunctionCalls, ParameterList parameterList, bool addDetailedComments)\r\n        {\r\n            Dictionary<string, object> inputParameters = new Dictionary<string, object>();\r\n            List<string> parameterNames = parameterList.AllParameterNames.ToList();\r\n            object[] paramaterValues = new object[parameterNames.Count];\r\n\r\n            for(int i=0; i<parameterNames.Count; i++)\r\n            {\r\n                paramaterValues[i] = parameterList.GetParameter(parameterNames[i]);\r\n            };\r\n\r\n            for (int i = 0; i < parameterNames.Count; i++)\r\n            {\r\n                inputParameters.Add(parameterNames[i], paramaterValues[i]);\r\n            }\r\n\r\n            return BuildInputDocument(FunctionCalls.ToList(), inputParameters, addDetailedComments);\r\n        }\r\n\r\n        private static XElement CreateParameterNode(string parameterName, object value)\r\n        {\r\n            if (value is XDocument) value = ((XDocument)value).Root;\r\n            \r\n            return new XElement(XsltInput10 + \"param\",\r\n                      new XAttribute(\"name\", parameterName),\r\n                      value);\r\n        }\r\n\r\n        private static XElement CreateFunctionCallResultNode(string functionCallName, object result)\r\n        {\r\n            if (result is XDocument) result = ((XDocument)result).Root;\r\n\r\n            return\r\n                new XElement(XsltInput10 + \"result\",\r\n                // GetTypeAttribute(result),\r\n                    new XAttribute(\"name\", functionCallName),\r\n                    result);\r\n        }\r\n\r\n        private static TransformationInputs BuildInputDocument(List<NamedFunctionCall> namedFunctions, Dictionary<string, object> inputParameters, bool addDetailedComments)\r\n        {\r\n            var evaluatedParameters = new List<KeyValuePair<string, XElement>>();\r\n            var xslExtensions = new List<KeyValuePair<string, IXsltExtensionDefinition>>();\r\n\r\n            foreach(KeyValuePair<string, object> entry in inputParameters)\r\n            {\r\n                object value = entry.Value;\r\n                if(value is IXsltExtensionDefinition)\r\n                {\r\n                    xslExtensions.Add(new KeyValuePair<string, IXsltExtensionDefinition>(entry.Key, value as IXsltExtensionDefinition));\r\n                }\r\n                else\r\n                {\r\n                    evaluatedParameters.Add(new KeyValuePair<string, XElement>(entry.Key, CreateParameterNode(entry.Key, value)));\r\n                }\r\n            }\r\n            return BuildInputDocument2(namedFunctions, inputParameters, evaluatedParameters, xslExtensions, addDetailedComments);\r\n        }\r\n\r\n        private static TransformationInputs BuildInputDocument2(List<NamedFunctionCall> namedFunctions, Dictionary<string, object> inputParameters, List<KeyValuePair<string, XElement>> evaluatedParameterList, List<KeyValuePair<string, IXsltExtensionDefinition>> xslExtensions, bool addDetailedComments)\r\n        {\r\n            var transformationInputs = new TransformationInputs();\r\n\r\n            // NOTE: Attribute attributes from \"xsi\" namespaces aren't used\r\n            // XElement inputRoot = XElement.Parse(string.Format(@\"<in:inputs xmlns:in=\"\"{0}\"\" xmlns:xsi=\"\"{1}\"\" xmlns:xsd=\"\"{2}\"\" />\", XsltInput10, Namespaces.Xsi, Namespaces.Xsd));\r\n\r\n            XElement inputRoot = XElement.Parse(@\"<in:inputs xmlns:in=\"\"{0}\"\" />\".FormatWith(XsltInput10));\r\n\r\n            transformationInputs.InputDocument = inputRoot;\r\n\r\n            // Adding XSL extensions\r\n            if(xslExtensions.Count > 0)\r\n            {\r\n                foreach (KeyValuePair<string, IXsltExtensionDefinition> xslExtension in xslExtensions)\r\n                {\r\n                    IXsltExtensionDefinition extensionDefinition = xslExtension.Value;\r\n\r\n                    transformationInputs.ExtensionDefinitions = transformationInputs.ExtensionDefinitions ?? new List<IXsltExtensionDefinition>();\r\n                    transformationInputs.ExtensionDefinitions.Add(extensionDefinition);\r\n\r\n                    if (addDetailedComments)\r\n                    {\r\n                        inputRoot.Add(new XComment(string.Format(\" Input Parameter '{0}' has been registered as an Xslt Entension Object. Methods on '{1}' can be called using the namespace '{2}' and format 'prefix:MethodName( arguments )'. \", xslExtension.Key, extensionDefinition.EntensionObjectAsObject.GetType().FullName, extensionDefinition.ExtensionNamespace)));\r\n                    }\r\n                }\r\n            }\r\n\r\n            // Adding input parameters\r\n            if (evaluatedParameterList.Count > 0)\r\n            {\r\n                foreach (KeyValuePair<string, XElement> parameter in evaluatedParameterList)\r\n                {\r\n                    if (addDetailedComments)\r\n                    {\r\n                        inputRoot.Add(new XComment(string.Format(\" Input Parameter, XPath /in:inputs/in:param[@name='{0}'] \", parameter.Key)));\r\n                    }\r\n                    inputRoot.Add(parameter.Value);\r\n                }\r\n            }\r\n\r\n            if (namedFunctions.Count > 0)\r\n            {\r\n                var functionCallResults = new object[namedFunctions.Count];\r\n                var functionCallExecutionTimes = new long[namedFunctions.Count];\r\n\r\n                for(int i=0; i<namedFunctions.Count; i++)\r\n                {\r\n                    FunctionContextContainer functionContextContainer = new FunctionContextContainer(inputParameters);\r\n\r\n                    var namedFunctionCall = namedFunctions[i];\r\n                    object result = null;\r\n                    Stopwatch executionStopwatch = Stopwatch.StartNew();\r\n                    try\r\n                    {\r\n                        result = GetFunctionCallResult(functionContextContainer, namedFunctionCall, addDetailedComments);\r\n\r\n                        executionStopwatch.Stop();\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        throw new InvalidOperationException(string.Format(\"Failed to execute function with local name '{0}'\", namedFunctionCall.Name), ex);\r\n                    }\r\n\r\n                    functionCallResults[i] = result;\r\n                    functionCallExecutionTimes[i] = executionStopwatch.ElapsedMilliseconds;\r\n                };\r\n\r\n                \r\n                for (int i=0; i<namedFunctions.Count; i++)\r\n                {\r\n                    object result = functionCallResults[i];\r\n\r\n                    if (result is IXsltExtensionDefinition)\r\n                    {\r\n                        IXsltExtensionDefinition extensionDefinition = (IXsltExtensionDefinition)result;\r\n                        transformationInputs.ExtensionDefinitions = transformationInputs.ExtensionDefinitions ?? new List<IXsltExtensionDefinition>();\r\n                        transformationInputs.ExtensionDefinitions.Add(extensionDefinition);\r\n\r\n                        if (addDetailedComments)\r\n                        {\r\n                            string name = namedFunctions[i].Name;\r\n                            inputRoot.Add(new XComment(string.Format(\" Function call result '{0}' has been registered as an Xslt Entension Object. \", name, extensionDefinition.ExtensionNamespace)));\r\n                            inputRoot.Add(new XComment(string.Format(\" Extension methods can be called using the namespace '{1}'. \", name, extensionDefinition.ExtensionNamespace)));\r\n                            inputRoot.Add(new XComment(\" The following methods exist: \"));\r\n                            foreach (MethodInfo mi in extensionDefinition.EntensionObjectAsObject.GetType().GetMethods().Where(m => m.DeclaringType != typeof(object)))\r\n                            {\r\n                                string paramsInfo = string.Join(\", \", mi.GetParameters().Select(p => string.Format(\"{0} {1}\", p.ParameterType.Name, p.Name)).ToArray());\r\n                                string returnTypeName = (mi.ReturnType != null ? mi.ReturnType.Name : \"void\");\r\n                                inputRoot.Add(new XComment(string.Format(\" {0} ns:{1}({2}) \", returnTypeName, mi.Name, paramsInfo)));\r\n                            }\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        Verify.That(result is XElement, \"Function call result had to be selialized as XElement\");\r\n\r\n                        if (addDetailedComments)\r\n                        {\r\n                            string xpathAppend = FindElementXPathAppend(result);\r\n\r\n                            inputRoot.Add(new XComment(string.Format(\" Function Call Result ({0} ms), XPath /in:inputs/in:result[@name='{1}']{2} \", functionCallExecutionTimes[i], namedFunctions[i].Name, xpathAppend)));\r\n                        }\r\n\r\n                        inputRoot.Add(result as XElement);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return transformationInputs;\r\n        }\r\n\r\n\r\n        private static string FindElementXPathAppend(object result)\r\n        {\r\n            string xpathAppend = \"\";\r\n\r\n            XElement firstResultElement = ((XElement)result).Elements().FirstOrDefault();\r\n            if (firstResultElement !=null)\r\n            {\r\n                XElement resultElementCopy = new XElement(firstResultElement);\r\n                resultElementCopy.Elements().Remove();\r\n                string serializedNode = resultElementCopy.ToString();\r\n                char[] nameEndChars = new char[] { ' ', '/', '>' };\r\n                xpathAppend = \"/\" + serializedNode.Substring(1, serializedNode.IndexOfAny(nameEndChars));\r\n            }\r\n            return xpathAppend;\r\n        }\r\n\r\n\r\n\r\n        private static object GetFunctionCallResult(FunctionContextContainer functionContextContainer, NamedFunctionCall namedFunctionCall, bool addDetailedComments)\r\n        {\r\n            object result = namedFunctionCall.FunctionCall.GetValue(functionContextContainer);\r\n\r\n            if (!(result is IXsltExtensionDefinition))\r\n            {\r\n                if (addDetailedComments)\r\n                {\r\n                    if (result is IEnumerable<XElement>) result = ((IEnumerable<XElement>)result).ToList(); // timers dont like lazy stuff, so evaluate now\r\n                    if (result is IEnumerable<XNode>) result = ((IEnumerable<XNode>)result).ToList(); // timers dont like lazy stuff, so evaluate now\r\n                }\r\n\r\n                result = CreateFunctionCallResultNode(namedFunctionCall.Name, result);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n\r\n        //private static XAttribute GetTypeAttribute(object data)\r\n        //{\r\n        //    if (data == null) return null;\r\n\r\n        //    Type dataType = data.GetType();\r\n\r\n        //    if (dataType == typeof(string)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:string\");\r\n        //    if (dataType == typeof(XElement)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:any\");\r\n        //    if (dataType == typeof(int)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:integer\");\r\n        //    if (dataType == typeof(Int32)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:int\");\r\n        //    if (dataType == typeof(long)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:integer\");\r\n        //    if (dataType == typeof(bool)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:boolean\");\r\n        //    if (dataType == typeof(DateTime)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:dateTime\");\r\n        //    if (dataType == typeof(TimeSpan)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:duration\");\r\n        //    if (dataType == typeof(Uri)) return new XAttribute(Namespaces.Xsi + \"type\", \"xsd:anyURI\");\r\n\r\n        //    return null;\r\n        //}\r\n\r\n        internal static IEnumerable<NamedFunctionCall> GetValidatedFunctionCalls(Guid xsltFunctionId)\r\n        {\r\n            List<string> errors;\r\n            IEnumerable<NamedFunctionCall> result = GetValidFunctionCalls(xsltFunctionId, out errors);\r\n\r\n            if (errors != null && errors.Any())\r\n            {\r\n                throw new InvalidOperationException(errors.First());\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static IEnumerable<NamedFunctionCall> GetValidFunctionCalls(Guid xsltFunctionId, out List<string> errors)\r\n        {\r\n            errors = null;\r\n            List<NamedFunctionCall> result = new List<NamedFunctionCall>();\r\n\r\n            foreach (INamedFunctionCall namedFunctionCallData in DataFacade.GetData<INamedFunctionCall>(f => f.XsltFunctionId == xsltFunctionId))\r\n            {\r\n                XElement functionElement = XElement.Parse(namedFunctionCallData.SerializedFunction);\r\n\r\n                FunctionRuntimeTreeNode function = null;\r\n\r\n                try\r\n                {\r\n                    function = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(functionElement);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    string errDescriptionForLog = string.Format(\"XSLT Function call markup for failed to parse ('{0}').\\nThe markup was \\n{1}\", ex.Message, functionElement);\r\n                    string errDescriptionForUser = string.Format(\"XSLT Function call markup for failed to parse ('{0}').\\nPlease see server log for more details.\", ex.Message);\r\n                    LoggingService.LogError(\"Function parse error\", errDescriptionForLog);\r\n\r\n                    if (errors == null)\r\n                        errors = new List<string>();\r\n\r\n                    errors.Add(errDescriptionForUser);\r\n                }\r\n\r\n                if (function != null)\r\n                {\r\n                    result.Add( new NamedFunctionCall(namedFunctionCallData.Name, function));\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n\r\n        private static Dictionary<string, object> BuildTestParameterInput(IEnumerable<ManagedParameterDefinition> parameters)\r\n        {\r\n            Dictionary<string, object> inputValues = new Dictionary<string, object>();\r\n\r\n            foreach (ManagedParameterDefinition parameterDefinition in parameters)\r\n            {\r\n                object value = null;\r\n                if (string.IsNullOrEmpty(parameterDefinition.TestValueFunctionMarkup) == false)\r\n                {\r\n                    FunctionRuntimeTreeNode functionNode = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(XElement.Parse(parameterDefinition.TestValueFunctionMarkup));\r\n                    value = functionNode.GetValue();\r\n                }\r\n                else\r\n                {\r\n                    if (string.IsNullOrEmpty(parameterDefinition.DefaultValueFunctionMarkup) == false)\r\n                    {\r\n                        FunctionRuntimeTreeNode functionNode = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(XElement.Parse(parameterDefinition.DefaultValueFunctionMarkup));\r\n                        value = functionNode.GetValue();\r\n                    }\r\n                }\r\n\r\n                if (value != null)\r\n                {\r\n                    if (parameterDefinition.Type.IsAssignableFrom(value.GetType()) == false)\r\n                    {\r\n                        value = ValueTypeConverter.Convert(value, parameterDefinition.Type);\r\n                    }\r\n\r\n                    inputValues.Add(parameterDefinition.Name, value);\r\n                }\r\n            }\r\n\r\n            return inputValues;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/FunctionProviders/XsltBasedFunctionProvider/XsltBasedFunctionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Xsl;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Streams;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.ManagedParameters;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.FunctionProviders.XsltBasedFunctionProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public enum OutputXmlSubType\r\n    {\r\n        /// <exclude />\r\n        XHTML = 0,\r\n\r\n        /// <exclude />\r\n        XML = 1\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ConfigurationElementType(typeof(XsltBasedFunctionProviderData))]\r\n    public sealed class XsltBasedFunctionProvider : IDynamicTypeFunctionProvider\r\n    {\r\n        private FunctionNotifier _functionNotifier;\r\n\r\n\r\n        /// <exclude />\r\n        public XsltBasedFunctionProvider()\r\n        {\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IXsltFunction>(OnDataChanged, false);\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public FunctionNotifier FunctionNotifier\r\n        {\r\n            set { _functionNotifier = value; }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<IFunction> DynamicTypeDependentFunctions\r\n        {\r\n            get\r\n            {\r\n                return\r\n                    (from f in DataFacade.GetData<IXsltFunction>().ToList()\r\n                     select new XsltXmlFunction(f) as IFunction).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<IFunction> Functions => Enumerable.Empty<IFunction>();\r\n\r\n\r\n\r\n        private void OnDataChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!SystemSetupFacade.SetupIsRunning)\r\n            {\r\n                _functionNotifier.FunctionsUpdated();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static void ResolveImportIncludePaths(XContainer doc)\r\n        {\r\n            IEnumerable<XElement> imports = doc.Descendants().Where(\r\n                f => f.Name == Namespaces.Xsl + \"import\" \r\n                  || f.Name == Namespaces.Xsl + \"include\");\r\n\r\n            foreach (XElement import in imports)\r\n            {\r\n                XAttribute hrefAttribute = import.Attribute(\"href\");\r\n                if (hrefAttribute != null && hrefAttribute.Value.StartsWith(\"~/\"))\r\n                {\r\n                    hrefAttribute.Value = PathUtil.Resolve(hrefAttribute.Value);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        private sealed class XsltXmlFunction : IFunction\r\n        {\r\n            private readonly IXsltFunction _xsltFunction; // go through XsltFunction instead of this\r\n            private IEnumerable<ParameterProfile> _parameterProfiles;\r\n            private volatile IEnumerable<NamedFunctionCall> _functionCalls;\r\n            private readonly object _lock = new object();\r\n            private bool _subscribedToFileChanges;\r\n            private readonly Hashtable<CultureInfo, XslCompiledTransform> _xslTransformations = new Hashtable<CultureInfo, XslCompiledTransform>();\r\n\r\n\r\n            public XsltXmlFunction(IXsltFunction xsltFunction)\r\n            {\r\n                _xsltFunction = xsltFunction;\r\n            }\r\n\r\n\r\n\r\n            public object Execute(ParameterList parameters, FunctionContextContainer context)\r\n            {\r\n                Guid xsltFunctionId = this._xsltFunction.Id;\r\n\r\n                if (_functionCalls == null)\r\n                {\r\n                    lock (_lock)\r\n                    {\r\n                        if (_functionCalls == null)\r\n                        {\r\n                            _functionCalls = RenderHelper.GetValidatedFunctionCalls(xsltFunctionId);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                TransformationInputs transformationInput = RenderHelper.BuildInputDocument(_functionCalls, parameters, false);\r\n\r\n                XDocument newTree = new XDocument();\r\n\r\n                using (XmlWriter writer = new LimitedDepthXmlWriter(newTree.CreateWriter()))\r\n                {\r\n                    var transformArgs = new XsltArgumentList();\r\n                    XslExtensionsManager.Register(transformArgs);\r\n\r\n                    if (transformationInput.ExtensionDefinitions != null)\r\n                    {\r\n                        foreach (IXsltExtensionDefinition extensionDef in transformationInput.ExtensionDefinitions)\r\n                        {\r\n                            transformArgs.AddExtensionObject(extensionDef.ExtensionNamespace.ToString(), extensionDef.EntensionObjectAsObject);\r\n                        }\r\n                    }\r\n\r\n                    var xslTransformer = GetXslCompiledTransform();\r\n                    xslTransformer.Transform(transformationInput.InputDocument.CreateReader(), transformArgs, writer);\r\n                }\r\n\r\n                if (this._xsltFunction.OutputXmlSubType == nameof(OutputXmlSubType.XHTML))\r\n                {\r\n                    return new XhtmlDocument(newTree);\r\n                }\r\n\r\n                return newTree.Root;\r\n            }\r\n\r\n\r\n\r\n            private XslCompiledTransform GetXslCompiledTransform()\r\n            {\r\n                var currentCultureInfo = LocalizationScopeManager.CurrentLocalizationScope;\r\n                XslCompiledTransform xslCompiledTransform;\r\n\r\n                if (_xslTransformations.TryGetValue(currentCultureInfo, out xslCompiledTransform))\r\n                {\r\n                    return xslCompiledTransform;\r\n                }\r\n\r\n                lock (_lock)\r\n                {\r\n                    if (!_xslTransformations.TryGetValue(currentCultureInfo, out xslCompiledTransform))\r\n                    {\r\n                        xslCompiledTransform = BuildCompiledTransform();\r\n\r\n                        _xslTransformations.Add(currentCultureInfo, xslCompiledTransform);\r\n                    }\r\n                }\r\n                return xslCompiledTransform;\r\n            }\r\n\r\n            private XslCompiledTransform BuildCompiledTransform()\r\n            {\r\n                using (DebugLoggingScope.CompletionTime(this.GetType(), $\"Loading and compiling {_xsltFunction.XslFilePath}\"))\r\n                {\r\n                    string folderPath = Path.GetDirectoryName(_xsltFunction.XslFilePath);\r\n                    string fileName = Path.GetFileName(_xsltFunction.XslFilePath);\r\n\r\n                    IXsltFile xsltFileHandle;\r\n\r\n                    try\r\n                    {\r\n                        var xsltFileHandles =\r\n                        (from file in DataFacade.GetData<IXsltFile>()\r\n                            where String.Equals(file.FolderPath, folderPath, StringComparison.OrdinalIgnoreCase)\r\n                                  && String.Equals(file.FileName, fileName, StringComparison.OrdinalIgnoreCase)\r\n                            select file).ToList();\r\n\r\n                        Verify.That(xsltFileHandles.Count == 1, \"XSLT file path {0} found {1} times. Only one instance was expected.\", _xsltFunction.XslFilePath, xsltFileHandles.Count);\r\n                        xsltFileHandle = xsltFileHandles[0];\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(\"XsltBasedFunctionProvider\", ex);\r\n                        throw;\r\n                    }\r\n\r\n                    if (!_subscribedToFileChanges)\r\n                    {\r\n                        xsltFileHandle.SubscribeOnChanged(ClearCachedData);\r\n                        _subscribedToFileChanges = true;\r\n                    }\r\n\r\n                    var xslCompiledTransform = new XslCompiledTransform();\r\n\r\n\r\n                    XDocument doc;\r\n                    using (Stream xsltSourceStream = xsltFileHandle.GetReadStream())\r\n                    {\r\n                        using (XmlReader xmlReader = XmlReader.Create(xsltSourceStream))\r\n                        {\r\n                            doc = XDocument.Load(xmlReader);\r\n                        }\r\n                    }\r\n\r\n                    ResolveImportIncludePaths(doc);\r\n\r\n                    LocalizationParser.Parse(doc);\r\n\r\n                    xslCompiledTransform.Load(doc.CreateReader(), XsltSettings.TrustedXslt, new XmlUrlResolver());\r\n\r\n\r\n                    return xslCompiledTransform;\r\n                }\r\n            }\r\n\r\n            private void ClearCachedData(string filePath, FileChangeType changeType)\r\n            {\r\n                lock(_lock)\r\n                {\r\n                    _xslTransformations.Clear();\r\n                }\r\n            }\r\n\r\n\r\n            public string Name => _xsltFunction.Name;\r\n\r\n\r\n            public string Namespace => _xsltFunction.Namespace;\r\n\r\n\r\n            public string Description => _xsltFunction.Description;\r\n\r\n\r\n            public Type ReturnType\r\n            {\r\n                get\r\n                {\r\n                    switch (this._xsltFunction.OutputXmlSubType)\r\n                    {\r\n                        case \"XHTML\":\r\n                            return typeof(XhtmlDocument);\r\n                        default:\r\n                            return typeof(XElement);\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n\r\n            public IEnumerable<ParameterProfile> ParameterProfiles\r\n            {\r\n                get\r\n                {\r\n                    if (_parameterProfiles == null)\r\n                    {\r\n                        lock (_lock)\r\n                        {\r\n                            if (_parameterProfiles == null)\r\n                            {\r\n                                _parameterProfiles = ManagedParameterManager.GetParameterProfiles(_xsltFunction.Id);\r\n                            }\r\n                        }\r\n                    }\r\n                    return _parameterProfiles;\r\n                }\r\n            }\r\n\r\n\r\n            public EntityToken EntityToken => _xsltFunction.GetDataEntityToken();\r\n        }\r\n\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableFunctionProviderAssembler))]\r\n    internal sealed class XsltBasedFunctionProviderData : FunctionProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Bool/BoolSelectorWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Bool\r\n{\r\n    internal sealed class BoolSelectorWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"BoolSelector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Bool.\" + _functionName;\r\n\r\n        public const string TrueLabelParameterName = \"TrueLabel\";\r\n        public const string FalseLabelParameterName = \"FalseLabel\";\r\n\r\n        public BoolSelectorWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(bool), entityTokenFactory)\r\n        {\r\n            SetParameterProfiles( true, \"True\", \"False\");\r\n        }\r\n\r\n        public BoolSelectorWidgetFuntion(EntityTokenFactory entityTokenFactory, string trueLabel, string falseLabel)\r\n            : base(CompositeName, typeof(bool), entityTokenFactory)\r\n        {\r\n            SetParameterProfiles(false, trueLabel, falseLabel);\r\n        }\r\n\r\n        private void SetParameterProfiles(bool require, string trueLabel, string falseLabel)\r\n        {\r\n            ParameterProfile trueLabelPP =\r\n                new ParameterProfile(BoolSelectorWidgetFuntion.TrueLabelParameterName,\r\n                    typeof(string), require,\r\n                    new ConstantValueProvider(trueLabel), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"True label\", new HelpDefinition(\"Label to show when value is true\"));\r\n\r\n            ParameterProfile falseLabelPP =\r\n                new ParameterProfile(BoolSelectorWidgetFuntion.FalseLabelParameterName,\r\n                    typeof(string), require,\r\n                    new ConstantValueProvider(falseLabel), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"False label\", new HelpDefinition(\"Label to show when value is false\"));\r\n\r\n            base.AddParameterProfile(trueLabelPP);\r\n            base.AddParameterProfile(falseLabelPP);\r\n        }\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement boolSelectorMarkup = base.BuildBasicWidgetMarkup(\"BoolSelector\", \"IsTrue\", label, help, bindingSourceName);\r\n\r\n            boolSelectorMarkup.Add(new XAttribute(\"TrueLabel\", parameters.GetParameter<string>(BoolSelectorWidgetFuntion.TrueLabelParameterName)));\r\n            boolSelectorMarkup.Add(new XAttribute(\"FalseLabel\", parameters.GetParameter<string>(BoolSelectorWidgetFuntion.FalseLabelParameterName)));\r\n\r\n            return boolSelectorMarkup;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Bool/CheckBoxWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Bool\r\n{\r\n    internal sealed class CheckBoxWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"CheckBox\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Bool.\" + _functionName;\r\n\r\n\r\n        public CheckBoxWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(bool), entityTokenFactory)\r\n        {\r\n            ParameterProfile pp =\r\n                new ParameterProfile(\"ItemLabel\", typeof(string), false,\r\n                    new ConstantValueProvider(\"\"), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"Sub label\", new HelpDefinition(\"Text to whow beside the checkbox\"));\r\n\r\n            base.AddParameterProfile(pp);\r\n        }\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement checkBoxMarkup = base.BuildBasicWidgetMarkup(\"CheckBox\", \"Checked\", label, help, bindingSourceName);\r\n\r\n            string itemLabel = parameters.GetParameter<string>(\"ItemLabel\");\r\n\r\n            if (string.IsNullOrEmpty(itemLabel) == false)\r\n            {\r\n                checkBoxMarkup.Add(new XAttribute(\"ItemLabel\", itemLabel));\r\n            }\r\n\r\n            return checkBoxMarkup;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/DataReference/DataReferenceSelectorWidgetFunction.cs",
    "content": "﻿using System.Collections;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataReferenceSelectorWidgetFunction<T> : CompositeWidgetFunctionBase\r\n         where T : class, IData\r\n    {\r\n        private const string _compositeNameBase = CompositeWidgetFunctionBase.CommonNamespace + \".DataReference.\";\r\n\r\n        /// <exclude />\r\n        public DataReferenceSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(DataReference<T>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        internal static string CompositeName\r\n        {\r\n            get\r\n            {\r\n                return _compositeNameBase + typeof(T).FullName.Replace(\".\", \"\") + \".Selector\";\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n        {\r\n            return StandardWidgetFunctions.BuildStaticCallPopulatedSelectorFormsMarkup(\r\n                    parameters,\r\n                    label,\r\n                    helpDefinition,\r\n                    bindingSourceName,\r\n                    this.GetType(),\r\n                    \"GetOptions\",\r\n                    TypeManager.SerializeType(typeof(T)),\r\n                    \"Key\",\r\n                    \"Label\",\r\n                    false,\r\n                    true,\r\n                    true,\r\n                    false);\r\n        }\r\n\r\n        /// <summary>\r\n        /// To be called through reflection\r\n        /// </summary>\r\n        /// <exclude />\r\n        public static IEnumerable GetOptions(string typeManagerName)\r\n        {\r\n            return GetOptionsCommon.GetOptions(typeManagerName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/DataReference/GetOptionsCommon.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Collections;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Data;\r\nusing System.Reflection;\r\n\r\n\r\nusing TypeInfo = Composite.Core.Types.Pair<System.Type, Composite.Data.DynamicTypes.DataTypeDescriptor>;\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference\r\n{\r\n\tinternal static class GetOptionsCommon\r\n\t{\r\n        private static readonly Cache<string, TypeInfo> _typeLookup = new Cache<string, TypeInfo>(\"GetOptionsCommon. Type info lookup\", 150);\r\n\r\n        internal static IEnumerable GetOptions(string typeManagerName)\r\n        {\r\n            Type t = GetTypeInfo(typeManagerName).First;\r\n\r\n            switch (t.FullName)\r\n            {\r\n                case \"Composite.Data.Types.IPage\":\r\n\r\n#pragma warning disable 612\r\n                    foreach (KeyValuePair<System.Guid, string> pageItem in PageStructureInfo.PageListInDocumentOrder())\r\n#pragma warning restore 612\r\n                    {\r\n                        yield return new { Key = pageItem.Key, Label = pageItem.Value };\r\n                    }\r\n                    break;\r\n                default:\r\n                    foreach (KeyValuePair pageItem in GetOptionsForDefault(t, typeManagerName))\r\n                    {\r\n                        yield return new { Key = pageItem.Key, Label = pageItem.Value };\r\n                    }\r\n                    break;\r\n            }\r\n\r\n        }\r\n\r\n\r\n        private static IEnumerable<KeyValuePair> GetOptionsForDefault(Type t, string typeManagerName)\r\n        {\r\n            DataTypeDescriptor dtd = GetTypeInfo(typeManagerName).Second;\r\n\r\n            Verify.That(dtd.KeyPropertyNames.Count == 1, \"Unable to deliver data for selector widget. The selected type '{0}' should have exactly one key property.\".FormatWith(typeManagerName));\r\n\r\n            string keyFieldName = dtd.KeyPropertyNames[0];\r\n\r\n            var allData = DataFacade.GetData(t)\r\n                .ToDataList()\r\n                .Select(data => new { Data = data, Label = data.GetLabel(true) })\r\n                .OrderBy(data => data.Label);\r\n\r\n            PropertyInfo keyPi = t.GetPropertiesRecursively(f => f.Name == keyFieldName).FirstOrDefault();\r\n            Verify.That(keyPi != null, \"The type '{0}' has invalid meta data. The specified key property '{1}' not found.\", typeManagerName, keyFieldName);\r\n\r\n            return\r\n                from data in allData\r\n                select new KeyValuePair { Key = (keyPi.GetValue(data.Data, new object[] { }) ?? \"\").ToString(), Value = data.Label };\r\n        }\r\n\r\n\r\n        private static TypeInfo GetTypeInfo(string typeManagerName)\r\n        {\r\n            TypeInfo cachedValue = _typeLookup.Get(typeManagerName);\r\n            if(cachedValue != null)\r\n            {\r\n                return cachedValue;\r\n            }\r\n\r\n            Type type = TypeManager.GetType(typeManagerName);\r\n            DataTypeDescriptor typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n\r\n            var result = new TypeInfo(type, typeDescriptor);\r\n            _typeLookup.Add(typeManagerName, result);\r\n            return result;\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/DataReference/HomePageSelectorWidgetFunction.cs",
    "content": "using System.Collections;\nusing System.Xml.Linq;\nusing Composite.Core.WebClient.Renderings.Page;\nusing Composite.Data;\nusing Composite.Data.Types;\nusing Composite.Functions;\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\n\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference\n{\n    /// <summary>    \n    /// </summary>\n    /// <exclude />\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n    public sealed class HomePageSelectorWidgetFunction : CompositeWidgetFunctionBase\n    {\n        /// <exclude />\n        public HomePageSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\n            : base(CompositeName, typeof(DataReference<IPage>), entityTokenFactory)\n        {\n        }\n\n        private const string CompositeName = CommonNamespace + \".DataReference\" + \".HomePageSelector\";\n\n        /// <exclude />\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\n        {\n            return StandardWidgetFunctions.BuildStaticCallPopulatedSelectorFormsMarkup(\n                parameters: parameters,\n                label: label,\n                helpDefinition: helpDefinition,\n                bindingSourceName: bindingSourceName,\n                optionsGeneratingStaticType: typeof(HomePageSelectorWidgetFunction),\n                optionsGeneratingStaticMethodName: nameof(GetHomePages),\n                optionsGeneratingStaticMethodParameterValue: null,\n                optionsObjectKeyPropertyName: \"Key\",\n                optionsObjectLabelPropertyName: \"Label\",\n                multiSelect: false,\n                compactMode: true,\n                required: true,\n                bindToString: false);\n        }\n\n        /// <summary>\n        /// To be called through reflection\n        /// </summary>\n        /// <exclude />\n        public static IEnumerable GetHomePages()\n        {\n            foreach (var element in PageStructureInfo.GetSiteMap())\n            {\n                yield return new\n                {\n                    Key = PageStructureInfo.GetIdForPageElement(element),\n                    Label = PageStructureInfo.GetLabelForPageElement(\"\", element)\n                };\n            }\n        }\n    }\n}"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/DataReference/NullableDataReferenceSelectorWidgetFunction.cs",
    "content": "﻿using System.Collections;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class NullableDataReferenceSelectorWidgetFunction<T> : CompositeWidgetFunctionBase\r\n         where T : class, IData\r\n    {\r\n        private const string _compositeNameBase = CompositeWidgetFunctionBase.CommonNamespace + \".DataReference.\";\r\n\r\n        /// <exclude />\r\n        public NullableDataReferenceSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(NullableDataReference<T>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        internal static string CompositeName\r\n        {\r\n            get\r\n            {\r\n                return _compositeNameBase + typeof(T).FullName.Replace(\".\", \"\") + \".OptionalSelector\";\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n        {\r\n            return StandardWidgetFunctions.BuildStaticCallPopulatedSelectorFormsMarkup(\r\n                    parameters,\r\n                    label,\r\n                    helpDefinition,\r\n                    bindingSourceName,\r\n                    this.GetType(),\r\n                    \"GetOptions\",\r\n                    TypeManager.SerializeType(typeof(T)),\r\n                    \"Key\",\r\n                    \"Label\",\r\n                    false,\r\n                    true,\r\n                    false,\r\n                    false);\r\n        }\r\n\r\n        /// <summary>\r\n        /// To be called through reflection\r\n        /// </summary>\r\n        /// <exclude />\r\n        public static IEnumerable GetOptions(string typeManagerName)\r\n        {\r\n            return GetOptionsCommon.GetOptions(typeManagerName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/DataReference/NullablePageReferenceSelectorWidgetFunction.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Data;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference\r\n{\r\n    internal sealed class NullablePageReferenceSelectorWidgetFunction : PageReferenceSelectorWidgetFunctionBase\r\n    {\r\n        public const string CompositeName = CompositeNameBase + \".OptionalPageSelector\";\r\n\r\n        public NullablePageReferenceSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(NullableDataReference<IPage>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override bool IsNullable()\r\n        {\r\n            return true;\r\n        }\r\n    };\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/DataReference/PageReferenceSelectorWidgetFunction.cs",
    "content": "using Composite.Data;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference\r\n{\r\n    internal sealed class PageReferenceSelectorWidgetFunction : PageReferenceSelectorWidgetFunctionBase\r\n    {\r\n        public const string CompositeName = CompositeNameBase + \".PageSelector\";\r\n\r\n        public PageReferenceSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(DataReference<IPage>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        protected override bool IsNullable()\r\n        {\r\n            return false;\r\n        }\r\n    };\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/DataReference/PageReferenceSelectorWidgetFunctionBase.cs",
    "content": "using Composite.Core.Types;\nusing Composite.Core.Xml;\nusing Composite.Data.Types;\nusing Composite.Functions;\nusing Composite.Plugins.Elements.ElementProviders.PageElementProvider;\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\nusing System;\nusing System.Xml.Linq;\n\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference\n{\n    internal abstract class PageReferenceSelectorWidgetFunctionBase : CompositeWidgetFunctionBase\n    {\n        protected const string CompositeNameBase = CommonNamespace + \".DataReference\";\n\n\n        private const string HomePageIdParameterName = \"HomePageId\";\n        protected PageReferenceSelectorWidgetFunctionBase(string compositeName, Type returnType, EntityTokenFactory entityTokenFactory) : base(compositeName, returnType, entityTokenFactory)\n        {\n            base.AddParameterProfile(\n                new ParameterProfile(HomePageIdParameterName, typeof(Guid?), false,\n                    new ConstantValueProvider(null), new WidgetFunctionProvider(new HomePageSelectorWidgetFunction(entityTokenFactory)), null,\n                    \"Filter by Home Page\", new HelpDefinition(\"Use this field to filter by root website. If not set all websites are shown. You can use GetPageId function to get current page\")));\n        }\n\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\n        {\n            var selector = BuildBasicWidgetMarkup(\"DataReferenceTreeSelector\", \"Selected\", label, helpDefinition, bindingSourceName);\n\n            selector.Add(\n                new XAttribute(\"Handle\", \"Composite.Management.PageIdSelectorDialog\"),\n                new XAttribute(\"DataType\", TypeManager.SerializeType(typeof(IPage))),\n                new XAttribute(\"NullValueAllowed\", IsNullable())\n            );\n            var searchToken = GetSearchToken(parameters, selector);\n            if (searchToken != null)\n                selector.Add(searchToken);\n\n            return selector;\n        }\n\n        private XElement GetSearchToken(ParameterList parameters, XElement selector)\n        {\n            var parameter = GetParameterElement(parameters);\n            if (parameter == null)\n                return null;\n\n            var f = Namespaces.BindingFormsStdFuncLib10;\n            var element = new XElement(selector.Name.Namespace + \"DataReferenceTreeSelector.SearchToken\",\n                new XElement(f + \"StaticMethodCall\",\n                    new XAttribute(\"Type\", TypeManager.SerializeType(typeof(PageReferenceSelectorWidgetFunctionBase))),\n                    new XAttribute(\"Method\", nameof(GetPageSearchToken)),\n                    new XElement(f + \"StaticMethodCall.Parameters\", parameter)));\n\n            return element;\n        }\n\n        private object GetParameterElement(ParameterList parameters)\n        {\n            if (!parameters.TryGetParameterRuntimeTreeNode(HomePageIdParameterName, out var runtimeTreeNode))\n            {\n                return null;\n            }\n\n            if (runtimeTreeNode is FunctionParameterRuntimeTreeNode functionParamNode)\n            {\n                return functionParamNode.GetHostedFunction().Serialize();\n            }\n\n            if (runtimeTreeNode is ConstantParameterRuntimeTreeNode constParamNode)\n            {\n                return constParamNode.GetValue();\n            }\n\n            return null;\n        }\n\n        public static string GetPageSearchToken(Guid? homePageId)\n        {\n            var token = new PageSearchToken\n            {\n                HomePageId = homePageId,\n            };\n            return token.Serialize();\n        }\n\n        protected abstract bool IsNullable();\n    };\n}"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Date/DateSelectorWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Date\r\n{\r\n    internal sealed class DateSelectorWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"DateSelector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Date.\" + _functionName;\r\n\r\n        public DateSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(DateTime), entityTokenFactory)\r\n        {\r\n            ParameterProfile pp =\r\n                new ParameterProfile(\"ReadOnly\", typeof(bool), false,\r\n                    new ConstantValueProvider(false), StandardWidgetFunctions.CheckBoxWidget, null,\r\n                    \"Read only\", new HelpDefinition(\"When selected users can not change the date.\"));\r\n\r\n            base.AddParameterProfile(pp);\r\n        }\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement dateSelectorElement = base.BuildBasicWidgetMarkup(\"DateSelector\", \"Date\", label, help, bindingSourceName);\r\n            if (parameters.GetParameter<bool>(\"ReadOnly\"))\r\n            {\r\n                dateSelectorElement.Add(new XAttribute(\"ReadOnly\", true));\r\n            }\r\n\r\n            return dateSelectorElement;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Date/DateTimeSelectorWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Date\r\n{\r\n    internal sealed class DateTimeSelectorWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"DateTimeSelector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Date.\" + _functionName;\r\n\r\n        public DateTimeSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(DateTime), entityTokenFactory)\r\n        {\r\n            ParameterProfile pp =\r\n                new ParameterProfile(\"ReadOnly\", typeof(bool), false,\r\n                    new ConstantValueProvider(false), StandardWidgetFunctions.CheckBoxWidget, null,\r\n                    \"Read only\", new HelpDefinition(\"When selected users can not change the date.\"));\r\n\r\n            base.AddParameterProfile(pp);\r\n        }\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement dateSelectorElement = base.BuildBasicWidgetMarkup(\"DateTimeSelector\", \"Date\", label, help, bindingSourceName);\r\n            if (parameters.GetParameter<bool>(\"ReadOnly\"))\r\n            {\r\n                dateSelectorElement.Add(new XAttribute(\"ReadOnly\", true));\r\n            }\r\n\r\n            return dateSelectorElement;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Decimal/DecimalTextBoxWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Decimal\r\n{\r\n\tinternal sealed class DecimalTextBoxWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"TextBox\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Decimal.\" + _functionName;\r\n\r\n\r\n        public DecimalTextBoxWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(decimal), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement textBoxMarkup = base.BuildBasicWidgetMarkup(\"TextBox\", \"Text\", label, help, bindingSourceName);\r\n\r\n            textBoxMarkup.Add(new XAttribute(\"Type\", TextBoxType.Decimal));\r\n\r\n            return textBoxMarkup;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Foundation/CompositeWidgetFunctionBase.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public abstract class CompositeWidgetFunctionBase : IWidgetFunction\r\n\t{\r\n        /// <exclude />\r\n        protected const string CommonNamespace = \"Composite.Widgets\";\r\n\r\n        /// <exclude />\r\n        protected const string InternalCommonNamespace = \"Composite.Widgets.Internal\"; // not exposed by provider\r\n        \r\n        private EntityTokenFactory _entityTokenFactory;\r\n\r\n\r\n        /// <exclude />\r\n        protected CompositeWidgetFunctionBase(string compositeName, Type returnType, EntityTokenFactory entityTokenFactory)\r\n        {\r\n            if (string.IsNullOrEmpty(compositeName)) throw new ArgumentNullException(\"compositeName\");\r\n\r\n            this.Namespace = compositeName.Substring(0,compositeName.LastIndexOf('.'));\r\n            this.Name = compositeName.Substring(compositeName.LastIndexOf('.')+1);\r\n            this.ReturnType = returnType;\r\n            this.ParameterProfiles = new List<ParameterProfile>();\r\n            _entityTokenFactory = entityTokenFactory;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        protected void AddParameterProfile(ParameterProfile pp)\r\n        {\r\n            ((List<ParameterProfile>)this.ParameterProfiles).Add(pp);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public virtual string Name { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public string Namespace{ get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public virtual string Description { get { return \"\"; } }\r\n\r\n\r\n        /// <exclude />\r\n        public Type ReturnType { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public IEnumerable<ParameterProfile> ParameterProfiles { get; private set; }\r\n\r\n\r\n        /// <exclude />\r\n        public abstract XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName);\r\n\r\n\r\n        /// <exclude />\r\n        protected XElement BuildBasicWidgetMarkup(string uiControlName, string bindingPropertyName, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            return StandardWidgetFunctions.BuildBasicFormsMarkup(Namespaces.BindingFormsStdUiControls10, uiControlName, bindingPropertyName, label, help, bindingSourceName);\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public EntityToken EntityToken\r\n        {\r\n            get { return _entityTokenFactory.CreateEntityToken(this); }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Foundation/EntityTokenFactory.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.Functions;\r\nusing Composite.Core.Extensions;\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class EntityTokenFactory\r\n\t{\r\n        private readonly string _providerName;\r\n\r\n        /// <exclude />\r\n        public EntityTokenFactory(string providerName)\r\n        {\r\n            _providerName = providerName;\r\n        }\r\n\r\n        internal EntityToken CreateEntityToken(IMetaFunction function)\r\n        {\r\n            string id = StringExtensionMethods.CreateNamespace(function.Namespace, function.Name, '.');\r\n\r\n            return new StandardWidgetFunctionProviderEntityToken(_providerName, id );\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Foundation/FormFunctionMarkupBuilder.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation\r\n{\r\n    internal static class FormFunctionMarkupBuilder\r\n    {\r\n        public static XElement StaticMethodCall(MethodInfo methodInfo, object parameter)\r\n        {\r\n            XNamespace f = Namespaces.BindingFormsStdFuncLib10;\r\n\r\n            try\r\n            {\r\n                string parameterSerialized = ValueTypeConverter.Convert<string>(parameter);\r\n\r\n                return new XElement(f + \"StaticMethodCall\",\r\n                           new XAttribute(\"Type\", TypeManager.SerializeType(methodInfo.DeclaringType)),\r\n                           new XAttribute(\"Method\", methodInfo.Name),\r\n                           new XAttribute(\"Parameters\", parameterSerialized ?? \"\"));\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Failed to generate markup for static method call to '{0}' ('{1}') with parameter of type {2}\", methodInfo.Name, methodInfo.DeclaringType.AssemblyQualifiedName, parameter.GetType()), ex);\r\n            }\r\n        }\r\n\r\n        internal static object StaticMethodCall(MethodInfo methodInfo)\r\n        {\r\n            XNamespace f = Namespaces.BindingFormsStdFuncLib10;\r\n\r\n            return new XElement(f + \"StaticMethodCall\",\r\n                       new XAttribute(\"Type\", TypeManager.SerializeType(methodInfo.DeclaringType)),\r\n                       new XAttribute(\"Method\", methodInfo.Name));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Guid/GuidTextBoxWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.GuidWidgetFunctions\r\n{\r\n\tinternal sealed class GuidTextBoxWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"TextBox\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Guid.\" + _functionName;\r\n\r\n\r\n        public GuidTextBoxWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(Guid), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement textBoxMarkup = base.BuildBasicWidgetMarkup(\"TextBox\", \"Text\", label, help, bindingSourceName);\r\n\r\n            textBoxMarkup.Add(new XAttribute(\"Type\", TextBoxType.Guid));\r\n            \r\n            return textBoxMarkup;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/ImageSelectorWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Functions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Logging;\r\nusing Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Data;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider\r\n{\r\n\tinternal sealed class ImageSelectorWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n        private static readonly string LogTitle = \"ImageSelectorWidgetFunction\";\r\n        private const string _functionName = \"ImageSelector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".\" + _functionName;\r\n        public const string RequiredParameterName = \"Required\";\r\n        public const string MediaFileFolderReferenceParameterName = \"MediaFileFolderReference\";\r\n\r\n        public ImageSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(NullableDataReference<IImageFile>), entityTokenFactory)\r\n        {\r\n            var mediaFolderSelectorWidget = new WidgetFunctionProvider(MediaFileFolderSelectorWidget.CompositeName);\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(MediaFileFolderReferenceParameterName,\r\n                    typeof(DataReference<IMediaFileFolder>),\r\n                    false,\r\n                    new ConstantValueProvider(new DataReference<IMediaFileFolder>()),\r\n                    mediaFolderSelectorWidget,\r\n                    new Dictionary<string, object>(),\r\n                    \"Image folder\",\r\n                    new HelpDefinition(\"Select a media folder to choose images from. Default is 'all media'.\"))\r\n                );\r\n\r\n            var requiredWidget = StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, require selection\", \"No, optional\");\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(RequiredParameterName, \r\n                    typeof(bool), \r\n                    false, \r\n                    new ConstantValueProvider(true),\r\n                    requiredWidget, \r\n                    new Dictionary<string, object>(), \r\n                    \"Selection required\", \r\n                    new HelpDefinition(\"Specify if selecting an image should be required.\"))\r\n                );\r\n        }\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            var searchToken = new MediaFileSearchToken();\r\n            searchToken.MimeTypes = new string[] { MimeTypeInfo.Gif, MimeTypeInfo.Jpeg, MimeTypeInfo.Png, MimeTypeInfo.Bmp, MimeTypeInfo.Svg };\r\n\r\n            var folderReference = parameters.GetParameter<DataReference<IMediaFileFolder>>(MediaFileFolderReferenceParameterName);\r\n            bool selectionRequired = parameters.GetParameter<bool>(RequiredParameterName);\r\n\r\n            if (folderReference != null && folderReference.IsSet)\r\n            {\r\n                IMediaFileFolder folder;\r\n\r\n                try\r\n                {\r\n                    folder = folderReference.Data;\r\n\r\n                    if(folder != null)\r\n                    {\r\n                        searchToken.Folder = folder.Path;\r\n                    }\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    string reference = folderReference.Serialize() ?? string.Empty;\r\n                    LoggingService.LogError(LogTitle, \"Failed to get media folder by referece: '{0}'\".FormatWith(reference));\r\n                }\r\n            }\r\n\r\n            XElement selector = base.BuildBasicWidgetMarkup(\"DataReferenceTreeSelector\", \"Selected\", label, help, bindingSourceName);\r\n\r\n            selector.Add(\r\n                new XAttribute(\"Handle\", \"Composite.Management.ImageSelectorDialog\"),\r\n                new XAttribute(\"SearchToken\", searchToken.Serialize()),\r\n                new XAttribute(\"DataType\", TypeManager.SerializeType(typeof(IImageFile))),\r\n                new XAttribute(\"NullValueAllowed\", (!selectionRequired))\r\n            );\r\n\r\n            return selector;\r\n        }\r\n\r\n        public static Type GetImageType()\r\n        {\r\n            return typeof (IImageFile);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Provides data for the drop down list. Left here only for backwards compatibility\r\n        /// </summary>\r\n        /// <param name=\"folderReference\"></param>\r\n        /// <returns></returns>\r\n        [Obsolete(\"Was used only in old image widget's markup.\", true)]\r\n        public static IEnumerable<DataReferenceLabelPair<IImageFile>> GenerateSelectorOptions(DataReference<IMediaFileFolder> folderReference)\r\n        {\r\n            IMediaFileFolder folder = null;\r\n\r\n            if (folderReference.IsSet)\r\n            {\r\n                try\r\n                {\r\n                    folder = folderReference.Data;\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    string reference = folderReference.Serialize() ?? string.Empty;\r\n                    LoggingService.LogError(LogTitle, \"Failed to get media folder by referece: '{0}'\".FormatWith(reference));\r\n                }\r\n            }\r\n\r\n            if (folder != null)\r\n            {\r\n                int pathLength = folder.Path.Length;\r\n\r\n                return\r\n                    from mediaFile in DataFacade.GetData<IImageFile>()\r\n                    where mediaFile.StoreId == folder.StoreId && mediaFile.FolderPath.StartsWith(folder.Path)\r\n                    orderby mediaFile.StoreId, mediaFile.FolderPath, mediaFile.FileName\r\n                    select new DataReferenceLabelPair<IImageFile>(mediaFile, mediaFile.FolderPath.Substring(pathLength) + \"/\" + mediaFile.FileName);\r\n            }\r\n\r\n            // Returning all of the images\r\n            return\r\n                from mediaFile in DataFacade.GetData<IImageFile>()\r\n                orderby mediaFile.StoreId, mediaFile.FolderPath, mediaFile.FileName\r\n                select new DataReferenceLabelPair<IImageFile>(mediaFile, mediaFile.StoreId + \":\" + mediaFile.FolderPath + \"/\" + mediaFile.FileName);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Integer/IntegerTextBoxWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Integer\r\n{\r\n\tinternal sealed class IntegerTextBoxWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"TextBox\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Integer.\" + _functionName;\r\n\r\n\r\n        public IntegerTextBoxWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(int), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement textBoxMarkup = base.BuildBasicWidgetMarkup(\"TextBox\", \"Text\", label, help, bindingSourceName);\r\n\r\n            textBoxMarkup.Add(new XAttribute(\"Type\", TextBoxType.Integer));\r\n\r\n            return textBoxMarkup;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/MediaFileSelectorWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Linq.Expressions;\r\nusing System.Reflection;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\nusing Composite.Core.Logging;\r\nusing Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider\r\n{\r\n    internal sealed class MediaFileSelectorWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n        private static readonly string LogTitle = \"MediaFileSelectorWidgetFunction\";\r\n        private const string _functionName = \"MediaFileSelector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".\" + _functionName;\r\n        public const string RequiredParameterName = \"Required\";\r\n\r\n        private static readonly Expression IgnoreCaseConstantExpression = Expression.Constant(StringComparison.OrdinalIgnoreCase, typeof(StringComparison));\r\n        private static readonly MethodInfo EndsWithMethodInfo = typeof(string).GetMethod(\"EndsWith\", new[] { typeof(string), typeof(StringComparison) });\r\n        private static Hashtable<string, Expression<Func<IMediaFile, bool>>> _expressionCache = new Hashtable<string, Expression<Func<IMediaFile, bool>>>();\r\n\r\n\r\n\r\n\r\n        public MediaFileSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(NullableDataReference<IMediaFile>), entityTokenFactory)\r\n        {\r\n            var widget = new WidgetFunctionProvider(MediaFileFolderSelectorWidget.CompositeName);\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"MediaFileFolderReference\", typeof(DataReference<IMediaFileFolder>), false,\r\n                    new ConstantValueProvider(new DataReference<IMediaFileFolder>()), widget, new Dictionary<string, object>(),\r\n                    \"Media Folder\", new HelpDefinition(\"Select a media folder to choose files from. Default is all media files.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"FileExtensionFilter\", typeof(string), false,\r\n                    new ConstantValueProvider(\"\"), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"File Extension Filter\", new HelpDefinition(\"Limit the list to files which have the specified extension. Default is no filter.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"IncludeSubfolders\", typeof(bool), false,\r\n                    new ConstantValueProvider(true), StandardWidgetFunctions.GetBoolSelectorWidget(\"Include files from subfolders\", \"Only show files from the specified Media folder\"), null,\r\n                    \"Include Subfolders\", new HelpDefinition(\"When false files from subfolders will no be included.\")));\r\n\r\n            var requiredWidget = StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, require selection\", \"No, optional\");\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(RequiredParameterName, typeof(bool), false,\r\n                    new ConstantValueProvider(true), requiredWidget, new Dictionary<string, object>(),\r\n                    \"Selection required\", new HelpDefinition(\"Specify if selecting a media file should be required.\"))\r\n                );\r\n\r\n        }\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            // TODO: config widget for optional values\r\n            bool selectionRequired = parameters.GetParameter<bool>(RequiredParameterName);\r\n\r\n            var searchToken = new MediaFileSearchToken();\r\n            string extensionStr = parameters.GetParameter<string>(\"FileExtensionFilter\");\r\n            if(!extensionStr.IsNullOrEmpty())\r\n            {\r\n                searchToken.Extensions = extensionStr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);\r\n            }\r\n\r\n            searchToken.Folder = GetFolderPath(parameters.GetParameter<DataReference<IMediaFileFolder>>(\"MediaFileFolderReference\"));\r\n            searchToken.HideSubfolders = !parameters.GetParameter<bool>(\"IncludeSubfolders\");\r\n\r\n            XElement selector = base.BuildBasicWidgetMarkup(\"DataReferenceTreeSelector\", \"Selected\", label, help, bindingSourceName);\r\n\r\n            selector.Add(\r\n                new XAttribute(\"Handle\", \"Composite.Management.EmbeddableMediaSelectorDialog\"),\r\n                new XAttribute(\"SearchToken\", searchToken.Serialize()),\r\n                new XAttribute(\"DataType\", TypeManager.SerializeType(typeof(IMediaFile))),\r\n                new XAttribute(\"NullValueAllowed\", (!selectionRequired))\r\n            );\r\n\r\n            return selector;\r\n        }\r\n\r\n        private static string GetFolderPath(DataReference<IMediaFileFolder> folderReference)\r\n        {\r\n            if (folderReference != null && folderReference.IsSet)\r\n            {\r\n                IMediaFileFolder folder;\r\n\r\n                try\r\n                {\r\n                    folder = folderReference.Data;\r\n\r\n                    if (folder != null)\r\n                    {\r\n                        return folder.Path;\r\n                    }\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    string reference = folderReference.Serialize() ?? string.Empty;\r\n                    LoggingService.LogError(LogTitle, \"Failed to get media folder by referece: '{0}'\".FormatWith(reference));\r\n                }\r\n            }\r\n            return null;\r\n        }\r\n\r\n        public static Type GetMediaType()\r\n        {\r\n            return typeof(IMediaFile);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Provides data for the drop down list. Left here only for backwards compatibility\r\n        /// </summary>\r\n        /// <param name=\"key\"></param>\r\n        /// <returns></returns>\r\n        [Obsolete(\"Was used only in old media file widget's markup.\")]\r\n        public static IEnumerable<DataReferenceLabelPair<IMediaFile>> GenerateSelectorOptions(string key)\r\n        {\r\n            string folderString = key.Split('?')[0];\r\n            string extensionFilter = key.Split('?')[1];\r\n            bool includeSubfolders = bool.Parse(key.Split('?')[2]);\r\n\r\n            IQueryable<IMediaFile> queryable = DataFacade.GetData<IMediaFile>();\r\n\r\n            bool filterByFolder = !folderString.IsNullOrEmpty();\r\n\r\n            IMediaFileFolder folder = null;\r\n\r\n            if (filterByFolder)\r\n            {\r\n                var folderReference = new DataReference<IMediaFileFolder>(folderString);\r\n                folder = folderReference.Data;\r\n\r\n                string storeId = folder.StoreId;\r\n\r\n                queryable = queryable.Where(mediaFile => mediaFile.StoreId == storeId);\r\n\r\n                string folderPath = folder.Path;\r\n                if (!includeSubfolders)\r\n                {\r\n                    queryable = queryable.Where(mediaFile => mediaFile.FolderPath == folderPath);\r\n                }\r\n                else\r\n                {\r\n                    string descFolderPrefix = folderPath + \"/\";\r\n                    queryable = queryable.Where(mediaFile => mediaFile.FolderPath == folderPath || mediaFile.FolderPath.StartsWith(descFolderPrefix));\r\n\r\n                }\r\n            }\r\n\r\n\r\n            if (!extensionFilter.IsNullOrEmpty())\r\n            {\r\n                Expression<Func<IMediaFile, bool>> filter = GetExtensionFilter(extensionFilter);\r\n\r\n                if (filter != null)\r\n                {\r\n                    queryable = queryable.Where(filter);\r\n                }\r\n            }\r\n\r\n            // orderby mediaFile.StoreId, mediaFile.FolderPath, mediaFile.FileName\r\n            queryable = queryable.OrderBy(file => file.StoreId).ThenBy(file => file.FolderPath).ThenBy(file => file.FileName);\r\n\r\n\r\n            if (filterByFolder)\r\n            {\r\n                int pathLength = folder.Path.Length;\r\n\r\n                return from mediaFile in queryable\r\n                       select new DataReferenceLabelPair<IMediaFile>(mediaFile, mediaFile.FolderPath.Substring(pathLength) + \"/\" + mediaFile.FileName);\r\n            }\r\n\r\n            return from mediaFile in queryable\r\n                   select new DataReferenceLabelPair<IMediaFile>(mediaFile, mediaFile.StoreId + \":\" + mediaFile.FolderPath + \"/\" + mediaFile.FileName);\r\n        }\r\n\r\n        [Obsolete()]\r\n        private static Expression<Func<IMediaFile, bool>> GetExtensionFilter(string allowedFileExtensions)\r\n        {\r\n            allowedFileExtensions = allowedFileExtensions.ToLowerInvariant();\r\n\r\n            Expression<Func<IMediaFile, bool>> cachedValue = _expressionCache[allowedFileExtensions];\r\n            if (cachedValue != null) return cachedValue;\r\n\r\n            lock (_expressionCache)\r\n            {\r\n                cachedValue = _expressionCache[allowedFileExtensions];\r\n                if (cachedValue != null) return cachedValue;\r\n\r\n\r\n                string[] extensions = allowedFileExtensions.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);\r\n\r\n                if (extensions.Length == 0)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                // \"file\"\r\n                var fileParameter = Expression.Parameter(typeof(IMediaFile), \"file\");\r\n\r\n                Expression body = null;\r\n\r\n                foreach (string extension in extensions)\r\n                {\r\n                    string suffix = extension.StartsWith(\".\") ? extension : \".\" + extension;\r\n\r\n                    // \"file.FileName\"\r\n                    Expression fileName = Expression.Property(fileParameter, typeof(IFile), \"FileName\");\r\n\r\n                    // Building \"file.FileName.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)\"\r\n                    MethodCallExpression predicate = Expression.Call(fileName,\r\n                                                                     EndsWithMethodInfo,\r\n                                                                     Expression.Constant(suffix),\r\n                                                                     IgnoreCaseConstantExpression);\r\n\r\n                    if (body == null)\r\n                    {\r\n                        // file => file.FileName.EndsWith(extension, StringComparison.OrdinalIgnoreCase);\r\n                        body = predicate;\r\n                    }\r\n                    else\r\n                    {\r\n                        // body = (.....) || file.FileName.EndsWith(extension, StringComparison.OrdinalIgnoreCase;\r\n                        body = Expression.OrElse(body, predicate);\r\n                    }\r\n                }\r\n\r\n                var result = Expression.Lambda<Func<IMediaFile, bool>>(body, fileParameter);\r\n\r\n                _expressionCache.Add(allowedFileExtensions, result);\r\n\r\n                return result;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/MediaFolderSelectorWidget.cs",
    "content": "﻿using System;\r\nusing System.Linq; \r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Data;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider\r\n{\r\n\tinternal sealed class MediaFileFolderSelectorWidget : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"MediaFileFolderSelector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".\" + _functionName;\r\n\r\n\r\n        public MediaFileFolderSelectorWidget(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(DataReference<IMediaFileFolder>), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement widgetMarkup = base.BuildBasicWidgetMarkup(\"DataReferenceSelector\", \"Selected\", label, help, bindingSourceName);\r\n            widgetMarkup.Add(new XElement(\"DataReferenceSelector.DataType\", typeof(IMediaFileFolder).AssemblyQualifiedName));\r\n\r\n            return widgetMarkup;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/SelectorWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider\r\n{\r\n    internal sealed class SelectorWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"Selector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".\" + _functionName;\r\n\r\n        private const string Parameter_Options = \"Options\";\r\n        private const string Parameter_KeyFieldName = \"KeyFieldName\";\r\n        private const string Parameter_LabelFieldName = \"LabelFieldName\";\r\n        private const string Parameter_Required = \"Required\";\r\n\r\n        public static IEnumerable GetOptions(string optionsDescriptorSerialized)\r\n        {\r\n            // DDZ: This method seem not to be used any more\r\n\r\n            XElement optionsDescriptor = XElement.Parse(optionsDescriptorSerialized);\r\n\r\n            string keyFieldName = optionsDescriptor.Attribute(\"KeyFieldName\").Value;\r\n            string labelFieldName = optionsDescriptor.Attribute(\"LabelFieldName\").Value;\r\n            XElement treeNodeElement = optionsDescriptor.Element(\"TreeNode\").Elements().First();\r\n            BaseRuntimeTreeNode runtimeTreeNode = FunctionFacade.BuildTree(treeNodeElement);\r\n\r\n            IEnumerable optionsSource = runtimeTreeNode.GetValue<IEnumerable>();\r\n\r\n            if (optionsSource is IEnumerable<XElement>)\r\n            {\r\n                IEnumerable<XElement> optionElements = (IEnumerable<XElement>)optionsSource;\r\n                foreach (XElement optionElement in optionElements)\r\n                {\r\n                    yield return new\r\n                    {\r\n                        Key = optionElement.Attribute(keyFieldName).Value,\r\n                        Label = optionElement.Attribute(labelFieldName).Value\r\n                    };\r\n                }\r\n            }\r\n            else if (optionsSource is IDictionary)\r\n            {\r\n                IDictionary optionsDictionary = (IDictionary)optionsSource;\r\n                foreach (var optionKey in optionsDictionary.Keys)\r\n                {\r\n                    yield return new { Key = optionKey, Label = optionsDictionary[optionKey] };\r\n                }\r\n            }\r\n            else if (string.IsNullOrEmpty(keyFieldName) == false || string.IsNullOrEmpty(labelFieldName))\r\n            {\r\n                foreach (object optionObject in optionsSource)\r\n                {\r\n                    if (optionObject != null)\r\n                    {\r\n                        Type objectType = optionObject.GetType();\r\n\r\n                        string key = (string.IsNullOrEmpty(keyFieldName) ?\r\n                            optionObject.ToString() :\r\n                            objectType.GetProperty(keyFieldName).GetValue(optionObject, null).ToString());\r\n\r\n                        string label = (string.IsNullOrEmpty(labelFieldName) ?\r\n                            optionObject.ToString() :\r\n                            objectType.GetProperty(labelFieldName).GetValue(optionObject, null).ToString());\r\n\r\n                        yield return new { Key = key, Label = label };\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                foreach (var option in optionsSource)\r\n                {\r\n                    yield return new { Key = option, Label = option };\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public SelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(object), entityTokenFactory)\r\n        {\r\n            SetParameterProfiles();\r\n        }\r\n\r\n\r\n        private void SetParameterProfiles()\r\n        {\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(Parameter_Options,\r\n                    typeof(IEnumerable),\r\n                    true,\r\n                    new NoValueValueProvider(),\r\n                    null,\r\n                    null,\r\n                    \"Options\", new HelpDefinition(\"A list of elements to use as options. Expected types are IEnumerable (simple lists) and Dictionary.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(Parameter_KeyFieldName,\r\n                    typeof(string),\r\n                    false,\r\n                    new ConstantValueProvider(null),\r\n                    StandardWidgetFunctions.TextBoxWidget,\r\n                    null,\r\n                    \"Source key field name\", new HelpDefinition(\"If your option source returns a list of objects or XElements, use this field to specify the name of the field (property) to use for key values. Leave this empty to use the source option value as a string.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(Parameter_LabelFieldName,\r\n                    typeof(string),\r\n                    false,\r\n                    new ConstantValueProvider(null),\r\n                    StandardWidgetFunctions.TextBoxWidget,\r\n                    null,\r\n                    \"Source label field name\", new HelpDefinition(\"If your option source returns a list of objects or XElements, use this field to specify the name of the field (property) to use for labels. Leave this empty to use the source option value as a string.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"Required\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(true),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, selection is required\", \"No, a 'none' selection is allowed.\") ,\r\n                    null,\r\n                    \"Selection required\", new HelpDefinition(\"When true the user is forced to make a selection. This feature is not available when 'multiple selection' is enabled.\")));          \r\n        }\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n        {\r\n            BaseRuntimeTreeNode runtimeTreeNode;\r\n\r\n            if (!parameters.TryGetParameterRuntimeTreeNode(Parameter_Options, out runtimeTreeNode))\r\n            {\r\n                throw new InvalidOperationException(\"Could not get BaseRuntimeTreeNode for parameter 'Options'.\");\r\n            }\r\n            \r\n            const string selectorName = \"KeySelector\";\r\n\r\n            IEnumerable options = runtimeTreeNode.GetValue<IEnumerable>();\r\n            IDictionary dictionaryOptions = options as IDictionary;\r\n\r\n            XElement treeNodeElement = runtimeTreeNode.Serialize().Elements().First();\r\n\r\n            XElement functionMarkup = treeNodeElement;\r\n\r\n\r\n            XElement selector = StandardWidgetFunctions.BuildBasicFormsMarkup(\r\n                Namespaces.BindingFormsStdUiControls10,\r\n                selectorName,\r\n                \"Selected\",\r\n                label,\r\n                helpDefinition,\r\n                bindingSourceName);\r\n\r\n            if (dictionaryOptions != null)\r\n            {\r\n                selector.Add(new XAttribute(\"OptionsKeyField\", \"Key\"));\r\n                selector.Add(new XAttribute(\"OptionsLabelField\", \"Value\"));\r\n            }\r\n            else\r\n            {\r\n                string keyFieldName = parameters.GetParameter<string>(Parameter_KeyFieldName);\r\n                if (keyFieldName != null)\r\n                {\r\n                    selector.Add(new XAttribute(\"OptionsKeyField\", keyFieldName));\r\n                }\r\n\r\n                string labelFieldName = parameters.GetParameter<string>(Parameter_LabelFieldName);\r\n                if (labelFieldName != null)\r\n                {\r\n                    selector.Add(new XAttribute(\"OptionsLabelField\", labelFieldName));\r\n                }\r\n            }\r\n\r\n            bool required = parameters.GetParameter<bool>(Parameter_Required);\r\n            selector.Add(new XAttribute(\"Required\", required));\r\n\r\n            selector.Add(new XElement(selector.Name.Namespace + (selectorName + \".Options\"), functionMarkup));\r\n\r\n            return selector;\r\n            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/StandardWidgetFunctionProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Plugins.WidgetFunctionProvider;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Bool;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataType;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Date;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Decimal;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.GuidWidgetFunctions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Integer;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Utils;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider\r\n{\r\n    [ConfigurationElementType(typeof(StandardWidgetFunctionProviderData))]\r\n    internal sealed class StandardWidgetFunctionProvider : IDynamicTypeWidgetFunctionProvider\r\n\t{\r\n        private EntityTokenFactory _entityTokenFactory;\r\n        private WidgetFunctionNotifier _widgetFunctionNotifier;\r\n        private List<IWidgetFunction> _widgetStaticTypeFunctions = null;\r\n        private List<IWidgetFunction> _widgetDynamicTypeFunctions = null;\r\n        \r\n\r\n\r\n        public StandardWidgetFunctionProvider(string providerName)\r\n        {\r\n            _entityTokenFactory = new EntityTokenFactory(providerName);\r\n        }\r\n\r\n\r\n\r\n        public WidgetFunctionNotifier WidgetFunctionNotifier\r\n        {\r\n            set { _widgetFunctionNotifier = value; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<IWidgetFunction> Functions\r\n        {\r\n            get \r\n            {\r\n                if (_widgetStaticTypeFunctions == null)\r\n                {\r\n                    InitializeStaticTypeFunctions();\r\n                }\r\n\r\n                foreach (IWidgetFunction widgetFunction in _widgetStaticTypeFunctions)\r\n                {\r\n                    yield return widgetFunction;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<IWidgetFunction> DynamicTypeDependentFunctions\r\n        {\r\n            get\r\n            {\r\n                if (_widgetDynamicTypeFunctions == null)\r\n                {\r\n                    InitializeDynamicTypeFunctions();\r\n                }\r\n\r\n                foreach (IWidgetFunction widgetFunction in _widgetDynamicTypeFunctions)\r\n                {\r\n                    yield return widgetFunction;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void InitializeStaticTypeFunctions()\r\n        {\r\n            _widgetStaticTypeFunctions = new List<IWidgetFunction>();\r\n\r\n            _widgetStaticTypeFunctions.Add(new FormMarkupWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new TextBoxWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new TextAreaWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new String.SelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new String.HierarchicalSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new TreeSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new DataIdMultiSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new String.VisualXhtmlEditorFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new String.UrlComboBoxWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new XhtmlDocument.VisualXhtmlEditorFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new DateSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new DateTimeSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new MediaFileFolderSelectorWidget(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new MediaFileSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new SelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new ImageSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new IntegerTextBoxWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new DecimalTextBoxWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new GuidTextBoxWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new CheckBoxWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new BoolSelectorWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new DataTypeSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new PageReferenceSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new NullablePageReferenceSelectorWidgetFunction(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new FontIconSelectorWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new SvgIconSelectorWidgetFuntion(_entityTokenFactory));\r\n            _widgetStaticTypeFunctions.Add(new ConsoleIconSelectorWidgetFuntion(_entityTokenFactory));\r\n        }\r\n\r\n\r\n\r\n        private void InitializeDynamicTypeFunctions()\r\n        {\r\n            _widgetDynamicTypeFunctions = new List<IWidgetFunction>();\r\n\r\n            List<Type> dataInterfaces = DataFacade.GetAllKnownInterfaces(UserType.Developer);\r\n            // Is there a better way to add these interfaces? They should be added if the properties (keys) is \r\n            // visible to the user when making a custom form.\r\n            dataInterfaces.Add(typeof(Composite.Data.Types.IPageFolderDefinition));\r\n            dataInterfaces.Add(typeof(Composite.Data.Types.IPageMetaDataDefinition));\r\n\r\n            object[] args = new object[] { _entityTokenFactory };\r\n\r\n            _widgetDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IWidgetFunction)Activator.CreateInstance(typeof(DataReferenceSelectorWidgetFunction<>).MakeGenericType(t), args));\r\n\r\n            _widgetDynamicTypeFunctions.AddRange(\r\n                from t in dataInterfaces\r\n                select (IWidgetFunction)Activator.CreateInstance(typeof(NullableDataReferenceSelectorWidgetFunction<>).MakeGenericType(t), args));\r\n\r\n        }        \r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(StandardWidgetFunctionProviderrAssembler))]\r\n    internal sealed class StandardWidgetFunctionProviderData : WidgetFunctionProviderData\r\n    {\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class StandardWidgetFunctionProviderrAssembler : IAssembler<IWidgetFunctionProvider, WidgetFunctionProviderData>\r\n    {\r\n        public IWidgetFunctionProvider Assemble(IBuilderContext context, WidgetFunctionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new StandardWidgetFunctionProvider(objectConfiguration.Name);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/StandardWidgetFunctionProviderEntityToken.cs",
    "content": "using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.SecurityAncestorProviders;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider\r\n{\r\n    [SecurityAncestorProvider(typeof(NoAncestorSecurityAncestorProvider))]\r\n    internal sealed class StandardWidgetFunctionProviderEntityToken : EntityToken\r\n\t{\r\n        private string _id;\r\n        private string _source;\r\n\r\n        public StandardWidgetFunctionProviderEntityToken(string source, string id)\r\n        {\r\n            _source = source;\r\n            _id = id;\r\n        }\r\n\r\n        public override string Type\r\n        {\r\n            get { return \"\"; }\r\n        }\r\n\r\n        public override string Source\r\n        {\r\n            get { return _source; }\r\n        }\r\n\r\n        public override string Id\r\n        {\r\n            get { return _id; }\r\n        }\r\n\r\n        public override string Serialize()\r\n        {\r\n            return DoSerialize();\r\n        }\r\n\r\n        public static EntityToken Deserialize(string serializedEntityToken)\r\n        {\r\n            string type, source, id;\r\n\r\n            DoDeserialize(serializedEntityToken, out type, out source, out id);\r\n\r\n            return new StandardWidgetFunctionProviderEntityToken(source, id);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/DataIdMultiSelectorWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataReference;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public sealed class DataIdMultiSelectorWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"DataIdMultiSelector\";\r\n        internal const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" + _functionName;\r\n\r\n        /// <summary> \r\n        /// Is called through reflection   \r\n        /// </summary>\r\n        /// <exclude />\r\n        public static IEnumerable GetOptions(string typeManagerName)\r\n        {\r\n            return GetOptionsCommon.GetOptions(typeManagerName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public DataIdMultiSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(string), entityTokenFactory)\r\n        {\r\n            SetParameterProfiles();\r\n        }\r\n\r\n\r\n        private void SetParameterProfiles()\r\n        {\r\n            ParameterProfile dataTypePP =\r\n                new ParameterProfile(\"OptionsType\",\r\n                    typeof(Type), \r\n                    true,\r\n                    new NoValueValueProvider(), \r\n                    StandardWidgetFunctions.DataTypeSelectorWidget, \r\n                    null,\r\n                    \"Data type to select from\", new HelpDefinition(\"The list of options the user can choose from will be selected from this type.\"));\r\n\r\n            base.AddParameterProfile(dataTypePP);\r\n\r\n            ParameterProfile compactModePP =\r\n                new ParameterProfile(\"CompactMode\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(false),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Compact\", \"Verbose\"),\r\n                    null,\r\n                    \"Compact UI\", new HelpDefinition(\"When true, a more compact representation of long option lists is used. Default is false (verbose).\"));\r\n\r\n            base.AddParameterProfile(compactModePP);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n        {\r\n            Type optionsType = parameters.GetParameter<Type>(\"OptionsType\");\r\n            bool compactMode = parameters.GetParameter<bool>(\"CompactMode\");\r\n            return BuildStaticCallPopulatedSelectorFormsMarkup(\r\n                    parameters,\r\n                    label,\r\n                    helpDefinition,\r\n                    bindingSourceName,\r\n                    this.GetType(),\r\n                    \"GetOptions\",\r\n                    TypeManager.SerializeType(optionsType),\r\n                    \"Key\",\r\n                    \"Label\",\r\n                    false,\r\n                    compactMode);\r\n        }\r\n\r\n\r\n        private static XElement BuildStaticCallPopulatedSelectorFormsMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName, Type optionsGeneratingStaticType, string optionsGeneratingStaticMethodName, object optionsGeneratingStaticMethodParameterValue, string optionsObjectKeyPropertyName, string optionsObjectLabelPropertyName, bool required, bool compactMode)\r\n        {\r\n            string tagName = \"MultiKeySelector\";\r\n\r\n            XElement selector = StandardWidgetFunctions.BuildBasicFormsMarkup(Namespaces.BindingFormsStdUiControls10, tagName, \"SelectedAsString\", label, helpDefinition, bindingSourceName);\r\n            XNamespace f = Namespaces.BindingFormsStdFuncLib10;\r\n\r\n            selector.Add(\r\n                new XAttribute(\"OptionsKeyField\", optionsObjectKeyPropertyName),\r\n                new XAttribute(\"OptionsLabelField\", optionsObjectLabelPropertyName),\r\n                new XAttribute(\"Required\", required),\r\n                new XAttribute(\"CompactMode\", compactMode),\r\n                new XElement(selector.Name.Namespace + (tagName + \".Options\"),\r\n                    new XElement(f + \"StaticMethodCall\",\r\n                       new XAttribute(\"Type\", TypeManager.SerializeType(optionsGeneratingStaticType)),\r\n                       new XAttribute(\"Method\", optionsGeneratingStaticMethodName))));\r\n\r\n            if (optionsGeneratingStaticMethodParameterValue != null) selector.Descendants(f + \"StaticMethodCall\").First().Add(\r\n                  new XAttribute(\"Parameters\", optionsGeneratingStaticMethodParameterValue));\r\n\r\n            return selector;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/FontIconSelectorWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\r\n{\r\n\tinternal sealed class FontIconSelectorWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"FontIconSelector\";\r\n\r\n        /// <exclude />\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" + _functionName;\r\n\r\n        /// <exclude />\r\n        public const string ClassNameOptionsParameterName = \"ClassNameOptions\";\r\n        public const string StylesheetPathParameterName = \"StylesheetPath\";\r\n        public const string ClassNamePrefixParameterName = \"ClassNamePrefix\";\r\n\r\n        public FontIconSelectorWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(string), entityTokenFactory)\r\n        {\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(FontIconSelectorWidgetFuntion.ClassNameOptionsParameterName,\r\n                    typeof(object), true,\r\n                    new ConstantValueProvider(null), StandardWidgetFunctions.TextAreaWidget, null,\r\n                    \"Class Name Options\", new HelpDefinition(\"A list of class names the user should be able to choose from. Pass in a (comma seperated) string, a IEnumerable<string> or a Dictionary<string,string>.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(FontIconSelectorWidgetFuntion.StylesheetPathParameterName,\r\n                    typeof(string), true,\r\n                    new ConstantValueProvider(null), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"Stylesheet Path\", new HelpDefinition(\"Path to style sheet containing class name definitions and web font include. Example: ~/Frontend/styles/glyphicons.less\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(FontIconSelectorWidgetFuntion.ClassNamePrefixParameterName,\r\n                    typeof(string), false,\r\n                    new ConstantValueProvider(\"\"), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"Class Name Prefix\", new HelpDefinition(\"String to always prepend to the class name options for font icons to be shown in drop down. Bootstrap Example: 'glyphicon glyphicon-'\")));\r\n        }\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            string stylesheetPath = parameters.GetParameter<string>(FontIconSelectorWidgetFuntion.StylesheetPathParameterName);\r\n            string classNamePrefix = parameters.GetParameter<string>(FontIconSelectorWidgetFuntion.ClassNamePrefixParameterName);\r\n\r\n            XElement formElement = base.BuildBasicWidgetMarkup(\"FontIconSelector\", \"SelectedClassName\", label, help, bindingSourceName);\r\n            formElement.Add(new XElement(Namespaces.BindingFormsStdUiControls10+\"FontIconSelector.ClassNameOptions\", \r\n                GetClassNameOptionsValueNodes(parameters)));\r\n            formElement.Add(new XAttribute(\"StylesheetPath\", stylesheetPath));\r\n            formElement.Add(new XAttribute(\"ClassNamePrefix\", classNamePrefix));\r\n            return formElement;\r\n        }\r\n\r\n        private IEnumerable<XNode> GetClassNameOptionsValueNodes(ParameterList parameters)\r\n        {\r\n            BaseRuntimeTreeNode classNameOptionsRuntimeTreeNode = null;\r\n            if (parameters.TryGetParameterRuntimeTreeNode(FontIconSelectorWidgetFuntion.ClassNameOptionsParameterName, out classNameOptionsRuntimeTreeNode))\r\n            {\r\n                object value = parameters.GetParameter(FontIconSelectorWidgetFuntion.ClassNameOptionsParameterName);\r\n                if (value is string)\r\n                {\r\n                    yield return new XText((string)value);\r\n                }\r\n                else\r\n                {\r\n                    foreach (var node in classNameOptionsRuntimeTreeNode.Serialize().Nodes())\r\n                    {\r\n                        yield return node;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/HierarchicalSelectorWidgetFunction.cs",
    "content": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Xml.Linq;\n\nusing Composite.Functions;\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\nusing Composite.C1Console.Forms.CoreUiControls;\nusing Composite.Core.Xml;\n\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\n{\n    internal sealed class HierarchicalSelectorWidgetFunction : CompositeWidgetFunctionBase\n    {\n        private const string _functionName = \"HierarchicalSelector\";\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" + _functionName;\n\n\n        public HierarchicalSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\n            : base(CompositeName, typeof(string), entityTokenFactory)\n        {\n            SetParameterProfiles();\n        }\n\n\n        private void SetParameterProfiles()\n        {\n            base.AddParameterProfile(\n                new ParameterProfile(\"TreeNodes\",\n                    typeof(IEnumerable<SelectionTreeNode>),\n                    true,\n                    new NoValueValueProvider(),\n                    null,\n                    null,\n                    \"Tree Nodes\", new HelpDefinition(\"The structure to use for building hierarchy for selection. Call a function that return IEnumerable<SelectionTreeNode>.\")));\n\n            base.AddParameterProfile(\n                new ParameterProfile(\"Required\",\n                    typeof(bool),\n                    false,\n                    new ConstantValueProvider(true),\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, selection is required\", \"No, a 'none' selection is allowed.\") ,\n                    null,\n                    \"Selection required\", new HelpDefinition(\"When true the user is forced to make a selection. This feature is not available when 'multiple selection' is enabled.\")));\n\n            base.AddParameterProfile(\n                new ParameterProfile(\"AutoSelectChildren\",\n                    typeof(bool),\n                    false,\n                    new ConstantValueProvider(false),\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, auto select child elements.\", \"No, only one selection on click.\"),\n                    null,\n                    \"Auto select children\", new HelpDefinition(\"When true a selection will automatically select all descendant elements in the hierarchy.\")));\n\n            base.AddParameterProfile(\n                new ParameterProfile(\"AutoSelectParents\",\n                    typeof(bool),\n                    false,\n                    new ConstantValueProvider(false),\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, auto select parents.\", \"No, only one selection on click.\"),\n                    null,\n                    \"Auto select parents\", new HelpDefinition(\"When true a selection will automatically select all ancestor elements in the hierarchy.\")));\n\n        }\n\n\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\n        {\n            BaseRuntimeTreeNode optionsRuntimeTreeNode = null;\n\n            if (parameters.TryGetParameterRuntimeTreeNode(\"TreeNodes\", out optionsRuntimeTreeNode))\n            {\n                bool required = parameters.GetParameter<bool>(\"Required\");\n                bool autoSelectChildren = parameters.GetParameter<bool>(\"AutoSelectChildren\");\n                bool autoSelectParents = parameters.GetParameter<bool>(\"AutoSelectParents\");\n\n                XElement formElement = base.BuildBasicWidgetMarkup(\"HierarchicalSelector\", \"SelectedKeys\", label, helpDefinition, bindingSourceName);\n                formElement.Add(new XElement(Namespaces.BindingFormsStdUiControls10 + \"HierarchicalSelector.TreeNodes\",\n                    optionsRuntimeTreeNode.Serialize()));\n                formElement.Add(new XAttribute(\"AutoSelectChildren\", autoSelectChildren));\n                formElement.Add(new XAttribute(\"AutoSelectParents\", autoSelectParents));\n\n                return formElement;\n            }\n            else\n            {\n                throw new InvalidOperationException(\"Could not get BaseRuntimeTreeNode for parameter 'TreeNodes'.\");\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/SelectorWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\r\n{\r\n    internal sealed class SelectorWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"Selector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" + _functionName;\r\n\r\n        public static IEnumerable GetOptions(string optionsDescriptorSerialized)\r\n        {\r\n            XElement optionsDescriptor = XElement.Parse(optionsDescriptorSerialized);\r\n\r\n            string keyFieldName = optionsDescriptor.Attribute(\"KeyFieldName\").Value;\r\n            string labelFieldName = optionsDescriptor.Attribute(\"LabelFieldName\").Value;\r\n            XElement treeNodeElement = optionsDescriptor.Element(\"TreeNode\").Elements().First();\r\n            BaseRuntimeTreeNode runtimeTreeNode = FunctionFacade.BuildTree(treeNodeElement);\r\n\r\n            IEnumerable optionsSource = runtimeTreeNode.GetValue<IEnumerable>();\r\n\r\n            if (optionsSource is IEnumerable<XElement>)\r\n            {\r\n                IEnumerable<XElement> optionElements = (IEnumerable<XElement>)optionsSource;\r\n                foreach (XElement optionElement in optionElements)\r\n                {\r\n                    yield return new\r\n                    {\r\n                        Key = optionElement.Attribute(keyFieldName).Value,\r\n                        Label = optionElement.Attribute(labelFieldName).Value\r\n                    };\r\n                }\r\n            }\r\n            else if (optionsSource is IDictionary)\r\n            {\r\n                IDictionary optionsDictionary = (IDictionary)optionsSource;\r\n                foreach (var optionKey in optionsDictionary.Keys)\r\n                {\r\n                    yield return new { Key = optionKey, Label = optionsDictionary[optionKey] };\r\n                }\r\n            }\r\n            else if (string.IsNullOrEmpty(keyFieldName) == false || string.IsNullOrEmpty(labelFieldName))\r\n            {\r\n                foreach (object optionObject in optionsSource)\r\n                {\r\n                    if (optionObject != null)\r\n                    {\r\n                        Type objectType = optionObject.GetType();\r\n\r\n                        string key = (string.IsNullOrEmpty(keyFieldName) ?\r\n                            optionObject.ToString() :\r\n                            objectType.GetProperty(keyFieldName).GetValue(optionObject, null).ToString());\r\n\r\n                        string label = (string.IsNullOrEmpty(labelFieldName) ?\r\n                            optionObject.ToString() :\r\n                            objectType.GetProperty(labelFieldName).GetValue(optionObject, null).ToString());\r\n\r\n                        yield return new { Key = key, Label = label };\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                foreach (var option in optionsSource)\r\n                {\r\n                    yield return new { Key = option, Label = option };\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private const string _compositeNameBase = CompositeWidgetFunctionBase.CommonNamespace + \".DataReference.\";\r\n\r\n        public SelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(string), entityTokenFactory)\r\n        {\r\n            SetParameterProfiles();\r\n        }\r\n\r\n\r\n        private void SetParameterProfiles()\r\n        {\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"Options\",\r\n                    typeof(IEnumerable),\r\n                    true,\r\n                    new NoValueValueProvider(),\r\n                    null,\r\n                    null,\r\n                    \"Options\", new HelpDefinition(\"A list of elements to use as options. Expected types are IEnumerable (simple lists) and Dictionary.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"KeyFieldName\",\r\n                    typeof(string),\r\n                    false,\r\n                    new ConstantValueProvider(null),\r\n                    StandardWidgetFunctions.TextBoxWidget,\r\n                    null,\r\n                    \"Source key field name\", new HelpDefinition(\"If your option source returns a list of objects or XElements, use this field to specify the name of the field (property) to use for key values. Leave this empty to use the source option value as a string.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"LabelFieldName\",\r\n                    typeof(string),\r\n                    false,\r\n                    new ConstantValueProvider(null),\r\n                    StandardWidgetFunctions.TextBoxWidget,\r\n                    null,\r\n                    \"Source label field name\", new HelpDefinition(\"If your option source returns a list of objects or XElements, use this field to specify the name of the field (property) to use for labels. Leave this empty to use the source option value as a string.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"Required\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(true),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, selection is required\", \"No, a 'none' selection is allowed.\") ,\r\n                    null,\r\n                    \"Selection required\", new HelpDefinition(\"When true the user is forced to make a selection. This feature is not available when 'multiple selection' is enabled.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"Multiple\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(false),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, allow multiple selections.\", \"No, allow only one selection.\"),\r\n                    null,\r\n                    \"Multiple selection\", new HelpDefinition(\"When true the user can select zero, one or more values. The selected values will be joined in a comma seperated string like 'A,B,C'.\")));\r\n\r\n            base.AddParameterProfile(\r\n                new ParameterProfile(\"Compact\",\r\n                    typeof(bool),\r\n                    false,\r\n                    new ConstantValueProvider(false),\r\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, use compact/popup UI.\", \"No, show all options.\"),\r\n                    null,\r\n                    \"Compact mode\", new HelpDefinition(\"When true the UI element will be compact.\")));\r\n\r\n        }\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n        {\r\n            BaseRuntimeTreeNode runtimeTreeNode = null;\r\n\r\n            if (parameters.TryGetParameterRuntimeTreeNode(\"Options\", out runtimeTreeNode))\r\n            {\r\n                string keyFieldName = parameters.GetParameter<string>(\"KeyFieldName\");\r\n                string labelFieldName = parameters.GetParameter<string>(\"LabelFieldName\");\r\n                bool multiple = parameters.GetParameter<bool>(\"Multiple\");\r\n                bool required = parameters.GetParameter<bool>(\"Required\");\r\n                bool compact = parameters.GetParameter<bool>(\"Compact\");\r\n\r\n                XElement optionsDescriptor = new XElement(\"SelectorOptionsSource\",\r\n                    new XAttribute(\"KeyFieldName\", parameters.GetParameter<string>(\"KeyFieldName\") ?? \"\"),\r\n                    new XAttribute(\"LabelFieldName\", parameters.GetParameter<string>(\"LabelFieldName\") ?? \"\"),\r\n                    new XElement(\"TreeNode\",\r\n                        runtimeTreeNode.Serialize()));\r\n\r\n                return StandardWidgetFunctions.BuildStaticCallPopulatedSelectorFormsMarkup(\r\n                            parameters,\r\n                            label,\r\n                            helpDefinition,\r\n                            bindingSourceName,\r\n                            this.GetType(),\r\n                            \"GetOptions\",\r\n                            optionsDescriptor.ToString(),\r\n                            \"Key\",\r\n                            \"Label\",\r\n                            multiple,\r\n                            compact,\r\n                            required,\r\n                            true);\r\n            }\r\n            else\r\n            {\r\n                throw new InvalidOperationException(\"Could not get BaseRuntimeTreeNode for parameter 'Options'.\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TextAreaWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\r\n{\r\n    internal sealed class TextAreaWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"TextArea\";\r\n\r\n        /// <exclude />\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" + _functionName;\r\n\r\n        /// <exclude />\r\n        public const string SpellCheckParameterName = \"SpellCheck\";\r\n\r\n\r\n        public TextAreaWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(string), entityTokenFactory)\r\n        {\r\n            ParameterProfile spellCheckPP =\r\n                new ParameterProfile(TextAreaWidgetFuntion.SpellCheckParameterName,\r\n                    typeof(bool), false,\r\n                    new ConstantValueProvider(true), StandardWidgetFunctions.GetBoolSelectorWidget(\"Allow spell checking\",\"Do not allow spell checking\"), null,\r\n                    \"Spell check\", new HelpDefinition(\"By default text will be spell checked (when available). You should explicitly disable spell checking on fields that contain e-mails, code values etc. not suitable for spell checking. \"));\r\n\r\n            base.AddParameterProfile(spellCheckPP);\r\n        }\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            bool spellCheck = parameters.GetParameter<bool>(TextAreaWidgetFuntion.SpellCheckParameterName);\r\n\r\n            XElement formElement = base.BuildBasicWidgetMarkup(\"TextArea\", \"Text\", label, help, bindingSourceName);\r\n            formElement.Add(new XAttribute(\"SpellCheck\", spellCheck));\r\n            return formElement;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TextBoxWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\r\n{\r\n\tinternal sealed class TextBoxWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"TextBox\";\r\n\r\n        /// <exclude />\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" + _functionName;\r\n\r\n        /// <exclude />\r\n        public const string SpellCheckParameterName = \"SpellCheck\";\r\n\r\n        public TextBoxWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(string), entityTokenFactory)\r\n        {\r\n            ParameterProfile spellCheckPP =\r\n                new ParameterProfile(TextBoxWidgetFuntion.SpellCheckParameterName,\r\n                    typeof(bool), false,\r\n                    new ConstantValueProvider(true), StandardWidgetFunctions.GetBoolSelectorWidget(\"Allow spell checking\", \"Do not allow spell checking\"), null,\r\n                    \"Spell check\", new HelpDefinition(\"By default text will be spell checked (when available). You should explicitly disable spell checking on fields that contain e-mails, code values etc. not suitable for spell checking. \"));\r\n\r\n            base.AddParameterProfile(spellCheckPP);\r\n        }\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            bool spellCheck = parameters.GetParameter<bool>(TextBoxWidgetFuntion.SpellCheckParameterName);\r\n\r\n            XElement formElement = base.BuildBasicWidgetMarkup(\"TextBox\", \"Text\", label, help, bindingSourceName);\r\n            formElement.Add(new XAttribute(\"SpellCheck\", spellCheck));\r\n            return formElement;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs",
    "content": "using System.Xml.Linq;\nusing Composite.Functions;\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\nusing Composite.C1Console.Forms.CoreUiControls;\n\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\n{\n    internal sealed class TreeSelectorWidgetFunction : CompositeWidgetFunctionBase\n    {\n        private const string FunctionName = \"TreeSelector\";\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" + FunctionName;\n\n        public TreeSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\n            : base(CompositeName, typeof(string), entityTokenFactory)\n        {\n            SetParameterProfiles();\n        }\n\n\n        private void SetParameterProfiles()\n        {\n            base.AddParameterProfile(\n                new ParameterProfile(nameof(TreeSelectorUiControl.ElementProvider),\n                    typeof(string),\n                    true,\n                    new ConstantValueProvider(string.Empty),\n                    StandardWidgetFunctions.TextBoxWidget,\n                    null,\n                    \"Element Provider\", new HelpDefinition(\"The name of a tree element provider (as defined in Composite.config)\")));\n\n            base.AddParameterProfile(\n                new ParameterProfile(nameof(TreeSelectorUiControl.SelectableElementReturnValue),\n                    typeof(string),\n                    true,\n                    new ConstantValueProvider(\"EntityToken\"),\n                    StandardWidgetFunctions.TextBoxWidget,\n                    null,\n                    \"Element field to return\", new HelpDefinition(\"The name of the element field whose value to return for selection. Typical values here can be DataId (for data trees), Uri (for linkable elements), or EntityToken (for any element). Element providers may provide more fields.\")));\n\n            base.AddParameterProfile(\n                new ParameterProfile(nameof(TreeSelectorUiControl.SelectableElementPropertyName),\n                    typeof(string),\n                    false,\n                    new ConstantValueProvider(string.Empty),\n                    StandardWidgetFunctions.TextBoxWidget,\n                    null,\n                    \"Selection filter, Property Name\", new HelpDefinition(\"An element must have this field to be selectable.\")));\n\n            base.AddParameterProfile(\n                new ParameterProfile(nameof(TreeSelectorUiControl.SelectableElementPropertyValue),\n                    typeof(string),\n                    false,\n                    new ConstantValueProvider(string.Empty),\n                    StandardWidgetFunctions.TextBoxWidget,\n                    null,\n                    \"Selection filter, Property Value\", new HelpDefinition(\"The value of the property optionally used (if provided) to further identify a selectable tree element by. Seperate multiple values with spaces.\")));\n\n            base.AddParameterProfile(\n                new ParameterProfile(nameof(TreeSelectorUiControl.SerializedSearchToken),\n                    typeof(string),\n                    false,\n                    new ConstantValueProvider(string.Empty),\n                    StandardWidgetFunctions.TextBoxWidget,\n                    null,\n                    \"Search Token\", new HelpDefinition(\"A search token, serialized, to filter which tree elements is shown. To filter what is selectable, use the 'Selection filter' properties.\")));\n            base.AddParameterProfile(\n                new ParameterProfile(nameof(TreeSelectorUiControl.Required),\n                    typeof(bool),\n                    false,\n                    new ConstantValueProvider(true),\n                    StandardWidgetFunctions.GetBoolSelectorWidget(\"Yes, selection is required\", \"No, a 'none' selection is allowed.\"),\n                    null,\n                    \"Required\", new HelpDefinition(\"An option that indicates whether the user is required to make a selection\")));\n\n        }\n\n\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\n        {\n            XElement formElement = base.BuildBasicWidgetMarkup(\"TreeSelector\", nameof(TreeSelectorUiControl.SelectedKey), label, helpDefinition, bindingSourceName);\n            foreach (var propertyName in new []\n            {\n                nameof(TreeSelectorUiControl.ElementProvider),\n                nameof(TreeSelectorUiControl.SelectableElementReturnValue),\n                nameof(TreeSelectorUiControl.SelectableElementPropertyName),\n                nameof(TreeSelectorUiControl.SelectableElementPropertyValue),\n                nameof(TreeSelectorUiControl.SerializedSearchToken),\n                nameof(TreeSelectorUiControl.Required)\n            })\n            {\n                string propertyValue = parameters.GetParameter<string>(propertyName);\n                formElement.Add(new XAttribute(propertyName, propertyValue));\n            }\n            return formElement;\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/UrlComboBoxWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\r\n{\r\n    internal sealed class UrlComboBoxWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n\t\tprivate const string _functionName = \"UrlComboBox\";\r\n\r\n        /// <exclude />\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" + _functionName;\r\n\r\n\t\tpublic UrlComboBoxWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(string), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n\t\t\tXElement formElement = base.BuildBasicWidgetMarkup(\"UrlComboBox\", \"Text\", label, help, bindingSourceName);\r\n            return formElement;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/VisualXhtmlEditorWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic sealed class VisualXhtmlEditorFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"VisualXhtmlEditor\";\r\n\r\n        /// <exclude />\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".String.\" +_functionName;\r\n        /// <exclude />\r\n        public const string ClassConfigurationNameParameterName = \"ClassConfigurationName\";\r\n        /// <exclude />\r\n        public const string ContainerClassesParameterName = \"ContainerClasses\";\r\n        /// <exclude />\r\n        public const string PreviewPageIdParameterName = \"PreviewPageId\";\r\n        /// <exclude />\r\n        public const string PreviewTemplateIdParameterName = \"PreviewTemplateId\";\r\n        /// <exclude />\r\n        public const string PreviewPlaceholderParameterName = \"PreviewPlaceholder\";\r\n\r\n\r\n        /// <exclude />\r\n        private const string DefaultConfiguration = \"common\";\r\n\r\n        /// <exclude />\r\n        public VisualXhtmlEditorFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(string), entityTokenFactory)\r\n        {\r\n            BuildParameterProfiles();\r\n        }\r\n\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement element = base.BuildBasicWidgetMarkup(\"InlineXhtmlEditor\", \"Xhtml\", label, help, bindingSourceName);\r\n            element.Add(new XAttribute(\"ClassConfigurationName\", parameters.GetParameter<string>(ClassConfigurationNameParameterName)));\r\n\r\n            var pageId = parameters.GetParameter<Guid>(PreviewPageIdParameterName);\r\n            var templateId = parameters.GetParameter<Guid>(PreviewTemplateIdParameterName);\r\n            string placeholderName = parameters.GetParameter<string>(PreviewPlaceholderParameterName);\r\n            string containerClasses = parameters.GetParameter<string>(ContainerClassesParameterName);\r\n\r\n            if (pageId != Guid.Empty)\r\n            {\r\n                element.Add(new XAttribute(\"PreviewPageId\", pageId));\r\n            }\r\n\r\n            if (templateId != Guid.Empty)\r\n            {\r\n                element.Add(new XAttribute(\"PreviewTemplateId\", templateId));\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(placeholderName))\r\n            {\r\n                element.Add(new XAttribute(\"PreviewPlaceholder\", placeholderName));\r\n            }\r\n\r\n            if (!string.IsNullOrWhiteSpace(containerClasses))\r\n            {\r\n                element.Add(new XAttribute(\"ContainerClasses\", containerClasses));\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n        private void BuildParameterProfiles()\r\n        {\r\n            // TODO: localize\r\n            base.AddParameterProfile(new ParameterProfile(ClassConfigurationNameParameterName,\r\n                    typeof(string), false,\r\n                    new ConstantValueProvider(DefaultConfiguration), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"Class configuration name\", \r\n                    new HelpDefinition(\"The visual editor can be configured to offer the editor a special set of class names for formatting xhtml elements. The default value is '\" + DefaultConfiguration + \"'\")\r\n            ));\r\n\r\n            base.AddParameterProfile(new ParameterProfile(ContainerClassesParameterName,\r\n                    typeof(string), false,\r\n                    new ConstantValueProvider(\"\"), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"Container Classes\",\r\n                    new HelpDefinition(\"Class names to attach to the editor (for styling) and to use for filtering components. Seperate multiple names with space or comma.\")\r\n            ));\r\n\r\n            BuildInlineXhtmlEditorParameters().ForEach(AddParameterProfile);\r\n        }\r\n\r\n        internal static IEnumerable<ParameterProfile> BuildInlineXhtmlEditorParameters()\r\n        {\r\n            // TODO: localize\r\n            var templateSelectorWidget = StandardWidgetFunctions.DropDownList(\r\n                    typeof(VisualXhtmlEditorFuntion), StaticReflection.GetMethodInfo(() => PageTemplates()).Name, \"Key\", \"Value\", false, false);\r\n\r\n            yield return new ParameterProfile(PreviewTemplateIdParameterName,\r\n                    typeof(Guid), false,\r\n                    new ConstantValueProvider(Guid.Empty),\r\n                    templateSelectorWidget,\r\n                    null,\r\n                    \"Page template for preview\",\r\n                    new HelpDefinition(\"Page template to be used while generating preview images for the C1 functions calls.\"));\r\n\r\n            yield return new ParameterProfile(PreviewPlaceholderParameterName,\r\n                    typeof(string), false,\r\n                    new ConstantValueProvider(null), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"Page placeholder for preview\",\r\n                    new HelpDefinition(\"Page placeholder to be used while generating preview images for the C1 functions calls. If not specified, the default placeholder for the selected template will be used.\")\r\n            );\r\n\r\n            yield return new ParameterProfile(PreviewPageIdParameterName,\r\n                    typeof(Guid), false,\r\n                    new ConstantValueProvider(Guid.Empty),\r\n                    StandardWidgetFunctions.GetDataReferenceWidget<IPage>(),\r\n                    null,\r\n                    \"Page for preview\",\r\n                    new HelpDefinition(\"Page template to be used while generating preview images. Certain fuctions may require page information for previewing.\"));\r\n        }\r\n\r\n\r\n        private static IEnumerable<KeyValuePair<Guid, string>> PageTemplates()\r\n        {\r\n            return PageTemplateFacade.GetPageTemplates()\r\n                                    .OrderBy(p => p.Title)\r\n                                    .Select(p => new KeyValuePair<Guid, string>(p.Id, p.Title));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Type/DataTypeSelectorWidgetFunction.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.DataType\r\n{\r\n    internal sealed class DataTypeSelectorWidgetFunction : CompositeWidgetFunctionBase\r\n    {\r\n        public static IEnumerable GetOptions()\r\n        {\r\n            return\r\n                DataFacade.GetAllKnownInterfaces(UserType.Developer); //.Where(f=>f.Namespace.StartsWith(typeof(Composite.Data.Types.IPage).Namespace)==false).ToList();\r\n        }\r\n\r\n        private const string _functionName = \"DataTypeSelector\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Type.\" + _functionName;\r\n\r\n        public DataTypeSelectorWidgetFunction(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(Type), entityTokenFactory)\r\n        {\r\n        }\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)\r\n        {\r\n            string tagName = \"TypeSelector\";\r\n\r\n            XElement selector = StandardWidgetFunctions.BuildBasicFormsMarkup(Namespaces.BindingFormsStdUiControls10, tagName, \"SelectedType\", label, helpDefinition, bindingSourceName);\r\n            XNamespace f = Namespaces.BindingFormsStdFuncLib10;\r\n\r\n            selector.Add(\r\n                new XElement(selector.Name.Namespace + (tagName + \".TypeOptions\"),\r\n                    new XElement(f + \"StaticMethodCall\",\r\n                       new XAttribute(\"Type\", TypeManager.SerializeType(this.GetType())),\r\n                       new XAttribute(\"Method\", \"GetOptions\"))));\r\n\r\n            return selector;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Utils/ConsoleIconSelectorWidgetFuntion.cs",
    "content": "using System.Xml.Linq;\n\nusing Composite.Functions;\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\n\n\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Utils\n{\r\n    internal sealed class ConsoleIconSelectorWidgetFuntion : CompositeWidgetFunctionBase\n    {\n        private const string _functionName = \"ConsoleIconSelector\";\n\n        /// <exclude />\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Utils.\" + _functionName;\n\n\n        public ConsoleIconSelectorWidgetFuntion(EntityTokenFactory entityTokenFactory)\n            : base(CompositeName, typeof(string), entityTokenFactory)\n        {\n        }\n\n\n\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\n        {\n            XElement formElement = base.BuildBasicWidgetMarkup(\"ConsoleIconSelector\", \"Selected\", label, help, bindingSourceName);\n            return formElement;\n        }\n\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Utils/FormMarkupWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Utils\r\n{\r\n\tinternal sealed class FormMarkupWidgetFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        private const string _functionName = \"FormMarkup\";\r\n\r\n        /// <exclude />\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Utils.\" + _functionName;\r\n\r\n        /// <exclude />\r\n        /// /// <exclude />\r\n        public const string MarkupParameterName = \"Markup\";\r\n\r\n        public FormMarkupWidgetFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(string), entityTokenFactory)\r\n        {\r\n            var markupParameterProfile =\r\n                new ParameterProfile(MarkupParameterName,\r\n                    typeof(string), true,\r\n                    new ConstantValueProvider(\r\n@\"<TextBox Label=\"\"$label\"\" Help=\"\"$help\"\" SpellCheck=\"\"true\"\">\r\n\t<TextBox.Text>\r\n\t  <cms:bind source=\"\"$binding\"\" />\r\n\t</TextBox.Text>\r\n</TextBox>\"), StandardWidgetFunctions.TextAreaWidget, null,\r\n                    \"Markup\", new HelpDefinition(\"Markup will be inserted into result form markup. Macroses are: '$binding', '$label' and '$help'\"));\r\n\r\n            base.AddParameterProfile(markupParameterProfile);\r\n        }\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            string markup = parameters.GetParameter<string>(MarkupParameterName) ?? \"\";\r\n\r\n            if (string.IsNullOrWhiteSpace(markup))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            markup = @\"<cms:formdefinition xmlns:cms=\"\"http://www.composite.net/ns/management/bindingforms/1.0\"\" xmlns=\"\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\"\">\"\r\n                      + markup\r\n                      + \"</cms:formdefinition>\";\r\n\r\n            XElement xml = XElement.Parse(markup);\r\n\r\n            foreach (var attribute in xml.Descendants().SelectMany(node => node.Attributes()))\r\n            {\r\n                attribute.Value = attribute.Value\r\n                                    .Replace(\"$label\",  label)\r\n                                    .Replace(\"$binding\", bindingSourceName)\r\n                                    .Replace(\"$help\", help != null ? help.HelpText : \"\");\r\n            }\r\n\r\n            return xml.Elements().FirstOrDefault();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/Utils/SvgIconSelectorWidgetFuntion.cs",
    "content": "using System.Xml.Linq;\n\nusing Composite.Functions;\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\n\n\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Utils\n{\r\n    internal sealed class SvgIconSelectorWidgetFuntion : CompositeWidgetFunctionBase\n    {\n        private const string _functionName = \"SvgIconSelector\";\n\n        /// <exclude />\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".Utils.\" + _functionName;\n\n        /// <exclude />\n        public const string SvgSpritePathParameterName = \"SvgSpritePath\";\n\n        public SvgIconSelectorWidgetFuntion(EntityTokenFactory entityTokenFactory)\n            : base(CompositeName, typeof(string), entityTokenFactory)\n        {\n              base.AddParameterProfile(\n                new ParameterProfile(SvgIconSelectorWidgetFuntion.SvgSpritePathParameterName,\n                    typeof(string), true,\n                    new ConstantValueProvider(null), StandardWidgetFunctions.TextBoxWidget, null,\n                    \"Svg Sprite Path\", new HelpDefinition(\"Path to the SVG sprite. Example: ~/Composite/images/sprite.svg\")));\n\n        }\n\n\n\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\n        {\n            string spritePath = parameters.GetParameter<string>(SvgIconSelectorWidgetFuntion.SvgSpritePathParameterName);\n\n            XElement formElement = base.BuildBasicWidgetMarkup(\"SvgIconSelector\", \"Selected\", label, help, bindingSourceName);\n            formElement.Add(new XAttribute(\"SvgSpritePath\", spritePath));\n            return formElement;\n        }\n\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/XhtmlDocument/VisualXhtmlEditorWidgetFuntion.cs",
    "content": "using System;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.Foundation;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\nusing StringSelector = Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.String.VisualXhtmlEditorFuntion;\r\n\r\nnamespace Composite.Plugins.Functions.WidgetFunctionProviders.StandardWidgetFunctionProvider.XhtmlDocument\r\n{\r\n\tinternal sealed class VisualXhtmlEditorFuntion : CompositeWidgetFunctionBase\r\n    {\r\n        public static IEnumerable<Type> GetOptions(object typeManagerTypeName)\r\n        {\r\n            yield return TypeManager.GetType((string)typeManagerTypeName);\r\n        }\r\n\r\n        private const string _functionName = \"VisualXhtmlEditor\";\r\n        public const string CompositeName = CompositeWidgetFunctionBase.CommonNamespace + \".XhtmlDocument.\" + _functionName;\r\n\r\n        public const string ClassConfigurationNameParameterName = \"ClassConfigurationName\";\r\n        public const string ContainerClassesParameterName = \"ContainerClasses\";\r\n        public const string EmbedableFieldTypeParameterName = \"EmbedableFieldsType\";\r\n\r\n\r\n        public VisualXhtmlEditorFuntion(EntityTokenFactory entityTokenFactory)\r\n            : base(CompositeName, typeof(Composite.Core.Xml.XhtmlDocument), entityTokenFactory)\r\n        {\r\n            SetParameterProfiles(\"common\");\r\n        }\r\n\r\n\r\n\r\n\r\n        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition help, string bindingSourceName)\r\n        {\r\n            XElement element = base.BuildBasicWidgetMarkup(\"InlineXhtmlEditor\", \"Xhtml\", label, help, bindingSourceName);\r\n            element.Add(new XAttribute(\"ClassConfigurationName\", parameters.GetParameter<string>(VisualXhtmlEditorFuntion.ClassConfigurationNameParameterName)));\r\n\r\n            var pageId = parameters.GetParameter<Guid>(StringSelector.PreviewPageIdParameterName);\r\n            var templateId = parameters.GetParameter<Guid>(StringSelector.PreviewTemplateIdParameterName);\r\n            string placeholderName = parameters.GetParameter<string>(StringSelector.PreviewPlaceholderParameterName);\r\n            string containerClasses = parameters.GetParameter<string>(ContainerClassesParameterName);\r\n\r\n            if (pageId != Guid.Empty)\r\n            {\r\n                element.Add(new XAttribute(\"PreviewPageId\", pageId));\r\n            }\r\n\r\n            if (templateId != Guid.Empty)\r\n            {\r\n                element.Add(new XAttribute(\"PreviewTemplateId\", templateId));\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(placeholderName))\r\n            {\r\n                element.Add(new XAttribute(\"PreviewPlaceholder\", placeholderName));\r\n            }\r\n\r\n            if (!string.IsNullOrWhiteSpace(containerClasses))\r\n            {\r\n                element.Add(new XAttribute(\"ContainerClasses\", containerClasses));\r\n            }\r\n\r\n            Type embedableFieldType = parameters.GetParameter<Type>(VisualXhtmlEditorFuntion.EmbedableFieldTypeParameterName);\r\n            if (embedableFieldType!=null)\r\n            {\r\n                XNamespace f = Namespaces.BindingFormsStdFuncLib10;\r\n\r\n                element.Add(\r\n                    new XElement(element.Name.Namespace + \"InlineXhtmlEditor.EmbedableFieldsTypes\",\r\n                        new XElement(f + \"StaticMethodCall\",\r\n                           new XAttribute(\"Type\", TypeManager.SerializeType(this.GetType())),\r\n                           new XAttribute(\"Parameters\", TypeManager.SerializeType(embedableFieldType)),\r\n                           new XAttribute(\"Method\", \"GetOptions\"))));\r\n\r\n            }\r\n\r\n            return element;\r\n        }\r\n\r\n\r\n        private void SetParameterProfiles(string classConfigurationName)\r\n        {\r\n            base.AddParameterProfile(new ParameterProfile(VisualXhtmlEditorFuntion.ContainerClassesParameterName,\r\n                    typeof(string), false,\r\n                    new ConstantValueProvider(\"\"), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"Container Classes\",\r\n                    new HelpDefinition(\"Class names to attach to the editor (for styling) and to use for filtering components. Seperate multiple names with space or comma.\")\r\n            ));\r\n\r\n            ParameterProfile classConfigNamePP =\r\n                new ParameterProfile(VisualXhtmlEditorFuntion.ClassConfigurationNameParameterName,\r\n                    typeof(string), false,\r\n                    new ConstantValueProvider(classConfigurationName), StandardWidgetFunctions.TextBoxWidget, null,\r\n                    \"Class configuration name\", new HelpDefinition(\"The visual editor can be configured to offer the editor a special set of class names for formatting xhtml elements. The default value is '\" + classConfigurationName + \"'\"));\r\n\r\n            base.AddParameterProfile(classConfigNamePP);\r\n\r\n            ParameterProfile typeNamePP =\r\n                new ParameterProfile(VisualXhtmlEditorFuntion.EmbedableFieldTypeParameterName,\r\n                    typeof(Type), false,\r\n                    new ConstantValueProvider(null), StandardWidgetFunctions.DataTypeSelectorWidget, null,\r\n                    \"Embedable fields, Data type\", new HelpDefinition(\"If a data type is selected, fields from this type can be inserted into the xhtml.\"));\r\n\r\n            base.AddParameterProfile(typeNamePP);\r\n\r\n            StringSelector.BuildInlineXhtmlEditorParameters().ForEach(AddParameterProfile);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/XslExtensionsProviders/CaptchaXslExtension.cs",
    "content": "﻿using System;\r\nusing Composite.Core.WebClient.Captcha;\r\nusing Composite.Plugins.Functions.XslExtensionsProviders.ConfigBasedXslExtensionsProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Functions.XslExtensionsProviders\r\n{\r\n    [ConfigurationElementType(typeof(ConfigBasedXslExtensionInfo))]\r\n    internal class CaptchaXslExtension\r\n    {\r\n        public string GetEncryptedValue(string oldValue)\r\n        {\r\n            if(EncryptedValueIsValid(oldValue))\r\n            {\r\n                return oldValue;\r\n            }\r\n            return CreateEncryptedValue();\r\n        }\r\n\r\n        public string CreateEncryptedValue()\r\n        {\r\n            return Captcha.CreateEncryptedValue();\r\n        }\r\n\r\n        public string GetImageUrl(string encryptedCaptchaValue)\r\n        {\r\n            return Captcha.GetImageUrl(encryptedCaptchaValue);\r\n        }\r\n\r\n        public bool IsValid(string value, string encryptedValue)\r\n        {\r\n            return Captcha.IsValid(value, encryptedValue);\r\n        }\r\n\r\n        public bool EncryptedValueIsValid(string encryptedValue)\r\n        {\r\n            return Captcha.IsValid(encryptedValue);\r\n        }\r\n\r\n        public void RegisterUsage(string encryptedValue)\r\n        {\r\n            Captcha.RegisterUsage(encryptedValue);\r\n        }\r\n\r\n        public bool IsAlreadyUsed(string encryptedValue)\r\n        {\r\n            return Captcha.IsAlreadyUsed(encryptedValue);\r\n        }\r\n\r\n        public static bool Decrypt(string encryptedValue, out DateTime timestamp, out string value)\r\n        {\r\n            return Captcha.Decrypt(encryptedValue, out timestamp, out value);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Functions/XslExtensionsProviders/ConfigBasedXslExtensionsProvider/ConfigBasedXslExtensionsProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Reflection;\r\nusing Composite.Functions.Plugins.XslExtensionsProvider;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Functions.XslExtensionsProviders.ConfigBasedXslExtensionsProvider\r\n{\r\n    [ConfigurationElementType(typeof(ConfigBasedXslExtensionsProviderData))]\r\n    internal class ConfigBasedXslExtensionsProvider : IXslExtensionsProvider\r\n\t{\r\n        private object _syncRoot = new object();\r\n        private List<KeyValuePair<string, ConstructorInfo>> _constructors;\r\n        private ConfigBasedXslExtensionsProviderData _providerData;\r\n\r\n        internal ConfigBasedXslExtensionsProvider(ConfigBasedXslExtensionsProviderData providerData)\r\n        {\r\n            _providerData = providerData;\r\n        }\r\n\r\n        public List<Pair<string, object>> CreateExtensions()\r\n        {\r\n            var result = new List<Pair<string, object>>();\r\n\r\n            if(_constructors == null)\r\n            {\r\n                lock(_syncRoot)\r\n                {\r\n                    if(_constructors == null)\r\n                    {\r\n                        var constructors = new List<KeyValuePair<string, ConstructorInfo>>();\r\n                        if (_providerData == null)\r\n                        {\r\n                            return result;\r\n                        }\r\n\r\n                        foreach (var configLine in _providerData.XslExtensions)\r\n                        {\r\n                            PropertyInformation propertyInformation = configLine.ElementInformation.Properties[\"type\"];\r\n                            if (propertyInformation == null) continue;\r\n\r\n                            Type type = propertyInformation.Value as Type;\r\n                            if (type == null) continue;\r\n\r\n                            ConstructorInfo constructor = type.GetConstructors()[0];\r\n                            constructors.Add(new KeyValuePair<string, ConstructorInfo>(configLine.Name, constructor));\r\n                        }\r\n\r\n                        // TODO: uncomment\r\n                        _constructors = constructors;\r\n                    }\r\n                }\r\n            }\r\n\r\n            foreach(var pair in _constructors)\r\n            {\r\n                object instance = pair.Value.Invoke(new object[0]);\r\n                result.Add(new Pair<string, object>(pair.Key, instance));\r\n            }\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/XslExtensionsProviders/ConfigBasedXslExtensionsProvider/ConfigBasedXslExtensionsProviderData.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Functions.Plugins.XslExtensionsProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.Functions.XslExtensionsProviders.ConfigBasedXslExtensionsProvider\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [Assembler(typeof(ConfigBasedXslExtensionsProviderAssembler))]\r\n\tinternal sealed class ConfigBasedXslExtensionsProviderData: XslExtensionsProviderData\r\n\t{\r\n\r\n        public const string SectionName = \"Composite.XslExtensions\";\r\n\r\n        private const string _xslExtensionsProperty = \"xslExtensions\";\r\n        [ConfigurationProperty(_xslExtensionsProperty)]\r\n        public NameTypeManagerTypeConfigurationElementCollection<ConfigBasedXslExtensionInfo> XslExtensions\r\n        {\r\n            get\r\n            {\r\n                return (NameTypeManagerTypeConfigurationElementCollection<ConfigBasedXslExtensionInfo>)base[_xslExtensionsProperty];\r\n            }\r\n        }\r\n\t}\r\n\r\n\r\n\r\n    internal sealed class ConfigBasedXslExtensionsProviderAssembler : IAssembler<IXslExtensionsProvider, XslExtensionsProviderData>\r\n    {\r\n        public IXslExtensionsProvider Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, XslExtensionsProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            ConfigBasedXslExtensionsProviderData myConfiguration = (ConfigBasedXslExtensionsProviderData)objectConfiguration;\r\n            return new ConfigBasedXslExtensionsProvider(myConfiguration);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ConfigBasedXslExtensionInfo : NameTypeManagerTypeConfigurationElement\r\n    {\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite/Plugins/Functions/XslExtensionsProviders/StandardExtension.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text.RegularExpressions;\r\nusing System.Web;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.XPath;\r\nusing Composite.Functions;\r\nusing Composite.Core.Logging;\r\nusing Composite.Plugins.Functions.XslExtensionsProviders.ConfigBasedXslExtensionsProvider;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Xml;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Functions.XslExtensionsProviders\r\n{\r\n    [ConfigurationElementType(typeof(ConfigBasedXslExtensionInfo))]\r\n\tinternal class StandardExtension\r\n\t{\r\n\t    public static readonly string XmlNamespace = \"http://c1.composite.net/StandardFunctions\";\r\n\r\n        private static readonly string EmailAddressRegex =\r\n            @\"^([a-zA-Z0-9_\\-\\+\\.]+)@((\\[[0-9]{1,3}\" +\r\n            @\"\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\\" +\r\n            @\".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$\";\r\n\r\n        private static readonly Regex _emailValidationRegex = new Regex(EmailAddressRegex);\r\n\r\n        public object CacheFunctionCall(XPathNodeIterator nodeIterator, string cacheKey, int expirationInSeconds)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(cacheKey, \"cacheKey\");\r\n\r\n            var cache = HttpRuntime.Cache;\r\n\r\n            object value = cache[cacheKey];\r\n            if (value == null)\r\n            {\r\n                value = CallFunction(nodeIterator);\r\n\r\n                cache.Add(cacheKey, value, null,\r\n                          DateTime.Now.AddSeconds(expirationInSeconds),\r\n                          TimeSpan.Zero,\r\n                          System.Web.Caching.CacheItemPriority.Default,\r\n                          null);\r\n            }\r\n\r\n            return value;\r\n        }\r\n\r\n        public object CallFunction(XPathNodeIterator nodeIterator)\r\n        {\r\n            Verify.ArgumentNotNull(nodeIterator, \"nodeIterator\");\r\n\r\n            if (!nodeIterator.MoveNext())\r\n            {\r\n                return string.Empty;\r\n            }\r\n\r\n            XPathNavigator navigator = nodeIterator.Current;\r\n\r\n            XElement functionNode = GetXElement(navigator);\r\n\r\n            if (functionNode == null)\r\n            {\r\n                LoggingService.LogWarning(\"StandardXslExtendion\", \"Failed to get a function definition.\");\r\n                return string.Empty;\r\n            }\r\n\r\n\r\n            BaseRuntimeTreeNode runtimeTreeNode = FunctionTreeBuilder.Build(functionNode);\r\n\r\n            object result = runtimeTreeNode.GetValue(new FunctionContextContainer());\r\n\r\n            if (result is XElement)\r\n            {\r\n                return (result as XElement).CreateNavigator();\r\n            }\r\n\r\n            if (result is IEnumerable<XElement>)\r\n            {\r\n                return new FunctionResultNodeIterator(result as IEnumerable<XElement>);\r\n            }\r\n\r\n            if(result is XhtmlDocument)\r\n            {\r\n                return (result as XhtmlDocument).Root.CreateNavigator();\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Checks whether an email address is valid.\r\n        /// </summary>\r\n        /// <param name=\"email\">The email address.</param>\r\n        /// <returns></returns>\r\n        public bool IsEmailValid(string email)\r\n        {\r\n            if (email.IsNullOrEmpty())\r\n            {\r\n                return false;\r\n            }\r\n            return _emailValidationRegex.IsMatch(email.Trim());\r\n        }\r\n \r\n        /// <summary>\r\n        /// Checks whether an email list  is valid.\r\n        /// </summary>\r\n        /// <param name=\"emailList\">The email list.</param>\r\n        /// <returns></returns>\r\n        public bool IsEmailListValid(string emailList)\r\n        {\r\n            var emails = emailList.Split(new[] {',', ';'});\r\n            return !emails.Any(email => !IsEmailValid(email.Trim()));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets an http form post value.\r\n        /// </summary>\r\n        /// <param name=\"key\">The key.</param>\r\n        /// <returns></returns>\r\n        public string GetFormData(string key)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if (httpContext == null\r\n                || httpContext.Request == null\r\n                || httpContext.Request.Form == null)\r\n            {\r\n                return string.Empty;\r\n            }\r\n\r\n            return httpContext.Request.Form[key] ?? string.Empty;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a query string parameter value.\r\n        /// </summary>\r\n        /// <param name=\"key\">The key.</param>\r\n        /// <returns></returns>\r\n        public string GetQueryStringValue(string key)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if (httpContext == null\r\n                || httpContext.Request == null\r\n                || httpContext.Request.QueryString == null)\r\n            {\r\n                return string.Empty;\r\n            }\r\n            return httpContext.Request.QueryString[key] ?? string.Empty;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a cookie's value.\r\n        /// </summary>\r\n        /// <param name=\"key\">The key.</param>\r\n        /// <returns></returns>\r\n        public string GetCookieValue(string key)\r\n        {\r\n            var httpContext = HttpContext.Current;\r\n            if (httpContext == null\r\n                || httpContext.Request == null\r\n                || httpContext.Request.Cookies == null)\r\n            {\r\n                return string.Empty;\r\n            }\r\n\r\n            var cookie = httpContext.Request.Cookies[key];\r\n            return cookie != null ? cookie.Value : string.Empty;\r\n        }\r\n\r\n\r\n        protected static XElement GetXElement(XPathNavigator navigator)\r\n        {\r\n            XDocument xDoc = new XDocument();\r\n\r\n            using (XmlWriter xmlWriter = xDoc.CreateWriter())\r\n\r\n                navigator.WriteSubtree(xmlWriter);\r\n\r\n            return xDoc.Root;\r\n        }\r\n\r\n\t    protected static XElement GetXElement(XmlNode node)\r\n        {\r\n            XDocument xDoc = new XDocument();\r\n\r\n            using (XmlWriter xmlWriter = xDoc.CreateWriter())\r\n\r\n                node.WriteTo(xmlWriter);\r\n\r\n            return xDoc.Root;\r\n        }\r\n\r\n        protected static XmlNode GetXmlNode(XElement element)\r\n        {\r\n\r\n            using (XmlReader xmlReader = element.CreateReader())\r\n            {\r\n\r\n                XmlDocument xmlDoc = new XmlDocument();\r\n\r\n                xmlDoc.Load(xmlReader);\r\n\r\n                return xmlDoc;\r\n            }\r\n        }\r\n\r\n        #region Nested classes\r\n\r\n        internal class FunctionResultNodeIterator: XPathNodeIterator\r\n        {\r\n            private readonly IEnumerable<XElement> _innerEnumerable;\r\n            private readonly IEnumerator<XElement> _iterator;\r\n            private int _position;\r\n\r\n            public FunctionResultNodeIterator(IEnumerable<XElement> innerEnumerable)\r\n            {\r\n                _innerEnumerable = innerEnumerable;\r\n                _iterator = innerEnumerable.GetEnumerator();\r\n            }\r\n\r\n            public override XPathNodeIterator Clone()\r\n            {\r\n                return new FunctionResultNodeIterator(_innerEnumerable);\r\n            }\r\n\r\n            public override XPathNavigator Current\r\n            {\r\n                get { return GetXmlNode(_iterator.Current).CreateNavigator(); }\r\n            }\r\n\r\n            public override int CurrentPosition\r\n            {\r\n                get { return _position; }\r\n            }\r\n\r\n            public override bool MoveNext()\r\n            {\r\n                bool result = _iterator.MoveNext();\r\n                if(result)\r\n                {\r\n                    _position++;\r\n                }\r\n                return result;\r\n            }\r\n        }\r\n\r\n        #endregion\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/GlobalSettings/GlobalSettingsProviders/ConfigBasedGlobalSettingsProvider.cs",
    "content": "using Composite.Core.Configuration;\r\nusing Composite.Core.Configuration.Plugins.GlobalSettingsProvider;\r\nusing Composite.Core.Extensions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.Plugins.GlobalSettings.GlobalSettingsProviders\r\n{\r\n    [ConfigurationElementType(typeof(ConfigBasedGlobalSettingsProviderData))]\r\n    internal sealed class ConfigBasedGlobalSettingsProvider : IGlobalSettingsProvider\r\n    {\r\n        private readonly ConfigBasedGlobalSettingsProviderData _configurationData;\r\n        private readonly ICachingSettings _cachingSettings;\r\n        private readonly List<string> _nonProbeableAssemblyNames;\r\n\r\n        public ConfigBasedGlobalSettingsProvider(ConfigBasedGlobalSettingsProviderData configurationData)\r\n        {\r\n            _configurationData = configurationData;\r\n            _cachingSettings = new ConfigCachingSettings(configurationData.Caching);\r\n\r\n            string cleannonProbeString = _configurationData.NonProbeableAssemblyNames.Replace(\" \", \"\");\r\n            _nonProbeableAssemblyNames = new List<string>(cleannonProbeString.Split(','));\r\n        }\r\n\r\n\r\n        public string AppCodeDirectory => _configurationData.AppCodeDirectory;\r\n\r\n        public string ApplicationName => _configurationData.ApplicationName;\r\n\r\n        public string ApplicationShortName => _configurationData.ApplicationShortName;\r\n\r\n        public string BrandedVersionAssemblySource => _configurationData.BrandedVersionAssemblySource;\r\n\r\n        public string DefaultCultureName => _configurationData.DefaultCultureName;\r\n\r\n        public string ConfigurationDirectory => _configurationData.ConfigurationDirectory;\r\n\r\n        public string GeneratedAssembliesDirectory => _configurationData.GeneratedAssembliesDirectory;\r\n\r\n        public string SerializedWorkflowsDirectory => _configurationData.SerializedWorkflowsDirectory;\r\n\r\n        public string SerializedConsoleMessagesDirectory => _configurationData.SerializedConsoleMessagesDirectory;\r\n\r\n        public string BinDirectory => _configurationData.BinDirectory;\r\n\r\n        public string TempDirectory => _configurationData.TempDirectory;\r\n\r\n        public string CacheDirectory => _configurationData.CacheDirectory;\r\n\r\n        public string PackageDirectory => _configurationData.PackageDirectory;\r\n\r\n        public string AutoPackageInstallDirectory => _configurationData.AutoPackageInstallDirectory;\r\n\r\n        public string TreeDefinitionsDirectory => _configurationData.TreeDefinitionsDirectory;\r\n\r\n        public string PageTemplateFeaturesDirectory => _configurationData.PageTemplateFeaturesDirectory;\r\n\r\n        public string DataMetaDataDirectory => _configurationData.DataMetaDataDirectory;\r\n\r\n        public string InlineCSharpFunctionDirectory => _configurationData.InlineCSharpFunctionDirectory;\r\n\r\n        public string PackageLicenseDirectory => _configurationData.PackageLicenseDirectory;\r\n\r\n        public IEnumerable<string> NonProbableAssemblyNames => _nonProbeableAssemblyNames;\r\n\r\n        public int ConsoleMessageQueueItemSecondToLive => _configurationData.ConsoleMessageQueueItemSecondToLive;\r\n\r\n        public bool EnableDataTypesAutoUpdate => _configurationData.EnableDataTypesAutoUpdate;\r\n\r\n        public bool BroadcastConsoleElementChanges => _configurationData.BroadcastConsoleElementChanges;\r\n\r\n        public string AutoCreatedAdministratorUserName => _configurationData.AutoCreatedAdministratorUserName;\r\n\r\n        public bool OnlyTranslateWhenApproved => _configurationData.OnlyTranslateWhenApproved;\r\n\r\n        public bool AllowChildPagesTranslationWithoutParent => _configurationData.AllowChildPagesTranslationWithoutParent;\r\n\r\n        public string WorkflowTimeout => _configurationData.WorkflowTimeout;\r\n\r\n        public string ConsoleTimeout => _configurationData.ConsoleTimeout;\r\n\r\n        public ICachingSettings Caching => _cachingSettings;\r\n\r\n        public int ImageQuality => _configurationData.ImageQuality;\r\n\r\n        public bool PrettifyPublicMarkup => _configurationData.PrettifyPublicMarkup;\r\n\r\n        public bool PrettifyRenderFunctionExceptions => _configurationData.PrettifyRenderFunctionExceptions;\r\n\r\n        public bool FunctionPreviewEnabled => _configurationData.FunctionPreviewEnabled;\r\n\r\n        public TimeZoneInfo TimeZone => \r\n            TimeZoneInfo.FindSystemTimeZoneById(\r\n                _configurationData.TimeZone.IsNullOrEmpty() \r\n                    ? TimeZoneInfo.Local.Id\r\n                    : _configurationData.TimeZone);\r\n\r\n        public bool InheritGlobalReadPermissionOnHiddenPerspectives =>\r\n            _configurationData.InheritGlobalReadPermissionOnHiddenPerspectives;\r\n\r\n        public bool OmitAspNetWebFormsSupport => _configurationData.OmitAspNetWebFormsSupport;\r\n\r\n        public bool ProtectResizedImagesWithHash => _configurationData.ProtectResizedImagesWithHash;\r\n    }\r\n\r\n    internal class ConfigCachingSettings: ICachingSettings\r\n    {\r\n        private readonly CachingConfigurationElement _data;\r\n\r\n        public ConfigCachingSettings(CachingConfigurationElement data)\r\n        {\r\n            _data = data;\r\n        }\r\n\r\n        public bool Enabled => _data.Enabled;\r\n\r\n        public IEnumerable<ICacheSettings> Caches\r\n        {\r\n            get\r\n            {\r\n                return _data.Cast<CacheSettingsElement>()\r\n                            .Select(element => new ConfigCacheSettings(element));\r\n            }\r\n        }\r\n    }\r\n\r\n    \r\n    \r\n    internal class ConfigCacheSettings: ICacheSettings\r\n    {\r\n        public ConfigCacheSettings(CacheSettingsElement data)\r\n        {\r\n            Name = data.Name;\r\n            Enabled = data.Enabled;\r\n            Size = data.Size;\r\n        }\r\n\r\n        public string Name { get; }\r\n        public bool Enabled { get; }\r\n        public int Size { get; }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class ConfigBasedGlobalSettingsProviderAssembler : IAssembler<IGlobalSettingsProvider, GlobalSettingsProviderData>\r\n    {\r\n        public IGlobalSettingsProvider Assemble(IBuilderContext context, GlobalSettingsProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            return new ConfigBasedGlobalSettingsProvider((ConfigBasedGlobalSettingsProviderData)objectConfiguration);\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    [Assembler(typeof(ConfigBasedGlobalSettingsProviderAssembler))]\r\n    internal sealed class ConfigBasedGlobalSettingsProviderData : GlobalSettingsProviderData\r\n    {\r\n        private const string _applicationNamePropertyName = \"applicationName\";\r\n        [ConfigurationProperty(_applicationNamePropertyName, IsRequired = true, DefaultValue = \"C1 CMS\")]\r\n        public string ApplicationName\r\n        {\r\n            get { return (string)base[_applicationNamePropertyName]; }\r\n            set { base[_applicationNamePropertyName] = value; }\r\n        }\r\n\r\n        private const string _applicationShortNamePropertyName = \"applicationShortName\";\r\n        [ConfigurationProperty(_applicationShortNamePropertyName, IsRequired = true, DefaultValue = \"CMS\")]\r\n        public string ApplicationShortName\r\n        {\r\n            get { return (string)base[_applicationShortNamePropertyName]; }\r\n            set { base[_applicationShortNamePropertyName] = value; }\r\n        }\r\n\r\n        private const string _brandedVersionAssemblySourcePropertyName = \"brandedVersionAssemblySource\";\r\n        [ConfigurationProperty(_brandedVersionAssemblySourcePropertyName, IsRequired = false, DefaultValue = \"Composite\")]\r\n        public string BrandedVersionAssemblySource\r\n        {\r\n            get { return (string)base[_brandedVersionAssemblySourcePropertyName]; }\r\n            set { base[_brandedVersionAssemblySourcePropertyName] = value; }\r\n        }\r\n        \r\n\r\n\r\n        private const string _defaultCultureNamePropertyName = \"defaultCultureName\";\r\n        [ConfigurationProperty(_defaultCultureNamePropertyName, DefaultValue = \"en-US\")]\r\n        public string DefaultCultureName\r\n        {\r\n            get { return (string)base[_defaultCultureNamePropertyName]; }\r\n            set { base[_defaultCultureNamePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _configurationDirectoryPropertyName = \"customConfigurationDirectory\";\r\n        [ConfigurationProperty(_configurationDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string ConfigurationDirectory\r\n        {\r\n            get { return (string)base[_configurationDirectoryPropertyName]; }\r\n            set { base[_configurationDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _generatedAssembliesDirectoryPropertyName = \"generatedAssembliesDirectory\";\r\n        [ConfigurationProperty(_generatedAssembliesDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string GeneratedAssembliesDirectory\r\n        {\r\n            get { return (string)base[_generatedAssembliesDirectoryPropertyName]; }\r\n            set { base[_generatedAssembliesDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _serializedWorkflowsDirectoryPropertyName = \"serializedWorkflowsDirectory\";\r\n        [ConfigurationProperty(_serializedWorkflowsDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string SerializedWorkflowsDirectory\r\n        {\r\n            get { return (string)base[_serializedWorkflowsDirectoryPropertyName]; }\r\n            set { base[_serializedWorkflowsDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _serializedConsoleMessagesDirectoryPropertyName = \"serializedConsoleMessagesDirectory\";\r\n        [ConfigurationProperty(_serializedConsoleMessagesDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string SerializedConsoleMessagesDirectory\r\n        {\r\n            get { return (string)base[_serializedConsoleMessagesDirectoryPropertyName]; }\r\n            set { base[_serializedConsoleMessagesDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n        private const string _appCodeDirectoryPropertyName = \"appCodeDirectory\";\r\n        [ConfigurationProperty(_appCodeDirectoryPropertyName, DefaultValue = \"App_Code\")]\r\n        public string AppCodeDirectory\r\n        {\r\n            get { return (string)base[_appCodeDirectoryPropertyName]; }\r\n            set { base[_appCodeDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _binDirectoryPropertyName = \"binDirectory\";\r\n        [ConfigurationProperty(_binDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string BinDirectory\r\n        {\r\n            get { return (string)base[_binDirectoryPropertyName]; }\r\n            set { base[_binDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _tempDirectoryPropertyName = \"tempDirectory\";\r\n        [ConfigurationProperty(_tempDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string TempDirectory\r\n        {\r\n            get { return (string)base[_tempDirectoryPropertyName]; }\r\n            set { base[_tempDirectoryPropertyName] = value; }\r\n        }\r\n        \r\n        private const string _cacheDirectoryPropertyName = \"cacheDirectory\";\r\n        [ConfigurationProperty(_cacheDirectoryPropertyName, DefaultValue = \"~/App_Data/Composite/Cache\")]\r\n        public string CacheDirectory\r\n        {\r\n            get { return (string)base[_cacheDirectoryPropertyName]; }\r\n            set { base[_cacheDirectoryPropertyName] = value; }\r\n        }\r\n\r\n        private const string _packageDirectoryPropertyName = \"packageDirectory\";\r\n        [ConfigurationProperty(_packageDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string PackageDirectory\r\n        {\r\n            get { return (string)base[_packageDirectoryPropertyName]; }\r\n            set { base[_packageDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _autoPackageInstallDirectoryPropertyName = \"autoPackageInstallDirectory\";\r\n        [ConfigurationProperty(_autoPackageInstallDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string AutoPackageInstallDirectory\r\n        {\r\n            get { return (string)base[_autoPackageInstallDirectoryPropertyName]; }\r\n            set { base[_autoPackageInstallDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _treeDefinitionsDirectoryPropertyName = \"treeDefinitionsDirectory\";\r\n        [ConfigurationProperty(_treeDefinitionsDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string TreeDefinitionsDirectory\r\n        {\r\n            get { return (string)base[_treeDefinitionsDirectoryPropertyName]; }\r\n            set { base[_treeDefinitionsDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _pageTemplateFeaturesDirectoryPropertyName = \"pageTemplateFeaturesDirectory\";\r\n        [ConfigurationProperty(_pageTemplateFeaturesDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string PageTemplateFeaturesDirectory\r\n        {\r\n            get { return (string)base[_pageTemplateFeaturesDirectoryPropertyName]; }\r\n            set { base[_pageTemplateFeaturesDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _dataMetaDataDirectoryPropertyName = \"dataMetaDataDirectory\";\r\n        [ConfigurationProperty(_dataMetaDataDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string DataMetaDataDirectory\r\n        {\r\n            get { return (string)base[_dataMetaDataDirectoryPropertyName]; }\r\n            set { base[_dataMetaDataDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _inlineCSharpFunctionDirectoryPropertyName = \"inlineCSharpFunctionDirectory\";\r\n        [ConfigurationProperty(_inlineCSharpFunctionDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string InlineCSharpFunctionDirectory\r\n        {\r\n            get { return (string)base[_inlineCSharpFunctionDirectoryPropertyName]; }\r\n            set { base[_inlineCSharpFunctionDirectoryPropertyName] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _packageLicenseDirectoryPropertyName = \"packageLicenseDirectory\";\r\n        [ConfigurationProperty(_packageLicenseDirectoryPropertyName, DefaultValue = \"~\")]\r\n        public string PackageLicenseDirectory\r\n        {\r\n            get { return (string)base[_packageLicenseDirectoryPropertyName]; }\r\n            set { base[_packageLicenseDirectoryPropertyName] = value; }\r\n        }\r\n        \r\n\r\n        private const int A_DAY_IN_MINUTES = 24*60;\r\n        private const int A_WEEK_IN_MINUTES = 7*24*60;\r\n\r\n\r\n        private const string _resourceCacheDirectory = \"resourceCacheDirectory\";\r\n        [Obsolete]\r\n        [ConfigurationProperty(_resourceCacheDirectory, IsRequired = false)]\r\n        public string ResourceCacheDirectory\r\n        {\r\n            get { return (string)base[_resourceCacheDirectory]; }\r\n            set { base[_resourceCacheDirectory] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _clientCacheMinutesProperty = \"clientCacheMinutes\";\r\n        public static readonly int DefaultClientCacheMinutes = A_WEEK_IN_MINUTES;\r\n        [Obsolete]\r\n        [ConfigurationProperty(_clientCacheMinutesProperty, IsRequired = false, DefaultValue = A_WEEK_IN_MINUTES)]\r\n        public int ClientCacheMinutes\r\n        {\r\n            get { return (int)base[_clientCacheMinutesProperty]; }\r\n            set { base[_clientCacheMinutesProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _serverCacheMinutesProperty = \"serverCacheMinutes\";\r\n        public static readonly int DefaultServerCacheMinutes = A_DAY_IN_MINUTES;\r\n        [Obsolete]\r\n        [ConfigurationProperty(_serverCacheMinutesProperty, IsRequired = false, DefaultValue = A_DAY_IN_MINUTES)]\r\n        public int ServerCacheMinutes\r\n        {\r\n            get { return (int)base[_serverCacheMinutesProperty]; }\r\n            set { base[_serverCacheMinutesProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _nonProbeableAssemblyNames = \"nonProbeableAssemblyNames\";\r\n        [ConfigurationProperty(_nonProbeableAssemblyNames, IsRequired = false, DefaultValue = \"\")]\r\n        public string NonProbeableAssemblyNames\r\n        {\r\n            get { return (string)base[_nonProbeableAssemblyNames]; }\r\n            set { base[_nonProbeableAssemblyNames] = value; }\r\n        }\r\n\r\n\r\n        private const string _onlyTranslateWhenApproved = \"onlyTranslateWhenApproved\";\r\n        [ConfigurationProperty(_onlyTranslateWhenApproved, IsRequired = false, DefaultValue = false)]\r\n        public bool OnlyTranslateWhenApproved\r\n        {\r\n            get { return (bool)base[_onlyTranslateWhenApproved]; }\r\n            set { base[_onlyTranslateWhenApproved] = value; }\r\n        }\r\n\r\n        private const string _allowChildPagesTranslationWithoutParent = \"allowChildPagesTranslationWithoutParent\";\r\n        [ConfigurationProperty(_allowChildPagesTranslationWithoutParent, IsRequired = false, DefaultValue = false)]\r\n        public bool AllowChildPagesTranslationWithoutParent\r\n        {\r\n            get { return (bool)base[_allowChildPagesTranslationWithoutParent]; }\r\n            set { base[_allowChildPagesTranslationWithoutParent] = value; }\r\n        }\r\n\r\n        private const string _applicationCultureNames = \"applicationCultureNames\";\r\n        [ConfigurationProperty(_applicationCultureNames, IsRequired = false, DefaultValue = \"da-DK,en-US\")]\r\n        [Obsolete(\"Preserved for compatibility with old language packages (versions older than C1 4.0)\")]\r\n        public string ApplicationCultureNames\r\n        {\r\n            get { return (string)base[_applicationCultureNames]; }\r\n            set { base[_applicationCultureNames] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _consoleMessageQueueItemSecondToLiveProperty = \"consoleMessageQueueItemSecondToLive\";\r\n        public static readonly int DefaultConsoleMessageQueueItemSecondToLive = 600;\r\n        [ConfigurationProperty(_consoleMessageQueueItemSecondToLiveProperty, IsRequired = false, DefaultValue = 600)]\r\n        public int ConsoleMessageQueueItemSecondToLive\r\n        {\r\n            get { return (int)base[_consoleMessageQueueItemSecondToLiveProperty]; }\r\n            set { base[_consoleMessageQueueItemSecondToLiveProperty] = value; }\r\n        }\r\n\r\n\r\n        private const string _enableDataTypesAutoUdpatePropertyName = \"enableDataTypesAutoUpdate\";\r\n        [ConfigurationProperty(_enableDataTypesAutoUdpatePropertyName, DefaultValue = true)]\r\n        public bool EnableDataTypesAutoUpdate\r\n        {\r\n            get { return (bool)base[_enableDataTypesAutoUdpatePropertyName]; }\r\n            set { base[_enableDataTypesAutoUdpatePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _broadcastConsoleElementChangesPropertyName = \"broadcastConsoleElementChanges\";\r\n        [ConfigurationProperty(_broadcastConsoleElementChangesPropertyName, DefaultValue = true)]\r\n        public bool BroadcastConsoleElementChanges\r\n        {\r\n            get { return (bool)base[_broadcastConsoleElementChangesPropertyName]; }\r\n            set { base[_broadcastConsoleElementChangesPropertyName] = value; }\r\n        }\r\n        \r\n\r\n\r\n        private const string _autoCreatedAdministratorUserNamePropertyName = \"autoCreatedAdministratorUserName\";\r\n        [ConfigurationProperty(_autoCreatedAdministratorUserNamePropertyName, DefaultValue = \"\")]\r\n        public string AutoCreatedAdministratorUserName\r\n        {\r\n            get { return (string)base[_autoCreatedAdministratorUserNamePropertyName]; }\r\n            set { base[_autoCreatedAdministratorUserNamePropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _workflowTimeoutPropertyName = \"workflowTimeout\";\r\n        [ConfigurationProperty(_workflowTimeoutPropertyName, DefaultValue = \"7.00:00:00\")]\r\n        public string WorkflowTimeout\r\n        {\r\n            get { return (string)base[_workflowTimeoutPropertyName]; }\r\n            set { base[_workflowTimeoutPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _consoleTimeoutPropertyName = \"consoleTimeout\";\r\n        [ConfigurationProperty(_consoleTimeoutPropertyName, DefaultValue = \"00:05:00\")]\r\n        public string ConsoleTimeout\r\n        {\r\n            get { return (string)base[_consoleTimeoutPropertyName]; }\r\n            set { base[_consoleTimeoutPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _cachingElementName = \"Caching\";\r\n        [ConfigurationProperty(_cachingElementName)]\r\n        public CachingConfigurationElement Caching\r\n        {\r\n            get { return (CachingConfigurationElement)base[_cachingElementName]; }\r\n            set { base[_cachingElementName] = value; }\r\n        }\r\n\r\n\r\n        private const string _imageQualityPropertyName = \"imageQuality\";\r\n        [ConfigurationProperty(_imageQualityPropertyName, DefaultValue = 80)]\r\n        public int ImageQuality\r\n        {\r\n            get { return (int)base[_imageQualityPropertyName]; }\r\n            set { base[_imageQualityPropertyName] = value; }\r\n        }\r\n\r\n                \r\n        private const string _prettifyPublicMarkupPropertyName = \"prettifyPublicMarkup\";\r\n        [ConfigurationProperty(_prettifyPublicMarkupPropertyName, DefaultValue = true)]\r\n        public bool PrettifyPublicMarkup\r\n        {\r\n            get { return (bool)base[_prettifyPublicMarkupPropertyName]; }\r\n            set { base[_prettifyPublicMarkupPropertyName] = value; }\r\n        }\r\n\r\n\r\n        private const string _prettifyRenderFunctionExceptionsPropertyName = \"prettifyRenderFunctionExceptions\";\r\n        [ConfigurationProperty(_prettifyRenderFunctionExceptionsPropertyName, DefaultValue = true)]\r\n        public bool PrettifyRenderFunctionExceptions\r\n        {\r\n            get { return (bool)base[_prettifyRenderFunctionExceptionsPropertyName]; }\r\n            set { base[_prettifyRenderFunctionExceptionsPropertyName] = value; }\r\n        }\r\n\r\n        private const string _functionPreviewEnabledPropertyName = \"functionPreviewEnabled\";\r\n        [ConfigurationProperty(_functionPreviewEnabledPropertyName, DefaultValue = true)]\r\n        public bool FunctionPreviewEnabled\r\n        {\r\n            get { return (bool)base[_functionPreviewEnabledPropertyName]; }\r\n            set { base[_functionPreviewEnabledPropertyName] = value; }\r\n        }\r\n\r\n        private const string TimeZonePropertyName = \"timezone\";\r\n        [ConfigurationProperty(TimeZonePropertyName, DefaultValue = null)]\r\n        public string TimeZone {\r\n            get\r\n            {\r\n                return (string)base[TimeZonePropertyName]; \r\n            }\r\n            set { base[TimeZonePropertyName] = value; }\r\n        }\r\n\r\n        private const string InheritGlobalReadPermissionOnHiddenPerspectivesPropertyName\r\n            = \"inheritGlobalReadPermissionOnHiddenPerspectives\";\r\n        [ConfigurationProperty(InheritGlobalReadPermissionOnHiddenPerspectivesPropertyName, DefaultValue = false)]\r\n        public bool InheritGlobalReadPermissionOnHiddenPerspectives\r\n        {\r\n            get { return (bool)base[InheritGlobalReadPermissionOnHiddenPerspectivesPropertyName]; }\r\n            set { base[InheritGlobalReadPermissionOnHiddenPerspectivesPropertyName] = value; }\r\n        }\r\n\r\n        private const string _omitAspNetWebFormsSupportPropertyName = \"omitAspNetWebFormsSupport\";\r\n        [ConfigurationProperty(_omitAspNetWebFormsSupportPropertyName, DefaultValue = false)]\r\n        public bool OmitAspNetWebFormsSupport\r\n        {\r\n            get { return (bool)base[_omitAspNetWebFormsSupportPropertyName]; }\r\n            set { base[_omitAspNetWebFormsSupportPropertyName] = value; }\r\n        }\r\n\r\n        private const string _protectResizedImagesWithHash = \"protectResizedImagesWithHash\";\r\n        [ConfigurationProperty(_protectResizedImagesWithHash, DefaultValue = false)]\r\n        public bool ProtectResizedImagesWithHash\r\n        {\r\n            get => (bool)base[_protectResizedImagesWithHash];\r\n            set => base[_protectResizedImagesWithHash] = value;\r\n        }\r\n    }\r\n\r\n\r\n    internal sealed class CachingConfigurationElement : ConfigurationElementCollection\r\n    {\r\n        private const string _enabledPropertyName = \"enabled\";\r\n        [ConfigurationProperty(_enabledPropertyName, DefaultValue = \"true\")]\r\n        public bool Enabled\r\n        {\r\n            get { return (bool)base[_enabledPropertyName]; }\r\n            set { base[_enabledPropertyName] = value; }\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new CacheSettingsElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            var cacheSettings = (CacheSettingsElement)element;\r\n            return cacheSettings.Name;\r\n        }\r\n    }\r\n\r\n    internal sealed class CacheSettingsElement: ConfigurationElement\r\n    {\r\n        private const string _namePropertyName = \"name\";\r\n        [ConfigurationProperty(_namePropertyName)]\r\n        public string Name\r\n        {\r\n            get { return (string)base[_namePropertyName]; }\r\n            set { base[_namePropertyName] = value; }\r\n        }\r\n\r\n        private const string _sizePropertyName = \"size\";\r\n        [ConfigurationProperty(_sizePropertyName, DefaultValue = \"1000\")]\r\n        public int Size\r\n        {\r\n            get { return (int)base[_sizePropertyName]; }\r\n            set { base[_sizePropertyName] = value; }\r\n        }\r\n\r\n        private const string _enabledPropertyName = \"enabled\";\r\n        [ConfigurationProperty(_enabledPropertyName, DefaultValue = \"true\")]\r\n        public bool Enabled\r\n        {\r\n            get { return (bool)base[_enabledPropertyName]; }\r\n            set { base[_enabledPropertyName] = value; }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1Configuration.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    internal class LocalC1Configuration : IC1Configuration\r\n    {\r\n        private Configuration _configuration;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationManagerClass:DoNotUseConfigurationManagerClass\", Justification = \"IO implementation\")]\r\n        public LocalC1Configuration(string path)\r\n        {\r\n            ExeConfigurationFileMap map = new ExeConfigurationFileMap();\r\n            map.ExeConfigFilename = path;\r\n            _configuration = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public string FilePath\r\n        {\r\n            get\r\n            {\r\n                return _configuration.FilePath;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public bool HasFile\r\n        {\r\n            get\r\n            {\r\n                return _configuration.HasFile;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public AppSettingsSection AppSettings\r\n        {\r\n            get\r\n            {\r\n                return _configuration.AppSettings;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public ConnectionStringsSection ConnectionStrings\r\n        {\r\n            get\r\n            {\r\n                return _configuration.ConnectionStrings;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public ConfigurationSectionCollection Sections\r\n        {\r\n            get\r\n            {\r\n                return _configuration.Sections;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public ConfigurationSectionGroup RootSectionGroup\r\n        {\r\n            get\r\n            {\r\n                return _configuration.RootSectionGroup;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public ConfigurationSectionGroupCollection SectionGroups\r\n        {\r\n            get\r\n            {\r\n                return _configuration.SectionGroups;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public ConfigurationSection GetSection(string sectionName)\r\n        {\r\n            return _configuration.GetSection(sectionName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public ConfigurationSectionGroup GetSectionGroup(string sectionGroupName)\r\n        {\r\n            return _configuration.GetSectionGroup(sectionGroupName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public void Save()\r\n        {\r\n            _configuration.Save();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public void Save(ConfigurationSaveMode saveMode)\r\n        {\r\n            _configuration.Save(saveMode);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public void Save(ConfigurationSaveMode saveMode, bool forceSaveAll)\r\n        {\r\n            _configuration.Save(saveMode, forceSaveAll);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public void SaveAs(string filename)\r\n        {\r\n            _configuration.SaveAs(filename);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public void SaveAs(string filename, ConfigurationSaveMode saveMode)\r\n        {\r\n            _configuration.SaveAs(filename, saveMode);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseConfigurationClass:DoNotUseConfigurationClass\", Justification = \"IO implementation\")]\r\n        public void SaveAs(string filename, ConfigurationSaveMode saveMode, bool forceSaveAll)\r\n        {\r\n            _configuration.SaveAs(filename, saveMode, forceSaveAll);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1Directory.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    internal class LocalC1Directory : IC1Directory\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1DirectoryInfo CreateDirectory(string path)\r\n        {\r\n            return new C1DirectoryInfo(Directory.CreateDirectory(path).FullName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public void Delete(string path)\r\n        {\r\n            Directory.Delete(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public void Delete(string path, bool recursive)\r\n        {\r\n            Directory.Delete(path, recursive);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public void Move(string sourceDirName, string destDirName)\r\n        {\r\n            Directory.Move(sourceDirName, destDirName);\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public bool Exists(string path)\r\n        {\r\n            return Directory.Exists(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public string GetCurrentDirectory()\r\n        {\r\n            return Directory.GetCurrentDirectory();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public void SetCurrentDirectory(string path)\r\n        {\r\n            Directory.SetCurrentDirectory(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1DirectoryInfo GetParent(string path)\r\n        {\r\n            return new C1DirectoryInfo(Directory.GetParent(path).FullName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public string GetDirectoryRoot(string path)\r\n        {\r\n            return Directory.GetDirectoryRoot(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public string[] GetDirectories(string path)\r\n        {\r\n            return Directory.GetDirectories(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public string[] GetDirectories(string path, string searchPattern)\r\n        {\r\n            return Directory.GetDirectories(path, searchPattern);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public string[] GetDirectories(string path, string searchPattern, SearchOption searchOption)\r\n        {\r\n            return Directory.GetDirectories(path, searchPattern, searchOption);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public string[] GetFiles(string path)\r\n        {\r\n            return Directory.GetFiles(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public string[] GetFiles(string path, string searchPattern)\r\n        {\r\n            return Directory.GetFiles(path, searchPattern);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public string[] GetFiles(string path, string searchPattern, SearchOption searchOption)\r\n        {\r\n            return Directory.Exists(path) ? Directory.GetFiles(path, searchPattern, searchOption) : new string[] { };\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public DateTime GetCreationTime(string path)\r\n        {\r\n            return Directory.GetCreationTime(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public DateTime GetCreationTimeUtc(string path)\r\n        {\r\n            return Directory.GetCreationTimeUtc(path);\r\n        }\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public void SetCreationTime(string path, DateTime creationTime)\r\n        {\r\n            Directory.SetCreationTime(path, creationTime);\r\n        }\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        public void SetCreationTimeUtc(string path, DateTime creationTimeUtc)\r\n        {\r\n            Directory.SetCreationTimeUtc(path, creationTimeUtc);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1DirectoryInfo.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.Serialization;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    internal class LocalC1DirectoryInfo : IC1DirectoryInfo\r\n    {\r\n        private DirectoryInfo _directoryInfo;\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        public LocalC1DirectoryInfo(string path)\r\n        {\r\n            _directoryInfo = new DirectoryInfo(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public string FullName\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.FullName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public string Extension\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Extension;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public bool Exists\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Exists;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1DirectoryInfo Root\r\n        {\r\n            get\r\n            {\r\n                return new C1DirectoryInfo(_directoryInfo.Root.FullName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1DirectoryInfo Parent\r\n        {\r\n            get\r\n            {\r\n                return new C1DirectoryInfo(_directoryInfo.Parent.FullName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public FileAttributes Attributes\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.Attributes;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.Attributes = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1DirectoryInfo[] GetDirectories()\r\n        {\r\n            return _directoryInfo.GetDirectories().Select(f => new C1DirectoryInfo(f.FullName)).ToArray();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1DirectoryInfo[] GetDirectories(string searchPattern)\r\n        {\r\n            return _directoryInfo.GetDirectories(searchPattern).Select(f => new C1DirectoryInfo(f.FullName)).ToArray();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1DirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchOption)\r\n        {\r\n            return _directoryInfo.GetDirectories(searchPattern, searchOption).Select(f => new C1DirectoryInfo(f.FullName)).ToArray();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileInfo[] GetFiles()\r\n        {\r\n            return _directoryInfo.GetFiles().Select(f => new C1FileInfo(f.FullName)).ToArray();\r\n        }\r\n\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileInfo[] GetFiles(string searchPattern)\r\n        {\r\n            return _directoryInfo.GetFiles(searchPattern).Select(f => new C1FileInfo(f.FullName)).ToArray();\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileInfo[] GetFiles(string searchPattern, SearchOption searchOption)\r\n        {\r\n            return _directoryInfo.GetFiles(searchPattern, searchOption).Select(f => new C1FileInfo(f.FullName)).ToArray();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        public void Create()\r\n        {\r\n            _directoryInfo.Create();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1DirectoryInfo CreateSubdirectory(string path)\r\n        {\r\n            return new C1DirectoryInfo(_directoryInfo.CreateSubdirectory(path).FullName);\r\n        }\r\n\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        public void MoveTo(string destDirName)\r\n        {\r\n            _directoryInfo.MoveTo(destDirName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public void Delete()\r\n        {\r\n            _directoryInfo.Delete();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseDirectoryInfoClass:DotNotUseDirectoryInfoClass\")]\r\n        public void Delete(bool recursive)\r\n        {\r\n            _directoryInfo.Delete(recursive);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime CreationTime\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.CreationTime;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.CreationTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime CreationTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _directoryInfo.CreationTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.CreationTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime LastAccessTime \r\n            {\r\n            get\r\n            {\r\n                return _directoryInfo.LastAccessTime;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.LastAccessTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime LastAccessTimeUtc \r\n            {\r\n            get\r\n            {\r\n                return _directoryInfo.LastAccessTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.LastAccessTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime LastWriteTime \r\n            {\r\n            get\r\n            {\r\n                return _directoryInfo.LastWriteTime;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.LastWriteTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime LastWriteTimeUtc \r\n            {\r\n            get\r\n            {\r\n                return _directoryInfo.LastWriteTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _directoryInfo.LastWriteTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public void GetObjectData(SerializationInfo info, StreamingContext context)\r\n        {\r\n            _directoryInfo.GetObjectData(info, context);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public void Refresh()\r\n        {\r\n            _directoryInfo.Refresh();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1File.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    internal class LocalC1File : IC1File\r\n    {\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public bool Exists(string path)\r\n        {\r\n            return File.Exists(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void Touch(string path)\r\n        {\r\n            File.SetLastWriteTime(path, DateTime.Now);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void Copy(string sourceFileName, string destFileName)\r\n        {\r\n            File.Copy(sourceFileName, destFileName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void Copy(string sourceFileName, string destFileName, bool overwrite)\r\n        {\r\n            File.Copy(sourceFileName, destFileName, overwrite);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void Move(string sourceFileName, string destFileName)\r\n        {\r\n            File.Move(sourceFileName, destFileName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName)\r\n        {\r\n            File.Replace(sourceFileName, destinationFileName, destinationBackupFileName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)\r\n        {\r\n            File.Replace(sourceFileName, destinationFileName, destinationBackupFileName, ignoreMetadataErrors);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void Delete(string path)\r\n        {\r\n            File.Delete(path);\r\n        }\r\n\r\n\r\n\r\n        public C1FileStream Create(string path)\r\n        {\r\n            return new C1FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);\r\n        }\r\n\r\n\r\n\r\n        public C1FileStream Create(string path, int bufferSize)\r\n        {\r\n            return new C1FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.Read, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public C1FileStream Create(string path, int bufferSize, FileOptions options)\r\n        {\r\n            return new C1FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.Read, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        public C1StreamWriter CreateText(string path)\r\n        {\r\n            return new C1StreamWriter(path, false);\r\n        }\r\n\r\n\r\n\r\n        public C1StreamWriter AppendText(string path)\r\n        {\r\n            return new C1StreamWriter(path, true);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void AppendAllText(string path, string contents)\r\n        {\r\n            File.AppendAllText(path, contents);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void AppendAllText(string path, string contents, Encoding encoding)\r\n        {\r\n            File.AppendAllText(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void AppendAllLines(string path, IEnumerable<string> contents)\r\n        {\r\n            File.AppendAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding)\r\n        {\r\n            File.AppendAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        public C1FileStream Open(string path, FileMode mode)\r\n        {\r\n            return new C1FileStream(path, mode);\r\n        }\r\n\r\n\r\n\r\n        public C1FileStream Open(string path, FileMode mode, FileAccess access)\r\n        {\r\n            return new C1FileStream(path, mode, access);\r\n        }\r\n\r\n\r\n\r\n        public C1FileStream Open(string path, FileMode mode, FileAccess access, FileShare share)\r\n        {\r\n            return new C1FileStream(path, mode, access, share);\r\n        }\r\n\r\n\r\n\r\n        public C1FileStream OpenRead(string path)\r\n        {\r\n            return new C1FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);\r\n        }\r\n\r\n\r\n\r\n        public C1StreamReader OpenText(string path)\r\n        {\r\n            return new C1StreamReader(path);\r\n        }\r\n\r\n\r\n\r\n        public C1FileStream OpenWrite(string path)\r\n        {\r\n            return new C1FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public byte[] ReadAllBytes(string path)\r\n        {\r\n            return File.ReadAllBytes(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public string[] ReadAllLines(string path)\r\n        {\r\n            return File.ReadAllLines(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public string[] ReadAllLines(string path, Encoding encoding)\r\n        {\r\n            return File.ReadAllLines(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public string ReadAllText(string path)\r\n        {\r\n            return File.ReadAllText(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public string ReadAllText(string path, Encoding encoding)\r\n        {\r\n            return File.ReadAllText(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public IEnumerable<string> ReadLines(string path)\r\n        {\r\n            return File.ReadLines(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public IEnumerable<string> ReadLines(string path, Encoding encoding)\r\n        {\r\n            return File.ReadLines(path, encoding);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void WriteAllBytes(string path, byte[] bytes)\r\n        {\r\n            File.WriteAllBytes(path, bytes);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void WriteAllLines(string path, IEnumerable<string> contents)\r\n        {\r\n            File.WriteAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding)\r\n        {\r\n            File.WriteAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void WriteAllLines(string path, string[] contents)\r\n        {\r\n            File.WriteAllLines(path, contents);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void WriteAllLines(string path, string[] contents, Encoding encoding)\r\n        {\r\n            File.WriteAllLines(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void WriteAllText(string path, string contents)\r\n        {\r\n            File.WriteAllText(path, contents);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void WriteAllText(string path, string contents, Encoding encoding)\r\n        {\r\n            File.WriteAllText(path, contents, encoding);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public FileAttributes GetAttributes(string path)\r\n        {\r\n            return File.GetAttributes(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void SetAttributes(string path, FileAttributes fileAttributes)\r\n        {\r\n            File.SetAttributes(path, fileAttributes);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public DateTime GetCreationTime(string path)\r\n        {\r\n            return File.GetCreationTime(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public DateTime GetCreationTimeUtc(string path)\r\n        {\r\n            return File.GetCreationTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void SetCreationTime(string path, DateTime creationTime)\r\n        {\r\n            File.SetCreationTime(path, creationTime);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void SetCreationTimeUtc(string path, DateTime creationTimeUtc)\r\n        {\r\n            File.SetCreationTimeUtc(path, creationTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public DateTime GetLastAccessTime(string path)\r\n        {\r\n            return File.GetLastAccessTime(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public DateTime GetLastAccessTimeUtc(string path)\r\n        {\r\n            return File.GetLastAccessTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void SetLastAccessTime(string path, DateTime lastAccessTime)\r\n        {\r\n            File.SetLastAccessTime(path, lastAccessTime);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)\r\n        {\r\n            File.SetLastAccessTimeUtc(path, lastAccessTimeUtc);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public DateTime GetLastWriteTime(string path)\r\n        {\r\n            return File.GetLastWriteTime(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public DateTime GetLastWriteTimeUtc(string path)\r\n        {\r\n            return File.GetLastWriteTimeUtc(path);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void SetLastWriteTime(string path, DateTime lastWriteTime)\r\n        {\r\n            File.SetLastWriteTime(path, lastWriteTime);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        public void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)\r\n        {\r\n            File.SetLastWriteTimeUtc(path, lastWriteTimeUtc);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1FileInfo.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Runtime.Serialization;\r\nusing System.Text;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    internal class LocalC1FileInfo : IC1FileInfo\r\n    {\r\n        private FileInfo _fileInfo;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        public LocalC1FileInfo(string fileName)\r\n        {\r\n            _fileInfo = new FileInfo(fileName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        public string DirectoryName\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.DirectoryName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        public C1DirectoryInfo Directory\r\n        {\r\n            get\r\n            {\r\n                return new C1DirectoryInfo(_fileInfo.DirectoryName);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public string Name\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Name;\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public string FullName\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.FullName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public bool Exists\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Exists;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public string Extension\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Extension;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        public bool IsReadOnly\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.IsReadOnly;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.IsReadOnly = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        public long Length\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Length;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public FileAttributes Attributes\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.Attributes;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.Attributes = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileStream Create()\r\n        {\r\n            return new C1FileStream(_fileInfo.FullName, FileMode.Create, FileAccess.ReadWrite, FileShare.Read, 0x1000, FileOptions.None);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1StreamWriter CreateText()\r\n        {\r\n            return new C1StreamWriter(_fileInfo.FullName, false);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1StreamWriter AppendText()\r\n        {\r\n            return new C1StreamWriter(_fileInfo.FullName, true);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileStream Open(FileMode mode)\r\n        {\r\n            return Open(mode, FileAccess.ReadWrite, FileShare.Read);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileStream Open(FileMode mode, FileAccess access)\r\n        {\r\n            return Open(mode, access, FileShare.Read);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileStream Open(FileMode mode, FileAccess access, FileShare share)\r\n        {\r\n            return new C1FileStream(_fileInfo.FullName, mode, access, share);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileStream OpenRead()\r\n        {\r\n            return new C1FileStream(_fileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1StreamReader OpenText()\r\n        {\r\n            return new C1StreamReader(_fileInfo.FullName, Encoding.UTF8, true, 0x400);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileStream OpenWrite()\r\n        {\r\n            return new C1FileStream(_fileInfo.FullName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileInfo CopyTo(string destFileName)\r\n        {\r\n            return new C1FileInfo(_fileInfo.CopyTo(destFileName).FullName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileInfo CopyTo(string destFileName, bool overwrite)\r\n        {\r\n            return new C1FileInfo(_fileInfo.CopyTo(destFileName, overwrite).FullName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public void MoveTo(string destFileName)\r\n        {\r\n            _fileInfo.MoveTo(destFileName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileInfo Replace(string destinationFileName, string destinationBackupFileName)\r\n        {\r\n            return new C1FileInfo(_fileInfo.Replace(destinationFileName, destinationBackupFileName).FullName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileInfoClass:DotNotUseFileInfoClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public C1FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)\r\n        {\r\n            return new C1FileInfo(_fileInfo.Replace(destinationFileName, destinationBackupFileName, ignoreMetadataErrors).FullName);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public void Delete()\r\n        {\r\n            _fileInfo.Delete();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public void Refresh()\r\n        {\r\n            _fileInfo.Refresh();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public void GetObjectData(SerializationInfo info, StreamingContext context)\r\n        {\r\n            _fileInfo.GetObjectData(info, context);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime CreationTime\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.CreationTime;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.CreationTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime CreationTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.CreationTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.CreationTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime LastAccessTime\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.LastAccessTime;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.LastAccessTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime LastAccessTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.LastAccessTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.LastAccessTimeUtc = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime LastWriteTime\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.LastWriteTime;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.LastWriteTime = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseFileSystemInfoClass:DotNotUseFileSystemInfoClass\")]\r\n        public DateTime LastWriteTimeUtc\r\n        {\r\n            get\r\n            {\r\n                return _fileInfo.LastWriteTimeUtc;\r\n            }\r\n            set\r\n            {\r\n                _fileInfo.LastWriteTimeUtc = value;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1FileStream.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    internal class LocalC1FileStream : IC1FileStream\r\n    {\r\n        private FileStream _fileStream;\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public LocalC1FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)\r\n        {\r\n            _fileStream = new System.IO.FileStream(path, mode, access, share, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public string Name => _fileStream.Name;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public long Length => _fileStream.Length;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public void SetLength(long value)\r\n        {\r\n            _fileStream.SetLength(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public long Position\r\n        {\r\n            get => _fileStream.Position;\r\n            set => _fileStream.Position = value;\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public int Read(byte[] array, int offset, int count)\r\n        {\r\n            return _fileStream.Read(array, offset, count);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public int ReadByte()\r\n        {\r\n            return _fileStream.ReadByte();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public void Write(byte[] array, int offset, int count)\r\n        {\r\n            _fileStream.Write(array, offset, count);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public void WriteByte(byte value)\r\n        {\r\n            _fileStream.WriteByte(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public long Seek(long offset, SeekOrigin origin)\r\n        {\r\n            return _fileStream.Seek(offset, origin);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public bool CanRead => _fileStream.CanRead;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public bool CanSeek => _fileStream.CanSeek;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public bool CanWrite => _fileStream.CanWrite;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public void Flush()\r\n        {\r\n            _fileStream.Flush();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public void Flush(bool flushToDisk)\r\n        {\r\n            _fileStream.Flush(flushToDisk);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public void Close()\r\n        {\r\n            _fileStream.Close();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\")]\r\n        public void Dispose()\r\n        {\r\n            _fileStream?.Dispose();\r\n            _fileStream = null;\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~LocalC1FileStream()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1FileSystemWatcher.cs",
    "content": "﻿using System.IO;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\nusing System;\r\nusing System.Threading.Tasks;\r\nusing System.Threading;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    // TODO: has to implement IDisposable as it may contain unmanaged resources\r\n    internal class LocalC1FileSystemWatcher : IC1FileSystemWatcher\r\n    {\r\n        private const string LogTitle = \"LocalC1FileSystemWatcher\";\r\n        private readonly FileSystemWatcher _fileSystemWatcher;\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public LocalC1FileSystemWatcher(string path, string filter)\r\n        {\r\n            if (filter == null)\r\n            {\r\n                _fileSystemWatcher = new FileSystemWatcher(path)\r\n                {\r\n                    InternalBufferSize = 8192\r\n                };\r\n            }\r\n            else\r\n            {\r\n                _fileSystemWatcher = new FileSystemWatcher(path, filter);\r\n            }\r\n            _fileSystemWatcher.Error += _fileSystemWatcher_Error;\r\n        }\r\n\r\n\r\n\r\n        void _fileSystemWatcher_Error(object sender, ErrorEventArgs e)\r\n        {\r\n            Composite.Core.Log.LogWarning(LogTitle, e.GetException());\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public bool EnableRaisingEvents\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.EnableRaisingEvents;\r\n            }\r\n            set\r\n            {\r\n                // Systems with flaky disk IO this can block thread for a very long time\r\n                Task.Factory.StartNew(() => {\r\n                    Thread.Sleep(1000);\r\n                    DoEnableRaisingEvents(value);\r\n                });\r\n            }\r\n        }\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        private void DoEnableRaisingEvents(bool raiseEvents)\r\n        {\r\n            try\r\n            {\r\n                _fileSystemWatcher.EnableRaisingEvents = raiseEvents;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Composite.Core.Log.LogWarning(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public string Path\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.Path;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.Path = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public string Filter\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.Filter;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.Filter = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public bool IncludeSubdirectories\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.IncludeSubdirectories;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.IncludeSubdirectories = value;\r\n            }\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public int InternalBufferSize\r\n        {\r\n            get { return _fileSystemWatcher.InternalBufferSize; }\r\n            set { _fileSystemWatcher.InternalBufferSize = value; }\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public event FileSystemEventHandler Created\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Created += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Created -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public event FileSystemEventHandler Changed\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Changed += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Changed -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public event RenamedEventHandler Renamed\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Renamed += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Renamed -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public event FileSystemEventHandler Deleted\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Deleted += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Deleted -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public event ErrorEventHandler Error\r\n        {\r\n            add\r\n            {\r\n                _fileSystemWatcher.Error += value;\r\n            }\r\n            remove\r\n            {\r\n                _fileSystemWatcher.Error -= value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public NotifyFilters NotifyFilter\r\n        {\r\n            get\r\n            {\r\n                return _fileSystemWatcher.NotifyFilter;\r\n            }\r\n            set\r\n            {\r\n                _fileSystemWatcher.NotifyFilter = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public void BeginInit()\r\n        {\r\n            _fileSystemWatcher.BeginInit();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        public void EndInit()\r\n        {\r\n            _fileSystemWatcher.EndInit();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseWaitForChangedResultClass:DoNotUseWaitForChangedResultClass\")]\r\n        public C1WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType)\r\n        {\r\n            WaitForChangedResult result = _fileSystemWatcher.WaitForChanged(changeType);\r\n\r\n            return new C1WaitForChangedResult\r\n            {\r\n                Name = result.Name,\r\n                OldName = result.OldName,\r\n                ChangeType = result.ChangeType,\r\n                TimedOut = result.TimedOut\r\n            };\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileSystemWatcherClass:DoNotUseFileSystemWatcherClass\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseWaitForChangedResultClass:DoNotUseWaitForChangedResultClass\")]\r\n        public C1WaitForChangedResult WaitForChanged(WatcherChangeTypes changeType, int timeout)\r\n        {\r\n            WaitForChangedResult result = _fileSystemWatcher.WaitForChanged(changeType, timeout);\r\n\r\n            return new C1WaitForChangedResult\r\n            {\r\n                Name = result.Name,\r\n                OldName = result.OldName,\r\n                ChangeType = result.ChangeType,\r\n\r\n                TimedOut = result.TimedOut\r\n            };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1StreamReader.cs",
    "content": "﻿using System.IO;\r\nusing System.Text;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    internal class LocalC1StreamReader : IC1StreamReader\r\n    {\r\n        private StreamReader _streamReader;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public LocalC1StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            _streamReader = new StreamReader(path, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public LocalC1StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            _streamReader = new StreamReader(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public int Read()\r\n        {\r\n            return _streamReader.Read();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public int Read(char[] buffer, int index, int count)\r\n        {\r\n            return _streamReader.Read(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public string ReadLine()\r\n        {\r\n            return _streamReader.ReadLine();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public string ReadToEnd()\r\n        {\r\n            return _streamReader.ReadToEnd();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public int ReadBlock(char[] buffer, int index, int count)\r\n        {\r\n            return _streamReader.ReadBlock(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public int Peek()\r\n        {\r\n            return _streamReader.Peek();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public bool EndOfStream\r\n        {\r\n            get\r\n            {\r\n                return _streamReader.EndOfStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public void Close()\r\n        {\r\n            _streamReader.Close();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public Stream BaseStream\r\n        {\r\n            get\r\n            {\r\n                return _streamReader.BaseStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public Encoding CurrentEncoding\r\n        {\r\n            get\r\n            {\r\n                return _streamReader.CurrentEncoding;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\")]\r\n        public void Dispose()\r\n        {\r\n            _streamReader.Dispose();\r\n#if LeakCheck\r\n            System.GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = System.Environment.StackTrace;\r\n        /// <exclude />\r\n        ~LocalC1StreamReader()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalC1StreamWriter.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    internal class LocalC1StreamWriter : IC1StreamWriter\r\n    {\r\n        private StreamWriter _streamWriter;\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public LocalC1StreamWriter(string path, bool append, Encoding encoding, int bufferSize)\r\n        {\r\n            _streamWriter = new StreamWriter(path, append, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public LocalC1StreamWriter(Stream stream, Encoding encoding, int bufferSize)\r\n        {\r\n            _streamWriter = new StreamWriter(stream, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(string value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(string format, object arg0)\r\n        {\r\n            _streamWriter.Write(format, arg0);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(string format, object arg0, object arg1)\r\n        {\r\n            _streamWriter.Write(format, arg0, arg1);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(string format, object arg0, object arg1, object arg2)\r\n        {\r\n            _streamWriter.Write(format, arg0, arg1, arg2);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(string format, params object[] arg)\r\n        {\r\n            _streamWriter.Write(format, arg);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(char value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(char[] buffer)\r\n        {\r\n            _streamWriter.Write(buffer);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(char[] buffer, int index, int count)\r\n        {\r\n            _streamWriter.Write(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(bool value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(int value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(uint value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(long value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(ulong value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(float value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(double value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(decimal value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Write(object value)\r\n        {\r\n            _streamWriter.Write(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine()\r\n        {\r\n            _streamWriter.WriteLine();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(string value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(string format, object arg0)\r\n        {\r\n            _streamWriter.WriteLine(format, arg0);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(string format, object arg0, object arg1)\r\n        {\r\n            _streamWriter.WriteLine(format, arg0, arg1);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(string format, object arg0, object arg1, object arg2)\r\n        {\r\n            _streamWriter.WriteLine(format, arg0, arg1, arg2);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(string format, params object[] arg)\r\n        {\r\n            _streamWriter.WriteLine(format, arg);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(char value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(char[] buffer)\r\n        {\r\n            _streamWriter.WriteLine(buffer);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(char[] buffer, int index, int count)\r\n        {\r\n            _streamWriter.WriteLine(buffer, index, count);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(bool value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(int value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(uint value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(long value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(ulong value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(float value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(double value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(decimal value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void WriteLine(object value)\r\n        {\r\n            _streamWriter.WriteLine(value);\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public string NewLine\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.NewLine;\r\n            }\r\n            set\r\n            {\r\n                _streamWriter.NewLine = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public IFormatProvider FormatProvider\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.FormatProvider;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public bool AutoFlush\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.AutoFlush;\r\n            }\r\n            set\r\n            {\r\n                _streamWriter.AutoFlush = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Flush()\r\n        {\r\n            _streamWriter.Flush();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Close()\r\n        {\r\n            _streamWriter.Close();\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public Stream BaseStream\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.BaseStream;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public Encoding Encoding\r\n        {\r\n            get\r\n            {\r\n                return _streamWriter.Encoding;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamWriterClass:DotNotUseStreamWriterClass\")]\r\n        public void Dispose()\r\n        {\r\n            _streamWriter.Dispose();\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~LocalC1StreamWriter()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/IO/IOProviders/LocalIOProvider/LocalIOProvider.cs",
    "content": "﻿using System.IO;\r\nusing System.Text;\r\nusing Composite.Core.IO.Plugins.IOProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.IO.IOProviders.LocalIOProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableIOProvider))]\r\n    internal class LocalIOProvider : IIOProvider\r\n    {\r\n        public IC1Directory C1Directory\r\n        {\r\n            get \r\n            {\r\n                return new LocalC1Directory();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IC1File C1File\r\n        {\r\n            get \r\n            {\r\n                return new LocalC1File();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IC1FileInfo CreateFileInfo(string fileName)\r\n        {\r\n            return new LocalC1FileInfo(fileName);\r\n        }\r\n\r\n\r\n\r\n        public IC1DirectoryInfo CreateDirectoryInfo(string path)\r\n        {\r\n            return new LocalC1DirectoryInfo(path);\r\n        }\r\n\r\n\r\n\r\n        public IC1FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)\r\n        {\r\n            return new LocalC1FileStream(path, mode, access, share, bufferSize, options);\r\n        }\r\n\r\n\r\n\r\n        public IC1FileSystemWatcher CreateFileSystemWatcher(string path, string filter)\r\n        {\r\n            return new LocalC1FileSystemWatcher(path, filter);\r\n        }\r\n\r\n\r\n\r\n        public IC1StreamReader CreateStreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            return new LocalC1StreamReader(path, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public IC1StreamReader CreateStreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)\r\n        {\r\n            return new LocalC1StreamReader(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public IC1StreamWriter CreateStreamWriter(string path, bool append, Encoding encoding, int bufferSize)\r\n        {\r\n            return new LocalC1StreamWriter(path, append, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public IC1StreamWriter CreateStreamWriter(Stream stream, Encoding encoding, int bufferSize)\r\n        {\r\n            return new LocalC1StreamWriter(stream, encoding, bufferSize);\r\n        }\r\n\r\n\r\n\r\n        public IC1Configuration CreateConfiguration(string path)\r\n        {\r\n            return new LocalC1Configuration(path);\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Instrumentation/PerformanceCounterProviders/NoPerformanceCounterProvider/NoPerformanceCounterProvider.cs",
    "content": "﻿using Composite.Core.Instrumentation;\r\nusing Composite.Core.Instrumentation.Plugin;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Instrumentation.PerformanceCounterProviders.NoPerformanceCounterProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurablePerformanceCounterProvider))]\r\n    internal sealed class NoPerformanceCounterProvider : IPerformanceCounterProvider\r\n    {\r\n        NoPerformanceCounterProviderPerformanceToken _noPerformanceCounterProviderPerformanceToken = new NoPerformanceCounterProviderPerformanceToken();\r\n\r\n        public void SystemStartupIncrement()\r\n        {\r\n        }\r\n\r\n        public IPerformanceCounterToken BeginElementCreation()\r\n        {\r\n            return _noPerformanceCounterProviderPerformanceToken;\r\n        }\r\n\r\n        public void EndElementCreation(IPerformanceCounterToken performanceToken, int resultElementCount, int totalElementCount)\r\n        {\r\n        }\r\n\r\n        public IPerformanceCounterToken BeginAspNetControlCompile()\r\n        {\r\n            return _noPerformanceCounterProviderPerformanceToken;\r\n        }\r\n\r\n        public void EndAspNetControlCompile(IPerformanceCounterToken performanceToken, int controlsCompiledCount)\r\n        {\r\n        }\r\n\r\n        public IPerformanceCounterToken BeginPageHookCreation()\r\n        {\r\n            return _noPerformanceCounterProviderPerformanceToken;\r\n        }\r\n\r\n        public void EndPageHookCreation(IPerformanceCounterToken performanceToken, int pageCount)\r\n        {\r\n        }\r\n\r\n        public void EntityTokenParentCacheHitIncrement()\r\n        {            \r\n        }\r\n\r\n        public void EntityTokenParentCacheMissIncrement()\r\n        {            \r\n        }\r\n\r\n        private sealed class NoPerformanceCounterProviderPerformanceToken : IPerformanceCounterToken\r\n        {\r\n            public void Dispose()\r\n            {\r\n            }\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Instrumentation/PerformanceCounterProviders/WindowsPerformanceCounterProvider/PerformanceCounterInstaller.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.ComponentModel;\r\nusing System.Diagnostics;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Manageability;\r\n\r\n\r\nnamespace Composite.Plugins.Instrumentation.PerformanceCounterProviders.WindowsPerformanceCounterProvider\r\n{\r\n    /// <summary>\r\n    /// Use Installutil.exe to install performance counters\r\n    /// </summary>\r\n    [RunInstallerAttribute(true)]\r\n    internal sealed class PerformanceCounterInstaller : Installer\r\n\t{\r\n        public override void Install(IDictionary stateSaver)\r\n        {\r\n            base.Install(stateSaver);\r\n\r\n            if (PerformanceCounterCategory.Exists(PerformanceNames.CategoryName)) throw new InvalidOperationException(\"Already installed\");\r\n\r\n            CounterCreationDataCollection collection = new CounterCreationDataCollection();\r\n            collection.Add(new CounterCreationData(PerformanceNames.SystemStartupCountName, PerformanceNames.SystemStartupCountDescription, PerformanceCounterType.NumberOfItems32));\r\n            collection.Add(new CounterCreationData(PerformanceNames.ElementResultCreationAverageTimeName, PerformanceNames.ElementResultCreationAverageTimeDescription, PerformanceCounterType.AverageTimer32));\r\n            collection.Add(new CounterCreationData(PerformanceNames.ElementResultCreationAverageTimeBaseName, PerformanceNames.ElementResultCreationAverageTimeBaseDescription, PerformanceCounterType.AverageBase));\r\n            collection.Add(new CounterCreationData(PerformanceNames.ElementTotalCreationAverageTimeName, PerformanceNames.ElementTotalCreationAverageTimeDescription, PerformanceCounterType.AverageTimer32));\r\n            collection.Add(new CounterCreationData(PerformanceNames.ElementTotalCreationAverageTimeBaseName, PerformanceNames.ElementTotalCreationAverageTimeBaseDescription, PerformanceCounterType.AverageBase));\r\n            collection.Add(new CounterCreationData(PerformanceNames.AspNetControlCompileAverageTimeName, PerformanceNames.AspNetControlCompileAverageTimeDescription, PerformanceCounterType.AverageTimer32));\r\n            collection.Add(new CounterCreationData(PerformanceNames.AspNetControlCompileAverageTimeBaseName, PerformanceNames.AspNetControlCompileAverageTimeBaseDescription, PerformanceCounterType.AverageBase));\r\n            collection.Add(new CounterCreationData(PerformanceNames.PageHookCreationAverageTimeName, PerformanceNames.PageHookCreationAverageTimeDescription, PerformanceCounterType.AverageCount64));\r\n            collection.Add(new CounterCreationData(PerformanceNames.PageHookCreationAverageTimeBaseName, PerformanceNames.PageHookCreationAverageTimeBaseDescription, PerformanceCounterType.AverageBase));\r\n            collection.Add(new CounterCreationData(PerformanceNames.EntityTokenParentCacheHitCountName, PerformanceNames.EntityTokenParentCacheHitCountDescription, PerformanceCounterType.NumberOfItems32));\r\n            collection.Add(new CounterCreationData(PerformanceNames.EntityTokenParentCacheMissCountName, PerformanceNames.EntityTokenParentCacheMissCountDescription, PerformanceCounterType.NumberOfItems32));\r\n\r\n            PerformanceCounterCategory.Create(PerformanceNames.CategoryName, PerformanceNames.CategoryDescription, PerformanceCounterCategoryType.MultiInstance, collection);\r\n        }\r\n\r\n\r\n\r\n        public override void Uninstall(IDictionary savedState)\r\n        {\r\n            base.Uninstall(savedState);\r\n\r\n            if (PerformanceCounterCategory.Exists(PerformanceNames.CategoryName))\r\n            {\r\n                PerformanceCounterCategory.Delete(PerformanceNames.CategoryName);\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Instrumentation/PerformanceCounterProviders/WindowsPerformanceCounterProvider/PerformanceNames.cs",
    "content": "﻿\r\n\r\nnamespace Composite.Plugins.Instrumentation.PerformanceCounterProviders.WindowsPerformanceCounterProvider\r\n{\r\n\tinternal static class PerformanceNames\r\n\t{\r\n        public static string CategoryName { get { return \"C1 CMS\"; } }\r\n        public static string CategoryDescription { get { return \"C1 CMS\"; } }\r\n\r\n        public static string SystemStartupCountName { get { return \"SystemStartupCount\"; } }\r\n        public static string SystemStartupCountDescription { get { return \"SystemStartupCount\"; } }\r\n        public static string ElementResultCreationAverageTimeName { get { return \"ElementResultCreationAverageTime\"; } }\r\n        public static string ElementResultCreationAverageTimeDescription { get { return \"ElementResultCreationAverageTime\"; } }\r\n        public static string ElementResultCreationAverageTimeBaseName { get { return \"ElementResultCreationAverageTimeBase\"; } }\r\n        public static string ElementResultCreationAverageTimeBaseDescription { get { return \"ElementResultCreationAverageTimeBase\"; } }\r\n        public static string ElementTotalCreationAverageTimeName { get { return \"ElementTotalCreationAverageTime\"; } }\r\n        public static string ElementTotalCreationAverageTimeDescription { get { return \"ElementTotalCreationAverageTime\"; } }\r\n        public static string ElementTotalCreationAverageTimeBaseName { get { return \"ElementTotalCreationAverageTimeBase\"; } }\r\n        public static string ElementTotalCreationAverageTimeBaseDescription { get { return \"ElementTotalCreationAverageTimeBase\"; } }\r\n        public static string AspNetControlCompileAverageTimeName { get { return \"AspNetControlCompileAverageTime\"; } }\r\n        public static string AspNetControlCompileAverageTimeDescription { get { return \"AspNetControlCompileAverageTime\"; } }\r\n        public static string AspNetControlCompileAverageTimeBaseName { get { return \"AspNetControlCompileAverageAverageTimeBase\"; } }\r\n        public static string AspNetControlCompileAverageTimeBaseDescription { get { return \"AspNetControlCompileAverageAverageTimeBase\"; } }\r\n        public static string PageHookCreationAverageTimeName { get { return \"PageHookCreationAverageTime\"; } }\r\n        public static string PageHookCreationAverageTimeDescription { get { return \"PageHookCreationAverageTime\"; } }\r\n        public static string PageHookCreationAverageTimeBaseName { get { return \"PageHookCreationAverageAverageTimeBase\"; } }\r\n        public static string PageHookCreationAverageTimeBaseDescription { get { return \"PageHookCreationAverageAverageTimeBase\"; } }\r\n        public static string EntityTokenParentCacheHitCountName { get { return \"EntityTokenParentCacheHitCount\"; } }\r\n        public static string EntityTokenParentCacheHitCountDescription { get { return \"EntityTokenParentCacheHitCount\"; } }\r\n        public static string EntityTokenParentCacheMissCountName { get { return \"EntityTokenParentCacheMissCount\"; } }\r\n        public static string EntityTokenParentCacheMissCountDescription { get { return \"EntityTokenParentCacheMissCount\"; } }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Instrumentation/PerformanceCounterProviders/WindowsPerformanceCounterProvider/WindowsPerformanceCounterProvider.cs",
    "content": "﻿using System;\r\nusing System.Diagnostics;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.Instrumentation.Plugin;\r\nusing Composite.Core.Logging;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Instrumentation.PerformanceCounterProviders.WindowsPerformanceCounterProvider\r\n{\r\n\r\n    [ConfigurationElementType(typeof(NonConfigurablePerformanceCounterProvider))]\r\n    internal sealed class WindowsPerformanceCounterProvider : IPerformanceCounterProvider\r\n    {\r\n        private PerformanceCounter _systemStartupCount = null;\r\n        private PerformanceCounter _elementResultCreationAverageTime = null;\r\n        private PerformanceCounter _elementResultCreationAverageTimeBase = null;\r\n        private PerformanceCounter _elementTotalCreationAverageTime = null;\r\n        private PerformanceCounter _elementTotalCreationAverageTimeBase = null;\r\n        private PerformanceCounter _aspNetControlCompileAverageTime = null;\r\n        private PerformanceCounter _aspNetControlCompileAverageTimeBase = null;\r\n        private PerformanceCounter _pageHookCreationAverageTime = null;\r\n        private PerformanceCounter _pageHookCreationAverageTimeBase = null;\r\n        private PerformanceCounter _entityTokenParentCacheHitCount = null;\r\n        private PerformanceCounter _entityTokenParentCacheMissCount = null;\r\n\r\n\r\n\r\n        public WindowsPerformanceCounterProvider()\r\n        {\r\n            _systemStartupCount = TryCreateCounter(PerformanceNames.SystemStartupCountName);\r\n            _elementResultCreationAverageTime = TryCreateCounter(PerformanceNames.ElementResultCreationAverageTimeName);\r\n            _elementResultCreationAverageTimeBase = TryCreateCounter(PerformanceNames.ElementResultCreationAverageTimeBaseName);\r\n            _elementTotalCreationAverageTime = TryCreateCounter(PerformanceNames.ElementTotalCreationAverageTimeName);\r\n            _elementTotalCreationAverageTimeBase = TryCreateCounter(PerformanceNames.ElementTotalCreationAverageTimeBaseName);\r\n            _aspNetControlCompileAverageTime = TryCreateCounter(PerformanceNames.AspNetControlCompileAverageTimeName);\r\n            _aspNetControlCompileAverageTimeBase = TryCreateCounter(PerformanceNames.AspNetControlCompileAverageTimeBaseName);\r\n            _pageHookCreationAverageTime = TryCreateCounter(PerformanceNames.PageHookCreationAverageTimeName);\r\n            _pageHookCreationAverageTimeBase = TryCreateCounter(PerformanceNames.PageHookCreationAverageTimeBaseName);\r\n            _entityTokenParentCacheHitCount = TryCreateCounter(PerformanceNames.EntityTokenParentCacheHitCountName);\r\n            _entityTokenParentCacheMissCount = TryCreateCounter(PerformanceNames.EntityTokenParentCacheMissCountName);\r\n        }\r\n\r\n\r\n\r\n        public void SystemStartupIncrement()\r\n        {\r\n            if (_systemStartupCount != null)\r\n            {\r\n                _systemStartupCount.Increment();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IPerformanceCounterToken BeginElementCreation()\r\n        {\r\n            WindowsPerformanceCounterProviderToken windowsPerformanceCounterProviderToken = new WindowsPerformanceCounterProviderToken();\r\n            windowsPerformanceCounterProviderToken.Start();\r\n            return windowsPerformanceCounterProviderToken;\r\n        }\r\n\r\n\r\n\r\n        public void EndElementCreation(IPerformanceCounterToken performanceToken, int resultElementCount, int totalElementCount)\r\n        {\r\n            WindowsPerformanceCounterProviderToken windowsPerformanceCounterProviderToken = (WindowsPerformanceCounterProviderToken)performanceToken;\r\n            windowsPerformanceCounterProviderToken.Stop();\r\n\r\n            if ((_elementResultCreationAverageTime != null) &&\r\n                (_elementResultCreationAverageTime != null) &&\r\n                (_elementResultCreationAverageTimeBase != null) &&\r\n                (_elementTotalCreationAverageTimeBase != null))\r\n            {\r\n                _elementResultCreationAverageTime.IncrementBy(windowsPerformanceCounterProviderToken.StopTicks - windowsPerformanceCounterProviderToken.StartTicks);\r\n                _elementTotalCreationAverageTime.IncrementBy(windowsPerformanceCounterProviderToken.StopTicks - windowsPerformanceCounterProviderToken.StartTicks);\r\n                _elementResultCreationAverageTimeBase.IncrementBy(resultElementCount);\r\n                _elementTotalCreationAverageTimeBase.IncrementBy(totalElementCount);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IPerformanceCounterToken BeginAspNetControlCompile()\r\n        {\r\n            WindowsPerformanceCounterProviderToken windowsPerformanceCounterProviderToken = new WindowsPerformanceCounterProviderToken();\r\n            windowsPerformanceCounterProviderToken.Start();\r\n            return windowsPerformanceCounterProviderToken;\r\n        }\r\n\r\n\r\n\r\n        public void EndAspNetControlCompile(IPerformanceCounterToken performanceToken, int controlsCompiledCount)\r\n        {\r\n            WindowsPerformanceCounterProviderToken windowsPerformanceCounterProviderToken = (WindowsPerformanceCounterProviderToken)performanceToken;\r\n            windowsPerformanceCounterProviderToken.Stop();\r\n\r\n            if ((_aspNetControlCompileAverageTime != null) &&\r\n                (_aspNetControlCompileAverageTimeBase != null))\r\n            {\r\n                _aspNetControlCompileAverageTime.IncrementBy(windowsPerformanceCounterProviderToken.StopTicks - windowsPerformanceCounterProviderToken.StartTicks);\r\n                _aspNetControlCompileAverageTimeBase.IncrementBy(controlsCompiledCount);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IPerformanceCounterToken BeginPageHookCreation()\r\n        {\r\n            WindowsPerformanceCounterProviderToken windowsPerformanceCounterProviderToken = new WindowsPerformanceCounterProviderToken();\r\n            windowsPerformanceCounterProviderToken.Start();\r\n            return windowsPerformanceCounterProviderToken;\r\n        }\r\n\r\n\r\n\r\n        public void EndPageHookCreation(IPerformanceCounterToken performanceToken, int pageCount)\r\n        {\r\n            WindowsPerformanceCounterProviderToken windowsPerformanceCounterProviderToken = (WindowsPerformanceCounterProviderToken)performanceToken;\r\n            windowsPerformanceCounterProviderToken.Stop();\r\n\r\n            if ((_pageHookCreationAverageTime != null) &&\r\n                (_pageHookCreationAverageTimeBase != null))\r\n            {\r\n                _pageHookCreationAverageTime.IncrementBy(windowsPerformanceCounterProviderToken.StopTicks - windowsPerformanceCounterProviderToken.StartTicks);\r\n                _pageHookCreationAverageTimeBase.IncrementBy(pageCount);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void EntityTokenParentCacheHitIncrement()\r\n        {\r\n            if (_entityTokenParentCacheHitCount != null)\r\n            {\r\n                _entityTokenParentCacheHitCount.Increment();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void EntityTokenParentCacheMissIncrement()\r\n        {\r\n            if (_entityTokenParentCacheMissCount != null)\r\n            {\r\n                _entityTokenParentCacheMissCount.Increment();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private PerformanceCounter TryCreateCounter(string counterName)\r\n        {\r\n            PerformanceCounter performanceCounter = null;\r\n            try\r\n            {\r\n                performanceCounter = new PerformanceCounter(PerformanceNames.CategoryName, counterName, GetInstanceName(), false);\r\n            }\r\n            catch(Exception ex)\r\n            {\r\n                LoggingService.LogWarning(\"WindowsPerformanceCounterProvider\", ex);\r\n            }\r\n\r\n            return performanceCounter;\r\n        }\r\n\r\n\r\n\r\n        private static string GetInstanceName()\r\n        {\r\n            return RuntimeInformation.UniqueInstanceName;\r\n        }\r\n\r\n\r\n\r\n        private sealed class WindowsPerformanceCounterProviderToken : IPerformanceCounterToken\r\n        {\r\n            internal delegate void OnComplete();\r\n\r\n            public long StartTicks { get; set; }\r\n            public long StopTicks { get; set; }\r\n\r\n            public void Start()\r\n            {\r\n                this.StartTicks = DateTime.Now.Ticks;\r\n            }\r\n\r\n\r\n            public void Stop()\r\n            {\r\n                this.StopTicks = DateTime.Now.Ticks; \r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n            }\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/FileLogTraceListener/CircullarList.cs",
    "content": "﻿using System;\nusing System.Linq;\n\nnamespace Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener\n{\n    class CircularList<T> where T: class\n    {\n        private readonly T[] _data;\n        private readonly int _size;\n\n        private int _position;\n\n        public CircularList(int size)\n        {\n            _data = new T[size];\n            _size = size;\n        }\n\n        public int Count => (_position > _size) ? _size : _position;\n\n        public void Add(T element)\n        {\n            _data[_position % _size] = element;\n            _position++;\n        }\n\n        public T First()\n        {\n            return _position == 0 ? null : _data[Offset(_position - 1)];\n        }\n\n        public T[] ToArray()\n        {\n            if (_position <= _size)\n            {\n                return _data.Take(_position).ToArray();\n            }\n\n            var insertPosition = Offset(_position);\n\n            var result = new T[_size];\n\n            Array.Copy(_data, insertPosition, result, 0, _size - insertPosition);\n            Array.Copy(_data, 0, result, _size - insertPosition, insertPosition);\n\n            return result;\n        }\n\n        private int Offset(int position) => position % _size;\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/FileLogTraceListener/CurrentFileReader.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    internal class CurrentFileReader : LogFileReader\r\n    {\r\n        private readonly FileLogger _fileLogger;\r\n\r\n        public CurrentFileReader(FileLogger fileLogger)\r\n        {\r\n            _fileLogger = fileLogger;\r\n\r\n            lock (_fileLogger.SyncRoot)\r\n            {\r\n                var fileConnection = _fileLogger.FileConnection;\r\n\r\n                if (fileConnection != null)\r\n                {\r\n                    Date = fileConnection.CreationDate;\r\n                }\r\n            }\r\n\r\n        }\r\n\r\n        public override bool Open()\r\n        {\r\n            // do nothing\r\n            return true;\r\n        }\r\n\r\n        public override void Close()\r\n        {\r\n            // do nothing\r\n        }\r\n\r\n        public override int EntriesCount\r\n        {\r\n            get\r\n            {\r\n                DateTime readUntil;\r\n                int count;\r\n                string filePath;\r\n\r\n                lock (_fileLogger.SyncRoot)\r\n                {\r\n                    var fileConn = _fileLogger.FileConnection;\r\n\r\n                    var firstEntry = fileConn.NewEntries.First();\r\n                    readUntil = firstEntry?.TimeStamp ?? DateTime.MaxValue;\r\n\r\n                    count = fileConn.NewEntries.Count;\r\n\r\n                    filePath = fileConn.FilePath;\r\n                }\r\n\r\n                using (var fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))\r\n                {\r\n                    foreach (var logEntry in LogReaderHelper.ParseLogLines(fs))\r\n                    {\r\n                        if (logEntry.TimeStamp >= readUntil) { break; }\r\n\r\n                        count++;\r\n                    }\r\n                }\r\n\r\n                return count;\r\n            }\r\n        }\r\n\r\n        public override IEnumerable<LogEntry> GetLogEntries(DateTime timeFrom, DateTime timeTo)\r\n        {\r\n            Verify.That(timeFrom <= timeTo, \"An incorrect time interval given.\");\r\n\r\n            string filePath;\r\n            LogEntry[] newEntries;\r\n\r\n            lock (_fileLogger.SyncRoot)\r\n            {\r\n                var fileConn = _fileLogger.FileConnection;\r\n                newEntries = fileConn.NewEntries.ToArray();\r\n\r\n                filePath = fileConn.FilePath;\r\n            }\r\n\r\n            DateTime readUntil = newEntries.FirstOrDefault()?.TimeStamp.AddMilliseconds(-1) ?? DateTime.Now;\r\n\r\n            if (timeFrom <= readUntil)\r\n            {\r\n                using (var fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))\r\n                {\r\n                    var parserEnumerable = LogReaderHelper.ParseLogLines(fs);\r\n                    foreach (var logEntry in parserEnumerable)\r\n                    {\r\n                        if(logEntry.TimeStamp < timeFrom) continue;\r\n                        if (logEntry.TimeStamp > timeTo \r\n                            || logEntry.TimeStamp > readUntil) break;\r\n\r\n                        yield return logEntry;\r\n                    }\r\n                }\r\n            }\r\n\r\n            foreach (var logEntry in newEntries)\r\n            {\r\n                if (logEntry.TimeStamp < timeFrom) continue;\r\n                if (logEntry.TimeStamp > timeTo) break;\r\n\r\n                yield return logEntry;\r\n            }\r\n        }\r\n\r\n        public override bool Delete()\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/FileLogTraceListener/FileLogTraceListener.cs",
    "content": "﻿using System;\r\nusing System.Text;\r\nusing System.Xml;\r\nusing Composite.Core.Logging;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;\r\n\r\n\r\nnamespace Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener\r\n{\r\n    [ConfigurationElementType(typeof(CustomTraceListenerData))]\r\n\tinternal class FileLogTraceListener: CustomTraceListener\r\n\t{\r\n        private static readonly TimeSpan TimeZoneAdjustment = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);\r\n\r\n        public FileLogTraceListener()\r\n        {\r\n            // That one should not be used\r\n        }\r\n\r\n        public FileLogTraceListener(string initializeData)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(initializeData, nameof(initializeData));\r\n\r\n            string[] parts = initializeData.Split(new[] {','});\r\n            Verify.ArgumentCondition(parts.Length == 2, \"initializeData\", \"Wrong configuration parameters\");\r\n\r\n            if(LoggerInstance == null)\r\n            {\r\n                string logFolderPath = parts[0];\r\n                bool flushAfterEveryLine;\r\n                if (!bool.TryParse(parts[1], out flushAfterEveryLine))\r\n                {\r\n                    throw new ArgumentException(initializeData, nameof(initializeData));\r\n                }\r\n\r\n                // Setting public property, so it can be used by a webservice\r\n                LoggerInstance = new FileLogger(logFolderPath, flushAfterEveryLine);\r\n            }\r\n        }\r\n\r\n        public override void TraceData(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data)\r\n        {\r\n            var logEntry = (Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry)data;\r\n\r\n            var fileLogEntry = new LogEntry\r\n            {\r\n                TimeStamp = logEntry.TimeStamp.Add(TimeZoneAdjustment),\r\n                ApplicationDomainId = AppDomain.CurrentDomain.Id,\r\n                ThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId,\r\n                Message = SanitizeForLog(logEntry.Message), \r\n                Severity = logEntry.Severity.ToString(),\r\n            };\r\n\r\n            string title = logEntry.Title;\r\n            title = title.Substring(title.IndexOf(')') + 2); // Removing ({AppDomainId} - {ThreadId}}) prefix.\r\n\r\n            // Extracting display options from title\r\n            if (title.StartsWith(\"RGB(\"))\r\n            {\r\n                fileLogEntry.DisplayOptions = title.Substring(0, title.IndexOf(')') + 1);\r\n                title = title.Substring(fileLogEntry.DisplayOptions.Length);\r\n            }\r\n            fileLogEntry.Title = SanitizeForLog(title);\r\n\r\n            LoggerInstance.WriteEntry(fileLogEntry);\r\n        }\r\n\r\n        public override void Write(string message)\r\n        {\r\n            // Do nothing here...\r\n        }\r\n\r\n        public override void WriteLine(string message)\r\n        {\r\n            // Do nothing here...\r\n        }\r\n\r\n        public static FileLogger LoggerInstance { get; private set; }\r\n \r\n        private static string SanitizeForLog(string input) \r\n        { \r\n            if (string.IsNullOrEmpty(input)) \r\n            { \r\n                return input; \r\n            } \r\n \r\n            var builder = new StringBuilder(input.Length); \r\n \r\n            foreach (char ch in input) \r\n            { \r\n                builder.Append(XmlConvert.IsXmlChar(ch) ? ch : ' ');\r\n            } \r\n \r\n            return builder.ToString(); \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/FileLogTraceListener/FileLogger.cs",
    "content": "//#define UseLockFiles\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener\r\n{\r\n    /// <summary>\r\n    /// File logger\r\n    /// </summary>\r\n    internal class FileLogger : IDisposable\r\n    {\r\n        private const int MaxLogFiles = 10;\r\n        private bool _initializationFailed;\r\n\r\n#if UseLockFiles\r\n        private static readonly TimeSpan LockFileUpdateFrequency = TimeSpan.FromSeconds(20);\r\n        private static readonly TimeSpan OldLockFilesPreservationTime = TimeSpan.FromSeconds(60);\r\n        private DateTime _lockFileUpdatedLast = DateTime.MinValue;\r\n#endif\r\n\r\n        private static readonly TimeSpan FileStreamFlushInterval = TimeSpan.FromSeconds(5);\r\n        private static readonly TimeSpan FileStreamCloseOnIdleInterval = TimeSpan.FromSeconds(10);\r\n\r\n        private readonly string _logDirectoryPath;\r\n        private readonly bool _flushImmediately;\r\n\r\n        public static event ThreadStart OnReset;\r\n        private static Task _flushOnIdleTask;\r\n\r\n\r\n        internal LogFileInfo FileConnection;\r\n        readonly object _syncRoot = new object();\r\n\r\n        public object SyncRoot => _syncRoot;\r\n\r\n        public FileLogger(string logDirectoryPath, bool flushImmediately)\r\n        {\r\n            Verify.ArgumentNotNull(logDirectoryPath, \"logDirectoryPath\");\r\n\r\n            _logDirectoryPath = Path.Combine(PathUtil.BaseDirectory, logDirectoryPath);\r\n            if (!C1Directory.Exists(_logDirectoryPath))\r\n            {\r\n                C1Directory.CreateDirectory(_logDirectoryPath);\r\n            }\r\n            _flushImmediately = flushImmediately;\r\n\r\n            _flushOnIdleTask = Task.Factory.StartNew(FlushOnIdle);\r\n\r\n#if UseLockFiles\r\n            TouchLockFile();\r\n#endif\r\n        }\r\n\r\n        private void FlushOnIdle()\r\n        {\r\n            Predicate<LogFileInfo> fileShouldBeClosed = logFile =>\r\n                logFile.LastUsageTime != null && DateTime.Now - logFile.LastUsageTime.Value > FileStreamCloseOnIdleInterval;\r\n\r\n            Predicate<LogFileInfo> fileStreamShouldBeFlushed = logFile =>\r\n            {\r\n                var lastFlushTime = logFile.LastFlushTime ?? logFile.StartupTime;\r\n                return logFile.LastUsageTime != null && logFile.LastUsageTime.Value > lastFlushTime\r\n                       && DateTime.Now - lastFlushTime > FileStreamFlushInterval;\r\n            };\r\n\r\n            while (!HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n            {\r\n                Thread.Sleep(500);\r\n\r\n                var conn = this.FileConnection;\r\n                if (conn != null && (fileShouldBeClosed(conn) || fileStreamShouldBeFlushed(conn)))\r\n                {\r\n                    lock (SyncRoot)\r\n                    {\r\n                        conn = this.FileConnection;\r\n                        if (conn != null)\r\n                        {\r\n                            if (fileShouldBeClosed(conn))\r\n                            {\r\n                                CloseLogFile(true);\r\n                            }\r\n                            else if (fileStreamShouldBeFlushed(conn))\r\n                            {\r\n                                Flush(true);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        public DateTime StartupTime\r\n        {\r\n            get\r\n            {\r\n                lock (_syncRoot)\r\n                {\r\n                    return FileConnection?.StartupTime ?? DateTime.Now;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void WriteEntry(LogEntry entry)\r\n        {\r\n            if (_initializationFailed) return;\r\n\r\n            string logLine = entry.ToString();\r\n\r\n            byte[] bytes = Encoding.UTF8.GetBytes(logLine + \"\\n\");\r\n\r\n            lock (_syncRoot)\r\n            {\r\n                // Checking whether we should change the file after midnight\r\n                int dayNumber = entry.TimeStamp.Day;\r\n\r\n                var now = DateTime.Now;\r\n\r\n                if (FileConnection != null && dayNumber != FileConnection.CreationDate.Day\r\n                   && dayNumber == now.Day)\r\n                {\r\n                    CloseLogFile(true);\r\n                }\r\n\r\n                EnsureInitialize();\r\n                if (_initializationFailed) return;\r\n\r\n                FileConnection.NewEntries.Add(entry);\r\n\r\n                // Writing the file in the \"catch\" block in order to prevent chance of corrupting the file by experiencing ThreadAbortException.\r\n                Exception thrownException = null;\r\n                try\r\n                {\r\n                }\r\n                finally\r\n                {\r\n                    \r\n                    try\r\n                    {\r\n                        FileConnection.FileStream.Write(bytes, 0, bytes.Length);\r\n                        FileConnection.LastUsageTime = now;\r\n\r\n                        if (_flushImmediately)\r\n                        {\r\n                            Flush(false);\r\n                        }\r\n                    }\r\n                    catch (Exception exception)\r\n                    {\r\n                        thrownException = exception;\r\n                    }\r\n                }\r\n                // ThreadAbortException should have a higher priority, and therefore we're doing rethrow in a separate block\r\n                if (thrownException != null) throw thrownException;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        public LogFileReader[] GetLogFiles()\r\n        {\r\n#if UseLockFiles\r\n            if (MoreThanOneAppDomainRunning()) return Array.Empty<LogFileReader>();\r\n#endif\r\n\r\n            string[] filePathes = Directory.GetFiles(_logDirectoryPath);\r\n\r\n            string currentlyOpenedFileName = null;\r\n\r\n            var result = new List<LogFileReader>();\r\n\r\n            lock (_syncRoot)\r\n            {\r\n                if (FileConnection != null)\r\n                {\r\n                    currentlyOpenedFileName = FileConnection.FileName;\r\n\r\n                    result.Add(new CurrentFileReader(this));\r\n\r\n                    FileConnection.LastUsageTime = DateTime.Now;\r\n                }\r\n            }\r\n\r\n            foreach (string filePath in filePathes)\r\n            {\r\n                string fileName = Path.GetFileName(filePath);\r\n\r\n                // Skipping file to which we're currently using\r\n                if (currentlyOpenedFileName != null\r\n                    && string.Compare(fileName, currentlyOpenedFileName, StringComparison.OrdinalIgnoreCase) == 0)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                // File names have format yyyymmdd[_number].txt\r\n                if (fileName.Length < 12)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                DateTime date;\r\n\r\n                if (!DateTime.TryParseExact(fileName.Substring(0, 8),\r\n                                            \"yyyyMMdd\",\r\n                                            CultureInfo.InvariantCulture.DateTimeFormat,\r\n                                            DateTimeStyles.None,\r\n                                            out date))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                result.Add(new PlainFileReader(filePath, date));\r\n            }\r\n\r\n            // Sorting by date\r\n            result.Sort((a, b) => a.Date.CompareTo(b.Date));\r\n\r\n            return result.ToArray();\r\n        }\r\n\r\n        internal void Flush(bool silent)\r\n        {\r\n            lock (_syncRoot)\r\n            {\r\n                if (FileConnection != null)\r\n                {\r\n                    try\r\n                    {\r\n                        FileConnection.FileStream.Flush();\r\n                    }\r\n                    catch (Exception) when (silent)\r\n                    {\r\n                    }\r\n\r\n                    FileConnection.LastFlushTime = DateTime.Now;\r\n                }\r\n            }\r\n        }\r\n\r\n        [DebuggerStepThrough]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        private static FileStream TryOpenFile(string filePath, out Exception e)\r\n        {\r\n            e = null;\r\n            try\r\n            {\r\n                return File.Open(filePath, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                e = ex;\r\n\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [DebuggerStepThrough]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DotNotUseStreamReaderClass:DotNotUseStreamReaderClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        private static bool TryReadAndOpen(string filePath, out string[] content, out FileStream stream, out Exception exception)\r\n        {\r\n            content = null;\r\n            stream = null;\r\n            exception = null;\r\n\r\n            try\r\n            {\r\n                stream = File.Open(filePath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);\r\n\r\n                // Not disposing StreamReader so the stream is not closed afterwards\r\n                var reader = new StreamReader(stream, Encoding.UTF8, true);\r\n                \r\n                var lines = new List<string>();\r\n\r\n                string line;\r\n\r\n                while ((line = reader.ReadLine()) != null)\r\n                {\r\n                    lines.Add(line);\r\n                }\r\n\r\n                content = lines.ToArray();\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                exception = e;\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileStreamClass:DoNotUseFileStreamClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        private void EnsureInitialize()\r\n        {\r\n#if UseLockFiles\r\n            TouchLockFile();\r\n            RemoveOldLockFiles();\r\n#endif\r\n\r\n            if (FileConnection != null) return;\r\n\r\n            lock (_syncRoot)\r\n            {\r\n                if (FileConnection != null) return;\r\n\r\n                DateTime creationDate = DateTime.Now;\r\n\r\n                string fileNamePrefix = creationDate.ToString(\"yyyyMMdd\");\r\n\r\n                for (int i = 0; i < MaxLogFiles; i++)\r\n                {\r\n                    var fileName = fileNamePrefix + (i > 0 ? \"_\" + i : string.Empty) + \".txt\";\r\n                    string filePath = Path.Combine(_logDirectoryPath, fileName);\r\n\r\n                    FileStream stream;\r\n                    Exception ex;\r\n                    if (!File.Exists(filePath))\r\n                    {\r\n                        stream = TryOpenFile(filePath, out ex);\r\n\r\n                        if (stream == null)\r\n                        {\r\n                            // Ignoring this exception if the file has already created\r\n                            if (File.Exists(filePath)) continue;\r\n\r\n                            throw new Exception($\"Failed to create file '{filePath}'\", ex);\r\n                        }\r\n\r\n                        FileConnection = new LogFileInfo\r\n                                              {\r\n                                                  CreationDate = creationDate.Date,\r\n                                                  StartupTime = creationDate,\r\n                                                  FileName = fileName,\r\n                                                  FilePath = filePath,\r\n                                                  FileStream = stream\r\n                                              };\r\n\r\n                        WriteUTF8EncodingHeader(stream);\r\n                        return;\r\n                    }\r\n\r\n                    string[] alreadyWritten;\r\n\r\n                    if (!TryReadAndOpen(filePath, out alreadyWritten, out stream, out ex))\r\n                    {\r\n                        // Trying another file name, since the file may be in use by another process\r\n                        continue;\r\n                    }\r\n\r\n                    FileConnection = new LogFileInfo\r\n                                          {\r\n                                              CreationDate = creationDate.Date,\r\n                                              StartupTime = creationDate,\r\n                                              FileName = fileName,\r\n                                              FilePath = filePath,\r\n                                              FileStream = stream\r\n                                          };\r\n                    return;\r\n                }\r\n\r\n                _initializationFailed = true;\r\n            }\r\n\r\n        }\r\n\r\n\r\n#if UseLockFiles\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]        \r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        private void RemoveOldLockFiles()\r\n        {\r\n            foreach (string filePath in Directory.GetFiles(_logDirectoryPath, \"*.lock\"))\r\n            {\r\n                string appDomainIdString = Path.GetFileNameWithoutExtension(filePath);\r\n                int appDomainId;\r\n                if (!int.TryParse(appDomainIdString, out appDomainId)) continue;\r\n\r\n                if (appDomainId != AppDomain.CurrentDomain.Id)\r\n                {\r\n                    DateTime lastWrite = File.GetLastWriteTime(filePath);\r\n\r\n                    TimeSpan fileAge = DateTime.Now - lastWrite;\r\n\r\n                    if (fileAge > OldLockFilesPreservationTime)\r\n                    {\r\n                        try\r\n                        {\r\n                            File.Delete(filePath);\r\n                        }\r\n                        catch (Exception)\r\n                        {\r\n                            // Ignore\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseDirectoryClass:DoNotUseDirectoryClass\")]\r\n        private bool MoreThanOneAppDomainRunning()\r\n        {\r\n            return Directory.GetFiles(_logDirectoryPath, \"*.lock\").Length > 1;\r\n        }\r\n#endif\r\n\r\n        private void CloseLogFile(bool raiseOnResetEvent)\r\n        {\r\n            if (FileConnection != null)\r\n            {\r\n                FileConnection.Dispose();\r\n                FileConnection = null;\r\n            }\r\n\r\n            if (raiseOnResetEvent)\r\n            {\r\n                OnReset?.Invoke();\r\n            }\r\n        }\r\n\r\n\r\n        private static void WriteUTF8EncodingHeader(Stream stream)\r\n        {\r\n            byte[] preamble = Encoding.UTF8.GetPreamble();\r\n            stream.Write(preamble, 0, preamble.Length);\r\n        }\r\n\r\n\r\n#if UseLockFiles\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        private void TouchLockFile()\r\n        {\r\n            if (_lockFileUpdatedLast + LockFileUpdateFrequency >= DateTime.Now)\r\n            {\r\n                return;\r\n            }\r\n\r\n            // Create .lock file\r\n            try\r\n            {\r\n                File.WriteAllText(LockFileName, \"\");\r\n\r\n                _lockFileUpdatedLast = DateTime.Now;\r\n            }\r\n            catch (Exception)\r\n            {\r\n                // Ignore\r\n            }\r\n        }\r\n#endif\r\n\r\n#if UseLockFiles\r\n        private string LockFileName => Path.Combine(_logDirectoryPath, AppDomain.CurrentDomain.Id + \".lock\");\r\n#endif\r\n\r\n\r\n        bool _disposed;\r\n        [SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\")]\r\n        protected virtual void Dispose(bool disposing)\r\n        {\r\n            if (!_disposed)\r\n            {\r\n                if (disposing)\r\n                {\r\n                    CloseLogFile(false);\r\n                }\r\n\r\n                _disposed = true;\r\n            }\r\n#if UseLockFiles\r\n            // Delete the file in any case\r\n            try\r\n            {\r\n                File.Delete(LockFileName);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                // Ignore\r\n            }\r\n#endif\r\n        }\r\n\r\n\r\n        public void Dispose()\r\n        {\r\n            Dispose(true);\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~FileLogger()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            Dispose(false);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/FileLogTraceListener/LogFileInfo.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener\r\n{\r\n    internal class LogFileInfo : IDisposable\r\n    {\r\n        public string FileName;\r\n        public string FilePath;\r\n        public FileStream FileStream;\r\n        public CircularList<LogEntry> NewEntries = new CircularList<LogEntry>(100);\r\n        public DateTime CreationDate;\r\n        public DateTime? LastUsageTime;\r\n        public DateTime? LastFlushTime;\r\n        public DateTime StartupTime;\r\n\r\n        private bool _disposed;\r\n\r\n        public void Dispose()\r\n        {\r\n            if (!_disposed)\r\n            {\r\n                FileStream.Dispose();\r\n                _disposed = true;\r\n            }\r\n\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~LogFileInfo()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/FileLogTraceListener/LogFileReader.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    internal abstract class LogFileReader\r\n    {\r\n\r\n        public DateTime Date { get; protected set; }\r\n\r\n        public abstract int EntriesCount { get; }\r\n\r\n        public abstract bool Open();\r\n        public abstract void Close();\r\n\r\n        public abstract bool Delete();\r\n\r\n        public abstract IEnumerable<LogEntry> GetLogEntries(DateTime timeFrom, DateTime timeFromTo);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/FileLogTraceListener/LogReaderHelper.cs",
    "content": "﻿using System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing Composite.Core.Logging;\n\nnamespace Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener\n{\n    internal static class LogReaderHelper\n    {\n        public static IEnumerable<string> GetLinesEnumerable(FileStream fileStream)\n        {\n            using (var reader = new StreamReader(fileStream, Encoding.UTF8))\n            {\n                while (reader.Peek() >= 0)\n                {\n                    yield return reader.ReadLine();\n                }\n            }\n        }\n\n        public static IEnumerable<LogEntry> ParseLogLines(FileStream fileStream)\n        {\n            var linesEnumerable = GetLinesEnumerable(fileStream);\n\n            return ParseLogLines(linesEnumerable);\n        }\n\n        public static IEnumerable<LogEntry> ParseLogLines(IEnumerable<string> lines)\n        {\n            var multilineMessage = new StringBuilder();\n\n            LogEntry currentEntry = null;\n            foreach (string line in lines)\n            {\n                LogEntry nextEntry = LogEntry.Parse(line);\n                if (nextEntry != null)\n                {\n                    if (currentEntry != null)\n                    {\n                        if (multilineMessage.Length > 0)\n                        {\n                            currentEntry.Message = multilineMessage.ToString();\n                            multilineMessage.Clear();\n                        }\n\n                        yield return currentEntry;\n                    }\n                    currentEntry = nextEntry;\n                }\n                else\n                {\n                    if (currentEntry != null)\n                    {\n                        if (multilineMessage.Length == 0)\n                        {\n                            multilineMessage.Append(currentEntry.Message);\n                        }\n\n                        multilineMessage.AppendLine(line);\n                    }\n                }\n            }\n\n            if (currentEntry != null)\n            {\n                if (multilineMessage.Length > 0)\n                {\n                    currentEntry.Message = multilineMessage.ToString();\n                    multilineMessage.Clear();\n                }\n\n                yield return currentEntry;\n            }\n        }\n    }\n}"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/FileLogTraceListener/PlainFileReader.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Plugins.Logging.LogTraceListeners.FileLogTraceListener\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [EditorBrowsable(EditorBrowsableState.Never)] \r\n    internal class PlainFileReader : LogFileReader\r\n    {\r\n        private FileStream _file;\r\n        private readonly string _filePath;\r\n        private int? _entriesCount;\r\n\r\n        public PlainFileReader(string filePath, DateTime date)\r\n        {\r\n            _filePath = filePath;\r\n            Date = date;\r\n        }\r\n\r\n        [DebuggerStepThrough]\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        public override bool Open()\r\n        {\r\n            try\r\n            {\r\n                _file = File.OpenRead(_filePath);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                return false;\r\n            }\r\n            return true;\r\n        }\r\n\r\n        public override void Close()\r\n        {\r\n            if (_file == null) return;\r\n\r\n            _file.Close();\r\n            _file.Dispose();\r\n            _file = null;\r\n        }\r\n\r\n        \r\n\r\n\r\n        public override IEnumerable<LogEntry> GetLogEntries(DateTime timeFrom, DateTime timeFromTo)\r\n        {\r\n            var logLines = LogReaderHelper.GetLinesEnumerable(_file);\r\n\r\n            return LogReaderHelper.ParseLogLines(logLines);\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        public override int EntriesCount\r\n        {\r\n            get\r\n            {\r\n                if (_entriesCount == null)\r\n                {\r\n                    try\r\n                    {\r\n                        Open();\r\n\r\n                        _entriesCount = GetLogEntries(DateTime.MinValue, DateTime.MaxValue).Count();\r\n                    }\r\n                    finally\r\n                    {\r\n                        Close();\r\n                    }\r\n                }\r\n\r\n                return (int)_entriesCount;\r\n            }\r\n        }\r\n\r\n\r\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Composite.IO\", \"Composite.DoNotUseFileClass:DoNotUseFileClass\", Justification = \"This is what we want, touch is used later on\")]\r\n        public override bool Delete()\r\n        {\r\n            try\r\n            {\r\n                File.Delete(_filePath);\r\n                return true;\r\n            }\r\n            catch\r\n            {\r\n                return false;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/ManagementConsoleLogTracer/ManagementConsoleLogTracer.cs",
    "content": "﻿using System;\r\nusing System.Text.RegularExpressions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Logging;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;\r\n\r\n\r\nnamespace Composite.Plugins.Logging.LogTraceListeners.ManagementConsoleLogTracer\r\n{\r\n    [ConfigurationElementType(typeof(CustomTraceListenerData))]\r\n    internal sealed class ManagementConsoleLogTracer : CustomTraceListener\r\n    {\r\n        private LogLevel _logLevel;\r\n\r\n        public ManagementConsoleLogTracer()\r\n        {\r\n\r\n            _logLevel = LogLevel.Info;\r\n        }\r\n\r\n        public ManagementConsoleLogTracer(string logLevel)\r\n        {\r\n            switch (logLevel)\r\n            {\r\n                case \"Fine\":\r\n                    _logLevel = LogLevel.Fine;\r\n                    break;\r\n                case \"Info\":\r\n                    _logLevel = LogLevel.Info;\r\n                    break;\r\n                case \"Fatal\":\r\n                    _logLevel = LogLevel.Fatal;\r\n                    break;\r\n                case \"Warning\":\r\n                    _logLevel = LogLevel.Warning;\r\n                    break;\r\n                case \"Debug\":\r\n                    _logLevel = LogLevel.Debug;\r\n                    break;\r\n                case \"Error\":\r\n                    _logLevel = LogLevel.Error;\r\n                    break;\r\n                default:\r\n                    throw new ArgumentException( \"Unhandled log level: \" + logLevel);\r\n            }\r\n        }\r\n\r\n\r\n        public override void Write(string message)\r\n        {\r\n            Regex regex = new Regex(@\"RGB\\((?<r>[0-9]+), (?<g>[0-9]+), (?<b>[0-9]+)\\)\");\r\n            Match matchMessage = regex.Match(message);\r\n            if (matchMessage.Success)\r\n            {\r\n                message = message.Replace(matchMessage.Groups[0].Value, \"\");\r\n            }\r\n\r\n            LogEntryMessageQueueItem messageItem = new LogEntryMessageQueueItem { Level = _logLevel, Message = message, Sender = this.GetType() };\r\n            ConsoleMessageQueueFacade.Enqueue(messageItem, null);\r\n        }\r\n\r\n\r\n        public override void WriteLine(string message)\r\n        {\r\n            this.Write(message);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Logging/LogTraceListeners/SystemDiagnosticsTrace/SystemDiagnosticsTraceBridge.cs",
    "content": "using System;\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;\n\nnamespace Composite.Plugins.Logging.LogTraceListeners.SystemDiagnosticsTrace\n{\n    [ConfigurationElementType(typeof(CustomTraceListenerData))]\n    internal sealed class SystemDiagnosticsTraceBridge : CustomTraceListener\n    {\n        public SystemDiagnosticsTraceBridge()\n        {\n        }\n\n        public SystemDiagnosticsTraceBridge(string initializeData)\n        {\n        }\n\n        public override void TraceData(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data)\n        {\n            var logEntry = (Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry)data;\n\n            string title = logEntry.Title;\n            title = title.Substring(title.IndexOf(')') + 2); // Removing ({AppDomainId} - {ThreadId}}) prefix.\n            if (title.StartsWith(\"RGB(\"))\n            {\n                string displayOptions = title.Substring(0, title.IndexOf(')') + 1);\n                title = title.Substring(displayOptions.Length);\n            }\n\n            string message = String.Format(\"[{0}] {1}\", title, logEntry.Message);\n\n            switch (logEntry.Severity)\n            {\n                case System.Diagnostics.TraceEventType.Critical:\n                case System.Diagnostics.TraceEventType.Error:\n                    System.Diagnostics.Trace.TraceError(message);\n                    break;\n                case System.Diagnostics.TraceEventType.Warning:\n                    System.Diagnostics.Trace.TraceWarning(message);\n                    break;\n                case System.Diagnostics.TraceEventType.Information:\n                    System.Diagnostics.Trace.TraceInformation(message);\n                    break;\n                default:\n                    System.Diagnostics.Trace.WriteLine(message);\n                    break;\n            }\n\n            System.Diagnostics.Trace.Flush();\n        }\n\n        public override void Write(string message)\n        {\n            System.Diagnostics.Trace.Write(message);\n        }\n\n        public override void WriteLine(string message)\n        {\n            System.Diagnostics.Trace.WriteLine(message);\n        }\n    }\n}\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Common/CachedTemplateInformation.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Core.IO;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Common\r\n{\r\n    internal class CachedTemplateInformation\r\n    {\r\n        private CachedTemplateInformation() {}\r\n\r\n        public CachedTemplateInformation(Core.PageTemplates.PageTemplateDescriptor parsedTemplate)\r\n        {\r\n            TemplateId = parsedTemplate.Id;\r\n            Title = parsedTemplate.Title;\r\n        }\r\n\r\n        public Guid TemplateId { get; set; }\r\n        public string Title { get; set; }\r\n\r\n        public static void SerializeToFile(CachedTemplateInformation pageTemplate, string filePath)\r\n        {\r\n            var lines = new List<string>();\r\n\r\n            if (pageTemplate != null)\r\n            {\r\n                lines.Add(pageTemplate.TemplateId.ToString());\r\n                lines.Add(pageTemplate.Title);\r\n            }\r\n\r\n            C1File.WriteAllLines(filePath, lines);\r\n        }\r\n\r\n        public static CachedTemplateInformation DeserializeFromFile(string filePath)\r\n        {\r\n            var lines = C1File.ReadAllLines(filePath);\r\n            if (lines == null || lines.Length == 0)\r\n            {\r\n                return null;\r\n            }\r\n                \r\n            Guid templateId = Guid.Parse(lines[0]);\r\n            string title = string.Join(Environment.NewLine, lines.Skip(1));\r\n\r\n            return new CachedTemplateInformation { TemplateId = templateId, Title = title };\r\n        }\r\n    }\r\n        \r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Common/TemplateParsingHelper.cs",
    "content": "﻿using System;\r\nusing System.Text;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Common\r\n{\r\n    internal static class TemplateParsingHelper\r\n    {\r\n        public static bool TryExtractTemplateIdFromCSharpCode(string filePath, out Guid templateId, string idTokenBegin, string idTokenEnd)\r\n        {\r\n            templateId = Guid.Empty;\r\n\r\n            if (!C1File.Exists(filePath)) return false;\r\n\r\n            var allText = C1File.ReadAllText(filePath, Encoding.UTF8);\r\n\r\n            allText = RemoveWhiteSpaces(allText);\r\n\r\n            string beginning = RemoveWhiteSpaces(idTokenBegin);\r\n            string ending = RemoveWhiteSpaces(idTokenEnd);\r\n\r\n            int firstIndex = allText.IndexOf(beginning, StringComparison.Ordinal);\r\n            if (firstIndex < 0) return false;\r\n\r\n            int lastIndex = allText.LastIndexOf(beginning, StringComparison.Ordinal);\r\n            if (lastIndex != firstIndex) return false;\r\n\r\n            int endOffset = allText.IndexOf(ending, firstIndex, StringComparison.Ordinal);\r\n            if (endOffset < 0) return false;\r\n\r\n            int guidOffset = firstIndex + beginning.Length;\r\n            string guidStr = allText.Substring(guidOffset, endOffset - guidOffset);\r\n\r\n            return Guid.TryParse(guidStr, out templateId);\r\n        }\r\n\r\n\r\n        private static string RemoveWhiteSpaces(string str)\r\n        {\r\n            var whiteSpaces = new[] { ' ', '\\t', '\\r', '\\n' };\r\n\r\n            whiteSpaces.ForEach(ch => str = str.Replace(new string(ch, 1), \"\"));\r\n\r\n            return str;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/CompilationHelper.cs",
    "content": "﻿using System;\r\nusing System.Reflection;\r\nusing System.Web;\r\nusing System.Web.Compilation;\r\nusing System.Web.UI;\r\nusing System.Web.Util;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    internal static class CompilationHelper\r\n    {\r\n        public static MasterPage CompileMasterPage(string virtualPath)\r\n        {\r\n            // Calling: object virtualPathObj = new System.Web.VirtualPath(virtualPath);\r\n            Assembly asmSystemWeb = typeof(HttpContext).Assembly;\r\n            Type tVirtualType = asmSystemWeb.GetType(\"System.Web.VirtualPath\");\r\n            var virtualTypeConstructor = tVirtualType.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null,\r\n                                                                     new[] { typeof(string) }, null);\r\n            object virtualPathObj = virtualTypeConstructor.Invoke(new object[] { virtualPath });\r\n\r\n            // Calling: return System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(null, virtualPathObj, false, false, false)\r\n\r\n\r\n            IWebObjectFactory factory;\r\n\r\n            using(BuildManagerHelper.DisableUrlMetadataCachingScope())\r\n            {\r\n                factory = typeof(BuildManager)\r\n                        .GetMethod(\"GetVPathBuildResultWithNoAssert\",\r\n                                    BindingFlags.NonPublic | BindingFlags.Static,\r\n                                    null,\r\n                                    CallingConventions.Any,\r\n                                    new Type[] { typeof(HttpContext), tVirtualType, typeof(bool), typeof(bool), typeof(bool) },\r\n                                    null)\r\n                        .Invoke(null, new object[] { null, virtualPathObj, false, false, false }) as IWebObjectFactory;\r\n\r\n            }\r\n\r\n            Verify.IsNotNull(factory, \"Failed to compile master page file\");\r\n\r\n            return factory.CreateInstance() as MasterPage;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Functions/Function.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [PersistChildren(false)]\r\n    [ParseChildren(true, \"Parameters\")]\r\n    public class Function : Control\r\n    {\r\n        private static readonly string LogTitle = \"Controls.Function\";\r\n\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n        private ParamCollection _parameters;\r\n\r\n        /// <exclude />\r\n        [PersistenceMode(PersistenceMode.InnerDefaultProperty)]\r\n        [DefaultValue(default(string))]\r\n        [MergableProperty(false)]\r\n        public ParamCollection Parameters\r\n        {\r\n            get\r\n            {\r\n                if (_parameters == null)\r\n                {\r\n                    _parameters = new ParamCollection();\r\n                }\r\n\r\n                return _parameters;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void OnInit(EventArgs e)\r\n        {\r\n            Type returnType;\r\n            object result;\r\n            string functionName = Name;\r\n\r\n            var functionContextContainer = PageRenderer.GetPageRenderFunctionContextContainer();\r\n\r\n            try\r\n            {\r\n                result = GetValue(functionContextContainer, out returnType);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                XElement errorBoxHtml;\r\n                if (!functionContextContainer.ProcessException(functionName, ex, LogTitle, out errorBoxHtml))\r\n                {\r\n                    throw;\r\n                }\r\n\r\n                result = errorBoxHtml;\r\n                returnType = typeof(XElement);\r\n            }\r\n\r\n            if (result != null)\r\n            {\r\n                if (returnType == typeof(XElement) || returnType == typeof(XhtmlDocument))\r\n                {\r\n                    var element = ValueTypeConverter.Convert<XElement>(result);\r\n                    var markup = new Markup(element, functionContextContainer);\r\n\r\n                    Controls.Add(markup);\r\n                }\r\n                else if (typeof(Control).IsAssignableFrom(returnType))\r\n                {\r\n                    var control = (Control) result;\r\n\r\n                    Controls.Add(control);\r\n                }\r\n                else if (result is IEnumerable<XNode>)\r\n                {\r\n                    var nodes = result as IEnumerable<XNode>;\r\n\r\n                    foreach (XNode node in nodes)\r\n                    {\r\n                        if (node == null) continue;\r\n\r\n                        if (node is XElement)\r\n                        {\r\n                            var markup = new Markup(node as XElement, functionContextContainer);\r\n\r\n                            Controls.Add(markup);\r\n                        }\r\n                        else\r\n                        {\r\n                            Controls.Add(new LiteralControl(node.ToString()));\r\n                        }\r\n                        \r\n                    }\r\n                }\r\n                else if (result is XAttribute)\r\n                {\r\n                    var parentControl = this.Parent as HtmlGenericControl;\r\n                    if(parentControl != null)\r\n                    {\r\n                        var attr = (XAttribute) result;\r\n                        parentControl.Attributes.Add(attr.Name.ToString(), attr.Value);\r\n                    }\r\n                    else\r\n                    {\r\n                        const string comment = @\"<!-- Failed to add attribute, parent control should be of type HtmlGenericControl, check that runat=\"\"server\"\" attribute is added -->\";\r\n                        Controls.Add(new LiteralControl(comment));\r\n                    }\r\n                }\r\n                else \r\n                {\r\n                    var str = result.ToString();\r\n\r\n                    Controls.Add(new LiteralControl(str));\r\n                }\r\n            }\r\n\r\n            base.OnInit(e);\r\n        }\r\n\r\n        private object GetValue(FunctionContextContainer functionContextContainer, out Type returnType)\r\n        {\r\n            string functionName = Name;\r\n\r\n            IFunction function;\r\n\r\n            if (!FunctionFacade.TryGetFunction(out function, functionName))\r\n            {\r\n                throw new InvalidOperationException(\"Invalid function name '{0}'\".FormatWith(functionName));\r\n            }\r\n\r\n            returnType = function.ReturnType;\r\n\r\n            IDictionary<string, object> parameters = parseParameters(functionContextContainer);\r\n\r\n            VerifyParameterMatch(function, parameters);\r\n\r\n            return ExecuteFunction(function, parameters, functionContextContainer);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Executes the function. Note that all the XhtmlParameters will have all the nested &gt;f:function /&lt; lazily evaluated\r\n        /// </summary>\r\n        private static object ExecuteFunction(IFunction function, IDictionary<string, object> parameters, FunctionContextContainer functionContextContainer )\r\n        {\r\n            List<BaseParameterRuntimeTreeNode> parameterNodes = new List<BaseParameterRuntimeTreeNode>();\r\n\r\n            if (parameters != null)\r\n            {\r\n                foreach (KeyValuePair<string, object> kvp in parameters)\r\n                {\r\n                    var value = kvp.Value;\r\n                    if (value is XhtmlDocument)\r\n                    {\r\n                        parameterNodes.Add(new LazyParameterRuntimeTreeNode(kvp.Key,\r\n                            () => ExecuteNestedFunctions(value as XhtmlDocument, functionContextContainer)));\r\n                    }\r\n                    else\r\n                    {\r\n                        parameterNodes.Add(new ConstantObjectParameterRuntimeTreeNode(kvp.Key, kvp.Value));\r\n                    }\r\n                }\r\n            }\r\n\r\n            var treeNode = new FunctionRuntimeTreeNode(function, parameterNodes);\r\n\r\n            return treeNode.GetValue(functionContextContainer);\r\n        }\r\n\r\n        private static XhtmlDocument ExecuteNestedFunctions(XhtmlDocument document, FunctionContextContainer functionContextContainer)\r\n        {\r\n            PageRenderer.ExecuteEmbeddedFunctions(document.Root, functionContextContainer);\r\n\r\n            return document;\r\n        }\r\n\r\n        private static void VerifyParameterMatch(IFunction function, IDictionary<string, object> parameters)\r\n        {\r\n            var initializationInfo = function as IFunctionInitializationInfo;\r\n            if(initializationInfo != null && !initializationInfo.FunctionInitializedCorrectly) return;\r\n            \r\n            foreach(string parameterName in parameters.Keys)\r\n            {\r\n                Verify.That(function.ParameterProfiles.Any(p => p.Name == parameterName),\r\n                    \"Function '{0}.{1}' does not have parameter '{2}' defined\",\r\n                    function.Namespace, function.Name, parameterName);\r\n            }\r\n        }\r\n\r\n        private IDictionary<string, object> parseParameters(FunctionContextContainer functionContextContainer)\r\n        {\r\n            var result = new Dictionary<string, object>();\r\n\r\n            foreach (Param param in Parameters)\r\n            {\r\n                param.DataBind();\r\n\r\n                object value;\r\n\r\n                if (param.Controls.Count == 1 && param.Controls[0] is Function)\r\n                {\r\n                    var nestedFunction = param.Controls[0] as Function;\r\n\r\n                    Type returnType;\r\n                    value = nestedFunction.GetValue(functionContextContainer, out returnType);\r\n                }\r\n                else\r\n                {\r\n                    value = param.Value;\r\n                }\r\n\r\n                result.Add(param.Name, value);\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Functions/LazyParameterRuntimeTreeNode.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\r\n{\r\n    internal class LazyParameterRuntimeTreeNode : BaseParameterRuntimeTreeNode\r\n    {\r\n        private readonly Func<object> _getValueFunction;\r\n        private object _result;\r\n        private bool _evaluated;\r\n\r\n        public LazyParameterRuntimeTreeNode(string parameterName, Func<object> getValueFunction)\r\n            : base(parameterName)\r\n        {\r\n            _getValueFunction = getValueFunction;\r\n        }\r\n\r\n        public override object GetValue(FunctionContextContainer contextContainer)\r\n        {\r\n            if (!_evaluated)\r\n            {\r\n                _result = _getValueFunction();\r\n                _evaluated = true;\r\n            }\r\n\r\n            return _result;\r\n        }\r\n\r\n        public override IEnumerable<string> GetAllSubFunctionNames()\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n        public override bool ContainsNestedFunctions\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n        public override System.Xml.Linq.XElement Serialize()\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Functions/Markup.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Xml.Linq;\r\nusing Composite.AspNet;\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\r\n{\r\n    /// <exclude />\r\n    [ParseChildren(false)]\r\n    public class Markup : Control\r\n    {\r\n        private readonly FunctionContextContainer _functionContextContainer;\r\n\r\n        /// <exclude />\r\n        protected XElement InnerContent { get; set; }\r\n\r\n        /// <exclude />\r\n        public Markup() { }\r\n\r\n        /// <exclude />\r\n        public Markup(XElement content, FunctionContextContainer functionContextContainer)\r\n        {\r\n            if(content.Name.LocalName == \"html\")\r\n            {\r\n                InnerContent = content;\r\n            }\r\n            else\r\n            {\r\n                var document = new XhtmlDocument();\r\n                document.Body.Add(content);\r\n\r\n                InnerContent = document.Root;\r\n            }\r\n\r\n            _functionContextContainer = functionContextContainer;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void OnInit(EventArgs e)\r\n        {\r\n            EnsureChildControls();\r\n\r\n            base.OnInit(e);\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void CreateChildControls()\r\n        {\r\n            if (InnerContent == null)\r\n            {\r\n                ProcessInternalControls();\r\n            }\r\n\r\n            if (InnerContent != null)\r\n            {\r\n                var functionContextContainer = _functionContextContainer;\r\n                if (functionContextContainer == null && this.NamingContainer is UserControlFunction)\r\n                {\r\n                    var containerFunction = this.NamingContainer as UserControlFunction;\r\n                    functionContextContainer = containerFunction.FunctionContextContainer;\r\n                } \r\n                \r\n                if (functionContextContainer == null)\r\n                {\r\n                    functionContextContainer = PageRenderer.GetPageRenderFunctionContextContainer();\r\n                } \r\n                var controlMapper = (IXElementToControlMapper) functionContextContainer.XEmbedableMapper;\r\n\r\n                PageRenderer.ExecuteEmbeddedFunctions(InnerContent, functionContextContainer);\r\n\r\n                var xhmlDocument = new XhtmlDocument(InnerContent);\r\n\r\n                PageRenderer.NormalizeXhtmlDocument(xhmlDocument);\r\n                PageRenderer.ResolveRelativePaths(xhmlDocument);\r\n\r\n                if (PageRenderer.CurrentPage != null)\r\n                {\r\n                    PageRenderer.ResolvePageFields(xhmlDocument, PageRenderer.CurrentPage);\r\n                }\r\n\r\n                NormalizeAspNetForms(xhmlDocument);\r\n\r\n                AddNodesAsControls(xhmlDocument.Body.Nodes(), this, controlMapper);\r\n\r\n                if (Page.Header != null)\r\n                {\r\n                    MergeHeadSection(xhmlDocument, Page.Header, controlMapper);\r\n                }\r\n            }\r\n\r\n            base.CreateChildControls();\r\n        }\r\n\r\n\r\n        private void MergeHeadSection(XhtmlDocument xhtmlDocument, HtmlHead headControl, IXElementToControlMapper controlMapper)\r\n        {\r\n            xhtmlDocument.MergeToHeadControl(headControl, controlMapper);\r\n\r\n            // handling custom master page head control locally - removing it if a generic meta description tag was in the document\r\n            if (headControl.Controls.OfType<HtmlMeta>().Any(f=>f.Name==\"description\"))\r\n            {\r\n                var existingDescriptionMetaTag = headControl.Controls.OfType<DescriptionMetaTag>().FirstOrDefault();\r\n                if (existingDescriptionMetaTag != null)\r\n                {\r\n                    headControl.Controls.Remove(existingDescriptionMetaTag);\r\n                }\r\n            }\r\n        }\r\n\r\n        \r\n        private void NormalizeAspNetForms(XhtmlDocument xhtmlDocument)\r\n        {\r\n            // If current control is inside <form id=\"\" runat=\"server\"> tag all <asp:forms> tags will be removed from placeholder\r\n\r\n            bool isInsideAspNetForm = false;\r\n\r\n            var ansestor = this.Parent;\r\n            while (ansestor != null)\r\n            {\r\n                if (ansestor is HtmlForm)\r\n                {\r\n                    isInsideAspNetForm = true;\r\n                    break;\r\n                }\r\n\r\n                ansestor = ansestor.Parent;\r\n            }\r\n\r\n            if (!isInsideAspNetForm)\r\n            {\r\n                return;\r\n            }\r\n\r\n            List<XElement> aspNetFormElements = xhtmlDocument.Descendants(Namespaces.AspNetControls + \"form\").Reverse().ToList();\r\n\r\n            foreach (XElement aspNetFormElement in aspNetFormElements)\r\n            {\r\n                aspNetFormElement.ReplaceWith(aspNetFormElement.Nodes());\r\n            }\r\n        }\r\n\r\n        private void ProcessInternalControls()\r\n        {\r\n            string str = null;\r\n\r\n            if (Controls.Count > 0)\r\n            {\r\n                var content = Controls[0] as LiteralControl;\r\n                if (content != null)\r\n                {\r\n                    str = content.Text;\r\n                }\r\n            }\r\n\r\n            if (!String.IsNullOrEmpty(str))\r\n            {\r\n                Controls.Clear();\r\n\r\n                InnerContent = new XElement(Namespaces.Xhtml + \"html\",\r\n                    new XAttribute(XNamespace.Xmlns + \"f\", Namespaces.Function10),\r\n                    new XAttribute(XNamespace.Xmlns + \"lang\", LocalizationXmlConstants.XmlNamespace),\r\n                        new XElement(Namespaces.Xhtml + \"head\"),\r\n                        new XElement(Namespaces.Xhtml + \"body\", XElement.Parse(str)));\r\n            }\r\n        }\r\n\r\n        private static void AddNodesAsControls(IEnumerable<XNode> nodes, Control parent, IXElementToControlMapper mapper)\r\n        {\r\n            foreach (var node in nodes)\r\n            {\r\n                var c = node.AsAspNetControl(mapper);\r\n                parent.Controls.Add(c);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Functions/Param.cs",
    "content": "﻿using System.ComponentModel;\r\nusing System.Web.UI;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    [ControlBuilder(typeof(ParamControlBuilder))]\r\n    public class Param : Control, IParserAccessor\r\n    {\r\n        private object _value;\r\n\r\n        /// <exclude />\r\n        [TypeConverter(typeof(StringToObjectConverter))]\r\n        public object Value\r\n        {\r\n            get { return _value; }\r\n\r\n            set\r\n            {\r\n                if (value is ParamObjectConverter)\r\n                {\r\n                    _value = ((ParamObjectConverter)value).Value;\r\n                }\r\n                else\r\n                {\r\n                    _value = value;\r\n                }\r\n            }\r\n\r\n        }\r\n\r\n        /// <exclude />\r\n        public string Name { get; set; }\r\n\r\n\r\n        /// <exclude />\r\n        public Param() { }\r\n\r\n        /// <exclude />\r\n        public Param(string name, object value)\r\n        {\r\n            Name = name;\r\n            Value = value;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void AddParsedSubObject(object obj)\r\n        {\r\n            if (!HasControls() && (obj is LiteralControl))\r\n            {\r\n                this.Value = ((LiteralControl)obj).Text;\r\n                return;\r\n            }\r\n            \r\n            base.AddParsedSubObject(obj);\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void DataBindChildren()\r\n        {\r\n            base.DataBindChildren();\r\n\r\n            if (Value == null)\r\n            {\r\n                if (Controls.Count > 0)\r\n                {\r\n                    var child = Controls[0];\r\n                    if (child is DataBoundLiteralControl)\r\n                    {\r\n                        Value = ((DataBoundLiteralControl)child).Text;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Functions/ParamCollection.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ParamCollection : IList, ICollection, IEnumerable\r\n    {\r\n        private readonly ArrayList _innerList = new ArrayList();\r\n\r\n        /// <exclude />\r\n        public void Add(Param value)\r\n        {\r\n            _innerList.Add(value);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Clear()\r\n        {\r\n            _innerList.Clear();\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool Contains(Param value)\r\n        {\r\n            return _innerList.Contains(value);\r\n        }\r\n\r\n        /// <exclude />\r\n        public int IndexOf(Param value)\r\n        {\r\n            return _innerList.IndexOf(value);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Insert(int index, Param value)\r\n        {\r\n            _innerList.Insert(index, value);\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsFixedSize\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsReadOnly\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public void Remove(Param value)\r\n        {\r\n            _innerList.Remove(value);\r\n        }\r\n\r\n        /// <exclude />\r\n        public void RemoveAt(int index)\r\n        {\r\n            _innerList.RemoveAt(index);\r\n        }\r\n\r\n        /// <exclude />\r\n        public Param this[int index]\r\n        {\r\n            get { return (Param)_innerList[index]; }\r\n            set { _innerList[index] = value; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public void CopyTo(Array array, int index)\r\n        {\r\n            _innerList.CopyTo(array, index);\r\n        }\r\n\r\n        /// <exclude />\r\n        public int Count\r\n        {\r\n            get { return _innerList.Count; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public bool IsSynchronized\r\n        {\r\n            get { return _innerList.IsSynchronized; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public object SyncRoot\r\n        {\r\n            get { return this; }\r\n        }\r\n\r\n        /// <exclude />\r\n        public IEnumerator GetEnumerator()\r\n        {\r\n            return _innerList.GetEnumerator();\r\n        }\r\n\r\n        int IList.Add(object value)\r\n        {\r\n            var param = (Param)value;\r\n\r\n            return _innerList.Add(param);\r\n        }\r\n\r\n        bool IList.Contains(object value)\r\n        {\r\n            return this.Contains((Param)value);\r\n        }\r\n\r\n        int IList.IndexOf(object value)\r\n        {\r\n            return this.IndexOf((Param)value);\r\n        }\r\n\r\n        void IList.Insert(int index, object value)\r\n        {\r\n            this.Insert(index, (Param)value);\r\n        }\r\n\r\n        void IList.Remove(object value)\r\n        {\r\n            this.Remove((Param)value);\r\n        }\r\n\r\n        object IList.this[int index]\r\n        {\r\n            get { return this._innerList[index]; }\r\n            set { this._innerList[index] = (Param)value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Functions/ParamObjectConverter.cs",
    "content": "﻿namespace Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ParamObjectConverter\r\n    {\r\n        /// <exclude />\r\n        public object Value { get; set; }\r\n\r\n        /// <exclude />\r\n        public ParamObjectConverter() { }\r\n\r\n        /// <exclude />\r\n        public ParamObjectConverter(string oValue)\r\n            : this()\r\n        {\r\n            this.Value = oValue;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override string ToString()\r\n        {\r\n            return Value == null ? string.Empty : Value.ToString();\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Functions/ParamTagControlBuilder.cs",
    "content": "﻿using System.Web.UI;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class ParamControlBuilder : ControlBuilder\r\n    {\r\n        /// <exclude />\r\n        public override bool AllowWhitespaceLiterals()\r\n        {\r\n            return false;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool HtmlDecodeLiterals()\r\n        {\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Functions/StringToObjectConverter.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design.Serialization;\r\nusing System.Globalization;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class StringToObjectConverter : TypeConverter\r\n    {\r\n        /// <exclude />\r\n        public override bool IsValid(ITypeDescriptorContext context, object value)\r\n        {\r\n            return true;\r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)\r\n        {\r\n            if (sourceType == typeof(string))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            return base.CanConvertFrom(context, sourceType);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)\r\n        {\r\n            if (destinationType == typeof(object))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            if (destinationType == typeof(InstanceDescriptor))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            return base.CanConvertTo(context, destinationType);\r\n        }\r\n\r\n        /// <exclude />\r\n        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)\r\n        {\r\n            return value.ToString();\r\n        }\r\n\r\n        /// <exclude />\r\n        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)\r\n        {\r\n            if (destinationType == typeof(object))\r\n            {\r\n                return (object)value;\r\n            }\r\n\r\n            if (destinationType == typeof(InstanceDescriptor))\r\n            {\r\n                return new InstanceDescriptor(typeof(ParamObjectConverter).GetConstructor(new Type[] { value.GetType() }), new object[] { value });\r\n            }\r\n\r\n            return base.ConvertTo(context, culture, value, destinationType);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Rendering/Description.cs",
    "content": "﻿using System.Web.UI;\r\n\r\nusing Composite.Core.WebClient.Renderings.Page;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Description : Control\r\n    {\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            string description = Page.Header.Description;\r\n\r\n            if (string.IsNullOrWhiteSpace(description))\r\n            {\r\n                description = PageRenderer.CurrentPage.Description;\r\n            }\r\n\r\n            if (string.IsNullOrWhiteSpace(description)) return;\r\n\r\n            writer.WriteEncodedText(description);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Rendering/DescriptionMetaTag.cs",
    "content": "﻿using System.Web.UI;\r\n\r\nusing Composite.Core.WebClient.Renderings.Page;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class DescriptionMetaTag : Control\r\n    {\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            string description = Page.Header.Description;\r\n\r\n            if (string.IsNullOrWhiteSpace(description))\r\n            {\r\n                description = PageRenderer.CurrentPage.Description;\r\n            }\r\n\r\n            if(string.IsNullOrWhiteSpace(description)) return;\r\n\r\n            writer.AddAttribute(\"name\", \"description\");\r\n            writer.AddAttribute(\"content\", description, true);\r\n            writer.RenderBeginTag(\"meta\");\r\n            writer.RenderEndTag();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Rendering/PageTemplateFeature.cs",
    "content": "﻿using System.Web.UI;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.PageTemplates.MasterPages.Controls.Functions;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering\r\n{\r\n    /// <summary>\r\n    /// \r\n    /// </summary>\r\n    public class PageTemplateFeature : Control\r\n    {\r\n        /// <summary>\r\n        /// Name of Page Template Feature to include\r\n        /// </summary>\r\n        public string Name { get; set; }\r\n\r\n        /// <exclude />\r\n        protected override void OnInit(System.EventArgs e)\r\n        {\r\n            XhtmlDocument feature = PageTemplateFeatureFacade.GetPageTemplateFeature(this.Name);\r\n            FunctionContextContainer functionContextContainer = PageRenderer.GetPageRenderFunctionContextContainer();\r\n\r\n            var markup = new Markup(feature.Root, functionContextContainer);\r\n\r\n            Controls.Add(markup);\r\n\r\n            base.OnInit(e);\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Rendering/Render.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.Xml;\r\nusing Composite.Plugins.PageTemplates.MasterPages.Controls.Functions;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Render : Markup\r\n    {\r\n        private string _placeholderId;\r\n\r\n        /// <exclude />\r\n        public string PlaceholderID\r\n        {\r\n            get { return _placeholderId;  }\r\n            set { _placeholderId = value;  } \r\n        }\r\n\r\n        /// <exclude />\r\n        public bool HasBody\r\n        {\r\n            get\r\n            {\r\n                EnsureChildControls();\r\n\r\n                if (Markup == null)\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                var body = new XhtmlDocument(Markup).Body;\r\n\r\n                return body != null && body.Nodes().Any();\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public XhtmlDocument Markup\r\n        {\r\n            get { return InnerContent == null ? null : new XhtmlDocument(base.InnerContent); }\r\n            set { InnerContent = value != null ? value.Root : null; }\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override void CreateChildControls()\r\n        {\r\n            DataBind();\r\n\r\n            if (InnerContent == null)\r\n            {\r\n                var renderingInfo = MasterPagePageRenderer.GetRenderingInfo(this.Page);\r\n\r\n                string placeholderId = PlaceholderID ?? ID;\r\n\r\n                if (placeholderId != null)\r\n                {\r\n                    var content = renderingInfo.Contents.SingleOrDefault(c => c.PlaceHolderId == placeholderId);\r\n                    if (content == null)\r\n                    {\r\n                        InnerContent = new XElement(Namespaces.Xhtml + \"html\",\r\n                                new XAttribute(XNamespace.Xmlns + \"f\", Namespaces.Function10),\r\n                                new XAttribute(XNamespace.Xmlns + \"lang\", LocalizationXmlConstants.XmlNamespace),\r\n                                    new XElement(Namespaces.Xhtml + \"head\"),\r\n                                    new XElement(Namespaces.Xhtml + \"body\"));\r\n                    }\r\n                    else\r\n                    {\r\n                        if (content.Content.StartsWith(\"<html\"))\r\n                        {\r\n                            try\r\n                            {\r\n                                InnerContent = XhtmlDocument.Parse(content.Content).Root;\r\n                            }\r\n                            catch (ArgumentException) { }\r\n                        }\r\n                        else\r\n                        {\r\n                            InnerContent = new XElement(Namespaces.Xhtml + \"html\",\r\n                               new XAttribute(XNamespace.Xmlns + \"f\", Namespaces.Function10),\r\n                                   new XElement(Namespaces.Xhtml + \"head\"),\r\n                                   new XElement(Namespaces.Xhtml + \"body\", XElement.Parse(content.Content)));\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            base.CreateChildControls();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/Controls/Rendering/Title.cs",
    "content": "﻿using System.Web.UI;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering\r\n{\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class Title : Control\r\n    {\r\n        /// <exclude />\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            string pageTitle = string.IsNullOrWhiteSpace(Page.Title) ? PageRenderer.CurrentPage.Title : Page.Title;\r\n            writer.WriteEncodedText(pageTitle);\r\n            this.Page.Title = pageTitle;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/MasterPageBase.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Data;\r\nusing Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    /// <summary>\r\n    /// Base class for ASP.NET MasterPage classes in C1 CMS. Inheriting from this bring common features like easy data and sitemap access. \r\n    /// This class is intended for use in shared MasterPages, to create a MasterPage based page template for C1 CMS use <see cref=\"Composite.Plugins.PageTemplates.MasterPages.MasterPagePageTemplate\"/>.\r\n    /// </summary>\r\n    public abstract class MasterPageBase : MasterPage\r\n    {\r\n        private DataConnection _dataConnection;\r\n\r\n        /// <summary>\r\n        /// Gets or sets the data connection.\r\n        /// </summary>\r\n        /// <value>\r\n        /// The data connection.\r\n        /// </value>\r\n        public DataConnection Data\r\n        {\r\n            get\r\n            {\r\n                if (_dataConnection == null)\r\n                {\r\n                    _dataConnection = new DataConnection();\r\n                }\r\n                return _dataConnection;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the sitemap navigator.\r\n        /// </summary>\r\n        public SitemapNavigator SitemapNavigator\r\n        {\r\n            get { return Data.SitemapNavigator; }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a Page Template Feature based on name.\r\n        /// </summary>\r\n        /// <param name=\"featureName\">Name of the Page Template Feature to return.</param>\r\n        /// <returns>The Page Template Feature as an ASP.NET Control</returns>\r\n        public Control GetPageTemplateFeature(string featureName)\r\n        {\r\n            var feature = new PageTemplateFeature();\r\n            feature.Name = featureName;\r\n            return feature;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public override void Dispose()\r\n        {\r\n            if (_dataConnection != null)\r\n            {\r\n                _dataConnection.Dispose();\r\n                _dataConnection = null;\r\n            }\r\n\r\n            base.Dispose();\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~MasterPageBase()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/MasterPagePageRenderer.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing System.Xml.Linq;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    internal class MasterPagePageRenderer: IPageRenderer\r\n    {\r\n        private static readonly string PageRenderingJob_Key = \"MasterPages.PageRenderingJob\";\r\n\r\n        private readonly Hashtable<Guid, MasterPageRenderingInfo> _renderingInfo;\r\n        private readonly Hashtable<Guid, Exception> _loadingExceptions;\r\n\r\n        public MasterPagePageRenderer(\r\n            Hashtable<Guid, MasterPageRenderingInfo> renderingInfo,\r\n            Hashtable<Guid, Exception> loadingExceptions)\r\n        {\r\n            Verify.ArgumentNotNull(renderingInfo, \"renderingInfo\");\r\n\r\n            _renderingInfo = renderingInfo;\r\n            _loadingExceptions = loadingExceptions;\r\n        }\r\n\r\n        public void AttachToPage(Page aspnetPage, PageContentToRender contentToRender)\r\n        {\r\n            Verify.ArgumentNotNull(aspnetPage, \"aspnetPage\");\r\n            Verify.ArgumentNotNull(contentToRender, \"contentToRender\");\r\n\r\n            aspnetPage.Items.Add(PageRenderingJob_Key, contentToRender);\r\n\r\n            Guid templateId = contentToRender.Page.TemplateId;\r\n            var rendering = _renderingInfo[templateId];\r\n\r\n            if(rendering == null)\r\n            {\r\n                Exception loadingException = _loadingExceptions[templateId];\r\n                if(loadingException != null)\r\n                {\r\n                    throw loadingException;\r\n                }\r\n\r\n                Verify.ThrowInvalidOperationException(\"Failed to get master page by template ID '{0}'. Check for compilation errors\".FormatWith(templateId));\r\n            }\r\n\r\n            aspnetPage.MasterPageFile = rendering.VirtualPath;\r\n            aspnetPage.PreRender += (e, args) => PageOnPreRender(aspnetPage, contentToRender.Page);\r\n\r\n            var master = aspnetPage.Master as MasterPagePageTemplate;\r\n            TemplateDefinitionHelper.BindPlaceholders(master, contentToRender, rendering.PlaceholderProperties, null);\r\n        }\r\n\r\n        private void PageOnPreRender(Page aspnetPage, IPage page)\r\n        {\r\n            bool emitMenuTitleMetaTag = !page.MenuTitle.IsNullOrEmpty();\r\n            bool emitUrlTitleMetaTag = !page.UrlTitle.IsNullOrEmpty();\r\n\r\n            if ((emitMenuTitleMetaTag || emitUrlTitleMetaTag)\r\n                && UserValidationFacade.IsLoggedIn())\r\n            {\r\n                var xhtmlDocument = new XhtmlDocument();\r\n\r\n                PageRenderer.AppendC1MetaTags(page, xhtmlDocument);\r\n\r\n\r\n                if (aspnetPage.Header != null)\r\n                {\r\n                    string xml = string.Join(string.Empty, xhtmlDocument.Head.Nodes().Select(node => node.ToString()));\r\n\r\n                    aspnetPage.Header.Controls.Add(new Literal {Text = xml});\r\n                }\r\n            }\r\n        }\r\n\r\n        public static PageContentToRender GetRenderingInfo(Page page)\r\n        {\r\n            return page.Items[PageRenderingJob_Key] as PageContentToRender;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/MasterPagePageTemplate.cs",
    "content": "﻿using System;\r\nusing Composite.Core.PageTemplates;\r\n\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    /// <summary>\r\n    /// Base master page\r\n    /// </summary>\r\n    public abstract class MasterPagePageTemplate : MasterPageBase, IPageTemplate\r\n    {\r\n        /// <summary>\r\n        /// Gets the template id.\r\n        /// </summary>\r\n        public abstract Guid TemplateId { get; }\r\n\r\n        /// <summary>\r\n        /// Gets the template title.\r\n        /// </summary>\r\n        public virtual string TemplateTitle\r\n        {\r\n            get { return null; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/MasterPagePageTemplateDescriptor.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_MasterPagePageTemplate;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    internal class MasterPagePageTemplateDescriptor : PageTemplateDescriptor\r\n    {\r\n        private static readonly PermissionType[] _editWebsiteFilePermissionTypes = new[] { PermissionType.Edit };\r\n\r\n        private static readonly ResourceHandle EditTemplateIcon = new ResourceHandle(BuildInIconProviderName.ProviderName, \"page-template-edit\");\r\n        public static ResourceHandle DeleteTemplateIcon { get { return PageTemplateElementProvider.GetIconHandle(\"page-template-delete\"); } }\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n\r\n        private readonly string _filePath;\r\n        private readonly string _codeBehindFilePath;\r\n\r\n        public MasterPagePageTemplateDescriptor(string filePath, string codeBehindFilePath)\r\n        {\r\n            Verify.ArgumentNotNull(filePath, \"filePath\");\r\n\r\n            _filePath = filePath;\r\n            _codeBehindFilePath = codeBehindFilePath;\r\n        }\r\n\r\n        public string FilePath { get { return _filePath; } }\r\n\r\n        public string CodeBehindFilePath { get { return _codeBehindFilePath; } }\r\n\r\n        public string[] GetFiles()\r\n        {\r\n            var result = new List<string>();\r\n            result.Add(FilePath);\r\n\r\n            if(CodeBehindFilePath != null)\r\n            {\r\n                result.Add(CodeBehindFilePath);\r\n            }\r\n\r\n            return result.ToArray();\r\n        }\r\n\r\n        public override IEnumerable<C1Console.Elements.ElementAction> GetActions()\r\n        {\r\n            var result = new List<ElementAction>();\r\n\r\n            Type workflowType = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.EditMasterPageWorkflow\");\r\n\r\n            result.Add(new ElementAction(new ActionHandle(new WorkflowActionToken(\r\n                workflowType,\r\n                _editWebsiteFilePermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = Texts.EditMasterPageAction_Label,\r\n                    ToolTip = Texts.EditMasterPageAction_ToolTip,\r\n                    Icon = EditTemplateIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            workflowType = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.DeletePageTemplateWorkflow\");\r\n\r\n            result.Add(new ElementAction(new ActionHandle(new WorkflowActionToken(workflowType, new[] { PermissionType.Delete })))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = Texts.DeleteMasterPageAction_Label,\r\n                    ToolTip = Texts.DeleteMasterPageAction_ToolTip,\r\n                    Icon = DeleteTemplateIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Delete,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            return result;\r\n        }\r\n    }\r\n\r\n    internal class LazyInitializedMasterPagePageTemplateDescriptor: MasterPagePageTemplateDescriptor\r\n    {\r\n        private readonly MasterPagePageTemplateProvider _provider;\r\n\r\n        private bool _initialized;\r\n\r\n        public LazyInitializedMasterPagePageTemplateDescriptor(string filePath, string codeBehindFilePath, Guid templateId, string templateTitle, MasterPagePageTemplateProvider provider)\r\n            :base(filePath, codeBehindFilePath)\r\n        {\r\n            Id = templateId;\r\n            Title = templateTitle;\r\n            _provider = provider;\r\n        }\r\n\r\n        private void EnsureInitialize()\r\n        {\r\n            if (!_initialized)\r\n            {\r\n                lock (this)\r\n                {\r\n                    if (!_initialized)\r\n                    {\r\n                        Initialize();\r\n\r\n                        _initialized = true;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private void Initialize()\r\n        {\r\n            MasterPage masterPage;\r\n            MasterPagePageTemplateDescriptor parsedPageTemplateDescriptor;\r\n            MasterPageRenderingInfo renderingInfo;\r\n            Exception loadingException;\r\n\r\n            if (!_provider.LoadMasterPage(\r\n                FilePath,\r\n                out masterPage,\r\n                out parsedPageTemplateDescriptor,\r\n                out renderingInfo,\r\n                out loadingException))\r\n            {\r\n                this.LoadingException = loadingException;\r\n                return;\r\n            }\r\n\r\n            Verify.IsNotNull(masterPage, \"Failed to compile master page file '{0}'\", FilePath);\r\n            Verify.That(masterPage is MasterPagePageTemplate, \"Incorrect base class. '{0}'\", FilePath);\r\n\r\n            \r\n            this.DefaultPlaceholderId = parsedPageTemplateDescriptor.DefaultPlaceholderId;\r\n            this.PlaceholderDescriptions = parsedPageTemplateDescriptor.PlaceholderDescriptions;\r\n        }\r\n\r\n        public override IEnumerable<PlaceholderDescriptor> PlaceholderDescriptions\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialize();\r\n\r\n                return base.PlaceholderDescriptions;\r\n            }\r\n            set\r\n            {\r\n                base.PlaceholderDescriptions = value;\r\n            }\r\n        }\r\n\r\n        public override string DefaultPlaceholderId\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialize();\r\n\r\n                return base.DefaultPlaceholderId;\r\n            }\r\n            set\r\n            {\r\n                base.DefaultPlaceholderId = value;\r\n            }\r\n        }\r\n\r\n        public override Exception LoadingException\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialize();\r\n\r\n                return base.LoadingException;\r\n            }\r\n            set\r\n            {\r\n                base.LoadingException = value;\r\n            }\r\n        }\r\n\r\n        public override bool IsValid\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialize();\r\n\r\n                return base.IsValid;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/MasterPagePageTemplateProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Web.Hosting;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Services.WysiwygEditor;\r\nusing Composite.Plugins.PageTemplates.Common;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    [ConfigurationElementType(typeof(MasterPagePageTemplateProviderData))]\r\n    internal class MasterPagePageTemplateProvider : IPageTemplateProvider, ISharedCodePageTemplateProvider\r\n    {\r\n        private static readonly string LogTitle = typeof (MasterPagePageTemplateProvider).FullName;\r\n\r\n        private static readonly FileRelatedDataCache<CachedTemplateInformation> _templateCache =\r\n            new FileRelatedDataCache<CachedTemplateInformation>(\"Templates\", \"masterPage\",\r\n                                                                CachedTemplateInformation.SerializeToFile,\r\n                                                                CachedTemplateInformation.DeserializeFromFile); \r\n\r\n        internal static readonly string TempFilePrefix = \"_temp_\";\r\n        private static readonly string MasterPageFileMask = \"*.master\";\r\n        private static readonly string FileWatcherMask = \"*.master*\";\r\n        private static readonly string FileWatcher_Regex = @\"\\.cs|\\.master\";\r\n\r\n        private readonly string _providerName;\r\n        private readonly string _templatesDirectoryVirtualPath;\r\n        private readonly string _templatesDirectory;\r\n\r\n        private volatile State _state;\r\n\r\n        private readonly object _initializationLock = new object();\r\n        private readonly C1FileSystemWatcher _watcher;\r\n\r\n        public string AddNewTemplateLabel\r\n        {\r\n            get; private set;\r\n        }\r\n\r\n        public Type AddNewTemplateWorkflow\r\n        {\r\n            get; private set;\r\n        }\r\n\r\n        public MasterPagePageTemplateProvider(string name, string templatesDirectoryVirtualPath, string addNewTemplateLabel, Type addNewTemplateWorkflow)\r\n        {\r\n            _providerName = name;\r\n            _templatesDirectoryVirtualPath = templatesDirectoryVirtualPath;\r\n            _templatesDirectory = PathUtil.Resolve(_templatesDirectoryVirtualPath);\r\n\r\n            AddNewTemplateLabel = addNewTemplateLabel;\r\n            AddNewTemplateWorkflow = addNewTemplateWorkflow;\r\n\r\n            Verify.That(C1Directory.Exists(_templatesDirectory), \"Folder '{0}' does not exist\", _templatesDirectory);\r\n\r\n            string folderToWatch = _templatesDirectory;\r\n\r\n            try\r\n            {\r\n                if (ReparsePointUtils.DirectoryIsReparsePoint(folderToWatch))\r\n                {\r\n                    folderToWatch = ReparsePointUtils.GetDirectoryReparsePointTarget(folderToWatch);\r\n                }\r\n\r\n                _watcher = new C1FileSystemWatcher(folderToWatch, FileWatcherMask)\r\n                {\r\n                    IncludeSubdirectories = true\r\n                };\r\n\r\n                _watcher.Created += Watcher_OnChanged;\r\n                _watcher.Deleted += Watcher_OnChanged;\r\n                _watcher.Changed += Watcher_OnChanged;\r\n                _watcher.Renamed += Watcher_OnChanged;\r\n\r\n                _watcher.EnableRaisingEvents = true;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogWarning(LogTitle, \"Failed to create a file system watcher for directory '{0}'. Provider: {1}\", folderToWatch, name);\r\n                Log.LogWarning(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n        public IEnumerable<PageTemplateDescriptor> GetPageTemplates()\r\n        {\r\n            return GetInitializedState().Templates;\r\n        }\r\n\r\n        public IPageRenderer BuildPageRenderer(Guid templateId)\r\n        {\r\n            var state = GetInitializedState();\r\n\r\n            return new MasterPagePageRenderer(state.RenderingInfo, state.LoadingExceptions);\r\n        }\r\n\r\n        public IEnumerable<ElementAction> GetRootActions()\r\n        {\r\n            return new ElementAction[0];\r\n        }\r\n\r\n\r\n        public IEnumerable<SharedFile> GetSharedFiles()\r\n        {\r\n            var state = GetInitializedState();\r\n\r\n            return state.SharedSourceFiles;\r\n        }\r\n\r\n        private State GetInitializedState()\r\n        {\r\n            var state = _state;\r\n            if(state != null)\r\n            {\r\n                return state;\r\n            }\r\n\r\n            lock (_initializationLock)\r\n            {\r\n                state = _state;\r\n                if (state == null)\r\n                {\r\n                    _state = state = Initialize();\r\n                }\r\n            }\r\n\r\n            return state;\r\n        }\r\n\r\n        private State Initialize()\r\n        {\r\n            var files = new C1DirectoryInfo(_templatesDirectory)\r\n                           .GetFiles(MasterPageFileMask, SearchOption.AllDirectories)\r\n                           .Where(f => !f.Name.StartsWith(TempFilePrefix, StringComparison.Ordinal));\r\n\r\n\r\n            var templates = new List<PageTemplateDescriptor>();\r\n            var templateRenderingData = new Hashtable<Guid, MasterPageRenderingInfo>();\r\n            var loadingExceptions = new Hashtable<Guid, Exception>();\r\n            var sharedSourceFiles = new List<SharedFile>();\r\n\r\n            // Loading and compiling layout controls\r\n            foreach (var fileInfo in files)\r\n            {\r\n                string filePath = fileInfo.FullName;\r\n                string virtualPath = ConvertToVirtualPath(filePath);\r\n                string codeBehindFilePath = GetCodebehindFilePath(filePath);\r\n\r\n                string[] cacheRelatedFiles = { filePath, codeBehindFilePath };\r\n\r\n                CachedTemplateInformation cachedTemplateInformation;\r\n\r\n                if (_templateCache.Get(virtualPath, cacheRelatedFiles, out cachedTemplateInformation))\r\n                {\r\n                    if (cachedTemplateInformation == null)\r\n                    {\r\n                        sharedSourceFiles.Add(new SharedMasterPage(virtualPath));\r\n                        continue;\r\n                    }\r\n\r\n                    Guid templateId = cachedTemplateInformation.TemplateId;\r\n\r\n                    templates.Add(new LazyInitializedMasterPagePageTemplateDescriptor(\r\n                        filePath, \r\n                        codeBehindFilePath, \r\n                        templateId,\r\n                        cachedTemplateInformation.Title,\r\n                        this));\r\n\r\n                    Verify.That(!templateRenderingData.ContainsKey(templateId), \"Multiple master page templates defined with the same ID '{0}'\", templateId);\r\n                \r\n                    templateRenderingData.Add(templateId, new LazyInitializedMasterPageRenderingInfo(filePath, virtualPath, this));\r\n                    continue;\r\n                }\r\n                \r\n                MasterPage masterPage;\r\n                MasterPagePageTemplateDescriptor parsedPageTemplateDescriptor;\r\n                MasterPageRenderingInfo renderingInfo;\r\n                Exception loadingException;\r\n\r\n                if (!LoadMasterPage(filePath, out masterPage, out parsedPageTemplateDescriptor, out renderingInfo, out loadingException))\r\n                {\r\n                    var brokenTemplate = GetIncorrectlyLoadedPageTemplate(filePath, loadingException);\r\n\r\n                    loadingExceptions.Add(brokenTemplate.Id, brokenTemplate.LoadingException);\r\n                    templates.Add(brokenTemplate);\r\n                    continue;\r\n                }\r\n\r\n                if (masterPage == null)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                if (!(masterPage is MasterPagePageTemplate))\r\n                {\r\n                    sharedSourceFiles.Add(new SharedMasterPage(virtualPath));\r\n\r\n                    if (!HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                    {\r\n                        _templateCache.Add(virtualPath, cacheRelatedFiles, null);\r\n                    }\r\n                    \r\n                    continue;\r\n                }\r\n\r\n                templates.Add(parsedPageTemplateDescriptor);\r\n\r\n                Verify.That(!templateRenderingData.ContainsKey(parsedPageTemplateDescriptor.Id), \r\n                    \"Multiple master page templates defined with the same ID '{0}'\", parsedPageTemplateDescriptor.Id);\r\n                \r\n                templateRenderingData.Add(parsedPageTemplateDescriptor.Id, renderingInfo);\r\n\r\n\r\n                _templateCache.Add(virtualPath, cacheRelatedFiles, new CachedTemplateInformation(parsedPageTemplateDescriptor));\r\n            }\r\n\r\n            return new State {\r\n                Templates = templates,\r\n                RenderingInfo = templateRenderingData,\r\n                LoadingExceptions = loadingExceptions,\r\n                SharedSourceFiles = sharedSourceFiles\r\n            };\r\n        }\r\n\r\n        /// <summary>\r\n        /// Compiles masters page and builds a <see cref=\"PageTemplateDescriptor\" />.\r\n        /// Returns <value>True</value> if there's no compilation errors\r\n        /// </summary>\r\n        /// <param name=\"filePath\">The file path.</param>\r\n        /// <param name=\"masterPage\">The master page.</param>\r\n        /// <param name=\"pageTemplateDescriptor\">The page template descriptor.</param>\r\n        /// <param name=\"renderingInfo\">The rendering info.</param>\r\n        /// <param name=\"loadingException\">The loading exception.</param>\r\n        /// <returns></returns>\r\n        internal bool LoadMasterPage(\r\n            string filePath,\r\n            out MasterPage masterPage,\r\n            out MasterPagePageTemplateDescriptor pageTemplateDescriptor,\r\n            out MasterPageRenderingInfo renderingInfo,\r\n            out Exception loadingException)\r\n        {\r\n            string virtualPath = ConvertToVirtualPath(filePath);\r\n\r\n            try\r\n            {\r\n                masterPage = CompilationHelper.CompileMasterPage(virtualPath);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, \"Failed to compile master page file '{0}'\", virtualPath);\r\n                Log.LogError(LogTitle, ex);\r\n\r\n                loadingException = ex is TargetInvocationException ? ex.InnerException : ex;\r\n                masterPage = null;\r\n                pageTemplateDescriptor = null;\r\n                renderingInfo = null;\r\n                return false;\r\n            }\r\n\r\n            if (!(masterPage is MasterPagePageTemplate))\r\n            {\r\n                pageTemplateDescriptor = null;\r\n                renderingInfo = null;\r\n                loadingException = null;\r\n                return true;\r\n            }\r\n\r\n            try\r\n            {\r\n                ParseTemplate(virtualPath,\r\n                                filePath,\r\n                                masterPage as MasterPagePageTemplate,\r\n                                out pageTemplateDescriptor,\r\n                                out renderingInfo);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, \"Failed to load master page template file '{0}'\", virtualPath);\r\n                Log.LogError(LogTitle, ex);\r\n\r\n                loadingException = ex;\r\n                pageTemplateDescriptor = null;\r\n                renderingInfo = null;\r\n                return false;\r\n            }\r\n\r\n            loadingException = null;\r\n            return true;\r\n        }\r\n\r\n\r\n        private static Guid GetMD5Hash(string text)\r\n        {\r\n            using (MD5 md5 = MD5.Create())\r\n            {\r\n                byte[] hash = md5.ComputeHash(Encoding.Unicode.GetBytes(text));\r\n                return new Guid(hash);\r\n            }\r\n        }\r\n\r\n\r\n        private PageTemplateDescriptor GetIncorrectlyLoadedPageTemplate(string filePath, Exception loadingException)\r\n        {\r\n            string codeBehindFile = GetCodebehindFilePath(filePath);\r\n            \r\n            Guid templateId;\r\n            \r\n            string idTokenBegin = \"Guid TemplateId { get { return new Guid(\\\"\";\r\n            string idTokenEnd = \"\\\"); } }\";\r\n\r\n            if(!TemplateParsingHelper.TryExtractTemplateIdFromCSharpCode(codeBehindFile, out templateId, idTokenBegin, idTokenEnd))\r\n            {\r\n                templateId = GetMD5Hash(filePath.ToLowerInvariant());\r\n            }\r\n            \r\n            return new MasterPagePageTemplateDescriptor(filePath, codeBehindFile)\r\n                {\r\n                    Id = templateId,\r\n                    Title = Path.GetFileName(filePath),\r\n                    LoadingException = loadingException\r\n                };\r\n        }\r\n\r\n\r\n        internal static string GetCodebehindFilePath(string masterFilePath)\r\n        {\r\n            string csFile = masterFilePath + \".cs\";\r\n            return C1File.Exists(csFile) ? csFile : null;\r\n        }\r\n\r\n        internal static void ParseTemplate(string virtualPath, \r\n                                           string filePath, \r\n                                           MasterPagePageTemplate masterPage,\r\n                                           out MasterPagePageTemplateDescriptor pageTemplateDescriptor,\r\n                                           out MasterPageRenderingInfo renderingInfo)\r\n        {\r\n            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath);\r\n\r\n            string csFile = GetCodebehindFilePath(filePath);\r\n\r\n            IDictionary<string, PropertyInfo> placeholderProperties;\r\n            Func<MasterPagePageTemplateDescriptor> constructor = () => new MasterPagePageTemplateDescriptor(filePath, csFile);\r\n\r\n            pageTemplateDescriptor = TemplateDefinitionHelper.BuildPageTemplateDescriptor(masterPage, constructor, out placeholderProperties);\r\n\r\n            if (pageTemplateDescriptor.Title == null)\r\n            {\r\n                pageTemplateDescriptor.Title = fileNameWithoutExtension;\r\n            }\r\n\r\n            renderingInfo = new MasterPageRenderingInfo(virtualPath, placeholderProperties);\r\n        }\r\n\r\n        public string ConvertToVirtualPath(string filePath)\r\n        {\r\n            return UrlUtils.Combine(_templatesDirectoryVirtualPath, filePath.Substring(_templatesDirectory.Length).Replace('\\\\', '/'));\r\n        }\r\n\r\n        private void Watcher_OnChanged(object sender, FileSystemEventArgs e)\r\n        {\r\n            // Ignoring changes to files, not related to master pages, and temporary files\r\n            if (e.Name.StartsWith(TempFilePrefix)\r\n                || !Regex.IsMatch(e.Name, FileWatcher_Regex, RegexOptions.IgnoreCase))\r\n            {\r\n                return;\r\n            }\r\n\r\n            PageTemplateProviderRegistry.FlushTemplates();\r\n            PageTemplatePreview.ClearCache();\r\n        }\r\n\r\n        public void FlushTemplates()\r\n        {\r\n            _state = null;\r\n        }\r\n\r\n        public string TemplateDirectoryPath\r\n        {\r\n            get { return _templatesDirectory; }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Immutable state - loaded page templates\r\n        /// </summary>\r\n        private class State\r\n        {\r\n            public List<PageTemplateDescriptor> Templates;\r\n            public Hashtable<Guid, MasterPageRenderingInfo> RenderingInfo;\r\n            public Hashtable<Guid, Exception> LoadingExceptions;\r\n            public List<SharedFile> SharedSourceFiles;   \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/MasterPagePageTemplateProviderData.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Plugins;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    [Assembler(typeof(MasterPagePageTemplateProviderAssembler))]\r\n    internal class MasterPagePageTemplateProviderData : PageTemplateProviderData\r\n    {\r\n        [ConfigurationProperty(\"directory\", IsRequired = false, DefaultValue = \"~/App_Data/Razor/PageTemplates\")]\r\n        public string Directory\r\n        {\r\n            get { return (string)base[\"directory\"]; }\r\n            set { base[\"directory\"] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(\"addNewTemplateLabel\", IsRequired = false, DefaultValue = null)]\r\n        public string AddNewTemplateLabel\r\n        {\r\n            get { return (string)base[\"addNewTemplateLabel\"]; }\r\n            set { base[\"addNewTemplateLabel\"] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(\"addNewTemplateWorkflow\", IsRequired = false, DefaultValue = null)]\r\n        public string AddNewTemplateWorkflow\r\n        {\r\n            get { return (string)base[\"addNewTemplateWorkflow\"]; }\r\n            set { base[\"addNewTemplateWorkflow\"] = value; }\r\n        }\r\n    }\r\n\r\n    internal class MasterPagePageTemplateProviderAssembler : IAssembler<IPageTemplateProvider, PageTemplateProviderData>\r\n    {\r\n        public IPageTemplateProvider Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, PageTemplateProviderData objectConfiguration, Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var data = objectConfiguration as MasterPagePageTemplateProviderData;\r\n            if (data == null)\r\n            {\r\n                throw new ArgumentException(\"Expected configuration to be of type \" + typeof(MasterPagePageTemplateProviderAssembler).Name,\r\n                                            \"objectConfiguration\");\r\n            }\r\n\r\n            Type addNewTemplateWorkflow = null;\r\n\r\n            if (!string.IsNullOrEmpty(data.AddNewTemplateWorkflow))\r\n            {\r\n                try\r\n                {\r\n                    addNewTemplateWorkflow = TypeManager.GetType(data.AddNewTemplateWorkflow);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(this.GetType().FullName, ex);\r\n                }\r\n            }\r\n\r\n            string folderPath = PathUtil.Resolve(data.Directory);\r\n\r\n            if (!C1Directory.Exists(folderPath))\r\n            {\r\n                throw new ConfigurationErrorsException(\"Folder '{0}' does not exists\".FormatWith(folderPath),\r\n                    objectConfiguration.ElementInformation.Source, objectConfiguration.ElementInformation.LineNumber);\r\n            }\r\n\r\n            return new MasterPagePageTemplateProvider(data.Name, data.Directory, data.AddNewTemplateLabel, addNewTemplateWorkflow);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/MasterPageRenderingInfo.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Web.UI;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    internal class MasterPageRenderingInfo\r\n    {\r\n        public MasterPageRenderingInfo(string virtualPath, IDictionary<string, PropertyInfo> placeholderProperties)\r\n        {\r\n            VirtualPath = virtualPath;\r\n            PlaceholderProperties = placeholderProperties;\r\n        }\r\n\r\n        public string VirtualPath { get; private set; }\r\n\r\n        public virtual IDictionary<string, PropertyInfo> PlaceholderProperties { get; private set; }\r\n    }\r\n\r\n    internal class LazyInitializedMasterPageRenderingInfo : MasterPageRenderingInfo\r\n    {\r\n        private IDictionary<string, PropertyInfo> _placeholderProperties;\r\n        private readonly MasterPagePageTemplateProvider _provider;\r\n        private readonly string _filePath;\r\n\r\n        public LazyInitializedMasterPageRenderingInfo(string filePath, string virtualPath, MasterPagePageTemplateProvider provider)\r\n            : base(virtualPath, null)\r\n        {\r\n            _filePath = filePath;\r\n            _provider = provider;\r\n        }\r\n\r\n        public override IDictionary<string, PropertyInfo> PlaceholderProperties\r\n        {\r\n            get\r\n            {\r\n                if (_placeholderProperties == null)\r\n                {\r\n                    lock (this)\r\n                    {\r\n                        if (_placeholderProperties == null)\r\n                        {\r\n                            _placeholderProperties = InitializePlaceholderProperties();\r\n                        }\r\n                    }\r\n                }\r\n                return _placeholderProperties;\r\n            }\r\n        }\r\n\r\n        private IDictionary<string, PropertyInfo> InitializePlaceholderProperties()\r\n        {\r\n            MasterPage masterPage;\r\n            MasterPagePageTemplateDescriptor parsedPageTemplateDescriptor;\r\n            MasterPageRenderingInfo renderingInfo;\r\n            Exception loadingException;\r\n\r\n            if (!_provider.LoadMasterPage(\r\n                _filePath,\r\n                out masterPage,\r\n                out parsedPageTemplateDescriptor,\r\n                out renderingInfo,\r\n                out loadingException))\r\n            {\r\n                throw loadingException;\r\n            }\r\n\r\n            Verify.IsNotNull(masterPage, \"Failed to compile master page file '{0}'\", _filePath);\r\n            Verify.That(masterPage is MasterPagePageTemplate, \"Incorrect base class. '{0}'\", _filePath);\r\n\r\n            return renderingInfo.PlaceholderProperties;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/MasterPages/SharedMasterPage.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\n\r\nnamespace Composite.Plugins.PageTemplates.MasterPages\r\n{\r\n    internal class SharedMasterPage: SharedFile\r\n    {\r\n        private static readonly PermissionType[] _editWebsiteFilePermissionTypes = new[] { PermissionType.Edit };\r\n\r\n        private static readonly ResourceHandle EditTemplateIcon = new ResourceHandle(BuildInIconProviderName.ProviderName, \"page-template-edit\");\r\n        private static readonly ActionGroup PrimaryFileActionGroup = new ActionGroup(\"File\", ActionGroupPriority.PrimaryMedium);\r\n\r\n\r\n        public SharedMasterPage(string virtualFilePath)\r\n            : base(virtualFilePath)\r\n        {\r\n            this.DefaultEditAction = false;\r\n        }\r\n\r\n        public override IEnumerable<C1Console.Elements.ElementAction> GetActions()\r\n        {\r\n            return new[] {\r\n            new ElementAction(new ActionHandle(new WorkflowActionToken(\r\n                WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.EditMasterPageWorkflow\"),\r\n                _editWebsiteFilePermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = GetText(\"EditMasterPageAction.Label\"),\r\n                    ToolTip = GetText(\"EditMasterPageAction.ToolTip\"),\r\n                    Icon = EditTemplateIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryFileActionGroup\r\n                    }\r\n                }\r\n            }};\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.MasterPagePageTemplate\", stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Razor/RazorPageRenderer.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.WebPages;\r\nusing System.Xml.Linq;\r\nusing Composite.AspNet.Razor;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Razor\r\n{\r\n    internal class RazorPageRenderer : IPageRenderer, ISlimPageRenderer\r\n    {\r\n        private readonly Hashtable<Guid, TemplateRenderingInfo> _renderingInfo;\r\n        private readonly Hashtable<Guid, Exception> _loadingExceptions;\r\n\r\n        public RazorPageRenderer(\r\n            Hashtable<Guid, TemplateRenderingInfo> renderingInfo,\r\n            Hashtable<Guid, Exception> loadingExceptions)\r\n        {\r\n            _renderingInfo = renderingInfo;\r\n            _loadingExceptions = loadingExceptions;\r\n        }\r\n\r\n        private Page _aspnetPage;\r\n        private PageContentToRender _job;\r\n\r\n        public void AttachToPage(Page renderTarget, PageContentToRender contentToRender)\r\n        {\r\n            _aspnetPage = renderTarget;\r\n            _job = contentToRender;\r\n\r\n            _aspnetPage.Init += RendererPage;\r\n        }\r\n\r\n        public XDocument Render(PageContentToRender contentToRender, FunctionContextContainer functionContextContainer)\r\n        {\r\n            Guid templateId = contentToRender.Page.TemplateId;\r\n            var renderingInfo = _renderingInfo[templateId];\r\n\r\n            if (renderingInfo == null)\r\n            {\r\n                Exception loadingException = _loadingExceptions[templateId];\r\n                if (loadingException != null)\r\n                {\r\n                    throw loadingException;\r\n                }\r\n\r\n                Verify.ThrowInvalidOperationException($\"Missing template '{templateId}'\");\r\n            }\r\n\r\n            string output;\r\n\r\n            RazorPageTemplate webPage = null;\r\n            try\r\n            {\r\n                webPage = WebPageBase.CreateInstanceFromVirtualPath(renderingInfo.ControlVirtualPath) as RazorPageTemplate;\r\n                Verify.IsNotNull(webPage, \"Razor compilation failed or base type does not inherit '{0}'\",\r\n                    typeof(RazorPageTemplate).FullName);\r\n\r\n                webPage.Configure();\r\n\r\n                using (Profiler.Measure(\"Evaluating placeholders\"))\r\n                {\r\n                    TemplateDefinitionHelper.BindPlaceholders(webPage, contentToRender, renderingInfo.PlaceholderProperties,\r\n                        functionContextContainer);\r\n                }\r\n\r\n                // Executing razor code\r\n                var httpContext = new HttpContextWrapper(HttpContext.Current);\r\n                var startPage = StartPage.GetStartPage(webPage, \"_PageStart\", new[] { \"cshtml\" });\r\n                var pageContext = new WebPageContext(httpContext, webPage, startPage);\r\n                pageContext.PageData.Add(RazorHelper.PageContext_FunctionContextContainer, functionContextContainer);\r\n\r\n                var sb = new StringBuilder();\r\n                using (var writer = new StringWriter(sb))\r\n                {\r\n                    using (Profiler.Measure(\"Executing Razor page template\"))\r\n                    {\r\n                        webPage.ExecutePageHierarchy(pageContext, writer);\r\n                    }\r\n                }\r\n\r\n                output = sb.ToString();\r\n            }\r\n            finally\r\n            {\r\n                webPage?.Dispose();\r\n            }\r\n\r\n            return XDocument.Parse(output);\r\n        }\r\n\r\n        private void RendererPage(object sender, EventArgs e)\r\n        {\r\n            var functionContextContainer = PageRenderer.GetPageRenderFunctionContextContainer();\r\n\r\n            var resultDocument = Render(_job, functionContextContainer);\r\n\r\n            var controlMapper = (IXElementToControlMapper)functionContextContainer.XEmbedableMapper;\r\n            Control control;\r\n\r\n            using (Profiler.Measure(\"Rendering the page\"))\r\n            {\r\n                control = PageRenderer.Render(resultDocument, functionContextContainer, controlMapper, _job.Page);\r\n            }\r\n\r\n            using (Profiler.Measure(\"ASP.NET controls: PagePreInit\"))\r\n            {\r\n                _aspnetPage.Controls.Add(control);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Razor/RazorPageTemplateDescriptor.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Web.WebPages;\r\nusing Composite.AspNet.Razor;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\nusing Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider;\r\nusing SR = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Razor\r\n{\r\n    internal class RazorPageTemplateDescriptor: PageTemplateDescriptor\r\n    {\r\n        private static readonly PermissionType[] _editWebsiteFilePermissionTypes = new [] { PermissionType.Edit };\r\n\r\n        private static readonly ResourceHandle EditTemplateIcon = new ResourceHandle(BuildInIconProviderName.ProviderName, \"page-template-edit\");\r\n        public static ResourceHandle DeleteTemplateIcon { get { return PageTemplateElementProvider.GetIconHandle(\"page-template-delete\"); } }\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        private readonly string _virtualPath;\r\n\r\n        public RazorPageTemplateDescriptor(string virtualPath)\r\n        {\r\n            _virtualPath = virtualPath;\r\n        }\r\n\r\n        public string VirtualPath { get { return _virtualPath; } }\r\n\r\n        public override IEnumerable<ElementAction> GetActions()\r\n        {\r\n            var result = new List<ElementAction>();\r\n\r\n            Type workflowType = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.EditRazorPageTemplateWorkflow\");\r\n\r\n            result.Add(new ElementAction(new ActionHandle(new WorkflowActionToken(\r\n                workflowType,\r\n                _editWebsiteFilePermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = GetText(\"EditRazorTemplateAction.Label\"),\r\n                    ToolTip = GetText( \"EditRazorTemplateAction.ToolTip\"),\r\n                    Icon = EditTemplateIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            workflowType = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.DeletePageTemplateWorkflow\");\r\n\r\n            result.Add(new ElementAction(new ActionHandle(new WorkflowActionToken(workflowType, new[] { PermissionType.Delete })))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = GetText(\"DeleteRazorPageTemplateAction.Label\"),\r\n                    ToolTip = GetText(\"DeleteRazorPageTemplateAction.ToolTip\"),\r\n                    Icon = DeleteTemplateIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Delete,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            return result;\r\n        }\r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorPageTemplate\", stringId);\r\n        }\r\n    }\r\n\r\n    internal class LazyInitializedRazorPageTemplateDescriptor : RazorPageTemplateDescriptor\r\n    {\r\n                private readonly RazorPageTemplateProvider _provider;\r\n\r\n        private bool _initialized;\r\n\r\n        public LazyInitializedRazorPageTemplateDescriptor(\r\n            string virtualPath, \r\n            Guid templateId, \r\n            string templateTitle, \r\n            RazorPageTemplateProvider provider)\r\n            : base(virtualPath)\r\n        {\r\n            Id = templateId;\r\n            Title = templateTitle;\r\n            _provider = provider;\r\n        }\r\n\r\n        private void EnsureInitialize()\r\n        {\r\n            if (!_initialized)\r\n            {\r\n                lock (this)\r\n                {\r\n                    if (!_initialized)\r\n                    {\r\n                        Initialize();\r\n\r\n                        _initialized = true;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private void Initialize()\r\n        {\r\n            WebPageBase webPage;\r\n            PageTemplateDescriptor parsedTemplate;\r\n            IDictionary<string, PropertyInfo> placeholderProperties;\r\n            Exception loadingException;\r\n\r\n            if (!_provider.LoadRazorTemplate(VirtualPath, out webPage, out parsedTemplate, out placeholderProperties, out loadingException))\r\n            {\r\n                LoadingException = loadingException;\r\n                _initialized = true;\r\n                throw loadingException;\r\n            }\r\n\r\n            Verify.IsNotNull(webPage, \"Failed to compile razor page template '{0}'\", VirtualPath);\r\n            Verify.That(webPage is RazorPageTemplate, \"Incorrect base class. '{0}'\", VirtualPath);\r\n\r\n\r\n            this.DefaultPlaceholderId = parsedTemplate.DefaultPlaceholderId;\r\n            this.PlaceholderDescriptions = parsedTemplate.PlaceholderDescriptions;\r\n        }\r\n\r\n        public override IEnumerable<PlaceholderDescriptor> PlaceholderDescriptions\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialize();\r\n\r\n                return base.PlaceholderDescriptions;\r\n            }\r\n            set\r\n            {\r\n                base.PlaceholderDescriptions = value;\r\n            }\r\n        }\r\n\r\n        public override string DefaultPlaceholderId\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialize();\r\n\r\n                return base.DefaultPlaceholderId;\r\n            }\r\n            set\r\n            {\r\n                base.DefaultPlaceholderId = value;\r\n            }\r\n        }\r\n\r\n        public override Exception LoadingException\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialize();\r\n\r\n                return base.LoadingException;\r\n            }\r\n            set\r\n            {\r\n                base.LoadingException = value;\r\n            }\r\n        }\r\n\r\n        public override bool IsValid\r\n        {\r\n            get\r\n            {\r\n                EnsureInitialize();\r\n\r\n                return base.IsValid;\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Razor/RazorPageTemplateProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Web.Hosting;\r\nusing System.Web.WebPages;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Services.WysiwygEditor;\r\nusing Composite.Plugins.PageTemplates.Common;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Composite.AspNet.Razor;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Razor\r\n{\r\n    [ConfigurationElementType(typeof(RazorPageTemplateProviderData))]\r\n    internal class RazorPageTemplateProvider : IPageTemplateProvider, ISharedCodePageTemplateProvider\r\n    {\r\n        private static readonly string LayoutFileMask = \"*.cshtml\";\r\n        private static readonly string LogTitle = typeof (RazorPageTemplateProvider).Name;\r\n        internal static readonly string TempFilePrefix = \"_temp_\";\r\n\r\n        private static readonly FileRelatedDataCache<CachedTemplateInformation> _templateCache =\r\n            new FileRelatedDataCache<CachedTemplateInformation>(\"Templates\", \"razorTemplate\",\r\n                                                                CachedTemplateInformation.SerializeToFile,\r\n                                                                CachedTemplateInformation.DeserializeFromFile); \r\n\r\n        private readonly string _providerName;  \r\n        private readonly string _templatesDirectory; \r\n        private readonly string _templatesDirectoryVirtualPath;\r\n        \r\n        private readonly object _initializationLock = new object();\r\n        private readonly C1FileSystemWatcher _watcher;\r\n\r\n        private volatile State _state;\r\n\r\n        private class State\r\n        {\r\n            public List<PageTemplateDescriptor> Templates;\r\n            public List<SharedFile> SharedFiles;\r\n            public Hashtable<Guid, TemplateRenderingInfo> RenderingInfo;\r\n            public Hashtable<Guid, Exception> LoadingExceptions;\r\n        }\r\n\r\n        public string AddNewTemplateLabel\r\n        {\r\n            get; private set;\r\n        }\r\n\r\n        public Type AddNewTemplateWorkflow\r\n        {\r\n            get; private set;\r\n        }\r\n\r\n        public RazorPageTemplateProvider(string providerName, string templatesDirectoryVirtualPath, string addNewTemplateLabel, Type addNewTemplateWorkflow)\r\n        {\r\n            _providerName = providerName;\r\n            _templatesDirectoryVirtualPath = templatesDirectoryVirtualPath;\r\n            _templatesDirectory = PathUtil.Resolve(templatesDirectoryVirtualPath);\r\n\r\n            AddNewTemplateLabel = addNewTemplateLabel;\r\n            AddNewTemplateWorkflow = addNewTemplateWorkflow;\r\n\r\n\r\n            string folderToWatch = _templatesDirectory;\r\n\r\n            try\r\n            {\r\n                if (ReparsePointUtils.DirectoryIsReparsePoint(folderToWatch))\r\n                {\r\n                    folderToWatch = ReparsePointUtils.GetDirectoryReparsePointTarget(folderToWatch);\r\n                }\r\n\r\n                _watcher = new C1FileSystemWatcher(folderToWatch, LayoutFileMask)\r\n                {\r\n                    IncludeSubdirectories = true\r\n                };\r\n\r\n                _watcher.Created += Watcher_OnChanged;\r\n                _watcher.Deleted += Watcher_OnChanged;\r\n                _watcher.Changed += Watcher_OnChanged;\r\n                _watcher.Renamed += Watcher_OnChanged;\r\n\r\n                _watcher.EnableRaisingEvents = true;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogWarning(LogTitle, \"Failed to create a file system watcher for directory '{0}'. Provider: {1}\", folderToWatch, providerName);\r\n                Log.LogWarning(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n        public IPageRenderer BuildPageRenderer(Guid templateId)\r\n        {\r\n            var state = GetInitializedState();\r\n\r\n            return new RazorPageRenderer(state.RenderingInfo, state.LoadingExceptions);\r\n        }\r\n\r\n        public IEnumerable<PageTemplateDescriptor> GetPageTemplates()\r\n        {\r\n            return GetInitializedState().Templates;\r\n        }\r\n\r\n        private State GetInitializedState()\r\n        {\r\n            var state = _state;\r\n\r\n            if (state != null) return state;\r\n            \r\n            lock (_initializationLock)\r\n            {\r\n                state = _state;\r\n\r\n                if (state == null)\r\n                {\r\n                    _state = state = Initialize();\r\n                }\r\n            }\r\n            \r\n\r\n            return state;\r\n        }\r\n\r\n\r\n        private State Initialize()\r\n        {\r\n            var files = new C1DirectoryInfo(_templatesDirectory)\r\n                           .GetFiles(LayoutFileMask, SearchOption.AllDirectories)\r\n                           .Where(f => !f.Name.StartsWith(TempFilePrefix, StringComparison.Ordinal));\r\n\r\n\r\n            var templates = new List<PageTemplateDescriptor>();\r\n            var templateRenderingData = new Hashtable<Guid, TemplateRenderingInfo>();\r\n            var loadingExceptions = new Hashtable<Guid, Exception>();\r\n            var sharedFiles = new List<SharedFile>();\r\n\r\n            // Loading and compiling layout controls\r\n            foreach (var fileInfo in files)\r\n            {\r\n                string filePath = fileInfo.FullName;\r\n                string virtualPath = ConvertToVirtualPath(filePath);\r\n\r\n                CachedTemplateInformation cachedTemplateInformation;\r\n\r\n                if (_templateCache.Get(virtualPath, filePath, out cachedTemplateInformation))\r\n                {\r\n                    if (cachedTemplateInformation == null)\r\n                    {\r\n                        sharedFiles.Add(new SharedRazorFile(virtualPath));\r\n                        continue;\r\n                    }\r\n\r\n                    Guid templateId = cachedTemplateInformation.TemplateId;\r\n\r\n                    templates.Add(new LazyInitializedRazorPageTemplateDescriptor(\r\n                        virtualPath,\r\n                        templateId,\r\n                        cachedTemplateInformation.Title,\r\n                        this));\r\n\r\n                    Verify.That(!templateRenderingData.ContainsKey(templateId), \"Multiple master page templates defined with the same ID '{0}'\", templateId);\r\n\r\n                    templateRenderingData.Add(templateId, new LazyInitializedTemplateRenderingInfo(virtualPath, this));\r\n                    continue;\r\n                }\r\n\r\n                WebPageBase webPage;\r\n                PageTemplateDescriptor parsedTemplate;\r\n                IDictionary<string, PropertyInfo> placeholderProperties;\r\n                Exception loadingException;\r\n\r\n                if (!LoadRazorTemplate(virtualPath, out webPage, out parsedTemplate, out placeholderProperties, out loadingException))\r\n                {\r\n                    var brokenTemplate = GetIncorrectlyLoadedPageTemplate(virtualPath, loadingException);\r\n\r\n                    loadingExceptions.Add(brokenTemplate.Id, brokenTemplate.LoadingException);\r\n                    templates.Add(brokenTemplate);\r\n                    continue;\r\n                }\r\n\r\n                if (!(webPage is RazorPageTemplate))\r\n                {\r\n                    sharedFiles.Add(new SharedRazorFile(virtualPath));\r\n\r\n                    if (!HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n                    {\r\n                        _templateCache.Add(virtualPath, filePath, null);\r\n                    }\r\n                    continue;\r\n                }\r\n\r\n                templates.Add(parsedTemplate);\r\n\r\n                templateRenderingData.Add(parsedTemplate.Id, new TemplateRenderingInfo(virtualPath, placeholderProperties));\r\n\r\n                _templateCache.Add(virtualPath, filePath, new CachedTemplateInformation(parsedTemplate));\r\n            }\r\n\r\n            return new State\r\n                       {\r\n                           Templates = templates,\r\n                           RenderingInfo = templateRenderingData,\r\n                           SharedFiles = sharedFiles,\r\n                           LoadingExceptions = loadingExceptions\r\n                       };\r\n        }\r\n\r\n        internal bool LoadRazorTemplate(\r\n            string virtualPath, \r\n            out WebPageBase webPage, \r\n            out PageTemplateDescriptor parsedTemplate,\r\n            out IDictionary<string, PropertyInfo> placeholderProperties,\r\n            out Exception loadingException)\r\n        {\r\n            try\r\n            {\r\n                webPage = WebPageBase.CreateInstanceFromVirtualPath(virtualPath);\r\n            }\r\n            catch(Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, \"Failed to compile razor file '{0}'\", virtualPath);\r\n                Log.LogError(LogTitle, ex);\r\n\r\n                loadingException = ex is TargetInvocationException ? ex.InnerException : ex;\r\n                    \r\n                webPage = null;\r\n                parsedTemplate = null;\r\n                placeholderProperties = null;\r\n                return false;\r\n            }\r\n\r\n            if (!(webPage is RazorPageTemplate))\r\n            {\r\n                parsedTemplate = null;\r\n                placeholderProperties = null;\r\n                loadingException = null;\r\n                return true;\r\n            }\r\n\r\n            RazorPageTemplate razorPageTemplate = webPage as RazorPageTemplate;\r\n            razorPageTemplate.Configure();\r\n            \r\n            try\r\n            {\r\n                ParseTemplate(virtualPath, razorPageTemplate, out parsedTemplate, out placeholderProperties);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, \"Failed to load razor page template '{0}'\", virtualPath);\r\n                Log.LogError(LogTitle, ex);\r\n\r\n                loadingException = ex;\r\n                parsedTemplate = null;\r\n                placeholderProperties = null;\r\n                return false;\r\n            }\r\n            finally\r\n            {\r\n                razorPageTemplate.Dispose();\r\n            }\r\n\r\n            loadingException = null;\r\n            return true;\r\n        }\r\n\r\n        private PageTemplateDescriptor GetIncorrectlyLoadedPageTemplate(string virtualPath, Exception loadingException)\r\n        {\r\n            Guid templateId;\r\n\r\n            string idTokenBegin = \"TemplateId = new Guid(\\\"\";\r\n            string idTokenEnd = \"\\\");\";\r\n\r\n            if (!TemplateParsingHelper.TryExtractTemplateIdFromCSharpCode(PathUtil.Resolve(virtualPath), out templateId, idTokenBegin, idTokenEnd))\r\n            {\r\n                templateId = GetMD5Hash(virtualPath.ToLowerInvariant());\r\n            }\r\n\r\n            return new RazorPageTemplateDescriptor(virtualPath)\r\n            {\r\n                Id = templateId,\r\n                Title = Path.GetFileName(virtualPath),\r\n                LoadingException = loadingException\r\n            };\r\n        }\r\n\r\n        private static Guid GetMD5Hash(string text)\r\n        {\r\n            using (MD5 md5 = MD5.Create())\r\n            {\r\n                byte[] hash = md5.ComputeHash(Encoding.Unicode.GetBytes(text));\r\n                return new Guid(hash);\r\n            }\r\n        }\r\n\r\n        public string ConvertToVirtualPath(string filePath)\r\n        {\r\n            return UrlUtils.Combine(_templatesDirectoryVirtualPath, filePath.Substring(_templatesDirectory.Length).Replace('\\\\', '/'));\r\n        }\r\n\r\n        private void ParseTemplate(string virtualPath,\r\n                                   AspNet.Razor.RazorPageTemplate webPage, \r\n                                   out PageTemplateDescriptor templateDescriptor, \r\n                                   out IDictionary<string, PropertyInfo> placeholderProperties)\r\n        {\r\n            Func<PageTemplateDescriptor> constructor = () => new RazorPageTemplateDescriptor(virtualPath);\r\n\r\n            templateDescriptor = TemplateDefinitionHelper.BuildPageTemplateDescriptor(webPage, constructor, out placeholderProperties);\r\n        }\r\n\r\n\r\n        private void Watcher_OnChanged(object sender, FileSystemEventArgs e)\r\n        {\r\n            // Ignoring system and temporary files\r\n            if (e.Name.StartsWith(TempFilePrefix))\r\n            {\r\n                return;\r\n            }\r\n\r\n            PageTemplateProviderRegistry.FlushTemplates();\r\n            PageTemplatePreview.ClearCache();\r\n        }\r\n\r\n\r\n        public IEnumerable<ElementAction> GetRootActions()\r\n        {\r\n            return new ElementAction[0];\r\n        }\r\n\r\n        public IEnumerable<SharedFile> GetSharedFiles()\r\n        {\r\n            var state = GetInitializedState();\r\n\r\n            return state.SharedFiles;\r\n        }\r\n\r\n        public string TemplateDirectoryPath\r\n        {\r\n            get { return _templatesDirectory; }\r\n        }\r\n\r\n        public void FlushTemplates()\r\n        {\r\n            lock(_initializationLock)\r\n            {\r\n                _state = null;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Razor/RazorPageTemplateProviderAssembler.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Plugins;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Razor\r\n{\r\n    internal class RazorPageTemplateProviderAssembler : IAssembler<IPageTemplateProvider, PageTemplateProviderData>\r\n    {\r\n        public IPageTemplateProvider Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, PageTemplateProviderData objectConfiguration, Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var data = objectConfiguration as RazorPageTemplateProviderData;\r\n            if (data == null)\r\n            {\r\n                throw new ArgumentException(\"Expected configuration to be of type \" + typeof(RazorPageTemplateProviderData).Name, \r\n                                            \"objectConfiguration\");\r\n            }\r\n\r\n            Type addNewTemplateWorkflow = null;\r\n\r\n            if (!string.IsNullOrEmpty(data.AddNewTemplateWorkflow))\r\n            {\r\n                try\r\n                {\r\n                    addNewTemplateWorkflow = TypeManager.GetType(data.AddNewTemplateWorkflow);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(this.GetType().FullName, ex);\r\n                }\r\n            }\r\n\r\n            string folderPath = PathUtil.Resolve(data.Directory);\r\n\r\n            if (!C1Directory.Exists(folderPath))\r\n            {\r\n                throw new ConfigurationErrorsException(\"Folder '{0}' does not exists\".FormatWith(folderPath),\r\n                    objectConfiguration.ElementInformation.Source, objectConfiguration.ElementInformation.LineNumber);\r\n            }\r\n\r\n            return new RazorPageTemplateProvider(data.Name, data.Directory, data.AddNewTemplateLabel, addNewTemplateWorkflow);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Razor/RazorPageTemplateProviderData.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Composite.Core.PageTemplates.Plugins;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Razor\r\n{\r\n    [Assembler(typeof(RazorPageTemplateProviderAssembler))]\r\n    internal class RazorPageTemplateProviderData : PageTemplateProviderData\r\n    {\r\n        [ConfigurationProperty(\"directory\", IsRequired = false, DefaultValue = \"~/App_Data/Razor/PageTemplates\")]\r\n        public string Directory\r\n        {\r\n            get { return (string)base[\"directory\"]; }\r\n            set { base[\"directory\"] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(\"addNewTemplateLabel\", IsRequired = false, DefaultValue = null)]\r\n        public string AddNewTemplateLabel\r\n        {\r\n            get { return (string)base[\"addNewTemplateLabel\"]; }\r\n            set { base[\"addNewTemplateLabel\"] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(\"addNewTemplateWorkflow\", IsRequired = false, DefaultValue = null)]\r\n        public string AddNewTemplateWorkflow\r\n        {\r\n            get { return (string)base[\"addNewTemplateWorkflow\"]; }\r\n            set { base[\"addNewTemplateWorkflow\"] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Razor/SharedRazorFile.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.ResourceSystem.Icons;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Razor\r\n{\r\n    internal class SharedRazorFile: SharedFile\r\n    {\r\n        private static readonly PermissionType[] _editWebsiteFilePermissionTypes = new[] { PermissionType.Edit };\r\n\r\n        private static readonly ResourceHandle EditTemplateIcon = new ResourceHandle(BuildInIconProviderName.ProviderName, \"page-template-edit\");\r\n        private static readonly ActionGroup PrimaryFileActionGroup = new ActionGroup(\"File\", ActionGroupPriority.PrimaryMedium);\r\n\r\n\r\n        public SharedRazorFile(string filePath): base(filePath)\r\n        {\r\n            this.DefaultEditAction = false;\r\n        }\r\n\r\n        public override IEnumerable<C1Console.Elements.ElementAction> GetActions()\r\n        {\r\n            return new[] {\r\n            new ElementAction(new ActionHandle(new WorkflowActionToken(\r\n                WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.EditRazorPageTemplateWorkflow\"),\r\n                _editWebsiteFilePermissionTypes)))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorPageTemplate\", \"EditRazorFileAction.Label\"),\r\n                    ToolTip = StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorPageTemplate\", \"EditRazorFileAction.ToolTip\"),\r\n                    Icon = EditTemplateIcon,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryFileActionGroup\r\n                    }\r\n                }\r\n            }};\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/Razor/TemplateRenderingInfo.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing System.Web.WebPages;\r\nusing Composite.AspNet.Razor;\r\nusing Composite.Core.PageTemplates;\r\n\r\nnamespace Composite.Plugins.PageTemplates.Razor\r\n{\r\n    internal class TemplateRenderingInfo\r\n    {\r\n        public TemplateRenderingInfo(string controlVirtualPath, IDictionary<string, PropertyInfo> placeholders)\r\n        {\r\n            ControlVirtualPath = controlVirtualPath;\r\n            PlaceholderProperties = placeholders;\r\n        }\r\n\r\n        public string ControlVirtualPath { get; set; }\r\n        public virtual IDictionary<string, PropertyInfo> PlaceholderProperties { get; private set; }\r\n    }\r\n\r\n    internal class LazyInitializedTemplateRenderingInfo : TemplateRenderingInfo\r\n    {\r\n        private IDictionary<string, PropertyInfo> _placeholderProperties;\r\n        private readonly RazorPageTemplateProvider _provider;\r\n\r\n        public LazyInitializedTemplateRenderingInfo(string controlVirtualPath, RazorPageTemplateProvider provider)\r\n            :base(controlVirtualPath, null)\r\n        {\r\n            _provider = provider;\r\n        }\r\n\r\n        public override IDictionary<string, PropertyInfo> PlaceholderProperties\r\n        {\r\n            get\r\n            {\r\n                if (_placeholderProperties == null)\r\n                {\r\n                    lock (this)\r\n                    {\r\n                        if (_placeholderProperties == null)\r\n                        {\r\n                            _placeholderProperties = InitializePlaceholderProperties();\r\n                        }\r\n                    }\r\n                }\r\n                return _placeholderProperties;\r\n            }\r\n        }\r\n\r\n        private IDictionary<string, PropertyInfo> InitializePlaceholderProperties()\r\n        {\r\n            WebPageBase webPage;\r\n            PageTemplateDescriptor parsedTemplate;\r\n            IDictionary<string, PropertyInfo> placeholderProperties;\r\n            Exception loadingException;\r\n\r\n            if (!_provider.LoadRazorTemplate(ControlVirtualPath, out webPage, out parsedTemplate, out placeholderProperties, out loadingException))\r\n            {\r\n                throw loadingException;\r\n            }\r\n\r\n            Verify.IsNotNull(webPage, \"Failed to compile razor page template '{0}'\", ControlVirtualPath);\r\n            Verify.That(webPage is RazorPageTemplate, \"Incorrect base class. '{0}'\", ControlVirtualPath);\r\n\r\n            return placeholderProperties;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/XmlPageTemplates/XmlPageRenderer.cs",
    "content": "using System;\r\nusing System.Web.UI;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\nusing Composite.Functions;\r\n\r\nnamespace Composite.Plugins.PageTemplates.XmlPageTemplates\r\n{\r\n    internal class XmlPageRenderer: IPageRenderer, ISlimPageRenderer\r\n    {\r\n        private Page _aspnetPage;\r\n        private PageContentToRender _job;\r\n\r\n        public void AttachToPage(Page renderTarget, PageContentToRender contentToRender)\r\n        {\r\n            _aspnetPage = renderTarget;\r\n            _job = contentToRender;\r\n\r\n            _aspnetPage.Init += RendererPage;\r\n        }\r\n\r\n        public XDocument Render(PageContentToRender contentToRender, FunctionContextContainer functionContextContainer)\r\n        {\r\n            var document = TemplateInfo.GetTemplateDocument(contentToRender.Page.TemplateId);\r\n\r\n            PageRenderer.ResolvePlaceholders(document, contentToRender.Contents);\r\n\r\n            return document;\r\n        }\r\n\r\n        private void RendererPage(object sender, EventArgs e)\r\n        {\r\n            if (_aspnetPage.Master != null)\r\n            {\r\n                // Backward compatibility with CompositeC1Contrib.Renderes.MasterPages package\r\n                return;\r\n            }\r\n\r\n            Control renderedPage;\r\n            using (Profiler.Measure(\"Page build up\"))\r\n            {\r\n                renderedPage = PageRenderer.Render(_job.Page, _job.Contents);\r\n            }\r\n\r\n            using (Profiler.Measure(\"ASP.NET controls: PagePreInit\"))\r\n            {\r\n                _aspnetPage.Controls.Add(renderedPage);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/XmlPageTemplates/XmlPageTemplateDescriptor.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider;\r\n\r\nusing SR = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\n\r\nnamespace Composite.Plugins.PageTemplates.XmlPageTemplates\r\n{\r\n    internal class XmlPageTemplateDescriptor: PageTemplateDescriptor\r\n    {\r\n        public static ResourceHandle DeleteTemplate { get { return PageTemplateElementProvider.GetIconHandle(\"page-template-delete\"); } }\r\n        private static readonly ActionGroup PrimaryActionGroup = new ActionGroup(ActionGroupPriority.PrimaryHigh);\r\n\r\n        private readonly IXmlPageTemplate _xmlPageTemplate;\r\n\r\n        public XmlPageTemplateDescriptor(IXmlPageTemplate pageTemplate)\r\n        {\r\n            _xmlPageTemplate = pageTemplate;\r\n        }\r\n\r\n        public override C1Console.Security.EntityToken GetEntityToken()\r\n        {\r\n            return _xmlPageTemplate.GetDataEntityToken();\r\n        }\r\n\r\n        public override IEnumerable<ElementAction> GetActions()\r\n        {\r\n            var result = new List<ElementAction>();\r\n\r\n            Type type = WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.EditXmlPageTemplateWorkflow\");\r\n\r\n            result.Add(new ElementAction(new ActionHandle(new WorkflowActionToken(type, new[] { PermissionType.Edit })))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", \"PageTemplateElementProvider.EditXmlTemplate\"),\r\n                    ToolTip = SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", \"PageTemplateElementProvider.EditXmlTemplateToolTip\"),\r\n                    Icon = PageTemplateElementProvider.EditTemplate,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Edit,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            type = WorkflowFacade.GetWorkflowType( \"Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider.DeletePageTemplateWorkflow\");\r\n\r\n            result.Add(new ElementAction(new ActionHandle(new WorkflowActionToken(type, new[] { PermissionType.Delete })))\r\n            {\r\n                VisualData = new ActionVisualizedData\r\n                {\r\n                    Label = SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", \"PageTemplateElementProvider.DeleteTemplate\"),\r\n                    ToolTip = SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", \"PageTemplateElementProvider.DeleteTemplateToolTip\"),\r\n                    Icon = DeleteTemplate,\r\n                    Disabled = false,\r\n                    ActionLocation = new ActionLocation\r\n                    {\r\n                        ActionType = ActionType.Delete,\r\n                        IsInFolder = false,\r\n                        IsInToolbar = true,\r\n                        ActionGroup = PrimaryActionGroup\r\n                    }\r\n                }\r\n            });\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/XmlPageTemplates/XmlPageTemplateProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nusing SR = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\n\r\nnamespace Composite.Plugins.PageTemplates.XmlPageTemplates\r\n{\r\n    [ConfigurationElementType(typeof(XmlPageTemplateProviderData))]\r\n    internal class XmlPageTemplateProvider : IPageTemplateProvider\r\n    {\r\n        public string AddNewTemplateLabel\r\n        {\r\n            get; private set;\r\n        }\r\n\r\n        public Type AddNewTemplateWorkflow\r\n        {\r\n            get; private set;\r\n        }\r\n\r\n        public XmlPageTemplateProvider(string providerName, string addNewTemplateLabel, Type addNewTemplateWorkflow)\r\n        {\r\n            AddNewTemplateLabel = addNewTemplateLabel;\r\n            AddNewTemplateWorkflow = addNewTemplateWorkflow;\r\n        }\r\n\r\n        public IEnumerable<PageTemplateDescriptor> GetPageTemplates()\r\n        {\r\n            using (var conn = new DataConnection(PublicationScope.Published))\r\n            {\r\n                var result = new List<PageTemplateDescriptor>();\r\n                \r\n                foreach (var xmlPageTemplate in conn.Get<IXmlPageTemplate>())\r\n                {\r\n                    string defaultPlaceholderId;\r\n                    PlaceholderDescriptor[] placeholders;\r\n\r\n                    ParseLayoutFile(xmlPageTemplate, out placeholders, out defaultPlaceholderId);\r\n\r\n                    PageTemplateDescriptor descriptor = new XmlPageTemplateDescriptor(xmlPageTemplate)\r\n                    {\r\n                        Id = xmlPageTemplate.Id,\r\n                        Title = xmlPageTemplate.Title,\r\n                        DefaultPlaceholderId = defaultPlaceholderId,\r\n                        PlaceholderDescriptions = placeholders\r\n                    };\r\n                \r\n                    result.Add(descriptor);\r\n                }\r\n                \r\n                return result;\r\n            }\r\n        }\r\n\r\n\r\n        private static void ParseLayoutFile(IXmlPageTemplate pageTemplate, out PlaceholderDescriptor[] placeholders, out string defaultPlaceholder)\r\n        {\r\n            var placeholdersInfo = TemplateInfo.GetRenderingPlaceHolders(pageTemplate.Id);\r\n\r\n            defaultPlaceholder = placeholdersInfo.DefaultPlaceholderId;\r\n\r\n            placeholders = placeholdersInfo\r\n                           .Placeholders\r\n                           .Select(pair => new PlaceholderDescriptor { Id = pair.Key, Title = pair.Value })\r\n                           .ToArray();\r\n        }\r\n\r\n        public IPageRenderer BuildPageRenderer(Guid templateId)\r\n        {\r\n            return new XmlPageRenderer();\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<ElementAction> GetRootActions()\r\n        {\r\n            return new ElementAction[0];\r\n        }\r\n\r\n        public void FlushTemplates()\r\n        {\r\n            // Provider holds no state - no need to reinitialize anything\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/PageTemplates/XmlPageTemplates/XmlPageTemplateProviderData.cs",
    "content": "﻿using System;\r\nusing System.Configuration;\r\nusing Composite.Core;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Plugins;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.PageTemplates.XmlPageTemplates\r\n{\r\n    [Assembler(typeof(XmlPageTemplateProviderAssembler))]\r\n    internal class XmlPageTemplateProviderData : PageTemplateProviderData\r\n    {\r\n        [ConfigurationProperty(\"addNewTemplateLabel\", IsRequired = false, DefaultValue = null)]\r\n        public string AddNewTemplateLabel\r\n        {\r\n            get { return (string)base[\"addNewTemplateLabel\"]; }\r\n            set { base[\"addNewTemplateLabel\"] = value; }\r\n        }\r\n\r\n        [ConfigurationProperty(\"addNewTemplateWorkflow\", IsRequired = false, DefaultValue = null)]\r\n        public string AddNewTemplateWorkflow\r\n        {\r\n            get { return (string)base[\"addNewTemplateWorkflow\"]; }\r\n            set { base[\"addNewTemplateWorkflow\"] = value; }\r\n        }\r\n    }\r\n\r\n    internal class XmlPageTemplateProviderAssembler : IAssembler<IPageTemplateProvider, PageTemplateProviderData>\r\n    {\r\n        public IPageTemplateProvider Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, PageTemplateProviderData objectConfiguration, Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var data = objectConfiguration as XmlPageTemplateProviderData;\r\n            if (data == null)\r\n            {\r\n                throw new ArgumentException(\"Expected configuration to be of type \" + typeof(XmlPageTemplateProviderData).Name,\r\n                                            \"objectConfiguration\");\r\n            }\r\n\r\n            Type addNewTemplateWorkflow = null;\r\n\r\n            if (!string.IsNullOrEmpty(data.AddNewTemplateWorkflow))\r\n            {\r\n                try\r\n                {\r\n                    addNewTemplateWorkflow = TypeManager.GetType(data.AddNewTemplateWorkflow);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(this.GetType().FullName, ex);\r\n                }\r\n            }\r\n\r\n            return new XmlPageTemplateProvider(data.Name, data.AddNewTemplateLabel, addNewTemplateWorkflow);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/ResourceSystem/AggregationLocalizationProvider/AggregationLocalizationProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.ResourceSystem.Plugins.ResourceProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.ResourceSystem.AggregationLocalizationProvider\r\n{\r\n    /// <summary>\r\n    /// ILocalizationProvider that aggrages multiple IStringResourceProviders. To be used for backward compatibility.\r\n    /// </summary>\r\n    [ConfigurationElementType(typeof(AggregationLocalizationProviderData))]\r\n    internal class AggregationLocalizationProvider: ILocalizationProvider\r\n    {\r\n        private readonly Dictionary<string, IStringResourceProvider> _providers;\r\n        private CultureInfo[] _supportedCultures;\r\n\r\n        public AggregationLocalizationProvider(Dictionary<string, IStringResourceProvider> providers)\r\n        {\r\n            _providers = providers;\r\n        }\r\n\r\n        public IEnumerable<string> GetSections()\r\n        {\r\n            return _providers.Keys;\r\n        }\r\n\r\n        public string GetString(string section, string stringId, CultureInfo cultureInfo)\r\n        {\r\n            IStringResourceProvider stringResourceProvider;\r\n\r\n            if (!_providers.TryGetValue(section, out stringResourceProvider))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return stringResourceProvider.GetStringValue(stringId, cultureInfo);\r\n        }\r\n\r\n        public ReadOnlyDictionary<string, string> GetAllStrings(string section, CultureInfo cultureInfo)\r\n        {\r\n            IStringResourceProvider stringResourceProvider;\r\n\r\n            if (!_providers.TryGetValue(section, out stringResourceProvider))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            IDictionary<string, string> dictionary = stringResourceProvider.GetAllStrings(cultureInfo);\r\n\r\n            return new ReadOnlyDictionary<string, string>(new Dictionary<string, string>(dictionary));\r\n        }\r\n\r\n        public IEnumerable<CultureInfo> GetSupportedCultures()\r\n        { \r\n            if(_supportedCultures == null)\r\n            {\r\n                var result = new List<CultureInfo>();\r\n\r\n                foreach(var provider in _providers.Values)\r\n                {\r\n                    result.AddRange(provider.GetSupportedCultures());\r\n                }\r\n\r\n                _supportedCultures = result.Distinct().ToArray();\r\n            }\r\n\r\n            return _supportedCultures;\r\n        }\r\n\r\n\r\n        #region Configuration\r\n\r\n        [Assembler(typeof(AggregationLocalizationProviderAssembler))]\r\n        internal sealed class AggregationLocalizationProviderData : ResourceProviderData\r\n        {\r\n            private const string _providersProperty = \"Providers\";\r\n            [ConfigurationProperty(_providersProperty)]\r\n            public NameTypeManagerTypeConfigurationElementCollection<ResourceProviderData> Providers\r\n            {\r\n                get\r\n                {\r\n                    return (NameTypeManagerTypeConfigurationElementCollection<ResourceProviderData>)base[_providersProperty];\r\n                }\r\n            }\r\n        }\r\n\r\n        internal sealed class AggregationLocalizationProviderAssembler : IAssembler<IResourceProvider, ResourceProviderData>\r\n        {\r\n            public IResourceProvider Assemble(IBuilderContext context, ResourceProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n            {\r\n                var data = (AggregationLocalizationProviderData)objectConfiguration;\r\n\r\n                var stringResourceProviders = new Dictionary<string, IStringResourceProvider>();\r\n\r\n                // TODO: rewrite using proper Object builder API\r\n                foreach(var configRecord in data.Providers)\r\n                {\r\n                    var type = configRecord.Type;\r\n                    var configTypeAttr = type.GetCustomAttributes(typeof (ConfigurationElementTypeAttribute), true).FirstOrDefault() as ConfigurationElementTypeAttribute;\r\n                    Verify.IsNotNull(configTypeAttr, \"Attribute not defined: \" + typeof(ConfigurationElementTypeAttribute).FullName);\r\n\r\n                    Type configType = configTypeAttr.ConfigurationType;\r\n                    var assemblerAttr = configType.GetCustomAttributes(typeof(AssemblerAttribute), true).FirstOrDefault() as AssemblerAttribute;\r\n                    Verify.IsNotNull(configTypeAttr, \"Attribute not defined: \" + typeof(AssemblerAttribute).FullName);\r\n\r\n                    var assemblerType = assemblerAttr.AssemblerType;\r\n\r\n                    var assembler = assemblerType.GetConstructor(new Type[0]).Invoke(new object[0]) as IAssembler<IResourceProvider, ResourceProviderData>;\r\n\r\n                    IResourceProvider resourceProvider = assembler.Assemble(context, configRecord, configurationSource, reflectionCache);\r\n                    Verify.That(resourceProvider is IStringResourceProvider, \"Provider should inherit \" + typeof(IStringResourceProvider).FullName);\r\n\r\n                    stringResourceProviders.Add(configRecord.Name, resourceProvider as IStringResourceProvider);\r\n                }\r\n\r\n                return new AggregationLocalizationProvider(stringResourceProviders);\r\n            }\r\n        }\r\n\r\n        #endregion Configuration\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/ResourceSystem/PropertyResourceProvider/PropertyResourceProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Reflection;\r\nusing Composite.Core.ResourceSystem.Plugins.ResourceProvider;\r\nusing Composite.Core.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.ResourceSystem.PropertyResourceProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableResourceProvider))]\r\n    internal sealed class PropertyResourceProvider : IStringResourceProvider\r\n\t{\r\n        public string GetStringValue(string stringId, CultureInfo cultureInfo)\r\n        {\r\n            int index = stringId.LastIndexOf('.');\r\n            if (index == -1) throw new InvalidOperationException(string.Format(\"'{0}' is not of correct format\", stringId));\r\n\r\n            string typeName = stringId.Substring(0, index);\r\n            string propertyName = stringId.Substring(index + 1);\r\n\r\n            Type type = TypeManager.GetType(typeName);\r\n            if (type == null) throw new InvalidOperationException(string.Format(\"'{0}' type could not found\", typeName));\r\n\r\n            PropertyInfo propertyInfo = type.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Static);\r\n\r\n            if (propertyInfo == null) throw new InvalidOperationException(string.Format(\"The property '{0}' on the type '{1}' could not be found\", propertyInfo));\r\n\r\n            return (string)propertyInfo.GetValue(null, null);\r\n        }\r\n\r\n\r\n\r\n        public IDictionary<string, string> GetAllStrings(CultureInfo cultureInfo)\r\n        {\r\n            return new Dictionary<string, string>();\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<CultureInfo> GetSupportedCultures()\r\n        {\r\n            yield break;\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/ResourceSystem/XmlLocalizationProvider/XmlLocalizationProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem.Plugins.ResourceProvider;\r\nusing Composite.Core.Xml;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.ResourceSystem.XmlLocalizationProvider\r\n{\r\n    [ConfigurationElementType(typeof(XmlLocalizationProviderData))]\r\n    internal class XmlLocalizationProvider: ILocalizationProvider\r\n    {\r\n        private static readonly string LogTitle = typeof (XmlLocalizationProvider).Name;\r\n\r\n        readonly string _directory;\r\n        readonly CultureInfo _defaultCulture;\r\n        \r\n        private State _state;\r\n        private readonly object _syncRoot = new object();\r\n\r\n        private readonly C1FileSystemWatcher _watcher;\r\n\r\n        public XmlLocalizationProvider(string directoryVirtualPath, CultureInfo defaultCulture)\r\n        {\r\n            _defaultCulture = defaultCulture;\r\n            _directory = PathUtil.Resolve(directoryVirtualPath);\r\n\r\n            if(!C1Directory.Exists(_directory))\r\n            {\r\n                Log.LogVerbose(LogTitle, \"Directory '{0}' does not exist\", directoryVirtualPath);\r\n                return;\r\n            }\r\n\r\n            _watcher = new C1FileSystemWatcher(_directory, \"*.xml\");\r\n\r\n            _watcher.Created += (sender, args) => Reset();\r\n            _watcher.Changed += (sender, args) => Reset();\r\n            _watcher.Deleted += (sender, args) => Reset();\r\n\r\n            _watcher.EnableRaisingEvents = true;\r\n        }\r\n\r\n        public IEnumerable<string> GetSections()\r\n        {\r\n            var state = GetState();\r\n\r\n            return state.Sections.Keys;\r\n        }\r\n\r\n        public string GetString(string section, string stringId, CultureInfo cultureInfo)\r\n        {\r\n            var state = GetState();\r\n\r\n            if(!state.Sections.ContainsKey(section))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var filesByCulture = state.Sections[section];\r\n\r\n            if(filesByCulture.ContainsKey(cultureInfo))\r\n            {\r\n                var strings = filesByCulture[cultureInfo].GetStrings();\r\n\r\n                if(strings.ContainsKey(stringId))\r\n                {\r\n                    return strings[stringId];\r\n                }\r\n            }\r\n\r\n            // If not found - searching in default culture\r\n            if(!cultureInfo.Equals(_defaultCulture) && filesByCulture.ContainsKey(_defaultCulture))\r\n            {\r\n                var strings = filesByCulture[_defaultCulture].GetStrings();\r\n\r\n                if(strings.ContainsKey(stringId))\r\n                {\r\n                    return strings[stringId];\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        public ReadOnlyDictionary<string, string> GetAllStrings(string section, CultureInfo cultureInfo)\r\n        {\r\n            var state = GetState();\r\n\r\n            if (!state.Sections.ContainsKey(section))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var filesByCulture = state.Sections[section];\r\n\r\n            if(filesByCulture.ContainsKey(cultureInfo))\r\n            {\r\n                return filesByCulture[cultureInfo].GetStrings();\r\n            }\r\n            \r\n            // If not found - searching in default culture\r\n            if(!cultureInfo.Equals(_defaultCulture) && filesByCulture.ContainsKey(_defaultCulture))\r\n            {\r\n                return filesByCulture[_defaultCulture].GetStrings();\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        public IEnumerable<CultureInfo> GetSupportedCultures()\r\n        {\r\n            var state = GetState();\r\n\r\n            var result = new List<CultureInfo>();\r\n\r\n            foreach(var section in state.Sections)\r\n            {\r\n                result.AddRange(section.Value.Keys);\r\n            }\r\n\r\n            return result.Distinct();\r\n        }\r\n\r\n\r\n        public IEnumerable<System.Globalization.CultureInfo> GetSupportedCultures(string section)\r\n        {\r\n            var state = GetState();\r\n\r\n            if(!state.Sections.ContainsKey(section))\r\n            {\r\n                return new CultureInfo[0];\r\n            }\r\n\r\n            return state.Sections[section].Keys;\r\n        }\r\n\r\n        private State Initialize()\r\n        {\r\n            var sections = new Dictionary<string, Dictionary<CultureInfo, LocalizationFile>>();\r\n\r\n            if (C1Directory.Exists(_directory))\r\n            {\r\n                foreach (string xmlFile in C1Directory.GetFiles(_directory, \"*.xml\", SearchOption.AllDirectories))\r\n                {\r\n                    // File names have format <section name>.<culture name>.xml\r\n\r\n                    string fileName = Path.GetFileName(xmlFile);\r\n\r\n                    fileName = fileName.Substring(0, fileName.Length - 4); // removing \".xml\";\r\n\r\n                    if (!fileName.Contains(\".\")) continue;\r\n\r\n                    string cultureName = fileName.Substring(fileName.LastIndexOf(\".\", StringComparison.Ordinal) + 1);\r\n\r\n                    CultureInfo cultureInfo;\r\n                    try\r\n                    {\r\n                        cultureInfo = CultureInfo.GetCultureInfo(cultureName);\r\n                    }\r\n                    catch (CultureNotFoundException)\r\n                    {\r\n                        Log.LogInformation(LogTitle, \"Skipping file '{0}' as '{1}' is not a valid culture name\",\r\n                                           Path.GetFileName(xmlFile), cultureName);\r\n                        continue;\r\n                    }\r\n\r\n                    string sectionName = fileName.Substring(0, fileName.Length - cultureName.Length - 1);\r\n\r\n                    if (!sections.ContainsKey(sectionName))\r\n                    {\r\n                        sections.Add(sectionName, new Dictionary<CultureInfo, LocalizationFile>());\r\n                    }\r\n\r\n                    var localizationFile = new LocalizationFile(xmlFile);\r\n                    sections[sectionName].Add(cultureInfo, localizationFile);\r\n                }\r\n            }\r\n\r\n            return new State { Sections = sections };\r\n        }\r\n\r\n        private void Reset()\r\n        {\r\n            lock(_syncRoot)\r\n            {\r\n                _state = null;\r\n            }\r\n        }\r\n\r\n        private State GetState()\r\n        {\r\n            var state = _state;\r\n            if(state == null)\r\n            {\r\n                lock (_syncRoot)\r\n                {\r\n                    state = _state;\r\n                    if(state == null)\r\n                    {\r\n                        _state = state = Initialize();\r\n                    }\r\n                }\r\n            }\r\n            return state;\r\n        }\r\n\r\n        private static ReadOnlyDictionary<string, string> LoadStrings(string fileName)\r\n        {\r\n            XElement strings = XElementUtils.Load(fileName);\r\n\r\n            var stringDictionary = new Dictionary<string, string>();\r\n\r\n            foreach (XElement stringElement in strings.Elements())\r\n            {\r\n                XAttribute keyAttribute = stringElement.Attribute(\"key\");\r\n                XAttribute valueAttribute = stringElement.Attribute(\"value\");\r\n\r\n                if (keyAttribute != null && valueAttribute != null)\r\n                {\r\n                    if (stringDictionary.ContainsKey(keyAttribute.Value))\r\n                    {\r\n                        throw new InvalidOperationException(\"Duplicate string resource key '{0}' in XML file '{1}'\"\r\n                                                            .FormatWith(keyAttribute.Value, Path.GetFileName(fileName)));\r\n                    }\r\n\r\n                    stringDictionary.Add(keyAttribute.Value, valueAttribute.Value);\r\n                }\r\n                else\r\n                {\r\n                    Log.LogError(LogTitle, \"Invalid entry '{0}' in file '{1}'\"\r\n                                          .FormatWith(stringElement.ToString(SaveOptions.DisableFormatting), Path.GetFileName(fileName)));\r\n                }\r\n            }\r\n\r\n            return new ReadOnlyDictionary<string, string>(stringDictionary);\r\n        }\r\n\r\n        private class State\r\n        {\r\n            public IDictionary<string, Dictionary<CultureInfo, LocalizationFile>> Sections;\r\n        }\r\n\r\n        private class LocalizationFile\r\n        {\r\n            private readonly string _filePath;\r\n            private volatile ReadOnlyDictionary<string, string> _strings;\r\n\r\n            public LocalizationFile(string filePath)\r\n            {\r\n                _filePath = filePath;\r\n            }\r\n\r\n            public ReadOnlyDictionary<string, string> GetStrings()\r\n            {\r\n                if(_strings == null)\r\n                {\r\n                    lock(this)\r\n                    {\r\n                        if(_strings == null)\r\n                        {\r\n                            _strings = LoadStrings(_filePath);\r\n                        }\r\n                    }\r\n                }\r\n\r\n                return _strings;\r\n            }\r\n        }\r\n\r\n        #region Configuration\r\n\r\n        [Assembler(typeof(XmlLocalizationProviderAssembler))]\r\n        internal sealed class XmlLocalizationProviderData : ResourceProviderData\r\n        {\r\n            private const string _defaultCultureNameProperty = \"defaultCultureName\";\r\n            [ConfigurationProperty(_defaultCultureNameProperty, IsRequired = true)]\r\n            public string DefaultCultureName\r\n            {\r\n                get { return (string)base[_defaultCultureNameProperty]; }\r\n                set { base[_defaultCultureNameProperty] = value; }\r\n            }\r\n\r\n            private const string _directoryProperty = \"directory\";\r\n            [ConfigurationProperty(_directoryProperty)]\r\n            public string Directory\r\n            {\r\n                get\r\n                {\r\n                    return (string)base[_directoryProperty];\r\n                }\r\n            }\r\n        }\r\n\r\n        internal sealed class XmlLocalizationProviderAssembler : IAssembler<IResourceProvider, ResourceProviderData>\r\n        {\r\n            public IResourceProvider Assemble(IBuilderContext context, ResourceProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n            {\r\n                var data = (XmlLocalizationProviderData)objectConfiguration;\r\n\r\n                var defaultCulture = CultureInfo.GetCultureInfo(data.DefaultCultureName);\r\n                string directoryVirtualPath = data.Directory;\r\n\r\n                return new XmlLocalizationProvider(directoryVirtualPath, defaultCulture);\r\n            }\r\n        }\r\n\r\n        #endregion Configuration\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/ResourceSystem/XmlStringResourceProvider/XmlStringResourceProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem.Plugins.ResourceProvider;\r\nusing Composite.Core.Xml;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.ResourceSystem.XmlStringResourceProvider\r\n{\r\n    [ConfigurationElementType(typeof(XmlStringResourceProviderData))]\r\n    internal sealed class XmlStringResourceProvider : IStringResourceProvider\r\n    {\r\n        private ResourceLocker<Resources> _resourceLocker = new ResourceLocker<Resources>(new Resources(), Resources.Initialize, false);\r\n        private string _providerName;\r\n\r\n\r\n\r\n        public XmlStringResourceProvider(string defaultCultureName, Dictionary<CultureInfo, string> cultureToFileLookup, Dictionary<CultureInfo, bool> watchForFileChanges, string providerName)\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                _providerName = providerName;\r\n\r\n                _resourceLocker.Resources.DefaultCulture = new CultureInfo(defaultCultureName);\r\n                _resourceLocker.Resources.CultureToFileLookup = cultureToFileLookup;\r\n\r\n                foreach (CultureInfo watchedCulture in watchForFileChanges.Where(f => f.Value).Select(f => f.Key))\r\n                {\r\n                    string unresolvedFileName;\r\n                    if (_resourceLocker.Resources.CultureToFileLookup.TryGetValue(watchedCulture, out unresolvedFileName))\r\n                    {\r\n                        string resolvedFileName = PathUtil.Resolve(unresolvedFileName);\r\n                        DateTime lastWrite = C1File.GetLastWriteTime(resolvedFileName);\r\n\r\n                        _resourceLocker.Resources.CultureFileLastUpdated.Add(watchedCulture, lastWrite);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string GetStringValue(string stringId, CultureInfo cultureInfo)\r\n        {\r\n            Dictionary<string, string> stringDictionary; \r\n\r\n            try\r\n            {\r\n                stringDictionary = GetStringsForCulture(cultureInfo);\r\n            }\r\n            catch (FileNotFoundException ex)\r\n            {\r\n                return string.Format(\"*** FILE '{0}' NOT FOUND ***\", ex.FileName);\r\n            }\r\n\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                if (stringDictionary == null)\r\n                {\r\n                    if (cultureInfo != _resourceLocker.Resources.DefaultCulture)\r\n                    {\r\n                        return GetStringValue(stringId, _resourceLocker.Resources.DefaultCulture);\r\n                    }\r\n                    else\r\n                    {\r\n                        LoggingService.LogError(\"XmlStringResourceProvider\", \"String provider misconfigured. No string file available for default culture.\");\r\n                        return \"*** STRING NOT FOUND ***\";\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    string result;\r\n\r\n                    if (stringDictionary.TryGetValue(stringId, out result) == false)\r\n                    {\r\n                        if (cultureInfo != _resourceLocker.Resources.DefaultCulture)\r\n                        {\r\n                            return GetStringValue(stringId, _resourceLocker.Resources.DefaultCulture);\r\n                        }\r\n                        else\r\n                        {\r\n                            LoggingService.LogError(\"XmlStringResourceProvider\", string.Format(\"String not found: '{0}' for provider '{1}'\", stringId, _providerName));\r\n                            return \"*** STRING NOT FOUND ***\";\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        return result;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IDictionary<string, string> GetAllStrings(CultureInfo cultureInfo)\r\n        {\r\n            IDictionary<string, string> currentCultureStrings = GetStringsForCulture(cultureInfo);\r\n\r\n            using (_resourceLocker.ReadLocker)\r\n            {\r\n                if (currentCultureStrings == null) return GetStringsForCulture(_resourceLocker.Resources.DefaultCulture);\r\n                if (cultureInfo == _resourceLocker.Resources.DefaultCulture) return currentCultureStrings;\r\n\r\n                IDictionary<string, string> defaultCultureStrings = GetStringsForCulture(_resourceLocker.Resources.DefaultCulture);\r\n\r\n                if (defaultCultureStrings.Count == currentCultureStrings.Count) return currentCultureStrings;\r\n\r\n                return currentCultureStrings.Union(defaultCultureStrings.Where(f => currentCultureStrings.ContainsKey(f.Key) == false)).ToDictionary(f => f.Key, f => f.Value);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n        public IEnumerable<CultureInfo> GetSupportedCultures()\r\n        {\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                foreach (CultureInfo cultureInfo in _resourceLocker.Resources.CultureToFileLookup.Keys.Distinct())\r\n                {\r\n                    yield return cultureInfo;\r\n                }\r\n            }\r\n        }\r\n\r\n        \r\n        \r\n        /// <summary>\r\n        /// Returns strings for the specified culture or null if no strings exists.\r\n        /// </summary>\r\n        private Dictionary<string, string> GetStringsForCulture(CultureInfo cultureInfo)\r\n        {\r\n            Dictionary<string, string> stringDictionary;\r\n\r\n            using (_resourceLocker.Locker)\r\n            {\r\n                if (_resourceLocker.Resources.CultureFileLastUpdated.ContainsKey(cultureInfo))\r\n                {\r\n                    string unresolvedFileName = _resourceLocker.Resources.CultureToFileLookup[cultureInfo];\r\n                    string resolvedFileName = PathUtil.Resolve(unresolvedFileName);\r\n\r\n                    DateTime lastWrite = C1File.GetLastWriteTime(resolvedFileName);\r\n                    double secondsSinceLastWrite = (DateTime.Now - lastWrite).TotalSeconds;\r\n\r\n                    if (secondsSinceLastWrite < 300 || lastWrite > _resourceLocker.Resources.CultureFileLastUpdated[cultureInfo])\r\n                    {\r\n                        _resourceLocker.Resources.CultureToTranslation.Remove(cultureInfo);\r\n                        _resourceLocker.Resources.CultureFileLastUpdated[cultureInfo] = lastWrite;\r\n                    }\r\n                }\r\n\r\n                if (_resourceLocker.Resources.CultureToTranslation.TryGetValue(cultureInfo, out stringDictionary) == false)\r\n                {\r\n                    string unresolvedFileName;\r\n                    if (_resourceLocker.Resources.CultureToFileLookup.TryGetValue(cultureInfo, out unresolvedFileName) == false)\r\n                    {\r\n                        return null;\r\n                    }\r\n\r\n                    string resolvedFileName = PathUtil.Resolve(unresolvedFileName);\r\n                    XElement strings = XElementUtils.Load(resolvedFileName);\r\n\r\n                    stringDictionary = new Dictionary<string, string>();\r\n\r\n                    foreach (XElement stringElement in strings.Elements())\r\n                    {\r\n                        XAttribute keyAttribute = stringElement.Attribute(\"key\");\r\n                        XAttribute valueAttribute = stringElement.Attribute(\"value\");\r\n\r\n                        if (keyAttribute != null && valueAttribute != null)\r\n                        {\r\n                            if (stringDictionary.ContainsKey(keyAttribute.Value))\r\n                            {\r\n                                throw new InvalidOperationException(string.Format(\"Duplicate string resource key '{0}' in XML file '{1}'\", keyAttribute.Value, unresolvedFileName));\r\n                            }\r\n                            stringDictionary.Add(keyAttribute.Value, valueAttribute.Value);\r\n                        }\r\n                        else\r\n                        {\r\n                            LoggingService.LogError(\"XmlStringResourceProvider\", string.Format(\"Invalid entry '{0}' in file '{1}'\", stringElement.ToString(SaveOptions.DisableFormatting), unresolvedFileName));\r\n                        }\r\n                    }\r\n\r\n                    _resourceLocker.Resources.CultureToTranslation.Add(cultureInfo, stringDictionary);\r\n                }\r\n            }\r\n\r\n            return stringDictionary;\r\n        }\r\n\r\n\r\n\r\n\r\n        private sealed class Resources\r\n        {\r\n            public CultureInfo DefaultCulture { get; set; }\r\n            public Dictionary<CultureInfo, string> CultureToFileLookup { get; set; }\r\n            public Dictionary<CultureInfo, Dictionary<string, string>> CultureToTranslation { get; set; }\r\n            public Dictionary<CultureInfo, DateTime> CultureFileLastUpdated { get; set; }\r\n\r\n            public static void Initialize(Resources resources)\r\n            {\r\n                resources.CultureToTranslation = new Dictionary<CultureInfo, Dictionary<string, string>>();\r\n                resources.CultureFileLastUpdated = new Dictionary<CultureInfo, DateTime>();\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(XmlStringResourceProviderAssembler))]\r\n    internal sealed class XmlStringResourceProviderData : ResourceProviderData\r\n    {\r\n        private const string _defaultCultureNameProperty = \"defaultCultureName\";\r\n        [ConfigurationProperty(_defaultCultureNameProperty, IsRequired = true)]\r\n        public string DefaultCultureName\r\n        {\r\n            get { return (string)base[_defaultCultureNameProperty]; }\r\n            set { base[_defaultCultureNameProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _culturesProperty = \"Cultures\";\r\n        [ConfigurationProperty(_culturesProperty)]\r\n        public CultureElementCollection Cultures\r\n        {\r\n            get\r\n            {\r\n                return (CultureElementCollection)base[_culturesProperty];\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class CulturenameConfigurationElement : ConfigurationElement\r\n    {\r\n        private const string _cultureNameProperty = \"cultureName\";\r\n        [ConfigurationProperty(_cultureNameProperty, IsKey = true)]\r\n        public string CultureName\r\n        {\r\n            get { return (string)base[_cultureNameProperty]; }\r\n            set { base[_cultureNameProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _xmlFileProperty = \"xmlFile\";\r\n        [ConfigurationProperty(_xmlFileProperty)]\r\n        public string XmlFile\r\n        {\r\n            get { return (string)base[_xmlFileProperty]; }\r\n            set { base[_xmlFileProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _monitorFileChanges = \"monitorFileChanges\";\r\n        [ConfigurationProperty(_monitorFileChanges)]\r\n        public bool MonitorFileChanges\r\n        {\r\n            get { return (bool)base[_monitorFileChanges]; }\r\n            set { base[_monitorFileChanges] = value; }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class CultureElementCollection : ConfigurationElementCollection\r\n    {\r\n        public void Add(CulturenameConfigurationElement element)\r\n        {\r\n            BaseAdd(element);\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new CulturenameConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            return ((CulturenameConfigurationElement)element).CultureName;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class XmlStringResourceProviderAssembler : IAssembler<IResourceProvider, ResourceProviderData>\r\n    {\r\n        public IResourceProvider Assemble(IBuilderContext context, ResourceProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            XmlStringResourceProviderData data = (XmlStringResourceProviderData)objectConfiguration;\r\n\r\n            IEnumerable<CulturenameConfigurationElement> cultureElements = data.Cultures.Cast<CulturenameConfigurationElement>();\r\n\r\n            Dictionary<CultureInfo, string> cultureFiles = cultureElements.ToDictionary(k => new CultureInfo(k.CultureName), f => f.XmlFile);\r\n            Dictionary<CultureInfo, bool> cultureFileWatches = cultureElements.ToDictionary(k => new CultureInfo(k.CultureName), f => f.MonitorFileChanges);\r\n\r\n            XmlStringResourceProvider provider =\r\n                new XmlStringResourceProvider(data.DefaultCultureName, cultureFiles, cultureFileWatches, data.Name);\r\n\r\n            return provider;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/Hostnames/FormFunctions.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Routing.Hostnames\r\n{\r\n    internal class FormFunctions\r\n    {\r\n        public static IEnumerable<Tuple<object, object, string>> GetRootPages()\r\n        {\r\n            var result = new List<Tuple<object, object, string>>();\r\n\r\n            CultureInfo[] cultures = DataLocalizationFacade.ActiveLocalizationCultures.ToArray();\r\n\r\n            foreach(var culture in cultures)\r\n            {\r\n                using(new DataScope(PublicationScope.Unpublished, culture))\r\n                {\r\n                    foreach(Guid rootPageId in PageManager.GetChildrenIDs(Guid.Empty))\r\n                    {\r\n                        IPage page = PageManager.GetPageById(rootPageId);\r\n\r\n                        if(page == null) continue;\r\n\r\n                        string label = page.Title;\r\n                        if(cultures.Length > 1)\r\n                        {\r\n                            label += \", \" + culture.NativeName;\r\n                        }\r\n\r\n                        result.Add(new Tuple<object, object, string>(page.Id, culture.Name, label));\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/InternalUrlConverters/DataInternalUrlConverter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Routing.InternalUrlConverters\r\n{\r\n    class DataInternalUrlConverter: IInternalUrlConverter\r\n    {\r\n        private readonly Type _type;\r\n        private readonly Type _keyType;\r\n        private readonly ConstructorInfo _dataReferenceConstructor;\r\n\r\n\r\n        public DataInternalUrlConverter(string shortTypeName, Type type)\r\n        {\r\n            AcceptedUrlPrefixes = new[] { shortTypeName + \"(\" };\r\n            _type = type;\r\n            _keyType = _type.GetSingleKeyProperty().PropertyType;\r\n\r\n            _dataReferenceConstructor = typeof(DataReference<>).MakeGenericType(_type).GetConstructor(new[] { typeof(object) });\r\n        }\r\n\r\n\r\n        public IEnumerable<string> AcceptedUrlPrefixes { get; }\r\n\r\n\r\n        public string ToPublicUrl(string internalDataUrl, UrlSpace urlSpace)\r\n        {\r\n            object keyValue = ExtractKeyValue(internalDataUrl);\r\n            if(keyValue == null) return null;\r\n\r\n            var data = DataFacade.TryGetDataByUniqueKey(_type, keyValue);\r\n            if(data == null) return null;\r\n\r\n            var pageUrlData = DataUrls.TryGetPageUrlData(data.ToDataReference());\r\n\r\n            if (internalDataUrl.IndexOf(\"?\", StringComparison.Ordinal) > 0)\r\n            {\r\n                var parameters = new UrlBuilder(internalDataUrl).GetQueryParameters();\r\n\r\n                if (parameters.HasKeys())\r\n                {\r\n                    if (pageUrlData.QueryParameters == null)\r\n                    {\r\n                        pageUrlData.QueryParameters = parameters;\r\n                    }\r\n                    else\r\n                    {\r\n                        pageUrlData.QueryParameters.Add(parameters);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return pageUrlData != null ? PageUrls.BuildUrl(pageUrlData, UrlKind.Public, urlSpace) : null;\r\n        }\r\n\r\n\r\n        private object ExtractKeyValue(string internalDataUrl)\r\n        {\r\n            int openBracketIndex = internalDataUrl.IndexOf(\"(\", StringComparison.Ordinal);\r\n            if (openBracketIndex < 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            int closingBracketOffset = internalDataUrl.IndexOf(\")\", openBracketIndex + 1, StringComparison.Ordinal);\r\n            if (closingBracketOffset < 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string dataIdStr = internalDataUrl.Substring(openBracketIndex + 1, closingBracketOffset - openBracketIndex - 1);\r\n\r\n            object keyValue = ValueTypeConverter.Convert(dataIdStr, _keyType);\r\n\r\n            if (keyValue == null || (keyValue is Guid && (Guid)keyValue == Guid.Empty))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return keyValue;\r\n        }\r\n\r\n        public IDataReference ToDataReference(string internalDataUrl)\r\n        {\r\n            object keyValue = ExtractKeyValue(internalDataUrl);\r\n            if (keyValue == null) return null;\r\n\r\n            return (IDataReference)_dataReferenceConstructor.Invoke(new [] { keyValue });\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/InternalUrlConverters/MediaInternalUrlConverter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Specialized;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Routing.InternalUrlConverters\r\n{\r\n    internal class MediaInternalUrlConverter: IInternalUrlConverter\r\n    {\r\n        internal static readonly string DefaultMediaStore = \"MediaArchive\";\r\n        private static readonly string LogTitle = typeof (MediaInternalUrlConverter).Name;\r\n\r\n        private readonly string[] _acceptedUrlPrefixes = {\"media(\"}; \r\n\r\n        public IEnumerable<string> AcceptedUrlPrefixes\r\n        {\r\n            get { return _acceptedUrlPrefixes; }\r\n        }\r\n\r\n        public string ToPublicUrl(string internalMediaUrl, UrlSpace urlSpace)\r\n        {\r\n            int openBracketIndex = internalMediaUrl.IndexOf(\"(\", StringComparison.Ordinal);\r\n            if (openBracketIndex < 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            int closingBracketOffset = internalMediaUrl.IndexOf(\")\", openBracketIndex + 1, StringComparison.Ordinal);\r\n            if (closingBracketOffset < 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            Guid mediaId;\r\n            \r\n\r\n            string mediaStore;\r\n            string mediaIdStr = internalMediaUrl.Substring(openBracketIndex + 1, closingBracketOffset - openBracketIndex - 1);\r\n\r\n            int semicolonOffset = mediaIdStr.IndexOf(\":\", StringComparison.Ordinal);\r\n            if (semicolonOffset > 0)\r\n            {\r\n                mediaStore = mediaIdStr.Substring(0, semicolonOffset);\r\n                mediaIdStr = mediaIdStr.Substring(semicolonOffset + 1);\r\n            }\r\n            else\r\n            {\r\n                mediaStore = DefaultMediaStore;\r\n            }\r\n\r\n            if (!Guid.TryParse(mediaIdStr, out mediaId))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            UrlBuilder parsedOldUrl;\r\n\r\n            try\r\n            {\r\n                parsedOldUrl = new UrlBuilder(internalMediaUrl);\r\n            }\r\n            catch\r\n            {\r\n                Log.LogWarning(LogTitle, \"Failed to parse url '{0}'\".FormatWith(internalMediaUrl));\r\n                return null;\r\n            }\r\n\r\n            NameValueCollection queryParams = parsedOldUrl.GetQueryParameters();\r\n\r\n            return MediaUrls.BuildUrl(\r\n                new MediaUrlData\r\n                {\r\n                    MediaId = mediaId,\r\n                    MediaStore = mediaStore,\r\n                    QueryParameters = queryParams\r\n                },\r\n                UrlKind.Public);\r\n        }\r\n\r\n        public IDataReference ToDataReference(string internalUrl)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/InternalUrlConverters/PageInternalUrlConverter.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Routing.InternalUrlConverters\r\n{\r\n    /// <summary>\r\n    /// Url provider for \"internal\" page links, f.e. \"~/page({Guid})\"\r\n    /// </summary>\r\n    public class PageInternalUrlConverter: IInternalUrlConverter\r\n    {\r\n        private static readonly string LogTitle = nameof(PageInternalUrlConverter);\r\n\r\n        private readonly string[] _acceptedUrlPrefixes = { \"page(\", \"Renderers/Page.aspx\" };\r\n\r\n        /// <inheritdoc />\r\n        public IEnumerable<string> AcceptedUrlPrefixes => _acceptedUrlPrefixes;\r\n\r\n        /// <inheritdoc />\r\n        public string ToPublicUrl(string internalPageUrl, UrlSpace urlSpace)\r\n        {\r\n            PageUrlData pageUrlData;\r\n            string anchor;\r\n\r\n            try\r\n            {\r\n                anchor = new UrlBuilder(internalPageUrl).Anchor;\r\n                pageUrlData = PageUrls.UrlProvider.ParseInternalUrl(internalPageUrl);\r\n            }\r\n            catch\r\n            {\r\n                Log.LogWarning(LogTitle, \"Failed to parse url '{0}'\", internalPageUrl);\r\n                return null;\r\n            }\r\n\r\n            if (pageUrlData == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            // While viewing pages in \"unpublished\" scope, all the links should also be in the same scope\r\n            if (DataScopeManager.CurrentDataScope == DataScopeIdentifier.Administrated)\r\n            {\r\n                pageUrlData.PublicationScope = PublicationScope.Unpublished;\r\n            }\r\n\r\n            string publicPageUrl = PageUrls.BuildUrl(pageUrlData, UrlKind.Public, urlSpace);\r\n            if (publicPageUrl == null)\r\n            {\r\n                // We have this situation if page does not exist\r\n                return null;\r\n            }\r\n\r\n            if (!anchor.IsNullOrEmpty())\r\n            {\r\n                publicPageUrl += \"#\" + anchor;\r\n            }\r\n\r\n            return publicPageUrl;\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public IDataReference ToDataReference(string internalUrl)\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite/Plugins/Routing/InternalUrlProviders/DataInternalUrlProvider.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Plugins.Routing.InternalUrlProviders\r\n{\r\n    class DataInternalUrlProvider : IInternalUrlProvider\r\n    {\r\n        private readonly string _shortTypeName;\r\n        private readonly Type _type;\r\n        //private readonly Type _keyType;\r\n\r\n        public DataInternalUrlProvider(string shortTypeName, Type type)\r\n        {\r\n            _type = type;\r\n            //_keyType = type.GetKeyProperties().Single().PropertyType;\r\n            _shortTypeName = shortTypeName;\r\n        }\r\n\r\n        public string BuildInternalUrl(IDataReference reference)\r\n        {\r\n            Verify.That(reference.ReferencedType == _type, \"Incorrect type of referenced data\");\r\n\r\n            string serializedKey = ValueTypeConverter.Convert<string>(reference.KeyValue);\r\n            if (string.IsNullOrEmpty(serializedKey))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return \"~/{0}({1})\".FormatWith(_shortTypeName, serializedKey);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/MediaUrlProviders/DefaultMediaUrlProvider.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Media;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Routing.MediaUrlProviders\r\n{\r\n    /// <exclude />\r\n    public class DefaultMediaUrlProvider: IResizableImageUrlProvider\r\n    {\r\n        internal static readonly string DefaultMediaStore = \"MediaArchive\";\r\n        private static readonly string ForbiddenUrlCharacters = @\"<>*%&\\?#\"\"\";\r\n\r\n        private readonly string _storeId;\r\n\r\n        /// <exclude />\r\n        public DefaultMediaUrlProvider(string storeId)\r\n        {\r\n            _storeId = storeId;\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public bool IsSupportedStoreId(string storeId)\r\n        {\r\n            return storeId == _storeId;\r\n        }\r\n\r\n        /// <exclude />\r\n        public string GetPublicMediaUrl(string storeId, Guid mediaId)\r\n        {\r\n            return GetResizedImageUrl(storeId, mediaId, null);\r\n        }\r\n\r\n        /// <exclude />\r\n        public string GetResizedImageUrl(string storeId, Guid mediaId, ResizingOptions resizingOptions)\r\n        {\r\n            IMediaFile file = MediaUrlHelper.GetFileById(storeId, mediaId);\r\n            if (file == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string pathToFile = UrlUtils.Combine(file.FolderPath, file.FileName);\r\n\r\n            pathToFile = RemoveForbiddenCharactersAndNormalize(pathToFile);\r\n\r\n            // IIS6 doesn't have wildcard mapping by default, so removing image extension if running in \"classic\" app pool\r\n            if (!HttpRuntime.UsingIntegratedPipeline)\r\n            {\r\n                int dotOffset = pathToFile.IndexOf(\".\", StringComparison.Ordinal);\r\n                if (dotOffset >= 0)\r\n                {\r\n                    pathToFile = pathToFile.Substring(0, dotOffset);\r\n                }\r\n            }\r\n\r\n            string mediaStore = string.Empty;\r\n\r\n            if (!storeId.Equals(DefaultMediaStore, StringComparison.InvariantCultureIgnoreCase))\r\n            {\r\n                mediaStore = storeId + \"/\";\r\n            }\r\n\r\n\r\n            var url = new UrlBuilder(UrlUtils.PublicRootPath + \"/media/\" + mediaStore + /* UrlUtils.CompressGuid(*/ mediaId /*)*/)\r\n            {\r\n                PathInfo = file.LastWriteTime != null\r\n                    ? \"/\" + GetDateTimeHash(file.LastWriteTime.Value.ToUniversalTime())\r\n                    : string.Empty\r\n            };\r\n\r\n            if (pathToFile.Length > 0)\r\n            {\r\n                url.PathInfo += pathToFile;\r\n            }\r\n\r\n            if (resizingOptions != null && !resizingOptions.IsEmpty)\r\n            {\r\n                var urlWithResizing = url + \"?\" + resizingOptions;\r\n                if (!GlobalSettingsFacade.ProtectResizedImagesWithHash)\r\n                {\r\n                    return urlWithResizing;\r\n                }\r\n\r\n                return $\"{urlWithResizing}&sh={resizingOptions.GetSecureHash(mediaId)}\";\r\n            }\r\n\r\n            return url.ToString();\r\n        }\r\n\r\n\r\n        private static string GetDateTimeHash(DateTime dateTime)\r\n        {\r\n            int hash = dateTime.GetHashCode();\r\n            return Convert.ToBase64String(BitConverter.GetBytes(hash)).Substring(0, 6).Replace('+', '-').Replace('/', '_');\r\n        }\r\n\r\n\r\n        private static string RemoveForbiddenCharactersAndNormalize(string path)\r\n        {\r\n            // Replacing dots with underscores, so IIS will not intercept requests in some scenarios\r\n\r\n            string legalFilePath = RemoveFilePathIllegalCharacters(path);\r\n            string extension = Path.GetExtension(legalFilePath);\r\n\r\n            if (!MimeTypeInfo.IsIisServeable(extension))\r\n            {\r\n                path = path.Replace('.', '_');\r\n            }\r\n\r\n            path = path.Replace('+', ' ');\r\n\r\n            foreach (var ch in ForbiddenUrlCharacters)\r\n            {\r\n                path = path.Replace(ch, '#');\r\n            }\r\n\r\n            path = path.Replace(\"#\", string.Empty);\r\n\r\n            // Removing consecutive white spaces\r\n            while (path.Contains(\"  \"))\r\n            {\r\n                path = path.Replace(\"  \", \" \");\r\n            }\r\n\r\n            string[] parts = path.Split('/');\r\n\r\n            var result = new StringBuilder();\r\n            for (int i = 0; i < parts.Length; i++)\r\n            {\r\n                string trimmedPart = parts[i].Trim();\r\n                if (trimmedPart.Length > 0)\r\n                {\r\n                    result.Append(\"/\").Append(trimmedPart);\r\n                }\r\n            }\r\n\r\n            // Encoding white spaces\r\n            result.Replace(\" \", \"%20\");\r\n\r\n            return result.ToString();\r\n        }\r\n\r\n\r\n        private static string RemoveFilePathIllegalCharacters(string path)\r\n        {\r\n            path = path.Replace('\\\"', ' ').Replace('<', ' ').Replace('>', ' ').Replace('|', ' ');\r\n            for (int i = 0; i < 31; i++)\r\n            {\r\n                path = path.Replace((char)i, ' ');\r\n            }\r\n            return path;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/Pages/DefaultPageUrlProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Collections.Specialized;\r\nusing System.Text;\r\nusing System.Web;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders.Runtime;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Routing.Pages\r\n{\r\n    /// <summary>\r\n    /// Default implementation of <see cref=\"IPageUrlProvider\"/>.\r\n    /// </summary>\r\n    [ConfigurationElementType(typeof(NonConfigurablePageUrlProvider))]\r\n    public class DefaultPageUrlProvider: IPageUrlProvider\r\n    {\r\n        /// <summary>\r\n        /// Url fragment than indicates that the hostname should be ignored when resolving root page.\r\n        /// Used for internally by C1 console.\r\n        /// </summary>\r\n        public static readonly string UrlMarker_RelativeUrl = \"/c1mode(relative)\";\r\n\r\n        /// <summary>\r\n        /// URL fragment that indicates that \"unpublished\" version of the page should be shown.\r\n        /// </summary>\r\n        public static readonly string UrlMarker_Unpublished = \"/c1mode(unpublished)\";\r\n\r\n        private static readonly string InternalUrlPrefix = \"~/page(\";\r\n        private static readonly string InternalUrlPrefixResolved = UrlUtils.PublicRootPath + \"/page(\";\r\n\r\n         private static readonly Hashtable<Tuple<DataScopeIdentifier, string>, Hashtable<string, Guid>> _friendlyUrls\r\n            = new Hashtable<Tuple<DataScopeIdentifier, string>, Hashtable<string, Guid>>();\r\n\r\n        /// <summary>\r\n        /// A URL suffix, to be inserted in every page URL, f.e. \".aspx\"\r\n        /// </summary>\r\n        public static string UrlSuffix { get; private set;}\r\n\r\n        static DefaultPageUrlProvider()\r\n        {\r\n            DataEvents<IPage>.OnAfterAdd += (a, b) => UpdateFriendlyUrl((IPage) b.Data);\r\n            DataEvents<IPage>.OnAfterUpdate += (a, b) => UpdateFriendlyUrl((IPage) b.Data);\r\n            DataEvents<IPage>.OnStoreChanged += (sender, args) =>\r\n            {\r\n                if (!args.DataEventsFired)\r\n                {\r\n                    lock (_friendlyUrls) _friendlyUrls.Clear();\r\n                }\r\n            };\r\n\r\n            DataEvents<IHostnameBinding>.OnAfterAdd += (a, b) => _hostnameBindings = null;\r\n            DataEvents<IHostnameBinding>.OnAfterUpdate += (a, b) => _hostnameBindings = null;\r\n            DataEvents<IHostnameBinding>.OnDeleted += (a, b) => _hostnameBindings = null;\r\n\r\n            DataEvents<IUrlConfiguration>.OnStoreChanged += (a, b) => LoadUrlSuffix();\r\n        }\r\n\r\n        \r\n        /// <summary>\r\n        /// Creates a new instance of <see cref=\"DefaultPageUrlProvider\" />\r\n        /// </summary>\r\n        public DefaultPageUrlProvider()\r\n        {\r\n            LoadUrlSuffix();\r\n        }\r\n\r\n        private static void LoadUrlSuffix()\r\n        {\r\n            UrlSuffix = DataFacade.GetData<IUrlConfiguration>()\r\n                                  .Select(c => c.PageUrlSuffix).FirstOrDefault() ?? string.Empty;\r\n        }\r\n\r\n\r\n        /// <inheritdoc />\r\n        [Obsolete]\r\n        public IPageUrlBuilder CreateUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace)\r\n        {\r\n            return new PageUrlBuilder(publicationScope, localizationScope, urlSpace);\r\n        }\r\n\r\n        private static IReadOnlyCollection<IHostnameBinding> _hostnameBindings;\r\n        private static readonly object _hostnameBindingsSyncRoot = new object();\r\n\r\n        private static IReadOnlyCollection<IHostnameBinding> GetHostnameBindings()\r\n        {\r\n            var result = _hostnameBindings;\r\n            if (result == null)\r\n            {\r\n                lock (_hostnameBindingsSyncRoot)\r\n                {\r\n                    result = _hostnameBindings;\r\n\r\n                    if (result == null)\r\n                    {\r\n                        _hostnameBindings = result = new ReadOnlyCollection<IHostnameBinding>(\r\n                            DataFacade.GetData<IHostnameBinding>().ToList());\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public bool IsInternalUrl(string relativeUrl)\r\n        {\r\n            string decodedRelativeUrl = HttpUtility.UrlDecode(relativeUrl);\r\n\r\n            return IsPageRendererRequest(new UrlBuilder(relativeUrl).FilePath)\r\n                || decodedRelativeUrl.StartsWith(InternalUrlPrefix, true)\r\n                || decodedRelativeUrl.StartsWith(InternalUrlPrefixResolved, true);\r\n        }\r\n\r\n        internal static bool IsPageRendererRequest(string filePath)\r\n        {\r\n            return filePath.EndsWith(\"Renderers/Page.aspx\", true);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public PageUrlData ParseInternalUrl(string relativeUrl)\r\n        {\r\n            return ParseInternalUrl(relativeUrl, out _);\r\n        }\r\n\r\n        private PageUrlData ParseInternalUrl(string relativeUrl, out UrlKind urlKind)\r\n        {\r\n            var urlBuilder = new UrlBuilder(relativeUrl);\r\n\r\n            if (IsPageRendererRequest(urlBuilder.FilePath))\r\n            {\r\n                urlKind = UrlKind.Renderer;\r\n                return ParseRendererUrl(urlBuilder);\r\n            }\r\n\r\n            urlKind = UrlKind.Undefined;\r\n\r\n            string decodedPath = HttpUtility.UrlDecode(urlBuilder.FullPath);\r\n\r\n            string prefix = InternalUrlPrefix;\r\n\r\n            if (!decodedPath.StartsWith(prefix, true))\r\n            {\r\n                prefix = InternalUrlPrefixResolved;\r\n                if (!decodedPath.StartsWith(prefix, true))\r\n                {\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            int closingBracketOffset = decodedPath.IndexOf(')');\r\n            if (closingBracketOffset < 0)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            Guid pageId;\r\n            if (!Guid.TryParse(decodedPath.Substring(prefix.Length, closingBracketOffset - prefix.Length), out pageId))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            string pathInfo = decodedPath.Substring(closingBracketOffset + 1);\r\n            if (pathInfo.Length > 0 && pathInfo[0] != '/')\r\n            {\r\n                return null;\r\n            }\r\n\r\n            bool isUnpublished = pathInfo.Contains(UrlMarker_Unpublished);\r\n            if (isUnpublished)\r\n            {\r\n                pathInfo = pathInfo.Replace(UrlMarker_Unpublished, string.Empty);\r\n            }\r\n\r\n            NameValueCollection queryString = urlBuilder.GetQueryParameters();\r\n            string cultureInfoStr = queryString[\"cultureInfo\"];\r\n\r\n            CultureInfo cultureInfo;\r\n            if (!cultureInfoStr.IsNullOrEmpty())\r\n            {\r\n                cultureInfo = new CultureInfo(cultureInfoStr);\r\n            }\r\n            else\r\n            {\r\n                cultureInfo = LocalizationScopeManager.CurrentLocalizationScope;\r\n                if (cultureInfo.Equals(CultureInfo.InvariantCulture))\r\n                {\r\n                    cultureInfo = DataLocalizationFacade.DefaultLocalizationCulture;\r\n                }\r\n            }\r\n\r\n            queryString.Remove(\"cultureInfo\");\r\n\r\n            urlKind = UrlKind.Internal;\r\n\r\n            return new PageUrlData(pageId, isUnpublished ? PublicationScope.Unpublished : PublicationScope.Published, cultureInfo)\r\n            {\r\n                PathInfo = pathInfo,\r\n                QueryParameters = queryString\r\n            };\r\n        }\r\n\r\n        private static PageUrlData ParseRendererUrl(UrlBuilder urlBuilder)\r\n        {\r\n            NameValueCollection queryString = urlBuilder.GetQueryParameters();\r\n\r\n            Verify.That(!string.IsNullOrEmpty(queryString[\"pageId\"]), \"Invalid query string. The 'pageId' parameter of the GUID type is expected.\");\r\n\r\n            string dataScopeName = queryString[\"dataScope\"];\r\n\r\n            PublicationScope publicationScope = PublicationScope.Published;\r\n\r\n            if (dataScopeName != null\r\n                && string.Compare(dataScopeName, DataScopeIdentifier.AdministratedName, StringComparison.OrdinalIgnoreCase) == 0)\r\n            {\r\n                publicationScope = PublicationScope.Unpublished;\r\n            }\r\n\r\n\r\n            string cultureInfoStr = queryString[\"cultureInfo\"];\r\n            if (cultureInfoStr.IsNullOrEmpty())\r\n            {\r\n                cultureInfoStr = queryString[\"CultureInfo\"];\r\n            }\r\n\r\n            CultureInfo cultureInfo;\r\n            if (!cultureInfoStr.IsNullOrEmpty())\r\n            {\r\n                cultureInfo = new CultureInfo(cultureInfoStr);\r\n            }\r\n            else\r\n            {\r\n                cultureInfo = LocalizationScopeManager.CurrentLocalizationScope;\r\n                if (cultureInfo.Equals(CultureInfo.InvariantCulture))\r\n                {\r\n                    cultureInfo = DataLocalizationFacade.DefaultLocalizationCulture;\r\n                }\r\n            }\r\n\r\n            Guid pageId = new Guid(queryString[\"pageId\"]);\r\n\r\n            var queryParameters = new NameValueCollection();\r\n\r\n            var queryKeys = new[] { \"pageId\", \"dataScope\", \"cultureInfo\", \"CultureInfo\" };\r\n\r\n            var notUsedKeys = queryString.AllKeys.Where(key => !queryKeys.Contains(key, StringComparer.OrdinalIgnoreCase));\r\n\r\n            foreach (string key in notUsedKeys)\r\n            {\r\n                queryParameters.Add(key, queryString[key]);\r\n            }\r\n\r\n            string pathInfo = urlBuilder.PathInfo != null ? HttpUtility.UrlDecode(urlBuilder.PathInfo) : null;\r\n\r\n            return new PageUrlData(pageId, publicationScope, cultureInfo)\r\n            {\r\n                PathInfo = pathInfo,\r\n                QueryParameters = queryParameters,\r\n            };\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public PageUrlData ParseUrl(string absoluteUrl, out UrlKind urlKind)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(absoluteUrl, \"absoluteUrl\");\r\n\r\n            // Converting links \r\n            // \"http://localhost\" to \"http://localhost/\"\r\n            // \"http://localhost?...\" to \"http://localhost/?...\"\r\n            if((absoluteUrl.Count(c => c == '/') == 2) && absoluteUrl.Contains(\"//\"))\r\n            {\r\n                int questionMarkIndex = absoluteUrl.IndexOf('?');\r\n                if(questionMarkIndex > 0)\r\n                {\r\n                    absoluteUrl = absoluteUrl.Insert(questionMarkIndex, \"/\");\r\n                }\r\n                else\r\n                {\r\n                    absoluteUrl += \"/\";\r\n                }\r\n            }\r\n\r\n            Uri uri = new Uri(absoluteUrl);\r\n\r\n            string hostname = uri.DnsSafeHost;\r\n            if(!IsKnownHostname(hostname))\r\n            {\r\n                urlKind = UrlKind.Undefined;\r\n                return null;\r\n            }\r\n\r\n            string serverUrl = new UrlBuilder(absoluteUrl).ServerUrl;\r\n            string relativeUrl = absoluteUrl.Substring(serverUrl.Length - 1);\r\n\r\n            var urlSpace = new UrlSpace(hostname, relativeUrl);\r\n\r\n            return ParseUrl(relativeUrl, urlSpace, out urlKind);\r\n        }\r\n\r\n        private bool IsKnownHostname(string hostname)\r\n        {\r\n            var context = HttpContext.Current;\r\n            if(context != null && context.Request.Url.DnsSafeHost == hostname)\r\n            {\r\n                return true;\r\n            }\r\n\r\n            return GetHostnameBindings().Any(b => b.Hostname == hostname);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public PageUrlData ParseUrl(string relativeUrl, UrlSpace urlSpace, out UrlKind urlKind)\r\n        {\r\n            if (IsInternalUrl(relativeUrl))\r\n            {\r\n                return ParseInternalUrl(relativeUrl, out urlKind);\r\n            }\r\n\r\n            var urlBuilder = new UrlBuilder(relativeUrl);\r\n\r\n            // Structure of a public url:\r\n            // http[s]://<hostname>[/<ApplicationVirtualPath>]{/<languageCode>}[/<Path to a page>][/c1mode(unpublished)][/c1mode(relative)][<UrlSuffix>][/<PathInfo>]\r\n\r\n            string filePathAndPathInfo = HttpUtility.UrlDecode(urlBuilder.FullPath);\r\n\r\n            filePathAndPathInfo = RemoveForceRelativeUrlMarker(filePathAndPathInfo, urlSpace);\r\n            filePathAndPathInfo = ParseAndRemovePublicationScopeMarker(filePathAndPathInfo, out PublicationScope publicationScope);\r\n\r\n            CultureInfo locale;\r\n            string pathWithoutLanguageCode;\r\n\r\n            IHostnameBinding hostnameBinding = urlSpace.ForceRelativeUrls ? null : GetHostnameBindings().FirstOrDefault(b => b.Hostname == urlSpace.Hostname);\r\n\r\n            if (hostnameBinding != null && filePathAndPathInfo == \"/\")\r\n            {\r\n                pathWithoutLanguageCode = \"/\";\r\n                locale = CultureInfo.GetCultureInfo(hostnameBinding.Culture);\r\n            }\r\n            else\r\n            {\r\n                locale = GetCultureInfo(filePathAndPathInfo, hostnameBinding, out pathWithoutLanguageCode);\r\n                if (locale == null)\r\n                {\r\n                    urlKind = UrlKind.Undefined;\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            using (new DataScope(publicationScope, locale))\r\n            {\r\n                bool isObsolete = false;\r\n                string pathToResolve = pathWithoutLanguageCode;\r\n\r\n                // Supporting obsolete \"*.aspx\" urls\r\n                if (!string.Equals(UrlSuffix, \".aspx\", StringComparison.OrdinalIgnoreCase) \r\n                    && (pathToResolve.Contains(\".aspx/\") || pathToResolve.EndsWith(\".aspx\")))\r\n                {\r\n                    pathToResolve = pathToResolve.Replace(\".aspx\", UrlSuffix);\r\n                    isObsolete = true;\r\n                }\r\n\r\n                PageUrlData data = ParsePagePath(pathToResolve, publicationScope, locale, hostnameBinding);\r\n                if (data != null)\r\n                {\r\n                    urlKind = !isObsolete ? UrlKind.Public : UrlKind.Redirect;\r\n                    data.QueryParameters = urlBuilder.GetQueryParameters();\r\n                    return data;\r\n                }\r\n\r\n                Guid friendlyUrlPageId = ParseFriendlyUrlPath(pathWithoutLanguageCode);\r\n                if (friendlyUrlPageId != Guid.Empty)\r\n                {\r\n                    urlKind = UrlKind.Friendly;\r\n                    return new PageUrlData(friendlyUrlPageId, publicationScope, locale) {QueryParameters = urlBuilder.GetQueryParameters()};\r\n                }\r\n            }\r\n\r\n            urlKind = UrlKind.Undefined;\r\n            return null;\r\n        }\r\n\r\n        private Guid ParseFriendlyUrlPath(string pathWithoutLanguageCode)\r\n        {\r\n            if (pathWithoutLanguageCode.Length <= 1)\r\n            {\r\n                return Guid.Empty;\r\n            }\r\n\r\n            var map = GetFriendlyUrlsMap();\r\n\r\n            string friendlyUrl1 = pathWithoutLanguageCode.ToLowerInvariant();\r\n            string friendlyUrl2 = \"~\" + friendlyUrl1;\r\n            string friendlyUrl3 = friendlyUrl1.Substring(1);\r\n\r\n            Guid pageId;\r\n\r\n            if (map.TryGetValue(friendlyUrl1, out pageId)\r\n                || map.TryGetValue(friendlyUrl2, out pageId)\r\n                || map.TryGetValue(friendlyUrl3, out pageId))\r\n            {\r\n                return pageId;\r\n            }\r\n\r\n            return Guid.Empty;\r\n        }\r\n\r\n        private static Hashtable<string, Guid> GetFriendlyUrlsMap()\r\n        {\r\n            var scopeKey = new Tuple<DataScopeIdentifier, string>(DataScopeManager.CurrentDataScope, LocalizationScopeManager.CurrentLocalizationScope.Name);\r\n\r\n            return _friendlyUrls.GetOrAddSync(scopeKey, a =>\r\n            {\r\n                var result = new Hashtable<string, Guid>();\r\n                foreach (var pair in DataFacade.GetData<IPage>().Where(p => !(p.FriendlyUrl == null || p.FriendlyUrl == string.Empty))\r\n                    .Select(p => new {p.Id, p.FriendlyUrl}))\r\n                {\r\n                    result[pair.FriendlyUrl.ToLowerInvariant()] = pair.Id;\r\n                }\r\n                return result;\r\n            });\r\n        }\r\n\r\n        private static void UpdateFriendlyUrl(IPage page)\r\n        {\r\n            if (string.IsNullOrEmpty(page.FriendlyUrl))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var scopeKey = new Tuple<DataScopeIdentifier, string>(page.DataSourceId.DataScopeIdentifier, page.DataSourceId.LocaleScope.Name);\r\n\r\n            Hashtable<string, Guid> friendlyUrlsMap;\r\n            if(!_friendlyUrls.TryGetValue(scopeKey, out friendlyUrlsMap))\r\n            {\r\n                return;\r\n            }\r\n\r\n            lock (friendlyUrlsMap)\r\n            {\r\n                friendlyUrlsMap[page.FriendlyUrl.ToLowerInvariant()] = page.Id;\r\n            }\r\n        }\r\n\r\n        private PageUrlData ParsePagePath(string pagePath, PublicationScope publicationScope, CultureInfo locale, IHostnameBinding hostnameBinding)\r\n        {\r\n            // Parsing what's left:\r\n            // [/Path to a page][UrlSuffix]{/PathInfo}\r\n            string pathInfo = null;\r\n\r\n            bool canBePublicUrl = true;\r\n            bool pathInfoExtracted = false;\r\n\r\n            if (!string.IsNullOrEmpty(UrlSuffix))\r\n            {\r\n                string urlSuffixPlusSlash = UrlSuffix + \"/\";\r\n\r\n                int suffixOffset = pagePath.IndexOf(urlSuffixPlusSlash, StringComparison.OrdinalIgnoreCase);\r\n                if (suffixOffset > 0)\r\n                {\r\n                    pathInfo = pagePath.Substring(suffixOffset + UrlSuffix.Length);\r\n                    pagePath = pagePath.Substring(0, suffixOffset);\r\n\r\n                    pathInfoExtracted = true;\r\n                }\r\n                else if (pagePath.EndsWith(UrlSuffix, StringComparison.OrdinalIgnoreCase))\r\n                {\r\n                    pagePath = pagePath.Substring(0, pagePath.Length - UrlSuffix.Length);\r\n\r\n                    pathInfoExtracted = true;\r\n                }\r\n                else\r\n                {\r\n                    canBePublicUrl = pagePath == \"/\"; // Only root page may not have a UrlSuffix\r\n                }\r\n            }\r\n\r\n            if (canBePublicUrl)\r\n            {\r\n                IPage page = TryGetPageByUrlTitlePath(pagePath, pathInfoExtracted, hostnameBinding, ref pathInfo);\r\n\r\n                if (page != null)\r\n                {\r\n                    return new PageUrlData(page.Id, publicationScope, page.DataSourceId.LocaleScope)\r\n                    {\r\n                        VersionId = page.VersionId,\r\n                        PathInfo = pathInfo\r\n                    };\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private IPage TryGetPageByUrlTitlePath(string pagePath, bool pathInfoExtracted, IHostnameBinding hostnameBinding, ref string pathInfo)\r\n        {\r\n            string[] pageUrlTitles = pagePath.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);\r\n\r\n            if (pageUrlTitles.Length == 0)\r\n            {\r\n                if (hostnameBinding != null)\r\n                {\r\n                    IPage rootPage = PageManager.GetPageById(hostnameBinding.HomePageId, true);\r\n                    if (rootPage != null && \r\n                        (!hostnameBinding.IncludeHomePageInUrl || string.IsNullOrEmpty(rootPage.UrlTitle)))\r\n                    {\r\n                        return rootPage;\r\n                    }\r\n\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            IEnumerable<IPage> rootPages = GetChildPages(Guid.Empty);\r\n            if (pageUrlTitles.Length == 0)\r\n            {\r\n                return rootPages.FirstOrDefault(p => string.IsNullOrEmpty(p.UrlTitle));\r\n            }\r\n\r\n            string firstUrlTitle = pageUrlTitles[0];\r\n\r\n            IPage firstPage = null;\r\n\r\n            if (hostnameBinding != null)\r\n            {\r\n                IPage rootPage = PageManager.GetPageById(hostnameBinding.HomePageId, true);\r\n\r\n                bool rootPageIsOmitted = rootPage != null && (!hostnameBinding.IncludeHomePageInUrl || string.IsNullOrEmpty(rootPage.UrlTitle));\r\n                if (rootPageIsOmitted)\r\n                {\r\n                    firstPage = FindMatchingPage(rootPage.Id, firstUrlTitle);\r\n                }\r\n            }\r\n\r\n            if (firstPage == null)\r\n            {\r\n                IPage defaultRootPage = rootPages.FirstOrDefault(p => string.IsNullOrEmpty(p.UrlTitle));\r\n                if (defaultRootPage != null)\r\n                {\r\n                    firstPage = FindMatchingPage(defaultRootPage.Id, firstUrlTitle);\r\n                }\r\n\r\n                if (firstPage == null)\r\n                {\r\n                    // Searching the first pageId among root pages\r\n                    firstPage = FindMatchingPage(Guid.Empty, firstUrlTitle);\r\n                }\r\n                \r\n                if (firstPage == null) return null;\r\n            }\r\n\r\n            IPage currentPage = firstPage;\r\n\r\n            if (pageUrlTitles.Length == 1) return currentPage;\r\n\r\n            for (int i = 1; i < pageUrlTitles.Length; i++)\r\n            {\r\n                IPage nextPage = FindMatchingPage(currentPage.Id, pageUrlTitles[i]);\r\n                if (nextPage == null)\r\n                {\r\n                    if (pathInfoExtracted) return null;\r\n\r\n                    pathInfo = \"/\" + string.Join(\"/\", pageUrlTitles.Skip(i));\r\n                    return currentPage;\r\n                }\r\n\r\n                currentPage = nextPage;\r\n            }\r\n\r\n            return currentPage;\r\n        }\r\n\r\n        /// <xmlignore />\r\n        protected virtual IPage FindMatchingPage(Guid parentId, string urlTitle)\r\n        {\r\n            foreach (var page in GetChildPages(parentId))\r\n            {\r\n                if(string.Equals(page.UrlTitle, urlTitle, StringComparison.OrdinalIgnoreCase))\r\n                {\r\n                    return page;\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        /// <xmlignore />\r\n        protected virtual IEnumerable<IPage> GetChildPages(Guid parentId)\r\n        {\r\n            var children = PageManager.GetChildrenIDs(parentId);\r\n\r\n            for (int i=0; i<children.Count; i++)\r\n            {\r\n                var page = PageManager.GetPageById(children[i], true);\r\n\r\n                if (page != null)\r\n                {\r\n                    yield return page;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private static string RemoveForceRelativeUrlMarker(string filePath, UrlSpace urlSpace)\r\n        {\r\n            if (urlSpace.ForceRelativeUrls && filePath.Contains(UrlMarker_RelativeUrl))\r\n            {\r\n                filePath = filePath.Replace(UrlMarker_RelativeUrl, string.Empty);\r\n            }\r\n\r\n            if (filePath == string.Empty)\r\n            {\r\n                filePath = \"/\";\r\n            }\r\n\r\n            return filePath;\r\n        }\r\n\r\n        private static string ParseAndRemovePublicationScopeMarker(string filePath, out PublicationScope publicationScope)\r\n        {\r\n            publicationScope = PublicationScope.Published;\r\n\r\n            if (filePath.Contains(UrlMarker_Unpublished))\r\n            {\r\n                publicationScope = PublicationScope.Unpublished;\r\n\r\n                filePath = filePath.Replace(UrlMarker_Unpublished, string.Empty);\r\n                if (filePath == string.Empty)\r\n                {\r\n                    filePath = \"/\";\r\n                }\r\n            }\r\n\r\n            return filePath;\r\n        }\r\n\r\n        internal static CultureInfo GetCultureInfo(string requestPath, IHostnameBinding hostnameBinding, out string pathWithoutLanguageAndAppRoot)\r\n        {\r\n            int startIndex = requestPath.IndexOf('/', UrlUtils.PublicRootPath.Length) + 1;\r\n\r\n            if (startIndex > 0 && requestPath.Length > startIndex)\r\n            {\r\n                int endIndex = requestPath.IndexOf('/', startIndex + 1) - 1;\r\n                if(endIndex < 0)\r\n                {\r\n                    endIndex = requestPath.Length - 1;\r\n                }\r\n                \r\n                if (endIndex > startIndex)\r\n                {\r\n                    string urlMappingName = requestPath.Substring(startIndex, endIndex - startIndex + 1);\r\n\r\n                    if (DataLocalizationFacade.UrlMappingNames.Any(um => String.Equals(um, urlMappingName, StringComparison.OrdinalIgnoreCase)))\r\n                    {\r\n                        CultureInfo cultureInfo = DataLocalizationFacade.GetCultureInfoByUrlMappingName(urlMappingName);\r\n\r\n                        bool exists = DataLocalizationFacade.ActiveLocalizationNames.Contains(cultureInfo.Name);\r\n\r\n                        if (exists)\r\n                        {\r\n                            pathWithoutLanguageAndAppRoot = requestPath.Substring(endIndex + 1);\r\n                            return cultureInfo;\r\n                        }\r\n\r\n                        // Culture is inactive\r\n                        pathWithoutLanguageAndAppRoot = null;\r\n                        return null;\r\n                    }\r\n                }\r\n            }\r\n\r\n            pathWithoutLanguageAndAppRoot = requestPath.Substring(UrlUtils.PublicRootPath.Length);\r\n\r\n            if (hostnameBinding != null && !hostnameBinding.IncludeCultureInUrl)\r\n            {\r\n                return new CultureInfo(hostnameBinding.Culture);\r\n            }\r\n\r\n            return DataLocalizationFacade.DefaultUrlMappingCulture;\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        public virtual string BuildUrl(PageUrlData pageUrlData, UrlKind urlKind, UrlSpace urlSpace)\r\n        {\r\n            Verify.ArgumentCondition(urlKind != UrlKind.Undefined, \"urlKind\", \"Url kind is undefined\");\r\n\r\n            /*var page = pageUrlData.Data;\r\n            Verify.ArgumentCondition(page != null, \"urlData\", \"Failed to get page from UrlData<IPage>\");*/\r\n\r\n            if (urlKind == UrlKind.Public)\r\n            {\r\n                return BuildPublicUrl(pageUrlData, urlSpace);\r\n            }\r\n\r\n            if (urlKind == UrlKind.Renderer)\r\n            {\r\n                return BuildRenderUrl(pageUrlData);\r\n            }\r\n\r\n            if (urlKind == UrlKind.Internal)\r\n            {\r\n                return BuildInternalUrl(pageUrlData);\r\n            }\r\n\r\n            throw new NotImplementedException(\"Only 'Public' and 'Internal' url types are supported.\");\r\n        }\r\n\r\n        protected string BuildPublicUrl(PageUrlData pageUrlData, UrlSpace urlSpace)\r\n        {\r\n            var cultureInfo = pageUrlData.LocalizationScope;\r\n            var publicationScope = pageUrlData.PublicationScope;\r\n\r\n            var pageUrlPath = new StringBuilder();\r\n\r\n            using (new DataScope(publicationScope, cultureInfo))\r\n            {\r\n                if (!BuildPageUrlPath(pageUrlData.PageId, pageUrlData.VersionId, cultureInfo, urlSpace, pageUrlPath))\r\n                {\r\n                    return null;\r\n                }\r\n            }\r\n\r\n            if (publicationScope == PublicationScope.Unpublished)\r\n            {\r\n                AppendUrlPart(pageUrlPath, UrlMarker_Unpublished);\r\n            }\r\n\r\n            if (urlSpace.ForceRelativeUrls)\r\n            {\r\n                AppendUrlPart(pageUrlPath, UrlMarker_RelativeUrl);\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(UrlSuffix) \r\n                && pageUrlPath[pageUrlPath.Length - 1] != '/')\r\n            {\r\n                pageUrlPath.Append(UrlSuffix);\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(pageUrlData.PathInfo))\r\n            {\r\n                AppendPathInfo(pageUrlPath, pageUrlData.PathInfo);\r\n            }\r\n\r\n\r\n            string url = pageUrlPath.ToString();\r\n\r\n            if (pageUrlData.QueryParameters != null)\r\n            {\r\n                var urlWithQuery = new UrlBuilder(url);\r\n                urlWithQuery.AddQueryParameters(pageUrlData.QueryParameters);\r\n\r\n                return urlWithQuery;\r\n            }\r\n\r\n            return url;\r\n        }\r\n\r\n        protected virtual bool BuildPageUrlPath(Guid pageId, Guid? versionId, CultureInfo culture, UrlSpace urlSpace, StringBuilder result)\r\n        {\r\n            IPage page;\r\n            if (versionId != null)\r\n            {\r\n                page = PageManager.GetPageById(pageId, versionId.Value, true);\r\n            }\r\n            else\r\n            {\r\n                page = PageManager.GetPageById(pageId, true);\r\n            }\r\n\r\n            if (page == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            Guid parentPageId = PageManager.GetParentId(pageId);\r\n            if (parentPageId == Guid.Empty)\r\n            {\r\n                return BuildRootPageUrl(page, culture, urlSpace, result);\r\n            }\r\n\r\n            if (!BuildPageUrlPath(parentPageId, null, culture, urlSpace, result))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            Verify.That(result.Length >= 1, \"Parent page urls is empty\");\r\n\r\n            AppendSlash(result);\r\n            result.Append(page.UrlTitle);\r\n\r\n            return true;\r\n        }\r\n\r\n        protected bool BuildRootPageUrl(IPage rootPage, CultureInfo cultureInfo, UrlSpace urlSpace, StringBuilder result)\r\n        {\r\n            var bindings = GetHostnameBindings();\r\n\r\n            bool knownHostname = urlSpace.Hostname != null\r\n                                 && bindings.Any(b => b.Hostname == urlSpace.Hostname);\r\n\r\n            IHostnameBinding hostnameBinding = null;\r\n\r\n            // Searching for a hostname binding matching either the root page, or current hostname/UrlSpace\r\n            if (!urlSpace.ForceRelativeUrls && knownHostname)\r\n            {\r\n                Guid pageId = rootPage.Id;\r\n                string host = urlSpace.Hostname;\r\n                string cultureName = cultureInfo.Name;\r\n\r\n                hostnameBinding =\r\n                    bindings.FirstOrDefault(b => b.HomePageId == pageId && b.Hostname == host && b.Culture == cultureName)\r\n                    ?? bindings.FirstOrDefault(b => b.HomePageId == pageId && b.Culture == cultureName)\r\n                    ?? bindings.FirstOrDefault(b => b.HomePageId == pageId && b.Hostname == host)\r\n                    ?? bindings.FirstOrDefault(b => b.HomePageId == pageId);\r\n\r\n                if (hostnameBinding != null)\r\n                {\r\n                    if (hostnameBinding.Hostname != urlSpace.Hostname)\r\n                    {\r\n                        result.AppendFormat(\"http{0}://\", hostnameBinding.EnforceHttps ? \"s\" : \"\")\r\n                              .Append(hostnameBinding.Hostname);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    hostnameBinding = bindings.FirstOrDefault(b => b.Hostname == urlSpace.Hostname);\r\n                }\r\n            }\r\n\r\n            result.Append(UrlUtils.PublicRootPath);\r\n\r\n            string cultureUrlMapping = DataLocalizationFacade.GetUrlMappingName(cultureInfo);\r\n\r\n            if (cultureUrlMapping != string.Empty\r\n                && (hostnameBinding == null \r\n                    || hostnameBinding.IncludeCultureInUrl \r\n                    || hostnameBinding.Culture != cultureInfo.Name))\r\n            {\r\n                result.Append(\"/\").Append(cultureUrlMapping);\r\n            }\r\n\r\n\r\n            AppendSlash(result);\r\n\r\n            if (rootPage.UrlTitle != string.Empty \r\n                && (hostnameBinding == null || hostnameBinding.IncludeHomePageInUrl || hostnameBinding.HomePageId != rootPage.Id))\r\n            {\r\n                result.Append(rootPage.UrlTitle);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        protected static StringBuilder AppendSlash(StringBuilder sb)\r\n        {\r\n            if (sb.Length == 0\r\n                || sb[sb.Length - 1] != '/')\r\n            {\r\n                sb.Append('/');\r\n            }\r\n\r\n            return sb;\r\n        }\r\n\r\n        private static StringBuilder AppendUrlPart(StringBuilder sb, string urlPart)\r\n        {\r\n            bool endsWithSlash = sb.Length != 0 && sb[sb.Length - 1] == '/';\r\n            bool startsWithSlash = urlPart.StartsWith(\"/\", StringComparison.Ordinal);\r\n\r\n            if (endsWithSlash != startsWithSlash)\r\n            {\r\n                return sb.Append(urlPart);\r\n            }\r\n\r\n            if (endsWithSlash)\r\n            {\r\n                return sb.Append(urlPart, 1, urlPart.Length - 1);\r\n            }\r\n\r\n            return sb.Append('/').Append(urlPart);\r\n        }\r\n\r\n        private static StringBuilder AppendPathInfo(StringBuilder sb, string pathInfo)\r\n        {\r\n            if (string.IsNullOrEmpty(pathInfo))\r\n            {\r\n                return sb;\r\n            }\r\n\r\n            Verify.That(pathInfo[0] == '/', \"pathInfo has to start with '/' character\");\r\n\r\n            bool endsWithSlash = sb.Length != 0 && sb[sb.Length - 1] == '/';\r\n            if (!endsWithSlash)\r\n            {\r\n                sb.Append('/');\r\n            }\r\n\r\n            var parts = pathInfo.Split('/');\r\n\r\n            bool isFirst = true;\r\n            foreach (var pathInfoPart in parts.Skip(1))\r\n            {\r\n                if (!isFirst)\r\n                {\r\n                    sb.Append('/');\r\n                }\r\n\r\n                sb.Append(UrlBuilder.DefaultHttpEncoder.UrlPathEncode(pathInfoPart));\r\n\r\n                isFirst = false;\r\n            }\r\n\r\n            return sb;\r\n        }\r\n\r\n        protected virtual string BuildRenderUrl(PageUrlData pageUrlData)\r\n        {\r\n            var cultureInfo = pageUrlData.LocalizationScope;\r\n            string legacyScopeName = GetLegacyPublicationScopeIdentifier(pageUrlData.PublicationScope);\r\n\r\n            string basePath = UrlUtils.ResolvePublicUrl(\"Renderers/Page.aspx\");\r\n            var result = new UrlBuilder(basePath);\r\n\r\n            result[\"pageId\"] = pageUrlData.PageId.ToString();\r\n            result[\"cultureInfo\"] = cultureInfo.ToString();\r\n            result[\"dataScope\"] = legacyScopeName;\r\n\r\n            result.PathInfo = pageUrlData.PathInfo;\r\n            if (pageUrlData.QueryParameters != null)\r\n            {\r\n                result.AddQueryParameters(pageUrlData.QueryParameters);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static string BuildInternalUrl(PageUrlData pageUrlData)\r\n        {\r\n            var cultureInfo = pageUrlData.LocalizationScope;\r\n            var publicationScope = pageUrlData.PublicationScope;\r\n\r\n            var result = new UrlBuilder(\"~/page(\" + pageUrlData.PageId + \")\");\r\n\r\n            string pathInfo = string.Empty;\r\n\r\n            if (publicationScope == PublicationScope.Unpublished)\r\n            {\r\n                pathInfo = UrlMarker_Unpublished;\r\n            }\r\n\r\n            if (!pageUrlData.PathInfo.IsNullOrEmpty())\r\n            {\r\n                pathInfo += pageUrlData.PathInfo;\r\n            }\r\n            result.PathInfo = pathInfo;\r\n\r\n            result[\"cultureInfo\"] = cultureInfo.ToString();\r\n\r\n            if (pageUrlData.QueryParameters != null)\r\n            {\r\n                result.AddQueryParameters(pageUrlData.QueryParameters);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static string GetLegacyPublicationScopeIdentifier(PublicationScope publicationScope)\r\n        {\r\n            return publicationScope == PublicationScope.Published ? \"public\" : \"administrated\";\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/Pages/PageUrlBuilder.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Plugins.PageUrlsProviders;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Routing.Pages\r\n{\r\n    [Obsolete]\r\n    internal class PageUrlBuilder: IPageUrlBuilder\r\n    {\r\n        private static readonly string LogTitle = typeof (PageUrlBuilder).FullName;\r\n\r\n        private readonly Hashtable<Guid, string> _folderPaths = new Hashtable<Guid, string>();\r\n        private readonly Hashtable<Guid, string> _redirectFolderPaths = new Hashtable<Guid, string>();\r\n\r\n        public Hashtable<string, Guid> UrlToIdLookup = new Hashtable<string, Guid>();\r\n        public Hashtable<string, Guid> UrlToIdLookupLowerCased = new Hashtable<string, Guid>();\r\n        public Hashtable<string, Guid> RedirectUrlToIdLookupLowerCased = new Hashtable<string, Guid>();\r\n        public Hashtable<string, Guid> FriendlyUrlToIdLookup = new Hashtable<string, Guid>();\r\n        public Hashtable<Guid, string> IdToUrlLookup = new Hashtable<Guid, string>();\r\n\r\n        private readonly UrlSpace _urlSpace;\r\n        private readonly bool _forceRelativeUrls;\r\n\r\n        // public Hashtable<Guid, IHostnameBinding> HostnameBindings = new Hashtable<Guid, IHostnameBinding>();\r\n        private readonly List<IHostnameBinding> _hostnameBindings = new List<IHostnameBinding>();\r\n\r\n        private readonly IHostnameBinding _hostnameBinding;\r\n\r\n        private readonly PublicationScope _publicationScope;\r\n        private readonly CultureInfo _localizationScope;\r\n\r\n        private readonly string _friendlyUrlPrefix;\r\n        private readonly string _friendlyUrlPrefixWithLanguageCode;\r\n\r\n        private static readonly HashSet<string> _knownNotUniqueUrls = new HashSet<string>();\r\n\r\n        public string UrlSuffix { get; private set;}\r\n        \r\n        public PageUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace)\r\n        {\r\n            _publicationScope = publicationScope;\r\n            _localizationScope = localizationScope;\r\n\r\n            var localeMappedName = DataLocalizationFacade.GetUrlMappingName(localizationScope) ?? string.Empty;\r\n            _forceRelativeUrls = urlSpace != null && urlSpace.ForceRelativeUrls;\r\n\r\n            if (!_forceRelativeUrls\r\n                && urlSpace != null \r\n                && urlSpace.Hostname != null)\r\n            {\r\n                List<IHostnameBinding> hostnameBindings = DataFacade.GetData<IHostnameBinding>().ToList();\r\n\r\n                _hostnameBinding = hostnameBindings.FirstOrDefault(b => b.Hostname == urlSpace.Hostname);\r\n\r\n                bool knownHostname = _hostnameBinding != null;\r\n                 \r\n                if(knownHostname)\r\n                {\r\n                    _hostnameBindings = hostnameBindings;\r\n\r\n                    _urlSpace = urlSpace;\r\n                }\r\n            }\r\n\r\n            if(_hostnameBinding != null \r\n                && !_hostnameBinding.IncludeCultureInUrl\r\n                && _hostnameBinding.Culture == localizationScope.Name)\r\n            {\r\n                _friendlyUrlPrefix = UrlUtils.PublicRootPath;\r\n\r\n                if (!localeMappedName.IsNullOrEmpty())\r\n                {\r\n                    _friendlyUrlPrefixWithLanguageCode = UrlUtils.PublicRootPath + \"/\" + localeMappedName;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                _friendlyUrlPrefix = UrlUtils.PublicRootPath + (localeMappedName.IsNullOrEmpty() ? string.Empty : \"/\" + localeMappedName);\r\n            }\r\n\r\n            UrlSuffix = DataFacade.GetData<IUrlConfiguration>().Select(c => c.PageUrlSuffix).FirstOrDefault() ?? string.Empty;\r\n        }\r\n\r\n        public PageUrlSet BuildUrlSet(IPage page, Guid parentPageId)\r\n        {\r\n            Verify.ArgumentNotNull(page, \"page\");\r\n            Verify.ArgumentCondition(page.DataSourceId.PublicationScope == _publicationScope, \"page\", \"Page belongs to a wrong publication scope\");\r\n            Verify.ArgumentCondition(page.DataSourceId.LocaleScope.Name == _localizationScope.Name, \"page\", \"Page belongs to a wrong localization scope\");\r\n\r\n            DataScopeIdentifier dataScopeIdentifier = page.DataSourceId.DataScopeIdentifier;\r\n            CultureInfo cultureInfo = page.DataSourceId.LocaleScope;\r\n\r\n            string parentPath;\r\n\r\n            IHostnameBinding appliedHostnameBinding = null;\r\n\r\n            // Checking if it is a root-level page\r\n            if (parentPageId == Guid.Empty)\r\n            {\r\n                parentPath = GetRootPageBaseUrl(page.Id, cultureInfo, out appliedHostnameBinding);\r\n            }\r\n            else\r\n            {\r\n                Verify.That(_folderPaths.ContainsKey(parentPageId), \"Method BuildUrlInternal() should be called for parent page before running for childildren, so 'urlBuildingCache' parameter will contains parent pages data.\");\r\n                parentPath = _folderPaths[parentPageId];\r\n            }\r\n\r\n            // Building folderPath & lookup url\r\n            string lookupUrl, folderPath;\r\n            \r\n            if (page.UrlTitle == string.Empty \r\n                || (appliedHostnameBinding != null\r\n                    && !appliedHostnameBinding.IncludeHomePageInUrl\r\n                    && appliedHostnameBinding.HomePageId == page.Id))\r\n            {\r\n                // Extensionless root url\r\n                lookupUrl = folderPath = (parentPath == \"\" ? \"/\" : parentPath);\r\n            }\r\n            else\r\n            {\r\n                string parentPathWithSlash = parentPath + (parentPath.EndsWith(\"/\") ? \"\" : \"/\");\r\n\r\n                string urlTitle = page.UrlTitle;\r\n\r\n#if URLDEBUG\r\n                urlTitle = UrlFormattersPluginFacade.FormatUrl(urlTitle, true);\r\n#endif \r\n\r\n                folderPath = parentPathWithSlash + urlTitle;\r\n                lookupUrl = folderPath + UrlSuffix;\r\n            }\r\n\r\n\r\n            _folderPaths.Add(page.Id, folderPath);\r\n\r\n            string lookupUrlLowerCased = lookupUrl.ToLowerInvariant();\r\n\r\n            if (UrlToIdLookupLowerCased.ContainsKey(lookupUrlLowerCased))\r\n            {\r\n                if (!_knownNotUniqueUrls.Contains(lookupUrlLowerCased))\r\n                {\r\n                    lock (_knownNotUniqueUrls)\r\n                    {\r\n                        _knownNotUniqueUrls.Add(lookupUrlLowerCased);\r\n                    }\r\n                    Log.LogError(LogTitle, \"Multiple pages share the same path '{0}'. Page ID: '{1}'. Duplicates are ignored.\".FormatWith(lookupUrlLowerCased, page.Id));\r\n                }\r\n                return null;\r\n            }\r\n\r\n            UrlToIdLookupLowerCased.Add(lookupUrlLowerCased, page.Id);\r\n            UrlToIdLookup.Add(lookupUrl, page.Id);\r\n            IdToUrlLookup.Add(page.Id, lookupUrl);\r\n\r\n\r\n            // Building redirect folder path & url\r\n\r\n            string redirectParentPath = (parentPageId == Guid.Empty)\r\n                                            ? GetRedirectBaseUrl(cultureInfo) \r\n                                            : _redirectFolderPaths[parentPageId];\r\n\r\n            if (redirectParentPath != null)\r\n            {\r\n                string redirectLookupUrl;\r\n                string redirectFolderPath;\r\n\r\n                \r\n\r\n                if (!page.UrlTitle.IsNullOrEmpty())\r\n                {\r\n                    string parentPathWithTrailingSlash = redirectParentPath + (redirectParentPath.EndsWith(\"/\") ? \"\" : \"/\");\r\n                    redirectFolderPath = parentPathWithTrailingSlash + page.UrlTitle;\r\n                    redirectLookupUrl = redirectFolderPath + UrlSuffix;\r\n                }\r\n                else\r\n                {\r\n                    redirectLookupUrl = redirectFolderPath = redirectParentPath;\r\n                }\r\n\r\n                if (redirectLookupUrl != lookupUrl || UrlSuffix == string.Empty)\r\n                {\r\n                    _redirectFolderPaths.Add(page.Id, redirectFolderPath);\r\n\r\n                    string redirectLookupUrlLowerCased = redirectLookupUrl.ToLowerInvariant();\r\n\r\n                    if (redirectLookupUrlLowerCased != lookupUrlLowerCased)\r\n                    {\r\n                        if (!RedirectUrlToIdLookupLowerCased.ContainsKey(redirectLookupUrlLowerCased))\r\n                        {\r\n                            RedirectUrlToIdLookupLowerCased.Add(redirectLookupUrlLowerCased, page.Id);\r\n                        }\r\n                    }\r\n                    \r\n                    if(UrlSuffix == string.Empty)\r\n                    {\r\n                        string aspxExtensionRedirectUrl = redirectLookupUrlLowerCased + \".aspx\";\r\n\r\n                        if (!RedirectUrlToIdLookupLowerCased.ContainsKey(aspxExtensionRedirectUrl))\r\n                        {\r\n                            RedirectUrlToIdLookupLowerCased.Add(aspxExtensionRedirectUrl, page.Id);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            string url = lookupUrl;\r\n\r\n            if(_forceRelativeUrls)\r\n            {\r\n                url = UrlUtils.Combine(url, DefaultPageUrlProvider.UrlMarker_RelativeUrl);\r\n            }\r\n\r\n            if (dataScopeIdentifier.Name == DataScopeIdentifier.AdministratedName)\r\n            {\r\n                url = UrlUtils.Combine(url, DefaultPageUrlProvider.UrlMarker_Unpublished);\r\n            }\r\n\r\n            var pageUrls = new PageUrlSet { PublicUrl = url };\r\n\r\n            if(!string.IsNullOrEmpty(page.FriendlyUrl))\r\n            {\r\n                string friendlyUrl = _friendlyUrlPrefix + MakeRelativeUrl(page.FriendlyUrl);\r\n                string lowerCasedFriendlyUrl = friendlyUrl.ToLowerInvariant();\r\n\r\n                if(!FriendlyUrlToIdLookup.ContainsKey(lowerCasedFriendlyUrl))\r\n                {\r\n                    pageUrls.FriendlyUrl = friendlyUrl;\r\n                    FriendlyUrlToIdLookup.Add(lowerCasedFriendlyUrl, page.Id);\r\n                }\r\n\r\n                if(_friendlyUrlPrefixWithLanguageCode != null)\r\n                {\r\n                    string alternativeFriendlyUrl = (_friendlyUrlPrefixWithLanguageCode + MakeRelativeUrl(page.FriendlyUrl)).ToLowerInvariant();\r\n                    if(!FriendlyUrlToIdLookup.ContainsKey(alternativeFriendlyUrl))\r\n                    {\r\n                        FriendlyUrlToIdLookup.Add(alternativeFriendlyUrl, page.Id);\r\n                    }\r\n                }\r\n            }\r\n            \r\n            return pageUrls;\r\n        }\r\n\r\n        private static string GetRedirectBaseUrl(CultureInfo cultureInfo)\r\n        {\r\n            string cultureUrlMapping = DataLocalizationFacade.GetUrlMappingName(cultureInfo);\r\n\r\n            if (cultureUrlMapping != \"\")\r\n            {\r\n                return UrlUtils.PublicRootPath + \"/\" + cultureUrlMapping;\r\n            }\r\n\r\n            return UrlUtils.PublicRootPath;\r\n        }\r\n\r\n        private string GetRootPageBaseUrl(Guid pageId, CultureInfo cultureInfo, out IHostnameBinding appliedHostnameBinding)\r\n        {\r\n            // TODO: merge with DefaultPageUrlProvider logic\r\n            string cultureUrlMapping = DataLocalizationFacade.GetUrlMappingName(cultureInfo);\r\n\r\n            if (!_forceRelativeUrls && _hostnameBindings.Any())\r\n            {\r\n                IHostnameBinding match = _hostnameBindings.FirstOrDefault(b => b.HomePageId == pageId && b.Culture == cultureInfo.Name);\r\n\r\n                if(match == null)\r\n                {\r\n                    match = _hostnameBindings.FirstOrDefault(b => b.HomePageId == pageId);\r\n                }\r\n\r\n                if(match != null)\r\n                {\r\n                    string result = string.Empty;\r\n\r\n                    if (match.Hostname != _urlSpace.Hostname)\r\n                    {\r\n                        result = \"http://\" + match.Hostname;\r\n                    }\r\n\r\n                    result += UrlUtils.PublicRootPath;\r\n\r\n                    if (match.IncludeCultureInUrl || match.Culture != cultureInfo.Name)\r\n                    {\r\n                        if (cultureUrlMapping != string.Empty)\r\n                        {\r\n                            result += \"/\" + cultureUrlMapping;\r\n                        }\r\n                    }\r\n\r\n                    appliedHostnameBinding = match;\r\n\r\n                    return result;\r\n                }\r\n            }\r\n\r\n            appliedHostnameBinding = _hostnameBinding;\r\n\r\n            if (cultureUrlMapping != \"\"\r\n                && (appliedHostnameBinding == null\r\n                    || appliedHostnameBinding.IncludeCultureInUrl\r\n                    || appliedHostnameBinding.Culture != cultureInfo.Name))\r\n            {\r\n                return UrlUtils.PublicRootPath + \"/\" + cultureUrlMapping;\r\n            }\r\n\r\n            return UrlUtils.PublicRootPath;\r\n        }\r\n\r\n        private static string MakeRelativeUrl(string url)\r\n        {\r\n            return url.StartsWith(\"/\") ? url : \"/\" + url;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/UrlFormatters/StringReplaceUrlFormatter.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web.Hosting;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Routing.Plugins.UrlFormatters;\r\nusing Composite.Core.Routing.Plugins.UrlFormatters.Runtime;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.Routing.UrlFormatters\r\n{\r\n    [ConfigurationElementType(typeof(StringReplaceUrlFormatterData))]\r\n    internal class StringReplaceUrlFormatter : IUrlFormatter\r\n    {\r\n        readonly List<Pair<string, string>> _replacementRules = new List<Pair<string, string>>();\r\n\r\n        public StringReplaceUrlFormatter(List<Pair<string, string>> replacementRules)\r\n        {\r\n            _replacementRules = replacementRules;\r\n        }\r\n\r\n        public string FormatUrl(string url)\r\n        {\r\n            foreach(var pair in _replacementRules)\r\n            {\r\n                if(pair.First.Length == 1 && pair.Second.Length == 1)\r\n                {\r\n                    url = url.Replace(pair.First[0], pair.Second[0]);\r\n                }\r\n                else\r\n                {\r\n                    url = url.Replace(pair.First, pair.Second);\r\n                }\r\n            }\r\n            return url;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(StringReplaceUrlFormatterAssembler))]\r\n    internal sealed class StringReplaceUrlFormatterData : UrlFormatterData\r\n    {\r\n        private const string RulesFilePropertyName = \"rulesFile\";\r\n\r\n        /// <exclude />\r\n        [ConfigurationProperty(RulesFilePropertyName, IsRequired = false)]\r\n        public string RulesFile\r\n        {\r\n            get\r\n            {\r\n                return (string)this[RulesFilePropertyName];\r\n            }\r\n            set\r\n            {\r\n                this[RulesFilePropertyName] = value;\r\n            }\r\n        }\r\n\r\n        private const string ReplaceProperty = \"ReplacementRules\";\r\n        [ConfigurationProperty(ReplaceProperty)]\r\n        public ReplacementElementCollection Replace\r\n        {\r\n            get\r\n            {\r\n                return (ReplacementElementCollection)base[ReplaceProperty];\r\n            }\r\n        }\r\n    }\r\n\r\n    internal sealed class ReplacementElementCollection : ConfigurationElementCollection\r\n    {\r\n        public void Add(ReplacementRuleConfigurationElement element)\r\n        {\r\n            BaseAdd(element);\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new ReplacementRuleConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            return ((ReplacementRuleConfigurationElement)element).OldValue;\r\n        }\r\n    }\r\n\r\n    internal sealed class StringReplaceUrlFormatterAssembler : IAssembler<IUrlFormatter, UrlFormatterData>\r\n    {\r\n        public IUrlFormatter Assemble(IBuilderContext context, UrlFormatterData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var data = (StringReplaceUrlFormatterData)objectConfiguration;\r\n\r\n            string rulesFile = data.RulesFile;\r\n            if (!rulesFile.IsNullOrEmpty())\r\n            {\r\n                string fullPath = HostingEnvironment.MapPath(rulesFile);\r\n                Verify.That(C1File.Exists(fullPath), \"Cannot find file '{0}'\", rulesFile);\r\n\r\n                try\r\n                {\r\n                    XDocument xDoc = XDocumentUtils.Load(fullPath);\r\n\r\n                    return new StringReplaceUrlFormatter(\r\n                        xDoc.Root.Elements()\r\n                        .Select(e => new Pair<string, string>(GetAttributeNotNull(e, \"oldValue\"), GetAttributeNotNull(e, \"newValue\"))).ToList());\r\n                }\r\n                catch (Exception e)\r\n                {\r\n                    throw new ConfigurationErrorsException(\"Failed to process file '{0}'\".FormatWith(rulesFile), e);\r\n                }\r\n            }\r\n\r\n            var replacements = data.Replace.Cast<ReplacementRuleConfigurationElement>();\r\n\r\n            return new StringReplaceUrlFormatter(replacements.Select(r => new Pair<string, string>(r.OldValue, r.NewValue)).ToList());\r\n        }\r\n\r\n        private static string GetAttributeNotNull(XElement xelement, string attributeName)\r\n        {\r\n            var attr = xelement.Attribute(attributeName);\r\n            Verify.IsNotNull(attr, \"Missing '{0}' attribute\", attributeName);\r\n\r\n            return attr.Value;\r\n        }\r\n    }\r\n    internal sealed class ReplacementRuleConfigurationElement : ConfigurationElement\r\n    {\r\n        private const string _oldValueAttributeName = \"oldValue\";\r\n        [ConfigurationProperty(_oldValueAttributeName)]\r\n        public string OldValue\r\n        {\r\n            get { return (string)base[_oldValueAttributeName]; }\r\n            set { base[_oldValueAttributeName] = value; }\r\n        }\r\n\r\n        private const string _newValueAttributeName = \"newValue\";\r\n        [ConfigurationProperty(_newValueAttributeName)]\r\n        public string NewValue\r\n        {\r\n            get { return (string)base[_newValueAttributeName]; }\r\n            set { base[_newValueAttributeName] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Routing/UrlFormatters/ToLowerCaseUrlFormatter.cs",
    "content": "﻿using Composite.Core.Routing.Plugins.UrlFormatters;\r\nusing Composite.Core.Routing.Plugins.UrlFormatters.Runtime;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Routing.UrlFormatters\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableUrlFormatter))]\r\n    internal class ToLowerCaseUrlFormatter: IUrlFormatter\r\n    {\r\n        public string FormatUrl(string url)\r\n        {\r\n            return url.ToLowerInvariant();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Search/Endpoint/ConsoleSearchPageStructure.cs",
    "content": "﻿using Composite.Plugins.Components.ComponentsEndpoint;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Search;\r\n\r\nnamespace Composite.Plugins.Search.Endpoint\r\n{\r\n    /// <exclude />\r\n    public class ConsoleSearchPageStructure\r\n    {\r\n        /// <exclude />\r\n        public string Name => \"search\";\r\n        /// <exclude />\r\n        public string Type => \"search\";\r\n        /// <exclude />\r\n        public string SearchProvider => \"searchProvider\";\r\n        /// <exclude />\r\n        public string UrlColumn => \"label\";\r\n        /// <exclude />\r\n        public ProviderResponse[] Providers => new ProviderResponse[] {new ConsoleSearchProviderResponse()};\r\n\r\n        /// <exclude />\r\n        public string Placeholder => Texts.SearchPage_SearchHerePlaceholder;\r\n        /// <exclude />\r\n        public string NoResultsFound => Texts.SearchPage_NoResultFound_Template;\r\n        /// <exclude />\r\n        public string SingleResultFound => Texts.SearchPage_SingleResultFound_Template;\r\n        /// <exclude />\r\n        public string MultipleResultsFound => Texts.SearchPage_MultipleResultsFound_Template;\r\n    }\r\n\r\n    /// <exclude />\r\n    public class ConsoleSearchProviderResponse: ProviderResponse\r\n    {\r\n        /// <exclude />\r\n        public override string Name => \"searchProvider\";\r\n\r\n        /// <exclude />\r\n        public override string Uri => ConsoleSearchRpcService.WampProcedureName;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Search/Endpoint/ConsoleSearchQuery.cs",
    "content": "﻿namespace Composite.Plugins.Search.Endpoint\r\n{\r\n    /// <exclude />\r\n    public class ConsoleSearchQuerySelection\r\n    {\r\n        /// <exclude />\r\n        public string FieldName { get; set; }\r\n        /// <exclude />\r\n        public string[] Values { get; set; }\r\n    }\r\n\r\n    /// <exclude />\r\n    public class ConsoleSearchQuery\r\n    {\r\n        /// <exclude />\r\n        public string CultureName { get; set; }\r\n        /// <exclude />\r\n        public string Text { get; set; }\r\n        /// <exclude />\r\n        public string SortBy { get; set; }\r\n        /// <exclude />\r\n        public bool SortInReverseOrder { get; set; }\r\n        /// <exclude />\r\n        public ConsoleSearchQuerySelection[] Selections { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Search/Endpoint/ConsoleSearchResult.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.Plugins.Search.Endpoint\r\n{\r\n    /// <exclude />\r\n    public class ConsoleSearchResult\r\n    {\r\n        /// <exclude />\r\n        public string QueryText { get; set; }\r\n        /// <exclude />\r\n        public ConsoleSearchResultColumn[] Columns { get; set; }\r\n        /// <exclude />\r\n        public ConsoleSearchResultRow[] Rows { get; set; }\r\n        /// <exclude />\r\n        public int TotalHits { get; set; }\r\n        /// <exclude />\r\n        public ConsoleSearchResultFacetField[] FacetFields { get; set; }\r\n    }\r\n\r\n\r\n\r\n    /// <exclude />\r\n    public class ConsoleSearchResultColumn\r\n    {\r\n        /// <exclude />\r\n        public string FieldName { get; set; }\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n        /// <exclude />\r\n        public bool Sortable { get; set; }\r\n    }\r\n\r\n    /// <exclude />\r\n    public class ConsoleSearchResultRow\r\n    {\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n        /// <exclude />\r\n        public string Url { get; set; }\r\n        /// <exclude />\r\n        public Dictionary<string, string> Values { get; set; }\r\n    }\r\n\r\n    /// <exclude />\r\n    public class ConsoleSearchResultFacetField\r\n    {\r\n        /// <exclude />\r\n        public string FieldName { get; set; }\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n        /// <exclude />\r\n        public ConsoleSearchResultFacetValue[] Facets { get; set; }\r\n    }\r\n\r\n    /// <exclude />\r\n    public class ConsoleSearchResultFacetValue\r\n    {\r\n        /// <exclude />\r\n        public string Value { get; set; }\r\n        /// <exclude />\r\n        public string Label { get; set; }\r\n        /// <exclude />\r\n        public int HitCount { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Search/Endpoint/ConsoleSearchRpcService.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing Composite.Search;\r\nusing Composite.Search.Crawling;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core;\r\nusing Composite.Core.Application;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Services.WampRouter;\r\nusing Composite.Data;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing WampSharp.V2.Rpc;\r\n\r\nnamespace Composite.Plugins.Search.Endpoint\r\n{\r\n    [ApplicationStartup]\r\n    class SearchApplicationStartup\r\n    {\r\n        public static void OnInitialized(IServiceProvider serviceProvider)\r\n        {\r\n            WampRouterFacade.RegisterCallee(new ConsoleSearchRpcService(\r\n                serviceProvider.GetService<ISearchProvider>(),\r\n                serviceProvider.GetServices<ISearchDocumentSourceProvider>()));\r\n        }\r\n    }\r\n\r\n\r\n\r\n    /// <exclude />\r\n    public class ConsoleSearchRpcService : IRpcService\r\n    {\r\n        internal const string WampProcedureName = \"search.query\";\r\n\r\n        private readonly ISearchProvider _searchProvider;\r\n        private readonly IEnumerable<ISearchDocumentSourceProvider> _docSourceProviders;\r\n\r\n        /// <exclude />\r\n        public ConsoleSearchRpcService(\r\n            ISearchProvider searchProvider,\r\n            IEnumerable<ISearchDocumentSourceProvider> docSourceProviders)\r\n        {\r\n            _searchProvider = searchProvider;\r\n            _docSourceProviders = docSourceProviders;\r\n        }\r\n\r\n        /// <exclude />\r\n        [WampProcedure(WampProcedureName)]\r\n        public async Task<ConsoleSearchResult> QueryAsync(ConsoleSearchQuery query)\r\n        {\r\n            if (_searchProvider == null || query == null) return null;\r\n\r\n            using (ThreadDataManager.EnsureInitialize())\r\n            {\r\n                Thread.CurrentThread.CurrentCulture = UserSettings.CultureInfo;\r\n                Thread.CurrentThread.CurrentUICulture = UserSettings.C1ConsoleUiLanguage;\r\n\r\n                var documentSources = _docSourceProviders.SelectMany(dsp => dsp.GetDocumentSources()).ToList();\r\n                var allFields = documentSources.SelectMany(ds => ds.CustomFields).ToList();\r\n\r\n                var facetFields = RemoveDuplicateKeys(\r\n                    allFields\r\n                    .Where(f => f.FacetedSearchEnabled && f.Label != null),\r\n                    f => f.Name).ToList();\r\n\r\n                if (string.IsNullOrEmpty(query.Text))\r\n                {\r\n                    return new ConsoleSearchResult\r\n                    {\r\n                        QueryText = string.Empty,\r\n                        FacetFields = EmptyFacetsFromSelections(query, facetFields),\r\n                        TotalHits = 0\r\n                    };\r\n                }\r\n\r\n                var selections = new List<SearchQuerySelection>();\r\n                if (query.Selections != null)\r\n                {\r\n                    foreach (var selection in query.Selections)\r\n                    {\r\n                        string fieldName = ExtractFieldName(selection.FieldName);\r\n\r\n                        var field = allFields.Where(f => f.Facet != null)\r\n                            .FirstOrDefault(f => f.Name == fieldName);\r\n                        Verify.IsNotNull(field, $\"Failed to find a facet field by name '{fieldName}'\");\r\n\r\n                        selections.Add(new SearchQuerySelection\r\n                        {\r\n                            FieldName = fieldName,\r\n                            Values = selection.Values,\r\n                            Operation = field.Facet.FacetType == FacetType.SingleValue \r\n                                ? SearchQuerySelectionOperation.Or\r\n                                : SearchQuerySelectionOperation.And\r\n                        });\r\n                    }\r\n                }\r\n\r\n                var sortOptions = new List<SearchQuerySortOption>();\r\n                if (!string.IsNullOrEmpty(query.SortBy))\r\n                {\r\n                    string sortByFieldName = ExtractFieldName(query.SortBy);\r\n\r\n                    var sortTermsAs = allFields\r\n                        .Where(f => f.Name == sortByFieldName && f.Preview != null && f.Preview.Sortable)\r\n                        .Select(f => f.Preview.SortTermsAs)\r\n                        .FirstOrDefault();\r\n\r\n                    sortOptions.Add(new SearchQuerySortOption(sortByFieldName, query.SortInReverseOrder, sortTermsAs));\r\n                }\r\n\r\n                var culture = !string.IsNullOrEmpty(query.CultureName) \r\n                    ? new CultureInfo(query.CultureName) \r\n                    : UserSettings.ActiveLocaleCultureInfo;\r\n                \r\n                var searchQuery = new SearchQuery(query.Text, culture)\r\n                {\r\n                    Facets = facetFields.Select(f => new KeyValuePair<string, DocumentFieldFacet>(f.Name, f.Facet)).ToList(),\r\n                    Selection = selections,\r\n                    SortOptions = sortOptions\r\n                };\r\n\r\n                searchQuery.FilterByUser(UserSettings.Username);\r\n                searchQuery.AddFieldFacet(DocumentFieldNames.Source);\r\n\r\n                var result = await _searchProvider.SearchAsync(searchQuery);\r\n\r\n                var items = result?.Items?.Evaluate() ?? Array.Empty<SearchResultItem>();\r\n                if (!items.Any())\r\n                {\r\n                    return new ConsoleSearchResult\r\n                    {\r\n                        QueryText = query.Text,\r\n                        FacetFields = EmptyFacetsFromSelections(query, facetFields),\r\n                        TotalHits = 0\r\n                    };\r\n                }\r\n\r\n                var documents = items.Select(m => m.Document);\r\n\r\n                HashSet<string> dataSourceNames;\r\n                Facet[] dsFacets;\r\n                if (result.Facets != null && result.Facets.TryGetValue(DocumentFieldNames.Source, out dsFacets))\r\n                {\r\n                    dataSourceNames = new HashSet<string>(dsFacets.Select(v => v.Value));\r\n                }\r\n                else\r\n                {\r\n                    Log.LogWarning(nameof(ConsoleSearchRpcService), \"The search provider did not return the list of document sources\");\r\n                    dataSourceNames = new HashSet<string>(documents.Select(d => d.Source).Distinct());\r\n                }\r\n\r\n\r\n                var dataSources = documentSources.Where(d => dataSourceNames.Contains(d.Name)).ToList();\r\n                var previewFields = RemoveDuplicateKeys(\r\n                        dataSources\r\n                            .SelectMany(ds => ds.CustomFields)\r\n                            .Where(f => f.FieldValuePreserved), \r\n                        f => f.Name).ToList();\r\n\r\n                using (new DataConnection(culture))\r\n                {\r\n                    return new ConsoleSearchResult\r\n                    {\r\n                        QueryText = query.Text,\r\n                        Columns = previewFields.Select(pf => new ConsoleSearchResultColumn\r\n                        {\r\n                            FieldName = MakeFieldNameJsFriendly(pf.Name),\r\n                            Label = StringResourceSystemFacade.ParseString(pf.Label),\r\n                            Sortable = pf.Preview.Sortable\r\n                        }).ToArray(),\r\n                        Rows = documents.Select(doc => new ConsoleSearchResultRow\r\n                        {\r\n                            Label = doc.Label,\r\n                            Url = GetFocusUrl(doc.SerializedEntityToken),\r\n                            Values = GetPreviewValues(doc, previewFields)\r\n                        }).ToArray(),\r\n                        FacetFields = GetFacets(result, facetFields),\r\n                        TotalHits = result.TotalHits\r\n                    };\r\n                }\r\n            }\r\n        }\r\n\r\n        private ConsoleSearchResultFacetField[] EmptyFacetsFromSelections(\r\n            ConsoleSearchQuery query, \r\n            List<DocumentField> facetFields)\r\n        {\r\n            if (query.Selections == null) return null;\r\n\r\n            return (from selection in query.Selections\r\n                    where selection.Values.Length > 0\r\n                    let facetField = facetFields.Where(ff => ff.Name == selection.FieldName)\r\n                                     .FirstOrException($\"Facet field '{selection.FieldName}' not found\")\r\n                    select new ConsoleSearchResultFacetField\r\n                    {\r\n                        FieldName = MakeFieldNameJsFriendly(selection.FieldName),\r\n                        Label = StringResourceSystemFacade.ParseString(facetField.Label),\r\n                        Facets = selection.Values.Select(value => new ConsoleSearchResultFacetValue\r\n                        {\r\n                            Label = (facetField.Facet.PreviewFunction ?? (v => v))(value),\r\n                            Value = value,\r\n                            HitCount = 0\r\n                        }).ToArray()\r\n                    }).ToArray();\r\n        }\r\n\r\n        private ConsoleSearchResultFacetField[] GetFacets(SearchResult queryResult, ICollection<DocumentField> facetFields)\r\n        {\r\n            if (queryResult.Facets == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            var result = new List<ConsoleSearchResultFacetField>();\r\n            foreach (var field in facetFields.Where(f => queryResult.Facets.ContainsKey(f.Name)))\r\n            {\r\n                if(field.Label == null) continue;\r\n\r\n                Facet[] values = queryResult.Facets[field.Name];\r\n                if (values.Length == 0) continue;\r\n\r\n                result.Add(new ConsoleSearchResultFacetField\r\n                {\r\n                    FieldName = MakeFieldNameJsFriendly(field.Name),\r\n                    Label = StringResourceSystemFacade.ParseString(field.Label),\r\n                    Facets = values.Select(v => new ConsoleSearchResultFacetValue\r\n                    {\r\n                        Value = v.Value,\r\n                        HitCount = v.HitCount,\r\n                        Label = (field.Facet.PreviewFunction ?? (value => value))(v.Value)\r\n                    }).ToArray()\r\n                });\r\n            }\r\n\r\n            return result.ToArray();\r\n        }\r\n\r\n        private Dictionary<string, string> GetPreviewValues(\r\n            SearchDocument searchDocument,\r\n            IEnumerable<DocumentField> fields)\r\n        {\r\n            var result = new Dictionary<string, string>();\r\n\r\n            foreach (var field in fields)\r\n            {\r\n                object value;\r\n                if (!searchDocument.FieldValues.TryGetValue(field.Name, out value)) continue;\r\n\r\n                var stringValue = (field.Preview.PreviewFunction ?? (v => v?.ToString()))(value);\r\n                result[MakeFieldNameJsFriendly(field.Name)] = stringValue;\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private static string MakeFieldNameJsFriendly(string fieldName)\r\n        {\r\n            return char.IsUpper(fieldName[0])\r\n                ? \"_\" + fieldName\r\n                : fieldName;\r\n        }\r\n\r\n        private static string ExtractFieldName(string jsFriendlyFieldName)\r\n        {\r\n            return jsFriendlyFieldName.StartsWith(\"_\") ? jsFriendlyFieldName.Substring(1) : jsFriendlyFieldName;\r\n        }\r\n\r\n        private string GetFocusUrl(string serializedEntityToken)\r\n        {\r\n            return UrlUtils.AdminRootPath + \"/top.aspx#FocusElement;\" + serializedEntityToken;\r\n        }\r\n\r\n        private IEnumerable<T> RemoveDuplicateKeys<T>(IEnumerable<T> sequence, Func<T, string> getKeyFunc)\r\n        {\r\n            var keys = new HashSet<string>();\r\n\r\n            foreach (var el in sequence)\r\n            {\r\n                string key = getKeyFunc(el);\r\n\r\n                if (keys.Contains(key)) continue;\r\n\r\n                keys.Add(key);\r\n\r\n                yield return el;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/HookRegistrators/ElementHookRegistrator/ElementHookRegistrator.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Plugins.HookRegistrator;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Security.HookRegistrators.ElementHookRegistrator\r\n{\r\n    [ConfigurationElementType(typeof(ElementHookRegistratorData))]\r\n    internal sealed class ElementHookRegistrator : IHookRegistrator\r\n\t{\r\n        public IEnumerable<EntityTokenHook> GetHooks()\r\n        {\r\n            return ElementHookRegistratorFacade.GetHooks();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableHookRegistratorAssembler))]\r\n    internal sealed class ElementHookRegistratorData : HookRegistratorData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/LoginProviderPlugins/ConfigBasedFormLoginProvider/ConfigBasedFormLoginProvider.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Security.LoginProviderPlugins.ConfigBasedFormLoginProvider\r\n{\r\n    [ConfigurationElementType(typeof(ConfigBasedFormLoginProviderData))]\r\n    internal sealed class ConfigBasedFormLoginProvider : IFormLoginProvider\r\n    {\r\n        private NamedElementCollection<ValidLoginConfigurationElement> _validLogins;\r\n\r\n        internal ConfigBasedFormLoginProvider(NamedElementCollection<ValidLoginConfigurationElement> validLogins)\r\n        {\r\n            _validLogins = validLogins;\r\n        }\r\n\r\n\r\n        public IEnumerable<string> AllUsernames\r\n        {\r\n            get { return _validLogins.Select(f => f.Name); }\r\n        }\r\n\r\n\r\n\r\n        public bool CanSetUserPassword\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n\r\n\r\n        LoginResult IFormLoginProvider.Validate(string username, string password)\r\n        {\r\n            if (_validLogins.Contains(username))\r\n            {\r\n                ValidLoginConfigurationElement usernameMatch = _validLogins.Get(username);\r\n\r\n                return usernameMatch.Password == password ? LoginResult.Success : LoginResult.IncorrectPassword;\r\n            }\r\n\r\n            return LoginResult.UserDoesNotExist;\r\n        }\r\n\r\n\r\n        public void SetUserPassword(string username, string password)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n        public bool CanAddNewUser\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n\r\n        public void AddNewUser(string userName, string password, string group, string email)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n        public bool UsersExists\r\n        {\r\n            get { return _validLogins.Any(); }\r\n        }\r\n    }\r\n\r\n\r\n    [Assembler(typeof(ConfigBasedFormLoginProviderAssembler))]\r\n    internal sealed class ConfigBasedFormLoginProviderData : LoginProviderData\r\n    {\r\n        private const string _validLoginsProperty = \"ValidLogins\";\r\n        [ConfigurationProperty(_validLoginsProperty, IsRequired = true)]\r\n        public NamedElementCollection<ValidLoginConfigurationElement> ValidLogins\r\n        {\r\n            get\r\n            {\r\n                return (NamedElementCollection<ValidLoginConfigurationElement>)base[_validLoginsProperty];\r\n            }\r\n        }        \r\n    }\r\n\r\n    internal sealed class ConfigBasedFormLoginProviderAssembler : IAssembler<ILoginProvider, LoginProviderData>\r\n    {\r\n        public ILoginProvider Assemble(Microsoft.Practices.ObjectBuilder.IBuilderContext context, LoginProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            ConfigBasedFormLoginProviderData myConfiguration = (ConfigBasedFormLoginProviderData)objectConfiguration;\r\n            return new ConfigBasedFormLoginProvider(myConfiguration.ValidLogins);\r\n        }\r\n    }\r\n\r\n    internal sealed class ValidLoginConfigurationElement : NamedConfigurationElement\r\n    {\r\n        private const string _passwordProperty = \"password\";\r\n        [ConfigurationProperty(_passwordProperty, IsRequired = true)]\r\n        public string Password\r\n        {\r\n            get { return (string)base[_passwordProperty]; }\r\n            set { base[_passwordProperty] = value; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/LoginProviderPlugins/DataBasedFormLoginProvider/DataBasedFormLoginProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Cryptography;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider.Runtime;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider;\r\nusing Composite.Data.Transactions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Security.LoginProviderPlugins.DataBasedFormLoginProvider\r\n{\r\n    [ConfigurationElementType(typeof(DataBasedFormLoginProviderData))]\r\n    internal sealed class DataBasedFormLoginProvider : IFormLoginProvider\r\n    {\r\n        private static readonly string LogTitle = typeof (DataBasedFormLoginProvider).Name;\r\n\r\n        static readonly TimeSpan MinimalTimeBetweenLoginAttempts = TimeSpan.FromMilliseconds(500);\r\n        static readonly TimeSpan HalfAnHour = TimeSpan.FromMinutes(30);\r\n        private const int BruteForcePrevention_MaximumLoginAttempts = 30;\r\n\r\n        private readonly int _maxLoginAttemptsBeforeLockout;\r\n\r\n        static DataBasedFormLoginProvider()\r\n        {\r\n            if (!DataFacade.GetData<IUserFormLogin>().Any())\r\n            {\r\n                UpgradeUserData();\r\n            }\r\n        }\r\n\r\n        public DataBasedFormLoginProvider()\r\n        {\r\n            var settings = ConfigurationServices.ConfigurationSource.GetSection(LoginProviderSettings.SectionName) as LoginProviderSettings;\r\n            Verify.IsNotNull(settings, \"Failed to load section '{0}'\", LoginProviderSettings.SectionName);\r\n\r\n            _maxLoginAttemptsBeforeLockout = settings.MaxLoginAttempts;\r\n        }\r\n\r\n        private class FailedLoginInfo\r\n        {\r\n            public DateTime LastLoginAttempt;\r\n            public int LoginAttemptCount;\r\n        }\r\n\r\n        static readonly ConcurrentDictionary<string, FailedLoginInfo> _loginHistory = new ConcurrentDictionary<string, FailedLoginInfo>();\r\n\r\n        public IEnumerable<string> AllUsernames\r\n        {\r\n            get \r\n            {\r\n                return\r\n                (from u in DataFacade.GetData<IUser>()\r\n                 select u.Username).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool CanSetUserPassword\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n\r\n\r\n        public bool CanAddNewUser\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n\r\n\r\n        public LoginResult Validate(string username, string password)\r\n        {\r\n            username = username.ToLower(CultureInfo.InvariantCulture);\r\n\r\n            FailedLoginInfo failedLoginInfo;\r\n            _loginHistory.TryGetValue(username, out failedLoginInfo);\r\n\r\n            if(!BruteForcePreventionCheck(username, failedLoginInfo))\r\n            {\r\n                return LoginResult.PolicyViolated;\r\n            }\r\n\r\n            IUser user =\r\n                (from u in DataFacade.GetData<IUser>()\r\n                 where string.Compare(u.Username, username, StringComparison.InvariantCultureIgnoreCase) == 0\r\n                 select u).FirstOrDefault();\r\n\r\n            if(user == null)\r\n            {\r\n                return LoginResult.UserDoesNotExist;\r\n            }\r\n\r\n            var userFormLogin = DataFacade.GetData<IUserFormLogin>().FirstOrDefault(u => u.UserId == user.Id);\r\n            if (userFormLogin == null)\r\n            {\r\n                if (!user.EncryptedPassword.IsNullOrEmpty())\r\n                {\r\n                    throw new InvalidOperationException(\"User form login data is missing or present in obsolete format.\");\r\n                }\r\n                throw new InvalidOperationException(\"User form login data is missing.\");\r\n            }\r\n\r\n\r\n            bool passwordIsCorrect = UserFormLoginManager.ValidatePassword(userFormLogin, password);\r\n\r\n            if (passwordIsCorrect)\r\n            {\r\n                if (userFormLogin.IsLocked)\r\n                {\r\n                    if (userFormLogin.LockoutReason == (int)UserLockoutReason.LockedByAdministrator)\r\n                    {\r\n                        return LoginResult.UserLockedByAdministrator;\r\n                    }\r\n\r\n                    return LoginResult.UserLockedAfterMaxLoginAttempts;\r\n                }\r\n\r\n                int passwordExpirationDays = PasswordPolicyFacade.PasswordExpirationTimeInDays;\r\n                if (passwordExpirationDays > 0 && DateTime.Now > userFormLogin.LastPasswordChangeDate + TimeSpan.FromDays(passwordExpirationDays))\r\n                {\r\n                    return LoginResult.PasswordUpdateRequired;\r\n                }\r\n            }\r\n\r\n            UpdateLoginHistory(username, passwordIsCorrect, failedLoginInfo);\r\n\r\n            if (!passwordIsCorrect && failedLoginInfo != null && failedLoginInfo.LoginAttemptCount >= _maxLoginAttemptsBeforeLockout)\r\n            {\r\n                LockUser(userFormLogin);\r\n            }\r\n\r\n            return passwordIsCorrect ? LoginResult.Success : LoginResult.IncorrectPassword;\r\n        }\r\n\r\n        private void LockUser(IUserFormLogin userFormLogin)\r\n        {\r\n            userFormLogin.IsLocked = true;\r\n            userFormLogin.LockoutReason = (int) UserLockoutReason.TooManyFailedLoginAttempts;\r\n            DataFacade.Update(userFormLogin);\r\n        }\r\n\r\n        private static void UpdateLoginHistory(string username, bool loginIsValid, FailedLoginInfo failedLoginInfo)\r\n        {\r\n            if(loginIsValid)\r\n            {\r\n                _loginHistory.TryRemove(username, out failedLoginInfo);\r\n                return;\r\n            }\r\n            \r\n            if(failedLoginInfo != null)\r\n            {\r\n                failedLoginInfo.LastLoginAttempt = DateTime.Now;\r\n\r\n                lock(failedLoginInfo)\r\n                {\r\n                    failedLoginInfo.LoginAttemptCount++;\r\n                }\r\n                return;\r\n            }\r\n\r\n            _loginHistory[username] = new FailedLoginInfo {LastLoginAttempt = DateTime.Now, LoginAttemptCount = 1};\r\n        }\r\n\r\n        static bool BruteForcePreventionCheck(string username, FailedLoginInfo failedLoginInfo)\r\n        {\r\n            if (failedLoginInfo == null)\r\n            {\r\n                return true;\r\n            }\r\n            \r\n            var now = DateTime.Now;\r\n\r\n            /* If a user tries to login quicker that 500ms from previous attempt - it is failed automatically */\r\n            lock (failedLoginInfo)\r\n            {\r\n                if (now - failedLoginInfo.LastLoginAttempt < MinimalTimeBetweenLoginAttempts)\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                if (failedLoginInfo.LoginAttemptCount > BruteForcePrevention_MaximumLoginAttempts)\r\n                {\r\n                    if (now - failedLoginInfo.LastLoginAttempt < HalfAnHour)\r\n                    {\r\n                        // User is \"locked\" for 30 minutes after 30 failed logins in a row\r\n                        return false;\r\n                    }\r\n\r\n                    // After half an hour - cleaning up the history\r\n                    FailedLoginInfo temp;\r\n\r\n                    _loginHistory.TryRemove(username, out temp);\r\n                }\r\n            }\r\n            return true;                        \r\n        }\r\n\r\n        public void SetUserPassword(string username, string password)\r\n        {\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IUser user = DataFacade.GetData<IUser>().FirstOrDefault(u => u.Username == username);\r\n                Verify.IsNotNull(user, \"The userFormLogin '{0}' does not exists\", username);\r\n\r\n                var userFormLogin = user.GetUserFormLogin();\r\n\r\n                UserFormLoginManager.SetPassword(userFormLogin, password);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n        public void AddNewUser(string userName, string password, string folder, string email)\r\n        {\r\n            var user = DataFacade.BuildNew<IUser>();\r\n            user.Id = Guid.NewGuid();\r\n            user.Username = userName.Trim().ToLowerInvariant();\r\n            user.Email = email;\r\n\r\n            user = DataFacade.AddNew(user);\r\n            UserFormLoginManager.CreateUserFormLogin(user.Id, password, folder);\r\n\r\n            Log.LogVerbose(LogTitle, \"Added new userFormLogin '{0}'\", userName);\r\n        }\r\n\r\n\r\n        public bool UsersExists\r\n        {\r\n            get { return DataFacade.GetData<IUser>().Any(); }\r\n        }\r\n\r\n\r\n        static void UpgradeUserData()\r\n        {\r\n            // TODO: to be removed after upgrades will be performed from versions newer that C1 4.3 +\r\n            ConvertOldPasswordFormat();\r\n            MoveDataFromIUserToIUserFormLogin();\r\n        }\r\n\r\n\r\n        static void ConvertOldPasswordFormat()\r\n        {\r\n            int processed = 0;\r\n\r\n            var toBeUpdated = new List<IUser>();\r\n\r\n            foreach (var user in DataFacade.GetData<IUser>())\r\n            {\r\n                if (string.IsNullOrEmpty(user.EncryptedPassword) || !string.IsNullOrEmpty(user.PasswordHashSalt))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                string password = Cryptographer.Decrypt(user.EncryptedPassword);\r\n\r\n                var salt = UserFormLoginManager.GenerateHashSalt();\r\n\r\n                user.PasswordHashSalt = Convert.ToBase64String(salt);\r\n                user.EncryptedPassword = UserFormLoginManager.GeneratePasswordHash(password, salt);\r\n\r\n                toBeUpdated.Add(user);\r\n\r\n                processed++;\r\n            }\r\n\r\n            if (toBeUpdated.Any())\r\n            {\r\n                DataFacade.Update(toBeUpdated);\r\n            }\r\n\r\n            if (processed > 0)\r\n            {\r\n                Log.LogInformation(LogTitle, \"User passwords converted to a new format: \" + processed);\r\n            }\r\n        }\r\n\r\n\r\n        private static void MoveDataFromIUserToIUserFormLogin()\r\n        {\r\n            using (var conn = new DataConnection())\r\n            {\r\n                var users = conn.Get<IUser>().ToList();\r\n                var existingUserLogins = new HashSet<Guid>(conn.Get<IUserFormLogin>().Select(l => l.UserId));\r\n\r\n                foreach (var user in users.Where(u => !existingUserLogins.Contains(u.Id)))\r\n                {\r\n                    if (string.IsNullOrEmpty(user.PasswordHashSalt) && !string.IsNullOrEmpty(user.EncryptedPassword))\r\n                    {\r\n                        throw new InvalidOperationException(\"User password stored in old format\");\r\n                    }\r\n\r\n                    var userFormLogin = DataConnection.New<IUserFormLogin>();\r\n                    userFormLogin.UserId = user.Id;\r\n                    userFormLogin.Folder = user.Group;\r\n                    userFormLogin.IsLocked = user.IsLocked;\r\n                    userFormLogin.LockoutReason = user.LockoutReason;\r\n                    userFormLogin.PasswordHash = user.EncryptedPassword;\r\n                    userFormLogin.PasswordHashSalt = user.PasswordHashSalt;\r\n\r\n                    conn.Add(userFormLogin);\r\n\r\n                    // Clear out old data\r\n                    user.IsLocked = false;\r\n                    user.LockoutReason = 0;\r\n                    user.Group = null;\r\n                    user.EncryptedPassword = null;\r\n                    user.PasswordHashSalt = null;\r\n\r\n                    conn.Update(user);\r\n                }\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableLoginProviderAssembler))]\r\n    internal sealed class DataBasedFormLoginProviderData : LoginProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/LoginProviderPlugins/DataBasedFormLoginProvider/UserFormLoginManager.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Security.LoginProviderPlugins.DataBasedFormLoginProvider\r\n{\r\n    /// <summary>\r\n    /// User password update/validation.\r\n    /// </summary>\r\n    public static class UserFormLoginManager\r\n    {\r\n        /// <summary>\r\n        /// Creates user's form login data.\r\n        /// </summary>\r\n        /// <param name=\"userId\">The user id.</param>\r\n        /// <param name=\"password\">Password</param>\r\n        /// <param name=\"userFolder\">The name of the folder in which the user will be shown in c1 console.</param>\r\n        public static void CreateUserFormLogin(Guid userId, string password, string userFolder)\r\n        {\r\n            var userFormLogin = DataFacade.BuildNew<IUserFormLogin>();\r\n            userFormLogin.UserId = userId;\r\n            userFormLogin.Folder = userFolder;\r\n\r\n            SetPasswordFieldsInt(userFormLogin, password);\r\n            DataFacade.AddNew(userFormLogin);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Sets a password for a user, preserving password history.\r\n        /// </summary>\r\n        /// <param name=\"userFormLogin\">The user form login data.</param>\r\n        /// <param name=\"password\">The new password.</param>\r\n        public static void SetPassword(IUserFormLogin userFormLogin, string password)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(password, \"password\");\r\n\r\n            SavePasswordHistory(userFormLogin);\r\n            SetPasswordFieldsInt(userFormLogin, password);\r\n\r\n            userFormLogin.LastPasswordChangeDate = DateTime.Now;\r\n\r\n            DataFacade.Update(userFormLogin);\r\n        }\r\n\r\n        private static void SavePasswordHistory(IUserFormLogin userFormLogin)\r\n        {\r\n            if (string.IsNullOrEmpty(userFormLogin.PasswordHash) || PasswordPolicyFacade.PasswordHistoryLength <= 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            var passwordHistoryRecord = DataFacade.BuildNew<IUserPasswordHistory>();\r\n            passwordHistoryRecord.Id = Guid.NewGuid();\r\n            passwordHistoryRecord.UserId = userFormLogin.UserId;\r\n            passwordHistoryRecord.SetDate = userFormLogin.LastPasswordChangeDate;\r\n            passwordHistoryRecord.PasswordSalt = userFormLogin.PasswordHashSalt;\r\n            passwordHistoryRecord.PasswordHash = userFormLogin.PasswordHash;\r\n\r\n            DataFacade.AddNew(passwordHistoryRecord);\r\n\r\n            // Cleaning up old history records\r\n            Guid userId = userFormLogin.UserId;\r\n            var passwordDataToBeRemoved = DataFacade.GetData<IUserPasswordHistory>()\r\n                .Where(uph => uph.UserId == userId)\r\n                .OrderByDescending(uph => uph.SetDate).Skip(PasswordPolicyFacade.PasswordHistoryLength).ToList();\r\n\r\n            if (passwordDataToBeRemoved.Any())\r\n            {\r\n                DataFacade.Delete((IEnumerable<IData>) passwordDataToBeRemoved);\r\n            }\r\n        }\r\n\r\n        private static void SetPasswordFieldsInt(IUserFormLogin user, string password)\r\n        {\r\n            var salt = GenerateHashSalt();\r\n\r\n            user.PasswordHashSalt = Convert.ToBase64String(salt);\r\n            user.PasswordHash = GeneratePasswordHash(password, salt);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Validates user's password.\r\n        /// </summary>\r\n        /// <param name=\"user\"></param>\r\n        /// <param name=\"password\"></param>\r\n        /// <returns></returns>\r\n        public static bool ValidatePassword(IUserFormLogin user, string password)\r\n        {\r\n            if (user.PasswordHash.IsNullOrEmpty())\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (user.PasswordHashSalt.IsNullOrEmpty())\r\n            {\r\n                return false;\r\n            }\r\n\r\n            byte[] salt = Convert.FromBase64String(user.PasswordHashSalt);\r\n\r\n            return user.PasswordHash == GeneratePasswordHash(password, salt);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Checks whether the password appears in the user's password history.\r\n        /// </summary>\r\n        /// <param name=\"user\">The user.</param>\r\n        /// <param name=\"password\">The password.</param>\r\n        /// <returns></returns>\r\n        public static bool PasswordFoundInHistory(IUser user, string password)\r\n        {\r\n            Guid userId = user.Id;\r\n\r\n            var allOldPasswords = DataFacade.GetData<IUserPasswordHistory>().Where(uph => uph.UserId == userId).Evaluate();\r\n\r\n            foreach (var pwdHistory in allOldPasswords)\r\n            {\r\n                byte[] salt = Convert.FromBase64String(pwdHistory.PasswordSalt);\r\n\r\n                if (pwdHistory.PasswordHash == GeneratePasswordHash(password, salt))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Generates password hash.\r\n        /// </summary>\r\n        /// <param name=\"password\">The password.</param>\r\n        /// <param name=\"salt\">The salt.</param>\r\n        /// <returns></returns>\r\n        public static string GeneratePasswordHash(string password, byte[] salt)\r\n        {\r\n            using (HashAlgorithm algorithm = new SHA256Managed())\r\n            {\r\n                var plainText = Encoding.UTF8.GetBytes(password);\r\n                byte[] plainTextWithSaltBytes = new byte[plainText.Length + salt.Length];\r\n\r\n                plainText.CopyTo(plainTextWithSaltBytes, 0);\r\n                salt.CopyTo(plainTextWithSaltBytes, plainText.Length);\r\n\r\n                return Convert.ToBase64String(algorithm.ComputeHash(plainTextWithSaltBytes));\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Generates hash salt.\r\n        /// </summary>\r\n        public static byte[] GenerateHashSalt()\r\n        {\r\n            using (var csprng = new RNGCryptoServiceProvider())\r\n            {\r\n                var salt = new byte[24];\r\n                csprng.GetBytes(salt);\r\n                return salt;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public static IUserFormLogin GetUserFormLogin(this IUser user)\r\n        {\r\n            Guid userId = user.Id;\r\n            return DataFacade.GetData<IUserFormLogin>().Where(ufl => ufl.UserId == userId)\r\n                .FirstOrException(\"Missing user form login data for user id '{0}'\", userId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/LoginProviderPlugins/ValidateAllWindowsLoginProvider/ValidateAllWindowsLoginProvider.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Management;\r\nusing Composite.C1Console.Security.Plugins.LoginProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Security.LoginProviderPlugins.ValidateAllWindowsLoginProvider\r\n{\r\n    [Assembler(typeof(NonConfigurableLoginProviderAssembler))]\r\n    internal sealed class ValidateAllWindowsLoginProviderData : LoginProviderData\r\n    {\r\n    }\r\n\r\n\r\n    [ConfigurationElementType(typeof(ValidateAllWindowsLoginProviderData))]\r\n    internal class ValidateAllWindowsLoginProvider : IWindowsLoginProvider\r\n    {\r\n        private List<string> _usernames = null;\r\n\r\n        public IEnumerable<string> AllUsernames\r\n        {\r\n            get\r\n            {\r\n                if (_usernames == null)\r\n                {\r\n                    SelectQuery selectQuery = new SelectQuery(\"Win32_UserAccount\");\r\n                    ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher(selectQuery);\r\n                    foreach (ManagementObject managementObject in managementObjectSearcher.Get())\r\n                    {\r\n                        _usernames.Add(managementObject[\"Name\"].ToString());\r\n                    }\r\n                }\r\n\r\n                return _usernames;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool CanSetUserPassword\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n\r\n\r\n        public bool CanAddNewUser\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n\r\n\r\n        bool IWindowsLoginProvider.Validate(string username, string domainName)\r\n        {\r\n            return true;\r\n        }\r\n\r\n\r\n        public bool UsersExists\r\n        {\r\n            get { return true; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/LoginSessionStores/HttpContextBasedLoginSessionStore/HttpContextBasedLoginSessionStore.cs",
    "content": "using System;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Net;\r\nusing System.Security.Cryptography;\r\nusing System.Web;\r\nusing System.Web.Security;\r\nusing Composite.C1Console.Security.Plugins.LoginSessionStore;\r\nusing Composite.Core.Caching;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.WebClient;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Security.LoginSessionStores.HttpContextBasedLoginSessionStore\r\n{\r\n    [ConfigurationElementType(typeof(HttpContextBasedSessionDataProviderData))]\r\n    internal sealed class HttpContextBasedLoginSessionStore : ILoginSessionStore\r\n    {\r\n        private static readonly TimeSpan TempTicketMaxAge = TimeSpan.FromDays(5);\r\n        private static readonly TimeSpan TempTicketMinAge = TimeSpan.FromDays(4); // auto renew tickets younger than this\r\n\r\n        private static readonly string ContextKey = typeof(HttpContextBasedLoginSessionStore).FullName + \"StoredUsername\";\r\n\r\n        internal const string AuthCookieName = \".CMSAUTH\";\r\n\r\n        public bool CanPersistAcrossSessions\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n        public void StoreUsername(string userName, bool persistAcrossSessions)\r\n        {\r\n            StoreUsernameImpl(userName, persistAcrossSessions);\r\n        }\r\n\r\n        private static void StoreUsernameImpl(string userName, bool persistAcrossSessions)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(userName, \"userName\");\r\n\r\n            userName = userName.ToLower(CultureInfo.InvariantCulture);\r\n\r\n            TimeSpan timeToLive = (persistAcrossSessions ? TimeSpan.FromDays(365) : TempTicketMaxAge);\r\n\r\n            var ticket = new FormsAuthenticationTicket(userName, persistAcrossSessions, (int)timeToLive.TotalMinutes);\r\n            string encryptedTicket = FormsAuthentication.Encrypt(ticket);\r\n\r\n            var cookie = CookieHandler.SetCookieInternal(AuthCookieName, encryptedTicket);\r\n            cookie.HttpOnly = true;\r\n\r\n            var context = HttpContext.Current;\r\n            if (context != null)\r\n            {\r\n                if (context.Request.IsSecureConnection)\r\n                {\r\n                    cookie.Secure = true;\r\n                }\r\n                else if (cookie.Secure)\r\n                {\r\n                    throw new InvalidOperationException(\r\n                        \"A login attempt over a not secure connection, when system.web/httpCookies/@requireSSL is set to 'true'. \" +\r\n                        \"Either secure connection should be required for console login, or SSL should not be required for cookies.\");\r\n                }\r\n            }\r\n\r\n            if (persistAcrossSessions)\r\n            {\r\n                cookie.Expires = DateTime.Now + timeToLive;\r\n            }\r\n        }\r\n\r\n\r\n        \r\n        public string StoredUsername\r\n        {\r\n            [DebuggerStepThrough]\r\n            get\r\n            {\r\n                HttpContext context = HttpContext.Current;\r\n\r\n                if (context == null || !context.RequestIsAvaliable())\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                ThreadDataManagerData threadDataManagerData = ThreadDataManager.GetCurrentNotNull();\r\n\r\n                object value;\r\n                if (threadDataManagerData.TryGetParentValue(ContextKey, out value) == false)\r\n                {\r\n                    try\r\n                    {\r\n                        value = GetUsernameFromCookie();\r\n\r\n                        if (!string.IsNullOrEmpty(value as string))\r\n                        {\r\n                            threadDataManagerData.SetValue(ContextKey, value);\r\n                        }                        \r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        return null;\r\n                    }\r\n                }\r\n\r\n                return value as string;\r\n            }\r\n        }\r\n\r\n\r\n        [DebuggerStepThrough]\r\n        private static string GetUsernameFromCookie()\r\n        {\r\n            try\r\n            {\r\n                string cookieValue = CookieHandler.Get(AuthCookieName);\r\n\r\n                if (!string.IsNullOrEmpty(cookieValue))\r\n                {\r\n                    FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookieValue);\r\n\r\n                    if (!ticket.Expired && (ticket.Expiration - DateTime.Now) < TempTicketMinAge)\r\n                    {\r\n                        StoreUsernameImpl(ticket.Name, false); \r\n                    }\r\n                    \r\n                    return ticket.Name;\r\n                }\r\n            }\r\n            catch (CryptographicException)\r\n            {\r\n            }\r\n            return null;\r\n        }\r\n\r\n\r\n        public void FlushUsername()\r\n        {\r\n            CookieHandler.Set(AuthCookieName, \"\", DateTime.Now.AddYears(-10));\r\n\r\n            string key = typeof(HttpContextBasedLoginSessionStore) + \"StoredUsername\";\r\n            if (RequestLifetimeCache.HasKey(key))\r\n            {\r\n                RequestLifetimeCache.Remove(key);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IPAddress UserIpAddress\r\n        {\r\n            get\r\n            {\r\n                string ipString = HttpContext.Current.Request.UserHostAddress;\r\n                return ipString != null ? IPAddress.Parse(ipString) : null;\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableSessionDataProviderAssembler))]\r\n    internal sealed class HttpContextBasedSessionDataProviderData : LoginSessionStoreData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/LoginSessionStores/WampContextBasedLoginSessionStore/WampContextBasedBasedLoginSessionStore.cs",
    "content": "﻿using System.Net;\r\nusing Composite.C1Console.Security.Plugins.LoginSessionStore;\r\nusing Composite.Core.Application;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing WampSharp.V2;\r\n\r\nnamespace Composite.Plugins.Security.LoginSessionStores.WampContextBasedLoginSessionStore\r\n{\r\n    \r\n    [ApplicationStartup]\r\n    internal class WampContextBasedLoginSessionStoreRegistrator\r\n    {\r\n        public void ConfigureServices(IServiceCollection serviceCollection)\r\n        {\r\n            serviceCollection.AddSingleton(typeof(INoneConfigurationBasedLoginSessionStore),\r\n                typeof(WampContextBasedBasedLoginSessionStore));\r\n        }\r\n    }\r\n\r\n    internal class WampContextBasedBasedLoginSessionStore : INoneConfigurationBasedLoginSessionStore\r\n    {\r\n        public bool CanPersistAcrossSessions => false;\r\n\r\n        public void StoreUsername(string username, bool persistAcrossSessions)\r\n        {\r\n        }\r\n\r\n        public string StoredUsername\r\n        {\r\n            get\r\n            {\r\n                if (WampInvocationContext.Current != null)\r\n                {\r\n                    return WampInvocationContext.Current.InvocationDetails.CallerAuthenticationId;\r\n                }\r\n\r\n                return null;\r\n            }\r\n        }\r\n        public void FlushUsername()\r\n        {\r\n        }\r\n\r\n        public IPAddress UserIpAddress => null;\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/PasswordRules/DifferentCharacterGroups/DifferentCharacterGroupsPasswordRule.cs",
    "content": "﻿using Composite.C1Console.Security.Plugins.PasswordPolicy;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Security.PasswordRules.DifferentCharacterGroups\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurablePasswordRule))]\r\n    internal class DifferentCharacterGroupsPasswordRule : IPasswordRule\r\n    {\r\n        public bool ValidatePassword(IUser user, string password)\r\n        {\r\n            bool lowerCaseLetters = false, upperCaseLetters = false, digits = false, otherCharacters = false;\r\n\r\n            foreach (var ch in password)\r\n            {\r\n                if (char.IsLower(ch))\r\n                {\r\n                    lowerCaseLetters = true;\r\n                    continue;\r\n                }\r\n\r\n                if (char.IsUpper(ch))\r\n                {\r\n                    upperCaseLetters = true;\r\n                    continue;\r\n                }\r\n\r\n                if (char.IsDigit(ch))\r\n                {\r\n                    digits = true;\r\n                    continue;\r\n                }\r\n\r\n                otherCharacters = true;\r\n            }\r\n\r\n            int points = 0;\r\n            if (lowerCaseLetters) points++;\r\n            if (upperCaseLetters) points++;\r\n            if (digits) points++;\r\n            if (otherCharacters) points++;\r\n\r\n            return points >= 3;\r\n        }\r\n\r\n        public string GetRuleDescription()\r\n        {\r\n            return LocalizationFiles.Composite_C1Console_Users.PasswordRules_DifferentCharacterGroups;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/PasswordRules/DoNotUseUserName/DoNotUseUserNamePasswordRule.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Security.Plugins.PasswordPolicy;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Security.PasswordRules.DoNotUseUserName\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurablePasswordRule))]\r\n    internal class DoNotUseUserNamePasswordRule : IPasswordRule\r\n    {\r\n        public bool ValidatePassword(IUser user, string password)\r\n        {\r\n            return password.IndexOf(user.Username, StringComparison.InvariantCultureIgnoreCase) == -1;\r\n        }\r\n\r\n        public string GetRuleDescription()\r\n        {\r\n            return LocalizationFiles.Composite_C1Console_Users.PasswordRules_DoNotUseUserName;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/PasswordRules/EnforcePasswordHistory/EnforcePasswordHistoryPasswordRule.cs",
    "content": "﻿using Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Plugins.PasswordPolicy;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Security.LoginProviderPlugins.DataBasedFormLoginProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\nnamespace Composite.Plugins.Security.PasswordRules.EnforcePasswordHistory\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurablePasswordRule))]\r\n    internal class EnforcePasswordHistoryPasswordRule : IPasswordRule\r\n    {\r\n        public bool ValidatePassword(IUser user, string password)\r\n        {\r\n            if (PasswordPolicyFacade.PasswordHistoryLength <= 0) return true;\r\n\r\n            return !UserFormLoginManager.PasswordFoundInHistory(user, password);\r\n        }\r\n\r\n        public string GetRuleDescription()\r\n        {\r\n            return LocalizationFiles.Composite_C1Console_Users.PasswordRules_EnforcePasswordHistory(PasswordPolicyFacade.PasswordHistoryLength + 1);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/PasswordRules/MinimumLength/MinimumLengthPasswordRule.cs",
    "content": "﻿using System.Configuration;\r\nusing Composite.C1Console.Security.Plugins.PasswordPolicy;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Types;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\nnamespace Composite.Plugins.Security.PasswordRules.MinimumLength\r\n{\r\n    [ConfigurationElementType(typeof(MinimumLengthPasswordRuleData))]\r\n    internal class MinimumLengthPasswordRule : IPasswordRule\r\n    {\r\n        public MinimumLengthPasswordRule(int minLength)\r\n        {\r\n            Verify.That(minLength > 0, \"The minimum length of a password should be at least 1 character.\");\r\n\r\n            _minLength = minLength;\r\n        }\r\n\r\n        private readonly int _minLength;\r\n\r\n        public bool ValidatePassword(IUser user, string password)\r\n        {\r\n            return password.Length >= _minLength;\r\n        }\r\n\r\n        public string GetRuleDescription()\r\n        {\r\n            return LocalizationFiles.Composite_C1Console_Users.PasswordRules_MinimumLength(_minLength);\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(MinimumLengthPasswordRuleAssembler))]\r\n    internal class MinimumLengthPasswordRuleData : PasswordRuleData\r\n    {\r\n        [ConfigurationProperty(\"minLength\", IsRequired = true)]\r\n        public int MinLength\r\n        {\r\n            get { return (int)base[\"minLength\"]; }\r\n            set { base[\"minLength\"] = value; }\r\n        }\r\n    }\r\n\r\n    internal class MinimumLengthPasswordRuleAssembler : IAssembler<IPasswordRule, PasswordRuleData>\r\n    {\r\n        IPasswordRule IAssembler<IPasswordRule, PasswordRuleData>.Assemble(IBuilderContext context, PasswordRuleData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            var data = (MinimumLengthPasswordRuleData) objectConfiguration;\r\n            return new MinimumLengthPasswordRule(data.MinLength);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/UserGroupPermissionDefinitionProvider/DataBasedUserGroupPermissionDefinitionProvider/DataBasedUserGroupPermissionDefinitionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Plugins.UserGroupPermissionDefinitionProvider;\r\nusing Composite.Data.Transactions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\n\r\n\r\nnamespace Composite.Plugins.Security.UserGroupPermissionDefinitionProvider.DataBasedUserGroupPermissionDefinitionProvider\r\n{\r\n    [ConfigurationElementType(typeof(NonConfigurableUserGroupPermissionDefinitionProvider))]\r\n    class DataBasedUserGroupPermissionDefinitionProvider : IUserGroupPermissionDefinitionProvider\r\n\t{\r\n        private static readonly int PermissionCacheSize = 50;\r\n        private static readonly Cache<Guid, ReadOnlyCollection<UserGroupPermissionDefinition>> _permissionCache = new Cache<Guid, ReadOnlyCollection<UserGroupPermissionDefinition>>(\"DataBasedUserGroupPermissionDefinitionProvider\", PermissionCacheSize);\r\n\r\n        static DataBasedUserGroupPermissionDefinitionProvider()\r\n        {\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IUserGroupPermissionDefinition>(OnUserGroupPermissionChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd<IUserGroupPermissionDefinition>(OnUserGroupPermissionChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<IUserGroupPermissionDefinition>(OnUserGroupPermissionChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IUserGroupPermissionDefinition>(OnUserGroupPermissionStoreChanged, true);\r\n            \r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<UserGroupPermissionDefinition> AllUserGroupPermissionDefinitions\r\n        {\r\n            get \r\n            {\r\n                return\r\n                    (from urd in DataFacade.GetData<IUserGroupPermissionDefinition>()\r\n                     select (UserGroupPermissionDefinition)new DataUserGroupPermissionDefinition(urd)).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool CanAlterDefinitions\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<UserGroupPermissionDefinition> GetPermissionsByUserGroup(Guid userGroupId)\r\n        {\r\n            ReadOnlyCollection<UserGroupPermissionDefinition> cachedUserGroupPermissionDefinitions = _permissionCache.Get(userGroupId);\r\n            if (cachedUserGroupPermissionDefinitions != null)\r\n            {\r\n                return cachedUserGroupPermissionDefinitions;\r\n            }\r\n\r\n            List<UserGroupPermissionDefinition> userGroupPermissionDefinitions = \r\n                (from urd in DataFacade.GetData<IUserGroupPermissionDefinition>()\r\n                 where urd.UserGroupId == userGroupId\r\n                 select (UserGroupPermissionDefinition)new DataUserGroupPermissionDefinition(urd)).ToList();\r\n\r\n            _permissionCache.Add(userGroupId, new ReadOnlyCollection<UserGroupPermissionDefinition>(userGroupPermissionDefinitions));\r\n\r\n            return userGroupPermissionDefinitions;\r\n        }\r\n\r\n\r\n        private EntityToken DeserializeSilent(string serializedEntityToken)\r\n        {\r\n            try\r\n            {\r\n                return EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                // Silent\r\n                return null;\r\n            }\r\n        }\r\n\r\n        public void SetUserGroupPermissionDefinition(UserGroupPermissionDefinition userGroupPermissionDefinition)\r\n        {\r\n            Guid userGroupId = userGroupPermissionDefinition.UserGroupId;\r\n            string serializedEntityToken = userGroupPermissionDefinition.SerializedEntityToken;\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IEnumerable<IUserGroupPermissionDefinition> existingPermissionDefinitions =\r\n                        DataFacade.GetData<IUserGroupPermissionDefinition>()\r\n                                  .Where(d => d.UserGroupId == userGroupId)\r\n                                  .ToList()\r\n                                  .Where(d => userGroupPermissionDefinition.EntityToken.EqualsWithVersionIgnore(DeserializeSilent(d.SerializedEntityToken)))\r\n                                  .ToList();\r\n\r\n                DataFacade.Delete(existingPermissionDefinitions);\r\n\r\n                IUserGroupPermissionDefinition definition = DataFacade.BuildNew<IUserGroupPermissionDefinition>();\r\n                definition.Id = Guid.NewGuid();\r\n                definition.UserGroupId = userGroupId;\r\n                definition.SerializedEntityToken = serializedEntityToken;\r\n\r\n                DataFacade.AddNew(definition);\r\n\r\n\r\n                foreach (PermissionType permissionType in userGroupPermissionDefinition.PermissionTypes)\r\n                {\r\n                    IUserGroupPermissionDefinitionPermissionType permission = DataFacade.BuildNew<IUserGroupPermissionDefinitionPermissionType>();\r\n                    permission.Id = Guid.NewGuid();\r\n                    permission.PermissionTypeName = permissionType.ToString();\r\n                    permission.UserGroupPermissionDefinitionId = definition.Id;\r\n\r\n                    DataFacade.AddNew(permission);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void RemoveUserGroupPermissionDefinition(Guid userGroupId, string serializedEntityToken)\r\n        {\r\n            var entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IList<IUserGroupPermissionDefinition> toDelete;\r\n\r\n                if (entityToken.IsValid())\r\n                {\r\n                    toDelete = DataFacade.GetData<IUserGroupPermissionDefinition>()\r\n                        .Where(ugpd => ugpd.UserGroupId == userGroupId)\r\n                        .ToList()\r\n                        .Where(d => entityToken.EqualsWithVersionIgnore(DeserializeSilent(d.SerializedEntityToken)))\r\n                        .ToList();\r\n                }\r\n                else\r\n                {\r\n                    toDelete = DataFacade.GetData<IUserGroupPermissionDefinition>()\r\n                        .Where(ugpd => ugpd.UserGroupId == userGroupId && ugpd.SerializedEntityToken == serializedEntityToken).ToList();\r\n                }\r\n\r\n                if (toDelete.Any())\r\n                {\r\n                    DataFacade.Delete<IUserGroupPermissionDefinition>(toDelete);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnUserGroupPermissionStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                _permissionCache.Clear();\r\n            }\r\n        }\r\n\r\n\r\n        private static void OnUserGroupPermissionChanged(object sender, DataEventArgs args)\r\n        {\r\n            var userGroupPermissionDefinition = args.Data as IUserGroupPermissionDefinition;\r\n            if (userGroupPermissionDefinition == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            _permissionCache.Remove(userGroupPermissionDefinition.UserGroupId);\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n        internal sealed class DataUserGroupPermissionDefinition : UserGroupPermissionDefinition\r\n        {\r\n            private IUserGroupPermissionDefinition _userGroupPermissionDefinition;\r\n            private List<PermissionType> _permissionTypes;\r\n\r\n\r\n            public DataUserGroupPermissionDefinition(IUserGroupPermissionDefinition userGroupPermissionDefinition)\r\n            {\r\n                _userGroupPermissionDefinition = userGroupPermissionDefinition;\r\n\r\n                Guid permissionDefinitionId = userGroupPermissionDefinition.Id;\r\n\r\n                List<string> permissionTypeNames =\r\n                    (from pt in DataFacade.GetData<IUserGroupPermissionDefinitionPermissionType>()\r\n                     where pt.UserGroupPermissionDefinitionId == permissionDefinitionId\r\n                     select pt.PermissionTypeName).ToList();\r\n\r\n                _permissionTypes = permissionTypeNames.FromListOfStrings().ToList();\r\n            }\r\n\r\n\r\n            public override Guid UserGroupId\r\n            {\r\n                get\r\n                {\r\n                    return _userGroupPermissionDefinition.UserGroupId;\r\n                }\r\n            }\r\n\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get\r\n                {\r\n                    foreach (PermissionType permissionType in _permissionTypes)\r\n                    {\r\n                        yield return permissionType;\r\n                    }\r\n                }\r\n            }\r\n\r\n\r\n            public override string SerializedEntityToken\r\n            {\r\n                get\r\n                {\r\n                    return _userGroupPermissionDefinition.SerializedEntityToken;\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/UserPermissionDefinitionProvider/ConfigBasedUserPermissionDefinitionProvider/ConfigBasedUserPermissionDefinitionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing Microsoft.Practices.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Security.UserPermissionDefinitionProvider.ConfigBasedUserPermissionDefinitionProvider\r\n{\r\n    [ConfigurationElementType(typeof(ConfigBasedUserPermissionDefinitionProviderData))]\r\n    internal sealed class ConfigBasedUserPermissionDefinitionProvider : IUserPermissionDefinitionProvider\r\n\t{\r\n        List<UserPermissionDefinition> _userPermissionDefinitions = new List<UserPermissionDefinition>();\r\n\r\n        public ConfigBasedUserPermissionDefinitionProvider(ConfigBasedUserPermissionDefinitionProviderData configBasedUserPermissionDefinitionProviderData)\r\n        {\r\n            foreach (UserPermissionDefinitionConfigurationElement element in configBasedUserPermissionDefinitionProviderData.UserPermissionDefinitions)\r\n            {\r\n                _userPermissionDefinitions.Add(new ConfigUserPermissionDefinition(element));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<UserPermissionDefinition> AllUserPermissionDefinitions\r\n        {\r\n            get \r\n            { \r\n                foreach (UserPermissionDefinition userPermissionDefinition in _userPermissionDefinitions)\r\n                {\r\n                    yield return userPermissionDefinition;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool CanAlterDefinitions\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n\r\n\r\n        public void SetUserPermissionDefinition(UserPermissionDefinition userPermissionDefinition)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        public void RemoveUserPermissionDefinition(UserToken userToken, string serializedEntityToken)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n\r\n\r\n        internal sealed class ConfigUserPermissionDefinition : UserPermissionDefinition\r\n        {\r\n            UserPermissionDefinitionConfigurationElement _element;\r\n\r\n\r\n            public ConfigUserPermissionDefinition(UserPermissionDefinitionConfigurationElement element)\r\n            {\r\n                _element = element;\r\n            }\r\n\r\n\r\n            public override string Username\r\n            {\r\n                get\r\n                {\r\n                    return _element.Username;\r\n                }\r\n            }\r\n\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get\r\n                {\r\n                    throw new NotImplementedException();\r\n                    //return _element.PermissionName;\r\n                }\r\n            }\r\n\r\n\r\n            public override string SerializedEntityToken\r\n            {\r\n                get\r\n                {\r\n                    return _element.SerializedEntityToken;\r\n                }\r\n            }\r\n        }\r\n\r\n        #region IUserPermissionDefinitionProvider Members\r\n\r\n\r\n        public IEnumerable<UserPermissionDefinition> GetPermissionsByUser(string userName)\r\n        {\r\n            return from urd in AllUserPermissionDefinitions\r\n                   where urd.Username == userName\r\n                   select urd;\r\n        }\r\n\r\n        #endregion\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(ConfigBasedUserPermissionDefinitionProviderAssembler))]\r\n    internal sealed class ConfigBasedUserPermissionDefinitionProviderData : UserPermissionDefinitionProviderData\r\n    {\r\n        private const string _userPermissionDefinitionsProperty = \"UserPermissionDefinitions\";\r\n        [ConfigurationProperty(_userPermissionDefinitionsProperty, IsRequired = true)]\r\n        public UserPermissionDefinitionConfigurationElementCollection UserPermissionDefinitions\r\n        {\r\n            get\r\n            {\r\n                return (UserPermissionDefinitionConfigurationElementCollection)base[_userPermissionDefinitionsProperty];\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    internal sealed class UserPermissionDefinitionConfigurationElement : ConfigurationElement\r\n    {\r\n        private const string _usernameProperty = \"username\";\r\n        [ConfigurationProperty(_usernameProperty, IsRequired = true)]\r\n        public string Username\r\n        {\r\n            get { return (string)base[_usernameProperty]; }\r\n            set { base[_usernameProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _permissionTypeNameProperty = \"permissionTypeName\";\r\n        [ConfigurationProperty(_permissionTypeNameProperty, IsRequired = true)]\r\n        public string PermissionTypeName\r\n        {\r\n            get { return (string)base[_permissionTypeNameProperty]; }\r\n            set { base[_permissionTypeNameProperty] = value; }\r\n        }\r\n\r\n\r\n\r\n        private const string _serializedEntityTokenProperty = \"serializedEntityToken\";\r\n        [ConfigurationProperty(_serializedEntityTokenProperty, IsRequired = true)]\r\n        public string SerializedEntityToken\r\n        {\r\n            get { return (string)base[_serializedEntityTokenProperty]; }\r\n            set { base[_serializedEntityTokenProperty] = value; }\r\n        }\r\n\r\n\r\n        public string CompositionName\r\n        {\r\n            get\r\n            {\r\n                return string.Format(\"{0}{1}{2}\", this.Username, this.PermissionTypeName, this.SerializedEntityToken);\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class UserPermissionDefinitionConfigurationElementCollection : ConfigurationElementCollection\r\n    {\r\n        public void Add(UserPermissionDefinitionConfigurationElement element)\r\n        {\r\n            base.BaseAdd(element);\r\n        }\r\n\r\n        protected override ConfigurationElement CreateNewElement()\r\n        {\r\n            return new UserPermissionDefinitionConfigurationElement();\r\n        }\r\n\r\n        protected override object GetElementKey(ConfigurationElement element)\r\n        {\r\n            UserPermissionDefinitionConfigurationElement castedElement = (UserPermissionDefinitionConfigurationElement)element;\r\n\r\n            return castedElement.CompositionName;\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n    internal sealed class ConfigBasedUserPermissionDefinitionProviderAssembler : IAssembler<IUserPermissionDefinitionProvider, UserPermissionDefinitionProviderData>\r\n    {\r\n        public IUserPermissionDefinitionProvider Assemble(IBuilderContext context, UserPermissionDefinitionProviderData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)\r\n        {\r\n            ConfigBasedUserPermissionDefinitionProviderData data = (ConfigBasedUserPermissionDefinitionProviderData)objectConfiguration;\r\n\r\n            return new ConfigBasedUserPermissionDefinitionProvider(data);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Security/UserPermissionDefinitionProvider/DataBaseUserPermissionDefinitionProvider/DataBaseUserPermissionDefinitionProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Caching;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Plugins.UserPermissionDefinitionProvider;\r\nusing Composite.Data.Transactions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Security.UserPermissionDefinitionProvider.DataBaseUserPermissionDefinitionProvider\r\n{\r\n    [ConfigurationElementType(typeof(DataBaseUserPermissionDefinitionProviderData))]\r\n    internal sealed class DataBaseUserPermissionDefinitionProvider : IUserPermissionDefinitionProvider\r\n    {\r\n        private static readonly int PermissionCacheSize = 1000;\r\n\r\n        private static readonly Cache<string, ReadOnlyCollection<UserPermissionDefinition>> _permissionCache \r\n            = new Cache<string, ReadOnlyCollection<UserPermissionDefinition>>(\"Security permissions\", PermissionCacheSize);\r\n\r\n\r\n\r\n        static DataBaseUserPermissionDefinitionProvider()\r\n        {\r\n            SubscribeToEvents();\r\n        }\r\n\r\n\r\n\r\n        private static void SubscribeToEvents()\r\n        {\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate<IUserPermissionDefinition>(OnUserPermissionChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd<IUserPermissionDefinition>(OnUserPermissionChanged, true);\r\n            DataEventSystemFacade.SubscribeToDataDeleted<IUserPermissionDefinition>(OnUserPermissionChanged, true);\r\n            DataEventSystemFacade.SubscribeToStoreChanged<IUserPermissionDefinition>(OnUserPermissionStoreChanged, true);\r\n        }\r\n\r\n        \r\n        \r\n        public IEnumerable<UserPermissionDefinition> AllUserPermissionDefinitions\r\n        {\r\n            get\r\n            {\r\n                // DDZ: To be refactored - has O(N(IUserPermissionDefinition) * N(IUserPermissionDefinitionType)) compexity, which isn't acceplable\r\n                // for 100+ users. \r\n                return\r\n                    (from urd in DataFacade.GetData<IUserPermissionDefinition>()\r\n                     select (UserPermissionDefinition)new DataUserPermissionDefinition(urd)).ToList();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool CanAlterDefinitions\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n        private EntityToken DeserializeSilent(string serializedEntityToken)\r\n        {\r\n            try\r\n            {\r\n                return EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                // Silent\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n        public void SetUserPermissionDefinition(UserPermissionDefinition userPermissionDefinition)\r\n        {\r\n            string username = userPermissionDefinition.Username;\r\n            string serializedEntityToken = userPermissionDefinition.SerializedEntityToken;\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IEnumerable<IUserPermissionDefinition> existingUserPermissionDefinitions = \r\n                    DataFacade.GetData<IUserPermissionDefinition>()\r\n                              .Where(d => d.Username == username)\r\n                              .ToList()\r\n                              .Where(d => userPermissionDefinition.EntityToken.EqualsWithVersionIgnore(DeserializeSilent(d.SerializedEntityToken)))\r\n                              .ToList();\r\n\r\n                DataFacade.Delete(existingUserPermissionDefinitions);\r\n\r\n                IUserPermissionDefinition definition = DataFacade.BuildNew<IUserPermissionDefinition>();\r\n                definition.Id = Guid.NewGuid();\r\n                definition.Username = userPermissionDefinition.Username;\r\n                definition.SerializedEntityToken = serializedEntityToken;\r\n\r\n                DataFacade.AddNew(definition);\r\n\r\n\r\n                foreach (PermissionType permissionType in userPermissionDefinition.PermissionTypes)\r\n                {\r\n                    IUserPermissionDefinitionPermissionType permission = DataFacade.BuildNew<IUserPermissionDefinitionPermissionType>();\r\n                    permission.Id = Guid.NewGuid();\r\n                    permission.PermissionTypeName = permissionType.ToString();\r\n                    permission.UserPermissionDefinitionId = definition.Id;\r\n\r\n                    DataFacade.AddNew(permission);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public void RemoveUserPermissionDefinition(UserToken userToken, string serializedEntityToken)\r\n        {\r\n            string username = userToken.Username;\r\n\r\n            var entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IList<IUserPermissionDefinition> toDelete;\r\n                if (entityToken.IsValid())\r\n                {\r\n                    toDelete = DataFacade.GetData<IUserPermissionDefinition>()\r\n                        .Where(upd => upd.Username == username)\r\n                        .ToList()\r\n                        .Where(d => entityToken.EqualsWithVersionIgnore(DeserializeSilent(d.SerializedEntityToken)))\r\n                        .ToList();\r\n                }\r\n                else\r\n                {\r\n                    toDelete = DataFacade.GetData<IUserPermissionDefinition>()\r\n                        .Where(upd => upd.Username == username && upd.SerializedEntityToken == serializedEntityToken)\r\n                        .ToList();\r\n                }\r\n\r\n                if (toDelete.Count > 0)\r\n                {\r\n                    DataFacade.Delete<IUserPermissionDefinition>(toDelete);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public IEnumerable<UserPermissionDefinition> GetPermissionsByUser(string userName)\r\n        {\r\n            var cachedValue = _permissionCache.Get(userName);\r\n            if(cachedValue != null)\r\n            {\r\n                return cachedValue;\r\n            }\r\n\r\n            var allPermissionTypes = DataFacade.GetData<IUserPermissionDefinitionPermissionType>()\r\n                .GroupBy(p => p.UserPermissionDefinitionId).ToDictionary(g => g.Key, g => g.ToList());\r\n\r\n            var permissions = (from urd in DataFacade.GetData<IUserPermissionDefinition>().Evaluate()\r\n                              where urd.Username == userName\r\n                                    && allPermissionTypes.ContainsKey(urd.Id)\r\n                              select (UserPermissionDefinition) new DataUserPermissionDefinition(urd, allPermissionTypes[urd.Id])).ToList();\r\n\r\n            _permissionCache.Add(userName, new ReadOnlyCollection<UserPermissionDefinition>(permissions));\r\n            return permissions;\r\n        }\r\n\r\n\r\n\r\n        internal sealed class DataUserPermissionDefinition : UserPermissionDefinition\r\n        {\r\n            private readonly IUserPermissionDefinition _userPermissionDefinition;\r\n            private readonly List<PermissionType> _permissionTypes;\r\n\r\n\r\n            public DataUserPermissionDefinition(IUserPermissionDefinition userPermissionDefinition)\r\n            {\r\n                _userPermissionDefinition = userPermissionDefinition;\r\n\r\n                Guid permissionDefinitionId = userPermissionDefinition.Id;\r\n\r\n                List<string> permissionTypeNames =\r\n                    (from pt in DataFacade.GetData<IUserPermissionDefinitionPermissionType>()\r\n                     where pt.UserPermissionDefinitionId == permissionDefinitionId\r\n                     select pt.PermissionTypeName).ToList();\r\n\r\n                _permissionTypes = permissionTypeNames.FromListOfStrings().ToList();\r\n            }\r\n\r\n            public DataUserPermissionDefinition(IUserPermissionDefinition userPermissionDefinition, IEnumerable<IUserPermissionDefinitionPermissionType> permissionTypes)\r\n            {\r\n                _userPermissionDefinition = userPermissionDefinition;\r\n\r\n                var permissionTypeNames = permissionTypes.Select(pt => pt.PermissionTypeName);\r\n\r\n                _permissionTypes = permissionTypeNames.FromListOfStrings().ToList();\r\n            }\r\n\r\n\r\n\r\n            public override string Username\r\n            {\r\n                get\r\n                {\r\n                    return _userPermissionDefinition.Username;\r\n                }\r\n            }\r\n\r\n\r\n            public override IEnumerable<PermissionType> PermissionTypes\r\n            {\r\n                get \r\n                {\r\n                    return _permissionTypes;\r\n                }\r\n            }\r\n\r\n\r\n            public override string SerializedEntityToken\r\n            {\r\n                get\r\n                {\r\n                    return _userPermissionDefinition.SerializedEntityToken;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void OnUserPermissionStoreChanged(object sender, StoreEventArgs storeEventArgs)\r\n        {\r\n            if (!storeEventArgs.DataEventsFired)\r\n            {\r\n                _permissionCache.Clear();\r\n            }\r\n        }\r\n\r\n        private static void OnUserPermissionChanged(object sender, DataEventArgs args)\r\n        {\r\n            var permission = args.Data as IUserPermissionDefinition;\r\n            if (permission == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            _permissionCache.Remove(permission.Username);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableUserPermissionDefinitionProviderAssembler))]\r\n    internal sealed class DataBaseUserPermissionDefinitionProviderData : UserPermissionDefinitionProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Types/TypeManagerTypeHandler/AspNetBuildManagerTypeManagerTypeHandler/AspNetBuildManagerTypeManagerTypeHandler.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Web.Compilation;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\nusing System.Web.Hosting;\r\n\r\n\r\nnamespace Composite.Plugins.Types.TypeManagerTypeHandler.AspNetBuildManagerTypeManagerTypeHandler\r\n{    \r\n    [ConfigurationElementType(typeof(AspNetBuildManagerTypeManagerTypeHandlerData))]\r\n    internal sealed class AspNetBuildManagerTypeManagerTypeHandler : ITypeManagerTypeHandler\r\n    {\r\n        private const string _typeNamePrefix = \"AspNetType:\";\r\n\r\n        public Type GetType(string fullName)\r\n        {\r\n            if (!HostingEnvironment.IsHosted) return null;\r\n\r\n            string name = fullName;\r\n\r\n            if (name.StartsWith(_typeNamePrefix))\r\n            {\r\n                name = name.Remove(0, _typeNamePrefix.Length);\r\n            }\r\n\r\n            if(name.Contains(\":\"))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return BuildManager.GetType(name, false, true);\r\n        }\r\n\r\n\r\n        public string SerializeType(Type type)\r\n        {\r\n            if (!HostingEnvironment.IsHosted) return null;\r\n\r\n            if (BuildManager.CodeAssemblies != null)\r\n            {\r\n                foreach (object obj in BuildManager.CodeAssemblies)\r\n                {\r\n                    Assembly assembly = obj as Assembly;\r\n\r\n                    if (assembly != null)\r\n                    {\r\n                        if (assembly.GetTypes().Contains(type))\r\n                        {\r\n                            return string.Format(\"{0}{1}\", _typeNamePrefix, type.FullName);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            \r\n            return null;\r\n        }\r\n\r\n\r\n\r\n        public bool HasTypeWithName(string typeFullname)\r\n        {\r\n            if (!HostingEnvironment.IsHosted) return false;\r\n\r\n            return BuildManager.GetType(typeFullname, false, true) != null;\r\n        }\r\n    }\r\n\r\n    [Assembler(typeof(NonConfigurableTypeManagerTypeHandlerAssembler))]\r\n    internal sealed class AspNetBuildManagerTypeManagerTypeHandlerData : TypeManagerTypeHandlerData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Types/TypeManagerTypeHandler/DynamicBuildManagerTypeManagerTypeHandler/DynamicBuildManagerTypeManagerTypeHandler.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Types.TypeManagerTypeHandler.DynamicBuildManagerTypeManagerTypeHandler\r\n{    \r\n    [ConfigurationElementType(typeof(DynamicBuildManagerTypeManagerTypeHandlerData))]\r\n    internal sealed class DynamicBuildManagerTypeManagerTypeHandler : ITypeManagerTypeHandler\r\n    {\r\n        private static readonly string _prefix = \"DynamicType:\";\r\n\r\n        private static readonly object _lock = new object();\r\n        private static readonly Dictionary<Type, string> _serializedCache = new Dictionary<Type, string>();\r\n\r\n        public Type GetType(string fullName)\r\n        {\r\n            Type compiledType = CodeGenerationManager.GetCompiledType(fullName);\r\n            if (compiledType != null) return compiledType;\r\n\r\n            string name = fullName;\r\n\r\n            bool hasObsoletePrefix = name.StartsWith(_prefix);\r\n            if (hasObsoletePrefix)\r\n            {\r\n                name = name.Substring(_prefix.Length);\r\n            }\r\n\r\n            if (!name.Contains(\",\") && (hasObsoletePrefix || !HostingEnvironment.IsHosted))\r\n            {\r\n                return Type.GetType(name + \", Composite.Generated\");\r\n            }\r\n            \r\n            return null;\r\n        }\r\n\r\n\r\n        \r\n        public string SerializeType(Type type)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                string result;\r\n\r\n                if (!_serializedCache.TryGetValue(type, out result))\r\n                {\r\n                    result = SerializeTypeImpl(type);\r\n                    _serializedCache.Add(type, result);\r\n                }\r\n\r\n                return result;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool HasTypeWithName(string typeFullname)\r\n        {\r\n            return GetType(typeFullname) != null;\r\n        }\r\n\r\n\r\n\r\n        private static string SerializeTypeImpl(Type type)\r\n        {\r\n            string assemblyLocation = type.Assembly.Location;\r\n            string assemblyCodeBase = type.Assembly.CodeBase;\r\n            string tempAssemblyFolderPath = CodeGenerationManager.TempAssemblyFolderPath;\r\n            string tempAssemblyFolderUri = new Uri(tempAssemblyFolderPath).AbsoluteUri;\r\n\r\n            if (assemblyLocation.StartsWith(tempAssemblyFolderPath, StringComparison.InvariantCultureIgnoreCase) ||\r\n                assemblyCodeBase.StartsWith(tempAssemblyFolderUri, StringComparison.InvariantCultureIgnoreCase) ||\r\n                assemblyLocation.IndexOf(CodeGenerationManager.CompositeGeneratedFileName, StringComparison.InvariantCultureIgnoreCase) >= 0)\r\n            {\r\n                return type.FullName;\r\n            }\r\n                \r\n            return null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableTypeManagerTypeHandlerAssembler))]\r\n    internal sealed class DynamicBuildManagerTypeManagerTypeHandlerData : TypeManagerTypeHandlerData\r\n    {        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Types/TypeManagerTypeHandler/SystemTypeManagerTypeHandler/SystemTypeManagerTypeHandler.cs",
    "content": "using System;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Types.Plugins.TypeManagerTypeHandler;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Types.TypeManagerTypeHandler.SystemTypeManagerTypeHandler\r\n{\r\n    [ConfigurationElementType(typeof(SystemTypeManagerTypeHandlerData))]\r\n    internal sealed class SystemTypeManagerTypeHandler : ITypeManagerTypeHandler\r\n    {\r\n        public Type GetType(string fullName)\r\n        {\r\n            if(fullName.Contains(\":\"))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            try\r\n            {\r\n                return Type.GetType(fullName);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                // Suppress all exceptions\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public string SerializeType(Type type)\r\n        {\r\n            if (type.FullName.StartsWith(\"System\") == false)\r\n            {\r\n                return type.GetVersionNeutralName();\r\n            }\r\n            else\r\n            {\r\n                return type.AssemblyQualifiedName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public bool HasTypeWithName(string typeFullname)\r\n        {\r\n            return GetType(typeFullname) != null;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableTypeManagerTypeHandlerAssembler))]\r\n    internal sealed class SystemTypeManagerTypeHandlerData : TypeManagerTypeHandlerData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Validation/ClientValidationRuleTranslators/StandardClientValidationRuleTranslator/StandardClientValidationRuleTranslator.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Data.Validation.Plugins.ClientValidationRuleTranslator;\r\nusing Composite.Data.Validation.Validators;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Validation.ClientValidationRuleTranslators.StandardClientValidationRuleTranslator\r\n{\r\n    [ConfigurationElementType(typeof(StandardClientValidationRuleTranslatorData))]\r\n    internal sealed class StandardClientValidationRuleTranslator : IClientValidationRuleTranslator\r\n    {\r\n        private readonly List<Type> _supportedTypes = new List<Type>\r\n            {\r\n                typeof(RegexValidatorAttribute),\r\n#pragma warning disable 0612\r\n                typeof(StringLengthValidatorAttribute),\r\n#pragma warning restore 0612\r\n                typeof(Microsoft.Practices.EnterpriseLibrary.Validation.Validators.NotNullValidatorAttribute)\r\n            };\r\n\r\n\r\n\r\n        public IEnumerable<Type> GetSupportedAttributeTypes()\r\n        {\r\n            return _supportedTypes;\r\n        }\r\n\r\n\r\n\r\n        public ClientValidationRule Translate(Attribute attribute)\r\n        {\r\n            Type type = attribute.GetType();\r\n\r\n            if (type == typeof(RegexValidatorAttribute))\r\n            {\r\n                return new RegexClientValidationRule((attribute as RegexValidatorAttribute).Pattern);\r\n            }\r\n#pragma warning disable 0612\r\n            else if (type == typeof(StringLengthValidatorAttribute))\r\n            {\r\n                return new StringLengthClientValidationRule((attribute as StringLengthValidatorAttribute).LowerBound, (attribute as StringLengthValidatorAttribute).UpperBound);\r\n            }\r\n#pragma warning restore 0612\r\n            else if (type == typeof(StringSizeValidatorAttribute))\r\n            {\r\n                return new StringLengthClientValidationRule((attribute as StringSizeValidatorAttribute).LowerBound, (attribute as StringSizeValidatorAttribute).UpperBound);\r\n            }\r\n\r\n            else if (type == typeof(Microsoft.Practices.EnterpriseLibrary.Validation.Validators.NotNullValidatorAttribute))\r\n            {\r\n                return new NotNullClientValidationRule();\r\n            }\r\n            else\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"The attribute type '{0}' is not supported\", attribute.GetType()));\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableClientValidationRuleTranslatorAssembler))]\r\n    internal sealed class StandardClientValidationRuleTranslatorData : ClientValidationRuleTranslatorData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Plugins/Workflow/WorkflowRuntimeProviders/StandardWorkflowRuntimeProvider/StandardWorkflowRuntimeProvider.cs",
    "content": "using System.Workflow.Runtime;\r\nusing Composite.C1Console.Workflow.Plugins.WorkflowRuntimeProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration;\r\nusing Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;\r\n\r\n\r\nnamespace Composite.Plugins.Workflow.WorkflowRuntimeProviders.StandardWorkflowRuntimeProvider\r\n{\r\n    [ConfigurationElementType(typeof(StandardWorkflowRuntimeProviderData))]\r\n    internal sealed class StandardWorkflowRuntimeProvider : IWorkflowRuntimeProvider\r\n    {\r\n        public WorkflowRuntime GetWorkflowRuntime()\r\n        {\r\n            return new WorkflowRuntime();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    [Assembler(typeof(NonConfigurableWorkflowRuntimeProviderAssembler))]\r\n    internal sealed class StandardWorkflowRuntimeProviderData : WorkflowRuntimeProviderData\r\n    {\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Properties/AssemblyInfo.cs",
    "content": "using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controlled through the following \r\n// set of attributes. Change these attribute values to modify the information\r\n// associated with an assembly. See also Composite SharedAssemblyInfo.cs\r\n[assembly: AssemblyDescription(\"C1 CMS Core classes\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n\r\n// Setting ComVisible to false makes the types in this assembly not visible \r\n// to COM components.  If you need to access a type in this assembly from \r\n// COM, set the ComVisible attribute to true on that type.\r\n[assembly: ComVisible(false)]\r\n\r\n// The following GUID is for the ID of the typelib if this project is exposed to COM\r\n[assembly: Guid(\"c190c8d0-449f-42db-972d-0fc30f8c301d\")]\r\n\r\n[assembly: InternalsVisibleTo(\"UpgradePackage\")]\r\n[assembly: InternalsVisibleTo(\"Composite.Workflows\")]"
  },
  {
    "path": "Composite/Properties/SharedAssemblyInfo.cs",
    "content": "using System.Reflection;\r\n\r\n// General Information about the assemblies Composite and Composite.Workflows  \r\n#if !InternalBuild\r\n[assembly: AssemblyTitle(\"C1 CMS 6.13\")]\r\n#else\r\n[assembly: AssemblyTitle(\"C1 CMS 6.13 (Internal Build)\")]\r\n#endif\r\n\r\n[assembly: AssemblyCompany(\"Orckestra Technologies Inc.\")]\r\n[assembly: AssemblyProduct(\"C1 CMS\")]\r\n[assembly: AssemblyCopyright(\"Copyright © Orckestra Technologies Inc. 2022\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n[assembly: AssemblyVersion(\"6.13.*\")]\r\n"
  },
  {
    "path": "Composite/RuntimeInformation.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Core.IO;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n\tpublic static class RuntimeInformation\r\n\t{\r\n        private static bool? _isUnitTest;\r\n        private static string _uniqueInstanceName;\r\n        private static string _uniqueInstanceNameSafe;\r\n        private static readonly Lazy<Version> _brandedAssemblyName = new Lazy<Version>(GetBrandedProductVersion);\r\n\r\n        /// <exclude />\r\n        public static bool IsDebugBuild\r\n        {\r\n            get\r\n            {\r\n#if DEBUG\r\n                return true;\r\n#else\r\n                return false;\r\n#endif\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n\t    public static bool AppDomainLockingDisabled => IsUnittest;\r\n\r\n\r\n        /// <exclude />\r\n        public static bool IsUnittest\r\n        {\r\n            get\r\n            {\r\n                if (!_isUnitTest.HasValue)\r\n                {\r\n                    _isUnitTest = IsUnittestEnvironment();\r\n                }\r\n\r\n                return _isUnitTest.Value;\r\n            }\r\n        }\r\n\r\n\r\n        private static bool IsUnittestEnvironment()\r\n        {\r\n            var domain = AppDomain.CurrentDomain;\r\n            string applicationName = domain.SetupInformation.ApplicationName;\r\n\r\n            return domain.FriendlyName.StartsWith(\"NUnit \")\r\n                || applicationName == null || applicationName == \"vstesthost.exe\";\r\n        }\r\n\r\n        internal static bool TestAutomationEnabled => true;\r\n\r\n\r\n        /// <exclude />\r\n        public static Version ProductVersion\r\n        {\r\n            get\r\n            {\r\n                return typeof(RuntimeInformation).Assembly.GetName().Version;\r\n            }\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// A version number to be shown in UI.\r\n        /// </summary>\r\n        public static Version BrandedProductVersion\r\n        {\r\n            get\r\n            {\r\n                return _brandedAssemblyName.Value ?? ProductVersion;\r\n            }\r\n        }\r\n\r\n\r\n        private static Version GetBrandedProductVersion()\r\n        {\r\n            try\r\n            {\r\n                string assemblyName = GlobalSettingsFacade.BrandedVersionAssemblySource;\r\n                if (assemblyName == null)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                var asm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == assemblyName);\r\n                if (asm == null)\r\n                {\r\n                    Log.LogWarning(nameof(RuntimeInformation),\r\n                        $\"Failed to find branded product version source assembly by name '{assemblyName}'\");\r\n                    return null;\r\n                }\r\n\r\n                return asm.GetName().Version;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(nameof(RuntimeInformation),  ex);\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n        /// <exclude />\r\n        public static string ProductTitle\r\n        {\r\n            get\r\n            {\r\n                Assembly asm = typeof(RuntimeInformation).Assembly;\r\n                string assemblyTitle = ((AssemblyTitleAttribute)asm.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0]).Title;\r\n\r\n                return assemblyTitle;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string UniqueInstanceName\r\n        {\r\n            get\r\n            {\r\n                if (_uniqueInstanceName == null)\r\n                {\r\n                    string baseString = PathUtil.BaseDirectory.ToLowerInvariant();\r\n                    _uniqueInstanceName = $\"C1@{PathUtil.CleanFileName(baseString)}\";\r\n                }\r\n\r\n                return _uniqueInstanceName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        public static string UniqueInstanceNameSafe\r\n        {\r\n            get\r\n            {\r\n                if (_uniqueInstanceNameSafe == null)\r\n                {\r\n                    string baseString = PathUtil.BaseDirectory.ToLowerInvariant().Replace(@\"\\\", \"-\").Replace(\"/\", \"-\");\r\n                    _uniqueInstanceNameSafe = $\"C1@{PathUtil.CleanFileName(baseString)}\";\r\n                }\r\n\r\n                return _uniqueInstanceNameSafe;\r\n            }\r\n        }\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/DataFieldProcessors/DateTimeDataFieldProcessor.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.Reflection;\r\n\r\nnamespace Composite.Search.Crawling.DataFieldProcessors\r\n{\r\n    /// <summary>\r\n    /// The default field processor for <see cref=\"DateTime\"/> fields.\r\n    /// </summary>\r\n    public class DateTimeDataFieldProcessor: DefaultDataFieldProcessor\r\n    {\r\n        /// <exclude />\r\n        public override object GetIndexValue(object fieldValue)\r\n        {\r\n            return ((DateTime?) fieldValue)?.ToString(\"s\");\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override DocumentFieldPreview.ValuePreviewDelegate GetPreviewFunction(PropertyInfo propertyInfo)\r\n        {\r\n            return value =>\r\n            {\r\n                if (value == null) return null;\r\n                if (DateTime.TryParseExact((string)value, \"s\", CultureInfo.InvariantCulture, DateTimeStyles.None, out var date))\r\n                {\r\n                    return date.ToString(\"yyyy MMM d\");\r\n                }\r\n                return (string)value;\r\n            };  \r\n        }\r\n\r\n        /// <exclude />\r\n        public override string[] GetFacetValues(object value)\r\n        {\r\n            var str = ((DateTime?) value)?.ToString(\"yyyy MM\");\r\n\r\n            return str != null ? new [] {str} : null;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected override DocumentFieldFacet.FacetValuePreviewDelegate GetFacetValuePreviewFunction(PropertyInfo propertyInfo)\r\n        {\r\n            return value =>\r\n            {\r\n                if (value == null) return null;\r\n                var parts = value.Split(' ');\r\n\r\n                int month = int.Parse(parts[1]);\r\n\r\n                var monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(month);\r\n                return $\"{parts[0]} {monthName}\";\r\n            };\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/DataFieldProcessors/FileNameDataFieldProcessor.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Search.Crawling.DataFieldProcessors\r\n{\r\n    internal class FileNameDataFieldProcessor: DefaultDataFieldProcessor\r\n    {\r\n        public override IEnumerable<string> GetTextParts(object value)\r\n        {\r\n            string fileName = (string) value;\r\n            yield return fileName;\r\n\r\n            int extensionSeparator = fileName.LastIndexOf(\".\", StringComparison.Ordinal);\r\n            if (extensionSeparator > 0)\r\n            {\r\n                yield return fileName.Substring(0, extensionSeparator);\r\n            }   \r\n\r\n            if (extensionSeparator + 1 < fileName.Length)\r\n            {\r\n                yield return fileName.Substring(extensionSeparator + 1);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/DataFieldProcessors/MediaTagsDataFieldProcessor.cs",
    "content": "using Composite.Core.Extensions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Composite.Search.Crawling.DataFieldProcessors\n{\n    class MediaTagsDataFieldProcessor : DefaultDataFieldProcessor\n    {\n        public override string[] GetFacetValues(object value)\n        {\n            var str = (string)value;\n            var strList = str.Split(',').Select(s => s.Trim()).Where(s => !s.IsNullOrEmpty()).ToArray();\n            return strList;\n        }\n\n        public override DocumentFieldFacet GetDocumentFieldFacet(PropertyInfo propertyInfo)\n        {\n            var result = base.GetDocumentFieldFacet(propertyInfo);\n\n            result.FacetType = FacetType.MultipleValues;\n\n            return result;\n        }\n\n    }\n\n}\n\n"
  },
  {
    "path": "Composite/Search/Crawling/DataFieldProcessors/MimeTypeDataFieldProcessor.cs",
    "content": "﻿using System.Reflection;\r\nusing Composite.Core.IO;\r\n\r\nnamespace Composite.Search.Crawling.DataFieldProcessors\r\n{\r\n    internal class MimeTypeDataFieldProcessor : DefaultDataFieldProcessor\r\n    {\r\n        protected override DocumentFieldPreview.ValuePreviewDelegate GetPreviewFunction(PropertyInfo propertyInfo)\r\n        {\r\n            return value => GetLocalizedLabel((string)value);\r\n        }\r\n\r\n        protected override DocumentFieldFacet.FacetValuePreviewDelegate GetFacetValuePreviewFunction(PropertyInfo propertyInfo)\r\n        {\r\n            return GetLocalizedLabel;\r\n        }\r\n\r\n        private string GetLocalizedLabel(string mimeType) \r\n            => MimeTypeInfo.TryGetLocalizedName(mimeType) ?? mimeType;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/DataFieldProcessors/PublicationStatusDataFieldProcessor.cs",
    "content": "﻿using System.Reflection;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Search.Untranslated;\r\n\r\nnamespace Composite.Search.Crawling.DataFieldProcessors\r\n{\r\n    internal class PublicationStatusDataFieldProcessor: DefaultDataFieldProcessor\r\n    {\r\n        public override string GetFieldLabel(PropertyInfo propertyInfo) => Texts.FieldNames_PublicationStatus;\r\n\r\n        protected override DocumentFieldPreview.ValuePreviewDelegate GetPreviewFunction(PropertyInfo propertyInfo)\r\n        {\r\n            return value => GetLocalizedPublicationStatus((string) value);\r\n        }\r\n\r\n        protected override DocumentFieldFacet.FacetValuePreviewDelegate GetFacetValuePreviewFunction(PropertyInfo propertyInfo)\r\n        {\r\n            return GetLocalizedPublicationStatus;\r\n        }\r\n\r\n        private static string GetLocalizedPublicationStatus(string status)\r\n        {\r\n            switch (status)\r\n            {\r\n                case GenericPublishProcessController.Published:\r\n                    return LocalizationFiles.Composite_Management.PublishingStatus_published;\r\n                case GenericPublishProcessController.Draft:\r\n                    return LocalizationFiles.Composite_Management.PublishingStatus_draft;\r\n                case GenericPublishProcessController.AwaitingApproval:\r\n                    return LocalizationFiles.Composite_Management.PublishingStatus_awaitingApproval;\r\n                case GenericPublishProcessController.AwaitingPublication:\r\n                    return LocalizationFiles.Composite_Management.PublishingStatus_awaitingPublication;\r\n            }\r\n\r\n            return status;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/DataTypeSearchReflectionHelper.cs",
    "content": "using System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Types;\r\nusing Composite.Search.Crawling.DataFieldProcessors;\r\nusing SearchableFieldInfo = System.Collections.Generic.KeyValuePair<System.Reflection.PropertyInfo, Composite.Data.SearchableFieldAttribute>;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    /// <summary>\r\n    /// A helper class for extracting search related information frome the data types.\r\n    /// </summary>\r\n    public static class DataTypeSearchReflectionHelper\r\n    {\r\n        private static readonly ConcurrentDictionary<Type, IEnumerable<SearchableFieldInfo>> DocumentFieldsCache =\r\n            new ConcurrentDictionary<Type, IEnumerable<SearchableFieldInfo>>();\r\n\r\n        private static readonly ConcurrentDictionary<PropertyInfo, IDataFieldProcessor> DataFieldProcessors =\r\n            new ConcurrentDictionary<PropertyInfo, IDataFieldProcessor>();\r\n\r\n\r\n        internal static IEnumerable<SearchableFieldInfo> GetSearchableFields(Type interfaceType)\r\n        {\r\n            if (!typeof(IData).IsAssignableFrom(interfaceType)) return Enumerable.Empty<SearchableFieldInfo>();\r\n\r\n            return DocumentFieldsCache.GetOrAdd(interfaceType, type =>\r\n            {\r\n                var properties = type.GetAllProperties();\r\n\r\n                var result = new List<SearchableFieldInfo>();\r\n                foreach (var property in properties)\r\n                {\r\n                    var searchableAttr =\r\n                        property.GetCustomAttributesRecursively<SearchableFieldAttribute>().FirstOrDefault();\r\n                    if (searchableAttr == null) continue;\r\n\r\n                    result.Add(new SearchableFieldInfo(property, searchableAttr));\r\n                }\r\n\r\n                return result;\r\n            });\r\n        }\r\n\r\n        internal static IDataFieldProcessor GetDataFieldProcessor(PropertyInfo propertyInfo)\r\n        {\r\n            return DataFieldProcessors.GetOrAdd(propertyInfo, pi =>\r\n            {\r\n                var processor = ServiceLocator.GetServices<IDataFieldProcessorProvider>()\r\n                    .Select(p => p.GetDataFieldProcessor(pi))\r\n                    .FirstOrDefault(pr => pr != null);\r\n\r\n                if (processor != null) return processor;\r\n\r\n                var propertyType = pi.PropertyType;\r\n                if (propertyType == typeof (DateTime) || propertyType == typeof (DateTime?))\r\n                {\r\n                    return new DateTimeDataFieldProcessor();\r\n                }\r\n\r\n                if (propertyInfo.DeclaringType == typeof(IPublishControlled) \r\n                    && propertyInfo.Name == nameof(IPublishControlled.PublicationStatus))\r\n                {\r\n                    return new PublicationStatusDataFieldProcessor();\r\n                }\r\n\r\n                if (propertyInfo.DeclaringType == typeof(IFile)\r\n                    && propertyInfo.Name == nameof(IFile.FileName))\r\n                {\r\n                    return new FileNameDataFieldProcessor();\r\n                }\r\n\r\n                if (propertyInfo.DeclaringType == typeof(IMediaFile)\r\n                    && propertyInfo.Name == nameof(IMediaFile.MimeType))\r\n                {\r\n                    return new MimeTypeDataFieldProcessor();\r\n                }\r\n\r\n                if (propertyInfo.DeclaringType == typeof(IMediaFile)\r\n                    && propertyInfo.Name == nameof(IMediaFile.Tags))\r\n                {\r\n                    return new MediaTagsDataFieldProcessor();\r\n                }\r\n\r\n                return new DefaultDataFieldProcessor();\r\n            });\r\n        }\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Gets an enumeration of the search document fields from a data type.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\"></param>\r\n        /// <param name=\"includeDefaultFields\"></param>\r\n        /// <returns></returns>\r\n        public static IEnumerable<DocumentField> GetDocumentFields(Type interfaceType, bool includeDefaultFields = true)\r\n        {\r\n            var fields = includeDefaultFields\r\n                ? SearchDocumentBuilder.GetDefaultDocumentFields()\r\n                : Enumerable.Empty<DocumentField>();\r\n\r\n            fields = fields.Concat(\r\n                from info in GetSearchableFields(interfaceType)\r\n                let prop = info.Key\r\n                let attr = info.Value\r\n                where attr.Previewable || attr.Faceted\r\n                let processor = GetDataFieldProcessor(prop)\r\n                select new DocumentField(\r\n                    processor.GetDocumentFieldName(prop),\r\n                    attr.Faceted ? processor.GetDocumentFieldFacet(prop) : null,\r\n                    attr.Previewable ? processor.GetDocumentFieldPreview(prop) : null)\r\n                {\r\n                    Label = processor.GetFieldLabel(prop)\r\n                });\r\n\r\n            if (includeDefaultFields)\r\n            {\r\n                fields = fields.Concat(\r\n                    ServiceLocator.GetServices<IDocumentFieldProvider>()\r\n                        .SelectMany(fp => fp.GetCustomFields(interfaceType)));\r\n            }\r\n\r\n            return fields;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/DefaultDataFieldProcessor.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Search.Untranslated;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    /// <summary>\r\n    /// The default data field processor.\r\n    /// </summary>\r\n    public class DefaultDataFieldProcessor: IDataFieldProcessor\r\n    {\r\n        /// <exclude />\r\n        public virtual IEnumerable<string> GetTextParts(object value)\r\n        {\r\n            if (value is string str)\r\n            {\r\n                yield return str;\r\n            }\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual object GetIndexValue(object fieldValue)\r\n        {\r\n            return fieldValue == null ? null : ValueTypeConverter.Convert<string>(fieldValue);\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual string[] GetFacetValues(object value)\r\n        {\r\n            if (value == null) return null;\r\n\r\n            string stringValue = value.ToString();\r\n\r\n            return string.IsNullOrEmpty(stringValue) ? null : new[] { stringValue };\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual string GetDocumentFieldName(PropertyInfo pi)\r\n        {\r\n            if (pi.Name == nameof(IPage.Description) && pi.PropertyType == typeof(string))\r\n            {\r\n                return DocumentFieldNames.Description;\r\n            }\r\n\r\n            if ((pi.Name == nameof(IChangeHistory.ChangeDate) || pi.Name == nameof(IMediaFile.CreationTime))\r\n                && (pi.PropertyType == typeof(DateTime) || pi.PropertyType == typeof(DateTime?)))\r\n            {\r\n                return DocumentFieldNames.LastUpdated;\r\n            }\r\n\r\n            return $\"{pi.ReflectedType.Name}.{pi.Name}\";\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual DocumentFieldFacet GetDocumentFieldFacet(PropertyInfo propertyInfo)\r\n        {\r\n            return new DocumentFieldFacet\r\n            {\r\n                Limit = 100,\r\n                MinHitCount = 1,\r\n                PreviewFunction = GetFacetValuePreviewFunction(propertyInfo)\r\n            };\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual DocumentFieldPreview GetDocumentFieldPreview(PropertyInfo propertyInfo)\r\n        {\r\n            return new DocumentFieldPreview\r\n            {\r\n                Sortable = IsFieldSortable(propertyInfo),\r\n                SortTermsAs = GetFieldSortingMethod(propertyInfo.PropertyType),\r\n                PreviewFunction = GetPreviewFunction(propertyInfo),\r\n                FieldOrder = 100\r\n            };\r\n        }\r\n\r\n        private SortTermsAs GetFieldSortingMethod(Type propertyType)\r\n        {\r\n            if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof (Nullable<>))\r\n            {\r\n                propertyType = propertyType.GetGenericArguments()[0];\r\n            }\r\n\r\n            if (propertyType == typeof (byte))\r\n            {\r\n                return SortTermsAs.Int;\r\n            }\r\n\r\n            if (propertyType == typeof(short))\r\n            {\r\n                return SortTermsAs.Int;\r\n            }\r\n\r\n            if (propertyType == typeof(int))\r\n            {\r\n                return SortTermsAs.Int;\r\n            }\r\n\r\n            if (propertyType == typeof(long))\r\n            {\r\n                return SortTermsAs.Long;\r\n            }\r\n\r\n            if (propertyType == typeof(float))\r\n            {\r\n                return SortTermsAs.Float;\r\n            }\r\n\r\n            if (propertyType == typeof(decimal))\r\n            {\r\n                return SortTermsAs.Double;\r\n            }\r\n\r\n            return SortTermsAs.String;\r\n        }\r\n\r\n        /// <exclude />\r\n        public virtual string GetFieldLabel(PropertyInfo propertyInfo)\r\n        {\r\n            var fieldName = GetDocumentFieldName(propertyInfo);\r\n            if (fieldName == DocumentFieldNames.Description)\r\n            {\r\n                return Texts.FieldNames_Description;\r\n            }\r\n\r\n            if (fieldName == DocumentFieldNames.LastUpdated) return Texts.FieldNames_LastUpdated;\r\n            if (propertyInfo.Name == nameof(IChangeHistory.ChangedBy)) return Texts.FieldNames_UpdatedBy;\r\n            if (propertyInfo.Name == nameof(IMediaFile.MimeType)) return Texts.FieldNames_MimeType;\r\n            if (propertyInfo.Name == nameof(IPage.PageTypeId)) return Texts.FieldNames_PageTypeId;\r\n\r\n            var frpAttribute = propertyInfo.GetCustomAttribute<FormRenderingProfileAttribute>();\r\n            if (!string.IsNullOrEmpty(frpAttribute?.Label))\r\n            {\r\n                return frpAttribute.Label;\r\n            }\r\n\r\n            Guid immutableTypeId;\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n            if (propertyInfo.DeclaringType.TryGetImmutableTypeId(out immutableTypeId)\r\n                && DynamicTypeManager.TryGetDataTypeDescriptor(immutableTypeId, out dataTypeDescriptor))\r\n            {\r\n                var fieldDescriptor = dataTypeDescriptor?.Fields.FirstOrDefault(f => f.Name == propertyInfo.Name);\r\n                var label = fieldDescriptor?.FormRenderingProfile?.Label;\r\n                if (label != null)\r\n                {\r\n                    return label;\r\n                }\r\n            }\r\n\r\n            return propertyInfo.Name;\r\n        }\r\n\r\n        /// <exclude />\r\n        protected virtual DocumentFieldPreview.ValuePreviewDelegate GetPreviewFunction(PropertyInfo propertyInfo)\r\n        {\r\n            return value => value?.ToString();\r\n        }\r\n\r\n\r\n\r\n        /// <exclude />\r\n        protected virtual DocumentFieldFacet.FacetValuePreviewDelegate GetFacetValuePreviewFunction(PropertyInfo propertyInfo)\r\n        {\r\n            var foreignKey = propertyInfo.GetCustomAttributes<ForeignKeyAttribute>().FirstOrDefault();\r\n            if (foreignKey != null)\r\n            {\r\n                var targetType = foreignKey.InterfaceType;\r\n                if (targetType != null\r\n                    && DynamicTypeManager.TryGetDataTypeDescriptor(targetType, out DataTypeDescriptor typeDescriptor)\r\n                    && !string.IsNullOrEmpty(typeDescriptor.LabelFieldName))\r\n                {\r\n                    return key =>\r\n                    {\r\n                        if (key == null) return string.Empty;\r\n\r\n                        var data = DataFacade.TryGetDataByUniqueKey(targetType, key);\r\n                        return data?.GetLabel() ?? key.ToString();\r\n                    };\r\n                }\r\n            }\r\n\r\n            return obj => obj;\r\n        }\r\n\r\n        private static bool IsFieldSortable(PropertyInfo propertyInfo)\r\n        {\r\n            var attr = propertyInfo.GetCustomAttribute<StoreFieldTypeAttribute>(true);\r\n            Verify.IsNotNull(attr, $\"Failed to find and attribute of type '{nameof(StoreFieldTypeAttribute)}'\");\r\n\r\n            var storeFieldType = attr.StoreFieldType;\r\n\r\n            if (storeFieldType.IsString)\r\n            {\r\n                return storeFieldType.MaximumLength <= 64;\r\n            }\r\n\r\n            return storeFieldType.IsDateTime\r\n                   || storeFieldType.IsNumeric\r\n                   || storeFieldType.IsBoolean;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/DocumentFieldNames.cs",
    "content": "﻿using System;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    /// <exclude/>\r\n    [Obsolete(\"Use DocumentFieldNames instead\", true)]\r\n    public static class DefaultDocumentFieldNames\r\n    {\r\n        /// <exclude/>\r\n        public static readonly string Label = DocumentFieldNames.Label;\r\n        /// <exclude/>\r\n        public static readonly string Source = DocumentFieldNames.Source;\r\n        /// <exclude/>\r\n        public static readonly string Description = DocumentFieldNames.Description;\r\n        /// <exclude/>\r\n        public static readonly string DataType = DocumentFieldNames.DataType;\r\n        /// <exclude/>\r\n        public static readonly string ConsoleAccess = DocumentFieldNames.ConsoleAccess;\r\n        /// <exclude/>\r\n        public static readonly string Ancestors = DocumentFieldNames.Ancestors;\r\n        /// <exclude/>\r\n        public static readonly string HasUrl = DocumentFieldNames.HasUrl;\r\n        /// <exclude/>\r\n        public static readonly string LastUpdated = DocumentFieldNames.LastUpdated;\r\n    }\r\n\r\n    /// <summary>\r\n    /// Contains default document field names\r\n    /// </summary>\r\n    public static class DocumentFieldNames\r\n    {\r\n        /// <summary>\r\n        /// The name of the label field.\r\n        /// </summary>\r\n        public static readonly string Label = \"label\";\r\n\r\n        /// <summary>\r\n        /// The name of the source field. \r\n        /// The source field contains a name of the document source that created the search document.\r\n        /// It is used both for updating documents for a given source as well as filtering search result columns.\r\n        /// </summary>\r\n        public static readonly string Source = \"src\";\r\n\r\n        /// <summary>\r\n        /// The name of the description field.\r\n        /// </summary>\r\n        public static readonly string Description = \"desc\";\r\n\r\n        /// <summary>\r\n        /// The name of the data type field.\r\n        /// </summary>\r\n        public static readonly string DataType = \"datatype\";\r\n\r\n        /// <summary>\r\n        /// The name of the facet field that contains the list of users and user groups that have access to the current document.\r\n        /// </summary>\r\n        public static readonly string ConsoleAccess = \"access\";\r\n\r\n        /// <summary>\r\n        /// The name of the facet field that contains the hashes of all ancestor's and current entity tokens.\r\n        /// </summary>\r\n        public static readonly string Ancestors = \"ancestors\";\r\n\r\n        /// <summary>\r\n        /// The name of the boolean facet field that indicates whether the document has a url.\r\n        ///  </summary>\r\n        public static readonly string HasUrl = \"hasUrl\";\r\n\r\n        /// <summary>\r\n        /// The name of the creation time field.\r\n        /// </summary>\r\n        public static readonly string LastUpdated = \"lastupdated\";\r\n\r\n        /// <summary>\r\n        /// Gets the field name for the given data type property\r\n        /// </summary>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <param name=\"propertyName\">The property name.</param>\r\n        /// <returns></returns>\r\n        public static string GetFieldName(Type dataType, string propertyName)\r\n        {\r\n            Verify.ArgumentNotNull(dataType, nameof(dataType));\r\n            Verify.ArgumentNotNull(propertyName, nameof(propertyName));\r\n\r\n            var propertyInfo = dataType.GetProperty(propertyName);\r\n            Verify.IsNotNull(propertyInfo, \"Type '{0}' does not have a prorety '{1}'\", dataType.FullName, propertyName);\r\n\r\n            var processor = DataTypeSearchReflectionHelper.GetDataFieldProcessor(propertyInfo);\r\n            return processor.GetDocumentFieldName(propertyInfo);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/EntityTokenSecurityHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.Immutable;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Security.Foundation.PluginFacades;\r\nusing Composite.Core.Threading;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    internal static class EntityTokenSecurityHelper\r\n    {\r\n        static EntityTokenSecurityHelper()\r\n        {\r\n            DataEvents<IUserPermissionDefinition>.OnStoreChanged += (a,b) => _allUserAccessDefinitions = null;\r\n            DataEvents<IUserPermissionDefinitionPermissionType>.OnStoreChanged += (a, b) => _allUserAccessDefinitions = null;\r\n\r\n            DataEvents<IUserGroupPermissionDefinition>.OnStoreChanged += (a, b) => _allUserGroupAccessDefinitions = null;\r\n            DataEvents<IUserGroupPermissionDefinitionPermissionType>.OnStoreChanged += (a, b) => _allUserGroupAccessDefinitions = null;\r\n        }\r\n\r\n        class UserAccess\r\n        {\r\n            public string UserName;\r\n            public bool HasAccess;\r\n        }\r\n\r\n        class GroupAccess\r\n        {\r\n            public Guid UserGroupId;\r\n            public bool HasAccess;\r\n        }\r\n\r\n\r\n        private static Dictionary<EntityToken, List<UserAccess>> _allUserAccessDefinitions;\r\n        private static Dictionary<EntityToken, List<GroupAccess>> _allUserGroupAccessDefinitions;\r\n\r\n        public static void GetUsersAndGroupsWithReadAccess(EntityToken entityToken,\r\n            out IEnumerable<EntityToken> ancestors,\r\n            out IEnumerable<string> users,\r\n            out IEnumerable<Guid> userGroups)\r\n        {\r\n            var userSet = new HashSet<string>();\r\n            var userGroupSet = new HashSet<Guid>();\r\n            var ancestorsSet = new HashSet<EntityToken>();\r\n\r\n            using (ThreadDataManager.EnsureInitialize())\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                CollectUsersAndGroupsRec(entityToken,\r\n                    GetUserAccessDefinitions(), GetUserGroupAccessDefinitions(),\r\n                    ImmutableHashSet<string>.Empty,\r\n                    ImmutableHashSet<Guid>.Empty,\r\n                    userSet,\r\n                    userGroupSet,\r\n                    ancestorsSet,\r\n                    20);\r\n            }\r\n\r\n            ancestors = ancestorsSet;\r\n            users = userSet;\r\n            userGroups = userGroupSet;\r\n        }\r\n\r\n\r\n        private static void CollectUsersAndGroupsRec(\r\n            EntityToken entityToken,\r\n            Dictionary<EntityToken, List<UserAccess>> userAccessDefinitions,\r\n            Dictionary<EntityToken, List<GroupAccess>> groupAccessDefinitions,\r\n            ImmutableHashSet<string> usersWithoutAccess,\r\n            ImmutableHashSet<Guid> groupsWithoutAccess,\r\n            HashSet<string> usersWithAccess,\r\n            HashSet<Guid> groupsWithAccess,\r\n            HashSet<EntityToken> alreadyVisited, \r\n            int depth)\r\n        {\r\n            if(depth < 1) return;\r\n\r\n            List<UserAccess> users;\r\n            if (userAccessDefinitions.TryGetValue(entityToken, out users))\r\n            {\r\n                foreach (var user in users)\r\n                {\r\n                    if (!user.HasAccess)\r\n                    {\r\n                        usersWithoutAccess = usersWithoutAccess.Add(user.UserName);\r\n                    }\r\n                    else if(!usersWithoutAccess.Contains(user.UserName))\r\n                    {\r\n                        usersWithAccess.Add(user.UserName);\r\n                    }\r\n                }\r\n            }\r\n\r\n            List<GroupAccess> userGroups;\r\n            if (groupAccessDefinitions.TryGetValue(entityToken, out userGroups))\r\n            {\r\n                foreach (var userGroup in userGroups)\r\n                {\r\n                    if (!userGroup.HasAccess)\r\n                    {\r\n                        groupsWithoutAccess = groupsWithoutAccess.Add(userGroup.UserGroupId);\r\n                    }\r\n                    else if (!groupsWithoutAccess.Contains(userGroup.UserGroupId))\r\n                    {\r\n                        groupsWithAccess.Add(userGroup.UserGroupId);\r\n                    }\r\n                }\r\n            }\r\n\r\n            alreadyVisited.Add(entityToken);\r\n            var parents = ParentsFacade.GetAllParents(entityToken);\r\n\r\n            foreach (var parent in parents)\r\n            {\r\n                if(alreadyVisited.Contains(parent)) continue;\r\n\r\n                CollectUsersAndGroupsRec(parent, \r\n                    userAccessDefinitions, groupAccessDefinitions, \r\n                    usersWithoutAccess, groupsWithoutAccess,\r\n                    usersWithAccess, groupsWithAccess,\r\n                    alreadyVisited, depth - 1);\r\n            }\r\n        }\r\n\r\n        private static Dictionary<EntityToken, List<UserAccess>> GetUserAccessDefinitions()\r\n        {\r\n            var result = _allUserAccessDefinitions;\r\n            if (result != null)\r\n            {\r\n                return result;\r\n            }\r\n\r\n            result = UserPermissionDefinitionProviderPluginFacade.AllUserPermissionDefinitions\r\n                .Select(pd => new \r\n                {\r\n                    pd.EntityToken, pd.Username,\r\n                    HasAccess = pd.PermissionTypes.Contains(PermissionType.Read)\r\n                })\r\n                .Where(a => a.EntityToken != null && a.EntityToken.IsValid())\r\n                .GroupBy(a => a.EntityToken)\r\n                .ToDictionary(group => group.Key, \r\n                            group => group.Select(a => new UserAccess {UserName = a.Username, HasAccess = a.HasAccess })\r\n                            .ToList());\r\n            \r\n            _allUserAccessDefinitions = result;\r\n\r\n            return result;\r\n        }\r\n\r\n        private static Dictionary<EntityToken, List<GroupAccess>> GetUserGroupAccessDefinitions()\r\n        {\r\n            var result = _allUserGroupAccessDefinitions;\r\n            if (result != null)\r\n            {\r\n                return result;\r\n            }\r\n\r\n            result = UserGroupPermissionDefinitionProviderPluginFacade.AllUserGroupPermissionDefinitions\r\n                .Select(pd => new\r\n                {\r\n                    pd.EntityToken,\r\n                    pd.UserGroupId,\r\n                    HasAccess = pd.PermissionTypes.Contains(PermissionType.Read)\r\n                })\r\n                .Where(a => a.EntityToken != null && a.EntityToken.IsValid())\r\n                .GroupBy(a => a.EntityToken)\r\n                .ToDictionary(group => group.Key,\r\n                            group => group.Select(a => new GroupAccess\r\n                            {\r\n                                UserGroupId = a.UserGroupId,\r\n                                HasAccess = a.HasAccess\r\n                            })\r\n                            .ToList());\r\n\r\n            _allUserGroupAccessDefinitions = result;\r\n\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/IDataFieldProcessor.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Reflection;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    /// <summary>\r\n    /// Extracts indexable information for a data type field.\r\n    /// </summary>\r\n    public interface IDataFieldProcessor\r\n    {\r\n        /// <summary>\r\n        /// Gets the text parts for the full text search.\r\n        /// </summary>\r\n        /// <param name=\"fieldValue\"></param>\r\n        /// <returns></returns>\r\n        IEnumerable<string> GetTextParts(object fieldValue);\r\n\r\n        /// <summary>\r\n        /// Get the field value to be preserved in the index.\r\n        /// </summary>\r\n        /// <param name=\"fieldValue\"></param>\r\n        /// <returns></returns>\r\n        object GetIndexValue(object fieldValue);\r\n\r\n        /// <summary>\r\n        /// Gets the facet values from the given field.\r\n        /// </summary>\r\n        /// <param name=\"fieldValue\"></param>\r\n        /// <returns></returns>\r\n        string[] GetFacetValues(object fieldValue);\r\n\r\n        /// <summary>\r\n        /// Gets the document field name for the specified data type property.\r\n        /// </summary>\r\n        /// <param name=\"propertyInfo\"></param>\r\n        /// <returns></returns>\r\n        string GetDocumentFieldName(PropertyInfo propertyInfo);\r\n\r\n        /// <summary>\r\n        /// Gets the facet information for the given property.\r\n        /// </summary>\r\n        /// <param name=\"propertyInfo\"></param>\r\n        /// <returns></returns>\r\n        DocumentFieldFacet GetDocumentFieldFacet(PropertyInfo propertyInfo);\r\n\r\n        /// <summary>\r\n        /// Gets the field preview information for the given property.\r\n        /// </summary>\r\n        /// <param name=\"propertyInfo\"></param>\r\n        /// <returns></returns>\r\n        DocumentFieldPreview GetDocumentFieldPreview(PropertyInfo propertyInfo);\r\n\r\n        /// <summary>\r\n        /// Gets the field label in a given locale.\r\n        /// </summary>\r\n        /// <param name=\"propertyInfo\"></param>\r\n        /// <returns></returns>\r\n        string GetFieldLabel(PropertyInfo propertyInfo);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/IDataFieldProcessorProvider.cs",
    "content": "﻿using System.Reflection;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    /// <summary>\r\n    /// Allows augmenting crawling data types for search related information.\r\n    /// </summary>\r\n    public interface IDataFieldProcessorProvider\r\n    {\r\n        /// <summary>\r\n        /// Provides <see cref=\"IDataFieldProcessor\" /> for a given property info\r\n        /// </summary>\r\n        IDataFieldProcessor GetDataFieldProcessor(PropertyInfo dataTypeProperty);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/IDocumentFieldProvider.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    /// <summary>\r\n    /// Allows adding custom document fields to existing document sources. \r\n    /// </summary>\r\n    public interface IDocumentFieldProvider\r\n    {\r\n        /// <summary>\r\n        /// Returns custom fields that should be added to the datatype's search document.\r\n        /// </summary>\r\n        /// <param name=\"dataType\">The data type.</param>\r\n        /// <returns></returns>\r\n        IEnumerable<DocumentField> GetCustomFields(Type dataType);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/ISearchDocumentBuilderExtension.cs",
    "content": "﻿using Composite.Data;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    /// <summary>\r\n    /// Allows extending the default SearchDocumentBuilder class,\r\n    /// making it possible to index additional new text fragments/field values.\r\n    /// </summary>\r\n    public interface ISearchDocumentBuilderExtension\r\n    {\r\n        /// <summary>\r\n        /// Populates the search document builder with the new data.\r\n        /// </summary>\r\n        /// <param name=\"searchDocumentBuilder\"></param>\r\n        /// <param name=\"data\"></param>\r\n        void Populate(SearchDocumentBuilder searchDocumentBuilder, IData data);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/SearchDocumentBuilder.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Search;\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    /// <summary>\r\n    /// A helper class to create search documents based of IData instances\r\n    /// </summary>\r\n    public class SearchDocumentBuilder\r\n    {\r\n        private readonly List<string> _textParts = new List<string>();\r\n        private readonly List<KeyValuePair<string, object>> _fieldValues = new List<KeyValuePair<string, object>>();\r\n        private readonly List<KeyValuePair<string, string[]>> _facetFieldValues = new List<KeyValuePair<string, string[]>>();\r\n\r\n        private readonly IEnumerable<ISearchDocumentBuilderExtension> _extensions;\r\n\r\n        private IPage _currentPage;\r\n\r\n        /// <summary>\r\n        /// Creates a new instance of <see cref=\"SearchDocumentBuilder\"/>.\r\n        /// </summary>\r\n        [Obsolete(\"Use an overload taking extensions as a parameter.\")]\r\n        public SearchDocumentBuilder(): this(null)\r\n        {\r\n        }\r\n\r\n        /// <summary>\r\n        /// Creates a new instance of <see cref=\"SearchDocumentBuilder\"/>.\r\n        /// </summary>\r\n        public SearchDocumentBuilder(IEnumerable<ISearchDocumentBuilderExtension> extensions)\r\n        {\r\n            _extensions = extensions;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Collected text parts.\r\n        /// </summary>\r\n        public ICollection<string> TextParts => _textParts;\r\n\r\n        /// <summary>\r\n        /// Collected field values to be available in search results.\r\n        /// </summary>\r\n        public ICollection<KeyValuePair<string, object>> FieldPreviewValues => _fieldValues;\r\n\r\n        /// <summary>\r\n        /// Collected facet field values\r\n        /// </summary>\r\n        public ICollection<KeyValuePair<string, string[]>> FacetFieldValues => _facetFieldValues;\r\n\r\n\r\n        /// <summary>\r\n        /// The document url. Setting a not empty value makes the document searchable from the frontend.\r\n        /// </summary>\r\n        public string Url { get; set; }\r\n\r\n        /// <summary>\r\n        /// A factor by which a search document should be boosted index time.\r\n        /// </summary>\r\n        public float Boost { get; set; } = 1;\r\n\r\n        /// <summary>\r\n        /// Sets the interface type, name of which will be used for populating the \"Data Type\" column in the search results.\r\n        /// </summary>\r\n        /// <param name=\"interfaceType\">The interface type.</param>\r\n        public void SetDataType(Type interfaceType)\r\n        {\r\n            string value;\r\n            if (typeof (IData).IsAssignableFrom(interfaceType))\r\n            {\r\n                Guid dataTypeId = interfaceType.GetImmutableTypeId();\r\n                value = dataTypeId.ToString();\r\n            }\r\n            else\r\n            {\r\n                value = interfaceType.FullName;\r\n            }\r\n\r\n            SetDataType(value);\r\n        }\r\n\r\n        /// Sets the data type name, which will be used for populating the \"Data Type\" column in the search results.\r\n        public void SetDataType(string dataTypeName)\r\n        {\r\n            _fieldValues.Add(new KeyValuePair<string, object>(DocumentFieldNames.DataType, dataTypeName));\r\n            _facetFieldValues.Add(new KeyValuePair<string, string[]>(DocumentFieldNames.DataType, new[] { dataTypeName }));\r\n        }\r\n\r\n        /// <summary>\r\n        /// Extracts searchable information from a given data object\r\n        /// (including text parts, field values for search results preview and faceted search).\r\n        /// </summary>\r\n        /// <param name=\"data\">The data item to collect searchable information from.</param>\r\n        /// <param name=\"skipInheritedInterfaces\">When <value>true</value>, the inherited properties will not be processed.</param>\r\n        public void CrawlData(IData data, bool skipInheritedInterfaces = false)\r\n        {\r\n            var interfaceType = data.DataSourceId.InterfaceType;\r\n            var fields = DataTypeSearchReflectionHelper.GetSearchableFields(interfaceType);\r\n\r\n            if (data is IPage page)\r\n            {\r\n                _currentPage = page;\r\n            }\r\n\r\n            foreach (var field in fields)\r\n            {\r\n                var propertyInfo = field.Key;\r\n\r\n                if (skipInheritedInterfaces && propertyInfo.DeclaringType != interfaceType)\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                var fieldProcessor = DataTypeSearchReflectionHelper.GetDataFieldProcessor(propertyInfo);\r\n\r\n                object value = propertyInfo.GetValue(data);\r\n                if(value == null) continue;\r\n\r\n                var attr = field.Value;\r\n\r\n                // Text indexing\r\n                if (attr.IndexText)\r\n                {\r\n                    var textParts = fieldProcessor.GetTextParts(value);\r\n                    if (textParts != null)\r\n                    {\r\n                        _textParts.AddRange(textParts.SelectMany(ProcessXhtml));\r\n                    }\r\n                }\r\n\r\n                // Field previewing\r\n                if (attr.Previewable)\r\n                {\r\n                    var indexValue = fieldProcessor.GetIndexValue(value);\r\n                    if (indexValue != null)\r\n                    {\r\n                        _fieldValues.Add(new KeyValuePair<string, object>(\r\n                            fieldProcessor.GetDocumentFieldName(propertyInfo), \r\n                            indexValue));\r\n                    }\r\n                }\r\n\r\n                // Faceted fields\r\n                if (attr.Faceted)\r\n                {\r\n                    string[] facetValues = fieldProcessor.GetFacetValues(value);\r\n                    if (facetValues != null && facetValues.Length > 0)\r\n                    {\r\n                        _facetFieldValues.Add(new KeyValuePair<string, string[]>(\r\n                        fieldProcessor.GetDocumentFieldName(propertyInfo),\r\n                            facetValues));\r\n                    }\r\n                }\r\n            }\r\n\r\n            _extensions?.ForEach(e =>\r\n            {\r\n                try\r\n                {\r\n                    e.Populate(this, data);\r\n                }\r\n                catch (Exception ex)\r\n                when (!(ex is ThreadAbortException))\r\n                {\r\n                    Log.LogError(nameof(SearchDocumentBuilder), ex);\r\n                }\r\n            });\r\n        }\r\n\r\n        /// <exclude />\r\n        [Obsolete(\"Use an overload that does not take a Url parameter and use the Url property instead.\")]\r\n        public SearchDocument BuildDocument(\r\n            string source,\r\n            string documentId,\r\n            string label,\r\n            string versionName,\r\n            EntityToken entityToken,\r\n            string url)\r\n        {\r\n            Url = Url ?? url;\r\n            return BuildDocument(source, documentId, label, versionName, entityToken);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Builds an instance of <see cref=\"SearchDocument\"/> based on collected information.\r\n        /// </summary>\r\n        /// <param name=\"source\">The document source name</param>\r\n        /// <param name=\"documentId\">The document id</param>\r\n        /// <param name=\"label\">The label of the item in the tree</param>\r\n        /// <param name=\"versionName\">The version name of the item</param>\r\n        /// <param name=\"entityToken\">The entity token.</param>\r\n        /// <returns></returns>\r\n        public SearchDocument BuildDocument(\r\n            string source, \r\n            string documentId, \r\n            string label, \r\n            string versionName, \r\n            EntityToken entityToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(source, nameof(source));\r\n            Verify.ArgumentNotNullOrEmpty(documentId, nameof(documentId));\r\n            Verify.ArgumentNotNullOrEmpty(label, nameof(label));\r\n\r\n            _fieldValues.Add(new KeyValuePair<string, object>(DocumentFieldNames.Label, label));\r\n\r\n            if (!string.IsNullOrWhiteSpace(Url))\r\n            {\r\n                _facetFieldValues.Add(new KeyValuePair<string, string[]>(DocumentFieldNames.HasUrl, new[] { \"1\" }));\r\n            }\r\n\r\n            AddAccessField(entityToken);\r\n\r\n            return new SearchDocument(source, documentId, label, entityToken)\r\n            {\r\n                ElementBundleName = versionName,\r\n                FullText = _textParts,\r\n                Url = Url,\r\n                Boost = Boost,\r\n                FieldValues = _fieldValues\r\n                    .ExcludeDuplicateKeys(pair => pair.Key)\r\n                    .ToDictionary(pair => pair.Key, pair => pair.Value),\r\n                FacetFieldValues = _facetFieldValues\r\n                    .ExcludeDuplicateKeys(pair => pair.Key)\r\n                    .ToDictionary(pair => pair.Key, pair => pair.Value)\r\n            };\r\n        }\r\n\r\n\r\n        private void AddAccessField(EntityToken entityToken)\r\n        {\r\n            IEnumerable<EntityToken> ancestors;\r\n            IEnumerable<string> users;\r\n            IEnumerable<Guid> groups;\r\n            EntityTokenSecurityHelper.GetUsersAndGroupsWithReadAccess(entityToken, out ancestors, out users, out groups);\r\n\r\n            var tokens = users.Concat(groups.Select(g => g.ToString())).ToArray();\r\n\r\n            if (tokens.Any())\r\n            {\r\n                _facetFieldValues.Add(new KeyValuePair<string, string[]>(\r\n                    DocumentFieldNames.ConsoleAccess,\r\n                    tokens));\r\n            }\r\n\r\n            if (ancestors.Any())\r\n            {\r\n                var ancestorTokens = ancestors.Select(GetEntityTokenHash).ToArray();\r\n\r\n                _facetFieldValues.Add(new KeyValuePair<string, string[]>(\r\n                    DocumentFieldNames.Ancestors,\r\n                    ancestorTokens));\r\n            }\r\n        }\r\n\r\n        internal static string GetEntityTokenHash(EntityToken entityToken)\r\n        {\r\n            var token = new StringBuilder();\r\n            if (entityToken is DataEntityToken dataEntityToken && typeof(IVersioned).IsAssignableFrom(dataEntityToken.InterfaceType))\r\n            {\r\n                var dataSourceId = dataEntityToken.DataSourceId;\r\n                // Serialize without versionId\r\n                token.Append(dataEntityToken.Id);\r\n                token.Append(':');\r\n                token.Append(dataSourceId.LocaleScope);\r\n                token.Append(\":\");\r\n                token.Append(dataSourceId.DataScopeIdentifier);\r\n            }\r\n            else\r\n            {\r\n                token.Append(EntityTokenSerializer.Serialize(entityToken));\r\n            }\r\n\r\n            var md5Hash  = HashingHelper.ComputeMD5Hash(token.ToString(), Encoding.UTF8);\r\n\r\n            return UrlUtils.CompressGuid(md5Hash);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets the list of default document fields\r\n        /// </summary>\r\n        /// <returns></returns>\r\n        public static IEnumerable<DocumentField> GetDefaultDocumentFields()\r\n        {\r\n            return new[]\r\n            {\r\n                new DocumentField(\r\n                    DocumentFieldNames.Label,\r\n                    null,\r\n                    new DocumentFieldPreview\r\n                    {\r\n                        PreviewFunction = value => value?.ToString(),\r\n                        Sortable = true,\r\n                        FieldOrder = 1\r\n                    })\r\n                {\r\n                    Label = Texts.Untranslated.FieldNames_Label\r\n                },\r\n\r\n                new DocumentField(\r\n                    DocumentFieldNames.Source,\r\n                    new DocumentFieldFacet\r\n                    {\r\n                        PreviewFunction = value => value,\r\n                        FacetType = FacetType.SingleValue,\r\n                        MinHitCount = 1\r\n                    },\r\n                    null)\r\n                {\r\n                    Label = null\r\n                },\r\n\r\n                new DocumentField(\r\n                    DocumentFieldNames.DataType,\r\n                    new DocumentFieldFacet\r\n                    {\r\n                        PreviewFunction = GetDataTypeLabel,\r\n                        MinHitCount = 1\r\n                    },\r\n                    new DocumentFieldPreview\r\n                    {\r\n                        PreviewFunction = GetDataTypeLabel,\r\n                        Sortable = false,\r\n                        FieldOrder = 2\r\n                    })\r\n                {\r\n                    Label = Texts.Untranslated.FieldNames_DataType\r\n                },\r\n\r\n                new DocumentField(\r\n                    DocumentFieldNames.HasUrl,\r\n                    new DocumentFieldFacet\r\n                    {\r\n                        PreviewFunction = value => value,\r\n                        MinHitCount = 1\r\n                    }, \r\n                    null)\r\n                {\r\n                    Label = null\r\n                },\r\n\r\n                new DocumentField(\r\n                    DocumentFieldNames.ConsoleAccess,\r\n                    new DocumentFieldFacet\r\n                    {\r\n                        FacetType = FacetType.MultipleValues,\r\n                        MinHitCount = 1\r\n                    },\r\n                    null)\r\n                {\r\n                    Label = null\r\n                },\r\n                new DocumentField(\r\n                    DocumentFieldNames.Ancestors,\r\n                    new DocumentFieldFacet\r\n                    {\r\n                        FacetType = FacetType.MultipleValues,\r\n                        MinHitCount = 1\r\n                    },\r\n                    null)\r\n                {\r\n                    Label = null\r\n                }\r\n            };\r\n        }\r\n\r\n        private IEnumerable<string> ProcessXhtml(string textFragment)\r\n        {\r\n            if (textFragment.StartsWith(\"<html\"))\r\n            {\r\n                var crawler = new XhtmlCrawlingHelper\r\n                {\r\n                    CrawlFunctionParameters = _currentPage?.DataSourceId.PublicationScope == PublicationScope.Unpublished\r\n                };\r\n\r\n                crawler.SetPageContext(_currentPage);\r\n                crawler.CrawlXhtml(textFragment);\r\n\r\n                foreach (var fragment in crawler.TextParts)\r\n                {\r\n                    yield return fragment;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                yield return textFragment;\r\n            }\r\n        }\r\n\r\n        private static string GetDataTypeLabel(object datatype)\r\n        {\r\n            var str = (string)datatype;\r\n\r\n            Guid dataTypeId;\r\n            if (Guid.TryParse(str, out dataTypeId))\r\n            {\r\n                if (dataTypeId == new Guid(\"C046F704-D3E4-4b3d-8CB9-77564FB0B9E7\"))\r\n                {\r\n                    return Texts.DataType_Page;\r\n                }\r\n\r\n                if (dataTypeId == new Guid(\"A8716C78-1499-4155-875B-2545006385B2\"))\r\n                {\r\n                    return Texts.DataType_MediaFile;\r\n                }\r\n\r\n                var descriptor = DataMetaDataFacade.GetDataTypeDescriptor(dataTypeId);\r\n                if (descriptor != null)\r\n                {\r\n                    return descriptor.Title ?? descriptor.Name;\r\n                }\r\n            }\r\n\r\n            return str;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/Crawling/XhtmlCrawlingHelper.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Web;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Pages;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.Search.Crawling\r\n{\r\n    internal class XhtmlCrawlingHelper\r\n    {\r\n        private const int FunctionExecutionTimeout = 5000;\r\n\r\n        private readonly IList<string> _textParts = new List<string>();\r\n\r\n        public IEnumerable<string> TextParts => _textParts;\r\n\r\n        private IPage _page;\r\n\r\n        private readonly StringBuilder _currentFragment = new StringBuilder();\r\n\r\n        public void SetPageContext(IPage page)\r\n        {\r\n            _page = page;\r\n        }\r\n\r\n        public bool CrawlFunctionParameters { get; set; }\r\n\r\n        /// <summary>\r\n        /// Crawls xhtml content and extracts text parts\r\n        /// </summary>\r\n        /// <param name=\"xhtml\"></param>\r\n        public bool CrawlXhtml(string xhtml)\r\n        {\r\n            try\r\n            {\r\n                var doc = XhtmlDocument.Parse(xhtml);\r\n\r\n                CrawlXhtml(doc);\r\n\r\n                CompleteTextFragment();\r\n\r\n                return true;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(nameof(XhtmlCrawlingHelper), ex);\r\n\r\n                _currentFragment.Clear();\r\n                return false;\r\n            }\r\n        }\r\n\r\n        private void CrawlXhtml(XhtmlDocument document) => ProcessNode(document.Body);\r\n\r\n        private void AppendToCurrentTextFragment(string text)\r\n        {\r\n            _currentFragment.Append(text);\r\n        }\r\n\r\n        private void CompleteTextFragment()\r\n        {\r\n            if (_currentFragment.Length == 0) return;\r\n\r\n            var str = _currentFragment.ToString();\r\n            if (!string.IsNullOrWhiteSpace(str))\r\n            {\r\n                _textParts.Add(str);\r\n            }\r\n\r\n            _currentFragment.Clear();\r\n        }\r\n\r\n        private void ProcessNode(XNode node)\r\n        {\r\n            if (node is XText textNode)\r\n            {\r\n                AppendToCurrentTextFragment(textNode.Value);\r\n                return;\r\n            }\r\n\r\n            if (node is XElement element)\r\n            {\r\n                ProcessElement(element);\r\n            }\r\n        }\r\n\r\n        private void ProcessElement(XElement element)\r\n        {\r\n            if (element.Name.Namespace == Namespaces.Function10\r\n                && element.Name.LocalName == \"function\")\r\n            {\r\n                ProcessFunctionCall(element);\r\n                return;\r\n            }\r\n\r\n            if (element.Name.LocalName == \"script\" || element.Name.LocalName == \"noscript\" || element.Name.LocalName == \"style\")\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (element.Name.LocalName == \"a\")\r\n            {\r\n                // TODO: process \"href\" attribute for page/data references\r\n            }\r\n\r\n            bool isInlineElement = XhtmlPrettifier.InlineElements.Contains(\r\n                new XhtmlPrettifier.NamespaceName {\r\n                    Name = element.Name.LocalName,\r\n                    Namespace = \"\"\r\n                });\r\n\r\n            bool isFragmentContinuation = element.Name.LocalName != \"br\"\r\n                    && (element.Name.LocalName == \"body\" || isInlineElement);\r\n\r\n            if (!isFragmentContinuation)\r\n            {\r\n                CompleteTextFragment();\r\n            }\r\n\r\n            foreach (var childNode in element.Nodes())\r\n            {\r\n                ProcessNode(childNode);\r\n            }\r\n\r\n            if (!isFragmentContinuation)\r\n            {\r\n                CompleteTextFragment();\r\n            }\r\n        }\r\n\r\n        private void ProcessFunctionCall(XElement functionNode)\r\n        {\r\n            var functionName = functionNode.GetAttributeValue(\"name\");\r\n            if(functionName == null) return;\r\n\r\n            IFunction function;\r\n            try\r\n            {\r\n                if (!FunctionFacade.TryGetFunction(out function, functionName))\r\n                {\r\n                    return;\r\n                }\r\n            }\r\n            catch\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (CrawlFunctionParameters)\r\n            {\r\n                foreach (var paramElement in functionNode.Elements())\r\n                {\r\n                    var parameterName = paramElement.GetAttributeValue(\"name\");\r\n                    if (parameterName == null) continue;\r\n\r\n                    var profile = function.ParameterProfiles.FirstOrDefault(p => p.Name == parameterName);\r\n                    if (profile != null)\r\n                    {\r\n                        if (profile.Type == typeof(XhtmlDocument) \r\n                            || profile.Type == typeof(Lazy<XhtmlDocument>))\r\n                        {\r\n                            ProcessElement(paramElement);\r\n                        }\r\n\r\n                        // TODO: handle the other parameter types\r\n                    }\r\n                }\r\n            }\r\n\r\n            var returnType = function.ReturnType;\r\n            if (returnType == typeof(XhtmlDocument)\r\n                || function.ReturnType == typeof(string))\r\n            {\r\n                var functionResult = TryExecuteFunction(functionNode, FunctionExecutionTimeout);\r\n                if (functionResult is XhtmlDocument document)\r\n                {\r\n                    CrawlXhtml(document);\r\n                }\r\n\r\n                if (functionResult is string str)\r\n                {\r\n                    if (str.TrimStart().StartsWith(\"<html\"))\r\n                    {\r\n                        CrawlXhtml(str);\r\n                    }\r\n                    else\r\n                    {\r\n                        AppendToCurrentTextFragment(str);\r\n                    }\r\n                }\r\n            }\r\n            \r\n        }\r\n\r\n        private object TryExecuteFunction(XElement functionNode, int timeoutMs)\r\n        {\r\n            object result = null;\r\n\r\n            var cts = new CancellationTokenSource();\r\n            var executeTask = Task.Run(() => result = TryExecuteFunction(functionNode), cts.Token);\r\n            executeTask.Wait(timeoutMs);\r\n\r\n            if(executeTask.Status == TaskStatus.Running)\r\n            {\r\n                cts.Cancel();\r\n            };\r\n\r\n            return result;\r\n        }\r\n\r\n\r\n        private object TryExecuteFunction(XElement functionNode)\r\n        {\r\n            try\r\n            {\r\n                var tree = FunctionFacade.BuildTree(functionNode);\r\n\r\n                using (new FakeHttpContext())\r\n                {\r\n                    if (_page != null)\r\n                    {\r\n                        PageRenderer.CurrentPage = _page;\r\n                        C1PageRoute.PageUrlData = new PageUrlData(_page);\r\n                    }\r\n                    PageRenderer.RenderingReason = RenderingReason.BuildSearchIndex;\r\n\r\n                    return tree.GetValue(new FunctionContextContainer\r\n                    {\r\n                        SuppressXhtmlExceptions = false\r\n                    });\r\n                }\r\n            }\r\n            catch (Exception)\r\n            {\r\n                return null;\r\n            }\r\n        }\r\n\r\n        private class FakeHttpContext : IDisposable\r\n        {\r\n            private readonly HttpContext _originalContext;\r\n\r\n            public FakeHttpContext()\r\n            {\r\n                _originalContext = HttpContext.Current;\r\n\r\n                HttpContext.Current = new HttpContext(\r\n                    new HttpRequest(\"\", \"http://contoso.com\", \"\"),\r\n                    new HttpResponse(new StringWriter())\r\n                );\r\n            }\r\n\r\n            public void Dispose()\r\n            {\r\n                HttpContext.Current = _originalContext;\r\n#if LeakCheck\r\n                GC.SuppressFinalize(this);\r\n#endif\r\n            }\r\n\r\n#if LeakCheck\r\n            private string stack = Environment.StackTrace;\r\n            /// <exclude />\r\n            ~FakeHttpContext()\r\n            {\r\n                Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n            }\r\n#endif\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/DocumentField.cs",
    "content": "﻿namespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// Contains information about the facet.\r\n    /// </summary>\r\n    public class DocumentFieldFacet\r\n    {\r\n        /// <exclude />\r\n        public delegate string FacetValuePreviewDelegate(string value);\r\n\r\n        /// <summary>\r\n        /// Gets or sets the maximum number of choices to return. The default value is 0 which means - all.\r\n        /// </summary>\r\n        public int Limit { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the minimum about of hits a choice should have to be listed in the result.\r\n        /// </summary>\r\n        public int MinHitCount { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the facet type.\r\n        /// </summary>\r\n        public FacetType FacetType { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the facet type.\r\n        /// </summary>\r\n        public FacetSorting FacetSorting { get; set; }\r\n\r\n        /// <summary>\r\n        /// A function to get a label for a given facet value.\r\n        /// </summary>\r\n        public FacetValuePreviewDelegate PreviewFunction { get; set; }\r\n\r\n        /// <summary>\r\n        /// When <value>true</value>, information about not selected facet values should be returned when querying the facet.\r\n        /// </summary>\r\n        public bool ExpandSelection { get; set; } = true;\r\n\r\n        //public int FieldOrder { get; set; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Defines a type of a facet field.\r\n    /// </summary>\r\n    public enum FacetType\r\n    {\r\n        /// <summary>\r\n        /// A signle facet value per data field value.\r\n        /// </summary>\r\n        SingleValue = 0,\r\n\r\n        /// <summary>\r\n        /// Allows multiple facet values per data field value.\r\n        /// </summary>\r\n        MultipleValues = 1\r\n    }\r\n\r\n    /// <summary>\r\n    /// Defines a type of a facet field.\r\n    /// </summary>\r\n    public enum FacetSorting\r\n    {\r\n        /// <summary>\r\n        /// A the facets with the most hits will be shown first.\r\n        /// </summary>\r\n        HitCount = 0,\r\n\r\n        /// <summary>\r\n        /// The facets will be shown in lexicographical ascending order.\r\n        /// </summary>\r\n        Ascending = 1\r\n    }\r\n\r\n    /// <summary>\r\n    /// Defines a sorting methods for the search results\r\n    /// </summary>\r\n    public enum SortTermsAs\r\n    {\r\n        /// <summary>\r\n        /// The values will be sorted alphabetically\r\n        /// </summary>\r\n        String = 0,\r\n        /// <summary>\r\n        /// The values will be sorted as integer values\r\n        /// </summary>\r\n        Int = 1,\r\n        /// <summary>\r\n        /// The values will be sorted as long values\r\n        /// </summary>\r\n        Long = 2,\r\n        /// <summary>\r\n        /// The values will be sorted as float values\r\n        /// </summary>\r\n        Float = 3,\r\n        /// <summary>\r\n        /// The values will be sorted as double values\r\n        /// </summary>\r\n        Double = 4\r\n    }\r\n\r\n    /// <summary>\r\n    /// Constains information how a data field is preserved and shown in search results.\r\n    /// </summary>\r\n    public sealed class DocumentFieldPreview\r\n    {\r\n        /// <exclude />\r\n        public delegate string ValuePreviewDelegate(object value);\r\n\r\n        /// <summary>\r\n        /// A function reference to preview the field value.\r\n        /// </summary>\r\n        public ValuePreviewDelegate PreviewFunction { get; set; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether sorting for the given field should be enabled.\r\n        /// </summary>\r\n        public bool Sortable { get; set; }\r\n\r\n        /// <summary>\r\n        /// Defines a sorting method for the given values.\r\n        /// </summary>\r\n        public SortTermsAs SortTermsAs { get; set; }\r\n\r\n        /// <summary>\r\n        /// Indicates the order in which the field appears\r\n        /// </summary>\r\n        public int FieldOrder { get; set; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Defines a custom field in a search document.\r\n    /// </summary>\r\n    public sealed class DocumentField\r\n    {\r\n        /// <summary>\r\n        /// \r\n        /// </summary>\r\n        /// <param name=\"name\"></param>\r\n        /// <param name=\"facetInformation\"></param>\r\n        /// <param name=\"previewInformation\"></param>\r\n        public DocumentField(\r\n            string name, \r\n            DocumentFieldFacet facetInformation, \r\n            DocumentFieldPreview previewInformation)\r\n        {\r\n            Name = name;\r\n            Facet = facetInformation;\r\n            Preview = previewInformation;\r\n            Label = name;\r\n        }\r\n\r\n        /// <summary>\r\n        /// The name of the field\r\n        /// </summary>\r\n        public string Name { get; }\r\n\r\n        /// <summary>\r\n        /// A function to get the field label in the given culture. ${,}\r\n        /// </summary>\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether faceted search is enabled for this field.\r\n        /// </summary>\r\n        public bool FacetedSearchEnabled => Facet != null;\r\n\r\n        /// <summary>\r\n        /// Indicates whether field value is preserved in the index to be shown in search results.\r\n        /// </summary>\r\n        public bool FieldValuePreserved => Preview != null;\r\n\r\n        /// <summary>\r\n        /// Faceted search information.\r\n        /// </summary>\r\n        public DocumentFieldFacet Facet { get; set; }\r\n\r\n        /// <summary>\r\n        /// Field preview information.\r\n        /// </summary>\r\n        public DocumentFieldPreview Preview { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/DocumentSources/BuiltInTypesDocumentSourceProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.Search.DocumentSources\r\n{\r\n    internal class BuiltInTypesDocumentSourceProvider: ISearchDocumentSourceProvider\r\n    {\r\n        private readonly ISearchDocumentSource[] _documentSources;\r\n\r\n        public BuiltInTypesDocumentSourceProvider(\r\n            CmsPageDocumentSource cmsPageDocumentSource,\r\n            MediaLibraryDocumentSource mediaLibraryDocumentSource)\r\n        {\r\n            _documentSources = new ISearchDocumentSource[]\r\n            {\r\n                cmsPageDocumentSource,\r\n                mediaLibraryDocumentSource\r\n            };\r\n        }\r\n\r\n        public IEnumerable<ISearchDocumentSource> GetDocumentSources() => _documentSources;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/DocumentSources/CmsPageDocumentSource.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Search.Crawling;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Routing.Foundation.PluginFacades;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Search.DocumentSources\r\n{\r\n    public class CmsPageDocumentSource : ISearchDocumentSource\r\n    {\r\n        const string LogTitle = nameof(CmsPageDocumentSource);\r\n\r\n        protected List<IDocumentSourceListener> _listeners = new List<IDocumentSourceListener>();\r\n        private readonly DataChangesIndexNotifier _changesIndexNotifier;\r\n        protected Lazy<IReadOnlyCollection<DocumentField>> _customFields;\r\n        protected IEnumerable<ISearchDocumentBuilderExtension> _docBuilderExtensions;\r\n\r\n        protected CmsPageDocumentSource()\r\n        {\r\n        }\r\n\r\n        public CmsPageDocumentSource(IEnumerable<ISearchDocumentBuilderExtension> extensions)\r\n        {\r\n            _customFields = new Lazy<IReadOnlyCollection<DocumentField>>(() =>\r\n            {\r\n                var pageDocFields = DataTypeSearchReflectionHelper.GetDocumentFields(typeof (IPage));\r\n                var metaDataFields = PageMetaDataFacade.GetAllMetaDataTypes()\r\n                    .SelectMany(dataType => DataTypeSearchReflectionHelper.GetDocumentFields(dataType, false));\r\n\r\n                return pageDocFields\r\n                       .Concat(metaDataFields)\r\n                       .ExcludeDuplicateKeys(f => f.Name)\r\n                       .ToList();\r\n            });\r\n\r\n            _docBuilderExtensions = extensions;\r\n\r\n            _changesIndexNotifier = new DataChangesIndexNotifier(\r\n                _listeners, typeof(IPage),\r\n                (data, culture) =>\r\n                {\r\n                    var page = (IPage) data;\r\n                    var entityToken = GetAdministratedEntityToken(page);\r\n                    return entityToken != null ? FromPage(page, entityToken, null) : null;\r\n                },\r\n                data => GetDocumentId((IPage) data),\r\n                PageShouldBeIndexed);\r\n\r\n            _changesIndexNotifier.Start();\r\n        }\r\n\r\n        public virtual string Name => typeof (IPage).FullName;\r\n\r\n        public virtual void Subscribe(IDocumentSourceListener sourceListener)\r\n        {\r\n            _listeners.Add(sourceListener);\r\n        }\r\n\r\n        public virtual IEnumerable<DocumentWithContinuationToken> GetSearchDocuments(CultureInfo culture, string continuationToken = null)\r\n        {\r\n            ICollection<IPage> unpublishedPages;\r\n            IDictionary<Guid, Guid> parentPageIDs;\r\n\r\n            var (lastPageId, lastPagesPublicationScope) = ParseContinuationToken(continuationToken);\r\n\r\n            using (var conn = new DataConnection(PublicationScope.Unpublished, culture))\r\n            {\r\n                unpublishedPages = conn.Get<IPage>().Evaluate();\r\n                parentPageIDs = conn.Get<IPageStructure>().ToDictionary(ps => ps.Id, ps => ps.ParentId);\r\n            }\r\n\r\n            unpublishedPages = unpublishedPages\r\n                .Where(p => p.Id.CompareTo(lastPageId) >= 0)\r\n                .OrderBy(p => p.Id)\r\n                .ToList();\r\n\r\n            var publishedPages = new Dictionary<Tuple<Guid, Guid>, IPage>();\r\n            HashSet<Guid> publishedPageIds;\r\n\r\n            using (var conn = new DataConnection(PublicationScope.Published, culture))\r\n            {\r\n                publishedPages = conn.Get<IPage>().ToDictionary(page => new Tuple<Guid, Guid>(page.Id, page.VersionId));\r\n                publishedPageIds = new HashSet<Guid>(publishedPages.Select(p => p.Key.Item1));\r\n            }\r\n\r\n            var unpublishedMetaData = GetAllMetaData(PublicationScope.Unpublished, culture);\r\n            var publishedMetaData = GetAllMetaData(PublicationScope.Published, culture);\r\n\r\n\r\n            foreach (var unpublishedPage in unpublishedPages)\r\n            {\r\n                Guid pageId = unpublishedPage.Id;\r\n                var entityToken = unpublishedPage.GetDataEntityToken();\r\n\r\n                if (pageId.CompareTo(lastPageId) > 0\r\n                    && publishedPages.TryGetValue(new Tuple<Guid, Guid>(pageId, unpublishedPage.VersionId),\r\n                        out IPage publishedPage)\r\n                    && AllAncestorPagesArePublished(pageId, publishedPageIds, parentPageIDs))\r\n                {\r\n                    yield return new DocumentWithContinuationToken\r\n                    {\r\n                        Document = FromPage(publishedPage, entityToken, publishedMetaData),\r\n                        ContinuationToken = GetContinuationToken(publishedPage)\r\n                    };\r\n\r\n                    if (unpublishedPage.PublicationStatus == GenericPublishProcessController.Published)\r\n                    {\r\n                        // If page is in \"published\" state, indexing only one version of it\r\n                        continue;\r\n                    }\r\n                }\r\n\r\n                if (pageId.CompareTo(lastPageId) > 0\r\n                    || lastPagesPublicationScope == PublicationScope.Published)\r\n                {\r\n                    yield return new DocumentWithContinuationToken\r\n                    {\r\n                        Document = FromPage(unpublishedPage, entityToken, unpublishedMetaData),\r\n                        ContinuationToken = GetContinuationToken(unpublishedPage)\r\n                    };\r\n                }\r\n            }\r\n        }\r\n\r\n        private (Guid lastPage, PublicationScope publicationScope) ParseContinuationToken(string continuationToken)\r\n        {\r\n            if (continuationToken == null)\r\n            {\r\n                return (Guid.Empty, PublicationScope.Unpublished);\r\n            }\r\n\r\n            var values = continuationToken.Split(':');\r\n            return (Guid.Parse(values[0]), (PublicationScope) Enum.Parse(typeof(PublicationScope), values[1]));\r\n        }\r\n\r\n        private string GetContinuationToken(IPage page) => $\"{page.Id}:{page.DataSourceId.PublicationScope}\";\r\n\r\n\r\n        public IReadOnlyCollection<DocumentField> CustomFields => _customFields.Value;\r\n\r\n\r\n        protected virtual SearchDocument FromPage(IPage page, EntityToken entityToken, Dictionary<Tuple<Guid, Guid>, List<IData>> allMetaData)\r\n        {\r\n            string label = page.MenuTitle;\r\n            if (string.IsNullOrWhiteSpace(label))\r\n            {\r\n                label = page.Title;\r\n            }\r\n\r\n            bool isPublished = page.DataSourceId.PublicationScope == PublicationScope.Published;\r\n            string documentId = GetDocumentId(page);\r\n\r\n            var docBuilder = new SearchDocumentBuilder(_docBuilderExtensions);\r\n            docBuilder.SetDataType(typeof(IPage));\r\n\r\n            docBuilder.CrawlData(page);\r\n\r\n            using (new DataConnection(page.DataSourceId.PublicationScope, page.DataSourceId.LocaleScope))\r\n            {\r\n                if (isPublished)\r\n                {\r\n                    docBuilder.Url = PageUrls.BuildUrl(page, UrlKind.Internal);\r\n                }\r\n\r\n                var placeholders = PageManager.GetPlaceholderContent(page.Id, page.VersionId);\r\n                placeholders.ForEach(pl => docBuilder.CrawlData(pl, true));\r\n\r\n                List<IData> metaData;\r\n\r\n                if (allMetaData != null)\r\n                {\r\n                    allMetaData.TryGetValue(new Tuple<Guid, Guid>(page.Id, page.VersionId), out metaData);\r\n                }\r\n                else\r\n                {\r\n                    metaData = GetMetaData(page.Id, page.VersionId, page.DataSourceId.PublicationScope, page.DataSourceId.LocaleScope);\r\n                }\r\n\r\n                try\r\n                {\r\n                    metaData?.ForEach(pageMetaData => docBuilder.CrawlData(pageMetaData));\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogWarning(LogTitle, ex);\r\n                }\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(page.UrlTitle) \r\n                && !UrlFormattersPluginFacade.FormatUrl(page.Title, true).Equals(page.UrlTitle, StringComparison.OrdinalIgnoreCase)\r\n                && !UrlFormattersPluginFacade.FormatUrl(page.Title, false).Equals(page.UrlTitle, StringComparison.OrdinalIgnoreCase))\r\n            {\r\n                docBuilder.TextParts.Add(page.UrlTitle);\r\n            }\r\n\r\n            return docBuilder.BuildDocument(Name, documentId, label, null, entityToken);\r\n        }\r\n\r\n        private EntityToken GetAdministratedEntityToken(IPage page)\r\n        {\r\n            if (page.DataSourceId.PublicationScope == PublicationScope.Published)\r\n            {\r\n                return page.GetDataEntityToken();\r\n            }\r\n\r\n            using (new DataScope(PublicationScope.Unpublished, page.DataSourceId.LocaleScope))\r\n            {\r\n                var unpublishedPage = PageManager.GetPageById(page.Id, page.VersionId, true);\r\n                return unpublishedPage?.GetDataEntityToken();\r\n            }\r\n        }\r\n\r\n        protected virtual string GetDocumentId(IPage page)\r\n        {\r\n            bool isUnpublished = page.DataSourceId.PublicationScope == PublicationScope.Unpublished;\r\n\r\n            string versionId = \"\";\r\n            if (page.VersionId != Guid.Empty)\r\n            {\r\n                versionId = UrlUtils.CompressGuid(page.VersionId);\r\n            }\r\n            return $\"{UrlUtils.CompressGuid(page.Id)}{versionId}\" + (isUnpublished ? \"u\" : \"\");\r\n        }\r\n\r\n        private Dictionary<Tuple<Guid, Guid>, List<IData>> GetAllMetaData(PublicationScope publicationScope, CultureInfo culture)\r\n        {\r\n            var result = new Dictionary<Tuple<Guid, Guid>, List<IData>>();\r\n\r\n            using (var conn = new DataConnection(publicationScope, culture))\r\n            {\r\n                conn.DisableServices();\r\n\r\n                foreach (var metaDataType in PageMetaDataFacade.GetAllMetaDataTypes()\r\n                    .Where(type => typeof(IPageMetaData).IsAssignableFrom(type)))\r\n                {\r\n                    foreach (var dataItem in DataFacade.GetData(metaDataType).OfType<IPageMetaData>())\r\n                    {\r\n                        var key = new Tuple<Guid, Guid>(dataItem.PageId, dataItem.VersionId);\r\n                        var list = result.GetOrAdd(key, () => new List<IData>());\r\n                        list.Add(dataItem);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private List<IData> GetMetaData(Guid pageId, Guid versionId, PublicationScope publicationScope, CultureInfo culture)\r\n        {\r\n            var result = new List<IData>();\r\n\r\n            using (var conn = new DataConnection(publicationScope, culture))\r\n            {\r\n                conn.DisableServices();\r\n\r\n                foreach (var metaDataType in PageMetaDataFacade.GetAllMetaDataTypes()\r\n                    .Where(type => typeof(IPageMetaData).IsAssignableFrom(type)))\r\n                {\r\n                    result.AddRange(DataFacade.GetData(metaDataType).OfType<IPageMetaData>()\r\n                        .Where(md => md.PageId == pageId && md.VersionId == versionId));\r\n                }\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        private bool AllAncestorPagesArePublished(Guid pageId, HashSet<Guid> publishedPageIds,\r\n            IDictionary<Guid, Guid> parentPageIDs)\r\n        {\r\n            int depth = 100;\r\n\r\n            while (depth > 0)\r\n            {\r\n                if (!parentPageIDs.TryGetValue(pageId, out Guid parentPageID))\r\n                {\r\n                    // The the page is unreachable from the tree, no need to index it\r\n                    return false;\r\n                }\r\n\r\n                if (parentPageID == Guid.Empty)\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                if (!publishedPageIds.Contains(parentPageID))\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                pageId = parentPageID;\r\n                depth--;\r\n            }\r\n\r\n            Log.LogError(nameof(CmsPageDocumentSource), $\"There's a loop in page hierarchy. Page ID: '{pageId}'\");\r\n            return false;\r\n        }\r\n\r\n        private bool AllAncestorPagesArePublished(Guid pageId, CultureInfo locale)\r\n        {\r\n            using (var dc = new DataConnection(PublicationScope.Published, locale))\r\n            {\r\n                dc.DisableServices();\r\n\r\n                int depth = 100;\r\n\r\n                while (depth > 0)\r\n                {\r\n                    var parentPageId = PageManager.GetParentId(pageId);\r\n                    if (parentPageId == Guid.Empty) return true;\r\n\r\n                    var parentPage = PageManager.GetPageById(parentPageId, true);\r\n                    if (parentPage == null)\r\n                    {\r\n                        return false;\r\n                    }\r\n\r\n                    pageId = parentPageId;\r\n                    depth--;\r\n                }\r\n            }\r\n\r\n            Log.LogError(nameof(CmsPageDocumentSource), $\"There's a loop in page hierarchy. Page ID: '{pageId}'\");\r\n            return false;\r\n        }\r\n\r\n        protected bool PageShouldBeIndexed(IData data)\r\n        {\r\n            if (!(data is IPage page))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            if (data.DataSourceId.PublicationScope == PublicationScope.Published)\r\n            {\r\n                return AllAncestorPagesArePublished(page.Id, page.DataSourceId.LocaleScope);\r\n            }\r\n\r\n            // Indexing the unpublished version fo the page only if the page is not in the \"published\" state,\r\n            // or the published version isn't indexed\r\n            return page.PublicationStatus != GenericPublishProcessController.Published\r\n                   || !AllAncestorPagesArePublished(page.Id, page.DataSourceId.LocaleScope);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/DocumentSources/DataChangesIndexNotifier.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\n\r\nnamespace Composite.Search.DocumentSources\r\n{\r\n    internal class DataChangesIndexNotifier\r\n    {\r\n        const string LogTitle = nameof(DataChangesIndexNotifier);\r\n\r\n        private readonly IEnumerable<IDocumentSourceListener> _listeners;\r\n        private readonly Type _interfaceType;\r\n\r\n        private Func<IData, CultureInfo, SearchDocument> GetDocument { get; }\r\n        private Func<IData, string> GetDocumentId { get; }\r\n        private Predicate<IData> DataItemShouldBeIndexed { get; }\r\n\r\n        public DataChangesIndexNotifier(\r\n            IEnumerable<IDocumentSourceListener> listeners,\r\n            Type interfaceType, \r\n            Func<IData, CultureInfo, SearchDocument> getDocumentFunc,\r\n            Func<IData, string> getDocumentIdFunc,\r\n            Predicate<IData> dataItemShouldBeIndexed = null)\r\n        {\r\n            _listeners = listeners;\r\n            _interfaceType = interfaceType;\r\n            GetDocument = getDocumentFunc;\r\n            GetDocumentId = getDocumentIdFunc;\r\n            DataItemShouldBeIndexed = dataItemShouldBeIndexed ?? (_ => !IsPublishedDataFromUnpublishedScope(_));\r\n        }\r\n\r\n        public void Start()\r\n        {\r\n            DataEventSystemFacade.SubscribeToDataAfterAdd(_interfaceType,\r\n                (sender, args) => CatchAll(() => GetActionContainer().Add(() => Data_OnAfterAdd(sender, args))),\r\n                true);\r\n\r\n            DataEventSystemFacade.SubscribeToDataAfterUpdate(_interfaceType,\r\n                (sender, args) => CatchAll(() => GetActionContainer().Add(() => Data_OnAfterUpdate(sender, args))),\r\n                true);\r\n\r\n            DataEventSystemFacade.SubscribeToDataDeleted(_interfaceType, \r\n                (sender, args) => CatchAll(() => GetActionContainer().Add(() => Data_OnDeleted(sender, args))),\r\n                true);\r\n        }\r\n\r\n        private IndexUpdateActionContainer GetActionContainer()\r\n        {\r\n            var service = ServiceLocator.GetService<IndexUpdateActionContainer>();\r\n\r\n            return service ?? new IndexUpdateActionContainer();\r\n        }\r\n\r\n        private IEnumerable<CultureInfo> GetCultures(IData data)\r\n        {\r\n            if (data is ILocalizedControlled)\r\n            {\r\n                return new[] { data.DataSourceId.LocaleScope };\r\n            }\r\n\r\n            // If data is not localized, it should be indexed for every localization scope\r\n            return DataLocalizationFacade.ActiveLocalizationCultures;\r\n        }\r\n\r\n        private bool IgnoreNotifications() => !_listeners.Any();\r\n\r\n        private void Data_OnAfterAdd(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            if (IgnoreNotifications()) return;\r\n\r\n            try\r\n            {\r\n                var data = dataEventArgs.Data;\r\n\r\n                if (!DataItemShouldBeIndexed(data))\r\n                {\r\n                    return;\r\n                }\r\n\r\n                foreach (var culture in GetCultures(data))\r\n                {\r\n                    var document = GetDocument(data, culture);\r\n                    if (document == null) continue;\r\n\r\n                    _listeners.ForEach(l => l.Create(culture, document));\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n        private void Data_OnAfterUpdate(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            if (IgnoreNotifications()) return;\r\n\r\n            try\r\n            {\r\n                var data = dataEventArgs.Data;\r\n                bool toBeDeleted = !DataItemShouldBeIndexed(data);\r\n\r\n                if (toBeDeleted)\r\n                {\r\n                    DeleteDocuments(data);\r\n                    return;\r\n                }\r\n\r\n                foreach (var culture in GetCultures(data))\r\n                {\r\n                    var document = GetDocument(data, culture);\r\n                    if (document == null) continue;\r\n\r\n                    _listeners.ForEach(l => l.Update(culture, document));\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n        private void Data_OnDeleted(object sender, DataEventArgs dataEventArgs)\r\n        {\r\n            if (IgnoreNotifications()) return;\r\n\r\n            var data = dataEventArgs.Data;\r\n            DeleteDocuments(data);\r\n        }\r\n\r\n        private void DeleteDocuments(IData data)\r\n        {\r\n            try\r\n            {\r\n                var documentId = GetDocumentId(data);\r\n\r\n                foreach (var culture in GetCultures(data))\r\n                {\r\n                    _listeners.ForEach(l => l.Delete(culture, documentId));\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, ex);\r\n            }\r\n        }\r\n\r\n        private bool IsPublishedDataFromUnpublishedScope(IData data)\r\n        {\r\n            return typeof (IPublishControlled).IsAssignableFrom(_interfaceType)\r\n                   && data.DataSourceId.PublicationScope == PublicationScope.Unpublished\r\n                   && ((IPublishControlled)data).PublicationStatus == GenericPublishProcessController.Published;\r\n        }\r\n\r\n        private void CatchAll(Action action)\r\n        {\r\n            try\r\n            {\r\n                action();\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(nameof(DataChangesIndexNotifier), ex);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/DocumentSources/DataTypeDocumentSource.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Search.Crawling;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\n\r\nnamespace Composite.Search.DocumentSources\r\n{\r\n    internal class DataTypeDocumentSource : ISearchDocumentSource\r\n    {\r\n        const string LogTitle = nameof(DataTypeDocumentSource);\r\n\r\n        private readonly List<IDocumentSourceListener> _listeners = new List<IDocumentSourceListener>();\r\n        private readonly Type _interfaceType;\r\n        private readonly DataChangesIndexNotifier _changesIndexNotifier;\r\n        private readonly Lazy<IReadOnlyCollection<DocumentField>> _customFields;\r\n\r\n        private readonly bool _isPublishable;\r\n\r\n        static DataTypeDocumentSource()\r\n        {\r\n            DynamicTypeManager.OnStoreCreated += OnStoreCreated;\r\n            DynamicTypeManager.OnStoreDropped += OnStoreDropped;\r\n            DynamicTypeManager.OnStoreUpdated += OnStoreUpdated;\r\n        }\r\n\r\n\r\n        public DataTypeDocumentSource(Type interfaceType)\r\n        {\r\n            _interfaceType = interfaceType;\r\n\r\n            _isPublishable = typeof (IPublishControlled).IsAssignableFrom(_interfaceType);\r\n\r\n            _customFields = new Lazy<IReadOnlyCollection<DocumentField>>(GetDocumentFields);\r\n\r\n            _changesIndexNotifier = new DataChangesIndexNotifier(\r\n                _listeners, _interfaceType, FromData, GetDocumentId);\r\n\r\n            _changesIndexNotifier.Start();\r\n        }\r\n\r\n        public string Name => _interfaceType.FullName;\r\n\r\n        public void Subscribe(IDocumentSourceListener sourceListener)\r\n        {\r\n            _listeners.Add(sourceListener);\r\n        }\r\n\r\n        public IEnumerable<DocumentWithContinuationToken> GetSearchDocuments(CultureInfo culture, string continuationToken = null)\r\n        {\r\n            var (continueFromScope, continueFromKey) = ParseCToken(continuationToken);\r\n\r\n            if (continueFromScope == PublicationScope.Published)\r\n            {\r\n                var documents = GetDocumentsFromScope(PublicationScope.Published, culture, continueFromKey);\r\n                foreach (var doc in documents)\r\n                {\r\n                    yield return doc;\r\n                }\r\n            }\r\n\r\n\r\n            if (typeof (IPublishControlled).IsAssignableFrom(_interfaceType))\r\n            {\r\n                var documents = GetDocumentsFromScope(PublicationScope.Unpublished, culture,\r\n                    continueFromScope == PublicationScope.Unpublished ? continueFromKey : null);\r\n\r\n                foreach (var doc in documents)\r\n                {\r\n                    yield return doc;\r\n                }\r\n            }\r\n        }\r\n\r\n        private IEnumerable<DocumentWithContinuationToken> GetDocumentsFromScope(\r\n            PublicationScope publicationScope,\r\n            CultureInfo culture,\r\n            object continueFromKey)\r\n        {\r\n            using (new DataConnection(publicationScope, culture))\r\n            {\r\n                var query = DataFacade.GetData(_interfaceType);\r\n\r\n                query = FilterAndOrderByKey(query, continueFromKey);\r\n\r\n                if (publicationScope == PublicationScope.Unpublished)\r\n                {\r\n                    query = query\r\n                        .Cast<IPublishControlled>()\r\n                        .Where(data => data.PublicationStatus != GenericPublishProcessController.Published);\r\n                }\r\n                var dataSet = query.Cast<IData>().Evaluate();\r\n\r\n                foreach (var data in dataSet)\r\n                {\r\n                    var document = FromData(data, culture);\r\n                    if (document == null) continue;\r\n\r\n                    yield return new DocumentWithContinuationToken\r\n                    {\r\n                        Document = document,\r\n                        ContinuationToken = GetContinuationToken(data, publicationScope)\r\n                    };\r\n                }\r\n            }\r\n        }\r\n\r\n        private IQueryable FilterAndOrderByKey(IQueryable dataset, object continueFromKey)\r\n        {\r\n            var keyProperties = _interfaceType.GetKeyProperties();\r\n            if (keyProperties.Count > 1\r\n                || !keyProperties.All(property => typeof(IComparable).IsAssignableFrom(property.PropertyType)))\r\n            {\r\n                return dataset.Cast<IData>(); // Not supported\r\n            }\r\n        \r\n            var keyProperty = keyProperties.Single();\r\n\r\n            dataset = dataset.OrderBy(_interfaceType, keyProperty.Name);\r\n\r\n            if (continueFromKey != null)\r\n            {\r\n                dataset = dataset.Cast<IData>()\r\n                    .ToList()\r\n                    .Where(data => (keyProperty.GetValue(data) as IComparable).CompareTo(continueFromKey) > 0)\r\n                    .AsQueryable();\r\n            }\r\n\r\n            return dataset;\r\n        }\r\n\r\n        private (PublicationScope continueFromScope, object continueFromKey) ParseCToken(string continuationToken)\r\n        {\r\n            if (continuationToken == null)\r\n            {\r\n                return (PublicationScope.Published, null);\r\n            }\r\n \r\n            int separator = continuationToken.IndexOf(':');\r\n            string keyStr = continuationToken.Substring(separator + 1);\r\n            var keyPropertyType = _interfaceType.GetKeyProperties().Single().PropertyType;\r\n\r\n            object key = ValueTypeConverter.Convert(keyStr, keyPropertyType);\r\n            var scope = (PublicationScope) Enum.Parse(typeof(PublicationScope), continuationToken.Substring(0, separator));\r\n\r\n            return (scope, key);\r\n        }\r\n\r\n        private string GetContinuationToken(IData data, PublicationScope publicationScope)\r\n        {\r\n            if (_interfaceType.GetKeyProperties().Count > 1) return null; // Not supported\r\n\r\n            var key = data.GetUniqueKey();\r\n            string keyStr = ValueTypeConverter.Convert<string>(key);\r\n            return $\"{publicationScope}:{keyStr}\";\r\n        }\r\n\r\n\r\n        public IReadOnlyCollection<DocumentField> CustomFields => _customFields.Value;\r\n\r\n        private SearchDocument FromData(IData data, CultureInfo culture)\r\n        {\r\n            using (new DataScope(culture))\r\n            {\r\n                string label = data.GetLabel();\r\n                if (string.IsNullOrEmpty(label))\r\n                {\r\n                    // Having a label is a requirement for a data item to be searchable\r\n                    return null;\r\n                }\r\n\r\n                var docBuilder = new SearchDocumentBuilder();\r\n                docBuilder.SetDataType(_interfaceType);\r\n\r\n                string documentId = GetDocumentId(data);\r\n                if (InternalUrls.DataTypeSupported(_interfaceType)\r\n                    && (!_isPublishable || data.DataSourceId.PublicationScope == PublicationScope.Published))\r\n                {\r\n                    docBuilder.Url = InternalUrls.TryBuildInternalUrl(data.ToDataReference());\r\n                }\r\n\r\n                docBuilder.CrawlData(data);\r\n\r\n                var entityToken = GetConsoleEntityToken(data);\r\n                if (entityToken == null)\r\n                {\r\n                    return null;\r\n                }\r\n\r\n                return docBuilder.BuildDocument(Name, documentId, label, null, entityToken);\r\n            }\r\n        }\r\n\r\n        private EntityToken GetConsoleEntityToken(IData data)\r\n        {\r\n            if (!(data is IPublishControlled)\r\n                || data.DataSourceId.DataScopeIdentifier == DataScopeIdentifier.Administrated)\r\n            {\r\n                return data.GetDataEntityToken();\r\n            }\r\n\r\n            var administratedData = DataFacade.GetDataFromOtherScope(data, DataScopeIdentifier.Administrated).FirstOrDefault();\r\n            if (administratedData == null)\r\n            {\r\n                Log.LogWarning(LogTitle, $\"The following data item exists in published scope, but doesn't exist in unpublished scope '{data.DataSourceId.Serialize()}'.\");\r\n                return null;\r\n            }\r\n\r\n            return administratedData.GetDataEntityToken();\r\n        }\r\n\r\n        private string GetDocumentId(IData data)\r\n        {\r\n            var uniqueKey = data.GetUniqueKey();\r\n            if (uniqueKey is Guid)\r\n            {\r\n                uniqueKey = UrlUtils.CompressGuid((Guid)uniqueKey);\r\n            }\r\n\r\n            string scopeSuffix = _isPublishable && data.DataSourceId.PublicationScope == PublicationScope.Unpublished\r\n                ? \"u\" : string.Empty;\r\n\r\n            return uniqueKey + scopeSuffix;\r\n        }\r\n\r\n        List<DocumentField> GetDocumentFields()\r\n        {\r\n            return DataTypeSearchReflectionHelper.GetDocumentFields(_interfaceType).ToList();\r\n        }\r\n\r\n        private static void OnStoreCreated(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            if (!dataTypeDescriptor.Searchable) return;\r\n\r\n            var indexUpdater = ServiceLocator.GetService<ISearchIndexUpdater>();\r\n\r\n            if (dataTypeDescriptor.IsCodeGenerated)\r\n            {\r\n                indexUpdater?.StopProcessingUpdates();\r\n            }\r\n\r\n            indexUpdater?.Populate(GetStoreName(dataTypeDescriptor));\r\n        }\r\n\r\n        private static void OnStoreDropped(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            if (!dataTypeDescriptor.Searchable) return;\r\n\r\n            var indexUpdater = ServiceLocator.GetService<ISearchIndexUpdater>();\r\n\r\n            if (dataTypeDescriptor.IsCodeGenerated)\r\n            {\r\n                indexUpdater?.StopProcessingUpdates();\r\n            }\r\n\r\n            indexUpdater?.Remove(GetStoreName(dataTypeDescriptor));\r\n        }\r\n\r\n        private static void OnStoreUpdated(UpdateDataTypeDescriptor updateDataTypeDescriptor)\r\n        {\r\n            OnStoreDropped(updateDataTypeDescriptor.OldDataTypeDescriptor);\r\n            OnStoreCreated(updateDataTypeDescriptor.NewDataTypeDescriptor);\r\n        }\r\n\r\n        private static string GetStoreName(DataTypeDescriptor dtd) => dtd.GetFullInterfaceName();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/DocumentSources/DataTypesDocumentSourceProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data;\r\n\r\nnamespace Composite.Search.DocumentSources\r\n{\r\n    class DataTypesDocumentSourceProvider: ISearchDocumentSourceProvider\r\n    {\r\n        private List<ISearchDocumentSource> _documentSources;\r\n\r\n        public IEnumerable<ISearchDocumentSource> GetDocumentSources()\r\n        {\r\n            if (_documentSources == null)\r\n            {\r\n                lock (this)\r\n                {\r\n                    if (_documentSources == null)\r\n                    {\r\n                        _documentSources = GetDataTypeDocumentSources().ToList();\r\n                    }\r\n                }\r\n            }\r\n\r\n            return _documentSources;\r\n        }\r\n\r\n        private IEnumerable<ISearchDocumentSource> GetDataTypeDocumentSources()\r\n        {\r\n            return from dataType in DataFacade.GetAllInterfaces()\r\n                where !typeof(IPageMetaData).IsAssignableFrom(dataType)\r\n                let attributes = dataType.GetCustomAttributes(true)\r\n                where attributes.Any(a => a is SearchableTypeAttribute)\r\n                select new DataTypeDocumentSource(dataType);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/DocumentSources/IndexUpdateActionContainer.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Composite.Search.DocumentSources\r\n{\r\n    internal class IndexUpdateActionContainer : IDisposable\r\n    {\r\n        private List<Action> _actions;\r\n\r\n        public void Add(Action action)\r\n        {\r\n            if (_actions == null) _actions = new List<Action>();\r\n\r\n            _actions.Add(action);\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n            if (_actions == null) return;\r\n\r\n            foreach (var action in _actions)\r\n            {\r\n                action();\r\n            }\r\n#if LeakCheck\r\n            GC.SuppressFinalize(this);\r\n#endif\r\n        }\r\n\r\n#if LeakCheck\r\n        private string stack = Environment.StackTrace;\r\n        /// <exclude />\r\n        ~IndexUpdateActionContainer()\r\n        {\r\n            Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);\r\n        }\r\n#endif\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/DocumentSources/MediaLibraryDocumentSource.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Core;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Search.Crawling;\r\n\r\nnamespace Composite.Search.DocumentSources\r\n{\r\n    internal class MediaLibraryDocumentSource : ISearchDocumentSource\r\n    {\r\n        private readonly List<IDocumentSourceListener> _listeners = new List<IDocumentSourceListener>();\r\n\r\n        private readonly Lazy<IReadOnlyCollection<DocumentField>> _customFields;\r\n        private readonly DataChangesIndexNotifier _changesIndexNotifier;\r\n        private readonly IEnumerable<ISearchDocumentBuilderExtension> _docBuilderExtensions;\r\n\r\n        public MediaLibraryDocumentSource(IEnumerable<ISearchDocumentBuilderExtension> extensions)\r\n        {\r\n            _customFields = new Lazy<IReadOnlyCollection<DocumentField>>(() =>\r\n                DataTypeSearchReflectionHelper.GetDocumentFields(typeof(IMediaFile)).ToList());\r\n\r\n            _docBuilderExtensions = extensions;\r\n\r\n            _changesIndexNotifier = new DataChangesIndexNotifier(\r\n                _listeners, typeof(IMediaFile),\r\n                (data, culture) => FromMediaFile((IMediaFile)data),\r\n                data => ((IMediaFile)data).Id.ToString());\r\n            _changesIndexNotifier.Start();\r\n        }\r\n\r\n        public string Name => typeof(IMediaFile).FullName;\r\n\r\n        public IReadOnlyCollection<DocumentField> CustomFields => _customFields.Value;\r\n\r\n        public void Subscribe(IDocumentSourceListener sourceListener)\r\n        {\r\n            _listeners.Add(sourceListener);\r\n        }\r\n\r\n        public IEnumerable<DocumentWithContinuationToken> GetSearchDocuments(CultureInfo culture, string continuationToken = null)\r\n        {\r\n            IEnumerable<IMediaFile> mediaFiles;\r\n\r\n            Guid lastMediaFileId = continuationToken == null ? Guid.Empty : new Guid(continuationToken);\r\n\r\n            using (var conn = new DataConnection())\r\n            {\r\n                mediaFiles = conn.Get<IMediaFile>()\r\n                    .Where(m => m.Id.CompareTo(lastMediaFileId) > 0)\r\n                    .OrderBy(m => m.Id)\r\n                    .Evaluate();\r\n            }\r\n\r\n            return mediaFiles.Select(m => new DocumentWithContinuationToken\r\n            {\r\n                Document = FromMediaFile(m),\r\n                ContinuationToken = m.Id.ToString()\r\n            }).Where(doc => doc.Document != null);\r\n        }\r\n\r\n        private SearchDocument FromMediaFile(IMediaFile mediaFile)\r\n        {\r\n            string label = mediaFile.Title;\r\n            if (string.IsNullOrWhiteSpace(label))\r\n            {\r\n                label = mediaFile.FileName;\r\n            }\r\n\r\n            if(string.IsNullOrEmpty(label))\r\n            {\r\n                Log.LogWarning(nameof(MediaLibraryDocumentSource),\r\n                    $\"A media file has neither FileName nor Label fields specified, Id: '{mediaFile.Id}', StoreId: '{mediaFile.StoreId}'.\");\r\n                return null;\r\n            }\r\n\r\n            var docBuilder = new SearchDocumentBuilder(_docBuilderExtensions);\r\n\r\n            docBuilder.SetDataType(typeof(IMediaFile));\r\n            docBuilder.CrawlData(mediaFile);\r\n\r\n            return docBuilder.BuildDocument(Name, mediaFile.Id.ToString(), label, null, mediaFile.GetDataEntityToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/IDocumentSourceListener.cs",
    "content": "﻿using System.Globalization;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// Listener to the <see cref=\"Composite.Search.DocumentSources\"/> changes.\r\n    /// </summary>\r\n    public interface IDocumentSourceListener\r\n    {\r\n        /// <summary>\r\n        /// Creates a search document.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        /// <param name=\"document\"></param>\r\n        void Create(CultureInfo cultureInfo, SearchDocument document);\r\n\r\n        /// <summary>\r\n        /// Updates the given document in the search collection.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\">The culture.</param>\r\n        /// <param name=\"document\"></param>\r\n        void Update(CultureInfo cultureInfo, SearchDocument document);\r\n\r\n        /// <summary>\r\n        /// Deletes a search document from collection.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\">The culture.</param>\r\n        /// <param name=\"documentId\">The id of the document to be deleted.</param>\r\n        void Delete(CultureInfo cultureInfo, string documentId);\r\n\r\n        /// <summary>\r\n        /// Requests rebuilding all of the document for the specified source\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\">The culture.</param>\r\n        /// <param name=\"source\">The document source name.</param>\r\n        void Rebuild(CultureInfo cultureInfo, string source);\r\n    }\r\n}"
  },
  {
    "path": "Composite/Search/ISearchDocumentSource.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Globalization;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// Represents a search document source (f.e. cms pages, media, etc.)\r\n    /// </summary>\r\n    public interface ISearchDocumentSource\r\n    {\r\n        /// <summary>\r\n        /// The name of the document source.\r\n        /// </summary>\r\n        string Name { get; }\r\n\r\n        /// <summary>\r\n        /// Returns search documents along with continuation tokens, so the indexing can be \r\n        /// can be continued after website restart.\r\n        /// </summary>\r\n        /// <param name=\"culture\">The culture for which the documents should be build.</param>\r\n        /// <param name=\"continuationToken\">Continuation token - contains pointer to the last \r\n        /// already indexed search documents, so the method will return all the following ones.</param>\r\n        /// <returns></returns>\r\n        IEnumerable<DocumentWithContinuationToken> GetSearchDocuments(\r\n            CultureInfo culture,\r\n            string continuationToken = null);\r\n\r\n        /// <summary>\r\n        /// Gets the custom fields.\r\n        /// </summary>\r\n        IReadOnlyCollection<DocumentField> CustomFields { get; }\r\n\r\n        /// <summary>\r\n        /// Subscribes the given search document sourceListener to the source.\r\n        /// </summary>\r\n        /// <param name=\"sourceListener\"></param>\r\n        void Subscribe(IDocumentSourceListener sourceListener);\r\n    }\r\n\r\n    /// <summary>\r\n    /// Represents a tuple of a document and a continuation token\r\n    /// </summary>\r\n    public sealed class DocumentWithContinuationToken\r\n    {\r\n        /// <summary>\r\n        /// The current document.\r\n        /// </summary>\r\n        public SearchDocument Document { get; set; }\r\n        \r\n        /// <summary>\r\n        /// The continuation token for the document source.\r\n        /// </summary>\r\n        public string ContinuationToken { get; set; }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/ISearchDocumentSourceProvider.cs",
    "content": "﻿using System.Collections.Generic;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// Provides an enumeration of <see cref=\"ISearchDocumentSource\"/>.\r\n    /// </summary>\r\n    public interface ISearchDocumentSourceProvider\r\n    {\r\n        /// <summary>\r\n        /// Provides an enumeration of <see cref=\"ISearchDocumentSource\"/>.\r\n        /// </summary>\r\n        IEnumerable<ISearchDocumentSource> GetDocumentSources();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/ISearchIndexUpdater.cs",
    "content": "﻿using System.Globalization;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// An interface for updating a search index.\r\n    /// </summary>\r\n    public interface ISearchIndexUpdater\r\n    {\r\n        /// <summary>\r\n        /// Rebuilds the index.\r\n        /// </summary>\r\n        void Rebuild();\r\n\r\n        /// <summary>\r\n        /// Rebuilds search data for the given data source.\r\n        /// </summary>\r\n        /// <param name=\"searchDocumentSource\"></param>\r\n        void Populate(string searchDocumentSource);\r\n\r\n        /// <summary>\r\n        /// Removes search documents received from the given data source.\r\n        /// </summary>\r\n        /// <param name=\"searchDocumentSource\"></param>\r\n        void Remove(string searchDocumentSource);\r\n\r\n        /// <summary>\r\n        /// Creates a search document collection for the given culture.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        void CreateCollection(CultureInfo cultureInfo);\r\n        \r\n        /// <summary>\r\n        /// Drops the document collection created for the given culture.\r\n        /// </summary>\r\n        /// <param name=\"cultureInfo\"></param>\r\n        void DropCollection(CultureInfo cultureInfo);\r\n\r\n        /// <summary>\r\n        /// Notifies the search updater that no updates should be processed until a website restart.\r\n        /// </summary>\r\n        void StopProcessingUpdates();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/ISearchProvider.cs",
    "content": "﻿using System.Threading.Tasks;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// A search provider.\r\n    /// </summary>\r\n    public interface ISearchProvider\r\n    {\r\n        /// <summary>\r\n        /// Executes the given search query asynchronously.\r\n        /// </summary>\r\n        /// <param name=\"query\">The search query.</param>\r\n        /// <returns></returns>\r\n        Task<SearchResult> SearchAsync(SearchQuery query);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/SearchDocument.cs",
    "content": "using System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// Represents a console document to be indexed and searched for.\r\n    /// </summary>\r\n    public sealed class SearchDocument\r\n    {\r\n        /// <summary>\r\n        /// To be used for deserialization.\r\n        /// </summary>\r\n        public SearchDocument()\r\n        {\r\n            \r\n        }\r\n\r\n        /// <summary>\r\n        /// Constructs a new search document.\r\n        /// </summary>\r\n        /// <param name=\"source\">The data source name.</param>\r\n        /// <param name=\"id\">An id to update the document later on.</param>\r\n        /// <param name=\"label\">A text to be shown in search results.</param>\r\n        /// <param name=\"serializedEntityToken\">The serialized entity token, will be used to locate the found document in the \r\n        /// console tree structure.</param>\r\n        public SearchDocument(string source, string id, string label, string serializedEntityToken)\r\n        {\r\n            Verify.ArgumentNotNull(source, nameof(source));\r\n            Verify.ArgumentNotNull(id, nameof(id));\r\n            Verify.ArgumentNotNull(label, nameof(label));\r\n            Verify.ArgumentNotNull(serializedEntityToken, nameof(serializedEntityToken));\r\n\r\n            Source = source;\r\n            Id = id;\r\n            Label = label;\r\n            SerializedEntityToken = serializedEntityToken;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Constructs a new search document.\r\n        /// </summary>\r\n        /// <param name=\"source\">The data source name.</param>\r\n        /// <param name=\"id\">An id to update the document later on.</param>\r\n        /// <param name=\"label\">A text to be shown in search results.</param>\r\n        /// <param name=\"entityToken\">The entity token, will be used to locate the found document in the \r\n        /// console tree structure.</param>\r\n        public SearchDocument(string source, string id, string label, EntityToken entityToken)\r\n            : this(source, id, label, \"\")\r\n        {\r\n            Verify.ArgumentNotNull(entityToken, nameof(entityToken));\r\n\r\n            SerializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);\r\n        }\r\n\r\n        /// <summary>\r\n        /// A unique identifier for the document.\r\n        /// </summary>\r\n        public string Id { get; set; }\r\n\r\n        /// <summary>\r\n        /// Document source name.\r\n        /// </summary>\r\n        public string Source { get; set; }\r\n\r\n        /// <summary>\r\n        /// Element label, to be shown in search results as well as searched for.\r\n        /// </summary>\r\n        public string Label { get; set; }\r\n\r\n        /// <summary>\r\n        /// Element bundle name, to be shown in search results as well as searched for.\r\n        /// </summary>\r\n        public string ElementBundleName { get; set; }\r\n\r\n        /// <summary>\r\n        /// A serialized entity token of an console tree element that's related to the document\r\n        /// </summary>\r\n        public string SerializedEntityToken { get; set; }\r\n\r\n        /// <summary>\r\n        /// Url, to be shown in search results as well as searched for.\r\n        /// </summary>\r\n        public string Url { get; set; }\r\n\r\n        /// <summary>\r\n        /// Contains all the text string that should be indexed.\r\n        /// </summary>\r\n        public IEnumerable<string> FullText { get; set; }\r\n\r\n        /// <summary>\r\n        /// Field values that is preserved in the index and will appear in the search results.\r\n        /// </summary>\r\n        public IDictionary<string, object> FieldValues { get; set; }\r\n\r\n        /// <summary>\r\n        /// Field values that is preserved in the index and will be used in faceted search.\r\n        /// </summary>\r\n        public IDictionary<string, string[]> FacetFieldValues { get; set; }\r\n\r\n        /// <summary>\r\n        /// A factor by which a search document should be boosted index time.\r\n        /// </summary>\r\n        public float Boost { get; set; } = 1;\r\n    }\r\n}"
  },
  {
    "path": "Composite/Search/SearchFacade.cs",
    "content": "﻿using System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Threading.Tasks;\r\nusing Composite.Search.DocumentSources;\r\nusing Composite.Core;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// Console search functionality\r\n    /// </summary>\r\n    public static class SearchFacade\r\n    {\r\n        /// <summary>\r\n        /// Gets the document sources\r\n        /// </summary>\r\n        public static IEnumerable<ISearchDocumentSource> DocumentSources =>\r\n            ServiceLocator.GetServices<ISearchDocumentSourceProvider>()\r\n                .SelectMany(sp => sp.GetDocumentSources());\r\n\r\n        /// <summary>\r\n        /// Gets or sets the search provider\r\n        /// </summary>\r\n        public static ISearchProvider SearchProvider\r\n            => ServiceLocator.GetService<ISearchProvider>();\r\n\r\n        /// <summary>\r\n        /// Indicates whether search functionality is enabled\r\n        /// </summary>\r\n        public static bool SearchEnabled => SearchProvider != null;\r\n\r\n        /// <summary>\r\n        /// Executes a search query\r\n        /// </summary>\r\n        /// <param name=\"query\"></param>\r\n        /// <returns></returns>\r\n        public static async Task<SearchResult> SearchConsoleAsync(\r\n            SearchQuery query)\r\n        {\r\n            if (!SearchEnabled)\r\n            {\r\n                return SearchResult.Empty;\r\n            }\r\n\r\n            return await SearchProvider.SearchAsync(query);\r\n        }\r\n\r\n        internal static void AddDefaultSearchDocumentSourceProviders(this IServiceCollection services)\r\n        {\r\n            services.AddSingleton<CmsPageDocumentSource>();\r\n            services.AddSingleton<MediaLibraryDocumentSource>();\r\n\r\n            services.Add(new ServiceDescriptor(\r\n                typeof(ISearchDocumentSourceProvider), \r\n                typeof(BuiltInTypesDocumentSourceProvider), \r\n                ServiceLifetime.Singleton));\r\n\r\n            services.Add(new ServiceDescriptor(\r\n                typeof(ISearchDocumentSourceProvider),\r\n                typeof(DataTypesDocumentSourceProvider),\r\n                ServiceLifetime.Singleton));\r\n\r\n            services.AddScoped<IndexUpdateActionContainer>();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/SearchQuery.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.Search.Crawling;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Threading;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// Defines how multiple selected values should be resolved (should all or them much the document or any)\r\n    /// </summary>\r\n    public enum SearchQuerySelectionOperation\r\n    {\r\n        /// <summary>\r\n        /// The result documents should have at least one of the given values.\r\n        /// </summary>\r\n        Or = 0,\r\n        /// <summary>\r\n        /// The result documents should have all of the given values.\r\n        /// </summary>\r\n        And = 1\r\n    }\r\n\r\n    /// <summary>\r\n    /// Allows filtering search results by defining the needed facet values.\r\n    /// </summary>\r\n    public class SearchQuerySelection\r\n    {\r\n        /// <summary>\r\n        /// The name of the field.\r\n        /// </summary>\r\n        public string FieldName { get; set; }\r\n\r\n        /// <summary>\r\n        /// The array of values that are required to appear in the search documents.\r\n        /// </summary>\r\n        public string[] Values { get; set; }\r\n\r\n        /// <summary>\r\n        /// Defines how multiple selected values should be resolved.\r\n        /// </summary>\r\n        public SearchQuerySelectionOperation Operation { get; set; }\r\n\r\n        /// <summary>\r\n        /// The array of field values, documents containing which, should not appear in the results.\r\n        /// </summary>\r\n        public string[] NotValues { get; set; }\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// Represents a sort option for the a search query.\r\n    /// </summary>\r\n    public class SearchQuerySortOption\r\n    {\r\n        /// <summary>\r\n        /// Constructs a new instance of <see cref=\"SearchQuerySortOption\"/>.\r\n        /// </summary>\r\n        /// <param name=\"fieldName\"></param>\r\n        /// <param name=\"reverseOrder\"></param>\r\n        /// <param name=\"sortTermsAs\"></param>\r\n        public SearchQuerySortOption(string fieldName, bool reverseOrder, SortTermsAs sortTermsAs = SortTermsAs.String)\r\n        {\r\n            FieldName = fieldName;\r\n            ReverseOrder = reverseOrder;\r\n            SortTermsAs = sortTermsAs;\r\n        }\r\n\r\n        /// <summary>\r\n        /// A field name to sort results by\r\n        /// </summary>\r\n        public string FieldName { get; }\r\n\r\n        /// <summary>\r\n        /// Indicates whether the results should appear in an order reverse to the way it is kept in the index.\r\n        /// </summary>\r\n        public bool ReverseOrder { get; }\r\n\r\n        /// <summary>\r\n        /// Defines how the field values are interpreted during sorting of the search results.\r\n        /// </summary>\r\n        public SortTermsAs SortTermsAs { get; set; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Search query hightlight settings.\r\n    /// </summary>\r\n    public sealed class SearchQueryHighlightSettings\r\n    {\r\n        /// <summary>\r\n        /// When set to <value>true</value>, highlihts will be included in the search results.\r\n        /// </summary>\r\n        public bool Enabled { get; set; }\r\n\r\n        /// <summary>\r\n        /// Maximum amount of highlight fragments.\r\n        /// </summary>\r\n        public int FragmentsCount { get; set; } = 1;\r\n\r\n        /// <summary>\r\n        /// Maximum fragment size. The default is 100 characters.\r\n        /// </summary>\r\n        public int FragmentSize { get; set; } = 100;\r\n\r\n        /// <summary>\r\n        /// Maximum amount of the full text field characters to be analyzed when extracting fragments to highlight.\r\n        /// The default value is 51200.\r\n        /// </summary>\r\n        public int MaxAnalyzedChars { get; set; } = 51200;\r\n    }\r\n\r\n\r\n    /// <summary>\r\n    /// A search query.\r\n    /// </summary>\r\n    public sealed class SearchQuery\r\n    {\r\n        /// <summary>\r\n        /// Constructs a search query.\r\n        /// </summary>\r\n        public SearchQuery(string query, CultureInfo cultureInfo)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(query, nameof(query));\r\n            Verify.ArgumentNotNull(cultureInfo, nameof(cultureInfo));\r\n\r\n            Query = query;\r\n            CultureInfo = cultureInfo;\r\n            MaxDocumentsNumber = 100;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Filters search results by data types.\r\n        /// </summary>\r\n        /// <param name=\"dataTypes\"></param>\r\n        public void FilterByDataTypes(params Type[] dataTypes)\r\n        {\r\n            Verify.ArgumentNotNull(dataTypes, nameof(dataTypes));\r\n\r\n            Selection.Add(new SearchQuerySelection\r\n            {\r\n                FieldName = DocumentFieldNames.DataType,\r\n                Operation = SearchQuerySelectionOperation.Or,\r\n                Values = dataTypes.Select(type => type.GetImmutableTypeId().ToString()).ToArray()\r\n            });\r\n        }\r\n\r\n        /// <summary>\r\n        /// Filters search results by page types.\r\n        /// </summary>\r\n        /// <param name=\"pageTypes\"></param>\r\n        public void FilterByPageTypes(params string[] pageTypes)\r\n        {\r\n            Verify.ArgumentNotNull(pageTypes, nameof(pageTypes));\r\n\r\n            Selection.Add(new SearchQuerySelection\r\n            {\r\n                FieldName = DocumentFieldNames.GetFieldName(typeof(IPage), nameof(IPage.PageTypeId)),\r\n                Operation = SearchQuerySelectionOperation.Or,\r\n                Values = pageTypes\r\n            });\r\n        }\r\n\r\n        /// <summary>\r\n        /// Only documents that have the <see cref=\"SearchDocument.Url\"/> property set should be returned.\r\n        /// </summary>\r\n        public void ShowOnlyDocumentsWithUrls()\r\n        {\r\n            Selection.Add(new SearchQuerySelection\r\n            {\r\n                FieldName = DocumentFieldNames.HasUrl,\r\n                Values = new [] {\"1\"}\r\n            });\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Filters the results, so only entity tokens that have at least one of the given entity tokens\r\n        /// as an ancestor, will be returned. This enables searching for the child elements in the console\r\n        /// and searching for data that belongs to a specific website on frontend.\r\n        /// </summary>\r\n        public void FilterByAncestors(params EntityToken[] entityTokens)\r\n        {\r\n            Selection.Add(new SearchQuerySelection\r\n            {\r\n                FieldName = DocumentFieldNames.Ancestors,\r\n                Operation = SearchQuerySelectionOperation.Or,\r\n                Values = entityTokens.Select(SearchDocumentBuilder.GetEntityTokenHash).ToArray()\r\n            });\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Filtering search results to which the given user does not have read access permission.\r\n        /// </summary>\r\n        /// <param name=\"userName\"></param>\r\n        public void FilterByUser(string userName)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(userName, nameof(userName));\r\n\r\n            var tokens = new List<string> {userName};\r\n\r\n            using (ThreadDataManager.EnsureInitialize())\r\n            {\r\n                tokens.AddRange(UserGroupFacade.GetUserGroupIds(userName).Select(id => id.ToString()));\r\n            }\r\n\r\n            Selection.Add(new SearchQuerySelection\r\n            {\r\n                FieldName = DocumentFieldNames.ConsoleAccess,\r\n                Operation = SearchQuerySelectionOperation.Or,\r\n                Values = tokens.ToArray()\r\n            });\r\n        }\r\n\r\n        /// <summary>\r\n        /// The query text\r\n        /// </summary>\r\n        public string Query { get; }\r\n\r\n        /// <summary>\r\n        /// The culture in which the search is performed\r\n        /// </summary>\r\n        public CultureInfo CultureInfo { get; }\r\n\r\n        /// <summary>\r\n        /// To be used for pagination - number for the first page from the result set to be returned.\r\n        /// </summary>\r\n        public int SearchResultOffset { get; set; }\r\n\r\n        /// <summary>\r\n        /// Maximum amount of documents returned.\r\n        /// </summary>\r\n        public int MaxDocumentsNumber { get; set; }\r\n\r\n        /// <summary>\r\n        /// Facets to be returned.\r\n        /// </summary>\r\n        public ICollection<KeyValuePair<string, DocumentFieldFacet>> Facets { get; set; } \r\n            = new List<KeyValuePair<string, DocumentFieldFacet>>();\r\n\r\n        /// <summary>\r\n        /// To be used to filter results by facet field values.\r\n        /// </summary>\r\n        public ICollection<SearchQuerySelection> Selection { get; set; } = new List<SearchQuerySelection>();\r\n\r\n        /// <summary>\r\n        /// Sort options.\r\n        /// </summary>\r\n        public IEnumerable<SearchQuerySortOption> SortOptions { get; set; }\r\n\r\n        /// <summary>\r\n        /// Highlight settings.\r\n        /// </summary>\r\n        public SearchQueryHighlightSettings HighlightSettings { get; set; } = new SearchQueryHighlightSettings();\r\n\r\n        /// <summary>\r\n        /// Gets or sets a flag indicating whether to set an explanation to the <see cref=\"SearchResultItem\"/>.\r\n        /// An explanation describes the score computation for document and query.\r\n        /// </summary>\r\n        public bool ShowExplanation { get; set; }\r\n\r\n        /// <summary>\r\n        /// Will indicate that the search results should return facet information for the given field.\r\n        /// </summary>\r\n        /// <param name=\"fieldName\"></param>\r\n        public void AddFieldFacet(string fieldName)\r\n        {\r\n            AddFieldFacet(fieldName, null, null);\r\n        }\r\n\r\n\r\n        /// <summary>\r\n        /// Will indicate that the search results should return facet information for the given field.\r\n        /// </summary>\r\n        /// <param name=\"fieldName\"></param>\r\n        /// <param name=\"values\">The array of values that are required to appear in the search documents.</param>\r\n        /// <param name=\"notValues\">The array of values that are required not to appear in the search documents.</param>\r\n        public void AddFieldFacet(string fieldName, string[] values, string[] notValues)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(fieldName, nameof(fieldName));\r\n\r\n            if (Facets.Any(f => f.Key == fieldName))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var field = SearchDocumentBuilder.GetDefaultDocumentFields()\r\n                .FirstOrDefault(f => f.Name == fieldName);\r\n\r\n            if (field == null)\r\n            {\r\n                field = SearchFacade.DocumentSources.SelectMany(f => f.CustomFields)\r\n                    .FirstOrDefault(f => f.Name == fieldName);\r\n\r\n                Verify.IsNotNull(field, $\"Failed to find a document field by name '{fieldName}'\");\r\n            }\r\n\r\n            Verify.IsNotNull(field.Facet, $\"Faceted search is not enabled for the field '{fieldName}'\");\r\n\r\n            Facets.Add(new KeyValuePair<string, DocumentFieldFacet>(\r\n                    fieldName,\r\n                    field.Facet));\r\n\r\n            if ((values != null && values.Length > 0) \r\n                || (notValues != null && notValues.Length > 0))\r\n            {\r\n                Selection.Add(new SearchQuerySelection\r\n                {\r\n                    FieldName = fieldName,\r\n                    Values = values,\r\n                    NotValues = notValues,\r\n                    Operation = field.Facet.FacetType == FacetType.SingleValue \r\n                    ? SearchQuerySelectionOperation.Or\r\n                    : SearchQuerySelectionOperation.And\r\n                });\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Search/SearchResult.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace Composite.Search\r\n{\r\n    /// <summary>\r\n    /// Information about a search facet.\r\n    /// </summary>\r\n    public class Facet\r\n    {\r\n        /// <summary>\r\n        /// The field value.\r\n        /// </summary>\r\n        public string Value { get; set; }\r\n\r\n        /// <summary>\r\n        /// Amount of document found for the given value.\r\n        /// </summary>\r\n        public int HitCount { get; set; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Represents a search result item, which consists of the document as well as highlighted matched terms.\r\n    /// </summary>\r\n    public sealed class SearchResultItem\r\n    {\r\n        /// <summary>\r\n        /// Gets the underlying search document.\r\n        /// </summary>\r\n        public SearchDocument Document { get; set; }\r\n\r\n        /// <summary>\r\n        /// Returns the label of the documents with highlighted matched terms.\r\n        /// </summary>\r\n        public string LabelHtmlHighlight { get; set; }\r\n\r\n        /// <summary>\r\n        /// Returns text fragments of the full text field with highlighted matched terms.\r\n        /// </summary>\r\n        public string[] FullTextHtmlHighlights { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the score.\r\n        /// </summary>\r\n        public float Score { get; set; }\r\n\r\n        /// <summary>\r\n        /// Gets or sets the explanation summary. This will be set if the <see cref=\"P:SearchQuery.ShowExplanation\" /> property is set to <value>true</value>.\r\n        /// An explanation describes the score computation for document and query.\r\n        /// </summary>\r\n        public string ExplanationSummary { get; set; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Search result.\r\n    /// </summary>\r\n    public sealed class SearchResult\r\n    {\r\n        /// <summary>\r\n        /// Found documents.\r\n        /// </summary>\r\n        public IEnumerable<SearchResultItem> Items { get; set; }\r\n\r\n        /// <summary>\r\n        /// Total documents found.\r\n        /// </summary>\r\n        public int TotalHits { get; set; }\r\n\r\n        /// <summary>\r\n        /// Found facet values.\r\n        /// </summary>\r\n        public IDictionary<string, Facet[]> Facets { get; set; }\r\n\r\n        /// <exclude />\r\n        public static SearchResult Empty => new SearchResult { Items = Enumerable.Empty<SearchResultItem>() };\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite/Verify.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing JetBrains.Annotations;\r\n\r\n\r\nnamespace Composite\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\r\n    public static class Verify\r\n    {\r\n        /// <summary>\r\n        /// Asserts that argument value is not null\r\n        /// </summary>\r\n        /// <param name=\"value\">The argument's value.</param>\r\n        /// <param name=\"paramName\">The parameter's name.</param>\r\n        /// <exception cref=\"ArgumentNullException\"></exception>\r\n        [AssertionMethod]\r\n        public static void ArgumentNotNull([AssertionConditionAttribute(AssertionConditionType.IS_NOT_NULL)] object value, string paramName)\r\n        {\r\n            if (value == null)\r\n            {\r\n                ThrowArgumentNullException(paramName);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Asserts that argument value is not null or emptry\r\n        /// </summary>\r\n        /// <param name=\"value\">The argument's value.</param>\r\n        /// <param name=\"paramName\">The parameter's name.</param>\r\n        /// <exception cref=\"ArgumentNullException\"></exception>\r\n        /// <exception cref=\"ArgumentException\"></exception>\r\n        [AssertionMethod]\r\n        public static void ArgumentNotNullOrEmpty([AssertionConditionAttribute(AssertionConditionType.IS_NOT_NULL)] string value, string paramName)\r\n        {\r\n            if (string.IsNullOrEmpty(value))\r\n            {\r\n                if (value == null)\r\n                {\r\n                    ThrowArgumentNullException(paramName);\r\n                }\r\n                ThrowArgumentException(\"Value cannot be String.Empty\", paramName);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Checks a condition.\r\n        /// </summary>\r\n        /// <param name=\"condition\">A condition to check.</param>\r\n        /// <param name=\"paramName\">Parameter name.</param>\r\n        /// <param name=\"message\">The message.</param>\r\n        /// <exception cref=\"ArgumentException\"></exception>\r\n        [AssertionMethod]\r\n        public static void ArgumentCondition([AssertionConditionAttribute(AssertionConditionType.IS_TRUE)] bool condition, string paramName, string message)\r\n        {\r\n            if (!condition)\r\n            {\r\n                ThrowArgumentException(message, paramName);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// If condition isn't true, throws an <see cref=\"InvalidOperationException\"/> exception.\r\n        /// </summary>\r\n        /// <param name=\"condition\"></param>\r\n        /// <param name=\"message\"></param>\r\n        /// <exception cref=\"InvalidOperationException\"></exception>\r\n        [AssertionMethod]\r\n        public static void IsTrue([AssertionConditionAttribute(AssertionConditionType.IS_TRUE)] bool condition, string message)\r\n        {\r\n            if (!condition)\r\n            {\r\n                ThrowInvalidOperationException(message);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// If condition is true, throws an <see cref=\"InvalidOperationException\"/> exception.\r\n        /// </summary>\r\n        /// <param name=\"condition\"></param>\r\n        /// <param name=\"message\"></param>\r\n        /// <exception cref=\"InvalidOperationException\"></exception>\r\n        [AssertionMethod]\r\n        public static void IsFalse([AssertionConditionAttribute(AssertionConditionType.IS_FALSE)] bool condition, string message)\r\n        {\r\n            if (condition)\r\n            {\r\n                ThrowInvalidOperationException(message);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// If condition isn't true, throws an <see cref=\"InvalidOperationException\"/> exception.\r\n        /// </summary>\r\n        /// <param name=\"condition\"></param>\r\n        /// <param name=\"message\"></param>\r\n        /// <param name=\"formatArgs\">Parameters for string.Format method.</param> \r\n        /// <exception cref=\"InvalidOperationException\"></exception>\r\n        [AssertionMethod]\r\n        [StringFormatMethod(\"message\")]\r\n        public static void That([AssertionConditionAttribute(AssertionConditionType.IS_TRUE)] bool condition, string message, params object[] formatArgs)\r\n        {\r\n            if (!condition)\r\n            {\r\n                ThrowInvalidOperationException(message, formatArgs);\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        /// Checks that the value is null.\r\n        /// </summary>\r\n        /// <param name=\"value\">The value.</param>\r\n        /// <param name=\"message\">The message to be an exception desctiption.</param>\r\n        /// <exception cref=\"InvalidOperationException\"></exception>\r\n        [AssertionMethod]\r\n        public static void IsNull([AssertionConditionAttribute(AssertionConditionType.IS_NULL)] object value, string message)\r\n        {\r\n            if (value != null)\r\n                ThrowInvalidOperationException(message);\r\n        }\r\n        /// <summary>\r\n        /// Checks that the value is not null.\r\n        /// </summary>\r\n        /// <param name=\"value\">The value.</param>\r\n        /// <param name=\"message\">The message to be an exception desctiption.</param>\r\n        /// <exception cref=\"InvalidOperationException\"></exception>\r\n        [AssertionMethod]\r\n        public static void IsNotNull([AssertionConditionAttribute(AssertionConditionType.IS_NOT_NULL)] object value, [NotNull] string message)\r\n        {\r\n            if (value == null)\r\n                ThrowInvalidOperationException(message);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Checks that the value is not null.\r\n        /// </summary>\r\n        /// <param name=\"value\">The value.</param>\r\n        /// <param name=\"message\">The message to be an exception desctiption.</param>\r\n        /// <param name=\"formattingArgs\">Parameters for string.Format() method.</param>\r\n        /// <exception cref=\"InvalidOperationException\"></exception>\r\n        [AssertionMethod]\r\n        [StringFormatMethod(\"message\")]\r\n        public static void IsNotNull([AssertionConditionAttribute(AssertionConditionType.IS_NOT_NULL)] object value, string message, params object[] formattingArgs)\r\n        {\r\n            if (value == null)\r\n                ThrowInvalidOperationException(message, formattingArgs);\r\n        }\r\n\r\n        #region Exception throwing\r\n\r\n        /// <exception cref=\"InvalidOperationException\"></exception>\r\n        public static void ThrowInvalidOperationException(string message)\r\n        {\r\n            throw new InvalidOperationException(message);\r\n        }\r\n\r\n        private static void ThrowInvalidOperationException(string message, object[] formatArguments)\r\n        {\r\n            throw new InvalidOperationException(formatArguments.Length > 0 ? string.Format(message, formatArguments) : message);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Throws an \"ThrowArgumentNullException\" exception.\r\n        /// </summary>\r\n        /// <param name=\"parameterName\">The parameter's name</param>\r\n        /// <exception cref=\"ArgumentNullException\"></exception>\r\n        public static void ThrowArgumentNullException(string parameterName)\r\n        {\r\n            throw new ArgumentNullException(parameterName);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Throws an \"ThrowArgumentNullException\" exception.\r\n        /// </summary>\r\n        /// <param name=\"parameterName\">The parameter's name</param>\r\n        /// <param name=\"message\">The message.</param>\r\n        /// <exception cref=\"ArgumentNullException\"></exception>\r\n        public static void ThrowArgumentException(string message, string parameterName)\r\n        {\r\n            throw new ArgumentException(message, parameterName);\r\n        }\r\n\r\n        /// <exclude />\r\n        public static T ResultNotNull<T>(T value) where T : class\r\n        {\r\n            return ResultNotNull(value, \"Result value should not be null\");\r\n        }\r\n\r\n        /// <exclude />\r\n        [StringFormatMethod(\"errorMessageOnNull\")]\r\n        public static T ResultNotNull<T>(T value, string errorMessageOnNull, params object[] formattingArgs) where T : class\r\n        {\r\n            if (value == null) ThrowInvalidOperationException(errorMessageOnNull.FormatWith(formattingArgs));\r\n            return value;\r\n        }\r\n\r\n        /// <exclude />\r\n        [AssertionMethod]\r\n        public static string StringNotIsNullOrWhiteSpace([AssertionConditionAttribute(AssertionConditionType.IS_NOT_NULL)] string value)\r\n        {\r\n            return StringNotIsNullOrWhiteSpace(value, \"Result string should not be null or empty\");\r\n        }\r\n\r\n        /// <exclude />\r\n        [AssertionMethod]\r\n        [StringFormatMethod(\"errorMessageOnNull\")]\r\n        public static string StringNotIsNullOrWhiteSpace([AssertionConditionAttribute(AssertionConditionType.IS_NOT_NULL)] string value, string errorMessageOnNull, params object[] formattingArgs)\r\n        {\r\n            if (String.IsNullOrWhiteSpace(value)) ThrowInvalidOperationException(errorMessageOnNull.FormatWith(formattingArgs));\r\n            return value;\r\n        }\r\n\r\n        #endregion Exception throwing\r\n    }\r\n}\r\n\r\n#region JetBrains Annotations\r\n\r\nnamespace JetBrains.Annotations\r\n{\r\n    /// <summary>\r\n    /// Indicates that marked element should be localized or not.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class LocalizationRequiredAttribute : Attribute\r\n    {\r\n        /// <summary>\r\n        /// Initializes a new instance of the <see cref=\"LocalizationRequiredAttribute\"/> class.\r\n        /// </summary>\r\n        /// <param name=\"required\"><c>true</c> if a element should be localized; otherwise, <c>false</c>.</param>\r\n        public LocalizationRequiredAttribute(bool required)\r\n        {\r\n            Required = required;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets a value indicating whether a element should be localized.\r\n        /// <value><c>true</c> if a element should be localized; otherwise, <c>false</c>.</value>\r\n        /// </summary>\r\n        public bool Required { get; set; }\r\n\r\n        /// <summary>\r\n        /// Returns whether the value of the given object is equal to the current <see cref=\"LocalizationRequiredAttribute\"/>.\r\n        /// </summary>\r\n        /// <param name=\"obj\">The object to test the value equality of. </param>\r\n        /// <returns>\r\n        /// <c>true</c> if the value of the given object is equal to that of the current; otherwise, <c>false</c>.\r\n        /// </returns>\r\n        public override bool Equals(object obj)\r\n        {\r\n            var attribute = obj as LocalizationRequiredAttribute;\r\n            return attribute != null && attribute.Required == Required;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Returns the hash code for this instance.\r\n        /// </summary>\r\n        /// <returns>A hash code for the current <see cref=\"LocalizationRequiredAttribute\"/>.</returns>\r\n        public override int GetHashCode()\r\n        {\r\n            return base.GetHashCode();\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that marked method builds string by format pattern and (optional) arguments. \r\n    /// Parameter, which contains format string, should be given in constructor.\r\n    /// The format string should be in <see cref=\"string.Format(IFormatProvider,string,object[])\"/> -like form\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class StringFormatMethodAttribute : Attribute\r\n    {\r\n        private readonly string myFormatParameterName;\r\n\r\n        /// <summary>\r\n        /// Initializes new instance of StringFormatMethodAttribute\r\n        /// </summary>\r\n        /// <param name=\"formatParameterName\">Specifies which parameter of an annotated method should be treated as format-string</param>\r\n        public StringFormatMethodAttribute(string formatParameterName)\r\n        {\r\n            myFormatParameterName = formatParameterName;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets format parameter name\r\n        /// </summary>\r\n        public string FormatParameterName\r\n        {\r\n            get { return myFormatParameterName; }\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that the function argument should be string literal and match one  of the parameters of the caller function.\r\n    /// For example, <see cref=\"ArgumentNullException\"/> has such parameter.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class InvokerParameterNameAttribute : Attribute\r\n    {\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that the marked method is assertion method, i.e. it halts control flow if one of the conditions is satisfied. \r\n    /// To set the condition, mark one of the parameters with <see cref=\"AssertionConditionAttribute\"/> attribute\r\n    /// </summary>\r\n    /// <seealso cref=\"AssertionConditionAttribute\"/>\r\n    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class AssertionMethodAttribute : Attribute\r\n    {\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates the condition parameter of the assertion method. \r\n    /// The method itself should be marked by <see cref=\"AssertionMethodAttribute\"/> attribute.\r\n    /// The mandatory argument of the attribute is the assertion type.\r\n    /// </summary>\r\n    /// <seealso cref=\"AssertionConditionType\"/>\r\n    [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class AssertionConditionAttribute : Attribute\r\n    {\r\n        private readonly AssertionConditionType myConditionType;\r\n\r\n        /// <summary>\r\n        /// Initializes new instance of AssertionConditionAttribute\r\n        /// </summary>\r\n        /// <param name=\"conditionType\">Specifies condition type</param>\r\n        public AssertionConditionAttribute(AssertionConditionType conditionType)\r\n        {\r\n            myConditionType = conditionType;\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets condition type\r\n        /// </summary>\r\n        public AssertionConditionType ConditionType\r\n        {\r\n            get { return myConditionType; }\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Specifies assertion type. If the assertion method argument satisifes the condition, then the execution continues. \r\n    /// Otherwise, execution is assumed to be halted\r\n    /// </summary>\r\n    internal enum AssertionConditionType\r\n    {\r\n        /// <summary>\r\n        /// Indicates that the marked parameter should be evaluated to true\r\n        /// </summary>\r\n        IS_TRUE = 0,\r\n\r\n        /// <summary>\r\n        /// Indicates that the marked parameter should be evaluated to false\r\n        /// </summary>\r\n        IS_FALSE = 1,\r\n\r\n        /// <summary>\r\n        /// Indicates that the marked parameter should be evaluated to null value\r\n        /// </summary>\r\n        IS_NULL = 2,\r\n\r\n        /// <summary>\r\n        /// Indicates that the marked parameter should be evaluated to not null value\r\n        /// </summary>\r\n        IS_NOT_NULL = 3,\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that the marked method unconditionally terminates control flow execution.\r\n    /// For example, it could unconditionally throw exception\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class TerminatesProgramAttribute : Attribute\r\n    {\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that the value of marked element could be <c>null</c> sometimes, so the check for <c>null</c> is necessary before its usage\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Delegate | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class CanBeNullAttribute : Attribute\r\n    {\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that the value of marked element could never be <c>null</c>\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Delegate | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class NotNullAttribute : Attribute\r\n    {\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that the value of marked type (or its derivatives) cannot be compared using '==' or '!=' operators.\r\n    /// There is only exception to compare with <c>null</c>, it is permitted\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class CannotApplyEqualityOperatorAttribute : Attribute\r\n    {\r\n    }\r\n\r\n    /// <summary>\r\n    /// When applied to target attribute, specifies a requirement for any type which is marked with \r\n    /// target attribute to implement or inherit specific type or types\r\n    /// </summary>\r\n    /// <example>\r\n    /// <code>\r\n    /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement\r\n    /// public class ComponentAttribute : Attribute \r\n    /// {}\r\n    /// \r\n    /// [Component] // ComponentAttribute requires implementing IComponent interface\r\n    /// public class MyComponent : IComponent\r\n    /// {}\r\n    /// </code>\r\n    /// </example>\r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]\r\n    [BaseTypeRequired(typeof(Attribute))]\r\n    internal sealed class BaseTypeRequiredAttribute : Attribute\r\n    {\r\n        private readonly Type[] myBaseTypes;\r\n\r\n        /// <summary>\r\n        /// Initializes new instance of BaseTypeRequiredAttribute\r\n        /// </summary>\r\n        /// <param name=\"baseType\">Specifies which types are required</param>\r\n        public BaseTypeRequiredAttribute(Type baseType)\r\n        {\r\n            myBaseTypes = new[] { baseType };\r\n        }\r\n\r\n        /// <summary>\r\n        /// Gets enumerations of specified base types\r\n        /// </summary>\r\n        public IEnumerable<Type> BaseTypes\r\n        {\r\n            get { return myBaseTypes; }\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library),\r\n    /// so this symbol will not be marked as unused (as well as by other usage inspections)\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class UsedImplicitlyAttribute : Attribute\r\n    {\r\n        [UsedImplicitly]\r\n        public UsedImplicitlyAttribute()\r\n            : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)\r\n        {\r\n        }\r\n\r\n        [UsedImplicitly]\r\n        public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)\r\n        {\r\n            UseKindFlags = useKindFlags;\r\n            TargetFlags = targetFlags;\r\n        }\r\n\r\n        [UsedImplicitly]\r\n        public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)\r\n            : this(useKindFlags, ImplicitUseTargetFlags.Default)\r\n        {\r\n        }\r\n\r\n        [UsedImplicitly]\r\n        public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)\r\n            : this(ImplicitUseKindFlags.Default, targetFlags)\r\n        {\r\n        }\r\n\r\n        [UsedImplicitly]\r\n        public ImplicitUseKindFlags UseKindFlags { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets value indicating what is meant to be used\r\n        /// </summary>\r\n        [UsedImplicitly]\r\n        public ImplicitUseTargetFlags TargetFlags { get; private set; }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes as unused (as well as by other usage inspections)\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]\r\n    internal sealed class MeansImplicitUseAttribute : Attribute\r\n    {\r\n        [UsedImplicitly]\r\n        public MeansImplicitUseAttribute()\r\n            : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)\r\n        {\r\n        }\r\n\r\n        [UsedImplicitly]\r\n        public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)\r\n        {\r\n            UseKindFlags = useKindFlags;\r\n            TargetFlags = targetFlags;\r\n        }\r\n\r\n        [UsedImplicitly]\r\n        public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)\r\n            : this(useKindFlags, ImplicitUseTargetFlags.Default)\r\n        {\r\n        }\r\n\r\n        [UsedImplicitly]\r\n        public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)\r\n            : this(ImplicitUseKindFlags.Default, targetFlags)\r\n        {\r\n        }\r\n\r\n        [UsedImplicitly]\r\n        public ImplicitUseKindFlags UseKindFlags { get; private set; }\r\n\r\n        /// <summary>\r\n        /// Gets value indicating what is meant to be used\r\n        /// </summary>\r\n        [UsedImplicitly]\r\n        public ImplicitUseTargetFlags TargetFlags { get; private set; }\r\n    }\r\n\r\n    [Flags]\r\n    internal enum ImplicitUseKindFlags\r\n    {\r\n        Default = Access | Assign | InstantiatedWithFixedConstructorSignature,\r\n\r\n        /// <summary>\r\n        /// Only entity marked with attribute considered used\r\n        /// </summary>\r\n        Access = 1,\r\n\r\n        /// <summary>\r\n        /// Indicates implicit assignment to a member\r\n        /// </summary>\r\n        Assign = 2,\r\n\r\n        /// <summary>\r\n        /// Indicates implicit instantiation of a type with fixed constructor signature.\r\n        /// That means any unused constructor parameters won't be reported as such.\r\n        /// </summary>\r\n        InstantiatedWithFixedConstructorSignature = 4,\r\n\r\n        /// <summary>\r\n        /// Indicates implicit instantiation of a type\r\n        /// </summary>\r\n        InstantiatedNoFixedConstructorSignature = 8,\r\n    }\r\n\r\n    /// <summary>\r\n    /// Specify what is considered used implicitly when marked with <see cref=\"MeansImplicitUseAttribute\"/> or <see cref=\"UsedImplicitlyAttribute\"/>\r\n    /// </summary>\r\n    [Flags]\r\n    internal enum ImplicitUseTargetFlags\r\n    {\r\n        Default = Itself,\r\n\r\n        Itself = 1,\r\n\r\n        /// <summary>\r\n        /// Members of entity marked with attribute are considered used\r\n        /// </summary>\r\n        Members = 2,\r\n\r\n        /// <summary>\r\n        /// Entity marked with attribute and all its members considered used\r\n        /// </summary>\r\n        WithMembers = Itself | Members\r\n    }\r\n\r\n    /// <summary>\r\n    /// This attribute is intended to mark publicly available API which should not be removed and so is treated as used.\r\n    /// </summary>\r\n    [MeansImplicitUse]\r\n    internal sealed class PublicAPIAttribute : Attribute\r\n    {\r\n        public PublicAPIAttribute()\r\n        {\r\n        }\r\n\r\n        // ReSharper disable UnusedParameter.Local\r\n        public PublicAPIAttribute(string comment)\r\n        // ReSharper restore UnusedParameter.Local\r\n        {\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. \r\n    /// If the parameter is delegate, indicates that delegate is executed while the method is executed.\r\n    /// If the parameter is enumerable, indicates that it is enumerated while the method is executed.\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Parameter, Inherited = true)]\r\n    internal sealed class InstantHandleAttribute : Attribute\r\n    {\r\n    }\r\n\r\n    /// <summary>\r\n    /// Indicates that method doesn't contain observable side effects.\r\n    /// The same as <see cref=\"System.Diagnostics.Contracts.PureAttribute\"/>\r\n    /// </summary>\r\n    [AttributeUsage(AttributeTargets.Method, Inherited = true)]\r\n    internal sealed class PureAttribute : Attribute { }\r\n}\r\nnamespace JetBrains.Annotations\r\n{\r\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\r\n    internal class PathReferenceAttribute : System.Attribute\r\n    {\r\n        public PathReferenceAttribute() { }\r\n\r\n        public PathReferenceAttribute([PathReference] string basePath)\r\n        {\r\n            BasePath = basePath;\r\n        }\r\n\r\n        public string BasePath { get; private set; }\r\n    }\r\n}\r\nnamespace JetBrains.Annotations\r\n{\r\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\r\n    internal sealed class AspMvcModelTypeAttribute : System.Attribute { }\r\n}\r\nnamespace JetBrains.Annotations\r\n{\r\n    [System.AttributeUsage(System.AttributeTargets.Parameter | System.AttributeTargets.Method)]\r\n    internal sealed class AspMvcControllerAttribute : System.Attribute\r\n    {\r\n        public string AnonymousProperty { get; private set; }\r\n\r\n        public AspMvcControllerAttribute() { }\r\n\r\n        public AspMvcControllerAttribute(string anonymousProperty)\r\n        {\r\n            AnonymousProperty = anonymousProperty;\r\n        }\r\n    }\r\n}\r\nnamespace JetBrains.Annotations\r\n{\r\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\r\n    internal sealed class AspMvcMasterAttribute : System.Attribute\r\n    {\r\n    }\r\n}\r\nnamespace JetBrains.Annotations\r\n{\r\n    [System.AttributeUsage(System.AttributeTargets.Parameter | System.AttributeTargets.Method)]\r\n    internal sealed class AspMvcViewAttribute : PathReferenceAttribute\r\n    {\r\n    }\r\n}\r\nnamespace JetBrains.Annotations\r\n{\r\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\r\n    internal sealed class AspMvcAreaAttribute : PathReferenceAttribute\r\n    {\r\n        public string AnonymousProperty { get; private set; }\r\n\r\n        public AspMvcAreaAttribute() { }\r\n\r\n        public AspMvcAreaAttribute(string anonymousProperty)\r\n        {\r\n            AnonymousProperty = anonymousProperty;\r\n        }\r\n    }\r\n}\r\nnamespace JetBrains.Annotations\r\n{\r\n    [System.AttributeUsage(System.AttributeTargets.Parameter | System.AttributeTargets.Method)]\r\n    internal sealed class AspMvcActionAttribute : System.Attribute\r\n    {\r\n        public string AnonymousProperty { get; private set; }\r\n\r\n        public AspMvcActionAttribute() { }\r\n\r\n        public AspMvcActionAttribute(string anonymousProperty)\r\n        {\r\n            AnonymousProperty = anonymousProperty;\r\n        }\r\n    }\r\n}\r\nnamespace JetBrains.Annotations\r\n{\r\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\r\n    internal sealed class AspMvcTemplateAttribute : System.Attribute\r\n    {\r\n    }\r\n}\r\n\r\n#endregion JetBrains Annotations"
  },
  {
    "path": "Composite/packages.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<packages>\r\n  <package id=\"Castle.Core\" version=\"4.2.1\" targetFramework=\"net471\" />\r\n  <package id=\"Microsoft.AspNet.Razor\" version=\"3.2.3\" targetFramework=\"net45\" />\r\n  <package id=\"Microsoft.AspNet.WebPages\" version=\"3.2.3\" targetFramework=\"net45\" />\r\n  <package id=\"Microsoft.Extensions.DependencyInjection\" version=\"1.1.0\" targetFramework=\"net461\" />\r\n  <package id=\"Microsoft.Extensions.DependencyInjection.Abstractions\" version=\"1.1.0\" targetFramework=\"net461\" />\r\n  <package id=\"Microsoft.Web.Infrastructure\" version=\"1.0.0.0\" targetFramework=\"net45\" />\r\n  <package id=\"Newtonsoft.Json\" version=\"6.0.5\" targetFramework=\"net461\" />\r\n  <package id=\"System.Collections.Immutable\" version=\"1.3.1\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive.Core\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive.Interfaces\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive.Linq\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive.PlatformServices\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive.Windows.Threading\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Threading.Tasks.Dataflow\" version=\"4.7.0\" targetFramework=\"net471\" />\r\n  <package id=\"System.ValueTuple\" version=\"4.4.0\" targetFramework=\"net471\" />\r\n  <package id=\"WampSharp\" version=\"18.3.1\" targetFramework=\"net471\" />\r\n  <package id=\"WampSharp.AspNet.WebSockets.Server\" version=\"18.3.1\" targetFramework=\"net471\" />\r\n  <package id=\"WampSharp.NewtonsoftJson\" version=\"18.3.1\" targetFramework=\"net471\" />\r\n  <package id=\"WampSharp.WebSockets\" version=\"18.3.1\" targetFramework=\"net471\" />\r\n</packages>"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/EntityTokenLockedWorkflow.cs",
    "content": "using System;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Actions.Workflows\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EntityTokenLockedWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EntityTokenLockedWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            EntityTokenLockedEntityToken entityToken = (EntityTokenLockedEntityToken)this.EntityToken;\r\n\r\n            this.Bindings.Add(\"LockedByUsername\", entityToken.LockedByUsername);\r\n            this.Bindings.Add(\"IsSameUser\", entityToken.LockedByUsername == UserValidationFacade.GetUsername());\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            EntityTokenLockedEntityToken entityToken = (EntityTokenLockedEntityToken)this.EntityToken;\r\n\r\n            ActionLockingFacade.RemoveLock(entityToken.LockedEntityToken);\r\n\r\n            this.CloseCurrentView();\r\n\r\n            this.ExecuteAction(entityToken.LockedEntityToken, entityToken.LockedActionToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/EntityTokenLockedWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Actions.Workflows\r\n{\r\n    partial class EntityTokenLockedWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\EntityTokenLockedStep1.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EntityTokenLockedWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EntityTokenLockedWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateActivity finalizeStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/EntityTokenLockedWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EntityTokenLockedWorkflow\" Location=\"30; 30\" Size=\"1176; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EntityTokenLockedWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EntityTokenLockedWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"435\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"511\" Y=\"500\" />\r\n\t\t\t\t<ns0:Point X=\"713\" Y=\"500\" />\r\n\t\t\t\t<ns0:Point X=\"713\" Y=\"617\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"515\" Y=\"524\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"524\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"812\" Y=\"658\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"658\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"308; 435\" Size=\"211; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"316; 466\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"dataDialogFormActivity1\" Location=\"326; 528\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"316; 490\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"326; 552\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"326; 612\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"316; 514\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"326; 576\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"326; 636\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"611; 617\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"619; 648\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"629; 710\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"629; 770\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"629; 830\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/FlowInformationScavengerWorkflow.cs",
    "content": "using System;\r\nusing System.Web.Hosting;\r\nusing Composite.Core.Extensions;\r\nusing System.Workflow.Activities;\r\nusing Composite.Core.Configuration;\r\n\r\n\r\nnamespace Composite.C1Console.Actions.Workflows\r\n{\r\n    public sealed partial class FlowInformationScavengerWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public FlowInformationScavengerWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void OnInitializeTimeout(object sender, EventArgs e)\r\n        {\r\n            (sender as DelayActivity).TimeoutDuration = GlobalSettingsFacade.WorkflowTimeout;\r\n        }\r\n\r\n\r\n        private void scavengeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if(HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n            {\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                FlowControllerFacade.Scavenge();\r\n            }\r\n            catch\r\n            {\r\n                // Ignore exceptions\r\n            }\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/FlowInformationScavengerWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Actions.Workflows\r\n{\r\n    partial class FlowInformationScavengerWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.delayActivity1 = new System.Workflow.Activities.DelayActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.scavengeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.waitEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.waitStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.scavengeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.waitStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.scavengeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"scavengeStateActivity\";\r\n            // \r\n            // delayActivity1\r\n            // \r\n            this.delayActivity1.Name = \"delayActivity1\";\r\n            this.delayActivity1.TimeoutDuration = System.TimeSpan.Parse(\"00:00:00\");\r\n            this.delayActivity1.InitializeTimeoutDuration += new System.EventHandler(this.OnInitializeTimeout);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"waitStateActivity\";\r\n            // \r\n            // scavengeCodeActivity\r\n            // \r\n            this.scavengeCodeActivity.Name = \"scavengeCodeActivity\";\r\n            this.scavengeCodeActivity.ExecuteCode += new System.EventHandler(this.scavengeCodeActivity_ExecuteCode);\r\n            // \r\n            // waitEventDrivenActivity\r\n            // \r\n            this.waitEventDrivenActivity.Activities.Add(this.delayActivity1);\r\n            this.waitEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.waitEventDrivenActivity.Name = \"waitEventDrivenActivity\";\r\n            // \r\n            // waitStateInitializationActivity\r\n            // \r\n            this.waitStateInitializationActivity.Name = \"waitStateInitializationActivity\";\r\n            // \r\n            // scavengeStateInitializationActivity\r\n            // \r\n            this.scavengeStateInitializationActivity.Activities.Add(this.scavengeCodeActivity);\r\n            this.scavengeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.scavengeStateInitializationActivity.Name = \"scavengeStateInitializationActivity\";\r\n            // \r\n            // waitStateActivity\r\n            // \r\n            this.waitStateActivity.Activities.Add(this.waitStateInitializationActivity);\r\n            this.waitStateActivity.Activities.Add(this.waitEventDrivenActivity);\r\n            this.waitStateActivity.Name = \"waitStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // scavengeStateActivity\r\n            // \r\n            this.scavengeStateActivity.Activities.Add(this.scavengeStateInitializationActivity);\r\n            this.scavengeStateActivity.Name = \"scavengeStateActivity\";\r\n            // \r\n            // FlowInformationScavengerWorkflow\r\n            // \r\n            this.Activities.Add(this.scavengeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.waitStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"scavengeStateActivity\";\r\n            this.Name = \"FlowInformationScavengerWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity scavengeStateInitializationActivity;\r\n        private DelayActivity delayActivity1;\r\n        private EventDrivenActivity waitEventDrivenActivity;\r\n        private StateInitializationActivity waitStateInitializationActivity;\r\n        private StateActivity waitStateActivity;\r\n        private StateActivity finalStateActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private CodeActivity scavengeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateActivity scavengeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/FlowInformationScavengerWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"FlowInformationScavengerWorkflow\" Location=\"30; 30\" Size=\"1182; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"waitStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"scavengeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"waitStateActivity\" SourceActivity=\"scavengeStateActivity\" EventHandlerName=\"scavengeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"678\" Y=\"419\" />\r\n\t\t\t\t<ns0:Point X=\"694\" Y=\"419\" />\r\n\t\t\t\t<ns0:Point X=\"694\" Y=\"132\" />\r\n\t\t\t\t<ns0:Point X=\"318\" Y=\"132\" />\r\n\t\t\t\t<ns0:Point X=\"318\" Y=\"140\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"scavengeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"waitStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"scavengeStateActivity\" SourceActivity=\"waitStateActivity\" EventHandlerName=\"waitEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"384\" Y=\"205\" />\r\n\t\t\t\t<ns0:Point X=\"573\" Y=\"205\" />\r\n\t\t\t\t<ns0:Point X=\"573\" Y=\"378\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"scavengeStateActivity\" Location=\"465; 378\" Size=\"217; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"scavengeStateInitializationActivity\" Location=\"473; 409\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"scavengeCodeActivity\" Location=\"483; 471\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"483; 531\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"waitStateActivity\" Location=\"223; 140\" Size=\"191; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 109\" Name=\"waitStateInitializationActivity\" Location=\"538; 135\" />\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"waitEventDrivenActivity\" Location=\"546; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<DelayDesigner Size=\"130; 41\" Name=\"delayActivity1\" Location=\"556; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"556; 270\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/SecurityViolationWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\n\r\n\r\nnamespace Composite.C1Console.Actions.Workflows\r\n{\r\n    public sealed partial class SecurityViolationWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public SecurityViolationWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/SecurityViolationWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Actions.Workflows\r\n{\r\n    partial class SecurityViolationWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\SecurityViolationStep1.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // SecurityViolationWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"SecurityViolationWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Actions/Workflows/SecurityViolationWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"SecurityViolationWorkflow\" Location=\"30; 30\" Size=\"1176; 974\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"SecurityViolationWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"SecurityViolationWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"437\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"437\" Y=\"363\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"537\" Y=\"428\" />\r\n\t\t\t\t<ns0:Point X=\"717\" Y=\"428\" />\r\n\t\t\t\t<ns0:Point X=\"717\" Y=\"518\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"816\" Y=\"559\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"559\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"334; 363\" Size=\"207; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"342; 394\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"dataDialogFormActivity1\" Location=\"352; 456\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"342; 418\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"352; 480\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"352; 540\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"615; 518\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"finalizeStateInitializationActivity\" Location=\"623; 549\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"633; 611\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddAssociatedDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\n\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Scheduling;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    /// <summary>\r\n    /// This is used when adding data to a page folder\r\n    /// </summary>\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddAssociatedDataWorkflow : FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        private bool _doPublish;\r\n\r\n        private static class BindingNames\r\n        {\r\n            public const string PageId = nameof(PageId);\r\n        }\r\n\r\n        public AddAssociatedDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void IsDataTypeDescriptorNullTest(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = !BindingExist(\"DataTypeDescriptor\");\r\n        }\r\n\r\n        private void initialCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var entityToken = EntityToken as AssociatedDataElementProviderHelperEntityToken;\r\n\r\n            if (!string.IsNullOrEmpty(entityToken?.Payload))\r\n            {\r\n                var type = TypeManager.GetType(entityToken.Payload);\r\n                var id = type.GetImmutableTypeId();\r\n                var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(id);\r\n                UpdateBinding(\"DataTypeDescriptor\", dataTypeDescriptor);\r\n\r\n                UpdateBinding(BindingNames.PageId, new Guid(entityToken.Id));\r\n\r\n                if (!PermissionsFacade.GetPermissionsForCurrentUser(EntityToken).Contains(PermissionType.Publish) || !typeof(IPublishControlled).IsAssignableFrom(type))\r\n                {\r\n                    var formData = WorkflowFacade.GetFormData(InstanceId, true);\r\n\r\n                    if (formData.ExcludedEvents == null)\r\n                        formData.ExcludedEvents = new List<string>();\r\n\r\n                    formData.ExcludedEvents.Add(\"SaveAndPublish\");\r\n                }\r\n            }\r\n        }\r\n\r\n        private void selectTypeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var types = PageFolderFacade.GetAllFolderTypes().ToList();\r\n\r\n            Bindings.Add(\"Types\", types);\r\n            Bindings.Add(\"SelectedType\", types[0]);\r\n        }\r\n\r\n        private void selectTypeCodeActivity_Next_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var type = GetBinding<Type>(\"SelectedType\");\r\n\r\n            var dataEntityToken = (DataEntityToken)EntityToken;\r\n\r\n            var parentInterfaceType = dataEntityToken.Data.DataSourceId.InterfaceType;\r\n            var id = parentInterfaceType.GetKeyProperties()[0].GetValue(dataEntityToken.Data, null);\r\n            var idString = ValueTypeConverter.Convert<string>(id);\r\n\r\n            var entityToken = new AssociatedDataElementProviderHelperEntityToken(\r\n                                TypeManager.SerializeType(parentInterfaceType),\r\n                                EntityToken.Source,\r\n                                idString,\r\n                                TypeManager.SerializeType(type)\r\n                            );\r\n\r\n            ExecuteWorklow(entityToken, typeof(AddAssociatedDataWorkflow));\r\n\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type.GetImmutableTypeId());\r\n            UpdateBinding(\"DataTypeDescriptor\", dataTypeDescriptor);\r\n        }\r\n\r\n        private void enterDataCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var dataTypeDescriptor = GetBinding<DataTypeDescriptor>(\"DataTypeDescriptor\");\r\n\r\n            var type = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            Guid pageId = GetBinding<Guid>(BindingNames.PageId);\r\n\r\n            var helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, true, EntityToken)\r\n            {\r\n                LayoutIconHandle = \"associated-data-add\"\r\n            };\r\n\r\n            var generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n            helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n            IData newData;\r\n            if (!BindingExist(\"NewData\"))\r\n            {\r\n                newData = DataFacade.BuildNew(type);\r\n\r\n                PageFolderFacade.AssignFolderDataSpecificValues(newData, pageId);\r\n\r\n                var publishControlled = newData as IPublishControlled;\r\n                if (publishControlled != null)\r\n                {\r\n                    publishControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n                }\r\n\r\n                var localizedData = newData as ILocalizedControlled;\r\n                if (localizedData != null)\r\n                {\r\n                    var cultureInfo = UserSettings.ActiveLocaleCultureInfo ?? DataLocalizationFacade.DefaultLocalizationCulture;\r\n                    localizedData.SourceCultureName = cultureInfo.Name;\r\n                }\r\n\r\n                Bindings.Add(\"NewData\", newData);\r\n\r\n                helper.UpdateWithNewBindings(Bindings);\r\n                helper.ObjectToBindings(newData, Bindings);\r\n            }\r\n            else\r\n            {\r\n                newData = GetBinding<IData>(\"NewData\");\r\n            }\r\n\r\n            DeliverFormData(\r\n                    type.Name,\r\n                    StandardUiContainerTypes.Document,\r\n                    helper.GetForm(),\r\n                    Bindings,\r\n                    helper.GetBindingsValidationRules(newData)\r\n                );\r\n        }\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var dataTypeDescriptor = GetBinding<DataTypeDescriptor>(\"DataTypeDescriptor\");\r\n\r\n            var newData = GetBinding<IData>(\"NewData\");\r\n\r\n            var helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, true, newData.GetDataEntityToken());\r\n\r\n            var generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n            helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n\r\n            var isValid = ValidateBindings();\r\n\r\n            if (!BindAndValidate(helper, newData))\r\n            {\r\n                isValid = false;\r\n            }\r\n\r\n            var justAdded = false;\r\n            if (isValid)\r\n            {\r\n                var published = false;\r\n\r\n                if (!BindingExist(\"DataAdded\"))\r\n                {\r\n                    var dataScopeIdentifier = DataScopeIdentifier.Public;\r\n                    if (dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled)))\r\n                    {\r\n                        dataScopeIdentifier = DataScopeIdentifier.Administrated;\r\n                    }\r\n\r\n                    using (new DataScope(dataScopeIdentifier))\r\n                    {\r\n                        newData = DataFacade.AddNew(newData);\r\n\r\n                        justAdded = true;\r\n                    }\r\n\r\n                    PublishControlledHelper.PublishIfNeeded(newData, _doPublish, Bindings, ShowMessage);\r\n\r\n                    AcquireLock(newData.GetDataEntityToken());\r\n\r\n                    UpdateBinding(\"NewData\", newData);\r\n                    Bindings.Add(\"DataAdded\", true);\r\n                }\r\n                else\r\n                {\r\n                    var publishedControlled = newData as IPublishControlled;\r\n                    if (publishedControlled != null)\r\n                    {\r\n                        var refreshedData = (IPublishControlled)DataFacade.GetDataFromDataSourceId(newData.DataSourceId);\r\n                        if (refreshedData != null && refreshedData.PublicationStatus == GenericPublishProcessController.Published)\r\n                        {\r\n                            refreshedData.PublicationStatus = GenericPublishProcessController.Draft;\r\n\r\n                            DataFacade.Update(refreshedData);\r\n                        }\r\n                    }\r\n\r\n                    DataFacade.Update(newData);\r\n\r\n                    published = PublishControlledHelper.PublishIfNeeded(newData, _doPublish, Bindings, ShowMessage);\r\n\r\n                    EntityTokenCacheFacade.ClearCache(newData.GetDataEntityToken());\r\n                }\r\n\r\n                if (!published)\r\n                {\r\n                    var specificTreeRefresher = CreateParentTreeRefresher();\r\n                    specificTreeRefresher.PostRefreshMesseges(EntityToken);\r\n                }\r\n\r\n                if (justAdded)\r\n                {\r\n                    SetSaveStatus(true, newData);\r\n                }\r\n                else\r\n                {\r\n                    SetSaveStatus(true);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                SetSaveStatus(false);\r\n            }\r\n        }\r\n\r\n        private void enablePublishCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            _doPublish = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddAssociatedDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    partial class AddAssociatedDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.selectTypeCodeActivity_Next = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.selectTypeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.enablePublishCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.saveAndPublishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.enterDataCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.initialCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.selectTypeEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectTypeEventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.enterDataEventDrivenActivity_SaveAndPublish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterDataEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterDataStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.selectTypeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.enterDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"enterDataStateActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"selectTypeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity2);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity7);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsDataTypeDescriptorNullTest);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // selectTypeCodeActivity_Next\r\n            // \r\n            this.selectTypeCodeActivity_Next.Name = \"selectTypeCodeActivity_Next\";\r\n            this.selectTypeCodeActivity_Next.ExecuteCode += new System.EventHandler(this.selectTypeCodeActivity_Next_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"/Administrative/AddAssociatedDataWorkflowTypeSelection.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // selectTypeCodeActivity\r\n            // \r\n            this.selectTypeCodeActivity.Name = \"selectTypeCodeActivity\";\r\n            this.selectTypeCodeActivity.ExecuteCode += new System.EventHandler(this.selectTypeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"enterDataStateActivity\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // enablePublishCodeActivity\r\n            // \r\n            this.enablePublishCodeActivity.Name = \"enablePublishCodeActivity\";\r\n            this.enablePublishCodeActivity.ExecuteCode += new System.EventHandler(this.enablePublishCodeActivity_ExecuteCode);\r\n            // \r\n            // saveAndPublishHandleExternalEventActivity1\r\n            // \r\n            this.saveAndPublishHandleExternalEventActivity1.EventName = \"SaveAndPublish\";\r\n            this.saveAndPublishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveAndPublishHandleExternalEventActivity1.Name = \"saveAndPublishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // enterDataCodeActivity\r\n            // \r\n            this.enterDataCodeActivity.Name = \"enterDataCodeActivity\";\r\n            this.enterDataCodeActivity.ExecuteCode += new System.EventHandler(this.enterDataCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // initialCodeActivity\r\n            // \r\n            this.initialCodeActivity.Name = \"initialCodeActivity\";\r\n            this.initialCodeActivity.ExecuteCode += new System.EventHandler(this.initialCodeActivity_ExecuteCode);\r\n            // \r\n            // selectTypeEventDrivenActivity_Cancel\r\n            // \r\n            this.selectTypeEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.selectTypeEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity8);\r\n            this.selectTypeEventDrivenActivity_Cancel.Name = \"selectTypeEventDrivenActivity_Cancel\";\r\n            // \r\n            // selectTypeEventDrivenActivity_Next\r\n            // \r\n            this.selectTypeEventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.selectTypeEventDrivenActivity_Next.Activities.Add(this.selectTypeCodeActivity_Next);\r\n            this.selectTypeEventDrivenActivity_Next.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.selectTypeEventDrivenActivity_Next.Activities.Add(this.setStateActivity6);\r\n            this.selectTypeEventDrivenActivity_Next.Name = \"selectTypeEventDrivenActivity_Next\";\r\n            // \r\n            // selectTypeStateInitializationActivity\r\n            // \r\n            this.selectTypeStateInitializationActivity.Activities.Add(this.selectTypeCodeActivity);\r\n            this.selectTypeStateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.selectTypeStateInitializationActivity.Name = \"selectTypeStateInitializationActivity\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // enterDataEventDrivenActivity_SaveAndPublish\r\n            // \r\n            this.enterDataEventDrivenActivity_SaveAndPublish.Activities.Add(this.saveAndPublishHandleExternalEventActivity1);\r\n            this.enterDataEventDrivenActivity_SaveAndPublish.Activities.Add(this.enablePublishCodeActivity);\r\n            this.enterDataEventDrivenActivity_SaveAndPublish.Activities.Add(this.setStateActivity3);\r\n            this.enterDataEventDrivenActivity_SaveAndPublish.Name = \"enterDataEventDrivenActivity_SaveAndPublish\";\r\n            // \r\n            // enterDataEventDrivenActivity_Save\r\n            // \r\n            this.enterDataEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.enterDataEventDrivenActivity_Save.Activities.Add(this.setStateActivity4);\r\n            this.enterDataEventDrivenActivity_Save.Name = \"enterDataEventDrivenActivity_Save\";\r\n            // \r\n            // enterDataStateInitializationActivity\r\n            // \r\n            this.enterDataStateInitializationActivity.Activities.Add(this.enterDataCodeActivity);\r\n            this.enterDataStateInitializationActivity.Name = \"enterDataStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initialCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.ifElseActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // selectTypeStateActivity\r\n            // \r\n            this.selectTypeStateActivity.Activities.Add(this.selectTypeStateInitializationActivity);\r\n            this.selectTypeStateActivity.Activities.Add(this.selectTypeEventDrivenActivity_Next);\r\n            this.selectTypeStateActivity.Activities.Add(this.selectTypeEventDrivenActivity_Cancel);\r\n            this.selectTypeStateActivity.Name = \"selectTypeStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // enterDataStateActivity\r\n            // \r\n            this.enterDataStateActivity.Activities.Add(this.enterDataStateInitializationActivity);\r\n            this.enterDataStateActivity.Activities.Add(this.enterDataEventDrivenActivity_Save);\r\n            this.enterDataStateActivity.Activities.Add(this.enterDataEventDrivenActivity_SaveAndPublish);\r\n            this.enterDataStateActivity.Name = \"enterDataStateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // AddAssociatedDataWorkflow\r\n            // \r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.enterDataStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.selectTypeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"AddAssociatedDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity selectTypeEventDrivenActivity_Cancel;\r\n\r\n        private CodeActivity selectTypeCodeActivity_Next;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private Workflow.Activities.WizardFormActivity wizzardFormActivity1;\r\n\r\n        private CodeActivity selectTypeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity selectTypeEventDrivenActivity_Next;\r\n\r\n        private StateInitializationActivity selectTypeStateInitializationActivity;\r\n\r\n        private StateActivity selectTypeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private EventDrivenActivity enterDataEventDrivenActivity_Save;\r\n\r\n        private CodeActivity finalizeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private CodeActivity enterDataCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n\r\n        private StateInitializationActivity enterDataStateInitializationActivity;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity enterDataStateActivity;\r\n\r\n        private StateActivity initialStateActivity;\r\n\r\n        private CodeActivity initialCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private CodeActivity enablePublishCodeActivity;\r\n\r\n        private Workflow.Activities.SaveAndPublishHandleExternalEventActivity saveAndPublishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity enterDataEventDrivenActivity_SaveAndPublish;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddAssociatedDataWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1199; 932\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddAssociatedDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"827; 665\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"212; 80\" AutoSizeMargin=\"16; 24\" Location=\"65; 141\" Name=\"initialStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"381; 396\" Location=\"73; 174\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initialCodeActivity\" Size=\"130; 44\" Location=\"198; 239\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2\" Size=\"361; 249\" Location=\"83; 302\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 146\" Location=\"102; 376\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 62\" Location=\"112; 441\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 146\" Location=\"275; 376\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"285; 441\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"299; 110\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"206; 296\" Name=\"enterDataStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"enterDataStateInitializationActivity\" Size=\"150; 128\" Location=\"546; 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"enterDataCodeActivity\" Size=\"130; 44\" Location=\"556; 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"enterDataEventDrivenActivity_Save\" Size=\"150; 209\" Location=\"546; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"556; 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"556; 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"enterDataEventDrivenActivity_SaveAndPublish\" Size=\"150; 272\" Location=\"554; 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveAndPublishHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"564; 219\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"enablePublishCodeActivity\" Size=\"130; 44\" Location=\"564; 282\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"564; 345\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"206; 80\" AutoSizeMargin=\"16; 24\" Location=\"607; 306\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 209\" Location=\"615; 339\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity\" Size=\"130; 44\" Location=\"625; 404\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 62\" Location=\"625; 467\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"252; 118\" AutoSizeMargin=\"16; 24\" Location=\"58; 499\" Name=\"selectTypeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"selectTypeStateInitializationActivity\" Size=\"150; 191\" Location=\"66; 532\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"selectTypeCodeActivity\" Size=\"130; 44\" Location=\"76; 597\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130; 44\" Location=\"76; 660\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"selectTypeEventDrivenActivity_Next\" Size=\"150; 335\" Location=\"66; 558\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"76; 623\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"selectTypeCodeActivity_Next\" Size=\"130; 44\" Location=\"76; 686\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 44\" Location=\"76; 749\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 62\" Location=\"76; 812\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"selectTypeEventDrivenActivity_Cancel\" Size=\"150; 209\" Location=\"66; 584\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 44\" Location=\"76; 649\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 62\" Location=\"76; 712\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddAssociatedDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddAssociatedDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"214\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"907\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"907\" Y=\"665\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectTypeStateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"initialStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initialStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"selectTypeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"185\" />\r\n\t\t\t\t<ns0:Point X=\"512\" Y=\"185\" />\r\n\t\t\t\t<ns0:Point X=\"512\" Y=\"487\" />\r\n\t\t\t\t<ns0:Point X=\"184\" Y=\"487\" />\r\n\t\t\t\t<ns0:Point X=\"184\" Y=\"499\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"enterDataStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initialStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initialStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"enterDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"185\" />\r\n\t\t\t\t<ns0:Point X=\"355\" Y=\"185\" />\r\n\t\t\t\t<ns0:Point X=\"355\" Y=\"296\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"enterDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"enterDataStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"enterDataEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"440\" Y=\"366\" />\r\n\t\t\t\t<ns0:Point X=\"517\" Y=\"366\" />\r\n\t\t\t\t<ns0:Point X=\"517\" Y=\"298\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"298\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"306\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"enterDataStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"enterDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"809\" Y=\"350\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"350\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"288\" />\r\n\t\t\t\t<ns0:Point X=\"355\" Y=\"288\" />\r\n\t\t\t\t<ns0:Point X=\"355\" Y=\"296\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"selectTypeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectTypeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectTypeEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"569\" />\r\n\t\t\t\t<ns0:Point X=\"907\" Y=\"569\" />\r\n\t\t\t\t<ns0:Point X=\"907\" Y=\"665\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity8\" SourceActivity=\"selectTypeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectTypeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectTypeEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"595\" />\r\n\t\t\t\t<ns0:Point X=\"907\" Y=\"595\" />\r\n\t\t\t\t<ns0:Point X=\"907\" Y=\"665\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"enterDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"enterDataStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"enterDataEventDrivenActivity_SaveAndPublish\" SourceConnectionIndex=\"2\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"501\" Y=\"392\" />\r\n\t\t\t\t<ns0:Point X=\"517\" Y=\"392\" />\r\n\t\t\t\t<ns0:Point X=\"517\" Y=\"298\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"298\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"306\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddDataFolderExWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Elements.ElementProviders.PageElementProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    [Obsolete(\"To be removed\")]\r\n    public sealed partial class AddDataFolderExWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private string TypesBindingName { get { return \"Types\"; } }\r\n        private string SelectedTypeBindingName { get { return \"SelectedType\"; } }\r\n\r\n        private string NewTypeNameBindingName { get { return \"NewTypeName\"; } }\r\n        private string NewTypeNamespaceBindingName { get { return \"NewTypeNamespace\"; } }\r\n        private string NewTypeTitleBindingName { get { return \"NewTypeTitle\"; } }\r\n        private string DataFieldDescriptorsBindingName { get { return \"DataFieldDescriptors\"; } }\r\n        private string LabelFieldNameBindingName { get { return \"LabelFieldName\"; } }\r\n        private string HasRecycleBinBindingName { get { return \"HasRecycleBin\"; } }\r\n        private string HasPublishingBindingName { get { return \"HasPublishing\"; } }\r\n        private string HasLocalizationBindingName { get { return \"HasLocalization\"; } }\r\n\r\n\r\n        private static readonly object _lock = new object();\r\n\r\n        public AddDataFolderExWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void ShouldCreateNewType(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.ExtraPayload == \"CreateNew\";\r\n        }\r\n\r\n\r\n\r\n        private void UnunsedTypesExist(object sender, ConditionalEventArgs e)\r\n        {\r\n            Type associatedType = TypeManager.GetType(this.Payload);\r\n\r\n            IEnumerable<Type> associationTypes = PageFolderFacade.GetAllFolderTypes();\r\n            IEnumerable<Type> usedAssociationTypes = PageFolderFacade.GetDefinedFolderTypes(this.GetDataItemFromEntityToken<IPage>());\r\n\r\n            e.Result = associationTypes.Except(usedAssociationTypes).Any();\r\n        }\r\n\r\n\r\n\r\n        private void UseExistingType(object sender, ConditionalEventArgs e)\r\n        {\r\n            Type type = this.GetBinding<Type>(this.SelectedTypeBindingName);\r\n\r\n            e.Result = type != typeof(AddDataFolderExWorkflow);\r\n        }\r\n\r\n\r\n\r\n        private void IsTypeCreated(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(this.SelectedTypeBindingName);\r\n        }        \r\n\r\n\r\n\r\n        private void selectTypeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Type associatedType = TypeManager.GetType(this.Payload);\r\n\r\n            IEnumerable<Type> associationTypes = PageFolderFacade.GetAllFolderTypes();\r\n            IEnumerable<Type> usedAccociationTypes = PageFolderFacade.GetDefinedFolderTypes(this.GetDataItemFromEntityToken<IPage>());\r\n\r\n            var types = new Dictionary<Type, string>();\r\n            foreach (var kvp in associationTypes.Except(usedAccociationTypes).ToDictionary(f => f, f => f.GetTypeTitle()))\r\n            {\r\n                types.Add(kvp.Key, kvp.Value);\r\n            }\r\n\r\n            this.Bindings.Add(this.TypesBindingName, types);\r\n            this.Bindings.Add(this.SelectedTypeBindingName, types.Keys.First());\r\n        }\r\n\r\n\r\n\r\n        private void selectTypeCodeActivity_StartCreateNewTypeWorkflow_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.CloseCurrentView();\r\n            this.ExecuteAction(this.EntityToken, new WorkflowActionToken(typeof(AddDataFolderExWorkflow), this.ActionToken.PermissionTypes) { Payload = this.Payload, ExtraPayload = \"CreateNew\", DoIgnoreEntityTokenLocking = this.ActionToken.IgnoreEntityTokenLocking });\r\n        }\r\n\r\n\r\n\r\n        private void createNewTypeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (!this.BindingExist(this.NewTypeNameBindingName))\r\n            {\r\n                this.Bindings.Add(this.NewTypeNameBindingName, \"\");\r\n                this.Bindings.Add(this.NewTypeNamespaceBindingName, UserSettings.LastSpecifiedNamespace);\r\n                this.Bindings.Add(this.NewTypeTitleBindingName, \"\");\r\n                this.Bindings.Add(this.DataFieldDescriptorsBindingName, new List<DataFieldDescriptor>());\r\n                this.Bindings.Add(this.LabelFieldNameBindingName, \"\");\r\n\r\n                this.Bindings.Add(this.HasRecycleBinBindingName, false);\r\n                this.Bindings.Add(this.HasPublishingBindingName, false);\r\n                this.Bindings.Add(this.HasLocalizationBindingName, false);\r\n\r\n                this.BindingsValidationRules.Add(this.NewTypeNameBindingName, new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n                this.BindingsValidationRules.Add(this.NewTypeNamespaceBindingName, new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n                this.BindingsValidationRules.Add(this.NewTypeTitleBindingName, new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n            }\r\n\r\n            //if (RuntimeInformation.IsDebugBuild)\r\n            //{\r\n            //    DynamicTempTypeCreator dynamicTempTypeCreator = new DynamicTempTypeCreator(\"IAggTest\");\r\n\r\n            //    this.UpdateBinding(this.NewTypeNameBindingName, dynamicTempTypeCreator.TypeName);\r\n            //    this.UpdateBinding(this.NewTypeTitleBindingName, dynamicTempTypeCreator.TypeTitle);\r\n            //    this.UpdateBinding(this.DataFieldDescriptorsBindingName, dynamicTempTypeCreator.DataFieldDescriptors);\r\n            //}\r\n        }        \r\n\r\n\r\n\r\n        private void saceNewTypeCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            bool saveResult = false;\r\n\r\n            try\r\n            {\r\n                string typeName = this.GetBinding<string>(this.NewTypeNameBindingName);\r\n                string typeNamespace = this.GetBinding<string>(this.NewTypeNamespaceBindingName);\r\n                string typeTitle = this.GetBinding<string>(this.NewTypeTitleBindingName);\r\n                bool hasRecycleBin = this.GetBinding<bool>(this.HasRecycleBinBindingName);\r\n                bool hasPublishing = this.GetBinding<bool>(this.HasPublishingBindingName);\r\n                bool hasLocalization = this.GetBinding<bool>(this.HasLocalizationBindingName);\r\n                string labelFieldName = this.GetBinding<string>(this.LabelFieldNameBindingName);\r\n                var dataFieldDescriptors = this.GetBinding<List<DataFieldDescriptor>>(this.DataFieldDescriptorsBindingName);\r\n\r\n                var helper = new GeneratedTypesHelper();\r\n                helper = new GeneratedTypesHelper();\r\n\r\n                string errorMessage;\r\n                if (!helper.ValidateNewTypeName(typeName, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeName\", errorMessage);\r\n                    SetSaveStatus(false);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeNamespace(typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeNamespace\", errorMessage);\r\n                    SetSaveStatus(false);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeFullName(typeName, typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeName\", errorMessage);\r\n                    SetSaveStatus(false);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewFieldDescriptors(dataFieldDescriptors, null, out errorMessage))\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            \"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.ErrorTitle}\",\r\n                            errorMessage\r\n                        );\r\n                    SetSaveStatus(false);\r\n                    return;\r\n                }\r\n\r\n                if (helper.IsEditProcessControlledAllowed)\r\n                {\r\n                    helper.SetPublishControlled(hasPublishing);\r\n                    helper.SetLocalizedControlled(hasLocalization);\r\n                }\r\n\r\n                helper.SetNewTypeFullName(typeName, typeNamespace);\r\n                helper.SetNewTypeTitle(typeTitle);\r\n\r\n                // TODO: fix and check where the workflow is actually used\r\n                helper.SetNewFieldDescriptors(dataFieldDescriptors, null, labelFieldName);\r\n\r\n                Type targetType = TypeManager.GetType(this.Payload);\r\n                helper.SetForeignKeyReference(targetType, Composite.Data.DataAssociationType.Aggregation);\r\n\r\n                helper.CreateType(false);\r\n\r\n                this.UpdateBinding(this.SelectedTypeBindingName, helper.InterfaceType);\r\n\r\n                UserSettings.LastSpecifiedNamespace = typeNamespace;\r\n\r\n                saveResult = true;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(\"AddNewAggregationTypeWorkflow\", ex);\r\n\r\n                this.ShowMessage(DialogType.Error, ex.Message, ex.Message);                \r\n            }\r\n\r\n            SetSaveStatus(saveResult);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            Type type = this.GetBinding<Type>(SelectedTypeBindingName);\r\n\r\n            IPage page = (IPage)dataEntityToken.Data;\r\n\r\n            Guid dataTypeId = type.GetImmutableTypeId();\r\n\r\n            lock (_lock)\r\n            {\r\n                if (page.GetFolderDefinitionId(dataTypeId) == Guid.Empty)\r\n                {\r\n                    page.AddFolderDefinition(dataTypeId);\r\n                }\r\n            }\r\n            \r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n\r\n            var folderEntityToken = new AssociatedDataElementProviderHelperEntityToken(\r\n                TypeManager.SerializeType(typeof (IPage)),\r\n                PageElementProvider.DefaultConfigurationName,\r\n                page.Id.ToString(),\r\n                TypeManager.SerializeType(type));\r\n\r\n            SelectElement(folderEntityToken);\r\n        }\r\n\r\n\r\n\r\n        private void noTypesToAddCodeActivity_ShowMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Type associatedType = TypeManager.GetType(this.Payload);\r\n            var associationTypes = PageFolderFacade.GetAllFolderTypes();\r\n\r\n            if (!associationTypes.Any())\r\n            {\r\n                this.ShowMessage(\r\n                    DialogType.Message,\r\n                    \"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoTypesTitle}\",\r\n                    \"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoTypesMessage}\"\r\n                    );\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                    DialogType.Message,\r\n                    \"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoUnusedTypesTitle}\",\r\n                    \"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoUnusedTypesMessage}\"\r\n                    );\r\n\r\n            }\r\n        }                \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddDataFolderExWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    partial class AddDataFolderExWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity8 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity7 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity2 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity3 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.selectTypeCodeActivity_StartCreateNewTypeWorkflow = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.if_UnusedTypesExist = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.noTypesToAddCodeActivity_ShowMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.saceNewTypeCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.createNewTypeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.selectTypeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.if_CreateNewType = new System.Workflow.Activities.IfElseActivity();\r\n            this.noTypesToAddStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.saveNewTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.createNewTypeEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.createNewTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.selectTypeEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectTypeEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.noTypesToAddStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveNewTypeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.createNewTypeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.selectTypeToAddStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"noTypesToAddStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"selectTypeToAddStateActivity\";\r\n            // \r\n            // ifElseBranchActivity8\r\n            // \r\n            this.ifElseBranchActivity8.Activities.Add(this.setStateActivity12);\r\n            this.ifElseBranchActivity8.Name = \"ifElseBranchActivity8\";\r\n            // \r\n            // ifElseBranchActivity7\r\n            // \r\n            this.ifElseBranchActivity7.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.UnunsedTypesExist);\r\n            this.ifElseBranchActivity7.Condition = codecondition1;\r\n            this.ifElseBranchActivity7.Name = \"ifElseBranchActivity7\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"createNewTypeStateActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity2\r\n            // \r\n            this.closeCurrentViewActivity2.Name = \"closeCurrentViewActivity2\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity3\r\n            // \r\n            this.closeCurrentViewActivity3.Name = \"closeCurrentViewActivity3\";\r\n            // \r\n            // selectTypeCodeActivity_StartCreateNewTypeWorkflow\r\n            // \r\n            this.selectTypeCodeActivity_StartCreateNewTypeWorkflow.Name = \"selectTypeCodeActivity_StartCreateNewTypeWorkflow\";\r\n            this.selectTypeCodeActivity_StartCreateNewTypeWorkflow.ExecuteCode += new System.EventHandler(this.selectTypeCodeActivity_StartCreateNewTypeWorkflow_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // if_UnusedTypesExist\r\n            // \r\n            this.if_UnusedTypesExist.Activities.Add(this.ifElseBranchActivity7);\r\n            this.if_UnusedTypesExist.Activities.Add(this.ifElseBranchActivity8);\r\n            this.if_UnusedTypesExist.Name = \"if_UnusedTypesExist\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"createNewTypeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity10);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.closeCurrentViewActivity2);\r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity5);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsTypeCreated);\r\n            this.ifElseBranchActivity5.Condition = codecondition2;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.selectTypeCodeActivity_StartCreateNewTypeWorkflow);\r\n            this.ifElseBranchActivity2.Activities.Add(this.closeCurrentViewActivity3);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.UseExistingType);\r\n            this.ifElseBranchActivity1.Condition = codecondition3;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.if_UnusedTypesExist);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity8);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ShouldCreateNewType);\r\n            this.ifElseBranchActivity3.Condition = codecondition4;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // noTypesToAddCodeActivity_ShowMessage\r\n            // \r\n            this.noTypesToAddCodeActivity_ShowMessage.Name = \"noTypesToAddCodeActivity_ShowMessage\";\r\n            this.noTypesToAddCodeActivity_ShowMessage.ExecuteCode += new System.EventHandler(this.noTypesToAddCodeActivity_ShowMessage_ExecuteCode);\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // saceNewTypeCodeActivity_Save\r\n            // \r\n            this.saceNewTypeCodeActivity_Save.Name = \"saceNewTypeCodeActivity_Save\";\r\n            this.saceNewTypeCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saceNewTypeCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"saveNewTypeStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddDataFolderCreateNewType.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // createNewTypeCodeActivity_Initialize\r\n            // \r\n            this.createNewTypeCodeActivity_Initialize.Name = \"createNewTypeCodeActivity_Initialize\";\r\n            this.createNewTypeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.createNewTypeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddDataFolderExSelectType.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // selectTypeCodeActivity_Initialize\r\n            // \r\n            this.selectTypeCodeActivity_Initialize.Name = \"selectTypeCodeActivity_Initialize\";\r\n            this.selectTypeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.selectTypeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // if_CreateNewType\r\n            // \r\n            this.if_CreateNewType.Activities.Add(this.ifElseBranchActivity3);\r\n            this.if_CreateNewType.Activities.Add(this.ifElseBranchActivity4);\r\n            this.if_CreateNewType.Name = \"if_CreateNewType\";\r\n            // \r\n            // noTypesToAddStateInitializationActivity\r\n            // \r\n            this.noTypesToAddStateInitializationActivity.Activities.Add(this.noTypesToAddCodeActivity_ShowMessage);\r\n            this.noTypesToAddStateInitializationActivity.Activities.Add(this.setStateActivity11);\r\n            this.noTypesToAddStateInitializationActivity.Name = \"noTypesToAddStateInitializationActivity\";\r\n            // \r\n            // saveNewTypeStateInitializationActivity\r\n            // \r\n            this.saveNewTypeStateInitializationActivity.Activities.Add(this.saceNewTypeCodeActivity_Save);\r\n            this.saveNewTypeStateInitializationActivity.Activities.Add(this.ifElseActivity2);\r\n            this.saveNewTypeStateInitializationActivity.Name = \"saveNewTypeStateInitializationActivity\";\r\n            // \r\n            // createNewTypeEventDrivenActivity_Save\r\n            // \r\n            this.createNewTypeEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.createNewTypeEventDrivenActivity_Save.Activities.Add(this.setStateActivity4);\r\n            this.createNewTypeEventDrivenActivity_Save.Name = \"createNewTypeEventDrivenActivity_Save\";\r\n            // \r\n            // createNewTypeStateInitializationActivity\r\n            // \r\n            this.createNewTypeStateInitializationActivity.Activities.Add(this.createNewTypeCodeActivity_Initialize);\r\n            this.createNewTypeStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.createNewTypeStateInitializationActivity.Name = \"createNewTypeStateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity7);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // selectTypeEventDrivenActivity_Cancel\r\n            // \r\n            this.selectTypeEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.selectTypeEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.selectTypeEventDrivenActivity_Cancel.Name = \"selectTypeEventDrivenActivity_Cancel\";\r\n            // \r\n            // selectTypeEventDrivenActivity_Finish\r\n            // \r\n            this.selectTypeEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.selectTypeEventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.selectTypeEventDrivenActivity_Finish.Name = \"selectTypeEventDrivenActivity_Finish\";\r\n            // \r\n            // selectTypeStateInitializationActivity\r\n            // \r\n            this.selectTypeStateInitializationActivity.Activities.Add(this.selectTypeCodeActivity_Initialize);\r\n            this.selectTypeStateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.selectTypeStateInitializationActivity.Name = \"selectTypeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.if_CreateNewType);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // noTypesToAddStateActivity\r\n            // \r\n            this.noTypesToAddStateActivity.Activities.Add(this.noTypesToAddStateInitializationActivity);\r\n            this.noTypesToAddStateActivity.Name = \"noTypesToAddStateActivity\";\r\n            // \r\n            // saveNewTypeStateActivity\r\n            // \r\n            this.saveNewTypeStateActivity.Activities.Add(this.saveNewTypeStateInitializationActivity);\r\n            this.saveNewTypeStateActivity.Name = \"saveNewTypeStateActivity\";\r\n            // \r\n            // createNewTypeStateActivity\r\n            // \r\n            this.createNewTypeStateActivity.Activities.Add(this.createNewTypeStateInitializationActivity);\r\n            this.createNewTypeStateActivity.Activities.Add(this.createNewTypeEventDrivenActivity_Save);\r\n            this.createNewTypeStateActivity.Name = \"createNewTypeStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // selectTypeToAddStateActivity\r\n            // \r\n            this.selectTypeToAddStateActivity.Activities.Add(this.selectTypeStateInitializationActivity);\r\n            this.selectTypeToAddStateActivity.Activities.Add(this.selectTypeEventDrivenActivity_Finish);\r\n            this.selectTypeToAddStateActivity.Activities.Add(this.selectTypeEventDrivenActivity_Cancel);\r\n            this.selectTypeToAddStateActivity.Name = \"selectTypeToAddStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddDataFolderExWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.selectTypeToAddStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.createNewTypeStateActivity);\r\n            this.Activities.Add(this.saveNewTypeStateActivity);\r\n            this.Activities.Add(this.noTypesToAddStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddDataFolderExWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity selectTypeToAddStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private EventDrivenActivity selectTypeEventDrivenActivity_Cancel;\r\n        private EventDrivenActivity selectTypeEventDrivenActivity_Finish;\r\n        private StateInitializationActivity selectTypeStateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity dataDialogFormActivity1;\r\n        private CodeActivity selectTypeCodeActivity_Initialize;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private EventDrivenActivity createNewTypeEventDrivenActivity_Save;\r\n        private StateInitializationActivity createNewTypeStateInitializationActivity;\r\n        private StateActivity saveNewTypeStateActivity;\r\n        private StateActivity createNewTypeStateActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity4;\r\n        private IfElseActivity ifElseActivity1;\r\n        private StateInitializationActivity saveNewTypeStateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private CodeActivity saceNewTypeCodeActivity_Save;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity if_CreateNewType;\r\n        private SetStateActivity setStateActivity8;\r\n        private CodeActivity selectTypeCodeActivity_StartCreateNewTypeWorkflow;\r\n        private SetStateActivity setStateActivity9;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity3;\r\n        private CodeActivity createNewTypeCodeActivity_Initialize;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseActivity ifElseActivity2;\r\n        private SetStateActivity setStateActivity10;\r\n        private SetStateActivity setStateActivity12;\r\n        private IfElseBranchActivity ifElseBranchActivity8;\r\n        private IfElseBranchActivity ifElseBranchActivity7;\r\n        private IfElseActivity if_UnusedTypesExist;\r\n        private SetStateActivity setStateActivity11;\r\n        private CodeActivity noTypesToAddCodeActivity_ShowMessage;\r\n        private StateInitializationActivity noTypesToAddStateInitializationActivity;\r\n        private StateActivity noTypesToAddStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddDataFolderExWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddDataFolderExWorkflow\" Location=\"30; 30\" Size=\"1146; 937\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddDataFolderExWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddDataFolderExWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"857\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"createNewTypeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"createNewTypeStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"305\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"305\" Y=\"462\" />\r\n\t\t\t\t<ns0:Point X=\"217\" Y=\"462\" />\r\n\t\t\t\t<ns0:Point X=\"217\" Y=\"474\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"selectTypeToAddStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"selectTypeToAddStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"331\" />\r\n\t\t\t\t<ns0:Point X=\"582\" Y=\"331\" />\r\n\t\t\t\t<ns0:Point X=\"582\" Y=\"343\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"selectTypeToAddStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"selectTypeToAddStateActivity\" EventHandlerName=\"selectTypeEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"693\" Y=\"408\" />\r\n\t\t\t\t<ns0:Point X=\"781\" Y=\"408\" />\r\n\t\t\t\t<ns0:Point X=\"781\" Y=\"627\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceStateName=\"selectTypeToAddStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"selectTypeToAddStateActivity\" EventHandlerName=\"selectTypeEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"693\" Y=\"408\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"408\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"857\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"selectTypeToAddStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"selectTypeToAddStateActivity\" EventHandlerName=\"selectTypeEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"697\" Y=\"432\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"432\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"857\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"880\" Y=\"668\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"668\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"857\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveNewTypeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"createNewTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveNewTypeStateActivity\" SourceActivity=\"createNewTypeStateActivity\" EventHandlerName=\"createNewTypeEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"339\" Y=\"539\" />\r\n\t\t\t\t<ns0:Point X=\"403\" Y=\"539\" />\r\n\t\t\t\t<ns0:Point X=\"403\" Y=\"637\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"saveNewTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"saveNewTypeStateActivity\" EventHandlerName=\"saveNewTypeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"519\" Y=\"678\" />\r\n\t\t\t\t<ns0:Point X=\"535\" Y=\"678\" />\r\n\t\t\t\t<ns0:Point X=\"535\" Y=\"619\" />\r\n\t\t\t\t<ns0:Point X=\"781\" Y=\"619\" />\r\n\t\t\t\t<ns0:Point X=\"781\" Y=\"627\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"createNewTypeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceStateName=\"saveNewTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"createNewTypeStateActivity\" SourceActivity=\"saveNewTypeStateActivity\" EventHandlerName=\"saveNewTypeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"519\" Y=\"678\" />\r\n\t\t\t\t<ns0:Point X=\"529\" Y=\"678\" />\r\n\t\t\t\t<ns0:Point X=\"529\" Y=\"466\" />\r\n\t\t\t\t<ns0:Point X=\"217\" Y=\"466\" />\r\n\t\t\t\t<ns0:Point X=\"217\" Y=\"474\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceStateName=\"noTypesToAddStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"noTypesToAddStateActivity\" EventHandlerName=\"noTypesToAddStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"738\" Y=\"248\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"248\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"857\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"noTypesToAddStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity12\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"noTypesToAddStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"199\" />\r\n\t\t\t\t<ns0:Point X=\"619\" Y=\"199\" />\r\n\t\t\t\t<ns0:Point X=\"619\" Y=\"207\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 197\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"612; 496\" Name=\"initializeStateInitializationActivity\" Location=\"98; 228\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 415\" Name=\"if_CreateNewType\" Location=\"108; 290\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 315\" Name=\"ifElseBranchActivity3\" Location=\"127; 361\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"137; 520\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 315\" Name=\"ifElseBranchActivity4\" Location=\"300; 361\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 234\" Name=\"if_UnusedTypesExist\" Location=\"310; 423\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 134\" Name=\"ifElseBranchActivity7\" Location=\"329; 494\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"339; 562\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 134\" Name=\"ifElseBranchActivity8\" Location=\"502; 494\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity12\" Location=\"512; 556\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 857\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"selectTypeToAddStateActivity\" Location=\"464; 343\" Size=\"237; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"selectTypeStateInitializationActivity\" Location=\"472; 374\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"selectTypeCodeActivity_Initialize\" Location=\"482; 436\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"dataDialogFormActivity1\" Location=\"482; 496\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 483\" Name=\"selectTypeEventDrivenActivity_Finish\" Location=\"472; 398\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"597; 460\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 342\" Name=\"ifElseActivity1\" Location=\"482; 520\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 242\" Name=\"ifElseBranchActivity1\" Location=\"501; 591\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"511; 713\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 242\" Name=\"ifElseBranchActivity2\" Location=\"674; 591\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"selectTypeCodeActivity_StartCreateNewTypeWorkflow\" Location=\"684; 653\" />\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity3\" Location=\"684; 713\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"684; 773\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"selectTypeEventDrivenActivity_Cancel\" Location=\"472; 422\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"482; 484\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"482; 544\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"679; 627\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"687; 658\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"697; 720\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"697; 780\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"697; 840\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"createNewTypeStateActivity\" Location=\"91; 474\" Size=\"252; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"createNewTypeStateInitializationActivity\" Location=\"99; 505\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"createNewTypeCodeActivity_Initialize\" Location=\"109; 567\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"109; 627\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"createNewTypeEventDrivenActivity_Save\" Location=\"99; 529\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"109; 591\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"109; 651\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveNewTypeStateActivity\" Location=\"283; 637\" Size=\"240; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 423\" Name=\"saveNewTypeStateInitializationActivity\" Location=\"291; 668\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saceNewTypeCodeActivity_Save\" Location=\"416; 730\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity2\" Location=\"301; 790\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity5\" Location=\"320; 861\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity2\" Location=\"330; 923\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"330; 983\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity6\" Location=\"493; 861\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity10\" Location=\"503; 947\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"noTypesToAddStateActivity\" Location=\"497; 207\" Size=\"245; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 194\" Name=\"noTypesToAddStateInitializationActivity\" Location=\"304; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"noTypesToAddCodeActivity_ShowMessage\" Location=\"314; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity11\" Location=\"314; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddMetaDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddMetaDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static string TypesBindingName { get { return \"Types\"; } }\r\n        private static string SelectedTypeBindingName { get { return \"SelectedType\"; } }\r\n        private static string FieldGroupNameBindingName { get { return \"FieldGroupName\"; } }\r\n        private static string FieldGroupLabelBindingName { get { return \"FieldGroupLabel\"; } }\r\n        private static string ContainersBindingName { get { return \"Containers\"; } }\r\n        private static string SelectedContainerBindingName { get { return \"SelectedContainer\"; } }\r\n        private static string StartDisplayOptionsBindingName { get { return \"StartDisplayOptions\"; } }\r\n        private static string SelectedStartDisplayBindingName { get { return \"SelectedStartDisplay\"; } }\r\n        private static string InheritDisplayOptionsBindingName { get { return \"InheritDisplayOptions\"; } }\r\n        private static string SelectedInheritDisplayBindingName { get { return \"SelectedInheritDisplay\"; } }\r\n\r\n        private static string DataAssociationVisabilityDescriptionBindingName { get { return \"DataAssociationVisabilityRule\"; } }\r\n\r\n\r\n\r\n        public AddMetaDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Type> GetAddebleTypes()\r\n        {\r\n            IEnumerable<Type> accociationTypes = PageMetaDataFacade.GetAllMetaDataTypes();\r\n\r\n            return accociationTypes;\r\n        }\r\n\r\n\r\n\r\n        private IPage GetCurrentPage()\r\n        {\r\n            if ((this.EntityToken is DataEntityToken))\r\n            {\r\n                return this.GetDataItemFromEntityToken<IPage>();\r\n            }\r\n            else\r\n            {\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Guid GetCurrentPageId()\r\n        {\r\n            IPage page = GetCurrentPage();\r\n\r\n            if (page != null)\r\n            {\r\n                return page.Id;\r\n            }\r\n            else\r\n            {\r\n                return Guid.Empty;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private bool IsAnyPagesAffected()\r\n        {\r\n            PageMetaDataDescription dataAssociationVisabilityRule = this.GetBinding<PageMetaDataDescription>(DataAssociationVisabilityDescriptionBindingName);\r\n\r\n            IPage page = GetCurrentPage();\r\n\r\n            return page.GetMetaDataAffectedPages(dataAssociationVisabilityRule.StartLevel, dataAssociationVisabilityRule.Levels).Any();\r\n        }\r\n\r\n\r\n\r\n\r\n        private void DoesTypesToAddExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = GetAddebleTypes().FirstOrDefault() != null;\r\n        }\r\n\r\n\r\n\r\n        private void DidFieldNameValidate(object sender, ConditionalEventArgs e)\r\n        {\r\n            PageMetaDataDescription dataAssociationVisabilityRule = this.GetBinding<PageMetaDataDescription>(DataAssociationVisabilityDescriptionBindingName);\r\n\r\n            e.Result = dataAssociationVisabilityRule != null;\r\n        }\r\n\r\n        \r\n\r\n        private void DoesTargetDataExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = IsAnyPagesAffected();\r\n        }\r\n\r\n\r\n\r\n        private void selectTypeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (this.BindingExist(TypesBindingName) == false)\r\n            {\r\n                Dictionary<Type, string> types = GetAddebleTypes().OrderBy(f => f.GetTypeTitle()).ToDictionary(f => f, f => f.GetTypeTitle());\r\n\r\n                this.UpdateBinding(TypesBindingName, types);\r\n                this.UpdateBinding(SelectedTypeBindingName, types.Keys.First());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void noTypesToAddCodeActivity_ShowMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(\r\n                DialogType.Message,\r\n                \"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataWorkflow.NoTypesTitle}\",\r\n                \"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataWorkflow.NoTypesMessage}\"\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void createFieldGroupCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Type type = this.GetBinding<Type>(SelectedTypeBindingName);\r\n\r\n            string metaDataDefinitionName = type.GetTypeTitle();\r\n            int counter = 1;\r\n            while (PageMetaDataFacade.IsDefinitionAllowed(GetCurrentPageId(), metaDataDefinitionName, metaDataDefinitionName, type.GetImmutableTypeId()) == false)\r\n            {\r\n                metaDataDefinitionName = string.Format(\"{0} {1}\", type.GetTypeTitle(), counter++);\r\n            }\r\n\r\n            this.UpdateBinding(FieldGroupNameBindingName, metaDataDefinitionName);\r\n            this.UpdateBinding(FieldGroupLabelBindingName, metaDataDefinitionName);\r\n\r\n\r\n            if (this.BindingExist(ContainersBindingName) == false)\r\n            {\r\n                List<KeyValuePair<Guid, string>> containers = PageMetaDataFacade.GetAllMetaDataContainers();\r\n                this.UpdateBinding(ContainersBindingName, containers);\r\n                this.UpdateBinding(SelectedContainerBindingName, containers.First().Key);\r\n\r\n                Dictionary<int, string> startDisplayOptions = new Dictionary<int, string>();\r\n                if (GetCurrentPage() != null)\r\n                {\r\n                    startDisplayOptions.Add(0, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption0\"));\r\n                }\r\n                startDisplayOptions.Add(1, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption1\"));\r\n                startDisplayOptions.Add(2, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption2\"));\r\n                startDisplayOptions.Add(3, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption3\"));\r\n                startDisplayOptions.Add(4, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption4\"));\r\n                startDisplayOptions.Add(5, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption5\"));\r\n                this.UpdateBinding(StartDisplayOptionsBindingName, startDisplayOptions);\r\n                this.UpdateBinding(SelectedStartDisplayBindingName, startDisplayOptions.Keys.First());\r\n\r\n                Dictionary<int, string> inheritDisplayOptions = new Dictionary<int, string>();\r\n                inheritDisplayOptions.Add(0, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption0\"));\r\n                inheritDisplayOptions.Add(1, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption1\"));\r\n                inheritDisplayOptions.Add(2, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption2\"));\r\n                inheritDisplayOptions.Add(3, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption3\"));\r\n                inheritDisplayOptions.Add(10000, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption4\"));\r\n                this.UpdateBinding(InheritDisplayOptionsBindingName, inheritDisplayOptions);\r\n                this.UpdateBinding(SelectedInheritDisplayBindingName, inheritDisplayOptions.Keys.Last());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void createFieldGroupCodeActivity_CreateVisabilatiyRule_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string metaDataDefinitionName = this.GetBinding<string>(FieldGroupNameBindingName);\r\n            string metaDataDefinitionLabel = this.GetBinding<string>(FieldGroupLabelBindingName);\r\n            Type type = this.GetBinding<Type>(SelectedTypeBindingName);\r\n\r\n            if (PageMetaDataFacade.IsDefinitionAllowed(GetCurrentPageId(), metaDataDefinitionName, metaDataDefinitionLabel, type.GetImmutableTypeId()))\r\n            {\r\n                int startLevel = this.GetBinding<int>(SelectedStartDisplayBindingName);\r\n                int levels = this.GetBinding<int>(SelectedInheritDisplayBindingName);\r\n                PageMetaDataDescription dataAssociationVisabilityRule = PageMetaDataDescription.Branch(startLevel, levels);\r\n\r\n                this.UpdateBinding(DataAssociationVisabilityDescriptionBindingName, dataAssociationVisabilityRule);\r\n            }\r\n            else\r\n            {\r\n                this.UpdateBinding(DataAssociationVisabilityDescriptionBindingName, null);\r\n\r\n                this.ShowFieldMessage(FieldGroupNameBindingName, \"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataWorkflow.FieldGroupNameNotValid}\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void enterDefaultValuesCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Type type = this.GetBinding<Type>(SelectedTypeBindingName);\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type.GetImmutableTypeId());\r\n\r\n            DataTypeDescriptorFormsHelper helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor);\r\n            helper.LayoutIconHandle = \"associated-data-add\";\r\n\r\n            GeneratedTypesHelper generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n            helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n            IData newData = DataFacade.BuildNew(type);\r\n\r\n            helper.UpdateWithNewBindings(this.Bindings);\r\n            helper.ObjectToBindings(newData, this.Bindings);\r\n\r\n            this.DeliverFormData(\r\n                    type.Name,\r\n                    StandardUiContainerTypes.Wizard,\r\n                    helper.GetForm(),\r\n                    this.Bindings,\r\n                    helper.GetBindingsValidationRules(newData)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Type selectedMetaDataType = this.GetBinding<Type>(SelectedTypeBindingName);\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(selectedMetaDataType.GetImmutableTypeId());\r\n\r\n            PageMetaDataDescription dataAssociationVisabilityRule = this.GetBinding<PageMetaDataDescription>(DataAssociationVisabilityDescriptionBindingName);\r\n            Guid metaDataContainerId = this.GetBinding<Guid>(SelectedContainerBindingName);\r\n            string metaDataDefinitionName = this.GetBinding<string>(FieldGroupNameBindingName);\r\n            string metaDataDefinitionLabel = this.GetBinding<string>(FieldGroupLabelBindingName);\r\n\r\n            IData newDataTemplate = null;\r\n            if (IsAnyPagesAffected())\r\n            {\r\n                DataTypeDescriptorFormsHelper helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor);\r\n\r\n                GeneratedTypesHelper generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n                helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n                newDataTemplate = DataFacade.BuildNew(selectedMetaDataType);\r\n                helper.BindingsToObject(this.Bindings, newDataTemplate);\r\n            }\r\n            \r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IPage page = GetCurrentPage();\r\n\r\n                page.AddMetaDataDefinition(metaDataDefinitionName, metaDataDefinitionLabel, selectedMetaDataType.GetImmutableTypeId(), metaDataContainerId, dataAssociationVisabilityRule.StartLevel, dataAssociationVisabilityRule.Levels);\r\n\r\n                if (newDataTemplate != null)\r\n                {\r\n                    page.AddNewMetaDataToExistingPages(metaDataDefinitionName, newDataTemplate);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n        }\r\n\r\n\r\n\r\n        private void MetaDataValid(object sender, ConditionalEventArgs e)\r\n        {\r\n            bool valid = ValidateBindings();\r\n\r\n            Type selectedMetaDataType = this.GetBinding<Type>(SelectedTypeBindingName);\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(selectedMetaDataType.GetImmutableTypeId());\r\n\r\n            DataTypeDescriptorFormsHelper helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor);\r\n\r\n            GeneratedTypesHelper generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n            helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n            IData newDataTemplate = DataFacade.BuildNew(selectedMetaDataType);\r\n\r\n            if(!BindAndValidate(helper, newDataTemplate))\r\n            {\r\n                valid = false;\r\n            }\r\n\r\n            if (valid)\r\n            {\r\n                var fieldsWithInvalidForeginKey = new List<string>();\r\n                DataReferenceFacade.TryValidateForeignKeyIntegrity(newDataTemplate, fieldsWithInvalidForeginKey);\r\n                if (fieldsWithInvalidForeginKey.Count > 0)\r\n                {\r\n                    foreach (string fieldName in fieldsWithInvalidForeginKey)\r\n                    {\r\n                        if (!generatedTypesHelper.NotEditableDataFieldDescriptorNames.Contains(fieldName))\r\n                        {\r\n                            this.ShowFieldMessage(fieldName, \"Invalid reference\");\r\n                            valid = false;\r\n                        }\r\n                    }\r\n\r\n                }\r\n            }\r\n\r\n            e.Result = valid;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddMetaDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    partial class AddMetaDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity21 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity14 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity15 = new System.Workflow.Activities.SetStateActivity();\r\n            this.if_DoesPagesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity10 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity9 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity18 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previousHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity13 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizardFormActivity4 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity17 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previousHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity3 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.enterDefaultValuesCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity16 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previousHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity5 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.if_DidFieldNameValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.createFieldGroupCodeActivity_CreateVisabilatiyRule = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.createFieldGroupCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity20 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity2 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.noTypesToAddCodeActivity_ShowMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizardFormActivity2 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.selectTypeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.noTargetDataEventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.noTargetDataEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.noTargetDataEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.noTargetDataStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.enterDefaultValuesEventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterDefaultValuesEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterDefaultValuesEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterDefaultValuesSateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.createFieldGroupEventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.createFieldGroupEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.createFieldGroupEventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.createFieldGroupStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.noTypesToAddStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.selectTypeEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectTypeEventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.noTargetDataWarningStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.enterDefaultValuesStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.createFieldGroupStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.noTypesToAddStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.selectTypeToAddStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"noTargetDataWarningStateActivity\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"enterDefaultValuesStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity10);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity9);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DoesTargetDataExists);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity21\r\n            // \r\n            this.setStateActivity21.Name = \"setStateActivity21\";\r\n            this.setStateActivity21.TargetStateName = \"enterDefaultValuesStateActivity\";\r\n            // \r\n            // setStateActivity14\r\n            // \r\n            this.setStateActivity14.Name = \"setStateActivity14\";\r\n            this.setStateActivity14.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity15\r\n            // \r\n            this.setStateActivity15.Name = \"setStateActivity15\";\r\n            this.setStateActivity15.TargetStateName = \"createFieldGroupStateActivity\";\r\n            // \r\n            // if_DoesPagesExists\r\n            // \r\n            this.if_DoesPagesExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.if_DoesPagesExists.Activities.Add(this.ifElseBranchActivity4);\r\n            this.if_DoesPagesExists.Name = \"if_DoesPagesExists\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"noTypesToAddStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"selectTypeToAddStateActivity\";\r\n            // \r\n            // ifElseBranchActivity10\r\n            // \r\n            this.ifElseBranchActivity10.Activities.Add(this.setStateActivity21);\r\n            this.ifElseBranchActivity10.Name = \"ifElseBranchActivity10\";\r\n            // \r\n            // ifElseBranchActivity9\r\n            // \r\n            this.ifElseBranchActivity9.Activities.Add(this.setStateActivity14);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.MetaDataValid);\r\n            this.ifElseBranchActivity9.Condition = codecondition2;\r\n            this.ifElseBranchActivity9.Name = \"ifElseBranchActivity9\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity15);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.if_DoesPagesExists);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidFieldNameValidate);\r\n            this.ifElseBranchActivity5.Condition = codecondition3;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DoesTypesToAddExists);\r\n            this.ifElseBranchActivity1.Condition = codecondition4;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity18\r\n            // \r\n            this.setStateActivity18.Name = \"setStateActivity18\";\r\n            this.setStateActivity18.TargetStateName = \"createFieldGroupStateActivity\";\r\n            // \r\n            // previousHandleExternalEventActivity3\r\n            // \r\n            this.previousHandleExternalEventActivity3.EventName = \"Previous\";\r\n            this.previousHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previousHandleExternalEventActivity3.Name = \"previousHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity4\r\n            // \r\n            this.cancelHandleExternalEventActivity4.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity4.Name = \"cancelHandleExternalEventActivity4\";\r\n            // \r\n            // setStateActivity13\r\n            // \r\n            this.setStateActivity13.Name = \"setStateActivity13\";\r\n            this.setStateActivity13.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // wizardFormActivity4\r\n            // \r\n            this.wizardFormActivity4.ContainerLabel = null;\r\n            this.wizardFormActivity4.FormDefinitionFileName = \"\\\\Administrative\\\\AddMetaDataNoTargetDataWarning.xml\";\r\n            this.wizardFormActivity4.Name = \"wizardFormActivity4\";\r\n            // \r\n            // setStateActivity17\r\n            // \r\n            this.setStateActivity17.Name = \"setStateActivity17\";\r\n            this.setStateActivity17.TargetStateName = \"createFieldGroupStateActivity\";\r\n            // \r\n            // previousHandleExternalEventActivity2\r\n            // \r\n            this.previousHandleExternalEventActivity2.EventName = \"Previous\";\r\n            this.previousHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previousHandleExternalEventActivity2.Name = \"previousHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // ifElseActivity3\r\n            // \r\n            this.ifElseActivity3.Activities.Add(this.ifElseBranchActivity9);\r\n            this.ifElseActivity3.Activities.Add(this.ifElseBranchActivity10);\r\n            this.ifElseActivity3.Name = \"ifElseActivity3\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // enterDefaultValuesCodeActivity_Initialize\r\n            // \r\n            this.enterDefaultValuesCodeActivity_Initialize.Name = \"enterDefaultValuesCodeActivity_Initialize\";\r\n            this.enterDefaultValuesCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.enterDefaultValuesCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity16\r\n            // \r\n            this.setStateActivity16.Name = \"setStateActivity16\";\r\n            this.setStateActivity16.TargetStateName = \"selectTypeToAddStateActivity\";\r\n            // \r\n            // previousHandleExternalEventActivity1\r\n            // \r\n            this.previousHandleExternalEventActivity1.EventName = \"Previous\";\r\n            this.previousHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previousHandleExternalEventActivity1.Name = \"previousHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity5\r\n            // \r\n            this.cancelHandleExternalEventActivity5.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity5.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity5.Name = \"cancelHandleExternalEventActivity5\";\r\n            // \r\n            // if_DidFieldNameValidate\r\n            // \r\n            this.if_DidFieldNameValidate.Activities.Add(this.ifElseBranchActivity5);\r\n            this.if_DidFieldNameValidate.Activities.Add(this.ifElseBranchActivity6);\r\n            this.if_DidFieldNameValidate.Name = \"if_DidFieldNameValidate\";\r\n            // \r\n            // createFieldGroupCodeActivity_CreateVisabilatiyRule\r\n            // \r\n            this.createFieldGroupCodeActivity_CreateVisabilatiyRule.Name = \"createFieldGroupCodeActivity_CreateVisabilatiyRule\";\r\n            this.createFieldGroupCodeActivity_CreateVisabilatiyRule.ExecuteCode += new System.EventHandler(this.createFieldGroupCodeActivity_CreateVisabilatiyRule_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddMetaDataCreateFieldGroup.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // createFieldGroupCodeActivity_Initialize\r\n            // \r\n            this.createFieldGroupCodeActivity_Initialize.Name = \"createFieldGroupCodeActivity_Initialize\";\r\n            this.createFieldGroupCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.createFieldGroupCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity20\r\n            // \r\n            this.setStateActivity20.Name = \"setStateActivity20\";\r\n            this.setStateActivity20.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity2\r\n            // \r\n            this.closeCurrentViewActivity2.Name = \"closeCurrentViewActivity2\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // noTypesToAddCodeActivity_ShowMessage\r\n            // \r\n            this.noTypesToAddCodeActivity_ShowMessage.Name = \"noTypesToAddCodeActivity_ShowMessage\";\r\n            this.noTypesToAddCodeActivity_ShowMessage.ExecuteCode += new System.EventHandler(this.noTypesToAddCodeActivity_ShowMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"createFieldGroupStateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // wizardFormActivity2\r\n            // \r\n            this.wizardFormActivity2.ContainerLabel = null;\r\n            this.wizardFormActivity2.FormDefinitionFileName = \"\\\\Administrative\\\\AddMetaDataSelectType.xml\";\r\n            this.wizardFormActivity2.Name = \"wizardFormActivity2\";\r\n            // \r\n            // selectTypeCodeActivity_Initialize\r\n            // \r\n            this.selectTypeCodeActivity_Initialize.Name = \"selectTypeCodeActivity_Initialize\";\r\n            this.selectTypeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.selectTypeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // noTargetDataEventDrivenActivity_Previous\r\n            // \r\n            this.noTargetDataEventDrivenActivity_Previous.Activities.Add(this.previousHandleExternalEventActivity3);\r\n            this.noTargetDataEventDrivenActivity_Previous.Activities.Add(this.setStateActivity18);\r\n            this.noTargetDataEventDrivenActivity_Previous.Name = \"noTargetDataEventDrivenActivity_Previous\";\r\n            // \r\n            // noTargetDataEventDrivenActivity_Cancel\r\n            // \r\n            this.noTargetDataEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity4);\r\n            this.noTargetDataEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity12);\r\n            this.noTargetDataEventDrivenActivity_Cancel.Name = \"noTargetDataEventDrivenActivity_Cancel\";\r\n            // \r\n            // noTargetDataEventDrivenActivity_Finish\r\n            // \r\n            this.noTargetDataEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.noTargetDataEventDrivenActivity_Finish.Activities.Add(this.setStateActivity13);\r\n            this.noTargetDataEventDrivenActivity_Finish.Name = \"noTargetDataEventDrivenActivity_Finish\";\r\n            // \r\n            // noTargetDataStateInitializationActivity\r\n            // \r\n            this.noTargetDataStateInitializationActivity.Activities.Add(this.wizardFormActivity4);\r\n            this.noTargetDataStateInitializationActivity.Name = \"noTargetDataStateInitializationActivity\";\r\n            // \r\n            // enterDefaultValuesEventDrivenActivity_Previous\r\n            // \r\n            this.enterDefaultValuesEventDrivenActivity_Previous.Activities.Add(this.previousHandleExternalEventActivity2);\r\n            this.enterDefaultValuesEventDrivenActivity_Previous.Activities.Add(this.setStateActivity17);\r\n            this.enterDefaultValuesEventDrivenActivity_Previous.Name = \"enterDefaultValuesEventDrivenActivity_Previous\";\r\n            // \r\n            // enterDefaultValuesEventDrivenActivity_Cancel\r\n            // \r\n            this.enterDefaultValuesEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.enterDefaultValuesEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity11);\r\n            this.enterDefaultValuesEventDrivenActivity_Cancel.Name = \"enterDefaultValuesEventDrivenActivity_Cancel\";\r\n            // \r\n            // enterDefaultValuesEventDrivenActivity_Finish\r\n            // \r\n            this.enterDefaultValuesEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.enterDefaultValuesEventDrivenActivity_Finish.Activities.Add(this.ifElseActivity3);\r\n            this.enterDefaultValuesEventDrivenActivity_Finish.Name = \"enterDefaultValuesEventDrivenActivity_Finish\";\r\n            // \r\n            // enterDefaultValuesSateInitializationActivity\r\n            // \r\n            this.enterDefaultValuesSateInitializationActivity.Activities.Add(this.enterDefaultValuesCodeActivity_Initialize);\r\n            this.enterDefaultValuesSateInitializationActivity.Name = \"enterDefaultValuesSateInitializationActivity\";\r\n            // \r\n            // createFieldGroupEventDrivenActivity_Previous\r\n            // \r\n            this.createFieldGroupEventDrivenActivity_Previous.Activities.Add(this.previousHandleExternalEventActivity1);\r\n            this.createFieldGroupEventDrivenActivity_Previous.Activities.Add(this.setStateActivity16);\r\n            this.createFieldGroupEventDrivenActivity_Previous.Name = \"createFieldGroupEventDrivenActivity_Previous\";\r\n            // \r\n            // createFieldGroupEventDrivenActivity_Cancel\r\n            // \r\n            this.createFieldGroupEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity5);\r\n            this.createFieldGroupEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity8);\r\n            this.createFieldGroupEventDrivenActivity_Cancel.Name = \"createFieldGroupEventDrivenActivity_Cancel\";\r\n            // \r\n            // createFieldGroupEventDrivenActivity_Next\r\n            // \r\n            this.createFieldGroupEventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.createFieldGroupEventDrivenActivity_Next.Activities.Add(this.createFieldGroupCodeActivity_CreateVisabilatiyRule);\r\n            this.createFieldGroupEventDrivenActivity_Next.Activities.Add(this.if_DidFieldNameValidate);\r\n            this.createFieldGroupEventDrivenActivity_Next.Name = \"createFieldGroupEventDrivenActivity_Next\";\r\n            // \r\n            // createFieldGroupStateInitializationActivity\r\n            // \r\n            this.createFieldGroupStateInitializationActivity.Activities.Add(this.createFieldGroupCodeActivity_Initialize);\r\n            this.createFieldGroupStateInitializationActivity.Activities.Add(this.wizardFormActivity1);\r\n            this.createFieldGroupStateInitializationActivity.Name = \"createFieldGroupStateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity2);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity20);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // noTypesToAddStateInitializationActivity\r\n            // \r\n            this.noTypesToAddStateInitializationActivity.Activities.Add(this.noTypesToAddCodeActivity_ShowMessage);\r\n            this.noTypesToAddStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.noTypesToAddStateInitializationActivity.Name = \"noTypesToAddStateInitializationActivity\";\r\n            // \r\n            // selectTypeEventDrivenActivity_Cancel\r\n            // \r\n            this.selectTypeEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.selectTypeEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.selectTypeEventDrivenActivity_Cancel.Name = \"selectTypeEventDrivenActivity_Cancel\";\r\n            // \r\n            // selectTypeEventDrivenActivity_Next\r\n            // \r\n            this.selectTypeEventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.selectTypeEventDrivenActivity_Next.Activities.Add(this.setStateActivity6);\r\n            this.selectTypeEventDrivenActivity_Next.Name = \"selectTypeEventDrivenActivity_Next\";\r\n            // \r\n            // selectTypeStateInitializationActivity\r\n            // \r\n            this.selectTypeStateInitializationActivity.Activities.Add(this.selectTypeCodeActivity_Initialize);\r\n            this.selectTypeStateInitializationActivity.Activities.Add(this.wizardFormActivity2);\r\n            this.selectTypeStateInitializationActivity.Name = \"selectTypeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // noTargetDataWarningStateActivity\r\n            // \r\n            this.noTargetDataWarningStateActivity.Activities.Add(this.noTargetDataStateInitializationActivity);\r\n            this.noTargetDataWarningStateActivity.Activities.Add(this.noTargetDataEventDrivenActivity_Finish);\r\n            this.noTargetDataWarningStateActivity.Activities.Add(this.noTargetDataEventDrivenActivity_Cancel);\r\n            this.noTargetDataWarningStateActivity.Activities.Add(this.noTargetDataEventDrivenActivity_Previous);\r\n            this.noTargetDataWarningStateActivity.Name = \"noTargetDataWarningStateActivity\";\r\n            // \r\n            // enterDefaultValuesStateActivity\r\n            // \r\n            this.enterDefaultValuesStateActivity.Activities.Add(this.enterDefaultValuesSateInitializationActivity);\r\n            this.enterDefaultValuesStateActivity.Activities.Add(this.enterDefaultValuesEventDrivenActivity_Finish);\r\n            this.enterDefaultValuesStateActivity.Activities.Add(this.enterDefaultValuesEventDrivenActivity_Cancel);\r\n            this.enterDefaultValuesStateActivity.Activities.Add(this.enterDefaultValuesEventDrivenActivity_Previous);\r\n            this.enterDefaultValuesStateActivity.Name = \"enterDefaultValuesStateActivity\";\r\n            // \r\n            // createFieldGroupStateActivity\r\n            // \r\n            this.createFieldGroupStateActivity.Activities.Add(this.createFieldGroupStateInitializationActivity);\r\n            this.createFieldGroupStateActivity.Activities.Add(this.createFieldGroupEventDrivenActivity_Next);\r\n            this.createFieldGroupStateActivity.Activities.Add(this.createFieldGroupEventDrivenActivity_Cancel);\r\n            this.createFieldGroupStateActivity.Activities.Add(this.createFieldGroupEventDrivenActivity_Previous);\r\n            this.createFieldGroupStateActivity.Name = \"createFieldGroupStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // noTypesToAddStateActivity\r\n            // \r\n            this.noTypesToAddStateActivity.Activities.Add(this.noTypesToAddStateInitializationActivity);\r\n            this.noTypesToAddStateActivity.Name = \"noTypesToAddStateActivity\";\r\n            // \r\n            // selectTypeToAddStateActivity\r\n            // \r\n            this.selectTypeToAddStateActivity.Activities.Add(this.selectTypeStateInitializationActivity);\r\n            this.selectTypeToAddStateActivity.Activities.Add(this.selectTypeEventDrivenActivity_Next);\r\n            this.selectTypeToAddStateActivity.Activities.Add(this.selectTypeEventDrivenActivity_Cancel);\r\n            this.selectTypeToAddStateActivity.Name = \"selectTypeToAddStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddMetaDataWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.selectTypeToAddStateActivity);\r\n            this.Activities.Add(this.noTypesToAddStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.createFieldGroupStateActivity);\r\n            this.Activities.Add(this.enterDefaultValuesStateActivity);\r\n            this.Activities.Add(this.noTargetDataWarningStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddMetaDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity selectTypeToAddStateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private EventDrivenActivity selectTypeEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity selectTypeEventDrivenActivity_Next;\r\n\r\n        private StateInitializationActivity selectTypeStateInitializationActivity;\r\n\r\n        private CodeActivity selectTypeCodeActivity_Initialize;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private CodeActivity noTypesToAddCodeActivity_ShowMessage;\r\n\r\n        private StateInitializationActivity noTypesToAddStateInitializationActivity;\r\n\r\n        private StateActivity noTypesToAddStateActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity createFieldGroupStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private StateInitializationActivity createFieldGroupStateInitializationActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity2;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity createFieldGroupEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity createFieldGroupEventDrivenActivity_Next;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private StateActivity noTargetDataWarningStateActivity;\r\n\r\n        private StateActivity enterDefaultValuesStateActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity if_DoesPagesExists;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity noTargetDataEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity noTargetDataEventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity noTargetDataStateInitializationActivity;\r\n\r\n        private EventDrivenActivity enterDefaultValuesEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity enterDefaultValuesEventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity enterDefaultValuesSateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity12;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity4;\r\n\r\n        private SetStateActivity setStateActivity13;\r\n\r\n        private SetStateActivity setStateActivity11;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity5;\r\n\r\n        private CodeActivity createFieldGroupCodeActivity_Initialize;\r\n\r\n        private CodeActivity createFieldGroupCodeActivity_CreateVisabilatiyRule;\r\n\r\n        private CodeActivity enterDefaultValuesCodeActivity_Initialize;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n\r\n        private IfElseActivity if_DidFieldNameValidate;\r\n\r\n        private SetStateActivity setStateActivity15;\r\n\r\n        private EventDrivenActivity createFieldGroupEventDrivenActivity_Previous;\r\n\r\n        private SetStateActivity setStateActivity18;\r\n\r\n        private C1Console.Workflow.Activities.PreviousHandleExternalEventActivity previousHandleExternalEventActivity3;\r\n\r\n        private SetStateActivity setStateActivity17;\r\n\r\n        private C1Console.Workflow.Activities.PreviousHandleExternalEventActivity previousHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity16;\r\n\r\n        private C1Console.Workflow.Activities.PreviousHandleExternalEventActivity previousHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity noTargetDataEventDrivenActivity_Previous;\r\n\r\n        private EventDrivenActivity enterDefaultValuesEventDrivenActivity_Previous;\r\n\r\n        private SetStateActivity setStateActivity20;\r\n\r\n        private SetStateActivity setStateActivity21;\r\n\r\n        private SetStateActivity setStateActivity14;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity10;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity9;\r\n\r\n        private IfElseActivity ifElseActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity2;\r\n\r\n        private CodeActivity codeActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/AddMetaDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1232; 986\" AutoSizeMargin=\"16; 24\" Location=\"30; 30\" Name=\"AddMetaDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 303\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 222\" Location=\"108; 231\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"127; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"137; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"300; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"310; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"237; 102\" AutoSizeMargin=\"16; 24\" Location=\"180; 261\" Name=\"selectTypeToAddStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"selectTypeStateInitializationActivity\" Size=\"150; 182\" Location=\"188; 292\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"selectTypeCodeActivity_Initialize\" Size=\"130; 41\" Location=\"198; 354\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity2\" Size=\"130; 41\" Location=\"198; 414\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"selectTypeEventDrivenActivity_Next\" Size=\"150; 182\" Location=\"188; 316\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"198; 378\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"198; 438\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"selectTypeEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"188; 340\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"198; 402\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"198; 462\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"245; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"637; 228\" Name=\"noTypesToAddStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"noTypesToAddStateInitializationActivity\" Size=\"150; 182\" Location=\"645; 259\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"noTypesToAddCodeActivity_ShowMessage\" Size=\"130; 41\" Location=\"655; 321\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"655; 381\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"345; 896\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 254\" Location=\"353; 927\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity1\" Size=\"130; 41\" Location=\"363; 989\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity2\" Size=\"130; 41\" Location=\"363; 1049\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity20\" Size=\"130; 53\" Location=\"363; 1109\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"277; 126\" AutoSizeMargin=\"16; 24\" Location=\"169; 418\" Name=\"createFieldGroupStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"createFieldGroupStateInitializationActivity\" Size=\"150; 182\" Location=\"177; 449\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"createFieldGroupCodeActivity_Initialize\" Size=\"130; 41\" Location=\"187; 511\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"187; 571\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"createFieldGroupEventDrivenActivity_Next\" Size=\"612; 616\" Location=\"177; 473\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"418; 535\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"createFieldGroupCodeActivity_CreateVisabilatiyRule\" Size=\"130; 41\" Location=\"418; 595\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"if_DidFieldNameValidate\" Size=\"592; 415\" Location=\"187; 655\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity5\" Size=\"381; 315\" Location=\"206; 726\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"if_DoesPagesExists\" Size=\"361; 234\" Location=\"216; 788\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 134\" Location=\"235; 859\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 41\" Location=\"245; 927\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 134\" Location=\"408; 859\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 53\" Location=\"418; 921\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity6\" Size=\"150; 315\" Location=\"610; 726\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity15\" Size=\"130; 53\" Location=\"620; 879\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"createFieldGroupEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"177; 497\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity5\" Size=\"130; 41\" Location=\"187; 559\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 41\" Location=\"187; 619\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"createFieldGroupEventDrivenActivity_Previous\" Size=\"150; 194\" Location=\"177; 521\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previousHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"187; 583\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity16\" Size=\"130; 53\" Location=\"187; 643\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"287; 126\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"96; 602\" Name=\"enterDefaultValuesStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"enterDefaultValuesSateInitializationActivity\" Size=\"150; 122\" Location=\"104; 633\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"enterDefaultValuesCodeActivity_Initialize\" Size=\"130; 41\" Location=\"114; 695\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"enterDefaultValuesEventDrivenActivity_Finish\" Size=\"381; 375\" Location=\"104; 657\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"229; 719\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity3\" Size=\"361; 234\" Location=\"114; 779\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity9\" Size=\"150; 134\" Location=\"133; 850\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity14\" Size=\"130; 53\" Location=\"143; 912\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity10\" Size=\"150; 134\" Location=\"306; 850\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity21\" Size=\"130; 53\" Location=\"316; 912\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"enterDefaultValuesEventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"104; 681\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"114; 743\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity11\" Size=\"130; 53\" Location=\"114; 803\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"enterDefaultValuesEventDrivenActivity_Previous\" Size=\"150; 194\" Location=\"104; 705\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previousHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"114; 767\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity17\" Size=\"130; 53\" Location=\"114; 827\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"261; 126\" AutoSizeMargin=\"16; 24\" Location=\"470; 601\" Name=\"noTargetDataWarningStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"noTargetDataStateInitializationActivity\" Size=\"150; 122\" Location=\"478; 632\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity4\" Size=\"130; 41\" Location=\"488; 694\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"noTargetDataEventDrivenActivity_Finish\" Size=\"150; 194\" Location=\"478; 656\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"488; 718\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity13\" Size=\"130; 53\" Location=\"488; 778\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"noTargetDataEventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"478; 680\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity4\" Size=\"130; 41\" Location=\"488; 742\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity12\" Size=\"130; 53\" Location=\"488; 802\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"noTargetDataEventDrivenActivity_Previous\" Size=\"150; 194\" Location=\"478; 704\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previousHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"488; 766\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity18\" Size=\"130; 53\" Location=\"488; 826\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddMetaDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddMetaDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectTypeToAddStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"selectTypeToAddStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"249\" />\r\n\t\t\t\t<ns0:Point X=\"298\" Y=\"249\" />\r\n\t\t\t\t<ns0:Point X=\"298\" Y=\"261\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"noTypesToAddStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"noTypesToAddStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"759\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"759\" Y=\"228\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"createFieldGroupStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"selectTypeToAddStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectTypeToAddStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectTypeEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"createFieldGroupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"403\" Y=\"326\" />\r\n\t\t\t\t<ns0:Point X=\"427\" Y=\"326\" />\r\n\t\t\t\t<ns0:Point X=\"427\" Y=\"406\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"406\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"418\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"selectTypeToAddStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectTypeToAddStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectTypeEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"350\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"350\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"noTypesToAddStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"noTypesToAddStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"noTypesToAddStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"878\" Y=\"269\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"269\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity20\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"546\" Y=\"937\" />\r\n\t\t\t\t<ns0:Point X=\"766\" Y=\"937\" />\r\n\t\t\t\t<ns0:Point X=\"766\" Y=\"798\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"createFieldGroupStateActivity\" SetStateName=\"setStateActivity15\" SourceActivity=\"createFieldGroupStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"createFieldGroupStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"createFieldGroupEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"createFieldGroupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"483\" />\r\n\t\t\t\t<ns0:Point X=\"451\" Y=\"483\" />\r\n\t\t\t\t<ns0:Point X=\"451\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"418\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"enterDefaultValuesStateActivity\" SetStateName=\"setStateActivity9\" SourceActivity=\"createFieldGroupStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"createFieldGroupStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"createFieldGroupEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"enterDefaultValuesStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"483\" />\r\n\t\t\t\t<ns0:Point X=\"455\" Y=\"483\" />\r\n\t\t\t\t<ns0:Point X=\"455\" Y=\"590\" />\r\n\t\t\t\t<ns0:Point X=\"239\" Y=\"590\" />\r\n\t\t\t\t<ns0:Point X=\"239\" Y=\"602\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"noTargetDataWarningStateActivity\" SetStateName=\"setStateActivity10\" SourceActivity=\"createFieldGroupStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"createFieldGroupStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"createFieldGroupEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"noTargetDataWarningStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"483\" />\r\n\t\t\t\t<ns0:Point X=\"600\" Y=\"483\" />\r\n\t\t\t\t<ns0:Point X=\"600\" Y=\"601\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity8\" SourceActivity=\"createFieldGroupStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"createFieldGroupStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"createFieldGroupEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"507\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"507\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectTypeToAddStateActivity\" SetStateName=\"setStateActivity16\" SourceActivity=\"createFieldGroupStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"createFieldGroupStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Left\" EventHandlerName=\"createFieldGroupEventDrivenActivity_Previous\" SourceConnectionIndex=\"3\" TargetStateName=\"selectTypeToAddStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"173\" Y=\"531\" />\r\n\t\t\t\t<ns0:Point X=\"162\" Y=\"531\" />\r\n\t\t\t\t<ns0:Point X=\"162\" Y=\"253\" />\r\n\t\t\t\t<ns0:Point X=\"298\" Y=\"253\" />\r\n\t\t\t\t<ns0:Point X=\"298\" Y=\"261\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity14\" SourceActivity=\"enterDefaultValuesStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"enterDefaultValuesStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"enterDefaultValuesEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"366\" Y=\"667\" />\r\n\t\t\t\t<ns0:Point X=\"447\" Y=\"667\" />\r\n\t\t\t\t<ns0:Point X=\"447\" Y=\"896\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"enterDefaultValuesStateActivity\" SetStateName=\"setStateActivity21\" SourceActivity=\"enterDefaultValuesStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"enterDefaultValuesStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"enterDefaultValuesEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"enterDefaultValuesStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"366\" Y=\"667\" />\r\n\t\t\t\t<ns0:Point X=\"391\" Y=\"667\" />\r\n\t\t\t\t<ns0:Point X=\"391\" Y=\"594\" />\r\n\t\t\t\t<ns0:Point X=\"239\" Y=\"594\" />\r\n\t\t\t\t<ns0:Point X=\"239\" Y=\"602\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity11\" SourceActivity=\"enterDefaultValuesStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"enterDefaultValuesStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"enterDefaultValuesEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"691\" />\r\n\t\t\t\t<ns0:Point X=\"386\" Y=\"691\" />\r\n\t\t\t\t<ns0:Point X=\"386\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"createFieldGroupStateActivity\" SetStateName=\"setStateActivity17\" SourceActivity=\"enterDefaultValuesStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"enterDefaultValuesStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Left\" EventHandlerName=\"enterDefaultValuesEventDrivenActivity_Previous\" SourceConnectionIndex=\"3\" TargetStateName=\"createFieldGroupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"100\" Y=\"715\" />\r\n\t\t\t\t<ns0:Point X=\"91\" Y=\"715\" />\r\n\t\t\t\t<ns0:Point X=\"91\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"418\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity13\" SourceActivity=\"noTargetDataWarningStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"noTargetDataWarningStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"noTargetDataEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"714\" Y=\"666\" />\r\n\t\t\t\t<ns0:Point X=\"727\" Y=\"666\" />\r\n\t\t\t\t<ns0:Point X=\"727\" Y=\"884\" />\r\n\t\t\t\t<ns0:Point X=\"447\" Y=\"884\" />\r\n\t\t\t\t<ns0:Point X=\"447\" Y=\"896\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity12\" SourceActivity=\"noTargetDataWarningStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"noTargetDataWarningStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"noTargetDataEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"718\" Y=\"690\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"690\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"createFieldGroupStateActivity\" SetStateName=\"setStateActivity18\" SourceActivity=\"noTargetDataWarningStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"noTargetDataWarningStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Left\" EventHandlerName=\"noTargetDataEventDrivenActivity_Previous\" SourceConnectionIndex=\"3\" TargetStateName=\"createFieldGroupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"474\" Y=\"714\" />\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"714\" />\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"418\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteAssociatedDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Extensions;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteAssociatedDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteAssociatedDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void HasDataReferences(object sender, ConditionalEventArgs e)\r\n        {\r\n            IData data = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            var brokenReferences = new List<IData>();\r\n\r\n            var references = DataReferenceFacade.GetNotOptionalReferences(data);\r\n            foreach (var reference in references)\r\n            {\r\n                DataSourceId dataSourceId = reference.DataSourceId;\r\n                if (brokenReferences.Any(brokenRef => brokenRef.DataSourceId == dataSourceId))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                brokenReferences.Add(reference);\r\n            }\r\n\r\n            e.Result = brokenReferences.Count > 0;\r\n            if (brokenReferences.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            Bindings.Add(\"ReferencedData\", DataReferenceFacade.GetBrokenReferencesReport(brokenReferences));\r\n        }\r\n\r\n        \r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            IData data = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            if (DataFacade.WillDeleteSucceed(data))\r\n            {\r\n                ProcessControllerFacade.FullDelete(data);\r\n\r\n                deleteTreeRefresher.PostRefreshMesseges(true);\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Management\", \"DeleteAssociatedDataWorkflow.CascadeDeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Management\", \"DeleteAssociatedDataWorkflow.CascadeDeleteErrorMessage\")\r\n                    );\r\n\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteAssociatedDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    partial class DeleteAssociatedDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.confirmDialogFormActivity2 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.branchHasNoRelatedData = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branchHasRelatedData = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseHasRelatedData = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.eventDrivenActivity_OK = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_OK = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.checkRelatedDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // confirmDialogFormActivity2\r\n            // \r\n            this.confirmDialogFormActivity2.ContainerLabel = null;\r\n            this.confirmDialogFormActivity2.FormDefinitionFileName = \"/Administrative/DeleteGeneratedDataStep2.xml\";\r\n            this.confirmDialogFormActivity2.Name = \"confirmDialogFormActivity2\";\r\n            // \r\n            // branchHasNoRelatedData\r\n            // \r\n            this.branchHasNoRelatedData.Activities.Add(this.setStateActivity6);\r\n            this.branchHasNoRelatedData.Name = \"branchHasNoRelatedData\";\r\n            // \r\n            // branchHasRelatedData\r\n            // \r\n            this.branchHasRelatedData.Activities.Add(this.confirmDialogFormActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasDataReferences);\r\n            this.branchHasRelatedData.Condition = codecondition1;\r\n            this.branchHasRelatedData.Name = \"branchHasRelatedData\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // ifElseHasRelatedData\r\n            // \r\n            this.ifElseHasRelatedData.Activities.Add(this.branchHasRelatedData);\r\n            this.ifElseHasRelatedData.Activities.Add(this.branchHasNoRelatedData);\r\n            this.ifElseHasRelatedData.Name = \"ifElseHasRelatedData\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteAssociatedTypeDataStep1.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finishState\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"checkRelatedDataStateActivity\";\r\n            // \r\n            // eventDrivenActivity_OK\r\n            // \r\n            this.eventDrivenActivity_OK.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.eventDrivenActivity_OK.Activities.Add(this.setStateActivity8);\r\n            this.eventDrivenActivity_OK.Name = \"eventDrivenActivity_OK\";\r\n            // \r\n            // eventDrivenActivity_Cancel\r\n            // \r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity7);\r\n            this.eventDrivenActivity_Cancel.Name = \"eventDrivenActivity_Cancel\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.ifElseHasRelatedData);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_OK\r\n            // \r\n            this.step1EventDrivenActivity_OK.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_OK.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_OK.Name = \"step1EventDrivenActivity_OK\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // checkRelatedDataStateActivity\r\n            // \r\n            this.checkRelatedDataStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_Cancel);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_OK);\r\n            this.checkRelatedDataStateActivity.Name = \"checkRelatedDataStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_OK);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // DeleteAssociatedDataWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.checkRelatedDataStateActivity);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"DeleteAssociatedDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finishState;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity initialStateActivity;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_OK;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity branchHasNoRelatedData;\r\n        private IfElseBranchActivity branchHasRelatedData;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private IfElseActivity ifElseHasRelatedData;\r\n        private EventDrivenActivity eventDrivenActivity_Cancel;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private StateActivity checkRelatedDataStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity2;\r\n        private SetStateActivity setStateActivity8;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_OK;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteAssociatedDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteAssociatedDataWorkflow\" Location=\"30; 30\" Size=\"822; 643\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteAssociatedDataWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"DeleteAssociatedDataWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"131\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"checkRelatedDataStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"checkRelatedDataStateActivity\" SourceActivity=\"initialStateActivity\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"253\" Y=\"162\" />\r\n\t\t\t\t<ns0:Point X=\"275\" Y=\"162\" />\r\n\t\t\t\t<ns0:Point X=\"275\" Y=\"284\" />\r\n\t\t\t\t<ns0:Point X=\"155\" Y=\"284\" />\r\n\t\t\t\t<ns0:Point X=\"155\" Y=\"296\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"808\" Y=\"327\" />\r\n\t\t\t\t<ns0:Point X=\"824\" Y=\"327\" />\r\n\t\t\t\t<ns0:Point X=\"824\" Y=\"95\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"95\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"131\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"555\" Y=\"480\" />\r\n\t\t\t\t<ns0:Point X=\"571\" Y=\"480\" />\r\n\t\t\t\t<ns0:Point X=\"571\" Y=\"123\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"123\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"131\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"235\" Y=\"337\" />\r\n\t\t\t\t<ns0:Point X=\"453\" Y=\"337\" />\r\n\t\t\t\t<ns0:Point X=\"453\" Y=\"391\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"eventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"243\" Y=\"361\" />\r\n\t\t\t\t<ns0:Point X=\"259\" Y=\"361\" />\r\n\t\t\t\t<ns0:Point X=\"259\" Y=\"371\" />\r\n\t\t\t\t<ns0:Point X=\"827\" Y=\"371\" />\r\n\t\t\t\t<ns0:Point X=\"827\" Y=\"123\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"123\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"131\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_OK\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"537\" Y=\"456\" />\r\n\t\t\t\t<ns0:Point X=\"571\" Y=\"456\" />\r\n\t\t\t\t<ns0:Point X=\"571\" Y=\"278\" />\r\n\t\t\t\t<ns0:Point X=\"709\" Y=\"278\" />\r\n\t\t\t\t<ns0:Point X=\"709\" Y=\"286\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"eventDrivenActivity_OK\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"225\" Y=\"385\" />\r\n\t\t\t\t<ns0:Point X=\"259\" Y=\"385\" />\r\n\t\t\t\t<ns0:Point X=\"259\" Y=\"278\" />\r\n\t\t\t\t<ns0:Point X=\"709\" Y=\"278\" />\r\n\t\t\t\t<ns0:Point X=\"709\" Y=\"286\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finishState\" Location=\"659; 131\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initialStateActivity\" Location=\"60; 121\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initialStateInitializationActivity\" Location=\"68; 152\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"78; 214\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"607; 286\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"615; 317\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"625; 379\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"625; 439\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"625; 499\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"348; 391\" Size=\"211; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"356; 422\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"366; 484\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_OK\" Location=\"356; 446\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"366; 508\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"366; 568\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"356; 470\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"366; 532\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"366; 592\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"checkRelatedDataStateActivity\" Location=\"64; 296\" Size=\"183; 118\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"stateInitializationActivity1\" Location=\"250; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseHasRelatedData\" Location=\"260; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"branchHasRelatedData\" Location=\"279; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity2\" Location=\"289; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"branchHasNoRelatedData\" Location=\"452; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"462; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Cancel\" Location=\"242; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"252; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"252; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_OK\" Location=\"242; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"252; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"252; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteDataFolderWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteDataFolderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteDataFolderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private IPage GetPage()\r\n        {\r\n            AssociatedDataElementProviderHelperEntityToken entityToken = (AssociatedDataElementProviderHelperEntityToken)this.EntityToken;\r\n\r\n            return Composite.Data.PageManager.GetPageById(new Guid(entityToken.Id));\r\n        }\r\n\r\n\r\n\r\n        private Type GetFolderType()\r\n        {\r\n            AssociatedDataElementProviderHelperEntityToken entityToken = (AssociatedDataElementProviderHelperEntityToken)this.EntityToken;\r\n\r\n            return TypeManager.GetType(entityToken.Payload);\r\n        }\r\n\r\n\r\n\r\n        private void confirmCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(\"DeleteDatas\", true);\r\n        }\r\n\r\n\r\n\r\n        private void HasDataReferences(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPage page = GetPage();\r\n\r\n            Type folderType = GetFolderType();\r\n            IEnumerable<IData> dataToDelete = page.GetFolderData(folderType);\r\n\r\n            var brokenReferences = new List<IData>();\r\n\r\n            foreach (var data in dataToDelete)\r\n            {\r\n                var references = DataReferenceFacade.GetNotOptionalReferences(data);\r\n                foreach (var reference in references)\r\n                {\r\n                    DataSourceId dataSourceId = reference.DataSourceId;\r\n                    if (brokenReferences.Any(brokenRef => brokenRef.DataSourceId.Equals(dataSourceId))\r\n                        || dataToDelete.Any(elem => elem.DataSourceId.Equals(dataSourceId)))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    brokenReferences.Add(reference);\r\n                }\r\n            }\r\n\r\n            e.Result = brokenReferences.Count > 0;\r\n            if (brokenReferences.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            Bindings.Add(\"ReferencedData\", DataReferenceFacade.GetBrokenReferencesReport(brokenReferences));\r\n        }\r\n\r\n\r\n\r\n        private void ShouldDeleteData(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.GetBinding<bool>(\"DeleteDatas\");\r\n        }\r\n\r\n\r\n\r\n        private void deleteCodeActivity_Delete_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPage page = GetPage();\r\n            Type folderType = GetFolderType();\r\n\r\n            page.RemoveFolderDefinition(folderType, this.GetBinding<bool>(\"DeleteDatas\"));\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(page.GetDataEntityToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteDataFolderWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    partial class DeleteDataFolderWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.confirmIfElseActivity_RelatedDataExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity2 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.deleteCodeActivity_Delete = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.confirmIfElseActivity_DeleteData = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.confirmCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.eventDrivenActivity_Ok = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.deleteStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.checkRelatedDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.deleteStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"deleteStateActivity\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"checkRelatedDataStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity10);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasDataReferences);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"deleteStateActivity\";\r\n            // \r\n            // confirmIfElseActivity_RelatedDataExists\r\n            // \r\n            this.confirmIfElseActivity_RelatedDataExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.confirmIfElseActivity_RelatedDataExists.Activities.Add(this.ifElseBranchActivity4);\r\n            this.confirmIfElseActivity_RelatedDataExists.Name = \"confirmIfElseActivity_RelatedDataExists\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.confirmIfElseActivity_RelatedDataExists);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ShouldDeleteData);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"deleteStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // confirmDialogFormActivity2\r\n            // \r\n            this.confirmDialogFormActivity2.ContainerLabel = null;\r\n            this.confirmDialogFormActivity2.FormDefinitionFileName = \"/Administrative/DeleteDataFolderConfirmDeletingRelatedData.xml\";\r\n            this.confirmDialogFormActivity2.Name = \"confirmDialogFormActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // deleteCodeActivity_Delete\r\n            // \r\n            this.deleteCodeActivity_Delete.Name = \"deleteCodeActivity_Delete\";\r\n            this.deleteCodeActivity_Delete.ExecuteCode += new System.EventHandler(this.deleteCodeActivity_Delete_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // confirmIfElseActivity_DeleteData\r\n            // \r\n            this.confirmIfElseActivity_DeleteData.Activities.Add(this.ifElseBranchActivity1);\r\n            this.confirmIfElseActivity_DeleteData.Activities.Add(this.ifElseBranchActivity2);\r\n            this.confirmIfElseActivity_DeleteData.Name = \"confirmIfElseActivity_DeleteData\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeleteDataFolderConfirm.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // confirmCodeActivity_Initialize\r\n            // \r\n            this.confirmCodeActivity_Initialize.Name = \"confirmCodeActivity_Initialize\";\r\n            this.confirmCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.confirmCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"confirmStateActivity\";\r\n            // \r\n            // eventDrivenActivity_Ok\r\n            // \r\n            this.eventDrivenActivity_Ok.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.eventDrivenActivity_Ok.Activities.Add(this.setStateActivity7);\r\n            this.eventDrivenActivity_Ok.Name = \"eventDrivenActivity_Ok\";\r\n            // \r\n            // eventDrivenActivity_Cancel\r\n            // \r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity8);\r\n            this.eventDrivenActivity_Cancel.Name = \"eventDrivenActivity_Cancel\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.confirmDialogFormActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // deleteStateInitializationActivity\r\n            // \r\n            this.deleteStateInitializationActivity.Activities.Add(this.deleteCodeActivity_Delete);\r\n            this.deleteStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.deleteStateInitializationActivity.Name = \"deleteStateInitializationActivity\";\r\n            // \r\n            // confirmEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Name = \"confirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmEventDrivenActivity_Finish\r\n            // \r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.confirmIfElseActivity_DeleteData);\r\n            this.confirmEventDrivenActivity_Finish.Name = \"confirmEventDrivenActivity_Finish\";\r\n            // \r\n            // confirmStateInitializationActivity\r\n            // \r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmCodeActivity_Initialize);\r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.confirmStateInitializationActivity.Name = \"confirmStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // checkRelatedDataStateActivity\r\n            // \r\n            this.checkRelatedDataStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_Cancel);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_Ok);\r\n            this.checkRelatedDataStateActivity.Name = \"checkRelatedDataStateActivity\";\r\n            // \r\n            // deleteStateActivity\r\n            // \r\n            this.deleteStateActivity.Activities.Add(this.deleteStateInitializationActivity);\r\n            this.deleteStateActivity.Name = \"deleteStateActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.confirmStateInitializationActivity);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeleteDataFolderWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.Activities.Add(this.deleteStateActivity);\r\n            this.Activities.Add(this.checkRelatedDataStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteDataFolderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity confirmEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity confirmEventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity confirmStateInitializationActivity;\r\n\r\n        private StateActivity confirmStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity deleteCodeActivity_Delete;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private StateInitializationActivity deleteStateInitializationActivity;\r\n\r\n        private StateActivity deleteStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity confirmDialogFormActivity1;\r\n\r\n        private CodeActivity confirmCodeActivity_Initialize;\r\n\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n\r\n        private StateActivity checkRelatedDataStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity confirmDialogFormActivity2;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_Ok;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_Cancel;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity confirmIfElseActivity_RelatedDataExists;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity confirmIfElseActivity_DeleteData;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteDataFolderWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1221; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"DeleteDataFolderWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"48; 131\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 122\" Location=\"56; 162\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"66; 224\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"786; 768\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"221; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"126; 274\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"confirmStateInitializationActivity\" Size=\"150; 182\" Location=\"565; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"confirmCodeActivity_Initialize\" Size=\"130; 41\" Location=\"575; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130; 41\" Location=\"575; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Finish\" Size=\"612; 556\" Location=\"557; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"798; 221\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"confirmIfElseActivity_DeleteData\" Size=\"592; 415\" Location=\"567; 281\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"381; 315\" Location=\"586; 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"confirmIfElseActivity_RelatedDataExists\" Size=\"361; 234\" Location=\"596; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 134\" Location=\"615; 485\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 53\" Location=\"625; 547\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 134\" Location=\"788; 485\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 41\" Location=\"798; 553\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 315\" Location=\"990; 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"1000; 511\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"557; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"567; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"567; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"201; 80\" AutoSizeMargin=\"16; 24\" Location=\"563; 623\" Name=\"deleteStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"deleteStateInitializationActivity\" Size=\"150; 182\" Location=\"571; 654\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"deleteCodeActivity_Delete\" Size=\"130; 41\" Location=\"581; 716\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"581; 776\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"183; 118\" AutoSizeMargin=\"16; 24\" Location=\"646; 280\" Name=\"checkRelatedDataStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity1\" Size=\"150; 122\" Location=\"654; 311\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity2\" Size=\"130; 41\" Location=\"664; 373\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"654; 335\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"664; 397\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 41\" Location=\"664; 457\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_Ok\" Size=\"150; 182\" Location=\"654; 359\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"664; 421\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"664; 481\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeleteDataFolderWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteDataFolderWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"768\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"deleteStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"deleteStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"339\" Y=\"339\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"339\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"611\" />\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"611\" />\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"623\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"343\" Y=\"363\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"363\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"756\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"756\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"768\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"deleteStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"deleteStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"deleteStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"760\" Y=\"664\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"664\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"768\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity8\" SourceActivity=\"checkRelatedDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"checkRelatedDataStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Cancel\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"825\" Y=\"345\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"345\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"768\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"deleteStateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"checkRelatedDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"checkRelatedDataStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Ok\" SourceConnectionIndex=\"2\" TargetStateName=\"deleteStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"806\" Y=\"369\" />\r\n\t\t\t\t<ns0:Point X=\"839\" Y=\"369\" />\r\n\t\t\t\t<ns0:Point X=\"839\" Y=\"611\" />\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"611\" />\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"623\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"deleteStateActivity\" SetStateName=\"setStateActivity9\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"deleteStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"339\" Y=\"339\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"339\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"611\" />\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"611\" />\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"623\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"checkRelatedDataStateActivity\" SetStateName=\"setStateActivity10\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"checkRelatedDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"339\" Y=\"339\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"339\" />\r\n\t\t\t\t<ns0:Point X=\"359\" Y=\"272\" />\r\n\t\t\t\t<ns0:Point X=\"737\" Y=\"272\" />\r\n\t\t\t\t<ns0:Point X=\"737\" Y=\"280\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"254\" Y=\"172\" />\r\n\t\t\t\t<ns0:Point X=\"268\" Y=\"172\" />\r\n\t\t\t\t<ns0:Point X=\"268\" Y=\"262\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"262\" />\r\n\t\t\t\t<ns0:Point X=\"236\" Y=\"274\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteMetaDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Events;\r\nusing System.Workflow.Activities;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteMetaDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteMetaDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private IPage GetCurrentPage()\r\n        {\r\n            if ((this.EntityToken is DataEntityToken))\r\n            {\r\n                return this.GetDataItemFromEntityToken<IPage>();\r\n            }\r\n            else\r\n            {\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void DoesDefinedMetaDataTypesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPage page = GetCurrentPage();\r\n\r\n            e.Result = page.GetDefinedMetaDataTypes().Count() > 0;\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ShowMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(\r\n                DialogType.Message,\r\n                StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow.NoDefinedTypesExists.Title\"),\r\n                StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow.NoDefinedTypesExists.Message\"));\r\n        }\r\n\r\n\r\n\r\n        private void confirmCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPage page = GetCurrentPage();\r\n\r\n            Dictionary<Pair<string, Type>, string> fieldGroupNames = new Dictionary<Pair<string, Type>, string>();\r\n            foreach (Tuple<Type, string> typeName in page.GetDefinedMetaDataTypeAndNames().OrderBy(f => f.Item2))\r\n            {\r\n                fieldGroupNames.Add(new Pair<string, Type>(typeName.Item2, typeName.Item1), typeName.Item2);\r\n            }\r\n\r\n            this.UpdateBinding(\"FieldGroupNames\", fieldGroupNames);\r\n            this.UpdateBinding(\"SelectedFieldGroupName\", fieldGroupNames.Keys.First());\r\n        }\r\n\r\n\r\n\r\n        private void deleteCodeActivity_Delete_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPage page = GetCurrentPage();\r\n\r\n            Pair<string, Type> metaDataPair = this.GetBinding<Pair<string, Type>>(\"SelectedFieldGroupName\");\r\n\r\n            page.RemoveMetaDataDefinition(metaDataPair.First);\r\n\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteMetaDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    partial class DeleteMetaDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_ShowMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.deleteCodeActivity_Delete = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.confirmCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.deleteStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.deleteStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // initializeCodeActivity_ShowMessage\r\n            // \r\n            this.initializeCodeActivity_ShowMessage.Name = \"initializeCodeActivity_ShowMessage\";\r\n            this.initializeCodeActivity_ShowMessage.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ShowMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"confirmStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.initializeCodeActivity_ShowMessage);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DoesDefinedMetaDataTypesExists);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // deleteCodeActivity_Delete\r\n            // \r\n            this.deleteCodeActivity_Delete.Name = \"deleteCodeActivity_Delete\";\r\n            this.deleteCodeActivity_Delete.ExecuteCode += new System.EventHandler(this.deleteCodeActivity_Delete_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"deleteStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeleteMetaDataConfirm.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // confirmCodeActivity_Initialize\r\n            // \r\n            this.confirmCodeActivity_Initialize.Name = \"confirmCodeActivity_Initialize\";\r\n            this.confirmCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.confirmCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // deleteStateInitializationActivity\r\n            // \r\n            this.deleteStateInitializationActivity.Activities.Add(this.deleteCodeActivity_Delete);\r\n            this.deleteStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.deleteStateInitializationActivity.Name = \"deleteStateInitializationActivity\";\r\n            // \r\n            // confirmEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Name = \"confirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmEventDrivenActivity_Finish\r\n            // \r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.confirmEventDrivenActivity_Finish.Name = \"confirmEventDrivenActivity_Finish\";\r\n            // \r\n            // confirmStateInitializationActivity\r\n            // \r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmCodeActivity_Initialize);\r\n            this.confirmStateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.confirmStateInitializationActivity.Name = \"confirmStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // deleteStateActivity\r\n            // \r\n            this.deleteStateActivity.Activities.Add(this.deleteStateInitializationActivity);\r\n            this.deleteStateActivity.Name = \"deleteStateActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.confirmStateInitializationActivity);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeleteMetaDataWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.Activities.Add(this.deleteStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteMetaDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity confirmEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity confirmEventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity confirmStateInitializationActivity;\r\n\r\n        private StateActivity confirmStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity deleteCodeActivity_Delete;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private StateInitializationActivity deleteStateInitializationActivity;\r\n\r\n        private StateActivity deleteStateActivity;\r\n\r\n        private CodeActivity confirmCodeActivity_Initialize;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private CodeActivity initializeCodeActivity_ShowMessage;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/DeleteMetaDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1190; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"DeleteMetaDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 363\" Location=\"434; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 282\" Location=\"444; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 182\" Location=\"463; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"473; 373\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 182\" Location=\"636; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_ShowMessage\" Size=\"130; 41\" Location=\"646; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"646; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"221; 102\" AutoSizeMargin=\"16; 24\" Location=\"210; 365\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"confirmStateInitializationActivity\" Size=\"150; 182\" Location=\"218; 396\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"confirmCodeActivity_Initialize\" Size=\"130; 41\" Location=\"228; 458\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"dataDialogFormActivity1\" Size=\"130; 41\" Location=\"228; 518\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"218; 420\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"228; 482\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"228; 542\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"218; 444\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"228; 506\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"228; 566\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"201; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"643; 536\" Name=\"deleteStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"deleteStateInitializationActivity\" Size=\"150; 182\" Location=\"651; 567\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"deleteCodeActivity_Delete\" Size=\"130; 41\" Location=\"661; 629\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"661; 689\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeleteMetaDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteMetaDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"320\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"320\" Y=\"365\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"deleteStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"deleteStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"430\" />\r\n\t\t\t\t<ns0:Point X=\"743\" Y=\"430\" />\r\n\t\t\t\t<ns0:Point X=\"743\" Y=\"536\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"427\" Y=\"454\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"454\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"deleteStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"deleteStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"deleteStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"840\" Y=\"577\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"577\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/EditAssociatedDataWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Scheduling;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditAssociatedDataWorkflow : FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        private bool _doPublish;\r\n\r\n        [NonSerialized]\r\n        private DataTypeDescriptorFormsHelper _helper;\r\n\r\n        private string _typeName;\r\n\r\n        public EditAssociatedDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private DataTypeDescriptorFormsHelper GetDataTypeDescriptorFormsHelper()\r\n        {\r\n            if (_helper == null)\r\n            {\r\n                var dataEntityToken = (DataEntityToken)EntityToken;\r\n                var interfaceType = dataEntityToken.Data.DataSourceId.InterfaceType;\r\n                var guid = interfaceType.GetImmutableTypeId();\r\n                var typeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n\r\n                var generatedTypesHelper = new GeneratedTypesHelper(typeDescriptor);\r\n\r\n                _helper = new DataTypeDescriptorFormsHelper(typeDescriptor, true, EntityToken);\r\n                _helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n                _typeName = typeDescriptor.Name;\r\n            }\r\n\r\n            return _helper;\r\n        }\r\n\r\n        private void editDataCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var helper = GetDataTypeDescriptorFormsHelper();\r\n            helper.LayoutIconHandle = \"associated-data-edit\";\r\n\r\n            var data = ((DataEntityToken)EntityToken).Data;\r\n            var publishedControlled = data as IPublishControlled;\r\n\r\n            if (!PermissionsFacade.GetPermissionsForCurrentUser(EntityToken).Contains(PermissionType.Publish) || publishedControlled == null)\r\n            {\r\n                var formData = WorkflowFacade.GetFormData(InstanceId, true);\r\n\r\n                if (formData.ExcludedEvents == null)\r\n                {\r\n                    formData.ExcludedEvents = new List<string>();\r\n                }\r\n\r\n                formData.ExcludedEvents.Add(\"SaveAndPublish\");\r\n            }\r\n\r\n            if (publishedControlled != null)\r\n            {\r\n                if (publishedControlled.PublicationStatus == GenericPublishProcessController.Published)\r\n                {\r\n                    publishedControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n                }\r\n            }\r\n\r\n            helper.UpdateWithBindings(data, Bindings);\r\n\r\n            DeliverFormData(\r\n                    _typeName,\r\n                    StandardUiContainerTypes.Document,\r\n                    helper.GetForm(),\r\n                    Bindings,\r\n                    helper.GetBindingsValidationRules(data)\r\n                );\r\n        }\r\n\r\n        private void saveDataCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var isValid = ValidateBindings();\r\n            var updateTreeRefresher = CreateUpdateTreeRefresher(EntityToken);\r\n            var helper = GetDataTypeDescriptorFormsHelper();\r\n\r\n            var data = ((DataEntityToken)EntityToken).Data;\r\n\r\n            if (!BindAndValidate(helper, data))\r\n            {\r\n                isValid = false;\r\n            }\r\n\r\n            if (isValid)\r\n            {\r\n                // published data stayed as published data - change to draft if status is published\r\n                if (data is IPublishControlled)\r\n                {\r\n                    var publishControlledData = (IPublishControlled)data;\r\n                    if (publishControlledData.PublicationStatus == GenericPublishProcessController.Published)\r\n                    {\r\n                        publishControlledData.PublicationStatus = GenericPublishProcessController.Draft;\r\n                    }\r\n                }\r\n\r\n                DataFacade.Update(data);\r\n\r\n                EntityTokenCacheFacade.ClearCache(EntityToken);\r\n\r\n                updateTreeRefresher.PostRefreshMessages(EntityToken);\r\n\r\n                PublishControlledHelper.PublishIfNeeded(data, _doPublish, Bindings, ShowMessage);\r\n\r\n                SetSaveStatus(true);\r\n            }\r\n            else\r\n            {\r\n                SetSaveStatus(false);\r\n            }\r\n        }\r\n\r\n        private void enablePublishCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            _doPublish = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/EditAssociatedDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    partial class EditAssociatedDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveDataCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.enablePublishCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.saveAndPublishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.editDataCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveDataStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editDataEventDrivenActivity_SaveAndPublish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editDataEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editDataStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editDataStateActivity\";\r\n            // \r\n            // saveDataCodeActivity\r\n            // \r\n            this.saveDataCodeActivity.Name = \"saveDataCodeActivity\";\r\n            this.saveDataCodeActivity.ExecuteCode += new System.EventHandler(this.saveDataCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"saveDataStateActivity\";\r\n            // \r\n            // enablePublishCodeActivity\r\n            // \r\n            this.enablePublishCodeActivity.Name = \"enablePublishCodeActivity\";\r\n            this.enablePublishCodeActivity.ExecuteCode += new System.EventHandler(this.enablePublishCodeActivity_ExecuteCode);\r\n            // \r\n            // saveAndPublishHandleExternalEventActivity1\r\n            // \r\n            this.saveAndPublishHandleExternalEventActivity1.EventName = \"SaveAndPublish\";\r\n            this.saveAndPublishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveAndPublishHandleExternalEventActivity1.Name = \"saveAndPublishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveDataStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // editDataCodeActivity\r\n            // \r\n            this.editDataCodeActivity.Name = \"editDataCodeActivity\";\r\n            this.editDataCodeActivity.ExecuteCode += new System.EventHandler(this.editDataCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editDataStateActivity\";\r\n            // \r\n            // saveDataStateInitializationActivity\r\n            // \r\n            this.saveDataStateInitializationActivity.Activities.Add(this.saveDataCodeActivity);\r\n            this.saveDataStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.saveDataStateInitializationActivity.Name = \"saveDataStateInitializationActivity\";\r\n            // \r\n            // editDataEventDrivenActivity_SaveAndPublish\r\n            // \r\n            this.editDataEventDrivenActivity_SaveAndPublish.Activities.Add(this.saveAndPublishHandleExternalEventActivity1);\r\n            this.editDataEventDrivenActivity_SaveAndPublish.Activities.Add(this.enablePublishCodeActivity);\r\n            this.editDataEventDrivenActivity_SaveAndPublish.Activities.Add(this.setStateActivity5);\r\n            this.editDataEventDrivenActivity_SaveAndPublish.Name = \"editDataEventDrivenActivity_SaveAndPublish\";\r\n            // \r\n            // editDataEventDrivenActivity_Save\r\n            // \r\n            this.editDataEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editDataEventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.editDataEventDrivenActivity_Save.Name = \"editDataEventDrivenActivity_Save\";\r\n            // \r\n            // editDataStateInitializationActivity\r\n            // \r\n            this.editDataStateInitializationActivity.Activities.Add(this.editDataCodeActivity);\r\n            this.editDataStateInitializationActivity.Name = \"editDataStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveDataStateActivity\r\n            // \r\n            this.saveDataStateActivity.Activities.Add(this.saveDataStateInitializationActivity);\r\n            this.saveDataStateActivity.Name = \"saveDataStateActivity\";\r\n            // \r\n            // editDataStateActivity\r\n            // \r\n            this.editDataStateActivity.Activities.Add(this.editDataStateInitializationActivity);\r\n            this.editDataStateActivity.Activities.Add(this.editDataEventDrivenActivity_Save);\r\n            this.editDataStateActivity.Activities.Add(this.editDataEventDrivenActivity_SaveAndPublish);\r\n            this.editDataStateActivity.Name = \"editDataStateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // EditAssociatedDataWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.editDataStateActivity);\r\n            this.Activities.Add(this.saveDataStateActivity);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"EditAssociatedDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity enablePublishCodeActivity;\r\n\r\n        private Workflow.Activities.SaveAndPublishHandleExternalEventActivity saveAndPublishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity editDataEventDrivenActivity_SaveAndPublish;\r\n\r\n        private StateActivity finishState;\r\n\r\n        private Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity initialStateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private StateInitializationActivity saveDataStateInitializationActivity;\r\n\r\n        private EventDrivenActivity editDataEventDrivenActivity_Save;\r\n\r\n        private StateInitializationActivity editDataStateInitializationActivity;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private StateActivity saveDataStateActivity;\r\n\r\n        private StateActivity editDataStateActivity;\r\n\r\n        private Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private CodeActivity editDataCodeActivity;\r\n\r\n        private CodeActivity saveDataCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/EditAssociatedDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1199; 932\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditAssociatedDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"1037; 810\" Name=\"finishState\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"212; 80\" AutoSizeMargin=\"16; 24\" Location=\"83; 150\" Name=\"initialStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150; 146\" Location=\"91; 183\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"101; 248\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"292; 110\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"218; 462\" Name=\"editDataStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editDataStateInitializationActivity\" Size=\"150; 128\" Location=\"546; 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"editDataCodeActivity\" Size=\"130; 44\" Location=\"556; 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editDataEventDrivenActivity_Save\" Size=\"150; 209\" Location=\"546; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"556; 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"556; 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editDataEventDrivenActivity_SaveAndPublish\" Size=\"150; 272\" Location=\"554; 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveAndPublishHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"564; 219\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"enablePublishCodeActivity\" Size=\"130; 44\" Location=\"564; 282\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 62\" Location=\"564; 345\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"232; 80\" AutoSizeMargin=\"16; 24\" Location=\"612; 468\" Name=\"saveDataStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveDataStateInitializationActivity\" Size=\"150; 209\" Location=\"620; 501\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveDataCodeActivity\" Size=\"130; 44\" Location=\"630; 566\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"630; 629\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditAssociatedDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditAssociatedDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1117\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1117\" Y=\"810\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editDataStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initialStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initialStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"291\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"364\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"364\" Y=\"462\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveDataStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"editDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editDataStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editDataEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"444\" Y=\"532\" />\r\n\t\t\t\t<ns0:Point X=\"522\" Y=\"532\" />\r\n\t\t\t\t<ns0:Point X=\"522\" Y=\"460\" />\r\n\t\t\t\t<ns0:Point X=\"728\" Y=\"460\" />\r\n\t\t\t\t<ns0:Point X=\"728\" Y=\"468\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editDataStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"saveDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveDataStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveDataStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"840\" Y=\"512\" />\r\n\t\t\t\t<ns0:Point X=\"852\" Y=\"512\" />\r\n\t\t\t\t<ns0:Point X=\"852\" Y=\"454\" />\r\n\t\t\t\t<ns0:Point X=\"364\" Y=\"454\" />\r\n\t\t\t\t<ns0:Point X=\"364\" Y=\"462\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveDataStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"editDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editDataStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editDataEventDrivenActivity_SaveAndPublish\" SourceConnectionIndex=\"2\" TargetStateName=\"saveDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"506\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"522\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"522\" Y=\"460\" />\r\n\t\t\t\t<ns0:Point X=\"728\" Y=\"460\" />\r\n\t\t\t\t<ns0:Point X=\"728\" Y=\"468\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/EditMetaDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    public sealed partial class EditMetaDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditMetaDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private IPage GetCurrentPage()\r\n        {\r\n            if ((this.EntityToken is DataEntityToken))\r\n            {\r\n                return this.GetDataItemFromEntityToken<IPage>();\r\n            }\r\n            else\r\n            {\r\n                return null;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Guid GetCurrentPageId()\r\n        {\r\n            IPage page = GetCurrentPage();\r\n            if (page != null)\r\n            {\r\n                return page.Id;\r\n            }\r\n            else\r\n            {\r\n                return Guid.Empty;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private List<Guid> GetOldAffectedPageIds()\r\n        {            \r\n            Pair<string, Type> metaDataPair = this.GetBinding<Pair<string, Type>>(\"SelectedMetaDataDefinition\");\r\n            IPageMetaDataDefinition pageMetaDataDefinition = PageMetaDataFacade.GetMetaDataDefinition(GetCurrentPageId(), metaDataPair.First);\r\n\r\n            IPage page = GetCurrentPage();\r\n            \r\n            return page.GetMetaDataAffectedPages(pageMetaDataDefinition.StartLevel, pageMetaDataDefinition.Levels).Select(f => f.Id).ToList();\r\n        }\r\n\r\n\r\n\r\n        private List<Guid> GetNewAffectedPageIds()\r\n        {\r\n            int startLevel = this.GetBinding<int>(\"SelectedStartDisplay\");\r\n            int levels = this.GetBinding<int>(\"SelectedInheritDisplay\");\r\n\r\n            IPage page = GetCurrentPage();\r\n\r\n            return page.GetMetaDataAffectedPages(startLevel, levels).Select(f => f.Id).ToList();\r\n        }\r\n\r\n\r\n\r\n        private void DefinedDefinitionsExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPage page = GetCurrentPage();\r\n\r\n            e.Result = page.GetDefinedMetaDataTypes().Count() > 0;\r\n        }\r\n\r\n\r\n\r\n        private void AffectedPagesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            List<Guid> oldPageIds = GetOldAffectedPageIds();\r\n            List<Guid> newPageIds = GetNewAffectedPageIds();\r\n\r\n            Pair<string, Type> metaDataPair = this.GetBinding<Pair<string, Type>>(\"SelectedMetaDataDefinition\");\r\n\r\n            IEnumerable<Guid> newPageIdsToAdd = newPageIds.Except(oldPageIds);\r\n            foreach (Guid id in newPageIdsToAdd)\r\n            {\r\n                IPage page = Composite.Data.PageManager.GetPageById(id);\r\n\r\n                if (page.GetMetaData(metaDataPair.First, metaDataPair.Second) == null)\r\n                {\r\n                    e.Result = true;\r\n                    return;\r\n                }\r\n            }\r\n\r\n            e.Result = false;\r\n        }\r\n\r\n\r\n\r\n        private void ValidateNewDefinition(object sender, ConditionalEventArgs e)\r\n        {\r\n            Pair<string, Type> metaDataPair = this.GetBinding<Pair<string, Type>>(\"SelectedMetaDataDefinition\");\r\n            IPageMetaDataDefinition pageMetaDataDefinition = PageMetaDataFacade.GetMetaDataDefinition(GetCurrentPageId(), metaDataPair.First);\r\n\r\n            e.Result = true;\r\n\r\n            string newLabel = this.GetBinding<string>(\"Label\");\r\n            Guid newMetaDataContainerId = this.GetBinding<Guid>(\"SelectedMetaDataContainer\");\r\n\r\n            Guid pageId = GetCurrentPageId();\r\n\r\n            if (pageMetaDataDefinition.Label != newLabel)\r\n            {\r\n                if (PageMetaDataFacade.IsDefinitionAllowed(pageId, pageMetaDataDefinition.Name, newLabel, pageMetaDataDefinition.MetaDataTypeId) == false)\r\n                {\r\n                    e.Result = false;\r\n                    ShowFieldMessage(\"Label\", StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataFieldNameAlreadyUsed\"));\r\n                }\r\n            }\r\n             \r\n            if (pageMetaDataDefinition.MetaDataContainerId != newMetaDataContainerId)\r\n            {\r\n                if (PageMetaDataFacade.IsNewContainerIdAllowed(pageId, pageMetaDataDefinition.Name, newMetaDataContainerId) == false)\r\n                {\r\n                    e.Result = false;\r\n                    ShowFieldMessage(\"SelectedMetaDataContainer\", StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerChangeNotAllowed\"));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ShowNoDefinedDefinitionsMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(\r\n                DialogType.Message,\r\n                StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoMetaDataDefinitionsExists.Title\"),\r\n                StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoMetaDataDefinitionsExists.Message\")\r\n            );\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPage page = GetCurrentPage();\r\n\r\n            Dictionary<Pair<string, Type>, string> fieldGroupNames = new Dictionary<Pair<string, Type>, string>();\r\n            foreach (Tuple<Type, string> typeName in page.GetDefinedMetaDataTypeAndNames().OrderBy(f => f.Item2))\r\n            {\r\n                fieldGroupNames.Add(new Pair<string, Type>(typeName.Item2, typeName.Item1), typeName.Item2);\r\n            }\r\n\r\n            this.Bindings.Add(\"MetaDataDefinitionOptions\", fieldGroupNames);\r\n            this.Bindings.Add(\"SelectedMetaDataDefinition\", fieldGroupNames.Keys.First());\r\n        }\r\n\r\n\r\n\r\n        private void editDefinitionCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {            \r\n            Pair<string, Type> metaDataPair = this.GetBinding<Pair<string, Type>>(\"SelectedMetaDataDefinition\");\r\n            IPageMetaDataDefinition pageMetaDataDefinition = PageMetaDataFacade.GetMetaDataDefinition(GetCurrentPageId(), metaDataPair.First);\r\n\r\n            this.UpdateBinding(\"Label\", pageMetaDataDefinition.Label);\r\n\r\n            List<KeyValuePair<Guid, string>> containers = PageMetaDataFacade.GetAllMetaDataContainers();\r\n            this.UpdateBinding(\"MetaDataContainerOptions\", containers);\r\n            this.UpdateBinding(\"SelectedMetaDataContainer\", pageMetaDataDefinition.MetaDataContainerId);\r\n\r\n            IPage page = GetCurrentPage();\r\n\r\n            Dictionary<int, string> startDisplayOptions = new Dictionary<int, string>();\r\n            if (page != null)\r\n            {\r\n                startDisplayOptions.Add(0, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption0\"));\r\n            }\r\n            startDisplayOptions.Add(1, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption1\"));\r\n            startDisplayOptions.Add(2, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption2\"));\r\n            startDisplayOptions.Add(3, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption3\"));\r\n            startDisplayOptions.Add(4, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption4\"));\r\n            startDisplayOptions.Add(5, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption5\"));\r\n            this.UpdateBinding(\"StartDisplayOptions\", startDisplayOptions);\r\n            this.UpdateBinding(\"SelectedStartDisplay\", pageMetaDataDefinition.StartLevel);\r\n\r\n            int levels = pageMetaDataDefinition.Levels;\r\n            if (levels > 10) levels = 10000;\r\n\r\n            Dictionary<int, string> inheritDisplayOptions = new Dictionary<int, string>();\r\n            inheritDisplayOptions.Add(0, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption0\"));\r\n            inheritDisplayOptions.Add(1, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption1\"));\r\n            inheritDisplayOptions.Add(2, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption2\"));\r\n            inheritDisplayOptions.Add(3, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption3\"));\r\n            inheritDisplayOptions.Add(10000, StringResourceSystemFacade.GetString(\"Composite.Management\", \"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption4\"));\r\n            this.UpdateBinding(\"InheritDisplayOptions\", inheritDisplayOptions);\r\n            this.UpdateBinding(\"SelectedInheritDisplay\", levels);\r\n        }\r\n\r\n\r\n\r\n        private void collectDefaultValuesCodeActivity_ShowWizzard_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Pair<string, Type> metaDataPair = this.GetBinding<Pair<string, Type>>(\"SelectedMetaDataDefinition\");\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(metaDataPair.Second);\r\n            Type metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            DataTypeDescriptorFormsHelper helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor);\r\n            helper.LayoutLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTypeElementProvider\", \"PageType.AddPageTypeMetaDataFieldWorkflow.AddingDefaultMetaData.Title\");\r\n            helper.LayoutIconHandle = \"pagetype-add-metedatafield\";\r\n\r\n            GeneratedTypesHelper generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n            helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n            IData newDataTemplate = DataFacade.BuildNew(metaDataType);\r\n\r\n            helper.UpdateWithNewBindings(this.Bindings);\r\n            helper.ObjectToBindings(newDataTemplate, this.Bindings);\r\n            this.UpdateBinding(\"NewDataTemplate\", newDataTemplate);\r\n\r\n            this.DeliverFormData(\r\n                    metaDataType.GetTypeTitle(),\r\n                    StandardUiContainerTypes.Wizard,\r\n                    helper.GetForm(),\r\n                    this.Bindings,\r\n                    helper.GetBindingsValidationRules(newDataTemplate)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                List<Guid> oldPageIds = GetOldAffectedPageIds();\r\n                List<Guid> newPageIds = GetNewAffectedPageIds();\r\n\r\n                Pair<string, Type> metaDataPair = this.GetBinding<Pair<string, Type>>(\"SelectedMetaDataDefinition\");\r\n                Guid newMetaDataContainerId = this.GetBinding<Guid>(\"SelectedMetaDataContainer\");                \r\n                string newLabel = this.GetBinding<string>(\"Label\");\r\n                int startLevel = this.GetBinding<int>(\"SelectedStartDisplay\");\r\n                int levels = this.GetBinding<int>(\"SelectedInheritDisplay\");\r\n\r\n                PageMetaDataFacade.UpdateDefinition(GetCurrentPageId(), metaDataPair.First, newLabel, startLevel, levels, newMetaDataContainerId);                \r\n\r\n                IEnumerable<Guid> oldPageIdsToRemove = oldPageIds.Except(newPageIds);\r\n                foreach (Guid id in oldPageIdsToRemove)\r\n                {\r\n                    IPage page = Composite.Data.PageManager.GetPageById(id);\r\n                    \r\n                    bool otherDefinitionExists = page.GetAllowedMetaDataDefinitions().Where(f => f.Name == metaDataPair.First).Any();\r\n\r\n                    if (otherDefinitionExists) continue;\r\n                                        \r\n                    using (new DataScope(DataScopeIdentifier.Public))\r\n                    {\r\n                        IData dataToDelete = page.GetMetaData(metaDataPair.First, metaDataPair.Second);\r\n                        if (dataToDelete != null)\r\n                        {\r\n                            DataFacade.Delete(dataToDelete);\r\n                        }\r\n                    }\r\n\r\n                    using (new DataScope(DataScopeIdentifier.Administrated))\r\n                    {\r\n                        IData dataToDelete = page.GetMetaData(metaDataPair.First, metaDataPair.Second);\r\n                        if (dataToDelete != null)\r\n                        {\r\n                            DataFacade.Delete(dataToDelete);\r\n                        }\r\n                    }\r\n                }\r\n\r\n\r\n                IData newDataTemplate = null;\r\n                if (this.BindingExist(\"NewDataTemplate\"))\r\n                {\r\n                    newDataTemplate = this.GetBinding<IData>(\"NewDataTemplate\");\r\n\r\n                    DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(metaDataPair.Second.GetImmutableTypeId());\r\n                    DataTypeDescriptorFormsHelper helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor);\r\n                    helper.BindingsToObject(this.Bindings, newDataTemplate);\r\n                }\r\n\r\n\r\n                IEnumerable<Guid> newPageIdsToAdd = newPageIds.Except(oldPageIds);\r\n                foreach (Guid id in newPageIdsToAdd)\r\n                {\r\n                    IPage page = Composite.Data.PageManager.GetPageById(id);\r\n\r\n                    page.AddNewMetaDataToExistingPage(metaDataPair.First, metaDataPair.Second, newDataTemplate);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/EditMetaDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper\r\n{\r\n    partial class EditMetaDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity15 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity14 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity16 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editDefinitionIfElseActivity_AffectedPagesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.initializeCodeActivity_ShowNoDefinedDefinitionsMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity5 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previousHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity();\r\n            this.setStateActivity13 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizardFormActivity3 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previousHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.collectDefaultValuesCodeActivity_ShowWizzard = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previousHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity();\r\n            this.editIfElseActivity_ValidateNewBinding = new System.Workflow.Activities.IfElseActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizardFormActivity2 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.editDefinitionCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.initializeIfElseActivity_DefinedDefintionsExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.noDefaultValuesNeededEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.noDefaultValuesNeededEventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.noDefaultValuesNeededEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.noDefaultValuesNeededStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.colectDefaultValuesEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.colectDefaultValuesEventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.colectDefaultValuesEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.colectDefaultValuesStateInitializationActivity3 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editDefinitionEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editDefinitionEventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editDefinitionEventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editDefinitionStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.selectDefinitionEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectDefinitionEventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectDefinitionStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.noDefaultDataNeededStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.colectDefaultValuesStateActivity3 = new System.Workflow.Activities.StateActivity();\r\n            this.editDefinitionStateActivity2 = new System.Workflow.Activities.StateActivity();\r\n            this.selectDefinitionStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity15\r\n            // \r\n            this.setStateActivity15.Name = \"setStateActivity15\";\r\n            this.setStateActivity15.TargetStateName = \"noDefaultDataNeededStateActivity\";\r\n            // \r\n            // setStateActivity14\r\n            // \r\n            this.setStateActivity14.Name = \"setStateActivity14\";\r\n            this.setStateActivity14.TargetStateName = \"colectDefaultValuesStateActivity3\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity15);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity14);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.AffectedPagesExists);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity16\r\n            // \r\n            this.setStateActivity16.Name = \"setStateActivity16\";\r\n            this.setStateActivity16.TargetStateName = \"colectDefaultValuesStateActivity3\";\r\n            // \r\n            // editDefinitionIfElseActivity_AffectedPagesExists\r\n            // \r\n            this.editDefinitionIfElseActivity_AffectedPagesExists.Activities.Add(this.ifElseBranchActivity1);\r\n            this.editDefinitionIfElseActivity_AffectedPagesExists.Activities.Add(this.ifElseBranchActivity2);\r\n            this.editDefinitionIfElseActivity_AffectedPagesExists.Name = \"editDefinitionIfElseActivity_AffectedPagesExists\";\r\n            // \r\n            // initializeCodeActivity_ShowNoDefinedDefinitionsMessage\r\n            // \r\n            this.initializeCodeActivity_ShowNoDefinedDefinitionsMessage.Name = \"initializeCodeActivity_ShowNoDefinedDefinitionsMessage\";\r\n            this.initializeCodeActivity_ShowNoDefinedDefinitionsMessage.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ShowNoDefinedDefinitionsMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"selectDefinitionStateActivity\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity16);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.editDefinitionIfElseActivity_AffectedPagesExists);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateNewDefinition);\r\n            this.ifElseBranchActivity5.Condition = codecondition2;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.initializeCodeActivity_ShowNoDefinedDefinitionsMessage);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity2);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DefinedDefinitionsExists);\r\n            this.ifElseBranchActivity3.Condition = codecondition3;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity5\r\n            // \r\n            this.cancelHandleExternalEventActivity5.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity5.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity5.Name = \"cancelHandleExternalEventActivity5\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"editDefinitionStateActivity2\";\r\n            // \r\n            // previousHandleExternalEventActivity3\r\n            // \r\n            this.previousHandleExternalEventActivity3.EventName = \"Previous\";\r\n            this.previousHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previousHandleExternalEventActivity3.Name = \"previousHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity13\r\n            // \r\n            this.setStateActivity13.Name = \"setStateActivity13\";\r\n            this.setStateActivity13.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // wizardFormActivity3\r\n            // \r\n            this.wizardFormActivity3.ContainerLabel = null;\r\n            this.wizardFormActivity3.FormDefinitionFileName = \"/Administrative/EditMetaData_NoDefaultValuesNeeded.xml\";\r\n            this.wizardFormActivity3.Name = \"wizardFormActivity3\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity4\r\n            // \r\n            this.cancelHandleExternalEventActivity4.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity4.Name = \"cancelHandleExternalEventActivity4\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"editDefinitionStateActivity2\";\r\n            // \r\n            // previousHandleExternalEventActivity2\r\n            // \r\n            this.previousHandleExternalEventActivity2.EventName = \"Previous\";\r\n            this.previousHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previousHandleExternalEventActivity2.Name = \"previousHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // collectDefaultValuesCodeActivity_ShowWizzard\r\n            // \r\n            this.collectDefaultValuesCodeActivity_ShowWizzard.Name = \"collectDefaultValuesCodeActivity_ShowWizzard\";\r\n            this.collectDefaultValuesCodeActivity_ShowWizzard.ExecuteCode += new System.EventHandler(this.collectDefaultValuesCodeActivity_ShowWizzard_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"selectDefinitionStateActivity\";\r\n            // \r\n            // previousHandleExternalEventActivity1\r\n            // \r\n            this.previousHandleExternalEventActivity1.EventName = \"Previous\";\r\n            this.previousHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previousHandleExternalEventActivity1.Name = \"previousHandleExternalEventActivity1\";\r\n            // \r\n            // editIfElseActivity_ValidateNewBinding\r\n            // \r\n            this.editIfElseActivity_ValidateNewBinding.Activities.Add(this.ifElseBranchActivity5);\r\n            this.editIfElseActivity_ValidateNewBinding.Activities.Add(this.ifElseBranchActivity6);\r\n            this.editIfElseActivity_ValidateNewBinding.Name = \"editIfElseActivity_ValidateNewBinding\";\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // wizardFormActivity2\r\n            // \r\n            this.wizardFormActivity2.ContainerLabel = null;\r\n            this.wizardFormActivity2.FormDefinitionFileName = \"/Administrative/EditMetaData_EditDefinition.xml\";\r\n            this.wizardFormActivity2.Name = \"wizardFormActivity2\";\r\n            // \r\n            // editDefinitionCodeActivity_UpdateBindings\r\n            // \r\n            this.editDefinitionCodeActivity_UpdateBindings.Name = \"editDefinitionCodeActivity_UpdateBindings\";\r\n            this.editDefinitionCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.editDefinitionCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"editDefinitionStateActivity2\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"/Administrative/EditMetaData_SelectDefinition.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // initializeIfElseActivity_DefinedDefintionsExists\r\n            // \r\n            this.initializeIfElseActivity_DefinedDefintionsExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.initializeIfElseActivity_DefinedDefintionsExists.Activities.Add(this.ifElseBranchActivity4);\r\n            this.initializeIfElseActivity_DefinedDefintionsExists.Name = \"initializeIfElseActivity_DefinedDefintionsExists\";\r\n            // \r\n            // noDefaultValuesNeededEventDrivenActivity_Cancel\r\n            // \r\n            this.noDefaultValuesNeededEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity5);\r\n            this.noDefaultValuesNeededEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity11);\r\n            this.noDefaultValuesNeededEventDrivenActivity_Cancel.Name = \"noDefaultValuesNeededEventDrivenActivity_Cancel\";\r\n            // \r\n            // noDefaultValuesNeededEventDrivenActivity_Previous\r\n            // \r\n            this.noDefaultValuesNeededEventDrivenActivity_Previous.Activities.Add(this.previousHandleExternalEventActivity3);\r\n            this.noDefaultValuesNeededEventDrivenActivity_Previous.Activities.Add(this.setStateActivity12);\r\n            this.noDefaultValuesNeededEventDrivenActivity_Previous.Name = \"noDefaultValuesNeededEventDrivenActivity_Previous\";\r\n            // \r\n            // noDefaultValuesNeededEventDrivenActivity_Finish\r\n            // \r\n            this.noDefaultValuesNeededEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.noDefaultValuesNeededEventDrivenActivity_Finish.Activities.Add(this.setStateActivity13);\r\n            this.noDefaultValuesNeededEventDrivenActivity_Finish.Name = \"noDefaultValuesNeededEventDrivenActivity_Finish\";\r\n            // \r\n            // noDefaultValuesNeededStateInitializationActivity\r\n            // \r\n            this.noDefaultValuesNeededStateInitializationActivity.Activities.Add(this.wizardFormActivity3);\r\n            this.noDefaultValuesNeededStateInitializationActivity.Name = \"noDefaultValuesNeededStateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity7);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // colectDefaultValuesEventDrivenActivity_Cancel\r\n            // \r\n            this.colectDefaultValuesEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity4);\r\n            this.colectDefaultValuesEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.colectDefaultValuesEventDrivenActivity_Cancel.Name = \"colectDefaultValuesEventDrivenActivity_Cancel\";\r\n            // \r\n            // colectDefaultValuesEventDrivenActivity_Previous\r\n            // \r\n            this.colectDefaultValuesEventDrivenActivity_Previous.Activities.Add(this.previousHandleExternalEventActivity2);\r\n            this.colectDefaultValuesEventDrivenActivity_Previous.Activities.Add(this.setStateActivity10);\r\n            this.colectDefaultValuesEventDrivenActivity_Previous.Name = \"colectDefaultValuesEventDrivenActivity_Previous\";\r\n            // \r\n            // colectDefaultValuesEventDrivenActivity_Finish\r\n            // \r\n            this.colectDefaultValuesEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.colectDefaultValuesEventDrivenActivity_Finish.Activities.Add(this.setStateActivity6);\r\n            this.colectDefaultValuesEventDrivenActivity_Finish.Name = \"colectDefaultValuesEventDrivenActivity_Finish\";\r\n            // \r\n            // colectDefaultValuesStateInitializationActivity3\r\n            // \r\n            this.colectDefaultValuesStateInitializationActivity3.Activities.Add(this.collectDefaultValuesCodeActivity_ShowWizzard);\r\n            this.colectDefaultValuesStateInitializationActivity3.Name = \"colectDefaultValuesStateInitializationActivity3\";\r\n            // \r\n            // editDefinitionEventDrivenActivity_Cancel\r\n            // \r\n            this.editDefinitionEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.editDefinitionEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.editDefinitionEventDrivenActivity_Cancel.Name = \"editDefinitionEventDrivenActivity_Cancel\";\r\n            // \r\n            // editDefinitionEventDrivenActivity_Previous\r\n            // \r\n            this.editDefinitionEventDrivenActivity_Previous.Activities.Add(this.previousHandleExternalEventActivity1);\r\n            this.editDefinitionEventDrivenActivity_Previous.Activities.Add(this.setStateActivity8);\r\n            this.editDefinitionEventDrivenActivity_Previous.Name = \"editDefinitionEventDrivenActivity_Previous\";\r\n            // \r\n            // editDefinitionEventDrivenActivity_Next\r\n            // \r\n            this.editDefinitionEventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.editDefinitionEventDrivenActivity_Next.Activities.Add(this.editIfElseActivity_ValidateNewBinding);\r\n            this.editDefinitionEventDrivenActivity_Next.Name = \"editDefinitionEventDrivenActivity_Next\";\r\n            // \r\n            // editDefinitionStateInitializationActivity\r\n            // \r\n            this.editDefinitionStateInitializationActivity.Activities.Add(this.editDefinitionCodeActivity_UpdateBindings);\r\n            this.editDefinitionStateInitializationActivity.Activities.Add(this.wizardFormActivity2);\r\n            this.editDefinitionStateInitializationActivity.Name = \"editDefinitionStateInitializationActivity\";\r\n            // \r\n            // selectDefinitionEventDrivenActivity_Cancel\r\n            // \r\n            this.selectDefinitionEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.selectDefinitionEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.selectDefinitionEventDrivenActivity_Cancel.Name = \"selectDefinitionEventDrivenActivity_Cancel\";\r\n            // \r\n            // selectDefinitionEventDrivenActivity_Next\r\n            // \r\n            this.selectDefinitionEventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.selectDefinitionEventDrivenActivity_Next.Activities.Add(this.setStateActivity9);\r\n            this.selectDefinitionEventDrivenActivity_Next.Name = \"selectDefinitionEventDrivenActivity_Next\";\r\n            // \r\n            // selectDefinitionStateInitializationActivity\r\n            // \r\n            this.selectDefinitionStateInitializationActivity.Activities.Add(this.wizardFormActivity1);\r\n            this.selectDefinitionStateInitializationActivity.Name = \"selectDefinitionStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_DefinedDefintionsExists);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // noDefaultDataNeededStateActivity\r\n            // \r\n            this.noDefaultDataNeededStateActivity.Activities.Add(this.noDefaultValuesNeededStateInitializationActivity);\r\n            this.noDefaultDataNeededStateActivity.Activities.Add(this.noDefaultValuesNeededEventDrivenActivity_Finish);\r\n            this.noDefaultDataNeededStateActivity.Activities.Add(this.noDefaultValuesNeededEventDrivenActivity_Previous);\r\n            this.noDefaultDataNeededStateActivity.Activities.Add(this.noDefaultValuesNeededEventDrivenActivity_Cancel);\r\n            this.noDefaultDataNeededStateActivity.Name = \"noDefaultDataNeededStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // colectDefaultValuesStateActivity3\r\n            // \r\n            this.colectDefaultValuesStateActivity3.Activities.Add(this.colectDefaultValuesStateInitializationActivity3);\r\n            this.colectDefaultValuesStateActivity3.Activities.Add(this.colectDefaultValuesEventDrivenActivity_Finish);\r\n            this.colectDefaultValuesStateActivity3.Activities.Add(this.colectDefaultValuesEventDrivenActivity_Previous);\r\n            this.colectDefaultValuesStateActivity3.Activities.Add(this.colectDefaultValuesEventDrivenActivity_Cancel);\r\n            this.colectDefaultValuesStateActivity3.Name = \"colectDefaultValuesStateActivity3\";\r\n            // \r\n            // editDefinitionStateActivity2\r\n            // \r\n            this.editDefinitionStateActivity2.Activities.Add(this.editDefinitionStateInitializationActivity);\r\n            this.editDefinitionStateActivity2.Activities.Add(this.editDefinitionEventDrivenActivity_Next);\r\n            this.editDefinitionStateActivity2.Activities.Add(this.editDefinitionEventDrivenActivity_Previous);\r\n            this.editDefinitionStateActivity2.Activities.Add(this.editDefinitionEventDrivenActivity_Cancel);\r\n            this.editDefinitionStateActivity2.Name = \"editDefinitionStateActivity2\";\r\n            // \r\n            // selectDefinitionStateActivity\r\n            // \r\n            this.selectDefinitionStateActivity.Activities.Add(this.selectDefinitionStateInitializationActivity);\r\n            this.selectDefinitionStateActivity.Activities.Add(this.selectDefinitionEventDrivenActivity_Next);\r\n            this.selectDefinitionStateActivity.Activities.Add(this.selectDefinitionEventDrivenActivity_Cancel);\r\n            this.selectDefinitionStateActivity.Name = \"selectDefinitionStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditMetaDataWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.selectDefinitionStateActivity);\r\n            this.Activities.Add(this.editDefinitionStateActivity2);\r\n            this.Activities.Add(this.colectDefaultValuesStateActivity3);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.noDefaultDataNeededStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditMetaDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n\r\n        private SetStateActivity setStateActivity11;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity5;\r\n\r\n        private SetStateActivity setStateActivity12;\r\n\r\n        private C1Console.Workflow.Activities.PreviousHandleExternalEventActivity previousHandleExternalEventActivity3;\r\n\r\n        private SetStateActivity setStateActivity13;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity4;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private C1Console.Workflow.Activities.PreviousHandleExternalEventActivity previousHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private C1Console.Workflow.Activities.PreviousHandleExternalEventActivity previousHandleExternalEventActivity1;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity noDefaultValuesNeededEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity noDefaultValuesNeededEventDrivenActivity_Previous;\r\n\r\n        private EventDrivenActivity noDefaultValuesNeededEventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity noDefaultValuesNeededStateInitializationActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity colectDefaultValuesEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity colectDefaultValuesEventDrivenActivity_Previous;\r\n\r\n        private EventDrivenActivity colectDefaultValuesEventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity colectDefaultValuesStateInitializationActivity3;\r\n\r\n        private EventDrivenActivity editDefinitionEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity editDefinitionEventDrivenActivity_Previous;\r\n\r\n        private EventDrivenActivity editDefinitionEventDrivenActivity_Next;\r\n\r\n        private StateInitializationActivity editDefinitionStateInitializationActivity;\r\n\r\n        private EventDrivenActivity selectDefinitionEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity selectDefinitionEventDrivenActivity_Next;\r\n\r\n        private StateInitializationActivity selectDefinitionStateInitializationActivity;\r\n\r\n        private StateActivity noDefaultDataNeededStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity colectDefaultValuesStateActivity3;\r\n\r\n        private StateActivity editDefinitionStateActivity2;\r\n\r\n        private StateActivity selectDefinitionStateActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity editDefinitionIfElseActivity_AffectedPagesExists;\r\n\r\n        private SetStateActivity setStateActivity15;\r\n\r\n        private SetStateActivity setStateActivity14;\r\n\r\n        private CodeActivity initializeCodeActivity_ShowNoDefinedDefinitionsMessage;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n\r\n        private IfElseActivity initializeIfElseActivity_DefinedDefintionsExists;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity3;\r\n\r\n        private CodeActivity collectDefaultValuesCodeActivity_ShowWizzard;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity2;\r\n\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n\r\n        private CodeActivity editDefinitionCodeActivity_UpdateBindings;\r\n\r\n        private SetStateActivity setStateActivity16;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n\r\n        private IfElseActivity editIfElseActivity_ValidateNewBinding;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Elements/ElementProviderHelpers/AssociatedDataElementProviderHelper/EditMetaDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1190; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditMetaDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 363\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"initializeIfElseActivity_DefinedDefintionsExists\" Size=\"361; 282\" Location=\"108; 231\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 182\" Location=\"127; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"137; 364\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"137; 424\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 182\" Location=\"300; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_ShowNoDefinedDefinitionsMessage\" Size=\"130; 41\" Location=\"310; 394\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"260; 102\" AutoSizeMargin=\"16; 24\" Location=\"192; 335\" Name=\"selectDefinitionStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"selectDefinitionStateInitializationActivity\" Size=\"150; 122\" Location=\"200; 366\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"210; 428\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"selectDefinitionEventDrivenActivity_Next\" Size=\"150; 182\" Location=\"200; 390\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"210; 452\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 41\" Location=\"210; 512\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"selectDefinitionEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"200; 414\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"210; 476\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"210; 536\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"259; 126\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"576; 336\" Name=\"editDefinitionStateActivity2\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editDefinitionStateInitializationActivity\" Size=\"150; 182\" Location=\"311; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"editDefinitionCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"321; 197\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity2\" Size=\"130; 41\" Location=\"321; 257\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editDefinitionEventDrivenActivity_Next\" Size=\"612; 556\" Location=\"319; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"560; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"editIfElseActivity_ValidateNewBinding\" Size=\"592; 415\" Location=\"329; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity5\" Size=\"381; 315\" Location=\"348; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"editDefinitionIfElseActivity_AffectedPagesExists\" Size=\"361; 234\" Location=\"358; 403\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 134\" Location=\"377; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity14\" Size=\"130; 53\" Location=\"387; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 134\" Location=\"550; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity15\" Size=\"130; 53\" Location=\"560; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity6\" Size=\"150; 315\" Location=\"752; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity16\" Size=\"130; 53\" Location=\"762; 494\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editDefinitionEventDrivenActivity_Previous\" Size=\"150; 182\" Location=\"311; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previousHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"321; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 41\" Location=\"321; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editDefinitionEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"311; 207\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"321; 269\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"321; 329\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"290; 126\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"109; 607\" Name=\"colectDefaultValuesStateActivity3\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"colectDefaultValuesStateInitializationActivity3\" Size=\"150; 122\" Location=\"117; 638\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"collectDefaultValuesCodeActivity_ShowWizzard\" Size=\"130; 41\" Location=\"127; 700\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"colectDefaultValuesEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"117; 662\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"127; 724\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"127; 784\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"colectDefaultValuesEventDrivenActivity_Previous\" Size=\"150; 194\" Location=\"117; 686\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previousHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"127; 748\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 53\" Location=\"127; 808\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"colectDefaultValuesEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"117; 710\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity4\" Size=\"130; 41\" Location=\"127; 772\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"127; 832\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 102\" AutoSizeMargin=\"16; 24\" Location=\"611; 816\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"619; 847\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"629; 909\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"629; 969\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"312; 126\" AutoSizeMargin=\"16; 24\" Location=\"854; 533\" Name=\"noDefaultDataNeededStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"noDefaultValuesNeededStateInitializationActivity\" Size=\"150; 122\" Location=\"862; 564\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity3\" Size=\"130; 41\" Location=\"872; 626\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"noDefaultValuesNeededEventDrivenActivity_Finish\" Size=\"150; 194\" Location=\"862; 588\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"872; 650\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity13\" Size=\"130; 53\" Location=\"872; 710\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"noDefaultValuesNeededEventDrivenActivity_Previous\" Size=\"150; 194\" Location=\"862; 612\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previousHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"872; 674\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity12\" Size=\"130; 53\" Location=\"872; 734\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"noDefaultValuesNeededEventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"862; 636\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity5\" Size=\"130; 41\" Location=\"872; 698\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity11\" Size=\"130; 53\" Location=\"872; 758\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditMetaDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditMetaDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1179\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1179\" Y=\"730\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"730\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectDefinitionStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"selectDefinitionStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"335\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editDefinitionStateActivity2\" SetStateName=\"setStateActivity9\" SourceActivity=\"selectDefinitionStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectDefinitionStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectDefinitionEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"editDefinitionStateActivity2\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"438\" Y=\"400\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"400\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"705\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"705\" Y=\"336\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"selectDefinitionStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectDefinitionStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectDefinitionEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"448\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"522\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"522\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"colectDefaultValuesStateActivity3\" SetStateName=\"setStateActivity14\" SourceActivity=\"editDefinitionStateActivity2\" TargetConnectionIndex=\"0\" SourceStateName=\"editDefinitionStateActivity2\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editDefinitionEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"colectDefaultValuesStateActivity3\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"812\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"846\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"846\" Y=\"595\" />\r\n\t\t\t\t<ns0:Point X=\"254\" Y=\"595\" />\r\n\t\t\t\t<ns0:Point X=\"254\" Y=\"607\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"noDefaultDataNeededStateActivity\" SetStateName=\"setStateActivity15\" SourceActivity=\"editDefinitionStateActivity2\" TargetConnectionIndex=\"0\" SourceStateName=\"editDefinitionStateActivity2\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editDefinitionEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"noDefaultDataNeededStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"812\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"1010\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"1010\" Y=\"533\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectDefinitionStateActivity\" SetStateName=\"setStateActivity8\" SourceActivity=\"editDefinitionStateActivity2\" TargetConnectionIndex=\"0\" SourceStateName=\"editDefinitionStateActivity2\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editDefinitionEventDrivenActivity_Previous\" SourceConnectionIndex=\"2\" TargetStateName=\"selectDefinitionStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"831\" Y=\"425\" />\r\n\t\t\t\t<ns0:Point X=\"842\" Y=\"425\" />\r\n\t\t\t\t<ns0:Point X=\"842\" Y=\"327\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"327\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"335\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"editDefinitionStateActivity2\" TargetConnectionIndex=\"0\" SourceStateName=\"editDefinitionStateActivity2\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editDefinitionEventDrivenActivity_Cancel\" SourceConnectionIndex=\"3\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"822\" Y=\"449\" />\r\n\t\t\t\t<ns0:Point X=\"1180\" Y=\"449\" />\r\n\t\t\t\t<ns0:Point X=\"1180\" Y=\"711\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"711\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"colectDefaultValuesStateActivity3\" TargetConnectionIndex=\"0\" SourceStateName=\"colectDefaultValuesStateActivity3\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"colectDefaultValuesEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"382\" Y=\"672\" />\r\n\t\t\t\t<ns0:Point X=\"713\" Y=\"672\" />\r\n\t\t\t\t<ns0:Point X=\"713\" Y=\"816\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editDefinitionStateActivity2\" SetStateName=\"setStateActivity10\" SourceActivity=\"colectDefaultValuesStateActivity3\" TargetConnectionIndex=\"0\" SourceStateName=\"colectDefaultValuesStateActivity3\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"colectDefaultValuesEventDrivenActivity_Previous\" SourceConnectionIndex=\"2\" TargetStateName=\"editDefinitionStateActivity2\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"395\" Y=\"696\" />\r\n\t\t\t\t<ns0:Point X=\"841\" Y=\"696\" />\r\n\t\t\t\t<ns0:Point X=\"841\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"705\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"705\" Y=\"336\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"colectDefaultValuesStateActivity3\" TargetConnectionIndex=\"0\" SourceStateName=\"colectDefaultValuesStateActivity3\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"colectDefaultValuesEventDrivenActivity_Cancel\" SourceConnectionIndex=\"3\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"386\" Y=\"720\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"720\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"812\" Y=\"857\" />\r\n\t\t\t\t<ns0:Point X=\"828\" Y=\"857\" />\r\n\t\t\t\t<ns0:Point X=\"828\" Y=\"790\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"790\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity13\" SourceActivity=\"noDefaultDataNeededStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"noDefaultDataNeededStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"noDefaultValuesNeededEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"1149\" Y=\"598\" />\r\n\t\t\t\t<ns0:Point X=\"1177\" Y=\"598\" />\r\n\t\t\t\t<ns0:Point X=\"1177\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"713\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"713\" Y=\"816\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editDefinitionStateActivity2\" SetStateName=\"setStateActivity12\" SourceActivity=\"noDefaultDataNeededStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"noDefaultDataNeededStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"noDefaultValuesNeededEventDrivenActivity_Previous\" SourceConnectionIndex=\"2\" TargetStateName=\"editDefinitionStateActivity2\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"1162\" Y=\"622\" />\r\n\t\t\t\t<ns0:Point X=\"1177\" Y=\"622\" />\r\n\t\t\t\t<ns0:Point X=\"1177\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"705\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"705\" Y=\"336\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity11\" SourceActivity=\"noDefaultDataNeededStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"noDefaultDataNeededStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"noDefaultValuesNeededEventDrivenActivity_Cancel\" SourceConnectionIndex=\"3\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"1153\" Y=\"646\" />\r\n\t\t\t\t<ns0:Point X=\"1178\" Y=\"646\" />\r\n\t\t\t\t<ns0:Point X=\"1178\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Events/Workflows/UserConsoleInformationScavengerWorkflow.cs",
    "content": "using System;\r\nusing System.Web.Hosting;\r\nusing System.Workflow.Activities;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Threading;\r\n\r\n\r\nnamespace Composite.C1Console.Events.Workflows\r\n{\r\n    public sealed partial class UserConsoleInformationScavengerWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public UserConsoleInformationScavengerWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void OnInitializeTimeout(object sender, EventArgs e)\r\n        {\r\n            (sender as DelayActivity).TimeoutDuration = GlobalSettingsFacade.ConsoleTimeout;\r\n        }\r\n\r\n\r\n\r\n        private void scavengeCodeActivity_Scavenge_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (HostingEnvironment.ApplicationHost.ShutdownInitiated())\r\n            {\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                using (ThreadDataManager.Initialize())\r\n                {\r\n                    ConsoleFacade.Scavenge();\r\n                }\r\n            }\r\n            catch\r\n            {\r\n                // Ignore exceptions\r\n            }\r\n        } \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Events/Workflows/UserConsoleInformationScavengerWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Events.Workflows\r\n{\r\n    partial class UserConsoleInformationScavengerWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.scavengeCodeActivity_Scavenge = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.delayActivity1 = new System.Workflow.Activities.DelayActivity();\r\n            this.scavangeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.waitEventDrivenActivity_Timeout = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.waitStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.scavengeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.waitStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"waitStateActivity\";\r\n            // \r\n            // scavengeCodeActivity_Scavenge\r\n            // \r\n            this.scavengeCodeActivity_Scavenge.Name = \"scavengeCodeActivity_Scavenge\";\r\n            this.scavengeCodeActivity_Scavenge.ExecuteCode += new System.EventHandler(this.scavengeCodeActivity_Scavenge_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"scavengeStateActivity\";\r\n            // \r\n            // delayActivity1\r\n            // \r\n            this.delayActivity1.Name = \"delayActivity1\";\r\n            this.delayActivity1.TimeoutDuration = System.TimeSpan.Parse(\"00:00:00\");\r\n            this.delayActivity1.InitializeTimeoutDuration += new System.EventHandler(this.OnInitializeTimeout);\r\n            // \r\n            // scavangeStateInitializationActivity\r\n            // \r\n            this.scavangeStateInitializationActivity.Activities.Add(this.scavengeCodeActivity_Scavenge);\r\n            this.scavangeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.scavangeStateInitializationActivity.Name = \"scavangeStateInitializationActivity\";\r\n            // \r\n            // waitEventDrivenActivity_Timeout\r\n            // \r\n            this.waitEventDrivenActivity_Timeout.Activities.Add(this.delayActivity1);\r\n            this.waitEventDrivenActivity_Timeout.Activities.Add(this.setStateActivity1);\r\n            this.waitEventDrivenActivity_Timeout.Name = \"waitEventDrivenActivity_Timeout\";\r\n            // \r\n            // waitStateInitializationActivity\r\n            // \r\n            this.waitStateInitializationActivity.Name = \"waitStateInitializationActivity\";\r\n            // \r\n            // scavengeStateActivity\r\n            // \r\n            this.scavengeStateActivity.Activities.Add(this.scavangeStateInitializationActivity);\r\n            this.scavengeStateActivity.Name = \"scavengeStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // waitStateActivity\r\n            // \r\n            this.waitStateActivity.Activities.Add(this.waitStateInitializationActivity);\r\n            this.waitStateActivity.Activities.Add(this.waitEventDrivenActivity_Timeout);\r\n            this.waitStateActivity.Name = \"waitStateActivity\";\r\n            // \r\n            // UserConsoleInformationScavengerWorkflow\r\n            // \r\n            this.Activities.Add(this.waitStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.scavengeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"waitStateActivity\";\r\n            this.Name = \"UserConsoleInformationScavengerWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity waitStateInitializationActivity;\r\n        private StateActivity finalStateActivity;\r\n        private DelayActivity delayActivity1;\r\n        private StateInitializationActivity scavangeStateInitializationActivity;\r\n        private EventDrivenActivity waitEventDrivenActivity_Timeout;\r\n        private StateActivity scavengeStateActivity;\r\n        private CodeActivity scavengeCodeActivity_Scavenge;\r\n        private SetStateActivity setStateActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateActivity waitStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Events/Workflows/UserConsoleInformationScavengerWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"UserConsoleInformationScavengerWorkflow\" Location=\"30; 30\" Size=\"1182; 996\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"scavengeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"waitStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"scavengeStateActivity\" SourceActivity=\"waitStateActivity\" EventHandlerName=\"waitEventDrivenActivity_Timeout\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"399\" Y=\"254\" />\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"254\" />\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"389\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"waitStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"scavengeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"waitStateActivity\" SourceActivity=\"scavengeStateActivity\" EventHandlerName=\"scavangeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"745\" Y=\"430\" />\r\n\t\t\t\t<ns0:Point X=\"761\" Y=\"430\" />\r\n\t\t\t\t<ns0:Point X=\"761\" Y=\"181\" />\r\n\t\t\t\t<ns0:Point X=\"297\" Y=\"181\" />\r\n\t\t\t\t<ns0:Point X=\"297\" Y=\"189\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"waitStateActivity\" Location=\"191; 189\" Size=\"212; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 109\" Name=\"waitStateInitializationActivity\" Location=\"199; 220\" />\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"waitEventDrivenActivity_Timeout\" Location=\"199; 244\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<DelayDesigner Size=\"130; 41\" Name=\"delayActivity1\" Location=\"209; 306\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"209; 366\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"scavengeStateActivity\" Location=\"532; 389\" Size=\"217; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"scavangeStateInitializationActivity\" Location=\"540; 420\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"scavengeCodeActivity_Scavenge\" Location=\"550; 482\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"550; 542\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Scheduling/BaseSchedulerWorkflow.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Workflow.Activities;\r\n\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.Threading;\r\n\r\nnamespace Composite.C1Console.Scheduling\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Shutdown)]\r\n    public abstract partial class BaseSchedulerWorkflow : StateMachineWorkflowActivity\r\n    {\r\n        private static readonly string LogTitle = typeof(BaseSchedulerWorkflow).Name;\r\n\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public DateTime Date { get; set; }\r\n\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string LocaleName { get; set; }\r\n\r\n        protected BaseSchedulerWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var delayActivity = (DelayActivity)GetActivityByName(\"waitDelayActivity\");\r\n\r\n            var now = DateTime.Now;\r\n            Log.LogVerbose(LogTitle, \"Current time: {0}, Execution time: {1}\", Date, now);\r\n\r\n            delayActivity.TimeoutDuration = Date > now ? Date - now : new TimeSpan(0);\r\n\r\n            Log.LogVerbose(LogTitle, \"Timeout in: \" + delayActivity.TimeoutDuration);\r\n        }\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            using (ThreadDataManager.Initialize())\r\n            using (ServiceLocator.EnsureThreadDataServiceScope())\r\n            {\r\n                Execute();\r\n            }\r\n        }\r\n\r\n        protected abstract void Execute();\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Scheduling/BaseSchedulerWorkflow.designer.cs",
    "content": "using System.Workflow.Activities;\r\n\r\nnamespace Composite.C1Console.Scheduling\r\n{\r\n    partial class BaseSchedulerWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.waitDelayActivity = new System.Workflow.Activities.DelayActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.waitEventDrivenActivity_Timeout = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.waitStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.waitStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finishState\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // waitDelayActivity\r\n            // \r\n            this.waitDelayActivity.Name = \"waitDelayActivity\";\r\n            this.waitDelayActivity.TimeoutDuration = System.TimeSpan.Parse(\"00:00:15\");\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"waitStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // waitEventDrivenActivity_Timeout\r\n            // \r\n            this.waitEventDrivenActivity_Timeout.Activities.Add(this.waitDelayActivity);\r\n            this.waitEventDrivenActivity_Timeout.Activities.Add(this.setStateActivity2);\r\n            this.waitEventDrivenActivity_Timeout.Name = \"waitEventDrivenActivity_Timeout\";\r\n            // \r\n            // waitStateInitializationActivity\r\n            // \r\n            this.waitStateInitializationActivity.Name = \"waitStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // waitStateActivity\r\n            // \r\n            this.waitStateActivity.Activities.Add(this.waitStateInitializationActivity);\r\n            this.waitStateActivity.Activities.Add(this.waitEventDrivenActivity_Timeout);\r\n            this.waitStateActivity.Name = \"waitStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity19);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // PagePublishSchedulerWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.waitStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"PagePublishSchedulerWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finishState;\r\n        private SetStateActivity setStateActivity19;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity waitStateInitializationActivity;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity waitStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private DelayActivity waitDelayActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private EventDrivenActivity waitEventDrivenActivity_Timeout;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity2;\r\n        private CodeActivity initializeCodeActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Scheduling/DataPublishSchedulerWorkflow.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.PublishScheduling;\r\nusing Composite.Data.Transactions;\r\n\r\n\r\nnamespace Composite.C1Console.Scheduling\r\n{\r\n    public sealed class DataPublishSchedulerWorkflow : BaseSchedulerWorkflow\r\n    {\r\n        private static readonly string LogTitle = typeof(DataPublishSchedulerWorkflow).Name;\r\n\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string DataType { get; set; }\r\n\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string DataId { get; set; }\r\n\r\n        protected override void Execute()\r\n        {\r\n            Type type = TypeManager.GetType(DataType);\r\n\r\n            using (new DataScope(DataScopeIdentifier.Administrated, CultureInfo.CreateSpecificCulture(LocaleName)))\r\n            {\r\n                DataEntityToken dataEntityToken;\r\n\r\n                using (var transaction = TransactionsFacade.CreateNewScope())\r\n                {\r\n                    var publishSchedule = PublishScheduleHelper.GetPublishSchedule(type, DataId, LocaleName);\r\n                    DataFacade.Delete(publishSchedule);\r\n\r\n                    var data = (IPublishControlled)DataFacade.TryGetDataByUniqueKey(type, DataId);\r\n                    if (data == null)\r\n                    {\r\n                        Log.LogWarning(LogTitle, $\"Failed to find data of type '{type}' by id '{DataId}'.\");\r\n\r\n                        transaction.Complete();\r\n                        return;\r\n                    }\r\n\r\n                    dataEntityToken = data.GetDataEntityToken();\r\n                    \r\n                    var transitions = ProcessControllerFacade.GetValidTransitions(data).Keys;\r\n\r\n                    if (transitions.Contains(GenericPublishProcessController.Published))\r\n                    {\r\n                        data.PublicationStatus = GenericPublishProcessController.Published;\r\n\r\n                        DataFacade.Update(data);\r\n\r\n                        Log.LogVerbose(LogTitle, $\"Scheduled publishing of data with label '{data.GetLabel()}' is complete\");\r\n                    }\r\n                    else\r\n                    {\r\n                        Log.LogWarning(LogTitle, $\"Scheduled publishing of data with label '{data.GetLabel()}' could not be done because the data is not in a publisheble state\");\r\n                    }\r\n\r\n                    transaction.Complete();\r\n                }\r\n                \r\n                EntityTokenCacheFacade.ClearCache(dataEntityToken);\r\n                PublishControlledHelper.ReloadDataElementInConsole(dataEntityToken);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Scheduling/DataUnpublishSchedulerWorkflow.cs",
    "content": "using System.ComponentModel;\r\nusing System.Globalization;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.PublishScheduling;\r\nusing Composite.Data.Transactions;\r\n\r\n\r\nnamespace Composite.C1Console.Scheduling\r\n{\r\n    public sealed class DataUnpublishSchedulerWorkflow : BaseSchedulerWorkflow\r\n    {\r\n        private static readonly string LogTitle = typeof(DataUnpublishSchedulerWorkflow).Name;\r\n\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string DataType { get; set; }\r\n\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public string DataId { get; set; }\r\n\r\n        protected override void Execute()\r\n        {\r\n            var type = TypeManager.GetType(DataType);\r\n\r\n            using (new DataScope(DataScopeIdentifier.Administrated, CultureInfo.CreateSpecificCulture(LocaleName)))\r\n            {\r\n                DataEntityToken dataEntityToken;\r\n\r\n                using (var transaction = TransactionsFacade.CreateNewScope())\r\n                {\r\n                    var unpublishSchedule = PublishScheduleHelper.GetUnpublishSchedule(type, DataId, LocaleName);\r\n                    Verify.IsNotNull(unpublishSchedule, \"Missing an unpublish data schedule record\");\r\n\r\n                    DataFacade.Delete(unpublishSchedule);\r\n\r\n                    var data = (IPublishControlled)DataFacade.TryGetDataByUniqueKey(type, DataId);\r\n                    if (data == null)\r\n                    {\r\n                        Log.LogWarning(LogTitle, $\"Failed to find data of type '{type}' by id '{DataId}'.\");\r\n\r\n                        transaction.Complete();\r\n                        return;\r\n                    }\r\n\r\n                    var deletePublished = false;\r\n\r\n                    dataEntityToken = data.GetDataEntityToken();\r\n\r\n                    var transitions = ProcessControllerFacade.GetValidTransitions(data).Keys;\r\n\r\n                    if (transitions.Contains(GenericPublishProcessController.Draft))\r\n                    {\r\n                        data.PublicationStatus = GenericPublishProcessController.Draft;\r\n\r\n                        DataFacade.Update(data);\r\n\r\n                        deletePublished = true;\r\n                    }\r\n                    else\r\n                    {\r\n                        Log.LogWarning(LogTitle, $\"Scheduled unpublishing of data with label '{data.GetLabel()}' could not be done because the data is not in a unpublisheble state\");\r\n                    }\r\n\r\n\r\n                    if (deletePublished)\r\n                    {\r\n                        using (new DataScope(DataScopeIdentifier.Public))\r\n                        {\r\n                            var deletedData = (IPublishControlled)DataFacade.GetDataByUniqueKey(type, DataId);\r\n                            if (deletedData != null)\r\n                            {\r\n                                DataFacade.Delete(deletedData, CascadeDeleteType.Disable);\r\n\r\n                                Log.LogVerbose(LogTitle, $\"Scheduled unpublishing of data with label '{deletedData.GetLabel()}' is complete\");\r\n                            }\r\n                        }\r\n                    }\r\n\r\n                    transaction.Complete();\r\n                }\r\n\r\n                EntityTokenCacheFacade.ClearCache(dataEntityToken);\r\n                PublishControlledHelper.ReloadDataElementInConsole(dataEntityToken);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Scheduling/PagePublishSchedulerWorkflow.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing Composite.Data;\r\nusing Composite.Data.PublishScheduling;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.C1Console.Scheduling\r\n{\r\n    [Obsolete]\r\n    public sealed class PagePublishSchedulerWorkflow : BaseSchedulerWorkflow\r\n    {\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public Guid PageId { get; set; }\r\n\r\n        protected override void Execute()\r\n        {\r\n            using (new DataScope(DataScopeIdentifier.Administrated, CultureInfo.CreateSpecificCulture(LocaleName)))\r\n            {\r\n                var pagePublishSchedule = PublishScheduleHelper.GetPublishSchedule(typeof(IPage), PageId.ToString(), LocaleName);\r\n                DataFacade.Delete(pagePublishSchedule);\r\n\r\n                // NOTE: publication logic removed\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Scheduling/PageUnpublishSchedulerWorkflow.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing Composite.Data;\r\nusing Composite.Data.PublishScheduling;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.C1Console.Scheduling\r\n{\r\n    [Obsolete]\r\n    public sealed class PageUnpublishSchedulerWorkflow : BaseSchedulerWorkflow\r\n    {\r\n        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r\n        public Guid PageId { get; set; }\r\n\r\n        protected override void Execute()\r\n        {\r\n            using (new DataScope(DataScopeIdentifier.Administrated, CultureInfo.CreateSpecificCulture(LocaleName)))\r\n            {\r\n                var pageUnpublishSchedule = PublishScheduleHelper.GetUnpublishSchedule(typeof (IPage), PageId.ToString(), LocaleName);\r\n                Verify.IsNotNull(pageUnpublishSchedule, \"Missing an unpublish page schedule record.\");\r\n\r\n                DataFacade.Delete(pageUnpublishSchedule);\r\n\r\n                // NOTE: Unpublication logic removed\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Scheduling/PublishControlledHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Workflow.Runtime;\r\n\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.PublishScheduling;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Elements.ElementProviders.PageElementProvider;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Management;\r\n\r\nnamespace Composite.C1Console.Scheduling\r\n{\r\n    public class PublishControlledHelper\r\n    {\r\n        public static void HandlePublishUnpublishWorkflows(IData selectedData, string cultureName, DateTime? publishDate, DateTime? unpublishDate, ref WorkflowInstance publishWorkflowInstance, ref WorkflowInstance unpublishWorkflowInstance)\r\n        {\r\n            var key = selectedData.GetUniqueKey().ToString();\r\n\r\n            var existingPublishSchedule = PublishScheduleHelper.GetPublishSchedule(selectedData.DataSourceId.InterfaceType, key, cultureName);\r\n            if (existingPublishSchedule != null)\r\n            {\r\n                WorkflowFacade.AbortWorkflow(existingPublishSchedule.WorkflowInstanceId);\r\n\r\n                DataFacade.Delete(existingPublishSchedule);\r\n            }\r\n\r\n            if (publishDate != null)\r\n            {\r\n                publishWorkflowInstance = WorkflowFacade.CreateNewWorkflow(\r\n                        typeof(DataPublishSchedulerWorkflow),\r\n                        new Dictionary<string, object> \r\n                        { \r\n                            { \"Date\", publishDate },\r\n                            { \"DataType\", selectedData.DataSourceId.InterfaceType.FullName },\r\n                            { \"DataId\", selectedData.GetUniqueKey().ToString() },\r\n                            { \"LocaleName\", cultureName }\r\n                        }\r\n                    );\r\n\r\n                PublishScheduleHelper.CreatePublishSchedule(selectedData.DataSourceId.InterfaceType, selectedData.GetUniqueKey().ToString(), cultureName, publishDate.Value, publishWorkflowInstance);\r\n            }\r\n\r\n            var existingUnpublishSchedule = PublishScheduleHelper.GetUnpublishSchedule(selectedData.DataSourceId.InterfaceType, key, cultureName);\r\n            if (existingUnpublishSchedule != null)\r\n            {\r\n                WorkflowFacade.AbortWorkflow(existingUnpublishSchedule.WorkflowInstanceId);\r\n\r\n                DataFacade.Delete(existingUnpublishSchedule);\r\n            }\r\n\r\n            if (unpublishDate != null)\r\n            {\r\n                unpublishWorkflowInstance = WorkflowFacade.CreateNewWorkflow(\r\n                        typeof(DataUnpublishSchedulerWorkflow),\r\n                        new Dictionary<string, object> \r\n                        { \r\n                            { \"Date\", unpublishDate },\r\n                            { \"DataType\", selectedData.DataSourceId.InterfaceType.FullName },\r\n                            { \"DataId\", key },\r\n                            { \"LocaleName\", cultureName }\r\n                        }\r\n                    );\r\n\r\n                PublishScheduleHelper.CreateUnpublishSchedule(selectedData.DataSourceId.InterfaceType, key, cultureName, unpublishDate.Value, unpublishWorkflowInstance);\r\n            }\r\n        }\r\n\r\n        public static void ReloadPageElementInConsole(IPage page)\r\n        {\r\n            var parentPageId = PageManager.GetParentId(page.Id);\r\n            var parentPage = parentPageId != Guid.Empty ? PageManager.GetPageById(parentPageId) : null;\r\n\r\n            var parentEntityToken = (parentPage != null)\r\n                                        ? parentPage.GetDataEntityToken()\r\n                                        : (EntityToken)new PageElementProviderEntityToken(\"PageElementProvider\");\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem { EntityToken = parentEntityToken }, null);\r\n        }\r\n\r\n        public static void ReloadDataElementInConsole(DataEntityToken dataEntityToken)\r\n        {\r\n            if (dataEntityToken == null) throw new ArgumentNullException(nameof(dataEntityToken));\r\n\r\n            var parentEntityTokens = AuxiliarySecurityAncestorFacade.GetParents(dataEntityToken);\r\n\r\n            if (parentEntityTokens != null) \r\n            {\r\n                foreach (var parentEntityToken in parentEntityTokens)\r\n                {\r\n                    ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem { EntityToken = parentEntityToken }, null);\r\n                }\r\n            }\r\n        }\r\n\r\n        public static bool PublishIfNeeded(IData data, bool doPublish, IDictionary<string, object> binding, Action<DialogType, string, string> messageAction)\r\n        {\r\n            if (!(data is IPublishControlled))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            WorkflowInstance publishWorkflowInstance = null;\r\n            WorkflowInstance unpublishWorkflowInstance = null;\r\n\r\n            var publishDate = binding.ContainsKey(\"PublishDate\") ? (DateTime?)binding[\"PublishDate\"] : null;\r\n            var unpublishDate = binding.ContainsKey(\"UnpublishDate\") ? (DateTime?)binding[\"UnpublishDate\"] : null;\r\n\r\n            string cultureName = UserSettings.ActiveLocaleCultureInfo.Name;\r\n            HandlePublishUnpublishWorkflows(data, cultureName, publishDate, unpublishDate, ref publishWorkflowInstance, ref unpublishWorkflowInstance);\r\n\r\n            if (publishWorkflowInstance != null)\r\n            {\r\n                publishWorkflowInstance.Start();\r\n\r\n                WorkflowFacade.RunWorkflow(publishWorkflowInstance);\r\n            }\r\n\r\n            if (unpublishWorkflowInstance != null)\r\n            {\r\n                unpublishWorkflowInstance.Start();\r\n\r\n                WorkflowFacade.RunWorkflow(unpublishWorkflowInstance);\r\n            }\r\n\r\n            if (!doPublish)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            if (publishWorkflowInstance == null || publishDate < DateTime.Now)\r\n            {\r\n                var actionToken = new GenericPublishProcessController.PublishActionToken();\r\n                var serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n\r\n                ActionExecutorFacade.Execute(data.GetDataEntityToken(), actionToken, serviceContainer);\r\n\r\n                return true;\r\n            }\r\n\r\n            var title = Texts.Website_Forms_Administrative_EditPage_PublishDatePreventPublishTitle;\r\n            var message = Texts.Website_Forms_Administrative_EditPage_PublishDatePreventPublish;\r\n\r\n            messageAction(DialogType.Warning, title, message);\r\n\r\n            return false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Tools/SendMessageToConsolesWorkflow.cs",
    "content": "using System;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Tools\r\n{\r\n    public sealed partial class SendMessageToConsolesWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public SendMessageToConsolesWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_InitializeBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.UpdateBinding(\"Title\", \"\");\r\n            this.UpdateBinding(\"Message\", \"\");\r\n        }\r\n\r\n\r\n\r\n        private void sendMessageCodeActivity_SendMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.CloseCurrentView();\r\n\r\n            string title = this.GetBinding<string>(\"Title\");\r\n            string message = this.GetBinding<string>(\"Message\");\r\n            \r\n            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n            managementConsoleMessageService.ShowGlobalMessage(DialogType.Message, title, message);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Tools/SendMessageToConsolesWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Tools\r\n{\r\n    partial class SendMessageToConsolesWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.sendMessageCodeActivity_SendMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_InitializeBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.sendMessageStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.enterMessageEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterMessageEventDrivenActivity_Ok = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterMessageStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.sendMessageStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.enterMessageStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // sendMessageCodeActivity_SendMessage\r\n            // \r\n            this.sendMessageCodeActivity_SendMessage.Name = \"sendMessageCodeActivity_SendMessage\";\r\n            this.sendMessageCodeActivity_SendMessage.ExecuteCode += new System.EventHandler(this.sendMessageCodeActivity_SendMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"sendMessageStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"/Administrative/SendMessageToConsoles_EnterMessage.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"enterMessageStateActivity\";\r\n            // \r\n            // initializeCodeActivity_InitializeBindings\r\n            // \r\n            this.initializeCodeActivity_InitializeBindings.Name = \"initializeCodeActivity_InitializeBindings\";\r\n            this.initializeCodeActivity_InitializeBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_InitializeBindings_ExecuteCode);\r\n            // \r\n            // sendMessageStateInitializationActivity\r\n            // \r\n            this.sendMessageStateInitializationActivity.Activities.Add(this.sendMessageCodeActivity_SendMessage);\r\n            this.sendMessageStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.sendMessageStateInitializationActivity.Name = \"sendMessageStateInitializationActivity\";\r\n            // \r\n            // enterMessageEventDrivenActivity_Cancel\r\n            // \r\n            this.enterMessageEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.enterMessageEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.enterMessageEventDrivenActivity_Cancel.Name = \"enterMessageEventDrivenActivity_Cancel\";\r\n            // \r\n            // enterMessageEventDrivenActivity_Ok\r\n            // \r\n            this.enterMessageEventDrivenActivity_Ok.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.enterMessageEventDrivenActivity_Ok.Activities.Add(this.setStateActivity4);\r\n            this.enterMessageEventDrivenActivity_Ok.Name = \"enterMessageEventDrivenActivity_Ok\";\r\n            // \r\n            // enterMessageStateInitializationActivity\r\n            // \r\n            this.enterMessageStateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.enterMessageStateInitializationActivity.Name = \"enterMessageStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_InitializeBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // sendMessageStateActivity\r\n            // \r\n            this.sendMessageStateActivity.Activities.Add(this.sendMessageStateInitializationActivity);\r\n            this.sendMessageStateActivity.Name = \"sendMessageStateActivity\";\r\n            // \r\n            // enterMessageStateActivity\r\n            // \r\n            this.enterMessageStateActivity.Activities.Add(this.enterMessageStateInitializationActivity);\r\n            this.enterMessageStateActivity.Activities.Add(this.enterMessageEventDrivenActivity_Ok);\r\n            this.enterMessageStateActivity.Activities.Add(this.enterMessageEventDrivenActivity_Cancel);\r\n            this.enterMessageStateActivity.Name = \"enterMessageStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // SendMessageToConsolesWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.enterMessageStateActivity);\r\n            this.Activities.Add(this.sendMessageStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"SendMessageToConsolesWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity enterMessageEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity enterMessageEventDrivenActivity_Ok;\r\n\r\n        private StateInitializationActivity enterMessageStateInitializationActivity;\r\n\r\n        private StateActivity sendMessageStateActivity;\r\n\r\n        private StateActivity enterMessageStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity initializeCodeActivity_InitializeBindings;\r\n\r\n        private StateInitializationActivity sendMessageStateInitializationActivity;\r\n\r\n        private CodeActivity sendMessageCodeActivity_SendMessage;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Tools/SendMessageToConsolesWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1146; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"SendMessageToConsolesWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_InitializeBindings\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"253; 102\" AutoSizeMargin=\"16; 24\" Location=\"282; 345\" Name=\"enterMessageStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"enterMessageStateInitializationActivity\" Size=\"150; 122\" Location=\"290; 376\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"dataDialogFormActivity1\" Size=\"130; 41\" Location=\"300; 438\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"enterMessageEventDrivenActivity_Ok\" Size=\"150; 182\" Location=\"290; 400\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"300; 462\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"300; 522\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"enterMessageEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"290; 424\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"300; 486\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"300; 546\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"237; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"578; 573\" Name=\"sendMessageStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"sendMessageStateInitializationActivity\" Size=\"150; 182\" Location=\"521; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"sendMessageCodeActivity_SendMessage\" Size=\"130; 41\" Location=\"531; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"531; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"SendMessageToConsolesWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"SendMessageToConsolesWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"enterMessageStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"enterMessageStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"408\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"408\" Y=\"345\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"enterMessageStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"enterMessageStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"enterMessageEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"531\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"sendMessageStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"enterMessageStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"enterMessageStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"enterMessageEventDrivenActivity_Ok\" SourceConnectionIndex=\"1\" TargetStateName=\"sendMessageStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"512\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"696\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"696\" Y=\"573\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"sendMessageStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"sendMessageStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"sendMessageStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"811\" Y=\"614\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"614\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Tools/SetTimeZoneWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web.Hosting;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.ResourceSystem;\r\n\r\nnamespace Composite.C1Console.Tools\r\n{\r\n    public sealed partial class SetTimeZoneWorkflow : Workflow.Activities.FormsWorkflow\r\n    {\r\n        private const string TimezoneXslt = @\"<?xml version=\"\"1.0\"\" encoding=\"\"utf-8\"\"?>\r\n                                                <xsl:stylesheet version=\"\"1.0\"\" xmlns:xsl=\"\"http://www.w3.org/1999/XSL/Transform\"\" \r\n                                                xmlns:msxsl=\"\"urn:schemas-microsoft-com:xslt\"\" exclude-result-prefixes=\"\"msxsl\"\">\r\n                                                <xsl:param name = \"\"theTimezone\"\" select='\"\"{0}\"\"'/>\r\n                                                  <xsl:output method = \"\"xml\"\" indent=\"\"yes\"\"/>\r\n                                                  <xsl:template match = \"\"@* | node()\"\" >\r\n                                                    <xsl:copy>\r\n                                                      <xsl:apply-templates select = \"\"@* | node()\"\"/>\r\n                                                    </xsl:copy>\r\n                                                  </xsl:template>\r\n                                                  <xsl:template match = \"\"GlobalSettingsProviderPlugins/add/@timezone\"\">\r\n                                                    <xsl:attribute name = \"\"timezone\"\">\r\n                                                       <xsl:value-of select = \"\"$theTimezone\"\"/>\r\n                                                      </xsl:attribute>\r\n                                                  </xsl:template>\r\n                                                  <xsl:template match = \"\"GlobalSettingsProviderPlugins/add[not(@timezone)]\"\">\r\n                                                    <xsl:copy>\r\n\t\t                                                <xsl:attribute name = \"\"timezone\"\" >\r\n                                                            <xsl:value-of select = \"\"$theTimezone\"\"/>\r\n                                                         </xsl:attribute>\r\n\t\t                                                <xsl:apply-templates select = \"\"@*|node()\"\"/>\r\n                                                    </xsl:copy>\r\n                                                  </xsl:template>\r\n                                                </xsl:stylesheet>\";\r\n        public SetTimeZoneWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        \r\n        private void initializeCodeActivity_InitializeBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string label;\r\n            var tzs = TimeZoneInfo.GetSystemTimeZones().ToDictionary(systemTimeZone => systemTimeZone.Id, systemTimeZone => \r\n                StringResourceSystemFacade.TryGetString(\"Composite.Plugins.TimezoneDisplayNames\",\r\n                    \"TimezoneDisplayName.\" + systemTimeZone.Id, out label)\r\n                ? label\r\n                : systemTimeZone.DisplayName);\r\n\r\n            var bindings = new Dictionary<string, object>\r\n            {\r\n                {\"TimeZones\", tzs},\r\n                {\"TimeZonesSelected\",GlobalSettingsFacade.TimeZone.Id }\r\n            };\r\n\r\n            Bindings = bindings;\r\n        }\r\n\r\n\r\n\r\n        private void sendMessageCodeActivity_SendMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            CloseCurrentView();\r\n\r\n            var timeZoneStandardName = GetBinding<string>(\"TimeZonesSelected\");\r\n\r\n            var timezoneId = TimeZoneInfo.FindSystemTimeZoneById(timeZoneStandardName);\r\n            \r\n            var timezoneTransform = XDocument.Parse(String.Format(TimezoneXslt, timezoneId.Id));\r\n\r\n            ConfigurationServices.TransformConfiguration(timezoneTransform,false);\r\n\r\n            HostingEnvironment.InitiateShutdown();\r\n\r\n            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            IManagementConsoleMessageService managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n            \r\n            managementConsoleMessageService.ShowGlobalMessage(DialogType.Message,\r\n                    StringResourceSystemFacade.GetString(\"Composite.Management\", \"SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedTitle\"),\r\n                    StringResourceSystemFacade.GetString(\"Composite.Management\", \"SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedMessage\"));\r\n\r\n            managementConsoleMessageService.RebootConsole();\r\n\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Tools/SetTimeZoneWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Tools\r\n{\r\n    partial class SetTimeZoneWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.sendMessageCodeActivity_SendMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_InitializeBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.sendMessageStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.enterMessageEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterMessageEventDrivenActivity_Ok = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.enterMessageStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.sendMessageStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.enterMessageStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // sendMessageCodeActivity_SendMessage\r\n            // \r\n            this.sendMessageCodeActivity_SendMessage.Name = \"sendMessageCodeActivity_SendMessage\";\r\n            this.sendMessageCodeActivity_SendMessage.ExecuteCode += new System.EventHandler(this.sendMessageCodeActivity_SendMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"sendMessageStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"/Administrative/SetTimeZone_select.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"enterMessageStateActivity\";\r\n            // \r\n            // initializeCodeActivity_InitializeBindings\r\n            // \r\n            this.initializeCodeActivity_InitializeBindings.Name = \"initializeCodeActivity_InitializeBindings\";\r\n            this.initializeCodeActivity_InitializeBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_InitializeBindings_ExecuteCode);\r\n            // \r\n            // sendMessageStateInitializationActivity\r\n            // \r\n            this.sendMessageStateInitializationActivity.Activities.Add(this.sendMessageCodeActivity_SendMessage);\r\n            this.sendMessageStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.sendMessageStateInitializationActivity.Name = \"sendMessageStateInitializationActivity\";\r\n            // \r\n            // enterMessageEventDrivenActivity_Cancel\r\n            // \r\n            this.enterMessageEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.enterMessageEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.enterMessageEventDrivenActivity_Cancel.Name = \"enterMessageEventDrivenActivity_Cancel\";\r\n            // \r\n            // enterMessageEventDrivenActivity_Ok\r\n            // \r\n            this.enterMessageEventDrivenActivity_Ok.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.enterMessageEventDrivenActivity_Ok.Activities.Add(this.setStateActivity4);\r\n            this.enterMessageEventDrivenActivity_Ok.Name = \"enterMessageEventDrivenActivity_Ok\";\r\n            // \r\n            // enterMessageStateInitializationActivity\r\n            // \r\n            this.enterMessageStateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.enterMessageStateInitializationActivity.Name = \"enterMessageStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_InitializeBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // sendMessageStateActivity\r\n            // \r\n            this.sendMessageStateActivity.Activities.Add(this.sendMessageStateInitializationActivity);\r\n            this.sendMessageStateActivity.Name = \"sendMessageStateActivity\";\r\n            // \r\n            // enterMessageStateActivity\r\n            // \r\n            this.enterMessageStateActivity.Activities.Add(this.enterMessageStateInitializationActivity);\r\n            this.enterMessageStateActivity.Activities.Add(this.enterMessageEventDrivenActivity_Ok);\r\n            this.enterMessageStateActivity.Activities.Add(this.enterMessageEventDrivenActivity_Cancel);\r\n            this.enterMessageStateActivity.Name = \"enterMessageStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // SendMessageToConsolesWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.enterMessageStateActivity);\r\n            this.Activities.Add(this.sendMessageStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"SendMessageToConsolesWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity enterMessageEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity enterMessageEventDrivenActivity_Ok;\r\n\r\n        private StateInitializationActivity enterMessageStateInitializationActivity;\r\n\r\n        private StateActivity sendMessageStateActivity;\r\n\r\n        private StateActivity enterMessageStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity initializeCodeActivity_InitializeBindings;\r\n\r\n        private StateInitializationActivity sendMessageStateInitializationActivity;\r\n\r\n        private CodeActivity sendMessageCodeActivity_SendMessage;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/AddApplicationWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements.Plugins.ElementAttachingProvider;\r\nusing Composite.Data.Transactions;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddApplicationWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddApplicationWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void IsThereAnyTrees(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"SelectedTreeId\");\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Dictionary<string, string> selectableTreeIds = new Dictionary<string, string>();\r\n            foreach (Tree tree in TreeFacade.AllTrees)\r\n            {\r\n                if (tree.HasPossibleAttachmentPoints(this.EntityToken) == false) continue;\r\n                if (tree.HasAttachmentPoints(this.EntityToken)) continue;\r\n\r\n                selectableTreeIds.Add(tree.TreeId, tree.AllowedAttachmentApplicationName);\r\n            }\r\n\r\n\r\n            if (selectableTreeIds.Count > 0)\r\n            {\r\n                this.UpdateBinding(\"SelectedTreeId\", selectableTreeIds.First().Key);\r\n                this.UpdateBinding(\"SelectableTreeIds\", selectableTreeIds);\r\n\r\n                Dictionary<string, string> selectablePositions = Enum.GetNames(typeof(ElementAttachingProviderPosition)).ToDictionary(f => f);\r\n                this.UpdateBinding(\"SelectedPosition\", selectablePositions.First().Key);\r\n                this.UpdateBinding(\"SelectablePositions\", selectablePositions);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            object keyValue = dataEntityToken.DataSourceId.GetKeyValue();\r\n\r\n            string treeId = this.GetBinding<string>(\"SelectedTreeId\");\r\n            string serializedPosition = this.GetBinding<string>(\"SelectedPosition\");\r\n\r\n            ElementAttachingProviderPosition position = (ElementAttachingProviderPosition)Enum.Parse(typeof(ElementAttachingProviderPosition), serializedPosition);\r\n\r\n            TreeFacade.AddPersistedAttachmentPoint(treeId, dataEntityToken.InterfaceType, keyValue, position);\r\n\r\n            this.RefreshCurrentEntityToken();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ShowNoTreesMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(DialogType.Message, \"${Composite.C1Console.Trees, AddApplication.NoTrees.Title}\", \"${Composite.C1Console.Trees, AddApplication.NoTrees.Message}\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/AddApplicationWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class AddApplicationWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_ShowNoTreesMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.initializeIfElseActivity_AnyTrees = new System.Workflow.Activities.IfElseActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // initializeCodeActivity_ShowNoTreesMessage\r\n            // \r\n            this.initializeCodeActivity_ShowNoTreesMessage.Name = \"initializeCodeActivity_ShowNoTreesMessage\";\r\n            this.initializeCodeActivity_ShowNoTreesMessage.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ShowNoTreesMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.initializeCodeActivity_ShowNoTreesMessage);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsThereAnyTrees);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\TreeAddApplication.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // initializeIfElseActivity_AnyTrees\r\n            // \r\n            this.initializeIfElseActivity_AnyTrees.Activities.Add(this.ifElseBranchActivity1);\r\n            this.initializeIfElseActivity_AnyTrees.Activities.Add(this.ifElseBranchActivity2);\r\n            this.initializeIfElseActivity_AnyTrees.Name = \"initializeIfElseActivity_AnyTrees\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_AnyTrees);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddApplicationWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddApplicationWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity5;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity initializeIfElseActivity_AnyTrees;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity initializeCodeActivity_ShowNoTreesMessage;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/AddApplicationWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1196; 959\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddApplicationWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"63; 105\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 423\" Location=\"437; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"562; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"initializeIfElseActivity_AnyTrees\" Size=\"361; 282\" Location=\"447; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 182\" Location=\"466; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"476; 433\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 182\" Location=\"639; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_ShowNoTreesMessage\" Size=\"130; 41\" Location=\"649; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"649; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"860; 730\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 118\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"271; 317\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"279; 348\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step1WizardFormActivity\" Size=\"130; 41\" Location=\"289; 410\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"279; 372\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"289; 434\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"289; 494\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"279; 396\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"289; 458\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"289; 518\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"567; 532\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"575; 563\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"585; 625\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"585; 685\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddApplicationWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddApplicationWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"940\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"940\" Y=\"730\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"376\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"376\" Y=\"317\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"478\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"940\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"940\" Y=\"730\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"474\" Y=\"406\" />\r\n\t\t\t\t<ns0:Point X=\"669\" Y=\"406\" />\r\n\t\t\t\t<ns0:Point X=\"669\" Y=\"532\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"768\" Y=\"573\" />\r\n\t\t\t\t<ns0:Point X=\"940\" Y=\"573\" />\r\n\t\t\t\t<ns0:Point X=\"940\" Y=\"730\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/AddTreeDefinitionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddTreeDefinitionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddTreeDefinitionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(\"DefinitionName\", \"\");\r\n\r\n            this.Bindings.Add(\"TemplatesList\", new Dictionary<string, string> {\r\n                { \"Empty\", \"Empty\" },\r\n                { \"Folder grouping\", \"Folder grouping\" },\r\n                { \"Parent filtering\", \"Parent filtering\" }\r\n            });\r\n            this.Bindings.Add(\"TemplateName\", \"Empty\");\r\n\r\n            this.Bindings.Add(\"PositionsList\", new Dictionary<string, string> {\r\n                  { \"Content\", \"Content\" },\r\n                  { \"Media\", \"Media\" },\r\n                  { \"Layout\", \"Layout\" },\r\n                  { \"Data\", \"Data\" },\r\n                  { \"Function\", \"Function\" },\r\n                  { \"User\", \"User\" },\r\n                  { \"System\", \"System\" },\r\n                  { \"PerspectivesRoot\", \"PerspectivesRoot\" }\r\n            });\r\n            this.Bindings.Add(\"PositionName\", \"Content\");\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string definitionName = this.GetBinding<string>(\"DefinitionName\");\r\n            string templateName = this.GetBinding<string>(\"TemplateName\");\r\n            string positionName = this.GetBinding<string>(\"PositionName\");\r\n\r\n            string template;\r\n\r\n            switch (templateName)\r\n            {\r\n                case \"Empty\":\r\n                    template = string.Format(@\"<?xml version=\"\"1.0\"\" encoding=\"\"UTF-8\"\"?>\r\n<ElementStructure xmlns=\"\"http://http://www.composite.net/ns/management/trees/treemarkup/1.0\"\" xmlns:f=\"\"http://www.composite.net/ns/function/1.0\"\">\r\n\r\n  <ElementStructure.AutoAttachments>\r\n    <NamedParent Name=\"\"{0}\"\" Position=\"\"Top\"\"/>\r\n  </ElementStructure.AutoAttachments>\r\n\r\n  <ElementRoot>\r\n    <Children>      \r\n        <Element Label=\"\"Simple tree\"\" Id=\"\"SimpleTree\"\" />\r\n    </Children>\r\n  </ElementRoot>\r\n</ElementStructure>\", positionName);\r\n                    break;\r\n\r\n                case \"Folder grouping\":\r\n                    template = string.Format(@\"<?xml version=\"\"1.0\"\" encoding=\"\"UTF-8\"\"?>\r\n<ElementStructure xmlns=\"\"http://http://www.composite.net/ns/management/trees/treemarkup/1.0\"\" xmlns:f=\"\"http://www.composite.net/ns/function/1.0\"\">\r\n\r\n\r\n  <ElementStructure.AutoAttachments>\r\n    <NamedParent Name=\"\"{0}\"\" Position=\"\"Top\"\"/>\r\n  </ElementStructure.AutoAttachments>\r\n\r\n  <ElementRoot>\r\n    <Children>      \r\n      <Element Label=\"\"My DSL Tree Demo\"\" Id=\"\"FolderGroupingId1\"\">\r\n        <Children>\r\n          <Element Label=\"\"Simple Element\"\" Id=\"\"FolderGroupingId2\"\">            \r\n            <Children>              \r\n              <DataFolderElements Type=\"\"Composite.Data.Types.IPage\"\" FieldGroupingName=\"\"ChangeDate\"\" DateFormat=\"\"yyyy - MMMM\"\">\r\n                <Children>\r\n                  <DataFolderElements FieldGroupingName=\"\"Description\"\">\r\n                    <Children>\r\n                      <DataElements Type=\"\"Composite.Data.Types.IPage\"\">\r\n                      </DataElements>\r\n                    </Children>\r\n                  </DataFolderElements>\r\n                </Children>\r\n              </DataFolderElements>\r\n            </Children>\r\n          </Element>\r\n        </Children>\r\n      </Element>\r\n    </Children>\r\n  </ElementRoot>\r\n</ElementStructure>\", positionName);\r\n                    break;\r\n\r\n                case \"Parent filtering\":\r\n                    template = string.Format(@\"<?xml version=\"\"1.0\"\" encoding=\"\"UTF-8\"\"?>\r\n<ElementStructure xmlns=\"\"http://http://www.composite.net/ns/management/trees/treemarkup/1.0\"\" xmlns:f=\"\"http://www.composite.net/ns/function/1.0\"\">\r\n\r\n\r\n  <ElementStructure.AutoAttachments>\r\n    <NamedParent Name=\"\"{0}\"\" Position=\"\"Top\"\"/>\r\n  </ElementStructure.AutoAttachments>\r\n\r\n  <ElementRoot>\r\n    <Children>      \r\n      <Element Label=\"\"My DSL Tree Demo\"\" Id=\"\"ParentFilteringId1\"\">\r\n        <Children>\r\n          <Element Label=\"\"Simple Element\"\" Id=\"\"ParentFilteringId2\"\">            \r\n            <Children>              \r\n              <DataElements Type=\"\"Composite.Data.Types.IPageTemplate\"\">\r\n                <Children>\r\n                  <DataElements Type=\"\"Composite.Data.Types.IPage\"\">\r\n                    <Filters>\r\n                      <ParentIdFilter ParentType=\"\"Composite.Data.Types.IPageTemplate\"\" ReferenceFieldName=\"\"TemplateId\"\" />\r\n                    </Filters>\r\n                  </DataElements>\r\n                </Children>\r\n              </DataElements>\r\n            </Children>\r\n          </Element>\r\n        </Children>\r\n      </Element>\r\n    </Children>\r\n  </ElementRoot>\r\n</ElementStructure>\", positionName);\r\n                    break;\r\n\r\n                default:\r\n                    throw new InvalidOperationException();\r\n            }\r\n\r\n\r\n            string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TreeDefinitionsDirectory), definitionName + \".xml\");\r\n\r\n            C1File.WriteAllText(filename, template);\r\n\r\n            this.RefreshRootEntityToken();\r\n        }\r\n\r\n\r\n\r\n        private void IsTreeIdFree(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            string definitionName = this.GetBinding<string>(\"DefinitionName\");\r\n\r\n            string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TreeDefinitionsDirectory), definitionName + \".xml\");\r\n\r\n            e.Result = C1File.Exists(filename) == false;\r\n\r\n            if (e.Result == false)\r\n            {\r\n                this.ShowFieldMessage(\"DefinitionName\", \"Definition name is already used\");\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/AddTreeDefinitionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class AddTreeDefinitionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.selectIfElseActivity_TreeIdFree = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.selectTemplateEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectTemplateStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.selectTemplateStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"selectTemplateStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsTreeIdFree);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // selectIfElseActivity_TreeIdFree\r\n            // \r\n            this.selectIfElseActivity_TreeIdFree.Activities.Add(this.ifElseBranchActivity1);\r\n            this.selectIfElseActivity_TreeIdFree.Activities.Add(this.ifElseBranchActivity2);\r\n            this.selectIfElseActivity_TreeIdFree.Name = \"selectIfElseActivity_TreeIdFree\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"/Administrative/TreeAddTreeDefinition.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"selectTemplateStateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // selectTemplateEventDrivenActivity_Finish\r\n            // \r\n            this.selectTemplateEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.selectTemplateEventDrivenActivity_Finish.Activities.Add(this.selectIfElseActivity_TreeIdFree);\r\n            this.selectTemplateEventDrivenActivity_Finish.Name = \"selectTemplateEventDrivenActivity_Finish\";\r\n            // \r\n            // selectTemplateStateInitializationActivity\r\n            // \r\n            this.selectTemplateStateInitializationActivity.Activities.Add(this.wizardFormActivity1);\r\n            this.selectTemplateStateInitializationActivity.Name = \"selectTemplateStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // selectTemplateStateActivity\r\n            // \r\n            this.selectTemplateStateActivity.Activities.Add(this.selectTemplateStateInitializationActivity);\r\n            this.selectTemplateStateActivity.Activities.Add(this.selectTemplateEventDrivenActivity_Finish);\r\n            this.selectTemplateStateActivity.Name = \"selectTemplateStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddTreeDefinitionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.selectTemplateStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddTreeDefinitionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateActivity selectTemplateStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity selectTemplateStateInitializationActivity;\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private SetStateActivity setStateActivity3;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity selectTemplateEventDrivenActivity_Finish;\r\n        private StateActivity finalizeStateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity selectIfElseActivity_TreeIdFree;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/AddTreeDefinitionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1164; 986\" AutoSizeMargin=\"16; 24\" Location=\"30; 30\" Name=\"AddTreeDefinitionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_Initialize\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"255; 80\" AutoSizeMargin=\"16; 24\" Location=\"292; 369\" Name=\"selectTemplateStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"selectTemplateStateInitializationActivity\" Size=\"150; 122\" Location=\"300; 400\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"310; 462\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"selectTemplateEventDrivenActivity_Finish\" Size=\"381; 363\" Location=\"300; 424\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"425; 486\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"selectIfElseActivity_TreeIdFree\" Size=\"361; 222\" Location=\"310; 546\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"329; 617\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"339; 679\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"502; 617\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"512; 679\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"680; 550\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"688; 581\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"698; 643\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"698; 703\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddTreeDefinitionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddTreeDefinitionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectTemplateStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"selectTemplateStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"419\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"419\" Y=\"369\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"selectTemplateStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectTemplateStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectTemplateEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"543\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"782\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"782\" Y=\"550\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectTemplateStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"selectTemplateStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectTemplateStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectTemplateEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"selectTemplateStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"543\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"555\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"555\" Y=\"361\" />\r\n\t\t\t\t<ns0:Point X=\"419\" Y=\"361\" />\r\n\t\t\t\t<ns0:Point X=\"419\" Y=\"369\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"881\" Y=\"591\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"591\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/ConfirmActionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Functions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    public sealed partial class ConfirmActionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public ConfirmActionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n      \r\n\r\n        private void initializeCodeActivity_UpdateBinding_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ConfirmActionNode confirmActionNode = (ConfirmActionNode)ActionNode.Deserialize(this.Payload);\r\n\r\n            DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext = CreateDynamicValuesHelperReplaceContext();\r\n\r\n            this.Bindings.Add(\"Label\", confirmActionNode.ConfirmTitleDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext));\r\n            this.Bindings.Add(\"Message\", confirmActionNode.ConfirmMessageDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext));\r\n        }\r\n\r\n\r\n\r\n        private void showConfirmCodeActivity_ExecuteFunction_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ConfirmActionNode confirmActionNode = (ConfirmActionNode)ActionNode.Deserialize(this.Payload);\r\n\r\n            DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext = CreateDynamicValuesHelperReplaceContext();\r\n\r\n            AttributeDynamicValuesHelper attributeDynamicValuesHelper = new AttributeDynamicValuesHelper(confirmActionNode.FunctionMarkup);\r\n            attributeDynamicValuesHelper.Initialize(confirmActionNode.OwnerNode);\r\n            XElement markup = confirmActionNode.FunctionMarkupDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext);\r\n\r\n            BaseRuntimeTreeNode baseRuntimeTreeNode = FunctionTreeBuilder.Build(markup);\r\n            object value = baseRuntimeTreeNode.GetValue();\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/ConfirmActionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class ConfirmActionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showConfirmCodeActivity_ExecuteFunction = new System.Workflow.Activities.CodeActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_UpdateBinding = new System.Workflow.Activities.CodeActivity();\r\n            this.showConfirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showConfirmEventDrivenActivity_Ok = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showConfirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.showConfirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // showConfirmCodeActivity_ExecuteFunction\r\n            // \r\n            this.showConfirmCodeActivity_ExecuteFunction.Name = \"showConfirmCodeActivity_ExecuteFunction\";\r\n            this.showConfirmCodeActivity_ExecuteFunction.ExecuteCode += new System.EventHandler(this.showConfirmCodeActivity_ExecuteFunction_ExecuteCode);\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/TreeConfirmActionConfirm.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"showConfirmStateActivity\";\r\n            // \r\n            // initializeCodeActivity_UpdateBinding\r\n            // \r\n            this.initializeCodeActivity_UpdateBinding.Name = \"initializeCodeActivity_UpdateBinding\";\r\n            this.initializeCodeActivity_UpdateBinding.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBinding_ExecuteCode);\r\n            // \r\n            // showConfirmEventDrivenActivity_Cancel\r\n            // \r\n            this.showConfirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.showConfirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.showConfirmEventDrivenActivity_Cancel.Name = \"showConfirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // showConfirmEventDrivenActivity_Ok\r\n            // \r\n            this.showConfirmEventDrivenActivity_Ok.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.showConfirmEventDrivenActivity_Ok.Activities.Add(this.showConfirmCodeActivity_ExecuteFunction);\r\n            this.showConfirmEventDrivenActivity_Ok.Activities.Add(this.setStateActivity4);\r\n            this.showConfirmEventDrivenActivity_Ok.Name = \"showConfirmEventDrivenActivity_Ok\";\r\n            // \r\n            // showConfirmStateInitializationActivity\r\n            // \r\n            this.showConfirmStateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.showConfirmStateInitializationActivity.Name = \"showConfirmStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBinding);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // showConfirmStateActivity\r\n            // \r\n            this.showConfirmStateActivity.Activities.Add(this.showConfirmStateInitializationActivity);\r\n            this.showConfirmStateActivity.Activities.Add(this.showConfirmEventDrivenActivity_Ok);\r\n            this.showConfirmStateActivity.Activities.Add(this.showConfirmEventDrivenActivity_Cancel);\r\n            this.showConfirmStateActivity.Name = \"showConfirmStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // ConfirmActionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.showConfirmStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"ConfirmActionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateActivity showConfirmStateActivity;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private StateInitializationActivity showConfirmStateInitializationActivity;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity showConfirmEventDrivenActivity_Cancel;\r\n        private EventDrivenActivity showConfirmEventDrivenActivity_Ok;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity showConfirmCodeActivity_ExecuteFunction;\r\n        private CodeActivity initializeCodeActivity_UpdateBinding;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/ConfirmActionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1146; 970\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"ConfirmActionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"512; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBinding\" Size=\"130; 41\" Location=\"522; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"522; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"249; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"334; 357\" Name=\"showConfirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"showConfirmStateInitializationActivity\" Size=\"150; 122\" Location=\"342; 388\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130; 41\" Location=\"352; 450\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"showConfirmEventDrivenActivity_Ok\" Size=\"150; 242\" Location=\"342; 412\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"352; 474\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"showConfirmCodeActivity_ExecuteFunction\" Size=\"130; 41\" Location=\"352; 534\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"352; 594\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"showConfirmEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"342; 436\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"352; 498\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"352; 558\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"ConfirmActionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"ConfirmActionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"showConfirmStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"showConfirmStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"357\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"showConfirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"showConfirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"showConfirmEventDrivenActivity_Ok\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"559\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"showConfirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"showConfirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"showConfirmEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"579\" Y=\"446\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"446\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/DeleteTreeDefinitionWorkflow.cs",
    "content": "using System;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Plugins.Elements.ElementProviders.DeveloperApplicationProvider;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteTreeDefinitionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteTreeDefinitionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)this.EntityToken;\r\n\r\n            FileUtils.Delete(castedEntityToken.FullTreePath);\r\n\r\n            this.RefreshRootEntityToken();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/DeleteTreeDefinitionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class DeleteTreeDefinitionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity2 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity2\r\n            // \r\n            this.confirmDialogFormActivity2.ContainerLabel = null;\r\n            this.confirmDialogFormActivity2.FormDefinitionFileName = \"/Administrative/TreeDeleteTreeDefinition.xml\";\r\n            this.confirmDialogFormActivity2.Name = \"confirmDialogFormActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"confirmStateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // confirmEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.confirmEventDrivenActivity_Cancel.Name = \"confirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmEventDrivenActivity_Finish\r\n            // \r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.confirmEventDrivenActivity_Finish.Name = \"confirmEventDrivenActivity_Finish\";\r\n            // \r\n            // confirmStateInitializationActivity\r\n            // \r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmDialogFormActivity2);\r\n            this.confirmStateInitializationActivity.Name = \"confirmStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.confirmStateInitializationActivity);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeleteTreeDefinitionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteTreeDefinitionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity2;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity confirmEventDrivenActivity_Finish;\r\n        private StateInitializationActivity confirmStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity confirmStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private SetStateActivity setStateActivity3;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity confirmEventDrivenActivity_Cancel;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/DeleteTreeDefinitionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1164; 986\" AutoSizeMargin=\"16; 24\" Location=\"30; 30\" Name=\"DeleteTreeDefinitionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 122\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"221; 102\" AutoSizeMargin=\"16; 24\" Location=\"271; 354\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"confirmStateInitializationActivity\" Size=\"150; 122\" Location=\"279; 385\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity2\" Size=\"130; 41\" Location=\"289; 447\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"279; 409\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"289; 471\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"289; 531\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"279; 433\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"289; 495\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"289; 555\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"566; 544\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"574; 575\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"584; 637\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"584; 697\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeleteTreeDefinitionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteTreeDefinitionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"381\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"381\" Y=\"354\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"484\" Y=\"419\" />\r\n\t\t\t\t<ns0:Point X=\"668\" Y=\"419\" />\r\n\t\t\t\t<ns0:Point X=\"668\" Y=\"544\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"767\" Y=\"585\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"585\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"488\" Y=\"443\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"443\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/EditTreeDefinitionWorkflow.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Plugins.Elements.ElementProviders.DeveloperApplicationProvider;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditTreeDefinitionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditTreeDefinitionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string path = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TreeDefinitionsDirectory), this.Filename);\r\n\r\n            this.Bindings.Add(\"TreeId\", Path.GetFileNameWithoutExtension(this.Filename));\r\n            this.Bindings.Add(\"TreeDefinitionMarkup\", C1File.ReadAllText(path));\r\n        }\r\n\r\n\r\n\r\n        private void saveStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string content = this.GetBinding<string>(\"TreeDefinitionMarkup\");\r\n\r\n            string path = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TreeDefinitionsDirectory), this.Filename);\r\n\r\n            FileUtils.RemoveReadOnly(path);\r\n\r\n            C1File.WriteAllText(path, content);\r\n\r\n            this.SetSaveStatus(true);\r\n\r\n            this.RefreshCurrentEntityToken();\r\n        }\r\n\r\n\r\n\r\n        private string Filename\r\n        {\r\n            get\r\n            {\r\n                DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)this.EntityToken;\r\n\r\n                return castedEntityToken.FullTreePath;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void IsMarkupValid(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)this.EntityToken;\r\n\r\n            string content = this.GetBinding<string>(\"TreeDefinitionMarkup\");\r\n            \r\n            this.UpdateBinding(\"Errors\", \"\");\r\n\r\n            XDocument document = null;\r\n            try\r\n            {\r\n                document = XDocument.Parse(content);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", ex.Message);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n\r\n            Tree tree = TreeFacade.LoadTreeFromDom(castedEntityToken.Filename, document);\r\n\r\n            ValidationError validationError = tree.BuildResult.ValidationErrors.FirstOrDefault();\r\n            if (validationError != null)\r\n            {\r\n                StringBuilder sb = new StringBuilder();\r\n                if (string.IsNullOrEmpty(validationError.XPath) == false)\r\n                {\r\n                    sb.Append(validationError.Message);\r\n                    sb.Append(\" at XPath: \");\r\n                    sb.Append(validationError.XPath);\r\n                }\r\n                else\r\n                {\r\n                    sb.Append(validationError.Message);\r\n                }\r\n\r\n                this.UpdateBinding(\"Errors\", sb.ToString());\r\n            }            \r\n\r\n            e.Result = tree.BuildResult.ValidationErrors.Count() == 0;\r\n        }\r\n\r\n\r\n\r\n\r\n        private void editCodeActivity_ShowErrorMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            \r\n            this.ShowMessage(DialogType.Error, \"Error\", this.GetBinding<string>(\"Errors\")); \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/EditTreeDefinitionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class EditTreeDefinitionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editCodeActivity_ShowErrorMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.editIfElseActivity_IsValidMarkup = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // editCodeActivity_ShowErrorMessage\r\n            // \r\n            this.editCodeActivity_ShowErrorMessage.Name = \"editCodeActivity_ShowErrorMessage\";\r\n            this.editCodeActivity_ShowErrorMessage.ExecuteCode += new System.EventHandler(this.editCodeActivity_ShowErrorMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.editCodeActivity_ShowErrorMessage);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity4);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsMarkupValid);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveStateCodeActivity\r\n            // \r\n            this.saveStateCodeActivity.Name = \"saveStateCodeActivity\";\r\n            this.saveStateCodeActivity.ExecuteCode += new System.EventHandler(this.saveStateCodeActivity_ExecuteCode);\r\n            // \r\n            // editIfElseActivity_IsValidMarkup\r\n            // \r\n            this.editIfElseActivity_IsValidMarkup.Activities.Add(this.ifElseBranchActivity1);\r\n            this.editIfElseActivity_IsValidMarkup.Activities.Add(this.ifElseBranchActivity2);\r\n            this.editIfElseActivity_IsValidMarkup.Name = \"editIfElseActivity_IsValidMarkup\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\TreeEditDefinition.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveStateCodeActivity);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.editIfElseActivity_IsValidMarkup);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditTreeDefinitionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditTreeDefinitionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateActivity editStateActivity;\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n        private StateActivity saveStateActivity;\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private CodeActivity saveStateCodeActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity editIfElseActivity_IsValidMarkup;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity editCodeActivity_ShowErrorMessage;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/EditTreeDefinitionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1164; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditTreeDefinitionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"208; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"240; 340\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 122\" Location=\"413; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130; 41\" Location=\"423; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Save\" Size=\"381; 423\" Location=\"421; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"546; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"editIfElseActivity_IsValidMarkup\" Size=\"361; 282\" Location=\"431; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 182\" Location=\"450; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"460; 433\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 182\" Location=\"623; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"editCodeActivity_ShowErrorMessage\" Size=\"130; 41\" Location=\"633; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"633; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"199; 80\" AutoSizeMargin=\"16; 24\" Location=\"535; 561\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 182\" Location=\"543; 592\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveStateCodeActivity\" Size=\"130; 41\" Location=\"553; 654\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"553; 714\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditTreeDefinitionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditTreeDefinitionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"340\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"429\" Y=\"405\" />\r\n\t\t\t\t<ns0:Point X=\"634\" Y=\"405\" />\r\n\t\t\t\t<ns0:Point X=\"634\" Y=\"561\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"724\" Y=\"602\" />\r\n\t\t\t\t<ns0:Point X=\"744\" Y=\"602\" />\r\n\t\t\t\t<ns0:Point X=\"744\" Y=\"332\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"332\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"340\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericAddDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Scheduling;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow.Foundation;\r\n\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class GenericAddDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        private bool _doPublish;\r\n\r\n        [NonSerialized]\r\n        private IDictionary<string, string> _dataPayload;\r\n\r\n        [NonSerialized]\r\n        private DataTypeDescriptorFormsHelper _dataTypeDescriptorFormsHelper;\r\n\r\n        [NonSerialized]\r\n        private string _typeName;\r\n        private string TypeName { get { return _typeName; } set { _typeName = value; } }\r\n\r\n        private Type InterfaceType\r\n        {\r\n            get { return StringConversionServices.DeserializeValueType(DataPayload[\"_InterfaceType_\"]); }\r\n        }\r\n\r\n        private string CustomFormMarkupPath\r\n        {\r\n            get\r\n            {\r\n                if (DataPayload.ContainsKey(\"_CustomFormMarkupPath_\"))\r\n                {\r\n                    return StringConversionServices.DeserializeValueString(DataPayload[\"_CustomFormMarkupPath_\"]);\r\n                }\r\n\r\n                return null;\r\n            }\r\n        }\r\n\r\n        private string IconResourceName\r\n        {\r\n            get { return StringConversionServices.DeserializeValueString(DataPayload[\"_IconResourceName_\"]); }\r\n        }\r\n\r\n        private void Initialize()\r\n        {\r\n            if (_dataTypeDescriptorFormsHelper == null)\r\n            {\r\n                if (String.IsNullOrEmpty(this.Payload))\r\n                {\r\n                    throw new InvalidOperationException(\"The interface type should be a part of the workflows payload\");\r\n                }\r\n\r\n                Dictionary<string, string> serializedValues = StringConversionServices.ParseKeyValueCollection(this.Payload);\r\n\r\n                _dataPayload = serializedValues;\r\n            }\r\n\r\n            if (!PermissionsFacade.GetPermissionsForCurrentUser(EntityToken).Contains(PermissionType.Publish)\r\n                || !typeof(IPublishControlled).IsAssignableFrom(InterfaceType))\r\n            {\r\n                FormData formData = WorkflowFacade.GetFormData(InstanceId, true);\r\n\r\n                if (formData.ExcludedEvents == null)\r\n                    formData.ExcludedEvents = new List<string>();\r\n\r\n                formData.ExcludedEvents.Add(\"SaveAndPublish\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IDictionary<string, string> DataPayload\r\n        {\r\n            get { return _dataPayload; }\r\n        }\r\n\r\n\r\n\r\n        private DataTypeDescriptorFormsHelper FormsHelper\r\n        {\r\n            get\r\n            {\r\n                if (_dataTypeDescriptorFormsHelper == null)\r\n                {\r\n                    DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(InterfaceType);\r\n\r\n                    this.TypeName = dataTypeDescriptor.Name;\r\n\r\n                    var generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor) { AllowForeignKeyEditing = true };\r\n\r\n                    _dataTypeDescriptorFormsHelper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, true, this.EntityToken);\r\n                    if (!string.IsNullOrEmpty(CustomFormMarkupPath))\r\n                    {\r\n                        _dataTypeDescriptorFormsHelper.CustomFormDefinition = \r\n                            XDocument.Load(CustomFormMarkupPath, LoadOptions.SetBaseUri | LoadOptions.SetLineInfo);\r\n                    }\r\n                    _dataTypeDescriptorFormsHelper.LayoutIconHandle = IconResourceName;\r\n                    _dataTypeDescriptorFormsHelper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n                }\r\n\r\n                return _dataTypeDescriptorFormsHelper;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public GenericAddDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_BuildNewData_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Initialize();\r\n\r\n            this.FormsHelper.UpdateWithNewBindings(this.Bindings);\r\n\r\n            IData newData = DataFacade.BuildNew(InterfaceType);\r\n\r\n            if (PageFolderFacade.GetAllFolderTypes().Contains(InterfaceType))\r\n            {\r\n                Dictionary<string, string> piggybag = PiggybagSerializer.Deserialize(this.ExtraPayload);\r\n                var piggybagDataFinder = new PiggybagDataFinder(piggybag, this.EntityToken);\r\n                IPage page = (IPage)piggybagDataFinder.TryGetData(typeof(IPage));\r\n                if (page != null)\r\n                {\r\n                    PageFolderFacade.AssignFolderDataSpecificValues(newData, page);\r\n                }\r\n            }\r\n\r\n            var publishControlled = newData as IPublishControlled;\r\n            if (publishControlled != null)\r\n            {\r\n                publishControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n            }\r\n\r\n\r\n            var values = new Dictionary<string, string>();\r\n            var castedEntityToken = this.EntityToken as TreeDataFieldGroupingElementEntityToken;\r\n            if (castedEntityToken != null)\r\n            {\r\n                Tree tree = TreeFacade.GetTree(castedEntityToken.Source);\r\n                var treeNode = (DataFolderElementsTreeNode)tree.GetTreeNode(castedEntityToken.TreeNodeId);\r\n\r\n                if (treeNode.Range == null && !treeNode.FirstLetterOnly)\r\n                {\r\n                    foreach (var kvp in castedEntityToken.DeserializedGroupingValues)\r\n                    {\r\n                        values.Add(kvp.Key, ValueTypeConverter.Convert<string>(kvp.Value));\r\n                    }\r\n                }\r\n            }\r\n\r\n            var props = InterfaceType.GetPropertiesRecursively().ToDictionary(prop => prop.Name);\r\n\r\n            foreach (var kvp in this.DataPayload)\r\n            {\r\n                // Filtering payload data which is not default field values\r\n                if (props.ContainsKey(kvp.Key))\r\n                {\r\n                    values[kvp.Key] = StringConversionServices.DeserializeValueString(kvp.Value);\r\n                }\r\n            }\r\n\r\n            newData.SetValues(values);\r\n\r\n\r\n\r\n            this.FormsHelper.ObjectToBindings(newData, this.Bindings);\r\n\r\n            GeneratedTypesHelper.SetNewIdFieldValue(newData);\r\n\r\n            this.Bindings.Add(\"NewData\", newData);\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_DisplayForm_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Initialize();\r\n\r\n            if (!BindingExist(\"DataAdded\"))\r\n            {\r\n                this.FormsHelper.LayoutLabel = this.FormsHelper.DataTypeDescriptor.Name;\r\n            }\r\n\r\n            IData newData = this.GetBinding<IData>(\"NewData\");\r\n\r\n            this.DeliverFormData(\r\n                    this.TypeName,\r\n                    StandardUiContainerTypes.Document,\r\n                    this.FormsHelper.GetForm(),\r\n                    this.Bindings,\r\n                    this.FormsHelper.GetBindingsValidationRules(newData)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_SaveData_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Initialize();\r\n\r\n            bool isValid = ValidateBindings();\r\n\r\n            IData newData = this.GetBinding<IData>(\"NewData\");\r\n\r\n            if (!BindAndValidate(FormsHelper, newData))\r\n            {\r\n                isValid = false;\r\n            }\r\n\r\n            if (!isValid)\r\n            {\r\n                SetSaveStatus(false);\r\n                return;\r\n            }\r\n\r\n            this.RefreshCurrentEntityToken();\r\n\r\n            if (!this.BindingExist(\"DataAdded\"))\r\n            {\r\n                newData = DataFacade.AddNew(newData);\r\n\r\n                this.AcquireLock(newData.GetDataEntityToken());\r\n\r\n                this.UpdateBinding(\"NewData\", newData);\r\n                this.Bindings.Add(\"DataAdded\", true);\r\n\r\n                SetSaveStatus(true, newData);\r\n            }\r\n            else\r\n            {\r\n                DataFacade.Update(newData);\r\n                SetSaveStatus(true);\r\n            }\r\n\r\n            PublishControlledHelper.PublishIfNeeded(newData, _doPublish, Bindings, ShowMessage);\r\n        }\r\n\r\n\r\n\r\n        private void enablePublishCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            _doPublish = true;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericAddDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class GenericAddDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity_SaveData = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.enablePublishCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.saveAndPublishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.step1CodeActivity_DisplayForm = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_BuildNewData = new System.Workflow.Activities.CodeActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_SaveAndPublish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // saveCodeActivity_SaveData\r\n            // \r\n            this.saveCodeActivity_SaveData.Name = \"saveCodeActivity_SaveData\";\r\n            this.saveCodeActivity_SaveData.ExecuteCode += new System.EventHandler(this.saveCodeActivity_SaveData_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // enablePublishCodeActivity\r\n            // \r\n            this.enablePublishCodeActivity.Name = \"enablePublishCodeActivity\";\r\n            this.enablePublishCodeActivity.ExecuteCode += new System.EventHandler(this.enablePublishCodeActivity_ExecuteCode);\r\n            // \r\n            // saveAndPublishHandleExternalEventActivity1\r\n            // \r\n            this.saveAndPublishHandleExternalEventActivity1.EventName = \"SaveAndPublish\";\r\n            this.saveAndPublishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveAndPublishHandleExternalEventActivity1.Name = \"saveAndPublishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // step1CodeActivity_DisplayForm\r\n            // \r\n            this.step1CodeActivity_DisplayForm.Name = \"step1CodeActivity_DisplayForm\";\r\n            this.step1CodeActivity_DisplayForm.ExecuteCode += new System.EventHandler(this.step1CodeActivity_DisplayForm_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_BuildNewData\r\n            // \r\n            this.initializeCodeActivity_BuildNewData.Name = \"initializeCodeActivity_BuildNewData\";\r\n            this.initializeCodeActivity_BuildNewData.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_BuildNewData_ExecuteCode);\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity_SaveData);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_SaveAndPublish\r\n            // \r\n            this.step1EventDrivenActivity_SaveAndPublish.Activities.Add(this.saveAndPublishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_SaveAndPublish.Activities.Add(this.enablePublishCodeActivity);\r\n            this.step1EventDrivenActivity_SaveAndPublish.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_SaveAndPublish.Name = \"step1EventDrivenActivity_SaveAndPublish\";\r\n            // \r\n            // step1EventDrivenActivity_Save\r\n            // \r\n            this.step1EventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Save.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Save.Name = \"step1EventDrivenActivity_Save\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1CodeActivity_DisplayForm);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_BuildNewData);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Save);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_SaveAndPublish);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // GenericAddDataWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"GenericAddDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity enablePublishCodeActivity;\r\n\r\n        private Workflow.Activities.SaveAndPublishHandleExternalEventActivity saveAndPublishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_SaveAndPublish;\r\n\r\n        private Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private CodeActivity initializeCodeActivity_BuildNewData;\r\n\r\n        private CodeActivity step1CodeActivity_DisplayForm;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private CodeActivity saveCodeActivity_SaveData;\r\n\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Save;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericAddDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1199; 932\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"GenericAddDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"227; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 209\" Location=\"98; 171\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_BuildNewData\" Size=\"130; 44\" Location=\"108; 236\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"108; 299\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"275; 110\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"269; 373\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 128\" Location=\"546; 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step1CodeActivity_DisplayForm\" Size=\"130; 44\" Location=\"556; 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Save\" Size=\"150; 209\" Location=\"546; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"556; 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"556; 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_SaveAndPublish\" Size=\"150; 272\" Location=\"554; 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveAndPublishHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"564; 219\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"enablePublishCodeActivity\" Size=\"130; 44\" Location=\"564; 282\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 62\" Location=\"564; 345\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"206; 80\" AutoSizeMargin=\"16; 24\" Location=\"553; 561\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 209\" Location=\"561; 594\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity_SaveData\" Size=\"130; 44\" Location=\"571; 659\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"571; 722\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"GenericAddDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"GenericAddDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"313\" Y=\"182\" />\r\n\t\t\t\t<ns0:Point X=\"406\" Y=\"182\" />\r\n\t\t\t\t<ns0:Point X=\"406\" Y=\"373\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"479\" Y=\"443\" />\r\n\t\t\t\t<ns0:Point X=\"656\" Y=\"443\" />\r\n\t\t\t\t<ns0:Point X=\"656\" Y=\"561\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"755\" Y=\"605\" />\r\n\t\t\t\t<ns0:Point X=\"766\" Y=\"605\" />\r\n\t\t\t\t<ns0:Point X=\"766\" Y=\"365\" />\r\n\t\t\t\t<ns0:Point X=\"406\" Y=\"365\" />\r\n\t\t\t\t<ns0:Point X=\"406\" Y=\"373\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_SaveAndPublish\" SourceConnectionIndex=\"2\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"540\" Y=\"469\" />\r\n\t\t\t\t<ns0:Point X=\"656\" Y=\"469\" />\r\n\t\t\t\t<ns0:Point X=\"656\" Y=\"561\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericDeleteDataWorkflow.cs",
    "content": "using System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class GenericDeleteDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public GenericDeleteDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void HasDataReferences(object sender, ConditionalEventArgs e)\r\n        {\r\n            IData data = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            this.Bindings.Add(\"Text\", string.Format(\"{0}: {1}\", Composite.Core.ResourceSystem.StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeGenericDeleteConfirm.Text\"), data.GetLabel()));\r\n\r\n            var brokenReferences = new List<IData>();\r\n\r\n            List<IData> references = DataReferenceFacade.GetNotOptionalReferences(data);\r\n            foreach (IData reference in references)\r\n            {\r\n                DataSourceId dataSourceId = reference.DataSourceId;\r\n                if (brokenReferences.Any(brokenRef => brokenRef.DataSourceId == dataSourceId))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                brokenReferences.Add(reference);\r\n            }\r\n\r\n            e.Result = brokenReferences.Count > 0;\r\n            if (brokenReferences.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            Bindings.Add(\"ReferencedData\", DataReferenceFacade.GetBrokenReferencesReport(brokenReferences));\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_DeteleData_ExecuteCode(object sender, System.EventArgs e)\r\n        {\r\n            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            IData data = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            if (DataFacade.WillDeleteSucceed(data))\r\n            {\r\n                ProcessControllerFacade.FullDelete(data);\r\n\r\n                deleteTreeRefresher.PostRefreshMesseges(true);\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeGenericDelete.CascadeDeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeGenericDelete.CascadeDeleteErrorMessage\")\r\n                    );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericDeleteDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class GenericDeleteDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.confirmConfirmDialogFormActivity_ShowConfirmDialog = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.confirmConfirmDialogFormActivity_ShowDataReferenceDialog = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_DeteleData = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmIfElseActivity_HasDataReferences = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // confirmConfirmDialogFormActivity_ShowConfirmDialog\r\n            // \r\n            this.confirmConfirmDialogFormActivity_ShowConfirmDialog.ContainerLabel = null;\r\n            this.confirmConfirmDialogFormActivity_ShowConfirmDialog.FormDefinitionFileName = \"/Administrative/TreeGenericDeleteConfirm.xml\";\r\n            this.confirmConfirmDialogFormActivity_ShowConfirmDialog.Name = \"confirmConfirmDialogFormActivity_ShowConfirmDialog\";\r\n            // \r\n            // confirmConfirmDialogFormActivity_ShowDataReferenceDialog\r\n            // \r\n            this.confirmConfirmDialogFormActivity_ShowDataReferenceDialog.ContainerLabel = null;\r\n            this.confirmConfirmDialogFormActivity_ShowDataReferenceDialog.FormDefinitionFileName = \"/Administrative/TreeGenericDeleteConfirmDeletingRelatedData.xml\";\r\n            this.confirmConfirmDialogFormActivity_ShowDataReferenceDialog.Name = \"confirmConfirmDialogFormActivity_ShowDataReferenceDialog\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.confirmConfirmDialogFormActivity_ShowConfirmDialog);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.confirmConfirmDialogFormActivity_ShowDataReferenceDialog);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasDataReferences);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_DeteleData\r\n            // \r\n            this.finalizeCodeActivity_DeteleData.Name = \"finalizeCodeActivity_DeteleData\";\r\n            this.finalizeCodeActivity_DeteleData.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_DeteleData_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // confirmIfElseActivity_HasDataReferences\r\n            // \r\n            this.confirmIfElseActivity_HasDataReferences.Activities.Add(this.ifElseBranchActivity1);\r\n            this.confirmIfElseActivity_HasDataReferences.Activities.Add(this.ifElseBranchActivity2);\r\n            this.confirmIfElseActivity_HasDataReferences.Name = \"confirmIfElseActivity_HasDataReferences\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"confirmStateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_DeteleData);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity6);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // confirmEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Name = \"confirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmEventDrivenActivity_Finish\r\n            // \r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.confirmEventDrivenActivity_Finish.Name = \"confirmEventDrivenActivity_Finish\";\r\n            // \r\n            // confirmStateInitializationActivity\r\n            // \r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmIfElseActivity_HasDataReferences);\r\n            this.confirmStateInitializationActivity.Name = \"confirmStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.confirmStateInitializationActivity);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // GenericDeleteDataWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"GenericDeleteDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity confirmStateActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity confirmEventDrivenActivity_Cancel;\r\n        private EventDrivenActivity confirmEventDrivenActivity_Finish;\r\n        private StateInitializationActivity confirmStateInitializationActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity confirmIfElseActivity_HasDataReferences;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmConfirmDialogFormActivity_ShowConfirmDialog;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmConfirmDialogFormActivity_ShowDataReferenceDialog;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity finalizeCodeActivity_DeteleData;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericDeleteDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"GenericDeleteDataWorkflow\" Location=\"30; 30\" Size=\"1202; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"GenericDeleteDataWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"GenericDeleteDataWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"confirmStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"confirmStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"398\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"398\" Y=\"315\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"confirmStateActivity\" EventHandlerName=\"confirmEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"501\" Y=\"380\" />\r\n\t\t\t\t<ns0:Point X=\"552\" Y=\"380\" />\r\n\t\t\t\t<ns0:Point X=\"552\" Y=\"585\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"confirmStateActivity\" EventHandlerName=\"confirmEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"505\" Y=\"404\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"404\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"651\" Y=\"626\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"626\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"confirmStateActivity\" Location=\"288; 315\" Size=\"221; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"confirmStateInitializationActivity\" Location=\"296; 346\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"confirmIfElseActivity_HasDataReferences\" Location=\"306; 408\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"325; 479\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmConfirmDialogFormActivity_ShowDataReferenceDialog\" Location=\"335; 541\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"498; 479\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmConfirmDialogFormActivity_ShowConfirmDialog\" Location=\"508; 541\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"confirmEventDrivenActivity_Finish\" Location=\"296; 370\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"306; 432\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"306; 492\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"confirmEventDrivenActivity_Cancel\" Location=\"296; 394\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"306; 456\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"306; 516\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"450; 585\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"556; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_DeteleData\" Location=\"566; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"566; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericEditDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Scheduling;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class GenericEditDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        private bool _doPublish;\r\n\r\n\r\n        [NonSerialized]\r\n        private DataTypeDescriptorFormsHelper _dataTypeDescriptorFormsHelper;\r\n\r\n        [NonSerialized]\r\n        private string _typeName;\r\n\r\n\r\n        private DataTypeDescriptorFormsHelper FormsHelper\r\n        {\r\n            get\r\n            {\r\n                if (_dataTypeDescriptorFormsHelper == null)\r\n                {\r\n                    if (String.IsNullOrEmpty(this.Payload))\r\n                    {\r\n                        throw new InvalidOperationException(\"Action token's 'Payload' property is null or empty\");\r\n                    }\r\n\r\n                    Dictionary<string, string> serializedValues = StringConversionServices.ParseKeyValueCollection(this.Payload);\r\n\r\n                    string iconResourceName = StringConversionServices.DeserializeValueString(serializedValues[\"_IconResourceName_\"]);\r\n\r\n                    string customFormMarkupPath = null;\r\n                    if (serializedValues.ContainsKey(\"_CustomFormMarkupPath_\"))\r\n                    {\r\n                        customFormMarkupPath = StringConversionServices.DeserializeValueString(serializedValues[\"_CustomFormMarkupPath_\"]);\r\n                    }\r\n\r\n                    DataEntityToken dataEntityToken = this.EntityToken as DataEntityToken;\r\n                    Verify.IsNotNull(dataEntityToken, \"The given entity token is of wrong type\");\r\n\r\n                    Type interfaceType = dataEntityToken.InterfaceType;\r\n                    \r\n\r\n                    DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n                    Verify.IsNotNull(dataTypeDescriptor, \"Can not find the type descriptor for the type '{0}'\", interfaceType);\r\n\r\n                    _typeName = dataTypeDescriptor.Name;\r\n\r\n                    var generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor) { AllowForeignKeyEditing = true };\r\n\r\n                    _dataTypeDescriptorFormsHelper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, true, this.EntityToken);\r\n                    if (!string.IsNullOrEmpty(customFormMarkupPath))\r\n                    {\r\n                        _dataTypeDescriptorFormsHelper.CustomFormDefinition =\r\n                            XDocument.Load(customFormMarkupPath, LoadOptions.SetBaseUri | LoadOptions.SetLineInfo);\r\n                    }\r\n                    _dataTypeDescriptorFormsHelper.LayoutIconHandle = iconResourceName;\r\n                    _dataTypeDescriptorFormsHelper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n                }\r\n\r\n                return _dataTypeDescriptorFormsHelper;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private string TypeName\r\n        {\r\n            get\r\n            {\r\n                return _typeName;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        public GenericEditDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void editCodeActivity_DisplayForm_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IData data = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            if (!PermissionsFacade.GetPermissionsForCurrentUser(EntityToken).Contains(PermissionType.Publish) \r\n                || !(data is IPublishControlled))\r\n            {\r\n                FormData formData = WorkflowFacade.GetFormData(InstanceId, true);\r\n\r\n                if (formData.ExcludedEvents == null)\r\n                    formData.ExcludedEvents = new List<string>();\r\n\r\n                formData.ExcludedEvents.Add(\"SaveAndPublish\");\r\n            }\r\n\r\n            if (data is IPublishControlled)\r\n            {\r\n                IPublishControlled publishControlledData = (IPublishControlled)data;\r\n                if (publishControlledData.PublicationStatus == GenericPublishProcessController.Published)\r\n                {\r\n                    publishControlledData.PublicationStatus = GenericPublishProcessController.Draft;\r\n                }\r\n            }\r\n\r\n            this.FormsHelper.UpdateWithBindings(data, this.Bindings);\r\n            this.FormsHelper.LayoutLabel = data.GetLabel(true);\r\n\r\n            this.DeliverFormData(\r\n                    this.TypeName,\r\n                    StandardUiContainerTypes.Document,\r\n                    this.FormsHelper.GetForm(),\r\n                    this.Bindings,\r\n                    this.FormsHelper.GetBindingsValidationRules(data)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_UpdateData_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            IData data = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            bool isValid = ValidateBindings();\r\n            if (!BindAndValidate(this.FormsHelper, data))\r\n            {\r\n                isValid = false;\r\n            }\r\n\r\n            var fieldsWithBrokenReferences = new List<string>();\r\n            if (!data.TryValidateForeignKeyIntegrity(fieldsWithBrokenReferences))\r\n            {\r\n                isValid = false;\r\n\r\n                foreach (string fieldName in fieldsWithBrokenReferences)\r\n                {\r\n                    ShowFieldMessage(fieldName, LocalizationFiles.Composite_Management.Validation_BrokenReference);\r\n                }\r\n            }\r\n\r\n            if (isValid)\r\n            {\r\n                if (data is IPublishControlled)\r\n                {\r\n                    IPublishControlled publishControlledData = (IPublishControlled)data;\r\n                    if (publishControlledData.PublicationStatus == GenericPublishProcessController.Published)\r\n                    {\r\n                        publishControlledData.PublicationStatus = GenericPublishProcessController.Draft;\r\n                    }\r\n                }\r\n\r\n                DataFacade.Update(data);\r\n\r\n                EntityTokenCacheFacade.ClearCache(EntityToken);\r\n\r\n                updateTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n\r\n                PublishControlledHelper.PublishIfNeeded(data, _doPublish, Bindings, ShowMessage);\r\n            }\r\n\r\n            SetSaveStatus(isValid);\r\n        }\r\n\r\n\r\n        private void enablePublishCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            _doPublish = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericEditDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class GenericEditDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity_UpdateData = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.enablePublishCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.saveAndPublishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.editCodeActivity_DisplayForm = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_SaveAndPublish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity_UpdateData\r\n            // \r\n            this.saveCodeActivity_UpdateData.Name = \"saveCodeActivity_UpdateData\";\r\n            this.saveCodeActivity_UpdateData.ExecuteCode += new System.EventHandler(this.saveCodeActivity_UpdateData_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // enablePublishCodeActivity\r\n            // \r\n            this.enablePublishCodeActivity.Name = \"enablePublishCodeActivity\";\r\n            this.enablePublishCodeActivity.ExecuteCode += new System.EventHandler(this.enablePublishCodeActivity_ExecuteCode);\r\n            // \r\n            // saveAndPublishHandleExternalEventActivity1\r\n            // \r\n            this.saveAndPublishHandleExternalEventActivity1.EventName = \"SaveAndPublish\";\r\n            this.saveAndPublishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveAndPublishHandleExternalEventActivity1.Name = \"saveAndPublishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // editCodeActivity_DisplayForm\r\n            // \r\n            this.editCodeActivity_DisplayForm.Name = \"editCodeActivity_DisplayForm\";\r\n            this.editCodeActivity_DisplayForm.ExecuteCode += new System.EventHandler(this.editCodeActivity_DisplayForm_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity_UpdateData);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_SaveAndPublish\r\n            // \r\n            this.editEventDrivenActivity_SaveAndPublish.Activities.Add(this.saveAndPublishHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_SaveAndPublish.Activities.Add(this.enablePublishCodeActivity);\r\n            this.editEventDrivenActivity_SaveAndPublish.Activities.Add(this.setStateActivity5);\r\n            this.editEventDrivenActivity_SaveAndPublish.Name = \"editEventDrivenActivity_SaveAndPublish\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.editCodeActivity_DisplayForm);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_SaveAndPublish);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // GenericEditDataWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"GenericEditDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity enablePublishCodeActivity;\r\n\r\n        private Workflow.Activities.SaveAndPublishHandleExternalEventActivity saveAndPublishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_SaveAndPublish;\r\n\r\n        private Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private CodeActivity editCodeActivity_DisplayForm;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private CodeActivity saveCodeActivity_UpdateData;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/GenericEditDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1199; 932\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"GenericEditDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"227; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 146\" Location=\"98; 171\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"108; 236\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"267; 110\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"237; 396\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 128\" Location=\"546; 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"editCodeActivity_DisplayForm\" Size=\"130; 44\" Location=\"556; 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Save\" Size=\"150; 209\" Location=\"546; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"556; 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"556; 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_SaveAndPublish\" Size=\"150; 272\" Location=\"554; 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveAndPublishHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"564; 219\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"enablePublishCodeActivity\" Size=\"130; 44\" Location=\"564; 282\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 62\" Location=\"564; 345\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"206; 80\" AutoSizeMargin=\"16; 24\" Location=\"558; 492\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 209\" Location=\"566; 525\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity_UpdateData\" Size=\"130; 44\" Location=\"576; 590\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"576; 653\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"GenericEditDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"GenericEditDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"313\" Y=\"182\" />\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"182\" />\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"396\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"438\" Y=\"466\" />\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"466\" />\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"492\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"760\" Y=\"536\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"536\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"396\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_SaveAndPublish\" SourceConnectionIndex=\"2\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"500\" Y=\"492\" />\r\n\t\t\t\t<ns0:Point X=\"516\" Y=\"492\" />\r\n\t\t\t\t<ns0:Point X=\"516\" Y=\"484\" />\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"484\" />\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"492\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/LocalizeDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    public sealed partial class LocalizeDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public LocalizeDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void ValidateReferencingProperties(object sender, ConditionalEventArgs e)\r\n        {\r\n            var dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            var data = dataEntityToken.Data as ILocalizedControlled;\r\n\r\n            IEnumerable<ReferenceFailingPropertyInfo> referenceFailingProperties = DataLocalizationFacade.GetReferencingLocalizeFailingProperties(data).Evaluate();\r\n\r\n            if (referenceFailingProperties.Any(f => f.OptionalReferenceWithValue == false))\r\n            {\r\n                List<string> row = new List<string>();\r\n\r\n                row.Add(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"LocalizeData.ShowError.Description\"));\r\n\r\n                foreach (ReferenceFailingPropertyInfo referenceFailingPropertyInfo in referenceFailingProperties.Where(f => f.OptionalReferenceWithValue == false))\r\n                {\r\n                    row.Add(string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"LocalizeData.ShowError.FieldErrorFormat\"), referenceFailingPropertyInfo.DataFieldDescriptor.Name, referenceFailingPropertyInfo.ReferencedType.GetTypeTitle(), referenceFailingPropertyInfo.OriginLocaleDataValue.GetLabel()));\r\n                }\r\n\r\n                List<List<string>> rows = new List<List<string>> { row };\r\n\r\n                this.UpdateBinding(\"ErrorHeader\", new List<string> { \"Fields\" });\r\n                this.UpdateBinding(\"Errors\", rows);\r\n\r\n                e.Result = false;\r\n            }\r\n            else\r\n            {\r\n                e.Result = true;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void localizeDataCodeActivity_Localize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            ILocalizedControlled data = dataEntityToken.Data as ILocalizedControlled;\r\n\r\n            CultureInfo targetCultureInfo = UserSettings.ActiveLocaleCultureInfo;\r\n\r\n            if (ExistsInLocale(data, targetCultureInfo))\r\n            {\r\n                this.ShowMessage(\r\n                    DialogType.Message,\r\n                    StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"LocalizeData.ShowError.Layout.Label\"),\r\n                    StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"LocalizeData.ShowError.AlreadyTranslated\")\r\n                );\r\n\r\n                return;\r\n            }\r\n\r\n\r\n            IEnumerable<ReferenceFailingPropertyInfo> referenceFailingPropertyInfos = DataLocalizationFacade.GetReferencingLocalizeFailingProperties(data).Evaluate();\r\n\r\n            IData newData;\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                data = data.GetTranslationSource();\r\n\r\n                using (new DataScope(targetCultureInfo))\r\n                {\r\n                    newData = DataFacade.BuildNew(data.DataSourceId.InterfaceType);\r\n\r\n                    data.ProjectedCopyTo(newData);\r\n\r\n                    ILocalizedControlled localizedControlled = newData as ILocalizedControlled;\r\n                    localizedControlled.SourceCultureName = targetCultureInfo.Name;\r\n\r\n                    if (newData is IPublishControlled)\r\n                    {\r\n                        IPublishControlled publishControlled = newData as IPublishControlled;\r\n                        publishControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n                    }\r\n\r\n                    foreach (ReferenceFailingPropertyInfo referenceFailingPropertyInfo in referenceFailingPropertyInfos)\r\n                    {\r\n                        PropertyInfo propertyInfo = data.DataSourceId.InterfaceType.GetPropertiesRecursively().Single(f => f.Name == referenceFailingPropertyInfo.DataFieldDescriptor.Name);\r\n                        if (propertyInfo.PropertyType.IsGenericType &&\r\n                            propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n                        {\r\n                            propertyInfo.SetValue(newData, null, null);\r\n                        }\r\n                        else if (propertyInfo.PropertyType == typeof(string))\r\n                        {\r\n                            propertyInfo.SetValue(newData, null, null);\r\n                        }\r\n                        else\r\n                        {\r\n                            propertyInfo.SetValue(newData, referenceFailingPropertyInfo.DataFieldDescriptor.DefaultValue.Value, null);\r\n                        }\r\n                    }\r\n\r\n                    newData = DataFacade.AddNew(newData);\r\n                }\r\n\r\n                EntityTokenCacheFacade.ClearCache(data.GetDataEntityToken());\r\n                EntityTokenCacheFacade.ClearCache(newData.GetDataEntityToken());\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(newData.GetDataEntityToken(), 2);\r\n        }\r\n\r\n\r\n\r\n        private static bool ExistsInLocale(IData data, CultureInfo locale)\r\n        {\r\n            Type dataType = data.DataSourceId.InterfaceType;\r\n\r\n            MethodInfo getDataFromOtherScopeMethodInfo = typeof(DataFacade).GetMethod(\"GetDataFromOtherLocale\", BindingFlags.Public | BindingFlags.Static);\r\n\r\n            MethodInfo genericMethod = getDataFromOtherScopeMethodInfo.MakeGenericMethod(new[] { dataType });\r\n\r\n            object result = genericMethod.Invoke(null, new object[] { data, locale });\r\n\r\n            if (result == null) return false;\r\n\r\n            var enumerable = result as IEnumerable;\r\n            Verify.IsNotNull(enumerable, \"Enumeration expected\");\r\n\r\n            return enumerable.Cast<object>().Any();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/LocalizeDataWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class LocalizeDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.localizeDataCodeActivity_Localize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.initializeIfElseActivity_ValidateReferencingPropertyies = new System.Workflow.Activities.IfElseActivity();\r\n            this.localizeDataStateInitializationActivity_Localize = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showErrorEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.localizeDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showErrorStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"localizeDataStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateReferencingProperties);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // localizeDataCodeActivity_Localize\r\n            // \r\n            this.localizeDataCodeActivity_Localize.Name = \"localizeDataCodeActivity_Localize\";\r\n            this.localizeDataCodeActivity_Localize.ExecuteCode += new System.EventHandler(this.localizeDataCodeActivity_Localize_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\TreeLocalizeData.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // initializeIfElseActivity_ValidateReferencingPropertyies\r\n            // \r\n            this.initializeIfElseActivity_ValidateReferencingPropertyies.Activities.Add(this.ifElseBranchActivity1);\r\n            this.initializeIfElseActivity_ValidateReferencingPropertyies.Activities.Add(this.ifElseBranchActivity2);\r\n            this.initializeIfElseActivity_ValidateReferencingPropertyies.Name = \"initializeIfElseActivity_ValidateReferencingPropertyies\";\r\n            // \r\n            // localizeDataStateInitializationActivity_Localize\r\n            // \r\n            this.localizeDataStateInitializationActivity_Localize.Activities.Add(this.localizeDataCodeActivity_Localize);\r\n            this.localizeDataStateInitializationActivity_Localize.Activities.Add(this.setStateActivity5);\r\n            this.localizeDataStateInitializationActivity_Localize.Name = \"localizeDataStateInitializationActivity_Localize\";\r\n            // \r\n            // showErrorEventDrivenActivity_Finish\r\n            // \r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.showErrorEventDrivenActivity_Finish.Name = \"showErrorEventDrivenActivity_Finish\";\r\n            // \r\n            // showErrorStateInitializationActivity\r\n            // \r\n            this.showErrorStateInitializationActivity.Activities.Add(this.wizardFormActivity1);\r\n            this.showErrorStateInitializationActivity.Name = \"showErrorStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_ValidateReferencingPropertyies);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // localizeDataStateActivity\r\n            // \r\n            this.localizeDataStateActivity.Activities.Add(this.localizeDataStateInitializationActivity_Localize);\r\n            this.localizeDataStateActivity.Name = \"localizeDataStateActivity\";\r\n            // \r\n            // showErrorStateActivity\r\n            // \r\n            this.showErrorStateActivity.Activities.Add(this.showErrorStateInitializationActivity);\r\n            this.showErrorStateActivity.Activities.Add(this.showErrorEventDrivenActivity_Finish);\r\n            this.showErrorStateActivity.Name = \"showErrorStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // LocalizeDataWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.showErrorStateActivity);\r\n            this.Activities.Add(this.localizeDataStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"LocalizeDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity initializeIfElseActivity_ValidateReferencingPropertyies;\r\n        private StateActivity localizeDataStateActivity;\r\n        private StateActivity showErrorStateActivity;\r\n        private StateInitializationActivity localizeDataStateInitializationActivity_Localize;\r\n        private StateInitializationActivity showErrorStateInitializationActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private CodeActivity localizeDataCodeActivity_Localize;\r\n        private SetStateActivity setStateActivity4;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n        private EventDrivenActivity showErrorEventDrivenActivity_Finish;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/LocalizeDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1115; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"LocalizeDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 303\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"initializeIfElseActivity_ValidateReferencingPropertyies\" Size=\"361; 222\" Location=\"108; 231\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"127; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"137; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"300; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"310; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"936; 799\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"230; 80\" AutoSizeMargin=\"16; 24\" Location=\"201; 487\" Name=\"showErrorStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"showErrorStateInitializationActivity\" Size=\"150; 122\" Location=\"209; 518\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"219; 580\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"showErrorEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"209; 542\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"219; 604\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"219; 664\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"275; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"525; 327\" Name=\"localizeDataStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"localizeDataStateInitializationActivity_Localize\" Size=\"150; 182\" Location=\"512; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"localizeDataCodeActivity_Localize\" Size=\"130; 41\" Location=\"522; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"522; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"LocalizeDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"LocalizeDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1023\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1023\" Y=\"799\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"localizeDataStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"localizeDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"662\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"662\" Y=\"327\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"showErrorStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"316\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"316\" Y=\"487\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"showErrorStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"showErrorStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"showErrorEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"427\" Y=\"552\" />\r\n\t\t\t\t<ns0:Point X=\"1023\" Y=\"552\" />\r\n\t\t\t\t<ns0:Point X=\"1023\" Y=\"799\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"localizeDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"localizeDataStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"localizeDataStateInitializationActivity_Localize\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"796\" Y=\"368\" />\r\n\t\t\t\t<ns0:Point X=\"1023\" Y=\"368\" />\r\n\t\t\t\t<ns0:Point X=\"1023\" Y=\"799\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/RemoveApplicationWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Transactions;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.C1Console.Trees.Foundation.AttachmentPoints;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class RemoveApplicationWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public RemoveApplicationWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void IsThereAnyTrees(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"SelectedTreeId\");\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Dictionary<string, string> selectableTreeIds = new Dictionary<string, string>();\r\n            foreach (Tree tree in TreeFacade.AllTrees)\r\n            {\r\n                if (!tree.HasAttachmentPoints(this.EntityToken)) continue;\r\n                if (!tree.HasPossibleAttachmentPoints(this.EntityToken)) continue;\r\n\r\n                selectableTreeIds.Add(tree.TreeId, tree.AllowedAttachmentApplicationName);\r\n            }\r\n\r\n\r\n            if (selectableTreeIds.Count > 0)\r\n            {\r\n                this.UpdateBinding(\"SelectedTreeId\", selectableTreeIds.First().Key);\r\n                this.UpdateBinding(\"SelectableTreeIds\", selectableTreeIds);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string treeId = this.GetBinding<string>(\"SelectedTreeId\");\r\n\r\n            Tree tree = TreeFacade.GetTree(treeId);\r\n            \r\n            DynamicDataItemAttachmentPoint dataItemAttachmentPoint = (DynamicDataItemAttachmentPoint)tree.GetAttachmentPoints(this.EntityToken).Single();\r\n\r\n            TreeFacade.RemovePersistedAttachmentPoint(treeId, dataItemAttachmentPoint.InterfaceType, dataItemAttachmentPoint.KeyValue);            \r\n\r\n            this.RefreshCurrentEntityToken();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ShowNoTreesMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(DialogType.Message, \"${Composite.C1Console.Trees, RemoveApplication.NoTrees.Title}\", \"${Composite.C1Console.Trees, RemoveApplication.NoTrees.Message}\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/RemoveApplicationWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class RemoveApplicationWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_ShowNoTreesMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.initializeIfElseActivity_IsThereAnyTrees = new System.Workflow.Activities.IfElseActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // initializeCodeActivity_ShowNoTreesMessage\r\n            // \r\n            this.initializeCodeActivity_ShowNoTreesMessage.Name = \"initializeCodeActivity_ShowNoTreesMessage\";\r\n            this.initializeCodeActivity_ShowNoTreesMessage.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ShowNoTreesMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.initializeCodeActivity_ShowNoTreesMessage);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsThereAnyTrees);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\TreeRemoveApplication.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // initializeIfElseActivity_IsThereAnyTrees\r\n            // \r\n            this.initializeIfElseActivity_IsThereAnyTrees.Activities.Add(this.ifElseBranchActivity1);\r\n            this.initializeIfElseActivity_IsThereAnyTrees.Activities.Add(this.ifElseBranchActivity2);\r\n            this.initializeIfElseActivity_IsThereAnyTrees.Name = \"initializeIfElseActivity_IsThereAnyTrees\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.wizardFormActivity1);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_IsThereAnyTrees);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // RemoveApplicationWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"RemoveApplicationWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity initializeCodeActivity_ShowNoTreesMessage;\r\n        private SetStateActivity setStateActivity5;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity2;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private IfElseActivity initializeIfElseActivity_IsThereAnyTrees;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/RemoveApplicationWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1196; 965\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"RemoveApplicationWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 423\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"223; 231\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"initializeIfElseActivity_IsThereAnyTrees\" Size=\"361; 282\" Location=\"108; 291\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 182\" Location=\"127; 362\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"137; 454\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 182\" Location=\"300; 362\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_ShowNoTreesMessage\" Size=\"130; 41\" Location=\"310; 424\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"310; 484\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"371; 368\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"545; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"555; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"555; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"545; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"555; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"555; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity1\" Size=\"150; 122\" Location=\"553; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"563; 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"619; 558\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"627; 589\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"637; 651\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"637; 711\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"RemoveApplicationWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"RemoveApplicationWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"574\" Y=\"433\" />\r\n\t\t\t\t<ns0:Point X=\"721\" Y=\"433\" />\r\n\t\t\t\t<ns0:Point X=\"721\" Y=\"558\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"820\" Y=\"599\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"599\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"457\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"457\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"476\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"476\" Y=\"368\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/ReportFunctionActionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core;\r\n\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class ReportFunctionActionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public ReportFunctionActionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        \r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ReportFunctionActionNode reportFunctionActionNode = (ReportFunctionActionNode)ActionNode.Deserialize(this.Payload);\r\n\r\n            Dictionary<string, string> piggybag = PiggybagSerializer.Deserialize(this.ExtraPayload);\r\n\r\n            var replaceContext = new DynamicValuesHelperReplaceContext(this.EntityToken, piggybag);\r\n\r\n            XElement markup = reportFunctionActionNode.FunctionMarkupDynamicValuesHelper.ReplaceValues(replaceContext);                       \r\n\r\n            BaseRuntimeTreeNode baseRuntimeTreeNode = FunctionTreeBuilder.Build(markup);\r\n            XDocument result = baseRuntimeTreeNode.GetValue() as XDocument;\r\n\r\n            if (result == null)\r\n            {\r\n                string message = string.Format(StringResourceSystemFacade.GetString(\"Composite.C1Console.Trees\", \"TreeValidationError.ReportFunctionAction.WrongReturnValue\"), \"XDocument\");\r\n                \r\n                Log.LogError(\"TreeFacade\", message);\r\n\r\n                throw new InvalidOperationException(message);\r\n            }\r\n\r\n            this.Bindings.Add(\"Label\", reportFunctionActionNode.DocumentLabelDynamicValueHelper.ReplaceValues(replaceContext));\r\n            this.Bindings.Add(\"Icon\", reportFunctionActionNode.DocumentIcon.ResourceName);\r\n            this.Bindings.Add(\"HtmlBlob\", result.ToString());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/ReportFunctionActionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Trees.Workflows\r\n{\r\n    partial class ReportFunctionActionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.EmptyDocumentFormActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/ReportFunctionAction.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // ReportFunctionActionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"ReportFunctionActionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.EmptyDocumentFormActivity documentFormActivity1;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Trees/Workflows/ReportFunctionActionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"ReportFunctionActionWorkflow\" Location=\"30; 30\" Size=\"1155; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"ReportFunctionActionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"ReportFunctionActionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"532; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"542; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"542; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnActiveLocaleWorkflow.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.C1Console.Users.Workflows\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class ChangeOwnActiveLocaleWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public ChangeOwnActiveLocaleWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void changeLocaleCodeActivity_Execute_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            WorkflowActionToken workflowActionToken = (WorkflowActionToken)this.ActionToken;\r\n\r\n            CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(workflowActionToken.Payload);\r\n\r\n            UserSettings.ActiveLocaleCultureInfo = cultureInfo;\r\n\r\n            string currentConsoleId = GetCurrentConsoleId();\r\n\r\n            foreach (string consoleId in GetConsoleIdsOpenedByCurrentUser())\r\n            {\r\n                if (consoleId != currentConsoleId)\r\n                {\r\n                    ConsoleMessageQueueFacade.Enqueue(new CloseAllViewsMessageQueueItem { Reason = StringResourceSystemFacade.GetString(\"Composite.C1Console.Users\", \"ChangeOwnActiveLocaleWorkflow.CloseAllViews.Message\") }, consoleId);\r\n                }\r\n                ConsoleMessageQueueFacade.Enqueue(new CollapseAndRefreshConsoleMessageQueueItem(), consoleId);\r\n                ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem { Name = \"ActiveLocaleChanged\", Value = \"\" }, consoleId);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnActiveLocaleWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Users.Workflows\r\n{\r\n    partial class ChangeOwnActiveLocaleWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.changeLocaleCodeActivity_Execute = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.changeLocaleStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.changeLocaleStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // changeLocaleCodeActivity_Execute\r\n            // \r\n            this.changeLocaleCodeActivity_Execute.Name = \"changeLocaleCodeActivity_Execute\";\r\n            this.changeLocaleCodeActivity_Execute.ExecuteCode += new System.EventHandler(this.changeLocaleCodeActivity_Execute_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"changeLocaleStateActivity\";\r\n            // \r\n            // changeLocaleStateInitializationActivity\r\n            // \r\n            this.changeLocaleStateInitializationActivity.Activities.Add(this.changeLocaleCodeActivity_Execute);\r\n            this.changeLocaleStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.changeLocaleStateInitializationActivity.Name = \"changeLocaleStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // changeLocaleStateActivity\r\n            // \r\n            this.changeLocaleStateActivity.Activities.Add(this.changeLocaleStateInitializationActivity);\r\n            this.changeLocaleStateActivity.Name = \"changeLocaleStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // ChangeOwnActiveLocaleWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.changeLocaleStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"ChangeOwnActiveLocaleWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private CodeActivity changeLocaleCodeActivity_Execute;\r\n        private StateInitializationActivity changeLocaleStateInitializationActivity;\r\n        private StateActivity changeLocaleStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnActiveLocaleWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"ChangeOwnActiveLocaleWorkflow\" Location=\"30; 30\" Size=\"1162; 996\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"ChangeOwnActiveLocaleWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"ChangeOwnActiveLocaleWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"changeLocaleStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"changeLocaleStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"476\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"476\" Y=\"381\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"changeLocaleStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"changeLocaleStateActivity\" EventHandlerName=\"changeLocaleStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"591\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"changeLocaleStateActivity\" Location=\"357; 381\" Size=\"238; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"changeLocaleStateInitializationActivity\" Location=\"365; 412\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"changeLocaleCodeActivity_Execute\" Location=\"375; 474\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"375; 534\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnCultureWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Data;\r\n\r\n\r\nnamespace Composite.C1Console.Users.Workflows\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class ChangeOwnCultureWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public ChangeOwnCultureWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void stepInitialize_codeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            CultureInfo userCulture = UserSettings.CultureInfo; // Copy admins settings\r\n            CultureInfo c1ConsoleUiLanguage = UserSettings.C1ConsoleUiLanguage; // Copy admins settings\r\n\r\n            List<KeyValuePair> regionLanguageList = StringResourceSystemFacade.GetSupportedCulturesList();\r\n            Dictionary<string, string> culturesDictionary = StringResourceSystemFacade.GetAllCultures();\r\n\r\n            this.Bindings.Add(\"AllCultures\", culturesDictionary);\r\n            this.Bindings.Add(\"CultureName\", userCulture.Name);\r\n\r\n            this.Bindings.Add(\"C1ConsoleUiCultures\", regionLanguageList);\r\n            this.Bindings.Add(\"C1ConsoleUiLanguageName\", c1ConsoleUiLanguage.Name);\r\n        }\r\n\r\n\r\n        private void stepFinalize_codeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string cultureName = this.GetBinding<string>(\"CultureName\");\r\n            string c1ConsoleUiLanguageName = this.GetBinding<string>(\"C1ConsoleUiLanguageName\");\r\n\r\n            UserSettings.CultureInfo = new CultureInfo(cultureName);\r\n            UserSettings.C1ConsoleUiLanguage = new CultureInfo(c1ConsoleUiLanguageName);\r\n\r\n            LoggingService.LogVerbose(\"ChangeOwnCultureWorkflow\", string.Format(\"Changed culture for user to {0}\", cultureName));\r\n        }\r\n\r\n\r\n\r\n        private void CultureHasChanged(object sender, ConditionalEventArgs e)\r\n        {\r\n            string cultureName = this.GetBinding<string>(\"CultureName\");\r\n            string c1ConsoleUiLanguageName = this.GetBinding<string>(\"C1ConsoleUiLanguageName\");\r\n\r\n            e.Result = UserSettings.CultureInfo.Name != cultureName || UserSettings.C1ConsoleUiLanguage.Name != c1ConsoleUiLanguageName;\r\n        }\r\n\r\n\r\n\r\n        private void rebootConsoleActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.RebootConsole();\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnCultureWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Users.Workflows\r\n{\r\n    partial class ChangeOwnCultureWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.handleExternalEventActivity1 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.stepInitialize_codeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.handleExternalEventActivity3 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.rebootConsoleActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.stepFinalize_codeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.confirm_eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirm_eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1_eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1_eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmChangeAndReboot = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1State = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finishState\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\ChangeOwnCultureConfirmReboot.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.confirmDialogFormActivity1);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CultureHasChanged);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeActivity\";\r\n            // \r\n            // handleExternalEventActivity1\r\n            // \r\n            this.handleExternalEventActivity1.EventName = \"Finish\";\r\n            this.handleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity1.Name = \"handleExternalEventActivity1\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1State\";\r\n            // \r\n            // stepInitialize_codeActivity\r\n            // \r\n            this.stepInitialize_codeActivity.Name = \"stepInitialize_codeActivity\";\r\n            this.stepInitialize_codeActivity.ExecuteCode += new System.EventHandler(this.stepInitialize_codeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"confirmChangeAndReboot\";\r\n            // \r\n            // handleExternalEventActivity3\r\n            // \r\n            this.handleExternalEventActivity3.EventName = \"Finish\";\r\n            this.handleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity3.Name = \"handleExternalEventActivity3\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = \"Add new\";\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\ChangeOwnCulture.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // rebootConsoleActivity\r\n            // \r\n            this.rebootConsoleActivity.Name = \"rebootConsoleActivity\";\r\n            this.rebootConsoleActivity.ExecuteCode += new System.EventHandler(this.rebootConsoleActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // stepFinalize_codeActivity\r\n            // \r\n            this.stepFinalize_codeActivity.Name = \"stepFinalize_codeActivity\";\r\n            this.stepFinalize_codeActivity.ExecuteCode += new System.EventHandler(this.stepFinalize_codeActivity_ExecuteCode);\r\n            // \r\n            // confirm_eventDrivenActivity_Cancel\r\n            // \r\n            this.confirm_eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirm_eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.confirm_eventDrivenActivity_Cancel.Name = \"confirm_eventDrivenActivity_Cancel\";\r\n            // \r\n            // confirm_eventDrivenActivity_Finish\r\n            // \r\n            this.confirm_eventDrivenActivity_Finish.Activities.Add(this.handleExternalEventActivity1);\r\n            this.confirm_eventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.confirm_eventDrivenActivity_Finish.Name = \"confirm_eventDrivenActivity_Finish\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.ifElseActivity1);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.stepInitialize_codeActivity);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // step1_eventDrivenActivity_Cancel\r\n            // \r\n            this.step1_eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step1_eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1_eventDrivenActivity_Cancel.Name = \"step1_eventDrivenActivity_Cancel\";\r\n            // \r\n            // step1_eventDrivenActivity_Finish\r\n            // \r\n            this.step1_eventDrivenActivity_Finish.Activities.Add(this.handleExternalEventActivity3);\r\n            this.step1_eventDrivenActivity_Finish.Activities.Add(this.setStateActivity11);\r\n            this.step1_eventDrivenActivity_Finish.Name = \"step1_eventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.stepFinalize_codeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.rebootConsoleActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // confirmChangeAndReboot\r\n            // \r\n            this.confirmChangeAndReboot.Activities.Add(this.stateInitializationActivity1);\r\n            this.confirmChangeAndReboot.Activities.Add(this.confirm_eventDrivenActivity_Finish);\r\n            this.confirmChangeAndReboot.Activities.Add(this.confirm_eventDrivenActivity_Cancel);\r\n            this.confirmChangeAndReboot.Name = \"confirmChangeAndReboot\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity19);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // initializeActivity\r\n            // \r\n            this.initializeActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeActivity.Name = \"initializeActivity\";\r\n            // \r\n            // step1State\r\n            // \r\n            this.step1State.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Finish);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Cancel);\r\n            this.step1State.Name = \"step1State\";\r\n            // \r\n            // finalizeActivity\r\n            // \r\n            this.finalizeActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeActivity.Name = \"finalizeActivity\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // ChangeOwnCultureWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.finalizeActivity);\r\n            this.Activities.Add(this.step1State);\r\n            this.Activities.Add(this.initializeActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.confirmChangeAndReboot);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeActivity\";\r\n            this.Name = \"ChangeOwnCultureWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private HandleExternalEventActivity handleExternalEventActivity3;\r\n        private EventDrivenActivity step1_eventDrivenActivity_Finish;\r\n        private StateActivity finishState;\r\n        private StateActivity finalizeActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private CodeActivity stepFinalize_codeActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity initializeActivity;\r\n        private CodeActivity stepInitialize_codeActivity;\r\n        private SetStateActivity setStateActivity11;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity step1WizardFormActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private SetStateActivity setStateActivity19;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private SetStateActivity setStateActivity2;\r\n        private HandleExternalEventActivity handleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private EventDrivenActivity confirm_eventDrivenActivity_Finish;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private StateActivity confirmChangeAndReboot;\r\n        private CodeActivity rebootConsoleActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private EventDrivenActivity confirm_eventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1_eventDrivenActivity_Cancel;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private StateActivity step1State;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnForeignLocaleWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.C1Console.Users.Workflows\r\n{\r\n    public sealed partial class ChangeOwnForeignLocaleWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public ChangeOwnForeignLocaleWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void HasActiveLocales(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = DataLocalizationFacade.ActiveLocalizationCultures.Count() > 1;\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IEnumerable<CultureInfo> foreignCultures =\r\n                    from l in DataLocalizationFacade.ActiveLocalizationCultures\r\n                    select l;\r\n\r\n            List<KeyValuePair<string, string>> foreignCulturesDictionary = foreignCultures.Select(f => new KeyValuePair<string, string>(f.Name, DataLocalizationFacade.GetCultureTitle(f))).OrderBy(f => f.Value).ToList();\r\n            foreignCulturesDictionary.Insert(0, new KeyValuePair<string, string>(\"NONE\", StringResourceSystemFacade.GetString(\"Composite.C1Console.Users\", \"ChangeForeignLocaleWorkflow.NoForeignLocaleLabel\")));\r\n\r\n            string selectedForeignCultureName = \"NONE\";\r\n            if (UserSettings.ForeignLocaleCultureInfo != null)\r\n            {\r\n                selectedForeignCultureName = UserSettings.ForeignLocaleCultureInfo.Name;\r\n            }\r\n\r\n            this.Bindings.Add(\"ForeignCultureName\", selectedForeignCultureName);\r\n            this.Bindings.Add(\"ForeignCulturesList\", foreignCulturesDictionary);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string foreignCultureName = this.GetBinding<string>(\"ForeignCultureName\");\r\n            CultureInfo foreignCultureInfo = null;\r\n            if (foreignCultureName != \"NONE\")\r\n            {\r\n                foreignCultureInfo = CultureInfo.CreateSpecificCulture(foreignCultureName);\r\n            }\r\n\r\n            UserSettings.ForeignLocaleCultureInfo = foreignCultureInfo;\r\n\r\n            foreach (string consoleId in GetConsoleIdsOpenedByCurrentUser())\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem { Name = \"ForeignLocaleChanged\", Value = \"\" }, consoleId);\r\n            }\r\n\r\n            this.CloseCurrentView();\r\n            this.CollapseAndRefresh();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnForeignLocaleWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Users.Workflows\r\n{\r\n    partial class ChangeOwnForeignLocaleWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity2 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.step1CodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.ifElseActivity_HasActiveLocales = new System.Workflow.Activities.IfElseActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.noOrOneActiveLocaleEventDrivenActivit_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.noOrOneActiveLocaleStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.noOrOneActiveLocaleStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"noOrOneActiveLocaleStateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasActiveLocales);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity2\r\n            // \r\n            this.dataDialogFormActivity2.ContainerLabel = null;\r\n            this.dataDialogFormActivity2.FormDefinitionFileName = \"\\\\Administrative\\\\ChangeOwnForeignLocaleStep1.xml\";\r\n            this.dataDialogFormActivity2.Name = \"dataDialogFormActivity2\";\r\n            // \r\n            // step1CodeActivity_Initialize\r\n            // \r\n            this.step1CodeActivity_Initialize.Name = \"step1CodeActivity_Initialize\";\r\n            this.step1CodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.step1CodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\ChangeOwnForeignLocaleNoOrOneActiveLocale.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // ifElseActivity_HasActiveLocales\r\n            // \r\n            this.ifElseActivity_HasActiveLocales.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity_HasActiveLocales.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity_HasActiveLocales.Name = \"ifElseActivity_HasActiveLocales\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity7);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity6);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1CodeActivity_Initialize);\r\n            this.step1StateInitializationActivity.Activities.Add(this.dataDialogFormActivity2);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // noOrOneActiveLocaleEventDrivenActivit_Finish\r\n            // \r\n            this.noOrOneActiveLocaleEventDrivenActivit_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.noOrOneActiveLocaleEventDrivenActivit_Finish.Activities.Add(this.setStateActivity4);\r\n            this.noOrOneActiveLocaleEventDrivenActivit_Finish.Name = \"noOrOneActiveLocaleEventDrivenActivit_Finish\";\r\n            // \r\n            // noOrOneActiveLocaleStateInitializationActivity\r\n            // \r\n            this.noOrOneActiveLocaleStateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.noOrOneActiveLocaleStateInitializationActivity.Name = \"noOrOneActiveLocaleStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity_HasActiveLocales);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // noOrOneActiveLocaleStateActivity\r\n            // \r\n            this.noOrOneActiveLocaleStateActivity.Activities.Add(this.noOrOneActiveLocaleStateInitializationActivity);\r\n            this.noOrOneActiveLocaleStateActivity.Activities.Add(this.noOrOneActiveLocaleEventDrivenActivit_Finish);\r\n            this.noOrOneActiveLocaleStateActivity.Name = \"noOrOneActiveLocaleStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // ChangeOwnForeignLocaleWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.noOrOneActiveLocaleStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"ChangeOwnForeignLocaleWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateActivity noOrOneActiveLocaleStateActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateInitializationActivity noOrOneActiveLocaleStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity_HasActiveLocales;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private CodeActivity step1CodeActivity_Initialize;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private EventDrivenActivity noOrOneActiveLocaleEventDrivenActivit_Finish;\r\n        private SetStateActivity setStateActivity7;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnForeignLocaleWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"ChangeOwnForeignLocaleWorkflow\" Location=\"30; 30\" Size=\"1162; 996\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"ChangeOwnForeignLocaleWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"ChangeOwnForeignLocaleWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"593\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"593\" Y=\"285\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"noOrOneActiveLocaleStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"noOrOneActiveLocaleStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"447\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"447\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"459\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"691\" Y=\"350\" />\r\n\t\t\t\t<ns0:Point X=\"796\" Y=\"350\" />\r\n\t\t\t\t<ns0:Point X=\"796\" Y=\"525\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"695\" Y=\"374\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"374\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"noOrOneActiveLocaleStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"noOrOneActiveLocaleStateActivity\" EventHandlerName=\"noOrOneActiveLocaleEventDrivenActivit_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"524\" />\r\n\t\t\t\t<ns0:Point X=\"434\" Y=\"524\" />\r\n\t\t\t\t<ns0:Point X=\"434\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"895\" Y=\"566\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"566\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity_HasActiveLocales\" Location=\"108; 231\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"127; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"137; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"300; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"310; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"noOrOneActiveLocaleStateActivity\" Location=\"142; 459\" Size=\"280; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"noOrOneActiveLocaleStateInitializationActivity\" Location=\"150; 490\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"dataDialogFormActivity1\" Location=\"160; 552\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"noOrOneActiveLocaleEventDrivenActivit_Finish\" Location=\"150; 514\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"160; 576\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"160; 636\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"488; 285\" Size=\"211; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"step1StateInitializationActivity\" Location=\"496; 316\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_Initialize\" Location=\"506; 378\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"dataDialogFormActivity2\" Location=\"506; 438\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"496; 340\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"506; 402\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"506; 462\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"496; 364\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"506; 426\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"506; 486\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"694; 525\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"702; 556\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"712; 618\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"712; 678\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnPasswordWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_C1Console_Users;\r\n\r\nnamespace Composite.C1Console.Users.Workflows\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class ChangeOwnPasswordWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public ChangeOwnPasswordWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private static class Fields\r\n        {\r\n            public const string OldPassword = \"OldPassword\";\r\n            public const string NewPassword = \"NewPassword\";\r\n            public const string NewPasswordConfirmed = \"NewPasswordConfirmed\";\r\n        }\r\n\r\n        private void ChangePasswordWorkflow_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(Fields.OldPassword, \"\");\r\n            this.Bindings.Add(Fields.NewPassword, \"\");\r\n            this.Bindings.Add(Fields.NewPasswordConfirmed, \"\");\r\n            this.BindingsValidationRules.Add(Fields.OldPassword, new List<ClientValidationRule>{ new NotNullClientValidationRule() });\r\n            this.BindingsValidationRules.Add(Fields.NewPassword, new List<ClientValidationRule>{new NotNullClientValidationRule()});\r\n            this.BindingsValidationRules.Add(Fields.NewPasswordConfirmed, new List<ClientValidationRule>{new NotNullClientValidationRule()});\r\n        }\r\n\r\n\r\n        private void stepFinalize_codeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string newPassword = this.GetBinding<string>(Fields.NewPassword);\r\n\r\n            string currentUserName = UserValidationFacade.GetUsername();\r\n            UserValidationFacade.FormSetUserPassword(currentUserName, newPassword);\r\n\r\n            LoggingService.LogVerbose(\"ChangeOwnPasswordWorkflow\", \r\n                string.Format(\"User '{0}' has changed password.\", UserValidationFacade.GetUsername()),\r\n                LoggingService.Category.Audit);\r\n        }\r\n\r\n\r\n\r\n        private void EnsurePasswordUpdatesAreSupported(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = UserValidationFacade.CanSetUserPassword;\r\n        }\r\n\r\n        private void ValidateSpecifiedPasswords(object sender, ConditionalEventArgs e)\r\n        {\r\n            string oldPassword = this.GetBinding<string>(Fields.OldPassword);\r\n            string newPassword = this.GetBinding<string>(Fields.NewPassword);\r\n            string newPasswordConfirmed = this.GetBinding<string>(Fields.NewPasswordConfirmed);\r\n\r\n            e.Result = ValidateSpecifiedPasswords(oldPassword, newPassword, newPasswordConfirmed);\r\n        }\r\n\r\n        private bool ValidateSpecifiedPasswords(string oldPassword, string newPassword, string newPasswordConfirmed)\r\n        {\r\n            string currentUserName = UserValidationFacade.GetUsername();\r\n\r\n            bool oldPasswordCorrect = UserValidationFacade.FormValidateUserWithoutLogin(currentUserName, oldPassword);\r\n\r\n            if (!oldPasswordCorrect)\r\n            {\r\n                this.ShowFieldMessage(Fields.OldPassword, Texts.ChangeOwnPasswordWorkflow_Dialog_Validation_IncorrectPassword);\r\n                return false;\r\n            }\r\n\r\n            if (newPassword != newPasswordConfirmed)\r\n            {\r\n                this.ShowFieldMessage(Fields.NewPasswordConfirmed, Texts.ChangeOwnPasswordWorkflow_Dialog_Validation_NewPasswordFieldsNotMatch);\r\n                return false;\r\n            }\r\n\r\n            if (newPassword == oldPassword)\r\n            {\r\n                this.ShowFieldMessage(Fields.NewPassword, Texts.ChangeOwnPasswordWorkflow_Dialog_Validation_PasswordsAreTheSame);\r\n                return false;\r\n            }\r\n\r\n            if (string.IsNullOrEmpty(newPassword))\r\n            {\r\n                this.ShowFieldMessage(Fields.NewPassword, Texts.ChangeOwnPasswordWorkflow_Dialog_Validation_NewPasswordIsEmpty);\r\n                return false;\r\n            }\r\n\r\n            string userName = UserValidationFacade.GetUsername();\r\n\r\n            var user = DataFacade.GetData<IUser>(u => string.Compare(u.Username, userName, StringComparison.InvariantCultureIgnoreCase) == 0)\r\n                .FirstOrException(\"No user found with name '{0}'\", userName);\r\n\r\n            IList<string> newPasswordValidationMessages;\r\n            if (!PasswordPolicyFacade.ValidatePassword(user, newPassword, out newPasswordValidationMessages))\r\n            {\r\n                foreach (var message in newPasswordValidationMessages)\r\n                {\r\n                    this.ShowFieldMessage(Fields.NewPassword, message);\r\n                }\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        private void InitializeConditionsNotMetAlertActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(DialogType.Error, Texts.ChangeOwnPasswordWorkflow_NotSupportedErrorLabel, Texts.ChangeOwnPasswordWorkflow_NotSupportedErrorText);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/C1Console/Users/Workflows/ChangeOwnPasswordWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.C1Console.Users.Workflows\r\n{\r\n    partial class ChangeOwnPasswordWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity20 = new System.Workflow.Activities.SetStateActivity();\r\n            this.InitializeConditionsNotMetAlertActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ChangePasswordWorkflow_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeConditionsNotMetBranchActivity = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.initializeConditionsMetBranchActivity = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.initializeConditionsMetIfElseActivity = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.handleExternalEventActivity2 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.handleExternalEventActivity1 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.stepFinalize_codeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1_eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1_eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1State = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity20\r\n            // \r\n            this.setStateActivity20.Name = \"setStateActivity20\";\r\n            this.setStateActivity20.TargetStateName = \"finishState\";\r\n            // \r\n            // InitializeConditionsNotMetAlertActivity\r\n            // \r\n            this.InitializeConditionsNotMetAlertActivity.Name = \"InitializeConditionsNotMetAlertActivity\";\r\n            this.InitializeConditionsNotMetAlertActivity.ExecuteCode += new System.EventHandler(this.InitializeConditionsNotMetAlertActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1State\";\r\n            // \r\n            // ChangePasswordWorkflow_Initialize\r\n            // \r\n            this.ChangePasswordWorkflow_Initialize.Name = \"ChangePasswordWorkflow_Initialize\";\r\n            this.ChangePasswordWorkflow_Initialize.ExecuteCode += new System.EventHandler(this.ChangePasswordWorkflow_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1State\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalizeActivity\";\r\n            // \r\n            // initializeConditionsNotMetBranchActivity\r\n            // \r\n            this.initializeConditionsNotMetBranchActivity.Activities.Add(this.InitializeConditionsNotMetAlertActivity);\r\n            this.initializeConditionsNotMetBranchActivity.Activities.Add(this.setStateActivity20);\r\n            this.initializeConditionsNotMetBranchActivity.Name = \"initializeConditionsNotMetBranchActivity\";\r\n            // \r\n            // initializeConditionsMetBranchActivity\r\n            // \r\n            this.initializeConditionsMetBranchActivity.Activities.Add(this.ChangePasswordWorkflow_Initialize);\r\n            this.initializeConditionsMetBranchActivity.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.EnsurePasswordUpdatesAreSupported);\r\n            this.initializeConditionsMetBranchActivity.Condition = codecondition1;\r\n            this.initializeConditionsMetBranchActivity.Name = \"initializeConditionsMetBranchActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity4);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateSpecifiedPasswords);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // initializeConditionsMetIfElseActivity\r\n            // \r\n            this.initializeConditionsMetIfElseActivity.Activities.Add(this.initializeConditionsMetBranchActivity);\r\n            this.initializeConditionsMetIfElseActivity.Activities.Add(this.initializeConditionsNotMetBranchActivity);\r\n            this.initializeConditionsMetIfElseActivity.Name = \"initializeConditionsMetIfElseActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finishState\";\r\n            // \r\n            // handleExternalEventActivity2\r\n            // \r\n            this.handleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.handleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity2.Name = \"handleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // handleExternalEventActivity1\r\n            // \r\n            this.handleExternalEventActivity1.EventName = \"Finish\";\r\n            this.handleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity1.Name = \"handleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\ChangeOwnPassword.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // stepFinalize_codeActivity\r\n            // \r\n            this.stepFinalize_codeActivity.Name = \"stepFinalize_codeActivity\";\r\n            this.stepFinalize_codeActivity.ExecuteCode += new System.EventHandler(this.stepFinalize_codeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeConditionsMetIfElseActivity);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // step1_eventDrivenActivity_Cancel\r\n            // \r\n            this.step1_eventDrivenActivity_Cancel.Activities.Add(this.handleExternalEventActivity2);\r\n            this.step1_eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.step1_eventDrivenActivity_Cancel.Name = \"step1_eventDrivenActivity_Cancel\";\r\n            // \r\n            // step1_eventDrivenActivity_Finish\r\n            // \r\n            this.step1_eventDrivenActivity_Finish.Activities.Add(this.handleExternalEventActivity1);\r\n            this.step1_eventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1_eventDrivenActivity_Finish.Name = \"step1_eventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.stepFinalize_codeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity19);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // initializeActivity\r\n            // \r\n            this.initializeActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeActivity.Name = \"initializeActivity\";\r\n            // \r\n            // step1State\r\n            // \r\n            this.step1State.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Finish);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Cancel);\r\n            this.step1State.Name = \"step1State\";\r\n            // \r\n            // finalizeActivity\r\n            // \r\n            this.finalizeActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeActivity.Name = \"finalizeActivity\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // ChangeOwnPasswordWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.finalizeActivity);\r\n            this.Activities.Add(this.step1State);\r\n            this.Activities.Add(this.initializeActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeActivity\";\r\n            this.Name = \"ChangeOwnPasswordWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private HandleExternalEventActivity handleExternalEventActivity1;\r\n        private EventDrivenActivity step1_eventDrivenActivity_Finish;\r\n        private StateActivity finishState;\r\n        private StateActivity finalizeActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private CodeActivity stepFinalize_codeActivity;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity initializeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private SetStateActivity setStateActivity19;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private CodeActivity ChangePasswordWorkflow_Initialize;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private HandleExternalEventActivity handleExternalEventActivity2;\r\n        private EventDrivenActivity step1_eventDrivenActivity_Cancel;\r\n        private SetStateActivity setStateActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity20;\r\n        private CodeActivity InitializeConditionsNotMetAlertActivity;\r\n        private IfElseBranchActivity initializeConditionsNotMetBranchActivity;\r\n        private IfElseBranchActivity initializeConditionsMetBranchActivity;\r\n        private IfElseActivity initializeConditionsMetIfElseActivity;\r\n        private StateActivity step1State;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Composite.Workflows.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\r\n    <ProductVersion>9.0.30729</ProductVersion>\r\n    <SchemaVersion>2.0</SchemaVersion>\r\n    <ProjectGuid>{1FE08476-346A-4053-813D-8807C0E0FC36}</ProjectGuid>\r\n    <OutputType>Library</OutputType>\r\n    <AppDesignerFolder>Properties</AppDesignerFolder>\r\n    <RootNamespace>Composite</RootNamespace>\r\n    <AssemblyName>Composite.Workflows</AssemblyName>\r\n    <ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\r\n    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>\r\n    <FileAlignment>512</FileAlignment>\r\n    <SccProjectName>SAK</SccProjectName>\r\n    <SccLocalPath>SAK</SccLocalPath>\r\n    <SccAuxPath>SAK</SccAuxPath>\r\n    <SccProvider>SAK</SccProvider>\r\n    <FileUpgradeFlags>\r\n    </FileUpgradeFlags>\r\n    <OldToolsVersion>3.5</OldToolsVersion>\r\n    <UpgradeBackupLocation />\r\n    <PublishUrl>publish\\</PublishUrl>\r\n    <Install>true</Install>\r\n    <InstallFrom>Disk</InstallFrom>\r\n    <UpdateEnabled>false</UpdateEnabled>\r\n    <UpdateMode>Foreground</UpdateMode>\r\n    <UpdateInterval>7</UpdateInterval>\r\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\r\n    <UpdatePeriodically>false</UpdatePeriodically>\r\n    <UpdateRequired>false</UpdateRequired>\r\n    <MapFileExtensions>true</MapFileExtensions>\r\n    <ApplicationRevision>0</ApplicationRevision>\r\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\r\n    <IsWebBootstrapper>false</IsWebBootstrapper>\r\n    <UseApplicationTrust>false</UseApplicationTrust>\r\n    <BootstrapperEnabled>true</BootstrapperEnabled>\r\n    <TargetFrameworkProfile />\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>false</Optimize>\r\n    <OutputPath>bin\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>\r\n    <Prefer32Bit>false</Prefer32Bit>\r\n    <NoWarn>618</NoWarn>\r\n    <LangVersion>7</LangVersion>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\r\n    <DebugType>pdbonly</DebugType>\r\n    <Optimize>true</Optimize>\r\n    <OutputPath>bin\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>\r\n    <Prefer32Bit>false</Prefer32Bit>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Common, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Common.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Logging.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Validation, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Validation.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.ObjectBuilder, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.ObjectBuilder.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.SqlServer.ConnectionInfo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.SqlServer.ConnectionInfo.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"System.configuration\" />\r\n    <Reference Include=\"System.Configuration.Install\" />\r\n    <Reference Include=\"System.Core\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Data.Linq\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Drawing\" />\r\n    <Reference Include=\"System.Drawing.Design\" />\r\n    <Reference Include=\"System.IO.Compression\" />\r\n    <Reference Include=\"System.Management\" />\r\n    <Reference Include=\"System.Runtime.Serialization\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Security\" />\r\n    <Reference Include=\"System.ServiceModel\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.ServiceModel.Web\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Transactions\" />\r\n    <Reference Include=\"System.Web\" />\r\n    <Reference Include=\"System.Web.Extensions\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.Services\" />\r\n    <Reference Include=\"System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.3.2.3\\lib\\net45\\System.Web.WebPages.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Workflow.Activities\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Workflow.ComponentModel\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Workflow.Runtime\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Xml.Linq\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Data.DataSetExtensions\">\r\n      <RequiredTargetFramework>3.5</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Data\" />\r\n    <Reference Include=\"System.Xml\" />\r\n    <Reference Include=\"TidyNet, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\TidyNet.dll</HintPath>\r\n    </Reference>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"C1Console\\Actions\\Workflows\\EntityTokenLockedWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Actions\\Workflows\\EntityTokenLockedWorkflow.designer.cs\">\r\n      <DependentUpon>EntityTokenLockedWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Actions\\Workflows\\FlowInformationScavengerWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Actions\\Workflows\\FlowInformationScavengerWorkflow.designer.cs\">\r\n      <DependentUpon>FlowInformationScavengerWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Actions\\Workflows\\SecurityViolationWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Actions\\Workflows\\SecurityViolationWorkflow.designer.cs\">\r\n      <DependentUpon>SecurityViolationWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Events\\Workflows\\UserConsoleInformationScavengerWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Events\\Workflows\\UserConsoleInformationScavengerWorkflow.designer.cs\">\r\n      <DependentUpon>UserConsoleInformationScavengerWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddAssociatedDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddAssociatedDataWorkflow.designer.cs\">\r\n      <DependentUpon>AddAssociatedDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddDataFolderExWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddDataFolderExWorkflow.designer.cs\">\r\n      <DependentUpon>AddDataFolderExWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddMetaDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddMetaDataWorkflow.designer.cs\">\r\n      <DependentUpon>AddMetaDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteAssociatedDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteAssociatedDataWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteAssociatedDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteDataFolderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteDataFolderWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteDataFolderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteMetaDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteMetaDataWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteMetaDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\EditAssociatedDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\EditAssociatedDataWorkflow.designer.cs\">\r\n      <DependentUpon>EditAssociatedDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\EditMetaDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\EditMetaDataWorkflow.designer.cs\">\r\n      <DependentUpon>EditMetaDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Scheduling\\BaseSchedulerWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Scheduling\\BaseSchedulerWorkflow.designer.cs\">\r\n      <DependentUpon>BaseSchedulerWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Scheduling\\DataPublishSchedulerWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Scheduling\\DataUnpublishSchedulerWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Scheduling\\PagePublishSchedulerWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Scheduling\\PageUnpublishSchedulerWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Scheduling\\PublishControlledHelper.cs\" />\r\n    <Compile Include=\"C1Console\\Tools\\SetTimeZoneWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Tools\\SetTimeZoneWorkflow.designer.cs\">\r\n      <DependentUpon>SetTimeZoneWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\FunctionTesterWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\FunctionTesterWorkflow.designer.cs\">\r\n      <DependentUpon>FunctionTesterWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\Common\\BaseFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\Common\\KeyFieldHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\Common\\PageTemplateHelper.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddTypeToWhiteListWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddTypeToWhiteListWorkflow.designer.cs\">\r\n      <DependentUpon>AddTypeToWhiteListWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\RemoveTypeFromWhiteListWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\RemoveTypeFromWhiteListWorkflow.designer.cs\">\r\n      <DependentUpon>RemoveTypeFromWhiteListWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\AddSystemLocaleWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\AddSystemLocaleWorkflow.designer.cs\">\r\n      <DependentUpon>AddSystemLocaleWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\DefineDefaultActiveLocaleWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\DefineDefaultActiveLocaleWorkflow.designer.cs\">\r\n      <DependentUpon>DefineDefaultActiveLocaleWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\EditSystemLocaleWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\EditSystemLocaleWorkflow.designer.cs\">\r\n      <DependentUpon>EditSystemLocaleWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\RemoveSystemLocaleWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\RemoveSystemLocaleWorkflow.designer.cs\">\r\n      <DependentUpon>RemoveSystemLocaleWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddMediaZipFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddMediaZipFileWorkflow.Designer.cs\">\r\n      <DependentUpon>AddMediaZipFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddNewMediaFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddNewMediaFileWorkflow.designer.cs\">\r\n      <DependentUpon>AddNewMediaFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddNewMediaFolderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddNewMediaFolderWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewMediaFolderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFileContentWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFileContentWorkflow.designer.cs\">\r\n      <DependentUpon>EditMediaFileContentWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\DeleteMediaFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\DeleteMediaFileWorkflow.Designer.cs\">\r\n      <DependentUpon>DeleteMediaFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\DeleteMediaFolderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\DeleteMediaFolderWorkflow.Designer.cs\">\r\n      <DependentUpon>DeleteMediaFolderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFileTextContentWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFileTextContentWorkflow.designer.cs\">\r\n      <DependentUpon>EditMediaFileTextContentWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFileWorkflow.Designer.cs\">\r\n      <DependentUpon>EditMediaFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFolderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFolderWorkflow.Designer.cs\">\r\n      <DependentUpon>EditMediaFolderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\UploadNewMediaFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\UploadNewMediaFileWorkflow.Designer.cs\">\r\n      <DependentUpon>UploadNewMediaFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\AddNewMethodBasedFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\AddNewMethodBasedFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewMethodBasedFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\AddInlineFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\AddInlineFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>AddInlineFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\DeleteInlineFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\DeleteInlineFunctionWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteInlineFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\DeleteMethodBasedFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\DeleteMethodBasedFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>DeleteMethodBasedFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\EditInlineFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\EditInlineFunctionWorkflow.designer.cs\">\r\n      <DependentUpon>EditInlineFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\EditMethodBasedFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\EditMethodBasedFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>EditMethodBasedFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\AddPackageSourceWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\AddPackageSourceWorkflow.designer.cs\">\r\n      <DependentUpon>AddPackageSourceWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\DeletePackageSourceWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\DeletePackageSourceWorkflow.designer.cs\">\r\n      <DependentUpon>DeletePackageSourceWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallLocalPackageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallLocalPackageWorkflow.designer.cs\">\r\n      <DependentUpon>InstallLocalPackageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallRemotePackageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallRemotePackageWorkflow.designer.cs\">\r\n      <DependentUpon>InstallRemotePackageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\UninstallLocalPackageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\UninstallLocalPackageWorkflow.designer.cs\">\r\n      <DependentUpon>UninstallLocalPackageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\UninstallRemotePackageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\UninstallRemotePackageWorkflow.designer.cs\">\r\n      <DependentUpon>UninstallRemotePackageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\ViewAvailablePackageInfoWorkflowWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\ViewAvailablePackageInfoWorkflowWorkflow.designer.cs\">\r\n      <DependentUpon>ViewAvailablePackageInfoWorkflowWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\ViewInstalledPackageInfoWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\ViewInstalledPackageInfoWorkflow.designer.cs\">\r\n      <DependentUpon>ViewInstalledPackageInfoWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\AddNewPageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\AddNewPageWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewPageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\DeletePageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\DeletePageWorkflow.Designer.cs\">\r\n      <DependentUpon>DeletePageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\EditPageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\EditPageWorkflow.Designer.cs\">\r\n      <DependentUpon>EditPageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\UnLocalizePageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\UnLocalizePageWorkflow.designer.cs\">\r\n      <DependentUpon>UnLocalizePageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\LocalizePageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\LocalizePageWorkflow.designer.cs\">\r\n      <DependentUpon>LocalizePageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\UndoUnpublishedChangesWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\UndoUnpublishedChangesWorkflow.designer.cs\">\r\n      <DependentUpon>UndoUnpublishedChangesWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewPageTemplateWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewPageTemplateWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewPageTemplateWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewRazorPageTemplateWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewRazorPageTemplateWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewRazorPageTemplateWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewMasterPagePageTemplateWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewMasterPagePageTemplateWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewMasterPagePageTemplateWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewXmlPageTemplateWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewXmlPageTemplateWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewXmlPageTemplateWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditMasterPageWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditMasterPageWorkflow.designer.cs\">\r\n      <DependentUpon>EditMasterPageWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\DeletePageTemplateWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\DeletePageTemplateWorkflow.Designer.cs\">\r\n      <DependentUpon>DeletePageTemplateWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditXmlPageTemplateWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditXmlPageTemplateWorkflow.Designer.cs\">\r\n      <DependentUpon>EditXmlPageTemplateWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditRazorPageTemplateWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditRazorPageTemplateWorkflow.designer.cs\">\r\n      <DependentUpon>EditRazorPageTemplateWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditSharedCodeFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditSharedCodeFileWorkflow.designer.cs\">\r\n      <DependentUpon>EditSharedCodeFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\TogglePageTemplateFeatureEditorWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\TogglePageTemplateFeatureEditorWorkflow.designer.cs\">\r\n      <DependentUpon>TogglePageTemplateFeatureEditorWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddNewPageTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddNewPageTypeWorkflow.designer.cs\">\r\n      <DependentUpon>AddNewPageTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddPageTypeDefaultPageContentWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddPageTypeDefaultPageContentWorkflow.designer.cs\">\r\n      <DependentUpon>AddPageTypeDefaultPageContentWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddPageTypeMetaDataFieldWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddPageTypeMetaDataFieldWorkflow.designer.cs\">\r\n      <DependentUpon>AddPageTypeMetaDataFieldWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\DeletePageTypeMetaDataFieldWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\DeletePageTypeMetaDataFieldWorkflow.designer.cs\">\r\n      <DependentUpon>DeletePageTypeMetaDataFieldWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\DeletePageTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\DeletePageTypeWorkflow.designer.cs\">\r\n      <DependentUpon>DeletePageTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeDefaultPageContentWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeDefaultPageContentWorkflow.designer.cs\">\r\n      <DependentUpon>EditPageTypeDefaultPageContentWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeMetaDataFieldWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeMetaDataFieldWorkflow.designer.cs\">\r\n      <DependentUpon>EditPageTypeMetaDataFieldWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeWorkflow.designer.cs\">\r\n      <DependentUpon>EditPageTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionProviderElementProvider\\AddNewRazorFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionProviderElementProvider\\AddNewRazorFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewRazorFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionProviderElementProvider\\DeleteRazorFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionProviderElementProvider\\DeleteRazorFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>DeleteRazorFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionProviderElementProvider\\EditRazorFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionProviderElementProvider\\EditRazorFunctionWorkflow.designer.cs\">\r\n      <DependentUpon>EditRazorFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\AddNewSqlConnectionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\AddNewSqlConnectionWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewSqlConnectionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\AddNewSqlFunctionProviderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\AddNewSqlFunctionProviderWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewSqlFunctionProviderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\DeleteSqlConnectionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\DeleteSqlConnectionWorkflow.Designer.cs\">\r\n      <DependentUpon>DeleteSqlConnectionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\DeleteSqlFunctionProviderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\DeleteSqlFunctionProviderWorkflow.Designer.cs\">\r\n      <DependentUpon>DeleteSqlFunctionProviderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\EditSqlConnectionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\EditSqlConnectionWorkflow.Designer.cs\">\r\n      <DependentUpon>EditSqlConnectionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\EditSqlFunctionProviderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\EditSqlFunctionProviderWorkflow.Designer.cs\">\r\n      <DependentUpon>EditSqlFunctionProviderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionProviderElementProvider\\AddNewUserControlFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionProviderElementProvider\\AddNewUserControlFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewUserControlFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionProviderElementProvider\\DeleteUserControlFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionProviderElementProvider\\DeleteUserControlFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>DeleteUserControlFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionProviderElementProvider\\EditUserControlFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionProviderElementProvider\\EditUserControlFunctionWorkflow.designer.cs\">\r\n      <DependentUpon>EditUserControlFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\AddNewUserWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\AddNewUserWorkflow.designer.cs\">\r\n      <DependentUpon>AddNewUserWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\DeleteUserWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\DeleteUserWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteUserWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\EditUserWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\EditUserWorkflow.designer.cs\">\r\n      <DependentUpon>EditUserWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\AddNewUserGroupWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\AddNewUserGroupWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewUserGroupWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\DeleteUserGroupWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\DeleteUserGroupWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteUserGroupWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\EditUserGroupWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\EditUserGroupWorkflow.designer.cs\">\r\n      <DependentUpon>EditUserGroupWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\AddNewVisualFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\AddNewVisualFunctionWorkflow.designer.cs\">\r\n      <DependentUpon>AddNewVisualFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\DeleteVisualFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\DeleteVisualFunctionWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteVisualFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\EditVisualFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\EditVisualFunctionWorkflow.designer.cs\">\r\n      <DependentUpon>EditVisualFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\UploadAndExtractZipFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\UploadAndExtractZipFileWorkflow.Designer.cs\">\r\n      <DependentUpon>UploadAndExtractZipFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\AddNewWebsiteFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\AddNewWebsiteFileWorkflow.designer.cs\">\r\n      <DependentUpon>AddNewWebsiteFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\AddNewWebsiteFolderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\AddNewWebsiteFolderWorkflow.designer.cs\">\r\n      <DependentUpon>AddNewWebsiteFolderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\AddWebsiteFolderToWhiteListWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\AddWebsiteFolderToWhiteListWorkflow.designer.cs\">\r\n      <DependentUpon>AddWebsiteFolderToWhiteListWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\DeleteWebsiteFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\DeleteWebsiteFileWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteWebsiteFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\DeleteWebsiteFolderWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\DeleteWebsiteFolderWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteWebsiteFolderWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\EditWebsiteFileTextContentWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\EditWebsiteFileTextContentWorkflow.designer.cs\">\r\n      <DependentUpon>EditWebsiteFileTextContentWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\RemoveWebsiteFolderFromWhiteListWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\RemoveWebsiteFolderFromWhiteListWorkflow.designer.cs\">\r\n      <DependentUpon>RemoveWebsiteFolderFromWhiteListWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\UploadWebsiteFileWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\UploadWebsiteFileWorkflow.designer.cs\">\r\n      <DependentUpon>UploadWebsiteFileWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\AddPageTemplateFeatureWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\AddPageTemplateFeatureWorkflow.designer.cs\">\r\n      <DependentUpon>AddPageTemplateFeatureWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\DeletePageTemplateFeatureWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\DeletePageTemplateFeatureWorkflow.designer.cs\">\r\n      <DependentUpon>DeletePageTemplateFeatureWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\EditPageTemplateFeatureWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\EditPageTemplateFeatureWorkflow.designer.cs\">\r\n      <DependentUpon>EditPageTemplateFeatureWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\AddNewXsltFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\AddNewXsltFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewXsltFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\Common.cs\" />\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\DeleteXsltFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\DeleteXsltFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>DeleteXsltFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\EditXsltFunctionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\EditXsltFunctionWorkflow.Designer.cs\">\r\n      <DependentUpon>EditXsltFunctionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\r\n    <Compile Include=\"..\\Composite\\Properties\\SharedAssemblyInfo.cs\">\r\n      <Link>Properties\\SharedAssemblyInfo.cs</Link>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewCompositionTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewCompositionTypeWorkflow.designer.cs\">\r\n      <DependentUpon>AddNewCompositionTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewDataWorkflow.Designer.cs\">\r\n      <DependentUpon>AddNewDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewInterfaceTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewInterfaceTypeWorkflow.designer.cs\">\r\n      <DependentUpon>AddNewInterfaceTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteAggregationTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteAggregationTypeWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteAggregationTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteCompositionTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteCompositionTypeWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteCompositionTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteDataWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteInterfaceTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteInterfaceTypeWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteInterfaceTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DisableTypeLocalizationWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DisableTypeLocalizationWorkflow.designer.cs\">\r\n      <DependentUpon>DisableTypeLocalizationWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditCompositionTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditCompositionTypeWorkflow.designer.cs\">\r\n      <DependentUpon>EditCompositionTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditDataWorkflow.Designer.cs\">\r\n      <DependentUpon>EditDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditFormWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditFormWorkflow.designer.cs\">\r\n      <DependentUpon>EditFormWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditInterfaceTypeWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditInterfaceTypeWorkflow.Designer.cs\">\r\n      <DependentUpon>EditInterfaceTypeWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EnableTypeLocalizationWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EnableTypeLocalizationWorkflow.designer.cs\">\r\n      <DependentUpon>EnableTypeLocalizationWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\LocalizeDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\LocalizeDataWorkflow.designer.cs\">\r\n      <DependentUpon>LocalizeDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Tools\\SendMessageToConsolesWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Tools\\SendMessageToConsolesWorkflow.designer.cs\">\r\n      <DependentUpon>SendMessageToConsolesWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\AddApplicationWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\AddApplicationWorkflow.designer.cs\">\r\n      <DependentUpon>AddApplicationWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\AddTreeDefinitionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\AddTreeDefinitionWorkflow.designer.cs\">\r\n      <DependentUpon>AddTreeDefinitionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\ConfirmActionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\ConfirmActionWorkflow.designer.cs\">\r\n      <DependentUpon>ConfirmActionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\DeleteTreeDefinitionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\DeleteTreeDefinitionWorkflow.designer.cs\">\r\n      <DependentUpon>DeleteTreeDefinitionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\EditTreeDefinitionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\EditTreeDefinitionWorkflow.designer.cs\">\r\n      <DependentUpon>EditTreeDefinitionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\GenericAddDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\GenericAddDataWorkflow.designer.cs\">\r\n      <DependentUpon>GenericAddDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\GenericDeleteDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\GenericDeleteDataWorkflow.designer.cs\">\r\n      <DependentUpon>GenericDeleteDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\GenericEditDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\GenericEditDataWorkflow.designer.cs\">\r\n      <DependentUpon>GenericEditDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\LocalizeDataWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\LocalizeDataWorkflow.designer.cs\">\r\n      <DependentUpon>LocalizeDataWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\RemoveApplicationWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\RemoveApplicationWorkflow.designer.cs\">\r\n      <DependentUpon>RemoveApplicationWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\ReportFunctionActionWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Trees\\Workflows\\ReportFunctionActionWorkflow.designer.cs\">\r\n      <DependentUpon>ReportFunctionActionWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Users\\Workflows\\ChangeOwnActiveLocaleWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Users\\Workflows\\ChangeOwnActiveLocaleWorkflow.designer.cs\">\r\n      <DependentUpon>ChangeOwnActiveLocaleWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Users\\Workflows\\ChangeOwnCultureWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Users\\Workflows\\ChangeOwnCultureWorkflow.designer.cs\">\r\n      <DependentUpon>ChangeOwnCultureWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Users\\Workflows\\ChangeOwnForeignLocaleWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Users\\Workflows\\ChangeOwnForeignLocaleWorkflow.designer.cs\">\r\n      <DependentUpon>ChangeOwnForeignLocaleWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Users\\Workflows\\ChangeOwnPasswordWorkflow.cs\">\r\n      <SubType>Component</SubType>\r\n    </Compile>\r\n    <Compile Include=\"C1Console\\Users\\Workflows\\ChangeOwnPasswordWorkflow.designer.cs\">\r\n      <DependentUpon>ChangeOwnPasswordWorkflow.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Properties\\GitCommitInfo.cs\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <EmbeddedResource Include=\"C1Console\\Actions\\Workflows\\EntityTokenLockedWorkflow.layout\">\r\n      <DependentUpon>EntityTokenLockedWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Actions\\Workflows\\FlowInformationScavengerWorkflow.layout\">\r\n      <DependentUpon>FlowInformationScavengerWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Actions\\Workflows\\SecurityViolationWorkflow.layout\">\r\n      <DependentUpon>SecurityViolationWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Events\\Workflows\\UserConsoleInformationScavengerWorkflow.layout\">\r\n      <DependentUpon>UserConsoleInformationScavengerWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddAssociatedDataWorkflow.layout\">\r\n      <DependentUpon>AddAssociatedDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddDataFolderExWorkflow.layout\">\r\n      <DependentUpon>AddDataFolderExWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\AddMetaDataWorkflow.layout\">\r\n      <DependentUpon>AddMetaDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteAssociatedDataWorkflow.layout\">\r\n      <DependentUpon>DeleteAssociatedDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteDataFolderWorkflow.layout\">\r\n      <DependentUpon>DeleteDataFolderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\DeleteMetaDataWorkflow.layout\">\r\n      <DependentUpon>DeleteMetaDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\EditAssociatedDataWorkflow.layout\">\r\n      <DependentUpon>EditAssociatedDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Elements\\ElementProviderHelpers\\AssociatedDataElementProviderHelper\\EditMetaDataWorkflow.layout\">\r\n      <DependentUpon>EditMetaDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\AllFunctionsElementProvider\\FunctionTesterWorkflow.layout\">\r\n      <DependentUpon>FunctionTesterWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddTypeToWhiteListWorkflow.layout\">\r\n      <DependentUpon>AddTypeToWhiteListWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteDataWorkflow.layout\">\r\n      <DependentUpon>DeleteDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\RemoveTypeFromWhiteListWorkflow.layout\">\r\n      <DependentUpon>RemoveTypeFromWhiteListWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\AddSystemLocaleWorkflow.layout\">\r\n      <DependentUpon>AddSystemLocaleWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\DefineDefaultActiveLocaleWorkflow.layout\">\r\n      <DependentUpon>DefineDefaultActiveLocaleWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\EditSystemLocaleWorkflow.layout\">\r\n      <DependentUpon>EditSystemLocaleWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\LocalizationElementProvider\\RemoveSystemLocaleWorkflow.layout\">\r\n      <DependentUpon>RemoveSystemLocaleWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddMediaZipFileWorkflow.layout\">\r\n      <DependentUpon>AddMediaZipFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddNewMediaFileWorkflow.layout\">\r\n      <DependentUpon>AddNewMediaFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\AddNewMediaFolderWorkflow.layout\">\r\n      <DependentUpon>AddNewMediaFolderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\DeleteMediaFileWorkflow.layout\">\r\n      <DependentUpon>DeleteMediaFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\DeleteMediaFolderWorkflow.layout\">\r\n      <DependentUpon>DeleteMediaFolderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFileContentWorkflow.layout\">\r\n      <DependentUpon>EditMediaFileContentWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFileWorkflow.layout\">\r\n      <DependentUpon>EditMediaFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\EditMediaFolderWorkflow.layout\">\r\n      <DependentUpon>EditMediaFolderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MediaFileProviderElementProvider\\UploadNewMediaFileWorkflow.layout\">\r\n      <DependentUpon>UploadNewMediaFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\AddInlineFunctionWorkflow.layout\">\r\n      <DependentUpon>AddInlineFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\AddNewMethodBasedFunctionWorkflow.layout\">\r\n      <DependentUpon>AddNewMethodBasedFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\DeleteInlineFunctionWorkflow.layout\">\r\n      <DependentUpon>DeleteMethodBasedFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\DeleteMethodBasedFunctionWorkflow.layout\">\r\n      <DependentUpon>DeleteInlineFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\EditInlineFunctionWorkflow.layout\">\r\n      <DependentUpon>EditInlineFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\MethodBasedFunctionProviderElementProvider\\EditMethodBasedFunctionWorkflow.layout\">\r\n      <DependentUpon>EditMethodBasedFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\AddPackageSourceWorkflow.layout\">\r\n      <DependentUpon>AddPackageSourceWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\DeletePackageSourceWorkflow.layout\">\r\n      <DependentUpon>DeletePackageSourceWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallLocalPackageWorkflow.layout\">\r\n      <DependentUpon>InstallLocalPackageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\InstallRemotePackageWorkflow.layout\">\r\n      <DependentUpon>InstallRemotePackageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\UninstallLocalPackageWorkflow.layout\">\r\n      <DependentUpon>UninstallLocalPackageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\UninstallRemotePackageWorkflow.layout\">\r\n      <DependentUpon>UninstallRemotePackageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\ViewAvailablePackageInfoWorkflowWorkflow.layout\">\r\n      <DependentUpon>ViewAvailablePackageInfoWorkflowWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PackageElementProvider\\ViewInstalledPackageInfoWorkflow.layout\">\r\n      <DependentUpon>ViewInstalledPackageInfoWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\AddNewPageWorkflow.layout\">\r\n      <DependentUpon>AddNewPageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\DeletePageWorkflow.layout\">\r\n      <DependentUpon>DeletePageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\EditPageWorkflow.layout\">\r\n      <DependentUpon>EditPageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\LocalizePageWorkflow.layout\">\r\n      <DependentUpon>LocalizePageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\UndoUnpublishedChangesWorkflow.layout\">\r\n      <DependentUpon>UndoUnpublishedChangesWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageElementProvider\\UnLocalizePageWorkflow.layout\">\r\n      <DependentUpon>UnLocalizePageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewMasterPagePageTemplateWorkflow.layout\">\r\n      <DependentUpon>AddNewMasterPagePageTemplateWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewPageTemplateWorkflow.layout\">\r\n      <DependentUpon>AddNewPageTemplateWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\AddNewRazorPageTemplateWorkflow.layout\">\r\n      <DependentUpon>AddNewRazorPageTemplateWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\DeletePageTemplateWorkflow.layout\">\r\n      <DependentUpon>DeletePageTemplateWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditMasterPageWorkflow.layout\">\r\n      <DependentUpon>EditMasterPageWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditRazorPageTemplateWorkflow.layout\">\r\n      <DependentUpon>EditRazorPageTemplateWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateElementProvider\\EditSharedCodeFileWorkflow.layout\">\r\n      <DependentUpon>EditSharedCodeFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\AddPageTemplateFeatureWorkflow.layout\">\r\n      <DependentUpon>AddPageTemplateFeatureWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\DeletePageTemplateFeatureWorkflow.layout\">\r\n      <DependentUpon>DeletePageTemplateFeatureWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\TogglePageTemplateFeatureEditorWorkflow.layout\">\r\n      <DependentUpon>TogglePageTemplateFeatureEditorWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddNewPageTypeWorkflow.layout\">\r\n      <DependentUpon>AddNewPageTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddPageTypeDefaultPageContentWorkflow.layout\">\r\n      <DependentUpon>AddPageTypeDefaultPageContentWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\AddPageTypeMetaDataFieldWorkflow.layout\">\r\n      <DependentUpon>AddPageTypeMetaDataFieldWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\DeletePageTypeMetaDataFieldWorkflow.layout\">\r\n      <DependentUpon>DeletePageTypeMetaDataFieldWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\DeletePageTypeWorkflow.layout\">\r\n      <DependentUpon>DeletePageTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeDefaultPageContentWorkflow.layout\">\r\n      <DependentUpon>EditPageTypeDefaultPageContentWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeMetaDataFieldWorkflow.layout\">\r\n      <DependentUpon>EditPageTypeMetaDataFieldWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTypeElementProvider\\EditPageTypeWorkflow.layout\">\r\n      <DependentUpon>EditPageTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionProviderElementProvider\\AddNewRazorFunctionWorkflow.layout\">\r\n      <DependentUpon>AddNewRazorFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\RazorFunctionProviderElementProvider\\DeleteRazorFunctionWorkflow.layout\">\r\n      <DependentUpon>DeleteRazorFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\AddNewSqlConnectionWorkflow.layout\">\r\n      <DependentUpon>AddNewSqlConnectionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\AddNewSqlFunctionProviderWorkflow.layout\">\r\n      <DependentUpon>AddNewSqlFunctionProviderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\DeleteSqlConnectionWorkflow.layout\">\r\n      <DependentUpon>DeleteSqlConnectionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\DeleteSqlFunctionProviderWorkflow.layout\">\r\n      <DependentUpon>DeleteSqlFunctionProviderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\EditSqlConnectionWorkflow.layout\">\r\n      <DependentUpon>EditSqlConnectionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\SqlFunctionElementProvider\\EditSqlFunctionProviderWorkflow.layout\">\r\n      <DependentUpon>EditSqlFunctionProviderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionProviderElementProvider\\AddNewUserControlFunctionWorkflow.layout\">\r\n      <DependentUpon>AddNewUserControlFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\UserControlFunctionProviderElementProvider\\DeleteUserControlFunctionWorkflow.layout\">\r\n      <DependentUpon>DeleteUserControlFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\AddNewUserWorkflow.layout\">\r\n      <DependentUpon>AddNewUserWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\DeleteUserWorkflow.layout\">\r\n      <DependentUpon>DeleteUserWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\UserElementProvider\\EditUserWorkflow.layout\">\r\n      <DependentUpon>EditUserWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\AddNewUserGroupWorkflow.layout\">\r\n      <DependentUpon>AddNewUserGroupWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\DeleteUserGroupWorkflow.layout\">\r\n      <DependentUpon>DeleteUserGroupWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\UserGroupElementProvider\\EditUserGroupWorkflow.layout\">\r\n      <DependentUpon>EditUserGroupWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\AddNewVisualFunctionWorkflow.layout\">\r\n      <DependentUpon>AddNewVisualFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\VisualFunctionProviderElementProvider\\EditVisualFunctionWorkflow.layout\">\r\n      <DependentUpon>EditVisualFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\UploadAndExtractZipFileWorkflow.layout\">\r\n      <DependentUpon>UploadAndExtractZipFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\AddNewWebsiteFileWorkflow.layout\">\r\n      <DependentUpon>AddNewWebsiteFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\AddNewWebsiteFolderWorkflow.layout\">\r\n      <DependentUpon>AddNewWebsiteFolderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\DeleteWebsiteFileWorkflow.layout\">\r\n      <DependentUpon>DeleteWebsiteFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\DeleteWebsiteFolderWorkflow.layout\">\r\n      <DependentUpon>DeleteWebsiteFolderWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\EditWebsiteFileTextContentWorkflow.layout\">\r\n      <DependentUpon>EditWebsiteFileTextContentWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\WebsiteFileElementProvider\\UploadWebsiteFileWorkflow.layout\">\r\n      <DependentUpon>UploadWebsiteFileWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewCompositionTypeWorkflow.layout\">\r\n      <DependentUpon>AddNewCompositionTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewDataWorkflow.layout\">\r\n      <DependentUpon>AddNewDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\AddNewInterfaceTypeWorkflow.layout\">\r\n      <DependentUpon>AddNewInterfaceTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteAggregationTypeWorkflow.layout\">\r\n      <DependentUpon>DeleteAggregationTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteCompositionTypeWorkflow.layout\">\r\n      <DependentUpon>DeleteCompositionTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DeleteInterfaceTypeWorkflow.layout\">\r\n      <DependentUpon>DeleteInterfaceTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\DisableTypeLocalizationWorkflow.layout\">\r\n      <DependentUpon>DisableTypeLocalizationWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditCompositionTypeWorkflow.layout\">\r\n      <DependentUpon>EditCompositionTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditDataWorkflow.layout\">\r\n      <DependentUpon>EditDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EditInterfaceTypeWorkflow.layout\">\r\n      <DependentUpon>EditInterfaceTypeWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\EnableTypeLocalizationWorkflow.layout\">\r\n      <DependentUpon>EnableTypeLocalizationWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\GeneratedDataTypesElementProvider\\LocalizeDataWorkflow.layout\">\r\n      <DependentUpon>LocalizeDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\PageTemplateFeatureElementProvider\\EditTreeDefinitionWorkflow.layout\">\r\n      <DependentUpon>EditPageTemplateFeatureWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\AddNewXsltFunctionWorkflow.layout\">\r\n      <DependentUpon>AddNewXsltFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Plugins\\Elements\\ElementProviders\\XsltBasedFunctionProviderElementProvider\\EditXsltFunctionWorkflow.layout\">\r\n      <DependentUpon>EditXsltFunctionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Tools\\SendMessageToConsolesWorkflow.layout\">\r\n      <DependentUpon>SendMessageToConsolesWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\AddApplicationWorkflow.layout\">\r\n      <DependentUpon>AddApplicationWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\AddTreeDefinitionWorkflow.layout\">\r\n      <DependentUpon>AddTreeDefinitionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\ConfirmActionWorkflow.layout\">\r\n      <DependentUpon>ConfirmActionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\DeleteTreeDefinitionWorkflow.layout\">\r\n      <DependentUpon>DeleteTreeDefinitionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\EditTreeDefinitionWorkflow.layout\">\r\n      <DependentUpon>EditTreeDefinitionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\GenericAddDataWorkflow.layout\">\r\n      <DependentUpon>GenericAddDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\GenericDeleteDataWorkflow.layout\">\r\n      <DependentUpon>GenericDeleteDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\GenericEditDataWorkflow.layout\">\r\n      <DependentUpon>GenericEditDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\LocalizeDataWorkflow.layout\">\r\n      <DependentUpon>LocalizeDataWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\RemoveApplicationWorkflow.layout\">\r\n      <DependentUpon>RemoveApplicationWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Trees\\Workflows\\ReportFunctionActionWorkflow.layout\">\r\n      <DependentUpon>ReportFunctionActionWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Users\\Workflows\\ChangeOwnActiveLocaleWorkflow.layout\">\r\n      <DependentUpon>ChangeOwnActiveLocaleWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"C1Console\\Users\\Workflows\\ChangeOwnForeignLocaleWorkflow.layout\">\r\n      <DependentUpon>ChangeOwnForeignLocaleWorkflow.cs</DependentUpon>\r\n    </EmbeddedResource>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Client.3.5\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5.SP1\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5 SP1</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.VisualBasic.PowerPacks.10.0\">\r\n      <Visible>False</Visible>\r\n      <ProductName>Microsoft Visual Basic PowerPacks 10.0</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Windows.Installer.3.1\">\r\n      <Visible>False</Visible>\r\n      <ProductName>Windows Installer 3.1</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ProjectReference Include=\"..\\Composite\\Composite.csproj\">\r\n      <Project>{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}</Project>\r\n      <Name>Composite</Name>\r\n    </ProjectReference>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"packages.config\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\r\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r\n       Other similar extension points exist, see Microsoft.Common.targets.\r\n  <Target Name=\"AfterBuild\">\r\n  </Target>\r\n  -->\r\n  <Target Name=\"BeforeBuild\">\r\n    <PropertyGroup>\r\n      <GitBranchFile>$(ProjectDir)git_branch.txt</GitBranchFile>\r\n      <GitCommitHashFile>$(ProjectDir)git_commithash.txt</GitCommitHashFile>\r\n    </PropertyGroup>\r\n    <Exec Condition=\"Exists('$(SolutionDir)\\.git')\" Command=\"git -C $(ProjectDir) rev-parse --abbrev-ref HEAD&gt; &quot;$(GitBranchFile)&quot;\" />\r\n    <Exec Condition=\"Exists('$(SolutionDir)\\.git')\" Command=\"git -C $(ProjectDir) rev-parse HEAD&gt; &quot;$(GitCommitHashFile)&quot;\" />\r\n    <Exec Condition=\"!Exists('$(SolutionDir)\\.git')\" Command=\"@echo unknown branch &gt; &quot;$(GitBranchFile)&quot;\" />\r\n    <Exec Condition=\"!Exists('$(SolutionDir)\\.git')\" Command=\"@echo unknown commit &gt; &quot;$(GitCommitHashFile)&quot;\" />\r\n    <PropertyGroup>\r\n      <GitBranch>$([System.IO.File]::ReadAllText(\"$(GitBranchFile)\").Trim())</GitBranch>\r\n      <GitCommitHash>$([System.IO.File]::ReadAllText(\"$(GitCommitHashFile)\").Trim())</GitCommitHash>\r\n      <AssemblyInformationalVersionAttribute>[assembly: System.Reflection.AssemblyInformationalVersion(\"$(GitBranch). Commit Hash: $(GitCommitHash)\")]</AssemblyInformationalVersionAttribute>\r\n    </PropertyGroup>\r\n    <WriteLinesToFile File=\"Properties\\GitCommitInfo.cs\" Lines=\"$(AssemblyInformationalVersionAttribute)\" Overwrite=\"true\">\r\n    </WriteLinesToFile>\r\n    <Exec Command=\"del &quot;$(GitBranchFile)&quot;\" />\r\n    <Exec Command=\"del &quot;$(GitCommitHashFile)&quot;\" />\r\n  </Target>\r\n  <PropertyGroup>\r\n    <PostBuildEvent>copy \"$(TargetPath)\" \"$(ProjectDir)..\\bin\\\"\r\ncopy \"$(TargetPath)\" \"$(ProjectDir)..\\Website\\bin\\\"</PostBuildEvent>\r\n  </PropertyGroup>\r\n</Project>"
  },
  {
    "path": "Composite.Workflows/Composite.Workflows.csproj.vspscc",
    "content": "﻿\"\"\r\n{\r\n\"FILE_VERSION\" = \"9237\"\r\n\"ENLISTMENT_CHOICE\" = \"NEVER\"\r\n\"PROJECT_FILE_RELATIVE_PATH\" = \"\"\r\n\"NUMBER_OF_EXCLUDED_FILES\" = \"0\"\r\n\"ORIGINAL_PROJECT_FILE_PATH\" = \"\"\r\n\"NUMBER_OF_NESTED_PROJECTS\" = \"0\"\r\n\"SOURCE_CONTROL_SETTINGS_PROVIDER\" = \"PROVIDER\"\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/FunctionTesterWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Serialization;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Foundation;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.Core.WebClient.FunctionCallEditor;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.Functions;\r\nusing Composite.Functions.ManagedParameters;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Data;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Globalization;\r\nusing System.Threading;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Workflows.Plugins.Elements.ElementProviders.AllFunctionsElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class FunctionTesterWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public FunctionTesterWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initalizeStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<NamedFunctionCall> namedFunctionCalls = new List<NamedFunctionCall>();\r\n\r\n            if (Payload != \"\")\r\n            {\r\n                IFunction function = FunctionFacade.GetFunction(Payload);\r\n\r\n                BaseRuntimeTreeNode baseRuntimeTreeNode = FunctionFacade.BuildTree(function, new Dictionary<string, object>());\r\n\r\n                NamedFunctionCall namedFunctionCall = new NamedFunctionCall(\"\", (BaseFunctionRuntimeTreeNode)baseRuntimeTreeNode);\r\n\r\n                namedFunctionCalls.Add(namedFunctionCall);\r\n\r\n                string layoutLabel = string.Format(StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"FunctionTesterWorkflow.Layout.Label\"), function.Name);\r\n                this.Bindings.Add(\"LayoutLabel\", layoutLabel);\r\n            }\r\n\r\n            this.Bindings.Add(\"FunctionCalls\", namedFunctionCalls);\r\n            this.Bindings.Add(\"Parameters\", new List<ManagedParameterDefinition>());\r\n            this.Bindings.Add(\"PageId\", PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault());\r\n\r\n            if (UserSettings.ActiveLocaleCultureInfo != null)\r\n            {\r\n                List<KeyValuePair<string, string>> activeCulturesDictionary = UserSettings.ActiveLocaleCultureInfos.Select(f => new KeyValuePair<string, string>(f.Name, DataLocalizationFacade.GetCultureTitle(f))).ToList();\r\n                this.Bindings.Add(\"ActiveCultureName\", UserSettings.ActiveLocaleCultureInfo.Name);\r\n                this.Bindings.Add(\"ActiveCulturesList\", activeCulturesDictionary);\r\n            }\r\n\r\n            this.Bindings.Add(\"PageDataScopeName\", DataScopeIdentifier.AdministratedName);\r\n            this.Bindings.Add(\"PageDataScopeList\", new Dictionary<string, string> \r\n            { \r\n                { DataScopeIdentifier.AdministratedName, StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"FunctionTesterWorkflow.AdminitrativeScope.Label\") }, \r\n                { DataScopeIdentifier.PublicName, StringResourceSystemFacade.GetString(\"Composite.Plugins.AllFunctionsElementProvider\", \"FunctionTesterWorkflow.PublicScope.Label\") } \r\n            });\r\n\r\n\r\n            Guid stateId = Guid.NewGuid();\r\n            var state = new FunctionCallDesignerState { WorkflowId = WorkflowInstanceId, ConsoleIdInternal = GetCurrentConsoleId() };\r\n            SessionStateManager.DefaultProvider.AddState<IFunctionCallEditorState>(stateId, state, DateTime.Now.AddDays(7.0));\r\n\r\n            this.Bindings.Add(\"SessionStateProvider\", SessionStateManager.DefaultProviderName);\r\n            this.Bindings.Add(\"SessionStateId\", stateId);\r\n        }\r\n\r\n\r\n\r\n        private void editCodeActivity_Preview_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Guid pageId;\r\n            if (this.GetBinding<object>(\"PageId\") == null) pageId = Guid.Empty;\r\n            else pageId = this.GetBinding<Guid>(\"PageId\");\r\n\r\n            string dataScopeName = this.GetBinding<string>(\"PageDataScopeName\");\r\n            string cultureName = this.GetBinding<string>(\"ActiveCultureName\");            \r\n            \r\n\r\n            // Setting debug page\r\n            IPage oldPage = PageRenderer.CurrentPage;            \r\n            IPage page = DataFacade.GetData<IPage>(f => f.Id == pageId).FirstOrDefault();\r\n            if (page != null) PageRenderer.CurrentPage = page;\r\n\r\n\r\n            // Setting debug culture\r\n            CultureInfo oldCurrentCulture = Thread.CurrentThread.CurrentCulture;\r\n            CultureInfo oldCurrentUICulture = Thread.CurrentThread.CurrentUICulture;\r\n            CultureInfo cultureInfo = null;\r\n            if (cultureName != null) cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);\r\n            if (cultureInfo != null)\r\n            {\r\n                Thread.CurrentThread.CurrentCulture = cultureInfo;\r\n                Thread.CurrentThread.CurrentUICulture = cultureInfo;\r\n            }\r\n\r\n            List<NamedFunctionCall> namedFunctionCalls = GetBinding<List<NamedFunctionCall>>(\"FunctionCalls\");\r\n\r\n            StringBuilder output = new StringBuilder();\r\n            foreach (NamedFunctionCall namedFunctionCall in namedFunctionCalls)\r\n            {\r\n                output.AppendLine(namedFunctionCall.FunctionCall.GetCompositeName() + \" result:\");\r\n\r\n                object functionResult;\r\n                try\r\n                {\r\n                    // Setting debug data scope\r\n                    using (new DataScope(DataScopeIdentifier.Deserialize(dataScopeName), cultureInfo))\r\n                    {\r\n                        functionResult = namedFunctionCall.FunctionCall.GetValue();\r\n                    }\r\n                }\r\n                catch(Exception ex)\r\n                {\r\n                    StringBuilder sb = new StringBuilder();\r\n                    while (ex != null)\r\n                    {\r\n                        sb.AppendLine(ex.ToString());\r\n                        ex = ex.InnerException;\r\n                    }\r\n\r\n                    functionResult = sb.ToString();\r\n                }\r\n               \r\n                \r\n                output.AppendLine(PrettyPrinter.Print(functionResult));\r\n\r\n                output.AppendLine();\r\n            }\r\n\r\n            // Restore culture\r\n            Thread.CurrentThread.CurrentCulture = oldCurrentCulture;\r\n            Thread.CurrentThread.CurrentUICulture = oldCurrentUICulture;            \r\n\r\n            // Page should not be restored\r\n\r\n            FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            IFormFlowWebRenderingService formFlowWebRenderingService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n\r\n            Control outputControl = new LiteralControl(\"<pre>\" + HttpUtility.HtmlEncode(output) + \"</pre>\");\r\n            formFlowWebRenderingService.SetNewPageOutput(outputControl);\r\n        }\r\n\r\n\r\n\r\n        [Serializable]\r\n        public sealed class FunctionCallDesignerState : IFunctionCallEditorState\r\n        {\r\n            public Guid WorkflowId { get; set; }\r\n            public string ConsoleIdInternal { get; set; }\r\n\r\n            private FormData GetFormData()\r\n            {\r\n                return WorkflowFacade.GetFormData(WorkflowId);\r\n            }\r\n\r\n            #region IFunctionCallEditorState Members\r\n\r\n            [XmlIgnore]\r\n            public List<NamedFunctionCall> FunctionCalls\r\n            {\r\n                get { return GetFormData().Bindings[\"FunctionCalls\"] as List<NamedFunctionCall>; }\r\n                set { GetFormData().Bindings[\"FunctionCalls\"] = value; }\r\n            }\r\n\r\n            [XmlIgnore]\r\n            public List<ManagedParameterDefinition> Parameters\r\n            {\r\n                get { return GetFormData().Bindings[\"Parameters\"] as List<ManagedParameterDefinition>; }\r\n                set { GetFormData().Bindings[\"Parameters\"] = value; }\r\n            }\r\n\r\n            [XmlIgnore]\r\n            public List<Type> ParameterTypeOptions\r\n            {\r\n                get { return (GetFormData().Bindings[\"ParameterTypeOptions\"] as IEnumerable<Type>).ToList(); }\r\n                set { GetFormData().Bindings[\"ParameterTypeOptions\"] = value.ToList(); }\r\n            }\r\n\r\n\r\n            public string ConsoleId\r\n            {\r\n                get { return ConsoleIdInternal; }\r\n            }\r\n\r\n\r\n            public bool StartInSourceMode\r\n            {\r\n                get { return true; }\r\n            }\r\n\r\n            public bool ShowLocalFunctionNames { get { return false; } }\r\n            public bool AllowLocalFunctionNameEditing { get { return false; } }\r\n\r\n            public bool WidgetFunctionSelection { get { return false; } }\r\n\r\n            public bool AllowSelectingInputParameters { get { return true; } }\r\n\r\n            public Type[] AllowedResultTypes { get { return new[] { typeof(object) }; } }\r\n\r\n            public int MaxFunctionAllowed { get { return 1000; } }\r\n\r\n            #endregion\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/FunctionTesterWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Workflows.Plugins.Elements.ElementProviders.AllFunctionsElementProvider\r\n{\r\n    partial class FunctionTesterWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editCodeActivity_Preview = new System.Workflow.Activities.CodeActivity();\r\n            this.editPreviewHandleExternalEventActivity = new Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity();\r\n            this.editDocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initalizeStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.editEventDrivenActivity_Preview = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // editCodeActivity_Preview\r\n            // \r\n            this.editCodeActivity_Preview.Name = \"editCodeActivity_Preview\";\r\n            this.editCodeActivity_Preview.ExecuteCode += new System.EventHandler(this.editCodeActivity_Preview_ExecuteCode);\r\n            // \r\n            // editPreviewHandleExternalEventActivity\r\n            // \r\n            this.editPreviewHandleExternalEventActivity.EventName = \"Preview\";\r\n            this.editPreviewHandleExternalEventActivity.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.editPreviewHandleExternalEventActivity.Name = \"editPreviewHandleExternalEventActivity\";\r\n            // \r\n            // editDocumentFormActivity\r\n            // \r\n            this.editDocumentFormActivity.ContainerLabel = null;\r\n            this.editDocumentFormActivity.CustomToolbarDefinitionFileName = null;\r\n            this.editDocumentFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\FunctionTesterEditFunction.xml\";\r\n            this.editDocumentFormActivity.Name = \"editDocumentFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initalizeStateCodeActivity_Initialize\r\n            // \r\n            this.initalizeStateCodeActivity_Initialize.Name = \"initalizeStateCodeActivity_Initialize\";\r\n            this.initalizeStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initalizeStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // editEventDrivenActivity_Preview\r\n            // \r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.editPreviewHandleExternalEventActivity);\r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.editCodeActivity_Preview);\r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.setStateActivity3);\r\n            this.editEventDrivenActivity_Preview.Name = \"editEventDrivenActivity_Preview\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.editDocumentFormActivity);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initalizeStateCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Preview);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // FunctionTesterWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"FunctionTesterWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.DocumentFormActivity editDocumentFormActivity;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private CodeActivity initalizeStateCodeActivity_Initialize;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private CodeActivity editCodeActivity_Preview;\r\n\r\n        private C1Console.Workflow.Activities.PreviewHandleExternalEventActivity editPreviewHandleExternalEventActivity;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_Preview;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/AllFunctionsElementProvider/FunctionTesterWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1185; 932\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"FunctionTesterWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"227; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 209\" Location=\"98; 171\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initalizeStateCodeActivity_Initialize\" Size=\"130; 44\" Location=\"108; 236\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"108; 299\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"222; 84\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"291; 318\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 128\" Location=\"539; 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"editDocumentFormActivity\" Size=\"130; 44\" Location=\"549; 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Preview\" Size=\"150; 272\" Location=\"547; 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"editPreviewHandleExternalEventActivity\" Size=\"130; 44\" Location=\"557; 219\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"editCodeActivity_Preview\" Size=\"130; 44\" Location=\"557; 282\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"557; 345\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"FunctionTesterWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"FunctionTesterWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"313\" Y=\"182\" />\r\n\t\t\t\t<ns0:Point X=\"402\" Y=\"182\" />\r\n\t\t\t\t<ns0:Point X=\"402\" Y=\"318\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Preview\" SourceConnectionIndex=\"1\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"749\" Y=\"178\" />\r\n\t\t\t\t<ns0:Point X=\"762\" Y=\"178\" />\r\n\t\t\t\t<ns0:Point X=\"762\" Y=\"100\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"100\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"108\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/Common/BaseFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements.Foundation.PluginFacades;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Foundation.PluginFacades;\r\nusing Composite.Functions.Plugins.FunctionProvider;\r\nusing Composite.Functions.Plugins.FunctionProvider.Runtime;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\nusing BaseFunctionElementProvider = Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider.BaseFunctionProviderElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.Common\r\n{\r\n    /// <summary>    \r\n    /// </summary>\r\n    /// <exclude />\r\n    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] \r\n    public class BaseFunctionWorkflow : FormsWorkflow\r\n    {\r\n        /// <summary>\r\n        /// Refreshed function tree for the currently used function provider element provider.\r\n        /// </summary>\r\n        public void RefreshFunctionTree()\r\n        {\r\n            WorkflowActionToken actionToken = (WorkflowActionToken)this.ActionToken;\r\n\r\n            var entityToken = new BaseFunctionFolderElementEntityToken(actionToken.Payload, string.Empty);\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(entityToken);\r\n        }\r\n\r\n        public T GetFunctionProvider<T>() where T: class, IFunctionProvider\r\n        {\r\n            var functionFolderEntityToken = (this.EntityToken as BaseFunctionFolderElementEntityToken);\r\n            if (functionFolderEntityToken != null)\r\n            {\r\n                var elementProvider = ElementProviderPluginFacade.GetElementProvider(functionFolderEntityToken.ElementProviderName) as BaseFunctionElementProvider;\r\n                if (elementProvider != null)\r\n                {\r\n                    var provider = FunctionProviderPluginFacade.GetFunctionProvider(elementProvider.FunctionProviderName);\r\n\r\n                    if (provider is T)\r\n                    {\r\n                        return provider as T;\r\n                    }\r\n                }\r\n            }\r\n\r\n            var functionProviderSettings = ConfigurationServices.ConfigurationSource.GetSection(FunctionProviderSettings.SectionName) \r\n                                           as FunctionProviderSettings;\r\n\r\n            var providerNames = functionProviderSettings.FunctionProviderPlugins.Select(plugin => plugin.Name);\r\n\r\n            foreach (string providerName in providerNames)\r\n            {\r\n                var provider = FunctionProviderPluginFacade.GetFunctionProvider(providerName);\r\n                if (provider is T)\r\n                {\r\n                    return provider as T;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Failed to get instance of \" + typeof(T).Name);\r\n        }\r\n\r\n        internal void GetProviderAndFunction<FunctionType>(\r\n            FileBasedFunctionEntityToken entityToken,\r\n            out FileBasedFunctionProvider<FunctionType> provider,\r\n            out FileBasedFunction<FunctionType> function) where FunctionType : FileBasedFunction<FunctionType>\r\n        {\r\n            string functionProviderName = entityToken.FunctionProviderName;\r\n\r\n            provider = (FileBasedFunctionProvider<FunctionType>)FunctionProviderPluginFacade.GetFunctionProvider(functionProviderName);\r\n            IFunction func = FunctionFacade.GetFunction(entityToken.FunctionName);\r\n\r\n            Verify.IsNotNull(func, \"Failed to get function '{0}'\", entityToken.FunctionName);\r\n\r\n            if (func is FunctionWrapper)\r\n            {\r\n                func = (func as FunctionWrapper).InnerFunction;\r\n            }\r\n\r\n            function = (FileBasedFunction<FunctionType>) func;\r\n        }\r\n\r\n        internal static void DeleteEmptyAncestorFolders(string filePath)\r\n        {\r\n            string folder = Path.GetDirectoryName(filePath);\r\n\r\n            while (!C1Directory.GetFiles(folder).Any() && !C1Directory.GetDirectories(folder).Any())\r\n            {\r\n                C1Directory.Delete(folder);\r\n\r\n                folder = folder.Substring(0, folder.LastIndexOf('\\\\'));\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/Common/KeyFieldHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_GeneratedDataTypesElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.Common\r\n{\r\n    public static class KeyFieldHelper\r\n    {\r\n        public static Dictionary<string, string> GetKeyFieldOptions()\r\n        {\r\n            return new Dictionary<string, string>\r\n            {\r\n                {GeneratedTypesHelper.KeyFieldType.Guid.ToString(), Texts.EditorCommon_KeyFieldType_Guid},\r\n                {GeneratedTypesHelper.KeyFieldType.RandomString4.ToString(), Texts.EditorCommon_KeyFieldType_RandomString4},\r\n                {GeneratedTypesHelper.KeyFieldType.RandomString8.ToString(), Texts.EditorCommon_KeyFieldType_RandomString8}\r\n            };\r\n        }\r\n\r\n        //public static GeneratedTypesHelper.KeyFieldType ParseKeyFieldType(string keyFieldTypeStr)\r\n        //{\r\n        //    return (GeneratedTypesHelper.KeyFieldType) Enum.Parse(typeof (GeneratedTypesHelper.KeyFieldType), keyFieldTypeStr);\r\n        //}\r\n\r\n        public static GeneratedTypesHelper.KeyFieldType GetKeyFieldType(DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            var idField = dataTypeDescriptor.Fields.Single(f => f.Name == \"Id\");\r\n            if (idField != null)\r\n            {\r\n                return GetKeyFieldType(idField);\r\n            }\r\n\r\n            return GeneratedTypesHelper.KeyFieldType.Undefined;\r\n        }\r\n\r\n        public static GeneratedTypesHelper.KeyFieldType GetKeyFieldType(DataFieldDescriptor field)\r\n        {\r\n            if (field.InstanceType == typeof(Guid))\r\n            {\r\n                return GeneratedTypesHelper.KeyFieldType.Guid;\r\n            }\r\n\r\n            if (field.InstanceType == typeof(string) && field.DefaultValue != null)\r\n            {\r\n                if (field.DefaultValue.Equals(DefaultValue.RandomString(4, true)))\r\n                {\r\n                    return GeneratedTypesHelper.KeyFieldType.RandomString4;\r\n                }\r\n\r\n                if (field.DefaultValue.Equals(DefaultValue.RandomString(8, false)))\r\n                {\r\n                    return GeneratedTypesHelper.KeyFieldType.RandomString8;\r\n                }\r\n            }\r\n            \r\n            return GeneratedTypesHelper.KeyFieldType.Undefined;\r\n        }\r\n\r\n        public static void UpdateKeyType(DataFieldDescriptor idField, GeneratedTypesHelper.KeyFieldType selectedFieldType)\r\n        {\r\n            switch (selectedFieldType)\r\n            {\r\n                case GeneratedTypesHelper.KeyFieldType.Guid:\r\n                    idField.StoreType = StoreFieldType.Guid;\r\n                    idField.InstanceType = typeof(Guid);\r\n                    idField.DefaultValue = null;\r\n                    break;\r\n                case GeneratedTypesHelper.KeyFieldType.RandomString4:\r\n                    idField.StoreType = StoreFieldType.String(22);\r\n                    idField.InstanceType = typeof(string);\r\n                    idField.DefaultValue = DefaultValue.RandomString(4, true);\r\n                    break;\r\n                case GeneratedTypesHelper.KeyFieldType.RandomString8:\r\n                    idField.StoreType = StoreFieldType.String(22);\r\n                    idField.InstanceType = typeof(string);\r\n                    idField.DefaultValue = DefaultValue.RandomString(8, false);\r\n                    break;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/Common/PageTemplateHelper.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.Common\r\n{\r\n    internal class PageTemplateHelper\r\n    {\r\n        public static string LoadDefaultTemplateFile(string fileName)\r\n        {\r\n            return C1File.ReadAllText(PathUtil.Resolve(\"~/Composite/templates/PageTemplates/\" + fileName))\r\n                  .Replace(\"    \", \"\\t\");\r\n        }\r\n\r\n        /// <summary>\r\n        /// Replaces html escape sequences with their XML alternative.\r\n        /// Fixes casing in DOCTYPE declaration\r\n        /// </summary>\r\n        public static string FixHtmlEscapeSequences(string xhtml)\r\n        {\r\n            return xhtml\r\n                .Replace(\"&nbsp;\", \"&#160;\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&ldquo;\", \"“\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&rdguo;\", \"”\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&lsquo;\", \"‘\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&rsquo;\", \"’\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&laquo;\", \"«\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&raquo;\", \"»\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&lsaquo;\", \"‹\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&rsaquo;\", \"›\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&bull;\", \"•\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&deg;\", \"°\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&hellip;\", \"…\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&trade;\", \"™\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&copy;\", \"©\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&reg;\", \"®\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&mdash;\", \"—\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&ndash;\", \"–\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&sup2;\", \"²\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&sup3;\", \"³\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&frac14;\", \"¼\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&frac12;\", \"½\", StringComparison.OrdinalIgnoreCase)\r\n                .Replace(\"&frac34;\", \"¾\", StringComparison.OrdinalIgnoreCase)\r\n\t\t\t\t.Replace(\"&times;\", \"×\", StringComparison.OrdinalIgnoreCase)\r\n\t\t\t\t.Replace(\"&larr;\", \"←\", StringComparison.OrdinalIgnoreCase)\r\n\t\t\t\t.Replace(\"&rarr;\", \"→\", StringComparison.OrdinalIgnoreCase)\r\n\t\t\t\t.Replace(\"&uarr;\", \"↑\", StringComparison.OrdinalIgnoreCase)\r\n\t\t\t\t.Replace(\"&darr;\", \"↓\", StringComparison.OrdinalIgnoreCase)\r\n\t\t\t    .Replace(\"&middot;\", \"·\", StringComparison.OrdinalIgnoreCase)\r\n\t\t\t\t.Replace(\"<!doctype\", \"<!DOCTYPE\", StringComparison.OrdinalIgnoreCase);\r\n        }\r\n\r\n        public static Guid GetTheMostUsedTemplate(IEnumerable<Guid> templateIds)\r\n        {\r\n            IDictionary<Guid, int> usageStats = TemplateUsageStatictic();\r\n            Guid mostUsed = Guid.Empty;\r\n            int usages = 0;\r\n\r\n            foreach (Guid templateId in templateIds)\r\n            {\r\n                if (usageStats.ContainsKey(templateId)\r\n                    && usages < usageStats[templateId])\r\n                {\r\n                    mostUsed = templateId;\r\n                    usages = usageStats[templateId];\r\n                }\r\n                else if(usages == 0 && mostUsed == Guid.Empty)\r\n                {\r\n                    mostUsed = templateId;\r\n                }\r\n            }\r\n\r\n            return mostUsed;\r\n        }\r\n\r\n        private static IDictionary<Guid, int> TemplateUsageStatictic()\r\n        {\r\n            var result = new Dictionary<Guid, int>();\r\n            foreach (IPage page in DataFacade.GetData<IPage>())\r\n            {\r\n                Guid templateId = page.TemplateId;\r\n\r\n                if (!result.ContainsKey(templateId))\r\n                {\r\n                    result.Add(templateId, 1);\r\n                }\r\n                else\r\n                {\r\n                    result[templateId] = result[templateId] + 1;\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewCompositionTypeWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Data.ExtendedDataType.Debug;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewCompositionTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private string NewTypeNameBindingName { get { return \"NewTypeName\"; } }\r\n        private string NewTypeNamespaceBindingName { get { return \"NewTypeNamespace\"; } }\r\n        private string NewTypeTitleBindingName { get { return \"NewTypeTitle\"; } }\r\n        private string DataFieldDescriptorsBindingName { get { return \"DataFieldDescriptors\"; } }\r\n        private string LabelFieldNameBindingName { get { return \"LabelFieldName\"; } }\r\n        private string HasCachingNameBindingName { get { return \"HasCaching\"; } }\r\n        private string HasPublishingBindingName { get { return \"HasPublishing\"; } }\r\n\r\n\r\n        public AddNewCompositionTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Type targetType = TypeManager.GetType(this.Payload);\r\n\r\n            this.Bindings.Add(this.NewTypeNameBindingName, \"\");\r\n            this.Bindings.Add(this.NewTypeNamespaceBindingName, UserSettings.LastSpecifiedNamespace);\r\n            this.Bindings.Add(this.NewTypeTitleBindingName, \"\");\r\n            this.Bindings.Add(this.DataFieldDescriptorsBindingName, new List<DataFieldDescriptor>());\r\n            this.Bindings.Add(this.LabelFieldNameBindingName, \"\");\r\n            this.Bindings.Add(this.HasCachingNameBindingName, false);\r\n\r\n            this.Bindings.Add(this.HasPublishingBindingName, typeof(IPublishControlled).IsAssignableFrom(targetType));\r\n\r\n            this.Bindings.Add(\"HasLocalization\", true);\r\n\r\n            this.BindingsValidationRules.Add(this.NewTypeNameBindingName, new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n            this.BindingsValidationRules.Add(this.NewTypeNamespaceBindingName, new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n            this.BindingsValidationRules.Add(this.NewTypeTitleBindingName, new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n\r\n            if ((RuntimeInformation.IsDebugBuild) && (DynamicTempTypeCreator.UseTempTypeCreator))\r\n            {\r\n                DynamicTempTypeCreator dynamicTempTypeCreator = new DynamicTempTypeCreator(\"PageMetaData\");\r\n\r\n                this.UpdateBinding(this.NewTypeNameBindingName, dynamicTempTypeCreator.TypeName);\r\n                this.UpdateBinding(this.NewTypeTitleBindingName, dynamicTempTypeCreator.TypeTitle);\r\n                this.UpdateBinding(this.DataFieldDescriptorsBindingName, dynamicTempTypeCreator.DataFieldDescriptors);\r\n                this.UpdateBinding(this.LabelFieldNameBindingName, dynamicTempTypeCreator.DataFieldDescriptors.First().Name);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void saveTypeCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                string typeName = this.GetBinding<string>(this.NewTypeNameBindingName);\r\n                string typeNamespace = this.GetBinding<string>(this.NewTypeNamespaceBindingName);\r\n                string typeTitle = this.GetBinding<string>(this.NewTypeTitleBindingName);\r\n                bool hasCaching = this.GetBinding<bool>(this.HasCachingNameBindingName);\r\n                bool hasPublishing = this.GetBinding<bool>(this.HasPublishingBindingName);\r\n                bool hasLocalization = this.GetBinding<bool>(\"HasLocalization\");\r\n                string labelFieldName = this.GetBinding<string>(this.LabelFieldNameBindingName);\r\n                var dataFieldDescriptors = this.GetBinding<List<DataFieldDescriptor>>(this.DataFieldDescriptorsBindingName);\r\n\r\n\r\n                GeneratedTypesHelper helper;\r\n\r\n                Type interfaceType = null;\r\n                if (this.BindingExist(\"InterfaceType\"))\r\n                {\r\n                    interfaceType = this.GetBinding<Type>(\"InterfaceType\");\r\n\r\n                    helper = new GeneratedTypesHelper(interfaceType);\r\n                }\r\n                else\r\n                {\r\n                    helper = new GeneratedTypesHelper();\r\n                }\r\n\r\n                string errorMessage;\r\n                if (!helper.ValidateNewTypeName(typeName, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeName\", errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeNamespace(typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeNamespace\", errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeFullName(typeName, typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeName\", errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewFieldDescriptors(dataFieldDescriptors, null, out errorMessage))\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            \"${Composite.Plugins.GeneratedDataTypesElementProvider, AddNewCompositionTypeWorkflow.ErrorTitle}\",\r\n                            errorMessage\r\n                        );\r\n                    return;\r\n                }\r\n\r\n                if (helper.IsEditProcessControlledAllowed)\r\n                {\r\n                    helper.SetPublishControlled(hasPublishing);\r\n                    helper.SetLocalizedControlled(hasLocalization);\r\n                }\r\n\r\n                helper.SetCacheable(hasCaching);\r\n                helper.SetNewTypeFullName(typeName, typeNamespace);\r\n                helper.SetNewTypeTitle(typeTitle);\r\n                helper.SetNewFieldDescriptors(dataFieldDescriptors, null, labelFieldName);\r\n\r\n                if (!this.BindingExist(\"InterfaceType\"))\r\n                {\r\n                    Type targetType = TypeManager.GetType(this.Payload);\r\n\r\n                    helper.SetForeignKeyReference(targetType, Composite.Data.DataAssociationType.Composition);\r\n                }\r\n\r\n                bool originalTypeDataExists = false;\r\n                if (interfaceType != null)\r\n                {\r\n                    originalTypeDataExists = DataFacade.HasDataInAnyScope(interfaceType);\r\n                }\r\n\r\n                if (helper.TryValidateUpdate(originalTypeDataExists, out errorMessage) == false)\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            \"${Composite.Plugins.GeneratedDataTypesElementProvider, AddNewCompositionTypeWorkflow.ErrorTitle}\",\r\n                            errorMessage\r\n                        );\r\n                    return;\r\n                }\r\n\r\n                helper.CreateType(originalTypeDataExists);\r\n\r\n                if (originalTypeDataExists)\r\n                {\r\n                    SetSaveStatus(true);\r\n                }\r\n                else\r\n                {\r\n                    string serializedTypeName = TypeManager.SerializeType(helper.InterfaceType);\r\n                    EntityToken entityToken = new GeneratedDataTypesElementProviderTypeEntityToken(\r\n                        serializedTypeName,\r\n                        this.EntityToken.Source,\r\n                        GeneratedDataTypesElementProviderRootEntityToken.PageMetaDataTypeFolderId);\r\n\r\n                    SetSaveStatus(true, entityToken);\r\n                }\r\n\r\n\r\n\r\n                this.UpdateBinding(\"InterfaceType\", helper.InterfaceType);\r\n\r\n                this.WorkflowResult = TypeManager.SerializeType(helper.InterfaceType);\r\n\r\n                UserSettings.LastSpecifiedNamespace = typeNamespace;\r\n\r\n                ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n                parentTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogCritical(\"AddNewCompositionTypeWorkflow\", ex);\r\n\r\n                this.ShowMessage(DialogType.Error, ex.Message, ex.Message);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewCompositionTypeWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class AddNewCompositionTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveTypeCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.editTypeDocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.saveTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editTypeEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveTypeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editTypeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editTypeStateActivity\";\r\n            // \r\n            // saveTypeCodeActivity_Save\r\n            // \r\n            this.saveTypeCodeActivity_Save.Name = \"saveTypeCodeActivity_Save\";\r\n            this.saveTypeCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saveTypeCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveTypeStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // editTypeDocumentFormActivity\r\n            // \r\n            this.editTypeDocumentFormActivity.ContainerLabel = null;\r\n            this.editTypeDocumentFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewCompositionTypeStep1.xml\";\r\n            this.editTypeDocumentFormActivity.Name = \"editTypeDocumentFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editTypeStateActivity\";\r\n            // \r\n            // initializeStateCodeActivity_Initialize\r\n            // \r\n            this.initializeStateCodeActivity_Initialize.Name = \"initializeStateCodeActivity_Initialize\";\r\n            this.initializeStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // saveTypeStateInitializationActivity\r\n            // \r\n            this.saveTypeStateInitializationActivity.Activities.Add(this.saveTypeCodeActivity_Save);\r\n            this.saveTypeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.saveTypeStateInitializationActivity.Name = \"saveTypeStateInitializationActivity\";\r\n            // \r\n            // editTypeEventDrivenActivity_Save\r\n            // \r\n            this.editTypeEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editTypeEventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.editTypeEventDrivenActivity_Save.Name = \"editTypeEventDrivenActivity_Save\";\r\n            // \r\n            // editTypeStateInitializationActivity\r\n            // \r\n            this.editTypeStateInitializationActivity.Activities.Add(this.editTypeDocumentFormActivity);\r\n            this.editTypeStateInitializationActivity.Name = \"editTypeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeStateCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveTypeStateActivity\r\n            // \r\n            this.saveTypeStateActivity.Activities.Add(this.saveTypeStateInitializationActivity);\r\n            this.saveTypeStateActivity.Name = \"saveTypeStateActivity\";\r\n            // \r\n            // editTypeStateActivity\r\n            // \r\n            this.editTypeStateActivity.Activities.Add(this.editTypeStateInitializationActivity);\r\n            this.editTypeStateActivity.Activities.Add(this.editTypeEventDrivenActivity_Save);\r\n            this.editTypeStateActivity.Name = \"editTypeStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddNewCompositionTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editTypeStateActivity);\r\n            this.Activities.Add(this.saveTypeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewCompositionTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity editTypeDocumentFormActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity editTypeStateInitializationActivity;\r\n        private StateActivity editTypeStateActivity;\r\n        private CodeActivity initializeStateCodeActivity_Initialize;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private EventDrivenActivity editTypeEventDrivenActivity_Save;\r\n        private CodeActivity saveTypeCodeActivity_Save;\r\n        private StateInitializationActivity saveTypeStateInitializationActivity;\r\n        private StateActivity saveTypeStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewCompositionTypeWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewCompositionTypeWorkflow\" Location=\"30; 30\" Size=\"1154; 974\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddNewCompositionTypeWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddNewCompositionTypeWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editTypeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editTypeStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"383\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"383\" Y=\"369\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveTypeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"editTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveTypeStateActivity\" SourceActivity=\"editTypeStateActivity\" EventHandlerName=\"editTypeEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"488\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"446\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editTypeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"saveTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editTypeStateActivity\" SourceActivity=\"saveTypeStateActivity\" EventHandlerName=\"saveTypeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"844\" Y=\"487\" />\r\n\t\t\t\t<ns0:Point X=\"855\" Y=\"487\" />\r\n\t\t\t\t<ns0:Point X=\"855\" Y=\"361\" />\r\n\t\t\t\t<ns0:Point X=\"383\" Y=\"361\" />\r\n\t\t\t\t<ns0:Point X=\"383\" Y=\"369\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeStateCodeActivity_Initialize\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"editTypeStateActivity\" Location=\"274; 369\" Size=\"218; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editTypeStateInitializationActivity\" Location=\"282; 400\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"editTypeDocumentFormActivity\" Location=\"292; 462\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"editTypeEventDrivenActivity_Save\" Location=\"282; 424\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"292; 486\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"292; 546\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveTypeStateActivity\" Location=\"630; 446\" Size=\"218; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveTypeStateInitializationActivity\" Location=\"638; 477\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveTypeCodeActivity_Save\" Location=\"648; 539\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"648; 599\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewDataWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class AddNewDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setEnablePublishCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.saveAndPublishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.step1CodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initialCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finializeDtateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.saveAndPublishEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.saveStep1EventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // setEnablePublishCodeActivity\r\n            // \r\n            this.setEnablePublishCodeActivity.Name = \"setEnablePublishCodeActivity\";\r\n            this.setEnablePublishCodeActivity.ExecuteCode += new System.EventHandler(this.setEnablePublishCodeActivity_ExecuteCode);\r\n            // \r\n            // saveAndPublishHandleExternalEventActivity1\r\n            // \r\n            this.saveAndPublishHandleExternalEventActivity1.EventName = \"SaveAndPublish\";\r\n            this.saveAndPublishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveAndPublishHandleExternalEventActivity1.Name = \"saveAndPublishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // step1CodeActivity\r\n            // \r\n            this.step1CodeActivity.Name = \"step1CodeActivity\";\r\n            this.step1CodeActivity.ExecuteCode += new System.EventHandler(this.step1CodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initialCodeActivity_Initialize\r\n            // \r\n            this.initialCodeActivity_Initialize.Name = \"initialCodeActivity_Initialize\";\r\n            this.initialCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initialCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finializeDtateInitializationActivity\r\n            // \r\n            this.finializeDtateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finializeDtateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finializeDtateInitializationActivity.Name = \"finializeDtateInitializationActivity\";\r\n            // \r\n            // saveAndPublishEventDrivenActivity\r\n            // \r\n            this.saveAndPublishEventDrivenActivity.Activities.Add(this.saveAndPublishHandleExternalEventActivity1);\r\n            this.saveAndPublishEventDrivenActivity.Activities.Add(this.setEnablePublishCodeActivity);\r\n            this.saveAndPublishEventDrivenActivity.Activities.Add(this.setStateActivity3);\r\n            this.saveAndPublishEventDrivenActivity.Name = \"saveAndPublishEventDrivenActivity\";\r\n            // \r\n            // saveStep1EventDrivenActivity\r\n            // \r\n            this.saveStep1EventDrivenActivity.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.saveStep1EventDrivenActivity.Activities.Add(this.setStateActivity6);\r\n            this.saveStep1EventDrivenActivity.Name = \"saveStep1EventDrivenActivity\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1CodeActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initialCodeActivity_Initialize);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finializeDtateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.saveStep1EventDrivenActivity);\r\n            this.step1StateActivity.Activities.Add(this.saveAndPublishEventDrivenActivity);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // AddNewDataWorkflow\r\n            // \r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"AddNewDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private CodeActivity setEnablePublishCodeActivity;\r\n\r\n        private C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity saveAndPublishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity saveAndPublishEventDrivenActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateInitializationActivity finializeDtateInitializationActivity;\r\n\r\n        private EventDrivenActivity saveStep1EventDrivenActivity;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private CodeActivity step1CodeActivity;\r\n\r\n        private CodeActivity finalizeCodeActivity;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private CodeActivity initialCodeActivity_Initialize;\r\n\r\n        private StateActivity initialStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewDataWorkflow.cs",
    "content": "﻿\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.DataGroupingProviderHelper;\r\nusing Composite.C1Console.Scheduling;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Core.Serialization;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewDataWorkflow : FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        private bool _doPublish;\r\n\r\n        [NonSerialized]\r\n        private DataTypeDescriptorFormsHelper _helper;\r\n\r\n        [NonSerialized]\r\n        private string _typeName;\r\n\r\n        public AddNewDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private Type GetInterfaceType()\r\n        {\r\n            Type type;\r\n            if (EntityToken is GeneratedDataTypesElementProviderTypeEntityToken)\r\n            {\r\n                var entityToken = EntityToken as GeneratedDataTypesElementProviderTypeEntityToken;\r\n\r\n                type = TypeManager.GetType(entityToken.SerializedTypeName);\r\n            }\r\n            else if (EntityToken is DataGroupingProviderHelperEntityToken)\r\n            {\r\n                var entityToken = EntityToken as DataGroupingProviderHelperEntityToken;\r\n\r\n                type = TypeManager.GetType(entityToken.Type);\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n\r\n            return type;\r\n        }\r\n\r\n        private DataTypeDescriptorFormsHelper GetDataTypeDescriptorFormsHelper()\r\n        {\r\n            if (_helper == null)\r\n            {\r\n                var type = GetInterfaceType();\r\n                var guid = type.GetImmutableTypeId();\r\n\r\n                var typeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n                if (typeDescriptor == null)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Can not find the type descriptor for the type '{0}'\", type));\r\n                }\r\n\r\n                var generatedTypesHelper = new GeneratedTypesHelper(typeDescriptor) { AllowForeignKeyEditing = true };\r\n\r\n                _helper = new DataTypeDescriptorFormsHelper(typeDescriptor, true, EntityToken)\r\n                {\r\n                    LayoutIconHandle = \"generated-type-data-add\"\r\n                };\r\n\r\n                _helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n                _typeName = typeDescriptor.Name;\r\n            }\r\n\r\n            return _helper;\r\n        }\r\n\r\n        private void initialCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var type = GetInterfaceType();\r\n\r\n            if (!PermissionsFacade.GetPermissionsForCurrentUser(EntityToken).Contains(PermissionType.Publish) || !typeof(IPublishControlled).IsAssignableFrom(type))\r\n            {\r\n                var formData = WorkflowFacade.GetFormData(InstanceId, true);\r\n\r\n                if (formData.ExcludedEvents == null)\r\n                {\r\n                    formData.ExcludedEvents = new List<string>();\r\n                }\r\n\r\n                formData.ExcludedEvents.Add(\"SaveAndPublish\");\r\n            }\r\n\r\n\r\n            var helper = GetDataTypeDescriptorFormsHelper();\r\n            helper.UpdateWithNewBindings(Bindings);\r\n\r\n            var newData = DataFacade.BuildNew(type);\r\n\r\n            var publishControlled = newData as IPublishControlled;\r\n            if (publishControlled != null)\r\n            {\r\n                publishControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(Payload))\r\n            {\r\n                var values = new Dictionary<string, string>();\r\n\r\n                var serializedValues = StringConversionServices.ParseKeyValueCollection(Payload);\r\n                foreach (var kvp in serializedValues)\r\n                {\r\n                    values.Add(kvp.Key, StringConversionServices.DeserializeValueString(kvp.Value));\r\n                }\r\n\r\n                newData.SetValues(values);\r\n            }\r\n\r\n            helper.ObjectToBindings(newData, Bindings);\r\n\r\n            GeneratedTypesHelper.SetNewIdFieldValue(newData);\r\n\r\n            Bindings.Add(\"NewData\", newData);\r\n        }\r\n\r\n        private void step1CodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var helper = GetDataTypeDescriptorFormsHelper();\r\n\r\n            if (!BindingExist(\"DataAdded\"))\r\n            {\r\n                helper.LayoutLabel = helper.DataTypeDescriptor.Name;\r\n            }\r\n\r\n            var newData = GetBinding<IData>(\"NewData\");\r\n\r\n            DeliverFormData(\r\n                    _typeName,\r\n                    StandardUiContainerTypes.Document,\r\n                    helper.GetForm(),\r\n                    Bindings,\r\n                    helper.GetBindingsValidationRules(newData)\r\n                );\r\n        }\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var justAdded = false;\r\n\r\n            var isValid = ValidateBindings();\r\n            var helper = GetDataTypeDescriptorFormsHelper();\r\n\r\n            var newData = GetBinding<IData>(\"NewData\");\r\n            if (!BindAndValidate(helper, newData))\r\n            {\r\n                isValid = false;\r\n            }\r\n\r\n            if (isValid)\r\n            {\r\n                if (!BindingExist(\"DataAdded\"))\r\n                {\r\n                    newData = DataFacade.AddNew(newData);\r\n                    justAdded = true;\r\n\r\n                    AcquireLock(newData.GetDataEntityToken());\r\n\r\n                    UpdateBinding(\"NewData\", newData);\r\n                    Bindings.Add(\"DataAdded\", true);\r\n\r\n                    PublishControlledHelper.PublishIfNeeded(newData, _doPublish, Bindings, ShowMessage);\r\n\r\n                    var specificTreeRefresher = CreateParentTreeRefresher();\r\n                    specificTreeRefresher.PostRefreshMesseges(EntityToken);\r\n                }\r\n                else\r\n                {\r\n                    var updateTreeRefresher = CreateUpdateTreeRefresher(EntityToken);\r\n\r\n                    DataFacade.Update(newData);\r\n                    EntityTokenCacheFacade.ClearCache(newData.GetDataEntityToken());\r\n\r\n                    var published = PublishControlledHelper.PublishIfNeeded(newData, _doPublish, Bindings, ShowMessage);\r\n                    if (!published)\r\n                    {\r\n                        updateTreeRefresher.PostRefreshMesseges(EntityToken);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (justAdded)\r\n            {\r\n                SetSaveStatus(true, newData);\r\n            }\r\n            else\r\n            {\r\n                SetSaveStatus(isValid);\r\n            }\r\n        }\r\n\r\n        private void setEnablePublishCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            _doPublish = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewDataWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1199; 932\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddNewDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"212; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"79; 119\" Name=\"initialStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150; 209\" Location=\"87; 152\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initialCodeActivity_Initialize\" Size=\"130; 44\" Location=\"97; 217\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"97; 280\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"239; 110\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"139; 318\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 128\" Location=\"546; 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step1CodeActivity\" Size=\"130; 44\" Location=\"556; 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"saveStep1EventDrivenActivity\" Size=\"150; 209\" Location=\"546; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"556; 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 62\" Location=\"556; 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"saveAndPublishEventDrivenActivity\" Size=\"150; 272\" Location=\"554; 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveAndPublishHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"564; 219\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"setEnablePublishCodeActivity\" Size=\"130; 44\" Location=\"564; 282\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"564; 345\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"225; 80\" AutoSizeMargin=\"16; 24\" Location=\"456; 436\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finializeDtateInitializationActivity\" Size=\"150; 209\" Location=\"464; 469\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity\" Size=\"130; 44\" Location=\"474; 534\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"474; 597\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"754; 652\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddNewDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"214\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"834\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"834\" Y=\"652\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"initialStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initialStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"287\" Y=\"163\" />\r\n\t\t\t\t<ns0:Point X=\"298\" Y=\"163\" />\r\n\t\t\t\t<ns0:Point X=\"298\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"258\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"258\" Y=\"318\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStep1EventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"568\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"568\" Y=\"436\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finializeDtateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"677\" Y=\"480\" />\r\n\t\t\t\t<ns0:Point X=\"690\" Y=\"480\" />\r\n\t\t\t\t<ns0:Point X=\"690\" Y=\"310\" />\r\n\t\t\t\t<ns0:Point X=\"258\" Y=\"310\" />\r\n\t\t\t\t<ns0:Point X=\"258\" Y=\"318\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveAndPublishEventDrivenActivity\" SourceConnectionIndex=\"2\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"374\" Y=\"414\" />\r\n\t\t\t\t<ns0:Point X=\"568\" Y=\"414\" />\r\n\t\t\t\t<ns0:Point X=\"568\" Y=\"436\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewInterfaceTypeWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ExtendedDataType.Debug;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_GeneratedDataTypesElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewInterfaceTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewInterfaceTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private static class BindingNames\r\n        {\r\n            public const string ViewLabel = \"ViewLabel\";\r\n            public const string InterfaceType = \"InterfaceType\";\r\n            public const string NewTypeName = \"NewTypeName\";\r\n            public const string NewTypeNamespace = \"NewTypeNamespace\";\r\n            public const string NewTypeTitle = \"NewTypeTitle\";\r\n            public const string DataFieldDescriptors = \"DataFieldDescriptors\";\r\n            public const string KeyFieldName = \"KeyFieldName\";\r\n            public const string LabelFieldName = \"LabelFieldName\";\r\n            public const string InternalUrlPrefix = \"InternalUrlPrefix\";\r\n            public const string HasCaching = \"HasCaching\";\r\n            public const string HasPublishing = \"HasPublishing\";\r\n            public const string HasLocalization = \"HasLocalization\";\r\n            public const string IsSearchable = nameof(IsSearchable);\r\n            public const string KeyFieldReadOnly = \"KeyFieldReadOnly\";\r\n        }\r\n\r\n        private bool IsPageDataFolder\r\n        {\r\n            get { return this.EntityToken.Id == GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId; }\r\n        }\r\n\r\n        private void initialStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var dataFieldDescriptors = new List<DataFieldDescriptor>\r\n            {\r\n                GeneratedTypesHelper.BuildIdField()\r\n            };\r\n\r\n            this.Bindings = new Dictionary<string, object>\r\n            {\r\n                {BindingNames.ViewLabel, IsPageDataFolder ? Texts.AddNewAggregationTypeWorkflow_DocumentTitle : Texts.AddNewInterfaceTypeStep1_DocumentTitle},\r\n                {BindingNames.NewTypeName, \"\"},\r\n                {BindingNames.NewTypeNamespace, UserSettings.LastSpecifiedNamespace},\r\n                {BindingNames.NewTypeTitle, \"\"},\r\n                {BindingNames.DataFieldDescriptors, dataFieldDescriptors},\r\n                {BindingNames.HasCaching, false},\r\n                {BindingNames.HasPublishing, false},\r\n                {BindingNames.HasLocalization, false},\r\n                {BindingNames.IsSearchable, true},\r\n                {BindingNames.KeyFieldName, dataFieldDescriptors.First().Name},\r\n                {BindingNames.LabelFieldName, \"\"},\r\n                {BindingNames.KeyFieldReadOnly, false}\r\n            };\r\n\r\n            this.BindingsValidationRules = new Dictionary<string, List<ClientValidationRule>>\r\n            {\r\n                {BindingNames.NewTypeName, new List<ClientValidationRule> {new NotNullClientValidationRule()}},\r\n                {BindingNames.NewTypeNamespace, new List<ClientValidationRule> {new NotNullClientValidationRule()}},\r\n                {BindingNames.NewTypeTitle, new List<ClientValidationRule> {new NotNullClientValidationRule()}}\r\n            };\r\n\r\n            if (RuntimeInformation.IsDebugBuild && DynamicTempTypeCreator.UseTempTypeCreator)\r\n            {\r\n                var dynamicTempTypeCreator = new DynamicTempTypeCreator(IsPageDataFolder ? \"PageFolder\" : \"GlobalTest\");\r\n\r\n                dataFieldDescriptors.AddRange(dynamicTempTypeCreator.DataFieldDescriptors);\r\n\r\n                this.UpdateBinding(BindingNames.NewTypeName, dynamicTempTypeCreator.TypeName);\r\n                this.UpdateBinding(BindingNames.NewTypeTitle, dynamicTempTypeCreator.TypeTitle);\r\n                this.UpdateBinding(BindingNames.LabelFieldName, dynamicTempTypeCreator.DataFieldDescriptors.First().Name);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                string typeName = this.GetBinding<string>(BindingNames.NewTypeName);\r\n                string typeNamespace = this.GetBinding<string>(BindingNames.NewTypeNamespace);\r\n                string typeTitle = this.GetBinding<string>(BindingNames.NewTypeTitle);\r\n                bool hasCaching = this.GetBinding<bool>(BindingNames.HasCaching);\r\n                bool hasPublishing = this.GetBinding<bool>(BindingNames.HasPublishing);\r\n                bool hasLocalization = this.GetBinding<bool>(BindingNames.HasLocalization);\r\n                bool isSearchable = this.GetBinding<bool>(BindingNames.IsSearchable);\r\n                string keyFieldName = this.GetBinding<string>(BindingNames.KeyFieldName);\r\n                string labelFieldName = this.GetBinding<string>(BindingNames.LabelFieldName);\r\n                string internalUrlPrefix = this.GetBinding<string>(BindingNames.InternalUrlPrefix);\r\n                var dataFieldDescriptors = this.GetBinding<List<DataFieldDescriptor>>(BindingNames.DataFieldDescriptors);\r\n\r\n                GeneratedTypesHelper helper;\r\n                Type interfaceType = null;\r\n                if (this.BindingExist(BindingNames.InterfaceType))\r\n                {\r\n                    interfaceType = this.GetBinding<Type>(BindingNames.InterfaceType);\r\n\r\n                    helper = new GeneratedTypesHelper(interfaceType);\r\n                }\r\n                else\r\n                {\r\n                    helper = new GeneratedTypesHelper();\r\n                }\r\n\r\n                string errorMessage;\r\n                if (!helper.ValidateNewTypeName(typeName, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(BindingNames.NewTypeName, errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeNamespace(typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(BindingNames.NewTypeNamespace, errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeFullName(typeName, typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(BindingNames.NewTypeName, errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewFieldDescriptors(dataFieldDescriptors, keyFieldName, out errorMessage))\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            Texts.AddNewInterfaceTypeStep1_ErrorTitle,\r\n                            errorMessage\r\n                        );\r\n                    return;\r\n                }\r\n\r\n                if (interfaceType != null)\r\n                {\r\n                    if (hasLocalization != DataLocalizationFacade.IsLocalized(interfaceType)\r\n                        && DataFacade.GetData(interfaceType).ToDataEnumerable().Any())\r\n                    {\r\n                        this.ShowMessage(\r\n                            DialogType.Error,\r\n                            Texts.AddNewInterfaceTypeStep1_ErrorTitle,\r\n                            \"It's not possible to change localization through the current tab\"\r\n                        );\r\n                        return;\r\n                    }\r\n                }\r\n\r\n\r\n                if (helper.IsEditProcessControlledAllowed)\r\n                {\r\n                    helper.SetCacheable(hasCaching);\r\n                    helper.SetPublishControlled(hasPublishing);\r\n                    helper.SetLocalizedControlled(hasLocalization);\r\n                    helper.SetSearchable(isSearchable);\r\n                }\r\n\r\n                helper.SetNewTypeFullName(typeName, typeNamespace);\r\n                helper.SetNewTypeTitle(typeTitle);\r\n                helper.SetNewInternalUrlPrefix(internalUrlPrefix);\r\n                helper.SetNewFieldDescriptors(dataFieldDescriptors, keyFieldName, labelFieldName);\r\n\r\n\r\n                if (IsPageDataFolder && !this.BindingExist(BindingNames.InterfaceType))\r\n                {\r\n                    Type targetType = TypeManager.GetType(this.Payload);\r\n\r\n                    helper.SetForeignKeyReference(targetType, Composite.Data.DataAssociationType.Aggregation);\r\n                }\r\n\r\n                bool originalTypeDataExists = false;\r\n                if (interfaceType != null)\r\n                {\r\n                    originalTypeDataExists = DataFacade.HasDataInAnyScope(interfaceType);\r\n                }\r\n\r\n                if (!helper.TryValidateUpdate(originalTypeDataExists, out errorMessage))\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            Texts.AddNewInterfaceTypeStep1_ErrorTitle,\r\n                            errorMessage\r\n                        );\r\n                    return;\r\n                }\r\n\r\n\r\n                helper.CreateType(originalTypeDataExists);\r\n\r\n                string serializedTypeName = TypeManager.SerializeType(helper.InterfaceType);\r\n\r\n                EntityToken entityToken = new GeneratedDataTypesElementProviderTypeEntityToken(\r\n                    serializedTypeName,\r\n                    this.EntityToken.Source,\r\n                    IsPageDataFolder ? GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId\r\n                                     : GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId\r\n                );\r\n\r\n                if (originalTypeDataExists)\r\n                {\r\n                    SetSaveStatus(true);\r\n                }\r\n                else\r\n                {\r\n                    SetSaveStatus(true, entityToken);\r\n                }\r\n\r\n\r\n                if (!this.BindingExist(BindingNames.InterfaceType))\r\n                {\r\n                    this.AcquireLock(entityToken);\r\n                }\r\n\r\n                this.UpdateBinding(BindingNames.InterfaceType, helper.InterfaceType);\r\n                this.UpdateBinding(BindingNames.KeyFieldReadOnly, true);\r\n\r\n                this.UpdateBinding(BindingNames.ViewLabel, typeTitle);\r\n                RerenderView();\r\n\r\n                //this.WorkflowResult = TypeManager.SerializeType(helper.InterfaceType);\r\n\r\n\r\n                UserSettings.LastSpecifiedNamespace = typeNamespace;\r\n\r\n                var parentTreeRefresher = this.CreateParentTreeRefresher();\r\n                parentTreeRefresher.PostRefreshMessages(entityToken);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(\"Add New Interface Failed\", ex);\r\n\r\n                this.ShowMessage(DialogType.Error, ex.Message, ex.Message);\r\n            }\r\n        }\r\n\r\n        private void codeActivity_RefreshViewHandler(object sender, EventArgs e)\r\n        {\r\n            RerenderView();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewInterfaceTypeWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class AddNewInterfaceTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity_RefreshView = new System.Workflow.Activities.CodeActivity();\r\n            this.customEvent01HandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initialStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editType_IsSearchableChanged = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.saveStep1EventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editTypePropertiesStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editTypePropertiesStateActivity\";\r\n            // \r\n            // finalizeStateCodeActivity\r\n            // \r\n            this.finalizeStateCodeActivity.Name = \"finalizeStateCodeActivity\";\r\n            this.finalizeStateCodeActivity.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"editTypePropertiesStateActivity\";\r\n            // \r\n            // codeActivity_RefreshView\r\n            // \r\n            this.codeActivity_RefreshView.Name = \"codeActivity_RefreshView\";\r\n            this.codeActivity_RefreshView.ExecuteCode += new System.EventHandler(this.codeActivity_RefreshViewHandler);\r\n            // \r\n            // customEvent01HandleExternalEventActivity1\r\n            // \r\n            this.customEvent01HandleExternalEventActivity1.EventName = \"CustomEvent01\";\r\n            this.customEvent01HandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.customEvent01HandleExternalEventActivity1.Name = \"customEvent01HandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/AddNewInterfaceTypeStep1.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editTypePropertiesStateActivity\";\r\n            // \r\n            // initialStateCodeActivity\r\n            // \r\n            this.initialStateCodeActivity.Name = \"initialStateCodeActivity\";\r\n            this.initialStateCodeActivity.ExecuteCode += new System.EventHandler(this.initialStateCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeStateCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // editType_IsSearchableChanged\r\n            // \r\n            this.editType_IsSearchableChanged.Activities.Add(this.customEvent01HandleExternalEventActivity1);\r\n            this.editType_IsSearchableChanged.Activities.Add(this.codeActivity_RefreshView);\r\n            this.editType_IsSearchableChanged.Activities.Add(this.setStateActivity1);\r\n            this.editType_IsSearchableChanged.Name = \"editType_IsSearchableChanged\";\r\n            // \r\n            // saveStep1EventDrivenActivity\r\n            // \r\n            this.saveStep1EventDrivenActivity.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.saveStep1EventDrivenActivity.Activities.Add(this.setStateActivity2);\r\n            this.saveStep1EventDrivenActivity.Name = \"saveStep1EventDrivenActivity\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initialStateCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity4);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // editTypePropertiesStateActivity\r\n            // \r\n            this.editTypePropertiesStateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.editTypePropertiesStateActivity.Activities.Add(this.saveStep1EventDrivenActivity);\r\n            this.editTypePropertiesStateActivity.Activities.Add(this.editType_IsSearchableChanged);\r\n            this.editTypePropertiesStateActivity.Name = \"editTypePropertiesStateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // AddNewInterfaceTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.editTypePropertiesStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"AddNewInterfaceTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity editTypePropertiesStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateActivity finalStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity initialStateCodeActivity;\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private EventDrivenActivity saveStep1EventDrivenActivity;\r\n        private CodeActivity finalizeStateCodeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private CodeActivity codeActivity_RefreshView;\r\n        private C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity customEvent01HandleExternalEventActivity1;\r\n        private EventDrivenActivity editType_IsSearchableChanged;\r\n        private StateActivity initialStateActivity;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddNewInterfaceTypeWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"898, 547\" AutoSizeMargin=\"16, 24\" Location=\"30, 30\" Name=\"AddNewInterfaceTypeWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"AddNewInterfaceTypeWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewInterfaceTypeWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"214\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"214\" Y=\"66\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"66\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"402\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"402\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"414\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editTypePropertiesStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"initialStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initialStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editTypePropertiesStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"172\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"172\" Y=\"202\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"editTypePropertiesStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editTypePropertiesStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStep1EventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"268\" Y=\"272\" />\r\n\t\t\t\t<ns0:Point X=\"472\" Y=\"272\" />\r\n\t\t\t\t<ns0:Point X=\"472\" Y=\"286\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editTypePropertiesStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editTypePropertiesStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"588\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"588\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"172\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"172\" Y=\"202\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editTypePropertiesStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"editTypePropertiesStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editTypePropertiesStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editType_IsSearchableChanged\" SourceConnectionIndex=\"2\" TargetStateName=\"editTypePropertiesStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"277\" Y=\"298\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"298\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"172\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"172\" Y=\"202\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"212, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 106\" Name=\"initialStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150, 209\" Location=\"71, 139\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initialStateCodeActivity\" Size=\"130, 44\" Location=\"81, 204\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 62\" Location=\"81, 267\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"218, 110\" AutoSizeMargin=\"16, 24\" Location=\"63, 202\" Name=\"editTypePropertiesStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150, 128\" Location=\"71, 235\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130, 44\" Location=\"81, 300\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"saveStep1EventDrivenActivity\" Size=\"150, 209\" Location=\"71, 261\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"81, 326\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 62\" Location=\"81, 389\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editType_IsSearchableChanged\" Size=\"150, 272\" Location=\"71, 287\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"customEvent01HandleExternalEventActivity1\" Size=\"130, 44\" Location=\"81, 352\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity_RefreshView\" Size=\"130, 44\" Location=\"81, 415\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 62\" Location=\"81, 478\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"220, 80\" AutoSizeMargin=\"16, 24\" Location=\"362, 286\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 209\" Location=\"370, 319\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeStateCodeActivity\" Size=\"130, 44\" Location=\"380, 384\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 62\" Location=\"380, 447\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 414\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150, 209\" Location=\"38, 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"48, 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 62\" Location=\"48, 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddTypeToWhiteListWorkflow.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    public sealed partial class AddTypeToWhiteListWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddTypeToWhiteListWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            GeneratedDataTypesElementProviderTypeEntityToken castedEntityToken = (GeneratedDataTypesElementProviderTypeEntityToken)this.EntityToken;\r\n\r\n            IGeneratedTypeWhiteList generatedTypeWhiteList = DataFacade.BuildNew<IGeneratedTypeWhiteList>();\r\n            generatedTypeWhiteList.TypeManagerTypeName = castedEntityToken.SerializedTypeName;\r\n            DataFacade.AddNew<IGeneratedTypeWhiteList>(generatedTypeWhiteList);\r\n\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(this.EntityToken, 3);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddTypeToWhiteListWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class AddTypeToWhiteListWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddTypeToWhiteListWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddTypeToWhiteListWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/AddTypeToWhiteListWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddTypeToWhiteListWorkflow\" Location=\"30; 30\" Size=\"1183; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddTypeToWhiteListWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddTypeToWhiteListWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"435\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"435\" Y=\"360\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"534\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"333; 360\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"546; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"556; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"556; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteAggregationTypeWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteAggregationTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteAggregationTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            Type type = TypeManager.GetType(this.Payload);\r\n\r\n            Guid guid = type.GetImmutableTypeId();\r\n\r\n            return DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n        }\r\n\r\n\r\n        private void DoesTypeExists(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = GetDataTypeDescriptor() != null;\r\n        }\r\n\r\n        private void TypeIsReferenced(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            var descriptor = GetDataTypeDescriptor();\r\n            Type interfaceType = descriptor.GetInterfaceType();\r\n\r\n            // NOTE: Type could reference to itself\r\n            e.Result = interfaceType.GetRefereeTypes().Where(type => type != interfaceType).Any();\r\n        }\r\n\r\n\r\n\r\n        private void IsUsedByPageType(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            bool isUsed = DataFacade.GetData<IPageTypeDataFolderTypeLink>().Where(f => f.DataTypeId == dataTypeDescriptor.DataTypeId).Any();\r\n\r\n            if (isUsed)\r\n            {\r\n                Type interfaceType = GetDataTypeDescriptor().GetInterfaceType();\r\n\r\n                this.ShowMessage(DialogType.Warning,\r\n                                 GetLocalizedText(\"DeleteAggregationTypeWorkflow.ErrorTitle\"),\r\n                                 GetLocalizedText(\"DeleteAggregationTypeWorkflow.IsUsedByPageType\").FormatWith(interfaceType.FullName));\r\n            }\r\n\r\n            e.Result = isUsed;\r\n        }\r\n\r\n\r\n\r\n        private void codeActivity_ShowTypeIsReferencedWarning(object sender, EventArgs e)\r\n        {\r\n            Type interfaceType = GetDataTypeDescriptor().GetInterfaceType();\r\n\r\n            this.ShowMessage(DialogType.Warning,\r\n                             GetLocalizedText(\"DeleteCompositionTypeWorkflow.ErrorTitle\"),\r\n                             GetLocalizedText(\"DeleteCompositionTypeWorkflow.TypeIsReferenced\").FormatWith(interfaceType.FullName));\r\n            return;\r\n        }\r\n\r\n        private static string GetLocalizedText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", key);\r\n        }\r\n\r\n        private void initializeStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            string interfaceName = StringExtensionMethods.CreateNamespace(dataTypeDescriptor.Namespace, dataTypeDescriptor.Name, '.');\r\n\r\n            interfaceName = string.Format(\"{0} {1}?\", StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"DeleteAggregationTypeWorkflow.Text\"), interfaceName);\r\n\r\n            this.Bindings.Add(\"InterfaceName\", interfaceName);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeStateCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            string errorMessage;\r\n            if (!GeneratedTypesFacade.CanDeleteType(dataTypeDescriptor, out errorMessage))\r\n            {\r\n                this.ShowMessage(DialogType.Warning,\r\n                                \"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteCompositionTypeWorkflow.ErrorTitle}\",\r\n                                errorMessage);\r\n                return;\r\n            }\r\n\r\n            GeneratedTypesFacade.DeleteType(dataTypeDescriptor);\r\n\r\n            GeneratedDataTypesElementProviderRootEntityToken entityToken = new GeneratedDataTypesElementProviderRootEntityToken(this.EntityToken.Source, GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId);\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(entityToken);\r\n        }\r\n\r\n        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteAggregationTypeWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class DeleteAggregationTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.caShowMessageBox = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.ifTypeIsReferenced = new System.Workflow.Activities.IfElseActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeStateCodeActivity_Initialize\r\n            // \r\n            this.initializeStateCodeActivity_Initialize.Name = \"initializeStateCodeActivity_Initialize\";\r\n            this.initializeStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.initializeStateCodeActivity_Initialize);\r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity7);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsUsedByPageType);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Description = \"IsUsedByPageType\";\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // caShowMessageBox\r\n            // \r\n            this.caShowMessageBox.Name = \"caShowMessageBox\";\r\n            this.caShowMessageBox.ExecuteCode += new System.EventHandler(this.codeActivity_ShowTypeIsReferencedWarning);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.ifElseActivity1);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.caShowMessageBox);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.TypeIsReferenced);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateCodeActivity_Finalize\r\n            // \r\n            this.finalizeStateCodeActivity_Finalize.Name = \"finalizeStateCodeActivity_Finalize\";\r\n            this.finalizeStateCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeStateCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeleteAggregationTypeStep1.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // ifTypeIsReferenced\r\n            // \r\n            this.ifTypeIsReferenced.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifTypeIsReferenced.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifTypeIsReferenced.Name = \"ifTypeIsReferenced\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeStateCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifTypeIsReferenced);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeleteAggregationTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteAggregationTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private CodeActivity initializeStateCodeActivity_Initialize;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity finalizeStateCodeActivity_Finalize;\r\n\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifTypeIsReferenced;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private CodeActivity caShowMessageBox;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteAggregationTypeWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1221; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"DeleteAggregationTypeWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"612; 544\" Location=\"334; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifTypeIsReferenced\" Size=\"592; 463\" Location=\"344; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 363\" Location=\"363; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"caShowMessageBox\" Size=\"130; 41\" Location=\"373; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"373; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"381; 363\" Location=\"536; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 282\" Location=\"546; 343\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 182\" Location=\"565; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"575; 506\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 182\" Location=\"738; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeStateCodeActivity_Initialize\" Size=\"130; 41\" Location=\"748; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"748; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"239; 333\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"247; 364\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130; 41\" Location=\"257; 426\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"247; 388\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"257; 450\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"257; 510\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"247; 412\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"257; 474\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"257; 534\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"538; 482\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 242\" Location=\"546; 513\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"556; 575\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeStateCodeActivity_Finalize\" Size=\"130; 41\" Location=\"556; 635\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"556; 695\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeleteAggregationTypeWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteAggregationTypeWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"333\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"442\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"482\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"446\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"523\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"523\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteCompositionTypeWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing System.Workflow.Activities;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteCompositionTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteCompositionTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            Type type = TypeManager.GetType(this.Payload);\r\n\r\n            Guid guid = type.GetImmutableTypeId();\r\n\r\n            return DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n        }\r\n\r\n\r\n\r\n        private void DoesTypeExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = GetDataTypeDescriptor() != null;\r\n        }\r\n\r\n\r\n\r\n        private void IsUsedByPageType(object sender, ConditionalEventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            bool isUsed = DataFacade.GetData<IPageTypeMetaDataTypeLink>().Where(f => f.DataTypeId == dataTypeDescriptor.DataTypeId).Any();\r\n\r\n            if (isUsed)\r\n            {\r\n                Type interfaceType = GetDataTypeDescriptor().GetInterfaceType();\r\n\r\n                this.ShowMessage(DialogType.Warning,\r\n                                 GetLocalizedText(\"DeleteCompositionTypeWorkflow.ErrorTitle\"),\r\n                                 GetLocalizedText(\"DeleteCompositionTypeWorkflow.IsUsedByPageType\").FormatWith(interfaceType.FullName));\r\n            }\r\n\r\n            e.Result = isUsed;\r\n        }\r\n\r\n\r\n\r\n        private void initializeStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            string interfaceName = StringExtensionMethods.CreateNamespace(dataTypeDescriptor.Namespace, dataTypeDescriptor.Name, '.');\r\n\r\n            interfaceName = string.Format(\"{0} {1}?\", StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"DeleteCompositionTypeWorkflow.Text\"), interfaceName);\r\n\r\n            this.Bindings.Add(\"InterfaceName\", interfaceName);\r\n        }\r\n\r\n        private void TypeIsReferenced(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            var descriptor = GetDataTypeDescriptor();\r\n            Type interfaceType = descriptor.GetInterfaceType();\r\n\r\n            // NOTE: Type could reference to itself\r\n            e.Result = interfaceType.GetRefereeTypes().Where(type => type != interfaceType).Any();\r\n        }\r\n\r\n\r\n        private void codeActivity_ShowTypeIsReferencedWarning(object sender, EventArgs e)\r\n        {\r\n            Type interfaceType = GetDataTypeDescriptor().GetInterfaceType();\r\n\r\n            this.ShowMessage(DialogType.Warning,\r\n                             GetLocalizedText(\"DeleteCompositionTypeWorkflow.ErrorTitle\"),\r\n                             GetLocalizedText(\"DeleteCompositionTypeWorkflow.TypeIsReferenced\").FormatWith(interfaceType.FullName));\r\n            return;\r\n        }\r\n\r\n        private static string GetLocalizedText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", key);\r\n        }\r\n\r\n\r\n        private void finalizeStateCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            string errorMessage;\r\n            if (!GeneratedTypesFacade.CanDeleteType(dataTypeDescriptor, out errorMessage))\r\n            {\r\n                this.ShowMessage(DialogType.Warning,\r\n                                \"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteCompositionTypeWorkflow.ErrorTitle}\",\r\n                                errorMessage);\r\n                return;\r\n            }\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                PageMetaDataFacade.RemoveAllDefinitions(dataTypeDescriptor.DataTypeId, false);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            GeneratedTypesFacade.DeleteType(dataTypeDescriptor);\r\n\r\n            GeneratedDataTypesElementProviderRootEntityToken entityToken = new GeneratedDataTypesElementProviderRootEntityToken(this.EntityToken.Source, GeneratedDataTypesElementProviderRootEntityToken.PageMetaDataTypeFolderId);\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(entityToken);\r\n        }\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteCompositionTypeWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class DeleteCompositionTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.caShowWarning = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.ifTypeIsReferenced = new System.Workflow.Activities.IfElseActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeStateCodeActivity_Initialize\r\n            // \r\n            this.initializeStateCodeActivity_Initialize.Name = \"initializeStateCodeActivity_Initialize\";\r\n            this.initializeStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.initializeStateCodeActivity_Initialize);\r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity7);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsUsedByPageType);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // caShowWarning\r\n            // \r\n            this.caShowWarning.Name = \"caShowWarning\";\r\n            this.caShowWarning.ExecuteCode += new System.EventHandler(this.codeActivity_ShowTypeIsReferencedWarning);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.ifElseActivity1);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.caShowWarning);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.TypeIsReferenced);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateCodeActivity_Finalize\r\n            // \r\n            this.finalizeStateCodeActivity_Finalize.Name = \"finalizeStateCodeActivity_Finalize\";\r\n            this.finalizeStateCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeStateCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeleteCompositionTypeStep1.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // ifTypeIsReferenced\r\n            // \r\n            this.ifTypeIsReferenced.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifTypeIsReferenced.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifTypeIsReferenced.Name = \"ifTypeIsReferenced\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeStateCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifTypeIsReferenced);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeleteCompositionTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteCompositionTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private CodeActivity initializeStateCodeActivity_Initialize;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity finalizeStateCodeActivity_Finalize;\r\n\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private CodeActivity caShowWarning;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifTypeIsReferenced;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteCompositionTypeWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1221; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"DeleteCompositionTypeWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"612; 544\" Location=\"334; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifTypeIsReferenced\" Size=\"592; 463\" Location=\"344; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 363\" Location=\"363; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"caShowWarning\" Size=\"130; 41\" Location=\"373; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"373; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"381; 363\" Location=\"536; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 282\" Location=\"546; 343\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 182\" Location=\"565; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"575; 506\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 182\" Location=\"738; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeStateCodeActivity_Initialize\" Size=\"130; 41\" Location=\"748; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"748; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"239; 333\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"247; 364\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130; 41\" Location=\"257; 426\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"247; 388\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"257; 450\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"257; 510\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"247; 412\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"257; 474\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"257; 534\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"538; 482\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 242\" Location=\"546; 513\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"556; 575\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeStateCodeActivity_Finalize\" Size=\"130; 41\" Location=\"556; 635\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"556; 695\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeleteCompositionTypeWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteCompositionTypeWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"333\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"442\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"482\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"446\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"739\" Y=\"523\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"523\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteDataWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions; \r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void HasDataReferences(object sender, ConditionalEventArgs e)\r\n        {\r\n            IData data = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            var brokenReferences = new List<IData>();\r\n\r\n            var references = DataReferenceFacade.GetNotOptionalReferences(data);\r\n            foreach (var reference in references)\r\n            {\r\n                DataSourceId referenceDataSourceId = reference.DataSourceId;\r\n                if (brokenReferences.Any(brokenRef => brokenRef.DataSourceId == referenceDataSourceId))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                brokenReferences.Add(reference);\r\n            }\r\n\r\n            e.Result = brokenReferences.Count > 0;\r\n            if (brokenReferences.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            Bindings.Add(\"ReferencedData\", DataReferenceFacade.GetBrokenReferencesReport(brokenReferences));\r\n        }\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            IData data = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            if (DataFacade.WillDeleteSucceed(data))\r\n            {\r\n                ProcessControllerFacade.FullDelete(data);\r\n\r\n                deleteTreeRefresher.PostRefreshMesseges(true);\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"CascadeDeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"CascadeDeleteErrorMessage\")\r\n                    );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteDataWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class DeleteDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.confirmDialogFormActivity2 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.branchHasNoRelatedData = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branchHasRelatedData = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.ifElseHasRelatedData = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1SventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.checkRelatedDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialstateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // confirmDialogFormActivity2\r\n            // \r\n            this.confirmDialogFormActivity2.ContainerLabel = null;\r\n            this.confirmDialogFormActivity2.FormDefinitionFileName = \"/Administrative/DeleteGeneratedDataStep2.xml\";\r\n            this.confirmDialogFormActivity2.Name = \"confirmDialogFormActivity2\";\r\n            // \r\n            // branchHasNoRelatedData\r\n            // \r\n            this.branchHasNoRelatedData.Activities.Add(this.setStateActivity6);\r\n            this.branchHasNoRelatedData.Name = \"branchHasNoRelatedData\";\r\n            // \r\n            // branchHasRelatedData\r\n            // \r\n            this.branchHasRelatedData.Activities.Add(this.confirmDialogFormActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasDataReferences);\r\n            this.branchHasRelatedData.Condition = codecondition1;\r\n            this.branchHasRelatedData.Name = \"branchHasRelatedData\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finializeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseHasRelatedData\r\n            // \r\n            this.ifElseHasRelatedData.Activities.Add(this.branchHasRelatedData);\r\n            this.ifElseHasRelatedData.Activities.Add(this.branchHasNoRelatedData);\r\n            this.ifElseHasRelatedData.Name = \"ifElseHasRelatedData\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finializeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteGeneratedDataStep1.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"checkRelatedDataStateActivity\";\r\n            // \r\n            // eventDrivenActivity_Finish\r\n            // \r\n            this.eventDrivenActivity_Finish.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.eventDrivenActivity_Finish.Activities.Add(this.setStateActivity8);\r\n            this.eventDrivenActivity_Finish.Name = \"eventDrivenActivity_Finish\";\r\n            // \r\n            // eventDrivenActivity_Cancel\r\n            // \r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity7);\r\n            this.eventDrivenActivity_Cancel.Name = \"eventDrivenActivity_Cancel\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.ifElseHasRelatedData);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1SventDrivenActivity_Finish\r\n            // \r\n            this.step1SventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1SventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.step1SventDrivenActivity_Finish.Name = \"step1SventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // checkRelatedDataStateActivity\r\n            // \r\n            this.checkRelatedDataStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_Cancel);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_Finish);\r\n            this.checkRelatedDataStateActivity.Name = \"checkRelatedDataStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1SventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finializeStateActivity\r\n            // \r\n            this.finializeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finializeStateActivity.Name = \"finializeStateActivity\";\r\n            // \r\n            // initialstateActivity\r\n            // \r\n            this.initialstateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialstateActivity.Name = \"initialstateActivity\";\r\n            // \r\n            // DeleteDataWorkflow\r\n            // \r\n            this.Activities.Add(this.initialstateActivity);\r\n            this.Activities.Add(this.finializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.checkRelatedDataStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialstateActivity\";\r\n            this.Name = \"DeleteDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity finializeStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1SventDrivenActivity_Finish;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity branchHasNoRelatedData;\r\n        private IfElseBranchActivity branchHasRelatedData;\r\n        private IfElseActivity ifElseHasRelatedData;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private StateActivity checkRelatedDataStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity2;\r\n        private SetStateActivity setStateActivity8;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_Finish;\r\n        private EventDrivenActivity eventDrivenActivity_Cancel;\r\n        private StateActivity initialstateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteDataWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteDataWorkflow\" Location=\"30; 30\" Size=\"1202; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteDataWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteDataWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1051\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1051\" Y=\"777\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"checkRelatedDataStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initialstateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"checkRelatedDataStateActivity\" SourceActivity=\"initialstateActivity\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"292\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"292\" Y=\"273\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"finializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finializeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"655\" />\r\n\t\t\t\t<ns0:Point X=\"1051\" Y=\"655\" />\r\n\t\t\t\t<ns0:Point X=\"1051\" Y=\"777\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finializeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finializeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1SventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"824\" Y=\"475\" />\r\n\t\t\t\t<ns0:Point X=\"839\" Y=\"475\" />\r\n\t\t\t\t<ns0:Point X=\"839\" Y=\"602\" />\r\n\t\t\t\t<ns0:Point X=\"543\" Y=\"602\" />\r\n\t\t\t\t<ns0:Point X=\"543\" Y=\"614\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"828\" Y=\"499\" />\r\n\t\t\t\t<ns0:Point X=\"1051\" Y=\"499\" />\r\n\t\t\t\t<ns0:Point X=\"1051\" Y=\"777\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"372\" Y=\"314\" />\r\n\t\t\t\t<ns0:Point X=\"726\" Y=\"314\" />\r\n\t\t\t\t<ns0:Point X=\"726\" Y=\"410\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finializeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finializeStateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"eventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"380\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"543\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"543\" Y=\"614\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"eventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"376\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"1051\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"1051\" Y=\"777\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialstateActivity\" Location=\"63; 105\" Size=\"197; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initialStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"81; 198\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finializeStateActivity\" Location=\"441; 614\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"449; 645\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"459; 707\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"459; 767\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"459; 827\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 777\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"621; 410\" Size=\"211; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"629; 441\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"639; 503\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1SventDrivenActivity_Finish\" Location=\"629; 465\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"639; 527\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"639; 587\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"629; 489\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"639; 551\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"639; 611\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"checkRelatedDataStateActivity\" Location=\"201; 273\" Size=\"183; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"stateInitializationActivity1\" Location=\"440; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseHasRelatedData\" Location=\"450; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"branchHasRelatedData\" Location=\"469; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity2\" Location=\"479; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"branchHasNoRelatedData\" Location=\"642; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"652; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Cancel\" Location=\"432; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"442; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"442; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Finish\" Location=\"432; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"442; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"442; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteInterfaceTypeWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteInterfaceTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteInterfaceTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            GeneratedDataTypesElementProviderTypeEntityToken entityToken = (GeneratedDataTypesElementProviderTypeEntityToken)this.EntityToken;\r\n            Type type = TypeManager.GetType(entityToken.SerializedTypeName);\r\n\r\n            Guid guid = type.GetImmutableTypeId();\r\n\r\n            return DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n        }\r\n\r\n\r\n\r\n        private void DoesTypeExists(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = GetDataTypeDescriptor() != null;\r\n        }\r\n\r\n\r\n        private void TypeIsReferenced(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            var descriptor = GetDataTypeDescriptor();\r\n            Type interfaceType = descriptor.GetInterfaceType();\r\n\r\n            // NOTE: Type could reference to itself\r\n            e.Result = interfaceType.GetRefereeTypes().Where(type => type != interfaceType).Any();\r\n        }\r\n\r\n\r\n        private void initialStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            string interfaceName = StringExtensionMethods.CreateNamespace(dataTypeDescriptor.Namespace, dataTypeDescriptor.Name, '.');\r\n\r\n            interfaceName = string.Format(\"{0} {1}?\", StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", \"DeleteGeneratedInterfaceStep1.Text\"), interfaceName);\r\n\r\n            this.Bindings.Add(\"InterfaceType\", interfaceName);\r\n        }\r\n\r\n        private void codeActivity_ShowTypeIsReferencedWarning(object sender, EventArgs e)\r\n        {\r\n            Type interfaceType = GetDataTypeDescriptor().GetInterfaceType();\r\n\r\n            this.ShowMessage(DialogType.Warning,\r\n                             GetLocalizedText(\"DeleteCompositionTypeWorkflow.ErrorTitle\"),\r\n                             GetLocalizedText(\"DeleteCompositionTypeWorkflow.TypeIsReferenced\").FormatWith(interfaceType.FullName));\r\n            return;\r\n        }\r\n\r\n\r\n\r\n        private void codeActivity_finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            string errorMessage;\r\n            if (!GeneratedTypesFacade.CanDeleteType(dataTypeDescriptor, out errorMessage))\r\n            {\r\n                this.ShowMessage(DialogType.Warning,\r\n                                \"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteCompositionTypeWorkflow.ErrorTitle}\",\r\n                                errorMessage);\r\n                return;\r\n            }\r\n\r\n            GeneratedTypesFacade.DeleteType(dataTypeDescriptor);\r\n\r\n            GeneratedDataTypesElementProviderRootEntityToken entityToken = new GeneratedDataTypesElementProviderRootEntityToken(this.EntityToken.Source, GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId);\r\n\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(entityToken, 2);\r\n        }\r\n\r\n        private static string GetLocalizedText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.GeneratedDataTypesElementProvider\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteInterfaceTypeWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class DeleteInterfaceTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initialStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.caShowWarning = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity_finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.ifTypeIsReferenced = new System.Workflow.Activities.IfElseActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initialStateCodeActivity\r\n            // \r\n            this.initialStateCodeActivity.Name = \"initialStateCodeActivity\";\r\n            this.initialStateCodeActivity.ExecuteCode += new System.EventHandler(this.initialStateCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // caShowWarning\r\n            // \r\n            this.caShowWarning.Name = \"caShowWarning\";\r\n            this.caShowWarning.ExecuteCode += new System.EventHandler(this.codeActivity_ShowTypeIsReferencedWarning);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.initialStateCodeActivity);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.caShowWarning);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.TypeIsReferenced);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteGeneratedInteraceStep1.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // codeActivity_finalize\r\n            // \r\n            this.codeActivity_finalize.Name = \"codeActivity_finalize\";\r\n            this.codeActivity_finalize.ExecuteCode += new System.EventHandler(this.codeActivity_finalize_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // ifTypeIsReferenced\r\n            // \r\n            this.ifTypeIsReferenced.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifTypeIsReferenced.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifTypeIsReferenced.Name = \"ifTypeIsReferenced\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity_finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.ifTypeIsReferenced);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // DeleteInterfaceTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"DeleteInterfaceTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private CodeActivity initialStateCodeActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity codeActivity_finalize;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifTypeIsReferenced;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity caShowWarning;\r\n        private StateActivity initialStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DeleteInterfaceTypeWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteInterfaceTypeWorkflow\" Location=\"30; 30\" Size=\"1161; 817\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteInterfaceTypeWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteInterfaceTypeWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"908\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"908\" Y=\"737\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"initialStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"initialStateActivity\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"293\" Y=\"173\" />\r\n\t\t\t\t<ns0:Point X=\"625\" Y=\"173\" />\r\n\t\t\t\t<ns0:Point X=\"625\" Y=\"540\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initialStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initialStateActivity\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"293\" Y=\"173\" />\r\n\t\t\t\t<ns0:Point X=\"388\" Y=\"173\" />\r\n\t\t\t\t<ns0:Point X=\"388\" Y=\"336\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"724\" Y=\"581\" />\r\n\t\t\t\t<ns0:Point X=\"908\" Y=\"581\" />\r\n\t\t\t\t<ns0:Point X=\"908\" Y=\"737\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"486\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"625\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"625\" Y=\"540\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"490\" Y=\"425\" />\r\n\t\t\t\t<ns0:Point X=\"908\" Y=\"425\" />\r\n\t\t\t\t<ns0:Point X=\"908\" Y=\"737\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialStateActivity\" Location=\"100; 132\" Size=\"197; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 363\" Name=\"initialStateInitializationActivity\" Location=\"420; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifTypeIsReferenced\" Location=\"430; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"449; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"caShowWarning\" Location=\"459; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"459; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity2\" Location=\"622; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initialStateCodeActivity\" Location=\"632; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"632; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"523; 540\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"531; 571\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"541; 633\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity_finalize\" Location=\"541; 693\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"541; 753\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"828; 737\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"283; 336\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"291; 367\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"301; 429\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"291; 391\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"301; 453\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"301; 513\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"291; 415\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"301; 477\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"301; 537\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DisableTypeLocalizationWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DisableTypeLocalizationWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DisableTypeLocalizationWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            Type type;\r\n\r\n            if ((this.EntityToken is Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AssociatedDataElementProviderHelperEntityToken))\r\n            {\r\n                Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AssociatedDataElementProviderHelperEntityToken castedEntityToken = this.EntityToken as Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.AssociatedDataElementProviderHelperEntityToken;\r\n\r\n                type = TypeManager.GetType(castedEntityToken.Payload);\r\n            }\r\n            else\r\n            {\r\n                GeneratedDataTypesElementProviderTypeEntityToken entityToken = (GeneratedDataTypesElementProviderTypeEntityToken)this.EntityToken;\r\n                type = TypeManager.GetType(entityToken.SerializedTypeName);\r\n            }\r\n\r\n            Guid guid = type.GetImmutableTypeId();\r\n\r\n            return DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n        }\r\n\r\n\r\n\r\n        private void DataExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            Type interfaceType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n            {\r\n                using (new DataScope(cultureInfo))\r\n                {\r\n                    e.Result = DataFacade.GetData(interfaceType).ToDataEnumerable().Any();\r\n\r\n                    if (e.Result)\r\n                    {\r\n                        return;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_InitializeBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            Type interfaceType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            List<CultureInfo> culturesWithData = new List<CultureInfo>();\r\n            foreach (CultureInfo cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n            {\r\n                using (DataScope localeScope = new DataScope(cultureInfo))\r\n                {\r\n                    bool dataExists = DataFacade.GetData(interfaceType).ToDataEnumerable().Any();\r\n\r\n                    if (dataExists)\r\n                    {\r\n                        culturesWithData.Add(cultureInfo);\r\n                    }\r\n                }\r\n            }\r\n\r\n            Dictionary<string, string> culturesDictionary = culturesWithData.ToDictionary(f => f.Name, DataLocalizationFacade.GetCultureTitle);\r\n\r\n            this.Bindings.Add(\"CultureName\", culturesDictionary.First().Key);\r\n            this.Bindings.Add(\"CultureNameList\", culturesDictionary);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            DataTypeDescriptor newDataTypeDescriptor = dataTypeDescriptor.Clone();\r\n            newDataTypeDescriptor.RemoveSuperInterface(typeof(ILocalizedControlled));\r\n\r\n\r\n            UpdateDataTypeDescriptor updateDataTypeDescriptor = new UpdateDataTypeDescriptor(dataTypeDescriptor, newDataTypeDescriptor, false);\r\n\r\n            if (this.BindingExist(\"CultureName\"))\r\n            {\r\n                string cultureName = this.GetBinding<string>(\"CultureName\");\r\n                CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);\r\n\r\n                updateDataTypeDescriptor.LocaleToCopyFrom = cultureInfo;\r\n            }\r\n\r\n            GeneratedTypesFacade.UpdateType(updateDataTypeDescriptor);\r\n\r\n            this.CloseCurrentView();\r\n            this.CollapseAndRefresh();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DisableTypeLocalizationWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class DisableTypeLocalizationWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.step1CodeActivity_InitializeBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.initializeIfElseActivity_DataExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity8);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DataExists);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"/Administrative/DisableTypeLocalizationStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"/Administrative/DisableTypeLocalizationStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // step1CodeActivity_InitializeBindings\r\n            // \r\n            this.step1CodeActivity_InitializeBindings.Name = \"step1CodeActivity_InitializeBindings\";\r\n            this.step1CodeActivity_InitializeBindings.ExecuteCode += new System.EventHandler(this.step1CodeActivity_InitializeBindings_ExecuteCode);\r\n            // \r\n            // initializeIfElseActivity_DataExists\r\n            // \r\n            this.initializeIfElseActivity_DataExists.Activities.Add(this.ifElseBranchActivity1);\r\n            this.initializeIfElseActivity_DataExists.Activities.Add(this.ifElseBranchActivity2);\r\n            this.initializeIfElseActivity_DataExists.Name = \"initializeIfElseActivity_DataExists\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity7);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Finish\r\n            // \r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.step2EventDrivenActivity_Finish.Name = \"step2EventDrivenActivity_Finish\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2WizardFormActivity);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1CodeActivity_InitializeBindings);\r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_DataExists);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Finish);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DisableTypeLocalizationWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DisableTypeLocalizationWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step2EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step2StateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private CodeActivity step1CodeActivity_InitializeBindings;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity initializeIfElseActivity_DataExists;\r\n        private SetStateActivity setStateActivity8;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/DisableTypeLocalizationWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DisableTypeLocalizationWorkflow\" Location=\"30; 30\" Size=\"1146; 980\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DisableTypeLocalizationWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DisableTypeLocalizationWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"352\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"352\" Y=\"295\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"539\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"539\" Y=\"432\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"444\" Y=\"360\" />\r\n\t\t\t\t<ns0:Point X=\"539\" Y=\"360\" />\r\n\t\t\t\t<ns0:Point X=\"539\" Y=\"432\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"454\" Y=\"384\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"384\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"637\" Y=\"497\" />\r\n\t\t\t\t<ns0:Point X=\"783\" Y=\"497\" />\r\n\t\t\t\t<ns0:Point X=\"783\" Y=\"608\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"641\" Y=\"521\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"521\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"882\" Y=\"649\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"649\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"initializeStateInitializationActivity\" Location=\"412; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"initializeIfElseActivity_DataExists\" Location=\"422; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"441; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"451; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"614; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"624; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"247; 295\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"step1StateInitializationActivity\" Location=\"255; 326\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_InitializeBindings\" Location=\"265; 388\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizardFormActivity\" Location=\"265; 448\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Next\" Location=\"255; 350\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity1\" Location=\"265; 412\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"265; 472\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"255; 374\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"265; 436\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"265; 496\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step2StateActivity\" Location=\"434; 432\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step2StateInitializationActivity\" Location=\"442; 463\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2WizardFormActivity\" Location=\"452; 525\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2EventDrivenActivity_Finish\" Location=\"442; 487\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"452; 549\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"452; 609\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2EventDrivenActivity_Cancel\" Location=\"442; 511\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"452; 573\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"452; 633\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"681; 608\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"689; 639\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"699; 701\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"699; 761\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditCompositionTypeWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_GeneratedDataTypesElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditCompositionTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private string NewTypeNameBindingName { get { return \"NewTypeName\"; } }\r\n        private string NewTypeNamespaceBindingName { get { return \"NewTypeNamespace\"; } }\r\n        private string NewTypeTitleBindingName { get { return \"NewTypeTitle\"; } }\r\n        private string DataFieldDescriptorsBindingName { get { return \"DataFieldDescriptors\"; } }\r\n        private string LabelFieldNameBindingName { get { return \"LabelFieldName\"; } }\r\n\r\n        private string HasCachingBindingName { get { return \"HasCaching\"; } }\r\n        private string HasPublishingBindingName { get { return \"HasPublishing\"; } }\r\n\r\n\r\n\r\n        public EditCompositionTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            Type type = TypeManager.GetType(this.Payload);\r\n\r\n            Guid guid = type.GetImmutableTypeId();\r\n\r\n            return DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n        }\r\n\r\n\r\n\r\n        private void initializeStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n            var helper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n            var fieldDescriptors = helper.EditableInDesignerOwnDataFields.ToList();\r\n\r\n            this.Bindings = new Dictionary<string, object>\r\n            {\r\n                {\"TypeName\", dataTypeDescriptor.Name},\r\n                {\"TypeNamespace\", dataTypeDescriptor.Namespace},\r\n                {\"TypeTitle\", dataTypeDescriptor.Title},\r\n                {\"LabelFieldName\", dataTypeDescriptor.LabelFieldName},\r\n                {\"HasCaching\", helper.IsCacheable},\r\n                {\"HasPublishing\", helper.IsPublishControlled},\r\n                {\"DataFieldDescriptors\", fieldDescriptors},\r\n                {\"OldTypeName\", dataTypeDescriptor.Name},\r\n                {\"OldTypeNamespace\", dataTypeDescriptor.Namespace}\r\n            };\r\n\r\n            this.BindingsValidationRules = new Dictionary<string, List<ClientValidationRule>>\r\n            {\r\n                {this.NewTypeNameBindingName, new List<ClientValidationRule> {new NotNullClientValidationRule()}},\r\n                {this.NewTypeNamespaceBindingName, new List<ClientValidationRule> {new NotNullClientValidationRule()}},\r\n                {this.NewTypeTitleBindingName, new List<ClientValidationRule> {new NotNullClientValidationRule()}}\r\n            };\r\n        }\r\n\r\n\r\n        private Type GetOldTypeFromBindings()\r\n        {\r\n            string typeFullName = GetBinding<string>(\"OldTypeNamespace\") + \".\" + GetBinding<string>(\"OldTypeName\");\r\n\r\n            return TypeManager.GetType(typeFullName);\r\n        }\r\n\r\n\r\n        private void saveTypeCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                Type oldType = GetOldTypeFromBindings();\r\n\r\n                string typeName = this.GetBinding<string>(\"TypeName\");\r\n                string typeNamespace = this.GetBinding<string>(\"TypeNamespace\");\r\n                string typeTitle = this.GetBinding<string>(\"TypeTitle\");\r\n                bool hasCaching = this.GetBinding<bool>(\"HasCaching\");\r\n                bool hasPublishing = this.GetBinding<bool>(\"HasPublishing\");\r\n                string labelFieldName = this.GetBinding<string>(\"LabelFieldName\");\r\n                var dataFieldDescriptors = this.GetBinding<List<DataFieldDescriptor>>(\"DataFieldDescriptors\");\r\n\r\n                var helper = new GeneratedTypesHelper(oldType);\r\n\r\n                string errorMessage;\r\n                if (!helper.ValidateNewTypeName(typeName, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeName\", errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeNamespace(typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeNamespace\", errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeFullName(typeName, typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(\"NewTypeName\", errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewFieldDescriptors(dataFieldDescriptors, null, out errorMessage))\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            Texts.EditCompositionTypeWorkflow_ErrorTitle,\r\n                            errorMessage\r\n                        );\r\n                    return;\r\n                }\r\n\r\n                helper.SetNewTypeFullName(typeName, typeNamespace);\r\n                helper.SetNewTypeTitle(typeTitle);\r\n                // TODO: fix\r\n                helper.SetNewFieldDescriptors(dataFieldDescriptors, null, labelFieldName);\r\n                helper.SetCacheable(hasCaching);\r\n\r\n                if (helper.IsEditProcessControlledAllowed)\r\n                {\r\n                    helper.SetPublishControlled(hasPublishing);\r\n                }\r\n\r\n                bool originalTypeDataExists = DataFacade.HasDataInAnyScope(oldType);\r\n\r\n                if (!helper.TryValidateUpdate(originalTypeDataExists, out errorMessage))\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            Texts.EditCompositionTypeWorkflow_ErrorTitle,\r\n                            errorMessage\r\n                        );\r\n                    return;\r\n                }\r\n\r\n                helper.CreateType(originalTypeDataExists);\r\n\r\n                UpdateBinding(\"OldTypeName\", typeName);\r\n                UpdateBinding(\"OldTypeNamespace\", typeNamespace);\r\n\r\n                SetSaveStatus(true);\r\n                \r\n                var rootEntityToken = new GeneratedDataTypesElementProviderRootEntityToken(this.EntityToken.Source, GeneratedDataTypesElementProviderRootEntityToken.PageMetaDataTypeFolderId);\r\n                SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n                specificTreeRefresher.PostRefreshMesseges(rootEntityToken);\r\n\r\n                IFile markupFile = DynamicTypesCustomFormFacade.GetCustomFormMarkupFile(typeNamespace, typeName);\r\n                if (markupFile != null)\r\n                {\r\n                    ShowMessage(DialogType.Message,\r\n                        Texts.FormMarkupInfo_Dialog_Label,\r\n                        Texts.FormMarkupInfo_Message(Texts.EditFormMarkup, markupFile.GetRelativeFilePath()));\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(\"EditCompositionTypeWorkflow\", ex);\r\n\r\n                this.ShowMessage(DialogType.Error, ex.Message, ex.Message);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditCompositionTypeWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class EditCompositionTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveTypeCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.editTypeDocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.saveTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editTypeEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editTypeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveTypeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editTypeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editTypeStateActivity\";\r\n            // \r\n            // saveTypeCodeActivity_Save\r\n            // \r\n            this.saveTypeCodeActivity_Save.Name = \"saveTypeCodeActivity_Save\";\r\n            this.saveTypeCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saveTypeCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"saveTypeStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // editTypeDocumentFormActivity\r\n            // \r\n            this.editTypeDocumentFormActivity.ContainerLabel = null;\r\n            this.editTypeDocumentFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\EditCompositionTypeStep1.xml\";\r\n            this.editTypeDocumentFormActivity.Name = \"editTypeDocumentFormActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editTypeStateActivity\";\r\n            // \r\n            // initializeStateCodeActivity_Initialize\r\n            // \r\n            this.initializeStateCodeActivity_Initialize.Name = \"initializeStateCodeActivity_Initialize\";\r\n            this.initializeStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // saveTypeStateInitializationActivity\r\n            // \r\n            this.saveTypeStateInitializationActivity.Activities.Add(this.saveTypeCodeActivity_Save);\r\n            this.saveTypeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.saveTypeStateInitializationActivity.Name = \"saveTypeStateInitializationActivity\";\r\n            // \r\n            // editTypeEventDrivenActivity_Save\r\n            // \r\n            this.editTypeEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editTypeEventDrivenActivity_Save.Activities.Add(this.setStateActivity2);\r\n            this.editTypeEventDrivenActivity_Save.Name = \"editTypeEventDrivenActivity_Save\";\r\n            // \r\n            // editTypeStateInitializationActivity\r\n            // \r\n            this.editTypeStateInitializationActivity.Activities.Add(this.editTypeDocumentFormActivity);\r\n            this.editTypeStateInitializationActivity.Name = \"editTypeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeStateCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveTypeStateActivity\r\n            // \r\n            this.saveTypeStateActivity.Activities.Add(this.saveTypeStateInitializationActivity);\r\n            this.saveTypeStateActivity.Name = \"saveTypeStateActivity\";\r\n            // \r\n            // editTypeStateActivity\r\n            // \r\n            this.editTypeStateActivity.Activities.Add(this.editTypeStateInitializationActivity);\r\n            this.editTypeStateActivity.Activities.Add(this.editTypeEventDrivenActivity_Save);\r\n            this.editTypeStateActivity.Name = \"editTypeStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditCompositionTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editTypeStateActivity);\r\n            this.Activities.Add(this.saveTypeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditCompositionTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateInitializationActivity saveTypeStateInitializationActivity;\r\n        private EventDrivenActivity editTypeEventDrivenActivity_Save;\r\n        private StateInitializationActivity editTypeStateInitializationActivity;\r\n        private StateActivity saveTypeStateActivity;\r\n        private StateActivity editTypeStateActivity;\r\n        private CodeActivity initializeStateCodeActivity_Initialize;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity editTypeDocumentFormActivity;\r\n        private CodeActivity saveTypeCodeActivity_Save;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditCompositionTypeWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditCompositionTypeWorkflow\" Location=\"30; 30\" Size=\"1154; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditCompositionTypeWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditCompositionTypeWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editTypeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editTypeStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"370\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveTypeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"editTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveTypeStateActivity\" SourceActivity=\"editTypeStateActivity\" EventHandlerName=\"editTypeEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"427\" Y=\"435\" />\r\n\t\t\t\t<ns0:Point X=\"693\" Y=\"435\" />\r\n\t\t\t\t<ns0:Point X=\"693\" Y=\"455\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editTypeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"saveTypeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editTypeStateActivity\" SourceActivity=\"saveTypeStateActivity\" EventHandlerName=\"saveTypeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"798\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"810\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"810\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"370\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeStateCodeActivity_Initialize\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"editTypeStateActivity\" Location=\"213; 370\" Size=\"218; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editTypeStateInitializationActivity\" Location=\"532; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"editTypeDocumentFormActivity\" Location=\"542; 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"editTypeEventDrivenActivity_Save\" Location=\"524; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"534; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"534; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveTypeStateActivity\" Location=\"584; 455\" Size=\"218; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveTypeStateInitializationActivity\" Location=\"592; 486\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveTypeCodeActivity_Save\" Location=\"602; 548\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"602; 608\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditDataWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class EditDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.enablePublishCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.saveAndPublishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.editCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveAndPublishEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.saveEditEventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // enablePublishCodeActivity\r\n            // \r\n            this.enablePublishCodeActivity.Name = \"enablePublishCodeActivity\";\r\n            this.enablePublishCodeActivity.ExecuteCode += new System.EventHandler(this.enablePublishCodeActivity_ExecuteCode);\r\n            // \r\n            // saveAndPublishHandleExternalEventActivity1\r\n            // \r\n            this.saveAndPublishHandleExternalEventActivity1.EventName = \"SaveAndPublish\";\r\n            this.saveAndPublishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveAndPublishHandleExternalEventActivity1.Name = \"saveAndPublishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // editCodeActivity\r\n            // \r\n            this.editCodeActivity.Name = \"editCodeActivity\";\r\n            this.editCodeActivity.ExecuteCode += new System.EventHandler(this.editCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveAndPublishEventDrivenActivity\r\n            // \r\n            this.saveAndPublishEventDrivenActivity.Activities.Add(this.saveAndPublishHandleExternalEventActivity1);\r\n            this.saveAndPublishEventDrivenActivity.Activities.Add(this.enablePublishCodeActivity);\r\n            this.saveAndPublishEventDrivenActivity.Activities.Add(this.setStateActivity5);\r\n            this.saveAndPublishEventDrivenActivity.Name = \"saveAndPublishEventDrivenActivity\";\r\n            // \r\n            // saveEditEventDrivenActivity1\r\n            // \r\n            this.saveEditEventDrivenActivity1.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.saveEditEventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.saveEditEventDrivenActivity1.Name = \"saveEditEventDrivenActivity1\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.editCodeActivity);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity2);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.saveEditEventDrivenActivity1);\r\n            this.editStateActivity.Activities.Add(this.saveAndPublishEventDrivenActivity);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // EditDataWorkflow\r\n            // \r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"EditDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity enablePublishCodeActivity;\r\n\r\n        private C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity saveAndPublishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity saveAndPublishEventDrivenActivity;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private CodeActivity editCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n\r\n        private EventDrivenActivity saveEditEventDrivenActivity1;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private CodeActivity saveCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity initialStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditDataWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Scheduling;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditDataWorkflow : FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        private bool _doPublish;\r\n\r\n        [NonSerialized]\r\n        private DataTypeDescriptorFormsHelper _helper;\r\n\r\n        [NonSerialized]\r\n        private string _typeName;\r\n\r\n        public EditDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private DataTypeDescriptorFormsHelper GetDataTypeDescriptorFormsHelper()\r\n        {\r\n            if (_helper == null)\r\n            {\r\n                var dataEntityToken = (DataEntityToken)EntityToken;\r\n                var guid = dataEntityToken.Data.DataSourceId.InterfaceType.GetImmutableTypeId();\r\n                var typeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n\r\n                var generatedTypesHelper = new GeneratedTypesHelper(typeDescriptor) { AllowForeignKeyEditing = true };\r\n\r\n                _helper = new DataTypeDescriptorFormsHelper(typeDescriptor, true, EntityToken)\r\n                {\r\n                    LayoutIconHandle = \"generated-type-data-edit\"\r\n                };\r\n\r\n                _helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n                _typeName = typeDescriptor.Name;\r\n            }\r\n\r\n            return _helper;\r\n        }\r\n\r\n        private void editCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var data = ((DataEntityToken)EntityToken).Data;\r\n            var publishedControlled = data as IPublishControlled;\r\n\r\n            if (!PermissionsFacade.GetPermissionsForCurrentUser(EntityToken).Contains(PermissionType.Publish) || publishedControlled == null)\r\n            {\r\n                var formData = WorkflowFacade.GetFormData(InstanceId, true);\r\n\r\n                if (formData.ExcludedEvents == null)\r\n                {\r\n                    formData.ExcludedEvents = new List<string>();\r\n                }\r\n\r\n                formData.ExcludedEvents.Add(\"SaveAndPublish\");\r\n            }\r\n\r\n            var helper = GetDataTypeDescriptorFormsHelper();\r\n\r\n            if (publishedControlled != null)\r\n            {\r\n                if (publishedControlled.PublicationStatus == GenericPublishProcessController.Published)\r\n                {\r\n                    publishedControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n                }\r\n            }\r\n\r\n            helper.UpdateWithBindings(data, Bindings);\r\n            helper.LayoutLabel = data.GetLabel(true);\r\n\r\n            DeliverFormData(\r\n                    _typeName,\r\n                    StandardUiContainerTypes.Document,\r\n                    helper.GetForm(),\r\n                    Bindings,\r\n                    helper.GetBindingsValidationRules(data)\r\n                );\r\n        }\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var isValid = ValidateBindings();\r\n            var updateTreeRefresher = CreateUpdateTreeRefresher(EntityToken);\r\n            var helper = GetDataTypeDescriptorFormsHelper();\r\n\r\n            var data = ((DataEntityToken)EntityToken).Data;\r\n\r\n            if (!BindAndValidate(helper, data))\r\n            {\r\n                isValid = false;\r\n            }\r\n\r\n            var fieldsWithBrokenReferences = new List<string>();\r\n            if (!data.TryValidateForeignKeyIntegrity(fieldsWithBrokenReferences))\r\n            {\r\n                isValid = false;\r\n\r\n                foreach (var fieldName in fieldsWithBrokenReferences)\r\n                {\r\n                    ShowFieldMessage(fieldName, StringResourceSystemFacade.GetString(\"Composite.Management\", \"Validation.BrokenReference\"));\r\n                }\r\n            }\r\n\r\n            if (isValid)\r\n            {\r\n                // published data stayed as published data - change to draft if status is published\r\n                if (data is IPublishControlled)\r\n                {\r\n                    var publishControlledData = (IPublishControlled)data;\r\n                    if (publishControlledData.PublicationStatus == GenericPublishProcessController.Published)\r\n                    {\r\n                        publishControlledData.PublicationStatus = GenericPublishProcessController.Draft;\r\n                    }\r\n                }\r\n\r\n                DataFacade.Update(data);\r\n\r\n                EntityTokenCacheFacade.ClearCache(EntityToken);\r\n\r\n                updateTreeRefresher.PostRefreshMesseges(EntityToken);\r\n\r\n                PublishControlledHelper.PublishIfNeeded(data, _doPublish, Bindings, ShowMessage);\r\n\r\n                SetSaveStatus(true);\r\n            }\r\n            else\r\n            {\r\n                SetSaveStatus(false);\r\n            }\r\n        }\r\n\r\n        private void enablePublishCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            _doPublish = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditDataWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1199; 932\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"212; 80\" AutoSizeMargin=\"16; 24\" Location=\"117; 131\" Name=\"initialStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150; 146\" Location=\"125; 164\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"135; 229\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"239; 110\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"102; 382\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 125\" Location=\"546; 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"editCodeActivity\" Size=\"130; 41\" Location=\"556; 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"saveEditEventDrivenActivity1\" Size=\"150; 209\" Location=\"546; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"556; 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"556; 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"saveAndPublishEventDrivenActivity\" Size=\"150; 272\" Location=\"554; 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveAndPublishHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"564; 219\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"enablePublishCodeActivity\" Size=\"130; 44\" Location=\"564; 282\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 62\" Location=\"564; 345\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"544; 144\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"206; 80\" AutoSizeMargin=\"16; 24\" Location=\"392; 366\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 209\" Location=\"400; 399\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity\" Size=\"130; 44\" Location=\"410; 464\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"410; 527\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"EditDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"214\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"624\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"624\" Y=\"144\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initialStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initialStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"325\" Y=\"175\" />\r\n\t\t\t\t<ns0:Point X=\"341\" Y=\"175\" />\r\n\t\t\t\t<ns0:Point X=\"341\" Y=\"370\" />\r\n\t\t\t\t<ns0:Point X=\"221\" Y=\"370\" />\r\n\t\t\t\t<ns0:Point X=\"221\" Y=\"382\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Bottom\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveEditEventDrivenActivity1\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"303\" Y=\"452\" />\r\n\t\t\t\t<ns0:Point X=\"495\" Y=\"452\" />\r\n\t\t\t\t<ns0:Point X=\"495\" Y=\"446\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"594\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"605\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"605\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"221\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"221\" Y=\"382\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Bottom\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveAndPublishEventDrivenActivity\" SourceConnectionIndex=\"2\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"337\" Y=\"478\" />\r\n\t\t\t\t<ns0:Point X=\"495\" Y=\"478\" />\r\n\t\t\t\t<ns0:Point X=\"495\" Y=\"446\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditFormWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditFormWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditFormWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        \r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            string formMarkup;\r\n\r\n            XDocument formMarkupDocument = DynamicTypesCustomFormFacade.GetCustomFormMarkup(dataTypeDescriptor);\r\n\r\n\r\n            if (formMarkupDocument != null)\r\n            {\r\n                formMarkup = formMarkupDocument.ToString();\r\n            }\r\n            else\r\n            {\r\n                bool isMetaDataType = dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPageMetaData));\r\n                var formsHelper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, null, !isMetaDataType, null);\r\n\r\n                var generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n                formsHelper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n                formMarkup = formsHelper.GetForm();\r\n            }\r\n\r\n            this.Bindings.Add(\"Title\", string.Format(\"{0}.{1} XML\", dataTypeDescriptor.Namespace, dataTypeDescriptor.Name));\r\n            this.Bindings.Add(\"FileContent\", formMarkup);\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string fileContent = this.GetBinding<string>(\"FileContent\");\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            try\r\n            {\r\n                DynamicTypesAlternateFormFacade.SetAlternateForm(dataTypeDescriptor, fileContent);\r\n\r\n                SetSaveStatus(true);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                var consoleMessageService = serviceContainer.GetService<IManagementConsoleMessageService>();\r\n                consoleMessageService.ShowMessage(\r\n                    DialogType.Error,\r\n                    \"Error\",\r\n                    ex.Message);\r\n            }\r\n\r\n        }\r\n\r\n\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            var entityToken = (GeneratedDataTypesElementProviderTypeEntityToken)this.EntityToken;\r\n            Type type = TypeManager.GetType(entityToken.SerializedTypeName);\r\n\r\n            Guid guid = type.GetImmutableTypeId();\r\n\r\n            return DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditFormWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class EditFormWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditDynamicTypeFormMarkup.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditFormWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditFormWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private CodeActivity saveCodeActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditInterfaceTypeWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class EditInterfaceTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity_refreshView = new System.Workflow.Activities.CodeActivity();\r\n            this.customEvent01HandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initialStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editState_IsSearchableChanged = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.saveStep1StateEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity1 = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeStateCodeActivity\r\n            // \r\n            this.finalizeStateCodeActivity.Name = \"finalizeStateCodeActivity\";\r\n            this.finalizeStateCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeStateCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // codeActivity_refreshView\r\n            // \r\n            this.codeActivity_refreshView.Name = \"codeActivity_refreshView\";\r\n            this.codeActivity_refreshView.ExecuteCode += new System.EventHandler(this.codeActivity_refreshViewHandler);\r\n            // \r\n            // customEvent01HandleExternalEventActivity1\r\n            // \r\n            this.customEvent01HandleExternalEventActivity1.EventName = \"CustomEvent01\";\r\n            this.customEvent01HandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.customEvent01HandleExternalEventActivity1.Name = \"customEvent01HandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditInterfaceTypeStep1.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initialStateCodeActivity\r\n            // \r\n            this.initialStateCodeActivity.Name = \"initialStateCodeActivity\";\r\n            this.initialStateCodeActivity.ExecuteCode += new System.EventHandler(this.initialStateCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeStateCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // editState_IsSearchableChanged\r\n            // \r\n            this.editState_IsSearchableChanged.Activities.Add(this.customEvent01HandleExternalEventActivity1);\r\n            this.editState_IsSearchableChanged.Activities.Add(this.codeActivity_refreshView);\r\n            this.editState_IsSearchableChanged.Activities.Add(this.setStateActivity5);\r\n            this.editState_IsSearchableChanged.Name = \"editState_IsSearchableChanged\";\r\n            // \r\n            // saveStep1StateEventDrivenActivity\r\n            // \r\n            this.saveStep1StateEventDrivenActivity.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.saveStep1StateEventDrivenActivity.Activities.Add(this.setStateActivity2);\r\n            this.saveStep1StateEventDrivenActivity.Name = \"saveStep1StateEventDrivenActivity\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initialStateCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.saveStep1StateEventDrivenActivity);\r\n            this.step1StateActivity.Activities.Add(this.editState_IsSearchableChanged);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initialStateActivity1\r\n            // \r\n            this.initialStateActivity1.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity1.Name = \"initialStateActivity1\";\r\n            // \r\n            // EditInterfaceTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.initialStateActivity1);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity1\";\r\n            this.Name = \"EditInterfaceTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity1;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private CodeActivity initialStateCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private EventDrivenActivity saveStep1StateEventDrivenActivity;\r\n        private CodeActivity finalizeStateCodeActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity5;\r\n        private CodeActivity codeActivity_refreshView;\r\n        private C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity customEvent01HandleExternalEventActivity1;\r\n        private EventDrivenActivity editState_IsSearchableChanged;\r\n        private StateActivity initialStateActivity1;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditInterfaceTypeWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.DynamicTypes.Foundation;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_GeneratedDataTypesElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditInterfaceTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditInterfaceTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private bool IsPageFolder\r\n        {\r\n            get { return this.EntityToken.Id == GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId; }\r\n        }\r\n\r\n        private static class BindingNames\r\n        {\r\n            public const string TypeName = \"TypeName\";\r\n            public const string TypeNamespace = \"TypeNamespace\";\r\n            public const string TypeTitle = \"TypeTitle\";\r\n            public const string DataFieldDescriptors = \"DataFieldDescriptors\";\r\n            public const string KeyFieldName = \"KeyFieldName\";\r\n            public const string LabelFieldName = \"LabelFieldName\";\r\n            public const string InternalUrlPrefix = \"InternalUrlPrefix\";\r\n            public const string HasCaching = \"HasCaching\";\r\n            public const string HasPublishing = \"HasPublishing\";\r\n            public const string IsSearchable = \"IsSearchable\";\r\n\r\n            public const string OldTypeName = \"OldTypeName\";\r\n            public const string OldTypeNamespace = \"OldTypeNamespace\";\r\n        }\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            Type type = GetTypeFromEntityToken();\r\n\r\n            Guid guid = type.GetImmutableTypeId();\r\n\r\n            return DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n        }\r\n\r\n\r\n        private Type GetTypeFromEntityToken()\r\n        {\r\n            var entityToken = (GeneratedDataTypesElementProviderTypeEntityToken)this.EntityToken;\r\n            return TypeManager.GetType(entityToken.SerializedTypeName);\r\n        }\r\n\r\n\r\n        private void initialStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            var helper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n\r\n            List<DataFieldDescriptor> fieldDescriptors = helper.EditableInDesignerOwnDataFields.ToList();\r\n\r\n            this.Bindings = new Dictionary<string, object>\r\n            {\r\n                {BindingNames.TypeName, dataTypeDescriptor.Name},\r\n                {BindingNames.TypeNamespace, dataTypeDescriptor.Namespace},\r\n                {BindingNames.TypeTitle, dataTypeDescriptor.Title},\r\n                {BindingNames.KeyFieldName, dataTypeDescriptor.KeyPropertyNames.Single() },\r\n                {BindingNames.LabelFieldName, dataTypeDescriptor.LabelFieldName},\r\n                {BindingNames.InternalUrlPrefix, dataTypeDescriptor.InternalUrlPrefix},\r\n                {BindingNames.HasCaching, helper.IsCacheable},\r\n                {BindingNames.HasPublishing, helper.IsPublishControlled},\r\n                {BindingNames.IsSearchable, helper.IsSearchable},\r\n                {BindingNames.DataFieldDescriptors, fieldDescriptors},\r\n                {BindingNames.OldTypeName, dataTypeDescriptor.Name},\r\n                {BindingNames.OldTypeNamespace, dataTypeDescriptor.Namespace}\r\n            };\r\n\r\n            this.BindingsValidationRules = new Dictionary<string, List<ClientValidationRule>>\r\n            {\r\n                {BindingNames.TypeName, new List<ClientValidationRule> {new NotNullClientValidationRule()}},\r\n                {BindingNames.TypeNamespace, new List<ClientValidationRule> {new NotNullClientValidationRule()}},\r\n                {BindingNames.TypeTitle, new List<ClientValidationRule> {new NotNullClientValidationRule()}}\r\n            };\r\n        }\r\n\r\n\r\n        private Type GetOldTypeFromBindings()\r\n        {\r\n            string typeFullName = GetBinding<string>(BindingNames.OldTypeNamespace) + \".\" + GetBinding<string>(BindingNames.OldTypeName);\r\n\r\n            return TypeManager.GetType(typeFullName);\r\n        }\r\n\r\n        private void finalizeStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                Type oldType = GetOldTypeFromBindings();\r\n\r\n                string typeName = this.GetBinding<string>(BindingNames.TypeName);\r\n                string typeNamespace = this.GetBinding<string>(BindingNames.TypeNamespace);\r\n                string typeTitle = this.GetBinding<string>(BindingNames.TypeTitle);\r\n                bool hasCaching = this.GetBinding<bool>(BindingNames.HasCaching);\r\n                bool hasPublishing = this.GetBinding<bool>(BindingNames.HasPublishing);\r\n                bool isSearchable = this.GetBinding<bool>(BindingNames.IsSearchable);\r\n                string keyFieldName = this.GetBinding<string>(BindingNames.KeyFieldName);\r\n                string labelFieldName = this.GetBinding<string>(BindingNames.LabelFieldName);\r\n                string internalUrlPrefix = this.GetBinding<string>(BindingNames.InternalUrlPrefix);\r\n                var dataFieldDescriptors = this.GetBinding<List<DataFieldDescriptor>>(BindingNames.DataFieldDescriptors);\r\n\r\n                var helper = new GeneratedTypesHelper(oldType);\r\n                bool hasLocalization = typeof(ILocalizedControlled).IsAssignableFrom(oldType);\r\n\r\n                string errorMessage;\r\n                if (!helper.ValidateNewTypeName(typeName, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(BindingNames.TypeName, errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeNamespace(typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(BindingNames.TypeNamespace, errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewTypeFullName(typeName, typeNamespace, out errorMessage))\r\n                {\r\n                    this.ShowFieldMessage(BindingNames.TypeName, errorMessage);\r\n                    return;\r\n                }\r\n\r\n                if (!helper.ValidateNewFieldDescriptors(dataFieldDescriptors, keyFieldName, out errorMessage))\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            Texts.EditInterfaceTypeStep1_ErrorTitle,\r\n                            errorMessage\r\n                        );\r\n                    return;\r\n                }\r\n\r\n\r\n                helper.SetNewTypeFullName(typeName, typeNamespace);\r\n                helper.SetNewTypeTitle(typeTitle);\r\n                helper.SetNewInternalUrlPrefix(internalUrlPrefix);\r\n\r\n                helper.SetNewFieldDescriptors(dataFieldDescriptors, keyFieldName, labelFieldName);\r\n\r\n                if (helper.IsEditProcessControlledAllowed)\r\n                {\r\n                    helper.SetCacheable(hasCaching);\r\n                    helper.SetSearchable(isSearchable);\r\n                    helper.SetPublishControlled(hasPublishing);\r\n                    helper.SetLocalizedControlled(hasLocalization);\r\n                }\r\n\r\n                bool originalTypeHasData = DataFacade.HasDataInAnyScope(oldType);\r\n\r\n                if (!helper.TryValidateUpdate(originalTypeHasData, out errorMessage))\r\n                {\r\n                    this.ShowMessage(\r\n                            DialogType.Warning,\r\n                            Texts.EditInterfaceTypeStep1_ErrorTitle,\r\n                            errorMessage\r\n                        );\r\n                    return;\r\n                }\r\n\r\n\r\n                if (!IsPageFolder)\r\n                {\r\n                    string oldSerializedTypeName = GetSerializedTypeName(GetBinding<string>(BindingNames.OldTypeNamespace), GetBinding<string>(BindingNames.OldTypeName));\r\n                    string newSerializedTypeName = GetSerializedTypeName(typeNamespace, typeName);\r\n                    if (newSerializedTypeName != oldSerializedTypeName)\r\n                    {\r\n                        UpdateWhiteListedGeneratedTypes(oldSerializedTypeName, newSerializedTypeName);\r\n                    }\r\n                }\r\n\r\n                helper.CreateType(originalTypeHasData);\r\n\r\n                UpdateBinding(BindingNames.OldTypeName, typeName);\r\n                UpdateBinding(BindingNames.OldTypeNamespace, typeNamespace);\r\n\r\n                SetSaveStatus(true);\r\n\r\n                var rootEntityToken = new GeneratedDataTypesElementProviderRootEntityToken(this.EntityToken.Source,\r\n                    IsPageFolder ? GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId\r\n                                 : GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId);\r\n\r\n                SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n                specificTreeRefresher.PostRefreshMesseges(rootEntityToken);\r\n\r\n                IFile markupFile = DynamicTypesAlternateFormFacade.GetAlternateFormMarkupFile(typeNamespace, typeName);\r\n                if (markupFile != null)\r\n                {\r\n                    ShowMessage(DialogType.Message,\r\n                        Texts.FormMarkupInfo_Dialog_Label,\r\n                        Texts.FormMarkupInfo_Message(Texts.EditFormMarkup, markupFile.GetRelativeFilePath()));\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(this.GetType().Name, ex);\r\n\r\n                this.ShowMessage(DialogType.Error, ex.Message, ex.Message);\r\n            }\r\n        }\r\n\r\n        private static void UpdateWhiteListedGeneratedTypes(string oldTypeName, string newTypeName)\r\n        {\r\n            var referencesToOldTypeName = DataFacade.GetData<IGeneratedTypeWhiteList>(item => item.TypeManagerTypeName == oldTypeName).ToList();\r\n            if (!referencesToOldTypeName.Any())\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (!DataFacade.GetData<IGeneratedTypeWhiteList>(item => item.TypeManagerTypeName == newTypeName).Any())\r\n            {\r\n                var newWhiteListItem = DataFacade.BuildNew<IGeneratedTypeWhiteList>();\r\n                newWhiteListItem.TypeManagerTypeName = newTypeName;\r\n\r\n                DataFacade.AddNew(newWhiteListItem);\r\n            }\r\n\r\n            DataFacade.Delete<IGeneratedTypeWhiteList>(referencesToOldTypeName);\r\n        }\r\n\r\n        private static string GetSerializedTypeName(string typeNamespace, string typeName)\r\n        {\r\n            return \"DynamicType:\" + (typeName.Length == 0 ? typeName : typeNamespace + \".\" + typeName);\r\n        }\r\n\r\n        private void codeActivity_refreshViewHandler(object sender, EventArgs e)\r\n        {\r\n            RerenderView();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EditInterfaceTypeWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"955, 547\" AutoSizeMargin=\"16, 24\" Location=\"30, 30\" Name=\"EditInterfaceTypeWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditInterfaceTypeWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditInterfaceTypeWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"214\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"214\" Y=\"66\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"66\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"139\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"139\" Y=\"413\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"initialStateActivity1\" TargetConnectionIndex=\"0\" SourceStateName=\"initialStateActivity1\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"267\" Y=\"149\" />\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"149\" />\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"177\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"177\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStep1StateEventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"291\" Y=\"271\" />\r\n\t\t\t\t<ns0:Point X=\"456\" Y=\"271\" />\r\n\t\t\t\t<ns0:Point X=\"456\" Y=\"339\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"562\" Y=\"383\" />\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"383\" />\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"177\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"177\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editState_IsSearchableChanged\" SourceConnectionIndex=\"2\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"274\" Y=\"297\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"297\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"177\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"177\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"212, 80\" AutoSizeMargin=\"16, 24\" Location=\"59, 105\" Name=\"initialStateActivity1\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150, 209\" Location=\"67, 138\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initialStateCodeActivity\" Size=\"130, 44\" Location=\"77, 203\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 62\" Location=\"77, 266\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"236, 136\" AutoSizeMargin=\"16, 24\" Location=\"59, 201\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150, 128\" Location=\"67, 234\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130, 44\" Location=\"77, 299\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"saveStep1StateEventDrivenActivity\" Size=\"150, 209\" Location=\"67, 260\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"77, 325\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 62\" Location=\"77, 388\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editState_IsSearchableChanged\" Size=\"150, 272\" Location=\"67, 286\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"customEvent01HandleExternalEventActivity1\" Size=\"130, 44\" Location=\"77, 351\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity_refreshView\" Size=\"130, 44\" Location=\"77, 414\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 62\" Location=\"77, 477\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"220, 80\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"346, 339\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 209\" Location=\"354, 372\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeStateCodeActivity\" Size=\"130, 44\" Location=\"364, 437\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 62\" Location=\"364, 500\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"59, 413\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150, 209\" Location=\"38, 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"48, 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 62\" Location=\"48, 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EnableTypeLocalizationWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Users;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EnableTypeLocalizationWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EnableTypeLocalizationWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            Type type;\r\n\r\n            if (this.EntityToken is AssociatedDataElementProviderHelperEntityToken)\r\n            {\r\n                var castedEntityToken = this.EntityToken as AssociatedDataElementProviderHelperEntityToken;\r\n\r\n                type = TypeManager.GetType(castedEntityToken.Payload);\r\n            }\r\n            else\r\n            {\r\n                var entityToken = (GeneratedDataTypesElementProviderTypeEntityToken)this.EntityToken;\r\n                type = TypeManager.GetType(entityToken.SerializedTypeName);\r\n            }\r\n\r\n            Guid guid = type.GetImmutableTypeId();\r\n\r\n            return DataMetaDataFacade.GetDataTypeDescriptor(guid);\r\n        }\r\n\r\n\r\n\r\n        private void LocalesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = DataLocalizationFacade.ActiveLocalizationCultures.Any();\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var culturesDictionary = DataLocalizationFacade.ActiveLocalizationCultures.ToDictionary(f => f.Name, DataLocalizationFacade.GetCultureTitle);\r\n\r\n            this.UpdateBinding(\"CultureName\", (UserSettings.ForeignLocaleCultureInfo ?? UserSettings.ActiveLocaleCultureInfo).Name);\r\n            this.UpdateBinding(\"CultureNameList\", culturesDictionary);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            // Making changes to type\r\n            DataTypeDescriptor newDataTypeDescriptor = dataTypeDescriptor.Clone();\r\n            newDataTypeDescriptor.AddSuperInterface(typeof(ILocalizedControlled));\r\n\r\n            List<CultureInfo> localesToCopyTo = new List<CultureInfo>();\r\n            if (ThereAreReferencesInLocalizedData())\r\n            {\r\n                localesToCopyTo.AddRange(DataLocalizationFacade.ActiveLocalizationCultures);\r\n            }\r\n            else\r\n            {\r\n                string cultureName = this.GetBinding<string>(\"CultureName\");\r\n                localesToCopyTo.Add(CultureInfo.CreateSpecificCulture(cultureName));\r\n            }\r\n\r\n            var updateDataTypeDescriptor = new UpdateDataTypeDescriptor(dataTypeDescriptor, newDataTypeDescriptor, false)\r\n            {\r\n                LocalesToCopyTo = localesToCopyTo\r\n            };\r\n\r\n            GeneratedTypesFacade.UpdateType(updateDataTypeDescriptor);\r\n\r\n            this.CloseCurrentView();\r\n            this.CollapseAndRefresh();\r\n        }\r\n\r\n        private bool ThereAreReferencesInLocalizedData()\r\n        {\r\n            if (DataLocalizationFacade.ActiveLocalizationCultures.Count() == 1)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            Type type = GetDataTypeDescriptor().GetInterfaceType();\r\n\r\n            return type.GetRefereeTypes().Any(DataLocalizationFacade.IsLocalized);\r\n        }\r\n\r\n        private void ThereAreReferencesInLocalizedData(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = ThereAreReferencesInLocalizedData();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EnableTypeLocalizationWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class EnableTypeLocalizationWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.NoReferencesInLocalizedDataActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ThereAreReferencesInLocalizedDataActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.noLocalesDataDialogFormActivity = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previousHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.step1CodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.initializeIfElseActivity_LocalesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.eventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.noLocalesEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.noLocalesStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.referencesExistsStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.noLocalesStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"referencesExistsStateActivity\";\r\n            // \r\n            // NoReferencesInLocalizedDataActivity3\r\n            // \r\n            this.NoReferencesInLocalizedDataActivity3.Activities.Add(this.setStateActivity6);\r\n            this.NoReferencesInLocalizedDataActivity3.Name = \"NoReferencesInLocalizedDataActivity3\";\r\n            // \r\n            // ThereAreReferencesInLocalizedDataActivity4\r\n            // \r\n            this.ThereAreReferencesInLocalizedDataActivity4.Activities.Add(this.setStateActivity10);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ThereAreReferencesInLocalizedData);\r\n            this.ThereAreReferencesInLocalizedDataActivity4.Condition = codecondition1;\r\n            this.ThereAreReferencesInLocalizedDataActivity4.Name = \"ThereAreReferencesInLocalizedDataActivity4\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"noLocalesStateActivity\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ThereAreReferencesInLocalizedDataActivity4);\r\n            this.ifElseActivity1.Activities.Add(this.NoReferencesInLocalizedDataActivity3);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity8);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.ifElseActivity1);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.LocalesExists);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity4\r\n            // \r\n            this.cancelHandleExternalEventActivity4.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity4.Name = \"cancelHandleExternalEventActivity4\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"/Administrative/EnableTypeLocalizationStep3.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // noLocalesDataDialogFormActivity\r\n            // \r\n            this.noLocalesDataDialogFormActivity.ContainerLabel = null;\r\n            this.noLocalesDataDialogFormActivity.FormDefinitionFileName = \"/Administrative/EnableTypeLocalizationNoLocales.xml\";\r\n            this.noLocalesDataDialogFormActivity.Name = \"noLocalesDataDialogFormActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // previousHandleExternalEventActivity1\r\n            // \r\n            this.previousHandleExternalEventActivity1.EventName = \"Previous\";\r\n            this.previousHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previousHandleExternalEventActivity1.Name = \"previousHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"/Administrative/EnableTypeLocalizationStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"/Administrative/EnableTypeLocalizationStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // step1CodeActivity_Initialize\r\n            // \r\n            this.step1CodeActivity_Initialize.Name = \"step1CodeActivity_Initialize\";\r\n            this.step1CodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.step1CodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // initializeIfElseActivity_LocalesExists\r\n            // \r\n            this.initializeIfElseActivity_LocalesExists.Activities.Add(this.ifElseBranchActivity1);\r\n            this.initializeIfElseActivity_LocalesExists.Activities.Add(this.ifElseBranchActivity2);\r\n            this.initializeIfElseActivity_LocalesExists.Name = \"initializeIfElseActivity_LocalesExists\";\r\n            // \r\n            // eventDrivenActivity_Cancel\r\n            // \r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity4);\r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity12);\r\n            this.eventDrivenActivity_Cancel.Name = \"eventDrivenActivity_Cancel\";\r\n            // \r\n            // eventDrivenActivity_Next\r\n            // \r\n            this.eventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.eventDrivenActivity_Next.Activities.Add(this.setStateActivity11);\r\n            this.eventDrivenActivity_Next.Name = \"eventDrivenActivity_Next\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.wizardFormActivity1);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // noLocalesEventDrivenActivity_Finish\r\n            // \r\n            this.noLocalesEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.noLocalesEventDrivenActivity_Finish.Activities.Add(this.setStateActivity9);\r\n            this.noLocalesEventDrivenActivity_Finish.Name = \"noLocalesEventDrivenActivity_Finish\";\r\n            // \r\n            // noLocalesStateInitializationActivity\r\n            // \r\n            this.noLocalesStateInitializationActivity.Activities.Add(this.noLocalesDataDialogFormActivity);\r\n            this.noLocalesStateInitializationActivity.Name = \"noLocalesStateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Previous\r\n            // \r\n            this.step2EventDrivenActivity_Previous.Activities.Add(this.previousHandleExternalEventActivity1);\r\n            this.step2EventDrivenActivity_Previous.Activities.Add(this.setStateActivity7);\r\n            this.step2EventDrivenActivity_Previous.Name = \"step2EventDrivenActivity_Previous\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Finish\r\n            // \r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.step2EventDrivenActivity_Finish.Name = \"step2EventDrivenActivity_Finish\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2WizardFormActivity);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1CodeActivity_Initialize);\r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_LocalesExists);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // referencesExistsStateActivity\r\n            // \r\n            this.referencesExistsStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.referencesExistsStateActivity.Activities.Add(this.eventDrivenActivity_Next);\r\n            this.referencesExistsStateActivity.Activities.Add(this.eventDrivenActivity_Cancel);\r\n            this.referencesExistsStateActivity.Name = \"referencesExistsStateActivity\";\r\n            // \r\n            // noLocalesStateActivity\r\n            // \r\n            this.noLocalesStateActivity.Activities.Add(this.noLocalesStateInitializationActivity);\r\n            this.noLocalesStateActivity.Activities.Add(this.noLocalesEventDrivenActivity_Finish);\r\n            this.noLocalesStateActivity.Name = \"noLocalesStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Finish);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Previous);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EnableTypeLocalizationWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.noLocalesStateActivity);\r\n            this.Activities.Add(this.referencesExistsStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EnableTypeLocalizationWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step2EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step2StateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity previousHandleExternalEventActivity1;\r\n        private CodeActivity step1CodeActivity_Initialize;\r\n        private EventDrivenActivity step2EventDrivenActivity_Previous;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity noLocalesDataDialogFormActivity;\r\n        private IfElseActivity initializeIfElseActivity_LocalesExists;\r\n        private StateInitializationActivity noLocalesStateInitializationActivity;\r\n        private StateActivity noLocalesStateActivity;\r\n        private SetStateActivity setStateActivity9;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private EventDrivenActivity noLocalesEventDrivenActivity_Finish;\r\n        private StateActivity referencesExistsStateActivity;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private SetStateActivity setStateActivity8;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ThereAreReferencesInLocalizedDataActivity4;\r\n        private IfElseBranchActivity NoReferencesInLocalizedDataActivity3;\r\n        private IfElseActivity ifElseActivity1;\r\n        private SetStateActivity setStateActivity10;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_Next;\r\n        private SetStateActivity setStateActivity11;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity12;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity4;\r\n        private EventDrivenActivity eventDrivenActivity_Cancel;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/EnableTypeLocalizationWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EnableTypeLocalizationWorkflow\" Location=\"30; 30\" Size=\"1079; 914\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EnableTypeLocalizationWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EnableTypeLocalizationWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"834\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"noLocalesStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"noLocalesStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"456\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"456\" Y=\"491\" />\r\n\t\t\t\t<ns0:Point X=\"220\" Y=\"491\" />\r\n\t\t\t\t<ns0:Point X=\"220\" Y=\"570\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"343\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"343\" Y=\"345\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"referencesExistsStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"referencesExistsStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"195\" />\r\n\t\t\t\t<ns0:Point X=\"637\" Y=\"195\" />\r\n\t\t\t\t<ns0:Point X=\"637\" Y=\"203\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"435\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"546\" Y=\"410\" />\r\n\t\t\t\t<ns0:Point X=\"546\" Y=\"503\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"445\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"434\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"834\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"639\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"811\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"811\" Y=\"670\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"643\" Y=\"592\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"592\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"834\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"3\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Previous\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"652\" Y=\"616\" />\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"616\" />\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"337\" />\r\n\t\t\t\t<ns0:Point X=\"343\" Y=\"337\" />\r\n\t\t\t\t<ns0:Point X=\"343\" Y=\"345\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceStateName=\"noLocalesStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"noLocalesStateActivity\" EventHandlerName=\"noLocalesEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"331\" Y=\"635\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"635\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"834\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceStateName=\"referencesExistsStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"referencesExistsStateActivity\" EventHandlerName=\"eventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"715\" Y=\"268\" />\r\n\t\t\t\t<ns0:Point X=\"738\" Y=\"268\" />\r\n\t\t\t\t<ns0:Point X=\"738\" Y=\"491\" />\r\n\t\t\t\t<ns0:Point X=\"546\" Y=\"491\" />\r\n\t\t\t\t<ns0:Point X=\"546\" Y=\"503\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity12\" SourceStateName=\"referencesExistsStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"referencesExistsStateActivity\" EventHandlerName=\"eventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"725\" Y=\"292\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"292\" />\r\n\t\t\t\t<ns0:Point X=\"991\" Y=\"834\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 197\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"612; 496\" Name=\"initializeStateInitializationActivity\" Location=\"112; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 415\" Name=\"initializeIfElseActivity_LocalesExists\" Location=\"122; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 315\" Name=\"ifElseBranchActivity1\" Location=\"141; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 234\" Name=\"ifElseActivity1\" Location=\"151; 343\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 134\" Name=\"ThereAreReferencesInLocalizedDataActivity4\" Location=\"170; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity10\" Location=\"180; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 134\" Name=\"NoReferencesInLocalizedDataActivity3\" Location=\"343; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"353; 482\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 315\" Name=\"ifElseBranchActivity2\" Location=\"545; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"555; 440\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"904; 834\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"238; 345\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"step1StateInitializationActivity\" Location=\"246; 376\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_Initialize\" Location=\"256; 438\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizardFormActivity\" Location=\"256; 498\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Next\" Location=\"246; 400\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity1\" Location=\"256; 462\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"256; 522\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"246; 424\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"256; 486\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"256; 546\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step2StateActivity\" Location=\"436; 503\" Size=\"220; 126\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step2StateInitializationActivity\" Location=\"444; 534\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2WizardFormActivity\" Location=\"454; 596\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2EventDrivenActivity_Finish\" Location=\"444; 558\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"454; 620\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"454; 680\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2EventDrivenActivity_Cancel\" Location=\"444; 582\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"454; 644\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"454; 704\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2EventDrivenActivity_Previous\" Location=\"444; 606\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"previousHandleExternalEventActivity1\" Location=\"454; 668\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"454; 728\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"709; 670\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"finalizeStateInitializationActivity\" Location=\"717; 701\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"727; 763\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"noLocalesStateActivity\" Location=\"106; 570\" Size=\"229; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"noLocalesStateInitializationActivity\" Location=\"114; 601\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"noLocalesDataDialogFormActivity\" Location=\"124; 663\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"noLocalesEventDrivenActivity_Finish\" Location=\"114; 625\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"124; 687\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"124; 747\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"referencesExistsStateActivity\" Location=\"546; 203\" Size=\"183; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"stateInitializationActivity1\" Location=\"554; 234\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizardFormActivity1\" Location=\"564; 296\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"eventDrivenActivity_Next\" Location=\"554; 258\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity2\" Location=\"564; 320\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity11\" Location=\"564; 380\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"eventDrivenActivity_Cancel\" Location=\"554; 282\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity4\" Location=\"564; 344\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity12\" Location=\"564; 404\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/LocalizeDataWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Transactions;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_GeneratedDataTypesElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    public sealed partial class LocalizeDataWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n\r\n        public LocalizeDataWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void ValidateLocalizeProcess(object sender, ConditionalEventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            ILocalizedControlled data = dataEntityToken.Data as ILocalizedControlled;\r\n\r\n            IEnumerable<ReferenceFailingPropertyInfo> referenceFailingPropertyInfos = DataLocalizationFacade.GetReferencingLocalizeFailingProperties(data).Evaluate();\r\n\r\n            if (referenceFailingPropertyInfos.Any(f => f.OptionalReferenceWithValue == false))\r\n            {\r\n                List<string> row = new List<string>();\r\n\r\n                row.Add(Texts.LocalizeDataWorkflow_ShowError_Description);\r\n\r\n                foreach (ReferenceFailingPropertyInfo referenceFailingPropertyInfo in referenceFailingPropertyInfos.Where(f => f.OptionalReferenceWithValue == false))\r\n                {\r\n                    row.Add(Texts.LocalizeDataWorkflow_ShowError_FieldErrorFormat( \r\n                        referenceFailingPropertyInfo.DataFieldDescriptor.Name, \r\n                        referenceFailingPropertyInfo.ReferencedType.GetTypeTitle(), \r\n                        referenceFailingPropertyInfo.OriginLocaleDataValue.GetLabel()));\r\n                }\r\n\r\n                List<List<string>> rows = new List<List<string>> { row };\r\n\r\n                this.UpdateBinding(\"ErrorHeader\", new List<string> { \"Fields\" });\r\n                this.UpdateBinding(\"Errors\", rows);\r\n\r\n                e.Result = false;\r\n            }\r\n            else\r\n            {\r\n                e.Result = true;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void localizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            ILocalizedControlled data = dataEntityToken.Data as ILocalizedControlled;\r\n\r\n            CultureInfo targetCultureInfo = UserSettings.ActiveLocaleCultureInfo;\r\n\r\n            if (ExistsInLocale(data, targetCultureInfo))\r\n            {\r\n                string title = Texts.LocalizeDataWorkflow_ShowError_LayoutLabel;\r\n                string description = Texts.LocalizeDataWorkflow_ShowError_AlreadyTranslated;\r\n\r\n                var messageBox = new MessageBoxMessageQueueItem\r\n                                     {\r\n                                         DialogType = DialogType.Message,\r\n                                         Message = description,\r\n                                         Title = title\r\n                                     };\r\n\r\n                ConsoleMessageQueueFacade.Enqueue(messageBox, GetCurrentConsoleId());\r\n                return;\r\n            }\r\n\r\n            IEnumerable<ReferenceFailingPropertyInfo> referenceFailingPropertyInfos = DataLocalizationFacade.GetReferencingLocalizeFailingProperties(data).Evaluate();\r\n\r\n            IData newData;\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                data = data.GetTranslationSource();\r\n\r\n                using (new DataScope(targetCultureInfo))\r\n                {\r\n                    newData = DataFacade.BuildNew(data.DataSourceId.InterfaceType);\r\n\r\n                    data.ProjectedCopyTo(newData);\r\n\r\n                    ILocalizedControlled localizedControlled = newData as ILocalizedControlled;\r\n                    localizedControlled.SourceCultureName = targetCultureInfo.Name;\r\n\r\n                    if (newData is IPublishControlled)\r\n                    {\r\n                        IPublishControlled publishControlled = newData as IPublishControlled;\r\n                        publishControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n                    }\r\n\r\n                    foreach (ReferenceFailingPropertyInfo referenceFailingPropertyInfo in referenceFailingPropertyInfos)\r\n                    {\r\n                        PropertyInfo propertyInfo = data.DataSourceId.InterfaceType.GetPropertiesRecursively().Single(f => f.Name == referenceFailingPropertyInfo.DataFieldDescriptor.Name);\r\n                        if (propertyInfo.PropertyType.IsGenericType &&\r\n                            propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n                        {\r\n                            propertyInfo.SetValue(newData, null, null);\r\n                        }\r\n                        else if (propertyInfo.PropertyType == typeof(string))\r\n                        {\r\n                            propertyInfo.SetValue(newData, null, null);\r\n                        }\r\n                        else\r\n                        {\r\n                            propertyInfo.SetValue(newData, referenceFailingPropertyInfo.DataFieldDescriptor.DefaultValue.Value, null);\r\n                        }\r\n                    }\r\n\r\n                    newData = DataFacade.AddNew(newData, false, false, true);\r\n                }\r\n\r\n                EntityTokenCacheFacade.ClearCache(data.GetDataEntityToken());\r\n                EntityTokenCacheFacade.ClearCache(newData.GetDataEntityToken());\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(newData.GetDataEntityToken());\r\n\r\n            if (this.Payload == \"Global\")\r\n            {\r\n                this.ExecuteWorklow(newData.GetDataEntityToken(), typeof(EditDataWorkflow));\r\n            }\r\n            else if (this.Payload == \"Pagefolder\")\r\n            {\r\n                this.ExecuteWorklow(newData.GetDataEntityToken(), WorkflowFacade.GetWorkflowType(\"Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.EditAssociatedDataWorkflow\"));\r\n            }\r\n        }\r\n\r\n        private static bool ExistsInLocale(IData data, CultureInfo locale)\r\n        {\r\n            Type dataType = data.DataSourceId.InterfaceType;\r\n\r\n            MethodInfo method = StaticReflection.GetGenericMethodInfo(a => DataFacade.GetDataFromOtherLocale((IData)null, null))\r\n                                                .MakeGenericMethod(new[] { dataType });\r\n\r\n            object result = method.Invoke(null, new object[] { data, locale });\r\n\r\n            if (result == null) return false;\r\n\r\n            var enumerable = result as IEnumerable<object>;\r\n            Verify.IsNotNull(enumerable, \"Enumeration expected\");\r\n\r\n            return enumerable.Any();\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/LocalizeDataWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class LocalizeDataWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.localizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity_ValidateLocalizeProcess = new System.Workflow.Activities.IfElseActivity();\r\n            this.showErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showErrorEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.localizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.showErrorStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.localizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"localizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateLocalizeProcess);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\LocalizeData.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // localizeCodeActivity\r\n            // \r\n            this.localizeCodeActivity.Name = \"localizeCodeActivity\";\r\n            this.localizeCodeActivity.ExecuteCode += new System.EventHandler(this.localizeCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseActivity_ValidateLocalizeProcess\r\n            // \r\n            this.ifElseActivity_ValidateLocalizeProcess.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity_ValidateLocalizeProcess.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity_ValidateLocalizeProcess.Name = \"ifElseActivity_ValidateLocalizeProcess\";\r\n            // \r\n            // showErrorStateInitializationActivity\r\n            // \r\n            this.showErrorStateInitializationActivity.Activities.Add(this.wizardFormActivity1);\r\n            this.showErrorStateInitializationActivity.Name = \"showErrorStateInitializationActivity\";\r\n            // \r\n            // showErrorEventDrivenActivity_Finish\r\n            // \r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.showErrorEventDrivenActivity_Finish.Name = \"showErrorEventDrivenActivity_Finish\";\r\n            // \r\n            // localizeStateInitializationActivity\r\n            // \r\n            this.localizeStateInitializationActivity.Activities.Add(this.localizeCodeActivity);\r\n            this.localizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.localizeStateInitializationActivity.Name = \"localizeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity_ValidateLocalizeProcess);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // showErrorStateActivity\r\n            // \r\n            this.showErrorStateActivity.Activities.Add(this.showErrorEventDrivenActivity_Finish);\r\n            this.showErrorStateActivity.Activities.Add(this.showErrorStateInitializationActivity);\r\n            this.showErrorStateActivity.Name = \"showErrorStateActivity\";\r\n            // \r\n            // localizeStateActivity\r\n            // \r\n            this.localizeStateActivity.Activities.Add(this.localizeStateInitializationActivity);\r\n            this.localizeStateActivity.Name = \"localizeStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // LocalizeDataWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.localizeStateActivity);\r\n            this.Activities.Add(this.showErrorStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"LocalizeDataWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private CodeActivity localizeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity localizeStateInitializationActivity;\r\n        private StateActivity localizeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity_ValidateLocalizeProcess;\r\n        private EventDrivenActivity showErrorEventDrivenActivity_Finish;\r\n        private StateActivity showErrorStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private StateInitializationActivity showErrorStateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/LocalizeDataWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1146; 986\" AutoSizeMargin=\"16; 24\" Location=\"30; 30\" Name=\"LocalizeDataWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 303\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity_ValidateLocalizeProcess\" Size=\"361; 222\" Location=\"108; 231\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"127; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"137; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"300; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"310; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"207; 80\" AutoSizeMargin=\"16; 24\" Location=\"330; 388\" Name=\"localizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"localizeStateInitializationActivity\" Size=\"150; 182\" Location=\"338; 419\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"localizeCodeActivity\" Size=\"130; 41\" Location=\"348; 481\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"348; 541\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"230; 80\" AutoSizeMargin=\"16; 24\" Location=\"233; 576\" Name=\"showErrorStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<EventDrivenDesigner Name=\"showErrorEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"241; 631\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"251; 693\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"251; 753\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<StateInitializationDesigner Name=\"showErrorStateInitializationActivity\" Size=\"150; 122\" Location=\"241; 607\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"251; 669\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"LocalizeDataWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"LocalizeDataWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"localizeStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"localizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"388\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"showErrorStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"564\" />\r\n\t\t\t\t<ns0:Point X=\"348\" Y=\"564\" />\r\n\t\t\t\t<ns0:Point X=\"348\" Y=\"576\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"localizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"localizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"localizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"533\" Y=\"429\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"429\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"showErrorStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"showErrorStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"showErrorEventDrivenActivity_Finish\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"459\" Y=\"641\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"641\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/RemoveTypeFromWhiteListWorkflow.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    public sealed partial class RemoveTypeFromWhiteListWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public RemoveTypeFromWhiteListWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            GeneratedDataTypesElementProviderTypeEntityToken castedEntityToken = (GeneratedDataTypesElementProviderTypeEntityToken)this.EntityToken;\r\n\r\n            DataFacade.Delete<IGeneratedTypeWhiteList>(f => f.TypeManagerTypeName == castedEntityToken.SerializedTypeName);\r\n\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(this.EntityToken, 3);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/RemoveTypeFromWhiteListWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.GeneratedDataTypesElementProvider\r\n{\r\n    partial class RemoveTypeFromWhiteListWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // RemoveTypeFromWhiteListWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"RemoveTypeFromWhiteListWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/GeneratedDataTypesElementProvider/RemoveTypeFromWhiteListWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"RemoveTypeFromWhiteListWorkflow\" Location=\"30; 30\" Size=\"1183; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"RemoveTypeFromWhiteListWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"RemoveTypeFromWhiteListWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"341\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"563\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"362; 341\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"546; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"556; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"556; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/AddSystemLocaleWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddSystemLocaleWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddSystemLocaleWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void HasAnyWhiteListedLocales(object sender, ConditionalEventArgs e)\r\n        {\r\n            List<string> alreadyAddedCultureNames =\r\n                (from d in DataFacade.GetData<ISystemActiveLocale>()\r\n                 select d.CultureName).ToList();\r\n\r\n            IEnumerable<CultureInfo> cultures =\r\n                from cul in DataLocalizationFacade.WhiteListedLocales\r\n                where !alreadyAddedCultureNames.Contains(cul.Name)\r\n                orderby cul.DisplayName\r\n                select cul;\r\n\r\n            e.Result = cultures.Any();\r\n        }\r\n\r\n\r\n\r\n        private void UrlMappingNameInUse(object sender, ConditionalEventArgs e)\r\n        {\r\n            string urlMappingName = this.GetBinding<string>(\"UrlMappingName\");\r\n\r\n            e.Result = LocalizationFacade.IsUrlMappingNameInUse(urlMappingName);\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<string> alreadyAddedCultureNames =\r\n                (from d in DataFacade.GetData<ISystemActiveLocale>()\r\n                 select d.CultureName).ToList();\r\n\r\n            IEnumerable<CultureInfo> cultures =\r\n                from cul in DataLocalizationFacade.WhiteListedLocales\r\n                where alreadyAddedCultureNames.Contains(cul.Name) == false\r\n                orderby cul.DisplayName\r\n                select cul;\r\n\r\n            var culturesDictionary = cultures.ToDictionary(f => f.Name, DataLocalizationFacade.GetCultureTitle);\r\n\r\n            this.Bindings = new Dictionary<string, object>\r\n            {\r\n                {\"CultureName\", \"\"},\r\n                {\"RegionLanguageList\", culturesDictionary},\r\n                {\"UrlMappingName\", \"\"},\r\n                {\"AccessToAllUsers\", true}\r\n            };\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string cultureName = this.GetBinding<string>(\"CultureName\");\r\n            string urlMappingName = this.GetBinding<string>(\"UrlMappingName\");\r\n            bool accessToAllUsers = this.GetBinding<bool>(\"AccessToAllUsers\");\r\n\r\n            LocalizationFacade.AddLocale(cultureName, urlMappingName, accessToAllUsers);\r\n\r\n            this.CloseCurrentView();\r\n\r\n            ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem { Name = \"LocalesUpdated\", Value = \"\" }, null);\r\n\r\n\r\n            var specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n\r\n            var newLocaleDataItem = DataFacade.GetData<ISystemActiveLocale>().FirstOrDefault(l => l.CultureName == cultureName);\r\n\r\n            if (newLocaleDataItem != null)\r\n            {\r\n                SelectElement(newLocaleDataItem.GetDataEntityToken());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void updateRulMappingNameCodeActivity_Update_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string urlMappingName = GetDefaultUrlMappingNameFromCultureName( this.GetBinding<string>(\"CultureName\") );\r\n\r\n            this.UpdateBinding(\"UrlMappingName\", urlMappingName);\r\n        }\r\n\r\n\r\n\r\n        private string GetDefaultUrlMappingNameFromCultureName(string cultureName)\r\n        {\r\n            string urlMappingName = cultureName;\r\n            if (urlMappingName.Contains(\"-\"))\r\n            {\r\n                urlMappingName = urlMappingName.Substring(0, urlMappingName.IndexOf(\"-\", StringComparison.Ordinal));\r\n            }\r\n            return urlMappingName;\r\n        }\r\n\r\n\r\n\r\n        private void codeActivity_ShowBalloon_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowFieldMessage(\"UrlMappingName\", StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"AddSystemLocaleWorkflow.UrlMappingName.InUseMessage\"));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/AddSystemLocaleWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    partial class AddSystemLocaleWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity_ShowBalloon = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showConsoleMessageBoxActivity1 = new Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.rerenderViewActivity1 = new Composite.C1Console.Workflow.Activities.RerenderViewActivity();\r\n            this.updateRulMappingNameCodeActivity_Update = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.customEvent01HandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElse_UrlMappingNameInUse = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1DataDialogFormActivity = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.ifElseActivity_HasAnyWhiteListedLocales = new System.Workflow.Activities.IfElseActivity();\r\n            this.updateUrlMappingNameStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_SelectionChange = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Ok = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.updateUrlMappingNameStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // codeActivity_ShowBalloon\r\n            // \r\n            this.codeActivity_ShowBalloon.Name = \"codeActivity_ShowBalloon\";\r\n            this.codeActivity_ShowBalloon.ExecuteCode += new System.EventHandler(this.codeActivity_ShowBalloon_ExecuteCode);\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // showConsoleMessageBoxActivity1\r\n            // \r\n            this.showConsoleMessageBoxActivity1.DialogType = Composite.C1Console.Events.DialogType.Warning;\r\n            this.showConsoleMessageBoxActivity1.Message = \"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.\" +\r\n                \"NoMoreLocalesMessage}\";\r\n            this.showConsoleMessageBoxActivity1.Name = \"showConsoleMessageBoxActivity1\";\r\n            this.showConsoleMessageBoxActivity1.Title = \"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.\" +\r\n                \"NoMoreLocalesTitle}\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.codeActivity_ShowBalloon);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.UrlMappingNameInUse);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.showConsoleMessageBoxActivity1);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity8);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasAnyWhiteListedLocales);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // rerenderViewActivity1\r\n            // \r\n            this.rerenderViewActivity1.Name = \"rerenderViewActivity1\";\r\n            // \r\n            // updateRulMappingNameCodeActivity_Update\r\n            // \r\n            this.updateRulMappingNameCodeActivity_Update.Name = \"updateRulMappingNameCodeActivity_Update\";\r\n            this.updateRulMappingNameCodeActivity_Update.ExecuteCode += new System.EventHandler(this.updateRulMappingNameCodeActivity_Update_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"updateUrlMappingNameStateActivity\";\r\n            // \r\n            // customEvent01HandleExternalEventActivity1\r\n            // \r\n            this.customEvent01HandleExternalEventActivity1.EventName = \"CustomEvent01\";\r\n            this.customEvent01HandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.customEvent01HandleExternalEventActivity1.Name = \"customEvent01HandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElse_UrlMappingNameInUse\r\n            // \r\n            this.ifElse_UrlMappingNameInUse.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElse_UrlMappingNameInUse.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElse_UrlMappingNameInUse.Name = \"ifElse_UrlMappingNameInUse\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1DataDialogFormActivity\r\n            // \r\n            this.step1DataDialogFormActivity.ContainerLabel = null;\r\n            this.step1DataDialogFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\AddSystemLocaleStep1.xml\";\r\n            this.step1DataDialogFormActivity.Name = \"step1DataDialogFormActivity\";\r\n            // \r\n            // ifElseActivity_HasAnyWhiteListedLocales\r\n            // \r\n            this.ifElseActivity_HasAnyWhiteListedLocales.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity_HasAnyWhiteListedLocales.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity_HasAnyWhiteListedLocales.Name = \"ifElseActivity_HasAnyWhiteListedLocales\";\r\n            // \r\n            // updateUrlMappingNameStateInitializationActivity\r\n            // \r\n            this.updateUrlMappingNameStateInitializationActivity.Activities.Add(this.updateRulMappingNameCodeActivity_Update);\r\n            this.updateUrlMappingNameStateInitializationActivity.Activities.Add(this.rerenderViewActivity1);\r\n            this.updateUrlMappingNameStateInitializationActivity.Activities.Add(this.setStateActivity7);\r\n            this.updateUrlMappingNameStateInitializationActivity.Name = \"updateUrlMappingNameStateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_SelectionChange\r\n            // \r\n            this.step1EventDrivenActivity_SelectionChange.Activities.Add(this.customEvent01HandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_SelectionChange.Activities.Add(this.setStateActivity6);\r\n            this.step1EventDrivenActivity_SelectionChange.Name = \"step1EventDrivenActivity_SelectionChange\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Ok\r\n            // \r\n            this.step1EventDrivenActivity_Ok.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Ok.Activities.Add(this.ifElse_UrlMappingNameInUse);\r\n            this.step1EventDrivenActivity_Ok.Name = \"step1EventDrivenActivity_Ok\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1DataDialogFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity_HasAnyWhiteListedLocales);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // updateUrlMappingNameStateActivity\r\n            // \r\n            this.updateUrlMappingNameStateActivity.Activities.Add(this.updateUrlMappingNameStateInitializationActivity);\r\n            this.updateUrlMappingNameStateActivity.Name = \"updateUrlMappingNameStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Ok);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_SelectionChange);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddSystemLocaleWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.updateUrlMappingNameStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddSystemLocaleWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity step1DataDialogFormActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Ok;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private SetStateActivity setStateActivity7;\r\n        private CodeActivity updateRulMappingNameCodeActivity_Update;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity customEvent01HandleExternalEventActivity1;\r\n        private StateInitializationActivity updateUrlMappingNameStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_SelectionChange;\r\n        private StateActivity updateUrlMappingNameStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.RerenderViewActivity rerenderViewActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity_HasAnyWhiteListedLocales;\r\n        private SetStateActivity setStateActivity8;\r\n        private Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity showConsoleMessageBoxActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElse_UrlMappingNameInUse;\r\n        private CodeActivity codeActivity_ShowBalloon;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/AddSystemLocaleWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddSystemLocaleWorkflow\" Location=\"30; 30\" Size=\"1146; 878\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddSystemLocaleWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddSystemLocaleWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"389\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"389\" Y=\"371\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Ok\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"447\" Y=\"436\" />\r\n\t\t\t\t<ns0:Point X=\"741\" Y=\"436\" />\r\n\t\t\t\t<ns0:Point X=\"741\" Y=\"529\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"466\" Y=\"460\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"460\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"updateUrlMappingNameStateActivity\" SourceConnectionIndex=\"3\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"updateUrlMappingNameStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_SelectionChange\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"516\" Y=\"484\" />\r\n\t\t\t\t<ns0:Point X=\"943\" Y=\"484\" />\r\n\t\t\t\t<ns0:Point X=\"943\" Y=\"237\" />\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"237\" />\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"245\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"840\" Y=\"570\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"570\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"updateUrlMappingNameStateActivity\" SourceConnectionEdge=\"Left\" TargetActivity=\"step1StateActivity\" SourceActivity=\"updateUrlMappingNameStateActivity\" EventHandlerName=\"updateUrlMappingNameStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"595\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"389\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"389\" Y=\"371\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 363\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity_HasAnyWhiteListedLocales\" Location=\"108; 231\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"127; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"137; 364\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"137; 424\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity2\" Location=\"300; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showConsoleMessageBoxActivity1\" Location=\"310; 364\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"310; 424\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"259; 371\" Size=\"261; 126\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"267; 402\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1DataDialogFormActivity\" Location=\"277; 464\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 363\" Name=\"step1EventDrivenActivity_Ok\" Location=\"267; 426\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"392; 488\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElse_UrlMappingNameInUse\" Location=\"277; 548\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity3\" Location=\"296; 619\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity_ShowBalloon\" Location=\"306; 681\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity4\" Location=\"469; 619\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"479; 681\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"267; 450\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"277; 512\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"277; 572\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_SelectionChange\" Location=\"267; 474\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"customEvent01HandleExternalEventActivity1\" Location=\"277; 536\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"277; 596\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"639; 529\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"338; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"348; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"348; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"updateUrlMappingNameStateActivity\" Location=\"591; 245\" Size=\"290; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"updateUrlMappingNameStateInitializationActivity\" Location=\"599; 276\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"updateRulMappingNameCodeActivity_Update\" Location=\"609; 338\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"rerenderViewActivity1\" Location=\"609; 398\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"609; 458\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/DefineDefaultActiveLocaleWorkflow.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Localization;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DefineDefaultActiveLocaleWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DefineDefaultActiveLocaleWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }      \r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            ISystemActiveLocale systemActiveLocale = (ISystemActiveLocale)dataEntityToken.Data;\r\n\r\n            CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(systemActiveLocale.CultureName);\r\n\r\n            if (LocalizationFacade.SetDefaultLocale(cultureInfo))\r\n            {\r\n                ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n                parentTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n            }\r\n        }        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/DefineDefaultActiveLocaleWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    partial class DefineDefaultActiveLocaleWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DefineDefaultActiveLocaleWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DefineDefaultActiveLocaleWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/DefineDefaultActiveLocaleWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DefineDefaultActiveLocaleWorkflow\" Location=\"30; 30\" Size=\"1146; 980\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DefineDefaultActiveLocaleWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DefineDefaultActiveLocaleWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"662\" Y=\"481\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"481\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"563\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"563\" Y=\"440\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"461; 440\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"469; 471\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"479; 533\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"479; 593\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/EditSystemLocaleWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Localization;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditSystemLocaleWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditSystemLocaleWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void UrlMappingNameInUse(object sender, ConditionalEventArgs e)\r\n        {\r\n            ISystemActiveLocale systemActiveLocale = this.GetBinding<ISystemActiveLocale>(\"SystemActiveLocale\");\r\n\r\n            e.Result = LocalizationFacade.IsUrlMappingNameInUse(systemActiveLocale.CultureName, systemActiveLocale.UrlMappingName);\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            ISystemActiveLocale systemActiveLocale = (ISystemActiveLocale)dataEntityToken.Data;\r\n\r\n            this.Bindings.Add(\"SystemActiveLocale\", systemActiveLocale);\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ISystemActiveLocale systemActiveLocale = this.GetBinding<ISystemActiveLocale>(\"SystemActiveLocale\");\r\n\r\n            DataFacade.Update(systemActiveLocale);\r\n            \r\n            SetSaveStatus(true);\r\n        }\r\n\r\n\r\n\r\n        private void editCodeActivity_ShowBaloon_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowFieldMessage(\"SystemActiveLocale.UrlMappingName\", StringResourceSystemFacade.GetString(\"Composite.Plugins.LocalizationElementProvider\", \"EditSystemLocaleWorkflow.UrlMappingName.InUseMessage\"));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/EditSystemLocaleWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    partial class EditSystemLocaleWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editCodeActivity_ShowBaloon = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElse_UrlMappingNameInUse = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.editDocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // editCodeActivity_ShowBaloon\r\n            // \r\n            this.editCodeActivity_ShowBaloon.Name = \"editCodeActivity_ShowBaloon\";\r\n            this.editCodeActivity_ShowBaloon.ExecuteCode += new System.EventHandler(this.editCodeActivity_ShowBaloon_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.editCodeActivity_ShowBaloon);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.UrlMappingNameInUse);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity_Save\r\n            // \r\n            this.saveCodeActivity_Save.Name = \"saveCodeActivity_Save\";\r\n            this.saveCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saveCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // ifElse_UrlMappingNameInUse\r\n            // \r\n            this.ifElse_UrlMappingNameInUse.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElse_UrlMappingNameInUse.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElse_UrlMappingNameInUse.Name = \"ifElse_UrlMappingNameInUse\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // editDocumentFormActivity\r\n            // \r\n            this.editDocumentFormActivity.ContainerLabel = null;\r\n            this.editDocumentFormActivity.CustomToolbarDefinitionFileName = null;\r\n            this.editDocumentFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\EditSystemLocaleEdit.xml\";\r\n            this.editDocumentFormActivity.Name = \"editDocumentFormActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity_Save);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.ifElse_UrlMappingNameInUse);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.editDocumentFormActivity);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditSystemLocaleWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditSystemLocaleWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private CodeActivity saveCodeActivity_Save;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity editDocumentFormActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElse_UrlMappingNameInUse;\r\n        private SetStateActivity setStateActivity5;\r\n        private CodeActivity editCodeActivity_ShowBaloon;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/EditSystemLocaleWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditSystemLocaleWorkflow\" Location=\"30; 30\" Size=\"1148; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditSystemLocaleWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditSystemLocaleWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"324\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"324\" Y=\"358\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"editEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"586\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"597\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"597\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"493\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"493\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"editEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"417\" Y=\"423\" />\r\n\t\t\t\t<ns0:Point X=\"617\" Y=\"423\" />\r\n\t\t\t\t<ns0:Point X=\"617\" Y=\"516\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"557\" />\r\n\t\t\t\t<ns0:Point X=\"724\" Y=\"557\" />\r\n\t\t\t\t<ns0:Point X=\"724\" Y=\"350\" />\r\n\t\t\t\t<ns0:Point X=\"324\" Y=\"350\" />\r\n\t\t\t\t<ns0:Point X=\"324\" Y=\"358\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"228; 358\" Size=\"193; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"405; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"editDocumentFormActivity\" Location=\"415; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 423\" Name=\"editEventDrivenActivity_Save\" Location=\"413; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"538; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElse_UrlMappingNameInUse\" Location=\"423; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"442; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"editCodeActivity_ShowBaloon\" Location=\"452; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"452; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity2\" Location=\"615; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"625; 433\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"521; 516\" Size=\"193; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveStateInitializationActivity\" Location=\"529; 547\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity_Save\" Location=\"539; 609\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"539; 669\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/RemoveSystemLocaleWorkflow.cs",
    "content": "using System;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Localization;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class RemoveSystemLocaleWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public RemoveSystemLocaleWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private CultureInfo CreateCultureInfo()\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            ISystemActiveLocale systemActiveLocale = (ISystemActiveLocale)dataEntityToken.Data;\r\n\r\n            CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(systemActiveLocale.CultureName);\r\n            return cultureInfo;\r\n        }\r\n\r\n\r\n\r\n        private void IsLastLocale(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = LocalizationFacade.IsLastLocale();\r\n        }\r\n\r\n\r\n\r\n        private void IsTypesUsingLocalization(object sender, ConditionalEventArgs e)\r\n        {            \r\n            e.Result = LocalizationFacade.IsTypesUsingLocalization();\r\n        }\r\n\r\n\r\n\r\n        private void IsOnlyActiveLocaleForSomeUsers(object sender, ConditionalEventArgs e)\r\n        {\r\n            CultureInfo cultureInfo = CreateCultureInfo();            \r\n\r\n            e.Result = LocalizationFacade.IsOnlyActiveLocaleForSomeUsers(cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        private void IsCurrentDefaultLocale(object sender, ConditionalEventArgs e)\r\n        {\r\n            CultureInfo cultureInfo = CreateCultureInfo();\r\n\r\n            e.Result = LocalizationFacade.IsDefaultLocale(cultureInfo);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n            \r\n            ISystemActiveLocale systemActiveLocale = this.GetDataItemFromEntityToken<ISystemActiveLocale>();\r\n\r\n            var cultureName = systemActiveLocale.CultureName;\r\n\r\n            var consolesToBeUpdated = \r\n                (from consoleInformation in DataFacade.GetData<IUserConsoleInformation>()\r\n                join userSettings in DataFacade.GetData<IUserSettings>()\r\n                    on consoleInformation.Username equals userSettings.Username\r\n                where userSettings.CurrentActiveLocaleCultureName == cultureName\r\n                      || userSettings.ForeignLocaleCultureName == cultureName\r\n                select consoleInformation.ConsoleId).ToList();\r\n\r\n            LocalizationFacade.RemoveLocale(cultureName);\r\n\r\n            foreach (var consoleId in consolesToBeUpdated)\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new CollapseAndRefreshConsoleMessageQueueItem(), consoleId);\r\n            }\r\n            \r\n            ConsoleMessageQueueFacade.Enqueue(new BroadcastMessageQueueItem { Name = \"LocalesUpdated\", Value = \"\" }, null);\r\n\r\n            SelectElement(new LocalizationElementProviderRootEntityToken());\r\n\r\n            deleteTreeRefresher.PostRefreshMesseges();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/RemoveSystemLocaleWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.LocalizationElementProvider\r\n{\r\n    partial class RemoveSystemLocaleWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.if_IsCurrentDefaultLocale = new System.Workflow.Activities.IfElseActivity();\r\n            this.if_IsTypesUsingLocalization = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity8 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity7 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity14 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.abortWizardFormActivity = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.if_IsLastLocale = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step3EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.abortEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.abortStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.abortStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"abortStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsCurrentDefaultLocale);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity10);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity11);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsTypesUsingLocalization);\r\n            this.ifElseBranchActivity3.Condition = codecondition2;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // if_IsCurrentDefaultLocale\r\n            // \r\n            this.if_IsCurrentDefaultLocale.Activities.Add(this.ifElseBranchActivity1);\r\n            this.if_IsCurrentDefaultLocale.Activities.Add(this.ifElseBranchActivity2);\r\n            this.if_IsCurrentDefaultLocale.Name = \"if_IsCurrentDefaultLocale\";\r\n            // \r\n            // if_IsTypesUsingLocalization\r\n            // \r\n            this.if_IsTypesUsingLocalization.Activities.Add(this.ifElseBranchActivity3);\r\n            this.if_IsTypesUsingLocalization.Activities.Add(this.ifElseBranchActivity4);\r\n            this.if_IsTypesUsingLocalization.Name = \"if_IsTypesUsingLocalization\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"abortStateActivity\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.if_IsCurrentDefaultLocale);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.if_IsTypesUsingLocalization);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsCurrentDefaultLocale);\r\n            this.ifElseBranchActivity5.Condition = codecondition3;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity8\r\n            // \r\n            this.ifElseBranchActivity8.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity8.Name = \"ifElseBranchActivity8\";\r\n            // \r\n            // ifElseBranchActivity7\r\n            // \r\n            this.ifElseBranchActivity7.Activities.Add(this.setStateActivity2);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsOnlyActiveLocaleForSomeUsers);\r\n            this.ifElseBranchActivity7.Condition = codecondition4;\r\n            this.ifElseBranchActivity7.Name = \"ifElseBranchActivity7\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\RemoveSystemLocaleStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // setStateActivity14\r\n            // \r\n            this.setStateActivity14.Name = \"setStateActivity14\";\r\n            this.setStateActivity14.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity3\r\n            // \r\n            this.finishHandleExternalEventActivity3.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity3.Name = \"finishHandleExternalEventActivity3\";\r\n            // \r\n            // abortWizardFormActivity\r\n            // \r\n            this.abortWizardFormActivity.ContainerLabel = null;\r\n            this.abortWizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\RemoveSystemLocaleAbort.xml\";\r\n            this.abortWizardFormActivity.Name = \"abortWizardFormActivity\";\r\n            // \r\n            // if_IsLastLocale\r\n            // \r\n            this.if_IsLastLocale.Activities.Add(this.ifElseBranchActivity5);\r\n            this.if_IsLastLocale.Activities.Add(this.ifElseBranchActivity6);\r\n            this.if_IsLastLocale.Enabled = false;\r\n            this.if_IsLastLocale.Name = \"if_IsLastLocale\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity7);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity8);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity8);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step3EventDrivenActivity_Cancel\r\n            // \r\n            this.step3EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step3EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity7);\r\n            this.step3EventDrivenActivity_Cancel.Name = \"step3EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Finish\r\n            // \r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.setStateActivity6);\r\n            this.step2EventDrivenActivity_Finish.Name = \"step2EventDrivenActivity_Finish\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2WizardFormActivity);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // abortEventDrivenActivity_Finish\r\n            // \r\n            this.abortEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity3);\r\n            this.abortEventDrivenActivity_Finish.Activities.Add(this.setStateActivity14);\r\n            this.abortEventDrivenActivity_Finish.Name = \"abortEventDrivenActivity_Finish\";\r\n            // \r\n            // abortStateInitializationActivity\r\n            // \r\n            this.abortStateInitializationActivity.Activities.Add(this.abortWizardFormActivity);\r\n            this.abortStateInitializationActivity.Name = \"abortStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.if_IsLastLocale);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Finish);\r\n            this.step2StateActivity.Activities.Add(this.step3EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // abortStateActivity\r\n            // \r\n            this.abortStateActivity.Activities.Add(this.abortStateInitializationActivity);\r\n            this.abortStateActivity.Activities.Add(this.abortEventDrivenActivity_Finish);\r\n            this.abortStateActivity.Name = \"abortStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // RemoveSystemLocaleWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.abortStateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"RemoveSystemLocaleWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateActivity abortStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity step2WizardFormActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private StateInitializationActivity abortStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step2StateActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity abortWizardFormActivity;\r\n        private EventDrivenActivity step2EventDrivenActivity_Finish;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private EventDrivenActivity step3EventDrivenActivity_Cancel;\r\n        private SetStateActivity setStateActivity8;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private EventDrivenActivity abortEventDrivenActivity_Finish;\r\n        private SetStateActivity setStateActivity14;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity10;\r\n        private SetStateActivity setStateActivity11;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private SetStateActivity setStateActivity3;\r\n        private IfElseActivity if_IsTypesUsingLocalization;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseActivity if_IsLastLocale;\r\n        private SetStateActivity setStateActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity if_IsCurrentDefaultLocale;\r\n        private IfElseBranchActivity ifElseBranchActivity8;\r\n        private IfElseBranchActivity ifElseBranchActivity7;\r\n        private IfElseActivity ifElseActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/LocalizationElementProvider/RemoveSystemLocaleWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"RemoveSystemLocaleWorkflow\" Location=\"30; 30\" Size=\"1146; 980\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"RemoveSystemLocaleWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"RemoveSystemLocaleWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity14\" SourceStateName=\"abortStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"abortStateActivity\" EventHandlerName=\"abortEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"434\" Y=\"581\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"581\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"688\" Y=\"394\" />\r\n\t\t\t\t<ns0:Point X=\"784\" Y=\"394\" />\r\n\t\t\t\t<ns0:Point X=\"784\" Y=\"605\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"3\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step3EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"692\" Y=\"418\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"418\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"883\" Y=\"646\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"646\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"595\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"595\" Y=\"329\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"abortStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"abortStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"516\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"595\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"595\" Y=\"329\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"abortStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"abortStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"516\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"843; 496\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"823; 415\" Name=\"if_IsLastLocale\" Location=\"108; 231\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 315\" Name=\"ifElseBranchActivity5\" Location=\"127; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 234\" Name=\"if_IsTypesUsingLocalization\" Location=\"137; 364\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 134\" Name=\"ifElseBranchActivity3\" Location=\"156; 435\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity11\" Location=\"166; 497\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 134\" Name=\"ifElseBranchActivity4\" Location=\"329; 435\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity10\" Location=\"339; 497\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 315\" Name=\"ifElseBranchActivity6\" Location=\"531; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"if_IsCurrentDefaultLocale\" Location=\"541; 370\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"560; 441\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"570; 503\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"733; 441\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"743; 503\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"abortStateActivity\" Location=\"232; 516\" Size=\"206; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"abortStateInitializationActivity\" Location=\"240; 547\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"abortWizardFormActivity\" Location=\"250; 609\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"abortEventDrivenActivity_Finish\" Location=\"240; 571\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity3\" Location=\"250; 633\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity14\" Location=\"250; 693\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step2StateActivity\" Location=\"485; 329\" Size=\"220; 126\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step2StateInitializationActivity\" Location=\"493; 360\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2WizardFormActivity\" Location=\"503; 422\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2EventDrivenActivity_Finish\" Location=\"493; 384\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"503; 446\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"503; 506\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step3EventDrivenActivity_Cancel\" Location=\"493; 408\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"503; 470\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"503; 530\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"682; 605\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"690; 636\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"700; 698\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"700; 758\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddMediaZipFileWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class AddMediaZipFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity3 = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finishEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectZipStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.selectZipFileStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"selectZipFileStateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"selectZipFileStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // codeActivity3\r\n            // \r\n            this.codeActivity3.Name = \"codeActivity3\";\r\n            this.codeActivity3.ExecuteCode += new System.EventHandler(this.HandleFinish_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity4);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ZipWasUploaded);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.codeActivity3);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasUserUploaded);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.FinalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"/Administrative/AddZipMediaFile.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"selectZipFileStateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.InitializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity2);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.ifElseActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity6);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finishEventDrivenActivity\r\n            // \r\n            this.finishEventDrivenActivity.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.finishEventDrivenActivity.Activities.Add(this.ifElseActivity1);\r\n            this.finishEventDrivenActivity.Name = \"finishEventDrivenActivity\";\r\n            // \r\n            // selectZipStateInitializationActivity\r\n            // \r\n            this.selectZipStateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.selectZipStateInitializationActivity.Name = \"selectZipStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // selectZipFileStateActivity\r\n            // \r\n            this.selectZipFileStateActivity.Activities.Add(this.selectZipStateInitializationActivity);\r\n            this.selectZipFileStateActivity.Activities.Add(this.finishEventDrivenActivity);\r\n            this.selectZipFileStateActivity.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.selectZipFileStateActivity.Name = \"selectZipFileStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // AddMediaZipFileWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.selectZipFileStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"AddMediaZipFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity selectZipFileStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private CodeActivity codeActivity1;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private StateInitializationActivity selectZipStateInitializationActivity;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private CodeActivity codeActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private CodeActivity codeActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity finishEventDrivenActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddMediaZipFileWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Core;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Management;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Never)]\r\n    public sealed partial class AddMediaZipFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        bool _zipHasBeenUploaded = false;\r\n\r\n        public AddMediaZipFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void InitializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            FormsWorkflow workflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            string parentFolderPath;\r\n            string storeId;\r\n            if (this.EntityToken is MediaRootFolderProviderEntityToken)\r\n            {\r\n                var token = (MediaRootFolderProviderEntityToken)this.EntityToken;\r\n                parentFolderPath = \"/\";\r\n                storeId = token.Id;\r\n            }\r\n            else\r\n            {\r\n                var token = (DataEntityToken)this.EntityToken;\r\n                IMediaFileFolder parentFolder = (IMediaFileFolder)token.Data;\r\n                parentFolderPath = parentFolder.Path;\r\n                storeId = parentFolder.StoreId;\r\n            }\r\n\r\n            string providerName = DataFacade.GetData<IMediaFileStore>().First(x => x.Id == storeId).DataSourceId.ProviderName;\r\n\r\n            UploadedFile file = new UploadedFile();\r\n\r\n            workflow.Bindings.Add(\"UploadedFile\", file);\r\n            workflow.Bindings.Add(\"RecreateFolders\", true);\r\n            workflow.Bindings.Add(\"OverwriteExisting\", false);\r\n            workflow.Bindings.Add(\"ParentFolderPath\", parentFolderPath);\r\n            workflow.Bindings.Add(\"ProviderName\", providerName);\r\n        }\r\n\r\n\r\n\r\n        private void HandleFinish_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n            bool recreateFolders = this.GetBinding<bool>(\"RecreateFolders\");\r\n            bool overwrite = this.GetBinding<bool>(\"OverwriteExisting\");\r\n            string parentFolderPath = this.GetBinding<string>(\"ParentFolderPath\");\r\n            string providerName = this.GetBinding<string>(\"ProviderName\");\r\n\r\n            if (uploadedFile.HasFile)\r\n            {\r\n                if(uploadedFile.FileName.EndsWith(\".docx\"))\r\n                {\r\n                    ShowUploadError(Texts.Website_Forms_Administrative_AddZipMediaFile_CannotUploadDocxFile);\r\n                    return;\r\n                }\r\n\r\n                using (System.IO.Stream readStream = uploadedFile.FileStream)\r\n                {\r\n                    try\r\n                    {\r\n                        ZipMediaFileExtractor.AddZip(providerName, parentFolderPath, readStream, recreateFolders, overwrite);\r\n                        _zipHasBeenUploaded = true;\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(nameof(AddMediaZipFileWorkflow), ex);\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (!_zipHasBeenUploaded)\r\n            {\r\n                ShowUploadError(Texts.Website_Forms_Administrative_AddZipMediaFile_WrongUploadedFile_Message);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ZipWasUploaded(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = _zipHasBeenUploaded;\r\n        }\r\n\r\n\r\n\r\n        private void FinalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n        }\r\n\r\n\r\n\r\n        private void HasUserUploaded(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n            if (!uploadedFile.HasFile)\r\n            {\r\n                ShowUploadError(Texts.Website_Forms_Administrative_AddZipMediaFile_MissingUploadedFile_Message);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n        private void ShowUploadError(string message)\r\n        {\r\n            //TODO: Cannot show an error bubble on file selector since the control doesn't support it. Should be fixed on client js\r\n            //this.ShowFieldMessage(\"UploadedFile\", \"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.MissingUploadedFile.Message}\");\r\n            this.ShowMessage(DialogType.Error,\r\n                Texts.Website_Forms_Administrative_AddZipMediaFile_Error_Title,\r\n                message);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddMediaZipFileWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1220; 986\" AutoSizeMargin=\"16; 24\" Location=\"30; 30\" Name=\"AddMediaZipFileWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"197; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 105\" Name=\"initialState\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150; 182\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity1\" Size=\"130; 41\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"214; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"240; 344\" Name=\"selectZipFileStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"selectZipStateInitializationActivity\" Size=\"150; 122\" Location=\"248; 375\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130; 41\" Location=\"258; 437\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"finishEventDrivenActivity\" Size=\"381; 423\" Location=\"248; 399\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"373; 461\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 282\" Location=\"258; 521\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 182\" Location=\"277; 592\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity3\" Size=\"130; 41\" Location=\"287; 654\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"287; 714\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 182\" Location=\"450; 592\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"460; 684\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150; 182\" Location=\"248; 423\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"258; 485\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"258; 545\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"534; 592\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"381; 423\" Location=\"542; 623\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity2\" Size=\"130; 41\" Location=\"667; 685\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2\" Size=\"361; 282\" Location=\"552; 745\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 182\" Location=\"571; 816\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"581; 878\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"581; 938\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 182\" Location=\"744; 816\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"754; 908\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity1\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"859; 784\" Name=\"finalStateActivity\" />\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddMediaZipFileWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddMediaZipFileWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity1\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"939\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"939\" Y=\"784\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectZipFileStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initialState\" TargetConnectionIndex=\"0\" SourceStateName=\"initialState\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"selectZipFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"347\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"347\" Y=\"344\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"selectZipFileStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectZipFileStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finishEventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"407\" Y=\"409\" />\r\n\t\t\t\t<ns0:Point X=\"636\" Y=\"409\" />\r\n\t\t\t\t<ns0:Point X=\"636\" Y=\"592\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectZipFileStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"selectZipFileStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectZipFileStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finishEventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"selectZipFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"407\" Y=\"409\" />\r\n\t\t\t\t<ns0:Point X=\"459\" Y=\"409\" />\r\n\t\t\t\t<ns0:Point X=\"459\" Y=\"336\" />\r\n\t\t\t\t<ns0:Point X=\"347\" Y=\"336\" />\r\n\t\t\t\t<ns0:Point X=\"347\" Y=\"344\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"selectZipFileStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectZipFileStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"412\" Y=\"433\" />\r\n\t\t\t\t<ns0:Point X=\"939\" Y=\"433\" />\r\n\t\t\t\t<ns0:Point X=\"939\" Y=\"784\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"735\" Y=\"633\" />\r\n\t\t\t\t<ns0:Point X=\"939\" Y=\"633\" />\r\n\t\t\t\t<ns0:Point X=\"939\" Y=\"784\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectZipFileStateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"selectZipFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"735\" Y=\"633\" />\r\n\t\t\t\t<ns0:Point X=\"747\" Y=\"633\" />\r\n\t\t\t\t<ns0:Point X=\"747\" Y=\"336\" />\r\n\t\t\t\t<ns0:Point X=\"347\" Y=\"336\" />\r\n\t\t\t\t<ns0:Point X=\"347\" Y=\"344\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddNewMediaFileWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class AddNewMediaFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step2IfElseActivity_ValidateStep2Bindings = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previousHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviousHandleExternalEventActivity();\r\n            this.wizardFormActivity2 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.step2CodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step1IfElseActivity_Finish_ValidateStep1Bindings = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1IfElseActivity_Next_ValidateStep1Bindings = new System.Workflow.Activities.IfElseActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_InitializeBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stepEventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity12);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity4);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateStep2Bindings);\r\n            this.ifElseBranchActivity5.Condition = codecondition1;\r\n            this.ifElseBranchActivity5.Description = \"ValidateStep2Bindings\";\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity11);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity7);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateStep1Bindings_Finish);\r\n            this.ifElseBranchActivity3.Condition = codecondition2;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity10);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity8);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateStep1Bindings_Next);\r\n            this.ifElseBranchActivity1.Condition = codecondition3;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // step2IfElseActivity_ValidateStep2Bindings\r\n            // \r\n            this.step2IfElseActivity_ValidateStep2Bindings.Activities.Add(this.ifElseBranchActivity5);\r\n            this.step2IfElseActivity_ValidateStep2Bindings.Activities.Add(this.ifElseBranchActivity6);\r\n            this.step2IfElseActivity_ValidateStep2Bindings.Name = \"step2IfElseActivity_ValidateStep2Bindings\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // previousHandleExternalEventActivity1\r\n            // \r\n            this.previousHandleExternalEventActivity1.EventName = \"Previous\";\r\n            this.previousHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previousHandleExternalEventActivity1.Name = \"previousHandleExternalEventActivity1\";\r\n            // \r\n            // wizardFormActivity2\r\n            // \r\n            this.wizardFormActivity2.ContainerLabel = null;\r\n            this.wizardFormActivity2.FormDefinitionFileName = \"/Administrative/AddMediaFileStep2.xml\";\r\n            this.wizardFormActivity2.Name = \"wizardFormActivity2\";\r\n            // \r\n            // step2CodeActivity_UpdateBindings\r\n            // \r\n            this.step2CodeActivity_UpdateBindings.Name = \"step2CodeActivity_UpdateBindings\";\r\n            this.step2CodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.step2CodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // step1IfElseActivity_Finish_ValidateStep1Bindings\r\n            // \r\n            this.step1IfElseActivity_Finish_ValidateStep1Bindings.Activities.Add(this.ifElseBranchActivity3);\r\n            this.step1IfElseActivity_Finish_ValidateStep1Bindings.Activities.Add(this.ifElseBranchActivity4);\r\n            this.step1IfElseActivity_Finish_ValidateStep1Bindings.Name = \"step1IfElseActivity_Finish_ValidateStep1Bindings\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1IfElseActivity_Next_ValidateStep1Bindings\r\n            // \r\n            this.step1IfElseActivity_Next_ValidateStep1Bindings.Activities.Add(this.ifElseBranchActivity1);\r\n            this.step1IfElseActivity_Next_ValidateStep1Bindings.Activities.Add(this.ifElseBranchActivity2);\r\n            this.step1IfElseActivity_Next_ValidateStep1Bindings.Name = \"step1IfElseActivity_Next_ValidateStep1Bindings\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"/Administrative/AddMediaFileStep1.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_InitializeBindings\r\n            // \r\n            this.initializeCodeActivity_InitializeBindings.Name = \"initializeCodeActivity_InitializeBindings\";\r\n            this.initializeCodeActivity_InitializeBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_InitializeBindings_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Finish\r\n            // \r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.step2IfElseActivity_ValidateStep2Bindings);\r\n            this.step2EventDrivenActivity_Finish.Name = \"step2EventDrivenActivity_Finish\";\r\n            // \r\n            // step2EventDrivenActivity_Previous\r\n            // \r\n            this.step2EventDrivenActivity_Previous.Activities.Add(this.previousHandleExternalEventActivity1);\r\n            this.step2EventDrivenActivity_Previous.Activities.Add(this.setStateActivity9);\r\n            this.step2EventDrivenActivity_Previous.Name = \"step2EventDrivenActivity_Previous\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2CodeActivity_UpdateBindings);\r\n            this.step2StateInitializationActivity.Activities.Add(this.wizardFormActivity2);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity6);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.step1IfElseActivity_Finish_ValidateStep1Bindings);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // stepEventDrivenActivity_Next\r\n            // \r\n            this.stepEventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.stepEventDrivenActivity_Next.Activities.Add(this.step1IfElseActivity_Next_ValidateStep1Bindings);\r\n            this.stepEventDrivenActivity_Next.Name = \"stepEventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_InitializeBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Previous);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Finish);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.stepEventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddNewMediaFileWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewMediaFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity step2CodeActivity_UpdateBindings;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private CodeActivity initializeCodeActivity_InitializeBindings;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Finish;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Previous;\r\n\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private EventDrivenActivity stepEventDrivenActivity_Next;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step2StateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity step1IfElseActivity_Next_ValidateStep1Bindings;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity12;\r\n\r\n        private SetStateActivity setStateActivity11;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity step2IfElseActivity_ValidateStep2Bindings;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.PreviousHandleExternalEventActivity previousHandleExternalEventActivity1;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private IfElseActivity step1IfElseActivity_Finish_ValidateStep1Bindings;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddNewMediaFileWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Data.Transactions;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Never)]\r\n    public sealed partial class AddNewMediaFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewMediaFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void Initialize()\r\n        {\r\n            if (this.EntityToken is MediaRootFolderProviderEntityToken token)\r\n            {\r\n                _storeId = token.Id;\r\n                _folderPath = \"/\";\r\n            }\r\n            else\r\n            {\r\n                var dataEntityToken = (DataEntityToken)this.EntityToken;\r\n                var parentFolder = (IMediaFileFolder)dataEntityToken.Data;\r\n                _storeId = parentFolder.StoreId;\r\n                _folderPath = parentFolder.Path;\r\n            }\r\n        }\r\n\r\n\r\n        [NonSerialized]\r\n        private string _folderPath;\r\n        internal string FolderPath\r\n        {\r\n            get\r\n            {\r\n                if (_folderPath == null)\r\n                {\r\n                    Initialize();\r\n                }\r\n\r\n                return _folderPath;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [NonSerialized]\r\n        private string _storeId;\r\n        internal string StoreId\r\n        {\r\n            get\r\n            {\r\n                if (_storeId == null)\r\n                {\r\n                    Initialize();\r\n                }\r\n\r\n                return _storeId;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private IMediaFile GetExistingFile(string folderPath, string filename)\r\n        {\r\n            return DataFacade.GetData<IMediaFile>().FirstOrDefault(file =>\r\n                string.Compare(file.FolderPath, folderPath, StringComparison.OrdinalIgnoreCase) == 0 &&\r\n                string.Compare(file.FileName, filename, StringComparison.OrdinalIgnoreCase) == 0);\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_InitializeBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(\"UploadedFile\", new UploadedFile());\r\n            this.Bindings.Add(\"AllowOverwrite\", false);\r\n            this.Bindings.Add(\"Title\", \"\");\r\n            this.Bindings.Add(\"Description\", \"\");\r\n            this.Bindings.Add(\"Tags\", \"\");\r\n        }\r\n\r\n\r\n\r\n        private void ValidateStep1Bindings_Next(object sender, ConditionalEventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n            if (!uploadedFile.HasFile)\r\n            {\r\n                this.ShowFieldMessage(\"UploadedFile\", \"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.MissingUploadedFile.Message}\");\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void ValidateStep1Bindings_Finish(object sender, ConditionalEventArgs e)\r\n        {\r\n            ValidateStep1Bindings_Next(sender, e);\r\n            if (!e.Result) return;\r\n\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n            string filename = uploadedFile.FileName;\r\n\r\n            bool allowOverwrite = this.GetBinding<bool>(\"AllowOverwrite\");\r\n\r\n            IMediaFile existingFile = GetExistingFile(this.FolderPath, filename);\r\n            if (existingFile != null && !allowOverwrite)\r\n            {\r\n                this.ShowFieldMessage(\"UploadedFile\", \"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.FileExists.Message}\");\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            string compositePath = IMediaFileExtensions.GetCompositePath(this.StoreId, this.FolderPath, filename);\r\n            if (compositePath.Length > 2048)\r\n            {\r\n                this.ShowFieldMessage(\"UploadedFile\", \"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.TotalFilenameToLong.Message}\");\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {            \r\n            if (!this.BindingExist(\"Filename\"))\r\n            {\r\n                UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n                this.Bindings.Add(\"Filename\", uploadedFile.FileName);\r\n\r\n                this.BindingsValidationRules.Add(\"Title\", new List<ClientValidationRule> { new StringLengthClientValidationRule(0, 256) });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ValidateStep2Bindings(object sender, ConditionalEventArgs e)\r\n        {            \r\n            string filename = this.GetBinding<string>(\"Filename\");\r\n\r\n            bool allowOverwrite = this.GetBinding<bool>(\"AllowOverwrite\");\r\n\r\n            IMediaFile existingFile = GetExistingFile(this.FolderPath, filename);\r\n            if (existingFile != null && !allowOverwrite)\r\n            {\r\n                this.ShowFieldMessage(\"Filename\", \"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.FileExists.Message}\");\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            string compositePath = IMediaFileExtensions.GetCompositePath(this.StoreId, this.FolderPath, filename);\r\n            if (compositePath.Length > 2048)\r\n            {\r\n                this.ShowFieldMessage(\"Filename\", \"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.TotalFilenameToLong.Message}\");\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n            DataEntityToken focusEntityToken;\r\n\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n            var filename = this.BindingExist(\"Filename\")\r\n                ? this.GetBinding<string>(\"Filename\")\r\n                : uploadedFile.FileName;\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IMediaFileStore store = DataFacade.GetData<IMediaFileStore>(x => x.Id == this.StoreId).First();\r\n\r\n                IMediaFile existingFile = GetExistingFile(this.FolderPath, filename);\r\n\r\n                if (existingFile == null)\r\n                {\r\n                    var mediaFile = new WorkflowMediaFile\r\n                    {\r\n                        FileName = System.IO.Path.GetFileName(filename),\r\n                        FolderPath = this.FolderPath,\r\n                        Title = this.GetBinding<string>(\"Title\"),\r\n                        Description = this.GetBinding<string>(\"Description\"),\r\n                        Tags = this.GetBinding<string>(\"Tags\"),\r\n                        Culture = C1Console.Users.UserSettings.ActiveLocaleCultureInfo.Name,\r\n                        Length = uploadedFile.ContentLength,\r\n                        MimeType = MimeTypeInfo.GetMimeType(uploadedFile)\r\n                    };\r\n\r\n                    using (var readStream = uploadedFile.FileStream)\r\n                    {\r\n                        using (var writeStream = mediaFile.GetNewWriteStream())\r\n                        {\r\n                            readStream.CopyTo(writeStream);\r\n                        }\r\n                    }\r\n\r\n                    IMediaFile addedFile = DataFacade.AddNew<IMediaFile>(mediaFile, store.DataSourceId.ProviderName);\r\n\r\n                    focusEntityToken = addedFile.GetDataEntityToken();\r\n                }\r\n                else\r\n                {\r\n                    Guid fileId = existingFile.Id;\r\n                    IMediaFileData fileData = DataFacade.GetData<IMediaFileData>(file => file.Id == fileId).FirstOrDefault();\r\n\r\n                    fileData.Title = this.GetBinding<string>(\"Title\");\r\n                    fileData.Description = this.GetBinding<string>(\"Description\");\r\n                    fileData.Tags = this.GetBinding<string>(\"Tags\");\r\n                    fileData.MimeType = MimeTypeInfo.GetMimeType(uploadedFile);\r\n                    fileData.Length = uploadedFile.ContentLength;\r\n\r\n                    using (var readStream = uploadedFile.FileStream)\r\n                    {\r\n                        using (var writeStream = existingFile.GetNewWriteStream())\r\n                        {\r\n                            readStream.CopyTo(writeStream);\r\n                        }\r\n                    }\r\n\r\n                    DataFacade.Update(existingFile);\r\n                    DataFacade.Update(fileData);\r\n\r\n                    focusEntityToken = existingFile.GetDataEntityToken();\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(focusEntityToken);\r\n            SelectElement(focusEntityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddNewMediaFileWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1190; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddNewMediaFileWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_InitializeBindings\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 126\" AutoSizeMargin=\"16; 24\" Location=\"146; 317\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"154; 348\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"164; 410\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"stepEventDrivenActivity_Next\" Size=\"381; 375\" Location=\"154; 372\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"279; 434\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"step1IfElseActivity_Next_ValidateStep1Bindings\" Size=\"361; 234\" Location=\"164; 494\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 134\" Location=\"183; 565\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 41\" Location=\"193; 633\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 134\" Location=\"356; 565\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 53\" Location=\"366; 627\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"381; 375\" Location=\"154; 396\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"279; 458\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"step1IfElseActivity_Finish_ValidateStep1Bindings\" Size=\"361; 234\" Location=\"164; 518\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 134\" Location=\"183; 589\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"193; 657\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 134\" Location=\"356; 589\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity11\" Size=\"130; 53\" Location=\"366; 651\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"154; 420\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"164; 482\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"164; 542\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"220; 126\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"424; 472\" Name=\"step2StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step2StateInitializationActivity\" Size=\"150; 182\" Location=\"550; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step2CodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"560; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity2\" Size=\"130; 41\" Location=\"560; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Previous\" Size=\"150; 182\" Location=\"542; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previousHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"552; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 41\" Location=\"552; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Finish\" Size=\"381; 375\" Location=\"542; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"667; 245\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"step2IfElseActivity_ValidateStep2Bindings\" Size=\"361; 234\" Location=\"552; 305\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity5\" Size=\"150; 134\" Location=\"571; 376\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"581; 444\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity6\" Size=\"150; 134\" Location=\"744; 376\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity12\" Size=\"130; 53\" Location=\"754; 438\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"542; 207\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"552; 269\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"552; 329\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"711; 618\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"719; 649\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"729; 711\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"729; 771\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddNewMediaFileWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewMediaFileWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"305\" />\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"305\" />\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"317\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2StateActivity\" SetStateName=\"setStateActivity8\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stepEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step2StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"337\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"534\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"534\" Y=\"472\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity10\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stepEventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"337\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"317\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"349\" Y=\"406\" />\r\n\t\t\t\t<ns0:Point X=\"813\" Y=\"406\" />\r\n\t\t\t\t<ns0:Point X=\"813\" Y=\"618\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity11\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"349\" Y=\"406\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"406\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"317\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"3\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"353\" Y=\"430\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"430\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity9\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Previous\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"537\" />\r\n\t\t\t\t<ns0:Point X=\"651\" Y=\"537\" />\r\n\t\t\t\t<ns0:Point X=\"651\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"317\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"627\" Y=\"561\" />\r\n\t\t\t\t<ns0:Point X=\"813\" Y=\"561\" />\r\n\t\t\t\t<ns0:Point X=\"813\" Y=\"618\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2StateActivity\" SetStateName=\"setStateActivity12\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"step2StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"737\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"764\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"764\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"644\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"644\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Cancel\" SourceConnectionIndex=\"3\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"631\" Y=\"585\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"585\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"912\" Y=\"659\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"659\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddNewMediaFolderWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class AddNewMediaFolderWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.step1IfElseBranchActivity_DoesFolderExist = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeAddNewfolderCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.stateInitializationActivity3 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.AddNewMediaFolderWorkflowInitialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // step1IfElseBranchActivity_DoesFolderExist\r\n            // \r\n            this.step1IfElseBranchActivity_DoesFolderExist.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateInputs);\r\n            this.step1IfElseBranchActivity_DoesFolderExist.Condition = codecondition1;\r\n            this.step1IfElseBranchActivity_DoesFolderExist.Name = \"step1IfElseBranchActivity_DoesFolderExist\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.step1IfElseBranchActivity_DoesFolderExist);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"/Administrative/AddNewMediaFolder.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeAddNewfolderCodeActivity\r\n            // \r\n            this.initializeAddNewfolderCodeActivity.Name = \"initializeAddNewfolderCodeActivity\";\r\n            this.initializeAddNewfolderCodeActivity.ExecuteCode += new System.EventHandler(this.initializeAddNewfolderCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // stateInitializationActivity3\r\n            // \r\n            this.stateInitializationActivity3.Activities.Add(this.finalizeCodeActivity);\r\n            this.stateInitializationActivity3.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.stateInitializationActivity3.Activities.Add(this.setStateActivity4);\r\n            this.stateInitializationActivity3.Name = \"stateInitializationActivity3\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.wizzardFormActivity1);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.initializeAddNewfolderCodeActivity);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // cancelActivity\r\n            // \r\n            this.cancelActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelActivity.Name = \"cancelActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.stateInitializationActivity3);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // AddNewMediaFolderWorkflowInitialState\r\n            // \r\n            this.AddNewMediaFolderWorkflowInitialState.Activities.Add(this.stateInitializationActivity1);\r\n            this.AddNewMediaFolderWorkflowInitialState.Name = \"AddNewMediaFolderWorkflowInitialState\";\r\n            // \r\n            // AddNewMediaFolderWorkflow\r\n            // \r\n            this.Activities.Add(this.AddNewMediaFolderWorkflowInitialState);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"AddNewMediaFolderWorkflowInitialState\";\r\n            this.Name = \"AddNewMediaFolderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeAddNewfolderCodeActivity;\r\n\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private StateInitializationActivity stateInitializationActivity3;\r\n\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private EventDrivenActivity cancelActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private CodeActivity finalizeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity step1IfElseBranchActivity_DoesFolderExist;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private StateActivity AddNewMediaFolderWorkflowInitialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddNewMediaFolderWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewMediaFolderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewMediaFolderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeAddNewfolderCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            FormsWorkflow workflow = this.GetRoot<FormsWorkflow>();\r\n            string parentFolderPath;\r\n            string storeId;\r\n            if (this.EntityToken is MediaRootFolderProviderEntityToken)\r\n            {\r\n                MediaRootFolderProviderEntityToken token = (MediaRootFolderProviderEntityToken)this.EntityToken;\r\n                storeId = token.Id;\r\n                parentFolderPath = \"/\";\r\n            }\r\n            else\r\n            {\r\n                DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n                IMediaFileFolder parentFolder = (IMediaFileFolder)token.Data;\r\n                storeId = parentFolder.StoreId;\r\n                parentFolderPath = parentFolder.Path;\r\n            }\r\n\r\n            IMediaFileStore store = DataFacade.GetData<IMediaFileStore>(x => x.Id == storeId).First();\r\n            IMediaFileFolder folder = DataFacade.BuildNew<IMediaFileFolder>();\r\n            folder.Path = parentFolderPath;\r\n\r\n            workflow.Bindings.Add(\"NewFolder\", folder);\r\n            workflow.Bindings.Add(\"FolderName\", \"\");\r\n            workflow.Bindings.Add(\"ProviderName\", store.DataSourceId.ProviderName);\r\n            workflow.Bindings.Add(\"ProvidesMetaData\", false);\r\n\r\n            workflow.BindingsValidationRules.Add(\"FolderName\", new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n        }\r\n\r\n\r\n        /*private string CreateFolderPath(IMediaFileFolder folder)\r\n        {\r\n            string folderName = this.GetBinding<string>(\"FolderName\");\r\n\r\n            string folderPath = folder.Path;\r\n\r\n            if (folderPath == \"/\")\r\n            {\r\n                folderPath = folderPath + folderName;\r\n            }\r\n            else\r\n            {\r\n                folderPath = folderPath + \"/\" + folderName;\r\n            }\r\n\r\n            folderPath = folderPath.Replace('\\\\', '/');\r\n            while (folderPath.Contains(\"//\"))\r\n            {\r\n                folderPath.Replace(\"//\", \"/\");\r\n            }\r\n\r\n            if ((folderPath != \"/\") && (folderPath.StartsWith(\"/\")))\r\n            {\r\n                folderPath.Remove(0, 1);\r\n            }\r\n\r\n            return folderPath;\r\n        }*/\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            IMediaFileFolder folder = this.GetBinding<IMediaFileFolder>(\"NewFolder\");\r\n            string folderName = this.GetBinding<string>(\"FolderName\");\r\n            string providerName = this.GetBinding<string>(\"ProviderName\");\r\n\r\n            string folderPath = folder.CreateFolderPath(folderName);\r\n\r\n            folder.Path = folderPath;\r\n\r\n            if (folder.Title == string.Empty)\r\n            {\r\n                folder.Title = folderPath.GetFolderName('/');\r\n            }            \r\n\r\n            CreateParentFolder(folder.GetParentFolderPath(), providerName);\r\n\r\n            folder = DataFacade.AddNew<IMediaFileFolder>(folder, providerName);\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(folder.GetDataEntityToken());\r\n\r\n            SelectElement(folder.GetDataEntityToken());\r\n\r\n        }\r\n\r\n\r\n\r\n        private void CreateParentFolder(string parentFolder, string providerName)\r\n        {\r\n            if (IMediaFileFolderUtils.DoesFolderExists(parentFolder)) return;\r\n\r\n            CreateParentFolder(IMediaFileFolderUtils.GetParentFolderPath(parentFolder), providerName);\r\n\r\n            IMediaFileFolder folder = DataFacade.BuildNew<IMediaFileFolder>();\r\n            folder.Path = parentFolder;\r\n\r\n            DataFacade.AddNew<IMediaFileFolder>(folder, providerName);\r\n        }\r\n\r\n\r\n        private void ValidateInputs(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = true;\r\n\r\n            IMediaFileFolder folder = this.GetBinding<IMediaFileFolder>(\"NewFolder\");\r\n            string folderName = this.GetBinding<string>(\"FolderName\");\r\n            string folderPath = folder.CreateFolderPath(folderName);\r\n\r\n            string tempFolderName = folderName.Replace('\\\\', '/').Trim();\r\n            while (tempFolderName.Contains(\"//\"))\r\n            {\r\n                tempFolderName = tempFolderName.Replace(\"//\", \"/\");\r\n            }\r\n\r\n            if (tempFolderName == \"/\") \r\n            {\r\n                e.Result = false;\r\n                ShowFieldMessage(\"FolderName\", StringResourceSystemFacade.GetString(\"Composite.Management\", \"Website.Forms.Administrative.AddNewMediaFolder.FolderNotOnlySlash\"));\r\n                return;\r\n            }\r\n\r\n            if (DataFacade.GetData<IMediaFileFolder>().Any(f => string.Compare(f.Path, folderPath, StringComparison.InvariantCultureIgnoreCase) == 0))\r\n            {\r\n                e.Result = false;\r\n                ShowFieldMessage(\"FolderName\", StringResourceSystemFacade.GetString(\"Composite.Management\", \"Website.Forms.Administrative.AddNewMediaFolder.FolderNameAlreadyUsed\"));\r\n            }\r\n\r\n            if (folderPath.Length > 2048)\r\n            {\r\n                e.Result = false;\r\n                ShowFieldMessage(\"FolderName\", StringResourceSystemFacade.GetString(\"Composite.Management\", \"Website.Forms.Administrative.AddNewMediaFolder.FolderNameTooLong\"));\r\n            }\r\n\r\n            \r\n\r\n            folderPath.IsCorrectFolderName('/');\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/AddNewMediaFolderWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1220; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddNewMediaFolderWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"235; 80\" AutoSizeMargin=\"16; 24\" Location=\"59; 101\" Name=\"AddNewMediaFolderWorkflowInitialState\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity1\" Size=\"150; 182\" Location=\"67; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeAddNewfolderCodeActivity\" Size=\"130; 41\" Location=\"77; 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"77; 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"265; 263\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity2\" Size=\"150; 122\" Location=\"441; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130; 41\" Location=\"451; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"381; 363\" Location=\"449; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"574; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 222\" Location=\"459; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"step1IfElseBranchActivity_DoesFolderExist\" Size=\"150; 122\" Location=\"478; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"488; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"651; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"661; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"441; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"451; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"451; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"453; 472\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity3\" Size=\"150; 242\" Location=\"461; 503\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity\" Size=\"130; 41\" Location=\"471; 565\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"471; 625\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"471; 685\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"868; 599\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelActivity\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddNewMediaFolderWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewMediaFolderWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"142\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"599\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"AddNewMediaFolderWorkflowInitialState\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewMediaFolderWorkflowInitialState\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity1\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"230\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"263\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"468\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"540\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"540\" Y=\"472\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"636\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"650\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"650\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"538\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"538\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"472\" Y=\"352\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"352\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"599\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity3\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"624\" Y=\"513\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"513\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"599\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/DeleteMediaFileWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class DeleteMediaFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.branchHasNoRelatedData = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branchHasRelatedData = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.ifElseHasRelatedData = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.deleteCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.eventDrivenActivity2 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.deleteEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.deleteEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.checkRelatedDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.DeleteMediaFileWorkflowInitialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"DeleteMediaFileWorkflowInitialState\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteMediaFileConfirmRemovingRelatedData.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // branchHasNoRelatedData\r\n            // \r\n            this.branchHasNoRelatedData.Activities.Add(this.setStateActivity6);\r\n            this.branchHasNoRelatedData.Name = \"branchHasNoRelatedData\";\r\n            // \r\n            // branchHasRelatedData\r\n            // \r\n            this.branchHasRelatedData.Activities.Add(this.confirmDialogFormActivity1);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasDataReferences);\r\n            this.branchHasRelatedData.Condition = codecondition1;\r\n            this.branchHasRelatedData.Name = \"branchHasRelatedData\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseHasRelatedData\r\n            // \r\n            this.ifElseHasRelatedData.Activities.Add(this.branchHasRelatedData);\r\n            this.ifElseHasRelatedData.Activities.Add(this.branchHasNoRelatedData);\r\n            this.ifElseHasRelatedData.Name = \"ifElseHasRelatedData\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // deleteCodeActivity\r\n            // \r\n            this.deleteCodeActivity.Name = \"deleteCodeActivity\";\r\n            this.deleteCodeActivity.ExecuteCode += new System.EventHandler(this.deleteCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeleteMediaFile.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // eventDrivenActivity2\r\n            // \r\n            this.eventDrivenActivity2.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.eventDrivenActivity2.Activities.Add(this.setStateActivity7);\r\n            this.eventDrivenActivity2.Name = \"eventDrivenActivity2\";\r\n            // \r\n            // eventDrivenActivity_Finish\r\n            // \r\n            this.eventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.eventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.eventDrivenActivity_Finish.Name = \"eventDrivenActivity_Finish\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.ifElseHasRelatedData);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.deleteCodeActivity);\r\n            this.stateInitializationActivity1.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // deleteEventDrivenActivity_Cancel\r\n            // \r\n            this.deleteEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.deleteEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.deleteEventDrivenActivity_Cancel.Name = \"deleteEventDrivenActivity_Cancel\";\r\n            // \r\n            // initializationActivity\r\n            // \r\n            this.initializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.initializationActivity.Name = \"initializationActivity\";\r\n            // \r\n            // deleteEventDrivenActivity_Finish\r\n            // \r\n            this.deleteEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.deleteEventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.deleteEventDrivenActivity_Finish.Name = \"deleteEventDrivenActivity_Finish\";\r\n            // \r\n            // checkRelatedDataStateActivity\r\n            // \r\n            this.checkRelatedDataStateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_Finish);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity2);\r\n            this.checkRelatedDataStateActivity.Name = \"checkRelatedDataStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // DeleteMediaFileWorkflowInitialState\r\n            // \r\n            this.DeleteMediaFileWorkflowInitialState.Activities.Add(this.deleteEventDrivenActivity_Finish);\r\n            this.DeleteMediaFileWorkflowInitialState.Activities.Add(this.initializationActivity);\r\n            this.DeleteMediaFileWorkflowInitialState.Activities.Add(this.deleteEventDrivenActivity_Cancel);\r\n            this.DeleteMediaFileWorkflowInitialState.Name = \"DeleteMediaFileWorkflowInitialState\";\r\n            // \r\n            // DeleteMediaFileWorkflow\r\n            // \r\n            this.Activities.Add(this.DeleteMediaFileWorkflowInitialState);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.checkRelatedDataStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"checkRelatedDataStateActivity\";\r\n            this.Name = \"DeleteMediaFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private CodeActivity deleteCodeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity deleteEventDrivenActivity_Finish;\r\n        private StateActivity finalizeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity wizzardFormActivity1;\r\n        private StateInitializationActivity initializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity deleteEventDrivenActivity_Cancel;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity branchHasNoRelatedData;\r\n        private IfElseBranchActivity branchHasRelatedData;\r\n        private IfElseActivity ifElseHasRelatedData;\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n        private StateActivity checkRelatedDataStateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_Finish;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private EventDrivenActivity eventDrivenActivity2;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private StateActivity DeleteMediaFileWorkflowInitialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/DeleteMediaFileWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteMediaFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteMediaFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void HasDataReferences(object sender, ConditionalEventArgs e)\r\n        {\r\n            IData mediaFile = ((DataEntityToken)this.EntityToken).Data;\r\n\r\n            var brokenReferences = new List<IData>();\r\n\r\n            var references = DataReferenceFacade.GetNotOptionalReferences(mediaFile);\r\n            foreach (var reference in references)\r\n            {\r\n                DataSourceId dataSourceId = reference.DataSourceId;\r\n                if (brokenReferences.Any(brokenRef => brokenRef.DataSourceId == dataSourceId))\r\n                {\r\n                    continue;\r\n                }\r\n\r\n                brokenReferences.Add(reference);\r\n            }\r\n\r\n            e.Result = brokenReferences.Count > 0;\r\n            if (brokenReferences.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            Bindings.Add(\"ReferencedData\", DataReferenceFacade.GetBrokenReferencesReport(brokenReferences));\r\n        }\r\n\r\n\r\n        private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n            IMediaFile file = (IMediaFile)token.Data;\r\n\r\n            if (DataFacade.WillDeleteSucceed(file))\r\n            {\r\n                DataFacade.Delete(file);\r\n\r\n                treeRefresher.PostRefreshMesseges(true);\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Management\", \"DeleteMediaFileWorkflow.CascadeDeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Management\", \"DeleteMediaFileWorkflow.CascadeDeleteErrorMessage\")\r\n                    );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/DeleteMediaFileWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteMediaFileWorkflow\" Location=\"30; 30\" Size=\"904; 530\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteMediaFileWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteMediaFileWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"235\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"DeleteMediaFileWorkflowInitialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"DeleteMediaFileWorkflowInitialState\" EventHandlerName=\"deleteEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"493\" />\r\n\t\t\t\t<ns0:Point X=\"319\" Y=\"493\" />\r\n\t\t\t\t<ns0:Point X=\"319\" Y=\"436\" />\r\n\t\t\t\t<ns0:Point X=\"816\" Y=\"436\" />\r\n\t\t\t\t<ns0:Point X=\"816\" Y=\"444\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"DeleteMediaFileWorkflowInitialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteMediaFileWorkflowInitialState\" EventHandlerName=\"deleteEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"287\" Y=\"517\" />\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"517\" />\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"227\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"227\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"235\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"900\" Y=\"485\" />\r\n\t\t\t\t<ns0:Point X=\"915\" Y=\"485\" />\r\n\t\t\t\t<ns0:Point X=\"915\" Y=\"227\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"227\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"235\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"DeleteMediaFileWorkflowInitialState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"DeleteMediaFileWorkflowInitialState\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"stateInitializationActivity2\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"234\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"184\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"184\" Y=\"428\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"eventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"238\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"258\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"258\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"816\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"816\" Y=\"444\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"eventDrivenActivity2\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"209\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"235\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"DeleteMediaFileWorkflowInitialState\" Location=\"77; 428\" Size=\"214; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"deleteEventDrivenActivity_Finish\" Location=\"85; 483\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"95; 545\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"95; 605\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializationActivity\" Location=\"85; 459\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"95; 521\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"deleteEventDrivenActivity_Cancel\" Location=\"85; 507\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"95; 569\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"95; 629\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"739; 235\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"729; 444\" Size=\"175; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"stateInitializationActivity1\" Location=\"737; 475\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"deleteCodeActivity\" Location=\"747; 537\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"747; 597\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"747; 657\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"checkRelatedDataStateActivity\" Location=\"63; 128\" Size=\"183; 118\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"stateInitializationActivity2\" Location=\"250; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseHasRelatedData\" Location=\"260; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"branchHasRelatedData\" Location=\"279; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"289; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"branchHasNoRelatedData\" Location=\"452; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"462; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Finish\" Location=\"242; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"252; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"252; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity2\" Location=\"242; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"252; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"252; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/DeleteMediaFolderWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class DeleteMediaFolderWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.branchHasNoRelatedData = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branchHasRelatedData = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseHasRelatedData = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.deleteCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.deleteEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.deleteEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.checkRelatedDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmationStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.stateActivity1 = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"confirmationStateActivity\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteMediaFolderConfirmDeletingRelatedData.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // branchHasNoRelatedData\r\n            // \r\n            this.branchHasNoRelatedData.Activities.Add(this.setStateActivity6);\r\n            this.branchHasNoRelatedData.Name = \"branchHasNoRelatedData\";\r\n            // \r\n            // branchHasRelatedData\r\n            // \r\n            this.branchHasRelatedData.Activities.Add(this.confirmDialogFormActivity1);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasDataReferences);\r\n            this.branchHasRelatedData.Condition = codecondition1;\r\n            this.branchHasRelatedData.Name = \"branchHasRelatedData\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"stateActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // ifElseHasRelatedData\r\n            // \r\n            this.ifElseHasRelatedData.Activities.Add(this.branchHasRelatedData);\r\n            this.ifElseHasRelatedData.Activities.Add(this.branchHasNoRelatedData);\r\n            this.ifElseHasRelatedData.Name = \"ifElseHasRelatedData\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"stateActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeleteMediaFolder.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // deleteCodeActivity\r\n            // \r\n            this.deleteCodeActivity.Name = \"deleteCodeActivity\";\r\n            this.deleteCodeActivity.ExecuteCode += new System.EventHandler(this.deleteCodeActivity_ExecuteCode);\r\n            // \r\n            // eventDrivenActivity_Finish\r\n            // \r\n            this.eventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.eventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.eventDrivenActivity_Finish.Name = \"eventDrivenActivity_Finish\";\r\n            // \r\n            // eventDrivenActivity_Cancel\r\n            // \r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity7);\r\n            this.eventDrivenActivity_Cancel.Name = \"eventDrivenActivity_Cancel\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.ifElseHasRelatedData);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // deleteEventDrivenActivity_Cancel\r\n            // \r\n            this.deleteEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.deleteEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.deleteEventDrivenActivity_Cancel.Name = \"deleteEventDrivenActivity_Cancel\";\r\n            // \r\n            // deleteEventDrivenActivity_Finish\r\n            // \r\n            this.deleteEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.deleteEventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.deleteEventDrivenActivity_Finish.Name = \"deleteEventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // finalizeActivity\r\n            // \r\n            this.finalizeActivity.Activities.Add(this.deleteCodeActivity);\r\n            this.finalizeActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeActivity.Name = \"finalizeActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // checkRelatedDataStateActivity\r\n            // \r\n            this.checkRelatedDataStateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_Cancel);\r\n            this.checkRelatedDataStateActivity.Activities.Add(this.eventDrivenActivity_Finish);\r\n            this.checkRelatedDataStateActivity.Name = \"checkRelatedDataStateActivity\";\r\n            // \r\n            // confirmationStateActivity\r\n            // \r\n            this.confirmationStateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.confirmationStateActivity.Activities.Add(this.deleteEventDrivenActivity_Finish);\r\n            this.confirmationStateActivity.Activities.Add(this.deleteEventDrivenActivity_Cancel);\r\n            this.confirmationStateActivity.Name = \"confirmationStateActivity\";\r\n            // \r\n            // stateActivity1\r\n            // \r\n            this.stateActivity1.Activities.Add(this.finalizeActivity);\r\n            this.stateActivity1.Name = \"stateActivity1\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // DeleteMediaFolderWorkflow\r\n            // \r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.stateActivity1);\r\n            this.Activities.Add(this.confirmationStateActivity);\r\n            this.Activities.Add(this.checkRelatedDataStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"checkRelatedDataStateActivity\";\r\n            this.Name = \"DeleteMediaFolderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity deleteCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity finalizeActivity;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity stateActivity1;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity wizzardFormActivity1;\r\n        private EventDrivenActivity deleteEventDrivenActivity_Finish;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity deleteEventDrivenActivity_Cancel;\r\n        private CodeActivity codeActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity branchHasNoRelatedData;\r\n        private IfElseBranchActivity branchHasRelatedData;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private IfElseActivity ifElseHasRelatedData;\r\n        private EventDrivenActivity eventDrivenActivity_Cancel;\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n        private StateActivity checkRelatedDataStateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_Finish;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private StateActivity confirmationStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/DeleteMediaFolderWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Types.StoreIdFilter;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Transactions;\r\nusing Composite.C1Console.Workflow;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Management;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteMediaFolderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteMediaFolderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void HasDataReferences(object sender, ConditionalEventArgs e)\r\n        {\r\n            var token = (DataEntityToken)this.EntityToken;\r\n            var folder = (IMediaFileFolder)token.Data;\r\n\r\n            string storeId = folder.StoreId;\r\n            string parentPath = folder.Path;\r\n\r\n            string innerElementsPathPrefix = $\"{parentPath}/\";\r\n\r\n            var fileQueryable = new StoreIdFilterQueryable<IMediaFile>(DataFacade.GetData<IMediaFile>(), storeId);\r\n            IEnumerable<IMediaFile> childFiles =\r\n                (from item in fileQueryable\r\n                 where item.FolderPath.StartsWith(innerElementsPathPrefix) || item.FolderPath == parentPath\r\n                 select item).Evaluate();\r\n\r\n            var brokenReferences = new List<IData>();\r\n\r\n            foreach (IMediaFile mediaFile in childFiles)\r\n            {\r\n                List<IData> references = DataReferenceFacade.GetNotOptionalReferences(mediaFile);\r\n                foreach (IData reference in references)\r\n                {\r\n                    if (brokenReferences.Any(data => data.DataSourceId.Equals(reference.DataSourceId)))\r\n                    {\r\n                        continue;\r\n                    }\r\n                    brokenReferences.Add(reference);\r\n                }\r\n            }\r\n\r\n            e.Result = brokenReferences.Count > 0;\r\n            if (brokenReferences.Count == 0)\r\n            {\r\n                return;\r\n            }\r\n\r\n            Bindings.Add(\"ReferencedData\", DataReferenceFacade.GetBrokenReferencesReport(brokenReferences));\r\n        }\r\n\r\n\r\n        private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IMediaFileFolder folder = DataFacade.GetDataFromDataSourceId(token.DataSourceId, false) as IMediaFileFolder;\r\n\r\n                // Media folder may already be deleted at this point\r\n                if (folder != null)\r\n                {\r\n                    if (!DataFacade.WillDeleteSucceed(folder))\r\n                    {\r\n                        this.ShowMessage(DialogType.Error,\r\n                                Texts.DeleteMediaFolderWorkflow_CascadeDeleteErrorTitle,\r\n                                Texts.DeleteMediaFolderWorkflow_CascadeDeleteErrorMessage);\r\n\r\n                        return;\r\n                    }\r\n\r\n                    DataFacade.Delete(folder);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            treeRefresher.PostRefreshMesseges();\r\n        }\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var token = (DataEntityToken)this.EntityToken;\r\n            var folder = (IMediaFileFolder)token.Data;\r\n\r\n            string storeId = folder.StoreId;\r\n            string parentPath = folder.Path;\r\n\r\n            var folderQueryable = new StoreIdFilterQueryable<IMediaFileFolder>(DataFacade.GetData<IMediaFileFolder>(), storeId);\r\n            var fileQueryable = new StoreIdFilterQueryable<IMediaFile>(DataFacade.GetData<IMediaFile>(), storeId);\r\n\r\n            string innerElementsPathPrefix = $\"{parentPath}/\";\r\n\r\n            bool anyFiles =\r\n                (from item in fileQueryable\r\n                 where item.FolderPath.StartsWith(innerElementsPathPrefix) || item.FolderPath == parentPath\r\n                 select item).Any();\r\n\r\n            bool anyFolders =\r\n                (from item in folderQueryable\r\n                 where item.Path.StartsWith(innerElementsPathPrefix)\r\n                 select item).Any();\r\n\r\n            var message = !anyFiles && !anyFolders\r\n                ? Texts.Website_Forms_Administrative_DeleteMediaFolder_Text\r\n                : Texts.Website_Forms_Administrative_DeleteMediaFolder_HasChildringText;\r\n\r\n            this.Bindings.Add(\"MessageText\", message);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/DeleteMediaFolderWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteMediaFolderWorkflow\" Location=\"30; 30\" Size=\"948; 486\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteMediaFolderWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteMediaFolderWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"868\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"868\" Y=\"406\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"stateActivity1\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"stateActivity1\" EventHandlerName=\"finalizeActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"607\" Y=\"256\" />\r\n\t\t\t\t<ns0:Point X=\"868\" Y=\"256\" />\r\n\t\t\t\t<ns0:Point X=\"868\" Y=\"406\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"stateActivity1\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"confirmationStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"stateActivity1\" SourceActivity=\"confirmationStateActivity\" EventHandlerName=\"deleteEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"411\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"411\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"207\" />\r\n\t\t\t\t<ns0:Point X=\"572\" Y=\"207\" />\r\n\t\t\t\t<ns0:Point X=\"572\" Y=\"215\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"confirmationStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"confirmationStateActivity\" EventHandlerName=\"deleteEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"435\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"435\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"868\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"868\" Y=\"406\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"confirmationStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"confirmationStateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"stateInitializationActivity2\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"287\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"334\" />\r\n\t\t\t\t<ns0:Point X=\"203\" Y=\"334\" />\r\n\t\t\t\t<ns0:Point X=\"203\" Y=\"346\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"eventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"295\" Y=\"174\" />\r\n\t\t\t\t<ns0:Point X=\"868\" Y=\"174\" />\r\n\t\t\t\t<ns0:Point X=\"868\" Y=\"406\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"stateActivity1\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"checkRelatedDataStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"stateActivity1\" SourceActivity=\"checkRelatedDataStateActivity\" EventHandlerName=\"eventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"291\" Y=\"198\" />\r\n\t\t\t\t<ns0:Point X=\"572\" Y=\"198\" />\r\n\t\t\t\t<ns0:Point X=\"572\" Y=\"215\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"788; 406\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"stateActivity1\" Location=\"492; 215\" Size=\"160; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeActivity\" Location=\"500; 246\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"deleteCodeActivity\" Location=\"510; 308\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"510; 368\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"510; 428\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"confirmationStateActivity\" Location=\"96; 346\" Size=\"214; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"step1StateInitializationActivity\" Location=\"104; 377\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity1\" Location=\"114; 439\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"114; 499\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"deleteEventDrivenActivity_Finish\" Location=\"104; 401\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"114; 463\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"114; 523\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"deleteEventDrivenActivity_Cancel\" Location=\"104; 425\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"114; 487\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"114; 547\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"checkRelatedDataStateActivity\" Location=\"116; 109\" Size=\"183; 118\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"stateInitializationActivity2\" Location=\"250; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseHasRelatedData\" Location=\"260; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"branchHasRelatedData\" Location=\"279; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"289; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"branchHasNoRelatedData\" Location=\"452; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"462; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Cancel\" Location=\"242; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"252; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"252; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Finish\" Location=\"242; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"252; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"252; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileContentWorkflow.cs",
    "content": "using System;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    /// <summary>\r\n    /// Fictive workflow. Is used by ImageManipulatior in order to raise events in task system\r\n    /// </summary>\r\n    public sealed partial class EditMediaFileContentWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditMediaFileContentWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n            IMediaFile file = (IMediaFile)token.Data;\r\n\r\n            this.Bindings.Add(\"FileName\", file.FileName);\r\n            this.Bindings.Add(\"FileMimeType\", file.MimeType);\r\n\r\n            SetSaveStatus(true);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileContentWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class EditMediaFileContentWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditMediaFileContentWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditMediaFileContentWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private StateActivity finalStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileContentWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditMediaFileContentWorkflow\" Location=\"30; 30\" Size=\"1086; 642\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditMediaFileContentWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditMediaFileContentWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"664\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"664\" Y=\"285\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"238\" />\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"389\" />\r\n\t\t\t\t<ns0:Point X=\"653\" Y=\"389\" />\r\n\t\t\t\t<ns0:Point X=\"653\" Y=\"365\" />\r\n\t\t\t\t<ns0:Point X=\"664\" Y=\"365\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"63; 197\" Size=\"197; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initialStateInitializationActivity\" Location=\"71; 228\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"81; 290\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"81; 350\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"584; 285\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileTextContentWorkflow.cs",
    "content": "using System;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditMediaFileTextContentWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditMediaFileTextContentWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        \r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n            IMediaFile file = (IMediaFile)token.Data;\r\n\r\n            string content = file.ReadAllText();\r\n\r\n            this.Bindings.Add(\"FileContent\", content);\r\n            this.Bindings.Add(\"FileName\", file.FileName);\r\n            this.Bindings.Add(\"FileMimeType\", file.MimeType);\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n            IMediaFile file = (IMediaFile)token.Data;\r\n\r\n            string content = this.GetBinding<string>(\"FileContent\");\r\n\r\n            file.SetNewContent(content);\r\n            DataFacade.Update(file);\r\n\r\n            SetSaveStatus(true);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileTextContentWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class EditMediaFileTextContentWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditMediaFileTextContent.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditMediaFileTextContentWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditMediaFileTextContentWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private CodeActivity saveCodeActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class EditMediaFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editMediaFileStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editMediaFileStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateInputs);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editMediaFileStateActivity\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditMediaFile.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editMediaFileStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.ifElseActivity1);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // editMediaFileStateActivity\r\n            // \r\n            this.editMediaFileStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editMediaFileStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editMediaFileStateActivity.Name = \"editMediaFileStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditMediaFileWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editMediaFileStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditMediaFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity editMediaFileStateActivity;\r\n\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private CodeActivity finalizeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing System.Workflow.Activities;\r\nusing System.Collections.Generic;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Data.Validation;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditMediaFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditMediaFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n            IMediaFile file = (IMediaFile)token.Data;\r\n            IMediaFileStore store = DataFacade.GetData<IMediaFileStore>(x => x.Id == file.StoreId).First();\r\n            var mediaURL = Composite.Core.Routing.MediaUrls.BuildUrl(file);\r\n\r\n            this.Bindings.Add(\"FileDataFileName\", file.FileName);\r\n            this.Bindings.Add(\"FileDataTitle\", file.Title);\r\n            this.Bindings.Add(\"FileDataURL\", mediaURL);\r\n            this.Bindings.Add(\"FileDataDescription\", file.Description);\r\n            this.Bindings.Add(\"FileDataTags\", file.Tags);\r\n            this.Bindings.Add(\"ProvidesMetaData\", store.ProvidesMetadata);\r\n\r\n            this.BindingsValidationRules.Add(\"FileDataTitle\", new List<ClientValidationRule> { new StringLengthClientValidationRule(0, 256) });\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n            IMediaFile file = (IMediaFile)token.Data;\r\n            IMediaFileStore store = DataFacade.GetData<IMediaFileStore>(x => x.Id == file.StoreId).First();\r\n\r\n            file.FileName = this.GetBinding<string>(\"FileDataFileName\");\r\n            file.Title = this.GetBinding<string>(\"FileDataTitle\");\r\n            file.Description = this.GetBinding<string>(\"FileDataDescription\");\r\n            file.Tags = this.GetBinding<string>(\"FileDataTags\");\r\n\r\n            DataFacade.Update(file);\r\n\r\n            SetSaveStatus(true);\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(file.GetDataEntityToken());\r\n        }\r\n\r\n\r\n\r\n        private void ValidateInputs(object sender, ConditionalEventArgs e)\r\n        {\r\n            IMediaFile file = this.GetDataItemFromEntityToken<IMediaFile>();\r\n\r\n            string filename = this.GetBinding<string>(\"FileDataFileName\");\r\n\r\n            string compositePath = IMediaFileExtensions.GetCompositePath(file.StoreId, file.FolderPath, filename);\r\n            if (compositePath.Length > 2048)\r\n            {\r\n                this.ShowFieldMessage(\"FileDataFileName\", \"${Composite.Management, Website.Forms.Administrative.EditMediaFile.TotalFilenameToLong.Message}\");\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            Guid mediaFileId = file.Id;\r\n            if(DataFacade.GetData<IMediaFile>()\r\n                .Any(mediaFile => string.Compare(mediaFile.CompositePath, compositePath, StringComparison.InvariantCultureIgnoreCase) == 0\r\n                                  && mediaFile.Id != mediaFileId))\r\n            {\r\n                this.ShowFieldMessage(\"FileDataFileName\", \"${Composite.Management, Website.Forms.Administrative.EditMediaFile.FileExists.Message}\");\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFileWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1190; 986\" AutoSizeMargin=\"16; 24\" Location=\"30; 30\" Name=\"EditMediaFileWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"197; 80\" AutoSizeMargin=\"16; 24\" Location=\"84; 105\" Name=\"initialState\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150; 182\" Location=\"92; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130; 41\" Location=\"102; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"102; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"189; 94\" AutoSizeMargin=\"16; 24\" Location=\"269; 290\" Name=\"editMediaFileStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 122\" Location=\"277; 321\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130; 41\" Location=\"287; 383\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_Save\" Size=\"381; 363\" Location=\"277; 345\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"402; 407\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 222\" Location=\"287; 467\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"306; 538\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"316; 600\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"479; 538\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"489; 600\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"608; 408\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"616; 439\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity\" Size=\"130; 41\" Location=\"626; 501\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"626; 561\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"1017; 853\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity1\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditMediaFileWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditMediaFileWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity1\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1097\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1097\" Y=\"853\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editMediaFileStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initialState\" TargetConnectionIndex=\"0\" SourceStateName=\"initialState\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editMediaFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"277\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"290\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"editMediaFileStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editMediaFileStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"439\" Y=\"355\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"355\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"408\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editMediaFileStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"editMediaFileStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editMediaFileStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"editMediaFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"439\" Y=\"355\" />\r\n\t\t\t\t<ns0:Point X=\"467\" Y=\"355\" />\r\n\t\t\t\t<ns0:Point X=\"467\" Y=\"282\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"282\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"290\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editMediaFileStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editMediaFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"809\" Y=\"449\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"449\" />\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"282\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"282\" />\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"290\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFolderWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class EditMediaFolderWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.saveEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializationStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eidtStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"eidtStateActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateInputs);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"eidtStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\EditMediaFolder.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"eidtStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // saveEventDrivenActivity\r\n            // \r\n            this.saveEventDrivenActivity.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.saveEventDrivenActivity.Activities.Add(this.ifElseActivity1);\r\n            this.saveEventDrivenActivity.Name = \"saveEventDrivenActivity\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializationStateInitializationActivity\r\n            // \r\n            this.initializationStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initializationStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initializationStateInitializationActivity.Name = \"initializationStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // eidtStateActivity\r\n            // \r\n            this.eidtStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.eidtStateActivity.Activities.Add(this.saveEventDrivenActivity);\r\n            this.eidtStateActivity.Name = \"eidtStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initializationStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditMediaFolderWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.eidtStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditMediaFolderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity initializationStateInitializationActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity eidtStateActivity;\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity saveEventDrivenActivity;\r\n\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private CodeActivity saveCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFolderWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditMediaFolderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditMediaFolderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IMediaFileFolder folder = this.GetDataItemFromEntityToken<IMediaFileFolder>();\r\n            IMediaFileStore store = DataFacade.GetData<IMediaFileStore>(x => x.Id == folder.StoreId).First();\r\n            \r\n            this.Bindings.Add(\"FolderTitle\", folder.Title);\r\n            this.Bindings.Add(\"FolderDescription\", folder.Description);\r\n            this.Bindings.Add(\"FolderName\", folder.Path.GetFolderName('/'));\r\n            this.Bindings.Add(\"ProvidesMetaData\", store.ProvidesMetadata);\r\n            this.Bindings.Add(\"OldFolderPath\", folder.Path);\r\n\r\n            this.BindingsValidationRules.Add(\"FolderName\", new List<ClientValidationRule> { new NotNullClientValidationRule() });\r\n            this.BindingsValidationRules.Add(\"FolderTitle\", new List<ClientValidationRule> { new StringLengthClientValidationRule(0, 256) });            \r\n        }\r\n\r\n\r\n        private string CreateFolderPath()\r\n        {\r\n            string updatedFoldername = this.GetBinding<string>(\"FolderName\");\r\n            string folderPath = this.GetBinding<string>(\"OldFolderPath\");\r\n\r\n            string currentName = folderPath.GetFolderName('/');\r\n\r\n            folderPath = folderPath.Remove(folderPath.Length - currentName.Length);\r\n            folderPath = folderPath + updatedFoldername;\r\n\r\n            return folderPath;\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n            \r\n            IMediaFileFolder folder = this.GetDataItemFromEntityToken<IMediaFileFolder>();            \r\n\r\n            folder.Path = CreateFolderPath();\r\n            folder.Title = this.GetBinding<string>(\"FolderTitle\");\r\n            folder.Description = this.GetBinding<string>(\"FolderDescription\");\r\n\r\n            DataFacade.Update(folder);\r\n\r\n            SetSaveStatus(true);\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(folder.GetDataEntityToken());\r\n        }\r\n\r\n\r\n\r\n        private void ValidateInputs(object sender, ConditionalEventArgs e)\r\n        {\r\n            IMediaFileFolder folder = this.GetDataItemFromEntityToken<IMediaFileFolder>();            \r\n\r\n            string oldFolderPath = this.GetBinding<string>(\"OldFolderPath\");\r\n            string folderPath = CreateFolderPath();\r\n\r\n            if (oldFolderPath != folderPath)\r\n            {\r\n                Guid folderId = folder.Id;\r\n\r\n                if (DataFacade.GetData<IMediaFileFolder>()\r\n                    .Any(f => string.Compare(f.Path, folderPath, StringComparison.OrdinalIgnoreCase) == 0\r\n                              && f.Id != folderId))\r\n                {\r\n                    ShowFieldMessage(\"FolderName\", StringResourceSystemFacade.GetString(\"Composite.Management\", \"Website.Forms.Administrative.AddNewMediaFolder.FolderNameAlreadyUsed\"));\r\n                    e.Result = false;\r\n                    return;\r\n                }\r\n\r\n                IEnumerable<string> filenames = DataFacade.GetData<IMediaFile>().Where(f => f.FolderPath == oldFolderPath).Select(f => f.FileName);\r\n                foreach (string filename in filenames)\r\n                {\r\n                    string compositePath = IMediaFileExtensions.GetCompositePath(folder.StoreId, folderPath, filename);\r\n                    if (compositePath.Length > 2048)\r\n                    {\r\n                        this.ShowFieldMessage(\"FolderName\", \"${Composite.Management, Website.Forms.Administrative.EditMediaFolder.TotalFilenameToLong.Message}\");\r\n                        e.Result = false;\r\n                        return;\r\n                    }\r\n                }\r\n            }            \r\n\r\n            e.Result = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/EditMediaFolderWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1190; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditMediaFolderWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"229; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 105\" Name=\"initialState\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializationStateInitializationActivity\" Size=\"150; 182\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130; 41\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"189; 94\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"155; 346\" Name=\"eidtStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 122\" Location=\"426; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130; 41\" Location=\"436; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"saveEventDrivenActivity\" Size=\"381; 363\" Location=\"434; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"559; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 222\" Location=\"444; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"463; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"473; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"636; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"646; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"485; 491\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"493; 522\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity\" Size=\"130; 41\" Location=\"503; 584\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"503; 644\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"733; 624\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity1\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditMediaFolderWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditMediaFolderWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity1\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"813\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"813\" Y=\"624\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"eidtStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initialState\" TargetConnectionIndex=\"0\" SourceStateName=\"initialState\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializationStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"eidtStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"297\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"297\" Y=\"334\" />\r\n\t\t\t\t<ns0:Point X=\"249\" Y=\"334\" />\r\n\t\t\t\t<ns0:Point X=\"249\" Y=\"346\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"eidtStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"eidtStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveEventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"318\" Y=\"411\" />\r\n\t\t\t\t<ns0:Point X=\"587\" Y=\"411\" />\r\n\t\t\t\t<ns0:Point X=\"587\" Y=\"491\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"eidtStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"eidtStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"eidtStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveEventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"eidtStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"616\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"616\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"512\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"512\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"eidtStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"eidtStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"686\" Y=\"532\" />\r\n\t\t\t\t<ns0:Point X=\"697\" Y=\"532\" />\r\n\t\t\t\t<ns0:Point X=\"697\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"249\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"249\" Y=\"346\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/UploadNewMediaFileWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    partial class UploadNewMediaFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showConsoleMessageBoxActivity1 = new Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finishEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showUploadStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"showUploadStateActivity\";\r\n            // \r\n            // showConsoleMessageBoxActivity1\r\n            // \r\n            this.showConsoleMessageBoxActivity1.DialogType = Composite.C1Console.Events.DialogType.Error;\r\n            this.showConsoleMessageBoxActivity1.Message = \"${Composite.Management,Website.Forms.Administrative.UploadMediaFile.EmptyFileErro\" +\r\n                \"rMessage}\";\r\n            this.showConsoleMessageBoxActivity1.Name = \"showConsoleMessageBoxActivity1\";\r\n            this.showConsoleMessageBoxActivity1.Title = \"${Composite.Management,Website.Forms.Administrative.UploadMediaFile.EmptyFileErro\" +\r\n                \"rTitle}\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.uploadCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.showConsoleMessageBoxActivity1);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.codeActivity1);\r\n            this.ifElseBranchActivity1.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasUserUploaded);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"/Administrative/UploadNewMediaFile.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"showUploadStateActivity\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity5);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finishEventDrivenActivity\r\n            // \r\n            this.finishEventDrivenActivity.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.finishEventDrivenActivity.Activities.Add(this.ifElseActivity1);\r\n            this.finishEventDrivenActivity.Name = \"finishEventDrivenActivity\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.wizzardFormActivity1);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.codeActivity2);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // showUploadStateActivity\r\n            // \r\n            this.showUploadStateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.showUploadStateActivity.Activities.Add(this.finishEventDrivenActivity);\r\n            this.showUploadStateActivity.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.showUploadStateActivity.Name = \"showUploadStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.stateInitializationActivity1);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // UploadNewMediaFileWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.showUploadStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"UploadNewMediaFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity showUploadStateActivity;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private CodeActivity codeActivity1;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private CodeActivity codeActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity finishEventDrivenActivity;\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity showConsoleMessageBoxActivity1;\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/UploadNewMediaFileWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Never)]\r\n    public sealed partial class UploadNewMediaFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public UploadNewMediaFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            FormsWorkflow workflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n            IMediaFile mediaFile = (IMediaFile)token.Data;\r\n\r\n            UploadedFile file = new UploadedFile();\r\n\r\n            workflow.Bindings.Add(\"UploadedFile\", file);\r\n            workflow.Bindings.Add(\"File\", mediaFile);\r\n        }\r\n\r\n\r\n\r\n\r\n        private void uploadCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            var managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n            IMediaFile mediaFile = this.GetBinding<IMediaFile>(\"File\");\r\n\r\n            if (uploadedFile.HasFile)\r\n            {\r\n                string mimeType = MimeTypeInfo.GetMimeType(uploadedFile);\r\n\r\n                // Image cannot be replaced with a file of not image mime type\r\n                string imageMimeTypePrefix = \"image/\";\r\n                if ((mediaFile.MimeType.StartsWith(imageMimeTypePrefix, StringComparison.OrdinalIgnoreCase)\r\n                     && !mimeType.StartsWith(imageMimeTypePrefix, StringComparison.OrdinalIgnoreCase)))\r\n                {\r\n                    managementConsoleMessageService.CloseCurrentView();\r\n                    string failure = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UploadNewMediaFileWorkflow.UploadFailure\");\r\n                    string failureMessage = StringResourceSystemFacade.GetString(\"Composite.Management\", \"UploadNewMediaFileWorkflow.UploadFailureMessage\");\r\n                    managementConsoleMessageService.ShowMessage(DialogType.Message, failure, failureMessage);\r\n                    return;\r\n                }\r\n\r\n                using (System.IO.Stream readStream = uploadedFile.FileStream)\r\n                {\r\n                    using (System.IO.Stream writeStream = mediaFile.GetNewWriteStream())\r\n                    {\r\n                        readStream.CopyTo(writeStream);\r\n                    }\r\n                }\r\n            }\r\n\r\n            DataFacade.Update(mediaFile);\r\n\r\n            SetSaveStatus(true);\r\n\r\n            SelectElement(mediaFile.GetDataEntityToken());\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(mediaFile.GetDataEntityToken());\r\n        }\r\n\r\n\r\n\r\n        private void HasUserUploaded(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n            e.Result = uploadedFile.HasFile;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MediaFileProviderElementProvider/UploadNewMediaFileWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"UploadNewMediaFileWorkflow\" Location=\"30; 30\" Size=\"1251; 601\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"UploadNewMediaFileWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"UploadNewMediaFileWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"675\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"675\" Y=\"233\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showUploadStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"showUploadStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"228\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"241\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"241\" Y=\"272\" />\r\n\t\t\t\t<ns0:Point X=\"169\" Y=\"272\" />\r\n\t\t\t\t<ns0:Point X=\"169\" Y=\"284\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"showUploadStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"showUploadStateActivity\" EventHandlerName=\"finishEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"349\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"349\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"225\" />\r\n\t\t\t\t<ns0:Point X=\"675\" Y=\"225\" />\r\n\t\t\t\t<ns0:Point X=\"675\" Y=\"233\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showUploadStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"showUploadStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"showUploadStateActivity\" SourceActivity=\"showUploadStateActivity\" EventHandlerName=\"finishEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"616\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"633\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"633\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"537\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"537\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"showUploadStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"showUploadStateActivity\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"253\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"225\" />\r\n\t\t\t\t<ns0:Point X=\"675\" Y=\"225\" />\r\n\t\t\t\t<ns0:Point X=\"675\" Y=\"233\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"57; 101\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"stateInitializationActivity1\" Location=\"65; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity2\" Location=\"75; 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"75; 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"showUploadStateActivity\" Location=\"81; 284\" Size=\"176; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"stateInitializationActivity2\" Location=\"457; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"467; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 483\" Name=\"finishEventDrivenActivity\" Location=\"465; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"590; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 342\" Name=\"ifElseActivity1\" Location=\"475; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 242\" Name=\"ifElseBranchActivity1\" Location=\"494; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity1\" Location=\"504; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"504; 463\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"504; 523\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 242\" Name=\"ifElseBranchActivity2\" Location=\"667; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showConsoleMessageBoxActivity1\" Location=\"677; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"677; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"457; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"467; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"467; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"595; 233\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/AddInlineFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    partial class AddInlineFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity_ValidateFunctionName = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_InitBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity4);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateFunctionName);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\InlineFunctionAddFunctionStep1.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity_ValidateFunctionName\r\n            // \r\n            this.ifElseActivity_ValidateFunctionName.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity_ValidateFunctionName.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity_ValidateFunctionName.Name = \"ifElseActivity_ValidateFunctionName\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_InitBindings\r\n            // \r\n            this.initializeCodeActivity_InitBindings.Name = \"initializeCodeActivity_InitBindings\";\r\n            this.initializeCodeActivity_InitBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_InitBindings_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.ifElseActivity_ValidateFunctionName);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_InitBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddInlineFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddInlineFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity_ValidateFunctionName;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n\r\n        private CodeActivity initializeCodeActivity_InitBindings;\r\n\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/AddInlineFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Transactions;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions.Inline;\r\nusing Composite.Functions.ManagedParameters;\r\nusing System.Workflow.Activities;\r\nusing Composite.Functions;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Composite.Data.Validation;\r\n\r\n\r\nnamespace Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    public sealed partial class AddInlineFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n\r\n\r\n        public AddInlineFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_InitBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IInlineFunction function = DataFacade.BuildNew<IInlineFunction>();\r\n            function.Id = Guid.NewGuid();\r\n            function.Namespace = UserSettings.LastSpecifiedNamespace;\r\n\r\n            this.Bindings.Add(\"NewFunction\", function);\r\n\r\n            Dictionary<string, string> templates = new Dictionary<string, string>();\r\n            templates.Add(\"clean\", StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"InlineFunctionMethodTemplate.Clean\"));\r\n            templates.Add(\"parameter\", StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"InlineFunctionMethodTemplate.WithParameters\"));\r\n            templates.Add(\"dataconnection\", StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"InlineFunctionMethodTemplate.DataConnection\"));\r\n\r\n            this.Bindings.Add(\"TemplateOptions\", templates);\r\n            this.Bindings.Add(\"SelectedTemplate\", \"clean\");\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IInlineFunction function = this.GetBinding<IInlineFunction>(\"NewFunction\");\r\n            function.UpdateCodePath();\r\n\r\n            string selectedTemplate = this.GetBinding<string>(\"SelectedTemplate\");\r\n\r\n            string codeTemplate;\r\n            switch (selectedTemplate)\r\n            {\r\n                case \"clean\":\r\n                    codeTemplate = _cleanTemplate;\r\n                    break;\r\n\r\n                case \"parameter\":\r\n                    codeTemplate = _parameterTemplate;\r\n\r\n                    List<ManagedParameterDefinition> parameters = new List<ManagedParameterDefinition>();\r\n\r\n                    ManagedParameterDefinition parameter1 = new ManagedParameterDefinition();\r\n                    parameter1.Id = Guid.NewGuid();\r\n                    parameter1.Name = \"myIntValue\";\r\n                    parameter1.Label = \"myIntValue\";\r\n                    parameter1.HelpText = \"myIntValue\";\r\n                    parameter1.Position = 0;\r\n                    parameter1.Type = typeof(int);\r\n                    parameter1.TestValueFunctionMarkup = \"<f:function xmlns:f=\\\"http://www.composite.net/ns/function/1.0\\\" name=\\\"Composite.Constant.Integer\\\"><f:param name=\\\"Constant\\\" value=\\\"0\\\" /></f:function>\";\r\n                    parameter1.WidgetFunctionMarkup = \"<f:widgetfunction xmlns:f=\\\"http://www.composite.net/ns/function/1.0\\\" name=\\\"Composite.Widgets.Integer.TextBox\\\" label=\\\"myIntValue\\\" bindingsourcename=\\\"\\\"><f:helpdefinition xmlns:f=\\\"http://www.composite.net/ns/function/1.0\\\" helptext=\\\"myIntValue\\\" /></f:widgetfunction>\";\r\n                    parameters.Add(parameter1);\r\n\r\n\r\n                    ManagedParameterDefinition parameter2 = new ManagedParameterDefinition();\r\n                    parameter2.Id = Guid.NewGuid();\r\n                    parameter2.Name = \"myStringValue\";\r\n                    parameter2.Label = \"myStringValue\";\r\n                    parameter2.HelpText = \"myStringValue\";\r\n                    parameter2.Position = 1;\r\n                    parameter2.Type = typeof(string);\r\n                    parameter2.TestValueFunctionMarkup = \"<f:function xmlns:f=\\\"http://www.composite.net/ns/function/1.0\\\" name=\\\"Composite.Constant.String\\\"><f:param name=\\\"Constant\\\" value=\\\"Hello world!\\\" /></f:function>\";\r\n                    parameter2.WidgetFunctionMarkup = \"<f:widgetfunction xmlns:f=\\\"http://www.composite.net/ns/function/1.0\\\" name=\\\"Composite.Widgets.String.TextBox\\\" label=\\\"myStringValue\\\" bindingsourcename=\\\"\\\"><f:helpdefinition xmlns:f=\\\"http://www.composite.net/ns/function/1.0\\\" helptext=\\\"myStringValue\\\" /></f:widgetfunction>\";\r\n                    parameters.Add(parameter2);\r\n\r\n                    ManagedParameterManager.Save(function.Id, parameters);\r\n                    break;\r\n\r\n                case \"dataconnection\":\r\n                    codeTemplate = _dataConnectionTemplate;\r\n                    break;\r\n\r\n                default:\r\n                    throw new NotImplementedException();\r\n            }\r\n\r\n            string code = string.Format(codeTemplate, function.Namespace, InlineFunctionHelper.MethodClassContainerName, function.Name);\r\n            code = code.Replace('', '\\t');\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                foreach (string assemblyPath in InlineFunctionHelper.DefaultAssemblies)\r\n                {\r\n                    IInlineFunctionAssemblyReference reference = DataFacade.BuildNew<IInlineFunctionAssemblyReference>();\r\n                    reference.Id = Guid.NewGuid();\r\n                    reference.Function = function.Id;\r\n                    reference.Name = System.IO.Path.GetFileName(assemblyPath);\r\n                    reference.Location = InlineFunctionHelper.GetAssemblyLocation(assemblyPath);\r\n\r\n                    DataFacade.AddNew(reference);\r\n                }\r\n\r\n                function.SetFunctionCode(code);\r\n\r\n                function = DataFacade.AddNew(function);\r\n\r\n                UserSettings.LastSpecifiedNamespace = function.Namespace;\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            this.CloseCurrentView();\r\n            this.CreateAddNewTreeRefresher(this.EntityToken).PostRefreshMesseges(function.GetDataEntityToken());\r\n            this.ExecuteWorklow(function.GetDataEntityToken(), WorkflowFacade.GetWorkflowType(\"Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider.EditInlineFunctionWorkflow\"));\r\n        }\r\n\r\n\r\n\r\n\r\n        private void ValidateFunctionName(object sender, ConditionalEventArgs e)\r\n        {\r\n            IInlineFunction function = this.GetBinding<IInlineFunction>(\"NewFunction\");\r\n\r\n            bool exists = FunctionFacade.FunctionExists(function.Namespace, function.Name);\r\n\r\n            if (exists)\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"AddFunction.NameAlreadyUsed\");\r\n                errorMessage = string.Format(errorMessage, FunctionFacade.GetFunctionCompositionName(function.Namespace, function.Name));\r\n                ShowFieldMessage(\"NewFunction.Name\", errorMessage);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate<IInlineFunction>(function);\r\n            if (!validationResults.IsValid)\r\n            {\r\n                foreach (ValidationResult result in validationResults)\r\n                {\r\n                    this.ShowFieldMessage(string.Format(\"{0}.{1}\", \"NewFunction\", result.Key), result.Message);\r\n                }\r\n\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private static string _cleanTemplate = @\"using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace {0}\r\n{{\r\npublic static class {1}\r\n{{\r\npublic static bool {2}()\r\n{{\r\nreturn true;\r\n}}\r\n}}\r\n}}\r\n\";\r\n\r\n\r\n        private static string _parameterTemplate = @\"using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace {0}\r\n{{\r\npublic static class {1}\r\n{{\r\npublic static bool {2}(int myIntValue, string myStringValue)\r\n{{\r\nreturn true;\r\n}}\r\n}}\r\n}}\r\n\";\r\n\r\n\r\n        private static string _dataConnectionTemplate = @\"using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace {0}\r\n{{\r\npublic static class {1}\r\n{{\r\npublic static XElement {2}()\r\n{{            \r\nusing (DataConnection connection = new DataConnection())\r\n{{\r\nXElement element = new XElement(\"\"Pages\"\");    \r\n\r\nforeach (IPage page in connection.Get<IPage>())\r\n{{\r\nelement.Add(\r\n   new XElement(\"\"Page\"\", new XAttribute(\"\"title\"\", page.Title))\r\n);\r\n}}\r\n\r\nreturn element;\r\n}}            \r\n}}\r\n}}\r\n}}\r\n\";        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/AddInlineFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1151; 965\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddInlineFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 105\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_InitBindings\" Size=\"130; 41\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"809; 776\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 118\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"273; 303\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"381; 363\" Location=\"415; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"540; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity_ValidateFunctionName\" Size=\"361; 222\" Location=\"425; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"444; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"454; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"617; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"627; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"407; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"417; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"417; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"407; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"417; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"548; 547\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"556; 578\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"566; 640\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"566; 700\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddInlineFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddInlineFunctionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"889\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"889\" Y=\"776\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"378\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"378\" Y=\"303\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"476\" Y=\"368\" />\r\n\t\t\t\t<ns0:Point X=\"650\" Y=\"368\" />\r\n\t\t\t\t<ns0:Point X=\"650\" Y=\"547\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"480\" Y=\"392\" />\r\n\t\t\t\t<ns0:Point X=\"889\" Y=\"392\" />\r\n\t\t\t\t<ns0:Point X=\"889\" Y=\"776\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"749\" Y=\"588\" />\r\n\t\t\t\t<ns0:Point X=\"889\" Y=\"588\" />\r\n\t\t\t\t<ns0:Point X=\"889\" Y=\"776\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/AddNewMethodBasedFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    partial class AddNewMethodBasedFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity2 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step2CodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizzardFormActivity3 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.checkMethodNameStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step3EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.checkMethodNameStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity9);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsValidMethodName);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity2);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckType);\r\n            this.ifElseBranchActivity3.Condition = codecondition2;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity4\r\n            // \r\n            this.cancelHandleExternalEventActivity4.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity4.Name = \"cancelHandleExternalEventActivity4\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"checkMethodNameStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity2\r\n            // \r\n            this.wizzardFormActivity2.ContainerLabel = \"Add new\";\r\n            this.wizzardFormActivity2.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewMethodBasedFunctionStep3.xml\";\r\n            this.wizzardFormActivity2.Name = \"wizzardFormActivity2\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // step2CodeActivity\r\n            // \r\n            this.step2CodeActivity.Name = \"step2CodeActivity\";\r\n            this.step2CodeActivity.ExecuteCode += new System.EventHandler(this.step2CodeActivity_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // wizzardFormActivity3\r\n            // \r\n            this.wizzardFormActivity3.ContainerLabel = \"Add new\";\r\n            this.wizzardFormActivity3.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewMethodBasedFunctionStep2.xml\";\r\n            this.wizzardFormActivity3.Name = \"wizzardFormActivity3\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = \"Add new\";\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewMethodBasedFunctionStep1.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // checkMethodNameStateInitializationActivity\r\n            // \r\n            this.checkMethodNameStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.checkMethodNameStateInitializationActivity.Name = \"checkMethodNameStateInitializationActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // step3EventDrivenActivity_Cancel\r\n            // \r\n            this.step3EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity4);\r\n            this.step3EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity12);\r\n            this.step3EventDrivenActivity_Cancel.Name = \"step3EventDrivenActivity_Cancel\";\r\n            // \r\n            // step3EventDrivenActivity_Finish\r\n            // \r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.step3EventDrivenActivity_Finish.Name = \"step3EventDrivenActivity_Finish\";\r\n            // \r\n            // step3StateInitializationActivity\r\n            // \r\n            this.step3StateInitializationActivity.Activities.Add(this.wizzardFormActivity2);\r\n            this.step3StateInitializationActivity.Name = \"step3StateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity11);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Next\r\n            // \r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2CodeActivity);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.setStateActivity10);\r\n            this.step2EventDrivenActivity_Next.Name = \"step2EventDrivenActivity_Next\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.wizzardFormActivity3);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity8);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.ifElseActivity2);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initalizeStateInitializationActivity\r\n            // \r\n            this.initalizeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initalizeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initalizeStateInitializationActivity.Name = \"initalizeStateInitializationActivity\";\r\n            // \r\n            // checkMethodNameStateActivity\r\n            // \r\n            this.checkMethodNameStateActivity.Activities.Add(this.checkMethodNameStateInitializationActivity);\r\n            this.checkMethodNameStateActivity.Name = \"checkMethodNameStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity6);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // step3StateActivity\r\n            // \r\n            this.step3StateActivity.Activities.Add(this.step3StateInitializationActivity);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Finish);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Cancel);\r\n            this.step3StateActivity.Name = \"step3StateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Next);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initalizeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // AddNewMethodBasedFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.step3StateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.checkMethodNameStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewMethodBasedFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizzardFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateInitializationActivity initalizeStateInitializationActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private CodeActivity finalizeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n\r\n        private StateActivity step2StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizzardFormActivity2;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizzardFormActivity3;\r\n\r\n        private EventDrivenActivity step3EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step3StateInitializationActivity;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Next;\r\n\r\n        private StateActivity step3StateActivity;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private CodeActivity step2CodeActivity;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity checkMethodNameStateInitializationActivity;\r\n\r\n        private StateActivity checkMethodNameStateActivity;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private EventDrivenActivity step3EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private SetStateActivity setStateActivity12;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity4;\r\n\r\n        private SetStateActivity setStateActivity11;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/AddNewMethodBasedFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\n\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewMethodBasedFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewMethodBasedFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private static string _lastAddedType;\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IMethodBasedFunctionInfo function = DataFacade.BuildNew<IMethodBasedFunctionInfo>();\r\n            BaseFunctionFolderElementEntityToken token = (BaseFunctionFolderElementEntityToken)this.EntityToken;\r\n\r\n            string namespaceName = \"\";\r\n            int index = token.Id.IndexOf('.');\r\n            if (index > 0)\r\n            {\r\n                namespaceName = token.Id.Substring(index + 1);\r\n            }\r\n            function.Namespace = namespaceName;\r\n            if (_lastAddedType != null)\r\n            {\r\n                function.Type = _lastAddedType;\r\n            }\r\n\r\n            this.Bindings.Add(\"UserMethodName\", \"\");\r\n            this.Bindings.Add(\"NewMethodBasedFunction\", function);\r\n        }\r\n\r\n\r\n\r\n        private void CheckType(object sender, ConditionalEventArgs e)\r\n        {\r\n            IMethodBasedFunctionInfo function = this.GetBinding<IMethodBasedFunctionInfo>(\"NewMethodBasedFunction\");\r\n\r\n            Type type = TypeManager.TryGetType(function.Type);\r\n\r\n            if (type == null)\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"AddFunction.CouldNotFindType\");\r\n                ShowFieldMessage(\"NewMethodBasedFunction.Type\", errorMessage);\r\n                e.Result = false;\r\n                return;\r\n            }          \r\n\r\n\r\n            List<string> methodNames =\r\n                (from methodInfo in type.GetMethods(BindingFlags.Static | BindingFlags.Public)\r\n                 select methodInfo.Name).ToList();\r\n\r\n            if (methodNames.Count == 0)\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"AddFunction.TypeHasNoValidMethod\");\r\n                ShowFieldMessage(\"NewMethodBasedFunction.Type\", errorMessage);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n\r\n            int destinctCount = methodNames.Distinct().Count();\r\n            if (destinctCount != methodNames.Count)\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"AddFunction.TypeMustNotHaveOverloads\");\r\n                ShowFieldMessage(\"NewMethodBasedFunction.Type\", errorMessage);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n\r\n            this.UpdateBinding(\"MethodNames\", methodNames);\r\n            this.UpdateBinding(\"SelectedMethodName\", \"\");\r\n\r\n            _lastAddedType = type.FullName;\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IMethodBasedFunctionInfo function = this.GetBinding<IMethodBasedFunctionInfo>(\"NewMethodBasedFunction\");\r\n\r\n            Type type = TypeManager.TryGetType(function.Type);\r\n\r\n            string methodName = this.GetBinding<string>(\"SelectedMethodName\");\r\n\r\n\r\n            function.MethodName = methodName;\r\n            function.UserMethodName = methodName;\r\n            function.Namespace = type.Namespace + \".\" + type.Name;\r\n        }\r\n\r\n\r\n\r\n        private void IsValidMethodName(object sender, ConditionalEventArgs e)\r\n        {\r\n            IMethodBasedFunctionInfo function = this.GetBinding<IMethodBasedFunctionInfo>(\"NewMethodBasedFunction\");\r\n\r\n            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            var flowRenderingService = container.GetService<IFormFlowRenderingService>();\r\n\r\n\r\n            if (function.UserMethodName == String.Empty)\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"AddFunction.MethodNameIsEmpty\");\r\n                ShowFieldMessage(\"NewMethodBasedFunction\", errorMessage);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n            if (!function.Namespace.IsCorrectNamespace('.'))\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"AddFunction.InvalidNamespace\");\r\n                ShowFieldMessage(\"NewMethodBasedFunction\", errorMessage);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            bool exists = FunctionFacade.FunctionExists(function.Namespace, function.UserMethodName);\r\n\r\n            if (exists)\r\n            {\r\n                string errorMessage = StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"AddFunction.NameAlreadyUsed\");\r\n                errorMessage = string.Format(errorMessage, StringExtensionMethods.CreateNamespace(function.Namespace, function.UserMethodName));\r\n                ShowFieldMessage(\"NewMethodBasedFunction.UserMethodName\", errorMessage);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            IMethodBasedFunctionInfo methodBasedFunctionInfo = this.GetBinding<IMethodBasedFunctionInfo>(\"NewMethodBasedFunction\");\r\n            methodBasedFunctionInfo.Id = Guid.NewGuid();\r\n\r\n            methodBasedFunctionInfo = DataFacade.AddNew<IMethodBasedFunctionInfo>(methodBasedFunctionInfo);\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(methodBasedFunctionInfo.GetDataEntityToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/AddNewMethodBasedFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1151; 965\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddNewMethodBasedFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"208; 80\" AutoSizeMargin=\"16; 24\" Location=\"156; 107\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"164; 138\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130; 41\" Location=\"174; 200\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"174; 260\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" Location=\"166; 244\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"174; 275\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130; 41\" Location=\"184; 337\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Next\" Size=\"381; 363\" Location=\"174; 299\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"299; 361\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2\" Size=\"361; 222\" Location=\"184; 421\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 122\" Location=\"203; 492\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"213; 554\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 122\" Location=\"376; 492\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"386; 554\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"174; 323\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"184; 385\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 41\" Location=\"184; 445\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"649; 764\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 242\" Location=\"657; 795\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity\" Size=\"130; 41\" Location=\"667; 857\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"667; 917\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"667; 977\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"953; 852\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 126\" AutoSizeMargin=\"16; 24\" Location=\"466; 232\" Name=\"step2StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step2StateInitializationActivity\" Size=\"150; 122\" Location=\"474; 263\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity3\" Size=\"130; 41\" Location=\"484; 325\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Next\" Size=\"150; 254\" Location=\"474; 287\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"484; 349\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step2CodeActivity\" Size=\"130; 41\" Location=\"484; 409\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 53\" Location=\"484; 469\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"474; 311\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"484; 373\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity11\" Size=\"130; 53\" Location=\"484; 433\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" Location=\"749; 241\" Name=\"step3StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step3StateInitializationActivity\" Size=\"150; 122\" Location=\"757; 272\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity2\" Size=\"130; 41\" Location=\"767; 334\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step3EventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"757; 296\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"767; 358\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"767; 418\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step3EventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"757; 320\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity4\" Size=\"130; 41\" Location=\"767; 382\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity12\" Size=\"130; 53\" Location=\"767; 442\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"265; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"59; 591\" Name=\"checkMethodNameStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"checkMethodNameStateInitializationActivity\" Size=\"381; 303\" Location=\"415; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 222\" Location=\"425; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"444; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 41\" Location=\"454; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"617; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"627; 343\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"AddNewMethodBasedFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewMethodBasedFunctionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"852\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"360\" Y=\"148\" />\r\n\t\t\t\t<ns0:Point X=\"375\" Y=\"148\" />\r\n\t\t\t\t<ns0:Point X=\"375\" Y=\"232\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"232\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"244\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2StateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step2StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"389\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"389\" Y=\"224\" />\r\n\t\t\t\t<ns0:Point X=\"571\" Y=\"224\" />\r\n\t\t\t\t<ns0:Point X=\"571\" Y=\"232\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"363\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"383\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"383\" Y=\"236\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"236\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"244\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity8\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"373\" Y=\"333\" />\r\n\t\t\t\t<ns0:Point X=\"389\" Y=\"333\" />\r\n\t\t\t\t<ns0:Point X=\"389\" Y=\"752\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"752\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"852\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"850\" Y=\"805\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"805\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"852\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step3StateActivity\" SetStateName=\"setStateActivity10\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step3StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"663\" Y=\"297\" />\r\n\t\t\t\t<ns0:Point X=\"689\" Y=\"297\" />\r\n\t\t\t\t<ns0:Point X=\"689\" Y=\"233\" />\r\n\t\t\t\t<ns0:Point X=\"854\" Y=\"233\" />\r\n\t\t\t\t<ns0:Point X=\"854\" Y=\"241\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity11\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"673\" Y=\"321\" />\r\n\t\t\t\t<ns0:Point X=\"689\" Y=\"321\" />\r\n\t\t\t\t<ns0:Point X=\"689\" Y=\"752\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"752\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"852\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"checkMethodNameStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"step3StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step3StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step3EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"checkMethodNameStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"952\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"967\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"967\" Y=\"579\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"579\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"591\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity12\" SourceActivity=\"step3StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step3StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step3EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"956\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"1033\" Y=\"852\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity9\" SourceActivity=\"checkMethodNameStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"checkMethodNameStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"checkMethodNameStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"320\" Y=\"632\" />\r\n\t\t\t\t<ns0:Point X=\"751\" Y=\"632\" />\r\n\t\t\t\t<ns0:Point X=\"751\" Y=\"764\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step3StateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"checkMethodNameStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"checkMethodNameStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"checkMethodNameStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step3StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"320\" Y=\"632\" />\r\n\t\t\t\t<ns0:Point X=\"966\" Y=\"632\" />\r\n\t\t\t\t<ns0:Point X=\"966\" Y=\"233\" />\r\n\t\t\t\t<ns0:Point X=\"854\" Y=\"233\" />\r\n\t\t\t\t<ns0:Point X=\"854\" Y=\"241\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/DeleteInlineFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Transactions;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions.Inline;\r\n\r\n\r\nnamespace Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    public sealed partial class DeleteInlineFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteInlineFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_DeleteFunction_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IInlineFunction function = GetDataItemFromEntityToken<IInlineFunction>();\r\n\r\n            if (DataFacade.WillDeleteSucceed(function))\r\n            {\r\n                DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n                using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n                {\r\n                    DataFacade.Delete<IInlineFunctionAssemblyReference>(f => f.Function == function.Id);\r\n                    DataFacade.Delete<IParameter>(f => f.OwnerId == function.Id);\r\n\r\n                    function.DeleteFunctionCode();\r\n\r\n                    DataFacade.Delete(function);\r\n\r\n                    transactionScope.Complete();\r\n                }\r\n\r\n                treeRefresher.PostRefreshMesseges();\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"CascadeDeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"CascadeDeleteErrorMessage\")\r\n                    );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/DeleteInlineFunctionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    partial class DeleteInlineFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_DeleteFunction = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmEventDrivenActivity_Ok = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_DeleteFunction\r\n            // \r\n            this.finalizeCodeActivity_DeleteFunction.Name = \"finalizeCodeActivity_DeleteFunction\";\r\n            this.finalizeCodeActivity_DeleteFunction.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_DeleteFunction_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\InlineFunctionDeleteFunction.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"confirmStateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_DeleteFunction);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // confirmEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Name = \"confirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmEventDrivenActivity_Ok\r\n            // \r\n            this.confirmEventDrivenActivity_Ok.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.confirmEventDrivenActivity_Ok.Activities.Add(this.setStateActivity6);\r\n            this.confirmEventDrivenActivity_Ok.Name = \"confirmEventDrivenActivity_Ok\";\r\n            // \r\n            // confirmStateInitializationActivity\r\n            // \r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.confirmStateInitializationActivity.Name = \"confirmStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.confirmStateInitializationActivity);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Ok);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeleteInlineFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteInlineFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity finalizeCodeActivity_DeleteFunction;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity confirmEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity confirmEventDrivenActivity_Ok;\r\n\r\n        private StateInitializationActivity confirmStateInitializationActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity confirmStateActivity;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/DeleteInlineFunctionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1146; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"DeleteInlineFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 122\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"221; 102\" AutoSizeMargin=\"16; 24\" Location=\"303; 359\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"confirmStateInitializationActivity\" Size=\"150; 122\" Location=\"311; 390\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130; 41\" Location=\"321; 452\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Ok\" Size=\"150; 182\" Location=\"311; 414\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"321; 476\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"321; 536\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"311; 438\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"321; 500\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"321; 560\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"632; 530\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"515; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_DeleteFunction\" Size=\"130; 41\" Location=\"525; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"525; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeleteInlineFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteInlineFunctionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"520\" Y=\"448\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"448\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"359\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"833\" Y=\"571\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"571\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Ok\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"501\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"734\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"734\" Y=\"530\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/DeleteMethodBasedFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    partial class DeleteMethodBasedFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.deleteStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.deleteStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/MethodBasedFunctionProviderElementProviderDeleteStep1.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity1);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // deleteStateInitializationActivity\r\n            // \r\n            this.deleteStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.deleteStateInitializationActivity.Name = \"deleteStateInitializationActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity2);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // deleteStateActivity\r\n            // \r\n            this.deleteStateActivity.Activities.Add(this.deleteStateInitializationActivity);\r\n            this.deleteStateActivity.Name = \"deleteStateActivity\";\r\n            // \r\n            // DeleteMethodBasedFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.deleteStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"deleteStateActivity\";\r\n            this.Name = \"DeleteMethodBasedFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity deleteStateInitializationActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private CodeActivity finalizeCodeActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private StateActivity deleteStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/DeleteMethodBasedFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteMethodBasedFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        public DeleteMethodBasedFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n\r\n            IMethodBasedFunctionInfo methodBasedFunctionInfo = (IMethodBasedFunctionInfo)token.Data;\r\n\r\n            if (DataFacade.WillDeleteSucceed(methodBasedFunctionInfo))\r\n            {\r\n                DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n                DataFacade.Delete(token.Data);\r\n\r\n                int count =\r\n                    (from info in DataFacade.GetData<IMethodBasedFunctionInfo>()\r\n                     where info.Namespace == methodBasedFunctionInfo.Namespace\r\n                     select info).Count();\r\n\r\n                if (count == 0)\r\n                {\r\n                    RefreshFunctionTree();\r\n                }\r\n                else\r\n                {\r\n                    treeRefresher.PostRefreshMesseges();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"CascadeDeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", \"CascadeDeleteErrorMessage\")\r\n                    );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/DeleteMethodBasedFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1120; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"DeleteMethodBasedFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"201; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 105\" Name=\"deleteStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"deleteStateInitializationActivity\" Size=\"150; 122\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"81; 198\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"797; 591\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"212; 278\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"515; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130; 41\" Location=\"525; 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"507; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"517; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"517; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"507; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"517; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"517; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"453; 456\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 242\" Location=\"461; 487\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity\" Size=\"130; 41\" Location=\"471; 549\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"471; 609\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"471; 669\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"DeleteMethodBasedFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteMethodBasedFunctionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"877\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"877\" Y=\"591\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"deleteStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"deleteStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"deleteStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"317\" Y=\"278\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"415\" Y=\"343\" />\r\n\t\t\t\t<ns0:Point X=\"555\" Y=\"343\" />\r\n\t\t\t\t<ns0:Point X=\"555\" Y=\"456\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"419\" Y=\"367\" />\r\n\t\t\t\t<ns0:Point X=\"877\" Y=\"367\" />\r\n\t\t\t\t<ns0:Point X=\"877\" Y=\"591\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"654\" Y=\"497\" />\r\n\t\t\t\t<ns0:Point X=\"877\" Y=\"497\" />\r\n\t\t\t\t<ns0:Point X=\"877\" Y=\"591\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/EditInlineFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Transactions;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Serialization;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Foundation;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.Core.WebClient.FunctionCallEditor;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.Data;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Inline;\r\nusing Composite.Functions.ManagedParameters;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\nnamespace Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditInlineFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditInlineFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_InitBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IInlineFunction functionInfo = this.GetDataItemFromEntityToken<IInlineFunction>();\r\n\r\n            this.Bindings.Add(\"Function\", functionInfo);\r\n            this.Bindings.Add(\"PageId\", PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault());\r\n\r\n            if (UserSettings.ActiveLocaleCultureInfo != null)\r\n            {\r\n                List<KeyValuePair<string, string>> activeCulturesDictionary = UserSettings.ActiveLocaleCultureInfos.Select(f => new KeyValuePair<string, string>(f.Name, DataLocalizationFacade.GetCultureTitle(f))).ToList();\r\n                this.Bindings.Add(\"ActiveCultureName\", UserSettings.ActiveLocaleCultureInfo.Name);\r\n                this.Bindings.Add(\"ActiveCulturesList\", activeCulturesDictionary);\r\n            }\r\n\r\n            this.Bindings.Add(\"PageDataScopeName\", DataScopeIdentifier.AdministratedName);\r\n            this.Bindings.Add(\"PageDataScopeList\", new Dictionary<string, string> \r\n            { \r\n                { DataScopeIdentifier.AdministratedName, GetText(\"EditInlineFunctionWorkflow.AdminitrativeScope.Label\") }, \r\n                { DataScopeIdentifier.PublicName, GetText(\"EditInlineFunctionWorkflow.PublicScope.Label\") } \r\n            });\r\n\r\n\r\n            this.Bindings.Add(\"FunctionCode\", functionInfo.GetFunctionCode());\r\n\r\n            List<KeyValuePair> assemblies = new List<KeyValuePair>();\r\n            foreach (string assembly in InlineFunctionHelper.GetReferencableAssemblies())\r\n            {\r\n                assemblies.Add(new KeyValuePair(assembly.ToLowerInvariant(), System.IO.Path.GetFileName(assembly)));\r\n            }\r\n\r\n            assemblies.Sort(delegate(KeyValuePair kvp1, KeyValuePair kvp2) { return kvp1.Value.CompareTo(kvp2.Value); });\r\n\r\n            this.Bindings.Add(\"Assemblies\", assemblies);\r\n\r\n\r\n            List<string> selectedAssemblies =\r\n                DataFacade.GetData<IInlineFunctionAssemblyReference>().\r\n                Where(f => f.Function == functionInfo.Id).\r\n                OrderBy(f => f.Name).\r\n                Evaluate().\r\n                Select(f => InlineFunctionHelper.GetAssemblyFullPath(f.Name, f.Location).ToLowerInvariant()).\r\n                ToList();\r\n\r\n            this.Bindings.Add(\"SelectedAssemblies\", selectedAssemblies);\r\n\r\n\r\n            List<ManagedParameterDefinition> parameters = ManagedParameterManager.Load(functionInfo.Id).ToList(); ;\r\n            this.Bindings.Add(\"Parameters\", parameters);\r\n\r\n\r\n            IEnumerable<Type> popularWidgetTypes = FunctionFacade.WidgetFunctionSupportedTypes.Where(f => f.GetGenericArguments().Any(g => DataFacade.GetAllInterfaces(UserType.Developer).Any(h => h.IsAssignableFrom(g))));\r\n            List<Type> parameterTypeOptions = FunctionFacade.FunctionSupportedTypes.Union(popularWidgetTypes).Union(FunctionFacade.WidgetFunctionSupportedTypes).ToList();\r\n            this.Bindings.Add(\"ParameterTypeOptions\", parameterTypeOptions);\r\n\r\n            Guid stateId = Guid.NewGuid();\r\n            ParameterEditorState parameterEditorState = new ParameterEditorState { WorkflowId = WorkflowInstanceId };\r\n            SessionStateManager.DefaultProvider.AddState<IParameterEditorState>(stateId, parameterEditorState, DateTime.Now.AddDays(7.0));\r\n\r\n            this.Bindings.Add(\"SessionStateProvider\", SessionStateManager.DefaultProviderName);\r\n            this.Bindings.Add(\"SessionStateId\", stateId);\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IInlineFunction function = this.GetBinding<IInlineFunction>(\"Function\");\r\n            string code = this.GetBinding<string>(\"FunctionCode\");\r\n            List<string> selectedAssemblies = this.GetBinding<List<string>>(\"SelectedAssemblies\");\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IEnumerable<IInlineFunctionAssemblyReference> assemblyReferences =\r\n                    DataFacade.GetData<IInlineFunctionAssemblyReference>(f => f.Function == function.Id).Evaluate();\r\n\r\n                foreach (string selectedAssembly in selectedAssemblies)\r\n                {\r\n                    string name = System.IO.Path.GetFileName(selectedAssembly).ToLowerInvariant();\r\n                    string location = InlineFunctionHelper.GetAssemblyLocation(selectedAssembly).ToLowerInvariant();\r\n\r\n                    if (assemblyReferences\r\n                        .Any(f => (string.Compare(f.Name, name, StringComparison.InvariantCultureIgnoreCase) == 0)\r\n                               && (string.Compare(f.Location, location, StringComparison.InvariantCultureIgnoreCase) == 0)) == false)\r\n                    {\r\n                        IInlineFunctionAssemblyReference assemblyReference = DataFacade.BuildNew<IInlineFunctionAssemblyReference>();\r\n                        assemblyReference.Id = Guid.NewGuid();\r\n                        assemblyReference.Function = function.Id;\r\n                        assemblyReference.Name = name;\r\n                        assemblyReference.Location = location;\r\n\r\n                        DataFacade.AddNew(assemblyReference);\r\n                    }\r\n                }\r\n\r\n\r\n                foreach (IInlineFunctionAssemblyReference assemblyReference in assemblyReferences)\r\n                {\r\n                    string fullPath = InlineFunctionHelper.GetAssemblyFullPath(assemblyReference.Name, assemblyReference.Location);\r\n\r\n                    if (selectedAssemblies.Any(f => string.Compare(f, fullPath, StringComparison.InvariantCultureIgnoreCase) == 0) == false)\r\n                    {\r\n                        DataFacade.Delete(assemblyReference);\r\n                    }\r\n                }\r\n\r\n\r\n                IInlineFunction oldFunction = DataFacade.GetData<IInlineFunction>(f => f.Id == function.Id).Single();\r\n                if ((oldFunction.Name != function.Name) || (oldFunction.Namespace != function.Namespace))\r\n                {\r\n                    InlineFunctionHelper.FunctionRenamed(function, oldFunction);\r\n                }\r\n\r\n\r\n                List<ManagedParameterDefinition> parameters = this.GetBinding<List<ManagedParameterDefinition>>(\"Parameters\");\r\n                ManagedParameterManager.Save(function.Id, parameters);\r\n\r\n                DataFacade.Update(function);\r\n                function.SetFunctionCode(code);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            SetSaveStatus(true);\r\n\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(function.GetDataEntityToken());\r\n        }\r\n\r\n\r\n\r\n        private void editCodeActivity_Preview_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IInlineFunction functionInfo = this.GetBinding<IInlineFunction>(\"Function\");\r\n            string code = this.GetBinding<string>(\"FunctionCode\");\r\n            List<string> selectedAssemblies = this.GetBinding<List<string>>(\"SelectedAssemblies\");\r\n\r\n            StringInlineFunctionCreateMethodErrorHandler handler = new StringInlineFunctionCreateMethodErrorHandler();\r\n\r\n            MethodInfo methodInfo = InlineFunctionHelper.Create(functionInfo, code, handler, selectedAssemblies);\r\n\r\n            FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            IFormFlowWebRenderingService formFlowWebRenderingService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n\r\n            if (handler.HasErrors)\r\n            {\r\n                StringBuilder sb = new StringBuilder();\r\n\r\n                if (!string.IsNullOrWhiteSpace(handler.MissingContainerType))\r\n                {\r\n                    AddFormattedTextBlock(sb, handler.MissingContainerType);\r\n                }\r\n\r\n                if (!string.IsNullOrWhiteSpace(handler.NamespaceMismatch))\r\n                {\r\n                    AddFormattedTextBlock(sb, handler.NamespaceMismatch);\r\n                }\r\n\r\n                if (!string.IsNullOrWhiteSpace(handler.MissionMethod))\r\n                {\r\n                    AddFormattedTextBlock(sb, handler.MissionMethod);\r\n                }\r\n\r\n                if (handler.LoadingException != null)\r\n                {\r\n                    AddFormattedTextBlock(sb, handler.LoadingException.ToString());\r\n                }\r\n\r\n                foreach (Tuple<int, string, string> compileError in handler.CompileErrors)\r\n                {\r\n                    AddFormattedTextBlock(sb, \"{0} : {1} : {2}\".FormatWith(compileError.Item1, compileError.Item2, compileError.Item3));\r\n                }\r\n\r\n                formFlowWebRenderingService.SetNewPageOutput(new LiteralControl(sb.ToString()));\r\n\r\n                return;\r\n            }\r\n\r\n            List<ManagedParameterDefinition> parameters = this.GetBinding<List<ManagedParameterDefinition>>(\"Parameters\");\r\n\r\n            List<object> parameterValues = new List<object>();\r\n            bool parameterErrors = false;\r\n            StringBuilder parameterErrorMessages = new StringBuilder();\r\n            foreach (ParameterInfo parameterInfo in methodInfo.GetParameters())\r\n            {\r\n                ManagedParameterDefinition parameter = parameters.FirstOrDefault(f => f.Name == parameterInfo.Name);\r\n                if (parameter == null)\r\n                {\r\n                    string message = string.Format(GetText(\"CSharpInlineFunction.MissingParameterDefinition\"), parameterInfo.Name);\r\n\r\n                    parameterErrors = true;\r\n                    AddFormattedTextBlock(parameterErrorMessages, message);\r\n                }\r\n                else if (parameter.Type != parameterInfo.ParameterType)\r\n                {\r\n                    string message = string.Format(GetText(\"CSharpInlineFunction.WrongParameterTestValueType\"), parameterInfo.Name, parameterInfo.ParameterType, parameter.Type);\r\n\r\n                    parameterErrors = true;\r\n                    AddFormattedTextBlock(parameterErrorMessages, message);\r\n                }\r\n                else\r\n                {\r\n                    string previewValueFunctionMarkup = (string.IsNullOrEmpty(parameter.TestValueFunctionMarkup) ? parameter.DefaultValueFunctionMarkup : parameter.TestValueFunctionMarkup);\r\n\r\n                    if (string.IsNullOrEmpty(previewValueFunctionMarkup))\r\n                    {\r\n                        string message = string.Format(GetText(\"CSharpInlineFunction.MissingParameterTestOrDefaultValue\"), parameterInfo.Name, parameterInfo.ParameterType, parameter.Type);\r\n\r\n                        parameterErrors = true;\r\n                        AddFormattedTextBlock(parameterErrorMessages, message);\r\n                    }\r\n                    else\r\n                    {\r\n                        try\r\n                        {\r\n                            BaseRuntimeTreeNode treeNode = FunctionFacade.BuildTree(XElement.Parse(previewValueFunctionMarkup));\r\n                            object value = treeNode.GetValue();\r\n                            object typedValue = ValueTypeConverter.Convert(value, parameter.Type);\r\n                            parameterValues.Add(typedValue);\r\n                        }\r\n                        catch (Exception ex)\r\n                        {\r\n                            string message = string.Format(\"Error setting '{0}'. {1}\", parameterInfo.Name, ex.Message);\r\n\r\n                            parameterErrors = true;\r\n                            AddFormattedTextBlock(parameterErrorMessages, message);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (parameterErrors)\r\n            {\r\n                formFlowWebRenderingService.SetNewPageOutput(new LiteralControl(parameterErrorMessages.ToString()));\r\n                return;\r\n            }\r\n\r\n            CultureInfo oldCurrentCulture = Thread.CurrentThread.CurrentCulture;\r\n            CultureInfo oldCurrentUICulture = Thread.CurrentThread.CurrentUICulture;\r\n\r\n            try\r\n            {\r\n                Guid pageId;\r\n                if (this.GetBinding<object>(\"PageId\") == null)\r\n                {\r\n                    pageId = Guid.Empty;\r\n                }\r\n                else\r\n                {\r\n                    pageId = this.GetBinding<Guid>(\"PageId\");\r\n                }\r\n                string dataScopeName = this.GetBinding<string>(\"PageDataScopeName\");\r\n                string cultureName = this.GetBinding<string>(\"ActiveCultureName\");\r\n                CultureInfo cultureInfo = null;\r\n                if (cultureName != null)\r\n                {\r\n                    cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);\r\n                }\r\n\r\n                using (new DataScope(DataScopeIdentifier.Deserialize(dataScopeName), cultureInfo))\r\n                {\r\n                    Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = cultureInfo;\r\n\r\n                    IPage page = DataFacade.GetData<IPage>(f => f.Id == pageId).FirstOrDefault();\r\n                    if (page != null)\r\n                    {\r\n                        PageRenderer.CurrentPage = page;\r\n                    }\r\n\r\n                    object result = methodInfo.Invoke(null, parameterValues.ToArray());\r\n\r\n                    string resultString; \r\n                    \r\n                    try\r\n                    {\r\n                        resultString = PrettyPrinter.Print(result);\r\n                    }\r\n                    catch(Exception ex)\r\n                    {\r\n                        throw new TargetInvocationException(ex);\r\n                    }\r\n\r\n                    SetOutput(formFlowWebRenderingService, resultString);\r\n                }\r\n            }\r\n            catch (TargetInvocationException ex)\r\n            {\r\n                SetOutput(formFlowWebRenderingService, ex.InnerException.ToString());\r\n            }\r\n            finally\r\n            {\r\n                Thread.CurrentThread.CurrentCulture = oldCurrentCulture;\r\n                Thread.CurrentThread.CurrentUICulture = oldCurrentUICulture;\r\n            }\r\n        }\r\n\r\n        private void AddFormattedTextBlock(StringBuilder sb, string text) {\r\n            sb.Append(\"<pre>\");\r\n            sb.Append(HttpUtility.HtmlEncode(text));\r\n            sb.AppendLine(\"</pre>\");\r\n        }\r\n\r\n\r\n        private void SetOutput(IFormFlowWebRenderingService formFlowWebRenderingService, string text)\r\n        {\r\n            Control output = new LiteralControl(\"<pre>\" + HttpUtility.HtmlEncode(text) + \"</pre>\");\r\n            formFlowWebRenderingService.SetNewPageOutput(output);\r\n        }\r\n\r\n        private string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.MethodBasedFunctionProviderElementProvider\", key);\r\n        }\r\n    }\r\n\r\n\r\n    [Serializable]\r\n    public sealed class ParameterEditorState : IParameterEditorState\r\n    {\r\n        public Guid WorkflowId { get; set; }\r\n\r\n        private FormData GetFormData()\r\n        {\r\n            return WorkflowFacade.GetFormData(WorkflowId);\r\n        }\r\n\r\n\r\n        [XmlIgnore]\r\n        public List<ManagedParameterDefinition> Parameters\r\n        {\r\n            get { return GetFormData().Bindings[\"Parameters\"] as List<ManagedParameterDefinition>; }\r\n            set { GetFormData().Bindings[\"Parameters\"] = value; }\r\n        }\r\n\r\n\r\n        [XmlIgnore]\r\n        public List<Type> ParameterTypeOptions\r\n        {\r\n            get { return (GetFormData().Bindings[\"ParameterTypeOptions\"] as IEnumerable<Type>).ToList(); }\r\n            set { GetFormData().Bindings[\"ParameterTypeOptions\"] = value.ToList(); }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/EditInlineFunctionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Workflows.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    partial class EditInlineFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editCodeActivity_Preview = new System.Workflow.Activities.CodeActivity();\r\n            this.previewHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_InitBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Preview = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity_Save\r\n            // \r\n            this.saveCodeActivity_Save.Name = \"saveCodeActivity_Save\";\r\n            this.saveCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saveCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // editCodeActivity_Preview\r\n            // \r\n            this.editCodeActivity_Preview.Name = \"editCodeActivity_Preview\";\r\n            this.editCodeActivity_Preview.ExecuteCode += new System.EventHandler(this.editCodeActivity_Preview_ExecuteCode);\r\n            // \r\n            // previewHandleExternalEventActivity1\r\n            // \r\n            this.previewHandleExternalEventActivity1.EventName = \"Preview\";\r\n            this.previewHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previewHandleExternalEventActivity1.Name = \"previewHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\InlineFunctionEditFunction.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity_InitBindings\r\n            // \r\n            this.initializeCodeActivity_InitBindings.Name = \"initializeCodeActivity_InitBindings\";\r\n            this.initializeCodeActivity_InitBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_InitBindings_ExecuteCode);\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity_Save);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Preview\r\n            // \r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.previewHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.editCodeActivity_Preview);\r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.setStateActivity2);\r\n            this.editEventDrivenActivity_Preview.Name = \"editEventDrivenActivity_Preview\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_InitBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Preview);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditInlineFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditInlineFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private CodeActivity initializeCodeActivity_InitBindings;\r\n\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private CodeActivity saveCodeActivity_Save;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private CodeActivity editCodeActivity_Preview;\r\n\r\n        private C1Console.Workflow.Activities.PreviewHandleExternalEventActivity previewHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_Preview;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/EditInlineFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1120; 986\" AutoSizeMargin=\"16; 24\" Location=\"30; 30\" Name=\"EditInlineFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 105\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_InitBindings\" Size=\"130; 41\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"805; 634\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"208; 118\" AutoSizeMargin=\"16; 24\" Location=\"197; 388\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Save\" Size=\"150; 182\" Location=\"205; 443\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"215; 505\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"215; 565\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 122\" Location=\"205; 419\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130; 41\" Location=\"215; 481\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Preview\" Size=\"150; 242\" Location=\"205; 467\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previewHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"215; 529\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"editCodeActivity_Preview\" Size=\"130; 41\" Location=\"215; 589\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"215; 649\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"193; 80\" AutoSizeMargin=\"16; 24\" Location=\"500; 387\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 182\" Location=\"508; 418\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity_Save\" Size=\"130; 41\" Location=\"518; 480\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"518; 540\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditInlineFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditInlineFunctionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"885\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"885\" Y=\"634\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"301\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"301\" Y=\"388\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"386\" Y=\"453\" />\r\n\t\t\t\t<ns0:Point X=\"417\" Y=\"453\" />\r\n\t\t\t\t<ns0:Point X=\"417\" Y=\"379\" />\r\n\t\t\t\t<ns0:Point X=\"596\" Y=\"379\" />\r\n\t\t\t\t<ns0:Point X=\"596\" Y=\"387\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Preview\" SourceConnectionIndex=\"2\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"401\" Y=\"477\" />\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"477\" />\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"380\" />\r\n\t\t\t\t<ns0:Point X=\"301\" Y=\"380\" />\r\n\t\t\t\t<ns0:Point X=\"301\" Y=\"388\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"689\" Y=\"428\" />\r\n\t\t\t\t<ns0:Point X=\"701\" Y=\"428\" />\r\n\t\t\t\t<ns0:Point X=\"701\" Y=\"380\" />\r\n\t\t\t\t<ns0:Point X=\"301\" Y=\"380\" />\r\n\t\t\t\t<ns0:Point X=\"301\" Y=\"388\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/EditMethodBasedFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    partial class EditMethodBasedFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.validateStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.validateStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsValidData);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"validateStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\EditMethodBasedFunction.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // validateStateInitializationActivity\r\n            // \r\n            this.validateStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.validateStateInitializationActivity.Name = \"validateStateInitializationActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initalizeStateInitializationActivity\r\n            // \r\n            this.initalizeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initalizeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initalizeStateInitializationActivity.Name = \"initalizeStateInitializationActivity\";\r\n            // \r\n            // validateStateActivity\r\n            // \r\n            this.validateStateActivity.Activities.Add(this.validateStateInitializationActivity);\r\n            this.validateStateActivity.Name = \"validateStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity4);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initalizeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // EditMethodBasedFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.validateStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditMethodBasedFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity1;\r\n        private CodeActivity initializeCodeActivity;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateInitializationActivity initalizeStateInitializationActivity;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private CodeActivity saveCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private StateInitializationActivity validateStateInitializationActivity;\r\n        private StateActivity validateStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/EditMethodBasedFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditMethodBasedFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditMethodBasedFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            this.Bindings.Add(\"CurrentMethodFunctionInfo\", dataEntityToken.Data);\r\n            this.Bindings.Add(\"ErrorMessage\", null);\r\n        }\r\n\r\n\r\n\r\n        private void IsValidData(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = false;\r\n\r\n            IMethodBasedFunctionInfo function = this.GetBinding<IMethodBasedFunctionInfo>(\"CurrentMethodFunctionInfo\");\r\n\r\n            if (function.UserMethodName == String.Empty)\r\n            {\r\n                this.ShowFieldMessage(\"CurrentMethodFunctionInfo.UserMethodName\", \"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.MethodNameEmpty}\");\r\n                return;\r\n            }\r\n\r\n            if (!function.Namespace.IsCorrectNamespace('.'))\r\n            {\r\n                this.ShowFieldMessage(\"CurrentMethodFunctionInfo.UserMethodName\", \"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.InvalidNamespace}\");\r\n                return;\r\n            }\r\n\r\n            Type type = TypeManager.TryGetType(function.Type);\r\n\r\n            if (type == null)\r\n            {\r\n                this.ShowFieldMessage(\"CurrentMethodFunctionInfo.Type\", \"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.TypeNotFound}\");\r\n                return;\r\n            }\r\n\r\n            List<string> methodNames =\r\n                (from methodInfo in type.GetMethods()\r\n                 select methodInfo.Name).ToList();\r\n\r\n\r\n            if (!methodNames.Contains(function.MethodName))\r\n            {\r\n                this.ShowFieldMessage(\"CurrentMethodFunctionInfo.MethodName\", \"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.MethodNotInType}\");\r\n                return;\r\n            }\r\n\r\n\r\n            if (methodNames.Count == 0)\r\n            {\r\n                this.ShowFieldMessage(\"CurrentMethodFunctionInfo.Type\", \"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.NoValidMethod}\");\r\n                return;\r\n            }\r\n\r\n            int destinctCount = methodNames.Distinct().Count();\r\n            if (destinctCount != methodNames.Count)\r\n            {\r\n                this.ShowFieldMessage(\"CurrentMethodFunctionInfo.Type\", \"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.MethodOverloadsNotAllowed}\");\r\n                return;\r\n            }           \r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            IMethodBasedFunctionInfo methodBasedFunctionInfo = this.GetBinding<IMethodBasedFunctionInfo>(\"CurrentMethodFunctionInfo\");\r\n\r\n            DataFacade.Update(methodBasedFunctionInfo);\r\n\r\n            SetSaveStatus(true);\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(methodBasedFunctionInfo.GetDataEntityToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/MethodBasedFunctionProviderElementProvider/EditMethodBasedFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditMethodBasedFunctionWorkflow\" Location=\"30; 30\" Size=\"1132; 974\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"EditMethodBasedFunctionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditMethodBasedFunctionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"876\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"876\" Y=\"731\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"261\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"334\" />\r\n\t\t\t\t<ns0:Point X=\"169\" Y=\"334\" />\r\n\t\t\t\t<ns0:Point X=\"169\" Y=\"346\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"validateStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"validateStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"editEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"262\" Y=\"411\" />\r\n\t\t\t\t<ns0:Point X=\"431\" Y=\"411\" />\r\n\t\t\t\t<ns0:Point X=\"431\" Y=\"452\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"775\" Y=\"354\" />\r\n\t\t\t\t<ns0:Point X=\"785\" Y=\"354\" />\r\n\t\t\t\t<ns0:Point X=\"785\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"169\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"169\" Y=\"346\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"validateStateActivity\" EventHandlerName=\"validateStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"532\" Y=\"493\" />\r\n\t\t\t\t<ns0:Point X=\"548\" Y=\"493\" />\r\n\t\t\t\t<ns0:Point X=\"548\" Y=\"305\" />\r\n\t\t\t\t<ns0:Point X=\"682\" Y=\"305\" />\r\n\t\t\t\t<ns0:Point X=\"682\" Y=\"313\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"validateStateActivity\" EventHandlerName=\"validateStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"532\" Y=\"493\" />\r\n\t\t\t\t<ns0:Point X=\"545\" Y=\"493\" />\r\n\t\t\t\t<ns0:Point X=\"545\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"169\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"169\" Y=\"346\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"57; 101\" Size=\"208; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initalizeStateInitializationActivity\" Location=\"65; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"75; 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"75; 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"73; 346\" Size=\"193; 94\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"81; 377\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"91; 439\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"editEventDrivenActivity_Save\" Location=\"81; 401\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"91; 463\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"91; 523\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"586; 313\" Size=\"193; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveStateInitializationActivity\" Location=\"594; 344\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"604; 406\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"604; 466\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"796; 731\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"validateStateActivity\" Location=\"327; 452\" Size=\"209; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"validateStateInitializationActivity\" Location=\"335; 483\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity1\" Location=\"345; 545\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"364; 616\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"374; 678\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"537; 616\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"547; 678\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/AddPackageSourceWorkflow.cs",
    "content": "using System;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_PackageElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddPackageSourceWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string LogTitle = typeof (AddPackageSourceWorkflow).Name;\r\n\r\n        private bool _urlIsValid;\r\n\r\n        private static class BindingNames\r\n        {\r\n            public const string Url = \"Url\";\r\n            public const string HttpOnly = \"HttpOnly\";\r\n            public const string CleanedUrl = \"CleanedUrl\";\r\n        }\r\n\r\n        public AddPackageSourceWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void IsUrlValid(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = _urlIsValid;\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings[BindingNames.Url] = \"\";\r\n            this.Bindings[BindingNames.HttpOnly] = true;\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_ValidateServerUrl_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string url = this.GetBinding<string>(\"Url\");\r\n\r\n            try\r\n            {\r\n                var uriBuilder = new UriBuilder(url);\r\n\r\n                string cleanedUrl = uriBuilder.Uri.ToString().Remove(0, uriBuilder.Scheme.Length + 3);\r\n                if (cleanedUrl.EndsWith(\"/\"))\r\n                {\r\n                    cleanedUrl = cleanedUrl.Remove(cleanedUrl.Length - 1);\r\n                }\r\n\r\n                ServerUrlValidationResult serverUrlValidationResult = PackageServerFacade.ValidateServerUrl(cleanedUrl);\r\n\r\n                _urlIsValid = true;\r\n                if (serverUrlValidationResult == ServerUrlValidationResult.Invalid)\r\n                {\r\n                    this.ShowFieldMessage(BindingNames.Url, Texts.AddPackageSource_Step1_UrlNonPackageServer);\r\n                    _urlIsValid = false;\r\n                }\r\n                else if (serverUrlValidationResult == ServerUrlValidationResult.Https)\r\n                {\r\n                    cleanedUrl = string.Format(\"https://{0}\", cleanedUrl);\r\n                    this.UpdateBinding(BindingNames.HttpOnly, false);\r\n                }\r\n                else if (serverUrlValidationResult == ServerUrlValidationResult.Http)\r\n                {\r\n                    cleanedUrl = string.Format(\"http://{0}\", cleanedUrl);\r\n                }\r\n\r\n                this.UpdateBinding(BindingNames.CleanedUrl, cleanedUrl);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogWarning(LogTitle, \"Failed to validate package source '{0}'\", url);\r\n                Log.LogWarning(LogTitle, ex);\r\n\r\n                this.ShowFieldMessage(BindingNames.Url, Texts.AddPackageSource_Step1_UrlNotValid);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var packageServerSource = DataFacade.BuildNew<IPackageServerSource>();\r\n            packageServerSource.Id = Guid.NewGuid();\r\n            packageServerSource.Url = this.GetBinding<string>(BindingNames.CleanedUrl);\r\n\r\n            DataFacade.AddNew(packageServerSource);\r\n\r\n            this.CreateSpecificTreeRefresher().PostRefreshMesseges(new PackageElementProviderRootEntityToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/AddPackageSourceWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class AddPackageSourceWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step2CodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.step2CloseCurrentViewActivity = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step1IfElseActivity_IsUrlValid = new System.Workflow.Activities.IfElseActivity();\r\n            this.step1CodeActivity_ValidateServerUrl = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.step2EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsUrlValid);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // step2CodeActivity_Finalize\r\n            // \r\n            this.step2CodeActivity_Finalize.Name = \"step2CodeActivity_Finalize\";\r\n            this.step2CodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.step2CodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // step2CloseCurrentViewActivity\r\n            // \r\n            this.step2CloseCurrentViewActivity.Name = \"step2CloseCurrentViewActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderAddPackageSourceStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // step1IfElseActivity_IsUrlValid\r\n            // \r\n            this.step1IfElseActivity_IsUrlValid.Activities.Add(this.ifElseBranchActivity1);\r\n            this.step1IfElseActivity_IsUrlValid.Activities.Add(this.ifElseBranchActivity2);\r\n            this.step1IfElseActivity_IsUrlValid.Name = \"step1IfElseActivity_IsUrlValid\";\r\n            // \r\n            // step1CodeActivity_ValidateServerUrl\r\n            // \r\n            this.step1CodeActivity_ValidateServerUrl.Name = \"step1CodeActivity_ValidateServerUrl\";\r\n            this.step1CodeActivity_ValidateServerUrl.ExecuteCode += new System.EventHandler(this.step1CodeActivity_ValidateServerUrl_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderAddPackageSourceStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // step2EventDrivenActivity_Finish\r\n            // \r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.step2CloseCurrentViewActivity);\r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.step2CodeActivity_Finalize);\r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.step2EventDrivenActivity_Finish.Name = \"step2EventDrivenActivity_Finish\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2WizardFormActivity);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity6);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.step1CodeActivity_ValidateServerUrl);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.step1IfElseActivity_IsUrlValid);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Finish);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddPackageSourceWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddPackageSourceWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private CodeActivity step1CodeActivity_ValidateServerUrl;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n        private SetStateActivity setStateActivity3;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private CodeActivity step2CodeActivity_Finalize;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n        private IfElseActivity step1IfElseActivity_IsUrlValid;\r\n        private EventDrivenActivity step2EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private StateActivity step2StateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity step2CloseCurrentViewActivity;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/AddPackageSourceWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddPackageSourceWorkflow\" Location=\"30; 30\" Size=\"1068; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddPackageSourceWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddPackageSourceWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"297\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"431\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"290\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"290\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"297\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"270\" Y=\"386\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"386\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"192\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"192\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"63; 105\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"63; 201\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"63; 297\" Size=\"211; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"71; 328\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizardFormActivity\" Location=\"81; 390\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 423\" Name=\"step1EventDrivenActivity_Next\" Location=\"71; 352\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity1\" Location=\"196; 414\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_ValidateServerUrl\" Location=\"196; 474\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"step1IfElseActivity_IsUrlValid\" Location=\"81; 534\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"100; 605\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"110; 667\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"273; 605\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"283; 667\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2EventDrivenActivity_Cancel\" Location=\"71; 376\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"81; 438\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"81; 498\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step2StateActivity\" Location=\"63; 431\" Size=\"207; 94\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step2StateInitializationActivity\" Location=\"481; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2WizardFormActivity\" Location=\"491; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 302\" Name=\"step2EventDrivenActivity_Finish\" Location=\"489; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"499; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2CloseCurrentViewActivity\" Location=\"499; 270\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step2CodeActivity_Finalize\" Location=\"499; 330\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"499; 390\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/DeletePackageSourceWorkflow.cs",
    "content": "using System;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Actions;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeletePackageSourceWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeletePackageSourceWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void step1CodeActivity_Delete_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            DataFacade.Delete(dataEntityToken.Data);\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/DeletePackageSourceWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class DeletePackageSourceWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step1CodeActivity_Delete = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.step1FinishHandleExternalEventActivity = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1ConfirmDialogFormActivity = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EentDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // step1CodeActivity_Delete\r\n            // \r\n            this.step1CodeActivity_Delete.Name = \"step1CodeActivity_Delete\";\r\n            this.step1CodeActivity_Delete.ExecuteCode += new System.EventHandler(this.step1CodeActivity_Delete_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // step1FinishHandleExternalEventActivity\r\n            // \r\n            this.step1FinishHandleExternalEventActivity.EventName = \"Finish\";\r\n            this.step1FinishHandleExternalEventActivity.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.step1FinishHandleExternalEventActivity.Name = \"step1FinishHandleExternalEventActivity\";\r\n            // \r\n            // step1ConfirmDialogFormActivity\r\n            // \r\n            this.step1ConfirmDialogFormActivity.ContainerLabel = null;\r\n            this.step1ConfirmDialogFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderDeletePackageSourceStep1.xml\";\r\n            this.step1ConfirmDialogFormActivity.Name = \"step1ConfirmDialogFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EentDrivenActivity_Finish\r\n            // \r\n            this.step1EentDrivenActivity_Finish.Activities.Add(this.step1FinishHandleExternalEventActivity);\r\n            this.step1EentDrivenActivity_Finish.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.step1EentDrivenActivity_Finish.Activities.Add(this.step1CodeActivity_Delete);\r\n            this.step1EentDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EentDrivenActivity_Finish.Name = \"step1EentDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1ConfirmDialogFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EentDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeletePackageSourceWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeletePackageSourceWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity step1ConfirmDialogFormActivity;\r\n        private CodeActivity step1CodeActivity_Delete;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity step1FinishHandleExternalEventActivity;\r\n        private EventDrivenActivity step1EentDrivenActivity_Finish;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/DeletePackageSourceWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeletePackageSourceWorkflow\" Location=\"30; 30\" Size=\"1148; 996\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeletePackageSourceWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeletePackageSourceWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"757\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"757\" Y=\"490\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"330\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EentDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"380\" Y=\"395\" />\r\n\t\t\t\t<ns0:Point X=\"757\" Y=\"395\" />\r\n\t\t\t\t<ns0:Point X=\"757\" Y=\"490\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"390\" Y=\"419\" />\r\n\t\t\t\t<ns0:Point X=\"757\" Y=\"419\" />\r\n\t\t\t\t<ns0:Point X=\"757\" Y=\"490\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"63; 105\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"81; 198\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"677; 490\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"183; 330\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"191; 361\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1ConfirmDialogFormActivity\" Location=\"201; 423\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 302\" Name=\"step1EentDrivenActivity_Finish\" Location=\"191; 385\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"step1FinishHandleExternalEventActivity\" Location=\"201; 447\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"201; 507\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_Delete\" Location=\"201; 567\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"201; 627\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"191; 409\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"201; 471\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"201; 531\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/InstallLocalPackageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class InstallLocalPackageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public InstallLocalPackageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void WasFileSelected(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n            e.Result = uploadedFile.HasFile;\r\n        }\r\n\r\n\r\n\r\n        private void DidValidate(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"Errors\") == false;\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.UpdateBinding(\"LayoutLabel\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackage.ShowError.LayoutLabel\"));\r\n            this.UpdateBinding(\"TableCaption\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackage.ShowError.InfoTableCaption\"));\r\n\r\n            this.Bindings.Add(\"UploadedFile\", new UploadedFile());\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_ValidateInstallation_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n                PackageManagerInstallProcess packageManagerInstallProcess = PackageManager.Install(uploadedFile.FileStream, true);\r\n\r\n                if (packageManagerInstallProcess.PreInstallValidationResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(packageManagerInstallProcess.PreInstallValidationResult));\r\n                }\r\n                else\r\n                {\r\n                    List<PackageFragmentValidationResult> validationResult = packageManagerInstallProcess.Validate();\r\n\r\n                    if (validationResult.Count > 0)\r\n                    {\r\n                        this.UpdateBinding(\"LayoutLabel\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackage.ShowWarning.LayoutLabel\"));\r\n                        this.UpdateBinding(\"TableCaption\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallLocalPackage.ShowWarning.InfoTableCaption\"));\r\n                        this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(validationResult));\r\n                    }\r\n                    else\r\n                    {\r\n                        this.Bindings.Add(\"PackageManagerInstallProcess\", packageManagerInstallProcess);\r\n\r\n                        this.Bindings.Add(\"FlushOnCompletion\", packageManagerInstallProcess.FlushOnCompletion);\r\n                        this.Bindings.Add(\"ReloadConsoleOnCompletion\", packageManagerInstallProcess.ReloadConsoleOnCompletion);\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_Install_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                PackageManagerInstallProcess packageManagerInstallProcess = this.GetBinding<PackageManagerInstallProcess>(\"PackageManagerInstallProcess\");\r\n\r\n                List<PackageFragmentValidationResult> installResult = packageManagerInstallProcess.Install();\r\n                if (installResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(installResult));\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void cleanupCodeActivity_Cleanup_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageManagerInstallProcess packageManagerInstallProcess;\r\n            if (this.TryGetBinding<PackageManagerInstallProcess>(\"PackageManagerInstallProcess\", out packageManagerInstallProcess))\r\n            {\r\n                packageManagerInstallProcess.CancelInstallation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step3CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (this.GetBinding<bool>(\"ReloadConsoleOnCompletion\"))\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);\r\n            }\r\n\r\n            if (this.GetBinding<bool>(\"FlushOnCompletion\"))\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());\r\n        }\r\n\r\n\r\n\r\n        private void showErrorCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<string> rowHeader = new List<string>();\r\n            rowHeader.Add(StringResourceSystemFacade.ParseString(\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.ShowError.MessageTitle}\"));\r\n\r\n            this.UpdateBinding(\"ErrorHeader\", rowHeader);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/InstallLocalPackageWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class InstallLocalPackageWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.step1If_DidValidate = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity2 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.cleanupCodeActivity_Cleanup = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step3CodeActivity_RefreshTree = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step3WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.showErrorWizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.showErrorCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step2IfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step2CodeActivity_Install = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.step1CodeActivity_ValidateInstallation = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.cleanupStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step3EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showErrorEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.cleanupStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step3StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showErrorStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity4.Condition = codecondition1;\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // step1If_DidValidate\r\n            // \r\n            this.step1If_DidValidate.Activities.Add(this.setStateActivity3);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.step1If_DidValidate.Condition = codecondition2;\r\n            this.step1If_DidValidate.Name = \"step1If_DidValidate\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity2\r\n            // \r\n            this.closeCurrentViewActivity2.Name = \"closeCurrentViewActivity2\";\r\n            // \r\n            // cleanupCodeActivity_Cleanup\r\n            // \r\n            this.cleanupCodeActivity_Cleanup.Name = \"cleanupCodeActivity_Cleanup\";\r\n            this.cleanupCodeActivity_Cleanup.ExecuteCode += new System.EventHandler(this.cleanupCodeActivity_Cleanup_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // step3CodeActivity_RefreshTree\r\n            // \r\n            this.step3CodeActivity_RefreshTree.Name = \"step3CodeActivity_RefreshTree\";\r\n            this.step3CodeActivity_RefreshTree.ExecuteCode += new System.EventHandler(this.step3CodeActivity_RefreshTree_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step3WizardFormActivity\r\n            // \r\n            this.step3WizardFormActivity.ContainerLabel = null;\r\n            this.step3WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallLocalPackageStep3.xml\";\r\n            this.step3WizardFormActivity.Name = \"step3WizardFormActivity\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // showErrorWizardFormActivity\r\n            // \r\n            this.showErrorWizardFormActivity.ContainerLabel = null;\r\n            this.showErrorWizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallLocalPackageShowError.xml\";\r\n            this.showErrorWizardFormActivity.Name = \"showErrorWizardFormActivity\";\r\n            // \r\n            // showErrorCodeActivity_Initialize\r\n            // \r\n            this.showErrorCodeActivity_Initialize.Name = \"showErrorCodeActivity_Initialize\";\r\n            this.showErrorCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.showErrorCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // step2IfElseActivity_DidValidate\r\n            // \r\n            this.step2IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity4);\r\n            this.step2IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity5);\r\n            this.step2IfElseActivity_DidValidate.Name = \"step2IfElseActivity_DidValidate\";\r\n            // \r\n            // step2CodeActivity_Install\r\n            // \r\n            this.step2CodeActivity_Install.Name = \"step2CodeActivity_Install\";\r\n            this.step2CodeActivity_Install.ExecuteCode += new System.EventHandler(this.step2CodeActivity_Install_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallLocalPackageStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.step1If_DidValidate);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // step1CodeActivity_ValidateInstallation\r\n            // \r\n            this.step1CodeActivity_ValidateInstallation.Name = \"step1CodeActivity_ValidateInstallation\";\r\n            this.step1CodeActivity_ValidateInstallation.ExecuteCode += new System.EventHandler(this.step1CodeActivity_ValidateInstallation_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallLocalPackageStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // cleanupStateInitializationActivity\r\n            // \r\n            this.cleanupStateInitializationActivity.Activities.Add(this.cleanupCodeActivity_Cleanup);\r\n            this.cleanupStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity2);\r\n            this.cleanupStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.cleanupStateInitializationActivity.Name = \"cleanupStateInitializationActivity\";\r\n            // \r\n            // step3EventDrivenActivity_Finish\r\n            // \r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.step3CodeActivity_RefreshTree);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.setStateActivity7);\r\n            this.step3EventDrivenActivity_Finish.Name = \"step3EventDrivenActivity_Finish\";\r\n            // \r\n            // step3StateInitializationActivity\r\n            // \r\n            this.step3StateInitializationActivity.Activities.Add(this.step3WizardFormActivity);\r\n            this.step3StateInitializationActivity.Name = \"step3StateInitializationActivity\";\r\n            // \r\n            // showErrorEventDrivenActivity_Finish\r\n            // \r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.setStateActivity8);\r\n            this.showErrorEventDrivenActivity_Finish.Name = \"showErrorEventDrivenActivity_Finish\";\r\n            // \r\n            // showErrorStateInitializationActivity\r\n            // \r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorCodeActivity_Initialize);\r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorWizardFormActivity);\r\n            this.showErrorStateInitializationActivity.Name = \"showErrorStateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity11);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Next\r\n            // \r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2CodeActivity_Install);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2IfElseActivity_DidValidate);\r\n            this.step2EventDrivenActivity_Next.Name = \"step2EventDrivenActivity_Next\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2WizardFormActivity);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity10);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.step1CodeActivity_ValidateInstallation);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // cleanupStateActivity\r\n            // \r\n            this.cleanupStateActivity.Activities.Add(this.cleanupStateInitializationActivity);\r\n            this.cleanupStateActivity.Name = \"cleanupStateActivity\";\r\n            // \r\n            // step3StateActivity\r\n            // \r\n            this.step3StateActivity.Activities.Add(this.step3StateInitializationActivity);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Finish);\r\n            this.step3StateActivity.Name = \"step3StateActivity\";\r\n            // \r\n            // showErrorStateActivity\r\n            // \r\n            this.showErrorStateActivity.Activities.Add(this.showErrorStateInitializationActivity);\r\n            this.showErrorStateActivity.Activities.Add(this.showErrorEventDrivenActivity_Finish);\r\n            this.showErrorStateActivity.Name = \"showErrorStateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Next);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // InstallLocalPackageWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.showErrorStateActivity);\r\n            this.Activities.Add(this.step3StateActivity);\r\n            this.Activities.Add(this.cleanupStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"InstallLocalPackageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private CodeActivity step1CodeActivity_ValidateInstallation;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity step1If_DidValidate;\r\n        private IfElseActivity ifElseActivity1;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n        private StateActivity showErrorStateActivity;\r\n        private StateActivity step2StateActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private CodeActivity step2CodeActivity_Install;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Next;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step3WizardFormActivity;\r\n        private StateInitializationActivity step3StateInitializationActivity;\r\n        private StateActivity step3StateActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private EventDrivenActivity step3EventDrivenActivity_Finish;\r\n        private EventDrivenActivity showErrorEventDrivenActivity_Finish;\r\n        private StateInitializationActivity showErrorStateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity showErrorWizardFormActivity;\r\n        private SetStateActivity setStateActivity8;\r\n        private CodeActivity step3CodeActivity_RefreshTree;\r\n        private SetStateActivity setStateActivity9;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseActivity step2IfElseActivity_DidValidate;\r\n        private CodeActivity showErrorCodeActivity_Initialize;\r\n        private SetStateActivity setStateActivity5;\r\n        private CodeActivity cleanupCodeActivity_Cleanup;\r\n        private StateInitializationActivity cleanupStateInitializationActivity;\r\n        private StateActivity cleanupStateActivity;\r\n        private SetStateActivity setStateActivity11;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity10;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/InstallLocalPackageWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"InstallLocalPackageWorkflow\" Location=\"30; 30\" Size=\"1068; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"cleanupStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"InstallLocalPackageWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"cleanupStateActivity\" SourceActivity=\"InstallLocalPackageWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"93\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"93\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"709\" />\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"709\" />\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"721\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"279\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"279\" Y=\"243\" />\r\n\t\t\t\t<ns0:Point X=\"167\" Y=\"243\" />\r\n\t\t\t\t<ns0:Point X=\"167\" Y=\"255\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"259\" Y=\"320\" />\r\n\t\t\t\t<ns0:Point X=\"396\" Y=\"320\" />\r\n\t\t\t\t<ns0:Point X=\"396\" Y=\"400\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"showErrorStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"259\" Y=\"320\" />\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"320\" />\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"796\" />\r\n\t\t\t\t<ns0:Point X=\"195\" Y=\"796\" />\r\n\t\t\t\t<ns0:Point X=\"195\" Y=\"808\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"cleanupStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"cleanupStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"344\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"344\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"709\" />\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"709\" />\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"721\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step3StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step3StateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"488\" Y=\"465\" />\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"465\" />\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"504\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"showErrorStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"488\" Y=\"465\" />\r\n\t\t\t\t<ns0:Point X=\"507\" Y=\"465\" />\r\n\t\t\t\t<ns0:Point X=\"507\" Y=\"796\" />\r\n\t\t\t\t<ns0:Point X=\"195\" Y=\"796\" />\r\n\t\t\t\t<ns0:Point X=\"195\" Y=\"808\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"cleanupStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"cleanupStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"498\" Y=\"489\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"489\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"709\" />\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"709\" />\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"721\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"showErrorStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"showErrorStateActivity\" EventHandlerName=\"showErrorEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"873\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"873\" />\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"715\" />\r\n\t\t\t\t<ns0:Point X=\"928\" Y=\"715\" />\r\n\t\t\t\t<ns0:Point X=\"928\" Y=\"811\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"step3StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step3StateActivity\" EventHandlerName=\"step3EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"761\" Y=\"569\" />\r\n\t\t\t\t<ns0:Point X=\"928\" Y=\"569\" />\r\n\t\t\t\t<ns0:Point X=\"928\" Y=\"811\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"cleanupStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"cleanupStateActivity\" EventHandlerName=\"cleanupStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"837\" Y=\"762\" />\r\n\t\t\t\t<ns0:Point X=\"928\" Y=\"762\" />\r\n\t\t\t\t<ns0:Point X=\"928\" Y=\"811\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"63; 105\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"848; 811\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"62; 255\" Size=\"211; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"70; 286\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizardFormActivity\" Location=\"80; 348\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 423\" Name=\"step1EventDrivenActivity_Next\" Location=\"70; 310\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity1\" Location=\"195; 372\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_ValidateInstallation\" Location=\"195; 432\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity1\" Location=\"80; 492\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"step1If_DidValidate\" Location=\"99; 563\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"109; 625\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"272; 563\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"282; 625\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"70; 334\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"80; 396\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity10\" Location=\"80; 456\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step2StateActivity\" Location=\"291; 400\" Size=\"211; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step2StateInitializationActivity\" Location=\"299; 431\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2WizardFormActivity\" Location=\"309; 493\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 423\" Name=\"step2EventDrivenActivity_Next\" Location=\"299; 455\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity2\" Location=\"424; 517\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step2CodeActivity_Install\" Location=\"424; 577\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"step2IfElseActivity_DidValidate\" Location=\"309; 637\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity4\" Location=\"328; 708\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"338; 770\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity5\" Location=\"501; 708\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"511; 770\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"step2EventDrivenActivity_Cancel\" Location=\"299; 479\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"309; 541\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity11\" Location=\"309; 601\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"showErrorStateActivity\" Location=\"80; 808\" Size=\"230; 94\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"showErrorStateInitializationActivity\" Location=\"88; 839\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"showErrorCodeActivity_Initialize\" Location=\"98; 901\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showErrorWizardFormActivity\" Location=\"98; 961\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"showErrorEventDrivenActivity_Finish\" Location=\"88; 863\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"98; 925\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"98; 985\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step3StateActivity\" Location=\"558; 504\" Size=\"207; 94\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step3StateInitializationActivity\" Location=\"566; 535\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step3WizardFormActivity\" Location=\"576; 597\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 302\" Name=\"step3EventDrivenActivity_Finish\" Location=\"566; 559\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"576; 621\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"576; 681\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step3CodeActivity_RefreshTree\" Location=\"576; 741\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"576; 801\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"cleanupStateActivity\" Location=\"632; 721\" Size=\"209; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"cleanupStateInitializationActivity\" Location=\"489; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"cleanupCodeActivity_Cleanup\" Location=\"499; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity2\" Location=\"499; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"499; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/InstallRemotePackageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    /// <exlude />\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class InstallRemotePackageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        bool _packageIsFree = false;\r\n\r\n\r\n        public InstallRemotePackageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private PackageDescription GetPackageDescription()\r\n        {\r\n            PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;\r\n\r\n            PackageDescription packageDescription =\r\n                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()\r\n                 where description.Id == castedEntityToken.PackageId\r\n                 select description).SingleOrDefault();\r\n\r\n            if (packageDescription == null)\r\n            {\r\n                this.UpdateBinding(\"ServerError\", true);\r\n            }\r\n\r\n            return packageDescription;\r\n        }\r\n\r\n\r\n\r\n        private void IsPackageFree(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = _packageIsFree;\r\n        }\r\n\r\n\r\n\r\n        private void EulaAccepted(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.GetBinding<bool>(\"EulaAccepted\");\r\n        }\r\n\r\n\r\n\r\n        private void DidValidate(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"Errors\") == false;\r\n        }\r\n\r\n\r\n\r\n        private void initializeStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.UpdateBinding(\"LayoutLabel\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallRemotePackage.ShowError.LayoutLabel\"));\r\n            this.UpdateBinding(\"TableCaption\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallRemotePackage.ShowError.InfoTableCaption\"));\r\n\r\n            try\r\n            {\r\n                _packageIsFree = GetPackageDescription().IsFree;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogVerbose(\"InstallRemotePackageWorkflowRGB(100, 100, 255)\", ex.Message);\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step2StateStepcodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                if (this.BindingExist(\"EulaText\") == false)\r\n                {\r\n                    PackageDescription packageDescription = GetPackageDescription();\r\n                    string eulaText = PackageSystemServices.GetEulaText(packageDescription);\r\n                    this.Bindings.Add(\"EulaText\", eulaText);\r\n                }\r\n\r\n                if (this.BindingExist(\"EulaAccepted\") == false)\r\n                {\r\n                    this.Bindings.Add(\"EulaAccepted\", false);\r\n                }\r\n\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step3CodeActivity_DownloadAndValidate_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                PackageDescription packageDescription = GetPackageDescription();\r\n\r\n                string packageServerSource = PackageSystemServices.GetPackageSourceNameByPackageId(packageDescription.Id, InstallationInformationFacade.InstallationId, UserSettings.CultureInfo);\r\n\r\n                System.IO.Stream installFileStream = PackageServerFacade.GetInstallFileStream(packageDescription.PackageFileDownloadUrl);\r\n\r\n                PackageManagerInstallProcess packageManagerInstallProcess = PackageManager.Install(installFileStream, false, packageServerSource);\r\n                this.Bindings.Add(\"PackageManagerInstallProcess\", packageManagerInstallProcess);\r\n\r\n                this.Bindings.Add(\"FlushOnCompletion\", packageManagerInstallProcess.FlushOnCompletion);\r\n                this.Bindings.Add(\"ReloadConsoleOnCompletion\", packageManagerInstallProcess.ReloadConsoleOnCompletion);\r\n\r\n                if (packageManagerInstallProcess.PreInstallValidationResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(packageManagerInstallProcess.PreInstallValidationResult));\r\n                }\r\n                else\r\n                {\r\n                    List<PackageFragmentValidationResult> validationResult = packageManagerInstallProcess.Validate();\r\n\r\n                    if (validationResult.Count > 0)\r\n                    {\r\n                        this.UpdateBinding(\"LayoutLabel\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallRemotePackage.ShowWarning.LayoutLabel\"));\r\n                        this.UpdateBinding(\"TableCaption\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PackageElementProvider\", \"InstallRemotePackage.ShowWarning.InfoTableCaption\"));\r\n                        this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(validationResult));\r\n                    }\r\n                    else\r\n                    {\r\n                        this.UpdateBinding(\"Uninstallable\", packageManagerInstallProcess.CanBeUninstalled == false);\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void showErrorCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<string> rowHeader = new List<string>();\r\n            rowHeader.Add(StringResourceSystemFacade.ParseString(\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.ShowError.MessageTitle}\"));\r\n\r\n            this.UpdateBinding(\"ErrorHeader\", rowHeader);\r\n        }\r\n\r\n\r\n\r\n        private void step4CodeActivity_Install_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageDescription packageDescription = GetPackageDescription();\r\n\r\n            PackageManagerInstallProcess packageManagerInstallProcess = this.GetBinding<PackageManagerInstallProcess>(\"PackageManagerInstallProcess\");\r\n\r\n            bool installOk = false;\r\n            string packageServerUrl = null;\r\n            Exception exception = null;\r\n            try\r\n            {\r\n                packageServerUrl = PackageSystemServices.GetPackageSourceNameByPackageId(packageDescription.Id, InstallationInformationFacade.InstallationId, UserSettings.CultureInfo);\r\n\r\n                List<PackageFragmentValidationResult> installResult = packageManagerInstallProcess.Install();\r\n                if (installResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(installResult));\r\n                }\r\n                else\r\n                {\r\n                    installOk = true;\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                exception = ex;\r\n\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n\r\n            try\r\n            {\r\n                if (installOk)\r\n                {\r\n                    PackageServerFacade.RegisterPackageInstallationCompletion(packageServerUrl, InstallationInformationFacade.InstallationId, packageDescription.Id, UserSettings.Username, UserSettings.UserIPAddress.ToString());\r\n                }\r\n                else\r\n                {\r\n                    StringBuilder sb = new StringBuilder();\r\n                    if (exception != null)\r\n                    {\r\n                        sb.Append(exception.ToString());\r\n                    }\r\n                    else\r\n                    {\r\n                        List<List<string>> errors = this.GetBinding<List<List<string>>>(\"Errors\");\r\n                        foreach (List<string> list in errors)\r\n                        {\r\n                            sb.AppendLine(list[0]);\r\n                        }\r\n                    }\r\n\r\n                    PackageServerFacade.RegisterPackageInstallationFailure(packageServerUrl, InstallationInformationFacade.InstallationId, packageDescription.Id, UserSettings.Username, UserSettings.UserIPAddress.ToString(), sb.ToString());\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogWarning(\"InstallRemotePackageWorkflow\", ex);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void cleanupCodeActivity_Cleanup_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageManagerInstallProcess packageManagerInstallProcess;\r\n            if (this.TryGetBinding<PackageManagerInstallProcess>(\"PackageManagerInstallProcess\", out packageManagerInstallProcess))\r\n            {\r\n                packageManagerInstallProcess.CancelInstallation();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step5CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (this.GetBinding<bool>(\"ReloadConsoleOnCompletion\"))\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);\r\n            }\r\n\r\n            if (this.GetBinding<bool>(\"FlushOnCompletion\"))\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());\r\n\r\n            if (this.GetBinding<bool>(\"ReloadConsoleOnCompletion\") == false)\r\n            {\r\n\r\n                PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;\r\n\r\n                InstalledPackageInformation installedPackage = PackageManager.GetInstalledPackages().FirstOrDefault(f => f.Id == castedEntityToken.PackageId);\r\n\r\n                var installedPackageEntityToken = new PackageElementProviderInstalledPackageItemEntityToken(\r\n                    installedPackage.Id,\r\n                    installedPackage.GroupName,\r\n                    installedPackage.IsLocalInstalled,\r\n                    installedPackage.CanBeUninstalled);\r\n\r\n                ExecuteWorklow(installedPackageEntityToken, WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewInstalledPackageInfoWorkflow\"));\r\n            }\r\n\r\n        }\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/InstallRemotePackageWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class InstallRemotePackageWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition5 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition6 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showFieldMessageActivity1 = new Composite.C1Console.Workflow.Activities.ShowFieldMessageActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity17 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity18 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeIfElseActivity_IsAddOnFree = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity12 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity11 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity8 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity7 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity10 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity9 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cleanupCodeActivity_Cleanup = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step5CodeActivity_RefreshTree = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step5WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity16 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity5 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step4IfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step4CodeActivity_Install = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step4WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.showErrorWizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.showErrorCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity15 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step3IfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step3CodeActivity_DownloadAndValidate = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step3WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity14 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.step2StateStepcodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity13 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.initializeIfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.initializeStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.cleanupStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step5EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step5StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step4EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step4EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step4StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showErrorEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step3EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.cleanupStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step5StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step4StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showErrorStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step3StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsPackageFree);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"step5StateActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step4StateActivity\";\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // showFieldMessageActivity1\r\n            // \r\n            this.showFieldMessageActivity1.FieldBindingPath = \"EulaAccepted\";\r\n            this.showFieldMessageActivity1.Message = \"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step2.AcceptMissin\" +\r\n                \"g}\";\r\n            this.showFieldMessageActivity1.Name = \"showFieldMessageActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // setStateActivity17\r\n            // \r\n            this.setStateActivity17.Name = \"setStateActivity17\";\r\n            this.setStateActivity17.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // setStateActivity18\r\n            // \r\n            this.setStateActivity18.Name = \"setStateActivity18\";\r\n            this.setStateActivity18.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // initializeIfElseActivity_IsAddOnFree\r\n            // \r\n            this.initializeIfElseActivity_IsAddOnFree.Activities.Add(this.ifElseBranchActivity1);\r\n            this.initializeIfElseActivity_IsAddOnFree.Activities.Add(this.ifElseBranchActivity2);\r\n            this.initializeIfElseActivity_IsAddOnFree.Name = \"initializeIfElseActivity_IsAddOnFree\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity10);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity9);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity5.Condition = codecondition2;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity6);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity3.Condition = codecondition3;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseBranchActivity12\r\n            // \r\n            this.ifElseBranchActivity12.Activities.Add(this.showFieldMessageActivity1);\r\n            this.ifElseBranchActivity12.Activities.Add(this.setStateActivity19);\r\n            this.ifElseBranchActivity12.Name = \"ifElseBranchActivity12\";\r\n            // \r\n            // ifElseBranchActivity11\r\n            // \r\n            this.ifElseBranchActivity11.Activities.Add(this.setStateActivity5);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.EulaAccepted);\r\n            this.ifElseBranchActivity11.Condition = codecondition4;\r\n            this.ifElseBranchActivity11.Name = \"ifElseBranchActivity11\";\r\n            // \r\n            // ifElseBranchActivity8\r\n            // \r\n            this.ifElseBranchActivity8.Activities.Add(this.setStateActivity17);\r\n            this.ifElseBranchActivity8.Name = \"ifElseBranchActivity8\";\r\n            // \r\n            // ifElseBranchActivity7\r\n            // \r\n            this.ifElseBranchActivity7.Activities.Add(this.step2WizardFormActivity);\r\n            codecondition5.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity7.Condition = codecondition5;\r\n            this.ifElseBranchActivity7.Name = \"ifElseBranchActivity7\";\r\n            // \r\n            // ifElseBranchActivity10\r\n            // \r\n            this.ifElseBranchActivity10.Activities.Add(this.setStateActivity18);\r\n            this.ifElseBranchActivity10.Name = \"ifElseBranchActivity10\";\r\n            // \r\n            // ifElseBranchActivity9\r\n            // \r\n            this.ifElseBranchActivity9.Activities.Add(this.initializeIfElseActivity_IsAddOnFree);\r\n            codecondition6.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity9.Condition = codecondition6;\r\n            this.ifElseBranchActivity9.Name = \"ifElseBranchActivity9\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cleanupCodeActivity_Cleanup\r\n            // \r\n            this.cleanupCodeActivity_Cleanup.Name = \"cleanupCodeActivity_Cleanup\";\r\n            this.cleanupCodeActivity_Cleanup.ExecuteCode += new System.EventHandler(this.cleanupCodeActivity_Cleanup_ExecuteCode);\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // step5CodeActivity_RefreshTree\r\n            // \r\n            this.step5CodeActivity_RefreshTree.Name = \"step5CodeActivity_RefreshTree\";\r\n            this.step5CodeActivity_RefreshTree.ExecuteCode += new System.EventHandler(this.step5CodeActivity_RefreshTree_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // step5WizardFormActivity\r\n            // \r\n            this.step5WizardFormActivity.ContainerLabel = null;\r\n            this.step5WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep5.xml\";\r\n            this.step5WizardFormActivity.Name = \"step5WizardFormActivity\";\r\n            // \r\n            // setStateActivity16\r\n            // \r\n            this.setStateActivity16.Name = \"setStateActivity16\";\r\n            this.setStateActivity16.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity5\r\n            // \r\n            this.cancelHandleExternalEventActivity5.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity5.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity5.Name = \"cancelHandleExternalEventActivity5\";\r\n            // \r\n            // step4IfElseActivity_DidValidate\r\n            // \r\n            this.step4IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity5);\r\n            this.step4IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity6);\r\n            this.step4IfElseActivity_DidValidate.Name = \"step4IfElseActivity_DidValidate\";\r\n            // \r\n            // step4CodeActivity_Install\r\n            // \r\n            this.step4CodeActivity_Install.Name = \"step4CodeActivity_Install\";\r\n            this.step4CodeActivity_Install.ExecuteCode += new System.EventHandler(this.step4CodeActivity_Install_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity4\r\n            // \r\n            this.nextHandleExternalEventActivity4.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity4.Name = \"nextHandleExternalEventActivity4\";\r\n            // \r\n            // step4WizardFormActivity\r\n            // \r\n            this.step4WizardFormActivity.ContainerLabel = null;\r\n            this.step4WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep4.xml\";\r\n            this.step4WizardFormActivity.Name = \"step4WizardFormActivity\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // showErrorWizardFormActivity\r\n            // \r\n            this.showErrorWizardFormActivity.ContainerLabel = null;\r\n            this.showErrorWizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageShowError.xml\";\r\n            this.showErrorWizardFormActivity.Name = \"showErrorWizardFormActivity\";\r\n            // \r\n            // showErrorCodeActivity_Initialize\r\n            // \r\n            this.showErrorCodeActivity_Initialize.Name = \"showErrorCodeActivity_Initialize\";\r\n            this.showErrorCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.showErrorCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity15\r\n            // \r\n            this.setStateActivity15.Name = \"setStateActivity15\";\r\n            this.setStateActivity15.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity4\r\n            // \r\n            this.cancelHandleExternalEventActivity4.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity4.Name = \"cancelHandleExternalEventActivity4\";\r\n            // \r\n            // step3IfElseActivity_DidValidate\r\n            // \r\n            this.step3IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity3);\r\n            this.step3IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity4);\r\n            this.step3IfElseActivity_DidValidate.Name = \"step3IfElseActivity_DidValidate\";\r\n            // \r\n            // step3CodeActivity_DownloadAndValidate\r\n            // \r\n            this.step3CodeActivity_DownloadAndValidate.Name = \"step3CodeActivity_DownloadAndValidate\";\r\n            this.step3CodeActivity_DownloadAndValidate.ExecuteCode += new System.EventHandler(this.step3CodeActivity_DownloadAndValidate_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity3\r\n            // \r\n            this.nextHandleExternalEventActivity3.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity3.Name = \"nextHandleExternalEventActivity3\";\r\n            // \r\n            // step3WizardFormActivity\r\n            // \r\n            this.step3WizardFormActivity.ContainerLabel = null;\r\n            this.step3WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep3.xml\";\r\n            this.step3WizardFormActivity.Name = \"step3WizardFormActivity\";\r\n            // \r\n            // setStateActivity14\r\n            // \r\n            this.setStateActivity14.Name = \"setStateActivity14\";\r\n            this.setStateActivity14.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity11);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity12);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity7);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity8);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // step2StateStepcodeActivity_Initialize\r\n            // \r\n            this.step2StateStepcodeActivity_Initialize.Name = \"step2StateStepcodeActivity_Initialize\";\r\n            this.step2StateStepcodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.step2StateStepcodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity13\r\n            // \r\n            this.setStateActivity13.Name = \"setStateActivity13\";\r\n            this.setStateActivity13.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderInstallRemotePackageStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // initializeIfElseActivity_DidValidate\r\n            // \r\n            this.initializeIfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity9);\r\n            this.initializeIfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity10);\r\n            this.initializeIfElseActivity_DidValidate.Name = \"initializeIfElseActivity_DidValidate\";\r\n            // \r\n            // initializeStateCodeActivity_Initialize\r\n            // \r\n            this.initializeStateCodeActivity_Initialize.Name = \"initializeStateCodeActivity_Initialize\";\r\n            this.initializeStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // cleanupStateInitializationActivity\r\n            // \r\n            this.cleanupStateInitializationActivity.Activities.Add(this.cleanupCodeActivity_Cleanup);\r\n            this.cleanupStateInitializationActivity.Activities.Add(this.setStateActivity12);\r\n            this.cleanupStateInitializationActivity.Name = \"cleanupStateInitializationActivity\";\r\n            // \r\n            // step5EventDrivenActivity_Finish\r\n            // \r\n            this.step5EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.step5EventDrivenActivity_Finish.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.step5EventDrivenActivity_Finish.Activities.Add(this.step5CodeActivity_RefreshTree);\r\n            this.step5EventDrivenActivity_Finish.Activities.Add(this.setStateActivity11);\r\n            this.step5EventDrivenActivity_Finish.Name = \"step5EventDrivenActivity_Finish\";\r\n            // \r\n            // step5StateInitializationActivity\r\n            // \r\n            this.step5StateInitializationActivity.Activities.Add(this.step5WizardFormActivity);\r\n            this.step5StateInitializationActivity.Name = \"step5StateInitializationActivity\";\r\n            // \r\n            // step4EventDrivenActivity_Cancel\r\n            // \r\n            this.step4EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity5);\r\n            this.step4EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity16);\r\n            this.step4EventDrivenActivity_Cancel.Name = \"step4EventDrivenActivity_Cancel\";\r\n            // \r\n            // step4EventDrivenActivity_Next\r\n            // \r\n            this.step4EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity4);\r\n            this.step4EventDrivenActivity_Next.Activities.Add(this.step4CodeActivity_Install);\r\n            this.step4EventDrivenActivity_Next.Activities.Add(this.step4IfElseActivity_DidValidate);\r\n            this.step4EventDrivenActivity_Next.Name = \"step4EventDrivenActivity_Next\";\r\n            // \r\n            // step4StateInitializationActivity\r\n            // \r\n            this.step4StateInitializationActivity.Activities.Add(this.step4WizardFormActivity);\r\n            this.step4StateInitializationActivity.Name = \"step4StateInitializationActivity\";\r\n            // \r\n            // showErrorEventDrivenActivity_Finish\r\n            // \r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.setStateActivity8);\r\n            this.showErrorEventDrivenActivity_Finish.Name = \"showErrorEventDrivenActivity_Finish\";\r\n            // \r\n            // showErrorStateInitializationActivity\r\n            // \r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorCodeActivity_Initialize);\r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorWizardFormActivity);\r\n            this.showErrorStateInitializationActivity.Name = \"showErrorStateInitializationActivity\";\r\n            // \r\n            // step3EventDrivenActivity_Cancel\r\n            // \r\n            this.step3EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity4);\r\n            this.step3EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity15);\r\n            this.step3EventDrivenActivity_Cancel.Name = \"step3EventDrivenActivity_Cancel\";\r\n            // \r\n            // step3EventDrivenActivity_Next\r\n            // \r\n            this.step3EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity3);\r\n            this.step3EventDrivenActivity_Next.Activities.Add(this.step3CodeActivity_DownloadAndValidate);\r\n            this.step3EventDrivenActivity_Next.Activities.Add(this.step3IfElseActivity_DidValidate);\r\n            this.step3EventDrivenActivity_Next.Name = \"step3EventDrivenActivity_Next\";\r\n            // \r\n            // step3StateInitializationActivity\r\n            // \r\n            this.step3StateInitializationActivity.Activities.Add(this.step3WizardFormActivity);\r\n            this.step3StateInitializationActivity.Name = \"step3StateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity14);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Next\r\n            // \r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.ifElseActivity2);\r\n            this.step2EventDrivenActivity_Next.Name = \"step2EventDrivenActivity_Next\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2StateStepcodeActivity_Initialize);\r\n            this.step2StateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity13);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeStateCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_DidValidate);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"cleanupStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // cleanupStateActivity\r\n            // \r\n            this.cleanupStateActivity.Activities.Add(this.cleanupStateInitializationActivity);\r\n            this.cleanupStateActivity.Name = \"cleanupStateActivity\";\r\n            // \r\n            // step5StateActivity\r\n            // \r\n            this.step5StateActivity.Activities.Add(this.step5StateInitializationActivity);\r\n            this.step5StateActivity.Activities.Add(this.step5EventDrivenActivity_Finish);\r\n            this.step5StateActivity.Name = \"step5StateActivity\";\r\n            // \r\n            // step4StateActivity\r\n            // \r\n            this.step4StateActivity.Activities.Add(this.step4StateInitializationActivity);\r\n            this.step4StateActivity.Activities.Add(this.step4EventDrivenActivity_Next);\r\n            this.step4StateActivity.Activities.Add(this.step4EventDrivenActivity_Cancel);\r\n            this.step4StateActivity.Name = \"step4StateActivity\";\r\n            // \r\n            // showErrorStateActivity\r\n            // \r\n            this.showErrorStateActivity.Activities.Add(this.showErrorStateInitializationActivity);\r\n            this.showErrorStateActivity.Activities.Add(this.showErrorEventDrivenActivity_Finish);\r\n            this.showErrorStateActivity.Name = \"showErrorStateActivity\";\r\n            // \r\n            // step3StateActivity\r\n            // \r\n            this.step3StateActivity.Activities.Add(this.step3StateInitializationActivity);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Next);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Cancel);\r\n            this.step3StateActivity.Name = \"step3StateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Next);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // InstallRemotePackageWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.step3StateActivity);\r\n            this.Activities.Add(this.showErrorStateActivity);\r\n            this.Activities.Add(this.step4StateActivity);\r\n            this.Activities.Add(this.step5StateActivity);\r\n            this.Activities.Add(this.cleanupStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"InstallRemotePackageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private CodeActivity initializeStateCodeActivity_Initialize;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity initializeIfElseActivity_IsAddOnFree;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateActivity step2StateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Next;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n\r\n        private CodeActivity step2StateStepcodeActivity_Initialize;\r\n\r\n        private StateActivity showErrorStateActivity;\r\n\r\n        private StateActivity step3StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity3;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step3WizardFormActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private EventDrivenActivity step3EventDrivenActivity_Next;\r\n\r\n        private StateInitializationActivity step3StateInitializationActivity;\r\n\r\n        private CodeActivity step3CodeActivity_DownloadAndValidate;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity step3IfElseActivity_DidValidate;\r\n\r\n        private StateActivity step4StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step4WizardFormActivity;\r\n\r\n        private StateInitializationActivity step4StateInitializationActivity;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity4;\r\n\r\n        private EventDrivenActivity step4EventDrivenActivity_Next;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity showErrorWizardFormActivity;\r\n\r\n        private StateInitializationActivity showErrorStateInitializationActivity;\r\n\r\n        private CodeActivity showErrorCodeActivity_Initialize;\r\n\r\n        private CodeActivity step4CodeActivity_Install;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n\r\n        private SetStateActivity setStateActivity11;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private IfElseActivity step4IfElseActivity_DidValidate;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity step5EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step5StateInitializationActivity;\r\n\r\n        private EventDrivenActivity showErrorEventDrivenActivity_Finish;\r\n\r\n        private StateActivity step5StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step5WizardFormActivity;\r\n\r\n        private CodeActivity step5CodeActivity_RefreshTree;\r\n\r\n        private SetStateActivity setStateActivity12;\r\n\r\n        private CodeActivity cleanupCodeActivity_Cleanup;\r\n\r\n        private StateInitializationActivity cleanupStateInitializationActivity;\r\n\r\n        private StateActivity cleanupStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private SetStateActivity setStateActivity14;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private SetStateActivity setStateActivity13;\r\n\r\n        private EventDrivenActivity step3EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n\r\n        private SetStateActivity setStateActivity16;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity5;\r\n\r\n        private SetStateActivity setStateActivity15;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity4;\r\n\r\n        private EventDrivenActivity step4EventDrivenActivity_Cancel;\r\n\r\n        private SetStateActivity setStateActivity17;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity8;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity7;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private SetStateActivity setStateActivity18;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity10;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity9;\r\n\r\n        private IfElseActivity initializeIfElseActivity_DidValidate;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity12;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity11;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private SetStateActivity setStateActivity19;\r\n\r\n        private C1Console.Workflow.Activities.ShowFieldMessageActivity showFieldMessageActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/InstallRemotePackageWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1130; 1129\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"InstallRemotePackageWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"51; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"61; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"61; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"59; 101\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"612; 544\" Location=\"67; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeStateCodeActivity_Initialize\" Size=\"130; 41\" Location=\"308; 194\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"initializeIfElseActivity_DidValidate\" Size=\"592; 403\" Location=\"77; 254\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity9\" Size=\"381; 303\" Location=\"96; 325\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"initializeIfElseActivity_IsAddOnFree\" Size=\"361; 222\" Location=\"106; 387\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"125; 458\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"135; 520\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"298; 458\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"308; 520\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity10\" Size=\"150; 303\" Location=\"500; 325\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity18\" Size=\"130; 53\" Location=\"510; 472\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"961; 890\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 118\" AutoSizeMargin=\"16; 24\" Location=\"59; 293\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"67; 324\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step1WizardFormActivity\" Size=\"130; 41\" Location=\"77; 386\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Next\" Size=\"150; 182\" Location=\"67; 348\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"77; 410\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"77; 470\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"67; 372\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"77; 434\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity13\" Size=\"130; 53\" Location=\"77; 494\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211; 118\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"353; 296\" Name=\"step2StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step2StateInitializationActivity\" Size=\"381; 375\" Location=\"404; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step2StateStepcodeActivity_Initialize\" Size=\"130; 41\" Location=\"529; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 234\" Location=\"414; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity7\" Size=\"150; 134\" Location=\"433; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"step2WizardFormActivity\" Size=\"130; 41\" Location=\"443; 409\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity8\" Size=\"150; 134\" Location=\"606; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity17\" Size=\"130; 53\" Location=\"616; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Next\" Size=\"381; 435\" Location=\"396; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"521; 221\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2\" Size=\"361; 294\" Location=\"406; 281\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity11\" Size=\"150; 194\" Location=\"425; 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"435; 450\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity12\" Size=\"150; 194\" Location=\"598; 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"showFieldMessageActivity1\" Size=\"130; 41\" Location=\"608; 414\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity19\" Size=\"130; 53\" Location=\"608; 474\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"396; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"406; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity14\" Size=\"130; 53\" Location=\"406; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211; 118\" AutoSizeMargin=\"16; 24\" Location=\"657; 293\" Name=\"step3StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step3StateInitializationActivity\" Size=\"150; 122\" Location=\"665; 324\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step3WizardFormActivity\" Size=\"130; 41\" Location=\"675; 386\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step3EventDrivenActivity_Next\" Size=\"381; 423\" Location=\"665; 348\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"790; 410\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step3CodeActivity_DownloadAndValidate\" Size=\"130; 41\" Location=\"790; 470\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"step3IfElseActivity_DidValidate\" Size=\"361; 222\" Location=\"675; 530\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 122\" Location=\"694; 601\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"704; 663\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 122\" Location=\"867; 601\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"877; 663\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step3EventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"665; 372\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity4\" Size=\"130; 41\" Location=\"675; 434\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity15\" Size=\"130; 53\" Location=\"675; 494\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"230; 94\" AutoSizeMargin=\"16; 24\" Location=\"308; 715\" Name=\"showErrorStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"showErrorStateInitializationActivity\" Size=\"150; 182\" Location=\"316; 746\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"showErrorCodeActivity_Initialize\" Size=\"130; 41\" Location=\"326; 808\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"showErrorWizardFormActivity\" Size=\"130; 41\" Location=\"326; 868\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"showErrorEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"316; 770\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"326; 832\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 41\" Location=\"326; 892\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211; 118\" AutoSizeMargin=\"16; 24\" Location=\"83; 487\" Name=\"step4StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step4StateInitializationActivity\" Size=\"150; 122\" Location=\"91; 518\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step4WizardFormActivity\" Size=\"130; 41\" Location=\"101; 580\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step4EventDrivenActivity_Next\" Size=\"381; 435\" Location=\"91; 542\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity4\" Size=\"130; 41\" Location=\"216; 604\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step4CodeActivity_Install\" Size=\"130; 41\" Location=\"216; 664\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"step4IfElseActivity_DidValidate\" Size=\"361; 234\" Location=\"101; 724\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity5\" Size=\"150; 134\" Location=\"120; 795\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 41\" Location=\"130; 863\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity6\" Size=\"150; 134\" Location=\"293; 795\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 53\" Location=\"303; 857\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step4EventDrivenActivity_Cancel\" Size=\"150; 194\" Location=\"91; 566\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity5\" Size=\"130; 41\" Location=\"101; 628\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity16\" Size=\"130; 53\" Location=\"101; 688\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"207; 94\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"619; 523\" Name=\"step5StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step5StateInitializationActivity\" Size=\"150; 122\" Location=\"627; 554\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step5WizardFormActivity\" Size=\"130; 41\" Location=\"637; 616\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step5EventDrivenActivity_Finish\" Size=\"150; 314\" Location=\"627; 578\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"637; 640\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"637; 700\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step5CodeActivity_RefreshTree\" Size=\"130; 41\" Location=\"637; 760\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity11\" Size=\"130; 53\" Location=\"637; 820\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"209; 80\" AutoSizeMargin=\"16; 24\" Location=\"59; 1049\" Name=\"cleanupStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"cleanupStateInitializationActivity\" Size=\"150; 194\" Location=\"67; 1080\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"cleanupCodeActivity_Cleanup\" Size=\"130; 41\" Location=\"77; 1142\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity12\" Size=\"130; 53\" Location=\"77; 1202\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"cleanupStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"InstallRemotePackageWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"InstallRemotePackageWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"cleanupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"93\" />\r\n\t\t\t\t<ns0:Point X=\"304\" Y=\"93\" />\r\n\t\t\t\t<ns0:Point X=\"304\" Y=\"703\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"703\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1049\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"showErrorStateActivity\" SetStateName=\"setStateActivity18\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"341\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"341\" Y=\"688\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"688\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"715\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2StateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"296\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"276\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"276\" Y=\"281\" />\r\n\t\t\t\t<ns0:Point X=\"164\" Y=\"281\" />\r\n\t\t\t\t<ns0:Point X=\"164\" Y=\"293\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2StateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step2StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"288\" />\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"288\" />\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"296\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"cleanupStateActivity\" SetStateName=\"setStateActivity13\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"cleanupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"275\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"275\" Y=\"285\" />\r\n\t\t\t\t<ns0:Point X=\"51\" Y=\"285\" />\r\n\t\t\t\t<ns0:Point X=\"51\" Y=\"1037\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1037\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1049\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"showErrorStateActivity\" SetStateName=\"setStateActivity17\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2StateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"547\" Y=\"337\" />\r\n\t\t\t\t<ns0:Point X=\"575\" Y=\"337\" />\r\n\t\t\t\t<ns0:Point X=\"575\" Y=\"680\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"680\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"715\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step3StateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step3StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"550\" Y=\"361\" />\r\n\t\t\t\t<ns0:Point X=\"576\" Y=\"361\" />\r\n\t\t\t\t<ns0:Point X=\"576\" Y=\"285\" />\r\n\t\t\t\t<ns0:Point X=\"762\" Y=\"285\" />\r\n\t\t\t\t<ns0:Point X=\"762\" Y=\"293\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2StateActivity\" SetStateName=\"setStateActivity19\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step2StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"585\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"605\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"605\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"493\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"493\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"cleanupStateActivity\" SetStateName=\"setStateActivity14\" SourceActivity=\"step2StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step2StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"cleanupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"385\" />\r\n\t\t\t\t<ns0:Point X=\"571\" Y=\"385\" />\r\n\t\t\t\t<ns0:Point X=\"571\" Y=\"1037\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1037\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1049\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step4StateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"step3StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step3StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step3EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step4StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"854\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"876\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"876\" Y=\"475\" />\r\n\t\t\t\t<ns0:Point X=\"188\" Y=\"475\" />\r\n\t\t\t\t<ns0:Point X=\"188\" Y=\"487\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"showErrorStateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"step3StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step3StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step3EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"showErrorStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"854\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"879\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"879\" Y=\"702\" />\r\n\t\t\t\t<ns0:Point X=\"430\" Y=\"702\" />\r\n\t\t\t\t<ns0:Point X=\"430\" Y=\"715\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"715\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"cleanupStateActivity\" SetStateName=\"setStateActivity15\" SourceActivity=\"step3StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step3StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step3EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"cleanupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"864\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"875\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"875\" Y=\"1037\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1037\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1049\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity8\" SourceActivity=\"showErrorStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"showErrorStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"showErrorEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"534\" Y=\"780\" />\r\n\t\t\t\t<ns0:Point X=\"1041\" Y=\"780\" />\r\n\t\t\t\t<ns0:Point X=\"1041\" Y=\"890\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step5StateActivity\" SetStateName=\"setStateActivity9\" SourceActivity=\"step4StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step4StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step4EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step5StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"552\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"552\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"515\" />\r\n\t\t\t\t<ns0:Point X=\"722\" Y=\"515\" />\r\n\t\t\t\t<ns0:Point X=\"722\" Y=\"523\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"showErrorStateActivity\" SetStateName=\"setStateActivity10\" SourceActivity=\"step4StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step4StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step4EventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"showErrorStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"552\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"552\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"715\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"cleanupStateActivity\" SetStateName=\"setStateActivity16\" SourceActivity=\"step4StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step4StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step4EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"cleanupStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"290\" Y=\"576\" />\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"576\" />\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"477\" />\r\n\t\t\t\t<ns0:Point X=\"51\" Y=\"477\" />\r\n\t\t\t\t<ns0:Point X=\"51\" Y=\"1037\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1037\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"1049\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity11\" SourceActivity=\"step5StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step5StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step5EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"822\" Y=\"588\" />\r\n\t\t\t\t<ns0:Point X=\"1041\" Y=\"588\" />\r\n\t\t\t\t<ns0:Point X=\"1041\" Y=\"890\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity12\" SourceActivity=\"cleanupStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"cleanupStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cleanupStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"264\" Y=\"1090\" />\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"1090\" />\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"882\" />\r\n\t\t\t\t<ns0:Point X=\"1041\" Y=\"882\" />\r\n\t\t\t\t<ns0:Point X=\"1041\" Y=\"890\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/UninstallLocalPackageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Elements.ElementProviders.PackageElementProvider;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Core.PackageSystem.Workflow\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class UninstallLocalPackageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public UninstallLocalPackageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void DidValidate(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"Errors\") == false;\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_Validate_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageElementProviderInstalledPackageItemEntityToken castedEntityToken = (PackageElementProviderInstalledPackageItemEntityToken)this.EntityToken;\r\n\r\n            PackageManagerUninstallProcess packageManagerUninstallProcess = PackageManager.Uninstall(castedEntityToken.PackageId);\r\n            this.Bindings.Add(\"PackageManagerUninstallProcess\", packageManagerUninstallProcess);\r\n\r\n            this.Bindings.Add(\"FlushOnCompletion\", packageManagerUninstallProcess.FlushOnCompletion);\r\n            this.Bindings.Add(\"ReloadConsoleOnCompletion\", packageManagerUninstallProcess.ReloadConsoleOnCompletion);\r\n\r\n            if (packageManagerUninstallProcess.PreUninstallValidationResult.Count > 0)\r\n            {\r\n                this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(packageManagerUninstallProcess.PreUninstallValidationResult));\r\n            }\r\n            else\r\n            {\r\n                List<PackageFragmentValidationResult> validationResult = packageManagerUninstallProcess.Validate();\r\n\r\n                if (validationResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(validationResult));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_Uninstall_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageManagerUninstallProcess packageManagerUninstallProcess = this.GetBinding<PackageManagerUninstallProcess>(\"PackageManagerUninstallProcess\");\r\n\r\n            List<PackageFragmentValidationResult> uninstallResult = packageManagerUninstallProcess.Uninstall();\r\n            if (uninstallResult.Count > 0)\r\n            {\r\n                this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(uninstallResult));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step3CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (this.GetBinding<bool>(\"ReloadConsoleOnCompletion\"))\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);\r\n            }\r\n\r\n            if (this.GetBinding<bool>(\"FlushOnCompletion\"))\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());\r\n        }\r\n\r\n\r\n\r\n        private void showErrorCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<string> rowHeader = new List<string>();\r\n            rowHeader.Add(StringResourceSystemFacade.ParseString(\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.ShowError.MessageTitle}\"));\r\n\r\n            this.UpdateBinding(\"ErrorHeader\", rowHeader);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/UninstallLocalPackageWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Core.PackageSystem.Workflow\r\n{\r\n    partial class UninstallLocalPackageWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step3CodeActivity_RefreshTree = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step3WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.showErrorWizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.showErrorCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step2IfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step2CodeActivity_Uninstall = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step2IfElseActivity_DidValidate_Old = new System.Workflow.Activities.IfElseActivity();\r\n            this.step2CodeActivity_Validate = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step3EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showErrorEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step3StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showErrorStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallLocalPackageStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity5.Condition = codecondition1;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.step2WizardFormActivity);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // step3CodeActivity_RefreshTree\r\n            // \r\n            this.step3CodeActivity_RefreshTree.Name = \"step3CodeActivity_RefreshTree\";\r\n            this.step3CodeActivity_RefreshTree.ExecuteCode += new System.EventHandler(this.step3CodeActivity_RefreshTree_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // step3WizardFormActivity\r\n            // \r\n            this.step3WizardFormActivity.ContainerLabel = null;\r\n            this.step3WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallLocalPackageStep3.xml\";\r\n            this.step3WizardFormActivity.Name = \"step3WizardFormActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // showErrorWizardFormActivity\r\n            // \r\n            this.showErrorWizardFormActivity.ContainerLabel = null;\r\n            this.showErrorWizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallLocalPackageShowError.xml\";\r\n            this.showErrorWizardFormActivity.Name = \"showErrorWizardFormActivity\";\r\n            // \r\n            // showErrorCodeActivity_Initialize\r\n            // \r\n            this.showErrorCodeActivity_Initialize.Name = \"showErrorCodeActivity_Initialize\";\r\n            this.showErrorCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.showErrorCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // step2IfElseActivity_DidValidate\r\n            // \r\n            this.step2IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity5);\r\n            this.step2IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity6);\r\n            this.step2IfElseActivity_DidValidate.Name = \"step2IfElseActivity_DidValidate\";\r\n            // \r\n            // step2CodeActivity_Uninstall\r\n            // \r\n            this.step2CodeActivity_Uninstall.Name = \"step2CodeActivity_Uninstall\";\r\n            this.step2CodeActivity_Uninstall.ExecuteCode += new System.EventHandler(this.step2CodeActivity_Uninstall_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // step2IfElseActivity_DidValidate_Old\r\n            // \r\n            this.step2IfElseActivity_DidValidate_Old.Activities.Add(this.ifElseBranchActivity1);\r\n            this.step2IfElseActivity_DidValidate_Old.Activities.Add(this.ifElseBranchActivity2);\r\n            this.step2IfElseActivity_DidValidate_Old.Name = \"step2IfElseActivity_DidValidate_Old\";\r\n            // \r\n            // step2CodeActivity_Validate\r\n            // \r\n            this.step2CodeActivity_Validate.Name = \"step2CodeActivity_Validate\";\r\n            this.step2CodeActivity_Validate.ExecuteCode += new System.EventHandler(this.step2CodeActivity_Validate_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallLocalPackageStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // step3EventDrivenActivity_Finish\r\n            // \r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.step3CodeActivity_RefreshTree);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.setStateActivity8);\r\n            this.step3EventDrivenActivity_Finish.Name = \"step3EventDrivenActivity_Finish\";\r\n            // \r\n            // step3StateInitializationActivity\r\n            // \r\n            this.step3StateInitializationActivity.Activities.Add(this.step3WizardFormActivity);\r\n            this.step3StateInitializationActivity.Name = \"step3StateInitializationActivity\";\r\n            // \r\n            // showErrorEventDrivenActivity_Finish\r\n            // \r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.showErrorEventDrivenActivity_Finish.Name = \"showErrorEventDrivenActivity_Finish\";\r\n            // \r\n            // showErrorStateInitializationActivity\r\n            // \r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorCodeActivity_Initialize);\r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorWizardFormActivity);\r\n            this.showErrorStateInitializationActivity.Name = \"showErrorStateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity10);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Next\r\n            // \r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2CodeActivity_Uninstall);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2IfElseActivity_DidValidate);\r\n            this.step2EventDrivenActivity_Next.Name = \"step2EventDrivenActivity_Next\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2CodeActivity_Validate);\r\n            this.step2StateInitializationActivity.Activities.Add(this.step2IfElseActivity_DidValidate_Old);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity7);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // step3StateActivity\r\n            // \r\n            this.step3StateActivity.Activities.Add(this.step3StateInitializationActivity);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Finish);\r\n            this.step3StateActivity.Name = \"step3StateActivity\";\r\n            // \r\n            // showErrorStateActivity\r\n            // \r\n            this.showErrorStateActivity.Activities.Add(this.showErrorStateInitializationActivity);\r\n            this.showErrorStateActivity.Activities.Add(this.showErrorEventDrivenActivity_Finish);\r\n            this.showErrorStateActivity.Name = \"showErrorStateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Next);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // UninstallLocalPackageWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.showErrorStateActivity);\r\n            this.Activities.Add(this.step3StateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"UninstallLocalPackageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n        private StateActivity step2StateActivity;\r\n        private CodeActivity step2CodeActivity_Validate;\r\n        private SetStateActivity setStateActivity3;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity step2IfElseActivity_DidValidate_Old;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private EventDrivenActivity showErrorEventDrivenActivity_Finish;\r\n        private StateInitializationActivity showErrorStateInitializationActivity;\r\n        private StateActivity showErrorStateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity showErrorWizardFormActivity;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Next;\r\n        private StateActivity step3StateActivity;\r\n        private CodeActivity step2CodeActivity_Uninstall;\r\n        private SetStateActivity setStateActivity6;\r\n        private StateInitializationActivity step3StateInitializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step3WizardFormActivity;\r\n        private SetStateActivity setStateActivity8;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private EventDrivenActivity step3EventDrivenActivity_Finish;\r\n        private CodeActivity step3CodeActivity_RefreshTree;\r\n        private SetStateActivity setStateActivity9;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseActivity step2IfElseActivity_DidValidate;\r\n        private CodeActivity showErrorCodeActivity_Initialize;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private SetStateActivity setStateActivity10;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/UninstallLocalPackageWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"UninstallLocalPackageWorkflow\" Location=\"30; 30\" Size=\"1146; 958\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"UninstallLocalPackageWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"UninstallLocalPackageWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"286\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"515\" Y=\"351\" />\r\n\t\t\t\t<ns0:Point X=\"634\" Y=\"351\" />\r\n\t\t\t\t<ns0:Point X=\"634\" Y=\"424\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"525\" Y=\"375\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"375\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"showErrorStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2StateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"723\" Y=\"465\" />\r\n\t\t\t\t<ns0:Point X=\"741\" Y=\"465\" />\r\n\t\t\t\t<ns0:Point X=\"741\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"277\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"277\" Y=\"504\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step3StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step3StateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"726\" Y=\"489\" />\r\n\t\t\t\t<ns0:Point X=\"810\" Y=\"489\" />\r\n\t\t\t\t<ns0:Point X=\"810\" Y=\"576\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"showErrorStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"726\" Y=\"489\" />\r\n\t\t\t\t<ns0:Point X=\"741\" Y=\"489\" />\r\n\t\t\t\t<ns0:Point X=\"741\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"277\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"277\" Y=\"504\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"736\" Y=\"513\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"513\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"showErrorStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"showErrorStateActivity\" EventHandlerName=\"showErrorEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"388\" Y=\"569\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"569\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"752\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"752\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"step3StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step3StateActivity\" EventHandlerName=\"step3EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"910\" Y=\"641\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"641\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"318; 286\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"326; 317\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizardFormActivity\" Location=\"336; 379\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Next\" Location=\"326; 341\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity1\" Location=\"336; 403\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"336; 463\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"326; 365\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"336; 427\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"336; 487\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step2StateActivity\" Location=\"529; 424\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 363\" Name=\"step2StateInitializationActivity\" Location=\"537; 455\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step2CodeActivity_Validate\" Location=\"662; 517\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"step2IfElseActivity_DidValidate_Old\" Location=\"547; 577\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"566; 648\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2WizardFormActivity\" Location=\"576; 710\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"739; 648\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"749; 710\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 423\" Name=\"step2EventDrivenActivity_Next\" Location=\"537; 479\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity2\" Location=\"662; 541\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step2CodeActivity_Uninstall\" Location=\"662; 601\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"step2IfElseActivity_DidValidate\" Location=\"547; 661\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity5\" Location=\"566; 732\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"576; 794\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity6\" Location=\"739; 732\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"749; 794\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"step2EventDrivenActivity_Cancel\" Location=\"537; 503\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"547; 565\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity10\" Location=\"547; 625\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"showErrorStateActivity\" Location=\"162; 504\" Size=\"230; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"showErrorStateInitializationActivity\" Location=\"170; 535\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"showErrorCodeActivity_Initialize\" Location=\"180; 597\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showErrorWizardFormActivity\" Location=\"180; 657\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"showErrorEventDrivenActivity_Finish\" Location=\"170; 559\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"180; 621\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"180; 681\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step3StateActivity\" Location=\"707; 576\" Size=\"207; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step3StateInitializationActivity\" Location=\"481; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step3WizardFormActivity\" Location=\"491; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 302\" Name=\"step3EventDrivenActivity_Finish\" Location=\"489; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"499; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"499; 270\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step3CodeActivity_RefreshTree\" Location=\"499; 330\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"499; 390\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/UninstallRemotePackageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class UninstallRemotePackageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public UninstallRemotePackageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void DidValidate(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"Errors\") == false;\r\n        }\r\n\r\n\r\n        private void DidUnregistre(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.BindingExist(\"UnregisterError\") == false;\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_Validate_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageElementProviderInstalledPackageItemEntityToken castedEntityToken = (PackageElementProviderInstalledPackageItemEntityToken)this.EntityToken;\r\n\r\n            PackageManagerUninstallProcess packageManagerUninstallProcess = PackageManager.Uninstall(castedEntityToken.PackageId);\r\n            this.Bindings.Add(\"PackageManagerUninstallProcess\", packageManagerUninstallProcess);\r\n\r\n            this.Bindings.Add(\"FlushOnCompletion\", packageManagerUninstallProcess.FlushOnCompletion);\r\n            this.Bindings.Add(\"ReloadConsoleOnCompletion\", packageManagerUninstallProcess.ReloadConsoleOnCompletion);\r\n\r\n            if (packageManagerUninstallProcess.PreUninstallValidationResult.Count > 0)\r\n            {\r\n                this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(packageManagerUninstallProcess.PreUninstallValidationResult));\r\n            }\r\n            else\r\n            {\r\n                List<PackageFragmentValidationResult> validationResult = packageManagerUninstallProcess.Validate();\r\n\r\n                if (validationResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(validationResult));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_Uninstall_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            PackageElementProviderInstalledPackageItemEntityToken castedToken = (PackageElementProviderInstalledPackageItemEntityToken)this.EntityToken;\r\n            PackageManagerUninstallProcess packageManagerUninstallProcess = this.GetBinding<PackageManagerUninstallProcess>(\"PackageManagerUninstallProcess\");\r\n\r\n            Exception exception = null;\r\n            try\r\n            {\r\n                string packageServerAddress =\r\n                    (from a in PackageManager.GetInstalledPackages()\r\n                     where a.Id == castedToken.PackageId\r\n                     select a.PackageServerAddress).Single();\r\n\r\n                List<PackageFragmentValidationResult> uninstallResult = packageManagerUninstallProcess.Uninstall();\r\n\r\n                try\r\n                {\r\n                    PackageServerFacade.RegisterPackageUninstall(packageServerAddress, InstallationInformationFacade.InstallationId, castedToken.PackageId, UserSettings.Username, UserSettings.UserIPAddress.ToString());\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    LoggingService.LogWarning(\"UninstallRemovePackageWorkflow\", ex);\r\n                    this.UpdateBinding(\"UnregisterError\", true);\r\n                }\r\n\r\n                if (uninstallResult.Count > 0)\r\n                {\r\n                    this.UpdateBinding(\"Errors\", WorkflowHelper.ValidationResultToBinding(uninstallResult));\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                exception = ex;\r\n\r\n                this.UpdateBinding(\"Errors\", new List<List<string>> { new List<string> { ex.Message, \"\" } });\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step3CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (this.GetBinding<bool>(\"ReloadConsoleOnCompletion\"))\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);\r\n            }\r\n\r\n            if (this.GetBinding<bool>(\"FlushOnCompletion\"))\r\n            {\r\n                GlobalEventSystemFacade.FlushTheSystem();\r\n            }\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());\r\n        }\r\n\r\n        private void showErrorCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<string> rowHeader = new List<string>();\r\n            rowHeader.Add(StringResourceSystemFacade.ParseString(\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.ShowError.MessageTitle}\"));\r\n\r\n            this.UpdateBinding(\"ErrorHeader\", rowHeader);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/UninstallRemotePackageWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class UninstallRemotePackageWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseActivity_DidUnregistre = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step2WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.showUnregistreErrorWizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.showErrorWizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.showErrorCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step3CodeActivity_RefreshTree = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step3WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step2IfElseActivity_DidValidate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step2CodeActivity_Uninstall = new System.Workflow.Activities.CodeActivity();\r\n            this.nextHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step2IfElseActivity_Validate = new System.Workflow.Activities.IfElseActivity();\r\n            this.step2CodeActivity_Validate = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showUnregistreErrorEventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showUnregistreErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showErrorEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showErrorStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step3EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step3StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.showUnregistreErrorActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showErrorStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step3StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"showUnregistreErrorActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity11);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity7);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidUnregistre);\r\n            this.ifElseBranchActivity5.Condition = codecondition1;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // ifElseActivity_DidUnregistre\r\n            // \r\n            this.ifElseActivity_DidUnregistre.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElseActivity_DidUnregistre.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity_DidUnregistre.Name = \"ifElseActivity_DidUnregistre\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"showErrorStateActivity\";\r\n            // \r\n            // step2WizardFormActivity\r\n            // \r\n            this.step2WizardFormActivity.ContainerLabel = null;\r\n            this.step2WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallRemotePackageStep2.xml\";\r\n            this.step2WizardFormActivity.Name = \"step2WizardFormActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity8);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.ifElseActivity_DidUnregistre);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity3.Condition = codecondition2;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.step2WizardFormActivity);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DidValidate);\r\n            this.ifElseBranchActivity1.Condition = codecondition3;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"step3StateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity3\r\n            // \r\n            this.nextHandleExternalEventActivity3.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity3.Name = \"nextHandleExternalEventActivity3\";\r\n            // \r\n            // showUnregistreErrorWizardFormActivity\r\n            // \r\n            this.showUnregistreErrorWizardFormActivity.ContainerLabel = null;\r\n            this.showUnregistreErrorWizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallRemotePackageShowUnregistreError.x\" +\r\n                \"ml\";\r\n            this.showUnregistreErrorWizardFormActivity.Name = \"showUnregistreErrorWizardFormActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // showErrorWizardFormActivity\r\n            // \r\n            this.showErrorWizardFormActivity.ContainerLabel = null;\r\n            this.showErrorWizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallRemotePackageShowError.xml\";\r\n            this.showErrorWizardFormActivity.Name = \"showErrorWizardFormActivity\";\r\n            // \r\n            // showErrorCodeActivity_Initialize\r\n            // \r\n            this.showErrorCodeActivity_Initialize.Name = \"showErrorCodeActivity_Initialize\";\r\n            this.showErrorCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.showErrorCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // step3CodeActivity_RefreshTree\r\n            // \r\n            this.step3CodeActivity_RefreshTree.Name = \"step3CodeActivity_RefreshTree\";\r\n            this.step3CodeActivity_RefreshTree.ExecuteCode += new System.EventHandler(this.step3CodeActivity_RefreshTree_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // step3WizardFormActivity\r\n            // \r\n            this.step3WizardFormActivity.ContainerLabel = null;\r\n            this.step3WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallRemotePackageStep3.xml\";\r\n            this.step3WizardFormActivity.Name = \"step3WizardFormActivity\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // step2IfElseActivity_DidValidate\r\n            // \r\n            this.step2IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity3);\r\n            this.step2IfElseActivity_DidValidate.Activities.Add(this.ifElseBranchActivity4);\r\n            this.step2IfElseActivity_DidValidate.Name = \"step2IfElseActivity_DidValidate\";\r\n            // \r\n            // step2CodeActivity_Uninstall\r\n            // \r\n            this.step2CodeActivity_Uninstall.Name = \"step2CodeActivity_Uninstall\";\r\n            this.step2CodeActivity_Uninstall.ExecuteCode += new System.EventHandler(this.step2CodeActivity_Uninstall_ExecuteCode);\r\n            // \r\n            // nextHandleExternalEventActivity2\r\n            // \r\n            this.nextHandleExternalEventActivity2.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity2.Name = \"nextHandleExternalEventActivity2\";\r\n            // \r\n            // step2IfElseActivity_Validate\r\n            // \r\n            this.step2IfElseActivity_Validate.Activities.Add(this.ifElseBranchActivity1);\r\n            this.step2IfElseActivity_Validate.Activities.Add(this.ifElseBranchActivity2);\r\n            this.step2IfElseActivity_Validate.Name = \"step2IfElseActivity_Validate\";\r\n            // \r\n            // step2CodeActivity_Validate\r\n            // \r\n            this.step2CodeActivity_Validate.Name = \"step2CodeActivity_Validate\";\r\n            this.step2CodeActivity_Validate.ExecuteCode += new System.EventHandler(this.step2CodeActivity_Validate_ExecuteCode);\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step2StateActivity\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderUninstallRemotePackageStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // showUnregistreErrorEventDrivenActivity_Next\r\n            // \r\n            this.showUnregistreErrorEventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity3);\r\n            this.showUnregistreErrorEventDrivenActivity_Next.Activities.Add(this.setStateActivity12);\r\n            this.showUnregistreErrorEventDrivenActivity_Next.Name = \"showUnregistreErrorEventDrivenActivity_Next\";\r\n            // \r\n            // showUnregistreErrorStateInitializationActivity\r\n            // \r\n            this.showUnregistreErrorStateInitializationActivity.Activities.Add(this.showUnregistreErrorWizardFormActivity);\r\n            this.showUnregistreErrorStateInitializationActivity.Name = \"showUnregistreErrorStateInitializationActivity\";\r\n            // \r\n            // showErrorEventDrivenActivity_Finish\r\n            // \r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.showErrorEventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.showErrorEventDrivenActivity_Finish.Name = \"showErrorEventDrivenActivity_Finish\";\r\n            // \r\n            // showErrorStateInitializationActivity\r\n            // \r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorCodeActivity_Initialize);\r\n            this.showErrorStateInitializationActivity.Activities.Add(this.showErrorWizardFormActivity);\r\n            this.showErrorStateInitializationActivity.Name = \"showErrorStateInitializationActivity\";\r\n            // \r\n            // step3EventDrivenActivity_Finish\r\n            // \r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.step3CodeActivity_RefreshTree);\r\n            this.step3EventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.step3EventDrivenActivity_Finish.Name = \"step3EventDrivenActivity_Finish\";\r\n            // \r\n            // step3StateInitializationActivity\r\n            // \r\n            this.step3StateInitializationActivity.Activities.Add(this.step3WizardFormActivity);\r\n            this.step3StateInitializationActivity.Name = \"step3StateInitializationActivity\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity10);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Next\r\n            // \r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2CodeActivity_Uninstall);\r\n            this.step2EventDrivenActivity_Next.Activities.Add(this.step2IfElseActivity_DidValidate);\r\n            this.step2EventDrivenActivity_Next.Name = \"step2EventDrivenActivity_Next\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2CodeActivity_Validate);\r\n            this.step2StateInitializationActivity.Activities.Add(this.step2IfElseActivity_Validate);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity9);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next.Activities.Add(this.setStateActivity6);\r\n            this.step1EventDrivenActivity_Next.Name = \"step1EventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // showUnregistreErrorActivity\r\n            // \r\n            this.showUnregistreErrorActivity.Activities.Add(this.showUnregistreErrorStateInitializationActivity);\r\n            this.showUnregistreErrorActivity.Activities.Add(this.showUnregistreErrorEventDrivenActivity_Next);\r\n            this.showUnregistreErrorActivity.Name = \"showUnregistreErrorActivity\";\r\n            // \r\n            // showErrorStateActivity\r\n            // \r\n            this.showErrorStateActivity.Activities.Add(this.showErrorStateInitializationActivity);\r\n            this.showErrorStateActivity.Activities.Add(this.showErrorEventDrivenActivity_Finish);\r\n            this.showErrorStateActivity.Name = \"showErrorStateActivity\";\r\n            // \r\n            // step3StateActivity\r\n            // \r\n            this.step3StateActivity.Activities.Add(this.step3StateInitializationActivity);\r\n            this.step3StateActivity.Activities.Add(this.step3EventDrivenActivity_Finish);\r\n            this.step3StateActivity.Name = \"step3StateActivity\";\r\n            // \r\n            // step2StateActivity\r\n            // \r\n            this.step2StateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Next);\r\n            this.step2StateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2StateActivity.Name = \"step2StateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Next);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // UninstallRemotePackageWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.step2StateActivity);\r\n            this.Activities.Add(this.step3StateActivity);\r\n            this.Activities.Add(this.showErrorStateActivity);\r\n            this.Activities.Add(this.showUnregistreErrorActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"UninstallRemotePackageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity showErrorEventDrivenActivity_Finish;\r\n        private StateInitializationActivity showErrorStateInitializationActivity;\r\n        private EventDrivenActivity step3EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step3StateInitializationActivity;\r\n        private EventDrivenActivity step2EventDrivenActivity_Next;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Next;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity showErrorStateActivity;\r\n        private StateActivity step3StateActivity;\r\n        private StateActivity step2StateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step2WizardFormActivity;\r\n        private CodeActivity step2CodeActivity_Validate;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity step2IfElseActivity_Validate;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity step2CodeActivity_Uninstall;\r\n        private SetStateActivity setStateActivity8;\r\n        private SetStateActivity setStateActivity7;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity step2IfElseActivity_DidValidate;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step3WizardFormActivity;\r\n        private CodeActivity step3CodeActivity_RefreshTree;\r\n        private CodeActivity showErrorCodeActivity_Initialize;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity showErrorWizardFormActivity;\r\n        private SetStateActivity setStateActivity10;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity9;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseActivity ifElseActivity_DidUnregistre;\r\n        private SetStateActivity setStateActivity11;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity showUnregistreErrorWizardFormActivity;\r\n        private EventDrivenActivity showUnregistreErrorEventDrivenActivity_Next;\r\n        private StateInitializationActivity showUnregistreErrorStateInitializationActivity;\r\n        private StateActivity showUnregistreErrorActivity;\r\n        private SetStateActivity setStateActivity12;\r\n        private Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity3;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/UninstallRemotePackageWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"UninstallRemotePackageWorkflow\" Location=\"30; 30\" Size=\"1068; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"UninstallRemotePackageWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"UninstallRemotePackageWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"297\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"431\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"270\" Y=\"386\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"386\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"showErrorStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2StateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"257\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"281\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"281\" Y=\"670\" />\r\n\t\t\t\t<ns0:Point X=\"178\" Y=\"670\" />\r\n\t\t\t\t<ns0:Point X=\"178\" Y=\"675\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showErrorStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"showErrorStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"670\" />\r\n\t\t\t\t<ns0:Point X=\"178\" Y=\"670\" />\r\n\t\t\t\t<ns0:Point X=\"178\" Y=\"675\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step3StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step3StateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"565\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"showUnregistreErrorActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"showUnregistreErrorActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"496\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"52\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"52\" Y=\"774\" />\r\n\t\t\t\t<ns0:Point X=\"201\" Y=\"774\" />\r\n\t\t\t\t<ns0:Point X=\"201\" Y=\"785\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceStateName=\"step2StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step2StateActivity\" EventHandlerName=\"step2EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"270\" Y=\"520\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"520\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"192\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"192\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step3StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step3StateActivity\" EventHandlerName=\"step3EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"630\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"630\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"showErrorStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"showErrorStateActivity\" EventHandlerName=\"showErrorEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"289\" Y=\"740\" />\r\n\t\t\t\t<ns0:Point X=\"305\" Y=\"740\" />\r\n\t\t\t\t<ns0:Point X=\"305\" Y=\"196\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"196\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step3StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity12\" SourceStateName=\"showUnregistreErrorActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step3StateActivity\" SourceActivity=\"showUnregistreErrorActivity\" EventHandlerName=\"showUnregistreErrorEventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"850\" />\r\n\t\t\t\t<ns0:Point X=\"351\" Y=\"850\" />\r\n\t\t\t\t<ns0:Point X=\"351\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"565\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"63; 105\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"81; 198\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"63; 201\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"63; 297\" Size=\"211; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"71; 328\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizardFormActivity\" Location=\"81; 390\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Next\" Location=\"71; 352\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity1\" Location=\"81; 414\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"81; 474\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"71; 376\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"81; 438\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"81; 498\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step2StateActivity\" Location=\"63; 431\" Size=\"211; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 363\" Name=\"step2StateInitializationActivity\" Location=\"71; 462\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step2CodeActivity_Validate\" Location=\"196; 524\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"step2IfElseActivity_Validate\" Location=\"81; 584\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"100; 655\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2WizardFormActivity\" Location=\"110; 717\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"273; 655\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"283; 717\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"612; 616\" Name=\"step2EventDrivenActivity_Next\" Location=\"71; 486\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity2\" Location=\"312; 548\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step2CodeActivity_Uninstall\" Location=\"312; 608\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 415\" Name=\"step2IfElseActivity_DidValidate\" Location=\"81; 668\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 315\" Name=\"ifElseBranchActivity3\" Location=\"100; 739\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 234\" Name=\"ifElseActivity_DidUnregistre\" Location=\"110; 801\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 134\" Name=\"ifElseBranchActivity5\" Location=\"129; 872\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"139; 940\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 134\" Name=\"ifElseBranchActivity6\" Location=\"302; 872\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity11\" Location=\"312; 934\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 315\" Name=\"ifElseBranchActivity4\" Location=\"504; 739\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"514; 898\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"step2EventDrivenActivity_Cancel\" Location=\"71; 510\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"81; 572\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity10\" Location=\"81; 632\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step3StateActivity\" Location=\"63; 565\" Size=\"207; 94\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step3StateInitializationActivity\" Location=\"481; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step3WizardFormActivity\" Location=\"491; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 302\" Name=\"step3EventDrivenActivity_Finish\" Location=\"489; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"499; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"499; 270\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step3CodeActivity_RefreshTree\" Location=\"499; 330\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"499; 390\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"showErrorStateActivity\" Location=\"63; 675\" Size=\"230; 94\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"showErrorStateInitializationActivity\" Location=\"71; 706\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"showErrorCodeActivity_Initialize\" Location=\"81; 768\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showErrorWizardFormActivity\" Location=\"81; 828\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"showErrorEventDrivenActivity_Finish\" Location=\"71; 730\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"81; 792\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"81; 852\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"showUnregistreErrorActivity\" Location=\"63; 785\" Size=\"276; 94\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"showUnregistreErrorStateInitializationActivity\" Location=\"71; 816\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showUnregistreErrorWizardFormActivity\" Location=\"81; 878\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"showUnregistreErrorEventDrivenActivity_Next\" Location=\"71; 840\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"nextHandleExternalEventActivity3\" Location=\"81; 902\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity12\" Location=\"81; 962\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/ViewAvailablePackageInfoWorkflowWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_PackageElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class ViewAvailablePackageInfoWorkflowWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        const string CustomToolbarFormPath = @\"\\Administrative\\PackageElementProviderViewAvailablePackageInformationToolbar.xml\";\r\n\r\n        static class BindingNames\r\n        {\r\n            public const string PackageDescription = nameof(PackageDescription);\r\n            public const string DocumentTitle = nameof(DocumentTitle);\r\n            public const string AddOnServerSource = nameof(AddOnServerSource);\r\n            public const string HasOwnPrice = nameof(HasOwnPrice);\r\n            public const string PriceText = nameof(PriceText);\r\n            public const string IsInPurchasableSubscriptions = nameof(IsInPurchasableSubscriptions);\r\n            public const string PurchasableSubscriptions = nameof(PurchasableSubscriptions);\r\n            public const string ShowTrialInfo = nameof(ShowTrialInfo);\r\n            public const string ShowSubscriptionLicense = nameof(ShowSubscriptionLicense);\r\n            public const string SubscriptionName = nameof(SubscriptionName);\r\n            public const string LicenseExpirationDate = nameof(LicenseExpirationDate);\r\n        }\r\n\r\n        class SubscriptionLicense\r\n        {\r\n            public string Name { get; set; }\r\n            public DateTime ExpirationDate { get; set; }\r\n            public bool Expired { get; set; }\r\n        }\r\n\r\n\r\n        public ViewAvailablePackageInfoWorkflowWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void AddOnDescriptionExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            this.TryGetBinding(BindingNames.PackageDescription, out PackageDescription packageDescription);\r\n            e.Result = packageDescription != null;\r\n        }\r\n\r\n\r\n\r\n        private void viewStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.SetCustomToolbarDefinition(new FormDefinitionFileMarkupProvider(CustomToolbarFormPath));\r\n\r\n\r\n            if (this.BindingExist(BindingNames.PackageDescription))\r\n            {\r\n                return;\r\n            }\r\n\r\n            var castedToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;\r\n\r\n            PackageDescription packageDescription =\r\n                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()\r\n                    where description.Id.ToString() == castedToken.Id\r\n                    select description).SingleOrDefault();\r\n\r\n            if (packageDescription == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            string packageSourceName = PackageSystemServices.GetPackageSourceNameByPackageId(packageDescription.Id,\r\n                InstallationInformationFacade.InstallationId, UserSettings.CultureInfo);\r\n\r\n            var purchasableSubscriptions = packageDescription.AvailableInSubscriptions.Where(f => f.Purchasable).ToList();\r\n\r\n            var licenses = GetSubscriptionLicenses(packageDescription.AvailableInSubscriptions);\r\n\r\n            var validLicense = licenses.Where(l => !l.Expired)\r\n                                       .OrderByDescending(l => l.ExpirationDate)\r\n                                       .FirstOrDefault();\r\n\r\n            this.Bindings = new Dictionary<string, object>\r\n            {\r\n                {BindingNames.PackageDescription, packageDescription},\r\n                {BindingNames.DocumentTitle, GetDocumentTitle(packageDescription)},\r\n                {BindingNames.AddOnServerSource, packageSourceName},\r\n                {BindingNames.HasOwnPrice, packageDescription.PriceAmmount > 0},\r\n                {BindingNames.PriceText, $\"{packageDescription.PriceAmmount} {packageDescription.PriceCurrency}\"},\r\n                {BindingNames.IsInPurchasableSubscriptions, purchasableSubscriptions.Any()},\r\n                {BindingNames.PurchasableSubscriptions, \r\n                    string.Join(\", \\n\", purchasableSubscriptions.Select(f => f.Name))},\r\n                {BindingNames.ShowTrialInfo, packageDescription.IsTrial && validLicense == null},\r\n                {BindingNames.ShowSubscriptionLicense, validLicense != null},\r\n                {BindingNames.SubscriptionName, validLicense?.Name},\r\n                {BindingNames.LicenseExpirationDate, validLicense?.ExpirationDate.ToLocalTime().ToString()}\r\n            };\r\n        }\r\n\r\n        private SubscriptionLicense[] GetSubscriptionLicenses(IEnumerable<Subscription> availableInSubscriptions)\r\n        {\r\n            return (from subscription in availableInSubscriptions\r\n                let license = PackageLicenseHelper.GetLicenseDefinition(subscription.Id)\r\n                where license != null\r\n                select new SubscriptionLicense\r\n                {\r\n                    Name = subscription.Name,\r\n                    ExpirationDate = license.Expires,\r\n                    Expired = !license.Permanent && license.Expires < DateTime.Now\r\n                }).ToArray();\r\n        }\r\n\r\n        private string GetDocumentTitle(PackageDescription packageDescription)\r\n        {\r\n            // Valid package names:\r\n            //  \"Composite.Community.Versioning\"\r\n            //  \"C1 CMS 3.0\"\r\n            string name = packageDescription.Name.Trim();\r\n\r\n            string documentTitle = name;\r\n\r\n            if (name.Contains(\".\") && !name.EndsWith(\".\"))\r\n            {\r\n                string packageName = name.Substring(name.LastIndexOf('.') + 1);\r\n                string packageNamespace = name.Substring(0, name.LastIndexOf('.'));\r\n\r\n                int temp;\r\n                if (!int.TryParse(packageName, out temp))\r\n                {\r\n                    documentTitle = $\"{packageName} ({packageNamespace})\";\r\n                }\r\n            }\r\n\r\n            return documentTitle;\r\n        }\r\n\r\n\r\n        private void installAddOnCodeActivity_Execute_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var castedToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;\r\n\r\n            PackageDescription packageDescription =\r\n                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()\r\n                 where description.Id.ToString() == castedToken.Id\r\n                 select description).FirstOrDefault();\r\n\r\n            if (packageDescription != null)\r\n            {\r\n#pragma warning disable 436\r\n                this.ExecuteWorklow(this.EntityToken, typeof(InstallRemotePackageWorkflow));\r\n#pragma warning restore 436\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(DialogType.Message,\r\n                    Texts.ViewAvailableInformation_ShowError_MessageTitle,\r\n                    Texts.ViewAvailableInformation_ShowError_MessageMessage);\r\n            }\r\n        }\r\n\r\n\r\n        private void viewCodeActivity_ShowMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(DialogType.Error,\r\n                Texts.ViewAvailableInformation_ShowServerError_MessageTitle,\r\n                Texts.ViewAvailableInformation_ShowServerError_MessageMessage);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/ViewAvailablePackageInfoWorkflowWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class ViewAvailablePackageInfoWorkflowWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.viewCodeActivity_ShowMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.viewDocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.installAddOnCodeActivity_Execute = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.customEvent01HandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity();\r\n            this.ifElseActivity_AddOnDescriptionExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.viewStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.installAddOnStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.viewSateEventDrivenActivity_Install = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.viewStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.installAddOnStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.viewStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // viewCodeActivity_ShowMessage\r\n            // \r\n            this.viewCodeActivity_ShowMessage.Name = \"viewCodeActivity_ShowMessage\";\r\n            this.viewCodeActivity_ShowMessage.ExecuteCode += new System.EventHandler(this.viewCodeActivity_ShowMessage_ExecuteCode);\r\n            // \r\n            // viewDocumentFormActivity\r\n            // \r\n            this.viewDocumentFormActivity.ContainerLabel = null;\r\n            this.viewDocumentFormActivity.CustomToolbarDefinitionFileName = null;\r\n            this.viewDocumentFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderViewAvailablePackageInformation.xml\";\r\n            this.viewDocumentFormActivity.Name = \"viewDocumentFormActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.viewCodeActivity_ShowMessage);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.viewDocumentFormActivity);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.AddOnDescriptionExists);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"viewStateActivity\";\r\n            // \r\n            // installAddOnCodeActivity_Execute\r\n            // \r\n            this.installAddOnCodeActivity_Execute.Name = \"installAddOnCodeActivity_Execute\";\r\n            this.installAddOnCodeActivity_Execute.ExecuteCode += new System.EventHandler(this.installAddOnCodeActivity_Execute_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"installAddOnStateActivity\";\r\n            // \r\n            // customEvent01HandleExternalEventActivity1\r\n            // \r\n            this.customEvent01HandleExternalEventActivity1.EventName = \"CustomEvent01\";\r\n            this.customEvent01HandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.customEvent01HandleExternalEventActivity1.Name = \"customEvent01HandleExternalEventActivity1\";\r\n            // \r\n            // ifElseActivity_AddOnDescriptionExists\r\n            // \r\n            this.ifElseActivity_AddOnDescriptionExists.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity_AddOnDescriptionExists.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity_AddOnDescriptionExists.Name = \"ifElseActivity_AddOnDescriptionExists\";\r\n            // \r\n            // viewStateCodeActivity_Initialize\r\n            // \r\n            this.viewStateCodeActivity_Initialize.Name = \"viewStateCodeActivity_Initialize\";\r\n            this.viewStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.viewStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"viewStateActivity\";\r\n            // \r\n            // installAddOnStateInitializationActivity\r\n            // \r\n            this.installAddOnStateInitializationActivity.Activities.Add(this.installAddOnCodeActivity_Execute);\r\n            this.installAddOnStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.installAddOnStateInitializationActivity.Name = \"installAddOnStateInitializationActivity\";\r\n            // \r\n            // viewSateEventDrivenActivity_Install\r\n            // \r\n            this.viewSateEventDrivenActivity_Install.Activities.Add(this.customEvent01HandleExternalEventActivity1);\r\n            this.viewSateEventDrivenActivity_Install.Activities.Add(this.setStateActivity3);\r\n            this.viewSateEventDrivenActivity_Install.Name = \"viewSateEventDrivenActivity_Install\";\r\n            // \r\n            // viewStateInitializationActivity\r\n            // \r\n            this.viewStateInitializationActivity.Activities.Add(this.viewStateCodeActivity_Initialize);\r\n            this.viewStateInitializationActivity.Activities.Add(this.ifElseActivity_AddOnDescriptionExists);\r\n            this.viewStateInitializationActivity.Name = \"viewStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // installAddOnStateActivity\r\n            // \r\n            this.installAddOnStateActivity.Activities.Add(this.installAddOnStateInitializationActivity);\r\n            this.installAddOnStateActivity.Name = \"installAddOnStateActivity\";\r\n            // \r\n            // viewStateActivity\r\n            // \r\n            this.viewStateActivity.Activities.Add(this.viewStateInitializationActivity);\r\n            this.viewStateActivity.Activities.Add(this.viewSateEventDrivenActivity_Install);\r\n            this.viewStateActivity.Name = \"viewStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // ViewAvailablePackageInfoWorkflowWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.viewStateActivity);\r\n            this.Activities.Add(this.installAddOnStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"ViewAvailablePackageInfoWorkflowWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private StateInitializationActivity viewStateInitializationActivity;\r\n        private StateActivity viewStateActivity;\r\n        private C1Console.Workflow.Activities.DocumentFormActivity viewDocumentFormActivity;\r\n        private CodeActivity viewStateCodeActivity_Initialize;\r\n        private EventDrivenActivity viewSateEventDrivenActivity_Install;\r\n        private SetStateActivity setStateActivity2;\r\n        private C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity customEvent01HandleExternalEventActivity1;\r\n        private CodeActivity installAddOnCodeActivity_Execute;\r\n        private SetStateActivity setStateActivity3;\r\n        private StateInitializationActivity installAddOnStateInitializationActivity;\r\n        private StateActivity installAddOnStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity5;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity_AddOnDescriptionExists;\r\n        private CodeActivity viewCodeActivity_ShowMessage;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/ViewAvailablePackageInfoWorkflowWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1086; 690\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"ViewAvailablePackageInfoWorkflowWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"ViewAvailablePackageInfoWorkflowWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"ViewAvailablePackageInfoWorkflowWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"944\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"944\" Y=\"306\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"viewStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"viewStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"545\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"545\" Y=\"183\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"viewStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"viewStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"viewStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"628\" Y=\"227\" />\r\n\t\t\t\t<ns0:Point X=\"944\" Y=\"227\" />\r\n\t\t\t\t<ns0:Point X=\"944\" Y=\"306\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"installAddOnStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"viewStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"viewStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"viewSateEventDrivenActivity_Install\" SourceConnectionIndex=\"1\" TargetStateName=\"installAddOnStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"253\" />\r\n\t\t\t\t<ns0:Point X=\"672\" Y=\"253\" />\r\n\t\t\t\t<ns0:Point X=\"672\" Y=\"323\" />\r\n\t\t\t\t<ns0:Point X=\"272\" Y=\"323\" />\r\n\t\t\t\t<ns0:Point X=\"272\" Y=\"335\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"viewStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"installAddOnStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"installAddOnStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"installAddOnStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"viewStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"395\" Y=\"379\" />\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"379\" />\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"175\" />\r\n\t\t\t\t<ns0:Point X=\"545\" Y=\"175\" />\r\n\t\t\t\t<ns0:Point X=\"545\" Y=\"183\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"227; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 106\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 146\" Location=\"71; 139\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"81; 204\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"864; 306\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"239; 100\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"426; 183\" Name=\"viewStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"viewStateInitializationActivity\" Size=\"381; 459\" Location=\"382; 154\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"viewStateCodeActivity_Initialize\" Size=\"130; 44\" Location=\"507; 219\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity_AddOnDescriptionExists\" Size=\"361; 312\" Location=\"392; 282\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 209\" Location=\"411; 356\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"viewDocumentFormActivity\" Size=\"130; 44\" Location=\"421; 461\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 209\" Location=\"584; 356\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"viewCodeActivity_ShowMessage\" Size=\"130; 44\" Location=\"594; 421\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 62\" Location=\"594; 484\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"viewSateEventDrivenActivity_Install\" Size=\"150; 209\" Location=\"374; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"customEvent01HandleExternalEventActivity1\" Size=\"130; 44\" Location=\"384; 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"384; 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"253; 80\" AutoSizeMargin=\"16; 24\" Location=\"146; 335\" Name=\"installAddOnStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"installAddOnStateInitializationActivity\" Size=\"150; 209\" Location=\"154; 368\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"installAddOnCodeActivity_Execute\" Size=\"130; 44\" Location=\"164; 433\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"164; 496\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/ViewInstalledPackageInfoWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.PackageSystem;\r\nusing Composite.Core.PackageSystem.Workflow;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Events;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class ViewInstalledPackageInfoWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        const string CustomToolbarDefinitionPath = @\"\\Administrative\\PackageElementProviderViewInstalledPackageInformationToolbar.xml\";\r\n\r\n        public ViewInstalledPackageInfoWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private static class BindingNames\r\n        {\r\n            public const string DocumentTitle = nameof(DocumentTitle);\r\n            public const string InstalledPackageInformation = nameof(InstalledPackageInformation);\r\n            public const string InstallDate = nameof(InstallDate);\r\n            public const string IsTrial = nameof(IsTrial);\r\n            public const string TrialPurchaseUrl = nameof(TrialPurchaseUrl);\r\n            public const string ReadMoreUrl = nameof(ReadMoreUrl);\r\n\r\n            public const string IsSubscription = nameof(IsSubscription);\r\n            public const string SubscriptionName = nameof(SubscriptionName);\r\n            public const string LicenseExpirationDate = nameof(LicenseExpirationDate);\r\n\r\n            public const string ShowPurchaseThisButton = nameof(ShowPurchaseThisButton);\r\n        }\r\n\r\n        private class LicenseInformation\r\n        {\r\n            public bool IsSubscription { get; set; }\r\n            public bool IsTrial { get; set; }\r\n            public bool HasExpired { get; set; }\r\n            public string Name { get; set; }\r\n            public string PurchaseUrl { get; set; }\r\n            public DateTime ExpirationDate { get; set; }\r\n        }\r\n\r\n        private void viewStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var castedToken = (PackageElementProviderInstalledPackageItemEntityToken)this.EntityToken;\r\n            Guid packageId = castedToken.PackageId;\r\n\r\n            if (castedToken.CanBeUninstalled)\r\n            {\r\n                this.SetCustomToolbarDefinition(new FormDefinitionFileMarkupProvider(CustomToolbarDefinitionPath));\r\n            }\r\n\r\n            if (this.BindingExist(BindingNames.InstalledPackageInformation))\r\n            {\r\n                return;\r\n            }\r\n\r\n            InstalledPackageInformation installedAddOnInformation =\r\n                PackageManager.GetInstalledPackages().Single(info => info.Id == packageId);\r\n\r\n            string name = installedAddOnInformation.Name;\r\n            string documentTitle = GetDocumentTitle(name);\r\n            DateTime installationDate = installedAddOnInformation.InstallDate.ToLocalTime();\r\n\r\n            this.Bindings = new Dictionary<string, object>\r\n            {\r\n                {BindingNames.DocumentTitle, documentTitle},\r\n                {BindingNames.InstalledPackageInformation, installedAddOnInformation},\r\n                {BindingNames.InstallDate, installationDate.ToString()}\r\n            };\r\n\r\n            PackageDescription packageDescription = null;\r\n            try\r\n            {\r\n                var allPackages = PackageServerFacade.GetAllPackageDescriptions(InstallationInformationFacade.InstallationId, UserSettings.CultureInfo);\r\n\r\n                packageDescription = allPackages.FirstOrDefault(p => p.Id == packageId);\r\n            }\r\n            catch\r\n            {\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(packageDescription?.ReadMoreUrl))\r\n            {\r\n                this.Bindings[BindingNames.ReadMoreUrl] = packageDescription.ReadMoreUrl;\r\n            }\r\n\r\n            var licenses = GetRelatedLicenses(packageId, packageDescription);\r\n            var actualLicense = licenses.OrderBy(l => l.HasExpired).ThenByDescending(l => l.IsSubscription).FirstOrDefault();\r\n\r\n            if (actualLicense != null)\r\n            {\r\n                Bindings[BindingNames.LicenseExpirationDate] = actualLicense.ExpirationDate.ToLocalTime().ToString();\r\n            }\r\n\r\n            bool isTrial = actualLicense != null && actualLicense.IsTrial;\r\n            this.Bindings[BindingNames.IsTrial] = isTrial;\r\n\r\n\r\n            bool showPurchaseButton = false;\r\n\r\n            if (isTrial && !string.IsNullOrWhiteSpace(actualLicense.PurchaseUrl))\r\n            {\r\n                string url = actualLicense.PurchaseUrl;\r\n                this.Bindings[BindingNames.TrialPurchaseUrl] = url;\r\n\r\n                showPurchaseButton = true;\r\n            }\r\n            this.Bindings[BindingNames.ShowPurchaseThisButton] = showPurchaseButton;\r\n\r\n            bool isSubscription = actualLicense != null && actualLicense.IsSubscription;\r\n            this.Bindings[BindingNames.IsSubscription] = isSubscription;\r\n            if (isSubscription)\r\n            {\r\n                Bindings[BindingNames.SubscriptionName] = actualLicense.Name;\r\n            }\r\n        }\r\n\r\n        private LicenseInformation[] GetRelatedLicenses(Guid packageId, PackageDescription packageDescription)\r\n        {\r\n            var result = new List<LicenseInformation>();\r\n\r\n            var licenseInfo = PackageLicenseHelper.GetLicenseDefinition(packageId);\r\n            if (licenseInfo != null)\r\n            {\r\n                result.Add(new LicenseInformation\r\n                {\r\n                    Name = licenseInfo.ProductName,\r\n                    IsSubscription = false,\r\n                    ExpirationDate = licenseInfo.Expires,\r\n                    HasExpired = !licenseInfo.Permanent && licenseInfo.Expires < DateTime.Now,\r\n                    IsTrial = !licenseInfo.Permanent,\r\n                    PurchaseUrl = licenseInfo.PurchaseUrl\r\n                });\r\n            }\r\n\r\n            if (packageDescription != null)\r\n            {\r\n                foreach (var subscription in packageDescription.AvailableInSubscriptions)\r\n                {\r\n                    var subscriptionLicense = PackageLicenseHelper.GetLicenseDefinition(subscription.Id);\r\n                    if (subscriptionLicense == null) continue;\r\n                    \r\n                    result.Add(new LicenseInformation\r\n                    {\r\n                        Name = subscription.Name,\r\n                        IsSubscription = true,\r\n                        ExpirationDate = subscriptionLicense.Expires,\r\n                        HasExpired = !subscriptionLicense.Permanent && subscriptionLicense.Expires < DateTime.Now,\r\n                        IsTrial = false,\r\n                        PurchaseUrl = subscription.DetailsUrl,\r\n                    });\r\n                }\r\n            }\r\n\r\n            return result.ToArray();\r\n        }\r\n\r\n        private string GetDocumentTitle(string name)\r\n        {\r\n            if (!name.Contains('.') || name.EndsWith(\".\"))\r\n            {\r\n                return name;\r\n            }\r\n\r\n            int nameOffset = name.LastIndexOf('.');\r\n            return $\"{name.Substring(nameOffset + 1)} ({name.Substring(0, nameOffset)})\";\r\n        }\r\n\r\n\r\n        private void uninstallCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var castedToken = (PackageElementProviderInstalledPackageItemEntityToken)this.EntityToken;\r\n\r\n            InstalledPackageInformation installedAddOnInformation =\r\n                (from info in PackageManager.GetInstalledPackages()\r\n                 where info.Id == castedToken.PackageId\r\n                 select info).FirstOrDefault();\r\n\r\n            if (installedAddOnInformation != null)\r\n            {\r\n                this.ExecuteWorklow(this.EntityToken,\r\n                    installedAddOnInformation.IsLocalInstalled\r\n                        ? typeof (UninstallLocalPackageWorkflow)\r\n                        : typeof (UninstallRemotePackageWorkflow));\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                    DialogType.Message,\r\n                    \"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.ShowError.MessageTitle}\",\r\n                    \"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.ShowError.MessageMessage}\");\r\n            }   \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/ViewInstalledPackageInfoWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PackageElementProvider\r\n{\r\n    partial class ViewInstalledPackageInfoWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.uninstallCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.customEvent01HandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity();\r\n            this.viewDocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.viewStateCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.uninstallStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Uninstall = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.viewStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.uninstallStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.viewStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"viewStateActivity\";\r\n            // \r\n            // uninstallCodeActivity\r\n            // \r\n            this.uninstallCodeActivity.Name = \"uninstallCodeActivity\";\r\n            this.uninstallCodeActivity.ExecuteCode += new System.EventHandler(this.uninstallCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"uninstallStateActivity\";\r\n            // \r\n            // customEvent01HandleExternalEventActivity1\r\n            // \r\n            this.customEvent01HandleExternalEventActivity1.EventName = \"CustomEvent01\";\r\n            this.customEvent01HandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.customEvent01HandleExternalEventActivity1.Name = \"customEvent01HandleExternalEventActivity1\";\r\n            // \r\n            // viewDocumentFormActivity\r\n            // \r\n            this.viewDocumentFormActivity.ContainerLabel = null;\r\n            this.viewDocumentFormActivity.CustomToolbarDefinitionFileName = null;\r\n            this.viewDocumentFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PackageElementProviderViewInstalledPackageInformation.xml\";\r\n            this.viewDocumentFormActivity.Name = \"viewDocumentFormActivity\";\r\n            // \r\n            // viewStateCodeActivity_Initialize\r\n            // \r\n            this.viewStateCodeActivity_Initialize.Name = \"viewStateCodeActivity_Initialize\";\r\n            this.viewStateCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.viewStateCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"viewStateActivity\";\r\n            // \r\n            // uninstallStateInitializationActivity\r\n            // \r\n            this.uninstallStateInitializationActivity.Activities.Add(this.uninstallCodeActivity);\r\n            this.uninstallStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.uninstallStateInitializationActivity.Name = \"uninstallStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Uninstall\r\n            // \r\n            this.eventDrivenActivity_Uninstall.Activities.Add(this.customEvent01HandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Uninstall.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Uninstall.Name = \"eventDrivenActivity_Uninstall\";\r\n            // \r\n            // viewStateInitializationActivity\r\n            // \r\n            this.viewStateInitializationActivity.Activities.Add(this.viewStateCodeActivity_Initialize);\r\n            this.viewStateInitializationActivity.Activities.Add(this.viewDocumentFormActivity);\r\n            this.viewStateInitializationActivity.Name = \"viewStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // uninstallStateActivity\r\n            // \r\n            this.uninstallStateActivity.Activities.Add(this.uninstallStateInitializationActivity);\r\n            this.uninstallStateActivity.Name = \"uninstallStateActivity\";\r\n            // \r\n            // viewStateActivity\r\n            // \r\n            this.viewStateActivity.Activities.Add(this.viewStateInitializationActivity);\r\n            this.viewStateActivity.Activities.Add(this.eventDrivenActivity_Uninstall);\r\n            this.viewStateActivity.Name = \"viewStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // ViewInstalledAddOnInfoWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.viewStateActivity);\r\n            this.Activities.Add(this.uninstallStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"ViewInstalledAddOnInfoWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity viewDocumentFormActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity viewStateInitializationActivity;\r\n        private StateActivity viewStateActivity;\r\n        private CodeActivity viewStateCodeActivity_Initialize;\r\n        private EventDrivenActivity eventDrivenActivity_Uninstall;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity customEvent01HandleExternalEventActivity1;\r\n        private StateInitializationActivity uninstallStateInitializationActivity;\r\n        private StateActivity uninstallStateActivity;\r\n        private CodeActivity uninstallCodeActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PackageElementProvider/ViewInstalledPackageInfoWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"ViewInstalledAddOnInfoWorkflow\" Location=\"30; 30\" Size=\"1146; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"ViewInstalledAddOnInfoWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"ViewInstalledAddOnInfoWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"viewStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"viewStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"402\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"402\" Y=\"432\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"uninstallStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"viewStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"uninstallStateActivity\" SourceActivity=\"viewStateActivity\" EventHandlerName=\"eventDrivenActivity_Uninstall\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"495\" Y=\"497\" />\r\n\t\t\t\t<ns0:Point X=\"767\" Y=\"497\" />\r\n\t\t\t\t<ns0:Point X=\"767\" Y=\"520\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"viewStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"uninstallStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"viewStateActivity\" SourceActivity=\"uninstallStateActivity\" EventHandlerName=\"uninstallStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"869\" Y=\"561\" />\r\n\t\t\t\t<ns0:Point X=\"882\" Y=\"561\" />\r\n\t\t\t\t<ns0:Point X=\"882\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"402\" Y=\"424\" />\r\n\t\t\t\t<ns0:Point X=\"402\" Y=\"432\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"viewStateActivity\" Location=\"306; 432\" Size=\"193; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"viewStateInitializationActivity\" Location=\"520; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"viewStateCodeActivity_Initialize\" Location=\"530; 197\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"viewDocumentFormActivity\" Location=\"530; 257\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Uninstall\" Location=\"528; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"customEvent01HandleExternalEventActivity1\" Location=\"538; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"538; 270\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"uninstallStateActivity\" Location=\"661; 520\" Size=\"212; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"uninstallStateInitializationActivity\" Location=\"669; 551\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"uninstallCodeActivity\" Location=\"679; 613\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"679; 673\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/AddNewPageWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    partial class AddNewPageWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition5 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition6 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition7 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition8 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition9 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition10 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.RuleDontAllowPageAddCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.stepInitialize_codeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity14 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity13 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingPageTypeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElse_RulesDontAllowPageAdd = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity12 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity11 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingActiveLanguageCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElse_CheckPageTypesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity_GoToFinalize = new System.Workflow.Activities.SetStateActivity();\r\n            this.PresetCalculatedFields = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity10 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity9 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity20 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingTemplateAlertActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElse_CheckActiveLanguagesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity_GoToStep2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseActivity4_ValidateUrlTitle = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity8 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity7 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElse_CheckTemplatesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity14 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseActivity_CanSkipStep2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity13 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity_redoStep2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity16 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseCheckPageTypesExist = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity19 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity18 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity17 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity15 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElse_FirstPageValid = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.ifFirstPageValid = new System.Workflow.Activities.IfElseActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.step1WizzardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.stepFinalize_codeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity__ValidateUrlTitle = new System.Workflow.Activities.IfElseActivity();\r\n            this.handleExternalEventActivity5 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.handleExternalEventActivity2 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.step2WizzardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.PrepareStep2 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1_eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1_eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1_eventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2_eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2_eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2_eventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1State = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            this.step2State = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"finishState\";\r\n            // \r\n            // RuleDontAllowPageAddCodeActivity\r\n            // \r\n            this.RuleDontAllowPageAddCodeActivity.Name = \"RuleDontAllowPageAddCodeActivity\";\r\n            this.RuleDontAllowPageAddCodeActivity.ExecuteCode += new System.EventHandler(this.RuleDontAllowPageAddCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1State\";\r\n            // \r\n            // stepInitialize_codeActivity\r\n            // \r\n            this.stepInitialize_codeActivity.Name = \"stepInitialize_codeActivity\";\r\n            this.stepInitialize_codeActivity.ExecuteCode += new System.EventHandler(this.stepInitialize_codeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity14\r\n            // \r\n            this.ifElseBranchActivity14.Activities.Add(this.RuleDontAllowPageAddCodeActivity);\r\n            this.ifElseBranchActivity14.Activities.Add(this.setStateActivity10);\r\n            this.ifElseBranchActivity14.Name = \"ifElseBranchActivity14\";\r\n            // \r\n            // ifElseBranchActivity13\r\n            // \r\n            this.ifElseBranchActivity13.Activities.Add(this.stepInitialize_codeActivity);\r\n            this.ifElseBranchActivity13.Activities.Add(this.setStateActivity4);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckRulesAllowPageAddExists);\r\n            this.ifElseBranchActivity13.Condition = codecondition1;\r\n            this.ifElseBranchActivity13.Name = \"ifElseBranchActivity13\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finishState\";\r\n            // \r\n            // MissingPageTypeCodeActivity\r\n            // \r\n            this.MissingPageTypeCodeActivity.Name = \"MissingPageTypeCodeActivity\";\r\n            this.MissingPageTypeCodeActivity.ExecuteCode += new System.EventHandler(this.MissingPageTypeCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElse_RulesDontAllowPageAdd\r\n            // \r\n            this.ifElse_RulesDontAllowPageAdd.Activities.Add(this.ifElseBranchActivity13);\r\n            this.ifElse_RulesDontAllowPageAdd.Activities.Add(this.ifElseBranchActivity14);\r\n            this.ifElse_RulesDontAllowPageAdd.Name = \"ifElse_RulesDontAllowPageAdd\";\r\n            // \r\n            // ifElseBranchActivity12\r\n            // \r\n            this.ifElseBranchActivity12.Activities.Add(this.MissingPageTypeCodeActivity);\r\n            this.ifElseBranchActivity12.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity12.Name = \"ifElseBranchActivity12\";\r\n            // \r\n            // ifElseBranchActivity11\r\n            // \r\n            this.ifElseBranchActivity11.Activities.Add(this.ifElse_RulesDontAllowPageAdd);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckPageTypeExists);\r\n            this.ifElseBranchActivity11.Condition = codecondition2;\r\n            this.ifElseBranchActivity11.Name = \"ifElseBranchActivity11\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finishState\";\r\n            // \r\n            // MissingActiveLanguageCodeActivity\r\n            // \r\n            this.MissingActiveLanguageCodeActivity.Name = \"MissingActiveLanguageCodeActivity\";\r\n            this.MissingActiveLanguageCodeActivity.ExecuteCode += new System.EventHandler(this.MissingActiveLanguageCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElse_CheckPageTypesExists\r\n            // \r\n            this.ifElse_CheckPageTypesExists.Activities.Add(this.ifElseBranchActivity11);\r\n            this.ifElse_CheckPageTypesExists.Activities.Add(this.ifElseBranchActivity12);\r\n            this.ifElse_CheckPageTypesExists.Name = \"ifElse_CheckPageTypesExists\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step1State\";\r\n            // \r\n            // setStateActivity_GoToFinalize\r\n            // \r\n            this.setStateActivity_GoToFinalize.Name = \"setStateActivity_GoToFinalize\";\r\n            this.setStateActivity_GoToFinalize.TargetStateName = \"finalizeActivity\";\r\n            // \r\n            // PresetCalculatedFields\r\n            // \r\n            this.PresetCalculatedFields.Name = \"PresetCalculatedFields\";\r\n            this.PresetCalculatedFields.ExecuteCode += new System.EventHandler(this.PresetCalculatedFields_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.MissingActiveLanguageCodeActivity);\r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.ifElse_CheckPageTypesExists);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckActiveLanguagesExists);\r\n            this.ifElseBranchActivity5.Condition = codecondition3;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity10\r\n            // \r\n            this.ifElseBranchActivity10.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity10.Name = \"ifElseBranchActivity10\";\r\n            // \r\n            // ifElseBranchActivity9\r\n            // \r\n            this.ifElseBranchActivity9.Activities.Add(this.PresetCalculatedFields);\r\n            this.ifElseBranchActivity9.Activities.Add(this.setStateActivity_GoToFinalize);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateUrlTitle);\r\n            this.ifElseBranchActivity9.Condition = codecondition4;\r\n            this.ifElseBranchActivity9.Name = \"ifElseBranchActivity9\";\r\n            // \r\n            // setStateActivity20\r\n            // \r\n            this.setStateActivity20.Name = \"setStateActivity20\";\r\n            this.setStateActivity20.TargetStateName = \"finishState\";\r\n            // \r\n            // MissingTemplateAlertActivity\r\n            // \r\n            this.MissingTemplateAlertActivity.Name = \"MissingTemplateAlertActivity\";\r\n            this.MissingTemplateAlertActivity.ExecuteCode += new System.EventHandler(this.MissingTemplateAlertActivity_ExecuteCode);\r\n            // \r\n            // ifElse_CheckActiveLanguagesExists\r\n            // \r\n            this.ifElse_CheckActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElse_CheckActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElse_CheckActiveLanguagesExists.Name = \"ifElse_CheckActiveLanguagesExists\";\r\n            // \r\n            // setStateActivity_GoToStep2\r\n            // \r\n            this.setStateActivity_GoToStep2.Name = \"setStateActivity_GoToStep2\";\r\n            this.setStateActivity_GoToStep2.TargetStateName = \"step2State\";\r\n            // \r\n            // ifElseActivity4_ValidateUrlTitle\r\n            // \r\n            this.ifElseActivity4_ValidateUrlTitle.Activities.Add(this.ifElseBranchActivity9);\r\n            this.ifElseActivity4_ValidateUrlTitle.Activities.Add(this.ifElseBranchActivity10);\r\n            this.ifElseActivity4_ValidateUrlTitle.Description = \"ValidateUrlTitle\";\r\n            this.ifElseActivity4_ValidateUrlTitle.Name = \"ifElseActivity4_ValidateUrlTitle\";\r\n            // \r\n            // ifElseBranchActivity8\r\n            // \r\n            this.ifElseBranchActivity8.Activities.Add(this.MissingTemplateAlertActivity);\r\n            this.ifElseBranchActivity8.Activities.Add(this.setStateActivity20);\r\n            this.ifElseBranchActivity8.Name = \"ifElseBranchActivity8\";\r\n            // \r\n            // ifElseBranchActivity7\r\n            // \r\n            this.ifElseBranchActivity7.Activities.Add(this.ifElse_CheckActiveLanguagesExists);\r\n            codecondition5.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckTemplatesExists);\r\n            this.ifElseBranchActivity7.Condition = codecondition5;\r\n            this.ifElseBranchActivity7.Name = \"ifElseBranchActivity7\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity_GoToStep2);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.ifElseActivity4_ValidateUrlTitle);\r\n            codecondition6.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CanSkipStep2);\r\n            this.ifElseBranchActivity3.Condition = codecondition6;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finishState\";\r\n            // \r\n            // ifElse_CheckTemplatesExists\r\n            // \r\n            this.ifElse_CheckTemplatesExists.Activities.Add(this.ifElseBranchActivity7);\r\n            this.ifElse_CheckTemplatesExists.Activities.Add(this.ifElseBranchActivity8);\r\n            this.ifElse_CheckTemplatesExists.Name = \"ifElse_CheckTemplatesExists\";\r\n            // \r\n            // setStateActivity14\r\n            // \r\n            this.setStateActivity14.Name = \"setStateActivity14\";\r\n            this.setStateActivity14.TargetStateName = \"step1State\";\r\n            // \r\n            // ifElseActivity_CanSkipStep2\r\n            // \r\n            this.ifElseActivity_CanSkipStep2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity_CanSkipStep2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity_CanSkipStep2.Name = \"ifElseActivity_CanSkipStep2\";\r\n            // \r\n            // setStateActivity13\r\n            // \r\n            this.setStateActivity13.Name = \"setStateActivity13\";\r\n            this.setStateActivity13.TargetStateName = \"step1State\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step2State\";\r\n            // \r\n            // setStateActivity_redoStep2\r\n            // \r\n            this.setStateActivity_redoStep2.Name = \"setStateActivity_redoStep2\";\r\n            this.setStateActivity_redoStep2.TargetStateName = \"step2State\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"finalizeActivity\";\r\n            // \r\n            // ifElseBranchActivity16\r\n            // \r\n            this.ifElseBranchActivity16.Activities.Add(this.setStateActivity11);\r\n            this.ifElseBranchActivity16.Name = \"ifElseBranchActivity16\";\r\n            // \r\n            // ifElseCheckPageTypesExist\r\n            // \r\n            this.ifElseCheckPageTypesExist.Activities.Add(this.ifElse_CheckTemplatesExists);\r\n            codecondition7.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckPageTypesExist);\r\n            this.ifElseCheckPageTypesExist.Condition = codecondition7;\r\n            this.ifElseCheckPageTypesExist.Name = \"ifElseCheckPageTypesExist\";\r\n            // \r\n            // ifElseBranchActivity19\r\n            // \r\n            this.ifElseBranchActivity19.Activities.Add(this.setStateActivity14);\r\n            this.ifElseBranchActivity19.Name = \"ifElseBranchActivity19\";\r\n            // \r\n            // ifElseBranchActivity18\r\n            // \r\n            this.ifElseBranchActivity18.Activities.Add(this.ifElseActivity_CanSkipStep2);\r\n            codecondition8.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateFirstPage);\r\n            this.ifElseBranchActivity18.Condition = codecondition8;\r\n            this.ifElseBranchActivity18.Name = \"ifElseBranchActivity18\";\r\n            // \r\n            // ifElseBranchActivity17\r\n            // \r\n            this.ifElseBranchActivity17.Activities.Add(this.setStateActivity13);\r\n            this.ifElseBranchActivity17.Name = \"ifElseBranchActivity17\";\r\n            // \r\n            // ifElseBranchActivity15\r\n            // \r\n            this.ifElseBranchActivity15.Activities.Add(this.setStateActivity3);\r\n            codecondition9.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateFirstPage);\r\n            this.ifElseBranchActivity15.Condition = codecondition9;\r\n            this.ifElseBranchActivity15.Name = \"ifElseBranchActivity15\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity_redoStep2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity12);\r\n            codecondition10.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateUrlTitle);\r\n            this.ifElseBranchActivity1.Condition = codecondition10;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseCheckPageTypesExist);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity16);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElse_FirstPageValid\r\n            // \r\n            this.ifElse_FirstPageValid.Activities.Add(this.ifElseBranchActivity18);\r\n            this.ifElse_FirstPageValid.Activities.Add(this.ifElseBranchActivity19);\r\n            this.ifElse_FirstPageValid.Name = \"ifElse_FirstPageValid\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // ifFirstPageValid\r\n            // \r\n            this.ifFirstPageValid.Activities.Add(this.ifElseBranchActivity15);\r\n            this.ifFirstPageValid.Activities.Add(this.ifElseBranchActivity17);\r\n            this.ifFirstPageValid.Name = \"ifFirstPageValid\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizzardFormActivity\r\n            // \r\n            this.step1WizzardFormActivity.ContainerLabel = \"Add new\";\r\n            this.step1WizzardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewPageStep1.xml\";\r\n            this.step1WizzardFormActivity.Name = \"step1WizzardFormActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // stepFinalize_codeActivity\r\n            // \r\n            this.stepFinalize_codeActivity.Name = \"stepFinalize_codeActivity\";\r\n            this.stepFinalize_codeActivity.ExecuteCode += new System.EventHandler(this.stepFinalize_codeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // ifElseActivity__ValidateUrlTitle\r\n            // \r\n            this.ifElseActivity__ValidateUrlTitle.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity__ValidateUrlTitle.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity__ValidateUrlTitle.Name = \"ifElseActivity__ValidateUrlTitle\";\r\n            // \r\n            // handleExternalEventActivity5\r\n            // \r\n            this.handleExternalEventActivity5.EventName = \"Finish\";\r\n            this.handleExternalEventActivity5.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity5.Name = \"handleExternalEventActivity5\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"step1State\";\r\n            // \r\n            // handleExternalEventActivity2\r\n            // \r\n            this.handleExternalEventActivity2.EventName = \"Previous\";\r\n            this.handleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity2.Name = \"handleExternalEventActivity2\";\r\n            // \r\n            // step2WizzardFormActivity\r\n            // \r\n            this.step2WizzardFormActivity.ContainerLabel = \"Add new\";\r\n            this.step2WizzardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewPageStep2.xml\";\r\n            this.step2WizzardFormActivity.Name = \"step2WizzardFormActivity\";\r\n            // \r\n            // PrepareStep2\r\n            // \r\n            this.PrepareStep2.Name = \"PrepareStep2\";\r\n            this.PrepareStep2.ExecuteCode += new System.EventHandler(this.PrepareStep2_ExecuteCode);\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // step1_eventDrivenActivity_Cancel\r\n            // \r\n            this.step1_eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1_eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step1_eventDrivenActivity_Cancel.Name = \"step1_eventDrivenActivity_Cancel\";\r\n            // \r\n            // step1_eventDrivenActivity_Finish\r\n            // \r\n            this.step1_eventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1_eventDrivenActivity_Finish.Activities.Add(this.ifElse_FirstPageValid);\r\n            this.step1_eventDrivenActivity_Finish.Name = \"step1_eventDrivenActivity_Finish\";\r\n            // \r\n            // step1_eventDrivenActivity_Next\r\n            // \r\n            this.step1_eventDrivenActivity_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1_eventDrivenActivity_Next.Activities.Add(this.ifFirstPageValid);\r\n            this.step1_eventDrivenActivity_Next.Name = \"step1_eventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizzardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.stepFinalize_codeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step2_eventDrivenActivity_Cancel\r\n            // \r\n            this.step2_eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2_eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step2_eventDrivenActivity_Cancel.Name = \"step2_eventDrivenActivity_Cancel\";\r\n            // \r\n            // step2_eventDrivenActivity_Finish\r\n            // \r\n            this.step2_eventDrivenActivity_Finish.Activities.Add(this.handleExternalEventActivity5);\r\n            this.step2_eventDrivenActivity_Finish.Activities.Add(this.ifElseActivity__ValidateUrlTitle);\r\n            this.step2_eventDrivenActivity_Finish.Name = \"step2_eventDrivenActivity_Finish\";\r\n            // \r\n            // step2_eventDrivenActivity_Previous\r\n            // \r\n            this.step2_eventDrivenActivity_Previous.Activities.Add(this.handleExternalEventActivity2);\r\n            this.step2_eventDrivenActivity_Previous.Activities.Add(this.setStateActivity8);\r\n            this.step2_eventDrivenActivity_Previous.Name = \"step2_eventDrivenActivity_Previous\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.PrepareStep2);\r\n            this.step2StateInitializationActivity.Activities.Add(this.step2WizzardFormActivity);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity19);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // initializeActivity\r\n            // \r\n            this.initializeActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeActivity.Name = \"initializeActivity\";\r\n            // \r\n            // step1State\r\n            // \r\n            this.step1State.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Next);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Finish);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Cancel);\r\n            this.step1State.Name = \"step1State\";\r\n            // \r\n            // finalizeActivity\r\n            // \r\n            this.finalizeActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeActivity.Name = \"finalizeActivity\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // step2State\r\n            // \r\n            this.step2State.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2State.Activities.Add(this.step2_eventDrivenActivity_Previous);\r\n            this.step2State.Activities.Add(this.step2_eventDrivenActivity_Finish);\r\n            this.step2State.Activities.Add(this.step2_eventDrivenActivity_Cancel);\r\n            this.step2State.Name = \"step2State\";\r\n            // \r\n            // AddNewPageWorkflow\r\n            // \r\n            this.Activities.Add(this.step2State);\r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.finalizeActivity);\r\n            this.Activities.Add(this.step1State);\r\n            this.Activities.Add(this.initializeActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeActivity\";\r\n            this.Name = \"AddNewPageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1_eventDrivenActivity_Next;\r\n\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n\r\n        private StateActivity step2State;\r\n\r\n        private EventDrivenActivity step2_eventDrivenActivity_Previous;\r\n\r\n        private HandleExternalEventActivity handleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private EventDrivenActivity step2_eventDrivenActivity_Finish;\r\n\r\n        private StateActivity finishState;\r\n\r\n        private HandleExternalEventActivity handleExternalEventActivity5;\r\n\r\n        private StateActivity finalizeActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private CodeActivity stepFinalize_codeActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private StateActivity initializeActivity;\r\n\r\n        private CodeActivity stepInitialize_codeActivity;\r\n\r\n        private SetStateActivity setStateActivity12;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step1WizzardFormActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step2WizzardFormActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private SetStateActivity setStateActivity19;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity8;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity7;\r\n\r\n        private IfElseActivity ifElse_CheckTemplatesExists;\r\n\r\n        private CodeActivity MissingTemplateAlertActivity;\r\n\r\n        private SetStateActivity setStateActivity20;\r\n\r\n        private SetStateActivity setStateActivity_redoStep2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity__ValidateUrlTitle;\r\n\r\n        private EventDrivenActivity step1_eventDrivenActivity_Finish;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity_CanSkipStep2;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity_GoToStep2;\r\n\r\n        private SetStateActivity setStateActivity_GoToFinalize;\r\n\r\n        private CodeActivity PresetCalculatedFields;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private EventDrivenActivity step1_eventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step2_eventDrivenActivity_Cancel;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n\r\n        private IfElseActivity ifElse_CheckActiveLanguagesExists;\r\n\r\n        private CodeActivity MissingActiveLanguageCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity10;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity9;\r\n\r\n        private IfElseActivity ifElseActivity4_ValidateUrlTitle;\r\n\r\n        private CodeActivity PrepareStep2;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private CodeActivity MissingPageTypeCodeActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity12;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity11;\r\n\r\n        private IfElseActivity ifElse_CheckPageTypesExists;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity14;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity13;\r\n\r\n        private IfElseActivity ifElse_RulesDontAllowPageAdd;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private CodeActivity RuleDontAllowPageAddCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity11;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity16;\r\n\r\n        private IfElseBranchActivity ifElseCheckPageTypesExist;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private SetStateActivity setStateActivity13;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity17;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity15;\r\n\r\n        private IfElseActivity ifFirstPageValid;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity14;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity19;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity18;\r\n\r\n        private IfElseActivity ifElse_FirstPageValid;\r\n\r\n        private StateActivity step1State;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/AddNewPageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\n\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.Routing.Foundation.PluginFacades;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Extensions;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Serialization;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewPageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        private List<IPageType> _selectablePageTypes;\r\n\r\n        private static class SortOrder\r\n        {\r\n            internal static string Bottom = \"Bottom\";\r\n            internal static string Top = \"Top\";\r\n            internal static string Relative = \"Relative\";\r\n            internal static string Alphabetic = \"Alphabetic\";\r\n        }\r\n\r\n        public AddNewPageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private Guid GetParentId()\r\n        {\r\n            if (this.EntityToken is PageElementProviderEntityToken)\r\n            {\r\n                return Guid.Empty;\r\n            }\r\n\r\n            if (this.EntityToken is DataEntityToken dataEntityToken)\r\n            {\r\n                IPage selectedPage = (IPage)dataEntityToken.Data;\r\n\r\n                return selectedPage.Id;\r\n            }\r\n\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n\r\n\r\n\r\n        private List<IPageType> GetSelectablePageTypes()\r\n        {\r\n            if (_selectablePageTypes == null)\r\n            {\r\n                if (this.EntityToken is PageElementProviderEntityToken)\r\n                {\r\n                    _selectablePageTypes =\r\n                        DataFacade.GetData<IPageType>().\r\n                        Where(f => f.Available  && (f.HomepageRelation != PageTypeHomepageRelation.OnlySubPages.ToString())).\r\n                        OrderBy(f => f.Name).\r\n                        ToList();\r\n                }\r\n                else\r\n                {\r\n                    IPage page = this.GetDataItemFromEntityToken<IPage>();\r\n\r\n                    _selectablePageTypes = page.GetChildPageSelectablePageTypes().ToList();\r\n                }\r\n            }\r\n\r\n            return _selectablePageTypes;\r\n        }\r\n\r\n\r\n\r\n        private Guid? GetDefaultPageTypeId(ICollection<IPageType> selectablePageTypes)\r\n        {\r\n            if (!string.IsNullOrEmpty(Payload))\r\n            {\r\n                return ((IPage)SerializerHandlerFacade.Deserialize(Payload)).PageTypeId;\r\n            }\r\n\r\n            if (!(this.EntityToken is PageElementProviderEntityToken))\r\n            {\r\n                IPage parentPage = this.GetDataItemFromEntityToken<IPage>();\r\n\r\n                IPageType parentPageType = DataFacade.GetData<IPageType>().FirstOrDefault(f => f.Id == parentPage.PageTypeId);\r\n\r\n                if (parentPageType != null && parentPageType.DefaultChildPageType != Guid.Empty)\r\n                {\r\n                    if (selectablePageTypes.Any(f => f.Id == parentPageType.DefaultChildPageType))\r\n                    {\r\n                        return parentPageType.DefaultChildPageType;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return selectablePageTypes.FirstOrDefault()?.Id;\r\n        }\r\n\r\n\r\n\r\n        private void MissingTemplateAlertActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(\r\n                DialogType.Message,\r\n                GetText(\"PageElementProvider.MissingTemplateTitle\"),\r\n                GetText(\"PageElementProvider.MissingTemplateMessage\"));\r\n        }\r\n\r\n\r\n\r\n        private void MissingActiveLanguageCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(\r\n                DialogType.Message,\r\n                GetText(\"PageElementProvider.MissingActiveLanguageTitle\"),\r\n                GetText(\"PageElementProvider.MissingActiveLanguageMessage\"));\r\n        }\r\n\r\n\r\n\r\n        private void MissingPageTypeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (this.EntityToken is PageElementProviderEntityToken)\r\n            {\r\n                ShowMessage(\r\n                    DialogType.Message,\r\n                    GetText(\"PageElementProvider.MissingPageTypeTitle\"),\r\n                    GetText(\"PageElementProvider.MissingPageTypeHomepageMessage\"));\r\n            }\r\n            else\r\n            {\r\n                ShowMessage(\r\n                    DialogType.Message,\r\n                    GetText(\"PageElementProvider.MissingPageTypeTitle\"),\r\n                    GetText(\"PageElementProvider.MissingPageTypeSubpageMessage\"));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void RuleDontAllowPageAddCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(\r\n                DialogType.Message,\r\n                GetText(\"PageElementProvider.RuleDontAllowPageAddTitle\"),\r\n                GetText(\"PageElementProvider.RuleDontAllowPageAddMessage\"));\r\n        }\r\n\r\n        private static string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", key);\r\n        }\r\n\r\n        private void CheckTemplatesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = PageTemplateFacade.ValidTemplateExists;\r\n        }\r\n\r\n\r\n\r\n        private void CheckActiveLanguagesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = UserSettings.ActiveLocaleCultureInfo != null;\r\n        }\r\n\r\n\r\n\r\n        private void CheckPageTypeExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            PageTypeHomepageRelation relationToExclude;\r\n\r\n            if (this.EntityToken is PageElementProviderEntityToken)\r\n            {\r\n                relationToExclude = PageTypeHomepageRelation.OnlySubPages;\r\n            }\r\n            else\r\n            {\r\n                relationToExclude = PageTypeHomepageRelation.OnlyHomePages;\r\n            }\r\n\r\n            e.Result = DataFacade.GetData<IPageType>()\r\n                .Any(f => f.Available && f.HomepageRelation != relationToExclude.ToString());\r\n        }\r\n\r\n\r\n\r\n        private void CheckRulesAllowPageAddExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = GetSelectablePageTypes().Count > 0;\r\n        }\r\n\r\n\r\n        private void CheckPageTypesExist(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = GetSelectablePageTypes().Any();\r\n\r\n            if (!e.Result)\r\n            {\r\n                ShowMessage(DialogType.Error,\r\n                    GetText(\"PageElementProvider.NoPageTypesAvailableTitle\"),\r\n                    GetText(\"PageElementProvider.NoPageTypesAvailableMessage\"));\r\n            }\r\n        }\r\n\r\n        private bool ThereAreOtherPages()\r\n        {\r\n            foreach (var cultureInfo in DataLocalizationFacade.ActiveLocalizationCultures)\r\n            {\r\n                using (new DataScope(PublicationScope.Unpublished, cultureInfo))\r\n                {\r\n                    if (DataFacade.GetData<IPageStructure>().Any())\r\n                    {\r\n                        return true;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        private void stepInitialize_codeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Guid templateId;\r\n\r\n            if (this.EntityToken is PageElementProviderEntityToken)\r\n            {\r\n                templateId = PageTemplateFacade.GetPageTemplates().Select(t => t.Id).FirstOrDefault();\r\n            }\r\n            else if (this.EntityToken is DataEntityToken dataEntityToken)\r\n            {\r\n                IPage selectedPage = (IPage)dataEntityToken.Data;\r\n\r\n                templateId = selectedPage.TemplateId;\r\n            }\r\n            else\r\n            {\r\n                throw new NotSupportedException();\r\n            }\r\n\r\n\r\n            List<IPageType> selectablePageTypes = GetSelectablePageTypes();\r\n\r\n            Guid? pageTypeId = GetDefaultPageTypeId(selectablePageTypes);\r\n\r\n            Verify.That(pageTypeId.HasValue, \"Failed to get a page type\");\r\n\r\n            Guid parentId = GetParentId();\r\n\r\n            string pageType = selectablePageTypes.First(f => f.Id == pageTypeId).Name;\r\n\r\n            IPage newPage = DataFacade.BuildNew<IPage>();\r\n            newPage.Id = Guid.NewGuid();\r\n            newPage.TemplateId = templateId;\r\n            newPage.PageTypeId = pageTypeId.Value;\r\n            newPage.Title = \"\";\r\n            newPage.MenuTitle = \"\";\r\n            newPage.UrlTitle = \"\";\r\n            newPage.FriendlyUrl = \"\";\r\n            newPage.PublicationStatus = GenericPublishProcessController.Draft;\r\n\r\n\r\n\r\n            int existingPagesCount = PageServices.GetChildrenCount(parentId);\r\n            var sortOrder = new Dictionary<string, string>\r\n            {\r\n                {SortOrder.Bottom, GetText(\"AddNewPageStep1.LabelAddToBottom\")}\r\n            };\r\n            if (existingPagesCount > 0)\r\n            {\r\n                sortOrder.Add(SortOrder.Top, GetText(\"AddNewPageStep1.LabelAddToTop\"));\r\n                if (existingPagesCount > 1)\r\n                {\r\n                    sortOrder.Add(SortOrder.Relative, GetText(\"AddNewPageStep1.LabelAddBelowOtherPage\"));\r\n                }\r\n\r\n                bool isAlpabeticOrdered = PageServices.IsChildrenAlphabeticOrdered(parentId);\r\n                if (isAlpabeticOrdered)\r\n                {\r\n                    sortOrder.Add(SortOrder.Alphabetic, GetText(\"AddNewPageStep1.LabelAddAlphabetic\"));\r\n                }\r\n            }\r\n\r\n            var bindings = new Dictionary<string, object>\r\n            {\r\n                {\"NewPage\", newPage},\r\n                {\"Title\", string.Format(GetText(\"AddNewPageStep1.DialogLabelFormat\"), pageType)},\r\n                {\"UrlTitleIsRequired\", true},\r\n                {\"SortOrder\", sortOrder},\r\n                {\"SelectedSortOrder\", sortOrder.Keys.First()}\r\n            };\r\n\r\n            if (parentId == Guid.Empty)\r\n            {\r\n                bindings.Add(\"ShowCulture\", true);\r\n                bindings.Add(\"Cultures\", DataLocalizationFacade.WhiteListedLocales\r\n                                         .Select(f => new KeyValuePair<string, string>(f.Name, DataLocalizationFacade.GetCultureTitle(f))).ToList());\r\n            }\r\n            else\r\n            {\r\n                bindings.Add(\"ShowCulture\", false);\r\n            }\r\n\r\n            this.Bindings = bindings;\r\n        }\r\n\r\n\r\n        private void CanSkipStep2(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPage newPage = this.GetBinding<IPage>(\"NewPage\");\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeof(IPage));\r\n\r\n            e.Result = this.GetBinding<string>(\"SelectedSortOrder\") != SortOrder.Relative\r\n                       && UrlTitleIsUniqueAmongSiblings()\r\n                       && newPage.UrlTitle.Length <= dataTypeDescriptor.Fields[\"UrlTitle\"].StoreType.MaximumLength\r\n                       && newPage.MenuTitle.Length <= dataTypeDescriptor.Fields[\"MenuTitle\"].StoreType.MaximumLength;\r\n        }\r\n\r\n\r\n        private void ValidateUrlTitle(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPage newPage = this.GetBinding<IPage>(\"NewPage\");\r\n\r\n            if (this.CurrentStateName == \"step1State\")\r\n            {\r\n                SetDefaultValues(newPage);\r\n            }\r\n\r\n            e.Result = true;\r\n\r\n            if (!UrlTitleIsUniqueAmongSiblings())\r\n            {\r\n                string fieldName = \"NewPage.UrlTitle\";\r\n\r\n                if (this.CurrentStateName == \"step1State\")\r\n                {\r\n                    fieldName = \"NewPage.Title\";\r\n                }\r\n\r\n                this.ShowFieldMessage(fieldName, GetText(\"UrlTitleNotUniqueError\"));\r\n                e.Result = false;\r\n            }\r\n            else\r\n            {\r\n                ValidationResults validationResults = ValidationFacade.Validate<IPage>(newPage);\r\n\r\n                if (!validationResults.IsValid && validationResults.Any(f => f.Key == \"UrlTitle\"))\r\n                {\r\n                    this.ShowFieldMessage(\"NewPage.Title\", \"${Composite.Plugins.PageElementProvider, UrlTitleNotValidError}\");\r\n                    e.Result = false;\r\n                }\r\n            }\r\n\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeof(IPage));\r\n\r\n            if (newPage.UrlTitle.Length > dataTypeDescriptor.Fields[\"UrlTitle\"].StoreType.MaximumLength)\r\n            {\r\n                this.ShowFieldMessage(\"NewPage.UrlTitle\", GetText(\"UrlTitleTooLong\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            if (newPage.MenuTitle.Length > dataTypeDescriptor.Fields[\"MenuTitle\"].StoreType.MaximumLength)\r\n            {\r\n                this.ShowFieldMessage(\"NewPage.MenuTitle\", GetText(\"AddNewPageStep1.MenuTitleTooLong\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n        }\r\n\r\n\r\n\r\n        private bool UrlTitleIsUniqueAmongSiblings()\r\n        {\r\n            IPage newPage = this.GetBinding<IPage>(\"NewPage\");\r\n\r\n            var siblingPageUrlTitles =\r\n                (from page in PageServices.GetChildren(GetParentId())\r\n                 select page.UrlTitle).ToList();\r\n\r\n            if (string.IsNullOrEmpty(newPage.UrlTitle) && ThereAreOtherPages())\r\n            {\r\n                newPage.UrlTitle = GenerateUrlTitleFromTitle(newPage.Title);\r\n\r\n                if (string.IsNullOrEmpty(newPage.UrlTitle))\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            return !siblingPageUrlTitles.Any(urlTitle => urlTitle.Equals(newPage.UrlTitle, StringComparison.InvariantCultureIgnoreCase));\r\n        }\r\n\r\n\r\n\r\n        private void PrepareStep2_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPage newPage = this.GetBinding<IPage>(\"NewPage\");\r\n\r\n            SetDefaultValues(newPage);\r\n\r\n            if (this.GetBinding<string>(\"SelectedSortOrder\") == SortOrder.Relative)\r\n            {\r\n                Dictionary<Guid, string> existingPages = PageServices.GetChildren(GetParentId())\r\n                    .GroupBy(page => page.Id)\r\n                    .Select(group => group.First())\r\n                    .ToDictionary(page => page.Id, page => page.Title);\r\n\r\n                this.Bindings[\"ExistingPages\"] = existingPages;\r\n                this.Bindings[\"RelativeSelectedPageId\"] = existingPages.First().Key;\r\n            }\r\n            else\r\n            {\r\n                this.Bindings.Remove(\"ExistingPages\");\r\n                this.Bindings.Remove(\"RelativeSelectedPageId\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void stepFinalize_codeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            IPage newPage = this.GetBinding<IPage>(\"NewPage\");\r\n            newPage.SourceCultureName = UserSettings.ActiveLocaleCultureInfo.Name;\r\n\r\n            Guid pageTypeId = newPage.PageTypeId;\r\n            Guid? defaultPageTemplateId = PageServices.GetDefaultPageTemplateId(pageTypeId);\r\n            if (defaultPageTemplateId != null)\r\n            {\r\n                newPage.TemplateId = defaultPageTemplateId.Value;\r\n            }\r\n\r\n            string sortOrder = this.GetBinding<string>(\"SelectedSortOrder\");\r\n\r\n            Guid parentId = GetParentId();\r\n\r\n            using (new DataScope(DataScopeIdentifier.Administrated))\r\n            {\r\n                IPageInsertionPosition position;\r\n\r\n                if (sortOrder == SortOrder.Top)\r\n                {\r\n                    position = PageInsertPosition.Top;\r\n                }\r\n                else if (sortOrder == SortOrder.Bottom)\r\n                {\r\n                    position = PageInsertPosition.Bottom;\r\n                }\r\n                else if (sortOrder == SortOrder.Alphabetic)\r\n                {\r\n                    position = PageInsertPosition.Alphabetic;\r\n                }\r\n                else if (sortOrder == SortOrder.Relative)\r\n                {\r\n                    Guid relativeSelectedPageId = this.GetBinding<Guid>(\"RelativeSelectedPageId\");\r\n\r\n                    position = PageInsertPosition.After(relativeSelectedPageId);\r\n                }\r\n                else\r\n                {\r\n                    throw new InvalidOperationException($\"Not handled page insert position '{sortOrder}'\");\r\n                }\r\n\r\n                newPage = newPage.Add(parentId, position);\r\n            }\r\n\r\n            SetSaveStatus(true);\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(newPage.GetDataEntityToken());\r\n\r\n            this.ExecuteWorklow(newPage.GetDataEntityToken(), typeof(EditPageWorkflow));\r\n        }\r\n\r\n\r\n\r\n        private string GenerateUrlTitleFromTitle(string title)\r\n        {\r\n            return UrlFormattersPluginFacade.FormatUrl(title.Trim(), false);\r\n        }\r\n\r\n\r\n\r\n        private void PresetCalculatedFields_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPage newPage = this.GetBinding<IPage>(\"NewPage\");\r\n\r\n            SetDefaultValues(newPage);\r\n        }\r\n\r\n        /// <summary>\r\n        /// Sets default values for \"MenuTitle\" and \"UrlTitle\" fields if they were not set.\r\n        /// </summary>\r\n        /// <param name=\"page\">The page.</param>\r\n        private void SetDefaultValues(IPage page)\r\n        {\r\n            IPage newPage = this.GetBinding<IPage>(\"NewPage\");\r\n            IPageType selectedPageType = DataFacade.GetData<IPageType>().Single(f => f.Id == newPage.PageTypeId);\r\n\r\n            if (selectedPageType.PresetMenuTitle && page.MenuTitle.IsNullOrEmpty())\r\n            {\r\n                page.MenuTitle = page.Title;\r\n            }\r\n\r\n            if (page.UrlTitle.IsNullOrEmpty())\r\n            {\r\n                page.UrlTitle = GenerateUrlTitleFromTitle(page.Title);\r\n\r\n                int i = 2;\r\n                while (!UrlTitleIsUniqueAmongSiblings())\r\n                {\r\n                    page.UrlTitle = $\"{GenerateUrlTitleFromTitle(page.Title)}{i}\";\r\n                    i++;\r\n                }\r\n\r\n            }\r\n        }\r\n\r\n        private void ValidateFirstPage(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPage newPage = this.GetBinding<IPage>(\"NewPage\");\r\n\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(typeof(IPage));\r\n\r\n            if (newPage.Title.Length > dataTypeDescriptor.Fields[\"Title\"].StoreType.MaximumLength)\r\n            {\r\n                this.ShowFieldMessage(\"NewPage.Title\", GetText(\"AddNewPageStep1.TitleTooLong\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/AddNewPageWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1144; 946\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddNewPageWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity19\" SourceActivity=\"AddNewPageWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewPageWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"866\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1State\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity8\" SourceActivity=\"step2State\" TargetConnectionIndex=\"0\" SourceStateName=\"step2State\" SourceConnectionEdge=\"Left\" EventHandlerName=\"step2_eventDrivenActivity_Previous\" SourceConnectionIndex=\"1\" TargetStateName=\"step1State\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"451\" Y=\"530\" />\r\n\t\t\t\t<ns0:Point X=\"261\" Y=\"530\" />\r\n\t\t\t\t<ns0:Point X=\"261\" Y=\"391\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity12\" SourceActivity=\"step2State\" TargetConnectionIndex=\"0\" SourceStateName=\"step2State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2_eventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"finalizeActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"656\" Y=\"554\" />\r\n\t\t\t\t<ns0:Point X=\"682\" Y=\"554\" />\r\n\t\t\t\t<ns0:Point X=\"682\" Y=\"744\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2State\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity_redoStep2\" SourceActivity=\"step2State\" TargetConnectionIndex=\"0\" SourceStateName=\"step2State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2_eventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"step2State\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"656\" Y=\"554\" />\r\n\t\t\t\t<ns0:Point X=\"680\" Y=\"554\" />\r\n\t\t\t\t<ns0:Point X=\"680\" Y=\"599\" />\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"599\" />\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"591\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"step2State\" TargetConnectionIndex=\"0\" SourceStateName=\"step2State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2_eventDrivenActivity_Cancel\" SourceConnectionIndex=\"3\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"660\" Y=\"578\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"578\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"866\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity1\" SourceActivity=\"finalizeActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"781\" Y=\"785\" />\r\n\t\t\t\t<ns0:Point X=\"797\" Y=\"785\" />\r\n\t\t\t\t<ns0:Point X=\"797\" Y=\"954\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"954\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"946\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2State\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1State\" TargetConnectionIndex=\"0\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1_eventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step2State\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"356\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"465\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1State\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity13\" SourceActivity=\"step1State\" TargetConnectionIndex=\"0\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1_eventDrivenActivity_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step1State\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"366\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"391\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"391\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1State\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity14\" SourceActivity=\"step1State\" TargetConnectionIndex=\"0\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1_eventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"step1State\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"372\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"391\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"391\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1State\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceActivity=\"step1State\" TargetConnectionIndex=\"0\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1_eventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"step1State\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"372\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"391\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"391\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity_GoToFinalize\" SourceActivity=\"step1State\" TargetConnectionIndex=\"0\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1_eventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"finalizeActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"362\" Y=\"354\" />\r\n\t\t\t\t<ns0:Point X=\"682\" Y=\"354\" />\r\n\t\t\t\t<ns0:Point X=\"682\" Y=\"744\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2State\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity_GoToStep2\" SourceActivity=\"step1State\" TargetConnectionIndex=\"0\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1_eventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"step2State\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"362\" Y=\"354\" />\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"354\" />\r\n\t\t\t\t<ns0:Point X=\"560\" Y=\"465\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1State\" TargetConnectionIndex=\"0\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1_eventDrivenActivity_Cancel\" SourceConnectionIndex=\"3\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"366\" Y=\"378\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"378\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"866\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceActivity=\"initializeActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"866\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity20\" SourceActivity=\"initializeActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"866\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceActivity=\"initializeActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"866\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceActivity=\"initializeActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"866\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1State\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"initializeActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Left\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1State\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"63\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"53\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"53\" Y=\"253\" />\r\n\t\t\t\t<ns0:Point X=\"261\" Y=\"253\" />\r\n\t\t\t\t<ns0:Point X=\"261\" Y=\"265\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finishState\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceActivity=\"initializeActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finishState\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"1064\" Y=\"866\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"226; 126\" AutoSizeMargin=\"16; 24\" Location=\"447; 465\" Name=\"step2State\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step2StateInitializationActivity\" Size=\"150; 182\" Location=\"455; 496\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"PrepareStep2\" Size=\"130; 41\" Location=\"465; 558\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step2WizzardFormActivity\" Size=\"130; 41\" Location=\"465; 618\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2_eventDrivenActivity_Previous\" Size=\"150; 182\" Location=\"455; 520\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"handleExternalEventActivity2\" Size=\"130; 41\" Location=\"465; 582\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 41\" Location=\"465; 642\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2_eventDrivenActivity_Finish\" Size=\"381; 375\" Location=\"455; 544\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"handleExternalEventActivity5\" Size=\"130; 41\" Location=\"580; 606\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity__ValidateUrlTitle\" Size=\"361; 234\" Location=\"465; 666\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 134\" Location=\"484; 737\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity12\" Size=\"130; 53\" Location=\"494; 799\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 134\" Location=\"657; 737\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity_redoStep2\" Size=\"130; 53\" Location=\"667; 799\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2_eventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"455; 568\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"465; 630\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"465; 690\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"984; 866\" Name=\"finishState\" />\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"580; 744\" Name=\"finalizeActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 242\" Location=\"588; 775\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"598; 837\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"stepFinalize_codeActivity\" Size=\"130; 41\" Location=\"598; 897\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"598; 957\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"217; 126\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"153; 265\" Name=\"step1State\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"171; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step1WizzardFormActivity\" Size=\"130; 41\" Location=\"181; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1_eventDrivenActivity_Next\" Size=\"381; 375\" Location=\"171; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"296; 221\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifFirstPageValid\" Size=\"361; 234\" Location=\"181; 281\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity15\" Size=\"150; 134\" Location=\"200; 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"210; 420\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity17\" Size=\"150; 134\" Location=\"373; 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity13\" Size=\"130; 53\" Location=\"383; 414\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1_eventDrivenActivity_Finish\" Size=\"843; 797\" Location=\"179; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"535; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_FirstPageValid\" Size=\"823; 656\" Location=\"189; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity18\" Size=\"612; 556\" Location=\"208; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity_CanSkipStep2\" Size=\"592; 475\" Location=\"218; 403\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"381; 375\" Location=\"237; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity4_ValidateUrlTitle\" Size=\"361; 294\" Location=\"247; 536\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity9\" Size=\"150; 194\" Location=\"266; 607\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"PresetCalculatedFields\" Size=\"130; 41\" Location=\"276; 669\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity_GoToFinalize\" Size=\"130; 53\" Location=\"276; 729\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity10\" Size=\"150; 194\" Location=\"439; 607\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"449; 705\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 375\" Location=\"641; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity_GoToStep2\" Size=\"130; 53\" Location=\"651; 657\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity19\" Size=\"150; 556\" Location=\"843; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity14\" Size=\"130; 53\" Location=\"853; 614\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1_eventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"171; 207\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"181; 269\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"181; 329\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"59; 123\" Name=\"initializeActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"1305; 1099\" Location=\"67; 154\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"1285; 1018\" Location=\"77; 216\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseCheckPageTypesExist\" Size=\"1074; 918\" Location=\"96; 287\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_CheckTemplatesExists\" Size=\"1054; 837\" Location=\"106; 349\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity7\" Size=\"843; 737\" Location=\"125; 420\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_CheckActiveLanguagesExists\" Size=\"823; 656\" Location=\"135; 482\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity5\" Size=\"612; 556\" Location=\"154; 553\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_CheckPageTypesExists\" Size=\"592; 475\" Location=\"164; 615\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity11\" Size=\"381; 375\" Location=\"183; 686\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_RulesDontAllowPageAdd\" Size=\"361; 294\" Location=\"193; 748\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity13\" Size=\"150; 194\" Location=\"212; 819\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"stepInitialize_codeActivity\" Size=\"130; 41\" Location=\"222; 881\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"222; 941\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity14\" Size=\"150; 194\" Location=\"385; 819\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"RuleDontAllowPageAddCodeActivity\" Size=\"130; 41\" Location=\"395; 881\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 53\" Location=\"395; 941\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity12\" Size=\"150; 375\" Location=\"587; 686\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"MissingPageTypeCodeActivity\" Size=\"130; 41\" Location=\"597; 748\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 41\" Location=\"597; 808\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity6\" Size=\"150; 556\" Location=\"789; 553\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"MissingActiveLanguageCodeActivity\" Size=\"130; 41\" Location=\"799; 615\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"799; 675\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity8\" Size=\"150; 737\" Location=\"991; 420\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"MissingTemplateAlertActivity\" Size=\"130; 41\" Location=\"1001; 482\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity20\" Size=\"130; 53\" Location=\"1001; 542\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity16\" Size=\"150; 918\" Location=\"1193; 287\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity11\" Size=\"130; 53\" Location=\"1203; 741\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 194\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity19\" Size=\"130; 53\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/DeletePageWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.Workflow.Activities;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    partial class DeletePageWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition5 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition6 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity15 = new System.Workflow.Activities.SetStateActivity();\r\n            this.caCheckChildren = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_ShowError_InstanceCompositions = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity16 = new System.Workflow.Activities.SetStateActivity();\r\n            this.confirmDialogFormActivity2 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.codeActivity_SetupDeleteMultipleVersionsForm = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.wizzardFormActivity2 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity17 = new System.Workflow.Activities.SetStateActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.branchNoCompositions = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branchHasCompositions = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity_DeleteCurrentVersion = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity_DeleteAllVersions = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branch_HasSingleVersion = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branch_HasMultipleVersions = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branchRelatedDataDoesntExist = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branchRelatedDataExist = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branch_deletionNotConfirmed = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branch_DeletionConfirmed = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branch_NoSubpages = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.branch_HasSubpages = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity18 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity_DeleteCurrentVersion = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElse_HasInstanceCompositions = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity14 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity5 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity_DeleteAllVersions = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.ifElse_HasMultipleVersions = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.setStateActivity13 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.conditionCheckRelatedData = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.ifElse_DeletionAlreadyConfirmed = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity_DeletingChildrenConfirmed = new System.Workflow.Activities.CodeActivity();\r\n            this.finishHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.ifElse_HasSubpages = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.stateInitializationActivity4 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.versions_eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.versions_eventDrivenActivity_Ok = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1InitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity3 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.deleteCurrentVersionStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.checkForCompositionsStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmDeletingAllVersionsStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confDeletingReferencedDataStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmationStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmDeletingChildrenStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity15\r\n            // \r\n            this.setStateActivity15.Name = \"setStateActivity15\";\r\n            this.setStateActivity15.TargetStateName = \"confirmDeletingChildrenStateActivity\";\r\n            // \r\n            // caCheckChildren\r\n            // \r\n            this.caCheckChildren.Description = \"Checking page children\";\r\n            this.caCheckChildren.Name = \"caCheckChildren\";\r\n            this.caCheckChildren.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // initializeCodeActivity_ShowError_InstanceCompositions\r\n            // \r\n            this.initializeCodeActivity_ShowError_InstanceCompositions.Name = \"initializeCodeActivity_ShowError_InstanceCompositions\";\r\n            this.initializeCodeActivity_ShowError_InstanceCompositions.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ShowError_InstanceCompositions_ExecuteCode);\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"deleteCurrentVersionStateActivity\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"checkForCompositionsStateActivity\";\r\n            // \r\n            // setStateActivity16\r\n            // \r\n            this.setStateActivity16.Name = \"setStateActivity16\";\r\n            this.setStateActivity16.TargetStateName = \"checkForCompositionsStateActivity\";\r\n            // \r\n            // confirmDialogFormActivity2\r\n            // \r\n            this.confirmDialogFormActivity2.ContainerLabel = \"Delete page\";\r\n            this.confirmDialogFormActivity2.FormDefinitionFileName = \"\\\\Administrative\\\\DeletePage_ConfirmAllVersionsDeletion.xml\";\r\n            this.confirmDialogFormActivity2.Name = \"confirmDialogFormActivity2\";\r\n            // \r\n            // codeActivity_SetupDeleteMultipleVersionsForm\r\n            // \r\n            this.codeActivity_SetupDeleteMultipleVersionsForm.Name = \"codeActivity_SetupDeleteMultipleVersionsForm\";\r\n            this.codeActivity_SetupDeleteMultipleVersionsForm.ExecuteCode += new System.EventHandler(this.SetupDeleteMultipleVersionsForm);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"confirmationStateActivity\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeletePageStep3.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // wizzardFormActivity2\r\n            // \r\n            this.wizzardFormActivity2.ContainerLabel = null;\r\n            this.wizzardFormActivity2.FormDefinitionFileName = \"\\\\Administrative\\\\DeletePageStep2.xml\";\r\n            this.wizzardFormActivity2.Name = \"wizzardFormActivity2\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity17\r\n            // \r\n            this.setStateActivity17.Name = \"setStateActivity17\";\r\n            this.setStateActivity17.TargetStateName = \"confDeletingReferencedDataStateActivity\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = \"Delete page\";\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeletePageStep1.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // branchNoCompositions\r\n            // \r\n            this.branchNoCompositions.Activities.Add(this.caCheckChildren);\r\n            this.branchNoCompositions.Activities.Add(this.setStateActivity15);\r\n            this.branchNoCompositions.Name = \"branchNoCompositions\";\r\n            // \r\n            // branchHasCompositions\r\n            // \r\n            this.branchHasCompositions.Activities.Add(this.initializeCodeActivity_ShowError_InstanceCompositions);\r\n            this.branchHasCompositions.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasInstanceCompositionsTest);\r\n            this.branchHasCompositions.Condition = codecondition1;\r\n            this.branchHasCompositions.Name = \"branchHasCompositions\";\r\n            // \r\n            // ifElseBranchActivity_DeleteCurrentVersion\r\n            // \r\n            this.ifElseBranchActivity_DeleteCurrentVersion.Activities.Add(this.setStateActivity19);\r\n            this.ifElseBranchActivity_DeleteCurrentVersion.Name = \"ifElseBranchActivity_DeleteCurrentVersion\";\r\n            // \r\n            // ifElseBranchActivity_DeleteAllVersions\r\n            // \r\n            this.ifElseBranchActivity_DeleteAllVersions.Activities.Add(this.setStateActivity10);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ifElse_ShouldAllVersionsBeDeleted);\r\n            this.ifElseBranchActivity_DeleteAllVersions.Condition = codecondition2;\r\n            this.ifElseBranchActivity_DeleteAllVersions.Name = \"ifElseBranchActivity_DeleteAllVersions\";\r\n            // \r\n            // branch_HasSingleVersion\r\n            // \r\n            this.branch_HasSingleVersion.Activities.Add(this.setStateActivity16);\r\n            this.branch_HasSingleVersion.Name = \"branch_HasSingleVersion\";\r\n            // \r\n            // branch_HasMultipleVersions\r\n            // \r\n            this.branch_HasMultipleVersions.Activities.Add(this.codeActivity_SetupDeleteMultipleVersionsForm);\r\n            this.branch_HasMultipleVersions.Activities.Add(this.confirmDialogFormActivity2);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.PageHasMultpleVersions);\r\n            this.branch_HasMultipleVersions.Condition = codecondition3;\r\n            this.branch_HasMultipleVersions.Name = \"branch_HasMultipleVersions\";\r\n            // \r\n            // branchRelatedDataDoesntExist\r\n            // \r\n            this.branchRelatedDataDoesntExist.Activities.Add(this.setStateActivity5);\r\n            this.branchRelatedDataDoesntExist.Name = \"branchRelatedDataDoesntExist\";\r\n            // \r\n            // branchRelatedDataExist\r\n            // \r\n            this.branchRelatedDataExist.Activities.Add(this.confirmDialogFormActivity1);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasDataReferences);\r\n            this.branchRelatedDataExist.Condition = codecondition4;\r\n            this.branchRelatedDataExist.Name = \"branchRelatedDataExist\";\r\n            // \r\n            // branch_deletionNotConfirmed\r\n            // \r\n            this.branch_deletionNotConfirmed.Activities.Add(this.wizzardFormActivity2);\r\n            this.branch_deletionNotConfirmed.Name = \"branch_deletionNotConfirmed\";\r\n            // \r\n            // branch_DeletionConfirmed\r\n            // \r\n            this.branch_DeletionConfirmed.Activities.Add(this.setStateActivity7);\r\n            codecondition5.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasPageDeletionBeenConfirmed);\r\n            this.branch_DeletionConfirmed.Condition = codecondition5;\r\n            this.branch_DeletionConfirmed.Name = \"branch_DeletionConfirmed\";\r\n            // \r\n            // branch_NoSubpages\r\n            // \r\n            this.branch_NoSubpages.Activities.Add(this.setStateActivity17);\r\n            this.branch_NoSubpages.Name = \"branch_NoSubpages\";\r\n            // \r\n            // branch_HasSubpages\r\n            // \r\n            this.branch_HasSubpages.Activities.Add(this.wizzardFormActivity1);\r\n            codecondition6.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasSubpages);\r\n            this.branch_HasSubpages.Condition = codecondition6;\r\n            this.branch_HasSubpages.Name = \"branch_HasSubpages\";\r\n            // \r\n            // setStateActivity18\r\n            // \r\n            this.setStateActivity18.Name = \"setStateActivity18\";\r\n            this.setStateActivity18.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // codeActivity_DeleteCurrentVersion\r\n            // \r\n            this.codeActivity_DeleteCurrentVersion.Name = \"codeActivity_DeleteCurrentVersion\";\r\n            this.codeActivity_DeleteCurrentVersion.ExecuteCode += new System.EventHandler(this.DeleteCurrentVersion);\r\n            // \r\n            // ifElse_HasInstanceCompositions\r\n            // \r\n            this.ifElse_HasInstanceCompositions.Activities.Add(this.branchHasCompositions);\r\n            this.ifElse_HasInstanceCompositions.Activities.Add(this.branchNoCompositions);\r\n            this.ifElse_HasInstanceCompositions.Name = \"ifElse_HasInstanceCompositions\";\r\n            // \r\n            // setStateActivity14\r\n            // \r\n            this.setStateActivity14.Name = \"setStateActivity14\";\r\n            this.setStateActivity14.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity5\r\n            // \r\n            this.cancelHandleExternalEventActivity5.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity5.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity5.Name = \"cancelHandleExternalEventActivity5\";\r\n            // \r\n            // ifElseActivity_DeleteAllVersions\r\n            // \r\n            this.ifElseActivity_DeleteAllVersions.Activities.Add(this.ifElseBranchActivity_DeleteAllVersions);\r\n            this.ifElseActivity_DeleteAllVersions.Activities.Add(this.ifElseBranchActivity_DeleteCurrentVersion);\r\n            this.ifElseActivity_DeleteAllVersions.Name = \"ifElseActivity_DeleteAllVersions\";\r\n            // \r\n            // finishHandleExternalEventActivity4\r\n            // \r\n            this.finishHandleExternalEventActivity4.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity4.Name = \"finishHandleExternalEventActivity4\";\r\n            // \r\n            // ifElse_HasMultipleVersions\r\n            // \r\n            this.ifElse_HasMultipleVersions.Activities.Add(this.branch_HasMultipleVersions);\r\n            this.ifElse_HasMultipleVersions.Activities.Add(this.branch_HasSingleVersion);\r\n            this.ifElse_HasMultipleVersions.Name = \"ifElse_HasMultipleVersions\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity13\r\n            // \r\n            this.setStateActivity13.Name = \"setStateActivity13\";\r\n            this.setStateActivity13.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // conditionCheckRelatedData\r\n            // \r\n            this.conditionCheckRelatedData.Activities.Add(this.branchRelatedDataExist);\r\n            this.conditionCheckRelatedData.Activities.Add(this.branchRelatedDataDoesntExist);\r\n            this.conditionCheckRelatedData.Name = \"conditionCheckRelatedData\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // ifElse_DeletionAlreadyConfirmed\r\n            // \r\n            this.ifElse_DeletionAlreadyConfirmed.Activities.Add(this.branch_DeletionConfirmed);\r\n            this.ifElse_DeletionAlreadyConfirmed.Activities.Add(this.branch_deletionNotConfirmed);\r\n            this.ifElse_DeletionAlreadyConfirmed.Name = \"ifElse_DeletionAlreadyConfirmed\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.codeActivity2_ExecuteCode);\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity4\r\n            // \r\n            this.cancelHandleExternalEventActivity4.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity4.Name = \"cancelHandleExternalEventActivity4\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"confDeletingReferencedDataStateActivity\";\r\n            // \r\n            // codeActivity_DeletingChildrenConfirmed\r\n            // \r\n            this.codeActivity_DeletingChildrenConfirmed.Name = \"codeActivity_DeletingChildrenConfirmed\";\r\n            this.codeActivity_DeletingChildrenConfirmed.ExecuteCode += new System.EventHandler(this.OnDeletingChildrenConfirmed);\r\n            // \r\n            // finishHandleExternalEventActivity3\r\n            // \r\n            this.finishHandleExternalEventActivity3.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity3.Name = \"finishHandleExternalEventActivity3\";\r\n            // \r\n            // ifElse_HasSubpages\r\n            // \r\n            this.ifElse_HasSubpages.Activities.Add(this.branch_HasSubpages);\r\n            this.ifElse_HasSubpages.Activities.Add(this.branch_NoSubpages);\r\n            this.ifElse_HasSubpages.Name = \"ifElse_HasSubpages\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"confirmDeletingAllVersionsStateActivity\";\r\n            // \r\n            // stateInitializationActivity4\r\n            // \r\n            this.stateInitializationActivity4.Activities.Add(this.codeActivity_DeleteCurrentVersion);\r\n            this.stateInitializationActivity4.Activities.Add(this.setStateActivity18);\r\n            this.stateInitializationActivity4.Name = \"stateInitializationActivity4\";\r\n            // \r\n            // initializeInitializationActivity\r\n            // \r\n            this.initializeInitializationActivity.Activities.Add(this.ifElse_HasInstanceCompositions);\r\n            this.initializeInitializationActivity.Name = \"initializeInitializationActivity\";\r\n            // \r\n            // versions_eventDrivenActivity_Cancel\r\n            // \r\n            this.versions_eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity5);\r\n            this.versions_eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity14);\r\n            this.versions_eventDrivenActivity_Cancel.Name = \"versions_eventDrivenActivity_Cancel\";\r\n            // \r\n            // versions_eventDrivenActivity_Ok\r\n            // \r\n            this.versions_eventDrivenActivity_Ok.Activities.Add(this.finishHandleExternalEventActivity4);\r\n            this.versions_eventDrivenActivity_Ok.Activities.Add(this.ifElseActivity_DeleteAllVersions);\r\n            this.versions_eventDrivenActivity_Ok.Name = \"versions_eventDrivenActivity_Ok\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.ifElse_HasMultipleVersions);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // eventDrivenActivity_Finish\r\n            // \r\n            this.eventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Finish.Activities.Add(this.setStateActivity12);\r\n            this.eventDrivenActivity_Finish.Name = \"eventDrivenActivity_Finish\";\r\n            // \r\n            // eventDrivenActivity_Cancel\r\n            // \r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity13);\r\n            this.eventDrivenActivity_Cancel.Name = \"eventDrivenActivity_Cancel\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.conditionCheckRelatedData);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity11);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Finish\r\n            // \r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.step2EventDrivenActivity_Finish.Name = \"step2EventDrivenActivity_Finish\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.ifElse_DeletionAlreadyConfirmed);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeInitializationActivity\r\n            // \r\n            this.finalizeInitializationActivity.Activities.Add(this.codeActivity2);\r\n            this.finalizeInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeInitializationActivity.Name = \"finalizeInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity9);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity3);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.codeActivity_DeletingChildrenConfirmed);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity1);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1InitializationActivity\r\n            // \r\n            this.step1InitializationActivity.Activities.Add(this.ifElse_HasSubpages);\r\n            this.step1InitializationActivity.Name = \"step1InitializationActivity\";\r\n            // \r\n            // stateInitializationActivity3\r\n            // \r\n            this.stateInitializationActivity3.Activities.Add(this.setStateActivity8);\r\n            this.stateInitializationActivity3.Name = \"stateInitializationActivity3\";\r\n            // \r\n            // deleteCurrentVersionStateActivity\r\n            // \r\n            this.deleteCurrentVersionStateActivity.Activities.Add(this.stateInitializationActivity4);\r\n            this.deleteCurrentVersionStateActivity.Name = \"deleteCurrentVersionStateActivity\";\r\n            // \r\n            // checkForCompositionsStateActivity\r\n            // \r\n            this.checkForCompositionsStateActivity.Activities.Add(this.initializeInitializationActivity);\r\n            this.checkForCompositionsStateActivity.Name = \"checkForCompositionsStateActivity\";\r\n            // \r\n            // confirmDeletingAllVersionsStateActivity\r\n            // \r\n            this.confirmDeletingAllVersionsStateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.confirmDeletingAllVersionsStateActivity.Activities.Add(this.versions_eventDrivenActivity_Ok);\r\n            this.confirmDeletingAllVersionsStateActivity.Activities.Add(this.versions_eventDrivenActivity_Cancel);\r\n            this.confirmDeletingAllVersionsStateActivity.Name = \"confirmDeletingAllVersionsStateActivity\";\r\n            // \r\n            // confDeletingReferencedDataStateActivity\r\n            // \r\n            this.confDeletingReferencedDataStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.confDeletingReferencedDataStateActivity.Activities.Add(this.eventDrivenActivity_Cancel);\r\n            this.confDeletingReferencedDataStateActivity.Activities.Add(this.eventDrivenActivity_Finish);\r\n            this.confDeletingReferencedDataStateActivity.Name = \"confDeletingReferencedDataStateActivity\";\r\n            // \r\n            // confirmationStateActivity\r\n            // \r\n            this.confirmationStateActivity.Activities.Add(this.step2StateInitializationActivity);\r\n            this.confirmationStateActivity.Activities.Add(this.step2EventDrivenActivity_Finish);\r\n            this.confirmationStateActivity.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.confirmationStateActivity.Name = \"confirmationStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity4);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // confirmDeletingChildrenStateActivity\r\n            // \r\n            this.confirmDeletingChildrenStateActivity.Activities.Add(this.step1InitializationActivity);\r\n            this.confirmDeletingChildrenStateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.confirmDeletingChildrenStateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.confirmDeletingChildrenStateActivity.Name = \"confirmDeletingChildrenStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.stateInitializationActivity3);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // DeletePageWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.confirmDeletingChildrenStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.confirmationStateActivity);\r\n            this.Activities.Add(this.confDeletingReferencedDataStateActivity);\r\n            this.Activities.Add(this.confirmDeletingAllVersionsStateActivity);\r\n            this.Activities.Add(this.checkForCompositionsStateActivity);\r\n            this.Activities.Add(this.deleteCurrentVersionStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeletePageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        #endregion\r\n        private StateActivity finalStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private StateInitializationActivity finalizeInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private CodeActivity codeActivity2;\r\n        private SetStateActivity setStateActivity4;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity step2EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private StateActivity confirmationStateActivity;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity wizzardFormActivity2;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity11;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n        private StateActivity confDeletingReferencedDataStateActivity;\r\n        private IfElseBranchActivity branchRelatedDataDoesntExist;\r\n        private IfElseBranchActivity branchRelatedDataExist;\r\n        private IfElseActivity conditionCheckRelatedData;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity13;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_Cancel;\r\n        private SetStateActivity setStateActivity12;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_Finish;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private SetStateActivity setStateActivity9;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity4;\r\n        private SetStateActivity setStateActivity1;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity3;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity wizzardFormActivity1;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1InitializationActivity;\r\n        private StateActivity confirmDeletingChildrenStateActivity;\r\n        private SetStateActivity setStateActivity14;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity5;\r\n        private SetStateActivity setStateActivity10;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity4;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity2;\r\n        private EventDrivenActivity versions_eventDrivenActivity_Cancel;\r\n        private EventDrivenActivity versions_eventDrivenActivity_Ok;\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n        private StateActivity confirmDeletingAllVersionsStateActivity;\r\n        private SetStateActivity setStateActivity16;\r\n        private SetStateActivity setStateActivity17;\r\n        private IfElseBranchActivity branch_HasSingleVersion;\r\n        private IfElseBranchActivity branch_HasMultipleVersions;\r\n        private IfElseBranchActivity branch_NoSubpages;\r\n        private IfElseBranchActivity branch_HasSubpages;\r\n        private IfElseActivity ifElse_HasMultipleVersions;\r\n        private IfElseActivity ifElse_HasSubpages;\r\n        private SetStateActivity setStateActivity7;\r\n        private IfElseBranchActivity branch_deletionNotConfirmed;\r\n        private IfElseBranchActivity branch_DeletionConfirmed;\r\n        private IfElseActivity ifElse_DeletionAlreadyConfirmed;\r\n        private SetStateActivity setStateActivity15;\r\n        private CodeActivity caCheckChildren;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity initializeCodeActivity_ShowError_InstanceCompositions;\r\n        private IfElseBranchActivity branchNoCompositions;\r\n        private IfElseBranchActivity branchHasCompositions;\r\n        private CodeActivity codeActivity_DeleteCurrentVersion;\r\n        private IfElseActivity ifElse_HasInstanceCompositions;\r\n        private SetStateActivity setStateActivity8;\r\n        private StateInitializationActivity stateInitializationActivity4;\r\n        private StateInitializationActivity initializeInitializationActivity;\r\n        private StateInitializationActivity stateInitializationActivity3;\r\n        private StateActivity deleteCurrentVersionStateActivity;\r\n        private StateActivity checkForCompositionsStateActivity;\r\n        private SetStateActivity setStateActivity19;\r\n        private IfElseBranchActivity ifElseBranchActivity_DeleteCurrentVersion;\r\n        private IfElseBranchActivity ifElseBranchActivity_DeleteAllVersions;\r\n        private SetStateActivity setStateActivity18;\r\n        private IfElseActivity ifElseActivity_DeleteAllVersions;\r\n        private CodeActivity codeActivity_SetupDeleteMultipleVersionsForm;\r\n        private CodeActivity codeActivity_DeletingChildrenConfirmed;\r\n        private StateActivity initializeStateActivity;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/DeletePageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Collections.Generic;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_PageElementProvider;\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeletePageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeletePageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private static class BindingNames\r\n        {\r\n            public const string DeleteAllVersions = nameof(DeleteAllVersions);\r\n            public const string DeleteChildrenConfirmed = nameof(DeleteChildrenConfirmed);\r\n            public const string HasSubPages = nameof(HasSubPages);\r\n            public const string DeleteMessageText = nameof(DeleteMessageText);\r\n            public const string ReferencedData = nameof(ReferencedData);\r\n        }\r\n\r\n\r\n        private void HasInstanceCompositionsTest(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = false; // Ignore this test, we delete all defined folders ande metadat fields when last page (with respect to locales) are deleted            \r\n        }\r\n\r\n\r\n        private void HasSubpages(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = this.GetBinding<bool>(BindingNames.HasSubPages);\r\n        }\r\n\r\n\r\n\r\n        private void HasDataReferences(object sender, ConditionalEventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            IPage selectedPage = (IPage)dataEntityToken.Data;\r\n\r\n            var dataToDelete = new List<IData>();\r\n\r\n            IEnumerable<IPage> subtree = new[] { selectedPage }.Concat(selectedPage.GetSubChildren());\r\n\r\n            foreach (IPage page in subtree)\r\n            {\r\n                dataToDelete.Add(page);\r\n                dataToDelete.AddRange(page.GetFolderData());\r\n                dataToDelete.AddRange(page.GetMetaData());\r\n            }\r\n\r\n            var brokenReferences = new List<IData>();\r\n            foreach (var data in dataToDelete)\r\n            {\r\n                var references = DataReferenceFacade.GetReferences(data, false, \r\n                    (type, fp) => !fp.IsOptionalReference \r\n                                  && type != typeof(IPagePlaceholderContent)\r\n                                  && fp.SourcePropertyInfo.DeclaringType != typeof(IPageRelatedData));\r\n\r\n                foreach (var reference in references)\r\n                {\r\n                    DataSourceId dataSourceId = reference.DataSourceId;\r\n                    if (dataToDelete.Any(elem => elem.DataSourceId.Equals(dataSourceId))\r\n                        || brokenReferences.Any(brokenRef => brokenRef.DataSourceId.Equals(dataSourceId)))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    brokenReferences.Add(reference);\r\n                }\r\n            }\r\n\r\n            e.Result = brokenReferences.Count > 0;\r\n            if (brokenReferences.Count > 0)\r\n            {\r\n                Bindings.Add(BindingNames.ReferencedData, DataReferenceFacade.GetBrokenReferencesReport(brokenReferences));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            IPage selectedPage = (IPage)dataEntityToken.Data;\r\n\r\n            bool hasChildren = PageServices.GetSubChildren(selectedPage).Any();\r\n\r\n            this.Bindings.AddDictionary(new Dictionary<string, object>\r\n            {\r\n                {BindingNames.HasSubPages, hasChildren},\r\n                {BindingNames.DeleteMessageText, Texts.DeletePageStep2_Text(selectedPage.Title)}\r\n            });\r\n        }\r\n\r\n\r\n        private void codeActivity2_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            bool hasSubPages = this.GetBinding<bool>(BindingNames.HasSubPages);\r\n\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            IPage selectedPage = (IPage)dataEntityToken.Data;\r\n\r\n\r\n            if (!DataFacade.WillDeleteSucceed<IPage>(selectedPage))\r\n            {\r\n                this.ShowMessage(\r\n                    DialogType.Error,\r\n                    Texts.DeletePageWorkflow_CascadeDeleteErrorTitle,\r\n                    Texts.DeletePageWorkflow_CascadeDeleteErrorMessage\r\n                );\r\n\r\n                return;\r\n            }\r\n\r\n            if (hasSubPages)\r\n            {\r\n                List<IPage> pagesToDelete = selectedPage.GetSubChildren().ToList();\r\n\r\n                if (pagesToDelete.Any(page => !DataFacade.WillDeleteSucceed<IPage>(page)))\r\n                {\r\n                    this.ShowMessage(DialogType.Error,\r\n                        Texts.DeletePageWorkflow_CascadeDeleteErrorTitle,\r\n                        Texts.DeletePageWorkflow_CascadeDeleteErrorMessage);\r\n\r\n                    return;\r\n                }\r\n            }\r\n\r\n            var parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMessages(selectedPage.GetDataEntityToken(), 2);\r\n\r\n            PageServices.DeletePage(selectedPage);\r\n        }\r\n\r\n\r\n        private void initializeCodeActivity_ShowError_InstanceCompositions_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(\r\n                DialogType.Error,\r\n                Texts.DeletePageWorkflow_HasCompositionsTitle,\r\n                Texts.DeletePageWorkflow_HasCompositionsMessage\r\n            );\r\n        }\r\n\r\n        private void PageHasMultpleVersions(object sender, ConditionalEventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            IPage selectedPage = (IPage)dataEntityToken.Data;\r\n\r\n            Guid pageId = selectedPage.Id;\r\n\r\n            e.Result = DataFacade.GetData<IPage>().Count(p => p.Id == pageId) > 1;\r\n        }\r\n\r\n        private void HasPageDeletionBeenConfirmed(object sender, ConditionalEventArgs e)\r\n        {\r\n            bool IsTrueBinding(string bindingName) => Bindings.ContainsKey(bindingName) && (bool) Bindings[bindingName];\r\n\r\n            e.Result = IsTrueBinding(BindingNames.DeleteAllVersions)\r\n                    || IsTrueBinding(BindingNames.DeleteChildrenConfirmed);\r\n        }\r\n\r\n        private void DeleteCurrentVersion(object sender, EventArgs e)\r\n        {\r\n            var dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            IPage selectedPage = (IPage)dataEntityToken.Data;\r\n\r\n            PageServices.DeletePage(selectedPage.Id, selectedPage.VersionId, selectedPage.DataSourceId.LocaleScope);\r\n\r\n            Guid pageId = selectedPage.Id;\r\n            var anotherVersion = DataFacade.GetData<IPage>().FirstOrDefault(p => p.Id == pageId);\r\n\r\n            var parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMessages((anotherVersion ?? selectedPage).GetDataEntityToken());\r\n\r\n            if (anotherVersion != null)\r\n            {\r\n                SelectElement(anotherVersion.GetDataEntityToken());\r\n            }\r\n        }\r\n\r\n        private void ifElse_ShouldAllVersionsBeDeleted(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = (bool)Bindings[BindingNames.DeleteAllVersions];\r\n        }\r\n\r\n        private void SetupDeleteMultipleVersionsForm(object sender, EventArgs e)\r\n        {\r\n            Bindings[BindingNames.DeleteAllVersions] = false;\r\n        }\r\n\r\n        private void OnDeletingChildrenConfirmed(object sender, EventArgs e)\r\n        {\r\n            Bindings[BindingNames.DeleteChildrenConfirmed] = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/DeletePageWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1525, 885\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"DeletePageWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"DeletePageWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeletePageWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"314\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmDeletingAllVersionsStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity3\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmDeletingAllVersionsStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"250\" Y=\"178\" />\r\n\t\t\t\t<ns0:Point X=\"274\" Y=\"178\" />\r\n\t\t\t\t<ns0:Point X=\"274\" Y=\"225\" />\r\n\t\t\t\t<ns0:Point X=\"170\" Y=\"225\" />\r\n\t\t\t\t<ns0:Point X=\"170\" Y=\"237\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confDeletingReferencedDataStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity17\" SourceActivity=\"confirmDeletingChildrenStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmDeletingChildrenStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1InitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confDeletingReferencedDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"398\" Y=\"593\" />\r\n\t\t\t\t<ns0:Point X=\"644\" Y=\"593\" />\r\n\t\t\t\t<ns0:Point X=\"644\" Y=\"759\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confDeletingReferencedDataStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"confirmDeletingChildrenStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmDeletingChildrenStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"confDeletingReferencedDataStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"434\" Y=\"619\" />\r\n\t\t\t\t<ns0:Point X=\"644\" Y=\"619\" />\r\n\t\t\t\t<ns0:Point X=\"644\" Y=\"759\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceActivity=\"confirmDeletingChildrenStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmDeletingChildrenStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"439\" Y=\"645\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"645\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"314\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"1475\" Y=\"598\" />\r\n\t\t\t\t<ns0:Point X=\"1533\" Y=\"598\" />\r\n\t\t\t\t<ns0:Point X=\"1533\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"314\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceActivity=\"confirmationStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmationStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2StateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"1184\" Y=\"782\" />\r\n\t\t\t\t<ns0:Point X=\"1213\" Y=\"782\" />\r\n\t\t\t\t<ns0:Point X=\"1213\" Y=\"546\" />\r\n\t\t\t\t<ns0:Point X=\"1405\" Y=\"546\" />\r\n\t\t\t\t<ns0:Point X=\"1405\" Y=\"554\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"confirmationStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmationStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"1192\" Y=\"808\" />\r\n\t\t\t\t<ns0:Point X=\"1213\" Y=\"808\" />\r\n\t\t\t\t<ns0:Point X=\"1213\" Y=\"546\" />\r\n\t\t\t\t<ns0:Point X=\"1405\" Y=\"546\" />\r\n\t\t\t\t<ns0:Point X=\"1405\" Y=\"554\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceActivity=\"confirmationStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmationStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"1197\" Y=\"834\" />\r\n\t\t\t\t<ns0:Point X=\"1213\" Y=\"834\" />\r\n\t\t\t\t<ns0:Point X=\"1213\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"314\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmationStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"confDeletingReferencedDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confDeletingReferencedDataStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity1\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmationStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"700\" Y=\"803\" />\r\n\t\t\t\t<ns0:Point X=\"785\" Y=\"803\" />\r\n\t\t\t\t<ns0:Point X=\"785\" Y=\"730\" />\r\n\t\t\t\t<ns0:Point X=\"1088\" Y=\"730\" />\r\n\t\t\t\t<ns0:Point X=\"1088\" Y=\"738\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity13\" SourceActivity=\"confDeletingReferencedDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confDeletingReferencedDataStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"707\" Y=\"829\" />\r\n\t\t\t\t<ns0:Point X=\"785\" Y=\"829\" />\r\n\t\t\t\t<ns0:Point X=\"785\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"314\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity12\" SourceActivity=\"confDeletingReferencedDataStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confDeletingReferencedDataStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Finish\" SourceConnectionIndex=\"2\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"702\" Y=\"855\" />\r\n\t\t\t\t<ns0:Point X=\"785\" Y=\"855\" />\r\n\t\t\t\t<ns0:Point X=\"785\" Y=\"546\" />\r\n\t\t\t\t<ns0:Point X=\"1405\" Y=\"546\" />\r\n\t\t\t\t<ns0:Point X=\"1405\" Y=\"554\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"checkForCompositionsStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity16\" SourceActivity=\"confirmDeletingAllVersionsStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmDeletingAllVersionsStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity2\" SourceConnectionIndex=\"0\" TargetStateName=\"checkForCompositionsStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"230\" Y=\"281\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"281\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"182\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"182\" Y=\"428\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"checkForCompositionsStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceActivity=\"confirmDeletingAllVersionsStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmDeletingAllVersionsStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"versions_eventDrivenActivity_Ok\" SourceConnectionIndex=\"1\" TargetStateName=\"checkForCompositionsStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"307\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"307\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"182\" Y=\"416\" />\r\n\t\t\t\t<ns0:Point X=\"182\" Y=\"428\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"deleteCurrentVersionStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity19\" SourceActivity=\"confirmDeletingAllVersionsStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmDeletingAllVersionsStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"versions_eventDrivenActivity_Ok\" SourceConnectionIndex=\"1\" TargetStateName=\"deleteCurrentVersionStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"307\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"307\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"640\" Y=\"172\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity14\" SourceActivity=\"confirmDeletingAllVersionsStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmDeletingAllVersionsStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"versions_eventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"287\" Y=\"333\" />\r\n\t\t\t\t<ns0:Point X=\"339\" Y=\"333\" />\r\n\t\t\t\t<ns0:Point X=\"339\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"314\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceActivity=\"checkForCompositionsStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"checkForCompositionsStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"338\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"338\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"306\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"314\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmDeletingChildrenStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity15\" SourceActivity=\"checkForCompositionsStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"checkForCompositionsStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmDeletingChildrenStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"335\" Y=\"549\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity18\" SourceActivity=\"deleteCurrentVersionStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"deleteCurrentVersionStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity4\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"716\" Y=\"216\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"216\" />\r\n\t\t\t\t<ns0:Point X=\"1365\" Y=\"314\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"199, 80\" AutoSizeMargin=\"16, 24\" Location=\"66, 134\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity3\" Size=\"150, 146\" Location=\"74, 167\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130, 62\" Location=\"84, 232\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"1285, 314\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"234, 126\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"218, 549\" Name=\"confirmDeletingChildrenStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1InitializationActivity\" Size=\"381, 333\" Location=\"478, 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_HasSubpages\" Size=\"361, 249\" Location=\"488, 206\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branch_HasSubpages\" Size=\"150, 146\" Location=\"507, 280\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130, 44\" Location=\"517, 354\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branch_NoSubpages\" Size=\"150, 146\" Location=\"680, 280\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity17\" Size=\"130, 62\" Location=\"690, 345\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150, 272\" Location=\"512, 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity3\" Size=\"130, 44\" Location=\"522, 219\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity_DeletingChildrenConfirmed\" Size=\"130, 44\" Location=\"522, 282\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 62\" Location=\"522, 345\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150, 209\" Location=\"478, 193\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity4\" Size=\"130, 44\" Location=\"488, 258\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130, 62\" Location=\"488, 321\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"239, 80\" AutoSizeMargin=\"16, 24\" Location=\"1286, 554\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeInitializationActivity\" Size=\"150, 269\" Location=\"1294, 587\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity2\" Size=\"130, 41\" Location=\"1304, 652\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130, 44\" Location=\"1304, 712\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 62\" Location=\"1304, 775\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 209\" Location=\"38, 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"48, 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 62\" Location=\"48, 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"225, 126\" AutoSizeMargin=\"16, 24\" Location=\"976, 738\" Name=\"confirmationStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step2StateInitializationActivity\" Size=\"381, 333\" Location=\"984, 771\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_DeletionAlreadyConfirmed\" Size=\"361, 249\" Location=\"994, 836\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branch_DeletionConfirmed\" Size=\"150, 146\" Location=\"1013, 910\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130, 62\" Location=\"1023, 975\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branch_deletionNotConfirmed\" Size=\"150, 146\" Location=\"1186, 910\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity2\" Size=\"130, 44\" Location=\"1196, 984\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Finish\" Size=\"150, 209\" Location=\"984, 797\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130, 44\" Location=\"994, 862\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 62\" Location=\"994, 925\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Cancel\" Size=\"150, 209\" Location=\"984, 823\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130, 44\" Location=\"994, 888\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity11\" Size=\"130, 62\" Location=\"994, 951\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"257, 126\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"516, 759\" Name=\"confDeletingReferencedDataStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity1\" Size=\"381, 333\" Location=\"524, 792\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"conditionCheckRelatedData\" Size=\"361, 249\" Location=\"534, 857\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branchRelatedDataExist\" Size=\"150, 146\" Location=\"553, 931\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130, 44\" Location=\"563, 1005\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branchRelatedDataDoesntExist\" Size=\"150, 146\" Location=\"726, 931\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 62\" Location=\"736, 996\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_Cancel\" Size=\"150, 209\" Location=\"524, 818\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130, 44\" Location=\"534, 883\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity13\" Size=\"130, 62\" Location=\"534, 946\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_Finish\" Size=\"150, 209\" Location=\"524, 844\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"534, 909\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity12\" Size=\"130, 62\" Location=\"534, 972\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"248, 126\" AutoSizeMargin=\"16, 24\" Location=\"46, 237\" Name=\"confirmDeletingAllVersionsStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity2\" Size=\"381, 378\" Location=\"54, 270\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_HasMultipleVersions\" Size=\"361, 294\" Location=\"64, 335\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branch_HasMultipleVersions\" Size=\"150, 191\" Location=\"83, 409\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity_SetupDeleteMultipleVersionsForm\" Size=\"130, 44\" Location=\"93, 474\" />\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity2\" Size=\"130, 44\" Location=\"93, 537\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branch_HasSingleVersion\" Size=\"150, 191\" Location=\"256, 409\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity16\" Size=\"130, 62\" Location=\"266, 496\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"versions_eventDrivenActivity_Ok\" Size=\"381, 396\" Location=\"54, 296\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity4\" Size=\"130, 44\" Location=\"179, 361\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity_DeleteAllVersions\" Size=\"361, 249\" Location=\"64, 424\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity_DeleteAllVersions\" Size=\"150, 146\" Location=\"83, 498\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130, 62\" Location=\"93, 563\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity_DeleteCurrentVersion\" Size=\"150, 146\" Location=\"256, 498\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity19\" Size=\"130, 62\" Location=\"266, 563\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"versions_eventDrivenActivity_Cancel\" Size=\"150, 209\" Location=\"54, 322\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity5\" Size=\"130, 44\" Location=\"64, 387\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity14\" Size=\"130, 62\" Location=\"64, 450\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"224, 80\" AutoSizeMargin=\"16, 24\" Location=\"70, 428\" Name=\"checkForCompositionsStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeInitializationActivity\" Size=\"381, 396\" Location=\"78, 461\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElse_HasInstanceCompositions\" Size=\"361, 312\" Location=\"88, 526\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branchHasCompositions\" Size=\"150, 209\" Location=\"107, 600\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_ShowError_InstanceCompositions\" Size=\"130, 44\" Location=\"117, 665\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130, 62\" Location=\"117, 728\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"branchNoCompositions\" Size=\"150, 209\" Location=\"280, 600\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"caCheckChildren\" Size=\"130, 41\" Location=\"290, 665\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity15\" Size=\"130, 62\" Location=\"290, 725\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"216, 80\" AutoSizeMargin=\"16, 24\" Location=\"532, 172\" Name=\"deleteCurrentVersionStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity4\" Size=\"150, 209\" Location=\"540, 205\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity_DeleteCurrentVersion\" Size=\"130, 44\" Location=\"550, 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity18\" Size=\"130, 62\" Location=\"550, 333\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/DeletePageWorkflow.rules",
    "content": "﻿"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/EditPageWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    partial class EditPageWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.showConsoleMessageBoxActivity1 = new Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setToPublishCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.newPageTypeSelectedCodeActivity_UpdateView = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveAndPublishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.customEvent01HandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editPreviewCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.previewHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity();\r\n            this.ifElseActivity2_PageStillExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.editStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.newPageTypeSelectedStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_SaveAndPublish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editEventDrivenActivity_PageTypeChanged = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editEventDrivenActivity_Preview = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.newPageTypeSelectedStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // showConsoleMessageBoxActivity1\r\n            // \r\n            this.showConsoleMessageBoxActivity1.DialogType = Composite.C1Console.Events.DialogType.Message;\r\n            this.showConsoleMessageBoxActivity1.Message = \"${Composite.Plugins.PageElementProvider, PageSaveValidationFailedMessage}\";\r\n            this.showConsoleMessageBoxActivity1.Name = \"showConsoleMessageBoxActivity1\";\r\n            this.showConsoleMessageBoxActivity1.Title = \"${Composite.Plugins.PageElementProvider, PageSaveValidationFailedTitle}\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // setToPublishCodeActivity\r\n            // \r\n            this.setToPublishCodeActivity.Name = \"setToPublishCodeActivity\";\r\n            this.setToPublishCodeActivity.ExecuteCode += new System.EventHandler(this.setToPublishCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.showConsoleMessageBoxActivity1);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.saveCodeActivity);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateSave);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity10);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setToPublishCodeActivity);\r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity9);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.PageStillExists);\r\n            this.ifElseBranchActivity5.Condition = codecondition2;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity8);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity2);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.PageStillExists);\r\n            this.ifElseBranchActivity3.Condition = codecondition3;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // newPageTypeSelectedCodeActivity_UpdateView\r\n            // \r\n            this.newPageTypeSelectedCodeActivity_UpdateView.Name = \"newPageTypeSelectedCodeActivity_UpdateView\";\r\n            this.newPageTypeSelectedCodeActivity_UpdateView.ExecuteCode += new System.EventHandler(this.newPageTypeSelectedCodeActivity_UpdateView_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // saveAndPublishHandleExternalEventActivity1\r\n            // \r\n            this.saveAndPublishHandleExternalEventActivity1.EventName = \"SaveAndPublish\";\r\n            this.saveAndPublishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveAndPublishHandleExternalEventActivity1.Name = \"saveAndPublishHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"newPageTypeSelectedStateActivity\";\r\n            // \r\n            // customEvent01HandleExternalEventActivity1\r\n            // \r\n            this.customEvent01HandleExternalEventActivity1.EventName = \"CustomEvent01\";\r\n            this.customEvent01HandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.customEvent01HandleExternalEventActivity1.Name = \"customEvent01HandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // editPreviewCodeActivity\r\n            // \r\n            this.editPreviewCodeActivity.Name = \"editPreviewCodeActivity\";\r\n            this.editPreviewCodeActivity.ExecuteCode += new System.EventHandler(this.editPreviewCodeActivity_ExecuteCode);\r\n            // \r\n            // previewHandleExternalEventActivity1\r\n            // \r\n            this.previewHandleExternalEventActivity1.EventName = \"Preview\";\r\n            this.previewHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previewHandleExternalEventActivity1.Name = \"previewHandleExternalEventActivity1\";\r\n            // \r\n            // ifElseActivity2_PageStillExists\r\n            // \r\n            this.ifElseActivity2_PageStillExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2_PageStillExists.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2_PageStillExists.Name = \"ifElseActivity2_PageStillExists\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // editStateCodeActivity\r\n            // \r\n            this.editStateCodeActivity.Name = \"editStateCodeActivity\";\r\n            this.editStateCodeActivity.ExecuteCode += new System.EventHandler(this.editStateCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // newPageTypeSelectedStateInitializationActivity\r\n            // \r\n            this.newPageTypeSelectedStateInitializationActivity.Activities.Add(this.newPageTypeSelectedCodeActivity_UpdateView);\r\n            this.newPageTypeSelectedStateInitializationActivity.Activities.Add(this.setStateActivity7);\r\n            this.newPageTypeSelectedStateInitializationActivity.Name = \"newPageTypeSelectedStateInitializationActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_SaveAndPublish\r\n            // \r\n            this.editEventDrivenActivity_SaveAndPublish.Activities.Add(this.saveAndPublishHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_SaveAndPublish.Activities.Add(this.ifElseActivity2);\r\n            this.editEventDrivenActivity_SaveAndPublish.Name = \"editEventDrivenActivity_SaveAndPublish\";\r\n            // \r\n            // editEventDrivenActivity_PageTypeChanged\r\n            // \r\n            this.editEventDrivenActivity_PageTypeChanged.Activities.Add(this.customEvent01HandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_PageTypeChanged.Activities.Add(this.setStateActivity6);\r\n            this.editEventDrivenActivity_PageTypeChanged.Name = \"editEventDrivenActivity_PageTypeChanged\";\r\n            // \r\n            // editEventDrivenActivity_Preview\r\n            // \r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.previewHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.editPreviewCodeActivity);\r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.setStateActivity4);\r\n            this.editEventDrivenActivity_Preview.Name = \"editEventDrivenActivity_Preview\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.ifElseActivity2_PageStillExists);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.editStateCodeActivity);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // newPageTypeSelectedStateActivity\r\n            // \r\n            this.newPageTypeSelectedStateActivity.Activities.Add(this.newPageTypeSelectedStateInitializationActivity);\r\n            this.newPageTypeSelectedStateActivity.Name = \"newPageTypeSelectedStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity5);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Preview);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_PageTypeChanged);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_SaveAndPublish);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // EditPageWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.newPageTypeSelectedStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditPageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private CodeActivity saveCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_Preview;\r\n\r\n        private C1Console.Workflow.Activities.PreviewHandleExternalEventActivity previewHandleExternalEventActivity1;\r\n\r\n        private CodeActivity editPreviewCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private CodeActivity editStateCodeActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity showConsoleMessageBoxActivity1;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private CodeActivity newPageTypeSelectedCodeActivity_UpdateView;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.CustomEvent01HandleExternalEventActivity customEvent01HandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity newPageTypeSelectedStateInitializationActivity;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_PageTypeChanged;\r\n\r\n        private StateActivity newPageTypeSelectedStateActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity2_PageStillExists;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_SaveAndPublish;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private CodeActivity setToPublishCodeActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private C1Console.Workflow.Activities.SaveAndPublishHandleExternalEventActivity saveAndPublishHandleExternalEventActivity1;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/EditPageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\n\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Core;\r\nusing Composite.Core.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Routing.Foundation.PluginFacades;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditPageWorkflow : FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        private bool _doPublish;\r\n\r\n        public EditPageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n            InitializeExtensions();\r\n        }\r\n\r\n        private static DataTypeDescriptorFormsHelper CreateDataTypeDescriptorFormsHelper(IPageMetaDataDefinition pageMetaDataDefinition, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            var bindingPrefix = $\"{pageMetaDataDefinition.Name}:{dataTypeDescriptor.Namespace}.{dataTypeDescriptor.Name}\";\r\n\r\n            var helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor, bindingPrefix);\r\n\r\n            var generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n            helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n            helper.FieldGroupLabel = StringResourceSystemFacade.ParseString(pageMetaDataDefinition.Label);\r\n\r\n            return helper;\r\n        }\r\n\r\n\r\n\r\n        private List<KeyValuePair<Guid, string>> GetSelectablePageTypes()\r\n        {\r\n            var selectedPage = GetBinding<IPage>(\"SelectedPage\");\r\n\r\n            var parentPageId = selectedPage.GetParentId();\r\n            IPage parentPage = null;\r\n            if (parentPageId != Guid.Empty)\r\n            {\r\n                parentPage = PageManager.GetPageById(parentPageId);\r\n                if (parentPage == null && GlobalSettingsFacade.AllowChildPagesTranslationWithoutParent)\r\n                {\r\n                    using (new DataScope(DataLocalizationFacade.DefaultLocalizationCulture))\r\n                    {\r\n                        parentPage = PageManager.GetPageById(parentPageId);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return\r\n                parentPage.GetChildPageSelectablePageTypes(selectedPage).\r\n                Select(f => new KeyValuePair<Guid, string>(f.Id, f.Name)).\r\n                ToList();\r\n        }\r\n\r\n\r\n\r\n        private List<KeyValuePair<Guid, string>> GetSelectablePageTemplates()\r\n        {\r\n            var selectedPage = GetBinding<IPage>(\"SelectedPage\");\r\n\r\n            var allPageTemplates = PageTemplateFacade.GetPageTemplates().ToList();\r\n\r\n            var templateRestrictions =\r\n                DataFacade.GetData<IPageTypePageTemplateRestriction>()\r\n                .Where(f => f.PageTypeId == selectedPage.PageTypeId)\r\n                .Select(restriction => restriction.PageTemplateId)\r\n                .ToList();\r\n\r\n            IEnumerable<PageTemplateDescriptor> result;\r\n\r\n            if (templateRestrictions.Any())\r\n            {\r\n                var allowedTemplatesHash = new HashSet<Guid>(templateRestrictions);\r\n\r\n                var allowedTemplates =\r\n                    allPageTemplates\r\n                    .Where(template => allowedTemplatesHash.Contains(template.Id))\r\n                    .ToList();\r\n\r\n                var selectedTemplateId = selectedPage.TemplateId;\r\n                var selectedTemplate = allPageTemplates.FirstOrDefault(t => t.Id == selectedTemplateId);\r\n                if (selectedTemplate != null\r\n                    & !allowedTemplates.Any(t => t.Id == selectedTemplateId))\r\n                {\r\n                    allowedTemplates.Add(selectedTemplate);\r\n                }\r\n\r\n                result = allowedTemplates;\r\n            }\r\n            else\r\n            {\r\n                result = allPageTemplates;\r\n            }\r\n\r\n            return result\r\n                   .OrderBy(template => template.Title)\r\n                   .Select(f => new KeyValuePair<Guid, string>(f.Id, f.Title)).ToList();\r\n        }\r\n\r\n\r\n\r\n        private void editStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            if (!PermissionsFacade.GetPermissionsForCurrentUser(EntityToken).Contains(PermissionType.Publish))\r\n            {\r\n                var formData = WorkflowFacade.GetFormData(InstanceId, true);\r\n\r\n                if (formData.ExcludedEvents == null)\r\n                    formData.ExcludedEvents = new List<string>();\r\n\r\n                formData.ExcludedEvents.Add(\"SaveAndPublish\");\r\n            }\r\n\r\n\r\n            IPage selectedPage;\r\n            if (!BindingExist(\"SelectedPage\"))\r\n            {\r\n                selectedPage = GetDataItemFromEntityToken<IPage>();\r\n\r\n                if (selectedPage.PublicationStatus == GenericPublishProcessController.Published)\r\n                {\r\n                    selectedPage.PublicationStatus = GenericPublishProcessController.Draft;\r\n                }\r\n                Bindings.Add(\"SelectedPage\", selectedPage);\r\n            }\r\n            else\r\n            {\r\n                selectedPage = GetBinding<IPage>(\"SelectedPage\");\r\n            }\r\n\r\n            if (!BindingExist(\"UrlTitleIsRequired\"))\r\n            {\r\n                var isRootPage = PageManager.GetParentId(selectedPage.Id) == Guid.Empty;\r\n\r\n                Bindings[\"UrlTitleIsRequired\"] = !isRootPage;\r\n                Bindings[\"IsRootPage\"] = isRootPage;\r\n            }\r\n\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(@\"\\Administrative\\EditPage.xml\");\r\n\r\n            XDocument formDocument;\r\n            using (var reader = markupProvider.GetReader())\r\n            {\r\n                formDocument = XDocument.Load(reader);\r\n            }\r\n\r\n            var bindingsXElement = formDocument.Root.Element(DataTypeDescriptorFormsHelper.CmsNamespace + FormKeyTagNames.Bindings);\r\n            var layoutXElement = formDocument.Root.Element(DataTypeDescriptorFormsHelper.CmsNamespace + FormKeyTagNames.Layout);\r\n            var tabPanelsXElement = layoutXElement.Element(DataTypeDescriptorFormsHelper.MainNamespace + \"TabPanels\");\r\n\r\n\r\n            IEnumerable<ICompositionContainer> compositionContainers = selectedPage.GetAllowedMetaDataContainers().Evaluate();\r\n\r\n            var compositionTabs = new Dictionary<Guid, XElement>();\r\n\r\n            foreach (var compositionContainer in compositionContainers)\r\n            {\r\n                var element = new XElement(Namespaces.BindingFormsStdUiControls10 + \"PlaceHolder\");\r\n                element.Add(new XAttribute(\"Label\", StringResourceSystemFacade.ParseString(compositionContainer.Label)));\r\n\r\n                compositionTabs.Add(compositionContainer.Id, element);\r\n            }\r\n\r\n            var clientValidationRules = new Dictionary<string, List<ClientValidationRule>>();\r\n\r\n            var pageMetaDataDefinitions = selectedPage.GetAllowedMetaDataDefinitions();\r\n\r\n            foreach (var pageMetaDataDefinition in pageMetaDataDefinitions)\r\n            {\r\n                var metaDatTypeId = pageMetaDataDefinition.MetaDataTypeId;\r\n\r\n                var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(metaDatTypeId);\r\n                Verify.IsNotNull(dataTypeDescriptor, \"Failed to get meta data type by id '{0}'. If data type was purposely removed, in order to fix this exception you should remove IPageMetaDataDefinition records that reference this data type.\", metaDatTypeId);\r\n\r\n                var metaDataType = TypeManager.TryGetType(dataTypeDescriptor.TypeManagerTypeName);\r\n                Verify.IsNotNull(metaDataType, \"Failed to get meta data type '{0}', id: {1}. If it has been removed, references from '{2}' have to be removed as well\",\r\n                                                dataTypeDescriptor.TypeManagerTypeName, metaDatTypeId, typeof(IPageMetaDataDefinition).Name);\r\n\r\n                var helper = CreateDataTypeDescriptorFormsHelper(pageMetaDataDefinition, dataTypeDescriptor);\r\n\r\n                var metaData = selectedPage.GetMetaData(pageMetaDataDefinition.Name, metaDataType);\r\n                if (metaData == null)\r\n                {\r\n                    metaData = DataFacade.BuildNew(metaDataType);\r\n\r\n                    PageMetaDataFacade.AssignMetaDataSpecificValues(metaData, pageMetaDataDefinition.Name, selectedPage);\r\n\r\n                    var localizedData = metaData as ILocalizedControlled;\r\n                    if (localizedData != null)\r\n                    {\r\n                        localizedData.SourceCultureName = UserSettings.ActiveLocaleCultureInfo.Name;\r\n                    }\r\n\r\n                    var publishControlled = metaData as IPublishControlled;\r\n                    publishControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n\r\n                    helper.UpdateWithNewBindings(Bindings);\r\n                    helper.ObjectToBindings(metaData, Bindings);\r\n                }\r\n                else\r\n                {\r\n                    helper.UpdateWithBindings(metaData, Bindings);\r\n                }\r\n\r\n\r\n                bindingsXElement.Add(helper.BindingXml.Elements());\r\n                compositionTabs[pageMetaDataDefinition.MetaDataContainerId].Add(helper.PanelXml);\r\n\r\n                clientValidationRules.AddDictionary(helper.GetBindingsValidationRules(metaData));\r\n            }\r\n\r\n\r\n            var previewTabPanel = tabPanelsXElement.Elements().Last();\r\n\r\n            foreach (var element in compositionTabs.Values)\r\n            {\r\n                previewTabPanel.AddBeforeSelf(element);\r\n            }\r\n\r\n\r\n\r\n            IDictionary<string, string> transitionNames = new Dictionary<string, string>();\r\n            transitionNames.Add(GenericPublishProcessController.Draft, StringResourceSystemFacade.GetString(\"Composite.Management\", \"PublishingStatus.draft\"));\r\n            transitionNames.Add(GenericPublishProcessController.AwaitingApproval, StringResourceSystemFacade.GetString(\"Composite.Management\", \"PublishingStatus.awaitingApproval\"));\r\n\r\n            var username = UserValidationFacade.GetUsername();\r\n            var userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(username);\r\n            var userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(username);\r\n            var currentPermissionTypes = PermissionTypeFacade.GetCurrentPermissionTypes(UserValidationFacade.GetUserToken(), EntityToken, userPermissionDefinitions, userGroupPermissionDefinitions);\r\n            foreach (var permissionType in currentPermissionTypes)\r\n            {\r\n                if (GenericPublishProcessController.AwaitingPublicationActionPermissionType.Contains(permissionType))\r\n                {\r\n                    transitionNames.Add(GenericPublishProcessController.AwaitingPublication, StringResourceSystemFacade.GetString(\"Composite.Management\", \"PublishingStatus.awaitingPublication\"));\r\n                    break;\r\n                }\r\n            }\r\n\r\n\r\n            var contents = DataFacade.GetData<IPagePlaceholderContent>(false)\r\n                .Where(f => f.PageId == selectedPage.Id && f.VersionId == selectedPage.VersionId)\r\n                .ToList();\r\n            var namedXhtmlFragments = contents.ToDictionary(content => content.PlaceHolderId, content => content.Content ?? \"\");\r\n\r\n\r\n            UpdateBinding(\"SelectablePageTypeIds\", GetSelectablePageTypes());\r\n            UpdateBinding(\"SelectableTemplateIds\", GetSelectablePageTemplates());\r\n            UpdateBinding(\"NamedXhtmlFragments\", namedXhtmlFragments);\r\n            UpdateBinding(\"StateOptions\", transitionNames);\r\n\r\n\r\n            var formDefinition = formDocument.GetDocumentAsString();\r\n\r\n            DeliverFormData(\r\n                    selectedPage.Title,\r\n                    StandardUiContainerTypes.Document,\r\n                    formDefinition,\r\n                    Bindings,\r\n                    clientValidationRules\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void newPageTypeSelectedCodeActivity_UpdateView_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            RerenderView();\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var updateTreeRefresher = CreateUpdateTreeRefresher(EntityToken);\r\n\r\n            var selectedPage = GetBinding<IPage>(\"SelectedPage\");\r\n            var originalPage = DataFacade.GetData<IPage>(f => f.Id == selectedPage.Id && f.VersionId == selectedPage.VersionId).SingleOrDefault();\r\n\r\n            var viewLabelUpdated = originalPage == null\r\n                || selectedPage.MenuTitle != originalPage.MenuTitle\r\n                || selectedPage.Title != originalPage.Title;\r\n\r\n            var dataToAdd = new Dictionary<string, IData>();\r\n            var dataToUpdate = new Dictionary<string, IData>();\r\n\r\n            var dataValidated = true;\r\n\r\n            try\r\n            {\r\n                using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n                {\r\n                    dataValidated = PrepareAddUpdateMetaData(selectedPage, dataToAdd, dataToUpdate);\r\n\r\n                    if (dataValidated)\r\n                    {\r\n                        if (selectedPage.PageTypeId != originalPage.PageTypeId)\r\n                        {\r\n                            // Adding metadata fields\r\n                            var oldPageMetaDataDefinitions = originalPage.GetAllowedMetaDataDefinitions().Except(selectedPage.GetAllowedMetaDataDefinitions(), new PageMetaDataDefinitionEqualityComparer());\r\n\r\n                            foreach (var pageMetaDataDefinition in oldPageMetaDataDefinitions)\r\n                            {\r\n                                var oldMetaData = selectedPage.GetMetaData(pageMetaDataDefinition.Name, pageMetaDataDefinition.MetaDataTypeId);\r\n                                if (oldMetaData != null)\r\n                                {\r\n                                    ProcessControllerFacade.FullDelete(oldMetaData);\r\n                                }\r\n                            }\r\n\r\n                            PageServices.AddPageTypePageFoldersAndApplications(selectedPage);\r\n                        }\r\n\r\n\r\n                        foreach (var data in dataToAdd.Values)\r\n                        {\r\n                            DataFacade.AddNew(data);\r\n                        }\r\n\r\n                        foreach (var data in dataToUpdate.Values)\r\n                        {\r\n                            var publishControlled = data as IPublishControlled;\r\n                            publishControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n\r\n                            DataFacade.Update(data);\r\n                        }\r\n\r\n                        var contentDictionary = GetBinding<Dictionary<string, string>>(\"NamedXhtmlFragments\");\r\n                        var existingContents = DataFacade.GetData<IPagePlaceholderContent>(false)\r\n                            .Where(f => f.PageId == selectedPage.Id && f.VersionId == selectedPage.VersionId).ToList();\r\n\r\n                        foreach (var existingContent in existingContents)\r\n                        {\r\n                            if (contentDictionary.ContainsKey(existingContent.PlaceHolderId))\r\n                            {\r\n                                existingContent.Content = contentDictionary[existingContent.PlaceHolderId];\r\n                                existingContent.PublicationStatus = GenericPublishProcessController.Draft;\r\n                                DataFacade.Update(existingContent);\r\n                            }\r\n                            else\r\n                            {\r\n                                DataFacade.Delete(existingContent);\r\n                            }\r\n                        }\r\n\r\n                        foreach (var contentDictionaryElement in contentDictionary\r\n                            .Where(f => !existingContents.Any(existing => existing.PlaceHolderId == f.Key)))\r\n                        {\r\n                            var newContent = DataFacade.BuildNew<IPagePlaceholderContent>();\r\n                            newContent.PageId = selectedPage.Id;\r\n                            newContent.VersionId = selectedPage.VersionId;\r\n                            newContent.PlaceHolderId = contentDictionaryElement.Key;\r\n                            newContent.Content = contentDictionaryElement.Value;\r\n                            newContent.SourceCultureName = UserSettings.ActiveLocaleCultureInfo.Name;\r\n                            newContent.PublicationStatus = GenericPublishProcessController.Draft;\r\n\r\n                            DataFacade.AddNew(newContent);\r\n                        }\r\n\r\n                        // NOTE: updating originalPage object, in order to make XML & SQL provider work in the same way\r\n                        originalPage.TemplateId = selectedPage.TemplateId;\r\n                        originalPage.PageTypeId = selectedPage.PageTypeId;\r\n                        originalPage.Title = selectedPage.Title;\r\n                        originalPage.MenuTitle = selectedPage.MenuTitle;\r\n                        originalPage.UrlTitle = selectedPage.UrlTitle;\r\n                        originalPage.FriendlyUrl = selectedPage.FriendlyUrl;\r\n                        originalPage.Description = selectedPage.Description;\r\n                        originalPage.PublicationStatus = selectedPage.PublicationStatus;\r\n                        originalPage.SourceCultureName = selectedPage.SourceCultureName;\r\n                        DataFacade.Update(originalPage);\r\n                    }\r\n\r\n                    transactionScope.Complete();\r\n                }\r\n\r\n                if (_doPublish)\r\n                {\r\n                    var actionToken = new GenericPublishProcessController.PublishActionToken();\r\n\r\n                    var serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n\r\n                    ActionExecutorFacade.Execute(EntityToken, actionToken, serviceContainer);\r\n                }\r\n                else\r\n                {\r\n                    updateTreeRefresher.PostRefreshMessages(selectedPage.GetDataEntityToken());\r\n                }\r\n\r\n                UpdateBinding(\"OldPublicationStatus\", selectedPage.PublicationStatus);\r\n\r\n                if (viewLabelUpdated)\r\n                {\r\n                    RerenderView();\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                var mostSpecificException = ex;\r\n                while (mostSpecificException.InnerException != null) mostSpecificException = mostSpecificException.InnerException;\r\n                ShowMessage(DialogType.Error, \"Save failed\", $\"Save failed: {mostSpecificException.Message}\");\r\n                Log.LogError(\"Page save\", ex);\r\n            }\r\n            finally\r\n            {\r\n                SetSaveStatus(dataValidated);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private bool PrepareAddUpdateMetaData(IPage selectedPage, IDictionary<string, IData> dataToAdd, IDictionary<string, IData> dataToUpdate)\r\n        {\r\n            var isValid = ValidateBindings();\r\n\r\n            IEnumerable<IPageMetaDataDefinition> pageMetaDataDefinitions = selectedPage.GetAllowedMetaDataDefinitions().Evaluate();\r\n\r\n            foreach (var pageMetaDataDefinition in pageMetaDataDefinitions)\r\n            {\r\n                var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(pageMetaDataDefinition.MetaDataTypeId);\r\n                var metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n                var helper = CreateDataTypeDescriptorFormsHelper(pageMetaDataDefinition, dataTypeDescriptor);\r\n\r\n                var metaData = selectedPage.GetMetaData(pageMetaDataDefinition.Name, metaDataType);\r\n                if (metaData == null)\r\n                {\r\n                    var newData = DataFacade.BuildNew(metaDataType);\r\n\r\n                    PageMetaDataFacade.AssignMetaDataSpecificValues(newData, pageMetaDataDefinition.Name, selectedPage);\r\n\r\n                    var localizedData = newData as ILocalizedControlled;\r\n                    if (localizedData != null)\r\n                    {\r\n                        localizedData.SourceCultureName = UserSettings.ActiveLocaleCultureInfo.Name;\r\n                    }\r\n\r\n                    if (!BindAndValidate(helper, newData))\r\n                    {\r\n                        isValid = false;\r\n                    }\r\n\r\n                    dataToAdd.Add(helper.BindingNamesPrefix, newData);\r\n                }\r\n                else\r\n                {\r\n                    if (!BindAndValidate(helper, metaData))\r\n                    {\r\n                        isValid = false;\r\n                    }\r\n\r\n                    dataToUpdate.Add(helper.BindingNamesPrefix, metaData);\r\n                }\r\n            }\r\n\r\n\r\n            var pageValidationResults = ValidationFacade.Validate(selectedPage);\r\n\r\n            if (!pageValidationResults.IsValid)\r\n            {\r\n                isValid = false;\r\n            }\r\n\r\n\r\n            foreach (var kvp in dataToAdd.Concat(dataToUpdate))\r\n            {\r\n                var validationResults = ValidationFacade.Validate(kvp.Value);\r\n\r\n                if (!validationResults.IsValid)\r\n                {\r\n                    isValid = false;\r\n\r\n                    foreach (var result in validationResults)\r\n                    {\r\n                        ShowFieldMessage(DataTypeDescriptorFormsHelper.GetBindingName(kvp.Key, result.Key), result.Message);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return isValid;\r\n        }\r\n\r\n\r\n        private void editPreviewCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            var webRenderService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n\r\n            try\r\n            {\r\n                var selectedPage = GetBinding<IPage>(\"SelectedPage\");\r\n\r\n                var contents = new List<IPagePlaceholderContent>();\r\n                var namedXhtmlFragments = GetBinding<Dictionary<string, string>>(\"NamedXhtmlFragments\");\r\n                foreach (var placeHolderContent in namedXhtmlFragments)\r\n                {\r\n                    var content = DataFacade.BuildNew<IPagePlaceholderContent>();\r\n                    content.PageId = selectedPage.Id;\r\n                    content.VersionId = selectedPage.VersionId;\r\n                    content.PlaceHolderId = placeHolderContent.Key;\r\n                    content.Content = placeHolderContent.Value;\r\n                    contents.Add(content);\r\n                }\r\n\r\n                var output = PagePreviewBuilder.RenderPreview(selectedPage, contents);\r\n                webRenderService.SetNewPageOutput(new LiteralControl(output));\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                // TODO: add html encoding for the exception text\r\n                Control errOutput = new LiteralControl(\"<pre>\" + ex + \"</pre>\");\r\n                webRenderService.SetNewPageOutput(errOutput);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private static void TrimFieldValues(IPage page)\r\n        {\r\n            page.Title = page.Title.Trim();\r\n            page.MenuTitle = page.MenuTitle.Trim();\r\n            page.UrlTitle = page.UrlTitle.Trim();\r\n            page.FriendlyUrl = page.FriendlyUrl?.Trim();\r\n        }\r\n\r\n\r\n        private bool FieldHasValidLength(string fieldValue, string fieldName, int maximumLength)\r\n        {\r\n            if (fieldValue.Length <= maximumLength)\r\n            {\r\n                return true;\r\n            }\r\n\r\n            var bindingName = \"SelectedPage.\" + fieldName;\r\n\r\n            ShowFieldMessage(bindingName, GetText(\"EditPage.MaxLength\").FormatWith(maximumLength));\r\n            return false;\r\n        }\r\n\r\n        private void ValidateSave(object sender, ConditionalEventArgs e)\r\n        {\r\n            var selectedPage = GetBinding<IPage>(\"SelectedPage\");\r\n\r\n            selectedPage.MenuTitle = selectedPage.MenuTitle ?? string.Empty;\r\n            selectedPage.FriendlyUrl = selectedPage.FriendlyUrl ?? string.Empty;\r\n\r\n            TrimFieldValues(selectedPage);\r\n\r\n            if (!FieldHasValidLength(selectedPage.Title, nameof(IPage.Title), 255)\r\n                || !FieldHasValidLength(selectedPage.MenuTitle, nameof(IPage.MenuTitle), 192)\r\n                || !FieldHasValidLength(selectedPage.UrlTitle, nameof(IPage.UrlTitle), 192)\r\n                || !FieldHasValidLength(selectedPage.FriendlyUrl, nameof(IPage.FriendlyUrl), 64))\r\n            {\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n\r\n            var processedUrlTitle = UrlFormattersPluginFacade.FormatUrl(selectedPage.UrlTitle, true);\r\n            if (selectedPage.UrlTitle != processedUrlTitle)\r\n            {\r\n                RerenderView();\r\n                selectedPage.UrlTitle = processedUrlTitle;\r\n                ShowMessage(DialogType.Message,\r\n                    GetText(\"EditPage.UrlTitleFormattedTitle\"),\r\n                    (GetText(\"EditPage.UrlTitleFormattedMessage\") ?? string.Empty).FormatWith(processedUrlTitle));\r\n            }\r\n\r\n            var siblingPageUrlTitles =\r\n                (from page in PageServices.GetChildren(selectedPage.GetParentId())\r\n                 where page.Id != selectedPage.Id\r\n                 select page.UrlTitle).ToList();\r\n\r\n            foreach (var siblingUrlTitle in siblingPageUrlTitles)\r\n            {\r\n                if (siblingUrlTitle.Equals(selectedPage.UrlTitle, StringComparison.InvariantCultureIgnoreCase))\r\n                {\r\n                    ShowFieldMessage(\"SelectedPage.UrlTitle\", \"${Composite.Plugins.PageElementProvider, UrlTitleNotUniqueError}\");\r\n                    e.Result = false;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            if (!string.IsNullOrEmpty(selectedPage.FriendlyUrl))\r\n            {\r\n                var usedFriendlyUrls = DataFacade.GetData<IPage>(f => f.FriendlyUrl != null && f.FriendlyUrl != string.Empty && f.Id != selectedPage.Id).Select(f => f.FriendlyUrl).ToList();\r\n\r\n                if (usedFriendlyUrls.Any(f => f.Equals(selectedPage.FriendlyUrl, StringComparison.InvariantCultureIgnoreCase)))\r\n                {\r\n                    ShowFieldMessage(\"SelectedPage.FriendlyUrl\", \"${Composite.Plugins.PageElementProvider, FriendlyUrlNotUniqueError}\");\r\n                    e.Result = false;\r\n                }\r\n            }\r\n\r\n            if (string.IsNullOrEmpty(selectedPage.Title))\r\n            {\r\n                ShowFieldMessage(\"SelectedPage.Title\", \"${Composite.Plugins.PageElementProvider, TitleMissingError}\");\r\n                e.Result = false;\r\n            }\r\n\r\n            var validationResults = ValidationFacade.Validate(selectedPage);\r\n            if (!validationResults.IsValid)\r\n            {\r\n                if (validationResults.Any(f => f.Key == \"UrlTitle\"))\r\n                {\r\n                    ShowFieldMessage(\"SelectedPage.UrlTitle\", \"${Composite.Plugins.PageElementProvider, UrlTitleNotValidError}\");\r\n                    e.Result = false;\r\n                }\r\n\r\n                foreach (var validationResult in validationResults.Where(f => f.Key != \"UrlTitle\"))\r\n                {\r\n                    ShowFieldMessage(\"SelectedPage.\" + validationResult.Key, validationResult.Message);\r\n                }\r\n            }\r\n\r\n            if (!ValidateBindings())\r\n            {\r\n                e.Result = false;\r\n            }\r\n        }\r\n\r\n        private static string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.PageElementProvider\", key);\r\n        }\r\n\r\n\r\n        private void PageStillExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            var selectedPage = GetBinding<IPage>(\"SelectedPage\");\r\n            var originalPage = DataFacade.GetData<IPage>(f => f.Id == selectedPage.Id && f.VersionId == selectedPage.VersionId).SingleOrDefault();\r\n\r\n            e.Result = originalPage != null;\r\n        }\r\n\r\n\r\n        private void setToPublishCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            _doPublish = true;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/EditPageWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1199; 932\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditPageWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"227; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 105\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 146\" Location=\"71; 138\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"81; 203\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"282; 178\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"63; 201\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 128\" Location=\"431; 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"editStateCodeActivity\" Size=\"130; 44\" Location=\"441; 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Save\" Size=\"381; 396\" Location=\"431; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"556; 232\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2_PageStillExists\" Size=\"361; 249\" Location=\"441; 295\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 146\" Location=\"460; 369\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"470; 434\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 146\" Location=\"633; 369\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 62\" Location=\"643; 434\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Preview\" Size=\"150; 272\" Location=\"431; 193\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"previewHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"441; 258\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"editPreviewCodeActivity\" Size=\"130; 44\" Location=\"441; 321\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"441; 384\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_PageTypeChanged\" Size=\"150; 209\" Location=\"431; 219\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"customEvent01HandleExternalEventActivity1\" Size=\"130; 44\" Location=\"441; 284\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 62\" Location=\"441; 347\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_SaveAndPublish\" Size=\"381; 459\" Location=\"439; 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveAndPublishHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"564; 219\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2\" Size=\"361; 312\" Location=\"449; 282\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity5\" Size=\"150; 209\" Location=\"468; 356\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"setToPublishCodeActivity\" Size=\"130; 44\" Location=\"478; 421\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 62\" Location=\"478; 484\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity6\" Size=\"150; 209\" Location=\"641; 356\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 62\" Location=\"651; 452\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"206; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 395\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"381; 396\" Location=\"71; 428\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 231\" Location=\"81; 493\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 128\" Location=\"100; 567\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity\" Size=\"130; 44\" Location=\"110; 632\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 128\" Location=\"273; 567\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"showConsoleMessageBoxActivity1\" Size=\"130; 44\" Location=\"283; 632\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"196; 743\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 491\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"304; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"63; 587\" Name=\"newPageTypeSelectedStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"newPageTypeSelectedStateInitializationActivity\" Size=\"150; 209\" Location=\"71; 620\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"newPageTypeSelectedCodeActivity_UpdateView\" Size=\"130; 44\" Location=\"81; 685\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 62\" Location=\"81; 748\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"EditPageWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditPageWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"491\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"149\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"149\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"204\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"204\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"264\" Y=\"271\" />\r\n\t\t\t\t<ns0:Point X=\"352\" Y=\"271\" />\r\n\t\t\t\t<ns0:Point X=\"352\" Y=\"390\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"390\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"395\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity8\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"264\" Y=\"271\" />\r\n\t\t\t\t<ns0:Point X=\"352\" Y=\"271\" />\r\n\t\t\t\t<ns0:Point X=\"352\" Y=\"486\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"486\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"491\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Bottom\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Preview\" SourceConnectionIndex=\"2\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"641\" Y=\"204\" />\r\n\t\t\t\t<ns0:Point X=\"713\" Y=\"204\" />\r\n\t\t\t\t<ns0:Point X=\"713\" Y=\"292\" />\r\n\t\t\t\t<ns0:Point X=\"564\" Y=\"292\" />\r\n\t\t\t\t<ns0:Point X=\"564\" Y=\"286\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"newPageTypeSelectedStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_PageTypeChanged\" SourceConnectionIndex=\"3\" TargetStateName=\"newPageTypeSelectedStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"341\" Y=\"323\" />\r\n\t\t\t\t<ns0:Point X=\"357\" Y=\"323\" />\r\n\t\t\t\t<ns0:Point X=\"357\" Y=\"582\" />\r\n\t\t\t\t<ns0:Point X=\"215\" Y=\"582\" />\r\n\t\t\t\t<ns0:Point X=\"215\" Y=\"587\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity9\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_SaveAndPublish\" SourceConnectionIndex=\"4\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"326\" Y=\"349\" />\r\n\t\t\t\t<ns0:Point X=\"350\" Y=\"349\" />\r\n\t\t\t\t<ns0:Point X=\"350\" Y=\"390\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"390\" />\r\n\t\t\t\t<ns0:Point X=\"166\" Y=\"395\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity10\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_SaveAndPublish\" SourceConnectionIndex=\"4\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"326\" Y=\"349\" />\r\n\t\t\t\t<ns0:Point X=\"350\" Y=\"349\" />\r\n\t\t\t\t<ns0:Point X=\"350\" Y=\"486\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"486\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"491\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Bottom\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"439\" />\r\n\t\t\t\t<ns0:Point X=\"281\" Y=\"439\" />\r\n\t\t\t\t<ns0:Point X=\"281\" Y=\"390\" />\r\n\t\t\t\t<ns0:Point X=\"204\" Y=\"390\" />\r\n\t\t\t\t<ns0:Point X=\"204\" Y=\"379\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"newPageTypeSelectedStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"newPageTypeSelectedStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Left\" EventHandlerName=\"newPageTypeSelectedStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"67\" Y=\"631\" />\r\n\t\t\t\t<ns0:Point X=\"51\" Y=\"631\" />\r\n\t\t\t\t<ns0:Point X=\"51\" Y=\"191\" />\r\n\t\t\t\t<ns0:Point X=\"204\" Y=\"191\" />\r\n\t\t\t\t<ns0:Point X=\"204\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/LocalizePageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Transactions;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    public sealed partial class LocalizePageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public LocalizePageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_Copy_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var castedEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IPage newPage;\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                CultureInfo sourceCultureInfo = UserSettings.ForeignLocaleCultureInfo;\r\n\r\n                IPage sourcePage;\r\n                List<IPagePlaceholderContent> sourcePagePlaceholders;\r\n                List<IData> sourceMetaDataSet;\r\n\r\n                using (new DataScope(sourceCultureInfo))\r\n                {\r\n                    var pageFromEntityToken = (IPage) castedEntityToken.Data;\r\n                    Guid sourcePageId = pageFromEntityToken.Id;\r\n                    Guid sourcePageVersionId = pageFromEntityToken.VersionId;\r\n\r\n                    using (new DataScope(DataScopeIdentifier.Administrated))\r\n                    {\r\n                        sourcePage = DataFacade.GetData<IPage>(f => f.Id == sourcePageId && f.VersionId == sourcePageVersionId).Single();\r\n                        sourcePage = sourcePage.GetTranslationSource();\r\n\r\n                        using (new DataScope(sourcePage.DataSourceId.DataScopeIdentifier))\r\n                        {\r\n                            sourcePagePlaceholders = DataFacade\r\n                                .GetData<IPagePlaceholderContent>(f => f.PageId == sourcePageId && f.VersionId == sourcePageVersionId)\r\n                                .ToList();\r\n                            sourceMetaDataSet = sourcePage.GetMetaData().ToList();\r\n                        }\r\n                    }\r\n                }\r\n\r\n\r\n                CultureInfo targetCultureInfo = UserSettings.ActiveLocaleCultureInfo;\r\n\r\n                using (new DataScope(targetCultureInfo))\r\n                {\r\n                    newPage = DataFacade.BuildNew<IPage>();\r\n                    sourcePage.ProjectedCopyTo(newPage);\r\n\r\n                    newPage.SourceCultureName = targetCultureInfo.Name;\r\n                    newPage.PublicationStatus = GenericPublishProcessController.Draft;\r\n                    newPage = DataFacade.AddNew<IPage>(newPage);\r\n\r\n                    foreach (IPagePlaceholderContent sourcePagePlaceholderContent in sourcePagePlaceholders)\r\n                    {\r\n                        IPagePlaceholderContent newPagePlaceholderContent = DataFacade.BuildNew<IPagePlaceholderContent>();\r\n                        sourcePagePlaceholderContent.ProjectedCopyTo(newPagePlaceholderContent);\r\n\r\n                        newPagePlaceholderContent.SourceCultureName = targetCultureInfo.Name;\r\n                        newPagePlaceholderContent.PublicationStatus = GenericPublishProcessController.Draft;\r\n                        DataFacade.AddNew<IPagePlaceholderContent>(newPagePlaceholderContent);\r\n                    }\r\n\r\n                    foreach (IData metaData in sourceMetaDataSet)\r\n                    {\r\n                        ILocalizedControlled localizedData = metaData as ILocalizedControlled;\r\n\r\n                        if(localizedData == null)\r\n                        {\r\n                            continue;\r\n                        }\r\n\r\n                        IEnumerable<ReferenceFailingPropertyInfo> referenceFailingPropertyInfos = DataLocalizationFacade.GetReferencingLocalizeFailingProperties(localizedData).Evaluate();\r\n\r\n                        if (!referenceFailingPropertyInfos.Any())\r\n                        {\r\n                            IData newMetaData = DataFacade.BuildNew(metaData.DataSourceId.InterfaceType);\r\n                            metaData.ProjectedCopyTo(newMetaData);\r\n\r\n                            ILocalizedControlled localizedControlled = newMetaData as ILocalizedControlled;\r\n                            localizedControlled.SourceCultureName = targetCultureInfo.Name;\r\n\r\n                            IPublishControlled publishControlled = newMetaData as IPublishControlled;\r\n                            publishControlled.PublicationStatus = GenericPublishProcessController.Draft;\r\n\r\n                            DataFacade.AddNew(newMetaData);\r\n                        }\r\n                        else\r\n                        {\r\n                            foreach (ReferenceFailingPropertyInfo referenceFailingPropertyInfo in referenceFailingPropertyInfos)\r\n                            {\r\n                                Log.LogVerbose(\"LocalizePageWorkflow\", \r\n                                                \"Meta data of type '{0}' is not localized because the field '{1}' is referring some not yet localzed data\"\r\n                                                .FormatWith(metaData.DataSourceId.InterfaceType, referenceFailingPropertyInfo.DataFieldDescriptor.Name));\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n\r\n                EntityTokenCacheFacade.ClearCache(sourcePage.GetDataEntityToken());\r\n                EntityTokenCacheFacade.ClearCache(newPage.GetDataEntityToken());\r\n\r\n                foreach (var folderType in PageFolderFacade.GetDefinedFolderTypes(newPage))\r\n                {\r\n                    EntityTokenCacheFacade.ClearCache(new AssociatedDataElementProviderHelperEntityToken(\r\n                        TypeManager.SerializeType(typeof(IPage)),\r\n                        PageElementProvider.DefaultConfigurationName,\r\n                        newPage.Id.ToString(),\r\n                        TypeManager.SerializeType(folderType)));\r\n                }\r\n\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            ParentTreeRefresher parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(newPage.GetDataEntityToken(), 2);\r\n\r\n            this.ExecuteWorklow(newPage.GetDataEntityToken(), typeof(EditPageWorkflow));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/LocalizePageWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    partial class LocalizePageWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Copy = new System.Workflow.Activities.CodeActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // initializeCodeActivity_Copy\r\n            // \r\n            this.initializeCodeActivity_Copy.Name = \"initializeCodeActivity_Copy\";\r\n            this.initializeCodeActivity_Copy.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Copy_ExecuteCode);\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Copy);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // LocalizePageWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"LocalizePageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private CodeActivity initializeCodeActivity_Copy;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/LocalizePageWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"LocalizePageWorkflow\" Location=\"30; 30\" Size=\"1182; 996\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"LocalizePageWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"LocalizePageWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Copy\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/UnLocalizePageWorkflow.cs",
    "content": "using System;\nusing Composite.Data;\nusing Composite.Data.Types;\n\n\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\n{\n    public sealed partial class UnLocalizePageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\n    {\n        public UnLocalizePageWorkflow()\n        {\n            InitializeComponent();\n        }\n\n        private void InitializeCodeActivity_ExecuteCode(object sender, EventArgs e)\n        {\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\n            IPage selectedPage = (IPage)dataEntityToken.Data;\n            PageServices.DeletePage(selectedPage.Id, selectedPage.VersionId, selectedPage.DataSourceId.LocaleScope, false);\n\n            var parentTreeRefresher = this.CreateParentTreeRefresher();\n            parentTreeRefresher.PostRefreshMessages(selectedPage.GetDataEntityToken());\n        }\n    }\n}\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/UnLocalizePageWorkflow.designer.cs",
    "content": "using System;\nusing System.ComponentModel;\nusing System.ComponentModel.Design;\nusing System.Collections;\nusing System.Drawing;\nusing System.Reflection;\nusing System.Workflow.ComponentModel.Compiler;\nusing System.Workflow.ComponentModel.Serialization;\nusing System.Workflow.ComponentModel;\nusing System.Workflow.ComponentModel.Design;\nusing System.Workflow.Runtime;\nusing System.Workflow.Activities;\nusing System.Workflow.Activities.Rules;\nusing Composite.C1Console.Workflow;\n\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\n{\n    partial class UnLocalizePageWorkflow\n    {\n        #region Designer generated code\n\n        /// <summary> \n        /// Required method for Designer support - do not modify \n        /// the contents of this� method with the code editor.\n        /// </summary>\n        [System.Diagnostics.DebuggerNonUserCode]\n        private void InitializeComponent()\n        {\n            this.CanModifyActivities = true;\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\n            this.initializeCodeActivity_Copy = new System.Workflow.Activities.CodeActivity();\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\n            // \n            // setStateActivity2\n            // \n            this.setStateActivity2.Name = \"setStateActivity2\";\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\n            // \n            // initializeCodeActivity_Copy\n            // \n            this.initializeCodeActivity_Copy.Name = \"initializeCodeActivity_Copy\";\n            this.initializeCodeActivity_Copy.ExecuteCode += new System.EventHandler(this.InitializeCodeActivity_ExecuteCode);\n            // \n            // initializeStateInitializationActivity\n            // \n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Copy);\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\n            // \n            // setStateActivity1\n            // \n            this.setStateActivity1.Name = \"setStateActivity1\";\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\n            // \n            // cancelHandleExternalEventActivity1\n            // \n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\n            // \n            // finalStateActivity\n            // \n            this.finalStateActivity.Name = \"finalStateActivity\";\n            // \n            // initializeStateActivity\n            // \n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\n            // \n            // eventDrivenActivity_GlobalCancel\n            // \n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\n            // \n            // UnLocalizePageWorkflow\n            // \n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\n            this.Activities.Add(this.initializeStateActivity);\n            this.Activities.Add(this.finalStateActivity);\n            this.CompletedStateName = \"finalStateActivity\";\n            this.DynamicUpdateCondition = null;\n            this.InitialStateName = \"initializeStateActivity\";\n            this.Name = \"UnLocalizePageWorkflow\";\n            this.CanModifyActivities = false;\n\n        }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n        #endregion\n\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\n        private StateInitializationActivity initializeStateInitializationActivity;\n        private SetStateActivity setStateActivity1;\n        private StateActivity finalStateActivity;\n        private StateActivity initializeStateActivity;\n        private CodeActivity initializeCodeActivity_Copy;\n        private SetStateActivity setStateActivity2;\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\n    }\n}\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/UnLocalizePageWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"889, 819\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"UnLocalizePageWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"UnLocalizePageWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"UnLocalizePageWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\n\t\t\t<StateDesignerConnector.Segments>\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\n\t\t\t\t<ns0:Point X=\"256\" Y=\"66\" />\n\t\t\t\t<ns0:Point X=\"296\" Y=\"66\" />\n\t\t\t\t<ns0:Point X=\"296\" Y=\"193\" />\n\t\t\t\t<ns0:Point X=\"143\" Y=\"193\" />\n\t\t\t\t<ns0:Point X=\"143\" Y=\"202\" />\n\t\t\t</StateDesignerConnector.Segments>\n\t\t</StateDesignerConnector>\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\n\t\t\t<StateDesignerConnector.Segments>\n\t\t\t\t<ns0:Point X=\"286\" Y=\"150\" />\n\t\t\t\t<ns0:Point X=\"302\" Y=\"150\" />\n\t\t\t\t<ns0:Point X=\"302\" Y=\"193\" />\n\t\t\t\t<ns0:Point X=\"143\" Y=\"193\" />\n\t\t\t\t<ns0:Point X=\"143\" Y=\"202\" />\n\t\t\t</StateDesignerConnector.Segments>\n\t\t</StateDesignerConnector>\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\n\t<StateMachineWorkflowDesigner.Designers>\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 209\" Location=\"38, 63\">\n\t\t\t<EventDrivenDesigner.Designers>\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"48, 128\" />\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 62\" Location=\"48, 191\" />\n\t\t\t</EventDrivenDesigner.Designers>\n\t\t</EventDrivenDesigner>\n\t\t<StateDesigner Size=\"227, 80\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"63, 106\" Name=\"initializeStateActivity\">\n\t\t\t<StateDesigner.Designers>\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150, 209\" Location=\"399, 154\">\n\t\t\t\t\t<StateInitializationDesigner.Designers>\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_Copy\" Size=\"130, 44\" Location=\"409, 219\" />\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 62\" Location=\"409, 282\" />\n\t\t\t\t\t</StateInitializationDesigner.Designers>\n\t\t\t\t</StateInitializationDesigner>\n\t\t\t</StateDesigner.Designers>\n\t\t</StateDesigner>\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 202\" Name=\"finalStateActivity\" />\n\t</StateMachineWorkflowDesigner.Designers>\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/UndoUnpublishedChangesWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing System.Collections.Generic;\r\nusing System.Transactions;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.ProcessControlled;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    public sealed partial class UndoUnpublishedChangesWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public UndoUnpublishedChangesWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void undoCodeActivity_Undo_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            List<string> propertyNamesToIgnore = new List<string> { \"PublicationStatus\" };\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                IPage administrativePage = (IPage)dataEntityToken.Data;\r\n                IPage publicPage = DataFacade.GetDataFromOtherScope<IPage>(administrativePage, DataScopeIdentifier.Public).Single();\r\n\r\n                List<IData> administrativeCompositions = administrativePage.GetMetaData(DataScopeIdentifier.Administrated).ToList();\r\n                List<IData> publicCompositions = publicPage.GetMetaData(DataScopeIdentifier.Public).ToList();\r\n\r\n                Guid pageId = administrativePage.Id;\r\n                Guid versionId = administrativePage.VersionId;\r\n\r\n                List<IPagePlaceholderContent> administrativePlaceholders;\r\n                using (new DataScope(DataScopeIdentifier.Administrated))\r\n                {\r\n                    administrativePlaceholders =\r\n                        (from ph in DataFacade.GetData<IPagePlaceholderContent>(false)\r\n                         where ph.PageId == pageId && ph.VersionId == versionId\r\n                         select ph).ToList();\r\n                }\r\n\r\n                List<IPagePlaceholderContent> publicPlaceholders;\r\n                using (new DataScope(DataScopeIdentifier.Public))\r\n                {\r\n                    publicPlaceholders =\r\n                        (from ph in DataFacade.GetData<IPagePlaceholderContent>(false)\r\n                         where ph.PageId == pageId && ph.VersionId == versionId\r\n                         select ph).ToList();\r\n                }\r\n\r\n                using (ProcessControllerFacade.NoProcessControllers)\r\n                {\r\n                    publicPage.FullCopyChangedTo(administrativePage, propertyNamesToIgnore);\r\n                    DataFacade.Update(administrativePage);\r\n\r\n                    foreach (IData publicComposition in publicCompositions)\r\n                    {\r\n                        IData administrativeComposition =\r\n                            (from com in administrativeCompositions\r\n                             where com.DataSourceId.DataId.CompareTo(publicComposition.DataSourceId.DataId, false) \r\n                             select com).Single();\r\n\r\n                        publicComposition.FullCopyChangedTo(administrativeComposition, propertyNamesToIgnore);\r\n                        DataFacade.Update(administrativeComposition);\r\n                    }\r\n\r\n                    foreach (IPagePlaceholderContent publicPagePlaceholderContent in publicPlaceholders)\r\n                    {\r\n                        IPagePlaceholderContent administrativePagePlaceholderContent =\r\n                            (from pc in administrativePlaceholders\r\n                             where pc.PlaceHolderId == publicPagePlaceholderContent.PlaceHolderId\r\n                             select pc).Single();\r\n\r\n                        publicPagePlaceholderContent.FullCopyChangedTo(administrativePagePlaceholderContent, propertyNamesToIgnore);\r\n                        DataFacade.Update(administrativePagePlaceholderContent);\r\n                    }\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/UndoUnpublishedChangesWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageElementProvider\r\n{\r\n    partial class UndoUnpublishedChangesWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.undoCodeActivity_Undo = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.undoStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.undoStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // undoCodeActivity_Undo\r\n            // \r\n            this.undoCodeActivity_Undo.Name = \"undoCodeActivity_Undo\";\r\n            this.undoCodeActivity_Undo.ExecuteCode += new System.EventHandler(this.undoCodeActivity_Undo_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"undoStateActivity\";\r\n            // \r\n            // undoStateInitializationActivity\r\n            // \r\n            this.undoStateInitializationActivity.Activities.Add(this.undoCodeActivity_Undo);\r\n            this.undoStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.undoStateInitializationActivity.Name = \"undoStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // undoStateActivity\r\n            // \r\n            this.undoStateActivity.Activities.Add(this.undoStateInitializationActivity);\r\n            this.undoStateActivity.Name = \"undoStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // UndoUnpublishedChangesWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.undoStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"UndoUnpublishedChangesWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity undoCodeActivity_Undo;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity undoStateInitializationActivity;\r\n        private StateActivity undoStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageElementProvider/UndoUnpublishedChangesWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"UndoUnpublishedChangesWorkflow\" Location=\"30; 30\" Size=\"1158; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"UndoUnpublishedChangesWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"UndoUnpublishedChangesWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"undoStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"undoStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"487\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"487\" Y=\"437\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"undoStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"undoStateActivity\" EventHandlerName=\"undoStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"478\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"478\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 231\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"undoStateActivity\" Location=\"389; 437\" Size=\"196; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"undoStateInitializationActivity\" Location=\"534; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"undoCodeActivity_Undo\" Location=\"544; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"544; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewMasterPagePageTemplateWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class AddNewMasterPagePageTemplateWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showFieldErrorCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finializeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateFilePath);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // showFieldErrorCodeActivity\r\n            // \r\n            this.showFieldErrorCodeActivity.Name = \"showFieldErrorCodeActivity\";\r\n            this.showFieldErrorCodeActivity.ExecuteCode += new System.EventHandler(this.showFieldErrorCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.ifElseActivity2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.showFieldErrorCodeActivity);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsTitleUsed);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.codeActivity2_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = \"Add new\";\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\PageTemplate\\\\AddNewMasterPagePageTemplate.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity2);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finializeStateActivity\r\n            // \r\n            this.finializeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finializeStateActivity.Name = \"finializeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initalizeStateActivity\r\n            // \r\n            this.initalizeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initalizeStateActivity.Name = \"initalizeStateActivity\";\r\n            // \r\n            // AddNewMasterPagePageTemplateWorkflow\r\n            // \r\n            this.Activities.Add(this.initalizeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initalizeStateActivity\";\r\n            this.Name = \"AddNewMasterPagePageTemplateWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finializeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private CodeActivity codeActivity1;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n\r\n        private CodeActivity codeActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private CodeActivity showFieldErrorCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private StateActivity initalizeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewMasterPagePageTemplateWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.PageTemplates.Foundation.PluginFacade;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.PageTemplates.MasterPages;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewMasterPagePageTemplateWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string Binding_Title = \"Title\";\r\n\r\n        private static readonly string Marker_TemplateId = \"%TemplateId%\";\r\n        private static readonly string Marker_TemplateTitle = \"%TemplateTitle%\";\r\n        private static readonly string Marker_Codebehind = \"%Codebehind%\";\r\n\r\n\r\n        private static readonly string NewMasterPage_Markup = PageTemplateHelper.LoadDefaultTemplateFile(\"MasterPage.txt\");\r\n        private static readonly string NewMasterPage_Codebehind = PageTemplateHelper.LoadDefaultTemplateFile(\"MasterPage.cs.txt\");\r\n\r\n        public AddNewMasterPagePageTemplateWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(Binding_Title, string.Empty);\r\n\r\n            List<KeyValuePair<Guid, string>> templatesOptions =\r\n                (from template in PageTemplateFacade.GetPageTemplates().OfType<MasterPagePageTemplateDescriptor>()\r\n                 where template.IsValid\r\n                       && TemplateIsClonable(template)\r\n                 orderby template.Title\r\n                 select new KeyValuePair<Guid, string>(template.Id, template.Title)).ToList();\r\n\r\n            templatesOptions.Insert(0, new KeyValuePair<Guid, string>(\r\n                Guid.Empty, GetText(\"AddNewMasterPagePageTemplate.LabelCopyFromEmptyOption\")));\r\n\r\n            Guid mostUsedTemplate = PageTemplateHelper.GetTheMostUsedTemplate(templatesOptions.Select(p => p.Key));\r\n\r\n            this.Bindings.Add(\"CopyOfOptions\", templatesOptions);\r\n            this.Bindings.Add(\"CopyOfId\", mostUsedTemplate);\r\n        }\r\n\r\n\r\n\r\n\r\n        private void codeActivity2_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            Guid newTemplateId = Guid.NewGuid();\r\n            string newTitle = this.GetBinding<string>(Binding_Title);\r\n\r\n            string newPageTemplate_Markup, newPageTemplate_Codebehind, templateFolder;\r\n\r\n            Guid copyOfId = this.GetBinding<Guid>(\"CopyOfId\");\r\n            if (copyOfId == Guid.Empty)\r\n            {\r\n                newPageTemplate_Markup = NewMasterPage_Markup;\r\n                newPageTemplate_Codebehind = NewMasterPage_Codebehind;\r\n\r\n                templateFolder = GetMasterPagesRootFolder();\r\n            }\r\n            else\r\n            {\r\n                ParseTemplateForCopying(copyOfId, out newPageTemplate_Markup, out newPageTemplate_Codebehind, out templateFolder);\r\n            }\r\n\r\n            string masterFilePath, codeFilePath;\r\n            GenerateFileNames(templateFolder, newTitle, newTemplateId, out masterFilePath, out codeFilePath);\r\n\r\n            newPageTemplate_Markup = newPageTemplate_Markup.Replace(Marker_Codebehind, Path.GetFileName(codeFilePath));\r\n            newPageTemplate_Codebehind = newPageTemplate_Codebehind\r\n                .Replace(Marker_TemplateId, newTemplateId.ToString())\r\n                .Replace(Marker_TemplateTitle, CSharpEncodeString(newTitle));\r\n\r\n            C1File.WriteAllText(codeFilePath, newPageTemplate_Codebehind);\r\n            C1File.WriteAllText(masterFilePath, newPageTemplate_Markup);\r\n\r\n            var entityToken = new PageTemplateEntityToken(newTemplateId);\r\n            PageTemplateProviderRegistry.FlushTemplates();\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(entityToken);\r\n\r\n            this.ExecuteAction(entityToken, new WorkflowActionToken(typeof(EditMasterPageWorkflow)));\r\n        }\r\n\r\n        private static void GenerateFileNames(string root, string templateTitle, Guid templateId, out string masterFilePath, out string codeFilePath)\r\n        {\r\n            string baseFileName = PathUtil.CleanFileName(templateTitle, true) ?? templateId.ToString();\r\n\r\n            for(int i=0; i<100; i++)\r\n            {\r\n                string fileName = baseFileName + (i == 0 ? \"\" : \"_\" + i.ToString());\r\n\r\n                string _masterPageFilePath = Path.Combine(root, fileName + \".master\");\r\n                string _codebehindFilePath = Path.Combine(root, fileName + \".master.cs\");\r\n\r\n                if (!C1File.Exists(_masterPageFilePath)\r\n                    && !C1File.Exists(_codebehindFilePath))\r\n                {\r\n                    masterFilePath = _masterPageFilePath;\r\n                    codeFilePath = _codebehindFilePath;\r\n                    return;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Failed to generate file name\");\r\n        }\r\n\r\n        private string GetMasterPagesRootFolder()\r\n        {\r\n            foreach(string providerName in PageTemplateProviderRegistry.ProviderNames)\r\n            {\r\n                var provider = PageTemplateProviderPluginFacade.GetProvider(providerName);\r\n                if(provider is MasterPagePageTemplateProvider)\r\n                {\r\n                    return (provider as MasterPagePageTemplateProvider).TemplateDirectoryPath;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Failed to get instance of \" + typeof(MasterPagePageTemplateProvider));\r\n        }\r\n\r\n        private static string CSharpEncodeString(string text)\r\n        {\r\n            return text.Replace(\"\\\\\", \"\\\\\\\\\").Replace(\"\\\"\", \"\\\\\\\"\");\r\n        }\r\n\r\n        private void ParseTemplateForCopying(\r\n            Guid templateId, \r\n            out string markupTemplate,\r\n            out string codebehindTemplate,\r\n            out string templateFolder)\r\n        {\r\n            var masterTemplate = PageTemplateFacade.GetPageTemplate(templateId) as MasterPagePageTemplateDescriptor;\r\n            Verify.IsNotNull(masterTemplate, \"Failed to get MasterPagePageTemplateDescriptor by template id '{0}'\", templateId);\r\n\r\n            var provider = PageTemplateProviderRegistry.GetProviderByTemplateId(templateId) as MasterPagePageTemplateProvider;\r\n            Verify.IsNotNull(provider, \"Failed to get MasterPagePageTemplateProvider by template id '{0}'\", templateId);\r\n\r\n            string markup = C1File.ReadAllText(masterTemplate.FilePath);\r\n            string codebehind = C1File.ReadAllText(masterTemplate.CodeBehindFilePath);\r\n\r\n            string codebehindFileName = Path.GetFileName(masterTemplate.CodeBehindFilePath);\r\n\r\n            // Parsing markup\r\n            markup = markup.Replace(codebehindFileName, Marker_Codebehind);\r\n\r\n            // Parsing codebehind\r\n            const string quote = @\"\"\"\";\r\n\r\n            Verify.That(codebehind.IndexOf(templateId.ToString(), StringComparison.OrdinalIgnoreCase) > 0, \r\n                \"Failed to replace existing templateId '{0}'\", templateId);\r\n\r\n            codebehind = codebehind.Replace(templateId.ToString(), Marker_TemplateId, StringComparison.OrdinalIgnoreCase);\r\n\r\n            // Replacing title, considering 2 types of encoding\r\n            codebehind = codebehind.Replace(\"@\" + quote + masterTemplate.Title.Replace(quote, quote + quote) + quote,\r\n                                            quote + Marker_TemplateTitle + quote);\r\n            codebehind = codebehind.Replace(quote + CSharpEncodeString(masterTemplate.Title) + quote, \r\n                                            quote + Marker_TemplateTitle + quote);\r\n\r\n\r\n            markupTemplate = markup;\r\n            codebehindTemplate = codebehind;\r\n            templateFolder = Path.GetDirectoryName(masterTemplate.CodeBehindFilePath);\r\n        }\r\n\r\n\r\n\r\n        private void IsTitleUsed(object sender, ConditionalEventArgs e)\r\n        {\r\n            string title = this.GetBinding<string>(Binding_Title);\r\n\r\n            e.Result = PageTemplateFacade.GetPageTemplates()\r\n                            .Any(f => f.Title.Equals(title, StringComparison.InvariantCultureIgnoreCase));\r\n        }\r\n\r\n\r\n\r\n        private void ValidateFilePath(object sender, ConditionalEventArgs e)\r\n        {\r\n            string title = this.GetBinding<string>(Binding_Title);\r\n            string rootFolder = GetMasterPagesRootFolder();\r\n\r\n            string masterFilePath, csFilePath;\r\n\r\n            GenerateFileNames(rootFolder, title, new Guid(), out masterFilePath, out csFilePath);\r\n\r\n            const int maximumFilePathLength = 250;\r\n\r\n            if (masterFilePath.Length > maximumFilePathLength || csFilePath.Length > maximumFilePathLength)\r\n            {\r\n                ShowFieldMessage(Binding_Title, GetText(\"AddNewMasterPagePageTemplateWorkflow.TitleTooLong\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n            \r\n            e.Result = true;\r\n        }\r\n\r\n\r\n        private bool TemplateIsClonable(MasterPagePageTemplateDescriptor templateDescriptor)\r\n        {\r\n            string codebehindFile = templateDescriptor.CodeBehindFilePath;\r\n            if(codebehindFile == null)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            string masterFile = templateDescriptor.FilePath;\r\n\r\n            string codebehindFileReference = \"\\\"\" + Path.GetFileName(codebehindFile) + \"\\\"\";\r\n            string templateId = templateDescriptor.Id.ToString();\r\n\r\n            return C1File.ReadAllText(codebehindFile).IndexOf(templateId, StringComparison.OrdinalIgnoreCase) > 0\r\n                && C1File.ReadAllText(masterFile).IndexOf(codebehindFileReference, StringComparison.OrdinalIgnoreCase) > 0;\r\n        }\r\n\r\n        private void showFieldErrorCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowFieldMessage(Binding_Title, GetText(\"AddNewMasterPagePageTemplateWorkflow.TitleInUseTitle\"));\r\n        }\r\n\r\n        private static string GetText(string stringName)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.MasterPagePageTemplate\", stringName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewMasterPagePageTemplateWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"941, 659\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"AddNewMasterPagePageTemplateWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"AddNewMasterPagePageTemplateWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewMasterPagePageTemplateWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"502\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"initalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"502\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"518\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"518\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"397\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"397\" Y=\"197\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"612\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"628\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"628\" Y=\"97\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"97\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finializeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finializeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"495\" Y=\"262\" />\r\n\t\t\t\t<ns0:Point X=\"512\" Y=\"262\" />\r\n\t\t\t\t<ns0:Point X=\"512\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"392\" Y=\"338\" />\r\n\t\t\t\t<ns0:Point X=\"392\" Y=\"350\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"612\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"628\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"628\" Y=\"97\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"97\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"499\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"502\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"finializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"491\" Y=\"391\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"391\" />\r\n\t\t\t\t<ns0:Point X=\"710\" Y=\"502\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"210, 80\" AutoSizeMargin=\"16, 24\" Location=\"296, 101\" Name=\"initalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150, 182\" Location=\"304, 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity1\" Size=\"130, 41\" Location=\"314, 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"314, 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211, 118\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"292, 197\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150, 122\" Location=\"425, 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130, 41\" Location=\"435, 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"612, 544\" Location=\"417, 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"658, 221\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"592, 403\" Location=\"427, 281\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150, 303\" Location=\"446, 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"showFieldErrorCodeActivity\" Size=\"130, 41\" Location=\"456, 414\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 41\" Location=\"456, 474\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"381, 303\" Location=\"619, 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2\" Size=\"361, 222\" Location=\"629, 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150, 122\" Location=\"648, 485\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130, 41\" Location=\"658, 547\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150, 122\" Location=\"821, 485\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130, 41\" Location=\"831, 547\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150, 182\" Location=\"417, 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130, 41\" Location=\"427, 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"427, 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205, 80\" AutoSizeMargin=\"16, 24\" Location=\"290, 350\" Name=\"finializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 242\" Location=\"298, 381\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130, 41\" Location=\"308, 443\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity2\" Size=\"130, 41\" Location=\"308, 503\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"308, 563\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"630, 502\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewPageTemplateWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class AddNewPageTemplateWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.codeActivity2_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finializeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = \"Add new\";\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\PageTemplate\\\\AddNewPageTemplate.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity2);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finializeStateActivity\r\n            // \r\n            this.finializeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finializeStateActivity.Name = \"finializeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initalizeStateActivity\r\n            // \r\n            this.initalizeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initalizeStateActivity.Name = \"initalizeStateActivity\";\r\n            // \r\n            // AddNewPageTemplateWorkflow\r\n            // \r\n            this.Activities.Add(this.initalizeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initalizeStateActivity\";\r\n            this.Name = \"AddNewPageTemplateWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finializeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private CodeActivity codeActivity1;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n\r\n        private CodeActivity codeActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private StateActivity initalizeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewPageTemplateWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewPageTemplateWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string Binding_TemplateTypeOptions = \"TemplateTypeOptions\";\r\n        private static readonly string Binding_TemplateTypeId = \"TemplateTypeId\";\r\n\r\n        public AddNewPageTemplateWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var templateTypes = new List<Tuple<string, string, int>>();\r\n\r\n            foreach (var providerInfo in PageTemplateFacade.GetProviders())\r\n            {\r\n                var provider = providerInfo.Value;\r\n\r\n                if (provider.AddNewTemplateWorkflow == null) continue;\r\n\r\n                templateTypes.Add(new Tuple<string, string, int>(\r\n                    providerInfo.Key, !provider.AddNewTemplateLabel.IsNullOrEmpty()\r\n                        ? StringResourceSystemFacade.ParseString(provider.AddNewTemplateLabel) \r\n                        : providerInfo.Key,\r\n                    provider.GetPageTemplates().Count()));\r\n            }\r\n            \r\n            Verify.That(templateTypes.Any(), \"No page templates supporting adding new templates defined in configuration\");\r\n\r\n            // Most used page template type will be first in the list and preselected\r\n            string preseceltedTemplate = templateTypes.OrderByDescending(t => t.Item3).Select(t => t.Item1).First();\r\n\r\n            List<KeyValuePair<string, string>> options = templateTypes\r\n                .OrderBy(t => t.Item2) // Sorting alphabetically by label \r\n                .Select(t => new KeyValuePair<string, string>(t.Item1, t.Item2)).ToList();\r\n\r\n            this.Bindings.Add(Binding_TemplateTypeOptions, options);\r\n            this.Bindings.Add(Binding_TemplateTypeId, preseceltedTemplate);\r\n        }\r\n\r\n\r\n        private void codeActivity2_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string providerName = this.GetBinding<string>(Binding_TemplateTypeId);\r\n\r\n            Type workflowType = PageTemplateFacade.GetProviders()\r\n                                                  .First(p => p.Key == providerName)\r\n                                                  .Value.AddNewTemplateWorkflow;\r\n\r\n            this.ExecuteAction(new PageTemplateRootEntityToken(), new WorkflowActionToken(workflowType));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewPageTemplateWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"923; 671\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddNewPageTemplateWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"AddNewPageTemplateWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewPageTemplateWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"591\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"initalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"252\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"261\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"261\" Y=\"279\" />\r\n\t\t\t\t<ns0:Point X=\"197\" Y=\"279\" />\r\n\t\t\t\t<ns0:Point X=\"197\" Y=\"291\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"380\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"380\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"591\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"finializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"590\" Y=\"453\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"453\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"591\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finializeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finializeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"295\" Y=\"356\" />\r\n\t\t\t\t<ns0:Point X=\"491\" Y=\"356\" />\r\n\t\t\t\t<ns0:Point X=\"491\" Y=\"412\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"46; 101\" Name=\"initalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"54; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity1\" Size=\"130; 41\" Location=\"64; 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"64; 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211; 118\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"92; 291\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"408; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130; 41\" Location=\"418; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"416; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"426; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"426; 270\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"408; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"418; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"418; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"389; 412\" Name=\"finializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 242\" Location=\"397; 443\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 41\" Location=\"407; 505\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity2\" Size=\"130; 41\" Location=\"407; 565\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"407; 625\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"543; 591\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewRazorPageTemplateWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class AddNewRazorPageTemplateWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showFieldErrorCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finializeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateFilePath);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // showFieldErrorCodeActivity\r\n            // \r\n            this.showFieldErrorCodeActivity.Name = \"showFieldErrorCodeActivity\";\r\n            this.showFieldErrorCodeActivity.ExecuteCode += new System.EventHandler(this.showFieldErrorCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.ifElseActivity2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.showFieldErrorCodeActivity);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsTitleUsed);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.codeActivity2_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = \"Add new\";\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\PageTemplate\\\\AddNewRazorPageTemplate.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity2);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finializeStateActivity\r\n            // \r\n            this.finializeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finializeStateActivity.Name = \"finializeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initalizeStateActivity\r\n            // \r\n            this.initalizeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initalizeStateActivity.Name = \"initalizeStateActivity\";\r\n            // \r\n            // AddNewRazorPageTemplateWorkflow\r\n            // \r\n            this.Activities.Add(this.initalizeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initalizeStateActivity\";\r\n            this.Name = \"AddNewRazorPageTemplateWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finializeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private CodeActivity codeActivity1;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n\r\n        private CodeActivity codeActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private CodeActivity showFieldErrorCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private StateActivity initalizeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewRazorPageTemplateWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.PageTemplates.Foundation.PluginFacade;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.PageTemplates.Razor;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewRazorPageTemplateWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string Binding_Title = \"Title\";\r\n\r\n        private static readonly string Marker_TemplateId = \"%TemplateId%\";\r\n        private static readonly string Marker_TemplateTitle = \"%TemplateTitle%\";\r\n\r\n        private static readonly string DefaultRazorTemplateMarkup = PageTemplateHelper.LoadDefaultTemplateFile(\"RazorPageTemplate.txt\");\r\n\r\n        public AddNewRazorPageTemplateWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(Binding_Title, string.Empty);\r\n\r\n            List<KeyValuePair<Guid, string>> templatesOptions =\r\n                (from template in PageTemplateFacade.GetPageTemplates().OfType<RazorPageTemplateDescriptor>()\r\n                 where template.IsValid\r\n                 orderby template.Title\r\n                 select new KeyValuePair<Guid, string>(template.Id, template.Title)).ToList();\r\n\r\n            templatesOptions.Insert(0, new KeyValuePair<Guid, string>(\r\n                Guid.Empty, GetText(\"AddNewRazorPageTemplate.LabelCopyFromEmptyOption\")));\r\n\r\n            Guid mostUsedTemplate = PageTemplateHelper.GetTheMostUsedTemplate(templatesOptions.Select(p => p.Key));\r\n\r\n            this.Bindings.Add(\"CopyOfOptions\", templatesOptions);\r\n            this.Bindings.Add(\"CopyOfId\", mostUsedTemplate);\r\n        }\r\n\r\n\r\n\r\n        private void codeActivity2_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            Guid newTemplateId = Guid.NewGuid();\r\n            string newTitle = this.GetBinding<string>(Binding_Title);\r\n\r\n            string newPageTemplateMarkup, folderPath;\r\n\r\n            Guid copyOfId = this.GetBinding<Guid>(\"CopyOfId\");\r\n            if (copyOfId == Guid.Empty)\r\n            {\r\n                newPageTemplateMarkup = DefaultRazorTemplateMarkup;\r\n                folderPath = GetRazorTemplatesRootFolder();\r\n            }\r\n            else\r\n            {\r\n                ParseExistingTemplateForCopying(copyOfId, out newPageTemplateMarkup, out folderPath);\r\n            }\r\n\r\n            newPageTemplateMarkup = newPageTemplateMarkup\r\n                    .Replace(Marker_TemplateId, newTemplateId.ToString())\r\n                    .Replace(Marker_TemplateTitle, CSharpEncodeString(newTitle));\r\n\r\n            \r\n            string filePath = GeneratedCshtmlFileName(folderPath, newTitle, newTemplateId);\r\n\r\n            C1File.WriteAllText(filePath, newPageTemplateMarkup);\r\n\r\n            var entityToken = new PageTemplateEntityToken(newTemplateId);\r\n\r\n            PageTemplateProviderRegistry.FlushTemplates();\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(entityToken);\r\n\r\n            this.ExecuteAction(entityToken, new WorkflowActionToken(typeof(EditRazorPageTemplateWorkflow)));\r\n        }\r\n\r\n        private static string GeneratedCshtmlFileName(string root, string templateTitle, Guid TemplateId)\r\n        {\r\n            string fileName = PathUtil.CleanFileName(templateTitle, true) ?? TemplateId.ToString();\r\n\r\n            for(int i=0; i<100; i++)\r\n            {\r\n                string filePath = Path.Combine(root, fileName + (i == 0 ? \"\" : \"_\" + i.ToString()) + \".cshtml\");\r\n\r\n                if(!C1File.Exists(filePath))\r\n                {\r\n                    return filePath;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Failed to generate file name\");\r\n        }\r\n\r\n        private string GetRazorTemplatesRootFolder()\r\n        {\r\n            foreach(string providerName in PageTemplateProviderRegistry.ProviderNames)\r\n            {\r\n                var provider = PageTemplateProviderPluginFacade.GetProvider(providerName);\r\n                if(provider is RazorPageTemplateProvider)\r\n                {\r\n                    return (provider as RazorPageTemplateProvider).TemplateDirectoryPath;\r\n                }\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Failed to get instance of \" + typeof(RazorPageTemplateProvider));\r\n        }\r\n\r\n        private void ParseExistingTemplateForCopying(Guid templateId, out string codeTemplate, out string folderPath)\r\n        {\r\n            var razorTemplate = PageTemplateFacade.GetPageTemplate(templateId) as RazorPageTemplateDescriptor;\r\n            Verify.IsNotNull(razorTemplate, \"Failed to get razor template descriptor by id '{0}'\", templateId);\r\n\r\n            var provider = PageTemplateProviderRegistry.GetProviderByTemplateId(templateId) as RazorPageTemplateProvider;\r\n            Verify.IsNotNull(provider, \"Failed to get razor template provider by template id '{0}'\", templateId);\r\n\r\n            string fullPath = PathUtil.Resolve(razorTemplate.VirtualPath);\r\n            string text = C1File.ReadAllText(fullPath);\r\n\r\n            \r\n\r\n            const string quote = @\"\"\"\";\r\n\r\n            Verify.That(text.IndexOf(templateId.ToString(), StringComparison.OrdinalIgnoreCase) > 0, \r\n                \"Failed to replace existing templateId '{0}'\", templateId);\r\n\r\n            text = text.Replace(templateId.ToString(), Marker_TemplateId, StringComparison.OrdinalIgnoreCase);\r\n\r\n            // Replacing title\r\n            text = text.Replace(\"@\" + quote + razorTemplate.Title.Replace(quote, quote + quote) + quote,\r\n                                quote + Marker_TemplateTitle + quote)\r\n                       .Replace(quote + CSharpEncodeString(razorTemplate.Title) + quote,\r\n                                quote + Marker_TemplateTitle + quote);\r\n\r\n            codeTemplate = text;\r\n            folderPath = Path.GetDirectoryName(fullPath);\r\n        }\r\n\r\n\r\n\r\n        private void IsTitleUsed(object sender, ConditionalEventArgs e)\r\n        {\r\n            string title = this.GetBinding<string>(Binding_Title);\r\n\r\n            e.Result = PageTemplateFacade.GetPageTemplates()\r\n                            .Any(f => f.Title.Equals(title, StringComparison.InvariantCultureIgnoreCase));\r\n        }\r\n\r\n\r\n\r\n        private void ValidateFilePath(object sender, ConditionalEventArgs e)\r\n        {\r\n            string title = this.GetBinding<string>(Binding_Title);\r\n            string rootFolder = GetRazorTemplatesRootFolder();\r\n\r\n            string cshtmlFilePath = GeneratedCshtmlFileName(rootFolder, title, new Guid());\r\n\r\n            const int maximumFilePathLength = 250;\r\n\r\n            if (cshtmlFilePath.Length > maximumFilePathLength)\r\n            {\r\n                ShowFieldMessage(Binding_Title, GetText(\"AddNewRazorPageTemplateWorkflow.TitleTooLong\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n        private static string CSharpEncodeString(string text)\r\n        {\r\n            return text.Replace(\"\\\\\", \"\\\\\\\\\").Replace(\"\\\"\", \"\\\\\\\"\");\r\n        }\r\n\r\n        private void showFieldErrorCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowFieldMessage(Binding_Title, GetText(\"AddNewRazorPageTemplateWorkflow.TitleInUseTitle\"));\r\n        }\r\n\r\n        private static string GetText(string stringName)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorPageTemplate\", stringName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewRazorPageTemplateWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"941, 638\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"AddNewRazorPageTemplateWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"AddNewRazorPageTemplateWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewRazorPageTemplateWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"574\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"574\" Y=\"558\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"initalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"445\" Y=\"144\" />\r\n\t\t\t\t<ns0:Point X=\"460\" Y=\"144\" />\r\n\t\t\t\t<ns0:Point X=\"460\" Y=\"219\" />\r\n\t\t\t\t<ns0:Point X=\"356\" Y=\"219\" />\r\n\t\t\t\t<ns0:Point X=\"356\" Y=\"231\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"612\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"626\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"626\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finializeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finializeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"454\" Y=\"296\" />\r\n\t\t\t\t<ns0:Point X=\"474\" Y=\"296\" />\r\n\t\t\t\t<ns0:Point X=\"474\" Y=\"390\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"390\" />\r\n\t\t\t\t<ns0:Point X=\"306\" Y=\"402\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"612\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"626\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"626\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"514\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"458\" Y=\"320\" />\r\n\t\t\t\t<ns0:Point X=\"574\" Y=\"320\" />\r\n\t\t\t\t<ns0:Point X=\"574\" Y=\"558\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"finializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"405\" Y=\"443\" />\r\n\t\t\t\t<ns0:Point X=\"574\" Y=\"443\" />\r\n\t\t\t\t<ns0:Point X=\"574\" Y=\"558\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"210, 80\" AutoSizeMargin=\"16, 24\" Location=\"239, 103\" Name=\"initalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150, 182\" Location=\"247, 134\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity1\" Size=\"130, 41\" Location=\"257, 196\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"257, 256\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211, 118\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"251, 231\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150, 122\" Location=\"425, 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130, 41\" Location=\"435, 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"612, 544\" Location=\"417, 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"658, 221\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"592, 403\" Location=\"427, 281\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150, 303\" Location=\"446, 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"showFieldErrorCodeActivity\" Size=\"130, 41\" Location=\"456, 414\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 41\" Location=\"456, 474\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"381, 303\" Location=\"619, 352\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2\" Size=\"361, 222\" Location=\"629, 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150, 122\" Location=\"648, 485\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130, 41\" Location=\"658, 547\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150, 122\" Location=\"821, 485\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130, 41\" Location=\"831, 547\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150, 182\" Location=\"417, 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130, 41\" Location=\"427, 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"427, 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205, 80\" AutoSizeMargin=\"16, 24\" Location=\"204, 402\" Name=\"finializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 242\" Location=\"212, 433\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130, 41\" Location=\"222, 495\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity2\" Size=\"130, 41\" Location=\"222, 555\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"222, 615\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"494, 558\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewXmlPageTemplateWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class AddNewXmlPageTemplateWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showFieldErrorCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finializeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateFilePath);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // showFieldErrorCodeActivity\r\n            // \r\n            this.showFieldErrorCodeActivity.Name = \"showFieldErrorCodeActivity\";\r\n            this.showFieldErrorCodeActivity.ExecuteCode += new System.EventHandler(this.showFieldErrorCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.ifElseActivity2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.showFieldErrorCodeActivity);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsTitleUsed);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.codeActivity2_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = \"Add new\";\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\PageTemplate\\\\AddNewXmlPageTemplate.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity2);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finializeStateActivity\r\n            // \r\n            this.finializeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finializeStateActivity.Name = \"finializeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initalizeStateActivity\r\n            // \r\n            this.initalizeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initalizeStateActivity.Name = \"initalizeStateActivity\";\r\n            // \r\n            // AddNewPageTemplateWorkflow\r\n            // \r\n            this.Activities.Add(this.initalizeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initalizeStateActivity\";\r\n            this.Name = \"AddNewPageTemplateWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finializeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private CodeActivity codeActivity1;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n\r\n        private CodeActivity codeActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private CodeActivity showFieldErrorCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity ifElseActivity2;\r\n\r\n        private StateActivity initalizeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/AddNewXmlPageTemplateWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.IO;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Localization;\r\nusing System.Workflow.Activities;\r\nusing Composite.Core.ResourceSystem;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\nusing System.Xml.Linq;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.PageTemplates.XmlPageTemplates;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewXmlPageTemplateWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string _defaultTemplateMarkup =\r\n            string.Format(PageTemplateHelper.LoadDefaultTemplateFile(\"XmlPageTemplate.xml\"),\r\n                          LocalizationXmlConstants.XmlNamespace);\r\n\r\n\r\n        public AddNewXmlPageTemplateWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IXmlPageTemplate newPageTemplate = DataFacade.BuildNew<IXmlPageTemplate>();\r\n\r\n            newPageTemplate.Id = Guid.NewGuid();\r\n            newPageTemplate.Title = \"\";\r\n\r\n            this.Bindings.Add(\"NewPageTemplate\", newPageTemplate);\r\n\r\n            List<KeyValuePair<Guid, string>> templatesOptions =\r\n                (from template in PageTemplateFacade.GetPageTemplates()\r\n                 where template is XmlPageTemplateDescriptor && template.IsValid\r\n                 orderby template.Title\r\n                 select new KeyValuePair<Guid, string>(template.Id, template.Title)).ToList();\r\n\r\n            templatesOptions.Insert(0, new KeyValuePair<Guid, string>(\r\n                Guid.Empty, GetText(\"AddNewXmlPageTemplate.LabelCopyFromEmptyOption\")));\r\n\r\n            Guid mostUsedTemplate = PageTemplateHelper.GetTheMostUsedTemplate(templatesOptions.Select(p => p.Key));\r\n\r\n            this.Bindings.Add(\"CopyOfOptions\", templatesOptions);\r\n            this.Bindings.Add(\"CopyOfId\", mostUsedTemplate);\r\n        }\r\n\r\n\r\n\r\n        private void codeActivity2_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            IXmlPageTemplate newPageTemplate = this.GetBinding<IXmlPageTemplate>(\"NewPageTemplate\");\r\n\r\n            string newPageTemplateMarkup = null;\r\n            Guid copyOfId = this.GetBinding<Guid>(\"CopyOfId\");\r\n            if (copyOfId == Guid.Empty)\r\n            {\r\n                newPageTemplateMarkup = _defaultTemplateMarkup.Replace(\"    \", \"\\t\");\r\n            }\r\n            else\r\n            {\r\n                XDocument copyDocument = TemplateInfo.GetTemplateDocument(copyOfId);\r\n                newPageTemplateMarkup = copyDocument.ToString();\r\n            }\r\n\r\n            IPageTemplateFile pageTemplateFile = DataFacade.BuildNew<IPageTemplateFile>();\r\n            pageTemplateFile.FolderPath = \"/\";\r\n            pageTemplateFile.FileName = string.Format(\"{0}.xml\", PathUtil.CleanFileName(newPageTemplate.Title, true) ?? newPageTemplate.Id.ToString());\r\n            //if (FileNameAlreadyUsed(pageTemplateFile)) pageTemplateFile.FileName = newPageTemplate.Id.ToString() + pageTemplateFile.FileName;\r\n            pageTemplateFile.SetNewContent(newPageTemplateMarkup);\r\n\r\n            DataFacade.AddNew<IPageTemplateFile>(pageTemplateFile, \"PageTemplateFileProvider\");\r\n\r\n            newPageTemplate.PageTemplateFilePath = \"/\" + pageTemplateFile.FileName;\r\n            newPageTemplate = DataFacade.AddNew<IXmlPageTemplate>(newPageTemplate);\r\n\r\n            PageTemplateProviderRegistry.FlushTemplates();\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(newPageTemplate.GetDataEntityToken());\r\n\r\n            this.ExecuteAction(newPageTemplate.GetDataEntityToken(), new WorkflowActionToken(typeof(EditXmlPageTemplateWorkflow)));\r\n        }\r\n\r\n\r\n\r\n        private void IsTitleUsed(object sender, ConditionalEventArgs e)\r\n        {\r\n            IXmlPageTemplate newPageTemplate = this.GetBinding<IXmlPageTemplate>(\"NewPageTemplate\");\r\n\r\n            e.Result = PageTemplateFacade.GetPageTemplates()\r\n                                 .Any(f => f.Title.Equals(newPageTemplate.Title, StringComparison.InvariantCultureIgnoreCase));\r\n        }\r\n\r\n\r\n\r\n        private void ValidateFilePath(object sender, ConditionalEventArgs e)\r\n        {\r\n            IXmlPageTemplate newPageTemplate = this.GetBinding<IXmlPageTemplate>(\"NewPageTemplate\");\r\n\r\n            IPageTemplateFile pageTemplateFile = DataFacade.BuildNew<IPageTemplateFile>();\r\n            pageTemplateFile.FolderPath = \"/\";\r\n            pageTemplateFile.FileName = GetTemplateFileName(newPageTemplate);\r\n\r\n            if (!DataFacade.ValidatePath<IPageTemplateFile>(pageTemplateFile, \"PageTemplateFileProvider\"))\r\n            {\r\n                ShowFieldMessage(\"NewPageTemplate.Title\", GetText(\"AddNewXmlPageTemplateWorkflow.TitleTooLong\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n        private string GetTemplateFileName(IXmlPageTemplate xmlTemplateFile)\r\n        {\r\n            string name = PathUtil.CleanFileName(xmlTemplateFile.Title, true) ?? xmlTemplateFile.Id.ToString();\r\n            return name + \".xml\";\r\n        }\r\n\r\n\r\n        private void showFieldErrorCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowFieldMessage(\"NewPageTemplate.Title\", GetText(\"AddNewXmlPageTemplateWorkflow.TitleInUseTitle\"));\r\n        }        \r\n\r\n        private static string GetText(string stringId)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateElementProvider\", stringId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/DeletePageTemplateWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class DeletePageTemplateWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1InitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.codeActivity2_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = \"Delete page\";\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\DeletePageTemplateStep1.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeInitializationActivity\r\n            // \r\n            this.finalizeInitializationActivity.Activities.Add(this.codeActivity2);\r\n            this.finalizeInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeInitializationActivity.Name = \"finalizeInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1InitializationActivity\r\n            // \r\n            this.step1InitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1InitializationActivity.Name = \"step1InitializationActivity\";\r\n            // \r\n            // initializeInitializationActivity\r\n            // \r\n            this.initializeInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initializeInitializationActivity.Name = \"initializeInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity4);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1InitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // DeletePageTemplateWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeletePageTemplateWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity1;\r\n        private StateInitializationActivity initializeInitializationActivity;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private StateInitializationActivity step1InitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private StateInitializationActivity finalizeInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity wizzardFormActivity1;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private CodeActivity codeActivity2;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/DeletePageTemplateWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.PageTemplates.MasterPages;\r\nusing Composite.Plugins.PageTemplates.Razor;\r\nusing SR = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeletePageTemplateWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string LogTitle = \"DeletePageTemplateWorkflow\";\r\n\r\n        public DeletePageTemplateWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void codeActivity2_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var entityToken = this.EntityToken;\r\n            ITemplateDeleter templateDeleter = GetPageTemplateDeleter(entityToken);\r\n\r\n            string errorMessage = null;\r\n            if (!templateDeleter.CanBeDeleted() || TemplateIsReferenced(templateDeleter.TemplateId, ref errorMessage))\r\n            {\r\n\r\n                string message = GetStr(\"DeletePageTemplateWorkflow.CascadeDeleteErrorMessage\");\r\n                if(errorMessage != null)\r\n                {\r\n                    message += \" \" + errorMessage;\r\n                }\r\n\r\n                this.ShowMessage(DialogType.Error,\r\n                    GetStr(\"DeletePageTemplateWorkflow.CascadeDeleteErrorTitle\"),\r\n                    message);\r\n\r\n                return;\r\n            }\r\n            \r\n            var parentTreeRefresher = this.CreateParentTreeRefresher();\r\n            parentTreeRefresher.PostRefreshMesseges(EntityToken);\r\n\r\n            templateDeleter.DeleteTemplate();\r\n            PageTemplateProviderRegistry.FlushTemplates();\r\n        }\r\n\r\n        private static bool TemplateIsReferenced(Guid templateId, ref string errorMessage)\r\n        {\r\n            var displayedPageReferences = new List<string>();\r\n            var pageHash = new HashSet<Guid>();\r\n\r\n            int pagesToShow = 5;\r\n\r\n            // Page references\r\n            foreach(var publicationScope in new [] { PublicationScope.Published, PublicationScope.Unpublished })\r\n            foreach(var locale in DataLocalizationFacade.ActiveLocalizationCultures)\r\n            {\r\n                using (new DataScope(publicationScope, locale))\r\n                {\r\n                    var pages = DataFacade.GetData<IPage>().Where(p => p.TemplateId == templateId).ToList();\r\n\r\n                    foreach (IPage page in pages)\r\n                    {\r\n                        // Showing each page only once\r\n                        if(pageHash.Contains(page.Id)) continue;\r\n\r\n                        pageHash.Add(page.Id);\r\n\r\n                        if(pagesToShow > 0)\r\n                        {\r\n                            string pageUrl = PageUrls.BuildUrl(new PageUrlData(page), UrlKind.Public, new UrlSpace());\r\n\r\n                            string pageReference = pageUrl ?? locale.Name + \"/\" + page.Id + \"/\" + page.Title;\r\n\r\n                            displayedPageReferences.Add(pageReference);\r\n                            pagesToShow--;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            if(pageHash.Count > 0)\r\n            {\r\n                var sb = new StringBuilder();\r\n\r\n                foreach (string pageReference in displayedPageReferences)\r\n                {\r\n                    sb.Append(Environment.NewLine).Append(pageReference);\r\n                }\r\n\r\n                errorMessage = GetStr(\"DeletePageTemplateWorkflow.PageReference\").FormatWith(pageHash.Count, sb);\r\n                return true;\r\n            }\r\n\r\n            // Page type references\r\n\r\n            var pageTypeReferences = new List<string>();\r\n\r\n            var pageTypes = DataFacade.GetData<IPageType>().Where(pt => pt.DefaultTemplateId == templateId).ToList();\r\n\r\n            foreach(var pageType in pageTypes)\r\n            {\r\n                string pageTypeReference = pageType.Name ?? pageType.Id.ToString();\r\n\r\n                pageTypeReferences.Add(pageTypeReference);\r\n            }\r\n\r\n\r\n            if (pageTypeReferences.Count > 0)\r\n            {\r\n                var sb = new StringBuilder();\r\n                foreach (string pageTypeReference in pageTypeReferences)\r\n                {\r\n                    sb.Append(Environment.NewLine).Append(\"'\" + pageTypeReference + \"'\");\r\n                }\r\n\r\n                errorMessage = GetStr(\"DeletePageTemplateWorkflow.PageTypeReference\")\r\n                               .FormatWith(pageTypeReferences.Count, sb);\r\n                return true;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        private ITemplateDeleter GetPageTemplateDeleter(EntityToken entityToken)\r\n        {\r\n            if (entityToken is DataEntityToken)\r\n            {\r\n                return new XmlPageTemplateDeleter(entityToken as DataEntityToken);\r\n            }\r\n\r\n            if(entityToken is PageTemplateEntityToken)\r\n            {\r\n                Guid pageTemplateId = (entityToken as PageTemplateEntityToken).TemplateId;\r\n\r\n                var pageTemplateDescriptor = PageTemplateFacade.GetPageTemplate(pageTemplateId);\r\n\r\n                if(pageTemplateDescriptor is RazorPageTemplateDescriptor)\r\n                {\r\n                    return new RazorPageTemplateDeleter(pageTemplateDescriptor as RazorPageTemplateDescriptor);\r\n                }\r\n\r\n                if(pageTemplateDescriptor is MasterPagePageTemplateDescriptor)\r\n                {\r\n                    return new MasterPagePageTemplateDeleter(pageTemplateDescriptor as MasterPagePageTemplateDescriptor);\r\n                }\r\n\r\n                throw new NotSupportedException(\"Not supported page template descriptor type '{0}'\"\r\n                                                    .FormatWith(pageTemplateDescriptor.GetType().FullName));\r\n            }\r\n\r\n            throw new NotSupportedException(\"Not supported entity token type '{0}'\".FormatWith(entityToken.GetType().FullName));\r\n        }\r\n\r\n        private static string GetStr(string stringName)\r\n        {\r\n            return SR.GetString(\"Composite.Plugins.PageTemplateElementProvider\", stringName);\r\n        }\r\n\r\n        private interface ITemplateDeleter\r\n        {\r\n            Guid TemplateId { get; }\r\n            bool CanBeDeleted(); \r\n            void DeleteTemplate();\r\n        }\r\n\r\n        private class XmlPageTemplateDeleter: ITemplateDeleter\r\n        {\r\n            private readonly IXmlPageTemplate _pageTemplate;\r\n\r\n            public XmlPageTemplateDeleter(DataEntityToken entityToken)\r\n            {\r\n                var dataEntityToken = entityToken;\r\n                _pageTemplate = (IXmlPageTemplate)dataEntityToken.Data;\r\n            }\r\n\r\n            public bool CanBeDeleted()\r\n            {\r\n                return DataFacade.WillDeleteSucceed(_pageTemplate);\r\n            }\r\n\r\n            public Guid TemplateId\r\n            {\r\n                get { return _pageTemplate.Id; }\r\n            }\r\n\r\n            public void DeleteTemplate()\r\n            {\r\n                IFile file = IFileServices.GetFile<IPageTemplateFile>(_pageTemplate.PageTemplateFilePath);\r\n\r\n                ProcessControllerFacade.FullDelete(_pageTemplate);\r\n\r\n                if (file != null && file is FileSystemFileBase)\r\n                {\r\n                    FileSystemFileBase baseFile = file as FileSystemFileBase;\r\n                    C1File.Delete(baseFile.SystemPath);\r\n\r\n                    try\r\n                    {\r\n                        C1File.Delete(baseFile.SystemPath);\r\n                    }\r\n                    catch\r\n                    {\r\n                        LoggingService.LogWarning(LogTitle, \"Failed to delete page template file: '{0}'\".FormatWith(baseFile.SystemPath));\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private class RazorPageTemplateDeleter: ITemplateDeleter\r\n        {\r\n            private readonly RazorPageTemplateDescriptor _templateDescriptor;\r\n\r\n            public RazorPageTemplateDeleter(RazorPageTemplateDescriptor templateDescriptor)\r\n            {\r\n                _templateDescriptor = templateDescriptor;\r\n            }\r\n\r\n            public Guid TemplateId\r\n            {\r\n                get { return _templateDescriptor.Id; }\r\n            }\r\n\r\n            public bool CanBeDeleted()\r\n            {\r\n                return true;\r\n            }\r\n\r\n            public void DeleteTemplate()\r\n            {\r\n                string filePath = PathUtil.Resolve(_templateDescriptor.VirtualPath);\r\n\r\n                C1File.Delete(filePath);\r\n            }\r\n        }\r\n\r\n        private class MasterPagePageTemplateDeleter : ITemplateDeleter\r\n        {\r\n            private readonly MasterPagePageTemplateDescriptor _templateDescriptor;\r\n\r\n            public MasterPagePageTemplateDeleter(MasterPagePageTemplateDescriptor templateDescriptor)\r\n            {\r\n                _templateDescriptor = templateDescriptor;\r\n            }\r\n\r\n            public Guid TemplateId\r\n            {\r\n                get { return _templateDescriptor.Id; }\r\n            }\r\n\r\n            public bool CanBeDeleted()\r\n            {\r\n                return true;\r\n            }\r\n\r\n            public void DeleteTemplate()\r\n            {\r\n                try\r\n                {\r\n                    C1File.Delete(_templateDescriptor.FilePath);\r\n                }\r\n                catch(Exception)\r\n                {\r\n                    throw new InvalidOperationException(\"Failed to delete file \" + _templateDescriptor.FilePath);\r\n                }\r\n\r\n                try\r\n                {\r\n                    C1File.Delete(_templateDescriptor.CodeBehindFilePath);\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    throw new InvalidOperationException(\"Failed to delete file \" + _templateDescriptor.CodeBehindFilePath);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/DeletePageTemplateWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeletePageTemplateWorkflow\" Location=\"30; 30\" Size=\"1094; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"DeletePageTemplateWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeletePageTemplateWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"126\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"126\" Y=\"197\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"227\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"243\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"243\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"151\" Y=\"286\" />\r\n\t\t\t\t<ns0:Point X=\"151\" Y=\"293\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"249\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"135\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"135\" Y=\"427\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"253\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"126\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"126\" Y=\"197\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"221\" Y=\"468\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"468\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"188\" />\r\n\t\t\t\t<ns0:Point X=\"126\" Y=\"188\" />\r\n\t\t\t\t<ns0:Point X=\"126\" Y=\"197\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"46; 101\" Size=\"185; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializeInitializationActivity\" Location=\"54; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"64; 194\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"46; 197\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"46; 293\" Size=\"211; 118\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1InitializationActivity\" Location=\"502; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"512; 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"494; 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"504; 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"504; 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"494; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"504; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"504; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"46; 427\" Size=\"179; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeInitializationActivity\" Location=\"54; 458\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity2\" Location=\"64; 520\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"64; 580\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"64; 640\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditMasterPageWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Reflection;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\nusing Composite.Plugins.PageTemplates.MasterPages;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditMasterPageWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string LogTitle = typeof (EditMasterPageWorkflow).Name;\r\n        // private static readonly string HtmlMimeType = \"text/html\";\r\n\r\n        private string[] GetFiles()\r\n        {\r\n            var entityToken = this.EntityToken;\r\n\r\n            if (entityToken is PageTemplateEntityToken)\r\n            {\r\n                var masterTemplate = GetPageTemplate();\r\n\r\n                return masterTemplate.GetFiles();\r\n            }\r\n\r\n            if (entityToken is SharedCodeFileEntityToken)\r\n            {\r\n                var sharedFileEntityToken = (SharedCodeFileEntityToken)this.EntityToken;\r\n\r\n                string relativeFilePath = sharedFileEntityToken.VirtualPath;\r\n\r\n                // Security check that validates that the file is a Shared code file \r\n                var sharedFiles = PageTemplateFacade.GetSharedFiles();\r\n\r\n                Verify.That(sharedFiles.Any(sharedFile => string.Compare(sharedFile.RelativeFilePath, relativeFilePath, StringComparison.OrdinalIgnoreCase) == 0),\r\n                            \"There's no page template provider that would claim ownership over shared code file '{0}'\");\r\n\r\n                string fullPath = PathUtil.Resolve(relativeFilePath);\r\n                string codebehindFile = MasterPagePageTemplateProvider.GetCodebehindFilePath(fullPath);\r\n\r\n                var result = new List<string>();\r\n                result.Add(fullPath);\r\n\r\n                if(codebehindFile != null)\r\n                {\r\n                    result.Add(codebehindFile);\r\n                }\r\n\r\n                return result.ToArray();\r\n            }\r\n\r\n            throw new InvalidOperationException(\"Invalid entity token type '{0}'\".FormatWith(entityToken.GetType().Name));\r\n        }\r\n\r\n        private Guid GetTemplateId()\r\n        {\r\n            var entityToken = this.EntityToken;\r\n            Verify.That(entityToken is PageTemplateEntityToken, \"Invalid entity token type '{0}'\", entityToken.GetType());\r\n\r\n            var pageTemplateEntityToken = (PageTemplateEntityToken)entityToken;\r\n            return pageTemplateEntityToken.TemplateId;\r\n        }\r\n\r\n        private MasterPagePageTemplateDescriptor GetPageTemplate()\r\n        {\r\n            Guid templateId = GetTemplateId();\r\n\r\n            var template = PageTemplateFacade.GetPageTemplates().FirstOrDefault(t => t.Id == templateId);\r\n            Verify.IsNotNull(template, \"Faile to find page template by ID '{0}'\", templateId);\r\n\r\n            return (MasterPagePageTemplateDescriptor)template;   \r\n        }\r\n\r\n        public EditMasterPageWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var entityToken = this.EntityToken;\r\n\r\n            string title;\r\n\r\n            if (entityToken is PageTemplateEntityToken)\r\n            {\r\n                title = GetPageTemplate().Title;\r\n            }\r\n            else\r\n            {\r\n                var sharedFileEntityToken = (SharedCodeFileEntityToken)entityToken;\r\n\r\n                title = Path.GetFileName(sharedFileEntityToken.VirtualPath);\r\n            }\r\n\r\n            this.Bindings.Add(\"TemplateTitle\", title);\r\n\r\n            string[] files = GetFiles();\r\n\r\n            // Binding all the files\r\n            for(int i=0; i<files.Length; i++)\r\n            {\r\n                var websiteFile = new WebsiteFile(files[i]);\r\n\r\n                string bindingPrefix = GetBindingPrefix(i);\r\n\r\n                this.Bindings.Add(bindingPrefix + \"Content\", websiteFile.ReadAllText());\r\n                this.Bindings.Add(bindingPrefix + \"Name\", websiteFile.FileName);\r\n                // Assigning \"text/html\" mimetype so CodeMirror will show it correctly\r\n\r\n                // this.Bindings.Add(bindingPrefix + \"MimeType\", i == 0 ? HtmlMimeType : websiteFile.MimeType);\r\n                this.Bindings.Add(bindingPrefix + \"MimeType\", websiteFile.MimeType);\r\n            }\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string[] files = GetFiles();\r\n\r\n            var fileContent = new List<string>();\r\n\r\n            for (int i = 0; i < files.Length; i++)\r\n            {\r\n                string bindingPrefix = GetBindingPrefix(i);\r\n\r\n                fileContent.Add(this.GetBinding<string>(bindingPrefix + \"Content\"));\r\n            }\r\n\r\n            // Fixing html specific escape sequences in .master file\r\n            string fixedMaster = PageTemplateHelper.FixHtmlEscapeSequences(fileContent[0]);\r\n            bool viewNeedsUpdating = fileContent[0] != fixedMaster;\r\n            fileContent[0] = fixedMaster;\r\n\r\n\r\n            EntityToken newEntityToken;\r\n            if (!CompileAndValidate(files, fileContent, out newEntityToken))\r\n            {\r\n                SetSaveStatus(false);\r\n                return;\r\n            }\r\n\r\n            for (int i = 0; i < files.Length; i++)\r\n            {\r\n                var websiteFile = new WebsiteFile(files[i]);\r\n\r\n                websiteFile.WriteAllText(fileContent[i]);\r\n            }\r\n\r\n            PageTemplateProviderRegistry.FlushTemplates();\r\n\r\n            if (newEntityToken != null)\r\n            {\r\n                SetSaveStatus(true, newEntityToken);\r\n\r\n                SerializedEntityToken = EntityTokenSerializer.Serialize(newEntityToken);\r\n            }\r\n            else\r\n            {\r\n                SetSaveStatus(true);\r\n            }\r\n\r\n            if(viewNeedsUpdating)\r\n            {\r\n                UpdateBinding(GetBindingPrefix(0) + \"Content\", fixedMaster);\r\n                RerenderView();\r\n            }\r\n\r\n            this.CreateParentTreeRefresher().PostRefreshMesseges(this.EntityToken);\r\n        }\r\n\r\n        private static string GetBindingPrefix(int zeroBasedFileNumber)\r\n        {\r\n            return \"File\" + (zeroBasedFileNumber + 1);\r\n        }\r\n\r\n        private bool CompileAndValidate(string[] files, IList<string> fileContent, out EntityToken newEntityToken)\r\n        {\r\n            string tempMasterFile = GetTempFilePath(files[0]);\r\n            string tempCodeBehindFile = null; \r\n\r\n            string tempMasterFileContent = fileContent[0];\r\n\r\n            if(files.Length > 1)\r\n            {\r\n                tempCodeBehindFile = GetTempFilePath(files[1]);\r\n\r\n                string originalCsFileName = Path.GetFileName(files[1]);\r\n                string newCsFileName = Path.GetFileName(tempCodeBehindFile);\r\n\r\n                // Fixing the refecence to the CS file in the temporary created .master file so it will point\r\n                // to the temporary CS file. Just string.Replace, writing a sofisticated parser would be overkill\r\n\r\n                int offset = tempMasterFileContent.IndexOf(originalCsFileName, StringComparison.OrdinalIgnoreCase);\r\n\r\n                if(offset > 0)\r\n                {\r\n                    tempMasterFileContent = tempMasterFileContent.Substring(0, offset)\r\n                                            + newCsFileName\r\n                                            + tempMasterFileContent.Substring(offset + originalCsFileName.Length);\r\n                }\r\n            }\r\n\r\n            try\r\n            {\r\n                File.WriteAllText(tempMasterFile, tempMasterFileContent); \r\n\r\n                if(tempCodeBehindFile != null)\r\n                {\r\n                    File.WriteAllText(tempCodeBehindFile, fileContent[1]); \r\n                }\r\n\r\n                string virtualPath = \"~\" + PathUtil.GetWebsitePath(tempMasterFile);\r\n\r\n\r\n                MasterPage masterPage;\r\n\r\n                try\r\n                {\r\n                    masterPage = CompilationHelper.CompileMasterPage(virtualPath);\r\n                }\r\n                catch(Exception ex)\r\n                {\r\n                    Log.LogWarning(LogTitle, \"Failed to compile master page\");\r\n                    Log.LogWarning(LogTitle, ex);\r\n\r\n                    Exception compilationException = (ex is TargetInvocationException) ? ex.InnerException : ex;\r\n\r\n                    // Replacing file path and temp file name from error message as it is irrelevant to the user\r\n                    string masterFileName = Path.GetFileName(files[0]);\r\n                    string errorMessage = compilationException.Message;\r\n                    \r\n                    if(errorMessage.StartsWith(tempMasterFile, StringComparison.OrdinalIgnoreCase))\r\n                    {\r\n                        errorMessage = masterFileName + errorMessage.Substring(tempMasterFile.Length);\r\n                    }\r\n\r\n                    ShowWarning(GetText(\"EditTemplate.Validation.CompilationFailed\")\r\n                                .FormatWith(errorMessage));\r\n\r\n                    newEntityToken = null;\r\n                    return false;\r\n                }\r\n\r\n                return Validate(masterPage, out newEntityToken);\r\n            }\r\n            finally\r\n            {\r\n                // Deleting temporary files\r\n                File.Delete(tempMasterFile);\r\n                if (tempCodeBehindFile != null)\r\n                {\r\n                    File.Delete(tempCodeBehindFile);\r\n                }\r\n            }\r\n        }\r\n\r\n        private bool Validate(MasterPage masterPage, out EntityToken newEntityToken)\r\n        {\r\n            newEntityToken = null;\r\n\r\n            if(!(this.EntityToken is PageTemplateEntityToken))\r\n            {\r\n                return true;\r\n            }\r\n\r\n            var pageTemplate = GetPageTemplate();\r\n\r\n            var templateDefinition = masterPage as MasterPagePageTemplate;\r\n            if(templateDefinition == null)\r\n            {\r\n                if(!pageTemplate.IsValid)\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                ShowWarning(GetText(\"EditTemplate.Validation.IncorrectBaseClass\")\r\n                            .FormatWith(typeof(MasterPagePageTemplate).FullName));\r\n                return false;\r\n            }\r\n\r\n            Guid templateId;\r\n\r\n            try\r\n            {\r\n                templateId = templateDefinition.TemplateId;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                ShowPropertyError(\"TemplateId\", ex);\r\n                return false;\r\n            }\r\n\r\n            try\r\n            {\r\n                string newTitle = templateDefinition.TemplateTitle;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                ShowPropertyError(\"TemplateTitle\", ex);\r\n                return false;\r\n            }\r\n\r\n            if(pageTemplate.IsValid)\r\n            {\r\n                if (templateId != pageTemplate.Id)\r\n                {\r\n                    ShowWarning(GetText(\"EditTemplate.Validation.TemplateIdChanged\").FormatWith(pageTemplate.Id));\r\n                    return false;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                newEntityToken = new PageTemplateEntityToken(templateId);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        private void ShowPropertyError(string propertyName, Exception ex)\r\n        {\r\n            ShowWarning(GetText(\"EditTemplate.Validation.PropertyError\")\r\n                        .FormatWith(propertyName, ex.Message));\r\n        }\r\n\r\n\r\n        private void ShowWarning(string warning)\r\n        {\r\n            this.ShowMessage(DialogType.Warning,\r\n                 GetText(\"EditTemplate.Validation.DialogTitle\"),\r\n                 warning);\r\n        }\r\n\r\n        private string GetText(string text)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.MasterPagePageTemplate\", text);\r\n        }\r\n\r\n\r\n        private string GetTempFilePath(string filePath)\r\n        {\r\n            string fileName = Path.GetFileName(filePath);\r\n            string folderPath = Path.GetDirectoryName(filePath);\r\n\r\n            return Path.Combine(folderPath, MasterPagePageTemplateProvider.TempFilePrefix  + fileName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditMasterPageWorkflow.designer.cs",
    "content": "using System.Workflow.Activities;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class EditMasterPageWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/PageTemplate/EditMasterPage.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditMasterPageWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditMasterPageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private CodeActivity saveCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditMasterPageWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"963, 837\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"EditMasterPageWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditMasterPageWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditMasterPageWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"526\" />\r\n\t\t\t\t<ns0:Point X=\"387\" Y=\"526\" />\r\n\t\t\t\t<ns0:Point X=\"387\" Y=\"538\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initialState\" TargetConnectionIndex=\"0\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"475\" Y=\"153\" />\r\n\t\t\t\t<ns0:Point X=\"485\" Y=\"153\" />\r\n\t\t\t\t<ns0:Point X=\"485\" Y=\"214\" />\r\n\t\t\t\t<ns0:Point X=\"381\" Y=\"214\" />\r\n\t\t\t\t<ns0:Point X=\"381\" Y=\"226\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"457\" Y=\"291\" />\r\n\t\t\t\t<ns0:Point X=\"483\" Y=\"291\" />\r\n\t\t\t\t<ns0:Point X=\"483\" Y=\"348\" />\r\n\t\t\t\t<ns0:Point X=\"387\" Y=\"348\" />\r\n\t\t\t\t<ns0:Point X=\"387\" Y=\"360\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"486\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"501\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"501\" Y=\"218\" />\r\n\t\t\t\t<ns0:Point X=\"381\" Y=\"218\" />\r\n\t\t\t\t<ns0:Point X=\"381\" Y=\"226\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"197, 80\" AutoSizeMargin=\"16, 24\" Location=\"282, 112\" Name=\"initialState\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150, 182\" Location=\"290, 143\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130, 41\" Location=\"300, 205\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"300, 265\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"189, 94\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"287, 226\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150, 122\" Location=\"436, 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130, 41\" Location=\"446, 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_Save\" Size=\"150, 182\" Location=\"428, 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"438, 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"438, 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205, 80\" AutoSizeMargin=\"16, 24\" Location=\"285, 360\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 182\" Location=\"293, 391\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity\" Size=\"130, 41\" Location=\"303, 453\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"303, 513\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"307, 538\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditRazorPageTemplateWorkflow.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web.WebPages;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.PageTemplates.Foundation;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\nusing Composite.Plugins.PageTemplates.Razor;\r\nusing RazorPageTemplate = Composite.AspNet.Razor.RazorPageTemplate;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditRazorPageTemplateWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string LogTitle = \"Razor Edit\";\r\n\r\n        public EditRazorPageTemplateWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string filePath = PathUtil.Resolve(GetFileVirtualPath());\r\n\r\n            WebsiteFile websiteFile = new WebsiteFile(filePath);\r\n\r\n            this.Bindings.Add(\"FilePath\", filePath);\r\n            this.Bindings.Add(\"FileContent\", websiteFile.ReadAllText());\r\n            this.Bindings.Add(\"FileName\", websiteFile.FileName);\r\n            this.Bindings.Add(\"FileMimeType\", websiteFile.MimeType);\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string virtualPath = GetFileVirtualPath();\r\n            string filePath = PathUtil.Resolve(virtualPath);\r\n\r\n            WebsiteFile websiteFile = new WebsiteFile(filePath);\r\n\r\n            string content = this.GetBinding<string>(\"FileContent\");\r\n            string fixedSource = PageTemplateHelper.FixHtmlEscapeSequences(content);\r\n\r\n            EntityToken newEntityToken;\r\n            bool isValid = ValidateMarkup(virtualPath, fixedSource, out newEntityToken);\r\n\r\n            if (isValid)\r\n            {\r\n                websiteFile.WriteAllText(fixedSource);\r\n\r\n                PageTemplateProviderRegistry.FlushTemplates();\r\n\r\n                this.CreateParentTreeRefresher().PostRefreshMesseges(this.EntityToken);\r\n            }\r\n\r\n            if (isValid && newEntityToken != null)\r\n            {\r\n                SetSaveStatus(true, newEntityToken);\r\n\r\n                SerializedEntityToken = EntityTokenSerializer.Serialize(newEntityToken);\r\n            }\r\n            else\r\n            {\r\n                SetSaveStatus(isValid);\r\n            }\r\n\r\n            if(isValid && fixedSource != content)\r\n            {\r\n                UpdateBinding(\"FileContent\", fixedSource);\r\n                RerenderView();\r\n            }\r\n        }\r\n\r\n\r\n        private bool ValidateMarkup(string virtualPath, string content, out EntityToken newEntityToken)\r\n        {\r\n            newEntityToken = null;\r\n\r\n            string filePath = PathUtil.Resolve(virtualPath);\r\n            string fileName = Path.GetFileName(filePath);\r\n\r\n            string tempFileName = RazorPageTemplateProvider.TempFilePrefix + fileName;\r\n            string tempFileVirtualPath = virtualPath.Substring(0, virtualPath.Length - fileName.Length) + tempFileName;\r\n            string tempFile = Path.Combine(Path.GetDirectoryName(filePath), tempFileName);\r\n\r\n            try\r\n            {\r\n                C1File.WriteAllText(tempFile, content);\r\n\r\n                WebPageBase webPageBase;\r\n\r\n                try\r\n                {\r\n                    webPageBase = WebPage.CreateInstanceFromVirtualPath(tempFileVirtualPath);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogWarning(LogTitle, \"Compilation failed while validating changes to '{0}'\", virtualPath);\r\n                    Log.LogWarning(LogTitle, ex);\r\n\r\n                    string message = ex.Message;\r\n\r\n                    if(message.StartsWith(tempFile, StringComparison.OrdinalIgnoreCase))\r\n                    {\r\n                        message = fileName + message.Substring(tempFile.Length);\r\n                    }\r\n\r\n                    ShowWarning(GetText(\"EditTemplate.Validation.CompilationFailed\")\r\n                                .FormatWith(message));\r\n                    return false;\r\n                }\r\n\r\n                if (!(webPageBase is RazorPageTemplate))\r\n                {\r\n                    if(IsPageTemplate) \r\n                    {\r\n                        var templateDescriptor = GetPageTemplateDescriptor();\r\n                        \r\n                        if(templateDescriptor.IsValid)\r\n                        {\r\n                            ShowWarning(GetText(\"EditTemplate.Validation.IncorrectBaseClass\")\r\n                                    .FormatWith(typeof(RazorPageTemplate).FullName));\r\n                            return false;    \r\n                        }\r\n\r\n                        newEntityToken = new SharedCodeFileEntityToken(virtualPath);\r\n                        return true;\r\n                    }\r\n\r\n                    return true;\r\n                }\r\n\r\n                Guid templateId;\r\n\r\n                var pageTemplate = webPageBase as RazorPageTemplate;\r\n                pageTemplate.Configure();\r\n\r\n                try\r\n                {\r\n                    templateId = pageTemplate.TemplateId;\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    ShowPropertyError(\"TemplateId\", ex);\r\n                    return false;\r\n                }\r\n\r\n                try\r\n                {\r\n                    string templateTitle = pageTemplate.TemplateTitle;\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    ShowPropertyError(\"TemplateTitle\", ex);\r\n                    return false;\r\n                }\r\n\r\n                if(!IsPageTemplate)\r\n                {\r\n                    newEntityToken = new PageTemplateEntityToken(templateId);\r\n                    return true;\r\n                }\r\n\r\n                var pageTemplateDescriptor = GetPageTemplateDescriptor();\r\n\r\n                if (pageTemplateDescriptor.IsValid)\r\n                {\r\n                    // Forbidding to change template id from this workflow in order to avoid mistakes\r\n                    if (templateId != pageTemplateDescriptor.Id)\r\n                    {\r\n                        ShowWarning(GetText(\"EditTemplate.Validation.TemplateIdChanged\").FormatWith(pageTemplateDescriptor.Id));\r\n                        return false;\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    newEntityToken = new PageTemplateEntityToken(templateId);\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                C1File.Delete(tempFile);\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n        private void ShowPropertyError(string propertyName, Exception ex)\r\n        {\r\n            ShowWarning(GetText(\"EditTemplate.Validation.PropertyError\")\r\n                        .FormatWith(propertyName, ex.Message));\r\n        }\r\n\r\n\r\n        private void ShowWarning(string warning)\r\n        {\r\n            this.ShowMessage(DialogType.Warning,\r\n                 GetText(\"EditTemplate.Validation.DialogTitle\"),\r\n                 warning);\r\n        }\r\n\r\n        private Guid GetTemplateId()\r\n        {\r\n            var entityToken = this.EntityToken;\r\n            Verify.That(entityToken is PageTemplateEntityToken, \"Invalid entity token type '{0}'\", entityToken.GetType());\r\n\r\n            var pageTemplateEntityToken = (PageTemplateEntityToken)entityToken;\r\n            return pageTemplateEntityToken.TemplateId;\r\n        }\r\n\r\n        private string GetText(string text)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorPageTemplate\", text);\r\n        }\r\n\r\n        private RazorPageTemplateDescriptor GetPageTemplateDescriptor()\r\n        {\r\n            Guid templateId = GetTemplateId();\r\n\r\n            var template = PageTemplateFacade.GetPageTemplates().FirstOrDefault(t => t.Id == templateId);\r\n            Verify.IsNotNull(template, \"Faile to find page template by ID '{0}'\", templateId);\r\n\r\n            return (PageTemplates.Razor.RazorPageTemplateDescriptor)template;\r\n        }\r\n\r\n        private bool IsPageTemplate\r\n        {\r\n            get { return this.EntityToken is PageTemplateEntityToken; }\r\n        }\r\n\r\n        private string GetFileVirtualPath()\r\n        {\r\n            if(IsPageTemplate)\r\n            {\r\n                return GetPageTemplateDescriptor().VirtualPath;\r\n            }\r\n\r\n            if(EntityToken is SharedCodeFileEntityToken)\r\n            {\r\n                return (EntityToken as SharedCodeFileEntityToken).VirtualPath;\r\n            }\r\n            \r\n            throw new InvalidOperationException(\"Unexpected entity token type \" + EntityToken.GetType().FullName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditRazorPageTemplateWorkflow.designer.cs",
    "content": "using System.Workflow.Activities;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class EditRazorPageTemplateWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/PageTemplate/EditRazorTemplate.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditRazorPageTemplateWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditRazorPageTemplateWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private CodeActivity saveCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditRazorPageTemplateWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"963, 837\" AutoSizeMargin=\"16, 24\" Location=\"30, 30\" Name=\"EditRazorPageTemplateWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditRazorPageTemplateWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditRazorPageTemplateWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"544\" />\r\n\t\t\t\t<ns0:Point X=\"329\" Y=\"544\" />\r\n\t\t\t\t<ns0:Point X=\"329\" Y=\"556\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initialState\" TargetConnectionIndex=\"0\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"436\" Y=\"189\" />\r\n\t\t\t\t<ns0:Point X=\"448\" Y=\"189\" />\r\n\t\t\t\t<ns0:Point X=\"448\" Y=\"244\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"244\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"256\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"420\" Y=\"321\" />\r\n\t\t\t\t<ns0:Point X=\"444\" Y=\"321\" />\r\n\t\t\t\t<ns0:Point X=\"444\" Y=\"384\" />\r\n\t\t\t\t<ns0:Point X=\"348\" Y=\"384\" />\r\n\t\t\t\t<ns0:Point X=\"348\" Y=\"396\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"447\" Y=\"437\" />\r\n\t\t\t\t<ns0:Point X=\"456\" Y=\"437\" />\r\n\t\t\t\t<ns0:Point X=\"456\" Y=\"248\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"248\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"256\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"197, 80\" AutoSizeMargin=\"16, 24\" Location=\"243, 148\" Name=\"initialState\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150, 182\" Location=\"251, 179\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130, 41\" Location=\"261, 241\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"261, 301\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"189, 94\" AutoSizeMargin=\"16, 24\" Location=\"250, 256\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150, 122\" Location=\"258, 287\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130, 41\" Location=\"268, 349\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_Save\" Size=\"150, 182\" Location=\"258, 311\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"268, 373\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"268, 433\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205, 80\" AutoSizeMargin=\"16, 24\" Location=\"246, 396\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 182\" Location=\"254, 427\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity\" Size=\"130, 41\" Location=\"264, 489\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"264, 549\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"249, 556\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditSharedCodeFileWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditSharedCodeFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private string GetFilePath()\r\n        {\r\n            var entityToken = (SharedCodeFileEntityToken)this.EntityToken;\r\n\r\n            string relativeFilePath = entityToken.VirtualPath;\r\n\r\n            // Security check that validates that the file is a Shared code file \r\n            var sharedFiles = PageTemplateFacade.GetSharedFiles();\r\n\r\n            Verify.That(sharedFiles.Any(sf => string.Compare(sf.RelativeFilePath, relativeFilePath, StringComparison.OrdinalIgnoreCase) == 0),\r\n                        \"There's no page template provider that would claim ownership over shared code file '{0}'\");\r\n\r\n            return PathUtil.Resolve(relativeFilePath);\r\n        }\r\n\r\n        public EditSharedCodeFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string filePath = GetFilePath();\r\n\r\n            WebsiteFile websiteFile = new WebsiteFile(filePath);\r\n\r\n            this.Bindings.Add(\"FileContent\", websiteFile.ReadAllText());\r\n            this.Bindings.Add(\"FileName\", websiteFile.FileName);\r\n            this.Bindings.Add(\"FileMimeType\", websiteFile.MimeType);\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string filePath = GetFilePath();\r\n\r\n            WebsiteFile websiteFile = new WebsiteFile(filePath);\r\n\r\n            string content = this.GetBinding<string>(\"FileContent\");\r\n\r\n            websiteFile.WriteAllText(content);\r\n\r\n            SetSaveStatus(true);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditSharedCodeFileWorkflow.designer.cs",
    "content": "using System.Workflow.Activities;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class EditSharedCodeFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/WebsiteFileElementProviderEditTextContentFile.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditSharedCodeFileWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditSharedCodeFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private CodeActivity saveCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditSharedCodeFileWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"963, 837\" AutoSizeMargin=\"16, 24\" Location=\"30, 30\" Name=\"EditSharedCodeFileWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditSharedCodeFileWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditSharedCodeFileWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"513\" />\r\n\t\t\t\t<ns0:Point X=\"424\" Y=\"513\" />\r\n\t\t\t\t<ns0:Point X=\"424\" Y=\"525\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initialState\" TargetConnectionIndex=\"0\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"504\" Y=\"145\" />\r\n\t\t\t\t<ns0:Point X=\"520\" Y=\"145\" />\r\n\t\t\t\t<ns0:Point X=\"520\" Y=\"218\" />\r\n\t\t\t\t<ns0:Point X=\"416\" Y=\"218\" />\r\n\t\t\t\t<ns0:Point X=\"416\" Y=\"230\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"492\" Y=\"295\" />\r\n\t\t\t\t<ns0:Point X=\"520\" Y=\"295\" />\r\n\t\t\t\t<ns0:Point X=\"520\" Y=\"360\" />\r\n\t\t\t\t<ns0:Point X=\"424\" Y=\"360\" />\r\n\t\t\t\t<ns0:Point X=\"424\" Y=\"372\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"523\" Y=\"413\" />\r\n\t\t\t\t<ns0:Point X=\"536\" Y=\"413\" />\r\n\t\t\t\t<ns0:Point X=\"536\" Y=\"222\" />\r\n\t\t\t\t<ns0:Point X=\"416\" Y=\"222\" />\r\n\t\t\t\t<ns0:Point X=\"416\" Y=\"230\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"197, 80\" AutoSizeMargin=\"16, 24\" Location=\"311, 104\" Name=\"initialState\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150, 182\" Location=\"319, 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130, 41\" Location=\"329, 197\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"329, 257\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"189, 94\" AutoSizeMargin=\"16, 24\" Location=\"322, 230\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150, 122\" Location=\"330, 261\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130, 41\" Location=\"340, 323\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_Save\" Size=\"150, 182\" Location=\"330, 285\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"340, 347\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"340, 407\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205, 80\" AutoSizeMargin=\"16, 24\" Location=\"322, 372\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 182\" Location=\"330, 403\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity\" Size=\"130, 41\" Location=\"340, 465\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"340, 525\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"344, 525\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditXmlPageTemplateWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    partial class EditXmlPageTemplateWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ShowMessageCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // ShowMessageCodeActivity\r\n            // \r\n            this.ShowMessageCodeActivity.Name = \"ShowMessageCodeActivity\";\r\n            this.ShowMessageCodeActivity.ExecuteCode += new System.EventHandler(this.ShowMessageCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.ShowMessageCodeActivity);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsTitleUsed);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\PageTemplate\\\\EditXmlPageTemplate.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.ifElseActivity1);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity4);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // EditPageTemplateWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditXmlPageTemplateWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity editStateActivity;\r\n        private CodeActivity initializeCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private StateActivity saveStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity codeActivity1;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private StateActivity finalStateActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private CodeActivity ShowMessageCodeActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateElementProvider/EditXmlPageTemplateWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditXmlPageTemplateWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditXmlPageTemplateWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            this.Bindings.Add(\"PageTemplate\", dataEntityToken.Data);\r\n            this.Bindings.Add(\"OldTitle\", ((IXmlPageTemplate)dataEntityToken.Data).Title);\r\n\r\n            string templatePath = ((IXmlPageTemplate)dataEntityToken.Data).PageTemplateFilePath;\r\n            IPageTemplateFile file = IFileServices.TryGetFile<IPageTemplateFile>(templatePath);\r\n\r\n            this.Bindings.Add(\"PageTemplateMarkup\", file.ReadAllText());\r\n        }\r\n\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IXmlPageTemplate pageTemplate = this.GetBinding<IXmlPageTemplate>(\"PageTemplate\");\r\n            string pageTemplateMarkup = this.GetBinding<string>(\"PageTemplateMarkup\");\r\n\r\n            bool xhtmlParseable = true;\r\n            string parseError = null;\r\n            try\r\n            {\r\n                XDocument parsedElement = XDocument.Parse(pageTemplateMarkup);\r\n\r\n                ValidatePageTemplate(parsedElement);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                xhtmlParseable = false;\r\n                parseError = ex.Message;\r\n            }\r\n\r\n            if (!xhtmlParseable)\r\n            {\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                var consoleMessageService = serviceContainer.GetService<IManagementConsoleMessageService>();\r\n                consoleMessageService.ShowMessage(\r\n                    DialogType.Error,\r\n                    GetString(\"EditXmlPageTemplateWorkflow.InvalidXmlTitle\"),\r\n                    GetString(\"EditXmlPageTemplateWorkflow.InvalidXmlMessage\").FormatWith(parseError));\r\n                return;\r\n            }\r\n\r\n            // Renaming related file if necessary\r\n            string fileName = GetTemplateFileName(pageTemplate);\r\n            if (Path.GetFileName(pageTemplate.PageTemplateFilePath) != fileName)\r\n            {\r\n                IPageTemplateFile file = IFileServices.GetFile<IPageTemplateFile>(pageTemplate.PageTemplateFilePath);\r\n                string systemPath = (file as FileSystemFileBase).SystemPath;\r\n                string newSystemPath = Path.Combine(Path.GetDirectoryName(systemPath), fileName);\r\n\r\n                if (string.Compare(systemPath, newSystemPath, true) != 0 && C1File.Exists(newSystemPath))\r\n                {\r\n                    FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                    var consoleMessageService = serviceContainer.GetService<IManagementConsoleMessageService>();\r\n                    consoleMessageService.ShowMessage(\r\n                        DialogType.Error,\r\n                        GetString(\"EditXmlPageTemplateWorkflow.InvalidXmlTitle\"),\r\n                        GetString(\"EditXmlPageTemplateWorkflow.CannotRenameFileExists\").FormatWith(newSystemPath));\r\n                    return;\r\n                }\r\n\r\n                C1File.Move(systemPath, newSystemPath);\r\n\r\n                string newRelativePath = Path.Combine(Path.GetDirectoryName(pageTemplate.PageTemplateFilePath), fileName);\r\n                pageTemplate.PageTemplateFilePath = newRelativePath;\r\n            }\r\n\r\n            IPageTemplateFile templateFile = IFileServices.GetFile<IPageTemplateFile>(pageTemplate.PageTemplateFilePath);\r\n            templateFile.SetNewContent(pageTemplateMarkup);\r\n            DataFacade.Update(templateFile);\r\n\r\n            DataFacade.Update(pageTemplate);\r\n\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n            updateTreeRefresher.PostRefreshMesseges(pageTemplate.GetDataEntityToken());\r\n\r\n            SetSaveStatus(true);\r\n        }\r\n\r\n        private string GetTemplateFileName(IXmlPageTemplate xmlTemplateFile)\r\n        {\r\n            string name = PathUtil.CleanFileName(xmlTemplateFile.Title, true) ?? xmlTemplateFile.Id.ToString();\r\n            return name + \".xml\";\r\n        }\r\n\r\n        private static string GetString(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateElementProvider\", key);\r\n        }\r\n\r\n        private void ValidatePageTemplate(XDocument xDocument)\r\n        {\r\n            // check unique id's\r\n            List<XAttribute> valueOrderedIdAttributes = xDocument.Descendants().Attributes(\"id\").OrderBy(f => f.Value).ToList();\r\n\r\n            XElement rootElement = xDocument.Root;\r\n            if (rootElement.Name.LocalName.ToLowerInvariant() == \"html\")\r\n            {\r\n                if (rootElement.Name.Namespace != Namespaces.Xhtml)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"Root element 'html' must belong to the namespace '{0}'. Change the \\\"<html>\\\" tag to \\\"<html xmlns='{0}'>\\\"\", Namespaces.Xhtml));\r\n                }\r\n\r\n                if (rootElement.Name.LocalName != rootElement.Name.LocalName.ToLowerInvariant())\r\n                {\r\n                    throw new InvalidOperationException(\"Root element 'html' must be written in lower case.\");\r\n                }\r\n            }\r\n\r\n            for (int i = 0; i < valueOrderedIdAttributes.Count - 1; i++)\r\n            {\r\n                if (valueOrderedIdAttributes[i].Value == valueOrderedIdAttributes[i + 1].Value)\r\n                {\r\n                    throw new InvalidOperationException(string.Format(\"The id '{0}' is used on multiple elements ('{1}' and '{2}'). Element id values must be unique.\", valueOrderedIdAttributes[i].Value, valueOrderedIdAttributes[i].Parent.Name.LocalName, valueOrderedIdAttributes[i + 1].Parent.Name.LocalName));\r\n                }\r\n            }\r\n\r\n            foreach (XElement element in xDocument.Descendants().Where(f => f.Name.Namespace == Namespaces.AspNetControls))\r\n            {\r\n                switch (element.Name.LocalName)\r\n                {\r\n                    case \"form\":\r\n                    case \"placeholder\":\r\n                        break;\r\n                    default:\r\n                        throw new InvalidOperationException(string.Format(\"Unknown element '{0}' in namespace '{1}'.\", element.Name.LocalName, Namespaces.AspNetControls));\r\n                }\r\n            }\r\n\r\n            foreach (XElement element in xDocument.Descendants().Where(f => f.Name.Namespace == Namespaces.Rendering10))\r\n            {\r\n                switch (element.Name.LocalName)\r\n                {\r\n                    case \"page.title\":\r\n                    case \"page.description\":\r\n                    case \"page.metatag.description\":\r\n                    case \"placeholder\":\r\n                        break;\r\n                    default:\r\n                        throw new InvalidOperationException(string.Format(\"Unknown element '{0}' in namespace '{1}'.\", element.Name.LocalName, Namespaces.Rendering10));\r\n                }\r\n            }\r\n\r\n            if (1 < xDocument.Descendants(Namespaces.Rendering10 + \"placeholder\").Attributes(\"default\").Where(f => f.Value == \"true\").Count())\r\n            {\r\n                throw new InvalidOperationException(string.Format(\"Multiple '{0}' elements are set to be default. Only one element may be default.\", \"placeholder\"));\r\n            }\r\n\r\n            foreach (XElement element in xDocument.Descendants(Namespaces.Function10 + \"function\"))\r\n            {\r\n                FunctionFacade.BuildTree(element);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void IsTitleUsed(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            IXmlPageTemplate newPageTemplate = this.GetBinding<IXmlPageTemplate>(\"PageTemplate\");\r\n\r\n            if (this.GetBinding<string>(\"OldTitle\") == newPageTemplate.Title)\r\n            {\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = DataFacade.GetData<IXmlPageTemplate>().ToList()\r\n                .Any(f => string.Compare(f.Title, newPageTemplate.Title, StringComparison.InvariantCultureIgnoreCase) == 0 \r\n                     && f.Id != newPageTemplate.Id);\r\n        }\r\n\r\n\r\n\r\n        private void ShowMessageCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowFieldMessage(\"PageTemplate.Title\", GetString(\"EditXmlPageTemplateWorkflow.TitleInUseTitle\"));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/AddPageTemplateFeatureWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\nusing System.Xml.Linq;\r\n\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_PageTemplateFeatureElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddPageTemplateFeatureWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddPageTemplateFeatureWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(\"Name\", \"\");\r\n            this.Bindings.Add(\"EditorType\", \"html\");\r\n\r\n            var editorOptions = new Dictionary<string, string>\r\n            {\r\n                { \"html\", Texts.AddWorkflow_LabelTemplateFeatureEditorType_html },\r\n                { \"xml\", Texts.AddWorkflow_LabelTemplateFeatureEditorType_xml }\r\n            };\r\n\r\n            this.Bindings.Add(\"EditorTypeOptions\", editorOptions);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string name = this.GetBinding<string>(\"Name\");\r\n            string editorType = this.GetBinding<string>(\"EditorType\");\r\n\r\n            string filename = PageTemplateFeatureFacade.GetNewPageTemplateFeaturePath(name, editorType);\r\n\r\n            var template = new XhtmlDocument();\r\n            template.Head.Add(\"\");\r\n            template.Body.Add(new XElement(Namespaces.Xhtml + \"p\", \"\"));\r\n\r\n            C1File.WriteAllText(filename, template.ToString());\r\n\r\n            this.CloseCurrentView();\r\n            this.RefreshRootEntityToken();\r\n\r\n            this.ExecuteAction(PageTemplateFeatureEntityToken.BuildFeatureEntityToken(name),\r\n                new WorkflowActionToken(typeof(EditPageTemplateFeatureWorkflow)));\r\n        }\r\n\r\n\r\n\r\n        private void IfFeatureNameFree(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            string name = this.GetBinding<string>(\"Name\");\r\n\r\n            if (name.Length > 50)\r\n            {\r\n                e.Result = false;\r\n                this.ShowFieldMessage(\"Name\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"AddWorkflow.NameTooLong\"));\r\n                return;\r\n            }\r\n\r\n            if (!C1Directory.Exists(PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory)))\r\n            {\r\n                try\r\n                {\r\n                    C1Directory.CreateDirectory(PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory));\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    e.Result = false;\r\n                    this.ShowFieldMessage(\"Name\", string.Format(\"Can not create directory '{0}'\", GlobalSettingsFacade.PageTemplateFeaturesDirectory));\r\n                }\r\n            }\r\n\r\n            string xmlFilename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory), name + \".xml\");\r\n            string htmlFilename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.PageTemplateFeaturesDirectory), name + \".html\");\r\n\r\n            e.Result = !C1File.Exists(xmlFilename) && !C1File.Exists(htmlFilename);\r\n\r\n            if (!e.Result)\r\n            {\r\n                this.ShowFieldMessage(\"Name\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"AddWorkflow.NameInUse\"));\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                C1File.WriteAllText(xmlFilename, \"tmp\");\r\n                C1File.Delete(xmlFilename);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                e.Result = false;\r\n                this.ShowFieldMessage(\"Name\", StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTemplateFeatureElementProvider\", \"AddWorkflow.NameNotValidInFilename\"));\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/AddPageTemplateFeatureWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    partial class AddPageTemplateFeatureWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.selectIfElseActivity_TreeIdFree = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.selectTemplateEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectTemplateStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.getNameStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"getNameStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IfFeatureNameFree);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // selectIfElseActivity_TreeIdFree\r\n            // \r\n            this.selectIfElseActivity_TreeIdFree.Activities.Add(this.ifElseBranchActivity1);\r\n            this.selectIfElseActivity_TreeIdFree.Activities.Add(this.ifElseBranchActivity2);\r\n            this.selectIfElseActivity_TreeIdFree.Name = \"selectIfElseActivity_TreeIdFree\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"/Administrative/PageTemplateFeature/Add.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"getNameStateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // selectTemplateEventDrivenActivity_Finish\r\n            // \r\n            this.selectTemplateEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.selectTemplateEventDrivenActivity_Finish.Activities.Add(this.selectIfElseActivity_TreeIdFree);\r\n            this.selectTemplateEventDrivenActivity_Finish.Name = \"selectTemplateEventDrivenActivity_Finish\";\r\n            // \r\n            // selectTemplateStateInitializationActivity\r\n            // \r\n            this.selectTemplateStateInitializationActivity.Activities.Add(this.wizardFormActivity1);\r\n            this.selectTemplateStateInitializationActivity.Name = \"selectTemplateStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // getNameStateActivity\r\n            // \r\n            this.getNameStateActivity.Activities.Add(this.selectTemplateStateInitializationActivity);\r\n            this.getNameStateActivity.Activities.Add(this.selectTemplateEventDrivenActivity_Finish);\r\n            this.getNameStateActivity.Name = \"getNameStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddPageTemplateFeatureWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.getNameStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddPageTemplateFeatureWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private StateActivity getNameStateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private StateInitializationActivity selectTemplateStateInitializationActivity;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity selectTemplateEventDrivenActivity_Finish;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity selectIfElseActivity_TreeIdFree;\r\n\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/AddPageTemplateFeatureWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1135, 649\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"AddPageTemplateFeatureWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddPageTemplateFeatureWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddPageTemplateFeatureWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"931\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"931\" Y=\"179\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"getNameStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"getNameStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"352\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"352\" Y=\"214\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"getNameStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"getNameStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"selectTemplateEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"484\" Y=\"284\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"284\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"323\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"729\" Y=\"367\" />\r\n\t\t\t\t<ns0:Point X=\"745\" Y=\"367\" />\r\n\t\t\t\t<ns0:Point X=\"745\" Y=\"171\" />\r\n\t\t\t\t<ns0:Point X=\"931\" Y=\"171\" />\r\n\t\t\t\t<ns0:Point X=\"931\" Y=\"179\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 209\" Location=\"38, 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"48, 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 62\" Location=\"48, 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"227, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 106\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150, 209\" Location=\"71, 139\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_Initialize\" Size=\"130, 44\" Location=\"81, 204\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 62\" Location=\"81, 267\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"851, 179\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"272, 100\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"216, 214\" Name=\"getNameStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"selectTemplateStateInitializationActivity\" Size=\"150, 128\" Location=\"399, 141\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130, 44\" Location=\"409, 206\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"selectTemplateEventDrivenActivity_Finish\" Size=\"381, 396\" Location=\"407, 154\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"532, 219\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"selectIfElseActivity_TreeIdFree\" Size=\"361, 249\" Location=\"417, 282\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150, 146\" Location=\"436, 356\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 62\" Location=\"446, 421\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150, 146\" Location=\"609, 356\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 62\" Location=\"619, 421\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"220, 80\" AutoSizeMargin=\"16, 24\" Location=\"513, 323\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 209\" Location=\"521, 356\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130, 44\" Location=\"531, 421\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 62\" Location=\"531, 484\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/DeletePageTemplateFeatureWorkflow.cs",
    "content": "using System;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeletePageTemplateFeatureWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeletePageTemplateFeatureWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            FileUtils.Delete(this.FilePath);\r\n\r\n            this.RefreshRootEntityToken();\r\n        }\r\n\r\n        private string FilePath\r\n        {\r\n            get\r\n            {\r\n                PageTemplateFeatureEntityToken castedEntityToken = (PageTemplateFeatureEntityToken)this.EntityToken;\r\n                return PageTemplateFeatureFacade.GetPageTemplateFeaturePath(castedEntityToken.FeatureName);\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/DeletePageTemplateFeatureWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    partial class DeletePageTemplateFeatureWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity2 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity2\r\n            // \r\n            this.confirmDialogFormActivity2.ContainerLabel = null;\r\n            this.confirmDialogFormActivity2.FormDefinitionFileName = \"/Administrative/PageTemplateFeature/Delete.xml\";\r\n            this.confirmDialogFormActivity2.Name = \"confirmDialogFormActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"confirmStateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // confirmEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.confirmEventDrivenActivity_Cancel.Name = \"confirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmEventDrivenActivity_Finish\r\n            // \r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.confirmEventDrivenActivity_Finish.Name = \"confirmEventDrivenActivity_Finish\";\r\n            // \r\n            // confirmStateInitializationActivity\r\n            // \r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmDialogFormActivity2);\r\n            this.confirmStateInitializationActivity.Name = \"confirmStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.confirmStateInitializationActivity);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeletePageTemplateFeatureWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeletePageTemplateFeatureWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity2;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity confirmEventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity confirmStateInitializationActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity confirmStateActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity confirmEventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/DeletePageTemplateFeatureWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1234, 649\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"DeletePageTemplateFeatureWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeletePageTemplateFeatureWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeletePageTemplateFeatureWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1111\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1111\" Y=\"129\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"364\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"364\" Y=\"241\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"474\" Y=\"311\" />\r\n\t\t\t\t<ns0:Point X=\"525\" Y=\"311\" />\r\n\t\t\t\t<ns0:Point X=\"525\" Y=\"413\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"479\" Y=\"337\" />\r\n\t\t\t\t<ns0:Point X=\"495\" Y=\"337\" />\r\n\t\t\t\t<ns0:Point X=\"495\" Y=\"121\" />\r\n\t\t\t\t<ns0:Point X=\"1111\" Y=\"121\" />\r\n\t\t\t\t<ns0:Point X=\"1111\" Y=\"129\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"631\" Y=\"457\" />\r\n\t\t\t\t<ns0:Point X=\"647\" Y=\"457\" />\r\n\t\t\t\t<ns0:Point X=\"647\" Y=\"121\" />\r\n\t\t\t\t<ns0:Point X=\"1111\" Y=\"121\" />\r\n\t\t\t\t<ns0:Point X=\"1111\" Y=\"129\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 209\" Location=\"38, 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"48, 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 62\" Location=\"48, 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"227, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 106\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150, 146\" Location=\"71, 139\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 62\" Location=\"81, 204\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"1031, 129\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"237, 126\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"246, 241\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"confirmStateInitializationActivity\" Size=\"150, 128\" Location=\"572, 154\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity2\" Size=\"130, 44\" Location=\"582, 219\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Finish\" Size=\"150, 209\" Location=\"564, 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"574, 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 62\" Location=\"574, 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Cancel\" Size=\"150, 209\" Location=\"564, 193\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130, 44\" Location=\"574, 258\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 62\" Location=\"574, 321\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"220, 80\" AutoSizeMargin=\"16, 24\" Location=\"415, 413\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 209\" Location=\"423, 446\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130, 44\" Location=\"433, 511\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 62\" Location=\"433, 574\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/EditPageTemplateFeatureWorkflow.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\nusing Composite.Core.Xml;\r\n\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditPageTemplateFeatureWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditPageTemplateFeatureWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string markup;\r\n\r\n            if (C1File.Exists(this.FilePath))\r\n            {\r\n                markup = C1File.ReadAllText(this.FilePath);\r\n            }\r\n            else\r\n            {\r\n                // someone deleted the feature file, but that won't stop us!\r\n                XhtmlDocument template = new XhtmlDocument();\r\n                template.Head.Add(\"\");\r\n                template.Body.Add(\"\");\r\n                markup = template.ToString();\r\n            }\r\n\r\n            this.Bindings.Add(\"FeatureName\", this.FeatureName);\r\n            this.Bindings.Add(\"Markup\", markup);\r\n\r\n            if (Path.GetExtension(this.FilePath)==\".html\")\r\n            {\r\n                this.documentFormActivity1.FormDefinitionFileName = @\"\\Administrative\\PageTemplateFeature\\EditVisual.xml\";\r\n            }\r\n            else\r\n            {\r\n                this.documentFormActivity1.FormDefinitionFileName = @\"\\Administrative\\PageTemplateFeature\\EditMarkup.xml\";\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void saveStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string content = this.GetBinding<string>(\"Markup\");\r\n\r\n            FileUtils.RemoveReadOnly(this.FilePath);\r\n\r\n            C1File.WriteAllText(this.FilePath, content);\r\n\r\n            this.SetSaveStatus(true);\r\n        }\r\n\r\n\r\n        private string FeatureName\r\n        {\r\n            get\r\n            {\r\n                PageTemplateFeatureEntityToken castedEntityToken = (PageTemplateFeatureEntityToken)this.EntityToken;\r\n                return castedEntityToken.FeatureName;\r\n            }\r\n        }\r\n\r\n\r\n        private string FilePath\r\n        {\r\n            get\r\n            {\r\n                PageTemplateFeatureEntityToken castedEntityToken = (PageTemplateFeatureEntityToken)this.EntityToken;\r\n                return PageTemplateFeatureFacade.GetPageTemplateFeaturePath(castedEntityToken.FeatureName);\r\n            }\r\n        }\r\n\r\n\r\n        private void IsMarkupValid(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            PageTemplateFeatureEntityToken castedEntityToken = (PageTemplateFeatureEntityToken)this.EntityToken;\r\n\r\n            string content = this.GetBinding<string>(\"Markup\");\r\n            \r\n            this.UpdateBinding(\"Errors\", \"\");\r\n\r\n            XhtmlDocument document = null;\r\n            try\r\n            {\r\n                document = XhtmlDocument.Parse(content);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                this.UpdateBinding(\"Errors\", ex.Message);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n\r\n        private void editCodeActivity_ShowErrorMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            \r\n            this.ShowMessage(DialogType.Error, \"Error\", this.GetBinding<string>(\"Errors\")); \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/EditPageTemplateFeatureWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    partial class EditPageTemplateFeatureWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editCodeActivity_ShowErrorMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.editIfElseActivity_IsValidMarkup = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // editCodeActivity_ShowErrorMessage\r\n            // \r\n            this.editCodeActivity_ShowErrorMessage.Name = \"editCodeActivity_ShowErrorMessage\";\r\n            this.editCodeActivity_ShowErrorMessage.ExecuteCode += new System.EventHandler(this.editCodeActivity_ShowErrorMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.editCodeActivity_ShowErrorMessage);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity4);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsMarkupValid);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveStateCodeActivity\r\n            // \r\n            this.saveStateCodeActivity.Name = \"saveStateCodeActivity\";\r\n            this.saveStateCodeActivity.ExecuteCode += new System.EventHandler(this.saveStateCodeActivity_ExecuteCode);\r\n            // \r\n            // editIfElseActivity_IsValidMarkup\r\n            // \r\n            this.editIfElseActivity_IsValidMarkup.Activities.Add(this.ifElseBranchActivity1);\r\n            this.editIfElseActivity_IsValidMarkup.Activities.Add(this.ifElseBranchActivity2);\r\n            this.editIfElseActivity_IsValidMarkup.Name = \"editIfElseActivity_IsValidMarkup\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\PageTemplateFeature\\\\EditMarkup.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveStateCodeActivity);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.editIfElseActivity_IsValidMarkup);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditTreeDefinitionWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditTreeDefinitionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateActivity editStateActivity;\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n        private StateActivity saveStateActivity;\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private CodeActivity saveStateCodeActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity editIfElseActivity_IsValidMarkup;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity editCodeActivity_ShowErrorMessage;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/EditTreeDefinitionWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1164; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditTreeDefinitionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"208; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"240; 340\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 122\" Location=\"413; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130; 41\" Location=\"423; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Save\" Size=\"381; 423\" Location=\"421; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"546; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"editIfElseActivity_IsValidMarkup\" Size=\"361; 282\" Location=\"431; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 182\" Location=\"450; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"460; 433\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 182\" Location=\"623; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"editCodeActivity_ShowErrorMessage\" Size=\"130; 41\" Location=\"633; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"633; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"199; 80\" AutoSizeMargin=\"16; 24\" Location=\"535; 561\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 182\" Location=\"543; 592\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveStateCodeActivity\" Size=\"130; 41\" Location=\"553; 654\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"553; 714\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditTreeDefinitionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditTreeDefinitionWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"340\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"429\" Y=\"405\" />\r\n\t\t\t\t<ns0:Point X=\"634\" Y=\"405\" />\r\n\t\t\t\t<ns0:Point X=\"634\" Y=\"561\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"724\" Y=\"602\" />\r\n\t\t\t\t<ns0:Point X=\"744\" Y=\"602\" />\r\n\t\t\t\t<ns0:Point X=\"744\" Y=\"332\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"332\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"340\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/TogglePageTemplateFeatureEditorWorkflow.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient.Renderings.Template;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class TogglePageTemplateFeatureEditorWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public TogglePageTemplateFeatureEditorWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string oldPath = this.FilePath;\r\n            if (oldPath != null && C1File.Exists(oldPath))\r\n            {\r\n                string newPath = Path.Combine(Path.GetDirectoryName(oldPath), Path.GetFileNameWithoutExtension(oldPath));\r\n\r\n                if (Path.GetExtension(oldPath) == \".html\")\r\n                {\r\n                    newPath += \".xml\";\r\n                }\r\n                else\r\n                {\r\n                    newPath += \".html\";\r\n                }\r\n\r\n                C1File.Move(oldPath, newPath);\r\n\r\n                this.RefreshRootEntityToken();\r\n            }\r\n        }\r\n\r\n\r\n        private string FilePath\r\n        {\r\n            get\r\n            {\r\n                PageTemplateFeatureEntityToken castedEntityToken = (PageTemplateFeatureEntityToken)this.EntityToken;\r\n                return PageTemplateFeatureFacade.GetPageTemplateFeaturePath(castedEntityToken.FeatureName);\r\n            }\r\n        }\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/TogglePageTemplateFeatureEditorWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTemplateFeatureElementProvider\r\n{\r\n    partial class TogglePageTemplateFeatureEditorWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeletePageTemplateFeatureWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeletePageTemplateFeatureWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTemplateFeatureElementProvider/TogglePageTemplateFeatureEditorWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1234, 649\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"DeletePageTemplateFeatureWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"TogglePageTemplateFeatureEditorWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeletePageTemplateFeatureWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1045\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1045\" Y=\"136\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"526\" Y=\"285\" />\r\n\t\t\t\t<ns0:Point X=\"542\" Y=\"285\" />\r\n\t\t\t\t<ns0:Point X=\"542\" Y=\"128\" />\r\n\t\t\t\t<ns0:Point X=\"1045\" Y=\"128\" />\r\n\t\t\t\t<ns0:Point X=\"1045\" Y=\"136\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"420\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"420\" Y=\"241\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 209\" Location=\"38, 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 44\" Location=\"48, 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 62\" Location=\"48, 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"227, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 106\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150, 146\" Location=\"71, 139\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 62\" Location=\"81, 204\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"965, 136\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"220, 80\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"310, 241\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150, 209\" Location=\"572, 154\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130, 44\" Location=\"582, 219\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 62\" Location=\"582, 282\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddNewPageTypeWorkflow.cs",
    "content": "using System;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewPageTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewPageTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageType pageType = DataFacade.BuildNew<IPageType>();\r\n            pageType.Id = Guid.NewGuid();\r\n            pageType.Available = true;\r\n            pageType.PresetMenuTitle = true;\r\n            pageType.HomepageRelation = nameof(PageTypeHomepageRelation.NoRestriction);\r\n            pageType.DefaultTemplateId = Guid.Empty;\r\n            pageType.DefaultChildPageType = Guid.Empty;\r\n\r\n            this.Bindings.Add(\"NewPageType\", pageType);\r\n        }\r\n\r\n\r\n\r\n        private void ValidateBindings(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_SavePageType_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageType pageType = this.GetBinding<IPageType>(\"NewPageType\");\r\n\r\n            pageType = DataFacade.AddNew<IPageType>(pageType);\r\n\r\n            this.RefreshCurrentEntityToken();\r\n\r\n            this.CloseCurrentView();\r\n            this.RefreshCurrentEntityToken();\r\n            this.ExecuteWorklow(pageType.GetDataEntityToken(), WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider.EditPageTypeWorkflow\"));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddNewPageTypeWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    partial class AddNewPageTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_SavePageType = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step1IfElseActivity_ValidateBindings = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateBindings);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_SavePageType\r\n            // \r\n            this.finalizeCodeActivity_SavePageType.Name = \"finalizeCodeActivity_SavePageType\";\r\n            this.finalizeCodeActivity_SavePageType.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_SavePageType_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // step1IfElseActivity_ValidateBindings\r\n            // \r\n            this.step1IfElseActivity_ValidateBindings.Activities.Add(this.ifElseBranchActivity1);\r\n            this.step1IfElseActivity_ValidateBindings.Activities.Add(this.ifElseBranchActivity2);\r\n            this.step1IfElseActivity_ValidateBindings.Name = \"step1IfElseActivity_ValidateBindings\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PageTypeAddPageType.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_SavePageType);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.step1IfElseActivity_ValidateBindings);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddNewPageTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewPageTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity finalizeCodeActivity_SavePageType;\r\n        private SetStateActivity setStateActivity2;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity step1WizardFormActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity step1IfElseActivity_ValidateBindings;\r\n        private SetStateActivity setStateActivity6;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddNewPageTypeWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1207; 986\" AutoSizeMargin=\"16; 24\" Location=\"30; 30\" Name=\"AddNewPageTypeWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" Location=\"260; 323\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"268; 354\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step1WizardFormActivity\" Size=\"130; 41\" Location=\"278; 416\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"381; 363\" Location=\"268; 378\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"393; 440\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"step1IfElseActivity_ValidateBindings\" Size=\"361; 222\" Location=\"278; 500\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"297; 571\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"307; 633\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"470; 571\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"480; 633\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"268; 402\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"278; 464\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"278; 524\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" Location=\"563; 534\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"571; 565\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_SavePageType\" Size=\"130; 41\" Location=\"581; 627\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"581; 687\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddNewPageTypeWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewPageTypeWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"467\" Y=\"412\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"412\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"463\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"665\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"665\" Y=\"534\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"764\" Y=\"575\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"575\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"365\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"365\" Y=\"323\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"463\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"477\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"477\" Y=\"315\" />\r\n\t\t\t\t<ns0:Point X=\"365\" Y=\"315\" />\r\n\t\t\t\t<ns0:Point X=\"365\" Y=\"323\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddPageTypeDefaultPageContentWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.C1Console.Workflow;\r\nusing RS = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddPageTypeDefaultPageContentWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddPageTypeDefaultPageContentWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeDefaultPageContent defaultPageContent = DataFacade.BuildNew<IPageTypeDefaultPageContent>();\r\n            defaultPageContent.Id = Guid.NewGuid();\r\n\r\n            this.Bindings.Add(\"DefaultPageContent\", defaultPageContent);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeDefaultPageContent defaultPageContent = this.GetBinding<IPageTypeDefaultPageContent>(\"DefaultPageContent\");\r\n\r\n            Dictionary<string, string> piggybag = PiggybagSerializer.Deserialize(this.ExtraPayload);\r\n\r\n            DataEntityToken dataEntityToken = piggybag.GetParentEntityTokens().FindDataEntityToken(typeof(IPageType));\r\n            IPageType parentPageType = (IPageType)dataEntityToken.Data;\r\n\r\n            var duplicate = DataFacade.GetData<IPageTypeDefaultPageContent>(f => f.PageTypeId == parentPageType.Id && f.PlaceHolderId == defaultPageContent.PlaceHolderId).FirstOrDefault();\r\n\r\n            if (duplicate == null)\r\n            {\r\n                defaultPageContent.PageTypeId = parentPageType.Id;\r\n                defaultPageContent.Content = \" \";\r\n\r\n                defaultPageContent = DataFacade.AddNew<IPageTypeDefaultPageContent>(defaultPageContent);\r\n            }\r\n            else\r\n            {\r\n                defaultPageContent = duplicate;\r\n            }\r\n\r\n            this.CloseCurrentView();\r\n            this.RefreshCurrentEntityToken();\r\n\r\n            if (!AnyTemplatesContainingPlaceholderId())\r\n            {\r\n                ShowMessage(C1Console.Events.DialogType.Message,\r\n                    string.Format(RS.GetString(\"Composite.Plugins.PageTypeElementProvider\", \"PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Title\"), defaultPageContent.PlaceHolderId),\r\n                    string.Format(RS.GetString(\"Composite.Plugins.PageTypeElementProvider\", \"PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Message\"), defaultPageContent.PlaceHolderId));\r\n            }\r\n\r\n            this.ExecuteWorklow(defaultPageContent.GetDataEntityToken(), WorkflowFacade.GetWorkflowType(\"Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider.EditPageTypeDefaultPageContentWorkflow\"));\r\n        }\r\n\r\n\r\n        private bool AnyTemplatesContainingPlaceholderId()\r\n        {\r\n            IPageTypeDefaultPageContent defaultPageContent = this.GetBinding<IPageTypeDefaultPageContent>(\"DefaultPageContent\");\r\n\r\n            foreach (var templateDescriptor in PageTemplateFacade.GetPageTemplates())\r\n            {\r\n                if(templateDescriptor.PlaceholderDescriptions\r\n                                     .Any(placholder => placholder.Id == defaultPageContent.PlaceHolderId))\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n\r\n            return false;\r\n        }        \r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddPageTypeDefaultPageContentWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    partial class AddPageTypeDefaultPageContentWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PageTypeAddPageTypeDefaultPageContent.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddPageTypeDefaultPageContentWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddPageTypeDefaultPageContentWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddPageTypeDefaultPageContentWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1207; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddPageTypeDefaultPageContentWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"235; 307\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity\" Size=\"150; 122\" Location=\"550; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step1WizardFormActivity\" Size=\"130; 41\" Location=\"560; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"558; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"568; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"568; 270\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"550; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"560; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"560; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"696; 607\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"704; 638\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"714; 700\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"714; 760\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddPageTypeDefaultPageContentWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddPageTypeDefaultPageContentWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"340\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"340\" Y=\"307\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"438\" Y=\"372\" />\r\n\t\t\t\t<ns0:Point X=\"798\" Y=\"372\" />\r\n\t\t\t\t<ns0:Point X=\"798\" Y=\"607\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"442\" Y=\"396\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"396\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"897\" Y=\"648\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"648\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddPageTypeMetaDataFieldWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddPageTypeMetaDataFieldWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddPageTypeMetaDataFieldWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = DataFacade.BuildNew<IPageTypeMetaDataTypeLink>();\r\n            pageTypeMetaDataTypeLink.Id = Guid.NewGuid();\r\n\r\n            Dictionary<string, string> piggybag = PiggybagSerializer.Deserialize(this.ExtraPayload);\r\n\r\n            DataEntityToken dataEntityToken = piggybag.GetParentEntityTokens().FindDataEntityToken(typeof(IPageType));\r\n            IPageType parentPageType = (IPageType)dataEntityToken.Data;\r\n\r\n            pageTypeMetaDataTypeLink.PageTypeId = parentPageType.Id;\r\n\r\n            this.Bindings.Add(\"CompositionDescriptionName\", \"\");\r\n            this.Bindings.Add(\"CompositionDescriptionLabel\", \"\");\r\n\r\n            this.Bindings.Add(\"NewMetaDataTypeLink\", pageTypeMetaDataTypeLink);\r\n\r\n            List<KeyValuePair<Guid, string>> metaDataTypeOptions =\r\n                PageMetaDataFacade.GetAllMetaDataTypes().\r\n                ToList(f => new KeyValuePair<Guid, string>(f.GetImmutableTypeId(), f.GetTypeTitle()));\r\n\r\n            this.Bindings.Add(\"MetaDataTypeOptions\", metaDataTypeOptions);\r\n\r\n            List<KeyValuePair<Guid, string>> metaDataContainerOptions = PageMetaDataFacade.GetAllMetaDataContainers();\r\n\r\n            this.Bindings.Add(\"MetaDataContainerOptions\", metaDataContainerOptions);\r\n            this.Bindings.Add(\"CompositionContainerId\", metaDataContainerOptions.First().Key);\r\n\r\n            this.BindingsValidationRules.Add(\"CompositionDescriptionName\", new List<ClientValidationRule> { new NotNullClientValidationRule(), new StringLengthClientValidationRule(1, 128) });\r\n            this.BindingsValidationRules.Add(\"CompositionDescriptionLabel\", new List<ClientValidationRule> { new NotNullClientValidationRule(), new StringLengthClientValidationRule(1, 256) });\r\n        }\r\n\r\n\r\n\r\n        private void PagesUsingPageTypeExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink metaDataTypeLink = this.GetBinding<IPageTypeMetaDataTypeLink>(\"NewMetaDataTypeLink\");\r\n\r\n            e.Result = DataFacade.GetData<IPage>().Where(f => f.PageTypeId == metaDataTypeLink.PageTypeId).Any();\r\n        }\r\n\r\n\r\n\r\n        private void ValidateMetaDataName(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetBinding<IPageTypeMetaDataTypeLink>(\"NewMetaDataTypeLink\");\r\n            string metaDataDefinitionName = this.GetBinding<string>(\"CompositionDescriptionName\");\r\n            string metaDataDefinitionLabel = this.GetBinding<string>(\"CompositionDescriptionLabel\");\r\n\r\n            e.Result = PageMetaDataFacade.IsDefinitionAllowed(pageTypeMetaDataTypeLink.PageTypeId, metaDataDefinitionName, metaDataDefinitionLabel, pageTypeMetaDataTypeLink.DataTypeId);\r\n\r\n            if (e.Result == false)\r\n            {\r\n                ShowFieldMessage(\"CompositionDescriptionName\", \"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataFieldNameAlreadyUsed}\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void step2CodeActivity_ShowWizzard_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetBinding<IPageTypeMetaDataTypeLink>(\"NewMetaDataTypeLink\");\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(pageTypeMetaDataTypeLink.DataTypeId);\r\n            Type metaDataType = TypeManager.GetType(dataTypeDescriptor.TypeManagerTypeName);\r\n\r\n            DataTypeDescriptorFormsHelper helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor);\r\n            helper.LayoutLabel = StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTypeElementProvider\", \"PageType.AddPageTypeMetaDataFieldWorkflow.AddingDefaultMetaData.Title\");\r\n            helper.LayoutIconHandle = \"pagetype-add-metedatafield\";\r\n\r\n            GeneratedTypesHelper generatedTypesHelper = new GeneratedTypesHelper(dataTypeDescriptor);\r\n            helper.AddReadOnlyFields(generatedTypesHelper.NotEditableDataFieldDescriptorNames);\r\n\r\n            IData newDataTemplate = DataFacade.BuildNew(metaDataType);\r\n\r\n            helper.UpdateWithNewBindings(this.Bindings);\r\n            helper.ObjectToBindings(newDataTemplate, this.Bindings);\r\n            this.UpdateBinding(\"NewDataTemplate\", newDataTemplate);\r\n\r\n            this.DeliverFormData(\r\n                    metaDataType.GetTypeTitle(),\r\n                    StandardUiContainerTypes.Wizard,\r\n                    helper.GetForm(),\r\n                    this.Bindings,\r\n                    helper.GetBindingsValidationRules(newDataTemplate)\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetBinding<IPageTypeMetaDataTypeLink>(\"NewMetaDataTypeLink\");\r\n            IData newDataTemplate;\r\n            this.TryGetBinding(\"NewDataTemplate\", out newDataTemplate);\r\n\r\n            string metaDataDefinitionName = this.GetBinding<string>(\"CompositionDescriptionName\");\r\n            pageTypeMetaDataTypeLink.Name = metaDataDefinitionName;\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataFacade.AddNew<IPageTypeMetaDataTypeLink>(pageTypeMetaDataTypeLink);\r\n\r\n                PageMetaDataFacade.AddDefinition(\r\n                    pageTypeMetaDataTypeLink.PageTypeId,\r\n                    metaDataDefinitionName,\r\n                    this.GetBinding<string>(\"CompositionDescriptionLabel\"),\r\n                    pageTypeMetaDataTypeLink.DataTypeId,\r\n                    this.GetBinding<Guid>(\"CompositionContainerId\")\r\n                );\r\n\r\n\r\n                if (newDataTemplate != null)\r\n                {\r\n                    IPageType pageType = DataFacade.GetData<IPageType>().Single(f => f.Id == pageTypeMetaDataTypeLink.PageTypeId);\r\n\r\n                    PageMetaDataFacade.AddNewMetaDataToExistingPages(pageType, metaDataDefinitionName, newDataTemplate);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            this.RefreshCurrentEntityToken();\r\n        }\r\n\r\n        private void DefaultValuesAreValid(object sender, ConditionalEventArgs e)\r\n        {\r\n            IData newDataTemplate;\r\n\r\n            if (!this.TryGetBinding(\"NewDataTemplate\", out newDataTemplate))\r\n            {\r\n                e.Result = true;\r\n                return;\r\n            }\r\n            \r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetBinding<IPageTypeMetaDataTypeLink>(\"NewMetaDataTypeLink\");\r\n\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(pageTypeMetaDataTypeLink.DataTypeId);\r\n            var helper = new DataTypeDescriptorFormsHelper(dataTypeDescriptor);\r\n\r\n            e.Result = BindAndValidate(helper, newDataTemplate);\r\n        }\r\n    }\r\n}\r\n    "
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddPageTypeMetaDataFieldWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    partial class AddPageTypeMetaDataFieldWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity13 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.if_notValid1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.if_valid1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.if_notValid = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.if_valid = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.if_isNotValid = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.if_isValid = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifNotExist = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifExist = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity4 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.if_defaultValuesAreValid = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step2CodeActivity_ShowWizzard = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step1ifElseActivity_Finish_ValidateMetaDataName = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1WizardFormActivity_Finish = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.wizardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step1IfElseActivity_ValidateMetaDataName = new System.Workflow.Activities.IfElseActivity();\r\n            this.nextHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.NextHandleExternalEventActivity();\r\n            this.ifPagesUsingPageTypeExist = new System.Workflow.Activities.IfElseActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.step2EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2EventDrivenActivity_Finsih = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Finish_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish_Finsih = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity_Finish = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1StateInitializationActivity_Next = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Next_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Next_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.step2_EnterDefaultValues = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1_EnterMetaDataFieldName_NoDefaultValues = new System.Workflow.Activities.StateActivity();\r\n            this.step1_EnterMetaDataFieldName = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity13\r\n            // \r\n            this.setStateActivity13.Name = \"setStateActivity13\";\r\n            this.setStateActivity13.TargetStateName = \"step2_EnterDefaultValues\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"step1_EnterMetaDataFieldName_NoDefaultValues\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"step1_EnterMetaDataFieldName\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step2_EnterDefaultValues\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"step1_EnterMetaDataFieldName_NoDefaultValues\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"step1_EnterMetaDataFieldName\";\r\n            // \r\n            // if_notValid1\r\n            // \r\n            this.if_notValid1.Activities.Add(this.setStateActivity13);\r\n            this.if_notValid1.Name = \"if_notValid1\";\r\n            // \r\n            // if_valid1\r\n            // \r\n            this.if_valid1.Activities.Add(this.setStateActivity8);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.DefaultValuesAreValid);\r\n            this.if_valid1.Condition = codecondition1;\r\n            this.if_valid1.Name = \"if_valid1\";\r\n            // \r\n            // if_notValid\r\n            // \r\n            this.if_notValid.Activities.Add(this.setStateActivity11);\r\n            this.if_notValid.Name = \"if_notValid\";\r\n            // \r\n            // if_valid\r\n            // \r\n            this.if_valid.Activities.Add(this.setStateActivity4);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateMetaDataName);\r\n            this.if_valid.Condition = codecondition2;\r\n            this.if_valid.Name = \"if_valid\";\r\n            // \r\n            // if_isNotValid\r\n            // \r\n            this.if_isNotValid.Activities.Add(this.setStateActivity12);\r\n            this.if_isNotValid.Name = \"if_isNotValid\";\r\n            // \r\n            // if_isValid\r\n            // \r\n            this.if_isValid.Activities.Add(this.setStateActivity6);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateMetaDataName);\r\n            this.if_isValid.Condition = codecondition3;\r\n            this.if_isValid.Name = \"if_isValid\";\r\n            // \r\n            // ifNotExist\r\n            // \r\n            this.ifNotExist.Activities.Add(this.setStateActivity10);\r\n            this.ifNotExist.Name = \"ifNotExist\";\r\n            // \r\n            // ifExist\r\n            // \r\n            this.ifExist.Activities.Add(this.setStateActivity9);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.PagesUsingPageTypeExists);\r\n            this.ifExist.Condition = codecondition4;\r\n            this.ifExist.Name = \"ifExist\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity4\r\n            // \r\n            this.cancelHandleExternalEventActivity4.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity4.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity4.Name = \"cancelHandleExternalEventActivity4\";\r\n            // \r\n            // if_defaultValuesAreValid\r\n            // \r\n            this.if_defaultValuesAreValid.Activities.Add(this.if_valid1);\r\n            this.if_defaultValuesAreValid.Activities.Add(this.if_notValid1);\r\n            this.if_defaultValuesAreValid.Name = \"if_defaultValuesAreValid\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // step2CodeActivity_ShowWizzard\r\n            // \r\n            this.step2CodeActivity_ShowWizzard.Name = \"step2CodeActivity_ShowWizzard\";\r\n            this.step2CodeActivity_ShowWizzard.ExecuteCode += new System.EventHandler(this.step2CodeActivity_ShowWizzard_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // step1ifElseActivity_Finish_ValidateMetaDataName\r\n            // \r\n            this.step1ifElseActivity_Finish_ValidateMetaDataName.Activities.Add(this.if_valid);\r\n            this.step1ifElseActivity_Finish_ValidateMetaDataName.Activities.Add(this.if_notValid);\r\n            this.step1ifElseActivity_Finish_ValidateMetaDataName.Name = \"step1ifElseActivity_Finish_ValidateMetaDataName\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity_Finish\r\n            // \r\n            this.step1WizardFormActivity_Finish.ContainerLabel = null;\r\n            this.step1WizardFormActivity_Finish.FormDefinitionFileName = \"/Administrative/PageTypeAddPageTypeMetaDataFieldStep1.xml\";\r\n            this.step1WizardFormActivity_Finish.Name = \"step1WizardFormActivity_Finish\";\r\n            // \r\n            // wizardFormActivity1\r\n            // \r\n            this.wizardFormActivity1.ContainerLabel = null;\r\n            this.wizardFormActivity1.FormDefinitionFileName = \"/Administrative/PageTypeAddPageTypeMetaDataFieldStep1.xml\";\r\n            this.wizardFormActivity1.Name = \"wizardFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // step1IfElseActivity_ValidateMetaDataName\r\n            // \r\n            this.step1IfElseActivity_ValidateMetaDataName.Activities.Add(this.if_isValid);\r\n            this.step1IfElseActivity_ValidateMetaDataName.Activities.Add(this.if_isNotValid);\r\n            this.step1IfElseActivity_ValidateMetaDataName.Name = \"step1IfElseActivity_ValidateMetaDataName\";\r\n            // \r\n            // nextHandleExternalEventActivity1\r\n            // \r\n            this.nextHandleExternalEventActivity1.EventName = \"Next\";\r\n            this.nextHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.nextHandleExternalEventActivity1.Name = \"nextHandleExternalEventActivity1\";\r\n            // \r\n            // ifPagesUsingPageTypeExist\r\n            // \r\n            this.ifPagesUsingPageTypeExist.Activities.Add(this.ifExist);\r\n            this.ifPagesUsingPageTypeExist.Activities.Add(this.ifNotExist);\r\n            this.ifPagesUsingPageTypeExist.Name = \"ifPagesUsingPageTypeExist\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // step2EventDrivenActivity_Cancel\r\n            // \r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity4);\r\n            this.step2EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity7);\r\n            this.step2EventDrivenActivity_Cancel.Name = \"step2EventDrivenActivity_Cancel\";\r\n            // \r\n            // step2EventDrivenActivity_Finsih\r\n            // \r\n            this.step2EventDrivenActivity_Finsih.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.step2EventDrivenActivity_Finsih.Activities.Add(this.if_defaultValuesAreValid);\r\n            this.step2EventDrivenActivity_Finsih.Name = \"step2EventDrivenActivity_Finsih\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2CodeActivity_ShowWizzard);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Finish_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Finish_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step1EventDrivenActivity_Finish_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Finish_Cancel.Name = \"step1EventDrivenActivity_Finish_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish_Finsih\r\n            // \r\n            this.step1EventDrivenActivity_Finish_Finsih.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish_Finsih.Activities.Add(this.step1ifElseActivity_Finish_ValidateMetaDataName);\r\n            this.step1EventDrivenActivity_Finish_Finsih.Name = \"step1EventDrivenActivity_Finish_Finsih\";\r\n            // \r\n            // step1StateInitializationActivity_Finish\r\n            // \r\n            this.step1StateInitializationActivity_Finish.Activities.Add(this.step1WizardFormActivity_Finish);\r\n            this.step1StateInitializationActivity_Finish.Name = \"step1StateInitializationActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity_Next\r\n            // \r\n            this.step1StateInitializationActivity_Next.Activities.Add(this.wizardFormActivity1);\r\n            this.step1StateInitializationActivity_Next.Name = \"step1StateInitializationActivity_Next\";\r\n            // \r\n            // step1EventDrivenActivity_Next_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Next_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Next_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Next_Cancel.Name = \"step1EventDrivenActivity_Next_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Next_Next\r\n            // \r\n            this.step1EventDrivenActivity_Next_Next.Activities.Add(this.nextHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Next_Next.Activities.Add(this.step1IfElseActivity_ValidateMetaDataName);\r\n            this.step1EventDrivenActivity_Next_Next.Name = \"step1EventDrivenActivity_Next_Next\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifPagesUsingPageTypeExist);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // step2_EnterDefaultValues\r\n            // \r\n            this.step2_EnterDefaultValues.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2_EnterDefaultValues.Activities.Add(this.step2EventDrivenActivity_Finsih);\r\n            this.step2_EnterDefaultValues.Activities.Add(this.step2EventDrivenActivity_Cancel);\r\n            this.step2_EnterDefaultValues.Name = \"step2_EnterDefaultValues\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1_EnterMetaDataFieldName_NoDefaultValues\r\n            // \r\n            this.step1_EnterMetaDataFieldName_NoDefaultValues.Activities.Add(this.step1StateInitializationActivity_Finish);\r\n            this.step1_EnterMetaDataFieldName_NoDefaultValues.Activities.Add(this.step1EventDrivenActivity_Finish_Finsih);\r\n            this.step1_EnterMetaDataFieldName_NoDefaultValues.Activities.Add(this.step1EventDrivenActivity_Finish_Cancel);\r\n            this.step1_EnterMetaDataFieldName_NoDefaultValues.Name = \"step1_EnterMetaDataFieldName_NoDefaultValues\";\r\n            // \r\n            // step1_EnterMetaDataFieldName\r\n            // \r\n            this.step1_EnterMetaDataFieldName.Activities.Add(this.step1EventDrivenActivity_Next_Next);\r\n            this.step1_EnterMetaDataFieldName.Activities.Add(this.step1EventDrivenActivity_Next_Cancel);\r\n            this.step1_EnterMetaDataFieldName.Activities.Add(this.step1StateInitializationActivity_Next);\r\n            this.step1_EnterMetaDataFieldName.Name = \"step1_EnterMetaDataFieldName\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddPageTypeMetaDataFieldWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1_EnterMetaDataFieldName);\r\n            this.Activities.Add(this.step1_EnterMetaDataFieldName_NoDefaultValues);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.step2_EnterDefaultValues);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddPageTypeMetaDataFieldWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.NextHandleExternalEventActivity nextHandleExternalEventActivity1;\r\n\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Next_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Next_Next;\r\n\r\n        private StateActivity step1_EnterMetaDataFieldName;\r\n\r\n        private IfElseBranchActivity ifNotExist;\r\n\r\n        private IfElseBranchActivity ifExist;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity4;\r\n\r\n        private SetStateActivity setStateActivity8;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private IfElseActivity ifPagesUsingPageTypeExist;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Cancel;\r\n\r\n        private EventDrivenActivity step2EventDrivenActivity_Finsih;\r\n\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish_Cancel;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish_Finsih;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity_Finish;\r\n\r\n        private StateInitializationActivity step1StateInitializationActivity_Next;\r\n\r\n        private StateActivity step2_EnterDefaultValues;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1_EnterMetaDataFieldName_NoDefaultValues;\r\n\r\n        private SetStateActivity setStateActivity10;\r\n\r\n        private SetStateActivity setStateActivity9;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity_Finish;\r\n\r\n        private IfElseBranchActivity if_notValid;\r\n\r\n        private IfElseBranchActivity if_valid;\r\n\r\n        private IfElseActivity step1ifElseActivity_Finish_ValidateMetaDataName;\r\n\r\n        private SetStateActivity setStateActivity11;\r\n\r\n        private SetStateActivity setStateActivity12;\r\n\r\n        private IfElseBranchActivity if_isNotValid;\r\n\r\n        private IfElseBranchActivity if_isValid;\r\n\r\n        private IfElseActivity step1IfElseActivity_ValidateMetaDataName;\r\n\r\n        private C1Console.Workflow.Activities.WizardFormActivity wizardFormActivity1;\r\n\r\n        private CodeActivity step2CodeActivity_ShowWizzard;\r\n\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n\r\n        private SetStateActivity setStateActivity13;\r\n\r\n        private IfElseBranchActivity if_notValid1;\r\n\r\n        private IfElseBranchActivity if_valid1;\r\n\r\n        private IfElseActivity if_defaultValuesAreValid;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/AddPageTypeMetaDataFieldWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1146; 878\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"AddPageTypeMetaDataFieldWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"AddPageTypeMetaDataFieldWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddPageTypeMetaDataFieldWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"983\" Y=\"603\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"603\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1_EnterMetaDataFieldName\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1_EnterMetaDataFieldName\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"165\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"165\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"333\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"step1_EnterMetaDataFieldName\" TargetConnectionIndex=\"0\" SourceStateName=\"step1_EnterMetaDataFieldName\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Next_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"403\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"421\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"421\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceActivity=\"step2_EnterDefaultValues\" TargetConnectionIndex=\"0\" SourceStateName=\"step2_EnterDefaultValues\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Finsih\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"668\" Y=\"626\" />\r\n\t\t\t\t<ns0:Point X=\"688\" Y=\"626\" />\r\n\t\t\t\t<ns0:Point X=\"688\" Y=\"554\" />\r\n\t\t\t\t<ns0:Point X=\"884\" Y=\"554\" />\r\n\t\t\t\t<ns0:Point X=\"884\" Y=\"562\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceActivity=\"step2_EnterDefaultValues\" TargetConnectionIndex=\"0\" SourceStateName=\"step2_EnterDefaultValues\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step2EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"672\" Y=\"650\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"650\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step2_EnterDefaultValues\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1_EnterMetaDataFieldName\" TargetConnectionIndex=\"0\" SourceStateName=\"step1_EnterMetaDataFieldName\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Next_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step2_EnterDefaultValues\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"393\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"570\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"570\" Y=\"561\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1_EnterMetaDataFieldName\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity12\" SourceActivity=\"step1_EnterMetaDataFieldName\" TargetConnectionIndex=\"0\" SourceStateName=\"step1_EnterMetaDataFieldName\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Next_Next\" SourceConnectionIndex=\"1\" TargetStateName=\"step1_EnterMetaDataFieldName\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"393\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"416\" Y=\"398\" />\r\n\t\t\t\t<ns0:Point X=\"416\" Y=\"325\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"325\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"333\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"step1_EnterMetaDataFieldName_NoDefaultValues\" TargetConnectionIndex=\"0\" SourceStateName=\"step1_EnterMetaDataFieldName_NoDefaultValues\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish_Finsih\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"831\" Y=\"403\" />\r\n\t\t\t\t<ns0:Point X=\"884\" Y=\"403\" />\r\n\t\t\t\t<ns0:Point X=\"884\" Y=\"562\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"step1_EnterMetaDataFieldName_NoDefaultValues\" TargetConnectionIndex=\"0\" SourceStateName=\"step1_EnterMetaDataFieldName_NoDefaultValues\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"835\" Y=\"427\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"427\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1_EnterMetaDataFieldName_NoDefaultValues\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1_EnterMetaDataFieldName_NoDefaultValues\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"165\" />\r\n\t\t\t\t<ns0:Point X=\"733\" Y=\"165\" />\r\n\t\t\t\t<ns0:Point X=\"733\" Y=\"338\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1_EnterMetaDataFieldName_NoDefaultValues\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceActivity=\"step1_EnterMetaDataFieldName_NoDefaultValues\" TargetConnectionIndex=\"0\" SourceStateName=\"step1_EnterMetaDataFieldName_NoDefaultValues\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish_Finsih\" SourceConnectionIndex=\"1\" TargetStateName=\"step1_EnterMetaDataFieldName_NoDefaultValues\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"831\" Y=\"403\" />\r\n\t\t\t\t<ns0:Point X=\"885\" Y=\"403\" />\r\n\t\t\t\t<ns0:Point X=\"885\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"733\" Y=\"330\" />\r\n\t\t\t\t<ns0:Point X=\"733\" Y=\"338\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"65; 124\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 375\" Location=\"73; 155\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"198; 217\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifPagesUsingPageTypeExist\" Size=\"361; 234\" Location=\"83; 277\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifExist\" Size=\"150; 134\" Location=\"102; 348\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity9\" Size=\"130; 41\" Location=\"112; 416\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifNotExist\" Size=\"150; 134\" Location=\"275; 348\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity10\" Size=\"130; 53\" Location=\"285; 410\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"242; 102\" AutoSizeMargin=\"16; 24\" Location=\"167; 333\" Name=\"step1_EnterMetaDataFieldName\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Next_Next\" Size=\"381; 375\" Location=\"175; 388\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"nextHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"300; 450\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"step1IfElseActivity_ValidateMetaDataName\" Size=\"361; 234\" Location=\"185; 510\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"if_isValid\" Size=\"150; 134\" Location=\"204; 581\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"214; 649\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"if_isNotValid\" Size=\"150; 134\" Location=\"377; 581\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity12\" Size=\"130; 53\" Location=\"387; 643\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Next_Cancel\" Size=\"150; 182\" Location=\"175; 412\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"185; 474\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"185; 534\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity_Next\" Size=\"150; 122\" Location=\"175; 364\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizardFormActivity1\" Size=\"130; 41\" Location=\"185; 426\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"281; 102\" AutoSizeMargin=\"16; 24\" Location=\"593; 338\" Name=\"step1_EnterMetaDataFieldName_NoDefaultValues\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step1StateInitializationActivity_Finish\" Size=\"150; 122\" Location=\"601; 369\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"step1WizardFormActivity_Finish\" Size=\"130; 41\" Location=\"611; 431\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish_Finsih\" Size=\"381; 375\" Location=\"601; 393\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"726; 455\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"step1ifElseActivity_Finish_ValidateMetaDataName\" Size=\"361; 234\" Location=\"611; 515\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"if_valid\" Size=\"150; 134\" Location=\"630; 586\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"640; 654\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"if_notValid\" Size=\"150; 134\" Location=\"803; 586\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity11\" Size=\"130; 53\" Location=\"813; 648\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish_Cancel\" Size=\"150; 182\" Location=\"601; 417\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity3\" Size=\"130; 41\" Location=\"611; 479\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"611; 539\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"782; 562\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"790; 593\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"800; 655\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"800; 715\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"465; 561\" Name=\"step2_EnterDefaultValues\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"step2StateInitializationActivity\" Size=\"150; 122\" Location=\"381; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"step2CodeActivity_ShowWizzard\" Size=\"130; 41\" Location=\"391; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Finsih\" Size=\"381; 375\" Location=\"389; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"514; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"if_defaultValuesAreValid\" Size=\"361; 234\" Location=\"399; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"if_valid1\" Size=\"150; 134\" Location=\"418; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity8\" Size=\"130; 41\" Location=\"428; 409\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"if_notValid1\" Size=\"150; 134\" Location=\"591; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity13\" Size=\"130; 53\" Location=\"601; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step2EventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"381; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity4\" Size=\"130; 41\" Location=\"391; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"391; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/DeletePageTypeMetaDataFieldWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq.Expressions;\r\nusing System.Transactions;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeletePageTypeMetaDataFieldWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeletePageTypeMetaDataFieldWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetDataItemFromEntityToken<IPageTypeMetaDataTypeLink>();\r\n\r\n            this.Bindings.Add(\"MessageText\", string.Format(StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTypeElementProvider\", \"PageType.DeletePageTypeMetaDataFieldWorkflow.Confirm.Layout.Message\"), pageTypeMetaDataTypeLink.Name));\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetDataItemFromEntityToken<IPageTypeMetaDataTypeLink>();\r\n\r\n            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n            if (DynamicTypeManager.TryGetDataTypeDescriptor(pageTypeMetaDataTypeLink.DataTypeId, out dataTypeDescriptor))\r\n            {\r\n                PageMetaDataFacade.RemoveDefinition(pageTypeMetaDataTypeLink.PageTypeId, pageTypeMetaDataTypeLink.Name);\r\n            }\r\n\r\n            DataFacade.Delete<IPageTypeMetaDataTypeLink>(pageTypeMetaDataTypeLink);\r\n\r\n            deleteTreeRefresher.PostRefreshMesseges();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/DeletePageTypeMetaDataFieldWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    partial class DeletePageTypeMetaDataFieldWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/PageTypeDeletePageTypeMetaDataFieldConfirm.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"confirmStateActivity\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // confirmEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.confirmEventDrivenActivity_Cancel.Name = \"confirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmEventDrivenActivity_Finish\r\n            // \r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.confirmEventDrivenActivity_Finish.Name = \"confirmEventDrivenActivity_Finish\";\r\n            // \r\n            // confirmStateInitializationActivity\r\n            // \r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.confirmStateInitializationActivity.Name = \"confirmStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.confirmStateInitializationActivity);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeletePageTypeMetaDataFieldWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeletePageTypeMetaDataFieldWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity5;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity confirmEventDrivenActivity_Cancel;\r\n        private EventDrivenActivity confirmEventDrivenActivity_Finish;\r\n        private StateInitializationActivity confirmStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity confirmStateActivity;\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/DeletePageTypeMetaDataFieldWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1146; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"DeletePageTypeMetaDataFieldWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"221; 102\" AutoSizeMargin=\"16; 24\" Location=\"291; 323\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"confirmStateInitializationActivity\" Size=\"150; 122\" Location=\"299; 354\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130; 41\" Location=\"309; 416\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"299; 378\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"309; 440\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"309; 500\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"299; 402\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"309; 464\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"309; 524\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"590; 493\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"522; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"532; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"532; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeletePageTypeMetaDataFieldWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeletePageTypeMetaDataFieldWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"791\" Y=\"534\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"534\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"504\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"692\" Y=\"388\" />\r\n\t\t\t\t<ns0:Point X=\"692\" Y=\"493\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"401\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"401\" Y=\"323\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"508\" Y=\"412\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"412\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/DeletePageTypeWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Data;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Core.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeletePageTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeletePageTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void IsPageReferingPageType(object sender, ConditionalEventArgs e)\r\n        {            \r\n            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;\r\n\r\n            e.Result = DataFacade.GetData<IPage>().Where(f => f.PageTypeId == pageType.Id).Any();\r\n        }\r\n\r\n\r\n\r\n        private void confirmCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;\r\n\r\n            this.Bindings.Add(\"MessageText\", string.Format(StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTypeElementProvider\", \"PageType.DeletePageTypeWorkflow.Confirm.Layout.Messeage\"), pageType.Name));\r\n        }\r\n\r\n\r\n\r\n        private void showPageReferingCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;\r\n\r\n            this.Bindings.Add(\"MessageText\", string.Format(StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTypeElementProvider\", \"PageType.DeletePageTypeWorkflow.PagesRefering.Layout.Message\"), pageType.Name));\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;\r\n\r\n            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            IEnumerable<IPageTypeMetaDataTypeLink> pageTypeMetaDataTypeLinks = \r\n                DataFacade.GetData<IPageTypeMetaDataTypeLink>().\r\n                Where(f => f.PageTypeId == pageType.Id).\r\n                Evaluate();\r\n\r\n            foreach (IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink in pageTypeMetaDataTypeLinks)\r\n            {\r\n                PageMetaDataFacade.RemoveDefinition(pageType.Id, pageTypeMetaDataTypeLink.Name);\r\n            }\r\n\r\n            DataFacade.Delete<IPageType>(pageType);\r\n\r\n            deleteTreeRefresher.PostRefreshMesseges();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/DeletePageTypeWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    partial class DeletePageTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmConfirmDialogFormActivity = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.confirmCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.showPageReferingConfirmDialogFormActivity = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.showPageReferingCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.initializeIfElseActivity_IsPageReferingPageType = new System.Workflow.Activities.IfElseActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.showPageReferingEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.showPageReferingStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.showPageReferingStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"confirmStateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"showPageReferingStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsPageReferingPageType);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // confirmConfirmDialogFormActivity\r\n            // \r\n            this.confirmConfirmDialogFormActivity.ContainerLabel = null;\r\n            this.confirmConfirmDialogFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PageTypeDeletePageTypeConfirm.xml\";\r\n            this.confirmConfirmDialogFormActivity.Name = \"confirmConfirmDialogFormActivity\";\r\n            // \r\n            // confirmCodeActivity_Initialize\r\n            // \r\n            this.confirmCodeActivity_Initialize.Name = \"confirmCodeActivity_Initialize\";\r\n            this.confirmCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.confirmCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // showPageReferingConfirmDialogFormActivity\r\n            // \r\n            this.showPageReferingConfirmDialogFormActivity.ContainerLabel = null;\r\n            this.showPageReferingConfirmDialogFormActivity.FormDefinitionFileName = \"/Administrative/PageTypeDeletePageTypePagesRefering.xml\";\r\n            this.showPageReferingConfirmDialogFormActivity.Name = \"showPageReferingConfirmDialogFormActivity\";\r\n            // \r\n            // showPageReferingCodeActivity_Initialize\r\n            // \r\n            this.showPageReferingCodeActivity_Initialize.Name = \"showPageReferingCodeActivity_Initialize\";\r\n            this.showPageReferingCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.showPageReferingCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // initializeIfElseActivity_IsPageReferingPageType\r\n            // \r\n            this.initializeIfElseActivity_IsPageReferingPageType.Activities.Add(this.ifElseBranchActivity1);\r\n            this.initializeIfElseActivity_IsPageReferingPageType.Activities.Add(this.ifElseBranchActivity2);\r\n            this.initializeIfElseActivity_IsPageReferingPageType.Name = \"initializeIfElseActivity_IsPageReferingPageType\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity6);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // confirmEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.confirmEventDrivenActivity_Cancel.Name = \"confirmEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmEventDrivenActivity_Finish\r\n            // \r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.confirmEventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.confirmEventDrivenActivity_Finish.Name = \"confirmEventDrivenActivity_Finish\";\r\n            // \r\n            // confirmStateInitializationActivity\r\n            // \r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmCodeActivity_Initialize);\r\n            this.confirmStateInitializationActivity.Activities.Add(this.confirmConfirmDialogFormActivity);\r\n            this.confirmStateInitializationActivity.Name = \"confirmStateInitializationActivity\";\r\n            // \r\n            // showPageReferingEventDrivenActivity_Finish\r\n            // \r\n            this.showPageReferingEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.showPageReferingEventDrivenActivity_Finish.Activities.Add(this.setStateActivity7);\r\n            this.showPageReferingEventDrivenActivity_Finish.Name = \"showPageReferingEventDrivenActivity_Finish\";\r\n            // \r\n            // showPageReferingStateInitializationActivity\r\n            // \r\n            this.showPageReferingStateInitializationActivity.Activities.Add(this.showPageReferingCodeActivity_Initialize);\r\n            this.showPageReferingStateInitializationActivity.Activities.Add(this.showPageReferingConfirmDialogFormActivity);\r\n            this.showPageReferingStateInitializationActivity.Name = \"showPageReferingStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_IsPageReferingPageType);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.confirmStateInitializationActivity);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirmEventDrivenActivity_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // showPageReferingStateActivity\r\n            // \r\n            this.showPageReferingStateActivity.Activities.Add(this.showPageReferingStateInitializationActivity);\r\n            this.showPageReferingStateActivity.Activities.Add(this.showPageReferingEventDrivenActivity_Finish);\r\n            this.showPageReferingStateActivity.Name = \"showPageReferingStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeletePageTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.showPageReferingStateActivity);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeletePageTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity initializeIfElseActivity_IsPageReferingPageType;\r\n        private StateActivity confirmStateActivity;\r\n        private StateActivity showPageReferingStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity6;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity7;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity confirmEventDrivenActivity_Cancel;\r\n        private EventDrivenActivity confirmEventDrivenActivity_Finish;\r\n        private StateInitializationActivity confirmStateInitializationActivity;\r\n        private EventDrivenActivity showPageReferingEventDrivenActivity_Finish;\r\n        private StateInitializationActivity showPageReferingStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmConfirmDialogFormActivity;\r\n        private CodeActivity confirmCodeActivity_Initialize;\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity showPageReferingConfirmDialogFormActivity;\r\n        private CodeActivity showPageReferingCodeActivity_Initialize;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/DeletePageTypeWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1146; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"DeletePageTypeWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 303\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"initializeIfElseActivity_IsPageReferingPageType\" Size=\"361; 222\" Location=\"108; 231\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"127; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"137; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"300; 302\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"310; 364\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"272; 80\" AutoSizeMargin=\"16; 24\" Location=\"187; 383\" Name=\"showPageReferingStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"showPageReferingStateInitializationActivity\" Size=\"150; 182\" Location=\"195; 414\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"showPageReferingCodeActivity_Initialize\" Size=\"130; 41\" Location=\"205; 476\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"showPageReferingConfirmDialogFormActivity\" Size=\"130; 41\" Location=\"205; 536\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"showPageReferingEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"195; 438\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"205; 500\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 41\" Location=\"205; 560\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"221; 102\" AutoSizeMargin=\"16; 24\" Location=\"499; 382\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"confirmStateInitializationActivity\" Size=\"150; 182\" Location=\"507; 413\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"confirmCodeActivity_Initialize\" Size=\"130; 41\" Location=\"517; 475\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmConfirmDialogFormActivity\" Size=\"130; 41\" Location=\"517; 535\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Finish\" Size=\"150; 182\" Location=\"507; 437\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"517; 499\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"517; 559\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirmEventDrivenActivity_Cancel\" Size=\"150; 182\" Location=\"507; 461\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 41\" Location=\"517; 523\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"517; 583\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"205; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"796; 571\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"150; 182\" Location=\"522; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizeCodeActivity_Finalize\" Size=\"130; 41\" Location=\"532; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"532; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"DeletePageTypeWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeletePageTypeWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"showPageReferingStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"showPageReferingStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"323\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"323\" Y=\"383\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"confirmStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"confirmStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"609\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"609\" Y=\"382\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity7\" SourceActivity=\"showPageReferingStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"showPageReferingStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"showPageReferingEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"455\" Y=\"448\" />\r\n\t\t\t\t<ns0:Point X=\"471\" Y=\"448\" />\r\n\t\t\t\t<ns0:Point X=\"471\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"786\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"712\" Y=\"447\" />\r\n\t\t\t\t<ns0:Point X=\"898\" Y=\"447\" />\r\n\t\t\t\t<ns0:Point X=\"898\" Y=\"571\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirmEventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"716\" Y=\"471\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"471\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"997\" Y=\"612\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"612\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeDefaultPageContentWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditPageTypeDefaultPageContentWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditPageTypeDefaultPageContentWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            this.Bindings.Add(\"DefaultPageContent\", dataEntityToken.Data);\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeDefaultPageContent defaultPageContent = this.GetBinding<IPageTypeDefaultPageContent>(\"DefaultPageContent\");\r\n\r\n            DataFacade.Update(defaultPageContent);\r\n\r\n            this.SetSaveStatus(true);\r\n\r\n            this.CreateParentTreeRefresher().PostRefreshMesseges(this.EntityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeDefaultPageContentWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    partial class EditPageTypeDefaultPageContentWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity_Save\r\n            // \r\n            this.saveCodeActivity_Save.Name = \"saveCodeActivity_Save\";\r\n            this.saveCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saveCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\PageTypeEditPageTypeDefaultPageContent.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity_Save);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditPageTypeDefaultPageContentWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditPageTypeDefaultPageContentWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n        private CodeActivity saveCodeActivity_Save;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeDefaultPageContentWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1241; 878\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditPageTypeDefaultPageContentWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditPageTypeDefaultPageContentWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditPageTypeDefaultPageContentWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"313\" Y=\"182\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"182\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"385\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"517\" Y=\"455\" />\r\n\t\t\t\t<ns0:Point X=\"533\" Y=\"455\" />\r\n\t\t\t\t<ns0:Point X=\"533\" Y=\"374\" />\r\n\t\t\t\t<ns0:Point X=\"740\" Y=\"374\" />\r\n\t\t\t\t<ns0:Point X=\"740\" Y=\"382\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"839\" Y=\"426\" />\r\n\t\t\t\t<ns0:Point X=\"850\" Y=\"426\" />\r\n\t\t\t\t<ns0:Point X=\"850\" Y=\"377\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"377\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"385\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"227; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 209\" Location=\"98; 171\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 44\" Location=\"108; 236\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"108; 299\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"205; 84\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"316; 385\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 128\" Location=\"575; 154\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"documentFormActivity1\" Size=\"130; 44\" Location=\"585; 219\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Save\" Size=\"150; 209\" Location=\"567; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"577; 232\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"577; 295\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"206; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"637; 382\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 209\" Location=\"645; 415\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity_Save\" Size=\"130; 44\" Location=\"655; 480\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"655; 543\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeMetaDataFieldWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditPageTypeMetaDataFieldWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditPageTypeMetaDataFieldWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void ValidateTypeExistence(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = true;\r\n\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetDataItemFromEntityToken<IPageTypeMetaDataTypeLink>();\r\n\r\n            DataTypeDescriptor dataTypeDescriptor;\r\n            if (!DynamicTypeManager.TryGetDataTypeDescriptor(pageTypeMetaDataTypeLink.DataTypeId, out dataTypeDescriptor))\r\n            {\r\n                e.Result = false;\r\n\r\n                DeleteTreeRefresher deleteTreeRefresher = CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n                DataFacade.Delete<IPageTypeMetaDataTypeLink>(pageTypeMetaDataTypeLink);\r\n\r\n                this.ShowMessage(\r\n                    DialogType.Warning,\r\n                    GetText(\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataTypeNotExisting.Title\"),\r\n                    GetText(\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataTypeNotExisting.Message\"));\r\n\r\n                deleteTreeRefresher.PostRefreshMesseges();                \r\n            }            \r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetDataItemFromEntityToken<IPageTypeMetaDataTypeLink>();\r\n\r\n            IPageMetaDataDefinition pageMetaDataDefinition = PageMetaDataFacade.GetMetaDataDefinition(pageTypeMetaDataTypeLink.PageTypeId, pageTypeMetaDataTypeLink.Name);\r\n\r\n            //this.UpdateBinding(\"CompositionDescriptionName\", compositionDescription.Name);\r\n            this.UpdateBinding(\"CompositionDescriptionLabel\", pageMetaDataDefinition.Label);\r\n\r\n            List<KeyValuePair<Guid, string>> metaDataContainerOptions = PageMetaDataFacade.GetAllMetaDataContainers();\r\n\r\n            this.Bindings.Add(\"MetaDataContainerOptions\", metaDataContainerOptions);\r\n            this.Bindings.Add(\"CompositionContainerId\", pageMetaDataDefinition.MetaDataContainerId);\r\n\r\n            var dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(pageTypeMetaDataTypeLink.DataTypeId);\r\n\r\n            this.Bindings.Add(\"MetaTypeName\", dataTypeDescriptor.TypeManagerTypeName);\r\n        }\r\n\r\n\r\n        private void ValidateBindings(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetDataItemFromEntityToken<IPageTypeMetaDataTypeLink>();\r\n\r\n            IPageMetaDataDefinition pageMetaDataDefinition = PageMetaDataFacade.GetMetaDataDefinition(pageTypeMetaDataTypeLink.PageTypeId, pageTypeMetaDataTypeLink.Name);\r\n\r\n            string metaDataDescriptionLabel = this.GetBinding<string>(\"CompositionDescriptionLabel\");\r\n            Guid containerId = this.GetBinding<Guid>(\"CompositionContainerId\");\r\n\r\n            e.Result = true;\r\n\r\n            if (pageMetaDataDefinition.Label != metaDataDescriptionLabel)\r\n            {\r\n                if (PageMetaDataFacade.IsDefinitionAllowed(pageTypeMetaDataTypeLink.PageTypeId, pageMetaDataDefinition.Name, metaDataDescriptionLabel, pageMetaDataDefinition.MetaDataTypeId) == false)\r\n                {\r\n                    this.ShowFieldMessage(\"CompositionDescriptionLabel\", GetText(\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataFieldNameAlreadyUsed\"));\r\n                    SetSaveStatus(false);\r\n                    e.Result = false;\r\n                }\r\n            }\r\n\r\n            if (pageMetaDataDefinition.MetaDataContainerId != containerId)\r\n            {\r\n                if (PageMetaDataFacade.IsNewContainerIdAllowed(pageTypeMetaDataTypeLink.PageTypeId, pageMetaDataDefinition.Name, containerId) == false)\r\n                {\r\n                    this.ShowFieldMessage(\"CompositionContainerId\", GetText(\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataContainerChangeNotAllowed\"));\r\n                    SetSaveStatus(false);\r\n                    e.Result = false;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetDataItemFromEntityToken<IPageTypeMetaDataTypeLink>();\r\n            string metaDataDescriptionLabel = this.GetBinding<string>(\"CompositionDescriptionLabel\");\r\n            Guid containerId = this.GetBinding<Guid>(\"CompositionContainerId\");\r\n\r\n            PageMetaDataFacade.UpdateDefinition(pageTypeMetaDataTypeLink.PageTypeId, pageTypeMetaDataTypeLink.Name, metaDataDescriptionLabel, containerId);\r\n\r\n            SetSaveStatus(true);\r\n            this.RefreshCurrentEntityToken();\r\n        }\r\n\r\n        string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTypeElementProvider\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeMetaDataFieldWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    partial class EditPageTypeMetaDataFieldWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.editIfElseActivity_ValidateBindings = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.editDocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.initializeIfElseActivity_ValidateTypeExistence = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateBindings);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity4);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateTypeExistence);\r\n            this.ifElseBranchActivity3.Condition = codecondition2;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity_Save\r\n            // \r\n            this.saveCodeActivity_Save.Name = \"saveCodeActivity_Save\";\r\n            this.saveCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saveCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // editIfElseActivity_ValidateBindings\r\n            // \r\n            this.editIfElseActivity_ValidateBindings.Activities.Add(this.ifElseBranchActivity1);\r\n            this.editIfElseActivity_ValidateBindings.Activities.Add(this.ifElseBranchActivity2);\r\n            this.editIfElseActivity_ValidateBindings.Name = \"editIfElseActivity_ValidateBindings\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // editDocumentFormActivity\r\n            // \r\n            this.editDocumentFormActivity.ContainerLabel = null;\r\n            this.editDocumentFormActivity.CustomToolbarDefinitionFileName = null;\r\n            this.editDocumentFormActivity.FormDefinitionFileName = \"/Administrative/PageTypeEditPageTypeMetaDataField.xml\";\r\n            this.editDocumentFormActivity.Name = \"editDocumentFormActivity\";\r\n            // \r\n            // initializeIfElseActivity_ValidateTypeExistence\r\n            // \r\n            this.initializeIfElseActivity_ValidateTypeExistence.Activities.Add(this.ifElseBranchActivity3);\r\n            this.initializeIfElseActivity_ValidateTypeExistence.Activities.Add(this.ifElseBranchActivity4);\r\n            this.initializeIfElseActivity_ValidateTypeExistence.Name = \"initializeIfElseActivity_ValidateTypeExistence\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity_Save);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.editIfElseActivity_ValidateBindings);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.editDocumentFormActivity);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeIfElseActivity_ValidateTypeExistence);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditPageTypeMetaDataFieldWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditPageTypeMetaDataFieldWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private C1Console.Workflow.Activities.DocumentFormActivity editDocumentFormActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity editIfElseActivity_ValidateBindings;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private CodeActivity saveCodeActivity_Save;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n\r\n        private IfElseActivity initializeIfElseActivity_ValidateTypeExistence;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeMetaDataFieldWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1190; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditPageTypeMetaDataFieldWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"381; 363\" Location=\"434; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"initializeIfElseActivity_ValidateTypeExistence\" Size=\"361; 282\" Location=\"444; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 182\" Location=\"463; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"473; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"473; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 182\" Location=\"636; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"646; 373\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"202; 102\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"310; 397\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 122\" Location=\"318; 428\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"editDocumentFormActivity\" Size=\"130; 41\" Location=\"328; 490\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Save\" Size=\"381; 363\" Location=\"318; 452\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"443; 514\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"editIfElseActivity_ValidateBindings\" Size=\"361; 222\" Location=\"328; 574\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"347; 645\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"357; 707\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"520; 645\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 41\" Location=\"530; 707\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"193; 80\" AutoSizeMargin=\"16; 24\" Location=\"624; 400\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 182\" Location=\"632; 431\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity_Save\" Size=\"130; 41\" Location=\"642; 493\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"642; 553\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditPageTypeMetaDataFieldWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditPageTypeMetaDataFieldWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"397\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"499\" Y=\"462\" />\r\n\t\t\t\t<ns0:Point X=\"546\" Y=\"462\" />\r\n\t\t\t\t<ns0:Point X=\"546\" Y=\"392\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"392\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"400\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity6\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"499\" Y=\"462\" />\r\n\t\t\t\t<ns0:Point X=\"523\" Y=\"462\" />\r\n\t\t\t\t<ns0:Point X=\"523\" Y=\"389\" />\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"389\" />\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"397\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"813\" Y=\"441\" />\r\n\t\t\t\t<ns0:Point X=\"827\" Y=\"441\" />\r\n\t\t\t\t<ns0:Point X=\"827\" Y=\"321\" />\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"321\" />\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"397\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Transactions;\r\nusing Composite.C1Console.Trees;\r\nusing Composite.C1Console.Workflow;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_PageTypeElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditPageTypeWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditPageTypeWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void CleanDeadLinks(Guid pageTypeId)\r\n        {\r\n            DataFacade.GetData<IPageTypeMetaDataTypeLink>()\r\n                .Where(f => f.PageTypeId == pageTypeId)\r\n                .Evaluate()\r\n                .RemoveDeadLinks();\r\n\r\n            DataFacade.GetData<IPageTypeDataFolderTypeLink>()\r\n                .Where(f => f.PageTypeId == pageTypeId)\r\n                .Evaluate()\r\n                .RemoveDeadLinks();\r\n\r\n            DataFacade.GetData<IPageTypeTreeLink>()\r\n                .Where(f => f.PageTypeId == pageTypeId)\r\n                .Evaluate()\r\n                .RemoveDeadLinks();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_UpdateBindings_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;\r\n\r\n            CleanDeadLinks(pageType.Id);\r\n\r\n            this.Bindings.Add(\"PageType\", pageType);\r\n\r\n            List<KeyValuePair<Guid, string>> pageTypes =\r\n                DataFacade.GetData<IPageType>().\r\n                OrderBy(f => f.Name).\r\n                ToList(f => new KeyValuePair<Guid, string>(f.Id, f.Name));\r\n\r\n            var defaultPageTypeOptions = new List<KeyValuePair<Guid, string>>\r\n            {\r\n                new KeyValuePair<Guid, string>(Guid.Empty,\r\n                   Texts.PageType_EditPageTypeWorkflow_DefaultChildPageTypeKeySelector_NoneSelectedLabel)\r\n            };\r\n\r\n            defaultPageTypeOptions.AddRange(pageTypes);\r\n\r\n            this.Bindings.Add(\"DefaultChildPageTypeOptions\", defaultPageTypeOptions);\r\n\r\n\r\n            Func<PageTypeHomepageRelation, KeyValuePair<string, string> > getOption =\r\n                relation =>\r\n                    new KeyValuePair<string, string>(\r\n                        relation.ToString(),\r\n                        GetText($\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.{relation}Label\"));\r\n\r\n            this.Bindings.Add(\"HomepageRelationOptions\", new List<KeyValuePair<string, string>> {\r\n               getOption(PageTypeHomepageRelation.NoRestriction),\r\n               getOption(PageTypeHomepageRelation.OnlyHomePages),\r\n               getOption(PageTypeHomepageRelation.OnlySubPages),\r\n            });\r\n\r\n\r\n            List<KeyValuePair<Guid, string>> pageTemplates =\r\n                PageTemplateFacade.GetPageTemplates().\r\n                OrderBy(f => f.Title).\r\n                ToList(f => new KeyValuePair<Guid, string>(f.Id, f.Title));\r\n\r\n            var defaultPageTemplateOptions = new List<KeyValuePair<Guid, string>>\r\n            {\r\n                new KeyValuePair<Guid, string>(Guid.Empty,\r\n                    Texts.PageType_EditPageTypeWorkflow_DefaultPageTemplateKeySelector_NoneSelectedLabel)\r\n            };\r\n            defaultPageTemplateOptions.AddRange(pageTemplates);\r\n\r\n            this.Bindings.Add(\"DefaultTemplateOptions\", defaultPageTemplateOptions);\r\n\r\n\r\n            this.Bindings.Add(\"TemplateRestrictionOptions\", pageTemplates);\r\n\r\n\r\n            List<Guid> selectedPageTemplateIds =\r\n                DataFacade.GetData<IPageTypePageTemplateRestriction>().\r\n                Where(f => f.PageTypeId == pageType.Id).\r\n                Select(f => f.PageTemplateId).\r\n                ToList();\r\n\r\n            this.Bindings.Add(\"TemplateRestrictionSelected\", selectedPageTemplateIds);\r\n\r\n\r\n            List<KeyValuePair<Guid, string>> parentRestrictingPageTypes =\r\n                DataFacade.GetData<IPageType>().\r\n                OrderBy(f => f.Name).\r\n                ToList(f => new KeyValuePair<Guid, string>(f.Id, f.Name));\r\n\r\n            this.Bindings.Add(\"PageTypeChildRestrictionOptions\", parentRestrictingPageTypes);\r\n\r\n\r\n            List<Guid> selectedPageTypeParentRestrictions =\r\n                DataFacade.GetData<IPageTypeParentRestriction>().\r\n                Where(f => f.PageTypeId == pageType.Id).\r\n                Select(f => f.AllowedParentPageTypeId).\r\n                ToList();\r\n\r\n            this.Bindings.Add(\"PageTypeChildRestrictionSelected\", selectedPageTypeParentRestrictions);\r\n\r\n\r\n            List<KeyValuePair<Guid, string>> dataFolderTypes =\r\n                PageFolderFacade.GetAllFolderTypes().\r\n                OrderBy(f => f.FullName).\r\n                ToList(f => new KeyValuePair<Guid, string>(f.GetImmutableTypeId(), f.GetTypeTitle()));\r\n\r\n            this.Bindings.Add(\"DataFolderOptions\", dataFolderTypes);\r\n\r\n\r\n            List<Guid> selectedDataFolderTypes =\r\n                DataFacade.GetData<IPageTypeDataFolderTypeLink>().\r\n                Where(f => f.PageTypeId == pageType.Id).\r\n                Select(f => f.DataTypeId).\r\n                ToList();\r\n\r\n            this.Bindings.Add(\"DataFolderSelected\", selectedDataFolderTypes);\r\n\r\n\r\n            List<KeyValuePair<string, string>> applications =\r\n                TreeFacade.AllTrees.\r\n                Where(f => !string.IsNullOrEmpty(f.AllowedAttachmentApplicationName)).\r\n                OrderBy(f => f.TreeId).\r\n                ToList(f => new KeyValuePair<string, string>(f.TreeId, f.AllowedAttachmentApplicationName));\r\n\r\n            this.Bindings.Add(\"ApplicationOptions\", applications);\r\n\r\n\r\n            List<string> selectedApplications =\r\n                DataFacade.GetData<IPageTypeTreeLink>().\r\n                Where(f => f.PageTypeId == pageType.Id).\r\n                Select(f => f.TreeId).\r\n                ToList();\r\n\r\n            this.Bindings.Add(\"ApplicationSelected\", selectedApplications);\r\n        }\r\n\r\n\r\n\r\n        private void editCodeActivity_ValidateBindings(object sender, ConditionalEventArgs e)\r\n        {\r\n            IPageType pageType = (IPageType)((DataEntityToken)this.EntityToken).Data;\r\n            List<Guid> selectedPageTemplateIds = this.GetBinding<List<Guid>>(\"TemplateRestrictionSelected\");\r\n            List<Guid> selectedPageTypeParentRestrictions = this.GetBinding<List<Guid>>(\"PageTypeChildRestrictionSelected\");\r\n\r\n            if (pageType.DefaultTemplateId != Guid.Empty \r\n                && selectedPageTemplateIds.Count > 0 \r\n                && !selectedPageTemplateIds.Contains(pageType.DefaultTemplateId))\r\n            {\r\n                this.ShowFieldMessage(\"DefaultTemplateSelected\", Texts.PageType_EditPageTypeWorkflow_ValidationError_DefaultTemplateNotInRestrictions);\r\n                SetSaveStatus(false);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            if (pageType.HomepageRelation == nameof(PageTypeHomepageRelation.OnlyHomePages) \r\n                && selectedPageTypeParentRestrictions.Count > 0)\r\n            {\r\n                this.ShowFieldMessage(\"PageType.HomepageRelation\", Texts.PageType_EditPageTypeWorkflow_ValidationError_HomepageRelationConflictsWithParentRestrictions);\r\n                SetSaveStatus(false);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                var args = new ConditionalEventArgs();\r\n                editCodeActivity_ValidateBindings(this, args);\r\n                if (!args.Result) return;\r\n\r\n                IPageType pageType = this.GetBinding<IPageType>(\"PageType\");\r\n\r\n                UpdatePageTemplateResctrictions(pageType);\r\n                UpdatePageTypeParentResctrictions(pageType);\r\n                UpdatePageTypeDataFolderTypeLinks(pageType);\r\n                UpdatePageTypeTreeLinks(pageType);\r\n\r\n                DataFacade.Update(pageType);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            this.RefreshParentEntityToken();\r\n\r\n            SetSaveStatus(true);\r\n        }\r\n\r\n\r\n\r\n        private void UpdatePageTemplateResctrictions(IPageType pageType)\r\n        {\r\n            List<Guid> selectedPageTemplateIds = this.GetBinding<List<Guid>>(\"TemplateRestrictionSelected\");\r\n\r\n            var pageTypePageTemplateRestrictions = DataFacade.GetData<IPageTypePageTemplateRestriction>()\r\n                .Where(f => f.PageTypeId == pageType.Id).Evaluate();\r\n\r\n            // Remove deselected\r\n            foreach (IPageTypePageTemplateRestriction restriction in pageTypePageTemplateRestrictions)\r\n            {\r\n                if (!selectedPageTemplateIds.Contains(restriction.PageTemplateId))\r\n                {\r\n                    DataFacade.Delete(restriction);\r\n                }\r\n            }\r\n\r\n            // Add newly selected\r\n            foreach (Guid templateId in selectedPageTemplateIds)\r\n            {\r\n                if (!pageTypePageTemplateRestrictions.Any(f => f.PageTemplateId == templateId))\r\n                {\r\n                    var pageTypePageTemplateRestriction = DataFacade.BuildNew<IPageTypePageTemplateRestriction>();\r\n                    pageTypePageTemplateRestriction.Id = Guid.NewGuid();\r\n                    pageTypePageTemplateRestriction.PageTypeId = pageType.Id;\r\n                    pageTypePageTemplateRestriction.PageTemplateId = templateId;\r\n\r\n                    DataFacade.AddNew(pageTypePageTemplateRestriction);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void UpdatePageTypeParentResctrictions(IPageType pageType)\r\n        {\r\n            List<Guid> selectedPageTypeParentRestrictions = this.GetBinding<List<Guid>>(\"PageTypeChildRestrictionSelected\");\r\n\r\n            var pageTypeParentRestrictions = DataFacade.GetData<IPageTypeParentRestriction>()\r\n                .Where(f => f.PageTypeId == pageType.Id).Evaluate();\r\n\r\n            // Remove deselected\r\n            foreach (IPageTypeParentRestriction restriction in pageTypeParentRestrictions)\r\n            {\r\n                if (!selectedPageTypeParentRestrictions.Contains(restriction.AllowedParentPageTypeId))\r\n                {\r\n                    DataFacade.Delete(restriction);\r\n                }\r\n            }\r\n\r\n            // Add newly selected\r\n            foreach (Guid templateId in selectedPageTypeParentRestrictions)\r\n            {\r\n                if (!pageTypeParentRestrictions.Any(f => f.AllowedParentPageTypeId == templateId))\r\n                {\r\n                    var pageTypeParentRestriction = DataFacade.BuildNew<IPageTypeParentRestriction>();\r\n                    pageTypeParentRestriction.Id = Guid.NewGuid();\r\n                    pageTypeParentRestriction.PageTypeId = pageType.Id;\r\n                    pageTypeParentRestriction.AllowedParentPageTypeId = templateId;\r\n\r\n                    DataFacade.AddNew(pageTypeParentRestriction);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void UpdatePageTypeDataFolderTypeLinks(IPageType pageType)\r\n        {\r\n            List<Guid> selectedDataFolderTypeIds = this.GetBinding<List<Guid>>(\"DataFolderSelected\");\r\n\r\n            var pageTypeDateFolderTypeLinks = DataFacade.GetData<IPageTypeDataFolderTypeLink>()\r\n                .Where(f => f.PageTypeId == pageType.Id).Evaluate();\r\n\r\n            // Remove deselected\r\n            foreach (IPageTypeDataFolderTypeLink dataFolderTypeLink in pageTypeDateFolderTypeLinks)\r\n            {\r\n                if (!selectedDataFolderTypeIds.Contains(dataFolderTypeLink.DataTypeId))\r\n                {\r\n                    DataFacade.Delete(dataFolderTypeLink);\r\n                }\r\n            }\r\n\r\n            // Add newly selected\r\n            foreach (Guid dataFolderTypeId in selectedDataFolderTypeIds)\r\n            {\r\n                if (!pageTypeDateFolderTypeLinks.Any(f => f.DataTypeId == dataFolderTypeId))\r\n                {\r\n                    IPageTypeDataFolderTypeLink pageTypeDateFolderTypeLink = DataFacade.BuildNew<IPageTypeDataFolderTypeLink>();\r\n                    pageTypeDateFolderTypeLink.Id = Guid.NewGuid();\r\n                    pageTypeDateFolderTypeLink.PageTypeId = pageType.Id;\r\n                    pageTypeDateFolderTypeLink.DataTypeId = dataFolderTypeId;\r\n\r\n                    DataFacade.AddNew(pageTypeDateFolderTypeLink);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void UpdatePageTypeTreeLinks(IPageType pageType)\r\n        {\r\n            List<string> selectedTreeIds = this.GetBinding<List<string>>(\"ApplicationSelected\");\r\n\r\n            var pageTypeTreeLinks = DataFacade.GetData<IPageTypeTreeLink>()\r\n                .Where(f => f.PageTypeId == pageType.Id).Evaluate();\r\n\r\n            // Remove deselected\r\n            foreach (IPageTypeTreeLink treeLink in pageTypeTreeLinks)\r\n            {\r\n                if (!selectedTreeIds.Contains(treeLink.TreeId))\r\n                {\r\n                    DataFacade.Delete<IPageTypeTreeLink>(treeLink);\r\n                }\r\n            }\r\n\r\n            // Add newly selected\r\n            foreach (string treeId in selectedTreeIds)\r\n            {\r\n                if (!pageTypeTreeLinks.Any(f => f.TreeId == treeId))\r\n                {\r\n                    IPageTypeTreeLink pageTypeTreeLink = DataFacade.BuildNew<IPageTypeTreeLink>();\r\n                    pageTypeTreeLink.Id = Guid.NewGuid();\r\n                    pageTypeTreeLink.PageTypeId = pageType.Id;\r\n                    pageTypeTreeLink.TreeId = treeId;\r\n\r\n                    DataFacade.AddNew<IPageTypeTreeLink>(pageTypeTreeLink);\r\n                }\r\n            }\r\n        }\r\n\r\n        private static string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.PageTypeElementProvider\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.PageTypeElementProvider\r\n{\r\n    partial class EditPageTypeWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.editIfElseActivity_ValidateBindings = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.initializeDocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_UpdateBindings = new System.Workflow.Activities.CodeActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.editCodeActivity_ValidateBindings);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity_Save\r\n            // \r\n            this.saveCodeActivity_Save.Name = \"saveCodeActivity_Save\";\r\n            this.saveCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saveCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // editIfElseActivity_ValidateBindings\r\n            // \r\n            this.editIfElseActivity_ValidateBindings.Activities.Add(this.ifElseBranchActivity1);\r\n            this.editIfElseActivity_ValidateBindings.Activities.Add(this.ifElseBranchActivity2);\r\n            this.editIfElseActivity_ValidateBindings.Name = \"editIfElseActivity_ValidateBindings\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // initializeDocumentFormActivity\r\n            // \r\n            this.initializeDocumentFormActivity.ContainerLabel = null;\r\n            this.initializeDocumentFormActivity.CustomToolbarDefinitionFileName = null;\r\n            this.initializeDocumentFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\PageTypeEditPageType.xml\";\r\n            this.initializeDocumentFormActivity.Name = \"initializeDocumentFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity_UpdateBindings\r\n            // \r\n            this.initializeCodeActivity_UpdateBindings.Name = \"initializeCodeActivity_UpdateBindings\";\r\n            this.initializeCodeActivity_UpdateBindings.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_UpdateBindings_ExecuteCode);\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity_Save);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.editIfElseActivity_ValidateBindings);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.initializeDocumentFormActivity);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_UpdateBindings);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditPageTypeWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditPageTypeWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateActivity editStateActivity;\r\n        private C1Console.Workflow.Activities.DocumentFormActivity initializeDocumentFormActivity;\r\n        private CodeActivity initializeCodeActivity_UpdateBindings;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity editIfElseActivity_ValidateBindings;\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity5;\r\n        private CodeActivity saveCodeActivity_Save;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private StateActivity saveStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/PageTypeElementProvider/EditPageTypeWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1207; 986\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"EditPageTypeWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150; 182\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 41\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"210; 80\" AutoSizeMargin=\"16; 24\" Location=\"90; 138\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initializeStateInitializationActivity\" Size=\"150; 182\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity_UpdateBindings\" Size=\"130; 41\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 41\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175; 80\" AutoSizeMargin=\"16; 24\" Location=\"971; 798\" Name=\"finalStateActivity\" />\r\n\t\t<StateDesigner Size=\"193; 80\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"289; 317\" Name=\"editStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"editStateInitializationActivity\" Size=\"150; 122\" Location=\"435; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"initializeDocumentFormActivity\" Size=\"130; 41\" Location=\"445; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"editEventDrivenActivity_Save\" Size=\"381; 363\" Location=\"443; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"saveHandleExternalEventActivity1\" Size=\"130; 41\" Location=\"568; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"editIfElseActivity_ValidateBindings\" Size=\"361; 222\" Location=\"453; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 122\" Location=\"472; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 41\" Location=\"482; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 122\" Location=\"645; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 41\" Location=\"655; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"193; 80\" AutoSizeMargin=\"16; 24\" Location=\"568; 582\" Name=\"saveStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"saveStateInitializationActivity\" Size=\"150; 182\" Location=\"576; 613\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"saveCodeActivity_Save\" Size=\"130; 41\" Location=\"586; 675\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 41\" Location=\"586; 735\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" SetStateName=\"setStateActivity1\" SourceActivity=\"EditPageTypeWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"EditPageTypeWorkflow\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initializeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"385\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"385\" Y=\"317\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"saveStateActivity\" SetStateName=\"setStateActivity3\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"saveStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"478\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"664\" Y=\"382\" />\r\n\t\t\t\t<ns0:Point X=\"664\" Y=\"582\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity4\" SourceActivity=\"editStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"editStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"editEventDrivenActivity_Save\" SourceConnectionIndex=\"1\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"616\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"627\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"627\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"523\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"523\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"editStateActivity\" SetStateName=\"setStateActivity5\" SourceActivity=\"saveStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"saveStateActivity\" TargetConnectionEdge=\"Top\" SourceConnectionEdge=\"Right\" EventHandlerName=\"saveStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"editStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"757\" Y=\"623\" />\r\n\t\t\t\t<ns0:Point X=\"769\" Y=\"623\" />\r\n\t\t\t\t<ns0:Point X=\"769\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"385\" Y=\"309\" />\r\n\t\t\t\t<ns0:Point X=\"385\" Y=\"317\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/RazorFunctionProviderElementProvider/AddNewRazorFunctionWorkflow.Designer.cs",
    "content": "using System.Workflow.Activities;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider\r\n{\r\n    partial class AddNewRazorFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizecodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.validateStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.stateInitializationActivity4 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.validateStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsValidData);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizecodeActivity\r\n            // \r\n            this.finalizecodeActivity.Name = \"finalizecodeActivity\";\r\n            this.finalizecodeActivity.ExecuteCode += new System.EventHandler(this.finalizecodeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"validateStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dialogFormActivity1\r\n            // \r\n            this.dialogFormActivity1.ContainerLabel = \"Add new\";\r\n            this.dialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewRazorFunction.xml\";\r\n            this.dialogFormActivity1.Name = \"dialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // validateStateInitializationActivity\r\n            // \r\n            this.validateStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.validateStateInitializationActivity.Name = \"validateStateInitializationActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // stateInitializationActivity4\r\n            // \r\n            this.stateInitializationActivity4.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.stateInitializationActivity4.Activities.Add(this.finalizecodeActivity);\r\n            this.stateInitializationActivity4.Activities.Add(this.setStateActivity1);\r\n            this.stateInitializationActivity4.Name = \"stateInitializationActivity4\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity6);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.dialogFormActivity1);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.initializeCodeActivity);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // validateStateActivity\r\n            // \r\n            this.validateStateActivity.Activities.Add(this.validateStateInitializationActivity);\r\n            this.validateStateActivity.Name = \"validateStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity7);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.stateInitializationActivity4);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // AddNewRazorFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.validateStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewRazorFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private StateInitializationActivity stateInitializationActivity4;\r\n\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity dialogFormActivity1;\r\n\r\n        private CodeActivity finalizecodeActivity;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private StateInitializationActivity validateStateInitializationActivity;\r\n\r\n        private StateActivity validateStateActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/RazorFunctionProviderElementProvider/AddNewRazorFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Foundation.PluginFacades;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.RazorFunctionProvider;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewRazorFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        private static readonly string Binding_Name = \"Name\";\r\n        private static readonly string Binding_Namespace = \"Namespace\";\r\n        private static readonly string Binding_CopyFromFunctionName = \"CopyFromFunctionName\";\r\n        private static readonly string Binding_CopyFromOptions = \"CopyFromOptions\";\r\n\r\n        private static readonly string NewRazorFunction_CSHTML =\r\n@\"@inherits RazorFunction\r\n\r\n@functions {\r\n    public override string FunctionDescription\r\n    {\r\n        get  { return \"\"Shortly describe this function here\"\"; }\r\n    }\r\n     \r\n    [FunctionParameter(Label = \"\"Heading label here...\"\", Help = \"\"Help text here...\"\", DefaultValue = \"\"Default value here...\"\")]\r\n    public string Heading { get; set; }\r\n\r\n    [FunctionParameter(Label = \"\"Article label here...\"\", Help = \"\"Help text here...\"\")]\r\n    public XhtmlDocument Article { get; set; }\r\n\r\n    [FunctionParameter(Label = \"\"Image label here...\"\", Help = \"\"Help text here...\"\")]\r\n    public DataReference<IImageFile> Image { get; set; }\r\n}\r\n\r\n<html xmlns=\"\"http://www.w3.org/1999/xhtml\"\" xmlns:f=\"\"\" + Namespaces.Function10 + @\"\"\">\r\n    <head>\r\n    </head>\r\n    <body>\r\n        <h1>@Heading</h1>\r\n        <div>\r\n\t\t\t<img src=\"\"/media(@Image)\"\" style=\"\"float:right\"\" />\r\n            @Html.Raw(@Article)\r\n        </div>\r\n    </body>\r\n</html>\";\r\n\r\n\r\n        public AddNewRazorFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            BaseFunctionFolderElementEntityToken token = (BaseFunctionFolderElementEntityToken)this.EntityToken;\r\n            string @namespace = token.FunctionNamespace ?? UserSettings.LastSpecifiedNamespace;\r\n\r\n            this.Bindings.Add(Binding_Name, string.Empty);\r\n            this.Bindings.Add(Binding_Namespace, @namespace);\r\n\r\n            var functionProvider = GetFunctionProvider<RazorFunctionProvider>();\r\n            var copyOfOptions = new List<KeyValuePair<string, string>>();\r\n\r\n            copyOfOptions.Add(new KeyValuePair<string, string>(string.Empty, GetText(\"AddNewRazorFunction.LabelCopyFromEmptyOption\")));\r\n            foreach (string functionName in FunctionFacade.GetFunctionNamesByProvider(functionProvider.Name))\r\n            {\r\n                copyOfOptions.Add(new KeyValuePair<string, string>(functionName, functionName));\r\n            }\r\n\r\n            this.Bindings.Add(Binding_CopyFromFunctionName, string.Empty);\r\n            this.Bindings.Add(Binding_CopyFromOptions, copyOfOptions);\r\n        }\r\n\r\n        private void IsValidData(object sender, ConditionalEventArgs e)\r\n        {\r\n            string functionName = this.GetBinding<string>(Binding_Name);\r\n            string functionNamespace = this.GetBinding<string>(Binding_Namespace);\r\n            var provider = GetFunctionProvider<RazorFunctionProvider>();\r\n\r\n            e.Result = false;\r\n\r\n            if (functionName == string.Empty)\r\n            {\r\n                ShowFieldMessage(Binding_Name, GetText(\"AddNewRazorFunctionWorkflow.EmptyName\"));\r\n                return;\r\n            }\r\n\r\n            if (string.IsNullOrWhiteSpace(functionNamespace))\r\n            {\r\n                ShowFieldMessage(Binding_Namespace, GetText(\"AddNewRazorFunctionWorkflow.NamespaceEmpty\"));\r\n                return;\r\n            }\r\n\r\n            if (!functionNamespace.IsCorrectNamespace('.'))\r\n            {\r\n                ShowFieldMessage(Binding_Namespace, GetText(\"AddNewRazorFunctionWorkflow.InvalidNamespace\"));\r\n                return;\r\n            }\r\n\r\n            string functionFullName = functionNamespace + \".\" + functionName;\r\n\r\n            bool nameIsUsed = FunctionFacade.FunctionNames.Contains(functionFullName, StringComparer.OrdinalIgnoreCase);\r\n            if (nameIsUsed)\r\n            {\r\n                ShowFieldMessage(Binding_Namespace, GetText(\"AddNewRazorFunctionWorkflow.DuplicateName\"));\r\n                return;\r\n            }\r\n\r\n            if ((provider.PhysicalPath + functionNamespace + functionName).Length > 240)\r\n            {\r\n                ShowFieldMessage(Binding_Name, GetText(\"AddNewRazorFunctionWorkflow.TotalNameTooLang\"));\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void finalizecodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var provider = GetFunctionProvider<RazorFunctionProvider>();\r\n\r\n            string functionName = this.GetBinding<string>(Binding_Name);\r\n            string functionNamespace = ChangeNamespaceAccordingToExistingFolders(provider,this.GetBinding<string>(Binding_Namespace));\r\n            string functionFullName = functionNamespace + \".\" + functionName;\r\n\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            string fileName = functionName + \".cshtml\";\r\n            string folder = Path.Combine(provider.PhysicalPath, functionNamespace.Replace('.', '\\\\'));\r\n\r\n            string cshtmlFilePath = Path.Combine(folder, fileName);\r\n\r\n            string code;\r\n\r\n            string copyFromFunction = this.GetBinding<string>(Binding_CopyFromFunctionName);\r\n            if(string.IsNullOrEmpty(copyFromFunction))\r\n            {\r\n                code = NewRazorFunction_CSHTML;\r\n            }\r\n            else\r\n            {\r\n                code = GetFunctionCode(copyFromFunction);\r\n            }\r\n\r\n            C1Directory.CreateDirectory(folder);\r\n            C1File.WriteAllText(cshtmlFilePath, code);\r\n\r\n            UserSettings.LastSpecifiedNamespace = functionNamespace;\r\n\r\n            provider.ReloadFunctions();\r\n\r\n            var newFunctionEntityToken = new FileBasedFunctionEntityToken(provider.Name, functionFullName);\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(newFunctionEntityToken);\r\n\r\n            var container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            var executionService = container.GetService<IActionExecutionService>();\r\n            executionService.Execute(newFunctionEntityToken, new WorkflowActionToken(typeof(EditRazorFunctionWorkflow)), null);\r\n        }\r\n\r\n        private static string ChangeNamespaceAccordingToExistingFolders(RazorFunctionProvider provider, string nameSpace)\r\n        {\r\n            string folder = Path.Combine(provider.PhysicalPath, nameSpace.Replace('.', '\\\\'));\r\n            \r\n            if (Directory.Exists(folder))\r\n            {\r\n                return GetAlldirectoriesAndSubDirectories(provider.PhysicalPath)\r\n                    .Single(f=>f.Equals(folder,StringComparison.InvariantCultureIgnoreCase))\r\n                    .Replace(provider.PhysicalPath + \"\\\\\", \"\")\r\n                    .Replace('\\\\','.');\r\n            }\r\n\r\n            return nameSpace;\r\n        }\r\n\r\n        private static List<string> GetAlldirectoriesAndSubDirectories(string physicalPath)\r\n        {\r\n            var res = new List<string>();\r\n\r\n            foreach (var dir in Directory.GetDirectories(physicalPath))\r\n            {\r\n                res.Add(dir);\r\n                res.AddRange(GetAlldirectoriesAndSubDirectories(dir));\r\n            }\r\n\r\n            return res;\r\n        }\r\n\r\n        private string GetFunctionCode(string copyFromFunction)\r\n        {\r\n            IFunction function = FunctionFacade.GetFunction(copyFromFunction);\r\n\r\n            if (function is FunctionWrapper)\r\n            {\r\n                function = (function as FunctionWrapper).InnerFunction;\r\n            }\r\n\r\n            var razorFunction = (RazorBasedFunction) function;\r\n            string filePath = PathUtil.Resolve(razorFunction.VirtualPath);\r\n\r\n            return C1File.ReadAllText(filePath);\r\n        }\r\n\r\n        private static string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorFunction\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/RazorFunctionProviderElementProvider/AddNewRazorFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1011, 607\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"AddNewRazorFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceActivity=\"AddNewRazorFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewRazorFunctionWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"63\" />\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"63\" />\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"431\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity1\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"234\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"250\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"250\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"validateStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"validateStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"266\" Y=\"266\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"266\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"518\" />\r\n\t\t\t\t<ns0:Point X=\"167\" Y=\"518\" />\r\n\t\t\t\t<ns0:Point X=\"167\" Y=\"527\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"270\" Y=\"290\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"290\" />\r\n\t\t\t\t<ns0:Point X=\"286\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"431\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity4\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"234\" Y=\"376\" />\r\n\t\t\t\t<ns0:Point X=\"250\" Y=\"376\" />\r\n\t\t\t\t<ns0:Point X=\"250\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"431\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"validateStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"validateStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"268\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"150\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"150\" Y=\"335\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"validateStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"validateStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"268\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"192\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"192\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"175, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 105\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity1\" Size=\"150, 182\" Location=\"71, 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130, 41\" Location=\"81, 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"81, 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211, 118\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"63, 201\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity2\" Size=\"150, 122\" Location=\"460, 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"dialogFormActivity1\" Size=\"130, 41\" Location=\"470, 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150, 182\" Location=\"452, 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"462, 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 41\" Location=\"462, 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150, 182\" Location=\"452, 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130, 41\" Location=\"462, 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130, 41\" Location=\"462, 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 335\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity4\" Size=\"150, 242\" Location=\"71, 366\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130, 41\" Location=\"81, 428\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizecodeActivity\" Size=\"130, 41\" Location=\"81, 488\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"81, 548\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 431\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"209, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 527\" Name=\"validateStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"validateStateInitializationActivity\" Size=\"381, 303\" Location=\"71, 558\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361, 222\" Location=\"81, 620\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150, 122\" Location=\"100, 691\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"110, 753\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150, 122\" Location=\"273, 691\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"283, 753\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/RazorFunctionProviderElementProvider/DeleteRazorFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider\r\n{\r\n    partial class DeleteRazorFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.confirm_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirm_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.deleteStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.deleteStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"deleteStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteRazorFunctionConfirm.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // confirm_Cancel\r\n            // \r\n            this.confirm_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirm_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.confirm_Cancel.Name = \"confirm_Cancel\";\r\n            // \r\n            // confirm_Finish\r\n            // \r\n            this.confirm_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.confirm_Finish.Activities.Add(this.setStateActivity3);\r\n            this.confirm_Finish.Name = \"confirm_Finish\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // deleteStateInitializationActivity\r\n            // \r\n            this.deleteStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.deleteStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.deleteStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.deleteStateInitializationActivity.Name = \"deleteStateInitializationActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.confirmStateActivity.Activities.Add(this.confirm_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirm_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity2);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // deleteStateActivity\r\n            // \r\n            this.deleteStateActivity.Activities.Add(this.deleteStateInitializationActivity);\r\n            this.deleteStateActivity.Name = \"deleteStateActivity\";\r\n            // \r\n            // DeleteRazorFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.deleteStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"confirmStateActivity\";\r\n            this.Name = \"DeleteRazorFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity codeActivity1;\r\n\r\n        private StateInitializationActivity deleteStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n\r\n        private EventDrivenActivity confirm_Cancel;\r\n\r\n        private EventDrivenActivity confirm_Finish;\r\n\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n\r\n        private StateActivity confirmStateActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private StateActivity deleteStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/RazorFunctionProviderElementProvider/DeleteRazorFunctionWorkflow.cs",
    "content": "using System;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.Functions.FunctionProviders.RazorFunctionProvider;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteRazorFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        public DeleteRazorFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var functionEntityToken = (FileBasedFunctionEntityToken)EntityToken;\r\n\r\n            FileBasedFunctionProvider<RazorBasedFunction> provider;\r\n            FileBasedFunction<RazorBasedFunction> function;\r\n\r\n            GetProviderAndFunction(functionEntityToken, out provider, out function);\r\n\r\n            string cshtmlFilePath = PathUtil.Resolve(function.VirtualPath);\r\n\r\n            C1File.Delete(cshtmlFilePath);\r\n\r\n            DeleteEmptyAncestorFolders(cshtmlFilePath);\r\n\r\n            provider.ReloadFunctions();\r\n\r\n            RefreshFunctionTree();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/RazorFunctionProviderElementProvider/DeleteRazorFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1011, 537\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"DeleteRazorFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"DeleteRazorFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteRazorFunctionWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"93\" />\r\n\t\t\t\t<ns0:Point X=\"272\" Y=\"93\" />\r\n\t\t\t\t<ns0:Point X=\"272\" Y=\"192\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"192\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"deleteStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"deleteStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"deleteStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"276\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"276\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"deleteStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirm_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"deleteStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"180\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"275\" Y=\"362\" />\r\n\t\t\t\t<ns0:Point X=\"275\" Y=\"97\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"97\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"105\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirm_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"184\" Y=\"386\" />\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"386\" />\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"201, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 105\" Name=\"deleteStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"deleteStateInitializationActivity\" Size=\"150, 242\" Location=\"71, 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity1\" Size=\"130, 41\" Location=\"81, 198\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130, 41\" Location=\"81, 258\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"81, 318\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 201\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"175, 118\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"63, 297\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity1\" Size=\"150, 122\" Location=\"460, 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130, 41\" Location=\"470, 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirm_Finish\" Size=\"150, 182\" Location=\"452, 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130, 41\" Location=\"462, 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"462, 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirm_Cancel\" Size=\"150, 182\" Location=\"452, 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130, 41\" Location=\"462, 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"462, 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/RazorFunctionProviderElementProvider/EditRazorFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Reflection;\r\nusing System.Web.WebPages;\r\nusing Composite.AspNet.Razor;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.RazorFunctionProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditRazorFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        private static readonly string LogTitle = typeof(EditRazorFunctionWorkflow).Name;\r\n\r\n        public EditRazorFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private string GetFile(FileBasedFunction<RazorBasedFunction> function)\r\n        {\r\n            return PathUtil.Resolve(function.VirtualPath);\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            FileBasedFunctionProvider<RazorBasedFunction> provider;\r\n            FileBasedFunction<RazorBasedFunction> function;\r\n\r\n            GetProviderAndFunction((FileBasedFunctionEntityToken)this.EntityToken, out provider, out function);\r\n            \r\n            string title = Path.GetFileName(function.VirtualPath);\r\n\r\n            this.Bindings.Add(\"Title\", title);\r\n\r\n            string file = GetFile(function);\r\n\r\n            var websiteFile = new WebsiteFile(file);\r\n\r\n            this.Bindings.Add(\"FileContent\", websiteFile.ReadAllText());\r\n            this.Bindings.Add(\"FileName\", websiteFile.FileName);\r\n            this.Bindings.Add(\"FileMimeType\", websiteFile.MimeType);\r\n\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var functionEntityToken = (FileBasedFunctionEntityToken)this.EntityToken;\r\n\r\n            FileBasedFunctionProvider<RazorBasedFunction> provider;\r\n            FileBasedFunction<RazorBasedFunction> function;\r\n\r\n            GetProviderAndFunction(functionEntityToken, out provider, out function);\r\n\r\n            string file = GetFile(function);\r\n\r\n            string fileContent = this.GetBinding<string>(\"FileContent\");\r\n            string fixedFileContent = PageTemplateHelper.FixHtmlEscapeSequences(fileContent);\r\n\r\n            if (!CompileAndValidate(file, fixedFileContent))\r\n            {\r\n                SetSaveStatus(false);\r\n                return;\r\n            }\r\n\r\n            var websiteFile = new WebsiteFile(file);\r\n            websiteFile.WriteAllText(fixedFileContent);\r\n\r\n\r\n            provider.ReloadFunctions();\r\n\r\n            this.CreateParentTreeRefresher().PostRefreshMesseges(this.EntityToken);\r\n\r\n            SetSaveStatus(true);\r\n\r\n            if(fixedFileContent != fileContent)\r\n            {\r\n                UpdateBinding(\"FileContent\", fixedFileContent);\r\n                RerenderView();\r\n            }\r\n        }\r\n\r\n        private bool CompileAndValidate(string file, string fileContent)\r\n        {\r\n            string tempMarkupFile = GetTempFilePath(file);\r\n\r\n            try\r\n            {\r\n                File.WriteAllText(tempMarkupFile, fileContent);\r\n                string tempFileVirtualPath = \"~\" + PathUtil.GetWebsitePath(tempMarkupFile);\r\n\r\n                WebPageBase webPageBase;\r\n\r\n                try\r\n                {\r\n                    webPageBase = WebPage.CreateInstanceFromVirtualPath(tempFileVirtualPath);\r\n                }\r\n                catch(Exception ex)\r\n                {\r\n                    Log.LogWarning(LogTitle, \"Failed to compile CSHTML file\");\r\n                    Log.LogWarning(LogTitle, ex);\r\n\r\n                    Exception compilationException = (ex is TargetInvocationException) ? ex.InnerException : ex;\r\n\r\n                    // Replacing file path and temp file name from error message as it is irrelevant to the user\r\n                    string markupFileName = Path.GetFileName(file);\r\n                    string errorMessage = compilationException.Message;\r\n\r\n                    if (errorMessage.StartsWith(tempMarkupFile, StringComparison.OrdinalIgnoreCase))\r\n                    {\r\n                        errorMessage = markupFileName + errorMessage.Substring(tempMarkupFile.Length);\r\n                    }\r\n\r\n                    ShowWarning(GetText(\"EditRazorFunctionWorkflow.Validation.CompilationFailed\")\r\n                                .FormatWith(errorMessage));\r\n\r\n                    return false;\r\n                }\r\n\r\n                return Validate(webPageBase);\r\n            }\r\n            finally\r\n            {\r\n                // Deleting temporary file\r\n                File.Delete(tempMarkupFile);\r\n            }\r\n        }\r\n\r\n        private bool Validate(WebPageBase webPageBase)\r\n        {\r\n            var razorFunction = webPageBase as RazorFunction;\r\n            if (razorFunction == null)\r\n            {\r\n                ShowWarning(GetText(\"EditRazorFunctionWorkflow.Validation.IncorrectBaseClass\")\r\n                            .FormatWith(typeof(RazorFunction).FullName));\r\n                return false;\r\n            }\r\n\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n        private void ShowWarning(string warning)\r\n        {\r\n            this.ShowMessage(DialogType.Warning,\r\n                 GetText(\"EditRazorFunctionWorkflow.Validation.DialogTitle\"),\r\n                 warning);\r\n        }\r\n\r\n        private string GetText(string text)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.RazorFunction\", text);\r\n        }\r\n\r\n\r\n        private string GetTempFilePath(string filePath)\r\n        {\r\n            string fileName = Path.GetFileName(filePath);\r\n            string folderPath = Path.GetDirectoryName(filePath);\r\n\r\n            return Path.Combine(folderPath, \"_temp_\" + fileName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/RazorFunctionProviderElementProvider/EditRazorFunctionWorkflow.designer.cs",
    "content": "using System.Workflow.Activities;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.RazorFunctionProviderElementProvider\r\n{\r\n    partial class EditRazorFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditRazorFunction.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditMasterPageWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditMasterPageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private CodeActivity saveCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/AddNewSqlConnectionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    partial class AddNewSqlConnectionWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.finalizecodeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"/Administrative/AddNewSqlFunctionConnection.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // stateInitializationActivity\r\n            // \r\n            this.stateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.stateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.stateInitializationActivity.Name = \"stateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity4);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.stateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // AddNewSqlConnectionWorkflow\r\n            // \r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"AddNewSqlConnectionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateInitializationActivity stateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity initializeCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n        private CodeActivity codeActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private StateActivity initialStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/AddNewSqlConnectionWorkflow.cs",
    "content": "using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Security.Cryptography;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewSqlConnectionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewSqlConnectionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ISqlConnection sqlConnection = DataFacade.BuildNew<ISqlConnection>();\r\n\r\n            sqlConnection.Id = Guid.NewGuid();\r\n            sqlConnection.Name = \"New Sql Connection\";\r\n\r\n            this.Bindings.Add(\"NewSqlConnection\", sqlConnection);\r\n            this.Bindings.Add(\"ConnectionString\", \"\");\r\n        }\r\n\r\n\r\n\r\n        private void finalizecodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            ISqlConnection sqlConnection = this.GetBinding<ISqlConnection>(\"NewSqlConnection\");\r\n            string connection = this.GetBinding<string>(\"ConnectionString\");\r\n\r\n            sqlConnection.EncryptedConnectionString = connection.Encrypt();\r\n\r\n            sqlConnection = DataFacade.AddNew<ISqlConnection>(sqlConnection);\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(sqlConnection.GetDataEntityToken());\r\n        }\r\n    }\r\n}\r\n \r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/AddNewSqlConnectionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewSqlConnectionWorkflow\" Location=\"30; 30\" Size=\"1146; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"AddNewSqlConnectionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddNewSqlConnectionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"674\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"initialStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initialStateActivity\" EventHandlerName=\"stateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"228\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"336\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"336\" Y=\"281\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"434\" Y=\"346\" />\r\n\t\t\t\t<ns0:Point X=\"551\" Y=\"346\" />\r\n\t\t\t\t<ns0:Point X=\"551\" Y=\"468\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"438\" Y=\"370\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"370\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"674\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"650\" Y=\"509\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"509\" />\r\n\t\t\t\t<ns0:Point X=\"873\" Y=\"674\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialStateActivity\" Location=\"63; 105\" Size=\"169; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"stateInitializationActivity\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"231; 281\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"239; 312\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"249; 374\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"239; 336\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"249; 398\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"249; 458\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"239; 360\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"249; 422\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"249; 482\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"449; 468\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"528; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"538; 210\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity1\" Location=\"538; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"538; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"793; 674\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/AddNewSqlFunctionProviderWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    partial class AddNewSqlFunctionProviderWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1WizzardFormActivity = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.stateInitializationActivity3 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.addNewSqlXmlProviderWorkflowInitialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizzardFormActivity\r\n            // \r\n            this.step1WizzardFormActivity.ContainerLabel = null;\r\n            this.step1WizzardFormActivity.FormDefinitionFileName = \"/Administrative/AddNewSqlFunction.xml\";\r\n            this.step1WizzardFormActivity.Name = \"step1WizzardFormActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.initializeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // stateInitializationActivity3\r\n            // \r\n            this.stateInitializationActivity3.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.stateInitializationActivity3.Activities.Add(this.finalizeCodeActivity);\r\n            this.stateInitializationActivity3.Activities.Add(this.setStateActivity4);\r\n            this.stateInitializationActivity3.Name = \"stateInitializationActivity3\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizzardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.codeActivity1);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity1);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.stateInitializationActivity3);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // addNewSqlXmlProviderWorkflowInitialState\r\n            // \r\n            this.addNewSqlXmlProviderWorkflowInitialState.Activities.Add(this.stateInitializationActivity1);\r\n            this.addNewSqlXmlProviderWorkflowInitialState.Name = \"addNewSqlXmlProviderWorkflowInitialState\";\r\n            // \r\n            // AddNewSqlFunctionProviderWorkflow\r\n            // \r\n            this.Activities.Add(this.addNewSqlXmlProviderWorkflowInitialState);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"addNewSqlXmlProviderWorkflowInitialState\";\r\n            this.Name = \"AddNewSqlFunctionProviderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateInitializationActivity stateInitializationActivity3;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private CodeActivity codeActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity step1WizzardFormActivity;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private StateActivity addNewSqlXmlProviderWorkflowInitialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/AddNewSqlFunctionProviderWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewSqlFunctionProviderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewSqlFunctionProviderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string namespaceName;\r\n            ISqlConnection sqlConnection;\r\n\r\n            if ((this.EntityToken is DataEntityToken))\r\n            {\r\n                DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n                namespaceName = UserSettings.LastSpecifiedNamespace;\r\n                sqlConnection = (ISqlConnection)dataEntityToken.Data;\r\n            }\r\n            else if ((this.EntityToken is SqlFunctionProviderFolderEntityToken))\r\n            {\r\n                Guid connectionId = new Guid(((SqlFunctionProviderFolderEntityToken)this.EntityToken).ConnectionId);\r\n\r\n                namespaceName = this.EntityToken.Id;\r\n                sqlConnection = DataFacade.GetData<ISqlConnection>(x => x.Id == connectionId).First();                \r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n             \r\n\r\n            ISqlFunctionInfo sqlFunctionInfo = DataFacade.BuildNew<ISqlFunctionInfo>();\r\n            sqlFunctionInfo.IsQuery = true;\r\n            sqlFunctionInfo.ConnectionId = sqlConnection.Id;\r\n            sqlFunctionInfo.Id = Guid.NewGuid();\r\n            sqlFunctionInfo.Name = \"\";\r\n            sqlFunctionInfo.Namespace = namespaceName;\r\n            sqlFunctionInfo.Description = \"\";\r\n\r\n            this.Bindings.Add(\"NewSqlQueryInfo\", sqlFunctionInfo);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            ISqlFunctionInfo sqlFunctionInfo = this.GetBinding<ISqlFunctionInfo>(\"NewSqlQueryInfo\");\r\n\r\n            sqlFunctionInfo = DataFacade.AddNew<ISqlFunctionInfo>(sqlFunctionInfo);\r\n\r\n            UserSettings.LastSpecifiedNamespace = sqlFunctionInfo.Namespace;\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(sqlFunctionInfo.GetDataEntityToken());\r\n\r\n            this.ExecuteWorklow(sqlFunctionInfo.GetDataEntityToken(), typeof(EditSqlFunctionProviderWorkflow));\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/AddNewSqlFunctionProviderWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewSqlFunctionProviderWorkflow\" Location=\"30; 30\" Size=\"1146; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"AddNewSqlFunctionProviderWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddNewSqlFunctionProviderWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"875\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"875\" Y=\"627\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"addNewSqlXmlProviderWorkflowInitialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"addNewSqlXmlProviderWorkflowInitialState\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"234\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"344\" Y=\"322\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"442\" Y=\"387\" />\r\n\t\t\t\t<ns0:Point X=\"651\" Y=\"387\" />\r\n\t\t\t\t<ns0:Point X=\"651\" Y=\"457\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"446\" Y=\"411\" />\r\n\t\t\t\t<ns0:Point X=\"875\" Y=\"411\" />\r\n\t\t\t\t<ns0:Point X=\"875\" Y=\"627\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"stateInitializationActivity3\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"735\" Y=\"498\" />\r\n\t\t\t\t<ns0:Point X=\"875\" Y=\"498\" />\r\n\t\t\t\t<ns0:Point X=\"875\" Y=\"627\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"addNewSqlXmlProviderWorkflowInitialState\" Location=\"63; 105\" Size=\"248; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"stateInitializationActivity1\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity1\" Location=\"81; 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"81; 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"239; 322\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"247; 353\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizzardFormActivity\" Location=\"257; 415\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"247; 377\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"257; 439\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"257; 499\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"247; 401\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"257; 463\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"257; 523\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"564; 457\" Size=\"175; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"stateInitializationActivity3\" Location=\"528; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"538; 210\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"538; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"538; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"795; 627\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/DeleteSqlConnectionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    partial class DeleteSqlConnectionWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/SqlFunctionElementProviderDeleteSqlConnection.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initialStateActivity\r\n            // \r\n            this.initialStateActivity.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialStateActivity.Name = \"initialStateActivity\";\r\n            // \r\n            // DeleteSqlConnectionWorkflow\r\n            // \r\n            this.Activities.Add(this.initialStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialStateActivity\";\r\n            this.Name = \"DeleteSqlConnectionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private StateActivity initialStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/DeleteSqlConnectionWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Transactions;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteSqlConnectionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteSqlConnectionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n      \r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            ISqlConnection connection = (ISqlConnection)dataEntityToken.Data;\r\n\r\n            var queries = from item in DataFacade.GetData<ISqlFunctionInfo>()\r\n                          where item.ConnectionId == connection.Id\r\n                          select item;\r\n            using (TransactionScope transationScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataFacade.Delete(connection);\r\n                foreach (ISqlFunctionInfo query in queries)\r\n                {\r\n                    DataFacade.Delete(query);\r\n                }\r\n                transationScope.Complete();\r\n            }\r\n\r\n            deleteTreeRefresher.PostRefreshMesseges();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/DeleteSqlConnectionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteSqlConnectionWorkflow\" Location=\"30; 30\" Size=\"1149; 974\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteSqlConnectionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteSqlConnectionWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"910\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"910\" Y=\"668\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initialStateActivity\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"239\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"298\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"298\" Y=\"269\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"396\" Y=\"334\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"334\" />\r\n\t\t\t\t<ns0:Point X=\"623\" Y=\"451\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"400\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"910\" Y=\"358\" />\r\n\t\t\t\t<ns0:Point X=\"910\" Y=\"668\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"722\" Y=\"492\" />\r\n\t\t\t\t<ns0:Point X=\"910\" Y=\"492\" />\r\n\t\t\t\t<ns0:Point X=\"910\" Y=\"668\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialStateActivity\" Location=\"46; 101\" Size=\"197; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initialStateInitializationActivity\" Location=\"54; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"64; 194\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"830; 668\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"193; 269\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"201; 300\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"211; 362\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"201; 324\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"211; 386\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"211; 446\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"201; 348\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"211; 410\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"211; 470\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"521; 451\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"529; 482\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"539; 544\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"539; 604\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"539; 664\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/DeleteSqlFunctionProviderWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    partial class DeleteSqlFunctionProviderWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.DeleteSqlXmlProviderWorkflowInitialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/SqlFunctionElementProviderDeleteSqlFunction.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // DeleteSqlXmlProviderWorkflowInitialState\r\n            // \r\n            this.DeleteSqlXmlProviderWorkflowInitialState.Activities.Add(this.stateInitializationActivity1);\r\n            this.DeleteSqlXmlProviderWorkflowInitialState.Name = \"DeleteSqlXmlProviderWorkflowInitialState\";\r\n            // \r\n            // DeleteSqlFunctionProviderWorkflow\r\n            // \r\n            this.Activities.Add(this.DeleteSqlXmlProviderWorkflowInitialState);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"DeleteSqlXmlProviderWorkflowInitialState\";\r\n            this.Name = \"DeleteSqlFunctionProviderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private StateActivity DeleteSqlXmlProviderWorkflowInitialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/DeleteSqlFunctionProviderWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteSqlFunctionProviderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteSqlFunctionProviderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken token = this.EntityToken as DataEntityToken;\r\n\r\n            ISqlFunctionInfo sqlFunctionInfo = (ISqlFunctionInfo)token.Data;\r\n\r\n            if (DataFacade.WillDeleteSucceed(token.Data))\r\n            {\r\n                DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n                DataFacade.Delete(sqlFunctionInfo);\r\n\r\n                int count =\r\n                    (from info in DataFacade.GetData<ISqlFunctionInfo>()\r\n                     where info.Namespace == sqlFunctionInfo.Namespace\r\n                     select info).Count();                \r\n\r\n                if (count == 0)\r\n                {\r\n                    ISqlConnection sqlConnection =\r\n                        (from connection in DataFacade.GetData<ISqlConnection>()\r\n                         where connection.Id == sqlFunctionInfo.ConnectionId\r\n                         select connection).Single();\r\n\r\n                    SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n                    specificTreeRefresher.PostRefreshMesseges(sqlConnection.GetDataEntityToken());\r\n                }\r\n                else\r\n                {                    \r\n                    treeRefresher.PostRefreshMesseges();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"CascadeDeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.SqlFunction\", \"CascadeDeleteErrorMessage\")\r\n                    );\r\n            }            \r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/DeleteSqlFunctionProviderWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteSqlFunctionProviderWorkflow\" Location=\"30; 30\" Size=\"1149; 974\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteSqlFunctionProviderWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteSqlFunctionProviderWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"985\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"985\" Y=\"664\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"DeleteSqlXmlProviderWorkflowInitialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"DeleteSqlXmlProviderWorkflowInitialState\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"234\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"321\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"321\" Y=\"302\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"423\" Y=\"391\" />\r\n\t\t\t\t<ns0:Point X=\"985\" Y=\"391\" />\r\n\t\t\t\t<ns0:Point X=\"985\" Y=\"664\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"419\" Y=\"367\" />\r\n\t\t\t\t<ns0:Point X=\"537\" Y=\"367\" />\r\n\t\t\t\t<ns0:Point X=\"537\" Y=\"502\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"636\" Y=\"543\" />\r\n\t\t\t\t<ns0:Point X=\"985\" Y=\"543\" />\r\n\t\t\t\t<ns0:Point X=\"985\" Y=\"664\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"DeleteSqlXmlProviderWorkflowInitialState\" Location=\"63; 105\" Size=\"240; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"stateInitializationActivity1\" Location=\"71; 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"81; 198\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"905; 664\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"216; 302\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"224; 333\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"234; 395\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"224; 357\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"234; 419\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"234; 479\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"224; 381\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"234; 443\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"234; 503\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"435; 502\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"443; 533\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"453; 595\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"453; 655\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"453; 715\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/EditSqlConnectionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    partial class EditSqlConnectionWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initialStateCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.saveEditEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.savestateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveEditStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"saveEditStateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.saveEditStateCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"savestateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditSqlFunctionConnection.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"saveEditStateActivity\";\r\n            // \r\n            // initialStateCodeActivity\r\n            // \r\n            this.initialStateCodeActivity.Name = \"initialStateCodeActivity\";\r\n            this.initialStateCodeActivity.ExecuteCode += new System.EventHandler(this.initialStateCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // saveEditEventDrivenActivity\r\n            // \r\n            this.saveEditEventDrivenActivity.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.saveEditEventDrivenActivity.Activities.Add(this.setStateActivity3);\r\n            this.saveEditEventDrivenActivity.Name = \"saveEditEventDrivenActivity\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.initialStateCodeActivity);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity4);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // savestateActivity\r\n            // \r\n            this.savestateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.savestateActivity.Name = \"savestateActivity\";\r\n            // \r\n            // saveEditStateActivity\r\n            // \r\n            this.saveEditStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.saveEditStateActivity.Activities.Add(this.saveEditEventDrivenActivity);\r\n            this.saveEditStateActivity.Name = \"saveEditStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.stateInitializationActivity1);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditSqlConnectionWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.saveEditStateActivity);\r\n            this.Activities.Add(this.savestateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditSqlConnectionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity savestateActivity;\r\n        private StateActivity saveEditStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private EventDrivenActivity saveEditEventDrivenActivity;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private CodeActivity initialStateCodeActivity;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private CodeActivity codeActivity1;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/EditSqlConnectionWorkflow.cs",
    "content": "using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Security.Cryptography;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditSqlConnectionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditSqlConnectionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initialStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            ISqlConnection connection = (ISqlConnection)dataEntityToken.Data;\r\n            \r\n            string decryptedConnectionString = connection.EncryptedConnectionString.Decrypt();\r\n\r\n            this.Bindings.Add(\"ConnectionString\", decryptedConnectionString);\r\n            this.Bindings.Add(\"SqlConnection\", connection);\r\n        }\r\n\r\n\r\n        private void saveEditStateCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            ISqlConnection connection = this.GetBinding<ISqlConnection>(\"SqlConnection\");\r\n            string connectionString = this.GetBinding<string>(\"ConnectionString\");\r\n            connection.EncryptedConnectionString = connectionString.Encrypt();\r\n\r\n            DataFacade.Update(connection);\r\n\r\n            SetSaveStatus(true);\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(connection.GetDataEntityToken());\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/EditSqlConnectionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditSqlConnectionWorkflow\" Location=\"30, 30\" Size=\"733, 520\" AutoSize=\"False\" AutoSizeMargin=\"16, 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"EditSqlConnectionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditSqlConnectionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"245\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"245\" Y=\"63\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"63\" />\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"397\" />\r\n\t\t\t\t<ns0:Point X=\"146\" Y=\"397\" />\r\n\t\t\t\t<ns0:Point X=\"146\" Y=\"403\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveEditStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveEditStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"237\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"253\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"253\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"160\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"160\" Y=\"197\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"savestateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"saveEditStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"savestateActivity\" SourceActivity=\"saveEditStateActivity\" EventHandlerName=\"saveEditEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"251\" Y=\"262\" />\r\n\t\t\t\t<ns0:Point X=\"267\" Y=\"262\" />\r\n\t\t\t\t<ns0:Point X=\"267\" Y=\"302\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"302\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"307\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveEditStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"savestateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveEditStateActivity\" SourceActivity=\"savestateActivity\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"348\" />\r\n\t\t\t\t<ns0:Point X=\"272\" Y=\"348\" />\r\n\t\t\t\t<ns0:Point X=\"272\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"160\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"160\" Y=\"197\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"66, 101\" Size=\"175, 80\" AutoSize=\"False\" AutoSizeMargin=\"16, 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150, 181\" Name=\"stateInitializationActivity1\" Location=\"74, 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130, 41\" Name=\"initialStateCodeActivity\" Location=\"84, 193\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity2\" Location=\"84, 253\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveEditStateActivity\" Location=\"66, 197\" Size=\"189, 94\" AutoSize=\"False\" AutoSizeMargin=\"16, 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150, 121\" Name=\"editStateInitializationActivity\" Location=\"321, 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130, 41\" Name=\"documentFormActivity1\" Location=\"331, 209\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150, 181\" Name=\"saveEditEventDrivenActivity\" Location=\"313, 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130, 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"323, 220\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity3\" Location=\"323, 280\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"savestateActivity\" Location=\"66, 307\" Size=\"194, 80\" AutoSizeMargin=\"16, 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150, 181\" Name=\"saveStateInitializationActivity\" Location=\"74, 338\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130, 41\" Name=\"codeActivity1\" Location=\"84, 399\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity1\" Location=\"84, 459\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"66, 403\" Size=\"160, 80\" AutoSizeMargin=\"16, 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150, 181\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130, 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48, 122\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity4\" Location=\"48, 182\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/EditSqlFunctionProviderWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    partial class EditSqlFunctionProviderWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity3 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.previewCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.previewHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_preview = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateActivity1 = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // codeActivity3\r\n            // \r\n            this.codeActivity3.Name = \"codeActivity3\";\r\n            this.codeActivity3.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // previewCodeActivity\r\n            // \r\n            this.previewCodeActivity.Name = \"previewCodeActivity\";\r\n            this.previewCodeActivity.ExecuteCode += new System.EventHandler(this.previewCodeActivity_ExecuteCode);\r\n            // \r\n            // previewHandleExternalEventActivity1\r\n            // \r\n            this.previewHandleExternalEventActivity1.EventName = \"Preview\";\r\n            this.previewHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previewHandleExternalEventActivity1.Name = \"previewHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"stateActivity1\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditSqlFunction.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.initialize_ExecuteCode);\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.codeActivity3);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_preview\r\n            // \r\n            this.editEventDrivenActivity_preview.Activities.Add(this.previewHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_preview.Activities.Add(this.previewCodeActivity);\r\n            this.editEventDrivenActivity_preview.Activities.Add(this.setStateActivity5);\r\n            this.editEventDrivenActivity_preview.Name = \"editEventDrivenActivity_preview\";\r\n            // \r\n            // editEventDrivenActivity_Save\r\n            // \r\n            this.editEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.editEventDrivenActivity_Save.Name = \"editEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // stateActivity1\r\n            // \r\n            this.stateActivity1.Activities.Add(this.saveStateInitializationActivity);\r\n            this.stateActivity1.Name = \"stateActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Save);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_preview);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditSqlFunctionProviderWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.stateActivity1);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditSqlFunctionProviderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private CodeActivity codeActivity1;\r\n        private EventDrivenActivity editEventDrivenActivity_Save;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private CodeActivity codeActivity3;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private StateActivity stateActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private EventDrivenActivity editEventDrivenActivity_preview;\r\n        private CodeActivity previewCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity previewHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/EditSqlFunctionProviderWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Serialization;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Functions.ManagedParameters;\r\nusing Composite.Core.Logging;\r\nusing Composite.Plugins.Functions.FunctionProviders.SqlFunctionProvider;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.Core.WebClient.FunctionCallEditor;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Foundation;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.SqlFunctionElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditSqlFunctionProviderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditSqlFunctionProviderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken token = this.EntityToken as DataEntityToken;\r\n\r\n            ISqlFunctionInfo functionInfo = (ISqlFunctionInfo)token.Data;\r\n            IEnumerable<ManagedParameterDefinition> parameters = ManagedParameterManager.Load(functionInfo.Id);\r\n\r\n            this.Bindings.Add(\"SqlQuery\", functionInfo);\r\n            this.Bindings.Add(\"Parameters\", parameters);\r\n            this.Bindings.Add(\"ParameterTypeOptions\", GetParameterTypes().ToList());\r\n\r\n            // Creating a session state object\r\n            Guid stateId = Guid.NewGuid();\r\n            var state = new EditSqlFunctionState { WorkflowId = WorkflowInstanceId, ConsoleIdInternal = GetCurrentConsoleId() };\r\n            SessionStateManager.DefaultProvider.AddState<IParameterEditorState>(stateId, state, DateTime.Now.AddDays(7.0));\r\n\r\n            this.Bindings.Add(\"SessionStateProvider\", SessionStateManager.DefaultProviderName);\r\n            this.Bindings.Add(\"SessionStateId\", stateId);\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<Type> GetParameterTypes()\r\n        {\r\n            yield return typeof(string);\r\n            yield return typeof(int);\r\n            yield return typeof(decimal);\r\n            yield return typeof(DateTime);\r\n            yield return typeof(bool);\r\n            yield return typeof(Guid);\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n            ISqlFunctionInfo info;\r\n\r\n            try\r\n            {\r\n                info = this.GetBinding<ISqlFunctionInfo>(\"SqlQuery\");\r\n                var parameters = this.GetBinding<IEnumerable<ManagedParameterDefinition>>(\"Parameters\");\r\n\r\n                ManagedParameterManager.Save(info.Id, parameters);\r\n                DataFacade.Update(info);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogCritical(\"SQL Function Save\", ex);\r\n\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                var consoleMsgService = serviceContainer.GetService<IManagementConsoleMessageService>();\r\n                consoleMsgService.ShowMessage(DialogType.Error, \"Error\", ex.Message);\r\n\r\n                SetSaveStatus(false);\r\n                return;\r\n            }\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(info.GetDataEntityToken());\r\n            SetSaveStatus(true);\r\n        }\r\n\r\n\r\n\r\n        private void previewCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                ISqlFunctionInfo queryInfo = this.GetBinding<ISqlFunctionInfo>(\"SqlQuery\");\r\n\r\n\r\n                var parameterDefinitions = this.GetBinding<IEnumerable<ManagedParameterDefinition>>(\"Parameters\");\r\n                ParameterList parameters = ManagedParameterManager.GetParametersListForTest(parameterDefinitions);\r\n                IEnumerable<ParameterProfile> parameterProfiles = ManagedParameterManager.GetParameterProfiles(parameterDefinitions);\r\n\r\n                SqlFunction function = new SqlFunction(queryInfo, parameterProfiles);\r\n\r\n                XElement result = function.Execute(parameters, new FunctionContextContainer()) as XElement;\r\n\r\n                Page currentPage = HttpContext.Current.Handler as Page;\r\n                if (currentPage == null) throw new InvalidOperationException(\"The Current HttpContext Handler must be a System.Web.Ui.Page\");\r\n\r\n                UserControl inOutControl = (UserControl)currentPage.LoadControl(UrlUtils.ResolveAdminUrl(\"controls/Misc/MarkupInOutView.ascx\"));\r\n                inOutControl.Attributes.Add(\"out\", result.ToString());\r\n\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                var webRenderService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n                webRenderService.SetNewPageOutput(inOutControl);\r\n\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                Control errOutput = new LiteralControl(\"<pre>\" + ex.ToString() + \"</pre>\");\r\n                var webRenderService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n                webRenderService.SetNewPageOutput(errOutput);\r\n            }\r\n        }\r\n\r\n        [Serializable]\r\n        public sealed class EditSqlFunctionState : IParameterEditorState\r\n        {\r\n            public Guid WorkflowId { get; set; }\r\n            public string ConsoleIdInternal { get; set; }\r\n\r\n            private FormData GetFormData()\r\n            {\r\n                return WorkflowFacade.GetFormData(WorkflowId);\r\n            }\r\n\r\n\r\n            [XmlIgnore]\r\n            public List<ManagedParameterDefinition> Parameters\r\n            {\r\n                get { return GetFormData().Bindings[\"Parameters\"] as List<ManagedParameterDefinition>; }\r\n                set { GetFormData().Bindings[\"Parameters\"] = value; }\r\n            }\r\n\r\n            [XmlIgnore]\r\n            public List<Type> ParameterTypeOptions\r\n            {\r\n                get { return (GetFormData().Bindings[\"ParameterTypeOptions\"] as IEnumerable<Type>).ToList(); }\r\n                set { GetFormData().Bindings[\"ParameterTypeOptions\"] = value.ToList(); }\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/SqlFunctionElementProvider/EditSqlFunctionProviderWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditSqlFunctionProviderWorkflow\" Location=\"30, 30\" Size=\"790, 530\" AutoSizeMargin=\"16, 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditSqlFunctionProviderWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditSqlFunctionProviderWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"93\" />\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"93\" />\r\n\t\t\t\t<ns0:Point X=\"280\" Y=\"329\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"329\" />\r\n\t\t\t\t<ns0:Point X=\"143\" Y=\"335\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"272\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"272\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"190\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"stateActivity1\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"stateActivity1\" SourceActivity=\"editStateActivity\" EventHandlerName=\"editEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"252\" Y=\"266\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"266\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"160\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"160\" Y=\"431\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"editEventDrivenActivity_preview\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"267\" Y=\"290\" />\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"290\" />\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"194\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"stateActivity1\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"stateActivity1\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"252\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"284\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"193\" />\r\n\t\t\t\t<ns0:Point X=\"168\" Y=\"201\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"63, 105\" Size=\"197, 80\" AutoSizeMargin=\"16, 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150, 182\" Name=\"initialStateInitializationActivity\" Location=\"71, 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130, 41\" Name=\"codeActivity1\" Location=\"81, 198\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity2\" Location=\"81, 258\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150, 182\" Name=\"eventDrivenActivity1\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130, 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity1\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"63, 201\" Size=\"210, 118\" AutoSizeMargin=\"16, 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150, 122\" Name=\"editStateInitializationActivity\" Location=\"71, 232\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130, 41\" Name=\"documentFormActivity1\" Location=\"81, 294\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150, 182\" Name=\"editEventDrivenActivity_Save\" Location=\"71, 256\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130, 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"81, 318\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity3\" Location=\"81, 378\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150, 242\" Name=\"editEventDrivenActivity_preview\" Location=\"71, 280\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130, 41\" Name=\"previewHandleExternalEventActivity1\" Location=\"81, 342\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130, 41\" Name=\"previewCodeActivity\" Location=\"81, 402\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity5\" Location=\"81, 462\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"63, 335\" Size=\"160, 80\" AutoSizeMargin=\"16, 24\" />\r\n\t\t<StateDesigner Name=\"stateActivity1\" Location=\"63, 431\" Size=\"194, 80\" AutoSizeMargin=\"16, 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150, 182\" Name=\"saveStateInitializationActivity\" Location=\"71, 462\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130, 41\" Name=\"codeActivity3\" Location=\"81, 524\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130, 41\" Name=\"setStateActivity4\" Location=\"81, 584\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserControlFunctionProviderElementProvider/AddNewUserControlFunctionWorkflow.Designer.cs",
    "content": "using System.Workflow.Activities;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider\r\n{\r\n    partial class AddNewUserControlFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizecodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.validateStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.stateInitializationActivity4 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.validateStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsValidData);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizecodeActivity\r\n            // \r\n            this.finalizecodeActivity.Name = \"finalizecodeActivity\";\r\n            this.finalizecodeActivity.ExecuteCode += new System.EventHandler(this.finalizecodeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"validateStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dialogFormActivity1\r\n            // \r\n            this.dialogFormActivity1.ContainerLabel = \"Add new\";\r\n            this.dialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewUserControlFunction.xml\";\r\n            this.dialogFormActivity1.Name = \"dialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // validateStateInitializationActivity\r\n            // \r\n            this.validateStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.validateStateInitializationActivity.Name = \"validateStateInitializationActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // stateInitializationActivity4\r\n            // \r\n            this.stateInitializationActivity4.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.stateInitializationActivity4.Activities.Add(this.finalizecodeActivity);\r\n            this.stateInitializationActivity4.Activities.Add(this.setStateActivity1);\r\n            this.stateInitializationActivity4.Name = \"stateInitializationActivity4\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity6);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.dialogFormActivity1);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.initializeCodeActivity);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // validateStateActivity\r\n            // \r\n            this.validateStateActivity.Activities.Add(this.validateStateInitializationActivity);\r\n            this.validateStateActivity.Name = \"validateStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity7);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.stateInitializationActivity4);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // AddNewUserControlFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.validateStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewUserControlFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity finalizeStateActivity;\r\n\r\n        private StateActivity step1StateActivity;\r\n\r\n        private StateInitializationActivity stateInitializationActivity4;\r\n\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private SetStateActivity setStateActivity5;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity dialogFormActivity1;\r\n\r\n        private CodeActivity finalizecodeActivity;\r\n\r\n        private SetStateActivity setStateActivity7;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n\r\n        private IfElseActivity ifElseActivity1;\r\n\r\n        private StateInitializationActivity validateStateInitializationActivity;\r\n\r\n        private StateActivity validateStateActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private SetStateActivity setStateActivity6;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserControlFunctionProviderElementProvider/AddNewUserControlFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Functions;\r\nusing Composite.Functions.Foundation.PluginFacades;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.UserControlFunctionProvider;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewUserControlFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        private static readonly string Binding_Name = \"Name\";\r\n        private static readonly string Binding_Namespace = \"Namespace\";\r\n        private static readonly string Binding_CopyFromFunctionName = \"CopyFromFunctionName\";\r\n        private static readonly string Binding_CopyFromOptions = \"CopyFromOptions\";\r\n\r\n\r\n        private static readonly string Marker_CodeFile = \"%CodeFile%\";\r\n\r\n        private static readonly string NewUserControl_Markup =\r\n@\"<%@ Control Language=\"\"C#\"\" AutoEventWireup=\"\"true\"\" CodeFile=\"\"%CodeFile%\"\" Inherits=\"\"C1Function\"\" %>\r\n\r\nHello <%= this.Name %>!\";\r\n\r\n        private static readonly string NewUserControl_CodeFile =\r\n@\"using System;\r\nusing Composite.Functions;\r\n\r\npublic partial class C1Function : Composite.AspNet.UserControlFunction\r\n{\r\n    public override string FunctionDescription\r\n    {\r\n        get \r\n        { \r\n            return \"\"A demo function that outputs a hello message.\"\"; \r\n        }\r\n    }\r\n\r\n    [FunctionParameter(DefaultValue = \"\"World\"\")]\r\n    public string Name { get; set; }\r\n\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n\r\n    }\r\n}\";\r\n\r\n\r\n        public AddNewUserControlFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            BaseFunctionFolderElementEntityToken token = (BaseFunctionFolderElementEntityToken)this.EntityToken;\r\n            string @namespace = token.FunctionNamespace ?? UserSettings.LastSpecifiedNamespace;\r\n\r\n            this.Bindings.Add(Binding_Name, string.Empty);\r\n            this.Bindings.Add(Binding_Namespace, @namespace);\r\n\r\n            var functionProvider = GetFunctionProvider<UserControlFunctionProvider>();\r\n            var copyOfOptions = new List<KeyValuePair<string, string>>();\r\n\r\n            copyOfOptions.Add(new KeyValuePair<string, string>(string.Empty, GetText(\"AddNewUserControlFunction.LabelCopyFromEmptyOption\")));\r\n            foreach (string functionName in FunctionFacade.GetFunctionNamesByProvider(functionProvider.Name))\r\n            {\r\n                copyOfOptions.Add(new KeyValuePair<string, string>(functionName, functionName));\r\n            }\r\n\r\n            this.Bindings.Add(Binding_CopyFromFunctionName, string.Empty);\r\n            this.Bindings.Add(Binding_CopyFromOptions, copyOfOptions);\r\n        }\r\n\r\n        private void IsValidData(object sender, ConditionalEventArgs e)\r\n        {\r\n            string functionName = this.GetBinding<string>(Binding_Name);\r\n            string functionNamespace = this.GetBinding<string>(Binding_Namespace);\r\n            var provider = GetFunctionProvider<UserControlFunctionProvider>();\r\n\r\n            e.Result = false;\r\n\r\n            if (functionName == string.Empty)\r\n            {\r\n                ShowFieldMessage(Binding_Name, GetText(\"AddNewUserControlFunctionWorkflow.EmptyName\"));\r\n                return;\r\n            }\r\n\r\n            if (string.IsNullOrWhiteSpace(functionNamespace))\r\n            {\r\n                ShowFieldMessage(Binding_Namespace, GetText(\"AddNewUserControlFunctionWorkflow.NamespaceEmpty\"));\r\n                return;\r\n            }\r\n\r\n            if (!functionNamespace.IsCorrectNamespace('.'))\r\n            {\r\n                ShowFieldMessage(Binding_Namespace, GetText(\"AddNewUserControlFunctionWorkflow.InvalidNamespace\"));\r\n                return;\r\n            }\r\n\r\n            string functionFullName = functionNamespace + \".\" + functionName;\r\n\r\n            bool nameIsUsed = FunctionFacade.FunctionNames.Contains(functionFullName, StringComparer.OrdinalIgnoreCase);\r\n            if (nameIsUsed)\r\n            {\r\n                ShowFieldMessage(Binding_Namespace, GetText(\"AddNewUserControlFunctionWorkflow.DuplicateName\"));\r\n                return;\r\n            }\r\n\r\n            if ((provider.PhysicalPath + functionNamespace + functionName).Length > 240)\r\n            {\r\n                ShowFieldMessage(Binding_Name, GetText(\"AddNewUserControlFunctionWorkflow.TotalNameTooLang\"));\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void finalizecodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string functionName = this.GetBinding<string>(Binding_Name);\r\n            string functionNamespace = this.GetBinding<string>(Binding_Namespace);\r\n            string copyFromFunctionName = this.GetBinding<string>(Binding_CopyFromFunctionName);\r\n            string functionFullName = functionNamespace + \".\" + functionName;\r\n\r\n            var provider = GetFunctionProvider<UserControlFunctionProvider>();\r\n\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            string fileName = functionName + \".ascx\";\r\n            string folder = Path.Combine(provider.PhysicalPath, functionNamespace.Replace('.', '\\\\'));\r\n            string markupFilePath = Path.Combine(folder, fileName);\r\n            string codeFilePath = markupFilePath + \".cs\";\r\n\r\n            string markupTemplate = NewUserControl_Markup;\r\n            string code = NewUserControl_CodeFile;\r\n            if (!copyFromFunctionName.IsNullOrEmpty())\r\n            {\r\n                GetFunctionCode(copyFromFunctionName, out markupTemplate, out code);\r\n            }\r\n\r\n            C1Directory.CreateDirectory(folder);\r\n            C1File.WriteAllText(codeFilePath, code);\r\n            C1File.WriteAllText(markupFilePath, markupTemplate.Replace(Marker_CodeFile, functionName + \".ascx.cs\"));\r\n\r\n\r\n            UserSettings.LastSpecifiedNamespace = functionNamespace;\r\n\r\n            provider.ReloadFunctions();\r\n\r\n            var newFunctionEntityToken = new FileBasedFunctionEntityToken(provider.Name, functionFullName);\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(newFunctionEntityToken);\r\n\r\n            var container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            var executionService = container.GetService<IActionExecutionService>();\r\n            executionService.Execute(newFunctionEntityToken, new WorkflowActionToken(typeof(EditUserControlFunctionWorkflow)), null);\r\n        }\r\n\r\n        private void GetFunctionCode(string copyFromFunctionName, out string markupTemplate, out string code)\r\n        {\r\n            IFunction function = FunctionFacade.GetFunction(copyFromFunctionName);\r\n\r\n            if (function is FunctionWrapper)\r\n            {\r\n                function = (function as FunctionWrapper).InnerFunction;\r\n            }\r\n\r\n            var razorFunction = (UserControlBasedFunction)function;\r\n            string filePath = PathUtil.Resolve(razorFunction.VirtualPath);\r\n            string codeFilePath = filePath + \".cs\";\r\n            Verify.That(C1File.Exists(codeFilePath), \"Codebehind file not found: {0}\", codeFilePath);\r\n\r\n            markupTemplate = C1File.ReadAllText(filePath);\r\n            code = C1File.ReadAllText(codeFilePath);\r\n\r\n            const string quote = \"\\\"\";\r\n            string codeFileReference = quote + Path.GetFileName(codeFilePath) + quote;\r\n\r\n            int codeReferenceOffset = markupTemplate.IndexOf(codeFileReference, StringComparison.OrdinalIgnoreCase);\r\n            Verify.That(codeReferenceOffset > 0, \"Failed to find codebehind file reference '{0}'\".FormatWith(codeFileReference));\r\n\r\n            markupTemplate = markupTemplate.Replace(codeFileReference, \r\n                                                    quote + Marker_CodeFile + quote, \r\n                                                    StringComparison.OrdinalIgnoreCase);\r\n        }\r\n\r\n\r\n        private static string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.UserControlFunction\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserControlFunctionProviderElementProvider/AddNewUserControlFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1011, 709\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"AddNewUserControlFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceActivity=\"AddNewUserControlFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"AddNewUserControlFunctionWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"617\" />\r\n\t\t\t\t<ns0:Point X=\"465\" Y=\"617\" />\r\n\t\t\t\t<ns0:Point X=\"465\" Y=\"629\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initializeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity1\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"559\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"568\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"568\" Y=\"203\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"203\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"215\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"validateStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"validateStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"562\" Y=\"280\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"280\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"351\" />\r\n\t\t\t\t<ns0:Point X=\"477\" Y=\"351\" />\r\n\t\t\t\t<ns0:Point X=\"477\" Y=\"363\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceActivity=\"step1StateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"step1EventDrivenActivity_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"566\" Y=\"304\" />\r\n\t\t\t\t<ns0:Point X=\"706\" Y=\"304\" />\r\n\t\t\t\t<ns0:Point X=\"706\" Y=\"617\" />\r\n\t\t\t\t<ns0:Point X=\"465\" Y=\"617\" />\r\n\t\t\t\t<ns0:Point X=\"465\" Y=\"629\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"stateInitializationActivity4\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"551\" Y=\"529\" />\r\n\t\t\t\t<ns0:Point X=\"561\" Y=\"529\" />\r\n\t\t\t\t<ns0:Point X=\"561\" Y=\"617\" />\r\n\t\t\t\t<ns0:Point X=\"465\" Y=\"617\" />\r\n\t\t\t\t<ns0:Point X=\"465\" Y=\"629\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"validateStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"validateStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"404\" />\r\n\t\t\t\t<ns0:Point X=\"587\" Y=\"404\" />\r\n\t\t\t\t<ns0:Point X=\"587\" Y=\"476\" />\r\n\t\t\t\t<ns0:Point X=\"467\" Y=\"476\" />\r\n\t\t\t\t<ns0:Point X=\"467\" Y=\"488\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"step1StateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"validateStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"validateStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"578\" Y=\"404\" />\r\n\t\t\t\t<ns0:Point X=\"592\" Y=\"404\" />\r\n\t\t\t\t<ns0:Point X=\"592\" Y=\"207\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"207\" />\r\n\t\t\t\t<ns0:Point X=\"464\" Y=\"215\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"175, 80\" AutoSizeMargin=\"16, 24\" Location=\"388, 101\" Name=\"initializeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity1\" Size=\"150, 182\" Location=\"396, 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"initializeCodeActivity\" Size=\"130, 41\" Location=\"406, 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"406, 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"211, 118\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"359, 215\" Name=\"step1StateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity2\" Size=\"150, 122\" Location=\"460, 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"dialogFormActivity1\" Size=\"130, 41\" Location=\"470, 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Finish\" Size=\"150, 182\" Location=\"452, 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"462, 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130, 41\" Location=\"462, 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"step1EventDrivenActivity_Cancel\" Size=\"150, 182\" Location=\"452, 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130, 41\" Location=\"462, 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130, 41\" Location=\"462, 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"175, 80\" AutoSizeMargin=\"16, 24\" Location=\"380, 488\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity4\" Size=\"150, 242\" Location=\"388, 519\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130, 41\" Location=\"398, 581\" />\r\n\t\t\t\t\t\t<CodeDesigner Name=\"finalizecodeActivity\" Size=\"130, 41\" Location=\"398, 641\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"398, 701\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"385, 629\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"209, 80\" AutoSizeMargin=\"16, 24\" Location=\"373, 363\" Name=\"validateStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"validateStateInitializationActivity\" Size=\"381, 303\" Location=\"381, 394\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361, 222\" Location=\"391, 456\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150, 122\" Location=\"410, 527\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"420, 589\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150, 122\" Location=\"583, 527\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"593, 589\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserControlFunctionProviderElementProvider/DeleteUserControlFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider\r\n{\r\n    partial class DeleteUserControlFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.confirm_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirm_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.deleteStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.deleteStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"deleteStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteUserControlFunctionConfirm.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // confirm_Cancel\r\n            // \r\n            this.confirm_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirm_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.confirm_Cancel.Name = \"confirm_Cancel\";\r\n            // \r\n            // confirm_Finish\r\n            // \r\n            this.confirm_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.confirm_Finish.Activities.Add(this.setStateActivity3);\r\n            this.confirm_Finish.Name = \"confirm_Finish\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // deleteStateInitializationActivity\r\n            // \r\n            this.deleteStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.deleteStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.deleteStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.deleteStateInitializationActivity.Name = \"deleteStateInitializationActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.confirmStateActivity.Activities.Add(this.confirm_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirm_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity2);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // deleteStateActivity\r\n            // \r\n            this.deleteStateActivity.Activities.Add(this.deleteStateInitializationActivity);\r\n            this.deleteStateActivity.Name = \"deleteStateActivity\";\r\n            // \r\n            // DeleteUserControlFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.deleteStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"confirmStateActivity\";\r\n            this.Name = \"DeleteUserControlFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity codeActivity1;\r\n\r\n        private StateInitializationActivity deleteStateInitializationActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n\r\n        private EventDrivenActivity confirm_Cancel;\r\n\r\n        private EventDrivenActivity confirm_Finish;\r\n\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n\r\n        private StateActivity confirmStateActivity;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n\r\n        private StateActivity deleteStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserControlFunctionProviderElementProvider/DeleteUserControlFunctionWorkflow.cs",
    "content": "using System;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.UserControlFunctionProvider;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteUserControlFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        public DeleteUserControlFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var functionEntityToken = (FileBasedFunctionEntityToken)EntityToken;\r\n\r\n            FileBasedFunctionProvider<UserControlBasedFunction> provider;\r\n            FileBasedFunction<UserControlBasedFunction> function;\r\n\r\n            GetProviderAndFunction(functionEntityToken, out provider, out function);\r\n\r\n            string markupFilePath = PathUtil.Resolve(function.VirtualPath);\r\n            string codeFilePath = markupFilePath + \".cs\";\r\n\r\n            C1File.Delete(markupFilePath);\r\n            C1File.Delete(codeFilePath);\r\n\r\n            DeleteEmptyAncestorFolders(markupFilePath);\r\n\r\n            provider.ReloadFunctions();\r\n\r\n            RefreshFunctionTree();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserControlFunctionProviderElementProvider/DeleteUserControlFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"1011, 603\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"30, 30\" Name=\"DeleteUserControlFunctionWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"DeleteUserControlFunctionWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"DeleteUserControlFunctionWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"452\" />\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"452\" />\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"464\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"deleteStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"deleteStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"deleteStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"260\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"452\" />\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"452\" />\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"464\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"deleteStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirm_Finish\" SourceConnectionIndex=\"1\" TargetStateName=\"deleteStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"218\" Y=\"303\" />\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"303\" />\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"97\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"97\" />\r\n\t\t\t\t<ns0:Point X=\"163\" Y=\"105\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"confirmStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"confirmStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"confirm_Cancel\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"222\" Y=\"327\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"327\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"452\" />\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"452\" />\r\n\t\t\t\t<ns0:Point X=\"248\" Y=\"464\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"201, 80\" AutoSizeMargin=\"16, 24\" Location=\"63, 105\" Name=\"deleteStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"deleteStateInitializationActivity\" Size=\"150, 242\" Location=\"71, 136\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity1\" Size=\"130, 41\" Location=\"81, 198\" />\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130, 41\" Location=\"81, 258\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130, 41\" Location=\"81, 318\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"160, 80\" AutoSizeMargin=\"16, 24\" Location=\"168, 464\" Name=\"finalStateActivity\" />\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity_GlobalCancel\" Size=\"150, 182\" Location=\"38, 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130, 41\" Location=\"48, 123\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130, 41\" Location=\"48, 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"175, 118\" AutoSizeMargin=\"16, 24\" AutoSize=\"False\" Location=\"101, 238\" Name=\"confirmStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"stateInitializationActivity1\" Size=\"150, 122\" Location=\"460, 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"confirmDialogFormActivity1\" Size=\"130, 41\" Location=\"470, 210\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirm_Finish\" Size=\"150, 182\" Location=\"452, 159\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity2\" Size=\"130, 41\" Location=\"462, 221\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130, 41\" Location=\"462, 281\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"confirm_Cancel\" Size=\"150, 182\" Location=\"452, 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130, 41\" Location=\"462, 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130, 41\" Location=\"462, 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserControlFunctionProviderElementProvider/EditUserControlFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Reflection;\r\nusing System.Web.UI;\r\nusing Composite.AspNet;\r\nusing Composite.AspNet.Security;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.FileBasedFunctionProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.UserControlFunctionProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditUserControlFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        private static readonly string LogTitle = typeof(EditUserControlFunctionWorkflow).Name;\r\n\r\n        public EditUserControlFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private string[] GetFiles(FileBasedFunction<UserControlBasedFunction> function)\r\n        {\r\n            var result = new List<string>();\r\n\r\n            string markupFilePath = PathUtil.Resolve(function.VirtualPath);\r\n            result.Add(markupFilePath);\r\n\r\n            string codeFile = markupFilePath + \".cs\";\r\n            if(C1File.Exists(codeFile))\r\n            {\r\n                result.Add(codeFile);\r\n            }\r\n\r\n            return result.ToArray();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            FileBasedFunctionProvider<UserControlBasedFunction> provider;\r\n            FileBasedFunction<UserControlBasedFunction> function;\r\n\r\n            GetProviderAndFunction((FileBasedFunctionEntityToken)this.EntityToken, out provider, out function);\r\n            \r\n            string title = Path.GetFileName(function.VirtualPath);\r\n\r\n            this.Bindings.Add(\"Title\", title);\r\n\r\n            string[] files = GetFiles(function);\r\n\r\n            // Binding all the files\r\n            for(int i=0; i<files.Length; i++)\r\n            {\r\n                var websiteFile = new WebsiteFile(files[i]);\r\n\r\n                string bindingPrefix = GetBindingPrefix(i);\r\n\r\n                this.Bindings.Add(bindingPrefix + \"Content\", websiteFile.ReadAllText());\r\n                this.Bindings.Add(bindingPrefix + \"Name\", websiteFile.FileName);\r\n                this.Bindings.Add(bindingPrefix + \"MimeType\", websiteFile.MimeType);\r\n            }\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var functionEntityToken = (FileBasedFunctionEntityToken)this.EntityToken;\r\n\r\n            FileBasedFunctionProvider<UserControlBasedFunction> provider;\r\n            FileBasedFunction<UserControlBasedFunction> function;\r\n\r\n            GetProviderAndFunction(functionEntityToken, out provider, out function);\r\n\r\n            string[] files = GetFiles(function);\r\n\r\n            var fileContent = new List<string>();\r\n\r\n            for (int i = 0; i < files.Length; i++)\r\n            {\r\n                string bindingPrefix = GetBindingPrefix(i);\r\n\r\n                fileContent.Add(this.GetBinding<string>(bindingPrefix + \"Content\"));\r\n            }\r\n\r\n            string fixedMarkup = PageTemplateHelper.FixHtmlEscapeSequences(fileContent[0]);\r\n            bool viewShouldBeUpdated = fixedMarkup != fileContent[0];\r\n            fileContent[0] = fixedMarkup;\r\n\r\n            if (!CompileAndValidate(files, fileContent))\r\n            {\r\n                SetSaveStatus(false);\r\n                return;\r\n            }\r\n\r\n            for (int i = 0; i < files.Length; i++)\r\n            {\r\n                var websiteFile = new WebsiteFile(files[i]);\r\n\r\n                websiteFile.WriteAllText(fileContent[i]);\r\n            }\r\n\r\n            provider.ReloadFunctions();\r\n\r\n            this.CreateParentTreeRefresher().PostRefreshMesseges(this.EntityToken);\r\n\r\n            SetSaveStatus(true);\r\n\r\n            if(viewShouldBeUpdated)\r\n            {\r\n                UpdateBinding(GetBindingPrefix(0) + \"Content\", fileContent[0]);\r\n                RerenderView();\r\n            }\r\n        }\r\n\r\n        private static string GetBindingPrefix(int zeroBasedFileNumber)\r\n        {\r\n            return \"File\" + (zeroBasedFileNumber + 1);\r\n        }\r\n\r\n        private bool CompileAndValidate(string[] files, IList<string> fileContent)\r\n        {\r\n            string tempMarkupFile = GetTempFilePath(files[0]);\r\n            string tempCodeBehindFile = null; \r\n\r\n            string tempMarkupFileContent = fileContent[0];\r\n\r\n            if(files.Length > 1)\r\n            {\r\n                tempCodeBehindFile = GetTempFilePath(files[1]);\r\n\r\n                string originalCsFileName = Path.GetFileName(files[1]);\r\n                string newCsFileName = Path.GetFileName(tempCodeBehindFile);\r\n\r\n                // Fixing the refecence to the CS file in the temporary created .ascx file so it will point\r\n                // to the temporary CS file. Just string.Replace(), writing a sofisticated parser would be overkill\r\n\r\n                int offset = tempMarkupFileContent.IndexOf(originalCsFileName, StringComparison.OrdinalIgnoreCase);\r\n\r\n                if(offset > 0)\r\n                {\r\n                    tempMarkupFileContent = tempMarkupFileContent.Substring(0, offset)\r\n                                            + newCsFileName\r\n                                            + tempMarkupFileContent.Substring(offset + originalCsFileName.Length);\r\n                }\r\n            }\r\n\r\n            try\r\n            {\r\n                File.WriteAllText(tempMarkupFile, tempMarkupFileContent); \r\n\r\n                if(tempCodeBehindFile != null)\r\n                {\r\n                    File.WriteAllText(tempCodeBehindFile, fileContent[1]); \r\n                }\r\n\r\n                string virtualPath = \"~\" + PathUtil.GetWebsitePath(tempMarkupFile);\r\n\r\n                try\r\n                {\r\n                    var page = new Page();\r\n                    Control control = page.LoadControl(virtualPath);\r\n\r\n                    if (!(control is UserControl))\r\n                    {\r\n                        ShowWarning(GetText(\"EditUserControlFunctionWorkflow.Validation.IncorrectBaseClass\")\r\n                                .FormatWith(typeof(UserControl).FullName));\r\n                        return false;\r\n                    }\r\n                }\r\n                catch(Exception ex)\r\n                {\r\n                    Log.LogWarning(LogTitle, \"Failed to compile ASCX file\");\r\n                    Log.LogWarning(LogTitle, ex);\r\n\r\n                    Exception compilationException = (ex is TargetInvocationException) ? ex.InnerException : ex;\r\n\r\n                    // Replacing file path and temp file name from error message as it is irrelevant to the user\r\n                    string markupFileName = Path.GetFileName(files[0]);\r\n                    string errorMessage = compilationException.Message;\r\n\r\n                    if (errorMessage.StartsWith(tempMarkupFile, StringComparison.OrdinalIgnoreCase))\r\n                    {\r\n                        errorMessage = markupFileName + errorMessage.Substring(tempMarkupFile.Length);\r\n                    }\r\n\r\n                    ShowWarning(GetText(\"EditUserControlFunctionWorkflow.Validation.CompilationFailed\")\r\n                                .FormatWith(errorMessage));\r\n\r\n                    return false;\r\n                }\r\n\r\n                return true;\r\n            }\r\n            finally\r\n            {\r\n                // Deleting temporary files\r\n                File.Delete(tempMarkupFile);\r\n                if (tempCodeBehindFile != null)\r\n                {\r\n                    File.Delete(tempCodeBehindFile);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private void ShowWarning(string warning)\r\n        {\r\n            this.ShowMessage(DialogType.Warning,\r\n                 GetText(\"EditUserControlFunctionWorkflow.Validation.DialogTitle\"),\r\n                 warning);\r\n        }\r\n\r\n        private string GetText(string text)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.UserControlFunction\", text);\r\n        }\r\n\r\n\r\n        private string GetTempFilePath(string filePath)\r\n        {\r\n            string fileName = Path.GetFileName(filePath);\r\n            string folderPath = Path.GetDirectoryName(filePath);\r\n\r\n            return Path.Combine(folderPath, \"_temp_\" + fileName);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserControlFunctionProviderElementProvider/EditUserControlFunctionWorkflow.designer.cs",
    "content": "using System.Workflow.Activities;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserControlFunctionProviderElementProvider\r\n{\r\n    partial class EditUserControlFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditUserControlFunction.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditMasterPageWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditMasterPageWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity1;\r\n\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n\r\n        private StateActivity finalStateActivity;\r\n\r\n        private StateActivity saveStateActivity;\r\n\r\n        private StateActivity editStateActivity;\r\n\r\n        private C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n\r\n        private CodeActivity saveCodeActivity;\r\n\r\n        private SetStateActivity setStateActivity3;\r\n\r\n        private C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n\r\n        private SetStateActivity setStateActivity2;\r\n\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n\r\n        private SetStateActivity setStateActivity4;\r\n\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/AddNewUserWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\n\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Data.Validation;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Plugins.Security.LoginProviderPlugins.DataBasedFormLoginProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewUserWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static class BindingNames\r\n        {\r\n            public const string NewUser = \"NewUser\";\r\n            public const string Username = \"NewUser.Username\";\r\n            public const string Password = \"Password\";\r\n            public const string UserFormLogin = \"UserFormLogin\";\r\n        }\r\n\r\n        public AddNewUserWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void CheckActiveLanguagesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = DataLocalizationFacade.ActiveLocalizationCultures.Any();\r\n        }\r\n\r\n\r\n        private void IsUserValid(object sender, ConditionalEventArgs e)\r\n        {\r\n            IUser newUser = this.GetBinding<IUser>(BindingNames.NewUser);\r\n            var bindedUserFormLogin = this.GetBinding<IUserFormLogin>(BindingNames.UserFormLogin);\r\n\r\n            NormalizeUsername(newUser);\r\n            \r\n            ValidationResults validationResults = ValidationFacade.Validate(newUser);\r\n\r\n            bool isValid = validationResults.IsValid;\r\n\r\n            if (isValid)\r\n            {\r\n                validationResults = ValidationFacade.Validate(bindedUserFormLogin);\r\n\r\n                isValid = validationResults.IsValid;\r\n            }\r\n\r\n            if(isValid)\r\n            {\r\n                IQueryable<IUser> usersWithTheSameName =\r\n                    from user in DataFacade.GetData<IUser>()\r\n                    where string.Compare(user.Username, newUser.Username, StringComparison.InvariantCultureIgnoreCase) == 0\r\n                    select user;\r\n\r\n                if(usersWithTheSameName.Any())\r\n                {\r\n                    ShowFieldMessage(BindingNames.Username,\r\n                        LocalizationFiles.Composite_Management.UserElementProvider_UserLoginIsAlreadyUsed);\r\n\r\n                    isValid = false;\r\n                }\r\n\r\n                string password = this.GetBinding<string>(BindingNames.Password);\r\n\r\n\r\n                IList<string> validationMessages;\r\n                if (!PasswordPolicyFacade.ValidatePassword(newUser, password, out validationMessages))\r\n                {\r\n                    foreach (var message in validationMessages)\r\n                    {\r\n                        this.ShowFieldMessage(BindingNames.Password, message);\r\n                    }\r\n\r\n                    isValid = false;\r\n                }\r\n            }\r\n\r\n            e.Result = isValid;\r\n        }\r\n\r\n\r\n        private void MissingActiveLanguageCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            var managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            managementConsoleMessageService.ShowMessage(\r\n                DialogType.Message,\r\n                LocalizationFiles.Composite_Management.UserElementProvider_MissingActiveLanguageTitle,\r\n                LocalizationFiles.Composite_Management.UserElementProvider_MissingActiveLanguageMessage);\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IUser newUser = DataFacade.BuildNew<IUser>();\r\n            newUser.Id = Guid.NewGuid();\r\n\r\n            var userFormLogin = DataFacade.BuildNew<IUserFormLogin>();\r\n\r\n            userFormLogin.PasswordHash = \"\";\r\n            userFormLogin.PasswordHashSalt = \"\";\r\n\r\n\r\n            var groupEntityToken = this.EntityToken as UserElementProviderGroupEntityToken;\r\n\r\n            if (groupEntityToken != null)\r\n            {\r\n                userFormLogin.Folder = groupEntityToken.Id;\r\n            }\r\n\r\n            CultureInfo userCulture = UserSettings.CultureInfo; // Copy admins settings\r\n            CultureInfo c1ConsoleUiLanguage = UserSettings.C1ConsoleUiLanguage; // Copy admins settings\r\n\r\n            List<KeyValuePair> regionLanguageList = StringResourceSystemFacade.GetSupportedCulturesList();\r\n            Dictionary<string, string> culturesDictionary = StringResourceSystemFacade.GetAllCultures();\r\n            \r\n            this.Bindings.Add(BindingNames.NewUser, newUser);\r\n            this.Bindings.Add(BindingNames.UserFormLogin, userFormLogin);\r\n\r\n            this.Bindings.Add(\"AllCultures\", culturesDictionary);\r\n            this.Bindings.Add(\"CultureName\", userCulture.Name);\r\n\r\n            this.Bindings.Add(\"C1ConsoleUiCultures\", regionLanguageList);\r\n            this.Bindings.Add(\"C1ConsoleUiLanguageName\", c1ConsoleUiLanguage.Name);\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IUser newUser = this.GetBinding<IUser>(BindingNames.NewUser);\r\n            NormalizeUsername(newUser);\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate(newUser);\r\n\r\n            foreach (ValidationResult result in validationResults)\r\n            {\r\n                this.ShowFieldMessage($\"{BindingNames.NewUser}.{result.Key}\", result.Message);\r\n            }\r\n\r\n            IQueryable<IUser> usersWithTheSameName =\r\n                 from user in DataFacade.GetData<IUser>()\r\n                 where string.Compare(user.Username, newUser.Username, StringComparison.InvariantCultureIgnoreCase) == 0\r\n                 select user;\r\n\r\n            if (usersWithTheSameName.Any())\r\n            {\r\n                this.ShowFieldMessage(BindingNames.Username,\r\n                    LocalizationFiles.Composite_Management.AddNewUserWorkflow_UsernameDuplicateError);\r\n                \r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            IUser newUser = this.GetBinding<IUser>(BindingNames.NewUser);\r\n            var bindedUserFormLogin = this.GetBinding<IUserFormLogin>(BindingNames.UserFormLogin);\r\n\r\n            NormalizeUsername(newUser);\r\n\r\n            string password = this.GetBinding<string>(BindingNames.Password);\r\n\r\n            newUser = DataFacade.AddNew<IUser>(newUser);\r\n\r\n            UserFormLoginManager.CreateUserFormLogin(newUser.Id, password, bindedUserFormLogin.Folder);\r\n\r\n            string cultureName = this.GetBinding<string>(\"CultureName\");\r\n            string c1ConsoleUiLanguageName = this.GetBinding<string>(\"C1ConsoleUiLanguageName\");\r\n\r\n            UserSettings.SetUserCultureInfo(newUser.Username, CultureInfo.CreateSpecificCulture(cultureName));\r\n            UserSettings.SetUserC1ConsoleUiLanguage(newUser.Username, CultureInfo.CreateSpecificCulture(c1ConsoleUiLanguageName));\r\n\r\n            CultureInfo locale = DataLocalizationFacade.DefaultLocalizationCulture;\r\n\r\n            UserSettings.AddActiveLocaleCultureInfo(newUser.Username, locale);\r\n            UserSettings.SetCurrentActiveLocaleCultureInfo(newUser.Username, locale);\r\n            UserSettings.SetForeignLocaleCultureInfo(newUser.Username, locale);\r\n\r\n            this.CloseCurrentView();\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(newUser.GetDataEntityToken());\r\n\r\n            LoggingService.LogEntry(\"UserManagement\",\r\n                $\"New C1 Console user '{newUser.Username}' created by '{UserValidationFacade.GetUsername()}'.\", \r\n                LoggingService.Category.Audit,\r\n                TraceEventType.Information);\r\n\r\n\r\n            this.ExecuteWorklow(newUser.GetDataEntityToken(), typeof(EditUserWorkflow));\r\n        }\r\n\r\n\r\n\r\n        private static void NormalizeUsername(IUser user)\r\n        {\r\n            // User names are lower-cased\r\n            user.Username =  user.Username.Trim().ToLowerInvariant();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/AddNewUserWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    partial class AddNewUserWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step1CodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingActiveLanguageCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.ifElseActivity_ActiveLanguagesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // step1CodeActivity\r\n            // \r\n            this.step1CodeActivity.Name = \"step1CodeActivity\";\r\n            this.step1CodeActivity.ExecuteCode += new System.EventHandler(this.step1CodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finishState\";\r\n            // \r\n            // MissingActiveLanguageCodeActivity\r\n            // \r\n            this.MissingActiveLanguageCodeActivity.Name = \"MissingActiveLanguageCodeActivity\";\r\n            this.MissingActiveLanguageCodeActivity.ExecuteCode += new System.EventHandler(this.MissingActiveLanguageCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.step1CodeActivity);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsUserValid);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.MissingActiveLanguageCodeActivity);\r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.initializeCodeActivity);\r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity2);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckActiveLanguagesExists);\r\n            this.ifElseBranchActivity3.Condition = codecondition2;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finishState\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewUserStep1.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // ifElseActivity_ActiveLanguagesExists\r\n            // \r\n            this.ifElseActivity_ActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity_ActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity_ActiveLanguagesExists.Name = \"ifElseActivity_ActiveLanguagesExists\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity6);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity_ActiveLanguagesExists);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // AddNewUserWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewUserWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finishState;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity step1CodeActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElseActivity_ActiveLanguagesExists;\r\n        private SetStateActivity setStateActivity7;\r\n        private CodeActivity MissingActiveLanguageCodeActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/AddNewUserWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewUserWorkflow\" Location=\"30; 30\" Size=\"840; 541\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddNewUserWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"AddNewUserWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"139\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"275\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"285\" Y=\"282\" />\r\n\t\t\t\t<ns0:Point X=\"181\" Y=\"282\" />\r\n\t\t\t\t<ns0:Point X=\"181\" Y=\"294\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"275\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"291\" Y=\"164\" />\r\n\t\t\t\t<ns0:Point X=\"291\" Y=\"131\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"131\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"139\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"279\" Y=\"359\" />\r\n\t\t\t\t<ns0:Point X=\"519\" Y=\"359\" />\r\n\t\t\t\t<ns0:Point X=\"519\" Y=\"413\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"279\" Y=\"359\" />\r\n\t\t\t\t<ns0:Point X=\"293\" Y=\"359\" />\r\n\t\t\t\t<ns0:Point X=\"293\" Y=\"404\" />\r\n\t\t\t\t<ns0:Point X=\"181\" Y=\"404\" />\r\n\t\t\t\t<ns0:Point X=\"181\" Y=\"396\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"383\" />\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"383\" />\r\n\t\t\t\t<ns0:Point X=\"413\" Y=\"131\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"131\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"139\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity5\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"618\" Y=\"454\" />\r\n\t\t\t\t<ns0:Point X=\"629\" Y=\"454\" />\r\n\t\t\t\t<ns0:Point X=\"629\" Y=\"231\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"231\" />\r\n\t\t\t\t<ns0:Point X=\"581\" Y=\"219\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finishState\" Location=\"501; 139\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"69; 123\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 363\" Name=\"initializeStateInitializationActivity\" Location=\"77; 154\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity_ActiveLanguagesExists\" Location=\"87; 216\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity3\" Location=\"106; 287\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"116; 349\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"116; 409\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity4\" Location=\"279; 287\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingActiveLanguageCodeActivity\" Location=\"289; 349\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"289; 409\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"76; 294\" Size=\"211; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"84; 325\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"94; 387\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 423\" Name=\"step1EventDrivenActivity_Finish\" Location=\"84; 349\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"209; 411\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity1\" Location=\"94; 471\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"113; 542\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"123; 634\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity2\" Location=\"286; 542\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity\" Location=\"296; 604\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"296; 664\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"84; 373\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"94; 435\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"94; 495\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"417; 413\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"375; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"385; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"385; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"385; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/DeleteUserWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Diagnostics;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Logging;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteUserWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private bool _deleteSelf;\r\n\r\n\r\n\r\n        public DeleteUserWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void IsDeleteSelf(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = _deleteSelf;\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IUser user = (IUser)dataEntityToken.Data;\r\n\r\n            _deleteSelf = user.Username == UserValidationFacade.GetUsername();\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            \r\n            IUser user = (IUser)dataEntityToken.Data;\r\n\r\n            if (!DataFacade.WillDeleteSucceed(user))\r\n            {\r\n                this.ShowMessage(\r\n                    DialogType.Error,\r\n                    LocalizationFiles.Composite_Management.DeleteUserWorkflow_CascadeDeleteErrorTitle,\r\n                    LocalizationFiles.Composite_Management.DeleteUserWorkflow_CascadeDeleteErrorMessage);\r\n                return;\r\n            }\r\n\r\n            UserPerspectiveFacade.DeleteAll(user.Username);\r\n\r\n            DataFacade.Delete(user);\r\n\r\n            LoggingService.LogEntry(\"UserManagement\",\r\n                $\"C1 Console user '{user.Username}' deleted by '{UserValidationFacade.GetUsername()}'.\",\r\n                LoggingService.Category.Audit,\r\n                TraceEventType.Information);\r\n\r\n            this.CreateParentTreeRefresher().PostRefreshMessages(dataEntityToken, 2);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/DeleteUserWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    partial class DeleteUserWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showConsoleMessageBoxActivity1 = new Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1WizzardFormActivity = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finishState\";\r\n            // \r\n            // showConsoleMessageBoxActivity1\r\n            // \r\n            this.showConsoleMessageBoxActivity1.DialogType = Composite.C1Console.Events.DialogType.Error;\r\n            this.showConsoleMessageBoxActivity1.Message = \"${Composite.Management, DeleteUserWorkflow.DeleteSelfErrorMessage}\";\r\n            this.showConsoleMessageBoxActivity1.Name = \"showConsoleMessageBoxActivity1\";\r\n            this.showConsoleMessageBoxActivity1.Title = \"${Composite.Management, DeleteUserWorkflow.DeleteSelfTitle}\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.showConsoleMessageBoxActivity1);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsDeleteSelf);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finishState\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizzardFormActivity\r\n            // \r\n            this.step1WizzardFormActivity.ContainerLabel = null;\r\n            this.step1WizzardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\DeleteUserStep1.xml\";\r\n            this.step1WizzardFormActivity.Name = \"step1WizzardFormActivity\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizzardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // DeleteUserWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteUserWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finishState;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity step1WizzardFormActivity;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateActivity finalizeStateActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity showConsoleMessageBoxActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/DeleteUserWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteUserWorkflow\" Location=\"30; 30\" Size=\"1146; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteUserWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"DeleteUserWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"171\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"198\" />\r\n\t\t\t\t<ns0:Point X=\"338\" Y=\"198\" />\r\n\t\t\t\t<ns0:Point X=\"338\" Y=\"163\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"163\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"171\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"322\" Y=\"198\" />\r\n\t\t\t\t<ns0:Point X=\"336\" Y=\"198\" />\r\n\t\t\t\t<ns0:Point X=\"336\" Y=\"255\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"255\" />\r\n\t\t\t\t<ns0:Point X=\"288\" Y=\"267\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"386\" Y=\"332\" />\r\n\t\t\t\t<ns0:Point X=\"551\" Y=\"332\" />\r\n\t\t\t\t<ns0:Point X=\"551\" Y=\"389\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"390\" Y=\"356\" />\r\n\t\t\t\t<ns0:Point X=\"406\" Y=\"356\" />\r\n\t\t\t\t<ns0:Point X=\"406\" Y=\"163\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"163\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"171\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"650\" Y=\"430\" />\r\n\t\t\t\t<ns0:Point X=\"730\" Y=\"430\" />\r\n\t\t\t\t<ns0:Point X=\"730\" Y=\"163\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"163\" />\r\n\t\t\t\t<ns0:Point X=\"642\" Y=\"171\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finishState\" Location=\"562; 171\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"116; 157\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 423\" Name=\"initializeStateInitializationActivity\" Location=\"124; 188\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"249; 250\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity1\" Location=\"134; 310\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"153; 381\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showConsoleMessageBoxActivity1\" Location=\"163; 443\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"163; 503\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity2\" Location=\"326; 381\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"336; 473\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"183; 267\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"191; 298\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizzardFormActivity\" Location=\"201; 360\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"191; 322\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"201; 384\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"201; 444\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"191; 346\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"201; 408\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"201; 468\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"449; 389\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"528; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"538; 210\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"538; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"538; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/EditUserWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Xml;\r\nusing Composite.Plugins.Security.LoginProviderPlugins.DataBasedFormLoginProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Composite.Core.Logging;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Management;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    [EntityTokenLock]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditUserWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static string NotPassword { get { return Uri.UnescapeDataString(\"%C9%AF%C7%9D%C9%A5%CA%87pu%C4%B1qo%CA%87s%C9%AF%C9%94%C7%9Duo\"); } } // should be a very unlikely real life password\r\n\r\n        public EditUserWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private static class BindingNames\r\n        {\r\n            public const string User = \"User\";\r\n            public const string UserFormLogin = \"UserFormLogin\";\r\n            public const string NewPassword = \"NewPassword\";\r\n            public const string ActiveContentLanguage = \"ActiveLocaleName\";\r\n        }\r\n\r\n        private void CheckActiveLanguagesExists(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            e.Result = DataLocalizationFacade.ActiveLocalizationCultures.Any();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            var dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            var user = (IUser)dataEntityToken.Data;\r\n            var userFormLogin = user.GetUserFormLogin();\r\n\r\n            this.Bindings.Add(BindingNames.User, user);\r\n            this.Bindings.Add(BindingNames.UserFormLogin, userFormLogin);\r\n            this.Bindings.Add(BindingNames.NewPassword, NotPassword);\r\n\r\n            CultureInfo userCulture = UserSettings.GetUserCultureInfo(user.Username);\r\n            CultureInfo c1ConsoleUiLanguage = UserSettings.GetUserC1ConsoleUiLanguage(user.Username);\r\n\r\n            List<KeyValuePair> regionLanguageList = StringResourceSystemFacade.GetSupportedCulturesList();\r\n            Dictionary<string, string> culturesDictionary = StringResourceSystemFacade.GetAllCultures();\r\n\r\n            this.Bindings.Add(\"AllCultures\", culturesDictionary);\r\n            this.Bindings.Add(\"CultureName\", userCulture.Name);\r\n\r\n            this.Bindings.Add(\"C1ConsoleUiCultures\", regionLanguageList);\r\n            this.Bindings.Add(\"C1ConsoleUiLanguageName\", c1ConsoleUiLanguage.Name);\r\n\r\n            var currentActiveCulture = UserSettings.GetCurrentActiveLocaleCultureInfo(user.Username);\r\n            this.Bindings.Add(\"ActiveLocaleName\", currentActiveCulture != null ? currentActiveCulture.Name : null);\r\n            this.Bindings.Add(\"ActiveLocaleList\", DataLocalizationFacade.ActiveLocalizationCultures.ToDictionary(f => f.Name, DataLocalizationFacade.GetCultureTitle));\r\n\r\n            var clientValidationRules = new Dictionary<string, List<ClientValidationRule>>\r\n            {\r\n                {\"Username\", ClientValidationRuleFacade.GetClientValidationRules(user, \"Username\")},\r\n                {\"Group\", ClientValidationRuleFacade.GetClientValidationRules(user, \"Group\")}\r\n            };\r\n\r\n\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(@\"\\Administrative\\EditUserStep1.xml\");\r\n\r\n            XDocument formDocument;\r\n            using (var reader = markupProvider.GetReader())\r\n            {\r\n                formDocument = XDocument.Load(reader);\r\n            }\r\n\r\n            XElement bindingsElement = formDocument.Root.Element(DataTypeDescriptorFormsHelper.CmsNamespace + FormKeyTagNames.Bindings);\r\n            XElement layoutElement = formDocument.Root.Element(DataTypeDescriptorFormsHelper.CmsNamespace + FormKeyTagNames.Layout);\r\n            XElement tabPanelsElement = layoutElement.Element(DataTypeDescriptorFormsHelper.MainNamespace + \"TabPanels\");\r\n            List<XElement> placeHolderElements = tabPanelsElement.Elements(DataTypeDescriptorFormsHelper.MainNamespace + \"PlaceHolder\").ToList();\r\n\r\n            UpdateFormDefinitionWithUserGroups(user, bindingsElement, placeHolderElements[1]);\r\n            UpdateFormDefinitionWithActivePerspectives(user, bindingsElement, placeHolderElements[2]);\r\n            //UpdateFormDefinitionWithGlobalPermissions(user, bindingsElement, placeHolderElements[1]);\r\n\r\n            if (DataLocalizationFacade.ActiveLocalizationCultures.Any())\r\n            {\r\n                UpdateFormDefinitionWithActiveLocales(user, bindingsElement, placeHolderElements[1]);\r\n            }\r\n\r\n            string formDefinition = formDocument.GetDocumentAsString();\r\n\r\n            this.DeliverFormData(\r\n                    user.Username,\r\n                    StandardUiContainerTypes.Document,\r\n                    formDefinition,\r\n                    this.Bindings,\r\n                    clientValidationRules\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void UpdateFormDefinitionWithActivePerspectives(IUser user, XElement bindingsElement, XElement placeHolderElement)\r\n        {\r\n            List<string> serializedEntityToken = UserPerspectiveFacade.GetSerializedEntityTokens(user.Username).ToList();\r\n\r\n            var helper = new ActivePerspectiveFormsHelper(\r\n                    GetText(\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveFieldLabel\"),\r\n                    GetText(\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveMultiSelectLabel\"),\r\n                    GetText(\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveMultiSelectHelp\")\r\n                );\r\n\r\n            bindingsElement.Add(helper.GetBindingsMarkup());\r\n            placeHolderElement.Add(helper.GetFormMarkup());\r\n\r\n            helper.UpdateWithNewBindings(this.Bindings, serializedEntityToken);\r\n        }\r\n\r\n\r\n\r\n        private void UpdateFormDefinitionWithActiveLocales(IUser user, XElement bindingsElement, XElement placeHolderElement)\r\n        {\r\n            var helper = new ActiveLocalesFormsHelper(\r\n                    GetText(\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesFieldLabel\"),\r\n                    GetText(\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesMultiSelectLabel\"),\r\n                    GetText(\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesMultiSelectHelp\")\r\n                );\r\n\r\n            bindingsElement.Add(helper.GetBindingsMarkup());\r\n            placeHolderElement.Add(helper.GetFormMarkup());\r\n\r\n            helper.UpdateWithNewBindings(this.Bindings, UserSettings.GetActiveLocaleCultureInfos(user.Username, false));\r\n        }\r\n\r\n\r\n\r\n        private void UpdateFormDefinitionWithUserGroups(IUser user, XElement bindingsElement, XElement placeHolderElement)\r\n        {\r\n            var helper = new UserGroupsFormsHelper(\r\n                    GetText(\"Website.Forms.Administrative.EditUserStep1.UserGroupsFieldLabel\"),\r\n                    GetText(\"Website.Forms.Administrative.EditUserStep1.UserGroupsMultiSelectHelp\")\r\n                );\r\n\r\n            bindingsElement.Add(helper.GetBindingsMarkup());\r\n            placeHolderElement.Add(helper.GetFormMarkup());\r\n\r\n            List<Guid> relations = DataFacade.GetData<IUserUserGroupRelation>(f => f.UserId == user.Id).Select(f => f.UserGroupId).ToList();\r\n\r\n            helper.UpdateWithNewBindings(this.Bindings, relations);\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IUser user = this.GetBinding<IUser>(BindingNames.User);\r\n            var userFormLogin = GetBinding<IUserFormLogin>(BindingNames.UserFormLogin);\r\n\r\n            var userFormLoginFromDatabase = user.GetUserFormLogin();\r\n\r\n            bool userValidated = true;\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate(user);\r\n\r\n            foreach (ValidationResult result in validationResults)\r\n            {\r\n                this.ShowFieldMessage($\"{BindingNames.User}.{result.Key}\", result.Message);\r\n                userValidated = false;\r\n            }\r\n\r\n\r\n            List<CultureInfo> newActiveLocales = ActiveLocalesFormsHelper.GetSelectedLocalesTypes(this.Bindings).ToList();\r\n            List<CultureInfo> currentActiveLocales = UserSettings.GetActiveLocaleCultureInfos(user.Username, false).ToList();\r\n\r\n            string selectedActiveLocaleName = this.GetBinding<string>(\"ActiveLocaleName\");\r\n\r\n            CultureInfo selectedActiveLocale = CultureInfo.CreateSpecificCulture(selectedActiveLocaleName);\r\n\r\n            string systemPerspectiveEntityToken = EntityTokenSerializer.Serialize(AttachingPoint.SystemPerspective.EntityToken);\r\n\r\n            List<Guid> newUserGroupIds = UserGroupsFormsHelper.GetSelectedUserGroupIds(this.Bindings);\r\n            List<string> newSerializedEnitityTokens = ActivePerspectiveFormsHelper.GetSelectedSerializedEntityTokens(this.Bindings).ToList();\r\n\r\n\r\n            if (string.Compare(user.Username, UserSettings.Username, StringComparison.InvariantCultureIgnoreCase) == 0)\r\n            {\r\n                // Current user shouldn't be able to lock itself \r\n                if (userFormLogin.IsLocked)\r\n                {\r\n                    this.ShowMessage(DialogType.Message,\r\n                             Texts.EditUserWorkflow_EditErrorTitle,\r\n                             Texts.EditUserWorkflow_LockingOwnUserAccount);\r\n\r\n                    userValidated = false;\r\n                }\r\n\r\n                // Current user shouldn't be able to remove its own access to \"System\" perspective\r\n                var groupsWithAccessToSystemPerspective = new HashSet<Guid>(GetGroupsThatHasAccessToPerspective(systemPerspectiveEntityToken));\r\n\r\n                if (!newSerializedEnitityTokens.Contains(systemPerspectiveEntityToken)\r\n                    && !newUserGroupIds.Any(groupsWithAccessToSystemPerspective.Contains))\r\n                {\r\n                    this.ShowMessage(DialogType.Message,\r\n                             Texts.EditUserWorkflow_EditErrorTitle,\r\n                             Texts.EditUserWorkflow_EditOwnAccessToSystemPerspective);\r\n\r\n                    userValidated = false;\r\n                }\r\n            }\r\n\r\n            string newPassword = this.GetBinding<string>(BindingNames.NewPassword);\r\n            if (newPassword == NotPassword || UserFormLoginManager.ValidatePassword(userFormLoginFromDatabase, newPassword))\r\n            {\r\n                newPassword = null;\r\n            }\r\n            else\r\n            {\r\n                IList<string> validationMessages;\r\n                if (!PasswordPolicyFacade.ValidatePassword(user, newPassword, out validationMessages))\r\n                {\r\n                    foreach (var message in validationMessages)\r\n                    {\r\n                        this.ShowFieldMessage(BindingNames.NewPassword, message);\r\n                    }\r\n\r\n                    userValidated = false;\r\n                }\r\n            }\r\n\r\n            if (!userValidated)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (!userFormLogin.IsLocked)\r\n            {\r\n                userFormLogin.LockoutReason = (int)UserLockoutReason.Undefined;\r\n            }\r\n            else\r\n            {\r\n                bool wasLockedBefore = userFormLoginFromDatabase.IsLocked;\r\n\r\n                if (!wasLockedBefore)\r\n                {\r\n                    userFormLoginFromDatabase.LockoutReason = (int)UserLockoutReason.LockedByAdministrator;\r\n                }\r\n            }\r\n\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            bool reloadUsersConsoles = false;\r\n\r\n            using (var transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                DataFacade.Update(user);\r\n\r\n                userFormLoginFromDatabase.Folder = userFormLogin.Folder;\r\n                userFormLoginFromDatabase.IsLocked = userFormLogin.IsLocked;\r\n                DataFacade.Update(userFormLoginFromDatabase);\r\n\r\n                if (newPassword != null)\r\n                {\r\n                    UserFormLoginManager.SetPassword(userFormLoginFromDatabase, newPassword);\r\n                }\r\n\r\n                string cultureName = this.GetBinding<string>(\"CultureName\");\r\n                string c1ConsoleUiLanguageName = this.GetBinding<string>(\"C1ConsoleUiLanguageName\");\r\n\r\n                UserSettings.SetUserCultureInfo(user.Username, CultureInfo.CreateSpecificCulture(cultureName));\r\n                UserSettings.SetUserC1ConsoleUiLanguage(user.Username, CultureInfo.CreateSpecificCulture(c1ConsoleUiLanguageName));\r\n\r\n                List<string> existingSerializedEntityTokens = UserPerspectiveFacade.GetSerializedEntityTokens(user.Username).ToList();\r\n\r\n                int intersectCount = existingSerializedEntityTokens.Intersect(newSerializedEnitityTokens).Count();\r\n                if ((intersectCount != newSerializedEnitityTokens.Count)\r\n                    || (intersectCount != existingSerializedEntityTokens.Count))\r\n                {\r\n                    UserPerspectiveFacade.SetSerializedEntityTokens(user.Username, newSerializedEnitityTokens);\r\n\r\n                    if (UserSettings.Username == user.Username)\r\n                    {\r\n                        reloadUsersConsoles = true;\r\n                    }\r\n                }\r\n\r\n                if (DataLocalizationFacade.ActiveLocalizationCultures.Any())\r\n                {\r\n                    foreach (CultureInfo cultureInfo in newActiveLocales)\r\n                    {\r\n                        if (!currentActiveLocales.Contains(cultureInfo))\r\n                        {\r\n                            UserSettings.AddActiveLocaleCultureInfo(user.Username, cultureInfo);\r\n                        }\r\n                    }\r\n\r\n                    foreach (CultureInfo cultureInfo in currentActiveLocales)\r\n                    {\r\n                        if (!newActiveLocales.Contains(cultureInfo))\r\n                        {\r\n                            UserSettings.RemoveActiveLocaleCultureInfo(user.Username, cultureInfo);\r\n                        }\r\n                    }\r\n\r\n                    if (selectedActiveLocale != null)\r\n                    {\r\n                        if (!selectedActiveLocale.Equals(UserSettings.GetCurrentActiveLocaleCultureInfo(user.Username)))\r\n                        {\r\n                            reloadUsersConsoles = true;\r\n                        }\r\n\r\n                        UserSettings.SetCurrentActiveLocaleCultureInfo(user.Username, selectedActiveLocale);\r\n                    }\r\n                    else if (UserSettings.GetActiveLocaleCultureInfos(user.Username).Any())\r\n                    {\r\n                        UserSettings.SetCurrentActiveLocaleCultureInfo(user.Username, UserSettings.GetActiveLocaleCultureInfos(user.Username).First());\r\n                    }\r\n                }\r\n\r\n\r\n                List<IUserUserGroupRelation> oldRelations = DataFacade.GetData<IUserUserGroupRelation>(f => f.UserId == user.Id).ToList();\r\n\r\n                IEnumerable<IUserUserGroupRelation> deleteRelations =\r\n                    from r in oldRelations\r\n                    where !newUserGroupIds.Contains(r.UserGroupId)\r\n                    select r;\r\n\r\n                DataFacade.Delete(deleteRelations);\r\n\r\n\r\n                foreach (Guid newUserGroupId in newUserGroupIds)\r\n                {\r\n                    Guid groupId = newUserGroupId;\r\n                    if (oldRelations.Any(f => f.UserGroupId == groupId)) continue;\r\n\r\n                    var userUserGroupRelation = DataFacade.BuildNew<IUserUserGroupRelation>();\r\n                    userUserGroupRelation.UserId = user.Id;\r\n                    userUserGroupRelation.UserGroupId = newUserGroupId;\r\n\r\n                    DataFacade.AddNew(userUserGroupRelation);\r\n                }\r\n\r\n                LoggingService.LogEntry(\"UserManagement\",\r\n                    $\"C1 Console user '{user.Username}' updated by '{UserValidationFacade.GetUsername()}'.\",\r\n                    LoggingService.Category.Audit,\r\n                    TraceEventType.Information);\r\n\r\n                transactionScope.Complete();\r\n            }\r\n\r\n            if (UserSettings.GetCurrentActiveLocaleCultureInfo(user.Username) == null)\r\n            {\r\n                this.ShowFieldMessage(BindingNames.ActiveContentLanguage, \"The user doesn't have permissions to access the language you selected here. Assign permissions so the user may access this.\");\r\n                this.ShowMessage(DialogType.Warning, \"User missing permissions for language\", \"The user doesn't have permissions to access the language you selected as 'Active content language'.\");\r\n            }\r\n            else\r\n            {\r\n                if (reloadUsersConsoles)\r\n                {\r\n                    foreach (string consoleId in GetConsoleIdsOpenedByUser(user.Username))\r\n                    {\r\n                        ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), consoleId);\r\n                    }\r\n                }\r\n            }\r\n\r\n            SetSaveStatus(true);\r\n            updateTreeRefresher.PostRefreshMesseges(user.GetDataEntityToken());\r\n        }\r\n\r\n        private List<Guid> GetGroupsThatHasAccessToPerspective(string usersPerspectiveEntityToken)\r\n        {\r\n            return DataFacade.GetData<IUserGroupActivePerspective>()\r\n                             .Where(ug => ug.SerializedEntityToken == usersPerspectiveEntityToken)\r\n                             .Select(ug => ug.UserGroupId).ToList();\r\n        }\r\n\r\n        private void IsUserLoggedOn(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IUser user = (IUser)dataEntityToken.Data;\r\n\r\n            string selectedActiveLocaleName = (user.Username != UserSettings.Username ?\r\n                    this.GetBinding<string>(\"ActiveLocaleName\") :\r\n                    UserSettings.ActiveLocaleCultureInfo.ToString());\r\n\r\n            if (selectedActiveLocaleName != null)\r\n            {\r\n                CultureInfo selectedActiveLocale = CultureInfo.CreateSpecificCulture(selectedActiveLocaleName);\r\n\r\n                if (!selectedActiveLocale.Equals(UserSettings.GetCurrentActiveLocaleCultureInfo(user.Username)))\r\n                {\r\n                    e.Result = ConsoleFacade.GetConsoleIdsByUsername(user.Username).Any();\r\n                    return;\r\n                }\r\n            }\r\n\r\n            e.Result = false;\r\n        }\r\n\r\n\r\n\r\n        private void IsSameUser(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IUser user = (IUser)dataEntityToken.Data;\r\n\r\n            e.Result = user.Username == UserSettings.Username;\r\n        }\r\n\r\n\r\n\r\n        private void MissingActiveLanguageCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            FlowControllerServicesContainer flowControllerServicesContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            var managementConsoleMessageService = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();\r\n\r\n            managementConsoleMessageService.ShowMessage(\r\n                DialogType.Message,\r\n                GetText(\"UserElementProvider.MissingActiveLanguageTitle\"),\r\n                GetText(\"UserElementProvider.MissingActiveLanguageMessage\"));\r\n        }\r\n\r\n        private string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Management\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/EditUserWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserElementProvider\r\n{\r\n    partial class EditUserWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.showConsoleMessageBoxActivity2 = new Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity_IsUserLoggedOn = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingActiveLanguageCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.ifElseActivity_ActiveLanguagesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1SventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // showConsoleMessageBoxActivity2\r\n            // \r\n            this.showConsoleMessageBoxActivity2.DialogType = Composite.C1Console.Events.DialogType.Message;\r\n            this.showConsoleMessageBoxActivity2.Message = \"${Composite.Management, UserElementProvider.ChangeOtherActiveLocaleMessage}\";\r\n            this.showConsoleMessageBoxActivity2.Name = \"showConsoleMessageBoxActivity2\";\r\n            this.showConsoleMessageBoxActivity2.Title = \"${Composite.Management, UserElementProvider.ChangeOtherActiveLocaleTitle}\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.showConsoleMessageBoxActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsUserLoggedOn);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity_IsUserLoggedOn\r\n            // \r\n            this.ifElseActivity_IsUserLoggedOn.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity_IsUserLoggedOn.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity_IsUserLoggedOn.Name = \"ifElseActivity_IsUserLoggedOn\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finishState\";\r\n            // \r\n            // MissingActiveLanguageCodeActivity\r\n            // \r\n            this.MissingActiveLanguageCodeActivity.Name = \"MissingActiveLanguageCodeActivity\";\r\n            this.MissingActiveLanguageCodeActivity.ExecuteCode += new System.EventHandler(this.MissingActiveLanguageCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.ifElseActivity_IsUserLoggedOn);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsSameUser);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.MissingActiveLanguageCodeActivity);\r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.initializeCodeActivity);\r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity2);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckActiveLanguagesExists);\r\n            this.ifElseBranchActivity5.Condition = codecondition3;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // ifElseActivity_ActiveLanguagesExists\r\n            // \r\n            this.ifElseActivity_ActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElseActivity_ActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity_ActiveLanguagesExists.Name = \"ifElseActivity_ActiveLanguagesExists\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // step1SventDrivenActivity_Save\r\n            // \r\n            this.step1SventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.step1SventDrivenActivity_Save.Activities.Add(this.ifElseActivity1);\r\n            this.step1SventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.step1SventDrivenActivity_Save.Name = \"step1SventDrivenActivity_Save\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity_ActiveLanguagesExists);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1SventDrivenActivity_Save);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // initializeActivity\r\n            // \r\n            this.initializeActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeActivity.Name = \"initializeActivity\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // EditUserWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.initializeActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeActivity\";\r\n            this.Name = \"EditUserWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finishState;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity initializeActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private EventDrivenActivity step1SventDrivenActivity_Save;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElseActivity_IsUserLoggedOn;\r\n        private Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity showConsoleMessageBoxActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseActivity ifElseActivity_ActiveLanguagesExists;\r\n        private SetStateActivity setStateActivity5;\r\n        private CodeActivity MissingActiveLanguageCodeActivity;\r\n        private CodeActivity saveCodeActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserElementProvider/EditUserWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditUserWorkflow\" Location=\"30; 30\" Size=\"1217; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditUserWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"EditUserWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"790\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"790\" Y=\"195\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"257\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"253\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"initializeActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"257\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"790\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"790\" Y=\"195\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1SventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"397\" Y=\"318\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"318\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"346\" />\r\n\t\t\t\t<ns0:Point X=\"550\" Y=\"346\" />\r\n\t\t\t\t<ns0:Point X=\"550\" Y=\"338\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"637\" Y=\"299\" />\r\n\t\t\t\t<ns0:Point X=\"662\" Y=\"299\" />\r\n\t\t\t\t<ns0:Point X=\"662\" Y=\"245\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"245\" />\r\n\t\t\t\t<ns0:Point X=\"302\" Y=\"253\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finishState\" Location=\"710; 195\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"initializeActivity\" Location=\"51; 101\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 363\" Name=\"initializeStateInitializationActivity\" Location=\"59; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity_ActiveLanguagesExists\" Location=\"69; 194\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity5\" Location=\"88; 265\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"98; 327\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"98; 387\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity6\" Location=\"261; 265\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingActiveLanguageCodeActivity\" Location=\"271; 327\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"271; 387\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"199; 253\" Size=\"207; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 109\" Name=\"step1StateInitializationActivity\" Location=\"324; 135\" />\r\n\t\t\t\t<EventDrivenDesigner Size=\"612; 604\" Name=\"step1SventDrivenActivity_Save\" Location=\"332; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"573; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 403\" Name=\"ifElseActivity1\" Location=\"342; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 303\" Name=\"ifElseBranchActivity1\" Location=\"361; 341\" />\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 303\" Name=\"ifElseBranchActivity2\" Location=\"534; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity_IsUserLoggedOn\" Location=\"544; 403\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity3\" Location=\"563; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showConsoleMessageBoxActivity2\" Location=\"573; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity4\" Location=\"736; 474\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"573; 692\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"448; 258\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveStateInitializationActivity\" Location=\"456; 289\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"466; 351\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"466; 411\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/AddNewUserGroupWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider\r\n{\r\n    partial class AddNewUserGroupWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showDataValidateErrorCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showGroupValidationErrorCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ValidateGroupName_step1IfElseBranchActivity = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Finalize = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1WizardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.globalEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // showDataValidateErrorCodeActivity\r\n            // \r\n            this.showDataValidateErrorCodeActivity.Name = \"showDataValidateErrorCodeActivity\";\r\n            this.showDataValidateErrorCodeActivity.ExecuteCode += new System.EventHandler(this.ShowDataValidateErrorCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.showDataValidateErrorCodeActivity);\r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateData);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // showGroupValidationErrorCodeActivity\r\n            // \r\n            this.showGroupValidationErrorCodeActivity.Name = \"showGroupValidationErrorCodeActivity\";\r\n            this.showGroupValidationErrorCodeActivity.ExecuteCode += new System.EventHandler(this.ShowGroupValidationError);\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.showGroupValidationErrorCodeActivity);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ValidateGroupName_step1IfElseBranchActivity\r\n            // \r\n            this.ValidateGroupName_step1IfElseBranchActivity.Activities.Add(this.ifElseActivity2);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateGroupName);\r\n            this.ValidateGroupName_step1IfElseBranchActivity.Condition = codecondition2;\r\n            this.ValidateGroupName_step1IfElseBranchActivity.Name = \"ValidateGroupName_step1IfElseBranchActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalActivity\";\r\n            // \r\n            // finalizeCodeActivity_Finalize\r\n            // \r\n            this.finalizeCodeActivity_Finalize.Name = \"finalizeCodeActivity_Finalize\";\r\n            this.finalizeCodeActivity_Finalize.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Finalize_ExecuteCode);\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ValidateGroupName_step1IfElseBranchActivity);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1WizardFormActivity\r\n            // \r\n            this.step1WizardFormActivity.ContainerLabel = null;\r\n            this.step1WizardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\UserGroupElementProviderAddNewUserGroupStep1.xml\";\r\n            this.step1WizardFormActivity.Name = \"step1WizardFormActivity\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Finalize);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1WizardFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // globalEventDrivenActivity_Cancel\r\n            // \r\n            this.globalEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.globalEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.globalEventDrivenActivity_Cancel.Name = \"globalEventDrivenActivity_Cancel\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalActivity\r\n            // \r\n            this.finalActivity.Name = \"finalActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // AddNewUserGroupWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.globalEventDrivenActivity_Cancel);\r\n            this.CompletedStateName = \"finalActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewUserGroupWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalActivity;\r\n        private StateActivity step1StateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private SetStateActivity setStateActivity3;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ValidateGroupName_step1IfElseBranchActivity;\r\n        private IfElseActivity ifElseActivity1;\r\n        private CodeActivity showGroupValidationErrorCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step1WizardFormActivity;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private CodeActivity finalizeCodeActivity_Finalize;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity globalEventDrivenActivity_Cancel;\r\n        private SetStateActivity setStateActivity5;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity2;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity showDataValidateErrorCodeActivity;\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/AddNewUserGroupWorkflow.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Diagnostics;\r\nusing System.Drawing;\r\nusing System.Linq;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data.Validation;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewUserGroupWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewUserGroupWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IUserGroup userGroup = DataFacade.BuildNew<IUserGroup>();\r\n            userGroup.Id = Guid.NewGuid();\r\n\r\n            this.Bindings.Add(\"NewUserGroup\", userGroup);\r\n        }\r\n\r\n\r\n\r\n        private void ValidateGroupName(object sender, ConditionalEventArgs e)\r\n        {\r\n            IUserGroup userGroup = this.GetBinding<IUserGroup>(\"NewUserGroup\");\r\n\r\n            bool exists =\r\n                (from ug in DataFacade.GetData<IUserGroup>()\r\n                 where ug.Name == userGroup.Name\r\n                 select ug).Any();\r\n\r\n            e.Result = exists == false;\r\n        }\r\n\r\n\r\n\r\n        private void ShowGroupValidationError(object sender, EventArgs e)\r\n        {\r\n            this.ShowFieldMessage(\r\n                \"NewUserGroup.Name\",\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameAlreadyExists\"));\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            IUserGroup userGroup = this.GetBinding<IUserGroup>(\"NewUserGroup\");\r\n\r\n            userGroup = DataFacade.AddNew<IUserGroup>(userGroup);\r\n\r\n            this.CloseCurrentView();\r\n\r\n            LoggingService.LogEntry(\"UserManagement\",\r\n                $\"New C1 Console user group '{userGroup.Name}' created by '{UserValidationFacade.GetUsername()}'.\", \r\n                LoggingService.Category.Audit,\r\n                TraceEventType.Information);\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(userGroup.GetDataEntityToken());\r\n\r\n            this.ExecuteWorklow(userGroup.GetDataEntityToken(), typeof(EditUserGroupWorkflow));\r\n\r\n        }\r\n\r\n\r\n\r\n        private void ValidateData(object sender, ConditionalEventArgs e)\r\n        {\r\n            IUserGroup userGroup = this.GetBinding<IUserGroup>(\"NewUserGroup\");\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate<IUserGroup>(userGroup);\r\n            e.Result = validationResults.IsValid;\r\n        }\r\n\r\n\r\n\r\n        private void ShowDataValidateErrorCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IUserGroup userGroup = this.GetBinding<IUserGroup>(\"NewUserGroup\");\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate<IUserGroup>(userGroup);\r\n            \r\n            this.ShowFieldMessage(\r\n                \"NewUserGroup.Name\",\r\n                validationResults.First().Message);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/AddNewUserGroupWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewUserGroupWorkflow\" Location=\"30; 30\" Size=\"1153; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"AddNewUserGroupWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalActivity\" SourceActivity=\"AddNewUserGroupWorkflow\" EventHandlerName=\"globalEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"239\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"824\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"824\" Y=\"583\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"252\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"379\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"379\" Y=\"197\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"479\" Y=\"262\" />\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"262\" />\r\n\t\t\t\t<ns0:Point X=\"661\" Y=\"366\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"487\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"499\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"499\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"387\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"387\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"760\" Y=\"407\" />\r\n\t\t\t\t<ns0:Point X=\"824\" Y=\"407\" />\r\n\t\t\t\t<ns0:Point X=\"824\" Y=\"583\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"46; 101\" Size=\"227; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"54; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"64; 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"64; 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalActivity\" Location=\"744; 583\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"276; 197\" Size=\"207; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"292; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1WizardFormActivity\" Location=\"302; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"612; 604\" Name=\"step1EventDrivenActivity_Finish\" Location=\"300; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"541; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 463\" Name=\"ifElseActivity1\" Location=\"310; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 363\" Name=\"ValidateGroupName_step1IfElseBranchActivity\" Location=\"329; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity2\" Location=\"339; 403\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"358; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"368; 566\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity3\" Location=\"531; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"showDataValidateErrorCodeActivity\" Location=\"541; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"541; 596\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 363\" Name=\"ifElseBranchActivity2\" Location=\"733; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"showGroupValidationErrorCodeActivity\" Location=\"743; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"743; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"559; 366\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"567; 397\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Finalize\" Location=\"577; 459\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"577; 519\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"globalEventDrivenActivity_Cancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/DeleteUserGroupWorkflow.cs",
    "content": "﻿using System;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Actions;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Logging;\r\nusing Composite.C1Console.Security;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider\r\n{\r\n    public sealed partial class DeleteUserGroupWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteUserGroupWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void HasUsers(object sender, ConditionalEventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IUserGroup userGroup = (IUserGroup)dataEntityToken.Data;\r\n\r\n            e.Result = DataFacade.GetData<IUserUserGroupRelation>(f => f.UserGroupId == userGroup.Id).Any();\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ShowMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(DialogType.Message,\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"DeleteUserGroup.DeleteUserGroupInitialStep.UserGroupHasUsersTitle\"),\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"DeleteUserGroup.DeleteUserGroupInitialStep.UserGroupHasUsersMessage\")\r\n                );\r\n        }\r\n\r\n\r\n        private void finalizeCodeActivity_Delete_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher deleteTreeRefresher = CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IUserGroup userGroup = (IUserGroup)dataEntityToken.Data;\r\n\r\n            DataFacade.Delete(userGroup);\r\n\r\n            LoggingService.LogEntry(\"UserManagement\",\r\n                $\"C1 Console user group '{userGroup.Name}' deleted by '{UserValidationFacade.GetUsername()}'.\", \r\n                LoggingService.Category.Audit,\r\n                TraceEventType.Information);\r\n\r\n            deleteTreeRefresher.PostRefreshMesseges();\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/DeleteUserGroupWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider\r\n{\r\n    partial class DeleteUserGroupWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_ShowMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_Delete = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.step1ConfirmDialogFormActivity = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.ifElseActivity_HasUsers = new System.Workflow.Activities.IfElseActivity();\r\n            this.finalizesStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivit_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // initializeCodeActivity_ShowMessage\r\n            // \r\n            this.initializeCodeActivity_ShowMessage.Name = \"initializeCodeActivity_ShowMessage\";\r\n            this.initializeCodeActivity_ShowMessage.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ShowMessage_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.initializeCodeActivity_ShowMessage);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasUsers);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizeCodeActivity_Delete\r\n            // \r\n            this.finalizeCodeActivity_Delete.Name = \"finalizeCodeActivity_Delete\";\r\n            this.finalizeCodeActivity_Delete.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_Delete_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // step1ConfirmDialogFormActivity\r\n            // \r\n            this.step1ConfirmDialogFormActivity.ContainerLabel = null;\r\n            this.step1ConfirmDialogFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\UserGroupElementProviderDeleteUserGroupStep1.xml\";\r\n            this.step1ConfirmDialogFormActivity.Name = \"step1ConfirmDialogFormActivity\";\r\n            // \r\n            // ifElseActivity_HasUsers\r\n            // \r\n            this.ifElseActivity_HasUsers.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity_HasUsers.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity_HasUsers.Name = \"ifElseActivity_HasUsers\";\r\n            // \r\n            // finalizesStateInitializationActivity\r\n            // \r\n            this.finalizesStateInitializationActivity.Activities.Add(this.finalizeCodeActivity_Delete);\r\n            this.finalizesStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizesStateInitializationActivity.Name = \"finalizesStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivit_Cancel\r\n            // \r\n            this.step1EventDrivenActivit_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivit_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivit_Cancel.Name = \"step1EventDrivenActivit_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1ConfirmDialogFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity_HasUsers);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizesStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivit_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // DeleteUserGroupWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteUserGroupWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private StateInitializationActivity finalizesStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivit_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity step1ConfirmDialogFormActivity;\r\n        private CodeActivity finalizeCodeActivity_Delete;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity_HasUsers;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity initializeCodeActivity_ShowMessage;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/DeleteUserGroupWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteUserGroupWorkflow\" Location=\"30; 30\" Size=\"1217; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteUserGroupWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteUserGroupWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"393\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"393\" Y=\"353\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"493\" Y=\"418\" />\r\n\t\t\t\t<ns0:Point X=\"659\" Y=\"418\" />\r\n\t\t\t\t<ns0:Point X=\"659\" Y=\"517\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivit_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"491\" Y=\"442\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"442\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizesStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"760\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"558\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 363\" Name=\"initializeStateInitializationActivity\" Location=\"448; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity_HasUsers\" Location=\"458; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"477; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_ShowMessage\" Location=\"487; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"487; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity2\" Location=\"650; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"660; 373\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"290; 353\" Size=\"207; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"298; 384\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1ConfirmDialogFormActivity\" Location=\"308; 446\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"298; 408\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"308; 470\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"308; 530\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivit_Cancel\" Location=\"298; 432\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"308; 494\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"308; 554\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"554; 517\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizesStateInitializationActivity\" Location=\"562; 548\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_Delete\" Location=\"572; 610\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"572; 670\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/EditUserGroupWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Logging;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.DataServices;\r\nusing Composite.C1Console.Forms.Flows;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Plugins.Elements.ElementProviders.UserElementProvider;\r\nusing Composite.Data.Validation;\r\nusing Composite.Data.Validation.ClientValidationRules;\r\nusing Composite.Core.Xml;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\nusing SR = Composite.Core.ResourceSystem.StringResourceSystemFacade;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider\r\n{\r\n    public sealed partial class EditUserGroupWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditUserGroupWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void initalizeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IUserGroup userGroup = (IUserGroup)dataEntityToken.Data;\r\n\r\n            this.Bindings.Add(\"UserGroup\", userGroup);\r\n            this.Bindings.Add(\"OldName\", userGroup.Name);\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_ShowDocument_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IFormMarkupProvider markupProvider = new FormDefinitionFileMarkupProvider(@\"\\Administrative\\UserGroupElementProviderEditUserGroupStep1.xml\");\r\n\r\n            XDocument formDocument;\r\n            using (var reader = markupProvider.GetReader())\r\n            {\r\n                formDocument = XDocument.Load(reader);\r\n            }\r\n\r\n            XElement bindingsElement = formDocument.Root.Element(DataTypeDescriptorFormsHelper.CmsNamespace + FormKeyTagNames.Bindings);\r\n            XElement layoutElement = formDocument.Root.Element(DataTypeDescriptorFormsHelper.CmsNamespace + FormKeyTagNames.Layout);\r\n            XElement placeHolderElement = layoutElement.Element(DataTypeDescriptorFormsHelper.MainNamespace + \"PlaceHolder\");\r\n\r\n\r\n            IUserGroup userGroup = this.GetBinding<IUserGroup>(\"UserGroup\");\r\n\r\n            UpdateFormDefinitionWithActivePerspectives(userGroup, bindingsElement, placeHolderElement);\r\n            UpdateFormDefinitionWithGlobalPermissions(userGroup, bindingsElement, placeHolderElement);\r\n            UpdateFormDefinitionWithActiveLocalePermissions(userGroup, bindingsElement, placeHolderElement);\r\n\r\n            var clientValidationRules = new Dictionary<string, List<ClientValidationRule>>();\r\n            clientValidationRules.Add(\"Name\", ClientValidationRuleFacade.GetClientValidationRules(userGroup, \"Name\"));\r\n\r\n            string formDefinition = formDocument.GetDocumentAsString();\r\n\r\n            this.DeliverFormData(\r\n                    userGroup.Name,\r\n                    StandardUiContainerTypes.Document,\r\n                    formDefinition,\r\n                    this.Bindings,\r\n                    clientValidationRules\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private void ValidateGroupName(object sender, ConditionalEventArgs e)\r\n        {\r\n            IUserGroup userGroup = this.GetBinding<IUserGroup>(\"UserGroup\");\r\n\r\n            if (userGroup.Name == this.GetBinding<string>(\"OldName\"))\r\n            {\r\n                e.Result = true;\r\n                return;\r\n            }\r\n\r\n            bool exists =\r\n                (from ug in DataFacade.GetData<IUserGroup>()\r\n                 where ug.Name == userGroup.Name\r\n                 select ug).Any();\r\n\r\n            e.Result = !exists;\r\n        }\r\n\r\n\r\n\r\n        private void ShowGroupValidationError(object sender, EventArgs e)\r\n        {\r\n            this.ShowFieldMessage(\r\n                \"UserGroup.Name\",\r\n                SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.UserGroupNameAlreadyExists\"));\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_Save_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IUserGroup userGroup = this.GetBinding<IUserGroup>(\"UserGroup\");\r\n            List<string> newUserGroupEntityTokens = ActivePerspectiveFormsHelper.GetSelectedSerializedEntityTokens(this.Bindings).ToList();\r\n\r\n            // If current user belongs to currently edited group -> checking that user won't lost access \"Users\" perspective\r\n            if (!ValidateUserPreservesAdminRights(userGroup, newUserGroupEntityTokens))\r\n            {\r\n                return;\r\n            }\r\n\r\n            UpdateTreeRefresher updateTreeRefresher = CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            EntityToken rootEntityToken = ElementFacade.GetRootsWithNoSecurity().Select(f => f.ElementHandle.EntityToken).Single();\r\n            IEnumerable<PermissionType> newPermissionTypes = GlobalPermissionsFormsHelper.GetSelectedPermissionTypes(this.Bindings);\r\n\r\n            UserGroupPermissionDefinition userGroupPermissionDefinition =\r\n                        new ConstructorBasedUserGroupPermissionDefinition(\r\n                            userGroup.Id,\r\n                            newPermissionTypes,\r\n                            EntityTokenSerializer.Serialize(rootEntityToken)\r\n                        );\r\n\r\n            PermissionTypeFacade.SetUserGroupPermissionDefinition(userGroupPermissionDefinition);\r\n\r\n            UserGroupPerspectiveFacade.SetSerializedEntityTokens(userGroup.Id, newUserGroupEntityTokens);\r\n\r\n            List<CultureInfo> selectedUserGroupActiveLocales = ActiveLocalesFormsHelper.GetSelectedLocalesTypes(this.Bindings).ToList();\r\n\r\n            using (var connection = new DataConnection())\r\n            {\r\n                var existingLocales = connection.Get<IUserGroupActiveLocale>().Where(f=> f.UserGroupId == userGroup.Id).ToList();\r\n                var toDelete = existingLocales.Where(f => !selectedUserGroupActiveLocales.Contains(new CultureInfo(f.CultureName)));\r\n                connection.Delete<IUserGroupActiveLocale>(toDelete);\r\n\r\n                foreach (var localeToAdd in selectedUserGroupActiveLocales.Where(f => !existingLocales.Any(g => g.CultureName == f.Name)))\r\n                {\r\n                    var toAdd = connection.CreateNew<IUserGroupActiveLocale>();\r\n                    toAdd.Id = Guid.NewGuid();\r\n                    toAdd.UserGroupId = userGroup.Id;\r\n                    toAdd.CultureName = localeToAdd.Name;\r\n                    connection.Add(toAdd);\r\n                }\r\n            }\r\n\r\n            SetSaveStatus(true);\r\n\r\n            LoggingService.LogEntry(\"UserManagement\", \r\n                $\"C1 Console user group '{userGroup.Name}' updated by '{UserValidationFacade.GetUsername()}'.\", \r\n                LoggingService.Category.Audit,\r\n                TraceEventType.Information);\r\n\r\n            if (userGroup.Name != this.GetBinding<string>(\"OldName\"))\r\n            {\r\n                DataFacade.Update(userGroup);\r\n\r\n                this.UpdateBinding(\"OldName\", userGroup.Name);\r\n\r\n                updateTreeRefresher.PostRefreshMesseges(userGroup.GetDataEntityToken());\r\n            }\r\n        }\r\n\r\n        private bool ValidateUserPreservesAdminRights(IUserGroup userGroup, List<string> newUserGroupEntityTokens)\r\n        {\r\n            string systemPerspectiveEntityToken = EntityTokenSerializer.Serialize(AttachingPoint.SystemPerspective.EntityToken);\r\n\r\n            Guid groupId = userGroup.Id;\r\n            string userName = UserSettings.Username;\r\n\r\n            var userGroupIds = UserGroupFacade.GetUserGroupIds(userName);\r\n\r\n            HashSet<Guid> groupsWithAccessToSystemPerspective = new HashSet<Guid>(GetGroupsThatHasAccessToPerspective(systemPerspectiveEntityToken));\r\n\r\n            if (groupsWithAccessToSystemPerspective.Contains(groupId)\r\n                && !newUserGroupEntityTokens.Contains(systemPerspectiveEntityToken)\r\n                && !UserPerspectiveFacade.GetSerializedEntityTokens(userName).Contains(systemPerspectiveEntityToken)\r\n                && !userGroupIds.Any(anotherGroupId => anotherGroupId != groupId && groupsWithAccessToSystemPerspective.Contains(anotherGroupId)))\r\n            {\r\n                this.ShowMessage(DialogType.Message,\r\n                            SR.GetString(\"Composite.Management\", \"EditUserWorkflow.EditErrorTitle\"),\r\n                            SR.GetString(\"Composite.Management\", \"EditUserWorkflow.EditOwnAccessToSystemPerspective\"));\r\n\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n        private List<Guid> GetGroupsThatHasAccessToPerspective(string usersPerspectiveEntityToken)\r\n        {\r\n            return DataFacade.GetData<IUserGroupActivePerspective>()\r\n                             .Where(ug => ug.SerializedEntityToken == usersPerspectiveEntityToken)\r\n                             .Select(ug => ug.UserGroupId).ToList();\r\n        }\r\n\r\n        private void UpdateFormDefinitionWithGlobalPermissions(IUserGroup userGroup, XElement bindingsElement, XElement placeHolderElement)\r\n        {\r\n            var helper = new GlobalPermissionsFormsHelper(\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.GlobalPermissionsFieldLabel\"),\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.GlobalPermissionsMultiSelectLabel\"),\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.GlobalPermissionsMultiSelectHelp\")\r\n                );\r\n\r\n            bindingsElement.Add(helper.GetBindingsMarkup());\r\n            placeHolderElement.Add(helper.GetFormMarkup());\r\n\r\n            EntityToken rootEntityToken = ElementFacade.GetRootsWithNoSecurity().Select(f => f.ElementHandle.EntityToken).Single();\r\n            IEnumerable<PermissionType> permissionTypes = PermissionTypeFacade.GetLocallyDefinedUserGroupPermissionTypes(userGroup.Id, rootEntityToken).ToList();\r\n\r\n            helper.UpdateWithNewBindings(this.Bindings, permissionTypes);\r\n        }\r\n\r\n        private void UpdateFormDefinitionWithActiveLocalePermissions(IUserGroup userGroup, XElement bindingsElement, XElement placeHolderElement)\r\n        {\r\n            var helper = new ActiveLocalesFormsHelper(\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.ActiveLocalesFieldLabel\"),\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.ActiveLocalesMultiSelectLabel\"),\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.ActiveLocalesMultiSelectHelp\")\r\n                );\r\n\r\n            bindingsElement.Add(helper.GetBindingsMarkup());\r\n            placeHolderElement.Add(helper.GetFormMarkup());\r\n\r\n            EntityToken rootEntityToken = ElementFacade.GetRootsWithNoSecurity().Select(f => f.ElementHandle.EntityToken).Single();\r\n\r\n            using (var connection = new DataConnection())\r\n            {\r\n                IEnumerable<CultureInfo> activeCultures = null;\r\n                activeCultures = connection.Get<IUserGroupActiveLocale>().Where(f => f.UserGroupId == userGroup.Id).Select(f => new CultureInfo(f.CultureName));\r\n                helper.UpdateWithNewBindings(this.Bindings, activeCultures);\r\n            }\r\n\r\n        }\r\n\r\n\r\n\r\n        private void UpdateFormDefinitionWithActivePerspectives(IUserGroup userGroup, XElement bindingsElement, XElement placeHolderElement)\r\n        {\r\n            List<string> serializedEntityToken = UserGroupPerspectiveFacade.GetSerializedEntityTokens(userGroup.Id).ToList();\r\n\r\n            var helper = new ActivePerspectiveFormsHelper(\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.ActivePerspectiveFieldLabel\"),\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.ActivePerspectiveMultiSelectLabel\"),\r\n                    SR.GetString(\"Composite.Plugins.UserGroupElementProvider\", \"EditUserGroup.EditUserGroupStep1.ActivePerspectiveMultiSelectHelp\")\r\n                );\r\n\r\n            bindingsElement.Add(helper.GetBindingsMarkup());\r\n            placeHolderElement.Add(helper.GetFormMarkup());\r\n\r\n            helper.UpdateWithNewBindings(this.Bindings, serializedEntityToken);\r\n        }\r\n\r\n        private void ValidateData(object sender, ConditionalEventArgs e)\r\n        {\r\n            IUserGroup userGroup = this.GetBinding<IUserGroup>(\"UserGroup\");\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate<IUserGroup>(userGroup);\r\n            e.Result = validationResults.IsValid;\r\n            if (!validationResults.IsValid)\r\n            {\r\n                this.ShowFieldMessage(\r\n                    \"UserGroup.Name\",\r\n                    validationResults.First().Message);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/EditUserGroupWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.UserGroupElementProvider\r\n{\r\n    partial class EditUserGroupWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step1CodeActivity_ShowErrorMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity_Save = new System.Workflow.Activities.CodeActivity();\r\n            this.step1DocumentFormActivity = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.step1CodeActivity_ShowDocument = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.conditionalSetStateActivity1 = new Composite.C1Console.Workflow.Activities.ConditionalSetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initalizeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateData);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // step1CodeActivity_ShowErrorMessage\r\n            // \r\n            this.step1CodeActivity_ShowErrorMessage.Name = \"step1CodeActivity_ShowErrorMessage\";\r\n            this.step1CodeActivity_ShowErrorMessage.ExecuteCode += new System.EventHandler(this.ShowGroupValidationError);\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.step1CodeActivity_ShowErrorMessage);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity1.Activities.Add(this.ifElseActivity2);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateGroupName);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // saveCodeActivity_Save\r\n            // \r\n            this.saveCodeActivity_Save.Name = \"saveCodeActivity_Save\";\r\n            this.saveCodeActivity_Save.ExecuteCode += new System.EventHandler(this.saveCodeActivity_Save_ExecuteCode);\r\n            // \r\n            // step1DocumentFormActivity\r\n            // \r\n            this.step1DocumentFormActivity.ContainerLabel = null;\r\n            this.step1DocumentFormActivity.CustomToolbarDefinitionFileName = null;\r\n            this.step1DocumentFormActivity.Enabled = false;\r\n            this.step1DocumentFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\UserGroupElementProviderEditUserGroupStep1.xml\";\r\n            this.step1DocumentFormActivity.Name = \"step1DocumentFormActivity\";\r\n            // \r\n            // step1CodeActivity_ShowDocument\r\n            // \r\n            this.step1CodeActivity_ShowDocument.Name = \"step1CodeActivity_ShowDocument\";\r\n            this.step1CodeActivity_ShowDocument.ExecuteCode += new System.EventHandler(this.step1CodeActivity_ShowDocument_ExecuteCode);\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // conditionalSetStateActivity1\r\n            // \r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ValidateData);\r\n            this.conditionalSetStateActivity1.Condition = codecondition3;\r\n            this.conditionalSetStateActivity1.FalseTargetStateName = \"step1StateActivity\";\r\n            this.conditionalSetStateActivity1.Name = \"conditionalSetStateActivity1\";\r\n            this.conditionalSetStateActivity1.TrueTargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initalizeCodeActivity_Initialize\r\n            // \r\n            this.initalizeCodeActivity_Initialize.Name = \"initalizeCodeActivity_Initialize\";\r\n            this.initalizeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initalizeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity_Save);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity5);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.step1CodeActivity_ShowDocument);\r\n            this.step1StateInitializationActivity.Activities.Add(this.step1DocumentFormActivity);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Save\r\n            // \r\n            this.step1EventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Save.Activities.Add(this.conditionalSetStateActivity1);\r\n            this.step1EventDrivenActivity_Save.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Save.Name = \"step1EventDrivenActivity_Save\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initalizeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity3);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Save);\r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // EditUserGroupWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditUserGroupWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private EventDrivenActivity step1EventDrivenActivity_Save;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity step1CodeActivity_ShowErrorMessage;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity3;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity saveStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity step1DocumentFormActivity;\r\n        private CodeActivity initalizeCodeActivity_Initialize;\r\n        private CodeActivity saveCodeActivity_Save;\r\n        private CodeActivity step1CodeActivity_ShowDocument;\r\n        private SetStateActivity setStateActivity7;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElseActivity2;\r\n        private Composite.C1Console.Workflow.Activities.ConditionalSetStateActivity conditionalSetStateActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/UserGroupElementProvider/EditUserGroupWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditUserGroupWorkflow\" Location=\"30; 30\" Size=\"1153; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditUserGroupWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditUserGroupWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"479\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"479\" Y=\"433\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"576\" Y=\"498\" />\r\n\t\t\t\t<ns0:Point X=\"592\" Y=\"498\" />\r\n\t\t\t\t<ns0:Point X=\"592\" Y=\"280\" />\r\n\t\t\t\t<ns0:Point X=\"743\" Y=\"280\" />\r\n\t\t\t\t<ns0:Point X=\"743\" Y=\"288\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"482\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"497\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"497\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"385\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"385\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"576\" Y=\"498\" />\r\n\t\t\t\t<ns0:Point X=\"592\" Y=\"498\" />\r\n\t\t\t\t<ns0:Point X=\"592\" Y=\"280\" />\r\n\t\t\t\t<ns0:Point X=\"743\" Y=\"280\" />\r\n\t\t\t\t<ns0:Point X=\"743\" Y=\"288\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"482\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"497\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"497\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"385\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"385\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"836\" Y=\"329\" />\r\n\t\t\t\t<ns0:Point X=\"847\" Y=\"329\" />\r\n\t\t\t\t<ns0:Point X=\"847\" Y=\"421\" />\r\n\t\t\t\t<ns0:Point X=\"479\" Y=\"421\" />\r\n\t\t\t\t<ns0:Point X=\"479\" Y=\"433\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initalizeCodeActivity_Initialize\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"378; 433\" Size=\"202; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<EventDrivenDesigner Size=\"612; 664\" Name=\"step1EventDrivenActivity_Save\" Location=\"300; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"541; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"conditionalSetStateActivity1\" Location=\"541; 270\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 463\" Name=\"ifElseActivity1\" Location=\"310; 330\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 363\" Name=\"ifElseBranchActivity1\" Location=\"329; 401\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"454; 463\" />\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity2\" Location=\"339; 523\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity3\" Location=\"358; 594\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"368; 656\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity4\" Location=\"531; 594\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"541; 656\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 363\" Name=\"ifElseBranchActivity2\" Location=\"733; 401\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_ShowErrorMessage\" Location=\"743; 463\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"743; 523\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"step1StateInitializationActivity\" Location=\"292; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_ShowDocument\" Location=\"302; 197\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step1DocumentFormActivity\" Location=\"302; 257\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"647; 288\" Size=\"193; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveStateInitializationActivity\" Location=\"655; 319\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity_Save\" Location=\"665; 381\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"665; 441\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/AddNewVisualFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewVisualFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewVisualFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private void CheckPageTemplatesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = PageTemplateFacade.ValidTemplateExists;\r\n        }\r\n\r\n\r\n\r\n        private void CheckActiveLanguageExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = UserSettings.ActiveLocaleCultureInfo != null;\r\n        }\r\n\r\n\r\n\r\n        private void MissingActiveLanguageActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(\r\n                DialogType.Message,\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"AddNew.MissingActiveLanguageTitle\"),\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"AddNew.MissingActiveLanguageMessage\"));\r\n        }\r\n\r\n\r\n\r\n        private void stepInitialize_codeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            List<Type> dataTypes = DataFacade.GetAllInterfaces(UserType.Developer);\r\n            dataTypes.RemoveAll(t => t.FullName.StartsWith(\"Composite.Data.Types\"));\r\n\r\n            this.Bindings = new Dictionary<string, object>\r\n            {\r\n                {\"SelectedType\", typeof (IData)},\r\n                {\"TypeOptions\", dataTypes}\r\n            };\r\n        }\r\n\r\n\r\n\r\n        private void prepareFunctionObject_codeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataTypeDescriptor dataTypeDescriptor = GetDataTypeDescriptor();\r\n\r\n            var function = DataFacade.BuildNew<IVisualFunction>();\r\n\r\n            function.Id = Guid.NewGuid();\r\n            function.Name = FunctionFacade.BuildUniqueFunctionName(dataTypeDescriptor.Namespace, string.Format(\"{0}Rendering\", dataTypeDescriptor.Name));\r\n            function.Namespace = dataTypeDescriptor.Namespace;\r\n            function.TypeManagerName = dataTypeDescriptor.TypeManagerTypeName;\r\n            function.Description = \"\";\r\n\r\n            this.UpdateBinding(\"Function\", function);\r\n        }\r\n\r\n\r\n\r\n        private DataTypeDescriptor GetDataTypeDescriptor()\r\n        {\r\n            Type sourceDataType = GetSourceDataType();\r\n\r\n            DataTypeDescriptor dataTypeDescriptor = null;\r\n            if (DynamicTypeManager.TryGetDataTypeDescriptor(sourceDataType, out dataTypeDescriptor) == false)\r\n            {\r\n                dataTypeDescriptor = DynamicTypeManager.BuildNewDataTypeDescriptor(sourceDataType);\r\n            }\r\n\r\n            return dataTypeDescriptor;\r\n        }\r\n\r\n\r\n\r\n        private Type GetSourceDataType()\r\n        {\r\n            return this.GetBinding<Type>(\"SelectedType\");\r\n        }\r\n\r\n\r\n\r\n        private void stepFinalize_codeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher updateTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            IVisualFunction newFunction = this.GetBinding<IVisualFunction>(\"Function\");\r\n\r\n            newFunction.MaximumItemsToList = 10;\r\n            newFunction.OrderbyAscending = true;\r\n            newFunction.OrderbyFieldName = (GetDataTypeDescriptor().LabelFieldName ?? GetDataTypeDescriptor().Fields.First().Name);\r\n\r\n            XhtmlDocument defaultDocument = BuildDefaultDocument(newFunction);\r\n\r\n            newFunction.XhtmlTemplate = defaultDocument.ToString();\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n\r\n            var createdFunction = DataFacade.AddNew<IVisualFunction>(newFunction);\r\n\r\n            this.ExecuteWorklow(createdFunction.GetDataEntityToken(), typeof(EditVisualFunctionWorkflow));\r\n        }\r\n\r\n        private static XhtmlDocument BuildDefaultDocument(IVisualFunction newFunction)\r\n        {\r\n            XElement htmlTable = new XElement(Namespaces.Xhtml + \"table\");\r\n\r\n            Type interfaceType = TypeManager.GetType(newFunction.TypeManagerName);\r\n            DataTypeDescriptor typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n            foreach (DataFieldDescriptor dataField in typeDescriptor.Fields.OrderBy(f => f.Position))\r\n            {\r\n                if (!typeDescriptor.KeyPropertyNames.Contains(dataField.Name)\r\n                    && dataField.FormRenderingProfile != null \r\n                    && !string.IsNullOrEmpty(dataField.FormRenderingProfile.Label))\r\n                {\r\n                    string fieldMarkup = string.Format(\"<data:fieldreference fieldname=\\\"{0}\\\" typemanagername=\\\"{1}\\\" xmlns:data=\\\"{2}\\\" />\", dataField.Name, newFunction.TypeManagerName, Namespaces.DynamicData10);\r\n\r\n                    htmlTable.Add(new XElement(Namespaces.Xhtml + \"tr\",\r\n                        new XElement(Namespaces.Xhtml + \"td\",\r\n                            dataField.FormRenderingProfile.Label),\r\n                        new XElement(Namespaces.Xhtml + \"td\",\r\n                            XElement.Parse(fieldMarkup))));\r\n                }\r\n            }\r\n            XhtmlDocument defaultDocument = new XhtmlDocument();\r\n            defaultDocument.Body.Add(htmlTable);\r\n            return defaultDocument;\r\n        }\r\n\r\n\r\n\r\n        private void CheckFunctionNameIsUnique(object sender, ConditionalEventArgs e)\r\n        {\r\n            IVisualFunction function = this.GetBinding<IVisualFunction>(\"Function\");\r\n\r\n            string functionFullName = $\"{function.Namespace}.{function.Name}\";\r\n\r\n            e.Result = !FunctionFacade.FunctionNames.Contains(functionFullName);\r\n        }\r\n\r\n\r\n\r\n        private void CheckDataExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            Type type = GetSourceDataType();\r\n\r\n            e.Result = DataFacade.GetData(type).Any();\r\n        }\r\n\r\n\r\n        private void CheckTypesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = (this.GetBinding<List<Type>>(\"TypeOptions\")).Count > 0;\r\n        }\r\n\r\n\r\n        private void CheckTypeNameIsDynamicType(object sender, ConditionalEventArgs e)\r\n        {\r\n            Type type = GetSourceDataType();\r\n\r\n            Guid immutableTypeId;\r\n\r\n            e.Result = type != null && type.TryGetImmutableTypeId(out immutableTypeId);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/AddNewVisualFunctionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider\r\n{\r\n    partial class AddNewVisualFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition5 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition6 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingPageActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity9 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.missingDataMessageBoxActivity = new Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.abortFlowSetStateActivity = new System.Workflow.Activities.SetStateActivity();\r\n            this.noTypesMessageBoxActivity = new Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity();\r\n            this.ifElseActivity_CheckPageExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranch_heckDataExists = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity8 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity7 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showFieldMessageActivity2 = new Composite.C1Console.Workflow.Activities.ShowFieldMessageActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity12 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showConsoleMessageBoxActivity_NoTemplate = new Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity();\r\n            this.ifElseActivity3 = new System.Workflow.Activities.IfElseActivity();\r\n            this.backTostep2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.showFieldMessageActivity1 = new Composite.C1Console.Workflow.Activities.ShowFieldMessageActivity();\r\n            this.setStateActivity11 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranch_CheckTypeNameIsDynamicType = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity11 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity10 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.handleExternalEventActivity1 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.ifElseActivity5 = new System.Workflow.Activities.IfElseActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifNameUniqueActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.handleExternalEventActivity3 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.handleExternalEventActivity2 = new System.Workflow.Activities.HandleExternalEventActivity();\r\n            this.step2WizzardFormActivity = new Composite.C1Console.Workflow.Activities.WizardFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.stepFinalize_codeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.step1_eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1_eventDrivenActivity_Next = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step2_eventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2_eventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2_eventDrivenActivity_Previous = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step2StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1State = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step2State = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finishState\";\r\n            // \r\n            // MissingPageActivity\r\n            // \r\n            this.MissingPageActivity.Name = \"MissingPageActivity\";\r\n            this.MissingPageActivity.ExecuteCode += new System.EventHandler(this.MissingActiveLanguageActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1State\";\r\n            // \r\n            // ifElseBranchActivity9\r\n            // \r\n            this.ifElseBranchActivity9.Activities.Add(this.MissingPageActivity);\r\n            this.ifElseBranchActivity9.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity9.Name = \"ifElseBranchActivity9\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity4);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckActiveLanguageExists);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1State\";\r\n            // \r\n            // missingDataMessageBoxActivity\r\n            // \r\n            this.missingDataMessageBoxActivity.DialogType = Composite.C1Console.Events.DialogType.Error;\r\n            this.missingDataMessageBoxActivity.Message = \"${Composite.Plugins.VisualFunction,AddNew.NoDataExistsErrorMessage}\";\r\n            this.missingDataMessageBoxActivity.Name = \"missingDataMessageBoxActivity\";\r\n            this.missingDataMessageBoxActivity.Title = \"${Composite.Plugins.VisualFunction,AddNew.NoDataExistsErrorTitle}\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"step2State\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.prepareFunctionObject_codeActivity_ExecuteCode);\r\n            // \r\n            // abortFlowSetStateActivity\r\n            // \r\n            this.abortFlowSetStateActivity.Name = \"abortFlowSetStateActivity\";\r\n            this.abortFlowSetStateActivity.TargetStateName = \"finishState\";\r\n            // \r\n            // noTypesMessageBoxActivity\r\n            // \r\n            this.noTypesMessageBoxActivity.DialogType = Composite.C1Console.Events.DialogType.Message;\r\n            this.noTypesMessageBoxActivity.Message = \"${Composite.Plugins.VisualFunction,AddNew.NoTypesExistsErrorMessage}\";\r\n            this.noTypesMessageBoxActivity.Name = \"noTypesMessageBoxActivity\";\r\n            this.noTypesMessageBoxActivity.Title = \"${Composite.Plugins.VisualFunction,AddNew.NoTypesExistsErrorTitle}\";\r\n            // \r\n            // ifElseActivity_CheckPageExists\r\n            // \r\n            this.ifElseActivity_CheckPageExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity_CheckPageExists.Activities.Add(this.ifElseBranchActivity9);\r\n            this.ifElseActivity_CheckPageExists.Name = \"ifElseActivity_CheckPageExists\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.missingDataMessageBoxActivity);\r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranch_heckDataExists\r\n            // \r\n            this.ifElseBranch_heckDataExists.Activities.Add(this.codeActivity1);\r\n            this.ifElseBranch_heckDataExists.Activities.Add(this.setStateActivity3);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckDataExists);\r\n            this.ifElseBranch_heckDataExists.Condition = codecondition2;\r\n            this.ifElseBranch_heckDataExists.Name = \"ifElseBranch_heckDataExists\";\r\n            // \r\n            // ifElseBranchActivity8\r\n            // \r\n            this.ifElseBranchActivity8.Activities.Add(this.noTypesMessageBoxActivity);\r\n            this.ifElseBranchActivity8.Activities.Add(this.abortFlowSetStateActivity);\r\n            this.ifElseBranchActivity8.Name = \"ifElseBranchActivity8\";\r\n            // \r\n            // ifElseBranchActivity7\r\n            // \r\n            this.ifElseBranchActivity7.Activities.Add(this.ifElseActivity_CheckPageExists);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckTypesExists);\r\n            this.ifElseBranchActivity7.Condition = codecondition3;\r\n            this.ifElseBranchActivity7.Name = \"ifElseBranchActivity7\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1State\";\r\n            // \r\n            // showFieldMessageActivity2\r\n            // \r\n            this.showFieldMessageActivity2.FieldBindingPath = \"TypeName\";\r\n            this.showFieldMessageActivity2.Message = \"Specified type is not a dynamic type\";\r\n            this.showFieldMessageActivity2.Name = \"showFieldMessageActivity2\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranch_heckDataExists);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // setStateActivity12\r\n            // \r\n            this.setStateActivity12.Name = \"setStateActivity12\";\r\n            this.setStateActivity12.TargetStateName = \"finishState\";\r\n            // \r\n            // showConsoleMessageBoxActivity_NoTemplate\r\n            // \r\n            this.showConsoleMessageBoxActivity_NoTemplate.DialogType = Composite.C1Console.Events.DialogType.Message;\r\n            this.showConsoleMessageBoxActivity_NoTemplate.Message = \"${Composite.Plugins.VisualFunction,AddNew.NoPageTemplatesExistsErrorMessa\" +\r\n                \"ge}\";\r\n            this.showConsoleMessageBoxActivity_NoTemplate.Name = \"showConsoleMessageBoxActivity_NoTemplate\";\r\n            this.showConsoleMessageBoxActivity_NoTemplate.Title = \"${Composite.Plugins.VisualFunction,AddNew.NoPageTemplatesExistsErrorTitle\" +\r\n                \"}\";\r\n            // \r\n            // ifElseActivity3\r\n            // \r\n            this.ifElseActivity3.Activities.Add(this.ifElseBranchActivity7);\r\n            this.ifElseActivity3.Activities.Add(this.ifElseBranchActivity8);\r\n            this.ifElseActivity3.Name = \"ifElseActivity3\";\r\n            // \r\n            // backTostep2\r\n            // \r\n            this.backTostep2.Name = \"backTostep2\";\r\n            this.backTostep2.TargetStateName = \"step2State\";\r\n            // \r\n            // showFieldMessageActivity1\r\n            // \r\n            this.showFieldMessageActivity1.FieldBindingPath = \"Function.Name\";\r\n            this.showFieldMessageActivity1.Message = \"${Composite.Plugins.VisualFunction, VisualFunctionElementProvider.Functio\" +\r\n                \"nNameNotUniqueError}\";\r\n            this.showFieldMessageActivity1.Name = \"showFieldMessageActivity1\";\r\n            // \r\n            // setStateActivity11\r\n            // \r\n            this.setStateActivity11.Name = \"setStateActivity11\";\r\n            this.setStateActivity11.TargetStateName = \"finalizeActivity\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.showFieldMessageActivity2);\r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity2);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranch_CheckTypeNameIsDynamicType\r\n            // \r\n            this.ifElseBranch_CheckTypeNameIsDynamicType.Activities.Add(this.ifElseActivity2);\r\n            codecondition4.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckTypeNameIsDynamicType);\r\n            this.ifElseBranch_CheckTypeNameIsDynamicType.Condition = codecondition4;\r\n            this.ifElseBranch_CheckTypeNameIsDynamicType.Name = \"ifElseBranch_CheckTypeNameIsDynamicType\";\r\n            // \r\n            // ifElseBranchActivity11\r\n            // \r\n            this.ifElseBranchActivity11.Activities.Add(this.showConsoleMessageBoxActivity_NoTemplate);\r\n            this.ifElseBranchActivity11.Activities.Add(this.setStateActivity12);\r\n            this.ifElseBranchActivity11.Name = \"ifElseBranchActivity11\";\r\n            // \r\n            // ifElseBranchActivity10\r\n            // \r\n            this.ifElseBranchActivity10.Activities.Add(this.ifElseActivity3);\r\n            codecondition5.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckPageTemplatesExists);\r\n            this.ifElseBranchActivity10.Condition = codecondition5;\r\n            this.ifElseBranchActivity10.Name = \"ifElseBranchActivity10\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.showFieldMessageActivity1);\r\n            this.ifElseBranchActivity2.Activities.Add(this.backTostep2);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity11);\r\n            codecondition6.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckFunctionNameIsUnique);\r\n            this.ifElseBranchActivity1.Condition = codecondition6;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranch_CheckTypeNameIsDynamicType);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // handleExternalEventActivity1\r\n            // \r\n            this.handleExternalEventActivity1.EventName = \"Next\";\r\n            this.handleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity1.Name = \"handleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = \"Add new\";\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewVisualFunctionStep1.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // ifElseActivity5\r\n            // \r\n            this.ifElseActivity5.Activities.Add(this.ifElseBranchActivity10);\r\n            this.ifElseActivity5.Activities.Add(this.ifElseBranchActivity11);\r\n            this.ifElseActivity5.Name = \"ifElseActivity5\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.stepInitialize_codeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // ifNameUniqueActivity1\r\n            // \r\n            this.ifNameUniqueActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifNameUniqueActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifNameUniqueActivity1.Name = \"ifNameUniqueActivity1\";\r\n            // \r\n            // handleExternalEventActivity3\r\n            // \r\n            this.handleExternalEventActivity3.EventName = \"Finish\";\r\n            this.handleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity3.Name = \"handleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1State\";\r\n            // \r\n            // handleExternalEventActivity2\r\n            // \r\n            this.handleExternalEventActivity2.EventName = \"Previous\";\r\n            this.handleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.handleExternalEventActivity2.Name = \"handleExternalEventActivity2\";\r\n            // \r\n            // step2WizzardFormActivity\r\n            // \r\n            this.step2WizzardFormActivity.ContainerLabel = \"Add new\";\r\n            this.step2WizzardFormActivity.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewVisualFunctionStep2.xml\";\r\n            this.step2WizzardFormActivity.Name = \"step2WizzardFormActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finishState\";\r\n            // \r\n            // stepFinalize_codeActivity\r\n            // \r\n            this.stepFinalize_codeActivity.Name = \"stepFinalize_codeActivity\";\r\n            this.stepFinalize_codeActivity.ExecuteCode += new System.EventHandler(this.stepFinalize_codeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // step1_eventDrivenActivity_Cancel\r\n            // \r\n            this.step1_eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1_eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity7);\r\n            this.step1_eventDrivenActivity_Cancel.Name = \"step1_eventDrivenActivity_Cancel\";\r\n            // \r\n            // step1_eventDrivenActivity_Next\r\n            // \r\n            this.step1_eventDrivenActivity_Next.Activities.Add(this.handleExternalEventActivity1);\r\n            this.step1_eventDrivenActivity_Next.Activities.Add(this.ifElseActivity1);\r\n            this.step1_eventDrivenActivity_Next.Name = \"step1_eventDrivenActivity_Next\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity5);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // step2_eventDrivenActivity_Cancel\r\n            // \r\n            this.step2_eventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.step2_eventDrivenActivity_Cancel.Activities.Add(this.setStateActivity8);\r\n            this.step2_eventDrivenActivity_Cancel.Name = \"step2_eventDrivenActivity_Cancel\";\r\n            // \r\n            // step2_eventDrivenActivity_Finish\r\n            // \r\n            this.step2_eventDrivenActivity_Finish.Activities.Add(this.handleExternalEventActivity3);\r\n            this.step2_eventDrivenActivity_Finish.Activities.Add(this.ifNameUniqueActivity1);\r\n            this.step2_eventDrivenActivity_Finish.Name = \"step2_eventDrivenActivity_Finish\";\r\n            // \r\n            // step2_eventDrivenActivity_Previous\r\n            // \r\n            this.step2_eventDrivenActivity_Previous.Activities.Add(this.handleExternalEventActivity2);\r\n            this.step2_eventDrivenActivity_Previous.Activities.Add(this.setStateActivity6);\r\n            this.step2_eventDrivenActivity_Previous.Name = \"step2_eventDrivenActivity_Previous\";\r\n            // \r\n            // step2StateInitializationActivity\r\n            // \r\n            this.step2StateInitializationActivity.Activities.Add(this.step2WizzardFormActivity);\r\n            this.step2StateInitializationActivity.Name = \"step2StateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.stepFinalize_codeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1State\r\n            // \r\n            this.step1State.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Next);\r\n            this.step1State.Activities.Add(this.step1_eventDrivenActivity_Cancel);\r\n            this.step1State.Name = \"step1State\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity19);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // initializeActivity\r\n            // \r\n            this.initializeActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeActivity.Name = \"initializeActivity\";\r\n            // \r\n            // step2State\r\n            // \r\n            this.step2State.Activities.Add(this.step2StateInitializationActivity);\r\n            this.step2State.Activities.Add(this.step2_eventDrivenActivity_Previous);\r\n            this.step2State.Activities.Add(this.step2_eventDrivenActivity_Finish);\r\n            this.step2State.Activities.Add(this.step2_eventDrivenActivity_Cancel);\r\n            this.step2State.Name = \"step2State\";\r\n            // \r\n            // finalizeActivity\r\n            // \r\n            this.finalizeActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeActivity.Name = \"finalizeActivity\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // AddNewVisualFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.finalizeActivity);\r\n            this.Activities.Add(this.step2State);\r\n            this.Activities.Add(this.initializeActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.step1State);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeActivity\";\r\n            this.Name = \"AddNewVisualFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity step2StateInitializationActivity;\r\n        private HandleExternalEventActivity handleExternalEventActivity3;\r\n        private EventDrivenActivity step2_eventDrivenActivity_Finish;\r\n        private StateActivity finishState;\r\n        private StateActivity finalizeActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private CodeActivity stepFinalize_codeActivity;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity initializeActivity;\r\n        private SetStateActivity setStateActivity11;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity step2WizzardFormActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private SetStateActivity setStateActivity19;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifNameUniqueActivity1;\r\n        private SetStateActivity backTostep2;\r\n        private Composite.C1Console.Workflow.Activities.ShowFieldMessageActivity showFieldMessageActivity1;\r\n        private StateActivity step1State;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private EventDrivenActivity step1_eventDrivenActivity_Next;\r\n        private HandleExternalEventActivity handleExternalEventActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranch_CheckTypeNameIsDynamicType;\r\n        private IfElseActivity ifElseActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity missingDataMessageBoxActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity codeActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranch_heckDataExists;\r\n        private IfElseActivity ifElseActivity2;\r\n        private Composite.C1Console.Workflow.Activities.WizardFormActivity wizzardFormActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity6;\r\n        private HandleExternalEventActivity handleExternalEventActivity2;\r\n        private EventDrivenActivity step2_eventDrivenActivity_Previous;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.ShowFieldMessageActivity showFieldMessageActivity2;\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity abortFlowSetStateActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity8;\r\n        private IfElseBranchActivity ifElseBranchActivity7;\r\n        private IfElseActivity ifElseActivity3;\r\n        private Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity noTypesMessageBoxActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity8;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private EventDrivenActivity step1_eventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step2_eventDrivenActivity_Cancel;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity9;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElseActivity_CheckPageExists;\r\n        private SetStateActivity setStateActivity9;\r\n        private CodeActivity MissingPageActivity;\r\n        private SetStateActivity setStateActivity12;\r\n        private Composite.C1Console.Workflow.Activities.ShowConsoleMessageBoxActivity showConsoleMessageBoxActivity_NoTemplate;\r\n        private IfElseBranchActivity ifElseBranchActivity11;\r\n        private IfElseBranchActivity ifElseBranchActivity10;\r\n        private IfElseActivity ifElseActivity5;\r\n        private StateActivity step2State;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/AddNewVisualFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewVisualFunctionWorkflow\" Location=\"30; 30\" Size=\"1145; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity19\" SourceStateName=\"AddNewVisualFunctionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"AddNewVisualFunctionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"177\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity1\" SourceStateName=\"finalizeActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"finalizeActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"638\" Y=\"489\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"489\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"257\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1State\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity6\" SourceStateName=\"step2State\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1State\" SourceActivity=\"step2State\" EventHandlerName=\"step2_eventDrivenActivity_Previous\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"531\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"531\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"179\" Y=\"422\" />\r\n\t\t\t\t<ns0:Point X=\"179\" Y=\"410\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity11\" SourceStateName=\"step2State\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeActivity\" SourceActivity=\"step2State\" EventHandlerName=\"step2_eventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"555\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"555\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"440\" />\r\n\t\t\t\t<ns0:Point X=\"543\" Y=\"440\" />\r\n\t\t\t\t<ns0:Point X=\"543\" Y=\"448\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2State\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Bottom\" SetStateName=\"backTostep2\" SourceStateName=\"step2State\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2State\" SourceActivity=\"step2State\" EventHandlerName=\"step2_eventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"283\" Y=\"555\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"555\" />\r\n\t\t\t\t<ns0:Point X=\"307\" Y=\"600\" />\r\n\t\t\t\t<ns0:Point X=\"187\" Y=\"600\" />\r\n\t\t\t\t<ns0:Point X=\"187\" Y=\"592\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"3\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"step2State\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"step2State\" EventHandlerName=\"step2_eventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"287\" Y=\"579\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"579\" />\r\n\t\t\t\t<ns0:Point X=\"312\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"177\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"abortFlowSetStateActivity\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"initializeActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"257\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"177\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1State\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1State\" SourceActivity=\"initializeActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"257\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"267\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"267\" Y=\"296\" />\r\n\t\t\t\t<ns0:Point X=\"179\" Y=\"296\" />\r\n\t\t\t\t<ns0:Point X=\"179\" Y=\"308\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"initializeActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"257\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"177\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1State\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity2\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1State\" SourceActivity=\"step1State\" EventHandlerName=\"step1_eventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"418\" />\r\n\t\t\t\t<ns0:Point X=\"179\" Y=\"418\" />\r\n\t\t\t\t<ns0:Point X=\"179\" Y=\"410\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step2State\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" TargetActivity=\"step2State\" SourceActivity=\"step1State\" EventHandlerName=\"step1_eventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"454\" />\r\n\t\t\t\t<ns0:Point X=\"187\" Y=\"454\" />\r\n\t\t\t\t<ns0:Point X=\"187\" Y=\"466\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1State\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1State\" SourceActivity=\"step1State\" EventHandlerName=\"step1_eventDrivenActivity_Next\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"299\" Y=\"300\" />\r\n\t\t\t\t<ns0:Point X=\"179\" Y=\"300\" />\r\n\t\t\t\t<ns0:Point X=\"179\" Y=\"308\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"step1State\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"step1State\" EventHandlerName=\"step1_eventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"279\" Y=\"397\" />\r\n\t\t\t\t<ns0:Point X=\"304\" Y=\"397\" />\r\n\t\t\t\t<ns0:Point X=\"304\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"177\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finishState\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity12\" SourceStateName=\"initializeActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finishState\" SourceActivity=\"initializeActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"257\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"217\" />\r\n\t\t\t\t<ns0:Point X=\"273\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"770\" Y=\"177\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finishState\" Location=\"690; 177\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"finalizeActivity\" Location=\"437; 448\" Size=\"213; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"445; 479\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"455; 541\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"stepFinalize_codeActivity\" Location=\"455; 601\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"455; 661\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step2State\" Location=\"74; 466\" Size=\"226; 126\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step2StateInitializationActivity\" Location=\"82; 497\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"step2WizzardFormActivity\" Location=\"92; 559\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2_eventDrivenActivity_Previous\" Location=\"82; 521\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"handleExternalEventActivity2\" Location=\"92; 583\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"92; 643\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 423\" Name=\"step2_eventDrivenActivity_Finish\" Location=\"82; 545\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"handleExternalEventActivity3\" Location=\"207; 607\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifNameUniqueActivity1\" Location=\"92; 667\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"111; 738\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity11\" Location=\"121; 824\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity2\" Location=\"284; 738\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showFieldMessageActivity1\" Location=\"294; 800\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"backTostep2\" Location=\"294; 860\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step2_eventDrivenActivity_Cancel\" Location=\"82; 569\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"92; 631\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"92; 691\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"initializeActivity\" Location=\"51; 176\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"843; 785\" Name=\"initializeStateInitializationActivity\" Location=\"181; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"537; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"823; 644\" Name=\"ifElseActivity5\" Location=\"191; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"612; 544\" Name=\"ifElseBranchActivity10\" Location=\"210; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"592; 463\" Name=\"ifElseActivity3\" Location=\"220; 403\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 363\" Name=\"ifElseBranchActivity7\" Location=\"239; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity_CheckPageExists\" Location=\"249; 536\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity3\" Location=\"268; 607\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"278; 699\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity9\" Location=\"441; 607\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingPageActivity\" Location=\"451; 669\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"451; 729\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 363\" Name=\"ifElseBranchActivity8\" Location=\"643; 474\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"noTypesMessageBoxActivity\" Location=\"653; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"abortFlowSetStateActivity\" Location=\"653; 596\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 544\" Name=\"ifElseBranchActivity11\" Location=\"845; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showConsoleMessageBoxActivity_NoTemplate\" Location=\"855; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity12\" Location=\"855; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity19\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1State\" Location=\"66; 308\" Size=\"226; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"74; 339\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"84; 401\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"612; 604\" Name=\"step1_eventDrivenActivity_Next\" Location=\"74; 363\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"handleExternalEventActivity1\" Location=\"315; 425\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 463\" Name=\"ifElseActivity1\" Location=\"84; 485\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 363\" Name=\"ifElseBranch_CheckTypeNameIsDynamicType\" Location=\"103; 556\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity2\" Location=\"113; 618\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranch_heckDataExists\" Location=\"132; 689\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"codeActivity1\" Location=\"142; 751\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"142; 811\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity6\" Location=\"305; 689\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"missingDataMessageBoxActivity\" Location=\"315; 751\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"315; 811\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 363\" Name=\"ifElseBranchActivity4\" Location=\"507; 556\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showFieldMessageActivity2\" Location=\"517; 618\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"517; 678\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1_eventDrivenActivity_Cancel\" Location=\"74; 387\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"84; 449\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"84; 509\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/DeleteVisualFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteVisualFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        public DeleteVisualFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        \r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IVisualFunction visualFunction = (IVisualFunction)dataEntityToken.Data;\r\n\r\n            DataFacade.Delete<IVisualFunction>(visualFunction);\r\n\r\n            int count =\r\n                    (from info in DataFacade.GetData<IVisualFunction>()\r\n                     where info.Namespace == visualFunction.Namespace\r\n                     select info).Count();\r\n\r\n\r\n            if (count == 0)\r\n            {\r\n                RefreshFunctionTree();\r\n            }\r\n            else\r\n            {\r\n                deleteTreeRefresher.PostRefreshMesseges();\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/DeleteVisualFunctionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider\r\n{\r\n    partial class DeleteVisualFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity19 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializeActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finishState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finishState\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteVisualFunctionStep1.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity19\r\n            // \r\n            this.setStateActivity19.Name = \"setStateActivity19\";\r\n            this.setStateActivity19.TargetStateName = \"finishState\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity19);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // initializeActivity\r\n            // \r\n            this.initializeActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeActivity.Name = \"initializeActivity\";\r\n            // \r\n            // finishState\r\n            // \r\n            this.finishState.Name = \"finishState\";\r\n            // \r\n            // DeleteVisualFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.finishState);\r\n            this.Activities.Add(this.initializeActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finishState\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeActivity\";\r\n            this.Name = \"DeleteVisualFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finishState;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity initializeActivity;\r\n        private SetStateActivity setStateActivity19;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/EditVisualFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Data.Types;\r\nusing Composite.Functions;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Plugins.Functions.FunctionProviders.VisualFunctionProvider;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Xml;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditVisualFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditVisualFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void CheckPageTemplatesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = PageTemplateFacade.ValidTemplateExists;\r\n        }\r\n\r\n\r\n\r\n        private void CheckActiveLanguageExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = UserSettings.ActiveLocaleCultureInfo != null;\r\n        }\r\n\r\n\r\n        private void MissingActiveLanguageActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(\r\n                DialogType.Message,\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"Edit.MissingActiveLanguageTitle\"),\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"Edit.MissingActiveLanguageMessage\"));\r\n        }\r\n\r\n\r\n        private void MissingPageTemplateActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(\r\n                DialogType.Message,\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"Edit.NoPageTemplatesExistsErrorTitle\"),\r\n                StringResourceSystemFacade.GetString(\"Composite.Plugins.VisualFunction\", \"Edit.NoPageTemplatesExistsErrorMessage\"));\r\n        }\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken token = (DataEntityToken)this.EntityToken;\r\n            IVisualFunction function = (IVisualFunction)token.Data;\r\n\r\n            this.Bindings.Add(\"OriginalFullName\", string.Format(\"{0}.{1}\", function.Namespace, function.Name));\r\n            this.Bindings.Add(\"Function\", function);\r\n            this.Bindings.Add(\"XhtmlBody\", function.XhtmlTemplate);\r\n\r\n            Type interfaceType = TypeManager.GetType(function.TypeManagerName);\r\n            DataTypeDescriptor typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n\r\n            this.Bindings.Add(\"EmbedableFieldsTypes\", new List<Type> { interfaceType });\r\n            this.Bindings.Add(\"SourceTypeFullName\", interfaceType.FullName);\r\n\r\n            this.Bindings.Add(\"FieldNameList\", FieldNames(typeDescriptor).ToList());\r\n\r\n            Dictionary<Guid, string> templateInfos = new Dictionary<Guid, string>();\r\n\r\n            foreach (PageTemplateDescriptor pageTemplate in PageTemplateFacade.GetPageTemplates())\r\n            {\r\n                if (pageTemplate.PlaceholderDescriptions.Any())\r\n                {\r\n                    templateInfos.Add(pageTemplate.Id, pageTemplate.Title);\r\n                }\r\n            }\r\n\r\n            this.Bindings.Add(\"PreviewTemplateId\", templateInfos.First().Key);\r\n            this.Bindings.Add(\"TemplateList\", templateInfos);\r\n        }\r\n\r\n\r\n\r\n        private IEnumerable<string> FieldNames(DataTypeDescriptor typeDescriptor)\r\n        {\r\n            yield return \"(random)\";\r\n\r\n            foreach (DataFieldDescriptor dataField in typeDescriptor.Fields.OrderBy(f => f.Position))\r\n            {\r\n                yield return dataField.Name;\r\n            }\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            XhtmlDocument templateDocument = GetTemplateDocumentFromBindings();\r\n\r\n            IVisualFunction function = this.GetBinding<IVisualFunction>(\"Function\");\r\n            function.XhtmlTemplate = templateDocument.ToString();\r\n\r\n            DataFacade.Update(function);\r\n\r\n            string functionFullName = string.Format(\"{0}.{1}\", function.Namespace, function.Name);\r\n            this.UpdateBinding(\"OriginalFullName\", functionFullName);\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(function.GetDataEntityToken());\r\n\r\n            SetSaveStatus(true);\r\n        }\r\n\r\n\r\n\r\n        private XhtmlDocument GetTemplateDocumentFromBindings()\r\n        {\r\n            string html = this.GetBinding<string>(\"XhtmlBody\");\r\n            XElement xElement = XElement.Parse(html);\r\n\r\n            return new XhtmlDocument(xElement);\r\n        }\r\n\r\n\r\n\r\n        private void CheckFunctionReNameIsUnique(object sender, ConditionalEventArgs e)\r\n        {\r\n            IVisualFunction function = this.GetBinding<IVisualFunction>(\"Function\");\r\n\r\n            string functionFullName = string.Format(\"{0}.{1}\", function.Namespace, function.Name);\r\n            string originalFullName = this.GetBinding<string>(\"OriginalFullName\");\r\n\r\n            if (functionFullName == originalFullName)\r\n            {\r\n                e.Result = true;\r\n                return;\r\n            }\r\n\r\n            if (FunctionFacade.FunctionNames.Contains(functionFullName))\r\n            {\r\n                e.Result = false;\r\n            }\r\n            else\r\n            {\r\n                e.Result = true;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void editPreviewCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                XhtmlDocument templateDocument = GetTemplateDocumentFromBindings();\r\n\r\n                IVisualFunction function = this.GetBinding<IVisualFunction>(\"Function\");\r\n                Type interfaceType = TypeManager.GetType(function.TypeManagerName);\r\n\r\n                DataTypeDescriptor typeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(interfaceType);\r\n\r\n                this.LogMessage(Composite.Core.Logging.LogLevel.Info, DataScopeManager.CurrentDataScope.Name);\r\n\r\n                FunctionContextContainer fcc = PageRenderer.GetPageRenderFunctionContextContainer();\r\n\r\n                XhtmlDocument result = RenderingHelper.RenderCompleteDataList(function, templateDocument, typeDescriptor, fcc);\r\n\r\n                IPage previewPage = DataFacade.BuildNew<IPage>();\r\n                previewPage.Id = GetRootPageId();\r\n                previewPage.Title = function.Name;\r\n                previewPage.DataSourceId.DataScopeIdentifier = DataScopeIdentifier.Administrated;\r\n                previewPage.DataSourceId.LocaleScope = LocalizationScopeManager.CurrentLocalizationScope;\r\n\r\n                previewPage.TemplateId = this.GetBinding<Guid>(\"PreviewTemplateId\");\r\n\r\n                var pageTemplate = PageTemplateFacade.GetPageTemplate(previewPage.TemplateId);\r\n                IPagePlaceholderContent placeHolderContent = DataFacade.BuildNew<IPagePlaceholderContent>();\r\n                placeHolderContent.Content = string.Concat((result.Body.Elements().Select(b => b.ToString())).ToArray());\r\n                placeHolderContent.PlaceHolderId = pageTemplate.DefaultPlaceholderId;\r\n\r\n                string output = PagePreviewBuilder.RenderPreview(previewPage, new List<IPagePlaceholderContent> { placeHolderContent });\r\n\r\n                var serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n\r\n                var webRenderService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n                webRenderService.SetNewPageOutput(new LiteralControl(output));\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                Control errOutput = new LiteralControl(\"<pre>\" + ex + \"</pre>\");\r\n                var webRenderService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n                webRenderService.SetNewPageOutput(errOutput);\r\n            }\r\n\r\n        }\r\n\r\n        private static Guid GetRootPageId()\r\n        {\r\n            return  PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault(pageId => PageManager.GetPageById(pageId) != null);\r\n        }\r\n\r\n        private void previewHandleExternalEventActivity1_Invoked(object sender, System.Workflow.Activities.ExternalDataEventArgs e)\r\n        {\r\n\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/EditVisualFunctionWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.VisualFunctionProviderElementProvider\r\n{\r\n    partial class EditVisualFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingPageTemplateActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.noSaveSetStateActivity = new System.Workflow.Activities.SetStateActivity();\r\n            this.showFieldMessageActivity1 = new Composite.C1Console.Workflow.Activities.ShowFieldMessageActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingActiveLanguageActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity_CheckPageTemplatesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editPreviewCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.previewHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.ifElseActivity_CheckActiveLanguageExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Preview = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // MissingPageTemplateActivity\r\n            // \r\n            this.MissingPageTemplateActivity.Name = \"MissingPageTemplateActivity\";\r\n            this.MissingPageTemplateActivity.ExecuteCode += new System.EventHandler(this.MissingPageTemplateActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.MissingPageTemplateActivity);\r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.initializeCodeActivity);\r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckPageTemplatesExists);\r\n            this.ifElseBranchActivity5.Condition = codecondition1;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // noSaveSetStateActivity\r\n            // \r\n            this.noSaveSetStateActivity.Name = \"noSaveSetStateActivity\";\r\n            this.noSaveSetStateActivity.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // showFieldMessageActivity1\r\n            // \r\n            this.showFieldMessageActivity1.FieldBindingPath = \"Function.Name\";\r\n            this.showFieldMessageActivity1.Message = \"${Composite.Plugins.VisualFunction, VisualFunctionElementProvider.Functio\" +\r\n                \"nNameNotUniqueError}\";\r\n            this.showFieldMessageActivity1.Name = \"showFieldMessageActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // MissingActiveLanguageActivity\r\n            // \r\n            this.MissingActiveLanguageActivity.Name = \"MissingActiveLanguageActivity\";\r\n            this.MissingActiveLanguageActivity.ExecuteCode += new System.EventHandler(this.MissingActiveLanguageActivity_ExecuteCode);\r\n            // \r\n            // ifElseActivity_CheckPageTemplatesExists\r\n            // \r\n            this.ifElseActivity_CheckPageTemplatesExists.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElseActivity_CheckPageTemplatesExists.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity_CheckPageTemplatesExists.Name = \"ifElseActivity_CheckPageTemplatesExists\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.showFieldMessageActivity1);\r\n            this.ifElseBranchActivity2.Activities.Add(this.noSaveSetStateActivity);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckFunctionReNameIsUnique);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.MissingActiveLanguageActivity);\r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.ifElseActivity_CheckPageTemplatesExists);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckActiveLanguageExists);\r\n            this.ifElseBranchActivity3.Condition = codecondition3;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // editPreviewCodeActivity\r\n            // \r\n            this.editPreviewCodeActivity.Name = \"editPreviewCodeActivity\";\r\n            this.editPreviewCodeActivity.ExecuteCode += new System.EventHandler(this.editPreviewCodeActivity_ExecuteCode);\r\n            // \r\n            // previewHandleExternalEventActivity1\r\n            // \r\n            this.previewHandleExternalEventActivity1.EventName = \"Preview\";\r\n            this.previewHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previewHandleExternalEventActivity1.Name = \"previewHandleExternalEventActivity1\";\r\n            this.previewHandleExternalEventActivity1.Invoked += new System.EventHandler<System.Workflow.Activities.ExternalDataEventArgs>(this.previewHandleExternalEventActivity1_Invoked);\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/EditVisualFunction.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // ifElseActivity_CheckActiveLanguageExists\r\n            // \r\n            this.ifElseActivity_CheckActiveLanguageExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity_CheckActiveLanguageExists.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity_CheckActiveLanguageExists.Name = \"ifElseActivity_CheckActiveLanguageExists\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Preview\r\n            // \r\n            this.eventDrivenActivity_Preview.Activities.Add(this.previewHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Preview.Activities.Add(this.editPreviewCodeActivity);\r\n            this.eventDrivenActivity_Preview.Activities.Add(this.setStateActivity5);\r\n            this.eventDrivenActivity_Preview.Name = \"eventDrivenActivity_Preview\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.ifElseActivity1);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.ifElseActivity_CheckActiveLanguageExists);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Preview);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditVisualFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditVisualFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private CodeActivity saveCodeActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity5;\r\n        private EventDrivenActivity eventDrivenActivity_Preview;\r\n        private CodeActivity editPreviewCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity previewHandleExternalEventActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private Composite.C1Console.Workflow.Activities.ShowFieldMessageActivity showFieldMessageActivity1;\r\n        private SetStateActivity noSaveSetStateActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElseActivity_CheckActiveLanguageExists;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity MissingPageTemplateActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private SetStateActivity setStateActivity7;\r\n        private CodeActivity MissingActiveLanguageActivity;\r\n        private IfElseActivity ifElseActivity_CheckPageTemplatesExists;\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/VisualFunctionProviderElementProvider/EditVisualFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditVisualFunctionWorkflow\" Location=\"30; 30\" Size=\"1145; 793\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditVisualFunctionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditVisualFunctionWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"685\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"685\" Y=\"117\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"263\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"267\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"448\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"448\" Y=\"386\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"noSaveSetStateActivity\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"267\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"295\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"295\" Y=\"255\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"255\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"263\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Preview\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"352\" />\r\n\t\t\t\t<ns0:Point X=\"295\" Y=\"352\" />\r\n\t\t\t\t<ns0:Point X=\"295\" Y=\"255\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"255\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"263\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity4\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"547\" Y=\"427\" />\r\n\t\t\t\t<ns0:Point X=\"559\" Y=\"427\" />\r\n\t\t\t\t<ns0:Point X=\"559\" Y=\"477\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"477\" />\r\n\t\t\t\t<ns0:Point X=\"191\" Y=\"381\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"63; 105\" Size=\"197; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"612; 544\" Name=\"initialStateInitializationActivity\" Location=\"296; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 463\" Name=\"ifElseActivity_CheckActiveLanguageExists\" Location=\"306; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 363\" Name=\"ifElseBranchActivity3\" Location=\"325; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity_CheckPageTemplatesExists\" Location=\"335; 343\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity5\" Location=\"354; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"364; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"364; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity6\" Location=\"527; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingPageTemplateActivity\" Location=\"537; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"537; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 363\" Name=\"ifElseBranchActivity4\" Location=\"729; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingActiveLanguageActivity\" Location=\"739; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"739; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"97; 263\" Size=\"189; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"105; 294\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"115; 356\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 435\" Name=\"eventDrivenActivity_Save\" Location=\"105; 318\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"230; 380\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 294\" Name=\"ifElseActivity1\" Location=\"115; 440\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 194\" Name=\"ifElseBranchActivity1\" Location=\"134; 511\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"144; 609\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 194\" Name=\"ifElseBranchActivity2\" Location=\"307; 511\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"showFieldMessageActivity1\" Location=\"317; 573\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"noSaveSetStateActivity\" Location=\"317; 633\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 242\" Name=\"eventDrivenActivity_Preview\" Location=\"105; 342\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"previewHandleExternalEventActivity1\" Location=\"115; 404\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"editPreviewCodeActivity\" Location=\"115; 464\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"115; 524\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"346; 386\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"354; 417\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"364; 479\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"364; 539\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"605; 117\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/AddNewWebsiteFileWorkflow.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewWebsiteFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewWebsiteFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private string GetCurrentPath()\r\n        {\r\n            if (this.EntityToken is WebsiteFileElementProviderRootEntityToken)\r\n            {\r\n                string rootPath = (string)ElementFacade.GetData(new ElementProviderHandle(this.EntityToken.Source), \"RootPath\");\r\n\r\n                return rootPath;\r\n            }\r\n            else if (this.EntityToken is WebsiteFileElementProviderEntityToken)\r\n            {\r\n                return (this.EntityToken as WebsiteFileElementProviderEntityToken).Path;\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void FileExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            string currentPath = GetCurrentPath();\r\n            string newFileName = this.GetBinding<string>(\"NewFileName\");\r\n\r\n            e.Result = C1File.Exists(Path.Combine(currentPath, newFileName));\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(\"NewFileName\", \"\");\r\n        }\r\n\r\n\r\n\r\n        private void step1CodeActivity_ShowError_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowFieldMessage(\"NewFileName\", \"${Composite.Plugins.WebsiteFileElementProvider, AddNewFile.Error.FileExist}\");\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string currentPath = GetCurrentPath();\r\n            string newFileName = this.GetBinding<string>(\"NewFileName\");\r\n            string fullPath = Path.Combine(currentPath, newFileName);\r\n\r\n            using (C1FileStream fs = C1File.Create(fullPath))\r\n            { }\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n\r\n            if (this.EntityToken is WebsiteFileElementProviderEntityToken)\r\n            {\r\n                WebsiteFileElementProviderEntityToken folderToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n                var newFileToken = new WebsiteFileElementProviderEntityToken(folderToken.ProviderName, fullPath, folderToken.RootPath);\r\n                SelectElement(newFileToken);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/AddNewWebsiteFileWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class AddNewWebsiteFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.step1CodeActivity_ShowError = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivit_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // step1CodeActivity_ShowError\r\n            // \r\n            this.step1CodeActivity_ShowError.Name = \"step1CodeActivity_ShowError\";\r\n            this.step1CodeActivity_ShowError.ExecuteCode += new System.EventHandler(this.step1CodeActivity_ShowError_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.step1CodeActivity_ShowError);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.FileExists);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"/Administrative/WebsiteFileElementProviderAddNewFile.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivit_Finish\r\n            // \r\n            this.step1EventDrivenActivit_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivit_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivit_Finish.Name = \"step1EventDrivenActivit_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.finalizeCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity7);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivit_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // AddNewWebsiteFileWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewWebsiteFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity4;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivit_Finish;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private StateActivity step1StateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private CodeActivity step1CodeActivity_ShowError;\r\n        private SetStateActivity setStateActivity5;\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/AddNewWebsiteFileWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewWebsiteFileWorkflow\" Location=\"30; 30\" Size=\"1174; 958\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddNewWebsiteFileWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddNewWebsiteFileWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1094\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1094\" Y=\"792\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"775\" Y=\"653\" />\r\n\t\t\t\t<ns0:Point X=\"1094\" Y=\"653\" />\r\n\t\t\t\t<ns0:Point X=\"1094\" Y=\"792\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"421\" Y=\"420\" />\r\n\t\t\t\t<ns0:Point X=\"1094\" Y=\"420\" />\r\n\t\t\t\t<ns0:Point X=\"1094\" Y=\"792\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivit_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"411\" Y=\"396\" />\r\n\t\t\t\t<ns0:Point X=\"676\" Y=\"396\" />\r\n\t\t\t\t<ns0:Point X=\"676\" Y=\"612\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"277\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"319\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"319\" Y=\"331\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivit_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"599\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"619\" Y=\"169\" />\r\n\t\t\t\t<ns0:Point X=\"619\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"507\" Y=\"96\" />\r\n\t\t\t\t<ns0:Point X=\"507\" Y=\"104\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"71; 101\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"79; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"89; 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"89; 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"574; 612\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeStateInitializationActivity\" Location=\"582; 643\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"592; 705\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"592; 765\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"592; 825\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"1014; 792\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"214; 331\" Size=\"211; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"410; 135\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"dataDialogFormActivity1\" Location=\"420; 197\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 423\" Name=\"step1EventDrivenActivit_Finish\" Location=\"418; 148\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"543; 210\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity1\" Location=\"428; 270\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity1\" Location=\"447; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"step1CodeActivity_ShowError\" Location=\"457; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"457; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity2\" Location=\"620; 341\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"630; 433\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"410; 183\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"420; 245\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"420; 305\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/AddNewWebsiteFolderWorkflow.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewWebsiteFolderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddNewWebsiteFolderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private string GetCurrentPath()\r\n        {\r\n            if (this.EntityToken is WebsiteFileElementProviderRootEntityToken)\r\n            {\r\n                string rootPath = (string)ElementFacade.GetData(new ElementProviderHandle(this.EntityToken.Source), \"RootPath\");\r\n\r\n                return rootPath;\r\n            }\r\n            else if (this.EntityToken is WebsiteFileElementProviderEntityToken)\r\n            {\r\n                return (this.EntityToken as WebsiteFileElementProviderEntityToken).Path;\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void FolderExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            string currentPath = GetCurrentPath();\r\n            string newFolderName = this.GetBinding<string>(\"NewFolderName\");\r\n\r\n            e.Result = C1Directory.Exists(Path.Combine(currentPath, newFolderName));\r\n        }\r\n\r\n\r\n\r\n        private void initializeAddNewfolderCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.Bindings.Add(\"NewFolderName\", \"\");\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            string currentPath = GetCurrentPath();\r\n            string newFolderName = this.GetBinding<string>(\"NewFolderName\");\r\n\r\n            string newFolderPath = Path.Combine(currentPath, newFolderName);\r\n\r\n            C1Directory.CreateDirectory(newFolderPath);\r\n\r\n            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n            specificTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n\r\n            string providerName;\r\n            string rootPath;\r\n\r\n            switch (this.EntityToken.GetType().Name)\r\n            {\r\n                case nameof(WebsiteFileElementProviderRootEntityToken):\r\n                    WebsiteFileElementProviderRootEntityToken rootToken = (WebsiteFileElementProviderRootEntityToken)this.EntityToken;\r\n                    providerName = rootToken.ProviderName;\r\n                    rootPath = rootToken.RootPath;\r\n                    break;\r\n                case nameof(WebsiteFileElementProviderEntityToken):\r\n                    WebsiteFileElementProviderEntityToken folderToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n                    providerName = folderToken.ProviderName;\r\n                    rootPath = folderToken.RootPath;\r\n                    break;\r\n                default:\r\n                    throw new InvalidOperationException(\"Unexpected EntityToken type\");\r\n            }\r\n\r\n            var newFileToken = new WebsiteFileElementProviderEntityToken(providerName, newFolderPath, rootPath);\r\n            SelectElement(newFileToken);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ShowError_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowFieldMessage(\"NewFolderName\", \"${Composite.Plugins.WebsiteFileElementProvider, AddNewFolder.Error.FolderExist}\");\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/AddNewWebsiteFolderWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class AddNewWebsiteFolderWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_ShowError = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.doesFolderExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeAddNewfolderCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.stateInitializationActivity3 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.AddNewWebsiteFolderWorkflowInitialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity\r\n            // \r\n            this.finalizeCodeActivity.Name = \"finalizeCodeActivity\";\r\n            this.finalizeCodeActivity.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeCodeActivity_ShowError\r\n            // \r\n            this.finalizeCodeActivity_ShowError.Name = \"finalizeCodeActivity_ShowError\";\r\n            this.finalizeCodeActivity_ShowError.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ShowError_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.finalizeCodeActivity);\r\n            this.ifElseBranchActivity2.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.finalizeCodeActivity_ShowError);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.FolderExists);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // doesFolderExists\r\n            // \r\n            this.doesFolderExists.Activities.Add(this.ifElseBranchActivity1);\r\n            this.doesFolderExists.Activities.Add(this.ifElseBranchActivity2);\r\n            this.doesFolderExists.Description = \"Folder exists?\";\r\n            this.doesFolderExists.Name = \"doesFolderExists\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"/Administrative/WebsiteFileElementProviderAddNewFolder.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeAddNewfolderCodeActivity\r\n            // \r\n            this.initializeAddNewfolderCodeActivity.Name = \"initializeAddNewfolderCodeActivity\";\r\n            this.initializeAddNewfolderCodeActivity.ExecuteCode += new System.EventHandler(this.initializeAddNewfolderCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // stateInitializationActivity3\r\n            // \r\n            this.stateInitializationActivity3.Activities.Add(this.doesFolderExists);\r\n            this.stateInitializationActivity3.Name = \"stateInitializationActivity3\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.wizzardFormActivity1);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.initializeAddNewfolderCodeActivity);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // cancelActivity\r\n            // \r\n            this.cancelActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelActivity.Name = \"cancelActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.stateInitializationActivity3);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // AddNewWebsiteFolderWorkflowInitialState\r\n            // \r\n            this.AddNewWebsiteFolderWorkflowInitialState.Activities.Add(this.stateInitializationActivity1);\r\n            this.AddNewWebsiteFolderWorkflowInitialState.Name = \"AddNewWebsiteFolderWorkflowInitialState\";\r\n            // \r\n            // AddNewWebsiteFolderWorkflow\r\n            // \r\n            this.Activities.Add(this.AddNewWebsiteFolderWorkflowInitialState);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"AddNewWebsiteFolderWorkflowInitialState\";\r\n            this.Name = \"AddNewWebsiteFolderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeAddNewfolderCodeActivity;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private StateInitializationActivity stateInitializationActivity3;\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private EventDrivenActivity cancelActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private CodeActivity finalizeCodeActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity doesFolderExists;\r\n        private CodeActivity finalizeCodeActivity_ShowError;\r\n        private SetStateActivity setStateActivity6;\r\n        private StateActivity AddNewWebsiteFolderWorkflowInitialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/AddNewWebsiteFolderWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewWebsiteFolderWorkflow\" Location=\"30; 30\" Size=\"1158; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"AddNewWebsiteFolderWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddNewWebsiteFolderWorkflow\" EventHandlerName=\"cancelActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"142\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"599\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"AddNewWebsiteFolderWorkflowInitialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"AddNewWebsiteFolderWorkflowInitialState\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"230\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"142\" />\r\n\t\t\t\t<ns0:Point X=\"370\" Y=\"263\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"468\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"540\" Y=\"328\" />\r\n\t\t\t\t<ns0:Point X=\"540\" Y=\"472\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"472\" Y=\"352\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"352\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"599\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"stateInitializationActivity3\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"624\" Y=\"513\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"513\" />\r\n\t\t\t\t<ns0:Point X=\"948\" Y=\"599\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"AddNewWebsiteFolderWorkflowInitialState\" Location=\"59; 101\" Size=\"245; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"stateInitializationActivity1\" Location=\"67; 132\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeAddNewfolderCodeActivity\" Location=\"77; 194\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"77; 254\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"265; 263\" Size=\"211; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"stateInitializationActivity2\" Location=\"273; 294\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"283; 356\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"273; 318\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"283; 380\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"283; 440\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"273; 342\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"283; 404\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"283; 464\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"453; 472\" Size=\"175; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 423\" Name=\"stateInitializationActivity3\" Location=\"418; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 342\" Name=\"doesFolderExists\" Location=\"428; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 242\" Name=\"ifElseBranchActivity1\" Location=\"447; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_ShowError\" Location=\"457; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"457; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 242\" Name=\"ifElseBranchActivity2\" Location=\"620; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity\" Location=\"630; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"630; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"630; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"868; 599\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/AddWebsiteFolderToWhiteListWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    public sealed partial class AddWebsiteFolderToWhiteListWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public AddWebsiteFolderToWhiteListWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            WorkflowActionToken workflowActionToken = (WorkflowActionToken)this.ActionToken;\r\n\r\n            string folderPath = null;\r\n            if (this.EntityToken is WebsiteFileElementProviderRootEntityToken)\r\n            {\r\n                folderPath = \"\";\r\n            }\r\n            else\r\n            {\r\n                WebsiteFileElementProviderEntityToken entityToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n                folderPath = entityToken.Path;\r\n            }\r\n\r\n            string keyName = workflowActionToken.Payload;\r\n\r\n            string relativeFolderPath = IFolderWhiteListExtensions.GetTildePath(folderPath);\r\n\r\n            if (!DataFacade.GetData<IFolderWhiteList>().Any(f => f.TildeBasedPath == relativeFolderPath && f.KeyName == keyName))\r\n            {\r\n                IFolderWhiteList folderWhiteList = DataFacade.BuildNew<IFolderWhiteList>();\r\n                folderWhiteList.KeyName = keyName;\r\n                folderWhiteList.TildeBasedPath = IFolderWhiteListExtensions.GetTildePath(folderPath);\r\n                DataFacade.AddNew(folderWhiteList);\r\n            }\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/AddWebsiteFolderToWhiteListWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class AddWebsiteFolderToWhiteListWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // AddWebsiteFolderToWhiteListWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddWebsiteFolderToWhiteListWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private CodeActivity initializeCodeActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/DeleteWebsiteFileWorkflow.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteWebsiteFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteWebsiteFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n         \r\n            WebsiteFileElementProviderEntityToken entityToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n\r\n            try\r\n            {\r\n                C1File.Delete(entityToken.Path);\r\n\r\n                treeRefresher.PostRefreshMesseges();\r\n            }\r\n            catch (Exception)\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DeleteWebsiteFileWorkflow.DeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DeleteWebsiteFileWorkflow.DeleteErrorMessage\")\r\n                    );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/DeleteWebsiteFileWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class DeleteWebsiteFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.deleteCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.deleteEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.initializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.deleteEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.DeleteWebsiteFileWorkflowInitialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // deleteCodeActivity\r\n            // \r\n            this.deleteCodeActivity.Name = \"deleteCodeActivity\";\r\n            this.deleteCodeActivity.ExecuteCode += new System.EventHandler(this.deleteCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\WebsiteFileElementProviderDeleteFile.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.deleteCodeActivity);\r\n            this.stateInitializationActivity1.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.stateInitializationActivity1.Activities.Add(this.setStateActivity2);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // deleteEventDrivenActivity_Cancel\r\n            // \r\n            this.deleteEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.deleteEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.deleteEventDrivenActivity_Cancel.Name = \"deleteEventDrivenActivity_Cancel\";\r\n            // \r\n            // initializationActivity\r\n            // \r\n            this.initializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.initializationActivity.Name = \"initializationActivity\";\r\n            // \r\n            // deleteEventDrivenActivity_Finish\r\n            // \r\n            this.deleteEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.deleteEventDrivenActivity_Finish.Activities.Add(this.setStateActivity3);\r\n            this.deleteEventDrivenActivity_Finish.Name = \"deleteEventDrivenActivity_Finish\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // DeleteWebsiteFileWorkflowInitialState\r\n            // \r\n            this.DeleteWebsiteFileWorkflowInitialState.Activities.Add(this.deleteEventDrivenActivity_Finish);\r\n            this.DeleteWebsiteFileWorkflowInitialState.Activities.Add(this.initializationActivity);\r\n            this.DeleteWebsiteFileWorkflowInitialState.Activities.Add(this.deleteEventDrivenActivity_Cancel);\r\n            this.DeleteWebsiteFileWorkflowInitialState.Name = \"DeleteWebsiteFileWorkflowInitialState\";\r\n            // \r\n            // DeleteWebsiteFileWorkflow\r\n            // \r\n            this.Activities.Add(this.DeleteWebsiteFileWorkflowInitialState);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"DeleteWebsiteFileWorkflowInitialState\";\r\n            this.Name = \"DeleteWebsiteFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private CodeActivity deleteCodeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity deleteEventDrivenActivity_Finish;\r\n        private StateActivity finalizeStateActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity wizzardFormActivity1;\r\n        private StateInitializationActivity initializationActivity;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity deleteEventDrivenActivity_Cancel;\r\n        private StateActivity DeleteWebsiteFileWorkflowInitialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/DeleteWebsiteFileWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteWebsiteFileWorkflow\" Location=\"30; 30\" Size=\"1158; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteWebsiteFileWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteWebsiteFileWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"860\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"860\" Y=\"644\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"DeleteWebsiteFileWorkflowInitialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"DeleteWebsiteFileWorkflowInitialState\" EventHandlerName=\"deleteEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"334\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"463\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"463\" Y=\"489\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"DeleteWebsiteFileWorkflowInitialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteWebsiteFileWorkflowInitialState\" EventHandlerName=\"deleteEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"338\" Y=\"275\" />\r\n\t\t\t\t<ns0:Point X=\"860\" Y=\"275\" />\r\n\t\t\t\t<ns0:Point X=\"860\" Y=\"644\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"547\" Y=\"530\" />\r\n\t\t\t\t<ns0:Point X=\"860\" Y=\"530\" />\r\n\t\t\t\t<ns0:Point X=\"860\" Y=\"644\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"DeleteWebsiteFileWorkflowInitialState\" Location=\"128; 186\" Size=\"222; 102\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"deleteEventDrivenActivity_Finish\" Location=\"136; 241\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"146; 303\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"146; 363\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"initializationActivity\" Location=\"136; 217\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"146; 279\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"deleteEventDrivenActivity_Cancel\" Location=\"136; 265\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"146; 327\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"146; 387\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"780; 644\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"376; 489\" Size=\"175; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"stateInitializationActivity1\" Location=\"534; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"deleteCodeActivity\" Location=\"544; 210\" />\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"544; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"544; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/DeleteWebsiteFolderWorkflow.cs",
    "content": "﻿using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteWebsiteFolderWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public DeleteWebsiteFolderWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void deleteCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DeleteTreeRefresher treeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n            WebsiteFileElementProviderEntityToken entityToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n\r\n            try\r\n            {                \r\n                C1Directory.Delete(entityToken.Path, true);\r\n\r\n                treeRefresher.PostRefreshMesseges();\r\n            }\r\n            catch (Exception) \r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DeleteWebsiteFolderWorkflow.DeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.WebsiteFileElementProvider\", \"DeleteWebsiteFolderWorkflow.DeleteErrorMessage\")\r\n                    );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/DeleteWebsiteFolderWorkflow.designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class DeleteWebsiteFolderWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.deleteCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.deleteEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.deleteEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1StateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.stateActivity1 = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"stateActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\WebsiteFileElementProviderDeleteFolder.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // deleteCodeActivity\r\n            // \r\n            this.deleteCodeActivity.Name = \"deleteCodeActivity\";\r\n            this.deleteCodeActivity.ExecuteCode += new System.EventHandler(this.deleteCodeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // deleteEventDrivenActivity_Cancel\r\n            // \r\n            this.deleteEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.deleteEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.deleteEventDrivenActivity_Cancel.Name = \"deleteEventDrivenActivity_Cancel\";\r\n            // \r\n            // deleteEventDrivenActivity_Finish\r\n            // \r\n            this.deleteEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.deleteEventDrivenActivity_Finish.Activities.Add(this.setStateActivity2);\r\n            this.deleteEventDrivenActivity_Finish.Name = \"deleteEventDrivenActivity_Finish\";\r\n            // \r\n            // step1StateInitializationActivity\r\n            // \r\n            this.step1StateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.step1StateInitializationActivity.Name = \"step1StateInitializationActivity\";\r\n            // \r\n            // finalizeActivity\r\n            // \r\n            this.finalizeActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.finalizeActivity.Activities.Add(this.deleteCodeActivity);\r\n            this.finalizeActivity.Activities.Add(this.setStateActivity3);\r\n            this.finalizeActivity.Name = \"finalizeActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.step1StateInitializationActivity);\r\n            this.initializeStateActivity.Activities.Add(this.deleteEventDrivenActivity_Finish);\r\n            this.initializeStateActivity.Activities.Add(this.deleteEventDrivenActivity_Cancel);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // stateActivity1\r\n            // \r\n            this.stateActivity1.Activities.Add(this.finalizeActivity);\r\n            this.stateActivity1.Name = \"stateActivity1\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // DeleteWebsiteFolderWorkflow\r\n            // \r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.stateActivity1);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"DeleteWebsiteFolderWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity deleteCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity finalizeActivity;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity stateActivity1;\r\n        private StateInitializationActivity step1StateInitializationActivity;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity wizzardFormActivity1;\r\n        private EventDrivenActivity deleteEventDrivenActivity_Finish;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity deleteEventDrivenActivity_Cancel;\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/DeleteWebsiteFolderWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"DeleteWebsiteFolderWorkflow\" Location=\"30; 30\" Size=\"1158; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"DeleteWebsiteFolderWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"DeleteWebsiteFolderWorkflow\" EventHandlerName=\"eventDrivenActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"176\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"716\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"716\" Y=\"485\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"stateActivity1\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"stateActivity1\" EventHandlerName=\"finalizeActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"422\" Y=\"425\" />\r\n\t\t\t\t<ns0:Point X=\"716\" Y=\"425\" />\r\n\t\t\t\t<ns0:Point X=\"716\" Y=\"485\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"stateActivity1\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"stateActivity1\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"deleteEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"300\" Y=\"231\" />\r\n\t\t\t\t<ns0:Point X=\"387\" Y=\"231\" />\r\n\t\t\t\t<ns0:Point X=\"387\" Y=\"384\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"deleteEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"304\" Y=\"255\" />\r\n\t\t\t\t<ns0:Point X=\"716\" Y=\"255\" />\r\n\t\t\t\t<ns0:Point X=\"716\" Y=\"485\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"636; 485\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity1\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"stateActivity1\" Location=\"307; 384\" Size=\"160; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"finalizeActivity\" Location=\"534; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"544; 210\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"deleteCodeActivity\" Location=\"544; 270\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"544; 330\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"94; 166\" Size=\"214; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"step1StateInitializationActivity\" Location=\"102; 197\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"wizzardFormActivity1\" Location=\"112; 259\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"deleteEventDrivenActivity_Finish\" Location=\"102; 221\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"112; 283\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"112; 343\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"deleteEventDrivenActivity_Cancel\" Location=\"102; 245\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"112; 307\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"112; 367\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/EditWebsiteFileTextContentWorkflow.cs",
    "content": "using System;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditWebsiteFileTextContentWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditWebsiteFileTextContentWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        \r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            WebsiteFileElementProviderEntityToken entityToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n\r\n            WebsiteFile websiteFile = new WebsiteFile(entityToken.Path);\r\n\r\n\r\n            this.Bindings.Add(\"FileContent\", websiteFile.ReadAllText());\r\n            this.Bindings.Add(\"FileName\", websiteFile.FileName);\r\n            this.Bindings.Add(\"FileMimeType\", websiteFile.MimeType);\r\n        }\r\n\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            WebsiteFileElementProviderEntityToken entityToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n\r\n            WebsiteFile websiteFile = new WebsiteFile(entityToken.Path);\r\n\r\n            string content = this.GetBinding<string>(\"FileContent\");\r\n\r\n            websiteFile.WriteAllText(content);\r\n\r\n            SetSaveStatus(true);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/EditWebsiteFileTextContentWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class EditWebsiteFileTextContentWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.eventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"/Administrative/WebsiteFileElementProviderEditTextContentFile.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.setStateActivity4);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // eventDrivenActivity_Save\r\n            // \r\n            this.eventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_Save.Activities.Add(this.setStateActivity3);\r\n            this.eventDrivenActivity_Save.Name = \"eventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity1);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.eventDrivenActivity_Save);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // EditWebsiteFileTextContentWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"EditWebsiteFileTextContentWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity initializeCodeActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private CodeActivity saveCodeActivity;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private EventDrivenActivity eventDrivenActivity_Save;\r\n        private SetStateActivity setStateActivity4;\r\n        private StateActivity initialState;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/EditWebsiteFileTextContentWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditWebsiteFileTextContentWorkflow\" Location=\"30; 30\" Size=\"1158; 974\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"EditWebsiteFileTextContentWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditWebsiteFileTextContentWorkflow\" EventHandlerName=\"cancelEventDrivenActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"202\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1001\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1001\" Y=\"776\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initialState\" EventHandlerName=\"initialStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"256\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"384\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"384\" Y=\"409\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"eventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"460\" Y=\"474\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"474\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"524\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"565\" />\r\n\t\t\t\t<ns0:Point X=\"832\" Y=\"565\" />\r\n\t\t\t\t<ns0:Point X=\"832\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"384\" Y=\"401\" />\r\n\t\t\t\t<ns0:Point X=\"384\" Y=\"409\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initialState\" Location=\"63; 105\" Size=\"197; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initialStateInitializationActivity\" Location=\"534; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"544; 210\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"544; 270\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"290; 409\" Size=\"189; 94\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"298; 440\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"308; 502\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_Save\" Location=\"298; 464\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"308; 526\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"308; 586\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"618; 524\" Size=\"205; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"finalizeStateInitializationActivity\" Location=\"626; 555\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"636; 617\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"636; 677\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"921; 776\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"cancelEventDrivenActivity\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/RemoveWebsiteFolderFromWhiteListWorkflow.cs",
    "content": "using System;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Workflow;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    public sealed partial class RemoveWebsiteFolderFromWhiteListWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public RemoveWebsiteFolderFromWhiteListWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            WorkflowActionToken workflowActionToken = (WorkflowActionToken)this.ActionToken;\r\n            string folderPath = null;\r\n            if (this.EntityToken is WebsiteFileElementProviderRootEntityToken)\r\n            {\r\n                folderPath = \"\";\r\n            }\r\n            else\r\n            {\r\n                WebsiteFileElementProviderEntityToken entityToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n                folderPath = entityToken.Path;\r\n            }\r\n\r\n            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);\r\n\r\n            string keyName = workflowActionToken.Payload;\r\n\r\n            DataFacade.Delete<IFolderWhiteList>(f => f.TildeBasedPath == IFolderWhiteListExtensions.GetTildePath(folderPath) && f.KeyName == keyName);\r\n\r\n            updateTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/RemoveWebsiteFolderFromWhiteListWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class RemoveWebsiteFolderFromWhiteListWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setFinalizeState = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setFinalizeState\r\n            // \r\n            this.setFinalizeState.Name = \"setFinalizeState\";\r\n            this.setFinalizeState.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setFinalizeState);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // RemoveWebsiteFolderFromWhiteListWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"RemoveWebsiteFolderFromWhiteListWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setFinalizeState;\r\n        private CodeActivity initializeCodeActivity;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/UploadAndExtractZipFileWorkflow.Designer.cs",
    "content": "﻿using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class UploadAndExtractZipFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity3 = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity2 = new System.Workflow.Activities.IfElseActivity();\r\n            this.codeActivity2 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.wizzardFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.cancelEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finishEventDrivenActivity = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.selectZipStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initialStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity1 = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.selectZipFileStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initialState = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"selectZipFileStateActivity\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"selectZipFileStateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // codeActivity3\r\n            // \r\n            this.codeActivity3.Name = \"codeActivity3\";\r\n            this.codeActivity3.ExecuteCode += new System.EventHandler(this.HandleFinish_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.ifElseBranchActivity3.Activities.Add(this.setStateActivity4);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ZipWasUploaded);\r\n            this.ifElseBranchActivity3.Condition = codecondition1;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity5);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.codeActivity3);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.HasUserUploaded);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseActivity2\r\n            // \r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity2.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity2.Name = \"ifElseActivity2\";\r\n            // \r\n            // codeActivity2\r\n            // \r\n            this.codeActivity2.Name = \"codeActivity2\";\r\n            this.codeActivity2.ExecuteCode += new System.EventHandler(this.FinalizeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // wizzardFormActivity1\r\n            // \r\n            this.wizzardFormActivity1.ContainerLabel = null;\r\n            this.wizzardFormActivity1.FormDefinitionFileName = \"/Administrative/WebsiteFileElementProviderUploadAndExtractZipFile.xml\";\r\n            this.wizzardFormActivity1.Name = \"wizzardFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"selectZipFileStateActivity\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.InitializeCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.codeActivity2);\r\n            this.finalizeStateInitializationActivity.Activities.Add(this.ifElseActivity2);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // cancelEventDrivenActivity\r\n            // \r\n            this.cancelEventDrivenActivity.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.cancelEventDrivenActivity.Activities.Add(this.setStateActivity6);\r\n            this.cancelEventDrivenActivity.Name = \"cancelEventDrivenActivity\";\r\n            // \r\n            // finishEventDrivenActivity\r\n            // \r\n            this.finishEventDrivenActivity.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.finishEventDrivenActivity.Activities.Add(this.ifElseActivity1);\r\n            this.finishEventDrivenActivity.Name = \"finishEventDrivenActivity\";\r\n            // \r\n            // selectZipStateInitializationActivity\r\n            // \r\n            this.selectZipStateInitializationActivity.Activities.Add(this.wizzardFormActivity1);\r\n            this.selectZipStateInitializationActivity.Name = \"selectZipStateInitializationActivity\";\r\n            // \r\n            // initialStateInitializationActivity\r\n            // \r\n            this.initialStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.initialStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initialStateInitializationActivity.Name = \"initialStateInitializationActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // eventDrivenActivity1\r\n            // \r\n            this.eventDrivenActivity1.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity1.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity1.Name = \"eventDrivenActivity1\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // selectZipFileStateActivity\r\n            // \r\n            this.selectZipFileStateActivity.Activities.Add(this.selectZipStateInitializationActivity);\r\n            this.selectZipFileStateActivity.Activities.Add(this.finishEventDrivenActivity);\r\n            this.selectZipFileStateActivity.Activities.Add(this.cancelEventDrivenActivity);\r\n            this.selectZipFileStateActivity.Name = \"selectZipFileStateActivity\";\r\n            // \r\n            // initialState\r\n            // \r\n            this.initialState.Activities.Add(this.initialStateInitializationActivity);\r\n            this.initialState.Name = \"initialState\";\r\n            // \r\n            // UploadAndExtractZipFileWorkflow\r\n            // \r\n            this.Activities.Add(this.initialState);\r\n            this.Activities.Add(this.selectZipFileStateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity1);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initialState\";\r\n            this.Name = \"UploadAndExtractZipFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        #endregion\r\n\r\n        private StateActivity selectZipFileStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private EventDrivenActivity eventDrivenActivity1;\r\n        private StateInitializationActivity initialStateInitializationActivity;\r\n        private StateActivity finalStateActivity;\r\n        private CodeActivity codeActivity1;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private StateInitializationActivity selectZipStateInitializationActivity;\r\n        private C1Console.Workflow.Activities.DataDialogFormActivity wizzardFormActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity codeActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity codeActivity3;\r\n        private C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private EventDrivenActivity finishEventDrivenActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity6;\r\n        private C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity cancelEventDrivenActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElseActivity2;\r\n        private SetStateActivity setStateActivity7;\r\n        private StateActivity initialState;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/UploadAndExtractZipFileWorkflow.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.IO.Compression;\r\nusing System.Linq;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Activities;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_WebsiteFileElementProvider;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Never)]\r\n    public sealed partial class UploadAndExtractZipFileWorkflow : FormsWorkflow\r\n    {\r\n        [NonSerialized]\r\n        bool _zipHasBeenUploaded = false;\r\n\r\n        public UploadAndExtractZipFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void InitializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            FormsWorkflow workflow = this.GetRoot<FormsWorkflow>();\r\n\r\n            string parentFolderPath;\r\n\r\n            if (this.EntityToken is WebsiteFileElementProviderRootEntityToken)\r\n            {\r\n                parentFolderPath = PathUtil.Resolve(\"~/\");\r\n            }\r\n            else\r\n            {\r\n                var token = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n                parentFolderPath = token.Path;\r\n            }\r\n\r\n            UploadedFile file = new UploadedFile();\r\n\r\n            workflow.Bindings.Add(\"UploadedFile\", file);\r\n            workflow.Bindings.Add(\"OverwriteExisting\", false);\r\n            workflow.Bindings.Add(\"ParentFolderPath\", parentFolderPath);\r\n        }\r\n\r\n\r\n\r\n        private void HandleFinish_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n            bool overwrite = this.GetBinding<bool>(\"OverwriteExisting\");\r\n            string parentFolderPath = this.GetBinding<string>(\"ParentFolderPath\");\r\n\r\n            if (uploadedFile.HasFile)\r\n            {\r\n                using (System.IO.Stream readStream = uploadedFile.FileStream)\r\n                {\r\n                    ZipArchive zipArchive;\r\n\r\n                    try\r\n                    {\r\n                        zipArchive = new ZipArchive(readStream);\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        ShowUploadError(Texts.UploadAndExtractZipFile_NotZip);\r\n                        return;\r\n                    }\r\n\r\n                    try\r\n                    {\r\n                        foreach (var entry in zipArchive.Entries)\r\n                        {\r\n                            string fullPath = Path.Combine(parentFolderPath, entry.FullName);\r\n                            if (File.Exists(fullPath))\r\n                            {\r\n                                string websiteFilePath = PathUtil.GetWebsitePath(fullPath);\r\n\r\n                                if (!overwrite)\r\n                                {\r\n                                    ShowUploadError(Texts.UploadAndExtractZipFile_FileExistsError(websiteFilePath));\r\n                                    return;\r\n                                }\r\n\r\n                                var fileInfo = new FileInfo(fullPath);\r\n\r\n                                if (fileInfo.IsReadOnly)\r\n                                {\r\n                                    ShowUploadError(Texts.UploadAndExtractZipFile_ExistingFileReadOnly(websiteFilePath));\r\n                                    return;\r\n                                }\r\n                            }\r\n                        }\r\n\r\n                        foreach (var entry in zipArchive.Entries.Where(f => !string.IsNullOrWhiteSpace(f.Name)))\r\n                        {\r\n                            using (var zipStream = entry.Open())\r\n                            {\r\n                                string fullPath = Path.Combine(parentFolderPath, entry.FullName);\r\n\r\n                                DirectoryUtils.EnsurePath(fullPath);\r\n\r\n                                using (var newFile = File.Create(fullPath, 4096))\r\n                                {\r\n                                    zipStream.CopyTo(newFile);\r\n                                }\r\n                            }\r\n                        }\r\n\r\n                        _zipHasBeenUploaded = true;\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(nameof(UploadAndExtractZipFileWorkflow), ex);\r\n                        ShowUploadError(Texts.UploadAndExtractZipFile_UnexpectedError);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ZipWasUploaded(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = _zipHasBeenUploaded;\r\n        }\r\n\r\n\r\n\r\n        private void FinalizeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n\r\n            addNewTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n        }\r\n\r\n\r\n\r\n        private void HasUserUploaded(object sender, System.Workflow.Activities.ConditionalEventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n            if (!uploadedFile.HasFile)\r\n            {\r\n                ShowUploadError(Texts.UploadAndExtractZipFile_FileNotUploaded);\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n        private void ShowUploadError(string message)\r\n        {\r\n            this.ShowMessage(DialogType.Error,\r\n                Texts.UploadAndExtractZipFile_ErrorDialogLabel,\r\n                message);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/UploadAndExtractZipFileWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Size=\"857; 689\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"30; 30\" Name=\"UploadAndExtractZipFileWorkflow\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceActivity=\"UploadAndExtractZipFileWorkflow\" TargetConnectionIndex=\"0\" SourceStateName=\"UploadAndExtractZipFileWorkflow\" SourceConnectionEdge=\"Right\" EventHandlerName=\"eventDrivenActivity1\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"186\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"753\" Y=\"74\" />\r\n\t\t\t\t<ns0:Point X=\"753\" Y=\"439\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectZipFileStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceActivity=\"initialState\" TargetConnectionIndex=\"0\" SourceStateName=\"initialState\" SourceConnectionEdge=\"Right\" EventHandlerName=\"initialStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"selectZipFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"271\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"305\" Y=\"150\" />\r\n\t\t\t\t<ns0:Point X=\"305\" Y=\"243\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalizeStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceActivity=\"selectZipFileStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectZipFileStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finishEventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"finalizeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"369\" Y=\"313\" />\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"313\" />\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"301\" />\r\n\t\t\t\t<ns0:Point X=\"617\" Y=\"301\" />\r\n\t\t\t\t<ns0:Point X=\"617\" Y=\"309\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectZipFileStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceActivity=\"selectZipFileStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectZipFileStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finishEventDrivenActivity\" SourceConnectionIndex=\"1\" TargetStateName=\"selectZipFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"546\" Y=\"178\" />\r\n\t\t\t\t<ns0:Point X=\"610\" Y=\"178\" />\r\n\t\t\t\t<ns0:Point X=\"610\" Y=\"100\" />\r\n\t\t\t\t<ns0:Point X=\"482\" Y=\"100\" />\r\n\t\t\t\t<ns0:Point X=\"482\" Y=\"108\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceActivity=\"selectZipFileStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"selectZipFileStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"cancelEventDrivenActivity\" SourceConnectionIndex=\"2\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"374\" Y=\"339\" />\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"339\" />\r\n\t\t\t\t<ns0:Point X=\"433\" Y=\"427\" />\r\n\t\t\t\t<ns0:Point X=\"753\" Y=\"427\" />\r\n\t\t\t\t<ns0:Point X=\"753\" Y=\"439\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"finalStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"723\" Y=\"353\" />\r\n\t\t\t\t<ns0:Point X=\"753\" Y=\"353\" />\r\n\t\t\t\t<ns0:Point X=\"753\" Y=\"439\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetActivity=\"selectZipFileStateActivity\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceActivity=\"finalizeStateActivity\" TargetConnectionIndex=\"0\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" EventHandlerName=\"finalizeStateInitializationActivity\" SourceConnectionIndex=\"0\" TargetStateName=\"selectZipFileStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"723\" Y=\"353\" />\r\n\t\t\t\t<ns0:Point X=\"737\" Y=\"353\" />\r\n\t\t\t\t<ns0:Point X=\"737\" Y=\"235\" />\r\n\t\t\t\t<ns0:Point X=\"305\" Y=\"235\" />\r\n\t\t\t\t<ns0:Point X=\"305\" Y=\"243\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Size=\"212; 80\" AutoSizeMargin=\"16; 24\" Location=\"63; 106\" Name=\"initialState\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"initialStateInitializationActivity\" Size=\"150; 206\" Location=\"71; 139\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity1\" Size=\"130; 41\" Location=\"81; 204\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity2\" Size=\"130; 62\" Location=\"81; 264\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"231; 126\" AutoSizeMargin=\"16; 24\" AutoSize=\"False\" Location=\"190; 243\" Name=\"selectZipFileStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"selectZipStateInitializationActivity\" Size=\"150; 128\" Location=\"383; 154\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Name=\"wizzardFormActivity1\" Size=\"130; 44\" Location=\"393; 219\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"finishEventDrivenActivity\" Size=\"381; 456\" Location=\"375; 167\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"finishHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"500; 232\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity1\" Size=\"361; 309\" Location=\"385; 295\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity1\" Size=\"150; 206\" Location=\"404; 369\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity3\" Size=\"130; 41\" Location=\"414; 434\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity3\" Size=\"130; 62\" Location=\"414; 494\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity2\" Size=\"150; 206\" Location=\"577; 369\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity5\" Size=\"130; 62\" Location=\"587; 464\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Name=\"cancelEventDrivenActivity\" Size=\"150; 209\" Location=\"375; 193\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity2\" Size=\"130; 44\" Location=\"385; 258\" />\r\n\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity6\" Size=\"130; 62\" Location=\"385; 321\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Size=\"220; 80\" AutoSizeMargin=\"16; 24\" Location=\"507; 309\" Name=\"finalizeStateActivity\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Name=\"finalizeStateInitializationActivity\" Size=\"381; 456\" Location=\"515; 342\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Name=\"codeActivity2\" Size=\"130; 41\" Location=\"640; 407\" />\r\n\t\t\t\t\t\t<IfElseDesigner Name=\"ifElseActivity2\" Size=\"361; 312\" Location=\"525; 467\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity3\" Size=\"150; 209\" Location=\"544; 541\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Name=\"closeCurrentViewActivity1\" Size=\"130; 44\" Location=\"554; 606\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity4\" Size=\"130; 62\" Location=\"554; 669\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Name=\"ifElseBranchActivity4\" Size=\"150; 209\" Location=\"717; 541\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Name=\"setStateActivity7\" Size=\"130; 62\" Location=\"727; 637\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<EventDrivenDesigner Name=\"eventDrivenActivity1\" Size=\"150; 209\" Location=\"38; 63\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Name=\"cancelHandleExternalEventActivity1\" Size=\"130; 44\" Location=\"48; 128\" />\r\n\t\t\t\t<SetStateDesigner Name=\"setStateActivity1\" Size=\"130; 62\" Location=\"48; 191\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Size=\"160; 80\" AutoSizeMargin=\"16; 24\" Location=\"673; 439\" Name=\"finalStateActivity\" />\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/UploadWebsiteFileWorkflow.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Workflow.Activities;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.CoreUiControls;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class UploadWebsiteFileWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public UploadWebsiteFileWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n        private string GetCurrentPath()\r\n        {\r\n            if (this.EntityToken is WebsiteFileElementProviderRootEntityToken)\r\n            {\r\n                string rootPath = (string)ElementFacade.GetData(new ElementProviderHandle(this.EntityToken.Source), \"RootPath\");\r\n\r\n                return rootPath;\r\n            }\r\n            else if (this.EntityToken is WebsiteFileElementProviderEntityToken)\r\n            {\r\n                return (this.EntityToken as WebsiteFileElementProviderEntityToken).Path;\r\n            }\r\n            else\r\n            {\r\n                throw new NotImplementedException();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void IsUploadTypeOk(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void FileExist(object sender, ConditionalEventArgs e)\r\n        {\r\n            UploadedFile file = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n            if (file.HasFile)\r\n            {\r\n                string currentPath = GetCurrentPath();\r\n\r\n                e.Result = C1Directory.GetFiles(currentPath, file.FileName).Length > 0;\r\n            }\r\n            else\r\n            {\r\n                e.Result = false;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UploadedFile file = new UploadedFile();\r\n\r\n            this.Bindings.Add(\"UploadedFile\", file);\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_SaveFile_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            UploadedFile uploadedFile = this.GetBinding<UploadedFile>(\"UploadedFile\");\r\n\r\n            if (uploadedFile.HasFile)\r\n            {\r\n                string currentPath = GetCurrentPath();\r\n                string filename = uploadedFile.FileName;\r\n\r\n                string fullFilename = System.IO.Path.Combine(currentPath, filename);\r\n\r\n                if (C1File.Exists(fullFilename))\r\n                {\r\n                    FileUtils.Delete(fullFilename);\r\n                }\r\n\r\n                using (C1FileStream fs = new C1FileStream(fullFilename, FileMode.CreateNew))\r\n                {\r\n                    uploadedFile.FileStream.CopyTo(fs);\r\n                }\r\n\r\n                SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();\r\n                specificTreeRefresher.PostRefreshMesseges(this.EntityToken);\r\n\r\n                if (this.EntityToken is WebsiteFileElementProviderEntityToken)\r\n                {\r\n                    WebsiteFileElementProviderEntityToken folderToken = (WebsiteFileElementProviderEntityToken)this.EntityToken;\r\n                    var newFileToken = new WebsiteFileElementProviderEntityToken(folderToken.ProviderName, fullFilename, folderToken.RootPath);\r\n                    SelectElement(newFileToken);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void finalizeCodeActivity_ShowErrorMessage_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            this.ShowMessage(\r\n                DialogType.Error,\r\n                \"${Composite.Plugins.WebsiteFileElementProvider, UploadFile.Error.WrongTypeTitle}\",\r\n                \"${Composite.Plugins.WebsiteFileElementProvider, UploadFile.Error.WrongTypeMessage}\"\r\n            );\r\n        }\r\n\r\n\r\n\r\n        //private void finalizeCodeActivity_ShowFileExistMessage_ExecuteCode(object sender, EventArgs e)\r\n        //{\r\n        //    this.ShowMessage(\r\n        //        DialogType.Error,\r\n        //        \"${Composite.Plugins.WebsiteFileElementProvider, UploadFile.Error.FileExistTitle}\",\r\n        //        \"${Composite.Plugins.WebsiteFileElementProvider, UploadFile.Error.FileExistMessage}\"\r\n        //    );\r\n        //}\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/UploadWebsiteFileWorkflow.designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider\r\n{\r\n    partial class UploadWebsiteFileWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this� method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizeCodeActivity_ShowErrorMessage = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.finalizeCodeActivity_SaveFile = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity3 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity10 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.ifElse_IsUploadTypeOk = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dataDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity_Initialize = new System.Workflow.Activities.CodeActivity();\r\n            this.confirmOverwriteEventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmOverwriteEventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirmOverwriteStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.finalizeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.confirmOverwriteStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // finalizeCodeActivity_ShowErrorMessage\r\n            // \r\n            this.finalizeCodeActivity_ShowErrorMessage.Name = \"finalizeCodeActivity_ShowErrorMessage\";\r\n            this.finalizeCodeActivity_ShowErrorMessage.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_ShowErrorMessage_ExecuteCode);\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // finalizeCodeActivity_SaveFile\r\n            // \r\n            this.finalizeCodeActivity_SaveFile.Name = \"finalizeCodeActivity_SaveFile\";\r\n            this.finalizeCodeActivity_SaveFile.ExecuteCode += new System.EventHandler(this.finalizeCodeActivity_SaveFile_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"confirmOverwriteStateActivity\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.finalizeCodeActivity_ShowErrorMessage);\r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity6);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.finalizeCodeActivity_SaveFile);\r\n            this.ifElseBranchActivity1.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity5);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsUploadTypeOk);\r\n            this.ifElseBranchActivity1.Condition = codecondition1;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity3);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity8);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.FileExist);\r\n            this.ifElseBranchActivity5.Condition = codecondition2;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity3\r\n            // \r\n            this.cancelHandleExternalEventActivity3.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity3.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity3.Name = \"cancelHandleExternalEventActivity3\";\r\n            // \r\n            // setStateActivity10\r\n            // \r\n            this.setStateActivity10.Name = \"setStateActivity10\";\r\n            this.setStateActivity10.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/WebsiteFileElementProviderUploadNewWebsiteFileConfirm.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // ifElse_IsUploadTypeOk\r\n            // \r\n            this.ifElse_IsUploadTypeOk.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElse_IsUploadTypeOk.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElse_IsUploadTypeOk.Name = \"ifElse_IsUploadTypeOk\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dataDialogFormActivity1\r\n            // \r\n            this.dataDialogFormActivity1.ContainerLabel = null;\r\n            this.dataDialogFormActivity1.FormDefinitionFileName = \"/Administrative/WebsiteFileElementProviderUploadNewWebsiteFile.xml\";\r\n            this.dataDialogFormActivity1.Name = \"dataDialogFormActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity_Initialize\r\n            // \r\n            this.initializeCodeActivity_Initialize.Name = \"initializeCodeActivity_Initialize\";\r\n            this.initializeCodeActivity_Initialize.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_Initialize_ExecuteCode);\r\n            // \r\n            // confirmOverwriteEventDrivenActivity_Cancel\r\n            // \r\n            this.confirmOverwriteEventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity3);\r\n            this.confirmOverwriteEventDrivenActivity_Cancel.Activities.Add(this.setStateActivity9);\r\n            this.confirmOverwriteEventDrivenActivity_Cancel.Name = \"confirmOverwriteEventDrivenActivity_Cancel\";\r\n            // \r\n            // confirmOverwriteEventDrivenActivity_Finish\r\n            // \r\n            this.confirmOverwriteEventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.confirmOverwriteEventDrivenActivity_Finish.Activities.Add(this.setStateActivity10);\r\n            this.confirmOverwriteEventDrivenActivity_Finish.Name = \"confirmOverwriteEventDrivenActivity_Finish\";\r\n            // \r\n            // confirmOverwriteStateInitializationActivity\r\n            // \r\n            this.confirmOverwriteStateInitializationActivity.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.confirmOverwriteStateInitializationActivity.Name = \"confirmOverwriteStateInitializationActivity\";\r\n            // \r\n            // finalizeStateInitializationActivity\r\n            // \r\n            this.finalizeStateInitializationActivity.Activities.Add(this.ifElse_IsUploadTypeOk);\r\n            this.finalizeStateInitializationActivity.Name = \"finalizeStateInitializationActivity\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.ifElseActivity1);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // stateInitializationActivity\r\n            // \r\n            this.stateInitializationActivity.Activities.Add(this.dataDialogFormActivity1);\r\n            this.stateInitializationActivity.Name = \"stateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.initializeCodeActivity_Initialize);\r\n            this.initializeStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // confirmOverwriteStateActivity\r\n            // \r\n            this.confirmOverwriteStateActivity.Activities.Add(this.confirmOverwriteStateInitializationActivity);\r\n            this.confirmOverwriteStateActivity.Activities.Add(this.confirmOverwriteEventDrivenActivity_Finish);\r\n            this.confirmOverwriteStateActivity.Activities.Add(this.confirmOverwriteEventDrivenActivity_Cancel);\r\n            this.confirmOverwriteStateActivity.Name = \"confirmOverwriteStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.finalizeStateInitializationActivity);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.stateInitializationActivity);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // UploadWebsiteFileWorkflow\r\n            // \r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.confirmOverwriteStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"UploadWebsiteFileWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity initializeStateActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity dataDialogFormActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private StateInitializationActivity finalizeStateInitializationActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private StateInitializationActivity stateInitializationActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private CodeActivity initializeCodeActivity_Initialize;\r\n        private CodeActivity finalizeCodeActivity_SaveFile;\r\n        private SetStateActivity setStateActivity6;\r\n        private CodeActivity finalizeCodeActivity_ShowErrorMessage;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElse_IsUploadTypeOk;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private StateInitializationActivity confirmOverwriteStateInitializationActivity;\r\n        private StateActivity confirmOverwriteStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseActivity ifElseActivity1;\r\n        private SetStateActivity setStateActivity8;\r\n        private SetStateActivity setStateActivity9;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity3;\r\n        private SetStateActivity setStateActivity10;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private EventDrivenActivity confirmOverwriteEventDrivenActivity_Cancel;\r\n        private EventDrivenActivity confirmOverwriteEventDrivenActivity_Finish;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/WebsiteFileElementProvider/UploadWebsiteFileWorkflow.layout",
    "content": "<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"UploadWebsiteFileWorkflow\" Location=\"30; 30\" Size=\"1153; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"UploadWebsiteFileWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"UploadWebsiteFileWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"296\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"392\" Y=\"179\" />\r\n\t\t\t\t<ns0:Point X=\"392\" Y=\"380\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"490\" Y=\"445\" />\r\n\t\t\t\t<ns0:Point X=\"608\" Y=\"445\" />\r\n\t\t\t\t<ns0:Point X=\"608\" Y=\"539\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"494\" Y=\"469\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"469\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"707\" Y=\"580\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"580\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"372\" />\r\n\t\t\t\t<ns0:Point X=\"392\" Y=\"372\" />\r\n\t\t\t\t<ns0:Point X=\"392\" Y=\"380\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"707\" Y=\"580\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"580\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"372\" />\r\n\t\t\t\t<ns0:Point X=\"392\" Y=\"372\" />\r\n\t\t\t\t<ns0:Point X=\"392\" Y=\"380\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"finalizeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"707\" Y=\"580\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"580\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"confirmOverwriteStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity8\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"confirmOverwriteStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"490\" Y=\"445\" />\r\n\t\t\t\t<ns0:Point X=\"506\" Y=\"445\" />\r\n\t\t\t\t<ns0:Point X=\"506\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"373\" />\r\n\t\t\t\t<ns0:Point X=\"282\" Y=\"668\" />\r\n\t\t\t\t<ns0:Point X=\"380\" Y=\"668\" />\r\n\t\t\t\t<ns0:Point X=\"380\" Y=\"680\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity9\" SourceStateName=\"confirmOverwriteStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"confirmOverwriteStateActivity\" EventHandlerName=\"confirmOverwriteEventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"511\" Y=\"769\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"769\" />\r\n\t\t\t\t<ns0:Point X=\"1058\" Y=\"798\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity10\" SourceStateName=\"confirmOverwriteStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"confirmOverwriteStateActivity\" EventHandlerName=\"confirmOverwriteEventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"507\" Y=\"745\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"745\" />\r\n\t\t\t\t<ns0:Point X=\"720\" Y=\"531\" />\r\n\t\t\t\t<ns0:Point X=\"608\" Y=\"531\" />\r\n\t\t\t\t<ns0:Point X=\"608\" Y=\"539\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"90; 138\" Size=\"210; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"initializeStateInitializationActivity\" Location=\"98; 169\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity_Initialize\" Location=\"108; 231\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"108; 291\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"971; 798\" Size=\"175; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"287; 380\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"stateInitializationActivity\" Location=\"295; 411\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"dataDialogFormActivity1\" Location=\"305; 473\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"381; 363\" Name=\"step1EventDrivenActivity_Finish\" Location=\"295; 435\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"420; 497\" />\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity1\" Location=\"305; 557\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity5\" Location=\"324; 628\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"334; 690\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity6\" Location=\"497; 628\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"507; 690\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"295; 459\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"305; 521\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"305; 581\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"506; 539\" Size=\"205; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 423\" Name=\"finalizeStateInitializationActivity\" Location=\"416; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 342\" Name=\"ifElse_IsUploadTypeOk\" Location=\"426; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 242\" Name=\"ifElseBranchActivity1\" Location=\"445; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_SaveFile\" Location=\"455; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"455; 403\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"455; 463\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 242\" Name=\"ifElseBranchActivity2\" Location=\"618; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizeCodeActivity_ShowErrorMessage\" Location=\"628; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"628; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"confirmOverwriteStateActivity\" Location=\"245; 680\" Size=\"270; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"confirmOverwriteStateInitializationActivity\" Location=\"253; 711\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"confirmDialogFormActivity1\" Location=\"263; 773\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 194\" Name=\"confirmOverwriteEventDrivenActivity_Finish\" Location=\"253; 735\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity2\" Location=\"263; 797\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 53\" Name=\"setStateActivity10\" Location=\"263; 857\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"confirmOverwriteEventDrivenActivity_Cancel\" Location=\"253; 759\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity3\" Location=\"263; 821\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"263; 881\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/AddNewXsltFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n    partial class AddNewXsltFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingPageCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingActiveLanguageCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity_PageExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finalizecodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.dialogFormActivity1 = new Composite.C1Console.Workflow.Activities.DataDialogFormActivity();\r\n            this.ifElseActivity_CheckActiveLanguagesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.validateStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.stateInitializationActivity4 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.step1EventDrivenActivity_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.step1EventDrivenActivity_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity2 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.validateStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.finalizeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.step1StateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // MissingPageCodeActivity\r\n            // \r\n            this.MissingPageCodeActivity.Name = \"MissingPageCodeActivity\";\r\n            this.MissingPageCodeActivity.ExecuteCode += new System.EventHandler(this.MissingPageCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.MissingPageCodeActivity);\r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity8);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.initializeCodeActivity);\r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity2);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckPageExists);\r\n            this.ifElseBranchActivity5.Condition = codecondition1;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"step1StateActivity\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"finalizeStateActivity\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // MissingActiveLanguageCodeActivity\r\n            // \r\n            this.MissingActiveLanguageCodeActivity.Name = \"MissingActiveLanguageCodeActivity\";\r\n            this.MissingActiveLanguageCodeActivity.ExecuteCode += new System.EventHandler(this.MissingActiveLanguageCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseActivity_PageExists\r\n            // \r\n            this.ifElseActivity_PageExists.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElseActivity_PageExists.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity_PageExists.Name = \"ifElseActivity_PageExists\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity4);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity3);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsValidData);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.MissingActiveLanguageCodeActivity);\r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.ifElseActivity_PageExists);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckActiveLanguagesExists);\r\n            this.ifElseBranchActivity3.Condition = codecondition3;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // finalizecodeActivity\r\n            // \r\n            this.finalizecodeActivity.Name = \"finalizecodeActivity\";\r\n            this.finalizecodeActivity.ExecuteCode += new System.EventHandler(this.finalizecodeActivity_ExecuteCode);\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"validateStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity1\r\n            // \r\n            this.finishHandleExternalEventActivity1.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity1.Name = \"finishHandleExternalEventActivity1\";\r\n            // \r\n            // dialogFormActivity1\r\n            // \r\n            this.dialogFormActivity1.ContainerLabel = \"Add new\";\r\n            this.dialogFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\AddNewXsltFunctionStep1.xml\";\r\n            this.dialogFormActivity1.Name = \"dialogFormActivity1\";\r\n            // \r\n            // ifElseActivity_CheckActiveLanguagesExists\r\n            // \r\n            this.ifElseActivity_CheckActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity_CheckActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity_CheckActiveLanguagesExists.Name = \"ifElseActivity_CheckActiveLanguagesExists\";\r\n            // \r\n            // validateStateInitializationActivity\r\n            // \r\n            this.validateStateInitializationActivity.Activities.Add(this.ifElseActivity1);\r\n            this.validateStateInitializationActivity.Name = \"validateStateInitializationActivity\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // stateInitializationActivity4\r\n            // \r\n            this.stateInitializationActivity4.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.stateInitializationActivity4.Activities.Add(this.finalizecodeActivity);\r\n            this.stateInitializationActivity4.Activities.Add(this.setStateActivity1);\r\n            this.stateInitializationActivity4.Name = \"stateInitializationActivity4\";\r\n            // \r\n            // step1EventDrivenActivity_Cancel\r\n            // \r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.step1EventDrivenActivity_Cancel.Activities.Add(this.setStateActivity6);\r\n            this.step1EventDrivenActivity_Cancel.Name = \"step1EventDrivenActivity_Cancel\";\r\n            // \r\n            // step1EventDrivenActivity_Finish\r\n            // \r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.finishHandleExternalEventActivity1);\r\n            this.step1EventDrivenActivity_Finish.Activities.Add(this.setStateActivity5);\r\n            this.step1EventDrivenActivity_Finish.Name = \"step1EventDrivenActivity_Finish\";\r\n            // \r\n            // stateInitializationActivity2\r\n            // \r\n            this.stateInitializationActivity2.Activities.Add(this.dialogFormActivity1);\r\n            this.stateInitializationActivity2.Name = \"stateInitializationActivity2\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.ifElseActivity_CheckActiveLanguagesExists);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // validateStateActivity\r\n            // \r\n            this.validateStateActivity.Activities.Add(this.validateStateInitializationActivity);\r\n            this.validateStateActivity.Name = \"validateStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity7);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // finalizeStateActivity\r\n            // \r\n            this.finalizeStateActivity.Activities.Add(this.stateInitializationActivity4);\r\n            this.finalizeStateActivity.Name = \"finalizeStateActivity\";\r\n            // \r\n            // step1StateActivity\r\n            // \r\n            this.step1StateActivity.Activities.Add(this.stateInitializationActivity2);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Finish);\r\n            this.step1StateActivity.Activities.Add(this.step1EventDrivenActivity_Cancel);\r\n            this.step1StateActivity.Name = \"step1StateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // AddNewXsltFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.step1StateActivity);\r\n            this.Activities.Add(this.finalizeStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.validateStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"AddNewXsltFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private StateActivity finalStateActivity;\r\n        private StateActivity finalizeStateActivity;\r\n        private StateActivity step1StateActivity;\r\n        private StateInitializationActivity stateInitializationActivity4;\r\n        private StateInitializationActivity stateInitializationActivity2;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity1;\r\n        private CodeActivity initializeCodeActivity;\r\n        private EventDrivenActivity step1EventDrivenActivity_Finish;\r\n        private Composite.C1Console.Workflow.Activities.DataDialogFormActivity dialogFormActivity1;\r\n        private CodeActivity finalizecodeActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private SetStateActivity setStateActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private StateInitializationActivity validateStateInitializationActivity;\r\n        private StateActivity validateStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private SetStateActivity setStateActivity3;\r\n        private SetStateActivity setStateActivity6;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private EventDrivenActivity step1EventDrivenActivity_Cancel;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElseActivity_CheckActiveLanguagesExists;\r\n        private CodeActivity MissingActiveLanguageCodeActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private IfElseActivity ifElseActivity_PageExists;\r\n        private CodeActivity MissingPageCodeActivity;\r\n        private SetStateActivity setStateActivity8;\r\n        private SetStateActivity setStateActivity9;\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/AddNewXsltFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Transactions;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.XsltBasedFunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\nusing Composite.Data.Validation;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n\r\n\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class AddNewXsltFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        private static readonly string Binding_CopyFromFunctionId = \"CopyFromFunctionId\";\r\n        private static readonly string Binding_CopyFromOptions = \"CopyFromOptions\";\r\n\r\n        private static string _newXsltMarkup = string.Format(@\"<?xml version=\"\"1.0\"\" encoding=\"\"UTF-8\"\"?>\r\n<xsl:stylesheet version=\"\"1.0\"\" xmlns:xsl=\"\"http://www.w3.org/1999/XSL/Transform\"\"\r\n\txmlns:in=\"\"{0}\"\"\r\n\txmlns:lang=\"\"{1}\"\"\r\n\txmlns:f=\"\"{2}\"\"\r\n\txmlns=\"\"http://www.w3.org/1999/xhtml\"\"\r\n\texclude-result-prefixes=\"\"xsl in lang f\"\">\r\n\r\n\t<xsl:template match=\"\"/\"\">\r\n\t\t<html>\r\n\t\t\t<head>\r\n\t\t\t\t<!-- markup placed here will be shown in the head section of the rendered page -->\r\n\t\t\t</head>\r\n\r\n\t\t\t<body>\r\n\t\t\t\t<!-- markup placed here will be the output of this rendering -->\r\n\t\t\t\t<div>\r\n\t\t\t\t\tValue of input parameter 'TestParam': \r\n\t\t\t\t\t<xsl:value-of select=\"\"/in:inputs/in:param[@name='Input parameter name']\"\" />\r\n\t\t\t\t</div>\r\n\t\t\t\t<div>\r\n\t\t\t\t\tValue of function call 'TestCall': \r\n\t\t\t\t\t<xsl:value-of select=\"\"/in:inputs/in:result[@name='Function call local name']\"\" />\r\n\t\t\t\t</div>\r\n\t\t\t</body>\r\n\t\t</html>\r\n\t</xsl:template>\r\n\r\n</xsl:stylesheet>\r\n\", RenderHelper.XsltInput10, LocalizationXmlConstants.XmlNamespace, Namespaces.Function10);\r\n\r\n\r\n        public AddNewXsltFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void CheckActiveLanguagesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = UserSettings.ActiveLocaleCultureInfo != null;\r\n        }\r\n\r\n\r\n\r\n        private void CheckPageExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = DataFacade.GetData<IPage>().Any();\r\n        }\r\n\r\n\r\n\r\n        private void MissingActiveLanguageCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(DialogType.Message,\r\n                GetText(\"AddNewXsltFunctionWorkflow.MissingActiveLanguageTitle\"),\r\n                GetText(\"AddNewXsltFunctionWorkflow.MissingActiveLanguageMessage\"));\r\n        }\r\n\r\n\r\n\r\n        private void MissingPageCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(\r\n                DialogType.Message,\r\n                GetText(\"AddNewXsltFunctionWorkflow.MissingPageTitle\"),\r\n                GetText(\"AddNewXsltFunctionWorkflow.MissingPageMessage\"));\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            IXsltFunction xsltFunction = DataFacade.BuildNew<IXsltFunction>();\r\n            xsltFunction.Id = Guid.NewGuid();\r\n            xsltFunction.Name = \"\";\r\n            xsltFunction.OutputXmlSubType = \"XHTML\";\r\n            xsltFunction.Description = \"\";\r\n\r\n            BaseFunctionFolderElementEntityToken folderToken = (BaseFunctionFolderElementEntityToken)this.EntityToken;\r\n            xsltFunction.Namespace = folderToken.FunctionNamespace ?? UserSettings.LastSpecifiedNamespace;\r\n\r\n            this.Bindings.Add(\"NewXslt\", xsltFunction);\r\n\r\n            var copyOfOptions = new List<KeyValuePair<Guid, string>>();\r\n\r\n            foreach (IXsltFunction function in DataFacade.GetData<IXsltFunction>())\r\n            {\r\n                string fullName = function.Namespace + \".\" + function.Name;\r\n                copyOfOptions.Add(new KeyValuePair<Guid, string>(function.Id, fullName));\r\n            }\r\n\r\n            // Sorting alphabetically by function's full name\r\n            copyOfOptions.Sort((a, b) => a.Value.CompareTo(b.Value));\r\n\r\n            copyOfOptions.Insert(0, new KeyValuePair<Guid, string>(Guid.Empty, GetText(\"AddNewXsltFunctionStep1.LabelCopyFromEmptyOption\")));\r\n\r\n            this.Bindings.Add(Binding_CopyFromFunctionId, Guid.Empty);\r\n            this.Bindings.Add(Binding_CopyFromOptions, copyOfOptions);\r\n        }\r\n\r\n\r\n\r\n        private void IsValidData(object sender, ConditionalEventArgs e)\r\n        {\r\n            IXsltFunction function = this.GetBinding<IXsltFunction>(\"NewXslt\");\r\n\r\n            e.Result = false;\r\n\r\n            if (function.Name == string.Empty)\r\n            {\r\n                this.ShowFieldMessage(\"NewXslt.Name\", GetText(\"AddNewXsltFunctionWorkflow.MethodEmpty\"));\r\n                return;\r\n            }\r\n\r\n            if (string.IsNullOrWhiteSpace(function.Namespace))\r\n            {\r\n                this.ShowFieldMessage(\"NewXslt.Namespace\", GetText(\"AddNewXsltFunctionWorkflow.NamespaceEmpty\"));\r\n                return;\r\n            }\r\n\r\n            if (!function.Namespace.IsCorrectNamespace('.'))\r\n            {\r\n                this.ShowFieldMessage(\"NewXslt.Namespace\", GetText(\"AddNewXsltFunctionWorkflow.InvalidNamespace\"));\r\n                return;\r\n            }\r\n\r\n            string functionName = function.Name;\r\n            string functionNamespace = function.Namespace;\r\n            bool nameIsReserved = DataFacade.GetData<IXsltFunction>()\r\n                .Where(func => string.Compare(func.Name, functionName, true) == 0\r\n                            && string.Compare(func.Namespace, functionNamespace, true) == 0)\r\n                .Any();\r\n\r\n            if (nameIsReserved)\r\n            {\r\n                this.ShowFieldMessage(\"NewXslt.Name\", GetText(\"AddNewXsltFunctionWorkflow.DuplicateName\"));\r\n                return;\r\n            }\r\n\r\n            function.XslFilePath = function.CreateXslFilePath();\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate<IXsltFunction>(function);\r\n            if (!validationResults.IsValid)\r\n            {\r\n                foreach (ValidationResult result in validationResults)\r\n                {\r\n                    this.ShowFieldMessage(string.Format(\"{0}.{1}\", \"NewXslt\", result.Key), result.Message);\r\n                }\r\n\r\n                return;\r\n            }\r\n\r\n\r\n            if (!function.ValidateXslFilePath())\r\n            {\r\n                this.ShowFieldMessage(\"NewXslt.Name\", GetText(\"AddNewXsltFunctionWorkflow.TotalNameTooLang\"));\r\n                return;\r\n            }\r\n\r\n\r\n            IXsltFile xsltfile = DataFacade.BuildNew<IXsltFile>();\r\n            xsltfile.FolderPath = System.IO.Path.GetDirectoryName(function.XslFilePath);\r\n            xsltfile.FileName = System.IO.Path.GetFileName(function.XslFilePath);\r\n\r\n            if (!DataFacade.ValidatePath(xsltfile, \"XslFileProvider\"))\r\n            {\r\n                this.ShowFieldMessage(\"NewXslt.Name\", GetText(\"AddNewXsltFunctionWorkflow.TotalNameTooLang\"));\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n\r\n        private void finalizecodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);\r\n\r\n            IXsltFunction xslt = this.GetBinding<IXsltFunction>(\"NewXslt\");\r\n            Guid copyFromFunctionId = this.GetBinding<Guid>(Binding_CopyFromFunctionId);\r\n\r\n            IXsltFunction copyFromFunction = null;\r\n            if(copyFromFunctionId != Guid.Empty)\r\n            {\r\n                copyFromFunction = DataFacade.GetData<IXsltFunction>().First(f => f.Id == copyFromFunctionId);\r\n            }\r\n\r\n            xslt.XslFilePath = xslt.CreateXslFilePath();\r\n\r\n            IFile file = IFileServices.TryGetFile<IXsltFile>(xslt.XslFilePath);\r\n\r\n            using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n            {\r\n                if (file == null)\r\n                {\r\n                    IXsltFile xsltfile = DataFacade.BuildNew<IXsltFile>();\r\n\r\n                    xsltfile.FolderPath = System.IO.Path.GetDirectoryName(xslt.XslFilePath);\r\n                    xsltfile.FileName = System.IO.Path.GetFileName(xslt.XslFilePath);\r\n\r\n                    string xslTemplate = _newXsltMarkup;\r\n                    if (copyFromFunction != null)\r\n                    {\r\n                        IFile copyFromFile = IFileServices.GetFile<IXsltFile>(copyFromFunction.XslFilePath);\r\n                        xslTemplate = copyFromFile.ReadAllText();\r\n                    }\r\n\r\n                    xsltfile.SetNewContent(xslTemplate);\r\n                    \r\n                    DataFacade.AddNew<IXsltFile>(xsltfile, \"XslFileProvider\");\r\n                }\r\n\r\n                xslt = DataFacade.AddNew<IXsltFunction>(xslt);\r\n\r\n                UserSettings.LastSpecifiedNamespace = xslt.Namespace;\r\n\r\n                \r\n                if (copyFromFunction != null)\r\n                {\r\n                    CloneFunctionParameters(copyFromFunction, xslt);\r\n                    CloneFunctionCalls(copyFromFunction, xslt);\r\n                }\r\n\r\n                transactionScope.Complete();\r\n            }\r\n            addNewTreeRefresher.PostRefreshMesseges(xslt.GetDataEntityToken());\r\n\r\n            FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n            var executionService = container.GetService<IActionExecutionService>();\r\n            executionService.Execute(xslt.GetDataEntityToken(), new WorkflowActionToken(typeof(EditXsltFunctionWorkflow)), null);\r\n        }\r\n\r\n        private void CloneFunctionParameters(IXsltFunction sourceFunction, IXsltFunction copyTo)\r\n        {\r\n            var parameters = DataFacade.GetData<IParameter>(p => p.OwnerId == sourceFunction.Id).ToList();\r\n            foreach (IParameter parameter in parameters)\r\n            {\r\n                var clonedFunctionParameter = DataFacade.BuildNew<IParameter>();\r\n                clonedFunctionParameter.OwnerId = copyTo.Id;\r\n\r\n                clonedFunctionParameter.ParameterId = Guid.NewGuid();\r\n                clonedFunctionParameter.Name = parameter.Name;\r\n                clonedFunctionParameter.TypeManagerName = parameter.TypeManagerName;\r\n                clonedFunctionParameter.HelpText = parameter.HelpText;\r\n                clonedFunctionParameter.Label = parameter.Label;\r\n                clonedFunctionParameter.DefaultValueFunctionMarkup = parameter.DefaultValueFunctionMarkup;\r\n                clonedFunctionParameter.Position = parameter.Position;\r\n                clonedFunctionParameter.TestValueFunctionMarkup = parameter.TestValueFunctionMarkup;\r\n                clonedFunctionParameter.WidgetFunctionMarkup = parameter.WidgetFunctionMarkup;\r\n\r\n                DataFacade.AddNew(clonedFunctionParameter);\r\n            }\r\n        }\r\n\r\n        private void CloneFunctionCalls(IXsltFunction sourceFunction, IXsltFunction copyTo)\r\n        {\r\n            var namedFunctionCalls = DataFacade.GetData<INamedFunctionCall>(nfc => nfc.XsltFunctionId == sourceFunction.Id).ToList();\r\n            foreach (INamedFunctionCall namedFunctionCall in namedFunctionCalls)\r\n            {\r\n                var clonedFunctionCall = DataFacade.BuildNew<INamedFunctionCall>();\r\n                clonedFunctionCall.XsltFunctionId = copyTo.Id;\r\n                clonedFunctionCall.Name = namedFunctionCall.Name;\r\n                clonedFunctionCall.SerializedFunction = namedFunctionCall.SerializedFunction;\r\n\r\n                DataFacade.AddNew(clonedFunctionCall);\r\n            }\r\n        }\r\n\r\n        private static string GetText(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", key);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/AddNewXsltFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"AddNewXsltFunctionWorkflow\" Location=\"30; 30\" Size=\"1145; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"AddNewXsltFunctionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"AddNewXsltFunctionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"996\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"996\" Y=\"713\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"stateInitializationActivity1\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"234\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"243\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"243\" Y=\"394\" />\r\n\t\t\t\t<ns0:Point X=\"235\" Y=\"394\" />\r\n\t\t\t\t<ns0:Point X=\"235\" Y=\"406\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"validateStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"validateStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Finish\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"333\" Y=\"471\" />\r\n\t\t\t\t<ns0:Point X=\"353\" Y=\"471\" />\r\n\t\t\t\t<ns0:Point X=\"353\" Y=\"423\" />\r\n\t\t\t\t<ns0:Point X=\"558\" Y=\"423\" />\r\n\t\t\t\t<ns0:Point X=\"558\" Y=\"431\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity6\" SourceStateName=\"step1StateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"step1StateActivity\" EventHandlerName=\"step1EventDrivenActivity_Cancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"337\" Y=\"495\" />\r\n\t\t\t\t<ns0:Point X=\"353\" Y=\"495\" />\r\n\t\t\t\t<ns0:Point X=\"353\" Y=\"873\" />\r\n\t\t\t\t<ns0:Point X=\"996\" Y=\"873\" />\r\n\t\t\t\t<ns0:Point X=\"996\" Y=\"793\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity1\" SourceStateName=\"finalizeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"finalizeStateActivity\" EventHandlerName=\"stateInitializationActivity4\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"819\" Y=\"825\" />\r\n\t\t\t\t<ns0:Point X=\"996\" Y=\"825\" />\r\n\t\t\t\t<ns0:Point X=\"996\" Y=\"793\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalizeStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalizeStateActivity\" SourceActivity=\"validateStateActivity\" EventHandlerName=\"validateStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"659\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"735\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"735\" Y=\"784\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"step1StateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Bottom\" SetStateName=\"setStateActivity4\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"step1StateActivity\" SourceActivity=\"validateStateActivity\" EventHandlerName=\"validateStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"659\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"675\" Y=\"472\" />\r\n\t\t\t\t<ns0:Point X=\"675\" Y=\"516\" />\r\n\t\t\t\t<ns0:Point X=\"235\" Y=\"516\" />\r\n\t\t\t\t<ns0:Point X=\"235\" Y=\"508\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"63; 105\" Size=\"175; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"612; 544\" Name=\"stateInitializationActivity1\" Location=\"296; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 463\" Name=\"ifElseActivity_CheckActiveLanguagesExists\" Location=\"306; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 363\" Name=\"ifElseBranchActivity3\" Location=\"325; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity_PageExists\" Location=\"335; 343\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity5\" Location=\"354; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"364; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"364; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity6\" Location=\"527; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingPageCodeActivity\" Location=\"537; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"537; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 363\" Name=\"ifElseBranchActivity4\" Location=\"729; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingActiveLanguageCodeActivity\" Location=\"739; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"739; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"step1StateActivity\" Location=\"130; 406\" Size=\"211; 102\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"stateInitializationActivity2\" Location=\"138; 437\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"dialogFormActivity1\" Location=\"148; 499\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Finish\" Location=\"138; 461\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"finishHandleExternalEventActivity1\" Location=\"148; 523\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"148; 583\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"step1EventDrivenActivity_Cancel\" Location=\"138; 485\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity2\" Location=\"148; 547\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"148; 607\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalizeStateActivity\" Location=\"648; 784\" Size=\"175; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 242\" Name=\"stateInitializationActivity4\" Location=\"656; 815\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"closeCurrentViewActivity1\" Location=\"666; 877\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"finalizecodeActivity\" Location=\"666; 937\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"666; 997\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"916; 713\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"validateStateActivity\" Location=\"454; 431\" Size=\"209; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"validateStateInitializationActivity\" Location=\"462; 462\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity1\" Location=\"472; 524\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"491; 595\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"501; 657\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"664; 595\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"674; 657\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/Common.cs",
    "content": "﻿using Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n    internal static class Common\r\n    {\r\n        internal static string CreateXslFilePath(this IXsltFunction xsltFunction)\r\n        {\r\n            return string.Format(\"/{0}/{1}.xsl\", xsltFunction.Namespace.Replace(\".\", \"/\"), xsltFunction.Name).Replace(\"//\", \"/\").Replace('\\\\', '/');\r\n        }\r\n\r\n\r\n        internal static bool ValidateXslFilePath(this IXsltFunction xsltFunction)\r\n        {\r\n            if (xsltFunction.XslFilePath == null) return false;\r\n            if (xsltFunction.XslFilePath.Length > 240) return false;       \r\n\r\n            return true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/DeleteXsltFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n    partial class DeleteXsltFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n        \r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.finishHandleExternalEventActivity2 = new Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity();\r\n            this.confirmDialogFormActivity1 = new Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.closeCurrentViewActivity1 = new Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity();\r\n            this.codeActivity1 = new System.Workflow.Activities.CodeActivity();\r\n            this.confirm_Cancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.confirm_Finish = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.stateInitializationActivity1 = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.deleteStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.confirmStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.deleteStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity2\r\n            // \r\n            this.cancelHandleExternalEventActivity2.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity2.Name = \"cancelHandleExternalEventActivity2\";\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"deleteStateActivity\";\r\n            // \r\n            // finishHandleExternalEventActivity2\r\n            // \r\n            this.finishHandleExternalEventActivity2.EventName = \"Finish\";\r\n            this.finishHandleExternalEventActivity2.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.finishHandleExternalEventActivity2.Name = \"finishHandleExternalEventActivity2\";\r\n            // \r\n            // confirmDialogFormActivity1\r\n            // \r\n            this.confirmDialogFormActivity1.ContainerLabel = null;\r\n            this.confirmDialogFormActivity1.FormDefinitionFileName = \"/Administrative/DeleteXsltFunctionConfirm.xml\";\r\n            this.confirmDialogFormActivity1.Name = \"confirmDialogFormActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // closeCurrentViewActivity1\r\n            // \r\n            this.closeCurrentViewActivity1.Name = \"closeCurrentViewActivity1\";\r\n            // \r\n            // codeActivity1\r\n            // \r\n            this.codeActivity1.Name = \"codeActivity1\";\r\n            this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);\r\n            // \r\n            // confirm_Cancel\r\n            // \r\n            this.confirm_Cancel.Activities.Add(this.cancelHandleExternalEventActivity2);\r\n            this.confirm_Cancel.Activities.Add(this.setStateActivity4);\r\n            this.confirm_Cancel.Name = \"confirm_Cancel\";\r\n            // \r\n            // confirm_Finish\r\n            // \r\n            this.confirm_Finish.Activities.Add(this.finishHandleExternalEventActivity2);\r\n            this.confirm_Finish.Activities.Add(this.setStateActivity3);\r\n            this.confirm_Finish.Name = \"confirm_Finish\";\r\n            // \r\n            // stateInitializationActivity1\r\n            // \r\n            this.stateInitializationActivity1.Activities.Add(this.confirmDialogFormActivity1);\r\n            this.stateInitializationActivity1.Name = \"stateInitializationActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // deleteStateInitializationActivity\r\n            // \r\n            this.deleteStateInitializationActivity.Activities.Add(this.codeActivity1);\r\n            this.deleteStateInitializationActivity.Activities.Add(this.closeCurrentViewActivity1);\r\n            this.deleteStateInitializationActivity.Activities.Add(this.setStateActivity1);\r\n            this.deleteStateInitializationActivity.Name = \"deleteStateInitializationActivity\";\r\n            // \r\n            // confirmStateActivity\r\n            // \r\n            this.confirmStateActivity.Activities.Add(this.stateInitializationActivity1);\r\n            this.confirmStateActivity.Activities.Add(this.confirm_Finish);\r\n            this.confirmStateActivity.Activities.Add(this.confirm_Cancel);\r\n            this.confirmStateActivity.Name = \"confirmStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity2);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // deleteStateActivity\r\n            // \r\n            this.deleteStateActivity.Activities.Add(this.deleteStateInitializationActivity);\r\n            this.deleteStateActivity.Name = \"deleteStateActivity\";\r\n            // \r\n            // DeleteXsltFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.deleteStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.confirmStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"confirmStateActivity\";\r\n            this.Name = \"DeleteXsltFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private CodeActivity codeActivity1;\r\n        private StateInitializationActivity deleteStateInitializationActivity;\r\n        private SetStateActivity setStateActivity1;\r\n        private SetStateActivity setStateActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private StateActivity finalStateActivity;\r\n        private Composite.C1Console.Workflow.Activities.ConfirmDialogFormActivity confirmDialogFormActivity1;\r\n        private EventDrivenActivity confirm_Cancel;\r\n        private EventDrivenActivity confirm_Finish;\r\n        private StateInitializationActivity stateInitializationActivity1;\r\n        private StateActivity confirmStateActivity;\r\n        private SetStateActivity setStateActivity4;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity2;\r\n        private SetStateActivity setStateActivity3;\r\n        private Composite.C1Console.Workflow.Activities.FinishHandleExternalEventActivity finishHandleExternalEventActivity2;\r\n        private Composite.C1Console.Workflow.Activities.CloseCurrentViewActivity closeCurrentViewActivity1;\r\n        private StateActivity deleteStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/DeleteXsltFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class DeleteXsltFunctionWorkflow : BaseFunctionWorkflow\r\n    {\r\n        public DeleteXsltFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void DeleteFile(IFile file)\r\n        {\r\n            FileSystemFileBase baseFile = file as FileSystemFileBase;\r\n            if(baseFile == null) return;\r\n\r\n            string filePath = baseFile.SystemPath;\r\n            try\r\n            {\r\n                C1File.Delete(filePath);\r\n            }\r\n            catch\r\n            {\r\n                LoggingService.LogWarning(typeof(DeleteXsltFunctionWorkflow).Name, \"Failed to delete file '{0}'\".FormatWith(filePath));\r\n            }\r\n        }\r\n\r\n        private void codeActivity1_ExecuteCode(object sender, EventArgs e)\r\n        {            \r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n\r\n            IXsltFunction xsltFunction = (IXsltFunction)dataEntityToken.Data;\r\n\r\n            if (DataFacade.WillDeleteSucceed<IXsltFunction>(xsltFunction))\r\n            {\r\n                DeleteTreeRefresher deleteTreeRefresher = this.CreateDeleteTreeRefresher(this.EntityToken);\r\n\r\n\r\n                IFile file = IFileServices.TryGetFile<IXsltFile>(xsltFunction.XslFilePath);\r\n                DataFacade.Delete<IParameter>(f => f.OwnerId == xsltFunction.Id);\r\n                DataFacade.Delete<INamedFunctionCall>(f => f.XsltFunctionId == xsltFunction.Id);\r\n                DataFacade.Delete(xsltFunction);\r\n\r\n                DeleteFile(file);\r\n\r\n                int count =\r\n                    (from info in DataFacade.GetData<IXsltFunction>()\r\n                     where info.Namespace == xsltFunction.Namespace\r\n                     select info).Count();\r\n\r\n                if (count == 0)\r\n                {\r\n                    RefreshFunctionTree();\r\n                }\r\n                else\r\n                {\r\n                    deleteTreeRefresher.PostRefreshMesseges();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                this.ShowMessage(\r\n                        DialogType.Error,\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"DeleteXsltFunctionWorkflow.CascadeDeleteErrorTitle\"),\r\n                        StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", \"DeleteXsltFunctionWorkflow.CascadeDeleteErrorMessage\")\r\n                    );\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/EditXsltFunctionWorkflow.Designer.cs",
    "content": "using System;\r\nusing System.ComponentModel;\r\nusing System.ComponentModel.Design;\r\nusing System.Collections;\r\nusing System.Drawing;\r\nusing System.Reflection;\r\nusing System.Workflow.ComponentModel.Compiler;\r\nusing System.Workflow.ComponentModel.Serialization;\r\nusing System.Workflow.ComponentModel;\r\nusing System.Workflow.ComponentModel.Design;\r\nusing System.Workflow.Runtime;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Activities.Rules;\r\nusing Composite.C1Console.Workflow;\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n    partial class EditXsltFunctionWorkflow\r\n    {\r\n        #region Designer generated code\r\n\r\n        /// <summary> \r\n        /// Required method for Designer support - do not modify \r\n        /// the contents of this method with the code editor.\r\n        /// </summary>\r\n        [System.Diagnostics.DebuggerNonUserCode]\r\n        private void InitializeComponent()\r\n        {\r\n            this.CanModifyActivities = true;\r\n            System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();\r\n            System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();\r\n            this.setStateActivity8 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingPageCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity3 = new System.Workflow.Activities.SetStateActivity();\r\n            this.initializeCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseBranchActivity6 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity5 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.setStateActivity7 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity6 = new System.Workflow.Activities.SetStateActivity();\r\n            this.setStateActivity9 = new System.Workflow.Activities.SetStateActivity();\r\n            this.MissingActiveLanguageCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.ifElseActivity_CheckPageExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity4 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseBranchActivity3 = new System.Workflow.Activities.IfElseBranchActivity();\r\n            this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();\r\n            this.setStateActivity2 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveCodeActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.setStateActivity4 = new System.Workflow.Activities.SetStateActivity();\r\n            this.editPreviewActivity = new System.Workflow.Activities.CodeActivity();\r\n            this.previewHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity();\r\n            this.setStateActivity1 = new System.Workflow.Activities.SetStateActivity();\r\n            this.saveHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity();\r\n            this.documentFormActivity1 = new Composite.C1Console.Workflow.Activities.DocumentFormActivity();\r\n            this.ifElseActivity_CheckActiveLanguagesExists = new System.Workflow.Activities.IfElseActivity();\r\n            this.validateInitializeStateActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.setStateActivity5 = new System.Workflow.Activities.SetStateActivity();\r\n            this.cancelHandleExternalEventActivity1 = new Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity();\r\n            this.saveStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.editEventDrivenActivity_Preview = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.saveEventDrivenActivity_Save = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.editStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.initializeStateInitializationActivity = new System.Workflow.Activities.StateInitializationActivity();\r\n            this.validateStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.eventDrivenActivity_GlobalCancel = new System.Workflow.Activities.EventDrivenActivity();\r\n            this.finalStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.saveStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.editStateActivity = new System.Workflow.Activities.StateActivity();\r\n            this.initializeStateActivity = new System.Workflow.Activities.StateActivity();\r\n            // \r\n            // setStateActivity8\r\n            // \r\n            this.setStateActivity8.Name = \"setStateActivity8\";\r\n            this.setStateActivity8.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // MissingPageCodeActivity\r\n            // \r\n            this.MissingPageCodeActivity.Name = \"MissingPageCodeActivity\";\r\n            this.MissingPageCodeActivity.ExecuteCode += new System.EventHandler(this.MissingPageCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity3\r\n            // \r\n            this.setStateActivity3.Name = \"setStateActivity3\";\r\n            this.setStateActivity3.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // initializeCodeActivity\r\n            // \r\n            this.initializeCodeActivity.Name = \"initializeCodeActivity\";\r\n            this.initializeCodeActivity.ExecuteCode += new System.EventHandler(this.initializeCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseBranchActivity6\r\n            // \r\n            this.ifElseBranchActivity6.Activities.Add(this.MissingPageCodeActivity);\r\n            this.ifElseBranchActivity6.Activities.Add(this.setStateActivity8);\r\n            this.ifElseBranchActivity6.Name = \"ifElseBranchActivity6\";\r\n            // \r\n            // ifElseBranchActivity5\r\n            // \r\n            this.ifElseBranchActivity5.Activities.Add(this.initializeCodeActivity);\r\n            this.ifElseBranchActivity5.Activities.Add(this.setStateActivity3);\r\n            codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckPageExists);\r\n            this.ifElseBranchActivity5.Condition = codecondition1;\r\n            this.ifElseBranchActivity5.Name = \"ifElseBranchActivity5\";\r\n            // \r\n            // setStateActivity7\r\n            // \r\n            this.setStateActivity7.Name = \"setStateActivity7\";\r\n            this.setStateActivity7.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // setStateActivity6\r\n            // \r\n            this.setStateActivity6.Name = \"setStateActivity6\";\r\n            this.setStateActivity6.TargetStateName = \"saveStateActivity\";\r\n            // \r\n            // setStateActivity9\r\n            // \r\n            this.setStateActivity9.Name = \"setStateActivity9\";\r\n            this.setStateActivity9.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // MissingActiveLanguageCodeActivity\r\n            // \r\n            this.MissingActiveLanguageCodeActivity.Name = \"MissingActiveLanguageCodeActivity\";\r\n            this.MissingActiveLanguageCodeActivity.ExecuteCode += new System.EventHandler(this.MissingActiveLanguageCodeActivity_ExecuteCode);\r\n            // \r\n            // ifElseActivity_CheckPageExists\r\n            // \r\n            this.ifElseActivity_CheckPageExists.Activities.Add(this.ifElseBranchActivity5);\r\n            this.ifElseActivity_CheckPageExists.Activities.Add(this.ifElseBranchActivity6);\r\n            this.ifElseActivity_CheckPageExists.Name = \"ifElseActivity_CheckPageExists\";\r\n            // \r\n            // ifElseBranchActivity2\r\n            // \r\n            this.ifElseBranchActivity2.Activities.Add(this.setStateActivity7);\r\n            this.ifElseBranchActivity2.Name = \"ifElseBranchActivity2\";\r\n            // \r\n            // ifElseBranchActivity1\r\n            // \r\n            this.ifElseBranchActivity1.Activities.Add(this.setStateActivity6);\r\n            codecondition2.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.IsValidData);\r\n            this.ifElseBranchActivity1.Condition = codecondition2;\r\n            this.ifElseBranchActivity1.Name = \"ifElseBranchActivity1\";\r\n            // \r\n            // ifElseBranchActivity4\r\n            // \r\n            this.ifElseBranchActivity4.Activities.Add(this.MissingActiveLanguageCodeActivity);\r\n            this.ifElseBranchActivity4.Activities.Add(this.setStateActivity9);\r\n            this.ifElseBranchActivity4.Name = \"ifElseBranchActivity4\";\r\n            // \r\n            // ifElseBranchActivity3\r\n            // \r\n            this.ifElseBranchActivity3.Activities.Add(this.ifElseActivity_CheckPageExists);\r\n            codecondition3.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.CheckActiveLanguagesExists);\r\n            this.ifElseBranchActivity3.Condition = codecondition3;\r\n            this.ifElseBranchActivity3.Name = \"ifElseBranchActivity3\";\r\n            // \r\n            // ifElseActivity1\r\n            // \r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);\r\n            this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);\r\n            this.ifElseActivity1.Name = \"ifElseActivity1\";\r\n            // \r\n            // setStateActivity2\r\n            // \r\n            this.setStateActivity2.Name = \"setStateActivity2\";\r\n            this.setStateActivity2.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // saveCodeActivity\r\n            // \r\n            this.saveCodeActivity.Name = \"saveCodeActivity\";\r\n            this.saveCodeActivity.ExecuteCode += new System.EventHandler(this.saveCodeActivity_ExecuteCode);\r\n            // \r\n            // setStateActivity4\r\n            // \r\n            this.setStateActivity4.Name = \"setStateActivity4\";\r\n            this.setStateActivity4.TargetStateName = \"editStateActivity\";\r\n            // \r\n            // editPreviewActivity\r\n            // \r\n            this.editPreviewActivity.Name = \"editPreviewActivity\";\r\n            this.editPreviewActivity.ExecuteCode += new System.EventHandler(this.editPreviewActivity_ExecuteCode);\r\n            // \r\n            // previewHandleExternalEventActivity1\r\n            // \r\n            this.previewHandleExternalEventActivity1.EventName = \"Preview\";\r\n            this.previewHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.previewHandleExternalEventActivity1.Name = \"previewHandleExternalEventActivity1\";\r\n            // \r\n            // setStateActivity1\r\n            // \r\n            this.setStateActivity1.Name = \"setStateActivity1\";\r\n            this.setStateActivity1.TargetStateName = \"validateStateActivity\";\r\n            // \r\n            // saveHandleExternalEventActivity1\r\n            // \r\n            this.saveHandleExternalEventActivity1.EventName = \"Save\";\r\n            this.saveHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.saveHandleExternalEventActivity1.Name = \"saveHandleExternalEventActivity1\";\r\n            // \r\n            // documentFormActivity1\r\n            // \r\n            this.documentFormActivity1.ContainerLabel = null;\r\n            this.documentFormActivity1.CustomToolbarDefinitionFileName = null;\r\n            this.documentFormActivity1.FormDefinitionFileName = \"\\\\Administrative\\\\EditXsltFunction.xml\";\r\n            this.documentFormActivity1.Name = \"documentFormActivity1\";\r\n            // \r\n            // ifElseActivity_CheckActiveLanguagesExists\r\n            // \r\n            this.ifElseActivity_CheckActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity3);\r\n            this.ifElseActivity_CheckActiveLanguagesExists.Activities.Add(this.ifElseBranchActivity4);\r\n            this.ifElseActivity_CheckActiveLanguagesExists.Name = \"ifElseActivity_CheckActiveLanguagesExists\";\r\n            // \r\n            // validateInitializeStateActivity\r\n            // \r\n            this.validateInitializeStateActivity.Activities.Add(this.ifElseActivity1);\r\n            this.validateInitializeStateActivity.Name = \"validateInitializeStateActivity\";\r\n            // \r\n            // setStateActivity5\r\n            // \r\n            this.setStateActivity5.Name = \"setStateActivity5\";\r\n            this.setStateActivity5.TargetStateName = \"finalStateActivity\";\r\n            // \r\n            // cancelHandleExternalEventActivity1\r\n            // \r\n            this.cancelHandleExternalEventActivity1.EventName = \"Cancel\";\r\n            this.cancelHandleExternalEventActivity1.InterfaceType = typeof(Composite.C1Console.Workflow.IFormsWorkflowEventService);\r\n            this.cancelHandleExternalEventActivity1.Name = \"cancelHandleExternalEventActivity1\";\r\n            // \r\n            // saveStateInitializationActivity\r\n            // \r\n            this.saveStateInitializationActivity.Activities.Add(this.saveCodeActivity);\r\n            this.saveStateInitializationActivity.Activities.Add(this.setStateActivity2);\r\n            this.saveStateInitializationActivity.Name = \"saveStateInitializationActivity\";\r\n            // \r\n            // editEventDrivenActivity_Preview\r\n            // \r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.previewHandleExternalEventActivity1);\r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.editPreviewActivity);\r\n            this.editEventDrivenActivity_Preview.Activities.Add(this.setStateActivity4);\r\n            this.editEventDrivenActivity_Preview.Name = \"editEventDrivenActivity_Preview\";\r\n            // \r\n            // saveEventDrivenActivity_Save\r\n            // \r\n            this.saveEventDrivenActivity_Save.Activities.Add(this.saveHandleExternalEventActivity1);\r\n            this.saveEventDrivenActivity_Save.Activities.Add(this.setStateActivity1);\r\n            this.saveEventDrivenActivity_Save.Name = \"saveEventDrivenActivity_Save\";\r\n            // \r\n            // editStateInitializationActivity\r\n            // \r\n            this.editStateInitializationActivity.Activities.Add(this.documentFormActivity1);\r\n            this.editStateInitializationActivity.Name = \"editStateInitializationActivity\";\r\n            // \r\n            // initializeStateInitializationActivity\r\n            // \r\n            this.initializeStateInitializationActivity.Activities.Add(this.ifElseActivity_CheckActiveLanguagesExists);\r\n            this.initializeStateInitializationActivity.Name = \"initializeStateInitializationActivity\";\r\n            // \r\n            // validateStateActivity\r\n            // \r\n            this.validateStateActivity.Activities.Add(this.validateInitializeStateActivity);\r\n            this.validateStateActivity.Name = \"validateStateActivity\";\r\n            // \r\n            // eventDrivenActivity_GlobalCancel\r\n            // \r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.cancelHandleExternalEventActivity1);\r\n            this.eventDrivenActivity_GlobalCancel.Activities.Add(this.setStateActivity5);\r\n            this.eventDrivenActivity_GlobalCancel.Name = \"eventDrivenActivity_GlobalCancel\";\r\n            // \r\n            // finalStateActivity\r\n            // \r\n            this.finalStateActivity.Name = \"finalStateActivity\";\r\n            // \r\n            // saveStateActivity\r\n            // \r\n            this.saveStateActivity.Activities.Add(this.saveStateInitializationActivity);\r\n            this.saveStateActivity.Name = \"saveStateActivity\";\r\n            // \r\n            // editStateActivity\r\n            // \r\n            this.editStateActivity.Activities.Add(this.editStateInitializationActivity);\r\n            this.editStateActivity.Activities.Add(this.saveEventDrivenActivity_Save);\r\n            this.editStateActivity.Activities.Add(this.editEventDrivenActivity_Preview);\r\n            this.editStateActivity.Name = \"editStateActivity\";\r\n            // \r\n            // initializeStateActivity\r\n            // \r\n            this.initializeStateActivity.Activities.Add(this.initializeStateInitializationActivity);\r\n            this.initializeStateActivity.Name = \"initializeStateActivity\";\r\n            // \r\n            // EditXsltFunctionWorkflow\r\n            // \r\n            this.Activities.Add(this.initializeStateActivity);\r\n            this.Activities.Add(this.editStateActivity);\r\n            this.Activities.Add(this.saveStateActivity);\r\n            this.Activities.Add(this.finalStateActivity);\r\n            this.Activities.Add(this.eventDrivenActivity_GlobalCancel);\r\n            this.Activities.Add(this.validateStateActivity);\r\n            this.CompletedStateName = \"finalStateActivity\";\r\n            this.DynamicUpdateCondition = null;\r\n            this.InitialStateName = \"initializeStateActivity\";\r\n            this.Name = \"EditXsltFunctionWorkflow\";\r\n            this.CanModifyActivities = false;\r\n\r\n        }\r\n\r\n        #endregion\r\n\r\n        private SetStateActivity setStateActivity2;\r\n        private SetStateActivity setStateActivity1;\r\n        private Composite.C1Console.Workflow.Activities.SaveHandleExternalEventActivity saveHandleExternalEventActivity1;\r\n        private SetStateActivity setStateActivity3;\r\n        private CodeActivity initializeCodeActivity;\r\n        private StateInitializationActivity saveStateInitializationActivity;\r\n        private EventDrivenActivity saveEventDrivenActivity_Save;\r\n        private StateInitializationActivity editStateInitializationActivity;\r\n        private StateInitializationActivity initializeStateInitializationActivity;\r\n        private StateActivity saveStateActivity;\r\n        private StateActivity editStateActivity;\r\n        private CodeActivity saveCodeActivity;\r\n        private Composite.C1Console.Workflow.Activities.DocumentFormActivity documentFormActivity1;\r\n        private Composite.C1Console.Workflow.Activities.PreviewHandleExternalEventActivity previewHandleExternalEventActivity1;\r\n        private EventDrivenActivity editEventDrivenActivity_Preview;\r\n        private SetStateActivity setStateActivity4;\r\n        private CodeActivity editPreviewActivity;\r\n        private SetStateActivity setStateActivity5;\r\n        private Composite.C1Console.Workflow.Activities.CancelHandleExternalEventActivity cancelHandleExternalEventActivity1;\r\n        private EventDrivenActivity eventDrivenActivity_GlobalCancel;\r\n        private StateActivity finalStateActivity;\r\n        private StateInitializationActivity validateInitializeStateActivity;\r\n        private StateActivity validateStateActivity;\r\n        private SetStateActivity setStateActivity7;\r\n        private SetStateActivity setStateActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity2;\r\n        private IfElseBranchActivity ifElseBranchActivity1;\r\n        private IfElseActivity ifElseActivity1;\r\n        private SetStateActivity setStateActivity8;\r\n        private CodeActivity MissingPageCodeActivity;\r\n        private IfElseBranchActivity ifElseBranchActivity6;\r\n        private IfElseBranchActivity ifElseBranchActivity5;\r\n        private SetStateActivity setStateActivity9;\r\n        private CodeActivity MissingActiveLanguageCodeActivity;\r\n        private IfElseActivity ifElseActivity_CheckPageExists;\r\n        private IfElseBranchActivity ifElseBranchActivity4;\r\n        private IfElseBranchActivity ifElseBranchActivity3;\r\n        private IfElseActivity ifElseActivity_CheckActiveLanguagesExists;\r\n        private StateActivity initializeStateActivity;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/EditXsltFunctionWorkflow.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Threading;\r\nusing System.Transactions;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Workflow.Activities;\r\nusing System.Workflow.Runtime;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Serialization;\r\nusing System.Xml.Xsl;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Users;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Workflow.Foundation;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Localization;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Threading;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.FlowMediators.FormFlowRendering;\r\nusing Composite.Core.WebClient.FunctionCallEditor;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\nusing Composite.Data.Transactions;\r\nusing Composite.Data.Types;\r\nusing Composite.Data.Validation;\r\nusing Composite.Functions;\r\nusing Composite.Functions.ManagedParameters;\r\nusing Composite.Plugins.Elements.ElementProviders.BaseFunctionProviderElementProvider;\r\nusing Composite.Plugins.Functions.FunctionProviders.XsltBasedFunctionProvider;\r\nusing Microsoft.Practices.EnterpriseLibrary.Validation;\r\n\r\n\r\nnamespace Composite.Plugins.Elements.ElementProviders.XsltBasedFunctionProviderElementProvider\r\n{\r\n    [EntityTokenLock()]\r\n    [AllowPersistingWorkflow(WorkflowPersistingType.Idle)]\r\n    public sealed partial class EditXsltFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow\r\n    {\r\n        public EditXsltFunctionWorkflow()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n        private void CheckActiveLanguagesExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = UserSettings.ActiveLocaleCultureInfo != null;\r\n        }\r\n\r\n\r\n\r\n        private void CheckPageExists(object sender, ConditionalEventArgs e)\r\n        {\r\n            e.Result = DataFacade.GetData<IPage>().Any();\r\n        }\r\n\r\n\r\n\r\n        private void MissingActiveLanguageCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(DialogType.Message,\r\n                GetString(\"EditXsltFunctionWorkflow.MissingActiveLanguageTitle\"),\r\n                GetString(\"EditXsltFunctionWorkflow.MissingActiveLanguageMessage\"));\r\n        }\r\n\r\n\r\n\r\n        private void MissingPageCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            ShowMessage(\r\n                DialogType.Message,\r\n                GetString(\"EditXsltFunctionWorkflow.MissingPageTitle\"),\r\n                GetString(\"EditXsltFunctionWorkflow.MissingPageMessage\"));\r\n        }\r\n\r\n\r\n\r\n        private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken;\r\n            IXsltFunction xsltFunction = (IXsltFunction)dataEntityToken.Data;\r\n            IFile file = IFileServices.GetFile<IXsltFile>(xsltFunction.XslFilePath);\r\n            IEnumerable<ManagedParameterDefinition> parameters = ManagedParameterManager.Load(xsltFunction.Id);\r\n            this.Bindings.Add(\"CurrentXslt\", dataEntityToken.Data);\r\n            this.Bindings.Add(\"Parameters\", parameters);\r\n\r\n            // popular type widgets\r\n            List<Type> popularTypes = DataFacade.GetAllInterfaces(UserType.Developer);\r\n            var popularWidgetTypes = FunctionFacade.WidgetFunctionSupportedTypes.Where(f => f.GetGenericArguments().Any(g => popularTypes.Any(h => h.IsAssignableFrom(g))));\r\n\r\n            IEnumerable<Type> parameterTypeOptions = FunctionFacade.FunctionSupportedTypes.Union(popularWidgetTypes).Union(FunctionFacade.WidgetFunctionSupportedTypes);\r\n\r\n            // At the moment we don't have functions that return IEnumerable<XNode>, so we're hardcoding this type for now\r\n            parameterTypeOptions = parameterTypeOptions.Union(new [] { typeof (IEnumerable<XNode>) });\r\n\r\n            this.Bindings.Add(\"ParameterTypeOptions\", parameterTypeOptions.ToList());\r\n\r\n            string xsltDocumentString = file.ReadAllText();\r\n            this.Bindings.Add(\"XslTemplate\", xsltDocumentString);\r\n            this.Bindings.Add(\"XslTemplateLastSaveHash\", xsltDocumentString.GetHashCode());\r\n\r\n            List<string> functionErrors;\r\n            List<NamedFunctionCall> FunctionCalls = RenderHelper.GetValidFunctionCalls(xsltFunction.Id, out functionErrors).ToList();\r\n\r\n            if ((functionErrors != null) && (functionErrors.Any()))\r\n            {\r\n                foreach (string error in functionErrors)\r\n                {\r\n                    this.ShowMessage(DialogType.Error, \"A function call has been dropped\", error);\r\n                }\r\n            }\r\n\r\n            this.Bindings.Add(\"FunctionCalls\", FunctionCalls);\r\n            this.Bindings.Add(\"PageId\", PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault());\r\n\r\n            if (UserSettings.ActiveLocaleCultureInfo != null)\r\n            {\r\n                List<KeyValuePair<string, string>> activeCulturesDictionary = UserSettings.ActiveLocaleCultureInfos.Select(f => new KeyValuePair<string, string>(f.Name,DataLocalizationFacade.GetCultureTitle(f))).ToList();\r\n                this.Bindings.Add(\"ActiveCultureName\", UserSettings.ActiveLocaleCultureInfo.Name);\r\n                this.Bindings.Add(\"ActiveCulturesList\", activeCulturesDictionary);\r\n            }\r\n\r\n            this.Bindings.Add(\"PageDataScopeName\", DataScopeIdentifier.AdministratedName);\r\n            this.Bindings.Add(\"PageDataScopeList\", new Dictionary<string, string> \r\n            { \r\n                { DataScopeIdentifier.AdministratedName, GetString(\"EditXsltFunction.LabelAdminitrativeScope\") }, \r\n                { DataScopeIdentifier.PublicName, GetString(\"EditXsltFunction.LabelPublicScope\") } \r\n            });\r\n\r\n\r\n            // Creating a session state object\r\n            Guid stateId = Guid.NewGuid();\r\n            var state = new FunctionCallDesignerState { WorkflowId = WorkflowInstanceId, ConsoleIdInternal = GetCurrentConsoleId() };\r\n            SessionStateManager.DefaultProvider.AddState<IFunctionCallEditorState>(stateId, state, DateTime.Now.AddDays(7.0));\r\n\r\n            this.Bindings.Add(\"SessionStateProvider\", SessionStateManager.DefaultProviderName);\r\n            this.Bindings.Add(\"SessionStateId\", stateId);\r\n        }\r\n\r\n\r\n        private void IsValidData(object sender, ConditionalEventArgs e)\r\n        {\r\n            IXsltFunction function = this.GetBinding<IXsltFunction>(\"CurrentXslt\");\r\n\r\n            if (function.Name == string.Empty)\r\n            {\r\n                this.ShowFieldMessage(\"CurrentXslt.Name\", GetString(\"EditXsltFunctionWorkflow.EmptyMethodName\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n\r\n            if (string.IsNullOrWhiteSpace(function.Namespace))\r\n            {\r\n                this.ShowFieldMessage(\"CurrentXslt.Namespace\", GetString(\"EditXsltFunctionWorkflow.NamespaceEmpty\"));\r\n                return;\r\n            }\r\n\r\n\r\n            if (!function.Namespace.IsCorrectNamespace('.'))\r\n            {\r\n                this.ShowFieldMessage(\"CurrentXslt.Namespace\", GetString(\"EditXsltFunctionWorkflow.InvalidNamespace\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n\r\n            if (!(function.XslFilePath.StartsWith(\"\\\\\") || function.XslFilePath.StartsWith(\"/\")))\r\n            {\r\n                this.ShowFieldMessage(\"CurrentXslt.Name\", GetString(\"EditXsltFunctionWorkflow.InvalidFileName\"));\r\n                e.Result = false;\r\n                return;\r\n            }\r\n\r\n\r\n            function.XslFilePath = function.CreateXslFilePath();\r\n\r\n            ValidationResults validationResults = ValidationFacade.Validate<IXsltFunction>(function);\r\n            if (!validationResults.IsValid)\r\n            {\r\n                foreach (ValidationResult result in validationResults)\r\n                {\r\n                    this.ShowFieldMessage(string.Format(\"{0}.{1}\", \"CurrentXslt\", result.Key), result.Message);\r\n                }\r\n\r\n                return;\r\n            }\r\n\r\n\r\n            if (!function.ValidateXslFilePath())\r\n            {\r\n                this.ShowFieldMessage(\"NewXslt.Name\", GetString(\"AddNewXsltFunctionWorkflow.TotalNameTooLang\"));\r\n                return;\r\n            }\r\n\r\n\r\n            IXsltFile xsltfile = DataFacade.BuildNew<IXsltFile>();\r\n            xsltfile.FolderPath = System.IO.Path.GetDirectoryName(function.XslFilePath);\r\n            xsltfile.FileName = System.IO.Path.GetFileName(function.XslFilePath);\r\n\r\n            if (!DataFacade.ValidatePath(xsltfile, \"XslFileProvider\"))\r\n            {\r\n                this.ShowFieldMessage(\"CurrentXslt.Name\", GetString(\"EditXsltFunctionWorkflow.TotalNameTooLang\"));\r\n                return;\r\n            }\r\n\r\n            e.Result = true;\r\n        }\r\n\r\n\r\n        private void editPreviewActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            Stopwatch functionCallingStopwatch = null;\r\n            long millisecondsToken = 0;\r\n\r\n            CultureInfo oldCurrentCulture = Thread.CurrentThread.CurrentCulture;\r\n            CultureInfo oldCurrentUICulture = Thread.CurrentThread.CurrentUICulture;\r\n\r\n            try\r\n            {\r\n                IXsltFunction xslt = this.GetBinding<IXsltFunction>(\"CurrentXslt\");\r\n\r\n                string xslTemplate = this.GetBinding<string>(\"XslTemplate\");\r\n\r\n                IFile persistemTemplateFile = IFileServices.TryGetFile<IXsltFile>(xslt.XslFilePath);\r\n                if (persistemTemplateFile != null)\r\n                {\r\n                    string persistemTemplate = persistemTemplateFile.ReadAllText();\r\n\r\n                    if (this.GetBinding<int>(\"XslTemplateLastSaveHash\") != persistemTemplate.GetHashCode())\r\n                    {\r\n                        xslTemplate = persistemTemplate;\r\n                        ConsoleMessageQueueFacade.Enqueue(new LogEntryMessageQueueItem { Level = LogLevel.Fine, Message = \"XSLT file on file system was used. It has been changed by another process.\", Sender = this.GetType() }, this.GetCurrentConsoleId());\r\n                    }\r\n                }\r\n\r\n                List<NamedFunctionCall> namedFunctions = this.GetBinding<IEnumerable<NamedFunctionCall>>(\"FunctionCalls\").ToList();\r\n\r\n                // If preview is done multiple times in a row, with no postbacks an object reference to BaseFunctionRuntimeTreeNode may be held\r\n                // If the function in the BaseFunctionRuntimeTreeNode have ben unloaded / reloaded, this preview will still run on the old instance\r\n                // We force refresh by serializing / deserializing\r\n                foreach (NamedFunctionCall namedFunction in namedFunctions)\r\n                {\r\n                    namedFunction.FunctionCall = (BaseFunctionRuntimeTreeNode)FunctionFacade.BuildTree(namedFunction.FunctionCall.Serialize());\r\n                }\r\n\r\n\r\n                List<ManagedParameterDefinition> parameterDefinitions = this.GetBinding<IEnumerable<ManagedParameterDefinition>>(\"Parameters\").ToList();\r\n\r\n                Guid pageId = this.GetBinding<Guid>(\"PageId\");\r\n                string dataScopeName = this.GetBinding<string>(\"PageDataScopeName\");\r\n                string cultureName = this.GetBinding<string>(\"ActiveCultureName\");\r\n                CultureInfo cultureInfo = null;\r\n                if (cultureName != null)\r\n                {\r\n                    cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);\r\n                }\r\n\r\n                IPage page;\r\n\r\n                TransformationInputs transformationInput;\r\n                using (new DataScope(DataScopeIdentifier.Deserialize(dataScopeName), cultureInfo))\r\n                {\r\n                    Thread.CurrentThread.CurrentCulture = cultureInfo;\r\n                    Thread.CurrentThread.CurrentUICulture = cultureInfo;\r\n\r\n                    page = DataFacade.GetData<IPage>(f => f.Id == pageId).FirstOrDefault();\r\n                    if (page != null)\r\n                    {\r\n                        PageRenderer.CurrentPage = page;\r\n                    }\r\n\r\n                    functionCallingStopwatch = Stopwatch.StartNew();\r\n                    transformationInput = RenderHelper.BuildInputDocument(namedFunctions, parameterDefinitions, true);\r\n                    functionCallingStopwatch.Stop();\r\n\r\n                    Thread.CurrentThread.CurrentCulture = oldCurrentCulture;\r\n                    Thread.CurrentThread.CurrentUICulture = oldCurrentUICulture;\r\n                }\r\n\r\n\r\n                string output = \"\";\r\n                string error = \"\";\r\n                try\r\n                {\r\n                    Thread.CurrentThread.CurrentCulture = cultureInfo;\r\n                    Thread.CurrentThread.CurrentUICulture = cultureInfo;\r\n\r\n                    var styleSheet = XElement.Parse(xslTemplate);\r\n\r\n                    XsltBasedFunctionProvider.ResolveImportIncludePaths(styleSheet);\r\n\r\n                    LocalizationParser.Parse(styleSheet);\r\n\r\n                    XDocument transformationResult = new XDocument();\r\n                    using (XmlWriter writer = new LimitedDepthXmlWriter(transformationResult.CreateWriter()))\r\n                    {\r\n                        XslCompiledTransform xslTransformer = new XslCompiledTransform();\r\n                        xslTransformer.Load(styleSheet.CreateReader(), XsltSettings.TrustedXslt, new XmlUrlResolver());\r\n\r\n                        XsltArgumentList transformArgs = new XsltArgumentList();\r\n                        XslExtensionsManager.Register(transformArgs);\r\n\r\n                        if (transformationInput.ExtensionDefinitions != null)\r\n                        {\r\n                            foreach (IXsltExtensionDefinition extensionDef in transformationInput.ExtensionDefinitions)\r\n                            {\r\n                                transformArgs.AddExtensionObject(extensionDef.ExtensionNamespace.ToString(),\r\n                                                                 extensionDef.EntensionObjectAsObject);\r\n                            }\r\n                        }\r\n\r\n                        Exception exception = null;\r\n                        HttpContext httpContext = HttpContext.Current;\r\n\r\n                        Thread thread = new Thread(delegate()\r\n                           {\r\n                               Thread.CurrentThread.CurrentCulture = cultureInfo;\r\n                               Thread.CurrentThread.CurrentUICulture = cultureInfo;\r\n\r\n                               Stopwatch transformationStopwatch = Stopwatch.StartNew();\r\n\r\n                               try\r\n                               {\r\n                                   using (ThreadDataManager.Initialize())\r\n                                   using (new DataScope(DataScopeIdentifier.Deserialize(dataScopeName), cultureInfo))\r\n                                   {\r\n                                       HttpContext.Current = httpContext;\r\n\r\n                                       var reader = transformationInput.InputDocument.CreateReader();\r\n                                       xslTransformer.Transform(reader, transformArgs, writer);\r\n                                   }\r\n                               }\r\n                               catch (ThreadAbortException ex)\r\n                               {\r\n                                   exception = ex;\r\n                                   Thread.ResetAbort();\r\n                               }\r\n                               catch (Exception ex)\r\n                               {\r\n                                   exception = ex;\r\n                               }\r\n\r\n                               transformationStopwatch.Stop();\r\n\r\n                               millisecondsToken = transformationStopwatch.ElapsedMilliseconds;\r\n                           });\r\n\r\n                        thread.Start();\r\n                        bool res = thread.Join(1000);  // sadly, this needs to be low enough to prevent StackOverflowException from fireing.\r\n\r\n                        if (res == false)\r\n                        {\r\n                            if (thread.ThreadState == System.Threading.ThreadState.Running)\r\n                            {\r\n                                thread.Abort();\r\n                            }\r\n                            throw new XslLoadException(\"Transformation took more than 1000 milliseconds to complete. This could be due to a never ending recursive call. Execution aborted to prevent fatal StackOverflowException.\");\r\n                        }\r\n\r\n                        if (exception != null)\r\n                        {\r\n                            throw exception;\r\n                        }\r\n                    }\r\n\r\n                    if (xslt.OutputXmlSubType == \"XHTML\")\r\n                    {\r\n                        XhtmlDocument xhtmlDocument = new XhtmlDocument(transformationResult);\r\n\r\n                        output = xhtmlDocument.Root.ToString();\r\n                    }\r\n                    else\r\n                    {\r\n                        output = transformationResult.Root.ToString();\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    output = \"<error/>\";\r\n                    error = string.Format(\"{0}\\n{1}\", ex.GetType().Name, ex.Message);\r\n\r\n                    Exception inner = ex.InnerException;\r\n\r\n                    string indent = \"\";\r\n\r\n                    while (inner != null)\r\n                    {\r\n                        indent = indent + \" - \";\r\n                        error = error + \"\\n\" + indent + inner.Message;\r\n                        inner = inner.InnerException;\r\n                    }\r\n                }\r\n                finally\r\n                {\r\n                    Thread.CurrentThread.CurrentCulture = oldCurrentCulture;\r\n                    Thread.CurrentThread.CurrentUICulture = oldCurrentUICulture;\r\n                }\r\n\r\n                Page currentPage = HttpContext.Current.Handler as Page;\r\n                if (currentPage == null) throw new InvalidOperationException(\"The Current HttpContext Handler must be a System.Web.Ui.Page\");\r\n\r\n                UserControl inOutControl = (UserControl)currentPage.LoadControl(UrlUtils.ResolveAdminUrl(\"controls/Misc/MarkupInOutView.ascx\"));\r\n                inOutControl.Attributes.Add(\"in\", transformationInput.InputDocument.ToString());\r\n                inOutControl.Attributes.Add(\"out\", output);\r\n                inOutControl.Attributes.Add(\"error\", error);\r\n                inOutControl.Attributes.Add(\"statusmessage\", string.Format(\"Execution times: Total {0} ms. Functions: {1} ms. XSLT: {2} ms.\",\r\n                    millisecondsToken + functionCallingStopwatch.ElapsedMilliseconds,\r\n                    functionCallingStopwatch.ElapsedMilliseconds,\r\n                    millisecondsToken));\r\n\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                var webRenderService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n                webRenderService.SetNewPageOutput(inOutControl);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                Control errOutput = new LiteralControl(\"<pre>\" + ex.ToString() + \"</pre>\");\r\n                var webRenderService = serviceContainer.GetService<IFormFlowWebRenderingService>();\r\n                webRenderService.SetNewPageOutput(errOutput);\r\n            }\r\n        }\r\n\r\n\r\n        private IEnumerable<INamedFunctionCall> ConvertFunctionCalls(IEnumerable<NamedFunctionCall> FunctionCalls, Guid xsltId)\r\n        {\r\n            foreach (NamedFunctionCall namedFunctionCall in FunctionCalls)\r\n            {\r\n                INamedFunctionCall newNamedFunctionCall = DataFacade.BuildNew<INamedFunctionCall>();\r\n                newNamedFunctionCall.XsltFunctionId = xsltId;\r\n                newNamedFunctionCall.Name = namedFunctionCall.Name;\r\n                newNamedFunctionCall.SerializedFunction = namedFunctionCall.FunctionCall.Serialize().ToString(SaveOptions.DisableFormatting);\r\n\r\n                yield return newNamedFunctionCall;\r\n            }\r\n        }\r\n\r\n\r\n        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)\r\n        {\r\n            try\r\n            {\r\n                IXsltFunction xslt = this.GetBinding<IXsltFunction>(\"CurrentXslt\");\r\n                IXsltFunction previousXslt = DataFacade.GetData<IXsltFunction>(f => f.Id == xslt.Id).SingleOrDefault();\r\n\r\n                IFile persistemTemplateFile = IFileServices.TryGetFile<IXsltFile>(xslt.XslFilePath);\r\n                if (persistemTemplateFile != null)\r\n                {\r\n                    string persistemTemplate = (persistemTemplateFile != null ? persistemTemplateFile.ReadAllText() : \"\");\r\n\r\n                    if (this.GetBinding<int>(\"XslTemplateLastSaveHash\") != persistemTemplate.GetHashCode())\r\n                    {\r\n                        this.Bindings[\"XslTemplate\"] = persistemTemplate;\r\n                        this.RerenderView();\r\n                        ConsoleMessageQueueFacade.Enqueue(new LogEntryMessageQueueItem { Level = LogLevel.Fine, Message = \"XSLT file on file system has been changed by another process. In-browser editor updated to reflect file on file system.\", Sender = this.GetType() }, this.GetCurrentConsoleId());\r\n                    }\r\n                }\r\n\r\n                string xslTemplate = this.GetBinding<string>(\"XslTemplate\");\r\n\r\n                var parameters = this.GetBinding<IEnumerable<ManagedParameterDefinition>>(\"Parameters\");\r\n\r\n                IEnumerable<NamedFunctionCall> FunctionCalls = this.GetBinding<IEnumerable<NamedFunctionCall>>(\"FunctionCalls\");\r\n                \r\n                if (FunctionCalls.Select(f => f.Name).Distinct().Count() != FunctionCalls.Count())\r\n                {                    \r\n                    ShowMessage(DialogType.Error,\r\n                        GetString(\"EditXsltFunctionWorkflow.SameLocalFunctionNameClashTitle\"),\r\n                        GetString(\"EditXsltFunctionWorkflow.SameLocalFunctionNameClashMessage\"));\r\n                    return;\r\n                }\r\n\r\n\r\n                using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope())\r\n                {\r\n                    // Renaming related file if necessary\r\n                    string oldRelativePath = previousXslt.XslFilePath.Replace('\\\\', '/'); // This replace takes care of old paths having \\ in them\r\n                    string newRelativePath = xslt.CreateXslFilePath();\r\n\r\n                    if (string.Compare(oldRelativePath, newRelativePath, true) != 0)\r\n                    {\r\n                        var xlsFile = IFileServices.GetFile<IXsltFile>(previousXslt.XslFilePath);\r\n                        string systemPath = (xlsFile as FileSystemFileBase).SystemPath;\r\n                        // Implement it in another way?\r\n                        string xsltFilesRoot = systemPath.Substring(0, systemPath.Length - previousXslt.XslFilePath.Length);\r\n\r\n                        string newSystemPath = (xsltFilesRoot + newRelativePath).Replace('\\\\', '/');\r\n\r\n                        if ((string.Compare(systemPath, newSystemPath, true) != 0) && C1File.Exists(newSystemPath))\r\n                        {\r\n                            FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                            var consoleMessageService = serviceContainer.GetService<IManagementConsoleMessageService>();\r\n                            consoleMessageService.ShowMessage(\r\n                                DialogType.Error,\r\n                                GetString(\"EditXsltFunctionWorkflow.InvalidName\"),\r\n                                GetString(\"EditXsltFunctionWorkflow.CannotRenameFileExists\").FormatWith(newSystemPath));\r\n                            return;\r\n                        }\r\n\r\n                        string directoryPath = Path.GetDirectoryName(newSystemPath);\r\n                        if (!C1Directory.Exists(directoryPath))\r\n                        {\r\n                            C1Directory.CreateDirectory(directoryPath);\r\n                        }\r\n\r\n                        C1File.Move(systemPath, newSystemPath);\r\n\r\n                        xslt.XslFilePath = newRelativePath;\r\n\r\n                        // TODO: Implement removing empty Xslt directories\r\n                    }\r\n\r\n\r\n                    IFile file = IFileServices.GetFile<IXsltFile>(xslt.XslFilePath);\r\n                    file.SetNewContent(xslTemplate);\r\n\r\n                    ManagedParameterManager.Save(xslt.Id, parameters);\r\n\r\n                    DataFacade.Update(xslt);\r\n                    DataFacade.Update(file);\r\n\r\n                    this.Bindings[\"XslTemplateLastSaveHash\"] = xslTemplate.GetHashCode();\r\n\r\n\r\n                    DataFacade.Delete<INamedFunctionCall>(f => f.XsltFunctionId == xslt.Id);\r\n                    DataFacade.AddNew<INamedFunctionCall>(ConvertFunctionCalls(FunctionCalls, xslt.Id));\r\n\r\n                    transactionScope.Complete();\r\n                }\r\n\r\n                if (previousXslt.Namespace != xslt.Namespace || previousXslt.Name != xslt.Name || previousXslt.Description != xslt.Description)\r\n                {\r\n                    // This is a some what nasty hack. Due to the nature of the BaseFunctionProviderElementProvider, this hack is needed\r\n                    BaseFunctionFolderElementEntityToken entityToken = new BaseFunctionFolderElementEntityToken(\"ROOT:XsltBasedFunctionProviderElementProvider\");\r\n                    RefreshEntityToken(entityToken);\r\n                }\r\n\r\n                SetSaveStatus(true);\r\n\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogCritical(\"XSLT Save\", ex);\r\n\r\n                FlowControllerServicesContainer serviceContainer = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId);\r\n                var consoleMsgService = serviceContainer.GetService<IManagementConsoleMessageService>();\r\n                consoleMsgService.ShowMessage(DialogType.Error, \"Error\", ex.Message);\r\n\r\n                SetSaveStatus(false);\r\n            }\r\n        }\r\n\r\n        private static string GetString(string key)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Plugins.XsltBasedFunction\", key);\r\n        }\r\n\r\n        // This is for propergating error message with never ending recursive calls\r\n        private sealed class XslLoadException : Exception\r\n        {\r\n            public XslLoadException(string message)\r\n                : base(message)\r\n            {\r\n            }\r\n        }\r\n\r\n        [Serializable]\r\n        public sealed class FunctionCallDesignerState : IFunctionCallEditorState\r\n        {\r\n            public Guid WorkflowId { get; set; }\r\n            public string ConsoleIdInternal { get; set; }\r\n\r\n            private FormData GetFormData()\r\n            {\r\n                var formData = WorkflowFacade.GetFormData(WorkflowId);\r\n\r\n                Verify.IsNotNull(formData, \"Failed to get form data, workflow may have been aborted!\");\r\n\r\n                return formData;\r\n            }\r\n\r\n            #region IFunctionCallEditorState Members\r\n\r\n            [XmlIgnore]\r\n            public List<NamedFunctionCall> FunctionCalls\r\n            {\r\n                get { return GetFormData().Bindings[\"FunctionCalls\"] as List<NamedFunctionCall>; }\r\n                set { GetFormData().Bindings[\"FunctionCalls\"] = value; }\r\n            }\r\n\r\n            [XmlIgnore]\r\n            public List<ManagedParameterDefinition> Parameters\r\n            {\r\n                get { return GetFormData().Bindings[\"Parameters\"] as List<ManagedParameterDefinition>; }\r\n                set { GetFormData().Bindings[\"Parameters\"] = value; }\r\n            }\r\n\r\n            [XmlIgnore]\r\n            public List<Type> ParameterTypeOptions\r\n            {\r\n                get { return (GetFormData().Bindings[\"ParameterTypeOptions\"] as IEnumerable<Type>).ToList(); }\r\n                set { GetFormData().Bindings[\"ParameterTypeOptions\"] = value.ToList(); }\r\n            }\r\n\r\n            public bool WidgetFunctionSelection\r\n            {\r\n                get { return false; }\r\n            }\r\n\r\n            public bool ShowLocalFunctionNames\r\n            {\r\n                get { return true; }\r\n            }\r\n\r\n            public bool AllowLocalFunctionNameEditing\r\n            {\r\n                get { return true; }\r\n            }\r\n\r\n            public bool AllowSelectingInputParameters\r\n            {\r\n                get { return true; }\r\n            }\r\n\r\n            public Type[] AllowedResultTypes\r\n            {\r\n                get\r\n                {\r\n                    return new[] {\r\n                    typeof (XDocument), typeof (XElement), typeof (IEnumerable<XElement>),\r\n                    typeof(bool), typeof(int), typeof(decimal), typeof(string), typeof(DateTime), typeof(Guid), typeof(CultureInfo),\r\n                    typeof(IDataReference), typeof(IXsltExtensionDefinition)};\r\n                }\r\n            }\r\n\r\n            public int MaxFunctionAllowed\r\n            {\r\n                get { return 1000; }\r\n            }\r\n\r\n            string IFunctionCallEditorState.ConsoleId\r\n            {\r\n                get { return ConsoleIdInternal; }\r\n            }\r\n\r\n            #endregion\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Composite.Workflows/Plugins/Elements/ElementProviders/XsltBasedFunctionProviderElementProvider/EditXsltFunctionWorkflow.layout",
    "content": "﻿<StateMachineWorkflowDesigner xmlns:ns0=\"clr-namespace:System.Drawing;Assembly=System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" Name=\"EditXsltFunctionWorkflow\" Location=\"30; 30\" Size=\"1145; 996\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/workflow\">\r\n\t<StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"finalStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity5\" SourceStateName=\"EditXsltFunctionWorkflow\" SourceConnectionEdge=\"Right\" TargetActivity=\"finalStateActivity\" SourceActivity=\"EditXsltFunctionWorkflow\" EventHandlerName=\"eventDrivenActivity_GlobalCancel\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"240\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"901\" Y=\"71\" />\r\n\t\t\t\t<ns0:Point X=\"901\" Y=\"673\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity3\" SourceStateName=\"initializeStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"initializeStateActivity\" EventHandlerName=\"initializeStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"269\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"146\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"259\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"validateStateActivity\" SourceConnectionIndex=\"1\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity1\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"validateStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"saveEventDrivenActivity_Save\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"507\" Y=\"324\" />\r\n\t\t\t\t<ns0:Point X=\"534\" Y=\"324\" />\r\n\t\t\t\t<ns0:Point X=\"534\" Y=\"515\" />\r\n\t\t\t\t<ns0:Point X=\"158\" Y=\"515\" />\r\n\t\t\t\t<ns0:Point X=\"158\" Y=\"527\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"2\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity4\" SourceStateName=\"editStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"editStateActivity\" EventHandlerName=\"editEventDrivenActivity_Preview\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"518\" Y=\"348\" />\r\n\t\t\t\t<ns0:Point X=\"530\" Y=\"348\" />\r\n\t\t\t\t<ns0:Point X=\"530\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"259\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity2\" SourceStateName=\"saveStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"saveStateActivity\" EventHandlerName=\"saveStateInitializationActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"612\" Y=\"675\" />\r\n\t\t\t\t<ns0:Point X=\"626\" Y=\"675\" />\r\n\t\t\t\t<ns0:Point X=\"626\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"259\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"saveStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity6\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"saveStateActivity\" SourceActivity=\"validateStateActivity\" EventHandlerName=\"validateInitializeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"249\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"519\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"519\" Y=\"634\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t\t<StateDesignerConnector TargetConnectionIndex=\"0\" TargetStateName=\"editStateActivity\" SourceConnectionIndex=\"0\" TargetConnectionEdge=\"Top\" SetStateName=\"setStateActivity7\" SourceStateName=\"validateStateActivity\" SourceConnectionEdge=\"Right\" TargetActivity=\"editStateActivity\" SourceActivity=\"validateStateActivity\" EventHandlerName=\"validateInitializeStateActivity\">\r\n\t\t\t<StateDesignerConnector.Segments>\r\n\t\t\t\t<ns0:Point X=\"249\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"568\" />\r\n\t\t\t\t<ns0:Point X=\"265\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"251\" />\r\n\t\t\t\t<ns0:Point X=\"418\" Y=\"259\" />\r\n\t\t\t</StateDesignerConnector.Segments>\r\n\t\t</StateDesignerConnector>\r\n\t</StateMachineWorkflowDesigner.DesignerConnectors>\r\n\t<StateMachineWorkflowDesigner.Designers>\r\n\t\t<StateDesigner Name=\"initializeStateActivity\" Location=\"63; 105\" Size=\"210; 80\" AutoSize=\"False\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"612; 544\" Name=\"initializeStateInitializationActivity\" Location=\"296; 148\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"592; 463\" Name=\"ifElseActivity_CheckActiveLanguagesExists\" Location=\"306; 210\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"381; 363\" Name=\"ifElseBranchActivity3\" Location=\"325; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<IfElseDesigner Size=\"361; 282\" Name=\"ifElseActivity_CheckPageExists\" Location=\"335; 343\">\r\n\t\t\t\t\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity5\" Location=\"354; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"initializeCodeActivity\" Location=\"364; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity3\" Location=\"364; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 182\" Name=\"ifElseBranchActivity6\" Location=\"527; 414\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingPageCodeActivity\" Location=\"537; 476\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity8\" Location=\"537; 536\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 363\" Name=\"ifElseBranchActivity4\" Location=\"729; 281\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"MissingActiveLanguageCodeActivity\" Location=\"739; 343\" />\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity9\" Location=\"739; 403\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"editStateActivity\" Location=\"314; 259\" Size=\"208; 118\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 122\" Name=\"editStateInitializationActivity\" Location=\"322; 290\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<ActivityDesigner Size=\"130; 41\" Name=\"documentFormActivity1\" Location=\"332; 352\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"saveEventDrivenActivity_Save\" Location=\"322; 314\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"saveHandleExternalEventActivity1\" Location=\"332; 376\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity1\" Location=\"332; 436\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t\t<EventDrivenDesigner Size=\"150; 242\" Name=\"editEventDrivenActivity_Preview\" Location=\"322; 338\">\r\n\t\t\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"previewHandleExternalEventActivity1\" Location=\"332; 400\" />\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"editPreviewActivity\" Location=\"332; 460\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity4\" Location=\"332; 520\" />\r\n\t\t\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t\t\t</EventDrivenDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"saveStateActivity\" Location=\"423; 634\" Size=\"193; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"150; 182\" Name=\"saveStateInitializationActivity\" Location=\"431; 665\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<CodeDesigner Size=\"130; 41\" Name=\"saveCodeActivity\" Location=\"441; 727\" />\r\n\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity2\" Location=\"441; 787\" />\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t\t<StateDesigner Name=\"finalStateActivity\" Location=\"821; 673\" Size=\"160; 80\" AutoSizeMargin=\"16; 24\" />\r\n\t\t<EventDrivenDesigner Size=\"150; 182\" Name=\"eventDrivenActivity_GlobalCancel\" Location=\"38; 61\">\r\n\t\t\t<EventDrivenDesigner.Designers>\r\n\t\t\t\t<HandleExternalEventActivityDesigner Size=\"130; 41\" Name=\"cancelHandleExternalEventActivity1\" Location=\"48; 123\" />\r\n\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity5\" Location=\"48; 183\" />\r\n\t\t\t</EventDrivenDesigner.Designers>\r\n\t\t</EventDrivenDesigner>\r\n\t\t<StateDesigner Name=\"validateStateActivity\" Location=\"63; 527\" Size=\"190; 80\" AutoSizeMargin=\"16; 24\">\r\n\t\t\t<StateDesigner.Designers>\r\n\t\t\t\t<StateInitializationDesigner Size=\"381; 303\" Name=\"validateInitializeStateActivity\" Location=\"71; 558\">\r\n\t\t\t\t\t<StateInitializationDesigner.Designers>\r\n\t\t\t\t\t\t<IfElseDesigner Size=\"361; 222\" Name=\"ifElseActivity1\" Location=\"81; 620\">\r\n\t\t\t\t\t\t\t<IfElseDesigner.Designers>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity1\" Location=\"100; 691\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity6\" Location=\"110; 753\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t\t<IfElseBranchDesigner Size=\"150; 122\" Name=\"ifElseBranchActivity2\" Location=\"273; 691\">\r\n\t\t\t\t\t\t\t\t\t<IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t\t\t<SetStateDesigner Size=\"130; 41\" Name=\"setStateActivity7\" Location=\"283; 753\" />\r\n\t\t\t\t\t\t\t\t\t</IfElseBranchDesigner.Designers>\r\n\t\t\t\t\t\t\t\t</IfElseBranchDesigner>\r\n\t\t\t\t\t\t\t</IfElseDesigner.Designers>\r\n\t\t\t\t\t\t</IfElseDesigner>\r\n\t\t\t\t\t</StateInitializationDesigner.Designers>\r\n\t\t\t\t</StateInitializationDesigner>\r\n\t\t\t</StateDesigner.Designers>\r\n\t\t</StateDesigner>\r\n\t</StateMachineWorkflowDesigner.Designers>\r\n</StateMachineWorkflowDesigner>"
  },
  {
    "path": "Composite.Workflows/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controlled through the following \r\n// set of attributes. Change these attribute values to modify the information\r\n// associated with an assembly. See also Composite SharedAssemblyInfo.cs\r\n[assembly: AssemblyDescription(\"C1 CMS Workflow Foundation classes\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n\r\n// Setting ComVisible to false makes the types in this assembly not visible \r\n// to COM components.  If you need to access a type in this assembly from \r\n// COM, set the ComVisible attribute to true on that type.\r\n[assembly: ComVisible(false)]\r\n\r\n// The following GUID is for the ID of the typelib if this project is exposed to COM\r\n[assembly: Guid(\"88dc8435-878f-482a-8def-bcc6c7210f3e\")]\r\n\r\n[assembly: InternalsVisibleTo(\"UpgradePackage\")]"
  },
  {
    "path": "Composite.Workflows/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.AspNet.Razor\" version=\"3.2.3\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebPages\" version=\"3.2.3\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Web.Infrastructure\" version=\"1.0.0.0\" targetFramework=\"net45\" />\n</packages>"
  },
  {
    "path": "CompositeC1.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio 14\r\nVisualStudioVersion = 14.0.25123.0\r\nMinimumVisualStudioVersion = 14.0.0.0\r\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{44113BBC-CB18-41CF-AB26-6D190BA4E117}\"\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"WebSite\", \"Website\\WebSite.csproj\", \"{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}\"\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Composite.Workflows\", \"Composite.Workflows\\Composite.Workflows.csproj\", \"{1FE08476-346A-4053-813D-8807C0E0FC36}\"\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Composite\", \"Composite\\Composite.csproj\", \"{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|.NET = Debug|.NET\r\n\t\tDebug|Any CPU = Debug|Any CPU\r\n\t\tDebug|Mixed Platforms = Debug|Mixed Platforms\r\n\t\tRelease|.NET = Release|.NET\r\n\t\tRelease|Any CPU = Release|Any CPU\r\n\t\tRelease|Mixed Platforms = Release|Mixed Platforms\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Debug|.NET.ActiveCfg = Debug|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Release|.NET.ActiveCfg = Release|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU\r\n\t\t{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}.Release|Mixed Platforms.Build.0 = Release|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Debug|.NET.ActiveCfg = Debug|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Release|.NET.ActiveCfg = Release|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU\r\n\t\t{1FE08476-346A-4053-813D-8807C0E0FC36}.Release|Mixed Platforms.Build.0 = Release|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Debug|.NET.ActiveCfg = Debug|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Release|.NET.ActiveCfg = Release|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU\r\n\t\t{F8D87A5F-D090-4D24-80C1-DBCD938C6CAB}.Release|Mixed Platforms.Build.0 = Release|Any CPU\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Install.ps1",
    "content": "param($installPath, $toolsPath, $package, $project)\r\n$asms = $package.AssemblyReferences | %{$_.Name} \r\nforeach ($reference in $project.Object.References) \r\n{\r\n    if ($asms -contains $reference.Name + \".dll\") \r\n    {\r\n        $reference.CopyLocal = $false;\r\n    }\r\n}"
  },
  {
    "path": "Package.ConsoleComponents.nuspec",
    "content": "<?xml version=\"1.0\"?>\n<package >\n  <metadata>\n    <id>C1CMS.ConsoleComponents</id>\n    <title>C1 CMS Console Components</title>\n    <version>$version$</version>\n    <authors>Orckestra A/S</authors>\n    <owners>Orckestra A/S</owners>\n    <licenseUrl>https://c1.orckestra.com/MPL11</licenseUrl>\n    <projectUrl>https://github.com/Orckestra/C1-CMS-Foundation</projectUrl>\n    <!--iconUrl></iconUrl-->\n    <requireLicenseAcceptance>true</requireLicenseAcceptance>\n    <description>Contains React components distributed with C1 CMS.</description>\n    <releaseNotes></releaseNotes>\n    <copyright>Copyright 2017</copyright>\n    <tags>C1CMS cms</tags>\n    <dependencies>\n    </dependencies>\n  </metadata>\n  <files>\n    <file src=\"Website\\Composite\\console\\**\\*.*\" target=\"Composite\\console\" /> \n    <file src=\"Website\\jspm.config.js\" target=\"Composite\" />\n    <file src=\"Website\\package.json\" target=\"Composite\" />\n  </files>\n</package>\n"
  },
  {
    "path": "Package.nuspec",
    "content": "<?xml version=\"1.0\"?>\r\n<package >\r\n  <metadata>\r\n    <id>C1CMS.Assemblies</id>\r\n    <title>C1 CMS Assemblies</title>\r\n    <version>$version$</version>\r\n    <authors>Orckestra A/S</authors>\r\n    <owners>Orckestra A/S</owners>\r\n    <licenseUrl>https://c1.orckestra.com/MPL11</licenseUrl>\r\n    <projectUrl>https://github.com/Orckestra/C1-CMS-Foundation</projectUrl>\r\n    <!--iconUrl></iconUrl-->\r\n    <requireLicenseAcceptance>true</requireLicenseAcceptance>\r\n    <description>Contains dll-s distributed with C1 CMS.</description>\r\n    <releaseNotes></releaseNotes>\r\n    <copyright>Copyright 2018</copyright>\r\n    <tags>C1CMS OrckestraCMS CompositeC1 cms</tags>\r\n    <dependencies>\r\n      <dependency id=\"Microsoft.AspNet.Razor\" version=\"3.2.3\" />\r\n      <dependency id=\"Microsoft.AspNet.WebPages\" version=\"3.2.3\" />\r\n      <dependency id=\"Microsoft.Web.Infrastructure\" version=\"1.0.0.0\"/>\r\n    </dependencies>\r\n  </metadata>\r\n  <files>\r\n    <file src=\"Install.ps1\" target=\"tools\\\" />\r\n    <file src=\"Bin\\Composite.dll\" target=\"lib\\net471\\\" />\r\n    <file src=\"Bin\\Composite.Workflows.dll\" target=\"lib\\net471\\\" />\r\n    <file src=\"Bin\\Microsoft.Practices.EnterpriseLibrary.Common.dll\" target=\"lib\\net471\\\" />\r\n    <file src=\"Bin\\Microsoft.Practices.EnterpriseLibrary.Logging.dll\" target=\"lib\\net471\\\" />\r\n    <file src=\"Bin\\Microsoft.Practices.EnterpriseLibrary.Validation.dll\" target=\"lib\\net471\\\" />\r\n    <file src=\"Bin\\Microsoft.Practices.ObjectBuilder.dll\" target=\"lib\\net471\\\" />\r\n    <!-- Not referencing Microsoft.Extensions.DependencyInjection via dependencies as they pull 50+ NuGet packages from .NET Core -->\r\n    <file src=\"Bin\\Microsoft.Extensions.DependencyInjection.dll\" target=\"lib\\net471\\\" />\r\n    <file src=\"Bin\\Microsoft.Extensions.DependencyInjection.Abstractions.dll\" target=\"lib\\net471\\\" />\t\r\n  </files>\r\n</package>\r\n"
  },
  {
    "path": "README.md",
    "content": "# C1 CMS Foundation[![Reviews here...!](http://hackathon.composite.net/maw/github/reviews.png)](https://www.facebook.com/pg/C1CMS/reviews)\n\nC1 CMS Foundation - a .NET based Web Content Management System, open source and a bundle of joy!\n\n[![screen shots from the new C1 user interface (the C1 Console)](http://hackathon.composite.net/maw/github/6-pack-screenshots-small.png)](http://hackathon.composite.net/maw/github/6-pack-screenshots.png)\n\n[![Join the chat at https://gitter.im/Orckestra/C1-CMS](https://badges.gitter.im/Orckestra/C1-CMS.svg)](https://gitter.im/Orckestra/C1-CMS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n## Getting started ##\nVisit http://docs.c1.orckestra.com/Getting-started/Guide\n\n## Download ##\nDownload binaries from https://github.com/Orckestra/CMS-Foundation/releases/latest\n\n## Forums ##\nHead over to https://gitter.im/Orckestra/C1-CMS or add an issue\n\n## Who are we? ##\nOrckestra is the company driving the development of C1 CMS Foundation. We have a team  working full time on this CMS and on other cool stuff you can add to it. We are situated in Montreal, Copenhagen and Kiev. We specialize in enterprise omni channel commerce software. \n\nYou can visit us at http://c1.orckestra.com and http://www.orckestra.com/\n"
  },
  {
    "path": "Website/.bowerrc",
    "content": "{\n    \"directory\": \"bower_components\"\n}\n"
  },
  {
    "path": "Website/.eslintignore",
    "content": "jspm.config.js\njspm.production.js\nWebsite/Composite/console.js\ngruntfile.js\n"
  },
  {
    "path": "Website/.eslintrc.json",
    "content": "{\n    \"env\": {\n        \"browser\": true,\n        \"es6\": true,\n        \"node\": true,\n\t\t\"mocha\": true\n    },\n\t\"extends\": [\"eslint:recommended\", \"plugin:react/recommended\"],\n    \"parserOptions\": {\n        \"ecmaFeatures\": {\n            \"experimentalObjectRestSpread\": true,\n            \"jsx\": true\n        },\n        \"sourceType\": \"module\"\n    },\n    \"plugins\": [\n        \"react\",\n\t\t\"mocha\"\n    ],\n    \"rules\": {\n        \"indent\": [\n            \"error\",\n            \"tab\"\n        ],\n        \"linebreak-style\": [\n            \"error\",\n            \"windows\"\n        ],\n        \"quotes\": [\n            \"error\",\n            \"single\"\n        ],\n        \"semi\": [\n            \"error\",\n            \"always\"\n        ]\n    }\n}\n"
  },
  {
    "path": "Website/.npmignore",
    "content": "*\n*.*\n*/*.*\n!/Composite/console/**/*\n"
  },
  {
    "path": "Website/Composite/CompileScripts.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<Scripts>\r\n\t<Type name=\"sub\">\r\n\t\t<Mode name=\"operate\">\r\n\t\t\t<Script filename=\"${root}/scripts/compressed/sub.js\"/>\r\n\t\t</Mode>\r\n\t\t<Mode name=\"develop\">\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/UpdateManager.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/UpdateAssistant.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/UpdatePlugin.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/Update.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/ReplaceUpdate.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/SiblingUpdate.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/AttributesUpdate.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/window/WindowManager.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/window/WindowAssistant.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/document/DocumentUpdatePlugin.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/document/DocumentCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/document/DocumentManager.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/data/DataManager.js\"/>\r\n\t\t</Mode>\r\n\t</Type>\r\n\t<Type name=\"top\">\r\n\t\t<Mode name=\"operate\">\r\n\t\t\t<Script filename=\"${root}/scripts/compressed/toplevelclassnames.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/compressed/top.js\"/>\r\n\t\t</Mode>\r\n\t\t<Mode name=\"develop\">\r\n\t\t\t<Script filename=\"${root}/lib/autobahnjs/autobahn.js\"/>\r\n\t\t\t<Script filename=\"${root}/lib/promise/promise.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IAcceptable.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IActionListener.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IActivatable.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IActivationAware.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IBroadcastListener.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IContextContainerBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/ICrawlerHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IData.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IDialogResponseHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IDOMHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IDraggable.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IDragHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IEditorControlBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IEventListener.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IFit.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IFlexible.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IFocusable.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IImageProfile.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IKeyEventHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/ILabel.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/ILoadHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IMenuContainer.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IResizeHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/ISourceEditorComponent.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IUpdateHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IWysiwygEditorComponent.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IWysiwygEditorContentChangeHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/interfaces/IWysiwygEditorNodeChangeHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/util/List.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/util/Map.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/util/SystemNodeList.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/util/LocalStorage.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/BroadcastMessages.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/EventBroadcaster.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Constants.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/ContextContainer.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Client.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dev/SystemLogger.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dev/SystemTimer.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dev/SystemDebug.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Interfaces.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Types.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/MimeTypes.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/SearchTokens.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/StringBundle.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/KeyMaster.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/ImageProvider.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Resolver.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Download.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Cookies.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/StatusBar.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Localization.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Validator.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dom/DOMEvents.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dom/DOMSerializer.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dom/DOMFormatter.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dom/DOMUtil.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dom/XMLParser.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dom/XPathResolver.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/dom/XSLTransformer.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/css/CSSUtil.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/css/CSSComputer.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/system/System.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/system/SystemNode.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/system/SystemAction.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/UpdateManager.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/UpdateAssistant.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/UpdatePlugin.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/Update.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/ReplaceUpdate.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/SiblingUpdate.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/updates/AttributesUpdate.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/window/WindowManager.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/window/WindowAssistant.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Application.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Installation.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Keyboard.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Preferences.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Persistance.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/LocalStore.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/StandardEventHandler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/Action.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/Animation.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/Point.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/Dimension.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/Geometry.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/BindingAcceptor.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/BindingBoxObject.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/BindingDragger.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/BindingParser.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/BindingSerializer.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/ImageProfile.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/BindingFinder.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/crawlers/NodeCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/crawlers/ElementCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/crawlers/BindingCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/utilities/crawlers/Crawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/flexboxes/FlexBoxCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/focus/FocusCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/dialogs/FitnessCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/document/DocumentUpdatePlugin.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/document/DocumentCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/document/DocumentManager.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/page/data/DataManager.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Templates.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/DialogButton.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Dialog.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Commands.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Prism.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/Uri.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/viewdefinitions/ViewDefinition.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/viewdefinitions/SystemViewDefinition.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/viewdefinitions/HostedViewDefinition.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/viewdefinitions/DialogViewDefinition.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/Binding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/DataBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/roots/RootBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/roots/StyleBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/flexboxes/FlexBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/flexboxes/ScrollBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/labels/LabelBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/labels/TextBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/broadcasters/BroadcasterSetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/broadcasters/BroadcasterBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/ButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/ButtonStateManager.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/clickbutton/ClickButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/radiobutton/RadioButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/checkbutton/CheckButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/viewbutton/ViewButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/controls/ControlGroupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/controls/ControlBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/controls/ControlBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/menus/MenuContainerBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/menus/MenuBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/menus/MenuBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/menus/MenuBodyBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/menus/MenuGroupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/menus/MenuItemBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/popups/PopupSetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/popups/PopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/popups/PopupBodyBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/menus/MenuPopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogHeadBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogBodyBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogSetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogBorderBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogCoverBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogTitleBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogTitleBarBodyBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogControlBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/dialogs/DialogTitleBarPopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/windows/WindowBindingHighlightNodeCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/windows/WindowBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/windows/PreviewWindowBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/radiobutton/RadioGroupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/DataBindingMap.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/keyboard/DataInputBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/keyboard/TextBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/keyboard/EditorTextBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/keyboard/IEEditorTextBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/keyboard/MozEditorTextBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/selectors/SelectorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/selectors/SimpleSelectorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/selectors/SelectorBindingSelection.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/selectors/DataInputSelectorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/DataInputDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/TreeSelectorDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/UrlInputDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/DataInputButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/DataDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/PostBackDataDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/ViewDefinitionPostBackDataDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/NullPostBackDataDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/NullPostBackDataDialogSelectorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/selectors/MultiSelectorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/selectors/HierarchicalSelectorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/HTMLDataDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/dialogs/MultiSelectorDataDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/lazy/LazyBindingSetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/lazy/LazyBindingBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/editors/EditorDataBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/editors/FunctionEditorDataBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/editors/ParameterEditorDataBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/misc/FilePickerBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/request/RequestBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/fields/FieldGroupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/fields/FieldBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/fields/FieldsBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/fields/FieldDescBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/fields/FieldDataBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/fields/FieldHelpBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/fields/ResolverContainerBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/radiocheck/RadioDataGroupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/radiocheck/RadioDataBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/radiocheck/CheckBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/radiocheck/CheckBoxGroupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/balloons/BalloonSetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/balloons/BalloonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/errors/ErrorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/focus/FocusBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/tabboxes/TabsButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/tabboxes/TabBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/tabboxes/TabsBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/tabboxes/TabBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/tabboxes/TabPanelsBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/tabboxes/TabPanelBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/splitboxes/SplitBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/splitboxes/SplitPanelBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/splitboxes/SplitterBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/decks/DecksBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/decks/DeckBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/toolbars/ToolBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/toolbars/ToolBarBodyBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/toolbars/ToolBarGroupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/toolbars/ToolBarButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/toolbars/ToolBarLabelBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/toolbars/DialogToolBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/combobutton/ComboBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/combobutton/ToolBarComboButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/toolboxbutton/ToolBoxToolBarButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/trees/TreeBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/trees/TreeBodyBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/trees/TreeNodeBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/trees/TreeContentBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/trees/TreePositionIndicatorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/trees/TreeCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/radiocheck/CheckTreeBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/data/radiocheck/CheckTreeNodeBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/docks/DockTabsButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/docks/DockBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/docks/DockTabsBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/docks/DockTabBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/docks/DockPanelsBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/docks/DockPanelBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/docks/DockTabPopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/views/ViewSetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/views/ViewBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/pages/PageBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/pages/DialogPageBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/pages/DialogPageBodyBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/pages/EditorPageBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/pages/ResponsePageBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/pages/WizardPageBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/pages/MarkupAwarePageBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/system/SystemToolBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/system/SystemTreeBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/system/SystemTreePopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/system/SystemTreeNodeBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/system/SystemPageBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/StageContainerBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/StageBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/StageCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/dialogs/StageDialogSetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/dialogs/StageDialogBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/dialogs/FitnessCrawler.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/decks/StageDecksBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/decks/StageDeckBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/decks/StageDeckRootBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/splitboxes/StageSplitBoxBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/splitboxes/StageSplitPanelBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/splitboxes/StageSplitterBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/splitboxes/StageSplitterBodyBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/abstractions/StageBoxAbstraction.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/abstractions/StageBoxHandlerAbstraction.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/menus/StageMenuBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/menus/StageViewMenuItemBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/stage/statusbar/StageStatusBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/explorer/ExplorerBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/explorer/ExplorerMenuBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/explorer/ExplorerToolBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/explorer/ExplorerToolBarButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/explorer/ExplorerPopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/EditorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/EditorPopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/EditorClickButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/EditorToolBarButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/EditorSelectorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/EditorMenuItemBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/visualeditor/VisualEditorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/visualeditor/VisualEditorPopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/visualeditor/VisualEditorFormattingConfiguration.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/visualeditor/VisualEditorFieldGroupConfiguration.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/visualeditor/multieditor/VisualMultiEditorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/visualeditor/multieditor/VisualMultiTemplateEditorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/CodeMirrorEditor/CodeMirrorEditorPopupBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/editors/CodeMirrorEditor/CodeMirrorEditorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/progressbar/ProgressBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/start/StartMenuItemBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/keys/KeySetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/cursors/CursorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/cover/CoverBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/cover/UncoverBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/theatre/TheatreBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/viewers/SourceCodeViewerBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/persistance/PersistanceBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/localization/LocalizationSelectorBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/response/ResponseBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/genericview/AddressBarBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/genericview/GenericViewBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/genericview/PathBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/branding/BrandSnippetBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/UserInterfaceMapping.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/UserInterface.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/soap/SOAPMessage.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/soap/SOAPRequest.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/soap/SOAPRequestResponse.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/soap/SOAPFault.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/soap/SOAPEncoder.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/soap/SOAPDecoder.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/schema/Schema.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/schema/SchemaDefinition.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/schema/SchemaType.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/schema/SchemaElementType.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/schema/SchemaComplexType.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/schema/SchemaSimpleType.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/services/WebServiceResolver.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/services/WebServiceOperation.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/services/WebServiceProxy.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/ConfigurationService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/ConsoleMessageQueueService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/EditorConfigurationService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/FlowControllerService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/InstallationService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/LocalizationService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/LoginService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/MarkupFormatService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/PageService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/ReadyService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/SecurityService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/SEOService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/SourceValidationService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/StringService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/TreeService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/XhtmlTransformationsService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/proxies/FunctionService.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/MessageQueue.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/ViewDefinitions.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/core/KickStart.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/combobutton/SelectorButtonBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/views/SlideInViewBinding.js\"/>\r\n\t\t\t<Script filename=\"${root}/scripts/source/top/ui/bindings/buttons/viewbutton/SlideInButtonBinding.js\"/>\r\n\t\t</Mode>\r\n\t</Type>\r\n</Scripts>\r\n"
  },
  {
    "path": "Website/Composite/GenerateIconSprite.aspx",
    "content": "﻿<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"GenerateIconSprite.aspx.cs\" Inherits=\"GenerateIconSprite\" %>\r\n\r\n<!DOCTYPE html>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head runat=\"server\">\r\n    <title></title>\r\n</head>\r\n<body>\r\n    <form id=\"form1\" runat=\"server\">\r\n    <div>\r\n\t\t\r\n    </div>\r\n    </form>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/GenerateIconSprite.aspx.cs",
    "content": "﻿using System.Xml;\r\nusing Composite.Core.IO;\r\nusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml.Linq;\r\n\r\npublic partial class GenerateIconSprite : System.Web.UI.Page\r\n{\r\n\r\n    private string svgBlank = @\"<?xml version=\"\"1.0\"\" encoding=\"\"UTF-8\"\" standalone=\"\"no\"\"?><svg version=\"\"1.1\"\" xmlns=\"\"http://www.w3.org/2000/svg\"\" xmlns:xlink=\"\"http://www.w3.org/1999/xlink\"\" width=\"\"24\"\" height=\"\"24\"\"  viewBox=\"\"0 0 128 128\"\">\r\n    <defs></defs></svg>\";\r\n\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        var pathSVGIcons = Server.MapPath(\"~/Composite/images/icons/svg/\");\r\n\r\n        XNamespace svgNamespace = @\"http://www.w3.org/2000/svg\";\r\n\r\n        var svgSprite = XElement.Parse(svgBlank);\r\n\r\n        var defs = svgSprite.Descendants(svgNamespace + \"defs\").First();\r\n\r\n        foreach (var file in Directory.GetFiles(pathSVGIcons))\r\n        {\r\n            var id = Path.GetFileNameWithoutExtension(file);\r\n            var svgElement = XElement.Load(file);\r\n\r\n            var taggetGroup = svgElement.Descendants(svgNamespace + \"g\").FirstOrDefault(el => (string) el.Attribute(\"id\") == id);\r\n\r\n            if (taggetGroup != null)\r\n            {\r\n                defs.Add(taggetGroup);\r\n            }\r\n        }\r\n\r\n\r\n       var settings = new XmlWriterSettings {OmitXmlDeclaration = true};\r\n\r\n        using (XmlWriter xw = XmlWriter.Create(PathUtil.Resolve(\"~/Composite/images/sprite.svg\"), settings))\r\n        {\r\n            svgSprite.Save(xw);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/Login.aspx",
    "content": "<%@ Page Language=\"C#\" AutoEventWireup=\"true\" EnableViewState=\"false\" Inherits=\"Composite_Management_Login\" CodeFile=\"Login.aspx.cs\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<head runat=\"server\">\r\n    <title>Composite.Management</title>\r\n    <meta name=\"robots\" content=\"noindex, nofollow\" />\r\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=9\" />\r\n    <% Response.WriteFile(\"favicon.inc\"); %>\r\n    <control:styleloader runat=\"server\"/>\r\n    <style type=\"text/css\">\r\n\r\n        form {\r\n            height: auto;\r\n        }\r\n\r\n         input, input:focus, input:active {\r\n             border: 0;\r\n             background: #fff;\r\n             outline: 0;\r\n         }\r\n\r\n        svg {\r\n            stroke: currentColor;\r\n            fill: currentColor;\r\n        }\r\n\r\n        .field {\r\n            border-bottom: solid 1px #ddd;\r\n            margin-bottom: 20px;\r\n            height: 40px;\r\n            padding: 5px 0;\r\n        }\r\n\r\n        .field .icon {\r\n            float: left;\r\n        }\r\n\r\n        .field .value {\r\n            height: 40px;\r\n            margin-left: 20px;\r\n        }\r\n\r\n        .field input {\r\n            border: 0;\r\n            font-size: 16px;\r\n            width: 100%;\r\n            padding: 4px 10px 5px 15px;\r\n        }\r\n    </style>\r\n</head>\r\n<body>\r\n    <div class=\"splash-cover\">\r\n        <div class=\"splash-bg\"></div>\r\n        <div id=\"splash\" class=\"splash\">\r\n            <div class=\"splash-inner\">\r\n                <control:brandingSnippet runat=\"server\" SnippetName=\"logo\" />\r\n                <div id=\"splashcontent\">\r\n                    <form id=\"form_login\" method=\"post\">\r\n                        <!-- action=\"Login.aspx\"  -->\r\n                        <div class=\"text-error\">\r\n                            <p>The entered url is protected, please enter CMS Console credentials</p>\r\n                            <div id=\"divLoginFailed\" runat=\"server\" visible=\"false\" class=\"text-error hide\">\r\n                                Username or password is incorrect.\r\n                            </div>\r\n                        </div>\r\n                        <div class=\"fields\">\r\n                            <div class=\"field\">\r\n                                <div class=\"icon\">\r\n                                    <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"text-primary\" width=\"20px\" height=\"26px\" viewBox=\"0 0 20 20\">\r\n                                        <g id=\"user\" viewBox=\"0 0 20 20\">\r\n                                            <path d=\"M9.5 11c-3.033 0-5.5-2.467-5.5-5.5s2.467-5.5 5.5-5.5 5.5 2.467 5.5 5.5-2.467 5.5-5.5 5.5zM9.5 1c-2.481 0-4.5 2.019-4.5 4.5s2.019 4.5 4.5 4.5c2.481 0 4.5-2.019 4.5-4.5s-2.019-4.5-4.5-4.5z\" stroke=\"none\" />\r\n                                            <path d=\"M17.5 20h-16c-0.827 0-1.5-0.673-1.5-1.5 0-0.068 0.014-1.685 1.225-3.3 0.705-0.94 1.67-1.687 2.869-2.219 1.464-0.651 3.283-0.981 5.406-0.981s3.942 0.33 5.406 0.981c1.199 0.533 2.164 1.279 2.869 2.219 1.211 1.615 1.225 3.232 1.225 3.3 0 0.827-0.673 1.5-1.5 1.5zM9.5 13c-3.487 0-6.060 0.953-7.441 2.756-1.035 1.351-1.058 2.732-1.059 2.746 0 0.274 0.224 0.498 0.5 0.498h16c0.276 0 0.5-0.224 0.5-0.5-0-0.012-0.023-1.393-1.059-2.744-1.382-1.803-3.955-2.756-7.441-2.756z\" stroke=\"none\" />\r\n                                        </g></svg>\r\n\r\n                                </div>\r\n                                <div class=\"value\">\r\n                                    <input runat=\"server\" tabindex=\"1\" placeholder=\"Username\" type=\"text\" id=\"txtUsername\" onkeydown=\"if (event.keyCode == 13) document.getElementById('aLogin').click()\" />\r\n                                </div>\r\n                            </div>\r\n                            <div class=\"field\">\r\n                                <div class=\"icon text-primary\">\r\n                                    <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"text-primary\" viewBox=\"0 0 14 16\" width=\"20px\" height=\"26px\">\r\n                                        <g id=\"users-changeownpassword\" viewBox=\"0 0 14 16\" stroke-width=\"1\" fill=\"none\">\r\n                                            <path d=\"M7,8.5 C7,8.776 6.776,9 6.5,9 C6.224,9 6,8.776 6,8.5 C6,8.224 6.224,8 6.5,8 C6.776,8 7,8.224 7,8.5 L7,8.5 Z\" id=\"Stroke-69\" />\r\n                                            <path d=\"M6.48358154,9.48071289 L6.48358154,11.5175781\" id=\"Stroke-71\" stroke-linecap=\"round\" />\r\n                                            <path d=\"M12.5124512,5.50524903 L0.567382832,5.50524903 L0.567382832,14.4874271 L12.5124512,14.4874271 L12.5124512,5.50524903 Z\" id=\"Stroke-73\" />\r\n                                            <path d=\"M6.5,0 C8.43327273,0 10.5031738,1.64133341 10.5031738,3.66666675 L10.5031738,5.50317383 L2.50640869,5.50317383 L2.50640869,3.66666675 C2.50640869,1.64133341 4.56672727,0 6.5,0 Z\" id=\"Stroke-75\" />\r\n                                        </g>\r\n                                    </svg>\r\n                                </div>\r\n                                <div class=\"value\">\r\n                                    <input runat=\"server\" tabindex=\"2\" type=\"password\" placeholder=\"Password\" id=\"txtPassword\" onkeydown=\"if (event.keyCode == 13) document.getElementById('aLogin').click()\" autocomplete=\"off\" />\r\n                                </div>\r\n                            </div>\r\n                            <div class=\"LoginButton\">\r\n                                <a href=\"#\" id=\"aLogin\" tabindex=\"3\" class=\"clickbutton\" onclick=\"document.forms['form_login'].submit();\">Login</a>\r\n                            </div>\r\n                        </div>\r\n                    </form>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <script type=\"text/javascript\">\r\n        document.getElementById('txtUsername').focus();\r\n    </script>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/Login.aspx.cs",
    "content": "using System;\r\nusing System.Web.Hosting;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Configuration;\r\n\r\npublic partial class Composite_Management_Login : System.Web.UI.Page\r\n{\r\n    protected void Page_Init(object sender, EventArgs e)\r\n    {\r\n        if (!SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n        {\r\n            Response.Redirect(\"/Composite\");\r\n            return;\r\n        }\r\n\r\n        if (UserValidationFacade.IsLoggedIn())\r\n        {\r\n            RedirectToReturnUrl();\r\n            return;\r\n        }\r\n\r\n        if (Request.RequestType == \"POST\")\r\n        {\r\n            OnPost();\r\n        }\r\n    }\r\n\r\n    private void RedirectToReturnUrl()\r\n    {\r\n        var returnUrl = Request.QueryString[\"ReturnUrl\"];\r\n\r\n        try\r\n        {\r\n            Uri uri = new Uri(returnUrl);\r\n            if (uri.Host != Request.Url.Host)\r\n            {\r\n                returnUrl = null; // prevent \"Arbitrary Redirection\" attacks\r\n            }\r\n        }\r\n        catch (Exception) { }\r\n\r\n        if (!string.IsNullOrEmpty(returnUrl))\r\n        {\r\n            Response.Redirect(returnUrl, false);\r\n            return;\r\n        }\r\n\r\n        Response.Redirect(HostingEnvironment.ApplicationVirtualPath, false);\r\n    }\r\n\r\n    private void OnPost()\r\n    {\r\n        bool isValid = true;\r\n\r\n        string username = Request.Form[\"txtUsername\"];\r\n        string password = Request.Form[\"txtPassword\"];\r\n\r\n        if (string.IsNullOrEmpty(username))\r\n        {\r\n            isValid = false;\r\n            txtUsername.Attributes[\"class\"] = \"error\";\r\n        }\r\n\r\n        if (string.IsNullOrEmpty(password))\r\n        {\r\n            isValid = false;\r\n            txtPassword.Attributes[\"class\"] = \"error\";\r\n        }\r\n\r\n        txtUsername.Attributes.Add(\"value\", username);\r\n\r\n        if(isValid)\r\n        {\r\n            if(UserValidationFacade.FormValidateUser(username, password) == LoginResult.Success)\r\n            {\r\n                RedirectToReturnUrl();\r\n                return;\r\n            }\r\n\r\n            divLoginFailed.Visible = true;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/Login.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_Management_Login {\r\n    \r\n    /// <summary>\r\n    /// divLoginFailed control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlGenericControl divLoginFailed;\r\n    \r\n    /// <summary>\r\n    /// txtUsername control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlInputText txtUsername;\r\n    \r\n    /// <summary>\r\n    /// txtPassword control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlInputPassword txtPassword;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/Welcome.js",
    "content": "var Welcome = new function () {\r\n\r\n\tvar TIME = 750;\r\n\tvar setup = null;\r\n\tvar clone = null;\r\n\r\n\tvar hasSetup = false;\r\n\tvar hasLanguages = false;\r\n\tvar hasBlock = false;\r\n\tvar hasLength = false;\r\n\r\n\tvar tabindex = 0;\r\n\tvar progressNotchIndex = 1;\r\n\tvar progressLoading = null;\r\n\t/**\r\n\t* @type {String}\r\n\t*/\r\n\tthis.params = new String(\"\");\r\n\r\n\t/**\r\n\t* Results are real. UI is fake ;)\r\n\t*/\r\n\tthis.test = function () {\r\n\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.KEY_TAB, this);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.KEY_ENTER, this);\r\n\r\n\t\tvar ul = document.getElementById(\"introtest\");\r\n\t\tvar lis = ul.getElementsByTagName(\"li\");\r\n\t\tvar result = {};\r\n\r\n\t\tvar response = new List(SetupService.CheckRequirements(true));\r\n\t\tresponse.each(function (res) {\r\n\r\n\t\t\tvar li = document.createElement(\"li\");\r\n\t\t\tif (!ul.hasChildNodes()) {\r\n\t\t\t\tli.className = \"on\";\r\n\t\t\t}\r\n\t\t\tli.rel = res.Key;\r\n\t\t\tli.appendChild(document.createTextNode(res.Title));\r\n\t\t\tul.appendChild(li);\r\n\t\t\tresult[res.Key] = res.Success;\r\n\t\t})\r\n\r\n\t\tvar i = 0;\r\n\t\tvar isSuccess = true;\r\n\r\n\t\tsetTimeout(function () {\r\n\t\t\tdoit(result);\r\n\t\t}, TIME * 2);\r\n\r\n\t\tfunction doit(res) {\r\n\r\n\t\t\tvar li = lis.item(i);\r\n\t\t\tvar rel = li.rel;\r\n\t\t\tli.className += res[rel] ? \" ok\" : \" bad\";\r\n\r\n\t\t\tvar is = res[rel];\r\n\t\t\tif (!is) {\r\n\t\t\t\tWelcome.params += (Welcome.params.length > 0 ? \";\" : \"\") + li.rel;\r\n\t\t\t}\r\n\t\t\tif (isSuccess) {\r\n\t\t\t\tisSuccess = is;\r\n\t\t\t}\r\n\r\n\t\t\tvar next = lis.item(i + 1);\r\n\t\t\tif (next != null) {\r\n\t\t\t\tnext.className = \"on\";\r\n\t\t\t}\r\n\r\n\t\t\tvar wait = TIME * Math.random();\r\n\t\t\tif (i++ < lis.length - 1) {\r\n\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\tdoit(res);\r\n\t\t\t\t}, wait);\r\n\t\t\t} else {\r\n\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\tWelcome.result(isSuccess);\r\n\t\t\t\t}, wait);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Test result.\r\n\t*/\r\n\tthis.result = function (isSuccess) {\r\n\r\n\t\tvar successtext = document.getElementById(\"introtestsuccess\");\r\n\t\tvar failuretext = document.getElementById(\"introtestfailure\");\r\n\r\n\t\tvar successbutton = bindingMap.introtestsuccessbutton;\r\n\t\tvar failurebutton = bindingMap.introtestfailurebutton;\r\n\r\n\t\tif (isSuccess) {\r\n\t\t\tsuccesstext.style.visibility = \"visible\";\r\n\t\t\tsuccessbutton.getBindingElement().style.visibility = \"visible\";\r\n\t\t} else {\r\n\t\t\tsuccesstext.style.display = \"none\";\r\n\t\t\tfailuretext.style.display = \"block\";\r\n\t\t\tsuccessbutton.hide();\r\n\t\t\tfailurebutton.setURL(failurebutton.getURL() + Welcome.params);\r\n\t\t\tfailurebutton.show();\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t* Switch to deck.\r\n\t* @param {String} id\r\n\t*/\r\n\tthis.switchTo = function (id) {\r\n\r\n\t\tswitch (id) {\r\n\r\n\t\t\tcase \"test\":\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"license\":\r\n\t\t\t\tvar doc = SetupService.GetLicenseHtml(true);\r\n\t\t\t\tvar markup = DOMSerializer.serialize(doc);\r\n\t\t\t\tdocument.getElementById(\"licensetext\").innerHTML = markup;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"setup\":\r\n\t\t\t\tif (!hasSetup) {\r\n\t\t\t\t\tgetSetup();\r\n\t\t\t\t\thasSetup = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"language\":\r\n\t\t\t\tupdateSetup();\r\n\t\t\t\tif (!hasLanguages) {\r\n\t\t\t\t\tgetLanguages();\r\n\t\t\t\t\thasLanguages = true;\r\n\t\t\t\t}\r\n\t\t\t\tprepareForm(\"languageform\");\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"login\":\r\n\t\t\t\tvar form = document.getElementById(\"loginform\");\r\n\t\t\t\tprepareForm(\"loginform\");\r\n\t\t\t\tsetConsoleLanguage();\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t\tbindingMap.introdecks.select(id);\r\n\t\tbindingMap.navdecks.select(\"nav\" + id);\r\n\r\n\t\tvar p = document.getElementById(\"crumbs\");\r\n\t\tvar spans = new List(p.getElementsByTagName(\"span\"));\r\n\t\tspans.each(function (span) {\r\n\t\t\tif (span.id == \"crumb\" + id) {\r\n\t\t\t\tspan.className = \"text-primary\";\r\n\t\t\t} else {\r\n\t\t\t\tspan.className = \"\";\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tfunction setConsoleLanguage() {\r\n\t\tdocument.getElementById(\"consolelanguage\").value = document.getElementById(\"websitelanguage\").value;\r\n\t}\r\n\r\n\tfunction getLanguages() {\r\n\r\n\t\tvar langs = new List(SetupService.GetLanguages(true));\r\n\t\tvar markup = \"\";\r\n\t\tlangs.each(function (lang) {\r\n\t\t\tmarkup += \"<option value=\\\"\" + lang.Key + \"\\\"\" + (lang.Selected ? \" selected=\\\"selected\\\"\" : \"\") + \">\" + lang.Title + \"</option>\";\r\n\t\t});\r\n\t\t\r\n\t\tvar selector = document.getElementById(\"websitelanguage\");\r\n\t\tselector.innerHTML = markup;\r\n\r\n\t\tselector = document.getElementById(\"consolelanguage\");\r\n\t\tselector.innerHTML = markup;\r\n\t}\r\n\r\n\t/**\r\n\t* @param {String} id\r\n\t*/\r\n\tfunction prepareForm(id) {\r\n\r\n\t\tvar form = document.getElementById(id);\r\n\t\tvar elements = new List(form.elements);\r\n\r\n\t\tif (!form.isPrepared) {\r\n\r\n\t\t\tform.isPrepared = true;\r\n\r\n\t\t\telements.each(function (element, index) {\r\n\r\n\t\t\t\telement.onfocus = function () {\r\n\r\n\t\t\t\t\twindow.standardEventHandler.enableNativeKeys();\r\n\r\n\t\t\t\t\ttabindex = index;\r\n\r\n\t\t\t\t\tif (this.type == \"text\" || this.type == \"password\") {\r\n\t\t\t\t\t\tvar input = this;\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\tif (Client.isExplorer) {\r\n\t\t\t\t\t\t\t\tvar range = input.createTextRange();\r\n\t\t\t\t\t\t\t\trange.moveStart(\"character\", 0);\r\n\t\t\t\t\t\t\t\trange.moveEnd(\"character\", input.value.length);\r\n\t\t\t\t\t\t\t\trange.select();\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tinput.setSelectionRange(0, input.value.length);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, 0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\telement.onblur = function () {\r\n\r\n\t\t\t\t\twindow.standardEventHandler.disableNativeKeys();\r\n\r\n\t\t\t\t\tswitch (this.id) {\r\n\t\t\t\t\t\tcase \"password\":\r\n\t\t\t\t\t\t\tif (this.value != \"\" && this.value.length < 6) {\r\n\t\t\t\t\t\t\t\tbadPassLength(true);\r\n\t\t\t\t\t\t\t} else if (hasLength) {\r\n\t\t\t\t\t\t\t\tbadPassLength(false);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"passcheck\":\r\n\t\t\t\t\t\t\tvar password = document.getElementById(\"password\");\r\n\t\t\t\t\t\t\tif (password.value != \"\") {\r\n\t\t\t\t\t\t\t\tif (password.value != this.value) {\r\n\t\t\t\t\t\t\t\t\tnoneShallPass(true);\r\n\t\t\t\t\t\t\t\t} else if (hasBlock) {\r\n\t\t\t\t\t\t\t\t\tnoneShallPass(false);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (id == \"loginform\") {\r\n\t\t\t\t\telement.onkeyup = function () {\r\n\t\t\t\t\t\tvalidate();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (element.id == \"newsletter\") {\r\n\t\t\t\t\t\telement.onclick = function () {\r\n\t\t\t\t\t\t\tvalidate();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\telements.get(0).focus();\r\n\r\n\t}\r\n\r\n\t// isRFC822ValidEmail function by Ross Kendall, http://rosskendall.com/ - added '.' check.\r\n\tfunction isRFC822ValidEmail(sEmail) {\r\n\t\tvar sQtext = '[^\\\\x0d\\\\x22\\\\x5c\\\\x80-\\\\xff]';\r\n\t\tvar sDtext = '[^\\\\x0d\\\\x5b-\\\\x5d\\\\x80-\\\\xff]';\r\n\t\tvar sAtom = '[^\\\\x00-\\\\x20\\\\x22\\\\x28\\\\x29\\\\x2c\\\\x2e\\\\x3a-\\\\x3c\\\\x3e\\\\x40\\\\x5b-\\\\x5d\\\\x7f-\\\\xff]+';\r\n\t\tvar sQuotedPair = '\\\\x5c[\\\\x00-\\\\x7f]';\r\n\t\tvar sDomainLiteral = '\\\\x5b(' + sDtext + '|' + sQuotedPair + ')*\\\\x5d';\r\n\t\tvar sQuotedString = '\\\\x22(' + sQtext + '|' + sQuotedPair + ')*\\\\x22';\r\n\t\tvar sDomain_ref = sAtom;\r\n\t\tvar sSubDomain = '(' + sDomain_ref + '|' + sDomainLiteral + ')';\r\n\t\tvar sWord = '(' + sAtom + '|' + sQuotedString + ')';\r\n\t\tvar sDomain = sSubDomain + '(\\\\x2e' + sSubDomain + ')*';\r\n\t\tvar sLocalPart = sWord + '(\\\\x2e' + sWord + ')*';\r\n\t\tvar sAddrSpec = sLocalPart + '\\\\x40' + sDomain; // complete RFC822 email address spec\r\n\t\tvar sValidEmail = '^' + sAddrSpec + '$'; // as whole string\r\n\r\n\t\tvar reValidEmail = new RegExp(sValidEmail);\r\n\r\n\t\tif (reValidEmail.test(sEmail) && sEmail.indexOf('.') != -1) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\r\n\tfunction validate() {\r\n\r\n\t\tvar username = document.getElementById(\"username\");\r\n\t\tvar password = document.getElementById(\"password\");\r\n\t\tvar passcheck = document.getElementById(\"passcheck\");\r\n\t\tvar email = document.getElementById(\"email\");\r\n\t\tvar newsletter = document.getElementById(\"newsletter\");\r\n\r\n\t\tvar isValid = false;\r\n\r\n\t\tif (username.value != \"\") {\r\n\t\t\tif (password.value.length >= 6 && passcheck.value.length >= 6) {\r\n\t\t\t\tif (password.value == passcheck.value) {\r\n\t\t\t\t\tif (isRFC822ValidEmail(email.value)) {\r\n\t\t\t\t\t\tisValid = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (isValid) {\r\n\t\t\tbindingMap.startbutton.enable();\r\n\t\t\tif (hasBlock) {\r\n\t\t\t\tnoneShallPass(false);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tbindingMap.startbutton.disable();\r\n\t\t}\r\n\r\n\t\treturn isValid;\r\n\t}\r\n\r\n\t/**\r\n\t* @param {boolean} isBad\r\n\t*/\r\n\tfunction badPassLength(isBad) {\r\n\r\n\t\tif (hasBlock) {\r\n\t\t\tnoneShallPass(false);\r\n\t\t}\r\n\r\n\t\tvar p = document.getElementById(\"lengthbad\");\r\n\t\tif (isBad) {\r\n\t\t\tp.style.display = \"block\";\r\n\t\t} else {\r\n\t\t\tp.style.display = \"none\";\r\n\t\t}\r\n\t\thasLength = isBad;\r\n\t}\r\n\r\n\t/**\r\n\t* @param {boolean} isBlock\r\n\t*/\r\n\tfunction noneShallPass(isBlock) {\r\n\r\n\t\tif (hasLength) {\r\n\t\t\tbadPassLength(false);\r\n\t\t}\r\n\r\n\t\tvar p = document.getElementById(\"loginbad\");\r\n\t\tif (isBlock) {\r\n\t\t\tp.style.display = \"block\";\r\n\t\t} else {\r\n\t\t\tp.style.display = \"none\";\r\n\t\t}\r\n\t\thasBlock = isBlock;\r\n\t}\r\n\r\n\t/**\r\n\t* @implements {IBroadcastListener}\r\n\t* @param {String} broadcast\r\n\t*/\r\n\tthis.handleBroadcast = function (broadcast) {\r\n\r\n\t\tvar decks = bindingMap.introdecks;\r\n\t\tvar deck = decks.getSelectedDeckBinding();\r\n\t\tvar id = deck.getID()\r\n\r\n\t\tif (id == \"language\" || id == \"login\") {\r\n\r\n\t\t\tswitch (broadcast) {\r\n\r\n\t\t\t\tcase BroadcastMessages.KEY_TAB:\r\n\r\n\t\t\t\t\tvar form = document.getElementById(id + \"form\");\r\n\t\t\t\t\tvar elements = form.elements;\r\n\r\n\t\t\t\t\tvar index = 0;\r\n\r\n\t\t\t\t\tif (Keyboard.isShiftPressed) {\r\n\t\t\t\t\t\tif (tabindex == 0) {\r\n\t\t\t\t\t\t\tindex = elements.length - 1;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tindex = --tabindex;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (tabindex != elements.length - 1) {\r\n\t\t\t\t\t\t\tindex = ++tabindex;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telements[index].focus();\r\n\t\t\t\t\ttabindex = index;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase BroadcastMessages.KEY_ENTER:\r\n\t\t\t\t\tif (id == \"login\") {\r\n\t\t\t\t\t\tif (validate()) {\r\n\t\t\t\t\t\t\tthis.login();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Mount setup options.\r\n\t*/\r\n\tfunction getSetup() {\r\n\r\n\t\tvar transformer = new XSLTransformer();\r\n\t\ttransformer.importStylesheet(\"${root}/welcome.xsl\");\r\n\r\n\t\tsetup = SetupService.GetSetupDescription(true);\r\n\t\tvar html = transformer.transformToString(setup, true);\r\n\t\thtml = Client.fixUI(html);\r\n\r\n\t\tvar target = document.getElementById(\"setuptext\");\r\n\t\ttarget.innerHTML = setup.documentElement.getAttribute(\"desc\");\r\n\r\n\t\ttarget = document.getElementById(\"setupfields\");\r\n\t\ttarget.innerHTML = html.replace(/xmlns:ui=\\\"urn:HACKED\\\"/g, \"\").replace('<?xml version=\"1.0\"?>',\"\");\r\n\t\tDocumentManager.attachBindings(target);\r\n\t}\r\n\r\n\tfunction updateSetup() {\r\n\r\n\t\t// reset setup result\r\n\t\tif (Client.isWebKit) { // huh? Cannot clone document node?\r\n\t\t\tvar xml = DOMSerializer.serialize(setup);\r\n\t\t\tclone = XMLParser.parse(xml);\r\n\t\t} else {\r\n\t\t\tclone = setup.cloneNode(true);\r\n\t\t}\r\n\r\n\t\tvar keys = {};\r\n\t\tvar radios = new List();\r\n\t\tvar elements = new List(clone.getElementsByTagName(\"*\"));\r\n\r\n\t\telements.each(function (element) { // IE no speak getElementsByTagName ( \"radio\" )!\r\n\t\t\tif (element.nodeName == \"radio\") {\r\n\t\t\t\tradios.add(element);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tradios.each(function (radio) {\r\n\t\t\tradio.removeAttribute(\"selected\");\r\n\t\t\tkeys[radio.getAttribute(\"key\")] = radio;\r\n\t\t});\r\n\r\n\t\tvar target = document.getElementById(\"setupfields\");\r\n\t\tvar groups = new List(DOMUtil.getElementsByTagName (target, \"radiodatagroup\"));\r\n\r\n\t\t// update setup result\r\n\t\tgroups.each(function (group) {\r\n\t\t\tgroup = UserInterface.getBinding(group);\r\n\t\t\tvar key = group.getValue();\r\n\t\t\tvar radio = keys[key];\r\n\t\t\tradio.setAttribute(\"selected\", \"true\");\r\n\t\t});\r\n\r\n\t\t// remove unselected elements\r\n\t\tradios.each(function (radio) {\r\n\t\t\tif (radio.getAttribute(\"selected\") == null) {\r\n\t\t\t\tradio.parentNode.removeChild(radio);\r\n\t\t\t} else {\r\n\t\t\t\tradio.removeAttribute(\"selected\");\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tthis.update = function (binding) {\r\n\r\n\t\tswitch (binding.constructor) {\r\n\t\t\tcase RadioDataBinding:\r\n\t\t\t\tupdateRadio(binding);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction updateRadio(binding) {\r\n\r\n\t\tvar parent = binding.bindingElement.parentNode;\r\n\t\tvar group = UserInterface.getBinding(parent);\r\n\t\tvar radios = group.getChildBindingsByLocalName(\"radio\");\r\n\r\n\t\tsetTimeout(function () {\r\n\t\t\tradios.each(function (radio) {\r\n\t\t\t\tvar id = \"div\" + radio.getProperty(\"value\");\r\n\t\t\t\tvar div = document.getElementById(id);\r\n\t\t\t\tif (div != null) {\r\n\t\t\t\t\tif (radio.isChecked) {\r\n\t\t\t\t\t\tCSSUtil.attachClassName(div, \"visible\");\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tCSSUtil.detachClassName(div, \"visible\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}, 0);\r\n\t}\r\n\r\n\t/**\r\n\t* @param {HTMLInputElement} input\r\n\t*/\r\n\tthis.acceptLicense = function (input) {\r\n\r\n\t\tvar button = bindingMap.setupbutton;\r\n\t\tif (input.checked) {\r\n\t\t\tbutton.enable();\r\n\t\t} else {\r\n\t\t\tbutton.disable();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Login!\r\n\t*/\r\n\tthis.login = function () {\r\n\t\r\n\t\tvar self = this;\r\n\t\tvar serial = DOMSerializer.serialize(clone, true);\r\n\t\tvar username = document.getElementById(\"username\").value;\r\n\t\tvar password = document.getElementById(\"password\").value;\r\n\t\tvar email = document.getElementById(\"email\").value;\r\n\t\tvar newsletter = document.getElementById(\"newsletter\").checked;\r\n\r\n\t\tvar select = document.getElementById(\"websitelanguage\");\r\n\t\tvar websitelanguage = select.options[select.selectedIndex].value;\r\n\r\n\t\tselect = document.getElementById(\"consolelanguage\");\r\n\t\tvar consolelanguage = select.options[select.selectedIndex].value;\r\n\r\n\t\tself.loading();\r\n\r\n\t\tSetupService.SetUp(serial, username, email, password, websitelanguage, consolelanguage, newsletter,\r\n\t\t\t\tfunction (response) {\r\n\t\t\t\t\tif (response) {\r\n\t\t\t\t\t\tApplication.reload(true);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tclearInterval(progressLoading);\r\n\t\t\t\t\t\talert(\"An unfortunate error has occurred.\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t* Show Loading Deck with progress bar\r\n\t* Progress bar goes from 0 to 100 in 45 seconds - and then restart after 5 seconds (if things are still working).\r\n\t*/\r\n\tthis.loading = function () {\r\n\t\tbindingMap.introdecks.select(\"loading\");\r\n\t\tbindingMap.cover.attachClassName(\"loading-cover\");\r\n\t\tbindingMap.navdecks.hide();\r\n\t\tvar current = new Date().getTime();\r\n\t\tvar end = current + 50000; // total 45 seconds + wait 5 seconds\r\n\t\tProgressBarBinding.notch(1);\r\n\t\tprogressLoading = setInterval(function () {\r\n\t\t\tif (current > end) {\r\n\t\t\t\tProgressBarBinding.reload();\r\n\t\t\t\tprogressNotchIndex = 0;\r\n\t\t\t\tend = current + 50000;\r\n\t\t\t}\r\n\t\t\tProgressBarBinding.notch(1);\r\n\t\t\tcurrent = new Date().getTime();\r\n\t\t\tprogressNotchIndex++;\r\n\t\t}, 2250); // 20 notches * 2.25 seconds = 45 seconds\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/app.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\r\n\t<title>Composite.Management.App</title>\r\n\r\n\t<!-- quickly set this variable before the WindowManager loads! -->\r\n\t<script type=\"text/javascript\">top.app = this;</script>\r\n\r\n\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t<control:styleloader runat=\"server\" />\r\n\t<control:brandingSnippet runat=\"server\" SnippetName=\"includes\" />\r\n\t<ui:bindingmappingset>\r\n\t\t<ui:bindingmapping element=\"ui:splitbox\" binding=\"StageSplitBoxBinding\" />\r\n\t\t<ui:bindingmapping element=\"ui:splitpanel\" binding=\"StageSplitPanelBinding\" />\r\n\t\t<ui:bindingmapping element=\"ui:splitter\" binding=\"StageSplitterBinding\" />\r\n\t</ui:bindingmappingset>\r\n\r\n\t<ui:broadcasterset>\r\n\t\t<ui:broadcaster id=\"broadcasterCurrentIsEditor\" isdisabled=\"true\" />\r\n\t\t<ui:broadcaster id=\"broadcasterHasOpenEditors\" isdisabled=\"true\" />\r\n\t\t<ui:broadcaster id=\"broadcasterCurrentTabDirty\" isdisabled=\"true\" />\r\n\t\t<ui:broadcaster id=\"broadcasterHasDirtyTabs\" isdisabled=\"true\" />\r\n\t</ui:broadcasterset>\r\n\r\n</head>\r\n<body id=\"app\">\r\n\r\n\t<ui:cursor id=\"dragdropcursor\" />\r\n\t<ui:dialogset id=\"masterdialogset\" binding=\"StageDialogSetBinding\" />\r\n\t<ui:window id=\"downloadwindow\" url=\"${root}/blank.aspx\" flex=\"false\" />\r\n\r\n\t<ui:popupset id=\"fieldhelpopupset\" />\r\n\t<ui:popupset id=\"selectorpopupset\" />\r\n\t<ui:popupset id=\"masterpopupset\">\r\n\t\t<ui:popup id=\"masterpopup\" />\r\n\t\t<ui:popup id=\"tabsbuttonpopup\" position=\"bottom\" />\r\n\t\t<ui:popup id=\"moreactionspopup\" position=\"bottom\" />\r\n\t\t<ui:popup id=\"visualeditorpopup\" binding=\"VisualEditorPopupBinding\" />\r\n\t\t<ui:popup id=\"sourcecodeeditorpopup\" binding=\"CodeMirrorEditorPopupBinding\" />\r\n\t\t<ui:popup id=\"explorerpopup\" binding=\"ExplorerPopupBinding\">\r\n\t\t\t<ui:menubody>\r\n\t\t\t\t<ui:menugroup rel=\"treeoperations\">\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelRefresh}\" cmd=\"refresh\" image=\"${icon:refresh}\" image-disabled=\"${icon:refresh-disabled}\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\t\t<ui:popup id=\"systemtreepopup\" binding=\"SystemTreePopupBinding\">\r\n\t\t\t<ui:menubody>\r\n\t\t\t\t<ui:menugroup rel=\"treeoperations\">\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelRefresh}\" cmd=\"refresh\" image=\"${icon:refresh}\" image-disabled=\"${icon:refresh-disabled}\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t\t<ui:menugroup rel=\"clipboardoperations\">\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelCut}\" cmd=\"cut\" image=\"${icon:cut}\" image-disabled=\"${icon:cut-disabled}\" isdisabled=\"true\" />\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelCopy}\" cmd=\"copy\" image=\"${icon:copy}\" image-disabled=\"${icon:copy-disabled}\" isdisabled=\"true\" style=\"display: none;\" />\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelPaste}\" cmd=\"paste\" image=\"${icon:paste}\" image-disabled=\"${icon:paste-disabled}\" isdisabled=\"true\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\t\t<ui:popup id=\"docktabpopup\" binding=\"DockTabPopupBinding\">\r\n\t\t\t<ui:menubody>\r\n\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelCloseTab}\" cmd=\"closetab\" />\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelCloseOthers}\" cmd=\"closeothers\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t\t<ui:menugroup rel=\"developermode\">\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelRefreshView}\" cmd=\"refreshview\" />\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelMakeDirty}\" cmd=\"makedirty\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t\t<ui:menugroup rel=\"developermode\">\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelViewSource}\" cmd=\"viewsource\" />\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelViewGenerated}\" cmd=\"viewgenerated\" />\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelViewSerialized}\" cmd=\"viewserialized\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\t\t<ui:popup id=\"dialogtitlebarpopup\" binding=\"DialogTitleBarPopupBinding\">\r\n\t\t\t<ui:menubody>\r\n\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelClose}\" cmd=\"closedialog\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t\t<ui:menugroup rel=\"developermode\">\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelRefreshView}\" cmd=\"refreshview\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t\t<ui:menugroup rel=\"developermode\">\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelViewSource}\" cmd=\"viewsource\" />\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelViewGenerated}\" cmd=\"viewgenerated\" />\r\n\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelViewSerialized}\" cmd=\"viewserialized\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\t\t<ui:popup id=\"toolboxpopup\" position=\"bottom\">\r\n\t\t\t<ui:menubody>\r\n\t\t\t\t<ui:menugroup id=\"toolboxpopupgroup\" />\r\n\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t<ui:menuitem binding=\"StartMenuItemBinding\" label=\"${string:Website.App.LabelViewCompositeStart}\" image=\"${icon:company-composite}\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\t</ui:popupset>\r\n\r\n\t<ui:balloonset id=\"balloonset\" />\r\n\t<ui:balloonset id=\"dialogballoonset\" />\r\n\r\n\t<ui:menubar id=\"menubar\" class=\"menubar\" binding=\"StageMenuBarBinding\">\r\n\r\n\t\t<%--\t\t<ui:menu label=\"${string:Website.App.LabelFile}\" >\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelFileClose}\" oncommand=\"Commands.close ()\" observes=\"broadcasterCurrentIsEditor\" tooltip=\"Save and close active editor\" />\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelFileCloseAll}\" oncommand=\"Commands.closeAll ()\" observes=\"broadcasterHasOpenEditors\" tooltip=\"Save and close all editors\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelSave}\" oncommand=\"Commands.save ()\" observes=\"broadcasterCurrentTabDirty\" tooltip=\"Save active editor\" />\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelFileSaveAll}\" oncommand=\"Commands.saveAll ()\" observes=\"broadcasterHasDirtyTabs\" tooltip=\"Save all editors\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menu>--%>\r\n\t\t<%--\t\t<ui:menu label=\"${string:Website.App.LabelView}\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem binding=\"StartMenuItemBinding\" label=\"${string:Website.App.LabelViewCompositeStart}\" image=\"${icon:composite}\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menu>--%>\r\n\t\t<ui:menu label=\"Developer\" rel=\"developermode\" id=\"developermenu\" class=\"last\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelSystemLog}\" binding=\"StageViewMenuItemBinding\" handle=\"Composite.Management.SystemLog\" type=\"checkbox\" image=\"${icon:systemlog}\" />\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelDeveloperPanel}\" binding=\"StageViewMenuItemBinding\" handle=\"Composite.Management.Developer\" type=\"checkbox\" image=\"${icon:developer}\" />\r\n\t\t\t\t\t\t<ui:menuitem label=\"Icons\">\r\n\t\t\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Sprite SVG\" binding=\"StageViewMenuItemBinding\" handle=\"Composite.Management.IconPack.SpriteSVG\" type=\"checkbox\" image=\"${icon:icon}\" />\r\n\t\t\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t\t\t</ui:menuitem>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menu>\r\n\t\t<%--\t\t<ui:menu label=\"${string:Website.App.LabelTools}\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menu>--%>\r\n\t\t<ui:menu image=\"${icon:help}\" id=\"helpmenu\" class=\"icon\" tooltip=\"${string:Website.App.LabelHelp}\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelHelpContents}\" image=\"${icon:help}\" binding=\"StageViewMenuItemBinding\" handle=\"Composite.Management.Help\" />\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelFeedback}\" image=\"${icon:feedback}\" oncommand=\"window.open('http://users.composite.net/Feedback')\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<div class=\"brand-about-menuitem\" onclick=\"Commands.about()\">\r\n\t\t\t\t\t\t\t<img alt=\"brand\" src=\"images/branding/brand-icon.png?cacheversion=<%= DateTime.Now.TimeOfDay %>\" />\r\n\t\t\t\t\t\t\t<div class=\"menuitem-text\">\r\n\t\t\t\t\t\t\t\t<ui:text label=\"${string:Website.App.LabelAbout}\"></ui:text>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menu>\r\n\t\t<ui:menu image=\"${icon:settings}\" id=\"settingsmenu\" class=\"icon\" tooltip=\"${string:Website.App.LabelSettings}\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup id=\"toolsmenugroup\" />\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menu>\r\n\t\t<ui:menu id=\"localizationmenu\" binding=\"LocalizationSelectorBinding\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menu>\r\n\t\t<ui:menu label=\"Username\" id=\"usermenu\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup id=\"translationsmenugroup\" />\r\n\t\t\t\t\t<ui:menugroup id=\"usermenugroup\" />\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.App.LabelFileExit}\" image=\"${icon:exit}\" oncommand=\"Application.quit ();\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menu>\r\n\t</ui:menubar>\r\n\t<ui:explorer id=\"explorer\">\r\n\t\t<ui:explorermenu id=\"explorermenu\">\r\n\t\t\t<ui:explorertoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"left\">\r\n\t\t\t\t\t<ui:toolbargroup class=\"clearfix\">\r\n\t\t\t\t\t\t<div class=\"brand-name\">\r\n\t\t\t\t\t\t\t<div class=\"brand-icon\">\r\n\t\t\t\t\t\t\t\t<img src=\"images/branding/brand-icon.png?cacheversion=<%= DateTime.Now.TimeOfDay %>\" alt=\"brand\" onclick=\"EventBroadcaster.broadcast(BroadcastMessages.START_COMPOSITE);\" />\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div class=\"brand-text\">\r\n\t\t\t\t\t\t\t\t<img src=\"images/branding/brand-text.svg?cacheversion=<%= DateTime.Now.TimeOfDay %>\" alt=\"brand\" />\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"menutogglebutton\" class=\"menu-toggle\" image=\"${icon:menu}\" oncommand=\"top.app.bindingMap.explorermenu.toggle()\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t<ui:toolbarbody class=\"max\">\r\n\t\t\t\t\t<ui:toolbargroup class=\"max textonly\" />\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t<ui:toolbarbody class=\"brand-main\">\r\n\t\t\t\t\t<control:brandingSnippet SnippetName=\"brand-main\" runat=\"server\" />\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:explorertoolbar>\r\n\t\t</ui:explorermenu>\r\n\t</ui:explorer>\r\n\t<ui:cover id=\"explorermenucover\" transparent=\"true\" busy=\"false\" class=\"explorermenucover\" onclick=\"top.app.bindingMap.explorermenu.collapse()\" />\r\n\r\n\t<ui:cover id=\"stagesplittercover\" hidden=\"true\" transparent=\"true\" busy=\"false\" />\r\n\t<ui:stagesplitterbody id=\"stagesplitterbody\" class=\"binding\" binding=\"StageSplitterBodyBinding\" />\r\n\r\n\t<ui:viewset id=\"views\" />\r\n\r\n\t<ui:stagecontainer id=\"stagecontainer\">\r\n\t\t<ui:flexbox id=\"stageflexbox\">\r\n\t\t\t<ui:stage id=\"stage\" strongfocusmanager=\"false\">\r\n\t\t\t\t<ui:splitbox id=\"appstagesplitbox\" orient=\"horizontal\" layout=\"5:2\" persist=\"layout\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:splitbox id=\"appverticalsplitbox\" orient=\"vertical\" layout=\"3:1\" persist=\"layout\">\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:decks id=\"maindecks\">\r\n\t\t\t\t\t\t\t\t\t<ui:deck id=\"startdeck\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:dock id=\"startdock\" reference=\"start\" type=\"start\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:docktab handle=\"Composite.Management.Start\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:dockpanel />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t\t\t\t\t<ui:deck id=\"stagedeck\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:cover id=\"stagedeckscover\" busy=\"false\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:stagedecks id=\"stagedecks\" />\r\n\t\t\t\t\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t\t\t\t</ui:decks>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:splitbox id=\"absbottomsplitbox\" orient=\"horizontal\" layout=\"2:1\" persist=\"layout\">\r\n\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t<ui:dock reference=\"absbottomleft\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:docktabs />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:dockpanels />\r\n\t\t\t\t\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t<ui:dock reference=\"absbottomright\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:docktabs />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:dockpanels />\r\n\t\t\t\t\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:splitbox id=\"absrightsplitbox\" orient=\"vertical\" layout=\"1:1\" persist=\"layout\">\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:dock reference=\"absrighttop\">\r\n\t\t\t\t\t\t\t\t\t<ui:docktabs />\r\n\t\t\t\t\t\t\t\t\t<ui:dockpanels />\r\n\t\t\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:dock reference=\"absrightbottom\">\r\n\t\t\t\t\t\t\t\t\t<ui:docktabs />\r\n\t\t\t\t\t\t\t\t\t<ui:dockpanels />\r\n\t\t\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t</ui:stage>\r\n\t\t</ui:flexbox>\r\n\t\t<%--\t<ui:toolbar id=\"statusbar\" binding=\"StageStatusBarBinding\">\r\n\t\t\t<ui:toolbarbody>\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:toolbarlabel id=\"statusbarlabel\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t<ui:selector binding=\"LocalizationSelectorBinding\" image=\"${icon:users-changepublicculture}\" />\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>--%>\r\n\t</ui:stagecontainer>\r\n\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/base.css",
    "content": "@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nhtml {\r\n    overflow: auto;\r\n}\r\n\r\n.toppage {\r\n    font-size: 16px;\r\n    font-family: \"Segoe UI\", Tahoma, sans-serif;\r\n    color: #333;\r\n    overflow: auto;\r\n}\r\n\r\n    .toppage a, .toppage a:focus {\r\n        color: #21B980;\r\n        cursor: pointer;\r\n    }\r\n\r\n\r\n        .toppage a:hover {\r\n            color: #04A380;\r\n            text-decoration: underline;\r\n        }\r\n\r\n    .toppage .cover {\r\n        display: block;\r\n        position: fixed;\r\n        z-index: 1;\r\n        top: 0;\r\n        left: 0;\r\n        right: 0;\r\n        width: 100%;\r\n        height: 100%;\r\n        overflow: auto;\r\n        background-color: rgb(240,240,240);\r\n        -moz-background-size: cover;\r\n        -o-background-size: cover;\r\n        background-size: cover;\r\n        background-position: center center;\r\n        background-repeat: no-repeat;\r\n        background-image: url(\"${root}/images/top-page-cover-bg.jpg\");\r\n    }\r\n\r\n    .toppage .cover-dark-overlay:after {\r\n        content: \"\";\r\n        position: fixed;\r\n        top: 0;\r\n        left: 0;\r\n        right: 0;\r\n        bottom: 0;\r\n        z-index: 2;\r\n        width: 100%;\r\n        background-color: rgba(0, 0, 0, 0.6);\r\n    }\r\n\r\n\r\n    .toppage .logo {\r\n        width: 168px;\r\n        height: 38px;\r\n        background: url(\"${root}/images/logo.png\") no-repeat 0 0;\r\n        margin: 0 auto 40px auto;\r\n    }\r\n\r\n\r\n    .toppage .splash {\r\n        position: relative;\r\n        z-index: 3;\r\n        display: block;\r\n        width: 312px;\r\n        margin: 10% auto 10% auto;\r\n        -ms-border-radius: 15px;\r\n        border-radius: 15px;\r\n        background: #fff;\r\n    }\r\n\r\n    .toppage .splash-inner {\r\n        padding: 30px 30px 40px 30px;\r\n    }\r\n\r\n    .toppage h1 {\r\n        border-bottom: solid 1px #E1E1E1;\r\n        padding-bottom: 10px;\r\n    }\r\n\r\n    .toppage .errortext {\r\n        display: none;\r\n        color: red;\r\n    }\r\n\r\n    .toppage ui|clickbutton {\r\n        float: none;\r\n        width: 100%;\r\n        margin: 0;\r\n    }\r\n\r\n        .toppage ui|clickbutton.right-btn {\r\n            float: right;\r\n            width: auto;\r\n        }\r\n\r\n        .toppage ui|clickbutton.left-btn {\r\n            float: left;\r\n            width: auto;\r\n        }\r\n\r\n    .toppage ui|dialogtoolbar ui|clickbutton.focusable {\r\n        margin: 0 !important;\r\n        color: #fff;\r\n    }\r\n\r\n    .toppage ui|clickbutton ui|labelbox, .toppage .clickbutton {\r\n        display: block;\r\n        text-decoration: none;\r\n        background: #21B980;\r\n        color: #fff;\r\n        -ms-border-radius: 20px;\r\n        border-radius: 20px;\r\n        width: 100%;\r\n        text-transform: uppercase;\r\n        padding: 10px 20px;\r\n        text-align: center;\r\n    }\r\n\r\n        .toppage ui|dialogtoolbar ui|clickbutton.hover ui|labelbox, .toppage .clickbutton:hover {\r\n            background: #04A380;\r\n            color: #fff;\r\n            text-decoration: none;\r\n        }\r\n\r\n    .toppage ui|clickbutton ui|labelbody {\r\n        height: auto;\r\n    }\r\n\r\n    .toppage ui|clickbutton ui|labelbody, .toppage ui|clickbutton ui|labelbox ui|labeltext {\r\n        float: none;\r\n    }\r\n\r\n    .toppage ui|clickbutton.isdisabled {\r\n        opacity: 0.5;\r\n    }\r\n\r\n        .toppage ui|clickbutton.isdisabled ui|labeltext {\r\n            color: white;\r\n        }\r\n"
  },
  {
    "path": "Website/Composite/blank.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n<%\r\n\tResponse.Cache.SetExpires(DateTime.Now.AddHours(1));\r\n\tResponse.Cache.SetCacheability(HttpCacheability.Private);\r\n%>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Blank</title>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\twindow.isDefaultDocument = true;\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<!-- \r\n\t\t\tfor HTTPS setup, XPSP2 will complain about loading \"about:blank\" in iframes \r\n\t\t\tso please use this page as default content. \r\n\t\t-->\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/compile.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<head>\r\n\t\t<title>Script Compilation</title>\r\n\t\t<style type=\"text/css\">\r\n\t\t\thtml {\r\n\t\t\t\tbackground-color: ThreeDFace;\r\n\t\t\t\tcolor: black;\r\n\t\t\t}\r\n\t\t\tbody {\r\n\t\t\t\tfont-family: Verdana, sans-serif;\r\n\t\t\t\tfont-size: 70%;\r\n\t\t\t\tmargin: 20px;\r\n\t\t\t}\r\n\t\t\tcode, textarea {\r\n\t\t\t\tfont-family: \"Courier New\", monospace;\r\n\t\t\t}\r\n\t\t\ttextarea {\r\n\t\t\t\tfont-size: 100%;\r\n\t\t\t\twidth: 80%;\r\n\t\t\t\theight: 60px;\r\n\t\t\t}\r\n\t\t\tp {\r\n\t\t\t\twhite-space: nowrap;\r\n\t\t\t}\r\n\t\t</style>\r\n\t</head>\r\n\t<body>\r\n\t\t<p>\r\n\t\t\t<control:scriptloader type=\"top\" directive=\"compile\" runat=\"server\"/>\r\n\t\t\t<control:scriptloader type=\"sub\" directive=\"compile\" runat=\"server\"/>\r\n            <control:styleloader directive=\"compile\" runat=\"server\" />\r\n\t\t</p>\r\n\t\t<p>Success! Now compress files manually by adapting these commands to your file structure:</p>\r\n\t\t<textarea wrap=\"off\">java -jar &quot;<%= Request.MapPath( \"~/Composite\") %>\\applets\\custom_rhino.jar&quot; -opt -1 -c &quot;<%= Request.MapPath( \"~/Composite\") %>\\scripts\\compressed\\top-uncompressed.js&quot; > &quot;<%= Request.MapPath( \"~/Composite\") %>\\scripts\\compressed\\top.js&quot; 2>&amp;1\r\njava -jar &quot;<%= Request.MapPath( \"~/Composite\") %>\\applets\\custom_rhino.jar&quot; -opt -1 -c &quot;<%= Request.MapPath( \"~/Composite\") %>\\scripts\\compressed\\sub-uncompressed.js&quot; > &quot;<%= Request.MapPath( \"~/Composite\") %>\\scripts\\compressed\\sub.js&quot; 2>&amp;1</textarea>\r\n\t\t<p><small>About the \"-opt -1\" flag, please consult <a href=\"http://dojotoolkit.org/node/188\">this note</a>. Should be fixed on trunk in newer builds.</small></p>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/console/README.txt",
    "content": "Required for development:\n\n1) Check version of node.js - should be >4.* (cmd -> node -v => https://nodejs.org/en/)\n2) Check that Visual Studio uses correct node executable (https://ryanhayes.net/synchronize-node-js-install-version-with-visual-studio-2015/)\n\nTo run scripts in Visual Studio (not required if these are run only in command line/PowerShell):\n\n1) Install npm Task runner: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.NPMTaskRunner\n2) Locate npm scripts in Task Runner Explorer, in Website project\n"
  },
  {
    "path": "Website/Composite/console/Tree.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Place this file in Website\\App_Data\\Composite\\TreeDefinitions\\ -->\n<ElementStructure xmlns=\"http://www.composite.net/ns/management/trees/treemarkup/1.0\" xmlns:f=\"http://www.composite.net/ns/function/1.0\">\n\n\t  <ElementStructure.AutoAttachments>\n\t    <NamedParent Name=\"Content\" Position=\"Bottom\" />\n\t  </ElementStructure.AutoAttachments>\n\n\t  <ElementRoot>\n\t    <Children>\n\t\t\t\t<Element Label=\"Languages\" Id=\"language.edit.new\" Icon=\"log\">\n\t\t\t\t\t<Actions>\n\t\t\t\t\t\t<CustomUrlAction Label=\"Edit Language\" Url=\"~/Composite/console/?page=edit-language\" Icon=\"log-viewlog\" />\n\t\t\t\t\t</Actions>\n\t\t\t\t</Element>\n\t    </Children>\n\t  </ElementRoot>\n\n\t</ElementStructure>\n"
  },
  {
    "path": "Website/Composite/console/access/postFrame.js",
    "content": "// Finds an object in the outer console application.\n// Will throw if no such application exists (i.e. top === undefined)\nfunction getApplicationObject(path) {\n\tpath = path.split('.');\n\treturn getInObject(top, path);\n}\n\n// Provides Immutable.Iterator#getIn() functionality for ordnary JS objects.\nfunction getInObject(obj, path) {\n\tlet name = path.shift();\n\tif (obj[name]) {\n\t\tif (path.length) {\n\t\t\treturn getInObject(obj[name], path);\n\t\t} else {\n\t\t\treturn obj[name];\n\t\t}\n\t} else {\n\t\treturn null;\n\t}\n}\n\n/** Somewhat hacky shim to communicate with old UI outside an iframe hosting this app.\n XXX: DEPRECATED AT START OF LIFE - do not use this unless you have to.\n FIXME: Hardcoded to return function markup, needs to be more general\n*/\nexport default function outerFrameCallback(provider, obj) {\n\tif (top && top.Application) {\n\t\tvar target = {\n\t\t\tresponse: getApplicationObject(provider.response)\n\t\t};\n\t\tlet markup = provider.markup && getInObject(obj, provider.markup);\n\t\tif (markup) {\n\t\t\ttarget.result = {\n\t\t\t\tFunctionMarkup: markup,\n\t\t\t\tRequireConfiguration: true\n\t\t\t};\n\t\t}\n\t\tvar action = new top.Action(target, getApplicationObject(provider.action));\n\t\ttop.UserInterface.getBinding(window.frameElement.parentNode).dispatchAction(action);\n\t\treturn Promise.resolve();\n\t} else {\n\t\treturn Promise.reject(new Error('PostFrame protocol failed: No outer frame console application found'));\n\t}\n}\n"
  },
  {
    "path": "Website/Composite/console/access/requestJSON.js",
    "content": "import 'whatwg-fetch';\nimport 'url-polyfill';\n\nexport default function requestJSON(path, inputData) {\n\tif (typeof inputData === 'object') {\n\t\tinputData.credentials = 'include';\n\t\tif (typeof inputData.body === 'object') {\n\t\t\tinputData.method = inputData.method ? inputData.method : 'POST';\n\t\t\tinputData.headers = inputData.headers || {};\n\t\t\tinputData.headers['Content-Type'] = 'application/json';\n\t\t\tinputData.body = JSON.stringify(inputData.body);\n\t\t} else {\n\t\t\tdelete inputData.body;\n\t\t}\n\t} else {\n\t\tinputData = {\n\t\t\tcredentials: 'include'\n\t\t};\n\t}\n\tlet url = new URL(path, location.href);\n\treturn fetch(url.href, inputData)\n\t.then(response => {\n\t\tif (response.ok) {\n\t\t\treturn response.json();\n\t\t} else {\n\t\t\tif (response.headers && response.headers.get('Retry-After')) {\n\t\t\t\tlet waittime = parseInt(response.headers.get('Retry-After'), 10) * 1000;\n\t\t\t\treturn new Promise(resolve => setTimeout(resolve, waittime))\n\t\t\t\t.then(() => requestJSON(path, inputData));\n\t\t\t} else {\n\t\t\t\tthrow new Error(response.status + ' ' + response.statusText);\n\t\t\t}\n\t\t}\n\t});\n}\n"
  },
  {
    "path": "Website/Composite/console/access/utils.js",
    "content": "export function getBaseUrl() {\n\n\tlet baseUrlMatches = /^.*?(?=\\/Composite\\/)/gi.exec(location.pathname);\n\tlet baseUrl = baseUrlMatches == null ? '' : baseUrlMatches[0];\n\treturn baseUrl;\n}\n\nexport function handleLinkClick(e) {\n\tif (top && top.Client && top.Client.isAnyExplorer) { \n\t\te.preventDefault();\n\t\tlet link = e.target;\n\t\tif (link.target == '_top' && link.href.indexOf('#') > 1) {\n\t\t\ttop.location.href = link.href;\n\t\t}\n\t}\n}"
  },
  {
    "path": "Website/Composite/console/access/wampClient.js",
    "content": "import Wampy from 'wampy';\nimport { getBaseUrl } from './utils.js';\nlet currentClients = {};\n\nfunction getClient(realm) {\n\tif (currentClients[realm]) {\n\t\treturn Promise.resolve(currentClients[realm]);\n\t} else {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tlet url = new URL(getBaseUrl() + '/Composite/api/Router', location.href);\n\t\t\turl.protocol = url.protocol.replace('http', 'ws');\n\t\t\tconst client = new Wampy(url.href, {\n\t\t\t\trealm,\n\t\t\t\tonConnect: () => {\n\t\t\t\t\tcurrentClients[realm] = client;\n\t\t\t\t\tresolve(client);\n\t\t\t\t},\n\t\t\t\tonError: err => reject(err)\n\t\t\t});\n\t\t});\n\t}\n}\n\nfunction close(realm) {\n\tif (currentClients[realm]) {\n\t\tcurrentClients[realm].disconnect();\n\t\tdelete currentClients[realm];\n\t}\n}\n\nfunction closeAll() {\n\tObject.keys(currentClients).forEach(realm => close(realm));\n}\nwindow.addEventListener('beforeunload', closeAll);\n\nconst WAMPClient = {\n\tcall: (uri, ...args) => {\n\t\treturn getClient('realm')\n\t\t.then(client =>\n\t\t\tnew Promise((resolve, reject) =>\n\t\t\t\tclient.call(uri, args, { onSuccess: result => {\n\t\t\t\t\t// Unpick the way Wampy passes data: (see https://github.com/KSDaemon/wampy.js/blob/dev/Migrating.md)\n\t\t\t\t\tif (Array.isArray(result) && result.length === 1) {\n\t\t\t\t\t\t// RPC returned non-array\n\t\t\t\t\t\tresolve(result[0]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// RPC returned array\n\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t}\n\t\t\t\t}, onError: reject })\n\t\t\t)\n\t\t);\n\t},\n\tsubscribe: (uri, handler) => {\n\t\treturn getClient('realm')\n\t\t.then(client =>\n\t\t\tnew Promise((resolve, reject) => {\n\t\t\t\tclient.subscribe(uri, {\n\t\t\t\t\tonSuccess: (...args) => resolve(args),\n\t\t\t\t\tonError: (message, details) => reject({message, details}),\n\t\t\t\t\tonEvent: handler // Potentially needs argument unwrapping\n\t\t\t\t});\n\t\t\t})\n\t\t);\n\t}\n};\n\nexport default WAMPClient;\n"
  },
  {
    "path": "Website/Composite/console/access/wampTest.js",
    "content": "import Wampy from 'wampy';\nimport React from 'react';\nimport { render } from 'react-dom';\nimport styled from 'styled-components';\nimport { getBaseUrl } from './utils.js';\n\nconst Warning = styled.div`\n\tmax-width: 400px;\n\tmax-height: 200px;\n\ttext-align: center;\n\tpadding: 40px;\n\tmargin: 50px auto;\n\tborder: 3px solid red;\n\tborder-radius: 5px;\n\tbackground-color: salmon;\n`;\n\nconst test = new Promise((resolve, reject) => {\n\n\tlet url = new URL(getBaseUrl() + '/Composite/api/Router', location.href);\n\tlet isConnected = false;\n\turl.protocol = url.protocol.replace('http', 'ws');\n\tconst client = new Wampy(url.href, {\n\t\trealm: 'realm',\n\t\tmaxRetries: 0,\n\t\tonConnect: () => {\n\t\t\tresolve();\n\t\t\tisConnected = true;\n\t\t\tclient.disconnect();\n\t\t},\n\t\tonError: err => {\n\t\t\tif (!isConnected) { //FF throw error on disconnect and on server restarted\n\t\t\t\trender(\n\t\t\t\t\t<Warning>\n\t\t\t\t\t\t<h1>Problem establishing WebSocket connection to server</h1>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\tThere is an issue with connecting to the server – this\n\t\t\t\t\t\t\tcould indicate that the web server does not support\n\t\t\t\t\t\t\tWebSocket requests.\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\tFor more information,<span> </span>\n\t\t\t\t\t\t\t<a href=\"http://docs.composite.net/Getting-started/Setup-check-failures?errors=websockets\" target=\"_blank\">\n\t\t\t\t\t\t\t\tplease read more about WebSocket requirements.\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</Warning>,\n\t\t\t\t\tdocument.querySelector('body > div.entry')\n\t\t\t\t);\n\t\t\t\treject(err);\n\t\t\t}\n\t\t}\n\t});\n});\n\nexport default test;\n"
  },
  {
    "path": "Website/Composite/console/components/colors.js",
    "content": "﻿export default {\n    primaryColor: '#22B980',\n    baseFontColor: '#333',\n    mutedTextColor: '#999',\n    borderColor: '#ccc',\n    darkBackground: '#EFEFEF',\n\n\t/* BUTTON */\n\tbuttonTextColor: '#575757',\n\tbuttonDropShadowColor: '#DDD',\n\tbuttonHighlightColor: '#22B980',\n    buttonShadingColor: '#1ea371',\n\t/* end BUTTON */\n\n\tfieldsetBackgroundColor: '#F7F7F7',\n\tfieldsetLegendColor: '#22B980',\n    fieldFocusColor: '#22B980',\n    fieldBorderColor: '#ccc',\n    fieldLabelColor: '#999',\n\n    dialogHeaderColor: '#22B980',\n\tscrollbarThumbColor: '#CACACA',\n\tscrollbarTrackColor: '#FAFAFA',\n\ttableBorderColor: '#DDD',\n\tfadedTextColor: '#ADADAD',\n\thelpIconColor: '#CDCDCF'\n};\n"
  },
  {
    "path": "Website/Composite/console/components/container/ConnectDialog.js",
    "content": "import { connect } from 'react-redux';\nimport { currentPaletteElementList } from 'console/state/selectors/paletteDialogSelector.js';\nimport { currentDialogDefSelector } from 'console/state/selectors/dialogSelector.js';\nimport Dialog from 'console/components/presentation/Dialog.js';\nimport Immutable from 'immutable';\n\nfunction mapStateToProps(state, ownProps) {\n\t// Harvest dialog identity from pageDef\n\tlet dialogDef = state.getIn(['dialogDefs', ownProps.pageDef.get('dialog')]) || Immutable.Map();\n\t// TODO: Rig this up in a way that allows dialog control from layout state.\n\treturn {\n\t\tdialogDef: currentDialogDefSelector(state),\n\t\titemGroups: currentPaletteElementList(state),\n\t\tdialogData: state.getIn(['dialogData', dialogDef.get('name')]) || Immutable.Map()\n\t};\n}\n\nconst ConnectDialog = connect(mapStateToProps)(Dialog);\n\nexport default ConnectDialog;\n"
  },
  {
    "path": "Website/Composite/console/components/container/ConnectDockPanel.js",
    "content": "import { connect } from 'react-redux';\nimport { currentPageSelector } from 'console/state/selectors/pageSelector.js';\nimport SwitchPanel from 'console/components/presentation/SwitchPanel.js';\nimport ConnectToolbarFrame from 'console/components/container/ConnectToolbarFrame.js';\nimport ConnectDialog from 'console/components/container/ConnectDialog.js';\nimport Spritesheet from 'console/components/presentation/Spritesheet.js';\nimport ConnectSearchPage from 'console/components/container/ConnectSearchPage.js';\nimport Immutable from 'immutable';\n\nlet panelTypes = {\n\tdocument: ConnectToolbarFrame,\n\tspritesheet: Spritesheet,\n\tdialogPageShim: ConnectDialog,\n\tsearch: ConnectSearchPage\n};\n\nfunction mapStateToProps(state) {\n\treturn {\n\t\tpageDef: currentPageSelector(state),\n\t\tshowType: (currentPageSelector(state) || Immutable.Map()).get('type'),\n\t\tpanelTypes\n\t};\n}\n\nconst ConnectDockPanel = connect(mapStateToProps)(SwitchPanel);\n\nexport default ConnectDockPanel;\n"
  },
  {
    "path": "Website/Composite/console/components/container/ConnectFormPanel.js",
    "content": "import { connect } from 'react-redux';\nimport FormTab from 'console/components/presentation/FormTab.js';\nimport { updateFieldValue } from 'console/state/reducers/dataFields.js';\nimport { formSelector } from 'console/state/selectors/formSelector.js';\n\nfunction mapStateToProps(state) {\n\tlet props = formSelector(state);\n\treturn props ? props.toObject() : {};\n}\n\nfunction mapDispatchToProps(dispatch) {\n\treturn {\n\t\tactions: {\n\t\t\tupdateValue: (pageName, fieldName) => value => dispatch(updateFieldValue(pageName, fieldName, value))\n\t\t}\n\t};\n}\n\nconst ConnectFormPanel = connect(mapStateToProps, mapDispatchToProps)(FormTab);\n\nexport default ConnectFormPanel;\n"
  },
  {
    "path": "Website/Composite/console/components/container/ConnectLogPanel.js",
    "content": "import React from 'react';\nimport { connect } from 'react-redux';\nimport { tabSelector } from 'console/state/selectors/tabSelector.js';\nimport { logSelector } from 'console/state/selectors/logSelector.js';\nimport Dimensions from 'react-dimensions';\nimport LogPanel from 'console/components/presentation/LogPanel.js';\nimport ScrollBox from 'console/components/presentation/ScrollBox.js';\nimport styled from 'styled-components';\n\nfunction mapStateToProps(state) {\n\treturn {\n\t\tplaceholder: () => tabSelector(state).get('placeholder') || 'No data',\n\t\tlogPage: logSelector(state).toJS()\n\t};\n}\n\nexport const CLP = connect(mapStateToProps)(LogPanel);\n\nconst SizedCLP = Dimensions({\n\tcontainerStyle: {\n\t\theight: '100%',\n\t\twidth: '100%'\n\t},\n\telementResize: true\n})(CLP);\n\nconst CleanScrollBox = styled(ScrollBox)`\n\tpadding: 0;\n\tborder-top: 0 !important;\n\toverflow: hidden;\n`;\n\nconst ConnectLogPanel = props => <CleanScrollBox>\n\t<SizedCLP {...props}/>\n</CleanScrollBox>;\n\nexport default ConnectLogPanel;\n"
  },
  {
    "path": "Website/Composite/console/components/container/ConnectSearchPage.js",
    "content": "import { connect } from 'react-redux';\nimport { setOption } from 'console/state/reducers/options.js';\nimport { getProviderPage } from 'console/state/actions/fetchFromProvider.js';\nimport { searchQuerySelector, facetSelector, columnSelector, rowSelector } from 'console/state/selectors/searchSelector.js';\nimport { currentPageNameSelector } from 'console/state/selectors/layoutSelector.js';\nimport SearchPage from 'console/components/presentation/SearchPage.js';\nimport Immutable from 'immutable';\n\nfunction mapStateToProps(state) {\n\t// Get facets, search results\n\treturn {\n\t\tfacetGroups: facetSelector(state),\n\t\tresultColumns: columnSelector(state),\n\t\tresults: rowSelector(state),\n\t\tsearchQuery: state.getIn(['options', 'values', currentPageNameSelector(state)]) || Immutable.fromJS({ text: '', sortInReverseOrder: false }),\n\t\tsearchString: searchQuerySelector(state),\n\t\tsearchActive: !!state.getIn(['activity', 'PROVIDER.GET'])\n\t};\n}\n\nfunction mapDispatchToProps(dispatch) {\n\treturn {\n\t\tactions: {\n\t\t\tperformSearch: (provider, pageName) => values => dispatch(getProviderPage(provider, pageName, values)),\n\t\t\tsetOption: fieldName => value => dispatch(setOption(fieldName, value))\n\t\t}\n\t};\n}\n\nconst ConnectSearchPage = connect(mapStateToProps, mapDispatchToProps)(SearchPage);\n\nexport default ConnectSearchPage;\n"
  },
  {
    "path": "Website/Composite/console/components/container/ConnectTabPanel.js",
    "content": "import { connect } from 'react-redux';\nimport { tabSelector } from 'console/state/selectors/tabSelector.js';\nimport SwitchPanel from 'console/components/presentation/SwitchPanel.js';\nimport ConnectFormPanel from 'console/components/container/ConnectFormPanel.js';\nimport ConnectLogPanel from 'console/components/container/ConnectLogPanel.js';\nimport Immutable from 'immutable';\n\nlet panelTypes = {\n\tform: ConnectFormPanel,\n\tlog: ConnectLogPanel\n};\n\nfunction mapStateToProps(state) {\n\treturn {\n\t\ttabDef: tabSelector(state),\n\t\tshowType: (tabSelector(state) || Immutable.Map()).get('type'),\n\t\tpanelTypes\n\t};\n}\n\nconst ConnectTabPanel = connect(mapStateToProps)(SwitchPanel);\n\nexport default ConnectTabPanel;\n"
  },
  {
    "path": "Website/Composite/console/components/container/ConnectToolbarFrame.js",
    "content": "import { connect } from 'react-redux';\nimport { toolbarSelector } from 'console/state/selectors/toolbarSelector.js';\nimport { currentPageSelector } from 'console/state/selectors/pageSelector.js';\nimport { shownTabNameSelector } from 'console/state/selectors/tabSelector.js';\nimport { currentPageNameSelector } from 'console/state/selectors/layoutSelector.js';\nimport ToolbarFrame from 'console/components/presentation/ToolbarFrame.js';\nimport { saveValues } from 'console/state/actions/values.js';\nimport { updateFieldValue } from 'console/state/reducers/dataFields.js';\nimport { setOption } from 'console/state/reducers/options.js';\nimport { fireAction } from 'console/state/actions/fireAction.js';\nimport { setTab } from 'console/state/reducers/layout.js';\nimport Immutable from 'immutable';\n\n// Sets up a page that allows editing of a document consisting of sets of fields.\nfunction mapStateToProps(state) {\n\tlet props = {\n\t\tpageName: currentPageNameSelector(state),\n\t\tshownTab: shownTabNameSelector(state),\n\t\ttabDefs: currentPageSelector(state).get('tabs').map(tabName => state.getIn(['tabDefs', tabName])),\n\t\ttoolbars: toolbarSelector(state)\n\t};\n\tprops.dirty = !Immutable.is(\n\t\tstate.getIn(['dataFields', 'committedPages', props.pageName]),\n\t\tstate.getIn(['dataFields', props.pageName])\n\t);\n\treturn props;\n}\n\nfunction mapDispatchToProps(dispatch) {\n\treturn {\n\t\tactions: {\n\t\t\tsave: pageName => () => dispatch(saveValues(pageName)),\n\t\t\tsetOption: fieldName => value => dispatch(setOption(fieldName, value)),\n\t\t\tupdateValue: (pageName, fieldName) => value => dispatch(updateFieldValue(pageName, fieldName, value)),\n\t\t\tfireAction: (pageName, actionId) => values => dispatch(fireAction(pageName, actionId, values)),\n\t\t\tsetTab: tabName => () => dispatch(setTab(tabName))\n\t\t}\n\t};\n}\n\nconst ConnectToolbarFrame = connect(mapStateToProps, mapDispatchToProps)(ToolbarFrame);\n\nexport default ConnectToolbarFrame;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/ActionButton.js",
    "content": "import React, { PropTypes } from 'react';\nimport Icon from 'console/components/presentation/Icon.js';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst Button = styled.button`\n\ttext-transform: uppercase;\n\tborder: 1px solid ${colors.borderColor};\n\tborder-radius: 4px;\n\tbackground: white;\n\tcolor: ${colors.buttonTextColor};\n\tmargin: 2px 10px 2px 0;\n\tpadding: 6px 11px;\n\tline-height: 18px;\n\theight: 36px;\n\tmin-width: 100px;\n\tbox-shadow: 0 2px 2px -2px ${colors.buttonDropShadowColor};\n\ttext-align: left;\n\n\t&:hover {\n\t\tcolor: ${colors.buttonHighlightColor};\n\t\tborder-color: ${colors.buttonHighlightColor};\n\t}\n\n\t&:disabled {\n\t\topacity: 0.4;\n\t}\n\n\t&.main {\n\t\tborder: 1px solid ${colors.buttonHighlightColor};\n\t\tbackground-image: linear-gradient(to bottom, ${colors.buttonHighlightColor} 0%, ${colors.buttonShadingColor} 100%);\n\t\tcolor: white;\n\t\tpadding-top: 4px;\n\t\tpadding-bottom: 4px;\n\t}\n\n\t&.dialog {\n\t\tcolor: ${colors.buttonHighlightColor};\n\t\tborder-color: ${colors.buttonHighlightColor};\n\t}\n`;\n\nconst Label = styled.span`\n\tdisplay: inline-block;\n\ttext-align: center;\n\twidth: 100%;\n\n\tsvg + & {\n\t\tpadding-left: 10px;\n\t\ttext-align: left;\n\t}\n`;\n\nconst ActionButton = ({ label, action, icon, disabled, style }) => (\n\t<Button onClick={() => action()} disabled={disabled} className={style}>\n\t\t{icon ? <Icon id={icon}/> : null}\n\t\t{label ? <Label>{label}</Label> : null }\n\t</Button>\n);\n\n\nActionButton.propTypes = {\n\tlabel: PropTypes.string,\n\tstyle: PropTypes.string,\n\taction: PropTypes.func.isRequired,\n\ticon: PropTypes.string,\n\tdisabled: PropTypes.bool\n};\n\nexport default ActionButton;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Checkbox.js",
    "content": "import React, { PropTypes } from 'react';\nimport styled, { css } from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst Wrapper = styled.div`\n\tdisplay: inline-block;\n\tposition: relative;\n\tvertical-align: middle;\n\tmargin: 2px 1px 7px 2px;\n\twidth: 18px;\n\theight: 18px;\n`;\n\nconst VisualCheckbox = styled.label`\n\tdisplay: inline-block;\n\tposition: absolute;\n\tvertical-align: middle;\n\tborder: 1px solid #ccc;\n\tborder-radius: 5px;\n\tborder-radius: 4px;\n\twidth: 18px;\n\theight: 18px;\n\tpadding: 0;\n\tmargin: 0;\n\tbackground-color: #fff;\n\n\t${props => props.checked ? css`\n\t\tbackground-color: ${colors.fieldFocusColor};\n\t\t&::after {\n\t\t\tcontent: \"\\u2713\";\n\t\t\tfont-size: 14px;\n\t\t\tfont-weight: bold;\n\t\t\tcolor: white;\n\t\t\tposition: absolute;\n\t\t\ttop: -1px;\n\t\t\tleft: 3px;\n\t\t}\n\t` : ''}\n\n\tinput:focus + & {\n\t\tborder-color: ${colors.fieldFocusColor};\n\t}\n`;\n\nconst HiddenCheckbox = styled.input`\n\tposition: absolute;\n`;\n\nconst Checkbox = props => (\n\t<Wrapper className={props.className}>\n\t\t<HiddenCheckbox type='checkbox' {...props}/>\n\t\t<VisualCheckbox checked={props.checked} htmlFor={props.id}/>\n\t</Wrapper>\n);\n\nCheckbox.propTypes = {\n\tchecked: PropTypes.bool,\n\tid: PropTypes.string.isRequired\n};\n\nexport default Checkbox;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/CheckboxGroup.js",
    "content": "import React, { PropTypes } from 'react';\nimport styled from 'styled-components';\nimport Checkbox from 'console/components/presentation/Checkbox.js';\n\nconst Div = styled.div`\n\tdisplay: inline-block;\n`;\n\nconst Label = styled.label`\n\tdisplay: inline-block;\n\tpadding-left: 5px;\n\tpadding-right: 15px;\n`;\n\nconst CheckboxGroup = props => {\n\tlet getBoxChanger = name => () => {\n\t\tlet value = [].concat(props.value);\n\t\tlet index = props.value.indexOf(name);\n\t\tif (index === -1) {\n\t\t\tvalue.push(name);\n\t\t} else {\n\t\t\tvalue.splice(index, 1);\n\t\t}\n\t\tprops.onChange(value);\n\t};\n\treturn (\n\t\t<Div className='checkboxGroup'>\n\t\t\t{props.options.reduce((elements, cbProps) => {\n\t\t\t\tlet value = (props.value.indexOf(cbProps.value) !== -1) || false;\n\t\t\t\telements.push(<Checkbox\n\t\t\t\t\tkey={cbProps.name}\n\t\t\t\t\tid={cbProps.name}\n\t\t\t\t\ttype='checkbox'\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tchecked={value}\n\t\t\t\t\tonChange={getBoxChanger(cbProps.value)}\n\t\t\t\t\t/>);\n\t\t\t\telements.push(<Label\n\t\t\t\t\tkey={cbProps.name + 'Key'}\n\t\t\t\t\thtmlFor={cbProps.name}>{cbProps.label}</Label>);\n\t\t\t\treturn elements;\n\t\t\t}, [])}\n\t\t</Div>\n\t);\n};\n\nCheckboxGroup.propTypes = {\n\toptions: PropTypes.arrayOf(PropTypes.object).isRequired,\n\tvalue: PropTypes.array.isRequired\n};\n\nexport default CheckboxGroup;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/DataField.js",
    "content": "﻿import React, { PropTypes } from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport DataFieldWrapper from 'console/components/presentation/DataFieldWrapper.js';\nimport DataFieldLabel from 'console/components/presentation/DataFieldLabel.js';\nimport HelpIcon from 'console/components/presentation/HelpIcon.js';\nimport Select from 'console/components/presentation/Select.js';\nimport Input from 'console/components/presentation/Input.js';\nimport TextArea from 'console/components/presentation/TextArea.js';\nimport Checkbox from 'console/components/presentation/Checkbox.js';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst Headline = styled.h4`\n\tdisplay: block;\n\tmargin: 0;\n\tfont-weight: normal;\n\tpadding: 7px 0 5px 5px;\n\tcolor: ${colors.fieldLabelColor};\n`;\n\nconst Error = styled.span`\n\tcolor: red;\n\tfont-size: 12px;\n`;\n\n\nconst DataField = props => {\n\tlet handleChange, defaultOption, inputElement, options;\n\tswitch (props.type) {\n\tcase 'checkbox':\n\t\thandleChange = function (event) {\n\t\t\tprops.updateValue(event.target.checked);\n\t\t};\n\t\tinputElement = <Checkbox\n\t\t\tid={props.name}\n\t\t\tvalue={props.value || false}\n\t\t\tchecked={props.value || false}\n\t\t\tonChange={handleChange}/>;\n\t\tbreak;\n\tcase 'select':\n\t\thandleChange = function (option) {\n\t\t\tprops.updateValue(option.value);\n\t\t};\n\t\toptions = props.options.toJS();\n\t\tdefaultOption = options.filter(option => option.value === props.value)[0];\n\t\tinputElement = <Select\n\t\t\tid={props.name}\n\t\t\tvalue={defaultOption}\n\t\t\tclearable={false}\n\t\t\tmulti={false}\n\t\t\toptions={options}\n\t\t\tonChange={handleChange}\n\t\t\tplaceholder={props.placeholder}>\n\t\t</Select>;\n\t\tbreak;\n\tcase 'textarea':\n\t\tinputElement = <TextArea\n\t\t\t{...props}\n\t\t\twithHelp={props.help ? true : false} />;\n\t\tbreak;\n\tdefault:\n\t\tinputElement = <Input\n\t\t\t{...props}\n\t\t\tonContextMenu={event => {\n\t\t\t\tevent.stopPropagation(); // to ensure default context menu is shown here\n\t\t\t}}\n\t\t\twithHelp={props.help ? true : false}\n\t\t/>;\n\t}\n\n\treturn (\n\t\t<DataFieldWrapper>\n\t\t\t{\n\t\t\t\t// props.headline ?\n\t\t\t\t//\t<Headline>{props.headline}</Headline> :\n\t\t\t\t//\tnull\n\t\t\t}\n\t\t\t\n\t\t\t{props.label ?\n\t\t\t\t<DataFieldLabel htmlFor={props.name}>{props.label}</DataFieldLabel> :\n\t\t\t\tnull}\n\t\t\t{inputElement}\n\t\t\t{props.help ? <HelpIcon text={props.help} /> : null}\n\t\t\t{props.error ? <Error>{props.error}</Error> : null}\n\t\t</DataFieldWrapper>\n\t);\n};\n\nDataField.propTypes = {\n\ttype: PropTypes.string,\n\toptions: ImmutablePropTypes.listOf(ImmutablePropTypes.map),\n\tupdateValue: PropTypes.func,\n\tname: PropTypes.string.isRequired,\n\theadline: PropTypes.string,\n\tlabel: PropTypes.string,\n\thelp: PropTypes.string,\n\tvalue: PropTypes.any,\n\tplaceholder: PropTypes.string\n};\nDataField.defaultProps = {\n\ttype: 'text',\n\tplaceholder: '(No selection)'\n};\nexport default DataField;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/DataFieldLabel.js",
    "content": "﻿import React, { PropTypes } from 'react';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\n\nconst DataFieldLabel = styled.label`\n\tdisplay: inline-block;\n\tmargin: 0;\n\tfont-size: 12px;\n\tpadding: 5px 0 4px 0;\n\tcolor: ${colors.fieldLabelColor};\n\twidth: calc(100% - 56px);\n`;\n\n\n\nexport default DataFieldLabel;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/DataFieldWrapper.js",
    "content": "﻿import React, { PropTypes } from 'react';\nimport styled from 'styled-components';\n\n\nconst DataFieldWrapper = styled.div`\n\tposition: relative;\n\tmargin-bottom: 4px;\n\n\t&::after {\n\t\tdisplay: block;\n\t\tcontent: \"\";\n\t\tclear: both;\n\t }\n`;\n\n\n\nexport default DataFieldWrapper;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Dialog.js",
    "content": "import React, { PropTypes } from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\nimport Palette from 'console/components/presentation/Palette.js';\nimport ActionButton from 'console/components/presentation/ActionButton.js';\nimport Immutable from 'immutable';\nimport { fireAction } from 'console/state/actions/fireAction.js';\nimport { setDialogState } from 'console/state/reducers/dialog.js';\nimport Input from 'console/components/presentation/Input.js';\nimport Icon from 'console/components/presentation/Icon.js';\n\nconst paneTypes = {\n\tpalette: Palette\n};\n\nconst sizes = {\n\tsidePadding: 15,\n\ttitlePaddingTop: 20,\n\ttitleHeight: 16,\n\ttitlePaddingBottom: 18,\n\tpaneBorder: 1,\n\tpanePaddingTop: 15,\n\tpanePaddingBottom: 15,\n\tbuttonsPaddingTop: 12,\n\tbuttonsHeight: 40,\n\tbuttonsPaddingBottom: 14\n};\n\n// TODO: Restyle for use as actual dialogs, add overlays where needed, etc.\nexport const DialogBox = styled.div`\n\tbackground-color: ${colors.fieldsetBackgroundColor};\n\theight: 100%;\n/*\tmax-width: 880px;\n\toverflow: hidden;*/\n`;\nexport const DialogTitle = styled.h1`\n\tmargin: 0;\n\tpadding: ${sizes.titlePaddingTop}px ${sizes.sidePadding}px ${sizes.titlePaddingBottom}px;\n\tfont-size: ${sizes.titleHeight}px;\n\tfont-weight: normal;\n\tfont-family: 'Roboto Condensed', sans-serif;\n\ttext-transform: uppercase;\n\tcolor: ${colors.dialogHeaderColor};\n`;\n\nexport const DialogPane = styled.div`\n\tborder-top: ${sizes.paneBorder}px solid ${colors.borderColor};\n\tborder-bottom: ${sizes.paneBorder}px solid ${colors.borderColor};\n\tpadding: ${sizes.panePaddingTop}px ${sizes.sidePadding}px ${sizes.panePaddingBottom}px;\n\theight: calc(100% - ${\n\t\t(sizes.titlePaddingTop + sizes.titleHeight + sizes.titlePaddingBottom) +\n\t\t(sizes.paneBorder + sizes.panePaddingTop + sizes.panePaddingBottom + sizes.paneBorder) +\n\t\t(sizes.buttonsPaddingTop + sizes.buttonsHeight + sizes.buttonsPaddingBottom)\n\t}px);\n\toverflow-y: auto;\n`;\n\nexport const DialogButtonGroup = styled.div`\n\tpadding: ${sizes.buttonsPaddingTop}px ${sizes.sidePadding}px ${sizes.buttonsPaddingBottom}px;\n\ttext-align: right;\n`;\nexport const SearchField = styled(Input)`\nposition: absolute;\ntop: 10px;\nright: 20px;\nwidth: 200px;\npadding-right: 30px;\n`;\nexport const SearchIcon = styled(Icon)`\nposition: absolute;\ntop: 18px;\nright: 31px;\n`;\n\nconst Dialog = props => {\n\tlet paneDef = props.dialogDef.getIn(['panes', props.dialogData.get('showPane') || 0]) || Immutable.Map();\n\tlet Pane = paneTypes[paneDef.get('type')] || (() => null);\n\tlet cancelButton = paneDef.get('cancelButton') ? paneDef.get('cancelButton').toJS() : null;\n\tlet cancelProvider = paneDef.get('cancelProvider') && paneDef.get('cancelProvider').toJS ? paneDef.get('cancelProvider').toJS() : null;\n\tlet cancelAction = cancelButton ? () => {\n\t\t// Cancel and close dialog\n\t\tif (cancelProvider) {\n\t\t\t// Fire off a call to the provider if one exists, send dialog name.\n\t\t\tprops.dispatch(fireAction(cancelProvider, props.dialogDef.get('name')));\n\t\t}\n\t} : null;\n\tlet nextButton = paneDef.get('nextButton') ? paneDef.get('nextButton').toJS() : null;\n\tlet nextAction = paneDef.get('nextButton') ? () => {\n\t\t// Switch to next pane - set or increment dialogData[showPane]\n\t} : null;\n\tlet finishButton = paneDef.get('finishButton') ? paneDef.get('finishButton').toJS() : null;\n\tlet finishAction = paneDef.get('finishButton') && paneDef.get('finishProvider') && paneDef.get('finishProvider').toJS ? () => {\n\t\t// Complete dialog activity, send back data using provider\n\t\tprops.dispatch(fireAction(paneDef.get('finishProvider').toJS(), props.dialogDef.get('name'), props.dialogData.toJS()));\n\t} : null;\n\tconst searchFunction = event => props.dispatch(\n\t\tsetDialogState(\n\t\t\tprops.dialogDef.get('name'),\n\t\t\tprops.dialogData\n\t\t\t.set('filterText', event.target.value)\n\t\t)\n\t);\n\treturn <DialogBox\n\t\tonContextMenu={event => {\n\t\t\tevent.preventDefault(); // To not show the default menu\n\t\t}}>\n\t\t{paneDef.get('headline') ? <DialogTitle>{paneDef.get('headline')}</DialogTitle> : null}\n\t\t<SearchField\n\t\t\tplaceholder={props.dialogDef.get('searchPlaceholder')}\n\t\t\tvalue={props.dialogData.get('filterText')}\n\t\t\tonChange={searchFunction}\n\t\t\tonInput={searchFunction}/>\n\t\t<SearchIcon id='magnifier'/>\n\t\t<DialogPane>\n\t\t\t<Pane dialogName={props.dialogDef.get('name')} paneDef={paneDef} itemGroups={props.itemGroups} dialogData={props.dialogData} dispatch={props.dispatch} nextAction={nextAction || finishAction}/>\n\t\t</DialogPane>\n\t\t<DialogButtonGroup>\n\t\t\t{ nextButton ? <ActionButton action={nextAction} {...nextButton}/> : null}\n\t\t\t{ finishButton ? <ActionButton action={finishAction} {...finishButton} disabled={!props.dialogData.get('selectedItem')}/> : null}\n\t\t\t{ cancelButton ? <ActionButton action={cancelAction} {...cancelButton}/> : null}\n\t\t</DialogButtonGroup>\n\t</DialogBox>;\n};\n\nDialog.propTypes = {\n\tdialogData: ImmutablePropTypes.mapContains({\n\t\tselectedItem: PropTypes.string\n\t}),\n\tdialogDef: ImmutablePropTypes.mapContains({\n\t\tname: PropTypes.string.isRequired,\n\t\theadline: PropTypes.string,\n\t\tpanes: ImmutablePropTypes.list.isRequired\n\t}).isRequired,\n\tdispatch: PropTypes.func.isRequired,\n\titemGroups: ImmutablePropTypes.list\n};\n\nexport default Dialog;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Fieldset.js",
    "content": "import React, { PropTypes } from 'react';\nimport DataField from 'console/components/presentation/DataField.js';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst FieldsetStyle = styled.fieldset`\n\tfloat: left;\n\tposition: relative;\n\tborder: 1px solid ${colors.borderColor};\n\tborder-radius: 4px;\n\tmargin: 35px 23px 20px 0;\n\tpadding: 8px 17px 25px;\n\twidth: 394px;\n\tbackground-color: ${colors.fieldsetBackgroundColor};\n`;\nconst Legend = styled.legend`\n\tposition: absolute;\n\ttop: -36px;\n\tleft: -1px;\n\tpadding: 0;\n\tbackground: transparent;\n\tcolor: ${colors.fieldsetLegendColor};\n\tfont-family: 'Roboto Condensed', sans-serif;\n\tfont-style: italic;\n\tfont-size: 14px;\n\ttext-transform: uppercase;\n`;\n\nconst Fieldset = ({ label, fields }) => (\n\t<FieldsetStyle>\n\t\t{label ? <Legend>{label}</Legend> : null}\n\t\t{\n\t\t\tfields.map(field => (\n\t\t\t\t<DataField key={field.get('name')} name={field.get('name')} {...field.toObject()}/>\n\t\t\t)).toArray()\n\t\t}\n\t</FieldsetStyle>\n);\n\nFieldset.propTypes = {\n\tlabel: PropTypes.string,\n\tfields: ImmutablePropTypes.listOf(ImmutablePropTypes.map).isRequired\n};\n\nexport default Fieldset;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/FormTab.js",
    "content": "import React, { PropTypes } from 'react';\nimport Fieldset from 'console/components/presentation/Fieldset.js';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ScrollBox from 'console/components/presentation/ScrollBox.js';\n\nconst FormTab = props => {\n\tif (!props.fieldsets) return null;\n\tlet fieldsets = props.fieldsets.toArray().map(fieldset => {\n\t\tlet fsProps = fieldset.toObject();\n\t\tfsProps.fields = fsProps.fields.map(field =>\n\t\t\tfield.set('updateValue', props.actions.updateValue(props.pageName, field.get('name')))\n\t\t);\n\t\treturn (\n\t\t\t<Fieldset\n\t\t\t\t{...fsProps}\n\t\t\t\tkey={fsProps.name}/>\n\t\t);\n\t});\n\treturn (\n\t\t<ScrollBox>\n\t\t\t{fieldsets}\n\t\t</ScrollBox>\n\t);\n};\n\nFormTab.propTypes = {\n\tname: PropTypes.string,\n\tpageName: PropTypes.string,\n\tactions: PropTypes.objectOf(PropTypes.func).isRequired,\n\tfieldsets: ImmutablePropTypes.listOf(ImmutablePropTypes.map)\n};\n\nexport default FormTab;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/HelpIcon.js",
    "content": "﻿import React, { PropTypes } from 'react';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst Span = styled.span`\n\tposition: absolute;\n\tright: -8px;\n\ttop: 20px;\n\n\t&::after {\n\t\tcontent: \"?\";\n\t\twidth: 16px;\n\t\theight: 16px;\n\t\tcolor: white;\n\t\tposition: absolute;\n\t\ttop: 6px;\n\t\tright: 2px;\n\t\tbackground: ${colors.helpIconColor};\n\t\tborder-radius: 8px;\n\t\tfont-size: 11px;\n\t\ttext-align: center;\n\t\tline-height: 16px;\n\t\tfont-weight: normal;\n\t\tfont-family: Verdana;\n\t}\n`;\n\n// TODO: Get this working again. Set a prop to control visibility?\nconst Helper = styled.div`\n\tposition: absolute;\n\tz-index: 100;\n\ttop: 2px;\n\tleft: calc(100% - 2px);\n\twidth: max-content;\n\tmax-width: 200px;\n\tbackground-color: #fff;\n\tbox-shadow: 0px 0px 12px -1px rgba(204, 204, 204, 0.75);\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tpadding: 10px 12px;\n\tfont-size: 12px;\n\tline-height: 15px;\n\tvisibility: hidden;\n\topacity: 0;\n\ttransition: opacity 0.2s, visibility 0.2s\n`;\n\nconst HelpIcon = ({text}) => {\n\tlet helper;\n\n\tfunction showHelper() {\n\t\thelper.style.visibility = 'visible';\n\t\thelper.style.opacity = 1;\n\t}\n\n\tfunction hideHelper() {\n\t\tlet savedHelper = helper;\n\t\tsetTimeout(() => {\n\t\t\tsavedHelper.style.visibility = 'hidden';\n\t\t\tsavedHelper.style.opacity = 0;\n\t\t}, 2000);\n\t}\n\n\treturn (\n\t\t<Span\n\t\t\tonClick={showHelper}\n\t\t\tonMouseOut={hideHelper}>\n\t\t\t<Helper\n\t\t\t\tinnerRef={comp => { helper = comp; }}\n\t\t\t\tstyle={{visibility: 'hidden', opacity: 0}}\n\t\t\t\tclassName=\"helper\">\n\t\t\t\t{text}\n\t\t\t</Helper>\n\t\t</Span>\n\t);\n};\n\nHelpIcon.propTypes = {\n\ttext: PropTypes.string.isRequired\n};\n\nexport default HelpIcon;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Icon.js",
    "content": "import React, { PropTypes } from 'react';\nimport styled from 'styled-components';\n\nconst Svg = styled.svg`\n\theight: 20px;\n\twidth: 20px;\n\tstroke: currentColor;\n\tfill: currentColor;\n\n\tbutton & {\n\t\theight: 18px;\n\t\twidth: 18px;\n\t\tdisplay: inline-block;\n\t\tvertical-align: -4px;\n\t}\n\n\t.iconlist & {\n\t\theight: 24px;\n\t\twidth: 24px;\n\t}\n`;\n\n\nconst Icon = ({ id, ...props }) => {\n\treturn (\n\t\t<Svg {...props}>\n\t\t\t<use xlinkHref={'#icon-' + id}/>\n\t\t</Svg>\n\t);\n};\n\nIcon.propTypes = {\n\tid: PropTypes.string.isRequired,\n\tclassName: PropTypes.string\n};\n\nexport default Icon;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Input.js",
    "content": "﻿import styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst Input = styled.input`\n\tvertical-align: middle;\n\tbox-sizing: border-box;\n\tdisplay: block;\n\tborder: 1px solid ${colors.fieldBorderColor};\n\tborder-radius: 4px;\n\tpadding: 5px 7px;\n\tmargin: 2px 1px 7px 2px;\n\tbackground-color: #fff;\n\theight: 30px;\n\toverflow: hidden;\n\twidth: ${props => !props.withHelp ? '100%' : 'calc(100% - 20px)'};\n\n\t&:focus {\n\t\tborder-color: ${colors.fieldFocusColor};\n\t}\n`;\n\nInput.defaultProps = {\n\tvalue: ''\n};\n\nexport default Input;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/LogPanel.js",
    "content": "import React, {PropTypes } from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport { Table, Column, Cell } from 'fixed-data-table-2';\nimport styled, {injectGlobal } from 'styled-components';\nimport colors from 'console/components/colors.js';\nimport fixedDataTableStylesheet from 'fixed-data-table-2/dist/fixed-data-table.css!text';\n\ninjectGlobal`${fixedDataTableStylesheet}`;\n\nfunction getTextHeight(message) {\n\tlet lineBreaks = message.match(/\\n/g);\n\tlet lineCount = lineBreaks && lineBreaks.length + 1;\n\tif (lineCount) {\n\t\treturn lineCount * 15;\n\t} else {\n\t\treturn 16;\n\t}\n}\n\nconst StyledTable = styled(Table)`\n.public_fixedDataTableCell_cellContent {\n\tpadding: 5px;\n}\n.fixedDataTableCellLayout_wrap3 {\n\tvertical-align: inherit;\n}\n.public_fixedDataTable_header,\n.public_fixedDataTable_header .public_fixedDataTableCell_main {\n\tbackground-color: ${colors.darkBackground};\n\tbackground-image: none;\n\tborder-right-width: 0;\n}\n.Information {\n\tbackground-color: lime;\n}\n.Warning {\n\tbackground-color: orange;\n}\n.Error {\n\tbackground-color: red;\n}\n.Critical {\n\tbackground-color: crimson;\n}\npre {\n\tmargin: 0;\n}\n`;\n\nexport const LogPanel = props => {\n\tlet mainWidth = props.containerWidth;\n\tlet mainHeight = props.containerHeight;\n\tlet getRowHeight = rowIndex =>\n\t\tprops.logPage[rowIndex] &&\n\t\tgetTextHeight(props.logPage[rowIndex].message) + 10;\n\tlet getMessageBlock = message => /\\n/.test(message) ? <pre>{message}</pre> : message;\n\treturn <StyledTable\n\t\theight={mainHeight}\n\t\twidth={mainWidth}\n\t\theaderHeight={26}\n\t\trowsCount={props.logPage.length}\n\t\trowHeight={26}\n\t\trowHeightGetter={getRowHeight}\n\t\t>\n\t\t<Column\n\t\t\twidth={26}\n\t\t\theader={<Cell/>}\n\t\t\tcell={({ rowIndex, ...cellProps }) => <Cell className={props.logPage[rowIndex]['severity']} {...cellProps}></Cell>}\n\t\t\t/>\n\t\t<Column\n\t\t\tflexGrow={3}\n\t\t\twidth={20}\n\t\t\theader={<Cell>{props.tabDef.get('headers').get('timestamp')}</Cell>}\n\t\t\tcell={({ rowIndex, ...cellProps }) => <Cell className='tableCell' {...cellProps}>\n\t\t\t\t{new Date(props.logPage[rowIndex]['timeStamp']).toLocaleString('en-gb')}\n\t\t\t</Cell>}\n\t\t\t/>\n\t\t<Column\n\t\t\tflexGrow={20}\n\t\t\twidth={50}\n\t\t\theader={<Cell>{props.tabDef.get('headers').get('message')}</Cell>}\n\t\t\tcell={\n\t\t\t\t({ rowIndex, ...cellProps }) =>\n\t\t\t\t<Cell className='tableCell' {...cellProps}>\n\t\t\t\t\t{getMessageBlock(props.logPage[rowIndex].message)}\n\t\t\t\t</Cell>\n\t\t\t}\n\t\t\t/>\n\t\t<Column\n\t\t\tflexGrow={5}\n\t\t\twidth={20}\n\t\t\theader={<Cell>{props.tabDef.get('headers').get('title')}</Cell>}\n\t\t\tcell={({ rowIndex, ...cellProps }) => <Cell className='tableCell' {...cellProps}>{props.logPage[rowIndex]['title']}</Cell>}\n\t\t\t/>\n\t\t<Column\n\t\t\tflexGrow={2}\n\t\t\twidth={10}\n\t\t\theader={<Cell>{props.tabDef.get('headers').get('severity')}</Cell>}\n\t\t\tcell={({ rowIndex, ...cellProps }) => <Cell className='tableCell' {...cellProps}>{props.logPage[rowIndex]['severity']}</Cell>}\n\t\t\t/>\n\t</StyledTable>;\n};\n\nLogPanel.propTypes = {\n\tcontainerWidth: PropTypes.number.isRequired,\n\tcontainerHeight: PropTypes.number.isRequired,\n\ttabDef: ImmutablePropTypes.map.isRequired,\n\tlogPage: PropTypes.arrayOf(PropTypes.object).isRequired\n};\n\nexport default LogPanel;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Palette.js",
    "content": "﻿import React, { PropTypes } from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport Immutable from 'immutable';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\nimport { setDialogState } from 'console/state/reducers/dialog.js';\nimport Icon from 'console/components/presentation/Icon.js';\n\n// two-dimensional structure: Categories containing components.\n// Category has headline, open state, contains list of components\n// Component has preview image url, label, description\n\nconst itemOpenCloseTime = '200ms';\n\nconst PaletteList = styled.div`\n\tmargin-right: -10px;\n`;\nexport const ItemGroup = styled.div`\n\toverflow: hidden;\n`;\nexport const ItemGroupTop = styled.div`\n\tposition: relative;\n\tdisplay: inline-block;\n\twidth: max-content;\n\tcursor: default;\n`;\nexport const ItemGroupTitle = styled.h2`\n\tcolor: ${colors.dialogHeaderColor};\n\tmargin-top: 0;\n\tfont-family: 'Roboto Condensed', sans-serif;\n\tfont-style: italic;\n\tfont-size: 14px;\n\tfont-weight: normal;\n\ttext-transform: uppercase;\n`;\nexport const ItemGroupSwitch = styled(Icon)`\n\tposition: absolute;\n\tright: -15px;\n\ttop: 3px;\n\theight: 10px;\n\twidth: 10px;\n`;\nexport const ItemGroupCount = styled.div`\n\tposition: absolute;\n\tright: -20px;\n\ttransform: translateX(100%);\n\ttop: 0;\n`;\nexport const Item = styled.div`\n\tfloat: left;\n\twidth: 420px;\n\theight: ${props => props.closed ? 0 : 140}px;\n\tmargin-right: 15px;\n\tmargin-bottom: ${props => props.closed ? 0 : 15}px;\n\tposition: relative;\n\tbackground-color: ${ props => props.active ? colors.darkBackground : 'white' };\n\tborder-radius: 5px;\n\tborder-width: ${props => props.closed ? 0 : 1}px;\n\tborder-color: ${colors.borderColor};\n\tborder-style: ${ props => props.active ? 'solid' : 'dashed' };\n\topacity: ${props => props.closed ? 0 : 1};\n\ttransition:\n\t\topacity ${itemOpenCloseTime},\n\t\theight ${itemOpenCloseTime},\n\t\tborder-width ${itemOpenCloseTime},\n\t\tbackground-color ${itemOpenCloseTime},\n\t\tmargin-bottom ${itemOpenCloseTime};\n`;\nexport const PreviewImage = styled.div`\n\twidth: 100px;\n\theight: 100px;\n\tposition: absolute;\n\tleft: 20px;\n\ttop: 15px;\n\tpadding: 5px;\n\tborder-radius: 5px;\n\tborder: 1px solid ${colors.borderColor};\n\tbackground-color: white;\n\tbackground-image: url('${ props => props.image }');\n\tbackground-position: center center;\n\tbackground-repeat: no-repeat;\n\tbackground-size: cover;\n`;\nexport const PreviewIcon = styled(Icon)`\n\twidth: 100px;\n\theight: 100px;\n\tposition: absolute;\n\tleft: 20px;\n\ttop: 15px;\n\tpadding: 5px;\n\tborder-radius: 5px;\n\tborder: 1px solid ${colors.borderColor};\n\tbackground-color: white;\n`;\nexport const InfoBox = styled.div`\n\tposition: absolute;\n\tleft: 150px;\n\ttop: 15px;\n\twidth: 260px;\n\theight: 112px;\n\toverflow-y: auto;\n`;\nexport const Label = styled.h3`\n\tfont-weight: normal;\n\tcolor: ${colors.fieldLabelColor};\n\tmargin: 0 0 10px;\n`;\nexport const Description = styled.p`\nmargin: 10px 0;\n`;\n\nexport const NoComponentsLabel = styled.div`\n\tcolor: ${colors.fieldLabelColor};\n\tmargin: 150px auto;\n\ttext-align: center;\n\tfont-size: 24px;\n`;\nexport const NoComponentsIcon = styled(Icon)`\n\theight: 60px;\n\twidth: 60px;\n`;\nNoComponentsIcon.defaultProps = { id: 'close'};\n\nfunction resolveMediaURI(uri) {\n\treturn uri;\n}\n\nconst Palette = props => {\n\treturn <PaletteList>\n\t\t{props.itemGroups.size === 0 ?\n\t\t\t<NoComponentsLabel>\n\t\t\t\t<NoComponentsIcon/><br/>\n\t\t\t\t{props.paneDef.get('noItemsText')}\n\t\t\t</NoComponentsLabel> :\n\t\t\tnull}\n\t\t{props.itemGroups.map(itemGroup =>\n\t\t\t<ItemGroup\n\t\t\t\tkey={itemGroup.get('name')}>\n\t\t\t\t<div>\n\t\t\t\t\t<ItemGroupTop\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tlet closed = props.dialogData.get('closed') || Immutable.Map();\n\t\t\t\t\t\t\tclosed = closed.set(itemGroup.get('name'), !closed.get(itemGroup.get('name')));\n\t\t\t\t\t\t\tprops.dispatch(\n\t\t\t\t\t\t\t\tsetDialogState(\n\t\t\t\t\t\t\t\t\tprops.dialogName,\n\t\t\t\t\t\t\t\t\tprops.dialogData\n\t\t\t\t\t\t\t\t\t.set('closed', closed)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}}>\n\t\t\t\t\t\t<ItemGroupSwitch\n\t\t\t\t\t\t\tid={props.dialogData.getIn(['closed', itemGroup.get('name')]) ?\n\t\t\t\t\t\t\t\t'chevron-right' :\n\t\t\t\t\t\t\t\t'chevron-down'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ItemGroupCount>({itemGroup.get('entries').size})</ItemGroupCount>\n\t\t\t\t\t\t<ItemGroupTitle>{itemGroup.get('title')}</ItemGroupTitle>\n\t\t\t\t\t</ItemGroupTop>\n\t\t\t\t</div>\n\t\t\t\t{itemGroup.get('entries').map(item => {\n\t\t\t\t\tlet itemName = item.get('id');\n\t\t\t\t\tconst selectItem = () => props.dispatch(\n\t\t\t\t\t\tsetDialogState(\n\t\t\t\t\t\t\tprops.dialogName,\n\t\t\t\t\t\t\tprops.dialogData\n\t\t\t\t\t\t\t.set('selectedItem', itemName)\n\t\t\t\t\t\t\t.set('selectedComponentDefinition', item.get('componentDefinition'))\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\treturn <Item\n\t\t\t\t\t\tclosed={props.dialogData.getIn(['closed', itemGroup.get('name')])}\n\t\t\t\t\t\tkey={itemName}\n\t\t\t\t\t\tonClick={selectItem}\n\t\t\t\t\t\tonDoubleClick={() => {\n\t\t\t\t\t\t\tselectItem();\n\t\t\t\t\t\t\t(props.nextAction && props.nextAction());\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tactive={itemName === props.dialogData.get('selectedItem')}>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\titem.getIn(['componentImage', 'customImageUri']) ?\n\t\t\t\t\t\t\t<PreviewImage image={resolveMediaURI(item.getIn(['componentImage', 'customImageUri']))}/> :\n\t\t\t\t\t\t\t<PreviewIcon id={item.getIn(['componentImage', 'iconName']) || 'base-function-function'}/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t<InfoBox>\n\t\t\t\t\t\t\t<Label>{item.get('title')}</Label>\n\t\t\t\t\t\t\t<Description>{item.get('description')}</Description>\n\t\t\t\t\t\t</InfoBox>\n\t\t\t\t\t</Item>;\n\t\t\t\t}).toArray()}\n\t\t\t</ItemGroup>\n\t\t).toArray()}\n\t</PaletteList>;\n};\n\nPalette.propTypes = {\n\tdialogName: PropTypes.string.isRequired,\n\tdialogData: ImmutablePropTypes.mapContains({\n\t\tselectedItem: PropTypes.string\n\t}),\n\tpaneDef: ImmutablePropTypes.mapContains({\n\t\tname: PropTypes.string.isRequired,\n\t\theadline: PropTypes.string\n\t}).isRequired,\n\titemGroups: ImmutablePropTypes.listOf(ImmutablePropTypes.mapContains({\n\t\tentries: ImmutablePropTypes.listOf(ImmutablePropTypes.map).isRequired\n\t})).isRequired,\n\tdispatch: PropTypes.func.isRequired,\n\tnextAction: PropTypes.func\n};\n\nexport default Palette;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/ScrollBox.js",
    "content": "import styled, { css } from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst style = css`\n\tdisplay: block;\n\tpadding: 30px 30px 20px 40px;\n\twidth: 100%;\n\tbox-sizing: border-box;\n\toverflow: auto;\n\tposition: relative;\n\theight: 100%;\n\n\t&::after {\n\t\tcontent: '';\n\t\tdisplay: block;\n\t\tclear: both;\n\t}\n\n\t.toolbar + & {\n\t\theight: calc(100% - 71px);\n\t\tborder-top: 1px solid ${colors.borderColor};\n\t}\n\n\t.toolbar + .toolbar + & {\n\t\theight: calc(100% - 136px);\n\t}\n\n\t.toolbar + .tabbar + & {\n\t\theight: calc(100% - 72px);\n\t}\n\n\t.toolbar + .toolbar + .tabbar + & {\n\t\theight: calc(100% - 137px);\n\t}\n`;\n\nexport function scrollboxStyle(comp) {\n\treturn styled(comp)`${style}`;\n}\n\nconst ScrollBox = styled.div`${style}`;\n\nexport default ScrollBox;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/SearchFacets.js",
    "content": "import React, { PropTypes } from 'react';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\nimport Immutable from 'immutable';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport Checkbox from 'console/components/presentation/Checkbox.js';\n\nexport const FacetList = styled.div`\nborder-top: 1px solid ${colors.borderColor};\nheight: calc(100% - 32px);\noverflow-y: auto;\nmargin-right: -15px;\npadding-right: 15px;\nuser-select: none;\n`;\nexport const FacetGroup = styled.div``;\nexport const FacetHeader = styled.h2`\ncolor: ${colors.dialogHeaderColor};\nfont-family: 'Roboto Condensed', sans-serif;\nfont-weight: normal;\nfont-style: italic;\nfont-size: 14px;\ntext-transform: uppercase;\n`;\nexport const Facet = styled.div``;\nexport const FacetSelector = styled(Checkbox)`\nmargin-right: 10px;\n`;\n\nconst SearchFacets = props => {\n\tfunction setFacet(name, value) {\n\t\treturn () => {\n\t\t\tlet searchQuery = props.searchQuery.withMutations(query => {\n\t\t\t\tif (!query.get('selections')) {\n\t\t\t\t\tquery.set('selections', Immutable.List());\n\t\t\t\t}\n\t\t\t\tlet selections = query.get('selections');\n\t\t\t\tlet fieldIndex = selections.findKey(field => field.get('fieldName') === name);\n\t\t\t\tif (typeof fieldIndex !== 'number') {\n\t\t\t\t\tfieldIndex = selections.size;\n\t\t\t\t\tselections = selections.push(Immutable.Map({\n\t\t\t\t\t\tfieldName: name,\n\t\t\t\t\t\tvalues: Immutable.List()\n\t\t\t\t\t}));\n\t\t\t\t\tquery.set('selections', selections);\n\t\t\t\t}\n\t\t\t\tlet checkedFacets = selections.getIn([fieldIndex, 'values']);\n\t\t\t\tlet facetIndex = checkedFacets.findKey(facet => facet === value);\n\t\t\t\tif (typeof facetIndex !== 'number') {\n\t\t\t\t\tquery.setIn(['selections', fieldIndex, 'values'], checkedFacets.push(value));\n\t\t\t\t} else {\n\t\t\t\t\tquery.deleteIn(['selections', fieldIndex, 'values', facetIndex]);\n\t\t\t\t}\n\t\t\t});\n\t\t\tprops.updateQuery(searchQuery);\n\t\t};\n\t}\n\treturn <FacetList>\n\t\t{props.facetGroups.map(group => <FacetGroup key={group.get('fieldName')}>\n\t\t\t<FacetHeader>{group.get('label')}</FacetHeader>\n\t\t\t{group.get('facets').map(facet => <Facet key={facet.get('value')}>\n\t\t\t\t<FacetSelector\n\t\t\t\t\tid={group.get('fieldName') + '_' +  facet.get('value')}\n\t\t\t\t\tchecked={!!facet.get('checked')}\n\t\t\t\t\tonClick={setFacet(group.get('fieldName'), facet.get('value'))}\n\t\t\t\t\tonChange={() => {}/* To calm warnings about onChange missing */}\n\t\t\t\t/>\n\t\t\t\t<label htmlFor={group.get('fieldName') + '_' +  facet.get('value')}>\n\t\t\t\t\t{facet.get('label').slice(0, 30) + (facet.get('label').length > 30 ? '\\u2026 ' : ' ')}\n\t\t\t\t\t[{facet.get('hitCount')}]\n\t\t\t\t</label>\n\t\t\t</Facet>).toArray()}\n\t\t</FacetGroup>).toArray()}\n\t</FacetList>;\n};\n\nSearchFacets.propTypes = {\n\tfacetGroups: ImmutablePropTypes.listOf(ImmutablePropTypes.mapContains({\n\t\tfacets: ImmutablePropTypes.listOf(ImmutablePropTypes.map)\n\t})),\n\tsearchQuery: ImmutablePropTypes.mapContains({\n\t\tselections: ImmutablePropTypes.listOf(ImmutablePropTypes.mapContains({\n\t\t\tfieldName: PropTypes.string.isRequired,\n\t\t\tvalues: ImmutablePropTypes.listOf(PropTypes.string).isRequired\n\t\t}))\n\t}).isRequired,\n\tupdateQuery: PropTypes.func.isRequired\n};\n\nexport default SearchFacets;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/SearchPage.js",
    "content": "import React, { PropTypes } from 'react';\nimport styled, { css, keyframes } from 'styled-components';\nimport colors from 'console/components/colors.js';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport Immutable from 'immutable';\nimport Input from 'console/components/presentation/Input.js';\nimport Icon from 'console/components/presentation/Icon.js';\nimport SearchResults from 'console/components/presentation/SearchResults.js';\nimport SearchFacets from 'console/components/presentation/SearchFacets.js';\n\nconst rotate360 = keyframes`\n  from {\n    transform: rotate(0deg);\n  }\n\n  to {\n    transform: rotate(-360deg);\n  }\n`;\n\nexport const SearchContainer = styled.div`\nwidth: 100%;\nheight: 100%;\nposition: relative;\n`;\nexport const SearchSidebar = styled.div`\nbox-sizing: border-box;\nposition: absolute;\ntop: 0;\nleft: 0;\nwidth: 290px;\nheight: 100%;\npadding: 15px;\nbackground-color: ${colors.darkBackground};\n`;\nexport const SearchField = styled(Input)`\npadding-right: 30px;\n`;\nexport const SearchIcon = styled(Icon)`\nposition: absolute;\ntop: 23px;\nright: 31px;\ntransform-origin: 9.25px 9.75px;\n\n${props => props.id === 'magnifier' ?\n\tcss`&:hover {\n\t\tfill: ${colors.buttonHighlightColor};\n\t}` :\n\tcss`animation: ${rotate360} 2s linear infinite;`\n}\n`;\nexport const SearchResultPane = styled.div`\nbox-sizing: border-box;\nposition: absolute;\ntop: 0;\nright: 0;\nwidth: calc(100% - 290px);\nheight: 100%;\n`;\nexport const ResultHeader = styled.h1`\nfont-family: 'Roboto Condensed', sans-serif;\nfont-weight: normal;\nfont-size: 18px;\ntext-transform: uppercase;\nmargin: 18px 15px 16px;\n`;\n\nfunction interpolateString(str, ...params) {\n\treturn str.replace(/\\{(\\d+)\\}/g, (match, num) => params[parseInt(num, 10)]);\n}\n\nconst SearchPage = props => {\n\tlet searchQueryUpdater = props.actions.setOption(props.pageDef.get('name'));\n\tlet searchChangeHandler = event => {\n\t\tsearchQueryUpdater(props.searchQuery.set('text', event.target.value));\n\t};\n\tlet fireSearch = props.actions.performSearch(\n\t\t(props.pageDef.getIn(['providers', props.pageDef.get('searchProvider')]) || Immutable.Map()).toJS(),\n\t\tprops.pageDef.get('name')\n\t);\n\tlet searchAction = () => {\n\t\tlet searchQuery = props.searchQuery.toJS();\n\t\tfireSearch(searchQuery);\n\t};\n\treturn <SearchContainer>\n\t\t<SearchSidebar>\n\t\t\t<SearchField\n\t\t\t\tplaceholder={props.pageDef.get('placeholder')}\n\t\t\t\tvalue={props.searchQuery.get('text')}\n\t\t\t\tonChange={searchChangeHandler}\n\t\t\t\tonInput={searchChangeHandler}\n\t\t\t\tonKeyPress={event => {\n\t\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\t\tsearchAction();\n\t\t\t\t\t}\n\t\t\t\t}}/>\n\t\t\t<SearchIcon id={props.searchActive ? 'refresh' : 'magnifier'} onClick={searchAction}/>\n\t\t\t<SearchFacets\n\t\t\t\tfacetGroups={props.facetGroups}\n\t\t\t\tsearchQuery={props.searchQuery}\n\t\t\t\tupdateQuery={searchQueryUpdater}\n\t\t\t/>\n\t\t</SearchSidebar>\n\t\t<SearchResultPane>\n\t\t\t{!props.searchString && !props.results.size ? null :\n\t\t\t\tprops.results.size ?\n\t\t\t\t\t(props.results.size > 1 ?\n\t\t\t\t\t\t<ResultHeader>{interpolateString(props.pageDef.get('multipleResultsFound'), props.searchString, props.results.size)}</ResultHeader> :\n\t\t\t\t\t\t<ResultHeader>{interpolateString(props.pageDef.get('singleResultFound'), props.searchString)}</ResultHeader>\n\t\t\t\t\t) :\n\t\t\t\t\t<ResultHeader>{interpolateString(props.pageDef.get('noResultsFound'), props.searchString)}</ResultHeader>\n\t\t\t}\n\t\t\t<SearchResults\n\t\t\t\tsearchQuery={props.searchQuery}\n\t\t\t\tupdateQuery={searchQueryUpdater}\n\t\t\t\tperformSearch={fireSearch}\n\t\t\t\tresultColumns={props.resultColumns}\n\t\t\t\tresults={props.results}\n\t\t\t\turlColumn={props.pageDef.get('urlColumn')}\n\t\t\t/>\n\t\t</SearchResultPane>\n\t</SearchContainer>;\n};\n\nSearchPage.propTypes = {\n\tpageDef: ImmutablePropTypes.map,\n\tfacetGroups: ImmutablePropTypes.list,\n\tresults: ImmutablePropTypes.list,\n\tresultColumns: ImmutablePropTypes.list.isRequired,\n\tsearchQuery: ImmutablePropTypes.mapContains({\n\t\ttext: PropTypes.string.isRequired,\n\t\tsortBy: PropTypes.string,\n\t\tsortInReverseOrder: PropTypes.bool.isRequired,\n\t\tselections: ImmutablePropTypes.listOf(ImmutablePropTypes.mapContains({\n\t\t\tfieldName: PropTypes.string.isRequired,\n\t\t\tvalues: ImmutablePropTypes.listOf(PropTypes.string).isRequired\n\t\t}))\n\t}).isRequired,\n\tsearchString: PropTypes.string,\n\tactions: PropTypes.shape({\n\t\tperformSearch: PropTypes.func.isRequired,\n\t\tsetOption: PropTypes.func.isRequired\n\t}).isRequired,\n\tsearchActive: PropTypes.bool\n};\n\nexport default SearchPage;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/SearchResults.js",
    "content": "import React, { PropTypes } from 'react';\nimport styled, { css } from 'styled-components';\nimport colors from 'console/components/colors.js';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport Icon from 'console/components/presentation/Icon.js';\nimport { handleLinkClick } from 'console/access/utils.js';\n\nexport const ResultTable = styled.table`\nwidth: 100%;\nheight: calc(100% - 56px);\ndisplay: block;\nborder-collapse: collapse;\n`;\nexport const ResultTableHead = styled.thead`\ndisplay: block;\nuser-select: none;\npadding-right: 13px;\nborder-top: 1px solid ${colors.borderColor};\nbackground-color: ${colors.darkBackground};\n`;\nexport const ResultTableBody = styled.tbody`\ndisplay: block;\nheight: calc(100% - 38px);\noverflow-y: scroll;\n`;\nexport const ResultTableRow = styled.tr`\ndisplay: table;\ntable-layout: fixed;\nwidth: 100%;\nborder-bottom: 1px solid ${colors.borderColor};\n\n&:empty {\n\tborder-bottom: 0 none transparent;\n}\n`;\nexport const SortIcon = styled(Icon)`\nwidth: 10px;\nheight: 10px;\nmargin-left: 4px;\n`;\n\nconst cellStyle = css`\nheight: 26px;\npadding: 5px;\n&:first-child {\n\tpadding-left: 15px;\n}\n&:last-child {\n\tpadding-right: 15px;\n}\n`;\nexport const ResultTableHeadCell = styled.th`\n${cellStyle}\ntext-align: left;\nfont-weight: normal;\ncursor: default;\n${props => props.sortable ?\n\t\tcss`\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\ttext-decoration: underline;\n\t\t}` :\n\t\t''\n\t}\n&:first-child {\n\tborder-left: 1px solid ${colors.borderColor};\n}\n`;\nexport const ResultTableBodyCell = styled.td`\n${cellStyle}\nwhite-space: nowrap;\ntext-overflow: ellipsis;\noverflow: hidden;\n`;\nexport const ResultLink = styled.a`\ncolor: #333;\n`;\n\nconst SearchResults = props => {\n\treturn <ResultTable>\n\t\t<ResultTableHead>\n\t\t\t<ResultTableRow>\n\t\t\t\t{props.resultColumns.map(col => {\n\t\t\t\t\tlet sort = col.get('sortable') ?\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tlet searchQuery = props.searchQuery;\n\t\t\t\t\t\t\tif (searchQuery.get('sortBy') === col.get('fieldName')) {\n\t\t\t\t\t\t\t\tsearchQuery = searchQuery.set('sortInReverseOrder', !searchQuery.get('sortInReverseOrder'));\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsearchQuery = searchQuery.set('sortBy', col.get('fieldName')).set('sortInReverseOrder', false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tprops.updateQuery(searchQuery);\n\t\t\t\t\t\t\tprops.performSearch(searchQuery);\n\t\t\t\t\t\t} :\n\t\t\t\t\t\t() => { };\n\t\t\t\t\treturn <ResultTableHeadCell key={col.get('fieldName')} onClick={sort} sortable={col.get('sortable')}>\n\t\t\t\t\t\t{col.get('label')}\n\t\t\t\t\t\t{props.searchQuery.get('sortBy') === col.get('fieldName') ?\n\t\t\t\t\t\t\t<SortIcon id={props.searchQuery.get('sortInReverseOrder') ? 'chevron-up' : 'chevron-down'} /> :\n\t\t\t\t\t\t\tnull}\n\t\t\t\t\t</ResultTableHeadCell>;\n\t\t\t\t}).toArray()}\n\t\t\t</ResultTableRow>\n\t\t</ResultTableHead>\n\t\t<ResultTableBody>\n\t\t\t{props.results.map(row =>\n\t\t\t\t<ResultTableRow key={row.hashCode()}>\n\t\t\t\t\t{props.resultColumns.map(col => <ResultTableBodyCell key={col.get('fieldName')}>\n\t\t\t\t\t\t{col.get('fieldName') === props.urlColumn ?\n\t\t\t\t\t\t\t<ResultLink href={row.get('url')} target=\"_top\" onClick={handleLinkClick}>{row.getIn(['values', col.get('fieldName')])}</ResultLink> :\n\t\t\t\t\t\t\trow.getIn(['values', col.get('fieldName')])\n\t\t\t\t\t\t}\n\t\t\t\t\t</ResultTableBodyCell>).toArray()}\n\t\t\t\t</ResultTableRow>\n\t\t\t).toArray()}\n\t\t</ResultTableBody>\n\t</ResultTable>;\n};\n\nSearchResults.propTypes = {\n\tresults: ImmutablePropTypes.listOf(ImmutablePropTypes.map),\n\tresultColumns: ImmutablePropTypes.listOf(ImmutablePropTypes.mapContains({\n\t\tfieldName: PropTypes.string.isRequired\n\t})).isRequired,\n\tsearchQuery: ImmutablePropTypes.mapContains({\n\t\tsortBy: PropTypes.string,\n\t\tsortInReverseOrder: PropTypes.bool.isRequired\n\t}).isRequired,\n\tupdateQuery: PropTypes.func.isRequired,\n\tperformSearch: PropTypes.func.isRequired,\n\turlColumn: PropTypes.string\n};\n\nexport default SearchResults;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Select.js",
    "content": "import ReactSelect from 'react-select';\nimport styled, {injectGlobal } from 'styled-components';\nimport colors from 'console/components/colors.js';\nimport selectStylesheet from 'react-select/dist/react-select.css!text';\n\ninjectGlobal`${selectStylesheet}`;\n\n// This stylesheet is as complex as it is to override the built-in theme of react-select.\nconst Select = styled(ReactSelect)`\n\tvertical-align: middle;\n\tdisplay: inline-block;\n\twidth: calc(100% - 34px);\n\tmargin: 2px 1px 4px 2px;\n\n\t.Select-placeholder {\n\t\tline-height: 30px;\n\t}\n\n\t.Select-input {\n\t\theight: 30px;\n\t}\n\t.Select-input input {\n\t\tborder: 0 none transparent;\n\t\tmargin: 0;\n\t\tpadding: 5px 0 9px;\n\t}\n\n\t.Select-control {\n\t\tborder: 1px solid #ccc;\n\t\tborder-radius: 5px;\n\t\theight: 20px;\n\t}\n\t.Select-control .Select-value {\n\t\tline-height: 30px;\n\t\tcolor: ${colors.baseFontColor};\n\t}\n\t&.is-focused .Select-control,\n\t&.is-focused:not(.is-open) .Select-control {\n\t\tborder-color: ${colors.fieldFocusColor};\n\t\tbox-shadow: none;\n\t}\n\n\t.Select-arrow {\n\t\tborder: 0 none transparent;\n\t}\n\t.Select-arrow:before, .Select-arrow:after {\n\t\tcontent: \"\";\n\t\tposition: absolute;\n\t\twidth: 0;\n\t\theight: 0;\n\t\tborder-style: solid;\n\t}\n\t.Select-arrow:after {\n\t\ttop: 14px;\n\t\tright: 11px;\n\t\tborder-width: 4px 4px 0 4px;\n\t\tborder-color: white transparent transparent transparent;\n\t}\n\t.Select-arrow:before {\n\t\ttop: 14px;\n\t\tright: 10px;\n\t\tborder-width: 5px 5px 0 5px;\n\t\tborder-color: ${colors.fieldFocusColor} transparent transparent transparent;\n\t}\n\t&.is-open .Select-arrow:after {\n\t\ttop: 15px;\n\t\tborder-width: 0px 4px 4px 4px;\n\t\tborder-color: transparent transparent white transparent;\n\t}\n\t&.is-open .Select-arrow:before {\n\t\ttop: 14px;\n\t\tborder-width: 0px 5px 5px 5px;\n\t\tborder-color: transparent transparent ${colors.buttonShadingColor} transparent;\n\t}\n\n\t.Select-menu-outer {\n\t\tposition: absolute;\n\t\tborder: 1px solid ${colors.borderColor};\n\t\tborder-radius: 5px;\n\t\tmargin: 1px 1px 7px 0;\n\t\tbackground-color: white;\n\t\twidth: calc(100% - 0px);\n\t\toverflow: hidden;\n\t\tz-index: 10;\n\t}\n\t.Select-menu-outer .Select-option {\n\t\tpadding: 7px 8px;\n\t}\n\t.Select-menu-outer .Select-option.is-focused {\n\t\tcolor: inherit;\n\t\tbackground-color: inherit;\n\t}\n\t.Select-menu-outer .Select-option:hover {\n\t\tbackground-color: ${colors.fieldFocusColor};\n\t\tcolor: white;\n\t}\n\n\t.Select-menu-outer .Select-option .is-selected {\n\t\tbackground-color: inherit;\n\t}\n\n\t.toolbar & {\n\t\twidth: 150px;\n\t\tmargin: 2px 10px 2px 0;\n\t\tvertical-align: -15px;\n\t}\n\n\t.toolbar & .Select-input {\n\t\tline-height: 34px;\n\t\theight: 34px;\n\t}\n\t.toolbar & .Select-placeholder {\n\t\tline-height: 34px;\n\t}\n\t.toolbar & .Select-control {\n\t\tborder-radius: 4px;\n\t}\n\t.toolbar & .Select-arrow:after {\n\t\ttop: 15px;\n\t}\n\t.toolbar & .Select-arrow:before {\n\t\ttop: 15px;\n\t}\n\t.toolbar &.is-open .Select-arrow:after {\n\t\ttop: 16px;\n\t}\n\t.toolbar &.is-open .Select-arrow:before {\n\t\ttop: 15px;\n\t}\n\n\t.toolbar + .toolbar .Select {\n\t\tvertical-align: -12px;\n\t}\n\t.toolbar + .toolbar .Select-input {\n\t\theight: 28px;\n\t}\n\t.toolbar + .toolbar .Select-arrow:after {\n\t\ttop: 13px;\n\t}\n\t.toolbar + .toolbar .Select-arrow:before {\n\t\ttop: 13px;\n\t}\n\t.toolbar + .toolbar &.is-open .Select-arrow:after {\n\t\ttop: 14px;\n\t}\n\t.toolbar + .toolbar &.is-open .Select-arrow:before {\n\t\ttop: 13px;\n\t}\n`;\n\nexport default Select;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Spritesheet.js",
    "content": "import React, { PropTypes } from 'react';\nimport Icon from 'console/components/presentation/Icon.js';\nimport ScrollBox from 'console/components/presentation/ScrollBox.js';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\n\nconst isMime = /mimetype/;\n\nconst IconList = styled.div`\n\t&:after {\n\t\tcontent: '';\n\t\tdisplay: block;\n\t\tclear: both;\n\t}\n`;\n\nconst IconCell = styled.div`\n\tfloat: left;\n\theight: 24px;\n\twidth: 380px;\n\tmargin-bottom: 10px;\n\tcolor: #999;\n`;\n\nconst IconLabel = styled.span`\n\tline-height: 24px;\n\tmargin-left: 15px;\n\tvertical-align: 10px;\n\tcolor: ${colors.baseFontColor};\n`;\n\nconst Spritesheet = () => {\n\tlet { general, reference, mimetype } = Array.from(document.querySelectorAll('svg > symbol'))\n\t\t.reduce((current, symbol) => {\n\t\t\tlet id = symbol.id.substr(5); // Cut off leading 'icon-'\n\t\t\tif (isMime.test(id)) {\n\t\t\t\tcurrent.mimetype.push(id);\n\t\t\t} else {\n\t\t\t\tif (symbol.querySelector('use')) {\n\t\t\t\t\tlet linkID = symbol.querySelector('use').getAttribute('xlink:href').substr(6);\n\t\t\t\t\tcurrent.reference[id] = linkID;\n\t\t\t\t} else {\n\t\t\t\t\tcurrent.general.push(id);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn current;\n\t\t}, { general: [], reference: {}, mimetype: [] });\n\treturn (\n\t\t<ScrollBox>\n\t\t\t<h1>General icons 24*24</h1>\n\t\t\t<IconList className=\"iconlist\">\n\t\t\t\t{general.map(id =>\n\t\t\t\t\t<IconCell key={id}>\n\t\t\t\t\t\t<Icon id={id}/>\n\t\t\t\t\t\t<IconLabel>{id}</IconLabel>\n\t\t\t\t\t</IconCell>\n\t\t\t\t)}\n\t\t\t</IconList>\n\t\t\t<h1>Referenced icons 24*24</h1>\n\t\t\t<IconList className=\"iconlist\">\n\t\t\t\t{Object.keys(reference).map((id) =>\n\t\t\t\t\t<IconCell key={id}>\n\t\t\t\t\t\t<Icon id={id}/>\n\t\t\t\t\t\t<IconLabel>{id} ({reference[id]})</IconLabel>\n\t\t\t\t\t</IconCell>\n\t\t\t\t)}\n\t\t\t</IconList>\n\t\t\t<h1>File format icons 24*24</h1>\n\t\t\t<IconList className=\"iconlist\">\n\t\t\t\t{mimetype.map(id =>\n\t\t\t\t\t<IconCell key={id}>\n\t\t\t\t\t\t<Icon id={id}/>\n\t\t\t\t\t\t<IconLabel>{id}</IconLabel>\n\t\t\t\t\t</IconCell>\n\t\t\t\t)}\n\t\t\t</IconList>\n\t\t</ScrollBox>\n\t);\n};\n\nSpritesheet.propTypes = {\n\tpageDef: PropTypes.object.isRequired\n};\n\nexport default Spritesheet;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/SwitchPanel.js",
    "content": "// Shows page if given name and type, else shows nothing.\nimport React, { PropTypes } from 'react';\n\nconst SwitchPanel = props => {\n\tif (!props.showType) {\n\t\treturn <div/>;\n\t} else {\n\t\tlet Page = props.panelTypes[props.showType];\n\t\tif (!Page) {\n\t\t\tthrow new Error('Could not find panel type \"' + props.showType + '\"');\n\t\t}\n\t\tlet otherProps = Object.assign({}, props);\n\t\tdelete otherProps.showType;\n\t\tdelete otherProps.panelTypes;\n\t\treturn (<Page {...otherProps}/>);\n\t}\n};\n\nSwitchPanel.propTypes = {\n\tshowType: PropTypes.string,\n\tpanelTypes: PropTypes.objectOf(PropTypes.func).isRequired\n};\n\nexport default SwitchPanel;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/TabBar.js",
    "content": "import React, {PropTypes } from 'react';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst TabDiv = styled.div`\n\twidth: 50px;\n\tpadding: 5px 20px 5px 15px;\n\tborder: 1px solid ${colors.borderColor};\n\tborder-radius: 5px 5px 0 0;\n\tposition: absolute;\n\ttop: -27px;\n\tbackground-color: white;\n\tcolor: ${colors.fadedTextColor};\n\ttext-transform: uppercase;\n\tcursor: default;\n\n\t&.active {\n\t\tborder-bottom-color: white;\n\t\tcolor: ${colors.buttonHighlightColor};\n\t\tz-index: 1;\n\t}\n`;\n\nexport const Tab = props => <TabDiv\n\tonClick={props.onClick}\n\tclassName={'tab' + (props.active ? ' active' : '')}\n\tstyle={{ left: 10 + (props.index * 83) + 'px' }}>\n\t\t{props.label}\n\t</TabDiv>;\n\nTab.propTypes = {\n\tlabel: PropTypes.string.isRequired,\n\tindex: PropTypes.number.isRequired,\n\tactive: PropTypes.bool,\n\tonClick: PropTypes.func\n};\n\nconst TabBarDiv = styled.div`\n\tborder-bottom: 1px solid ${colors.borderColor};\n\tposition: relative;\n`;\n\nconst TabBar = props => (\n\t<TabBarDiv className='tabbar'>\n\t\t{props.tabs.map((p, index) => <Tab\n\t\t\tkey={p.name}\n\t\t\tindex={index}\n\t\t\t{...p}/>)}\n\t</TabBarDiv>\n);\n\nTabBar.propTypes = {\n\ttabs: PropTypes.array.isRequired,\n\tonClick: PropTypes.func\n};\n\nexport default TabBar;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/TextArea.js",
    "content": "﻿import styled from 'styled-components';\nimport colors from 'console/components/colors.js';\n\nconst Textarea = styled.textarea`\n\tbox-sizing: border-box;\n\tvertical-align: middle;\n\tdisplay: block;\n\tborder: 1px solid ${colors.fieldBorderColor};\n\tborder-radius: 4px;\n\tpadding: 5px 7px;\n\tmargin: 2px 0 7px 0;\n\tbackground-color: #fff;\n\theight: 90px;\n\toverflow: hidden;\n\twidth: ${props => !props.withHelp ? '100%' : 'calc(100% - 20px)'};\n\n\n\t&:focus {\n\t\tborder-color: ${colors.fieldFocusColor};\n\t}\n`;\n\nTextarea.defaultProps = {\n\tvalue: ''\n};\n\nexport default Textarea;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/Toolbar.js",
    "content": "import React, { PropTypes } from 'react';\nimport styled from 'styled-components';\nimport colors from 'console/components/colors.js';\nimport ActionButton from 'console/components/presentation/ActionButton.js';\nimport CheckboxGroup from 'console/components/presentation/CheckboxGroup.js';\nimport Select from 'console/components/presentation/Select.js';\n\nconst Div = styled.div`\n\tpadding: 15px 10px 20px;\n\n\t&.rightAligned {\n\t\ttext-align: right; // TODO: Needs better way\n\t}\n\t&.rightAligned > * {\n\t\ttext-align: left;\n\t}\n\t&.rightAligned > button,\n\t&.rightAligned > .Select {\n\t\tmargin-left: 10px;\n\t\tmargin-right: 0;\n\t}\n\t&.dark {\n\t\tbackground-color: ${colors.darkBackground};\n\t}\n\n\t& + & {\n\t\tborder-top: 1px solid ${colors.borderColor};\n\t\tpadding-bottom: 15px;\n\n\t}\n\t& + & button {\n\t\theight: 30px;\n\t\tpadding-top: 5px;\n\t\tpadding-bottom: 5px;\n\t}\n\n`;\n\nconst Toolbar = props => (\n\t<Div className={'toolbar' + (props.style ? ' ' + props.style : '')}>\n\t\t{props.items.map(item => {\n\t\t\tswitch (item.get('type')) {\n\t\t\tcase 'checkboxGroup':\n\t\t\t\treturn <CheckboxGroup key={item.get('name')} {...item.toJS()}/>;\n\t\t\tcase 'select':\n\t\t\t\titem = item.toJS();\n\t\t\t\titem.options && item.options.forEach(option => {\n\t\t\t\t\toption.label = option.label || option.value;\n\t\t\t\t});\n\t\t\t\treturn <Select key={item.name} clearable={false} multi={false} simpleValue={true} {...item}/>;\n\t\t\tcase 'button':\n\t\t\tdefault:\n\t\t\t\tif (!((item.get('label') || item.get('icon')) && item.get('action'))) return null;\n\t\t\t\treturn <ActionButton\n\t\t\t\t\tkey={item.get('name')}\n\t\t\t\t\t{...item.toJS()}/>;\n\t\t\t}\n\t\t}).filter(item => !!item)}\n\t</Div>\n);\n\nToolbar.propTypes = {\n\tstyle: PropTypes.string,\n\titems: PropTypes.object.isRequired,\n\tcanSave: PropTypes.bool\n};\n\nexport default Toolbar;\n"
  },
  {
    "path": "Website/Composite/console/components/presentation/ToolbarFrame.js",
    "content": "import React, { PropTypes } from 'react';\nimport Toolbar from 'console/components/presentation/Toolbar.js';\nimport TabBar from 'console/components/presentation/TabBar.js';\nimport ConnectTabPanel from 'console/components/container/ConnectTabPanel.js';\nimport { toolbarPropsSelector } from 'console/state/selectors/toolbarPropsSelector.js';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\n\nconst ToolbarFrame = props => {\n\tlet toolbars = toolbarPropsSelector(props).map(toolbar => (\n\t\t\t<Toolbar\n\t\t\t\t{...toolbar.toObject()}\n\t\t\t\tkey={toolbar.get('name')}/>\n\t\t)\n\t).toArray();\n\tif (props.tabDefs.size > 1) {\n\t\ttoolbars.push(<TabBar key='tabs' tabs={props.tabDefs\n\t\t\t.map(tabDef => ({\n\t\t\t\tname: tabDef.get('name'),\n\t\t\t\tactive: tabDef.get('name') === props.shownTab,\n\t\t\t\tlabel: tabDef.get('label'),\n\t\t\t\tonClick: props.actions.setTab(tabDef.get('name'))\n\t\t\t}))\n\t\t\t.toArray()}/>);\n\t}\n\treturn (\n\t\t<div className='page'\n\t\t\tonContextMenu={event => {\n\t\t\t\tevent.preventDefault(); // To not show the default menu\n\t\t\t}}>\n\t\t\t{toolbars}\n\t\t\t<ConnectTabPanel/>\n\t\t</div>\n\t);\n};\n\nToolbarFrame.propTypes = {\n\ttabDefs: ImmutablePropTypes.list.isRequired,\n\tshownTab: PropTypes.string,\n\ttoolbars: ImmutablePropTypes.list.isRequired,\n\tactions: PropTypes.object.isRequired,\n\tdirty: PropTypes.bool.isRequired\n};\n\nexport default ToolbarFrame;\n"
  },
  {
    "path": "Website/Composite/console/console.js",
    "content": "import 'systemjs-hot-reloader/default-listener';\n\nimport wampTest from 'console/access/wampTest.js';\nimport React from 'react';\nimport { render } from 'react-dom';\nimport { Provider } from 'react-redux';\nimport configureStore from 'console/state/store.js';\nimport ConnectDockPanel from 'console/components/container/ConnectDockPanel.js';\nimport { injectGlobal } from 'styled-components';\nimport 'console/iconIndex.js';\n\nimport colors from 'console/components/colors.js';\n\ninjectGlobal`\n*:focus {\n\toutline: 0;\n}\n\n::-webkit-scrollbar {\n  width: 13px;\n  height: 13px;\n  background: ${colors.scrollbarTrackColor};\n}\n\n::-webkit-scrollbar-thumb {\n  background: ${colors.scrollbarThumbColor};\n  border: 3px solid ${colors.scrollbarTrackColor};\n  border-radius: 7px;\n}\n\n::-webkit-scrollbar-thumb:hover {\n  background: ${colors.buttonHighlightColor};\n}\n\nhtml, body {\n\tmargin: 0;\n\tpadding: 0;\n\toverflow: hidden;\n\theight: 100%;\n\twidth: 100%;\n}\n\ndiv.entry, div.page {\n\twidth: inherit;\n\theight: inherit;\n}\n\nbody, input, textarea, select, button {\n\tfont-size: 12px;\n\tfont-family: \"Segoe UI\", Tahoma, sans-serif;\n\tcolor: ${colors.baseFontColor};\n}\n`;\n\n\ndocument.title = 'C1 CMS: ' + location.hostname;\n\nconst initialState = {\n\tpageDefs: {\n\t\t'svg-sprites': {\n\t\t\tname: 'svg-sprites',\n\t\t\tlabel: 'SVG Spritesheet',\n\t\t\ttype: 'spritesheet'\n\t\t}\n\t}\n};\n\nfunction whenReadyRender() {\n\tif (document.readyState === 'complete') {\n\t\twampTest\n\t\t.then(() => {\n\t\t\tconst store = configureStore(initialState);\n\t\t\trender(\n\t\t\t\t<Provider store={store}>\n\t\t\t\t\t<ConnectDockPanel/>\n\t\t\t\t</Provider>,\n\t\t\t\tdocument.querySelector('body > div.entry')\n\t\t\t);\n\t\t})\n\t\t.catch(err => { throw err; });\n\t}\n}\ndocument.addEventListener('readystatechange', whenReadyRender);\nwhenReadyRender();\n"
  },
  {
    "path": "Website/Composite/console/iconIndex.js",
    "content": "import spriteSheet from 'console/icons.svg!';\n\nspriteSheet.style.display = 'none';\nspriteSheet.id = 'spritesheet';\n\n// support hot reloading\nfunction insertSpriteSheet() {\n\tif (document.readyState === 'complete') {\n\t\tconst oldSheet = document.getElementById('spritesheet');\n\t\tif (oldSheet) {\n\t\t\tdocument.body.replaceChild(spriteSheet, oldSheet);\n\t\t} else {\n\t\t\tdocument.body.appendChild(spriteSheet);\n\t\t}\n\t}\n}\n\ninsertSpriteSheet();\ndocument.addEventListener('readystatechange', insertSpriteSheet);\n"
  },
  {
    "path": "Website/Composite/console/index.html",
    "content": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,400italic\">\n\t\t<script type=\"text/javascript\" src=\"/Composite/lib/babel/browser-polyfill.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"/jspm_packages/system.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"/jspm.config.js\"></script>\n\t\t<script type=\"text/javascript\">\n\t\t\tSystem.import('CMSConsole');\n\t\t</script>\n\t</head>\n\t<body>\n\t\t<div class=\"entry\"></div>\n\t</body>\n</html>\n"
  },
  {
    "path": "Website/Composite/console/index.prod.html",
    "content": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,400italic\">\n\t\t<script type=\"text/javascript\" src=\"../lib/babel/browser-polyfill.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"../console.js\"></script>\n\t</head>\n\t<body>\n\t\t<div class=\"entry\"></div>\n\t</body>\n</html>\n"
  },
  {
    "path": "Website/Composite/console/state/actions/fetchFromProvider.js",
    "content": "import requestJSON from 'console/access/requestJSON.js';\nimport WAMPClient from 'console/access/wampClient.js';\nimport { storeData } from 'console/state/reducers/providers.js';\n\n// Determine protocol (HTTP/WAMP)\n// Access endpoint\nconst prefix = 'PROVIDER.';\n\nconst getActionType = prefix + 'GET';\nexport const GET_PROVIDER = getActionType + '_COMMENCE';\nexport const GET_PROVIDER_DONE = getActionType + '_DONE';\nexport const GET_PROVIDER_FAILED = getActionType + '_FAILED';\n\nfunction stringifySearchParam(param) {\n\tif (Array.isArray(param)) {\n\t\treturn param.map(encodeURIComponent).join(',');\n\t} else {\n\t\treturn encodeURIComponent(param.toString());\n\t}\n}\n\nexport const getProviderPage = (provider, page, ...params) => (dispatch) => {\n\tdispatch({ type: GET_PROVIDER, provider, page, params });\n\tlet request;\n\tif (provider.protocol === 'http') {\n\t\t// HTTP needs key/value parameters - pass as object in first parameter.\n\t\tparams = params[0];\n\t\tlet url = provider.uri;\n\t\tlet body;\n\t\tif (params && typeof params === 'object') {\n\t\t\tif (provider.post) {\n\t\t\t\tbody = params;\n\t\t\t} else {\n\t\t\t\turl += '?' + Object.keys(params)\n\t\t\t\t.map(key => key + '=' + stringifySearchParam(params[key]))\n\t\t\t\t.join('&');\n\t\t\t}\n\t\t}\n\t\trequest =  requestJSON(url, {\n\t\t\tbody\n\t\t});\n\t} else if (provider.protocol === 'wamp') {\n\t\trequest = WAMPClient.call(provider.uri, ...params);\n\t} else {\n\t\tdispatch({\n\t\t\ttype: GET_PROVIDER_FAILED,\n\t\t\tprovider,\n\t\t\tpage,\n\t\t\tmessage: 'Unknown protocol: ' + provider.protocol\n\t\t});\n\t\treturn;\n\t}\n\treturn request\n\t.then(data => {\n\t\tdispatch(storeData(provider.uri, page, data));\n\t\tdispatch({ type: GET_PROVIDER_DONE, provider, page });\n\t})\n\t.catch(err => {\n\t\tdispatch({ type: GET_PROVIDER_FAILED, provider, page, params, message: err.message, stack: err.stack });\n\t\tconsole.error(err); // eslint-disable-line no-console\n\t});\n};\n"
  },
  {
    "path": "Website/Composite/console/state/actions/fireAction.js",
    "content": "import requestJSON from 'console/access/requestJSON.js';\nimport WAMPClient from 'console/access/wampClient.js';\nimport outerFrameCallback from 'console/access/postFrame.js';\n\nconst prefix = 'SERVER_ACTION.';\nconst fireActionType = prefix + 'FIRE';\nexport const FIRE_ACTION = fireActionType + '_COMMENCE';\nexport const FIRE_ACTION_DONE = fireActionType + '_DONE';\nexport const FIRE_ACTION_FAILED = fireActionType + '_FAILED';\n\n// TODO: Rig to handle WAMP endpoints\n\nfunction stringifySearchParam(param) {\n\tif (Array.isArray(param)) {\n\t\treturn param.map(encodeURIComponent).join(',');\n\t} else {\n\t\treturn encodeURIComponent(param.toString());\n\t}\n}\n\nexport function fireAction(provider, pageName, ...params) {\n\treturn dispatch => {\n\t\tdispatch({ type: FIRE_ACTION, provider, pageName });\n\t\tlet request;\n\t\tif (provider.protocol === 'http') {\n\t\t\t// HTTP needs key/value parameters - pass as object in first parameter.\n\t\t\tparams = params[0];\n\t\t\tparams.pageName = pageName;\n\t\t\tlet url = provider.uri;\n\t\t\tlet body;\n\t\t\tif (params && typeof params === 'object') {\n\t\t\t\tif (provider.post) {\n\t\t\t\t\tbody = params;\n\t\t\t\t} else {\n\t\t\t\t\turl += '?' + Object.keys(params)\n\t\t\t\t\t.map(key => key + '=' + stringifySearchParam(params[key]))\n\t\t\t\t\t.join('&');\n\t\t\t\t}\n\t\t\t}\n\t\t\trequest = requestJSON(url, {\n\t\t\t\tbody\n\t\t\t});\n\t\t} else if (provider.protocol === 'wamp') {\n\t\t\trequest = WAMPClient.call(provider.uri, pageName, ...params);\n\t\t} else if (provider.protocol === 'post') {\n\t\t\t// Get postFrame accessor, fire with appropriate info\n\t\t\trequest = outerFrameCallback(provider, params[0]);\n\t\t} else {\n\t\t\tdispatch({\n\t\t\t\ttype: FIRE_ACTION_FAILED,\n\t\t\t\tprovider,\n\t\t\t\tpageName,\n\t\t\t\tmessage: 'Unknown protocol: ' + provider.protocol\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\treturn request\n\t\t.then(() => {\n\t\t\tdispatch({ type: FIRE_ACTION_DONE, provider, pageName });\n\t\t})\n\t\t.catch(err => {\n\t\t\tdispatch({ type: FIRE_ACTION_FAILED, provider, pageName, message: err.message, stack: err.stack });\n\t\t\t//console.error(err); // eslint-disable-line no-console\n\t\t});\n\t};\n}\n"
  },
  {
    "path": "Website/Composite/console/state/actions/loadAndOpen.js",
    "content": "import { loadPageDef } from 'console/state/actions/pageDefs.js';\nimport { loadValues } from 'console/state/actions/values.js';\nimport { openPage, setPage } from 'console/state/reducers/layout.js';\nimport { getLogDates, getLogPage } from 'console/state/actions/logs.js';\nimport { getProviderPage } from 'console/state/actions/fetchFromProvider.js';\nimport { subscribe } from 'console/state/observers.js';\nimport WAMPClient from 'console/access/wampClient.js';\n\nconst actionList = {\n\tgetLogDates,\n\tgetLogPage\n};\n\nconst pageLoaders = {\n\tdocument: (pageName, getState, dispatch) => {\n\t\tlet pageDef = getState().getIn(['pageDefs', pageName]);\n\t\tlet loading = [\n\t\t\tdispatch(loadValues(pageName))\n\t\t];\n\t\t// Run through toolbars, load options\n\t\tpageDef.get('toolbars').forEach(toolbarName => {\n\t\t\tlet toolbarDef = getState().getIn(['toolbarDefs', toolbarName]);\n\t\t\ttoolbarDef.get('items').forEach(itemName => {\n\t\t\t\tlet itemDef = getState().getIn(['itemDefs', itemName]);\n\t\t\t\tif (itemDef.get('type') === 'select' && itemDef.get('optionLoader')) {\n\t\t\t\t\tloading.push(dispatch(actionList[itemDef.get('optionLoader')](itemName)));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\tlet tabs = pageDef && pageDef.get('tabs') ?\n\t\t\tpageDef.get('tabs').toArray() :\n\t\t\t[];\n\t\ttabs.forEach(tabName =>\n\t\t\tloading.push(dispatch(loadTabValues(tabName)))\n\t\t);\n\t\treturn Promise.all(loading);\n\t},\n\tdialogPageShim: (pageName, getState, dispatch) => {\n\t\tlet context;\n\t\tif (location.search && /(\\?|&)containerClasses/.test(location.search)) {\n\t\t\tcontext = location.search.replace(/^\\?(?:.*&)?containerClasses=(.+?)?(?:&.*)?$/, '$1');\n\t\t} else {\n\t\t\tcontext = '';\n\t\t}\n\t\tlet dialogName = getState().getIn(['pageDefs', pageName, 'dialog']);\n\t\tlet dialogDef = getState().getIn(['dialogDefs', dialogName]);\n\t\tlet paneIndex = getState().getIn(['dialogData', dialogName, 'showPane']) || 0;\n\t\tlet paneName = dialogDef.getIn(['panes', paneIndex]);\n\t\tlet paneDef = getState().getIn(['dialogPaneDefs', paneName]);\n\t\tif (paneDef.get('type') === 'palette') {\n\t\t\tlet provider = getState().getIn(['providerDefs', paneDef.get('provider')]).toJS();\n\t\t\t// XXX: Context extraction is hard coded and ugly AF.\n\t\t\t// Needs to be in page structure data where it belongs,\n\t\t\treturn dispatch(getProviderPage(provider, dialogName, /**/context/*/paneDef.get('context')/**/))\n\t\t\t.then(() => {\n\t\t\t\t// Subscribe to component update\n\t\t\t\tlet topic = getState().getIn(['providerDefs', paneDef.get('updateTopic'), 'uri']);\n\t\t\t\tif (topic) {\n\t\t\t\t\tWAMPClient.subscribe(topic, () => {\n\t\t\t\t\t\t// Fetch new list if event\n\t\t\t\t\t\tdispatch(getProviderPage(provider, dialogName, /**/context/*/paneDef.get('context')/**/));\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t}\n};\n\nexport function loadAndOpenPage(pageName) {\n\treturn (dispatch, getState) => {\n\t\tlet loadDef = getState().getIn(['pageDefs', pageName]) ?\n\t\t\tPromise.resolve(null) :\n\t\t\tdispatch(loadPageDef(pageName));\n\t\treturn Promise.all([\n\t\t\tloadDef.then(() => {\n\t\t\t\tlet pageDef = getState().getIn(['pageDefs', pageName]);\n\t\t\t\t// Load any options specified\n\t\t\t\tlet tabs = pageDef && pageDef.get('tabs') ?\n\t\t\t\t\tpageDef.get('tabs').toArray() :\n\t\t\t\t\t[];\n\t\t\t\tlet loading = [];\n\t\t\t\tdispatch(openPage(pageName, tabs));\n\t\t\t\tdispatch(setPage(pageName));\n\t\t\t\tlet loader = pageLoaders[pageDef.get('type')];\n\t\t\t\tif (loader) {\n\t\t\t\t\tloading.push(loader(pageName, getState, dispatch));\n\t\t\t\t}\n\t\t\t\treturn Promise.all(loading);\n\t\t\t})\n\t\t]);\n\t};\n}\n\nconst tabLoaders = {\n\tlog: (tabName, getState, dispatch) => {\n\t\tlet dateSelectorName = getState().getIn(['tabDefs', tabName, 'logPageName']);\n\t\tlet loadLogs = () => {\n\t\t\tlet date = getState().getIn(['options', 'values', dateSelectorName]) ||\n\t\t\t\tgetState().getIn(['options', 'lists', dateSelectorName, 0, 'value']);\n\t\t\tif (!getState().getIn(['logs', tabName, date])) {\n\t\t\t\tdispatch(actionList.getLogPage(tabName, date));\n\t\t\t}\n\t\t};\n\t\tsubscribe(['options', 'values', dateSelectorName], loadLogs);\n\t\treturn loadLogs();\n\t}\n};\n\nexport function loadTabValues(tabName) {\n\treturn (dispatch, getState) => {\n\t\tlet tabDef = getState().getIn(['tabDefs', tabName]);\n\t\tlet loader = tabLoaders[tabDef.get('type')];\n\t\tif (loader) {\n\t\t\treturn loader(tabName, getState, dispatch);\n\t\t}\n\t};\n}\n"
  },
  {
    "path": "Website/Composite/console/state/actions/logs.js",
    "content": "import requestJSON from 'console/access/requestJSON.js';\nimport { storeOptions, setOption } from 'console/state/reducers/options.js';\nimport { refreshLog } from 'console/state/reducers/logs.js';\n\nconst logDateURL = '/Composite/api/Logger/GetDates';\nconst logURL = '/Composite/api/Logger/GetData';\nconst prefix = 'LOGS.';\n\nconst getLogActionType = prefix + 'GET_DATES';\nexport const GET_LOG_DATES = getLogActionType + '_COMMENCE';\nexport const GET_LOG_DATES_DONE = getLogActionType + '_DONE';\nexport const GET_LOG_DATES_FAILED = getLogActionType + '_FAILED';\n\nexport const getLogDates = dateSelectorName => (dispatch, getState) => {\n\tdispatch({ type: GET_LOG_DATES, dateSelectorName });\n\treturn requestJSON(logDateURL)\n\t.then(dates => {\n\t\tlet dateOptions = dates.map(dateString => {\n\t\t\t// Date string is in M/D/YYYY format\n\t\t\tlet dateParts = dateString.split('/');\n\t\t\tlet date = new Date(Date.UTC(\n\t\t\t\tparseInt(dateParts[2], 10),\n\t\t\t\tparseInt(dateParts[0], 10) - 1,\n\t\t\t\tparseInt(dateParts[1], 10)\n\t\t\t));\n\t\t\treturn {\n\t\t\t\tvalue: date.toISOString(),\n\t\t\t\t// TODO: Need to extract IANA langtag from user environment\n\t\t\t\tlabel: date.toLocaleDateString('en-gb')\n\t\t\t};\n\t\t}).sort((a,b) => (a.value > b.value ? -1 : (a.value < b.value ? 1 : 0)));\n\t\tdispatch(storeOptions(dateSelectorName, dateOptions));\n\t\tif (!getState().getIn(['options', dateSelectorName])) {\n\t\t\tdispatch(setOption(dateSelectorName, dateOptions[0].value));\n\t\t}\n\t\tdispatch({ type: GET_LOG_DATES_DONE, dateSelectorName });\n\t})\n\t.catch(err => {\n\t\tdispatch({ type: GET_LOG_DATES_FAILED, dateSelectorName, message: err.message, stack: err.stack });\n\t\tconsole.error(err); // eslint-disable-line no-console\n\t});\n};\n\nfunction formatDate(date) {\n\treturn (date.getUTCMonth() + 1) + '/' + date.getUTCDate() + '/' + date.getUTCFullYear();\n}\n\nexport const GET_LOG = prefix + 'GET';\nexport const GET_LOG_DONE = GET_LOG + '_DONE';\nexport const GET_LOG_FAILED = GET_LOG + '_FAILED';\nexport const getLogPage = (logTabName, day) => (dispatch) => {\n\tdispatch({ type: GET_LOG, logTabName, day });\n\tlet fromDate = new Date(day);\n\tlet toDate = new Date(day);\n\ttoDate.setDate(fromDate.getDate() + 1);\n\treturn requestJSON(logURL, {\n\t\tmethod: 'POST',\n\t\tbody: {\n\t\t\tDateFrom: formatDate(fromDate),\n\t\t\tDateTo: formatDate(toDate),\n\t\t\tSeverity: 'Verbose',\n\t\t\tAmount: 5000\n\t\t}\n\t})\n\t.then(logData => {\n\t\tdispatch(refreshLog(logTabName, day, logData));\n\t\tdispatch({ type: GET_LOG_DONE, logTabName, day });\n\t})\n\t.catch(err => {\n\t\tdispatch({ type: GET_LOG_FAILED, logTabName, day, message: err.message, stack: err.stack });\n\t\tconsole.error(err); // eslint-disable-line no-console\n\t});\n};\n"
  },
  {
    "path": "Website/Composite/console/state/actions/pageDefs.js",
    "content": "import WAMPClient from 'console/access/wampClient.js';\nimport { normalize } from 'normalizr';\nimport { pageSchema } from 'console/state/normalizingSchema.js';\nimport { addDefinition } from 'console/state/reducers/definitions.js';\n\nconst prefix = 'PAGE_DEF.';\nconst loadPageDefActionType = prefix + 'LOAD';\nexport const LOAD_PAGE_DEF = loadPageDefActionType + '_COMMENCE';\nexport const LOAD_PAGE_DEF_DONE = loadPageDefActionType + '_DONE';\nexport const LOAD_PAGE_DEF_FAILED = loadPageDefActionType + '_FAIL';\n\nconst pageDefEndpointURI = 'structure.page';\n\nexport function loadPageDef(pageName) {\n\treturn dispatch => {\n\t\tdispatch({ type: LOAD_PAGE_DEF, name: pageName });\n\t\treturn WAMPClient.call(pageDefEndpointURI, pageName)\n\t\t.then(response => {\n\t\t\tlet defs = normalize(response, pageSchema).entities;\n\t\t\tObject.keys(defs).forEach(defType => {\n\t\t\t\tlet defSet = defs[defType];\n\t\t\t\tlet typeName = defType.replace(/Defs$/, '');\n\t\t\t\tObject.keys(defSet).forEach(defName => {\n\t\t\t\t\tdispatch(addDefinition(typeName, defSet[defName]));\n\t\t\t\t});\n\t\t\t});\n\t\t\tdispatch({ type: LOAD_PAGE_DEF_DONE, name: pageName });\n\t\t})\n\t\t.catch(err => {\n\t\t\tdispatch({ type: LOAD_PAGE_DEF_FAILED, message: err.message, stack: err.stack });\n\t\t\t// console.error(err); // eslint-disable-line no-console\n\t\t});\n\t};\n}\n"
  },
  {
    "path": "Website/Composite/console/state/actions/values.js",
    "content": "import WAMPClient from 'console/access/wampClient.js';\nimport { storeValues, commitPage } from 'console/state/reducers/dataFields.js';\nimport Immutable from 'immutable';\n\nconst prefix = 'VALUES.';\nconst loadActionType = prefix + 'LOAD';\nexport const LOAD_VALUES = loadActionType + '_COMMENCE';\nexport const LOAD_VALUES_DONE = loadActionType + '_DONE';\nexport const LOAD_VALUES_FAILED = loadActionType + '_FAIL';\nconst saveActionType = prefix + 'SAVE';\nexport const SAVE_VALUES = saveActionType + '_COMMENCE';\nexport const SAVE_VALUES_DONE = saveActionType + '_DONE';\nexport const SAVE_VALUES_FAILED = saveActionType + '_FAIL';\n\nconst valueEndpointURI = 'mock.data.values';\nconst valueLoadEndpointURI = valueEndpointURI + '.load';\nconst valueSaveEndpointURI = valueEndpointURI + '.save';\n\nexport function loadValues(pageName) {\n\treturn dispatch => {\n\t\tdispatch({ type: LOAD_VALUES, pageName });\n\t\treturn WAMPClient.call(valueLoadEndpointURI, pageName)\n\t\t.then(valueData => {\n\t\t\tdispatch(storeValues(pageName, valueData));\n\t\t\tdispatch({ type: LOAD_VALUES_DONE, pageName });\n\t\t})\n\t\t.catch(err => {\n\t\t\tdispatch({ type: LOAD_VALUES_FAILED, message: err.message, stack: err.stack });\n\t\t\t// console.error(err); // eslint-disable-line no-console\n\t\t});\n\t};\n}\n\nexport function saveValues(pageName) {\n\treturn (dispatch, getState) => {\n\t\tdispatch({ type: SAVE_VALUES, pageName });\n\t\tlet state = getState().get('dataFields');\n\t\tlet fieldValues = state.get(pageName);\n\t\tlet committedFieldList = state.getIn(['committedPages', pageName]);\n\t\tif (Immutable.is(fieldValues, committedFieldList)) {\n\t\t\tdispatch({ type: SAVE_VALUES_FAILED, pageName, message: 'Page ' + pageName + ' is unchanged'});\n\t\t\treturn;\n\t\t}\n\t\tlet values = fieldValues.toJS();\n\t\treturn WAMPClient.call(valueSaveEndpointURI, pageName, values)\n\t\t.then(() => {\n\t\t\tdispatch(commitPage(pageName));\n\t\t\tdispatch({ type: SAVE_VALUES_DONE, pageName });\n\t\t})\n\t\t.catch(err => {\n\t\t\tdispatch({ type: SAVE_VALUES_FAILED, message: err.message, stack: err.stack });\n\t\t\t// console.error(err); // eslint-disable-line no-console\n\t\t});\n\t};\n}\n"
  },
  {
    "path": "Website/Composite/console/state/initState.js",
    "content": "import { loadAndOpenPage } from 'console/state/actions/loadAndOpen.js';\n\n// The intent is that this should be as small as possible, instead initializing\n// from server data\nlet pageName;\n// Temporary. Intent is to let localstorage control location\nif (location.search && /(\\?|&)pageId/.test(location.search)) {\n\tpageName = location.search.replace(/^\\?(?:.*&)?pageId=(.+?)?(?:&.*)?$/, '$1');\n} else {\n\tpageName = 'component-selector-shim';\n}\n\nexport default function initState(store) {\n\tstore.dispatch(loadAndOpenPage(pageName));\n}\n"
  },
  {
    "path": "Website/Composite/console/state/normalizingSchema.js",
    "content": "import { Schema, arrayOf } from 'normalizr';\n\nexport const dataFieldSchema = new Schema('dataFieldDefs', { idAttribute: 'name' });\nexport const fieldsetSchema = new Schema('fieldsetDefs', { idAttribute: 'name' });\nfieldsetSchema.define({\n\tfields: arrayOf(dataFieldSchema)\n});\nexport const tabSchema = new Schema('tabDefs', { idAttribute: 'name' });\ntabSchema.define({\n\tfieldsets: arrayOf(fieldsetSchema),\n});\nexport const itemSchema = new Schema('itemDefs', { idAttribute: 'name' });\nexport const toolbarSchema = new Schema('toolbarDefs', { idAttribute: 'name' });\ntoolbarSchema.define({\n\titems: arrayOf(itemSchema)\n});\nexport const providerSchema = new Schema('providerDefs', { idAttribute: 'name' });\nexport const dialogPaneSchema = new Schema('dialogPaneDefs', { idAttribute: 'name' });\ndialogPaneSchema.define({\n\tprovider: providerSchema,\n\tupdateTopic: providerSchema,\n\tcancelProvider: providerSchema,\n\tfinishProvider: providerSchema\n});\nexport const dialogSchema = new Schema('dialogDefs', { idAttribute: 'name' });\ndialogSchema.define({\n\tpanes: arrayOf(dialogPaneSchema)\n});\nexport const pageSchema = new Schema('pageDefs', { idAttribute: 'name' });\npageSchema.define({\n\ttabs: arrayOf(tabSchema),\n\ttoolbars: arrayOf(toolbarSchema),\n\tdialog: dialogSchema,\n\tproviders: arrayOf(providerSchema)\n});\n\nexport default arrayOf(pageSchema);\n"
  },
  {
    "path": "Website/Composite/console/state/observers.js",
    "content": "import observer from 'redux-observer';\nimport Immutable from 'immutable';\n\nconst pathSubscriptions = new Map();\n\nexport function subscribe(path, handler) {\n\tif (!pathSubscriptions.get(path)) {\n\t\tpathSubscriptions.set(path, []);\n\t}\n\tpathSubscriptions.get(path).push(handler);\n}\n\nexport function unsubscribe(path, handler) {\n\tif (pathSubscriptions.get(path)) {\n\t\tlet handlers = pathSubscriptions.get(path);\n\t\tlet handlerIndex = handlers.indexOf(handler);\n\t\tif (handlerIndex != -1) {\n\t\t\thandlers.splice(handlerIndex, 1);\n\t\t}\n\t}\n}\n\nexport function stateChange(newState, oldState) {\n\treturn [...pathSubscriptions].map(([path, handlers]) => {\n\t\tif (!Immutable.is(newState.getIn(path), oldState.getIn(path))) {\n\t\t\treturn Promise.all(handlers.map(handler => new Promise(handler)));\n\t\t}\n\t});\n}\n\nexport default observer(stateChange, { compareWith: Immutable.is });\n"
  },
  {
    "path": "Website/Composite/console/state/reducers/activity.js",
    "content": "import Immutable from 'immutable';\n\nconst initialState = Immutable.Map({});\n\nconst commenceActionPattern = /_COMMENCE$/;\nconst failedActionPattern = /_FAILED$/;\nconst doneActionPattern = /_DONE$/;\nconst lastWordPattern = /_[A-Z]+$/;\n\nexport default function activity(state = initialState, action) {\n\tlet actionType = '';\n\tif (action && action.type) {\n\t\tactionType = action.type.replace(lastWordPattern, '');\n\t\tif (commenceActionPattern.test(action.type)) {\n\t\t\treturn state.set(actionType, (state.get(actionType) || 0) + 1);\n\t\t} else if (\n\t\t\tstate.get(actionType) &&\n\t\t\tdoneActionPattern.test(action.type) ||\n\t\t\tfailedActionPattern.test(action.type)\n\t\t) {\n\t\t\treturn state.set(actionType, state.get(actionType) - 1);\n\t\t}\n\t}\n\treturn state;\n}\n"
  },
  {
    "path": "Website/Composite/console/state/reducers/dataFields.js",
    "content": "import Immutable from 'immutable';\n\nconst prefix = 'DATAFIELDS.';\n\nexport const UPDATE_VALUE = prefix + 'UPDATE_VALUE';\nexport function updateFieldValue(pageName, fieldName, newValue) {\n\treturn { type: UPDATE_VALUE, pageName, fieldName, newValue };\n}\n\nexport const COMMIT_PAGE = prefix + 'COMMIT';\nexport function commitPage(pageName) {\n\treturn { type: COMMIT_PAGE, pageName };\n}\n\nexport const ROLLBACK_PAGE = prefix + 'ROLLBACK';\nexport function rollbackPage(pageName, values) {\n\treturn {type: ROLLBACK_PAGE, pageName, values };\n}\n\nexport const STORE_VALUES = prefix + 'STORE_VALUES';\nexport function storeValues(pageName, values) {\n\treturn { type: STORE_VALUES, pageName, values };\n}\n\nconst initialState = Immutable.Map({\n\tcommittedPages: Immutable.Map()\n});\n\nexport default function dataFields(state = initialState, action) {\n\tswitch (action.type) {\n\tcase UPDATE_VALUE:\n\t\treturn state.withMutations(state => {\n\t\t\tif (!state.getIn(['committedPages', action.pageName])) {\n\t\t\t\tstate.setIn(['committedPages', action.pageName], Immutable.Map());\n\t\t\t}\n\t\t\tif (!state.get(action.pageName)) {\n\t\t\t\tstate.set(action.pageName, Immutable.Map());\n\t\t\t}\n\t\t\tstate.setIn([action.pageName, action.fieldName], action.newValue);\n\t\t});\n\tcase COMMIT_PAGE:\n\t\treturn state.setIn(['committedPages', action.pageName], state.get(action.pageName));\n\tcase ROLLBACK_PAGE:\n\t\tif (!Immutable.Map.isMap(action.values)) {\n\t\t\taction.values = state.getIn(['committedPages', action.pageName]);\n\t\t}\n\t\treturn state\n\t\t\t.set(action.pageName, action.values)\n\t\t\t.setIn(['committedPages', action.pageName], action.values);\n\tcase STORE_VALUES:\n\t\treturn state.withMutations(state => {\n\t\t\tstate.mergeIn([action.pageName], action.values);\n\t\t\tstate.setIn(['committedPages', action.pageName], state.get(action.pageName));\n\t\t});\n\tdefault:\n\t\treturn state;\n\t}\n}\n"
  },
  {
    "path": "Website/Composite/console/state/reducers/definitions.js",
    "content": "import Immutable from 'immutable';\n\nconst prefix = 'DEFINITIONS.';\n\nexport const STORE_DEF = prefix + 'STORE';\n\nexport function addDefinition(defType, definition) {\n\treturn { type: STORE_DEF, defType, definition };\n}\n\nconst initialState = Immutable.Map();\n\nexport default function getDefinitionReducer(typeName) {\n\treturn (state = initialState, action) => {\n\t\tif (action.type === STORE_DEF && action.defType === typeName) {\n\t\t\treturn state.set(action.definition.name, Immutable.fromJS(action.definition));\n\t\t} else {\n\t\t\treturn state;\n\t\t}\n\t};\n}\n"
  },
  {
    "path": "Website/Composite/console/state/reducers/dialog.js",
    "content": "import Immutable from 'immutable';\n\nconst prefix = 'DIALOG.';\nexport const SET_DIALOG_STATE = prefix + 'SET_STATE';\nexport function setDialogState(dialogName, data) {\n\treturn {\n\t\ttype: SET_DIALOG_STATE,\n\t\tdialogName,\n\t\tdata\n\t};\n}\n\nconst initialState = Immutable.Map();\n\nfunction dialog(state = initialState, action) {\n\tswitch(action.type) {\n\tcase SET_DIALOG_STATE:\n\t\treturn state.set(action.dialogName, action.data);\n\tdefault:\n\t\treturn state;\n\t}\n}\n\nexport default dialog;\n"
  },
  {
    "path": "Website/Composite/console/state/reducers/layout.js",
    "content": "import Immutable from 'immutable';\n\nconst prefix = 'LAYOUT.';\n\n// Select perspective, page, tab, browser location\nexport const SELECT_LOCATION = prefix + 'SELECT_LOCATION';\nexport function setPerspective(perspective, page, tab, preview) {\n\tlet action = { type: SELECT_LOCATION, perspective };\n\tif (page) {\n\t\taction.page = page;\n\t\tif (tab) {\n\t\t\taction.tab = tab;\n\t\t\tif (preview) {\n\t\t\t\taction.preview = preview;\n\t\t\t}\n\t\t}\n\t}\n\treturn action;\n}\nexport function setPage(page, tab, preview) {\n\tlet action = { type: SELECT_LOCATION, page };\n\tif (tab) {\n\t\taction.tab = tab;\n\t\tif (preview) {\n\t\t\taction.preview = preview;\n\t\t}\n\t}\n\treturn action;\n}\nexport function setTab(tab, preview) {\n\tlet action = { type: SELECT_LOCATION, tab };\n\tif (preview) {\n\t\taction.preview = preview;\n\t}\n\treturn action;\n}\nexport function setPreview(preview) {\n\treturn { type: SELECT_LOCATION, preview };\n}\n\n// Open page\nexport const OPEN_PAGE = prefix + 'OPEN_PAGE';\nexport function openPage(pageName, tabNames) {\n\treturn { type: OPEN_PAGE, pageName, tabNames };\n}\n\n// Close page\nexport const CLOSE_PAGE = prefix + 'CLOSE_PAGE';\n\n// Show seo, dev, log, help\n// Hide seo, dev, log, help\n// Move split seo, dev, log, help\n\nconst initialState = Immutable.Map({\n\tcurrentPerspective: 'content',\n\tperspectives: Immutable.OrderedMap({\n\t\tcontent: Immutable.Map(),\n\t\tmedia: Immutable.Map(),\n\t\tdata: Immutable.Map(),\n\t\tlayout: Immutable.Map(),\n\t\tfunctions: Immutable.Map(),\n\t\tsystem: Immutable.Map()\n\t})\n});\n\nexport default function layout(state = initialState, action) {\n\tswitch (action.type) {\n\tcase SELECT_LOCATION:\n\t\treturn state.withMutations(state => {\n\t\t\tlet perspective = state.getIn(['perspectives', action.perspective || state.get('currentPerspective')]);\n\t\t\tif (perspective) {\n\t\t\t\tif (action.perspective) {\n\t\t\t\t\tstate.set('currentPerspective', action.perspective);\n\t\t\t\t}\n\t\t\t\tstate.setIn(['perspectives', state.get('currentPerspective')], perspective.withMutations(perspective => {\n\t\t\t\t\tlet page = perspective.getIn(['pages', action.page || perspective.get('currentPage')]);\n\t\t\t\t\tif (page) {\n\t\t\t\t\t\tif (action.page) {\n\t\t\t\t\t\t\tperspective.set('currentPage', action.page);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tperspective.setIn(['pages', perspective.get('currentPage')], page.withMutations(page => {\n\t\t\t\t\t\t\tlet tab = page.getIn(['tabs', action.tab || page.get('currentTab')]);\n\t\t\t\t\t\t\tif (tab) {\n\t\t\t\t\t\t\t\tif (action.tab) {\n\t\t\t\t\t\t\t\t\tpage.set('currentTab', action.tab);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (action.preview) {\n\t\t\t\t\t\t\t\t\tpage.setIn(['tabs', page.get('currentTab')], tab.withMutations(tab => {\n\t\t\t\t\t\t\t\t\t\ttab.set('previewLocation', action.preview);\n\t\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t}\n\t\t});\n\tcase OPEN_PAGE:\n\t\tif(state.getIn(['perspectives', state.get('currentPerspective'), 'pages', action.pageName])) return state;\n\t\treturn state.setIn(\n\t\t\t['perspectives', state.get('currentPerspective'), 'pages', action.pageName],\n\t\t\tImmutable.Map({\n\t\t\t\ttabs: (action.tabNames || []).reduce((tabs, tabName) =>\n\t\t\t\t\ttabs.set(tabName, Immutable.Map()), Immutable.OrderedMap())\n\t\t\t})\n\t\t);\n\tcase CLOSE_PAGE:\n\t\treturn state.withMutations(state => {\n\t\t\tif (state.getIn(['perspectives', state.get('currentPerspective'), 'currentPage']) === action.pageName) {\n\t\t\t\tstate.setIn(\n\t\t\t\t\t['perspectives', state.get('currentPerspective'), 'currentPage'],\n\t\t\t\t\tstate.getIn(['perspectives', state.get('currentPerspective'), 'pages']).keySeq().first()\n\t\t\t\t);\n\t\t\t}\n\t\t\tstate.deleteIn([\n\t\t\t\t'perspectives',\n\t\t\t\tstate.get('currentPerspective'),\n\t\t\t\t'pages',\n\t\t\t\taction.pageName\n\t\t\t]);\n\t\t});\n\tdefault:\n\t\treturn state;\n\t}\n}\n"
  },
  {
    "path": "Website/Composite/console/state/reducers/logs.js",
    "content": "import Immutable from 'immutable';\n\nconst prefix = 'LOGS.';\n\nexport const REFRESH_LOG = prefix + 'REFRESH';\nexport function refreshLog(logName, page, entries) {\n\treturn { type: REFRESH_LOG, logName, page, entries };\n}\n\nconst initialState = Immutable.Map({\n});\n\nexport default function logs(state = initialState, action) {\n\tswitch (action.type) {\n\tcase REFRESH_LOG:\n\t\treturn state.setIn([action.logName, action.page], Immutable.fromJS(action.entries));\n\tdefault:\n\t\treturn state;\n\t}\n}\n"
  },
  {
    "path": "Website/Composite/console/state/reducers/options.js",
    "content": "import Immutable from 'immutable';\n\nconst prefix = 'OPTIONS.';\n\nexport const SET_OPTION = prefix + 'SET';\nexport function setOption(name, value) {\n\treturn { type: SET_OPTION, name, value };\n}\n\nexport const STORE_OPTION_LIST = prefix + 'STORE_LIST';\nexport function storeOptions(field, options) {\n\treturn { type: STORE_OPTION_LIST, field, options };\n}\n\nconst initialState = Immutable.Map({\n\tvalues: Immutable.Map(),\n\tlists: Immutable.Map()\n});\n\nconst options = (state = initialState, action) => {\n\tswitch (action.type) {\n\tcase SET_OPTION:\n\t\treturn state.setIn(['values', action.name], action.value);\n\tcase STORE_OPTION_LIST:\n\t\treturn state.setIn(['lists', action.field], Immutable.fromJS(action.options));\n\tdefault:\n\t\treturn state;\n\t}\n};\n\nexport default options;\n"
  },
  {
    "path": "Website/Composite/console/state/reducers/providers.js",
    "content": "import Immutable from 'immutable';\n\nconst prefix = 'PROVIDER.';\n\n// Save data from provider in state\nexport const STORE_PROVIDER_DATA = prefix + 'STORE';\nexport function storeData(providerName, page, data) {\n\treturn { type: STORE_PROVIDER_DATA, providerName, page, data };\n}\n\nconst initialState = Immutable.Map({});\n\nexport default function providers(state = initialState, action) {\n\tswitch (action.type) {\n\tcase STORE_PROVIDER_DATA:\n\t\treturn state.setIn([action.providerName, action.page], Immutable.fromJS(action.data));\n\tdefault:\n\t\treturn state;\n\t}\n}\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/dialogSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport Immutable from 'immutable';\nimport { currentPageSelector } from 'console/state/selectors/pageSelector.js';\n\nconst dialogDefsSelector = state => state.get('dialogDefs');\nconst dialogPaneDefsSelector = state => state.get('dialogPaneDefs');\nconst providerDefsSelector = state => state.get('providerDefs');\nconst dialogDataSelector = state => state.get('dialogData');\n\nexport const currentDialogDefSelector = createSelector(\n\tcurrentPageSelector,\n\tdialogDefsSelector,\n\tdialogPaneDefsSelector,\n\tproviderDefsSelector,\n\t(page, dialogDefs, paneDefs, providerDefs) => (dialogDefs.get(page.get('dialog')) || Immutable.Map()).withMutations(dialogDef => {\n\t\tdialogDef.set(\n\t\t\t'panes',\n\t\t\t(dialogDef.get('panes') || Immutable.List()).map(paneName => {\n\t\t\t\tlet paneDef = paneDefs.get(paneName) || Immutable.Map();\n\t\t\t\tif (paneDef.get('provider')) {\n\t\t\t\t\tpaneDef = paneDef.set(\n\t\t\t\t\t\t'provider',\n\t\t\t\t\t\tproviderDefs.get(paneDef.get('provider'))\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t['finish', 'cancel'].forEach(button => {\n\t\t\t\t\tlet name = button + 'Provider';\n\t\t\t\t\tif (paneDef.get(name)) {\n\t\t\t\t\t\tpaneDef = paneDef.set(\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tproviderDefs.get(paneDef.get(name))\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn paneDef;\n\t\t\t})\n\t\t);\n\t})\n);\n\nexport const currentDialogDataSelector = createSelector(\n\tcurrentDialogDefSelector,\n\tdialogDataSelector,\n\t(dialogDef, dialogData) => dialogData.get(dialogDef.get('name')) || Immutable.Map()\n);\n\nexport const currentDialogPaneDefSelector = createSelector(\n\tcurrentDialogDefSelector,\n\tcurrentDialogDataSelector,\n\t(dialogDef, dialogData) => dialogDef.getIn(['panes', dialogData.get('showPane') || 0]) || Immutable.Map()\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/formSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport { currentPageSelector } from 'console/state/selectors/pageSelector.js';\nimport { tabSelector } from 'console/state/selectors/tabSelector.js';\n\nconst fieldsetDefsSelector = state => state.get('fieldsetDefs');\nconst dataFieldDefsSelector = state => state.get('dataFieldDefs');\nconst valuesSelector = state => state.get('dataFields');\n\nconst exists = x => x;\n\nconst pureValuesSelector = createSelector(\n\tvaluesSelector,\n\tvalues => values.delete('committedPages')\n);\n\nexport const formAssemblySelector = createSelector(\n\tcurrentPageSelector,\n\ttabSelector,\n\tfieldsetDefsSelector,\n\tdataFieldDefsSelector,\n\t(page, tabDef, fieldsetDefs, dataFieldDefs) =>\n\t\t!tabDef ? null :\n\t\ttabDef.set('fieldsets', tabDef.get('fieldsets')\n\t\t\t.map(fieldsetName => fieldsetDefs.get(fieldsetName))\n\t\t\t.filter(exists)\n\t\t\t.map(fieldset => fieldset.set('fields', fieldset.get('fields')\n\t\t\t\t.map(fieldName => dataFieldDefs.get(fieldName))\n\t\t\t\t.filter(exists)\n\t\t\t))\n\t\t).set('pageName', page.get('name'))\n);\n\nexport const formSelector = createSelector(\n\tformAssemblySelector,\n\tpureValuesSelector,\n\t(tabAssembly, values) =>\n\t\t!tabAssembly ? null :\n\t\ttabAssembly.set('fieldsets',\n\t\t\ttabAssembly.get('fieldsets')\n\t\t\t\t.map(fieldset =>\n\t\t\t\t\tfieldset.set('fields', fieldset.get('fields')\n\t\t\t\t\t\t.map(field =>\n\t\t\t\t\t\t\tfield.set('value',\n\t\t\t\t\t\t\t\tvalues.getIn([tabAssembly.get('pageName'), field.get('name')] || '')\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t)\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/layoutSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport Immutable from 'immutable';\n\nconst layoutSelector = state => state.get('layout');\n\nconst perspectivesSelector = createSelector(\n\tlayoutSelector,\n\tlayout => layout.get('perspectives')\n);\nexport const currentPerspectiveNameSelector = createSelector(\n\tlayoutSelector,\n\tlayout => layout.get('currentPerspective')\n);\n\nconst currentPerspectiveSelector = createSelector(\n\tperspectivesSelector,\n\tcurrentPerspectiveNameSelector,\n\t(perspectives, name) => perspectives.get(name)\n);\n\nconst pagesSelector = createSelector(\n\tcurrentPerspectiveSelector,\n\tperspective => perspective.get('pages') || Immutable.Map()\n);\nexport const currentPageNameSelector = createSelector(\n\tcurrentPerspectiveSelector,\n\tperspective => perspective.get('currentPage')\n);\n\nconst currentPageSelector = createSelector(\n\tpagesSelector,\n\tcurrentPageNameSelector,\n\t(pages, name) => pages.get(name) || Immutable.Map()\n);\n\nexport const currentTabNameSelector = createSelector(\n\tcurrentPageSelector,\n\tpage => page.get('currentTab')\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/logSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport { tabSelector, shownTabNameSelector } from 'console/state/selectors/tabSelector.js';\nimport Immutable from 'immutable';\n\nconst allLogsSelector = state => state.get('logs');\nconst allOptionsSelector = state => state.get('options');\nconst itemDefsSelector = state => state.get('itemDefs');\n\nconst logLevelSelector = createSelector(\n\tallOptionsSelector,\n\titemDefsSelector,\n\ttabSelector,\n\t(options, itemDefs, tabDef) => {\n\t\tlet itemName = tabDef.get('logLevels');\n\t\treturn options.getIn(['values', itemName]) ||\n\t\t\titemDefs.getIn([itemName, 'default']) ||\n\t\t\tImmutable.List();\n\t}\n);\n\nconst pageNameSelector = createSelector(\n\tallOptionsSelector,\n\titemDefsSelector,\n\ttabSelector,\n\t(options, itemDefs, tabDef) => {\n\t\tlet itemName = tabDef.get('logPageName');\n\t\treturn options.getIn(['values', itemName]) ||\n\t\t\titemDefs.getIn([itemName, 'default']);\n\t}\n);\n\nconst currentLogSelector = createSelector(\n\tallLogsSelector,\n\tshownTabNameSelector,\n\t(logs, tabName) =>\n\t\t(logs.get(tabName) || Immutable.Map())\n);\n\nconst currentLogPageSelector = createSelector(\n\tcurrentLogSelector,\n\tpageNameSelector,\n\t(log, page) => log.get(page) || Immutable.List()\n);\n\nconst levelFilteredLogSelector = createSelector(\n\tcurrentLogPageSelector,\n\tlogLevelSelector,\n\t(log, levels) => log.filter(logEntry => levels.includes(logEntry.get('severity')))\n);\n\nconst dateDescComparator = (a, b) => {\n\tlet aDate = new Date(a.get('timestamp'));\n\tlet bDate = new Date(b.get('timestamp'));\n\treturn aDate < bDate ?  1 :\n\t\taDate > bDate ? -1 :\n\t\t0;\n};\n\nexport const logSelector = createSelector(\n\tlevelFilteredLogSelector,\n\tlogs => logs.sort(dateDescComparator)\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/pageSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport { currentPageNameSelector } from 'console/state/selectors/layoutSelector.js';\nimport Immutable from 'immutable';\n\nconst pageDefSelector = state => state.get('pageDefs');\nconst providerSelector = state => state.get('providerDefs');\n\nexport const currentPageSelector = createSelector(\n\tcurrentPageNameSelector,\n\tpageDefSelector,\n\tproviderSelector,\n\t(name, pageDefs, providerDefs) => pageDefs.get(name) && pageDefs.get(name).withMutations(pageDef => {\n\t\tif (pageDef.get('providers')) {\n\t\t\tpageDef.set('providers', pageDef.get('providers').reduce((providers, providerName) =>\n\t\t\t\tproviders.set(providerName, providerDefs.get(providerName)),\n\t\t\t\tImmutable.Map()\n\t\t\t));\n\t\t}\n\t})\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/paletteDialogSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport { currentDialogDefSelector, currentDialogPaneDefSelector, currentDialogDataSelector } from 'console/state/selectors/dialogSelector.js';\nimport Immutable from 'immutable';\n\nconst providersSelector = state => state.get('providers');\n\nconst rawProviderDataSelector = createSelector(\n\tcurrentDialogDefSelector,\n\tcurrentDialogPaneDefSelector,\n\tprovidersSelector,\n\t(dialogDef, paneDef, providers) =>\n\t\tproviders.getIn([\n\t\t\tpaneDef.getIn(['provider', 'uri']),\n\t\t\tdialogDef.get('name')\n\t\t]) || Immutable.List()\n);\n\nconst filteredElementsSelector = createSelector(\n\trawProviderDataSelector,\n\tcurrentDialogDataSelector,\n\t(elements, dialogData) => {\n\t\tlet filterText = (dialogData.get('filterText') || '').toLowerCase();\n\t\tif (/\\w/.test(filterText)) {\n\t\t\treturn elements.filter(element => {\n\t\t\t\tlet searchText = (element.get('title') + ' ' + element.get('description')).toLowerCase();\n\t\t\t\treturn searchText.indexOf(filterText) !== -1;\n\t\t\t});\n\t\t} else {\n\t\t\treturn elements;\n\t\t}\n\t}\n);\n\nconst categorySelector = createSelector(\n\tcurrentDialogPaneDefSelector,\n\tpaneDef => paneDef.get('categories') || Immutable.List()\n);\n\nconst categorizedElementListSelector = createSelector(\n\tcategorySelector,\n\tfilteredElementsSelector,\n\t(categories, rawData) => {\n\t\tlet categoryMap = {\n\t\t\tuncategorized: []\n\t\t};\n\t\tcategories.forEach(name => {\n\t\t\tcategoryMap[name] = [];\n\t\t});\n\t\trawData.forEach(element => {\n\t\t\tlet categorized = false;\n\t\t\telement.get('groupingTags').forEach(tag => {\n\t\t\t\tif (categoryMap[tag]) {\n\t\t\t\t\tcategoryMap[tag].push(element);\n\t\t\t\t\tcategorized = true;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (!categorized) {\n\t\t\t\tcategoryMap['uncategorized'].push(element);\n\t\t\t}\n\t\t});\n\t\tcategories = categories.push('uncategorized');\n\t\tcategories = categories.filter(name => categoryMap[name].length);\n\t\treturn categories.map(categoryName => Immutable.Map({\n\t\t\tname: categoryName,\n\t\t\t// Ideally, title for the group would be defined as a string somewhere.\n\t\t\ttitle: categoryName.replace(/^\\w/, match => match.toLocaleUpperCase()),\n\t\t\tentries: Immutable.List(categoryMap[categoryName])\n\t\t}));\n\t}\n);\n\n// Grab and transform the list of components\nexport const currentPaletteElementList = createSelector(\n\tcategorizedElementListSelector,\n\tlist => list\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/searchSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport Immutable from 'immutable';\nimport {currentPageNameSelector } from 'console/state/selectors/layoutSelector.js';\nimport { currentPageSelector } from 'console/state/selectors/pageSelector.js';\n\nconst providerSelector = state => state.get('providers');\nconst allOptionsSelector = state => state.get('options');\n\nexport const searchSelector = createSelector(\n\tproviderSelector,\n\tcurrentPageSelector,\n\t(provider, pageDef) => pageDef && provider.getIn([\n\t\tpageDef.getIn([\n\t\t\t'providers',\n\t\t\tpageDef.get('searchProvider'),\n\t\t\t'uri'\n\t\t]),\n\t\tpageDef.get('name')\n\t]) || Immutable.Map()\n);\n\nexport const searchQuerySelector = createSelector(\n\tsearchSelector,\n\tsearch => search.get('queryText') || ''\n);\n\nconst facetOptionsSelector = createSelector(\n\tallOptionsSelector,\n\tcurrentPageNameSelector,\n\t(options, pageName) => options.getIn(['values', pageName, 'selections']) || Immutable.List()\n);\n\nexport const facetSelector = createSelector(\n\tsearchSelector,\n\tfacetOptionsSelector,\n\t(search, selections) => (search.get('facetFields') || Immutable.List()).withMutations(facetFields => {\n\t\tselections.forEach(field => {\n\t\t\tlet fieldName = field.get('fieldName');\n\t\t\tlet fieldIndex = facetFields.findKey(field => field.get('fieldName') === fieldName);\n\t\t\tlet facets = facetFields.getIn([fieldIndex, 'facets']) || Immutable.List();\n\t\t\tfield.get('values').forEach(facetValue => {\n\t\t\t\tlet facetIndex = facets.findKey(facet => facet.get('value') === facetValue);\n\t\t\t\tfacetFields.setIn([fieldIndex, 'facets', facetIndex, 'checked'], true);\n\t\t\t});\n\t\t});\n\t})\n);\n\nexport const columnSelector = createSelector(\n\tsearchSelector,\n\tsearch => search.get('columns') || Immutable.List()\n);\n\nexport const rowSelector = createSelector(\n\tsearchSelector,\n\tsearch => search.get('rows') || Immutable.List()\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/tabSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport { currentPageSelector } from 'console/state/selectors/pageSelector.js';\nimport { currentTabNameSelector } from 'console/state/selectors/layoutSelector.js';\n\nconst tabDefsSelector = state => state.get('tabDefs');\n\nexport const shownTabNameSelector = createSelector(\n\tcurrentTabNameSelector,\n\tcurrentPageSelector,\n\t(tabName, page) => {\n\t\treturn tabName || page.getIn(['tabs', 0]);\n\t}\n);\n\nexport const tabSelector = createSelector(\n\ttabDefsSelector,\n\tshownTabNameSelector,\n\t(tabDefs, tabName) => tabDefs.get(tabName)\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/toolbarPropsSelector.js",
    "content": "import { createSelector } from 'reselect';\n// import Immutable from 'immutable';\n\nconst toolbarsSelector = props => props.toolbars;\nconst actionsSelector = props => props.actions;\nconst pageNameSelector = props => props.pageName;\nconst dirtySelector = props => props.dirty;\n\n// Combines actions and toolbar items\nexport const toolbarPropsSelector = createSelector(\n\ttoolbarsSelector,\n\tactionsSelector,\n\tpageNameSelector,\n\tdirtySelector,\n\t(toolbars, actions, pageName, dirty) => toolbars.map(toolbar =>\n\t\ttoolbar.set('items', toolbar.get('items').map(item => {\n\t\t\tif (item.get('action') === 'save') {\n\t\t\t\treturn item.withMutations(item => {\n\t\t\t\t\titem.set('action', actions.save(pageName));\n\t\t\t\t\titem.set('disabled', !dirty);\n\t\t\t\t});\n\t\t\t} else if (item.get('type') === 'select' || item.get('type') === 'checkboxGroup') {\n\t\t\t\treturn item.set('onChange', actions.setOption(item.get('name')));\n\t\t\t} else {\n\t\t\t\treturn item.set('action', actions.fireAction(item.get('action'), pageName));\n\t\t\t}\n\t\t}))\n\t)\n);\n"
  },
  {
    "path": "Website/Composite/console/state/selectors/toolbarSelector.js",
    "content": "import { createSelector } from 'reselect';\nimport { currentPageSelector } from 'console/state/selectors/pageSelector.js';\nimport Immutable from 'immutable';\n\nconst toolbarDefSelector = state => state.get('toolbarDefs');\nconst itemDefSelector = state => state.get('itemDefs');\nconst optionsSelector = state => state.get('options');\n\nconst exists = x => x;\n\nexport const toolbarAssemblySelector = createSelector(\n\tcurrentPageSelector,\n\ttoolbarDefSelector,\n\titemDefSelector,\n\t(pageDef, toolbarDefs, itemDefs) =>\n\t\tpageDef.get('toolbars')\n\t\t\t.map(toolbarName => toolbarDefs.get(toolbarName))\n\t\t\t.filter(exists)\n\t\t\t.map(toolbar => {\n\t\t\t\tlet items = toolbar.get('items')\n\t\t\t\t\t.map(itemName => itemDefs.get(itemName))\n\t\t\t\t\t.filter(exists);\n\t\t\t\treturn toolbar.set('items', items);\n\t\t\t})\n);\n\nexport const toolbarSelector = createSelector(\n\ttoolbarAssemblySelector,\n\toptionsSelector,\n\t(toolbars, options) =>\n\t\ttoolbars.map(toolbar => {\n\t\t\tlet items = toolbar.get('items')\n\t\t\t\t.map(item => item.withMutations(item => {\n\t\t\t\t\tif (item.get('type') === 'select' || item.get('type') === 'checkboxGroup') {\n\t\t\t\t\t\tlet name = item.get('name');\n\t\t\t\t\t\tlet optionList = options.getIn(['lists', name]);\n\t\t\t\t\t\tif (optionList) {\n\t\t\t\t\t\t\titem.set('options', optionList);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet value = options.getIn(['values', name]);\n\t\t\t\t\t\tif (typeof value === 'undefined') {\n\t\t\t\t\t\t\tvalue = item.get('default') || '';\n\t\t\t\t\t\t}\n\t\t\t\t\t\titem.set('value', value);\n\t\t\t\t\t\tif (item.get('type') === 'checkboxGroup' && item.get('value') === '') {\n\t\t\t\t\t\t\titem.set('value', Immutable.List());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\treturn toolbar.set('items', items);\n\t\t})\n);\n"
  },
  {
    "path": "Website/Composite/console/state/store.js",
    "content": "import getHotReloadStore from 'systemjs-hot-reloader-store';\nimport { createStore, applyMiddleware, compose } from 'redux';\nimport { combineReducers } from 'redux-immutablejs';\nimport layout from 'console/state/reducers/layout.js';\nimport dataFields from 'console/state/reducers/dataFields.js';\nimport activity from 'console/state/reducers/activity.js';\nimport options from 'console/state/reducers/options.js';\nimport logs from 'console/state/reducers/logs.js';\nimport providers from 'console/state/reducers/providers.js';\nimport dialogData from 'console/state/reducers/dialog.js';\nimport getDefinitionReducer from 'console/state/reducers/definitions.js';\nimport thunk from 'redux-thunk';\nimport observers from 'console/state/observers.js';\nimport initState from 'console/state/initState.js';\nimport Immutable from 'immutable';\n\nlet reducers = {\n\tactivity,\n\tlayout,\n\tdataFields,\n\toptions,\n\tlogs,\n\tproviders,\n\tdialogData\n};\n[\n\t'page',\n\t'tab',\n\t'item',\n\t'toolbar',\n\t'fieldset',\n\t'dataField',\n\t'dialog',\n\t'dialogPane',\n\t'provider'\n].forEach(typeName => {\n\treducers[typeName + 'Defs'] = getDefinitionReducer(typeName);\n});\n\nconst consoleReducers = combineReducers(reducers);\n\nconst hotStore = getHotReloadStore('console:store');\n\nexport default function configureStore(initialState) {\n\tlet store = hotStore.prevStore;\n\tif (store && store.replaceReducer) {\n\t\tstore.replaceReducer(consoleReducers);\n\t} else {\n\t\tstore = createStore(consoleReducers, Immutable.fromJS(initialState), compose(\n\t\t\tapplyMiddleware(thunk),\n\t\t\tapplyMiddleware(observers),\n\t\t\twindow.devToolsExtension ? window.devToolsExtension() : f => f\n\t\t));\n\t\thotStore.prevStore = store;\n\t\tinitState(store);\n\t}\n\treturn store;\n}\n"
  },
  {
    "path": "Website/Composite/content/branding/about-company.inc",
    "content": "<ui:dialogpage label=\"${string:Website.Dialogs.About.Title}\" height=\"auto\" width=\"370\" resizable=\"false\">\n\t<div id=\"about\">\n\t\t<div id=\"info\">\n\t\t\t<ui:cover id=\"infocover\" busy=\"false\" hidden=\"true\" />\n\t\t\t<div id=\"prettyversion\">\n\t\t\t\t${pretty}\n\t\t\t</div>\n\t\t\t<div id=\"version\">\n\t\t\t\tBuild no. ${version}\n\t\t\t</div>\n\t\t\t<div id=\"copyright\">\n\t\t\t\t© ${year} Orckestra Inc\n\t\t\t</div>\n\t\t\t<br />\n\t\t\t<div>\n\t\t\t\t<input id=\"id\" onclick=\"this.select()\" readonly=\"readonly\" value=\"${id}\" /> Installation ID:\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"credits\">\n\t\t\t<div id=\"roll\">\n\t\t\t\t<a href=\"https://cms.orckestra.com/\" target=\"cmsorckestracom\">\n                    <div class=\"logo-wrapper\">\n                        <div id=\"logo1\" class=\"brand-logo dark\"></div>\n                    </div>\n </a>\n        <h2>Credits</h2>\n        <p>C1 CMS is developed by <a href=\"http://www.orckestra.com/\">Orckestra Inc</a>.</p>\n\t\t\t\t<h2>Visual Editor</h2>\n\t\t\t\t<p>\n\t\t\t\t\tpowered by<br />\n\t\t\t\t\t<a href=\"http://tinymce.moxiecode.com/\" target=\"_blank\" title=\"Visit Moxicode\">TinyMCE</a>\n\t\t\t\t</p>\n\t\t\t\t<h2>Source Editor</h2>\n\t\t\t\t<p>\n\t\t\t\t\tpowered by<br />\n\t\t\t\t\t<a href=\"http://codemirror.net/\" target=\"_blank\" title=\"Visit CodeMirror\">CodeMirror</a>\n\t\t\t\t</p>\n\t\t\t\t<h2>Function Previews</h2>\n\t\t\t\t<p>\n\t\t\t\t\tpowered by<br />\n\t\t\t\t\t<a href=\"http://phantomjs.org/\" target=\"_blank\" title=\"Visit PhantomJS\">PhantomJS</a>\n\t\t\t\t</p>\n\t\t\t\t<h2>SVG Icons</h2>\n\t\t\t\t<p>\n\t\t\t\t\tdesigned by<br />\n\t\t\t\t\t<a href=\"http://www.orckestra.com/\" target=\"_blank\" title=\"Visit Orckestra\">Orckestra</a><br />\n\t\t\t\t\t<a href=\"http://www.freepik.com/\" target=\"_blank\" title=\"Visit Freepik\">Freepik</a>\n\t\t\t\t</p>\n\t\t\t\t<div id=\"names\">\n                    <div class=\"logo-wrapper logo2\">\n\t\t\t\t\t    <div id=\"logo2\" class=\"brand-logo dark\">\n\t\t\t\t\t</div>\n                    </div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div id=\"fade\">\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<ui:dialogtoolbar>\n\t\t<ui:toolbarbody equalsize=\"true\">\n\t\t\t<ui:toolbargroup>\n\t\t\t\t<ui:clickbutton id=\"buttonAccept\" label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\" class=\"pull-right\" />\n\t\t\t\t<ui:clickbutton id=\"buttonCredits\" label=\"${string:Website.Dialogs.About.LabelCredits}\" focusable=\"true\" oncommand=\"About.credits ()\" />\n\t\t\t</ui:toolbargroup>\n\t\t</ui:toolbarbody>\n\t</ui:dialogtoolbar>\n\t<script type=\"text/javascript\" src=\"About.js\"></script>\n</ui:dialogpage>\n"
  },
  {
    "path": "Website/Composite/content/branding/brand-main.inc",
    "content": ""
  },
  {
    "path": "Website/Composite/content/branding/company-logo-branded.inc",
    "content": ""
  },
  {
    "path": "Website/Composite/content/branding/company-logo.inc",
    "content": "<div class=\"company-logo-wrapper\">\n\t<img src=\"../Composite/images/Orckestra-Black.svg\" alt=\"logo\" />\n</div>"
  },
  {
    "path": "Website/Composite/content/branding/includes.inc",
    "content": ""
  },
  {
    "path": "Website/Composite/content/branding/logo-branded.inc",
    "content": ""
  },
  {
    "path": "Website/Composite/content/branding/logo.inc",
    "content": "<div class=\"brand-logo-wrapper\">\n    <div class=\"brand-logo\"></div>\n</div>"
  },
  {
    "path": "Website/Composite/content/branding/start-page-content.inc",
    "content": "﻿<ui:page binding=\"StartPageBinding\">\n\t<ui:controlgroup id=\"controlgroup\">\n\t\t<ui:control binding=\"DialogControlBinding\" id=\"closecontrol\" controltype=\"close\"/>\n\t</ui:controlgroup>\n\t<ui:cover id=\"cover\" busy=\"false\" transparent=\"true\"/>\n\t<ui:window id=\"start\"/>\n</ui:page>"
  },
  {
    "path": "Website/Composite/content/branding/start-page-js.inc",
    "content": "﻿<script type=\"text/javascript\" src=\"StartPageBinding.js\"></script>"
  },
  {
    "path": "Website/Composite/content/dialogs/about/About.js",
    "content": "/**\r\n * @class\r\n */\r\nvar About = new function () {\r\n\t\r\n\tthis._isCredits = false;\r\n\tthis._y = 0;\r\n\tthis._i = 1;\r\n\t\r\n\t/*\r\n\t * Make text selectable!\r\n\t */\r\n\tDocumentManager.isDocumentSelectable = true;\r\n\t\r\n\t/**\r\n\t * @implements {ILoadHandler}\r\n\t */\r\n\tthis.fireOnLoad = function () {\r\n\t\t\r\n\t\tvar div0 = document.getElementById ( \"prettyversion\" );\r\n\t\tvar div1 = document.getElementById ( \"version\" );\r\n\t\tvar idfield = document.getElementById(\"id\");\r\n\t\tvar copyright = document.getElementById(\"copyright\");\r\n\t\t\r\n\t\tdiv0.firstChild.data = div0.firstChild.data.replace ( \"${pretty}\", Installation.applicationName );\r\n\t\tdiv1.firstChild.data = div1.firstChild.data.replace ( \"${version}\", Installation.versionString );\r\n\t\tidfield.value = idfield.value.replace(\"${id}\", Installation.installationID);\r\n\t\tcopyright.firstChild.data = copyright.firstChild.data.replace(\"${year}\", new Date().getFullYear());\r\n\t\t\r\n\t\tDOMEvents.addEventListener ( window, DOMEvents.UNLOAD, this );\r\n\t\tDOMEvents.addEventListener ( document, DOMEvents.MOUSEOVER, this );\r\n\t\tDOMEvents.addEventListener ( document, DOMEvents.MOUSEOUT, this );\r\n\t}\r\n\t\r\n\t/**\r\n\t * @param {Event} e\r\n\t */\r\n\tthis.handleEvent = function ( e ) {\r\n\t\t\r\n\t\tswitch ( e.type ) {\r\n\t\t\t\r\n\t\t\tcase DOMEvents.UNLOAD :\r\n\t\t\t\tif ( this._isCredits ) {\r\n\t\t\t\t\ttop.clearInterval ( this._interval );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.MOUSEOVER : \r\n\t\t\t\tif ( this._isCredits ) {\r\n\t\t\t\t\tvar target = DOMEvents.getTarget ( e );\r\n\t\t\t\t\tif ( target.nodeName.toLowerCase () == \"a\" ) {\r\n\t\t\t\t\t\tthis._i = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\t\tif ( this._isCredits ) {\r\n\t\t\t\t\tvar target = DOMEvents.getTarget ( e );\r\n\t\t\t\t\tif ( target.nodeName.toLowerCase () == \"a\" ) {\r\n\t\t\t\t\t\tthis._i = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis.credits = function () {\r\n\t\t\r\n\t\tif ( !this._isSwitching ) {\r\n\t\t\t\r\n\t\t\tif ( !this._isCredits ) {\r\n\t\t\t\t\r\n\t\t\t\tthis._isSwitching = true;\r\n\t\t\t\tif ( !this._hasCredits ) {\r\n\t\t\t\t\tthis._buildCredits ();\r\n\t\t\t\t\tthis._hasCredits = true;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tthis._isCredits = true;\r\n\t\t\t\t\r\n\t\t\t\tvar cover = bindingMap.infocover;\r\n\t\t\t\tcover.bindingElement.style.display = \"block\";\r\n\t\t\t\tCoverBinding.fadeIn ( cover );\r\n\t\t\t\t\r\n\t\t\t\tthis._y = 0;\r\n\t\t\t\tthis._i = 1;\r\n\t\t\t\t\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tvar button = window.bindingMap.buttonCredits;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tbutton.setLabel ( \"${string:Website.Dialogs.About.LabelBack}\" ); \r\n\t\t\t\t\tbutton.setImage ( \"${icon:back}\" );\r\n\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\tdocument.getElementById ( \"info\" ).style.display = \"none\";\r\n\t\t\t\t\t\tself._interval = top.setInterval ( function () {\r\n\t\t\t\t\t\t\tself.tick ();\r\n\t\t\t\t\t\t}, 25 );\r\n\t\t\t\t\t\tself._isSwitching = false;\r\n\t\t\t\t\t}, 500 );\r\n\t\t\t\t}, 500 );\r\n\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\tthis._back ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis._buildCredits = function () {\r\n\t\t\r\n\t\tvar credits = new List ( InstallationService.GetCreditsInfo ( true ));\r\n\t\tvar div = document.getElementById ( \"names\" );\r\n\t\t\r\n\t\tcredits.each ( function ( category ) {\r\n\t\t\t\r\n\t\t\tvar h2 = document.createElement ( \"h2\" );\r\n\t\t\tvar p = document.createElement ( \"p\" );\r\n\t\t\t\r\n\t\t\th2.appendChild ( document.createTextNode ( category.Key ));\r\n\t\t\t\r\n\t\t\tvar names = new List ( category.Value.split ( \";\" )); \r\n\t\t\tnames.each ( function ( name, index ) {\r\n\t\t\t\tp.appendChild ( document.createTextNode ( name ));\r\n\t\t\t\tp.appendChild ( document.createElement ( \"br\" ));\r\n\t\t\t});\r\n\t\t\r\n\t\t\tdiv.appendChild ( h2 );\r\n\t\t\tdiv.appendChild ( p );\r\n\t\t});\r\n\t\t\r\n\t}\r\n\t\r\n\tthis.tick = function () {\r\n\t\t\r\n\t\ttry {\r\n\t\t\r\n\t\t\tvar roll = document.getElementById ( \"roll\" );\r\n\t\t\tif ( roll != null ) {\r\n\t\t\t\tif ( Math.abs ( this._y ) == roll.offsetHeight - ( 70 + 59 )) {\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\tself._back ( true );\r\n\t\t\t\t\t}, 500 );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._y -= this._i;\r\n\t\t\t\t\troll.style.top = this._y + \"px\";\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\ttop.clearInterval ( this._interval );\r\n\t\t\t}\r\n\t\t\r\n\t\t} catch ( exception ) {\r\n\t\t\ttop.clearInterval ( this._interval );\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis._back = function ( isEnd ) {\r\n\t\t\r\n\t\ttop.clearInterval ( this._interval );\r\n\t\t\r\n\t\tif ( this._isCredits ) {\r\n\t\t\t\r\n\t\t\tthis._isCredits = false;\r\n\t\t\t\t\r\n\t\t\tvar roll = document.getElementById ( \"roll\" );\r\n\t\t\tvar info = document.getElementById ( \"info\" );\r\n\t\t\troll.style.top = 0;\r\n\t\t\t\r\n\t\t\tvar cover = bindingMap.infocover;\r\n\t\t\tif ( Binding.exists ( cover )) {\r\n\t\t\t\tif ( isEnd ) {\r\n\t\t\t\t\tCoverBinding.fadeOut ( cover );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcover.bindingElement.style.opacity = \"0\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t\tinfo.style.display = \"block\";\r\n\t\t\t\r\n\t\t\tvar button = window.bindingMap.buttonCredits;\r\n\t\t\tif ( Binding.exists ( button )) {\r\n\t\t\t    button.setLabel( \"${string:Website.Dialogs.About.LabelCredits2}\" ); \r\n\t\t\t\tbutton.setImage ( false );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nWindowManager.fireOnLoad ( About );"
  },
  {
    "path": "Website/Composite/content/dialogs/about/about.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\t<title>Composite.Management.About</title>\r\n\t<control:styleloader runat=\"server\" />\r\n\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t<control:brandingSnippet runat=\"server\" SnippetName=\"includes\" />\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"about.css.aspx\" />\r\n</head>\r\n<body>\r\n\t <control:brandingSnippet runat=\"server\" SnippetName=\"about-company\" />\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/dialogs/about/about.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\ndiv#about {\r\n\theight: 250px;\r\n\tposition: relative;\r\n\toverflow: hidden;\r\n\tborder-top: solid 1px #ccc;\r\n}\r\n\r\ndiv#info {\r\n\tposition: absolute;\r\n\tz-index: 2;\r\n\tbottom: 0;\r\n\tline-height: 17px;\r\n\twidth: 100%;\r\n\tpadding: 0 25px 40px 25px;\r\n}\r\n\r\n#infocover {\r\n\twidth: 348px;\r\n\theight: 160px;\r\n\tbackground: #fff;\r\n}\r\n\r\ninput#id {\r\n\tfloat: right;\r\n\twidth: 235px;\r\n\tpadding: 3px 4px;\r\n\tmargin-top: -5px;\r\n\tborder: 1px solid #ccc;\r\n}\r\n\r\ndiv#version,\r\ndiv#copyright,\r\nui|toolbarbody,\r\nui|toolbargroup {\r\n\tfloat: none;\r\n}\r\n\r\n#roll {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\ttext-align: center;\r\n\tline-height: 20px;\r\n\tpadding-top: 220px;\r\n\tpadding-bottom: 100px;\r\n}\r\n\r\n.logo-wrapper {\r\n\tcursor: pointer;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 50%;\r\n\tmargin-left: -125px;\r\n}\r\n\r\n\r\n.logo-wrapper.logo2 {\r\n\tposition: absolute;\r\n\ttop: auto;\r\n\tbottom: 0;\r\n\theight: 141px;\r\n}\r\n\r\n.logo-wrapper.logo2 .brand-logo {\r\n\tmargin-top: 32px;\r\n}\r\n\r\n\r\n\r\n#credits ul,\r\n#credits p {\r\n\tmargin: 0 0 40px 0;\r\n}\r\n\r\n#credits h2 {\r\n\tfont-size: 100%;\r\n\tmargin: 40px 0 0 0;\r\n}\r\n\r\n#credits ul {\r\n\tlist-style: none;\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n}\r\n\r\n#credits li {\r\n\tdisplay: inline;\r\n}\r\n\r\n#credits a {\r\n\tfont-weight: bold;\r\n\tcursor: pointer;\r\n}\r\n\r\ndiv#fade {\r\n\tposition: absolute;\r\n\twidth: 100%;\r\n\theight: 250px;\r\n\tbottom: 0;\r\n\tleft: 0;\r\n\tz-index: 1;\r\n\t-webkit-box-shadow: inset 0 0 72px 8px rgba(255,255,255,1);\r\n\t-moz-box-shadow: inset 0 0 72px 8px rgba(255,255,255,1);\r\n\tbox-shadow: inset 0 0 72px 8px rgba(255,255,255,1);\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/dialogs/functions/EditFunctionCallDialogPageBinding.js",
    "content": "EditFunctionCallDialogPageBinding.prototype = new DialogPageBinding;\r\nEditFunctionCallDialogPageBinding.prototype.constructor = EditFunctionCallDialogPageBinding;\r\nEditFunctionCallDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\nEditFunctionCallDialogPageBinding.ID_BASICTAB = \"basictab\";\r\nEditFunctionCallDialogPageBinding.ID_ADVANCEDTAB = \"advancedtab\";\r\nEditFunctionCallDialogPageBinding.ID_MAINTABBOX = \"maintabbox\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction EditFunctionCallDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"EditFunctionCallDialogPageBinding\");\r\n\r\n\t/**\r\n\t  * Enable flexbox behavior.\r\n\t  * @type {boolean}\r\n\t  */\r\n\tthis.isFlexible = true;\r\n\r\n\t/** The main tabbox!\r\n\t * @type {TabBoxBinding}\r\n\t */\r\n\tthis._tabBoxBinding = null;\r\n\r\n\t/**\r\n\t * @type {Handler}\r\n\t */\r\n\tthis._successHandler = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditFunctionCallDialogPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[EditFunctionCallDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBindingAttach}\r\n */\r\nEditFunctionCallDialogPageBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tEditFunctionCallDialogPageBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.addActionListener ( ResponseBinding.ACTION_SUCCESS );\r\n\tthis.addActionListener ( ResponseBinding.ACTION_FAILURE );\r\n\tthis.addActionListener ( ResponseBinding.ACTION_OOOOKAY );\r\n}\r\n\r\n/**\r\n * @overwrites {PageBinding#onPageInitialize}\r\n */\r\nEditFunctionCallDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tvar box = this.bindingDocument.getElementById(EditFunctionCallDialogPageBinding.ID_MAINTABBOX);\r\n\tif (box != null) {\r\n\t\tthis._tabBoxBinding = UserInterface.getBinding(box);\r\n\t}\r\n\r\n\tEditFunctionCallDialogPageBinding.superclass.onBeforePageInitialize.call(this);\r\n}\r\n\r\n\r\n/**\r\n * @overwrites {PageBinding#onAfterPageInitialize}\r\n */\r\nEditFunctionCallDialogPageBinding.prototype.onAfterPageInitialize = function () {\r\n\r\n\tEditFunctionCallDialogPageBinding.superclass.onAfterPageInitialize.call(this);\r\n\t\r\n\tvar dialog = this.getAncestorBindingByType(DialogBinding, true);\r\n\tif (dialog != null) {\r\n\t\tvar dim = dialog.getDimension();\r\n\t\tvar pos = dialog.getPosition();\r\n\t\tvar newdim = dialog.getDimension();\r\n\t\tnewdim.w = this.getProperty(\"width\");\r\n\t\tnewdim.h = this.getProperty(\"height\");\r\n\t\tdialog.setDimension(newdim);\r\n\r\n\t\t//Fit height\r\n\t\tdialog._fit(true);\r\n\r\n\t\t//Flex height\r\n\t\tnewdim = dialog.getDimension();\r\n\t\tif (newdim.h > top.window.innerHeight) {\r\n\t\t\tnewdim.h = top.window.innerHeight;\r\n\t\t\tdialog.setDimension(newdim);\r\n\t\t\tdialog.reflex(true);\r\n\t\t}\r\n\r\n\r\n\t\t//Fit position\r\n\t\tpos.x = pos.x + (dim.w - newdim.w) / 2;\r\n\t\tpos.x = (pos.x + newdim.w > top.window.innerWidth) ? top.window.innerWidth - newdim.w : pos.x;\r\n\t\tpos.x = pos.x < 0 ? 0 : pos.x;\r\n\t\tpos.y = (pos.y + newdim.h > top.window.innerHeight) ? top.window.innerHeight - newdim.h : pos.y;\r\n\t\tpos.y = pos.y < 0 ? 0 : pos.y;\r\n\t\tdialog.setPosition(pos);\r\n\r\n\r\n\t}\r\n\r\n}\r\n\r\n\r\n\r\n/**\r\n * @overloads {DialogPageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nEditFunctionCallDialogPageBinding.prototype.handleAction = function (action) {\r\n\r\n\tEditFunctionCallDialogPageBinding.superclass.handleAction.call(this, action);\r\n\r\n\tvar binding = action.target;\r\n\tvar self = this;\r\n\r\n\tswitch (action.type) {\r\n\r\n\t\tcase ResponseBinding.ACTION_SUCCESS:\r\n\t\t\tif (this.bindingWindow.bindingMap.FunctionCallDesigner.getContentWindow() == binding.bindingWindow) {\r\n\t\t\t\tif (this._successHandler) this._successHandler();\r\n\t\t\t\tthis._successHandler = null;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase ResponseBinding.ACTION_FAILURE:\r\n\t\t\tthis._successHandler = null;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase ButtonBinding.ACTION_COMMAND:\r\n\t\t\tvar button = action.target;\r\n\t\t\tvar page = this.bindingWindow.bindingMap.renderingdialogpage;\r\n\t\t\tswitch (button.getID()) {\r\n\t\t\t\tcase \"advancedbutton\":\r\n\t\t\t\t\t//if (page.validateAllDataBindings()) {\r\n\t\t\t\t\t\tpage.bindingWindow.__doPostBack(\"Advanced\");\r\n\t\t\t\t\t//}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"basicbutton\":\r\n\t\t\t\t\tif (page.validateAllDataBindings()) {\r\n\t\t\t\t\t\tpage.postframe(\r\n\t\t\t\t\t\t\tfunction () {\r\n\t\t\t\t\t\t\t\tpage.bindingWindow.__doPostBack(\"Basic\");\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Post that frame. Somwhat hacky, eh?\r\n */\r\nEditFunctionCallDialogPageBinding.prototype.onOk = function () {\r\n\r\n\tvar advancedbutton = this.bindingWindow.bindingMap.advancedbutton;\r\n\tif (this.validateAllDataBindings()) {\r\n\t\tif (advancedbutton == undefined) {\r\n\t\t\tvar self = this;\r\n\t\t\tthis.postframe(\r\n\t\t\t\tfunction () {\r\n\t\t\t\t\tself.bindingWindow.__doPostBack(\"buttonAccept\");\r\n\t\t\t\t});\r\n\t\t} else {\r\n\t\t\tthis.bindingWindow.__doPostBack(\"buttonAccept\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Post that frame. Somwhat hacky, eh?\r\n */\r\nEditFunctionCallDialogPageBinding.prototype.postframe = function (successHandler) {\r\n\t\r\n\tif (successHandler) {\r\n\t\tthis._successHandler = successHandler;\r\n\t};\r\n\r\n\tvar win = this.bindingWindow.bindingMap.FunctionCallDesigner.getContentWindow();\r\n\t\r\n\tif ( win.bindingMap != null ) {\r\n\t\tvar page = win.bindingMap.functioneditorpage;\r\n\t\twin.DataManager.isDirty = true; // hacking away!\r\n\t\tpage.postMessage ( EditorPageBinding.MESSAGE_SAVE );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBindingAccept}\r\n */\r\nEditFunctionCallDialogPageBinding.prototype.onDialogAccept = function () {\r\n\t\r\n\tthis.response = Dialog.RESPONSE_ACCEPT;\r\n\tthis.result = new String ( \"\" );\r\n\t\r\n\tvar value = document.getElementById ( \"FunctionMarkup\" ).value;\r\n\t\r\n\tif ( value != \"\" ) {\r\n\t\tthis.result = value;\r\n\t}\r\n\t\r\n    EditFunctionCallDialogPageBinding.superclass.onDialogAccept.call ( this );\t\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/functions/editFunctionCall.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" Inherits=\"CompositeEditFunctionCall.EditFunctionCall\" EnableEventValidation=\"false\" ValidateRequest=\"false\" CodeFile=\"editFunctionCall.aspx.cs\" %>\r\n\r\n<%@ Import Namespace=\"Composite.Core.ResourceSystem\" %>\r\n<%@ Import Namespace=\"CompositeEditFunctionCall\" %>\r\n\r\n<%@ Register TagPrefix=\"aspui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n<%@ Register TagPrefix=\"control1\" Src=\"~/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionCallsDesigner.ascx\" TagName=\"FunctionCallDesigner\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n<control:httpheaders id=\"Httpheaders1\" runat=\"server\" />\r\n<head>\r\n\t<title>Composite.Management.Dialogs.Functions.EditFunctionCall</title>\r\n\t<control:styleloader id=\"Styleloader1\" runat=\"server\" />\r\n\t<control:scriptloader id=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n\t<asp:PlaceHolder ID=\"HeaderPlaceHolder\" runat=\"server\" />\r\n\t<script type=\"text/javascript\" src=\"EditFunctionCallDialogPageBinding.js\"></script>\r\n\r\n\t<script type=\"text/javascript\">\r\n\t\t/*\r\n\t\t * Hacks a bug where haywire would fire on dialog exit.\r\n\t\t */\r\n\t\tfunction exit() {\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tbindingMap.renderingdialogpage.onDialogAccept();\r\n\t\t\t\tApplication.unlock(window, true); // now what?\r\n\t\t\t}, 0);\r\n\t\t}\r\n\t</script>\r\n</head>\r\n<body>\r\n\t<form id=\"Form1\" runat=\"server\">\r\n\r\n\t\t<!-- this textbox contains the markup when Finish is clicked -->\r\n\t\t<div style=\"display: none;\">\r\n\t\t\t<textarea runat=\"server\" id=\"FunctionMarkup\"></textarea>\r\n\t\t\t<asp:PlaceHolder ID=\"DialogDoAcceptPlaceHolder\" runat=\"server\" Visible=\"false\">\r\n\t\t\t\t<ui:binding onattach=\"exit()\" />\r\n\t\t\t</asp:PlaceHolder>\r\n\t\t</div>\r\n\t\t<ui:dialogpage\r\n\t\t\tbinding=\"EditFunctionCallDialogPageBinding\"\r\n\t\t\tid=\"renderingdialogpage\"\r\n\t\t\timage=\"${icon:parameter_overloaded}\"\r\n\t\t\twidth=\"<% =ActiveTab == Tab.Basic? \"820\" : \"865\" %>\"\r\n\t\t\theight=\"<% =ActiveTab == Tab.Basic? \"100\" : \"610\" %>\"\r\n\t\t\tresizable=\"false\"\r\n\t\t\tlabel=\"<%= this.DialogLabel %>\"\r\n            class=\"with-top-toolbar <% =ActiveTab == Tab.Basic? \" functionview-basic\" : \" functionview-adv\" %>\">\r\n\t\t\t<asp:PlaceHolder runat=\"server\" ID=\"BasicPanel\">\r\n\t\t\t\t<ui:toolbar id=\"toolbar\">\r\n\t\t\t\t\t<ui:toolbarbody />\r\n\t\t\t\t\t<ui:toolbarbody id=\"switchtoolbargroup\">\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton id=\"advancedbutton\" label=\"${string:Website.Dialogs.EditFunction.AdvancedView}\" image=\"${icon:advanced}\" flip=\"true\" />\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t<ui:scrollbox>\r\n\t\t\t\t\t<asp:PlaceHolder ID=\"BasicContentPanel\" runat=\"server\"></asp:PlaceHolder>\r\n                    <asp:PlaceHolder ID=\"plhNoParameters\" runat=\"server\" Visible=\"false\">\r\n                        <div class=\"padded\">\r\n                            <%= StringResourceSystemFacade.GetString(\"Composite.Management\", \"Website.Dialogs.EditFunction.BasicView.NoParameters\") %>\r\n                        </div>\r\n                    </asp:PlaceHolder>\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t<div id=\"errors\" style=\"display: none\" class=\"updatezone\">\r\n\t\t\t\t\t<asp:PlaceHolder runat=\"server\" ID=\"plhErrors\"></asp:PlaceHolder>\r\n\t\t\t\t</div>\r\n\t\t\t</asp:PlaceHolder>\r\n\t\t\t<asp:HiddenField runat=\"server\" ID=\"hdnActiveTab\" Value=\"<%# hdnActiveTab.Value %>\"></asp:HiddenField>\r\n\t\t\t<asp:PlaceHolder ID=\"AdvancedPanel\" runat=\"server\">\r\n\t\t\t\t<control1:FunctionCallDesigner ID=\"FunctionCallDesigner\" runat=\"server\" />\r\n\t\t\t</asp:PlaceHolder>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\"\r\n\t\t\t\t\t\t\toncommand=\"bindingMap.renderingdialogpage.onOk ()\"\r\n\t\t\t\t\t\t\tcallbackid=\"buttonAccept\"\r\n                            class=\"primary\"\r\n                            focusable=\"true\" />\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\"\r\n\t\t\t\t\t\t\tresponse=\"cancel\"\r\n\t\t\t\t\t\t\tfocusable=\"true\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\r\n\t\t</ui:dialogpage>\r\n\t</form>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/dialogs/functions/editFunctionCall.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing System.Xml.Linq;\r\nusing Composite;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Functions;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.FunctionCallEditor;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\nnamespace CompositeEditFunctionCall\r\n{\r\n\tpublic enum Tab\r\n\t{\r\n\t\tBasic = 0,\r\n\t\tAdvanced = 1\r\n\t}\r\n\r\n\tpublic partial class EditFunctionCall : Composite.Core.WebClient.XhtmlPage\r\n\t{\r\n\t    private const string LogTitle = \"EditFunctionCall\";\r\n\r\n\t\tprotected void Page_Load(object sender, EventArgs e)\r\n\t\t{\r\n\t\t\tSetDesignerParameters();\r\n\r\n\t\t    string eventTarget = Request[\"__EVENTTARGET\"];\r\n\r\n            \r\n            if (eventTarget == \"Basic\")\r\n\t\t\t{\r\n\t\t\t\tvar functionCallsEvaluated = new List<XElement> { XElement.Parse(FunctionMarkupInState) };\r\n\t\t\t\tCheckBasicView(functionCallsEvaluated);\r\n\t\t\t\tif (BasicViewEnabled)\r\n\t\t\t\t{\r\n\r\n\t\t\t\t\tActiveTab = Tab.Basic;\r\n\t\t\t\t\tProcessWidgets(false);\r\n\t\t\t\t}\r\n\t\t\t}\r\n            else if (eventTarget == \"Advanced\")\r\n            {\r\n                ProcessWidgets(true, false, true);\r\n\r\n                ActiveTab = Tab.Advanced;\r\n\t\t\t}\r\n            else if (eventTarget == \"buttonAccept\")\r\n            {\r\n                if (ActiveTab == Tab.Basic && ValidateAndSaveBasicTab() ||\r\n                    ActiveTab == Tab.Advanced)\r\n                {\r\n                    FunctionMarkup.Value = FunctionMarkupInState;\r\n                    DialogDoAcceptPlaceHolder.Visible = true;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (BasicViewEnabled)\r\n                {\r\n                    ProcessWidgets(IsPostBack);\r\n                }\r\n            }\r\n\r\n\t\t    bool isBasicView = ActiveTab == Tab.Basic;\r\n\r\n\t\t\tFunctionCallDesigner.HasBasic = BasicViewEnabled;\r\n            BasicPanel.Visible = isBasicView;\r\n            AdvancedPanel.Visible = !isBasicView;\r\n\t\t}\r\n\r\n\t    private bool ProcessWidgets(bool processPost, bool showValidationErrors = false, bool ignoreValidationErrors = false)\r\n\t    {\r\n            XElement functionMarkup = XElement.Parse(FunctionMarkupInState);\r\n\r\n\t        string functionName = (string) functionMarkup.Attribute(\"name\");\r\n\t        IFunction function = FunctionFacade.GetFunction(functionName);\r\n\r\n\t        if (function.ParameterProfiles.All(p => p.WidgetFunction == null))\r\n\t        {\r\n\t            plhNoParameters.Visible = true;\r\n                return true;\r\n\t        }\r\n\r\n            var bindings = new Dictionary<string, object>();\r\n            var parameterNodes = FunctionMarkupHelper.GetParameterNodes(functionMarkup);\r\n\r\n            foreach (var parameterProfile in function.ParameterProfiles)\r\n            {\r\n                object parameterValue;\r\n\r\n                XElement parameterNode;\r\n\r\n\t            if (parameterNodes.TryGetValue(parameterProfile.Name, out parameterNode))\r\n\t            {\r\n                    parameterValue = FunctionMarkupHelper.GetParameterValue(parameterNode, parameterProfile);\r\n\t            }\r\n\t            else\r\n\t            {\r\n\t                parameterValue = parameterProfile.GetDefaultValue();\r\n\t            }\r\n\r\n                if (parameterProfile.Type.IsLazyGenericType() && parameterValue != null)\r\n                {\r\n                    parameterValue = parameterProfile.Type.GetProperty(\"Value\").GetGetMethod().Invoke(parameterValue, null);\r\n                }\r\n\r\n                bindings.Add(parameterProfile.Name, parameterValue);\r\n\t        }\r\n            \r\n            var formTreeCompiler = FunctionUiHelper.BuildWidgetForParameters(\r\n                function.ParameterProfiles.Where(p => !p.HideInSimpleView \r\n                    || (p.IsRequired && (!bindings.ContainsKey(p.Name) || bindings[p.Name] == null))),\r\n                bindings,\r\n                \"BasicView\" ,\r\n                \"\",\r\n                WebManagementChannel.Identifier);\r\n\r\n            var webUiControl = (IWebUiControl)formTreeCompiler.UiControl;\r\n\r\n            var webControl = webUiControl.BuildWebControl();\r\n\r\n            BasicContentPanel.Controls.Add(webControl);\r\n\r\n            if (!processPost)\r\n\t        {\r\n\t            webUiControl.InitializeViewState();\r\n\t            return true;\r\n\t        }\r\n\r\n            // Loading control's post data\r\n\t        LoadPostBackData(webControl);\r\n\r\n\t        var validationErrors = formTreeCompiler.SaveAndValidateControlProperties();\r\n\r\n\t        if (!ignoreValidationErrors)\r\n\t        {\r\n                // Validating required parameters\r\n\t            foreach (var parameterProfile in function.ParameterProfiles)\r\n\t            {\r\n\t                if (!validationErrors.ContainsKey(parameterProfile.Name)\r\n\t                    && parameterProfile.IsRequired\r\n\t                    && parameterProfile.WidgetFunction != null\r\n\t                    && (!bindings.ContainsKey(parameterProfile.Name) || bindings[parameterProfile.Name] == null))\r\n\t                {\r\n\t                    validationErrors.Add(parameterProfile.Name, new Exception(\r\n\t                        StringResourceSystemFacade.GetString(\"Composite.Management\", \"Validation.RequiredField\")));\r\n\t                }\r\n\t            }\r\n\r\n\r\n\t            if (validationErrors.Any())\r\n\t            {\r\n\t                if (showValidationErrors)\r\n\t                {\r\n\t                    ShowServerValidationErrors(formTreeCompiler, validationErrors);\r\n\t                }\r\n\r\n\t                return false;\r\n\t            }\r\n\t        }\r\n\r\n\t        foreach (var parameterProfile in function.ParameterProfiles)\r\n\t        {\r\n                XElement parameterNode;\r\n                parameterNodes.TryGetValue(parameterProfile.Name, out parameterNode);\r\n\r\n\t            object value = bindings[parameterProfile.Name];\r\n\r\n\t            if (!parameterProfile.IsRequired)\r\n\t            {\r\n\t                object defaultValue = parameterProfile.GetDefaultValue();\r\n                    if(value == defaultValue \r\n                       || (value != null && value.Equals(defaultValue))\r\n                       || (value is XNode && defaultValue is XNode && XElement.DeepEquals(value as XNode, defaultValue as XNode))\r\n                       || parameterProfile.WidgetFunction == null)\r\n\t                {\r\n\t                    if (parameterNode != null)\r\n\t                    {\r\n                            parameterNode.Remove();\r\n\t                    }\r\n\t                    continue;\r\n\t                }\r\n\t            }\r\n\r\n                FunctionMarkupHelper.SetParameterValue(functionMarkup, parameterProfile, value);\r\n\t        }\r\n\r\n\t        FunctionMarkupInState = functionMarkup.ToString();\r\n\r\n            return true;\r\n\t    }\r\n\r\n\r\n\r\n\t    private void LoadPostBackData(Control control)\r\n\t    {\r\n            if (control is IPostBackDataHandler)\r\n            {\r\n                (control as IPostBackDataHandler).LoadPostData(control.UniqueID, Request.Form);\r\n            }\r\n\r\n            foreach (Control childControl in control.Controls)\r\n            {\r\n                LoadPostBackData(childControl);\r\n            }\r\n\t    }\r\n\r\n\r\n\r\n        private void ShowServerValidationErrors(FormTreeCompiler formTreeCompiler, Dictionary<string, Exception> serverValidationErrors)\r\n        {\r\n            foreach (var serverValidationError in serverValidationErrors)\r\n            {\r\n                string controlId = formTreeCompiler.GetBindingToClientIDMapping()[serverValidationError.Key];\r\n                string message = StringResourceSystemFacade.ParseString(serverValidationError.Value.Message);\r\n\r\n                plhErrors.Controls.Add(new FieldMessage(controlId, message));\r\n            }\r\n        }\r\n\r\n\t\tpublic Tab ActiveTab\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tTab tab;\r\n\t\t\t\tEnum.TryParse(hdnActiveTab.Value, out tab);\r\n\t\t\t\treturn tab;\r\n\t\t\t}\r\n\t\t\tset { hdnActiveTab.Value = ((int)value).ToString(); }\r\n\t\t}\r\n\r\n\t\tprivate bool ValidateAndSaveBasicTab()\r\n\t\t{\r\n\t\t    return ProcessWidgets(true, true);\r\n\t\t}\r\n\r\n\t\tprivate void CheckBasicView(ICollection<XElement> functionCallsEvaluated)\r\n\t\t{\r\n            BasicViewEnabled = BasicViewApplicable(functionCallsEvaluated);\r\n\t\t}\r\n\r\n        private bool BasicViewApplicable(ICollection<XElement> functionCallsEvaluated)\r\n\t    {\r\n            // Basic view is enabled if \r\n            // - Only one function is being edited\r\n            // - here's no parameters defined as function calls\r\n            // - And there no required parameters without widgets\r\n\r\n            if (MultiMode || IsWidgetSelection || functionCallsEvaluated.Count != 1)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            var functionMarkup = functionCallsEvaluated.Single();\r\n\r\n            if (functionMarkup\r\n                 .Elements()\r\n                 .Any(childElement => childElement.Elements().Any(e => e.Name.LocalName == \"function\")))\r\n            {\r\n                return false;\r\n            }\r\n\r\n            string functionName = (string)functionMarkup.Attribute(\"name\");\r\n            var function = FunctionFacade.GetFunction(functionName);\r\n\r\n            if (function == null)\r\n            {\r\n                return false;\r\n            }\r\n            \r\n            return !function.ParameterProfiles.Any(p => p.IsRequired && p.WidgetFunction == null && !p.IsInjectedValue);\r\n\t    }\r\n\r\n\t\tprivate void SetDesignerParameters()\r\n\t\t{\r\n\t\t    if (IsPostBack) return;\r\n\r\n\t\t    string typeName = Request.QueryString[\"type\"];\r\n\r\n\t\t    if (typeName.IsNullOrEmpty())\r\n\t\t    {\r\n\t\t        typeName = UrlUtils.UnZipContent(Request.QueryString[\"zip_type\"]);\r\n\t\t    }\r\n\r\n\t\t    Type resultType = typeName == null ? typeof(object) : TypeManager.GetType(typeName);\r\n\r\n\r\n\t\t    IsWidgetSelection = Request.QueryString[\"functiontype\"] == \"widget\";\r\n\r\n\t\t    Guid stateId = Guid.NewGuid();\r\n\r\n\t\t    var state = new FunctionCallEditorStateSimple();\r\n\r\n\t\t    IEnumerable<XElement> functionCalls = GetFunctionElementsFromQueryString();\r\n\t\t    var functionCallsEvaluated = functionCalls.Evaluate();\r\n\r\n            state.FunctionCallsXml = new XElement(\"functions\", functionCallsEvaluated).ToString();\r\n\t\t    state.MaxFunctionAllowed = MultiMode ? 1000 : 1;\r\n\t\t    state.AllowedResultTypes = new[] { resultType };\r\n\t\t    state.WidgetFunctionSelection = IsWidgetSelection;\r\n\t\t    state.ConsoleId = Request.QueryString[\"consoleid\"] ?? string.Empty;\r\n\r\n\t\t    SessionStateManager.DefaultProvider.AddState<IFunctionCallEditorState>(stateId, state, DateTime.Now.AddDays(7.0));\r\n\r\n\t\t    FunctionCallDesigner.SessionStateProvider = SessionStateManager.DefaultProviderName;\r\n\t\t    FunctionCallDesigner.SessionStateId = stateId;\r\n            \r\n\t\t    SessionStateId = stateId;\r\n\r\n\t\t\tCheckBasicView(functionCallsEvaluated);\r\n\r\n            ActiveTab = BasicViewEnabled ? Tab.Basic : Tab.Advanced;\r\n\t\t}\r\n\r\n        private IEnumerable<XElement> GetFunctionElementsFromQueryString()\r\n\t\t{\r\n\t\t\tstring functionMarkup = this.Request.QueryString[\"functionMarkup\"];\r\n\r\n\t\t\tif (string.IsNullOrEmpty(functionMarkup))\r\n\t\t\t{\r\n\t\t\t\tfunctionMarkup = this.Request.Form[\"functionMarkup\"];\r\n\t\t\t}\r\n\r\n\t\t\tconst string ZipPrefix = \"ZIP_\";\r\n\t\t\tif (functionMarkup != null && functionMarkup.StartsWith(ZipPrefix))\r\n\t\t\t{\r\n\t\t\t\tfunctionMarkup = UrlUtils.UnZipContent(functionMarkup.Substring(ZipPrefix.Length));\r\n\t\t\t}\r\n\r\n\t\t\treturn GetFunctionElements(functionMarkup);\r\n\t\t}\r\n\r\n\t\tprivate IEnumerable<XElement> GetFunctionElements(string functionMarkup)\r\n\t\t{\r\n\t\t\tif (!string.IsNullOrEmpty(functionMarkup) && functionMarkup != \"null\")\r\n\t\t\t{\r\n\t\t\t\tXElement functionElement = XElement.Parse(functionMarkup);\r\n\r\n\t\t\t\tif (functionElement.Name.Namespace == Namespaces.Function10)\r\n\t\t\t\t{\r\n\t\t\t\t\tyield return functionElement;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tforeach (XElement multiFunctionElement in functionElement.Elements())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tVerify.That(multiFunctionElement.Name.Namespace == Namespaces.Function10,\r\n\t\t\t\t\t\t\t\t\t\"Nested function elements does not belong to expected namespace\");\r\n\r\n\t\t\t\t\t\tyield return multiFunctionElement;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprotected string DialogLabel\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\treturn Request.QueryString[\"dialoglabel\"] ?? StringResourceSystemFacade.GetString(\"Composite.Web.FormControl.FunctionCallsDesigner\", \"DialogTitle\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprotected bool MultiMode\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\treturn bool.Parse(Request.QueryString[\"multimode\"] ?? \"false\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprivate bool IsWidgetSelection\r\n\t\t{\r\n\t\t\tget { return (bool)ViewState[\"IsWidgetSelection\"]; }\r\n\t\t\tset { ViewState[\"IsWidgetSelection\"] = value; }\r\n\t\t}\r\n\r\n\t\tprivate Guid SessionStateId\r\n\t\t{\r\n\t\t\tget { return (Guid)ViewState[\"SessionStateId\"]; }\r\n\t\t\tset { ViewState[\"SessionStateId\"] = value; }\r\n\t\t}\r\n\r\n\t    protected bool BasicViewEnabled\r\n        {\r\n            get { return (bool) ViewState[\"BasicViewEnabled\"]; }\r\n            set { ViewState[\"BasicViewEnabled\"] = value; }\r\n        }\r\n\r\n\t\tprotected string FunctionMarkupInState\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tIFunctionCallEditorState state;\r\n\t\t\t\tif (!SessionStateManager.DefaultProvider.TryGetState<IFunctionCallEditorState>(SessionStateId, out state))\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new InvalidOperationException(\"Failed to get session state\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstring functionMarkup = \"\";\r\n\r\n\t\t\t\tforeach (NamedFunctionCall functionCall in state.FunctionCalls)\r\n\t\t\t\t{\r\n\t\t\t\t\tXElement serializedFunctionCall = functionCall.FunctionCall.Serialize();\r\n\r\n\t\t\t\t\tvar nestedFunctions = serializedFunctionCall.Descendants(Namespaces.Function10 + \"function\").Where(\r\n\t\t\t\t\t\tf => f.Parent.Name.Namespace != Namespaces.Function10 && f.Attribute(XNamespace.Xmlns + \"f\") == null).ToList();\r\n\r\n\t\t\t\t\tforeach (var nestedFunction in nestedFunctions)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tnestedFunction.Add(new XAttribute(XNamespace.Xmlns + \"f\", Namespaces.Function10));\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfunctionMarkup += serializedFunctionCall.ToString();\r\n\r\n\t\t\t\t\tif (!this.MultiMode) break;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (this.MultiMode && !string.IsNullOrEmpty(functionMarkup))\r\n\t\t\t\t{\r\n\t\t\t\t\tfunctionMarkup = string.Format(\"<functions>{0}</functions>\", functionMarkup);\r\n\t\t\t\t}\r\n\t\t\t\treturn functionMarkup;\r\n\t\t\t}\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tIFunctionCallEditorState state;\r\n\t\t\t\tif (!SessionStateManager.DefaultProvider.TryGetState(SessionStateId, out state))\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new InvalidOperationException(\"Failed to get session state\");\r\n\t\t\t\t}\r\n\t\t\t\t(state as FunctionCallEditorStateSimple).FunctionCallsXml = new XElement(\"functions\", GetFunctionElements(value)).ToString(); ;\r\n\t\t\t\tSessionStateManager.DefaultProvider.SetState<IFunctionCallEditorState>(SessionStateId, state, DateTime.Now.AddDays(7.0));\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/functions/editFunctionCall.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace CompositeEditFunctionCall {\r\n    \r\n    \r\n    public partial class EditFunctionCall {\r\n        \r\n        /// <summary>\r\n        /// HeaderPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder HeaderPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// Form1 control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.HtmlControls.HtmlForm Form1;\r\n        \r\n        /// <summary>\r\n        /// FunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.HtmlControls.HtmlTextArea FunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// DialogDoAcceptPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder DialogDoAcceptPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// hdnActiveTab control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.HiddenField hdnActiveTab;\r\n        \r\n        /// <summary>\r\n        /// BasicPanel control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder BasicPanel;\r\n        \r\n        /// <summary>\r\n        /// BasicContentPanel control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder BasicContentPanel;\r\n        \r\n        /// <summary>\r\n        /// plhNoParameters control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhNoParameters;\r\n        \r\n        /// <summary>\r\n        /// plhErrors control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhErrors;\r\n        \r\n        /// <summary>\r\n        /// AdvancedPanel control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder AdvancedPanel;\r\n        \r\n        /// <summary>\r\n        /// FunctionCallDesigner control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::CompositeFunctionCallsDesigner.FunctionCallsDesigner FunctionCallDesigner;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/dialogs/imageeditor/scaleimage/ScaleImageDialogPageBinding.js",
    "content": "ScaleImageDialogPageBinding.prototype = new DialogPageBinding;\r\nScaleImageDialogPageBinding.prototype.constructor = ScaleImageDialogPageBinding;\r\nScaleImageDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ScaleImageDialogPageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ScaleImageDialogPageBinding\" );\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nScaleImageDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tvar arg = this.pageArgument;\r\n\r\n\tvar ratio = arg.width / arg.height;\r\n\tvar isFixedRatio = true;\r\n\t\r\n\tbindingMap.width.setValue ( arg.width );\r\n\tbindingMap.height.setValue ( arg.height );\r\n\t\r\n\t/*\r\n\t * Dimensions.\r\n\t */\r\n\tbindingMap.dimensions.onValueChange = function () {\r\n\t\tisFixedRatio = this.getValue () == \"fixed\";\r\n\t\tbindingMap.width.onValueChange ();\r\n\t}\r\n\t\r\n\t/*\r\n\t * Unit.\r\n\t */\r\n\tbindingMap.unit.onValueChange = function () {\r\n\t\tswitch ( this.getValue ()) {\r\n\t\t\tcase \"pixels\" :\r\n\t\t\t\tbindingMap.width.setValue ( arg.width );\r\n\t\t\t\tbindingMap.height.setValue ( arg.height );\t\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"percent\" :\r\n\t\t\t\tbindingMap.width.setValue ( \"100\" );\r\n\t\t\t\tbindingMap.height.setValue ( \"100\" );\t\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * Width.\r\n\t */\r\n\tbindingMap.width.onValueChange = function () {\r\n\t\tif ( isFixedRatio ) {\r\n\t\t\tvar val = this.getValue ();\r\n\t\t\tif ( bindingMap.unit.getValue () ==  \"pixels\" ) {\r\n\t\t\t\tval = Math.round ( val / ratio )\r\n\t\t\t}\r\n\t\t\tbindingMap.height.setValue ( val );\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * Height.\r\n\t */\r\n\tbindingMap.height.onValueChange = function () {\r\n\t\tif ( isFixedRatio ) {\r\n\t\t\tbindingMap.width.setValue ( \r\n\t\t\t\tMath.round ( this.getValue () * ratio )\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\t\r\n\t// superduper\r\n\tScaleImageDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Set result on dialog accept.\r\n * @overloads {DialogPageBinding#onDialogAccept}\r\n */\r\nScaleImageDialogPageBinding.prototype.onDialogAccept = function () {\r\n\t\r\n\tvar width = bindingMap.width.getResult ();\r\n\tvar height = bindingMap.height.getResult ();\r\n\t\r\n\tthis.result = {\r\n\t\tunit : bindingMap.unit.getValue () == \"percent\" ? \"%\" : \"px\",\r\n\t\twidth : width,\r\n\t\theight : height\r\n\t}\r\n\t\r\n\tScaleImageDialogPageBinding.superclass.onDialogAccept.call ( this );\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/dialogs/imageeditor/scaleimage/scaleimage.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.ImageEditor.ScaleImage</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\" src=\"ScaleImageDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"ScaleImageDialogPageBinding\"\r\n\t\t\tlabel=\"${string:Website.Dialogs.ImageEditor.ScaleImage.LabelScaleImage}\" \r\n\t\t\timage=\"${icon:scale}\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:fields>\r\n\t\t\t\t\t<ui:fieldgroup label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.LabelImageSize}\">\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.LabelDimensions}\"/>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:selector id=\"dimensions\">\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.LabelFixedRatio}\" value=\"fixed\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.LabelFreeResize}\" value=\"free\"/>\r\n\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.Unit}\"/>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:selector id=\"unit\">\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.LabelPixels}\" value=\"pixels\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.LabelPercent}\" value=\"percent\"/>\r\n\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.Width}\"/>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput id=\"width\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Website.Dialogs.ImageEditor.ScaleImage.Height}\"/>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput id=\"height\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" id=\"buttonAccept\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t\t\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/multiselector/MultiSelectorDialogPageBinding.js",
    "content": "MultiSelectorDialogPageBinding.prototype = new DialogPageBinding;\r\nMultiSelectorDialogPageBinding.prototype.constructor = MultiSelectorDialogPageBinding;\r\nMultiSelectorDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction MultiSelectorDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MultiSelectorDialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * This property is provided as page argument \r\n\t * and will page returned as dialog result.\r\n\t * @type {List<SelectorBindingSelection>}\r\n\t */\r\n\tthis._selections = null;\r\n\t\r\n\t/**\r\n\t * The left selector.\r\n\t * @type {MultiSelectorBinding}\r\n\t */\r\n\tthis._left = null;\r\n\t\r\n\t/**\r\n\t * The right selector.\r\n\t * @type {MultiSelectorBinding}\r\n\t */\r\n\tthis._left = null;\r\n\t\r\n\t/**\r\n\t * The left broadcaster.\r\n\t * @type {BroadcasterBinding}\r\n\t */\r\n\tthis._broadcasterLeft = null;\r\n\t\r\n\t/**\r\n\t * The right broadcaster.\r\n\t * @type {BroadcasterBinding}\r\n\t */\r\n\tthis._broadcasterLeft = null;\r\n\t\r\n\t/**\r\n\t * The up broadcaster.\r\n\t * @type {BroadcasterBinding}\r\n\t */\r\n\tthis._broadcasterUp = null;\r\n\t\r\n\t/**\r\n\t * The down broadcaster.\r\n\t * @type {BroadcasterBinding}\r\n\t */\r\n\tthis._broadcasterDown = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMultiSelectorDialogPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[MultiSelectorDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {object} arg\r\n */\r\nMultiSelectorDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tMultiSelectorDialogPageBinding.superclass.setPageArgument.call ( this );\r\n\t\r\n\tthis.label = arg.label;\r\n\tthis._selections = arg.selections;\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nMultiSelectorDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tthis.addActionListener ( MultiSelectorBinding.ACTION_SELECTIONCHANGED );\r\n\t\r\n\tvar map = this.bindingWindow.bindingMap;\r\n\t\r\n\t/*\r\n\t * Locate key players.\r\n\t */\r\n\tthis._left = map.leftselector;\r\n\tthis._right = map.rightselector;\r\n\tthis._broadcasterRight = map.broadcasterRight;\r\n\tthis._broadcasterLeft = map.broadcasterLeft;\r\n\tthis._broadcasterUp = map.broadcasterUp;\r\n\tthis._broadcasterDown = map.broadcasterDown;\r\n\t\r\n\t/*\r\n\t * Setup doubleclick.\r\n\t */\r\n\tDOMEvents.addEventListener ( this._left.bindingElement, DOMEvents.DOUBLECLICK, this );\r\n\tDOMEvents.addEventListener ( this._right.bindingElement, DOMEvents.DOUBLECLICK, this );\r\n\t\r\n\t/*\r\n\t * Populate selectors. Left selector is rigged to show unselected selections.\r\n\t */\r\n\tif ( this._selections.hasEntries ()) {\r\n\t\tthis._left.populateFromList ( this._selections );\r\n\t\tthis._right.populateFromList ( this._selections );\r\n\t}\r\n\t\r\n\tMultiSelectorDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nMultiSelectorDialogPageBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tMultiSelectorDialogPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\tvar id = binding.bindingElement.id;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\r\n\t\t/*\r\n\t\t * Listener added by PageBinding superclass\r\n\t\t */\r\n\t\tcase ButtonBinding.ACTION_COMMAND : \r\n\t\t\r\n\t\t\tswitch ( id ) {\r\n\t\t\t\tcase \"rightbutton\" :\r\n\t\t\t\tcase \"leftbutton\" :\r\n\t\t\t\tcase \"upbutton\" :\r\n\t\t\t\tcase \"downbutton\" :\r\n\t\t\t\t\tthis._handleButton ( binding );\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\t/*\r\n\t\t * Updating buttons when selection changes.\r\n\t\t */\r\n\t\tcase MultiSelectorBinding.ACTION_SELECTIONCHANGED :\r\n\t\t\r\n\t\t\tthis._broadcasterRight.setDisabled ( !this._right.hasHighlight ());\r\n\t\t\tthis._broadcasterLeft.setDisabled ( !this._left.hasHighlight ());\r\n\t\t\tthis._updateUpDownBroadcasters ();\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tMultiSelectorDialogPageBinding.superclass.handleAction.call ( this, action );\r\n}\r\n\r\n/**\r\n * @param {ClickButtonBinding} binding\r\n */\r\nMultiSelectorDialogPageBinding.prototype._handleButton = function ( binding ) {\r\n\r\n\tswitch ( binding.bindingElement.id ) {\r\n\t\tcase \"rightbutton\" :\r\n\t\t\tthis._right.cumulateFromList ( this._left.extractSelected (), true );\r\n\t\t\tbreak;\r\n\t\tcase \"leftbutton\" :\r\n\t\t\tthis._left.cumulateFromList ( this._right.extractSelected (), true );\r\n\t\t\tbreak;\r\n\t\tcase \"upbutton\" :\r\n\t\t\tthis._right.reposition ( true );\r\n\t\t\tthis._updateUpDownBroadcasters ();\r\n\t\t\tbreak;\r\n\t\tcase \"downbutton\" :\r\n\t\t\tthis._right.reposition ( false );\r\n\t\t\tthis._updateUpDownBroadcasters ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#handleEvent}\r\n * @imlements {IEventHandler}\r\n * @param {MouseEvent} e\r\n */\r\nMultiSelectorDialogPageBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tMultiSelectorDialogPageBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.DOUBLECLICK :\r\n\t\t\tvar element = DOMEvents.getTarget ( e );\r\n\t\t\twhile ( DOMUtil.getLocalName ( element ) != \"multiselector\" ) {\r\n\t\t\t\telement = element.parentNode;\r\n\t\t\t}\r\n\t\t\tswitch ( element ) {\r\n\t\t\t\tcase this._left.bindingElement :\r\n\t\t\t\t\tthis._right.cumulateFromList ( this._left.extractSelected (), true );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase this._right.bindingElement :\r\n\t\t\t\t\tthis._left.cumulateFromList ( this._right.extractSelected (), true );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\t/*\r\n\tswitch ( DOMUtil.getTarget ( e )) {\r\n\t\tcase this._left.bindingElement :\r\n\t\t\talert ( \"LEFT\" )\r\n\t\t\tbreak;\r\n\t\tcase this._right.bindingElement :\r\n\t\t\talert ( \"RIGHT\" )\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t}\r\n\t*/\r\n}\r\n\r\n/**\r\n * Disable up-down buttons?\r\n */\r\nMultiSelectorDialogPageBinding.prototype._updateUpDownBroadcasters = function () {\r\n\t\r\n\tif ( !this._right.hasHighlight ()) {\r\n\t\tthis._broadcasterUp.setDisabled ( true );\r\n\t\tthis._broadcasterDown.setDisabled ( true );\r\n\t} else {\r\n\t\tvar list = this._right.toSelectionList ();\r\n\t\tif ( list.hasEntries ()) {\r\n\t\t\tthis._broadcasterUp.setDisabled ( list.getFirst ().isHighlighted );\r\n\t\t\tthis._broadcasterDown.setDisabled ( list.getLast ().isHighlighted );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Combine left and right selections into a list. This list \r\n * will be used to populate multiselector in original window.\r\n * @overloads {DialogPageBinding#onDialogAccept}\r\n */\r\nMultiSelectorDialogPageBinding.prototype.onDialogAccept = function () {\r\n\t\r\n\tthis.result = this._right.toSelectionList ();\r\n\tvar temp = this._left.toSelectionList ();\r\n\twhile ( temp.hasNext ()) {\r\n\t\tthis.result.add ( temp.getNext ());\r\n\t}\r\n\t\r\n\tMultiSelectorDialogPageBinding.superclass.onDialogAccept.call ( this );\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/multiselector/multiselectordialog.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.MultiSelectorDialog</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"MultiSelectorDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:broadcasterset>\r\n\t\t\t<ui:broadcaster id=\"broadcasterLeft\" isdisabled=\"true\"/>\r\n\t\t\t<ui:broadcaster id=\"broadcasterRight\" isdisabled=\"true\"/>\r\n\t\t\t<ui:broadcaster id=\"broadcasterUp\" isdisabled=\"true\"/>\r\n\t\t\t<ui:broadcaster id=\"broadcasterDown\" isdisabled=\"true\"/>\r\n\t\t</ui:broadcasterset>\r\n\t\t<ui:dialogpage width=\"560\" binding=\"MultiSelectorDialogPageBinding\" class=\"dialog-multiselector\">\r\n\t\t\t<ui:flexbox>\r\n\t\t\t\t<ui:fields>\r\n\t\t\t\t\t<ui:field class=\"left\">\r\n\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t<ui:multiselector \r\n\t\t\t\t\t\t\t\tid=\"leftselector\"\r\n\t\t\t\t\t\t\t\teditable=\"false\" \r\n\t\t\t\t\t\t\t\tselectable=\"true\" \r\n\t\t\t\t\t\t\t\tdisplay=\"unselected\"/>\r\n\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t<ui:box class=\"controls\">\r\n\t\t\t\t\t\t<ui:clickbutton label=\"►\" id=\"rightbutton\" observes=\"broadcasterLeft\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"◄\" id=\"leftbutton\" observes=\"broadcasterRight\"/>\r\n\t\t\t\t\t</ui:box>\r\n\t\t\t\t\t<ui:field class=\"right\">\r\n\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t<ui:multiselector \r\n\t\t\t\t\t\t\t\tid=\"rightselector\" \r\n\t\t\t\t\t\t\t\teditable=\"false\" \r\n\t\t\t\t\t\t\t\tselectable=\"true\"\r\n\t\t\t\t\t\t\t\tdisplay=\"selected\"/>\r\n\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t<ui:box class=\"controls\">\r\n\t\t\t\t\t\t<ui:clickbutton label=\"▲\" id=\"upbutton\" observes=\"broadcasterUp\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"▼\" id=\"downbutton\" observes=\"broadcasterDown\"/>\r\n\t\t\t\t\t</ui:box>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:flexbox>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\" id=\"buttonAccept\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/options/OptionsDialogPageBinding.js",
    "content": "OptionsDialogPageBinding.prototype = new DialogPageBinding;\r\nOptionsDialogPageBinding.prototype.constructor = OptionsDialogPageBinding;\r\nOptionsDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction OptionsDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"OptionsDialogPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nOptionsDialogPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[OptionsDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * On initialize.\r\n * @overloading {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nOptionsDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tbindingMap.login.setCheckedButtonBinding ( \r\n\t\tPreferences.getPref ( Preferences.LOGIN ) ? \r\n\t\t\tbindingMap.logintrue : \r\n\t\t\tbindingMap.loginfalse\r\n\t);\r\n\r\n\tOptionsDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * On accept.\r\n * @overloading {DialogPageBinding#onDialogAccept}\r\n */\r\nOptionsDialogPageBinding.prototype.onDialogAccept = function () {\r\n\t\r\n\tPreferences.setPref ( Preferences.LOGIN, bindingMap.logintrue.isChecked );\r\n\r\n\tOptionsDialogPageBinding.superclass.onDialogAccept.call ( this );\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/options/options.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t        <title>Composite.Management.Dialogs.Options</title>\r\n\t\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"OptionsDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage \r\n\t\t\tbinding=\"OptionsDialogPageBinding\" \r\n\t\t\timage=\"${icon:default}\" \r\n\t\t\tlabel=\"${string:Website.Dialogs.Options.LabelOptions}\" \r\n\t\t\tclass=\"tabboxed\">\r\n\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab label=\"${string:Website.Dialogs.Options.LabelGeneral}\"/>\r\n\t\t\t\t\t<ui:tab label=\"${string:Website.Dialogs.Options.LabelAdvanced}\"/>\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Website.Dialogs.Options.LabelLoginPreferences}\">\r\n\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Website.Dialogs.Options.LoginScreen}\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup id=\"login\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:radio id=\"logintrue\" name=\"logintrue\" label=\"${string:Website.Dialogs.Options.LabelFakeLoginScreen}\" value=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:radio id=\"loginfalse\" name=\"loginfalse\" label=\"${string:Website.Dialogs.Options.LabelNoLoginScreen}\" value=\"false\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t\t\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/postback/PostBackDialogPageBinding.js",
    "content": "PostBackDialogPageBinding.prototype = new DialogPageBinding;\r\nPostBackDialogPageBinding.prototype.constructor = PostBackDialogPageBinding;\r\nPostBackDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction PostBackDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PostBackDialogPageBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._url = null;\r\n\r\n\t/**\r\n\t * @type {List<object>}\r\n\t */\r\n\tthis._list = null;\r\n\r\n\t/**\r\n\t * @type {List<object>}\r\n\t */\r\n\tthis._method = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPostBackDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[PostBackDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @param {object} arg\r\n */\r\nPostBackDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\r\n\tPostBackDialogPageBinding.superclass.setPageArgument.call ( this, arg );\r\n\r\n\tthis._url = arg.url;\r\n\tthis._list = arg.list;\r\n\tthis._method = arg.method;\r\n}\r\n\r\n/**\r\n * Submit on ready. Investigations should be instigated\r\n * to further study how we can make this go a lot faster.\r\n * @overloads {DialogPageBinding#onAfterPageInitialize}\r\n */\r\nPostBackDialogPageBinding.prototype.onAfterPageInitialize = function() {\r\n\r\n\tPostBackDialogPageBinding.superclass.onAfterPageInitialize.call(this);\r\n\t//TODO\r\n\tif (this._method === \"get\") {\r\n\t\twindow.location = top.Resolver.resolve(this._url);\r\n\t} else\r\n\t{\r\n\t\tthis._submit();\r\n\t}\r\n}\r\n\r\n/**\r\n * Submit the data to the specified URL.\r\n */\r\nPostBackDialogPageBinding.prototype._submit = function () {\r\n\r\n\tvar form = this.bindingDocument.forms [ 0 ];\r\n\tform.action = top.Resolver.resolve(this._url);\r\n\r\n\tvar isDebugging = true;\r\n\tvar debug = \"Posting to: \" + form.action +\"\\n\\n\";\r\n\r\n\tthis._list.reset ();\r\n\twhile ( this._list.hasNext ()) {\r\n\r\n\t\tvar entry = this._list.getNext ();\r\n\t\tvar input = this.bindingDocument.createElement ( \"input\" );\r\n\r\n\t\tinput.name = entry.name;\r\n\t\tinput.value =  entry.value;\r\n\r\n\t\t// DELETE THIS NOW???\r\n\t\tinput.setAttribute ( \"name\", new String ( entry.name )); // FF4.0 beta bug!!!\r\n\t\tinput.setAttribute ( \"value\", new String ( entry.value )); // FF4.0 beta bug!!!\r\n\r\n\t\tinput.type = \"hidden\";\r\n\t\tform.appendChild ( input );\r\n\r\n\t\tif ( isDebugging ) {\r\n\t\t\tdebug += entry.name + \": \" + entry.value  + \"\\n\";\r\n\t\t}\r\n\t}\r\n\tif ( isDebugging ) {\r\n\t\tthis.logger.debug ( debug );\r\n\t}\r\n\tform.submit ();\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/postback/postbackdialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialog.PostBack</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"PostBackDialogPageBinding.js\"></script>\r\n\t\t<style type=\"text/css\">\r\n\t\t\tbody {\r\n\t\t\t\tcursor: wait !important;\r\n\t\t\t}\r\n\t\t</style>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"PostBackDialogPageBinding\" resizable=\"false\">\r\n\t\t\t<form action=\"javascript:void(false);\" method=\"post\" target=\"_self\"/>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/save/SaveAllDialogPageBinding.js",
    "content": "SaveAllDialogPageBinding.prototype = new DialogPageBinding;\r\nSaveAllDialogPageBinding.prototype.constructor = SaveAllDialogPageBinding;\r\nSaveAllDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SaveAllDialogPageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SaveAllDialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * List<string><DockTabBinding>\r\n\t */\r\n\tthis._dirtyTabs = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSaveAllDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SaveAllDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {Map<string><DockTabBinding>} list\r\n */\r\nSaveAllDialogPageBinding.prototype.setPageArgument = function ( map ) {\r\n\t\r\n\tSaveAllDialogPageBinding.superclass.setPageArgument.call ( this, map );\r\n\tthis._dirtyTabs = map;\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nSaveAllDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tSaveAllDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\t\r\n\t/*\r\n\t * Sort tabs according to associated perspective.\r\n\t */\r\n\tvar perspectives = new Map ();\r\n\tthis._dirtyTabs.each ( function ( key, tab ) {\r\n\t\tvar label = tab.perspectiveNode.getLabel ();\r\n\t\tif ( !perspectives.has ( label )) {\r\n\t\t\tperspectives.set ( label, new List ());\r\n\t\t}\r\n\t\tperspectives.get ( label ).add ( tab );\r\n\t});\r\n\t\r\n\t/*\r\n\t * Build fields.\r\n\t */\r\n\tvar doc = this.bindingDocument;\r\n\tvar self = this;\r\n\tperspectives.each ( function ( label, list ) {\r\n\t\tself._buildField ( label, list );\r\n\t});\r\n}\r\n\r\n/**\r\n * @param {string} label\r\n * @param {List<DockTabBinding>} list\r\n */\r\nSaveAllDialogPageBinding.prototype._buildField = function ( label, list ) {\r\n\t\r\n\tvar doc = this.bindingDocument;\r\n\tvar field = FieldBinding.newInstance ( doc );\r\n\tvar desc = FieldDescBinding.newInstance ( doc );\r\n\tvar data = FieldDataBinding.newInstance ( doc );\r\n\tvar group = CheckBoxGroupBinding.newInstance ( doc );\r\n\t\r\n\tlist.each ( function ( tab ) {\r\n\t\tvar box = CheckBoxBinding.newInstance ( doc );\r\n\t\tbox.setLabel ( tab.getLabel ());\r\n\t\tbox.setResult ( tab );\r\n\t\tbox.check ( true );\r\n\t\tgroup.add ( box );\r\n\t});\r\n\t\r\n\tdesc.setLabel ( label );\r\n\tdata.add ( group );\r\n\tfield.add ( desc );\r\n\tfield.add ( data );\r\n\t\r\n\tthis.bindingWindow.bindingMap.fieldgroup.add ( field );\r\n\tfield.attachRecursive ();\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/save/saveall.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialog.SaveAll</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"SaveAllDialogPageBinding.js\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"SaveAllDialogPageBinding\"\r\n\t\t\tlabel=\"${string:Website.Dialogs.SaveAll.LabelSaveResources}\"\r\n\t\t\timage=\"${icon:question}\" \r\n\t\t\tresizable=\"false\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:fields id=\"fields\">\r\n\t\t\t\t\t<ui:fieldgroup label=\"${string:Website.Dialogs.SaveAll.LabelUnsavedResources}\" id=\"fieldgroup\">\r\n\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Content</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"checkA1\" value=\"c1\" checked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"checkA2\" value=\"c2\" oncommand=\"alert('fister')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"checkA3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t-->\r\n\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar id=\"dialogtoolbar\">\r\n\t\t\t\t<ui:toolbarbody id=\"dialogtoolbarbody\" align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/standard/StandardDialogPageBinding.js",
    "content": "StandardDialogPageBinding.prototype = new DialogPageBinding;\r\nStandardDialogPageBinding.prototype.constructor = StandardDialogPageBinding;\r\nStandardDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StandardDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StandardDialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._dialogType = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._dialogText = null;\r\n\t\r\n\t/**\r\n\t * @type {List<DialogButton>}\r\n\t */\r\n\tthis._dialogButtons = null;\r\n\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStandardDialogPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[StandardDialogPageBinding]\";\r\n\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {object} arg\r\n */\r\nStandardDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tStandardDialogPageBinding.superclass.setPageArgument.call ( this, arg );\r\n\t\r\n\tthis.label \t\t\t= arg.title;\r\n\tthis.image \t\t\t= arg.image;\r\n\t\r\n\tthis._dialogType \t= arg.type;\r\n\tthis._dialogText\t= arg.text;\r\n\tthis._dialogButtons = arg.buttons;\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nStandardDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n    this.attachClassName(this._dialogType);\r\n\r\n    var divDialogText = document.getElementById(\"dialogtext\");\r\n\r\n    var text = (this._dialogText == null) ? \"\" : this._dialogText.replace('\\r\\n', '\\n');\r\n    var textParts = text.split('\\n');\r\n\r\n    // Adding text and inserting and inserting line breaks\r\n    for (var i = 0; i < textParts.length; i++) {\r\n        divDialogText.appendChild(document.createTextNode(textParts[i]));\r\n        if (i < textParts.length - 1) {\r\n            divDialogText.appendChild(document.createElement(\"br\"));\r\n        }\r\n    }\r\n\r\n    while (this._dialogButtons.hasNext()) {\r\n\r\n        var config = this._dialogButtons.getNext();\r\n        var button = ClickButtonBinding.newInstance(document);\r\n\r\n        button.isFocusable = config.isFocusable;\r\n        button.isFocused = config.isFocused;\r\n        button.isDefault = config.isDefault;\r\n\r\n        button.setLabel(config.label);\r\n        button.setImage(config.image);\r\n        button.response = config.response;\r\n\r\n        if (!button.response) {\r\n            button.response = Dialog.DEFAULT_RESPONSE;\r\n        }\r\n        bindingMap.dialogtoolbargroup.add(button);\r\n    }\r\n\r\n    bindingMap.dialogtoolbargroup.attachRecursive();\r\n    bindingMap.dialogtoolbarbody.enforceEqualSize();\r\n    bindingMap.dialogtoolbar.indexDialogButtons();\r\n\r\n    StandardDialogPageBinding.superclass.onBeforePageInitialize.call(this);\r\n}\r\n\r\n/**\r\n * Display a notification on the statusbar (copy dialog title).\r\n * @overloads {DialogPageBinding#onAfterPageInitialize}\r\n */\r\nStandardDialogPageBinding.prototype.onAfterPageInitialize = function () {\r\n\t\r\n\tStandardDialogPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\t\r\n\t/*\r\n\t * Mirror message in statusbar.\r\n\t */\r\n\tif ( !StatusBar.status ) {\r\n\t\tStatusBar.report ( this.label, this.image );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Force-clear the lock. This has been added specifically to \r\n\t * hack the scenario where a page-preview was hindered by \r\n\t * non-wellformed markup (the screen would stay locked), but \r\n\t * it may come in handy in other situations (this being \r\n\t * warning and error dialogs).\r\n\t */\r\n\tApplication.unlock ( this, true );\r\n}\r\n\r\n/**\r\n * Clear statusbar on terminate (unless something important is now displayed).\r\n * @overloads {FocusBinding#onBindingDispose}\r\n */\r\nStandardDialogPageBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tStandardDialogPageBinding.superclass.onBindingDispose.call ( this );\r\n\tif ( !StatusBar.status ) {\r\n\t\tStatusBar.clear ();\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/standard/standard.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialog.Standard</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"StandardDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"StandardDialogPageBinding\"\r\n\t\t\tclass=\"standard\" \r\n\t\t\tresizable=\"false\"\r\n\t\t\twidth=\"440\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<table id=\"dialoglayout\">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td id=\"dialogvignette\">\r\n\t\t\t\t\t\t\t<ui:dialogvignette/>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td id=\"dialogtext\"><!-- ${dialogtext} --></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar id=\"dialogtoolbar\">\r\n\t\t\t\t<ui:toolbarbody id=\"dialogtoolbarbody\" align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup id=\"dialogtoolbargroup\"/>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/systemtrees/DetailedPastePageBinding.js",
    "content": "DetailedPastePageBinding.prototype = new DialogPageBinding;\r\nDetailedPastePageBinding.prototype.constructor = DetailedPastePageBinding;\r\nDetailedPastePageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DetailedPastePageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DetailedPastePageBinding\" );\r\n\t\r\n\t/**\r\n\t * List<SystemNode>\r\n\t */\r\n\tthis._list = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDetailedPastePageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[StandardDialogPageBinding]\";\r\n\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {List<SystemNode>} nodes\r\n */\r\nDetailedPastePageBinding.prototype.setPageArgument = function ( nodes ) {\r\n\t\r\n\tDetailedPastePageBinding.superclass.setPageArgument.call ( this, nodes );\r\n\r\n\tvar list = new List ();\r\n\tvar iterate = 0;\r\n\tnodes.each ( function ( node ) {\r\n\t    if ( node.hasDragAccept ()) { // TODO: implement highly advanced check for accept type...\r\n\t\t    list.add ( \r\n\t\t\t    new SelectorBindingSelection ( \r\n\t\t\t\t    node.getLabel (),\r\n\t\t\t\t    String ( iterate ),\r\n\t\t\t\t    false,\r\n\t\t\t\t    node.getImageProfile ()\r\n\t\t\t    )\r\n\t\t    );\r\n\t\t    iterate ++;\r\n\t\t}\r\n\t});\r\n\tthis._list = list;\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nDetailedPastePageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tvar manager = this.bindingWindow.DataManager;\r\n\t\r\n\t/*\r\n\t * Fix selector.\r\n\t */\r\n\tvar selector = manager.getDataBinding ( \"sibling\" );\r\n\tselector.populateFromList ( this._list );\r\n\tif ( this._list.getLength () == 1 ) {\r\n\t\tselector.disable ();\r\n\t}\r\n\t\r\n\t/*\r\n\t * Fix radiogroup.\t\t\t\t\t\r\n\t */\r\n\tvar radiogroup = manager.getDataBinding ( \"switch\" );\r\n\tradiogroup.addActionListener ( RadioGroupBinding.ACTION_SELECTIONCHANGED, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tswitch ( radiogroup.getValue ()) {\r\n\t\t\t\tcase \"before\" :\r\n\t\t\t\t\tbindingMap.insertlabel.setLabel (\r\n\t\t\t\t\t\tStringBundle.getString ( \"ui\", \"Website.Dialogs.SystemTree.DetailedPaste.LabelInsertBefore\" )\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"after\" :\r\n\t\t\t\t\tbindingMap.insertlabel.setLabel (\r\n\t\t\t\t\t\tStringBundle.getString ( \"ui\", \"Website.Dialogs.SystemTree.DetailedPaste.LabelInsertAfter\" )\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\taction.consume ();\t\r\n\t\t}\r\n\t});\r\n\t\r\n\tDetailedPastePageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/systemtrees/detailedpaste.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialog.SystemTree.DetailedPaste</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"DetailedPastePageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage \r\n\t\t\tbinding=\"DetailedPastePageBinding\"\r\n\t\t\tlabel=\"${string:Website.Dialogs.SystemTree.DetailedPaste.Title}\" \r\n\t\t\timage=\"${icon:question}\" \r\n\t\t\tresizable=\"false\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:fields>\r\n\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Website.Dialogs.SystemTree.DetailedPaste.LabelPosition}\"/>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"switch\">\r\n\t\t\t\t\t\t\t\t\t<ui:radio label=\"Before\" value=\"before\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:radio label=\"After\" value=\"after\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc id=\"insertlabel\" label=\"${string:Website.Dialogs.SystemTree.DetailedPaste.LabelInsertAfter}\"/>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:selector name=\"sibling\"/>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/autoheight/autoheightdialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\tDocumentManager.hasNativeContextMenu = true;\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:dialogpage label=\"Auto Height Dialog\" height=\"auto\" resizable=\"true\">\r\n\t\t\t\t<div style=\"padding-bottom:10px;\">This dialog fits the content. Although you can resize it!</div>\r\n\t\t\t\t<ui:pagebody style=\"border: 2px inset ThreeDHighlight;padding: 10px;\">\r\n\t\t\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</ui:flexbox>\r\n\t\t\t\t</ui:pagebody>\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t</ui:dialogpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/datadialog/datadialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Test</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage label=\"Data Dialog Test\" resizable=\"false\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:fields>\r\n\t\t\t\t\t<ui:fieldgroup label=\"Options\">\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Option 1</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:selector name=\"option1\" label=\"(default)\">\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"High\" value=\"high\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Low\" value=\"low\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Autohigh\" value=\"autoheigh\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Autolow\" value=\"autolow\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Best\" value=\"best\"/>\r\n\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Option 2</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:selector name=\"option2\" label=\"(default)\">\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Window\" value=\"window\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Opaque\" value=\"opaque\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Transparent\" value=\"transparent\"/>\r\n\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Settings</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Option 3\" name=\"option3\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Option 4\" name=\"option4\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Option 5\" name=\"option5\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Option 6\" name=\"option6\"/>\r\n\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton \r\n\t\t\t\t\t\t\tid=\"buttonAccept\" \r\n\t\t\t\t\t\t\tlabel=\"OK\" \r\n\t\t\t\t\t\t\tdefault=\"true\" \r\n\t\t\t\t\t\t\tresponse=\"accept\" \r\n\t\t\t\t\t\t\tfocusable=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton \r\n\t\t\t\t\t\t\tlabel=\"Cancel\" \r\n\t\t\t\t\t\t\tresponse=\"cancel\" \r\n\t\t\t\t\t\t\tfocusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/fixedheight/fixedheightdialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\tDocumentManager.hasNativeContextMenu = true;\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage label=\"Auto Height Dialog\" height=\"500\" width=\"320\" resizable=\"true\">\r\n\t\t\t<ui:pagebody style=\"border: 2px inset ThreeDHighlight;padding: 10px;\">\r\n\t\t\t\t<p>This dialog has a fixed size. Although you can resize it!</p>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/forcefitness/forcefitness-advanced.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\tDocumentManager.hasNativeContextMenu = true;\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:dialogpage label=\"Fitness Advanced :)\" width=\"760\" height=\"300\" resizable=\"false\">\r\n\t\t\t\r\n\t\t\t<ui:pagebody style=\"border: 1px solid black;\">\t\t\t\r\n\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:3\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:clickbutton label=\"Fit!!!\" oncommand=\"this.dispatchAction(Binding.ACTION_UPDATED)\" style=\"margin: 0\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t<div style=\"padding: 10px;\">\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t\t<div>Content LAST!</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t<ui:splitpanel>\t\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:scrollbox fit=\"true\">\r\n\t\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:clickbutton label=\"Fit!!!\" oncommand=\"this.dispatchAction(Binding.ACTION_UPDATED)\" style=\"margin: 0\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t\t<div class=\"padded\" id=\"hello\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Checkboxes\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"check1\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"check2\" value=\"c2\" oncommand=\"alert('fister')\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"check3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"check4\" value=\"d1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"check5\" value=\"d2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"check6\" value=\"d3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Radiobuttons\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput23\" value=\"23\" type=\"integer\" error=\"Testing error!\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>radiogroup</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup1\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 1\" value=\"p1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 2\" value=\"p2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 3\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>radiogroup + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup2\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 1\" value=\"p1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 2\" value=\"p2\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 3\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t</ui:pagebody>\r\n\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t\r\n\t\t\t</ui:dialogpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/forcefitness/forcefitness-basic.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:dialogpage label=\"Fitness\" height=\"300\" resizable=\"true\">\r\n\t\t\t\t\r\n\t\t\t\t<ui:pagebody style=\"border: 1px solid black;\">\r\n\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:clickbutton label=\"Fit!!!\" oncommand=\"this.dispatchAction(Binding.ACTION_UPDATED)\" style=\"margin: 0\"/>\r\n\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t<div style=\"padding: 10px;\">\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content LAST!</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</ui:pagebody>\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t\r\n\t\t\t</ui:dialogpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/forcefitness/forcefitness-windowed-content.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:page>\r\n\t\t\t\t\t\r\n\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:clickbutton label=\"Fit!!!\" oncommand=\"this.dispatchAction(Binding.ACTION_UPDATED)\" style=\"margin: 0\"/>\r\n\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\r\n\t\t\t\t\t<div style=\"padding: 10px;\">\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content LAST!</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\r\n\t\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/forcefitness/forcefitness-windowed.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:dialogpage label=\"Fitness Windowed\" resizable=\"true\">\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:clickbutton label=\"Nothing here!\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t<ui:pagebody>\r\n\t\t\t\t\t<ui:window url=\"forcefitness-windowed-content.aspx\" style=\"border: 2px inset ThreeDHighlight;\"/>\r\n\t\t\t\t</ui:pagebody>\t\t\t\t\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t\r\n\t\t\t</ui:dialogpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/multipage/page1.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\tDocumentManager.hasNativeContextMenu = true;\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:dialogpage label=\"Multipage1\" resizable=\"false\">\r\n\t\t\t\t<div style=\"padding-bottom:10px;\">Load next page!</div>\r\n\t\t\t\t<ui:pagebody style=\"border: 2px inset ThreeDHighlight;padding: 10px;\">\r\n\t\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</ui:pagebody>\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t</ui:dialogpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/multipage/page2.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\tDocumentManager.hasNativeContextMenu = true;\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:dialogpage label=\"Multipage1\" resizable=\"false\">\r\n\t\t\t\t<div style=\"padding-bottom:10px;\"></div>\r\n\t\t\t\t<ui:pagebody style=\"border: 2px inset ThreeDHighlight;padding: 10px;\">\r\n\t\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</ui:pagebody>\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t</ui:dialogpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/subpageforcefitness/child.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form id=\"hans\" action=\"child.aspx\" method=\"post\" class=\"updateform updatezone\">\r\n\t\t<ui:page>\r\n\t\t\t<div id=\"johnson\">\r\n\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t<ui:clickbutton label=\"Update\" oncommand=\"document.forms [ 0 ].submit ();\"/>\r\n\t\t\t\t</div>\r\n\t\t\t\t<br style=\"clear:both;\"/>\r\n\t\t\t\t<ui:scrollbox class=\"padded\" id=\"thingy\">\r\n\t\t\t\t\t\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t</div>\r\n\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/subpageforcefitness/parent.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage label=\"Sub Page Dialog\" resizable=\"true\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:window url=\"child.aspx\" style=\"border: 2px inset ThreeDHighlight;\"/>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/subpages/sub1.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:page>\r\n\t\t\t\t<ui:clickbutton label=\"Load next sub-page!\" oncommand=\"document.location=document.location.toString().replace('sub1','sub2');\"/>\r\n\t\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/subpages/sub2.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t<ui:page>\r\n\t\t\t<ui:clickbutton label=\"Load next sub-page!\" oncommand=\"document.location=document.location.toString().replace('sub2','sub3');\"/>\r\n\t\t\t<div style=\"padding: 10px; clear: both;\">\r\n\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t<div>Behold: The dialog resizes to fit loaded content.</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/subpages/sub3.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:page>\r\n\t\t\t\t<ui:clickbutton label=\"Load next sub-page!\" oncommand=\"document.location=document.location.toString().replace('sub3','sub4');\"/>\r\n\t\t\t\t<div style=\"padding: 10px; clear: both;\">\r\n\t\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t\t<div>This page is smaller than the previous page. This will NOT resize the dialog!</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/subpages/sub4.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<ui:page>\r\n\t\t\t\t<ui:clickbutton label=\"Load next sub-page!\" oncommand=\"document.location=document.location.toString().replace('sub2','sub3');\"/>\r\n\t\t\t\t<div style=\"padding: 10px; clear: both;\">\r\n\t\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t\t<div>TODO: handle REALLY HUGE dialogs that won't fit on screen...</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/subpages/subpagedialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\tfunction load () {\r\n\t\t\t\tUserInterface.getBinding ( \r\n\t\t\t\t\tdocument.getElementById ( \"window\" )\r\n\t\t\t\t).setURL ( \"subpagedialog-sub1.aspx\" );\r\n\t\t\t}\r\n\t\t</script>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\tDocumentManager.hasNativeContextMenu = true;\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage label=\"Sub Page Dialog\" resizable=\"true\">\r\n\t\t\t<div style=\"padding-bottom:10px;\">You can resize this dialog. Here is an iframe with some loaded content:</div>\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:window url=\"sub1.aspx\" style=\"border: 2px inset ThreeDHighlight;\"/>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/textcontent/textcontent.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title></title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage label=\"Sub Page Dialog\" resizable=\"false\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<div>\r\n\t\t\t\t\tLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br/>\r\n\t\t\t\t\t<br/>\r\n\t\t\t\t\tAlarm<br/>\r\n\t\t\t\t\tAlarm<br/>\r\n\t\t\t\t\tAlarm<br/>\r\n\t\t\t\t</div>\r\n\t\t\t</ui:pagebody>\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"OK\" response=\"accept\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/wizard/wizard1.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Wizard1</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:wizardpage label=\"Auto Height Dialog\" resizable=\"true\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<div style=\"padding-bottom:10px;\">This dialog fits the content. Although you can resize it!</div>\r\n\t\t\t\t<ui:fields>\r\n\t\t\t\t\t<ui:fieldgroup label=\"Fields!\">\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Fister!</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput type=\"integer\" error=\"Alarm!\" />\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton oncommand=\"document.location=Resolver.resolve('${root}/content/dialogs/tests/wizard/wizard2.aspx')\" callbackid=\"CALLBACKID\" id=\"nextbutton\" image=\"${icon:next}\" label=\"Next\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:wizardpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/wizard/wizard2.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Wizard2</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:wizardpage label=\"Auto Height Dialog\" resizable=\"true\" width=\"300\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<div style=\"padding-bottom:10px;\">This dialog fits the content. Although you can resize it!</div>\r\n\t\t\t\t<div style=\"padding-bottom:10px;\">\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t\t<div>Content</div>\r\n\t\t\t\t</div>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton \r\n\t\t\t\t\t\t\toncommand=\"document.location=Resolver.resolve('${root}/content/dialogs/tests/wizard/wizard1.aspx')\"\r\n\t\t\t\t\t\t\tcallbackid=\"CALLBACKID\" \r\n\t\t\t\t\t\t\tid=\"previousbutton\" \r\n\t\t\t\t\t\t\timage=\"${icon:previous}\" \r\n\t\t\t\t\t\t\tlabel=\"Back\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:wizardpage>\r\n\t\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/wizard/wizard3.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Wizard1</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:wizardpage id=\"formcontrolpage\" label=\"Add new page\" image=\"${icon:Composite.Icons:page-add-page}\" resizable=\"false\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:fields>\r\n\t\t\t\t\t<ui:fieldgroup label=\"General settings\">\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Page title</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fieldhelp>The entry specified in this field is shown in the browser window title bar. The field is used by search engines and sitemaps</ui:fieldhelp>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput name=\"FlowUI$Wizard$DialogCanvas1$repeater$ctl00$FieldGroup0$TextBox1\" required=\"true\" />\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Description</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fieldhelp>Use this field for at short description of the page</ui:fieldhelp>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:textbox required=\"false\" name=\"FlowUI$Wizard$DialogCanvas1$repeater$ctl00$FieldGroup0$TextArea2\">\r\n\t\t\t\t\t\t\t\t\t<textarea />\r\n\t\t\t\t\t\t\t\t</ui:textbox>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Template</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fieldhelp>Select which template you want the page to be based on</ui:fieldhelp>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:selector name=\"FlowUI$Wizard$DialogCanvas1$repeater$ctl00$FieldGroup0$KeySelector3\">\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Alarmtemplate\" value=\"6df64aaf-e378-4131-944d-a0e0b96fd465\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Fiaskotemplate\" value=\"a2a80400-ff87-477c-a83a-4e553cf4f4be\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Nedturstemplate\" value=\"61c8f749-0ab3-4fad-9cdb-ea6553d7f264\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Opturstemplate\" value=\"78d7bb75-5c36-4ffd-a89b-a945e6ee5766\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Skandaletemplate\" value=\"0bd28f79-0790-4d2b-a33c-79e10c3c6fb7\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spassertemplate\" value=\"49960ce4-e2ac-4f2d-a28b-0bea82d963c9\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spastikertemplate\" value=\"91545b55-c161-4bca-9742-62c3a142fce2\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Successtemplate\" value=\"e453965c-1454-4d7f-9b38-24c16c7ac19c\" />\r\n\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc>Position</ui:fielddesc>\r\n\t\t\t\t\t\t\t<ui:fieldhelp>Select where in the content tree you want the page to be placed</ui:fieldhelp>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:selector name=\"FlowUI$Wizard$DialogCanvas1$repeater$ctl00$FieldGroup0$KeySelector4\">\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Insert at the bottom\" value=\"Bottom\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Insert at the top\" value=\"Top\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Select position...\" value=\"Relative\" />\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Insert alphabetically\" value=\"Alphabetic\" />\r\n\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Next\" callbackid=\"FlowUI_Wizard_DialogToolbar4_repeater_ctl00_NextButton6_nextButton\" oncommand=\"this.dispatchAction(WizardPageBinding.ACTION_NAVIGATE_NEXT);\" id=\"nextbutton\" image=\"${icon:next}\" image-disabled=\"${icon:next-disabled}\" focusable=\"true\" />\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Finish\" callbackid=\"FlowUI_Wizard_DialogToolbar4_repeater_ctl01_FinishButton7_finishButton\" oncommand=\"this.dispatchAction(WizardPageBinding.ACTION_FINISH);\" id=\"finishbutton\" image=\"${icon:finish}\" image-disabled=\"${icon:finish-disabled}\" focusable=\"true\" default=\"true\" />\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Cancel\" callbackid=\"FlowUI_Wizard_DialogToolbar4_repeater_ctl02_WizardCancelButton8_cancenButton\" response=\"cancel\" id=\"buttonCancel\" focusable=\"true\" image=\"${icon:cancel}\" image-disabled=\"${icon:cancel-disabled}\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t\t<div style=\"display: none;\">\r\n\t\t\t\t<ui:updatepanel id=\"FlowUI_UpdatePanel2\" repaintmode=\"normal\">\r\n\t\t\t\t\t<ui:updatepanelbody>\r\n\t\t\t\t\t\t<ui:binding onattach=\"window.setTimeout('MessageQueue.update();',50);\" />\r\n\t\t\t\t\t</ui:updatepanelbody>\r\n\t\t\t\t</ui:updatepanel>\r\n\t\t\t</div>\r\n\t\t</ui:wizardpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/tests/wizard/wizard4.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Wizard4</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:wizardpage id=\"formcontrolpage\" label=\"Infobox scrollbox!\" resizable=\"true\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:scrollbox class=\"infobox\">\r\n\t\t\t\t\t<h3>This is the heading</h3>\r\n\t\t\t\t\t<p>This is the info.</p>\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Next\" callbackid=\"FlowUI_Wizard_DialogToolbar4_repeater_ctl00_NextButton6_nextButton\" oncommand=\"this.dispatchAction(WizardPageBinding.ACTION_NAVIGATE_NEXT);\" id=\"nextbutton\" image=\"${icon:next}\" image-disabled=\"${icon:next-disabled}\" focusable=\"true\" />\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Finish\" callbackid=\"FlowUI_Wizard_DialogToolbar4_repeater_ctl01_FinishButton7_finishButton\" oncommand=\"this.dispatchAction(WizardPageBinding.ACTION_FINISH);\" id=\"finishbutton\" image=\"${icon:finish}\" image-disabled=\"${icon:finish-disabled}\" focusable=\"true\" default=\"true\" />\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Cancel\" callbackid=\"FlowUI_Wizard_DialogToolbar4_repeater_ctl02_WizardCancelButton8_cancenButton\" response=\"cancel\" id=\"buttonCancel\" focusable=\"true\" image=\"${icon:cancel}\" image-disabled=\"${icon:cancel-disabled}\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:wizardpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/translations/TranslationsDialogPageBinding.js",
    "content": "TranslationsDialogPageBinding.prototype = new DialogPageBinding;\r\nTranslationsDialogPageBinding.prototype.constructor = TranslationsDialogPageBinding;\r\nTranslationsDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TranslationsDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TranslationsDialogPageBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTranslationsDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TranslationsDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBindong#onBeforePageInitialize}\r\n */\r\nTranslationsDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tTranslationsDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\t\r\n\tvar list = new List ();\r\n\tLocalization.locales.each ( function ( locale ) {\r\n\t\tlist.add ( \r\n\t\t\tnew SelectorBindingSelection ( locale, locale, false, null )\r\n\t\t);\r\n\t});\r\n\t\r\n\tDataManager.getDataBinding ( \"sourcelanguage\" ).populateFromList ( list );\r\n\tDataManager.getDataBinding ( \"targetlanguage\" ).populateFromList ( list );\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBindong#onDialogAccept}\r\n */\r\nTranslationsDialogPageBinding.prototype.onDialogAccept = function () {\r\n\t\r\n\tvar isContinue = true;\r\n\t\r\n\tvar source = DataManager.getDataBinding ( \"sourcelanguage\" );\r\n\tvar target = DataManager.getDataBinding ( \"targetlanguage\" );\r\n\tvar deck = window.bindingMap.decks.getSelectedDeckBinding ();\r\n\t\r\n\tif ( deck.getID () == \"fieldsdeck\" ) {\r\n\t\tif ( target.isDirty ) {\r\n\t\t\twindow.bindingMap.decks.select ( \"warningdeck\" );\r\n\t\t\tisContinue = false;\r\n\t\t}\r\n\t}\r\n\tif ( isContinue == true ) {\r\n\t\tif ( source.isDirty == true ) {\r\n\t\t\tLocalization.setSourceLanguage ( source.getValue ());\r\n\t\t}\r\n\t\tif ( target.isDirty == true ) {\r\n\t\t\tLocalization.setTargetLanguage ( source.getValue ());\r\n\t\t}\r\n\t\tTranslationsDialogPageBinding.superclass.onDialogAccept.call ( this );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/translations/translations.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialog.Translations</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"TranslationsDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"TranslationsDialogPageBinding\" resizable=\"false\" class=\"standard question\">\r\n\t\t\t<ui:decks id=\"decks\">\r\n\t\t\t\t<ui:deck id=\"fieldsdeck\">\r\n\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Translation settings\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc label=\"Translations mode\"/>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Enable translations\" relate=\"translationsenabled\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field relation=\"translationsenabled\">\r\n\t\t\t\t\t\t\t\t<ui:fielddesc label=\"Source language\"/>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"Explaining the concept of source language.\"/>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"sourcelanguage\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field relation=\"translationsenabled\">\r\n\t\t\t\t\t\t\t\t<ui:fielddesc label=\"Target language\"/>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"Explaining the concept of target language.\"/>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"targetlanguage\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t</ui:fields>\r\n\t\t\t\t</ui:deck>\r\n\t\t\t\t<ui:deck id=\"warningdeck\">\r\n\t\t\t\t\t<ui:flexbox>\r\n\t                     <table id=\"dialoglayout\">\r\n\t                         <tr>\r\n\t                             <td id=\"dialogvignette\">\r\n\t                                <ui:dialogvignette/>\r\n\t                            </td>\r\n\t                             <td id=\"dialogtext\">\r\n\t                                <ui:text label=\"Are your sure you wish to change the target language? The application will restart and all your unsaved changes will be lost.\"/>\r\n\t                            </td>\r\n\t                        </tr>\r\n\t                    </table>\r\n\t                </ui:flexbox>\r\n\t\t\t\t</ui:deck>\r\n\t\t\t</ui:decks>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\" class=\"right\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"OK\" id=\"buttonAccept\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Cancel\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/treeselector/TreeSelectorDialogPageBinding.js",
    "content": "TreeSelectorDialogPageBinding.prototype = new DialogPageBinding;\r\nTreeSelectorDialogPageBinding.prototype.constructor = TreeSelectorDialogPageBinding;\r\nTreeSelectorDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/*\r\n\r\n\tHOW TO USE:\r\n\r\n\tvar handler = {\r\n\t\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\t\tgetQueryTreeBinding ().buildFromServer ( result.get ( 0 ));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar arg = {\r\n\t\t\tlabel \t\t\t\t: \"Select Image\",\r\n\t\t\tkey \t\t\t\t: \"ReadOnlyXmlProviderElementProvider\",\r\n\t\t\tselectionProperty \t: \"ElementType\",\r\n\t\t\tselectionValue\t\t: \"image/jpg image/gif image/png\",\r\n\t\t\tselectionResult\t\t: \"ElementId\"\r\n\t\t\t//optional , width : 400\r\n\t\t\t//optional , height : 400\r\n\t\t}\r\n\t\tDialog.invokeModal ( Dialog.URL_TREESELECTOR, handler, arg );\r\n*/\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TreeSelectorDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TreeSelectorDialogPageBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t *\r\n\tthis._key = null;\r\n\t*/\r\n\r\n\t/**\r\n\t * @type {SystemTreeBinding}\r\n\t */\r\n\tthis._treeBinding = null;\r\n\r\n\t/**\r\n\t * @type {GenericViewBinding}\r\n\t */\r\n\tthis._genericViewBinding = null;\r\n\r\n\t/**\r\n\t * @type {SystemToolbarBinding}\r\n\t */\r\n\tthis._toolbarBinding = null;\r\n\r\n\t/**\r\n\t * @type {TabBinding}\r\n\t */\r\n\tthis._previewTab = null;\r\n\r\n\t/**\r\n\t * @type {TabBinding}\r\n\t */\r\n\tthis._genericTab = null;\r\n\r\n\t/**\r\n\t * The name of the treenode property on which to base tree selection.\r\n\t * @type {string}\r\n\t */\r\n\tthis._selectionProperty = null;\r\n\r\n\t/**\r\n\t * The (optional) treenode property value on which to base tree selection. Multiple\r\n\t * values supported, separated by whitespace. Omit to allow all values for property.\r\n\t * @type {string} Whitespace-separated list of values.\r\n\t */\r\n\tthis._selectionValue = null;\r\n\r\n\t/**\r\n\t * The name of the treenode property whose value will form the RESULT.\r\n\t * @type {string}\r\n\t */\r\n\tthis._selectionResult = null;\r\n\r\n\t/**\r\n\t * Does the dialog have the preview tab?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasPreview = false;\r\n\r\n\t/**\r\n\t *  The (optional) action groups.\r\n\t * @type {tring}}\r\n\t */\r\n\tthis._actionGroup = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isPushingUrl = false;\r\n\r\n\t/**\r\n\t * Search token.\r\n\t * @type {string}\r\n\t *\r\n\tthis._selectionSearch = null;\r\n\t*/\r\n\r\n\t/**\r\n\t * Root nodes in tree. Each object in array may have two properties,\r\n\t * a required named provider key and an optional search token.\r\n\t * @type {Array<Object>}\r\n\t */\r\n\tthis._nodes = null;\r\n\r\n\t/**\r\n\t * List of parents of root nodes. Used for handle tree refreshing\r\n\t * @type {List}\r\n\t */\r\n\tthis._parents = null;\r\n\r\n\r\n\t/**\r\n\t * This will be set to an index in the map declared above. it has two properties:\r\n\t *     history {List<string>}\r\n\t *     index {int}\r\n\t * @type {object}\r\n\t */\r\n\tthis._current = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isHistoryBrowsing = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTreeSelectorDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TreeSelectorDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * Fetch properties from page argument.\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {object} arg\r\n */\r\nTreeSelectorDialogPageBinding.prototype.setPageArgument = function (arg) {\r\n\r\n\tTreeSelectorDialogPageBinding.superclass.setPageArgument.call(this, arg);\r\n\r\n\tthis.label = arg.label;\r\n\tthis.image = arg.image;\r\n\tthis._key = arg.key;\r\n\tthis._selectionProperty = arg.selectionProperty;\r\n\tthis._selectionValue = arg.selectionValue;\r\n\tthis._selectionResult = arg.selectionResult;\r\n\tthis._hasPreview = arg.hasPreview;\r\n\tthis._actionGroup = arg.actionGroup;\r\n\r\n\tif (arg.selectedToken) {\r\n\t\tthis._selectedToken = arg.selectedToken;\r\n\t}\r\n\telse if (arg.selectedResult) {\r\n\t\tvar compositeUrl = new Uri(arg.selectedResult);\r\n\t\tif (compositeUrl.isMedia || compositeUrl.isPage || compositeUrl.isInternalUrl) {\r\n\t\t\tthis._selectedToken = TreeService.GetCompositeEntityToken(arg.selectedResult);\r\n\t\t}\r\n\t}\r\n\tthis._nodes = arg.nodes;\r\n\tthis._parents = new List();\r\n\tif (arg.width) {\r\n\t\tthis.width = arg.width;\r\n\t}\r\n\tif (arg.height) {\r\n\t\tthis.height = arg.height;\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @overloads {SystemTreeBinding#onBindingRegister}\r\n */\r\nTreeSelectorDialogPageBinding.prototype.onBindingRegister = function () {\r\n\r\n\tTreeSelectorDialogPageBinding.superclass.onBindingRegister.call(this);\r\n\r\n\t//Subscribe to double click action\r\n\tthis.addActionListener(TreeNodeBinding.ACTION_COMMAND);\r\n\r\n\tthis.addActionListener(PathBinding.ACTION_COMMAND);\r\n\tthis.addActionListener(WindowBinding.ACTION_ONLOAD);\r\n\r\n\t/*\r\n\t* File subscriptions.\r\n\t*/\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESH);\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED_AFTER);\r\n\tthis.subscribe(BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED);\r\n\r\n}\r\n\r\n/**\r\n * Implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nTreeSelectorDialogPageBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\t/**\r\n\t* Doublecheck that this tree is actually focused. Although if\r\n\t* the server transmits a refresh signal, this is not required.\r\n\t*/\r\n\tswitch (broadcast) {\r\n\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESH:\r\n\t\t\tif (arg != null || this.isFocused) { // arg is only provided when server is refreshing!\r\n\t\t\t\tif (this._parents.has(arg)) {\r\n\t\t\t\t\tthis._treeBinding._handleCommandBroadcast(broadcast);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t} else if (this._treeBinding.hasToken(arg)) {\r\n\t\t\t\t\tthis._treeBinding._handleCommandBroadcast(broadcast, arg);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESHED_AFTER:\r\n\t\t\tif (arg.syncHandle == this.getSyncHandle()) {\r\n\t\t\t\tthis.refreshView();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED:\r\n\t\t\tif (arg.syncHandle == this.getSyncHandle()) {\r\n\t\t\t\tif (arg.source && arg.source == this._treeBinding && arg.actionProfile) {\r\n\t\t\t\t\tvar node = arg.actionProfile.Node;\r\n\t\t\t\t\tvar entityToken = node.getEntityToken();\r\n\t\t\t\t\tif (entityToken) {\r\n\t\t\t\t\t\tif (this._entityToken != entityToken) {\r\n\t\t\t\t\t\t\tthis._entityToken = entityToken;\r\n\t\t\t\t\t\t\tthis.push(node);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tTreeSelectorDialogPageBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBeforePageInitialize}\r\n */\r\nTreeSelectorDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tthis._treeBinding = this.bindingWindow.bindingMap.selectiontree;\r\n\tthis._treeBinding.addActionListener ( TreeBinding.ACTION_SELECTIONCHANGED, this );\r\n\tthis._treeBinding.addActionListener(TreeBinding.ACTION_NOSELECTION, this);\r\n\r\n\tthis._treeBinding.setSelectable ( true );\r\n\tthis._treeBinding.setSelectionProperty ( this._selectionProperty );\r\n\tthis._treeBinding.setSelectionValue(this._selectionValue);\r\n\tthis._treeBinding.setActionGroup(this._actionGroup);\r\n\r\n\t//Remove default double click action\r\n\tthis._treeBinding.removeActionListener(TreeNodeBinding.ACTION_COMMAND);\r\n\r\n\tthis._treeBinding.unsubscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESH);\r\n\r\n\t/*\r\n\t * Build root nodes.\r\n\t */\r\n\tthis._injectTreeNodes (\r\n\t\tnew List ( this._nodes )\r\n\t);\r\n\r\n\tStageBinding.treeSelector = this._treeBinding;\r\n\r\n\r\n\r\n\tthis._genericViewBinding = this.bindingWindow.bindingMap.genericview;\r\n\tthis._genericViewBinding.addActionListener(TreeBinding.ACTION_SELECTIONCHANGED, this);\r\n\tthis._genericViewBinding.addActionListener(TreeBinding.ACTION_NOSELECTION, this);\r\n\tthis._genericViewBinding.addActionListener(GenericViewBinding.ACTION_COMMAND, this);\r\n\r\n\tthis._genericViewBinding.setSelectable(true);\r\n\tthis._genericViewBinding.setSelectionProperty(this._selectionProperty);\r\n\tthis._genericViewBinding.setSelectionValue(this._selectionValue);\r\n\tthis._genericViewBinding.setActionGroup(this._actionGroup);\r\n\r\n\r\n\tthis._previewTab = this.bindingWindow.bindingMap.previewtab;\r\n\tthis._genericTab = this.bindingWindow.bindingMap.generictab;\r\n\r\n\tthis._toolbarBinding = this.bindingWindow.bindingMap.toolbar;\r\n\tif (this._toolbarBinding) {\r\n\t\tthis._toolbarBinding.setSyncHandle(this.getSyncHandle());\r\n\t}\r\n\r\n\tthis._clearHistory();\r\n\r\n\tTreeSelectorDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n\r\n/**\r\n * Select Node by Entitytoken\r\n * @param {EntityToken} entityToken\r\n */\r\nTreeSelectorDialogPageBinding.prototype.select = function (entityToken) {\r\n\r\n\tthis._treeBinding.handleBroadcast(BroadcastMessages.SYSTEMTREEBINDING_FOCUS, entityToken);\r\n}\r\n\r\n/**\r\n * Push Node\r\n * @param {SystemNode} node\r\n */\r\nTreeSelectorDialogPageBinding.prototype.push = function (node) {\r\n\r\n\tif (this._hasPreview && node) {\r\n\t\tvar entityToken = node.getEntityToken();\r\n\t\tvar self = this;\r\n\t\tTreeService.GetBrowserUrlByEntityToken(entityToken, false, function (result) {\r\n\t\t\tif (result && result.Url) {\r\n\t\t\t\tself.setPreview(result.Url);\r\n\t\t\t\tself._updateHistory(entityToken);\r\n\t\t\t\tself._updateBroadcasters();\r\n\t\t\t} else {\r\n\t\t\t\tself.setNode(node);\r\n\r\n\t\t\t}\r\n\t\t});\r\n\t} else {\r\n\t\tthis.setNode(node);\r\n\t}\r\n}\r\n\r\n/**\r\n * Set Node\r\n * @param {SystemNode} node\r\n */\r\nTreeSelectorDialogPageBinding.prototype.setNode = function (node) {\r\n\r\n\tthis._genericViewBinding.setNode(node);\r\n\tvar generictab = this.bindingWindow.bindingMap.generictab;\r\n\tgenerictab.containingTabBoxBinding.select(generictab, true);\r\n\tthis._updateHistory(node ? node.getEntityToken() : null);\r\n\tthis._updateBroadcasters();\r\n\tthis._updateAddressBar(node);\r\n\r\n\tif (node == undefined) {\r\n\t\tif (this._toolbarBinding) {\r\n\t\t\tthis._toolbarBinding.handleBroadcast(BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED, {\r\n\t\t\t\tactivePosition: this._activePosition,\r\n\t\t\t\tactionProfile: null,\r\n\t\t\t\tsyncHandle: this.getSyncHandle(),\r\n\t\t\t\tsource: this\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Set preview\r\n * @param {string} url\r\n */\r\nTreeSelectorDialogPageBinding.prototype.setPreview = function (url) {\r\n\r\n\tthis._isPushingUrl = true;\r\n\tvar previewframe = this.bindingWindow.bindingMap.previewframe;\r\n\tvar previewtab = this.bindingWindow.bindingMap.previewtab;\r\n\tpreviewframe.setURL(url);\r\n\tpreviewtab.containingTabBoxBinding.select(previewtab);\r\n}\r\n\r\n/**\r\n * Refresh Generic View\r\n */\r\nTreeSelectorDialogPageBinding.prototype.refreshView = function () {\r\n\r\n\tvar selectedTreeNode = this._treeBinding.getFocusedTreeNodeBindings().getFirst();\r\n\tif (selectedTreeNode) {\r\n\t\tthis.push(selectedTreeNode.node);\r\n\t\tthis._updateDisplayAndResult(this._treeBinding);\r\n\t} else {\r\n\t\tthis.push(undefined);\r\n\t\tthis._clearDisplayAndResult();\r\n\t}\r\n}\r\n\r\n/**\r\n * Inject root nodes in tree.\r\n * @param {List<object>}\r\n */\r\nTreeSelectorDialogPageBinding.prototype._injectTreeNodes = function (list) {\r\n\r\n\twhile (list.hasNext()) {\r\n\r\n\t\t/*\r\n\t\t* Fetch key and search.\r\n\t\t*/\r\n\t\tvar object = list.getNext();\r\n\t\tvar key = object.key;\r\n\t\tvar search = object.search;\r\n\r\n\t\t/*\r\n\t\t* Search could be both a searchtoken *or* a searchtoken key.\r\n\t\t*/\r\n\t\tif (search != null && SearchTokens.hasToken(search)) {\r\n\t\t\tsearch = SearchTokens.getToken(search);\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* Build treenodes.\r\n\t\t*/\r\n\t\tvar roots = System.getNamedRootsBySearchToken(key, search);\r\n\r\n\t\tvar count = 0;\r\n\t\tvar expandNodes = new List([]);\r\n\t\tvar self = this;\r\n\r\n\t\twhile (roots.hasNext()) {\r\n\r\n\t\t\tvar treenode = SystemTreeNodeBinding.newInstance(\r\n\t\t\t\troots.getNext(),\r\n\t\t\t\tthis.bindingDocument\r\n\t\t\t)\r\n\t\t\ttreenode.autoExpand = true;\r\n\t\t\tthis._treeBinding.add(treenode);\r\n\t\t\ttreenode.attach();\r\n\r\n\t\t\t// Auto expand tree folders in selection dialogs, when only one folder can be expanded.\r\n\t\t\t// Expand last opened nodes\r\n\t\t\tcount++;\r\n\t\t\tif (!roots.hasNext() && count == 1 || LocalStore.openedNodes.has(treenode.node)) {\r\n\t\t\t\texpandNodes.add(treenode);\r\n\t\t\t}\r\n\r\n\t\t\t// Fill list of parents, used for handle refreshed tree\r\n\r\n\t\t\tvar parents = TreeService.GetAllParents(treenode.node.getEntityToken());\r\n\t\t\tnew List(parents).each(\r\n\t\t\t\tfunction (parent) {\r\n\t\t\t\t\tself._parents.add(parent);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t\texpandNodes.each(function (node) {\r\n\t\t\tif (node.isContainer && !node.isOpen) {\r\n\t\t\t\tvar self = node;\r\n\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\tself.open();\r\n\t\t\t\t}, 0);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tvar self = this;\r\n\tsetTimeout(function () {\r\n\r\n\t}, 0);\r\n}\r\n\r\n/**\r\n * Executed when the page is shown.\r\n */\r\nTreeSelectorDialogPageBinding.prototype.onAfterPageInitialize = function () {\r\n\r\n\tTreeSelectorDialogPageBinding.superclass.onAfterPageInitialize.call(this);\r\n\r\n\tvar treeBinding = this._treeBinding;\r\n\tvar token = this._selectedToken;\r\n\t\r\n\tsetTimeout(function () {\r\n\t\ttreeBinding.focus();\r\n\t\tif (token)\r\n\t\t\ttreeBinding._focusTreeNodeByEntityToken(token);\r\n\t\telse\r\n\t\t\ttreeBinding.selectDefault();\r\n\t}, 0);\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {DialogPageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nTreeSelectorDialogPageBinding.prototype.handleAction = function (action) {\r\n\r\n\tif ( window.TreeSelectorDialogPageBinding && window.TreeBinding ) {  // huh?\r\n\r\n\t\tswitch (action.type) {\r\n\t\t\tcase WindowBinding.ACTION_ONLOAD:\r\n\t\t\t\tif (this.bindingWindow.bindingMap.previewframe == action.target) {\r\n\t\t\t\t\tthis._handleDocumentLoad(action.target);\r\n\t\t\t\t\taction.consume();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase ButtonBinding.ACTION_COMMAND:\r\n\t\t\t\tif (action.target && action.target.response == Dialog.RESPONSE_ACCEPT) {\r\n\t\t\t\t\tthis._saveOpenedSystemNodes();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._handleCommand(action.target.getProperty(\"cmd\"), action.target);\r\n\t\t\t\t\taction.consume();\r\n\t\t\t\t}\r\n\t\t\t\t//Disable bindingMap.buttonAccept after first invoke\r\n\t\t\t\tif (action.target == bindingMap.buttonAccept) {\r\n\t\t\t\t\tbindingMap.buttonAccept.setDisabled(true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase TreeNodeBinding.ACTION_COMMAND:\r\n\t\t\t\tbindingMap.buttonAccept.fireCommand();\r\n\t\t\t\tbreak;\r\n\t\t\tcase TreeBinding.ACTION_SELECTIONCHANGED:\r\n\t\t\t\tthis._updateDisplayAndResult(action.target);\r\n\r\n\t\t\t\tbreak;\r\n\t\t\tcase TreeBinding.ACTION_NOSELECTION :\r\n\t\t\t\tthis._clearDisplayAndResult();\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase GenericViewBinding.ACTION_COMMAND:\r\n\t\t\t\tif (action.target.node.hasChildren()) {\r\n\t\t\t\t\tthis.select(action.target.node.getEntityToken());\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbindingMap.buttonAccept.fireCommand();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\t\t\tcase PathBinding.ACTION_COMMAND:\r\n\t\t\t\tthis.select(action.target.entityToken);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tTreeSelectorDialogPageBinding.superclass.handleAction.call ( this, action );\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Handle loaded document.\r\n * @param {WindowBinding} binding\r\n */\r\nTreeSelectorDialogPageBinding.prototype._handleDocumentLoad = function (binding) {\r\n\r\n\tvar url = new String(binding.getContentDocument().location);\r\n\r\n\tthis._stateKey = KeyMaster.getUniqueKey();\r\n\r\n\t/*\r\n\t * Update stuff.\r\n\t */\r\n\tthis._updateAddressBar(url);\r\n\r\n\tif (!this._isPushingUrl) {\r\n\t\tvar self = this;\r\n\t\tvar stateKey = this._stateKey;\r\n\t\tTreeService.GetEntityTokenByPageUrl(url, function (entityToken) {\r\n\t\t\tif (stateKey === self._stateKey) {\r\n\t\t\t\tself._entityToken = entityToken;\r\n\t\t\t\tself.select(entityToken);\r\n\t\t\t\tself._updateHistory(entityToken);\r\n\t\t\t\tself._updateBroadcasters();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t}\r\n\r\n\tthis._isPushingUrl = false;\r\n}\r\n\r\n/**\r\n* Save last opened system nodes Update selections display and store result.\r\n*/\r\nTreeSelectorDialogPageBinding.prototype._saveOpenedSystemNodes = function () {\r\n\tLocalStore.openedNodes.clear();\r\n\tvar treenodes = this._treeBinding.getOpenSystemNodes();\r\n\ttreenodes.each(\r\n\t\tfunction (treenode) {\r\n\t\t\tLocalStore.openedNodes.add(treenode)\r\n\t\t}\r\n\t);\r\n}\r\n\r\n/**\r\n * Update selections display and store result.\r\n */\r\nTreeSelectorDialogPageBinding.prototype._updateDisplayAndResult = function (tree) {\r\n\r\n\r\n\tvar selections \t= tree.getSelectedTreeNodeBindings ();\r\n\tvar dataInput\t= this.bindingWindow.DataManager.getDataBinding ( \"treeselectionresult\" );\r\n\tvar okButton\t= bindingMap.buttonAccept;\r\n\tvar result \t\t= new List ();\r\n\tvar value \t\t= new String ( \"\" );\r\n\tvar prop \t\t= this._selectionResult;\r\n\r\n\tselections.each ( function ( binding ) {\r\n\t\tresult.add(\r\n\t\t\tbinding.getProperty(prop)\r\n\t\t);\r\n\t\tvalue += binding.getLabel ();\r\n\t\tif ( selections.hasNext ()) {\r\n\t\t\tvalue += \"; \";\r\n\t\t}\r\n\t});\r\n\r\n\tif ( dataInput.isDisabled ) {\r\n\t\tdataInput.enable ();\r\n\t\tokButton.enable ();\r\n\t}\r\n\r\n\tdataInput.setValue ( value );\r\n\tthis.result = result;\r\n}\r\n\r\n/**\r\n * Cleart selections display and null result.\r\n */\r\nTreeSelectorDialogPageBinding.prototype._clearDisplayAndResult = function () {\r\n\r\n\tvar dataInput = this.bindingWindow.DataManager.getDataBinding ( \"treeselectionresult\" );\r\n\tvar okButton = bindingMap.buttonAccept;\r\n\r\n\tif ( !dataInput.isDisabled ) {\r\n\t\tdataInput.disable ();\r\n\t\tokButton.disable ();\r\n\t}\r\n\r\n\tdataInput.setValue ( \"\" );\r\n\tthis.result = null;\r\n}\r\n\r\n/**\r\n * @param {string} url\r\n */\r\nTreeSelectorDialogPageBinding.prototype._updateAddressBar = function (address) {\r\n\tvar bar = this.bindingWindow.bindingMap.addressbar;\r\n\tif (bar != null) {\r\n\t\tif (typeof (address) == \"string\" || address instanceof String) {\r\n\t\t\tvar url = address;\r\n\t\t\tbar.showAddreesbar(url);\r\n\t\t} else {\r\n\t\t\tvar treenode = this._treeBinding.getFocusedTreeNodeBindings().getFirst();\r\n\t\t\tif (treenode) {\r\n\t\t\t\tvar parents = new List();\r\n\t\t\t\tvar element = treenode.bindingElement;\r\n\t\t\t\twhile ((element = element.parentNode) != null) {\r\n\t\t\t\t\tvar parent = UserInterface.getBinding(element);\r\n\t\t\t\t\tif (parent instanceof SystemTreeNodeBinding) {\r\n\t\t\t\t\t\tparents.add(parent.node);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbar.showBreadcrumb(treenode.node, parents);\r\n\t\t\t} else {\r\n\t\t\t\tbar.showBreadcrumb();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle command (navbar or contextmenu).\r\n * @param {string} cmd\r\n * @param {Binding} binding\r\n */\r\nTreeSelectorDialogPageBinding.prototype._handleCommand = function (cmd, binding) {\r\n\r\n\t/*\r\n\t * Because of a bug in the history object in Prism 0.91,\r\n\t * we cannot invoke history.back and stuff. We have\r\n\t * to load new URLs from our own history. This will\r\n\t * destroy native history.back in document, so please\r\n\t * fix at some point...\r\n\t * @see https://bugzilla.mozilla.org/show_bug.cgi?id=429550\r\n\t */\r\n\tswitch (cmd) {\r\n\t\tcase \"back\":\r\n\t\t\tthis._isHistoryBrowsing = true;\r\n\t\t\tvar item = this._current.history.get(--this._current.index);\r\n\t\t\tthis.select(item);\r\n\t\t\tbreak;\r\n\t\tcase \"forward\":\r\n\t\t\tthis._isHistoryBrowsing = true;\r\n\t\t\tvar item = this._current.history.get(++this._current.index);\r\n\t\t\tthis.select(item);\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"refresh\":\r\n\t\t\tthis._treeBinding._handleCommandBroadcast(BroadcastMessages.SYSTEMTREEBINDING_REFRESH);\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"home\":\r\n\t\t\tvar rootNode = this._treeBinding.getRootTreeNodeBindings().getFirst();\r\n\t\t\tif (rootNode) {\r\n\t\t\t\tthis._treeBinding.focusSingleTreeNodeBinding(rootNode);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"toggletree\":\r\n\t\t\tvar toggletreebutton = this.bindingWindow.bindingMap.toggletreebutton;\r\n\t\t\tvar explorerpanel = this.bindingWindow.bindingMap.explorerpanel;\r\n\t\t\tif (toggletreebutton.isChecked) {\r\n\t\t\t\texplorerpanel.show();\r\n\t\t\t} else {\r\n\t\t\t\texplorerpanel.hide();\r\n\t\t\t}\r\n\t\t\tthis.reflex();\r\n\t\t\tbreak;\r\n\r\n\t}\r\n}\r\n\r\n/*\r\n * Update history.\r\n * @param {object} item\r\n */\r\nTreeSelectorDialogPageBinding.prototype._updateHistory = function (item) {\r\n\r\n\tif (this._isHistoryBrowsing == true) {\r\n\t\tthis._isHistoryBrowsing = false;\r\n\t} else {\r\n\t\tif (item != null) {\r\n\t\t\twhile (this._current.history.getLength() - 1 > this._current.index) {\r\n\t\t\t\tthis._current.history.extractLast();\r\n\t\t\t}\r\n\t\t\tthis._current.history.add(item);\r\n\t\t\tthis._current.index++;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*\r\n * Clear history\r\n */\r\nTreeSelectorDialogPageBinding.prototype._clearHistory = function () {\r\n\r\n\tif (!this._current) {\r\n\t\tthis._current = {\r\n\t\t\thistory: new List(),\r\n\t\t\tindex: parseInt(-1)\r\n\t\t};\r\n\t}\r\n\r\n\twhile (this._current.history.getLength() > 1) {\r\n\t\tthis._current.history.del(0);\r\n\t\tthis._current.index = this._current.history.getLength() - 1;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Update broadcasters.\r\n */\r\nTreeSelectorDialogPageBinding.prototype._updateBroadcasters = function () {\r\n\r\n\tvar back = window.bindingMap.broadcasterHistoryBack;\r\n\tvar forward = window.bindingMap.broadcasterHistoryForward;\r\n\r\n\tif (this._current.index > 0) {\r\n\t\tback.enable();\r\n\t} else {\r\n\t\tback.disable();\r\n\t}\r\n\tif (this._current.index < this._current.history.getLength() - 1) {\r\n\t\tforward.enable();\r\n\t} else {\r\n\t\tforward.disable();\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onDialogResponse}\r\n*/\r\nTreeSelectorDialogPageBinding.prototype.onDialogResponse = function () {\r\n\r\n\tStageBinding.treeSelector = null;\r\n\r\n\tTreeSelectorDialogPageBinding.superclass.onDialogResponse.call(this);\r\n\r\n}\r\n\r\nTreeSelectorDialogPageBinding.prototype.getSyncHandle = function () {\r\n\treturn this.getID();\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/treeselector/TreeSelectorToolBarBinding.js",
    "content": "TreeSelectorToolBarBinding.prototype = new SystemToolBarBinding;\r\nTreeSelectorToolBarBinding.prototype.constructor = TreeSelectorToolBarBinding;\r\nTreeSelectorToolBarBinding.superclass = SystemToolBarBinding.prototype;\r\n\r\n\r\n/**\r\n * @class\r\n * This would be the giant toolbar at the top of the main window.\r\n */\r\nfunction TreeSelectorToolBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TreeSelectorToolBarBinding\" );\r\n\r\n\t/**\r\n\t* Tree position \r\n\t* @type {int}\r\n\t*/\r\n\tthis._activePosition = SystemAction.activePositions.SelectorTree;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTreeSelectorToolBarBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TreeSelectorToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * Contain all buttons. Overflowing buttons are moved to a popup. \r\n * The margin between buttons and groups are not accounted for...\r\n */\r\nTreeSelectorToolBarBinding.prototype._containAllButtons = function () {\r\n\t\r\n\tvar mores = this.bindingWindow.bindingMap.moreactionstoolbargroup;\r\n\tvar avail = this.bindingWindow.bindingMap.toolbar.boxObject.getDimension().w - this._moreActionsWidth - 6;\r\n\tvar total = 0;\r\n\tvar hides = new List ();\r\n\t\r\n\tvar button, buttons = this._toolBarBodyLeft.getDescendantBindingsByLocalName ( \"toolbarbutton\" );\r\n\twhile (( button = buttons.getNext ()) != null ) {\r\n\t\tif ( !button.isVisible ) {\r\n\t\t\tbutton.show ();\r\n\t\t}\r\n\t\ttotal += button.boxObject.getDimension ().w;\r\n\t\tif ( total >= avail ) {\r\n\t\t\thides.add ( button );\r\n\t\t\tbutton.hide ();\r\n\t\t}\r\n\t}\r\n\t\r\n\tif ( hides.hasEntries ()) {\r\n\t\t\r\n\t\tvar group = hides.getFirst ().bindingElement.parentNode;\r\n\t\tUserInterface.getBinding ( group ).setLayout ( ToolBarGroupBinding.LAYOUT_LAST );\r\n\t\t\r\n\t\tthis._moreActions = new List ();\r\n\t\twhile (( button = hides.getNext ()) != null ) {\r\n\t\t\tthis._moreActions.add ( button.associatedSystemAction );\r\n\t\t}\r\n\t\tmores.show ();\r\n\t\t\r\n\t} else {\r\n\t\tthis._moreActions = null;\r\n\t\tmores.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * TreeSelectorToolBarBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TreeSelectorToolBarBinding}\r\n */\r\nTreeSelectorToolBarBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbar\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, TreeSelectorToolBarBinding );\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/treeselector/treeselector.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\t<title>Composite.Management.Dialog.TreeSelector</title>\r\n\t<control:styleloader runat=\"server\" />\r\n\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t<script type=\"text/javascript\" src=\"TreeSelectorDialogPageBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"TreeSelectorToolBarBinding.js\"></script>\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"treeselector.css.aspx\" />\r\n</head>\r\n<body>\r\n\t<ui:broadcasterset>\r\n\t\t<ui:broadcaster id=\"broadcasterHistoryBack\" isdisabled=\"true\" />\r\n\t\t<ui:broadcaster id=\"broadcasterHistoryForward\" isdisabled=\"true\" />\r\n\t\t<ui:broadcaster id=\"broadcasterBrowserView\" isdisabled=\"true\" />\r\n\t</ui:broadcasterset>\r\n\t<ui:popupset id=\"masterpopupset\">\r\n\t\t<ui:popup id=\"moreactionspopup\" position=\"bottom\" />\r\n\t</ui:popupset>\r\n\t<ui:dialogpage binding=\"TreeSelectorDialogPageBinding\"\r\n\t\tlabel=\"(title supplied as page argument!)\"\r\n\t\twidth=\"1200\"\r\n\t\theight=\"750\"\r\n\t\tresizable=\"false\"\r\n\t\tclass=\"with-top-toolbar\">\r\n\t\t<ui:toolbar id=\"toolbar\" binding=\"TreeSelectorToolBarBinding\" imagesize=\"large\" class=\"white\">\r\n\t\t\t<ui:toolbarbody />\r\n\t\t\t<ui:toolbarbody id=\"moreactionstoolbargroup\">\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:toolbarbutton id=\"moreactionsbutton\" label=\"${string:Composite.Management:Website.Misc.Toolbar.LabelShowMoreActions}\" popup=\"moreactionspopup\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>\r\n\t\t<ui:toolbar id=\"navbar\" class=\"dark\">\r\n\t\t\t<ui:toolbarbody>\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:toolbarbutton id=\"toggletreebutton\" cmd=\"toggletree\" image=\"${icon:nodes}\" binding=\"CheckButtonBinding\" ischecked=\"true\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.TreeView.ToolTip}\" />\r\n\t\t\t\t\t<ui:toolbarbutton class=\"btn-group-left\" cmd=\"back\" image=\"${icon:previous}\" image-disabled=\"${icon:previous-disabled}\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Back.ToolTip}\" observes=\"broadcasterHistoryBack\" />\r\n\t\t\t\t\t<ui:toolbarbutton class=\"btn-group-right\" cmd=\"forward\" image=\"${icon:next}\" image-disabled=\"${icon:next-disabled}\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Forward.ToolTip}\" observes=\"broadcasterHistoryForward\" />\r\n\t\t\t\t\t<ui:toolbarbutton cmd=\"refresh\" image=\"${icon:refresh}\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Refresh.ToolTip}\" />\r\n\t\t\t\t\t<ui:toolbarbutton cmd=\"home\" image=\"${icon:home}\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Home.ToolTip}\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t\t<ui:toolbarbody align=\"right\" class=\"max\" style=\"overflow: hidden;\">\r\n\t\t\t\t<ui:toolbargroup class=\"max\">\r\n\t\t\t\t\t<ui:datainput id=\"addressbar\" name=\"addressbar\" autoselect=\"true\" binding=\"AddressBarBinding\" readonly=\"true\"/>\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>\r\n\t\t<ui:pagebody class=\"pad-0\">\r\n\r\n\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"2:3\" class=\"line\">\r\n\t\t\t\t<ui:splitpanel id=\"explorerpanel\">\r\n\t\t\t\t\t<ui:tree id=\"selectiontree\" binding=\"SystemTreeBinding\" selectiontype=\"single\" actionaware=\"true\"\r\n\t\t\t\t\t\ttreeselector=\"true\" locktoeditor=\"false\">\r\n\t\t\t\t\t\t<ui:treebody />\r\n\t\t\t\t\t</ui:tree>\r\n\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t<ui:splitter />\r\n\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t<ui:tabbox id=\"browsertabbox\">\r\n\t\t\t\t\t\t<ui:tabs hidden=\"true\">\r\n\t\t\t\t\t\t\t<ui:tab id=\"generictab\"/>\r\n\t\t\t\t\t\t\t<ui:tab id=\"previewtab\"/>\r\n\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t<ui:tree id=\"genericview\" treeselector=\"true\" binding=\"GenericViewBinding\" selectiontype=\"single\"\r\n\t\t\t\t\t\t\t\t\tlocktoeditor=\"false\">\r\n\t\t\t\t\t\t\t\t\t<ui:treebody />\r\n\t\t\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t<ui:window id=\"previewframe\" />\r\n\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t</ui:tabbox>\r\n\t\t\t\t</ui:splitpanel>\r\n\t\t\t</ui:splitbox>\r\n\t\t</ui:pagebody>\r\n\r\n\t\t<ui:dialogtoolbar>\r\n\t\t\t<ui:toolbarbody class=\"max\">\r\n\t\t\t\t<ui:toolbargroup class=\"max\">\r\n\t\t\t\t\t<ui:datainput readonly=\"true\" isdisabled=\"true\" id=\"treeselectionresult\" name=\"treeselectionresult\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\" class=\"right\">\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" id=\"buttonAccept\" response=\"accept\" isdisabled=\"true\" focusable=\"true\" default=\"true\" />\r\n\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:dialogtoolbar>\r\n\t</ui:dialogpage>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/dialogs/treeselector/treeselector.css",
    "content": "@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|datainput#treeselectionresult {\r\n\topacity: 1;\r\n}\r\n\r\nui|datainput#treeselectionresult ui|box {\r\n\tborder: none;\r\n\tbackground: none;\r\n}\r\n\r\nui|datainput#treeselectionresult ui|box input {\r\n\ttext-align: center;\r\n\tbackground: none;\r\n\tcolor: #343434;\r\n\tpadding: 10px 0 0 0 !important;\r\n\tfont-size: 12px;\r\n\twidth: 100%;\r\n\ttext-align: left;\r\n}\r\n#addressbar input {\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tpadding-top: 2px;\r\n\tpadding-left: 5px;\r\n\tbackground-color: #fff;\r\n}\r\nui|datainput#addressbar ui|box,\r\nui|datainput#addressbar ui|toolbarbutton {\r\n\tbackground-color: #fff;\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/util/comparestrings/CompareStringsDialogPageBinding.js",
    "content": "CompareStringsDialogPageBinding.prototype = new DialogPageBinding;\r\nCompareStringsDialogPageBinding.prototype.constructor = CompareStringsDialogPageBinding;\r\nCompareStringsDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\nCompareStringsDialogPageBinding.URL_CONTENT = \"comparestringscontent.html\";\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction CompareStringsDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"CompareStringsDialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._newval = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._oldval = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCompareStringsDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[CompareStringsDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBindingAttach}\r\n */\r\nCompareStringsDialogPageBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tCompareStringsDialogPageBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\t/*\r\n\t * Setup to inject iframe as soon as it is loaded. \r\n\t * Also disabling the contextmenu...\r\n\t */\r\n\tvar self = this;\r\n\tbindingMap.win.addActionListener ( WindowBinding.ACTION_ONLOAD, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tvar url = action.target.getURL ();\r\n\t\t\tif ( url == CompareStringsDialogPageBinding.URL_CONTENT ) {\r\n\t\t\t\tself._compare ();\r\n\t\t\t\tDOMEvents.addEventListener (\r\n\t\t\t\t\taction.target.getContentDocument (),\r\n\t\t\t\t\tDOMEvents.CONTEXTMENU, {\r\n\t\t\t\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Store page arguments.\r\n */\r\nCompareStringsDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tCompareStringsDialogPageBinding.superclass.setPageArgument.call ( this, arg );\r\n\t\r\n\tthis._string1 = arg.string1;\r\n\tthis._string2 = arg.string2;\r\n}\r\n\r\n/**\r\n * Compare!\r\n */\r\nCompareStringsDialogPageBinding.prototype._compare = function () {\r\n\t\r\n\tvar string1 = this._string1;\r\n\tvar string2 = this._string2;\r\n\t\r\n\t/*\r\n\t * Conjure up the DiffService.\r\n\t */\r\n\tif ( top.DiffService == null ) {\r\n\t\ttop.DiffService\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_DIFFSERVICE );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Summon diff result and inject to iframe.\r\n\t */\r\n\tvar doc = bindingMap.win.getContentDocument ();\r\n\tvar markup = null;\r\n\t\r\n\tif ( string1 != null && string2 != null ) {\r\n\t\tmarkup = this._getMarkup ( \r\n\t\t\tnew List (\r\n\t\t\t\ttop.DiffService.GetDifference ( string1, string2, \"\\n\" )\r\n\t\t\t)\r\n\t\t);\r\n\t} else if ( string1 == null || string2 == null ) {\r\n\t\tmarkup = this._getSpecialMarkup ( string1, string2 );\r\n\t} else { \t\r\n\t\tmarkup = \"<p style=\\\"color:red;\\\">Nothing to compare!</p>\";\r\n\t}\r\n\t\r\n\tif ( markup != null ) {\r\n\t\tdoc.body.innerHTML = markup;\r\n\t}\r\n}\r\n\r\n/**\r\n * Build markup for a real diff-comparison.\r\n * @param {List<object>} diffs\r\n */\r\nCompareStringsDialogPageBinding.prototype._getMarkup = function ( diffs ) {\r\n\r\n\tvar markup = \"<pre>\";\r\n\tvar linecount = 0;\r\n\tvar self = this;\r\n\t\r\n\tdiffs.each ( function ( diff ) {\r\n\t\t\r\n\t\tmarkup += \"<span class=\\\"type\" + String ( diff.DiffType ) + \"\\\" \";\r\n\t\tswitch ( diff.DiffType ) {\r\n\t\t\tcase 1 :\r\n\t\t\t\tmarkup += \"title=\\\"This text was DELETED between two versions\\\" \";\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2 :\r\n\t\t\t\tmarkup += \"title=\\\"This text was ADDED between two versions\\\" \";\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tmarkup += \">\";\r\n\t\tvar lines = new List ( diff.Lines );\r\n\t\tlines.each ( function ( line ) {\r\n\t\t\tif ( line != null ) {\r\n\t\t\t\tmarkup += self._encode ( line ) + \"<br/>\";\r\n\t\t\t}\r\n\t\t});\r\n\t\tmarkup += \"</span>\";\r\n\t});\r\n\t\r\n\tmarkup += \"</pre>\";\r\n\treturn markup;\r\n}\r\n\r\n/**\r\n * When one string is null.\r\n * @param {string} string1\r\n * @param {string} string2\r\n * @return\r\n */\r\nCompareStringsDialogPageBinding.prototype._getSpecialMarkup = function ( string1, string2 ) {\r\n\t\r\n\tvar classname = string1 == null ? \"type2\" : \"type1\";\r\n\tmarkup = \"<pre><span class=\\\"\" + classname + \"\\\">\";\r\n\t\r\n\tvar self = this;\r\n\tvar string = string1 == null ? string2 : string1;\r\n\tvar lines = new List ( string.split ( \"\\n\" ));\r\n\tlines.each ( function ( line ) {\r\n\t\tmarkup += self._encode ( line ) + \"<br/>\";\r\n\t});\r\n\tmarkup += \"</span></pre>\";\r\n\treturn markup;\r\n}\r\n\r\n/**\r\n * HTML-encode line. And some other tricks.\r\n * @param {string} line\r\n * @return {string}\r\n */\r\nCompareStringsDialogPageBinding.prototype._encode = function ( line ) {\r\n\t\r\n\tline = line.replace ( /&/g, \"&amp;\" );\r\n\tline = line.replace ( /\\\"/g, \"&quot;\" );\r\n\tline = line.replace ( /</g, \"&lt;\" );\r\n\tline = line.replace ( />/g, \"&gt;\" );\r\n\t\r\n\t/*\r\n\t * Note that we boldly assume all TABS to be \r\n\t * locating in the leading section of the line.\r\n\t */\r\n\tvar index = line.lastIndexOf ( \"\\t\" );\r\n\tif ( index >-1 ) {\r\n\t\tline = line.substring ( 0, index ) + \"<em>\" + line.substring ( index + 1, line.length ) + \"</em>\";\r\n\t\tline = line.replace ( /\\t/g, \"&nbsp;&nbsp;&nbsp;&nbsp;\" );\r\n\t} else {\r\n\t\tline = \"<em>\" + line + \"</em>\";\r\n\t}\r\n\t\r\n\treturn line;\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/util/comparestrings/comparestrings.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialog.TreeSelector</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"CompareStringsDialogPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"CompareStringsNodeCrawler.js\"></script>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"comparestrings.css.aspx\"/>\r\n\t</head>\r\n\t<body>\r\n\t\r\n\t\t<ui:dialogpage \r\n\t\t\tbinding=\"CompareStringsDialogPageBinding\"\r\n\t\t\tlabel=\"Comparison\"\r\n\t\t\timage=\"${icon:versioning-compare}\" \r\n\t\t\twidth=\"750\"\r\n\t\t\theight=\"500\"\r\n\t\t\tresizable=\"false\">\r\n\t\t\t\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:flexbox>\r\n\t\t\t\t\t<ui:window id=\"win\" url=\"comparestringscontent.html\"/>\r\n\t\t\t\t</ui:flexbox>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t\t\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/util/comparestrings/comparestrings.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|flexbox {\r\n\tborder: 1px solid;\r\n\tborder-color: #ddd;\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/util/comparestrings/comparestringscontent.css",
    "content": "html {\r\n\tborder: none;\r\n}\r\nbody {\r\n\tbackground: white none;\r\n\tpadding: 0;\r\n\tmargin: 0;\r\n\tfont-family: \"Courier New\", monospace;\r\n\tfont-size: 13px;\r\n\toverflow: auto;\r\n\twhite-space: nowrap;\r\n}\r\nem {\r\n\tfont-style: normal;\r\n}\r\nspan {\r\n\tdisplay: block;\r\n\tpadding-left: 12px;\r\n\tpadding-right: 12px;\r\n}\r\nspan.type1,\r\nspan.type2 {\r\n\tbackground-color: $(color:infobackground);\r\n\tcolor: $(color:infotext);\r\n\tdisplay: block;\r\n}\r\nspan.type1 em {\r\n\tcolor: $(color:graytext);\r\n\ttext-decoration: line-through;\r\n}\r\nspan.type2 em {\r\n\tfont-weight: bold;\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/util/comparestrings/comparestringscontent.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n\t<head>\r\n\t\t<title>Compare!</title>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"comparestringscontent.css\"/>\r\n\t</head>\r\n\t<body>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/webservices/WebServiceErrorDialogPageBinding.js",
    "content": "WebServiceErrorDialogPageBinding.prototype = new DialogPageBinding;\r\nWebServiceErrorDialogPageBinding.prototype.constructor = WebServiceErrorDialogPageBinding;\r\nWebServiceErrorDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction WebServiceErrorDialogPageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"WebServiceErrorDialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {SOAPFault}\r\n\t */\r\n\tthis._soapFault = null;\r\n\t\r\n\t/**\r\n\t * @type {SOAPRequest}\r\n\t */\r\n\tthis._soapRequest = null;\r\n\t\r\n\t/**\r\n\t * @type {SOAPRequestResponse}\r\n\t */\r\n\tthis._soapResponse = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nWebServiceErrorDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[WebServiceErrorDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#setPageArgument}\r\n * @param {SOAPFault} arg\r\n */\r\nWebServiceErrorDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tthis._soapFault \t= arg.soapFault;\r\n\tthis._soapRequest \t= arg.soapRequest;\r\n\tthis._soapResponse \t= arg.soapResponse;\r\n\t\r\n\tWebServiceErrorDialogPageBinding.superclass.setPageArgument.call ( this, arg );\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nWebServiceErrorDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tvar span = this.bindingDocument.getElementById ( \"operationname\" );\r\n\tspan.firstChild.data = this._soapFault.getOperationName ();\r\n\t\r\n\tvar textarea = this.bindingDocument.getElementById ( \"faultstring\" );\r\n\ttextarea.value = this._soapFault.getFaultString ();\r\n\t\r\n\tWebServiceErrorDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/webservices/error.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WebServices.Error</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"error.css.aspx\"/>\r\n\t\t<script type=\"text/javascript\" src=\"WebServiceErrorDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\r\n\t\t<ui:dialogpage binding=\"WebServiceErrorDialogPageBinding\"\r\n\t\t\tlabel=\"${string:Website.Dialogs.WebServices.LabelWebServiceError}\" \r\n\t\t\timage=\"${icon:error}\"\r\n\t\t\tclass=\"error\" \r\n\t\t\tresizable=\"true\"\r\n\t\t\twidth=\"700\"\r\n\t\t\theight=\"500\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<table id=\"dialoglayout\">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td id=\"dialogvignette\">\r\n\t\t\t\t\t\t\t<ui:dialogvignette/>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td id=\"dialogtext\">\r\n\t\t\t\t\t\t\t<ui:text label=\"${string:Website.Dialogs.WebServices.Error}\"/><span id=\"operationname\">${operationname}</span>.\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td></td>\r\n\t\t\t\t\t\t<td id=\"textarea\">\r\n\t\t\t\t\t\t\t<textarea wrap=\"off\" id=\"faultstring\" spellcheck=\"false\" readonly=\"readonly\"></textarea>\r\n\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t<ui:tabbox typed=\"boxed\">\r\n\t\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"Fault String\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"Request XML\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"Response XML\"/>\r\n\t\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t<textarea wrap=\"off\" id=\"faultstring\" spellcheck=\"false\" readonly=\"readonly\"></textarea>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t -->\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/webservices/error.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\ntable#dialoglayout,\r\ntd#textarea {\r\n\theight: 100%;\r\n\twidth: 100%;\r\n}\r\ntextarea {\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\toverflow: auto;\r\n\tbackground-color: transparent;\r\n\tborder: none;\r\n\tdisplay: block;\r\n}\r\ntd#textarea {\r\n\tborder: 1px solid;\r\n\tborder-color: $(color:threeddarkshadow) $(color:threedshadow) $(color:threedshadow) $(color:threeddarkshadow);\r\n\tbackground-color: white;\r\n\t/*\r\n\tbackground: white url(\"error.png\") no-repeat 100% 100%;\r\n\t*/\r\n}\r\nspan#operationname {\r\n\tfont-weight: bold;\t\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/wysiwygeditor/VisualEditorDialogPageBinding.js",
    "content": "VisualEditorDialogPageBinding.prototype = new DialogPageBinding;\r\nVisualEditorDialogPageBinding.prototype.constructor = VisualEditorDialogPageBinding;\r\nVisualEditorDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction VisualEditorDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorDialogPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorDialogPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[VisualEditorDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * Transfer all argument properties to editor instance.\r\n * @param {object} arg\r\n */\r\nVisualEditorDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\t/*\r\n\t * Dialog title.\r\n\t */\r\n\tthis.label = arg.label;\r\n\t\r\n\t/*\r\n\t * Deprecated!\r\n\t *\r\n\tvar textarea = this.bindingDocument.getElementById ( \"visualeditortextarea\" );\r\n\ttextarea.value = arg.value;\r\n\t*/\r\n\t\r\n\t/*\r\n\t * Editor value.\r\n\t */\r\n\tthis.bindingWindow.bindingMap.visualeditor.setValue ( arg.value );\r\n\t\r\n\t/*\r\n\t * Configuration.\r\n\t */ \r\n\tvar editor = this.bindingWindow.bindingMap.visualeditor;\r\n\tif ( editor && !editor.isAttached ) {\r\n\t\tfor ( var property in arg.configuration ) {\r\n\t\t\teditor.setProperty ( property, arg.configuration [ property ]);\r\n\t\t}\r\n\t} else {\r\n\t\tthrow \"VisualEditorDialogPageBinding dysfunction!\";\r\n\t}\r\n\t\r\n\tVisualEditorDialogPageBinding.superclass.setPageArgument.call ( this, arg );\r\n}\r\n\r\n/**\r\n * Must return a simple string.\r\n * @overloads {DialogPageBinding#onBindingAccept}\r\n */\r\nVisualEditorDialogPageBinding.prototype.onDialogAccept = function () {\r\n\t\r\n\tthis.response  = Dialog.RESPONSE_ACCEPT;\r\n\tthis.result = this.bindingWindow.bindingMap.visualeditor.getValue ();\r\n\r\n    VisualEditorDialogPageBinding.superclass.onDialogAccept.call ( this );\t\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/wysiwygeditor/errors/ContentErrorDialogPageBinding.js",
    "content": "ContentErrorDialogPageBinding.prototype = new DialogPageBinding;\r\nContentErrorDialogPageBinding.prototype.constructor = ContentErrorDialogPageBinding;\r\nContentErrorDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ContentErrorDialogPageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ContentErrorDialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * Supplied as page argument.\r\n\t * @type {SOAPFault}\r\n\t */\r\n\tthis._soapFault = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nContentErrorDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ContentErrorDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @param {SOAPFault} soapFault\r\n */\r\nContentErrorDialogPageBinding.prototype.setPageArgument = function ( soapFault ) {\r\n\t\r\n\tContentErrorDialogPageBinding.superclass.setPageArgument.call ( this, soapFault );\r\n\t\r\n\tthis._soapFault = soapFault;\r\n}\r\n\r\n/**\r\n * @param {SOAPFault} soapFault\r\n */\r\nContentErrorDialogPageBinding.prototype.onBeforePageInitialize = function ( soapFault ) {\r\n\t\r\n\tvar string = this._soapFault.getFaultString ();\r\n\tvar key = \"Failed to parse html:\\n\\n\";\r\n\tvar error = null;\r\n\t\r\n\t/*\r\n\t * Parse the HTMLTidy error message and extract the relevant part.\r\n\t */\r\n\tif ( string.indexOf ( key ) >-1 ) {\r\n\t\ttry {\r\n\t\t\tvar split = string.split ( key )[ 1 ];\r\n\t\t\terror = split.split ( \"\\n\" )[ 0 ];\r\n\t\t\terror = error.replace ( \" - Error:\", \":\" );\r\n\t\t} catch ( exception ) {\r\n\t\t\terror = \"Unknown error.\";\r\n\t\t\tthis.logger.error ( \"Error could not be parsed!\" );\r\n\t\t}\r\n\t} else {\r\n\t\terror = \"Unknown error.\";\r\n\t}\r\n\t\r\n\tthis.bindingDocument.getElementById ( \"error\" ).firstChild.data = error;\r\n\tContentErrorDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Force-unlock application interface. This is \r\n * needed when a switch to Preview tab was made \r\n * using invalid markup.\r\n * @overloads {PageBinding#onAfterPageInitialize}\r\n */\r\nContentErrorDialogPageBinding.prototype.onAfterPageInitialize = function () {\r\n\r\n\tContentErrorDialogPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\tif ( Application.isLocked ) {\r\n\t\tApplication.unlock ( this, true );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/wysiwygeditor/errors/contenterror.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Errors.ContentError</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"ContentErrorDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"ContentErrorDialogPageBinding\"\r\n\t\t\tlabel=\"${string:Composite.Web.VisualEditor:ContentError.DialogTitle}\" \r\n\t\t\timage=\"${icon:error}\"\r\n\t\t\tclass=\"error\" \r\n\t\t\tresizable=\"false\">\r\n\t\t\t<ui:flexbox>\r\n\t\t\t\t<table id=\"dialoglayout\">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td id=\"dialogvignette\">\r\n\t\t\t\t\t\t\t<ui:dialogvignette/>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td id=\"dialogtext\">\r\n\t\t\t\t\t\t\t<ui:text label=\"${string:Composite.Web.VisualEditor:ContentError.DialogText}\"/>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td></td>\r\n\t\t\t\t\t\t<td id=\"error\">${error}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t</ui:flexbox>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/wysiwygeditor/mozsecuritynote/mozsecuritynote.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Errors.ClipboardError</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage \r\n\t\t\tlabel=\"${string:Composite.Web.VisualEditor:MozSecurityNote.LabelSecurityStuff}\" \r\n\t\t\timage=\"${icon:warning}\"\r\n\t\t\tclass=\"warning\" \r\n\t\t\tresizable=\"false\"\r\n\t\t\twidth=\"340\">\r\n\t\t\t<ui:flexbox>\r\n\t\t\t\t<table id=\"dialoglayout\">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td id=\"dialogvignette\">\r\n\t\t\t\t\t\t\t<ui:dialogvignette/>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td id=\"dialogtext\">\r\n\t\t\t\t\t\t\t<ui:text label=\"${string:Composite.Web.VisualEditor:MozSecurityNote.TextSecurityStuff}\"/>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t</ui:flexbox>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelDisclosure}\" url=\"http://www.mozilla.org/editor/midasdemo/securityprefs.html\" focusable=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/dialogs/wysiwygeditor/visualeditordialog.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|visualeditor {\r\n\tborder-bottom: 1px solid $(color:threedshadow);\r\n}\r\nui|dialogtoolbar {\r\n\tborder-top: 1px solid $(color:threedhighlight) !important;\r\n\tborder-right: 1px solid $(color:threedshadow); /* should actually be removed from editor! */\r\n}"
  },
  {
    "path": "Website/Composite/content/dialogs/wysiwygeditor/wysiwygeditordialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"visualeditordialog.css.aspx\"/>\r\n\t\t<script type=\"text/javascript\" src=\"VisualEditorDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage \r\n\t\t\tbinding=\"VisualEditorDialogPageBinding\" \r\n\t\t\tid=\"visualeditordialogpage\" \r\n\t\t\tlabel=\"\" \r\n\t\t\theight=\"450\"\r\n\t\t\timage=\"${icon:mimetype-html}\" \r\n\t\t\tresizable=\"true\">\r\n\t\t\t\r\n\t\t\t<ui:visualeditor id=\"visualeditor\">\r\n\t\t\t</ui:visualeditor>\r\n\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" id=\"buttonAccept\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/flow/FlowUICompleted.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\ndiv#layout {\r\n\twidth: 185px;\r\n\theight: 220px;\r\n\tposition: absolute;\r\n\tleft: 50%;\r\n\ttop: 50%;\r\n\tmargin-left: -92px;\r\n\tmargin-top: -105px;\r\n}\r\ndiv#layout div#image {\r\n\t#alphabackdrop: url(\"${root}/images/actionended.png\");\r\n\twidth: 185px;\r\n\theight: 185px;\r\n}\r\ndiv#layout div#text {\r\n\tposition: absolute;\r\n\ttext-align: center;\r\n\tbottom: 0;\r\n\t-moz-user-select: none;\r\n\twidth: 120px;\r\n\tleft: 32px;\r\n}"
  },
  {
    "path": "Website/Composite/content/flow/FlowUICompleted.js",
    "content": "try {\r\n\tif ( top.Application != null ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * force unlock all - just in case.\r\n\t\t */\r\n\t\ttop.Application.unlock ( document.title, true );\r\n\t\t\r\n\t\t/*\r\n\t\t * Instructions to close the dialog are stacked on the \r\n\t\t * MessageQueue. A timeout value of zero is not enough... \r\n\t\t */\r\n\t\tsetTimeout ( function () {\r\n\t\t\ttop.MessageQueue.update ();\r\n\t\t}, 50 );\r\n\t}\r\n} catch ( exception ) {\r\n\tvar browser = window.navigator.userAgent;\r\n\tif ( browser.toLowerCase ().indexOf ( \"gecko\" ) >-1 ) {\r\n\t\tthrow exception;\r\n\t} else {\r\n\t\t/*\r\n\t\t * Explorer may be so cornered in its pityful \r\n\t\t * disgrace that it cannot even resolve \"top\"   \r\n\t\t * around here. Better do nothing about this \r\n\t\t * exception and hope for the best. The joke  \r\n\t\t * is that it seems to do just fine even when \r\n\t\t * the exception is encountered. Ridiculous.\r\n\t\t */\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/flow/FlowUICompletedPageBinding.js",
    "content": "FlowUICompletedPageBinding.prototype = new PageBinding;\r\nFlowUICompletedPageBinding.prototype.constructor = FlowUICompletedPageBinding;\r\nFlowUICompletedPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FlowUICompletedPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FlowUICompletedPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFlowUICompletedPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[FlowUICompletedPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nFlowUICompletedPageBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tFlowUICompletedPageBinding.superclass.onBindingDispose.call ( this );\r\n\t\r\n\tif ( this._timeout ) {\r\n\t\twindow.clearTimeout ( this._timeout );\r\n\t\tthis._timeout = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * Force unlock application and update message queue.\r\n * @overwrites {PageBinding#onAfterPageInitialize}\r\n */\r\nFlowUICompletedPageBinding.prototype.onAfterPageInitialize = function () {\r\n\t\r\n\t/*\r\n\t * Because of the terrible page-load driven interaction model, \r\n\t * this page is bound to appear at times we don't want to see it. \r\n\t * Show the message on a timeout to prevent weird images flashing.\r\n\t */\r\n\tif ( window.bindingMap ) { // why not always?\r\n\t\tvar cover = window.bindingMap.cover;\r\n\t\tthis._timeout = window.setTimeout ( function () {\r\n\t\t\tif ( Binding.exists ( cover )) {\r\n\t\t\t\tCoverBinding.fadeOut ( cover );\r\n\t\t\t}\r\n\t\t}, 1500 );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Force unlock. Something may have gotten stuck if we are here...\r\n\t */\r\n\tApplication.unlock ( this, true );\r\n\t\r\n\t/*\r\n\t * Fetch messages.\r\n\t */\r\n\tsetTimeout ( function () {\r\n\t\tMessageQueue.update ();\r\n\t}, 50 );\r\n}"
  },
  {
    "path": "Website/Composite/content/flow/FlowUi.aspx",
    "content": "<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"FlowUi.aspx.cs\" Inherits=\"Composite_Management_FlowUi\"\r\n    EnableEventValidation=\"false\" ValidateRequest=\"false\" %>\r\n"
  },
  {
    "path": "Website/Composite/content/flow/FlowUi.aspx.cs",
    "content": "using System;\r\nusing System.Threading;\r\nusing System.Web;\r\nusing System.Web.UI;\r\n\r\nusing Composite;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.FlowMediators;\r\n\r\n\r\npublic partial class Composite_Management_FlowUi : FlowPage\r\n{\r\n    private readonly int _startTickCount = Environment.TickCount;\r\n    private string _consoleId = null;\r\n    private string _uiContainerName = null;\r\n\r\n    private const string _consoleIdParameterName = \"consoleId\";\r\n    private const string _flowHandleParameterName = \"flowHandle\";\r\n    private const string _elementProviderNameParameterName = \"elementProvider\";\r\n\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        this.Error += Composite_Management_FlowUi_Error;\r\n        _consoleId = Request.QueryString[_consoleIdParameterName];\r\n        string flowHandleSerialized = Request.QueryString[_flowHandleParameterName];\r\n        string elementProviderName = Request.QueryString[_elementProviderNameParameterName];\r\n\r\n        if (string.IsNullOrEmpty(_consoleId)) throw new ArgumentNullException(_consoleIdParameterName, \"Missing query string parameter\");\r\n        if (string.IsNullOrEmpty(flowHandleSerialized)) throw new ArgumentNullException(_flowHandleParameterName, \"Missing query string parameter\");\r\n        if (string.IsNullOrEmpty(elementProviderName)) throw new ArgumentNullException(_elementProviderNameParameterName, \"Missing query string parameter\");\r\n\r\n        FlowHandle flowHandle = FlowHandle.Deserialize(flowHandleSerialized);\r\n\r\n        try\r\n        {\r\n            using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n            {\r\n                Control webControl = WebFlowUiMediator.GetFlowUi(flowHandle, elementProviderName, _consoleId, out _uiContainerName);\r\n\r\n                if (webControl == null)\r\n                {\r\n                    // TODO: check if \"httpContext.ApplicationInstance.CompleteRequest();\" can be used\r\n                    Response.Redirect(UrlUtils.ResolveAdminUrl(\"content/flow/FlowUiCompleted.aspx\"), true);\r\n                }\r\n                else\r\n                {\r\n                    this.Controls.Add(webControl);\r\n                }\r\n            }\r\n        }\r\n        catch (ThreadAbortException)\r\n        {\r\n            throw;\r\n        }\r\n        catch (Exception ex)\r\n        {\r\n            IConsoleMessageQueueItem errorLogEntry = new LogEntryMessageQueueItem\r\n            {\r\n                Sender = typeof(System.Web.UI.Page), Level = Composite.Core.Logging.LogLevel.Error, Message = ex.Message\r\n            };\r\n            ConsoleMessageQueueFacade.Enqueue(errorLogEntry, _consoleId);\r\n            throw;\r\n        }\r\n\r\n        Response.Cache.SetCacheability(HttpCacheability.NoCache);\r\n    }\r\n\r\n\r\n    void Composite_Management_FlowUi_Error(object sender, EventArgs e)\r\n    {\r\n        Composite.Core.WebClient.ErrorServices.DocumentAdministrativeError(Server.GetLastError());\r\n        Composite.Core.WebClient.ErrorServices.RedirectUserToErrorPage(_uiContainerName, Server.GetLastError());\r\n    }\r\n\r\n\r\n    protected override void OnUnload(EventArgs e)\r\n    {\r\n        if (Composite.RuntimeInformation.IsDebugBuild)\r\n        {\r\n            int endTickCount = Environment.TickCount;\r\n            Log.LogVerbose(\"FlowUi.aspx\", \"Time spent serving request: {0} ms\", endTickCount - _startTickCount);\r\n            base.OnUnload(e);\r\n        }\r\n    }\r\n\r\n}"
  },
  {
    "path": "Website/Composite/content/flow/FlowUi.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_Management_FlowUi {\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/flow/FlowUiCompleted.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n    <head runat=\"server\">\r\n        <title>Composite.Management.CompletedUI</title>\r\n        <control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"FlowUICompleted.css.aspx\"/>\r\n\t\t<script type=\"text/javascript\" src=\"FlowUICompletedPageBinding.js\"></script>\r\n    </head>\r\n    <body>\r\n    \t<ui:page \r\n    \t\tbinding=\"FlowUICompletedPageBinding\" \r\n    \t\tlabel=\"${string:Website.FlowUICompleted.ExecutionEndedTitle}\" \r\n    \t\timage=\"${icon:generic-delete}\">\r\n\t        <div id=\"layout\">\r\n\t\t\t\t<ui:cover id=\"cover\" busy=\"false\"/>\r\n\t        \t<div id=\"image\"></div>\r\n\t        \t<div id=\"text\">\r\n\t\t            <ui:text label=\"${string:Website.FlowUICompleted.ExecutionEndedMessage}\"/>\r\n\t\t\t\t</div>\r\n\t        </div>\r\n\t    </ui:page>\r\n    </body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/flow/FlowUiCompletedDialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.FlowUiCompletedDialog</title>\r\n\t\t<script type=\"text/javascript\" src=\"FlowUICompleted.js\"></script>\r\n\t\t<style type=\"text/css\">\r\n\t\t\thtml,\r\n\t\t\tbody {\r\n\t\t\t\tmargin: 0;\r\n\t\t\t\tpadding: 0;\r\n\t\t\t\tborder: none;\r\n\t\t\t\tbackground-color: ThreeDFace;\t\r\n\t\t\t}\r\n\t\t</style>\r\n\t</head>\r\n\t<body>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddAssociatedDataWorkflowTypeSelection.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedType\" type=\"System.Type\" />\r\n    <cms:binding name=\"Types\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedDataWorkflow.FieldGroupLabel}\">\r\n      <TypeSelector Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedDataWorkflow.TypeSelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedDataWorkflow.TypeSelectorHelp}\">\r\n        <TypeSelector.TypeOptions>\r\n          <cms:read source=\"Types\" />\r\n        </TypeSelector.TypeOptions>\r\n        <TypeSelector.SelectedType>\r\n          <cms:bind source=\"SelectedType\" />\r\n        </TypeSelector.SelectedType>\r\n      </TypeSelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddAssociatedTypeAddExisting.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedExistingType\" type=\"System.Type\" />\r\n    <cms:binding name=\"ExistingCompatibleTypes\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"dataassociation-add-association\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel}\">\r\n      <TypeSelector Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeAddExisting.TypeSelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeAddExisting.TypeSelectorHelp}\">\r\n        <TypeSelector.TypeOptions>\r\n          <cms:read source=\"ExistingCompatibleTypes\" />\r\n        </TypeSelector.TypeOptions>\r\n        <TypeSelector.SelectedType>\r\n          <cms:bind source=\"SelectedExistingType\" />\r\n        </TypeSelector.SelectedType>\r\n      </TypeSelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddAssociatedTypeAddExistingSelectForeignKey.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedForeignKeyPropertyName\" type=\"System.String\" />\r\n    <cms:binding name=\"ForeignKeyPropertyNames\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"dataassociation-add-association\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel}\">\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeAddExistingSelectForeignKey.KeySelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeAddExistingSelectForeignKey.KeySelectorHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedForeignKeyPropertyName\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"ForeignKeyPropertyNames\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddAssociatedTypeAddingTypeSelection.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedAddingType\" type=\"System.String\" />\r\n    <cms:binding name=\"AddingTypes\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"dataassociation-add-association\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel}\">\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeAddingTypeSelection.KeySelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeAddingTypeSelection.KeySelectorHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedAddingType\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"AddingTypes\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddAssociatedTypeAssociationTypeSelection.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedAssociationType\" type=\"System.String\" />\r\n    <cms:binding name=\"AssociationTypes\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"dataassociation-add-association\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel}\">\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeAssociationTypeSelection.KeySelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeAssociationTypeSelection.KeySelectorHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedAssociationType\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"AssociationTypes\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddAssociatedTypeCompositionScopeSelection.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CompositionDescriptionName\" type=\"System.String\" />\r\n    <cms:binding name=\"CompositionDescriptionLabel\" type=\"System.String\" />\r\n    <cms:binding name=\"SelectedCompositionContainer\" type=\"System.Guid\" />\r\n    <cms:binding name=\"CompositionContainers\" type=\"System.Object\" />\r\n    <cms:binding name=\"SelectedCompositionScope\" type=\"System.String\" />\r\n    <cms:binding name=\"CompositionScopes\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"dataassociation-add-association\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel}\">\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleNameLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleNameHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CompositionDescriptionName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleLabelLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleHelpHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CompositionDescriptionLabel\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ContainerKeySelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ContainerKeySelectorHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedCompositionContainer\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CompositionContainers\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeKeySelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeKeySelectorHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedCompositionScope\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CompositionScopes\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddAssociatedTypeFinalInfo.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FinalAssociationType\" type=\"System.String\" />\r\n    <cms:binding name=\"FinalCompositionDescriptionName\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"FinalCompositionDescriptionLabel\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"FinalCompositionScopeType\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"FinalAddingType\" type=\"System.String\" />\r\n    <cms:binding name=\"FinalExistingTypeName\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"FinalExistingForeignPropertyName\" type=\"System.String\" optional=\"true\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"dataassociation-add-association\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel}\">\r\n      <TextBox Type=\"ReadOnly\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AssociationTypeLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AssociationTypeHelp}\">\r\n        <TextBox.Text>\r\n          <cms:read source=\"FinalAssociationType\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"FinalCompositionDescriptionName\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleNameLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleNameHelp}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"FinalCompositionDescriptionName\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"FinalCompositionDescriptionLabel\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleLabelLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleHelpHelp}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"FinalCompositionDescriptionLabel\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"FinalCompositionScopeType\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeHelp}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"FinalCompositionScopeType\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n      <!--<TextBox Type=\"ReadOnly\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AddingTypeLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AddingTypeHelp}\">\r\n        <TextBox.Text>\r\n          <cms:read source=\"FinalAddingType\" />\r\n        </TextBox.Text>\r\n      </TextBox>-->\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"FinalExistingTypeName\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ExistingTypeNameLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ExistingTypeNameHelp}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"FinalExistingTypeName\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"FinalExistingTypeName\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ForeignKeyFieldNameLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ForeignKeyFieldNameHelp}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"FinalExistingForeignPropertyName\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddAssociatedTypeLevelsScopeSelection.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CompositionScopeLevels\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"dataassociation-add-association\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel}\">\r\n      <TextBox Type=\"Integer\" Label=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeLevelsScopeSelection.LevelsLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddAssociatedTypeLevelsScopeSelection.LevelsHelp}\">\r\n        <cms:bind source=\"CompositionScopeLevels\" />\r\n      </TextBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddDataFolderCreateNewType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewTypeName\" type=\"System.String\" />\r\n    <cms:binding name=\"NewTypeNamespace\" type=\"System.String\" />\r\n    <cms:binding name=\"NewTypeTitle\" type=\"System.String\" />\r\n    <cms:binding name=\"DataFieldDescriptors\" type=\"System.Object\" />\r\n    <cms:binding name=\"LabelFieldName\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"HasPublishing\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"HasLocalization\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    \r\n    <!-- maw: the associated workflow is not available via UI any more-->\r\n    \r\n    <TabPanels Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelNewType}\">\r\n      <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelNewType}\">\r\n        <TextBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeName}\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeName}\" Type=\"ProgrammingIdentifier\">\r\n          <cms:bind source=\"NewTypeName\" />\r\n        </TextBox>\r\n        <TextBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeNamespace}\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeNamespace}\" Type=\"ProgrammingNamespace\">\r\n          <cms:bind source=\"NewTypeNamespace\" />\r\n        </TextBox>\r\n        <TextBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeTitle}\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeTitle}\">\r\n          <cms:bind source=\"NewTypeTitle\" />\r\n        </TextBox>\r\n        <PlaceHolder Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.ServicesLabel}\">\r\n          <CheckBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HasPublishing}\" ItemLabel=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HasPublishing}\">\r\n            <CheckBox.Checked>\r\n              <cms:bind source=\"HasPublishing\" />\r\n            </CheckBox.Checked>\r\n          </CheckBox>\r\n\r\n\t\t\t<CheckBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HasLocalization}\" ItemLabel=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HasLocalization}\">\r\n\t\t\t\t<CheckBox.Checked>\r\n\t\t\t\t\t<cms:bind source=\"HasLocalization\" />\r\n\t\t\t\t</CheckBox.Checked>\r\n\t\t\t</CheckBox>\r\n\t\t</PlaceHolder>\r\n      </FieldGroup>\r\n      <internal:TypeFieldDesigner Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelFields}\">\r\n        <internal:TypeFieldDesigner.Fields>\r\n          <cms:bind source=\"DataFieldDescriptors\" />\r\n        </internal:TypeFieldDesigner.Fields>\r\n        <internal:TypeFieldDesigner.LabelFieldName>\r\n          <cms:bind source=\"LabelFieldName\" />\r\n        </internal:TypeFieldDesigner.LabelFieldName>\r\n      </internal:TypeFieldDesigner>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddDataFolderExSelectType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Types\" type=\"System.Object\"  />\r\n    <cms:binding name=\"SelectedType\" type=\"System.Type\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExSelectType.FieldLabel}\">\r\n    <FieldGroup>\r\n      <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExSelectType.SelectorLabel}\" OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderExSelectType.SelectorHelp}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"Types\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedType\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddDataFolderSelectType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Types\" type=\"System.Object\"  />\r\n    <cms:binding name=\"SelectedType\" type=\"System.Type\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n      <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderSelectType.FieldLabel}\">\r\n        <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderSelectType.SelectorLabel}\" OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddDataFolderSelectType.SelectorHelp}\">\r\n          <KeySelector.Options>\r\n            <cms:read source=\"Types\" />\r\n          </KeySelector.Options>\r\n          <KeySelector.Selected>\r\n            <cms:bind source=\"SelectedType\" />\r\n          </KeySelector.Selected>\r\n        </KeySelector>\r\n      </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddMediaFileStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UploadedFile\" type=\"Composite.C1Console.Forms.CoreUiControls.UploadedFile, Composite\" />\r\n    <cms:binding name=\"AllowOverwrite\" type=\"System.Boolean\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"media-add-media-file\" label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.Layout.Label}\">\r\n    \r\n    <FieldGroup>\r\n      \r\n      <FileUpload Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.FileUpload.Label}\" \r\n                  Help=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.FileUpload.Help}\">\r\n        <FileUpload.UploadedFile>\r\n          <cms:bind source=\"UploadedFile\" />\r\n        </FileUpload.UploadedFile>\r\n      </FileUpload>\r\n\r\n      <CheckBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.OverwriteCheckBox.Label}\" \r\n                ItemLabel=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.OverwriteCheckBox.Help}\">\r\n        <CheckBox.Checked>\r\n          <cms:bind source=\"AllowOverwrite\" />\r\n        </CheckBox.Checked>\r\n      </CheckBox>\r\n      \r\n    </FieldGroup>\r\n    \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddMediaFileStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Filename\" type=\"System.String\" />\r\n    <cms:binding name=\"Title\" type=\"System.String\" />\r\n    <cms:binding name=\"Description\" type=\"System.String\" />\r\n    <cms:binding name=\"Tags\" type=\"System.String\" />\r\n    <cms:binding name=\"AllowOverwrite\" type=\"System.Boolean\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"media-add-media-file\" label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.Layout.Label}\">\r\n\r\n    <FieldGroup>\r\n      \r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.FilenameTextBox.Label}\" \r\n               Help=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.FilenameTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Filename\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      \r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.TitleTextBox.Label}\" \r\n               Help=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.TitleTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Title\" />\r\n        </TextBox.Text>\r\n      </TextBox>     \r\n      \r\n      <TextArea Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.DescriptionTextBox.Label}\" \r\n                Help=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.DescriptionTextBox.Help}\">\r\n        <TextArea.Text>\r\n          <cms:bind source=\"Description\" />\r\n        </TextArea.Text>\r\n      </TextArea>\r\n      \r\n       <TextArea Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.TagsTextBox.Label}\" \r\n                Help=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.TagsTextBox.Help}\">\r\n        <TextArea.Text>\r\n          <cms:bind source=\"Tags\" />\r\n        </TextArea.Text>\r\n      </TextArea>\r\n\r\n      <CheckBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.OverwriteCheckBox.Label}\"\r\n                ItemLabel=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFile.OverwriteCheckBox.Help}\">\r\n        <CheckBox.Checked>\r\n          <cms:bind source=\"AllowOverwrite\" />\r\n        </CheckBox.Checked>\r\n      </CheckBox>\r\n      \r\n    </FieldGroup>\r\n    \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddMetaDataCreateFieldGroup.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FieldGroupName\" type=\"System.String\"  />\r\n    <cms:binding name=\"FieldGroupLabel\" type=\"System.String\" />\r\n    <cms:binding name=\"Containers\" type=\"System.Object\"  />\r\n    <cms:binding name=\"SelectedContainer\" type=\"System.Guid\" />\r\n    <cms:binding name=\"StartDisplayOptions\" type=\"System.Object\"  />\r\n    <cms:binding name=\"SelectedStartDisplay\" type=\"System.Int32\" />\r\n    <cms:binding name=\"InheritDisplayOptions\" type=\"System.Object\"  />\r\n    <cms:binding name=\"SelectedInheritDisplay\" type=\"System.Int32\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generated-type-add\" label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataSelectType.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.NamingFieldLabel}\">\r\n        <TextBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupNameLabel}\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupNameHelp}\">\r\n          <TextBox.Text>\r\n            <cms:bind source=\"FieldGroupName\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n        <TextBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupLabelLabel}\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupLabelHelp}\">\r\n          <TextBox.Text>\r\n            <cms:bind source=\"FieldGroupLabel\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n      </FieldGroup>\r\n\r\n      <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.VisabilityFieldLabel}\">\r\n        <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.ContainerSelectorLabel}\" OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.ContainerSelectorHelp}\">\r\n          <KeySelector.Options>\r\n            <cms:read source=\"Containers\" />\r\n          </KeySelector.Options>\r\n          <KeySelector.Selected>\r\n            <cms:bind source=\"SelectedContainer\" />\r\n          </KeySelector.Selected>\r\n        </KeySelector>\r\n\r\n        <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.StartDisplaySelectorLabel}\" OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.StartDisplaySelectorHelp}\">\r\n          <KeySelector.Options>\r\n            <cms:read source=\"StartDisplayOptions\" />\r\n          </KeySelector.Options>\r\n          <KeySelector.Selected>\r\n            <cms:bind source=\"SelectedStartDisplay\" />\r\n          </KeySelector.Selected>\r\n        </KeySelector>\r\n\r\n        <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.InheritDisplaySelectorLabel}\" OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.InheritDisplaySelectorHelp}\">\r\n          <KeySelector.Options>\r\n            <cms:read source=\"InheritDisplayOptions\" />\r\n          </KeySelector.Options>\r\n          <KeySelector.Selected>\r\n            <cms:bind source=\"SelectedInheritDisplay\" />\r\n          </KeySelector.Selected>\r\n        </KeySelector>\r\n      </FieldGroup>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddMetaDataNoTargetDataWarning.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Types\" type=\"System.Object\"  />\r\n    <cms:binding name=\"SelectedType\" type=\"System.Type\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generated-type-add\" label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataSelectType.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <Heading Title=\"${Composite.Management, AssociatedDataElementProviderHelper.NoItems.Title}\"\r\n\t\t\t\t\t\t\t Description=\"${Composite.Management, AssociatedDataElementProviderHelper.NoItems.Description}\"/>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddMetaDataSelectType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Types\" type=\"System.Object\"  />\r\n    <cms:binding name=\"SelectedType\" type=\"System.Type\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generated-type-add\" label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataSelectType.LayoutLabel}\">\r\n    <FieldGroup>\r\n      <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataSelectType.SelectorLabel}\" OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.AddMetaDataSelectType.SelectorHelp}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"Types\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedType\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewCompositionTypeStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"NewTypeName\" type=\"System.String\" />\r\n\t\t<cms:binding name=\"NewTypeNamespace\" type=\"System.String\" />\r\n\t\t<cms:binding name=\"NewTypeTitle\" type=\"System.String\" />\r\n\t\t<cms:binding name=\"DataFieldDescriptors\" type=\"System.Object\" />\r\n\t\t<cms:binding name=\"LabelFieldName\" type=\"System.String\" optional=\"true\" />\r\n\t\t<cms:binding name=\"HasCaching\" type=\"System.Boolean\" />\r\n\t\t<cms:binding name=\"HasLocalization\" type=\"System.Boolean\" />\r\n\t</cms:bindings>\r\n\t<cms:layout>\r\n\t\t<TabPanels Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, AddNewCompositionTypeWorkflow.DocumentTitle}\">\r\n\t\t\t<PlaceHolder Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.SettingsTab}\">\r\n\r\n\t\t\t\t<FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTitleGroup}\">\r\n\t\t\t\t\t<TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTitle}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTitle}\">\r\n\t\t\t\t\t\t<cms:bind source=\"NewTypeTitle\" />\r\n\t\t\t\t\t</TextBox>\r\n\t\t\t\t</FieldGroup>\r\n\r\n\r\n\t\t\t\t<FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelProgrammaticNaming}\">\r\n\t\t\t\t\t<TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTypeName}\"\r\n\t\t\t\t\t\t Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTypeName}\" Type=\"ProgrammingIdentifier\">\r\n\t\t\t\t\t\t<cms:bind source=\"NewTypeName\" />\r\n\t\t\t\t\t</TextBox>\r\n\t\t\t\t\t<TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTypeNamespace}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTypeNamespace}\" Type=\"ProgrammingNamespace\">\r\n\t\t\t\t\t\t<cms:bind source=\"NewTypeNamespace\" />\r\n\t\t\t\t\t</TextBox>\r\n\r\n\t\t\t\t\t<PlaceHolder Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.ServicesLabel}\">\r\n\t\t\t\t\t\t<CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasCaching}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasCaching}\">\r\n\t\t\t\t\t\t\t<CheckBox.Checked>\r\n\t\t\t\t\t\t\t\t<cms:bind source=\"HasCaching\" />\r\n\t\t\t\t\t\t\t</CheckBox.Checked>\r\n\t\t\t\t\t\t</CheckBox>\r\n\t\t\t\t\t\t<CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasLocalization}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasLocalization}\">\r\n\t\t\t\t\t\t\t<CheckBox.Checked>\r\n\t\t\t\t\t\t\t\t<cms:bind source=\"HasLocalization\" />\r\n\t\t\t\t\t\t\t</CheckBox.Checked>\r\n\t\t\t\t\t\t</CheckBox>\r\n\t\t\t\t\t</PlaceHolder>\r\n\t\t\t\t</FieldGroup>\r\n\t\t\t</PlaceHolder>\r\n\t\t\t<internal:TypeFieldDesigner Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelFields}\" IsSearchable=\"true\">\r\n\t\t\t\t<internal:TypeFieldDesigner.Fields>\r\n\t\t\t\t\t<cms:bind source=\"DataFieldDescriptors\" />\r\n\t\t\t\t</internal:TypeFieldDesigner.Fields>\r\n\t\t\t\t<internal:TypeFieldDesigner.LabelFieldName>\r\n\t\t\t\t\t<cms:bind source=\"LabelFieldName\" />\r\n\t\t\t\t</internal:TypeFieldDesigner.LabelFieldName>\r\n\t\t\t</internal:TypeFieldDesigner>\r\n\r\n\t\t</TabPanels>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewInterfaceTypeStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ViewLabel\" type=\"System.String\" />\r\n    <cms:binding name=\"NewTypeName\" type=\"System.String\" />\r\n    <cms:binding name=\"NewTypeNamespace\" type=\"System.String\" />\r\n    <cms:binding name=\"NewTypeTitle\" type=\"System.String\" />\r\n    <cms:binding name=\"DataFieldDescriptors\" type=\"System.Object\" />\r\n    <cms:binding name=\"HasCaching\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"HasPublishing\" type=\"System.Boolean\" />\r\n\t\t<cms:binding name=\"HasLocalization\" type=\"System.Boolean\" />\r\n\t\t<cms:binding name=\"IsSearchable\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"KeyFieldName\" type=\"System.String\" />\r\n    <cms:binding name=\"LabelFieldName\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"InternalUrlPrefix\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"KeyFieldReadOnly\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"CustomEvent01Handler\" type=\"System.EventHandler\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generated-type-add\">\r\n    <TabPanels>\r\n      <TabPanels.Label>\r\n        <cms:read source=\"ViewLabel\" />\r\n      </TabPanels.Label>\r\n      <PlaceHolder Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.SettingsTab}\">\r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTitleGroup}\">\r\n          <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTitle}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTitle}\">\r\n            <cms:bind source=\"NewTypeTitle\" />\r\n          </TextBox>\r\n        </FieldGroup>\r\n\r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelProgrammaticNamingAndServices}\">\r\n          <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTypeName}\"\r\n               Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTypeName}\" Type=\"ProgrammingIdentifier\">\r\n            <cms:bind source=\"NewTypeName\" />\r\n          </TextBox>\r\n          \r\n          <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTypeNamespace}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTypeNamespace}\" Type=\"ProgrammingNamespace\">\r\n            <cms:bind source=\"NewTypeNamespace\" />\r\n          </TextBox>\r\n\r\n          <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.InternalUrlPrefixLabel}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.InternalUrlPrefixHelp}\" Type=\"programmingidentifier\">\r\n            <cms:bind source=\"InternalUrlPrefix\" />\r\n          </TextBox>\r\n          \r\n          <PlaceHolder Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.ServicesLabel}\">\r\n            <CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasCaching}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasCaching}\">\r\n              <CheckBox.Checked>\r\n                <cms:bind source=\"HasCaching\" />\r\n              </CheckBox.Checked>\r\n            </CheckBox>\r\n            <CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasPublishing}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasPublishing}\">\r\n              <CheckBox.Checked>\r\n                <cms:bind source=\"HasPublishing\" />\r\n              </CheckBox.Checked>\r\n            </CheckBox>\r\n            <CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasLocalization}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasLocalization}\">\r\n              <CheckBox.Checked>\r\n                <cms:bind source=\"HasLocalization\" />\r\n              </CheckBox.Checked>\r\n            </CheckBox>\r\n\t\t\t\t\t\t<CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.IsSearchable}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.IsSearchable}\">\r\n\t\t\t\t\t\t\t<CheckBox.Checked>\r\n\t\t\t\t\t\t\t\t<cms:bind source=\"IsSearchable\" />\r\n\t\t\t\t\t\t\t</CheckBox.Checked>\r\n\t\t\t\t\t\t\t<CheckBox.CheckedChangedEventHandler>\r\n\t\t\t\t\t\t\t\t<cms:read source=\"CustomEvent01Handler\"/>\r\n\t\t\t\t\t\t\t</CheckBox.CheckedChangedEventHandler>\r\n\t\t\t\t\t\t</CheckBox>\r\n          </PlaceHolder>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      <internal:TypeFieldDesigner Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelFields}\">\r\n        <internal:TypeFieldDesigner.Fields>\r\n          <cms:bind source=\"DataFieldDescriptors\" />\r\n        </internal:TypeFieldDesigner.Fields>\r\n        <internal:TypeFieldDesigner.KeyFieldName>\r\n          <cms:bind source=\"KeyFieldName\" />\r\n        </internal:TypeFieldDesigner.KeyFieldName>\r\n        <internal:TypeFieldDesigner.LabelFieldName>\r\n          <cms:bind source=\"LabelFieldName\" />\r\n        </internal:TypeFieldDesigner.LabelFieldName>\r\n        <internal:TypeFieldDesigner.KeyFieldReadOnly>\r\n          <cms:bind source=\"KeyFieldReadOnly\" />\r\n        </internal:TypeFieldDesigner.KeyFieldReadOnly>\r\n\t\t\t\t<internal:TypeFieldDesigner.IsSearchable>\r\n\t\t\t\t\t<cms:read source=\"IsSearchable\" />\r\n\t\t\t\t</internal:TypeFieldDesigner.IsSearchable>\r\n\t\t\t</internal:TypeFieldDesigner>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewMediaFolder.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewFolder\" type=\"Composite.Data.Types.IMediaFileFolder, Composite\" />\r\n    <cms:binding name=\"FolderName\" type=\"System.String\" />\r\n    <cms:binding name=\"ProvidesMetaData\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"media-add-media-folder\" label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFolder.Label.AddNewMediaFolder}\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFolder.LabelFolderName}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFolder.HelpFolderName}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"FolderName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"ProvidesMetaData\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n          <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFolder.LabelTitle}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFolder.HelpTitle}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"NewFolder.Title\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </f:BooleanCheck.WhenTrue>\r\n      </f:BooleanCheck>\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"ProvidesMetaData\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n          <TextArea Label=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFolder.LabelDescription}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewMediaFolder.HelpDescription}\">\r\n            <cms:bind source=\"NewFolder.Description\" />\r\n          </TextArea>\r\n        </f:BooleanCheck.WhenTrue>\r\n      </f:BooleanCheck>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewMethodBasedFunctionStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewMethodBasedFunction\" type=\"Composite.Data.Types.IMethodBasedFunctionInfo, Composite\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"functioncall\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep1.LabelType}\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep1.LabelTypeHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewMethodBasedFunction.Type\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewMethodBasedFunctionStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"MethodNames\" type=\"System.Collections.IList\" />\r\n    <cms:binding name=\"SelectedMethodName\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup>\r\n      <KeySelector Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep2.LabelMethodName}\" OptionsKeyField=\"\" OptionsLabelField=\"\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep2.HelpMethodName}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"MethodNames\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedMethodName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewMethodBasedFunctionStep3.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewMethodBasedFunction\" type=\"Composite.Data.Types.IMethodBasedFunctionInfo, Composite\" />\r\n    <cms:binding optional=\"true\" name=\"ErrorMessage\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep3.LabelMethodName}\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep3.HelpMethodName}\" Type=\"ProgrammingIdentifier\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewMethodBasedFunction.UserMethodName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep3.LabelNamespaceName}\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep3.HelpNamespaceName}\" Type=\"ProgrammingNamespace\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewMethodBasedFunction.Namespace\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"ErrorMessage\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <Text Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddNewMethodBasedFunctionStep3.LabelError}\">\r\n            <Text.Text>\r\n              <cms:read source=\"ErrorMessage\" />\r\n            </Text.Text>\r\n          </Text>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewPageStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewPage\" type=\"Composite.Data.Types.IPage\" />\r\n    <cms:binding name=\"SortOrder\" type=\"System.Object\" />\r\n    <cms:binding name=\"SelectedSortOrder\" type=\"System.String\" />\r\n    <cms:binding name=\"PageTypeOptions\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"Title\" type=\"System.String\"/>\r\n    <cms:binding name=\"Label\" type=\"System.String\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-add-page\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"Title\"/>\r\n    </cms:layout.label>\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.PageElementProvider, AddNewPageStep1.LabelTitle}\" Help=\"${Composite.Plugins.PageElementProvider, AddNewPageStep1.LabelTitleHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewPage.Title\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextArea Label=\"${Composite.Plugins.PageElementProvider, AddNewPageStep1.LabelAbstract}\" Help=\"${Composite.Plugins.PageElementProvider, AddNewPageStep1.LabelAbstractHelp}\">\r\n        <TextArea.Text>\r\n          <cms:bind source=\"NewPage.Description\" />\r\n        </TextArea.Text>\r\n      </TextArea>\r\n      \r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Plugins.PageElementProvider, AddNewPageStep1.HelpPosition}\" Label=\"${Composite.Plugins.PageElementProvider, AddNewPageStep1.LabelPosition}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedSortOrder\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"SortOrder\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>       \r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewPageStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewPage\" type=\"Composite.Data.Types.IPage\" />\r\n    <cms:binding name=\"ExistingPages\" type=\"System.Collections.IEnumerable\" optional=\"true\" />\r\n    <cms:binding name=\"RelativeSelectedPageId\" type=\"System.Guid\" optional=\"true\" />\r\n    <cms:binding name=\"UrlTitleIsRequired\" type=\"System.Boolean\"/>\r\n    <cms:binding name=\"Title\" type=\"System.String\"/>\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <cms:layout.label>\r\n      <cms:read source=\"Title\"/>\r\n    </cms:layout.label>\r\n    <PlaceHolder>\r\n      <FieldGroup>\r\n        <TextBox Label=\"${Composite.Plugins.PageElementProvider, AddNewPageStep2.LabelUrlTitle}\" Help=\"${Composite.Plugins.PageElementProvider, AddNewPageStep2.HelpUrlTitle}\" SpellCheck=\"false\">\r\n\t\t  <TextBox.Required>\r\n\t\t    <cms:read source=\"UrlTitleIsRequired\" />\r\n\t\t  </TextBox.Required>\r\n          <TextBox.Text>\r\n            <cms:bind source=\"NewPage.UrlTitle\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n        <TextBox Label=\"${Composite.Plugins.PageElementProvider, AddNewPageStep2.LabelMenuTitle}\" Help=\"${Composite.Plugins.PageElementProvider, AddNewPageStep2.HelpMenuTitle}\">\r\n          <TextBox.Text>\r\n            <cms:bind source=\"NewPage.MenuTitle\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n      </FieldGroup>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"ExistingPages\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <FieldGroup Label=\"${Composite.Plugins.PageElementProvider, AddNewPageStep2.LabelPositionSelectorPanel}\">\r\n            <KeySelector Label=\"${Composite.Plugins.PageElementProvider, AddNewPageStep2.LabelPositionSelector}\" OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Plugins.PageElementProvider, AddNewPageStep2.HelpPositionSelector}\">\r\n              <KeySelector.Options>\r\n                <cms:read source=\"ExistingPages\" />\r\n              </KeySelector.Options>\r\n              <KeySelector.Selected>\r\n                <cms:bind source=\"RelativeSelectedPageId\" />\r\n              </KeySelector.Selected>\r\n            </KeySelector>\r\n          </FieldGroup>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewRazorFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Name\" type=\"System.String\" />\r\n    <cms:binding name=\"Namespace\" type=\"System.String\" />\r\n\r\n    <cms:binding name=\"CopyFromFunctionName\" type=\"System.String\" />\r\n    <cms:binding name=\"CopyFromOptions\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.RazorFunction, AddNewRazorFunction.LabelDialog}\" iconhandle=\"razor-function-add\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.RazorFunction, AddNewRazorFunction.LabelName}\" Help=\"${Composite.Plugins.RazorFunction, AddNewRazorFunction.HelpName}\" Type=\"ProgrammingIdentifier\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.RazorFunction, AddNewRazorFunction.LabelNamespace}\" Help=\"${Composite.Plugins.RazorFunction, AddNewRazorFunction.HelpNamespace}\" Type=\"ProgrammingNamespace\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Namespace\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n                   Help=\"${Composite.Plugins.RazorFunction, AddNewRazorFunction.LabelCopyFromHelp}\"\r\n                   Label=\"${Composite.Plugins.RazorFunction, AddNewRazorFunction.LabelCopyFrom}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CopyFromFunctionName\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CopyFromOptions\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n      \r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewSqlFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewSqlQueryInfo\" type=\"Composite.Data.Types.ISqlFunctionInfo, Composite\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"sql-based-function\" label=\"${Composite.Plugins.SqlFunction, AddNewSqlFunction.LabelDialog}\">\r\n    <PlaceHolder>\r\n      <FieldGroup>\r\n        <TextBox Label=\"${Composite.Plugins.SqlFunction, AddNewSqlFunction.LabelName}\" Help=\"${Composite.Plugins.SqlFunction, AddNewSqlFunction.HelpName}\" Type=\"ProgrammingIdentifier\">\r\n          <TextBox.Text>\r\n            <cms:bind source=\"NewSqlQueryInfo.Name\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n        <TextBox Label=\"${Composite.Plugins.SqlFunction, AddNewSqlFunction.LabelNamespace}\" Help=\"${Composite.Plugins.SqlFunction, AddNewSqlFunction.HelpNamespace}\" Type=\"ProgrammingNamespace\">\r\n          <TextBox.Text>\r\n            <cms:bind source=\"NewSqlQueryInfo.Namespace\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n      </FieldGroup>\r\n      <FieldGroup Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelSqlEditor}\">\r\n        <TextArea Label=\"${Composite.Plugins.SqlFunction, AddNewSqlFunction.LabelQueryCOmmand}\" Help=\"${Composite.Plugins.SqlFunction, AddNewSqlFunction.HelpQueryCOmmand}\" SpellCheck=\"false\">\r\n          <cms:bind source=\"NewSqlQueryInfo.Command\" />\r\n        </TextArea>\r\n      </FieldGroup>\r\n      <FieldGroup Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelCommandBehaviour}\">\r\n        <CheckBox Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelIsStoredProcedure}\" ItemLabel=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelIsStoredProcedureCheckBox}\">\r\n          <CheckBox.Checked>\r\n            <cms:bind source=\"NewSqlQueryInfo.IsStoredProcedure\" />\r\n          </CheckBox.Checked>\r\n        </CheckBox>\r\n        <CheckBox Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelReturnsXml}\" ItemLabel=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelReturnsXmlCheckBox}\">\r\n          <CheckBox.Checked>\r\n            <cms:bind source=\"NewSqlQueryInfo.ReturnsXml\" />\r\n          </CheckBox.Checked>\r\n        </CheckBox>\r\n        <CheckBox Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelIsQuery}\" ItemLabel=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelIsQueryCheckBox}\">\r\n          <CheckBox.Checked>\r\n            <cms:bind source=\"NewSqlQueryInfo.IsQuery\" />\r\n          </CheckBox.Checked>\r\n        </CheckBox>\r\n      </FieldGroup>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewSqlFunctionConnection.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewSqlConnection\" type=\"Composite.Data.Types.ISqlConnection, Composite\" />\r\n    <cms:binding name=\"ConnectionString\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"sql-based-connection-add\" label=\"${Composite.Plugins.SqlFunction, AddNewSqlFunctionConnection.LabelDialog}\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.SqlFunction, AddNewSqlFunctionConnection.LabelName}\" Help=\"${Composite.Plugins.SqlFunction, AddNewSqlFunctionConnection.HelpName}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewSqlConnection.Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.SqlFunction, AddNewSqlFunctionConnection.LabelConnectionString}\" Help=\"${Composite.Plugins.SqlFunction, AddNewSqlFunctionConnection.HelpConnectionString}\" SpellCheck=\"false\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"ConnectionString\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <CheckBox ItemLabel=\"${Composite.Plugins.SqlFunction, AddNewSqlFunctionConnection.LabelIsMSSQLCheckBox}\" Label=\"${Composite.Plugins.SqlFunction, AddNewSqlFunctionConnection.LabelIsMSSQL}\">\r\n        <CheckBox.Checked>\r\n          <cms:bind source=\"NewSqlConnection.IsMsSql\" />\r\n        </CheckBox.Checked>\r\n      </CheckBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewUserControlFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Name\" type=\"System.String\" />\r\n    <cms:binding name=\"Namespace\" type=\"System.String\" />\r\n    <cms:binding name=\"CopyFromFunctionName\" type=\"System.String\" />\r\n    <cms:binding name=\"CopyFromOptions\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.UserControlFunction, AddNewUserControlFunction.LabelDialog}\" iconhandle=\"usercontrol-function\">\r\n    <FieldGroup>\r\n      \r\n      <TextBox Label=\"${Composite.Plugins.UserControlFunction, AddNewUserControlFunction.LabelName}\" Help=\"${Composite.Plugins.UserControlFunction, AddNewUserControlFunction.HelpName}\" Type=\"ProgrammingIdentifier\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      \r\n      <TextBox Label=\"${Composite.Plugins.UserControlFunction, AddNewUserControlFunction.LabelNamespace}\" Help=\"${Composite.Plugins.UserControlFunction, AddNewUserControlFunction.HelpNamespace}\" Type=\"ProgrammingNamespace\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Namespace\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n                   Help=\"${Composite.Plugins.UserControlFunction, AddNewUserControlFunction.LabelCopyFromHelp}\"\r\n                   Label=\"${Composite.Plugins.UserControlFunction, AddNewUserControlFunction.LabelCopyFrom}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CopyFromFunctionName\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CopyFromOptions\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n      \r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewUserStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"NewUser\" type=\"Composite.Data.Types.IUser\" />\r\n    <cms:binding name=\"UserFormLogin\" type=\"Composite.Data.Types.IUserFormLogin\" />\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" />\r\n    <cms:binding name=\"C1ConsoleUiLanguageName\" type=\"System.String\" />\r\n    <cms:binding name=\"C1ConsoleUiCultures\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"AllCultures\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"Password\" type=\"System.String\" optional=\"true\"/>\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"users-adduser\" label=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.LabelFieldGroup}\">\r\n\t\t<FieldGroup>\r\n\t\t\t<TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.UserNameLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.UserNameHelp}\" SpellCheck=\"false\">\r\n\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t<cms:bind source=\"NewUser.Username\" />\r\n\t\t\t\t</TextBox.Text>\r\n\t\t\t</TextBox>\r\n\t\t\t<TextBox Type=\"Password\" Label=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.PasswordLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.PasswordHelp}\" Required=\"true\">\r\n\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t<cms:bind source=\"Password\" />\r\n\t\t\t\t</TextBox.Text>\r\n\t\t\t</TextBox>\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.NameLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.NameHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewUser.Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.EmailLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.EmailHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewUser.Email\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.GroupLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.GroupHelp}\">\r\n\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t<cms:bind source=\"UserFormLogin.Folder\" />\r\n\t\t\t\t</TextBox.Text>\r\n\t\t\t</TextBox>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.CultureLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.CultureHelp}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"AllCultures\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CultureName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.C1ConsoleLanguageLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddNewUserStep1.C1ConsoleLanguageHelp}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"C1ConsoleUiCultures\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"C1ConsoleUiLanguageName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n    </FieldGroup>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewVisualFunctionStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedType\" type=\"System.Type\" />\r\n    <cms:binding name=\"TypeOptions\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"wysiwyg-function\" label=\"${Composite.Plugins.VisualFunction, AddNew.DialogLabel}\">\r\n    <FieldGroup>\r\n      <TypeSelector Label=\"${Composite.Plugins.VisualFunction, AddNewStep1.TypeSelectorLabel}\" Help=\"${Composite.Plugins.VisualFunction, AddNewStep1.TypeSelectorHelp}\">\r\n        <TypeSelector.TypeOptions>\r\n          <cms:read source=\"TypeOptions\" />\r\n        </TypeSelector.TypeOptions>\r\n        <TypeSelector.SelectedType>\r\n          <cms:bind source=\"SelectedType\" />\r\n        </TypeSelector.SelectedType>\r\n      </TypeSelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewVisualFunctionStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Function\" type=\"Composite.Data.Types.IVisualFunction, Composite\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"wysiwyg-function\" label=\"${Composite.Plugins.VisualFunction, AddNew.DialogLabel}\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.VisualFunction, AddNewStep2.FuncitonNameLabel}\" Help=\"${Composite.Plugins.VisualFunction, AddNewStep2.FuncitonNameHelp}\" Type=\"ProgrammingIdentifier\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Function.Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.VisualFunction, AddNewStep2.FuncitonNamespaceLabel}\" Help=\"${Composite.Plugins.VisualFunction, AddNewStep2.FuncitonNamespaceHelp}\" Type=\"ProgrammingNamespace\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Function.Namespace\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddNewXsltFunctionStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewXslt\" type=\"Composite.Data.Types.IXsltFunction, Composite\" />\r\n    <cms:binding name=\"CopyFromFunctionId\" type=\"System.Guid\" />\r\n    <cms:binding name=\"CopyFromOptions\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.XsltBasedFunction, AddNewXsltFunctionStep1.LabelDialog}\" iconhandle=\"xslt-based-function\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.XsltBasedFunction, AddNewXsltFunctionStep1.LabelName}\" Help=\"${Composite.Plugins.XsltBasedFunction, AddNewXsltFunctionStep1.HelpName}\" Type=\"ProgrammingIdentifier\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewXslt.Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.XsltBasedFunction, AddNewXsltFunctionStep1.LabelNamespace}\" Help=\"${Composite.Plugins.XsltBasedFunction, AddNewXsltFunctionStep1.HelpNamespace}\" Type=\"ProgrammingNamespace\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewXslt.Namespace\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <EnumSelector EnumType=\"Composite.Plugins.Functions.FunctionProviders.XsltBasedFunctionProvider.OutputXmlSubType\" Label=\"${Composite.Plugins.XsltBasedFunction, AddNewXsltFunctionStep1.LabelOutputType}\">\r\n        <EnumSelector.Selected>\r\n          <cms:bind source=\"NewXslt.OutputXmlSubType\" />\r\n        </EnumSelector.Selected>\r\n      </EnumSelector>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n            Label=\"${Composite.Plugins.XsltBasedFunction, AddNewXsltFunctionStep1.LabelCopyFrom}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CopyFromFunctionId\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CopyFromOptions\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>   \r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddPageHostNameBindings.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"HostName\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-manage-host-names\" label=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Add.DialogLabel}\">\r\n    <PlaceHolder>\r\n      <Heading Title=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Add.HeadingTitle}\" Description=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Add.HeadingDescription}\" />\r\n      <FieldGroup Label=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Add.FieldGroupLabel}\">\r\n        <TextBox Label=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Add.HostNameTextBoxLabel}\" Help=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Add.HostNametextBoxHelp}\">\r\n          <TextBox.Text>\r\n            <cms:bind source=\"HostName\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n      </FieldGroup>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddSystemLocaleStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" />\r\n    <cms:binding name=\"RegionLanguageList\" type=\"System.Collections.IEnumerable\" />\r\n\t\t<cms:binding name=\"UrlMappingName\" type=\"System.String\" />\r\n\t\t<cms:binding name=\"AccessToAllUsers\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"CustomEvent01Handler\" type=\"System.EventHandler\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"localization-addsystemlocale\" label=\"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.Dialog.Label}\">\r\n    <FieldGroup>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" \r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.CultureSelector.Label}\" \r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.CultureSelector.Help}\">\r\n        <KeySelector.SelectedIndexChangedEventHandler>\r\n          <cms:read source=\"CustomEvent01Handler\"/>\r\n        </KeySelector.SelectedIndexChangedEventHandler>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"RegionLanguageList\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CultureName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n\t\t\t<TextBox Label=\"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.UrlMappingName.Label}\" Help=\"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.UrlMappingName.Help}\" SpellCheck=\"false\">\r\n\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t<cms:bind source=\"UrlMappingName\" />\r\n\t\t\t\t</TextBox.Text>\r\n\t\t\t</TextBox>\r\n\t\t\t\r\n\t\t\t<CheckBox Label=\"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.AllUsersAccess.Label}\" \r\n\t\t\t\t\t\t\t\tItemLabel=\"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.AllUsersAccess.ItemLabel}\"\r\n\t\t\t\t\t\t\t\tHelp=\"${Composite.Plugins.LocalizationElementProvider, AddSystemLocaleWorkflow.AllUsersAccess.Help}\">\r\n\t\t\t\t<CheckBox.Checked>\r\n\t\t\t\t\t<cms:bind source=\"AccessToAllUsers\" />\r\n\t\t\t\t</CheckBox.Checked>\r\n\t\t\t</CheckBox>\r\n\t\t</FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AddZipMediaFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UploadedFile\" type=\"Composite.C1Console.Forms.CoreUiControls.UploadedFile, Composite\" />\r\n    <cms:binding name=\"RecreateFolders\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"OverwriteExisting\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"media-upload-zip-file\" label=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.LabelDialog}\">\r\n    <FieldGroup>\r\n      <FileUpload Label=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.LabelFile}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.HelpFile}\">\r\n        <FileUpload.UploadedFile>\r\n          <cms:bind source=\"UploadedFile\" />\r\n        </FileUpload.UploadedFile>\r\n      </FileUpload>\r\n      <CheckBox Label=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.LabelRecreateStructure}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.HelpRecreateStructure}\" ItemLabel=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.LabelRecreateStructureCheckBox}\">\r\n        <CheckBox.Checked>\r\n          <cms:bind source=\"RecreateFolders\" />\r\n        </CheckBox.Checked>\r\n      </CheckBox>\r\n      <CheckBox Label=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.LabelOverwriteExsisting}\" Help=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.HelpOverwriteExsisting}\" ItemLabel=\"${Composite.Management, Website.Forms.Administrative.AddZipMediaFile.LabelOverwriteExsistingCheckBox}\">\r\n        <CheckBox.Checked>\r\n          <cms:bind source=\"OverwriteExisting\" />\r\n        </CheckBox.Checked>\r\n      </CheckBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/AllFunctionsElementProviderSearchForm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SearchToken\" type=\"Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider.AllFunctionsElementProviderSearchToken,Composite\" />\r\n    <cms:binding name=\"Types\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelFunctionSearch}\">\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelKeyword}\" Help=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelKeywordHelp}\">\r\n        <cms:bind source=\"SearchToken.Keyword\" />\r\n      </TextBox>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelReturnType}\" Help=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelReturnTypeHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SearchToken.SelectedTypeKey\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"Types\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/ChangeOwnCulture.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" />\r\n    <cms:binding name=\"C1ConsoleUiLanguageName\" type=\"System.String\" />\r\n    <cms:binding name=\"C1ConsoleUiCultures\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"AllCultures\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"users-changeownculture\" label=\"${Composite.C1Console.Users, ChangeOwnCultureWorkflow.Dialog.Label}\">\r\n    <FieldGroup>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.C1Console.Users, ChangeOwnCultureWorkflow.Dialog.CultureSelector.Label}\" Help=\"${Composite.C1Console.Users, ChangeOwnCultureWorkflow.Dialog.CultureSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"AllCultures\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CultureName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.C1Console.Users, ChangeOwnCultureWorkflow.Dialog.C1ConsoleLanguageSelector.Label}\" Help=\"${Composite.C1Console.Users, ChangeOwnCultureWorkflow.Dialog.C1ConsoleLanguageSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"C1ConsoleUiCultures\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"C1ConsoleUiLanguageName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/ChangeOwnCultureConfirmReboot.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"users-changeownculture\" label=\"${Composite.C1Console.Users, ChangeOwnCultureWorkflow.Dialog.Confirm.Title}\">\r\n    <Text Text=\"${Composite.C1Console.Users, ChangeOwnCultureWorkflow.Dialog.Confirm.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/ChangeOwnForeignLocaleNoOrOneActiveLocale.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"localization-changelocale\" label=\"${Composite.C1Console.Users, ChangeForeignLocaleWorkflow.Dialog.Label}\">\r\n\t\t<Heading\r\n\t\t\tTitle=\"${Composite.C1Console.Users, ChangeForeignLocaleWorkflow.NoOrOneActiveLocales.Title}\"\r\n\t\t\tDescription=\"${Composite.C1Console.Users, ChangeForeignLocaleWorkflow.NoOrOneActiveLocales.Description}\" />\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/ChangeOwnForeignLocaleStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n\t\t<cms:binding name=\"ForeignCultureName\" type=\"System.String\" />\r\n\t\t<cms:binding name=\"ForeignCulturesList\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"localization-changelocale\" label=\"${Composite.C1Console.Users, ChangeForeignLocaleWorkflow.Dialog.Label}\">\r\n    <FieldGroup Label=\"${Composite.C1Console.Users, ChangeForeignLocaleWorkflow.FieldGroup.Label}\">\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.C1Console.Users, ChangeForeignLocaleWorkflow.ForeignCultureSelector.Label}\"\r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.C1Console.Users, ChangeForeignLocaleWorkflow.ForeignCultureSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"ForeignCulturesList\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"ForeignCultureName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>           \t\t\r\n\t\t</FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/ChangeOwnPassword.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"OldPassword\" type=\"System.String\" />\r\n    <cms:binding name=\"NewPassword\" type=\"System.String\" />\r\n    <cms:binding name=\"NewPasswordConfirmed\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"users-changeownpassword\" label=\"${Composite.C1Console.Users, ChangeOwnPasswordWorkflow.Dialog.Label}\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.C1Console.Users, ChangeOwnPasswordWorkflow.Dialog.ExistingPassword.Label}\" Type=\"Password\" Help=\"${Composite.C1Console.Users, ChangeOwnPasswordWorkflow.Dialog.ExistingPassword.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"OldPassword\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.C1Console.Users, ChangeOwnPasswordWorkflow.Dialog.NewPassword.Label}\" Type=\"Password\" Help=\"${Composite.C1Console.Users, ChangeOwnPasswordWorkflow.Dialog.NewPassword.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewPassword\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.C1Console.Users, ChangeOwnPasswordWorkflow.Dialog.NewPasswordConfirmed.Label}\" Type=\"Password\" Help=\"${Composite.C1Console.Users, ChangeOwnPasswordWorkflow.Dialog.NewPasswordConfirmed.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewPasswordConfirmed\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/CreateNewAssociatedTypeStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewTypeName\" type=\"System.String\" />\r\n    <cms:binding name=\"NewTypeNamespace\" type=\"System.String\" />\r\n    <cms:binding name=\"NewTypeTitle\" type=\"System.String\" />\r\n    <cms:binding name=\"DataFieldDescriptors\" type=\"System.Object\" />\r\n    <cms:binding name=\"LabelFieldName\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"UseProcessControlled\" type=\"System.Boolean\" />\r\n    <!--<cms:binding name=\"HasVersioning\" type=\"System.Boolean\" />-->\r\n    <cms:binding name=\"HasPublishing\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <TabPanels Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelNewType}\">\r\n      <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelNewType}\">\r\n        <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeName}\" Help=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeName}\" Type=\"ProgrammingIdentifier\">\r\n          <cms:bind source=\"NewTypeName\" />\r\n        </TextBox>\r\n        <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeNamespace}\" Help=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeNamespace}\" Type=\"ProgrammingNamespace\">\r\n          <cms:bind source=\"NewTypeNamespace\" />\r\n        </TextBox>\r\n        <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeTitle}\" Help=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeTitle}\">\r\n          <cms:bind source=\"NewTypeTitle\" />\r\n        </TextBox>\r\n        <f:BooleanCheck>\r\n          <f:BooleanCheck.CheckValue>\r\n            <cms:read source=\"UseProcessControlled\" />\r\n          </f:BooleanCheck.CheckValue>\r\n          <f:BooleanCheck.WhenTrue>\r\n            <PlaceHolder Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.ServicesLabel}\">\r\n              <!--<CheckBox Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HasVersioning}\" ItemLabel=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HasVersioning}\">\r\n\t\t\t\t\t\t\t\t<CheckBox.Checked>\r\n\t\t\t\t\t\t\t\t\t<cms:bind source=\"HasVersioning\" />\r\n\t\t\t\t\t\t\t\t</CheckBox.Checked>\r\n\t\t\t\t\t\t\t</CheckBox>-->\r\n              <CheckBox Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HasPublishing}\" ItemLabel=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HasPublishing}\">\r\n                <CheckBox.Checked>\r\n                  <cms:bind source=\"HasPublishing\" />\r\n                </CheckBox.Checked>\r\n              </CheckBox>\r\n            </PlaceHolder>\r\n          </f:BooleanCheck.WhenTrue>\r\n        </f:BooleanCheck>\r\n      </FieldGroup>\r\n      <internal:TypeFieldDesigner Label=\"${Composite.Management, Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelFields}\">\r\n        <internal:TypeFieldDesigner.Fields>\r\n          <cms:bind source=\"DataFieldDescriptors\" />\r\n        </internal:TypeFieldDesigner.Fields>\r\n        <internal:TypeFieldDesigner.LabelFieldName>\r\n          <cms:bind source=\"LabelFieldName\" />\r\n        </internal:TypeFieldDesigner.LabelFieldName>\r\n      </internal:TypeFieldDesigner>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteAggregationTypeStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"InterfaceName\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteAggregationTypeWorkflow.LabelFieldGroup}\">\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"InterfaceName\" />\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteAssociatedTypeDataStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Management, Website.Forms.Administrative.DeleteAssociatedTypeDataStep1.FieldGroupLabel}\">\r\n    <Text Text=\"${Composite.Management, Website.Forms.Administrative.DeleteAssociatedTypeDataStep1.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteCompositionTypeStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"InterfaceName\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteCompositionTypeWorkflow.LabelFieldGroup}\">\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"InterfaceName\" />\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteDataFolderConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"DeleteDatas\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.LabelFieldGroup}\" iconhandle=\"question\">\r\n\r\n    <PlaceHolder>\r\n      <!--<Text Text=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.HasData}\"/>-->\r\n\r\n      <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.FieldGroupLabel}\">\r\n        <CheckBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataLabel}\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataHelp}\" ItemLabel=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataCheckBoxLabel}\">\r\n          <CheckBox.Checked>\r\n            <cms:bind source=\"DeleteDatas\"/>\r\n          </CheckBox.Checked>\r\n        </CheckBox>\r\n      </FieldGroup>\r\n\r\n    </PlaceHolder>\r\n\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteDataFolderConfirmDeletingRelatedData.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"ReferencedData\" type=\"System.String\" optional=\"true\"/>\r\n\t</cms:bindings>\r\n\t<cms:layout label=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.LabelFieldGroup}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Text Text=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteDataConfirmationText}\" />\r\n\t\t\t<Text Text=\"\r\n\t\t\t\t\t\t\r\n\" />\r\n\t\t\t<Text>\r\n\t\t\t\t<Text.Text>\r\n\t\t\t\t\t<cms:read source=\"ReferencedData\" />\r\n\t\t\t\t</Text.Text>\r\n\t\t\t</Text>\r\n\t\t</PlaceHolder>\r\n\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteGeneratedDataStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteGeneratedDataStep1.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteGeneratedDataStep1.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteGeneratedDataStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"ReferencedData\" type=\"System.String\" optional=\"true\"/>\r\n\t</cms:bindings>\r\n\t<cms:layout label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteGeneratedDataStep1.LabelFieldGroup}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Text Text=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteDataConfirmationText}\" />\r\n\t\t\t<Text Text=\"\r\n\t\t\t\t\t\t\r\n\" />\r\n\t\t\t<Text>\r\n\t\t\t\t<Text.Text>\r\n\t\t\t\t\t<cms:read source=\"ReferencedData\" />\r\n\t\t\t\t</Text.Text>\r\n\t\t\t</Text>\r\n\t\t</PlaceHolder>\r\n\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteGeneratedInteraceStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"InterfaceType\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteGeneratedInterfaceStep1.LabelFieldGroup}\">\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"InterfaceType\" />\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteMediaFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Management, Website.Forms.Administrative.DeleteMediaFile.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Management, Website.Forms.Administrative.DeleteMediaFile.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteMediaFileConfirmRemovingRelatedData.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"ReferencedData\" type=\"System.String\" optional=\"true\"/>\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"page-delete-page\" label=\"${Composite.Management, Website.Forms.Administrative.DeleteMediaFile.DeleteDataConfirmationHeader}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Text Text=\"${Composite.Management, Website.Forms.Administrative.DeleteMediaFile.DeleteDataConfirmationText}\" />\r\n\t\t\t<Text Text=\"\r\n\t\t\t\t\t\t\r\n\" />\r\n\t\t\t<Text>\r\n\t\t\t\t<Text.Text>\r\n\t\t\t\t\t<cms:read source=\"ReferencedData\" />\r\n\t\t\t\t</Text.Text>\r\n\t\t\t</Text>\r\n\t\t</PlaceHolder>\r\n\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteMediaFolder.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"MessageText\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Management, Website.Forms.Administrative.DeleteMediaFolder.LabelFieldGroup}\">\r\n    <!--<Text Text=\"${Composite.Management, Website.Forms.Administrative.DeleteMediaFolder.Text}\" />-->\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"MessageText\"/>\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteMediaFolderConfirmDeletingRelatedData.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"ReferencedData\" type=\"System.String\" optional=\"true\"/>\r\n\t</cms:bindings>\r\n\t<cms:layout label=\"${Composite.Management, Website.Forms.Administrative.DeleteMediaFolder.LabelFieldGroup}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Text Text=\"${Composite.Management, Website.Forms.Administrative.DeleteMediaFile.DeleteDataConfirmationText}\" />\r\n\t\t\t<Text Text=\"\r\n\t\t\t\t\t\t\r\n\" />\r\n\t\t\t<Text>\r\n\t\t\t\t<Text.Text>\r\n\t\t\t\t\t<cms:read source=\"ReferencedData\" />\r\n\t\t\t\t</Text.Text>\r\n\t\t\t</Text>\r\n\t\t</PlaceHolder>\r\n\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteMetaDataConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FieldGroupNames\" type=\"System.Object\" />\r\n    <cms:binding name=\"SelectedFieldGroupName\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generated-type-delete\" label=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteMetaDataSelectType.LayoutLabel}\">\r\n    <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.FieldLabel}\">\r\n      <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.SelectorLabel}\" OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Management, AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.SelectorHelp}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"FieldGroupNames\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedFieldGroupName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeletePageStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-delete-page\" label=\"${Composite.Plugins.PageElementProvider, DeletePage.LabelFieldGroup}\">\r\n    <Heading\r\n        Title=\"${Composite.Plugins.PageElementProvider, DeletePageStep1.Title}\"\r\n        Description=\"${Composite.Plugins.PageElementProvider, DeletePageStep1.Description}\" />\r\n    </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeletePageStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n\t  <cms:binding name=\"DeleteMessageText\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-delete-page\" label=\"${Composite.Plugins.PageElementProvider, DeletePage.LabelFieldGroup}\">\r\n\t  <Text>\r\n\t\t  <Text.Text>\r\n\t\t\t  <cms:read source=\"DeleteMessageText\" />\r\n\t\t  </Text.Text>  \r\n\t  </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeletePageStep3.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n\t\t<cms:binding name=\"ReferencedData\" type=\"System.String\" optional=\"true\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-delete-page\" label=\"${Composite.Plugins.PageElementProvider, DeletePage.LabelFieldGroup}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Text Text=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DeleteDataConfirmationText}\" />\r\n\t\t\t<Text Text=\"\r\n\t\t\t\t\t\t\r\n\" />\r\n\t\t\t<Text>\r\n\t\t\t\t<Text.Text>\r\n\t\t\t\t\t<cms:read source=\"ReferencedData\" />\r\n\t\t\t\t</Text.Text>\r\n\t\t\t</Text>\r\n\t\t</PlaceHolder>\r\n\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeletePageTemplateStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.PageTemplateElementProvider, DeletePageTemplateStep1.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Plugins.PageTemplateElementProvider, DeletePageTemplateStep1.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeletePage_ConfirmAllVersionsDeletion.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"DeleteAllVersions\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-delete-page\" label=\"${Composite.Plugins.PageElementProvider, DeletePageWorkflow.ConfirmAllVersionsDeletion.DialogLabel}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Text Text=\"${Composite.Plugins.PageElementProvider, DeletePageWorkflow.ConfirmAllVersionsDeletion.Text}\" />\r\n\r\n\t\t\t<BoolSelector \r\n\t\t\t\tTrueLabel=\"${Composite.Plugins.PageElementProvider, DeletePageWorkflow.ConfirmAllVersionsDeletion.DeleteAllVersions}\" \r\n\t\t\t\tFalseLabel=\"${Composite.Plugins.PageElementProvider, DeletePageWorkflow.ConfirmAllVersionsDeletion.DeleteCurrentVersion}\" \r\n\t\t\t\tLabel=\"\">\r\n\t\t\t\t<cms:bind source=\"DeleteAllVersions\" />\r\n\t\t\t</BoolSelector>\r\n\t\t</PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteRazorFunctionConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.RazorFunction, DeleteRazorFunctionWorkflow.ConfirmDeleteTitle}\">\r\n    <Text Text=\"${Composite.Plugins.RazorFunction, DeleteRazorFunctionWorkflow.ConfirmDeleteMessage}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteUserControlFunctionConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.UserControlFunction, DeleteUserControlFunctionWorkflow.ConfirmDeleteTitle}\">\r\n    <Text Text=\"${Composite.Plugins.UserControlFunction, DeleteUserControlFunctionWorkflow.ConfirmDeleteMessage}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteUserStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Management, Website.Forms.Administrative.DeleteUserStep1.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Management, Website.Forms.Administrative.DeleteUserStep1.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteVisualFunctionStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.VisualFunction, DeleteStep1.FieldGroupLabel}\">\r\n    <Text Text=\"${Composite.Plugins.VisualFunction, DeleteStep1.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DeleteXsltFunctionConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.XsltBasedFunction, DeleteXsltFunctionWorkflow.ConfirmDeleteTitle}\">\r\n    <Text Text=\"${Composite.Plugins.XsltBasedFunction, DeleteXsltFunctionWorkflow.ConfirmDeleteMessage}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DisableTypeLocalizationStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" />\r\n    <cms:binding name=\"CultureNameList\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"generated-type-delocalize\" label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DisableTypeLocalizationWorkflow.Dialog.Label}\">\r\n    <FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DisableTypeLocalizationWorkflow.Step1.FieldGroup.Label}\">\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" \r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DisableTypeLocalizationWorkflow.Step1.CultureSelector.Label}\" \r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DisableTypeLocalizationWorkflow.Step1.CultureSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CultureNameList\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CultureName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\t\t</FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/DisableTypeLocalizationStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"generated-type-delocalize\" label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DisableTypeLocalizationWorkflow.Dialog.Label}\">\r\n    <Heading\r\n\t\t\tTitle=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DisableTypeLocalizationWorkflow.Step2.Title}\"\r\n\t\t\tDescription=\"${Composite.Plugins.GeneratedDataTypesElementProvider, DisableTypeLocalizationWorkflow.Step2.Description}\" />    \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditCompositionTypeStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"TypeName\" type=\"System.String\" />\r\n    <cms:binding name=\"TypeNamespace\" type=\"System.String\" />\r\n    <cms:binding name=\"TypeTitle\" type=\"System.String\" />\r\n    <cms:binding name=\"DataFieldDescriptors\" type=\"System.Object\" />\r\n    <cms:binding name=\"LabelFieldName\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"HasCaching\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <TabPanels>\r\n      <TabPanels.Label>\r\n        <cms:read source=\"TypeName\"/>\r\n      </TabPanels.Label>\r\n      <PlaceHolder Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.SettingsTab}\">\r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTitleGroup}\">\r\n          <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTitle}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTitle}\">\r\n            <cms:bind source=\"TypeTitle\" />\r\n          </TextBox>\r\n        </FieldGroup>\r\n\r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelProgrammaticNaming}\">\r\n          <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTypeName}\"\r\n               Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTypeName}\" Type=\"ProgrammingIdentifier\">\r\n            <cms:bind source=\"TypeName\" />\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTypeNamespace}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTypeNamespace}\" Type=\"ProgrammingNamespace\">\r\n            <cms:bind source=\"TypeNamespace\" />\r\n          </TextBox>\r\n\r\n          <PlaceHolder Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.ServicesLabel}\">\r\n            <CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasCaching}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasCaching}\">\r\n              <CheckBox.Checked>\r\n                <cms:bind source=\"HasCaching\" />\r\n              </CheckBox.Checked>\r\n            </CheckBox>\r\n          </PlaceHolder>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      <internal:TypeFieldDesigner Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelFields}\" IsSearchable=\"true\">\r\n        <internal:TypeFieldDesigner.Fields>\r\n          <cms:bind source=\"DataFieldDescriptors\" />\r\n        </internal:TypeFieldDesigner.Fields>\r\n        <internal:TypeFieldDesigner.LabelFieldName>\r\n          <cms:bind source=\"LabelFieldName\" />\r\n        </internal:TypeFieldDesigner.LabelFieldName>\r\n      </internal:TypeFieldDesigner>\r\n\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditDynamicTypeFormMarkup.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Title\" type=\"System.String\" />\r\n    <cms:binding name=\"FileContent\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <TextEditor MimeType=\"text/xml\">\r\n      <TextEditor.Label>\r\n        <cms:read source=\"Title\" />\r\n      </TextEditor.Label>\r\n      <cms:bind source=\"FileContent\" />\r\n    </TextEditor>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditInterfaceTypeStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n    <cms:bindings>\r\n        <cms:binding name=\"TypeName\" type=\"System.String\" />\r\n        <cms:binding name=\"TypeNamespace\" type=\"System.String\" />\r\n        <cms:binding name=\"TypeTitle\" type=\"System.String\" />\r\n        <cms:binding name=\"DataFieldDescriptors\" type=\"System.Object\" />\r\n        <cms:binding name=\"HasCaching\" type=\"System.Boolean\" />\r\n        <cms:binding name=\"HasPublishing\" type=\"System.Boolean\" />\r\n        <cms:binding name=\"IsSearchable\" type=\"System.Boolean\" />\r\n        <cms:binding name=\"KeyFieldName\" type=\"System.String\" optional=\"true\" />\r\n        <cms:binding name=\"LabelFieldName\" type=\"System.String\" optional=\"true\" />\r\n        <cms:binding name=\"InternalUrlPrefix\" type=\"System.String\" optional=\"true\" />\r\n        <cms:binding name=\"CustomEvent01Handler\" type=\"System.EventHandler\" />\r\n    </cms:bindings>\r\n    <cms:layout iconhandle=\"generated-type-edit\">\r\n        <cms:layout.label>\r\n            <cms:read source=\"TypeName\"/>\r\n        </cms:layout.label>\r\n        <TabPanels>\r\n            <PlaceHolder Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.SettingsTab}\">\r\n\r\n                <FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTitleGroup}\">\r\n                    <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTitle}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTitle}\">\r\n                        <cms:bind source=\"TypeTitle\" />\r\n                    </TextBox>\r\n                </FieldGroup>\r\n\r\n\r\n                <FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelProgrammaticNamingAndServices}\">\r\n                    <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTypeName}\"\r\n                         Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTypeName}\" Type=\"ProgrammingIdentifier\">\r\n                        <cms:bind source=\"TypeName\" />\r\n                    </TextBox>\r\n                    <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelTypeNamespace}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HelpTypeNamespace}\" Type=\"ProgrammingNamespace\">\r\n                        <cms:bind source=\"TypeNamespace\" />\r\n                    </TextBox>\r\n\r\n                  <TextBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.InternalUrlPrefixLabel}\" Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.InternalUrlPrefixHelp}\" Type=\"programmingidentifier\">\r\n                    <cms:bind source=\"InternalUrlPrefix\" />\r\n                  </TextBox>\r\n\r\n                  <PlaceHolder Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.ServicesLabel}\">\r\n                        <CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasCaching}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasCaching}\">\r\n                            <CheckBox.Checked>\r\n                                <cms:bind source=\"HasCaching\" />\r\n                            </CheckBox.Checked>\r\n                        </CheckBox>\r\n                        <CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasPublishing}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.HasPublishing}\">\r\n                            <CheckBox.Checked>\r\n                                <cms:bind source=\"HasPublishing\" />\r\n                            </CheckBox.Checked>\r\n                        </CheckBox>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<CheckBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.IsSearchable}\" ItemLabel=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.IsSearchable}\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<CheckBox.Checked>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<cms:bind source=\"IsSearchable\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</CheckBox.Checked>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<CheckBox.CheckedChangedEventHandler>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<cms:read source=\"CustomEvent01Handler\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</CheckBox.CheckedChangedEventHandler>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</CheckBox>\r\n\t\t\t\t\t\t\t\t\t</PlaceHolder>\r\n                </FieldGroup>\r\n            </PlaceHolder>\r\n            <internal:TypeFieldDesigner Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EditorCommon.LabelFields}\" KeyFieldReadOnly=\"true\">\r\n                <internal:TypeFieldDesigner.Fields>\r\n                    <cms:bind source=\"DataFieldDescriptors\" />\r\n                </internal:TypeFieldDesigner.Fields>\r\n                <internal:TypeFieldDesigner.KeyFieldName>\r\n                    <cms:bind source=\"KeyFieldName\" />\r\n                </internal:TypeFieldDesigner.KeyFieldName>\r\n                <internal:TypeFieldDesigner.LabelFieldName>\r\n                    <cms:bind source=\"LabelFieldName\" />\r\n                </internal:TypeFieldDesigner.LabelFieldName>\r\n\t\t\t\t\t\t\t\t<internal:TypeFieldDesigner.IsSearchable>\r\n\t\t\t\t\t\t\t\t\t<cms:read source=\"IsSearchable\" />\r\n\t\t\t\t\t\t\t\t</internal:TypeFieldDesigner.IsSearchable>\r\n            </internal:TypeFieldDesigner>\r\n\r\n        </TabPanels>\r\n    </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditMediaFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FileDataFileName\" type=\"System.String\" />\r\n    <cms:binding name=\"FileDataTitle\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"FileDataDescription\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"FileDataTags\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"FileDataURL\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"ProvidesMetaData\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"media-edit-media-file\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.LabelFieldGroup}\">\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.LabelFileName}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.HelpFileName}\" SpellCheck=\"false\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"FileDataFileName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"ProvidesMetaData\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n          <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.LabelTitle}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.HelpTitle}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"FileDataTitle\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </f:BooleanCheck.WhenTrue>\r\n      </f:BooleanCheck>\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"ProvidesMetaData\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>          \r\n          <TextArea Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.LabelDescription}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.HelpDescription}\">            \r\n              <cms:bind source=\"FileDataDescription\" />            \r\n          </TextArea>\r\n        </f:BooleanCheck.WhenTrue>\r\n      </f:BooleanCheck>\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"ProvidesMetaData\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n          <TextArea Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.LabelTags}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.HelpTags}\">\r\n            <cms:bind source=\"FileDataTags\" />\r\n          </TextArea>\r\n        </f:BooleanCheck.WhenTrue>\r\n      </f:BooleanCheck>\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"ProvidesMetaData\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.LabelMediaURL}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditMediaFile.HelpMediaURL}\" Required=\"false\">\r\n            <cms:read source=\"FileDataURL\" />\r\n          </TextBox>\r\n        </f:BooleanCheck.WhenTrue>\r\n      </f:BooleanCheck>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditMediaFileTextContent.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FileContent\" type=\"System.String\" />\r\n    <cms:binding name=\"FileName\" type=\"System.String\" />\r\n    <cms:binding name=\"FileMimeType\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <TextEditor>\r\n      <TextEditor.MimeType>\r\n        <cms:read source=\"FileMimeType\" />\r\n      </TextEditor.MimeType>\r\n      <TextEditor.Label>\r\n        <cms:read source=\"FileName\" />\r\n      </TextEditor.Label>\r\n      <cms:bind source=\"FileContent\" />\r\n    </TextEditor>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditMediaFolder.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"FolderTitle\" type=\"System.String\" optional=\"true\"/>\r\n\t\t<cms:binding name=\"FolderDescription\" type=\"System.String\" optional=\"true\"/>\r\n\t\t<cms:binding name=\"FolderName\" type=\"System.String\" />\r\n\t\t<cms:binding name=\"ProvidesMetaData\" type=\"System.Boolean\" />\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"folder-edit\">\r\n\t\t<FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFolder.LabelFieldGroup}\">\r\n\t\t\t<TextBox Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFolder.LabelFolderName}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditMediaFolder.HelpFolderName}\">\r\n\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t<cms:bind source=\"FolderName\" />\r\n\t\t\t\t</TextBox.Text>\r\n\t\t\t</TextBox>\r\n\t\t\t<f:BooleanCheck>\r\n\t\t\t\t<f:BooleanCheck.CheckValue>\r\n\t\t\t\t\t<cms:read source=\"ProvidesMetaData\" />\r\n\t\t\t\t</f:BooleanCheck.CheckValue>\r\n\t\t\t\t<f:BooleanCheck.WhenTrue>\r\n\t\t\t\t\t<TextBox Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFolder.LabelTitle}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditMediaFolder.HelpTitle}\">\r\n\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t<cms:bind source=\"FolderTitle\" />\r\n\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t</TextBox>\r\n\t\t\t\t</f:BooleanCheck.WhenTrue>\r\n\t\t\t</f:BooleanCheck>\r\n\t\t\t<f:BooleanCheck>\r\n\t\t\t\t<f:BooleanCheck.CheckValue>\r\n\t\t\t\t\t<cms:read source=\"ProvidesMetaData\" />\r\n\t\t\t\t</f:BooleanCheck.CheckValue>\r\n\t\t\t\t<f:BooleanCheck.WhenTrue>\r\n\t\t\t\t\t<TextArea Label=\"${Composite.Management, Website.Forms.Administrative.EditMediaFolder.LabelDescription}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditMediaFolder.HelpDescription}\">\r\n\t\t\t\t\t\t<cms:bind source=\"FolderDescription\" />\r\n\t\t\t\t\t</TextArea>\r\n\t\t\t\t</f:BooleanCheck.WhenTrue>\r\n\t\t\t</f:BooleanCheck>\r\n\t\t</FieldGroup>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditMetaDataSelectType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedMetaDataTypeId\" type=\"System.Guid\"/>\r\n    <cms:binding name=\"MetaDataTypeOptions\" type=\"System.Collections.IEnumerable\"/>\r\n  </cms:bindings>\r\n\r\n  <cms:layout iconhandle=\"generated-type-edit\" label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataSelectTypeWorkflow.Layout.Label}\">    \r\n    <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataSelectTypeWorkflow.FieldGroup.Label}\">      \r\n\r\n      <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataSelectTypeWorkflow.MetaDataTypeSelector.Label}\"\r\n                   Help=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataSelectTypeWorkflow.MetaDataTypeSelector.Help}\"\r\n                   OptionsKeyField=\"Key\" OptionsLabelField=\"Value\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"MetaDataContainerOptions\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"MetaDataDefinition.MetaDataContainerId\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n    \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditMetaData_EditDefinition.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Label\" type=\"System.String\"/>    \r\n    <cms:binding name=\"MetaDataContainerOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"SelectedMetaDataContainer\" type=\"System.Guid\"/>\r\n    <cms:binding name=\"StartDisplayOptions\" type=\"System.Collections.IEnumerable\"  />\r\n    <cms:binding name=\"SelectedStartDisplay\" type=\"System.Int32\" />\r\n    <cms:binding name=\"InheritDisplayOptions\" type=\"System.Collections.IEnumerable\"  />\r\n    <cms:binding name=\"SelectedInheritDisplay\" type=\"System.Int32\" />\r\n  </cms:bindings>\r\n\r\n  <cms:layout iconhandle=\"generated-type-edit\" label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.Layout.Label}\">    \r\n    <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.FieldGroup.Label}\">\r\n\r\n      <TextBox Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.LabelTextBox.Label}\"\r\n               Help=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.LabelTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Label\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n      <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerSelector.Label}\"\r\n                   Help=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerSelector.Help}\"\r\n                   OptionsKeyField=\"Key\" OptionsLabelField=\"Value\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"MetaDataContainerOptions\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedMetaDataContainer\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n      <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.StartDisplaySelectorLabel}\" \r\n                   Help=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.StartDisplaySelectorHelp}\"\r\n                   OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n        <KeySelector.Options>\r\n          <cms:read source=\"StartDisplayOptions\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedStartDisplay\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n      <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.InheritDisplaySelectorLabel}\" \r\n                   Help=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.InheritDisplaySelectorHelp}\"\r\n                   OptionsKeyField=\"Key\" OptionsLabelField=\"Value\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"InheritDisplayOptions\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedInheritDisplay\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n      \r\n    </FieldGroup>       \r\n    \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditMetaData_NoDefaultValuesNeeded.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n\r\n  <cms:layout iconhandle=\"generated-type-edit\" label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.Layout.Label}\">\r\n\r\n    <Heading\r\n      Title=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoDefaultValuesNeeded.Title}\"\r\n      Description=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoDefaultValuesNeeded.Description}\" />\r\n      \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditMetaData_SelectDefinition.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedMetaDataDefinition\" type=\"System.Object\"/>\r\n    <cms:binding name=\"MetaDataDefinitionOptions\" type=\"System.Collections.IEnumerable\"/>\r\n  </cms:bindings>\r\n\r\n  <cms:layout iconhandle=\"generated-type-edit\" label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.Layout.Label}\">\r\n    <FieldGroup Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.FieldGroup.Label}\">\r\n\r\n      <KeySelector Label=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataDefinitionSelector.Label}\"\r\n                   Help=\"${Composite.Management, AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataDefinitionSelector.Help}\"\r\n                   OptionsKeyField=\"Key\" OptionsLabelField=\"Value\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"MetaDataDefinitionOptions\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedMetaDataDefinition\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditMethodBasedFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CurrentMethodFunctionInfo\" type=\"Composite.Data.Types.IMethodBasedFunctionInfo, Composite\" />\r\n    <cms:binding optional=\"true\" name=\"ErrorMessage\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"functioncall\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"CurrentMethodFunctionInfo.UserMethodName\" />\r\n    </cms:layout.label>\r\n\r\n    <FieldGroup Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelFieldGroup}\">\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelMethodName}\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelMethodNameHelp}\" Type=\"ProgrammingIdentifier\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CurrentMethodFunctionInfo.UserMethodName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelNamespaceName}\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelNamespaceNameHelp}\" Type=\"ProgrammingNamespace\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CurrentMethodFunctionInfo.Namespace\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelType}\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelTypeHelp}\" SpellCheck=\"false\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CurrentMethodFunctionInfo.Type\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelMethod}\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelMethodHelp}\" SpellCheck=\"false\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CurrentMethodFunctionInfo.MethodName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"ErrorMessage\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <Text Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditMethodBasedFunction.LabelError}\">\r\n            <Text.Text>\r\n              <cms:read source=\"ErrorMessage\" />\r\n            </Text.Text>\r\n          </Text>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditPage.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"SelectedPage\" type=\"Composite.Data.Types.IPage\" />\r\n\t\t<cms:binding name=\"SelectablePageTypeIds\" type=\"System.Collections.IEnumerable\" />\r\n\t\t<cms:binding name=\"SelectableTemplateIds\" type=\"System.Collections.IEnumerable\" />\r\n\t\t<cms:binding name=\"StateOptions\" type=\"System.Object\" />\r\n\t\t<cms:binding name=\"NamedXhtmlFragments\" type=\"System.Object\" />\r\n\t\t<cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n\t\t<cms:binding name=\"CustomEvent01Handler\" type=\"System.EventHandler\" />\r\n\t\t<cms:binding name=\"UrlTitleIsRequired\" type=\"System.Boolean\"/>\r\n    <cms:binding name=\"IsRootPage\" type=\"System.Boolean\"/>\r\n\t\t<cms:binding name=\"Tooltip\" type=\"System.String\" optional=\"true\" />\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"page-edit-page\">\r\n\t\t<cms:layout.tooltip>\r\n\t\t\t<cms:read source=\"Tooltip\" />\r\n\t\t</cms:layout.tooltip>\r\n\t\t\r\n\t\t<TabPanels PreSelectedIndex=\"1\">\r\n\t\t\t<TabPanels.Label>\r\n        <f:BooleanCheck>\r\n          <f:BooleanCheck.CheckValue>\r\n            <cms:read source=\"IsRootPage\"/>\r\n          </f:BooleanCheck.CheckValue>\r\n          <f:BooleanCheck.WhenTrue>\r\n            <cms:read source=\"SelectedPage.Title\" />\r\n          </f:BooleanCheck.WhenTrue>\r\n          <f:BooleanCheck.WhenFalse>\r\n            <f:NullCheck>\r\n              <f:NullCheck.CheckValue>\r\n                <cms:read source=\"SelectedPage.MenuTitle\" />\r\n              </f:NullCheck.CheckValue>\r\n              <f:NullCheck.WhenNull>\r\n                <cms:read source=\"SelectedPage.Title\" />\r\n              </f:NullCheck.WhenNull>\r\n              <f:NullCheck.WhenNotNull>\r\n                <cms:read source=\"SelectedPage.MenuTitle\" />\r\n              </f:NullCheck.WhenNotNull>\r\n            </f:NullCheck>\r\n          </f:BooleanCheck.WhenFalse>\r\n        </f:BooleanCheck>\r\n\t\t\t</TabPanels.Label>\r\n\t\t\t<PlaceHolder Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelPaneSettings}\">\r\n\t\t\t\t<FieldGroup Label=\"${Composite.Plugins.PageElementProvider, GeneralSettings.FieldGroupLabel}\">\r\n\t\t\t\t\t<TextBox Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelPageTitle}\" Help=\"${Composite.Plugins.PageElementProvider, EditPage.LabelPageTitleHelp}\">\r\n\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t<cms:bind source=\"SelectedPage.Title\" />\r\n\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t</TextBox>\r\n\t\t\t\t\t<TextArea Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelAbstract}\" Help=\"${Composite.Plugins.PageElementProvider, EditPage.LabelAbstractHelp}\">\r\n\t\t\t\t\t\t<TextArea.Text>\r\n\t\t\t\t\t\t\t<cms:bind source=\"SelectedPage.Description\" />\r\n\t\t\t\t\t\t</TextArea.Text>\r\n\t\t\t\t\t</TextArea>\r\n\r\n          <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.Plugins.PageElementProvider, EditPage.PageTypeSelectorLabel}\"\r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.Plugins.PageElementProvider, EditPage.PageTypeSelectorHelp}\">\r\n            <KeySelector.SelectedIndexChangedEventHandler>\r\n              <cms:read source=\"CustomEvent01Handler\"/>\r\n            </KeySelector.SelectedIndexChangedEventHandler>\r\n            <KeySelector.Options>\r\n              <cms:read source=\"SelectablePageTypeIds\"/>\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"SelectedPage.PageTypeId\" />\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n          \r\n\t\t\t\t</FieldGroup>\r\n\t\t\t\t<FieldGroup Label=\"${Composite.Plugins.PageElementProvider, AdvancedSettings.FieldGroupLabel}\">\r\n\t\t\t\t\t<TextBox Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelMenuTitle}\" Help=\"${Composite.Plugins.PageElementProvider, EditPage.HelpMenuTitle}\">\r\n\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t<cms:bind source=\"SelectedPage.MenuTitle\" />\r\n\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t</TextBox>\r\n\t\t\t\t\t<TextBox Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelUrlTitle}\" Help=\"${Composite.Plugins.PageElementProvider, EditPage.HelpUrlTitle}\" SpellCheck=\"false\">\r\n\t\t\t\t\t\t<TextBox.Required>\r\n\t\t\t\t\t\t\t<cms:read source=\"UrlTitleIsRequired\" />\r\n\t\t\t\t\t\t</TextBox.Required>\r\n\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t<cms:bind source=\"SelectedPage.UrlTitle\" />\r\n\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t</TextBox>\r\n\t\t\t\t\t<TextBox Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelFriendlyUrl}\" Help=\"${Composite.Plugins.PageElementProvider, EditPage.HelpFriendlyUrl}\" SpellCheck=\"false\">\r\n\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t<cms:bind source=\"SelectedPage.FriendlyUrl\" />\r\n\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t</TextBox>\r\n\t\t\t\t</FieldGroup>\r\n\r\n\t\t\t\t<FieldGroup Label=\"${Composite.Plugins.PageElementProvider, PublicationSettings.FieldGroupLabel}\">\r\n\t\t\t\t\t<KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelPublicationState}\" Help=\"${Composite.Plugins.PageElementProvider, EditPage.HelpPublicationState}\" Required=\"true\">\r\n\t\t\t\t\t\t<KeySelector.Selected>\r\n\t\t\t\t\t\t\t<cms:bind source=\"SelectedPage.PublicationStatus\" />\r\n\t\t\t\t\t\t</KeySelector.Selected>\r\n\t\t\t\t\t\t<KeySelector.Options>\r\n\t\t\t\t\t\t\t<cms:read source=\"StateOptions\" />\r\n\t\t\t\t\t\t</KeySelector.Options>\r\n\t\t\t\t\t</KeySelector>\r\n\t\t\t\t</FieldGroup>\r\n\t\t\t</PlaceHolder>\r\n      \r\n\t\t\t<internal:PageContentEditor Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelContent}\">\r\n\t\t\t\t<internal:PageContentEditor.PageId>\r\n\t\t\t\t\t<cms:bind source=\"SelectedPage.Id\" />\r\n\t\t\t\t</internal:PageContentEditor.PageId>\r\n\t\t\t\t<internal:PageContentEditor.TemplateId>\r\n          <cms:bind source=\"SelectedPage.TemplateId\" />\r\n        </internal:PageContentEditor.TemplateId>\r\n        <internal:PageContentEditor.SelectableTemplateIds>\r\n          <cms:bind source=\"SelectableTemplateIds\" />\r\n        </internal:PageContentEditor.SelectableTemplateIds>\r\n        <internal:PageContentEditor.NamedXhtmlFragments>\r\n          <cms:bind source=\"NamedXhtmlFragments\" />\r\n        </internal:PageContentEditor.NamedXhtmlFragments>\r\n        <internal:PageContentEditor.PageTypeId>\r\n          <cms:read source=\"SelectedPage.PageTypeId\" />\r\n        </internal:PageContentEditor.PageTypeId>\r\n\r\n      </internal:PageContentEditor>\r\n      \r\n\t\t\t<f:NullCheck>\r\n\t\t\t\t<f:NullCheck.CheckValue>\r\n\t\t\t\t\t<cms:read source=\"PreviewEventHandler\" />\r\n\t\t\t\t</f:NullCheck.CheckValue>\r\n\t\t\t\t<f:NullCheck.WhenNotNull>\r\n\t\t\t\t\t<internal:PreviewPanel Label=\"${Composite.Plugins.PageElementProvider, EditPage.LabelPreview}\">\r\n\t\t\t\t\t\t<internal:PreviewPanel.ClickEventHandler>\r\n\t\t\t\t\t\t\t<cms:read source=\"PreviewEventHandler\" />\r\n\t\t\t\t\t\t</internal:PreviewPanel.ClickEventHandler>\r\n\t\t\t\t\t</internal:PreviewPanel>\r\n\t\t\t\t</f:NullCheck.WhenNotNull>\r\n\t\t\t</f:NullCheck>\r\n\t\t</TabPanels>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditRazorFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FileContent\" type=\"System.String\" />\r\n    <cms:binding name=\"FileName\" type=\"System.String\" />\r\n    <cms:binding name=\"FileMimeType\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"functioncall\">\r\n    <TextEditor>\r\n      <TextEditor.MimeType>\r\n        <cms:read source=\"FileMimeType\" />\r\n      </TextEditor.MimeType>\r\n      <TextEditor.Label>\r\n        <cms:read source=\"FileName\" />\r\n      </TextEditor.Label>\r\n      <cms:bind source=\"FileContent\" />\r\n    </TextEditor>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditSqlFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SqlQuery\" type=\"Composite.Data.Types.ISqlFunctionInfo, Composite\" />\r\n    <cms:binding name=\"ParameterTypeOptions\" type=\"System.Collections.Generic.IEnumerable`1[[System.Type]]\" />\r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"false\" />\r\n\r\n    <cms:binding name=\"SessionStateProvider\" type=\"System.String\" />\r\n\t<cms:binding name=\"SessionStateId\" type=\"System.Guid\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"sql-based-function\">\r\n    <TabPanels PreSelectedIndex=\"2\">\r\n      <TabPanels.Label>\r\n        <cms:read source=\"SqlQuery.Name\" />\r\n      </TabPanels.Label>\r\n      <PlaceHolder Label=\"${Composite.Plugins.SqlFunction, EditSqlFunction.LabelSettings}\">\r\n        <FieldGroup Label=\"${Composite.Plugins.SqlFunction, EditSqlFunction.LabelNamingAndDescription}\">\r\n          <TextBox Label=\"${Composite.Plugins.SqlFunction, EditSqlFunction.LabelName}\" Help=\"${Composite.Plugins.SqlFunction, EditSqlFunction.HelpName}\" Type=\"ProgrammingIdentifier\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"SqlQuery.Name\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Plugins.SqlFunction, EditSqlFunction.LabelNamespace}\" Help=\"${Composite.Plugins.SqlFunction, EditSqlFunction.HelpNamespace}\" Type=\"ProgrammingNamespace\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"SqlQuery.Namespace\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextArea Label=\"${Composite.Plugins.SqlFunction, EditSqlFunction.LabelDescription}\" Help=\"${Composite.Plugins.SqlFunction, EditSqlFunction.HelpDescription}\">\r\n            <TextArea.Text>\r\n              <cms:bind source=\"SqlQuery.Description\" />\r\n            </TextArea.Text>\r\n          </TextArea>\r\n        </FieldGroup>\r\n        <FieldGroup Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelCommandBehaviour}\">\r\n          <CheckBox Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelIsStoredProcedure}\" ItemLabel=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelIsStoredProcedureCheckBox}\">\r\n            <CheckBox.Checked>\r\n              <cms:bind source=\"SqlQuery.IsStoredProcedure\" />\r\n            </CheckBox.Checked>\r\n          </CheckBox>\r\n          <CheckBox Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelReturnsXml}\" ItemLabel=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelReturnsXmlCheckBox}\">\r\n            <CheckBox.Checked>\r\n              <cms:bind source=\"SqlQuery.ReturnsXml\" />\r\n            </CheckBox.Checked>\r\n          </CheckBox>\r\n          <CheckBox Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelIsQuery}\" ItemLabel=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelIsQueryCheckBox}\">\r\n            <CheckBox.Checked>\r\n              <cms:bind source=\"SqlQuery.IsQuery\" />\r\n            </CheckBox.Checked>\r\n          </CheckBox>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      <internal:ParameterDesigner Label=\"${Composite.Plugins.SqlFunction, EditSqlFunction.LabelInputParameters}\">\r\n\t\t  <internal:ParameterDesigner.SessionStateProvider>\r\n\t\t\t  <cms:read source=\"SessionStateProvider\"/>\r\n\t\t  </internal:ParameterDesigner.SessionStateProvider>\r\n\t\t  <internal:ParameterDesigner.SessionStateId>\r\n\t\t\t  <cms:read source=\"SessionStateId\"/>\r\n\t\t  </internal:ParameterDesigner.SessionStateId>\r\n      </internal:ParameterDesigner>\r\n      <SqlEditor Label=\"${Composite.Plugins.SqlFunction, AddEditSqlFunction.LabelSqlEditor}\">\r\n        <cms:bind source=\"SqlQuery.Command\" />\r\n      </SqlEditor>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"PreviewEventHandler\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <internal:PreviewPanel Label=\"${Composite.Plugins.SqlFunction, EditSqlFunction.LabelPreview}\">\r\n            <internal:PreviewPanel.ClickEventHandler>\r\n              <cms:read source=\"PreviewEventHandler\" />\r\n            </internal:PreviewPanel.ClickEventHandler>\r\n          </internal:PreviewPanel>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditSqlFunctionConnection.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SqlConnection\" type=\"Composite.Data.Types.ISqlConnection, Composite\" />\r\n    <cms:binding name=\"ConnectionString\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"sql-based-connection-edit\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"SqlConnection.Name\" />\r\n    </cms:layout.label>\r\n    <FieldGroup Label=\"${Composite.Plugins.SqlFunction, EditSqlFunctionConnection.LabelFieldGroup}\">\r\n      <TextBox Label=\"${Composite.Plugins.SqlFunction, EditSqlFunctionConnection.LabelName}\" Help=\"${Composite.Plugins.SqlFunction, EditSqlFunctionConnection.HelpName}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"SqlConnection.Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.SqlFunction, EditSqlFunctionConnection.LabelConnectionString}\" Help=\"${Composite.Plugins.SqlFunction, EditSqlFunctionConnection.HelpConnectionString}\" SpellCheck=\"false\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"ConnectionString\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <CheckBox ItemLabel=\"${Composite.Plugins.SqlFunction, EditSqlFunctionConnection.LabelIsMSSQLCheckBox}\" Label=\"${Composite.Plugins.SqlFunction, EditSqlFunctionConnection.LabelIsMSSQL}\">\r\n        <CheckBox.Checked>\r\n          <cms:bind source=\"SqlConnection.IsMsSql\" />\r\n        </CheckBox.Checked>\r\n      </CheckBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditSystemLocaleEdit.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"SystemActiveLocale\" type=\"Composite.Data.Types.ISystemActiveLocale\" />\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"localization-editsystemlocale\" label=\"${Composite.Plugins.LocalizationElementProvider, EditSystemLocaleWorkflow.Dialog.Label}\">\r\n\t\t<FieldGroup Label=\"${Composite.Plugins.LocalizationElementProvider, EditSystemLocaleWorkflow.FieldGroup.Label}\">\r\n\t\t\t<TextBox Label=\"${Composite.Plugins.LocalizationElementProvider, EditSystemLocaleWorkflow.UrlMappingName.Label}\" Help=\"${Composite.Plugins.LocalizationElementProvider, EditSystemLocaleWorkflow.UrlMappingName.Help}\" SpellCheck=\"false\">\r\n\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t<cms:bind source=\"SystemActiveLocale.UrlMappingName\" />\r\n\t\t\t\t</TextBox.Text>\r\n\t\t\t</TextBox>\r\n\t\t</FieldGroup>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditUserControlFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Title\" type=\"System.String\" />\r\n    \r\n    <cms:binding name=\"File1Content\" type=\"System.String\" />\r\n    <cms:binding name=\"File1Name\" type=\"System.String\" />\r\n    <cms:binding name=\"File1MimeType\" type=\"System.String\" />\r\n\r\n    <cms:binding name=\"File2Content\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"File2Name\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"File2MimeType\" type=\"System.String\" optional=\"true\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"functioncall\">\r\n    <TabPanels>\r\n      <TabPanels.Label>\r\n        <cms:read source=\"Title\" />\r\n      </TabPanels.Label>\r\n      \r\n      <TextEditor>\r\n        <TextEditor.MimeType>\r\n          <cms:read source=\"File1MimeType\" />\r\n        </TextEditor.MimeType>\r\n        <TextEditor.Label>\r\n          <cms:read source=\"File1Name\" />\r\n        </TextEditor.Label>\r\n        <cms:bind source=\"File1Content\" />\r\n      </TextEditor>\r\n\r\n\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"File2Content\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n\r\n          <TextEditor>\r\n            <TextEditor.MimeType>\r\n              <cms:read source=\"File2MimeType\" />\r\n            </TextEditor.MimeType>\r\n            <TextEditor.Label>\r\n              <cms:read source=\"File2Name\" />\r\n            </TextEditor.Label>\r\n            <cms:bind source=\"File2Content\" />\r\n          </TextEditor>\r\n          \r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n      \r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditUserStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"User\" type=\"Composite.Data.Types.IUser\" />\r\n    <cms:binding name=\"UserFormLogin\" type=\"Composite.Data.Types.IUserFormLogin\" />\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" />\r\n    <cms:binding name=\"C1ConsoleUiLanguageName\" type=\"System.String\" />\r\n    <cms:binding name=\"C1ConsoleUiCultures\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"AllCultures\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"ActiveLocaleName\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"ActiveLocaleList\" type=\"System.Collections.IEnumerable\" optional=\"true\"/>\r\n    <cms:binding name=\"NewPassword\" type=\"System.String\" optional=\"false\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"users-edituser\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"User.Username\" />\r\n    </cms:layout.label>\r\n    <TabPanels PreSelectedIndex=\"0\">\r\n      <PlaceHolder Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.GenerelTabLabel}\">\r\n        <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.LabelFieldGroup}\">\r\n          <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.UserNameLabel}\"\r\n                   Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.UserNameHelp}\"\r\n                   Type=\"readonly\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"User.Username\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Type=\"Password\" Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.PasswordLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.PasswordHelp}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"NewPassword\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.NameLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.NameHelp}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"User.Name\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.EmailLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.EmailHelp}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"User.Email\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.GroupLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.GroupHelp}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"UserFormLogin.Folder\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <f:NullCheck>\r\n            <f:NullCheck.CheckValue>\r\n              <cms:read source=\"ActiveLocaleList\" />\r\n            </f:NullCheck.CheckValue>\r\n            <f:NullCheck.WhenNotNull>\r\n              <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.ActiveLocaleLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.ActiveLocaleHelp}\">\r\n                <KeySelector.Options>\r\n                  <cms:read source=\"ActiveLocaleList\"/>\r\n                </KeySelector.Options>\r\n                <KeySelector.Selected>\r\n                  <cms:bind source=\"ActiveLocaleName\" />\r\n                </KeySelector.Selected>\r\n              </KeySelector>\r\n            </f:NullCheck.WhenNotNull>\r\n          </f:NullCheck>\r\n          <CheckBox Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.IsLockedLabel}\" ItemLabel=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.IsLockedItemLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.IsLockedHelp}\">\r\n            <CheckBox.Checked>\r\n              <cms:bind source=\"UserFormLogin.IsLocked\" />\r\n            </CheckBox.Checked>\r\n          </CheckBox>\r\n        </FieldGroup>\r\n        <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.LabelLocalizationFieldGroup}\">\r\n          <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.CultureLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.CultureHelp}\">\r\n            <KeySelector.Options>\r\n              <cms:read source=\"AllCultures\"/>\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"CultureName\" />\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n          <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.C1ConsoleLanguageLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.C1ConsoleLanguageHelp}\">\r\n            <KeySelector.Options>\r\n              <cms:read source=\"C1ConsoleUiCultures\"/>\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"C1ConsoleUiLanguageName\" />\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n\r\n\r\n      <PlaceHolder Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.PermissionsTabLabel}\">\r\n      </PlaceHolder>\r\n\r\n      <PlaceHolder Label=\"${Composite.Management, Website.Forms.Administrative.EditUserStep1.PerspectivesTabLabel}\">\r\n      </PlaceHolder>\r\n\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditVisualFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Function\" type=\"Composite.Data.Types.IVisualFunction, Composite\" />\r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"XhtmlBody\" type=\"System.String\" />\r\n    <cms:binding name=\"EmbedableFieldsTypes\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"SourceTypeFullName\" type=\"System.String\" />\r\n    <cms:binding name=\"PreviewTemplateId\" type=\"System.Guid\" />\r\n    <cms:binding name=\"FieldNameList\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"TemplateList\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"functioncall\">\r\n    <TabPanels PreSelectedIndex=\"0\">\r\n      <TabPanels.Label>\r\n        <cms:read source=\"Function.Name\" />\r\n      </TabPanels.Label>\r\n      <PlaceHolder Label=\"${Composite.Plugins.VisualFunction, Edit.PlaceHolderLabel}\">\r\n        <Heading Title=\"${Composite.Plugins.VisualFunction, Edit.HeadingTitel}\">\r\n          <Heading.Description>\r\n            <cms:read source=\"SourceTypeFullName\" />\r\n          </Heading.Description>\r\n        </Heading>\r\n        <FieldGroup Label=\"${Composite.Plugins.VisualFunction, Edit.FieldGroupLabel}\">\r\n          <TextBox Label=\"${Composite.Plugins.VisualFunction, Edit.FunctionNameLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.FunctionNameHelp}\" Type=\"ProgrammingIdentifier\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"Function.Name\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Plugins.VisualFunction, Edit.FunctionNamespaceLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.FunctionNamespaceHelp}\" Type=\"ProgrammingNamespace\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"Function.Namespace\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextArea Label=\"${Composite.Plugins.VisualFunction, Edit.FunctionDescriptionLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.FunctionDescriptionHelp}\">\r\n            <TextArea.Text>\r\n              <cms:bind source=\"Function.Description\" />\r\n            </TextArea.Text>\r\n          </TextArea>\r\n          <TextBox Label=\"${Composite.Plugins.VisualFunction, Edit.ItemListLenghtLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.ItemListLenghtHelp}\" Type=\"integer\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"Function.MaximumItemsToList\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <KeySelector Label=\"${Composite.Plugins.VisualFunction, Edit.ItemSortingLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.ItemSortingHelp}\">\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"Function.OrderbyFieldName\" />\r\n            </KeySelector.Selected>\r\n            <KeySelector.Options>\r\n              <cms:read source=\"FieldNameList\" />\r\n            </KeySelector.Options>\r\n          </KeySelector>\r\n          <BoolSelector TrueLabel=\"${Composite.Plugins.VisualFunction, Edit.ListSortingTrueLabel}\" FalseLabel=\"${Composite.Plugins.VisualFunction, Edit.ListSortingFalseLabel}\" Label=\"${Composite.Plugins.VisualFunction, Edit.ListSortingLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.ListSortingHelp}\">\r\n            <cms:bind source=\"Function.OrderbyAscending\" />\r\n          </BoolSelector>\r\n          <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Plugins.VisualFunction, Edit.PreviewTemplateLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.PreviewTemplateHelp}\">\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"PreviewTemplateId\" />\r\n            </KeySelector.Selected>\r\n            <KeySelector.Options>\r\n              <cms:read source=\"TemplateList\" />\r\n            </KeySelector.Options>\r\n          </KeySelector>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      <XhtmlEditor Label=\"${Composite.Plugins.VisualFunction, Edit.WYSIWYGLayoutLabel}\">\r\n        <XhtmlEditor.EmbedableFieldsTypes>\r\n          <cms:read source=\"EmbedableFieldsTypes\" />\r\n        </XhtmlEditor.EmbedableFieldsTypes>\r\n        <cms:bind source=\"XhtmlBody\" />\r\n      </XhtmlEditor>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"PreviewEventHandler\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <internal:PreviewPanel Label=\"${Composite.Plugins.VisualFunction, Edit.LabelPreview}\">\r\n            <internal:PreviewPanel.ClickEventHandler>\r\n              <cms:read source=\"PreviewEventHandler\" />\r\n            </internal:PreviewPanel.ClickEventHandler>\r\n          </internal:PreviewPanel>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EditXsltFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CurrentXslt\" type=\"Composite.Data.Types.IXsltFunction, Composite\"/>\r\n    <cms:binding name=\"XslTemplate\" type=\"System.String\"/>\r\n    <cms:binding name=\"Parameters\" type=\"System.Collections.Generic.IEnumerable`1[[Composite.Functions.ManagedParameters.ManagedParameterDefinition, Composite]]\"/>\r\n    <cms:binding name=\"ParameterTypeOptions\" type=\"System.Collections.Generic.IEnumerable`1[[System.Type]]\"/>\r\n    <cms:binding name=\"FunctionCalls\" type=\"System.Collections.Generic.IEnumerable`1[[Composite.Functions.NamedFunctionCall, Composite]]\"/>\r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"false\"/>\r\n    <cms:binding name=\"PageId\" type=\"System.Guid\" optional=\"true\"/>\r\n    <cms:binding name=\"PageDataScopeName\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"PageDataScopeList\" type=\"System.Collections.IEnumerable\" optional=\"true\"/>\r\n    <cms:binding name=\"ActiveCultureName\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"ActiveCulturesList\" type=\"System.Collections.IEnumerable\" optional=\"true\"/>\r\n\r\n    <cms:binding name=\"SessionStateProvider\" type=\"System.String\" />\r\n    <cms:binding name=\"SessionStateId\" type=\"System.Guid\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"xslt-based-function\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"CurrentXslt.Name\"/>\r\n    </cms:layout.label>\r\n    <TabPanels PreSelectedIndex=\"3\">\r\n      <TabPanels.Label>\r\n        <cms:read source=\"CurrentXslt.Name\"/>\r\n      </TabPanels.Label>\r\n      <PlaceHolder Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelSettings}\">\r\n        <FieldGroup Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelSettings}\">\r\n          <TextBox Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelName}\" Help=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.HelpName}\" Type=\"ProgrammingIdentifier\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"CurrentXslt.Name\"/>\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelNamespace}\" Help=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.HelpNamespace}\" Type=\"ProgrammingNamespace\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"CurrentXslt.Namespace\"/>\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextArea Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelDescription}\" Help=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.HelpDescription}\">\r\n            <TextArea.Text>\r\n              <cms:bind source=\"CurrentXslt.Description\"/>\r\n            </TextArea.Text>\r\n          </TextArea>\r\n          <EnumSelector EnumType=\"Composite.Plugins.Functions.FunctionProviders.XsltBasedFunctionProvider.OutputXmlSubType\" Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.OutputType}\">\r\n            <EnumSelector.Selected>\r\n              <cms:bind source=\"CurrentXslt.OutputXmlSubType\"/>\r\n            </EnumSelector.Selected>\r\n          </EnumSelector>\r\n        </FieldGroup>\r\n        <FieldGroup Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelDebug}\">\r\n          <PageSelector Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelPage}\" Help=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.HelpPage}\">\r\n            <PageSelector.Selected>\r\n              <cms:bind source=\"PageId\"/>\r\n            </PageSelector.Selected>\r\n          </PageSelector>\r\n          <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelPageDataScope}\" Help=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.HelpPageDataScope}\">\r\n            <KeySelector.Options>\r\n              <cms:read source=\"PageDataScopeList\"/>\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"PageDataScopeName\"/>\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n          <f:NullCheck>\r\n            <f:NullCheck.CheckValue>\r\n              <cms:read source=\"ActiveCultureName\"/>\r\n            </f:NullCheck.CheckValue>\r\n            <f:NullCheck.WhenNotNull>\r\n              <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelActiveLocales}\" Help=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.HelpActiveLocales}\">\r\n                <KeySelector.Options>\r\n                  <cms:read source=\"ActiveCulturesList\"/>\r\n                </KeySelector.Options>\r\n                <KeySelector.Selected>\r\n                  <cms:bind source=\"ActiveCultureName\"/>\r\n                </KeySelector.Selected>\r\n              </KeySelector>\r\n            </f:NullCheck.WhenNotNull>\r\n          </f:NullCheck>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      <internal:ParameterDesigner Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelInputParameters}\">\r\n        <internal:ParameterDesigner.SessionStateProvider>\r\n          <cms:read source=\"SessionStateProvider\"/>\r\n        </internal:ParameterDesigner.SessionStateProvider>\r\n        <internal:ParameterDesigner.SessionStateId>\r\n          <cms:read source=\"SessionStateId\"/>\r\n        </internal:ParameterDesigner.SessionStateId>\r\n      </internal:ParameterDesigner>\r\n      <internal:FunctionCallsDesigner Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelFunctionCalls}\">\r\n        <internal:FunctionCallsDesigner.SessionStateProvider>\r\n          <cms:read source=\"SessionStateProvider\"/>\r\n        </internal:FunctionCallsDesigner.SessionStateProvider>\r\n        <internal:FunctionCallsDesigner.SessionStateId>\r\n          <cms:read source=\"SessionStateId\"/>\r\n        </internal:FunctionCallsDesigner.SessionStateId>\r\n      </internal:FunctionCallsDesigner>\r\n      <XsltEditor Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelTemplate}\">\r\n        <cms:bind source=\"XslTemplate\"/>\r\n      </XsltEditor>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"PreviewEventHandler\"/>\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <internal:PreviewPanel Label=\"${Composite.Plugins.XsltBasedFunction, EditXsltFunction.LabelPreview}\">\r\n            <internal:PreviewPanel.ClickEventHandler>\r\n              <cms:read source=\"PreviewEventHandler\"/>\r\n            </internal:PreviewPanel.ClickEventHandler>\r\n          </internal:PreviewPanel>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/ElementKeywordSearch.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SearchToken\" type=\"Composite.C1Console.Elements.SearchToken,Composite\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.ElementKeywordSearch.LabelFieldGroup}\">\r\n      <TextBox Label=\"${Composite.Management, Website.Forms.Administrative.ElementKeywordSearch.LabelKeyword}\" Help=\"${Composite.Management, Website.Forms.Administrative.ElementKeywordSearch.LabelSearchKeyword}\">\r\n        <cms:bind source=\"SearchToken.Keyword\" />\r\n      </TextBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EnableTypeLocalizationNoLocales.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" />\r\n    <cms:binding name=\"CultureNameList\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"generated-type-localize\" label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Dialog.Label}\">\r\n    <Heading\r\n\t\t\tTitle=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Abort.Title}\"\r\n\t\t\tDescription=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Abort.Description}\" />    \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EnableTypeLocalizationStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" />\r\n    <cms:binding name=\"CultureNameList\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"generated-type-localize\" label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Dialog.Label}\">\r\n    <FieldGroup Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Step1.FieldGroup.Label}\">\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" \r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Step1.CultureSelector.Label}\" \r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Step1.CultureSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CultureNameList\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CultureName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\t\t</FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EnableTypeLocalizationStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"CultureName\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"CultureNameList\" type=\"System.Collections.IEnumerable\" optional=\"true\" />\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"generated-type-localize\" label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Dialog.Label}\">\r\n    <Heading\r\n\t\t\tTitle=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Step2.Title}\"\r\n\t\t\tDescription=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Step2.Description}\" />    \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EnableTypeLocalizationStep3.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"generated-type-localize\" label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Dialog.Label}\">\r\n    <Heading\r\n\t\t\tTitle=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Step3.Title}\"\r\n\t\t\tDescription=\"${Composite.Plugins.GeneratedDataTypesElementProvider, EnableTypeLocalizationWorkflow.Step3.Description}\" />    \r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/EntityTokenLockedStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"LockedByUsername\" type=\"System.String\" />\r\n\t\t<cms:binding name=\"IsSameUser\" type=\"System.Boolean\" />\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"lock\" label=\"${Composite.EntityTokenLocked, LayoutLabel}\">\r\n\t\t<PlaceHolder>\r\n\r\n\t\t\t<f:BooleanCheck>\r\n\t\t\t\t<f:BooleanCheck.CheckValue>\r\n\t\t\t\t\t<cms:read source=\"IsSameUser\" />\r\n\t\t\t\t</f:BooleanCheck.CheckValue>\r\n\t\t\t\t\r\n\t\t\t\t<f:BooleanCheck.WhenTrue>\r\n\t\t\t\t\t<Heading Title=\"${Composite.EntityTokenLocked, SameUserHeading.Title}\"\r\n\t\t\t\t\t\t\t Description=\"${Composite.EntityTokenLocked, SameUserHeading.Description}\" />\r\n\t\t\t\t</f:BooleanCheck.WhenTrue>\r\n\r\n\t\t\t\t<f:BooleanCheck.WhenFalse>\r\n\t\t\t\t\t<PlaceHolder>\r\n\t\t\t\t\t\t<Heading Title=\"${Composite.EntityTokenLocked, AnotherUserHeading.Title}\"\r\n\t\t\t\t\t\t\t Description=\"${Composite.EntityTokenLocked, AnotherUserHeading.Description}\" />\r\n\t\t\t\t\t\t<FieldGroup Label=\"${Composite.EntityTokenLocked, LockedByUsername.FieldGroupLabel}\">\r\n\t\t\t\t\t\t\t<TextBox Type=\"ReadOnly\" \r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.EntityTokenLocked, LockedByUsername.Label}\" \r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.EntityTokenLocked, LockedByUsername.Help}\">\r\n\t\t\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t\t\t<cms:read source=\"LockedByUsername\" />\r\n\t\t\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t\t\t</TextBox>\r\n\t\t\t\t\t\t</FieldGroup>\r\n\t\t\t\t\t</PlaceHolder>\r\n\t\t\t\t</f:BooleanCheck.WhenFalse>\t\t\t\t\t\t\t\t\r\n\t\t\t</f:BooleanCheck>\r\n\t\t</PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/FunctionTesterEditFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"PageId\" type=\"System.Guid\" />\r\n    <cms:binding name=\"PageDataScopeName\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"PageDataScopeList\" type=\"System.Collections.IEnumerable\" optional=\"true\"/>\r\n    <cms:binding name=\"ActiveCultureName\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"ActiveCulturesList\" type=\"System.Collections.IEnumerable\" optional=\"true\"/>\r\n    \r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"true\" />    \r\n    \r\n    <cms:binding name=\"SessionStateProvider\" type=\"System.String\" />\r\n    <cms:binding name=\"SessionStateId\" type=\"System.Guid\" />\r\n    \r\n    <cms:binding name=\"LayoutLabel\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"functioncall\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"LayoutLabel\"/>\r\n    </cms:layout.label>\r\n    <TabPanels PreSelectedIndex=\"1\">\r\n\r\n      <PlaceHolder Label=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.Runtime.FieldGroup.Label}\">        \r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.DebugFieldGroup.Label}\">\r\n          <PageSelector Label=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.DebugPage.Label}\" Help=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.DebugPage.Help}\">\r\n            <PageSelector.Selected>\r\n              <cms:bind source=\"PageId\"/>\r\n            </PageSelector.Selected>\r\n          </PageSelector>\r\n          <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n                       Label=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.DebugPageDataScope.Label}\"\r\n                       Help=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.DebugPageDataScope.Help}\">\r\n            <KeySelector.Options>\r\n              <cms:read source=\"PageDataScopeList\"/>\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"PageDataScopeName\"/>\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n          <f:NullCheck>\r\n            <f:NullCheck.CheckValue>\r\n              <cms:read source=\"ActiveCultureName\"/>\r\n            </f:NullCheck.CheckValue>\r\n            <f:NullCheck.WhenNotNull>\r\n              <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n                           Label=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.DebugActiveLocale.Label}\"\r\n                           Help=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.DebugActiveLocale.Help}\">\r\n                <KeySelector.Options>\r\n                  <cms:read source=\"ActiveCulturesList\"/>\r\n                </KeySelector.Options>\r\n                <KeySelector.Selected>\r\n                  <cms:bind source=\"ActiveCultureName\"/>\r\n                </KeySelector.Selected>\r\n              </KeySelector>\r\n            </f:NullCheck.WhenNotNull>\r\n          </f:NullCheck>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      \r\n      <internal:FunctionCallsDesigner Label=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.FunctionCalls.Label}\">\r\n        <internal:FunctionCallsDesigner.SessionStateProvider>          \r\n          <cms:read source=\"SessionStateProvider\"/>\r\n        </internal:FunctionCallsDesigner.SessionStateProvider>\r\n        <internal:FunctionCallsDesigner.SessionStateId>\r\n          <cms:read source=\"SessionStateId\"/>\r\n        </internal:FunctionCallsDesigner.SessionStateId>\r\n      </internal:FunctionCallsDesigner>\r\n\r\n      <internal:PreviewPanel Label=\"${Composite.Plugins.AllFunctionsElementProvider, FunctionTesterWorkflow.Preview.Label}\">\r\n        <internal:PreviewPanel.ClickEventHandler>\r\n          <cms:read source=\"PreviewEventHandler\" />\r\n        </internal:PreviewPanel.ClickEventHandler>\r\n      </internal:PreviewPanel>\r\n          \r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/Hostnames.xml",
    "content": "<cms:formdefinition xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\">\n\t<cms:bindings>\n\t\t<cms:binding name=\"Id\" type=\"System.Guid\" optional=\"true\" />\n\t\t<cms:binding name=\"Hostname\" type=\"System.String\" optional=\"true\" />\n\t\t<cms:binding name=\"HomePageId\" type=\"System.Guid\" optional=\"true\" />\n\t\t<cms:binding name=\"Culture\" type=\"System.String\" optional=\"true\" />\n\t\t<cms:binding name=\"IncludeHomePageInUrl\" type=\"System.Boolean\" optional=\"true\" />\n\t\t<cms:binding name=\"IncludeCultureInUrl\" type=\"System.Boolean\" optional=\"true\" />\n\t\t<cms:binding name=\"PageNotFoundUrl\" type=\"System.String\" optional=\"true\" />\n\t\t<cms:binding name=\"Aliases\" type=\"System.String\" optional=\"true\" />\n\t\t<cms:binding name=\"EnforceHttps\" type=\"System.Boolean\" />\n\t\t<cms:binding name=\"UsePermanentRedirect\" type=\"System.Boolean\" />\n\t</cms:bindings>\n\t<cms:layout>\n\t\t<cms:layout.label>\n\t\t\t<f:NullCheck>\n\t\t\t\t<f:NullCheck.CheckValue>\n\t\t\t\t\t<cms:read source=\"Aliases\" />\n\t\t\t\t</f:NullCheck.CheckValue>\n\t\t\t\t<f:NullCheck.WhenNull>\n\t\t\t\t\t${Orckestra.Tools.UrlConfiguration, HostnameBinding.AddNewHostnameTitle}\n\t\t\t\t</f:NullCheck.WhenNull>\n\t\t\t\t<f:NullCheck.WhenNotNull>\n\t\t\t\t\t<cms:read source=\"Hostname\" />\n\t\t\t\t</f:NullCheck.WhenNotNull>\n\t\t\t</f:NullCheck>\n\t\t</cms:layout.label>\n\n\t\t<FieldGroup>\n\t\t\t<TextBox Label=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.Hostname.Label}\" Help=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.Hostname.Help}\" SpellCheck=\"false\">\n\t\t\t\t<TextBox.Text>\n\t\t\t\t\t<cms:bind source=\"Hostname\" />\n\t\t\t\t</TextBox.Text>\n\t\t\t</TextBox>\n\t\t\t<DoubleKeySelector Label=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.Page.Label}\" Help=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.Page.Help}\" Required=\"true\">\n\t\t\t\t<DoubleKeySelector.FirstKey>\n\t\t\t\t\t<cms:bind source=\"HomePageId\" />\n\t\t\t\t</DoubleKeySelector.FirstKey>\n\t\t\t\t<DoubleKeySelector.SecondKey>\n\t\t\t\t\t<cms:bind source=\"Culture\" />\n\t\t\t\t</DoubleKeySelector.SecondKey>\n\t\t\t\t<DoubleKeySelector.Options>\n\t\t\t\t\t<f:StaticMethodCall Type=\"Composite.Plugins.Routing.Hostnames.FormFunctions\" Method=\"GetRootPages\" />\n\t\t\t\t</DoubleKeySelector.Options>\n\t\t\t</DoubleKeySelector>\n\t\t\t<CheckBox Label=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.IncludeHomepageUrlTitle.Label}\" ItemLabel=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.IncludeHomepageUrlTitle.ItemLabel}\" Help=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.IncludeHomepageUrlTitle.Help}\">\n\t\t\t\t<CheckBox.Checked>\n\t\t\t\t\t<cms:bind source=\"IncludeHomePageInUrl\" />\n\t\t\t\t</CheckBox.Checked>\n\t\t\t</CheckBox>\n\t\t\t<CheckBox Label=\"\" ItemLabel=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.IncludeLanguageUrlMapping.ItemLabel}\" Help=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.IncludeLanguageUrlMapping.Help}\">\n\t\t\t\t<CheckBox.Checked>\n\t\t\t\t\t<cms:bind source=\"IncludeCultureInUrl\" />\n\t\t\t\t</CheckBox.Checked>\n\t\t\t</CheckBox>\n\t\t\t<CheckBox Label=\"\" ItemLabel=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.EnforceHttps.ItemLabel}\" Help=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.EnforceHttps.Help}\">\n\t\t\t\t<CheckBox.Checked>\n\t\t\t\t\t<cms:bind source=\"EnforceHttps\" />\n\t\t\t\t</CheckBox.Checked>\n\t\t\t</CheckBox>\n\t\t\t<UrlComboBox Label=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.Custom404Page.Label}\" Help=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.Custom404Page.Help}\" SpellCheck=\"false\">\n        <UrlComboBox.Text>\n\t\t\t\t\t<cms:bind source=\"PageNotFoundUrl\" />\n\t\t\t\t</UrlComboBox.Text>\n\t\t\t</UrlComboBox>\n\t\t\t<TextArea Label=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.Aliases.Label}\" Help=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.Aliases.Help}\" SpellCheck=\"false\">\n\t\t\t\t<TextArea.Text>\n\t\t\t\t\t<cms:bind source=\"Aliases\" />\n\t\t\t\t</TextArea.Text>\n\t\t\t</TextArea>\n\t\t\t<CheckBox Label=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.UsePermanentRedirect.Label}\" ItemLabel=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.UsePermanentRedirect.ItemLabel}\" Help=\"${Orckestra.Tools.UrlConfiguration, HostnameBinding.UsePermanentRedirect.Help}\">\n\t\t\t\t<CheckBox.Checked>\n\t\t\t\t\t<cms:bind source=\"UsePermanentRedirect\" />\n\t\t\t\t</CheckBox.Checked>\n\t\t\t</CheckBox>\n\t\t</FieldGroup>\n\t</cms:layout>\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/InlineFunctionAddFunctionStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewFunction\" type=\"Composite.Data.Types.IInlineFunction, Composite\" />\r\n    <cms:binding name=\"TemplateOptions\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"SelectedTemplate\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"functioncall\" label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.FieldGroup.Label}\">\r\n\r\n    <FieldGroup>\r\n\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.MethodName.Label}\"\r\n               Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.MethodName.Help}\" Type=\"ProgrammingIdentifier\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewFunction.Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n      <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.MethodNamespace.Label}\"\r\n               Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.MethodNamespace.Help}\" Type=\"ProgrammingNamespace\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewFunction.Namespace\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n\r\n      <TextArea Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.MethodDescription.Label}\"\r\n                Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.MethodDescription.Help}\">\r\n        <TextArea.Text>\r\n          <cms:bind source=\"NewFunction.Description\" />\r\n        </TextArea.Text>\r\n      </TextArea>\r\n\r\n      <KeySelector Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.InlineFunctionMethodTemplate.Label}\"\r\n                   Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, AddInlineFunctionWorkflow.InlineFunctionMethodTemplate.Help}\"\r\n                   OptionsKeyField=\"Key\" OptionsLabelField=\"Value\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"TemplateOptions\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedTemplate\"/>\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n    </FieldGroup>\r\n\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/InlineFunctionDeleteFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, DeleteFunction.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, DeleteFunction.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/InlineFunctionEditFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Function\" type=\"Composite.Data.Types.IInlineFunction, Composite\" />\r\n    \r\n    <cms:binding name=\"PageId\" type=\"System.Guid\" />\r\n    <cms:binding name=\"PageDataScopeName\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"PageDataScopeList\" type=\"System.Collections.IEnumerable\" optional=\"true\"/>\r\n    <cms:binding name=\"ActiveCultureName\" type=\"System.String\" optional=\"true\"/>\r\n    <cms:binding name=\"ActiveCulturesList\" type=\"System.Collections.IEnumerable\" optional=\"true\"/>\r\n    \r\n    <cms:binding name=\"FunctionCode\" type=\"System.String\" />\r\n    <cms:binding name=\"Assemblies\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"SelectedAssemblies\" type=\"System.Collections.IEnumerable\" />\r\n    \r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    \r\n    <cms:binding name=\"SessionStateProvider\" type=\"System.String\" />\r\n    <cms:binding name=\"SessionStateId\" type=\"System.Guid\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <cms:layout.label>\r\n      <cms:read source=\"Function.Name\" />\r\n      \r\n    </cms:layout.label>\r\n\r\n    <TabPanels PreSelectedIndex=\"1\">\r\n\r\n      <PlaceHolder Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.FieldGroup.Label}\">\r\n        <FieldGroup Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.FieldGroup.Label}\">\r\n          <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.MethodName.Label}\"\r\n                   Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.MethodName.Help}\" Type=\"ProgrammingIdentifier\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"Function.Name\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n\r\n          <TextBox Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.MethodNamespace.Label}\"\r\n                   Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.MethodNamespace.Help}\" Type=\"ProgrammingNamespace\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"Function.Namespace\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n\r\n          <TextArea Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.MethodDescription.Label}\"\r\n                 Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.MethodDescription.Help}\">\r\n            <TextArea.Text>\r\n              <cms:bind source=\"Function.Description\" />\r\n            </TextArea.Text>\r\n          </TextArea>\r\n          \r\n        </FieldGroup>\r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.DebugFieldGroup.Label}\">\r\n          <PageSelector Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.DebugPage.Label}\" Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.DebugPage.Help}\">\r\n            <PageSelector.Selected>\r\n              <cms:bind source=\"PageId\"/>\r\n            </PageSelector.Selected>\r\n          </PageSelector>\r\n          <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n                       Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.DebugPageDataScope.Label}\"\r\n                       Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.DebugPageDataScope.Help}\">\r\n            <KeySelector.Options>\r\n              <cms:read source=\"PageDataScopeList\"/>\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"PageDataScopeName\"/>\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n          <f:NullCheck>\r\n            <f:NullCheck.CheckValue>\r\n              <cms:read source=\"ActiveCultureName\"/>\r\n            </f:NullCheck.CheckValue>\r\n            <f:NullCheck.WhenNotNull>\r\n              <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n                           Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.DebugActiveLocale.Label}\"\r\n                           Help=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.DebugActiveLocale.Help}\">\r\n                <KeySelector.Options>\r\n                  <cms:read source=\"ActiveCulturesList\"/>\r\n                </KeySelector.Options>\r\n                <KeySelector.Selected>\r\n                  <cms:bind source=\"ActiveCultureName\"/>\r\n                </KeySelector.Selected>\r\n              </KeySelector>\r\n            </f:NullCheck.WhenNotNull>\r\n          </f:NullCheck>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n\r\n\r\n      <TextEditor Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.Code.Label}\" MimeType=\"text/x-csharp\">        \r\n        <cms:bind source=\"FunctionCode\" />      \r\n      </TextEditor>\r\n\r\n\r\n      <FieldGroup Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.AssembliesFieldGroup.Label}\">\r\n        \r\n        <MultiKeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" CompactMode=\"true\">\r\n          <MultiKeySelector.Options>\r\n            <cms:read source=\"Assemblies\"/>\r\n          </MultiKeySelector.Options>\r\n          <MultiKeySelector.Selected>\r\n            <cms:bind source=\"SelectedAssemblies\"/>\r\n          </MultiKeySelector.Selected>\r\n        </MultiKeySelector>\r\n      </FieldGroup>\r\n\r\n      <internal:ParameterDesigner Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.ParameterFieldGroup.Label}\">\r\n        <internal:ParameterDesigner.SessionStateProvider>\r\n          <cms:read source=\"SessionStateProvider\"/>\r\n        </internal:ParameterDesigner.SessionStateProvider>\r\n        <internal:ParameterDesigner.SessionStateId>\r\n          <cms:read source=\"SessionStateId\"/>\r\n        </internal:ParameterDesigner.SessionStateId>\r\n      </internal:ParameterDesigner>\r\n\r\n\r\n      <internal:PreviewPanel Label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditInlineFunctionWorkflow.Preview.Label}\">\r\n        <internal:PreviewPanel.ClickEventHandler>\r\n          <cms:read source=\"PreviewEventHandler\" />\r\n        </internal:PreviewPanel.ClickEventHandler>\r\n      </internal:PreviewPanel>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/LocalizeData.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ErrorHeader\" type=\"System.Object\" />\r\n    <cms:binding name=\"Errors\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generated-type-data-localize\" label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, LocalizeDataWorkflow.ShowError.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <InfoBox Label=\"${Composite.Plugins.GeneratedDataTypesElementProvider, LocalizeDataWorkflow.ShowError.InfoTableCaption}\">\r\n        <InfoTable>\r\n          <InfoTable.Headers>\r\n            <cms:read source=\"ErrorHeader\" />\r\n          </InfoTable.Headers>\r\n          <InfoTable.Rows>\r\n            <cms:read source=\"Errors\" />\r\n          </InfoTable.Rows>\r\n        </InfoTable>\r\n      </InfoBox>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/MethodBasedFunctionProviderElementProviderDeleteStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, DeleteFunction.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Plugins.MethodBasedFunctionProviderElementProvider, DeleteFunction.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderAddPackageSourceStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Url\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-add-source\" label=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step1.LayoutLabel}\">\r\n    <FieldGroup Label=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step1.FieldGroupLabel}\">\r\n      <TextBox Label=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step1.UrlLabel}\"\r\n               Help=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step1.UrlHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Url\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderAddPackageSourceStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Url\" type=\"System.String\" />\r\n    <cms:binding name=\"HttpOnly\" type=\"System.Boolean\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-add-source\" label=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step2.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"HttpOnly\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n          <Heading\r\n            Title=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step2.HeadingTitle}\"\r\n            Description=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step2.HeadingNoHttpsDescription}\" />\r\n        </f:BooleanCheck.WhenTrue>\r\n        <f:BooleanCheck.WhenFalse>\r\n          <Heading\r\n            Title=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step2.HeadingTitle}\"\r\n            Description=\"${Composite.Plugins.PackageElementProvider, AddPackageSource.Step2.HeadingWithHttpsDescription}\" />\r\n        </f:BooleanCheck.WhenFalse>\r\n      </f:BooleanCheck>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderConfirmLicense.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n\r\n  <cms:layout label=\"${Composite.Plugins.PackageElementProvider, ConfirmLicense.ExpiredTitle}\">\r\n    <Text Text=\"${Composite.Plugins.PackageElementProvider, ConfirmLicense.ExpiredMessage}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderDeletePackageSourceStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.PackageElementProvider, DeletePackageSource.Step1.LayoutLabel}\">\r\n    <Text Text=\"${Composite.Plugins.PackageElementProvider, DeletePackageSource.Step1.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallLocalPackageShowError.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ErrorHeader\" type=\"System.Object\" />\r\n    <cms:binding name=\"Errors\" type=\"System.Object\" />\r\n    <cms:binding name=\"LayoutLabel\" type=\"System.String\" />\r\n    <cms:binding name=\"TableCaption\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  \r\n  <cms:layout iconhandle=\"package-installer-install\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"LayoutLabel\"/>\r\n    </cms:layout.label>\r\n    <PlaceHolder>\r\n      <InfoBox>\r\n        <InfoBox.Label>\r\n          <cms:read source=\"TableCaption\"/>\r\n        </InfoBox.Label>\r\n        <InfoTable>\r\n          <InfoTable.Headers>\r\n            <cms:read source=\"ErrorHeader\" />\r\n          </InfoTable.Headers>\r\n          <InfoTable.Rows>\r\n            <cms:read source=\"Errors\" />\r\n          </InfoTable.Rows>\r\n        </InfoTable>\r\n      </InfoBox>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallLocalPackageStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UploadedFile\" type=\"Composite.C1Console.Forms.CoreUiControls.UploadedFile, Composite\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-installer-install\" label=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step1.LayoutLabel}\">\r\n    <FieldGroup>\r\n      <FileUpload\r\n          Label=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step1.FileUploadLabel}\"\r\n          Help=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step1.FileUploadHelp}\">\r\n        <FileUpload.UploadedFile>\r\n          <cms:bind source=\"UploadedFile\" />\r\n        </FileUpload.UploadedFile>\r\n      </FileUpload>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallLocalPackageStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-installer-install\" label=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step2.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <Heading \r\n        Title=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step2.HeadingTitle}\"\r\n        Description=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step2.HeadingDescription}\" />\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallLocalPackageStep3.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-installer-install\" label=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step3.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <Heading \r\n        Title=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step3.HeadingTitle}\"\r\n        Description=\"${Composite.Plugins.PackageElementProvider, InstallLocalPackage.Step3.HeadingDescription}\" />\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallRemotePackageShowError.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ErrorHeader\" type=\"System.Object\" />\r\n    <cms:binding name=\"Errors\" type=\"System.Object\" />\r\n    <cms:binding name=\"LayoutLabel\" type=\"System.String\" />\r\n    <cms:binding name=\"TableCaption\" type=\"System.String\" />\r\n  </cms:bindings>\r\n \r\n  <cms:layout iconhandle=\"package-install-package\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"LayoutLabel\"/>\r\n    </cms:layout.label>\r\n    <PlaceHolder>      \r\n      <InfoBox>\r\n        <InfoBox.Label>\r\n          <cms:read source=\"TableCaption\"/>\r\n        </InfoBox.Label>\r\n        <InfoTable>\r\n          <InfoTable.Headers>\r\n            <cms:read source=\"ErrorHeader\" />\r\n          </InfoTable.Headers>\r\n          <InfoTable.Rows>\r\n            <cms:read source=\"Errors\" />\r\n          </InfoTable.Rows>\r\n        </InfoTable>\r\n      </InfoBox>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallRemotePackageStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-install-package\" label=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step1.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <Heading \r\n        Title=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step1.HeadingTitle}\"\r\n        Description=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step1.HeadingDescription}\" />\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallRemotePackageStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"EulaText\" type=\"System.String\" />\r\n    <cms:binding name=\"EulaAccepted\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-install-package\" label=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step2.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      \r\n      <Heading Title=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step2.HeadingTitle}\"\r\n               Description=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step2.HeadingDescription}\">\r\n      </Heading>\r\n\r\n      <LongText>\r\n        <cms:read source=\"EulaText\" />\r\n      </LongText>\r\n\r\n      <CheckBox ItemLabel=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step2.IAcceptItemLabel}\">\r\n        <CheckBox.Checked>\r\n          <cms:bind source=\"EulaAccepted\"/>\r\n        </CheckBox.Checked>\r\n      </CheckBox>\r\n\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallRemotePackageStep3.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-install-package\" label=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step3.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <Heading \r\n        Title=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step3.HeadingTitle}\"\r\n        Description=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step3.HeadingDescription}\" />\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallRemotePackageStep4.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Uninstallable\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-install-package\" label=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step4.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"Uninstallable\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n          <Heading\r\n            Title=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step4.NonUninstallableHeadingTitle}\"\r\n            Description=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step4.NonUninstallableHeadingDescription}\" />\r\n        </f:BooleanCheck.WhenTrue>\r\n        <f:BooleanCheck.WhenFalse>\r\n          <Heading\r\n            Title=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step4.HeadingTitle}\"\r\n            Description=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step4.HeadingDescription}\" />\r\n        </f:BooleanCheck.WhenFalse>\r\n      </f:BooleanCheck>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderInstallRemotePackageStep5.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-installer-install\" label=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step5.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <Heading \r\n        Title=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step5.HeadingTitle}\"\r\n        Description=\"${Composite.Plugins.PackageElementProvider, InstallRemotePackage.Step5.HeadingDescription}\" />\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallLocalPackageShowError.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ErrorHeader\" type=\"System.Object\" />\r\n    <cms:binding name=\"Errors\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-uninstall-local-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.ShowError.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <InfoBox Label=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.ShowError.InfoTableCaption}\">\r\n        <InfoTable>\r\n          <InfoTable.Headers>\r\n            <cms:read source=\"ErrorHeader\" />\r\n          </InfoTable.Headers>\r\n          <InfoTable.Rows>\r\n            <cms:read source=\"Errors\" />\r\n          </InfoTable.Rows>\r\n        </InfoTable>\r\n      </InfoBox>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallLocalPackageStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-uninstall-local-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step1.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <Heading \r\n        Title=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step1.HeadingTitle}\"\r\n        Description=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step1.HeadingDescription}\" />\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallLocalPackageStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"package-uninstall-local-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step2.LayoutLabel}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Heading\r\n\t\t\t  Title=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step2.HeadingTitle}\"\r\n\t\t\t  Description=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step2.HeadingDescription}\" />\r\n\t\t</PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallLocalPackageStep3.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"package-uninstall-local-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step3.LayoutLabel}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Heading\r\n\t\t\t  Title=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step3.HeadingTitle}\"\r\n\t\t\t  Description=\"${Composite.Plugins.PackageElementProvider, UninstallLocalPackage.Step3.HeadingDescription}\" />\r\n\t\t</PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallRemotePackageShowError.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ErrorHeader\" type=\"System.Object\" />\r\n    <cms:binding name=\"Errors\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-uninstall-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.ShowError.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <InfoBox Label=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.ShowError.InfoTableCaption}\">\r\n        <InfoTable>\r\n          <InfoTable.Headers>\r\n            <cms:read source=\"ErrorHeader\" />\r\n          </InfoTable.Headers>\r\n          <InfoTable.Rows>\r\n            <cms:read source=\"Errors\" />\r\n          </InfoTable.Rows>\r\n        </InfoTable>\r\n      </InfoBox>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallRemotePackageShowUnregistreError.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"package-uninstall-local-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.ShowUnregistre.LayoutLabel}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Heading\r\n\t\t\t  Title=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.ShowUnregistre.HeadingTitle}\"\r\n\t\t\t  Description=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.ShowUnregistre.HeadingDescription}\" />\r\n\t\t</PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallRemotePackageStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-uninstall-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step1.LayoutLabel}\">\r\n    <PlaceHolder>\r\n      <Heading \r\n        Title=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step1.HeadingTitle}\"\r\n        Description=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step1.HeadingDescription}\" />\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallRemotePackageStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"package-uninstall-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step2.LayoutLabel}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Heading\r\n\t\t\t  Title=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step2.HeadingTitle}\"\r\n\t\t\t  Description=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step2.HeadingDescription}\" />\r\n\t\t</PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderUninstallRemotePackageStep3.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"package-uninstall-package\" label=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step3.LayoutLabel}\">\r\n\t\t<PlaceHolder>\r\n\t\t\t<Heading\r\n\t\t\t  Title=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step3.HeadingTitle}\"\r\n\t\t\t  Description=\"${Composite.Plugins.PackageElementProvider, UninstallRemotePackage.Step3.HeadingDescription}\" />\r\n\t\t</PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderViewAvailablePackageInformation.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"DocumentTitle\" type=\"System.String\" />\r\n    <cms:binding name=\"PackageDescription\" type=\"Composite.Core.PackageSystem.PackageDescription\" />\r\n    <cms:binding name=\"AddOnServerSource\" type=\"System.String\" />\r\n    <cms:binding name=\"HasOwnPrice\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"PriceText\" type=\"System.String\" />\r\n    <cms:binding name=\"IsInPurchasableSubscriptions\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"PurchasableSubscriptions\" type=\"System.String\" />\r\n\r\n\t\t<cms:binding name=\"ShowTrialInfo\" type=\"System.Boolean\" />\r\n\t\t<cms:binding name=\"ShowSubscriptionLicense\" type=\"System.Boolean\" />\r\n\t\t<cms:binding name=\"SubscriptionName\" type=\"System.String\" />\r\n\t\t<cms:binding name=\"LicenseExpirationDate\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-view-availableinfo\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"DocumentTitle\" />\r\n    </cms:layout.label>\r\n\r\n    <TabPanels PreSelectedIndex=\"0\">\r\n      <TabPanels.Label>\r\n        <cms:read source=\"PackageDescription.Name\"/>\r\n      </TabPanels.Label>\r\n\r\n      <PlaceHolder Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.FieldGroupLabel}\">\r\n\r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.FieldGroupLabel}\">\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.NameTextLabel}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"PackageDescription.Name\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n\r\n          <TextArea Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.DescriptionTextLabel}\">\r\n            <TextArea.Text>\r\n              <cms:read source=\"PackageDescription.Description\" />\r\n            </TextArea.Text>\r\n          </TextArea>\r\n\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.AuthorTextLabel}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"PackageDescription.Vendor\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </FieldGroup>\r\n\r\n\r\n        <f:BooleanCheck>\r\n          <f:BooleanCheck.CheckValue>\r\n            <cms:read source=\"ShowTrialInfo\" />\r\n          </f:BooleanCheck.CheckValue>\r\n          <f:BooleanCheck.WhenTrue>\r\n\r\n            <FieldGroup Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.TrialInfoFieldGroupLabel}\">\r\n              <TextArea Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.TrialInformationLabel}\" Text=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.TrialInformationText}\" />\r\n              <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.TrialDaysLabel}\">\r\n                <TextBox.Text>\r\n                  <cms:read source=\"PackageDescription.TrialPeriodDays\" />\r\n                </TextBox.Text>\r\n              </TextBox>\r\n\r\n              <f:BooleanCheck>\r\n                <f:BooleanCheck.CheckValue>\r\n                  <cms:read source=\"HasOwnPrice\" />\r\n                </f:BooleanCheck.CheckValue>\r\n                <f:BooleanCheck.WhenTrue>\r\n                  <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.PriceTextLabel}\">\r\n                    <TextBox.Text>\r\n                      <cms:read source=\"PriceText\" />\r\n                    </TextBox.Text>\r\n                  </TextBox>\r\n                </f:BooleanCheck.WhenTrue>\r\n              </f:BooleanCheck>\r\n\r\n              <f:BooleanCheck>\r\n                <f:BooleanCheck.CheckValue>\r\n                  <cms:read source=\"IsInPurchasableSubscriptions\" />\r\n                </f:BooleanCheck.CheckValue>\r\n                <f:BooleanCheck.WhenTrue>\r\n                  <TextArea Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.SubscriptionListLabel}\">\r\n                    <TextArea.Text>\r\n                      <cms:read source=\"PurchasableSubscriptions\" />\r\n                    </TextArea.Text>\r\n                  </TextArea>\r\n                </f:BooleanCheck.WhenTrue>\r\n              </f:BooleanCheck>\r\n\r\n            </FieldGroup>\r\n          </f:BooleanCheck.WhenTrue>\r\n        </f:BooleanCheck>\r\n\r\n\t\t\t\t<f:BooleanCheck>\r\n\t\t\t\t\t<f:BooleanCheck.CheckValue>\r\n\t\t\t\t\t\t<cms:read source=\"ShowSubscriptionLicense\" />\r\n\t\t\t\t\t</f:BooleanCheck.CheckValue>\r\n\t\t\t\t\t<f:BooleanCheck.WhenTrue>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<FieldGroup Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.LicenseInformationGroupLabel}\">\r\n\r\n\t\t\t\t\t\t\t<TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.SubscriptionNameLabel}\">\r\n\t\t\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t\t\t<cms:read source=\"SubscriptionName\" />\r\n\t\t\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t\t\t</TextBox>\r\n\r\n\t\t\t\t\t\t\t<TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.LicenseExpirationDateLabel}\">\r\n\t\t\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t\t\t<cms:read source=\"LicenseExpirationDate\" />\r\n\t\t\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t\t\t</TextBox>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</FieldGroup>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</f:BooleanCheck.WhenTrue>\r\n\t\t\t\t</f:BooleanCheck>\r\n\t\t\t\t\r\n\t\t\t</PlaceHolder>\r\n\r\n      <PlaceHolder Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.InstallationInfoFieldGroupLabel}\">\r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.InstallationInfoFieldGroupLabel}\">\r\n\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.VersionTextLabel}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"PackageDescription.PackageVersion\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n\r\n          <TextArea Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.TechicalDescriptionTextLabel}\">\r\n            <TextArea.Text>\r\n              <cms:read source=\"PackageDescription.TechicalDetails\" />\r\n            </TextArea.Text>\r\n          </TextArea>\r\n\r\n          <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.PackageSourceTextLabel}\">\r\n            <TextBox.Text>\r\n              <cms:read source=\"AddOnServerSource\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n        </FieldGroup>\r\n\r\n      </PlaceHolder>\r\n\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderViewAvailablePackageInformationToolbar.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"CustomEvent01Handler\" type=\"System.EventHandler\" />\r\n\t\t<cms:binding name=\"PackageDescription\" type=\"Composite.Core.PackageSystem.PackageDescription\" />\r\n\t</cms:bindings>\r\n\t<cms:layout>\r\n\t\t<PlaceHolder>\r\n\t\t\t<ToolbarButton Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.Toolbar.InstallLabel}\" IconHandle=\"package-install-package\">\r\n\t\t\t\t<ToolbarButton.ClickEventHandler>\r\n\t\t\t\t\t<cms:read source=\"CustomEvent01Handler\" />\r\n\t\t\t\t</ToolbarButton.ClickEventHandler>\r\n\t\t\t</ToolbarButton>\r\n\r\n\t\t\t<ToolbarButton Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.Toolbar.ReadMoreLabel}\" IconHandle=\"package-installer-readmore\">\r\n\t\t\t\t<ToolbarButton.LaunchUrl>\r\n\t\t\t\t\t<cms:read source=\"PackageDescription.ReadMoreUrl\" />\r\n\t\t\t\t</ToolbarButton.LaunchUrl>\r\n\t\t\t</ToolbarButton>\r\n\t\t\t\r\n\t\t</PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderViewInstalledPackageInformation.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"DocumentTitle\" type=\"System.String\" />\r\n    <cms:binding name=\"InstalledPackageInformation\" type=\"Composite.Core.PackageSystem.InstalledPackageInformation\" />\r\n    <cms:binding name=\"InstallDate\" type=\"System.String\" />\r\n    <cms:binding name=\"IsTrial\" type=\"System.Boolean\" />\r\n\t\t<cms:binding name=\"IsSubscription\" type=\"System.Boolean\"  />\r\n\t\t<cms:binding name=\"SubscriptionName\" type=\"System.String\" optional=\"true\" />\r\n\t\t<cms:binding name=\"LicenseExpirationDate\" type=\"System.String\" optional=\"true\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"package-view-installedinfo\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"DocumentTitle\" />\r\n    </cms:layout.label>\r\n    <PlaceHolder>\r\n\r\n\r\n      <FieldGroup Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.FieldGroupLabel}\">\r\n        <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.NameTextLabel}\">\r\n          <TextBox.Text>\r\n            <cms:read source=\"InstalledPackageInformation.Name\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n        <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.VersionTextLabel}\">\r\n          <TextBox.Text>\r\n            <cms:read source=\"InstalledPackageInformation.Version\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n        <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.AuthorTextLabel}\">\r\n          <TextBox.Text>\r\n            <cms:read source=\"InstalledPackageInformation.Author\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n        <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.DateTextLabel}\">\r\n          <TextBox.Text>\r\n            <cms:read source=\"InstallDate\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n        <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.UserTextLabel}\">\r\n          <TextBox.Text>\r\n            <cms:read source=\"InstalledPackageInformation.InstalledBy\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n      </FieldGroup>\r\n      \r\n      \r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"IsTrial\" />\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n\r\n          <FieldGroup Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.TrialInfoFieldGroupLabel}\">\r\n            <TextArea Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.TrialInformationLabel}\" Text=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.TrialInformationText}\" />\r\n            <TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.TrialExpireLabel}\">\r\n              <TextBox.Text>\r\n                <cms:read source=\"LicenseExpirationDate\" />\r\n              </TextBox.Text>\r\n            </TextBox>\r\n          </FieldGroup>\r\n        </f:BooleanCheck.WhenTrue>\r\n      </f:BooleanCheck>\r\n\r\n\t\t\t<f:BooleanCheck>\r\n\t\t\t\t<f:BooleanCheck.CheckValue>\r\n\t\t\t\t\t<cms:read source=\"IsSubscription\" />\r\n\t\t\t\t</f:BooleanCheck.CheckValue>\r\n\t\t\t\t<f:BooleanCheck.WhenTrue>\r\n\t\t\t\t\t<FieldGroup Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.LicenseInformationGroupLabel}\">\r\n\t\t\t\t\t\t<TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.SubscriptionNameLabel}\">\r\n\t\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t\t<cms:read source=\"SubscriptionName\" />\r\n\t\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t\t</TextBox>\r\n\t\t\t\t\t\t<TextBox Type=\"ReadOnly\" Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.LicenseExpirationDateLabel}\">\r\n\t\t\t\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t\t\t\t<cms:read source=\"LicenseExpirationDate\" />\r\n\t\t\t\t\t\t\t</TextBox.Text>\r\n\t\t\t\t\t\t</TextBox>\r\n\t\t\t\t\t</FieldGroup>\r\n\t\t\t\t</f:BooleanCheck.WhenTrue>\r\n\t\t\t</f:BooleanCheck>\r\n\r\n\t\t</PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PackageElementProviderViewInstalledPackageInformationToolbar.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"CustomEvent01Handler\" type=\"System.EventHandler\" />\r\n    <cms:binding name=\"ShowPurchaseThisButton\" type=\"System.Boolean\" />\r\n    <cms:binding name=\"TrialPurchaseUrl\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"ReadMoreUrl\" type=\"System.String\" optional=\"true\" />\r\n  </cms:bindings>\r\n\t<cms:layout>\r\n\t\t<PlaceHolder>\r\n\t\t\t<ToolbarButton Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.Toolbar.UninstallLabel}\" IconHandle=\"package-installer-uninstall\">\r\n\t\t\t\t<ToolbarButton.ClickEventHandler>\r\n\t\t\t\t\t<cms:read source=\"CustomEvent01Handler\" />\r\n\t\t\t\t</ToolbarButton.ClickEventHandler>\r\n\t\t\t</ToolbarButton>\r\n\r\n      <f:BooleanCheck>\r\n        <f:BooleanCheck.CheckValue>\r\n          <cms:read source=\"ShowPurchaseThisButton\"/>\r\n        </f:BooleanCheck.CheckValue>\r\n        <f:BooleanCheck.WhenTrue>\r\n          <ToolbarButton Label=\"${Composite.Plugins.PackageElementProvider, ViewInstalledInformation.Toolbar.PurchaseLabel}\" IconHandle=\"cart\">\r\n            <ToolbarButton.LaunchUrl>\r\n              <cms:read source=\"TrialPurchaseUrl\" />\r\n            </ToolbarButton.LaunchUrl>\r\n          </ToolbarButton>\r\n        </f:BooleanCheck.WhenTrue>\r\n      </f:BooleanCheck>\r\n\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"ReadMoreUrl\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <ToolbarButton Label=\"${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.Toolbar.ReadMoreLabel}\" IconHandle=\"package-installer-readmore\">\r\n            <ToolbarButton.LaunchUrl>\r\n              <cms:read source=\"ReadMoreUrl\" />\r\n            </ToolbarButton.LaunchUrl>\r\n          </ToolbarButton>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </PlaceHolder>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplate/AddNewMasterPagePageTemplate.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Title\" type=\"System.String\" />\r\n    <cms:binding name=\"CopyOfOptions\" type=\"System.Object\" />\r\n    <cms:binding name=\"CopyOfId\" type=\"System.Guid\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generic-add\" label=\"${Composite.Plugins.MasterPagePageTemplate, AddNewMasterPagePageTemplate.LabelDialog}\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.MasterPagePageTemplate, AddNewMasterPagePageTemplate.LabelTemplateTitle}\" Help=\"${Composite.Plugins.MasterPagePageTemplate, AddNewMasterPagePageTemplate.LabelTemplateTitleHelp}\" Required=\"true\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Title\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Plugins.MasterPagePageTemplate, AddNewMasterPagePageTemplate.LabelCopyFromHelp}\" Label=\"${Composite.Plugins.MasterPagePageTemplate, AddNewMasterPagePageTemplate.LabelCopyFrom}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CopyOfId\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CopyOfOptions\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplate/AddNewPageTemplate.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"TemplateTypeOptions\" type=\"System.Object\" />\r\n    <cms:binding name=\"TemplateTypeId\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generic-add\" label=\"${Composite.Plugins.PageTemplateElementProvider, AddNewPageTemplate.LabelDialog}\">\r\n    <FieldGroup>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Plugins.PageTemplateElementProvider, AddNewPageTemplate.TemplateTypeHelp}\" Label=\"${Composite.Plugins.PageTemplateElementProvider, AddNewPageTemplate.TemplateTypeLabel}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"TemplateTypeId\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"TemplateTypeOptions\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplate/AddNewRazorPageTemplate.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Title\" type=\"System.String\" />\r\n    <cms:binding name=\"CopyOfOptions\" type=\"System.Object\" />\r\n    <cms:binding name=\"CopyOfId\" type=\"System.Guid\" />\r\n    \r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generic-add\" label=\"${Composite.Plugins.RazorPageTemplate, AddNewRazorPageTemplate.LabelDialog}\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.RazorPageTemplate, AddNewRazorPageTemplate.LabelTemplateTitle}\" Help=\"${Composite.Plugins.RazorPageTemplate, AddNewRazorPageTemplate.LabelTemplateTitleHelp}\" Required=\"true\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Title\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Plugins.RazorPageTemplate, AddNewRazorPageTemplate.LabelCopyFromHelp}\" Label=\"${Composite.Plugins.RazorPageTemplate, AddNewRazorPageTemplate.LabelCopyFrom}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CopyOfId\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CopyOfOptions\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplate/AddNewXmlPageTemplate.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewPageTemplate\" type=\"Composite.Data.Types.IXmlPageTemplate\" />\r\n    <cms:binding name=\"CopyOfOptions\" type=\"System.Object\" />\r\n    <cms:binding name=\"CopyOfId\" type=\"System.Guid\" />\r\n    \r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"generic-add\" label=\"${Composite.Plugins.PageTemplateElementProvider, AddNewXmlPageTemplate.LabelDialog}\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.PageTemplateElementProvider, AddNewXmlPageTemplate.LabelTemplateTitle}\" Help=\"${Composite.Plugins.PageTemplateElementProvider, AddNewXmlPageTemplate.LabelTemplateTitleHelp}\" Required=\"true\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewPageTemplate.Title\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Help=\"${Composite.Plugins.PageTemplateElementProvider, AddNewXmlPageTemplate.LabelCopyFromHelp}\" Label=\"${Composite.Plugins.PageTemplateElementProvider, AddNewXmlPageTemplate.LabelCopyFrom}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CopyOfId\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"CopyOfOptions\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplate/EditMasterPage.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"TemplateTitle\" type=\"System.String\" />\r\n    \r\n    <cms:binding name=\"File1Content\" type=\"System.String\" />\r\n    <cms:binding name=\"File1Name\" type=\"System.String\" />\r\n    <cms:binding name=\"File1MimeType\" type=\"System.String\" />\r\n\r\n    <cms:binding name=\"File2Content\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"File2Name\" type=\"System.String\" optional=\"true\" />\r\n    <cms:binding name=\"File2MimeType\" type=\"System.String\" optional=\"true\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-template-edit\">\r\n    <TabPanels>\r\n      <TabPanels.Label>\r\n        <cms:read source=\"TemplateTitle\" />\r\n      </TabPanels.Label>\r\n      \r\n      <TextEditor>\r\n        <TextEditor.MimeType>\r\n          <cms:read source=\"File1MimeType\" />\r\n        </TextEditor.MimeType>\r\n        <TextEditor.Label>\r\n          <cms:read source=\"File1Name\" />\r\n        </TextEditor.Label>\r\n        <cms:bind source=\"File1Content\" />\r\n      </TextEditor>\r\n\r\n\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"File2Content\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n\r\n          <TextEditor>\r\n            <TextEditor.MimeType>\r\n              <cms:read source=\"File2MimeType\" />\r\n            </TextEditor.MimeType>\r\n            <TextEditor.Label>\r\n              <cms:read source=\"File2Name\" />\r\n            </TextEditor.Label>\r\n            <cms:bind source=\"File2Content\" />\r\n          </TextEditor>\r\n          \r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n      \r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplate/EditRazorTemplate.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FileContent\" type=\"System.String\" />\r\n    <cms:binding name=\"FileName\" type=\"System.String\" />\r\n    <cms:binding name=\"FileMimeType\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-template-edit\">\r\n    <TextEditor>\r\n      <TextEditor.MimeType>\r\n        <cms:read source=\"FileMimeType\" />\r\n      </TextEditor.MimeType>\r\n      <TextEditor.Label>\r\n        <cms:read source=\"FileName\" />\r\n      </TextEditor.Label>\r\n      <cms:bind source=\"FileContent\" />\r\n    </TextEditor>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplate/EditXmlPageTemplate.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"PageTemplate\" type=\"Composite.Data.Types.IXmlPageTemplate\" />\r\n    <cms:binding name=\"PageTemplateMarkup\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-template-edit\">\r\n    <TabPanels PreSelectedIndex=\"1\">\r\n      <FieldGroup Label=\"${Composite.Plugins.PageTemplateElementProvider, EditXmlPageTemplate.LabelTemplateIdentification}\">\r\n        <TextBox Label=\"${Composite.Plugins.PageTemplateElementProvider, EditXmlPageTemplate.LabelTemplateTitle}\" Help=\"${Composite.Plugins.PageTemplateElementProvider, EditXmlPageTemplate.LabelTemplateTitleHelp}\">\r\n          <TextBox.Text>\r\n            <cms:bind source=\"PageTemplate.Title\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n      </FieldGroup>\r\n      <TabPanels.Label>\r\n        <cms:read source=\"PageTemplate.Title\" />\r\n      </TabPanels.Label>\r\n      <MarkupEditor Label=\"${Composite.Plugins.PageTemplateElementProvider, EditXmlPageTemplate.LabelMarkUpCode}\">\r\n        <cms:bind source=\"PageTemplateMarkup\" />\r\n      </MarkupEditor>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplateFeature/Add.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Name\" type=\"System.String\" />\r\n    <cms:binding name=\"EditorType\" type=\"System.String\" />\r\n    <cms:binding name=\"EditorTypeOptions\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.PageTemplateFeatureElementProvider, AddWorkflow.LabelDialog}\" iconhandle=\"page-template-feature-add\">\r\n    <FieldGroup>\r\n\r\n      <TextBox Label=\"${Composite.Plugins.PageTemplateFeatureElementProvider, AddWorkflow.LabelTemplateFeatureName}\" Help=\"${Composite.Plugins.PageTemplateFeatureElementProvider, AddWorkflow.LabelTemplateFeatureNameHelp}\" Required=\"true\" SpellCheck=\"false\">\r\n        <cms:bind source=\"Name\" />\r\n      </TextBox>\r\n\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.Plugins.PageTemplateFeatureElementProvider, AddWorkflow.LabelTemplateFeatureEditorType}\"\r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.Plugins.PageTemplateFeatureElementProvider, AddWorkflow.LabelTemplateFeatureEditorTypeHelp}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"EditorTypeOptions\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"EditorType\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplateFeature/Delete.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.PageTemplateFeatureElementProvider, DeleteWorkflow.Title}\"  iconhandle=\"page-template-feature-delete\">\r\n    <Text Text=\"${Composite.Plugins.PageTemplateFeatureElementProvider, DeleteWorkflow.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplateFeature/EditMarkup.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FeatureName\" type=\"System.String\"/>\r\n    <cms:binding name=\"Markup\" type=\"System.String\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-template-feature-edit\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"FeatureName\" />\r\n    </cms:layout.label>\r\n    <MarkupEditor Label=\"Edit\">\r\n      <cms:bind source=\"Markup\" />\r\n    </MarkupEditor>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTemplateFeature/EditVisual.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FeatureName\" type=\"System.String\"/>\r\n    <cms:binding name=\"Markup\" type=\"System.String\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-template-feature-edit\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"FeatureName\" />\r\n    </cms:layout.label>\r\n    <XhtmlEditor Label=\"Edit\">\r\n      <cms:bind source=\"Markup\" />\r\n    </XhtmlEditor>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeAddPageType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewPageType\" type=\"Composite.Data.Types.IPageType\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"pagetype-add-pagetype\" label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddNewPageTypeWorkflow.Layout.Label}\">\r\n    <FieldGroup>\r\n\r\n      <TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddNewPageTypeWorkflow.NameTextBox.Label}\"\r\n               Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddNewPageTypeWorkflow.NameTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewPageType.Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n\r\n      <TextArea Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddNewPageTypeWorkflow.DescriptionTextArea.Label}\"\r\n                Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddNewPageTypeWorkflow.DescriptionTextArea.Help}\">\r\n        <TextArea.Text>\r\n          <cms:bind source=\"NewPageType.Description\" />\r\n        </TextArea.Text>\r\n      </TextArea>\r\n\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeAddPageTypeDefaultPageContent.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"DefaultPageContent\" type=\"Composite.Data.Types.IPageTypeDefaultPageContent\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"pagetype-add-pagetypedefaultpagecontent\" label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeDefaultPageContentWorkflow.Layout.Label}\">\r\n    <FieldGroup >\r\n\r\n      <TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Label}\"\r\n               Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"DefaultPageContent.PlaceHolderId\" />\r\n        </TextBox.Text>\r\n      </TextBox>    \r\n\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeAddPageTypeMetaDataFieldStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewMetaDataTypeLink\" type=\"Composite.Data.Types.IPageTypeMetaDataTypeLink\"/>\r\n    <cms:binding name=\"CompositionDescriptionName\" type=\"System.String\"/>\r\n    <cms:binding name=\"CompositionDescriptionLabel\" type=\"System.String\"/>\r\n    <cms:binding name=\"CompositionContainerId\" type=\"System.Guid\"/>\r\n    <cms:binding name=\"MetaDataTypeOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"MetaDataContainerOptions\" type=\"System.Collections.IEnumerable\"/>    \r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"pagetype-add-metedatafield\" label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.Layout.Label}\">\r\n    <FieldGroup Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.FieldGroup.Label}\">\r\n\r\n\t   <KeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataTypeKeySelector.Label}\"\r\n                       Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataTypeKeySelector.Help}\"\r\n                       OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n        <KeySelector.Options>\r\n          <cms:read source=\"MetaDataTypeOptions\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"NewMetaDataTypeLink.DataTypeId\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n      <TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.NameTextBox.Label}\"\r\n               Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.NameTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CompositionDescriptionName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n\r\n      <TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.LabelTextBox.Label}\"\r\n               Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.LabelTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CompositionDescriptionLabel\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n      <KeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Label}\"\r\n                       Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Help}\"\r\n                       OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n        <KeySelector.Options>\r\n          <cms:read source=\"MetaDataContainerOptions\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CompositionContainerId\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n      \r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeDeletePageTypeConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"MessageText\" type=\"System.String\" />\r\n  </cms:bindings>  \r\n  <cms:layout label=\"${Composite.Plugins.PageTypeElementProvider, PageType.DeletePageTypeWorkflow.Confirm.Layout.Label}\">\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"MessageText\"/>\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeDeletePageTypeMetaDataFieldConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"MessageText\" type=\"System.String\" />\r\n  </cms:bindings>  \r\n  <cms:layout label=\"${Composite.Plugins.PageTypeElementProvider, PageType.DeletePageTypeMetaDataFieldWorkflow.Confirm.Layout.Label}\">\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"MessageText\"/>\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeDeletePageTypePagesRefering.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"MessageText\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.PageTypeElementProvider, PageType.DeletePageTypeWorkflow.PagesRefering.Layout.Label}\">\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"MessageText\"/>\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeEditPageType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"PageType\" type=\"Composite.Data.Types.IPageType\"/>\r\n    <cms:binding name=\"DefaultChildPageTypeOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"HomepageRelationOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"DefaultTemplateOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"TemplateRestrictionOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"TemplateRestrictionSelected\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"PageTypeChildRestrictionOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"PageTypeChildRestrictionSelected\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"DataFolderOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"DataFolderSelected\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"ApplicationOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"ApplicationSelected\" type=\"System.Collections.IEnumerable\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"pagetype-edit-pagetype\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"PageType.Name\"/>\r\n    </cms:layout.label>\r\n\r\n\r\n    <TabPanels PreSelectedIndex=\"0\">\r\n      <TabPanels.Label>\r\n        <cms:read source=\"PageType.Name\"/>\r\n      </TabPanels.Label>\r\n\r\n      <PlaceHolder Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.SettingsPlaceHolder.Label}\">\r\n        <FieldGroup Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.SettingsFieldGroup.Label}\">\r\n\r\n          <TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.NameTextBox.Label}\"\r\n                   Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.NameTextBox.Help}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"PageType.Name\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n\r\n          <TextArea Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DescriptionTextArea.Label}\"\r\n                    Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DescriptionTextArea.Help}\">\r\n            <TextArea.Text>\r\n              <cms:bind source=\"PageType.Description\" />\r\n            </TextArea.Text>\r\n          </TextArea>\r\n\r\n          <CheckBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.AvailableCheckBox.Label}\"\r\n                    Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.AvailableCheckBox.Help}\">\r\n            <CheckBox.Checked>\r\n              <cms:bind source=\"PageType.Available\" />\r\n            </CheckBox.Checked>\r\n          </CheckBox>\r\n\r\n          <CheckBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.PresetMenuTitleCheckBox.Label}\"\r\n                    Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.PresetMenuTitleCheckBox.Help}\">\r\n            <CheckBox.Checked>\r\n              <cms:bind source=\"PageType.PresetMenuTitle\" />\r\n            </CheckBox.Checked>\r\n          </CheckBox>\r\n\r\n          <KeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.Label}\"\r\n                       Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.Help}\"\r\n                       OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n            <KeySelector.Options>\r\n              <cms:read source=\"DefaultChildPageTypeOptions\" />\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"PageType.DefaultChildPageType\" />\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n          \r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n\r\n      \r\n      <PlaceHolder Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DataFolderApplicationPlaceHolder.Label}\">\r\n        <FieldGroup Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DataFolderFieldGroup.Label}\">          \r\n          <MultiKeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DataFolderMultiKeySelector.Label}\"\r\n                            Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DataFolderMultiKeySelector.Help}\"\r\n                            OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n            <MultiKeySelector.Options>\r\n              <cms:read source=\"DataFolderOptions\" />\r\n            </MultiKeySelector.Options>\r\n            <MultiKeySelector.Selected>\r\n              <cms:bind source=\"DataFolderSelected\" />\r\n            </MultiKeySelector.Selected>\r\n          </MultiKeySelector>          \r\n        </FieldGroup>\r\n\r\n        <FieldGroup Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.ApplicationFieldGroup.Label}\">\r\n          <MultiKeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.ApplicationMultiKeySelector.Label}\"\r\n                            Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.ApplicationMultiKeySelector.Help}\"\r\n                            OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n            <MultiKeySelector.Options>\r\n              <cms:read source=\"ApplicationOptions\" />\r\n            </MultiKeySelector.Options>\r\n            <MultiKeySelector.Selected>\r\n              <cms:bind source=\"ApplicationSelected\" />\r\n            </MultiKeySelector.Selected>\r\n          </MultiKeySelector>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      \r\n      \r\n      <PlaceHolder Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.PageTemplatePlaceHolder.Label}\">\r\n        <FieldGroup Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.PageTemplateRestrictionFieldGroup.Label}\">\r\n\r\n          <KeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.Label}\"\r\n                       Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.Help}\"\r\n                       OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n            <KeySelector.Options>\r\n              <cms:read source=\"DefaultTemplateOptions\" />\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"PageType.DefaultTemplateId\" />\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n          \r\n          <MultiKeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.PageTemplateRestrictionMultiKeySelector.Label}\"\r\n                            Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.PageTemplateRestrictionMultiKeySelector.Help}\" \r\n                            OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n            <MultiKeySelector.Options>\r\n              <cms:read source=\"TemplateRestrictionOptions\" />\r\n            </MultiKeySelector.Options>\r\n            <MultiKeySelector.Selected>\r\n              <cms:bind source=\"TemplateRestrictionSelected\" />\r\n            </MultiKeySelector.Selected>\r\n          </MultiKeySelector>\r\n\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n\r\n      <PlaceHolder Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.AvailabilityPlaceHolder.Label}\">\r\n        <FieldGroup Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.AvailabilityFieldGroup.Label}\">\r\n          \r\n          <KeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.Label}\"\r\n                       Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.Help}\"\r\n                       OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n            <KeySelector.Options>\r\n              <cms:read source=\"HomepageRelationOptions\" />\r\n            </KeySelector.Options>\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"PageType.HomepageRelation\" />\r\n            </KeySelector.Selected>\r\n          </KeySelector>\r\n\r\n          <MultiKeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.PageTypeChildRestrictionMultiKeySelector.Label}\"\r\n                            Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeWorkflow.PageTypeChildRestrictionMultiKeySelector.Help}\"\r\n                            OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n            <MultiKeySelector.Options>\r\n              <cms:read source=\"PageTypeChildRestrictionOptions\" />\r\n            </MultiKeySelector.Options>\r\n            <MultiKeySelector.Selected>\r\n              <cms:bind source=\"PageTypeChildRestrictionSelected\" />\r\n            </MultiKeySelector.Selected>\r\n          </MultiKeySelector>\r\n          \r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      \r\n    </TabPanels>\r\n\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeEditPageTypeDefaultPageContent.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"DefaultPageContent\" type=\"Composite.Data.Types.IPageTypeDefaultPageContent\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"pagetype-edit-pagetypedefaultpagecontent\" label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeDefaultPageContentWorkflow.Layout.Label}\">\r\n\r\n    <TabPanels PreSelectedIndex=\"1\">\r\n      <TabPanels.Label>\r\n        <cms:read source=\"DefaultPageContent.PlaceHolderId\" />\r\n      </TabPanels.Label>\r\n\r\n      <PlaceHolder Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeDefaultPageContentWorkflow.SettingsPlaceHolder.Label}\">\r\n        <FieldGroup Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeDefaultPageContentWorkflow.SettingsFieldGroup.Label}\">\r\n\r\n          <TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Label}\"\r\n                   Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Help}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"DefaultPageContent.PlaceHolderId\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderContainerClassesTextBox.Label}\"\r\n                   Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderContainerClassesTextBox.Help}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"DefaultPageContent.ContainerClasses\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n\r\n      <XhtmlEditor Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeDefaultPageContentWorkflow.ContentXhtmlEditor.Label}\">\r\n        <cms:bind source=\"DefaultPageContent.Content\" />\r\n      </XhtmlEditor>      \r\n      \r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/PageTypeEditPageTypeMetaDataField.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <!--<cms:binding name=\"CompositionDescriptionName\" type=\"System.String\"/>-->\r\n    <cms:binding name=\"CompositionDescriptionLabel\" type=\"System.String\"/>\r\n    <cms:binding name=\"CompositionContainerId\" type=\"System.Guid\"/>\r\n    <cms:binding name=\"MetaDataContainerOptions\" type=\"System.Collections.IEnumerable\"/>\r\n    <cms:binding name=\"MetaTypeName\" type=\"System.String\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"pagetype-edit-metedatafield\" label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.Layout.Label}\">\r\n    <FieldGroup Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.FieldGroup.Label}\">\r\n\r\n      <!--<TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.NameTextBox.Label}\"\r\n               Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.NameTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CompositionDescriptionName\" />\r\n        </TextBox.Text>\r\n      </TextBox>-->\r\n\r\n\r\n      <TextBox Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.LabelTextBox.Label}\"\r\n               Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.LabelTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"CompositionDescriptionLabel\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n      \r\n      <KeySelector Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Label}\"\r\n                       Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Help}\"\r\n                       OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" >\r\n        <KeySelector.Options>\r\n          <cms:read source=\"MetaDataContainerOptions\" />\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"CompositionContainerId\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n      <TextBox Type=\"ReadOnly\"\r\n               Label=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.MetaTypeName.Label}\"\r\n               Help=\"${Composite.Plugins.PageTypeElementProvider, PageType.EditPageTypeMetaDataFieldWorkflow.MetaTypeName.Help}\">\r\n        <TextBox.Text>\r\n          <cms:read source=\"MetaTypeName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/RemoveAssociatedTypeFinalInfo.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FinalAssociationInterfaceType\" type=\"System.String\" />\r\n    <cms:binding name=\"FinalCompositionDescriptionName\" type=\"System.String\" optional=\"true\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"dataassociation-remove-association\">\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedType.FieldGroupLabel}\">\r\n      <Text Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedTypeFinalInfo.AssociationTypeLabel}\">\r\n        <Text.Text>\r\n          <cms:read source=\"FinalAssociationInterfaceType\" />\r\n        </Text.Text>\r\n      </Text>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"FinalCompositionDescriptionName\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <Text Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedTypeFinalInfo.CompositionScopeRuleNameLabel}\">\r\n            <Text.Text>\r\n              <cms:read source=\"FinalCompositionDescriptionName\" />\r\n            </Text.Text>\r\n          </Text>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/RemoveAssociatedTypeSelectAssociationType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedAssociationType\" type=\"System.String\" />\r\n    <cms:binding name=\"AssociationTypes\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedType.FieldGroupLabel}\">\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedTypeSelectAssociationType.KeySelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedTypeSelectAssociationType.KeySelectorHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedAssociationType\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"AssociationTypes\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/RemoveAssociatedTypeSelectRuleName.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedDescriptionName\" type=\"System.String\" />\r\n    <cms:binding name=\"DescriptionNames\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedType.FieldGroupLabel}\">\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedTypeSelectRuleName.KeySelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedTypeSelectRuleName.KeySelectorHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedDescriptionName\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"DescriptionNames\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/RemoveAssociatedTypeSelectType.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedType\" type=\"System.Type\" />\r\n    <cms:binding name=\"Types\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedType.FieldGroupLabel}\">\r\n      <TypeSelector Label=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedTypeSelectType.TypeSelectorLabel}\" Help=\"${Composite.Management, Website.Forms.Administrative.RemoveAssociatedTypeSelectType.TypeSelectorHelp}\">\r\n        <TypeSelector.TypeOptions>\r\n          <cms:read source=\"Types\" />\r\n        </TypeSelector.TypeOptions>\r\n        <TypeSelector.SelectedType>\r\n          <cms:bind source=\"SelectedType\" />\r\n        </TypeSelector.SelectedType>\r\n      </TypeSelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/RemovePageHostNameBindings.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ExistingHostNames\" type=\"System.Collections.Generic.List`1[[System.String]]\" />\r\n    <cms:binding name=\"HostNamesToRemove\" type=\"System.Collections.Generic.List`1[[System.String]]\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"page-manage-host-names\" label=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Remove.DialogLabel}\">\r\n    <PlaceHolder>\r\n      <FieldGroup Label=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Remove.FieldGroupLabel}\">\r\n        <MultiKeySelector Label=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Remove.MultiSelectorLabel}\" Help=\"${Composite.Plugins.PageElementProvider,ManageHostNames.Remove.MultiSelectorHelp}\">\r\n          <MultiKeySelector.Options>\r\n            <cms:read source=\"ExistingHostNames\" />\r\n          </MultiKeySelector.Options>\r\n          <MultiKeySelector.Selected>\r\n            <cms:bind source=\"HostNamesToRemove\" />\r\n          </MultiKeySelector.Selected>\r\n        </MultiKeySelector>\r\n      </FieldGroup>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/RemoveSystemLocaleAbort.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"localization-removesystemlocale\" label=\"${Composite.Plugins.LocalizationElementProvider, RemoveSystemLocaleWorkflow.Abort.Title}\">\r\n\t\t<Text Text=\"${Composite.Plugins.LocalizationElementProvider, RemoveSystemLocaleWorkflow.Abort.Description}\" />\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/RemoveSystemLocaleStep2.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t</cms:bindings>\r\n\t<cms:layout iconhandle=\"localization-removesystemlocale\" label=\"${Composite.Plugins.LocalizationElementProvider, RemoveSystemLocaleWorkflow.Dialog.Label}\">\r\n\t\t<Text Text=\"${Composite.Plugins.LocalizationElementProvider, RemoveSystemLocaleWorkflow.Confirm.Description}\" />\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/ReportFunctionAction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" xmlns:fun=\"http://www.composite.net/ns/function/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Icon\" type=\"System.String\"/>\r\n    <cms:binding name=\"Label\" type=\"System.String\"/>\r\n    <cms:binding name=\"HtmlBlob\" type=\"System.String\"/>\r\n\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <cms:layout.iconhandle>\r\n      <cms:read source=\"Icon\" />\r\n    </cms:layout.iconhandle>\r\n    <cms:layout.label>\r\n      <cms:read source=\"Label\" />\r\n    </cms:layout.label>\r\n    <PlaceHolder>\r\n      <HtmlBlob>\r\n        <cms:read source=\"HtmlBlob\" />\r\n      </HtmlBlob>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n\r\n\r\n<!--<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"TreeDefinitionMarkup\" type=\"System.String\"/>\r\n    <cms:binding name=\"SamplesMarkup\" type=\"System.String\"/>\r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"false\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"xslt-based-function\" label=\"Demo edit\">\r\n    <TabPanels PreSelectedIndex=\"0\" Label=\"Edit.......\">\r\n\r\n      <TextEditor Label=\"Edit\" MimeType=\"xml\">\r\n        <cms:bind source=\"TreeDefinitionMarkup\" />\r\n      </TextEditor>\r\n\r\n      <TextEditor Label=\"Samples\" MimeType=\"xml\">\r\n        <cms:bind source=\"SamplesMarkup\" />\r\n      </TextEditor>\r\n\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"PreviewEventHandler\"/>\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <internal:PreviewPanel Label=\"Preview\">\r\n            <internal:PreviewPanel.ClickEventHandler>\r\n              <cms:read source=\"PreviewEventHandler\"/>\r\n            </internal:PreviewPanel.ClickEventHandler>\r\n          </internal:PreviewPanel>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>-->"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/SecurityViolationStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"warning\" label=\"${Composite.C1Console.SecurityViolation, LayoutLabel}\">\r\n    <PlaceHolder>\r\n\r\n\r\n      <Heading Title=\"${Composite.C1Console.SecurityViolation, Title}\"\r\n           Description=\"${Composite.C1Console.SecurityViolation, Description}\" />\r\n\r\n\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/SendMessageToConsoles_EnterMessage.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Title\" type=\"System.String\"/>\r\n    <cms:binding name=\"Message\" type=\"System.String\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"balloon\" label=\"${Composite.Management, SendMessageToConsolesWorkflow.Layout.Label}\">\r\n    <FieldGroup>\r\n\r\n      <TextBox Label=\"${Composite.Management, SendMessageToConsolesWorkflow.TitleTextBox.Label}\"\r\n               Help=\"${Composite.Management, SendMessageToConsolesWorkflow.TitleTextBox.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Title\"/>\r\n        </TextBox.Text>\r\n      </TextBox>\r\n\r\n\r\n      <TextArea Label=\"${Composite.Management, SendMessageToConsolesWorkflow.MessageTextArea.Label}\"\r\n                Help=\"${Composite.Management, SendMessageToConsolesWorkflow.MessageTextArea.Help}\">\r\n        <TextArea.Text>\r\n          <cms:bind source=\"Message\"/>\r\n        </TextArea.Text>\r\n      </TextArea>\r\n\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/SetTimeZone_select.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"TimeZonesSelected\" type=\"System.String\" />\r\n    <cms:binding name=\"TimeZones\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"balloon\" label=\"${Composite.Management, SetTimezoneWorkflow.Layout.Label}\">\r\n    <FieldGroup>\r\n\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, SetTimezoneWorkflow.TitleTextBox.Label}\"\r\n               Help=\"${Composite.Management, SetTimezoneWorkflow.TitleTextBox.Help}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"TimeZonesSelected\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"TimeZones\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n      <Text Text=\"${Composite.Management, SetTimezoneWorkflow.WarningText.Text}\"/>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/SqlFunctionElementProviderDeleteSqlConnection.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.SqlFunction, DeleteSqlConnection.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Plugins.SqlFunction, DeleteSqlConnection.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/SqlFunctionElementProviderDeleteSqlFunction.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.SqlFunction, DeleteSqlFunction.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Plugins.SqlFunction, DeleteSqlFunction.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeAddApplication.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedTreeId\" type=\"System.String\" />\r\n    <cms:binding name=\"SelectableTreeIds\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"SelectedPosition\" type=\"System.String\" />\r\n    <cms:binding name=\"SelectablePositions\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.C1Console.Trees, AddApplication.Layout.Label}\" iconhandle=\"tree-add-application\">\r\n    <FieldGroup Label=\"${Composite.C1Console.Trees, AddApplication.FieldGroup.Label}\">\r\n\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.C1Console.Trees, AddApplication.TreeIdSelector.Label}\"\r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.C1Console.Trees, AddApplication.TreeIdSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"SelectableTreeIds\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedTreeId\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.C1Console.Trees, AddApplication.PositionSelector.Label}\"\r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.C1Console.Trees, AddApplication.PositionSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"SelectablePositions\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedPosition\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>\r\n\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeAddTreeDefinition.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"DefinitionName\" type=\"System.String\" />\r\n    <cms:binding name=\"TemplateName\" type=\"System.String\" />\r\n    <cms:binding name=\"TemplatesList\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"PositionName\" type=\"System.String\" />\r\n    <cms:binding name=\"PositionsList\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.C1Console.Trees, TreeAddTreeDefinition.Layout.Label}\" iconhandle=\"developerapplication-treedefinition-add\">\r\n    <FieldGroup Label=\"${Composite.C1Console.Trees, TreeAddTreeDefinition.FieldGroup.Label}\">\r\n      <TextBox Label=\"${Composite.C1Console.Trees, TreeAddTreeDefinition.NameTextBox.Label}\" Help=\"${Composite.C1Console.Trees, TreeAddTreeDefinition.NameTextBox.Help}\">\r\n        <cms:bind source=\"DefinitionName\" />\r\n      </TextBox>      \r\n      \r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.C1Console.Trees, TreeAddTreeDefinition.TemplateSelector.Label}\"\r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.C1Console.Trees, TreeAddTreeDefinition.TemplateSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"TemplatesList\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"TemplateName\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>    \r\n\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.C1Console.Trees, TreeAddTreeDefinition.PositionSelector.Label}\"\r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.C1Console.Trees, TreeAddTreeDefinition.PositionSelector.Help}\">\r\n      <KeySelector.Options>\r\n        <cms:read source=\"PositionsList\"/>\r\n      </KeySelector.Options>\r\n      <KeySelector.Selected>\r\n        <cms:bind source=\"PositionName\" />\r\n      </KeySelector.Selected>\r\n    </KeySelector>\r\n      \r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeConfirmActionConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Label\" type=\"System.String\" />\r\n    <cms:binding name=\"Message\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <cms:layout.label>\r\n      <cms:read source=\"Label\"/>\r\n    </cms:layout.label>\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"Message\"/>\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeDeleteTreeDefinition.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.C1Console.Trees, TreeDeleteTreeDefinition.Layout.Label}\"  iconhandle=\"developerapplication-treedefinition-delete\">\r\n    <Heading\r\n       Title=\"${Composite.C1Console.Trees, TreeDeleteTreeDefinition.Title}\"\r\n       Description=\"${Composite.C1Console.Trees, TreeDeleteTreeDefinition.Description}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeEditDefinition.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"TreeId\" type=\"System.String\"/>\r\n    <cms:binding name=\"TreeDefinitionMarkup\" type=\"System.String\"/>\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"developerapplication-treedefinition-edit\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"TreeId\" />\r\n    </cms:layout.label>\r\n    <MarkupEditor Label=\"Edit\">\r\n      <cms:bind source=\"TreeDefinitionMarkup\" />\r\n    </MarkupEditor>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeGenericDeleteConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Text\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.C1Console.Trees, TreeGenericDeleteConfirm.LabelFieldGroup}\">\r\n    <!--Text=\"${Composite.C1Console.Trees, TreeGenericDeleteConfirm.Text}\"-->\r\n    <Text>\r\n      <Text.Text>\r\n        <cms:read source=\"Text\" />\r\n      </Text.Text>\r\n    </Text>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeGenericDeleteConfirmDeletingRelatedData.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ReferencedData\" type=\"System.String\" optional=\"true\"/>\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.C1Console.Trees, TreeGenericDeleteConfirmDeletingRelatedData.LabelFieldGroup}\">\r\n    <PlaceHolder>\r\n      <Text Text=\"${Composite.C1Console.Trees, TreeGenericDeleteConfirmDeletingRelatedData.ConfirmationText}\" />\r\n      <Text Text=\"\r\n\t\t\t\t\t\t\r\n\" />\r\n      <Text>\r\n        <Text.Text>\r\n          <cms:read source=\"ReferencedData\" />\r\n        </Text.Text>\r\n      </Text>\r\n    </PlaceHolder>\r\n\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeLocalizeData.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"ErrorHeader\" type=\"System.Object\" />\r\n    <cms:binding name=\"Errors\" type=\"System.Object\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"tree-localize-data\" label=\"${Composite.C1Console.Trees, LocalizeData.ShowError.Layout.Label}\">\r\n    <PlaceHolder>\r\n      <InfoBox Label=\"${Composite.C1Console.Trees, LocalizeData.ShowError.InfoTable.Caption}\">\r\n        <InfoTable>\r\n          <InfoTable.Headers>\r\n            <cms:read source=\"ErrorHeader\" />\r\n          </InfoTable.Headers>\r\n          <InfoTable.Rows>\r\n            <cms:read source=\"Errors\" />\r\n          </InfoTable.Rows>\r\n        </InfoTable>\r\n      </InfoBox>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/TreeRemoveApplication.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"SelectedTreeId\" type=\"System.String\" />\r\n    <cms:binding name=\"SelectableTreeIds\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.C1Console.Trees, RemoveApplication.Layout.Label}\" iconhandle=\"tree-remove-application\">\r\n    <FieldGroup Label=\"${Composite.C1Console.Trees, RemoveApplication.FieldGroup.Label}\">\r\n\r\n      <KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\"\r\n\t\t\t\t\t\t\t\t\t Label=\"${Composite.C1Console.Trees, RemoveApplication.TreeIdSelector.Label}\"\r\n\t\t\t\t\t\t\t\t\t Help=\"${Composite.C1Console.Trees, RemoveApplication.TreeIdSelector.Help}\">\r\n        <KeySelector.Options>\r\n          <cms:read source=\"SelectableTreeIds\"/>\r\n        </KeySelector.Options>\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedTreeId\" />\r\n        </KeySelector.Selected>\r\n      </KeySelector>      \r\n\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/UploadMediaFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UploadedFile\" type=\"Composite.C1Console.Forms.CoreUiControls.UploadedFile, Composite\" />\r\n    <cms:binding name=\"NextEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"media-add-media-file\" label=\"${Composite.Management, Website.Forms.Administrative.UploadMediaFile.LabelFieldGroup}\">\r\n    <FieldGroup>\r\n      <FileUpload Label=\"${Composite.Management, Website.Forms.Administrative.UploadMediaFile.LabelFile}\" Help=\"${Composite.Management, Website.Forms.Administrative.UploadMediaFile.HelpFile}\">\r\n        <FileUpload.UploadedFile>\r\n          <cms:bind source=\"UploadedFile\" />\r\n        </FileUpload.UploadedFile>\r\n      </FileUpload>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/UploadNewMediaFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UploadedFile\" type=\"Composite.C1Console.Forms.CoreUiControls.UploadedFile, Composite\" />\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"media-add-media-file\" label=\"${Composite.Management, Website.Forms.Administrative.UploadNewMediaFile.LabelFieldGroup}\">\r\n    <FieldGroup>\r\n      <FileUpload Label=\"${Composite.Management, Website.Forms.Administrative.UploadNewMediaFile.LabelFile}\" Help=\"${Composite.Management, Website.Forms.Administrative.UploadNewMediaFile.HelpFile}\">\r\n        <FileUpload.UploadedFile>\r\n          <cms:bind source=\"UploadedFile\" />\r\n        </FileUpload.UploadedFile>\r\n      </FileUpload>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/UrlConfiguration.xml",
    "content": "﻿<cms:formdefinition xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\">\n\t<cms:bindings>\n\t\t<cms:binding name=\"PageUrlSuffix\" type=\"System.String\" optional=\"true\" />\n\t</cms:bindings>\n\t<cms:layout label=\"${Orckestra.Tools.UrlConfiguration, UrlConfiguration.Title}\">\n\t\t<FieldGroup>\n\t\t\t<TextBox Label=\"${Orckestra.Tools.UrlConfiguration, UrlConfiguration.PageUrlSuffix.Label}\" Help=\"${Orckestra.Tools.UrlConfiguration, UrlConfiguration.PageUrlSuffix.Help}\" SpellCheck=\"false\">\n\t\t\t\t<TextBox.Text>\n\t\t\t\t\t<cms:bind source=\"PageUrlSuffix\" />\n\t\t\t\t</TextBox.Text>\n\t\t\t</TextBox>\n\t\t</FieldGroup>\n\t</cms:layout>\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/UserGroupElementProviderAddNewUserGroupStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"NewUserGroup\" type=\"Composite.Data.Types.IUserGroup\" />\r\n  </cms:bindings>\r\n\t<cms:layout iconhandle=\"usergroups-addusergroup\" label=\"${Composite.Plugins.UserGroupElementProvider, AddNewUserGroup.AddNewUserGroupStep1.LabelFieldGroup}\">\r\n\t\t<FieldGroup>\r\n\t\t\t<TextBox Label=\"${Composite.Plugins.UserGroupElementProvider, AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameLabel}\" Help=\"${Composite.Plugins.UserGroupElementProvider, AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameHelp}\">\r\n\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t<cms:bind source=\"NewUserGroup.Name\" />\r\n\t\t\t\t</TextBox.Text>\r\n\t\t\t</TextBox>\r\n    </FieldGroup>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/UserGroupElementProviderDeleteUserGroupStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.UserGroupElementProvider, DeleteUserGroup.DeleteUserGroupStep1.LabelFieldGroup}\">\r\n    <Text Text=\"${Composite.Plugins.UserGroupElementProvider, DeleteUserGroup.DeleteUserGroupStep1.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/UserGroupElementProviderEditUserGroupStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UserGroup\" type=\"Composite.Data.Types.IUserGroup\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"usergroups-editusergroup\">\r\n    <cms:layout.label>\r\n      <cms:read source=\"UserGroup.Name\" />\r\n    </cms:layout.label>\r\n    <PlaceHolder>\r\n      <FieldGroup Label=\"${Composite.Plugins.UserGroupElementProvider, EditUserGroup.EditUserGroupStep1.LabelFieldGroup}\">\r\n        <TextBox Label=\"${Composite.Plugins.UserGroupElementProvider, EditUserGroup.EditUserGroupStep1.UserGroupNameLabel}\" Help=\"${Composite.Plugins.UserGroupElementProvider, EditUserGroup.EditUserGroupStep1.UserGroupNameHelp}\">\r\n          <TextBox.Text>\r\n            <cms:bind source=\"UserGroup.Name\" />\r\n          </TextBox.Text>\r\n        </TextBox>\r\n      </FieldGroup>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/VisualFunctionElementProviderHelperAddNewStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Function\" type=\"Composite.Data.Types.IVisualFunction, Composite\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"wysiwyg-function\" label=\"${Composite.Plugins.VisualFunction, AddNew.DialogLabel}\">\r\n    <FieldGroup Label=\"${Composite.Plugins.VisualFunction, AddNewStep2.FieldGroupLabel}\">\r\n      <TextBox Label=\"${Composite.Plugins.VisualFunction, AddNewStep2.FuncitonNameLabel}\" Help=\"${Composite.Plugins.VisualFunction, AddNewStep2.FuncitonNameHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Function.Name\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n      <TextBox Label=\"${Composite.Plugins.VisualFunction, AddNewStep2.FuncitonNamespaceLabel}\" Help=\"${Composite.Plugins.VisualFunction, AddNewStep2.FuncitonNamespaceHelp}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"Function.Namespace\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/VisualFunctionElementProviderHelperDeleteStep1.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings></cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.VisualFunction, DeleteStep1.FieldGroupLabel}\">\r\n    <Text Text=\"${Composite.Plugins.VisualFunction, DeleteStep1.Text}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/VisualFunctionElementProviderHelperEdit.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"Function\" type=\"Composite.Data.Types.IVisualFunction, Composite\" />\r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"XhtmlBody\" type=\"System.String\" />\r\n    <cms:binding name=\"EmbedableFieldsTypes\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"SourceTypeFullName\" type=\"System.String\" />\r\n    <cms:binding name=\"PreviewTemplateId\" type=\"System.Guid\" />\r\n    <cms:binding name=\"FieldNameList\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"TemplateList\" type=\"System.Collections.IEnumerable\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <TabPanels>\r\n      <TabPanels.Label>\r\n        <cms:read source=\"Function.Name\" />\r\n      </TabPanels.Label>\r\n      <PlaceHolder Label=\"${Composite.Plugins.VisualFunction, Edit.PlaceHolderLabel}\">\r\n        <Heading Title=\"${Composite.Plugins.VisualFunction, Edit.HeadingTitel}\">\r\n          <Heading.Description>\r\n            <cms:read source=\"SourceTypeFullName\" />\r\n          </Heading.Description>\r\n        </Heading>\r\n        <FieldGroup Label=\"${Composite.Plugins.VisualFunction, Edit.FieldGroupLabel}\">\r\n          <TextBox Label=\"${Composite.Plugins.VisualFunction, Edit.FunctionNameLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.FunctionNameHelp}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"Function.Name\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextBox Label=\"${Composite.Plugins.VisualFunction, Edit.FunctionNamespaceLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.FunctionNamespaceHelp}\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"Function.Namespace\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <TextArea Label=\"${Composite.Plugins.VisualFunction, Edit.FunctionDescriptionLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.FunctionDescriptionHelp}\">\r\n            <TextArea.Text>\r\n              <cms:bind source=\"Function.Description\" />\r\n            </TextArea.Text>\r\n          </TextArea>\r\n          <TextBox Label=\"${Composite.Plugins.VisualFunction, Edit.ItemListLenghtLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.ItemListLenghtHelp}\" Type=\"integer\">\r\n            <TextBox.Text>\r\n              <cms:bind source=\"Function.MaximumItemsToList\" />\r\n            </TextBox.Text>\r\n          </TextBox>\r\n          <KeySelector Label=\"${Composite.Plugins.VisualFunction, Edit.ItemSortingLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.ItemSortingHelp}\">\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"Function.OrderbyFieldName\" />\r\n            </KeySelector.Selected>\r\n            <KeySelector.Options>\r\n              <cms:read source=\"FieldNameList\" />\r\n            </KeySelector.Options>\r\n          </KeySelector>\r\n          <BoolSelector TrueLabel=\"${Composite.Plugins.VisualFunction, Edit.ListSortingTrueLabel}\" FalseLabel=\"${Composite.Plugins.VisualFunction, Edit.ListSortingFalseLabel}\" Label=\"${Composite.Plugins.VisualFunction, Edit.ListSortingLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.ListSortingHelp}\">\r\n            <cms:bind source=\"Function.OrderbyAscending\" />\r\n          </BoolSelector>\r\n          <KeySelector OptionsKeyField=\"Id\" OptionsLabelField=\"Title\" Label=\"${Composite.Plugins.VisualFunction, Edit.PreviewTemplateLabel}\" Help=\"${Composite.Plugins.VisualFunction, Edit.PreviewTemplateHelp}\">\r\n            <KeySelector.Selected>\r\n              <cms:bind source=\"PreviewTemplateId\" />\r\n            </KeySelector.Selected>\r\n            <KeySelector.Options>\r\n              <cms:read source=\"TemplateList\" />\r\n            </KeySelector.Options>\r\n          </KeySelector>\r\n        </FieldGroup>\r\n      </PlaceHolder>\r\n      <XhtmlEditor Label=\"${Composite.Plugins.VisualFunction, Edit.WYSIWYGLayoutLabel}\">\r\n        <XhtmlEditor.EmbedableFieldsTypes>\r\n          <cms:read source=\"EmbedableFieldsTypes\" />\r\n        </XhtmlEditor.EmbedableFieldsTypes>\r\n        <cms:bind source=\"XhtmlBody\" />\r\n      </XhtmlEditor>\r\n      <f:NullCheck>\r\n        <f:NullCheck.CheckValue>\r\n          <cms:read source=\"PreviewEventHandler\" />\r\n        </f:NullCheck.CheckValue>\r\n        <f:NullCheck.WhenNotNull>\r\n          <internal:PreviewPanel Label=\"${Composite.Plugins.VisualFunction, Edit.LabelPreview}\">\r\n            <internal:PreviewPanel.ClickEventHandler>\r\n              <cms:read source=\"PreviewEventHandler\" />\r\n            </internal:PreviewPanel.ClickEventHandler>\r\n          </internal:PreviewPanel>\r\n        </f:NullCheck.WhenNotNull>\r\n      </f:NullCheck>\r\n    </TabPanels>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/VisualFunctionElementProviderHelperSelect.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"RenderingFunctions\" type=\"System.Collections.IEnumerable\" />\r\n    <cms:binding name=\"SelectedRenderingFunction\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <FieldGroup Label=\"${Composite.Plugins.VisualFunction, Select.FieldGroupLabel}\">\r\n      <KeySelector Label=\"${Composite.Plugins.VisualFunction, Select.FunctionFunctionsLabel}\" Help=\"${Composite.Plugins.VisualFunction, Select.FunctionFunctionsHelp}\">\r\n        <KeySelector.Selected>\r\n          <cms:bind source=\"SelectedRenderingFunction\" />\r\n        </KeySelector.Selected>\r\n        <KeySelector.Options>\r\n          <cms:read source=\"RenderingFunctions\" />\r\n        </KeySelector.Options>\r\n      </KeySelector>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/WebsiteFileElementProviderAddNewFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"NewFileName\" type=\"System.String\" />\r\n\t</cms:bindings>\r\n\t<cms:layout label=\"${Composite.Plugins.WebsiteFileElementProvider, AddNewFile.LabelFieldGroup}\">\r\n\t\t<FieldGroup>\r\n\t\t\t<TextBox Label=\"${Composite.Plugins.WebsiteFileElementProvider, AddNewFile.Text}\"\r\n\t\t\t\t\t Help=\"${Composite.Plugins.WebsiteFileElementProvider, AddNewFile.Help}\">\r\n\t\t\t\t<TextBox.Text>\r\n\t\t\t\t\t<cms:bind source=\"NewFileName\" />\r\n\t\t\t\t</TextBox.Text>\r\n\t\t\t</TextBox>\r\n\t\t</FieldGroup>\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/WebsiteFileElementProviderAddNewFolder.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"NewFolderName\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.WebsiteFileElementProvider, AddNewFolder.LabelFieldGroup}\">\r\n    <FieldGroup>\r\n      <TextBox Label=\"${Composite.Plugins.WebsiteFileElementProvider, AddNewFolder.Text}\" \r\n\t\t\t   Help=\"${Composite.Plugins.WebsiteFileElementProvider, AddNewFolder.Help}\">\r\n        <TextBox.Text>\r\n          <cms:bind source=\"NewFolderName\" />\r\n        </TextBox.Text>\r\n      </TextBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/WebsiteFileElementProviderDeleteFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings></cms:bindings>\r\n\t<cms:layout label=\"${Composite.Plugins.WebsiteFileElementProvider, DeleteFile.LabelFieldGroup}\">\r\n\t\t<Text Text=\"${Composite.Plugins.WebsiteFileElementProvider, DeleteFile.Text}\" />\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/WebsiteFileElementProviderDeleteFolder.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\t<cms:bindings></cms:bindings>\r\n\t<cms:layout label=\"${Composite.Plugins.WebsiteFileElementProvider, DeleteFolder.LabelFieldGroup}\">\r\n\t\t<Text Text=\"${Composite.Plugins.WebsiteFileElementProvider, DeleteFolder.Text}\" />\r\n\t</cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/WebsiteFileElementProviderEditTextContentFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"FileContent\" type=\"System.String\" />\r\n    <cms:binding name=\"FileName\" type=\"System.String\" />\r\n    <cms:binding name=\"FileMimeType\" type=\"System.String\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <TextEditor>\r\n      <TextEditor.MimeType>\r\n        <cms:read source=\"FileMimeType\" />\r\n      </TextEditor.MimeType>\r\n      <TextEditor.Label>\r\n        <cms:read source=\"FileName\" />\r\n      </TextEditor.Label>\r\n      <cms:bind source=\"FileContent\" />\r\n    </TextEditor>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/WebsiteFileElementProviderUploadAndExtractZipFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UploadedFile\" type=\"Composite.C1Console.Forms.CoreUiControls.UploadedFile, Composite\" />\r\n    <cms:binding name=\"OverwriteExisting\" type=\"System.Boolean\" />\r\n  </cms:bindings>\r\n  <cms:layout iconhandle=\"website-upload-zip-file\" label=\"${Composite.Plugins.WebsiteFileElementProvider, UploadAndExtractZipFile.DialogLabel}\">\r\n    <FieldGroup>\r\n      <FileUpload Label=\"${Composite.Plugins.WebsiteFileElementProvider, UploadAndExtractZipFile.FileLabel}\" Help=\"${Composite.Plugins.WebsiteFileElementProvider, UploadAndExtractZipFile.FileHelp}\">\r\n        <FileUpload.UploadedFile>\r\n          <cms:bind source=\"UploadedFile\" />\r\n        </FileUpload.UploadedFile>\r\n      </FileUpload>\r\n      <CheckBox Label=\"${Composite.Plugins.WebsiteFileElementProvider, UploadAndExtractZipFile.OverwriteExistingLabel}\" Help=\"${Composite.Plugins.WebsiteFileElementProvider, UploadAndExtractZipFile.OverwriteExistingHelp}\" ItemLabel=\"${Composite.Plugins.WebsiteFileElementProvider, UploadAndExtractZipFile.OverwriteExistingItemLabel}\">\r\n        <CheckBox.Checked>\r\n          <cms:bind source=\"OverwriteExisting\" />\r\n        </CheckBox.Checked>\r\n      </CheckBox>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/WebsiteFileElementProviderUploadNewWebsiteFile.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UploadedFile\" type=\"Composite.C1Console.Forms.CoreUiControls.UploadedFile, Composite\" />\r\n  </cms:bindings>\r\n  <cms:layout label=\"${Composite.Plugins.WebsiteFileElementProvider, UploadNewWebsiteFile.LabelFieldGroup}\">\r\n    <FieldGroup>\r\n      <FileUpload Label=\"${Composite.Plugins.WebsiteFileElementProvider, UploadNewWebsiteFile.LabelFile}\" \r\n\t\t\t\t  Help=\"${Composite.Plugins.WebsiteFileElementProvider, UploadNewWebsiteFile.HelpFile}\">\r\n        <FileUpload.UploadedFile>\r\n          <cms:bind source=\"UploadedFile\" />\r\n        </FileUpload.UploadedFile>\r\n      </FileUpload>\r\n    </FieldGroup>\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/Administrative/WebsiteFileElementProviderUploadNewWebsiteFileConfirm.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n  <cms:bindings>\r\n    <cms:binding name=\"UploadedFile\" type=\"Composite.C1Console.Forms.CoreUiControls.UploadedFile, Composite\" />\r\n  </cms:bindings>\r\n  <cms:layout>\r\n    <Heading\r\n    Title=\"${Composite.Plugins.WebsiteFileElementProvider, UploadNewWebsiteFile.ConfirmOverwriteTitle}\"\r\n    Description=\"${Composite.Plugins.WebsiteFileElementProvider, UploadNewWebsiteFile.ConfirmOverwriteDescription}\" />\r\n  </cms:layout>\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/content/forms/AdministrativeTemplates/ConfirmDialog.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n\r\n<cms:formdefinition\r\n  xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\"\r\n  xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\"\r\n  xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\"\r\n  xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\r\n  <cms:bindings>\r\n    <cms:binding name=\"Form\" type=\"Composite.C1Console.Forms.IUiControl, Composite\" />\r\n    <cms:binding name=\"NextEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"PreviousEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"FinishEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"CancelEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <!-- common mistakes... warning are shown if recieved -->\r\n    <cms:binding name=\"SaveEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n  </cms:bindings>\r\n\r\n  <cms:layout >\r\n    <PlaceHolder>\r\n\r\n      <internal:ConfirmDialogCanvas>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"PreviewEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>PREVIEW EVENT NOT EXPECTED ON CONFIRM DIALOGS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"SaveEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>SAVE EVENT NOT EXPECTED ON CONFIRM DIALOGS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"PreviousEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>PREVIOUS EVENT NOT EXPECTED ON CONFIRM DIALOGS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"NextEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>NEXT EVENT NOT EXPECTED ON CONFIRM DIALOGS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n        \r\n        <f:Replicator>\r\n          <cms:read source=\"Form\" />\r\n        </f:Replicator>\r\n\r\n      </internal:ConfirmDialogCanvas>\r\n\r\n\r\n      <internal:DialogToolbar>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"FinishEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:OkButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.ConfirmDialog.LabelOk}\">\r\n              <internal:OkButton.ClickEventHandler>\r\n                <cms:read source=\"FinishEventHandler\" />\r\n              </internal:OkButton.ClickEventHandler>\r\n            </internal:OkButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"CancelEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:CancelButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.ConfirmDialog.LabelCancel}\">\r\n              <internal:CancelButton.ClickEventHandler>\r\n                <cms:read source=\"CancelEventHandler\" />\r\n              </internal:CancelButton.ClickEventHandler>\r\n            </internal:CancelButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n      </internal:DialogToolbar>\r\n\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/forms/AdministrativeTemplates/DataDialog.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n\r\n<cms:formdefinition\r\n  xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\"\r\n  xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\"\r\n  xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\"\r\n  xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\r\n  <cms:bindings>\r\n    <cms:binding name=\"Form\" type=\"Composite.C1Console.Forms.IUiControl, Composite\" />\r\n    <cms:binding name=\"NextEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"PreviousEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"FinishEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"CancelEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <!-- common mistakes... warning are shown if recieved -->\r\n    <cms:binding name=\"SaveEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n  </cms:bindings>\r\n\r\n  <cms:layout >\r\n    <PlaceHolder>\r\n\r\n      <internal:DialogCanvas>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"PreviewEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>USE \"PREVIOUS\" NOT \"PREVIEW\" ON WIZARDS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"SaveEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>SAVE EVENT NOT EXPECTED ON WIZARDS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"PreviousEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>USE \"PREVIOUS\" NOT \"PREVIOUS\" ON CONFIRM DIALOGS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"NextEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>USE \"PREVIOUS\" NOT \"NEXT\" ON CONFIRM DIALOGS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n        <f:Replicator>\r\n          <cms:read source=\"Form\" />\r\n        </f:Replicator>\r\n\r\n      </internal:DialogCanvas>\r\n\r\n\r\n      <internal:DialogToolbar>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"FinishEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:OkButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.DataDialog.LabelOk}\">\r\n              <internal:OkButton.ClickEventHandler>\r\n                <cms:read source=\"FinishEventHandler\" />\r\n              </internal:OkButton.ClickEventHandler>\r\n            </internal:OkButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"CancelEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:CancelButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.DataDialog.LabelCancel}\">\r\n              <internal:CancelButton.ClickEventHandler>\r\n                <cms:read source=\"CancelEventHandler\" />\r\n              </internal:CancelButton.ClickEventHandler>\r\n            </internal:CancelButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n      </internal:DialogToolbar>\r\n\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/forms/AdministrativeTemplates/Document.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n\r\n<cms:formdefinition\r\n  xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\"\r\n  xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\"\r\n  xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\"\r\n  xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\r\n  <cms:bindings>\r\n    <cms:binding name=\"Form\" type=\"Composite.C1Console.Forms.IUiControl, Composite\" />\r\n    <cms:binding name=\"CustomToolbarItems\" type=\"Composite.C1Console.Forms.IUiControl, Composite\" optional=\"true\" />\r\n    <cms:binding name=\"SaveEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"SaveAndPublishEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"SaveAsEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"NextEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"PreviousEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"FinishEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"CancelEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n  </cms:bindings>\r\n\r\n  <cms:layout >\r\n    <PlaceHolder>\r\n      <internal:Toolbar>\r\n\r\n\t\t\t\t<f:NullCheck>\r\n\t\t\t\t\t<f:NullCheck.CheckValue>\r\n\t\t\t\t\t\t<cms:read source=\"CustomToolbarItems\" />\r\n\t\t\t\t\t</f:NullCheck.CheckValue>\r\n\t\t\t\t\t<f:NullCheck.WhenNotNull>\r\n\t\t\t\t\t\t<f:Replicator>\r\n\t\t\t\t\t\t\t<cms:read source=\"CustomToolbarItems\" />\r\n\t\t\t\t\t\t</f:Replicator>\r\n\t\t\t\t\t</f:NullCheck.WhenNotNull>\r\n\t\t\t\t</f:NullCheck>\r\n\r\n\t\t\t\t<f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"SaveEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:SaveButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.Document.LabelSave}\">\r\n              <internal:SaveButton.SaveEventHandler>                \r\n                <cms:read source=\"SaveEventHandler\" />\r\n              </internal:SaveButton.SaveEventHandler>\r\n              <internal:SaveButton.SaveAndPublishEventHandler>\r\n                <cms:read source=\"SaveAndPublishEventHandler\" />\r\n              </internal:SaveButton.SaveAndPublishEventHandler>\r\n            </internal:SaveButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n<!--\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"SaveAndPublishEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <ToolbarButton Label=\"Save and Publish\">\r\n              <ToolbarButton.ClickEventHandler>\r\n                <cms:read source=\"SaveAndPublishEventHandler\" />\r\n              </ToolbarButton.ClickEventHandler>\r\n            </ToolbarButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n-->        \r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"SaveAsEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:SaveAsButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.Document.LabelSaveAs}\">\r\n              <internal:SaveAsButton.ClickEventHandler>\r\n                <cms:read source=\"SaveAsEventHandler\" />\r\n              </internal:SaveAsButton.ClickEventHandler>\r\n            </internal:SaveAsButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"PreviousEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>PREVIOUS EVENTS NOT EXPECTED ON DOCUMENTS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"NextEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>NEXT EVENTS NOT EXPECTED ON DOCUMENTS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"FinishEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>FINISH EVENTS NOT EXPECTED ON DOCUMENTS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"CancelEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>CANCEL EVENTS NOT EXPECTED ON DOCUMENTS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n      </internal:Toolbar>\r\n      <internal:DocumentBody>\r\n\r\n        <f:Replicator>\r\n          <cms:read source=\"Form\" />\r\n        </f:Replicator>\r\n      </internal:DocumentBody>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/forms/AdministrativeTemplates/EmptyDocument.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n\r\n<cms:formdefinition\r\n  xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\"\r\n  xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\"\r\n  xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\"\r\n  xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\r\n  <cms:bindings>\r\n    <cms:binding name=\"Form\" type=\"Composite.C1Console.Forms.IUiControl, Composite\" />\r\n  </cms:bindings>\r\n\r\n  <cms:layout >\r\n    <PlaceHolder>\r\n      <f:Replicator>\r\n        <cms:read source=\"Form\" />\r\n      </f:Replicator>\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/forms/AdministrativeTemplates/Wizard.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n\r\n<cms:formdefinition\r\n  xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\"\r\n  xmlns:internal=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\"\r\n  xmlns:f=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\"\r\n  xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\r\n  <cms:bindings>\r\n    <cms:binding name=\"Form\" type=\"Composite.C1Console.Forms.IUiControl, Composite\" />\r\n    <cms:binding name=\"NextEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"PreviousEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"FinishEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"CancelEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <!-- common mistakes... warning are shown if recieved -->\r\n    <cms:binding name=\"SaveEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n    <cms:binding name=\"PreviewEventHandler\" type=\"System.EventHandler\" optional=\"true\" />\r\n  </cms:bindings>\r\n\r\n  <cms:layout>\r\n    <PlaceHolder>\r\n      <internal:DialogCanvas>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"PreviewEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>PREVIEW EVENT NOT EXPECTED ON WIZARDS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"SaveEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <Text>SAVE EVENT NOT EXPECTED ON WIZARDS</Text>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:Replicator>\r\n          <cms:read source=\"Form\" />\r\n        </f:Replicator>\r\n\r\n      </internal:DialogCanvas>\r\n\r\n\r\n      <internal:DialogToolbar>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"PreviousEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:PreviousButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelPrevious} \">\r\n              <internal:PreviousButton.ClickEventHandler>\r\n                <cms:read source=\"PreviousEventHandler\" />\r\n              </internal:PreviousButton.ClickEventHandler>\r\n            </internal:PreviousButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"NextEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:NextButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelNext}\">\r\n              <internal:NextButton.ClickEventHandler>\r\n                <cms:read source=\"NextEventHandler\" />\r\n              </internal:NextButton.ClickEventHandler>\r\n            </internal:NextButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"FinishEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:FinishButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelFinish}\">\r\n              <internal:FinishButton.ClickEventHandler>\r\n                <cms:read source=\"FinishEventHandler\" />\r\n              </internal:FinishButton.ClickEventHandler>\r\n            </internal:FinishButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n        <f:NullCheck>\r\n          <f:NullCheck.CheckValue>\r\n            <cms:read source=\"CancelEventHandler\" />\r\n          </f:NullCheck.CheckValue>\r\n          <f:NullCheck.WhenNotNull>\r\n            <internal:WizardCancelButton Label=\"${Composite.Management, Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelCancel}\">\r\n              <internal:WizardCancelButton.ClickEventHandler>\r\n                <cms:read source=\"CancelEventHandler\" />\r\n              </internal:WizardCancelButton.ClickEventHandler>\r\n            </internal:WizardCancelButton>\r\n          </f:NullCheck.WhenNotNull>\r\n        </f:NullCheck>\r\n\r\n      </internal:DialogToolbar>\r\n\r\n    </PlaceHolder>\r\n  </cms:layout>\r\n</cms:formdefinition>\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/bindings/SourceEditorFindAndReplaceToolBarButtonBinding.js",
    "content": "﻿SourceEditorFindAndReplaceToolBarButtonBinding.prototype = new EditorToolBarButtonBinding;\nSourceEditorFindAndReplaceToolBarButtonBinding.prototype.constructor = SourceEditorFindAndReplaceToolBarButtonBinding;\nSourceEditorFindAndReplaceToolBarButtonBinding.superclass = EditorToolBarButtonBinding.prototype;\n\n/**\n* @class\n*/\nfunction SourceEditorFindAndReplaceToolBarButtonBinding() {\n\n    /**\n    * @type {SystemLogger}\n    */\n    this.logger = SystemLogger.getLogger(\"SourceEditorFindAndReplaceToolBarButtonBinding\");\n\n    /**\n    * The containing editor.\n    * @type {SourceEditorBinding}\n    */\n    this._editorBinding = null;\n\n    /**\n    * The codemirror editor.\n    * @type {Codemirror}\n    */\n    this._codemirrorEditor = null;\n\n    /*\n    * Returnable.\n    */\n    return this;\n}\n\n/**\n* Identifies binding.\n*/\nSourceEditorFindAndReplaceToolBarButtonBinding.prototype.toString = function() {\n\n    return \"[SourceEditorFindAndReplaceToolBarButtonBinding]\";\n};\n\n/**\n* @overloads {EditorToolBarBinding#onBindingAttach}\n*/\nSourceEditorFindAndReplaceToolBarButtonBinding.prototype.onBindingAttach = function() {\n\n    SourceEditorFindAndReplaceToolBarButtonBinding.superclass.onBindingAttach.call(this);\n    var codemirrorwindow = this.bindingWindow.bindingMap.codemirrorwindow;\n    EditorBinding.registerComponent(this, codemirrorwindow);\n};\n\n/**\n* @implements {IWysiwygEditorComponent}\n* @param {CodemirrorEditorBinding} binding\n* @param {Codemirror} editor\n*/\nSourceEditorFindAndReplaceToolBarButtonBinding.prototype.initializeSourceEditorComponent = function(binding, editor) {\n\n    this._editorBinding = binding;\n    this._codemirrorEditor = editor;\n\n    var self = this;\n\n    this._codemirrorEditor.addKeyMap({\n        \"Ctrl-F\": function () {\n            self.openDialog(self);\n        }\n    });\n\n    this._codemirrorEditor.addKeyMap({\n        \"Cmd-F\": function () {\n            self.openDialog(self);\n        }\n    });\n\n};\n\n/**\n* Open find and replace dialog and wait for input.\n* @overwrites {ToolBarButtonBinding#onCommand}\n*/\nSourceEditorFindAndReplaceToolBarButtonBinding.prototype.oncommand = function() {\n    this.openDialog(this);\n};\n\nSourceEditorFindAndReplaceToolBarButtonBinding.prototype.openDialog = function (self) {\n    \n    var handler = {\n        handleDialogResponse: function (response, result) {\n        }\n    };\n\n    var args = { editor: this._codemirrorEditor };\n    Dialog.invokeModal(\"${root}/content/misc/editors/codemirroreditor/codemirrorfindandreplace.aspx\", handler, args);\n}\n\n/**\n* This has been isolated so that the contextmenu can invoke it.\n* @param {string} cmd\n* @param {string} gui\n* @param {string} val\n*/\nSourceEditorFindAndReplaceToolBarButtonBinding.prototype.handleCommand = function(cmd, gui, val) {\n\n    this.oncommand();\n};\n\n/**\n* @param {string} string\n* @param {string} token\n* @return {string}\n*/\nSourceEditorFindAndReplaceToolBarButtonBinding.prototype._getStartString = function(string, token) {\n\n    var result = null;\n    if (string.indexOf(token) > -1) {\n        result = string.substring(0, string.indexOf(token));\n    }\n    return result;\n};\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/bindings/SourceEditorFormatToolBarButtonBinding.js",
    "content": "SourceEditorFormatToolbarButtonBinding.prototype = new EditorToolBarButtonBinding;\r\nSourceEditorFormatToolbarButtonBinding.prototype.constructor = SourceEditorFormatToolbarButtonBinding;\r\nSourceEditorFormatToolbarButtonBinding.superclass = EditorToolBarButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SourceEditorFormatToolbarButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SourceEditorFormatToolbarButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {SourceEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * The codemirror editor.\r\n\t * @type {Codemirror}\r\n\t */\r\n\tthis._codemirrorEditor = null;\r\n\r\n\t/**\r\n\t* Syntax defaults to plain text.\r\n\t* @type {string}\r\n\t*/\r\n\tthis.syntax = new String(CodeMirrorEditorBinding.syntax.TEXT);\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSourceEditorFormatToolbarButtonBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[SourceEditorFormatToolbarButtonBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {EditorToolBarBinding#onBindingAttach}\r\n */\r\nSourceEditorFormatToolbarButtonBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tSourceEditorFormatToolbarButtonBinding.superclass.onBindingAttach.call ( this );\r\n\tvar codemirrorwindow = this.bindingWindow.bindingMap.codemirrorwindow;\r\n\tEditorBinding.registerComponent ( this, codemirrorwindow );\r\n}\r\n\r\n/**\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {CodemirrorEditorBinding} binding\r\n * @param {Codemirror} editor\r\n */\r\nSourceEditorFormatToolbarButtonBinding.prototype.initializeSourceEditorComponent = function (binding, editor) {\r\n\r\n\tthis._editorBinding = binding;\r\n\tthis._codemirrorEditor = editor;\r\n\tif (binding != null)\r\n\t\tthis.syntax = binding.syntax;\r\n}\r\n\r\n/**\r\n * Format or die.\r\n * @overwrites {ToolBarButtonBinding#onCommand}\r\n */\r\nSourceEditorFormatToolbarButtonBinding.prototype.oncommand = function () {\r\n\t\r\n\t/* \r\n\t * The timeout is simply to lock the GUI so that user knows we are working.\r\n\t */\r\n\tApplication.lock ( this );\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tself._doIt ();\r\n\t}, 0 );\r\n}\r\n\r\n/**\r\n * Do it.\r\n * @return\r\n */\r\nSourceEditorFormatToolbarButtonBinding.prototype._doIt = function () {\r\n\r\n    var markup = this._editorBinding.getContent();\r\n\tvar dom = XMLParser.parse(markup, true);\r\n\r\n\tif (dom != null) {\r\n\t\tWebServiceProxy.isFaultHandler = false;\r\n\t\tvar result;\r\n\t\tif (this.syntax == CodeMirrorEditorBinding.syntax.HTML) {\r\n\t\t\tresult = MarkupFormatService.AutoIndentDocument(encodeURIComponent(markup));\r\n\t\t}\r\n\t\telse {\r\n\t\t\tresult = MarkupFormatService.AutoIndentXml(encodeURIComponent(markup));\r\n\t\t}\r\n\t\tWebServiceProxy.isFaultHandler = true;\r\n\t\tif (result instanceof SOAPFault) {\r\n\t\t\tApplication.unlock(this);\r\n\t\t\tthis._editorBinding.validate();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tbindingMap.editorpage.setContent(decodeURIComponent(result));\r\n\t\t\tthis._editorBinding.checkForDirty();\r\n\t\t\tApplication.unlock(this);\r\n\t\t}\r\n\t} else {\r\n\t\tApplication.unlock(this);\r\n\t\tvar editor = this._editorBinding;\r\n\t\tDialog.warning(\r\n\t\t\tStringBundle.getString(\"Composite.Web.SourceEditor\", \"Format.XML.ErrorDialog.Title\"),\r\n\t\t\tStringBundle.getString(\"Composite.Web.SourceEditor\", \"Format.XML.ErrorDialog.Text\"),\r\n\t\t\tnull,\r\n\t\t\t{\r\n\t\t\t\thandleDialogResponse: function () {\r\n\t\t\t\t\teditor.validate();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * This has been isolated so that the contextmenu can invoke it.\r\n * @param {string} cmd\r\n * @param {string} gui\r\n * @param {string} val\r\n */\r\nSourceEditorFormatToolbarButtonBinding.prototype.handleCommand = function ( cmd, gui, val ) {\r\n\t\r\n\tthis.oncommand ();\r\n}\r\n\r\n/**\r\n * @param {string} string\r\n * @param {string} token\r\n * @return {string}\r\n */\r\nSourceEditorFormatToolbarButtonBinding.prototype._getStartString = function ( string, token ) {\r\n\t\r\n\tvar result = null;\r\n\tif ( string.indexOf ( token ) > -1 ) {\r\n\t\tresult = string.substring ( 0, string.indexOf ( token ));\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/bindings/SourceEditorInsertToolbarButtonBinding.js",
    "content": "SourceEditorInsertToolbarButtonBinding.prototype = new EditorToolBarButtonBinding;\r\nSourceEditorInsertToolbarButtonBinding.prototype.constructor = SourceEditorInsertToolbarButtonBinding;\r\nSourceEditorInsertToolbarButtonBinding.superclass = EditorToolBarButtonBinding.prototype;\r\n\r\n/*\r\n * This could be elevated to a global utility function at some point.\r\n * UPDATE: now copied into CodePressCopyPasteManager!\r\n * UPDATE: now deprecated by intro of Codemirror\r\n * @param {string} code\r\n * @return {string}\r\n * @depreacated\r\n *\r\nSourceEditorInsertToolbarButtonBinding._translate = function ( code ) {\r\n\r\n\tcode = code.replace ( /&/gi, \"&amp;\" );\r\n\tcode = code.replace ( /</g, \"&lt;\" );\r\n\tcode = code.replace ( />/g, \"&gt;\" );\r\n\treturn code;\r\n}\r\n*/\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SourceEditorInsertToolbarButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SourceEditorInsertToolbarButtonBinding\" );\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SourceEditorInsertToolbarButtonBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {ButtonBinding#onBindingAttach}\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype.onBindingAttach = function () {\r\n\r\n\tSourceEditorInsertToolbarButtonBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.popupBinding.addActionListener ( MenuItemBinding.ACTION_COMMAND, this );\r\n\tvar codemirrorwindow = this.bindingWindow.bindingMap.codemirrorwindow;\r\n\tEditorBinding.registerComponent ( this, codemirrorwindow );\r\n}\r\n\r\n/**\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {CodemirrorEditorBinding} binding\r\n * @param {Codemirror} editor\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype.initializeSourceEditorComponent = function ( binding, editor ) {\r\n\r\n\tthis._editorBinding = binding;\r\n\tthis._codemirrorEditor = editor;\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tSourceEditorInsertToolbarButtonBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\r\n\t\t\tvar cmd = binding.getProperty ( \"cmd\" );\r\n\t\t\tvar val = binding.getProperty ( \"val\" );\r\n\t\t\tthis.handleCommand ( cmd, null, val );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * This has been isolated so that the contextmenu can invoke it.\r\n * @param {string} cmd\r\n * @param {string} gui\r\n * @param {string} val\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype.handleCommand = function ( cmd, gui, val ) {\r\n\r\n\tswitch ( cmd ) {\r\n\t\tcase \"compositeInsert\" :\r\n\t\t\tswitch ( val ) {\r\n\t\t\t\tcase \"pageurl\" :\r\n\t\t\t\t\tthis._injectLinkable ( \"Composite.Management.PageSelectorDialog\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"imageurl\" :\r\n\t\t\t\t\tthis._injectLinkable ( \"Composite.Management.ImageSelectorDialog\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"mediaurl\" :\r\n\t\t\t\t\tthis._injectLinkable ( \"Composite.Management.EmbeddableMediaSelectorDialog\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"frontendurl\" :\r\n\t\t\t\t\tthis._injectLinkable ( \"Composite.Management.FrontendFileSelectorDialog\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"functionmarkup\" :\r\n\t\t\t\t\tthis._injectFunction ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Collect and inject linkable page, image or or media URL.\r\n * @param {string} handle\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype._injectLinkable = function ( handle ) {\r\n\r\n\tvar def = ViewDefinitions [ handle ];\r\n\r\n\tvar self = this;\r\n\tdef.handler = {\r\n\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\tself._inject ( result.getFirst ());\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tDialog.invokeDefinition ( def );\r\n}\r\n\r\n/**\r\n * Collect and inject function markup.\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype._injectFunction = function () {\r\n\r\n\tvar def = ViewDefinitions [ \"Composite.Management.FunctionSelectorDialog\" ]; // \"Composite.Management.XhtmlDocumentFunctionSelectorDialog\"\r\n\tdef.argument.nodes = [{\r\n\t\tkey : \"AllFunctionsElementProvider\"\r\n\t}];\r\n\r\n\tvar self = this;\r\n\tdef.handler = {\r\n\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\tvar functionName = result.getFirst ();\r\n\t\t\t\tvar functionInfo = XhtmlTransformationsService.GetFunctionInfo ( functionName );\r\n\t\t\t\tif ( functionInfo.RequireConfiguration ) {\r\n\t\t\t\t\tself._injectFunctionConfiguration ( functionInfo.FunctionMarkup );\r\n\t\t\t\t} else {\r\n\t\t\t\t    self._injectFunctionMarkup(functionInfo.FunctionMarkup);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tDialog.invokeDefinition(def, this._editorBinding);\r\n}\r\n\r\n/**\r\n * Collect and inject configured function markup.\r\n * @param {string} markup\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype._injectFunctionConfiguration = function ( markup ) {\r\n\r\n\tvar self = this;\r\n\tvar handler = {\r\n\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t    self._injectFunctionMarkup(result);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tEditorBinding.invokeFunctionEditorDialog(markup, handler, undefined, this._editorBinding);\r\n}\r\n\r\n/**\r\n * Inject result and trigger a syntaxhighlight.\r\n * @param {string} string\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype._injectFunctionMarkup = function (string) {\r\n\r\n    switch (this._editorBinding.syntax) {\r\n        case CodeMirrorEditorBinding.syntax.ASPX:\r\n            string = string.replace(/(<f:function[^>]*) xmlns:f=\"[^\"]*\"/gi, '$1 runat=\"server\"');\r\n            string = string.replace(/(<f:param[^>]*) xmlns:f=\"[^\"]*\"/gi, '$1');\r\n            break;\r\n        default:\r\n            break;\r\n    }\r\n\r\n    this._inject(string);\r\n}\r\n\r\n/**\r\n * Inject result and trigger a syntaxhighlight.\r\n * @param {string} string\r\n */\r\nSourceEditorInsertToolbarButtonBinding.prototype._inject = function ( string ) {\r\n\r\n\tthis._codemirrorEditor.replaceSelection(string);\r\n\tthis._editorBinding.checkForDirty ();\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/bindings/SourceEditorPageBinding.js",
    "content": "SourceEditorPageBinding.prototype = new PageBinding;\r\nSourceEditorPageBinding.prototype.constructor = SourceEditorPageBinding;\r\nSourceEditorPageBinding.superclass = PageBinding.prototype;\r\n\r\nSourceEditorPageBinding.URL_CODEMIRRORWINDOW = \"${root}/content/misc/editors/codemirroreditor/codemirror.aspx\";\r\n\r\n/**\r\n * @class\r\n * @implements {IWysiwygEditorComponent}\r\n */\r\nfunction SourceEditorPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SourceEditorPageBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {CodemirrorEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * The codemirror editor.\r\n\t * @type {Codemirror}\r\n\t */\r\n\tthis._codemirrorEditor = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSourceEditorPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[SourceEditorPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overlaods {PageBinding#onBindingRegister}\r\n */\r\nSourceEditorPageBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tSourceEditorPageBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this.setDisabled;\r\n}\r\n\r\n/**\r\n * Halting page initialization until after Editor is loaded.\r\n * @overwrites {PageBinding#onPageInitialize}\r\n */\r\nSourceEditorPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tthis._loadCodemirror();\r\n\r\n}\r\n\r\n/**\r\n * Register for initialization when CodePress is loaded - then load CodePress.\r\n */\r\nSourceEditorPageBinding.prototype._loadCodemirror = function () {\r\n\tvar codemirrorwindow = this.bindingWindow.bindingMap.codemirrorwindow;\r\n\tEditorBinding.registerComponent(this, codemirrorwindow);\r\n\tcodemirrorwindow.setURL(SourceEditorPageBinding.URL_CODEMIRRORWINDOW);\r\n}\r\n\r\n/**\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {CodemirrorEditorBinding} binding\r\n * @param {Codemirror} editor\r\n */\r\nSourceEditorPageBinding.prototype.initializeSourceEditorComponent = function ( binding, editor ) {\r\n\r\n\tthis._editorBinding = binding;\r\n\tthis._codemirrorEditor = editor;\r\n\t\r\n\t/*\r\n\t * TODO: Hide \"flash of syntax highlighting\" with less timeout?\r\n\t */\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tself._fit ();\r\n\t}, 500 );\r\n\t\r\n\tthis.onPageInitialize ();\r\n}\r\n\r\n/**\r\n * Set content.\r\n * @return {string}\r\n */\r\nSourceEditorPageBinding.prototype.setContent = function(string) {\r\n\r\n\t// Unixification.\r\n\tstring = string.replace(/\\r\\n/g, \"\\n\");\r\n\r\n\t// Fixing the title char\r\n\t// TODO: probably on server...\r\n\tstring = string.replace(/\\\"%7E/g, \"\\\"~\");\r\n\tstring = string.replace(/%28/g, \"(\");\r\n\tstring = string.replace(/%29/g, \")\");\r\n\r\n\tthis._codemirrorEditor.setValue(string);\r\n\r\n}\r\n/**\r\n * Get content.\r\n * @param {string} string\r\n */\r\nSourceEditorPageBinding.prototype.getContent = function (string) {\r\n\r\n\tvar result = null;\r\n\tresult = this._codemirrorEditor.getValue();\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Nothing to see yet...\r\n * @param {boolean} isDisabled\r\n */\r\nSourceEditorPageBinding.prototype.setDisabled = function ( isDisabled ) {}\r\n\r\n/**\r\n * Debug editor HTML source (developer feature).\r\n */\r\nSourceEditorPageBinding.prototype.debug = function () {\r\n\t\r\n\tthis._editorBinding.debug ();\r\n}\r\n\r\n/** \r\n * Notify Codemirror on environment resize.\r\n */\r\nSourceEditorPageBinding.prototype.flex = function () {\r\n\t\r\n\tSourceEditorPageBinding.superclass.flex.call ( this );\r\n\t\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tself._fit ();\r\n\t}, 0 );\r\n}\r\n\r\n/**\r\n * Fit Codemirror to window size.\r\n */\r\nSourceEditorPageBinding.prototype._fit = function () {\r\n\r\n\tvar win = this.bindingWindow.bindingMap.codemirrorwindow;\r\n\r\n\tif (win !== undefined) {\r\n\t\tvar div = win.getContentDocument().getElementById(\"textarea\");\r\n\t\tif (div != null) {\r\n\t\t\tvar dim = win.boxObject.getDimension();\r\n\t\t\tdiv.style.width = dim.w + \"px\";\r\n\t\t\tdiv.style.height = dim.h + \"px\";\r\n\r\n\t\t}\r\n\t\tif (this._codemirrorEditor != null) {\r\n\t\t\tvar wrapper = this._codemirrorEditor.getWrapperElement();\r\n\t\t\tif (wrapper != null) {\r\n\t\t\t\tvar dim = win.boxObject.getDimension();\r\n\t\t\t\twrapper.style.width = (dim.w) + \"px\";\r\n\t\t\t\twrapper.style.height = (dim.h) + \"px\";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param isDisabled\r\n * @return\r\n */\r\nSourceEditorPageBinding.prototype.cover = function (isCover) {\r\n\t\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nSourceEditorPageBinding.prototype.getCheckSum = function () {\r\n\r\n\tvar result = null;\r\n\tresult = this._codemirrorEditor.getValue();\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/bindings/SourceEditorToggleWordWrapToolbarButtonBinding.js",
    "content": "SourceEditorToggleWordWrapToolbarButtonBinding.prototype = new EditorToolBarButtonBinding;\nSourceEditorToggleWordWrapToolbarButtonBinding.prototype.constructor = SourceEditorToggleWordWrapToolbarButtonBinding;\nSourceEditorToggleWordWrapToolbarButtonBinding.superclass = EditorToolBarButtonBinding.prototype;\n\n/**\n * @class\n */\nfunction SourceEditorToggleWordWrapToolbarButtonBinding () {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger ( \"SourceEditorToggleWordWrapToolbarButtonBinding\" );\n\n\t/**\n\t * The containing editor.\n\t * @type {SourceEditorBinding}\n\t */\n\tthis._editorBinding = null;\n\n\t/**\n\t * The codemirror editor.\n\t * @type {Codemirror}\n\t */\n\tthis._codemirrorEditor = null;\n\n\t/*\n\t * Returnable.\n\t */\n\treturn this;\n}\n\n/**\n * Identifies binding.\n */\nSourceEditorToggleWordWrapToolbarButtonBinding.prototype.toString = function () {\n\n\treturn \"[SourceEditorToggleWordWrapToolbarButtonBinding]\";\n}\n\n/**\n * @overloads {EditorToolBarBinding#onBindingAttach}\n */\nSourceEditorToggleWordWrapToolbarButtonBinding.prototype.onBindingAttach = function () {\n\n\tSourceEditorToggleWordWrapToolbarButtonBinding.superclass.onBindingAttach.call ( this );\n\tvar codemirrorwindow = this.bindingWindow.bindingMap.codemirrorwindow;\n\tEditorBinding.registerComponent ( this, codemirrorwindow );\n}\n\n/**\n * @implements {IWysiwygEditorComponent}\n * @param {CodemirrorEditorBinding} binding\n * @param {Codemirror} editor\n */\nSourceEditorToggleWordWrapToolbarButtonBinding.prototype.initializeSourceEditorComponent = function ( binding, editor ) {\n\n\tthis._editorBinding = binding;\n    this._codemirrorEditor = editor;\n}\n\n/**\n * \n * @overwrites {ToolBarButtonBinding#onCommand}\n */\nSourceEditorToggleWordWrapToolbarButtonBinding.prototype.oncommand = function () {\n\t\n\tvar self = this;\t\n\tthis._codemirrorEditor.setOption(\"lineWrapping\", !this._codemirrorEditor.getOption(\"lineWrapping\"));\n    localStorage.setItem(\"lineWrapping\", this._codemirrorEditor.getOption(\"lineWrapping\"));\n}\n\n/**\n * This has been isolated so that the contextmenu can invoke it.\n * @param {string} cmd\n * @param {string} gui\n * @param {string} val\n */\nSourceEditorToggleWordWrapToolbarButtonBinding.prototype.handleCommand = function ( cmd, gui, val ) {\n\n\tthis.oncommand ();\n}\n\n/**\n * @param {string} string\n * @param {string} token\n * @return {string}\n */\nSourceEditorToggleWordWrapToolbarButtonBinding.prototype._getStartString = function ( string, token ) {\n\n\tvar result = null;\n\tif ( string.indexOf ( token ) > -1 ) {\n\t\tresult = string.substring ( 0, string.indexOf ( token ));\n\t}\n\treturn result;\n}\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/bindings/SourceEditorToolBarBinding.js",
    "content": "SourceEditorToolBarBinding.prototype = new ToolBarBinding;\r\nSourceEditorToolBarBinding.prototype.constructor = SourceEditorToolBarBinding;\r\nSourceEditorToolBarBinding.superclass = ToolBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IWysiwygEditorComponent}\r\n * @implements {IWysiwygEditorNodeChangeHandler}\r\n */\r\nfunction SourceEditorToolBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SourceEditorToolBarBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {CodemirrorEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {Codemirror}\r\n\t */\r\n\tthis._codemirrorEditor = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSourceEditorToolBarBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[SourceEditorToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * Hookup broadcaster integration.\r\n * @overloads {ToolBarBinding#onBindingRegister}\r\n */\r\nSourceEditorToolBarBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tSourceEditorToolBarBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this.setDisabled;\r\n\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND );\r\n}\r\n\r\n/**\r\n * Register as editor component.\r\n * @overloads {ToolBarBinding#onBindingAttach}\r\n */\r\nSourceEditorToolBarBinding.prototype.onBindingAttach = function () {\r\n\r\n\tSourceEditorToolBarBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tvar codemirrorwindow = this.bindingWindow.bindingMap.codemirrorwindow;\r\n\tEditorBinding.registerComponent(this, codemirrorwindow);\r\n}\r\n\r\n/**\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {CodemirrorEditorBinding} binding\r\n * @param {Codemirror} editor\r\n */\r\nSourceEditorToolBarBinding.prototype.initializeSourceEditorComponent = function (binding, editor) {\r\n\r\n\tthis._editorBinding = binding;\r\n\tthis._codemirrorEditor = editor;\r\n\t\r\n\t/*\r\n\t* Show XML tools?\r\n\t*/\r\n\tswitch ( this._editorBinding.syntax ) {\r\n\t\tcase CodeMirrorEditorBinding.syntax.XML:\r\n\t\tcase CodeMirrorEditorBinding.syntax.XSL:\r\n\t\tcase CodeMirrorEditorBinding.syntax.HTML:\r\n\t\t\tthis.bindingWindow.bindingMap.xmltools.show ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Nothing to see yet...\r\n * @param {boolean} isDisabled\r\n */\r\nSourceEditorToolBarBinding.prototype.setDisabled = function ( isDisabled ) {}"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/codemirror.aspx",
    "content": "<!DOCTYPE html>\r\n<html>\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n<head>\r\n\t<title>Codemirror</title>\r\n\t<script type=\"text/javascript\">\r\n\t\ttop.Application.declareTopLocal(window);\r\n\t</script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/lib/codemirror.js\"></script>\r\n    <script type=\"text/javascript\" src=\"../../../../lib/codemirror/addon/search/searchcursor.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/xml/xml.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/javascript/javascript.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/css/css.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/htmlmixed/htmlmixed.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/addon/mode/multiplex.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/htmlembedded/htmlembedded.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/clike/clike.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/razor/razor.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/sass/sass.js\"></script>\r\n    <script type=\"text/javascript\" src=\"../../../../lib/codemirror/mode/sql/sql.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"../../../../lib/codemirror/addon/dropmedia/dropmedia.js\"></script>\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"../../../../lib/codemirror/lib/codemirror.css\" />\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"codemirror.css\" />\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"theme/composite.css\" />\r\n\t<script type=\"text/javascript\" src=\"codemirror.js\"></script>\r\n</head>\r\n<body class=\"editor\">\r\n\t<textarea id=\"textarea\" rows=\"20\" cols=\"80\"></textarea>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/codemirror.css",
    "content": "html, body {\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\tbackground-color: white;\r\n\toverflow: hidden;\r\n\tmax-width: 2000px;\r\n}\r\n\r\n.CodeMirror {\r\n\tline-height: 16px;\r\n\tfont-size: 13px;\r\n\tfont-family: monospace;\r\n}\r\n\r\n.CodeMirror-scroll {\r\n\toverflow: auto;\r\n\theight: 100%; /* This is needed to prevent an IE[67] bug where the scrolled content      is visible outside of the scrolling box. */\r\n\tposition: relative;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/codemirror.js",
    "content": "window.onload = function () {\r\n\r\n\tvar div = document.getElementById(\"textarea\");\r\n\r\n\t// WebKit needs a short timeout here...\r\n\tsetTimeout(function () {\r\n\t\tvar editor = CodeMirror.fromTextArea(div, {\r\n\t\t\tmode: \"text/html\",\r\n\t\t\tindentUnit: 4,\r\n\t\t\tindentWithTabs: true,\r\n\t\t\textraKeys: {\"Tab\": \"indentMore\", \"Shift-Tab\": \"indentLess\"},\r\n            lineNumbers: true,\r\n            theme: \"composite\",\r\n            lineWrapping: false\r\n        });\r\n\r\n        if (localStorage.getItem(\"lineWrapping\") == null) {\r\n            editor.setOption(\"lineWrapping\", true);\r\n        } else {\r\n            editor.setOption(\"lineWrapping\", localStorage.getItem(\"lineWrapping\") === 'true');\r\n        }\r\n\r\n\t\tvar broadcaster = top.EventBroadcaster;\r\n\t\tvar messages = top.BroadcastMessages;\r\n\t\tif (broadcaster != undefined) {\r\n\t\t\tbroadcaster.broadcast(messages.CODEMIRROR_LOADED, {\r\n\t\t\t\tbroadcastWindow: window,\r\n\t\t\t\tcodemirrorEditor: editor\r\n\t\t\t});\r\n\t\t}\r\n\t}, 0);\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/codemirroreditor.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\"\r\nxmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\t<title>Composite.Management.SourceCodeEditor</title>\r\n\t<control:styleloader runat=\"server\" />\r\n\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"codemirror.css.aspx\" />\r\n\t<script type=\"text/javascript\" src=\"bindings/SourceEditorPageBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"bindings/SourceEditorToolBarBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"bindings/SourceEditorInsertToolbarButtonBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"bindings/SourceEditorFormatToolbarButtonBinding.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/SourceEditorFindAndReplaceToolBarButtonBinding.js\" ></script>\r\n    <script type=\"text/javascript\" src=\"bindings/SourceEditorToggleWordWrapToolbarButtonBinding.js\" ></script>\r\n</head>\r\n<body>\r\n\t<ui:broadcasterset>\r\n\t\t<ui:broadcaster id=\"broadcasterIsActive\" isdisabled=\"true\" />\r\n\t</ui:broadcasterset>\r\n\t<ui:bindingmappingset>\r\n\t\t<ui:bindingmapping element=\"ui:toolbarbutton\" binding=\"EditorToolBarButtonBinding\" />\r\n\t\t<ui:bindingmapping element=\"ui:selector\" binding=\"EditorSelectorBinding\" />\r\n\t</ui:bindingmappingset>\r\n\t<ui:popupset>\r\n\t\t<ui:popup id=\"insertpopup\">\r\n\t\t\t<ui:menubody>\r\n\t\t\t\t<ui:menugroup rel=\"insertions\">\r\n\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"pageurl\" label=\"${string:Composite.Web.SourceEditor:Insert.PageURL.Label}\"\r\n\t\t\t\t\t\timage=\"${icon:page}\" />\r\n\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"imageurl\" label=\"${string:Composite.Web.SourceEditor:Insert.ImageURL.Label}\"\r\n\t\t\t\t\t\timage=\"${icon:image}\" />\r\n\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"mediaurl\" label=\"${string:Composite.Web.SourceEditor:Insert.MediaURL.Label}\"\r\n\t\t\t\t\t\timage=\"${icon:perspective-media}\" />\r\n\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"frontendurl\" label=\"${string:Composite.Web.SourceEditor:Insert.FrontendURL.Label}\"\r\n\t\t\t\t\t\timage=\"${icon:page-template-template}\" />\r\n\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"functionmarkup\" label=\"${string:Composite.Web.SourceEditor:Insert.FunctionMarkup.Label}\"\r\n\t\t\t\t\t\timage=\"${icon:functioncall}\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\t</ui:popupset>\r\n\t<ui:page id=\"editorpage\" binding=\"SourceEditorPageBinding\">\r\n\t\t<ui:toolbar id=\"toolbar\" class=\"codemirroreditor-toolbar\" binding=\"SourceEditorToolBarBinding\">\r\n\t\t\t<ui:toolbarbody>\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:toolbarbutton id=\"insertbutton\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelInsert}\"\r\n\t\t\t\t\t\timage=\"${icon:insert}\" image-disabled=\"${icon:insert-disabled}\" observes=\"broadcasterIsActive\"\r\n\t\t\t\t\t\tpopup=\"insertpopup\" binding=\"SourceEditorInsertToolbarButtonBinding\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t<ui:toolbargroup id=\"xmltools\" hidden=\"true\">\r\n\t\t\t\t\t<ui:toolbarbutton id=\"formatbutton\" label=\"${string:Composite.Web.SourceEditor:Toolbar.Format.Label}\" tooltip=\"${string:Composite.Web.SourceEditor:Toolbar.Format.ToolTip}\" image=\"${icon:editor-formatsource}\"\r\n\t\t\t\t\t\timage-disabled=\"${icon:editor-formatsource-disabled}\" observes=\"broadcasterIsActive\"\r\n\t\t\t\t\t\tbinding=\"SourceEditorFormatToolbarButtonBinding\" />\r\n\t\t\t\t\t\t\t<ui:toolbarbutton id=\"wordwrapbutton\" label=\"${string:Composite.Web.SourceEditor:Toolbar.ToggleWordWrap.Label}\" tooltip=\"\" image=\"${icon:editor-formatsource}\"\r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:editor-formatsource-disabled}\" observes=\"broadcasterIsActive\"\r\n\t\t\t\t\t\t\t\tbinding=\"SourceEditorToggleWordWrapToolbarButtonBinding\" />\r\n                            <ui:toolbarbutton id=\"findandreplacebutton\" label=\"${string:Composite.Web.SourceEditor:Toolbar.FindAndReplace.Label}\" tooltip=\"\" image=\"${icon:editor-formatsource}\"\r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:editor-formatsource-disabled}\" observes=\"broadcasterIsActive\"\r\n\t\t\t\t\t\t\t\tbinding=\"SourceEditorFindAndReplaceToolBarButtonBinding\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t\t\t\tWhen loaded inside the wysiwygeditor, \r\n\t\t\t\t\t\t\t\t\t\tthe WysiwygEditorBinding will insert \r\n\t\t\t\t\t\t\t\t\t\ta toolbarbutton here! \r\n\t\t\t\t\t\t\t\t\t-->\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>\r\n\t\t<ui:flexbox id=\"editorflexbox\">\r\n\t\t\t<ui:window id=\"codemirrorwindow\" />\r\n\t\t</ui:flexbox>\r\n\r\n\t</ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/codemirroreditor.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\ninput#focusableinput { /* synchronize with wysiwygeditor.css */\r\n\tbackground-color: transparent;\r\n\tborder: none;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\tdisplay: none;\r\n}\r\nui|flexbox#editorflexbox {\r\n\tposition: relative;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/codemirrorfindandreplace.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\n\t<control:httpheaders ID=\"Httpheaders1\" runat=\"server\"/>\n\t<head>\n\t\t<title>${string:Composite.Web.SourceEditor:FindAndReplace.LabelTitle}</title>\n\t\t<control:styleloader ID=\"Styleloader1\" runat=\"server\"/>\n\t\t<control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\"/>\n        <script src=\"codemirrorfindandreplace.js\" type=\"text/javascript\"></script>\n\n           <style>\n            @namespace ui url(http://www.w3.org/1999/xhtml);\n\n            .checkBoxSettings {\n                float: left;\n            }\n\n            .left-label {\n                float: left;\n                margin-right: 20px;\n                width: 100px;\n            }\n\n            .checkBoxSettings ui|datalabeltext {\n                color:#999 !important;\n            }\n\n            ui|checkbox {\n            }\n          \n        </style>\n\n\t</head>\n\t<body>\n        <div>\n            <ui:broadcasterset>\n                <ui:broadcaster id=\"broadcasterFindNext\" isdisabled=\"false\"/>\n                <ui:broadcaster id=\"broadcasterReplace\" isdisabled=\"false\"/>\n                <ui:broadcaster id=\"broadcasterReplaceAll\" isdisabled=\"false\"/>\n\t\t    </ui:broadcasterset>\n\t\t    <ui:dialogpage label=\"${string:Composite.Web.SourceEditor:FindAndReplace.LabelTitle}\" image=\"${icon:composite}\" height=\"auto\" resizable=\"false\" binding=\"CodemirrorFindAndReplace\">\n                <ui:pagebody>\n                    <ui:flexbox>\n                        <ui:fields>\n                            <ui:fieldgroup>\n                                <ui:field>\n                                    <ui:fielddesc class=\"left-label\" label=\"${string:Composite.Web.SourceEditor:FindAndReplace.LabelFind}\"/>                            \n                                    <ui:fielddata>  \n                                        <ui:datainput id=\"searchFor\" default=\"true\">\n                                        </ui:datainput>\n                                    </ui:fielddata>\n                                </ui:field>\n                                <ui:field>\n                                    <ui:fielddesc class=\"left-label\" label=\"${string:Composite.Web.SourceEditor:FindAndReplace.LabelReplaceWith}\"/>\n                                    <ui:fielddata>\n                                        <ui:datainput id=\"replaceWith\"></ui:datainput>\n                                    </ui:fielddata>\n                                </ui:field>\n                            </ui:fieldgroup>\n                        </ui:fields>\n                         <div>\n                            <div class=\"checkBoxSettings\">\n                                <ui:field>                                \n                                    <ui:fielddata>\n                                        <ui:checkbox label=\"${string:Composite.Web.SourceEditor:FindAndReplace.LabelWholeWords}\" id=\"matchWholeWord\"></ui:checkbox>\n                                    </ui:fielddata>                                \n                                </ui:field>\n                            </div>\n                            <div class=\"checkBoxSettings\">\n                                <ui:field>                                \n                                    <ui:fielddata>\n                                        <ui:checkbox label=\"${string:Composite.Web.SourceEditor:FindAndReplace.LabelMatchCase}\" id=\"matchCase\"></ui:checkbox>\n                                    </ui:fielddata>\n                                </ui:field>     \n                            </div>\n                        </div>                      \n                    </ui:flexbox>     \n                </ui:pagebody>\n\t\t\t    <ui:dialogtoolbar>\n\t\t\t\t    <ui:toolbarbody align=\"right\" equalsize=\"true\">\n\t\t\t\t\t    <ui:toolbargroup>\n                            <ui:clickbutton id=\"buttonFindNext\" label=\"${string:Composite.Web.SourceEditor:FindAndReplace.ButtonFind}\" focusable=\"true\" observes=\"broadcasterFindNext\" />\n                            <ui:clickbutton id=\"buttonReplace\" label=\"${string:Composite.Web.SourceEditor:FindAndReplace.ButtonReplace}\" focusable=\"true\" observes=\"broadcasterReplace\" />\n                            <ui:clickbutton id=\"buttonReplaceAll\" label=\"${string:Composite.Web.SourceEditor:FindAndReplace.ButtonReplaceAll}\" focusable=\"true\" observes=\"broadcasterReplaceAll\"/>\n\t\t\t\t\t    </ui:toolbargroup>\n\t\t\t\t    </ui:toolbarbody>\n\t\t\t    </ui:dialogtoolbar>\n\t\t    </ui:dialogpage>\n        </div>\n\t</body>\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/codemirrorfindandreplace.js",
    "content": "﻿\n\nCodemirrorFindAndReplace.prototype = new DialogPageBinding;\nCodemirrorFindAndReplace.prototype.constructor = CodemirrorFindAndReplace;\nCodemirrorFindAndReplace.superclass = DialogPageBinding.prototype;\n\n\nfunction CodemirrorFindAndReplace() {\n        \n    this._cursor = null;\n    this.logger = SystemLogger.getLogger(\"CodemirrorFindAndReplace\");\n    this._findText = null;\n    this._replacementText = null;\n    this._caseSensitive = null;\n    this._matchWholeWord = null;\n    this._editor = null;\n    this._findTextBox = null;\n    this._replaceTextBox = null;\n    this._caseSensitiveCheckbox = null;\n    this._initialized = false;\n    this._textPosition = null;\n    this._matchWholeWordCheckbox = null;\n}\n\nCodemirrorFindAndReplace.prototype.toString = function () {    \n    return \"[CodemirrorFindAndReplace]\";\n}\n\nCodemirrorFindAndReplace.prototype.onBindingRegister = function () {\n    CodemirrorFindAndReplace.superclass.onBindingRegister.call(this);\n}\n\nCodemirrorFindAndReplace.prototype.setPageArgument = function (arg) {\n\n    CodemirrorFindAndReplace.superclass.setPageArgument.call(this);\n\n    this._editor = arg.editor;\n    this._findText = this._editor.getSelection();\n    this._replacementText = \"\";\n\n    var map = this.bindingWindow.bindingMap;\n\n    /*\n    * Locate key players.\n    */\n    this._findTextBox = map.searchFor;\n    this._replaceTextBox = map.replaceWith;\n    this._caseSensitiveCheckbox = map.matchCase;\n    this._matchWholeWordCheckbox = map.matchWholeWord;\n\n\n    if (!(app.FindAndReplaceOverride == undefined) && app.FindAndReplaceOverride.hasData()) {\n        this._findTextBox.setValue(app.FindAndReplaceOverride.findText);\n        this._replaceTextBox.setValue(app.FindAndReplaceOverride.replaceText);\n\n        if (app.FindAndReplaceOverride.matchCase)\n            this._caseSensitiveCheckbox.check(app.FindAndReplaceOverride.matchCase);\n\n        if (app.FindAndReplaceOverride.matchWholeWord)\n            this._matchWholeWordCheckbox.check(app.FindAndReplaceOverride.matchWholeWord);\n    }\n    else {\n        this._findTextBox.setValue(this._findText);\n        this._replaceTextBox.setValue(this._replacementText);\n    }\n\n    this._initialized = true;\n    map.broadcasterReplace.setDisabled(true);\n    map.broadcasterReplaceAll.setDisabled(true);\n}\n\nCodemirrorFindAndReplace.prototype.getChecked = function (control) {\n    if (control != null) {\n        if (control.getValue() === true)\n            return true;\n\n        if (control.getValue() == \"on\")\n            return true;\n    }\n    return false;\n}\n\nCodemirrorFindAndReplace.prototype.stateChanged = function () {\n        \n    return (this._findTextBox != null && this._findTextBox.getValue() != this._findText)\n        || this._cursor == null\n        || this.getChecked(this._caseSensitiveCheckbox) !== this._caseSensitive\n        || this.getChecked(this._matchWholeWordCheckbox) !== this._matchWholeWord\n        || this._cursor.to() != this._textPosition;\n\n}\n\nCodemirrorFindAndReplace.prototype.handleAction = function (action) {\n\n    CodemirrorFindAndReplace.superclass.handleAction.call(this, action);\n\n    if (action.type == ButtonBinding.ACTION_COMMAND) {\n\n        var binding = action.target;\n        var id = binding.bindingElement.id;\n\n        this._replacementText = this._replaceTextBox.getValue();\n\n        var foundItem = false;\n\n        switch (id) {\n            case \"buttonFindNext\":\n                this.findNextText();\n                action.consume();\n                break;\n            case \"buttonReplace\":\n                this.replaceText();\n                action.consume();\n                break;\n            case \"buttonReplaceAll\":\n                this.replaceAllFoundText();\n                action.consume();\n                break;\n        }\n    }\n}\n\n/**\n* Implements {IBroadcastListener}\n* @param {string} broadcast\n* @param {object} arg\n*/\nCodemirrorFindAndReplace.prototype.handleBroadcast = function (broadcast, arg) {\n\n    CodemirrorFindAndReplace.superclass.handleBroadcast.call(this, broadcast, arg);\n}\n\nCodemirrorFindAndReplace.prototype.findNextText = function () {\n\n    if (this.stateChanged()) {\n\n        this.setOptionsFromUserInput();\n\n        this._cursor = this._editor.getSearchCursor(this._findText, this._textPosition, this._caseSensitive);\n    }\n\n    var map = this.bindingWindow.bindingMap;\n    var foundItem = this._cursor.findNext();\n    if (foundItem) {\n\n        this._editor.setSelection(this._cursor.from(), this._cursor.to());\n        map.broadcasterReplace.setDisabled(false);\n        map.broadcasterReplaceAll.setDisabled(false);\n        this._textPosition = this._cursor.to()\n\n    }\n    else {\n        this._textPosition = false;\n        map.broadcasterReplace.setDisabled(true);\n        map.broadcasterReplaceAll.setDisabled(true);\n    }\n\n}\n\nCodemirrorFindAndReplace.prototype.replaceText = function () {\n    this._cursor.replace(this._replacementText);\n    this.findNextText();\n    this._textPosition = this._cursor.to();\n}\n\n\nCodemirrorFindAndReplace.prototype.replaceAllFoundText = function () {\n\n    this.setOptionsFromUserInput();\n\n    var infiniteGuard = 0;\n    this._cursor = this._editor.getSearchCursor(this._findText, false, this._caseSensitive);\n    while (this._cursor.findNext() && infiniteGuard <= 200) {        \n        var newStart = this._cursor.to();\n        this._cursor.replace(this._replacementText);\n        newStart.character = newStart.character + this._replacementText.length;\n        this._cursor = this._editor.getSearchCursor(this._findText, newStart, this._caseSensitive);\n        infiniteGuard = infiniteGuard + 1;\n    }\n\n    if (infiniteGuard >= 200)\n        alert(\"Error: Too many iterations occurred in the replaceAllFoundText method of CodemirrorFindAndReplace\");\n\n}\n\nCodemirrorFindAndReplace.prototype.setOptionsFromUserInput = function () {\n\n    if (this._textPosition == null)\n        this._textPosition = this._editor.getCursor();\n\n    this._caseSensitive = this.getChecked(this._caseSensitiveCheckbox);\n    this._matchWholeWord = this.getChecked(this._matchWholeWordCheckbox);\n\n    if (this._matchWholeWord == true) {\n        this._findText = new RegExp(\"\\\\b\" + this._findTextBox.getValue() + \"\\\\b\", this._caseSensitive ? \"\" : \"i\");\n    }\n    else {\n        this._findText = new RegExp(this._findTextBox.getValue(), this._caseSensitive ? \"\" : \"i\");\n    }\n\n    return;\n}\n\nfunction _CodemirrorFindAndReplace() { }\n\n_CodemirrorFindAndReplace.prototype = {\n    findText: \"\",\n    replaceText: \"\",\n    matchCase: false,\n    matchWholeWord: false,\n    hasData: function () {\n        return this.findText !== \"\" || this.replaceText !== \"\";\n    }\n}\n\n\n\n\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/codemirroreditor/theme/composite.css",
    "content": ".cm-s-composite span.cm-keyword {color: #00F;}\n.cm-s-composite span.cm-atom {color: #219;}\n.cm-s-composite span.cm-number {color: #164;}\n.cm-s-composite span.cm-def {color: #00f;}\n.cm-s-composite span.cm-variable {color: black;}\n.cm-s-composite span.cm-variable-2 {color: #05a;}\n.cm-s-composite span.cm-variable-3 {color: #0a5;}\n.cm-s-composite span.cm-property {color: black;}\n.cm-s-composite span.cm-operator {color: black;}\n.cm-s-composite span.cm-comment {color: #008000;}\n.cm-s-composite span.cm-string {color: #a11;}\n.cm-s-composite span.cm-string-2 {color: #f50;}\n.cm-s-composite span.cm-meta {color: #555;}\n.cm-s-composite span.cm-error {color: #f00;}\n.cm-s-composite span.cm-qualifier {color: #555;}\n.cm-s-composite span.cm-builtin {color: #30a;}\n.cm-s-composite span.cm-bracket {color: #cc7;}\n.cm-s-composite span.cm-tag {color: #170;}\n.cm-s-composite span.cm-attribute {color: #00c;}\n.cm-s-composite span.cm-razor {background-color: rgba(255, 255, 0, 0.3)}\n.cm-s-composite span.cm-razor-comment {color: #aaa;}"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/bindings/FieldsButtonDataBinding.js",
    "content": "FieldsButtonDataBinding.prototype = new DataBinding;\r\nFieldsButtonDataBinding.prototype.constructor = FieldsButtonDataBinding;\r\nFieldsButtonDataBinding.superclass = DataBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FieldsButtonDataBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FieldsButtonDataBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFieldsButtonDataBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FieldsButtonDataBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingRegister}\r\n */\r\nFieldsButtonDataBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tFieldsButtonDataBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.propertyMethodMap [ \"image\" ] = function ( image ) {\r\n\t\tvar button = this._buttonBinding;\r\n\t\tif ( button != null ) { \r\n\t\t\tif ( button.imageProfile != null ) {\r\n\t\t\t\tbutton.imageProfile.setDefaultImage ( image ); // DAMMIT!!!\r\n\t\t\t}\r\n\t\t\tbutton.setImage ( image );\r\n\t\t}\r\n\t} \r\n\t\r\n\tthis.propertyMethodMap [ \"label\" ] = function ( label ) {\r\n\t\tvar button = this._buttonBinding;\r\n\t\tif ( button != null ) {\r\n\t\t\tbutton.setLabel ( label );\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis.propertyMethodMap [ \"tooltip\" ] = function ( tooltip ) {\r\n\t\tvar button = this._buttonBinding;\r\n\t\tif ( button != null ) {\r\n\t\t\tbutton.setToolTip ( tooltip );\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = function ( isDisabled ) {\r\n\t\tvar button = this._buttonBinding;\r\n\t\tif ( button != null ) {\r\n\t\t\tbutton.setDisabled ( isDisabled );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingAttach}\r\n */\r\nFieldsButtonDataBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tFieldsButtonDataBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tvar button = this.add ( ClickButtonBinding.newInstance ( this.bindingDocument ));\r\n\t\r\n\tbutton.isFocusable = false;\r\n\tbutton.setProperty ( \"image\", this.getProperty ( \"image\" ));\r\n\tbutton.setProperty ( \"label\", this.getProperty ( \"label\" ));\r\n\t\r\n\tvar isDisabled = this.getProperty ( \"isdisabled\" );\r\n\tif ( isDisabled ) {\r\n\t\tbutton.setProperty ( \"isdisabled\", true );\r\n\t\tthis.isFocusable = false;\r\n\t}\r\n\t\r\n\tbutton.attach ();\r\n\tthis._buttonBinding = button;\r\n\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND );\r\n\t\r\n\t// garbage going on here!\r\n\tvar callbackid = this.getProperty ( \"callbackid\" );\r\n\tif ( callbackid != null ) {\r\n\t\tBinding.dotnetify ( this ); \r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nFieldsButtonDataBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tFieldsButtonDataBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\tthis.focus ();\r\n\t\t\tthis.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n//ABSTRACT METHODS ............................................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nFieldsButtonDataBinding.prototype.validate = function () {\r\n\t\r\n\treturn true;\r\n};\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nFieldsButtonDataBinding.prototype.manifest = function () {};\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nFieldsButtonDataBinding.prototype.getValue = function () {};\r\n\r\n/**\r\n * Set value.\r\n * @implements {IData}\r\n * @param {string} value\r\n */\r\nFieldsButtonDataBinding.prototype.setValue = function () {};\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nFieldsButtonDataBinding.prototype.getResult = function () {};\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} value\r\n */\r\nFieldsButtonDataBinding.prototype.setResult = function () {};"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/bindings/FunctionEditorPageBinding.js",
    "content": "FunctionEditorPageBinding.prototype = new PageBinding;\r\nFunctionEditorPageBinding.prototype.constructor = FunctionEditorPageBinding;\r\nFunctionEditorPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FunctionEditorPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FunctionEditorPageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isSourceMode = false;\r\n\t\r\n\t/**\r\n\t * Enable flexbox behavior.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFlexible = true;\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFunctionEditorPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FunctionEditorPageBinding]\";\r\n}\r\n\r\nFunctionEditorPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tFunctionEditorPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\tthis.addActionListener ( Binding.ACTION_DIRTY );\r\n\tthis.addActionListener( CodeMirrorEditorBinding.ACTION_INITIALIZED ); \r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overwrites {EditorPageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nFunctionEditorPageBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tFunctionEditorPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\t\r\n\t\tcase Binding.ACTION_DIRTY :\r\n\t\t\tif ( action.target.getID () == \"switchbutton\" ) {\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase PageBinding.ACTION_DOPOSTBACK :\r\n\t\t\tif (action.target.getID() == \"switchbutton\" && !this._isSourceMode) {\r\n\t\t\t\tthis._cover ( false );\r\n\t\t\t\tvar decks = this.bindingWindow.bindingMap.decks;\r\n\t\t\t\tdecks.select ( \"sourcedeck\" );\r\n\t\t\t\tthis._isSourceMode = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase CodeMirrorEditorBinding.ACTION_INITIALIZED :\r\n\t\t\tthis.removeActionListener ( action.type );\r\n\t\t\tthis._buildSwitchButton ( action.target );\r\n\t\t\taction.consume ();\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * for some reason, UI may remain locked at this point \r\n\t\t\t * execpt on the machine belonging to yours truly. \r\n\t\t\t * Could we have a missing file checkin? Let's hack it:\r\n\t\t\t */\r\n\t\t\tApplication.unlock ( this, true );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * THIS IS PRETTY MUCH A COPY-PASTE FROM VisualEditorPageBinding.js\r\n * TODO: Consider erecting an interface for adding this kind of button \r\n * (injecting the switch-button on the sourceeditor toolbar).\r\n * @param {SourceEditorBinding} editor\r\n */\r\nFunctionEditorPageBinding.prototype._buildSwitchButton = function ( editor ) {\r\n\t\r\n\tvar win = editor.getContentWindow ();\r\n\tvar doc = editor.getContentDocument ();\r\n\t\r\n\tvar button = ToolBarButtonBinding.newInstance ( doc );\r\n\tbutton.isEditorControlBinding = false;\r\n\tbutton.setLabel( \"${string:Composite.Web.FormControl.FunctionCallsDesigner:ToolBar.LabelDesign}\" );\r\n\tbutton.flip ( true );\r\n\t//button.imageProfile = new ImageProfile ({\r\n\t//\timage : \"${icon:editor-designview}\",\r\n\t//\timageDisabled : \"${icon:editor-designview-disabled}\" \r\n\t//});\r\n\r\n\tvar self = this;\r\n\tbutton.oncommand = function () {\r\n\t\tif ( editor.validate ()) {\r\n\t\t\tself._switchBack ();\r\n\t\t}\r\n\t};\r\n\t\r\n\twin.bindingMap.toolbar.addRight ( button );\r\n\tbutton.attach ();\r\n}\r\n\r\n/**\r\n * Switching from source to forms mode. \r\n * The SourceEditorBinding must be validated at this point.\r\n */\r\nFunctionEditorPageBinding.prototype._switchBack = function () {\r\n\t\r\n\tvar callbackbutton = this.bindingWindow.bindingMap.switchbutton;\r\n\tvar decks = this.bindingWindow.bindingMap.decks;\r\n\t\r\n\tthis._cover ( true );\r\n\t\r\n\tcallbackbutton.setProperty ( \"callbackarg\", \"design\" );\r\n\tcallbackbutton.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\tdecks.select ( \"designdeck\" );\r\n\tcallbackbutton.setProperty ( \"callbackarg\", \"source\" );\r\n\t\r\n\tthis._isSourceMode = false;\r\n}\r\n\r\n/**\r\n * Show a cover; and hide it when updates are finished.\r\n * @param {boolean} isSourceMode\r\n */\r\nFunctionEditorPageBinding.prototype._cover = function ( isSourceMode ) {\r\n\t\r\n\tvar doc = this.bindingDocument;\r\n\tvar root = doc.documentElement;\r\n\tvar cover = this.bindingWindow.bindingMap.formscover;\r\n\tvar editor = this.bindingWindow.bindingMap.sourceeditor;\r\n\t\r\n\tvar handler = {\r\n\t\thandleEvent : function ( e ) {\r\n\t\t\tif ( DOMEvents.getTarget ( e ) == root ) {\r\n\t\t\t\tif ( isSourceMode ) {\r\n\t\t\t\t\tDOMEvents.removeEventListener ( \r\n\t\t\t\t\t\tdoc, \r\n\t\t\t\t\t\tDOMEvents.AFTERUPDATE, \r\n\t\t\t\t\t\thandler \r\n\t\t\t\t\t);\r\n\t\t\t\t\tcover.hide ();\r\n\t\t\t\t} else {\r\n\t\t\t\t\teditor.cover ( false );\r\n\t\t\t\t}\r\n\t\t\t} \r\n\t\t}\r\n\t}\r\n\tDOMEvents.addEventListener ( \r\n\t\tdoc, \r\n\t\tDOMEvents.AFTERUPDATE, \r\n\t\thandler \r\n\t);\r\n\t\r\n\tif ( isSourceMode ) {\r\n\t\tcover.show ();\r\n\t} else {\r\n\t\teditor.cover ( true );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/bindings/ToolBarButtonDataBindingAddNew.js",
    "content": "ToolBarButtonDataBindingAddNew.prototype = new ToolBarButtonBinding;\r\nToolBarButtonDataBindingAddNew.prototype.constructor = ToolBarButtonDataBindingAddNew;\r\nToolBarButtonDataBindingAddNew.superclass = ToolBarButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ToolBarButtonDataBindingAddNew () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ToolBarButtonDataBindingAddNew\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._dialoglabel = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nToolBarButtonDataBindingAddNew.prototype.toString = function () {\r\n\r\n\treturn \"[ToolBarButtonDataBindingAddNew]\";\r\n}\r\n\r\nToolBarButtonDataBindingAddNew.prototype.oncommand = function () {\r\n\t\r\n\t// TODO: move the view handle to binding markup as a property... \r\n\tvar showWidget = this.getProperty ( \"selectwidget\" );\r\n\tvar def = ViewDefinitions [ showWidget ? \"Composite.Management.WidgetFunctionSelectorDialog\" : \"Composite.Management.FunctionSelectorDialog\" ];\r\n\t\r\n\tthis._dialoglabel = def._label;\r\n\tdef.argument.label = this.getProperty ( \"dialoglabel\" );\r\n\tdef.argument.nodes[0].search = this.getProperty(\"providersearch\");\r\n\r\n\tvar self = this;\r\n\tdef.handler = {\r\n\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\tdelete def.argument.nodes [ 0 ].search;\r\n\t\t\tdef.argument.label = self._dialoglabel;\r\n\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\tself.shadowTree.dotnetinput.value = result.getFirst ();\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tself.dispatchAction ( Binding.ACTION_DIRTY )\r\n\t\t\t\t\tself.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tdef.argument.selectedToken = null;\r\n\r\n\tif (showWidget) {\r\n\t\tTreeService.GetWidgetEntityToken(this.shadowTree.dotnetinput.value, function (result) {\r\n\t\t\tdef.argument.selectedToken = result;\r\n\t\t\tDialog.invokeDefinition(def);\r\n\t\t});\r\n\t}\r\n\telse {\r\n\t\tDialog.invokeDefinition(def);\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/functioncalleditor.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Inherits=\"functioneditor\" Language=\"C#\" AutoEventWireup=\"True\" EnableEventValidation=\"true\" ValidateRequest=\"false\" CodeFile=\"functioncalleditor.aspx.cs\" %>\r\n<%@ Register TagPrefix=\"aspui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.FunctionCallEditor</title>\r\n        \r\n        <control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n        <control:httpheaders runat=\"server\" />\r\n        \r\n\t\r\n\t\t<script type=\"text/javascript\" src=\"bindings/FunctionEditorPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/ToolBarButtonDataBindingAddNew.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/FieldsButtonDataBinding.js\"></script>\r\n\t\t\r\n\t\t<ui:bindingmappingset>\r\n\t\t\t<ui:bindingmapping element=\"ui:fieldsbutton\" binding=\"FieldsButtonDataBinding\"/>\r\n\t\t</ui:bindingmappingset>\r\n\t\t\r\n\t</head>\r\n\t<body>\r\n\t\t<form id=\"Form1\" runat=\"server\" class=\"updateform updatezone\">\r\n\t\t\t<ui:page id=\"functioneditorpage\" binding=\"FunctionEditorPageBinding\" class=\"with-top-toolbar\"> <!--  fitasdialogsubpage=\"false\" -->\r\n\r\n                <aspui:Feedback runat=\"server\" \r\n                    ID=\"ctlFeedback\"\r\n                    OnCommand=\"OnMessage\" />\r\n\r\n\t\t\t\t<ui:decks id=\"decks\">\r\n\t\t\t\t\t<ui:deck id=\"designdeck\">\r\n\t\t\t\r\n\t\t\t\t\t\t<ui:toolbar id=\"toolbar\">\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup id=\"toolbargroup\">\r\n\t\t\t\t\t\t\t\t\r\n                                    <aspui:Generic runat=\"server\" \r\n\t\t\t                        \tbinding=\"ToolBarButtonDataBindingAddNew\"\r\n\t\t\t                            TagName=\"ui:toolbarbutton\" \r\n\t\t\t                            id=\"btnSetNewFunction\"\r\n\t\t\t                            callbackid=\"btnSetNewFunction\" \r\n\t\t\t                            label=\"${string:Composite.Web.FormControl.FunctionCallsDesigner:SetNewButtonLabel}\" \r\n\t\t\t                            image=\"${icon:functioncall}\" \r\n\t\t\t                            image-disabled=\"${icon:functioncall}\" \r\n\t\t\t                            disabled=\"false\" \r\n\t\t\t                            value=\"(not-empty!)\"/>\r\n\r\n\t\t\t                        <aspui:Generic runat=\"server\" \r\n\t\t\t                        \tbinding=\"ToolBarButtonDataBindingAddNew\"\r\n\t\t\t                            TagName=\"ui:toolbarbutton\" \r\n\t\t\t                            id=\"btnAddFunction\"\r\n\t\t\t                            callbackid=\"btnAddFunction\" \r\n\t\t\t                            label=\"${string:Composite.Web.FormControl.FunctionCallsDesigner:AddNewButtonLabel}\" \r\n\t\t\t                            image=\"${icon:add}\" \r\n\t\t\t                            image-disabled=\"${icon:add}\" \r\n\t\t\t                            disabled=\"false\" \r\n\t\t\t                            value=\"(not-empty!)\"/>\r\n\t\t\t                            \r\n\t\t\t                        <aspui:Generic runat=\"server\" \r\n\t\t\t                            TagName=\"ui:toolbarbutton\" \r\n\t\t\t                            id=\"btnDeleteFunction\" \r\n\t\t\t                            callbackid=\"btnDeleteFunction\" \r\n\t\t\t                            label=\"${string:Composite.Web.FormControl.FunctionCallsDesigner:DeleteButtonLabel}\" \r\n\t\t\t                            image=\"${icon:delete}\" \r\n\t\t\t                            image-disabled=\"${icon:delete-disabled()}\" \r\n\t\t\t                            disabled=\"false\"/>\r\n\t\t\t                            \r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<%--<ui:toolbargroup rel=\"developermode\">\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton \r\n\t\t\t\t\t\t\t\t\t\timage=\"${icon:systemlog}\" \r\n\t\t\t\t\t\t\t\t\t\tlabel=\"DEBUG\" tootltip=\"Dump innerHTML to the System Log...\" \r\n\t\t\t\t\t\t\t\t\t\toncommand=\"this.logger.debug(document.body.innerHTML)\" />\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>--%>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<aspui:Generic runat=\"server\"\r\n                                        TagName=\"ui:toolbarbutton\"\r\n\t\t\t\t\t\t\t\t\t\tcallbackid=\"switchbutton\"\r\n\t\t\t\t\t\t\t\t\t\tcallbackarg=\"source\"\r\n\t\t\t\t\t\t\t\t\t \tclientid=\"switchbutton\"\r\n\t\t\t\t\t\t\t\t\t\timage=\"${icon:editor-sourceview}\" \r\n\t\t\t\t\t\t\t\t\t\timage-disabled=\"${icon:editor-sourceview-disabled}\"\r\n\t\t\t\t\t\t\t\t\t\t\r\n                                        />\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup id=\"basicgroup\">\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton id=\"basicbutton\" image=\"${icon:editor-plainedit}\" />\r\n\t\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:flexbox id=\"formsflexbox\" style=\"position:relative;\"> <!-- contain the cover -->\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<ui:cover id=\"formscover\" hidden=\"true\"/>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"4:5\" forcefitness=\"true\">\r\n\t\t\t\t\t\t\t\t<ui:splitpanel id=\"treepanel\" forcefitness=\"true\">\r\n\t\t\t\t\t\t\t\t\t<asp:PlaceHolder ID=\"TreePlaceholder\" runat=\"server\"/>\r\n\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\t\t\t\t<ui:splitpanel id=\"fieldspanel\" forcefitness=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:scrollbox id=\"scrollbox\" class=\"padded-sm\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t    <asp:MultiView ID=\"mlvMain\" runat=\"server\">\r\n\t\t\t\t\t\t\t\t\t      <asp:View ID=\"viewParameter\" runat=\"server\">\r\n\t\t\t\t\t\t\t\t\t      \r\n\t\t\t\t\t\t\t\t\t\t\t<ui:pagehead id=\"pagehead\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:pageheading id=\"fieldname\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:Label runat=\"server\" ID=\"txtFieldName\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:pageheading>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:pagedescription id=\"fieldtype\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span>&#8592;</span> <asp:Label runat=\"server\" ID=\"txtFieldType\" EnableViewState=\"false\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:pagedescription>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:pagedescription id=\"fielddesc\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:Label runat=\"server\" ID=\"txtFieldDescription\"  />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:pagedescription>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:pagehead>\r\n\t\t\t\t\t\t\t\t\t      \t\r\n\t\t                                      <ui:fields id=\"fieldsData\" style=\"padding-bottom: 9px;\"> <!-- padding hacks resize problem in dialog :( --> \r\n\t\t                                     \r\n\t\t                                          <ui:fieldgroup id=\"optionsfieldgroup\" class=\"options-filedgroup\">\r\n\t\t                                              <ui:field>\r\n\t\t                                                  <ui:fielddesc><%= Server.HtmlEncode(GetString(\"ParameterTypeLabel\")) %></ui:fielddesc>\r\n\t\t                                                  <ui:fielddata id=\"optionsfielddata\">\r\n\t\t                                                      <aspui:Generic TagName=\"ui:fieldsbutton\" runat=\"server\" \r\n\t\t                                                          id=\"btnDefault\" label=\"${string:Composite.Web.FormControl.FunctionCallsDesigner:ParameterTypeDefaultLabel}\" \r\n\t\t                                                          callbackid=\"btnDefault\"  />\r\n\t\t                                                          \r\n\t\t                                                      <aspui:Generic TagName=\"ui:fieldsbutton\" runat=\"server\" \r\n\t\t                                                           id=\"btnConstant\" label=\"${string:Composite.Web.FormControl.FunctionCallsDesigner:ParameterTypeConstantLabel}\" callbackid=\"btnConstant\" />\r\n\t\t                                                           \r\n\t\t                                                      <aspui:Generic TagName=\"ui:fieldsbutton\" runat=\"server\" \r\n\t\t                                                           id=\"btnInputParameter\" label=\"${string:Composite.Web.FormControl.FunctionCallsDesigner:ParameterTypeInputParameterLabel}\" callbackid=\"btnInputParameter\" />\r\n\t\t                                                      \r\n\t                                                             <aspui:PostBackDialog runat=\"server\" \r\n\t                                                                   EnableViewState=\"false\"\r\n\t                                                                   ID=\"btnFunctionCall\" \r\n\t                                                                   label=\"${string:Composite.Web.FormControl.FunctionCallsDesigner:ParameterTypeFunctionLabel}\" \r\n\t                                                                   callbackid=\"btnFunctionCall\"\r\n\t                                                                   handle=\"Composite.Management.FunctionSelectorDialog\" \r\n\t                                                                   binding=\"ViewDefinitionPostBackDataDialogBinding\"/>\r\n\t\t                                                  </ui:fielddata>\r\n\t\t                                              </ui:field>\r\n\t\t                                          </ui:fieldgroup>\r\n\t\t                                          \r\n\t\t                                          <asp:MultiView ID=\"mlvWidget\" runat=\"server\" EnableViewState=\"true\">\r\n\t\t                                          \r\n\t\t                                            <asp:View ID=\"viewWidget_Constant\" runat=\"server\">\r\n\t\t\t                                            <asp:PlaceHolder runat=\"server\" ID=\"plhWidget\" EnableViewState=\"true\" />                                             \r\n\t\t                                            </asp:View>\r\n\t\t                                            \r\n\t\t                                            <asp:View ID=\"viewWidget_InputParameter\" runat=\"server\">\r\n\t\t                                                \r\n\t\t                                             <ui:fieldgroup id=\"parameternamefieldgroup\" class=\"width-md\">\r\n\t\t                                                 <ui:field>\r\n\t\t            \t\t\t\t\t                    <ui:fielddesc><%= Server.HtmlEncode(GetString(\"ParameterNameLabel\")) %></ui:fielddesc>\r\n\t\t            \t\t\t\t\t                    <ui:fieldhelp></ui:fieldhelp>\r\n\t\t                \t\t\t\t\t                    <ui:fielddata>\r\n\t\t                                                             <aspui:Selector runat=\"server\" EnableViewState=\"false\" \r\n\t\t                \t\t\t\t\t\t                    \tID=\"lstInputParameterName\" \r\n\t\t                \t\t\t\t\t\t                    \tInputType=\"ProgrammingIdentifier\" />\r\n\t\t                \t\t\t\t\t                    </ui:fielddata>\r\n\t\t                \t\t\t\t                    </ui:field>\r\n\t\t                                                </ui:fieldgroup>\r\n\t\t                                                \r\n\t\t                                            </asp:View>\r\n\t\t                                          </asp:MultiView>\r\n\t\t                                          \r\n\t\t                                        </ui:fields>\r\n\t\t\t                                        \r\n\t\t\t                              </asp:View>\r\n\t\t\t                              <asp:View ID=\"viewFunction\" runat=\"server\">\r\n\t\t\t                              \t\r\n\t\t\t                              \t<ui:pagehead id=\"pagehead\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:pageheading id=\"fieldname\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:Label ID=\"txtFunctionName\" runat=\"server\" EnableViewState=\"false\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:pageheading>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:pagedescription id=\"fieldtype\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span>&#8592;</span> <asp:Label runat=\"server\" ID=\"txtFunctionReturnType\" EnableViewState=\"false\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:pagedescription>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:pagedescription id=\"fielddesc\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:Label runat=\"server\" ID=\"txtFunctionDescription\" EnableViewState=\"false\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:pagedescription>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:pagehead>\r\n\t\t\t                            \r\n\t\t\t                                <asp:PlaceHolder id=\"plhEditLocalName\" runat=\"server\">  \r\n\t\t\t                                     <ui:fields>\r\n\t\t\t                                             <ui:fieldgroup id=\"localnamefieldgroup\"> <!--  label=\"<%= Server.HtmlEncode(this.FunctionLocalNameGroupLabel) %>\" -->\r\n\t\t\t                                                <ui:field>\r\n\t\t\t           \t\t\t\t\t                    <ui:fielddesc><%= Server.HtmlEncode(FunctionLocalNameLabel) %></ui:fielddesc>\r\n\t\t\t           \t\t\t\t\t                    <ui:fieldhelp><%= Server.HtmlEncode(FunctionLocalNameHelp) %></ui:fieldhelp>\r\n\t\t\t   \t\t        \t\t\t                    <ui:fielddata>\r\n\t\t\t   \t\t        \t\t\t                    \t<!-- InputType=\"ProgrammingIdentifier\" removed, see bug 2698 -->\r\n\t\t\t           \t\t\t\t\t\t                    <aspui:DataInput \r\n\t\t\t           \t\t\t\t\t\t                    \tID=\"txtLocalName\" runat=\"server\" \r\n\t\t\t           \t\t\t\t\t\t                    \tClient_autopost=\"true\"/>\r\n\t\t\t       \t\t\t\t\t                         </ui:fielddata>\r\n\t\t\t       \t\t\t\t                       </ui:field>\r\n\t\t\t                                        </ui:fieldgroup>\r\n\t\t\t                                      </ui:fields>\r\n\t\t\t                                 </asp:PlaceHolder>   \r\n\t\t\t                                \r\n\t\t\t                              </asp:View>\r\n\t\t\t                               <asp:View ID=\"viewNoSelection\" runat=\"server\"/>\r\n\t\t\t                            </asp:MultiView>\r\n\t\t\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t</ui:flexbox>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t<ui:deck id=\"sourcedeck\" lazy=\"true\">\r\n\t\t\t\t\t\t<aspui:Generic runat=\"server\"\r\n                            ID=\"ctlSourceEditor\"\r\n                            TagName=\"ui:sourceeditor\"\r\n\t\t\t\t\t\t\tclientid=\"sourceeditor\" \r\n\t\t\t\t\t\t\tsyntax=\"xml\" \r\n\t\t\t\t\t\t\tvalidator=\"http://www.composite.net/ns/function/1.0\"\r\n                            HasCallbackId=\"true\" />\r\n\t\t\t\t\t</ui:deck>\r\n\t\t\t\t</ui:decks>\r\n\t\t\t\t\t\r\n\t\t\t</ui:page>\r\n\r\n            <asp:HiddenField id=\"fldMode\" runat=\"server\" />\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/functioncalleditor.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing System.Web.UI;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.XPath;\r\nusing System.Xml.Xsl;\r\nusing Composite;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Forms.WebChannel;\r\nusing Composite.Core;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.FunctionCallEditor;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.Core.Xml;\r\nusing Composite.Functions;\r\nusing Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories;\r\n\r\n\r\n/// <summary>\r\n/// Summary description for functioneditor\r\n/// </summary>\r\npublic partial class functioneditor : Composite.Core.WebClient.XhtmlPage\r\n{\r\n    private static readonly TimeSpan SessionExpirationPeriod = TimeSpan.FromDays(4.0);\r\n\r\n    private static readonly string XsltExtensionObjectNamespace = \"functioncalleditor\";\r\n    private const string LogTitle = \"FunctionCallEditor\";\r\n\r\n    private static readonly XName ParameterNodeXName = Namespaces.Function10 + \"param\";\r\n    private static readonly XName FunctionNodeXName = Namespaces.Function10 + \"function\";\r\n    private static readonly XName WidgetFunctionNodeXName = Namespaces.Function10 + \"widgetfunction\";\r\n\r\n    private static readonly string SessionStateProviderQueryKey = \"StateProvider\";\r\n    private static readonly string StateIdQueryKey = \"Handle\";\r\n\r\n    private static readonly string SelectedInputParameter_AttributeName = \"inputParameter\";\r\n\r\n    private static readonly string GetInputParameterFunctionName = \"Composite.Utils.GetInputParameter\";\r\n    private static readonly string GetInputParameterFunctionParameterName = \"InputParameterName\";\r\n\r\n    private readonly XNamespace functionDescriptionNs = \"#functionDescription\";\r\n    private static readonly string FunctionMarkupSessionKey = \"fmsk\";\r\n\r\n    // Localization\r\n    protected string ReturnTypeLabel { get { return GetString(\"ReturnTypeLabel\"); } }\r\n    protected string AddNewFunctionDialogLabel { get { return GetString(\"AddNewFunctionDialogLabel\"); } }\r\n    protected string SetNewFunctionDialogLabel { get { return GetString(\"SetNewFunctionDialogLabel\"); } }\r\n    protected string SelectFunctionDialogLabel { get { return GetString(\"ComplexFunctionCallDialogLabel\"); } }\r\n    protected string FunctionLocalNameGroupLabel { get { return GetString(\"FunctionLocalNameGroupLabel\"); } }\r\n    protected string FunctionLocalNameLabel { get { return GetString(\"FunctionLocalNameLabel\"); } }\r\n    protected string FunctionLocalNameHelp { get { return GetString(\"FunctionLocalNameHelp\"); } }\r\n\r\n    private enum ParameterValueType\r\n    {\r\n        Default = 0, Constant, InputParameter, FunctionCall\r\n    }\r\n\r\n    private enum EditorModeEnum\r\n    {\r\n        Design = 0,\r\n        Source = 1\r\n    }\r\n\r\n    private IFunctionCallEditorState _state;\r\n    private XDocument _functionMarkup;\r\n\r\n    private EditorModeEnum EditorMode\r\n    {\r\n        get\r\n        {\r\n            return fldMode.Value == \"source\" ? EditorModeEnum.Source : EditorModeEnum.Design;\r\n        }\r\n        set\r\n        {\r\n            fldMode.Value = (value == EditorModeEnum.Source) ? \"source\" : \"design\";\r\n        }\r\n    }\r\n\r\n    private Guid? _stateId;\r\n    private Guid StateId\r\n    {\r\n        get\r\n        {\r\n            if (_stateId == null)\r\n            {\r\n                string stateIdStr = Request.QueryString[StateIdQueryKey];\r\n\r\n                Guid stateId;\r\n                if (!SessionStateProviderName.IsNullOrEmpty()\r\n                    && !stateIdStr.IsNullOrEmpty()\r\n                    && Guid.TryParse(stateIdStr, out stateId))\r\n                {\r\n                    _stateId = stateId;\r\n                }\r\n                else\r\n                {\r\n                    _stateId = Guid.Empty;\r\n                }\r\n            }\r\n\r\n            return _stateId.Value;\r\n        }\r\n    }\r\n\r\n    private string SessionStateProviderName\r\n    {\r\n        get\r\n        {\r\n            return Request.QueryString[SessionStateProviderQueryKey];\r\n        }\r\n    }\r\n\r\n    bool IsInTestMode\r\n    {\r\n        get { return StateId == Guid.Empty; }\r\n    }\r\n\r\n    protected XDocument FunctionMarkup\r\n    {\r\n        get\r\n        {\r\n            if (_functionMarkup == null)\r\n            {\r\n                if (!IsInTestMode)\r\n                {\r\n                    throw new InvalidOperationException();\r\n                }\r\n\r\n                string serializedMarkup = ViewState[FunctionMarkupSessionKey] as string;\r\n\r\n                byte[] bytes = System.Text.Encoding.UTF8.GetBytes(serializedMarkup);\r\n                using (var stream = new MemoryStream(bytes))\r\n                {\r\n                    _functionMarkup = XDocument.Load(stream);\r\n                }\r\n\r\n                PrettifyXmlNamespacePrefixes(_functionMarkup);\r\n            }\r\n\r\n            return _functionMarkup;\r\n        }\r\n        set\r\n        {\r\n            _functionMarkup = value;\r\n        }\r\n    }\r\n\r\n    private static void PrettifyXmlNamespacePrefixes(XContainer functionTree)\r\n    {\r\n        var nestedFunctions = functionTree.Descendants(Namespaces.Function10 + \"function\").Where(\r\n            f => f.Parent.Name.Namespace != Namespaces.Function10 && f.Attribute(XNamespace.Xmlns + \"f\") == null).ToList();\r\n\r\n        foreach (var nestedFunction in nestedFunctions)\r\n        {\r\n            nestedFunction.Add(new XAttribute(XNamespace.Xmlns + \"f\", Namespaces.Function10));\r\n        }\r\n\r\n        functionTree.Descendants(Namespaces.Function10 + \"function\").Attributes(\"xmlns\").Remove();\r\n    }\r\n\r\n    // Contains info that is used while building ID-s for treeview nodes\r\n    private Dictionary<XElement, string> _xElementTreeNodeIDs;\r\n\r\n    // Contains id map, an example is \"/function[1]\" => some guid\r\n    private Dictionary<string, string> TreePathToIdMapping\r\n    {\r\n        get\r\n        {\r\n            return ViewState[\"TreeNodePathToIdMapping\"] as Dictionary<string, string>;\r\n        }\r\n        set\r\n        {\r\n            ViewState[\"TreeNodePathToIdMapping\"] = value;\r\n        }\r\n    }\r\n\r\n    string SelectedNode\r\n    {\r\n        get\r\n        {\r\n            return ViewState[\"SelectedTreeNode\"] as string;\r\n        }\r\n        set\r\n        {\r\n            ViewState[\"SelectedTreeNode\"] = value;\r\n        }\r\n    }\r\n\r\n    HashSet<string> InputParameterNodeIDs\r\n    {\r\n        get { return ViewState[\"InputParameterNodeIDs\"] as HashSet<string>; }\r\n        set { ViewState[\"InputParameterNodeIDs\"] = value; }\r\n    }\r\n\r\n    bool InputParameterSelectorIsShown\r\n    {\r\n        get { return (bool)(ViewState[\"InputParameterSelectorIsShown\"] ?? false); }\r\n        set { ViewState[\"InputParameterSelectorIsShown\"] = value; }\r\n    }\r\n\r\n    bool WidgetIsShown\r\n    {\r\n        get { return (bool)(ViewState[\"WidgetIsShown\"] ?? false); }\r\n        set { ViewState[\"WidgetIsShown\"] = value; }\r\n    }\r\n\r\n    bool LocalFunctionNameIsShown\r\n    {\r\n        get { return (bool)(ViewState[\"LocalFunctionNameIsShown\"] ?? false); }\r\n        set { ViewState[\"LocalFunctionNameIsShown\"] = value; }\r\n    }\r\n\r\n    private void Page_Load(object sender, EventArgs args)\r\n    {\r\n        this.Error += Page_Error;\r\n\r\n        if (!IsInTestMode)\r\n        {\r\n            LoadFunctions();\r\n        }\r\n\r\n        if (!IsPostBack)\r\n        {\r\n            InitializeTreeView();\r\n        }\r\n\r\n        _xElementTreeNodeIDs = TreeHelper.GetElementToIdMap(FunctionMarkup, TreePathToIdMapping);\r\n\r\n        string eventTarget = Request.Form[\"__EVENTTARGET\"];\r\n        string eventArgument = Request.Form[\"__EVENTARGUMENT\"];\r\n\r\n        string nodePath = null;\r\n        Guid temp;\r\n        if (Guid.TryParse(eventTarget, out temp))\r\n        {\r\n            nodePath = TreePathToIdMapping.Where(pair => pair.Value == eventTarget).Select(pair => pair.Key).FirstOrDefault();\r\n        }\r\n\r\n        // Treeview click\r\n        if (nodePath != null\r\n            || eventTarget == string.Empty\r\n            || ctlFeedback.IsPosted\r\n            || (eventTarget == \"switchbutton\" || eventArgument == \"source\"))\r\n        {\r\n            bool isValid = true;\r\n\r\n            // If node is changed, updating changed parameter's value\r\n            if (!SelectedNode.IsNullOrEmpty())\r\n            {\r\n                if (WidgetIsShown)\r\n                {\r\n                    // TODO: insert validation logic\r\n                    UpdateParameterValueFromWidget();\r\n                }\r\n                else if (LocalFunctionNameIsShown)\r\n                {\r\n                    UpdateFunctionLocalName();\r\n                }\r\n                else if (InputParameterSelectorIsShown)\r\n                {\r\n                    UpdateInputParameterName();\r\n                }\r\n            }\r\n\r\n            if (isValid && nodePath != null)\r\n            {\r\n                SelectedNode = nodePath;\r\n            }\r\n        }\r\n        else\r\n        {\r\n            ParameterValueType? newParameterValueType = null;\r\n\r\n            switch (eventTarget)\r\n            {\r\n                case \"btnSetNewFunction\": BtnSetNewFunctionCallClicked();\r\n                    break;\r\n                case \"btnAddFunction\": BtnAddFunctionCallClicked();\r\n                    break;\r\n                case \"btnDeleteFunction\": BtnDeleteFunctionClicked();\r\n                    break;\r\n                case \"btnDefault\": newParameterValueType = ParameterValueType.Default;\r\n                    break;\r\n                case \"btnConstant\": newParameterValueType = ParameterValueType.Constant;\r\n                    break;\r\n                case \"btnInputParameter\": newParameterValueType = ParameterValueType.InputParameter;\r\n                    break;\r\n                case \"btnFunctionCall\": newParameterValueType = ParameterValueType.FunctionCall;\r\n                    break;\r\n            }\r\n\r\n            if (newParameterValueType != null)\r\n            {\r\n                ParameterValueTypeChanged(newParameterValueType.Value);\r\n                ctlFeedback.MarkAsDirty();\r\n            }\r\n        }\r\n\r\n        UpdateMenu();\r\n\r\n        if (eventTarget == \"switchbutton\")\r\n        {\r\n            switch (eventArgument)\r\n            {\r\n                case \"source\":\r\n                    EditorMode = EditorModeEnum.Source;\r\n                    break;\r\n                case \"design\":\r\n                    if (SaveSourceMarkupChanges())\r\n                    {\r\n                        EditorMode = EditorModeEnum.Design;\r\n                    }\r\n                    break;\r\n            }\r\n        }\r\n\r\n        SyncTreeAndEditingPanel();\r\n    }\r\n\r\n    private void Page_Error(object sender, EventArgs e)\r\n    {\r\n        Composite.Core.WebClient.ErrorServices.DocumentAdministrativeError(Server.GetLastError());\r\n        Composite.Core.WebClient.ErrorServices.RedirectUserToErrorPage(null, Server.GetLastError());\r\n    }\r\n\r\n\r\n    private void Page_PreRender(object sender, EventArgs args)\r\n    {\r\n        //SyncTreeAndEditingPanel();\r\n    }\r\n\r\n\r\n    private void InitializeTreeView()\r\n    {\r\n        if (IsInTestMode)\r\n        {\r\n            // For testing only\r\n            FunctionMarkup = XDocumentUtils.Load(Request.MapPath(\"functioneditor-sample-function.xml\"));\r\n        }\r\n\r\n        WidgetIsShown = false;\r\n        LocalFunctionNameIsShown = false;\r\n        InputParameterSelectorIsShown = false;\r\n\r\n        TreePathToIdMapping = TreeHelper.BuildTreePathToIdDictionary(FunctionMarkup);\r\n\r\n        if (_state.AllowSelectingInputParameters)\r\n        {\r\n            InputParameterNodeIDs = CalculateGetInputParamaterFunctionCalls(FunctionMarkup, TreePathToIdMapping);\r\n        }\r\n\r\n        if (_state.WidgetFunctionSelection) {\r\n            var functionName = ((IEnumerable)FunctionMarkup.XPathEvaluate(\"//*[local-name()='widgetfunction']/@name\")).Cast<XAttribute>().Select(d => d.Value).FirstOrDefault();\r\n            btnSetNewFunction.Attributes[\"value\"] = functionName;\r\n        }\r\n\r\n    }\r\n\r\n    public void OnMessage()\r\n    {\r\n        string message = ctlFeedback.GetPostedMessage();\r\n\r\n        if (message == \"save\")\r\n        {\r\n            ctlFeedback.SetStatus(EditorMode == EditorModeEnum.Source ? SaveSourceMarkupChanges() : ValidateSave());\r\n        }\r\n        else if (message == \"persist\")\r\n        {\r\n            ctlFeedback.SetStatus(EditorMode == EditorModeEnum.Source ? SaveSourceMarkupChanges() : true);\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    /// Searches for parameter values that are required but not set.\r\n    /// </summary>\r\n    /// <returns></returns>\r\n    private bool ValidateSave()\r\n    {\r\n        return ValidateMarkup(FunctionMarkup, true);\r\n    }\r\n\r\n    /// <summary>\r\n    /// Searches for parameter values that are required but not set.\r\n    /// </summary>\r\n    /// <returns></returns>\r\n    private bool ValidateMarkup(XDocument markup, bool checkRequiredParameters)\r\n    {\r\n        foreach (XElement functionCall in markup.Descendants(FunctionNodeXName))\r\n        {\r\n            // Checking if function exists\r\n            IMetaFunction metaFunction = TreeHelper.GetFunction(functionCall);\r\n            if (metaFunction == null)\r\n            {\r\n                XAttribute nameAttr = functionCall.Attribute(\"name\");\r\n                string functionName = nameAttr != null ? nameAttr.Value : string.Empty;\r\n\r\n                Alert(GetString(\"FunctionNotFound\").FormatWith(functionName));\r\n                FocusTreeNode(functionCall);\r\n                return false;\r\n            }\r\n\r\n            List<string> undefinedParameters = TreeHelper.GetUndefinedParameterNames(functionCall).ToList();\r\n\r\n            // Checking that all required parameters are set\r\n            if (checkRequiredParameters)\r\n            {\r\n                foreach (ParameterProfile parameter in metaFunction.ParameterProfiles)\r\n                {\r\n                    if (parameter.IsRequired && undefinedParameters.Contains(parameter.Name) && !parameter.IsInjectedValue)\r\n                    {\r\n                        FocusTreeNode(functionCall, parameter.Name);\r\n                        Alert(GetString(\"RequiredParameterNotDefined\").FormatWith(parameter.LabelLocalized));\r\n                        return false;\r\n                    }\r\n                }\r\n            }\r\n\r\n            // Checking type compatibility\r\n            XElement parentNode = functionCall.Parent;\r\n            if (parentNode.Name == ParameterNodeXName)\r\n            {\r\n                string parameterName = parentNode.Attribute(\"name\").Value;\r\n\r\n                IMetaFunction parentFunctionCall = TreeHelper.GetFunction(functionCall.Parent.Parent);\r\n                ParameterProfile parameterProfile = parentFunctionCall.ParameterProfiles.FirstOrDefault(pr => pr.Name == parameterName);\r\n\r\n                Verify.IsNotNull(parameterProfile, \"Failed to get profile for parameter '{1}' on '{0}' function.\".FormatWith(parentFunctionCall.Name, parameterName));\r\n\r\n                Type functionReturnType = metaFunction.ReturnType;\r\n                Type parameterType = parameterProfile.Type;\r\n                if (!parameterType.IsAssignableFrom(functionReturnType)\r\n                    && !functionReturnType.IsAssignableFrom(parameterType))\r\n                {\r\n                    FocusTreeNode(functionCall);\r\n                    Alert(GetString(\"IncorrectTypeCast\").FormatWith(parameterName, metaFunction.Name));\r\n                    return false;\r\n                }\r\n            }\r\n        }\r\n\r\n        return true;\r\n    }\r\n\r\n\r\n\r\n    private void FocusTreeNode(XElement functionNode, string parameterName)\r\n    {\r\n        string functionPath = TreeHelper.GetElementToPathMap(FunctionMarkup)[functionNode];\r\n\r\n        string parameterPath = TreeHelper.GetParameterPath(functionPath, parameterName);\r\n\r\n        SelectedNode = parameterPath;\r\n    }\r\n\r\n    private void FocusTreeNode(XElement node)\r\n    {\r\n        string functionPath = TreeHelper.GetElementToPathMap(FunctionMarkup)[node];\r\n\r\n        SelectedNode = functionPath;\r\n    }\r\n\r\n    private void Alert(string message)\r\n    {\r\n        string consoleId = _state.ConsoleId;\r\n        if (consoleId.IsNullOrEmpty()) return;\r\n\r\n        ConsoleMessageQueueFacade.Enqueue(\r\n            new MessageBoxMessageQueueItem\r\n            {\r\n                DialogType = DialogType.Error,\r\n                Message = message,\r\n                Title = GetString(\"ValidationFailedAlertTitle\")\r\n            }, consoleId);\r\n    }\r\n\r\n    private void LoadState()\r\n    {\r\n        var stateProvider = SessionStateManager.GetProvider(SessionStateProviderName);\r\n\r\n        if (!stateProvider.TryGetState(StateId, out _state))\r\n        {\r\n            throw new InvalidOperationException(\"Failed to get load session state\");\r\n        }\r\n    }\r\n\r\n    private void LoadFunctions()\r\n    {\r\n        LoadState();\r\n\r\n        List<NamedFunctionCall> functionCalls = _state.FunctionCalls;\r\n\r\n        Verify.IsNotNull(functionCalls, \"Failed to get function calls\");\r\n\r\n        XElement functionsNode = XElement.Parse(\"<functions />\");\r\n\r\n        foreach (var localNamedFunctionCall in functionCalls)\r\n        {\r\n            Guid handle = Guid.NewGuid();\r\n\r\n            BaseFunctionRuntimeTreeNode functionRuntime = localNamedFunctionCall.FunctionCall;\r\n\r\n            XElement function = functionRuntime.Serialize();\r\n            if (_state.AllowLocalFunctionNameEditing)\r\n            {\r\n                function.Add(new XAttribute(\"localname\", localNamedFunctionCall.Name));\r\n            }\r\n\r\n            function.Add(new XAttribute(\"handle\", handle));\r\n\r\n            functionsNode.Add(function);\r\n        }\r\n\r\n        PrettifyXmlNamespacePrefixes(functionsNode);\r\n\r\n\r\n        FunctionMarkup = new XDocument(functionsNode);\r\n    }\r\n\r\n    private void SaveChanges()\r\n    {\r\n        if (IsInTestMode)\r\n        {\r\n            return;\r\n        }\r\n\r\n        List<NamedFunctionCall> functionList = new List<NamedFunctionCall>();\r\n\r\n        foreach (XElement functionElement in FunctionMarkup.Root.Elements())\r\n        {\r\n            BaseFunctionRuntimeTreeNode functionDefinition = (BaseFunctionRuntimeTreeNode)FunctionTreeBuilder.Build(functionElement);\r\n\r\n            if (_state.WidgetFunctionSelection)\r\n            {\r\n                functionList.Add(new NamedFunctionCall(string.Empty, functionDefinition));\r\n            }\r\n            else\r\n            {\r\n                var localNameAttr = functionElement.Attribute(\"localname\");\r\n                string localname = localNameAttr == null ? string.Empty : localNameAttr.Value;\r\n\r\n                functionList.Add(new NamedFunctionCall(localname, functionDefinition));\r\n            }\r\n        }\r\n\r\n        var stateProvider = SessionStateManager.GetProvider(SessionStateProviderName);\r\n\r\n        _state.FunctionCalls = functionList;\r\n        stateProvider.SetState<IFunctionCallEditorState>(StateId, _state, DateTime.Now.Add(SessionExpirationPeriod));\r\n\r\n        // Updating tree IDs\r\n        Dictionary<XElement, string> newElementToPathMap = TreeHelper.GetElementToPathMap(FunctionMarkup);\r\n\r\n        var newPathToIdMap = new Dictionary<string, string>();\r\n\r\n        foreach (KeyValuePair<XElement, string> kvp in newElementToPathMap)\r\n        {\r\n            XElement node = kvp.Key;\r\n            string nodePath = kvp.Value;\r\n\r\n            if (_xElementTreeNodeIDs.ContainsKey(node))\r\n            {\r\n                string nodeId = _xElementTreeNodeIDs[node];\r\n                newPathToIdMap.Add(nodePath, nodeId);\r\n\r\n                // Copying virtual IDs \r\n                if (node.Name == FunctionNodeXName || node.Name == WidgetFunctionNodeXName)\r\n                {\r\n                    foreach (string parameterName in TreeHelper.GetUndefinedParameterNames(node))\r\n                    {\r\n                        string newVirtualParameterPath = TreeHelper.GetParameterPath(nodePath, parameterName);\r\n\r\n                        string oldFunctionPath = TreePathToIdMapping.Where(p => p.Value == nodeId).Select(p => p.Key).First();\r\n                        string oldVirtualParameterPath = TreeHelper.GetParameterPath(oldFunctionPath, parameterName);\r\n\r\n                        if (TreePathToIdMapping.ContainsKey(oldVirtualParameterPath))\r\n                        {\r\n                            newPathToIdMap.Add(newVirtualParameterPath, TreePathToIdMapping[oldVirtualParameterPath]);\r\n                        }\r\n                        else\r\n                        {\r\n                            newPathToIdMap.Add(newVirtualParameterPath, TreeHelper.GetNewId());\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            else\r\n            {\r\n                string nodeId;\r\n                if (node.Name == ParameterNodeXName && TreePathToIdMapping.ContainsKey(nodePath))\r\n                {\r\n                    nodeId = TreePathToIdMapping[nodePath];\r\n                }\r\n                else\r\n                {\r\n                    nodeId = TreeHelper.GetNewId();\r\n                }\r\n                newPathToIdMap.Add(nodePath, nodeId);\r\n\r\n                // Creating IDs for virtual parameter nodes\r\n                if (node.Name == FunctionNodeXName || node.Name == WidgetFunctionNodeXName)\r\n                {\r\n                    foreach (string parameterName in TreeHelper.GetUndefinedParameterNames(node))\r\n                    {\r\n                        string newVirtualParameterPath = TreeHelper.GetParameterPath(nodePath, parameterName);\r\n                        newPathToIdMap.Add(newVirtualParameterPath, TreeHelper.GetNewId());\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        TreePathToIdMapping = newPathToIdMap;\r\n    }\r\n\r\n\r\n\r\n    private void SyncTreeAndEditingPanel()\r\n    {\r\n        //Select first parameter if not selected\r\n        //TODO: refactor this\r\n        if (Request.UserAgent.IndexOf(\"MSIE \", System.StringComparison.Ordinal) == -1) // skip IE\r\n        {\r\n            if (SelectedNode.IsNullOrEmpty() && TreePathToIdMapping.Count > 1)\r\n            {\r\n                SelectedNode = TreePathToIdMapping.Keys.Skip(1).FirstOrDefault();\r\n                _xElementTreeNodeIDs = TreeHelper.GetElementToIdMap(FunctionMarkup, TreePathToIdMapping);\r\n            }\r\n        }\r\n\r\n        // Building tree \r\n        XDocument functionMarkup = Clone(FunctionMarkup);\r\n        XElement updatedTreeView = UpdateTreeView(functionMarkup.Root);\r\n\r\n        // Building an editing panel\r\n        if (!SelectedNode.IsNullOrEmpty())\r\n        {\r\n            UpdateEditingPanel(updatedTreeView, SelectedNode);\r\n        }\r\n\r\n        btnSetNewFunction.Attributes.Add(\"dialoglabel\", SetNewFunctionDialogLabel);\r\n        btnAddFunction.Attributes.Add(\"dialoglabel\", AddNewFunctionDialogLabel);\r\n        btnAddFunction.Attributes[\"isdisabled\"] = (_state.MaxFunctionAllowed > FunctionMarkup.Root.Elements().Count()) ? \"false\" : \"true\";\r\n\r\n\r\n        bool singleFunctionSelection = _state.MaxFunctionAllowed == 1;\r\n        btnSetNewFunction.Visible = singleFunctionSelection;\r\n        btnAddFunction.Visible = !singleFunctionSelection;\r\n\r\n        var visibleButton = singleFunctionSelection ? btnSetNewFunction : btnAddFunction;\r\n\r\n        Type[] allowedTypes = _state.AllowedResultTypes;\r\n\r\n        visibleButton.Attributes.Add(\"providersearch\", AllFunctionsElementProviderSearchToken.Build(allowedTypes).Serialize());\r\n        visibleButton.Attributes.Add(\"selectwidget\", _state.WidgetFunctionSelection ? \"true\" : \"false\");\r\n\r\n        // Updating \"source xml\" field\r\n        functionMarkup = Clone(FunctionMarkup);\r\n        foreach (XElement element in functionMarkup.Descendants().ToList())\r\n        {\r\n            var attr = element.Attribute(\"handle\");\r\n            if (attr != null)\r\n            {\r\n                attr.Remove();\r\n            }\r\n        }\r\n\r\n        PrettifyXmlNamespacePrefixes(functionMarkup);\r\n\r\n        var utf8 = System.Text.Encoding.UTF8;\r\n        var xmlWriterSettings = new XmlWriterSettings\r\n        {\r\n            Indent = true,\r\n            IndentChars = \"\\t\",\r\n            NamespaceHandling = NamespaceHandling.OmitDuplicates,\r\n            Encoding = utf8\r\n        };\r\n\r\n        byte[] serializedXDocument;\r\n\r\n        using (MemoryStream stream = new MemoryStream())\r\n        {\r\n            using (XmlWriter writer = XmlWriter.Create(stream, xmlWriterSettings))\r\n            {\r\n                functionMarkup.Save(writer);\r\n            }\r\n            serializedXDocument = stream.ToArray();\r\n        }\r\n\r\n        string serializedMarkup = utf8.GetString(serializedXDocument);\r\n        serializedMarkup = serializedMarkup.Substring(serializedMarkup.IndexOf(Environment.NewLine) + Environment.NewLine.Length);\r\n\r\n        //Update editor if switching to SourceMode\r\n        if (Request[\"__EVENTARGUMENT\"] == \"source\")\r\n            ctlSourceEditor.Attributes[\"value\"] = Context.Server.UrlEncode(serializedMarkup).Replace(\"+\", \"%20\");\r\n\r\n        if (IsInTestMode)\r\n        {\r\n            ViewState[FunctionMarkupSessionKey] = serializedMarkup;\r\n        }\r\n    }\r\n\r\n    private void UpdateInputParameterName()\r\n    {\r\n        string nodeID = SelectedNode;\r\n\r\n        XElement parameterNode = TreeHelper.FindByPath(FunctionMarkup.Root, nodeID);\r\n\r\n        string selectedParameterName = Request.Form[\"lstInputParameterName\"];\r\n\r\n        // Updating param/function[@name='Composite.Utils.GetInputParameter']/param[@name='InputParameterName']/@value\r\n\r\n        var parameterNameNode = parameterNode.Descendants(ParameterNodeXName).First();\r\n        parameterNameNode.Attribute(\"value\").Value = selectedParameterName ?? string.Empty;\r\n\r\n        SaveChanges();\r\n    }\r\n\r\n    private void UpdateFunctionLocalName()\r\n    {\r\n        string nodeID = SelectedNode;\r\n\r\n        XElement functionNode = TreeHelper.FindByPath(FunctionMarkup.Root, nodeID);\r\n\r\n        functionNode.SetAttributeValue(\"localname\", txtLocalName.Text);\r\n\r\n        SaveChanges();\r\n    }\r\n\r\n    private void UpdateParameterValueFromWidget()\r\n    {\r\n        string nodeID = SelectedNode;\r\n\r\n        XElement parameterNode = TreeHelper.FindByPath(FunctionMarkup.Root, nodeID);\r\n        if (parameterNode == null) return;\r\n        Verify.That(parameterNode != null, \"Failed to get a parameter by path '{0}'\", nodeID);\r\n\r\n        string parameterName = parameterNode.Attribute(\"name\").Value;\r\n\r\n        XElement functionNode = parameterNode.Parent;\r\n        IMetaFunction function = TreeHelper.GetFunction(functionNode);\r\n\r\n        ParameterProfile parameterProfile = function.ParameterProfiles.FirstOrDefault(p => p.Name == parameterName);\r\n\r\n        // Creating a widget instance\r\n        object defaultParameterValue = parameterProfile.GetDefaultValue();\r\n        var bindings = new Dictionary<string, object> { { parameterProfile.Name, defaultParameterValue } };\r\n\r\n\r\n        var formTreeCompiler = FunctionUiHelper.BuildWidgetForParameters(\r\n            new[] { parameterProfile },\r\n            bindings,\r\n            \"FORM\" + SelectedNode.GetHashCode(),\r\n            \"\",\r\n            WebManagementChannel.Identifier);\r\n\r\n        // The control is temporary added to page, so it will get a correct ID\r\n        var webUiControl = (IWebUiControl)formTreeCompiler.UiControl;\r\n        var webControl = webUiControl.BuildWebControl();\r\n\r\n        plhWidget.Controls.Add(webControl);\r\n\r\n        // Loading control's post data\r\n        LoadPostBackData(webControl);\r\n\r\n        formTreeCompiler.SaveControlProperties();\r\n\r\n        plhWidget.Controls.Clear();\r\n\r\n        object newValue = bindings[parameterProfile.Name];\r\n\r\n        bool newValueNotEmpty = newValue != null \r\n                                && (!(newValue is IList) || ((IList)newValue).Count > 0)\r\n                                && !(parameterProfile.IsRequired && newValue as string == string.Empty);\r\n\r\n        parameterNode.Remove();\r\n\r\n        if (newValueNotEmpty)\r\n        {\r\n            var newConstantParam = new ConstantObjectParameterRuntimeTreeNode(parameterProfile.Name, newValue);\r\n\r\n            functionNode.Add(newConstantParam.Serialize());\r\n        }\r\n\r\n        SaveChanges();\r\n    }\r\n\r\n\r\n    private void LoadPostBackData(Control control)\r\n    {\r\n        if (control is IPostBackDataHandler)\r\n        {\r\n            (control as IPostBackDataHandler).LoadPostData(control.UniqueID, Request.Form);\r\n        }\r\n\r\n        foreach (Control childControl in control.Controls)\r\n        {\r\n            LoadPostBackData(childControl);\r\n        }\r\n    }\r\n\r\n\r\n    private void BtnDefaultClicked(XElement parameterNode)\r\n    {\r\n        if (parameterNode != null)\r\n        {\r\n            parameterNode.Remove();\r\n\r\n            SaveChanges();\r\n        }\r\n    }\r\n\r\n    private void ParameterValueTypeChanged(ParameterValueType valueType)\r\n    {\r\n        string nodePath = SelectedNode;\r\n\r\n        int parameterOffset = nodePath.LastIndexOf(\"@\", System.StringComparison.Ordinal);\r\n        string functionPath = nodePath.Substring(0, parameterOffset - 1);\r\n        string parameterName = nodePath.Substring(parameterOffset + 1);\r\n\r\n        XElement functionNode = TreeHelper.FindByPath(FunctionMarkup.Root, functionPath);\r\n        XElement parameterNode = functionNode.Elements(ParameterNodeXName).FirstOrDefault(element => element.Attribute(\"name\").Value == parameterName);\r\n\r\n        string nodeID = TreePathToIdMapping[nodePath];\r\n\r\n        if (_state.AllowSelectingInputParameters)\r\n        {\r\n            if (valueType != ParameterValueType.InputParameter)\r\n            {\r\n                InputParameterNodeIDs.Remove(nodeID);\r\n            }\r\n            else\r\n            {\r\n                if (!InputParameterNodeIDs.Contains(nodeID))\r\n                {\r\n                    InputParameterNodeIDs.Add(nodeID);\r\n                }\r\n            }\r\n        }\r\n\r\n        if (valueType == ParameterValueType.Default)\r\n        {\r\n            BtnDefaultClicked(parameterNode);\r\n        }\r\n        else if (valueType == ParameterValueType.Constant)\r\n        {\r\n            BtnConstantClicked(functionNode, parameterNode, parameterName);\r\n        }\r\n        else if (valueType == ParameterValueType.FunctionCall)\r\n        {\r\n            BtnFunctionCallClicked(functionNode, parameterNode, parameterName);\r\n        }\r\n        else if (valueType == ParameterValueType.InputParameter)\r\n        {\r\n            BtnInputParameterClicked(functionNode, parameterNode, parameterName);\r\n        }\r\n    }\r\n\r\n    private void BtnConstantClicked(XElement functionNode, XElement parameterNode, string parameterName)\r\n    {\r\n        IMetaFunction function = TreeHelper.GetFunction(functionNode);\r\n        ParameterProfile parameterProfile = function.ParameterProfiles.FirstOrDefault(p => p.Name == parameterName);\r\n        Verify.IsNotNull(parameterProfile, \"Failed to get parameter profile\");\r\n\r\n        if (parameterNode != null)\r\n        {\r\n            parameterNode.Remove();\r\n        }\r\n\r\n        object defaultParameterValue = parameterProfile.GetDefaultValue();\r\n\r\n        var newConstantParam = new ConstantObjectParameterRuntimeTreeNode(parameterProfile.Name, defaultParameterValue ?? string.Empty);\r\n        functionNode.Add(newConstantParam.Serialize());\r\n\r\n        SaveChanges();\r\n    }\r\n\r\n    private void BtnSetNewFunctionCallClicked()\r\n    {\r\n        string selectedFunctionName = this.Request.Form[\"btnSetNewFunction\"];\r\n\r\n        FunctionMarkup.Root.RemoveAll();\r\n\r\n        IMetaFunction metaFunction;\r\n        AddFunctionCall(selectedFunctionName, out metaFunction);\r\n\r\n        // If function has no parameters, focusing on it, otherwise client will automatically focus on the first parameter\r\n        if (!metaFunction.ParameterProfiles.Any())\r\n        {\r\n            FocusTreeNode(FunctionMarkup.Root.Elements().Last());\r\n        }\r\n        else\r\n        {\r\n            SelectedNode = null;\r\n        }\r\n\r\n        SaveChanges();\r\n    }\r\n\r\n    private void BtnAddFunctionCallClicked()\r\n    {\r\n        string selectedFunctionName = this.Request.Form[\"btnAddFunction\"];\r\n\r\n        IMetaFunction metaFunction;\r\n        AddFunctionCall(selectedFunctionName, out metaFunction);\r\n\r\n        SaveChanges();\r\n    }\r\n\r\n    private void AddFunctionCall(string functionName, out IMetaFunction metaFunction)\r\n    {\r\n        BaseFunctionRuntimeTreeNode functionRuntime;\r\n\r\n        if (_state.WidgetFunctionSelection)\r\n        {\r\n            IWidgetFunction widgetFunction = FunctionFacade.GetWidgetFunction(functionName);\r\n            functionRuntime = new WidgetFunctionRuntimeTreeNode(widgetFunction);\r\n\r\n            metaFunction = widgetFunction;\r\n        }\r\n        else\r\n        {\r\n            IFunction functionInfo = FunctionFacade.GetFunction(functionName);\r\n            functionRuntime = new FunctionRuntimeTreeNode(functionInfo);\r\n\r\n            metaFunction = functionInfo;\r\n        }\r\n\r\n        XElement function = functionRuntime.Serialize();\r\n\r\n        if (!_state.WidgetFunctionSelection && _state.AllowLocalFunctionNameEditing)\r\n        {\r\n            string localName = functionName;\r\n            int pointOffset = localName.LastIndexOf(\".\", StringComparison.Ordinal);\r\n            if (pointOffset > 0 && pointOffset < localName.Length - 1)\r\n            {\r\n                localName = localName.Substring(pointOffset + 1);\r\n            }\r\n            string uniqueLocalName = localName;\r\n            int retry = 1;\r\n            while (FunctionMarkup.Descendants().Attributes(\"localname\").Any(a => a.Value == uniqueLocalName))\r\n            {\r\n                uniqueLocalName = string.Format(\"{0}{1}\", localName, ++retry);\r\n            }\r\n\r\n            function.Add(new XAttribute(\"localname\", uniqueLocalName));\r\n        }\r\n\r\n        function.Add(new XAttribute(\"handle\", Guid.NewGuid()));\r\n\r\n        FunctionMarkup.Root.Add(function);\r\n    }\r\n\r\n    private void BtnInputParameterClicked(XElement functionNode, XElement parameterNode, string parameterName)\r\n    {\r\n        if (parameterNode != null)\r\n        {\r\n            parameterNode.Remove();\r\n        }\r\n\r\n        // Adding function call - GetInputParameter(InputParameterName = \"...\")\r\n\r\n        IFunction getInputParameterFunc = FunctionFacade.GetFunction(GetInputParameterFunctionName);\r\n\r\n\r\n        IMetaFunction function = TreeHelper.GetFunction(functionNode);\r\n        ParameterProfile parameterProfile = function.ParameterProfiles.FirstOrDefault(p => p.Name == parameterName);\r\n        var selectedParameter = _state.Parameters.FirstOrDefault(ip => InputParameterCanBeAssigned(parameterProfile.Type, ip.Type));\r\n        string selectedParameterName = selectedParameter != null ? selectedParameter.Name : string.Empty;\r\n\r\n\r\n        var newElement = new FunctionParameterRuntimeTreeNode(parameterName, new FunctionRuntimeTreeNode(getInputParameterFunc)).Serialize();\r\n        functionNode.Add(newElement);\r\n\r\n        var inputParameterNameNode = new ConstantObjectParameterRuntimeTreeNode(GetInputParameterFunctionParameterName, selectedParameterName).Serialize();\r\n        newElement.Elements().First().Add(inputParameterNameNode);\r\n\r\n        SaveChanges();\r\n    }\r\n\r\n    private void BtnFunctionCallClicked(XElement functionNode, XElement parameterNode, string parameterName)\r\n    {\r\n        if (parameterNode != null)\r\n        {\r\n            parameterNode.Remove();\r\n        }\r\n\r\n        // Adding function call to the xml\r\n        string selectedFunction = btnFunctionCall.Value;\r\n        IFunction newFunction = FunctionFacade.GetFunction(selectedFunction);\r\n\r\n        functionNode.Add(new FunctionParameterRuntimeTreeNode(parameterName, new FunctionRuntimeTreeNode(newFunction)).Serialize());\r\n\r\n        SaveChanges();\r\n    }\r\n\r\n    private void BtnDeleteFunctionClicked()\r\n    {\r\n        string nodeID = SelectedNode;\r\n\r\n        var root = FunctionMarkup.Root;\r\n        XElement functionNode = TreeHelper.FindByPath(FunctionMarkup.Root, nodeID);\r\n\r\n        if (functionNode != null && functionNode.Parent == root)\r\n        {\r\n            functionNode.Remove();\r\n\r\n            SaveChanges();\r\n\r\n            SelectedNode = null; // Or something else\r\n\r\n            UpdateEditingPanel(null, string.Empty);\r\n        }\r\n    }\r\n\r\n    private void UpdateEditingPanel(XElement document, string nodeID)\r\n    {\r\n        WidgetIsShown = false;\r\n        LocalFunctionNameIsShown = false;\r\n        InputParameterSelectorIsShown = false;\r\n\r\n        if (string.IsNullOrEmpty(nodeID))\r\n        {\r\n            mlvMain.SetActiveView(viewNoSelection);\r\n            return;\r\n        }\r\n\r\n        bool isParameter = nodeID.LastIndexOf(\"@\") > nodeID.LastIndexOf(\"/\");\r\n\r\n        string functionID = isParameter ? nodeID.Substring(0, nodeID.LastIndexOf(\"/\")) : nodeID;\r\n\r\n        var function = TreeHelper.FindByPath(document, functionID);\r\n\r\n        Verify.That(function != null, \"Failed to get a function by path '{0}'\", functionID);\r\n\r\n        if (isParameter)\r\n        {\r\n            string parameterName = nodeID.Substring(nodeID.LastIndexOf(\"@\") + 1);\r\n            ShowParameterData(function, parameterName, nodeID);\r\n            return;\r\n        }\r\n\r\n        ShowFunctionData(function);\r\n    }\r\n\r\n    private static bool InputParameterCanBeAssigned(Type parameterType, Type inputParameterType)\r\n    {\r\n        return inputParameterType == typeof(object)\r\n        || (parameterType == typeof(string)\r\n            && (inputParameterType == typeof(int) || inputParameterType == typeof(DateTime)))\r\n        || parameterType.IsAssignableFrom(inputParameterType);\r\n    }\r\n\r\n    private void ShowParameterData(XElement functionNode, string parameterName, string fullParameterPath)\r\n    {\r\n        mlvMain.SetActiveView(viewParameter);\r\n       \r\n        IMetaFunction function = TreeHelper.GetFunction(functionNode);\r\n\r\n        ParameterProfile parameterProfile = function.ParameterProfiles.FirstOrDefault(p => p.Name == parameterName);\r\n\r\n        // Configuring function selection dialog\r\n        var searchToken = new AllFunctionsElementProviderSearchToken\r\n        {\r\n            // NOTE: shoudn't expose implementation details\r\n            AcceptableTypes = TypeManager.TrySerializeType(parameterProfile.Type)\r\n        };\r\n        btnFunctionCall.Attributes.Add(\"providersearch\", searchToken.Serialize());\r\n        btnFunctionCall.Attributes.Add(\"dialoglabel\", SelectFunctionDialogLabel.FormatWith(parameterProfile.Name));\r\n\r\n\r\n        txtFieldName.Text = Server.HtmlEncode(StringResourceSystemFacade.ParseString(parameterProfile.Label));\r\n        txtFieldType.Text = Server.HtmlEncode(parameterProfile.Type.GetShortLabel());\r\n        txtFieldDescription.Text = Server.HtmlEncode(StringResourceSystemFacade.ParseString(parameterProfile.HelpDefinition.HelpText));\r\n\r\n        XElement parameterNode = TreeHelper.GetParameterNode(functionNode, parameterName);\r\n\r\n\r\n        if (!_state.AllowSelectingInputParameters)\r\n        {\r\n            btnInputParameter.Visible = false;\r\n        }\r\n        else\r\n        {\r\n            // Input parameter selector should be awaliable only if there's a parameter of an appropriate type\r\n            bool inputParameterSelectorAvailable = _state.Parameters.Any(ip => InputParameterCanBeAssigned(parameterProfile.Type, ip.Type));\r\n            if (!inputParameterSelectorAvailable)\r\n            {\r\n                btnInputParameter.Attributes[\"isdisabled\"] = \"true\";\r\n            }\r\n        }\r\n\r\n        if (parameterProfile.IsRequired && !parameterProfile.IsInjectedValue)\r\n        {\r\n            btnDefault.Visible = false;\r\n\r\n            // If parameter is required, has no value and a widget is available - the widget should be shown by default.\r\n            if (parameterNode == null\r\n                && parameterProfile.WidgetFunction != null)\r\n            {\r\n                ParameterValueTypeChanged(ParameterValueType.Constant);\r\n\r\n                parameterNode = TreeHelper.FindByPath(FunctionMarkup.Root, fullParameterPath);\r\n            }\r\n        }\r\n\r\n        if (parameterProfile.WidgetFunction == null)\r\n        {\r\n            btnConstant.Attributes[\"isdisabled\"] = \"true\";\r\n        }\r\n\r\n        if (parameterNode == null)\r\n        {\r\n            mlvWidget.Visible = false;\r\n\r\n            btnDefault.Attributes[\"isdisabled\"] = \"true\";\r\n            return;\r\n        }\r\n\r\n        if (parameterNode.Attribute(SelectedInputParameter_AttributeName) != null)\r\n        {\r\n            ShowInputParameterSelector(parameterProfile, parameterNode);\r\n            mlvWidget.Visible = true;\r\n            return;\r\n        }\r\n\r\n        if (parameterNode.Elements(FunctionNodeXName).Any())\r\n        {\r\n            // function call should be shown\r\n            btnFunctionCall.Attributes[\"class\"] = \"selected\";\r\n\r\n            mlvWidget.Visible = false;\r\n            return;\r\n        }\r\n\r\n        // Constant (or input parameter), widget should be shown\r\n        btnConstant.Attributes[\"isdisabled\"] = \"true\";\r\n  \r\n        object parameterValue = FunctionMarkupHelper.GetParameterValue(parameterNode, parameterProfile);\r\n\r\n        if (parameterProfile.Type.IsLazyGenericType() && parameterValue != null)\r\n        {\r\n            parameterValue = parameterProfile.Type.GetProperty(\"Value\").GetGetMethod().Invoke(parameterValue, null);\r\n        }\r\n\r\n        // Adding a widget\r\n        var bindings = new Dictionary<string, object> { { parameterProfile.Name, parameterValue } };\r\n\r\n        var formTreeCompiler = FunctionUiHelper.BuildWidgetForParameters(\r\n            new[] { parameterProfile },\r\n            bindings,\r\n            \"FORM\" + SelectedNode.GetHashCode(),\r\n            \"\",\r\n            WebManagementChannel.Identifier);\r\n\r\n        IWebUiControl webUiControl = (IWebUiControl)formTreeCompiler.UiControl;\r\n\r\n        var fieldGroupControl = webUiControl.BuildWebControl();\r\n        var fieldGroupControlBase = fieldGroupControl as ContainerTemplateUserControlBase;\r\n\r\n        // Preventing <ui:fields> tag from rendering\r\n        fieldGroupControlBase.Settings.Add(\"RenderFieldsTag\", false);\r\n        // Overwriting field label\r\n        fieldGroupControlBase.Settings.Add(\"FieldLabel\", GetString(\"ParameterValueLabel\"));\r\n\r\n        mlvWidget.Visible = true;\r\n        mlvWidget.SetActiveView(viewWidget_Constant);\r\n        //viewWidget_Constant.Visible = true;\r\n        plhWidget.Visible = true;\r\n        plhWidget.Controls.Add(fieldGroupControl);\r\n\r\n        if (IsPostBack && Context.Request.Form[\"__EVENTTARGET\"].StartsWith(webUiControl.UiControlID + \"$\"))\r\n        {\r\n            webUiControl.BindStateToControlProperties();\r\n        }\r\n        else\r\n        {\r\n            webUiControl.InitializeViewState();\r\n        }\r\n\r\n        mlvWidget.SetActiveView(viewWidget_Constant);\r\n\r\n        WidgetIsShown = true;\r\n    }\r\n\r\n\r\n    private static bool FunctionIsOnTopLevel(XElement functionNode)\r\n    {\r\n        return functionNode.Parent.Name.LocalName == \"functions\";\r\n    }\r\n\r\n\r\n    private void ShowInputParameterSelector(ParameterProfile parameterProfile, XElement parameterName)\r\n    {\r\n        // string inputParameterName = functionNode.Elements().First().Attribute(\"value\").Value;\r\n\r\n        btnInputParameter.Attributes[\"isdisabled\"] = \"true\";\r\n        btnInputParameter.Attributes[\"class\"] = \"selected\";\r\n\r\n        mlvWidget.SetActiveView(viewWidget_InputParameter);\r\n\r\n        lstInputParameterName.Items.Clear();\r\n\r\n        foreach (var parameter in _state.Parameters)\r\n        {\r\n            if (InputParameterCanBeAssigned(parameterProfile.Type, parameter.Type))\r\n            {\r\n                lstInputParameterName.Items.Add(parameter.Name);\r\n            }\r\n        }\r\n\r\n        lstInputParameterName.SelectedValue = parameterName.Attribute(SelectedInputParameter_AttributeName).Value;\r\n\r\n        InputParameterSelectorIsShown = true;\r\n    }\r\n\r\n    private void ShowFunctionData(XElement functionNode)\r\n    {\r\n        IMetaFunction function = TreeHelper.GetFunction(functionNode);\r\n\r\n        txtFunctionName.Text = Server.HtmlEncode(function.Name);\r\n        txtFunctionReturnType.Text = Server.HtmlEncode(function.ReturnType.GetShortLabel());\r\n        txtFunctionDescription.Text = Server.HtmlEncode(StringResourceSystemFacade.ParseString(function.Description));\r\n\r\n        if (FunctionIsOnTopLevel(functionNode) && _state.AllowLocalFunctionNameEditing)\r\n        {\r\n            plhEditLocalName.Visible = true;\r\n\r\n            string localFunctionName = functionNode.Attribute(\"localname\").Value;\r\n            txtLocalName.Text = localFunctionName;\r\n\r\n            LocalFunctionNameIsShown = true;\r\n        }\r\n        else\r\n        {\r\n            plhEditLocalName.Visible = false;\r\n        }\r\n        mlvMain.SetActiveView(viewFunction);\r\n    }\r\n\r\n    private XElement CopyWithId(XElement source)\r\n    {\r\n        XElement copy = new XElement(source);\r\n\r\n        Dictionary<XElement, string> elementToPathMap = TreeHelper.GetElementToPathMap(copy);\r\n\r\n        foreach (XElement element in elementToPathMap.Keys)\r\n        {\r\n            string elementPath = elementToPathMap[element];\r\n\r\n            Verify.That(TreePathToIdMapping.ContainsKey(elementPath), \"There's no tree ID assigned to element '{0}'\", elementPath);\r\n            string treeNodeId = TreePathToIdMapping[elementPath];\r\n\r\n            element.Add(new XAttribute(\"id\", treeNodeId),\r\n                        new XAttribute(\"path\", elementPath));\r\n        }\r\n\r\n        return copy;\r\n    }\r\n\r\n    private void UpdateMenu()\r\n    {\r\n        string selectedNode = SelectedNode;\r\n\r\n        bool rootFunctionSelected = selectedNode != null && !selectedNode.Contains(\"@\");\r\n        btnDeleteFunction.Attributes[\"isdisabled\"] = (!rootFunctionSelected) ? \"true\" : \"false\";\r\n    }\r\n\r\n    public bool SaveSourceMarkupChanges()\r\n    {\r\n        string markup = Context.Request.Form[\"ctlSourceEditor\"];\r\n        if (markup.IsNullOrEmpty())\r\n        {\r\n            return false;\r\n        }\r\n\r\n        markup = Context.Server.UrlDecode(markup);\r\n\r\n        XDocument newMarkup;\r\n        try\r\n        {\r\n            newMarkup = XDocument.Parse(markup);\r\n        }\r\n\r\n        catch (Exception e)\r\n        {\r\n            Log.LogError(\"FunctionCallEditor\", e);\r\n            Alert(\"Failed to parse the markup\");\r\n            return false;\r\n        }\r\n\r\n        try\r\n        {\r\n            if (!ValidateMarkup(newMarkup, false))\r\n                return false;\r\n        }\r\n        catch (Exception e)\r\n        {\r\n            Alert(e.Message);\r\n            return false;\r\n        }\r\n\r\n\r\n        FunctionMarkup = newMarkup;\r\n\r\n        InitializeTreeView();\r\n\r\n        SaveChanges();\r\n\r\n        //Leave selected node if exists in murkup\r\n        if (SelectedNode != null && !TreePathToIdMapping.ContainsKey(SelectedNode))\r\n        {\r\n            SelectedNode = null;\r\n        }\r\n\r\n        return true;\r\n    }\r\n\r\n    private XElement UpdateTreeView(XElement functionMarkupContainer)\r\n    {\r\n        // TODO: Do some compiled xslt caching\r\n\r\n        XElement treeInput = CopyWithId(functionMarkupContainer);\r\n\r\n        treeInput.Add(GetFunctionDescriptionElements(functionMarkupContainer));\r\n\r\n        if (_state.AllowSelectingInputParameters)\r\n        {\r\n            CollapseGetInputParamaterFunctionCalls(treeInput, InputParameterNodeIDs);\r\n        }\r\n\r\n        // treeInput.Save(Request.MapPath(\"out.tmp.xml\"));\r\n\r\n        string xslFilePath = Request.MapPath(\"functioneditortree.xslt\");\r\n        XslCompiledTransform transform = GetTransformation(xslFilePath);\r\n\r\n        var xsltTransformArguments = new XsltArgumentList();\r\n        xsltTransformArguments.AddExtensionObject(XsltExtensionObjectNamespace, new TreeRenderingXsltExtensionObject(TreePathToIdMapping));\r\n        xsltTransformArguments.AddParam(\"SelectedId\", string.Empty, SelectedNode.IsNullOrEmpty() ? string.Empty : TreePathToIdMapping[SelectedNode]);\r\n\r\n        XDocument transformedDoc = new XDocument();\r\n\r\n        using (XmlWriter writer = transformedDoc.CreateWriter())\r\n        {\r\n            transform.Transform(treeInput.CreateReader(), xsltTransformArguments, writer);\r\n        }\r\n\r\n        WriteTo(transformedDoc, this.TreePlaceholder);\r\n\r\n        return treeInput;\r\n    }\r\n\r\n    private XslCompiledTransform GetTransformation(string xsltFilePath)\r\n    {\r\n        string transformationCacheKey = \"Compiled\" + xsltFilePath;\r\n        var cache = HttpContext.Current.Cache;\r\n\r\n        var transform = cache[transformationCacheKey] as XslCompiledTransform;\r\n        if (transform == null)\r\n        {\r\n            lock (this.GetType())\r\n            {\r\n                transform = cache[transformationCacheKey] as XslCompiledTransform;\r\n                if (transform == null)\r\n                {\r\n                    transform = XsltServices.GetCompiledXsltTransform(xsltFilePath);\r\n                    cache.Add(transformationCacheKey,\r\n                        transform,\r\n                        new CacheDependency(xsltFilePath),\r\n                        DateTime.MaxValue,\r\n                        TimeSpan.FromDays(1.0),\r\n                        CacheItemPriority.Default,\r\n                        null);\r\n                }\r\n            }\r\n        }\r\n        return transform;\r\n    }\r\n\r\n    private HashSet<string> CalculateGetInputParamaterFunctionCalls(XDocument functionCalls, Dictionary<string, string> pathToIdMapping)\r\n    {\r\n        Verify.That(_state.AllowSelectingInputParameters, \"Invalid function call\");\r\n\r\n        var result = new HashSet<string>();\r\n\r\n        List<string> availableParameters = _state.Parameters.Select(parameter => parameter.Name).ToList();\r\n\r\n        var elementToPathMap = TreeHelper.GetElementToPathMap(functionCalls);\r\n        foreach (XElement parameterElement in functionCalls.Descendants(ParameterNodeXName))\r\n        {\r\n            XElement functionNode = parameterElement.Elements().FirstOrDefault();\r\n            if (functionNode == null\r\n                || functionNode.Attribute(\"name\") == null\r\n                || functionNode.Attribute(\"name\").Value != GetInputParameterFunctionName)\r\n            {\r\n                continue;\r\n            }\r\n\r\n            XElement inputParameterNameNode = functionNode.Elements(ParameterNodeXName).FirstOrDefault();\r\n            if (inputParameterNameNode == null)\r\n            {\r\n                continue;\r\n            }\r\n\r\n            var parameterNameAttr = inputParameterNameNode.Attribute(\"value\");\r\n            if (parameterNameAttr == null\r\n                || string.IsNullOrEmpty(parameterNameAttr.Value)\r\n                || !availableParameters.Contains(parameterNameAttr.Value))\r\n            {\r\n                continue;\r\n            }\r\n\r\n            result.Add(pathToIdMapping[elementToPathMap[parameterElement]]);\r\n        }\r\n\r\n        return result;\r\n    }\r\n\r\n    /// <summary>\r\n    /// Removes nodes that are related to \"GetInputParameter\" function calls, which are invisible in the tree\r\n    /// </summary>\r\n    /// <param name=\"root\"></param>\r\n    private static void CollapseGetInputParamaterFunctionCalls(XElement root, HashSet<string> inputParameterNodeIDs)\r\n    {\r\n        Func<XElement, bool> isUnnestedFunction10 = f => f.Ancestors().All(g => g.Name.Namespace == Namespaces.Function10 || g.Parent == null);\r\n        List<XElement> parameterNodes = root.Descendants(ParameterNodeXName).Where(isUnnestedFunction10).ToList();\r\n\r\n        var toBeRemoved = new List<XElement>();\r\n\r\n        foreach (XElement parameterElement in parameterNodes)\r\n        {\r\n            string nodeId = parameterElement.Attribute(\"id\").Value;\r\n            if (!inputParameterNodeIDs.Contains(nodeId)) continue;\r\n\r\n            XElement functionNode = parameterElement.Elements().FirstOrDefault();\r\n            if (functionNode == null\r\n                || (string) functionNode.Attribute(\"name\") != GetInputParameterFunctionName) continue;\r\n\r\n            XAttribute parameterNameAttr = functionNode.Elements().First().Attribute(\"value\");\r\n\r\n            // If parameter value isn't a constant - continue\r\n            if (parameterNameAttr == null) continue;\r\n\r\n            string parameterName = parameterNameAttr.Value;\r\n\r\n            toBeRemoved.Add(functionNode);\r\n            parameterElement.Add(new XAttribute(SelectedInputParameter_AttributeName, parameterName));\r\n        }\r\n\r\n        toBeRemoved.ForEach(element => element.Remove());\r\n    }\r\n\r\n    private IEnumerable<XElement> GetFunctionDescriptionElements(XElement functionMarkupToDescribe)\r\n    {\r\n        XElement unexpected = functionMarkupToDescribe.Elements().FirstOrDefault(f => f.Name != FunctionNodeXName && f.Name != WidgetFunctionNodeXName);\r\n        if (unexpected != null)\r\n        {\r\n            throw new InvalidOperationException(string.Format(\"Provided function markup contained unexpected element name '{0}' at root.elements level.\", unexpected.Name));\r\n        }\r\n\r\n        foreach (XElement element in functionMarkupToDescribe.Descendants())\r\n        {\r\n            element.Add(new XAttribute(\"xpath\", element.GetXPath()));\r\n        }\r\n\r\n\r\n        string[] uniqueFunctionNames = functionMarkupToDescribe.Descendants(FunctionNodeXName).Select(f => f.Attribute(\"name\").Value).Distinct().ToArray();\r\n        string[] uniqueWidgetFunctionNames = functionMarkupToDescribe.Descendants(WidgetFunctionNodeXName).Select(f => f.Attribute(\"name\").Value).Distinct().ToArray();\r\n\r\n        List<IMetaFunction> toBeDescribed =\r\n            uniqueFunctionNames\r\n            .Select(functionName => FunctionFacade.GetFunction(functionName) as IMetaFunction)\r\n            .Union(uniqueWidgetFunctionNames\r\n                  .Select(functionName => FunctionFacade.GetWidgetFunction(functionName) as IMetaFunction))\r\n            .ToList();\r\n\r\n\r\n        var allFunctionDescriptions = new List<XElement>();\r\n\r\n        foreach (IMetaFunction function in toBeDescribed)\r\n        {\r\n            var functionDescription = new XElement(functionDescriptionNs + \"function\"\r\n                , new XAttribute(\"compositename\", function.CompositeName())\r\n                , new XAttribute(\"name\", function.Name)\r\n                , new XAttribute(\"namespace\", function.Namespace)\r\n                , new XAttribute(\"description\", function.DescriptionLocalized() ?? \"\")\r\n                , new XAttribute(\"returntypelabel\", function.ReturnType.GetShortLabel()));\r\n\r\n            foreach (ParameterProfile parameter in function.ParameterProfiles)\r\n            {\r\n                var parameterDescription = new XElement(functionDescriptionNs + \"param\"\r\n                    , new XAttribute(\"name\", parameter.Name)\r\n                    , new XAttribute(\"typelabel\", parameter.Type.GetShortLabel())\r\n                    , new XAttribute(\"label\", parameter.LabelLocalized)\r\n                    , new XAttribute(\"required\", parameter.IsRequired && !parameter.IsInjectedValue)\r\n                    , new XAttribute(\"description\", parameter.HelpDefinition.GetLocalized().HelpText));\r\n\r\n                functionDescription.Add(parameterDescription);\r\n            }\r\n\r\n            allFunctionDescriptions.Add(functionDescription);\r\n        }\r\n\r\n        return allFunctionDescriptions;\r\n    }\r\n\r\n    private void WriteTo(XContainer markupSource, Control targetControl)\r\n    {\r\n        targetControl.Controls.Add(new LiteralControl(markupSource.ToString()));\r\n    }\r\n\r\n\r\n    private static XDocument Clone(XDocument document)\r\n    {\r\n        return new XDocument(CloneElement(document.Root));\r\n    }\r\n\r\n    private static XElement CloneElement(XElement element)\r\n    {\r\n        return new XElement(element.Name, element.Attributes(),\r\n            element.Nodes().Select(n =>\r\n            {\r\n                XElement e = n as XElement;\r\n                if (e != null)\r\n                    return CloneElement(e);\r\n                return n;\r\n            }\r\n            )\r\n        );\r\n    }\r\n\r\n    protected static string GetString(string localPart)\r\n    {\r\n        return StringResourceSystemFacade.GetString(\"Composite.Web.FormControl.FunctionCallsDesigner\", localPart);\r\n    }\r\n\r\n    protected string EventTarget\r\n    {\r\n        get\r\n        {\r\n            return IsPostBack ? Request.Form[\"__EVENTTARGET\"] : string.Empty;\r\n        }\r\n    }\r\n\r\n    public class TreeRenderingXsltExtensionObject\r\n    {\r\n        private readonly Dictionary<string, string> _pathToIdMapping;\r\n\r\n        public TreeRenderingXsltExtensionObject(Dictionary<string, string> pathToIdMapping)\r\n        {\r\n            _pathToIdMapping = pathToIdMapping;\r\n        }\r\n\r\n        public string GetVirtualParameterId(string functionPath, string parameterName)\r\n        {\r\n            return _pathToIdMapping[TreeHelper.GetParameterPath(functionPath, parameterName)];\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/functioncalleditor.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class functioneditor {\r\n    \r\n    /// <summary>\r\n    /// Form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm Form1;\r\n    \r\n    /// <summary>\r\n    /// ctlFeedback control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Feedback ctlFeedback;\r\n    \r\n    /// <summary>\r\n    /// btnSetNewFunction control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Generic btnSetNewFunction;\r\n    \r\n    /// <summary>\r\n    /// btnAddFunction control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Generic btnAddFunction;\r\n    \r\n    /// <summary>\r\n    /// btnDeleteFunction control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Generic btnDeleteFunction;\r\n    \r\n    /// <summary>\r\n    /// TreePlaceholder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder TreePlaceholder;\r\n    \r\n    /// <summary>\r\n    /// mlvMain control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.MultiView mlvMain;\r\n    \r\n    /// <summary>\r\n    /// viewParameter control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.View viewParameter;\r\n    \r\n    /// <summary>\r\n    /// txtFieldName control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Label txtFieldName;\r\n    \r\n    /// <summary>\r\n    /// txtFieldType control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Label txtFieldType;\r\n    \r\n    /// <summary>\r\n    /// txtFieldDescription control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Label txtFieldDescription;\r\n    \r\n    /// <summary>\r\n    /// btnDefault control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Generic btnDefault;\r\n    \r\n    /// <summary>\r\n    /// btnConstant control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Generic btnConstant;\r\n    \r\n    /// <summary>\r\n    /// btnInputParameter control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Generic btnInputParameter;\r\n    \r\n    /// <summary>\r\n    /// btnFunctionCall control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.PostBackDialog btnFunctionCall;\r\n    \r\n    /// <summary>\r\n    /// mlvWidget control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.MultiView mlvWidget;\r\n    \r\n    /// <summary>\r\n    /// viewWidget_Constant control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.View viewWidget_Constant;\r\n    \r\n    /// <summary>\r\n    /// plhWidget control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder plhWidget;\r\n    \r\n    /// <summary>\r\n    /// viewWidget_InputParameter control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.View viewWidget_InputParameter;\r\n    \r\n    /// <summary>\r\n    /// lstInputParameterName control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Selector lstInputParameterName;\r\n    \r\n    /// <summary>\r\n    /// viewFunction control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.View viewFunction;\r\n    \r\n    /// <summary>\r\n    /// txtFunctionName control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Label txtFunctionName;\r\n    \r\n    /// <summary>\r\n    /// txtFunctionReturnType control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Label txtFunctionReturnType;\r\n    \r\n    /// <summary>\r\n    /// txtFunctionDescription control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Label txtFunctionDescription;\r\n    \r\n    /// <summary>\r\n    /// plhEditLocalName control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder plhEditLocalName;\r\n    \r\n    /// <summary>\r\n    /// txtLocalName control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.DataInput txtLocalName;\r\n    \r\n    /// <summary>\r\n    /// viewNoSelection control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.View viewNoSelection;\r\n    \r\n    /// <summary>\r\n    /// ctlSourceEditor control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Generic ctlSourceEditor;\r\n    \r\n    /// <summary>\r\n    /// fldMode control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.HiddenField fldMode;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/functioneditor-sample-function.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<functions>\r\n  <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Pages.SitemapXml\">\r\n    <f:param name=\"SitemapScope\" value=\"AncestorAndCurrent\" />\r\n  </f:function>\r\n  <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.GetIPageXml\">\r\n    <f:param name=\"PropertyNames\">\r\n      <f:paramelement value=\"Id\" />\r\n      <f:paramelement value=\"Title\" />\r\n      <f:paramelement value=\"MenuTitle\" />\r\n      <f:paramelement value=\"ChangedBy\" />\r\n    </f:param>\r\n    <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Filter\">\r\n      <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.CompoundFilter\">\r\n        <f:param name=\"IsAndQuery\" value=\"False\" />\r\n        <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Left\">\r\n          <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.FieldPredicatesFilter\">\r\n            <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"ChangeDate\">\r\n              <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Utils.Predicates.DateTimeGreaterThan\">\r\n                <f:param name=\"Value\" value=\"2009-10-01T00:00:00+02:00\" />\r\n              </f:function>\r\n            </f:param>\r\n          </f:function>\r\n        </f:param>\r\n        <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Right\">\r\n          <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.DataReferenceFilter\">\r\n            <f:param name=\"DataReference\" value=\"69f9e0f1-e2ce-4b99-a1ba-5117964b0793\" />\r\n          </f:function>\r\n        </f:param>\r\n      </f:function>\r\n    </f:param>\r\n    <f:param name=\"PageSize\" value=\"5\" />\r\n    <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"PageNumber\">\r\n      <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Utils.GetInputParameter\">\r\n        <f:param name=\"InputParameterName\" value=\"pagenumber\" />\r\n      </f:function>\r\n    </f:param>\r\n  </f:function>\r\n  <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.GetIPageXml\" />\r\n  \r\n</functions>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/functioneditortree.xslt",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xsl:stylesheet \r\n\tversion=\"1.0\" \r\n\txmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \r\n\txmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" \r\n\txmlns:f=\"http://www.composite.net/ns/function/1.0\" \r\n\txmlns:desc=\"#functionDescription\" \r\n\txmlns:ui=\"http://www.w3.org/1999/xhtml\"\r\n  xmlns:helper=\"functioncalleditor\"\r\n\texclude-result-prefixes=\"xsl msxsl f desc helper\">\r\n\r\n  <xsl:param name=\"SelectedId\" />\r\n  \r\n\t<xsl:template match=\"/\">\r\n\t\t<ui:tree id=\"tree\">\r\n\t\t\t<ui:treebody id=\"treebody\">\r\n\t\t\t\t<!--<ui:treenode label=\"Function Calls\" open=\"true\">-->\r\n\t\t\t\t\t<xsl:apply-templates select=\"*/f:function\"/>\r\n      \t\t<xsl:apply-templates select=\"*/f:widgetfunction\"/>\r\n<!--        \t\t</ui:treenode> -->\r\n\t\t\t</ui:treebody>\r\n\t\t</ui:tree>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"f:function|f:widgetfunction\">\r\n\t\r\n\t\t<xsl:variable name=\"desc\" select=\"//desc:function[@compositename=current()/@name]\"/>\r\n\t\t<xsl:if test=\"count($desc)=0\">\r\n\t\t\t<xsl:message terminate=\"yes\">Undescribed function name encountered.</xsl:message>\r\n\t\t</xsl:if>\r\n\r\n\t    <xsl:variable name=\"label\">\r\n\t    \t<xsl:value-of select=\"$desc/@namespace\" />\r\n\t    \t<xsl:text>.</xsl:text>\r\n\t    \t<xsl:value-of select=\"$desc/@name\" />\r\n\t    \t<xsl:if test=\"@localname != ''\">\r\n\t\t    \t<xsl:text> : </xsl:text>\r\n\t\t    \t<xsl:value-of select=\"@localname \"/>\r\n\t    \t</xsl:if>\r\n\t    </xsl:variable>\r\n\r\n\t\t<xsl:variable name=\"id\" select=\"translate(@id,'-','')\"/>\r\n\r\n\t\t<ui:treenode \r\n\t\t\tlabel=\"{$label}\" \r\n\t\t\timage=\"${{icon:base-function-function}}\" \r\n\t\t\topen=\"true\" title=\"{$desc/@description}\" \r\n\t\t\tcallbackid=\"{@id}\"\r\n\t\t\tid=\"id{$id}\"\r\n\t\t\thandle=\"handle{@id}\">\r\n      \r\n      <xsl:if test=\"$SelectedId = $id\">\r\n        <xsl:attribute name=\"focused\">true</xsl:attribute>\r\n      </xsl:if>\r\n\r\n      <xsl:apply-templates select=\"$desc/desc:param\">\r\n\t\t\t\t<xsl:with-param name=\"funcimpl\" select=\".\"/>\r\n\t\t\t</xsl:apply-templates>\r\n\t\t</ui:treenode>\r\n\t\t\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"desc:param\">\r\n\t\t<xsl:param name=\"funcimpl\"/>\r\n    \r\n\t\t<xsl:variable name=\"desc\" select=\".\"/>\r\n\t\t<xsl:variable name=\"impl\" select=\"$funcimpl/f:param[@name=$desc/@name]\"/>\r\n    <xsl:variable name=\"id\"><xsl:choose>\r\n        <xsl:when test=\"count($impl) > 0\"><xsl:value-of select=\"$impl/@id\"/></xsl:when>\r\n        <xsl:otherwise><xsl:value-of select=\"helper:GetVirtualParameterId($funcimpl/@path, $desc/@name)\"/></xsl:otherwise>\r\n    </xsl:choose></xsl:variable>\r\n\r\n    <xsl:variable name=\"cleanedId\"><xsl:value-of select=\"translate($id,'-','')\" /></xsl:variable>\r\n\r\n    <xsl:variable name=\"label\">\r\n      <xsl:value-of select=\"$desc/@label\" />\r\n      <xsl:if test=\"$impl/@inputParameter != ''\">\r\n        <xsl:text> ← </xsl:text>\r\n        <xsl:value-of select=\"$impl/@inputParameter\"/>\r\n      </xsl:if>\r\n    </xsl:variable>\r\n    \r\n\t\t<ui:treenode label=\"{$label}\" open=\"false\" title=\"{$desc/@description}\" callbackid=\"{$id}\" id=\"id{$cleanedId}\" handle=\"handle{$cleanedId}\">\r\n      <xsl:if test=\"$SelectedId = $id\">\r\n        <xsl:attribute name=\"focused\">true</xsl:attribute>\r\n      </xsl:if>\r\n      \r\n\t\t\t<xsl:choose>\r\n\t\t\t\t<xsl:when test=\"count($impl) &gt; 0 and count($impl/f:function)=0\">\r\n\t\t\t\t\t<xsl:attribute name=\"image\">${icon:parameter_overloaded}</xsl:attribute>\r\n\t\t\t\t</xsl:when> \r\n\t\t\t\t<xsl:when test=\"count($impl) &gt; 0\">\r\n\t\t\t\t\t<xsl:attribute name=\"image\">${icon:parameter_overloaded}</xsl:attribute>\r\n\t\t\t\t\t<xsl:apply-templates select=\"$impl/f:function\"/>\r\n\t\t\t\t</xsl:when>\r\n\t\t\t\t<xsl:when test=\"$desc/@required='true'\">\r\n\t\t\t\t\t<xsl:attribute name=\"image\">${icon:parameter_missing}</xsl:attribute>\r\n\t\t\t\t</xsl:when>\r\n\t\t\t\t<xsl:otherwise>\r\n\t\t\t\t\t<xsl:attribute name=\"image\">${icon:parameter}</xsl:attribute>\r\n\t\t\t\t</xsl:otherwise>\r\n\t\t\t</xsl:choose>\r\n\t\t</ui:treenode>\r\n\t</xsl:template>\r\n\r\n\t<!--\r\n\t\t<ui:treenode label=\"Composite.Data.Types.IMediaFolder.GetIMediaFolderXml\" image=\"${{icon:functioncall}}\" open=\"true\"> <ui:treenode label=\"Selected fields: Id, Path\" image=\"${{icon:parameter_overloaded}}\" /> <ui:treenode label=\"Filter\" image=\"${{icon:parameter_overloaded}}\" open=\"true\">\r\n\t\t<ui:treenode label=\"Composite.Data.Types.IMediaFolder.FieldPredicateFilter\" image=\"${{icon:functioncall}}\" open=\"true\"> <ui:treenode label=\"Id\" image=\"${{icon:parameter_overloaded}}\" open=\"true\"> <ui:treenode label=\"Composite.Utils.Predicates.GuidEquals\" image=\"${{icon:functioncall}}\" open=\"true\">\r\n\t\t<ui:treenode label=\"The value to compare to\" image=\"${{icon:parameter_overloaded}}\" open=\"true\"> <ui:treenode label=\"Composite.Web.Request.QueryStringGuidValue\" image=\"${{icon:functioncall}}\" open=\"true\"> <ui:treenode label=\"Parameter name: mediafolderid\" image=\"${{icon:parameter_overloaded}}\" />\r\n\t\t<ui:treenode label=\"Fallback Value\" image=\"${{icon:parameter}}\" /> </ui:treenode> </ui:treenode> </ui:treenode> </ui:treenode> <ui:treenode label=\"KeyPath\" image=\"${{icon:parameter}}\" /> <ui:treenode label=\"CompositePath\" image=\"${{icon:parameter}}\" /> <ui:treenode label=\"StoreId\"\r\n\t\timage=\"${{icon:parameter}}\" /> <ui:treenode label=\"Path\" image=\"${{icon:parameter}}\" /> <ui:treenode label=\"Title\" image=\"${{icon:parameter}}\" /> <ui:treenode label=\"Descrition\" image=\"${{icon:parameter}}\" /> </ui:treenode> </ui:treenode> <ui:treenode label=\"Order by\" image=\"${{icon:parameter}}\"\r\n\t\t/> <ui:treenode label=\"Order ascending\" image=\"${{icon:parameter}}\" /> <ui:treenode label=\"Page\" image=\"${{icon:parameter}}\" /> </ui:treenode>\r\n\t-->\r\n\r\n</xsl:stylesheet>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/functioncalleditor/out.tmp.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<functions>\r\n  <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Pages.SitemapXml\" id=\"/function[1]\">\r\n    <f:param name=\"PageAssociationScope\" value=\"AncestorAndCurrentPages\" id=\"/function[1]/@PageAssociationScope\" />\r\n  </f:function>\r\n  <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.GetIPageXml\" id=\"/function[2]\">\r\n    <f:param name=\"PropertyNames\" id=\"/function[2]/@PropertyNames\">\r\n      <f:paramelement value=\"Id\" />\r\n      <f:paramelement value=\"Title\" />\r\n      <f:paramelement value=\"MenuTitle\" />\r\n      <f:paramelement value=\"ChangedBy\" />\r\n    </f:param>\r\n    <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Filter\" id=\"/function[2]/@Filter\">\r\n      <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.CompoundFilter\" id=\"/function[2]/@Filter/function\">\r\n        <f:param name=\"IsAndQuery\" value=\"False\" id=\"/function[2]/@Filter/function/@IsAndQuery\" />\r\n        <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Left\" id=\"/function[2]/@Filter/function/@Left\">\r\n          <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.FieldPredicatesFilter\" id=\"/function[2]/@Filter/function/@Left/function\">\r\n            <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"ChangeDate\" id=\"/function[2]/@Filter/function/@Left/function/@ChangeDate\">\r\n              <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Utils.Predicates.DateTimeGreaterThan\" id=\"/function[2]/@Filter/function/@Left/function/@ChangeDate/function\">\r\n                <f:param name=\"Value\" value=\"2009-10-01T00:00:00+02:00\" id=\"/function[2]/@Filter/function/@Left/function/@ChangeDate/function/@Value\" />\r\n              </f:function>\r\n            </f:param>\r\n          </f:function>\r\n        </f:param>\r\n        <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Right\" id=\"/function[2]/@Filter/function/@Right\">\r\n          <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.DataReferenceFilter\" id=\"/function[2]/@Filter/function/@Right/function\">\r\n            <f:param name=\"DataReference\" value=\"69f9e0f1-e2ce-4b99-a1ba-5117964b0793\" id=\"/function[2]/@Filter/function/@Right/function/@DataReference\" />\r\n          </f:function>\r\n        </f:param>\r\n      </f:function>\r\n    </f:param>\r\n    <f:param name=\"PageSize\" value=\"5\" id=\"/function[2]/@PageSize\" />\r\n    <f:param xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"PageNumber\" id=\"/function[2]/@PageNumber\">\r\n      <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Utils.GetInputParameter\" id=\"/function[2]/@PageNumber/function\">\r\n        <f:param name=\"InputParameterName\" value=\"pagenumber\" id=\"/function[2]/@PageNumber/function/@InputParameterName\" />\r\n      </f:function>\r\n    </f:param>\r\n  </f:function>\r\n  <f:function xmlns:f=\"http://www.composite.net/ns/function/1.0\" name=\"Composite.Data.Types.IPage.GetIPageXml\" id=\"/function[3]\" />\r\n  <function compositename=\"Composite.Pages.SitemapXml\" name=\"SitemapXml\" namespace=\"Composite.Pages\" description=\"Returns a hierarchical XML structure of pages. When executed as part of a page rendering XML elements representing the current and ancestor pages will be appended the attributes isopen=”true” and iscurrent=”true”\" returntypelabel=\"IEnumerable&lt;XElement&gt;\" xmlns=\"#functionDescription\">\r\n    <param name=\"SourcePage\" typelabel=\"DataReference&lt;C1 Page&gt;\" label=\"Source page\" required=\"false\" description=\"By default the source page is the page currently being rendered. Specify a value if you want to get sitemap information relative to another page. The source page controls how page elements are annotated with 'isopen' and 'iscurrent' and is the starting point when calculating the page scope.\" />\r\n    <param name=\"PageAssociationScope\" typelabel=\"PageAssociationScope\" label=\"Page scope\" required=\"false\" description=\"The scope of pages to extract from the sitemap. The default is 'all pages'. You can use this parameter to extract the structure you need to complete your task.\" />\r\n  </function>\r\n  <function compositename=\"Composite.Data.Types.IPage.GetIPageXml\" name=\"GetIPageXml\" namespace=\"Composite.Data.Types.IPage\" description=\"Retrieves an XML representation of the data. \" returntypelabel=\"IEnumerable&lt;XElement&gt;\" xmlns=\"#functionDescription\">\r\n    <param name=\"PropertyNames\" typelabel=\"IEnumerable&lt;String&gt;\" label=\"Selected fields\" required=\"true\" description=\"The data fields to output in the XML. Fewer fields can yield faster renderings.\" />\r\n    <param name=\"Filter\" typelabel=\"Expression&lt;Func&lt;C1 Page,Boolean&gt;&gt;\" label=\"Filter\" required=\"false\" description=\"\" />\r\n    <param name=\"OrderByField\" typelabel=\"String\" label=\"Order by\" required=\"false\" description=\"The field to order data by\" />\r\n    <param name=\"OrderAscending\" typelabel=\"Boolean\" label=\"Order ascending\" required=\"false\" description=\"When set to true results are delivered in in ascending order, otherwise descending order is used. Default is ascending order.\" />\r\n    <param name=\"PageSize\" typelabel=\"Int32\" label=\"Page size\" required=\"false\" description=\"The number of items to display on one page – the maximum number of elements to return. \" />\r\n    <param name=\"PageNumber\" typelabel=\"Int32\" label=\"Page number\" required=\"false\" description=\"If the number of data elements exceed the page size you can use paging to move to the other pages. See the Page size parameter.\" />\r\n    <param name=\"ShowReferencesInline\" typelabel=\"Boolean\" label=\"Show reference data inline\" required=\"false\" description=\"If you include reference data in the 'Selected properties' setting, you can use this option to control how the referenced data is included. 'Inline' is easy to use, but may bloat the size of the XML document.\" />\r\n    <param name=\"IncludePagingInfo\" typelabel=\"Boolean\" label=\"Include paging info\" required=\"false\" description=\"When selected the data XML will be preceded by a &lt;PagingInfo /&gt; element detailing number of pages, items and more.\" />\r\n    <param name=\"Randomized\" typelabel=\"Boolean\" label=\"Randomized\" required=\"false\" description=\"When true data can be ordered randomly. Specify the number of random results you require by setting the 'Page size'. If a filter is specified, this is applied before the random selection. If you speficy an 'Order by' value, you should specify a low 'Page size' or the randomization will become void.\" />\r\n    <param name=\"ElementName\" typelabel=\"String\" label=\"Element name\" required=\"false\" description=\"The name of the XML element. The detault is 'IPage'\" />\r\n    <param name=\"ElementNamespace\" typelabel=\"XNamespace\" label=\"Element namespace\" required=\"false\" description=\"The namespace the XML element belongs to. The detault is ''\" />\r\n  </function>\r\n  <function compositename=\"Composite.Data.Types.IPage.CompoundFilter\" name=\"CompoundFilter\" namespace=\"Composite.Data.Types.IPage\" description=\"Defines an “and” or “or” query, combining two other filters.\" returntypelabel=\"Expression&lt;Func&lt;C1 Page,Boolean&gt;&gt;\" xmlns=\"#functionDescription\">\r\n    <param name=\"IsAndQuery\" typelabel=\"Boolean\" label=\"And / or filter\" required=\"false\" description=\"If you select “And” both filters are applied to the data. Selecting “Or” will give you the data that matches just one of the filters.\" />\r\n    <param name=\"Left\" typelabel=\"Expression&lt;Func&lt;C1 Page,Boolean&gt;&gt;\" label=\"Left filter\" required=\"true\" description=\"One of the two filters (the one to evaluate first)\" />\r\n    <param name=\"Right\" typelabel=\"Expression&lt;Func&lt;C1 Page,Boolean&gt;&gt;\" label=\"Right filter\" required=\"true\" description=\"One of the two filters (the one to evaluate last)\" />\r\n  </function>\r\n  <function compositename=\"Composite.Data.Types.IPage.FieldPredicatesFilter\" name=\"FieldPredicatesFilter\" namespace=\"Composite.Data.Types.IPage\" description=\"Lets you specify a filter on data by specifying requirements for the individual fields. If you set requirements on multiple fields, they are all enforced (and query).\" returntypelabel=\"Expression&lt;Func&lt;C1 Page,Boolean&gt;&gt;\" xmlns=\"#functionDescription\">\r\n    <param name=\"Id\" typelabel=\"Expression&lt;Func&lt;Guid,Boolean&gt;&gt;\" label=\"Id filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"TemplateId\" typelabel=\"Expression&lt;Func&lt;Guid,Boolean&gt;&gt;\" label=\"TemplateId filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"Title\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"Title filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"MenuTitle\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"MenuTitle filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"UrlTitle\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"UrlTitle filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"FriendlyUrl\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"FriendlyUrl filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"Abstract\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"Abstract filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"ChangeDate\" typelabel=\"Expression&lt;Func&lt;DateTime,Boolean&gt;&gt;\" label=\"ChangeDate filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"ChangedBy\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"ChangedBy filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"PublicationStatus\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"PublicationStatus filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"CultureName\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"CultureName filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n    <param name=\"SourceCultureName\" typelabel=\"Expression&lt;Func&lt;String,Boolean&gt;&gt;\" label=\"SourceCultureName filter\" required=\"false\" description=\"Specify a criteria that this field must meet or use the default value (no criteria)\" />\r\n  </function>\r\n  <function compositename=\"Composite.Utils.Predicates.DateTimeGreaterThan\" name=\"DateTimeGreaterThan\" namespace=\"Composite.Utils.Predicates\" description=\"Check if a date is greater than a certain value\" returntypelabel=\"Expression&lt;Func&lt;DateTime,Boolean&gt;&gt;\" xmlns=\"#functionDescription\">\r\n    <param name=\"Value\" typelabel=\"DateTime\" label=\"The value to compare with\" required=\"true\" description=\"\" />\r\n  </function>\r\n  <function compositename=\"Composite.Data.Types.IPage.DataReferenceFilter\" name=\"DataReferenceFilter\" namespace=\"Composite.Data.Types.IPage\" description=\"Converts a DataReference into a single element filter. This filter will select a maximum of one item.\" returntypelabel=\"Expression&lt;Func&lt;C1 Page,Boolean&gt;&gt;\" xmlns=\"#functionDescription\">\r\n    <param name=\"DataReference\" typelabel=\"DataReference&lt;C1 Page&gt;\" label=\"Data Reference\" required=\"true\" description=\"The Data Reference to use when selecting data.\" />\r\n  </function>\r\n  <function compositename=\"Composite.Utils.GetInputParameter\" name=\"GetInputParameter\" namespace=\"Composite.Utils\" description=\"Returns an input parameter from executing function context. Use this in developing to copy an input value to a new function call.\" returntypelabel=\"Object\" xmlns=\"#functionDescription\">\r\n    <param name=\"InputParameterName\" typelabel=\"String\" label=\"Parameter name\" required=\"true\" description=\"Specify the name of the input parameter which value you wish to use here.\" />\r\n  </function>\r\n</functions>"
  },
  {
    "path": "Website/Composite/content/misc/editors/resxeditor/Bindings/RowContainerBinding.js",
    "content": "RowContainerBinding.prototype = new Binding;\r\nRowContainerBinding.prototype.constructor = RowContainerBinding;\r\nRowContainerBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * RowContainerBinding.\r\n * @param {DOMElement} bindingElement\r\n */\r\nfunction RowContainerBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"RowContainerBinding\");\r\n\r\n\t/*\r\n\t * Return this.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nRowContainerBinding.prototype.toString = function () {\r\n\r\n\treturn \"[RowContainerBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nRowContainerBinding.prototype.onBindingRegister = function () {\r\n\r\n\tRowContainerBinding.superclass.onBindingRegister.call(this);\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nRowContainerBinding.prototype.onBindingAttach = function () {\r\n\r\n\tRowContainerBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tvar row, rows = new List(this.bindingElement.rows);\r\n\twhile (rows.hasNext()) {\r\n\t\trow = rows.getNext();\r\n\t\tDOMEvents.addEventListener(row, DOMEvents.MOUSEENTER, this);\r\n\t\tDOMEvents.addEventListener(row, DOMEvents.MOUSELEAVE, this);\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nRowContainerBinding.prototype.handleEvent = function (e) {\r\n\r\n\tRowContainerBinding.superclass.handleEvent.call(this, e);\r\n\r\n\tvar target = e.currentTarget ? e.currentTarget : DOMEvents.getTarget(e);\r\n\r\n\tswitch (e.type) {\r\n\t\tcase DOMEvents.MOUSEENTER:\r\n\t\tcase DOMEvents.MOUSEOVER:\r\n\t\t\tvar row, rows = new List(this.bindingElement.rows);\r\n\t\t\twhile (rows.hasNext()) {\r\n\t\t\t\trow = rows.getNext();\r\n\t\t\t\tCSSUtil.detachClassName(row, \"hilite\");\r\n\t\t\t}\r\n\t\t\tCSSUtil.attachClassName(target, \"hilite\");\r\n\t\t\tbreak;\r\n\r\n\t\tcase DOMEvents.MOUSELEAVE:\r\n\t\tcase DOMEvents.MOUSEOUT:\r\n\t\t\tCSSUtil.detachClassName(target, \"hilite\");\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/resxeditor/resxeditor.aspx",
    "content": "<%@ Page Async=\"true\" Language=\"C#\" Debug=\"true\" AutoEventWireup=\"true\" CodeFile=\"resxeditor.aspx.cs\" Inherits=\"ResxEditor\"\r\n\tValidateRequest=\"false\" %>\r\n\r\n<%@ Import Namespace=\"Composite.Core.ResourceSystem\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\t<control:styleloader runat=\"server\" />\r\n\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"resxeditor.css.aspx\" />\r\n\t<link href=\"https://fonts.googleapis.com/css?family=Open+Sans:600,400\" rel=\"stylesheet\" type=\"text/css\" />\r\n\t<script type=\"text/javascript\" src=\"bindings/RowContainerBinding.js\"></script>\r\n</head>\r\n<body>\r\n\t<form runat=\"server\" class=\"updateform updatezone\">\r\n\t\t<ui:editorpage label=\"<%= PageTitle%>\" image=\"${icon:page-list-unpublished-items}\">\r\n\t\t\t<aspui:feedback runat=\"server\"\r\n\t\t\t\tid=\"ctlFeedback\"\r\n\t\t\t\toncommand=\"OnMessage\" />\r\n\t\t\t<ui:broadcasterset>\r\n\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t</ui:broadcasterset>\r\n\t\t\t<ui:toolbar id=\"toolbar\" class=\"document-toolbar\">\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbarbutton\r\n\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\tid=\"savebutton\"\r\n\t\t\t\t\t\timage=\"${icon:save}\"\r\n\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\"\r\n\t\t\t\t\t\tlabel=\"${string:Composite.Web.SourceEditor:ResxEditor.Save}\"\r\n\t\t\t\t\t\tobserves=\"broadcasterCanSave\" />\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\t\t\t<ui:scrollbox id=\"scrollbox\">\r\n\t\t\t\t<table class=\"table\">\r\n\t\t\t\t\t<asp:Repeater ID=\"DataRepeater\" runat=\"server\">\r\n\t\t\t\t\t\t<HeaderTemplate>\r\n\t\t\t\t\t\t\t<thead>\r\n\t\t\t\t\t\t\t\t<tr class=\"head\">\r\n\t\t\t\t\t\t\t\t\t<th>\r\n\t\t\t\t\t\t\t\t\t\t<%= LocalizationFiles.Composite_Web_SourceEditor.ResxEditor_Label %> \r\n\t\t\t\t\t\t\t\t\t</th>\r\n\t\t\t\t\t\t\t\t\t<th>\r\n\t\t\t\t\t\t\t\t\t\t<%= LocalizationFiles.Composite_Web_SourceEditor.ResxEditor_OriginalText %> \r\n\t\t\t\t\t\t\t\t\t</th>\r\n\t\t\t\t\t\t\t\t\t<% if (OtherCultureExist)\r\n\t\t\t\t\t\t\t\t\t\t{ %>\r\n\t\t\t\t\t\t\t\t\t<th>\r\n\t\t\t\t\t\t\t\t\t\t<%= LocalizationFiles.Composite_Web_SourceEditor.ResxEditor_TranslatedText %> \r\n\t\t\t\t\t\t\t\t\t</th>\r\n\t\t\t\t\t\t\t\t\t<% } %>\r\n\t\t\t\t\t\t\t\t\t<th></th>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t</thead>\r\n\t\t\t\t\t\t\t<tbody id=\"tbody\" binding=\"RowContainerBinding\">\r\n\t\t\t\t\t\t</HeaderTemplate>\r\n\t\t\t\t\t\t<ItemTemplate>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\t<asp:Label ID=\"Label\" runat=\"server\" Text='<%#Eval(\"Label\") %>' />\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<% if (!OtherCultureExist)\r\n\t\t\t\t\t\t\t\t\t{ %>\r\n\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata class=\"inputbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t<aspui:datainput id=\"Original\" runat=\"server\" text='<%#Eval(\"Original\")%>' />\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<% } %>\r\n\t\t\t\t\t\t\t\t<% if (OtherCultureExist)\r\n\t\t\t\t\t\t\t\t\t{ %>\r\n\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\t<asp:Literal ID=\"Original2\" runat=\"server\" Text='<%#HttpUtility.HtmlEncode(Eval(\"Original\"))%>' />\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata class=\"inputbox\">\r\n\t\t\t\t\t\t\t\t\t\t\t<aspui:datainput id=\"Translated\" runat=\"server\" text='<%#Eval(\"Translated\")%>' language='<%#CultureName%>' />\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<% } %>\r\n\t\t\t\t\t\t\t\t<td></td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t</ItemTemplate>\r\n\t\t\t\t\t\t<FooterTemplate>\r\n\t\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t\t</FooterTemplate>\r\n\t\t\t\t\t</asp:Repeater>\r\n\t\t\t\t</table>\r\n\t\t\t</ui:scrollbox>\r\n\t\t</ui:editorpage>\r\n\t</form>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/resxeditor/resxeditor.aspx.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Threading.Tasks;\r\nusing System.Web.UI.WebControls;\r\nusing System.Xml.Linq;\r\nusing Castle.Core.Internal;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Core.IO;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\n\r\npublic partial class ResxEditor : System.Web.UI.Page\r\n{\r\n    public string FileName\r\n    {\r\n        get { return (string)ViewState[\"FileName\"]; }\r\n        set { ViewState[\"FileName\"] = value; }\r\n    }\r\n\r\n    public string CultureName\r\n    {\r\n        get { return (string)ViewState[\"CultureName\"]; }\r\n        set { ViewState[\"CultureName\"] = value; }\r\n    }\r\n\r\n    public string PageTitle\r\n    {\r\n        get { return Path.GetFileName(GetCurrentAlternateFileName(FileName)); }\r\n    }\r\n\r\n    public bool OtherCultureExist\r\n    {\r\n        get { return bool.Parse((string)ViewState[\"OtherCultureExist\"]); }\r\n        set { ViewState[\"OtherCultureExist\"] = value.ToString(); }\r\n    }\r\n    public List<string> OtherCulturesCultureNames { get; set; }\r\n\r\n\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n\r\n        if (!this.IsPostBack)\r\n        {\r\n            OtherCultureExist = false;\r\n\r\n            FileName = Request.QueryString[\"f\"];\r\n\r\n            CultureName = Request.QueryString[\"t\"];\r\n\r\n            if (CultureName != null)\r\n            {\r\n                OtherCultureExist = true;\r\n                Save(null, null);\r\n                var entityToken = new WebsiteFileElementProviderEntityToken(\"WebsiteFileElementProvider\",\r\n                    Path.GetDirectoryName(FileName), Path.GetDirectoryName(PathUtil.BaseDirectory));\r\n                ConsoleMessageQueueFacade.Enqueue(new RefreshTreeMessageQueueItem { EntityToken = entityToken }, null);\r\n            }\r\n\r\n            if (!FileName.EndsWith(\".resx\", StringComparison.OrdinalIgnoreCase))\r\n            {\r\n                FileName = null;\r\n                return;\r\n            }\r\n\r\n            var loc = CultureInfo.GetCultures(CultureTypes.AllCultures)\r\n                .LastOrDefault(f => f.Name != \"\" && FileName.EndsWith(\".\" + f.Name + \".Resx\", StringComparison.OrdinalIgnoreCase));\r\n\r\n            if (loc != null)\r\n            {\r\n                FileName = FileName.Replace(loc.Name + \".\", \"\");\r\n                OtherCultureExist = true;\r\n            }\r\n\r\n            if (loc != null)\r\n            {\r\n                CultureName = loc.Name;\r\n            }\r\n\r\n            this.BindGridView();\r\n        }\r\n    }\r\n\r\n\r\n\r\n    private static Dictionary<string, string> GetResDic(string file)\r\n    {\r\n        Dictionary<string, string> res = new Dictionary<string, string>();\r\n\r\n        try\r\n        {\r\n            var xdoc = XDocument.Load(file);\r\n            var topicNodes = xdoc.Descendants(\"data\");\r\n            foreach (var node in topicNodes)\r\n            {\r\n                if (node.Attributes().Any(f => f.Name == XNamespace.Xml + \"space\" && f.Value == \"preserve\"))\r\n                {\r\n                    var xAttribute = node.Attribute(\"name\");\r\n                    if (xAttribute != null) res.Add(xAttribute.Value, node.Descendants(\"value\").First().Value);\r\n                }\r\n\r\n            }\r\n\r\n            return res;\r\n        }\r\n        catch\r\n        {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    public async void Save(object sender, CommandEventArgs e)\r\n    {\r\n        if (FileName == null)\r\n            return;\r\n\r\n        if (!OtherCultureExist)\r\n        {\r\n            var xdoc = await Task.Run(() => XDocument.Load(FileName));\r\n            foreach (RepeaterItem item in DataRepeater.Items)\r\n            {\r\n                var labelcontrol = item.FindControl(\"Label\") as Label;\r\n                if (labelcontrol != null)\r\n                {\r\n                    var label = labelcontrol.Text;\r\n                    var textBox = item.FindControl(\"Original\") as TextBox;\r\n                    if (textBox != null)\r\n                    {\r\n                        var original = textBox.Text;\r\n                        var target = xdoc.Descendants(\"data\").SingleOrDefault(f =>\r\n                        {\r\n                            var xAttribute = f.Attribute(\"name\");\r\n                            return xAttribute != null && xAttribute.Value == label;\r\n                        });\r\n                        if (target != null)\r\n                        {\r\n                            target.Descendants(\"value\").Single().Value = original ?? \"\";\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            await Task.Run(() => xdoc.Save(FileName));\r\n        }\r\n        else\r\n        {\r\n            var xdoc = await Task.Run(() => XDocument.Load(FileName));\r\n            foreach (RepeaterItem item in DataRepeater.Items)\r\n            {\r\n                var labelcontrol = item.FindControl(\"Label\") as Label;\r\n                if (labelcontrol != null)\r\n                {\r\n                    var label = labelcontrol.Text;\r\n                    var textBox = item.FindControl(\"Translated\") as TextBox;\r\n                    if (textBox != null)\r\n                    {\r\n                        var translated = textBox.Text;\r\n                        var target = xdoc.Descendants(\"data\").SingleOrDefault(f =>\r\n                        {\r\n                            var xAttribute = f.Attribute(\"name\");\r\n                            return xAttribute != null && xAttribute.Value == label;\r\n                        });\r\n                        if (target != null)\r\n                        {\r\n                            target.Descendants(\"value\").Single().Value = translated ?? \"\";\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            await Task.Run(() => xdoc.Save(GetCurrentAlternateFileName(FileName)));\r\n        }\r\n        SaveStatus(true);\r\n    }\r\n\r\n    public void OnMessage()\r\n    {\r\n        string message = ctlFeedback.GetPostedMessage();\r\n\r\n        if (message == \"save\")\r\n        {\r\n            Save(null, null);\r\n            ctlFeedback.SetStatus(true);\r\n            SaveStatus(true);\r\n        }\r\n    }\r\n\r\n    protected void SaveStatus(bool succeeded)\r\n    {\r\n        var viewId = Request[\"__VIEWID\"];\r\n        var consoleId = Request[\"__CONSOLEID\"];\r\n        ConsoleMessageQueueFacade.Enqueue(new SaveStatusConsoleMessageQueueItem { ViewId = viewId, Succeeded = succeeded }, consoleId);\r\n    }\r\n\r\n    private string GetCurrentAlternateFileName(string file)\r\n    {\r\n        return Path.GetDirectoryName(file) +\r\n            Path.DirectorySeparatorChar +\r\n            Path.GetFileNameWithoutExtension(file) + ((!CultureName.IsNullOrEmpty()) ? \".\" : \"\") +\r\n               CultureName + Path.GetExtension(file);\r\n    }\r\n\r\n    private void BindGridView()\r\n    {\r\n        Dictionary<string, string> otherculturedic = null;\r\n\r\n        if (FileName == null)\r\n            return;\r\n\r\n        var dic = GetResDic(FileName);\r\n\r\n        if (dic == null)\r\n            return;\r\n\r\n        if (OtherCultureExist)\r\n        {\r\n            otherculturedic = GetResDic(GetCurrentAlternateFileName(FileName));\r\n        }\r\n\r\n        List<Phrase> li = new List<Phrase>();\r\n\r\n        foreach (var n in dic)\r\n        {\r\n            var p = new Phrase()\r\n            {\r\n                Label = n.Key,\r\n                Original = n.Value,\r\n                Translated = otherculturedic != null && otherculturedic.ContainsKey(n.Key) ? otherculturedic[n.Key] : string.Empty\r\n            };\r\n            li.Add(p);\r\n        }\r\n\r\n        DataRepeater.DataSource = li;\r\n        DataRepeater.DataBind();\r\n    }\r\n\r\n\r\n    public class Phrase\r\n    {\r\n        public string Label { get; set; }\r\n        public string Original { get; set; }\r\n        public string Translated { get; set; }\r\n    }\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/resxeditor/resxeditor.aspx.designer.cs",
    "content": "﻿public partial class ResxEditor\r\n{\r\n    protected global::Composite.Core.WebClient.UiControlLib.Feedback ctlFeedback;\r\n\r\n    protected global::System.Web.UI.WebControls.Repeater DataRepeater;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/resxeditor/resxeditor.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nhtml, input, textarea, button, select, td, th {\r\n\tfont-family: \"Open Sans\", sans-serif;\r\n\tfont-size: 13px;\r\n}\r\n\r\nth {\r\n\tfont-weight: 600;\r\n\tline-height: 18px;\r\n}\r\n\r\ntd {\r\n\tfont-weight: 400;\r\n}\r\n\r\n.title {\r\n\tfont-size: 18px;\r\n}\r\n\r\n.label {\r\n\twidth: 400px;\r\n\tword-wrap: normal;\r\n\twhite-space: normal !important;\r\n}\r\n\r\n.inputbox input {\r\n\twidth: 400px;\r\n}\r\n\r\n.table th:last-child,\r\n.table td:last-child {\r\n\twidth: 100%;\r\n}\r\n\r\n.table td {\r\n\toverflow: visible;\r\n\tcolor: inherit;\r\n\tuser-select: text;\r\n}\r\n\r\n.table .hidden {\r\n\tvisibility: hidden;\r\n}\r\n\r\n.table .hilite .hidden{\r\n\tvisibility: visible;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/BlockSelectorBinding.js",
    "content": "﻿BlockSelectorBinding.prototype = new EditorSelectorBinding;\r\nBlockSelectorBinding.prototype.constructor = BlockSelectorBinding;\r\nBlockSelectorBinding.superclass = EditorSelectorBinding.prototype;\r\n\r\nBlockSelectorBinding.LABEL_DEFAULT = \"(Default)\";\r\nBlockSelectorBinding.VALUE_DEFAULT = \"(Default)\";\r\n\r\n\r\n/**\r\n* Block format controller.\r\n* @implements {IWysiwygEditorComponent}\r\n*/\r\nfunction BlockSelectorBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"BlockSelectorBinding\");\r\n\r\n\t/**\r\n\t* @type {HTMLElement}\r\n\t*/\r\n\tthis._element = null;\r\n\r\n\t/**\r\n\t* @type {List<Format>}\r\n\t*/\r\n\tthis.priorities = null;\r\n\r\n\t/*\r\n\t* Returnable.\r\n\t*/\r\n\treturn this;\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nBlockSelectorBinding.prototype.toString = function() {\r\n\r\n\treturn \"[BlockSelectorBinding]\";\r\n};\r\n\r\n/**\r\n* Populate selector on build.\r\n* @overloads {EditorSelectorBinding#buildDOMContent}\r\n*/\r\nBlockSelectorBinding.prototype.buildDOMContent = function() {\r\n\r\n\tBlockSelectorBinding.superclass.buildDOMContent.call(this);\r\n\r\n\tthis.addActionListener(SelectorBinding.ACTION_SELECTIONCHANGED);\r\n\r\n\tvar groups = this._tinyTheme.formatGroups;\r\n\r\n\t// Compute priorities\r\n\tvar array = [];\r\n\tgroups.reverse().each(function (group) {\r\n\t\tgroup.each(function (format) {\r\n\t\t\tif (format.select != null && format.props.block != null && format.props.wrapper == 1) {\r\n\t\t\t\tarray.push(format);\r\n\t\t\t}\r\n\t\t}, this);\r\n\t}, this);\r\n\tarray.sort(function (f1, f2) {\r\n\t\treturn f2.priority - f1.priority;\r\n\t});\r\n\tthis.priorities = new List(array);\r\n\r\n\tvar list = new List([\r\n\t    new SelectorBindingSelection(\r\n\t    \tBlockSelectorBinding.LABEL_DEFAULT,\r\n\t    \tBlockSelectorBinding.VALUE_DEFAULT\r\n\t    )\r\n\t]);;\r\n\r\n\tthis.priorities.each(function (format) {\r\n\t\tvar name = format.select.label;\r\n\t\tvar value = format.id;\r\n\t\tvar notes = format.notes;\r\n\t\tlist.add(new SelectorBindingSelection(name, value, null, null, notes));\r\n\t\t\r\n\t\tthis._tinyInstance.formatter.register(value + '_special', {\r\n\t\t\tblock: format.props.block,\r\n\t\t\tclasses: format.props.classes,\r\n\t\t\twrapper: 0\r\n\t\t});\r\n\t}, this);\r\n\r\n\r\n\r\n\r\n\r\n\tthis.populateFromList(list);\r\n\r\n\tif (!this.priorities.hasEntries())\r\n\t\tthis.hide();\r\n};\r\n\r\n/**\r\n* Register as node change handler when TinyMCE is initialized.\r\n* @implements {IWysiwygEditorComponent}\r\n* @param {WysiwygEditorBinding} editor\r\n* @param {TinyMCE_Engine} engine\r\n* @param {TinyMCE_Control} instance\r\n* @param {TinyMCE_CompositeTheme} theme\r\n*/\r\nBlockSelectorBinding.prototype.initializeComponent = function(editor, engine, instance, theme) {\r\n\r\n\tBlockSelectorBinding.superclass.initializeComponent.call(\r\n\t\tthis,\r\n\t\teditor,\r\n\t\tengine,\r\n\t\tinstance,\r\n\t\ttheme\r\n\t);\r\n\r\n\tthis._tinyTheme.registerNodeChangeHandler(this);\r\n\tthis._tinyTheme.registerEnterKeyHandler(this);\r\n};\r\n\r\n/**\r\n* Implements {@link IActionHandler}\r\n* @overloads {SelectorBinding#handleAction}\r\n* @param {Action} action\r\n*/\r\nBlockSelectorBinding.prototype.handleAction = function (action) {\r\n\r\n\tBlockSelectorBinding.superclass.handleAction.call(this, action);\r\n\r\n\tswitch (action.type) {\r\n\t\tcase SelectorBinding.ACTION_SELECTIONCHANGED:\r\n\t\t\tif (Client.isAnyExplorer) {\r\n\t\t\t\tthis._editorBinding.deleteBookmark();\r\n\t\t\t}\r\n\r\n\t\t\tvar value = this.getValue();\r\n\t\t\tif (value != BlockSelectorBinding.VALUE_DEFAULT) {\r\n\t\t\t\tthis._tinyInstance.formatter.functionIsBlock = true;\r\n\t\t\t\tthis._tinyInstance.formatter.apply(value);\r\n\t\t\t\tthis._tinyInstance.formatter.functionIsBlock = false;\r\n\t\t\t}\r\n\r\n\t\t\tthis.selections.each(function (selection) {\r\n\t\t\t\tvar id = selection.value;\r\n\t\t\t\tif (id != null && id !=value) {\r\n\t\t\t\t\tif (this._tinyInstance.formatter.match(id + '_special')) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tthis._tinyInstance.formatter.remove(id + '_special');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, this);\r\n\r\n\t\t\tthis._tinyInstance.undoManager.add();\r\n\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n/**\r\n* Handle node change.\r\n* @implements {IWysiwygEditorNodeChangeHandler}\r\n* @param {DOMElement} element\r\n*/\r\nBlockSelectorBinding.prototype.handleNodeChange = function(element) {\r\n\tif (element != this._element) {\r\n\r\n\t\tthis._element = element;\r\n\r\n\t\tvar value = null;\r\n\t\twhile (value == null && element != null && element.nodeName.toLowerCase() != \"body\") {\r\n\t\t\tthis.priorities.each(function (format) {\r\n\t\t\t\tif (this._tinyInstance.formatter.matchNode(element, format.id)) {\r\n\t\t\t\t\tvalue = format.id;\r\n\t\t\t\t}\r\n\t\t\t\treturn value == null;\r\n\t\t\t}, this);\r\n\r\n\t\t\telement = element.parentNode;\r\n\t\t}\r\n\t\tif (value == null) {\r\n\t\t\tvalue = BlockSelectorBinding.VALUE_DEFAULT;\r\n\t\t}\r\n\t\tthis.selectByValue(value, true);\r\n\t}\r\n};\r\n\r\n/**\r\n* Handle Editor Enter Key\r\n*/\r\nBlockSelectorBinding.prototype.handleEnterKey = function (e) {\r\n\r\n\tvar editor = this._tinyInstance;\r\n\tvar dom = editor.dom;\r\n\tvar rng = editor.selection.getRng();\r\n\t\r\n\tif (rng.startContainer != null && rng.startContainer == rng.endContainer && rng.startOffset == 0 && rng.endOffset == 0) {\r\n\t\tvar node = rng.startContainer;\r\n\t\tif (dom.isBlock(node) && editor.dom.isEmpty(node) && (node.nextElementSibling === null || node.previousElementSibling === null)) {\r\n\t\t\tvar parent = rng.startContainer.parentNode;\r\n\t\t\tvar value;\r\n\t\t\tthis.priorities.each(function (format) {\r\n\t\t\t\tif (editor.formatter.matchNode(parent, format.id)) {\r\n\t\t\t\t\tvalue = format.id;\r\n\t\t\t\t}\r\n\t\t\t\treturn value == null;\r\n\t\t\t}, this);\r\n\r\n\t\t\tif (value) {\r\n\t\t\t\tvar p = dom.create(\"p\");\r\n\t\t\t\tif (!editor.isIE) {\r\n\t\t\t\t\tp.innerHTML = '<br data-mce-bogus=\"1\">';\r\n\t\t\t\t}\r\n\t\t\t\tif (node.previousElementSibling === null) {\r\n\t\t\t\t\tparent.parentNode.insertBefore(p, parent);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdom.insertAfter(p, parent);\r\n\t\t\t\t}\r\n\t\t\t\tdom.remove(node);\r\n\t\t\t\teditor.selection.setCursorLocation(p, 0);\r\n\t\t\t\teditor.undoManager.add();\r\n\t\t\t\te.preventDefault();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/ClassNameSelectorBinding.js",
    "content": "ClassNameSelectorBinding.prototype = new EditorSelectorBinding;\r\nClassNameSelectorBinding.prototype.constructor = ClassNameSelectorBinding;\r\nClassNameSelectorBinding.superclass = EditorSelectorBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ClassNameSelectorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ClassNameSelectorBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hack = false;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nClassNameSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ClassNameSelectorBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads {SelectorBinding#onBindingAttach}\r\n */\r\nClassNameSelectorBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tClassNameSelectorBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.addActionListener ( SelectorBinding.ACTION_SELECTIONCHANGED );\r\n\t\r\n\tvar groups = this._tinyTheme.formatGroups;\r\n\t\r\n\t// Compute priorities\r\n\tvar array = [];\r\n\tgroups.reverse ().each ( function ( group ) {\r\n\t\tgroup.each ( function ( format ) {\r\n\t\t\tif ( format.select != null && format.props.classes != null ) {\r\n\t\t\t\tif ( format.props.block == null && format.props.inline == null ) {\r\n\t\t\t\t\tarray.push ( format );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, this );\r\n\t}, this );\r\n\tarray.sort ( function ( f1, f2 ) {\r\n\t\treturn f2.priority - f1.priority;\r\n\t});\r\n\tthis.priorities = new List ( array );\r\n}\r\n\r\n/**\r\n * Register as node change handler when TinyMCE is initialized.\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {VisualEditorBinding} editor\r\n * @param {TinyMCE_Engine} engine\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_CompositeTheme} theme\r\n */\r\nClassNameSelectorBinding.prototype.initializeComponent = function ( editor, engine, instance, theme ) {\r\n\t\r\n\tClassNameSelectorBinding.superclass.initializeComponent.call ( \r\n\t\tthis,\r\n\t\teditor, \r\n\t\tengine, \r\n\t\tinstance,\r\n\t\ttheme \r\n\t);\r\n\t\r\n\tthis._tinyTheme.registerNodeChangeHandler ( this );\r\n}\r\n\r\n\r\n/**\r\n * Implements {@link IActionHandler}\r\n * @overloads {SelectorBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nClassNameSelectorBinding.prototype.handleAction = function (action) {\r\n\r\n    ClassNameSelectorBinding.superclass.handleAction.call(this, action);\r\n\r\n    switch (action.type) {\r\n        case SelectorBinding.ACTION_SELECTIONCHANGED:\r\n\r\n            var result = true;\r\n\r\n            if (Client.isExplorer) {\r\n                this._editorBinding.createBookmark();\r\n            }\r\n\r\n            this._isUpdating = true;\r\n            var value = this.getValue();\r\n            for (var i = this.selections.getLength() - 1; i >= 0; i--) {\r\n            \tselection = this.selections.get(i);\r\n            \tvar id = selection.value;\r\n            \tif (id != null) {\r\n            \t\tif (this._tinyInstance.formatter.match(id)) {\r\n            \t\t\tthis._tinyInstance.formatter.remove(id);\r\n            \t\t\tbreak;\r\n            \t\t}\r\n            \t}\r\n            }\r\n\r\n            if (value != null) {\r\n                \r\n                this._tinyInstance.formatter.apply(this.getValue());\r\n                this._tinyInstance.undoManager.add();\r\n            }\r\n\r\n            this._isUpdating = false;\r\n\r\n            if (Client.isExplorer) {\r\n                this._editorBinding.createBookmark();\r\n            }\r\n\r\n            break;\r\n    }\r\n}\r\n\r\n/**\r\n * Handle node change.\r\n * Implements {@link IWysiwygEditorNodeChangeHandler}\r\n * @param {DOMElement} element\r\n */\r\nClassNameSelectorBinding.prototype.handleNodeChange = function (element) {\r\n\r\n    if (!this._isUpdating) {\r\n        if (element != this._element || element.className != this._classname) {\r\n\r\n            this._element = element; \r\n            this._classname = element.className;\r\n\r\n            // TODO: Add support for images here?\r\n\r\n            var list = new List();\r\n            this.priorities.each(function (format) {\r\n\r\n                if (this.canApplyDirect(format.id, element)) {\r\n                    list.add(new SelectorBindingSelection(\r\n                        format.select.label,\r\n                        format.id,\r\n                        this._tinyInstance.formatter.match(format.id),\r\n                        null,\r\n                        format.notes\r\n                    ));\r\n                }\r\n            }, this);\r\n\r\n            if (list.hasEntries()) {\r\n                this.populateFromList(list);\r\n                this._hack = true;\r\n                this.enable();\r\n                this._false = true;\r\n\r\n            } else {\r\n                this.clear();\r\n                this.disable();\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n/**\r\n* Test is the named TinyMCE format can be applied directly to the current selection.\r\n* A specialization for the formatter.canApply(name) which also include parent elements\r\n* @param {string} formatName\r\n* @returns {boolean}\r\n*/\r\nClassNameSelectorBinding.prototype.canApplyDirect = function (formatName, element) {\r\n\r\n\tif (VisualEditorBinding.isReservedElement(element))\r\n\t\treturn false;\r\n\r\n\tvar formatList = this._tinyInstance.formatter.get(formatName), x, selector;\r\n\r\n\tfor (x = formatList.length - 1; x >= 0; x--) {\r\n\t\tselector = formatList[x].selector;\r\n\t\tif (!selector || this._tinyInstance.dom.is(element, selector)) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\n\r\n\r\n\r\n/**\r\n * Only enable the selector when WE decide to.\r\n * @param {boolean} isDisabled\r\n */\r\nClassNameSelectorBinding.prototype.setDisabled = function ( isDisabled ) {\r\n\t\r\n\tif ( isDisabled == true || this._hack == true ) {\r\n\t\tClassNameSelectorBinding.superclass.setDisabled.call ( this, isDisabled );\r\n\t\tif ( isDisabled ) {\r\n\t\t\tthis._element = null;\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/FormatSelectorBinding.js",
    "content": "FormatSelectorBinding.prototype = new EditorSelectorBinding;\r\nFormatSelectorBinding.prototype.constructor = FormatSelectorBinding;\r\nFormatSelectorBinding.superclass = EditorSelectorBinding.prototype;\r\n\r\nFormatSelectorBinding.LABEL_UNKNOWN = \"(Unknown)\";\r\nFormatSelectorBinding.VALUE_UNKNOWN = \"(Unknown)\";\r\nFormatSelectorBinding.LABEL_TEXT = \"(Text)\";\r\nFormatSelectorBinding.LABEL_LIST = \"(List)\";\r\n\r\n\r\n/*\r\n<p>\r\n<h1>, <h2>, <h3>, <h4>, <h5>, <h6>\r\n<ol>, <ul>\r\n<pre>\r\n<address>\r\n<blockquote>\r\n<dl>\r\n<div>\r\n<fieldset>\r\n<form>\r\n<hr>\r\n<noscript>\r\n<table>\r\n*/\r\n\r\n/**\r\n* Block format controller.\r\n* @implements {IWysiwygEditorComponent}\r\n*/\r\nfunction FormatSelectorBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"FormatSelectorBinding\");\r\n\r\n\t/**\r\n\t* @type {List<SelectorBindingSelection>}\r\n\t*/\r\n\tthis._list = null;\r\n\r\n\t/**\r\n\t* @type {List<Format>}\r\n\t*/\r\n\tthis.priorities = null;\r\n\r\n\t/**\r\n\t* @type {HTMLElement}\r\n\t*/\r\n\tthis._element = null;\r\n\r\n\t/**\r\n\t* @type {HashMap<string><Format>}\r\n\t*/\r\n\tthis._formats = new Map();\r\n\r\n    /**\r\n    * @type {MenuItemBinding}\r\n    */\r\n\tthis._unknownItemBinding = null;\r\n\r\n\t/*\r\n\t* Returnable.\r\n\t*/\r\n\treturn this;\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nFormatSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FormatSelectorBinding]\";\r\n}\r\n\r\n/**\r\n* Populate selector on build.\r\n* @overloads {EditorSelectorBinding#buildDOMContent}\r\n*/\r\nFormatSelectorBinding.prototype.buildDOMContent = function () {\r\n\r\n\tFormatSelectorBinding.superclass.buildDOMContent.call(this);\r\n\r\n\t/*\r\n\t* Mount and index configuration buttons.\r\n\t*/\r\n\tvar groups = this._tinyTheme.formatGroups;\r\n\tvar list = new List([\r\n\t    new SelectorBindingSelection(\r\n\t    \tFormatSelectorBinding.LABEL_UNKNOWN,\r\n\t    \tFormatSelectorBinding.VALUE_UNKNOWN\r\n\t    )\r\n\t]);\r\n\r\n\t// isolating BLOCK format instances\r\n\tgroups.each(function (group) {\r\n\t\tgroup.each(function (format) {\r\n\t\t\tif (format.props.block != null && format.select != null && format.props.classes == null && !format.props.wrapper) {\r\n\t\t\t\tthis._formats.set(format.id, format);\r\n\t\t\t\tvar name = format.select.label;\r\n\t\t\t\tvar value = format.id;\r\n\t\t\t\tvar notes = format.notes;\r\n\t\t\t\tlist.add(new SelectorBindingSelection(name, value, null, null, notes));\r\n\t\t\t}\r\n\t\t}, this);\r\n\t}, this);\r\n\r\n\t// Compute priorities\r\n\tvar array = [];\r\n\tgroups.each(function (group) {\r\n\t\tgroup.each(function (format) {\r\n\t\t\tif (format.select != null && format.props.block != null && format.props.classes == null && !format.props.wrapper) {\r\n\t\t\t\tarray.push(format);\r\n\t\t\t}\r\n\t\t}, this);\r\n\t}, this);\r\n\tarray.sort(function (f1, f2) {\r\n\t\treturn f2.priority - f1.priority;\r\n\t});\r\n\tthis.priorities = new List(array);\r\n\r\n\tthis.populateFromList(list);\r\n\r\n\tvar defaultitem = this._menuBodyBinding.getChildBindingByLocalName(\"menuitem\");\r\n\tdefaultitem.disable();\r\n\r\n\tthis.addActionListener(SelectorBinding.ACTION_SELECTIONCHANGED);\r\n\tthis._list = list;\r\n}\r\n\r\n/**\r\n* Register as node change handler when TinyMCE is initialized.\r\n* @implements {IWysiwygEditorComponent}\r\n* @param {WysiwygEditorBinding} editor\r\n* @param {TinyMCE_Engine} engine\r\n* @param {TinyMCE_Control} instance\r\n* @param {TinyMCE_CompositeTheme} theme\r\n*/\r\nFormatSelectorBinding.prototype.initializeComponent = function (editor, engine, instance, theme) {\r\n\r\n\tFormatSelectorBinding.superclass.initializeComponent.call(\r\n\t\tthis,\r\n\t\teditor,\r\n\t\tengine,\r\n\t\tinstance,\r\n\t\ttheme\r\n\t);\r\n\r\n\tthis._tinyTheme.registerNodeChangeHandler(this);\r\n}\r\n\r\n/**\r\n* Implements {@link IActionHandler}\r\n* @overloads {SelectorBinding#handleAction}\r\n* @param {Action} action\r\n*/\r\nFormatSelectorBinding.prototype.handleAction = function (action) {\r\n\r\n    FormatSelectorBinding.superclass.handleAction.call(this, action);\r\n\r\n    switch (action.type) {\r\n        case SelectorBinding.ACTION_SELECTIONCHANGED:\r\n            var value = this.getValue();\r\n            if (this._formats.has(value)) { // (exluding \"Unknown\" selection)\r\n                var format = this._formats.get(value);\r\n                this._tinyInstance.execCommand('FormatBlock', false, format.id);\r\n                action.consume();\r\n            }\r\n            break;\r\n    }\r\n}\r\n\r\n/**\r\n* Handle node change.\r\n* @implements {IWysiwygEditorNodeChangeHandler}\r\n* @param {DOMElement} element\r\n*/\r\nFormatSelectorBinding.prototype.handleNodeChange = function (element) {\r\n\r\n\tif (element != this._element) {\r\n\r\n\t    if (element != null && element.nodeName.toLowerCase() == \"br\") {\r\n\t        element = element.parentNode;\r\n\t    }\r\n\t    this._element = element;\r\n\r\n\t    var isList = false;\r\n\t    var isText = element.nodeName.toLowerCase() == \"body\";\r\n\r\n\t\tvar value = null;\r\n\t\twhile (value == null && element != null && element.nodeName.toLowerCase() != \"body\") {\r\n\t\t\tthis.priorities.each(function (format) {\r\n\t\t\t\tif (this._tinyInstance.formatter.matchNode(element, format.id)) {\r\n\t\t\t\t\tvalue = format.id;\r\n\t\t\t\t}\r\n\t\t\t\treturn value == null;\r\n\t\t\t}, this);\r\n\r\n\t\t\tif (element.nodeName.toLowerCase() == \"li\") { isList = true; }\r\n\t\t\tif (element.parentNode != null\r\n\t\t\t\t&& element.parentNode.nodeName.toLowerCase() == \"body\"\r\n                && element.nodeName.toLowerCase() == \"div\") {\r\n\t\t\t    isText = true;\r\n\t\t\t}\r\n\t\t\telement = element.parentNode;\r\n\t\t}\r\n\t\tif (value == null) {\r\n\t\t    value = FormatSelectorBinding.VALUE_UNKNOWN;\r\n\t\t}\r\n\t\t\r\n\t\tthis.selectByValue(value, true);\r\n\r\n\t\tif (isList) {\r\n\t\t    this.setUknownLabel(FormatSelectorBinding.LABEL_LIST);\r\n\t\t} else if (isText) {\r\n\t\t    this.setUknownLabel(FormatSelectorBinding.LABEL_TEXT);\r\n\t\t} else {\r\n\t\t    this.setUknownLabel(FormatSelectorBinding.LABEL_UNKNOWN);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label for FormatSelectorBinding.VALUE_UNKNOWN selection.\r\n * @param {object} value\r\n * @return {boolean} True if something (new) was selected\r\n */\r\nFormatSelectorBinding.prototype.setUknownLabel = function (label) {\r\n\r\n    var isSuccess = false;\r\n\r\n    if (this._unknownItemBinding == null) {\r\n        var bodyBinding = this._menuBodyBinding;\r\n        var itemElementList = bodyBinding.getDescendantElementsByLocalName(\"menuitem\");\r\n        while (itemElementList.hasNext()) {\r\n            var itemBinding = UserInterface.getBinding(\r\n                    itemElementList.getNext()\r\n            );\r\n            if (itemBinding.selectionValue == FormatSelectorBinding.VALUE_UNKNOWN) {\r\n                this._unknownItemBinding = itemBinding;\r\n                break;\r\n            }\r\n        }\r\n    }\r\n\r\n    if (this._unknownItemBinding != null) {\r\n        this._unknownItemBinding.setLabel(label)\r\n        if (this._unknownItemBinding == this._selectedItemBinding) {\r\n            this._selectionLabel = label;\r\n            this._buttonBinding.setLabel(label);\r\n        }\r\n        isSuccess = true;\r\n    }\r\n\r\n    return isSuccess;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/TemplateTreeBinding.js",
    "content": "TemplateTreeBinding.prototype = new TreeBinding;\r\nTemplateTreeBinding.prototype.constructor = TemplateTreeBinding;\r\nTemplateTreeBinding.superclass = TreeBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TemplateTreeBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TemplateTreeBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTemplateTreeBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[TemplateTreeBinding]\";\r\n}\r\n\r\n/**\r\n * Don't allow invalid markup to be stored in placeholders!\r\n * @overwrites {TreeBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nTemplateTreeBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\t// overwrite - not overload!\r\n\t\r\n\tvar isPropagate = true;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase TreeNodeBinding.ACTION_ONFOCUS :\r\n\t\t\tvar page = this.bindingWindow.bindingMap.editorpage;\r\n\t\t\tif ( page.isSourceMode ) {\r\n\t\t\t\tif ( !page.validate ()) {\r\n\t\t\t\t\tisPropagate = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\tif ( isPropagate ) {\r\n\t\tTemplateTreeBinding.superclass.handleAction.call ( this, action );\r\n\t}\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/VisualEditorBoxBinding.js",
    "content": "VisualEditorBoxBinding.prototype = new Binding;\r\nVisualEditorBoxBinding.prototype.constructor = VisualEditorBoxBinding;\r\nVisualEditorBoxBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction VisualEditorBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {VisualEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * Subtree binding attachment delayed until editor has loaded.\r\n\t * @overwrites {Binding#isLazy}\r\n\t */\r\n\tthis.isLazy = true;\r\n\r\n\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.lastHeight = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[VisualEditorBoxBinding]\";\r\n}\r\n\r\n\r\n/**\r\n * Register for initialization when TinyMCE is loaded.\r\n * @overloads {ToolBarBinding#onBindingAttach}\r\n */\r\nVisualEditorBoxBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tVisualEditorBoxBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\t/*\r\n\t * Rigup editor component.\r\n\t */\r\n\tvar tinywindow = this.bindingWindow.bindingMap.tinywindow;\r\n\tEditorBinding.registerComponent ( this, tinywindow );\r\n\t\r\n\t/*\r\n\t * Size the damn cover for IE.\r\n\t */\r\n\tif ( Client.isExplorer ) {\r\n\t\tvar cover = this.bindingWindow.bindingMap.toolbarscover;\r\n\t\tcover.setHeight ( this.boxObject.getDimension ().h );\r\n\t}\r\n}\r\n\r\n/**\r\n * Setup to initialize when TinyMCE is loaded and containng EditorBinding initializes.\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {WysiwygEditorBinding} editor\r\n * @param {TinyMCE_Engine} engine\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_CompositeTheme} theme\r\n */\r\nVisualEditorBoxBinding.prototype.initializeComponent = function ( editor, engine, instance, theme ) {\r\n\r\n\tthis._editorBinding = editor;\r\n\tthis._editorBinding.addActionListener ( VisualEditorBinding.ACTION_INITIALIZED, this );\r\n\r\n\ttheme.registerNodeChangeHandler(this);\r\n}\r\n\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nVisualEditorBoxBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tVisualEditorBoxBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\t/*\r\n\t * This binding is LAZY. We attach toolbar content \r\n\t * only when editor content has finished loading. \r\n\t * This will be percieved as a faster load. \r\n\t */\r\n\tswitch ( action.type ) {\r\n\t\tcase VisualEditorBinding.ACTION_INITIALIZED :\r\n\t\t\tif ( binding == this._editorBinding ) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tself._initialize ();\r\n\t\t\t\t}, 100 );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n* Handle node change.\r\n* @implements {IWysiwygEditorNodeChangeHandler}\r\n* @param {DOMElement} element\r\n*/\r\nVisualEditorBoxBinding.prototype.handleNodeChange = function (element) {\r\n\tvar self = this;\r\n\tsetTimeout(\r\n\t\tfunction () {\r\n\t\t\tvar height = self.bindingElement.offsetHeight;\r\n\t\t\tif (self.lastHeight != height) {\r\n\t\t\t\tself.lastHeight = height;\r\n\t\t\t\tself.bindingWindow.bindingMap.tinyflexbox.flex();\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}, 0);\r\n};\r\n\r\n/**\r\n * Initialize. By default, this simply attaches subtree bindings.\r\n */\r\nVisualEditorBoxBinding.prototype._initialize = function () {\r\n\t\r\n\tthis._editorBinding.removeActionListener ( VisualEditorBinding.ACTION_INITIALIZED, this );\r\n\tthis.attachRecursive ();\r\n\t//this.bindingWindow.bindingMap.toolbarscover.hide ();\r\n\tCoverBinding.fadeOut ( this.bindingWindow.bindingMap.toolbarscover );\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/VisualEditorInsertPlusFieldsToolBarButtonBinding.js",
    "content": "VisualEditorInsertPlusFieldsToolBarButtonBinding.prototype = new VisualEditorInsertToolBarButtonBinding;\r\nVisualEditorInsertPlusFieldsToolBarButtonBinding.prototype.constructor = VisualEditorInsertPlusFieldsToolBarButtonBinding;\r\nVisualEditorInsertPlusFieldsToolBarButtonBinding.superclass = VisualEditorInsertToolBarButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction VisualEditorInsertPlusFieldsToolBarButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorInsertPlusFieldsToolBarButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isFieldsConfigured = false;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorInsertPlusFieldsToolBarButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[VisualEditorInsertPlusFieldsToolBarButtonBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {VisualEditorInsertToolBarButtonBinding#onBindingAttach}\r\n */\r\nVisualEditorInsertPlusFieldsToolBarButtonBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tVisualEditorInsertPlusFieldsToolBarButtonBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND );\r\n}\r\n\r\n/**\r\n * Configure fields insertion.\r\n */\r\nVisualEditorInsertPlusFieldsToolBarButtonBinding.prototype._configureFields = function ( config ) {\r\n\t\r\n\tthis.popupBinding._indexMenuContent ();\r\n\tvar item = this.popupBinding.getMenuItemForCommand ( \"compositeInsertFieldParent\" );\r\n\tvar doc = this.bindingDocument;\r\n\t\r\n\tif ( item ) {\r\n\t\titem.dispose ();\r\n\t}\r\n\t\r\n\titem = MenuItemBinding.newInstance ( doc );\r\n\titem.setLabel( \"${string:Composite.Web.VisualEditor:ContextMenu.LabelField}\" );\r\n\titem.image = \"${icon:fields}\";\r\n\titem.imageDisabled = \"${icon:fields-disabled}\";\r\n\titem.setProperty ( \"cmd\", \"compositeInsertFieldParent\" );\r\n\t\t\t\r\n\tvar groupnames = config.getGroupNames ();\r\n\tif ( groupnames.hasEntries ()) {\r\n\t\r\n\t\tvar popup \t= MenuPopupBinding.newInstance ( doc );\r\n\t\tvar body \t= popup.add ( MenuBodyBinding.newInstance ( doc ));\r\n\t\tvar group \t= body.add ( MenuGroupBinding.newInstance ( doc ));\r\n\t\t\r\n\t\tgroupnames.each ( function ( groupname ) {\r\n\t\t\tvar fields = config.getFieldNames ( groupname );\r\n\t\t\tfields.each ( function ( fieldname ) {\r\n\t\t\t\tvar i = group.add ( MenuItemBinding.newInstance ( doc ));\r\n\t\t\t\ti.setLabel ( fieldname );\r\n\t\t\t\ti.setImage ( \"${icon:field}\" );\r\n\t\t\t\ti.setProperty ( \"cmd\", \"compositeInsertField\" );\r\n\t\t\t\ti.setProperty ( \"val\", groupname + \":\" + fieldname );\r\n\t\t\t\tgroup.add ( i );\r\n\t\t\t});\r\n\t\t});\r\n\t\titem.add ( popup );\r\n\t}\r\n\t\r\n\tthis.popupBinding._menuGroups [ \"insertions\" ].getFirst ().add ( item );\r\n\titem.attachRecursive ();\r\n\tthis.popupBinding._menuItems [ \"compositeInsertFieldParent\" ] = item;\r\n}\r\n\r\n/**\r\n * @overloads {VisualEditorInsertToolBarButtonBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n */\r\nVisualEditorInsertPlusFieldsToolBarButtonBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tVisualEditorInsertPlusFieldsToolBarButtonBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\tif ( !this._isFieldsConfigured ) {\r\n\t\t\t\tif ( binding == this ) {\r\n\t\t\t\t\tvar config = this._editorBinding.embedableFieldConfiguration;\r\n\t\t\t\t\tif ( config ) {\r\n\t\t\t\t\t\tthis._configureFields ( config );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis._isFieldsConfigured = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/VisualEditorInsertToolbarButtonBinding.js",
    "content": "VisualEditorInsertToolBarButtonBinding.prototype = new EditorToolBarButtonBinding;\r\nVisualEditorInsertToolBarButtonBinding.prototype.constructor = VisualEditorInsertToolBarButtonBinding;\r\nVisualEditorInsertToolBarButtonBinding.superclass = EditorToolBarButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction VisualEditorInsertToolBarButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorInsertToolBarButtonBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorInsertToolBarButtonBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[VisualEditorInsertToolBarButtonBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {ButtonBinding#onBindingAttach}\r\n */\r\nVisualEditorInsertToolBarButtonBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tVisualEditorInsertToolBarButtonBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.popupBinding.addActionListener ( MenuItemBinding.ACTION_COMMAND, this );\r\n}\r\n\r\n/**\r\n * Configure fields insertion.\r\n */\r\nVisualEditorInsertToolBarButtonBinding.prototype._configureFields = function ( config ) {\r\n\t\r\n\tthis.popupBinding._indexMenuContent ();\r\n\tvar item = this.popupBinding.getMenuItemForCommand ( \"compositeInsertFieldParent\" );\r\n\tvar doc = this.bindingDocument;\r\n\t\r\n\tif ( item ) {\r\n\t\titem.dispose ();\r\n\t}\r\n\t\r\n\titem = MenuItemBinding.newInstance ( doc );\r\n\titem.setLabel ( \"Field\" );\r\n\titem.image = \"${icon:fields}\";\r\n\titem.imageDisabled = \"${icon:fields-disabled}\";\r\n\titem.setProperty ( \"cmd\", \"compositeInsertFieldParent\" );\r\n\t\t\t\r\n\tvar groupnames = config.getGroupNames ();\r\n\tif ( groupnames.hasEntries ()) {\r\n\t\r\n\t\tvar popup \t= MenuPopupBinding.newInstance ( doc );\r\n\t\tvar body \t= popup.add ( MenuBodyBinding.newInstance ( doc ));\r\n\t\tvar group \t= body.add ( MenuGroupBinding.newInstance ( doc ));\r\n\t\t\r\n\t\tgroupnames.each ( function ( groupname ) {\r\n\t\t\tvar fields = config.getFieldNames ( groupname );\r\n\t\t\tfields.each ( function ( fieldname ) {\r\n\t\t\t\tvar i = group.add ( MenuItemBinding.newInstance ( doc ));\r\n\t\t\t\ti.setLabel ( fieldname );\r\n\t\t\t\ti.setImage ( \"${icon:field}\" );\r\n\t\t\t\ti.setProperty ( \"cmd\", \"compositeInsertField\" );\r\n\t\t\t\ti.setProperty ( \"val\", groupname + \":\" + fieldname );\r\n\t\t\t\tgroup.add ( i );\r\n\t\t\t});\r\n\t\t});\r\n\t\titem.add ( popup );\r\n\t}\r\n\t\r\n\tthis.popupBinding._menuGroups [ \"insertions\" ].getFirst ().add ( item );\r\n\titem.attachRecursive ();\r\n\tthis.popupBinding._menuItems [ \"compositeInsertFieldParent\" ] = item;\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nVisualEditorInsertToolBarButtonBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tVisualEditorInsertToolBarButtonBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\t\t\r\n\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\t\t\r\n\t\t\tvar cmd = binding.getProperty ( \"cmd\" );\r\n\t\t\tvar gui = binding.getProperty ( \"gui\" );\r\n\t\t\tvar val = binding.getProperty ( \"val\" );\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\tif ( this._editorBinding.hasBookmark ()) {\r\n\t\t\t\tthis._editorBinding.restoreBookmark ();\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\t\r\n\t\t\tthis._editorBinding.handleCommand ( cmd, gui ? gui : false, val );\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Temp!!!!!!!!!!!!!!!!!!!!!!!\r\n\t\t\t */\r\n\t\t\tvar handler = this._editorBinding.getEditorWindow ().standardEventHandler;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\thandler.enableNativeKeys ( true );\r\n\t\t\t}, 100 );\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/VisualEditorPageBinding.js",
    "content": "VisualEditorPageBinding.prototype = new PageBinding;\r\nVisualEditorPageBinding.prototype.constructor = VisualEditorPageBinding;\r\nVisualEditorPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction VisualEditorPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorPageBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {WysiwygEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {TinyMCE_Engine} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE instance.\r\n\t * @type {TinyMCE_Control}\r\n\t */\r\n\tthis._tinyInstance = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {TinyMCE_CompositeTheme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\t\r\n\t/**\r\n\t * Flipped when editor is targetted by the mouse or something.\r\n\t * TODO: implement something!\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isActive = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isSourceMode = false;\r\n\t\r\n\t/**\r\n\t * @type {SourceEditorBinding}\r\n\t */\r\n\tthis._sourceEditor = null;\r\n\t\r\n\t/**\r\n\t * TODO: this seems to have no effect!\r\n\t */\r\n\tthis._isFocusManager = false;\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis._dirtyInterval = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[VisualEditorPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBindingAttach}\r\n */\r\nVisualEditorPageBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tVisualEditorPageBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.addActionListener( CodeMirrorEditorBinding.ACTION_INITIALIZED );\r\n}\r\n\r\n/**\r\n * Register for initialization when TinyMCE is loaded.\r\n * @overloads {PageBinding#onPageInitialize}\r\n */\r\nVisualEditorPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tVisualEditorPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\tvar tinywindow = this.bindingWindow.bindingMap.tinywindow;\r\n\tEditorBinding.registerComponent ( this, tinywindow );\r\n}\r\n\r\n/**\r\n * Clear dirty interval on dispose.\r\n * @overloads {PageBinding#onBindingDispose}\r\n */\r\nVisualEditorPageBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tVisualEditorPageBinding.superclass.onBindingDispose.call ( this ); \r\n\t\r\n\tif ( this._dirtyInterval != null ) {\r\n\t\tclearInterval ( this._dirtyInterval );\r\n\t}\r\n\t\r\n\t/*\r\n\t * This is supposed to unleak memory.\r\n\t * http://wiki.moxiecode.com/index.php/TinyMCE:API/tinymce.Editor/destroy\r\n\t */\r\n\tif ( this._tinyInstance != null ) {\r\n\t\tthis._tinyInstance.destroy (true);\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {WysiwygEditorBinding} editor\r\n * @param {TinyMCE_Engine} engine\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_CompositeTheme} theme\r\n */\r\nVisualEditorPageBinding.prototype.initializeComponent = function ( editor, engine, instance, theme ) {\r\n\r\n\tthis._editorBinding = editor;\r\n\tthis._tinyEngine\t= engine;\r\n\tthis._tinyInstance \t= instance;\r\n\tthis._tinyTheme \t= theme;\r\n\t\r\n\t/*\r\n\t * Intercept undo-redo.\r\n\t */\r\n\tvar self = this;\r\n\tinstance.on('Undo',  function () {\r\n\t\tself.updateUndoBroadcasters ();\r\n\t\teditor.checkForDirty ();\r\n\t});\r\n\tinstance.on('Redo',  function () {\r\n\t\tself.updateUndoBroadcasters ();\r\n\t\teditor.checkForDirty ();\r\n\t});\r\n\t\r\n\t/*\r\n\t * Register content change handler to support undo-redo.\r\n\t */\r\n\ttheme.registerContentChangeHandler ({\r\n\t\thandleContentChange: function () {\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tself.updateUndoBroadcasters();\r\n\t\t\t}, 0);\r\n\t\t}\r\n\t});\r\n\t\r\n\t/*\r\n\t * Get ready to do the dirty thing when stuff is dragged around and images are resized. \r\n\t * Stuff like this cannot be evented in IE, so we must resort to a primitive timeout.\r\n\t */\r\n\tif ( Client.isMozilla ) {\r\n\t\tvar isWaiting = false;\r\n\t\tDOMEvents.addEventListener ( this._tinyInstance.getDoc (), \"DOMSubtreeModified\", {\r\n\t\t\thandleEvent : function () {\r\n\t\t\t\tif ( !isWaiting ) {\r\n\t\t\t\t\tisWaiting = true;\r\n\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\teditor.checkForDirty ();\r\n\t\t\t\t\t\tisWaiting = false;\r\n\t\t\t\t\t}, 100 );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t} else {\r\n\t\tthis._dirtyInterval = setInterval ( function () {\r\n\t\t\teditor.checkForDirty ();\r\n\t\t}, 1500 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Validate. Always validates true when in visual mode.\r\n * @return {boolean}\r\n */\r\nVisualEditorPageBinding.prototype.validate = function () {\r\n\t\r\n\tvar result = true;\r\n\t\r\n\t/*\r\n\t * Validate source code?\r\n\t */\r\n\tif ( this.isSourceMode == true ) {\r\n\t\tresult = this._sourceEditor.validate (); \r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {boolean} isShow\r\n */\r\nVisualEditorPageBinding.prototype.showEditor = function ( isShow ) {\r\n\t\r\n\t/**\r\n\t * Visual editor cover.\r\n\t */\r\n\tvar cover = bindingMap.tinycover;\r\n\tif ( cover != null ) {\r\n\t\tif ( isShow ) {\r\n\t\t\tcover.hide ();\r\n\t\t} else {\r\n\t\t\tcover.show ();\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Source editor cover.\r\n\t */\r\n\tvar editor = this._sourceEditor;\r\n\tif ( editor != null ) {\r\n\t\teditor.cover ( !isShow );\r\n\t}\r\n};\r\n\r\n/**\r\n * Switch to either wysiwyg or source code editing.\r\n * Invoked by the {@link WysigwygEditorToolBarBinding}\r\n * @see {VisualEditorPageBinding#_buildSwitchButton}\r\n */\r\nVisualEditorPageBinding.prototype.switchEditingMode = function () {\r\n\t\r\n\tvar self = this;\r\n\tApplication.lock ( self );\r\n\tsetTimeout ( function () {\r\n\t\tself._switchMode ();\r\n\t\tsetTimeout ( function () {\r\n\t\t\tApplication.unlock ( self );\r\n\t\t}, 0 );\r\n\t}, 0 );\r\n}\r\n\r\n/**\r\n * Switch editing mode.\r\n */\r\nVisualEditorPageBinding.prototype._switchMode = function () {\r\n\t\r\n\tvar decks = this.bindingWindow.bindingMap.decks;\r\n\tvar isSwitchAllowed = true;\r\n\t\r\n\t/*\r\n\t * Note double validation. First we check if the source editor \r\n\t * has valid code. Then we see if visual editor will accept it.\r\n\t * The source editor may not be loaded now, see below.\r\n\t */\r\n\tif ( this._sourceEditor != null ) {\r\n\t\tisSwitchAllowed = this._sourceEditor.validate ();\r\n\t\tif ( isSwitchAllowed == true ) {\r\n\t\t\tif ( !this._synchronizeSwitch ()) {\r\n\t\t\t\tisSwitchAllowed = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * This will attach and load the (lazy) sourceeditor on first invoke. \r\n\t */\r\n\tif ( isSwitchAllowed ) {\r\n\t\tvar currentID = decks.getSelectedDeckBinding ().getID ();\r\n\t\tdecks.select (\r\n\t\t\tcurrentID == \"sourcedeck\" ? \"designdeck\" : \"sourcedeck\"\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Switch to either wysiwyg or source code editing, transferring content from one \r\n * to the other. This may not always succeed, in which case the deck will not shift.\r\n * @param {boolean} isNotSwitching True if the editing mode is not supposed to switch.\r\n * @return {boolean} True for smooth switch.\r\n */\r\nVisualEditorPageBinding.prototype._synchronizeSwitch = function () {\r\n\t\r\n\tvar content = this.getContent ();\r\n\tthis.isSourceMode = !this.isSourceMode;\r\n\tvar isSuccess = this.setContent ( content );\r\n\tif ( !isSuccess ) {\r\n\t\tthis.isSourceMode = !this.isSourceMode;\r\n\t} else {\r\n\t\t\r\n\t\t/*\r\n\t\t * Hide \"flash-of-previous-code\"\r\n\t\t * when switching to source editor.\r\n\t\t */\r\n\t\tif ( this._sourceEditor != null ) {\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tself._sourceEditor.cover ( !self.isSourceMode );\r\n\t\t\t}, 200 )\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * Hacks ohoy! For some absurd reason, the toolbarbutton images are hidden \r\n\t * in Explorer after a switch to source editor. This seems to have been \r\n\t * introduced after adding the fading cover. Anyhow, this stunt will fix it. \r\n\t */\r\n\tif ( Client.isExplorer ) {\r\n\t\tif ( !this.isSourceMode ) {\r\n\t\t\tvar box = this.bindingWindow.bindingMap.toolbarsbox;\r\n\t\t\tbox.bindingElement.style.display = \"none\";\r\n\t\t\tbox.bindingElement.style.display = \"block\";\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn isSuccess;\r\n}\r\n\r\n/**\r\n * Get content. Some garbage markup is eliminated by XSLT, anticipating \r\n * the users intention to create an all empty page.\r\n * @return {string}\r\n */\r\nVisualEditorPageBinding.prototype.getContent = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.isSourceMode == true ) {\r\n\t\tresult = this._sourceEditor.getValue ();\r\n\t} else {\r\n\t\tvar html = this._tinyInstance.getContent({ format: 'raw' });\r\n\t\tvar WEBKITBAD = '\"=\"\">'; // what on earth? invalid innerHTML!\r\n\t\tif ( html.indexOf ( WEBKITBAD ) >-1 ) {\r\n\t\t\thtml = html.replace ( /\\\"=\\\"\\\">/g, \">\" );\r\n\t\t}\r\n\t\tresult = this._editorBinding.normalizeToDocument ( \r\n\t\t\tVisualEditorBinding.getStructuredContent ( html )\r\n\t\t);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set content. Note that content should *always* be provided as structured markup, not \r\n * Tiny markup. This method is invoked by the containing {@link VisualEditorBinding}\r\n * @param {string} content\r\n * @return {boolean} True if content can be mounted.\r\n */\r\nVisualEditorPageBinding.prototype.setContent = function ( content ) {\r\n\t\r\n\tvar isSuccess = true;\r\n\t\r\n\tif ( this.isSourceMode ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * While old pages (with no HEAD section) are updated, \r\n\t\t * notmalizeToDocument should be enabled here so that \r\n\t\t * switch between placeholders in source mode works.\r\n\t\t */\r\n\t    content = this._editorBinding.normalizeToDocument(  content );\r\n\t    if ( content == null || content == \"\" ) {\r\n\t    \t\r\n\t    \t// this may happen in WebKit...\r\n\t    \tcontent = \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\\t<head></head>\\n\\t<body></body>\\n</html>\";\r\n\t    }\r\n\t    content = decodeURIComponent( MarkupFormatService.AutoIndentDocument( encodeURIComponent( content )));\r\n\t\tthis._sourceEditor.setValue ( content );\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\t/*\r\n\t\t * Isolate the BODY section.\r\n\t\t */\r\n\t\tcontent = this._editorBinding.extractBody ( content );\r\n\t\t\r\n\t\t/*\r\n\t\t * Inject to TinyMCE.\r\n\t\t */\r\n\t\tcontent = VisualEditorBinding.getTinyContent ( content, this._editorBinding );\r\n\t\tif ( content != null ) {\r\n\t\t\tthis._tinyInstance.setContent(content, { format: 'raw' });\r\n\t\t\tthis._editorBinding.resetUndoRedo ();\r\n\t\t\tthis._editorBinding._checksum = this._editorBinding.getCheckSum (); // ARGH\r\n\t\t} else {\r\n\t\t\tisSuccess = false;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn isSuccess;\t\r\n};\r\n\r\n/**\r\n * @implements {IActionListner}\r\n * @overloads {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nVisualEditorPageBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tVisualEditorPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\r\n\t\tcase CodeMirrorEditorBinding.ACTION_INITIALIZED:\r\n\t\t\t\r\n\t\t\tthis._sourceEditor = binding;\r\n\t\t\tthis._buildSwitchButton ();\r\n\t\t\t\r\n\t\t\tvar cover = this.bindingWindow.bindingMap.sourcecover;\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Timeout saves the day.\r\n\t\t\t * TODO: handle illegal content?\r\n\t\t\t */\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tif ( self._synchronizeSwitch ()) {\r\n\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\tcover.hide ();\r\n\t\t\t\t\t}, 100 );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow \"Illegal content\";\r\n\t\t\t\t}\r\n\t\t\t}, Client.isExplorer == true ? 500 : 0 );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Injecting the switch-button on the sourceeditor toolbar.\r\n */\r\nVisualEditorPageBinding.prototype._buildSwitchButton = function () {\r\n\r\n\tvar win = this._sourceEditor.getContentWindow ();\r\n\tvar doc = this._sourceEditor.getContentDocument ();\r\n\t\r\n\tvar button = ToolBarButtonBinding.newInstance ( doc );\r\n\tbutton.isEditorControlBinding = false;\r\n\tbutton.setLabel ( StringBundle.getString ( \"Composite.Web.VisualEditor\", \"ToolBar.LabelWysiwyg\" ));\r\n\tbutton.flip ( true );\r\n\tbutton.imageProfile = new ImageProfile ({\r\n\t\timage : \"${icon:editor-designview}\",\r\n\t\timageDisabled : \"${icon:editor-designview-disabled}\" \r\n\t});\r\n\r\n\tvar self = this;\r\n\tbutton.oncommand = function () {\r\n\t\tself.switchEditingMode ();\r\n\t};\r\n\t\r\n\tvar toolbar = win.bindingMap.toolbar;\r\n\tif ( toolbar != null ) {\r\n\t\twin.bindingMap.toolbar.addRight ( button );\r\n\t\tbutton.attach ();\r\n\t\t\r\n\t\t/*\r\n\t\t// pending https://bugzilla.mozilla.org/show_bug.cgi?id=602484\r\n\t\tif ( !toolbar.isVisible ) {\r\n\t\t\ttoolbar.show ();\r\n\t\t\tthis.reflex ();\r\n\t\t}\r\n\t\t*/\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked by {@link VisualEditorBinding} and {@link VisualEditorSimpleToolBarBinding}\r\n */\r\nVisualEditorPageBinding.prototype.updateUndoBroadcasters = function () {\r\n\t\r\n\tvar manager = this._tinyInstance.undoManager;\r\n\tvar undo = this.bindingWindow.bindingMap.broadcasterCanUndo;\r\n\tvar redo = this.bindingWindow.bindingMap.broadcasterCanRedo;\r\n\t\r\n\tundo.setDisabled ( !manager.hasUndo ());\r\n\tredo.setDisabled ( !manager.hasRedo ());\r\n}\r\n\r\n/**\r\n * Clean the source editor.\r\n * Invoked by {@link VisualEditorBinding} on clean.\r\n */\r\nVisualEditorPageBinding.prototype.clean = function () {\r\n\t\r\n\tif ( this._sourceEditor != null ) {\r\n\t\tthis._sourceEditor.clean ();\r\n\t}\r\n}\r\n\r\n/**\r\n * This setup implies that a switch to source and back again may actually \r\n * corrupt the checksum system IF the user copied stuff from either mode \r\n * without modifying content. Just so that you know...\r\n * @param {string} checksum \r\n * @return {string}\r\n */\r\nVisualEditorPageBinding.prototype.getCheckSum = function (checksum) {\r\n\r\n\tif (this.isSourceMode) {\r\n\r\n\t\t/*\r\n\t\t* If the source editor is dirty, we must return something \r\n\t\t* not equal to the current visual editor checksum.\r\n\t\t*/\r\n\t\tif (this._sourceEditor.isDirty) {\r\n\t\t\treturn new String(Math.random());\r\n\t\t} else {\r\n\t\t\treturn checksum;\r\n\t\t}\r\n\t} else {\r\n\t\t// IE innerHTML - returns wrong quotes (' instead \") in attribute data-markup\r\n\t\tif (Client.isAnyExplorer) {\r\n\t\t\tchecksum = this._tinyInstance.getContent();\r\n\t\t} else {\r\n\t\t\tchecksum = this._tinyInstance.getDoc().body.innerHTML;\r\n\t\t}\r\n\r\n\t\t//delete mceC1Focused from checksum to prevent unexpected dirty\r\n\t\tchecksum = checksum.replace(/\\s*mceC1Focused\\s*/g, \"\");\r\n\r\n\t\tchecksum = checksum.replace(/<img[^<]*data-markup=\"([^\"]*)\"[^<]*>/g, \"$1\");\r\n\t\tchecksum = checksum.replace(/\\sdata-mce-selected=\"[^\"]*\"/g, \"\");\r\n\t\t\r\n\r\n\t\treturn checksum;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/VisualEditorPropertiesToolBarGroupBinding.js",
    "content": "VisualEditorPropertiesToolBarGroupBinding.prototype = new ToolBarGroupBinding;\r\nVisualEditorPropertiesToolBarGroupBinding.prototype.constructor = VisualEditorPropertiesToolBarGroupBinding;\r\nVisualEditorPropertiesToolBarGroupBinding.superclass = ToolBarGroupBinding.prototype;\r\n\r\n/**\r\n * Classname reserved for focused element.\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.CLASSNAME_FOCUSED = \"mceC1Focused\";\r\n\r\n/**\r\n * @class\r\n * @implements {IWysiwygEditorComponent}\r\n */\r\nfunction VisualEditorPropertiesToolBarGroupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorPropertiesToolBarGroupBinding\" );\r\n\t\r\n\t\t/**\r\n\t * The containing editor.\r\n\t * @type {VisualEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {tinymce.Engine} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE instance.\r\n\t * @type {tinymce.EngineManager}\r\n\t */\r\n\tthis._tinyInstance = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {tinymce.Theme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\t\r\n\t/**\r\n\t * @type {HTMLElement}\r\n\t */\r\n\tthis._tinyElement = null;\r\n\t\r\n\t/**\r\n\t * @type {Map<string><WysiwygEditorToolBarButtonBinding}\r\n\t */\r\n\tthis._buttons = new Map ();\r\n\t\r\n\t/**\r\n\t * Tracking the focused image.\r\n\t * @type {HTMLImageElement}\r\n\t */\r\n\tthis._focusedImage = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[VisualEditorPropertiesToolBarGroupBinding]\";\r\n}\r\n\r\n/**\r\n * Although the \"hidden\" property is set in markup, Mozilla insists on \r\n * displaying contents in a short flash. We hide the entire setup for starters.\r\n * @overloads {RadioGroupBinding#onBindingRegister}\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tVisualEditorPropertiesToolBarGroupBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tif ( Client.isMozilla ) {\r\n\t\tthis.bindingElement.style.visibility = \"hidden\";\r\n\t}\r\n}\r\n\r\n/**\r\n * Register as editor component.\r\n * @overloads {ToolBarGroupBinding#onBindingAttach}\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.prototype.onBindingAttach = function () {\r\n\r\n\tVisualEditorPropertiesToolBarGroupBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this._setSpecialVisibility;\r\n\tvar tinywindow = this.bindingWindow.bindingMap.tinywindow;\r\n\tEditorBinding.registerComponent ( this, tinywindow );\r\n}\r\n\r\n/**\r\n * Register buttons.\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.prototype.onBindingInitialize = function () {\r\n\t\r\n\tVisualEditorPropertiesToolBarGroupBinding.superclass.onBindingInitialize.call ( this );\r\n\t\r\n\tvar buttons = this._buttons;\r\n\tthis.getDescendantBindingsByLocalName ( \"toolbarbutton\" ).each ( function ( button ) {\r\n\t\tbuttons.set ( button.cmd, button );\r\n\t});\r\n\t\r\n}\r\n\r\n/**\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {VisualEditorBinding} editor\r\n * @param {tinymce.Engine} engine\r\n * @param {tinymce.EngineManager} instance\r\n * @param {tinymce.Theme} theme\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.prototype.initializeComponent = function ( editor, engine, instance, theme ) {\r\n\r\n\tthis._editorBinding = editor;\r\n\tthis._tinyEngine\t= engine;\r\n\tthis._tinyInstance \t= instance;\r\n\tthis._tinyTheme \t= theme;\r\n\t\r\n\t/* \r\n\t * Register as node change handler.\r\n\t */\r\n\tthis._tinyTheme.registerNodeChangeHandler ( this );\r\n\t\r\n\t/*\r\n\t * Mozilla bug. Hidden by method onBindingRegister.\r\n\t */\r\n\tif ( Client.isMozilla == true ) {\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tself.bindingElement.style.visibility = \"visible\";\r\n\t\t}, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Note to self: When editor has selection, explorer and mozilla behave differently. \r\n * Mozilla will show eg. the function properties button while explorer will not (bug 653).\r\n * This should probably be synchronized - what should happen when two functions are selected?\r\n * @implements {IWysiwygEditorNodeChangeHandler}\r\n * @param {DOMElement} element\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.prototype.handleNodeChange = function (element) {\r\n\r\n\tthis._tinyElement = element;\r\n\tvar classname = VisualEditorPropertiesToolBarGroupBinding.CLASSNAME_FOCUSED;\r\n\r\n\tif (VisualEditorBinding.isImage(this._tinyElement)) {\r\n\r\n\t\tif (this._focusedImage != null) {\r\n\t\t\tthis._tinyInstance.dom.removeClass(this._focusedImage, classname);\r\n\t\t}\r\n\t\tthis._tinyInstance.dom.addClass(element, classname);\r\n\t\tthis._focusedImage = element;\r\n\r\n\t\tvar command = null;\r\n\t\tif (VisualEditorBinding.isFunctionElement(this._tinyElement)) {\r\n\t\t\tcommand = \"compositeInsertRendering\";\r\n\t\t} else if (VisualEditorBinding.isImageElement(this._tinyElement)) {\r\n\t\t\tcommand = \"compositeInsertImage\";\r\n\t\t}\r\n\r\n\t\tthis._buttons.each(function (cmd, button) {\r\n\t\t\tif (cmd == command) {\r\n\t\t\t\tbutton.show();\r\n\t\t\t} else {\r\n\t\t\t\tbutton.hide();\r\n\t\t\t}\r\n\t\t});\r\n\t\tif (!this.isVisible) {\r\n\t\t\tthis.show();\r\n\t\t}\r\n\t} else {\r\n\r\n\t\tif (this._focusedImage != null) {\r\n\t\t\tthis._tinyInstance.dom.removeClass(this._focusedImage, classname);\r\n\t\t\tthis._focusedImage = null;\r\n\t\t}\r\n\t\tif (this.isVisible) {\r\n\t\t\tthis.hide();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {RadioGroupBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tVisualEditorPropertiesToolBarGroupBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * For your information, this listener was\r\n\t\t * added by the RadioGroupBinding superclass.\r\n\t\t */\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\tvar button = action.target;\r\n\t\t\tthis._editorBinding.handleCommand ( \r\n\t\t\t\tbutton.cmd, \r\n\t\t\t\tbutton.gui, \r\n\t\t\t\tbutton.val\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide all buttons when editor looses focus.\r\n * @param {boolean} isDisabled\r\n */\r\nVisualEditorPropertiesToolBarGroupBinding.prototype._setSpecialVisibility = function ( isDisabled ) {\r\n\t\r\n\tif ( isDisabled ) {\r\n\t\tif ( this.isVisible == true ) {\r\n\t\t\tthis.hide ();\r\n\t\t\tthis._buttons.each ( function ( cmd, button ) {\r\n\t\t\t\tif ( button.isVisible ) {\r\n\t\t\t\t\tbutton.hide ();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/VisualEditorSimpleToolBarBinding.js",
    "content": "VisualEditorSimpleToolBarBinding.prototype = new VisualEditorToolBarBinding;\r\nVisualEditorSimpleToolBarBinding.prototype.constructor = VisualEditorSimpleToolBarBinding;\r\nVisualEditorSimpleToolBarBinding.superclass = VisualEditorToolBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction VisualEditorSimpleToolBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorSimpleToolBarBinding\" );\r\n\r\n\t/**\r\n\t * Indexing toolbarbuttons by value of the cmd attribute.\r\n\t * @type {Map<string><EditorToolBarButtonBinding>}\r\n\t */\r\n\tthis._buttons = null;\r\n\r\n\t/**\r\n\t * Supress nodechange instructions while toolbar is handled.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isToolBarUpdate = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isAlignmentDisabled = false;\r\n\r\n\t/**\r\n\t * @type {HTMLElement}\r\n\t *\r\n\tthis._element = null;\r\n\r\n\t/**\r\n\t * @type {String}\r\n\t *\r\n\tthis._classname = null;\r\n\t*/\r\n\r\n\t/**\r\n\t * @type {List<ToolBarButtonBinding>}\r\n\t */\r\n\tthis.priorities = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype.toString = function () {\r\n\r\n\treturn \"[VisualEditorSimpleToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * Hookup broadcaster integration.\r\n * @overloads {ToolBarBinding#onBindingRegister}\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype.onBindingRegister = function () {\r\n\r\n\tVisualEditorSimpleToolBarBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this.setDisabled;\r\n\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND );\r\n\tthis.addActionListener ( RadioGroupBinding.ACTION_SELECTIONCHANGED );\r\n}\r\n\r\n/**\r\n * @overloads {ToolBarBinding#onBindingAttach}\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype.onBindingAttach = function () {\r\n\r\n\t/*\r\n\t * Fetch buttons from server.\r\n\t */\r\n\tVisualEditorSimpleToolBarBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\t/*\r\n\t * toolbar buttons index.\r\n\t */\r\n\tthis._buttons = new Map ();\r\n\r\n\t/*\r\n\t * Index existing buttons.\r\n\t */\r\n\tvar buttons = this.getDescendantBindingsByLocalName ( \"toolbarbutton\" );\r\n\twhile ( buttons.hasNext ()) {\r\n\t\tvar button = buttons.getNext ();\r\n\t\tvar cmd = button.getProperty ( \"cmd\" );\r\n\t\tif ( cmd != null ) {\r\n\t\t\tthis._buttons.set (\r\n\t\t\t\tcmd,\r\n\t\t\t\tbutton\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Mount and index configuration buttons.\r\n\t */\r\n\tvar groups = this._tinyTheme.formatGroups;\r\n\tgroups.reverse ().each ( function ( group ) {\r\n\t\tvar groupBinding = ToolBarGroupBinding.newInstance ( this.bindingDocument );\r\n\t\tgroup.each ( function ( format ) {\r\n\t\t\tif ( format.button != null ) {\r\n\t\t\t\tvar button = this._getButton ( format )\r\n\t\t\t\tgroupBinding.add ( button );\r\n\t\t\t\tif ( this._buttons.has ( format.id )) {\r\n\t\t\t\t\tthrow \"Duplicate format ID: \" + format.id;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._buttons.set (\r\n\t\t\t\t\t\tformat.id,\r\n\t\t\t\t\t\tbutton\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, this );\r\n\t\tthis.addFirst ( groupBinding );\r\n\t\tgroupBinding.attachRecursive ();\r\n\t}, this );\r\n\r\n\t/*\r\n\t * Compute priorities\r\n\t */\r\n\tvar array = [];\r\n\tthis._buttons.each ( function ( key, button ) {\r\n\t\tif ( button.format != null ) {\r\n\t\t\tarray.push ( button );\r\n\t\t}\r\n\t});\r\n\tarray.sort ( function ( b1, b2 ) {\r\n\t\tvar p1 = b1.format.priority;\r\n\t\tvar p2 = b2.format.priority;\r\n\t\treturn p2 - p1;\r\n\t});\r\n\tthis.priorities = new List ( array );\r\n\r\n\t/*\r\n\t * Hookup on theme transmission.\r\n\t */\r\n\tthis._tinyTheme.registerNodeChangeHandler ( this );\r\n\r\n\t/*\r\n\t * Hookup on TinyMCE internal events.\r\n\t */\r\n\tDOMEvents.addEventListener ( this._tinyInstance.getDoc (), DOMEvents.MOUSEUP, this );\r\n\tDOMEvents.addEventListener ( this._tinyInstance.getDoc (), DOMEvents.KEYUP, this );\r\n}\r\n\r\n/**\r\n * Build button.\r\n * @param {Format} format\r\n * @returns {EditorToolBarButtonBinding}\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype._getButton = function ( format ) {\r\n\r\n\tvar button = EditorToolBarButtonBinding.newInstance ( this.bindingDocument );\r\n\r\n\tvar cmd = format.id;\r\n\tvar label = format.button.label;\r\n\tvar image = format.button.image;\r\n\tvar notes = format.button.notes;\r\n\r\n\tif ( label != null && label != \"\" ) {\r\n\t\tbutton.setLabel ( label );\r\n\t}\r\n\tif ( image != null && image != \"\" ) {\r\n\t\tbutton.setImage ( Constants.CONFIGROOT + image );\r\n\t}\r\n\tif ( notes != null && notes != \"\" ) {\r\n\t\tbutton.setToolTip ( notes );\r\n\t}\r\n\r\n\tbutton.disable ();\r\n\tbutton.setProperty ( \"cmd\", cmd );\r\n\tbutton.setType ( ButtonBinding.TYPE_CHECKBUTTON );\r\n\tbutton.format = format;\r\n\r\n\treturn button;\r\n}\r\n\r\n/**\r\n * Handle node change.\r\n * @implements {IWysiwygEditorNodeChangeHandler}\r\n * @param {DOMElement} element\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype.handleNodeChange = function ( element ) {\r\n\r\n\tif ( !this._isToolBarUpdate ) {\r\n\r\n\t\tvar hasSelection = this._editorBinding.hasSelection();\r\n\t\t//Buttons should be always enabled for ipad, becouse iPad does not always handle selection changes.\r\n\t\tif (Client.isPad) {\r\n\t\t\thasSelection = true;\r\n\t\t}\r\n\t\t// uncheck buttons and disable some buttons\r\n\t\tthis._buttons.each ( function ( key, button ) {\r\n\t\t\tif ( button.isChecked ) {\r\n\t\t\t\tbutton.uncheck ( true );\r\n\t\t\t}\r\n\t\t\tvar format = button.format;\r\n\t\t\tif ( format != null ) {\r\n\t\t\t\tif ( format.props.inline != null ) {\r\n\t\t\t\t\tbutton.setDisabled ( !hasSelection );\r\n\t\t\t\t} else if ( format.props.block != null ) {\r\n\t\t\t\t\tbutton.setDisabled ( hasSelection );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbutton.enable ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, this )\r\n\r\n\t\tvar tiny = this._tinyInstance;\r\n\r\n\t\t//skip rendering functions objects\r\n\t\tif (VisualEditorBinding.isReservedElement(element)) {\r\n\t\t\tthis._buttons.each(function (key, button) {\r\n\t\t\t\tvar format = button.format;\r\n\t\t\t\tif (format != null) {\r\n\t\t\t\t\tif (!button.isDisabled) {\r\n\t\t\t\t\t\tbutton.disable();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\t\telse\r\n\t\t\t// disable more buttons\r\n\t\t\tthis._buttons.each ( function ( key, button ) {\r\n\t\t\t\tif ( !button.isDisabled ) {\r\n\t\t\t\t\tvar format = button.format;\r\n\t\t\t\t\tif ( format != null ) {\r\n\t\t\t\t\t\tif ( tiny.formatter.canApply ( format.id )) {\r\n\t\t\t\t\t\t\tbutton.enable ();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tbutton.disable ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t})\r\n\r\n\t\t// check buttons\r\n\t\tthis.priorities.each ( function ( button ) {\r\n\t\t\tvar result = true;\r\n\t\t\tif ( !button.isDisabled ) {\r\n\t\t\t\tif ( tiny.queryCommandState ( button.cmd )) {\r\n\t\t\t\t\tbutton.check ( true );\r\n\t\t\t\t\tresult = false;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbutton.uncheck ( true );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}, this );\r\n\r\n\r\n\t\tif (this._buttons.has(\"InsertUnorderedList\"))  {\r\n\t\t\t// hack this button\r\n\t\t\t// TODO: less hacking\r\n\t\t\tvar b1 = this._buttons.get ( \"InsertUnorderedList\" );\r\n\t\t\tif ( tiny.queryCommandState ( b1.cmd )) {\r\n\t\t\t\tb1.check ( true );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (this._buttons.has(\"InsertUnorderedList\")) {\r\n\t\t\t// hack this button\r\n\t\t\t// TODO: less hacking\r\n\t\t\tvar b2 = this._buttons.get(\"InsertOrderedList\");\r\n\t\t\tif (tiny.queryCommandState(b2.cmd)) {\r\n\t\t\t\tb2.check(true);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tif (this._buttons.has(\"Indent\") && this._buttons.has(\"Outdent\")) {\r\n\t\t\tvar indentButton = this._buttons.get(\"Indent\");\r\n\t\t\tvar outdentButton = this._buttons.get(\"Outdent\");\r\n\t\t\tvar isEnableIndent = false;\r\n\t\t\tvar isEnableOutdent = false;\r\n\t\t\tvar node = element;\r\n\t\t\tdo {\r\n\t\t\t\tif (node.nodeType == Node.ELEMENT_NODE) {\r\n\t\t\t\t\tif (node.nodeName.toLowerCase() == \"ul\" || node.nodeName.toLowerCase() == \"ol\") {\r\n\t\t\t\t\t\tisEnableIndent = true;\r\n\t\t\t\t\t\tisEnableOutdent = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} while ((node = node.parentNode) != null);\r\n\r\n\t\t\tindentButton.setDisabled(!isEnableIndent);\r\n\t\t\toutdentButton.setDisabled(!isEnableOutdent);\r\n\t\t}\r\n\r\n\t\tif (this._buttons.has(\"compositeInsertLink\")) {\r\n\r\n\t\t\tvar linkButton = this._buttons.get(\"compositeInsertLink\");\r\n\t\t\tvar unLinkButton = this._buttons.get(\"unlink\");\r\n\t\t\tvar isEnableLink = hasSelection;\r\n\r\n\t\t\tvar isEnableUnlink = false;\r\n\r\n\t\t\tvar node = element;\r\n\t\t\tdo {\r\n\t\t\t\tif (node.nodeType == Node.ELEMENT_NODE) {\r\n\t\t\t\t\tif (node.nodeName.toLowerCase() == \"a\") {\r\n\t\t\t\t\t\tisEnableLink = true;\r\n\t\t\t\t\t\tisEnableUnlink = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} while ((node = node.parentNode) != null);\r\n\r\n\t\t\tlinkButton.setDisabled(!isEnableLink);\r\n\t\t\tunLinkButton.setDisabled(!isEnableUnlink);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * This handles all button commands.\r\n * @overloads {WysiwygEditorToolBarBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tVisualEditorSimpleToolBarBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar button = null;\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\tbutton = binding;\r\n\t\t\tbreak;\r\n\t\tcase RadioGroupBinding.ACTION_SELECTIONCHANGED :\r\n\t\t\tbutton = binding.getCheckedButtonBinding ();\r\n\t\t\tbreak;\r\n\t}\r\n\tif ( button ) {\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tself._handleButton ( button );\r\n\t\t}, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle button.\r\n * @param {EditorToolBarButton} button\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype._handleButton = function ( button ) {\r\n\r\n\tif ( button.cmd != null ) {\r\n\r\n\t\tvar isRelay = true;\r\n\t\tvar isUndoRedo = false;\r\n\r\n\t\tswitch ( button.cmd ) {\r\n\r\n\t\t\tcase \"compositeswitchmode\" :\r\n\t\t\t\tthis.bindingWindow.bindingMap.editorpage.switchEditingMode ();\r\n\t\t\t\tisRelay = false;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"Undo\" :\r\n\t\t\t\tthis._tinyInstance.undoManager.undo ();\r\n\t\t\t\tthis._editorBinding.checkForDirty ();\r\n\t\t\t\tisUndoRedo = true;\r\n\t\t\t\tisRelay = false;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"Redo\" :\r\n\t\t\t\tthis._tinyInstance.undoManager.redo ();\r\n\t\t\t\tthis._editorBinding.checkForDirty ();\r\n\t\t\t\tisUndoRedo = true;\r\n\t\t\t\tisRelay = false;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"unlink\" :\r\n\t\t\t\tthis._buttons.get ( \"compositeInsertLink\" ).disable ();\r\n\t\t\t\tthis._buttons.get ( \"unlink\" ).disable ();\r\n\t\t\t\tthis._editorBinding.checkForDirty ();\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"compositeCleanup\" :\r\n\t\t\t\tthis._cleanup ();\r\n\t\t\t\tthis._editorBinding.checkForDirty ();\r\n\t\t\t\tisRealy = false;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tif ( isUndoRedo ) {\r\n\t\t\tthis._editorBinding.blurEditor ();\r\n\t\t}\r\n\r\n\t\tif ( isRelay ) {\r\n\r\n\t\t\t/*\r\n\t\t\t * Relay command execution to TinyMCE. Note that\r\n\t\t\t * we disable nodechange awareness for the duration\r\n\t\t\t * of this operation (leads to weird toolbar behavior).\r\n\t\t\t */\r\n\t\t\tthis._isToolBarUpdate = true;\r\n\r\n\t\t\t/*\r\n\t\t\t * Not the most elegant way to handle this...\r\n\t\t\t */\r\n\t\t\tif ( button.format != null ) {\r\n\t\t\t\tif ( button.isChecked ) {\r\n\t\t\t\t\tif ( button.format != null && button.format.isRadio ) {\r\n\t\t\t\t\t\tvar group = UserInterface.getBinding ( button.bindingElement.parentNode );\r\n\t\t\t\t\t\tvar buttons = group.getDescendantBindingsByLocalName ( \"toolbarbutton\" );\r\n\t\t\t\t\t\tbuttons.each ( function ( b ) {\r\n\t\t\t\t\t\t\tif ( b != button ) {\r\n\t\t\t\t\t\t\t\tthis._tinyInstance.formatter.remove ( b.cmd );\r\n\t\t\t\t\t\t\t\tb.uncheck ( true );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, this );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis._tinyInstance.formatter.apply ( button.cmd );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._tinyInstance.formatter.remove ( button.cmd );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis._editorBinding.handleCommand (\r\n\t\t\t\t\tbutton.cmd, button.val, button.gui\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\t//self._editorBinding.restoreEditorFocus();\r\n\t\t\t\tself._isToolBarUpdate = false;\r\n\t\t\t}, 0 );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Disabling alignement functions when eg. a function or field is selected.\r\n * @param {boolean} isDisable\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype._disableAlignment = function ( isDisable ) {\r\n\r\n\tif ( isDisable != this._isAlignmentDisabled ) {\r\n\t\tvar buttons = this._buttons;\r\n\t\tnew List ([ \"JustifyLeft\", \"JustifyRight\", \"JustifyCenter\", \"JustifyFull\" ]).each (\r\n\t\t\tfunction ( cmd ) {\r\n\t\t\t\tvar button = buttons.get ( cmd );\r\n\t\t\t\tif ( button.isDisabled != isDisable ) {\r\n\t\t\t\t\tbutton.setDisabled ( isDisable );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t\tthis._isAlignmentDisabled = isDisable;\r\n\t}\r\n}\r\n\r\n/**\r\n * Exposing buttons so that outside fellows can control the toolbar.\r\n * @param {string} cmd\r\n * @return {EditorToolBarButtonBinding}\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype.getButtonForCommand = function ( cmd ) {\r\n\r\n\treturn this._buttons.get ( cmd );\r\n}\r\n\r\n/**\r\n * Disable buttons when editor is unactivated.\r\n * TODO: To allow completely custom buttons, maybe move this to button itself?\r\n * @param {boolean} isDisabled\r\n */\r\nVisualEditorSimpleToolBarBinding.prototype.setDisabled = function ( isDisabled ) {\r\n\r\n\t/*\r\n\t * Timeout should allow another view to focus\r\n\t * any databinding before we update buttons.\r\n\t */\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tself._buttons.each ( function ( key, button ) {\r\n\t\t\tswitch ( button.cmd ) {\r\n\t\t\t\tcase \"Undo\" :\r\n\t\t\t\tcase \"Redo\" :\r\n\t\t\t\tcase \"compositeswitchmode\" :\r\n\t\t\t\t\t// these should always be enabled...\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"compositeInsertLink\" :\r\n\t\t\t\tcase \"unlink\" :\r\n\t\t\t\t\tif ( isDisabled ) {\r\n\t\t\t\t\t\tbutton.disable ();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"InsertUnorderedList\" :\r\n\t\t\t\tcase \"InsertOrderedList\" :\r\n\t\t\t\t\tbutton.setDisabled ( isDisabled );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tif ( isDisabled ) {\r\n\t\t\t\t\t\tif ( button.format != null ) {\r\n\t\t\t\t\t\t\tif ( button.isChecked ) {\r\n\t\t\t\t\t\t\t\tbutton.uncheck ( true );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbutton.disable ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// button.setDisabled ( isDisabled );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t});\r\n\t}, 10 );\r\n\r\n\t// this._element = null;\r\n}\r\n\r\nVisualEditorSimpleToolBarBinding.prototype._cleanup = function () {\r\n\r\n\t//alert ( this + \": TODO!\" );\r\n\r\n\tvar markup = this._editorBinding.getValue ();\r\n\t// alert ( this + \":\\n\\n\" + markup );\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/VisualEditorStatusBarBinding.js",
    "content": "VisualEditorStatusBarBinding.prototype = new ToolBarBinding;\r\nVisualEditorStatusBarBinding.prototype.constructor = VisualEditorStatusBarBinding;\r\nVisualEditorStatusBarBinding.superclass = ToolBarBinding.prototype;\r\n\r\nVisualEditorStatusBarBinding.NAME_RENDERING \t= \"[function]\";\r\nVisualEditorStatusBarBinding.NAME_FIELD \t\t= \"[field]\";\r\nVisualEditorStatusBarBinding.NAME_HTML\t\t\t= \"[html]\";\r\n\r\n// TODO: THESE ARE NOT USED NO MORE!\r\nVisualEditorStatusBarBinding.NAME_FLASH \t\t= \"[flash]\";\r\nVisualEditorStatusBarBinding.NAME_QUICKTIME \t= \"[quicktime]\";\r\nVisualEditorStatusBarBinding.NAME_SHOCKWAVE \t= \"[shockwave]\";\r\nVisualEditorStatusBarBinding.NAME_WINMEDIA \t\t= \"[windowsmedia]\";\r\nVisualEditorStatusBarBinding.NAME_GENERICMEDIA \t= \"[media]\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction VisualEditorStatusBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorStatusBarBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {VisualEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {TinyMCE_Engine} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE instance.\r\n\t * @type {TinyMCE_Control}\r\n\t */\r\n\tthis._tinyInstance = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {TinyMCE_CompositeTheme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\t\r\n\t/**\r\n\t * @type {HTMLElement}\r\n\t */\r\n\tthis._element = null;\r\n\t\r\n\t/**\r\n\t * @type {String}\r\n\t */\r\n\tthis._classname = null;\r\n\t\r\n\t/**\r\n\t * @type {LabelBinding}\r\n\t */\r\n\tthis._placeholderlabel = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorStatusBarBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[VisualEditorStatusBarBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {ToolBarBinding#onBindingAttach}\r\n */\r\nVisualEditorStatusBarBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tVisualEditorStatusBarBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this.setDisabled;\r\n\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND );\r\n\t\r\n\t/*\r\n\t * Register for initialization when TinyMCE is loaded.\r\n\t */\r\n\tvar tinywindow = this.bindingWindow.bindingMap.tinywindow;\r\n\tEditorBinding.registerComponent ( this, tinywindow );\r\n}\r\n\r\n/**\r\n * Register as node change handler when TinyMCE is initialized.\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {VisualEditorBinding} editor\r\n * @param {TinyMCE_Engine} engine\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_CompositeTheme} theme\r\n */\r\nVisualEditorStatusBarBinding.prototype.initializeComponent = function ( editor, engine, instance, theme ) {\r\n\r\n\tthis._editorBinding = editor;\r\n\tthis._tinyEngine\t= engine;\r\n\tthis._tinyInstance \t= instance;\r\n\tthis._tinyTheme \t= theme;\r\n\t\r\n\tthis._tinyTheme.registerNodeChangeHandler ( this );\r\n\t\r\n\t/*\r\n\t * A bug in Firefox 3.0 prevents us from attaching the blur listener to the window object.\r\n\t * TODO: Check out if this code stil works as expected in Firefox 3.5!\r\n\t */\r\n\tvar self = this;\r\n\tvar target = Client.isMozilla ? this._tinyInstance.getDoc () : this._tinyInstance.getWin (); \r\n\tDOMEvents.addEventListener ( target, DOMEvents.BLUR, {\r\n\t\thandleEvent : function ( e ) {\r\n\t\t\tself._element = null;\r\n\t\t}\r\n\t});\r\n}\r\n\r\n\r\n/**\r\n * @implements {IWysiwygEditorNodeChangeHandler}\r\n * @param {DOMElement} element\r\n */\r\nVisualEditorStatusBarBinding.prototype.handleNodeChange = function (element) {\r\n\r\n    if (element != this._element || element.className != this._classname) {\r\n        this._buildToolBar(element);\r\n        this._element = element;\r\n        this._classname = element.classname;\r\n    }\r\n}\r\n\r\n/**\r\n * Select DOM tree section on button command.\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nVisualEditorStatusBarBinding.prototype.handleAction = function (action) {\r\n\r\n\tVisualEditorStatusBarBinding.superclass.handleAction.call(this, action);\r\n\r\n\tswitch (action.type) {\r\n\t\tcase ButtonBinding.ACTION_COMMAND:\r\n\t\t\tvar button = action.target;\r\n\t\t\tvar depth = button.structuralDepth;\r\n\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tsetTimeout(function () { // chrome needs a timeout\r\n\t\t\t\t//self._tinyInstance.execCommand(\"mceSelectNodeDepth\", false, depth);\r\n\t\t\t\tvar counter = 0;\r\n\t\t\t\tself._tinyInstance.dom.getParent(self._tinyInstance.selection.getNode(), function (node) {\r\n\t\t\t\t\tif (node.nodeType == 1 && counter++ == depth) {\r\n\t\t\t\t\t\tself._tinyInstance.selection.select(node);\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}, self._tinyInstance.getBody());\r\n\t\t\t\tself._tinyInstance.nodeChanged();\r\n\t\t\t}, 0);\r\n\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n* Returns selected element\r\n*/\r\nVisualEditorStatusBarBinding.prototype._getSelectedNode = function () {\r\n\treturn this._tinyInstance.selection.getNode();\r\n}\r\n\r\n/**\r\n * @implements {IWysiwygEditorNodeChangeHandler}\r\n * @param {DOMElement} element\r\n */\r\nVisualEditorStatusBarBinding.prototype._buildToolBar = function ( element ) {\r\n\t\r\n\tif ( element != null ) {\r\n\t\r\n\t\tvar body = this._toolBarBodyLeft;\r\n\t\tif ( this._groupBinding ) {\r\n\t\t\tthis._groupBinding.dispose ();\r\n\t\t\tthis._groupBinding = null;\r\n\t\t}\r\n\t\tbody.hide ();\r\n\t\t\r\n\t\tvar elements = new List ();\r\n\t\twhile ( element != null && element.nodeName.toLowerCase () != \"body\" ) {\r\n\t\t\tif ( element.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\t\telements.add ( element );\r\n\t\t\t}\r\n\t\t\telement = element.parentNode;\r\n\t\t}\r\n\t\t\r\n\t\tif ( elements.reverse ().hasEntries ()) {\r\n\t\t\t\r\n\t\t\tvar groupBinding = ToolBarGroupBinding.newInstance ( this.bindingDocument );\r\n\t\t\tvar structuralDepth = elements.getLength ();\r\n\t\t\t\r\n\t\t\twhile ( elements.hasNext ()) {\r\n\t\t\t\tvar e = elements.getNext ();\r\n\t\t\t\tif ( e.nodeName.toLowerCase () != \"br\" ) { // some new TinyMCE devilry\r\n\t\t\t\t\tgroupBinding.add ( \r\n\t\t\t\t\t\tthis._getButtonBinding ( e, -- structuralDepth )\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.addLeft ( groupBinding );\r\n\t\t\tthis._groupBinding = groupBinding;\r\n\t\t\tgroupBinding.attachRecursive ();\r\n\t\t}\r\n\t\t\r\n\t\tbody.show ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Build special label to show the name of currently edited placeholder.\r\n * @param {string} name Use null to undisplay the placeholder\r\n */\r\nVisualEditorStatusBarBinding.prototype.setPlaceHolderName = function ( name ) {\r\n\t\r\n\tif ( this._placeholderlabel == null ) {\r\n\t\t\r\n\t\tvar doc = this.bindingDocument;\r\n\t\tvar group = ToolBarGroupBinding.newInstance ( doc );\r\n\t\tvar label = group.add ( ToolBarLabelBinding.newInstance ( doc ));\r\n\t\t\r\n\t\tlabel.setImage ( \"${icon:placeholder}\" );\r\n\t\t\r\n\t\tif ( name != null ) {\r\n\t\t\tlabel.setLabel ( name );\r\n\t\t} else {\r\n\t\t\tlabel.hide ();\r\n\t\t}\r\n\t\t\r\n\t\tthis.addLeftFirst ( group );\r\n\t\tgroup.attachRecursive ();\r\n\t\tthis._placeholderlabel = label;\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tif ( name ) {\r\n\t\t\tthis._placeholderlabel.setLabel ( name );\r\n\t\t\tthis._placeholderlabel.show ();\r\n\t\t} else {\r\n\t\t\tthis._placeholderlabel.hide ();\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis._toolBarBodyLeft.refreshToolBarGroups ();\r\n}\r\n\r\n/**\r\n * @param {DOMElement} element\r\n * @param {int} structuralDepth\r\n * return {EditorToolBarButtonBinding}\r\n */\r\nVisualEditorStatusBarBinding.prototype._getButtonBinding = function ( element, structuralDepth ) {\r\n\t\r\n\tvar button = EditorToolBarButtonBinding.newInstance ( this.bindingDocument );\r\n\tvar nodeName = element.nodeName.toLowerCase ();\r\n\tvar nodeData = \"\";\r\n\t\r\n\tswitch ( nodeName ) {\r\n\t\tcase \"img\":\r\n\t\t\tif (VisualEditorBinding.isFunctionElement(element))\r\n\t\t\t\tnodeName = VisualEditorStatusBarBinding.NAME_RENDERING; ;\r\n\t\t\tif (VisualEditorBinding.isFieldElement(element))\r\n\t\t\t\tnodeName = VisualEditorStatusBarBinding.NAME_FIELD;\r\n\t\t\tif (VisualEditorBinding.isHtmlElement(element))\r\n\t\t\t\tnodeName = VisualEditorStatusBarBinding.NAME_HTML;\r\n\t\t\tbreak;\r\n\t\tcase \"b\" :\r\n\t\t\tnodeName = \"strong\";\r\n\t\t\tbreak;\r\n\t\tcase \"i\" :\r\n\t\t\tnodeName = \"em\";\r\n\t\t\tbreak;\r\n\t\t case \"font\" :\r\n\t\t\tnodeName = \"span\";\r\n\t}\r\n\t\r\n\t\r\n\tvar id = element.id;\r\n\tvar classname = element.className;\r\n\t\r\n\tif ( id != \"\" ) {\r\n\t\tnodeData += \"id=\\\"\" + id + \"\\\" \";\r\n\t\tnodeName += \"#\" + id;\r\n\t}\r\n\tif ( classname != \"\" && !VisualEditorBinding.isReservedElement(element)\r\n\t\t) { \r\n\t\tclassname = VisualEditorBinding.getTinyLessClassName ( classname );\r\n\t\tif ( classname != \"\" ) {\r\n\t\t\tnodeData += \"class=\\\"\" + classname + \"\\\" \";\r\n\t\t\tnodeName += \".\" + classname;\r\n\t\t}\r\n\t}\r\n\t\r\n\tbutton.structuralDepth = structuralDepth;\r\n\tbutton.setLabel ( nodeName );\r\n\tbutton.setToolTip ( nodeData );\r\n\treturn button;\r\n}\r\n\r\n/**\r\n * Hide statusbar content when editor is not active.\r\n * @param {boolean} isDisable\r\n */\r\nVisualEditorStatusBarBinding.prototype.setDisabled = function ( isDisabled ) {\r\n\t\r\n\tif ( this._groupBinding ) {\r\n\t\tif ( isDisabled ) {\r\n\t\t\tthis._groupBinding.dispose ();\r\n\t\t\tthis._groupBinding = null;\r\n\t\t\tthis._toolBarBodyLeft.refreshToolBarGroups ();\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/bindings/VisualEditorToolBarBinding.js",
    "content": "VisualEditorToolBarBinding.prototype = new ToolBarBinding;\r\nVisualEditorToolBarBinding.prototype.constructor = VisualEditorToolBarBinding;\r\nVisualEditorToolBarBinding.superclass = ToolBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IWysiwygEditorComponent}\r\n * @implements {IWysiwygEditorNodeChangeHandler}\r\n */\r\nfunction VisualEditorToolBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorToolBarBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {WysiwygEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {TinyMCE_Engine} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE instance.\r\n\t * @type {tinymce.Editor}\r\n\t */\r\n\tthis._tinyInstance = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {TinyMCE_CompositeTheme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorToolBarBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[VisualEditorToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * Fix the height, awating lazy attachment by containing box.\r\n * @overloads {ToolBarBinding#onBindingRegister}\r\n */\r\nVisualEditorToolBarBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tVisualEditorToolBarBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.buildDOMContent ();\r\n}\r\n\r\n\r\n/**\r\n * Register for initialization when TinyMCE is loaded.\r\n * @overloads {ToolBarBinding#onBindingAttach}\r\n */\r\nVisualEditorToolBarBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tVisualEditorToolBarBinding.superclass.onBindingAttach.call ( this );\r\n\tvar tinywindow = this.bindingWindow.bindingMap.tinywindow;\r\n\tEditorBinding.registerComponent ( this, tinywindow );\r\n}\r\n\r\n/**\r\n * Setup to initialize when TinyMCE is loaded and containng EditorBinding initializes.\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {WysiwygEditorBinding} editor\r\n * @param {TinyMCE_Engine} engine\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_CompositeTheme} theme\r\n */\r\nVisualEditorToolBarBinding.prototype.initializeComponent = function ( editor, engine, instance, theme ) {\r\n\r\n\tthis._editorBinding = editor;\r\n\tthis._tinyEngine\t= engine;\r\n\tthis._tinyInstance \t= instance;\r\n\tthis._tinyTheme \t= theme;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/ie.css",
    "content": "﻿body {\r\n\tbackground-color: #00bfff;\r\n}\r\n/* Disable hasLayout for IE*/\r\n.mce-content-body * {\r\n\tmin-height: auto !important;\r\n\tmin-width: auto !important;\r\n\tmax-height: none !important;\r\n\tmax-width: none !important;\r\n\tcolumn-count: auto !important;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/includes/toolbaradvanced.inc",
    "content": "<ui:toolbarbody>\r\n  <ui:toolbargroup>\r\n    <ui:selector id=\"blockselector\" binding=\"BlockSelectorBinding\" observes=\"broadcasterIsActive\" image=\"${icon:editor-blockselector}\" image-disabled=\"${icon:editor-blockselector-disabled}\" width=\"140\" />\r\n    <ui:selector id=\"formatselector\" binding=\"FormatSelectorBinding\" observes=\"broadcasterIsActive\" image=\"${icon:editor-formatselector}\" image-disabled=\"${icon:editor-formatselector-disabled}\" width=\"140\"/>\r\n    <ui:selector id=\"classnameselector\" binding=\"ClassNameSelectorBinding\" observes=\"broadcasterIsActive\" image=\"${icon:editor-classselector}\" image-disabled=\"${icon:editor-classselector-disabled}\" label=\"${string:Composite.Web.VisualEditor:ClassSelector.LabelNone}\" value=\"\" width=\"140\" />\r\n  </ui:toolbargroup>\r\n  <ui:toolbargroup>\r\n    <ui:toolbarbutton label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelInsert}\" binding=\"VisualEditorInsertPlusFieldsToolBarButtonBinding\" image=\"${icon:insert}\" image-disabled=\"${icon:insert-disabled}\" isdisabled=\"true\" observes=\"broadcasterIsActive\" popup=\"insertpopup\" />\r\n    <ui:toolbarbutton label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelPaste}\" binding=\"VisualEditorInsertToolBarButtonBinding\" image=\"${icon:down}\" image-disabled=\"${icon:down-disabled}\" isdisabled=\"true\" observes=\"broadcasterIsActive\" popup=\"pastepopup\" />\r\n  </ui:toolbargroup>\r\n  <ui:toolbargroup binding=\"VisualEditorPropertiesToolBarGroupBinding\" hidden=\"true\" observes=\"broadcasterIsActive\">\r\n    <ui:toolbarbutton cmd=\"compositeInsertImage\" val=\"update\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelImageProperties\" image=\"${icon:image}\" />\r\n    <ui:toolbarbutton cmd=\"compositeInsertRendering\" val=\"update\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelRenderingProperties}\" image=\"${icon:functioncall}\" />\r\n  </ui:toolbargroup>\r\n</ui:toolbarbody>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/includes/toolbarsimple.inc",
    "content": "<ui:toolbarbody>\r\n\t<ui:toolbargroup>\r\n\t\t<ui:toolbarbutton cmd=\"InsertUnorderedList\" tooltip=\"${string:Composite.Web.VisualEditor:ToolBar.ToolTipUnorderedList}\" type=\"checkbox\" image=\"${icon:bullist}\" isdisabled=\"true\" /> <!-- image-disabled=\"${skin}/wysiwygeditor/bullist-disabled.png\" -->\r\n\t\t<ui:toolbarbutton cmd=\"InsertOrderedList\" tooltip=\"${string:Composite.Web.VisualEditor:ToolBar.ToolTipOrderedList}\" type=\"checkbox\" image=\"${icon:numlist}\" isdisabled=\"true\" /> <!-- image-disabled=\"${skin}/wysiwygeditor/numlist-disabled.png\" -->\r\n\t\t<ui:toolbarbutton cmd=\"Outdent\" tooltip=\"Outdent\" type=\"checkbox\" image=\"${icon:outdent}\" isdisabled=\"true\" />\r\n\t\t<ui:toolbarbutton cmd=\"Indent\" tooltip=\"Indent\" type=\"checkbox\" image=\"${icon:indent}\" isdisabled=\"true\" />\r\n\t</ui:toolbargroup>\r\n\t<ui:toolbargroup>\r\n\t\t<ui:toolbarbutton cmd=\"compositeInsertLink\" tooltip=\"${string:Composite.Web.VisualEditor:ToolBar.ToolTipLink}\" image=\"${icon:link}\" isdisabled=\"true\" /> <!-- image-disabled=\"${icon:link-disabled}\" -->\r\n\t\t<ui:toolbarbutton cmd=\"unlink\" tooltip=\"${string:Composite.Web.VisualEditor:ToolBar.ToolTipDeleteLink}\" image=\"${icon:unlink}\" isdisabled=\"true\" /> <!-- image-disabled=\"${icon:unlink-disabled}\" -->\r\n\t</ui:toolbargroup>\r\n\t<ui:toolbargroup>\r\n\t\t<ui:toolbarbutton cmd=\"Undo\" tooltip=\"${string:Composite.Web.VisualEditor:ToolBar.ToolTipUndo}\" image=\"${icon:undo}\" isdisabled=\"true\" observes=\"broadcasterCanUndo\" /> <!-- image-disabled=\"${icon:undo-disabled}\" -->\r\n\t\t<ui:toolbarbutton cmd=\"Redo\" tooltip=\"${string:Composite.Web.VisualEditor:ToolBar.ToolTipRedo}\" image=\"${icon:redo}\" isdisabled=\"true\" observes=\"broadcasterCanRedo\" /> <!-- image-disabled=\"${icon:redo-disabled}\" -->\r\n\t\t<ui:toolbarbutton cmd=\"compositeSearchAndReplace\" tooltip=\"${string:Composite.Web.VisualEditor:SearchAndReplace.LaunchButton.Label}\" image=\"${icon:generic-search}\" isdisabled=\"true\" observes=\"broadcasterIsActive\" />\r\n\t</ui:toolbargroup>\r\n\t<ui:toolbargroup>\t\t\r\n\t\t<ui:toolbarbutton cmd=\"compositeInsertComponent\" label=\"${string:Composite.Web.VisualEditor:Components.LaunchButton.Label}\" image=\"${icon:functioncall}\" isdisabled=\"true\" observes=\"broadcasterIsActive\" />\r\n\t</ui:toolbargroup>\r\n</ui:toolbarbody>\r\n<ui:toolbarbody align=\"right\">\r\n\t<ui:toolbargroup>\r\n\t\t<ui:toolbarbutton cmd=\"compositeswitchmode\" hidden=\"false\" editorcontrol=\"false\" id=\"switchbutton\" label=\"${string:Composite.Web.VisualEditor:ToolBar.LabelSource}\" image=\"${icon:editor-sourceview}\" image-disabled=\"${icon:editor-sourceview-disabled}\" flip=\"true\"/>\r\n\t</ui:toolbargroup>\r\n</ui:toolbarbody>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/scripts/Format.js",
    "content": "/**\r\n * @type {Element}\r\n */\r\nFormat.element = null;\r\n\r\n/**\r\n * @param {Element} element\r\n * @param {String} name\r\n * @returns {object}\r\n */\r\nFormat.get = function ( name ) {\r\n\t\r\n\tvar result = null;\r\n\tvar value = Format.element.getAttribute ( name );\r\n\tif ( value != null ) {\r\n\t\tresult = Types.castFromString ( value );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @type {List<Format>}\r\n */\r\nFormat.instances = new List ();\r\n\r\n/**\r\n * The active TinyMCE element.\r\n * @type {Element}\r\n */\r\nFormat._tinyElement = null;\r\n\r\n/**\r\n * Tracking the active TinyMCE element.\r\n * @implements {IWysiwygEditorNodeChangeHandler}\r\n * @param {Element} element\r\n */\r\nFormat.handleNodeChange = function ( element ) {\r\n\t\r\n\tthis._tinyElement = element;\r\n}\r\n\r\n/**\r\n * Configure TinyMCE instance.\r\n * @type {tinymce.Editor} tinyInstance\r\n */\r\nFormat.configure = function ( tinyInstance ) {\r\n\t\r\n\tFormat.instances.each ( function ( format ) {\r\n\t\ttinyInstance.addQueryStateHandler ( format.id, function () {\r\n\t\t\treturn Format.test ( format, tinyInstance );\r\n\t\t}, this );\r\n\t});\r\n}\r\n\r\n/**\r\n * Implement a test for TinyMCE \"queryCommandState\" action.\r\n * @param {Format} format\r\n * @param {tinymce.Editor} tinyInstance\r\n * @returns {boolean}\r\n */\r\nFormat.test = function ( format, tinyInstance ) {\r\n\t\r\n\tvar result = false;\r\n\t\r\n\tvar tag = null;\r\n\tvar props = format.props;\r\n\tvar element = Format._tinyElement;\r\n\t\r\n\ttag = props.block ? props.block : props.inline;\r\n\tif ( tag === undefined || element.nodeName.toLowerCase () == tag ) {\r\n\t\tvar classes = props.classes;\r\n\t\tif ( props.classes !== undefined ) {\r\n\t\t\tvar classes = new String ( props.classes );\r\n\t\t\tvar res = true;\r\n\t\t\tnew List ( classes.split ( \" \" )).each ( function ( c ) {\r\n\t\t\t\tif ( !CSSUtil.hasClassName ( element, c )) {\r\n\t\t\t\t\tres = false;\r\n\t\t\t\t}\r\n\t\t\t\treturn res;\r\n\t\t\t});\r\n\t\t\tresult = res;\r\n\t\t} else {\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn result;\r\n}\r\n\r\n\r\n//.......................................................................\r\n\r\n/**\r\n * @param {Element} element\r\n * @returns {Format}\r\n */\r\nfunction Format ( element ) {\r\n\t\r\n\tFormat.instances.add ( this );\r\n\tthis._construct ( element );\r\n}\r\n\r\nFormat.prototype = {\r\n\r\n\t/**\r\n\t * @type {String}\r\n\t */\r\n\tid : null,\r\n\t\r\n\t/**\r\n\t * Label.\r\n\t * @type {String}\r\n\t */\r\n\tlabel : null,\r\n\t\r\n\t/**\r\n\t * Image.\r\n\t * @type {String}\r\n\t */\r\n\timage : null,\r\n\t\r\n\t/**\r\n\t * Notes.\r\n\t * @type {String}\r\n\t */\r\n\tnotes : null,\r\n\t\r\n\t/**\r\n\t * Notes.\r\n\t * @type {String}\r\n\t */\r\n\tisRadio : null,\r\n\t\r\n\t/**\r\n\t * Button config.\r\n\t * @type {boolean}\r\n\t */\r\n\tbutton : null,\r\n\t\r\n\t/**\r\n\t * Select config.\r\n\t * @type {boolean}\r\n\t */\r\n\tselect : null,\r\n\t\r\n\t/**\r\n\t * Configures TinyMCE.\r\n\t * @type {object}\r\n\t */\r\n\tprops : null,\r\n\t\r\n\t/**\r\n\t * @type {number}\r\n\t */\r\n\tpriority : 0,\r\n\t\r\n\t/**\r\n\t * Constructor action.\r\n\t * @param {Element} element\r\n\t */\r\n\t_construct : function ( element ) {\r\n\t\r\n\t\tFormat.element = element;\r\n\t\r\n\t\t// basic properties\r\n\t\tthis.id = Format.get ( \"id\" );\r\n\t\tthis.label = Format.get ( \"label\" ); \r\n\t\tthis.image = Format.get ( \"image\" );\r\n\t\tthis.notes = Format.get ( \"notes\" );\r\n\t\t\r\n\t\t// priroty (defaults to zero).\r\n\t\tvar priority = Format.get ( \"priority\" );\r\n\t\tif ( priority != null ) {\r\n\t\t\tthis.priority = priority; \r\n\t\t}\r\n\t\t\r\n\t\t// is radio button?\r\n\t\tthis.isRadio = element.parentNode.nodeName.toLowerCase () == \"radiogroup\";\r\n\t\t\r\n\t\t// build TinyMCE configuration object.\r\n\t\tthis._propify ();\r\n\t\t\r\n\t\t// buttons and menuitems\r\n\t\tthis._extras ( element );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Parse format properties.\r\n\t */\r\n\t_propify : function () {\r\n\t\t\r\n\t\tthis.props = {\r\n\t\t\tinline\t\t: Format.get ( \"inline\" ),\r\n\t\t\tblock \t\t: Format.get ( \"block\" ),\r\n\t\t\tclasses \t: Format.get ( \"classes\" ), \r\n\t\t\tselector \t: Format.get ( \"selector\" ),\r\n\t\t\twrapper\t\t: Format.get ( \"wrapper\" ),\r\n\t\t};\r\n\t\t\r\n\t\t// primitive validation\r\n\t\tif ( this.props.block != null && this.props.inline != null ) {\r\n\t\t\tvar cry = \"Conflicting format attributes: block, inline (#\" + this.id + \")\";\r\n\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\talert ( cry );\r\n\t\t\t}\r\n\t\t\tthrow cry;\r\n\t\t}\r\n\t\t\r\n\t\t// wipe empty props\r\n\t\tfor ( var prop in this.props ) {\r\n\t\t\tif ( this.props [ prop ] == null ) {\r\n\t\t\t\tdelete this.props [ prop ];\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Extract button and select configuration.\r\n\t * @param {Element} element\r\n\t */\r\n\t_extras : function ( element ) {\r\n\t\t\r\n\t\tvar button = element.getElementsByTagName ( \"button\" ).item ( 0 );\r\n\t\tvar select = element.getElementsByTagName ( \"select\" ).item ( 0 );\r\n\t\t\r\n\t\tif ( button != null ) {\r\n\t\t\tFormat.element = button;\r\n\t\t\tvar label = Format.get ( \"label\" );\r\n\t\t\tvar image = Format.get ( \"image\" );\r\n\t\t\tvar notes = Format.get ( \"notes\" );\r\n\t\t\tthis.button = {\r\n\t\t\t\tlabel : label != null ? label : this.label,\r\n\t\t\t\timage : image != null ? image : this.image,\r\n\t\t\t\tnotes : notes != null ? notes : this.notes\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif ( select != null ) {\r\n\t\t\tFormat.element = select;\r\n\t\t\tvar label = Format.get ( \"label\" );\r\n\t\t\tvar image = Format.get ( \"image\" );\r\n\t\t\tvar notes = Format.get ( \"notes\" );\r\n\t\t\tthis.select = {\r\n\t\t\t\tlabel : label != null ? label : this.label,\r\n\t\t\t\timage : image != null ? image : this.image,\r\n\t\t\t\tnotes : notes != null ? notes : this.notes\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositecharmap/CharMapDialogPageBinding.js",
    "content": "CharMapDialogPageBinding.prototype = new DialogPageBinding;\r\nCharMapDialogPageBinding.prototype.constructor = CharMapDialogPageBinding;\r\nCharMapDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction CharMapDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"CharMapDialogPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCharMapDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[CharMapDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n *\r\n */\r\nCharMapDialogPageBinding.prototype.onBindingAttach = function () {\r\n\r\n\tCharMapDialogPageBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.addEventListener ( DOMEvents.MOUSEOVER );\r\n\tthis.addEventListener ( DOMEvents.MOUSEOUT );\r\n\tthis.addEventListener ( DOMEvents.CLICK );\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nCharMapDialogPageBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tCharMapDialogPageBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tvar e = e ? e : this.bindingWindow.event;\r\n\tvar node = e.target ? e.target : e.srcElement;\r\n\tvar p = this.bindingDocument.getElementById ( \"selection\" );\r\n\t\r\n\tif ( DOMUtil.getLocalName ( node ) == \"a\" ) {\r\n\t\tswitch ( e.type ) {\r\n\t\t\tcase \"click\" :\r\n\t\t\t\tthis.response = Dialog.RESPONSE_ACCEPT;\r\n\t\t\t\tthis.result = String.fromCharCode ( node.getAttribute ( \"code\" ));\r\n\t\t\t\tthis.dispatchAction ( DialogPageBinding.ACTION_RESPONSE );\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tp.firstChild.nodeValue = e.type == DOMEvents.MOUSEOVER ? node.getAttribute ( \"text\" ) : \"\";\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositecharmap/charmap.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>    \r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialog.WysiwygEditor.Charmap</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\" src=\"CharMapDialogPageBinding.js\"></script>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"charmap.css\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage \r\n\t\t\tclass=\"tabboxed\" \r\n\t\t\tbinding=\"CharMapDialogPageBinding\" \r\n\t\t\tlabel=\"${string:Composite.Web.VisualEditor:CharMap.LabelSelectSpecialChar}\" \r\n\t\t\timage=\"${icon:specialchar}\"\r\n\t\t\tresizable=\"false\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"${string:Composite.Web.VisualEditor:CharMap.LabelGeneral}\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"${string:Composite.Web.VisualEditor:CharMap.LabelAlphabetical}\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"${string:Composite.Web.VisualEditor:CharMap.LabelMathSymbols}\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:CharMap.LabelCommon}\" class=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"160\" entity=\"nbsp\" text=\"no-break space\" href=\"javascript:void(false);\" />\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"38\" entity=\"amp\" text=\"ampersand\" href=\"javascript:void(false);\">&amp;</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"34\" entity=\"quot\" text=\"quotation mark\" href=\"javascript:void(false);\">\"</a>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:CharMap.LabelQuotation}\" class=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8249\" entity=\"lsaquo\" text=\"Single left-pointing angle quotation\" href=\"javascript:void(false);\">‹</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8250\" entity=\"rsaquo\" text=\"Single right-pointing angle quotation\" href=\"javascript:void(false);\">›</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"171\" entity=\"laquo\" text=\"Left pointing guillemet\" href=\"javascript:void(false);\">«</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"187\" entity=\"raquo\" text=\"Right pointing guillemet\" href=\"javascript:void(false);\">»</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8216\" entity=\"lsquo\" text=\"Left single quotation\" href=\"javascript:void(false);\">‘</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8217\" entity=\"rsquo\" text=\"Right single quotation\" href=\"javascript:void(false);\">’</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8220\" entity=\"ldquo\" text=\"Left double quotation\" href=\"javascript:void(false);\">“</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8221\" entity=\"rdquo\" text=\"Right double quotation\" href=\"javascript:void(false);\">”</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8218\" entity=\"sbquo\" text=\"single low-9 quotation\" href=\"javascript:void(false);\">‚</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8222\" entity=\"bdquo\" text=\"double low-9 quotation\" href=\"javascript:void(false);\">„</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"60\" entity=\"lt\" text=\"Less-than\" href=\"javascript:void(false);\">&lt;</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"62\" entity=\"gt\" text=\"Greater-than\" href=\"javascript:void(false);\">&gt;</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8805\" entity=\"ge\" text=\"Greater-than or equal to\" href=\"javascript:void(false);\">≥</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8211\" entity=\"ndash\" text=\"En dash\" href=\"javascript:void(false);\">—</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8212\" entity=\"mdash\" text=\"Em dash\" href=\"javascript:void(false);\">¯</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"175\" entity=\"macr\" text=\"Macron\" href=\"javascript:void(false);\">¯</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8254\" entity=\"oline\" text=\"Overline\" href=\"javascript:void(false);\">‾</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"166\" entity=\"brvbar\" text=\"Broken bar\" href=\"javascript:void(false);\">¦</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"168\" entity=\"uml\" text=\"Diaeresis\" href=\"javascript:void(false);\">¨</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"161\" entity=\"iexcl\" text=\"Inverted exclamation mark\" href=\"javascript:void(false);\">¡</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"191\" entity=\"lquest\" text=\"Turned question mark\" href=\"javascript:void(false);\">¿</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"710\" entity=\"circ\" text=\"Circumflex accent\" href=\"javascript:void(false);\">ˆ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"732\" entity=\"tilde\" text=\"Small tilde\" href=\"javascript:void(false);\">˜</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"176\" entity=\"deg\" text=\"Degree sign\" href=\"javascript:void(false);\">°</a>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:CharMap.LabelCurrency}\" class=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"164\" entity=\"curren\" text=\"Currency sign\" href=\"javascript:void(false);\">¤</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8364\" entity=\"euro\" text=\"Euro\" href=\"javascript:void(false);\">€</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"036\" entity=\"dollar\" text=\"Dollar\" href=\"javascript:void(false);\">$</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"162\" entity=\"cent\" text=\"Cent\" href=\"javascript:void(false);\">¢</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"163\" entity=\"pound\" text=\"Pound\" href=\"javascript:void(false);\">£</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"165\" entity=\"yen\" text=\"Yen\" href=\"javascript:void(false);\">¥</a>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:CharMap.LabelLatin}\" class=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"192\" entity=\"Agrave\" text=\"A - grave\" href=\"javascript:void(false);\">À</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"193\" entity=\"Aacute\" text=\"A - acute\" href=\"javascript:void(false);\">Á</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"194\" entity=\"Acirc\" text=\"A - circumflex\" href=\"javascript:void(false);\">Â</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"195\" entity=\"Atilde\" text=\"A - tilde\" href=\"javascript:void(false);\">Ã</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"196\" entity=\"Auml\" text=\"A - diaeresis\" href=\"javascript:void(false);\">Ä</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"197\" entity=\"Aring\" text=\"A - ring above\" href=\"javascript:void(false);\">Å</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"198\" entity=\"AElig\" text=\"ligature AE\" href=\"javascript:void(false);\">Æ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"199\" entity=\"Ccedil\" text=\"C - cedilla\" href=\"javascript:void(false);\">Ç</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"200\" entity=\"Egrave\" text=\"E - grave\" href=\"javascript:void(false);\">È</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"201\" entity=\"Eacute\" text=\"E - acute\" href=\"javascript:void(false);\">É</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"202\" entity=\"Ecirc\" text=\"E - circumflex\" href=\"javascript:void(false);\">Ê</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"203\" entity=\"Euml\" text=\"E - diaeresis\" href=\"javascript:void(false);\">Ë</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"204\" entity=\"Igrave\" text=\"I - grave\" href=\"javascript:void(false);\">Ì</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"205\" entity=\"Iacute\" text=\"I - acute\" href=\"javascript:void(false);\">Í</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"206\" entity=\"Icirc\" text=\"I - circumflex\" href=\"javascript:void(false);\">Î</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"207\" entity=\"Iuml\" text=\"I - diaeresis\" href=\"javascript:void(false);\">Ï</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"208\" entity=\"ETH\" text=\"ETH\" href=\"javascript:void(false);\">Ð</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"209\" entity=\"Ntilde\" text=\"N - tilde\" href=\"javascript:void(false);\">Ñ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"210\" entity=\"Ograve\" text=\"O - grave\" href=\"javascript:void(false);\">Ò</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"211\" entity=\"Oacute\" text=\"O - acute\" href=\"javascript:void(false);\">Ó</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"212\" entity=\"Ocirc\" text=\"O - circumflex\" href=\"javascript:void(false);\">Ô</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"213\" entity=\"Otilde\" text=\"O - tilde\" href=\"javascript:void(false);\">Õ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"214\" entity=\"Ouml\" text=\"O - diaeresis\" href=\"javascript:void(false);\">Ö</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"216\" entity=\"Oslash\" text=\"O - slash\" href=\"javascript:void(false);\">Ø</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"338\" entity=\"OElig\" text=\"ligature OE\" href=\"javascript:void(false);\">Œ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"352\" entity=\"Scaron\" text=\"S - caron\" href=\"javascript:void(false);\">Š</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"217\" entity=\"Ugrave\" text=\"U - grave\" href=\"javascript:void(false);\">Ù</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"218\" entity=\"Uacute\" text=\"U - acute\" href=\"javascript:void(false);\">Ú</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"219\" entity=\"Ucirc\" text=\"U - circumflex\" href=\"javascript:void(false);\">Û</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"220\" entity=\"Uuml\" text=\"U - diaeresis\" href=\"javascript:void(false);\">Ü</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"221\" entity=\"Yacute\" text=\"Y - acute\" href=\"javascript:void(false);\">Ý</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"376\" entity=\"Yuml\" text=\"Y - diaeresis\" href=\"javascript:void(false);\">Ÿ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"222\" entity=\"THORN\" text=\"THORN\" href=\"javascript:void(false);\">Þ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"224\" entity=\"agrave\" text=\"a - grave\" href=\"javascript:void(false);\">à</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"225\" entity=\"aacute\" text=\"a - acute\" href=\"javascript:void(false);\">á</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"226\" entity=\"acirc\" text=\"a - circumflex\" href=\"javascript:void(false);\">â</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"227\" entity=\"atilde\" text=\"a - tilde\" href=\"javascript:void(false);\">ã</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"228\" entity=\"auml\" text=\"a - diaeresis\" href=\"javascript:void(false);\">ä</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"229\" entity=\"aring\" text=\"a - ring above\" href=\"javascript:void(false);\">å</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"230\" entity=\"aelig\" text=\"ligature ae\" href=\"javascript:void(false);\">æ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"231\" entity=\"ccedil\" text=\"c - cedilla\" href=\"javascript:void(false);\">ç</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"232\" entity=\"egrave\" text=\"e - grave\" href=\"javascript:void(false);\">è</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"233\" entity=\"eacute\" text=\"e - acute\" href=\"javascript:void(false);\">é</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"234\" entity=\"ecirc\" text=\"e - circumflex\" href=\"javascript:void(false);\">ê</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"235\" entity=\"euml\" text=\"e - diaeresis\" href=\"javascript:void(false);\">ë</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"236\" entity=\"igrave\" text=\"i - grave\" href=\"javascript:void(false);\">ì</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"237\" entity=\"iacute\" text=\"i - acute\" href=\"javascript:void(false);\">í</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"238\" entity=\"icirc\" text=\"i - circumflex\" href=\"javascript:void(false);\">î</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"239\" entity=\"iuml\" text=\"i - diaeresis\" href=\"javascript:void(false);\">ï</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"240\" entity=\"eth\" text=\"eth\" href=\"javascript:void(false);\">ð</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"241\" entity=\"ntilde\" text=\"n - tilde\" href=\"javascript:void(false);\">ñ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"242\" entity=\"ograve\" text=\"o - grave\" href=\"javascript:void(false);\">ò</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"243\" entity=\"oacute\" text=\"o - acute\" href=\"javascript:void(false);\">ó</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"244\" entity=\"ocirc\" text=\"o - circumflex\" href=\"javascript:void(false);\">ô</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"245\" entity=\"otilde\" text=\"o - tilde\" href=\"javascript:void(false);\">õ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"246\" entity=\"ouml\" text=\"o - diaeresis\" href=\"javascript:void(false);\">ö</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"248\" entity=\"oslash\" text=\"o slash\" href=\"javascript:void(false);\">ø</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"339\" entity=\"oelig\" text=\"ligature oe\" href=\"javascript:void(false);\">œ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"353\" entity=\"scaron\" text=\"s - caron\" href=\"javascript:void(false);\">š</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"249\" entity=\"ugrave\" text=\"u - grave\" href=\"javascript:void(false);\">ù</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"250\" entity=\"uacute\" text=\"u - acute\" href=\"javascript:void(false);\">ú</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"251\" entity=\"ucirc\" text=\"u - circumflex\" href=\"javascript:void(false);\">û</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"252\" entity=\"uuml\" text=\"u - diaeresis\" href=\"javascript:void(false);\">ü</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"253\" entity=\"yacute\" text=\"y - acute\" href=\"javascript:void(false);\">ý</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"254\" entity=\"thorn\" text=\"thorn\" href=\"javascript:void(false);\">þ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"255\" entity=\"yuml\" text=\"y - diaeresis\" href=\"javascript:void(false);\">ÿ</a>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:CharMap.LabelGreek}\" class=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"913\" entity=\"Alpha\" text=\"Alpha\" href=\"javascript:void(false);\">Α</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"914\" entity=\"Beta\" text=\"Beta\" href=\"javascript:void(false);\">Β</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"915\" entity=\"Gamma\" text=\"Gamma\" href=\"javascript:void(false);\">Γ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"916\" entity=\"Delta\" text=\"Delta\" href=\"javascript:void(false);\">Δ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"917\" entity=\"Epsilon\" text=\"Epsilon\" href=\"javascript:void(false);\">Ε</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"918\" entity=\"Zeta\" text=\"Zeta\" href=\"javascript:void(false);\">Ζ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"919\" entity=\"Eta\" text=\"Eta\" href=\"javascript:void(false);\">Η</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"920\" entity=\"Theta\" text=\"Theta\" href=\"javascript:void(false);\">Θ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"921\" entity=\"Iota\" text=\"Iota\" href=\"javascript:void(false);\">Ι</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"922\" entity=\"Kappa\" text=\"Kappa\" href=\"javascript:void(false);\">Κ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"923\" entity=\"Lambda\" text=\"Lambda\" href=\"javascript:void(false);\">Λ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"924\" entity=\"Mu\" text=\"Mu\" href=\"javascript:void(false);\">Μ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"925\" entity=\"Nu\" text=\"Nu\" href=\"javascript:void(false);\">Ν</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"926\" entity=\"Xi\" text=\"Xi\" href=\"javascript:void(false);\">Ξ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"927\" entity=\"Omicron\" text=\"Omicron\" href=\"javascript:void(false);\">Ο</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"928\" entity=\"Pi\" text=\"Pi\" href=\"javascript:void(false);\">Π</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"929\" entity=\"Rho\" text=\"Rho\" href=\"javascript:void(false);\">Ρ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"931\" entity=\"Sigma\" text=\"Sigma\" href=\"javascript:void(false);\">Σ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"932\" entity=\"Tau\" text=\"Tau\" href=\"javascript:void(false);\">Τ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"933\" entity=\"Upsilon\" text=\"Upsilon\" href=\"javascript:void(false);\">Υ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"934\" entity=\"Phi\" text=\"Phi\" href=\"javascript:void(false);\">Φ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"935\" entity=\"Chi\" text=\"Chi\" href=\"javascript:void(false);\">Χ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"936\" entity=\"Psi\" text=\"Psi\" href=\"javascript:void(false);\">Ψ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"937\" entity=\"Omega\" text=\"Omega\" href=\"javascript:void(false);\">Ω</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"945\" entity=\"alpha\" text=\"alpha\" href=\"javascript:void(false);\">α</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"946\" entity=\"beta\" text=\"beta\" href=\"javascript:void(false);\">β</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"947\" entity=\"gamma\" text=\"gamma\" href=\"javascript:void(false);\">γ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"948\" entity=\"delta\" text=\"delta\" href=\"javascript:void(false);\">δ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"949\" entity=\"epsilon\" text=\"epsilon\" href=\"javascript:void(false);\">ε</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"950\" entity=\"zeta\" text=\"zeta\" href=\"javascript:void(false);\">ζ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"951\" entity=\"eta\" text=\"eta\" href=\"javascript:void(false);\">η</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"952\" entity=\"theta\" text=\"theta\" href=\"javascript:void(false);\">θ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"953\" entity=\"iota\" text=\"iota\" href=\"javascript:void(false);\">ι</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"954\" entity=\"kappa\" text=\"kappa\" href=\"javascript:void(false);\">κ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"955\" entity=\"lambda\" text=\"lambda\" href=\"javascript:void(false);\">λ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"956\" entity=\"mu\" text=\"mu\" href=\"javascript:void(false);\">μ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"957\" entity=\"nu\" text=\"nu\" href=\"javascript:void(false);\">ν</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"958\" entity=\"xi\" text=\"xi\" href=\"javascript:void(false);\">ξ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"959\" entity=\"omicron\" text=\"omicron\" href=\"javascript:void(false);\">ο</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"960\" entity=\"pi\" text=\"pi\" href=\"javascript:void(false);\">π</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"961\" entity=\"rho\" text=\"rho\" href=\"javascript:void(false);\">ρ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"962\" entity=\"sigmaf\" text=\"final sigma\" href=\"javascript:void(false);\">ς</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"963\" entity=\"sigma\" text=\"sigma\" href=\"javascript:void(false);\">σ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"964\" entity=\"tau\" text=\"tau\" href=\"javascript:void(false);\">τ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"965\" entity=\"upsilon\" text=\"upsilon\" href=\"javascript:void(false);\">υ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"966\" entity=\"phi\" text=\"phi\" href=\"javascript:void(false);\">φ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"967\" entity=\"chi\" text=\"chi\" href=\"javascript:void(false);\">χ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"968\" entity=\"psi\" text=\"psi\" href=\"javascript:void(false);\">ψ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"969\" entity=\"omega\" text=\"omega\" href=\"javascript:void(false);\">ω</a>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:CharMap.LabelMathAndLogic}\" class=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8722\" entity=\"minus\" text=\"Minus sign\" href=\"javascript:void(false);\">−</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"177\" entity=\"plusmn\" text=\"Plus-minus sign\" href=\"javascript:void(false);\">±</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"247\" entity=\"divide\" text=\"Division sign\" href=\"javascript:void(false);\">÷</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8260\" entity=\"frasl\" text=\"Fraction slash\" href=\"javascript:void(false);\">⁄</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"215\" entity=\"times\" text=\"Multiplication sign\" href=\"javascript:void(false);\">×</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"185\" entity=\"sup1\" text=\"Superscript one\" href=\"javascript:void(false);\">¹</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"178\" entity=\"sup2\" text=\"Superscript two\" href=\"javascript:void(false);\">²</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"179\" entity=\"sup3\" text=\"Superscript three\" href=\"javascript:void(false);\">³</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"188\" entity=\"frac14\" text=\"Fraction one quarter\" href=\"javascript:void(false);\">¼</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"189\" entity=\"frac12\" text=\"Fraction one half\" href=\"javascript:void(false);\">½</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"190\" entity=\"frac34\" text=\"Fraction three quarters\" href=\"javascript:void(false);\">¾</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"402\" entity=\"fnof\" text=\"Function / florin\" href=\"javascript:void(false);\">ƒ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8747\" entity=\"int\" text=\"Integral\" href=\"javascript:void(false);\">∫</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8721\" entity=\"sum\" text=\"N-ary sumation\" href=\"javascript:void(false);\">∑</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8734\" entity=\"infin\" text=\"Infinity\" href=\"javascript:void(false);\">∞</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8730\" entity=\"radic\" text=\"Square root\" href=\"javascript:void(false);\">√</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8764\" entity=\"sim\" text=\"Similar to\" href=\"javascript:void(false);\">∼</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8773\" entity=\"cong\" text=\"Approximately equal to\" href=\"javascript:void(false);\">≅</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8776\" entity=\"asymp\" text=\"Almost equal to\" href=\"javascript:void(false);\">≈</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8800\" entity=\"ne\" text=\"Not equal to\" href=\"javascript:void(false);\">≠</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8801\" entity=\"equiv\" text=\"Identical to\" href=\"javascript:void(false);\">≡</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8712\" entity=\"isin\" text=\"Element of\" href=\"javascript:void(false);\">∈</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8713\" entity=\"notin\" text=\"Not an element of\" href=\"javascript:void(false);\">∉</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8715\" entity=\"ni\" text=\"Contains as member\" href=\"javascript:void(false);\">∋</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8719\" entity=\"prod\" text=\"N-ary product\" href=\"javascript:void(false);\">∏</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8743\" entity=\"and\" text=\"Logical and\" href=\"javascript:void(false);\">∧</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8744\" entity=\"or\" text=\"Logical or\" href=\"javascript:void(false);\">∨</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"172\" entity=\"not\" text=\"Not sign\" href=\"javascript:void(false);\">¬</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8745\" entity=\"cap\" text=\"Intersection\" href=\"javascript:void(false);\">∩</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8746\" entity=\"cup\" text=\"Union\" href=\"javascript:void(false);\">∪</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8706\" entity=\"part\" text=\"Partial differential\" href=\"javascript:void(false);\">∂</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8704\" entity=\"forall\" text=\"For all\" href=\"javascript:void(false);\">∀</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8707\" entity=\"exist\" text=\"There exists\" href=\"javascript:void(false);\">∃</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8709\" entity=\"empty\" text=\"Diameter\" href=\"javascript:void(false);\">∅</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8711\" entity=\"nabla\" text=\"Backward difference\" href=\"javascript:void(false);\">∇</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8727\" entity=\"lowast\" text=\"Asterisk operator\" href=\"javascript:void(false);\">∗</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8733\" entity=\"prop\" text=\"Proportional to\" href=\"javascript:void(false);\">∝</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8736\" entity=\"ang\" text=\"Angle\" href=\"javascript:void(false);\">∠</a>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:CharMap.LabelSymbols}\" class=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"169\" entity=\"copy\" text=\"Copyright\" href=\"javascript:void(false);\">©</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"174\" entity=\"reg\" text=\"Registered\" href=\"javascript:void(false);\">®</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8482\" entity=\"trade\" text=\"Trademark\" href=\"javascript:void(false);\">™</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8240\" entity=\"permil\" text=\"Per Mille\" href=\"javascript:void(false);\">‰</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"181\" entity=\"micro\" text=\"Micro\" href=\"javascript:void(false);\">µ</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"183\" entity=\"middot\" text=\"Middle Dot\" href=\"javascript:void(false);\">·</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8226\" entity=\"bull\" text=\"Bullet\" href=\"javascript:void(false);\">•</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8230\" entity=\"hellip\" text=\"Three Dots\" href=\"javascript:void(false);\">…</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8242\" entity=\"prime\" text=\"Minutes / Feet\" href=\"javascript:void(false);\">′</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8243\" entity=\"Prime\" text=\"Seconds / Inches\" href=\"javascript:void(false);\">″</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"167\" entity=\"sect\" text=\"Section\" href=\"javascript:void(false);\">§</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"182\" entity=\"para\" text=\"Paragraph\" href=\"javascript:void(false);\">¶</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"223\" entity=\"szlig\" text=\"Sharp S / Ess-Zed\" href=\"javascript:void(false);\">ß</a>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:CharMap.LabelArrows}\" class=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8592\" entity=\"larr\" text=\"leftwards arrow\" href=\"javascript:void(false);\">←</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8593\" entity=\"uarr\" text=\"upwards arrow\" href=\"javascript:void(false);\">↑</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8594\" entity=\"rarr\" text=\"rightwards arrow\" href=\"javascript:void(false);\">→</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8595\" entity=\"darr\" text=\"downwards arrow\" href=\"javascript:void(false);\">↓</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8596\" entity=\"harr\" text=\"left right arrow\" href=\"javascript:void(false);\">↔</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8629\" entity=\"crarr\" text=\"carriage return\" href=\"javascript:void(false);\">↵</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8656\" entity=\"lArr\" text=\"leftwards double arrow\" href=\"javascript:void(false);\">⇐</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8657\" entity=\"uArr\" text=\"upwards double arrow\" href=\"javascript:void(false);\">⇑</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8658\" entity=\"rArr\" text=\"rightwards double arrow\" href=\"javascript:void(false);\">⇒</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8659\" entity=\"dArr\" text=\"downwards double arrow\" href=\"javascript:void(false);\">⇓</a>\r\n\t\t\t\t\t\t\t\t\t\t<a code=\"8660\" entity=\"hArr\" text=\"left right double arrow\" href=\"javascript:void(false);\">⇔</a>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t\t<div id=\"selection\">&#160;</div>\r\n\t\t\t</ui:pagebody>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositecharmap/charmap.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|fieldgroup {\r\n    padding-bottom: 20px;\r\n}\r\n\r\nui|field a {\r\n\tdisplay: block;\r\n\tfloat: left;\r\n\tpadding: 3px 0 2px 0;\r\n\ttext-align: center;\r\n\twidth: 22px;\r\n\theight: 22px;\r\n\toverflow: hidden;\r\n\tfont-family: Arial, sans-serif;\r\n\tfont-size: 16px;\r\n}\r\nui|field a:hover {\r\n\tbackground-color: Highlight;\r\n\tcolor: HighlightText;\r\n}\r\ndiv#selection {\r\n\tpadding-top: 0;\r\n\tpadding-bottom: 18px;\r\n\tfont-weight: bold;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositeimage/ImageDialogPageBinding.js",
    "content": "ImageDialogPageBinding.prototype = new TinyDialogPageBinding;\r\nImageDialogPageBinding.prototype.constructor = ImageDialogPageBinding;\r\nImageDialogPageBinding.superclass = TinyDialogPageBinding.prototype;\r\n\r\n/**\r\n* @class\r\n*/\r\nfunction ImageDialogPageBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"ImageDialogPageBinding\");\r\n\r\n\t/**\r\n\t* @type {string}\r\n\t*/\r\n\tthis._tinyAction = null;\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nImageDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ImageDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n* @overloads {PageBinding#setPageArgument}\r\n* @param {object} arg\r\n*/\r\nImageDialogPageBinding.prototype.setPageArgument = function (arg) {\r\n\r\n\tthis._tinyAction = arg.tinyAction;\r\n\tthis.label = this._tinyAction == \"insert\" ? \"${string:Composite.Web.VisualEditor:Image.LabelInsertImage}\" : \"${string:Composite.Web.VisualEditor:Image.LabelImageProperties}\";\r\n\r\n\tImageDialogPageBinding.superclass.setPageArgument.call(this, arg);\r\n}\r\n\r\n/**\r\n* @overloads {DialogPageBinding#onBeforePageIntialize}\r\n*/\r\nImageDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tImageDialogPageBinding.superclass.onBeforePageInitialize.call(this);\r\n\r\n\tthis.addActionListener(UrlInputDialogBinding.URL_SELECTED);\r\n\r\n\tthis._populateClassNameSelector(\"img\");\r\n\tif (this._tinyAction == \"update\") {\r\n\t\tthis._populateDataBindingsFromDOM();\r\n\t}\r\n\tthis._configureFields();\r\n}\r\n\r\n/**\r\n* On \"insert\" action, launch dialog automatically.\r\n* @overloads {DialogPageBinding#onAfterPageIntialize}\r\n*/\r\nImageDialogPageBinding.prototype.onAfterPageInitialize = function () {\r\n\r\n\tif (this._tinyAction == \"insert\") {\r\n\t\tvar dialoginput = this.bindingWindow.DataManager.getDataBinding(\"src\");\r\n\t\tdialoginput.oncommand();\r\n\t}\r\n\r\n\tImageDialogPageBinding.superclass.onAfterPageInitialize.call(this);\r\n}\r\n\r\n/**\r\n* Initialize databindings.\r\n* @overloads {TinyDialogPageBinding#_populateDataBindingsFromDOM}\r\n*/\r\nImageDialogPageBinding.prototype._populateDataBindingsFromDOM = function () {\r\n\r\n\tImageDialogPageBinding.superclass._populateDataBindingsFromDOM.call(this);\r\n\r\n\tvar img = this._tinyElement;\r\n\tvar src = img.getAttribute(\"src\");\r\n\tvar alt = img.getAttribute(\"alt\");\r\n\tvar title = img.getAttribute(\"title\");\r\n\tvar c1PreserveTilde = img.getAttribute(\"c1-preserve-tilde\");\r\n\tvar manager = this.bindingWindow.DataManager;\r\n\r\n\tif (src) {\r\n\t\tif (src.indexOf(\"../../../../..\") > -1) {\r\n\t\t\tsrc = \"~\" + src.substring(src.indexOf(\"../../../../..\") + 14);\r\n\t\t} else if (c1PreserveTilde && src.indexOf(Constants.WEBSITEROOT) === 0) {\r\n\t\t\tsrc = src.replace(Constants.WEBSITEROOT, \"~/\");\r\n\t\t}\r\n\r\n\t\tsrc = src.replace(/%28/g, \"(\").replace(/%29/g, \")\");\r\n\r\n\t\tvar mediaUrl = new Uri(src);\r\n\t\tif (mediaUrl.isMedia) {\r\n\t\t\tif (mediaUrl.hasParam(\"mw\"))\r\n\t\t\t\tmanager.getDataBinding(\"maxwidth\").setValue(mediaUrl.getParam(\"mw\"));\r\n\t\t\tif (mediaUrl.hasParam(\"mh\"))\r\n\t\t\t\tmanager.getDataBinding(\"maxheight\").setValue(mediaUrl.getParam(\"mh\"));\r\n\t\t\tsrc = mediaUrl.getPath();\r\n\t\t}\r\n\r\n\t\tmanager.getDataBinding(\"src\").setValue(src);\r\n\t}\r\n\tif (alt) {\r\n\t\tmanager.getDataBinding(\"alt\").setValue(alt);\r\n\t}\r\n\tif (title) {\r\n\t\tmanager.getDataBinding(\"title\").setValue(title);\r\n\t}\r\n}\r\n\r\n/**\r\n* @implements {IActionListener}\r\n* @overloads {TinyDialogPageBinding#handleAction}\r\n* @param {Action} action\r\n*/\r\nImageDialogPageBinding.prototype.handleAction = function (action) {\r\n\r\n\tImageDialogPageBinding.superclass.handleAction.call(this, action);\r\n\r\n\tswitch (action.type) {\r\n\t\tcase UrlInputDialogBinding.URL_SELECTED:\r\n\t\t\tthis._configureFields();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n* Configure fields\r\n*/\r\nImageDialogPageBinding.prototype._configureFields = function () {\r\n\tvar manager = this.bindingWindow.DataManager;\r\n\tvar src = manager.getDataBinding(\"src\");\r\n\tvar maxwidth = manager.getDataBinding(\"maxwidth\");\r\n\tvar maxheight = manager.getDataBinding(\"maxheight\");\r\n\r\n\tif (maxwidth && maxheight) {\r\n\r\n\t\tif (src.compositeUrl != null && src.compositeUrl.isMedia) {\r\n\t\t\tmaxwidth.setReadOnly(false);\r\n\t\t\tmaxheight.setReadOnly(false);\r\n\t\t} else {\r\n\t\t\tmaxwidth.setReadOnly(true);\r\n\t\t\tmaxheight.setReadOnly(true);\r\n\t\t}\r\n\t}\r\n\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositeimage/image.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Image.Image</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"image.css\"/>\r\n\t\t<script type=\"text/javascript\" src=\"../compositeplugin/TinyDialogPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"ImageDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"ImageDialogPageBinding\"\r\n\t\t\tlabel=\"(label computed)\"\r\n\t\t\timage=\"${icon:image}\" \r\n\t\t\theight=\"auto\"\r\n\t\t\tresizable=\"false\"\r\n\t\t\tclass=\"tabboxed\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t \t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabBasic}\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabAdvanced}\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Image.Source}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:urlinputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"src\" required=\"true\" />\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Image.AlternativeText}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:Image.AlternativeTextToolTip}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"alt\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Image.TitleText}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:Image.TitleTextToolTip}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"title\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputselector id=\"classnameselector\" name=\"classname\" image=\"${icon:editor-classselector}\" emptyentrylabel=\"${string:Composite.Web.VisualEditor:ClassSelector.LabelNone}\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"id\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Image.MaxWidth}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:Image.MaxWidthToolTip}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"maxwidth\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Image.MaxHeight}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:Image.MaxHeightToolTip}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"maxheight\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton id=\"buttonAccept\" label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositeimage/image.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|window#treewindow {\r\n\tborder: 1px solid $(color:threedshadow);\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositelink/LinkDialogPageBinding.js",
    "content": "LinkDialogPageBinding.prototype = new TinyDialogPageBinding;\r\nLinkDialogPageBinding.prototype.constructor = LinkDialogPageBinding;\r\nLinkDialogPageBinding.superclass = TinyDialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction LinkDialogPageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"LinkDialogPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nLinkDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[LinkDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {object} arg\r\n */\r\nLinkDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tLinkDialogPageBinding.superclass.setPageArgument.call ( this, arg );\r\n\tthis.label = this._tinyAction == \"update\" ? \"${string:Composite.Web.VisualEditor:Link.LabelLinkProperties}\" : \"${string:Composite.Web.VisualEditor:Link.LabelInsertLink}\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageIntialize}\r\n */\r\nLinkDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tLinkDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\t\r\n\t//this._populateClassNameSelector ();\r\n\tthis._populateClassNameSelector ( \"a\" );\r\n\tif ( this._tinyAction == \"update\" ) {\r\n\t\tthis._populateDataBindingsFromDOM ();\r\n\t} else {\r\n\t\tvar manager = this.bindingWindow.DataManager;\r\n\t\tmanager.getDataBinding(\"href\").setValue(\"http://\");\r\n\t\tmanager.getDataBinding(\"href\").select();\r\n\t}\r\n}\r\n\r\n/**\r\n * Initialize databindings.\r\n * @overloads {TinyDialogPageBinding#_populateDataBindingsFromDOM}\r\n */\r\nLinkDialogPageBinding.prototype._populateDataBindingsFromDOM = function () {\r\n\t\r\n\tLinkDialogPageBinding.superclass._populateDataBindingsFromDOM.call ( this );\r\n\t\r\n\tvar a = this._tinyElement, manager = this.bindingWindow.DataManager;\r\n\t\r\n\tif ( a.href ) {\r\n\t\tvar href = a.href;\r\n\t\tif ( href.indexOf ( \"tinymce.aspx\" ) >-1 && href.indexOf ( \"#\" ) >-1 ) {\r\n\t\t    href = href.substring(href.indexOf(\"#\"));\r\n\t\t} else if (href.indexOf( \"%7E/\") >-1 ) {\r\n\t\t    href = \"~\" + href.substring(href.indexOf(\"%7E/\")+3);\r\n\t\t} else if ( href.indexOf ( \"~\" ) >-1 ) {\r\n\t\t\thref = href.substring ( href.indexOf ( \"~\" ));\r\n\t\t}\r\n        href = href.replace(/%28/g, \"(\").replace(/%29/g, \")\");\r\n\r\n\t\tmanager.getDataBinding ( \"href\" ).setValue ( href );\r\n\t}\r\n\tif ( a.rel ) {\r\n\t\tmanager.getDataBinding ( \"rel\" ).setValue ( a.rel );\r\n\t}\r\n\tif ( a.title ) {\r\n\t\tmanager.getDataBinding ( \"title\" ).setValue ( a.title );\r\n\t}\r\n\t\r\n\tvar target = a.getAttribute ( \"tinymcetargetalias\" );\r\n\tif ( target &&  target == \"_blank\" ) {\r\n\t\tmanager.getDataBinding ( \"blank\" ).check ( true );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositelink/link.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Link.Link</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"../compositeplugin/TinyDialogPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"LinkDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"LinkDialogPageBinding\"\r\n\t\t\tlabel=\"(label computed)\"\r\n\t\t\timage=\"${icon:link}\" \r\n\t\t\theight=\"auto\"\r\n\t\t\tresizable=\"false\"\r\n\t\t\tclass=\"tabboxed\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t \t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabBasic}\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabAdvanced}\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Link.LinkDestination}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:urlinputdialog type=\"url\" handle=\"Composite.Management.LinkableSelectorDialog\" name=\"href\" required=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Link.LinkRole}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputselector name=\"rel\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Alternate\" tooltip=\"Designates substitute versions for the document in which the link occurs.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Start\" tooltip=\"Refers to the first document in a collection of documents. This link type tells search engines which document is considered by the author to be the starting point of the collection.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Next\" tooltip=\"Refers to the next document in a linear sequence of documents. Browsers may choose to preload the &quot;next&quot; document, to reduce the perceived load time.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Prev\" tooltip=\"Refers to the previous document in an ordered series of documents.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Contents\" tooltip=\"Refers to a document serving as a table of contents.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Index\" tooltip=\"Refers to a document providing an index for the current document.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Glossary\" tooltip=\"Refers to a document providing a glossary of terms that pertain to the current document.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Copyright\" tooltip=\"Refers to a copyright statement for the current document.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Chapter\" tooltip=\"Refers to a document serving as a chapter in a collection of documents.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Section\" tooltip=\"Refers to a document serving as a section in a collection of documents.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Subsection\" tooltip=\"Refers to a document serving as a subsection in a collection of documents.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Appendix\" tooltip=\"Refers to a document serving as an appendix in a collection of documents.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Help\" tooltip=\"Refers to a document offering help (more information, links to other sources information, etc.)\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"Bookmark\" tooltip=\"Refers to a bookmark. A bookmark is a link to a key entry point within an extended document. The title attribute may be used, for example, to label the bookmark. Note that several bookmarks may be defined in each document.\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:datainputselector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Link.TitleText}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:Link.TitleTextToolTip}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"title\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Link.LinkTarget}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"${string:Composite.Web.VisualEditor:Link.LinkTarget.LabelCheckBox}\" name=\"blank\" value=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputselector id=\"classnameselector\" name=\"classname\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"id\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t</ui:pagebody>\t\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton id=\"buttonAccept\" label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t\t\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositeplugin/TinyDialogPageBinding.js",
    "content": "TinyDialogPageBinding.prototype = new DialogPageBinding;\r\nTinyDialogPageBinding.prototype.constructor = TinyDialogPageBinding;\r\nTinyDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * Subclass this to get a standard hold on varios TinyMCE entities.\r\n * @class\r\n */\r\nfunction TinyDialogPageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TinyDialogPageBinding\" );\r\n\t \r\n\t/**\r\n\t * The current action.\r\n\t * @type {string}\r\n\t */\r\n\tthis._tinyAction = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE window.\r\n\t * @type {DOMDocumentView}\r\n\t */\r\n\tthis._tinyWindow = null;\r\n\t\r\n\t/**\r\n\t * The element being edited.\r\n\t * @type {DOMElement}\r\n\t */\r\n\tthis._tinyElement = null;\r\n\t\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {tinymce.EditorManager} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {tinymce.EditorManager} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {tinymce.Theme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\r\n\t/**\r\n\t * The containing binding.\r\n\t * @type {VisualEditorBinding}\r\n\t */\r\n\tthis._tinyEditor = null;\r\n}\r\n\r\n/**\r\n * @param {object} arg\r\n */\r\nTinyDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tTinyDialogPageBinding.superclass.setPageArgument.call ( this, arg );\r\n\t\r\n\tthis._tinyAction \t\t= arg.tinyAction;\r\n\tthis._tinyWindow \t\t= arg.tinyWindow;\r\n\tthis._tinyElement \t\t= arg.tinyElement;\r\n\tthis._tinyEngine \t\t= arg.tinyEngine;\r\n\tthis._tinyInstance \t\t= arg.tinyInstance;\r\n\tthis._tinyTheme \t\t= arg.tinyTheme;\r\n\tthis._editorBinding \t= arg.editorBinding;\r\n}\r\n\r\n/**\r\n * Populate the classname selector.\r\n * @param {string} elementName Optional\r\n */\r\nTinyDialogPageBinding.prototype._populateClassNameSelector = function (elementName) {\r\n\r\n\tvar groups = this._tinyTheme.formatGroups;\r\n\tvar classSelector = this.bindingWindow.bindingMap.classnameselector;\r\n\r\n\tif (classSelector != null) {\r\n\r\n\r\n\t\tvar list = new List();\r\n\t\tgroups.reverse().each(function (group) {\r\n\t\t\tgroup.each(function (format) {\r\n\t\t\t\tif (format.select != null) {\r\n\t\t\t\t\tif (format.props.block == null && format.props.inline == null) {\r\n\t\t\t\t\t\tif (this.canApplyDirect(format.id, elementName)) {\r\n\t\t\t\t\t\t\tlist.add({\r\n\t\t\t\t\t\t\t\tvalue: format.props.classes,\r\n\t\t\t\t\t\t\t\tlabel: format.label,\r\n\t\t\t\t\t\t\t\timage: (format.image != null && format.image != \"\") ? (Constants.CONFIGROOT + format.image) : null\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, this);\r\n\t\t}, this);\r\n\t\tclassSelector.populateFromList(list);\r\n\t}\r\n}\r\n\r\n/**\r\n * Populates the common classname and id databindings.\r\n */\r\nTinyDialogPageBinding.prototype._populateDataBindingsFromDOM = function () {\r\n\t\r\n\tvar manager = this.bindingWindow.DataManager;\r\n\tvar element = this._tinyElement;\r\n\t\r\n\tif ( element.className != \"\" ) {\r\n\t\tvar classSelector = this.bindingWindow.bindingMap.classnameselector;\r\n\t\tif ( classSelector != null ) {\r\n\t\t\tclassSelector.setValue ( \r\n\t\t\t\tVisualEditorBinding.getTinyLessClassName ( element.className )\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif ( element.id ) {\r\n\t\tmanager.getDataBinding ( \"id\" ).setValue ( element.id );\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n* Test is the named TinyMCE format can be applied directly to the current selection.\r\n* A specialization for the formatter.canApply(name) which also include parent elements\r\n* @param {string} formatName\r\n* @param {string} elementName\r\n* @returns {boolean}\r\n*/\r\nTinyDialogPageBinding.prototype.canApplyDirect = function (formatName, elementName) {\r\n\r\n\tvar formatList = this._tinyInstance.formatter.get(formatName), x, selector;\r\n\tvar element = this._tinyElement;\r\n\r\n\r\n\r\n\tif (elementName == null) {\r\n\t\tif (element == null)\r\n\t\t\treturn true;\r\n\r\n\t\tfor (x = formatList.length - 1; x >= 0; x--) {\r\n\t\t\tselector = formatList[x].selector;\r\n\t\t\tif (!selector || this._tinyInstance.dom.is(element, selector)) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tfor (x = formatList.length - 1; x >= 0; x--) {\r\n\t\t\tselector = formatList[x].selector;\r\n\t\t\tif (!selector || selector == elementName) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositesearchandreplace/VisualSearchAndReplace.js",
    "content": "﻿\n\nVisualSearchAndReplace.prototype = new DialogPageBinding;\nVisualSearchAndReplace.prototype.constructor = VisualSearchAndReplace;\nVisualSearchAndReplace.superclass = DialogPageBinding.prototype;\n\nfunction VisualSearchAndReplace() {\n\n    //debugger;    \n    this.logger = SystemLogger.getLogger(\"VisualSearchAndReplace\");\n    this._findText = null;\n    this._replacementText = null;\n    this._caseSensitive = null;\n    this._matchWholeWord = null;\n    this._editor = null;\n    this._searchReplacePlugin = null;\n    this._findTextBox = null;\n    this._replaceTextBox = null;\n    this._caseSensitiveCheckBox = null;\n    this._initialized = false;    \n    this._matchWholeWordCheckbox = null;    \n    this._itemsFound = 0;    \n}\n\nVisualSearchAndReplace.prototype.toString = function () {\n    //debugger;\n    return \"[VisualSearchAndReplace]\";\n}\n\n/**\n* @overloads {SystemTreeBinding#onBindingRegister}\n*/\nVisualSearchAndReplace.prototype.onBindingRegister = function () {\n    VisualSearchAndReplace.superclass.onBindingRegister.call(this);\n}\n\nVisualSearchAndReplace.prototype.setPageArgument = function (arg) {\n    //debugger;\n    VisualSearchAndReplace.superclass.setPageArgument.call(this);\n\n    var self = this;\n\n    this._editor = arg.editor;\n    this._searchReplacePlugin = arg.plugin;\n    this._findText = \"\";\n\n    var selectedText = this._editor.selection.getSel().toString();\n    if (selectedText)\n        this._findText = selectedText;\n\n    this._replacementText = \"\";\n\n    var map = this.bindingWindow.bindingMap;\n\n    /*\n    * Locate key players.\n    */\n    this._findTextBox = map.searchFor;\n\n    self.updateMessage(\"\");\n\n    this._findTextBox.bindingElement.addEventListener(\"change\", function () {\n        self.updateMessage(\"\");\n        self._itemsFound = 0;\n        self.setButtonStates();\n    }); \n\n    this._replaceTextBox = map.replaceWith;\n\n    this._caseSensitiveCheckBox = map.matchCase;\n    this._matchWholeWordCheckbox = map.matchWholeWord;\n\n    this._findTextBox.setValue(this._findText);\n    this._replaceTextBox.setValue(this._replacementText);\n\n    this._initialized = true;\n    \n    this.setButtonStates();\n}\n\nVisualSearchAndReplace.prototype.setButtonStates = function () {\n\n    var map = this.bindingWindow.bindingMap;\n\n    if (this.stateChanged() || this._itemsFound <= 0) {\n        map.broadcasterFind.setDisabled(false);\n        map.broadcasterReplace.setDisabled(true);\n        map.broadcasterReplaceAll.setDisabled(true);\n        map.broadcasterPrev.setDisabled(true);\n        map.broadcasterNext.setDisabled(true);        \n    }\n    else  {\n        map.broadcasterFind.setDisabled(false);\n        map.broadcasterReplace.setDisabled(false);\n        map.broadcasterReplaceAll.setDisabled(false);\n        map.broadcasterPrev.setDisabled(false);\n        map.broadcasterNext.setDisabled(false);\n    }    \n}\n\nVisualSearchAndReplace.prototype.stateChanged = function () {\n    \n    return (this._findTextBox != null && this._findTextBox.getValue() != this._findText) || this.getChecked(this._caseSensitiveCheckBox) !== this._caseSensitive || this.getChecked(this._matchWholeWordCheckbox) !== this._matchWholeWord;\n}\n\nVisualSearchAndReplace.prototype.getChecked = function(control)\n{\n    if (control != null) {\n        if (control.getValue() === true)\n            return true;\n\n        if (control.getValue() == \"on\")\n            return true;\n    }\n    return false;\n}\n\nVisualSearchAndReplace.prototype.handleAction = function (action) {\n\n    VisualSearchAndReplace.superclass.handleAction.call(this, action);\n\n    if (action.type == ButtonBinding.ACTION_COMMAND) {\n\n        var binding = action.target;\n        var id = binding.bindingElement.id;\n\n        this._replacementText = this._replaceTextBox.getValue();\n\n        var foundItem = false;\n\n        switch (id) {\n            case \"buttonFind\":\n                this.findNext();\n                action.consume();\n                break;\n            case \"buttonReplace\":\n                this.replaceText();\n                action.consume();\n                break;\n            case \"buttonReplaceAll\":\n                this.replaceAllFoundText();\n                action.consume();\n                break;\n            case \"buttonNext\":\n                this.moveNext();\n                action.consume();\n                break;\n            case \"buttonPrev\":\n                this.movePrev();\n                action.consume();\n                break;\n        }\n    }\n}\n\n/**\n* Implements {IBroadcastListener}\n* @param {string} broadcast\n* @param {object} arg\n*/\nVisualSearchAndReplace.prototype.handleBroadcast = function (broadcast, arg) {\n\n    VisualSearchAndReplace.superclass.handleBroadcast.call(this, broadcast, arg);\n}\n\nVisualSearchAndReplace.prototype.findNext = function () {\n\n    if (this.stateChanged()) {\n        this.setOptionsFromUserInput();\n\n        var result = this._searchReplacePlugin.find(this._findText, this._caseSensitive, this._matchWholeWord);\n\n        if (result <= 0) {\n            this.updateMessage(StringBundle.getString(\"Composite.Web.VisualEditor\", \"SearchAndReplace.NothingFoundMessage\"));\n        }\n        else {\n            this.updateMessage(result + \" \" + StringBundle.getString(\"Composite.Web.VisualEditor\", \"SearchAndReplace.ItemsWereFoundMessage\"));            \n        }\n\n        this._itemsFound = result;\n        this.setButtonStates();\n    }\n    else {\n        this.moveNext();\n    }\n}\n\nVisualSearchAndReplace.prototype.replaceText = function () {\n\n    this.setOptionsFromUserInput();\n    this._searchReplacePlugin.replace(this._replacementText); \n}\n\nVisualSearchAndReplace.prototype.updateMessage = function (message) {\n    var el = document.getElementById(\"nothingWasFound\");\n    if (el != null)\n        el.innerHTML = message;\n}\n\n\nVisualSearchAndReplace.prototype.replaceAllFoundText = function () {\n\n    this.setOptionsFromUserInput();\n    this._searchReplacePlugin.replace(this._replacementText, true, true);\n}\n\nVisualSearchAndReplace.prototype.moveNext = function () {\n\n    this.setOptionsFromUserInput();\n    this._searchReplacePlugin.next();\n}\n\nVisualSearchAndReplace.prototype.movePrev = function () {\n\n    this.setOptionsFromUserInput();\n    this._searchReplacePlugin.prev();\n}\n\nVisualSearchAndReplace.prototype.setOptionsFromUserInput = function () {\n\n    this._caseSensitive = this.getChecked(this._caseSensitiveCheckBox);\n    this._matchWholeWord = this.getChecked(this._matchWholeWordCheckbox);\n    this._findText = this._findTextBox.getValue();\n    this._replacementText = this._replaceTextBox.getValue();\n    return;\n}\n\nVisualSearchAndReplace.prototype.onBeforePageInitialize = function () {    \n    VisualSearchAndReplace.superclass.onBeforePageInitialize.call(this);\n}\n\nVisualSearchAndReplace.prototype.onDeactivate = function () {\n    this._searchReplacePlugin.done();\n    VisualSearchAndReplace.superclass.onDeactivate.call(this);\n}\n\n\n\n\n\n\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositesearchandreplace/visualsearchandreplace.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\n<%@ Page Language=\"C#\" %>    \n\n\t<control:httpheaders ID=\"Httpheaders1\" runat=\"server\"/>\n\t<head>\n\t\t<title>${string:Composite.Web.VisualEditor:SearchAndReplace.LabelTitle}</title>\n\t\t<control:styleloader runat=\"server\"/>\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\n        <script src=\"VisualSearchAndReplace.js\" type=\"text/javascript\"></script>\n\n        <style>\n            @namespace ui url(http://www.w3.org/1999/xhtml);\n\n            .checkBoxSettings {\n                float: left;\n            }\n\n            .left-label {\n                float: left;\n                margin-right: 20px;\n                width: 100px;\n            }\n\n            .checkBoxSettings ui|datalabeltext {\n                color:#999 !important;\n            }\n\n            ui|checkbox {\n            }\n\n            .found-message {\n                display:block;\n                height: 30px;\n            }\n        </style>\n\n\t</head>\n\t<body>        \n        <ui:broadcasterset>\n            <ui:broadcaster id=\"broadcasterFind\" isdisabled=\"false\"/>\n            <ui:broadcaster id=\"broadcasterReplace\" isdisabled=\"false\"/>\n            <ui:broadcaster id=\"broadcasterReplaceAll\" isdisabled=\"false\"/>                \n            <ui:broadcaster id=\"broadcasterPrev\" isdisabled=\"false\"/>\n            <ui:broadcaster id=\"broadcasterNext\" isdisabled=\"false\"/>            \n\t\t</ui:broadcasterset>\n\t\t<ui:dialogpage \n            label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.LabelTitle}\" \n            image=\"${icon:composite}\" \n            height=\"auto\" \n            resizable=\"false\"             \n            binding=\"VisualSearchAndReplace\">\n            <ui:pagebody>                \n\t\t\t\t<ui:flexbox>                    \n                    <ui:fields>\n                        <ui:fieldgroup>                            \n                            <ui:field>\n                                <ui:fielddesc class=\"left-label\" label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.LabelFind}\"/>                            \n                                <ui:fielddata>  \n                                    <ui:datainput id=\"searchFor\" default=\"true\">\n                                    </ui:datainput>\n                                </ui:fielddata>\n                            </ui:field>\n                            <ui:field>\n                                <ui:fielddesc class=\"left-label\" label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.LabelReplaceWith}\"/>\n                                <ui:fielddata>\n                                    <ui:datainput id=\"replaceWith\"></ui:datainput>\n                                </ui:fielddata>\n                            </ui:field>\n                        </ui:fieldgroup>\n                    </ui:fields>\n                    <div>\n                        <div class=\"checkBoxSettings\">\n                            <ui:field>\n                                <!--<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.LabelWholeWords}\"/>-->\n                                <ui:fielddata>\n                                    <ui:checkbox label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.LabelWholeWords}\" id=\"matchWholeWord\"></ui:checkbox>\n                                </ui:fielddata>                                \n                            </ui:field>\n                        </div>\n                        <div class=\"checkBoxSettings\">\n                            <ui:field>\n                                <!--<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.LabelMatchCase}\"/>-->\n                                <ui:fielddata>\n                                    <ui:checkbox label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.LabelMatchCase}\" id=\"matchCase\"></ui:checkbox>\n                                </ui:fielddata>\n                            </ui:field>\n                        </div>\n                    </div>  \n                    <div style=\"clear:both\"></div>\n                    <div class=\"found-message\">\n                        <label id=\"nothingWasFound\"></label>                            \n                    </div>\n                </ui:flexbox>\t\t\t\t\t\t                   \n            </ui:pagebody>          \n\t\t\t<ui:dialogtoolbar>\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\n\t\t\t\t\t<ui:toolbargroup>                        \n                        <ui:clickbutton id=\"buttonFind\" label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.ButtonFind}\" focusable=\"true\" observes=\"broadcasterFind\" />\n                        <ui:clickbutton id=\"buttonReplace\" label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.ButtonReplace}\" focusable=\"true\" observes=\"broadcasterReplace\" />\n                        <ui:clickbutton id=\"buttonReplaceAll\" label=\"${string:Composite.Web.VisualEditor:SearchAndReplace.ButtonReplaceAll}\" focusable=\"true\" observes=\"broadcasterReplaceAll\"/>\n\t\t\t\t\t</ui:toolbargroup>\n\t\t\t\t</ui:toolbarbody>\n\t\t\t</ui:dialogtoolbar>            \n\t\t</ui:dialogpage>        \n\t</body>\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetable/TableCellDialogPageBinding.js",
    "content": "TableCellDialogPageBinding.prototype = new TinyDialogPageBinding;\r\nTableCellDialogPageBinding.prototype.constructor = TableCellDialogPageBinding;\r\nTableCellDialogPageBinding.superclass = TinyDialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TableCellDialogPageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TableCellDialogPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTableCellDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TableCellDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageIntialize}\r\n */\r\nTableCellDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tthis._populateClassNameSelector ();\r\n\tthis._populateDataBindingsFromDOM ();\r\n\t\r\n\tTableCellDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Initialize databindings.\r\n * @overloads {TinyDialogPageBinding#_populateDataBindingsFromDOM}\r\n */\r\nTableCellDialogPageBinding.prototype._populateDataBindingsFromDOM = function () {\r\n\t\r\n\tTableCellDialogPageBinding.superclass._populateDataBindingsFromDOM.call ( this );\r\n\t\r\n\tvar td = this._tinyElement;\r\n\tvar manager = this.bindingWindow.DataManager;\r\n\t\r\n\tmanager.getDataBinding ( \"cellType\" ).selectByValue ( \r\n\t\tDOMUtil.getLocalName ( td ),\r\n\t\ttrue\r\n\t);\r\n\tif ( td.getAttribute ( \"width\" )) {\r\n\t\tmanager.getDataBinding ( \"width\" ).setValue ( td.width );\r\n\t}\r\n\tif ( td.getAttribute ( \"align\" )) {\r\n\t\tmanager.getDataBinding ( \"align\" ).selectByValue ( td.align );\r\n\t}\r\n\tif ( td.getAttribute ( \"valign\" )) {\r\n\t\tmanager.getDataBinding ( \"valign\" ).selectByValue ( td.valign );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetable/TableDialogPageBinding.js",
    "content": "TableDialogPageBinding.prototype = new TinyDialogPageBinding;\r\nTableDialogPageBinding.prototype.constructor = TableDialogPageBinding;\r\nTableDialogPageBinding.superclass = TinyDialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TableDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TableDialogPageBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._tinyAction = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTableDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TableDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nTableDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tthis._tinyAction = this.pageArgument.tinyAction;\r\n\t//this._populateClassNameSelector ();\r\n\tthis._populateClassNameSelector ( \"table\" );\r\n\tthis._invokeInsertVersusUpdateLayout ();\r\n\t\r\n\tTableDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Same dialog is used for both \"insert\" and \"update\" table.\r\n */\r\nTableDialogPageBinding.prototype._invokeInsertVersusUpdateLayout = function () {\r\n\t\r\n\tif ( this._tinyAction == \"update\" ) {\r\n\t\tthis.label = StringBundle.getString ( \"Composite.Web.VisualEditor\", \"Tables.Table.TitleUpdate\" );\r\n\t\tthis._populateDataBindingsFromDOM ();\r\n\t} else {\r\n\t\tthis.label = StringBundle.getString ( \"Composite.Web.VisualEditor\", \"Tables.Table.TitleInsert\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Initialize databindings (only  in update scenario}.\r\n * @overloads {TinyDialogPageBinding#_populateDataBindingsFromDOM}\r\n */\r\nTableDialogPageBinding.prototype._populateDataBindingsFromDOM = function () {\r\n\t\r\n\tTableDialogPageBinding.superclass._populateDataBindingsFromDOM.call ( this );\r\n\t\r\n\tvar docManager = this.bindingWindow.DataManager;\r\n\tvar table = this._tinyElement;\r\n\t\r\n\tvar layoutFieldGroupBinding = UserInterface.getBinding ( \r\n\t\tthis.bindingDocument.getElementById ( \"layoutfieldgroup\" )\r\n\t);\r\n\tif ( layoutFieldGroupBinding ) {\r\n\t\tlayoutFieldGroupBinding.hide ();\r\n\t}\r\n\tif ( table.summary ) {\r\n\t\tdocManager.getDataBinding ( \"summary\" ).setValue ( table.summary );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetable/TableMergeCellsDialogPageBinding.js",
    "content": "TableMergeCellsDialogPageBinding.prototype = new TinyDialogPageBinding;\r\nTableMergeCellsDialogPageBinding.prototype.constructor = TableMergeCellsDialogPageBinding;\r\nTableMergeCellsDialogPageBinding.superclass = TinyDialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TableMergeCellsDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TableMergeCellsDialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis._layout = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTableMergeCellsDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TableMergeCellsDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @param {object} arg\r\n */\r\nTableMergeCellsDialogPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tTableMergeCellsDialogPageBinding.superclass.setPageArgument.call ( this, arg );\r\n\t\r\n\tthis._layout = arg;\r\n}\r\n\r\n/**\r\n * overloads {DialogPageBinding#onBeforePageIntialize}\r\n */\r\nTableMergeCellsDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tvar manager = this.bindingWindow.DataManager;\r\n\t\r\n\tif ( this._layout.numcols ) {\r\n\t\tmanager.getDataBinding ( \"numcols\" ).setValue ( this._layout.numcols );\r\n\t}\r\n\tif ( this._layout.numrows ) {\r\n\t\tmanager.getDataBinding ( \"numrows\" ).setValue ( this._layout.numrows );\r\n\t}\r\n\t\r\n\tTableMergeCellsDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetable/TableRowDialogPageBinding.js",
    "content": "TableRowDialogPageBinding.prototype = new TinyDialogPageBinding;\r\nTableRowDialogPageBinding.prototype.constructor = TableRowDialogPageBinding;\r\nTableRowDialogPageBinding.superclass = TinyDialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TableRowDialogPageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TableRowDialogPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTableRowDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TableRowDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nTableRowDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tTableRowDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\t\r\n\tthis._populateClassNameSelector ();\r\n\tthis._populateDataBindingsFromDOM ();\r\n}\r\n\r\n/**\r\n * Initialize databindings.\r\n * @overloads {TinyDialogPageBinding#_populateDataBindingsFromDOM}\r\n */\r\nTableRowDialogPageBinding.prototype._populateDataBindingsFromDOM = function () {\r\n\t\r\n\tTableRowDialogPageBinding.superclass._populateDataBindingsFromDOM.call ( this );\r\n\t\r\n\tvar manager = this.bindingWindow.DataManager;\r\n\tvar tr = this._tinyElement;\r\n\r\n\tvar rowtype = manager.getDataBinding ( \"rowtype\" );\r\n\tvar position = DOMUtil.getLocalName ( tr.parentNode );\r\n\trowtype.selectByValue ( position, true );\r\n\t\r\n\tif ( tr.getAttribute ( \"align\" )) {\r\n\t\tmanager.getDataBinding ( \"align\" ).selectByValue ( tr.align );\r\n\t}\r\n\tif ( tr.getAttribute ( \"valign\" )) {\r\n\t\tmanager.getDataBinding ( \"valign\" ).selectByValue ( tr.valign );\r\n\t}\r\n\t\r\n\tvar selector = DataManager.getDataBinding ( \"rowtype\" );\r\n\tswitch ( tr.parentNode.nodeName.toLowerCase ()) {\r\n\t\tcase \"thead\" :\r\n\t\t\tselector.selectByValue ( \"thead\" );\r\n\t\t\tbreak;\r\n\t\tcase \"tfoot\" :\r\n\t\t\tselector.selectByValue ( \"tfoot\" );\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetable/cell.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Tables.Cell</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\" src=\"../compositeplugin/TinyDialogPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"TableCellDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"TableCellDialogPageBinding\"\r\n\t\t\tlabel=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelCellProperties}\" \r\n\t\t\timage=\"${icon:fields}\" \r\n\t\t\theight=\"auto\"\r\n\t\t\tclass=\"tabboxed\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t \t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabBasic}\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabAdvanced}\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Cell.CellType}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"cellType\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelDataCell}\" value=\"td\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelHeaderCell}\" value=\"th\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelWidth}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"width\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Cell.HorizontalAlignment}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"align\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"(default)\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelLeft}\" value=\"left\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelCenter}\" value=\"center\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelRight}\" value=\"right\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Cell.VerticalAlignment}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"valign\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"(default)\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelTop}\" value=\"top\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelCenter}\" value=\"middle\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelBottom}\" value=\"bottom\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputselector id=\"classnameselector\" name=\"classname\" image=\"${icon:editor-classselector}\" emptyentrylabel=\"${string:Composite.Web.VisualEditor:ClassSelector.LabelNone}\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelScope}\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Cell.ApplyTo}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"action\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelCurrentCell}\" value=\"cell\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelAllRowCells}\" value=\"row\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Cell.LabelAllTableCells}\" value=\"all\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"id\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t</ui:pagebody>\t\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetable/merge.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Tables.Merge</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\" src=\"../compositeplugin/TinyDialogPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"TableMergeCellsDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"TableMergeCellsDialogPageBinding\"\r\n\t\t\tlabel=\"${string:Composite.Web.VisualEditor:Tables.Merge.LabelMergeCells}\" \r\n\t\t\timage=\"${skin}/wysiwygeditor/table_merge_cells.png\" \r\n\t\t\theight=\"auto\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:fields>\r\n\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:Tables.Merge.LabelMergeCells}\">\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Merge.Columns}\"/>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput name=\"numcols\" value=\"1\" required=\"true\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Merge.Rows}\"/>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput name=\"numrows\" value=\"1\" required=\"true\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetable/row.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Tables.Row</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\" src=\"../compositeplugin/TinyDialogPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"TableRowDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"TableRowDialogPageBinding\"\r\n\t\t\tlabel=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelRowProperties}\" \r\n\t\t\timage=\"${icon:fields}\" \r\n\t\t\theight=\"auto\"\r\n\t\t\tclass=\"tabboxed\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t \t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabBasic}\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabAdvanced}\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Row.Rows}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"rowtype\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelTableHead}\" value=\"thead\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelTableBody}\" value=\"tbody\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelTableFoot}\" value=\"tfoot\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Row.HorizontalAlignment}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"align\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"(default)\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelLeft}\" value=\"left\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelCenter}\" value=\"center\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelRight}\" value=\"right\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Row.VerticalAlignment}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"valign\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"(default)\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelTop}\" value=\"top\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelCenter}\" value=\"middle\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelBottom}\" value=\"bottom\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputselector id=\"classnameselector\" name=\"classname\" image=\"${icon:editor-classselector}\" emptyentrylabel=\"${string:Composite.Web.VisualEditor:ClassSelector.LabelNone}\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t    </ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelScope}\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Row.ApplyTo}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"action\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelCurrentRow}\" value=\"row\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelOddRows}\" value=\"odd\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelEvenRows}\" value=\"even\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"${string:Composite.Web.VisualEditor:Tables.Row.LabelAllRows}\" value=\"all\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t <ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"id\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t</ui:pagebody>\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetable/table.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Tables.Table</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\" src=\"../compositeplugin/TinyDialogPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"TableDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"TableDialogPageBinding\"\r\n\t\t\tlabel=\"(label computed)\" \r\n\t\t\timage=\"${icon:table}\" \r\n\t\t\theight=\"auto\"\r\n\t\t\tclass=\"tabboxed\">\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t \t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabBasic}\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"${string:Composite.Web.VisualEditor:LabelTabAdvanced}\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup id=\"layoutfieldgroup\" label=\"${string:Composite.Web.VisualEditor:Tables.Table.LabelLayout}\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Table.Columns}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput type=\"integer\" required=\"true\" name=\"cols\" value=\"2\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Table.Rows}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput type=\"integer\" required=\"true\" name=\"rows\" value=\"2\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"${string:Composite.Web.VisualEditor:Tables.Table.LabelMeta}\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:Tables.Table.Summary}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:Tables.Table.SummaryHelp}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"summary\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpClass}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputselector id=\"classnameselector\" name=\"classname\" image=\"${icon:editor-classselector}\" emptyentrylabel=\"${string:Composite.Web.VisualEditor:ClassSelector.LabelNone}\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc label=\"${string:Composite.Web.VisualEditor:LabelId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp label=\"${string:Composite.Web.VisualEditor:HelpId}\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"id\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody id=\"dialogtoolbarbody\" align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" id=\"buttonAccept\" response=\"accept\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetext/TextDialogPageBinding.js",
    "content": "TextDialogPageBinding.prototype = new DialogPageBinding;\r\nTextDialogPageBinding.prototype.constructor = TextDialogPageBinding;\r\nTextDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TextDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TextDialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._defaulttext = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTextDialogPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[TextDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onBeforePageInitialize}\r\n */\r\nTextDialogPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tthis._defaulttext = this.bindingWindow.bindingMap.text.getResult ();\r\n\tTextDialogPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {DialogPageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nTextDialogPageBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tTextDialogPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase Binding.ACTION_DIRTY :\r\n\t\t\tbindingMap.buttonAccept.enable ();\r\n\t\t\tbindingMap.buttonAccept.focus ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Cleanup editor content and assing to dialogpage as result.\r\n * @overwrites {DialogPageBinding#onDialogAccept}\r\n */\r\nTextDialogPageBinding.prototype.onDialogAccept = function () {\r\n\t\r\n\tvar text = this.bindingWindow.bindingMap.text.getResult ();\r\n\tif ( text != this._defaulttext ) {\r\n\t\t\r\n\t\tvar result = \"\";\r\n\t\tvar BULLET = \"* \";\r\n\t\tvar lines = new List ( text.split ( \"\\n\" ));\r\n\t\t\r\n\t\tlines.each ( function ( line ) {\r\n\t\t\t\r\n\t\t\t// remove leading whitespace\r\n\t\t\tline = line.replace( /^(\\s)*/, \"\" );\r\n\t\t\t\r\n\t\t\t// allow paste of HTML stuff (move this somewhere else?)\r\n\t\t\tline = line.replace( /\\&/, \"&amp;\" );\r\n\t\t\tline = line.replace( /\\</, \"&lt;\" );\r\n\t\t\tline = line.replace( /\\>/, \"&gt;\" );\r\n\t\t\tline = line.replace( /\\\"/, \"&quot;\" );\r\n\r\n\t\t\t// ditch bullets\r\n\t\t\tif ( line.length >= 2 && line.substring ( 0, 2 ) == BULLET ) {\r\n\t\t\t\tline = line.substring ( 2, line.length );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// wrap in paragraph...\r\n\t\t\tif ( line.length > 0 ) {\r\n\t\t\t\tresult += \"<p>\" + line + \"</p>\\n\";\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tthis.result = result;\r\n\t} else {\r\n\t\tthis.result = null;\r\n\t}\r\n\t\r\n\tthis.onDialogResponse ();\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetext/text.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<%@ Page Language=\"C#\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Dialogs.WysiwygEditor.Text</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"text.css.aspx\"/>\r\n\t\t<script type=\"text/javascript\" src=\"TextDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage binding=\"TextDialogPageBinding\"\r\n\t\t\tlabel=\"${string:Composite.Web.VisualEditor:TextPaste.Label}\" \r\n\t\t\timage=\"${icon:page}\" \r\n\t\t\theight=\"300\"\r\n\t\t\tresizable=\"true\">\r\n\t\t\t\r\n\t\t\t<ui:pagebody>\r\n\t\t\t\t<ui:flexbox>\r\n\t\t\t\t\t<ui:editortextbox id=\"text\" autoselect=\"true\">\r\n\t\t\t\t\t\t<textarea><%= Composite.Core.ResourceSystem.StringResourceSystemFacade.GetString(\"Composite.Web.VisualEditor\",\"TextPaste.PasteHereContent\") %></textarea>\r\n\t\t\t\t\t</ui:editortextbox>\r\n\t\t\t\t</ui:flexbox>\r\n\t\t\t</ui:pagebody>\r\n\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton id=\"buttonAccept\" label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" focusable=\"true\" isdisabled=\"true\"/>\r\n\t\t\t\t\t\t<ui:clickbutton id=\"buttonCancel\" label=\"${string:Website.Dialogs.LabelCancel}\" response=\"cancel\" focusable=\"true\" default=\"true\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce/plugins/compositetext/text.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|pagebody {\r\n\theight: 150px;\r\n}\r\nui|editortextbox#text {\r\n\tborder: 1px solid $(color:threedshadow);\t\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/tinymce.aspx",
    "content": "<%@ Page Language=\"C#\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\t<title>TinyMCE</title>\r\n\t<script type=\"text/javascript\">\r\n\t\ttop.Application.declareTopLocal(window);\r\n\t</script>\r\n\t<script type=\"text/javascript\" src=\"tinymce/tinymce.min.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"scripts/Format.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"visualeditor.js\"></script>\r\n\t<script runat=\"server\" language=\"c#\">\r\n\t\tprotected void Page_PreRender(object sender, EventArgs e)\r\n\t\t{\r\n\t\t\tResponse.AddHeader(\"Content-Type\", \"text/html; charset=utf-8\");\r\n\t\t}\r\n\t</script>\r\n\t<style type=\"text/css\">\r\n\t\thtml,\r\n\t\tbody {\r\n\t\t\tborder: none;\r\n\t\t}\r\n\r\n\t\tbody {\r\n\t\t\tbackground-color: white;\r\n\t\t\toverflow: hidden;\r\n\t\t\tmargin: 0;\r\n\t\t\tpadding: 0;\r\n\t\t}\r\n\t</style>\r\n</head>\r\n<body>\r\n\t<textarea id=\"editor\" name=\"editor\" style=\"width: 100%; height: 100%;\"></textarea>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/visualeditor.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<%@ Page Language=\"C#\"%>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.WysiwygEditor</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"visualeditor.css.aspx\"/>\r\n\r\n\t\t<script type=\"text/javascript\" src=\"bindings/VisualEditorPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/VisualEditorBoxBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/VisualEditorToolBarBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/VisualEditorSimpleToolBarBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/VisualEditorStatusBarBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/FormatSelectorBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/ClassNameSelectorBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/BlockSelectorBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/VisualEditorInsertToolbarButtonBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/VisualEditorInsertPlusFieldsToolBarButtonBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/VisualEditorPropertiesToolBarGroupBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"bindings/TemplateTreeBinding.js\"></script>\r\n\r\n\t\t<ui:bindingmappingset>\r\n\t\t\t<ui:bindingmapping element=\"ui:toolbarbutton\" binding=\"EditorToolBarButtonBinding\" />\r\n\t\t\t<ui:bindingmapping element=\"ui:selector\" binding=\"EditorSelectorBinding\" />\r\n\t\t</ui:bindingmappingset>\r\n\r\n\t\t<ui:broadcasterset>\r\n\t\t\t<ui:broadcaster id=\"broadcasterIsActive\" isdisabled=\"true\" />\r\n\t\t\t<ui:broadcaster id=\"broadcasterCanUndo\" isdisabled=\"true\" />\r\n\t\t\t<ui:broadcaster id=\"broadcasterCanRedo\" isdisabled=\"true\" />\r\n\t\t</ui:broadcasterset>\r\n\r\n\t</head>\r\n\t<body>\r\n\r\n\t\t<ui:popupset>\r\n\t\t\t<ui:popup id=\"pastepopup\">\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup rel=\"insertions\">\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertText\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAsText}\" image=\"${icon:page}\" binding=\"EditorMenuItemBinding\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:popup>\r\n\t\t\t<ui:popup id=\"insertpopup\">\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup rel=\"insertions\">\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertTable\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelTable}\" image=\"${icon:table}\" binding=\"EditorMenuItemBinding\" />\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertImage\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelImage}\" image=\"${icon:image}\" binding=\"EditorMenuItemBinding\" />\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertComponent\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelComponent}\" image=\"${icon:functioncall}\" binding=\"EditorMenuItemBinding\" />\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertRendering\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelRendering}\" image=\"${icon:functioncall}\" binding=\"EditorMenuItemBinding\" />\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertCharacter\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelCharacter}\" image=\"${icon:specialchar}\" binding=\"EditorMenuItemBinding\" />\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertFieldParent\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelField}\" image=\"${icon:field}\" image-disabled=\"${icon:field-disabled}\" binding=\"EditorMenuItemBinding\" isdisabled=\"true\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:popup>\r\n\t\t</ui:popupset>\r\n\r\n\t\t<!-- editor gets blurred by focusing this -->\r\n\t\t<input id=\"focusableinput\" type=\"text\" />\r\n\r\n\t\t<!-- notice that this page is not a focusmanager! -->\r\n\t\t<ui:page id=\"editorpage\" binding=\"VisualEditorPageBinding\" observes=\"broadcasterIsActive\" focusmanager=\"false\"> <!-- fitasdialogsubpage=\"false\" -->\r\n\t\t\t<ui:splitbox id=\"visualeditorsplitbox\" orient=\"horizontal\" layout=\"3:1\" persist=\"layout\">\r\n\t\t\t\t<ui:splitpanel id=\"editorsplitpanel\">\r\n\t\t\t\t\t<ui:decks id=\"decks\">\r\n\t\t\t\t\t\t<ui:deck id=\"designdeck\">\r\n\t\t\t\t\t\t\t<ui:box id=\"toolbarsbox\" binding=\"VisualEditorBoxBinding\">\r\n\t\t\t\t\t\t\t\t<ui:cover id=\"toolbarscover\" busy=\"false\"/>\r\n\t\t\t\t\t\t\t\t<ui:toolbar id=\"toolbar\" class=\"visualeditor-toolbar btns-group\" binding=\"VisualEditorSimpleToolBarBinding\" observes=\"broadcasterIsActive\">\r\n\t\t\t\t\t\t\t\t\t<% Response.WriteFile ( \"includes/toolbarsimple.inc\" ); %>\r\n\t\t\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t\t\t<ui:toolbar id=\"advancedtoolbar\" class=\"visualeditor-adv-toolbar\" binding=\"VisualEditorToolBarBinding\">\r\n\t\t\t\t\t\t\t\t\t<% Response.WriteFile ( \"includes/toolbaradvanced.inc\" ); %>\r\n\t\t\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t\t</ui:box>\r\n\t\t\t\t\t\t\t<ui:flexbox id=\"tinyflexbox\">\r\n\t\t\t\t\t\t\t\t<ui:window id=\"tinywindow\" url=\"tinymce.aspx?config=<%= Request.QueryString [ \"config\" ] %>\"/>\r\n\t\t\t\t\t\t\t\t<ui:cover id=\"tinycover\" busy=\"false\"/>\r\n\t\t\t\t\t\t\t</ui:flexbox>\r\n\t\t\t\t\t\t\t<ui:toolbar id=\"statusbar\" binding=\"VisualEditorStatusBarBinding\" observes=\"broadcasterIsActive\" class=\"statusbar dark\">\r\n\t\t\t\t\t\t\t\t<ui:toolbarbody />\r\n\t\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t\t<ui:deck id=\"sourcedeck\" lazy=\"true\">\r\n\t\t\t\t\t\t\t<ui:cover id=\"sourcecover\" busy=\"true\"/>\r\n\t\t\t\t\t\t\t<ui:sourceeditor id=\"sourcecodeeditor\" syntax=\"html\" validate=\"true\" embedded=\"true\" />\r\n\t\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t</ui:decks>\r\n\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t<ui:splitter id=\"toolsplitter\" collapse=\"after\" collapsed=\"true\" />\r\n\t\t\t\t<ui:splitpanel id=\"toolsplitpanel\">\r\n\t\t\t\t\t<ui:toolbar id=\"templatetoolbar\" class=\"pagetemplates-toolbar\" hidden=\"true\">\r\n\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:selector id=\"templateselector\" editorcontrol=\"false\" />\r\n\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t<ui:tree id=\"templatetree\" binding=\"TemplateTreeBinding\" selectable=\"true\" selectionproperty=\"placeholder\">\r\n\t\t\t\t\t\t<ui:treebody />\r\n\t\t\t\t\t</ui:tree>\r\n\t\t\t\t</ui:splitpanel>\r\n\t\t\t</ui:splitbox>\r\n\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/visualeditor.css",
    "content": "@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n\r\nui|box {\r\n\tposition: relative;\r\n}\r\n\r\nui|cover#toolbarscover {\r\n\tborder-top: 1px solid #fff;\r\n\tborder-bottom: 1px solid #ddd;\r\n}\r\nui|flexbox#tinyflexbox {\r\n\tposition: relative; /* contain the cover */\t\r\n}\r\nui|splitpanel#editorsplitpanel {\r\n\tborder-right: 1px solid #ddd;\t\r\n}\r\n\r\ninput#focusableinput { /* synchronize with sourcecodeeditor.css */\r\n\tbackground-color: transparent;\r\n\tborder: none;\r\n\tposition: absolute;\r\n\tbottom: 0;\r\n\tright: 0;\r\n\tdisplay: none;\r\n\tcursor: help;\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/misc/editors/visualeditor/visualeditor.js",
    "content": "/*\r\n * TinyMCE initialization.\r\n */\r\nvar config = {\r\n\r\n\tmode : \"exact\",\r\n\telements : \"editor\",\r\n\ttheme : \"composite\",\r\n\tbrowsers : \"msie,gecko\",\r\n\tplugins: \"autolink,composite,compositelink,table,compositetable,compositeimage,compositerendering,compositecharmap,compositefield,compositetext,compositespellcheck,compositeimageresize,compositecomponent,paste,lists,searchreplace,compositesearchandreplace\",\r\n\tentity_encoding : \"raw\",\r\n\tconvert_fonts_to_spans : false,\r\n\tapply_source_formatting : false,\r\n\tfix_list_elements : false,\r\n\tfix_table_elements : false,\r\n\tconvert_newlines_to_brs : false,\r\n\tforce_p_newlines : true,\r\n\tforce_br_newlines: false,\r\n\tforced_root_block: '',\r\n\tvisual : true,\r\n\tobject_resizing: Client.isExplorer,\r\n\tauto_reset_designmode : true,\r\n\tlist_outdent_on_enter: true,\r\n\tnoneditable_leave_contenteditable: true,\r\n\tinit_instance_callback: onInstanceInitialize,\r\n\tsetup: function (editor) {\r\n\t\teditor.on('PreInit', function (e) {\r\n\t\t\tvar ed = e.target;\r\n\r\n\t\t\tif (Localization.isRtl)\r\n\t\t\t{\r\n\t\t\t\ted.getBody().setAttribute(\"dir\", \"rtl\");\r\n\t\t\t}\r\n\r\n\t\t\tvar blockElementsMap = ed.schema.getBlockElements();\r\n\t\t\ted.dom.isBlock = function (node) {\r\n\t\t\t\t// Fix for #5446\r\n\t\t\t\tif (!node) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (ed.formatter.functionIsBlock) {\r\n\t\t\t\t\tif (node.nodeName && node.nodeName.toLowerCase() == \"img\" && ed.dom.hasClass(node, \"compositeFunctionWysiwygRepresentation\")) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// This function is called in module pattern style since it might be executed with the wrong this scope\r\n\t\t\t\tvar type = node.nodeType;\r\n\r\n\t\t\t\t// If it's a node then check the type and use the nodeName\r\n\t\t\t\tif (type) {\r\n\t\t\t\t\treturn !!(type === 1 && blockElementsMap[node.nodeName]);\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\treturn !!blockElementsMap[node];\r\n\t\t\t};\r\n\t\t\t//ReInit Formatter with our isBlock;\r\n\t\t\ted.formatter = new tinyMCE.Formatter(ed);\r\n\t\t\ted.formatter.functionIsBlock = false;\r\n\t\t});\r\n\t}\r\n};\r\n\r\n/*\r\n * Load configuration.\r\n */\r\nvar conf = \"common\";\r\n\r\nvar editorpath = window.location.toString();\r\nvar configParam = /[\\?&]config=([^&#]*)/.exec(window.location.search);\r\nif (configParam != null) {\r\n\tconf = configParam[1];\r\n}\r\nvar sitepath = editorpath.substring(0, editorpath.toLowerCase().indexOf(\"/composite/content/\"));\r\nvar relconfigpath = \"/Composite/services/WysiwygEditor/getconfig.ashx?name=\" + conf;\r\nvar url = sitepath + relconfigpath;\r\n\r\nvar request = DOMUtil.getXMLHTTPRequest ();\r\nrequest.open ( \"get\", url, false );\r\nrequest.send ( null );\r\n\r\nvar doc = request.responseXML;\r\nif ( doc == null ) {\r\n\tdoc = document.createElement(\"div\");\r\n}\r\n\r\nvar groups = new List ();\r\nvar formats = {};\r\n\r\n/*\r\n * Setup formats.\r\n */\r\nvar elements = new List ( doc.getElementsByTagName ( \"group\" ))\r\n\t.merge ( new List ( doc.getElementsByTagName ( \"radiogroup\" )));\r\n\r\nelements.each ( function ( el ) {\r\n\tvar group = new List ();\r\n\tnew List ( el.getElementsByTagName ( \"format\" )).each ( function ( element ) {\r\n\t\tvar format = new Format ( element );\r\n\t\tformats [ format.id ] = format.props;\r\n\t\tgroup.add ( format );\r\n\t});\r\n\tgroups.add ( group );\r\n});\r\n\r\nif (Client.isExplorer || Client.isExplorer11) {\r\n\tconfig.content_css = \"ie.css\";\r\n}\r\n\r\n/*\r\n * Preload plugins\r\n */\r\n\r\nvar plugins = config.plugins.split(',');\r\nvar loadedPlugins = [];\r\nfor (var i = 0, length = plugins.length; i < length; i++) {\r\n\tvar plugin = plugins[i];\r\n\twindow.tinyMCE.PluginManager.load(plugin, sitepath + \"/Composite/content/misc/editors/visualeditor/tinymce/plugins/\" + plugin + \"/plugin.min.js?c1=\" + Installation.versionString);\r\n\tloadedPlugins.push(\"-\" + plugin);\r\n}\r\nconfig.plugins = loadedPlugins.join(\",\");\r\n\r\n/*\r\n * Preload theme\r\n */\r\nwindow.tinyMCE.ThemeManager.load(config.theme, sitepath + \"/Composite/content/misc/editors/visualeditor/tinymce/themes/\" + config.theme + \"/theme.min.js?c1=\" + Installation.versionString);\r\nconfig.theme = \"-\" + config.theme;\r\n\r\n\r\n/*\r\n * Init TinyMCE.\r\n */\r\nconfig.formats = formats;\r\nwindow.tinyMCE.init ( config );\r\n\r\n/**\r\n * Used by plugins.\r\n * @param {string} attrib\r\n * @param {string} value\r\n * @return {string}\r\n */\r\nfunction makeAttrib ( attrib, value ) {\r\n\tvar res = \"\";\r\n\tif (value) {\r\n\t\tres = res + value;\r\n\t\tres = res.replace(/&/g, '&amp;');\r\n\t\tres = res.replace(/\\\"/g, '&quot;');\r\n\t\tres = res.replace(/</g, '&lt;');\r\n\t\tres = res.replace(/>/g, '&gt;');\r\n\t\tres = ' ' + attrib + '=\"' + res + '\"';\r\n\t}\r\n\treturn res;\r\n}\r\n\r\n\r\n// ...........................................................................\r\n\r\n/** @type {TinyMCE_Engine} */\r\nvar tinyEngine = null;\r\n\r\n/** @type {tinymce.Editor} */\r\nvar tinyInstance = null;\r\n\r\n/** @type {tinymce.themes.CompositeTheme} */\r\nvar tinyTheme = null;\r\n\r\n/**\r\n * Called when tinyInstance initialized.\r\n * @param {object} inst\r\n */\r\nfunction onInstanceInitialize ( inst ) {\r\n\r\n\ttinyEngine = tinyMCE;\r\n\ttinyInstance = inst;\r\n\ttinyTheme = inst.theme;\r\n\r\n\t// make TinyMCE aware of our buttons and stuff.\r\n\tFormat.configure ( tinyInstance );\r\n\ttinyTheme.registerNodeChangeHandler ( Format );\r\n\r\n\t// The toolbar will access this at some point...\r\n\ttinyTheme.formatGroups = groups;\r\n\r\n\tvar head = tinyInstance.dom.doc.getElementsByTagName('head')[0];\r\n\r\n\t/*\r\n\t * Load CSS.\r\n\t */\r\n\r\n\tvar styles = new List ( doc.getElementsByTagName ( \"style\" ));\r\n\tstyles.each(function(style) {\r\n\t\tvar file = style.getAttribute(\"file\");\r\n\t\tvar rel = style.getAttribute(\"rel\");\r\n\t\tif (file != null && file != \"\") {\r\n\t\t\ttinyInstance.dom.add(head, 'link', {\r\n\t\t\t\t'href': Constants.CONFIGROOT + file,\r\n\t\t\t\t'rel': rel ? rel:'stylesheet'\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\t/*\r\n\t * Load Scripts.\r\n\t */\r\n\tvar scripts = new List(doc.getElementsByTagName(\"script\"));\r\n\tscripts.each(function (script) {\r\n\t\tvar file = script.getAttribute(\"file\");\r\n\t\tif (file != null && file != \"\") {\r\n\t\t\ttinyInstance.dom.add(head, 'script', {\r\n\t\t\t\tsrc: Constants.CONFIGROOT + file,\r\n\t\t\t\ttype: 'text/javascript'\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\t//Enable SpellCheck\r\n\tif (Client.hasSpellcheck) {\r\n\t\ttinyInstance.getBody().spellcheck = true;\r\n\t\ttinyInstance.getBody().lang = Localization.currentLang();\r\n\t}\r\n\r\n\tif ( top.EventBroadcaster != null ) {\r\n\r\n\t\t/*\r\n\t\t * Broadcast intercepted by VisualEditorBinding.\r\n\t\t */\r\n\t\ttop.EventBroadcaster.broadcast (\r\n\t\t\ttop.BroadcastMessages.TINYMCE_INITIALIZED, {\r\n\r\n\t\t\t\t// this will identify us to the correct editor\r\n\t\t\t\tbroadcastWindow\t: window,\r\n\r\n\t\t\t\t// this is what the editor needs to know\r\n\t\t\t\ttinyEngine : tinyEngine,\r\n\t\t\t\ttinyInstance : tinyInstance,\r\n\t\t\t\ttinyTheme : tinyTheme\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/errors/ServerErrorDialogPageBinding.js",
    "content": "ServerErrorDialogPageBinding.prototype = new DialogPageBinding;\r\nServerErrorDialogPageBinding.prototype.constructor = ServerErrorDialogPageBinding;\r\nServerErrorDialogPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ServerErrorDialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ServerErrorDialogPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nServerErrorDialogPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ServerErrorDialogPageBinding]\";\r\n}\r\n\r\n/**\r\n * Detach the containing ViewBinding from all server control.\r\n * @overloads {DialogPageBinding#onBindingAttach}\r\n */\r\nServerErrorDialogPageBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tServerErrorDialogPageBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.dispatchAction ( ViewBinding.ACTION_DETACH );\r\n\tthis.dispatchAction ( DockTabBinding.ACTION_FORCE_CLEAN );\r\n}\r\n\r\n/**\r\n * Force unlock application.\r\n * @overloads {PageBinding#onAfterPageInitialize}\r\n */\r\nServerErrorDialogPageBinding.prototype.onAfterPageInitialize = function () {\r\n\t\r\n\tServerErrorDialogPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\t\r\n\t/*\r\n\t * Better force-unlock the GUI.\r\n\t */\r\n\tApplication.unlock ( this, true );\r\n\t\r\n\tfunction hideCover () {\r\n\t\tvar cover = bindingMap.cover;\r\n\t\tif ( Binding.exists ( cover )) {\r\n\t\t\tCoverBinding.fadeOut ( cover );\r\n\t\t}\r\n\t}\r\n\t\r\n\t/* \r\n\t * This fade-in stuff is just for show.\r\n\t */\r\n\tsetTimeout ( hideCover, 500 );\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/errors/ServerErrorPageBinding.js",
    "content": "ServerErrorPageBinding.prototype = new PageBinding;\r\nServerErrorPageBinding.prototype.constructor = ServerErrorPageBinding;\r\nServerErrorPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ServerErrorPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ServerErrorPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nServerErrorPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ServerErrorPageBinding]\";\r\n}\r\n\r\n/**\r\n * Detach the containing ViewBinding from all server control.\r\n * @overloads {PageBinding#onBindingAttach}\r\n */\r\nServerErrorPageBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tServerErrorPageBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.dispatchAction ( ViewBinding.ACTION_DETACH );\r\n\tthis.dispatchAction ( DockTabBinding.ACTION_FORCE_CLEAN );\r\n}\r\n\r\n/**\r\n * Force unlock application and update message queue.\r\n * @overloads {PageBinding#onAfterPageInitialize}\r\n */\r\nServerErrorPageBinding.prototype.onAfterPageInitialize = function () {\r\n\t\r\n\tServerErrorPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\t\r\n\t/*\r\n\t * Better force-unlock the GUI.\r\n\t */\r\n\tApplication.unlock ( this, true );\r\n\t\r\n\tfunction hideCover () {\r\n\t\tvar cover = bindingMap.cover;\r\n\t\tif ( Binding.exists ( cover )) {\r\n\t\t\tCoverBinding.fadeOut ( cover );\r\n\t\t}\r\n\t}\r\n\t\r\n\t/* \r\n\t * This stuff is just for show.\r\n\t */\r\n\tsetTimeout ( hideCover, 500 );\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/errors/error.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<%@ Page Language=\"C#\" ValidateRequest=\"false\" %>\r\n<script runat=\"server\">\r\n\tprotected void Page_Load(object sender, EventArgs e)\r\n\t{\r\n\t\t// Header for handling redirect error page by javascript\r\n\t\tfor (int i = 0; i < 10; i++)\r\n\t\t{\r\n\t\t\tstring indexStr = i == 0 ? string.Empty : i.ToString();\r\n\t\t\tstring type = Request.QueryString[\"type\" + indexStr];\r\n\t\t\tif (string.IsNullOrEmpty(type)) break;\r\n\t\t\tstring msg = Request.QueryString[\"msg\" + indexStr];\r\n\t\t\tResponse.AddHeader(\"X-Error-Type\" + indexStr, type);\r\n\t\t\tResponse.AddHeader(\"X-Error-Message\" + indexStr, msg);\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.ServerError</title>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"error.css.aspx\" />\r\n\t\t<script type=\"text/javascript\" src=\"ServerErrorPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page binding=\"ServerErrorPageBinding\" \r\n\t\t\tlabel=\"${string:Website.ServerError.ServerErrorTitle}\" \r\n\t\t\timage=\"${icon:error}\">\r\n                <div id=\"errerdetails\">\r\n                    \r\n<% for(int i=0; i<10; i++)\r\n   {\r\n       string indexStr = i == 0 ? string.Empty : i.ToString();\r\n       string type = Request.QueryString[\"type\" + indexStr];\r\n\r\n       if (string.IsNullOrEmpty(type)) break;\r\n\r\n       string msg = Request.QueryString[\"msg\" + indexStr];\r\n       string stack = Request.QueryString[\"stack\" + indexStr];\r\n\r\n%>                    \r\n\r\n<pre class=\"errordetailshead\"><%= HttpUtility.HtmlAttributeEncode(type)%>:\r\n<strong><%= HttpUtility.HtmlAttributeEncode(msg)%></strong></pre>\r\n\r\n<pre class=\"errordetailsstack\">Stack trace:\r\n<%= HttpUtility.HtmlAttributeEncode(stack)%></pre>\r\n\r\n<% } %>\r\n\r\n<pre id=\"errordetailsgenerated\">Generated <%= HttpUtility.HtmlAttributeEncode(DateTime.Now.ToString(\"yyyy-MM-dd HH:mm\"))%></pre>\r\n                </div>\r\n\t\t\t<div id=\"layout\">\r\n\t\t\t\t<ui:cover id=\"cover\" busy=\"false\"/>\r\n\t\t\t\t<div id=\"image\"></div>\r\n\t\t\t\t<div id=\"text\">\r\n\t\t\t\t\t<ui:text label=\"${string:Website.ServerError.ServerErrorMessage}\" />\r\n\t\t\t\t    <div id=\"detailslink\" onclick=\"document.getElementById('errerdetails').style.display='block'\">\r\n\t\t\t\t\t    <ui:text label=\"${string:Website.ServerError.ServerErrorDetails}\" />\r\n\t\t\t\t    </div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/errors/error.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\ndiv#layout {\r\n\twidth: 146px;\r\n\theight: 270px;\r\n\tposition: absolute;\r\n\tleft: 50%;\r\n\ttop: 50%;\r\n\tmargin-left: -73px;\r\n\tmargin-top: -85px;\r\n}\r\ndiv#layout div#image {\r\n\t#alphabackdrop: url(\"${root}/images/unfortunateerror.png\");\r\n\twidth: 146px;\r\n\theight: 175px;\r\n}\r\ndiv#layout div#text {\r\n\tposition: absolute;\r\n\ttext-align: center;\r\n\tbottom: 0;\r\n\twidth: 110px;\r\n\t-moz-user-select: none;\r\n}\r\ndiv#layout div#detailslink {\r\n    padding-top:7px;\r\n    text-decoration: underline;\r\n    cursor: pointer;\r\n}\r\ndiv#errerdetails {\r\n    display: none;\r\n\tposition: absolute;\r\n    background-color: White;\r\n    padding: 20px;\r\n\tz-index: 10;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\toverflow: scroll;\r\n}\r\n\r\npre.errordetailshead, \r\npre#errordetailshead {\r\n    font-size: 1.5em;\r\n}\r\nui|dialogpage div#box {\r\n\tposition: relative;\r\n\theight: 290px;\r\n}\r\nui|dialogpage div#layout {\r\n\ttop: 0;\r\n\tmargin-top: 10px;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/errors/error_dialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<%@ Page Language=\"C#\" ValidateRequest=\"false\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.ServerErrorDialog</title>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"error.css.aspx\" />\r\n\t\t<script type=\"text/javascript\" src=\"ServerErrorDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage \r\n\t\t\tbinding=\"ServerErrorDialogPageBinding\" \r\n\t\t\tlabel=\"${string:Website.ServerError.ServerErrorTitle}\" \r\n\t\t\timage=\"${icon:error}\" \r\n            resizable=\"true\"\r\n\t\t\twidth=\"500\">\r\n\t\t\t\r\n                <div id=\"errerdetails\">\r\n<% for(int i=0; i<10; i++)\r\n   {\r\n       string indexStr = i == 0 ? string.Empty : i.ToString();\r\n       string type = Request.QueryString[\"type\" + indexStr];\r\n\r\n       if (string.IsNullOrEmpty(type)) break;\r\n\r\n       string msg = Request.QueryString[\"msg\" + indexStr];\r\n       string stack = Request.QueryString[\"stack\" + indexStr];\r\n\r\n       Response.AddHeader(\"X-Error-Type\" + indexStr, type);\r\n       Response.AddHeader(\"X-Error-Message\" + indexStr, msg);\r\n%>                    \r\n\r\n<pre class=\"errordetailshead\"><%= HttpUtility.HtmlAttributeEncode(type)%>:\r\n<strong><%= HttpUtility.HtmlAttributeEncode(msg)%></strong></pre>\r\n\r\n<pre class=\"errordetailsstack\">Stack trace:\r\n<%= HttpUtility.HtmlAttributeEncode(stack)%></pre>\r\n\r\n<% } %>\r\n\r\n<pre id=\"errordetailsgenerated\">Generated <%= HttpUtility.HtmlAttributeEncode(DateTime.Now.ToString(\"yyyy-MM-dd HH:mm\"))%></pre>\r\n                </div>\r\n\t\t\t<ui:flexbox>\r\n\t\t\t\t<div id=\"box\">\r\n\t\t\t\t\t<div id=\"layout\">\r\n\t\t\t\t\t\t<ui:cover id=\"cover\" busy=\"false\"/>\r\n\t\t\t\t\t\t<div id=\"image\"></div>\r\n\t\t\t\t\t\t<div id=\"text\">\r\n\t\t\t\t\t\t\t<ui:text label=\"${string:Website.ServerError.ServerErrorMessage}\" />\r\n\t\t\t\t                <div id=\"detailslink\" onclick=\"document.getElementById('errerdetails').style.display='block'\">\r\n\t\t\t\t\t                <ui:text label=\"${string:Website.ServerError.ServerErrorDetails}\" />\r\n\t\t\t\t                </div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</ui:flexbox>\r\n\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/errors/licenseviolation.aspx",
    "content": "<%@ Page Language=\"C#\" %><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.ServerError</title>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"error.css.aspx\" />\r\n\t\t<script type=\"text/javascript\" src=\"ServerErrorPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page binding=\"ServerErrorPageBinding\" \r\n\t\t\tlabel=\"${string:Website.LicenseViolation.LicenseViolationTitle}\" \r\n\t\t\timage=\"${icon:error}\">\r\n\t\t\t<div id=\"layout\">\r\n\t\t\t\t<ui:cover id=\"cover\" busy=\"false\"/>\r\n\t\t\t\t<div id=\"image\"></div>\r\n\t\t\t\t<div id=\"text\">\r\n\t\t\t\t\t<ui:text label=\"${string:Website.LicenseViolation.LicenseViolationMessage}\" />\r\n\t\t\t        <ui:text label=\"<%= HttpUtility.HtmlAttributeEncode( Request.QueryString[\"message\"] ) %>\" />\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/errors/licenseviolation_dialog.aspx",
    "content": "<%@ Page Language=\"C#\" %><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.ServerErrorDialog</title>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"licenseviolation.css.aspx\" />\r\n\t\t<script type=\"text/javascript\" src=\"ServerErrorDialogPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:dialogpage \r\n\t\t\tbinding=\"ServerErrorDialogPageBinding\" \r\n\t\t\tlabel=\"${string:Website.LicenseViolation.LicenseViolationTitle}\" \r\n\t\t\timage=\"${icon:error}\" \r\n\t\t\twidth=\"300\">\r\n\t\t\t\r\n\t\t\t<ui:flexbox>\r\n\t\t\t\t<div id=\"box\">\r\n\t\t\t\t\t<div id=\"layout\">\r\n\t\t\t\t\t\t<ui:cover id=\"cover\" busy=\"false\"/>\r\n\t\t\t\t\t\t<div id=\"image\"></div>\r\n\t\t\t\t\t\t<div id=\"text\">\r\n\t\t\t\t\t\t\t<ui:text label=\"${string:Website.LicenseViolation.LicenseViolationMessage}\" />\r\n\t\t\t        \t\t<ui:text label=\"<%= HttpUtility.HtmlAttributeEncode( Request.QueryString[\"message\"] ) %>\" />\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</ui:flexbox>\r\n\t\t\t\r\n\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"${string:Website.Dialogs.LabelAccept}\" response=\"accept\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:dialogtoolbar>\r\n\t\t</ui:dialogpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/gatekeeper/AllUsersAllowedFiles/PreLoginPage.css",
    "content": "﻿\r\nbody\r\n{\r\n    font-family: Arial;\r\n\tfont-size: 75%;\r\n}\r\n\r\ninput, select, textarea, table, tr, td, th {\r\n\tfont-size: 100%;\r\n}\r\n\r\nbody, input, select, textarea, table, tr, td, th {\r\n\tfont-family: verdana, arial, helvetica, sans-serif;\r\n\tcolor: #555555;\r\n}\r\n\r\nh1\r\n{\r\n    font-size: 120%;\r\n}\r\n\r\ndiv.StyledBox\r\n{\r\n    width: 40em;\r\n    text-align: left;\r\n}\r\n\r\ndiv.StyledBoxText\r\n{\r\n    padding: 0 1.2em 0 1.2em;\r\n}\r\n\r\ndiv.Corners {\r\n\tmargin-bottom: 1em;\r\n\tposition: relative;\r\n}\r\n\r\nb.CornersTop, \r\nb.CornersBottom {\r\n\tbackground: transparent;\r\n\tdisplay: block;\r\n\tfont-size: 1px;\r\n\tposition: relative;\r\n}\r\n\r\ndiv.CornersContent {\r\n\tdisplay: block;\r\n}\r\n\r\n/* Colors */\r\nb.CornersTop b.b1 {\r\n\tbackground: #C5C5C5;\r\n}\r\n\r\nb.CornersTop b.b2 {\r\n\tborder-left: 1px solid #C5C5C5;\r\n\tborder-right: 1px solid #C5C5C5;\r\n}\r\n\r\nb.CornersTop b.b3 {\r\n\tborder-left: 1px solid #C5C5C5;\r\n\tborder-right: 1px solid #C5C5C5;\r\n}\r\n\r\nb.CornersTop b.b4 {\r\n\tborder-left: 1px solid #C5C5C5;\r\n\tborder-right: 1px solid #C5C5C5;\r\n}\r\n\r\nb.CornersBottom b.b0 {\r\n\tbackground-color: #E3E3E3;\r\n}\r\n\r\nb.CornersBottom b.b1 {\r\n\tbackground-color: #C5C5C5;\r\n}\r\n\r\nb.CornersBottom b.b2 {\r\n\tborder-left: 1px solid #C5C5C5;\r\n\tborder-right: 2px solid #C5C5C5;\r\n}\r\n\r\nb.CornersBottom b.b3 {\r\n\tborder-left: 1px solid #C5C5C5;\r\n\tborder-right: 2px solid #C5C5C5;\r\n}\r\n\r\nb.CornersBottom b.b4 {\r\n\tborder-left: 1px solid #C5C5C5;\r\n\tborder-right: 2px solid #C5C5C5;\r\n}\r\n\r\ndiv.CornersContent {\r\n\tbackground-color: #C5C5C5;\r\n\tborder-left: 1px solid #C5C5C5;\r\n\tborder-right: 1px solid #E3E3E3;\r\n\tpadding-right: 1px;\r\n}\r\n\r\n/* Gradient */\r\ndiv.Gradient div.CornersContentInner {\r\n\tbackground-color: #F9FCFF;\r\n\tbackground-image: url(\"BackgroundGradient.png\");\r\n\tbackground-position: bottom;\r\n\tbackground-repeat: repeat-x;\r\n\tpadding: 0.7em 1em 0.7em 1em;\r\n}\r\n\r\ndiv.Gradient b.CornersTop b.b2,\r\ndiv.Gradient b.CornersTop b.b3,\r\ndiv.Gradient b.CornersTop b.b4 {\r\n\tbackground-color: #F9FCFF;\r\n}\r\n\r\ndiv.Gradient b.CornersBottom b.b2,\r\ndiv.Gradient b.CornersBottom b.b3,\r\ndiv.Gradient b.CornersBottom b.b4 {\r\n\tbackground-color: #D3EAFE;\r\n}\r\n\r\n/* Corner size b1 is outer horisontal line b4 is inner horisontal line */\r\ndiv.Corners b.b0, \r\ndiv.Corners b.b1, \r\ndiv.Corners b.b2, \r\ndiv.Corners b.b3, \r\ndiv.Corners b.b4 {\r\n\tdisplay: block;\r\n\toverflow: hidden;\r\n}\r\n\r\ndiv.Corners b.b0 {\r\n\theight: 1px;\r\n\tmargin: 0 7px;\r\n}\r\n\r\ndiv.Corners b.b1 {\r\n\theight: 1px;\r\n\tmargin: 0 5px;\r\n}\r\n\r\ndiv.Corners b.b2 {\r\n\tborder-width: 0 2px;\r\n\theight: 1px;\r\n\tmargin: 0 3px;\r\n}\r\n\r\ndiv.Corners b.b3 {\r\n\theight: 1px;\r\n\tmargin: 0 2px;\r\n}\r\n\r\ndiv.Corners b.b4 {\r\n\theight: 2px;\r\n\tmargin: 0 1px;\r\n}\r\n\r\ndiv.ImagesRelative img\r\n{\r\n\tposition:relative;\r\n}    \r\n"
  },
  {
    "path": "Website/Composite/content/misc/gatekeeper/PreLoginPageTemplate.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head id=\"Head1\" runat=\"server\">\r\n    <title>Composite.Management</title>\r\n    <link id=\"Link1\" rel=\"stylesheet\" href=\"AllUsersAllowedFiles/PreLoginPage.css\" runat=\"server\" />\r\n</head>\r\n<body>\r\n    <table height=\"90%\" width=\"100%\">\r\n        <tr>\r\n            <td align=\"center\">\r\n                <div class=\"StyledBox\">\r\n                    <div class=\"ProductBox\">\r\n                        <div class=\"Corners Gradient\">\r\n                            <b class=\"CornersTop\"><b class=\"b1\"></b><b class=\"b2\"></b><b class=\"b3\"></b><b class=\"b4\">\r\n                            </b></b>\r\n                            <div class=\"CornersContent\">\r\n                                <div class=\"CornersContentInner ImagesRelative\">\r\n                                    <div class=\"StyledBoxText\">\r\n                                        <form id=\"Form1\" runat=\"server\">\r\n                                            <asp:PlaceHolder ID=\"PlaceHolder1\" runat=\"server\" />\r\n                                        </form>\r\n                                    </div>\r\n                                </div>\r\n                            </div>\r\n                            <b class=\"CornersBottom\"><b class=\"b4\"></b><b class=\"b3\"></b><b class=\"b2\"></b><b\r\n                                class=\"b1\"></b><b class=\"b0\"></b></b>\r\n                        </div>\r\n                    </div>\r\n                </div>\r\n            </td>\r\n        </tr>\r\n    </table>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/preview/StopPageBinding.js",
    "content": "StopPageBinding.prototype = new PageBinding;\r\nStopPageBinding.prototype.constructor = StopPageBinding;\r\nStopPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StopPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StopPageBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStopPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StopPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onPageInitialize}\r\n */\r\nStopPageBinding.prototype.onPageInitialize = function () {\r\n\t\r\n\tStopPageBinding.superclass.onPageInitialize.call ( this );\r\n\t\r\n\t/*\r\n\t * Return on mouseclick anywhere.\r\n\t */\r\n\tvar self = this;\r\n\tDOMEvents.addEventListener ( document.body, DOMEvents.MOUSEDOWN, {\r\n\t\thandleEvent : function () {\r\n\t\t\tself.dispatchAction ( PreviewWindowBinding.ACTION_RETURN );\r\n\t\t}\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/preview/error.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.PagePreview.Error</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"error.css\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page>\r\n\t\t\t<div class=\"message\">\r\n\t\t\t    <div class=\"icon\">\r\n\t\t\t        <ui:labelbox image=\"${icon:stop-red}\"></ui:labelbox>\r\n\t\t\t    </div>\r\n\t\t\t\t<div class=\"text\">\r\n\t\t\t\t\t<ui:text label=\"Error in preview.\"/>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/preview/error.css",
    "content": ".message {\r\n\tpadding: 22px;\r\n}\r\n.icon {\r\n\twidth: 32px;\r\n\theight: 32px;\r\n\tfloat: left;\r\n}\r\n.icon svg{\r\n    width: 32px;\r\n    height: 32px;\r\n    color: red;\r\n}\r\n.text {\r\n\tpadding-left: 44px;\r\n\t-moz-user-select: none;\r\n\tpadding-top: 10px;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/misc/preview/stop.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n    <title>Composite.Management.PagePreview.FullStop</title>\r\n    <control:styleloader runat=\"server\" />\r\n    <control:scriptloader type=\"sub\" runat=\"server\" />\r\n    <script type=\"text/javascript\" src=\"StopPageBinding.js\" />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"stop.css\" />\r\n</head>\r\n<body>\r\n    <ui:page binding=\"StopPageBinding\" title=\"Go Back\">\r\n        <div class=\"message\">\r\n            <div class=\"icon\">\r\n                <ui:labelbox image=\"${icon:stop-red}\"></ui:labelbox>\r\n            </div>\r\n            <div class=\"text\">\r\n                <ui:text label=\"Navigation disabled in preview.\" />\r\n            </div>\r\n        </div>\r\n    </ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/preview/stop.css",
    "content": "html body,\r\nhtml body * {\r\n\tcursor: pointer !important;\t\r\n}\r\n.message {\r\n\tpadding: 22px;\r\n}\r\n.icon {\r\n\twidth: 32px;\r\n\theight: 32px;\r\n\tfloat: left;\r\n}\r\n\r\n.icon svg{\r\n    width: 32px;\r\n    height: 32px;\r\n    color: red;\r\n}\r\n.text {\r\n\tpadding-left: 44px;\r\n\t-moz-user-select: none;\r\n\tpadding-top: 8px;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/misc/stage/stagedeck.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>    \r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\r\n\t\t<title>Composite.Management.StageDeck</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"stagedeck.css.aspx\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t\r\n\t\t<!-- custom bindings around here! -->\r\n\t\t<ui:bindingmappingset>\r\n\t\t\t<ui:bindingmapping element=\"body\" binding=\"StageDeckRootBinding\"/>\r\n\t\t\t<ui:bindingmapping element=\"ui:splitbox\" binding=\"StageSplitBoxBinding\"/>\r\n\t\t\t<ui:bindingmapping element=\"ui:splitpanel\" binding=\"StageSplitPanelBinding\"/>\r\n\t\t\t<ui:bindingmapping element=\"ui:splitter\" binding=\"StageSplitterBinding\"/>\r\n\t\t</ui:bindingmappingset>\r\n\t</head>\r\n\t<body>\r\n\t\t\r\n\t\t<!-- \r\n\t\t\tthe StageDeckRootBinding has been setup to load deck markup \r\n\t\t\tfrom server using XMLHttpRequest so that we can preserve \r\n\t\t\tdeck layout between sessions. This feature is DISABLED now, \r\n\t\t\tand the markup has been hardwired. All changes here should \r\n\t\t\tbe mirrored in \"templates/defaultstagedeck.xml\" at some point.\r\n\t\t-->\r\n\t\t\r\n\t\t<ui:viewset id=\"views\"/>\r\n\r\n\t\t\r\n\t\t<ui:splitbox orient=\"horizontal\" layout=\"8:3\">\r\n\t\t\t<ui:splitpanel>\r\n\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"8:3\">\r\n\t\t\t\t\t<ui:splitpanel type=\"editors\">\r\n\t\t\t\t\t\t<ui:dock reference=\"main\" type=\"editors\">\r\n\t\t\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:1\">\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:dock reference=\"bottomleft\">\r\n\t\t\t\t\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:dock reference=\"bottomright\">\r\n\t\t\t\t\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t</ui:splitpanel>\r\n\t\t\t<ui:splitter collapse=\"after\"/>\r\n\t\t\t<ui:splitpanel>\r\n\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"1:1\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:dock reference=\"righttop\">\r\n\t\t\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:dock reference=\"rightbottom\">\r\n\t\t\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t</ui:splitpanel>\r\n\t\t</ui:splitbox>\r\n\t\t\r\n\t</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/misc/stage/stagedeck.css",
    "content": "@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n\r\n/*\r\n * These declarations are duplicated in \"app.css\"\r\n */\r\n \r\n#region ie\r\n\tui|splitbox {\r\n\t\twidth: 100%;\r\n\t}\r\n\tui|splitpanel.horizontal {\r\n\t\twidth: 100%;\r\n\t\theight: 100%;\r\n\t}\r\n#endregion\r\n\r\nui|splitter.horizontal ui|splitterbody,\r\nui|splitter.vertical ui|splitterbody {\r\n\tborder: none;\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/viewers/sourcecodeviewer/viewsourcecontent.aspx",
    "content": "<%@ Page Language=\"C#\" %>\r\n\r\n<html>\r\n\t<head>\r\n\t\t<title>Composite.Management.SourceCodeViewerContent</title>\r\n\t\t<script type=\"text/javascript\" src=\"viewsourcecontent.js\"></script>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"viewsourcecontent.css.aspx\"/>\r\n\t</head>\r\n\t<body>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/misc/viewers/sourcecodeviewer/viewsourcecontent.css",
    "content": "html {\r\n\tborder: none;\r\n}\r\nbody {\r\n\tbackground: white none;\r\n\tpadding: 0 12px 12px 12px;\r\n\tfont-family: \"Courier New\", monospace;\r\n\tfont-size: 13px;\r\n\twhite-space: pre;\r\n\toverflow: auto;\r\n}\r\ndiv {\r\n\twhite-space: nowrap;;\r\n}\r\npre {\r\n\tmargin:0px; \r\n\tdisplay:inline;\r\n}\r\nspan.atts {\r\n\twhite-space: nowrap;\t\r\n}\r\ndiv.element {\r\n\tcolor: rgb(63,127,127);\r\n}\r\ndiv.comment {\r\n\tcolor: rgb(63,95,191);\r\n}\r\ndiv.comment pre {\r\n\tdisplay: block;\r\n}\r\ndiv.pi {\r\n\tcolor: rgb(127,0,0);\r\n}\r\nspan.atts {\r\n\tcolor: rgb(127,0,127);\r\n}\r\nspan.attval {\r\n\tcolor: rgb(0,0,255);\r\n}\r\ndiv.text,\r\nspan.text {\r\n\tcolor: rgb(0,0,0);\r\n}\r\ndiv.haschildren {\r\n\t#moz cursor: pointer;\r\n\t#ie cursor: hand;\r\n}\r\ndiv.closed div.children {\r\n\tdisplay: none;\r\n}\r\nspan.twisty {\r\n\twidth: 8px;\r\n\theight: 7px;\r\n\tbackground: url(\"images/minus.png\") transparent no-repeat 0 0;\r\n\tposition: absolute;\r\n\toverflow: hidden;\r\n\tmargin-top: 5px;\r\n\tmargin-left: -12px;\r\n\t#moz -moz-user-select: none;\r\n}\r\ndiv.closed span.twisty {\r\n\tbackground-image: url(\"images/plus.png\");\r\n}"
  },
  {
    "path": "Website/Composite/content/misc/viewers/sourcecodeviewer/viewsourcecontent.js",
    "content": "var DOMEvents = top.DOMEvents;\r\nvar Node = top.Node;\r\nvar CSSUtil = top.CSSUtil;\r\nvar Client = top.Client;\r\n\r\n/**\r\n * @class\r\n */ \r\nvar ViewSourceContent = new function () {\r\n\t\r\n\tvar logger = top.SystemLogger.getLogger ( \"ViewSourceContent\" );\r\n\tvar listen = true;\r\n\t\r\n\t/**\r\n\t * Timeout fixes a strange bug in exploder.\r\n\t * @param {DOMElement} e\r\n\t */ \r\n\tfunction twist ( element ) {\r\n\t\tif ( listen ) {\r\n\t\t\telement.className = element.className == \"open\" ? \"closed\" : \"open\";\r\n\t\t\tlisten = false;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tlisten = true;\r\n\t\t\t}, 0 );\t\r\n\t\t} \r\n\t}\r\n\t\r\n\t/**\r\n\t * @implements {IEventListener}\r\n\t * @param {MouseEvent} e\r\n\t */\r\n\tthis.handleEvent = function ( e ) {\r\n\t\r\n\t\tif ( e.button == Client.isExplorer ? 1 : 0 ) {\r\n\t\t\tvar target = DOMEvents.getTarget ( e );\r\n\t\t\twhile ( target.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\t\tif ( CSSUtil.hasClassName ( target, \"haschildren\" )) {\r\n\t\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\t\ttwist ( target.parentNode );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget = target.parentNode;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tDOMEvents.addEventListener ( \r\n\t\tdocument, \r\n\t\tDOMEvents.MOUSEDOWN, \r\n\t\tthis\r\n\t);\r\n}"
  },
  {
    "path": "Website/Composite/content/views/browser/BrowserAddressBarBinding.js",
    "content": "BrowserAddressBarBinding.prototype = new AddressBarBinding;\r\nBrowserAddressBarBinding.prototype.constructor = BrowserAddressBarBinding;\r\nBrowserAddressBarBinding.superclass = AddressBarBinding.prototype;\r\n\r\nBrowserAddressBarBinding.URL_404 = \"${root}/content/views/browser/errors/404.aspx\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction BrowserAddressBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BrowserAddressBarBinding\" );\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBrowserAddressBarBinding.prototype.toString = function () {\r\n\r\n\treturn \"[BrowserAddressBarBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DataInputBinding#onBindingAttach}\r\n */\r\nBrowserAddressBarBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tBrowserAddressBarBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.addActionListener ( Binding.ACTION_DIRTY );\r\n\t\r\n\t/*\r\n\t * Rig up the Go button.\r\n\t */\r\n\tvar go = this.bindingWindow.bindingMap.go;\r\n\tthis._goButton = go;\r\n\tvar self = this;\r\n\tgo.oncommand = function () {\r\n\t\tself.go ();\r\n\t}\r\n\r\n\t//Hide go button as obsolute\r\n\t//TODO remove button\r\n\tgo.hide();\r\n}\r\n\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nBrowserAddressBarBinding.prototype.onBindingRegister = function () {\r\n\r\n\tBrowserAddressBarBinding.superclass.onBindingRegister.call(this);\r\n\r\n\tthis.addEventListener(DOMEvents.CLICK);\r\n\r\n}\r\n\r\n/**\r\n * @overwrites {DataInputBinding#onfocus}\r\n */\r\nBrowserAddressBarBinding.prototype.onfocus = function () {\r\n\r\n\tthis.subscribe(BroadcastMessages.KEY_ENTER);\r\n}\r\n\r\n/**\r\n * @overwrites {DataInputBinding#onfocus}\r\n */\r\nBrowserAddressBarBinding.prototype.onblur = function () {\r\n\r\n\tthis.unsubscribe(BroadcastMessages.KEY_ENTER);\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @overloads {DataInputBinding#handleBroadcast}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nBrowserAddressBarBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tBrowserAddressBarBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tswitch (broadcast) {\r\n\t\tcase BroadcastMessages.KEY_ENTER:\r\n\t\t\tthis.go();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Maximize to available width (crappy javascript layout alert).\r\n * @param {int} avail\r\n */\r\nBrowserAddressBarBinding.prototype.maximize = function ( avail ) {\r\n\t\r\n\tvar width = avail;\r\n\tif (this.bindingWindow.bindingMap.addressrightgroup) {\r\n\t\twidth = width - this.bindingWindow.bindingMap.addressrightgroup.boxObject.getDimension().w;\r\n\t}\r\n\r\n\tthis.bindingElement.style.width = (width - 10) + \"px\";\r\n\tthis.bindingElement.parentNode.style.width = (width - 8) + \"px\";\r\n}\r\n\r\n\r\n \r\n/**\r\n * @implements {IActionHandler}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nBrowserAddressBarBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tBrowserAddressBarBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase Binding.ACTION_DIRTY :\r\n\t\t\tif ( action.target == this ) {\r\n\t\t\t\tthis._goButton.enable ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n\r\n\r\n/**\r\n * @overloads {DataInputBinding#setValue}\r\n * @param {string} value\r\n */\r\nBrowserAddressBarBinding.prototype.setValue = function (value) {\r\n\r\n\tBrowserAddressBarBinding.superclass.setValue.call ( this, value );\r\n\tthis._goButton.disable ();\r\n\tthis.isDirty = false;\r\n}\r\n\r\n/**\r\n * Load URL in addressbar.\r\n */\r\nBrowserAddressBarBinding.prototype.go = function () {\r\n\r\n\tvar url = this.getValue().replace(/\\s/g, \"\"); // kill whitespace\r\n\r\n\t\tif (url.length > 0) {\r\n\r\n\t\turl = this._cleanupURL(url);\r\n\t\tthis.setValue(url);\r\n\t\tthis.blur();\r\n\t\tApplication.lock(this);\r\n\r\n\t\tvar self = this;\r\n\t\tsetTimeout(function () {\r\n\r\n\t\t\turl = PageService.ConvertAbsolutePageUrlToRelative(url);\r\n\r\n\t\t\tvar status = self._getRequestStatus(url);\r\n\t\t\tif (status == 200) {\r\n\t\t\t\tself.bindingWindow.bindingMap.browserpage.setURL(url);\r\n\t\t\t} else {\r\n\t\t\t\tself._showWarning(status);\r\n\t\t\t}\r\n\t\t\tApplication.unlock(self);\r\n\t\t}, 0);\r\n\t}\r\n}\r\n\r\n/**\r\n * This is an attempt to make the addressbar \"autoguess\" missing \r\n * elements of an entered URL. It may not be the best code, but...\r\n * @param {string} url\r\n * @return {string}\r\n */\r\nBrowserAddressBarBinding.prototype._cleanupURL = function ( url ) {\r\n\t\r\n\tvar hasProto = false;\r\n\tvar hasHost = false;\r\n\t\r\n\tvar proto = document.location.protocol;\r\n\tvar port = document.location.port;\r\n\tvar host = document.location.host;\r\n\t\r\n\tif ( url.charAt ( 0 ) == \"/\" ) {\r\n\t\tif ( url.indexOf ( host ) == -1 ) {\r\n\t\t\tvar p = port == \"\" ? \"\" : ( \":\" + port );\r\n\t\t\turl = host + p + url;\r\n\t\t}\r\n\t}\r\n\t\r\n\tvar split = url.split ( proto );\r\n\tif ( split.length == 2 && split [ 0 ] == \"\" ) {\r\n\t\thasProto = true;\r\n\t}\r\n\tif ( !hasProto ) {\r\n\t\tif ( url.charAt ( 0 ) == \"/\" ) {\r\n\t\t\turl = proto + \"/\" + url;\r\n\t\t} else {\r\n\t\t\turl = proto + \"//\" + url;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn url;\r\n}\r\n\r\n/**\r\n * Show warning dialog.\r\n * @param {int} status\r\n */\r\nBrowserAddressBarBinding.prototype._showWarning = function ( status ) {\r\n\t\r\n\tvar title = null;\r\n\tvar text = null;\r\n\t\r\n\tswitch ( status ) {\r\n\t\tcase 0 : // external domain\r\n\t\t\ttitle = \"AddressBar.Invalid.DialogTitle.External\";\r\n\t\t\ttext = \"AddressBar.Invalid.DialogText.External\";\r\n\t\t\tbreak;\r\n\t\tcase 400 : // bad request\r\n\t\t\ttitle = \"AddressBar.Invalid.DialogTitle.BadRequest\";\r\n\t\t\ttext = \"AddressBar.Invalid.DialogText.BadRequest\";\r\n\t\t\tbreak;\r\n\t\tcase 401 : // unauthorized\r\n\t\tcase 403 :\r\n\t\t\ttitle = \"AddressBar.Invalid.DialogTitle.Unauthorized\";\r\n\t\t\ttext = \"AddressBar.Invalid.DialogText.Unauthorized\";\r\n\t\t\tbreak;\r\n\t\tcase 404 : // not found\r\n\t\t\ttitle = \"AddressBar.Invalid.DialogTitle.NotFound\";\r\n\t\t\ttext = \"AddressBar.Invalid.DialogText.NotFound\";\r\n\t\t\tbreak;\r\n\t\tcase 500 : // internal error\r\n\t\t\ttitle = \"AddressBar.Invalid.DialogTitle.InternalError\";\r\n\t\t\ttext = \"AddressBar.Invalid.DialogText.InternalError\";\r\n\t\t\tbreak;\r\n\t\tdefault : // default\r\n\t\t\tthis.logger.debug ( \"Exotic status code: \" + status );\r\n\t\t\ttitle = \"AddressBar.Invalid.DialogTitle.Default\";\r\n\t\t\ttext = \"AddressBar.Invalid.DialogText.Default\";\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tDialog.warning ( \r\n\t\tStringBundle.getString ( \"Composite.Web.PageBrowser\", title ), \r\n\t\tStringBundle.getString ( \"Composite.Web.PageBrowser\", text ) \r\n\t);\r\n}\r\n\r\n/**\r\n * Extract the HTTP response code from an URL request.\r\n * @param {string} url\r\n * @return {int}\r\n */\r\nBrowserAddressBarBinding.prototype._getRequestStatus = function ( url ) {\r\n\t\r\n\tvar result = 0;\r\n\tvar request = DOMUtil.getXMLHTTPRequest ();\r\n\ttry {\r\n\t\trequest.open ( \"get\", url, false );\r\n\t\trequest.send ( null );\r\n\t\tresult = request.status;\r\n\t} catch ( accessDeniedException ) {\r\n\t\tresult = 0;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/views/browser/BrowserPageBinding.js",
    "content": "BrowserPageBinding.prototype = new PageBinding;\r\nBrowserPageBinding.prototype = new PageBinding;\r\nBrowserPageBinding.prototype.constructor = BrowserPageBinding;\r\nBrowserPageBinding.superclass = PageBinding.prototype;\r\n\r\nBrowserPageBinding.ACTION_ONLOAD = \"browserpage loaded\";\r\nBrowserPageBinding.ACTION_TABSHIFT = \"browserpage tabshift\";\r\n\r\nBrowserPageBinding.DEVICE_LIST = \"${root}/content/views/browser/deviceoptions.xml?consoleId=\" + Application.CONSOLE_ID;\r\nBrowserPageBinding.DEVICE_TOUCHVIEW_FRAMEOVERLAY_ID = \"deviceframeoverlay\";\r\n\r\nBrowserPageBinding.VIEWMODE_PUBLIC_ICON = \"item-publish\";\r\nBrowserPageBinding.VIEWMODE_LOCALSTORAGE_KEY = \"COMPOSITE_BROWSERPAGEBINDING_VIEWMODE\";\r\nBrowserPageBinding.VIEW_MODES = Object.freeze({\r\n\tUnpublic: 1,\r\n\tPublic: 2\r\n});\r\n\r\nBrowserPageBinding.BUNDLE_CLASSNAME = \"bundleselector\";\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction BrowserPageBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"BrowserPageBinding\");\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._startURL = null;\r\n\r\n\t/**\r\n\t * This will be set to an index in the map declared above. it has two properties:\r\n\t *     history {List<string>}\r\n\t *     index {int}\r\n\t * @type {object}\r\n\t */\r\n\tthis._current = null;\r\n\r\n\t/**\r\n\t* The Page View Mode - Public or Unpublic version\r\n\t* @type {int}\r\n\t**/\r\n\tthis._currentViewMode = BrowserPageBinding.VIEW_MODES.Unpublic;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._targetUrl = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._customUrl = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isRequirePublicNet = true;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isHistoryBrowsing = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isPushingUrl = false;\r\n\r\n\t/**\r\n\t * @type {BrowserTabBoxBinding}\r\n\t */\r\n\tthis._box = null;\r\n\r\n\t/**\r\n\t * Timeout to hide the cover that blocks external URLs.\r\n\t * @type {function}\r\n\t */\r\n\tthis._blockertimeout = null;\r\n\r\n\r\n\t/**\r\n\t * Key to validate that result of async request is actual\r\n\t * @type {string}\r\n\t */\r\n\tthis._stateKey = null;\r\n\r\n\r\n\tthis._frameTransformIndex = 1;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBrowserPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[BrowserPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBindingRegister}\r\n */\r\nBrowserPageBinding.prototype.onBindingRegister = function () {\r\n\r\n\tBrowserPageBinding.superclass.onBindingRegister.call(this);\r\n\tthis.subscribe(BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED);\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED_AFTER);\r\n\tthis.subscribe(BroadcastMessages.KEY_ARROW);\r\n\r\n\tthis.addActionListener(WindowBinding.ACTION_ONLOAD);\r\n\tthis.addActionListener(TabBoxBinding.ACTION_SELECTED);\r\n\tthis.addActionListener(ViewBinding.ACTION_LOADED);\r\n\tthis.addActionListener(PageBinding.ACTION_INITIALIZED);\r\n\tthis.addActionListener(SplitterBinding.ACTION_DRAGSTART);\r\n\tthis.addActionListener(SplitterBinding.ACTION_DRAGGED);\r\n\tthis.addActionListener(SystemTreeNodeBinding.ACTION_REFRESHED);\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nBrowserPageBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tBrowserPageBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tswitch (broadcast) {\r\n\t\tcase BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED:\r\n\t\t\tif (arg.syncHandle == this.getSyncHandle() && !(arg.source instanceof GenericViewBinding) && arg.actionProfile) {\r\n\t\t\t\tvar self = this;\r\n\r\n\t\t\t\tvar bundleselector = this.getBundleSelector();\r\n\t\t\t\t//TODO move this\r\n\r\n\t\t\t\tvar treenode = this.getSystemTree().getFocusedTreeNodeBindings().getFirst();\r\n\t\t\t\tif (treenode.node.isMultiple()) {\r\n\t\t\t\t\tvar list = new List();\r\n\t\t\t\t\ttreenode.node.getDatas().each(function(data) {\r\n\t\t\t\t\t\tlist.add(new SelectorBindingSelection(data.BundleElementName ? data.BundleElementName : data.Label, data.EntityToken, data.EntityToken === treenode.node.getEntityToken()));\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbundleselector.populateFromList(list);\r\n\t\t\t\t\tbundleselector.show();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbundleselector.hide();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.bindingWindow.bindingMap.navbar.flex();\r\n\r\n\t\t\t\t//TODO end move this\r\n\r\n\r\n\t\t\t\t//IE Require timeout for first time\r\n\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\tself.push(arg.actionProfile.Node, true);\r\n\t\t\t\t}, 0);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESHED_AFTER:\r\n\t\t\tif (arg.syncHandle == this.getSyncHandle()) {\r\n\t\t\t\tthis.refreshView();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.KEY_ARROW:\r\n\t\t\tif (this._box.isFocused) {\r\n\t\t\t\tvar frameOvl = document.getElementById(BrowserPageBinding.DEVICE_TOUCHVIEW_FRAMEOVERLAY_ID);\r\n\t\t\t\tif (frameOvl && frameOvl.style.display == \"block\") { // Scroll Touch Device View on Key UP/DOWN\r\n\t\t\t\t\tvar delta = KeyEventCodes.VK_UP == arg ? -50 : 50;\r\n\t\t\t\t\tthis.scrollDeviceFrame(delta);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Refresh Generic View\r\n */\r\nBrowserPageBinding.prototype.refreshView = function () {\r\n\r\n\tvar treenode = this.getSystemTree().getFocusedTreeNodeBindings().getFirst();\r\n\tif (treenode) {\r\n\t\ttreenode.focus();\r\n\t\tthis.push(treenode.node, true, true);\r\n\t} else {\r\n\t\tthis.push(this.getSystemPage().node, false, true);\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {HashMap<string><string>}\r\n */\r\nBrowserPageBinding.prototype.setPageArgument = function (map) {\r\n\r\n\tBrowserPageBinding.superclass.setPageArgument.call(this, map);\r\n\r\n\tvar url = map[\"URL\"];\r\n\tif (url && this._isPageBindingInitialized) {\r\n\t\tthis.setURL(url);\r\n\t} else {\r\n\t\tthis._startURL = url;\r\n\t}\r\n\tif (!this.systemViewDefinition) {\r\n\r\n\t\tthis.systemViewDefinition = map[\"SystemViewDefinition\"];\r\n\t\t//NEWUI Add tree to Browser\r\n\t\tvar explorerdocument = this.bindingDocument;\r\n\t\tvar explorerpanel = this.bindingWindow.bindingMap.explorerpanel;\r\n\t\t// construct ViewBinding\r\n\t\tvar viewBinding = ViewBinding.newInstance(explorerdocument);\r\n\t\tviewBinding.setType(ViewBinding.TYPE_EXPLORERVIEW);\r\n\t\tviewBinding.setDefinition(this.systemViewDefinition);\r\n\r\n\t\texplorerpanel.add(viewBinding);\r\n\r\n\t\tviewBinding.attach();\r\n\t\tviewBinding.initialize();\r\n\r\n\t\tthis._viewBinding = viewBinding;\r\n\t\tif (map.image)\r\n\t\t\tthis.image = map.image;\r\n\t}\r\n\r\n\r\n}\r\n\r\n/**\r\n * @overwrites {PageBinding#onBeforePageInitialize}\r\n */\r\nBrowserPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tBrowserPageBinding.superclass.onBeforePageInitialize.call(this);\r\n\r\n\tthis._box = window.bindingMap.browsertabbox;\r\n\r\n\tvar navbar = window.bindingMap.navbar;\r\n\tnavbar.addActionListener(ButtonBinding.ACTION_COMMAND, this);\r\n\r\n\tvar contextmenu = window.bindingMap.contextmenu;\r\n\tcontextmenu.addActionListener(MenuItemBinding.ACTION_COMMAND, this);\r\n\r\n\tvar devicepopup = window.bindingMap.devicepopup;\r\n\tdevicepopup.addActionListener(MenuItemBinding.ACTION_COMMAND, this);\r\n\r\n\tthis.addActionListener(PathBinding.ACTION_COMMAND);\r\n\r\n\t// Subscribe to current tab selected\r\n\tvar dockPanelViewBinding = this.getAncestorBindingByType(ViewBinding, true);\r\n\tvar dockTabPanel = UserInterface.getBinding(dockPanelViewBinding.getMigrationParent());\r\n\tdockTabPanel.addActionListener(FocusBinding.ACTION_FOCUS, this);\r\n\tdockTabPanel.addActionListener(FocusBinding.ACTION_BLUR, this);\r\n\r\n\tif (this._startURL) {\r\n\t\tthis.setURL(this._startURL);\r\n\t\tthis._startURL = null;\r\n\t}\r\n\r\n\tif (Client.isAnyExplorer) {\r\n\t\twindow.bindingMap.viewsourcegroup.hide();\r\n\t}\r\n}\r\n\r\n/**\r\n * Prepare cover to block external URLs.\r\n * @overloads {PageBinding#onAfterPageInitialize}\r\n */\r\nBrowserPageBinding.prototype.onAfterPageInitialize = function () {\r\n\r\n\tBrowserPageBinding.superclass.onAfterPageInitialize.call(this);\r\n\r\n\tvar self = this;\r\n\tvar blocker = this.bindingWindow.bindingMap.blocker;\r\n\r\n\tif (blocker != null) {\r\n\t\tDOMEvents.addEventListener(blocker.bindingElement, DOMEvents.MOUSEDOWN, {\r\n\t\t\thandleEvent: function () {\r\n\t\t\t\tblocker.hide();\r\n\t\t\t\tif (self._blockertimeout != null) {\r\n\t\t\t\t\tclearTimeout(self._blockertimeout);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tthis.loadDeviceList();\r\n\r\n\tthis.reflex(); //?\r\n\r\n\tif (this._startURL) {\r\n\t\tthis._isPushingUrl = false;\r\n\t\tthis.setURL(this._startURL);\r\n\t\tthis._startURL = null;\r\n\t}\r\n\r\n\tthis._clearHistory();\r\n\tthis._updateBroadcasters();\r\n\r\n\t//TODO move this\r\n\tthis._box.getGeneticViewTabBinding().tree.addActionListener(GenericViewBinding.ACTION_COMMAND, this);\r\n\r\n\tvar _savedCurrentViewMode = LocalStorage.get_data(BrowserPageBinding.VIEWMODE_LOCALSTORAGE_KEY);\r\n\tif (_savedCurrentViewMode) {\r\n\t\tthis._currentViewMode = _savedCurrentViewMode;\r\n\t\tif (_savedCurrentViewMode = BrowserPageBinding.VIEW_MODES.Public) {\r\n\t\t\tthis.bindingWindow.bindingMap.setscreenbutton.setImage(BrowserPageBinding.VIEWMODE_PUBLIC_ICON);\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n\r\n/**\r\n* Set Current View Mode\r\n* @param {viewMode}\r\n*/\r\nBrowserPageBinding.prototype.setCurrentViewMode = function (viewMode) {\r\n\r\n\tvar isNewValue = viewMode && viewMode != this._currentViewMode;\r\n\tif (isNewValue) {\r\n\t\tthis._currentViewMode = viewMode;\r\n\t\tLocalStorage.store_data(viewMode, BrowserPageBinding.VIEWMODE_LOCALSTORAGE_KEY);\r\n\t\tthis.refreshView();\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Add node to order\r\n * @param {string} url\r\n * @return\r\n */\r\nBrowserPageBinding.prototype.push = function (node, isManual, isForce) {\r\n\r\n\tthis.newState();\r\n\r\n\tthis.bindingWindow.bindingMap.cover.hide();\r\n\tvar self = this;\r\n\tif (typeof (node) == \"string\" || node instanceof String) {\r\n\t\tself.pushURL(node, isManual);\r\n\t}\r\n\tif (node instanceof SystemNode) {\r\n\t\tvar entityToken = node.getEntityToken();\r\n\t\tif (entityToken) {\r\n\t\t\tif (this._entityToken != entityToken || isForce) {\r\n\r\n\t\t\t\tvar propertyBag = node.getPropertyBag();\r\n\t\t\t\tif (propertyBag && propertyBag.BrowserUrl) {\r\n\t\t\t\t\tvar isExternalUrl = propertyBag.BrowserUrl.indexOf(\"//\") > -1 && propertyBag.BrowserUrl.split(\"//\")[1].split(\"/\")[0] == window.location.host;\r\n\t\t\t\t\tif (isExternalUrl || propertyBag.BrowserToolingOn === \"false\") {\r\n\t\t\t\t\t\tself.pushNodeURL(node, propertyBag.BrowserUrl, isManual);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tself.pushURL(propertyBag.BrowseUrl, isManual);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar isPublic = self._currentViewMode == BrowserPageBinding.VIEW_MODES.Public;\r\n\r\n\t\t\t\t\tTreeService.GetBrowserUrlByEntityToken(entityToken, isPublic, function (result) {\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\tif (result && result.Url) {\r\n\t\t\t\t\t\t\t\tif (result.ToolingOn) {\r\n\t\t\t\t\t\t\t\t\tself.pushURL(result.Url, isManual);\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tself.pushNodeURL(node, result.Url, isManual);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tself.pushToken(node, isManual);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, 0);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._entityToken = entityToken;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Add Url to view\r\n * @param {string} url\r\n * @return\r\n */\r\nBrowserPageBinding.prototype.pushURL = function (url, isManual) {\r\n\r\n\tthis.toolingOn = true;\r\n\tthis.isBrowserTab = false;\r\n\r\n\tif (url && url != this._box.getLocation()) {\r\n\t\tthis._isPushingUrl = isManual;\r\n\t\tif (this._customUrl) {\r\n\t\t\tthis._targetUrl = this.getAbsoluteUrl(url);\r\n\t\t\tthis.setCustomUrl(this._customUrl);\r\n\t\t} else {\r\n\t\t\tthis.setURL(url);\r\n\t\t}\r\n\t\tthis._updateAddressBar(url);\r\n\t}\r\n}\r\n\r\nBrowserPageBinding.prototype.getAbsoluteUrl = function (url) {\r\n\tvar a = document.createElement(\"a\");\r\n\ta.href = url;\r\n\treturn a.href;\r\n}\r\n\r\n/**\r\n * Add Node to view\r\n * @param {string} url\r\n * @return\r\n */\r\nBrowserPageBinding.prototype.pushToken = function (node, isManual) {\r\n\r\n\tthis.isBrowserTab = false;\r\n\r\n\tvar tab = this._box.getGeneticViewTabBinding();\r\n\tthis._box.select(tab, true);\r\n\ttab.tree.setNode(node);\r\n\tthis._updateHistory({ node: node });\r\n\tthis._updateBroadcasters();\r\n\tthis._updateAddressBar(node);\r\n\tif (!isManual) {\r\n\t\tthis.getSystemTree()._focusTreeNodeByEntityToken(node.getEntityToken());\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Add External url to view\r\n * @param {string} url\r\n * @return\r\n */\r\nBrowserPageBinding.prototype.pushNodeURL = function (node, url, isManual) {\r\n\turl = Resolver.resolve(url);\r\n\r\n\tthis.toolingOn = false;\r\n\r\n\tthis._updateHistory({ node: node });\r\n\tthis._updateBroadcasters();\r\n\tthis._updateAddressBar(node);\r\n\r\n\tthis.setFrameURL(url);\r\n\r\n\tif (!isManual) {\r\n\t\tthis.getSystemTree()._focusTreeNodeByEntityToken(node.getEntityToken());\r\n\t}\r\n}\r\n\r\n/**\r\n * Load URL in browser frame.\r\n * @param {string} url\r\n * @return\r\n */\r\nBrowserPageBinding.prototype.setURL = function (url) {\r\n\r\n\tthis.isBrowserTab = true;\r\n\r\n\tvar cover = window.bindingMap.cover;\r\n\tcover.show();\r\n\tthis._box.setURL(url);\r\n}\r\n\r\n/**\r\n * Load  URL in simple frame.\r\n * @param {string} url\r\n * @return\r\n */\r\n\r\nBrowserPageBinding.prototype.setFrameURL = function (url) {\r\n\tvar customView = this._box.getCustomViewTabBinding();\r\n\t\tif (customView.iframe.src) {\r\n\t\tcustomView.iframe.src = \"about:blank\";\r\n\t\tcustomView.iframe.onload = function () {\r\n\t\t\tcustomView.iframe.onload = null;\r\n\t\t\tcustomView.iframe.src = url;\r\n\t\t};\r\n\t} else {\r\n\t\tcustomView.iframe.src = url;\r\n\t}\r\n\tthis._box.select(customView, true);\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nBrowserPageBinding.prototype.handleAction = function (action) {\r\n\r\n\tBrowserPageBinding.superclass.handleAction.call(this, action);\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch (action.type) {\r\n\r\n\t\tcase WindowBinding.ACTION_ONLOAD:\r\n\t\t\tif (this._box.getBrowserWindow() == binding) {\r\n\t\t\t\tthis._handleDocumentLoad(binding);\r\n\t\t\t\taction.consume();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase ButtonBinding.ACTION_COMMAND:\r\n\t\tcase MenuItemBinding.ACTION_COMMAND:\r\n\t\t\tthis._handleCommand(binding.getProperty(\"cmd\"), binding);\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\r\n\t\tcase TabBoxBinding.ACTION_SELECTED:\r\n\t\t\tthis._handleSelectedTab();\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\r\n\t\tcase GenericViewBinding.ACTION_COMMAND:\r\n\t\t\tthis.getSystemTree().handleBroadcast(BroadcastMessages.SYSTEMTREEBINDING_FOCUS, action.target.node.getEntityToken());\r\n\t\t\tbreak;\r\n\r\n\t\tcase ViewBinding.ACTION_LOADED:\r\n\t\t\tthis.dispatchAction(StageBinding.ACTION_DECK_LOADED);\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_INITIALIZED:\r\n\t\t\tif (binding instanceof SystemPageBinding) {\r\n\t\t\t\tEventBroadcaster.broadcast(BroadcastMessages.STAGEDECK_CHANGED, this.getSyncHandle());\r\n\t\t\t\tthis.removeActionListener(PageBinding.ACTION_INITIALIZED);\r\n\t\t\t\taction.consume();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase SplitterBinding.ACTION_DRAGSTART:\r\n\t\t\twindow.bindingMap.cover.show();\r\n\t\t\tbreak;\r\n\r\n\t\tcase SplitterBinding.ACTION_DRAGGED:\r\n\t\t\twindow.bindingMap.cover.hide();\r\n\t\t\tbreak;\r\n\r\n\t\tcase FocusBinding.ACTION_FOCUS:\r\n\t\t\t//TODO add check target\r\n\t\t\tif (action.target instanceof DockPanelBinding) {\r\n\t\t\t\tthis.onBrowserTabSelected();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase FocusBinding.ACTION_BLUR:\r\n\t\t\t//TODO add check target\r\n\t\t\tif (action.target instanceof DockPanelBinding) {\r\n\t\t\t\tthis.onBrowserTabUnselected();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase SystemTreeNodeBinding.ACTION_REFRESHED:\r\n\t\t\tthis._autoExpand();\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\r\n\t\tcase PathBinding.ACTION_COMMAND:\r\n\t\t\tthis.push(binding.node);\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/*\r\n * Clear history\r\n */\r\nBrowserPageBinding.prototype._clearHistory = function () {\r\n\r\n\tif (!this._current) {\r\n\t\tthis._current = {\r\n\t\t\thistory: new List(),\r\n\t\t\tindex: parseInt(-1)\r\n\t\t};\r\n\t}\r\n\r\n\twhile (this._current.history.getLength() > 1) {\r\n\t\tthis._current.history.del(0);\r\n\t\tthis._current.index = this._current.history.getLength() - 1;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Handle selected tab.\r\n * @param {BrowserTabBoxBinding} tabbox\r\n */\r\nBrowserPageBinding.prototype._handleSelectedTab = function () {\r\n\r\n\tvar tab = this._box.getSelectedTabBinding();\r\n\tif (tab.getLabel() != null) {\r\n\t\ttab.dispatchAction(DockTabBinding.ACTION_UPDATE_VISUAL);\r\n\t}\r\n\tif (Types.isFunction(tab.getEntityToken)) {\r\n\t\ttab.dispatchAction(DockTabBinding.ACTION_UPDATE_TOKEN);\r\n\t}\r\n\r\n\r\n\tif (!this._current) {\r\n\t\tthis._current = {\r\n\t\t\thistory: new List(),\r\n\t\t\tindex: parseInt(-1)\r\n\t\t};\r\n\t}\r\n\tthis._updateBroadcasters();\r\n\r\n\t/*\r\n\t * Broadcast contained markup for various panels to intercept. Since the markup\r\n\t * extraction requires a server roundtrip, we check for subscribers first.\r\n\t */\r\n\tif (EventBroadcaster.hasSubscribers(BroadcastMessages.XHTML_MARKUP_ON)) {\r\n\t\tif (tab.browserwindow != null) {\r\n\t\t\tvar markup = WindowBinding.getMarkup(tab.browserwindow);\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.XHTML_MARKUP_ON, markup);\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Dispatch event for plugins to hook.\r\n\t */\r\n\tthis.dispatchAction(BrowserPageBinding.ACTION_TABSHIFT);\r\n}\r\n\r\n/**\r\n * Handle loaded document.\r\n * @param {WindowBinding} binding\r\n */\r\nBrowserPageBinding.prototype._handleDocumentLoad = function (binding) {\r\n\r\n\tvar url = new String(binding.getContentDocument().location);\r\n\r\n\tthis.newState();\r\n\r\n\t/*\r\n\t * Update stuff.\r\n\t */\r\n\tthis._updateAddressBar(url);\r\n\tthis._updateHistory(url);\r\n\tthis._updateBroadcasters();\r\n\tthis._updateDocument();\r\n\tthis._updateTabBox(url);\r\n\r\n\t/*\r\n\t * Broadcast contained markup for various panels to intercept. Since the markup\r\n\t * extraction requires a server roundtrip, we check for subscribers first.\r\n\t */\r\n\tif (EventBroadcaster.hasSubscribers(BroadcastMessages.XHTML_MARKUP_ON)) {\r\n\t\tvar markup = WindowBinding.getMarkup(binding);\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.XHTML_MARKUP_ON, markup);\r\n\t}\r\n\r\n\t/*\r\n\t * Hide the cover.\r\n\t */\r\n\tvar cover = window.bindingMap.cover;\r\n\tif (cover.isVisible) {\r\n\t\tcover.hide();\r\n\t}\r\n\r\n\tif (!this._isPushingUrl) {\r\n\t\tvar self = this;\r\n\t\tvar stateKey = self.getState();\r\n\t\tTreeService.GetEntityTokenByPageUrl(url, function (entityToken) {\r\n\t\t\tif (stateKey === self.getState()) {\r\n\t\t\t\tself._entityToken = entityToken;\r\n\t\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\t\tBroadcastMessages.SYSTEMTREEBINDING_FOCUS,\r\n\t\t\t\t\tentityToken\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t}\r\n\r\n\t/*\r\n\t * Dispatch event for Browser plugins to hook into.\r\n\t */\r\n\tthis.dispatchAction(BrowserPageBinding.ACTION_ONLOAD);\r\n\r\n\tthis._isPushingUrl = false;\r\n\r\n\tif (this.isBrowserTab) {\r\n\t\tvar tab = this._box.getBrowserTabBinding();\r\n\t\tthis._box.select(tab);\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @param {string} url\r\n */\r\nBrowserPageBinding.prototype._updateAddressBar = function (url) {\r\n\r\n\tvar bar = this.bindingWindow.bindingMap.addressbar;\r\n\tif (bar != null) {\r\n\r\n\t\tif (typeof (url) == \"string\" || url instanceof String) {\r\n\t\t\tbar.showAddreesbar(url);\r\n\t\t} else if (url instanceof SystemNode) {\r\n\t\t\tbar.showBreadcrumb(url, System.getParents(url.getHandle()));\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {string} url\r\n */\r\nBrowserPageBinding.prototype._updateTabBox = function (url) {\r\n\r\n\t//TODO: check and remove this\r\n\tvar def = ViewDefinitions[\"Composite.Management.Browser\"];\r\n\tdef.argument = { \"URL\": url };\r\n\r\n}\r\n\r\n/*\r\n * Update history.\r\n * @param {object} item\r\n */\r\nBrowserPageBinding.prototype._updateHistory = function (item) {\r\n\r\n\tif (this._isHistoryBrowsing == true) {\r\n\t\tthis._isHistoryBrowsing = false;\r\n\t} else {\r\n\r\n\t\twhile (this._current.history.getLength() - 1 > this._current.index) {\r\n\t\t\tthis._current.history.extractLast();\r\n\t\t}\r\n\t\tthis._current.history.add(item);\r\n\t\tthis._current.index++;\r\n\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle command (navbar or contextmenu).\r\n * @param {string} cmd\r\n * @param {Binding} binding\r\n */\r\nBrowserPageBinding.prototype._handleCommand = function (cmd, binding) {\r\n\r\n\tswitch (cmd) {\r\n\t\tcase \"back\":\r\n\t\t\tthis._isHistoryBrowsing = true;\r\n\t\t\tvar item = this._current.history.get(--this._current.index);\r\n\t\t\tthis.push(item && item.node ? item.node : item);\r\n\t\t\tbreak;\r\n\t\tcase \"forward\":\r\n\t\t\tthis._isHistoryBrowsing = true;\r\n\t\t\tvar item = this._current.history.get(++this._current.index);\r\n\t\t\tthis.push(item && item.node ? item.node : item);\r\n\r\n\t\t\tbreak;\r\n\t\tcase \"refresh\":\r\n\t\t\tthis.getSystemTree()._handleCommandBroadcast(BroadcastMessages.SYSTEMTREEBINDING_REFRESH);\r\n\t\t\tbreak;\r\n\t\tcase \"home\":\r\n\t\t\tthis.push(this.getSystemPage().node);\r\n\t\t\tbreak;\r\n\t\tcase \"toggletree\":\r\n\t\t\tvar toggletreebutton = this.bindingWindow.bindingMap.toggletreebutton;\r\n\t\t\tvar explorerpanel = this.bindingWindow.bindingMap.explorerpanel;\r\n\t\t\tif (toggletreebutton.isChecked) {\r\n\t\t\t\texplorerpanel.show();\r\n\t\t\t} else {\r\n\t\t\t\texplorerpanel.hide();\r\n\t\t\t}\r\n\t\t\tthis.reflex();\r\n\t\t\tbreak;\r\n\t\tcase \"seoassistant\":\r\n\t\t\tStageBinding.handleViewPresentation(\"Composite.Management.SEOAssistant\");\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tself.getContentDocument().location.reload();\r\n\t\t\t}, 250);\r\n\t\t\tbreak;\r\n\t\t\tbreak;\r\n\t\tcase \"setscreen\":\r\n\t\t\tthis._box.focus();\r\n\t\t\tvar w = binding.getProperty(\"w\");\r\n\t\t\tvar h = binding.getProperty(\"h\");\r\n\t\t\tvar touch = binding.getProperty(\"touch\");\r\n\t\t\tvar viewMode = binding.getProperty(\"viewmode\");\r\n\r\n\t\t\tthis.setCurrentViewMode(viewMode);\r\n\r\n\t\t\tthis._customUrl = binding.getProperty(\"url\");;\r\n\t\t\tthis._isRequirePublicNet = binding.getProperty(\"requirepublicnet\");\r\n\t\t\tif (this._customUrl) {\r\n\t\t\t\tthis.setCustomUrl(this._customUrl);\r\n\t\t\t} else {\r\n\t\t\t\tif (this._targetUrl) {\r\n\t\t\t\t\tthis.setURL(this._targetUrl);\r\n\t\t\t\t\tthis._targetUrl = null;\r\n\t\t\t\t}\r\n\t\t\t\tvar browserView = this._box.getBrowserTabBinding();\r\n\t\t\t\tthis._box.select(browserView, true);\r\n\t\t\t}\r\n\t\t\tthis.setScreen(new Dimension(w, h), touch);\r\n\r\n\t\t\t//set screen button image\r\n\t\t\tvar setscreenbutton = this.bindingWindow.bindingMap.setscreenbutton;\r\n\t\t\tif (binding.image) {\r\n\t\t\t\tsetscreenbutton.setImage(binding.image);\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSOURCE: /* notice dependencies */\r\n\t\t\tthis._viewSource(cmd);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * View source.\r\n * @param {string} cmd\r\n */\r\nBrowserPageBinding.prototype._viewSource = function (cmd) {\r\n\tif (!Client.isAnyExplorer) {\r\n\t\twindow.open('view-source:' + this._box.getContentWindow().location.href);\r\n\t}\r\n}\r\n\r\n/**\r\n * Update broadcasters.\r\n */\r\nBrowserPageBinding.prototype._updateBroadcasters = function () {\r\n\r\n\tvar back = window.bindingMap.broadcasterHistoryBack;\r\n\tvar forward = window.bindingMap.broadcasterHistoryForward;\r\n\tvar browserview = window.bindingMap.broadcasterBrowserView;\r\n\r\n\tif (this._current.index > 0) {\r\n\t\tback.enable();\r\n\t} else {\r\n\t\tback.disable();\r\n\t}\r\n\tif (this._current.index < this._current.history.getLength() - 1) {\r\n\t\tforward.enable();\r\n\t} else {\r\n\t\tforward.disable();\r\n\t}\r\n\r\n\tif (!this.toolingOn || this._box.getGeneticViewTabBinding().isSelected) {\r\n\t\tbrowserview.disable();\r\n\t} else {\r\n\t\tbrowserview.enable();\r\n\t}\r\n\r\n\r\n\r\n\r\n}\r\n\r\n/**\r\n * Update hosted document (performed on load).\r\n */\r\nBrowserPageBinding.prototype._updateDocument = function () {\r\n\r\n\tvar win = this.getContentWindow();\r\n\tvar doc = this.getContentDocument();\r\n\r\n\t//Do not add context menu to UI Pages\r\n\tif (!UserInterface.getBinding(doc.body))\r\n\t\tDOMEvents.addEventListener(doc, DOMEvents.CONTEXTMENU, this);\r\n\tDOMEvents.addEventListener(win, DOMEvents.UNLOAD, this);\r\n\tDOMEvents.addEventListener(win, DOMEvents.MOUSEDOWN, this);\r\n\r\n\t/*\r\n\t * Paralyze links leading to external websites.\r\n\t */\r\n\tif (doc.links.length > 0) {\r\n\r\n\t\tvar self = this;\r\n\t\tvar span = this.bindingDocument.getElementById(\"externalurl\");\r\n\t\tvar blocker = this.bindingWindow.bindingMap.blocker;\r\n\r\n\t\tvar handler = {\r\n\t\t\thandleEvent: function (e) {\r\n\t\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\t\tvar link = DOMEvents.getTarget(e);\r\n\t\t\t\tspan.firstChild.data = link.href;\r\n\t\t\t\tblocker.show();\r\n\t\t\t\tself._blockertimeout = setTimeout(function () {\r\n\t\t\t\t\tblocker.hide();\r\n\t\t\t\t}, 2300);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar link, i = 0;\r\n\t\twhile ((link = doc.links[i++]) != null) {\r\n\t\t\tif (link.href.indexOf(\"//\") > -1) {\r\n\t\t\t\tvar host = link.href.split(\"//\")[1].split(\"/\")[0];\r\n\t\t\t\tif (host != window.location.host) {\r\n\t\t\t\t\tDOMEvents.addEventListener(link, DOMEvents.CLICK, handler);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get document from selected tab.\r\n * @return {DOMDocument}\r\n */\r\nBrowserPageBinding.prototype.getContentDocument = function () {\r\n\r\n\treturn this._box.getContentDocument();\r\n}\r\n\r\n/**\r\n * Get window from selected tab.\r\n * @return {DOMDocumentView}\r\n */\r\nBrowserPageBinding.prototype.getContentWindow = function () {\r\n\r\n\treturn this._box.getContentWindow();\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#handleEvent}\r\n * @implements {IEventListener}\r\n * @param {Event} e\r\n */\r\nBrowserPageBinding.prototype.handleEvent = function (e) {\r\n\r\n\tBrowserPageBinding.superclass.handleEvent.call(this, e);\r\n\r\n\tvar cover = window.bindingMap.cover;\r\n\tvar element = DOMEvents.getTarget(e);\r\n\r\n\tswitch (e.type) {\r\n\r\n\t\tcase DOMEvents.CONTEXTMENU:\r\n\t\t\tvar contextmenu = window.bindingMap.contextmenu;\r\n\t\t\tvar p1 = DOMUtil.getUniversalMousePosition(e);\r\n\t\t\tvar p2 = this.boxObject.getUniversalPosition();\r\n\t\t\tvar p3 = new Point(p1.x - p2.x, p1.y - p2.y);\r\n\t\t\tcontextmenu.snapToPoint(p3);\r\n\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\tbreak;\r\n\r\n\t\tcase DOMEvents.UNLOAD:\r\n\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.MOUSEDOWN:\r\n\t\t\tthis._box.focus();\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.WHEEL:\r\n\t\t\tif (element.id == BrowserPageBinding.DEVICE_TOUCHVIEW_FRAMEOVERLAY_ID) {\r\n\t\t\t\tthis._box.focus();\r\n\t\t\t\tvar delta = e.deltaY || e.detail || e.wheelDelta;\r\n\t\t\t\tdelta = Math.abs(delta) < 50 ? 50 * Math.sign(delta) : delta;\r\n\t\t\t\tthis.scrollDeviceFrame(delta);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.CLICK:\r\n\t\t\tif (element.id == BrowserPageBinding.DEVICE_TOUCHVIEW_FRAMEOVERLAY_ID) {\r\n\t\t\t\tthis._box.focus();\r\n\t\t\t\telement.style.display = \"none\";\r\n\t\t\t\tvar frame = this._box.getFrameElement();\r\n\t\t\t\tvar framePosition = frame.getBoundingClientRect();\r\n\t\t\t\tvar el = frame.contentWindow.document.elementFromPoint((e.clientX - framePosition.left) / this._frameTransformIndex, (e.clientY - framePosition.top) / this._frameTransformIndex);\r\n\t\t\t\tif (el) {\r\n\t\t\t\t\tif (el.tagName && [\"input\", \"textarea\"].indexOf(el.tagName.toLowerCase()) > -1 && [\"text\", \"textarea\", \"email\", \"password\", \"url\", \"radio\", \"checkbox\"].indexOf(el.type.toLowerCase()) > -1) {\r\n\t\t\t\t\t\tel.focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tel.click();\r\n\t\t\t\t}\r\n\t\t\t\telement.style.display = \"block\";\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n\r\nBrowserPageBinding.prototype.loadDeviceList = function () {\r\n\tvar request = DOMUtil.getXMLHTTPRequest();\r\n\tvar url = Resolver.resolve(BrowserPageBinding.DEVICE_LIST);\r\n\tvar devicepopup = window.bindingMap.devicepopup;\r\n\tdevicepopup.empty();\r\n\tvar bindingDocument = this.bindingDocument;\r\n\trequest.open(\"get\", url, true);\r\n\trequest.onreadystatechange = function () {\r\n\t\tif (request.readyState == 4) {\r\n\t\t\tif (request.status == 200) {\r\n\t\t\t\tvar response = request.responseXML;\r\n\t\t\t\tnew List(response.getElementsByTagName(\"group\")).each(function (devicegroup) {\r\n\t\t\t\t\tvar groupBinding = MenuGroupBinding.newInstance(bindingDocument);\r\n\t\t\t\t\tdevicepopup.add(groupBinding);\r\n\t\t\t\t\tgroupBinding.attach();\r\n\t\t\t\t\tnew List(devicegroup.getElementsByTagName(\"*\")).each(function (element) {\r\n\t\t\t\t\t\tvar itemBinding = MenuItemBinding.newInstance(bindingDocument);\r\n\t\t\t\t\t\tvar label = element.getAttribute(\"label\");\r\n\t\t\t\t\t\tvar image = element.getAttribute(\"image\");\r\n\t\t\t\t\t\titemBinding.setImage(image);\r\n\t\t\t\t\t\titemBinding.setLabel(label);\r\n\r\n\t\t\t\t\t\tswitch(element.nodeName.toLowerCase())\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcase \"device\":\r\n\t\t\t\t\t\t\t\tvar label = element.getAttribute(\"label\");\r\n\t\t\t\t\t\t\t\tvar image = element.getAttribute(\"image\");\r\n\t\t\t\t\t\t\t\tvar viewMode = element.getAttribute(\"viewmode\");\r\n\t\t\t\t\t\t\t\tvar w = element.getAttribute(\"w\");\r\n\t\t\t\t\t\t\t\tvar h = element.getAttribute(\"h\");\r\n\t\t\t\t\t\t\t\tvar touch = element.getAttribute(\"touch\");\r\n\t\t\t\t\t\t\t\tvar requirepublicnet = element.getAttribute(\"requirepublicnet\");\r\n\t\t\t\t\t\t\t\tvar urlProperty = element.getAttribute(\"url\");\r\n\t\t\t\t\t\t\t\titemBinding.setProperty(\"cmd\", \"setscreen\");\r\n\t\t\t\t\t\t\t\titemBinding.setProperty(\"viewmode\", viewMode);\r\n\t\t\t\t\t\t\t\titemBinding.setProperty(\"w\", w);\r\n\t\t\t\t\t\t\t\titemBinding.setProperty(\"h\", h);\r\n\t\t\t\t\t\t\t\titemBinding.setProperty(\"touch\", touch);\r\n\t\t\t\t\t\t\t\titemBinding.setProperty(\"requirepublicnet\", requirepublicnet);\r\n\t\t\t\t\t\t\t\titemBinding.setProperty(\"url\", urlProperty);\r\n\r\n\r\n\t\t\t\t\t\t\t\tif (!Application.isOnPublicNet && requirepublicnet) {\r\n\t\t\t\t\t\t\t\t\titemBinding.disable();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tgroupBinding.add(itemBinding);\r\n\t\t\t\t\t\titemBinding.attach();\r\n\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\trequest.send(null);\r\n}\r\n\r\n/**\r\n * Set Custom Url\r\n * @param {string} url\r\n */\r\nBrowserPageBinding.prototype.setCustomUrl = function (url) {\r\n\tvar targetUrl = this.getUrl();\r\n\turl = Resolver.resolve(url);\r\n\turl = url.replace(\"{url}\", targetUrl);\r\n\turl = url.replace(\"{encodedurl}\", encodeURIComponent(this._isRequirePublicNet ? targetUrl.replace(/\\/c1mode\\(unpublished\\)/, \"\") : targetUrl));\r\n\t//replace 2nd and next '?' to '&'\r\n\turl = url.replace(/(\\?)(.+)/g, function (a, b, c) { return b + c.replace(/\\?/g, \"&\") });\r\n\tthis.setFrameURL(url);\r\n}\r\n\r\n/**\r\n * Get Url\r\n */\r\nBrowserPageBinding.prototype.getUrl = function (url) {\r\n\treturn this._targetUrl ? this._targetUrl : this._box.getLocation();\r\n}\r\n\r\n/**\r\n * Set client width/height for browser iframe\r\n * For touch device view the Frame Overlay is created to imitate touch device: hand cursor, skip hover effects.\r\n * For touch device view next should work: focus form fields, handle click events, scroll on MOUSE WHEEL, on KEY UP/DOWN, fit window area by using CSS transform.scale feature.\r\n * @param {int} width\r\n */\r\nBrowserPageBinding.prototype.setScreen = function (dim, touch) {\r\n\r\n\tvar win = this._box.getBrowserWindow().bindingElement;\r\n\tvar frame = this._box.getFrameElement();\r\n\tvar isFrameCenteredXY = dim.w && dim.h && dim.h < win.offsetHeight;\r\n\r\n\tCSSUtil.attachClassName(win, \"deviceWindow\");\r\n\tCSSUtil.attachClassName(frame, \"deviceFrame\");\r\n\tCSSUtil.detachClassName(frame, \"centeredXY\");\r\n\tframe.contentWindow.document.getElementsByTagName('body')[0].style.overflowX = \"hidden\";\r\n\r\n\tif (isFrameCenteredXY) {\r\n\t\tCSSUtil.attachClassName(frame, \"centeredXY\");\r\n\t}\r\n\r\n\tif (dim.w) {\r\n\t\tvar width = touch ? dim.w + this.getScrollbarWidth() : dim.w;\r\n\t\tframe.style.width = width + \"px\";\r\n\t} else {\r\n\t\tframe.style.removeProperty(\"width\");\r\n\t}\r\n\r\n\tif (dim.h) {\r\n\t\tframe.style.height = dim.h + \"px\";\r\n\t} else {\r\n\t\tframe.style.removeProperty(\"height\");\r\n\t}\r\n\r\n\tvar frameOvl = document.getElementById(BrowserPageBinding.DEVICE_TOUCHVIEW_FRAMEOVERLAY_ID);\r\n\r\n\tif (touch && !frameOvl) {\r\n\t\tframeOvl = document.createElement('div');\r\n\t\tframeOvl.id = BrowserPageBinding.DEVICE_TOUCHVIEW_FRAMEOVERLAY_ID;\r\n\t\twin.appendChild(frameOvl);\r\n\r\n\t\tDOMEvents.addEventListener(frameOvl, DOMEvents.WHEEL, this);\r\n\t\tDOMEvents.addEventListener(frameOvl, DOMEvents.CLICK, this);\r\n\t}\r\n\r\n\tif (touch) {\r\n\t\tframeOvl.style.marginLeft = \"-\" + (this.getScrollbarWidth() / 2) + \"px\";\r\n\t\tframeOvl.style.width = dim.w + \"px\";\r\n\t\tframeOvl.style.height = dim.h + \"px\";\r\n\t\tframeOvl.className = isFrameCenteredXY ? 'centeredXY' : 'centeredX';\r\n\t}\r\n\r\n\t// Transform the frame if it doesn't fit the window area\r\n\tframe.style.removeProperty(\"transform\");\r\n\tCSSUtil.detachClassName(frame, \"transformed\");\r\n\tif (frameOvl) {\r\n\t\tframeOvl.style.display = touch ? \"block\" : \"none\";\r\n\t\tframeOvl.style.removeProperty(\"transform\");\r\n\t\tCSSUtil.detachClassName(frameOvl, \"transformed\");\r\n\t}\r\n\r\n\tvar hRatio = win.offsetHeight / dim.h;\r\n\tvar wRatio = win.offsetWidth / dim.w;\r\n\tvar isTransform = hRatio < 1 || wRatio < 1;\r\n\tif (isTransform) {\r\n\t\tthis._frameTransformIndex = hRatio < wRatio ? hRatio : wRatio;\r\n\t\tframe.style.transform = \"scale(\" + this._frameTransformIndex + \",\" + this._frameTransformIndex + \") translate(-50%, -50%)\";\r\n\t\tCSSUtil.attachClassName(frame, \"transformed\");\r\n\t\tif (touch) {\r\n\t\t\tvar translateStatement = isFrameCenteredXY ? \"translate(-50%, -50%)\" : \"translate(-50%, 0)\";\r\n\t\t\tframeOvl.style.transform = \"scale(\" + this._frameTransformIndex + \",\" + this._frameTransformIndex + \")\" + translateStatement;\r\n\t\t\tCSSUtil.attachClassName(frameOvl, \"transformed\");\r\n\t\t}\r\n\t} else {\r\n\t\tthis._frameTransformIndex = 1;\r\n\t}\r\n}\r\n\r\n/**\r\n  Helper fucntions with Device Frame\r\n*/\r\nBrowserPageBinding.prototype.getScrollbarWidth = function () {\r\n\tvar div, width = this.getScrollbarWidth.width;\r\n\tif (width === undefined) {\r\n\t\tdiv = document.createElement('div');\r\n\t\tdiv.innerHTML = '<div style=\"width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;\"><div style=\"width:1px;height:100px;\"></div></div>';\r\n\t\tdiv = div.firstChild;\r\n\t\tdocument.body.appendChild(div);\r\n\t\twidth = this.getScrollbarWidth.width = div.offsetWidth - div.clientWidth;\r\n\t\tdocument.body.removeChild(div);\r\n\t}\r\n\treturn width;\r\n};\r\n\r\nBrowserPageBinding.prototype.scrollDeviceFrame = function (delta) {\r\n\tvar doc = this._box.getFrameElement().contentWindow.document;\r\n\tdoc.documentElement.scrollTop += delta;\r\n\tdoc.body.scrollTop += delta; // Chrome\r\n}\r\n\r\n/**\r\n * Return perspective handle for browser\r\n */\r\nBrowserPageBinding.prototype.getSyncHandle = function () {\r\n\r\n\treturn this.systemViewDefinition.handle;\r\n}\r\n\r\n/**\r\n * Get system tree\r\n */\r\nBrowserPageBinding.prototype.getSystemTree = function () {\r\n\r\n\treturn this._viewBinding.getContentWindow().bindingMap.tree;\r\n}\r\n\r\n/**\r\n * Get system tree\r\n */\r\nBrowserPageBinding.prototype.getSystemPage = function () {\r\n\r\n\treturn this._viewBinding.getContentWindow().bindingMap.page;\r\n}\r\n\r\n/**\r\n * handle browser tab selected\r\n */\r\nBrowserPageBinding.prototype.onBrowserTabSelected = function () {\r\n\r\n\tif (Client.isEdge) {\r\n\t\tvar systemtoolbar = this.bindingWindow.bindingMap.systemtoolbar;\r\n\t\tsetTimeout(function () {\r\n\t\t\tsystemtoolbar._containAllButtons();\r\n\t\t}, 0);\r\n\t}\r\n}\r\n\r\n/**\r\n * handle browser tab selected\r\n */\r\nBrowserPageBinding.prototype.onBrowserTabUnselected = function () {\r\n\r\n\tEventBroadcaster.broadcast(\r\n\t\tBroadcastMessages.SYSTEMTREENODEBINDING_FOCUS,\r\n\t\t this.getSystemPage().node\r\n\t);\r\n}\r\n\r\n/**\r\n * new State\r\n */\r\nBrowserPageBinding.prototype.newState = function () {\r\n\r\n\tthis._stateKey = KeyMaster.getUniqueKey();\r\n\treturn this._stateKey;\r\n}\r\n\r\n/**\r\n * new State\r\n */\r\nBrowserPageBinding.prototype.getState = function () {\r\n\r\n\treturn this._stateKey;\r\n}\r\n\r\n\r\nBrowserPageBinding.prototype.getBundleSelector = function () {\r\n\r\n\tif (!this.shadowTree.bundleselector) {\r\n\t\tvar addressrightgroup = this.bindingWindow.bindingMap.addressrightgroup;\r\n\t\tvar selector = SelectorBinding.newInstance(this.bindingDocument);\r\n\t\tselector.setProperty(\"textonly\", true);\r\n\t\taddressrightgroup.bindingElement.insertBefore(selector.bindingElement, addressrightgroup.bindingElement.firstChild);\r\n\t\tselector.attach();\r\n\t\tselector.attachClassName(BrowserPageBinding.BUNDLE_CLASSNAME);\r\n\t\tthis.shadowTree.bundleselector = selector;\r\n\r\n\t\tselector.addActionListener(SelectorBinding.ACTION_SELECTIONCHANGED, {\r\n\t\t\thandleAction: (function (action) {\r\n\t\t\t\tvar binding = action.target;\r\n\r\n\t\t\t\tswitch (action.type) {\r\n\t\t\t\t\tcase SelectorBinding.ACTION_SELECTIONCHANGED:\r\n\t\t\t\t\t\tif (selector === binding) {\r\n\t\t\t\t\t\t\tvar entityToken = binding.getValue();\r\n\t\t\t\t\t\t\tthis.getSystemTree()._focusTreeNodeByEntityToken(entityToken);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}).bind(this)\r\n\t\t});\r\n\r\n\t}\r\n\r\n\treturn this.shadowTree.bundleselector;\r\n}\r\n\r\n\r\n/**\r\n * Auto expand tree\r\n */\r\nBrowserPageBinding.prototype._autoExpand = function () {\r\n\r\n\tvar tree = this.getSystemTree();\r\n\tvar treebody = tree.getTreeBodyBinding();\r\n\tvar width = treebody.bindingElement.clientWidth;\r\n\tvar scrollWidth = treebody.bindingElement.scrollWidth;\r\n\tif (scrollWidth > width)\r\n\t{\r\n\t\tvar splitbox = this.bindingWindow.bindingMap.browsersplitbox;\r\n\t\tvar splitter = splitbox.getSplitterBindings().getFirst();\r\n\t\tvar maxwidth = Math.floor(splitbox.getInnerWidth() / 2);\r\n\t\tvar offset = Math.min(maxwidth, scrollWidth + 10) - width;\r\n\t\tif(offset > 0){\r\n\t\t\tsplitter.offset = offset;\r\n\t\t\tsplitbox.refreshLayout();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/views/browser/BrowserTabBoxBinding.js",
    "content": "﻿BrowserTabBoxBinding.prototype = new TabBoxBinding;\r\nBrowserTabBoxBinding.prototype.constructor = BrowserTabBoxBinding;\r\nBrowserTabBoxBinding.superclass = TabBoxBinding.prototype;\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction BrowserTabBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BrowserTabBoxBinding\" );\r\n\r\n\t/**\r\n\t * @type {TabBinding}\r\n\t */\r\n\tthis._browserTabBinding = null;\r\n\r\n\t/**\r\n\t * @type {TabBinding}\r\n\t */\r\n\tthis._genericViewTabBinding = null;\r\n\r\n\t/**\r\n\t * @type {TabBinding}\r\n\t */\r\n\tthis._customTabBinding = null;\r\n\r\n\t/**\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\r\n\t/**\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBrowserTabBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[BrowserTabBoxBinding]\";\r\n}\r\n\r\n\r\n\r\n/**\r\n * Show URL.\r\n * @param {string} url.\r\n */\r\nBrowserTabBoxBinding.prototype.setURL = function ( url ) {\r\n\t\r\n\tvar tab = this.getBrowserTabBinding();\t\r\n\t//this.select(tab);\r\n\t//tab.select();\r\n\tvar win = tab.browserwindow;\r\n\twin.setURL(url);\r\n\r\n}\r\n\r\n/**\r\n * Get BrowserTabBinding\r\n * @param {string} url.\r\n */\r\nBrowserTabBoxBinding.prototype.getBrowserTabBinding = function () {\r\n\r\n\tif (!this._browserTabBinding) {\r\n\t\tthis._browserTabBinding = TabBinding.newInstance ( this.bindingDocument );\r\n\t\tvar win = WindowBinding.newInstance(this.bindingDocument);\r\n\t\twin.setProperty(\"native\", \"true\");\r\n\t\tthis._browserTabBinding.browserwindow = win;\r\n\t\tthis.appendTabByBindings ( this._browserTabBinding, win );\r\n\t}\r\n\t//hide tabs buttons\r\n\tthis.getTabsBinding().hide();\r\n\treturn this._browserTabBinding;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Get Generic View TabBinding\r\n * @param {string} url.\r\n */\r\nBrowserTabBoxBinding.prototype.getGeneticViewTabBinding = function () {\r\n\r\n\tif (!this._genericViewTabBinding) {\r\n\t\tthis._genericViewTabBinding = TabBinding.newInstance(this.bindingDocument);\r\n\r\n\t\tvar tree = GenericViewBinding.newInstance(this.bindingDocument);\r\n\t\tthis.appendTabByBindings(this._genericViewTabBinding, tree);\r\n\t\tthis._genericViewTabBinding.tree = tree;\r\n\t}\r\n\t//hide tabs buttons\r\n\tthis.getTabsBinding().hide();\r\n\treturn this._genericViewTabBinding;\r\n}\r\n\r\n/**\r\n * Get Custom View TabBinding\r\n * @param {string} url.\r\n */\r\nBrowserTabBoxBinding.prototype.getCustomViewTabBinding = function () {\r\n\r\n\tif (!this._customTabBinding) {\r\n\t\tthis._customTabBinding = TabBinding.newInstance(this.bindingDocument);\r\n\t\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:scrollbox\", this.bindingDocument);\r\n\t\tvar scrollbox = UserInterface.registerBinding(element, ScrollBoxBinding);\r\n\r\n\t\tvar iframe = DOMUtil.createElementNS(Constants.NS_XHTML, \"iframe\", this.bindingDocument);\r\n\t\tiframe.setAttribute(\"frameborder\", \"0\");\r\n\t\tiframe.frameBorder = 0;\r\n\t\tiframe.id = KeyMaster.getUniqueKey();\r\n\t\tscrollbox.bindingElement.appendChild(iframe);\r\n\t\tthis._customTabBinding.iframe = iframe;\r\n\t\tthis.appendTabByBindings(this._customTabBinding, scrollbox);\r\n\r\n\t\t//IE reload console on top location hash changed from iframe\r\n\t\t//For IE - js replacement instead default click behevior\r\n\t\tif (Client.isAnyExplorer) {\r\n\t\t\tDOMEvents.addEventListener(iframe, DOMEvents.LOAD, {\r\n\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\tif (iframe.src != \"about:blank\") {\r\n\t\t\t\t\t\tvar targethost = iframe.contentWindow.location.host;\r\n\t\t\t\t\t\tif (targethost == window.location.host) {\r\n\t\t\t\t\t\t\t//TODO: check perfomance and move to singleton handler\r\n\t\t\t\t\t\t\tvar handler = {\r\n\t\t\t\t\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\t\t\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\t\t\t\t\t\t\tvar link = DOMEvents.getTarget(e);\r\n\t\t\t\t\t\t\t\t\ttop.location.href = link.href;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tdoc = iframe.contentWindow.document;\r\n\t\t\t\t\t\t\tif (doc.links.length > 0) {\r\n\t\t\t\t\t\t\t\tvar link, i = 0;\r\n\t\t\t\t\t\t\t\twhile ((link = doc.links[i++]) != null) {\r\n\t\t\t\t\t\t\t\t\tif (link.target == \"_top\" && link.href.indexOf(\"#\") > 1) {\r\n\t\t\t\t\t\t\t\t\t\tDOMEvents.addEventListener(link, DOMEvents.CLICK, handler);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t}\r\n\t//hide tabs buttons\r\n\tthis.getTabsBinding().hide();\r\n\treturn this._customTabBinding;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Reload\r\n */\r\nBrowserTabBoxBinding.prototype.reload = function() {\r\n\tif (this.getBrowserTabBinding().isSelected) {\r\n\t\tthis.getContentDocument().location.reload();\r\n\t} else if (this.getCustomViewTabBinding().isSelected) {\r\n\t\tthis.getCustomViewTabBinding().iframe.contentWindow.location.reload();\r\n\t}\r\n}\r\n\r\n/**\r\n * Get URL from selected tab.\r\n * @return {string}\r\n */\r\nBrowserTabBoxBinding.prototype.getLocation = function () {\r\n\t\r\n\tvar tab = this.getBrowserTabBinding();\r\n\tvar win = tab.browserwindow;\r\n\tvar doc = win.getContentDocument();\r\n\tif (doc == null) {\r\n\t\treturn undefined;\r\n\t} else {\r\n\t\treturn new String(win.getContentDocument().location);\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Get currently active browser window.\r\n * @return {DOMDocument}\r\n */\r\nBrowserTabBoxBinding.prototype.getBrowserWindow = function () {\r\n\r\n\tvar tab = this.getBrowserTabBinding();\r\n\tvar win = tab.browserwindow;\r\n\treturn win;\r\n}\r\n\r\n\r\n/**\r\n * Get currently active document.\r\n * @return {DOMDocument}\r\n */\r\nBrowserTabBoxBinding.prototype.getContentDocument = function () {\r\n\r\n\tvar tab = this.getBrowserTabBinding();\r\n\tvar win = tab.browserwindow;\r\n\treturn win.getContentDocument ();\r\n}\r\n\r\n/**\r\n * Get currently active window.\r\n * @return {DOMDocumentView}\r\n */\r\nBrowserTabBoxBinding.prototype.getContentWindow = function () {\r\n\r\n\tvar tab = this.getBrowserTabBinding();\r\n\tvar win = tab.browserwindow;\r\n\treturn win.getContentWindow ();\r\n}\r\n\r\n/**\r\n * Get currently active frame.\r\n * @return {DOMDocumentView}\r\n */\r\nBrowserTabBoxBinding.prototype.getFrameElement = function () {\r\n\r\n\tvar tab = this.getBrowserTabBinding();\r\n\tvar win = tab.browserwindow;\r\n\treturn win.getFrameElement();\r\n}\r\n\r\n/**\r\n* Focus.\r\n* @implements {IFocusable}\r\n*/\r\nBrowserTabBoxBinding.prototype.focus = function () {\r\n\tthis.dispatchAction(Binding.ACTION_FOCUSED);\r\n\tthis.isFocused = true;\r\n};\r\n\r\n/**\r\n* Blur.\r\n* @implements {IFocusable}\r\n*/\r\nBrowserTabBoxBinding.prototype.blur = function () {\r\n\tthis.dispatchAction(Binding.ACTION_BLURRED);\r\n\tthis.isFocused = false;\r\n};"
  },
  {
    "path": "Website/Composite/content/views/browser/BrowserToolBarBinding.js",
    "content": "BrowserToolBarBinding.prototype = new ToolBarBinding;\r\nBrowserToolBarBinding.prototype.constructor = BrowserToolBarBinding;\r\nBrowserToolBarBinding.superclass = ToolBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction BrowserToolBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BrowserToolBarBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBrowserToolBarBinding.prototype.toString = function () {\r\n\r\n\treturn \"[BrowserToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {ToolBarBinding#flex}\r\n * @return\r\n */\r\nBrowserToolBarBinding.prototype.flex = function () {\r\n\t\r\n\tBrowserToolBarBinding.superclass.flex.call ( this );\r\n\t\r\n\tvar right = this._toolBarBodyRight;\r\n\tif ( right != null && right.isAttached ) {\r\n\t\tthis.bindingWindow.bindingMap.addressbar.maximize ( \r\n\t\t\t\tright.boxObject.getDimension ().w \r\n\t\t);\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/views/browser/LanguageSelectorBinding.js",
    "content": "LanguageSelectorBinding.prototype = new SelectorBinding;\r\nLanguageSelectorBinding.prototype.constructor = LanguageSelectorBinding;\r\nLanguageSelectorBinding.superclass = SelectorBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction LanguageSelectorBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"LanguageSelectorBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nLanguageSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[LanguageSelectorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {SelectorBinding#onBindingAttach}\r\n */\r\nLanguageSelectorBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tLanguageSelectorBinding.superclass.onBindingAttach.call ( this );\r\n\t \r\n\tvar browser = bindingMap.browserpage;\r\n\tbrowser.addActionListener ( BrowserPageBinding.ACTION_ONLOAD, this );\r\n\tbrowser.addActionListener ( BrowserPageBinding.ACTION_TABSHIFT, this );\r\n}\r\n\r\n/**\r\n * @overloads {SelectorBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n */\r\nLanguageSelectorBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tLanguageSelectorBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase BrowserPageBinding.ACTION_ONLOAD :\r\n\t\tcase BrowserPageBinding.ACTION_TABSHIFT :\r\n\t\t\tthis._updateLanguages ();\t\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * The server returns an array of objects with props:\r\n *     Name\r\n *     IsoName\r\n *     UrlMappingName\r\n *     Url\r\n *     IsCurrent\r\n */\r\nLanguageSelectorBinding.prototype._updateLanguages = function () {\r\n\t\r\n\tvar doc = bindingMap.browserpage.getContentDocument ();\r\n\t\r\n\tif ( doc != null ) {\r\n\t\t\r\n\t\tvar location = doc.location.toString ();\r\n\t\t\r\n\t\tWebServiceProxy.isFaultHandler = false;\r\n\t\tvar response = LocalizationService.GetPageOtherLocales ( location );\r\n\t\tWebServiceProxy.isFaultHandler = true;\r\n\t\t\r\n\t\tif ( !response instanceof SOAPFault ) {\r\n\t\t\tvar list = new List ( response );\r\n\t\t\tif ( list != null && list.hasEntries ()) {\r\n\t\t\t\tvar selections = new List ();\r\n\t\t\t\tlist.each ( function ( lang ) {\r\n\t\t\t\t\tselections.add ( \r\n\t\t\t\t\t\tnew SelectorBindingSelection (\r\n\t\t\t\t\t\t\tlang.Name,\r\n\t\t\t\t\t\t\tlang.Url,\r\n\t\t\t\t\t\t\tlang.IsCurrent,\r\n\t\t\t\t\t\t\tnull\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t\t\tthis.populateFromList ( selections );\r\n\t\t\t\tthis.show ();\r\n\t\t\t} else {\r\n\t\t\t\tthis.hide ();\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tthis.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Update browser window when selector is handled.\r\n * @overwrites {Selector#onValueChange}\r\n */\r\nLanguageSelectorBinding.prototype.onValueChange = function () {\r\n\t\r\n\tbindingMap.browserpage.setURL ( this.getValue ());\r\n}"
  },
  {
    "path": "Website/Composite/content/views/browser/browser.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<%@ Page Language=\"C#\" %>\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\t<title>Composite.Management.Browser</title>\r\n\t<control:styleloader runat=\"server\" />\r\n\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"browser.css.aspx\" />\r\n\t<script type=\"text/javascript\" src=\"BrowserAddressBarBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"BrowserPageBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"BrowserToolBarBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"BrowserTabBoxBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"LanguageSelectorBinding.js\"></script>\r\n</head>\r\n<body>\r\n\t<ui:broadcasterset>\r\n\t\t<ui:broadcaster id=\"broadcasterHistoryBack\" isdisabled=\"true\" />\r\n\t\t<ui:broadcaster id=\"broadcasterHistoryForward\" isdisabled=\"true\" />\r\n\t\t<ui:broadcaster id=\"broadcasterBrowserView\" isdisabled=\"true\" />\r\n\t</ui:broadcasterset>\r\n\t<ui:popupset>\r\n\t\t<ui:popup id=\"contextmenu\">\r\n\t\t\t<ui:menubody>\r\n\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t<ui:menuitem cmd=\"back\" label=\"${string:Composite.Web.PageBrowser:ContextMenu.Back}\" image=\"${icon:previous}\" image-disabled=\"${icon:previous-disabled}\" tooltip=\"${string:Website.Content.Views.Help.ToolTipBack}\" observes=\"broadcasterHistoryBack\" />\r\n\t\t\t\t\t<ui:menuitem cmd=\"forward\" label=\"${string:Composite.Web.PageBrowser:ContextMenu.Forward}\" image=\"${icon:next}\" image-disabled=\"${icon:next-disabled}\" tooltip=\"${string:Website.Content.Views.Help.ToolTipForward}\" observes=\"broadcasterHistoryForward\" />\r\n\t\t\t\t\t<ui:menuitem cmd=\"refresh\" label=\"${string:Composite.Web.PageBrowser:ContextMenu.Refresh}\" image=\"${icon:refresh}\" tooltip=\"${string:Website.Content.Views.Help.ToolTipRefresh}\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t\t<ui:menugroup id=\"viewsourcegroup\">\r\n\t\t\t\t\t<ui:menuitem cmd=\"viewsource\" label=\"${string:Composite.Web.PageBrowser:ContextMenu.ViewSource}\" image=\"${icon:editor-sourceview}\" />\r\n\t\t\t\t</ui:menugroup>\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\r\n\r\n\t\t<ui:popup id=\"toolboxpopupgroup\" />\r\n\t\t<ui:popup id=\"toolboxpopup\" position=\"bottom\" />\r\n\t\t<ui:popup id=\"moreactionspopup\" position=\"bottom\" />\r\n\t\t<ui:popup id=\"devicepopup\" position=\"bottom\">\r\n\t\t\t<ui:menubody>\r\n\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\t</ui:popupset>\r\n\t<ui:page id=\"browserpage\" binding=\"BrowserPageBinding\" image=\"${icon:browser}\">\r\n\t\t<ui:toolbar id=\"systemtoolbar\" class=\"system-toolbar\" binding=\"SystemToolBarBinding\" target=\"perspective\">\r\n\t\t\t<ui:toolbarbody/>\r\n\t\t\t<ui:toolbarbody id=\"moreactionstoolbargroup\">\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:toolbarbutton id=\"moreactionsbutton\" label=\"${string:Composite.Management:Website.Misc.Toolbar.LabelShowMoreActions}\" image=\"${icon:chevron-right-circle}\" popup=\"moreactionspopup\" flip=\"true\"/>\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>\r\n\t\t<ui:toolbar id=\"navbar\" class=\"dark nav-toolbar\" binding=\"BrowserToolBarBinding\">\r\n\t\t\t<ui:toolbarbody>\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:toolbarbutton id=\"toggletreebutton\" cmd=\"toggletree\" image=\"${icon:nodes}\" binding=\"CheckButtonBinding\" ischecked=\"true\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.TreeView.ToolTip}\"/>\r\n\t\t\t\t\t<ui:toolbarbutton class=\"btn-group-left\" cmd=\"back\" image=\"${icon:previous}\" image-disabled=\"${icon:previous-disabled}\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Back.ToolTip}\" observes=\"broadcasterHistoryBack\" />\r\n\t\t\t\t\t<ui:toolbarbutton class=\"btn-group-right\" cmd=\"forward\" image=\"${icon:next}\" image-disabled=\"${icon:next-disabled}\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Forward.ToolTip}\" observes=\"broadcasterHistoryForward\" />\r\n\t\t\t\t\t<ui:toolbarbutton cmd=\"refresh\" image=\"${icon:refresh}\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Refresh.ToolTip}\" />\r\n\t\t\t\t\t<ui:toolbarbutton cmd=\"home\" image=\"${icon:home}\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Home.ToolTip}\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t\t<ui:toolbarbody align=\"right\" class=\"max\" style=\"overflow: hidden;\">\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:datainput id=\"addressbar\" name=\"addressbar\" binding=\"BrowserAddressBarBinding\" autoselect=\"true\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t<ui:toolbargroup id=\"addressrightgroup\">\r\n\t\t\t\t\t<ui:toolbarbutton id=\"go\" image=\"${icon:input}\" image-disabled=\"${icon:input-disabled}\" isdisabled=\"true\" tooltip=\"${string:Composite.Web.PageBrowser:ToolBarButton.Go.ToolTip}\" />\r\n\t\t\t\t\t<ui:toolbarbutton id=\"setscreenbutton\" tooltip=\"${string:Composite.Web.PageBrowser:Menu.ViewMode}\"  image=\"${icon:browsedevicetype}\" popup=\"devicepopup\"  observes=\"broadcasterBrowserView\" />\r\n\t\t\t\t\t<ui:toolbarbutton cmd=\"seoassistant\" tooltip=\"${string:Composite.Web.SEOAssistant:SEOAssistant.ToolTip}\" image=\"${icon:seoassistant}\"  observes=\"broadcasterBrowserView\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>\r\n\t\t<ui:splitbox id=\"browsersplitbox\" orient=\"horizontal\" layout=\"2:7\" class=\"line\" >\r\n\t\t\t<ui:splitpanel type=\"explorer\" id=\"explorerpanel\">\r\n\t\t\t\t<div style=\"width:100%\" ></div>\r\n\t\t\t</ui:splitpanel>\r\n\t\t\t<ui:splitter />\r\n\t\t\t<ui:splitpanel>\r\n\t\t\t\t<ui:cover id=\"cover\" transparent=\"true\" busy=\"false\" />\r\n\t\t\t\t<ui:tabbox id=\"browsertabbox\" binding=\"BrowserTabBoxBinding\">\r\n\t\t\t\t\t<ui:tabs hidden=\"true\" />\r\n\t\t\t\t\t<ui:tabpanels style=\"position: relative;\">\r\n\t\t\t\t\t\t<ui:cover id=\"blocker\" transparent=\"false\" busy=\"false\" hidden=\"true\">\r\n\t\t\t\t\t\t\t<div id=\"message\">\r\n\t\t\t\t\t\t\t\t<ui:labelbox image=\"${icon:message}\"></ui:labelbox>\r\n\t\t\t\t\t\t\t\t<div id=\"text\">\r\n\t\t\t\t\t\t\t\t\t<ui:text label=\"External URL not loaded: \" />\r\n\t\t\t\t\t\t\t\t\t<span id=\"externalurl\">:)</span>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</ui:cover>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t</ui:splitpanel>\r\n\t\t</ui:splitbox>\r\n\r\n<%--\t\t<ui:toolbar class=\"statusbar\">\r\n\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<ui:selector binding=\"LanguageSelectorBinding\" id=\"langselector\" image=\"${icon:users-changepublicculture}\" tooltip=\"View translation\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>--%>\r\n\t</ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/browser/browser.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n#addressbar {\r\n\tfloat: left;\r\n\tmargin-top: 2px;\r\n\tpadding: 0 0 0 10px;\r\n}\r\n\r\n\r\n\t#addressbar input {\r\n\t\twidth: 100%;\r\n\t\theight: 100%;\r\n\t\tpadding-top: 2px;\r\n\t\tpadding-left: 5px;\r\n\t}\r\n\r\nui|cover#blocker {\r\n\tcursor: pointer !important;\r\n}\r\n\r\n#message {\r\n\tpadding: 22px;\r\n}\r\n\r\n#text {\r\n\tpadding-left: 44px;\r\n\t-moz-user-select: none;\r\n\tuser-select: none;\r\n\tpadding-top: 8px;\r\n}\r\n\r\n.deviceWindow {\r\n\toverflow: hidden;\r\n\tbackground: #444;\r\n}\r\n\r\n.deviceFrame {\r\n\tmargin: 0 auto;\r\n\toverflow-x: hidden;\r\n\toverflow-y: scroll;\r\n\tbackground: #fff;\r\n}\r\n\r\n#deviceframeoverlay {\r\n\tposition: absolute;\r\n\tbackground: transparent;\r\n\tcursor: pointer;\r\n\tcursor: url('/Composite/images/touch-cursor.png') 13 6, pointer;\r\n\toverflow: hidden;\r\n}\r\n\r\n.transformed {\r\n\tmargin: 0;\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\t-moz-transform-origin: 0 0;\r\n\ttransform-origin: 0 0;\r\n\t-webkit-transform-origin: 0 0;\r\n}\r\n\r\n.centeredX {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 50%;\r\n\t-webkit-transform: translateX(-50%);\r\n\t-ms-transform: translateX(-50%);\r\n\ttransform: translateX(-50%);\r\n}\r\n\r\n.centeredXY {\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\t-webkit-transform: translate(-50%, -50%);\r\n\t-ms-transform: translate(-50%, -50%);\r\n\ttransform: translate(-50%, -50%);\r\n}\r\n\r\nui|toolbar#breadcrumbbar {\r\n\tpadding: 0;\r\n}\r\n\r\n#browsertabbox ui|tabs {\r\n\tdisplay: none !important;\r\n}\r\n\r\n.selectorpopup ui|labelbox.image-and-text ui|labeltext {\r\n\tmargin-left: 4px;\r\n}\r\n\r\nui|selector.bundleselector {\r\n    min-width: 200px;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/browser/deviceoptions.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<devices>\r\n  <group>\r\n    <device label=\"Auto\" image=\"eye\" viewmode=\"1\"/>\r\n    <device label=\"Public Version\" image=\"item-publish\" viewmode=\"2\"/>\r\n  </group>\r\n  <group>\r\n    <device label=\"Desktop (1366x768)\" w=\"1366\" h=\"768\" image=\"screen\"/>\r\n    <device label=\"Tablet (1024x768)\" w=\"1024\" h=\"768\" image=\"tablet-landscape\" touch=\"true\"/>\r\n    <device label=\"Tablet (Portrait)\" w=\"768\" h=\"1024\" image=\"tablet\" touch=\"true\"/>\r\n    <device label=\"Small Tablet (800x600)\" w=\"800\" h=\"600\" image=\"tablet-landscape\" touch=\"true\"/>\r\n    <device label=\"Small Tablet (Portrait)\" w=\"600\" h=\"800\" image=\"tablet\" touch=\"true\"/>\r\n    <device label=\"Mobile\" w=\"320\" h=\"480\" image=\"smartphone\" touch=\"true\"/>\r\n  </group>\r\n  <group>\r\n    <device label=\"C1 Page Speed\" image=\"functioncall\" url=\"{url}?c1mode=perf\" />\r\n    <device label=\"Google PageSpeed Insights\" image=\"chart-bars\" url=\"https://developers.google.com/speed/pagespeed/insights/?tab=desktop&amp;url={encodedurl}\" requirepublicnet=\"true\" />\r\n    <device label=\"Markup Validation\" image=\"editor-formatsource\" url=\"https://validator.nu/?doc={encodedurl}\" requirepublicnet=\"true\" />\r\n  </group>\r\n  <group>\r\n    <device label=\"Page Source\" image=\"editor-sourceview\" url=\"${root}/content/views/dev/viewsource/viewsource.aspx?url={encodedurl}\"/>\r\n  </group>\r\n</devices>\r\n"
  },
  {
    "path": "Website/Composite/content/views/datatypedescriptor/ToXml.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"ToXml.aspx.cs\" Inherits=\"Composite_content_views_datatypedescriptor_ToXml\" %>\r\n\r\n<%@ Register TagPrefix=\"control\" TagName=\"httpheaders\" Src=\"~/Composite/controls/HttpHeadersControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"scriptloader\" Src=\"~/Composite/controls/ScriptLoaderControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"styleloader\" Src=\"~/Composite/controls/StyleLoaderControl.ascx\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n<head>\r\n    <title>DataTypeDescriptor to Xml</title>\r\n    <control:styleloader ID=\"Styleloader1\" runat=\"server\" />\r\n    <control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n</head>\r\n<body>\r\n    <ui:page label=\"DataTypeDescriptor to Xml\" image=\"${skin}/dialogpages/message16.png\">\r\n        <ui:scrollbox>\r\n            <asp:PlaceHolder ID=\"DataTypeDescriptorHolder\" runat=\"server\" />\r\n        </ui:scrollbox>\r\n    </ui:page>\r\n</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/datatypedescriptor/ToXml.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Configuration;\r\nusing System.Data;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Security;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Web.UI.WebControls;\r\nusing System.Web.UI.WebControls.WebParts;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Types;\r\nusing Composite.Data.DynamicTypes;\r\n\r\n\r\npublic partial class Composite_content_views_datatypedescriptor_ToXml : System.Web.UI.Page\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        string typeName = this.Request.QueryString[\"TypeName\"];\r\n\r\n        Type type = TypeManager.GetType(typeName);\r\n\r\n        DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type);\r\n        XElement element = dataTypeDescriptor.ToXml();\r\n\r\n        this.DataTypeDescriptorHolder.Controls.Add(new LiteralControl(new XElement(\"h3\", \"Xml\").ToString()));\r\n        this.DataTypeDescriptorHolder.Controls.Add(new LiteralControl(new XElement(\"pre\", element.ToString()).ToString()));\r\n\r\n        this.DataTypeDescriptorHolder.Controls.Add(new LiteralControl(new XElement(\"h3\", \"Xml attribute encoded xml\").ToString()));\r\n        XElement dummyElement = new XElement(\"Dummy\", new XAttribute(\"dummy\", element.ToString()));\r\n        string dummyString = dummyElement.ToString();\r\n        dummyString = dummyString.Remove(0, 13);\r\n        dummyString = dummyString.Remove(dummyString.Length - 3);\r\n        this.DataTypeDescriptorHolder.Controls.Add(new LiteralControl(new XElement(\"pre\", dummyString).ToString()));\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/datatypedescriptor/ToXml.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_content_views_datatypedescriptor_ToXml {\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Styleloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::StyleLoaderControl Styleloader1;\r\n    \r\n    /// <summary>\r\n    /// Scriptloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader1;\r\n    \r\n    /// <summary>\r\n    /// DataTypeDescriptorHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder DataTypeDescriptorHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/Developer.js",
    "content": "/**\r\nopen=\"false\" * @class\r\n */\r\nvar Developer = new function () {\r\n\t\r\n\tvar keys = {\r\n\t\t\t\r\n\t\t// VIEWS ............................................................................\r\n\t\t\r\n\t\t\t// ASPX views.\r\n\t\t\t\"xslt-preview\"\t                : \"${root}/../Spikes/Maw/XsltPreviewMarkup.aspx\",\r\n\t\t\t\"widget-editor\"\t                : \"${root}/../Spikes/Maw/WidgetEditor.aspx\",\r\n\t\t\t\"execition-ended\"\t\t\t\t: \"${root}/content/flow/FlowUICompleted.aspx\",\r\n\t\t\t\"server-error\"\t\t\t\t\t: \"${root}/content/misc/errors/error.aspx\",\r\n\t\t\t\"update-panel\"\t                : \"${root}/../Spikes/JEM/UpdatePanelDebug.aspx\",\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t\"editor-renderingeditor\" \t\t: \"${root}/content/views/editors/renderingeditor/renderingeditor.aspx\",\r\n\t\t\t\"editor-querytreeeditor\" \t\t: \"${root}/content/views/editors/querytreeeditor/querytreeeditor.aspx\",\r\n\t\t\t\"editor-imageeditor\" \t\t\t: \"${root}/content/views/editors/imageeditor/imageeditor.aspx?src=../../../../content/dialogs/wysiwygeditor/images/sample.jpg\",\r\n\t\t\t*/\r\n\t\t\t\r\n\t\t\t\"test-flexperimental\"\t\t\t: \"${root}/content/views/dev/developer/tests/ui/flexperimental.aspx\",\r\n\t\t\t\"test-crawlers\"\t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/crawlers.aspx\",\r\n\t\t\t\r\n\t\t\t\"test-pageeditorfull\"\t\t\t: \"${root}/content/views/dev/developer/tests/ui/pageeditorfull.aspx\",\r\n\t\t\t\"test-xslt\"\t\t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/xslt.aspx\",\r\n\t\t\t\"test-memory\"\t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/memory.aspx\",\r\n\t\t\t\"test-persistance\"\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/persistance.aspx\",\r\n\t\t\t\"test-domevents\"\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/domevents.aspx\",\r\n\t\t\t\"test-actionended\"\t\t\t\t: \"${root}/FlowUICompleted.aspx\",\r\n\t\t\t\r\n\t\t\t// GUI library tests.\r\n\t\t\t\"test-sourcecodeviewers\"\t\t: \"${root}/content/views/dev/developer/tests/ui/sourcecodeviewers.aspx\",\r\n\t\t\t\"test-icons\"\t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/icons.aspx\",\r\n\t\t\t\"test-iebug\"\t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/iebug.aspx\",\r\n\t\t\t\"test-relations\"\t\t\t\t: \"${root}/content/views/dev/developer/tests/fields/relations.aspx\",\r\n\t\t\t\"test-fields-selectors\"\t\t\t: \"${root}/content/views/dev/developer/tests/fields/selectors.aspx\",\r\n\t\t\t\"test-fields-datainputs\"\t\t: \"${root}/content/views/dev/developer/tests/fields/datainputs.aspx\",\r\n\t\t\t\"test-fields-specialdatainputs\" : \"${root}/content/views/dev/developer/tests/fields/specialdatainputs.aspx\",\r\n\t\t\t\"test-fields-htmldatadialog\"\t: \"${root}/content/views/dev/developer/tests/fields/htmldatadialog.aspx\",\r\n\t\t\t\"test-lazy\" \t\t\t\t\t: \"${root}/content/views/dev/developer/tests/fields/lazybindings.aspx\",\r\n\t\t\t\"test-fields-sourcecode\"\t\t: \"${root}/content/views/dev/developer/tests/fields/sourcodeeditors.aspx\",\r\n\t\t\t\"test-fields-sourceedit\"\t\t: \"${root}/content/views/dev/developer/tests/fields/sourceeditors.aspx\",\r\n\t\t\t\"test-fields-visualedit\"\t\t: \"${root}/content/views/dev/developer/tests/fields/visualeditors.aspx\",\r\n\t\t\t\"test-fields-wysiwyg\"\t\t\t: \"${root}/content/views/dev/developer/tests/fields/wyswiwygeditors.aspx\",\r\n\t\t\t\"test-textboxes\" \t\t\t\t: \"${root}/content/views/dev/developer/tests/fields/textboxes.aspx\",\r\n\t\t\t\"test-checkboxes\"\t\t\t\t: \"${root}/content/views/dev/developer/tests/fields/checkboxes.aspx\",\r\n\t\t\t\"test-radiogroups\"\t\t\t\t: \"${root}/content/views/dev/developer/tests/fields/radiogroups.aspx\",\r\n\t\t\t\"test-fields\"\t\t\t\t\t: \"${root}/content/views/dev/developer/tests/fields/all/fields.aspx\",\r\n\t\t\t\"test-trees\" \t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/trees.aspx\",\r\n\t\t\t\"test-splitboxes\" \t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/splitboxes.aspx\",\r\n\t\t\t\"test-tabboxes\" \t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/tabboxes.aspx\",\r\n\t\t\t\"test-buttons\" \t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/buttons.aspx\",\r\n\t\t\t\"test-menus\" \t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/menus.aspx\",\r\n\t\t\t\"test-focus\" \t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/focus.aspx\",\r\n\t\t\t\"test-special\" \t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/special.aspx\",\r\n\t\t\t\"test-style\"\t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/style.aspx\",\r\n\t\t\t\"test-nulltreeselect\"\t\t\t: \"${root}/content/views/dev/developer/tests/fields/nulltreeselector.aspx\",\r\n\t\t\t\"test-nonframework\"\t\t\t\t: \"${root}/content/views/dev/developer/tests/fields/nonframework.aspx\",\r\n\t\t\t\r\n\t\t\t\"test-marcusfun\" \t\t\t\t: \"${root}/content/views/dev/developer/tests/fields/postbackfun.aspx\", \r\n\t\t\t\"test-dmitryfun\" \t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/dmitryfun.aspx\",\r\n\t\t\t\"test-mothfun\" \t\t\t\t\t: \"${root}/content/views/dev/developer/tests/ui/updatemanager/updatemanager.aspx\",\r\n\t\t\t\r\n\t\t// DAILOGS ............................................................................\r\n\t\t\r\n\t\t\t// special dialogs\r\n\t\t\t\"dialog-imageselector\"\t\t\t: null, // see below\r\n\t\t\t\"server-error-dialog\"\t\t\t: \"${root}/content/misc/errors/error_dialog.aspx\",\r\n\t\t\r\n\t\t\t// APSX dialogs.\r\n\t\t\t\"dialog-function-parameters\"    : \"${root}/content/dialogs/functions/editFunctionCall.aspx?functionmarkup=<function name=\\\"Composite.Date.Now\\\" xmlns=\\\"http://www.composite.net/ns/function/1.0\\\"></function>\",\r\n\t\t\t\r\n\t\t\t// Dialog types\r\n\t\t\t\"dialog-autoheight\"\t\t\t\t: \"${root}/content/dialogs/tests/autoheight/autoheightdialog.aspx\",\r\n\t\t\t\"dialog-fixedheight\"\t\t\t: \"${root}/content/dialogs/tests/fixedheight/fixedheightdialog.aspx\",\r\n\t\t\t\"dialog-subpages\"\t\t\t\t: \"${root}/content/dialogs/tests/subpages/subpagedialog.aspx\",\r\n\t\t\t\"dialog-textcontent\"\t\t\t: \"${root}/content/dialogs/tests/textcontent/textcontent.aspx\",\r\n\t\t\t\"dialog-wizard\"\t\t\t\t\t: \"${root}/content/dialogs/tests/wizard/wizard1.aspx\",\r\n\t\t\t\"dialog-no-ajax-wizard\"\t\t\t: \"${root}/content/dialogs/tests/wizard/wizard3.aspx\",\r\n\t\t\t\"dialog-forcefitness-basic\"\t\t: \"${root}/content/dialogs/tests/forcefitness/forcefitness-basic.aspx\",\r\n\t\t\t\"dialog-forcefitness-advanced\"\t: \"${root}/content/dialogs/tests/forcefitness/forcefitness-advanced.aspx\",\r\n\t\t\t\"dialog-forcefitness-windowed\"\t: \"${root}/content/dialogs/tests/forcefitness/forcefitness-windowed.aspx\",\r\n\t\t\t\"dialog-subpageforcefitness\"    : \"${root}/content/dialogs/tests/subpageforcefitness/parent.aspx\",\r\n\t\t\t\r\n\t\t\t\"dialog-test-infobox\"\t\t\t: \"${root}/content/dialogs/tests/wizard/wizard4.aspx\"\r\n\t}\r\n\t\r\n\t/**\r\n\t * Load view.\r\n\t * @param {string} url The url to load.\r\n\t * @param {string} target The dock position.\r\n\t */\r\n\tthis.load = function ( key, target ) {\r\n\t\t\r\n\t\tswitch ( key ) {\r\n\t\t\tdefault :\r\n\t\t\t\tStageBinding.presentViewDefinition ( \r\n\t\t\t\t\tnew HostedViewDefinition ({\r\n\t\t\t\t\t\thandle\t\t: key,\r\n\t\t\t\t\t\turl \t\t: keys [ key ],\r\n\t\t\t\t\t\tposition \t: target ? target : DockBinding.MAIN\r\n\t\t\t\t\t})\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Load ViewDefinition.\r\n\t * @param {string} url The url to load.\r\n\t */\r\n\tthis.loadView = function ( key ) {\r\n\t\t\r\n\t\tvar definition = ViewDefinitions [ key ];\r\n\t\tStageBinding.presentViewDefinition ( \r\n\t\t\tdefinition\r\n\t\t);\r\n\t}\r\n\t\r\n\t/**\r\n\t * Launch modal dialog.\r\n\t * @param {string} key\r\n\t */\r\n\tthis.launch = function ( key ) {\r\n\t\t\r\n\t\tswitch ( key ) {\r\n\t\t\tcase \"dialog-imageselector\" :\r\n\t\t\t\tlaunchImageSelector ();\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"dialog-wysiwygimageselector\" :\r\n\t\t\t\tlaunchWysiwyg ();\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tDialog.invokeModal ( keys [ key ]);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t\r\n\t// SPECIAL ......................................................................\r\n\t\r\n\tfunction launchWysiwyg () {\r\n\t\t\r\n\t\tvar handler = {\r\n\t\t\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\t\t\talert ( result );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} \r\n\t\t\t\t\r\n\t\tvar arg = {\r\n\t\t\t\r\n\t\t\t// relevant for main window\r\n\t\t\ttinyAction\t\t\t: \"insert\",\r\n\t\t\ttinyWindow\t\t\t: null,\r\n\t\t\ttinyElement \t\t: null // TODO!\r\n\t\t}\r\n\t\t\r\n\t\tvar URL_IMAGETREESELECTOR = \"${root}/content/dialogs/wysiwygeditor/image/image.aspx\";\r\n\t\tDialog.invokeModal ( URL_IMAGETREESELECTOR, handler, arg );\r\n\t}\r\n\t\r\n\t\r\n\t/*\r\n\t * Launch image selector.\r\n\t */\r\n\tfunction launchImageSelector () {\r\n\t\r\n\t\tvar handler = {\r\n\t\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\t\talert ( result.getFirst ());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} \r\n\t\tvar arg = {\r\n\t\t\tlabel \t\t\t\t: \"Select Image\",\r\n\t\t\tkey \t\t\t\t: \"MediaFileProviderOnlyImages\",\r\n\t\t\tselectionProperty \t: \"ElementType\",\r\n\t\t\tselectionValue\t\t: \"image/jpeg image/gif image/png image/bmp image/tiff\",\r\n\t\t\tselectionResult\t\t: \"ElementId\"\r\n\t\t}\r\n\t\tDialog.invokeModal ( Dialog.URL_TREESELECTOR, handler, arg );\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/developer.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n    \r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Developer</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"Developer.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t\r\n\t\t<ui:page image=\"${icon:developer}\">\r\n\t\t\t\r\n\t\t\t<ui:tabbox id=\"developerviewtabbox\" selectedindex=\"0\" persist=\"selectedindex\">\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab label=\"Views\"/>\r\n\t\t\t\t\t<ui:tab label=\"Dialogs\"/>\r\n\t\t\t\t\t<ui:tab label=\"Actions\"/>\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tree>\r\n\t\t\t\t\t\t\t<ui:treebody>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"SourceEditor test\" oncommand=\"Developer.load('test-fields-sourceedit')\"/>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"UpdateManager fun\" oncommand=\"Developer.load('test-mothfun')\"/>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Non-framework doc\" oncommand=\"Developer.load('test-nonframework')\"/>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Bindings\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"DataBindings\" open=\"false\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Null Tree Selector\" oncommand=\"Developer.load('test-nulltreeselect')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Visualeditors\" oncommand=\"Developer.load('test-fields-visualedit')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Sourceeditors\" oncommand=\"Developer.load('test-fields-sourceedit')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Radiogroups\" oncommand=\"Developer.load('test-radiogroups')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Selectors\" oncommand=\"Developer.load('test-fields-selectors')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Wysiwyg Editors\" oncommand=\"Developer.load('test-fields-wysiwyg')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Sourcecode editors\" oncommand=\"Developer.load('test-fields-sourcecode')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"All DataBindings\" oncommand=\"Developer.load('test-fields')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"HTMLDataDialog\" oncommand=\"Developer.load('test-fields-htmldatadialog')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Relations\" oncommand=\"Developer.load('test-relations')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"LazyBindings\" oncommand=\"Developer.load('test-lazy')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"DataInputs\" oncommand=\"Developer.load('test-fields-datainputs')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"DataInputs Special\" oncommand=\"Developer.load('test-fields-specialdatainputs')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Textboxes\" oncommand=\"Developer.load('test-textboxes')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Checkboxes\" oncommand=\"Developer.load('test-checkboxes')\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"UIBindings\" open=\"false\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Tabboxes\" oncommand=\"Developer.load('test-tabboxes')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Menus and toolbars\" oncommand=\"Developer.load('test-menus')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Source code viewers\" oncommand=\"Developer.load('test-sourcecodeviewers')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Icons\" oncommand=\"Developer.load('test-icons')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Focus\" oncommand=\"Developer.load('test-focus')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Buttons\" oncommand=\"Developer.load('test-buttons')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Splitboxes\" oncommand=\"Developer.load('test-splitboxes')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Styles\" oncommand=\"Developer.load('test-style')\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Binding features\" open=\"false\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Memory\" oncommand=\"Developer.load('test-memory')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Persistance\" oncommand=\"Developer.load('test-persistance')\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Framework features\" open=\"false\">\r\n\t\t\t\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Trees\" oncommand=\"Developer.load('test-trees')\"/>\r\n\t\t\t\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"DOMEvents\" oncommand=\"Developer.load('test-domevents')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Crawlers\" oncommand=\"Developer.load('test-crawlers')\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Editors\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Permissions editor\" oncommand=\"Developer.loadView('Composite.Management.PermissionEditor')\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Stuff\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"FlowUICompleted\" oncommand=\"Developer.load('test-actionended')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Browser\" oncommand=\"Developer.loadView('Composite.Management.Browser')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Execution Ended\" oncommand=\"Developer.load('execition-ended')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Server Error\" oncommand=\"Developer.load('server-error')\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Atlas Tests\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Xslt preview\" oncommand=\"Developer.load('xslt-preview')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"WidgetEditor\" oncommand=\"Developer.load('widget-editor')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Update Panels\" oncommand=\"Developer.load('update-panel')\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t</ui:treebody>\r\n\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t<ui:tree>\r\n\t\t\t\t\t\t\t<ui:treebody>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Dialogs types\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Subpage fitness\" oncommand=\"Developer.launch ( 'dialog-subpageforcefitness' )\"/> \r\n\t\t\t\t\t\t\t \t\t<ui:treenode label=\"Fitness basic\" oncommand=\"Developer.launch ( 'dialog-forcefitness-basic' )\"/>\r\n\t\t\t\t\t\t\t \t\t<ui:treenode label=\"Fitness advanced\" oncommand=\"Developer.launch ( 'dialog-forcefitness-advanced' )\"/>\r\n\t\t\t\t\t\t\t \t\t<ui:treenode label=\"Fitness windowed\" oncommand=\"Developer.launch ( 'dialog-forcefitness-windowed' )\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Auto height dialog\" oncommand=\"Developer.launch('dialog-autoheight')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Fixed height dialog\" oncommand=\"Developer.launch('dialog-fixedheight')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Sub-page dialog\" oncommand=\"Developer.launch('dialog-subpages')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Wizard\" oncommand=\"Developer.launch('dialog-wizard')\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Misc garbage\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Text content bug\" oncommand=\"Developer.launch('dialog-textcontent')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Infobox wizard\" oncommand=\"Developer.launch('dialog-test-infobox')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"No Ajax Wizard\" oncommand=\"Developer.launch('dialog-no-ajax-wizard')\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Special dialogs\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Image selector\" oncommand=\"Developer.launch('dialog-imageselector')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Wysiwygeditor Image Selector\" oncommand=\"Developer.launch('dialog-wysiwygimageselector')\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Atlas tests\">\r\n\t\t\t\t\t\t\t \t\t<ui:treenode label=\"Edit Function Parameters\" oncommand=\"Developer.launch('dialog-function-parameters')\"/>\r\n\t\t\t\t\t\t\t \t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Standard dialogs\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Warning\" oncommand=\"Dialog.warning('Beware','You must beware.')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Message\" oncommand=\"Dialog.message('Did you know','Freja has many features.')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Error\" oncommand=\"Dialog.error('You are wrong','It is an error.')\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Question\" oncommand=\"Dialog.question('So what?','Now what?')\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t \t<ui:treenode label=\"Server Error\" oncommand=\"Developer.launch('server-error-dialog')\"/>\r\n\t\t\t\t\t\t\t</ui:treebody>\r\n\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:clickbutton label=\"Update MessageQueue\" oncommand=\"MessageQueue.update ()\" image=\"${icon:refresh}\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t\t\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/all/fields.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Fields</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\t\t\r\n\t\t\t<ui:errorset>\r\n\t\t\t\t<ui:error targetname=\"datainput23\" text=\"Welcome travellers!\"/>\r\n\t\t\t</ui:errorset>\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Fields\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:1\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\r\n\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t<ui:tree id=\"simpletree\" style=\"height: 100px;\" flex=\"false\">\r\n\t\t\t\t\t\t\t\t<ui:treebody>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"TreeNode A\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"TreeNode A1\" onbindingfocus=\"this.logger.debug(Math.random())\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"TreeNode A2\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"TreeNode A3\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"TreeNode B\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"TreeNode B1\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"TreeNode B2\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"TreeNode B3\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t</ui:treebody>\r\n\t\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datadialogs\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datadialog</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" label=\"Advanced options\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainputdialog</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"datainputdialog1\" value=\"1\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainputdialog + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"datainputdialog2\" value=\"1\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Checkboxes\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"check1\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"check2\" value=\"c2\" oncommand=\"alert('fister')\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"check3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"check4\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"check5\" value=\"c2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"check6\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Radiobuttons\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput23\" value=\"23\" type=\"integer\" error=\"Der er sket en beklagelig fejl!\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>radiogroup</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup1\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 1\" value=\"p1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 2\" value=\"p2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 3\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>radiogroup + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup2\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 1\" value=\"p1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 2\" value=\"p2\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 3\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Selectors\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>selector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector1\" label=\"(vælg farve)\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Blå\" value=\"2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Grøn\" value=\"3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sort\" value=\"4\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Pink\" value=\"5\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>selector + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector2\" label=\"(vælg farve)\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Blå\" value=\"2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Grøn\" value=\"3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sort\" value=\"4\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Pink\" value=\"5\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainputselector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputselector name=\"datainputselector1\" value=\"1\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"4\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"5\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:datainputselector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainputselector + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:datainputselector name=\"datainputselector2\" value=\"1\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"4\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"5\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:datainputselector>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Texboxes\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>textbox</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:textbox name=\"textbox1\" value=\"Text!\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>textbox + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:textbox name=\"textbox2\" value=\"Text!\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<ui:window url=\"fieldsframe.aspx\"/>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/all/fieldsframe.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n    \r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.MoreFields</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\r\n\t\t<ui:page label=\"More Fields\">\r\n\r\n\t\t\t<ui:pagehead>\r\n\t\t\t\t<ui:pageheading>Sub frame loaded!</ui:pageheading>\r\n\t\t\t\t<ui:pagedescription>This page should automatically be indexed in the tab order for keyboard navigation. Currently this fails in Mozilla.</ui:pagedescription>\r\n\t\t\t</ui:pagehead>\t\r\n\r\n\t\t\t<ui:fields>\r\n\t\t\t\r\n\t\t\t\t<ui:fieldgroup label=\"Datadialogs\">\r\n\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t<ui:fielddesc>datadialog</ui:fielddesc>\r\n\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" label=\"Advanced options\"/>\r\n\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t<ui:fielddesc>datainputdialog</ui:fielddesc>\r\n\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t<ui:datainputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"datainputdialog1\" value=\"1\" type=\"integer\"/>\r\n\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t<ui:fielddesc>datainputdialog + help</ui:fielddesc>\r\n\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t<ui:datainputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"datainputdialog2\" value=\"1\" type=\"integer\"/>\r\n\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t</ui:field>\r\n\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\r\n\t\t\t\t<ui:fieldgroup label=\"Checkboxes\">\r\n\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t<ui:fielddesc>checkbox</ui:fielddesc>\r\n\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"check1\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"check2\" value=\"c2\"/>\r\n\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"check3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t<ui:fielddesc>checkbox + help</ui:fielddesc>\r\n\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"check4\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"check5\" value=\"c2\"/>\r\n\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"check6\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t</ui:field>\r\n\t\t\t\t</ui:fieldgroup>\r\n\t\t\t</ui:fields>\r\n\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/checkboxes.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\t\t\r\n\t\t\r\n\t\t\r\n\t</head>\r\n\t<body>\r\n\t\t<form runat=\"server\" class=\"updateform updatezone\">\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Checkboxes\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Checkboxes\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"checkA1\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"checkA2\" value=\"c2\" oncommand=\"alert('fister')\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"checkA3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"checkB1\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"checkB2\" value=\"c2\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"checkB3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox REQUIRED</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:checkboxgroup required=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t\t\t\t<ui:labelbox class=\"invalid\" label=\"Selection required\" image=\"${icon:error}\"/>\r\n\t\t\t\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"checkC1\" value=\"c1\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"checkC2\" value=\"c2\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"checkC3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t</ui:fields>\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/datainputs.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n    \r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Fields\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\r\n\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Password + minlength</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"password\" password=\"true\" minlength=\"5\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Required</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" required=\"true\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Type</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" type=\"email\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Regexrule</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput3\" regexrule=\"^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,})+$\" error=\"Det er forkert\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Maxlength</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput4\" maxlength=\"3\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\" minlength=\"5\" onvaluechange=\"this.logger.debug (Math.random ())\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help string req</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"required string\" type=\"string\" required=\"true\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t -->\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/htmldatadialog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n    \r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\">function __doPostBack () {}</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"><!-- simulate dot net -->\r\n\t\t\t<ui:editorpage label=\"Fields\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\" id=\"savebutton\" image=\"${icon:save}\" image-disabled=\"${icon:save-disabled}\" label=\"Save\" observes=\"broadcasterCanSave\" />\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Visual editor control!\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>htmldatadialog</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:htmldatadialog \r\n\t\t\t\t\t\t\t\t\t\tcallbackid=\"fisgerloegsovs\" \r\n\t\t\t\t\t\t\t\t\t\tname=\"htmldatadialog\" \r\n\t\t\t\t\t\t\t\t\t\tformattingconfiguration=\"common\">\r\n\t\t\t\t\t\t\t\t\t\t<input name=\"alarm\" value=\"Fisterloegsovs!\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:htmldatadialog>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t</ui:fields>\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/lazybindings.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\t\t\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t\t\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Fields\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:lazybindingset>\r\n\t\t\t\t\t<ui:lazybinding bindingid=\"tabpanel2\" name=\"lazyA\"/>\r\n\t\t\t\t\t<ui:lazybinding bindingid=\"tabpanel3\" name=\"lazyB\"/>\r\n\t\t\t\t\t<ui:lazybinding bindingid=\"tabpanel4\" name=\"lazyC\"/>\r\n\t\t\t\t\t<ui:lazybinding bindingid=\"tabpanel5\" name=\"lazyD\"/>\r\n\t\t\t\t</ui:lazybindingset>\r\n\t\t\t\t\r\n\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"1\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"2\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"3\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"4\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"5\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel id=\"tabpanel1\">\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\" id=\"A\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel id=\"tabpanel2\">\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\" id=\"B\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel id=\"tabpanel3\">\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\" id=\"C\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel id=\"tabpanel4\">\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\" id=\"D\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel id=\"tabpanel5\">\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\" id=\"E\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/nonframework.aspx",
    "content": "<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<head>\r\n\t\t<title>Non Framework!</title>\r\n\t</head>\r\n\t<body>\r\n\t\t<form>\r\n\t\t\t<fieldset>\r\n\t\t\t\t<label>Hello</label>\r\n\t\t\t\t<input type=\"text\"/>\r\n\t\t\t</fieldset>\r\n\t\t\t<fieldset>\r\n\t\t\t\t<label>Hello</label>\r\n\t\t\t\t<textarea></textarea>\r\n\t\t\t</fieldset>\r\n\t\t\t<fieldset>\r\n\t\t\t\t<label>Hello</label>\r\n\t\t\t\t<select>\r\n\t\t\t\t\t<option>Hey</option>\r\n\t\t\t\t\t<option>Ho</option>\r\n\t\t\t\t\t<option>Hey</option>\r\n\t\t\t\t\t<option>Ho</option>\r\n\t\t\t\t</select>\r\n\t\t\t</fieldset>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/nulltreeselector.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Selectors</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\">function __doPostBack () {}</script>\r\n\t\t<script type=\"text/javascript\" src=\"NullPostBackDataDialogBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"NullPostBackDataDialogSelectorBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"nulltreeselector.aspx\" method=\"post\" class=\"updateform updatezone\"><!-- simulate dot net -->\r\n\t\t\t<ui:editorpage label=\"Null Tree Selector\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\" id=\"savebutton\" image=\"${icon:save}\" image-disabled=\"${icon:save-disabled}\" label=\"Save\" observes=\"broadcasterCanSave\" />\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Hello Master\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>This is it</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:nullpostbackdialog  \r\n\t\t\t\t\t\t\t\t\t\tcallbackid=\"HelloFister\" \r\n\t\t\t\t\t\t\t\t\t\thandle=\"Composite.Management.ImageSelectorDialog\" \r\n\t\t\t\t\t\t\t\t\t\tselectorlabel=\"Select something\" \r\n\t\t\t\t\t\t\t\t\t\tlabel=\"FriendlyValue\"\r\n\t\t\t\t\t\t\t\t\t\tvalue=\"DataValue\"/>\r\n\t\t\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector1\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t</ui:fields>\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/postbackfun.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.Test.FunctionEditor</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\t\t<ui:editorpage label=\"Function Editor\" id=\"functioneditortestpage\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"Input Parameters\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"Function Calls\" selected=\"true\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"Nothing\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t<ui:parametereditor>\r\n\t\t\t\t\t\t\t\t<textarea name=\"parameters\">hello!</textarea>\r\n\t\t\t\t\t\t\t</ui:parametereditor>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:functioneditor>\r\n\t\t\t\t\t\t\t\t<textarea name=\"function\">hello!</textarea>\r\n\t\t\t\t\t\t\t</ui:functioneditor>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Johnson\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"john1\" value=\"John!\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"john2\" value=\"John!\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"john3\" value=\"John!\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/radiogroups.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\t\t\r\n\t\t<script type=\"text/javascript\">\r\n\t\t//function __doPostBack () {\r\n\t\t//\t// simulate dot net\r\n\t\t//}\r\n\t\t</script>\r\n\t\t\r\n\t</head>\r\n\t<body>\r\n\t\t<form runat=\"server\" class=\"updateform updatezone\"> <!-- simulate dot net -->\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Checkboxes\" id=\"EditorPage\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction ( PageBinding.ACTION_DOPOSTBACK )\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Radiobuttons\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>radiogroup</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup1\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 1\" value=\"p1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 2\" value=\"p2\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 3\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>radiogroup + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup2\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 1\" value=\"p1\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 2\" value=\"p2\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 3\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t</ui:fields>\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/relations.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\">function __doPostBack () {}</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"><!-- simulate dot net -->\r\n\t\t\t<ui:editorpage label=\"Fields\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\" id=\"savebutton\" image=\"${icon:save}\" image-disabled=\"${icon:save-disabled}\" label=\"Save\" observes=\"broadcasterCanSave\" />\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"Radiobuttons\" />\r\n\t\t\t\t\t\t<ui:tab label=\"Checkboxes\" />\r\n\t\t\t\t\t\t<ui:tab label=\"Selectors\" />\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Single field relation\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Radiogroup</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup1\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Field one\" value=\"p1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Field two\" value=\"p2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Field three\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field id=\"field1\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field one</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"ONE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field id=\"field2\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field two</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"TWO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field id=\"field3\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field three</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput3\" value=\"THREE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Fieldgroup relation\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Radiogroup</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup1\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Fieldgroup one\" value=\"p1\" ischecked=\"true\" relate=\"fieldgroup1\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Fieldgroup two\" value=\"p2\" relate=\"fieldgroup2\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Fieldgroup three\" value=\"p3\" relate=\"fieldgroup3\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Fieldgroup one\" id=\"fieldgroup1\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput4\" value=\"HEJ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Fieldgroup two\" id=\"fieldgroup2\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput5\" value=\"DAV\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Fieldgroup three\" id=\"fieldgroup3\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput6\" value=\"HALLO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel />\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Single field relation\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Selector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector1\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Field one\" value=\"field1b\" relate=\"field1b\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Field two\" value=\"field2b\" relate=\"field2b\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Field three\" value=\"field3b\" relate=\"field3b\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field id=\"field1b\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field one</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1b\" value=\"ONE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field id=\"field2b\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field two</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2b\" value=\"TWO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field id=\"field3b\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field three</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput3b\" value=\"THREE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Fieldgroup relation\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Radiogroup</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup1\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Fieldgroup one\" value=\"p1\" ischecked=\"true\" relate=\"fieldgroup1\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Fieldgroup two\" value=\"p2\" relate=\"fieldgroup2\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Fieldgroup three\" value=\"p3\" relate=\"fieldgroup3\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Fieldgroup one\" id=\"fieldgroup1b\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput4\" value=\"HEJ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Fieldgroup two\" id=\"fieldgroup2b\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput5\" value=\"DAV\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Fieldgroup three\" id=\"fieldgroup3b\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Field</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput6\" value=\"HALLO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/selectors.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Selectors</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\">function __doPostBack () {}</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"><!-- simulate dot net -->\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Fields\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\" id=\"savebutton\" image=\"${icon:save}\" image-disabled=\"${icon:save-disabled}\" label=\"Save\" observes=\"broadcasterCanSave\" />\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\r\n\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\r\n\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Extreme selection count\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Selector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector1\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selection\" value=\"X\" />\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>SimpleSelector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:simpleselector required=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<select>\r\n\t\t\t\t\t\t\t\t\t\t\t<option>Choose...</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Lorem</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 2</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 3</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 4</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 5</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 6</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 7</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t\t\t</ui:simpleselector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>SimpleSelector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>This is the field help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:simpleselector required=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<select>\r\n\t\t\t\t\t\t\t\t\t\t\t<option>Choose...</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Lorem ipsum lirum larum skibet gaar til aabenraa</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 2</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 3</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 4</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 5</option>\r\n\t\t\t\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t\t\t</ui:simpleselector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>SimpleSelector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:simpleselector required=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<select>\r\n\t\t\t\t\t\t\t\t\t\t\t<option>Choose...</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Lorem ipsum lirum larum skibet gaar til aabenraa</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 2</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 3</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 4</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 5</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 6</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection 7</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"X\">Selection</option>\r\n\t\t\t\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t\t\t</ui:simpleselector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Layout reference...</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"selectorRequired\" required=\"true\" label=\"Choose now...\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hej\" value=\"thevalue\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Required selectors\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Required selector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"selectorRequired\" required=\"true\" label=\"Choose now...\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hej\" value=\"thevalue\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Multiselectors\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>multiselector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:multiselector name=\"multiselector1\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sporvognsaktieselskabskinneskidtsraberpersonalebeklningsmagasinforvalter\" value=\"2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Gr\" value=\"3\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sort\" value=\"4\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Pink\" value=\"5\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Grlilla\" value=\"6\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Smaddersort\" value=\"7\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Gaypink\" value=\"8\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t\t</ui:multiselector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>multiselector + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>This is the help.</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:multiselector name=\"multiselector2\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sporvognsaktieselskabskinneskidtsraberpersonalebeklningsmagasinforvalter\" value=\"2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kontakt presse\" value=\"2973a746-15ef-46cc-9219-c15f626837e9\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kontakt analyse\" value=\"afa09d69-b4f5-4d95-ae9a-e74cd92f445e\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kontakt JobASE\" value=\"cc658e90-debf-433c-b30b-4076ce0a6c37\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kontakt Topdanmark\" value=\"ebf87b5c-0e4c-4ea4-a0b6-4915a1bebe33\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kontakt IT\" value=\"d38cff0d-c418-4b5b-a08f-b0a4ecc48283\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Bestil ASE+ materiale\" value=\"3a3042a8-17f1-4cd6-922d-58789e837d5c\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Bestil materiale\" value=\"0c7c1a34-f5e0-4a66-8fd4-a618627b5654\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Selvsyn\" value=\"933b9e3c-37cb-4163-805c-ed69c2a84889\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"L Selvsyn\" value=\"38c11555-91ea-4897-ac89-987aa3bcfdad\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Nyt til medlemmer\" value=\"85213064-e4be-4230-a57a-8ed36c9774c9\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Nyt fra ASE\" value=\"398dd8d0-c262-40e3-a6ea-60f3594b5ef2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Pressemeddelelser\" value=\"9af1e352-1025-49ca-8047-43c55790b01f\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Analyser\" value=\"c4a766a2-72ee-43a1-9617-28f1eb0a9a60\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hent brochurer\" value=\"4c8ae413-a0dd-42ce-8166-e1473e3d296d\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hent blanketter\" value=\"2e76715a-9507-405a-86b8-b34dd032e517\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Opbygning\" value=\"3aa679f9-2bd4-495f-9675-b18b64b5038c\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Organisation\" value=\"3990dd19-e5c8-42fb-b69e-4f85530ffef3\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Bestyrelse\" value=\"28c66a82-d4b5-4133-a86c-d90f1599b7a9\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Vedtter\" value=\"582c3d67-0579-441b-9ecd-413209cd1e53\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kort om ASE \" value=\"3afd29d8-3001-47a1-a3c9-4d0279b1c9ca\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASEs bestyrelsesformand\" value=\"35815b89-7320-4951-8e90-b1b21885b647\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASEs direkt \" value=\"1a9980c7-4353-4267-8a29-642151abcb0a\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"S job i ASE\" value=\"e2c1c610-065e-4982-b20b-cebda6815eeb\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Anstelsesforhold\" value=\"87cee400-4605-4f8e-8618-c665c12a1f4d\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASEs afdelinger\" value=\"911c926a-7623-4466-ae8e-e81619082250\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kontakt HR\" value=\"32f15221-5dd4-431a-9c75-a0866a03e49e\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mere om afdelingerne\" value=\"a82f9220-ec52-41f0-826b-22f9153bdbb7\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"M en medarbejder\" value=\"cb6f6c9d-fdc0-41ef-a17f-8147644c4dd9\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spg Hanne\" value=\"f750f09e-2fe7-4a35-a7d3-88c1bf2e99d5\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Job i ASE\" value=\"19b6d95a-c173-443e-a5bb-a08b974da1db\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Medarbejdere i HR\" value=\"5e92803f-2c29-4342-af21-5139cac436e6\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Udbetalingsdatoer\" value=\"3ee9308c-1f51-4b62-894f-4edfa3803e28\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Jobnet\" value=\"5de96ca5-63ba-4752-835a-9250598c566b\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"SVU-stte\" value=\"888bec70-a46a-48a6-9eec-9f83983c7070\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"VEU-godtgelse\" value=\"6dc47b4a-e555-490c-bc81-7bca7d02f35b\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Husk SKAT\" value=\"7464ffe2-b5f9-4f0f-879c-8c326943ec92\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Satser\" value=\"0ef24711-6431-4943-922a-282fa01841d0\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mere om dagpenge\" value=\"65d90f26-e814-4959-9ef2-38913bea909f\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mere om efterl\" value=\"3e584ea1-0317-4aa0-b69c-4f782470399c\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mere om prie\" value=\"15db4e7d-b9f6-452c-9d99-a97bf712048e\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Fortrydelsesordning\" value=\"e202e827-cebf-431d-b551-2c878f0c753c\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mit ASE\" value=\"4179868d-3542-4f44-b60f-27f4f4ac082d\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Support\" value=\"e5346f0d-8129-477f-acfd-b3024072b222\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Tjekliste ledig\" value=\"710cf24f-8638-4b9b-8355-5c05d7657351\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Tjekliste righed\" value=\"b4927d92-6eeb-4983-9d1c-f5b822390b23\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Tjekliste efterl\" value=\"4c745004-4ad7-40eb-bdd3-33e396ff0965\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Tjekliste efterlsbevis\" value=\"adf2edca-a827-41e9-952c-c5896fa12911\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Ekstra fordele\" value=\"5bcf5a6c-69af-451b-8f25-b0f343400adb\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Alt om ASE+\" value=\"cecc4609-b817-452b-ad4d-553515e796c1\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Beregn\" value=\"9457d08d-eb27-4a81-b816-155f3fed8198\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mere om ASE+\" value=\"9f9571be-73c3-4e6f-913f-0930628df700\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sammenlign priser \" value=\"f3ccfa8e-1ec9-4aa1-a280-9efd235ca919\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Se filmene\" value=\"bf3e7cdd-5691-4222-995c-b2f104e9be1a\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hent ringetone\" value=\"2058aa5a-76b0-47e4-8a58-944a774fc722\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Medlemsfordele\" value=\"65a19379-e504-458b-925c-b3631641e994\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Dine genveje\" value=\"8470d50d-0fb6-4019-93e4-e382937db110\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Meld dig ind i nu!\" value=\"680a7de5-5c5b-43b9-abb1-2a670ddeaf85\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Din jobportal\" value=\"407676e0-15ae-43e6-8439-522c68efd547\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Vind lre prier \" value=\"a2c06a7b-6418-4b06-b127-a567874aaee5\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Tilmeld dig OASEN\" value=\"27eedaa4-a643-4d05-9623-6ce4b32d9bbd\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Skaf et medlem \" value=\"c00ba432-106d-44b3-9902-8c517d89ca29\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Tilmeld dig BS \" value=\"94938c77-d744-4ff9-86f9-37a46e43d980\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Lukkedage i 2008\" value=\"fc7942dd-00c6-4ffe-ad44-371b45cbee8f\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Ser du job?\" value=\"9b25681f-e072-4968-b715-a6b26163c710\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hent vedtter\" value=\"32bf45a0-afe2-42b7-8b52-4ef7a9f08d88\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kontakt billedarkiv\" value=\"6e0c9ba6-d067-4185-897c-844013c7b36a\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Ros og ris redaktionen\" value=\"c60206a9-c65a-4753-8110-1e020ee40dad\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Annonc i Selvsyn\" value=\"aa41b0e9-3d30-48a4-9c96-c0951646e6b1\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Img test\" value=\"da9155d7-5841-4943-b043-34d0ff9bde28\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Test af billede i MWR\" value=\"cb634f26-1923-467f-9e90-2dd03ad13220\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Test Ib\" value=\"09934033-2c11-4600-b7fd-9b624d893711\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Seneste Selvsyn\" value=\"44ca2b79-4686-4a5e-b0e5-1558af9a8ba6\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Rotation\" value=\"13440a1c-b9e5-4591-a259-b19456880138\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Bliv Medlem\" value=\"4be716d2-46cd-4748-ae5c-06cc5fdef88f\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Vd at vide DK\" value=\"f0030ecd-34e2-434b-8f72-0b786fd83c2c\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Ring til os\" value=\"8d306203-4197-4bf6-a8d0-daa820244d0a\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ningstider\" value=\"8bef4294-af35-4ce2-ab2e-3d57dd99f2c0\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Send os en fax\" value=\"23828455-c181-41f7-84bb-951a0b986ec1\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASE Midtjylland\" value=\"d8dd8bf9-0a55-4f78-b8e4-c40279973fb2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hovedstaden\" value=\"3b19102a-bf85-4f5f-911c-af023878e6a4\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASE Sydjylland\" value=\"d45238b1-8bcd-4ef4-91f7-2f0f8adf3907\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASE Fyn\" value=\"41fe8988-a51d-4857-b4f8-704344ced993\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASE Sjland\" value=\"af77b028-ecc6-4a8c-9f98-9db560dad2ea\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASE Nordjylland\" value=\"2eca86d1-14e7-46a1-9e09-b276c4e813a1\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASE Danmark\" value=\"12d0104e-9fae-43b9-a5e5-586299a17a72\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"ASE Hovedstaden\" value=\"ed305707-9b57-4e85-9d50-fd2dad665ef2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"SMS service\" value=\"3dc07880-7591-4808-a229-2efbdccfb352\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Medlem skaffer medlem\" value=\"fae3083d-f1e1-4abf-a8d4-7e3851235e8a\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Test Img_rotator\" value=\"049ceb4d-9324-4a93-89de-af401fac5e07\" />\r\n\t\t\t\t\t\t\t\t\t</ui:multiselector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Selectors\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Selector with loads of text</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector1\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sporvognsaktieselskabskinneskidtsraberpersonalebeklningsmagasinforvalter\" value=\"2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Gr\" value=\"3\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sort\" value=\"4\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Pink\" value=\"5\" />\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>selector with lots of selections</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector2\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"A\" value=\"A2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"B\" value=\"A3\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"C\" value=\"A4\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"D\" value=\"A5\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"E\" value=\"A6\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"F\" value=\"A7\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"G\" value=\"A8\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"H\" value=\"A9\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"I\" value=\"A10\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"J\" value=\"A11\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"K\" value=\"A12\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"L\" value=\"A13\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"M\" value=\"A14\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"N\" value=\"A15\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"O\" value=\"A16\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"P\" value=\"A17\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Q\" value=\"A18\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"R\" value=\"A19\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"S\" value=\"A20\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"T\" value=\"A21\" />\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>selector + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector3\" label=\"(vg farve)\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sporvognsaktieselskabskinneskidtsraberpersonalebeklningsmagasinforvalter\" value=\"1\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Bl\" value=\"2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Gr\" value=\"3\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sort\" value=\"4\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Pink\" value=\"5\" />\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>selector with class</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:selector name=\"selector3\" label=\"(vg farve)\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection image=\"${icon:delete}\" label=\"Icon\" value=\"1\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection image=\"${class:fonticon fonticon-asterisk}\" label=\"ClassName asterisk\" value=\"2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection image=\"${class:fonticon fonticon-cloud}\" label=\"ClassName cloud\" value=\"3\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection image=\"${class:fonticon fonticon-envelope}\" label=\"ClassName envelope\" value=\"4\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection image=\"${class:fonticon fonticon-pencil}\" label=\"ClassName pencil\" value=\"5\" />\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\r\n\t\t\t\t\t\t\t<%--<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainputselector</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainputselector name=\"datainputselector1\" value=\"1\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"3\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"4\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"5\" />\r\n\t\t\t\t\t\t\t\t\t</ui:datainputselector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>datainputselector + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainputselector name=\"datainputselector2\" value=\"1\" type=\"integer\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"2\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"3\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"4\" />\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection value=\"5\" />\r\n\t\t\t\t\t\t\t\t\t</ui:datainputselector>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>--%>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\r\n\t\t\t\t\t</ui:fields>\r\n\r\n\t\t\t\t</ui:scrollbox>\r\n\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/sourceeditors.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Fields.SourceCodeEditors</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Source Code Editors\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"XML Editor\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"Editor Gallery\" selected=\"true\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t<ui:sourceeditor syntax=\"xml\">\r\n\t\t\t\t\t\t\t\t<textarea name=\"XMLEDITOR\">&lt;root&gt;&lt;/root&gt;</textarea>\r\n\t\t\t\t\t\t\t</ui:sourceeditor>\r\n\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"XSL\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"XML\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"XHTML\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"JS\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"C#\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"CSS\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:tab label=\"SQL\"/>\r\n\t\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t<ui:sourceeditor syntax=\"xsl\" debug=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:sourceeditor syntax=\"xml\" debug=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:sourceeditor syntax=\"html\" debug=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:sourceeditor syntax=\"js\" debug=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:sourceeditor syntax=\"cs\" debug=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:sourceeditor syntax=\"css\" debug=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:sourceeditor syntax=\"sql\" debug=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/sourcodeeditorbug/testA.html",
    "content": "<html>\r\n\t<head>\r\n\t\t<title>SourceCodeEditor Bug</title>\r\n\t</head>\r\n\t<body>\r\n\t\t<p>Nested iframes will provoke a focus bug in Internet Explorer.</p>\r\n\t\t<iframe style=\"width:100%;height:40%;\" src=\"testB.html\"></iframe>\r\n\t\t<br/><br/>\r\n\t\t<iframe style=\"width:100%;height:40%;\" src=\"testB.html\"></iframe>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/sourcodeeditorbug/testB.html",
    "content": "<html>\r\n\t<head>\r\n\t\t<title>Testing!</title>\r\n\t</head>\r\n\t<body>\r\n\t\t<iframe style=\"width:100%;height:100%;\" src=\"testC.html\"></iframe>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/sourcodeeditorbug/testC.html",
    "content": "<html>\r\n\t<head>\r\n\t\t<title>Testing!</title>\r\n\t</head>\r\n\t<body>\r\n\t\t<iframe style=\"width:100%;height:100%;\" src=\"http://localhost/website/Composite/content/misc/editors/sourcecodeeditor/codepress/codepress.html?language=javascript\"></iframe>\t\t\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/specialdatainputs.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Fields\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\r\n\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:fieldgroup label=\"Special DataInputBindings\">\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>URL</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"url\" value=\"http://\" type=\"url\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Identifier</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"programmingidentifier\" type=\"programmingidentifier\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t<ui:fielddesc>Namespace</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t<ui:datainput name=\"programmingnamespace\" type=\"programmingnamespace\"/>\r\n\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/textboxes.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\t\t\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t\t\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\t\t\r\n\t\t\t<ui:editorpage label=\"Fields\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"Used in fields\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"Used standalone\" selected=\"true\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:fields>\t\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>textbox</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:textbox name=\"textbox1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>editortextbox</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:editortextbox name=\"editortextbox1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:flexbox>\r\n\t\t\t\t\t\t\t\t<ui:editortextbox name=\"editortextbox2\">\r\n\t\t\t\t\t\t\t\t\t<textarea>Creating a TextRange object on the \r\nbody will not include the content \r\ninside a textArea or button. Conversely, \r\nyou cannot change the start or end \r\nposition of a text range over the textArea \r\nor button to move outside the \r\nscope of these particular elements. \r\nUse the properties provided on each element, \r\nisTextEdit and parentTextEdit, to walk the hierarchy. \r\nIf the document above contained a textArea, \r\na createTextRange on the body object would not \r\nfind the position where the user actually clicked. \r\nThe following reworks the above example to handle this case.\r\n\t\t\t\t\t\t\t\t\t</textarea>\r\n\t\t\t\t\t\t\t\t</ui:editortextbox>\r\n\t\t\t\t\t\t\t</ui:flexbox>\r\n\t\t\t\t\t\t\t<div style=\"padding: 10px; font-weight: bold;\">Use classname \"full\" on the editortextbox!</div>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/visualeditors.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Fields.WysiwygEditors</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\r\n\t\t\t<ui:editorpage label=\"Visual Editors\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\r\n\t\t\t\t<ui:lazybindingset>\r\n\t\t\t\t\t<ui:lazybinding bindingid=\"testlazystuff\" name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_lazybindingactivated1\"/>\r\n\t\t\t\t</ui:lazybindingset>\r\n\t\t\t\t\t\r\n\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"Hallo\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:visualeditor \r\n\t\t\t\t\t\t\t\tformattingconfiguration=\"common\">\r\n\t\t\t\t\t\t\t\t<textarea name=\"FlowUI$Document$DocumentBody$TabPanels$PageContentEditor13$contentplaceholder\" rows=\"2\" cols=\"20\" id=\"FlowUI_Document_DocumentBody_TabPanels_PageContentEditor13_contentplaceholder\" placeholderid=\"contentplaceholder\" placeholdername=\"Content\" selected=\"true\">&lt;html xmlns=\"http://www.w3.org/1999/xhtml\"&gt;\r\n\t&lt;head&gt;&lt;/head&gt;\r\n\t&lt;body&gt;\t\r\n\t\t&lt;p&gt;This is yet another an update!&lt;/p&gt;\r\n\t\t&lt;p&gt;Now with &lt;strong&gt;multiple&lt;/strong&gt; lines!&lt;/p&gt;\r\n\t\t&lt;p&gt;\r\n\t\t\t&lt;img src=\"/Renderers/ShowMedia.ashx?i=MediaArchive%3a%2fberlin02.jpg\" /&gt;\r\n\t\t&lt;/p&gt;\r\n\t&lt;/body&gt;\r\n&lt;/html&gt;</textarea>\r\n\t\t\t\t\t\t\t</ui:visualeditor>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/fields/wyswiwygeditors.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Fields.WysiwygEditors</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form action=\"javascript://\" method=\"get\"> <!-- simulate dot net -->\r\n\t\r\n\t\t\t<ui:editorpage label=\"Visual Editors\">\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<ui:toolbarbutton  \r\n\t\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE)\"\r\n\t\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\t\tlabel=\"Save\"\r\n\t\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\"/>\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\r\n\t\t\t\t<ui:lazybindingset>\r\n\t\t\t\t\t<ui:lazybinding bindingid=\"testlazystuff\" name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_lazybindingactivated1\"/>\r\n\t\t\t\t</ui:lazybindingset>\r\n\t\t\t\t\t\r\n\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"Nothing\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"Page Editor\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<div>Nothing to see.</div>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel id=\"testlazystuff\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<ui:wysiwygeditor type=\"pageeditor\" embedablefieldstypenames=\"\">\r\n\t\t\t\t\t\t\t\t<ui:selector name=\"selector\">\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Template1\" value=\"tempalteID1\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Template2\" value=\"tempalteID2\" selected=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:selection label=\"Template3\" value=\"tempalteID3\"/>\r\n\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t<ui:updatepanel>\r\n\t\t\t\t\t\t\t\t\t<ui:updatepanelbody>\r\n\t\t\t\t\t\t\t\t\t\t<textarea placeholdername=\"TopBar\" name=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl01$UiControl13$contentTextBox\">Hej</textarea>\r\n\t\t\t\t\t\t\t\t\t\t<textarea placeholdername=\"Content\" selected=\"true\" name=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl01$UiControl13$contentTextBox2\">Dav</textarea>\r\n\t\t\t\t\t\t\t\t\t\t<textarea placeholdername=\"LeftColumn\" name=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl01$UiControl13$contentTextBox3\">Hey</textarea>\r\n\t\t\t\t\t\t\t\t\t\t<textarea placeholdername=\"RightColumn\" name=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl01$UiControl13$contentTextBox4\">Ho!</textarea>\r\n\t\t\t\t\t\t\t\t\t</ui:updatepanelbody>\r\n\t\t\t\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t\t\t\t</ui:wysiwygeditor>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/TreeTest.js",
    "content": "var TreeTest = new function () {\r\n\t\r\n\tvar logger = SystemLogger.getLogger ( \"TreeTest\" );\r\n\t\r\n\tvar treenodeHTML = '<ui:treenode xmlns:ui=\"http://www.w3.org/1999/xhtml\" key=\"key7700348098982728\" id=\"key7700348098982728\" label=\"TreeNode 0\" image=\"${root}/images/icons/harmony/composite/default_16.png\"><ui:labelbox key=\"key37870853414305583\" id=\"key37870853414305583\" label=\"TreeNode 0\" class=\"both\" image=\"${root}/images/icons/harmony/composite/default_16.png\"><ui:labelbody style=\"background-image: url(/website/Composite/images/icons/harmony/composite/default_16.png);\"><ui:labeltext>${labeltext}</ui:labeltext></ui:labelbody></ui:labelbox></ui:treenode>';\r\n\t\r\n\t/**\r\n\t * Certified tree API.\r\n\t */\r\n\tthis.testAPI = function () {\r\n\t\t\r\n\t\tvar tree = window.bindingMap.testtree;\r\n\t\tvar max = bindingMap.selector.getResult ();\r\n\t\t\r\n\t\tvar t1 = new Date ();\r\n\t\tApplication.lock ( TreeTest );\r\n\t\t\r\n\t\tsetTimeout ( function () {\r\n\t\t\r\n\t\t\tvar i = -1; \r\n\t\t\twhile ( ++i <= max ) {\r\n\t\t\t\tvar node = TreeNodeBinding.newInstance ( document );\r\n\t\t\t\tnode.setLabel ( \"TreeNode \" + i );\r\n\t\t\t\ttree.add ( node );\r\n\t\t\t\tnode.attach ();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar t2 = new Date ();\r\n\t\t\tlogger.debug ( \"Time in seconds: Objects and HTML using API: \" + ( t2.getSeconds () - t1.getSeconds ()));\r\n\t\t\tApplication.unlock ( TreeTest );\r\n\t\t}, 0 );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Pure html injection.\r\n\t */\r\n\tthis.testHTML = function () {\r\n\t\t\r\n\t\tvar tree = window.bindingMap.testtree;\r\n\t\tvar max = bindingMap.selector.getResult ();\r\n\t\t\r\n\t\tvar t1 = new Date ();\r\n\t\tApplication.lock ( TreeTest );\r\n\t\t\r\n\t\tvar string = \"\";\r\n\t\tvar i = -1; \r\n\t\twhile ( ++i <= max ) {\r\n\t\t\tstring += treenodeHTML.replace ( \"${labeltext}\", \"TreeNode \" + i );\t\r\n\t\t}\r\n\t\t\r\n\t\tsetTimeout ( function () {\r\n\t\t\ttree._treeBodyBinding.bindingElement.innerHTML = string;\r\n\t\t\tvar t2 = new Date ();\r\n\t\t\tlogger.debug ( \"Time in seconds: Pure HTML, no objects: \" + ( t2.getSeconds () - t1.getSeconds ()));\r\n\t\t\tApplication.unlock ( TreeTest );\r\n\t\t},0 );\r\n\t}\r\n\t\r\n\tvar bindings = null;\r\n\t\r\n\t/**\r\n\t * Create binding objects only (no screen update).\r\n\t */\r\n\tthis.constructBindings = function () {\r\n\t\t\r\n\t\tvar max = bindingMap.selector.getResult ();\r\n\t\tvar t1 = new Date ();\r\n\t\tApplication.lock ( TreeTest );\r\n\t\t\r\n\t\tbindings = new List ();\r\n\t\t\r\n\t\tsetTimeout ( function () {\r\n\t\t\tvar i = -1; \r\n\t\t\twhile ( ++i <= max ) {\r\n\t\t\t\tvar treenode = LabelBinding.newInstance ( document );\r\n\t\t\t\ttreenode.setLabel ( \"TreeNode \" + i );\r\n\t\t\t\tbindings.add ( treenode );\r\n\t\t\t}\r\n\t\t\tvar t2 = new Date ();\r\n\t\t\tlogger.debug ( \"Time in seconds: Only objects, no HTML : \" + ( t2.getSeconds () - t1.getSeconds ()));\r\n\t\t\tApplication.unlock ( TreeTest );\r\n\t\t}, 0 );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Destroy created bindings.\r\n\t */\r\n\tthis.destructBindings = function () {\r\n\t\t\r\n\t\tif ( bindings ) {\r\n\t\t\tbindings.each ( function ( binding ) {\r\n\t\t\t\tbinding.dispose ( true );\r\n\t\t\t});\r\n\t\t\tbindings = null;\r\n\t\t} else {\r\n\t\t\talert ( \"First create them!\" );\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis.attachBindings = function () {\r\n\t\t\r\n\t\tvar tree = window.bindingMap.testtree;\r\n\t\t\r\n\t\tif ( bindings ) {\r\n\t\t\tvar div = DOMUtil.createElementNS ( Constants.NS_XHTML, \"div\", document );\r\n\t\t\tbindings.each ( function ( binding ) {\r\n\t\t\t\tdiv.appendChild ( binding.bindingElement );\r\n\t\t\t});\r\n\t\t\ttree._treeBodyBinding.bindingElement.appendChild ( div );\r\n\t\t\tDocumentManager.attachBindings ( div );\r\n\t\t} else {\r\n\t\t\talert ( \"First create them!\" );\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis.detachBindings = function () {\r\n\t\t\r\n\t\tvar tree = window.bindingMap.testtree;\r\n\t\t\r\n\t\tif ( bindings ) {\r\n\t\t\tbindings.each ( function ( binding ) {\r\n\t\t\t\tbinding.dispose ();\r\n\t\t\t});\r\n\t\t\tbindings = null;\r\n\t\t}\r\n\t}\r\n\t\r\n}"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/buttons.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Buttons</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Buttons\">\r\n\t\t\r\n\t\t\t<ui:popupset>\r\n\t\t\t\t<ui:popup id=\"testpopup\">\r\n\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t<ui:menuitem label=\"A\"/>\r\n\t\t\t\t\t\t\t<ui:menuitem label=\"B\"/>\r\n\t\t\t\t\t\t\t<ui:menuitem label=\"C\"/>\r\n\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t</ui:popup>\r\n\t\t\t</ui:popupset>\r\n\t\t\t\r\n\t\t\t<ui:toolbar>\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Toolbarbutton\" oncommand=\"alert('hej')\" contextmenu=\"testpopup\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Toolbarbutton\" oncommand=\"alert('hej')\" contextmenu=\"testpopup\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Toolbarbutton\" oncommand=\"alert('hej')\" contextmenu=\"testpopup\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Clickbutton\" oncommand=\"alert('hej')\" contextmenu=\"testpopup\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Clickbutton\" oncommand=\"alert('hej')\" contextmenu=\"testpopup\"/>\r\n\t\t\t\t\t\t<ui:clickbutton label=\"Clickbutton\" oncommand=\"alert('hej')\" contextmenu=\"testpopup\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\t\t\t\r\n\t\t\t<ui:box class=\"padded\">Right-click for button contextmenus.</ui:box>\r\n\t\t\t\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/c1functions.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.C1Function</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"C1Function\">\r\n\t\t\t<ui:window url=\"c1functions.html\"/>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/c1functions.html",
    "content": "<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n\t<head>\r\n\t\t<title>C1Function Test</title>\r\n\t\t<script type=\"text/javascript\" src=\"/Composite/scripts/source/page/functions/C1Function.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"/Composite/scripts/source/page/functions/C1FunctionParam.js\"></script>\r\n\t\t<script type=\"text/javascript\">\r\n\r\n\t\t\t// SIMPLE ................................................................................\r\n\r\n\t\t\t/**\r\n\t\t\t * Get sitemap as XML.\r\n\t\t\t */\r\n\t\t\tfunction getSitemapXML () {\r\n\t\t\t\t\r\n\t\t\t\tnew C1Function ( \"Composite.Pages.SitemapXml\" ).setKey ( \"hello\" ).invokeAsync ( \"text/xml\", function ( func ) {\r\n\t\t\t\t\talert ( func );\r\n\t\t\t\t\talert ( func.result );\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t * Get sitemap as string.\r\n\t\t\t */\r\n\t\t\tfunction getSitemapString () {\r\n\r\n\t\t\t\tnew C1Function ( \"Composite.Pages.SitemapXml\" ).invokeAsync ( \"text/plain\", function ( func ) {\r\n\t\t\t\t\talert ( func );\r\n\t\t\t\t\talert ( func.result );\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t * Get sitemap as string.\r\n\t\t\t */\r\n\t\t\tfunction getSitemapJSON () {\r\n\r\n\t\t\t\tnew C1Function ( \"Composite.Pages.SitemapXml\" ).invokeAsync ( \"application/json\", function ( func ) {\r\n\t\t\t\t\talert ( func );\r\n\t\t\t\t\talert ( func.result );\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t// PARAMS ................................................................................\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * A serialized HTML document :)\r\n\t\t\t */\t\t\r\n\t\t\tvar XHTML_STRING = \"&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&#xD;&#xA;&lt;head&gt;&lt;/head&gt;&#xD;&#xA;&lt;body&gt;&#xD;&#xA;&lt;p&gt;Hello from the XHTML document!&lt;/p&gt;&#xD;&#xA;&lt;/body&gt;&#xD;&#xA;&lt;/html&gt;\";\r\n\r\n\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Get XHTML as XML.\r\n\t\t\t */\r\n\t\t\tfunction getDocumentXML () {\r\n\t\t\t\t\r\n\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\" )\r\n\t\t\t\t\t.addParam ( \"Constant\", XHTML_STRING )\r\n\t\t\t\t\t.invokeAsync ( \"text/xml\", function ( func ) {\r\n\t\t\t\t\t\talert ( func );\r\n\t\t\t\t\t\talert ( func.result );\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t * Get XHTML as string.\r\n\t\t\t */\r\n\t\t\tfunction getDocumentString () {\r\n\r\n\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\", \"text/plain\" )\r\n\t\t\t\t\t.addParam ( \"Constant\", XHTML_STRING )\r\n\t\t\t\t\t.invokeAsync ( \"text/plain\", function ( func ) {\r\n\t\t\t\t\t\talert ( func );\r\n\t\t\t\t\t\talert ( func.result );\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t * Get XHTML as JSON.\r\n\t\t\t */\r\n\t\t\tfunction getDocumentJSON () {\r\n\r\n\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\", \"application/json\" )\r\n\t\t\t\t\t.addParam ( \"Constant\", XHTML_STRING )\r\n\t\t\t\t\t.invokeAsync ( \"application/json\", function ( func ) {\r\n\t\t\t\t\t\talert ( func );\r\n\t\t\t\t\t\talert ( func.result );\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// NESTED ................................................................................\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Get sitemap as XML.\r\n\t\t\t */\r\n\t\t\tfunction getDocumentXMLnested () {\r\n\r\n\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\" )\r\n\t\t\t\t\t.addParam ( \"Constant\", \r\n\t\t\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\" )\r\n\t\t\t\t\t\t\t.addParam ( \"Constant\", XHTML_STRING )\r\n\t\t\t\t\t)\r\n\t\t\t\t\t.invokeAsync ( \"text/xml\", function ( func ) {\r\n\t\t\t\t\t\talert ( func );\r\n\t\t\t\t\t\talert ( func.result );\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t// ALTERNATIVE SYNTAX!\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\tvar f1 = new C1Function ( \"Composite.Constant.XhtmlDocument\" );\r\n\t\t\t\tvar f2 = new C1Function ( \"Composite.Constant.XhtmlDocument\" );\r\n\t\t\t\tf2.addParam ( \"Constant\", XHTML_STRING );\r\n\t\t\t\tf1.addParam ( \"Constant\", f2 );\r\n\t\t\t\tf1.invoke ( \"text/xml );\r\n\t\t\t\tvar doc = f1.result; \r\n\t\t\t\talert ( doc );\r\n\t\t\t\t*/\r\n\r\n\t\t\t\t// MORE ALTERNATIVE SYNTAX\r\n\t\t\t\t/*\r\n\t\t\t\tvar handler = {\r\n\t\t\t\t\thandleFunctionResult : function ( doc ) {\r\n\t\t\t\t\t\talert ( doc );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\t\r\n\t\t\t\tf1.invoke ( \"text/xml\", handler );\r\n\t\t\t\t*/\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t * Get sitemap as string.\r\n\t\t\t */\r\n\t\t\tfunction getDocumentStringnested () {\r\n\r\n\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\" )\r\n\t\t\t\t\t.addParam ( \"Constant\", \r\n\t\t\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\" )\r\n\t\t\t\t\t\t\t.addParam ( \"Constant\", XHTML_STRING )\r\n\t\t\t\t\t)\r\n\t\t\t\t\t.invokeAsync ( \"text/plain\", function ( func ) {\r\n\t\t\t\t\t\talert ( func );\r\n\t\t\t\t\t\talert ( func.result );\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t * Get sitemap as string.\r\n\t\t\t */\r\n\t\t\tfunction getDocumentJSONnested () {\r\n\r\n\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\" )\r\n\t\t\t\t\t.addParam ( \"Constant\", \r\n\t\t\t\t\t\tnew C1Function ( \"Composite.Constant.XhtmlDocument\" )\r\n\t\t\t\t\t\t\t.addParam ( \"Constant\", XHTML_STRING )\r\n\t\t\t\t\t)\r\n\t\t\t\t\t.invokeAsync ( \"application/json\", function ( func ) {\r\n\t\t\t\t\t\talert ( func );\r\n\t\t\t\t\t\talert ( func.result );\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t\r\n\t\t</script>\r\n\t\t<style type=\"text/css\">\r\n\t\t\tbody {\r\n\t\t\t\tbackground-color: white;\r\n\t\t\t}\r\n\t\t</style>\r\n\t</head>\r\n\t<body>\r\n\t\t<h1>Omnicorp Ajax Division</h1>\r\n\t\t<hr/>\r\n\t\t<h2>Simple Functions</h2>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get sitemap as XML\" onclick=\"getSitemapXML ()\" />\r\n\t\t</p>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get sitemap as string\" onclick=\"getSitemapString ()\" />\r\n\t\t</p>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get sitemap as JSON\" onclick=\"getSitemapJSON ()\" />\r\n\t\t</p>\r\n\t\t<hr/>\r\n\t\t<h2>Param Functions</h2>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get XHTML document as XML\" onclick=\"getDocumentXML ()\" />\r\n\t\t</p>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get XHTML document as string\" onclick=\"getDocumentString ()\" />\r\n\t\t</p>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get XHTML document as JSON\" onclick=\"getDocumentJSON ()\" />\r\n\t\t</p>\r\n\t\t<h2>Nested Functions</h2>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get XHTML document as XML\" onclick=\"getDocumentXMLnested ()\" />\r\n\t\t</p>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get XHTML document as string\" onclick=\"getDocumentStringnested ()\" />\r\n\t\t</p>\r\n\t\t<p>\r\n\t\t\t<input type=\"submit\" value=\"Get XHTML document as JSON\" onclick=\"getDocumentJSONnested ()\" />\r\n\t\t</p>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/crawlers.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.DataInputs</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"crawlers.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:editorpage label=\"Crawlers\">\r\n\t\t\r\n\t\t\t<ui:splitbox layout=\"2:1\" orient=\"horizontal\">\r\n\t\t\t\t<ui:splitpanel>\r\n\t\t\r\n\t\t\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t<ui:tab label=\"Descending\"/>\r\n\t\t\t\t\t\t\t\t<ui:tab label=\"Ascending\"/>\r\n\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Test NodeCrawler\" oncommand=\"Crawlers.testDescending(1)\" image=\"${icon:help}\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Test ElementCrawler\" oncommand=\"Crawlers.testDescending(2)\" image=\"${icon:help}\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Test BindingCrawler\" oncommand=\"Crawlers.testDescending(3)\" image=\"${icon:help}\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<div f=\"START\" id=\"test1\" style=\"position: absolute;\">\r\n\t\t\t\t\t\t\t\t\t\t<div f=\"A1\"/>\r\n\t\t\t\t\t\t\t\t\t\t<div f=\"A2\" directive=\"skip node\"/> \r\n\t\t\t\t\t\t\t\t\t\t<div f=\"A3\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"B1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"B2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"B3\" nextnode=\"X1\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"C1\" directive=\"skip node\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"C2\" directive=\"skip node\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"C3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t<div f=\"A4\" binding=\"Binding\"/>\r\n\t\t\t\t\t\t\t\t\t\t<div f=\"X1\" id=\"X1\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"Y1\" binding=\"Binding\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"Y2\" directive=\"skip children\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"Z1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"Z2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"Z3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"Y3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"Z4\" directive=\"stop crawling\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"Z5\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"Z6\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:sourcecodeviewer syntax=\"xml\">\r\n\t\t\t\t\t\t\t\t\t\t<textarea>&lt;div  f=\"START\" id=\"test1\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;div f=\"A1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;div f=\"A2\" directive=\"skip node\"/&gt; \r\n\t\t\t\t\t\t\t\t\t\t&lt;div f=\"A3\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"B1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"B2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"B3\" nextnode=\"X1\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"C1\" directive=\"skip node\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"C2\" directive=\"skip node\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"C3\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;div f=\"A4\" binding=\"Binding\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;div f=\"X1\" id=\"X1\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Y1\" binding=\"Binding\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Y2\" directive=\"skip children\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Z1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Z2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Z3\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Y3\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Z4\" directive=\"stop crawling\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Z5\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"Z6\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t&lt;/div&gt;</textarea>\r\n\t\t\t\t\t\t\t\t\t</ui:sourcecodeviewer>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Test NodeCrawler\" oncommand=\"Crawlers.testAscending(1)\" image=\"${icon:help}\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Test ElementCrawler\" oncommand=\"Crawlers.testAscending(2)\" image=\"${icon:help}\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Test BindingCrawler\" oncommand=\"Crawlers.testAscending(3)\" image=\"${icon:help}\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<div f=\"STOP\" directive=\"stop crawling\">\r\n\t\t\t\t\t\t\t\t\t\t<div f=\"G1\"/>\r\n\t\t\t\t\t\t\t\t\t\t<div f=\"G2\"/> \r\n\t\t\t\t\t\t\t\t\t\t<div f=\"G3\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"F1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"F2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<div f=\"F3\" directive=\"skip node\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"E1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"E2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"E3\" binding=\"Binding\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"D1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"D2\" id=\"D2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"D3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"C1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"C2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"C3\" nextnode=\"D2\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"B1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"B2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"B3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"A1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"A2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div f=\"START\" id=\"test2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<ui:sourcecodeviewer syntax=\"xml\">\r\n\t\t\t\t\t\t\t\t\t\t<textarea>&lt;div f=\"STOP\" directive=\"stop crawling\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;div f=\"G1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;div f=\"G2\"/&gt; \r\n\t\t\t\t\t\t\t\t\t\t&lt;div f=\"G3\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"F1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"F2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"F3\" directive=\"skip node\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"E1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"E2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"E3\" binding=\"Binding\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"D1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"D2\" id=\"D2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"D3\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"C1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"C2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"C3\" nextnode=\"D2\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"B1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"B2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"B3\"&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"A1\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"A2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;div f=\"START\" id=\"test2\"/&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;/div&gt;\r\n\t\t\t\t\t\t\t\t\t&lt;/div&gt;</textarea>\r\n\t\t\t\t\t\t\t\t</ui:sourcecodeviewer>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t<ui:splitpanel class=\"padded\">\r\n\t\t\t\t\t\t<ol id=\"output\">\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t</ol>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t</ui:editorpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/crawlers.js",
    "content": "var Crawlers = new function () {\r\n\t\r\n\tvar directives = {\r\n\t\t\"stop crawling\" : NodeCrawler.STOP_CRAWLING,\r\n\t\t\"skip children\" : NodeCrawler.SKIP_CHILDREN,\r\n\t\t\"skip node\"\t: NodeCrawler.SKIP_NODE\r\n\t}\r\n\t\r\n\t/**\r\n\t * Test descending crawler.\r\n\t */\r\n\tthis.testDescending = function ( arg ) {\r\n\t\t\r\n\t\tthis._clear ();\r\n\t\tvar crawler = this._getCrawler ( arg );\r\n\t\tcrawler.crawl ( document.getElementById ( \"test1\" ));\r\n\t}\r\n\t\r\n\t/**\r\n\t * Test ascending crawler.\r\n\t */\r\n\tthis.testAscending = function ( arg ) {\r\n\t\t\r\n\t\tthis._clear ();\r\n\t\tvar crawler = this._getCrawler ( arg );\r\n\t\tcrawler.type = NodeCrawler.TYPE_ASCENDING;\r\n\t\tcrawler.crawl ( document.getElementById ( \"test2\" ), true );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Clear previous test.\r\n\t */\r\n\tthis._clear = function () {\r\n\t\t\r\n\t\tvar out = document.getElementById ( \"output\" );\r\n\t\twhile ( out.hasChildNodes () == true ) {\r\n\t\t\tout.removeChild ( out.lastChild );\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Build test result.\r\n\t */\r\n\tfunction out ( string ) {\r\n\t\t\r\n\t\tvar ul = document.getElementById ( \"output\" );\r\n\t\tvar li = DOMUtil.createElementNS ( Constants.NS_XHTML, \"li\", document );\r\n\t\tli.appendChild ( document.createTextNode ( string ));\r\n\t\tul.appendChild ( li );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Configure test crawler.\r\n\t * @return {NodeCrawler}\r\n\t */\r\n\tthis._getCrawler = function ( arg ) {\r\n\t\t\r\n\t\tvar crawler = null;\r\n\t\tswitch ( arg ) {\r\n\t\t\tcase 1 :\r\n\t\t\t\tcrawler = new NodeCrawler ();\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2 :\r\n\t\t\t\tcrawler = new ElementCrawler ();\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3 :\r\n\t\t\t\tcrawler = new BindingCrawler ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\tcrawler.addFilter ( function ( node ) {\r\n\t\t\tif ( node.nodeType == Node.TEXT_NODE ) {\r\n\t\t\t\tout ( \"#text\" );\r\n\t\t\t\treturn NodeCrawler.SKIP_NODE;\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tcrawler.addFilter ( function ( node ) {\r\n\t\t\tout ( \"<\" + node.nodeName.toLowerCase () + \" f=\\\"\" + node.getAttribute ( \"f\" ) + \"\\\">\" );\r\n\t\t});\r\n\t\t\r\n\t\tcrawler.addFilter ( function ( node ) {\r\n\t\t\tvar directive = node.getAttribute ( \"directive\" );\r\n\t\t\tif ( directive ) {\r\n\t\t\t\treturn directives [ directive ];\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tcrawler.addFilter ( function ( node ) {\r\n\t\t\tvar nextnode = node.getAttribute ( \"nextnode\" );\r\n\t\t\tif ( nextnode ) {\r\n\t\t\t\tcrawler.nextNode = document.getElementById ( nextnode );\r\n\t\t\t}\r\n\t\t})\r\n\t\t\r\n\t\treturn crawler;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/dmitryfun.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Page Inherits=\"dmitryfun\" Language=\"C#\" AutoEventWireup=\"true\" EnableEventValidation=\"true\" ValidateRequest=\"true\" CodeFile=\"dmitryfun.aspx.cs\" %> <%@ Register TagPrefix=\"aspui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.Dialogs.Functions.EditFunctionCall</title>\r\n\t\t<control:styleloader ID=\"Styleloader1\" runat=\"server\" />\r\n\t\t<control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n\t\t<asp:PlaceHolder ID=\"HeaderPlaceHolder\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\">\r\n\t\t    DataManager.isPostBackFun = true;\r\n\t\t\t// C1Ajax  - calling Ajax gods :)\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<form id=\"Form1\" runat=\"server\"> \r\n\t\t\t<ui:page label=\"Postback FUN :)\">\r\n\t\t\t\r\n\t\t\t    <input runat=\"server\" id=\"Bugaga\" />\r\n\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"!\" />\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t<ui:popupset>\r\n\t\t\t\t\t<ui:popup id=\"xisse\">\r\n\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Add New\" image=\"${icon:functioncall}\" />\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Add New\" image=\"${icon:functioncall}\" />\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Delete\" image=\"${icon:delete}\" image-disabled=\"${icon:delete-disabled()}\" />\r\n\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t</ui:popup>\r\n\t\t\t\t</ui:popupset>\r\n\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"4:5\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:tree contextmenu=\"xisse\">\r\n\t\t\t\t\t\t\t<ui:treebody>\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"Composite.Data.Types.IMediaFolder.GetIMediaFolderXml\" image=\"${icon:functioncall}\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Selected fields: Id, Path\" image=\"${icon:parameter_overloaded}\" />\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Filter\" image=\"${icon:parameter_overloaded}\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Composite.Data.Types.IMediaFolder.FieldPredicateFilter\" image=\"${icon:functioncall}\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Id\" image=\"${icon:parameter_overloaded}\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Composite.Utils.Predicates.GuidEquals\" image=\"${icon:functioncall}\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"The value to compare to\" image=\"${icon:parameter_overloaded}\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Composite.Web.Request.QueryStringGuidValue\" image=\"${icon:functioncall}\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Parameter name: mediafolderid\" image=\"${icon:parameter_overloaded}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Fallback Value\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"KeyPath\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"CompositePath\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"StoreId\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Path\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Title\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Descrition\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Order by\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Order ascending\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t\t<ui:treenode label=\"Page\" image=\"${icon:parameter}\" />\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t</ui:treebody>\r\n\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:flexbox>\r\n\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t<h3>Selected fields</h3>\r\n\t\t\t\t\t\t\t\t<p>&lt;-- List&lt;String&gt;</p>\r\n\t\t\t\t\t\t\t\t<p>Select the fields to include in your XML document, bitch.</p>\r\n\t\t\t\t\t\t\t\t<!-- \r\n\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Parameter Type</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" ximage=\"${icon:accept-disbled}\" label=\"Default\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" ximage=\"${icon:accept-disbled}\" label=\"Constant\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" ximage=\"${icon:accept-disbled}\" label=\"Function\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" image=\"${icon:accept}\" label=\"Input Parameter\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t\t\t<ui:fields id=\"superCoolFields\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<asp:Button runat=\"server\" Text=\"UPDATE SOMETHING\" ID=\"UpdaterButton\" OnClick=\"UpdaterButton_Click\" />\r\n\t\t\t\t\t\t\t\t\t<h1><asp:Label ID=\"lblTest\" runat=\"server\" /></h1>\r\n\t\t\t\t\t\t\t\t\t<asp:PlaceHolder Visible=\"true\" ID=\"fakedUpdatePanel_OFF\" runat=\"server\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup id=\"niceFieldGroup\" updated=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t</asp:PlaceHolder>\r\n\t\t\t\t\t\t\t\t\t<asp:PlaceHolder Visible=\"false\" ID=\"fakedUpdatePanel_ON\" runat=\"server\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup id=\"niceFieldGroup\" updated=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Parameter Type</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" ximage=\"${icon:accept-fisse}\" label=\"Default\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" ximage=\"${icon:accept-disbled}\" label=\"Constant\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" ximage=\"${icon:accept-disbled}\" label=\"Function\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" image=\"${icon:accept}\" label=\"Input Parameter\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t</asp:PlaceHolder>\r\n\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<div id=\"Div1\" updated=\"true\">\r\n\t\t\t\t\t\t\t\t\t<p><%= DateTime.Now %></p>\r\n\t\t\t\t\t\t\t\t    <asp:Calendar runat=\"server\" ID=\"worldsMostCoolCalendar\" />\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t</ui:flexbox>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/dmitryfun.aspx.cs",
    "content": "﻿using System;\r\nusing System.Data;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Security;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Web.UI.WebControls;\r\nusing System.Web.UI.WebControls.WebParts;\r\nusing System.Xml.Linq;\r\n\r\n/// <summary>\r\n/// Summary description for postbackfun\r\n/// </summary>\r\npublic partial class dmitryfun : Composite.Core.WebClient.XhtmlPage\r\n{\r\n\r\n\tprivate void Page_Load(object sender, EventArgs args)\r\n\t{\r\n\t\t/*\r\n\t\t * This will force the NET mumbojumbo to appear in  \r\n\t\t * the output: __doPostback and related hidden fields.\r\n\t\t */\r\n//\t\tthis.GetPostBackEventReference ( this, string.Empty );\r\n\t}\r\n\r\n    public void UpdaterButton_Click(object sender, EventArgs args)\r\n    {\r\n\t/*\tResponse.Cache.SetNoStore();\r\n        this.fakedUpdatePanel_OFF.Visible = !this.fakedUpdatePanel_OFF.Visible;\r\n        this.fakedUpdatePanel_ON.Visible = !this.fakedUpdatePanel_ON.Visible;*/\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/domevents.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Fields</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\twindow.onload = function () {\r\n\t\t\tvar target = document.getElementById ( \"target\" );\r\n\t\t\tvar logger = SystemLogger.getLogger ( \"DOMEvents TEST\" );\r\n\t\t\tDOMEvents.addEventListener ( target, DOMEvents.MOUSEENTER, {\r\n\t\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\t\tlogger.debug ( e.type + \": \" + Math.random ());\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tDOMEvents.addEventListener ( target, DOMEvents.MOUSELEAVE, {\r\n\t\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\t\tlogger.debug ( e.type + \": \" + Math.random ());\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Testing DOMEvents\" class=\"padded\">\r\n\t\t\t<div id=\"target\" style=\"background-color: #FFFFFF; padding: 20px;\">\r\n\t\t\t\t<div style=\"background-color: #CCCCCC; padding: 20px;\">\r\n\t\t\t\t\t<div style=\"background-color: #888888; padding: 20px;\">\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/focus.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Fields</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction __doPostBack () {\r\n\t\t\t// simulate dot net\r\n\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Testing focus\" class=\"padded\">\r\n\t\t\t<ui:tabbox type=\"boxed\">\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab label=\"Hans\"/>\r\n\t\t\t\t\t<ui:tab label=\"Jens\"/>\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datadialogs\">\r\n\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddesc>datadialog</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t<ui:datadialog url=\"${root}/content/dialogs/tests/datadialog/datadialog.aspx\" label=\"Advanced options\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainputdialog</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t<ui:datainputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"datainputdialog1\" value=\"1\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainputdialog + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t<ui:datainputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"datainputdialog2\" value=\"1\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t<ui:fieldgroup label=\"Checkboxes\">\r\n\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"check1\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"check2\" value=\"c2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"check3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddesc>checkbox + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 1\" name=\"check1\" value=\"c1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 2\" name=\"check2\" value=\"c2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:checkbox label=\"Checkbox 3\" name=\"check3\" value=\"c3\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/icons.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Icons</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Icons\">\r\n\t\t\t<ui:toolbar> \r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Hans\" image=\"${icon:close(16)}\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/iebug.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.IEBug</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"IE BUG!\">\r\n\t\t\t<ui:tabbox>\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab label=\"Palle\" />\r\n\t\t\t\t\t<ui:tab label=\"Birgitte\" />\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:tree id=\"draggabletree\">\r\n\t\t\t\t\t\t\t\t\t<ui:treebody><!-- dragaccept=\"filea fileb\" -->\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"foldera\" dragaccept=\"filea foldera\" label=\"Folder A.1\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.1\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.2\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.3\" />\r\n\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragaccept=\"fileb\" label=\"Folder B.1\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"fileb\" label=\"File B.1\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"fileb\" label=\"File B.2\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"fileb\" label=\"File B.3\" />\r\n\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"foldera\" dragaccept=\"filea foldera\" label=\"Folder A.4\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.10\" dragaccept=\"filea foldera\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.11\" dragaccept=\"filea foldera\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.12\" dragaccept=\"filea foldera\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.13\" dragaccept=\"filea foldera\" />\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"foldera\" dragaccept=\"filea foldera\" label=\"Folder A.2\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.4\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.5\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.6\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"foldera\" dragaccept=\"filea foldera\" label=\"Folder A.3\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.7\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.8\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.9\" />\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.12\" />\r\n\t\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t</ui:treebody>\r\n\t\t\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/memory.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Memory</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"memory.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Memory\">\r\n\t\t\t<ui:toolbar>\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Generate\" oncommand=\"this.bindingWindow.Fister.generate()\"/> \r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Inject\" oncommand=\"this.bindingWindow.Fister.inject()\"/> \r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Release\" oncommand=\"this.bindingWindow.Fister.release()\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\t\t\t<ui:flexbox id=\"flex\"></ui:flexbox>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/menus.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Menus</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Menus\">\r\n\t\t\r\n\t\t\t<ui:menubar id=\"menubar\">\r\n\t\t\t\t<ui:menu label=\"File\">\r\n\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Temp\"/>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Temp\"/>\r\n\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Submenu\">\r\n\t\t\t\t\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Temp\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Temp\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Submenu\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Temp\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Temp\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:menuitem>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t\t\t\t\t</ui:menuitem>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Temp\"/>\r\n\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t</ui:menu>\r\n\t\t\t\t<ui:menu label=\"View\">\r\n\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"System Log\" binding=\"StageViewMenuItemBinding\" handle=\"Composite.Management.SystemLog\" image=\"${icon:systemlog}\"/>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Developer Panel\" binding=\"StageViewMenuItemBinding\" handle=\"Composite.Management.Developer\" image=\"${icon:developer}\"/>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Icon Pack\" binding=\"StageViewMenuItemBinding\" handle=\"Composite.Management.IconPack\" image=\"${icon:icon}\"/>\r\n\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t</ui:menu>\r\n\t\t\t\t<ui:menu label=\"Tools\">\r\n\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Options...\" binding=\"StageViewMenuItemBinding\" handle=\"Composite.Management.Options\"/>\r\n\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t</ui:menu>\r\n\t\t\t\t<ui:menu label=\"Help\">\r\n\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"Help Contents\"/>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"About Composite Management\" oncommand=\"Commands.about()\"/>\r\n\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t</ui:menu>\r\n\t\t\t</ui:menubar>\r\n\t\t\t\r\n\t\t\t<ui:toolbar>\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Hej\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Dav\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Hallo\" image=\"${icon:default}\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Hey\" image=\"${icon:default}\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarlabel label=\"Radiobuttons\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton cmd=\"JustifyLeft\" tooltip=\"${string:Website.WysiwygEditor.ToolBar.ToolTipJustifyLeft}\" type=\"radio\" image=\"${skin}/wysiwygeditor/justifyleft.png\" image-disabled=\"${skin}/wysiwygeditor/justifyleft-disabled.png\" />\r\n\t\t\t\t\t\t<ui:toolbarbutton cmd=\"JustifyRight\" tooltip=\"${string:Website.WysiwygEditor.ToolBar.ToolTipJustifyRight}\" type=\"radio\" image=\"${skin}/wysiwygeditor/justifyright.png\" image-disabled=\"${skin}/wysiwygeditor/justifyright-disabled.png\" />\r\n\t\t\t\t\t\t<ui:toolbarbutton cmd=\"JustifyCenter\" tooltip=\"${string:Website.WysiwygEditor.ToolBar.ToolTipJustifyCenter}\" type=\"radio\" image=\"${skin}/wysiwygeditor/justifycenter.png\" image-disabled=\"${skin}/wysiwygeditor/justifycenter-disabled.png\" />\r\n\t\t\t\t\t\t<ui:toolbarbutton cmd=\"JustifyFull\" tooltip=\"${string:Website.WysiwygEditor.ToolBar.ToolTipJustifyFull}\" type=\"radio\" image=\"${skin}/wysiwygeditor/justifyfull.png\" image-disabled=\"${skin}/wysiwygeditor/justifyfull-disabled.png\" />\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\t\t\t\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/pageeditorfull.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.TESTING!</title>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t\t<!-- DONT UPDATE TAG NESTING STRUCTURE WITHOUT CONSULTING MOTH! -->\r\n\t\t<form method=\"post\" action=\"javascript:alert('hans')\" id=\"aspnetForm\">\r\n\t\t\t<ui:editorpage image=\"${icon:Composite.Icons:page-edit-page}\" label=\"FrontPage\">\r\n\t\t\t\t<ui:updatepanel id=\"ctl00_UpdatePanel1\" repaintmode=\"normal\" flex=\"true\">\r\n\t\t\t\t\t<ui:updatepanelbody>\r\n\t\t\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<span style=\"display:none;\">\r\n\t\t\t\t\t\t\t\t\t\t<a id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl00_UiControl1_repeater_ctl00_UiControl2_ShadowSaveLinkButton\" href=\"javascript:__doPostBack('ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl00$UiControl1$repeater$ctl00$UiControl2$ShadowSaveLinkButton','')\">Save</a>\r\n\t\t\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE);\" callbackid=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl00_UiControl1_repeater_ctl00_UiControl2_ShadowSaveLinkButton\" id=\"savebutton\" image=\"${icon:save}\" image-disabled=\"${icon:save-disabled}\" label=\"Save\" observes=\"broadcasterCanSave\" />\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t<ui:lazybindingset>\r\n\t\t\t\t\t\t\t<ui:lazybinding bindingid=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanel1\" name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_lazybindingactivated1\" />\r\n\t\t\t\t\t\t\t<ui:lazybinding bindingid=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanel2\" name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_lazybindingactivated2\" />\r\n\t\t\t\t\t\t</ui:lazybindingset>\r\n\t\t\t\t\t\t<ui:tabbox id=\"maintabbox\" binding=\"EditorPageTabBoxBinding\">\r\n\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t<ui:tab label=\"Settings\" tooltip=\"Settings\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t<ui:tab label=\"Content\" tooltip=\"Content\" />\r\n\t\t\t\t\t\t\t\t<ui:tab label=\"Preview\" tooltip=\"Preview\" id=\"previewtab\" callbackid=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl02$UiControl15$Preview\" />\r\n\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t\t<ui:tabpanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanel0\">\r\n\t\t\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"General settings\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Page title</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>The entry specified in this field is shown in the browser window title bar. The field is used by search engines and sitemaps</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl00_UiControl2_repeater_ctl00_UiControl3\" value=\"FrontPage\" required=\"true\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Description</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Use this field for at short description of the page</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:textbox required=\"false\" name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl00_UiControl2_repeater_ctl01_UiControl4\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldgroupseparator />\r\n\t\t\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Publication settings\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Status</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Send the page to another status</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl00_UiControl6\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Draft\" value=\"draft\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Awaiting Approval\" value=\"awaitingApproval\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Awaiting Publication\" value=\"awaitingPublication\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Publish date</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Specify at which date and time you want the page to be published. At the specified time the page will automatically be published to the site</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl01_UiControl7_WrapperUpdatePanel\" repaintmode=\"normal\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanelbody>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl00$UiControl1$repeater$ctl01$UiControl5$repeater$ctl01$UiControl7$TypeSelector\" callbackid=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl01_UiControl7_TypeSelector\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonchange=\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection selected=\"true\" label=\"(no date selected)\" value=\"none\" tooltip=\"(no date selected)\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Select date\" value=\"select\" tooltip=\"Select date\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl01_UiControl7_CalendarUpdatePanel\" repaintmode=\"normal\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanelbody />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl01_UiControl7_TimeSelectorUpdatePanel\" repaintmode=\"normal\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanelbody />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanelbody>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Unpublish date</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Specify at which date and time you want the page to be unpublished. At the specified time the page will automatically be removed from the site</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl02_UiControl8_WrapperUpdatePanel\" repaintmode=\"normal\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanelbody>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl00$UiControl1$repeater$ctl01$UiControl5$repeater$ctl02$UiControl8$TypeSelector\" callbackid=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl02_UiControl8_TypeSelector\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonchange=\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection selected=\"true\" label=\"(no date selected)\" value=\"none\" tooltip=\"(no date selected)\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Select date\" value=\"select\" tooltip=\"Select date\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl02_UiControl8_CalendarUpdatePanel\" repaintmode=\"normal\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanelbody />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl01_UiControl5_repeater_ctl02_UiControl8_TimeSelectorUpdatePanel\" repaintmode=\"normal\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanelbody />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanelbody>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldgroupseparator />\r\n\t\t\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Advanced settings\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Menu title</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>The entry specified in this field can be used in the navigation on the website</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl02_UiControl9_repeater_ctl00_UiControl10\" value=\"FrontPage\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>URL title</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>The entry specified in this field is shown in the browser address bar as a part of the URL address. The field is used by search engines</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl02_UiControl9_repeater_ctl01_UiControl11\" value=\"FrontPage\" required=\"true\" regexrule=\"^[-\\w]*$\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Friendly URL</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>The entry specified in this field is shown in the browser address bar and replaces system generated URL´s. Note that the server has to be configured to support this feature</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl02_UiControl9_repeater_ctl02_UiControl12\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>Language</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Select language for the page</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl00_UiControl1_repeater_ctl02_UiControl9_repeater_ctl03_UiControl13\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Afrikaans (South Africa)\" value=\"af-ZA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Albanian (Albania)\" value=\"sq-AL\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Algeria)\" value=\"ar-DZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Bahrain)\" value=\"ar-BH\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Egypt)\" value=\"ar-EG\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Iraq)\" value=\"ar-IQ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Jordan)\" value=\"ar-JO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Kuwait)\" value=\"ar-KW\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Lebanon)\" value=\"ar-LB\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Libya)\" value=\"ar-LY\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Morocco)\" value=\"ar-MA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Oman)\" value=\"ar-OM\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Qatar)\" value=\"ar-QA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Saudi Arabia)\" value=\"ar-SA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Syria)\" value=\"ar-SY\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Tunisia)\" value=\"ar-TN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (U.A.E.)\" value=\"ar-AE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Arabic (Yemen)\" value=\"ar-YE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Armenian (Armenia)\" value=\"hy-AM\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Azeri (Cyrillic, Azerbaijan)\" value=\"az-Cyrl-AZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Azeri (Latin, Azerbaijan)\" value=\"az-Latn-AZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Basque (Basque)\" value=\"eu-ES\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Belarusian (Belarus)\" value=\"be-BY\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Bosnian (Cyrillic, Bosnia and Herzegovina)\" value=\"bs-Cyrl-BA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Bosnian (Latin, Bosnia and Herzegovina)\" value=\"bs-Latn-BA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Bulgarian (Bulgaria)\" value=\"bg-BG\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Catalan (Catalan)\" value=\"ca-ES\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Chinese (Hong Kong S.A.R.)\" value=\"zh-HK\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Chinese (Macao S.A.R.)\" value=\"zh-MO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Chinese (People's Republic of China)\" value=\"zh-CN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Chinese (Singapore)\" value=\"zh-SG\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Chinese (Taiwan)\" value=\"zh-TW\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Croatian (Bosnia and Herzegovina)\" value=\"hr-BA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Croatian (Croatia)\" value=\"hr-HR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Czech (Czech Republic)\" value=\"cs-CZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Danish (Denmark)\" value=\"da-DK\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Divehi (Maldives)\" value=\"dv-MV\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Dutch (Belgium)\" value=\"nl-BE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Dutch (Netherlands)\" value=\"nl-NL\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Australia)\" value=\"en-AU\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Belize)\" value=\"en-BZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Canada)\" value=\"en-CA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Caribbean)\" value=\"en-029\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Ireland)\" value=\"en-IE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Jamaica)\" value=\"en-JM\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (New Zealand)\" value=\"en-NZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Republic of the Philippines)\" value=\"en-PH\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (South Africa)\" value=\"en-ZA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Trinidad and Tobago)\" value=\"en-TT\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (United Kingdom)\" value=\"en-GB\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (United States)\" value=\"en-US\" selected=\"true\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"English (Zimbabwe)\" value=\"en-ZW\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Estonian (Estonia)\" value=\"et-EE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Faroese (Faroe Islands)\" value=\"fo-FO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Filipino (Philippines)\" value=\"fil-PH\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Finnish (Finland)\" value=\"fi-FI\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"French (Belgium)\" value=\"fr-BE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"French (Canada)\" value=\"fr-CA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"French (France)\" value=\"fr-FR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"French (Luxembourg)\" value=\"fr-LU\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"French (Principality of Monaco)\" value=\"fr-MC\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"French (Switzerland)\" value=\"fr-CH\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Frisian (Netherlands)\" value=\"fy-NL\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Galician (Galician)\" value=\"gl-ES\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Georgian (Georgia)\" value=\"ka-GE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"German (Austria)\" value=\"de-AT\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"German (Germany)\" value=\"de-DE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"German (Liechtenstein)\" value=\"de-LI\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"German (Luxembourg)\" value=\"de-LU\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"German (Switzerland)\" value=\"de-CH\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Greek (Greece)\" value=\"el-GR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Gujarati (India)\" value=\"gu-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hebrew (Israel)\" value=\"he-IL\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hindi (India)\" value=\"hi-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Hungarian (Hungary)\" value=\"hu-HU\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Icelandic (Iceland)\" value=\"is-IS\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Indonesian (Indonesia)\" value=\"id-ID\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Inuktitut (Latin, Canada)\" value=\"iu-Latn-CA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Irish (Ireland)\" value=\"ga-IE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Italian (Italy)\" value=\"it-IT\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Italian (Switzerland)\" value=\"it-CH\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Japanese (Japan)\" value=\"ja-JP\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kannada (India)\" value=\"kn-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kazakh (Kazakhstan)\" value=\"kk-KZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kiswahili (Kenya)\" value=\"sw-KE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Konkani (India)\" value=\"kok-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Korean (Korea)\" value=\"ko-KR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Kyrgyz (Kyrgyzstan)\" value=\"ky-KG\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Latvian (Latvia)\" value=\"lv-LV\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Lithuanian (Lithuania)\" value=\"lt-LT\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Luxembourgish (Luxembourg)\" value=\"lb-LU\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Macedonian (Former Yugoslav Republic of Macedonia)\" value=\"mk-MK\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Malay (Brunei Darussalam)\" value=\"ms-BN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Malay (Malaysia)\" value=\"ms-MY\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Maltese\" value=\"mt-MT\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Maori\" value=\"mi-NZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mapudungun (Chile)\" value=\"arn-CL\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Marathi (India)\" value=\"mr-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mohawk (Mohawk)\" value=\"moh-CA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Mongolian (Cyrillic, Mongolia)\" value=\"mn-MN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Norwegian, Bokmål (Norway)\" value=\"nb-NO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Norwegian, Nynorsk (Norway)\" value=\"nn-NO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Persian (Iran)\" value=\"fa-IR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Polish (Poland)\" value=\"pl-PL\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Portuguese (Brazil)\" value=\"pt-BR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Portuguese (Portugal)\" value=\"pt-PT\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Punjabi (India)\" value=\"pa-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Quechua (Bolivia)\" value=\"quz-BO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Quechua (Ecuador)\" value=\"quz-EC\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Quechua (Peru)\" value=\"quz-PE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Romanian (Romania)\" value=\"ro-RO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Romansh (Switzerland)\" value=\"rm-CH\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Russian (Russia)\" value=\"ru-RU\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Inari (Finland)\" value=\"smn-FI\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Lule (Norway)\" value=\"smj-NO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Lule (Sweden)\" value=\"smj-SE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Northern (Finland)\" value=\"se-FI\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Northern (Norway)\" value=\"se-NO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Northern (Sweden)\" value=\"se-SE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Skolt (Finland)\" value=\"sms-FI\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Southern (Norway)\" value=\"sma-NO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sami, Southern (Sweden)\" value=\"sma-SE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sanskrit (India)\" value=\"sa-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Serbian (Cyrillic, Bosnia and Herzegovina)\" value=\"sr-Cyrl-BA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Serbian (Cyrillic, Serbia)\" value=\"sr-Cyrl-CS\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Serbian (Latin, Bosnia and Herzegovina)\" value=\"sr-Latn-BA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Serbian (Latin, Serbia)\" value=\"sr-Latn-CS\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Sesotho sa Leboa (South Africa)\" value=\"ns-ZA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Setswana (South Africa)\" value=\"tn-ZA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Slovak (Slovakia)\" value=\"sk-SK\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Slovenian (Slovenia)\" value=\"sl-SI\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Argentina)\" value=\"es-AR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Bolivia)\" value=\"es-BO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Chile)\" value=\"es-CL\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Colombia)\" value=\"es-CO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Costa Rica)\" value=\"es-CR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Dominican Republic)\" value=\"es-DO\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Ecuador)\" value=\"es-EC\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (El Salvador)\" value=\"es-SV\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Guatemala)\" value=\"es-GT\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Honduras)\" value=\"es-HN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Mexico)\" value=\"es-MX\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Nicaragua)\" value=\"es-NI\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Panama)\" value=\"es-PA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Paraguay)\" value=\"es-PY\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Peru)\" value=\"es-PE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Puerto Rico)\" value=\"es-PR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Spain)\" value=\"es-ES\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Uruguay)\" value=\"es-UY\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Spanish (Venezuela)\" value=\"es-VE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Swedish (Finland)\" value=\"sv-FI\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Swedish (Sweden)\" value=\"sv-SE\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Syriac (Syria)\" value=\"syr-SY\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Tamil (India)\" value=\"ta-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Tatar (Russia)\" value=\"tt-RU\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Telugu (India)\" value=\"te-IN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Thai (Thailand)\" value=\"th-TH\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Turkish (Turkey)\" value=\"tr-TR\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Ukrainian (Ukraine)\" value=\"uk-UA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Urdu (Islamic Republic of Pakistan)\" value=\"ur-PK\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Uzbek (Cyrillic, Uzbekistan)\" value=\"uz-Cyrl-UZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Uzbek (Latin, Uzbekistan)\" value=\"uz-Latn-UZ\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Vietnamese (Vietnam)\" value=\"vi-VN\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Welsh\" value=\"cy-GB\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Xhosa\" value=\"xh-ZA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"Zulu\" value=\"zu-ZA\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t<ui:tabpanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanel1\">\r\n\t\t\t\t\t\t\t\t\t<ui:wysiwygeditor type=\"pageeditor\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selector name=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl01$UiControl14$TemplateSelector\" callbackid=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl01_UiControl14_TemplateSelector\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:selection selected=\"true\" label=\"StandardTemplate\" value=\"967f7fd3-13c1-4952-af48-14cec814c824\" tooltip=\"StandardTemplate\" />\r\n\t\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t\t\t<ui:updatepanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl01_UiControl14_ContentsUpdatePanel\" repaintmode=\"normal\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:updatepanelbody>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<textarea name=\"ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl01$UiControl14$contentplaceholder\" rows=\"2\" cols=\"20\" id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl01_UiControl14_contentplaceholder\" placeholderid=\"contentplaceholder\" placeholdername=\"Content\" selected=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLortepage.\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</textarea>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:updatepanelbody>\r\n\t\t\t\t\t\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t\t\t\t\t\t</ui:wysiwygeditor>\r\n\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t<ui:tabpanel id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanel2\">\r\n\t\t\t\t\t\t\t\t\t<ui:window id=\"previewwindow\" />\r\n\t\t\t\t\t\t\t\t\t<a id=\"ctl00_/AdministrativeTemplates/Document.xml_repeater_ctl01_UiControl8_repeater_ctl00_UiControl0_tabpanelRepeater_ctl02_UiControl15_Preview\" href=\"javascript:__doPostBack('ctl00$/AdministrativeTemplates/Document.xml$repeater$ctl01$UiControl8$repeater$ctl00$UiControl0$tabpanelRepeater$ctl02$UiControl15$Preview','')\" style=\"display:none;\">Preview</a>\r\n\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t</ui:updatepanelbody>\r\n\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t<div style=\"display: none;\">\r\n\t\t\t\t\t<ui:updatepanel id=\"ctl00_UpdatePanel2\" repaintmode=\"normal\">\r\n\t\t\t\t\t\t<ui:updatepanelbody />\r\n\t\t\t\t\t</ui:updatepanel>\r\n\t\t\t\t</div>\r\n\t\t\t</ui:editorpage>\r\n\t\t\t<div>\r\n\t\t\t\t<input type=\"hidden\" name=\"__EVENTVALIDATION\" id=\"__EVENTVALIDATION\" value=\"/wEWCQLb8a3+DwLfnt6QDwLy0v+zBgKktJTNDQLPgYf1DQKZ5+yLBgLohMFGAreE1MMNAre/jqQBFKN41H2wwOWSugRP397crKlss5I=\" />\r\n\t\t\t</div>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/persistance.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Menus</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Persistance\">\r\n\t\t\t\r\n\t\t\t<div style=\"padding: 10px;\">This tabbox will persist selected panel on reload.</div>\r\n\t\t\t\r\n\t\t\t\t<ui:tabbox id=\"tabboxwithveryuniqueid\" selectedindex=\"2\" persist=\"selectedindex\">\r\n\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t<ui:tab label=\"Splitboxes\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"More Content\"/>\r\n\t\t\t\t\t\t<ui:tab label=\"Most Content\"/>\r\n\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t<ui:tabpanels flex=\"false\">\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<ui:splitbox id=\"splitboxwithveryuniqueid\" orient=\"horizontal\" layout=\"1:1\" persist=\"layout\">\r\n\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t<div style=\"padding: 10px;\">This split box will persist layout.</div>\r\n\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<div><strong>Tabpanel 2</strong></div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t<div><strong>Tabpanel 3</strong></div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t</ui:tabbox>\r\n\t\t\t\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/sourcecodeviewers.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.SourceCodeViewers</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"SourceCodeViewers\">\r\n\t\t\t<ui:splitbox orient=\"vertical\" layout=\"1:1\">\r\n\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:toolbarlabel label=\"${string:Website.Misc.SourceCodeViewer.LabelInput}\" image=\"${icon:input}\"/>\r\n\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t<ui:sourcecodeviewer syntax=\"xml\">\r\n\t\t\t\t\t\t<textarea>&lt;in:inputs xmlns:in=\"http://www.composite.net/ns/transformation/input/1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"&gt;\r\n&lt;!-- Function Call Result, XPath /in:inputs/in:result[@name='IsLessThan'] --&gt;\r\n&lt;in:result xsi:type=\"xsd:integer\" name=\"IsLessThan\"&gt;-1&lt;/in:result&gt;\r\n&lt;/in:inputs&gt;</textarea>\r\n\t\t\t\t\t</ui:sourcecodeviewer>\r\n\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t<ui:splitter/>\r\n\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:toolbarlabel label=\"${string:Website.Misc.SourceCodeViewer.LabelOutput}\" image=\"${icon:output}\"/>\r\n\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t<ui:sourcecodeviewer syntax=\"xml\">\r\n\t\t\t\t\t\t<textarea>&lt;xml/&gt;</textarea>\r\n\t\t\t\t\t</ui:sourcecodeviewer>\r\n\t\t\t\t</ui:splitpanel>\r\n\t\t\t</ui:splitbox>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/special.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.SourceCodeViewers</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"special.css.aspx\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\tfunction ready () {\r\n\t\t\t\r\n\t\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Special!\">\r\n\t\t\t<object id=\"applet\" type=\"application/x-java-applet;version=1.5\">\r\n\t\t\t\t<param name=\"code\" value=\"org.dataplastique.editor.XMLEditorApplet\"/>\r\n\t\t\t\t<param name=\"archive\" value=\"xmleditor.jar\"/>\r\n\t\t\t\t<param name=\"cache_option\" value=\"no\"/>\r\n\t\t\t</object>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/special.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nhtml {\r\n\tbackground-color: -moz-Dialog;\r\n\tcolor: -moz-DialogText;\r\n\tfont: message-box;\r\n}\r\nhtml,\r\nbody {\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\theight: 100%;\r\n\toverflow: hidden;\r\n}\r\nform {\r\n\tdisplay: none;\r\n}\r\nobject {\r\n\twidth: 100%;\r\n\theight: 100%;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/splitboxes.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Splitboxes</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Splitboxes\">\r\n\t\t\r\n\t\t\t<ui:tabbox>\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab label=\"Nothing\"/>\r\n\t\t\t\t\t<ui:tab label=\"Complex nest\"/>\r\n\t\t\t\t\t<ui:tab label=\"Stage layout\"/>\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t \t<ui:splitbox orient=\"horizontal\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t \t<ui:splitbox orient=\"horizontal\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t<ui:splitbox orient=\"horizontal\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"1:3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\r\n\t\t\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"8:3\">\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"8:3\">\r\n\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:1\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t<ui:splitter collapse=\"after\"/>\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"1:1\">\r\n\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t\t\t<ui:splitpanel/>\r\n\t\t\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/style.aspx",
    "content": "﻿<%@ Page Language=\"C#\" AutoEventWireup=\"true\" %>\r\n\r\n<script runat=\"server\">\r\n\tpublic string Path { get; set; }\r\n\r\n\tprotected void Page_Load(object sender, EventArgs e)\r\n\t{\r\n\t\tswitch (Request[\"__EVENTTARGET\"])\r\n\t\t{\r\n\t\t\tcase \"style1\":\r\n\t\t\t\tPath = \"${root}/content/views/dev/developer/tests/ui/style1.css\";\r\n\t\t\t\tthis.pStyle.Visible = true;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"style2\":\r\n\t\t\t\tPath = \"${root}/content/views/dev/developer/tests/ui/style2.css\";\r\n\t\t\t\tthis.pStyle.Visible = true;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tthis.pStyle.Visible = false;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<!DOCTYPE html>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\t<title>Composite.Management.Test.DataInputs</title>\r\n\t<control:styleloader runat=\"server\" />\r\n\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\r\n\r\n</head>\r\n<body>\r\n\t<form runat=\"server\" class=\"updateform updatezone\">\r\n\r\n\t\t<ui:editorpage label=\"Checkboxes\">\r\n\t\t\t<ui:broadcasterset>\r\n\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t</ui:broadcasterset>\r\n\t\t\t<ui:toolbar>\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton\r\n\t\t\t\t\t\t\toncommand=\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\"\r\n\t\t\t\t\t\t\tid=\"clear\"\r\n\t\t\t\t\t\t\timage=\"${icon:cleanup}\"\r\n\t\t\t\t\t\t\tcallbackid=\"clear\"\r\n\t\t\t\t\t\t\tlabel=\"Clear\" />\r\n\t\t\t\t\t\t<ui:toolbarbutton\r\n\t\t\t\t\t\t\toncommand=\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\"\r\n\t\t\t\t\t\t\tid=\"style1\"\r\n\t\t\t\t\t\t\timage=\"${icon:parameter_missing}\"\r\n\t\t\t\t\t\t\tcallbackid=\"style1\"\r\n\t\t\t\t\t\t\tlabel=\"Style 1\" />\r\n\t\t\t\t\t\t<ui:toolbarbutton\r\n\t\t\t\t\t\t\toncommand=\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\"\r\n\t\t\t\t\t\t\tid=\"style2\"\r\n\t\t\t\t\t\t\timage=\"${icon:media-download-file}\"\r\n\t\t\t\t\t\t\tcallbackid=\"style2\"\r\n\t\t\t\t\t\t\tlabel=\"Style 2\" />\r\n\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\r\n\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t<div id=\"styles\">\r\n\t\t\t\t\t<asp:PlaceHolder ID=\"pStyle\" runat=\"server\">\r\n\t\t\t\t\t\t<ui:stylesheet id=\"stylebinding\" binding=\"StyleBinding\" link=\"<%=Path%>\" />\r\n\t\t\t\t\t</asp:PlaceHolder>\r\n\t\t\t\t</div>\r\n\t\t\t\t<ui:fields>\r\n\t\t\t\t\t<ui:fieldgroup label=\"Johnson\">\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput name=\"john1\" value=\"John!\" />\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput name=\"john2\" value=\"John!\" />\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t<ui:datainput name=\"john3\" value=\"John!\" />\r\n\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t</ui:fields>\r\n\t\t\t</ui:scrollbox>\r\n\t\t</ui:editorpage>\r\n\t</form>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/style1.css",
    "content": "﻿body {\r\n\tbackground-color: red;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/style2.css",
    "content": "﻿body {\r\n\tbackground-color: green;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/tabboxes.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Tabboxes</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\r\n\t\t<form method=\"post\" action=\"javascript://\">\r\n\t\r\n\t\t<ui:lazybindingset>\r\n\t\t\t<ui:lazybinding bindingid=\"tabpanelA\" value=\"false\" name=\"alarmA\"/>\r\n\t\t\t<ui:lazybinding bindingid=\"tabpanelB\" value=\"false\" name=\"alarmB\"/>\r\n\t\t\t<ui:lazybinding bindingid=\"tabpanelC\" value=\"false\" name=\"alarmC\"/>\r\n\t\t</ui:lazybindingset>\r\n\t\r\n\t\t<ui:page label=\"Tabboxes\">\r\n\t\t\r\n\t\t\t<ui:tabbox>\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab label=\"Boxed Tabboxes\"/>\r\n\t\t\t\t\t<ui:tab label=\"Too Many Tabs!\"/> \r\n\t\t\t\t\t<ui:tab label=\"Fields ohoy!\"/>\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel id=\"tabpanelA\">\r\n\t\t\t\t\t\t<ui:scrollbox class=\"padded\">\r\n\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Boxed Tabbox\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<p>Tabbox will resize to fit the visible tabpanel.</p>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabbox type=\"boxed\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Some Content\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"More Content\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Most Content\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div><strong>Tabpanel 1</strong></div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>Some content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div><strong>Tabpanel 2</strong></div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div><strong>Tabpanel 3</strong></div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t\t\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Boxed Equalsize Tabbox\">\r\n\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t<p>Tabbox will fit the largest tabpanel.</p>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Some Content\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"More Content\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Most Content\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:tabpanels flex=\"false\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div><strong>Tabpanel 1</strong></div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>Some content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div><strong>Tabpanel 2</strong></div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div><strong>Tabpanel 3</strong></div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div>More content</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t\t\t\t\t\t</ui:tabbox>\t\t\t\r\n\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel id=\"tabpanelB\">\r\n\t\t\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:1\">\r\n\t\t\t\t\t\t\t<ui:splitpanel class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number One\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Two\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Three\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Four\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Five\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Six\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Seven\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Eight\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Nine\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Ten\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t<ui:splitpanel class=\"padded\">\r\n\t\t\t\t\t\t\t\t<ui:tabbox type=\"boxed\" equalsize=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number One\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Two\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Three\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Four\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Five\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Six\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Seven\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Eight\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Nine\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tab label=\"Long Tab Title Number Ten\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:tabpanel/>\r\n\t\t\t\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel id=\"tabpanelC\">\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t<ui:tabbox type=\"boxed\">\r\n\t\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t\t<ui:tab label=\"Some Content\"/>\r\n\t\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t\t<ui:fields>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainputdialogs Datainputdialogs Datainputdialogs\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainputdialog</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"datainputdialog1\" value=\"1\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainputdialog + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainputdialog handle=\"Composite.Management.ImageSelectorDialog\" name=\"datainputdialog2\" value=\"1\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Radiobuttons\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>radiogroup</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup1\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 1\" value=\"p1\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 2\" value=\"p2\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 3\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>radiogroup + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radiodatagroup name=\"radiogroup2\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 1\" value=\"p1\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 2\" value=\"p2\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:radio label=\"Program 3\" value=\"p3\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:radiodatagroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"Datainput\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput1\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>datainput + help</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp>Help!</ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:datainput name=\"datainput2\" value=\"23\" type=\"integer\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t\t</ui:tabbox>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t\t\r\n\t\t</ui:page>\r\n\t\t\r\n\t\t</form>\r\n\t\t\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/trees.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.Trees</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"TreeTest.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page label=\"Trees\">\r\n\t\t\t<ui:tabbox>\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab label=\"Draggable Tree\"/>\r\n\t\t\t\t\t<ui:tab label=\"Tree performance test\"/>\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t<ui:tree id=\"draggabletree\">\r\n\t\t\t\t\t\t\t<ui:treebody>\r\n\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"foldera\" dragaccept=\"filea foldera\" label=\"Folder A.1\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.1\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.2\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.3\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"folderb\" dragaccept=\"folderb fileb\" label=\"Folder B.1\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"fileb\" label=\"File B.1\" dragaccept=\"fileb\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"fileb\" label=\"File B.2\" dragaccept=\"fileb\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"fileb\" label=\"File B.3\" dragaccept=\"fileb\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"foldera\" dragaccept=\"filea foldera\" label=\"Folder A.4\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.10\" dragaccept=\"filea foldera\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.11\" dragaccept=\"filea foldera\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.12\" dragaccept=\"filea foldera\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.13\" dragaccept=\"filea foldera\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"foldera\" dragaccept=\"filea foldera\" label=\"Folder A.2\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.4\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.5\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.6\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"foldera\" dragaccept=\"filea foldera\" label=\"Folder A.3\" open=\"true\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.7\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.8\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.9\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t\t\t<ui:treenode dragtype=\"filea\" label=\"File A.12\"/>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t</ui:treebody>\r\n\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel lazy=\"true\">\r\n\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Build treenodes (API)\" oncommand=\"this.bindingWindow.TreeTest.testAPI()\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Inject treenodes (innerHTML)\" oncommand=\"this.bindingWindow.TreeTest.testHTML()\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Construct\" oncommand=\"this.bindingWindow.TreeTest.constructBindings()\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Destruct\" oncommand=\"this.bindingWindow.TreeTest.destructBindings()\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Attach\" oncommand=\"this.bindingWindow.TreeTest.attachBindings()\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbutton label=\"Detach\" oncommand=\"this.bindingWindow.TreeTest.detachBindings()\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:selector id=\"selector\" type=\"number\">\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"1000 treenodes\" value=\"1000\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"100 treenodes\" value=\"100\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:selection label=\"10 treenodes\" value=\"10\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:selector>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:clickbutton label=\"Clear tree\" oncommand=\"this.bindingWindow.bindingMap.testtree.empty()\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t<ui:tree id=\"testtree\">\r\n\t\t\t\t\t\t\t<ui:treebody/>\r\n\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/updatemanager/UpdateManagerTestPageBinding.js",
    "content": "UpdateManagerTestPageBinding.prototype = new PageBinding;\r\nUpdateManagerTestPageBinding.prototype.constructor = UpdateManagerTestPageBinding;\r\nUpdateManagerTestPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * Notice this! Make sure that before and after  \r\n * markup gets send to the System Log.... \r\n * @overwrites {DocumentUpdatePlugin.isDebugging}\r\n */\r\nDocumentUpdatePlugin.isDebugging = true;\r\n\r\n/**\r\n * UpdateManager test!\r\n */\r\nfunction UpdateManagerTestPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"UpdateManagerTestPageBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nUpdateManagerTestPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[UpdateManagerTestPageBinding]\";\r\n}\r\n\r\n/**\r\n * Setup update listeners and handle potential errors.\r\n * @overloads {PageBinding#onBeforePageInitialize}\r\n */\r\nUpdateManagerTestPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tDOMEvents.addEventListener ( document, DOMEvents.BEFOREUPDATE, this );\r\n\tDOMEvents.addEventListener ( document, DOMEvents.AFTERUPDATE, this );\r\n\tDOMEvents.addEventListener ( document, DOMEvents.ERRORUPDATE, this );\r\n\t \r\n\tbindingMap.menubar.addActionListener ( MenuItemBinding.ACTION_COMMAND, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tvar file = action.target.getProperty ( \"example\" );\r\n\t\t\tbindingMap.markup.setValue ( Templates.getPlainText ( file ));\r\n\t\t\tbindingMap.updatebutton.fireCommand ();\r\n\t\t}\r\n\t})\r\n\t\r\n\tUpdateManagerTestPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * @implements {IEventHandler}\r\n * @overloads {PageBinding#handleEvent}\r\n * @param {Event} e\r\n */\r\nUpdateManagerTestPageBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tUpdateManagerTestPageBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tif ( DOMEvents.getTarget ( e ) == document.documentElement ) {\r\n\t\tswitch ( e.type ) {\r\n\t\t\tcase DOMEvents.BEFOREUPDATE :\r\n\t\t\t\tthis._beforeUpdate ();\r\n\t\t\t\tbreak;\r\n\t\t\tcase DOMEvents.AFTERUPDATE :\r\n\t\t\t\tthis._afterUpdate ();\r\n\t\t\t\tbreak;\r\n\t\t\tcase DOMEvents.ERRORUPDATE :\r\n\t\t\t\tthis._errorUpdate ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Before update.\r\n */\r\nUpdateManagerTestPageBinding.prototype._beforeUpdate = function () {\r\n\t\r\n\tthis.bindingWindow.bindingMap.reporttextbox.setValue ( \"\" );\r\n}\r\n\r\n/**\r\n * After update.\r\n */\r\nUpdateManagerTestPageBinding.prototype._afterUpdate = function () {\r\n\t\r\n\tvar summary = this.bindingWindow.UpdateManager.summary;\r\n\tif ( summary == \"\" ) {\r\n\t\tsummary = \"No updates :)\"\r\n\t}\r\n\tthis.bindingWindow.bindingMap.reporttextbox.setValue ( \tsummary );\r\n}\r\n\r\n/**\r\n * After error.\r\n */\r\nUpdateManagerTestPageBinding.prototype._errorUpdate = function () {\r\n\t\r\n\tthis.bindingWindow.bindingMap.reporttextbox.setValue (\r\n\t\t\"RELOAD THIS TEST! :)\\n\\n\" + UpdateManager.errorsmessage \r\n\t);\r\n}"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/updatemanager/tests/mothfun1.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<a id=\"a1\">\r\n\t<b id=\"b1\">\r\n\t\t<c id=\"c1\">\r\n\t\t\t<d/>\r\n\t\t</c>\r\n\t</b>\r\n\t<b id=\"b2\">\r\n\t\t<c>\r\n\t\t\t<d>\r\n\t\t\t\t<e id=\"e1\">\r\n\t\t\t\t\t<f/>\r\n\t\t\t\t</e>\r\n\t\t\t</d>\r\n\t\t</c>\r\n\t</b>\r\n\t<b id=\"b3\">\r\n\t\t<c>\r\n\t\t\t<d name=\"value\"/>\r\n\t\t</c>\r\n\t</b>\r\n\t<b id=\"b4\"/>\r\n</a>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/updatemanager/tests/mothfun2.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<a id=\"a1\">\r\n\t<b id=\"b1\">\r\n\t\t<c id=\"c1\">\r\n\t\t\t<DIFFERENT/>\r\n\t\t</c>\r\n\t</b>\r\n\t<b id=\"b2\">\r\n\t\t<c>\r\n\t\t\t<d DIFFERENT=\"TRUE\">\r\n\t\t\t\t<e id=\"e1\">\r\n\t\t\t\t\t<f note=\"Not crawled\"/>\r\n\t\t\t\t</e>\r\n\t\t\t</d>\r\n\t\t</c>\r\n\t</b>\r\n\t<b id=\"b3\">\r\n\t\t<c>\r\n\t\t\t<d name=\"DIFFERENT\"/>\r\n\t\t</c>\r\n\t</b>\r\n\t<b id=\"b4\">\r\n\t\t<DIFFERENT/>\r\n\t</b>\r\n</a>"
  },
  {
    "path": "Website/Composite/content/views/dev/developer/tests/ui/updatemanager/updatemanager.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<%@ Page Language=\"C#\" ValidateRequest=\"false\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Test.UpdateManager</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"UpdateManagerTestPageBinding.js\"/>\r\n\t\t\r\n\t\t<style type=\"text/css\">\r\n\t\t\th1,h3 {margin: 0 0 1em 0;}\r\n\t\t\tp { margin: 0; }\r\n\t\t</style>\r\n\t\t\r\n\t\t<!-- play with these classnames! -->\r\n\t\t<style type=\"text/css\">\r\n\t\t\t.red { color: red; }\r\n\t\t\t.green { color: green; }\r\n\t\t\t.blue { color: blue; }\r\n\t\t</style>\r\n\t\t\r\n\t</head>\r\n\t<body>\r\n\t\r\n\t\t<!-- 1) This ajax-enabled FORM must have classname \"updateform\" -->\r\n\t\t<!-- 2) Updateable elements on page must be surrounded by classname \"updatezone\" -->\r\n\t\t<!-- 3) Use ID attributes on elements to update smallest possible regions -->\r\n\t\r\n\t\t<form id=\"ID_IS_IMPORTANT\" runat=\"server\" action=\"\" method=\"post\" class=\"updateform\">\r\n\t\t\r\n\t\t\t<ui:page binding=\"UpdateManagerTestPageBinding\" label=\"UpdateManager!\" image=\"${icon:composite}\">\r\n\t\t\t\r\n\t\t\t\t<ui:menubar id=\"menubar\">\r\n\t\t\t\t\t<ui:menu label=\"Examples\">\r\n\t\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Basic example\" image=\"${icon:mimetype-html}\" example=\"updatemanagertest/basic.txt\"/>\r\n\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Advanced example\" image=\"${icon:mimetype-html}\" example=\"updatemanagertest/advanced.txt\"/>\r\n\t\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t<ui:menuitem label=\"Composite Forms\" image=\"${icon:mimetype-html}\" example=\"updatemanagertest/forms.txt\"/>\r\n\t\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t\t</ui:menu>\r\n\t\t\t\t</ui:menubar>\r\n\t\t\t\t\r\n\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:1\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarlabel label=\"Request\" image=\"${icon:mimetype-html}\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t<ui:flexbox>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<!-- posting this to change to updatezone! -->\r\n\t\t\t\t\t\t\t<ui:editortextbox id=\"markup\" name=\"markup\">\r\n\t\t\t\t\t\t\t\t<textarea>&lt;h3&gt;Press the &quot;Update&quot; button&lt;/h3&gt;\r\n&lt;p&gt;Make some changes and press it again.&lt;/p&gt;\r\n&lt;p&gt;Then check out examples from the menu.&lt;/p&gt;</textarea>\r\n\t\t\t\t\t\t\t</ui:editortextbox>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</ui:flexbox>\r\n\t\t\t\t\t\t<ui:toolbar class=\"statusbar\">\r\n\t\t\t\t\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:clickbutton id=\"updatebutton\" label=\"Update\" image=\"${icon:accept}\"  oncommand=\"document.forms[0].submit();\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:splitbox orient=\"vertical\" layout=\"2:1\">\r\n\t\t\t\t\t\t\t<ui:splitpanel id=\"testsplitpanel\">\r\n\t\t\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:toolbarlabel label=\"Response\" image=\"${icon:page-view-public-scope}\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<!-- CSS classname \"updatezone\" and ID is required! -->\r\n\t\t\t\t\t\t\t\t<div class=\"updatezone padded\" id=\"UPDATEZONE\">\r\n\t\t\t\t\t\t\t\t\t<%= Request.Form [ \"markup\" ] %>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:toolbarlabel label=\"Report\" image=\"${icon:message}\"/>\r\n\t\t\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t\t\t<ui:flexbox>\r\n\t\t\t\t\t\t\t\t\t<ui:editortextbox id=\"reporttextbox\" readonly=\"true\" isdisabled=\"true\"/>\r\n\t\t\t\t\t\t\t\t</ui:flexbox>\r\n\t\t\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\r\n\t\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/flushadmin/Default.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"Default.aspx.cs\" Inherits=\"FlushAdmin_Default\" %>\r\n\r\n<%@ Register TagPrefix=\"control\" TagName=\"httpheaders\" Src=\"~/Composite/controls/HttpHeadersControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"scriptloader\" Src=\"~/Composite/controls/ScriptLoaderControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"styleloader\" Src=\"~/Composite/controls/StyleLoaderControl.ascx\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n    <title>Flush Admin</title>\r\n    <control:styleloader runat=\"server\" />\r\n    <control:scriptloader type=\"sub\" runat=\"server\" />\r\n</head>\r\n<body>\r\n    <ui:page label=\"Flush Admin\" image=\"${skin}/dialogpages/message16.png\">\r\n        <ui:scrollbox>\r\n            <asp:PlaceHolder ID=\"FlushAdminPlaceHolder\" runat=\"server\" />\r\n        </ui:scrollbox>\r\n    </ui:page>\r\n</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/flushadmin/Default.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Events;\r\nusing System.Reflection;\r\n\r\n\r\npublic partial class FlushAdmin_Default : System.Web.UI.Page\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        if (this.Request.QueryString[\"Type\"] != null)\r\n        {\r\n            Type type = TypeManager.GetType(this.Request.QueryString[\"Type\"]);\r\n\r\n            FlushAttribute flushAttribute = type.GetCustomAttributes(false).Where(f => f.GetType() == typeof(FlushAttribute)).Single() as FlushAttribute;\r\n\r\n            MethodInfo methodInfo =\r\n                (from m in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static)\r\n                 where m.Name == flushAttribute.MethodName\r\n                 select m).SingleOrDefault();\r\n\r\n            methodInfo.Invoke(null, null);\r\n\r\n            FlushAdminPlaceHolder.Controls.Add(new LiteralControl(string.Format(@\"<b>{0} flushed</b>\", this.Request.QueryString[\"Type\"])));\r\n            FlushAdminPlaceHolder.Controls.Add(new LiteralControl(\"<br /><br /><br />\"));\r\n        }\r\n        \r\n        FlushAdminPlaceHolder.Controls.Add(new LiteralControl(@\"<table border=\"\"0\"\">\"));\r\n\r\n        foreach (Type type in AssemblyFacade.GetAllAssemblies().GetTypes())\r\n        {\r\n            FlushAttribute flushAttribute = type.GetCustomAttributes(false).Where(f => f.GetType() == typeof(FlushAttribute)).SingleOrDefault() as FlushAttribute;\r\n\r\n\r\n            if (flushAttribute == null) continue;            \r\n\r\n            MethodInfo methodInfo =\r\n                (from m in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static)\r\n                 where m.Name == flushAttribute.MethodName\r\n                 select m).SingleOrDefault();\r\n\r\n            if (methodInfo == null) continue;\r\n\r\n            FlushAdminPlaceHolder.Controls.Add(new LiteralControl(\"<tr>\"));\r\n            FlushAdminPlaceHolder.Controls.Add(new LiteralControl(\"<td>\" + type.FullName + \"</td>\"));\r\n            FlushAdminPlaceHolder.Controls.Add(new LiteralControl(string.Format(@\"<td><a href=\"\"{0}?Type={1}\"\">Flush</a></td>\", this.Request.CurrentExecutionFilePath, HttpUtility.UrlEncode(type.GetVersionNeutralName()))));\r\n            FlushAdminPlaceHolder.Controls.Add(new LiteralControl(\"</tr>\"));\r\n        }\r\n\r\n        FlushAdminPlaceHolder.Controls.Add(new LiteralControl(\"</table>\"));\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/flushadmin/Default.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class FlushAdmin_Default {\r\n    \r\n    /// <summary>\r\n    /// FlushAdminPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder FlushAdminPlaceHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/icons/svg/sprite.cshtml",
    "content": "﻿@using System.Xml.Linq\r\n@{\r\n\tXNamespace nsSys = \"http://www.w3.org/2000/svg\";\r\n\tXNamespace nsLink = \"http://www.w3.org/1999/xlink\";\r\n\r\n\tvar file = XDocument.Load(Server.MapPath(\"~/Composite/images/sprite.svg\"));\r\n\tvar root = file.Root;\r\n\tif (root == null)\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\tvar iconElements = root.Element(nsSys + \"defs\").Elements().ToList();\r\n\r\n\tvar mimeTypeIcons = iconElements.Where(el => el.Attribute(\"id\") != null && el.Attribute(\"id\").Value.StartsWith(\"mimetype-\")).ToList();\r\n\tvar iconsWithUSe = iconElements.Where(el => el.Element(nsSys + \"use\") != null).ToList();\r\n\tvar genralIcons = iconElements.Except(mimeTypeIcons).Except(iconsWithUSe).ToList();\r\n\r\n}\r\n\r\n\r\n<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:f=\"http://www.composite.net/ns/function/1.0\">\r\n<head>\r\n\t<style type=\"text/css\">\r\n\t\t.cell {\r\n\t\t\tfloat: left;\r\n\t\t\twidth: 380px;\r\n\t\t\theight: 24px;\r\n\t\t\tline-height: 24px;\r\n\t\t\tvertical-align: middle;\r\n\t\t\tfont-size: 14px;\r\n\t\t\tmargin-bottom: 10px;\r\n\t\t}\r\n\r\n\t\t.icons24x24:after {\r\n\t\t\tclear: both;\r\n\t\t\tcontent: \" \";\r\n\t\t\tdisplay: table;\r\n\t\t}\r\n\r\n\t\t.icons24x24 svg {\r\n\t\t\tfill: currentColor;\r\n\t\t\tcolor: #999;\r\n\t\t\tstroke: #999;\r\n\t\t\twidth: 24px;\r\n\t\t\theight: 24px;\r\n\t\t\tpadding-right: 15px;\r\n\t\t}\r\n\t</style>\r\n</head>\r\n<body>\r\n\t<h2>General Icons 24x24:</h2>\r\n\t<div class=\"icons24x24\">\r\n\t\t@foreach (var item in genralIcons)\r\n\t\t{\r\n\t\t\tvar viewBox = item.Attribute(\"viewBox\") != null ? item.Attribute(\"viewBox\").Value : string.Empty;\r\n\r\n\t\t\t<div class=\"cell\">\r\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\"\r\n\t\t\t\t\t @if (!string.IsNullOrEmpty(viewBox)) {  @: viewBox=\"@viewBox\"\r\n\t\t\t\t\t                         }>\r\n\t\t\t\t\t<use xlink:href=\"~/Composite/images/sprite.svg#@item.Attribute(\"id\").Value\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" />\r\n\t\t\t\t</svg>\r\n\t\t\t\t<span>@item.Attribute(\"id\").Value</span>\r\n\t\t\t</div>\r\n\t\t}\r\n\t</div>\r\n\t<h2>Icons that use reference to general icons:</h2>\r\n\t<div class=\"icons24x24\">\r\n\t\t@foreach (var item in iconsWithUSe)\r\n\t\t{\r\n\t\t\tvar viewBox = item.Attribute(\"viewBox\") != null ? item.Attribute(\"viewBox\").Value : string.Empty;\r\n\t\t\tvar useIconId = item.Element(nsSys + \"use\").Attribute(nsLink + \"href\").Value;\r\n\t\t\t<div class=\"cell\">\r\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\"\r\n\t\t\t\t\t @if (!string.IsNullOrEmpty(viewBox)) {  @: viewBox=\"@viewBox\"\r\n\t\t\t\t\t                                                                                                        }>\r\n\t\t\t\t\t<use xlink:href=\"~/Composite/images/sprite.svg#@item.Attribute(\"id\").Value\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" />\r\n\t\t\t\t</svg>\r\n\t\t\t\t<span>@item.Attribute(\"id\").Value (@useIconId)</span>\r\n\t\t\t</div>\r\n\t\t}\r\n\t</div>\r\n\t<h2>File Format Icons:</h2>\r\n\t<div class=\"icons24x24\">\r\n\t\t@foreach (var item in mimeTypeIcons)\r\n\t\t{\r\n\t\t\tvar viewBox = item.Attribute(\"viewBox\") != null ? item.Attribute(\"viewBox\").Value : string.Empty;\r\n\r\n\t\t\t<div class=\"cell\">\r\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\"\r\n\t\t\t\t\t @if (!string.IsNullOrEmpty(viewBox)) {  @: viewBox=\"@viewBox\"\r\n\t\t\t\t\t                                                      }>\r\n\t\t\t\t\t<use xlink:href=\"~/Composite/images/sprite.svg#@item.Attribute(\"id\").Value\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" />\r\n\t\t\t\t</svg>\r\n\t\t\t\t<span>@item.Attribute(\"id\").Value</span>\r\n\t\t\t</div>\r\n\t\t}\r\n\t</div>\r\n\r\n</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/icons/svg/web.config",
    "content": "﻿<?xml version=\"1.0\"?>\r\n<configuration>\r\n    <system.web>\r\n\t\t\t<pages>\r\n\t\t\t\t<namespaces>\r\n\t\t\t\t\t<add namespace=\"System\" />\r\n\t\t\t\t\t<add namespace=\"System.Linq\" />\r\n\t\t\t\t\t<add namespace=\"System.Linq.Expressions\" />\r\n\t\t\t\t\t<add namespace=\"System.Web.WebPages.Html\" />\r\n\t\t\t\t\t<add namespace=\"System.Xml.Linq\" />\r\n\r\n\t\t\t\t\t<add namespace=\"Composite.Data\" />\r\n\t\t\t\t\t<add namespace=\"Composite.Data.Types\" />\r\n\t\t\t\t\t<add namespace=\"Composite.Functions\" />\r\n\r\n\t\t\t\t\t<add namespace=\"Composite.AspNet.Razor\" />\r\n\r\n\t\t\t\t\t<add namespace=\"Composite.Core.Xml\" />\r\n\t\t\t\t\t<add namespace=\"Composite.Core.PageTemplates\" />\r\n\t\t\t\t</namespaces>\r\n\t\t\t</pages>\r\n\t\t</system.web>\r\n</configuration>\r\n"
  },
  {
    "path": "Website/Composite/content/views/dev/systemlog/SystemLogPageBinding.js",
    "content": "SystemLogPageBinding.prototype = new PageBinding;\r\nSystemLogPageBinding.prototype.constructor = SystemLogPageBinding;\r\nSystemLogPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SystemLogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SystemLogPageBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSystemLogPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[SystemLogPageBinding]\";\r\n}\r\n\r\n/**\r\n * Broadcast log opened.\r\n * @overloads {PageBinding#onBindingRegister}\r\n */\r\nSystemLogPageBinding.prototype.onBindingRegister = function () {\r\n\r\n\tSystemLogPageBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( WindowBinding.ACTION_LOADED, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tEventBroadcaster.broadcast (\r\n\t\t\t\tBroadcastMessages.SYSTEMLOG_OPENED, \r\n\t\t\t\taction.target.getContentWindow ()\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Broadcast log closed.\r\n * @overloads {PageBinding#onBindingDispose}\r\n */\r\nSystemLogPageBinding.prototype.onBindingDispose = function () {\r\n\r\n\tEventBroadcaster.broadcast ( BroadcastMessages.SYSTEMLOG_CLOSED );\r\n\tSystemLogPageBinding.superclass.onBindingDispose.call ( this );\r\n}\r\n\r\n\r\n\r\n// BINDING COUNT DEBUGGING .................................................\r\n\r\n/**\r\n * Display binding count.\r\n *\r\nSystemLogPageBinding.prototype.countBindings = function () {\r\n\t\r\n\tthis.logger.debug ( \"Binding instance count: \" + UserInterface.getBindingCount ());\r\n}\r\n\r\n/**\r\n * Set point.\r\n *\r\nSystemLogPageBinding.prototype.setPoint = function () {\r\n\t\r\n\tUserInterface.setPoint ();\r\n\tthis.logger.debug ( \"Point at \" + UserInterface.getBindingCount () + \" bindings.\" );\r\n}\r\n\r\n/**\r\n * Clear point and log new bindings.\r\n *\r\nSystemLogPageBinding.prototype.clearPoint = function () {\r\n\t\r\n\tvar keys = UserInterface.getPoint ();\r\n\tif ( keys ) {\r\n\t\tif ( keys.hasEntries ()) {\r\n\t\t\tvar debug = \"\";\r\n\t\t\twhile ( keys.hasNext ()) {\r\n\t\t\t\tvar key = keys.getNext ();\r\n\t\t\t\tdebug += UserInterface.getBindingByKey ( key ).toString () + ( Client.isExplorer ? \"\\n\\n\" : \"\\n\" );\r\n\t\t\t}\r\n\t\t\tthis.logger.debug ( debug );\r\n\t\t} else {\r\n\t\t\tthis.logger.debug ( \"No new bindings!\" );\r\n\t\t}\r\n\t} else {\r\n\t\tthis.logger.error ( \"No point set!\" );\r\n\t}\r\n\tUserInterface.clearPoint ();\r\n}\r\n\r\n/**\r\n * @param {boolean} isTrack\r\n *\r\nSystemLogPageBinding.prototype.autoTrack = function ( isTrack ) {\r\n\t\r\n\tif ( isTrack ) {\r\n\t\tthis.logger.debug ( \"Tracking every 10 seconds.\" );\r\n\t} else {\r\n\t\tthis.logger.debug ( \"Untracking.\" );\r\n\t}\r\n\tUserInterface.autoTrackDisposedBindings ( isTrack );\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/content/views/dev/systemlog/systemlog.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>    \r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.SystemLog</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"SystemLogPageBinding.js\"></script>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"systemlog.css.aspx\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page id=\"page\" image=\"${icon:systemlog}\" binding=\"SystemLogPageBinding\">\r\n\t\t\t<ui:toolbar>\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<!-- \r\n\t\t\t\t\t<ui:toolbargroup id=\"filterbuttons\">\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"All\" type=\"checkbox\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Info\" type=\"checkbox\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Debug\" type=\"checkbox\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Error\" type=\"checkbox\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Warn\" type=\"checkbox\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Fatal\" type=\"checkbox\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Fine\" type=\"checkbox\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t-->\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton \r\n\t\t\t\t\t\t\tlabel=\"Clear\" \r\n\t\t\t\t\t\t\timage=\"${icon:delete}\" \r\n\t\t\t\t\t\t\ttitle=\"Clear the log\" \r\n\t\t\t\t\t\t\toncommand=\"SystemLogger.clear ()\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t<!-- \r\n\t\t\t\tBINDING COUNT DEBUGGING\r\n\t\t\t\t<ui:toolbarbody align=\"right\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Bindingcount\" oncommand=\"bindingMap.page.countBindings ();\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Autotracking\" type=\"checkbox\" oncommand=\"bindingMap.page.autoTrack ( this.isChecked );\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Set point\" oncommand=\"bindingMap.page.setPoint ();\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"Clear point\" oncommand=\"bindingMap.page.clearPoint ();\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t-->\r\n\t\t\t</ui:toolbar>\r\n\t\t\t<ui:window id=\"outputview\" url=\"systemlogoutput.aspx\"/>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/systemlog/systemlog.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");"
  },
  {
    "path": "Website/Composite/content/views/dev/systemlog/systemlogoutput.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n    \r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Log Output</title>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"systemlogoutput.css.aspx\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t//<![CDATA[\r\n\t\t\tDocumentManager.isDocumentSelectable = true;\r\n\t\t\tDocumentManager.hasNativeContextMenu = true;\r\n\t\t//]]>\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/systemlog/systemlogoutput.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n/* BINDINGS ................................................................ */\r\n\r\n/*\r\nbody {\r\n\t#ie behavior: url(\"${root}/bindings/bindings.ashx?root\");\r\n\t#moz -moz-binding: url(\"${root}/bindings/bindings.xml#root\");\r\n}\r\n*/\r\n\r\n/* LAYOUT .................................................................. */\r\n\r\nhtml,\r\nbody {\r\n\theight: 100%;\r\n\tborder: none !important;\r\n}\r\nhtml {\r\n\tbackground-color: black;\t\r\n}\r\nbody {\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\toverflow: auto;\r\n\tfont-size: 70%;\r\n}\r\ndiv {\r\n\tcolor: white;\r\n\tfont-size: 1.2em;\r\n\tborder: 1px solid black;\r\n\tpadding-left: 1.5em;\r\n}\r\npre {\r\n\tmargin: 0 0 1em 0;\r\n\tpadding: 0;\r\n}\r\npre,\r\nspan {\r\n\tfont-family: Arial, sans-serif;\t\r\n}\r\nspan {\r\n\tfont-size: 0.8em;\r\n\tdisplay: block;\r\n\tmargin-left: -1em;\r\n}\r\ndiv.info {\r\n\tcolor: #77BBFF;\r\n}\r\ndiv.debug {\r\n\tcolor: #00FF00;\r\n}\r\ndiv.warn {\r\n\tcolor: pink;\r\n}\r\ndiv.error {\r\n\tcolor: #FF8844;\r\n}\r\ndiv.fine {\r\n\tcolor: #FFCC22;\r\n}\r\ndiv.fatal {\r\n\tcolor: #FF0000;\r\n\tfont-weight: bold;\t\r\n}\r\ndiv.info span { \r\n\tcolor: #3377BB;\r\n}\r\ndiv.debug span {\r\n\tcolor: #008800;\r\n}\r\ndiv.warn span {\r\n\tcolor: purple;\r\n}\r\ndiv.error span {\r\n\tcolor: #884422;\r\n}\r\ndiv.fine span { \r\n\tcolor: #CC8822;\r\n}\r\ndiv.fatal span {\r\n\tcolor: #FF0000;\r\n\tfont-weight: normal;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/dev/viewsource/ViewSourcePageBinding.js",
    "content": "ViewSourcePageBinding.prototype = new PageBinding;\r\nViewSourcePageBinding.prototype.constructor = ViewSourcePageBinding;\r\nViewSourcePageBinding.superclass = PageBinding.prototype;\r\n\r\nViewSourcePageBinding.XSLT = Resolver.resolve ( \r\n\t\"${root}/transformations/viewsource-xml.xsl\" \r\n);\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ViewSourcePageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ViewSourcePageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._action = null;\r\n\t\r\n\t/**\r\n\t * @type {XSLTransformer}\r\n\t */\r\n\tthis._transformer = null;\r\n\t\r\n\t/**\r\n\t * @type {DOMDocument}\r\n\t */\r\n\tthis._doc = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._url = null;\r\n\t\r\n\t/**\r\n\t * @type {HostedViewDefinition}\r\n\t */\r\n\tthis._viewDefinition = null;\r\n\t\r\n\t/**\r\n\t * @type {WindowBinding}\r\n\t */\r\n\tthis._windowBinding = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nViewSourcePageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ViewSourcePageBinding]\";\r\n}\r\n\r\nViewSourcePageBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tViewSourcePageBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( WindowBinding.ACTION_ONLOAD, this );\r\n\t\r\n\tthis._transformer = new XSLTransformer ();\r\n\tthis._transformer.importStylesheet ( ViewSourcePageBinding.XSLT );\r\n\r\n\tvar url = this._getParameterByName(\"url\");\r\n\tif(url) {\r\n\t\tthis._url = url;\r\n\t\tthis._action = DockTabPopupBinding.CMD_VIEWSOURCE;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n */\r\nViewSourcePageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tViewSourcePageBinding.superclass.setPageArgument.call ( this, arg );\r\n\r\n\tthis._action = arg.action;\r\n\tthis._doc = arg.doc;\r\n\tthis._url = arg.url;\r\n\t\r\n\tswitch ( this._action ) {\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSOURCE :\r\n\t\t\tthis.image = \"${icon:editor-sourceview}\";\r\n\t\t\tbreak;\r\n\t\tcase DockTabPopupBinding.CMD_VIEWGENERATED :\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSERIALIZED :\r\n\t\t\tthis.image = \"${icon:default}\";\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tthis._inject ();\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nViewSourcePageBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tViewSourcePageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase WindowBinding.ACTION_ONLOAD :\r\n\t\t\tthis._windowBinding = binding;\r\n\t\t\tApplication.framework ( binding.getContentDocument ());\r\n\t\t\tthis.reflex ();\r\n\t\t\tthis._inject ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\nViewSourcePageBinding.prototype._getParameterByName = function ( name ) {\r\n\tvar match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);\r\n\treturn match && decodeURIComponent(match[1].replace(/\\+/g, ' '));\r\n}\r\n\r\n/** \r\n * Inject!\r\n */\r\nViewSourcePageBinding.prototype._inject = function () {\r\n\r\n\tif ((this._doc || this._url) && this._windowBinding) {\r\n\t\t\r\n\t\tvar area = document.getElementById ( \"raw\" );\r\n\t\tvar doc = this._windowBinding.getContentDocument ();\r\n\t\t\r\n\t\tif(Client.isEdge) {\r\n\t\t\tvar markup = this._getMarkup();\r\n\t\t\t// raw output only!\r\n\t\t\tarea.value = markup;\r\n\t\t\tdoc.body.innerHTML = \"Only raw source available in Microsoft Edge.\";\r\n\t\t\tvar tabbox = window.bindingMap.tabbox;\r\n\t\t\tvar rawtab = window.bindingMap.rawtab;\r\n\t\t\ttabbox.select(rawtab);\r\n\r\n\t\t} else if (Client.isExplorer && this._action == DockTabPopupBinding.CMD_VIEWGENERATED) {\r\n\t\t\t\r\n\t\t\tvar markup = this._doc.body.innerHTML;\r\n\t\t\t\r\n\t\t\t// raw output only!\r\n\t\t\tarea.value = markup;\r\n\t\t\tdoc.body.innerHTML = \"Only raw source available in Internet Explorer.\";\r\n\t\t\r\n\t\t} \r\n\t\telse {\r\n\t\t\r\n\t\t\tvar markup = this._getMarkup ();\r\n\t\t\t\r\n\t\t\tif ( markup ) {\r\n\t\t\t\r\n\t\t\t\t// raw output\r\n\t\t\t\tarea.value = markup;\r\n\t\t\t\t\r\n\t\t\t\t// fancy output\r\n\t\t\t\tvar isIgnore = true;\r\n\t\t\t\tvar source = XMLParser.parse ( markup, isIgnore );\r\n\t\t\t\tif ( source ) {\r\n\t\t\t\t\t/* \r\n\t\t\t\t\tthis.logger.debug ( \r\n\t\t\t\t\t\tDOMSerializer.serialize ( \r\n\t\t\t\t\t\t\tthis._transformer.transformToDocument ( source ), \r\n\t\t\t\t\t\t\ttrue \r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t);\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tvar result = this._transformer.transformToString ( source );\r\n\t\t\t\t\tdoc.body.innerHTML = result;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// the non-wellformed message is already present in markup.\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// display result\r\n\t\twindow.bindingMap.cover.hide ();\r\n\t}\r\n}\r\n\r\n/** \r\n * Inject!\r\n */\r\nViewSourcePageBinding.prototype._getMarkup = function () {\r\n\t\r\n\tvar result = null;\r\n\t\r\n\tswitch ( this._action ) {\r\n\t\t\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSOURCE :\r\n\t\t\tvar url = this._url ? this._url : this._doc.location.toString();\r\n\t\t\tvar request = DOMUtil.getXMLHTTPRequest ();\r\n\t\t\trequest.open ( \"get\", url, false );\r\n\t\t\trequest.send ( null );\r\n\t\t\tresult = request.responseText;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase DockTabPopupBinding.CMD_VIEWGENERATED :\r\n\t\t\t\r\n\t\t\tif ( Client.isMozilla ) {\r\n\t\t\t\tresult = DOMSerializer.serialize ( this._doc );\r\n\t\t\t} else {\r\n\t\t\t\tDialog.warning ( \"Browser Dysfunction\", \"Generated source not available for Internet Explorer.\" );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSERIALIZED :\r\n\t\t\t\r\n\t\t\talert ( \"ViewSourcePageBinding: UPDATE REQUIRED!\" );\r\n\t\t\t//result = this._viewBinding.getRootBinding ().serializeToString ();\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\treturn result;\r\n\t\r\n}"
  },
  {
    "path": "Website/Composite/content/views/dev/viewsource/blank.html",
    "content": "<html>\r\n\t<head>\r\n\t\t<title>Blank</title>\r\n\t</head>\r\n\t<body>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/viewsource/viewsource.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.ViewSource</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"viewsource.css.aspx\"/>\r\n\t\t<script type=\"text/javascript\" src=\"ViewSourcePageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page binding=\"ViewSourcePageBinding\">\r\n\t\t\t<ui:cover id=\"cover\"/>\r\n\t\t\t<ui:tabbox id=\"tabbox\">\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab label=\"${string:Website.Content.Views.ViewSource.LabelFormatted}\"/>\r\n\t\t\t\t\t<ui:tab id=\"rawtab\" label=\"${string:Website.Content.Views.ViewSource.LabelRaw}\"/>\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel id=\"fancypanel\">\r\n\t\t\t\t\t\t<ui:window id=\"fancy\" url=\"viewsourcecontent.html\"/>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t<textarea id=\"raw\" wrap=\"off\" readonly=\"true\"></textarea>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/viewsource/viewsource.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\ntextarea#raw {\r\n\tborder: none;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tfont-family: \"Courier New\", monospace;\r\n\tfont-size: 13px;\r\n\t/*\r\n\t#moz overflow: -moz-scrollbars-vertical;\r\n\t#ie overflow-y: scroll;\t\r\n\t*/\r\n\t\r\n}\r\ndiv#locked {\r\n\tdisplay: none;\r\n\tposition: absolute;\r\n\t#moz top: 40px;\r\n\t#ie top: 10px;\r\n\tright: 22px;\r\n\twidth: 24px;\r\n\theight: 24px;\r\n\tcursor: not-allowed;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/dev/viewsource/viewsourcecontent.css",
    "content": "html {\r\n\tborder: none;\r\n}\r\nbody {\r\n\tbackground-color: white;\r\n\tpadding: 0 12px 12px 12px;\r\n\tfont-family: \"Courier New\", monospace;\r\n\tfont-size: 13px;\r\n\twhite-space: pre;\r\n\toverflow: auto;\r\n}\r\ndiv {\r\n\twhite-space: nowrap;;\r\n}\r\npre {\r\n\tmargin:0px; \r\n\tdisplay:inline;\r\n}\r\nspan.atts {\r\n\twhite-space: nowrap;\t\r\n}\r\ndiv.element {\r\n\tcolor: rgb(63,127,127);\r\n}\r\ndiv.comment {\r\n\tcolor: rgb(63,95,191);\r\n}\r\ndiv.comment pre {\r\n\tdisplay: block;\r\n}\r\ndiv.pi {\r\n\tcolor: rgb(127,0,0);\r\n}\r\nspan.atts {\r\n\tcolor: rgb(127,0,127);\r\n}\r\nspan.attval {\r\n\tcolor: rgb(0,0,255);\r\n}\r\ndiv.text,\r\nspan.text {\r\n\tcolor: rgb(0,0,0);\r\n}\r\ndiv.haschildren {\r\n\t#moz cursor: pointer;\r\n\t#ie cursor: hand;\r\n}\r\ndiv.closed div.children {\r\n\tdisplay: none;\r\n}\r\nspan.twisty {\r\n\twidth: 8px;\r\n\theight: 7px;\r\n\tbackground: url(\"images/minus.png\") transparent no-repeat 0 0;\r\n\tposition: absolute;\r\n\toverflow: hidden;\r\n\tmargin-top: 5px;\r\n\tmargin-left: -12px;\r\n\t#moz -moz-user-select: none;\r\n}\r\ndiv.closed span.twisty {\r\n\tbackground-image: url(\"images/plus.png\");\r\n}\r\n\r\n/* DEFAULT MESSAGE - PLEASE FIX THE TERRIBLE URL! */\r\n\r\ndiv#defaultmessage {\r\n\tposition: absolute;\r\n\ttop: 20px;\r\n\tleft: 20px;\r\n\twidth: 300px;\r\n\theight: 32px;\r\n\tpadding-left: 40px;\r\n\tpadding-top: 10px;\r\n\t-moz-box-sizing: border-box;\r\n\t#region default\r\n\t \tfont-family: Tahoma, sans-serif;\r\n\t \tfont-size: 11px;\r\n\t#endregion\r\n\t#region vista\r\n\t \tfont-family: \"Segoe UI\", Tahoma, sans-serif;\r\n \t\tfont-size: 12px;\r\n\t#endregion\r\n\t#region osx\r\n\t \tfont-family: \"Lucida Grande\", sans-serif;\r\n \t\tfont-size: 1;\r\n \t#endregion\r\n}\r\ndiv#defaultmessage p {\r\n\tmargin: 0;\r\n\tpadding: 0;\t\r\n}\r\ndiv#vignette {\r\n\twidth: 32px;\r\n\theight: 32px;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\t#alphabackdrop: url(\"${folder}/../../../../skins/system/dialogpages/error_32.png\");\r\n}"
  },
  {
    "path": "Website/Composite/content/views/dev/viewsource/viewsourcecontent.html",
    "content": "<html>\r\n\t<head>\r\n\t\t<title>Composite.Management.ViewSourceContent</title>\r\n\t\t<script type=\"text/javascript\" src=\"viewsourcecontent.js\"></script>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"viewsourcecontent.css.aspx\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<div id=\"defaultmessage\">\r\n\t\t\t<div id=\"vignette\"></div>\r\n\t\t\t<p>Not well-formed.</p>\r\n\t\t</div>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/dev/viewsource/viewsourcecontent.js",
    "content": "var DOMEvents = top.DOMEvents;\r\nvar Node = top.Node;\r\nvar CSSUtil = top.CSSUtil;\r\nvar Client = top.Client;\r\n\r\n/**\r\n * @class\r\n */ \r\nvar ViewSourceContent = new function () {\r\n\t\r\n\tvar logger = top.SystemLogger.getLogger ( \"ViewSourceContent\" );\r\n\tvar listen = true;\r\n\t\r\n\t/**\r\n\t * Timeout fixes a strange bug in exploder.\r\n\t * @param {DOMElement} e\r\n\t */ \r\n\tfunction twist ( element ) {\r\n\t\tif ( listen == true ) {\r\n\t\t\telement.className = element.className == \"open\" ? \"closed\" : \"open\";\r\n\t\t\tlisten = false;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tlisten = true;\r\n\t\t\t}, 0 );\t\r\n\t\t} \r\n\t}\r\n\t\r\n\t/**\r\n\t * @implements {IEventListener}\r\n\t * @param {MouseEvent} e\r\n\t */\r\n\tthis.handleEvent = function ( e ) {\r\n\t\r\n\t\tif ( !DOMEvents.isRightButton ( e )) {\r\n\t\t\tvar target = DOMEvents.getTarget ( e );\r\n\t\t\twhile ( target.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\t\tif ( CSSUtil.hasClassName ( target, \"haschildren\" )) {\r\n\t\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\t\ttwist ( target.parentNode );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget = target.parentNode;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tDOMEvents.addEventListener ( \r\n\t\tdocument, \r\n\t\tDOMEvents.MOUSEDOWN, \r\n\t\tthis\r\n\t);\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/ImageEditor.js",
    "content": "/**\r\n * @class\r\n */\r\nvar ImageEditor = new function () {\r\n\t\r\n\tvar logger = SystemLogger.getLogger ( \"ImageEditor\" );\r\n\tvar scales = [ 0.12, 0.25, 0.5, 1, 2, 4, 8 ];\r\n\tvar index = 3;\r\n\t\t\r\n\tthis.MODE_MOVE \t\t= \"move\";\r\n\tthis.MODE_SELECT \t= \"select\";\r\n\tthis.MODE_ZOOMIN \t= \"zoomin\";\r\n\tthis.MODE_ZOOMOUT \t= \"zoomout\";\r\n\t\r\n\t/**\r\n\t * @type {number}\r\n\t */\r\n\tthis.scale = scales [ index ];\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.mode = null;\r\n\t\r\n\t/**\r\n\t * True while user is dragging a new selection.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isSelecting = false;\r\n\t \r\n\t/**\r\n\t * Set mode.\r\n\t * @param {string} state\r\n\t */\r\n\tthis.setMode = function ( mode ) {\r\n\t\t\r\n\t\tif ( this.mode ) {\r\n\t\t\tbindingMap.imagestage.detachClassName ( this.mode );\r\n\t\t}\r\n\t\tbindingMap.imagestage.attachClassName ( mode );\r\n\t\tbindingMap.imagecursor.setMode ( mode );\r\n\t\tthis.mode = mode;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Implements {@link IBroadcastListener}\r\n\t * @param {string} broadcast\r\n\t */\r\n\tthis.handleBroadcast = function ( broadcast ) {\r\n\t\t\r\n\t\tswitch ( broadcast ) {\r\n\t\t\tcase BroadcastMessages.KEY_SHIFT_DOWN :\r\n\t\t\t\tif ( this.mode == ImageEditor.MODE_ZOOMIN ) {\r\n\t\t\t\t\tthis.setMode ( ImageEditor.MODE_ZOOMOUT );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase BroadcastMessages.KEY_SHIFT_UP :\r\n\t\t\t\tif ( this.mode == ImageEditor.MODE_ZOOMOUT ) {\r\n\t\t\t\t\tthis.setMode ( ImageEditor.MODE_ZOOMIN );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase WindowManager.WINDOW_UNLOADED_BROADCAST :\r\n\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.KEY_SHIFT_DOWN, this );\r\n\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.KEY_SHIFT_UP, this );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.KEY_SHIFT_DOWN, this );\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.KEY_SHIFT_UP, this );\r\n\tEventBroadcaster.subscribe ( WindowManager.WINDOW_UNLOADED_BROADCAST, this );\r\n\t\r\n\t/**\r\n\t * Zoom in.\r\n\t */\r\n\tthis.zoomIn = function () {\r\n\t\t\r\n\t\tif ( index + 1 < scales.length ) {\r\n\t\t\tthis.scale = scales [ ++ index ];\r\n\t\t\tthis._updateZoomBindings ();\r\n\t\t\trepaint ();\r\n\t\t}\r\n\t\t\r\n\t}\r\n\t\r\n\t/**\r\n\t * Zoom out.\r\n\t */\r\n\tthis.zoomOut = function () {\r\n\t\t\r\n\t\tif ( index > 0 ) {\r\n\t\t\tthis.scale = scales [ -- index ];\r\n\t\t\tthis._updateZoomBindings ();\r\n\t\t\trepaint ();\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Zoom to specified index.\r\n\t * @param {int} newIndex\r\n\t */\r\n\tthis.zoomTo = function ( newIndex ) {\r\n\t\t\r\n\t\tnewIndex = Number ( newIndex );\r\n\t\t\r\n\t\tif ( newIndex != index ) {\r\n\t\t\tindex = newIndex;\r\n\t\t\tthis.scale = scales [ index ];\r\n\t\t\tthis._updateZoomBindings ();\r\n\t\t\trepaint ();\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Update zoom broadcasters and zoom selector.\r\n\t */\r\n\tthis._updateZoomBindings = function () {\r\n\t\t\r\n\t\t// broadcasters\r\n\t\tvar b1 = bindingMap.broadcasterCanZoomIn;\r\n\t\tvar b2 = bindingMap.broadcasterCanZoomOut;\r\n\t\t\r\n\t\tvar isMin = index == 0;\r\n\t\tvar isMax = index == scales.length - 1;\r\n\t\t\r\n\t\tif ( isMin ) {\r\n\t\t\tb2.disable ();\r\n\t\t\tb1.enable ();\r\n\t\t} else if ( isMax ) {\r\n\t\t\tb2.enable ();\r\n\t\t\tb1.disable ();\r\n\t\t} else {\r\n\t\t\tb2.enable ();\r\n\t\t\tb1.enable ();\r\n\t\t}\r\n\t\t\r\n\t\t// zoom selector\r\n\t\tbindingMap.zoomselector.selectByValue ( \r\n\t\t\tindex, true \r\n\t\t);\r\n\t\t\r\n\t\t// zoom menugroup\r\n\t\tvar group = bindingMap.zoommenugroup;\r\n\t\tvar items = group.getChildBindingsByLocalName ( \"menuitem\" );\r\n\t\titems.each ( function ( item ) {\r\n\t\t\tif ( item.getProperty ( \"zoom\" ) == index ) {\r\n\t\t\t\titem.check ( true );\r\n\t\t\t} else {\r\n\t\t\t \titem.uncheck ( true );\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\t\r\n\t/**\r\n\t * Snap value to nearest number.\r\n\t * @param {number} value\r\n\t * @param {number} number\r\n\t */\r\n\tthis.grid = function ( value, number ) {\r\n\t\t\r\n\t\tvar ceil = Math.ceil ( value );\r\n\t\tvar remainder = value % number;\r\n\t\tif ( remainder > 0 ) {\r\n\t\t\tvalue = value - remainder + number;\r\n\t\t}\r\n\t  \treturn value;\r\n\t}\r\n\t\t\r\n\t\r\n\t/**\r\n\t * Repaint stuff.\r\n\t */\r\n\tfunction repaint () {\r\n\t\t\r\n\t\tbindingMap.imagestagecontainer.bindingElement.style.visibility = \"hidden\";\r\n\t\tbindingMap.imagebox.repaint ();\r\n\t\tbindingMap.imageselection.repaint ();\r\n\t\tbindingMap.imagescrollbox.repaint ();\r\n\t\tbindingMap.imagestagecontainer.bindingElement.style.visibility = \"visible\";\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/ImageEditorAction.js",
    "content": "ImageEditorAction.TYPE_CROP \t\t= \"c\"; // x,y,w,h\r\nImageEditorAction.TYPE_SCALE \t\t= \"s\"; // 'px'|'%',w,h\r\nImageEditorAction.TYPE_ROTATE \t\t= \"r\"; // d\r\nImageEditorAction.TYPE_FLIP \t\t= \"f\"; // true|false (horizontal)\r\nImageEditorAction.TYPE_SELECT\t\t= \"x\"; // x,y,w,h\r\nImageEditorAction.TYPE_SAVE\t\t\t= \"save\";\r\n\r\n/**\r\n * String values to be placed in quotes by this method.\r\n * @param {object} value\r\n * @return {string}\r\n */\r\nImageEditorAction.compute = function ( value ) {\r\n\t\r\n\tif ( parseInt ( value ).toString () == value || parseFloat ( value ).toString () == value || value == true || value == false ) {\r\n\t\tvalue = new String ( encodeURIComponent ( value ));\r\n\t} else {\r\n\t\tvalue = new String ( \"\\\"\" + encodeURIComponent ( value ) + \"\\\"\" );\r\n\t}\r\n\treturn value;\r\n}\r\n\r\n/**\r\n * @class\r\n * @param {string} type\r\n * @param {array} args\r\n */\r\nfunction ImageEditorAction ( type, args ) {\r\n\t\r\n\tthis.type = type;\r\n\tthis.args = args;\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */ \r\nImageEditorAction.prototype.toString = function () {\r\n\r\n\tvar result = this.type;\r\n\r\n\tif ( this.args ) {\r\n\t\tresult += \"(\"\r\n\t\tvar args = new List ( this.args );\r\n\t\twhile ( args.hasNext ()) {\r\n\t\t\tresult += ImageEditorAction.compute ( args.getNext ());\r\n\t\t\tif ( args.hasNext ()) {\r\n\t\t\t\tresult += \",\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tresult += \")\"\r\n\t}\r\n\treturn result;\t\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/ImageEditorActions.js",
    "content": "/**\r\n * Image editor actions.\r\n * @class\r\n */\r\nvar ImageEditorActions = new function () {\r\n\t\r\n\tvar logger \t\t\t\t= SystemLogger.getLogger ( \"ImageEditorActions\" );\r\n\tvar actionList \t\t\t= new List ();\r\n\tvar redoList \t\t\t= new List ();\r\n\tvar url \t\t\t\t= document.location.search.split ( \"?src=\" )[ 1 ];\r\n\t\r\n\tvar SERVICE_URL \t\t= Resolver.resolve ( \"${root}/services/Media/ImageManipulator.ashx?src=\" ) + url;\r\n\tvar DIALOG_SCALE_URL \t= \"${root}/content/dialogs/imageeditor/scaleimage/scaleimage.aspx\";\r\n\t\r\n\t/**\r\n\t * Save.\r\n\t */\r\n\tthis.save = function () {\r\n\t\r\n\t\tactionList.add ( \r\n\t\t\tnew ImageEditorAction (\r\n\t\t\t\tImageEditorAction.TYPE_SAVE \r\n\t\t\t)\r\n\t\t);\r\n\t\t\r\n\t\tbindingMap.imagebox.deInitialize ();\r\n\t\trefresh ();\r\n\t\tactionList.clear ();\r\n\t\tupdateUndoBroadcasters ();\r\n\t}\r\n\t\r\n\t/**\r\n\t * Crop.\r\n\t */\r\n\tthis.crop = function () {\r\n\t\t\r\n\t\tvar geometry = bindingMap.imageselection.geometry;\r\n\t\t\r\n\t\tactionList.add ( \r\n\t\t\tnew ImageEditorAction (\r\n\t\t\t\tImageEditorAction.TYPE_CROP, \r\n\t\t\t\t[\r\n\t\t\t\t\tgeometry.x,\r\n\t\t\t\t\tgeometry.y,\r\n\t\t\t\t\tgeometry.w,\r\n\t\t\t\t\tgeometry.h\r\n\t\t\t\t]\r\n\t\t\t)\r\n\t\t);\r\n\t\t\r\n\t\tbindingMap.broadcasterHasSelection.disable (); // TODO: move this?\r\n\t\t\r\n\t\tbindingMap.imagebox.deInitialize ();\r\n\t\tredoList.clear ();\r\n\t\trefresh ();\r\n\t}\r\n\t\r\n\t/**\r\n\t * Rotate.\r\n\t * @param {int} degrees\r\n\t */\r\n\tthis.rotate = function ( degrees ) {\r\n\t\r\n\t\tactionList.add ( \r\n\t\t\tnew ImageEditorAction (\r\n\t\t\t\tImageEditorAction.TYPE_ROTATE, \r\n\t\t\t\t[ degrees ]\r\n\t\t\t)\r\n\t\t);\r\n\t\tbindingMap.imagebox.deInitialize ();\r\n\t\tredoList.clear ();\r\n\t\trefresh ();\r\n\t}\r\n\t\r\n\t/**\r\n\t * Flip.\r\n\t * @param {boolean} isHorizontal\r\n\t */\r\n\tthis.flip = function ( isHorizontal ) {\r\n\t\r\n\t\tactionList.add ( \r\n\t\t\tnew ImageEditorAction (\r\n\t\t\t\tImageEditorAction.TYPE_FLIP, \r\n\t\t\t\t[ isHorizontal ]\r\n\t\t\t)\r\n\t\t);\r\n\t\tbindingMap.imagebox.deInitialize ();\r\n\t\tredoList.clear ();\r\n\t\trefresh ();\r\n\t}\r\n\t\r\n\t/**\r\n\t * Scale.\r\n\t */\r\n\tthis.scale = function () {\r\n\t\t\r\n\t\tvar dialogHandler = {\r\n\t\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\t\tactionList.add ( \r\n\t\t\t\t\t\tnew ImageEditorAction (\r\n\t\t\t\t\t\t\tImageEditorAction.TYPE_SCALE, \r\n\t\t\t\t\t\t\t[ result.unit, result.width, result.height ]\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbindingMap.imagebox.deInitialize ();\r\n\t\t\t\t\tredoList.clear ();\r\n\t\t\t\t\trefresh ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tvar dialogArgument = {\r\n\t\t\twidth : bindingMap.imagebox.geometry.w,\r\n\t\t\theight : bindingMap.imagebox.geometry.h\r\n\t\t}\r\n\t\t\r\n\t\tDialog.invokeModal ( \r\n\t\t\tDIALOG_SCALE_URL, \r\n\t\t\tdialogHandler, \r\n\t\t\tdialogArgument \r\n\t\t);\r\n\t}\r\n\t\r\n\t/**\r\n\t * Select.\r\n\t * TODO: add selections to the undo list?\r\n\t */\r\n\tthis.select = function () {\r\n\t\t\r\n\t\t/*\r\n\t\tvar geometry = bindingMap.imageselection.geometry;\r\n\t\t\r\n\t\tactionList.add ( \r\n\t\t\tnew ImageEditorAction (\r\n\t\t\t\tImageEditorAction.TYPE_SELECT, \r\n\t\t\t\t[\r\n\t\t\t\t\tgeometry.x,\r\n\t\t\t\t\tgeometry.y,\r\n\t\t\t\t\tgeometry.w,\r\n\t\t\t\t\tgeometry.h\r\n\t\t\t\t]\r\n\t\t\t)\r\n\t\t);\r\n\t\tredoList.clear ();\r\n\t\tupdateUndoBroadcasters ();\t\r\n\t\t*/\r\n\t}\r\n\t\r\n\t/**\r\n\t * Undo.\r\n\t */\r\n\tthis.undo = function () {\r\n\t\t\r\n\t\tvar lastAction = actionList.extractLast ();\r\n\t\t\r\n\t\tredoList.add ( \r\n\t\t\tlastAction\r\n\t\t);\r\n\t\t\r\n\t\tswitch ( lastAction.type ) {\r\n\t\t\tcase ImageEditorAction.TYPE_SELECT :\r\n\t\t\t\trestoreSelection ( lastAction )\r\n\t\t\t\t//updateUndoBroadcasters ();\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tbindingMap.imagebox.deInitialize ();\r\n\t\t\t\trefresh ();\r\n\t\t\t\tupdateUndoBroadcasters ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Redo.\r\n\t */\r\n\tthis.redo = function () {\r\n\t\t\r\n\t\tvar nextAction = redoList.extractLast ();\r\n\t\t\r\n\t\tactionList.add ( \r\n\t\t\tnextAction\r\n\t\t);\r\n\t\t\r\n\t\tswitch ( nextAction.type ) {\r\n\t\t\tcase ImageEditorAction.TYPE_SELECT :\r\n\t\t\t\trestoreSelection ( nextAction )\r\n\t\t\t\t//updateUndoBroadcasters ();\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tbindingMap.imagebox.deInitialize ();\r\n\t\t\t\trefresh ();\r\n\t\t\t\tupdateUndoBroadcasters ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Compile image url.\r\n\t * @return {string}\r\n\t */\r\n\tthis.getURL = function () {\r\n\t\t\r\n\t\tvar result = SERVICE_URL;\r\n\t\tvar isSave = false;\r\n\t\t\r\n\t\tif ( actionList.hasEntries ()) {\r\n\t\t\tresult += \"&actions=\";\r\n\t\t\tactionList.reset ();\r\n\t\t\twhile ( actionList.hasNext ()) {\r\n\t\t\t\tvar action = actionList.getNext ();\r\n\t\t\t\tswitch ( action.type ) {\r\n\t\t\t\t\tcase ImageEditorAction.TYPE_CROP :\r\n\t\t\t\t\tcase ImageEditorAction.TYPE_SCALE :\r\n\t\t\t\t\tcase ImageEditorAction.TYPE_ROTATE :\r\n\t\t\t\t\tcase ImageEditorAction.TYPE_FLIP :\r\n\t\t\t\t\t\tresult += action.toString ();\r\n\t\t\t\t\t\tif ( actionList.hasNext ()) {\r\n\t\t\t\t\t\t\tresult += \";\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase ImageEditorAction.TYPE_SAVE :\r\n\t\t\t\t\t\tisSave = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( isSave ) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Besides the \"save\" parameter, view handle and console ID is used \r\n\t\t\t * to correctly trigger a SaveStatus instruction on the MessageQueue.\r\n\t\t\t */\r\n\t\t\tresult += \"&save=true&viewId=\" + bindingMap.editorpage.viewhandle + \"&consoleId=\" + Application.CONSOLE_ID;\r\n\t\t}\r\n\t\tlogger.debug ( result );\r\n\t\treturn result;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Update the image and hide the selection.\r\n\t */\r\n\tfunction refresh () {\r\n\t\r\n\t\tbindingMap.imagebox.refresh ();\r\n\t\tbindingMap.imageselection.hide ();\r\n\t\tupdateUndoBroadcasters ();\r\n\t}\r\n\t\r\n\t/**\r\n\t * Update undo-redo broadcasters. Note that the dirty stuff should normally \r\n\t * be handled by the EditorPageBinding. This may cause substantial misery.\r\n\t */\r\n\tfunction updateUndoBroadcasters () {\r\n\t\t\r\n\t\tvar undo = bindingMap.broadcasterCanUndo;\r\n\t\tvar redo = bindingMap.broadcasterCanRedo;\r\n\t\t\r\n\t\tif ( actionList.hasEntries ()) {\r\n\t\t\tif ( undo.isDisabled ()) {\r\n\t\t\t\tundo.dispatchAction ( \r\n\t\t\t\t\tEditorPageBinding.ACTION_DIRTY \r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tundo.enable ();\r\n\t\t} else {\r\n\t\t\tundo.disable ();\r\n\t\t\tundo.dispatchAction ( \r\n\t\t\t\tEditorPageBinding.ACTION_CLEAN \r\n\t\t\t);\r\n\t\t}\r\n\t\t\r\n\t\tif ( redoList.hasEntries ()) {\r\n\t\t\tredo.enable ();\r\n\t\t} else {\r\n\t\t\tredo.disable ();\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Restore selection.\r\n\t * @param {ImageAction} action\r\n\t */\r\n\tfunction restoreSelection ( action ) {\r\n\t\t\r\n\t\tif ( action.type == ImageEditorAction.TYPE_SELECT ) {\t\t\r\n\t\t\twith ( bindingMap.imageselection ) {\r\n\t\t\t\tsetX ( action.args [ 0 ]);\r\n\t\t\t\tsetY ( action.args [ 1 ]);\r\n\t\t\t\tsetW ( action.args [ 2 ]);\r\n\t\t\t\tsetH ( action.args [ 3 ]);\r\n\t\t\t}\r\n\t\t\tbindingMap.imageselection.hide ();\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/bindings/ImageBoxBinding.js",
    "content": "ImageBoxBinding.prototype = new Binding;\r\nImageBoxBinding.prototype.constructor = ImageBoxBinding;\r\nImageBoxBinding.superclass = Binding.prototype;\r\n\r\nImageBoxBinding.ACTION_INITIALIZED = \"imagebox initialized\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ImageBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ImageBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * Flipped once in a while (see method deinitialize).\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isImageBoxBindingInitialized = false;\r\n\t \r\n\t/**\r\n\t * Flipped on startup.\r\n\t */\r\n\tthis._isFirstLoad = true;\r\n\t\r\n\t/**\r\n\t * @type {BindingBoxObject}\r\n\t */\r\n\tthis.boxObject = null;\r\n\t\r\n\t/**\r\n\t * @type {DOMElement}\r\n\t */\r\n\tthis._img = null;\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis.geometry = {\r\n\t\tw : null,\r\n\t\th : null,\r\n\t\tx : null,\r\n\t\ty : null\r\n\t}\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._fixurl = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nImageBoxBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ImageBoxBinding]\";\r\n}\r\n\r\n/**\r\n * \r\n */\r\nImageBoxBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tImageBoxBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis._img = document.getElementById ( \"image\" );\r\n\tvar self = this;\r\n\tthis._img.onload = function () {\r\n\t\tself._initialize ();\r\n\t}\r\n\tthis.refresh ();\r\n}\r\n\r\n/**\r\n * Initialize when image loads.\r\n */\r\nImageBoxBinding.prototype._initialize = function () {\r\n\t\r\n\tif ( this._img.src != this._fixurl ) {\r\n\t\r\n\t\tthis.setW ( this._img.width );\r\n\t\tthis.setH ( this._img.height );\r\n\t\tthis.setX ( 0 );\r\n\t\tthis.setY ( 0 );\r\n\t\t\r\n\t\tif ( !this._isImageBoxBindingInitialized ) {\r\n\t\t\tthis.attachClassName ( \"initialized\" );\r\n\t\t\tthis.dispatchAction ( ImageBoxBinding.ACTION_INITIALIZED );\r\n\t\t\tthis._isImageBoxBindingInitialized = true;\r\n\t\t}\r\n\t\t\r\n\t\tthis._fixurl = this._img.src;\r\n\t}\r\n\t\r\n\t/*\r\n\t * Image was hidden by CSS while initializing. \r\n\t * On first image loaded, a timeout makes \r\n\t * sure that editing stage is fully rendered.\r\n\t */\r\n\tvar img = this._img;\r\n\tif ( this._isFirstLoad ) {\r\n\t\tthis._isFirstLoad = false;\r\n\t\tsetTimeout ( function () {\t\r\n\t\t\timg.style.visibility = \"visible\";\r\n\t\t}, 500 );\r\n\t} else {\r\n\t\timg.style.visibility = \"visible\";\r\n\t}\r\n}\r\n\r\nImageBoxBinding.prototype.getImageSource = function () {\r\n\t\r\n\treturn this._img.src;\r\n}\r\n\r\n/**\r\n * Setup re-initialization after image scaling.\r\n */\r\nImageBoxBinding.prototype.deInitialize = function () {\r\n\r\n\tthis._isImageBoxBindingInitialized = false;\r\n\tthis.detachClassName ( \"initialized\" );\r\n}\r\n\r\n/**\r\n * Refresh image.\r\n */\r\nImageBoxBinding.prototype.refresh = function () {\r\n\t\r\n\tthis._img.style.visibility = \"hidden\"; // flipped by method _initialize\r\n\tthis._img.src = ImageEditorActions.getURL ();\r\n}\r\n\r\n/**\r\n * Repaint.\r\n */\r\nImageBoxBinding.prototype.repaint = function () {\r\n\t\r\n\tthis.setW ( this.geometry.w );\r\n\tthis.setH ( this.geometry.h );\r\n\tthis.setX ( this.geometry.x );\r\n\tthis.setY ( this.geometry.y );\r\n}\r\n\r\n/**\r\n * Set width.\r\n * @param {int} w\r\n */\r\nImageBoxBinding.prototype.setW = function ( w ) {\r\n\t\r\n\tthis.bindingElement.style.width = new String ( w * ImageEditor.scale ) + \"px\";\r\n\tthis.geometry.w = w;\r\n}\r\n\r\n/**\r\n * Set height.\r\n * @param {int} h\r\n */\r\nImageBoxBinding.prototype.setH = function ( h ) {\r\n\t\r\n\tthis.bindingElement.style.height = new String ( h * ImageEditor.scale ) + \"px\";\r\n\tthis.geometry.h = h;\r\n}\r\n\r\n/**\r\n * Set x.\r\n * @param {int} x\r\n */\r\nImageBoxBinding.prototype.setX = function ( x ) {\r\n\t\r\n\tx = Math.round ( x );\r\n\tvar def = - 0.5 * this.geometry.w * ImageEditor.scale;\r\n\tthis.bindingElement.style.marginLeft = def + x + \"px\";\r\n\tthis.geometry.x = x;\r\n}\r\n\r\n/**\r\n * Set y.\r\n * @param {int} y\r\n */\r\nImageBoxBinding.prototype.setY = function ( y ) {\r\n\t\r\n\ty = Math.round ( y );\r\n\tvar def = - 0.5 * this.geometry.h * ImageEditor.scale;\r\n\tthis.bindingElement.style.marginTop = def + y + \"px\";\r\n\tthis.geometry.y = y;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/bindings/ImageCursorBinding.js",
    "content": "ImageCursorBinding.prototype = new CursorBinding;\r\nImageCursorBinding.prototype.constructor = ImageCursorBinding;\r\nImageCursorBinding.superclass = CursorBinding.prototype;\r\n\r\nImageCursorBinding.CURSOR_SELECT = \"${icon:selection}\";;\r\nImageCursorBinding.CURSOR_ZOOMIN = \"${icon:zoomin}\";\r\nImageCursorBinding.CURSOR_ZOOMOUT = \"${icon:zoomout}\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ImageCursorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ImageCursorBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nImageCursorBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ImageCursorBinding]\";\r\n}\r\n\r\n/** \r\n * Set mode.\r\n * @param {string} mode \n */\r\nImageCursorBinding.prototype.setMode = function ( mode ) {\r\n\t\r\n\tvar img = null;\r\n\t\r\n\tswitch ( mode ) {\r\n\t\tcase ImageEditor.MODE_SELECT :\r\n\t\t\timg = ImageCursorBinding.CURSOR_SELECT;\r\n\t\t\tbreak;\r\n\t\tcase ImageEditor.MODE_ZOOMIN :\r\n\t\t\timg = ImageCursorBinding.CURSOR_ZOOMIN;\r\n\t\t\tbreak;\r\n\t\tcase ImageEditor.MODE_ZOOMOUT :\r\n\t\t\timg = ImageCursorBinding.CURSOR_ZOOMOUT;\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tthis.setImage ( img );\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/bindings/ImageEditorPageBinding.js",
    "content": "ImageEditorPageBinding.prototype = new EditorPageBinding;\r\nImageEditorPageBinding.prototype.constructor = ImageEditorPageBinding;\r\nImageEditorPageBinding.superclass = EditorPageBinding.prototype;\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ImageEditorPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ImageEditorPageBinding\" );\r\n\t\r\n\t/**\r\n\t * Handle of the view that contains us.\r\n\t * @type {string}\r\n\t */\r\n\tthis.viewhandle = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nImageEditorPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ImageEditorPageBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads.\r\n */\r\nImageEditorPageBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tImageEditorPageBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.addActionListener ( ImageBoxBinding.ACTION_INITIALIZED, this );\r\n}\r\n\r\n/**\r\n * Overloads.\r\n */\r\nImageEditorPageBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tImageEditorPageBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\t/*\r\n\t * Extract the view handle. Backend needs to know.\r\n\t */\r\n\tvar view = this.getAncestorBindingByLocalName ( \"view\", true );\r\n\tvar def = view.getDefinition ();\r\n\tthis.viewhandle = def.handle;\r\n\t\r\n\t/*\r\n\t * Connect zoom selector.\r\n\t */\r\n\tvar selector = bindingMap.zoomselector;\r\n\tselector.onValueChange = function () {\r\n\t\tImageEditor.zoomTo ( selector.getValue ());\r\n\t}\r\n\t\r\n\t/**\r\n\t * Setup zoom menu.\r\n\t */\r\n\tbindingMap.zoommenugroup.addActionListener ( \r\n\t\tMenuItemBinding.ACTION_COMMAND, this \r\n\t);\r\n}\r\n\r\n/**\r\n * Pause page initialization.\r\n * @overwrites {PageBinding#onBeforePageInitialize}\r\n */\r\nImageEditorPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\t/*\r\n\t * Do nothing - waiting for the image to load. \r\n\t * @see {ImageEditor#PageBindinghandleAction}\r\n\t */\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {EditorPageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nImageEditorPageBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tImageEditorPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ){\r\n\t\tcase ImageBoxBinding.ACTION_INITIALIZED :\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * This stunt is somewhat hacked...\r\n\t\t\t */\r\n\t\t\tvar src = String ( decodeURIComponent ( action.target.getImageSource ()));\r\n\t\t\tvar temp1 = src.split ( \"MediaArchive:\" )[ 1 ];\r\n\t\t\tvar temp2 = temp1.split ( \"&\" )[ 0 ];\r\n\t\t\tvar temp3 = temp2.split ( \"/\" );\r\n\t\t\tvar temp4 = temp3 [ temp3.length - 1 ]; \r\n\t\t\t\r\n\t\t\tthis.label = temp4;\r\n\t\t\t\r\n\t\t\tif ( !this._isPageBindingInitialized ) {\r\n\t\t\t\tImageEditorPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\t\t\tvar item = action.target;\r\n\t\t\tImageEditor.zoomTo ( \r\n\t\t\t\titem.getProperty ( \"zoom\" )\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overwrites {EditorPageBinding#save}\r\n */\r\nImageEditorPageBinding.prototype._saveEditorPage = function () {\r\n\t\r\n\tImageEditorActions.save ();\r\n\t\r\n\t/*\r\n\t * TODO!\r\n\t */\r\n\tthis.logger.error ( \"TODO: MessageQueue SaveStatus!!!!!!!!!!!!!!!!!!!!!!!!!!\" );\r\n\tsetTimeout ( function () {\r\n\t\tMessageQueue.update ();\r\n\t}, 50 );\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/bindings/ImageScrollBoxBinding.js",
    "content": "ImageScrollBoxBinding.prototype = new ScrollBoxBinding;\r\nImageScrollBoxBinding.prototype.constructor = ImageScrollBoxBinding;\r\nImageScrollBoxBinding.superclass = ScrollBoxBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ImageScrollBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ImageScrollBoxBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nImageScrollBoxBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ImageScrollBoxBinding]\";\r\n}\r\n\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nImageScrollBoxBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tImageScrollBoxBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.buildDOMContent ();\r\n\tthis.attachDOMEvents ();\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nImageScrollBoxBinding.prototype.buildDOMContent = function () {\r\n\r\n\tthis.shadowTree.div = DOMUtil.createElementNS ( \r\n\t\tConstants.NS_XHTML, \"div\", this.bindingDocument \r\n\t);\r\n\tthis.shadowTree.div.id = \"imagescrollbox\";\r\n\tthis.bindingElement.appendChild ( \r\n\t\tthis.shadowTree.div\r\n\t)\r\n}\r\n\r\n/**\r\n * Attach DOM events.\r\n */\r\nImageScrollBoxBinding.prototype.attachDOMEvents = function () {\r\n\t\r\n\tthis.addEventListener ( DOMEvents.SCROLL );\r\n\tthis.addEventListener ( DOMEvents.MOUSEMOVE );\r\n\tthis.addEventListener ( DOMEvents.MOUSEOVER );\r\n\tthis.addEventListener ( DOMEvents.MOUSEOUT );\r\n\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n}\r\n\r\n/**\r\n * @implements {IEventHandler}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nImageScrollBoxBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tImageScrollBoxBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tswitch ( e.type ) {\r\n\t\r\n\t\tcase DOMEvents.SCROLL :\r\n\t\t\tthis._synchronize ();\r\n\t\t\tbreak;\r\n\t\r\n\t\tcase DOMEvents.MOUSEMOVE :\t\r\n\t\t\ttry {\r\n\t\t\t\tthis._onmousemove ( e );\r\n\t\t\t} catch ( exception ) {\r\n\t\t\t\tDOMEvents.removeEventListener ( this.bindingElement, DOMEvents.MOUSEMOVE, this );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\tbindingMap.imagecursor.show ();\r\n\t\t\tbindingMap.coordstext.show ();\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\tbindingMap.imagecursor.hide ();\r\n\t\t\tbindingMap.coordstext.hide ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\tswitch ( ImageEditor.mode ) {\r\n\t\t\t\tcase ImageEditor.MODE_ZOOMIN :\r\n\t\t\t\t\tImageEditor.zoomIn ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ImageEditor.MODE_ZOOMOUT :\r\n\t\t\t\t\tImageEditor.zoomOut ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {MouseEvent} e\r\n */\r\nImageScrollBoxBinding.prototype._onmousemove = function ( e ) {\r\n\t\r\n\tvar span \t\t= Constants.SCROLLBAR_DIMENSION_HARDCODED_VALUE;\r\n\tvar scale \t\t= ImageEditor.scale;\r\n\tvar dim \t\t= this.boxObject.getDimension ();\r\n\tvar pos\t\t\t= this.boxObject.getGlobalPosition ();\r\n\tvar point \t\t= DOMUtil.getGlobalMousePosition ( e );\r\n\t\r\n\tvar hitScrollX \t= point.x > dim.w - span;\r\n\tvar hitScrollY \t= point.y > dim.h + pos.y + this.bindingElement.scrollTop - span;\r\n\t\r\n\t/*\r\n\t * Set cursor position\r\n\t */\r\n\tbindingMap.imagecursor.setPosition ( new Point (\r\n\t\tpoint.x,\r\n\t\tpoint.y - pos.y - this.bindingElement.scrollTop // TODO: should scroll compute here?\r\n\t));\r\n\t\r\n\t/*\r\n\t * Update coordinates label\r\n\t */\r\n\tif ( !hitScrollX && !hitScrollY ) { // TODO: only check if overflow!!!\r\n\t\t\r\n\t\tvar box = bindingMap.imagebox.boxObject.getGlobalPosition ();\r\n\t\t\r\n\t\tvar x = point.x - box.x;\r\n\t\tvar y = point.y - box.y;\r\n\t\t\r\n\t\tx = ImageEditor.grid ( x, scale ) / scale;\r\n\t\ty = ImageEditor.grid ( y, scale ) / scale;\r\n\t\t\r\n\t\tbindingMap.coordstext.setLabel ( new String ( \r\n\t\t\tMath.round ( x ) + \" x \" + Math.round ( y )\r\n\t\t), true );\r\n\t\t\r\n\t\tif ( !bindingMap.coordstext.isVisible ) {\r\n\t\t\tbindingMap.coordstext.show ();\r\n\t\t}\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tbindingMap.coordstext.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Update on flex.\r\n * @overloads {FlexBoxBinding#flex}\r\n */\r\nImageScrollBoxBinding.prototype.flex = function () {\r\n\t\r\n\tImageScrollBoxBinding.superclass.flex.call ( this );\r\n\t\r\n\t/*\r\n\tthis._synchronize ();\r\n\tthis.repaint ();\r\n\t*/\r\n}\r\n\r\n/**\r\n * Repaint.\r\n */\r\nImageScrollBoxBinding.prototype.repaint = function () {\r\n\t\r\n\tvar dim = this.boxObject.getDimension ();\r\n\tvar box = bindingMap.imagebox.boxObject.getDimension ();\r\n\tvar geo = bindingMap.imagebox.geometry;\r\n\t\r\n\tthis.sizeY ( box.h );\r\n\tthis.sizeX ( box.w );\r\n\t\r\n\tif ( dim.h < box.h ) {\r\n\t\tvar dy = dim.h - box.h;\r\n\t\tthis.bindingElement.scrollTop = - geo.y - 0.5 * dy;\r\n\t} else {\r\n\t\tbindingMap.imagebox.setY ( 0 );\r\n\t}\r\n\t\r\n\tif ( dim.w < box.w ) {\r\n\t\tvar dx = dim.w - box.w;\r\n\t\tthis.bindingElement.scrollLeft = - geo.x - 0.5 * dx;\r\n\t} else {\r\n\t\tbindingMap.imagebox.setX ( 0 );\r\n\t}\r\n\t\r\n\tthis._synchronize ();\r\n}\r\n\r\n/**\r\n * Synchronize.\r\n */\r\nImageScrollBoxBinding.prototype._synchronize = function () {\r\n\r\n\tvar dim = this.boxObject.getDimension ();\r\n\tvar box = bindingMap.imagebox.boxObject.getDimension ();\r\n\t\r\n\tif ( dim.h < box.h ) {\r\n\t\tvar dy = dim.h - box.h;\r\n\t\tbindingMap.imagebox.setY ( - this.bindingElement.scrollTop - 0.5 * dy );\r\n\t}\r\n\tif ( dim.w < box.w ) {\r\n\t\tvar dx = dim.w - box.w;\r\n\t\tbindingMap.imagebox.setX ( - this.bindingElement.scrollLeft - 0.5 * dx );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set height.\r\n */\r\nImageScrollBoxBinding.prototype.sizeY = function ( size ) {\r\n\t\r\n\tthis.shadowTree.div.style.height = size + \"px\";\r\n}\r\n\r\n/**\r\n * Set width.\r\n */\r\nImageScrollBoxBinding.prototype.sizeX = function ( size ) {\r\n\t\r\n\tthis.shadowTree.div.style.width = size + \"px\";\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/bindings/ImageSelectionBinding.js",
    "content": "ImageSelectionBinding.prototype = new Binding;\r\nImageSelectionBinding.prototype.constructor = ImageSelectionBinding;\r\nImageSelectionBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * Largely controlled by the {@link ImageStageBinding}.\r\n */\r\nfunction ImageSelectionBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ImageSelectionBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._state = true;\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis.geometry = {\r\n\t\tw : 0,\r\n\t\th : 0,\r\n\t\tx : 0,\r\n\t\ty : 0\r\n\t}\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nImageSelectionBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ImageSelectionBinding]\";\r\n}\r\n\r\n/**\r\n * Hide on startup.\r\n */\r\nImageSelectionBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tImageSelectionBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.hide ();\r\n}\r\n\r\n/**\r\n * Repaint.\r\n */\r\nImageSelectionBinding.prototype.repaint = function () {\r\n\t\r\n\tthis.setW ( this.geometry.w );\r\n\tthis.setH ( this.geometry.h );\r\n\tthis.setX ( this.geometry.x );\r\n\tthis.setY ( this.geometry.y );\r\n\t\r\n\t// TODO: squares!\r\n}\r\n\r\n/**\r\n * Update statustext when hiding.\r\n * TODO: put this elsewhere?\r\n * @overloads {Binding#hide}\r\n */\r\nImageSelectionBinding.prototype.hide = function () {\r\n\t\r\n\tImageSelectionBinding.superclass.hide.call ( this );\r\n\tif ( bindingMap.statustext ) {\r\n\t\tbindingMap.statustext.setLabel ( \"\", true );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set width.\r\n * @param {int} w\r\n */\r\nImageSelectionBinding.prototype.setW = function ( w ) {\r\n\t\r\n\tthis.bindingElement.style.width = new String ( w * ImageEditor.scale ) + \"px\";\r\n\tthis.geometry.w = w;\r\n}\r\n\r\n/**\r\n * Set height.\r\n * @param {int} h\r\n */\r\nImageSelectionBinding.prototype.setH = function ( h ) {\r\n\t\r\n\tthis.bindingElement.style.height = new String ( h * ImageEditor.scale ) + \"px\";\r\n\tthis.geometry.h = h;\r\n}\r\n\r\n/**\r\n * Set x.\r\n * @param {int} x\r\n */\r\nImageSelectionBinding.prototype.setX = function ( x ) {\r\n\t\r\n\tthis.bindingElement.style.left = new String ( x * ImageEditor.scale ) + \"px\";\r\n\tthis.geometry.x = x;\r\n}\r\n\r\n/**\r\n * Set y.\r\n * @param {int} y\r\n */\r\nImageSelectionBinding.prototype.setY = function ( y ) {\r\n\t\r\n\tthis.bindingElement.style.top = new String ( y * ImageEditor.scale ) + \"px\";\r\n\tthis.geometry.y = y;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/bindings/ImageStageBinding.js",
    "content": "ImageStageBinding.prototype = new FlexBoxBinding;\r\nImageStageBinding.prototype.constructor = ImageStageBinding;\r\nImageStageBinding.superclass = FlexBoxBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ImageStageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ImageStageBinding\" );\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isDraggable = true;\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isDragging = false;\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis._snapshot = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nImageStageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ImageStageBinding]\";\r\n}\r\n\r\n/**\r\n *\r\n */\r\nImageStageBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tImageStageBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.addActionListener ( Binding.ACTION_DRAG, this );\r\n}\r\n\r\n/**\r\n * @implements {@link IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nImageStageBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tImageStageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase Binding.ACTION_DRAG :\r\n\t\t\tthis.dragger.registerHandler ( this );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {Point} point\r\n */\r\nImageStageBinding.prototype.onDragStart = function ( point ) {\r\n\t\r\n\tvar scale = ImageEditor.scale;\r\n\t\r\n\tswitch ( ImageEditor.mode ) {\r\n\t\r\n\t\tcase ImageEditor.MODE_SELECT :\r\n\t\t\r\n\t\t\tif ( !this._isHittingScroolBars ( point )) {\r\n\t\t\t\t\r\n\t\t\t\tvar pos = bindingMap.imagebox.boxObject.getUniversalPosition ();\r\n\t\t\t\t\r\n\t\t\t\tthis.startx = point.x - pos.x;\r\n\t\t\t\tthis.starty = point.y - pos.y;\r\n\t\t\t\t\r\n\t\t\t\tbindingMap.imageselection.setX ( ImageEditor.grid ( this.startx, scale ) / scale );\r\n\t\t\t\tbindingMap.imageselection.setY ( ImageEditor.grid ( this.starty, scale ) / scale );\r\n\t\t\t\tbindingMap.imageselection.show ();\r\n\t\t\t\t\r\n\t\t\t\tbindingMap.broadcasterHasSelection.disable ();\r\n\t\t\t\tImageEditor.isSelecting = true;\r\n\t\t\t\t\r\n\t\t\t\tthis._snapshot = {\r\n\t\t\t\t\txmod\t\t\t: 0,\r\n\t\t\t\t\tymod\t\t\t: 0,\r\n\t\t\t\t\tmousePosition \t: point,\r\n\t\t\t\t\tstagePosition \t: bindingMap.imagestage.boxObject.getUniversalPosition (),\r\n\t\t\t\t\tstageDimension \t: bindingMap.imagestage.boxObject.getDimension ()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Implements {@link IDragHandler}\r\n * @param {Point} diff\r\n */\r\nImageStageBinding.prototype.onDrag = function ( diff ) {\r\n\r\n\t\r\n\tif ( ImageEditor.isSelecting ) {\r\n\t\t\r\n\t\tdiff = this._scrollDiff ( diff );\r\n\t\tthis._updateSelection ( diff );\r\n\t\tthis._updateSelectionText ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Implements {@link IDragHandler}\r\n * @param {Point} diff\r\n */\r\nImageStageBinding.prototype.onDragStop = function ( diff ) {\r\n\t\r\n\tif ( ImageEditor.isSelecting ) {\r\n\t\tvar geo = bindingMap.imageselection.geometry;\r\n\t\tif ( geo.w > 1 && geo.h > 1 ) {\r\n\t\t\tbindingMap.broadcasterHasSelection.enable ();\r\n\t\t}\r\n\t\tImageEditorActions.select ();\r\n\t\tImageEditor.isSelecting = false;\r\n\t}\r\n}\r\n\r\n/*\r\n * Update scroling while user drags *outside* screen area. \r\n * This will only have effect if the image is scaled larger \r\n * than the available screen estate (where scrolling occurs).\r\n * @param {Point} diff\r\n * @return {Point}\r\n */\r\nImageStageBinding.prototype._scrollDiff = function ( diff ) {\r\n\t\r\n\tif ( ImageEditor.isSelecting ) {\r\n\t\r\n\t\tvar scrollBinding = bindingMap.imagescrollbox;\r\n\t\tvar scrollElement = scrollBinding.bindingElement;\r\n\t\tvar mod = 3 * ImageEditor.scale;\r\n\t\tvar x = this._snapshot.mousePosition.x + diff.x;\r\n\t\tvar y = this._snapshot.mousePosition.y + diff.y;\r\n\t\t\r\n\t\t/*\r\n\t\t * horizontal action.\r\n\t\t */\t\r\n\t\tif ( x < this._snapshot.stagePosition.x ) {\r\n\t\t\tif ( scrollElement.scrollLeft > 0 ) {\r\n\t\t\t\tscrollElement.scrollLeft -= mod;\r\n\t\t\t\tthis._snapshot.xmod -= mod;\r\n\t\t\t}\r\n\t\t} else if ( x > this._snapshot.stagePosition.x + this._snapshot.stageDimension.w ) {\r\n\t\t\tvar curLeft = scrollElement.scrollLeft;\r\n\t\t\tscrollElement.scrollLeft += mod;\r\n\t\t\tif ( scrollElement.scrollLeft != curLeft ) {\r\n\t\t\t\tthis._snapshot.xmod += mod;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * vertical action.\r\n\t\t */\t\r\n\t\tif ( y < this._snapshot.stagePosition.y ) {\r\n\t\t\tif ( scrollElement.scrollTop > 0 ) {\r\n\t\t\t\tscrollElement.scrollTop -= mod;\r\n\t\t\t\tthis._snapshot.ymod -= mod;\r\n\t\t\t}\r\n\t\t} else if ( y > this._snapshot.stagePosition.y + this._snapshot.stageDimension.h ) {\r\n\t\t\tvar curTop = scrollElement.scrollTop;\r\n\t\t\tscrollElement.scrollTop += mod;\r\n\t\t\tif ( scrollElement.scrollTop != curTop ) {\r\n\t\t\t\tthis._snapshot.ymod += mod;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tdiff.x += this._snapshot.xmod;\r\n\t\tdiff.y += this._snapshot.ymod;\r\n\t}\r\n\t\r\n\treturn diff;\r\n}\r\n\r\n/*\r\n * Update selection.\r\n * TODO: shaky selection when dragging anything but topleft to bottomright!\r\n * @param {Point} diff\r\n */\r\nImageStageBinding.prototype._updateSelection = function ( diff ) {\r\n\t\t\r\n\tvar selector = bindingMap.imageselection;\r\n\tvar scale = ImageEditor.scale;\r\n\t\r\n\tselector.setH ( ImageEditor.grid (  Math.abs ( diff.y ), scale ) / scale );\r\n\tselector.setW ( ImageEditor.grid (  Math.abs ( diff.x ), scale ) / scale );\r\n\t\r\n\tif ( diff.y < 0 ) {\r\n\t\tselector.setY (\r\n\t\t\tImageEditor.grid ( this.starty + diff.y, scale ) / scale\r\n\t\t);\r\n\t}\r\n\tif ( diff.x < 0 ) {\r\n\t\tselector.setX (\r\n\t\t\tImageEditor.grid ( this.startx + diff.x, scale ) / scale\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/*\r\n * Update statustext (displaying selection dimensions).\r\n */\r\nImageStageBinding.prototype._updateSelectionText = function () {\r\n\r\n\tvar geometry = bindingMap.imageselection.geometry;\r\n\tvar statustext = new String ( \"Selection: \" + geometry.w + \" x \" + geometry.h );\r\n\tbindingMap.statustext.setLabel ( statustext, true );\r\n}\r\n\r\n\r\n/**\r\n * Detect whether or not a point intersects with the scrollbars.\r\n * Implements {@link IDragHandler}\r\n * @param {Point} point\r\n */\r\nImageStageBinding.prototype._isHittingScroolBars = function ( point ) {\r\n\t\r\n\tvar span = Constants.SCROLLBAR_DIMENSION_HARDCODED_VALUE;\r\n\t\r\n\tvar pos = this.boxObject.getUniversalPosition ();\r\n\tvar dim = this.boxObject.getDimension ();\r\n\tvar hitScroolBarX = point.x > pos.x + dim.w - span;\r\n\tvar hitScroolBarY = point.y > pos.y + dim.h - span;\r\n\t\r\n\treturn hitScroolBarX || hitScroolBarY;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/bindings/ImageToolBoxBinding.js",
    "content": "ImageToolBoxBinding.prototype = new Binding;\r\nImageToolBoxBinding.prototype.constructor = ImageToolBoxBinding;\r\nImageToolBoxBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ImageToolBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ImageToolBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {Point}\r\n\t */\r\n\tthis._startPosition = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nImageToolBoxBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ImageToolBoxBinding]\";\r\n}\r\n\r\nImageToolBoxBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tImageToolBoxBinding.superclass.onBindingAttach.call ( this );\r\n\tEventBroadcaster.subscribe ( this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST, this );\r\n}\r\n\r\n/**\r\n * Implements {@link IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nImageToolBoxBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tImageToolBoxBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST :\r\n\t\t\tthis._startPosition = this.getPosition ();\r\n\t\t\tthis._setComputedPosition ( \r\n\t\t\t\tnew Point ( 0, 0 )\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Implements {@link IDragHandler}\r\n * @param {Point} point\r\n */\r\nImageToolBoxBinding.prototype.onDragStart = function ( point ) {\r\n\t\r\n\tthis._startPosition = this.getPosition ();\r\n}\r\n\r\n/**\r\n * Implements {@link IDragHandler}\r\n * @param {Point} diff\r\n */\r\nImageToolBoxBinding.prototype.onDrag = function ( diff ) {\r\n\r\n\tthis._setComputedPosition ( diff );\r\n}\r\n\r\n/**\r\n * Implements {@link IDragHandler}\r\n * @param {Point} diff\r\n */\r\nImageToolBoxBinding.prototype.onDragStop = function ( diff ) {\r\n\t\r\n\tthis.onDrag ( diff );\r\n\tthis._startPosition = null;\r\n}\r\n\r\n/**\r\n * Keep toolbox on stage.\r\n * @param {Point} diff\r\n */\r\nImageToolBoxBinding.prototype._setComputedPosition = function ( diff ) {\r\n\r\n\tvar dim1 = this.boxObject.getDimension ();\r\n\tvar dim2 = bindingMap.imagestage.boxObject.getDimension ();\r\n\r\n\tvar x = this._startPosition.x + diff.x;\r\n\tvar y = this._startPosition.y + diff.y;\r\n\t\r\n\tx = x < 0 ? 0 : x + dim1.w > dim2.w ? dim2.w - dim1.w : x;\r\n\ty = y < 0 ? 0 : y + dim1.h > dim2.h ? dim2.h - dim1.h : y;\r\n\t\r\n\tthis.setPosition ( \r\n\t\tnew Point ( x, y )\r\n\t)\r\n}\r\n\r\n/**\r\n * Set position.\r\n * @param {Point} point\r\n */\r\nImageToolBoxBinding.prototype.setPosition = function ( point ) {\r\n\t\r\n\tthis.bindingElement.style.left = point.x + \"px\";\r\n\tthis.bindingElement.style.top = point.y + \"px\";\r\n}\r\n\r\n/**\r\n * Get position.\r\n * @return {Point}\r\n */\r\nImageToolBoxBinding.prototype.getPosition = function () {\r\n\t\r\n\treturn new Point ( \r\n\t\tthis.bindingElement.offsetLeft,\r\n\t\tthis.bindingElement.offsetTop\r\n\t);\r\n}\r\n\r\n/**\r\n * Get position.\r\n * @return {Point}\r\n */\r\nImageToolBoxBinding.prototype.getDimension = function () {\r\n\t\r\n\treturn this.boxObject.getDimension ();\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/bindings/ImageToolBoxDraggerBinding.js",
    "content": "ImageToolBoxDraggerBinding.prototype = new Binding;\r\nImageToolBoxDraggerBinding.prototype.constructor = ImageToolBoxDraggerBinding;\r\nImageToolBoxDraggerBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ImageToolBoxDraggerBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ImageToolBoxDraggerBinding\" );\r\n\t\r\n\t/**\r\n\t * @overwrites {Binding#isDraggable}\r\n\t */\r\n\tthis.isDraggable = true;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nImageToolBoxDraggerBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ImageToolBoxDraggerBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nImageToolBoxDraggerBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tImageToolBoxDraggerBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.dragger.registerHandler ( \r\n\t\tthis.getAncestorBindingByLocalName ( \"imagetoolbox\" )\r\n\t);\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/imageeditor.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n    <title>Composite.Management.ImageEditor</title>\r\n    <control:styleloader runat=\"server\" />\r\n    <control:scriptloader type=\"sub\" runat=\"server\" />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"imageeditor.css.aspx\" />\r\n\r\n    <script type=\"text/javascript\" src=\"ImageEditor.js\"></script>\r\n    <script type=\"text/javascript\" src=\"ImageEditorAction.js\"></script>\r\n    <script type=\"text/javascript\" src=\"ImageEditorActions.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/ImageEditorPageBinding.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/ImageBoxBinding.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/ImageSelectionBinding.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/ImageStageBinding.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/ImageScrollBoxBinding.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/ImageCursorBinding.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/ImageToolBoxBinding.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/ImageToolBoxDraggerBinding.js\"></script>\r\n\r\n    <ui:bindingmappingset>\r\n        <ui:bindingmapping element=\"ui:imagebox\" binding=\"ImageBoxBinding\" />\r\n        <ui:bindingmapping element=\"ui:imageselection\" binding=\"ImageSelectionBinding\" />\r\n        <ui:bindingmapping element=\"ui:imagetoolbox\" binding=\"ImageToolBoxBinding\" />\r\n        <ui:bindingmapping element=\"ui:imagetoolboxdragger\" binding=\"ImageToolBoxDraggerBinding\" />\r\n    </ui:bindingmappingset>\r\n\r\n    <ui:keyset>\r\n        <ui:key key=\"VK_NUMPLUS\" oncommand=\"ImageEditor.zoomIn ()\" />\r\n        <ui:key key=\"VK_NUMMINUS\" oncommand=\"ImageEditor.zoomOut ()\" />\r\n    </ui:keyset>\r\n\r\n</head>\r\n<body id=\"root\">\r\n\r\n    <ui:broadcasterset>\r\n        <ui:broadcaster id=\"broadcasterHasSelection\" isdisabled=\"true\" />\r\n        <ui:broadcaster id=\"broadcasterCanUndo\" isdisabled=\"true\" />\r\n        <ui:broadcaster id=\"broadcasterCanRedo\" isdisabled=\"true\" />\r\n        <ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n        <!-- not used?!?! -->\r\n        <ui:broadcaster id=\"broadcasterCanZoomIn\" />\r\n        <ui:broadcaster id=\"broadcasterCanZoomOut\" />\r\n    </ui:broadcasterset>\r\n\r\n    <ui:editorpage id=\"editorpage\"\r\n        binding=\"ImageEditorPageBinding\"\r\n        label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelTitle}\"\r\n        image=\"${icon:media-edit-image-file}\">\r\n\r\n        <ui:menubar>\r\n            <ui:menu label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelImage}\" class=\"last\">\r\n                <ui:menupopup>\r\n                    <ui:menubody>\r\n                        <ui:menugroup>\r\n                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelTransform}\">\r\n                                <ui:menupopup>\r\n                                    <ui:menubody>\r\n                                        <ui:menugroup>\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFlipHorizontal}\" oncommand=\"ImageEditorActions.flip(true)\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFlipVertical}\" oncommand=\"ImageEditorActions.flip(false)\" />\r\n                                        </ui:menugroup>\r\n                                        <ui:menugroup>\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate90CW}\" oncommand=\"ImageEditorActions.rotate(90)\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate90CCW}\" oncommand=\"ImageEditorActions.rotate(270)\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate180}\" oncommand=\"ImageEditorActions.rotate(180)\" />\r\n                                        </ui:menugroup>\r\n                                    </ui:menubody>\r\n                                </ui:menupopup>\r\n                            </ui:menuitem>\r\n                        </ui:menugroup>\r\n                        <ui:menugroup>\r\n                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelScale}\"\r\n                                oncommand=\"ImageEditorActions.scale ()\"\r\n                                image=\"${icon:scale}\" />\r\n                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelCrop}\"\r\n                                oncommand=\"ImageEditorActions.crop ()\"\r\n                                image=\"${icon:crop}\"\r\n                                image-disabled=\"${icon:crop-disabled}\"\r\n                                observes=\"broadcasterHasSelection\" />\r\n                        </ui:menugroup>\r\n                    </ui:menubody>\r\n                </ui:menupopup>\r\n            </ui:menu>\r\n            <ui:menu label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelView}\">\r\n                <ui:menupopup>\r\n                    <ui:menubody>\r\n                        <ui:menugroup>\r\n                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoom}\" image=\"${icon:zoom}\">\r\n                                <ui:menupopup>\r\n                                    <ui:menubody>\r\n                                        <ui:menugroup>\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoomIn}\"\r\n                                                oncommand=\"ImageEditor.zoomIn ();\"\r\n                                                observes=\"broadcasterCanZoomIn\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoomOut}\"\r\n                                                oncommand=\"ImageEditor.zoomOut ();\"\r\n                                                observes=\"broadcasterCanZoomOut\" />\r\n                                        </ui:menugroup>\r\n                                        <ui:menugroup id=\"zoommenugroup\">\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label800}\" zoom=\"6\" type=\"checkbox\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label400}\" zoom=\"5\" type=\"checkbox\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label200}\" zoom=\"4\" type=\"checkbox\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label100}\" zoom=\"3\" type=\"checkbox\" ischecked=\"true\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label50}\" zoom=\"2\" type=\"checkbox\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label25}\" zoom=\"1\" type=\"checkbox\" />\r\n                                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label12}\" zoom=\"0\" type=\"checkbox\" />\r\n                                        </ui:menugroup>\r\n                                    </ui:menubody>\r\n                                </ui:menupopup>\r\n                            </ui:menuitem>\r\n                        </ui:menugroup>\r\n                    </ui:menubody>\r\n                </ui:menupopup>\r\n            </ui:menu>\r\n            <ui:menu label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFile}\">\r\n                <ui:menupopup>\r\n                    <ui:menubody>\r\n                        <ui:menugroup>\r\n                            <ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelSave}\"\r\n                                image=\"${icon:save}\"\r\n                                image-disabled=\"${icon:save-disabled}\"\r\n                                observes=\"broadcasterCanUndo\"\r\n                                id=\"savemenuitem\"\r\n                                oncommand=\"bindingMap.savemenuitem.dispatchAction(EditorPageBinding.ACTION_SAVE);\" />\r\n                            <!-- \r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelSaveAs}\"/>\r\n\t\t\t\t\t\t\t\t<ui:menuitem label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRevert}\" observes=\"broadcasterCanUndo\"/>\r\n\t\t\t\t\t\t\t\t-->\r\n                        </ui:menugroup>\r\n                    </ui:menubody>\r\n                </ui:menupopup>\r\n            </ui:menu>\r\n        </ui:menubar>\r\n\r\n        <ui:toolbar id=\"toolbar\" class=\"btns-group\">\r\n            <ui:toolbarbody>\r\n                <ui:toolbargroup>\r\n                    <ui:toolbarbutton\r\n                        id=\"savebutton\"\r\n                        image=\"${icon:save}\"\r\n                        tooltip=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelSave}\"\r\n                        image-disabled=\"${icon:save-disabled}\"\r\n                        oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE);\"\r\n                        observes=\"broadcasterCanUndo\" />\r\n                </ui:toolbargroup>\r\n                <ui:toolbargroup>\r\n                    <ui:toolbarbutton\r\n                        id=\"scalebutton\"\r\n                        tooltip=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelScale}\"\r\n                        oncommand=\"ImageEditorActions.scale ()\"\r\n                        image=\"${icon:scale}\" />\r\n                    <ui:toolbarbutton\r\n                        id=\"cropbutton\"\r\n                        tooltip=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelCrop}\"\r\n                        oncommand=\"ImageEditorActions.crop ()\"\r\n                        image=\"${icon:crop}\"\r\n                        image-disabled=\"${icon:crop-disabled}\"\r\n                        observes=\"broadcasterHasSelection\" />\r\n                </ui:toolbargroup>\r\n                <ui:toolbargroup>\r\n                    <ui:toolbarbutton\r\n                        image=\"${icon:undo}\"\r\n                        tooltip=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelUndo}\"\r\n                        image-disabled=\"${icon:undo-disabled}\"\r\n                        observes=\"broadcasterCanUndo\"\r\n                        oncommand=\"ImageEditorActions.undo()\" />\r\n                    <ui:toolbarbutton\r\n                        image=\"${icon:redo}\"\r\n                        tooltip=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelRedo}\"\r\n                        image-disabled=\"${icon:redo-disabled}\"\r\n                        observes=\"broadcasterCanRedo\"\r\n                        oncommand=\"ImageEditorActions.redo()\" />\r\n                </ui:toolbargroup>\r\n            </ui:toolbarbody>\r\n        </ui:toolbar>\r\n\r\n        <ui:flexbox id=\"imagestagecontainer\">\r\n\r\n            <ui:flexbox id=\"imagestage\" binding=\"ImageStageBinding\">\r\n                <ui:imageboxsystem id=\"imagecontainer\">\r\n                    <ui:imagebox id=\"imagebox\">\r\n                        <img id=\"image\" src=\"blank.png\" />\r\n                        <ui:imagecover />\r\n                        <ui:imageselection id=\"imageselection\" />\r\n                    </ui:imagebox>\r\n                </ui:imageboxsystem>\r\n                <ui:cursor id=\"imagecursor\" binding=\"ImageCursorBinding\" />\r\n                <ui:scrollbox id=\"imagescrollbox\" binding=\"ImageScrollBoxBinding\" />\r\n            </ui:flexbox>\r\n\r\n            <ui:imagetoolbox>\r\n                <ui:imagetoolboxdragger />\r\n                <ui:toolbar imagesize=\"large\">\r\n                    <ui:toolbarbody>\r\n                        <ui:toolbargroup>\r\n                            <!-- <ui:toolbarbutton type=\"radio\" image=\"${skin}/imageeditor/move24.png\" oncommand=\"ImageEditor.setMode ( ImageEditor.MODE_MOVE )\"/>-->\r\n                            <ui:toolbarbutton type=\"radio\" image=\"${icon:selection(24)}\" oncommand=\"ImageEditor.setMode ( ImageEditor.MODE_SELECT )\" tooltip=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBox.ToolTipSelect}\" />\r\n                            <ui:toolbarbutton type=\"radio\" image=\"${icon:zoom(24)}\" oncommand=\"ImageEditor.setMode ( ImageEditor.MODE_ZOOMIN )\" tooltip=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBox.ToolTipZoom}\" />\r\n                        </ui:toolbargroup>\r\n                    </ui:toolbarbody>\r\n                </ui:toolbar>\r\n            </ui:imagetoolbox>\r\n\r\n        </ui:flexbox>\r\n\r\n        <ui:toolbar class=\"statusbar\" blockactionevents=\"true\">\r\n            <ui:toolbarbody>\r\n                <ui:toolbargroup>\r\n                    <ui:selector id=\"zoomselector\" image=\"${icon:zoom}\">\r\n                        <ui:selection label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label800}\" value=\"6\" />\r\n                        <ui:selection label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label400}\" value=\"5\" />\r\n                        <ui:selection label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label200}\" value=\"4\" />\r\n                        <ui:selection label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label100}\" value=\"3\" selected=\"true\" />\r\n                        <ui:selection label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label50}\" value=\"2\" />\r\n                        <ui:selection label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label25}\" value=\"1\" />\r\n                        <ui:selection label=\"${string:Website.Content.Views.Editors.ImageEditor.ImageEditor.Label12}\" value=\"0\" />\r\n                    </ui:selector>\r\n                    <ui:labelbox id=\"statustext\" class=\"toolbartext\" />\r\n                </ui:toolbargroup>\r\n            </ui:toolbarbody>\r\n            <ui:toolbarbody class=\"pull-right\">\r\n                <ui:labelbox id=\"coordstext\" class=\"toolbartext\" />\r\n            </ui:toolbarbody>\r\n        </ui:toolbar>\r\n\r\n    </ui:editorpage>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/editors/imageeditor/imageeditor.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n \r\nui|flexbox#imagestagecontainer {\r\n \tbackground-color: $(color:appworkspace);\r\n \tposition: relative;\r\n}\r\nui|flexbox#imagestage {\r\n \tposition: relative;\r\n}\r\n\r\nui|menubar {\r\n    position: absolute;\r\n    top: 15px;\r\n    right: 0;\r\n}\r\n\r\nui|imageboxsystem {\r\n\tdisplay: block;\r\n \twidth: 0;\r\n \theight: 0;\r\n \ttop: 50%;\r\n \tleft: 50%;\r\n \tposition: absolute;\r\n}\r\n\r\nui|imagebox {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\toverflow: visible;\r\n}\r\n\r\nui|imagebox img {\r\n \tdisplay: block;\r\n \tposition: absolute;\r\n \ttop: 0;\r\n \tleft: 0;\r\n \twidth: auto;\r\n \theight: auto;\r\n \tvisibility: hidden; /* flipped by script, see ImageBoxBinding */\r\n}\r\n\r\nui|imagebox.initialized img {\r\n \twidth: 100%;\r\n \theight: 100%;\r\n \tvisibility: visible;\r\n}\r\n\r\nui|imagecover {\r\n\tposition: absolute;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\tbackground-color: red;\r\n\topacity: 0;\r\n}\r\n\r\nui|flexbox#imagestage.move {\r\n\tcursor: move;\t\r\n}\r\n\r\nui|flexbox#imagestage.select  {\r\n\tcursor: crosshair;\t\r\n}\r\nui|flexbox#imagestage.zoomin,\r\nui|flexbox#imagestage.zoomout {\r\n\tcursor: default;\r\n}\r\nui|imageselection {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\toverflow: hidden;\r\n\tborder: 1px dashed blue;\r\n\twidth: 0;\r\n\theight: 0;\r\n}\r\nui|imagetoolbox {\r\n\tposition: absolute;\r\n\tz-index: 6; /* above shadow (huh - 3 should be enough!) */\r\n\toverflow: hidden;\r\n\ttop: 20px;\r\n\tleft: 20px;\r\n\twidth: 50px;\r\n\tbackground-color: #fff;\r\n\tborder: 1px solid #ccc;\r\n    padding: 2px;\r\n}\r\nui|imagetoolbox ui|toolbar {\r\n\tpadding: 0;\r\n    box-shadow: none;\r\n}\r\n\r\nui|imagetoolbox ui|toolbarbutton {\r\n    height: 32px;\r\n}\r\n\r\nui|imagetoolboxdragger {\r\n    display: block;\r\n\theight: 20px;\r\n    margin-bottom: 3px;\r\n\tbackground-color: ActiveCaption;\r\n\r\n}\r\n\r\nui|imagetoolbox ui|toolbarbutton {\r\n\tmargin: 0 0 3px 0;\r\n\tfloat: none !important;\r\n}\r\n\r\nui|labelbox#coordstext {\r\n\tpadding-top: 3px;\r\n\tpadding-right: 8px;\t\r\n}\r\n\r\nui|labelbox#statustext {\r\n    padding: 3px 0 0 8px;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/permissioneditor/PermissionEditorGridBinding.js",
    "content": "PermissionEditorGridBinding.prototype = new Binding;\r\nPermissionEditorGridBinding.prototype.constructor = PermissionEditorGridBinding;\r\nPermissionEditorGridBinding.superclass = Binding.prototype;\r\n\r\nPermissionEditorGridBinding.CLASSNAME_DEFINED = \"primary\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction PermissionEditorGridBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PermissionEditorGridBinding\" );\r\n\t\r\n\t/**\r\n\t * Tracking defined permissions.\r\n\t * @type {HashMap<string><array>}\r\n\t */\r\n\tthis._defined = {};\r\n\t\r\n\t/**\r\n\t * Tracking inherited permissions.\r\n\t * @type {HashMap<string><array>}\r\n\t */\r\n\tthis._inherited = {};\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._index = 0;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPermissionEditorGridBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[PermissionEditorGridBinding]\";\r\n}\r\n\r\n/**\r\n * Added when editor was modified to handle two distinct editor grids.\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nPermissionEditorGridBinding.prototype.onBindingRegister = function () {\r\n\r\n\tPermissionEditorGridBinding.superclass.onBindingRegister.call ( this );\r\n \tthis._index = this.getID ().split ( \"grid\" )[ 1 ];\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nPermissionEditorGridBinding.prototype.onBindingAttach = function () {\r\n\r\n\tPermissionEditorGridBinding.superclass.onBindingAttach.call ( this );\r\n \tthis.addActionListener ( CheckBoxBinding.ACTION_COMMAND );\r\n}\r\n\r\n/**\r\n * Populate grid.\r\n * @param {List<object>} inheritedList\r\n * @param {List<object>} definedList\r\n */\r\nPermissionEditorGridBinding.prototype.populate = function ( inheritedList, definedList ) {\r\n\t\r\n\tvar isFirst\t= true;\r\n\tvar tbody = this.getChildElementByLocalName ( \"tbody\" );\r\n\tvar self = this;\r\n\t\r\n\t/*\r\n\t * Terminate existing population.\r\n\t */\r\n\twhile ( tbody.hasChildNodes ()) {\r\n\t\ttbody.removeChild ( tbody.lastChild );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Scanning defined permissions. \r\n\t */\r\n\tdefinedList.each ( function ( object ) {\r\n\t\tself._defined [ object.UserName ] = object.PermissionTypes;\r\n\t});\r\n\t\r\n\t/*\r\n\t * Scanning inherited permissions.\r\n\t */\r\n\tinheritedList.each ( function ( object ) {\r\n\t\tself._inherited [ object.UserName ] = object.PermissionTypes;\r\n\t});\r\n\t\r\n\t/*\r\n\t * Build main table.\r\n\t */\r\n\tinheritedList.each ( function ( object ) {\r\n\t\tvar row = self._getRow ( object.UserName, object.PermissionTypes );\r\n\t\tif ( isFirst ) {\r\n\t\t\tCSSUtil.attachClassName ( row, \"first\" );\r\n\t\t\tisFirst = false;\r\n\t\t}\r\n\t\ttbody.appendChild ( row );\r\n\t});\r\n\t\r\n}\r\n\r\n/**\r\n * Get row, freshly populated by name and permissions.\r\n * @param {string} name\r\n * @param {array} perms\r\n */\r\nPermissionEditorGridBinding.prototype._getRow = function ( name, perms ) {\r\n\r\n\tvar self = this;\r\n\t\r\n\tif ( !this._row ) {\r\n\t\tthis._row = this._getBaseRow ();\r\n\t}\r\n\tvar row = this._row.cloneNode ( true );\r\n\tvar cells = new List ( DOMUtil.getElementsByTagName ( row, \"td\" ));\r\n\t\r\n\tif ( name ) {\r\n\t\t\r\n\t\t// checkbox\r\n\t\tvar checkbox = CheckBoxBinding.newInstance ( document );\r\n\t\tcells.get ( 0 ).appendChild ( checkbox.bindingElement );\r\n\t\tcheckbox.associatedRow = row;\r\n\t\tcheckbox.associatedName = name;\r\n\t\tcheckbox.associatedCells = new List ();\r\n\t\tcheckbox.attach ();\r\n\t\t\r\n\t\t// name\r\n\t\tcells.get ( 1 ).appendChild ( this._getElement ( \"span\", \"name\", name ));\r\n\t\t\r\n\t\t// defined permissions\r\n\t\tvar definedPerms = this._defined [ name ];\r\n\t\tif ( definedPerms ) {\r\n\t\t\tnew List ( definedPerms ).each ( function ( perm ) {\r\n\t\t\t\tvar index = self.getHeadBinding ().getIndexForPermission ( perm );\r\n\t\t\t\tself._check ( cells.get ( index ));\r\n\t\t\t});\r\n\t\t\tCSSUtil.attachClassName ( row, PermissionEditorGridBinding.CLASSNAME_DEFINED );\r\n\t\t\tcheckbox.check ( true );\r\n\t\t}\r\n\t\t\r\n\t\t// inherited permissions\r\n\t\telse {\r\n\t\t\tvar inheritedPerms = this._inherited [ name ];\r\n\t\t\tif ( inheritedPerms ) {\r\n\t\t\t\tthis._setInheritedPermissions ( row );\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// activate permission cells\r\n\t\tvar i = 1;\r\n\t\twhile ( i++ <= this.getHeadBinding ().getPermissionTypeCount ()) {\r\n\t\t\tvar cell = cells.get ( i );\r\n\t\t\tDOMEvents.addEventListener ( cell, DOMEvents.MOUSEDOWN, this );\r\n\t\t\tcheckbox.associatedCells.add ( cell );\r\n\t\t}\r\n\t}\r\n\treturn row;\r\n}\r\n\r\n/**\r\n * Set inherited permissions for a row.\r\n * @param {HTMLTableRowElement} row\r\n */\r\nPermissionEditorGridBinding.prototype._setInheritedPermissions = function ( row ) {\r\n\r\n\tvar cells = new List ( DOMUtil.getElementsByTagName ( row, \"td\" ));\r\n\tvar inheritedPerms = this._inherited [ this._getNameForRow ( row )];\r\n\tvar self = this;\r\n\t\r\n\tCSSUtil.detachClassName ( row, PermissionEditorGridBinding.CLASSNAME_DEFINED );\r\n\t\r\n\tvar i = 0;\r\n\tcells.each ( function ( cell ) {\r\n\t\tif ( i++ > 1 ) {\r\n\t\t\tself._uncheck ( cell );\r\n\t\t}\r\n\t});\r\n\t\r\n\tnew List ( inheritedPerms ).each ( function ( perm ) {\r\n\t\tvar index = self.getHeadBinding ().getIndexForPermission ( perm );\r\n\t\tcells.get ( index ).appendChild ( self._getElement ( \"span\", \"x\" ));\r\n\t});\r\n}\r\n\r\n/**\r\n * Get name for row.\r\n * @param {HTMLTableRowElement} row\r\n * @return {string}\r\n */\r\nPermissionEditorGridBinding.prototype._getNameForRow = function ( row ) {\r\n\t\r\n\tvar result = null;\r\n\tvar span = DOMUtil.getElementsByTagName ( row, \"span\" ).item ( 0 );\r\n\tif ( span ) {\r\n\t \tresult = DOMUtil.getTextContent ( span );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Check permission.\r\n * @param {HTMLTableCellElement} cell\r\n * @param {boolean} isUpdate This switch is not needed during startup\r\n */\r\nPermissionEditorGridBinding.prototype._check = function ( cell, isUpdate ) {\r\n\t\r\n\tcell.appendChild ( this._getElement ( \"span\", \"x\" ));\r\n\tif ( isUpdate ) {\r\n\t\tthis._define ( cell );\r\n\t}\r\n}\r\n\r\n/**\r\n * Uncheck permission.\r\n * @param {HTMLTableCellElement} cell\r\n */\r\nPermissionEditorGridBinding.prototype._uncheck = function ( cell, isUpdate ) {\r\n\r\n\tcell.innerHTML = \"\"; // removeChild causes a spastic loop in Explorer...\r\n\tif ( isUpdate ) {\r\n\t\tthis._define ( cell );\r\n\t}\r\n}\r\n\r\n/**\r\n * Permission checked?\r\n * @param {HTMLTableCellElement} cell\r\n */\r\nPermissionEditorGridBinding.prototype._isChecked = function ( cell ) {\r\n\t\r\n\treturn DOMUtil.getElementsByTagName ( cell, \"span\" ).item ( 0 ) != null;\r\n}\r\n\r\n/**\r\n * Checking the checkbox assocaiated to a given cell (row).\r\n * @param {HTMLTableCellElement} cell\r\n */\r\nPermissionEditorGridBinding.prototype._define = function ( cell ) {\r\n\t\r\n\t/*\r\n\t * Oldshcool.\r\n\t */\r\n\tvar row = cell.parentNode;\r\n\tvar first = row.cells [ 0 ];\r\n\tvar element = DOMUtil.getElementsByTagName ( first, \"checkbox\" ).item ( 0 );\r\n\tvar binding = UserInterface.getBinding ( element );\r\n\tbinding.check ();\r\n}\r\n\r\n\r\n/**\r\n * Create an clonable default row.\r\n * @param {boolean} isDecorational\r\n * @return {HTMLTableRowElement}\r\n */\r\nPermissionEditorGridBinding.prototype._getBaseRow = function () {\r\n\t\r\n\tvar cell, row = this._getElement ( \"tr\" );\r\n\tcell = row.appendChild ( this._getElement ( \"td\", \"edit\" ));\r\n\tcell = row.appendChild ( this._getElement ( \"td\", \"index\" ));\r\n\t\r\n\tvar i = 0, max = this.getHeadBinding ().getPermissionTypeCount ();\r\n\twhile ( i < max ) {\r\n\t\tcell = row.appendChild ( this._getElement ( \"td\" ));\r\n\t\tif ( ++i == max ) {\r\n\t\t\tcell.className = \"last\";\r\n\t\t}\r\n\t}\r\n\treturn row;\r\n}\r\n\r\n/**\r\n * Simple element builder.\r\n * @param {string} name\r\n * @param {string} className\r\n * @return {HTMLElement}\r\n */\r\nPermissionEditorGridBinding.prototype._getElement = function ( name, className, text ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_XHTML, name, document );\r\n\tif ( className ) {\r\n\t\tCSSUtil.attachClassName ( element, className );\r\n\t}\r\n\tif ( text ) {\r\n\t\telement.appendChild ( document.createTextNode ( text ));\r\n\t}\r\n\treturn element;\r\n}\r\n\r\n/**\r\n * @implements {IEventHandler}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nPermissionEditorGridBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tPermissionEditorGridBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\tvar cell = e.currentTarget ? e.currentTarget : DOMEvents.getTarget ( e );\r\n\t\t\tif ( DOMUtil.getLocalName ( cell ) == \"span\" ) { // elegant...\r\n\t\t\t\tcell = cell.parentNode;\r\n\t\t\t}\r\n\t\t\tif ( this._isChecked ( cell )) {\r\n\t\t\t\tthis._uncheck ( cell, true );\r\n\t\t\t} else {\r\n\t\t\t\tthis._check ( cell, true );\r\n\t\t\t}\r\n\t\t\tthis.dispatchAction ( Binding.ACTION_DIRTY );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionHandler}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nPermissionEditorGridBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tPermissionEditorGridBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase CheckBoxBinding.ACTION_COMMAND :\r\n\t\t\tvar checkbox = action.target;\r\n\t\t\tvar row = checkbox.associatedRow;\r\n\t\t\tif ( checkbox.isChecked ) {\r\n\t\t\t\tCSSUtil.attachClassName ( row, PermissionEditorGridBinding.CLASSNAME_DEFINED );\r\n\t\t\t} else {\r\n\t\t\t\tthis._setInheritedPermissions ( row );\r\n\t\t\t}\r\n\t\t\tthis.dispatchAction ( Binding.ACTION_DIRTY );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Get that result.\r\n * @param {boolean} isPreview\r\n * @return {array}\r\n */\r\nPermissionEditorGridBinding.prototype.getResult = function ( isPreview ) {\r\n\t\r\n\tvar checkboxes = this.getDescendantBindingsByLocalName ( \"checkbox\" );\r\n\tvar result = [];\r\n\t\r\n\tvar self = this;\r\n\tcheckboxes.each ( function ( checkbox ) {\r\n\t\tif ( isPreview || checkbox.isChecked ) {\r\n\t\t\tvar types = [];\r\n\t\t\tcheckbox.associatedCells.each ( function ( cell ) {\r\n\t\t\t\tif ( self._isChecked ( cell )) {\r\n\t\t\t\t\ttypes.push ( self.getHeadBinding ().getPermissionForIndex ( cell.cellIndex ));\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tresult.push ({\r\n\t\t\t\tUserName : checkbox.associatedName,\r\n\t\t\t\tPermissionTypes : types\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\t\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get preview result. THIS IS NO LONGER USED!\r\n * @deprecated\r\n * @return {array}\r\n */\r\nPermissionEditorGridBinding.prototype.getPreviewResult = function () {\r\n\t\r\n\treturn this.getResult ( true );\r\n}\r\n\r\n/**\r\n * Get table head binding.\r\n * @return {PermissionEditorHeadBinding}\r\n */\r\nPermissionEditorGridBinding.prototype.getHeadBinding = function () {\r\n\t\r\n\treturn this.bindingWindow.bindingMap [ \"head\" + this._index ];\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/permissioneditor/PermissionEditorHeadBinding.js",
    "content": "PermissionEditorHeadBinding.prototype = new Binding;\r\nPermissionEditorHeadBinding.prototype.constructor = PermissionEditorHeadBinding;\r\nPermissionEditorHeadBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction PermissionEditorHeadBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PermissionEditorHeadBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {Map<string><int>}\r\n\t */\r\n\tthis._indexes = new Map ();\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._count = 0;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPermissionEditorHeadBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[PermissionEditorHeadBinding]\";\r\n}\r\n\r\n/** \r\n * Set headings.\r\n * @param {List<object>}\r\n */\r\nPermissionEditorHeadBinding.prototype.setHeadings = function ( list ) {\r\n\t\r\n\tvar row = this.bindingElement.rows [ 0 ];\r\n\tvar indexes = this._indexes;\r\n\t\r\n\tlist.each ( function ( object ) {\r\n\t\tvar th = DOMUtil.createElementNS ( Constants.NS_XHTML, \"th\", document );\r\n\t\tth.appendChild ( document.createTextNode ( object.Value ));\r\n\t\trow.appendChild ( th );\r\n\t\tindexes.set ( object.Key, th.cellIndex );\r\n\t});\r\n}\r\n\r\n/**\r\n * Get cell index for permission type key.\r\n * @param {string} key\r\n */\r\nPermissionEditorHeadBinding.prototype.getIndexForPermission = function ( key ) {\r\n\t\r\n\treturn this._indexes.get ( key );\r\n}\r\n\r\n/**\r\n * Get permission type key for cell index.\r\n * @param {string} key\r\n */\r\nPermissionEditorHeadBinding.prototype.getPermissionForIndex = function ( index ) {\r\n\t\r\n\tif ( !this._keys ) {\r\n\t\tthis._keys = this._indexes.inverse ();\r\n\t}\r\n\treturn this._keys.get ( index );\r\n}\r\n\r\n/**\r\n * Get permission type count.\r\n * @return {int}\r\n */\r\nPermissionEditorHeadBinding.prototype.getPermissionTypeCount = function () {\r\n\t\r\n\tif ( !this._count ) {\r\n\t\tthis._count = this._indexes.countEntries ();\r\n\t}\r\n\treturn this._count;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/permissioneditor/PermissionEditorPageBinding.js",
    "content": "PermissionEditorPageBinding.prototype = new EditorPageBinding;\r\nPermissionEditorPageBinding.prototype.constructor = PermissionEditorPageBinding;\r\nPermissionEditorPageBinding.superclass = EditorPageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction PermissionEditorPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PermissionEditorPageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._entityToken = null;\r\n\t\r\n\t/**\r\n\t * First tab inflated? This is the groups tab.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._tab0 = false;\r\n\t\r\n\t/**\r\n\t * Second tab inflated? This is the users tab.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._tab1 = false;\r\n\t\r\n\t/**\r\n\t * Inflate this tab when page initializes.\r\n\t * @type {int}\r\n\t */\r\n\tthis._inflateOnInitialize = null;\r\n\t\r\n\t/**\r\n\t * Handle of the view that contains us.\r\n\t * @type {string}\r\n\t */\r\n\tthis._viewhandle = null;\r\n\t\r\n\t/**\r\n\t * True when usergroup permissions was changed.\r\n\t */\r\n\tthis.wasGroupsUpdated = false;\r\n}\r\n/**\r\n * Identifies binding.\r\n */\r\nPermissionEditorPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[PermissionEditorPageBinding]\";\r\n}\r\n\r\n/**\r\n * @param {object} arg\r\n * @overloads {PageBinding#setPageArgument}\r\n */\r\nPermissionEditorPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\r\n\tPermissionEditorPageBinding.superclass.setPageArgument.call ( this );\r\n\tthis._entityToken = arg.serializedEntityToken;\r\n\t//this._entityToken = arg.getFirst ().value;\r\n}\r\n\r\n/**\r\n * @overwrites {PageBinding#onBindingAttach}\r\n */\r\nPermissionEditorPageBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tPermissionEditorPageBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\t/*\r\n\t * Extract the view handle. SecurityService needs to know.\r\n\t */\r\n\tvar view = this.getAncestorBindingByLocalName ( \"view\", true );\r\n\tvar def = view.getDefinition ();\r\n\tthis._viewhandle = def.handle;\r\n\t\r\n\t/*\r\n\t * Listen for tab selection.\r\n\t */\r\n\tthis.addActionListener ( TabBoxBinding.ACTION_SELECTED );\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {EditorPageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nPermissionEditorPageBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tPermissionEditorPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\tswitch ( action.type ) {\r\n\t\tcase TabBoxBinding.ACTION_SELECTED :\r\n\t\t\tvar id = binding.getSelectedTabBinding ().getID ();\r\n\t\t\tif ( !this [ \"_\" + id ] == true ) {\r\n\t\t\t\tthis [ \"_\" + id ] = true;\r\n\t\t\t\tthis._inflate ( id );\r\n\t\t\t}\r\n\t\t\tswitch ( id ) {\r\n\t\t\t\tcase \"tab0\" :\r\n\t\t\t\t\tthis._display ( 0, true );\r\n\t\t\t\t\tthis._display ( 1, false );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"tab1\" :\r\n\t\t\t\t\tthis._display ( 1, true );\r\n\t\t\t\t\tthis._display ( 0, false );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase Binding.ACTION_DIRTY :\r\n\t\t\tif ( binding.getID () == \"grid0\" ) {\r\n\t\t\t\tthis._tab1 = false;\r\n\t\t\t\tthis._wasGroupsUpdated = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Inflate.\r\n * @param {string} id\r\n */\r\nPermissionEditorPageBinding.prototype._inflate = function ( id ) {\r\n\t\r\n\tvar map = this.bindingWindow.bindingMap;\r\n\tvar perms = null;\r\n\t\r\n\tif ( this._isPageBindingInitialized ) {\r\n\t\t\r\n\t\tswitch ( id ) {\r\n\t\t\tcase \"tab0\" :\r\n\t\t\t\tperms = SecurityService.GetGroupPermissions ( this._entityToken );\r\n\t\t\t\tmap.grid0.populate ( \r\n\t\t\t\t\tnew List ( perms.InheritedUserPermissions ),\r\n\t\t\t\t\tnew List ( perms.EntityUserPermissions )\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"tab1\" :\r\n\t\t\t\tif ( this._wasGroupsUpdated ) {\r\n\t\t\t\t\tperms = SecurityService.PreviewGetPermissions ( \r\n\t\t\t\t\t\tthis._entityToken, \r\n\t\t\t\t\t\tmap.grid1.getResult (),\r\n\t\t\t\t\t\tmap.grid0.getResult ()\r\n\t\t\t\t\t);\r\n\t\t\t\t\tthis._wasGroupsUpdated = false;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tperms = SecurityService.GetPermissions ( this._entityToken );\r\n\t\t\t\t}\r\n\t\t\t\tmap.grid1.populate ( \r\n\t\t\t\t\tnew List ( perms.InheritedUserPermissions ),\r\n\t\t\t\t\tnew List ( perms.EntityUserPermissions )\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tthis._inflateOnInitialize = id;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onPageInitialize}\r\n */\r\nPermissionEditorPageBinding.prototype.onPageInitialize = function () {\r\n\t\r\n\t/*\r\n\t * Set headings.\r\n\t */\r\n\tvar types = SecurityService.GetPermissionTypes ( \"dummy\" );\r\n\t\r\n\tthis.bindingWindow.bindingMap.head0.setHeadings ( new List ( types ));\r\n\tthis.bindingWindow.bindingMap.head1.setHeadings ( new List ( types ));\r\n\t\r\n\tPermissionEditorPageBinding.superclass.onPageInitialize.call ( this );\r\n\t\r\n\tif ( this._inflateOnInitialize != null ) {\r\n\t\tthis._inflate ( this._inflateOnInitialize );\r\n\t}\r\n}\r\n\r\n/**\r\n * Show main section only after page initializes. This \r\n * prevents strange visual initialization in Explorer. \r\n * Also, it renders faster while undisplayed.\r\n * @overloads {EditorPageBinding#onAfterPageInitialize}\r\n */\r\nPermissionEditorPageBinding.prototype._display = function ( index, isDisplay ) {\r\n\t\r\n\tPermissionEditorPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\t\r\n\tvar display = isDisplay ? ( Client.isExplorer ? \"block\" : \"table\" ) : \"none\";\r\n\t\r\n\tdocument.getElementById ( \"head\" + index ).style.display = display;\r\n\tdocument.getElementById ( \"grid\" + index ).style.display = display;\r\n}\r\n\r\n/**\r\n * Backup edits.\r\n * @overwrites {EditorPageBinding#_saveEditorPage}\r\n */\r\nPermissionEditorPageBinding.prototype._saveEditorPage = function () {\r\n\r\n\tvar map = this.bindingWindow.bindingMap;\r\n\t\r\n\tvar error = SecurityService.SetAllPermissions ( \r\n\t\t\tthis._entityToken, \r\n\t\t\tmap.grid1.getResult (), \r\n\t\t\tmap.grid0.getResult (),\r\n\t\t\tthis._viewhandle,\r\n\t\t\tApplication.CONSOLE_ID\r\n\t);\r\n\t\r\n\tif ( error != null ) {\r\n\t\tDialog.error ( \"Error!\", error );\r\n\t}\r\n\t\r\n\t/*\r\n\tmap.broadcasterCanSave.disable ();\r\n\tthis.isDirty = false;\r\n\tthis.dispatchAction ( EditorPageBinding.ACTION_CLEAN );\r\n\t*/\r\n\t\r\n\t/*\r\n\t * TODO!\r\n\t */\r\n\tsetTimeout ( function () {\r\n\t\tMessageQueue.update ();\r\n\t}, 50 );\r\n}"
  },
  {
    "path": "Website/Composite/content/views/editors/permissioneditor/permissioneditor.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Website.Content.Views.Editors.PermissionEditorPageBinding</title>\r\n\t    <control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"PermissionEditorPageBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"PermissionEditorGridBinding.js\"></script>\r\n\t\t<script type=\"text/javascript\" src=\"PermissionEditorHeadBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\r\n\t\t<ui:editorpage \r\n\t\t\tid=\"page\"\r\n\t\t\tlabel=\"${string:Website.Content.Views.Editors.PermissionEditor.LabelTitle}\" \r\n\t\t\timage=\"${icon:security-manage-permissions}\"\r\n\t\t\tbinding=\"PermissionEditorPageBinding\">\r\n\t\t\t\r\n\t\t\t<ui:broadcasterset>\r\n\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\"/>\r\n\t\t\t</ui:broadcasterset>\r\n\t\t\t\r\n\t\t\t<ui:toolbar id=\"toolbar\" class=\"document-toolbar\">\r\n\t\t\t \t<ui:toolbarbody class=\"pull-right\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton\r\n\t\t\t\t\t\t\tlabel=\"${string:Website.Content.Views.Editors.PermissionEditor.LabelButtonSave}\" \r\n\t\t\t\t\t\t\tid=\"savebutton\" \r\n\t\t\t\t\t\t\timage=\"${icon:save}\" \r\n\t\t\t\t\t\t\timage-disabled=\"${icon:save-disabled}\" \r\n\t\t\t\t\t\t\tobserves=\"broadcasterCanSave\" \r\n\t\t\t\t\t\t\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE);\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\t\t\t<ui:tabbox>\r\n\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t<ui:tab id=\"tab0\" label=\"${string:Website.Content.Views.Editors.PermissionEditor.LabelTabUserGroups}\"/>\r\n\t\t\t\t\t<ui:tab id=\"tab1\" label=\"${string:Website.Content.Views.Editors.PermissionEditor.LabelTabUsers}\"/>\r\n\t\t\t\t</ui:tabs>\r\n\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t<ui:tabpanel id=\"tabpanel0\">\r\n\t\t\t\t\t\t<table id=\"head0\" class=\"table permissions-table hide\" binding=\"PermissionEditorHeadBinding\">\r\n\t\t\t\t\t\t\t<thead>\r\n\t\t\t\t\t\t\t\t<tr class=\"head text-center\">\r\n\t\t\t\t\t\t\t\t\t<th class=\"edit\">&#160;</th>\r\n\t\t\t\t\t\t\t\t\t<th class=\"index\">&#160;</th>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t</thead>\r\n\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t<ui:scrollbox>\r\n\t\t\t\t\t\t\t<table id=\"grid0\" class=\"table permissions-table hide\" binding=\"PermissionEditorGridBinding\">\r\n\t\t\t\t\t\t\t\t<tbody/>\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t<ui:tabpanel id=\"tabpanel1\">\r\n\t\t\t\t\t\t<table id=\"head1\" class=\"table permissions-table\"  binding=\"PermissionEditorHeadBinding\">\r\n\t\t\t\t\t\t\t<thead>\r\n\t\t\t\t\t\t\t\t<tr class=\"head\">\r\n\t\t\t\t\t\t\t\t\t<th class=\"edit\">&#160;</th>\r\n\t\t\t\t\t\t\t\t\t<th class=\"index\">&#160;</th>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t</thead>\r\n\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t<ui:scrollbox>\r\n\t\t\t\t\t\t\t<table id=\"grid1\" class=\"table permissions-table\" binding=\"PermissionEditorGridBinding\">\r\n\t\t\t\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t</ui:tabpanels>\r\n\t\t\t</ui:tabbox>\r\n\t\t</ui:editorpage>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/functiondoc/FunctionDocumentation-print.css",
    "content": "﻿@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n*#toolbar\r\n{\r\n\tdisplay: none;\r\n}\r\n\r\n*\r\n{\r\n\theight: auto !important;\r\n\toverflow: visible !important;\r\n}\r\n\r\nui|scrollbox#scrollbox\r\n{\r\n\theight: auto !important;\r\n\toverflow: visible !important;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/functiondoc/FunctionDocumentation.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"FunctionDocumentation.aspx.cs\"\r\n    Inherits=\"Spikes_MAW_FunctionDocumentation\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\"\r\nxmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n    <control:styleloader runat=\"server\" />\r\n    <control:scriptloader type=\"sub\" runat=\"server\" />\r\n    <title>\r\n        <%= Request.QueryString[\"functionPrefix\"]%>\r\n        Functions</title>\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"FunctionDocumentation.css.aspx\" media=\"all\" />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"FunctionDocumentation-print.css.aspx\" media=\"print\" />\r\n\r\n    <script type=\"text/javascript\">\r\n    \tDocumentManager.isDocumentSelectable = true;\r\n    \tDocumentManager.hasNativeContextMenu = true;\r\n    </script>\r\n\r\n</head>\r\n<body>\r\n    <ui:page label=\"<%= Request.QueryString[\"functionPrefix\"]%> Functions\" image=\"${icon:all-functions-generatedocumentation}\">\r\n        <ui:toolbar id=\"toolbar\">\r\n            <ui:toolbarbody>\r\n                <ui:toolbargroup>\r\n                    <ui:toolbarbutton oncommand=\"window.location.reload()\" id=\"refreshbutton\" image=\"${icon:refresh}\"\r\n                        label=\"${string:FunctionDocumentation.LabelButtonRefresh}\" />\r\n                    <ui:toolbarbutton oncommand=\"print()\" id=\"printbutton\" image=\"${icon:print}\"\r\n                        label=\"${string:FunctionDocumentation.LabelButtonPrint}\" />\r\n                </ui:toolbargroup>\r\n            </ui:toolbarbody>\r\n        </ui:toolbar>\r\n        <ui:scrollbox id=\"scrollbox\">\r\n            <div class=\"content\">\r\n                <asp:PlaceHolder ID=\"functionDescriptorsPlaceholder\" runat=\"server\" />\r\n            </div>\r\n        </ui:scrollbox>\r\n    </ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/functiondoc/FunctionDocumentation.aspx.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\n\r\npublic partial class Spikes_MAW_FunctionDocumentation : System.Web.UI.Page\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        string functionPrefix = Request.QueryString[\"functionPrefix\"] ?? \"\";\r\n        bool widgets = bool.Parse(Request.QueryString[\"widgets\"] ?? \"false\");\r\n\r\n\r\n        List<string> functionNames = widgets ? FunctionFacade.WidgetFunctionNames : FunctionFacade.FunctionNames;\r\n\r\n        functionNames = functionNames.Where(f => f.StartsWith(functionPrefix)).OrderBy(f => f).ToList();\r\n\r\n\r\n        var functionDescriptors = new XElement(\"ul\",\r\n            new XAttribute(\"id\", \"functionList\"));\r\n\r\n        foreach (string functionName in functionNames)\r\n        {\r\n            IMetaFunction function;\r\n            if (!widgets)\r\n                function = FunctionFacade.GetFunction(functionName);\r\n            else\r\n                function = FunctionFacade.GetWidgetFunction(functionName);\r\n\r\n            XElement descriptionElement = null;\r\n            XElement parametersTable = null;\r\n\r\n            if (!string.IsNullOrEmpty(function.Description))\r\n            {\r\n                descriptionElement = new XElement(\"div\",\r\n                    new XAttribute(\"class\", \"description\"),\r\n                    StringResourceSystemFacade.ParseString(function.Description));\r\n            }\r\n\r\n            if (function.ParameterProfiles.Any())\r\n            {\r\n                parametersTable = new XElement(\"table\", new XAttribute(\"class\", \"parameters\"));\r\n                foreach (ParameterProfile parameterProfile in function.ParameterProfiles)\r\n                {\r\n                    string helpText = parameterProfile.HelpDefinition.GetLocalized().HelpText;\r\n\r\n                    if (!string.IsNullOrEmpty(helpText))\r\n                    {\r\n                        helpText = string.Format(\" {0}\", helpText);\r\n                    }\r\n\r\n                    var parameterRow = new XElement(\"tr\",\r\n                        new XAttribute(\"title\", parameterProfile.LabelLocalized),\r\n                        new XElement(\"td\",\r\n                            new XAttribute(\"class\", string.Format(\"requiredInfo required{0}\", parameterProfile.IsRequired))),\r\n                        new XElement(\"td\",\r\n                            new XAttribute(\"class\", \"name\"),\r\n                            parameterProfile.Name),\r\n                        new XElement(\"td\",\r\n                            new XAttribute(\"class\", \"parameterType\"),\r\n                            parameterProfile.Type.GetShortLabel()),\r\n                        new XElement(\"td\",\r\n                            new XAttribute(\"class\", \"description\"),\r\n                            new XElement(\"span\",\r\n                                new XAttribute(\"class\", \"typeinfo\"),\r\n                                helpText ?? \"\"))\r\n                        );\r\n                    parametersTable.Add(parameterRow);\r\n                }\r\n            }\r\n\r\n            var functionDescriptor = new XElement(\"li\",\r\n                new XElement(\"div\",\r\n                    new XAttribute(\"class\", \"header\"),\r\n                    functionName,\r\n                    new XElement(\"span\",\r\n                        new XAttribute(\"class\", \"typeinfo\"),\r\n                        \" ← \" + function.ReturnType.GetShortLabel())),\r\n                descriptionElement,\r\n                parametersTable\r\n                );\r\n\r\n            functionDescriptors.Add(functionDescriptor);\r\n        }\r\n\r\n        functionDescriptorsPlaceholder.Controls.Add(new LiteralControl(functionDescriptors.ToString(SaveOptions.DisableFormatting)));\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/functiondoc/FunctionDocumentation.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Spikes_MAW_FunctionDocumentation {\r\n    \r\n    /// <summary>\r\n    /// functionDescriptorsPlaceholder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder functionDescriptorsPlaceholder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/functiondoc/FunctionDocumentation.css",
    "content": "﻿@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n*#scrollbox\r\n{\r\n\tbackground-color: white !important;\r\n\tline-height: 20px;\r\n}\r\ntable\r\n{\r\n\tborder-collapse: collapse;\r\n}\r\n\r\nul#functionList\r\n{\r\n\tmargin-left: 20px;\r\n\tmargin-top: 20px;\r\n\tpadding-left: 0;\r\n\tlist-style: none;\r\n}\r\nul#functionList li\r\n{\r\n\tmargin-top: 5px;\r\n\tpadding-left: 25px;\r\n\tbackground-image: url(../../../images/icons/svg/base-function-function.svg);\r\n\tbackground-repeat: no-repeat;\r\n\tbackground-position: 0 3px;\r\n    line-height: 24px;\r\n}\r\ndiv.header\r\n{\r\n\tfont-weight: bold;\r\n\tdisplay: inline;\r\n}\r\ntable.parameters tr\r\n{\r\n\tline-height: 20px;\r\n}\r\ntable.parameters td\r\n{\r\n\tvertical-align: top;\r\n}\r\ntable.parameters td.requiredInfo\r\n{\r\n\tbackground-repeat: no-repeat;\r\n\tbackground-position: 2px 3px;\r\n\twidth: 24px;\r\n    height: 20px;\r\n}\r\ntable.parameters td.requiredTrue\r\n{\r\n\tbackground-image: url(../../../images/icons/svg/parameter_missing.svg);\r\n}\r\ntable.parameters td.requiredFalse\r\n{\r\n\tbackground-image: url(../../../images/icons/svg/parameter.svg);\r\n}\r\ntable.parameters td.name\r\n{\r\n\twidth: 10em;\r\n}\r\n\r\nspan.typeinfo\r\n{\r\n\tcolor: #485588;\r\n\tpadding-right: 5px;\r\n}\r\n\r\ndiv.header span.typeinfo\r\n{\r\n\tfont-weight: normal;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/functioninfo/ShowFunctionInfo.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"ShowFunctionInfo.aspx.cs\" Inherits=\"Composite_content_views_functioninfo_ShowFunctionInfo\" %>\r\n\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\"\r\nxmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n\r\n<head>\r\n    <control:styleloader ID=\"Styleloader\" runat=\"server\" />\r\n    <control:scriptloader ID=\"Scriptloader\" type=\"sub\" runat=\"server\" />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"ShowFunctionInfo.css\" media=\"all\" />\r\n    <title>Function Info</title>\r\n    <script type=\"text/javascript\">\r\n        DocumentManager.isDocumentSelectable = true;\r\n    </script>\r\n</head>\r\n<body>\r\n    <ui:page label=\"<%= this.PageLabel %>\" image=\"${icon:zoom}\">\r\n        <%--<ui:toolbar id=\"toolbar\">\r\n            <ui:toolbarbody>\r\n                <ui:toolbargroup>\r\n                </ui:toolbargroup>\r\n            </ui:toolbarbody>\r\n        </ui:toolbar>--%>\r\n        <div id=\"statuscontainer\">\r\n            <asp:PlaceHolder ID=\"functionInfoPlaceholder\" runat=\"server\" />\r\n        </div>\r\n    </ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/functioninfo/ShowFunctionInfo.aspx.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing System.Xml.Linq;\r\nusing Composite.Functions;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Functions.Foundation;\r\n\r\n\r\npublic partial class Composite_content_views_functioninfo_ShowFunctionInfo : System.Web.UI.Page\r\n{\r\n    public string PageLabel { get; set; }\r\n\r\n\r\n    public Composite_content_views_functioninfo_ShowFunctionInfo()\r\n    {\r\n        PageLabel = \"Function Info\";\r\n    }\r\n\r\n\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        string functionName = Request.QueryString[\"Name\"];\r\n        bool isWidget = bool.Parse(Request.QueryString[\"IsWidget\"] ?? \"false\");\r\n\r\n        this.PageLabel = functionName;\r\n\r\n        IMetaFunction function = isWidget ? FunctionFacade.GetWidgetFunction(functionName)\r\n                                           : (IMetaFunction) FunctionFacade.GetFunction(functionName);\r\n\r\n        var functionDescriptors = new XElement(\"ul\", new XAttribute(\"id\", \"functionList\"));\r\n        XElement descriptionElement = null;\r\n        XElement parametersTable = null;\r\n\r\n        XNamespace functionNamespace = FunctionTreeConfigurationNames.NamespaceName;\r\n        var codeElement = new XElement(functionNamespace + (isWidget ? \"widgetfunction\" : \"function\"),\r\n            new XAttribute(\"name\", functionName),\r\n            new XAttribute(XNamespace.Xmlns + \"f\", FunctionTreeConfigurationNames.NamespaceName));\r\n\r\n\r\n        if (!string.IsNullOrEmpty(function.Description))\r\n        {\r\n            descriptionElement = new XElement(\"div\",\r\n                new XAttribute(\"class\", \"description\"),\r\n                StringResourceSystemFacade.ParseString(function.Description));\r\n        }\r\n\r\n\r\n\r\n        if (function.ParameterProfiles.Any())\r\n        {\r\n            parametersTable = new XElement(\"table\", new XAttribute(\"class\", \"parameters\"));\r\n            foreach (ParameterProfile parameterProfile in function.ParameterProfiles)\r\n            {\r\n                string helpText = parameterProfile.HelpDefinition.GetLocalized().HelpText;\r\n\r\n                if (!string.IsNullOrEmpty(helpText))\r\n                {\r\n                    helpText = string.Format(\" {0}\", helpText);\r\n                }\r\n\r\n                var parameterRow = new XElement(\"tr\",\r\n                    new XAttribute(\"title\", parameterProfile.LabelLocalized),\r\n                    new XElement(\"td\",\r\n                        new XAttribute(\"class\", string.Format(\"requiredInfo required{0}\", parameterProfile.IsRequired))),\r\n                    new XElement(\"td\",\r\n                        new XAttribute(\"class\", \"name\"),\r\n                        parameterProfile.Name),\r\n                    new XElement(\"td\",\r\n                        new XAttribute(\"class\", \"type\"),\r\n                        new XElement(\"span\",\r\n                            new XAttribute(\"class\", \"typeinfo\"),\r\n                            parameterProfile.Type.GetShortLabel())),\r\n                    new XElement(\"td\",\r\n                        new XAttribute(\"class\", \"description\"),\r\n                            helpText\r\n                        )\r\n                    );\r\n                parametersTable.Add(parameterRow);\r\n\r\n\r\n\r\n                var codeParameter = new XElement(functionNamespace + \"param\", new XAttribute(\"name\", parameterProfile.Name));\r\n\r\n                string value = parameterProfile.IsRequired ? \"[Required Value]\" : \"[Optional Value]\";\r\n\r\n                if (parameterProfile.Type.IsPrimitive || parameterProfile.Type == typeof(string) || parameterProfile.Type == typeof(Guid))\r\n                {\r\n                    codeParameter.Add(new XAttribute(\"value\", value));\r\n                }\r\n                else\r\n                {\r\n                    codeParameter.Add(value);\r\n                }\r\n\r\n                codeParameter.Add(new XAttribute(XNamespace.Xmlns + \"f\", FunctionTreeConfigurationNames.NamespaceName));\r\n\r\n                codeElement.Add(codeParameter);\r\n            }\r\n        }\r\n\r\n\r\n        var functionDescriptor = new XElement(\"li\",\r\n            new XElement(\"div\",\r\n                new XAttribute(\"class\", \"header\"),\r\n                functionName,\r\n                new XElement(\"span\",\r\n                    new XAttribute(\"class\", \"typeinfo\"),\r\n                    \" ← \" + function.ReturnType.GetShortLabel())),\r\n            descriptionElement,\r\n            parametersTable\r\n            );\r\n\r\n        functionDescriptors.Add(functionDescriptor);\r\n\r\n        var hans = new XElement(\"div\", functionDescriptors);\r\n        hans.Add(new XElement(\"div\", new XAttribute(\"style\", \"padding-left: 45px\"),\r\n            new XElement(\"div\", new XAttribute(\"style\", \"font-weight: bold\"), \"Function Markup\"),\r\n            new XElement(\"div\", new XAttribute(\"style\", \"padding-left: 10px\"), new XElement(\"pre\", codeElement.ToString(SaveOptions.OmitDuplicateNamespaces)))\r\n        ));\r\n\r\n        functionInfoPlaceholder.Controls.Add(new LiteralControl(hans.ToString(SaveOptions.DisableFormatting)));\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/functioninfo/ShowFunctionInfo.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_content_views_functioninfo_ShowFunctionInfo {\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Styleloader control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.controls.StyleLoaderControl Styleloader;\r\n    \r\n    /// <summary>\r\n    /// Scriptloader control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader;\r\n    \r\n    /// <summary>\r\n    /// functionInfoPlaceholder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder functionInfoPlaceholder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/functioninfo/ShowFunctionInfo.css",
    "content": "﻿@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n*#scrollbox {\r\n    background-color: white !important;\r\n    line-height: 20px;\r\n}\r\n\r\ntable {\r\n    border-collapse: collapse;\r\n}\r\n\r\n\r\nul#functionList {\r\n    margin-left: 20px;\r\n    margin-top: 20px;\r\n    padding-left: 0;\r\n    list-style: none;\r\n}\r\n\r\n    ul#functionList li {\r\n        margin-top: 5px;\r\n        padding-left: 25px;\r\n        background-image: url(../../../images/icons/svg/functioncall.svg);\r\n        background-repeat: no-repeat;\r\n        background-position: 0 3px;\r\n        line-height: 24px;\r\n    }\r\n\r\ndiv.header {\r\n    font-weight: bold;\r\n    display: inline;\r\n}\r\n\r\ntable.parameters tr {\r\n    line-height: 20px;\r\n}\r\n\r\ntable.parameters td {\r\n    vertical-align: top;\r\n}\r\n\r\n    table.parameters td.requiredInfo {\r\n        background-repeat: no-repeat;\r\n        background-position: 2px 3px;\r\n        width: 24px;\r\n    }\r\n\r\n    table.parameters td.requiredTrue {\r\n        background-image: url(../../../images/icons/svg/parameter_missing.svg);\r\n    }\r\n\r\n    table.parameters td.requiredFalse {\r\n        background-image: url(../../../images/icons/svg/parameter.svg);\r\n    }\r\n\r\n    table.parameters td.name {\r\n        width: 10em;\r\n    }\r\n\r\n    table.parameters td.description {\r\n    }\r\n\r\nspan.typeinfo {\r\n    color: #485588;\r\n    padding-right: 5px;\r\n}\r\n\r\ndiv.header span.typeinfo {\r\n    font-weight: normal;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/generic/GenericPageBinding.js",
    "content": "GenericPageBinding.prototype = new PageBinding;\r\nGenericPageBinding.prototype.constructor = GenericPageBinding;\r\nGenericPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction GenericPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"GenericPageBinding\" );\r\n\t\r\n\t/**\r\n\t * URL to either 1) load directly or 2) set as action on the form. \r\n\t * @type {string}\r\n\t */\r\n\tthis._url = null;\r\n\t\r\n\t/**\r\n\t * Postback arguments.\r\n\t * @type {Map<String><String>}\r\n\t */\r\n\tthis._map = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nGenericPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[GenericPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {object} arg\r\n */\r\nGenericPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\t\r\n\tGenericPageBinding.superclass.setPageArgument.call ( this, arg );\r\n\t\r\n\tthis._url = arg.url;\r\n\tthis._map = arg.map;\r\n\t\r\n\tvar win = this.bindingWindow.bindingMap.window;\r\n\tif ( this._list.hasEntries ()) {\r\n\t\twin.setURL ( WindowBinding.POSTBACK_URL );\r\n\t\tthis.addActionListener ( WindowBinding.ACTION_LOADED );\r\n\t} else {\r\n\t\twin.setURL ( this._url );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @param {Action} action \r\n */\r\nGenericPageBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tGenericPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase WindowBinding.ACTION_LOADED :\r\n\t\t\tvar win = action.target.getContentWindow ();\r\n\t\t\tif ( win.isPostBackDocument ) {\r\n\t\t\t\taction.target.post ( this._list, this._url );\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBeforePageInitialize}\r\n */\r\nGenericPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tGenericPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}"
  },
  {
    "path": "Website/Composite/content/views/generic/generic.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Generic</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\" src=\"GenericPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page id=\"page\" binding=\"GenericPageBinding\">\r\n\t\t\t<ui:window id=\"window\"/>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/help/HelpPageBinding.js",
    "content": "HelpPageBinding.prototype = new PageBinding;\r\nHelpPageBinding.prototype.constructor = HelpPageBinding;\r\nHelpPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * True when content is pulled from remote server.\r\n * TODO: Figure out how to switch this intelligently.\r\n * @type {boolean}\r\n */\r\nHelpPageBinding.hasRemoteConnection = false;\r\n\r\n/**\r\n * Update this to always point at the root of the help folder.\r\n * @type {string}\r\n */\r\nHelpPageBinding.HELPURL = Resolver.resolve ( \"${root}/help/help.ashx\" );\r\n\r\n/**\r\n * Special pages mapped to special buttons.\r\n * @type {HashMap<string><string>}\r\n */\r\nHelpPageBinding.PAGES = {\r\n\t\r\n\t\"contentsbutton\"\t: \"Composite.Help.Contents.Url\",\r\n\t\"searchbutton\" \t\t: \"Composite.Help.Search.Url\",\r\n\t\"bookmarksbutton\" \t: \"Composite.Help.Bookmarks.Url\",\r\n\t\"indexbutton\" \t\t: \"Composite.Help.Index.Url\"\r\n}\r\n\r\n/**\r\n * This is injected into links as an onclick function.\r\n * @type {funtion}\r\n */\r\nHelpPageBinding.navigate = function () {\r\n\t\r\n\tvar domain = \"c1console.composite.net/\";\r\n\tvar location = this.href.split ( domain )[ 1 ];\r\n\t\r\n\t/*\r\n\t * Change window location. Patching an \r\n\t * exotic WindowBinding exception in moz.\r\n\t */\r\n\tvar page = bindingMap.page;\r\n\tif ( Client.isExplorer ) {\r\n\t\tpage.setLocalURL ( location );\r\n\t} else {\r\n\t\tsetTimeout ( function () {\r\n\t\t\tpage.setLocalURL ( location );\r\n\t\t}, 0 );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Onclick action can \r\n\t * be removed now.\r\n\t */\r\n\tthis.onclick = null;\r\n\t\r\n\t/*\r\n\t * Skip normal link behavior because it doesn't \r\n\t * update the WindowBinding URL property.\r\n\t */\r\n\treturn false;\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction HelpPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"HelpPageBinding\" );\r\n\t \r\n\t/**\r\n\t * The main window.\r\n\t * @type {WindowBinding}\r\n\t */\r\n\tthis._windowBinding = null;\r\n\t\r\n\t/**\r\n\t * The bottom toolbar.\r\n\t * @type {ToolBarBinding}\r\n\t */\r\n\tthis._statusbarBinding = null;\r\n\t\r\n\t/**\r\n\t * The text size popup.\r\n\t * @type {PopupBinding}\r\n\t */\r\n\tthis._popupBinding = null;\r\n\t\r\n\t/**\r\n\t * Navigation history list.\r\n\t * @type {List<string>\r\n\t */\r\n\tthis._history = new List ();\r\n\t\r\n\t/**\r\n\t * Navigation history position.\r\n\t * @type {int}\r\n\t */\r\n\tthis._index = parseInt ( -1 );\r\n\t\r\n\t/**\r\n\t * True when navigating using toolbar buttons.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isHistoryBrowsing = false;\r\n\t\r\n\t/**\r\n\t * True while using the refresh button (developermode).\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isRefreshing = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nHelpPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[HelpPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBeforePageInitialize}\r\n */\r\nHelpPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tHelpPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\t\r\n\tthis._windowBinding = bindingMap.helpwindow;\r\n\tthis._windowBinding.addActionListener ( WindowBinding.ACTION_ONLOAD, this );\r\n\t\r\n\tthis._toolbarBinding = bindingMap.toolbar;\r\n\tthis._toolbarBinding.addActionListener ( ButtonBinding.ACTION_COMMAND, this )\r\n\t\r\n\tthis._statusbarBinding = bindingMap.statusbar;\r\n\tif ( this._statusbarBinding != null ) {\r\n\t\tthis._statusbarBinding.addActionListener ( ButtonBinding.ACTION_COMMAND, this );\r\n\t}\r\n\t\r\n\tthis._popupBinding = bindingMap.textsizepopup;\r\n\tif ( this._popupBinding != null ) {\r\n\t\tthis._popupBinding.addActionListener ( MenuItemBinding.ACTION_COMMAND, this );\r\n\t}\r\n}\r\n\r\n\r\n\r\n/**\r\n * Page load delayed in order to present GUI faster.\r\n * @overloads {PageBinding#onAfterPageInitialize}\r\n */\r\nHelpPageBinding.prototype.onAfterPageInitialize = function () {\r\n\t\r\n\tHelpPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\tthis.setLocalURL ( \"Composite.Help.Contents.Url\" );\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n */\r\nHelpPageBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tHelpPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase WindowBinding.ACTION_ONLOAD :\r\n\t\t\tif ( binding == this._windowBinding ) {\r\n\t\t\t\tthis._onWindowLoaded ();\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\tswitch ( action.listener ) {\r\n\t\t\t\tcase this._toolbarBinding :\r\n\t\t\t\t\tthis._onToolBarButton ( binding );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase this._statusbarBinding :\r\n\t\t\t\t\tthis._onStatusBarButton ( binding );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\t\t\talert ( \"Text size not implemented!\" );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set window location by localized URL fragment.\r\n * @param {string} urlfragment\r\n */\r\nHelpPageBinding.prototype.setLocalURL = function ( urlfragment ) {\r\n\t\r\n\tif ( urlfragment == null ) {\r\n\t\turlfragment = \"\";\r\n\t}\r\n\tthis._windowBinding.setURL ( HelpPageBinding.HELPURL + \"?id=\" + urlfragment );\r\n}\r\n\r\n/**\r\n * Get window location as localized URL fragment.\r\n * @return {string}\r\n */\r\nHelpPageBinding.prototype.getLocalURL = function () {\r\n\t\r\n\treturn this._windowBinding.getURL ().split ( HelpPageBinding.HELPURL + \"?id=\" )[ 1 ];\r\n}\r\n\r\n/**\r\n * Go forward.\r\n */\r\nHelpPageBinding.prototype._goForward = function () {\r\n\t\r\n\tif ( !this._isHistoryBrowsing ) {\r\n\t\tif ( this._index < this._history.getLength () - 1 ) {\r\n\t\t\tthis._isHistoryBrowsing = true;\r\n\t\t\tthis._index ++;\r\n\t\t\tthis.setLocalURL ( this._history.get ( this._index ));\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Go back.\r\n */\r\nHelpPageBinding.prototype._goBack = function () {\r\n\t\r\n\tif ( !this._isHistoryBrowsing ) {\r\n\t\tif ( this._index > 0 ) {\r\n\t\t\tthis._isHistoryBrowsing = true;\r\n\t\t\tthis._index --;\r\n\t\t\tthis.setLocalURL ( this._history.get ( this._index ));\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * On window loaded.\r\n * @param {string} url\r\n */\r\nHelpPageBinding.prototype._onWindowLoaded = function () {\r\n\t\r\n\t/*\r\n\t * Update history index, broadcasters and statusbar buttons.\r\n\t */\r\n\tif ( !this._isRefreshing ) {\r\n\t\tvar url = this.getLocalURL ();\r\n\t\tthis._updateHistory ( url );\r\n\t\tthis._updateBroadcasters ();\r\n\t\tthis._updateStatusBar ( url );\r\n\t} else {\r\n\t\tthis._isRefreshing = false;\r\n\t}\r\n\t\r\n\t/*\r\n\t * Modify links in contained document.\r\n\t */\r\n\tvar win = this._windowBinding;\r\n\tvar doc = win.getContentDocument ();\r\n\tvar links = new List ( doc.links );\r\n\tlinks.each ( function ( link ) {\r\n\t\tif ( link.href != Constants.DUMMY_LINK && link.target != \"_blank\" ) {\r\n\t\t\tlink.onclick = HelpPageBinding.navigate;\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * On navigationbar button.\r\n * @param {ToolBarButtonBinding} button\r\n */\r\nHelpPageBinding.prototype._onToolBarButton = function ( button ) {\r\n\t\r\n\tswitch ( button.bindingElement.id ) {\r\n\t\tcase \"backbutton\" :\r\n\t\t\tthis._goBack ();\r\n\t\t\tbreak;\r\n\t\tcase \"forwardbutton\" :\r\n\t\t\tthis._goForward ();\r\n\t\t\tbreak;\r\n\t\tcase \"refreshbutton\" :\r\n\t\t\tthis._isRefreshing = true;\r\n\t\t\tthis._windowBinding.reload ();\r\n\t\t\tbreak;\r\n\t\tcase \"bookmarkbutton\" :\r\n\t\t\talert ( \"Bookmarks not implemented!\" );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * On statusbar button.\r\n * @param {ToolBarButtonBinding} button\r\n */\r\nHelpPageBinding.prototype._onStatusBarButton = function ( button ) {\r\n\t\r\n\tvar id = button.bindingElement.id;\r\n\tvar url = HelpPageBinding.PAGES [ id ];\r\n\tthis.setLocalURL ( url );\r\n}\r\n\r\n/**\r\n * Update history index (on page load).\r\n * @param {string} url\r\n */\r\nHelpPageBinding.prototype._updateHistory = function ( url ) {\r\n\r\n\tif ( !this._isHistoryBrowsing ) {\r\n\t\twhile ( this._history.getLength () - 1 > this._index ) {\r\n\t\t\tthis._history.extractLast ();\r\n\t\t}\r\n\t\tthis._history.add ( url );\r\n\t\tthis._index ++;\r\n\t} else {\r\n\t\tthis._isHistoryBrowsing = false;\r\n\t}\r\n}\r\n \r\n/**\r\n * Update broadcasters.\r\n */\r\nHelpPageBinding.prototype._updateBroadcasters = function () {\r\n\t\r\n\t/*\r\n\t * Back.\r\n\t */\r\n\tvar back = bindingMap.broadcasterHistoryBack;\r\n\tif ( this._index == parseInt ( 0 )) {\r\n\t\tif ( !back.isDisabled ()) {\r\n\t\t\tback.disable ();\r\n\t\t}\r\n\t} else {\r\n\t\tif ( back.isDisabled ()) {\r\n\t\t\tback.enable ();\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * Forward.\r\n\t */\r\n\tvar forward = bindingMap.broadcasterHistoryForward;\r\n\tif ( this._index < this._history.getLength () - 1 ) {\r\n\t\tif ( forward.isDisabled ()) {\r\n\t\t\tforward.enable ();\r\n\t\t}\r\n\t} else {\r\n\t\tif ( !forward.isDisabled ()) {\r\n\t\t\tforward.disable ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*\r\n * Update statusbar on page load. When special pages \r\n * are active, disable corresponding button.\r\n * @param {string} url\r\n */\r\nHelpPageBinding.prototype._updateStatusBar = function ( url ) {\r\n\r\n\tfor ( var entry in HelpPageBinding.PAGES ) {\r\n\t\tif ( bindingMap [ entry ]) {\r\n\t\t\tif ( HelpPageBinding.PAGES [ entry ] == url ) {\r\n\t\t\t\tbindingMap [ entry ].disable ();\r\n\t\t\t} else {\r\n\t\t\t\tbindingMap [ entry ].enable ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/views/help/help.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Help</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<script type=\"text/javascript\" src=\"HelpPageBinding.js\"></script>\r\n\t</head>\r\n\t<body>\r\n\t\r\n\t\t<ui:broadcasterset>\r\n\t\t\t<ui:broadcaster id=\"broadcasterHistoryBack\" isdisabled=\"true\"/>\r\n\t\t\t<ui:broadcaster id=\"broadcasterHistoryForward\" isdisabled=\"true\"/>\r\n\t\t</ui:broadcasterset>\r\n\t\t\r\n\t\t<ui:popupset>\r\n\t\t\t<ui:popup id=\"textsizepopup\">\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem label=\"Normal\" type=\"checkbox\" ischecked=\"true\"/>\r\n\t\t\t\t\t\t<ui:menuitem label=\"Larger\" type=\"checkbox\"/>\r\n\t\t\t\t\t\t<ui:menuitem label=\"Largest\" type=\"checkbox\"/>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:popup>\r\n\t\t</ui:popupset>\r\n\t\t\r\n\t\t<!-- <ui:cover id=\"cover\"/>  -->\r\n\t\t\r\n\t\t<ui:page id=\"page\" binding=\"HelpPageBinding\">\r\n\t\t\t<ui:toolbar id=\"toolbar\" type=\"imagesonly\">\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"backbutton\" label=\"Back\" image=\"${icon:previous}\" image-disabled=\"${icon:previous-disabled}\" tooltip=\"${string:Website.Content.Views.Help.ToolTipBack}\" observes=\"broadcasterHistoryBack\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"forwardbutton\" label=\"Forward\" image=\"${icon:next}\" image-disabled=\"${icon:next-disabled}\" tooltip=\"${string:Website.Content.Views.Help.ToolTipForward}\" observes=\"broadcasterHistoryForward\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"refreshbutton\" rel=\"developermode\" label=\"Refresh\" image=\"${icon:refresh}\" tooltip=\"${string:Website.Content.Views.Help.ToolTipRefresh}\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t<ui:toolbarbody align=\"right\" rel=\"developermode\">\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"bookmarkbutton\" label=\"Bookmark\" rel=\"developermode\" image=\"${icon:bookmark}\" tooltip=\"Bookmark this page\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"textsizebutton\" label=\"Text Size\" rel=\"developermode\" image=\"${icon:zoomin}\" tooltip=\"Change text size\" popup=\"textsizepopup\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\t\t\t<ui:flexbox>\r\n\t\t\t\t<ui:window id=\"helpwindow\"/>\r\n\t\t\t</ui:flexbox>\r\n\t\t\t<ui:toolbar id=\"statusbar\" class=\"statusbar\">\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"contentsbutton\" label=\"${string:Website.Content.Views.Help.LabelContents}\" image=\"${icon:contents}\" image-disabled=\"${icon:contents-disabled}\" tooltip=\"${string:Website.Content.Views.Help.ToolTipContents}\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"searchbutton\" rel=\"developermode\" label=\"Search\" image=\"${icon:zoom}\" image-disabled=\"${icon:zoom-disabled}\" tooltip=\"Search Help\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"bookmarksbutton\" rel=\"developermode\" label=\"Bookmarks\" image=\"${icon:bookmark}\" image-disabled=\"${icon:bookmark-disabled}\" tooltip=\"Your bookmarked pages\"/>\r\n\t\t\t\t\t\t<ui:toolbarbutton id=\"indexbutton\" rel=\"developermode\" label=\"Index\" image=\"${icon:alphbeticindex}\" image-disabled=\"${icon:alphbeticindex-disabled}\" tooltip=\"Alphabetic index\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n\t\t\t</ui:toolbar>\r\n\t\t</ui:page>\r\n\t\t\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/log/log.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" Inherits=\"Composite_content_views_log_log\" CodeFile=\"log.aspx.cs\" %>\r\n<%@ Register TagPrefix=\"aspui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.ServerLog</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" updateManagerDisabled=\"True\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"log.css.aspx\" />\r\n\t\t<script type=\"text/javascript\">\r\n\t\t    DocumentManager.isDocumentSelectable = true;\r\n\t\t</script>\r\n        <% if(IsBrowserView) { %>\r\n            <style>\r\n                #toolbar { display: none; }\r\n            </style>\r\n        <% } %>\r\n\t</head>\r\n\t<body>\r\n\t\t<form id=\"Form1\" runat=\"server\">\r\n\t\t\t<ui:page label=\"${string:ServerLog.LabelTitle}\" image=\"${icon:log-viewlog}\">\r\n\t\t\t\t<ui:toolbar id=\"toolbar\">\r\n\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t<aspui:Selector runat=\"server\" ID=\"Pager\" AutoPostBack=\"true\" OnSelectedIndexChanged=\"LogContentChanged\" />\r\n\t\t\t\t\t\t\t<aspui:ToolbarButton ID=\"DeleteOlderButton\" AutoPostBack=\"true\" Text=\"${string:ServerLog.LabelButtonDeleteOld}\" ImageUrl=\"${icon:package-installer-uninstall}\" runat=\"server\" OnClick=\"DeleteOldButton_Click\" />\r\n\t\t\t\t\t\t\t<aspui:ToolbarButton AutoPostBack=\"true\" Text=\"${string:ServerLog.LabelButtonRefresh}\" ImageUrl=\"${icon:refresh}\" runat=\"server\" OnClick=\"LogContentChanged\" />\r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t    \r\n                            <div class=\"pull-left\">\r\n                                <aspui:CheckBox runat=\"server\" ItemLabel=\"${string:ServerLog.Severity.Critical}\" ID=\"chkCritical\" Checked=\"True\" AutoPostBack=\"true\" />\r\n                            </div>\r\n                            <div class=\"pull-left\">\r\n                                <aspui:CheckBox runat=\"server\" ItemLabel=\"${string:ServerLog.Severity.Error}\" ID=\"chkError\" Checked=\"True\" AutoPostBack=\"true\" />\r\n                            </div>\r\n                            <div class=\"pull-left\">\r\n                                <aspui:CheckBox runat=\"server\" ItemLabel=\"${string:ServerLog.Severity.Warning}\" ID=\"chkWarning\" Checked=\"True\" AutoPostBack=\"true\" />\r\n                            </div>\r\n                            <div class=\"pull-left\">\r\n                                <aspui:CheckBox runat=\"server\" ItemLabel=\"${string:ServerLog.Severity.Information}\" ID=\"chkInformation\" Checked=\"True\" AutoPostBack=\"true\" />\r\n                            </div>\r\n                            <div class=\"pull-left\">\r\n                                <aspui:CheckBox runat=\"server\" ItemLabel=\"${string:ServerLog.Severity.Verbose}\" ID=\"chkVerbose\" Checked=\"False\" AutoPostBack=\"true\" />\r\n                            </div>\r\n                            \r\n\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t</ui:toolbar>\r\n\t\t\t\t<ui:scrollbox id=\"scrollbox\">\r\n\t\t\t\t\t<asp:PlaceHolder  runat=\"server\" ID=\"LogHolder\" />\r\n\t\t\t\t\t<asp:PlaceHolder runat=\"server\" ID=\"EmptyLabelPlaheHolder\" Visible=\"false\">\r\n\t\t\t\t\t\t<div id=\"emptylabel\"><ui:text label=\"${string:ServerLog.EmptyLabel}\"/></div>\r\n\t\t\t\t\t</asp:PlaceHolder>\r\n                    <asp:PlaceHolder runat=\"server\" ID=\"LogEntriesRemovedPlaceHolder\">\r\n                        <div id=\"logentriesremovedlabel\"><asp:Label runat=\"server\" ID=\"LogEntriesRemovedLabel\" /></div>\r\n                    </asp:PlaceHolder>\r\n\t\t\t\t</ui:scrollbox>\r\n\t\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/log/log.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Web.UI;\r\nusing System.Xml.Linq;\r\nusing System.Diagnostics;\r\nusing System.Linq;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\npublic partial class Composite_content_views_log_log : System.Web.UI.Page\r\n{\r\n    private const string DateTimeFormat = \"yyyy-MM-dd\";\r\n\r\n    private const string View_DateTimeFormat = \"yyyy-MM-dd HH:mm:ss.ff\";\r\n    \r\n\r\n    private string SelectedDateStr\r\n    {\r\n        get { return Request.Form[\"Pager\"]; }\r\n    }\r\n\r\n    protected bool IsBrowserView\r\n    {\r\n        get { return Request.QueryString[\"browserView\"] == \"true\"; }\r\n    }\r\n\r\n    protected int MaxEntriesToShow\r\n    {\r\n        get\r\n        {\r\n            return IsBrowserView ? 1000 : 10000;\r\n        }\r\n    }\r\n\r\n    private bool _allLogsHaveBeenDeleted;\r\n\r\n    protected void Page_PreRender(object sender, EventArgs e)\r\n    {\r\n        bool includeVerbose = chkVerbose.Checked;\r\n        bool includeInformation = chkInformation.Checked;\r\n        bool includeWarning = chkWarning.Checked;\r\n        bool includeError = chkError.Checked;\r\n        bool includeCritical = chkCritical.Checked;\r\n\r\n        var dates = LogManager.GetLoggingDates().OrderByDescending(date => date).ToArray();\r\n\r\n        this.Pager.Items.Clear();\r\n        foreach (var date in dates)\r\n        {\r\n            this.Pager.Items.Add(date.ToString(DateTimeFormat));\r\n        }\r\n\r\n        DateTime selectedDate = DateTime.Now.Date;\r\n\r\n        string selectDateStr = SelectedDateStr;\r\n        if(!_allLogsHaveBeenDeleted && !string.IsNullOrEmpty(SelectedDateStr) && this.Pager.Items.FindByText(SelectedDateStr) != null)\r\n        {\r\n            selectedDate = DateTime.ParseExact(selectDateStr, DateTimeFormat, CultureInfo.InvariantCulture);\r\n\r\n            this.Pager.SelectedValue = SelectedDateStr;\r\n        }\r\n        else\r\n        {\r\n            selectedDate = DateTime.Now;\r\n        }\r\n\r\n        selectedDate = selectedDate.Date;\r\n\r\n        var logEntries = new List<LogEntry>();\r\n\r\n        DateTime fromDate = selectedDate;\r\n\r\n        const int bulkSize = 5000;\r\n        bool logEntriesRemoved = false;\r\n        int totalExistingLogEntries = 0;\r\n\r\n        while (true)\r\n        {\r\n            LogEntry[] entriesPart = LogManager.GetLogEntries(fromDate, selectedDate.AddDays(1.0), includeVerbose, bulkSize);\r\n\r\n            logEntries.AddRange(entriesPart.Where(entry => (includeVerbose && entry.Severity == \"Verbose\")\r\n                                                          || (includeInformation && entry.Severity == \"Information\")\r\n                                                          || (includeWarning && entry.Severity == \"Warning\")\r\n                                                          || (includeError && entry.Severity == \"Error\")\r\n                                                          || (includeCritical && entry.Severity == \"Critical\")));\r\n\r\n            totalExistingLogEntries += logEntries.Count;\r\n\r\n            if (logEntries.Count > MaxEntriesToShow)\r\n            {\r\n                logEntries.RemoveRange(0, logEntries.Count - MaxEntriesToShow);\r\n                logEntriesRemoved = true;\r\n            }\r\n\r\n            if (entriesPart.Length < bulkSize)\r\n            {\r\n                break;\r\n            }\r\n\r\n            fromDate = entriesPart[entriesPart.Length - 1].TimeStamp.AddMilliseconds(0.5);\r\n        }\r\n\r\n        if (logEntriesRemoved) \r\n        {\r\n            string label = StringResourceSystemFacade.GetString(\"Composite.Management\", IsBrowserView ? \"ServerLog.LogEntriesRemovedBrowserViewLabel\" : \"ServerLog.LogEntriesRemovedLabel\"); \r\n            LogEntriesRemovedLabel.Text = String.Format(label, this.MaxEntriesToShow, totalExistingLogEntries);\r\n            LogEntriesRemovedPlaceHolder.Visible = true;\r\n        }\r\n        else\r\n        {\r\n            LogEntriesRemovedPlaceHolder.Visible = false;\r\n        }\r\n\r\n        if (logEntries.Count > 0)\r\n        {\r\n            BuildLogTable(logEntries);\r\n            \r\n            EmptyLabelPlaheHolder.Visible = false;\r\n        }\r\n        else\r\n        {\r\n            EmptyLabelPlaheHolder.Visible = true;\r\n        }\r\n\r\n        DeleteOlderButton.Enabled = dates.Count() > 1;\r\n    }\r\n\r\n\r\n    private void BuildLogTable(IEnumerable<LogEntry> entries)\r\n    {\r\n        XElement table = new XElement(\"table\");\r\n\r\n        XElement tableHeader = new XElement(\"tr\");\r\n        tableHeader.Add(\r\n                new XElement(\"th\", \" \"),\r\n                new XElement(\"th\", StringResourceSystemFacade.GetString(\"Composite.Management\",\"ServerLog.LogEntry.DateLabel\")),\r\n                new XElement(\"th\", StringResourceSystemFacade.GetString(\"Composite.Management\",\"ServerLog.LogEntry.MessageLabel\")),\r\n                new XElement(\"th\", StringResourceSystemFacade.GetString(\"Composite.Management\",\"ServerLog.LogEntry.TitleLabel\")),\r\n                new XElement(\"th\", StringResourceSystemFacade.GetString(\"Composite.Management\",\"ServerLog.LogEntry.EventTypeLabel\"))\r\n            );\r\n\r\n        table.Add(tableHeader);\r\n\r\n        int index = 0;\r\n        foreach (LogEntry logEntry in entries.Reverse())\r\n        {\r\n            TraceEventType eventType;\r\n\r\n            try\r\n            {\r\n                eventType = (TraceEventType)Enum.Parse(typeof(TraceEventType), logEntry.Severity);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                eventType = TraceEventType.Information;\r\n            }\r\n\r\n            \r\n            var colors = new []\r\n                               {\r\n                                   new Tuple<TraceEventType, string>(TraceEventType.Information, \"lime\"),\r\n                                   new Tuple<TraceEventType, string>(TraceEventType.Verbose, \"white\"),\r\n                                   new Tuple<TraceEventType, string>(TraceEventType.Warning, \"orange\"),\r\n                                   new Tuple<TraceEventType, string>(TraceEventType.Error, \"red\"),\r\n                                   new Tuple<TraceEventType, string>(TraceEventType.Critical, \"darkred\")\r\n                               };\r\n\r\n            string colorName = colors.Where(c => c.Item1 == eventType).Select(c => c.Item2).FirstOrDefault() ?? \"orange\";\r\n\r\n            XAttribute color = new XAttribute(\"bgcolor\", colorName);\r\n\r\n\r\n            XElement row = new XElement(\"tr\");\r\n            row.Add(\r\n                new XElement(\"td\", color, \" \"),\r\n                new XElement(\"td\", logEntry.TimeStamp.ToString(View_DateTimeFormat)),\r\n                new XElement(\"td\", MessageMarkup(logEntry, index++)),\r\n                new XElement(\"td\", EncodeXml10InvalidCharacters(logEntry.Title)),\r\n                new XElement(\"td\", logEntry.Severity)\r\n            );\r\n\r\n            table.Add(row);\r\n        }\r\n\r\n        LogHolder.Controls.Add(new LiteralControl(table.ToString()));\r\n    }\r\n\r\n    public object[] MessageMarkup(LogEntry logEntry, int index)\r\n    {\r\n        if (!logEntry.Message.Contains(\"\\n\"))\r\n        {\r\n            string encodedMessage = EncodeXml10InvalidCharacters(logEntry.Message);\r\n            return new object[] { encodedMessage };\r\n        }\r\n\r\n        string[] lines = EncodeXml10InvalidCharacters(logEntry.Message).Trim().Split('\\n');\r\n\r\n        if (lines.Length < 7)\r\n        {\r\n            return new object[]\r\n            {\r\n                new XElement(\"pre\", EncodeXml10InvalidCharacters(logEntry.Message.Replace(\"\\n\", \"\")))\r\n            };\r\n        }\r\n\r\n        return new object[]\r\n        {\r\n            PreTag(lines, 0, 2),\r\n            new XElement(\"a\", \r\n                new XAttribute(\"id\", \"a\" + index),\r\n                new XAttribute(\"href\", \"#\"),\r\n                new XAttribute(\"onclick\", string.Format(\"document.getElementById('log{0}').style.display = 'block';document.getElementById('a{0}').style.display = 'none'\", index)),\r\n                new XAttribute(\"class\", \"expandCode\"),\r\n                \". . .\"),\r\n            PreTag(lines, 2, lines.Length - 4, \r\n                new XAttribute(\"id\", \"log\" + index),\r\n                new XAttribute(\"style\", \"display:none;\")),\r\n            PreTag(lines, lines.Length - 2, 2)\r\n        };\r\n    }\r\n\r\n    private XElement PreTag(string[] lines, int startIndex, int count, params object[] content)\r\n    {\r\n        var text = string.Join(\"\\n\", lines.Skip(startIndex).Take(count));\r\n        var result = new XElement(\"pre\", text);\r\n        if (content != null)\r\n        {\r\n            result.Add(content);\r\n        }\r\n\r\n        return result;\r\n    }\r\n\r\n\r\n    private string EncodeXml10InvalidCharacters(string text)\r\n    {\r\n        // We double encoding charaters 00h -> 1Fh except spaces so the encoded version will be shown.\r\n        for (int i = 0; i < 32; i++) {\r\n            if(i == 8 || i == 10 || i == 13) continue;\r\n\r\n            char ch = (char) i;\r\n\r\n            if(text.Contains(ch))\r\n            {\r\n                text = text.Replace(new string(ch, 1), \"&#\" + (i/16) + \"0123456789ABCDEF\"[i % 16] + \";\");\r\n            }\r\n        }\r\n\r\n        return text;\r\n    }\r\n\r\n    protected void LogContentChanged(Object sender, EventArgs e)\r\n    {\r\n    }\r\n\r\n\r\n\r\n    protected void DeleteOldButton_Click(Object sender, EventArgs e)\r\n    {\r\n        DateTime[] dates = LogManager.GetLoggingDates();\r\n\r\n        DateTime today = DateTime.Now.Date;\r\n\r\n        foreach(var date in dates)\r\n        {\r\n            if(date.Date != today)\r\n            {\r\n                LogManager.DeleteLogFile(date);\r\n            }\r\n        }\r\n        \r\n        this.DeleteOlderButton.Enabled = false;\r\n\r\n        _allLogsHaveBeenDeleted = true;\r\n    }\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/log/log.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_content_views_log_log {\r\n    \r\n    /// <summary>\r\n    /// Form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm Form1;\r\n    \r\n    /// <summary>\r\n    /// Pager control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Selector Pager;\r\n    \r\n    /// <summary>\r\n    /// DeleteOlderButton control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.ToolbarButton DeleteOlderButton;\r\n    \r\n    /// <summary>\r\n    /// chkCritical control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkCritical;\r\n    \r\n    /// <summary>\r\n    /// chkError control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkError;\r\n    \r\n    /// <summary>\r\n    /// chkWarning control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkWarning;\r\n    \r\n    /// <summary>\r\n    /// chkInformation control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkInformation;\r\n    \r\n    /// <summary>\r\n    /// chkVerbose control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkVerbose;\r\n    \r\n    /// <summary>\r\n    /// LogHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder LogHolder;\r\n    \r\n    /// <summary>\r\n    /// EmptyLabelPlaheHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder EmptyLabelPlaheHolder;\r\n\r\n    protected global::System.Web.UI.WebControls.PlaceHolder LogEntriesRemovedPlaceHolder;\r\n    protected global::System.Web.UI.WebControls.Label LogEntriesRemovedLabel;\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/log/log.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|selector {\r\n    margin-right: 10px;\r\n}\r\n\r\nui|selector ui|clickbutton ui|labelbox {\r\n    width: 140px;\r\n    height: 31px;\r\n}\r\n\r\nui|checkbox {\r\n    padding-top: 7px;\r\n    \r\n}\r\n\r\nui|scrollbox#scrollbox {\r\n\tbackground-color: white !important;\r\n\toverflow: scroll !important;\r\n\theight: 100%;\r\n\twidth: 100%;\r\n}\r\nui|scrollbox#scrollbox table {\r\n\tborder-collapse: collapse;\r\n\twidth: 100%;\r\n}\r\nui|scrollbox#scrollbox td, th {\r\n\tpadding: 5px;\r\n\twhite-space: nowrap;\r\n}\r\nui|scrollbox#scrollbox td {\r\n\tborder: 1px solid #ddd;\r\n\tvertical-align: top;\r\n\tcursor: text;\r\n}\r\nui|scrollbox#scrollbox th {\r\n\ttext-align: left;\r\n\tfont-weight: bold;\r\n\tbackground-color: #eeeeee;\r\n}\r\npre \r\n{\r\n\tpadding: 0;\r\n\tmargin: 0;\r\n\tcursor: text;\r\n}\r\n\r\ndiv#emptylabel {\r\n\tpadding: 1em;\r\n\tborder-top: 1px solid #ddd;\r\n}\r\n\r\ndiv#logentriesremovedlabel {\r\n\tpadding: 1em;\r\n\tborder-top: 1px solid #ddd;\r\n}\r\n\r\n#toolbar datalabeltext {\r\n    width: auto;\r\n    margin-right: 15px;\r\n}\r\n\r\n#toolbar checkbutton {\r\n    margin-top: 1px;\r\n}\r\n\r\n            \r\na.expandCode {\r\n    display: block;\r\n    width: 200px;\r\n    font-weight: bold;\r\n    text-align: center; \r\n    border: 1px solid #ddd;\r\n    color: #ddd;\r\n    margin-left: 20px;\r\n}            \r\n\r\na.expandCode:hover {\r\n    background-color: #EEE;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/publishworkflowstatus/ViewUnpublishedItems.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"ViewUnpublishedItems.aspx.cs\" Inherits=\"ViewUnpublishedItems\" %>\r\n<%@ Import Namespace=\"Composite.Data.Types\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\t<control:styleloader runat=\"server\" />\r\n\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t<title><%= Request[\"title\"] %></title>\r\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"ViewUnpublishedItems.css.aspx\" />\r\n\t<script type=\"text/javascript\" src=\"bindings/UnpublishedPageBinding.js\"></script>\r\n\t<script type=\"text/javascript\" src=\"bindings/SortButtonBinding.js\"></script>\r\n</head>\r\n<body>\r\n\t<ui:page label=\"${string:Composite.Plugins.PageElementProvider:PageElementProvider.ViewUnpublishedItems-document-title}\"\r\n\t\ttooltip=\"${string:Composite.Plugins.PageElementProvider:PageElementProvider.ViewUnpublishedItems-document-description}\"\r\n\t\timage=\"${icon:page-list-unpublished-items}\" id=\"page\" binding=\"UnpublishedPageBinding\"\r\n\t\tshowpagedata=\"<%=Request[\"showpagedata\"] %>\" showglobaldata=\"<%=Request[\"showglobaldata\"]%>\">\r\n\t\t<ui:toolbar id=\"toolbar\">\r\n\t\t\t<ui:toolbarbody>\r\n\t\t\t\t<ui:toolbargroup id=\"actiongroup\">\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>\r\n\t\t<ui:scrollbox>\r\n\t\t\t<table class=\"table\">\r\n\t\t\t\t<thead>\r\n\t\t\t\t\t<tr class=\"head\">\r\n\t\t\t\t\t\t<th>\r\n\t\t\t\t\t\t\t<ui:checkbox id=\"checkallbox\" oncommand=\"this.dispatchAction(UnpublishedPageBinding.ACTION_CHECK_ALL)\" />\r\n\t\t\t\t\t\t</th>\r\n\t\t\t\t\t\t<th><ui:clickbutton label=\"${string:Composite.Plugins.PageElementProvider:ViewUnpublishedItems.PageTitleLabel}\" binding=\"SortButtonBinding\"/></th>\r\n\t\t\t\t\t\t<% if (VersionedDataHelper.IsThereAnyVersioningServices)\r\n\t\t\t\t\t\t   { %>\r\n                        <th class=\"version\"><ui:clickbutton label=\"${string:Composite.Plugins.PageElementProvider:ViewUnpublishedItems.VersionLabel}\" binding=\"SortButtonBinding\" /></th>\r\n\t\t\t\t\t\t<% } %>\r\n                        <th><ui:clickbutton label=\"${string:Composite.Plugins.PageElementProvider:ViewUnpublishedItems.StatusLabel}\" binding=\"SortButtonBinding\" /></th>\r\n                        <th><ui:clickbutton label=\"${string:Composite.Plugins.PageElementProvider:ViewUnpublishedItems.LabelChangedBy}\" binding=\"SortButtonBinding\" /></th>\r\n\t\t\t\t\t\t<asp:Repeater runat=\"server\" ID=\"headerRepeater\">\r\n                            <ItemTemplate>\r\n                                <th>\r\n                                    <ui:clickbutton label=\"<%# (Container.DataItem as VersionedExtraPropertiesColumnInfo).ColumnName %>\" binding=\"SortButtonBinding\" />\r\n\t\t\t\t\t\t\t        <ui:fieldhelp label=\"<%# (Container.DataItem as VersionedExtraPropertiesColumnInfo).ColumnTooltip %>\"/>\r\n                                    \r\n                                </th>\r\n                            </ItemTemplate>\r\n                        </asp:Repeater>\r\n\t\t\t\t\t\t<th><ui:clickbutton label=\"${string:Composite.Plugins.PageElementProvider:ViewUnpublishedItems.DateCreatedLabel}\" binding=\"SortButtonBinding\" /></th>\r\n\t\t\t\t\t\t<th><ui:clickbutton label=\"${string:Composite.Plugins.PageElementProvider:ViewUnpublishedItems.DateModifiedLabel}\" binding=\"SortButtonBinding\" /></th>\r\n\t\t\t\t\t\t<th></th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</thead>\r\n\t\t\t\t<tbody id=\"tablebody\" binding=\"Binding\">\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t</ui:scrollbox>\r\n\t</ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/publishworkflowstatus/ViewUnpublishedItems.aspx.cs",
    "content": "﻿using System;\r\nusing Composite.Data.Types;\r\n\r\npublic partial class ViewUnpublishedItems : System.Web.UI.Page\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        if (!this.IsPostBack)\r\n        {\r\n            headerRepeater.DataSource = VersionedDataHelper.GetExtraPropertyNames();\r\n            headerRepeater.DataBind();\r\n        }\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/publishworkflowstatus/ViewUnpublishedItems.css",
    "content": "﻿@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\na {\r\n\tcursor: pointer;\r\n}\r\n\r\n.table td, .table th {\r\n\tfont-family: Calibri, Candara, Segoe, 'Segoe UI', Optima, Arial, sans-serif;\r\n\tfont-size: 15px;\r\n}\r\n\r\n.table thead th:last-child {\r\n\twidth: 100%;\r\n}\r\n\r\n.table ui|fieldhelp {\r\n\tfloat: left;\r\n\twidth: 20px;\r\n\tmargin-top: -4px;\r\n\tmargin-left: -20px;\r\n}\r\n\r\n.table ui|clickbutton.sortbutton {\r\n\tmargin: 0 54px 0 0;\r\n\tcursor: pointer;\r\n}\r\n.table ui|clickbutton.sortbutton * {\r\n\tcursor: pointer;\r\n}\r\n\r\n.table ui|clickbutton.sortbutton ui|labelbox {\r\n\tborder: inherit;\r\n\tcolor: inherit;\r\n\tbackground: inherit;\r\n\ttext-transform: inherit;\r\n\tpadding: inherit;\r\n\tcursor: pointer;\r\n}\r\n\r\n.table ui|clickbutton.sortbutton.hover ui|labelbox {\r\n\tcolor: #22B980;\r\n}\r\n\r\n.table ui|clickbutton.sortbutton[direction='asc']:after,\r\n.table ui|clickbutton.sortbutton[direction='desc']:after {\r\n\tposition: absolute;\r\n\tcontent: \"\";\r\n\twidth: 0;\r\n\theight: 0;\r\n\tright: -20px;\r\n\ttop: 7px;\r\n\tborder-style: solid;\r\n\tborder-width: 0 4px 4px 4px;\r\n\tborder-color: transparent transparent #989898 transparent;\r\n}\r\n\r\n.table ui|clickbutton.sortbutton[direction='desc']:after {\r\n\tborder-width: 4px 4px 0 4px;\r\n\tborder-color: #989898 transparent transparent transparent;\r\n}\r\n\r\n.table td.date {\r\n\tpadding: 0 13px 0 0 !important;\r\n}\r\n.table td.date span{\r\n\tdisplay: block;\r\n\tbackground: #EFEFEF;\r\n\tmargin: 9px 9px 9px 10px;\r\n\tpadding: 6px 6px 7px 10px;\r\n\tborder-radius: 5px;\r\n\tmin-width: 190px;\r\n}\r\n\r\nui|toolbarbutton[image='item-publish'] {\r\n\tborder-color: #22B980;\r\n}\r\n\r\nui|toolbarbutton[image='item-publish'] ui|labelbox {\r\n\tborder-color: #22B980;\r\n\tbackground-color: #22B980;\r\n\tbackground-image: linear-gradient(to bottom, #22B980 0%, #1ea371 100%);\r\n\tcolor: #fff;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/publishworkflowstatus/ViewUnpublishedItems.xslt",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t\r\n\t<xsl:template match=\"/\">\r\n\t\t<ui:tree focusable=\"false\">\r\n\t\t\t<ui:treebody>\r\n\t\t\t\t<xsl:if test=\"ActionItems/Page\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"ActionItems/Page\"/>\r\n\t\t\t\t</xsl:if>\r\n\t\t\t\t<xsl:if test=\"ActionItems/DataTypes/DataType\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"ActionItems/DataTypes/DataType\"/>\r\n\t\t\t\t</xsl:if>\r\n\t\t\t</ui:treebody>\r\n\t\t</ui:tree>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"Page\">\r\n\t\t<ui:treenode open=\"true\">\r\n\t\t\t<xsl:variable name=\"iconname\">\r\n\t\t\t\t<xsl:choose>\r\n\t\t\t\t\t<xsl:when test=\"@Status='published'\">page</xsl:when>\r\n\t\t\t\t\t<xsl:when test=\"@Status='awaitingApproval'\">page-awaiting-approval</xsl:when>\r\n\t\t\t\t\t<xsl:when test=\"@Status='awaitingPublication'\">page-awaiting-publication</xsl:when>\r\n\t\t\t\t\t<xsl:when test=\"@Status='draft'\">page-draft</xsl:when>\r\n\t\t\t\t</xsl:choose>\r\n\t\t\t</xsl:variable>\r\n\t\t\t<xsl:attribute name=\"label\">\r\n\t\t\t\t<xsl:value-of select=\"@Title\"/>\r\n\t\t\t</xsl:attribute>\r\n\t\t\t<xsl:attribute name=\"image\">\r\n\t\t\t\t<xsl:text>${icon:</xsl:text>\r\n\t\t\t\t<xsl:value-of select=\"$iconname\"/>\r\n\t\t\t\t<xsl:text>}</xsl:text>\r\n\t\t\t</xsl:attribute>\r\n\t\t\t<xsl:attribute name=\"tooltip\">\r\n\t\t\t\t<xsl:value-of select=\"@changedate\"/>\r\n\t\t\t</xsl:attribute>\r\n\t\t\t<xsl:if test=\"PageFolder\">\r\n\t\t\t\t<xsl:apply-templates select=\"PageFolder\"/>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:if test=\"Page\">\r\n\t\t\t\t<xsl:apply-templates select=\"Page\"/>\r\n\t\t\t</xsl:if>\r\n\t\t</ui:treenode>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"PageFolder|DataType\">\r\n\t\t<ui:treenode open=\"true\" label=\"{@Title}\">\r\n\t\t\t<xsl:attribute name=\"image\">${icon:data-interface-open}</xsl:attribute>\r\n\t\t\t<xsl:if test=\"DataItem\">\r\n\t\t\t\t<xsl:apply-templates select=\"DataItem\"/>\r\n\t\t\t</xsl:if>\r\n\t\t</ui:treenode>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"DataItem\">\r\n\t\t<xsl:variable name=\"iconname\">\r\n\t\t\t<xsl:choose>\r\n\t\t\t\t<xsl:when test=\"@Status='published'\">generated-type-data-published</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@Status='awaitingApproval'\">generated-type-data-awaiting-approval</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@Status='awaitingPublication'\">generated-type-data-awaiting-publication</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@Status='draft'\">generated-type-data-draft</xsl:when>\r\n\t\t\t</xsl:choose>\r\n\t\t</xsl:variable>\r\n\t\t<ui:treenode open=\"true\" label=\"{@Title}\">\r\n\t\t\t<xsl:attribute name=\"image\">\r\n\t\t\t\t<xsl:text>${icon:</xsl:text>\r\n\t\t\t\t<xsl:value-of select=\"$iconname\"/>\r\n\t\t\t\t<xsl:text>}</xsl:text>\r\n\t\t\t</xsl:attribute>\r\n\t\t</ui:treenode>\r\n\t</xsl:template>\r\n\t\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/content/views/publishworkflowstatus/bindings/SortButtonBinding.js",
    "content": "﻿SortButtonBinding.prototype = new ButtonBinding;\nSortButtonBinding.prototype.constructor = SortButtonBinding;\nSortButtonBinding.superclass = ButtonBinding.prototype;\n\nSortButtonBinding.DIRECTION_ASC = \"asc\";\nSortButtonBinding.DIRECTION_DESC = \"desc\";\n\n\n\nSortButtonBinding.ascDirection = function (a, b) {\n\n\tif (a.sortvalue > b.sortvalue) {\n\t\treturn 1;\n\t}\n\tif (a.sortvalue < b.sortvalue) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\n\nSortButtonBinding.descDirection = function (a, b) {\n\n\tif (a.sortvalue < b.sortvalue) {\n\t\treturn 1;\n\t}\n\tif (a.sortvalue > b.sortvalue) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\n/**\n * @class\n */\nfunction SortButtonBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"SortButtonBinding\");\n\n\tthis.table = null;\n\n\tthis.tablebody = null;\n}\n\n/**\n * Identifies binding.\n */\nSortButtonBinding.prototype.toString = function () {\n\n\treturn \"[SortButtonBinding]\";\n}\n\n/**\n * Overloads {ButtonBinding#onBindingRegister}\n */\nSortButtonBinding.prototype.onBindingRegister = function () {\n\n\tSortButtonBinding.superclass.onBindingRegister.call(this);\n\n\tthis.table = DOMUtil.getAncestorByLocalName(\"table\", this.bindingElement);\n\tthis.tablebody = this.table.querySelector(\"tbody\");\n\n\tthis.attachClassName(\"sortbutton\");\n}\n\n/**\n * Overloads {ButtonBinding#fireCommand}\n */\nSortButtonBinding.prototype.fireCommand = function () {\n\n\tvar direction = this.getProperty(\"direction\") === SortButtonBinding.DIRECTION_ASC ? SortButtonBinding.DIRECTION_DESC : SortButtonBinding.DIRECTION_ASC;\n\tnew List(this.table.querySelectorAll(\".sortbutton[direction]\")).each(function (sortbutton) {\n\t\tsortbutton.removeAttribute(\"direction\");\n\t});\n\n\tthis.sort(direction);\n}\n\nSortButtonBinding.prototype.getDirection = function() {\n\n\treturn this.getProperty(\"direction\");\n}\n\nSortButtonBinding.prototype.sort = function (direction) {\n\n\tthis.setProperty(\"direction\", direction);\n\n\tvar cell = DOMUtil.getAncestorByLocalName(\"th\", this.bindingElement);\n\tvar cellIndex = cell.cellIndex;\n\n\tvar items = [];\n\n\tnew List(this.tablebody.querySelectorAll(\"tr\")).each(function (row) {\n\t\tvar sortcell = row.querySelector(\"td:nth-of-type(\" + (cellIndex + 1) + \")\");\n\t\tvar sortvalue = this.getSortValue(sortcell);\n\t\titems.push({ row: row, sortvalue: sortvalue });\n\t}, this);\n\n\titems.sort(direction === SortButtonBinding.DIRECTION_ASC ? SortButtonBinding.ascDirection : SortButtonBinding.descDirection);\n\n\tnew List(items).each(function (item) {\n\t\tthis.tablebody.appendChild(item.row);\n\t}, this);\n\n\t/*\n\t * Force new indexation of focusable elements.\n\t */\n\tthis.dispatchAction(FocusBinding.ACTION_UPDATE);\n}\n\nSortButtonBinding.prototype.getSortValue = function (cell) {\n\n\tif (cell == null) {\n\t\treturn undefined;\n\t}\n\tif (cell.hasAttribute(\"data-sort-value\")) {\n\t\treturn cell.getAttribute(\"data-sort-value\");\n\t}\n\treturn cell.textContent;\n}"
  },
  {
    "path": "Website/Composite/content/views/publishworkflowstatus/bindings/UnpublishedPageBinding.js",
    "content": "﻿UnpublishedPageBinding.prototype = new PageBinding;\nUnpublishedPageBinding.prototype.constructor = UnpublishedPageBinding;\nUnpublishedPageBinding.superclass = PageBinding.prototype;\n\nUnpublishedPageBinding.ACTION_CHECK_ALL = \"unpublished check all\";\n\nUnpublishedPageBinding.SELECTED_CLASSNAME = \"selected\";\nUnpublishedPageBinding.NOVERSION_CLASSNAME = \"noversion\";\n\nUnpublishedPageBinding.BULK_PUBLISHING_COMMANDS = \"BulkPublishingCommands\";\n\n/**\n * @class\n */\nfunction UnpublishedPageBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"UnpublishedPageBinding\");\n\n\n\tthis.table = null;\n\n\tthis.tablebody = null;\n\n\tthis.actionGroup = null;\n\n\tthis.containingViewBinding = null;\n\n\tthis.isSelectedTab = false;\n\n\tthis.isRequireRefresh = false;\n\n\t/*\n\t * Returnable.\n\t */\n\treturn this;\n}\n\n/**\n * Identifies binding.\n */\nUnpublishedPageBinding.prototype.toString = function () {\n\n\treturn \"[UnpublishedPageBinding]\";\n}\n\n/**\n * Note that the binding is *invisible* when created!\n * @see {UnpublishedPageBinding#newInstance}\n * @overloads {Binding#onBindintAttach}\n */\nUnpublishedPageBinding.prototype.onBindingAttach = function () {\n\n\tUnpublishedPageBinding.superclass.onBindingAttach.call(this);\n\n\tthis.addActionListener(CheckBoxBinding.ACTION_COMMAND);\n\tthis.addActionListener(ButtonBinding.ACTION_COMMAND);\n\tthis.addActionListener(UnpublishedPageBinding.ACTION_CHECK_ALL);\n\n\tthis.addEventListener(DOMEvents.DOUBLECLICK);\n\n\tthis.subscribe(BroadcastMessages.DOCKTABBINDING_SELECT);\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESH);\n\n\tthis.tablebody = this.bindingWindow.bindingMap.tablebody;\n\tthis.table = DOMUtil.getAncestorByLocalName(\"table\", this.tablebody.bindingElement);\n\tthis.table.style.display = \"none\";\n\n\tthis.actionGroup = this.bindingWindow.bindingMap.actiongroup;\n\n\tthis.containingViewBinding = this.getAncestorBindingByType(ViewBinding, true);\n\tthis.isSelectedTab = true;\n}\n\nUnpublishedPageBinding.prototype.renderActions = function (nodes) {\n\n\tthis.actionGroup.empty();\n\n\tvar actions = new Map();\n\tnodes.each(function (node) {\n\t\tthis.getWorkflowActions(node).each(function (action) {\n\t\t\tif (!actions.has(action.getHandle())) {\n\t\t\t\tactions.set(action.getHandle(), action);\n\t\t\t}\n\t\t});\n\n\t}, this);\n\n\tactions.each(function (key, action) {\n\n\t\tvar buttonBinding = SystemToolBarBinding.prototype.getToolBarButtonBinding.call(this, action);\n\t\tbuttonBinding.disable();\n\t\tthis.actionGroup.add(buttonBinding);\n\t}, this);\n\n\tthis.actionGroup.attachRecursive();\n}\n\n\nUnpublishedPageBinding.prototype.updateActions = function () {\n\n\tvar actionButtons = this.actionGroup.getDescendantBindingsByType(ToolBarButtonBinding);\n\tvar selected = this.getSelectedCheckboxes();\n\tvar requiredActionKeys = new Map();\n\n\tselected.each(function (check) {\n\t\tvar node = check.associatedNode;\n\t\tthis.getAllowedActionKeys(node).each(function (key) {\n\t\t\trequiredActionKeys.set(key, requiredActionKeys.has(key) ? requiredActionKeys.get(key) + 1 : 1);\n\t\t}, this);\n\t}, this);\n\n\tactionButtons.each(function (actionButton) {\n\t\tvar action = actionButton.associatedSystemAction;\n\t\tif (action) {\n\t\t\tvar key = action.getHandle();\n\t\t\tif (requiredActionKeys.has(key) && requiredActionKeys.get(key) === selected.getLength()) {\n\t\t\t\tactionButton.enable();\n\t\t\t} else {\n\t\t\t\tactionButton.disable();\n\t\t\t}\n\t\t}\n\t}, this);\n}\n\nUnpublishedPageBinding.prototype.renderTable = function (nodes, selected) {\n\n\twhile (this.tablebody.bindingElement.firstChild) {\n\t\tthis.tablebody.bindingElement.removeChild(this.tablebody.bindingElement.firstChild);\n\t}\n\n\tvar hasVersion = false;\n\tnodes.each(function(node) {\n\t\tif (node.getPropertyBag().Version != undefined) {\n\t\t\thasVersion = true;\n\t\t}\n\t\treturn hasVersion;\n\t}, this);\n\n\tif (hasVersion) {\n\t\tCSSUtil.detachClassName(this.table, UnpublishedPageBinding.NOVERSION_CLASSNAME);\n\t} else {\n\t\tCSSUtil.attachClassName(this.table, UnpublishedPageBinding.NOVERSION_CLASSNAME);\n\t}\n\tthis.table.style.display = \"\";\n\n\tnodes.each(function (node) {\n\t\tvar handle = node.getHandle();\n\t\tvar row = this.bindingDocument.createElement('tr');\n\t\tthis.tablebody.bindingElement.appendChild(row);\n\n\t\tvar cell = this.bindingDocument.createElement(\"td\");\n\t\tvar checkbox = CheckBoxBinding.newInstance(this.bindingDocument);\n\t\tif (selected.has(handle)) {\n\t\t\tcheckbox.check(true);\n\t\t\tCSSUtil.attachClassName(row, UnpublishedPageBinding.SELECTED_CLASSNAME);\n\t\t}\n\t\tcell.appendChild(checkbox.bindingElement);\n\t\tcheckbox.attach();\n\t\tcheckbox.associatedNode = node;\n\t\trow.appendChild(cell);\n\n\t\trow.setAttribute(\"entitytoken\", node.getEntityToken());\n\n\t\tvar linkcell = this.addTextCell(row);\n\t\tvar link = this.bindingDocument.createElement(\"a\");\n\t\tlink.appendChild(this.bindingDocument.createTextNode(node.getLabel()));\n\t\tlink.onclick = function (e) {\n\t\t\tDOMEvents.preventDefault(e);\n\t\t\tDOMEvents.stopPropagation(e);\n\t\t\tvar entityToken = row.getAttribute(\"entitytoken\");\n\t\t\tStageBinding.selectBrowserTab();\n\t\t\tEventBroadcaster.broadcast(\n\t\t\t\tBroadcastMessages.SYSTEMTREEBINDING_FOCUS,\n\t\t\t\tentityToken\n\t\t\t);\n\t\t}\n\t\tlinkcell.appendChild(link);\n\n\t\tvar headers = this.table.firstElementChild.firstElementChild.cells;\n\t\tvar propertybag = node.getPropertyBag();\n\n\t\tfor (var i = 2; i < headers.length; i++) {\r\n\t\t    var propertyName = headers[i].innerText.trim();\n\t\t    if (propertyName in propertybag) {\r\n\t\t        this.addTextCell(row, propertybag[propertyName]).\n                    setAttribute(\"data-sort-value\", ((propertyName + \"Sortable\") in propertybag) ?\n                    propertybag[propertyName + \"Sortable\"] :\n                    propertybag[propertyName]);\r\n\t\t    } else {\r\n\t\t        this.addTextCell(row, \"\");\r\n\t\t    }\r\n\t\t}\n\n\t}, this);\n\n\n\tvar sortButton = UserInterface.getBinding(this.table.querySelector(\".sortbutton[direction]\"));\n\tif(sortButton != null && sortButton instanceof SortButtonBinding){\n\t\tsortButton.sort(sortButton.getDirection());\n\t}\n}\n\nUnpublishedPageBinding.prototype.onAfterPageInitialize = function () {\r\n\r\n    UnpublishedPageBinding.superclass.onAfterPageInitialize.call(this);\r\n\r\n    this.refresh();\r\n}\n\nUnpublishedPageBinding.prototype.refresh = function () {\n\n\tthis.isRequireRefresh = false;\n\n\tTreeService.GetUnpublishedElements(true, (function (response) {\n\n\t\tvar selected = new List();\n\t\tthis.getSelectedCheckboxes().each(function(checkbox) {\n\t\t\tif (checkbox.associatedNode && checkbox.isChecked) {\n\t\t\t\tselected.add(checkbox.associatedNode.getHandle());\n\t\t\t}\n\t\t});\n\n\t\tvar nodes = new List();\n\t\tnew List(response).each(function (element) {\n\t\t\tvar newnode = new SystemNode(element);\n\t\t\tnodes.add(newnode);\n\t\t});\n\t\tthis.renderActions(nodes);\n\t\tthis.renderTable(nodes, selected);\n\t\tthis.updateActions();\n\t\tthis.updateCheckAllButton(true);\n\n\t}).bind(this));\n}\n\nUnpublishedPageBinding.prototype.getWorkflowActions = function (node) {\n\n\tvar result = new List();\n\tnode.getActionProfile().each(function (group, list) {\n\t\tlist.each(function (action) {\n\t\t\tif (action.getTag() === UnpublishedPageBinding.BULK_PUBLISHING_COMMANDS) {\n\t\t\t\tresult.add(action);\n\t\t\t}\n\t\t}, this);\n\t}, this);\n\treturn result;\n}\n\nUnpublishedPageBinding.prototype.getAllowedActionKeys = function (node) {\n\n\tvar result = new List();\n\tthis.getWorkflowActions(node).each(function (action) {\n\t\tif (!action.isDisabled()) {\n\t\t\tresult.add(action.getHandle());\n\t\t}\n\t}, this);\n\treturn result;\n}\n\nUnpublishedPageBinding.prototype.getSelectedCheckboxes = function() {\n\n\tvar selected = new List();\n\tthis.tablebody.getDescendantBindingsByType(CheckBoxBinding).each(function(checkbox) {\n\t\tif (checkbox.associatedNode && checkbox.isChecked) {\n\t\t\tselected.add(checkbox);\n\t\t}\n\t}, this);\n\treturn selected;\n}\n\nUnpublishedPageBinding.prototype.addTextCell = function (row, value, attributes) {\n\n\tvar cell = this.bindingDocument.createElement(\"td\");\n\tif (value != undefined) {\n\t\tvar span = this.bindingDocument.createElement(\"span\");\n\t\tspan.appendChild(this.bindingDocument.createTextNode(value));\n\t\tcell.appendChild(span);\n\t}\n\tif (attributes != undefined) {\n\t\tfor (var name in attributes) {\n\t\t\tcell.setAttribute(name, attributes[name]);\n\t\t}\n\t}\n\n\treturn row.appendChild(cell);\n}\n\n/**\n * @overloads {Binding#onBindingDispose}\n */\nUnpublishedPageBinding.prototype.onBindingDispose = function () {\n\n\tUnpublishedPageBinding.superclass.onBindingDispose.call(this);\n}\n\n/**\n * @implements {IActionListener}\n * @overloads {Binding#handleAction}\n * @param {Action} action\n */\nUnpublishedPageBinding.prototype.handleAction = function (action) {\n\n\tUnpublishedPageBinding.superclass.handleAction.call(this, action);\n\n\tvar binding = action.target;\n\n\tswitch (action.type) {\n\n\t\tcase CheckBoxBinding.ACTION_COMMAND:\n\n\t\t\tvar checkbox = action.target;\n\t\t\tvar node = checkbox.associatedNode;\n\t\t\tif (node instanceof SystemNode) {\n\t\t\t\tthis.updateActions();\n\t\t\t\tthis.updateCheckAllButton(checkbox.isChecked);\n\t\t\t\tthis.hightlightRow(checkbox);\n\t\t\t}\n\t\t\taction.consume();\n\t\t\tbreak;\n\n\t\tcase ButtonBinding.ACTION_COMMAND:\n\n\t\t\tvar button = action.target;\n\t\t\tvar systemAction = button.associatedSystemAction;\n\t\t\tif (systemAction != null) {\n\t\t\t\tvar bulkExecutionDialog = systemAction.getBulkExecutionDialog();\n\t\t\t\tif (bulkExecutionDialog != null && this.getSelectedCheckboxes().getLength() > 1) {\n\t\t\t\t\tDialog.question(\n\t\t\t\t\t\tbulkExecutionDialog.Title,\n\t\t\t\t\t\tbulkExecutionDialog.Text,\n\t\t\t\t\t\tDialog.BUTTONS_ACCEPT_CANCEL,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thandleDialogResponse: (function(response) {\n\t\t\t\t\t\t\t\tif (response === Dialog.RESPONSE_ACCEPT) {\n\t\t\t\t\t\t\t\t\tthis._handleSystemAction(systemAction);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}).bind(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis._handleSystemAction(systemAction);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase UnpublishedPageBinding.ACTION_CHECK_ALL:\n\n\t\t\tthis.tablebody.getDescendantBindingsByType(CheckBoxBinding).each(function (checkbox) {\n\t\t\t\tif (checkbox.associatedNode) {\n\t\t\t\t\tcheckbox.setChecked(binding.isChecked, true);\n\t\t\t\t\tthis.hightlightRow(checkbox);\n\t\t\t\t}\n\t\t\t}, this);\n\n\t\t\tthis.updateActions();\n\n\t\t\taction.consume();\n\t\t\tbreak;\n\t}\n}\n\n\n/**\n * Implements {IBroadcastListener}\n * @param {string} broadcast\n * @param {object} arg\n */\nUnpublishedPageBinding.prototype.handleBroadcast = function (broadcast, arg) {\n\n\tUnpublishedPageBinding.superclass.handleBroadcast.call(this, broadcast, arg);\n\n\tswitch (broadcast) {\n\n\t\tcase BroadcastMessages.DOCKTABBINDING_SELECT:\n\t\t\tif (this.containingViewBinding === arg.getAssociatedView()) {\n\t\t\t\tthis.isSelectedTab = true;\n\t\t\t\tif (this.isRequireRefresh) {\n\t\t\t\t\tthis.refresh();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.isSelectedTab = false;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESH:\n\t\t\tif (this.isSelectedTab) {\n\t\t\t\tthis.refresh();\n\t\t\t} else {\n\t\t\t\tthis.isRequireRefresh = true;\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\n\n/**\n * Update 'check all' button\n * @param (checkbox} Chec\n */\nUnpublishedPageBinding.prototype.hightlightRow = function (checkbox) {\n\n\tvar row = DOMUtil.getAncestorByLocalName(\"tr\", checkbox.bindingElement);\n\tif (row) {\n\t\tif (checkbox.isChecked) {\n\t\t\tCSSUtil.attachClassName(row, UnpublishedPageBinding.SELECTED_CLASSNAME);\n\t\t} else {\n\t\t\tCSSUtil.detachClassName(row, UnpublishedPageBinding.SELECTED_CLASSNAME);\n\t\t}\n\t}\n}\n\n/**\n * Update 'check all' button\n * @param (bool} isChecked\n */\nUnpublishedPageBinding.prototype.updateCheckAllButton = function(isChecked) {\n\n\tthis.bindingWindow.bindingMap.checkallbox.setChecked(\n\t\tisChecked && this.tablebody.getDescendantBindingsByType(CheckBoxBinding).toArray().filter(function(item) { return item.associatedNode && !item.isChecked; }).length === 0,\n\t\ttrue\n\t);\n}\n\n\n/**\n * Handle system-action.\n * @param (SystemAction} action\n */\nUnpublishedPageBinding.prototype._handleSystemAction = function (action) {\n\n\tif (action != null) {\n\n\t\tApplication.lock(SystemAction);\n\t\tthis.getSelectedCheckboxes().each(function (check) {\n\t\t\tvar node = check.associatedNode;\n\t\t\tif (node instanceof SystemNode) {\n\t\t\t\tvar allowedActionKeys = this.getAllowedActionKeys(node);\n\t\t\t\tif (allowedActionKeys.has(action.getHandle())) {\n\t\t\t\t\tTreeService.ExecuteSingleElementAction(\n\t\t\t\t\t\tnode.getData(),\n\t\t\t\t\t\taction.getHandle(),\n\t\t\t\t\t\tApplication.CONSOLE_ID\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}, this);\n\t\tMessageQueue.update();\n\t\tApplication.unlock(SystemAction);\n\t\tthis.refresh();\n\t}\n}"
  },
  {
    "path": "Website/Composite/content/views/relationshipgraph/Default.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"Default.aspx.cs\" Inherits=\"Spikes_RelationshipGraph_Default\" %>\r\n\r\n<%@ Register TagPrefix=\"control\" TagName=\"httpheaders\" Src=\"~/Composite/controls/HttpHeadersControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"scriptloader\" Src=\"~/Composite/controls/ScriptLoaderControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"styleloader\" Src=\"~/Composite/controls/StyleLoaderControl.ascx\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n<head>\r\n    <title>Relationship Graph</title>\r\n    <control:styleloader ID=\"Styleloader1\" runat=\"server\" />\r\n    <control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n</head>\r\n<body>\r\n    <ui:page label=\"Relationship Graph\" image=\"${icon:nodes}\">\r\n        <ui:scrollbox>\r\n            <asp:PlaceHolder ID=\"RelationshipGraphHolder\" runat=\"server\" />\r\n        </ui:scrollbox>\r\n    </ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/relationshipgraph/Default.aspx.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing Composite.Core.Serialization;\r\nusing System.Collections.Generic;\r\nusing Composite.C1Console.Security;\r\nusing System.Xml.Linq;\r\nusing Composite.Data.Types;\r\nusing Composite.Data;\r\n\r\n\r\npublic partial class Spikes_RelationshipGraph_Default : System.Web.UI.Page\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        if (Request.QueryString[\"EntityToken\"] == null)\r\n        {\r\n            RelationshipGraphHolder.Controls.Add(new LiteralControl(\"No entity token.... nothing to do....\"));\r\n\r\n            return;\r\n        }\r\n\r\n        string serializedEntityToken = Request.QueryString[\"EntityToken\"];\r\n\r\n        EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n        //Composite.Core.WebClient.ElementInformation elementInformation = ElementInformationSerializer.Deserialize(serializedEntityToken);\r\n\r\n        RelationshipGraph graph = new RelationshipGraph(entityToken, RelationshipGraphSearchOption.Both);\r\n\r\n        foreach (RelationshipGraphLevel level in graph.Levels)\r\n        {\r\n            if (level.AllEntities.Count() != 0)\r\n            {\r\n                RelationshipGraphHolder.Controls.Add(new LiteralControl(new XElement(\"h2\", string.Format(\"Level {0}\", level.Level)).ToString()));\r\n            }\r\n\r\n            foreach (EntityToken token in level.Entities)\r\n            {\r\n                PrettyPrintEntityToken(token, \"red\");\r\n            }\r\n\r\n\r\n            foreach (EntityToken token in level.HookedEntities)\r\n            {\r\n                PrettyPrintEntityToken(token, \"green\");\r\n            }\r\n        }\r\n    }\r\n\r\n    private void AddPersissionsLine(List<object> elements, string entity, IEnumerable<PermissionType> permissions)\r\n    {\r\n        var permissionLabels = permissions.Select(p => new PermissionDescriptor(p).Label).OrderBy(l => l).ToList();\r\n\r\n        if (permissionLabels.Count == 0) return;\r\n\r\n        elements.Add(new XElement(\"span\", \r\n                        new XAttribute(\"style\", \"padding-left: 15px;\"),\r\n                        entity + \" = \" + string.Join(\", \", permissionLabels)));\r\n        elements.Add(new XElement(\"br\"));\r\n    }\r\n\r\n\r\n    private void PrettyPrintEntityToken(EntityToken entityToken, string color)\r\n    {\r\n        var idList = new List<object>();\r\n\r\n        if (entityToken.Id.Contains(\"=\"))\r\n        {\r\n            Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(entityToken.Id);\r\n\r\n            idList.Add(new XElement(\"br\"));\r\n\r\n            foreach (KeyValuePair<string, string> kvp in dic)\r\n            {\r\n                idList.Add(new XElement(\"span\", new XAttribute(\"style\", \"padding-left: 15px; color: \" + color),\r\n                    string.Format(\"{0} = {1}\", kvp.Key, kvp.Value)));\r\n                idList.Add(new XElement(\"br\"));\r\n            }\r\n        }\r\n        else\r\n        {\r\n            idList.Add(entityToken.Id);\r\n        }\r\n\r\n\r\n        var userPermissionsDefinedHere = new List<object>();\r\n        var currentUsersPermissionTypes = new List<object>();\r\n\r\n        string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);\r\n\r\n        var usernames = UserValidationFacade.AllUsernames.OrderBy(u => u).ToList();\r\n\r\n        foreach (string username in usernames)\r\n        {\r\n            IEnumerable<PermissionType> userPermissionTypes = PermissionTypeFacade.GetLocallyDefinedUserPermissionTypes(\r\n                new UserToken(username), entityToken);\r\n\r\n            AddPersissionsLine(userPermissionsDefinedHere, username, userPermissionTypes);\r\n\r\n            var currentPermissionTypes = PermissionTypeFacade.GetCurrentPermissionTypes(\r\n                new UserToken(username), entityToken, \r\n                PermissionTypeFacade.GetUserPermissionDefinitions(username), \r\n                PermissionTypeFacade.GetUserGroupPermissionDefinitions(username));\r\n\r\n            AddPersissionsLine(currentUsersPermissionTypes, username, currentPermissionTypes);\r\n        }\r\n\r\n\r\n        var userGroupPermissionsDefinedHere = new List<object>();\r\n        var inheritedGroupPermissions = new List<object>();\r\n\r\n        var userGroups = DataFacade.GetData<IUserGroup>().OrderBy(ug => ug.Name).ToList();\r\n        foreach (IUserGroup userGroup in userGroups)\r\n        {\r\n            var userGroupPermissionTypes = PermissionTypeFacade.GetLocallyDefinedUserGroupPermissionTypes(userGroup.Id, entityToken);\r\n\r\n            AddPersissionsLine(userGroupPermissionsDefinedHere, userGroup.Name, userGroupPermissionTypes);\r\n\r\n            IEnumerable<PermissionType> inheritedUserGroupPermissionTypes = PermissionTypeFacade.GetInheritedGroupPermissionsTypes(userGroup.Id, entityToken);\r\n\r\n            AddPersissionsLine(inheritedGroupPermissions, userGroup.Name, inheritedUserGroupPermissionTypes);\r\n        }\r\n\r\n\r\n\r\n        var element =\r\n            new XElement(\"div\",\r\n                new XAttribute(\"style\",\r\n                    string.Format(\r\n                        \"border:2px; border-style: solid; border-color: {0}; margin-bottom: 2px; margin-left:5px; margin-right:5px; padding: 3px;\",\r\n                        color)),\r\n                new XElement(\"b\", \"Runtime type: \"),\r\n                entityToken.GetType().ToString(),\r\n                new XElement(\"br\"),\r\n                new XElement(\"b\", \"Hashcode: \"),\r\n                entityToken.GetHashCode().ToString(),\r\n                new XElement(\"br\"),\r\n                new XElement(\"b\", \"Source: \"),\r\n                entityToken.Source,\r\n                new XElement(\"br\"),\r\n                new XElement(\"b\", \"Type: \"),\r\n                entityToken.Type,\r\n                new XElement(\"br\"),\r\n                new XElement(\"b\", \"Id: \"),\r\n                idList,\r\n                new XElement(\"br\"),\r\n                new XElement(\"b\", \"Serialized entity token: \"),\r\n                serializedEntityToken,\r\n                new XElement(\"br\"),\r\n                new XElement(\"br\"));\r\n\r\n\r\n        if (currentUsersPermissionTypes.Any())\r\n        {\r\n            element.Add(\r\n                new XElement(\"b\", \"Resolved users permissions here: \"),\r\n                new XElement(\"br\"),\r\n                currentUsersPermissionTypes,\r\n                new XElement(\"br\"));\r\n        }\r\n\r\n\r\n        if (userPermissionsDefinedHere.Any())\r\n        {\r\n            element.Add(\r\n                new XElement(\"b\", \"Users permissions defined here: \"),\r\n                new XElement(\"br\"),\r\n                userPermissionsDefinedHere,\r\n                new XElement(\"br\"));\r\n        }\r\n\r\n        if (inheritedGroupPermissions.Any())\r\n        {\r\n            element.Add(\r\n                new XElement(\"b\", \"Inherted user group permissions: \"),\r\n                new XElement(\"br\"),\r\n                inheritedGroupPermissions,\r\n                new XElement(\"br\"));\r\n        }\r\n\r\n        if (userGroupPermissionsDefinedHere.Any())\r\n        {\r\n            element.Add(\r\n                new XElement(\"b\", \"User group permissions defined here: \"),\r\n                new XElement(\"br\"),\r\n                userGroupPermissionsDefinedHere,\r\n                new XElement(\"br\"));\r\n        }\r\n\r\n\r\n        RelationshipGraphHolder.Controls.Add(new LiteralControl(element.ToString()));\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/relationshipgraph/Default.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Spikes_RelationshipGraph_Default {\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Styleloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::StyleLoaderControl Styleloader1;\r\n    \r\n    /// <summary>\r\n    /// Scriptloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader1;\r\n    \r\n    /// <summary>\r\n    /// RelationshipGraphHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder RelationshipGraphHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/relationshipgraph/ShowRelationshipOrientedGraph.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" Inherits=\"Composite.content.views.relationshipgraph.ShowRelationshipOrientedGraph\" CodeFile=\"ShowRelationshipOrientedGraph.aspx.cs\" %>\r\n\r\n<%@ Register TagPrefix=\"control\" TagName=\"httpheaders\" Src=\"~/Composite/controls/HttpHeadersControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"scriptloader\" Src=\"~/Composite/controls/ScriptLoaderControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"styleloader\" Src=\"~/Composite/controls/StyleLoaderControl.ascx\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n<head>\r\n    <title>Element Information</title>\r\n    <control:styleloader ID=\"Styleloader1\" runat=\"server\" />\r\n    <control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n</head>\r\n<body>\r\n    <ui:page image=\"${icon:nodes}\">\r\n        <ui:scrollbox>\r\n            <asp:PlaceHolder ID=\"RelationshipOrientedGraphPlaceHolder\" runat=\"server\" />\r\n        </ui:scrollbox>\r\n    </ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/relationshipgraph/ShowRelationshipOrientedGraph.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Types;\r\n\r\n\r\nnamespace Composite.content.views.relationshipgraph\r\n{\r\n    public partial class ShowRelationshipOrientedGraph : System.Web.UI.Page\r\n    {\r\n        protected void Page_Load(object sender, EventArgs e)\r\n        {\r\n            string idString = Request.QueryString[\"Id\"];\r\n            if (string.IsNullOrEmpty(idString) == true)\r\n            {\r\n                return;\r\n            }\r\n\r\n            Guid id = new Guid(idString);\r\n            string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format(\"{0}.RelationshipGraph\", id));\r\n\r\n            EntityToken startEntityToken = EntityTokenSerializer.Deserialize(C1File.ReadAllLines(filename)[0]);\r\n\r\n            RelationshipOrientedGraph graph = new RelationshipOrientedGraph(startEntityToken);\r\n\r\n            IEnumerable<IEnumerable<EntityToken>> paths = graph.Root.GetAllPaths();\r\n\r\n            RelationshipOrientedGraphPlaceHolder.Controls.Add(new LiteralControl(string.Format(\"<div><b>Path count: {0}</b></div>\", paths.Count())));\r\n\r\n            int pathCounter = 1;\r\n            foreach (IEnumerable<EntityToken> path in paths)\r\n            {\r\n                EntityTokenHtmlPrettyfierHelper helper = new EntityTokenHtmlPrettyfierHelper();\r\n                helper.StartTable();\r\n                                \r\n                helper.AddHeading(string.Format(\"<b>Path: {0}</b>\", pathCounter++));                \r\n\r\n                int levelCounter = 0;\r\n                foreach (EntityToken entityToken in path)\r\n                {\r\n                    helper.StartRow();\r\n                    helper.AddCell(string.Format(\"<center><b>Level: {0}</b></center>\", levelCounter++), 2, \"#aaaaaa\");\r\n                    helper.EndRow();\r\n\r\n                    helper.StartRow();\r\n                    helper.AddCell(\"<b>Id</b>\");\r\n                    helper.AddCell(entityToken.OnGetIdPrettyHtml());\r\n                    helper.EndRow();\r\n\r\n                    helper.StartRow();\r\n                    helper.AddCell(\"<b>Type</b>\");\r\n                    helper.AddCell(entityToken.OnGetTypePrettyHtml());\r\n                    helper.EndRow();\r\n\r\n                    helper.StartRow();\r\n                    helper.AddCell(\"<b>Source</b>\");\r\n                    helper.AddCell(entityToken.OnGetSourcePrettyHtml());                    \r\n                    helper.EndRow();\r\n\r\n                    string extra = entityToken.OnGetExtraPrettyHtml();\r\n                    if (string.IsNullOrEmpty(extra) == false)\r\n                    {\r\n                        helper.StartRow();\r\n                        helper.AddCell(\"<b>Extra</b>\");\r\n                        helper.AddCell(extra);\r\n                        helper.EndRow();\r\n                    }\r\n\r\n                    helper.StartRow();\r\n                    helper.AddCell(\"<b>RTT</b>\");\r\n                    helper.AddCell(TypeManager.SerializeType(entityToken.GetType()));\r\n                    helper.EndRow();\r\n                }                                                \r\n                \r\n                helper.EndTable();\r\n\r\n                RelationshipOrientedGraphPlaceHolder.Controls.Add(new LiteralControl(helper.GetResult()));\r\n            }\r\n        }        \r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/content/views/relationshipgraph/ShowRelationshipOrientedGraph.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace Composite.content.views.relationshipgraph {\r\n    \r\n    \r\n    public partial class ShowRelationshipOrientedGraph {\r\n        \r\n        /// <summary>\r\n        /// Httpheaders1 control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::HttpHeadersControl Httpheaders1;\r\n        \r\n        /// <summary>\r\n        /// Styleloader1 control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::StyleLoaderControl Styleloader1;\r\n        \r\n        /// <summary>\r\n        /// Scriptloader1 control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::ScriptLoaderControl Scriptloader1;\r\n        \r\n        /// <summary>\r\n        /// RelationshipOrientedGraphPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder RelationshipOrientedGraphPlaceHolder;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/search/SearchPageBinding.js",
    "content": "SearchPageBinding.prototype = new PageBinding;\r\nSearchPageBinding.prototype.constructor = SearchPageBinding;\r\nSearchPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SearchPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SearchPageBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._provoderName = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._entityToken = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._searchToken = null;\r\n}\r\n\r\n/** \r\n * Identifies binding.\r\n */\r\nSearchPageBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[SearchPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {HashMap<string><string>} map\r\n */\r\nSearchPageBinding.prototype.setPageArgument = function ( map ) {\r\n\t\r\n\tSearchPageBinding.superclass.setPageArgument.call ( this, map );\r\n\t\r\n\tif ( map ) {\r\n\t\r\n\t\tthis._providerName\t= map [ \"ProviderName\" ];\r\n\t\tthis._entityToken\t= map [ \"EntityToken\" ];\r\n\t\tthis._searchToken\t= map [ \"SerializedSearchToken\" ];\r\n\t\t\r\n\t\tif ( !this._isValidSearch ()) {\r\n\t\t\tthrow \"SearchPageBinding argument dysfunction.\";\r\n\t\t} else if ( this._isPageBindingInitialized ) {\r\n\t\t\tbindingMap.tree.clear ();\r\n\t\t\tthis._buildSearchResultTree ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBeforePageInitialize}\r\n */\r\nSearchPageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tif ( this._isValidSearch ()) {\r\n\t\tthis._buildSearchResultTree ();\r\n\t}\r\n\tSearchPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Is valid search?\r\n * @return {boolean}\r\n */\r\nSearchPageBinding.prototype._isValidSearch = function () {\r\n\r\n\treturn (\r\n\t\tthis._providerName != null && \r\n\t\tthis._entityToken != null && \r\n\t\tthis._searchToken != null\r\n\t);\r\n}\r\n\r\n/**\r\n * Launch new search dialog, providing existing search token.\r\n */\r\nSearchPageBinding.prototype.newSearch = function () {\r\n\t\r\n\tvar url = Dialog.URL_TREESEARCH;\r\n\t\r\n\tif ( this._isValidSearch () ) {\r\n\t\turl += \"?SearchToken=\" + this._searchToken;\r\n\t\turl += \"&EntityToken=\" + this._entityToken;\r\n\t\turl += \"&ProviderName=\" + this._providerName;\r\n\t\tDialog.invokeModal ( url );\r\n\t} else {\r\n\t\tDialog.error ( \"UARGH?\", \"How to handle fresh search?\" );\r\n\t}\r\n\t\r\n\tthis._providerName \t= null;\r\n \tthis._entityToken \t= null;\r\n\tthis._searchToken \t= null;\r\n}\r\n\r\n/**\r\n * Build search result tree.\r\n */\r\nSearchPageBinding.prototype._buildSearchResultTree = function () {\r\n\t\r\n\tif ( this._isValidSearch ()) {\r\n\t\r\n\t\tbindingMap.tree.searchToken = this._searchToken;\r\n\t\t\r\n\t\talert ( \"tree.searchToken REFACTORED!\" );\r\n\t\t\r\n\t\tvar list = new List ( \r\n\t\t\t\t\r\n\t\t\t/*\r\n\t\t\t * THIS WSMETHOD ALSO REFACTORED!\r\n\t\t\t */\r\n\t\t\t\t\r\n\t\t\tTreeService.GetElementsBySearchToken ( \r\n\t\t\t\tthis._providerName,\r\n\t\t\t\tthis._entityToken,\r\n\t\t\t\tthis._searchToken\t\r\n\t\t\t)\r\n\t\t);\r\n\t\tif ( list.hasEntries ()) {\r\n\t\t\twhile ( list.hasNext ()) {\r\n\t\t\t\tvar node = SystemTreeNodeBinding.newInstance ( \r\n\t\t\t\t\tnew SystemNode ( \r\n\t\t\t\t\t\tlist.getNext ()\r\n\t\t\t\t\t), \r\n\t\t\t\t\tthis.bindingDocument \r\n\t\t\t\t)\r\n\t\t\t\tbindingMap.tree.add ( node ); \r\n\t\t\t\tnode.attach ();\r\n\t\t\t}\r\n\t\t\tbindingMap.decks.select ( \"resultdeck\" );\r\n\t\t} else {\r\n\t\t\tbindingMap.decks.select ( \"noresultdeck\" );\t\t\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Executed when the page is shown.\r\n *\r\nSearchPageBinding.prototype.onAfterPageInitialize = function () {\r\n\t\r\n\tSystemPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\t\r\n\tif ( this._isValidSearch ()) {\r\n\t\tsetTimeout ( function () {\r\n\t\t\tbindingMap.tree.focus ();\r\n\t\t\tbindingMap.tree.selectDefault ();\r\n\t\t}, 500 );\r\n\t}\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/content/views/search/search.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Website.Content.Views.Search.Search</title>\r\n\t    <control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"SearchPageBinding.js\"></script>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css.aspx\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page id=\"page\" binding=\"SearchPageBinding\">\r\n\t\t\t\r\n\t\t\t<ui:toolbar>\r\n\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t<ui:toolbarbutton label=\"${string:Website.Content.Views.Search.Search.LabelNewSearch}\" oncommand=\"bindingMap.page.newSearch ()\"/>\r\n\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t</ui:toolbarbody>\r\n \t\t \t</ui:toolbar>\r\n\t\t\t\r\n\t\t\t<ui:decks id=\"decks\">\r\n\t\t\t\r\n\t\t\t\t<ui:deck id=\"defaultdeck\">\r\n\t\t\t\t\t<ui:flexbox class=\"statustext\">\r\n\t\t\t\t\t    <!-- No current search.-->\r\n\t\t\t\t\t\t<!--<ui:text label=\"${string:Website.Content.Views.Editors.RenderingEditor.RenderingEditor-General.Name.StatusText}\"/>-->\r\n\t\t\t\t\t</ui:flexbox>\r\n\t\t\t\t</ui:deck>\r\n\t\t\t\r\n\t\t\t\t<ui:deck id=\"resultdeck\">\r\n\t\t\t \t\t<ui:box class=\"statustext\">\r\n\t\t\t \t\t    <!-- 23 results for \"Fister\" in \"Flemming\"-->\r\n\t\t\t \t\t\t<!--<ui:text label=\"323 results for &quot;fister&quot; in &quot;Flemming&quot;\"/></ui:text>-->\r\n\t\t\t \t\t</ui:box>\r\n\t\t\t\t\t<ui:tree id=\"tree\" binding=\"SystemTreeBinding\">\r\n\t\t\t\t\t\t<ui:treebody/>\r\n\t\t\t\t\t</ui:tree>\r\n\t\t\t\t</ui:deck>\r\n\t\t\t\t\r\n\t\t\t\t<ui:deck id=\"noresultdeck\">\r\n\t\t\t \t\t <ui:flexbox class=\"statustext\">\r\n\t\t\t \t\t    <!-- No results for \"fister\".-->\r\n\t\t\t \t\t \t<!--<ui:text label=\"No results for &quot;fisting&quot;\"/>-->\r\n\t\t\t \t\t </ui:flexbox>\r\n\t\t\t\t</ui:deck>\r\n\t\t\t\t\r\n\t\t\t</ui:decks>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/search/search.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n \r\nui|flexbox.statustext,\r\nui|box.statustext {\r\n\tbackground-color: Window;\t\r\n\tcolor: $(color:windowtext);\r\n\tpadding: 9px;\r\n}"
  },
  {
    "path": "Website/Composite/content/views/seoassist/bindings/SEOAssistantPageBinding.js",
    "content": "SEOAssistantPageBinding.prototype = new MarkupAwarePageBinding;\r\nSEOAssistantPageBinding.prototype.constructor = SEOAssistantPageBinding;\r\nSEOAssistantPageBinding.superclass = MarkupAwarePageBinding.prototype;\r\n\r\nSEOAssistantPageBinding.CLASSNAME_DEACTIVATED = \"deactivated\";\r\nSEOAssistantPageBinding.LOCALIZATION = \"Composite.Web.SEOAssistant\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SEOAssistantPageBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"SEOAssistantPageBinding.\");\r\n\r\n\t/**\r\n\t * @type {SEODOMParser}\r\n\t */\r\n\tthis._parser = new SEODOMParser();\r\n\r\n\t/**\r\n\t * @type {HTMLInputElement}\r\n\t */\r\n\tthis._focusedInput = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isDirty = false;\r\n\r\n\t/**\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis._keywords = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._markup = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSEOAssistantPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SEOAssistantPageBinding.]\";\r\n}\r\n\r\n/**\r\n * Setup page elements.\r\n * @overloads {PageBinding#onBeforePageInitialize}\r\n */\r\nSEOAssistantPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tSEOAssistantPageBinding.superclass.onBeforePageInitialize.call(this);\r\n\r\n\r\n\tthis.addActionListener(ButtonBinding.ACTION_COMMAND);\r\n\r\n\tthis.subscribe(BroadcastMessages.TOLANGUAGE_UPDATED);\r\n\r\n\tthis.addEventListener(DOMEvents.DOUBLECLICK);\r\n\r\n\t/*\r\n\t * Initialize the SEO service and retrieve keywords.\r\n\t */\r\n\tif (top.SEOService == null) {\r\n\t\ttop.SEOService = WebServiceProxy.createProxy(Constants.URL_WSDL_SEOSERVICE);\r\n\t}\r\n\tthis._getKeywords();\r\n}\r\n\r\n/**\r\n * Get keywords and populate list. Note that this  \r\n * is reinvoked when user changes to to-language.\r\n */\r\nSEOAssistantPageBinding.prototype._getKeywords = function () {\r\n\r\n\tvar list = new List(top.SEOService.GetKeyWords(true));\r\n\tthis._parser.setKeys(list);\r\n\tthis._keywords = list;\r\n\r\n\r\n}\r\n\r\n/**\r\n * Save keywords.\r\n */\r\nSEOAssistantPageBinding.prototype._saveKeywords = function () {\r\n\r\n\tvar keywords = this._keywords;\r\n\r\n\t/*\r\n\t * Transmit to server.\r\n\t */\r\n\tApplication.lock(this);\r\n\ttop.SEOService.SaveKeyWords(keywords.toArray());\r\n\r\n\t/*\r\n\t * Update internally.\r\n\t */\r\n\tvar list = keywords;\r\n\tthis._parser.setKeys(list);\r\n\r\n\tvar self = this;\r\n\tsetTimeout(function () {\r\n\t\tApplication.unlock(self);\r\n\t}, 500);\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastHandler}\r\n * @overloads {PageBinding#handleBroadcast}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nSEOAssistantPageBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tSEOAssistantPageBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tswitch (broadcast) {\r\n\r\n\t\tcase BroadcastMessages.TOLANGUAGE_UPDATED:\r\n\r\n\t\t\tthis._getKeywords();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {MarkupAwarePageBinding#_handleMarkup}\r\n * @param {string} markup\r\n */\r\nSEOAssistantPageBinding.prototype._handleMarkup = function (markup) {\r\n\r\n\tSEOAssistantPageBinding.superclass._handleMarkup.call(this, markup);\r\n\r\n\tthis._markup = markup;\r\n\r\n\tif (markup == null || markup == \"\") {\r\n\t\tthis._incorrectHtml();\r\n\t}\r\n\telse if (this._keywords.hasEntries()) {\r\n\t\tthis._parseMarkup(markup);\r\n\t} else {\r\n\t\tthis._noKeyWords();\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n* @overloads {MarkupAwarePageBinding#_handleWrongMarkup}\r\n* @param {string} markup\r\n*/\r\nSEOAssistantPageBinding.prototype._incorrectHtml = function () {\r\n\r\n\t//var tree = this.bindingWindow.bindingMap.tree;\r\n\t//tree.empty();\r\n\t//var node = tree.add(TreeNodeBinding.newInstance(tree.bindingDocument));\r\n\t//node.setImage(\"${icon:warning}\");\r\n\t//node.setLabel(StringBundle.getString(SEOAssistantPageBinding.LOCALIZATION, \"IncorrectHtml\"));\r\n\t//node.attach();\r\n}\r\n\r\n/**\r\n * \r\n */\r\nSEOAssistantPageBinding.prototype._noKeyWords = function () {\r\n\r\n\t//var tree = this.bindingWindow.bindingMap.tree;\r\n\t//tree.empty ();\r\n\t//var node = tree.add ( TreeNodeBinding.newInstance ( tree.bindingDocument ));\r\n\t//node.setImage ( \"${icon:warning}\" );\r\n\t//node.setLabel ( StringBundle.getString ( SEOAssistantPageBinding.LOCALIZATION, \"NoKeywordsWarning\" ));\r\n\t//node.attach ();\r\n}\r\n\r\n/**\r\n * @param {string} markup\r\n */\r\nSEOAssistantPageBinding.prototype._parseMarkup = function (markup) {\r\n\r\n\tvar dom = null;\r\n\ttry {\r\n\t\tdom = new DOMParser().parseFromString(markup, \"text/html\");\r\n\t\t\r\n\t} catch (Exception) {\r\n\t}\r\n\r\n\tif (dom == null) // IE9\r\n\t{\r\n\t\ttry {\r\n\t\t\tvar dom = document.implementation.createHTMLDocument(\"\");\r\n\t\t\tdom.body.innerHTML = markup;\r\n\t\t} catch (Exception) {\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\tif (dom != null) {\r\n\r\n\t\t/*\r\n\t\t * Build the tree.\r\n\t\t */\r\n\t\tvar list = this._parser.parse(dom);\r\n\t\tif (list.hasEntries()) {\r\n\t\t\tdocument.getElementById(\"resultcontaner\").innerHTML = \"\";\r\n\r\n\t\t\twhile (list.hasNext()) {\r\n\t\t\t\tvar item = list.getNext();\r\n\t\t\t\tvar tr = this._addKeywordRow(document.getElementById(\"resultcontaner\"), item);\r\n\t\t\t\tthis._addResults(tr, item.isInTitle, item.isInURL, item.isInMenuTitle, item.isInDescription, item.isInHeading, item.isInContent);\r\n\t\t\t\tthis._addDeleteCell(tr);\r\n\t\t\t}\r\n\t\t\tdocument.getElementById(\"message\").style.display = \"none\";\r\n\r\n\t\t} else {\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tthis.logger.error(\"Illformed markup:\\n\\n\" + markup);\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {string} \r\n */\r\nSEOAssistantPageBinding.prototype._addKeywordRow = function (tablebody, item) {\r\n\r\n\tvar tr = this.bindingDocument.createElement(\"tr\");\r\n\ttr.setAttribute(\"keyword\", item.keyword);\r\n\ttablebody.appendChild(tr);\r\n\tvar scoretd = this._addCell(tr);\r\n\tscoretd.className = \"score\";\r\n\tvar span = DOMUtil.createElementNS(Constants.NS_XHTML, \"span\", this.bindingDocument);\r\n\tvar score = item.getScore();\r\n\r\n\tvar i = 0; while (i++ < SEOResult.MAX_SCORE) {\r\n\t\tvar inc = span.cloneNode(false);\r\n\t\tinc.className = i <= score ? \"true\" : \"false\";\r\n\t\tspan.appendChild(inc);\r\n\t}\r\n\r\n\tspan.className = \"seoresult\";\r\n\tscoretd.appendChild(span);\r\n\r\n\tvar keyword = item.keyword;\r\n\tvar button = ClickButtonBinding.newInstance(this.bindingDocument);\r\n\tvar keywordtd = this._addCell(tr);\r\n\tkeywordtd.appendChild(button.bindingElement);\r\n\tbutton.addActionListener(\r\n\t\tButtonBinding.ACTION_COMMAND, {\r\n\t\t\thandleAction: function (action) {\r\n\t\t\t\taction.consume();\r\n\t\t\t\tEventBroadcaster.broadcast(BroadcastMessages.HIGHLIGHT_KEYWORDS,\r\n\t\t\t\tnew List([keyword])\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\tbutton.setLabel(keyword);\r\n\tbutton.attach();\r\n\tbutton.attachClassName(\"simple-text\");\r\n\r\n\treturn tr;\r\n}\r\n\r\n/**\r\n * @param {string} \r\n */\r\nSEOAssistantPageBinding.prototype._addCell = function (tr) {\r\n\tvar td = this.bindingDocument.createElement(\"td\");\r\n\treturn tr.appendChild(td);\r\n}\r\n\r\nSEOAssistantPageBinding.prototype._addDeleteCell = function (tr) {\r\n\tvar td = this.bindingDocument.createElement(\"td\");\r\n\tvar button = ClickButtonBinding.newInstance(this.bindingDocument);\r\n\tbutton.setImage(\"${icon:delete}\");\r\n\t\r\n\ttd.appendChild(button.bindingElement);\r\n\ttr.appendChild(td);\r\n\tbutton.attach();\r\n\tbutton.attachClassName(\"simple-icon\");\r\n\tvar self = this;\r\n\tbutton.oncommand = function () {\r\n\t\tself._deleteKeywordRow(tr);\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @param {string} \r\n */\r\nSEOAssistantPageBinding.prototype._addResults = function () {\r\n\tif (arguments.length === 0)\r\n\t\treturn;\r\n\tvar tr = arguments[0];\r\n\tvar i;\r\n\tfor (i = 1; i < arguments.length; i++) {\r\n\t\tvar td = this._addCell(tr);\r\n\t\ttd.className = arguments[i];\r\n\t}\r\n}\r\n\r\nSEOAssistantPageBinding.prototype._deleteKeywordRow = function (tr) {\r\n\tvar keyword = tr.getAttribute(\"keyword\");\r\n\ttr.parentNode.removeChild(tr);\r\n\tthis._removeKeyword(keyword);\r\n\tthis._saveKeywords();\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nSEOAssistantPageBinding.prototype.handleAction = function (action) {\r\n\r\n\tSEOAssistantPageBinding.superclass.handleAction.call(this, action);\r\n\r\n\tswitch (action.type) {\r\n\t\tcase ButtonBinding.ACTION_COMMAND:\r\n\t\t\tvar button = action.target;\r\n\t\t\tswitch (button.getID()) {\r\n\t\t\t\tcase \"addkeywordbutton\":\r\n\t\t\t\t\tvar input = this.bindingWindow.bindingMap.keywordinput;\r\n\t\t\t\t\tvar value = input.getValue();\r\n\t\t\t\t\tif (!value) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis._addKeyword(input.getValue());\r\n\t\t\t\t\tthis._saveKeywords();\r\n\t\t\t\t\tinput.setValue(\"\");\r\n\t\t\t\t\tif (this._markup)\r\n\t\t\t\t\t\tthis._parseMarkup(this._markup);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Add keyword.\r\n */\r\nSEOAssistantPageBinding.prototype._addKeyword = function (keyword) {\r\n\r\n\r\n\tthis._keywords.add(keyword);\r\n\r\n}\r\n\r\n\r\n/**\r\n * Add keyword.\r\n */\r\nSEOAssistantPageBinding.prototype._removeKeyword = function (keyword) {\r\n\r\n\tthis._keywords.remove(keyword);\r\n\r\n}"
  },
  {
    "path": "Website/Composite/content/views/seoassist/scripts/SEODOMParser.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction SEODOMParser () {\r\n\t\r\n\tthis._init ();\r\n}\r\n\r\nSEODOMParser.prototype = {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"SEODOMParser\" ),\r\n\t\r\n\t/**\r\n\t * @type {NodeCrawler}\r\n\t */\r\n\t_crawler : null,\r\n\t\r\n\t/**\r\n\t * @type {Map<string><RegExp>}\r\n\t */\r\n\t_map : new Map (),\r\n\t\r\n\t/**\r\n\t * @type {Map<string><SEOResult>}\r\n\t */\r\n\t_results : null,\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\t_isDebugging : false,\r\n\t\r\n\t/**\r\n\t * Init.\r\n\t */\r\n\t_init : function () {\r\n\t\t\r\n\t\tthis._crawler = new NodeCrawler ();\r\n\t\tvar WHITESPACE = /[^\\t\\n\\r ]/;\r\n\t\tvar self = this;\r\n\t\t\r\n\t\t/*\r\n\t\t * Filter empty text nodes, scripts and styles. \r\n\t\t */\r\n\t\tthis._crawler.addFilter ( function ( node ) {\r\n\t\t\tvar result = null;\r\n\t\t\tswitch ( node.nodeType ) {\r\n\t\t\t\tcase Node.TEXT_NODE :\r\n\t\t\t\t\tif ( !WHITESPACE.test ( node.nodeValue )) {\r\n\t\t\t\t\t\tresult = NodeCrawler.SKIP_NODE;\r\n\t\t\t\t\t}\r\n\t\t\t\t \tbreak;\r\n\t\t\t\tcase Node.ELEMENT_NODE :\r\n\t\t\t\t\tswitch ( node.nodeName.toLowerCase ()) {\r\n\t\t\t\t\t\tcase \"script\" :\r\n\t\t\t\t\t\tcase \"style\" :\r\n\t\t\t\t\t\tcase \"textarea\" :\r\n\t\t\t\t\t\t\tresult = NodeCrawler.SKIP_NODE + NodeCrawler.SKIP_CHILDREN;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t});\r\n\t\t\r\n\t\t/*\r\n\t\t * Analayze remaining nodes.\r\n\t\t */\r\n\t\tthis._crawler.addFilter ( function ( node ) {\r\n\t\t\tif ( node.nodeType == Node.TEXT_NODE ) {\r\n\t\t\t\tself._analyzeTextNode ( node );\r\n\t\t\t} else {\r\n\t\t\t\tswitch ( node.nodeName.toLowerCase ()) {\r\n\t\t\t\t\tcase \"meta\" :\r\n\t\t\t\t\t\tself._analyzeMetaTag ( node );\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\t\r\n\t/**\r\n\t * Set keywords. \r\n\t * @param {List<string>} list\r\n\t * @see {SEODOMParser#setKeys}\r\n\t */\r\n\tsetKeys : function ( list ) {\r\n\t\t\r\n\t\t/* (\\Wkeyword\\Wkeyword2\\W)|(keyword\\Wkeyword2\\W)|(\\Wkeyword\\Wkeyword2)|(keyword\\Wkeyword2) */\r\n\t\t\r\n\t\tlist.reset ();\r\n\t\tthis._map.empty ();\r\n\t\t\r\n\t\twhile ( list.hasNext ()) {\r\n\t\t\tvar key = list.getNext ()\r\n\t\t\tvar phrase = key.toLowerCase ().replace ( / /g, \"\\\\W\" );\r\n\t\t\tvar exp = new RegExp ( \"(\\\\W\" + phrase + \"\\\\W)|(\" + phrase + \"\\\\W)|(\\\\W\" + phrase + \")|(\" + phrase + \")\" );\r\n\t\t\tthis._map.set ( key, exp );\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * @param {DOMDocument} dom\r\n\t * @return {List<SEOResult>}\r\n\t */\r\n\tparse : function ( dom ) {\r\n\t\t\r\n\t\tif ( this._isDebugging == true ) {\r\n\t\t\tthis._logger.debug ( DOMSerializer.serialize ( dom ));\r\n\t\t}\r\n\t\tthis._results = new Map();\r\n\r\n\t\t//add all keys to result\r\n\t\tvar self = this;\r\n\t\tthis._map.each(function(key) {\r\n\t\t\tself._getResult(key);\r\n\t\t});\r\n\t\t\r\n\r\n\r\n\t\tthis._crawler.crawl ( dom );\r\n\t\t\r\n\t\t/*\r\n\t\t * Collect results in array.\r\n\t\t */\r\n\t\tvar array = [];\r\n\t\tthis._results.each ( function ( key, result ) {\r\n\t\t\tarray.push ( result );\r\n\t\t});\r\n\t\t\r\n\t\t/*\r\n\t\t * Sort array by score.\r\n\t\t */\r\n\t\tarray.sort ( function ( a, b ) {\r\n\t\t\tvar result = 0;\r\n\t\t\tvar ascore = a.getScore ();\r\n\t\t\tvar bscore = b.getScore ();\r\n\t\t\tif ( ascore < bscore ) {\r\n\t\t\t\tresult = 1;\r\n\t\t\t}\r\n\t\t\tif ( ascore > bscore ) {\r\n\t\t\t\tresult = -1;\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t});\r\n\t\t\r\n\t\treturn new List ( array );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Cache results.\r\n\t * @return {SEOResult}\r\n\t */\r\n\t_getResult : function ( key ) {\r\n\t\t\r\n\t\tif ( !this._results.has ( key )) {\r\n\t\t\tthis._results.set ( key, new SEOResult ( key ));\r\n\t\t}\r\n\t\treturn this._results.get ( key );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Analyze text node.\r\n\t * @param {DOMTextNode} node\r\n\t */\r\n\t_analyzeTextNode : function ( node ) {\r\n\t\t\r\n\t\tvar self= this;\r\n\t\tvar string = node.nodeValue.toLowerCase ();\r\n\t\tself._map.each ( function ( key, exp ) {\r\n\t\t\tif ( exp.test ( string )) {\r\n\t\t\t\tself._analyze ( key, node );\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\t\r\n\t/**\r\n\t * Analyze meta tag content.\r\n\t * @param {HTMLMetaElement} element\r\n\t */\r\n\t_analyzeMetaTag : function ( element ) {\r\n\t\t\r\n\t\tvar name = element.getAttribute ( \"name\" );\r\n\t\tif ( name ) {\r\n\t\t\tname = name.toLowerCase ();\r\n\t\t\tswitch ( name ) {\r\n\t\t\t\tcase \"c1.menutitle\" :\r\n\t\t\t    case \"c1.urlseowords\":\r\n\t\t\t\tcase \"description\" :\r\n\t\t\t\t\tvar text = element.getAttribute ( \"content\" );\r\n\t\t\t\t\tif ( text ) {\r\n\t\t\t\t\t\tvar self = this, string = text.toLowerCase ();\r\n\t\t\t\t\t\tthis._map.each ( function ( key, exp ) {\r\n\t\t\t\t\t\t\tif ( exp.test ( string )) {\r\n\t\t\t\t\t\t\t\tvar result = self._getResult ( key );\r\n\t\t\t\t\t\t\t\tswitch ( name ) {\r\n\t\t\t\t\t\t\t\t\tcase \"c1.menutitle\" :\r\n\t\t\t\t\t\t\t\t\t\tresult.isInMenuTitle = true;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t    case \"c1.urlseowords\":\r\n\t\t\t\t\t\t\t\t\t\tresult.isInURL = true;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\tcase \"description\" :\r\n\t\t\t\t\t\t\t\t\t\tresult.isInDescription = true;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * @param {DOMTextNode} node\r\n\t */\r\n\t_analyze : function ( key, node ) {\r\n\t\t\r\n\t\tvar next = node.parentNode;\r\n\t\tvar isContinue = true;\r\n\t\t\r\n\t\twhile ( next != null && isContinue == true ) {\r\n\t\t\tswitch ( next.nodeName.toLowerCase ()) {\r\n\t\t\t\tcase \"h1\" :\r\n\t\t\t\tcase \"h2\" :\r\n\t\t\t\tcase \"h3\" :\r\n\t\t\t\tcase \"h4\" :\r\n\t\t\t\tcase \"h5\" :\r\n\t\t\t\tcase \"h6\" :\r\n\t\t\t\t\tthis._getResult ( key ).isInHeading = true;\r\n\t\t\t\t\tisContinue = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"title\" :\r\n\t\t\t\t\tthis._getResult ( key ).isInTitle = true;\r\n\t\t\t\t\tisContinue = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"p\" :\r\n\t\t\t\tcase \"li\" :\r\n\t\t\t\tcase \"td\" :\r\n\t\t\t\tcase \"div\" :\r\n\t\t\t\t\tthis._getResult ( key ).isInContent = true;\r\n\t\t\t\t\tisContinue = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tnext = next.parentNode;\r\n\t\t}\r\n\t\t/*\r\n\t\tif ( isContinue == true ) {\r\n\t\t\t// indicates keyword occurance in menus etc.\r\n\t\t}\r\n\t\t*/\r\n\t}\r\n};"
  },
  {
    "path": "Website/Composite/content/views/seoassist/scripts/SEOResult.js",
    "content": "/**\r\n * The max score.\r\n */\r\nSEOResult.MAX_SCORE = 6;\r\n\r\n/**\r\n * @param {string} keyword\r\n */\r\nfunction SEOResult ( keyword ) {\r\n\t\r\n\tthis.keyword = keyword;\r\n}\r\n\r\nSEOResult.prototype = {\r\n\t\r\n\t_score : 0,\r\n\tkeyword : null,\r\n\tisInTitle : false,\r\n\tisInURL : false,\r\n\tisInMenuTitle : false,\r\n\tisInDescription : false,\r\n\tisInHeading : false,\r\n\tisInContent : false\t\r\n};\r\n\r\n/**\r\n * Result is cached, so you should Only compute  \r\n * the score when SEOResult is fully parsed.\r\n * @return {int}\r\n */\r\nSEOResult.prototype.getScore = function () {\r\n\t\r\n\tif ( this._score == 0 ) {\r\n\t\tthis._score += this.isInTitle ? 1 : 0;\r\n\t\tthis._score += this.isInURL ? 1 : 0;\r\n\t\tthis._score += this.isInMenuTitle ? 1 : 0;\r\n\t\tthis._score += this.isInDescription ? 1 : 0;\r\n\t\tthis._score += this.isInHeading ? 1 : 0;\r\n\t\tthis._score += this.isInContent ? 1 : 0;\r\n\t}\r\n\treturn this._score;\r\n};"
  },
  {
    "path": "Website/Composite/content/views/seoassist/seoassist.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n    <title>Composite.Management.Test!</title>\r\n    <control:styleloader runat=\"server\" />\r\n    <control:scriptloader type=\"sub\" runat=\"server\" />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"seoassist.css.aspx\" />\r\n    <script type=\"text/javascript\" src=\"scripts/SEODOMParser.js\"></script>\r\n    <script type=\"text/javascript\" src=\"scripts/SEOResult.js\"></script>\r\n    <script type=\"text/javascript\" src=\"bindings/SEOAssistantPageBinding.js\"></script>\r\n    <ui:stringbundle id=\"strings\" />\r\n</head>\r\n<body>\r\n    <ui:page binding=\"SEOAssistantPageBinding\">\r\n        <ui:scrollbox>\r\n            <table class=\"resulttable\">\r\n                <thead>\r\n                    <tr>\r\n                        <th colspan=\"2\">\r\n                            <div class=\"seoform clearfix\">\r\n                                <ui:fielddata>\r\n                                    <ui:datainput id=\"keywordinput\" placeholder=\"${string:Composite.Web.SEOAssistant:AddKeywordInputPlaceholder}\" />\r\n                                    <ui:toolbarbutton image=\"add\" id=\"addkeywordbutton\" title=\"Add Keyword\" />\r\n                                </ui:fielddata>\r\n                            </div>\r\n                        </th>\r\n                        <th>\r\n                            <ui:text label=\"${string:Composite.Web.SEOAssistant:isInTitle}\"></ui:text></th>\r\n                        <th>\r\n                            <ui:text label=\"${string:Composite.Web.SEOAssistant:isInURL}\"></ui:text></th>\r\n                        <th>\r\n                            <ui:text label=\"${string:Composite.Web.SEOAssistant:isInMenuTitle}\"></ui:text></th>\r\n                        <th>\r\n                            <ui:text label=\"${string:Composite.Web.SEOAssistant:isInDescription}\"></ui:text></th>\r\n                        <th>\r\n                            <ui:text label=\"${string:Composite.Web.SEOAssistant:isInHeading}\"></ui:text></th>\r\n                        <th>\r\n                            <ui:text label=\"${string:Composite.Web.SEOAssistant:isInContent}\"></ui:text></th>\r\n                        <th></th>\r\n                    </tr>\r\n                </thead>\r\n                <tbody id=\"resultcontaner\">\r\n                </tbody>\r\n            </table>\r\n            <div id=\"message\">\r\n                <div id=\"icon\">\r\n                    <ui:labelbox image=\"message\" />\r\n                </div>\r\n\r\n                <div id=\"text\">\r\n                    <ui:text label=\"${string:Composite.Web.SEOAssistant:IntroText}\" />\r\n                </div>\r\n            </div>\r\n        </ui:scrollbox>\r\n    </ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/seoassist/seoassist.css",
    "content": "﻿@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n.seoresult {\r\n\tdisplay: block;\r\n\tfloat: left;\r\n\tposition: relative;\r\n\tmargin-right: 8px;\r\n\tborder: 1px solid #ddd;\r\n\r\n}\r\n\r\n.seoresult span {\r\n\twidth: 7px;\r\n\theight: 8px;\r\n\tdisplay: block;\r\n\tfloat: left;\t\t\r\n}\r\n.seoresult span.true {\r\n\tbackground-color: #22D32A;\r\n}\r\n.seoresult span.false {\r\n\tbackground-color: #fff;\r\n}\r\n\r\n/* message ........................................................ */\r\n\r\n#message {\r\n\tpadding: 22px;\r\n}\r\n#icon {\r\n\twidth: 32px;\r\n\theight: 32px;\r\n\tfloat: left;\r\n\tposition: relative;\r\n\ttop: 2px;\r\n\tcolor: #5FC0DC;\r\n}\r\n#text {\r\n\tpadding-left: 44px;\r\n\t-moz-user-select: none;\r\n}\r\n#desc {\r\n\tclear: both;\r\n\tpadding-top: 10px;\r\n\tcolor: graytext;\r\n}\r\n#warning {\r\n\tpadding-right: 3px;\t\r\n}\r\n\r\n\r\n/* result table*/\r\n.resulttable {\r\n\tbackground: #EFEFEF;\r\n\tborder: 1px solid #D4D4D4;\r\n}\r\n\r\n.resulttable ui|toolbarbutton {\r\n    margin-left: 10px;\r\n}\r\n\r\n\r\n.resulttable ui|datainput {\r\n\tfloat: left;\r\n}\r\n\r\n.resulttable thead th {\r\n\theight: 50px;\r\n\twhite-space: nowrap;\r\n\tpadding: 10px 35px 10px 10px;\r\n\ttext-align: left;\r\n\tbackground: #F7F7F7;\r\n\tfont-weight: normal;\r\n\tfont-size: 14px;\r\n\tcolor: #000;\r\n\r\n}\r\n\r\n.seoform {\r\n\twidth: 250px;\r\n\r\n}\r\n\r\n.resulttable thead th:last-child {\r\n\twidth: 100%;\r\n}\r\n.resulttable tbody td {\r\n\tposition: relative;\r\n\theight: 30px;\r\n\tborder-top: 1px solid #ccc;\r\n\tfont-size: 14px;\r\n\tcolor: #000;\r\n}\r\n\r\n.resulttable tbody td.true:after {\r\n\tposition: absolute;\r\n\tcontent: \"\";\r\n\ttop: 5px;\r\n\tleft: 12px;\r\n\twidth: 14px;\r\n\theight: 7px;\r\n\tborder: 1px solid #22D32A;\r\n\tborder-width: 0 0 1px 1px;\r\n    -ms-transform: rotate(-40deg); /* IE 9 */\r\n    -webkit-transform: rotate(-40deg); /* Chrome, Safari, Opera */\r\n\ttransform:rotate(-40deg);\r\n}\r\n\r\n\r\n.resulttable tbody td.false:after {\r\n\tposition: absolute;\r\n\tcontent: '×';\r\n\ttop: 4px;\r\n\tleft: 10px;\r\n\twidth: 15px;\r\n\theight: 15px;\r\n\tcolor: #EA6458;\r\n\tline-height: 15px;\r\n    font-size: 24px;\r\n    font-weight: bold;\r\n}\r\n\r\n.resulttable tbody td.score {\r\n\tpadding-left: 30px;\r\n\twidth: 90px;\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/content/views/showelementinformation/Default.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"Default.aspx.cs\" Inherits=\"ShowElementInformation_Default\" %>\r\n\r\n<%@ Register TagPrefix=\"control\" TagName=\"httpheaders\" Src=\"~/Composite/controls/HttpHeadersControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"scriptloader\" Src=\"~/Composite/controls/ScriptLoaderControl.ascx\" %>\r\n<%@ Register TagPrefix=\"control\" TagName=\"styleloader\" Src=\"~/Composite/controls/StyleLoaderControl.ascx\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n<head>\r\n    <title>Element Information</title>\r\n    <control:styleloader ID=\"Styleloader1\" runat=\"server\" />\r\n    <control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n</head>\r\n<body>\r\n    <ui:page label=\"Element Information\" image=\"${icon:zoom}\">\r\n        <ui:scrollbox>\r\n            <asp:PlaceHolder ID=\"ElementInformationPlaceHolder\" runat=\"server\" />\r\n        </ui:scrollbox>\r\n    </ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/content/views/showelementinformation/Default.aspx.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Web.UI;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Serialization;\r\n\r\n\r\npublic partial class ShowElementInformation_Default : System.Web.UI.Page\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        if (Request.QueryString[\"PiggyBagId\"] == null)\r\n        {\r\n            ElementInformationPlaceHolder.Controls.Add(new LiteralControl(\"No entity token.... nothing to do.... \"));\r\n\r\n            return;\r\n        }\r\n\r\n        Guid piggybagId = new Guid(Request.QueryString[\"PiggyBagId\"]);\r\n        string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format(\"{0}.showinfo\", piggybagId));\r\n\r\n        string[] showinfo = C1File.ReadAllLines(filename);\r\n\r\n        string serializedEntityToken = showinfo[0];\r\n        string serializedPiggyBag = showinfo[1];\r\n\r\n        EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n        Dictionary<string, string> dic = StringConversionServices.ParseKeyValueCollection(serializedPiggyBag);\r\n        Dictionary<string, string> piggybag = new Dictionary<string, string>();\r\n        foreach (var kvp in dic)\r\n        {\r\n            piggybag.Add(kvp.Key, StringConversionServices.DeserializeValueString(kvp.Value));\r\n        }\r\n\r\n        string entityTokenHtml = entityToken.GetPrettyHtml(piggybag);\r\n\r\n        ElementInformationPlaceHolder.Controls.Add(new LiteralControl(entityTokenHtml));\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/showelementinformation/Default.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class ShowElementInformation_Default\r\n{\r\n\r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n\r\n    /// <summary>\r\n    /// Styleloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::StyleLoaderControl Styleloader1;\r\n\r\n    /// <summary>\r\n    /// Scriptloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader1;\r\n\r\n    /// <summary>\r\n    /// RelationshipGraphHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder ElementInformationPlaceHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/content/views/simplesearch/SimpleSearch.cshtml",
    "content": "﻿@using System.Globalization\r\n@using Composite.Search\r\n@using Composite.C1Console.Security\r\n@using Composite.C1Console.Users\r\n@using Composite.Core\r\n@using Composite.Core.WebClient\r\n@using Composite.Plugins.Search.Endpoint\r\n\r\n\r\n@functions {\r\n\r\n\tconst string FacetSelectionPrefix = \"chk_\";\r\n}\r\n\r\n@{\r\n\tif (!UserValidationFacade.IsLoggedIn())\r\n\t{\r\n\t\t@: No user logged in\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!SearchFacade.SearchEnabled)\r\n\t{\r\n\t\t@: The search functionality is not enabled\r\n\t\treturn;\r\n\t}\r\n\r\n\tstring text = null;\r\n\tEntityToken searchRoot = null;\r\n\tConsoleSearchResult result = null;\r\n\tstring sortField = null;\r\n\tbool sortByAscending = true;\r\n\tIList<DocumentField> facetFields = null;\r\n\r\n\tif (IsPost)\r\n\t{\r\n\t\ttext = Request[\"q\"];\r\n\t\tsortField = Request[\"sf\"];\r\n\t\tsortByAscending = bool.Parse(Request[\"sfd\"]);\r\n\r\n\t\t//string root = Request[\"r\"];\r\n\t\t//if (root != null)\r\n\t\t//{\r\n\t\t//\tsearchRoot = EntityTokenSerializer.Deserialize(UrlUtils.UnZipContent(root));\r\n\t\t//}\r\n\r\n\t\tif (!string.IsNullOrWhiteSpace(text))\r\n\t\t{\r\n\t\t\tvar selections = new List<ConsoleSearchQuerySelection>();\r\n\t\t\tforeach (string key in Request.Form.Keys)\r\n\t\t\t{\r\n\t\t\t\tif (key.StartsWith(FacetSelectionPrefix))\r\n\t\t\t\t{\r\n\t\t\t\t\tstring fieldName = key.Substring(FacetSelectionPrefix.Length);\r\n\t\t\t\t\tstring[] values = Request.Form[key].Split(',');\r\n\r\n\t\t\t\t\tselections.Add(new ConsoleSearchQuerySelection\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFieldName = fieldName,\r\n\t\t\t\t\t\tValues = values\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar query = new ConsoleSearchQuery\r\n\t\t\t{\r\n\t\t\t\tText = text,\r\n\t\t\t\tSelections = selections.ToArray(),\r\n\t\t\t\tCultureName = UserSettings.ActiveLocaleCultureInfo.Name,\r\n\t\t\t\tSortBy = sortField,\r\n\t\t\t\tSortInReverseOrder = !sortByAscending\r\n\t\t\t};\r\n\r\n\t\t\tvar service = new ConsoleSearchRpcService(\r\n\t\t\t\tServiceLocator.GetService<ISearchProvider>(),\r\n\t\t\t\tServiceLocator.GetServices<ISearchDocumentSourceProvider>());\r\n\t\t\t//result = SearchFacade.ConsoleSearchRpcService(query, true, searchRoot).Result;\r\n\r\n\t\t\tresult = service.QueryAsync(query).Result;\r\n\t\t}\r\n\t}\r\n}\r\n<html>\r\n<head>\r\n\t<style type=\"text/css\">\r\n\t\t table thead { background-color: grey;font-weight: bold; color: white }\r\n\t\t table thead a { color: white;}\r\n\t\t table tbody tr:nth-child(even) { background-color: #EEEEEE }\r\n\t\t table td { padding: 2px 10px }\r\n\t\t table { padding-bottom: 10px; }\r\n\r\n\t\t .facets { clear: both; padding-bottom: 20px; width: 100%; }\r\n\t\t .facets .facet { width: 300px; float: left; }\r\n\r\n\t\t .clearfix:after {\r\n\t\t\tvisibility: hidden;\r\n\t\t\tdisplay: block;\r\n\t\t\tfont-size: 0;\r\n\t\t\tcontent: \" \";\r\n\t\t\tclear: both;\r\n\t\t\theight: 0;\r\n\t\t\t}\r\n\t</style>\r\n\t<script type=\"text/javascript\">\r\n\t\tfunction Sort(fieldName, isAsc) {\r\n\t\t\tdocument.getElementById('sortField').value = fieldName;\r\n\t\t\tdocument.getElementById('sortAsc').value = isAsc ? 'true' : 'false';\r\n\t\t\tdocument.getElementById(\"search\").submit();\r\n\t\t}\r\n\t</script>\r\n</head>\r\n<body>\r\n\r\n<h1>Search</h1>\r\n<form method=\"POST\" id=\"search\">\r\n\t<div>\r\n\t\t<input name=\"q\" type=\"text\" class=\"searchfield\" value=\"@text\"/>\r\n\r\n\t\t<input id=\"sortField\" name=\"sf\" value=\"@sortField\" type=\"hidden\"/>\r\n\t\t<input id=\"sortAsc\" name=\"sfd\" value=\"@sortByAscending.ToString()\" type=\"hidden\" />\r\n\t</div>\r\n\t<input type=\"submit\"/>\r\n\r\n\t@if (result != null)\r\n\t{\r\n\t\t@ResultFacets(result)\r\n\t}\r\n</form>\r\n\t\r\n@if (result != null)\r\n{\r\n\t@ResultTable(result, sortField, sortByAscending)\r\n\r\n\tif (!string.IsNullOrEmpty(sortField))\r\n\t{\r\n\t\t<div>\r\n\t\t\tSorted by: @sortField\r\n\t\t</div>\r\n\t}\r\n\r\n\t<div>\r\n\t\tTotal hits: @result.TotalHits\r\n\t</div>\r\n}\r\n\r\n</body>\r\n</html>\r\n\r\n@helper ResultFacets(ConsoleSearchResult result)\r\n{\r\n\tif (result.FacetFields == null)\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\r\n\t<div class=\"facets clearfix\">\r\n\t\t@foreach (var facetField in result.FacetFields)\r\n\t\t{\r\n\t\t\tstring checkBoxName = FacetSelectionPrefix + facetField.FieldName;\r\n\t\t\tstring[] preselectedValues = (Request.Form[checkBoxName] ?? \"\").Split(',');\r\n\r\n\t\t\t<div class=\"facet\">\r\n\t\t\t\t<h2>@facetField.Label</h2>\r\n\t\t\t\t@{\r\n\t\t\t\t\tint optionIndex = 0;\r\n\t\t\t\t}\r\n\t\t\t\t@foreach (var facet in facetField.Facets)\r\n\t\t\t\t{\r\n\t\t\t\t\toptionIndex++;\r\n\r\n\t\t\t\t\tbool @checked = preselectedValues.Contains(facet.Value);\r\n\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<input type=\"checkbox\" id=\"@checkBoxName@optionIndex\" name=\"@checkBoxName\" value=\"@facet.Value\"\r\n\t\t\t\t\t\t       @if (@checked)\r\n\t\t\t\t\t\t       {<text>checked=\"checked\"</text>}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t<label for=\"@checkBoxName@optionIndex\">\r\n\t\t\t\t\t\t\t@facet.Label [@facet.HitCount]\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t}\r\n\t\t\t</div>\r\n\t\t}\r\n\t</div>\r\n}\r\n\r\n@helper ResultTable(ConsoleSearchResult result, string sortField, bool sortAscending)\r\n{\r\n\tif (result.TotalHits == 0)\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\r\n\t<div class=\"results\">\r\n\t\t<table>\r\n\t\t\t<thead>\r\n\t\t\t<tr>\r\n\t\t\t\t@foreach (var column in result.Columns)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar fieldName = column.FieldName;\r\n\r\n\t\t\t\t\t<td>\r\n\t\t\t\t\t\t@if (column.Sortable)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (fieldName == sortField)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t@(sortAscending ? \"▲\" : \"▼\")\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t<a href=\"#\" onclick=\"Sort('@fieldName', @((fieldName != sortField || !sortAscending) ? \"true\" : \"false\"))\">\r\n\t\t\t\t\t\t\t\t<label title=\"@fieldName\">\r\n\t\t\t\t\t\t\t\t\t@column.Label\r\n\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t<label title=\"@fieldName\">\r\n\t\t\t\t\t\t\t\t@column.Label\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t</td>\r\n\t\t\t\t}\r\n\t\t\t</tr>\r\n\t\t\t</thead>\r\n\t\t\t<tbody>\r\n\t\t\t\t@foreach (var row in result.Rows)\r\n\t\t\t\t{\r\n\t\t\t\t\tint index = 0;\r\n\t\t\t\t\t<tr class=\"hit\">\r\n\t\t\t\t\t\t@foreach (var column in result.Columns)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstring value;\r\n\t\t\t\t\t\t\tbool isFirst = index++ == 0;\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t@if (row.Values.TryGetValue(column.FieldName, out value))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif (isFirst)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t<a href=\"@row.Url\" target=\"_top\">\r\n\t\t\t\t\t\t\t\t\t\t\t@value\r\n\t\t\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t@value\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t}\r\n\t\t\t</tbody>\r\n\t\t</table>\r\n\t</div>\r\n}"
  },
  {
    "path": "Website/Composite/content/views/start/GetStartPage.ashx",
    "content": "﻿<%@ WebHandler Language=\"C#\" Class=\"FetchPage\" %>\r\n\r\nusing System;\r\nusing System.IO;\r\nusing System.Net;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Web;\r\n\r\nusing Composite;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient;\r\n\r\npublic class FetchPage : IHttpHandler\r\n{\r\n\tpublic void ProcessRequest (HttpContext context)\r\n\t{\r\n\t\tstring userCultureName = UserSettings.CultureInfo.Name;\r\n\t\tstring productVersion = RuntimeInformation.ProductVersion.ToString(4);\r\n\t\tstring installationId = InstallationInformationFacade.InstallationId.ToString();\r\n\t\tstring browser = context.Request.UserAgent.IndexOf(\"Gecko\") > -1 ? \"mozilla\" : \"explorer\";\r\n\t\tstring platform = context.Request.Browser.Platform;\r\n\r\n\t\tstring baseUriString = System.Configuration.ConfigurationManager.AppSettings[\"Composite.StartPage.Url\"];\r\n\t\tstring sourceUriString = string.Format(\"{0}?culture={1}&version={2}&installation={3}&browser={4}&platform={5}&environment={6}\",\r\n\t\t\tbaseUriString,\r\n\t\t\tHttpUtility.UrlEncode(userCultureName, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(productVersion, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(installationId, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(browser, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(platform, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(Environment(context), Encoding.UTF8)\r\n\t\t\t);\r\n\r\n\t\tUri sourceUri = new Uri(sourceUriString);\r\n\r\n\t\tvar request = (HttpWebRequest)HttpWebRequest.Create(sourceUri);\r\n\t\trequest.UserAgent = context.Request.Headers[\"User-Agent\"];\r\n\t\trequest.Timeout = 2000;\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\tWebResponse webResponse = request.GetResponse();\r\n\r\n\t\t\tstring contentType = webResponse.ContentType;\r\n\r\n\t\t\tstring content;\r\n\r\n\t\t\tusing (Stream responseStream = webResponse.GetResponseStream())\r\n\t\t\tusing (var streamReader = new C1StreamReader(responseStream))\r\n\t\t\t{\r\n\t\t\t\tcontent = streamReader.ReadToEnd();\r\n\t\t\t}\r\n\r\n\t\t\tcontext.Response.ContentType = contentType;\r\n\t\t\tcontext.Response.Write(content);\r\n\t\t}\r\n\t\tcatch( Exception )\r\n\t\t{\r\n\t\t\tcontext.Response.Redirect( UrlUtils.ResolveAdminUrl( \"blank.aspx\" ));\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tprivate string Environment(HttpContext context)\r\n\t{\r\n\t\tvar encoder = new UTF8Encoding();\r\n\t\tvar hashBuilder = (HashAlgorithm)CryptoConfig.CreateFromName(\"MD5\");\r\n\t\tbyte[] appBytes = encoder.GetBytes(context.Request.PhysicalApplicationPath);\r\n\t\tbyte[] hostBytes = encoder.GetBytes(context.Request.Url.Host);\r\n\t\tbyte[] appHashed = hashBuilder.ComputeHash(appBytes); // anonymize\r\n\t\tbyte[] hostHashed = hashBuilder.ComputeHash(hostBytes); //anonymize\r\n\r\n\t\treturn string.Format(\"{0}-{1}\",\r\n\t\t\tBitConverter.ToString(hostHashed).Replace(\"-\", string.Empty).ToLower(),\r\n\t\t\tBitConverter.ToString(appHashed).Replace(\"-\", string.Empty).ToLower());\r\n\t}\r\n\r\n\tpublic bool IsReusable\r\n\t{\r\n\t\tget\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n}"
  },
  {
    "path": "Website/Composite/content/views/start/StartPageBinding.js",
    "content": "StartPageBinding.prototype = new PageBinding;\r\nStartPageBinding.prototype.constructor = StartPageBinding;\r\nStartPageBinding.superclass = PageBinding.prototype;\r\n\r\nStartPageBinding.VIEW_CLASSNAME = \"startpage-view\";\r\n/**\r\n * @class\r\n */\r\nfunction StartPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StartPageBinding\" );\r\n\r\n\t/**\r\n\t * This object gets loaded in the start page frame.\r\n\t * @type {CompositeStart}\r\n\t */\r\n\tthis._starter = null;\r\n\r\n\t/**\r\n\t * True when Start screen is visible.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isShowingStart = false;\r\n\r\n\t/**\r\n\t * Container ViewBinding.\r\n\t * @type {ViewBinding}\r\n\t */\r\n\tthis._viewBinding = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStartPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StartPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBindingRegister}\r\n */\r\nStartPageBinding.prototype.onBindingRegister = function () {\r\n\r\n\tStartPageBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\tApplication.hasStartPage = Application.hasExternalConnection;\r\n\r\n\tif (Application.hasStartPage) {\r\n\t\tthis.addActionListener(WindowBinding.ACTION_ONLOAD);\r\n\t\tthis.addActionListener(ControlBinding.ACTION_COMMAND);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.START_COMPOSITE, this);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.STOP_COMPOSITE, this);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.COMPOSITE_START, this);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.COMPOSITE_STOP, this);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.KEY_ESCAPE, this);\r\n\t\tthis._viewBinding = this.getAncestorBindingByType(ViewBinding, true);\r\n\t\tif (this._viewBinding) {\r\n\t\t\tDOMEvents.addEventListener(this._viewBinding.bindingElement, DOMEvents.CLICK, this);\r\n\t\t\tthis._viewBinding.attachClassName(StartPageBinding.VIEW_CLASSNAME);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Load start page with a random querystring to avoid client cache.\r\n * @overloads {PageBinding#onBindingAttach}\r\n */\r\nStartPageBinding.prototype.onBindingAttach = function () {\r\n\r\n\t/*\r\n\t * compositestart/CompositeStart.aspx\r\n\t */\r\n\tStartPageBinding.superclass.onBindingAttach.call(this);\r\n\tif (Application.hasStartPage) {\r\n\t\tthis.bindingWindow.bindingMap.start.setURL(\r\n\t\t\t\"GetStartPage.ashx?random=\" + KeyMaster.getUniqueKey()\r\n\t\t);\r\n\t}\r\n\r\n\tthis.dispatchAction(StageBinding.ACTION_START_LOADED);\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#handleEvent}\r\n * @implements {IEventListener}\r\n * @param {Event} e\r\n */\r\nStartPageBinding.prototype.handleEvent = function (e) {\r\n\r\n\tStartPageBinding.superclass.handleEvent.call(this, e);\r\n\tvar element = DOMEvents.getTarget(e);\r\n\tswitch (e.type) {\r\n\t\tcase DOMEvents.CLICK:\r\n\t\t\tif (this._viewBinding && this._viewBinding.bindingElement == element) {\r\n\t\t\t\tthis.stop();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nStartPageBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tStartPageBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\tcase WindowBinding.ACTION_ONLOAD :\r\n\t\t\tif ( action.target == bindingMap.start ) {\r\n\t\t\t\tthis._starter = bindingMap.start.getContentWindow ().CompositeStart;\r\n\t\t\t\tif (this._starter && this._starter.hasCloseButton)\r\n\t\t\t\t{\r\n\t\t\t\t\tbindingMap.controlgroup.hide();\r\n\t\t\t\t}\r\n\t\t\t\tif (this._isShowingStart) {\r\n\t\t\t\t\tthis.start();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase ControlBinding.ACTION_COMMAND :\r\n\t\t\tif ( action.target == bindingMap.closecontrol ) {\r\n\t\t\t\tif ( bindingMap.cover ) {\r\n\t\t\t\t\tbindingMap.cover.show ();\r\n\t\t\t\t}\r\n\t\t\t\tthis.stop();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Open starter page\r\n */\r\nStartPageBinding.prototype.start = function () {\r\n\r\n\t//check that starter page have start function, otherwise send direct broadcast\r\n\tif (this._starter && this._starter.start) {\r\n\t\ttry {\r\n\t\t\tthis._starter.start();\r\n\t\t} catch (exception) {\r\n\t\t\tSystemDebug.stack(arguments);\r\n\t\t}\r\n\t} else {\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.COMPOSITE_START);\r\n\t}\r\n}\r\n\r\n/**\r\n * Close starter page\r\n */\r\nStartPageBinding.prototype.stop = function () {\r\n\r\n\t//check that starter page have stop function, otherwise send direct broadcast\r\n\tif (this._starter) {\r\n\t\ttry {\r\n\t\t\tthis._starter.stop();\r\n\t\t} catch (exception) {\r\n\t\t\tSystemDebug.stack(arguments);\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.COMPOSITE_STOP);\r\n\t\t}\r\n\t} else {\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.COMPOSITE_STOP);\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @overloads {PageBinding#handleBroadcast}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nStartPageBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tStartPageBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\r\n\t\tcase BroadcastMessages.START_COMPOSITE:\r\n\t\t\tthis._isShowingStart = true;\r\n\t\t\tthis.start();\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.STOP_COMPOSITE :\r\n\t\t\tthis.stop();\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.COMPOSITE_START: // broadcated by CompositeStart when ready\r\n\t\t\tif ( bindingMap.cover ) {\r\n\t\t\t\tbindingMap.cover.hide ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.COMPOSITE_STOP:\r\n\t\t\tthis._isShowingStart = false;\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.KEY_ESCAPE:\r\n\t\t\tif (this._isShowingStart) {\r\n\t\t\t\tthis.stop();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/content/views/start/start.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.Start</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<control:brandingSnippet SnippetName=\"start-page-js\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t\t<control:brandingSnippet SnippetName=\"start-page-content\" runat=\"server\" />\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/content/views/systemview/systemview.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.SystemView</title>\r\n\t\t<control:styleloader runat=\"server\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<ui:page binding=\"SystemPageBinding\" id=\"page\">\r\n\t\t\t<ui:tree id=\"tree\" binding=\"SystemTreeBinding\" locktoeditor=\"true\">\r\n\t\t\t\t<ui:treebody/>\r\n\t\t\t</ui:tree>\r\n\t\t</ui:page>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/controls/AppInitializerControl.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"AppInitializerControl.ascx.cs\" Inherits=\"AppInitializerControl\" %>"
  },
  {
    "path": "Website/Composite/controls/AppInitializerControl.ascx.cs",
    "content": "using System;\r\nusing System.Web;\r\nusing Composite;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.WebClient;\r\n\r\n/**\r\n * Simply store developermode on session. \r\n */\r\npublic partial class AppInitializerControl : System.Web.UI.UserControl\r\n{\r\n    protected void Page_Init(object sender, EventArgs e)\r\n    {\r\n\r\n        /*\r\n         * Set the browsing mode cookie.\r\n         */\r\n        string mode = Request.QueryString[\"mode\"];\r\n\r\n        if (String.IsNullOrEmpty(mode))\r\n        {\r\n            CookieHandler.Set(\"mode\", \"operate\");\r\n        }\r\n        else\r\n        {\r\n            CookieHandler.Set(\"mode\", mode == \"develop\" ? \"develop\" : \"operate\");\r\n        }\r\n\r\n        /*\r\n         * Set the version cookie. If version doesn't match \r\n         * last session version, redirect to upgraded page.\r\n         */\r\n        string nowversion = Composite.RuntimeInformation.ProductVersion.ToString();\r\n\r\n        bool isUpdated = false;\r\n        if (CookieHandler.Get(\"CompositeVersionString\") != null)\r\n        {\r\n            string oldversion = CookieHandler.Get(\"CompositeVersionString\");\r\n            if (nowversion != oldversion)\r\n            {\r\n                var installationAge = DateTime.Now - SystemSetupFacade.GetFirstTimeStart();\r\n                isUpdated = installationAge.TotalMinutes > 5;\r\n            }\r\n        }\r\n\r\n        CookieHandler.Set(\"CompositeVersionString\", nowversion, DateTime.Now.AddDays(28));\r\n\r\n        if (!RuntimeInformation.IsDebugBuild && isUpdated)\r\n        {\r\n            string url = \"updated.aspx\";\r\n            if (CookieHandler.Get(\"mode\") == \"develop\")\r\n            {\r\n                url += \"?mode=develop\";\t// TODO: copy entire querystring (no intellisense here)!\r\n            }\r\n            Response.Redirect(url);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/AppInitializerControl.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class AppInitializerControl {\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/BrandingSnippet.ascx",
    "content": "﻿<%@ Control Language=\"C#\" AutoEventWireup=\"true\" %>\n<script runat=\"server\">\n\tconst string contentdHolderFileUrlTemplate = \"../content/branding/{0}{1}.inc\";\n\tpublic string SnippetName { get; set; }\n\n\tprotected void Page_Init(object sender, EventArgs e)\n\t{\n\t\tvar snippetFileUrl = string.Format(contentdHolderFileUrlTemplate, SnippetName, string.Empty);\n\t\tvar snippentBrandedFileUrl = string.Format(contentdHolderFileUrlTemplate, SnippetName, \"-branded\");\n\t\tvar brandedContent = string.Empty;\n\t\tif(Composite.Core.IO.C1File.Exists(this.MapPath(snippentBrandedFileUrl)))\n\t\t{\n\t\t\tbrandedContent = Composite.Core.IO.C1File.ReadAllText(this.MapPath(snippentBrandedFileUrl));\n\t\t}\n\t\tcontentHolder.Text = !string.IsNullOrEmpty(brandedContent) ? brandedContent :Composite.Core.IO.C1File.ReadAllText(this.MapPath(snippetFileUrl));\n\t}\n\n</script>\n<asp:Literal ID=\"contentHolder\" runat=\"server\"></asp:Literal>"
  },
  {
    "path": "Website/Composite/controls/CodePressControl.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"CodePressControl.ascx.cs\" Inherits=\"CodePressControl\" %>"
  },
  {
    "path": "Website/Composite/controls/CodePressControl.ascx.cs",
    "content": "using System;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\n\r\npublic partial class CodePressControl : System.Web.UI.UserControl\r\n{\r\n    protected override void Render(HtmlTextWriter writer)\r\n    {\r\n\t\t\r\n\t\tResponse.ContentType = \"text/html\";\r\n\t\tString _lang = HttpContext.Current.Request.QueryString [ \"lang\" ];\r\n\t\tbool _isMozilla = HttpContext.Current.Request.UserAgent.IndexOf ( \"Gecko\" ) > -1;\r\n\t\tStringBuilder _builder = new StringBuilder ();\r\n\t\t\r\n\t\tif ( null == _lang ) \r\n\t\t{\r\n\t\t\t_lang = \"text\";\r\n\t\t}\r\n\t\t_builder.AppendLine ( @\"<link type=\"\"text/css\"\" href=\"\"languages/codepress-\" + _lang + @\".css\"\" rel=\"\"stylesheet\"\" id=\"\"cp-lang-style\"\" />\" );\r\n\t\t_builder.AppendLine ( @\"<script type=\"\"text/javascript\"\" src=\"\"languages/codepress-\" + _lang + @\".js\"\"></script>\" );\r\n\t\t_builder.AppendLine ( @\"<script type=\"\"text/javascript\"\">CodePress.language=\"\"\" + _lang + @\"\"\";</script>\" );\r\n\t\t_builder.AppendLine ( @\"<script type=\"\"text/javascript\"\" src=\"\"extensions/\" + ( _isMozilla ? \"mozilla\" : \"explorer\" ) + @\".js\"\"></script>\" );\r\n\t\t\r\n\t\twriter.Write ( _builder.ToString ());\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/CodePressControl.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class CodePressControl {\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FieldGroupControl.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"FieldGroupControl.ascx.cs\" Inherits=\"FieldGroupControl\" %>"
  },
  {
    "path": "Website/Composite/controls/FieldGroupControl.ascx.cs",
    "content": "using System;\r\nusing System.Web.UI;\r\n\r\n\r\npublic partial class FieldGroupControl : System.Web.UI.UserControl\r\n{\r\n\t\r\n\t\r\n\tpublic string label;\r\n\tpublic string image;\r\n\r\n\tprotected void Page_Load ( object sender, EventArgs e )\r\n\t{\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/controls/FieldGroupControl.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class FieldGroupControl {\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/DataDialogExecutionContainer.ascx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"DataDialogExecutionContainer.ascx.cs\"\r\n    Inherits=\"Composite_Forms_DataDialogExecutionContainer\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<head id=\"Head1\" runat=\"server\">\r\n\t    <title>Composite.Management.DialogDocument</title>\r\n\t    <control:httpheaders id=\"Httpheaders1\" runat=\"server\" />\r\n\t    <control:styleloader id=\"Styleloader1\" runat=\"server\" />\r\n\t    <control:scriptloader id=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n\t    <asp:PlaceHolder ID=\"HeaderPlaceHolder\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t    <form id=\"form1\" runat=\"server\" class=\"updateDISABLEDform updatezone\">\r\n\t\t    <ui:dialogpage\r\n\t\t    \tid=\"formcontrolpage\"\r\n\t\t    \tlabel=\"<%= Server.HtmlEncode( this.ContainerLabel )%>\"\r\n\t\t    \timage=\"<%= Server.HtmlEncode( this.ContainerIconClientString )%>\"\r\n\t\t        resizable=\"false\">\r\n\r\n\t\t        <aspui:Feedback runat=\"server\"\r\n\t\t        \tID=\"ctlFeedback\"\r\n\t\t        \tOnCommand=\"OnMessage\" />\r\n\r\n\t\t\t\t<asp:PlaceHolder ID=\"customBroadcasterSets\" runat=\"server\" />\r\n\t\t\t\t<asp:PlaceHolder ID=\"formPlaceHolder\" runat=\"server\"/>\r\n\t\t\t\t<div style=\"display: none;\" id=\"clientmessages\">\r\n\t\t\t\t\t<asp:PlaceHolder ID=\"messagePlaceHolder\" runat=\"server\"/>\r\n\t\t\t\t</div>\r\n\t\t\t</ui:dialogpage>\r\n\t    </form>\r\n\t</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/DataDialogExecutionContainer.ascx.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Web.UI.WebControls;\r\n\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Plugins.Forms.WebChannel.UiContainerFactories;\r\n\r\n\r\npublic partial class Composite_Forms_DataDialogExecutionContainer : TemplatedUiContainerBase\r\n{\r\n    private PlaceHolder formPlaceHolder2 = new PlaceHolder();\r\n    private PlaceHolder messagePlaceHolder2 = new PlaceHolder();\r\n\r\n    protected string ContainerLabel { get; private set; }\r\n    protected ResourceHandle ContainerIcon { get; private set; }\r\n\r\n    protected string ContainerIconClientString\r\n    {\r\n        get\r\n        {\r\n            if (this.ContainerIcon != null)\r\n            {\r\n                return string.Format(\"${{icon:{0}:{1}}}\", this.ContainerIcon.ResourceNamespace, this.ContainerIcon.ResourceName);\r\n            }\r\n            else\r\n            {\r\n                return \"${icon:default}\";\r\n            }\r\n        }\r\n    }\r\n\r\n    public override System.Web.UI.Control GetFormPlaceHolder()\r\n    {\r\n        return formPlaceHolder2;\r\n    }\r\n\r\n    public override System.Web.UI.Control GetMessagePlaceHolder()\r\n    {\r\n        return messagePlaceHolder2;\r\n    }\r\n\r\n    public override void SetContainerTitle(string containerLabel)\r\n    {\r\n        this.ContainerLabel = containerLabel;\r\n    }\r\n\r\n    public override void SetContainerIcon(ResourceHandle icon)\r\n    {\r\n        this.ContainerIcon = icon;\r\n    }\r\n\r\n    protected void Page_Init(object sender, EventArgs e)\r\n    {\r\n        formPlaceHolder.Controls.Add(formPlaceHolder2);\r\n        messagePlaceHolder.Controls.Add(messagePlaceHolder2);\r\n\r\n        Page.Items.Add(\"CustomBroadcasterSets\", this.customBroadcasterSets);\r\n    }\r\n\r\n    public override void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages)\r\n    {\r\n        foreach (var msgElement in clientIDPathedMessages)\r\n        {\r\n            FieldMessage fieldMessage = new FieldMessage(msgElement.Key, msgElement.Value);\r\n            messagePlaceHolder.Controls.Add(fieldMessage);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/DataDialogExecutionContainer.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3603\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_Forms_DataDialogExecutionContainer {\r\n    \r\n    /// <summary>\r\n    /// Head1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlHead Head1;\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Styleloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::StyleLoaderControl Styleloader1;\r\n    \r\n    /// <summary>\r\n    /// Scriptloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader1;\r\n    \r\n    /// <summary>\r\n    /// HeaderPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder HeaderPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm form1;\r\n    \r\n    /// <summary>\r\n    /// SM1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.ScriptManager SM1;\r\n    \r\n    /// <summary>\r\n    /// customBroadcasterSets control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder customBroadcasterSets;\r\n    \r\n    /// <summary>\r\n    /// formPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder formPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// messagePlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder messagePlaceHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/DocumentExecutionContainer.ascx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Control Language=\"C#\" AutoEventWireup=\"true\" Inherits=\"Composite_Forms_DocumentExecutionContainer\" CodeFile=\"DocumentExecutionContainer.ascx.cs\" %>\r\n<%@ Register TagPrefix=\"aspui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.Document</title>\r\n\t\t<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n\t\t<control:styleloader ID=\"Styleloader1\" runat=\"server\" />\r\n\t\t<control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n\t\t<asp:PlaceHolder ID=\"HeaderPlaceHolder\" runat=\"server\" />\r\n\t</head>\r\n\t<body id=\"root\">\r\n\t\t<form id=\"form1\" runat=\"server\" class=\"updateform updatezone\">\r\n\t\t\t<ui:editorpage id=\"formcontrolpage\" \r\n            \timage=\"<%= Server.HtmlEncode ( this.ContainerIconClientString ) %>\"\r\n\t\t\t    label=\"<%= Server.HtmlEncode ( this.ContainerLabel ) %>\"\r\n                labelfield=\"<%= Server.HtmlEncode( GetTitleFieldControlId() ) %>\"\r\n\t\t\t\t<% if (this.ContainerTooltip != null) { %>\r\n\t\t\t\t\ttooltip=\"<%= Server.HtmlEncode ( this.ContainerTooltip ) %>\"\r\n\t\t\t\t<% } %>\r\n\t\t\t>\r\n\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t\t</ui:broadcasterset> \r\n\r\n                <aspui:Feedback runat=\"server\" \r\n                    ID=\"ctlFeedback\"\r\n                    OnCommand=\"OnMessage\" />\r\n\r\n\t\t\t\t<asp:PlaceHolder ID=\"customBroadcasterSets\" runat=\"server\" />\r\n\t\t\t\t<asp:PlaceHolder ID=\"formPlaceHolder\" runat=\"server\" />\r\n                <div id=\"TEMP_ID\">\r\n\t\t\t\t<asp:PlaceHolder ID=\"messagePlaceHolder\" runat=\"server\"/>\r\n                </div>\r\n\t\t\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/DocumentExecutionContainer.ascx.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Web.UI.WebControls;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Plugins.Forms.WebChannel.UiContainerFactories;\r\n\r\npublic partial class Composite_Forms_DocumentExecutionContainer : TemplatedUiContainerBase\r\n{\r\n    private readonly PlaceHolder formPlaceHolder2 = new PlaceHolder();\r\n    private readonly PlaceHolder messagePlaceHolder2 = new PlaceHolder();\r\n\r\n    protected string ContainerLabel { get; private set; }\r\n    protected string ContainerTooltip { get; private set; }\r\n    protected ResourceHandle ContainerIcon { get; private set; }\r\n\r\n    protected string ContainerIconClientString\r\n    {\r\n        get\r\n        {\r\n            if (ContainerIcon == null)\r\n            {\r\n                return \"${icon:default}\";\r\n            }\r\n\r\n            return string.Format(\"${{icon:{0}:{1}}}\", ContainerIcon.ResourceNamespace, ContainerIcon.ResourceName);\r\n            \r\n        }\r\n    }\r\n\r\n    public override System.Web.UI.Control GetFormPlaceHolder()\r\n    {\r\n        return formPlaceHolder2;\r\n    }\r\n\r\n    public override System.Web.UI.Control GetMessagePlaceHolder()\r\n    {\r\n        return messagePlaceHolder2; \r\n    }\r\n\r\n    public override void SetContainerTitle(string containerTitle)\r\n    {\r\n        this.ContainerLabel = containerTitle;\r\n    }\r\n\r\n    public override void SetContainerTooltip(string containerTooltip)\r\n    {\r\n        this.ContainerTooltip = containerTooltip;\r\n    }\r\n\r\n    public override void SetContainerIcon(ResourceHandle icon)\r\n    {\r\n        this.ContainerIcon = icon;\r\n    }\r\n\r\n    protected void Page_Init(object sender, EventArgs e)\r\n    {\r\n        formPlaceHolder.Controls.Add(formPlaceHolder2);\r\n        messagePlaceHolder.Controls.Add(messagePlaceHolder2);\r\n\r\n        Page.Items.Add(\"CustomBroadcasterSets\", this.customBroadcasterSets);\r\n    }\r\n\r\n    public override void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages)\r\n    {\r\n        foreach (var msgElement in clientIDPathedMessages)\r\n        {\r\n            FieldMessage fieldMessage = new FieldMessage(msgElement.Key, msgElement.Value);\r\n            messagePlaceHolder.Controls.Add(fieldMessage);\r\n        }\r\n    }\r\n    \r\n    public void OnMessage()\r\n    {\r\n        string message = ctlFeedback.GetPostedMessage();\r\n\r\n        if (message == \"save\")\r\n        {\r\n            var flowPage = (this.Page as FlowPage);\r\n            flowPage.OnSave(null, null);\r\n\r\n            ctlFeedback.SetStatus(flowPage.SaveStepSucceeded);\r\n        }\r\n        else if (message == \"saveandpublish\")\r\n        {\r\n            var flowPage = (this.Page as FlowPage);\r\n            flowPage.OnSaveAndPublish(null, null);\r\n\r\n            ctlFeedback.SetStatus(flowPage.SaveStepSucceeded);\r\n        }\r\n        else if (message == \"persist\")\r\n        {\r\n            ctlFeedback.SetStatus(true);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/DocumentExecutionContainer.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_Forms_DocumentExecutionContainer {\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Styleloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::StyleLoaderControl Styleloader1;\r\n    \r\n    /// <summary>\r\n    /// Scriptloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader1;\r\n    \r\n    /// <summary>\r\n    /// HeaderPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder HeaderPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm form1;\r\n    \r\n    /// <summary>\r\n    /// ctlFeedback control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite.Core.WebClient.UiControlLib.Feedback ctlFeedback;\r\n    \r\n    /// <summary>\r\n    /// customBroadcasterSets control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder customBroadcasterSets;\r\n    \r\n    /// <summary>\r\n    /// formPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder formPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// messagePlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder messagePlaceHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/EmptyDocumentExecutionContainer.ascx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"EmptyDocumentExecutionContainer.ascx.cs\" Inherits=\"Composite_Forms_EmptyDocumentExecutionContainer\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<head runat=\"server\">\r\n\t\t<title>Composite.Management.EmptyDocument</title>\r\n\t\t<control:httpheaders ID=\"Httpheaders1\" runat=\"server\" />\r\n\t\t<control:styleloader ID=\"Styleloader1\" runat=\"server\" />\r\n\t\t<control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n\t\t<asp:PlaceHolder ID=\"HeaderPlaceHolder\" runat=\"server\" />\r\n\t</head>\r\n\t<body id=\"root\">\r\n\t\t<form id=\"form1\" runat=\"server\" class=\"updateform updatezone\">\r\n\t\t\t<ui:editorpage \r\n\t\t\t\tid=\"formcontrolpage\"\r\n            \timage=\"<%= Server.HtmlEncode( this.ContainerIconClientString )%>\"\r\n\t\t\t    label=\"<%= Server.HtmlEncode( this.ContainerLabel )%>\">\r\n\t\t\t\t\r\n\t\t\t\t<aspui:Feedback runat=\"server\" \r\n\t\t\t\t\tID=\"ctlFeedback\" \r\n\t\t\t\t\tOnCommand=\"OnMessage\" />\r\n\t\t\t\t\t\r\n\t\t\t\t<ui:broadcasterset>\r\n\t\t\t\t\t<ui:broadcaster id=\"broadcasterCanSave\" isdisabled=\"true\" />\r\n\t\t\t\t</ui:broadcasterset>\r\n\t\t\t\t \r\n\t\t\t\t<asp:PlaceHolder ID=\"customBroadcasterSets\" runat=\"server\" />\r\n\t\t\t\t<asp:PlaceHolder ID=\"formPlaceHolder\" runat=\"server\" />\r\n\t\t\t\t<asp:PlaceHolder ID=\"messagePlaceHolder\" runat=\"server\" />\r\n\t\t\t\t\t\r\n\t\t\t</ui:editorpage>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/EmptyDocumentExecutionContainer.ascx.cs",
    "content": "using System.Web.UI;\r\n\r\nusing Composite.Plugins.Forms.WebChannel.UiContainerFactories;\r\nusing System.Web.UI.WebControls;\r\nusing System;\r\nusing System.Web;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\npublic partial class Composite_Forms_EmptyDocumentExecutionContainer : TemplatedUiContainerBase\r\n{\r\n    private PlaceHolder formPlaceHolder2 = new PlaceHolder();\r\n    private PlaceHolder messagePlaceHolder2 = new PlaceHolder();\r\n\r\n    protected string ContainerLabel { get; private set; }\r\n    protected ResourceHandle ContainerIcon { get; private set; }\r\n\r\n    protected string ContainerIconClientString\r\n    {\r\n        get\r\n        {\r\n            if (this.ContainerIcon != null)\r\n            {\r\n                return string.Format(\"${{icon:{0}:{1}}}\", this.ContainerIcon.ResourceNamespace, this.ContainerIcon.ResourceName);\r\n            }\r\n            else\r\n            {\r\n                return \"${icon:default}\";\r\n            }\r\n        }\r\n    }\r\n\r\n    public override Control GetFormPlaceHolder()\r\n    {\r\n        return formPlaceHolder2;\r\n    }\r\n\r\n    public override Control GetMessagePlaceHolder()\r\n    {\r\n        return messagePlaceHolder2; \r\n    }\r\n\r\n    public override void SetContainerTitle(string containerLabel)\r\n    {\r\n        this.ContainerLabel = containerLabel;\r\n    }\r\n\r\n    public override void SetContainerIcon(ResourceHandle icon)\r\n    {\r\n        this.ContainerIcon = icon;\r\n    }\r\n\r\n    protected void Page_Init(object sender, EventArgs e)\r\n    {\r\n        formPlaceHolder.Controls.Add(formPlaceHolder2);\r\n        messagePlaceHolder.Controls.Add(messagePlaceHolder2);\r\n\r\n        Page.Items.Add(\"CustomBroadcasterSets\", this.customBroadcasterSets);\r\n    }\r\n\r\n    public override void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages)\r\n    {\r\n        foreach (var msgElement in clientIDPathedMessages)\r\n        {\r\n            FieldMessage fieldMessage = new FieldMessage(msgElement.Key, msgElement.Value);\r\n            messagePlaceHolder.Controls.Add(fieldMessage);\r\n        }\r\n    }\r\n\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/EmptyDocumentExecutionContainer.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3603\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_Forms_EmptyDocumentExecutionContainer {\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Styleloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::StyleLoaderControl Styleloader1;\r\n    \r\n    /// <summary>\r\n    /// Scriptloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader1;\r\n    \r\n    /// <summary>\r\n    /// HeaderPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder HeaderPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm form1;\r\n    \r\n    /// <summary>\r\n    /// SM1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.ScriptManager SM1;\r\n    \r\n    /// <summary>\r\n    /// customBroadcasterSets control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder customBroadcasterSets;\r\n    \r\n    /// <summary>\r\n    /// formPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder formPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// messagePlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder messagePlaceHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/FormUIStandardDialogs/ConfirmDialogExecutionContainer.ascx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"ConfirmDialogExecutionContainer.ascx.cs\" Inherits=\"Composite_Forms_ConfirmDialogExecutionContainer\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<head id=\"Head1\" runat=\"server\">\r\n\t    <title>Composite.Management.ConfirmDialog</title>\r\n\t    <control:httpheaders id=\"Httpheaders1\" runat=\"server\" />\r\n\t    <control:styleloader id=\"Styleloader1\" runat=\"server\" />\r\n\t    <control:scriptloader id=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n\t    <asp:PlaceHolder ID=\"HeaderPlaceHolder\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t    <form id=\"form1\" runat=\"server\">\r\n\t\t    <ui:dialogpage \r\n\t\t    \tid=\"formcontrolpage\"\r\n\t\t    \tclass=\"standard question\" \r\n\t\t    \tlabel=\"<%= Server.HtmlEncode( this.ContainerLabel )%>\"\r\n\t\t        image=\"${icon:question}\"  \r\n\t\t        width=\"380\" \r\n\t\t        resizable=\"false\">\r\n\t\t        \r\n\t\t        <aspui:Feedback runat=\"server\"\r\n\t\t         \tID=\"ctlFeedback\"\r\n\t\t         \tOnCommand=\"OnMessage\" />\r\n\t\t        \r\n\t\t        <asp:PlaceHolder ID=\"formPlaceHolder\" runat=\"server\"/>\r\n\t\t        <div style=\"display: none;\">\r\n\t\t        \t<asp:PlaceHolder ID=\"messagePlaceHolder\" runat=\"server\"/>\r\n\t\t        </div>\r\n\t\t    </ui:dialogpage>\r\n\t    </form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/FormUIStandardDialogs/ConfirmDialogExecutionContainer.ascx.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Plugins.Forms.WebChannel.UiContainerFactories;\r\n\r\n\r\npublic partial class Composite_Forms_ConfirmDialogExecutionContainer : TemplatedUiContainerBase\r\n{\r\n    private PlaceHolder formPlaceHolder2 = new PlaceHolder();\r\n    private PlaceHolder messagePlaceHolder2 = new PlaceHolder();\r\n\r\n    protected string ContainerLabel { get; private set; }\r\n    protected ResourceHandle ContainerIcon { get; private set; }\r\n\r\n    protected string ContainerIconClientString\r\n    {\r\n        get\r\n        {\r\n            if (this.ContainerIcon != null)\r\n            {\r\n                return string.Format(\"${{icon:{0}:{1}}}\", this.ContainerIcon.ResourceNamespace, this.ContainerIcon.ResourceName);\r\n            }\r\n            \r\n            return \"${icon:question}\";\r\n        }\r\n    }\r\n\r\n    public override Control GetFormPlaceHolder()\r\n    {\r\n        return formPlaceHolder2;\r\n    }\r\n\r\n    public override Control GetMessagePlaceHolder()\r\n    {\r\n        return messagePlaceHolder2;\r\n    }\r\n\r\n    public override void SetContainerTitle(string containerLabel)\r\n    {\r\n        this.ContainerLabel = containerLabel;\r\n    }\r\n\r\n    public override void SetContainerIcon(ResourceHandle icon)\r\n    {\r\n        this.ContainerIcon = icon;\r\n    }\r\n\r\n    protected void Page_Init(object sender, EventArgs e)\r\n    {\r\n        formPlaceHolder.Controls.Add(formPlaceHolder2);\r\n        messagePlaceHolder.Controls.Add(messagePlaceHolder2);\r\n\r\n//        Page.Items.Add(\"CustomBroadcasterSets\", this.customBroadcasterSets);\r\n    }\r\n\r\n    public override void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages)\r\n    {\r\n        foreach (var msgElement in clientIDPathedMessages)\r\n        {\r\n            FieldMessage fieldMessage = new FieldMessage(msgElement.Key, msgElement.Value);\r\n            messagePlaceHolder.Controls.Add(fieldMessage);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/FormUIStandardDialogs/ConfirmDialogExecutionContainer.ascx.designer.cs",
    "content": "﻿\r\n\r\npublic partial class Composite_Forms_ConfirmDialogExecutionContainer {\r\n    \r\n    /// <summary>\r\n    /// Head1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlHead Head1;\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Styleloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::StyleLoaderControl Styleloader1;\r\n    \r\n    /// <summary>\r\n    /// Scriptloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader1;\r\n    \r\n    /// <summary>\r\n    /// HeaderPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder HeaderPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm form1;\r\n    \r\n    /// <summary>\r\n    /// SM1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.ScriptManager SM1;\r\n    \r\n    /// <summary>\r\n    /// formPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder formPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// messagePlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder messagePlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// queueUpdatePlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder queueUpdatePlaceHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/FormUIStandardDialogs/WarningDialogExecutionContainer.ascx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"WarningDialogExecutionContainer.ascx.cs\" Inherits=\"Composite_Forms_WarningDialogExecutionContainer\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<head id=\"Head1\" runat=\"server\">\r\n\t    <title>Composite.Management.WarningDialog</title>\r\n\t    <control:httpheaders id=\"Httpheaders1\" runat=\"server\" />\r\n\t    <control:styleloader id=\"Styleloader1\" runat=\"server\" />\r\n\t    <control:scriptloader id=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n\t    <asp:PlaceHolder ID=\"HeaderPlaceHolder\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t    <form id=\"form1\" runat=\"server\">\r\n\t\t    <ui:dialogpage \r\n\t\t    \tid=\"formcontrolpage\"\r\n\t\t    \tclass=\"standard warning\" \r\n\t\t    \tlabel=\"<%= Server.HtmlEncode( this.ContainerLabel )%>\"\r\n\t\t        image=\"${icon:warning}\"  \r\n\t\t        width=\"340\" \r\n\t\t        resizable=\"false\">\r\n\t\t        \r\n\t\t        <aspui:Feedback runat=\"server\"\r\n\t\t         \tID=\"ctlFeedback\"\r\n\t\t         \tOnCommand=\"OnMessage\" />\r\n\t\t        \r\n\t\t        <asp:PlaceHolder ID=\"formPlaceHolder\" runat=\"server\"/>\r\n\t\t        <div style=\"display: none;\">\r\n\t\t        \t<asp:PlaceHolder ID=\"messagePlaceHolder\" runat=\"server\"/>\r\n\t\t        </div>\r\n\t\t        \r\n\t\t    </ui:dialogpage>\r\n\t    </form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/FormUIStandardDialogs/WarningDialogExecutionContainer.ascx.cs",
    "content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Plugins.Forms.WebChannel.UiContainerFactories;\r\n\r\n\r\npublic partial class Composite_Forms_WarningDialogExecutionContainer : TemplatedUiContainerBase\r\n{\r\n    private PlaceHolder formPlaceHolder2 = new PlaceHolder();\r\n    private PlaceHolder messagePlaceHolder2 = new PlaceHolder();\r\n\r\n    protected string ContainerLabel { get; private set; }\r\n    protected ResourceHandle ContainerIcon { get; private set; }\r\n\r\n    protected string ContainerIconClientString\r\n    {\r\n        get\r\n        {\r\n            if (this.ContainerIcon != null)\r\n            {\r\n                return string.Format(\"${{icon:{0}:{1}}}\", this.ContainerIcon.ResourceNamespace, this.ContainerIcon.ResourceName);\r\n            }\r\n            \r\n            return \"${icon:question}\";\r\n        }\r\n    }\r\n\r\n    public override Control GetFormPlaceHolder()\r\n    {\r\n        return formPlaceHolder2;\r\n    }\r\n\r\n    public override Control GetMessagePlaceHolder()\r\n    {\r\n        return messagePlaceHolder2;\r\n    }\r\n\r\n    public override void SetContainerTitle(string containerLabel)\r\n    {\r\n        this.ContainerLabel = containerLabel;\r\n    }\r\n\r\n    public override void SetContainerIcon(ResourceHandle icon)\r\n    {\r\n        this.ContainerIcon = icon;\r\n    }\r\n\r\n    protected void Page_Init(object sender, EventArgs e)\r\n    {\r\n        formPlaceHolder.Controls.Add(formPlaceHolder2);\r\n        messagePlaceHolder.Controls.Add(messagePlaceHolder2);\r\n\r\n//        Page.Items.Add(\"CustomBroadcasterSets\", this.customBroadcasterSets);\r\n    }\r\n\r\n    public override void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages)\r\n    {\r\n        foreach (var msgElement in clientIDPathedMessages)\r\n        {\r\n            FieldMessage fieldMessage = new FieldMessage(msgElement.Key, msgElement.Value);\r\n            messagePlaceHolder.Controls.Add(fieldMessage);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/FormUIStandardDialogs/WarningDialogExecutionContainer.ascx.designer.cs",
    "content": "﻿\r\n\r\npublic partial class Composite_Forms_WarningDialogExecutionContainer {\r\n    \r\n    /// <summary>\r\n    /// Head1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlHead Head1;\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Styleloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::StyleLoaderControl Styleloader1;\r\n    \r\n    /// <summary>\r\n    /// Scriptloader1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::ScriptLoaderControl Scriptloader1;\r\n    \r\n    /// <summary>\r\n    /// HeaderPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder HeaderPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm form1;\r\n    \r\n    /// <summary>\r\n    /// SM1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.ScriptManager SM1;\r\n    \r\n    /// <summary>\r\n    /// formPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder formPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// messagePlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder messagePlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// queueUpdatePlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder queueUpdatePlaceHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/WizardExecutionContainer.ascx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"WizardExecutionContainer.ascx.cs\" Inherits=\"Composite_Forms_WizardExecutionContainer\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\t<head runat=\"server\">\r\n\t    <title>Composite.Management.WizardDocument</title>\r\n\t    <control:httpheaders runat=\"server\" />\r\n\t    <control:styleloader runat=\"server\" />\r\n\t    <control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t    <asp:PlaceHolder ID=\"HeaderPlaceHolder\" runat=\"server\" />\r\n\t</head>\r\n\t<body>\r\n\t    <form id=\"form1\" runat=\"server\" class=\"updateXXXform updateXXXzone\">\r\n\t\t    <ui:wizardpage \r\n\t\t    \tid=\"formcontrolpage\"\r\n\t\t    \tlabel=\"<%= Server.HtmlEncode( this.ContainerLabel )%>\" \r\n\t\t    \timage=\"<%= Server.HtmlEncode( this.ContainerIconClientString )%>\"  \r\n\t\t        resizable=\"false\">\r\n\t\t        \r\n\t\t        <aspui:Feedback runat=\"server\" \r\n                    ID=\"ctlFeedback\"\r\n                    OnCommand=\"OnMessage\" />\r\n\t\t        \r\n\t\t\t        <asp:PlaceHolder ID=\"customBroadcasterSets\" runat=\"server\" />\r\n\t\t\t        <asp:PlaceHolder ID=\"formPlaceHolder\" runat=\"server\"/>\r\n\t\t\t        <div style=\"display: none;\" id=\"clientmessages\">\r\n\t\t\t        \t<asp:PlaceHolder ID=\"messagePlaceHolder\" runat=\"server\"/>\r\n\t\t\t        </div>\r\n\t\t    </ui:wizardpage>\r\n\t    </form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/WizardExecutionContainer.ascx.cs",
    "content": "using System.Web.UI;\r\n\r\nusing Composite.Plugins.Forms.WebChannel.UiContainerFactories;\r\nusing System.Web.UI.WebControls;\r\nusing System;\r\nusing System.Web;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\n\r\n\r\npublic partial class Composite_Forms_WizardExecutionContainer : TemplatedUiContainerBase\r\n{\r\n    private PlaceHolder formPlaceHolder2 = new PlaceHolder();\r\n    private PlaceHolder messagePlaceHolder2 = new PlaceHolder();\r\n\r\n    protected string ContainerLabel { get; private set; }\r\n    protected ResourceHandle ContainerIcon { get; private set; }\r\n\r\n    protected string ContainerIconClientString\r\n    {\r\n        get\r\n        {\r\n            if (this.ContainerIcon != null)\r\n            {\r\n                return string.Format(\"${{icon:{0}:{1}}}\", this.ContainerIcon.ResourceNamespace, this.ContainerIcon.ResourceName);\r\n            }\r\n            else\r\n            {\r\n                return \"${icon:wizard}\";\r\n            }\r\n        }\r\n    }\r\n\r\n    public override Control GetFormPlaceHolder()\r\n    {\r\n        return formPlaceHolder2;\r\n    }\r\n\r\n    public override Control GetMessagePlaceHolder()\r\n    {\r\n        return messagePlaceHolder2;\r\n    }\r\n\r\n    public override void SetContainerTitle(string containerLabel)\r\n    {\r\n        this.ContainerLabel = containerLabel;\r\n    }\r\n\r\n    public override void SetContainerIcon(ResourceHandle icon)\r\n    {\r\n        this.ContainerIcon = icon;\r\n    }\r\n\r\n    protected void Page_Init(object sender, EventArgs e)\r\n    {\r\n        formPlaceHolder.Controls.Add(formPlaceHolder2);\r\n        messagePlaceHolder.Controls.Add(messagePlaceHolder2);\r\n\r\n        Page.Items.Add(\"CustomBroadcasterSets\", this.customBroadcasterSets);\r\n    }\r\n\r\n    public override void ShowFieldMessages(Dictionary<string, string> clientIDPathedMessages)\r\n    {\r\n        foreach (var msgElement in clientIDPathedMessages)\r\n        {\r\n            FieldMessage fieldMessage = new FieldMessage(msgElement.Key, msgElement.Value);\r\n            messagePlaceHolder.Controls.Add(fieldMessage);\r\n        }\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiContainerTemplates/WizardExecutionContainer.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3603\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_Forms_WizardExecutionContainer {\r\n    \r\n    /// <summary>\r\n    /// HeaderPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder HeaderPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm form1;\r\n    \r\n    /// <summary>\r\n    /// SM1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.ScriptManager SM1;\r\n    \r\n    /// <summary>\r\n    /// customBroadcasterSets control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder customBroadcasterSets;\r\n    \r\n    /// <summary>\r\n    /// formPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder formPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// messagePlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder messagePlaceHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/BoolSelectors/BoolSelector.ascx",
    "content": "<%@ Control Language=\"C#\" EnableViewState=\"true\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.BoolSelectorTemplateUserControlBase\"  %>\r\n\r\n<script runat=\"server\">\r\n\tconst string ViewStateKey = \"BoolSelector.IsTrue\";\r\n\r\n\r\n\tprivate bool ViewState_IsTrue\r\n\t{\r\n\t\tget { return (bool) ViewState[ViewStateKey]; }\r\n\t\tset { ViewState[ViewStateKey] = value; }\r\n\t}\r\n\r\n\tprotected void Page_Init(object sender, EventArgs e)\r\n\t{\r\n\t}\r\n\r\n\tprotected override void BindStateToProperties()\r\n\t{\r\n\t\tthis.IsTrue = ViewState_IsTrue;\r\n\t}\r\n\r\n\tprotected override void InitializeViewState()\r\n\t{\r\n\t\tViewState_IsTrue = this.IsTrue;\r\n\t}\r\n\r\n\tpublic override string GetDataFieldClientName()\r\n\t{\r\n\t\treturn this.UniqueID;\r\n\t}\r\n\r\n\tpublic override bool LoadPostData(string postDataKey, NameValueCollection postCollection)\r\n\t{\r\n\t\tbool previousValue = ViewState_IsTrue;\r\n\r\n\t\tViewState_IsTrue = postCollection[postDataKey] == \"true\";\r\n\r\n\t\treturn ViewState_IsTrue != previousValue;\r\n\t}\r\n\r\n\tpublic override void RaisePostDataChangedEvent()\r\n\t{\r\n\t\tif (this.SelectionChangedEventHandler != null)\r\n\t\t{\r\n\t\t\tthis.SelectionChangedEventHandler(this, EventArgs.Empty);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate string ExtraAttributes()\r\n\t{\r\n\t\tif (this.SelectionChangedEventHandler != null)\r\n\t\t{\r\n\t\t\treturn string.Format(@\"callbackid=\"\"{0}\"\" onchange=\"\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\"\"\", this.UniqueID);\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t}\r\n\r\n</script>\r\n\r\n<ui:radiodatagroup name=\"<%= this.UniqueID %>\" <%= ExtraAttributes() %> >\r\n\t<ui:radio label=\"<%= Server.HtmlEncode(this.TrueLabel) %>\" value=\"true\" ischecked=\"<%= this.IsTrue.ToString().ToLower() %>\" />\r\n\t<ui:radio label=\"<%= Server.HtmlEncode(this.FalseLabel) %>\" value=\"false\" ischecked=\"<%= (!this.IsTrue).ToString().ToLower() %>\" />\r\n</ui:radiodatagroup>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/BoolSelectors/CheckBox.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.CheckBoxTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script runat=\"server\">\r\n    const string ViewStateKey = \"Checkbox.IsChecked\";\r\n    private bool _initialize = false;\r\n\r\n    private bool PrePostbackValue\r\n    {\r\n        get { return (bool) (ViewState[ViewStateKey] ?? this.Checked); }\r\n        set { ViewState[ViewStateKey] = value; }\r\n    }\r\n\r\n    private bool UserValue\r\n    {\r\n        get { return (IsPostBack && !_initialize) ? (Request[UniqueID] ?? \"\").Contains(\"on\") : this.Checked; }\r\n    }\r\n\r\n    public override bool LoadPostData(string postDataKey, NameValueCollection postCollection)\r\n    {\r\n        bool previousValue = PrePostbackValue;\r\n\r\n        PrePostbackValue = UserValue;\r\n\r\n        return !_initialize && UserValue != previousValue;\r\n    }\r\n\r\n    public override void RaisePostDataChangedEvent()\r\n    {\r\n        if (this.CheckedChangedEventHandler != null)\r\n        {\r\n            this.CheckedChangedEventHandler(this, EventArgs.Empty);\r\n        }\r\n    }\r\n\r\n    protected override void BindStateToProperties()\r\n    {\r\n        this.Checked = UserValue;\r\n    }\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n        _initialize = true;\r\n        PrePostbackValue = this.Checked;\r\n    }\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.UniqueID;\r\n    }\r\n\r\n    private string ExtraAttributes()\r\n    {\r\n        if (this.CheckedChangedEventHandler != null)\r\n        {\r\n            return string.Format(@\"callbackid=\"\"{0}\"\" onchange=\"\"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)\"\"\", this.UniqueID);\r\n        }\r\n\r\n        return null;\r\n    }\r\n\r\n\r\n</script>\r\n\r\n<ui:checkboxgroup>\r\n\t<ui:checkbox label=\"<%= this.ItemLabel %>\" name=\"<%= this.UniqueID %>\" \r\n\t\tischecked=\"<%= UserValue.ToString().ToLower() %>\" \r\n\t\t<%= ExtraAttributes() %> />\r\n</ui:checkboxgroup>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/CancelButton.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ButtonTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        cancelButton.Click += this.FormControlClickEventHandler;\r\n        cancelButton.Text = this.FormControlLabel;\r\n    }\r\n</script>\r\n\r\n<aspui:ClickButton  ID=\"cancelButton\" \r\n                    AutoPostBack=\"false\" \r\n                    client_response=\"cancel\" \r\n                    client_id=\"buttonCancel\" \r\n                    client_focusable=\"true\" \r\n                    runat=\"server\" \r\n                    client_oncommand=\"void(false);\"/> <!-- DON'T POST AFTER WORKFLOW CANCEL; REMOVE WHEN AJAX! -->\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/FinishButton.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ButtonTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        finishButton.Click += this.FormControlClickEventHandler;\r\n        finishButton.Text = this.FormControlLabel;\r\n\r\n        this.Page.Items.Add(\"HasFinishButton\", true);\r\n    }\r\n</script>\r\n\r\n<aspui:ClickButton  ID=\"finishButton\" \r\n                    AutoPostBack=\"false\" \r\n                    OnClientClick=\"this.dispatchAction(WizardPageBinding.ACTION_FINISH);\" \r\n                    CustomClientId=\"finishbutton\" \r\n                    client_image=\"${icon:finish}\" \r\n                    client_image-disabled=\"${icon:finish-disabled}\" \r\n                    client_focusable=\"true\" \r\n                    client_default=\"true\" \r\n                    runat=\"server\" />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/NextButton.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ButtonTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        nextButton.Click += this.FormControlClickEventHandler;\r\n        nextButton.Text = this.FormControlLabel;\r\n    }\r\n\r\n\r\n    private void Page_Load(object sender, System.EventArgs e)\r\n    {\r\n        if (this.Page.Items.Contains(\"HasFinishButton\") == false)\r\n        {\r\n            nextButton.Attributes.Add(\"client_default\", \"true\");\r\n        }\r\n    }\r\n</script>\r\n\r\n<aspui:ClickButton \r\n    ID=\"nextButton\" \r\n    AutoPostBack=\"false\" \r\n    OnClientClick=\"this.dispatchAction(WizardPageBinding.ACTION_NAVIGATE_NEXT);\" \r\n    CustomClientId=\"nextbutton\" \r\n    client_image=\"${icon:next}\" \r\n    client_image-disabled=\"${icon:next-disabled}\" \r\n    client_focusable=\"true\" \r\n    runat=\"server\" />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/OkButton.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ButtonTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {        \r\n        finishButton.Click += this.FormControlClickEventHandler;\r\n        finishButton.Text = this.FormControlLabel;\r\n\r\n        this.Page.Items.Add(\"HasOkButton\", true);\r\n    }\r\n</script>\r\n\r\n<aspui:ClickButton  ID=\"finishButton\" \r\n                    AutoPostBack=\"false\" \r\n                    CustomClientId=\"buttonAccept\" \r\n                    client_validate=\"true\"  \r\n                    client_focusable=\"true\" \r\n                    client_default=\"true\" \r\n                    runat=\"server\" />"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/PreviewPanel.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.PreviewTabPanelTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        this.Controls.Add( this.EventControl );\r\n    }\r\n</script>\r\n<ui:window id=\"previewwindow\" binding=\"PreviewWindowBinding\"/>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/PreviousButton.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ButtonTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        previousButton.Click += this.FormControlClickEventHandler;\r\n        previousButton.Text = this.FormControlLabel;\r\n    }\r\n</script>\r\n\r\n<aspui:ClickButton \r\n    ID=\"previousButton\" \r\n    AutoPostBack=\"false\" \r\n    OnClientClick=\"this.dispatchAction(WizardPageBinding.ACTION_NAVIGATE_PREVIOUS);\" \r\n    CustomClientId=\"previousbutton\" \r\n    client_image=\"${icon:previous}\" \r\n    client_image-disabled=\"${icon:previous-disabled}\" \r\n    client_focusable=\"true\" \r\n    runat=\"server\" />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/SaveAsButton.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ButtonTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        ShadowSaveLinkButton.Click += this.FormControlClickEventHandler;\r\n        ShadowSaveLinkButton.Text = this.FormControlLabel;\r\n    }\r\n</script>\r\n<span style=\"display:none;\"><asp:LinkButton runat=\"server\" ID=\"ShadowSaveLinkButton\" Visible=\"true\" Text=\"Computer!\"/></span>\r\n\r\n<ui:toolbarbutton   oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE);\"\r\n                    callbackid=\"<%=ShadowSaveLinkButton.ClientID%>\" \r\n                    id=\"saveasbutton\" \r\n                    image=\"${skin}/imageeditor/save.png\" \r\n                    image-disabled=\"${skin}/imageeditor/save-disabled.png\" \r\n                    label=\"<%=Server.HtmlEncode(this.FormControlLabel)%>\"\r\n                    observes=\"broadcasterCanSave\"/>\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/SaveButton.ascx",
    "content": "﻿<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.SaveButtonTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient\" %>\r\n<script runat=\"server\">\r\n\tprivate void Page_Init(object sender, System.EventArgs e)\r\n\t{\r\n\t\t(this.Page as FlowPage).OnSave = SaveEventHandler;\r\n\r\n\t\tif (this.SaveAndPublishEventHandler != null)\r\n\t\t{\r\n\t\t\t(this.Page as FlowPage).OnSaveAndPublish = SaveAndPublishEventHandler;\r\n\t\t\tSaveAndPublishButtonPlaceholder.Visible = true;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic string BindingParam()\r\n\t{\r\n\t\tif (this.SaveAndPublishEventHandler != null)\r\n\t\t{\r\n\t\t\treturn @\"binding=\"\"ToolBarComboButtonBinding\"\"\";\r\n\t\t}\r\n\t\treturn string.Empty;\r\n\t}\r\n\tpublic string PopupParam()\r\n\t{\r\n\t\tif (this.SaveAndPublishEventHandler != null)\r\n\t\t{\r\n\t\t\treturn @\"popup=\"\"moreactionspopup\"\"\";\r\n\t\t}\r\n\t\treturn string.Empty;\r\n\t}\r\n\r\n</script>\r\n<ui:toolbarbutton <%= this.BindingParam() %>\r\n\toncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE);\"\r\n\tid=\"savebutton\" image=\"${icon:save}\" image-disabled=\"${icon:save-disabled}\" label=\"<%=Server.HtmlEncode(this.FormControlLabel)%>\"\r\n\tobserves=\"broadcasterCanSave\" <%= this.PopupParam() %>/>\r\n<asp:PlaceHolder ID=\"SaveAndPublishButtonPlaceholder\" Visible=\"false\" runat=\"server\">\r\n\t<ui:popupset>\r\n\t\t<ui:popup id=\"moreactionspopup\" position=\"bottom\">\r\n\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup >\r\n\t\t\t\t\t\t\t<ui:menuitem id=\"save\" label=\"<%=Server.HtmlEncode(this.FormControlLabel)%>\" image=\"${icon:save}\" image-disabled=\"${icon:save-disabled}\" observes=\"broadcasterCanSave\"\r\n\t\t\t\t\t\t\t oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE);\" />\r\n\t\t\t\t\t\t\t<ui:menuitem id=\"saveandpublish\" label=\"${string:Composite.Management:Website.App.LabelSaveAndPublish}\" image=\"${icon:saveandpublish}\" image-disabled=\"${icon:save-disabled}\" observes=\"broadcasterCanSave\"\r\n\t\t\t\t\t\t\t oncommand=\"this.dispatchAction(EditorPageBinding.ACTION_SAVE_AND_PUBLISH);\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t</ui:menubody>\r\n\t\t</ui:popup>\r\n\t</ui:popupset>\r\n</asp:PlaceHolder>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/ToolbarButton.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ToolbarButtonTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        ShadowLinkButton.Click += this.FormControlClickEventHandler;\r\n        ShadowLinkButton.Text = this.FormControlLabel;\r\n    }\r\n\r\n\r\n    private string OptionalParams\r\n    {\r\n        get\r\n        {\r\n            StringBuilder sb = new StringBuilder();\r\n\r\n            string oncommands = \"\";\r\n            \r\n            if (this.FormControlSaveBehaviour == true)\r\n            {\r\n                sb.Append(\"observes='broadcasterCanSave' \");\r\n                oncommands += \"this.dispatchAction(EditorPageBinding.ACTION_SAVE);\";\r\n            }\r\n\r\n            if (this.FormControlClickEventHandler != null)\r\n            {\r\n                sb.AppendFormat(\"callbackid='{0}' \", ShadowLinkButton.ClientID);\r\n\r\n                /*\r\n                 * Client auto-generates this action dispatch when it sees a callbackid...\r\n                 *\r\n                if (this.FormControlSaveBehaviour == false)\r\n                    oncommands += \"this.dispatchAction(PageBinding.ACTION_DOPOSTBACK);\";\r\n                */\r\n            }\r\n\r\n            if (string.IsNullOrEmpty(this.FormControlLaunchUrl) == false)\r\n                sb.AppendFormat(\"url='{0}' \",  HttpUtility.HtmlAttributeEncode(this.FormControlLaunchUrl));\r\n\r\n            if (string.IsNullOrEmpty(this.FormControlIconHandle) == false)\r\n                sb.AppendFormat(\"image='${{icon:{0}}}' \", this.FormControlIconHandle);\r\n\r\n            if (string.IsNullOrEmpty(this.FormControlDisabledIconHandle) == false)\r\n                sb.AppendFormat(\"image-disabled='${{icon:{0}}}' \", this.FormControlDisabledIconHandle);\r\n\r\n            if (string.IsNullOrEmpty(oncommands) == false)\r\n                sb.AppendFormat(\"oncommand='{0}' \", oncommands);\r\n\r\n            if (this.FormControlIsDisabled == true)\r\n                sb.Append(\"isdisabled='true' \");\r\n\r\n            return sb.ToString();\r\n        }\r\n    }\r\n    \r\n</script>\r\n<span style=\"display:none;\"><asp:LinkButton runat=\"server\" ID=\"ShadowLinkButton\" Visible=\"true\" Text=\"Computer!\"/></span>\r\n\r\n<ui:toolbarbutton   label=\"<%=Server.HtmlEncode(this.FormControlLabel)%>\"\r\n                    tooltip=\"<%=Server.HtmlEncode(this.FormControlHelp)%>\"\r\n                    <%= this.OptionalParams %>\r\n                    />\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Buttons/WizardCancelButton.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ButtonTemplateUserControlBase\" %>\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        cancelButton.Click += this.FormControlClickEventHandler;\r\n        cancelButton.Text = this.FormControlLabel;\r\n    }\r\n</script>\r\n\r\n<aspui:ClickButton  ID=\"cancelButton\" \r\n                    AutoPostBack=\"false\" \r\n                    client_response=\"cancel\" \r\n                    client_id=\"buttonCancel\" \r\n                    client_focusable=\"true\" \r\n                    client_image=\"${icon:cancel}\" \r\n    \t\t\t\tclient_image-disabled=\"${icon:cancel-disabled}\" \r\n                    runat=\"server\" \r\n                    client_oncommand=\"void(false);\"/> <!-- DON'T POST AFTER WORKFLOW CANCEL; REMOVE WHEN AJAX! -->\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/ConfirmDialogCanvas.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        repeater.ItemDataBound += new RepeaterItemEventHandler(repeater_ItemDataBound);\r\n        repeater.DataSource = this.FormControlDefinitions;\r\n        repeater.DataBind();\r\n\r\n    }\r\n\r\n    void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)\r\n    {\r\n        FormControlDefinition definition = ((FormControlDefinition)e.Item.DataItem);\r\n\r\n        e.Item.FindControl(\"controlPlaceholder\").Controls.Add(definition.FormControl);\r\n    }\r\n    \r\n</script>\r\n\r\n<ui:pagebody id=\"pagebody\">\r\n    <table id=\"dialoglayout\">\r\n\t    <tr>\r\n\t\t    <td id=\"dialogvignette\">\r\n\t\t\t    <ui:dialogvignette/>\r\n\t\t    </td>\r\n\t\t    <td id=\"dialogtext\">\r\n                <asp:Repeater runat=\"server\" ID=\"repeater\">\r\n                    <ItemTemplate>\r\n                        <asp:PlaceHolder ID=\"controlPlaceholder\" runat=\"server\" />\r\n                    </ItemTemplate>\r\n                </asp:Repeater>\r\n\t\t    </td>\r\n\t    </tr>\r\n    </table>\r\n</ui:pagebody>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/DialogCanvas.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        repeater.ItemDataBound +=new RepeaterItemEventHandler(repeater_ItemDataBound);\r\n        repeater.DataSource = this.FormControlDefinitions;\r\n        repeater.DataBind();\r\n\r\n    }\r\n\r\n    void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)\r\n    {\r\n        FormControlDefinition definition = ((FormControlDefinition)e.Item.DataItem);\r\n\r\n        e.Item.FindControl(\"controlPlaceholder\").Controls.Add(definition.FormControl);\r\n    }\r\n    \r\n</script>\r\n\r\n<ui:pagebody id=\"pagebody\">\r\n    <asp:Repeater runat=\"server\" ID=\"repeater\">\r\n        <ItemTemplate>\r\n            <asp:PlaceHolder ID=\"controlPlaceholder\" runat=\"server\" />\r\n        </ItemTemplate>\r\n    </asp:Repeater>\r\n</ui:pagebody>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/DialogToolbar.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        repeater.ItemDataBound += new RepeaterItemEventHandler(repeater_ItemDataBound);\r\n        repeater.DataSource = this.FormControlDefinitions;\r\n        repeater.DataBind();\r\n\r\n    }\r\n\r\n    void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)\r\n    {\r\n        FormControlDefinition definition = ((FormControlDefinition)e.Item.DataItem);\r\n        e.Item.FindControl(\"controlPlaceholder\").Controls.Add(definition.FormControl);\r\n    }\r\n    \r\n</script>\r\n\r\n<ui:dialogtoolbar id=\"dialogbuttonstoolbar\">\r\n\t<ui:toolbarbody align=\"right\" equalsize=\"true\">\r\n        <ui:toolbargroup>\r\n            <asp:Repeater runat=\"server\" ID=\"repeater\">\r\n                <ItemTemplate>\r\n                    <asp:PlaceHolder ID=\"controlPlaceholder\" runat=\"server\" />\r\n                </ItemTemplate>\r\n            </asp:Repeater>\r\n        </ui:toolbargroup>\r\n    </ui:toolbarbody>\r\n</ui:dialogtoolbar>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/DocumentBody.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        this.ID = \"DocumentBody\";\r\n        foreach (FormControlDefinition formControlDefinition in this.FormControlDefinitions)\r\n        {\r\n            content.Controls.Add(formControlDefinition.FormControl);\r\n        }\r\n\r\n        if (this.FormControlDefinitions[0].IsFullWidthControl == true)\r\n        {\r\n            this.paddingStart.Visible = false;\r\n            this.paddingEnd.Visible = false;\r\n        }\r\n    }\r\n</script>\r\n\r\n<asp:PlaceHolder ID=\"paddingStart\" runat=\"server\">\r\n    <ui:scrollbox class=\"padded\">\r\n</asp:PlaceHolder>\r\n\r\n<asp:PlaceHolder ID=\"content\" runat=\"server\">\r\n</asp:PlaceHolder>\r\n\r\n<asp:PlaceHolder ID=\"paddingEnd\" runat=\"server\">\r\n    </ui:scrollbox>\r\n</asp:PlaceHolder>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/FieldGroup.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        foreach (FormControlDefinition formControlDefinition in this.FormControlDefinitions)\r\n        {\r\n            UiFields.Controls.Add(new LiteralControl(\"<ui:field>\"));\r\n            UiFields.Controls.Add(new LiteralControl(string.Format(\"<ui:fielddesc>{0}</ui:fielddesc>\", Server.HtmlEncode(FieldLabel ?? formControlDefinition.Label))));\r\n            if (string.IsNullOrEmpty(formControlDefinition.Help) == false)\r\n            {\r\n                string helpMarkup = string.Format(\"<ui:fieldhelp>{0}</ui:fieldhelp>\", Server.HtmlEncode(formControlDefinition.Help));\r\n                UiFields.Controls.Add(new LiteralControl(helpMarkup));\r\n            }\r\n            //PlaceHolder fieldDataWithIdPlaceholder = new PlaceHolder();\r\n            //UiFields.Controls.Add(fieldDataWithIdPlaceholder);\r\n            UiFields.Controls.Add(new LiteralControl(\"<ui:fielddata>\"));\r\n            UiFields.Controls.Add(formControlDefinition.FormControl);\r\n            UiFields.Controls.Add(new LiteralControl(\"</ui:fielddata>\"));\r\n            UiFields.Controls.Add(new LiteralControl(\"</ui:field>\"));\r\n\r\n            // ID-GENERATING FEATURE MOVED TO XSLT!\r\n            //fieldDataWithIdPlaceholder.Controls.Add(new LiteralControl(string.Format(\"<ui:fielddata id='{0}_fielddata'>\", formControlDefinition.FormControl.ClientID)));\r\n        }\r\n    }\r\n\r\n    private string FieldLabel\r\n    {\r\n        get\r\n        {\r\n            return this.Settings.ContainsKey(\"FieldLabel\")\r\n                ? (string)this.Settings[\"FieldLabel\"] : null; \r\n        }\r\n    }\r\n    \r\n    // Temporary workaround\r\n    public bool RenderFieldsTag \r\n    {\r\n       get \r\n       {\r\n           return !this.Settings.ContainsKey(\"RenderFieldsTag\") \r\n                  || (bool)this.Settings[\"RenderFieldsTag\"]; \r\n       }\r\n    }\r\n</script>\r\n<%= RenderFieldsTag ? string.Format(@\"<ui:fields id=\"\"fields_{0}\"\">\", this.ClientID) : string.Empty%>\r\n\r\n    <ui:fieldgroup label=\"<%= Server.HtmlEncode(this.Label) %>\">\r\n        <asp:PlaceHolder ID=\"UiFields\" runat=\"server\" />\r\n    </ui:fieldgroup>\r\n    \r\n<%= RenderFieldsTag ? \"</ui:fields>\" : string.Empty %>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/InfoBox.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        foreach (FormControlDefinition formControlDefinition in this.FormControlDefinitions)\r\n        {\r\n            content.Controls.Add(formControlDefinition.FormControl);\r\n        }\r\n    }\r\n</script>\r\n\r\n<!-- \r\n<ui:scrollbox class=\"infobox\">\r\n   placeholder here!\r\n</ui:scrollbox>\r\n-->\r\n\r\n<!-- FOK THIS - HARDWIRED HACK FOR IMMEDIATE RELEASE! -->\r\n<table id=\"dialoglayout\">\r\n\t<tr>\r\n\t\t<td id=\"dialogvignette\">\r\n\t\t\t<ui:dialogvignette class=\"error\"/>\r\n\t\t</td>\r\n\t\t<td id=\"dialogtext\">\r\n\t\t\t<strong>\r\n\t\t\t\t<ui:text label=\"<%= this.Label %>\" />\r\n\t\t\t</strong>\r\n\t\t\t<asp:PlaceHolder ID=\"content\" runat=\"server\">\r\n    \t\t</asp:PlaceHolder>\r\n\t\t</td>\r\n\t</tr>\r\n</table>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/PlaceHolder.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        foreach (FormControlDefinition formControlDefinition in this.FormControlDefinitions)\r\n        {\r\n            content.Controls.Add(formControlDefinition.FormControl);\r\n        }\r\n    }\r\n</script>\r\n\r\n<asp:PlaceHolder ID=\"content\" runat=\"server\">\r\n</asp:PlaceHolder>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/TabPanels.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.C1Console.Forms.WebChannel\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Import Namespace=\"System.ComponentModel\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        this.ID = \"TabPanels\";\r\n\r\n        int tabCounter = 0;\r\n        foreach (FormControlDefinition formControlDefinition in this.FormControlDefinitions)\r\n        {\r\n            string uiTabStartTag = string.Format(\"<ui:tabpanel{0}>\", CustomUiTabPanelTagParams(formControlDefinition, tabCounter));\r\n            content.Controls.Add(new LiteralControl(uiTabStartTag));\r\n            if (formControlDefinition.IsFullWidthControl == false)\r\n                content.Controls.Add( new LiteralControl(\"<ui:scrollbox class='padded'>\"));\r\n                \r\n            content.Controls.Add(formControlDefinition.FormControl);\r\n            \r\n            if (formControlDefinition.IsFullWidthControl == false)\r\n                content.Controls.Add(new LiteralControl(\"</ui:scrollbox>\"));\r\n            \r\n            content.Controls.Add(new LiteralControl(\"</ui:tabpanel>\"));\r\n\r\n            tabCounter++;\r\n        }\r\n\r\n        tabsRepeater.DataSource = this.FormControlDefinitions;\r\n        tabsRepeater.DataBind();\r\n\r\n        lazyBindingRepeater.DataSource = this.FormControlDefinitions;\r\n        lazyBindingRepeater.DataBind();\r\n    }\r\n\r\n    string CustomUiTabTagParams(FormControlDefinition definition, int listPosition)\r\n    {\r\n        string tagParams = \"\";\r\n\r\n        int preSelectedIndexNormalized = (this.PreSelectedIndex + this.FormControlDefinitions.Count) % this.FormControlDefinitions.Count;\r\n\r\n        if (preSelectedIndexNormalized == listPosition)\r\n        {\r\n            tagParams += \" selected=\\\"true\\\"\";\r\n        }\r\n\r\n        if (typeof(IClickableTabPanelControl).IsAssignableFrom(definition.FormControl.GetType()))\r\n        {\r\n            IClickableTabPanelControl control = (IClickableTabPanelControl)definition.FormControl;\r\n            tagParams += \" id=\\\"\" + control.CustomTabId + \"\\\"\";\r\n            tagParams += \" callbackid=\\\"\" + control.EventControl.UniqueID + \"\\\"\";\r\n        }\r\n\r\n        return tagParams;\r\n    }\r\n\r\n    string CustomUiTabPanelTagParams(FormControlDefinition childControl, int listPosition)\r\n    {\r\n        StringBuilder tagParams = new StringBuilder();\r\n\r\n        tagParams.AppendFormat(\" id=\\\"tabpanel_{0}_{1}\\\"\", this.UniqueID, childControl.Label );\r\n\r\n        return tagParams.ToString();\r\n    }\r\n\r\n    string CustomUiLazyBindingTagParams(FormControlDefinition childControl, int listPosition)\r\n    {\r\n        if (this.PreSelectedIndex == listPosition)\r\n        {\r\n            return \"\";\r\n        }\r\n        \r\n        StringBuilder tagParams = new StringBuilder(\"<ui:lazybinding \");\r\n\r\n        tagParams.AppendFormat(\" bindingid=\\\"tabpanel_{0}_{1}\\\"\", this.UniqueID, childControl.Label);\r\n\r\n        string lazyBindingPostBackName = string.Format(\"{0}_lazybindingactivated{1}\", this.UniqueID, GetId(childControl));\r\n        tagParams.AppendFormat(\" name=\\\"{0}\\\"\", HttpUtility.HtmlAttributeEncode(lazyBindingPostBackName));\r\n        tagParams.AppendFormat(\" callbackid=\\\"{0}\\\"\", HttpUtility.HtmlAttributeEncode(lazyBindingPostBackName));\r\n        this.RegisterLazyChildControl(listPosition, lazyBindingPostBackName);\r\n\r\n        tagParams.Append(\" />\");\r\n\r\n        return tagParams.ToString();\r\n    }\r\n\r\n    private string GetId(FormControlDefinition control)\r\n    {\r\n        return control.Label;\r\n    }\r\n    \r\n</script>\r\n\r\n<ui:lazybindingset>\r\n    <asp:Repeater runat=\"server\" ID=\"lazyBindingRepeater\">\r\n        <ItemTemplate>\r\n            <%# CustomUiLazyBindingTagParams((FormControlDefinition)Container.DataItem, Container.ItemIndex) %> \r\n        </ItemTemplate>\r\n    </asp:Repeater>\r\n</ui:lazybindingset>\r\n\r\n<ui:tabbox id=\"maintabbox\">\r\n    <ui:tabs id=\"maintabs\">\r\n        <asp:Repeater runat=\"server\" ID=\"tabsRepeater\">\r\n            <ItemTemplate>\r\n                <ui:tab \r\n                        label=\"<%# Server.HtmlEncode(((FormControlDefinition)Container.DataItem).Label) %>\" \r\n                        tooltip=\"<%# Server.HtmlEncode(((FormControlDefinition)Container.DataItem).ToolTip) %>\"\r\n                        <%# CustomUiTabTagParams( (FormControlDefinition)Container.DataItem, Container.ItemIndex ) %> \r\n                        <%# CustomUiTabTagParams( (FormControlDefinition)Container.DataItem, Container.ItemIndex ).Contains(\"id=\") ? \"\" :\r\n                           \"id=\\\"\" + this.UniqueID + \"_tab_\" + Server.HtmlEncode(((FormControlDefinition)Container.DataItem).Label) + \"\\\"\"   %> />\r\n            </ItemTemplate>\r\n        </asp:Repeater>\r\n    </ui:tabs>\r\n    <ui:tabpanels id=\"maintabpanels\">\r\n        <asp:PlaceHolder runat=\"server\" ID=\"content\" />\r\n    </ui:tabpanels>       \r\n</ui:tabbox>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Containers/Toolbar.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.ContainerTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    private void Page_Init(object sender, System.EventArgs e)\r\n    {\r\n        repeater.ItemDataBound += new RepeaterItemEventHandler(repeater_ItemDataBound);\r\n        repeater.DataSource = this.FormControlDefinitions;\r\n        repeater.DataBind();\r\n\r\n    }\r\n\r\n    void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)\r\n    {\r\n        FormControlDefinition definition = ((FormControlDefinition)e.Item.DataItem);\r\n        e.Item.FindControl(\"controlPlaceholder\").Controls.Add(definition.FormControl);\r\n    }\r\n    \r\n</script>\r\n\r\n<ui:toolbar class=\"document-toolbar\">\r\n    <ui:toolbarbody>\r\n        <ui:toolbargroup>\r\n            <asp:Repeater runat=\"server\" ID=\"repeater\">\r\n                <ItemTemplate>\r\n                    <asp:PlaceHolder ID=\"controlPlaceholder\" runat=\"server\" />\r\n                </ItemTemplate>\r\n            </asp:Repeater>\r\n        </ui:toolbargroup>\r\n    </ui:toolbarbody>\r\n</ui:toolbar>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Customized/PageContentEditor.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"CompositePageContentEditor.PageContentEditor\" CodeFile=\"PageContentEditor.ascx.cs\" %>\r\n<%@ Register TagPrefix=\"aspui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Import Namespace=\"System.Xml.Linq\" %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient.Services.WysiwygEditor\" %>\r\n<%@ Import Namespace=\"Composite.Core.Types\" %>\r\n\r\n<ui:visualmultitemplateeditor\r\n\tformattingconfiguration=\"<%= this.ClassConfigurationName %>\"\r\n    embedablefieldstypenames=\"\"\r\n\tpageid=\"<%= this.PageId %>\"\r\n\tid=\"<%= this.UniqueID %>\">\r\n\t<div class=\"visualmultitemplateeditor_placeholders\">\r\n\t    <asp:PlaceHolder ID=\"ContentsPlaceHolder\" runat=\"server\"/>\r\n\t</div>\r\n\t<div class=\"visualmultitemplateeditor_templateselector\">\r\n\t\t<aspui:Selector SimpleSelectorMode=\"false\" ID=\"TemplateSelector\" runat=\"server\" OnSelectedIndexChanged=\"TemplateSelector_SelectedIndexChanged\" />\r\n\t</div>\r\n</ui:visualmultitemplateeditor>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Customized/PageContentEditor.ascx.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing Composite;\r\nusing Composite.C1Console.RichContent.ContainerClasses;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Plugins.Forms.WebChannel.CustomUiControls;\r\n\r\nnamespace CompositePageContentEditor\r\n{\r\n    public partial class PageContentEditor : PageContentEditorTemplateUserControlBase\r\n    {\r\n        private Guid SelectedTemplateId { get { return new Guid(this.TemplateSelector.SelectedValue); } }\r\n\r\n\r\n        protected void Page_Load(object sender, EventArgs e)\r\n        {\r\n            if (this.ContentsPlaceHolder.Controls.Count == 0)\r\n            {\r\n                SetUpTextAreas(false);\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        protected void TemplateSelector_SelectedIndexChanged(object sender, EventArgs e)\r\n        {\r\n            SetUpTextAreas(true);\r\n        }\r\n\r\n\r\n        protected override void BindStateToProperties()\r\n        {\r\n            this.TemplateId = this.SelectedTemplateId;\r\n\r\n            var newNamedXhtmlFragments = new Dictionary<string, string>();\r\n            foreach (Control c in this.ContentsPlaceHolder.Controls)\r\n            {\r\n                if (IsRealContent(((TextBox)c).Text))\r\n                {\r\n                    newNamedXhtmlFragments.Add(c.ID, ((TextBox)c).Text.Replace(\"&nbsp;\", \"&#160;\"));\r\n                }\r\n            }\r\n\r\n            this.NamedXhtmlFragments = newNamedXhtmlFragments;\r\n        }\r\n\r\n\r\n        protected override void InitializeViewState()\r\n        {\r\n            this.TemplateSelector.DataSource = this.SelectableTemplateIds;\r\n            this.TemplateSelector.DataValueField = \"Key\";\r\n            this.TemplateSelector.DataTextField = \"Value\";\r\n            this.TemplateSelector.DataBind();\r\n\r\n            Verify.That(SelectableTemplateIds.Count > 0, \"No page templates available for selection\");\r\n\r\n            this.TemplateSelector.SelectedValue = this.TemplateId.ToString();\r\n\r\n            SetUpTextAreas(true);\r\n        }\r\n\r\n        public override string GetDataFieldClientName()\r\n        {\r\n            return null;\r\n        }\r\n\r\n\r\n        private void SetUpTextAreas(bool flush)\r\n        {\r\n            Guid selectedTemplateId = this.SelectedTemplateId;\r\n\r\n            PageTemplateDescriptor pageTemplate = PageTemplateFacade.GetPageTemplate(selectedTemplateId);\r\n\r\n            Verify.IsNotNull(pageTemplate, \"Failed to get page template by id '{0}'\", selectedTemplateId);\r\n            if (!pageTemplate.IsValid)\r\n            {\r\n                throw new InvalidOperationException(\r\n                    \"Page template '{0}' contains errors. You can edit the template in the 'Layout' section\".FormatWith(selectedTemplateId),\r\n                    pageTemplate.LoadingException);\r\n            }\r\n\r\n            var handledIds = new List<string>();\r\n\r\n            ContentsPlaceHolder.Controls.Clear();\r\n            foreach (var placeholderDescription in pageTemplate.PlaceholderDescriptions)\r\n            {\r\n                string placeholderId = placeholderDescription.Id;\r\n\r\n                if (handledIds.Contains(placeholderId) == false)\r\n                {\r\n                    var pageTypeContainerClasses = ContainerClassManager.GetPageTypeContainerClasses(this.PageTypeId, placeholderDescription.Id);\r\n                    var allContainerClasses = ContainerClassManager.MergeContainerClasses(placeholderDescription.ContainerClasses, pageTypeContainerClasses);\r\n\r\n                    TextBox contentTextBox = new Composite.Core.WebClient.UiControlLib.TextBox();\r\n                    contentTextBox.TextMode = TextBoxMode.MultiLine;\r\n                    contentTextBox.ID = placeholderId;\r\n                    contentTextBox.Attributes.Add(\"placeholderid\", placeholderId);\r\n                    contentTextBox.Attributes.Add(\"placeholdername\", placeholderDescription.Title);\r\n                    contentTextBox.Attributes.Add(\"containerclasses\", string.Join(\",\", allContainerClasses));\r\n\r\n                    if (placeholderId == pageTemplate.DefaultPlaceholderId)\r\n                    {\r\n                        contentTextBox.Attributes.Add(\"selected\", \"true\");\r\n                    }\r\n                    if (flush)\r\n                    {\r\n                        if (this.NamedXhtmlFragments.ContainsKey(placeholderId))\r\n                        {\r\n                            contentTextBox.Text = this.NamedXhtmlFragments[placeholderId];\r\n                        }\r\n                        else\r\n                        {\r\n                            contentTextBox.Text = \"\";\r\n                        }\r\n                    }\r\n                    ContentsPlaceHolder.Controls.Add(contentTextBox);\r\n                    handledIds.Add(placeholderId);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private bool IsRealContent(string content)\r\n        {\r\n            if (content.Length > 50) return true;\r\n\r\n            string testContent = content.Replace(\"<p>\", \"\")\r\n                                        .Replace(\"</p>\", \"\")\r\n                                        .Replace(\"&nbsp;\", \"\")\r\n                                        .Replace(\"&#160;\", \"\")\r\n                                        .Replace(\" \", \"\")\r\n                                        .Replace(\"<br/>\", \"\");\r\n\r\n            return !string.IsNullOrEmpty(testContent);\r\n        }\r\n\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Customized/PageContentEditor.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace CompositePageContentEditor {\r\n    \r\n    \r\n    public partial class PageContentEditor {\r\n        \r\n        /// <summary>\r\n        /// TemplateSelector control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector TemplateSelector;\r\n        \r\n        /// <summary>\r\n        /// ContentsPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder ContentsPlaceHolder;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DateTimeSelectors/DateSelector.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.controls.FormsControls.FormUiControlTemplates.DateTimeSelectors.DateSelectorBase\" Src=\"~/Composite/controls/FormsControls/FormUiControlTemplates/DateTimeSelectors/DateSelector.ascx.cs\" %>\r\n\r\n<div id=\"updatezone<%= this.UniqueID %>A\">\r\n    <div>\r\n        <ui:datainputbutton name=\"<%= this.UniqueID  %>\" callbackid=\"<%=  GetButtonCallbackId()  %>\"\r\n            image=\"${icon:calendar-full}\" value=\"<%= this.CurrentStringValue %>\" \r\n\t\t\treadonly=\"<%=this.ReadOnly.ToString().ToLower()%>\"\r\n\t\t\trequired=\"<%=this.Required.ToString().ToLower()%>\" />\r\n    </div>\r\n    <div style=\"display:none\">\r\n        <asp:PlaceHolder ID=\"MessagesPlaceHolder\" runat=\"server\"></asp:PlaceHolder>\r\n    </div>\r\n</div>\r\n<div id=\"updatezone<%= this.UniqueID %>B\">\r\n    <asp:PlaceHolder ID=\"CalendarPlaceHolder\" Visible=\"false\" runat=\"server\">\r\n        <div class=\"calendar\">\r\n            <asp:Calendar ID=\"DateTimeSelector\" runat=\"server\" ShowDayHeader=\"true\" OnSelectionChanged=\"CalendarSelectionChange\"\r\n                OtherMonthDayStyle-CssClass=\"othermonth\" SelectedDayStyle-CssClass=\"selectedday\" />\r\n            <!-- masterfilter.xslt will make the links below show up inside the calendar -->\r\n            <asp:LinkButton ID=\"LinkButton1\" CssClass=\"calendaryearback\" OnClick=\"CalendarYearBackClick\"\r\n                runat=\"server\">back</asp:LinkButton>\r\n            <asp:LinkButton ID=\"LinkButton2\" CssClass=\"calendaryearforward\" OnClick=\"CalendarYearForwardClick\"\r\n                runat=\"server\">forward</asp:LinkButton>\r\n        </div>\r\n    </asp:PlaceHolder>\r\n</div>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DateTimeSelectors/DateSelector.ascx.cs",
    "content": "﻿using System;\r\nusing System.Web;\r\nusing System.Web.UI.WebControls;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories;\r\nusing System.Web.UI;\r\nusing System.Linq;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.controls.FormsControls.FormUiControlTemplates.DateTimeSelectors\r\n{\r\n    public abstract class DateSelectorBase : DateTimeSelectorTemplateUserControlBase\r\n    {\r\n        private string ResetOnClickValue\r\n        {\r\n            get { return this.ViewState[\"resetOnClickValue\"] as string; }\r\n            set { this.ViewState[\"resetOnClickValue\"] = value; }\r\n        }\r\n\r\n        public Calendar DateTimeSelector;\r\n        public PlaceHolder CalendarPlaceHolder;\r\n        public PlaceHolder MessagesPlaceHolder;\r\n        public string CurrentStringValue;\r\n\r\n        protected void Page_Init(object sender, EventArgs e)\r\n        {\r\n            if (ReadOnly)\r\n            {\r\n                DateTimeSelector.CssClass = \"readonly\";\r\n            }\r\n\r\n            if (this.CurrentStringValue == null)\r\n            {\r\n                this.CurrentStringValue = Request.Form[this.UniqueID];\r\n            }\r\n        }\r\n\r\n        private void InsertSelectedDate(DateTime? toShow)\r\n        {\r\n            if (toShow.HasValue && toShow.Value != DateTime.MinValue)\r\n            {\r\n                if (!ShowHours)\r\n                {\r\n                    this.CurrentStringValue = toShow.Value.ToTimeZoneDateString();\r\n                }\r\n                else\r\n                {\r\n                    this.CurrentStringValue = toShow.Value.ToTimeZoneDateTimeString();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                this.CurrentStringValue = \"\";\r\n            }\r\n        }\r\n\r\n        public override void BindStateToProperties()\r\n        {\r\n            if (this.ReadOnly)\r\n                return;\r\n\r\n            try\r\n            {\r\n                if (string.IsNullOrEmpty(this.CurrentStringValue))\r\n                {\r\n                    this.Date = null;\r\n                }\r\n                else\r\n                {\r\n                    DateTime parsedTime;\r\n                    if (!DateTimeExtensionMethods.TryParseInTimeZone(this.CurrentStringValue, out parsedTime))\r\n                    {\r\n                        throw new FormatException();\r\n                    }\r\n\r\n                    if (!ShowHours)\r\n                        parsedTime -= parsedTime.TimeOfDay;\r\n\r\n                    this.Date = parsedTime.FromTimeZoneToUtc().ToLocalTime();\r\n                }\r\n                this.IsValid = true;\r\n            }\r\n            catch (Exception)\r\n            {\r\n                this.IsValid = false;\r\n                this.ValidationError = string.Format(StringResourceSystemFacade.GetString(\"Composite.Management\", \"Validation.DateTime.InvalidDateFormat\"),\r\n                                       this.CurrentStringValue, SampleDateString);\r\n            }\r\n        }\r\n\r\n        private string SampleDateString\r\n        {\r\n            get\r\n            {\r\n                if(ShowHours)\r\n                {\r\n                    return DateTime.Now.ToTimeZoneDateTimeString();\r\n                }\r\n                else\r\n                {\r\n                    return DateTime.Now.ToTimeZoneDateString();\r\n                }\r\n            }\r\n        }\r\n\r\n        public override void InitializeViewState()\r\n        {\r\n            SetCalendar(this.Date);\r\n            InsertSelectedDate(this.Date);\r\n        }\r\n\r\n        private void SetCalendar(DateTime? date)\r\n        {\r\n            if (date.HasValue == true && date.Value > DateTime.MinValue)\r\n            {\r\n                DateTime parsedTime;\r\n                if (DateTimeExtensionMethods.TryParseInTimeZone(date.Value.ToTimeZoneDateString(), out parsedTime))\r\n                {\r\n                    DateTimeSelector.SelectedDate = parsedTime - parsedTime.TimeOfDay;\r\n                    DateTimeSelector.VisibleDate = DateTimeSelector.SelectedDate;\r\n                }\r\n                else\r\n                {\r\n                    DateTimeSelector.SelectedDate = date.Value - date.Value.TimeOfDay;\r\n                    DateTimeSelector.VisibleDate = DateTimeSelector.SelectedDate;\r\n                }\r\n                \r\n            }\r\n            else\r\n            {\r\n                DateTimeSelector.SelectedDate = DateTime.MinValue;\r\n                DateTimeSelector.VisibleDate = DateTime.Now;\r\n            }\r\n        }\r\n\r\n        public override string GetDataFieldClientName()\r\n        {\r\n            return this.UniqueID;\r\n        }\r\n\r\n        public string GetButtonCallbackId()\r\n        {\r\n            return \"btnDate\" + this.UniqueID;\r\n        }\r\n\r\n        public void CalendarYearBackClick(object sender, EventArgs e)\r\n        {\r\n            this.DateTimeSelector.VisibleDate = this.DateTimeSelector.VisibleDate.AddYears(-1);\r\n        }\r\n\r\n        public void CalendarYearForwardClick(object sender, EventArgs e)\r\n        {\r\n            this.DateTimeSelector.VisibleDate = this.DateTimeSelector.VisibleDate.AddYears(1);\r\n        }\r\n\r\n        public void CalendarSelectionChange(object sender, EventArgs e)\r\n        {\r\n            CalendarPlaceHolder.Visible = false;\r\n            DateTime toShow = DateTimeSelector.SelectedDate;\r\n\r\n            if (ShowHours)\r\n            {\r\n                DateTime oldDateTime;\r\n                if (DateTimeExtensionMethods.TryParseInTimeZone(this.CurrentStringValue, out oldDateTime))\r\n                    toShow += oldDateTime.TimeOfDay;\r\n            }\r\n\r\n            InsertSelectedDate(toShow.FromTimeZoneToUtc());\r\n            this.MessagesPlaceHolder.Controls.Add(new DocumentDirtyEvent());\r\n        }\r\n\r\n        private void MessagesTextbox(string message)\r\n        {\r\n            FieldMessage fm = new FieldMessage(this.UniqueID, message);\r\n            MessagesPlaceHolder.Controls.Add(fm);\r\n        }\r\n\r\n        private void Page_Load(object sender, EventArgs args)\r\n        {\r\n            var c = MessagesPlaceHolder.Controls;\r\n            string eventTarget = HttpContext.Current.Request.Form[\"__EVENTTARGET\"];\r\n            if (eventTarget == GetButtonCallbackId())\r\n            {\r\n                bool enteringCalendarMode = !CalendarPlaceHolder.Visible;\r\n\r\n                if (enteringCalendarMode)\r\n                {\r\n                    BindStateToProperties();\r\n                    if (!this.IsValid)\r\n                    {\r\n                        bool clickWillReset = this.CurrentStringValue.Equals(this.ResetOnClickValue);\r\n                        this.ResetOnClickValue = this.CurrentStringValue;\r\n                        this.Date = null;\r\n                        if (!clickWillReset)\r\n                        {\r\n                            MessagesTextbox(string.Format(\r\n                                    \"This is not a valid date. Click again to reset calendar or use format '{0}'.\",\r\n                                    SampleDateString));\r\n\r\n                            enteringCalendarMode = false;\r\n                        }\r\n                    }\r\n                    SetCalendar(this.Date);\r\n\r\n                    if (this.Date.HasValue)\r\n                        this.ResetOnClickValue = null;\r\n                }\r\n\r\n                CalendarPlaceHolder.Visible = enteringCalendarMode;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionCallsDesigner.Function.TreeBinding.js",
    "content": "﻿FunctionTreeBinding.prototype = new TreeBinding;\r\nFunctionTreeBinding.prototype.constructor = TreeBinding;\r\nFunctionTreeBinding.superclass = TreeBinding.prototype;\r\n\r\n/**\r\n * @type {ToolBarButtonBinding}\r\n */\r\nFunctionTreeBinding.addNew = function ( binding ) {\r\n    \r\n    var def = ViewDefinitions [ \"Composite.Management.FunctionSelectorDialog\" ];\r\n    \r\n    def.argument.nodes [ 0 ].search = binding.getProperty(\"SerializedFunctionSearchToken\");\r\n    \r\n    def.handler = {\r\n        handleDialogResponse : function ( response, result ) {\r\n            if ( response == Dialog.RESPONSE_ACCEPT ) {\r\n                var input = document.getElementById ( binding.getProperty ( \"AddNewPostBackArgsId\" ));\r\n                input.value = result.getFirst ();\r\n                \r\n                setTimeout ( function () {\r\n                    binding.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n                }, 0 );\r\n            }\r\n        }\r\n    }\r\n\r\n    Dialog.invokeDefinition ( def );\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FunctionTreeBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t \r\n\tthis.logger = SystemLogger.getLogger ( \"FunctionTreeBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {SystemTreeNodeBinding}\r\n\t */\r\n\tthis._defaultTreeNode = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFunctionTreeBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[FunctionTreeBinding]\";\r\n}\r\n\r\n/**\r\n * TEMP!\r\n */\r\nFunctionTreeBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tFunctionTreeBinding.superclass.onBindingAttach.call ( this );\r\n\t// alert ( \"Hej Maw!\\n\\nKan du fixe det sådan at Query-noden er focused som default?\\n\\nEllers fjerner jeg ikke alerten.\" );\r\n}\r\n\r\nFunctionTreeBinding.prototype.handleAction = function ( action ) {\r\n    \r\n    switch ( action.type ) {\r\n    \r\n        case TreeNodeBinding.ACTION_ONFOCUS :\r\n        \r\n            var binding = action.target;\r\n            var bindingHandle = binding.getHandle ();\r\n            \r\n            var input = document.getElementById ( this.getProperty ( \"FunctionTreePostBackHandle\" ));\r\n            var previousHandle = input.value;\r\n            \r\n            if ( previousHandle != bindingHandle )\r\n            {\r\n                input.value = bindingHandle;\r\n\r\n                var treeNodeType = ( bindingHandle.indexOf(\":\")>-1 ? bindingHandle.split(':')[0] : \"\" ) ;\r\n                \r\n                switch (treeNodeType)\r\n                {\r\n                    case \"Function\":\r\n                        bindingMap.broadcasterFunctionTreeHasSelection.enable ();\r\n                        binding.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n                        break;\r\n                    case \"Namespace\":\r\n                        bindingMap.broadcasterFunctionTreeHasSelection.enable ();\r\n                        binding.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n                        break;\r\n                    case \"Parameter\":\r\n                        bindingMap.broadcasterFunctionTreeHasSelection.disable ();\r\n                        binding.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n                        break;\r\n                    default:\r\n                        bindingMap.broadcasterFunctionTreeHasSelection.disable ();\r\n                }\r\n                \r\n            }\r\n            \r\n            break;\r\n    }\r\n    \r\n    FunctionTreeBinding.superclass.handleAction.call ( this, action );\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionCallsDesigner.UiTree.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n\r\n<xsl:stylesheet version=\"1.0\" xmlns:f=\"http://www.composite.net/ns/function/1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\r\n\r\n\t<xsl:template match=\"/\">\r\n\t\t<ui:treenode label=\"Functions\" open=\"true\"><!-- image=\"{//layoutsettings/@containericonuri}\" -->\r\n\t\t\t<xsl:apply-templates select=\"/*/f:function\" mode=\"printNamespace\">\r\n\t\t\t\t<xsl:sort select=\"@name\" />\r\n\t\t\t</xsl:apply-templates>\r\n\t\t</ui:treenode>\r\n\t</xsl:template>\r\n\r\n\r\n\t<!-- namespaces -->\r\n\t<xsl:template match=\"f:function\" mode=\"printNamespace\">\r\n\t\t<xsl:param name=\"parentNamespaceSections\" select=\"''\" />\r\n\r\n\t\t<xsl:variable name=\"namespaceSection\">\r\n\t\t\t<xsl:call-template name=\"GetNamespaceSection\">\r\n\t\t\t\t<xsl:with-param name=\"parentNamespaceSections\" select=\"$parentNamespaceSections\" />\r\n\t\t\t\t<xsl:with-param name=\"name\" select=\"@name\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t</xsl:variable>\r\n\r\n\t\t<xsl:if test=\"string-length($namespaceSection) &gt; 0\">\r\n\r\n\t\t\t<xsl:variable name=\"namespaceSections\">\r\n\t\t\t\t<xsl:call-template name=\"ConcatNamespaceSections\">\r\n\t\t\t\t\t<xsl:with-param name=\"parentNamespaceSections\" select=\"$parentNamespaceSections\" />\r\n\t\t\t\t\t<xsl:with-param name=\"namespaceSection\" select=\"$namespaceSection\" />\r\n\t\t\t\t</xsl:call-template>\r\n\t\t\t</xsl:variable>\r\n\r\n\t\t\t<xsl:variable name=\"pre-siblings-matches\" select=\"preceding-sibling::f:function[starts-with(@name, concat($namespaceSections,'.'))]\" />\r\n\r\n\t\t\t<xsl:if test=\"count($pre-siblings-matches)=0\">\r\n\r\n\t\t\t\t<ui:treenode label=\"{$namespaceSection}\" open=\"true\" callbackid=\"{//clickhandler/@callbackid}\" handle=\"Namespace:{$namespaceSections}\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"/*/f:function[starts-with(@name,$namespaceSections)]\" mode=\"printNamespace\">\r\n\t\t\t\t\t\t<xsl:with-param name=\"parentNamespaceSections\" select=\"$namespaceSections\" />\r\n\t\t\t\t\t\t<xsl:sort select=\"@name\" />\r\n\t\t\t\t\t</xsl:apply-templates>\r\n\r\n\t\t\t\t\t<xsl:apply-templates select=\"/*/f:function[starts-with(@name,concat($namespaceSections,'.')) and contains(substring-after(@name,concat($namespaceSections,'.')),'.') = false]\" mode=\"printFunction\">\r\n\t\t\t\t\t\t<xsl:with-param name=\"parentNamespaceSections\" select=\"$namespaceSections\" />\r\n\t\t\t\t\t\t<xsl:sort select=\"@name\" />\r\n\t\t\t\t\t</xsl:apply-templates>\r\n\t\t\t\t</ui:treenode>\r\n\r\n\t\t\t</xsl:if>\r\n\t\t</xsl:if>\r\n\t</xsl:template>\r\n\r\n\r\n\t<!-- functions -->\r\n\t<xsl:template match=\"f:function\" mode=\"printFunction\">\r\n\t\t<xsl:param name=\"parentNamespaceSections\" />\r\n\t\t<ui:treenode xlabel=\"{substring-after(@name,concat($parentNamespaceSections,'.'))} : {@localname}\" open=\"true\" handle=\"Function:{@handle}\" image=\"{//layoutsettings/@functioniconuri}\" callbackid=\"{//clickhandler/@callbackid}\">\r\n\t\t\t<xsl:attribute name=\"label\">\r\n\t\t\t\t<xsl:value-of select=\"substring-after(@name,concat($parentNamespaceSections,'.'))\" />\r\n\t\t\t\t<xsl:if test=\"//layoutsettings/@displaylocalnames='true'\">\r\n\t\t\t\t\t<xsl:value-of select=\"concat(' : ', @localname)\" />\r\n\t\t\t\t</xsl:if>\r\n\t\t\t</xsl:attribute>\r\n\r\n\t\t\t<xsl:if test=\"count(/*/functioninfo[@name=current()/@name]/param) &gt; 0\">\r\n\t\t\t\t<xsl:apply-templates select=\"/*/functioninfo[@name=current()/@name]\">\r\n\t\t\t\t\t<xsl:with-param name=\"function\" select=\".\" />\r\n\t\t\t\t</xsl:apply-templates>\r\n\t\t\t</xsl:if>\r\n\t\t</ui:treenode>\r\n\t</xsl:template>\r\n\r\n\r\n\t<!-- parameters -->\r\n\t<xsl:template match=\"functioninfo\">\r\n\t\t<xsl:param name=\"function\" />\r\n\r\n\t\t<xsl:for-each select=\"param\">\r\n\r\n\t\t\t<xsl:variable name=\"parameter\" select=\"$function/f:param[@name=current()/@name]\" />\r\n\r\n\t\t\t<ui:treenode label=\"{@label}\" handle=\"Parameter:{$function/@handle}:{@name}\" callbackid=\"{//clickhandler/@callbackid}\">\r\n\r\n\t\t\t\t<xsl:choose>\r\n\t\t\t\t\t<xsl:when test=\"count($parameter) &gt; 0\">\r\n\t\t\t\t\t\t<xsl:attribute name=\"image\">${root}/services/Icon/GetIcon.ashx?resourceName=parameter_overloaded&amp;resourceNamespace=Composite.Icons&amp;size=normal</xsl:attribute>\r\n\t\t\t\t\t\t<xsl:choose>\r\n\t\t\t\t\t\t\t<xsl:when test=\"count($parameter/@value) &gt; 0\">\r\n\t\t\t\t\t\t\t\t<xsl:attribute name=\"tooltip\">\r\n\t\t\t\t\t\t\t\t\t<xsl:value-of select=\"$parameter/@value\" />\r\n\t\t\t\t\t\t\t\t</xsl:attribute>\r\n\t\t\t\t\t\t\t</xsl:when>\r\n\t\t\t\t\t\t\t<xsl:otherwise>\r\n\t\t\t\t\t\t\t\t<xsl:attribute name=\"tooltip\">\r\n\t\t\t\t\t\t\t\t\t<xsl:value-of select=\"$parameter/f:function/@name\" />\r\n\t\t\t\t\t\t\t\t</xsl:attribute>\r\n\t\t\t\t\t\t\t</xsl:otherwise>\r\n\t\t\t\t\t\t</xsl:choose>\r\n\t\t\t\t\t</xsl:when>\r\n\t\t\t\t\t<xsl:when test=\"@isrequired='true'\">\r\n\t\t\t\t\t\t<xsl:attribute name=\"image\">${root}/services/Icon/GetIcon.ashx?resourceName=parameter_missing&amp;resourceNamespace=Composite.Icons&amp;size=normal</xsl:attribute>\r\n\t\t\t\t\t</xsl:when>\r\n\t\t\t\t\t<xsl:otherwise>\r\n\t\t\t\t\t\t<xsl:attribute name=\"image\">${root}/services/Icon/GetIcon.ashx?resourceName=parameter&amp;resourceNamespace=Composite.Icons&amp;size=normal</xsl:attribute>\r\n\t\t\t\t\t</xsl:otherwise>\r\n\t\t\t\t</xsl:choose>\r\n\r\n\t\t\t</ui:treenode>\r\n\t\t</xsl:for-each>\r\n\t</xsl:template>\r\n\r\n\r\n\r\n\t<xsl:template name=\"GetNamespaceSection\">\r\n\t\t<xsl:param name=\"parentNamespaceSections\" />\r\n\t\t<xsl:param name=\"name\" />\r\n\t\t<xsl:choose>\r\n\t\t\t<xsl:when test=\"string-length($parentNamespaceSections)=0\">\r\n\t\t\t\t<xsl:value-of select=\"substring-before($name,'.')\" />\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:value-of select=\"substring-before(substring-after($name,concat($parentNamespaceSections,'.')),'.')\" />\r\n\t\t\t</xsl:otherwise>\r\n\t\t</xsl:choose>\r\n\t</xsl:template>\r\n\r\n\r\n\t<xsl:template name=\"ConcatNamespaceSections\">\r\n\t\t<xsl:param name=\"parentNamespaceSections\" />\r\n\t\t<xsl:param name=\"namespaceSection\" />\r\n\t\t<xsl:choose>\r\n\t\t\t<xsl:when test=\"string-length($parentNamespaceSections)=0\">\r\n\t\t\t\t<xsl:value-of select=\"$namespaceSection\" />\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:value-of select=\"concat($parentNamespaceSections,'.',$namespaceSection)\" />\r\n\t\t\t</xsl:otherwise>\r\n\t\t</xsl:choose>\r\n\t</xsl:template>\r\n\r\n\r\n\r\n\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionCallsDesigner.Widget.TreeBinding.js",
    "content": "﻿FunctionTreeBinding.prototype = new TreeBinding;\r\nFunctionTreeBinding.prototype.constructor = TreeBinding;\r\nFunctionTreeBinding.superclass = TreeBinding.prototype;\r\n\r\n/**\r\n * @type {ToolBarButtonBinding}\r\n */\r\nFunctionTreeBinding.addNew = function ( binding ) {\r\n    \r\n    var def = ViewDefinitions [ \"Composite.Management.WidgetFunctionSelectorDialog\" ];\r\n    \r\n    def.argument.nodes [ 0 ].search = binding.getProperty(\"SerializedFunctionSearchToken\");\r\n    \r\n    def.handler = {\r\n        handleDialogResponse : function ( response, result ) {\r\n            if ( response == Dialog.RESPONSE_ACCEPT ) {\r\n                var input = document.getElementById ( binding.getProperty ( \"AddNewPostBackArgsId\" ));\r\n                input.value = result.getFirst ();\r\n                \r\n                setTimeout ( function () {\r\n                    binding.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n                }, 0 );\r\n            }\r\n        }\r\n    }\r\n\r\n    Dialog.invokeDefinition ( def );\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FunctionTreeBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t \r\n\tthis.logger = SystemLogger.getLogger ( \"FunctionTreeBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {SystemTreeNodeBinding}\r\n\t */\r\n\tthis._defaultTreeNode = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFunctionTreeBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[FunctionTreeBinding]\";\r\n}\r\n\r\n/**\r\n * TEMP!\r\n */\r\nFunctionTreeBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tFunctionTreeBinding.superclass.onBindingAttach.call ( this );\r\n\t// alert ( \"Hej Maw!\\n\\nKan du fixe det sådan at Query-noden er focused som default?\\n\\nEllers fjerner jeg ikke alerten.\" );\r\n}\r\n\r\nFunctionTreeBinding.prototype.handleAction = function ( action ) {\r\n    \r\n    switch ( action.type ) {\r\n    \r\n        case TreeNodeBinding.ACTION_ONFOCUS :\r\n        \r\n            var binding = action.target;\r\n            var bindingHandle = binding.getHandle ();\r\n            \r\n            var input = document.getElementById ( this.getProperty ( \"FunctionTreePostBackHandle\" ));\r\n            var previousHandle = input.value;\r\n            \r\n            if ( previousHandle != bindingHandle )\r\n            {\r\n                input.value = bindingHandle;\r\n\r\n                var treeNodeType = ( bindingHandle.indexOf(\":\")>-1 ? bindingHandle.split(':')[0] : \"\" ) ;\r\n                \r\n                switch (treeNodeType)\r\n                {\r\n                    case \"Function\":\r\n                        bindingMap.broadcasterFunctionTreeHasSelection.enable ();\r\n                        binding.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n                        break;\r\n                    case \"Namespace\":\r\n                        bindingMap.broadcasterFunctionTreeHasSelection.enable ();\r\n                        binding.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n                        break;\r\n                    case \"Parameter\":\r\n                        bindingMap.broadcasterFunctionTreeHasSelection.disable ();\r\n                        binding.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n                        break;\r\n                    default:\r\n                        bindingMap.broadcasterFunctionTreeHasSelection.disable ();\r\n                }\r\n                \r\n            }\r\n            \r\n            break;\r\n    }\r\n    \r\n    FunctionTreeBinding.superclass.handleAction.call ( this, action );\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionCallsDesigner.ascx",
    "content": "﻿<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"FunctionCallsDesigner.ascx.cs\" Inherits=\"CompositeFunctionCallsDesigner.FunctionCallsDesigner\" %>\r\n<%@ Import Namespace=\"System.Xml\" %>\r\n<ui:functioneditor stateprovider=\"<%= this.SessionStateProvider %>\" handle=\"<%= this.SessionStateId %>\" id=\"<%=ClientID %>\" hasbasic=\"<%= XmlConvert.ToString(HasBasic) %>\"/>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionCallsDesigner.ascx.cs",
    "content": "using System;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories;\r\n\r\nnamespace CompositeFunctionCallsDesigner\r\n{\r\n    public partial class FunctionCallsDesigner : FunctionCallsDesignerTemplateUserControlBase\r\n    {\r\n        public override string SessionStateProvider\r\n        {\r\n            get { return ViewState[\"SessionStateProvider\"] as string; }\r\n            set { ViewState[\"SessionStateProvider\"] = value; }\r\n        }\r\n\r\n        public override Guid SessionStateId\r\n        {\r\n            get { return (Guid)ViewState[\"SessionStateId\"]; }\r\n            set { ViewState[\"SessionStateId\"] = value; }\r\n        }\r\n\r\n\t    public bool HasBasic { get; set; }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionCallsDesigner.css",
    "content": "﻿@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|flexbox#layout {\r\n\tborder: 2px groove $(color:threedhighlight);\r\n}\r\nui|toolbar#toolbartreebuttons {\r\n\tborder-top: none;\r\n}\r\nui|splitpanel#splitpaneltree {\r\n\tborder-right: 1px solid $(color:threedshadow);\t\r\n}\r\n\r\n/* fix the horrendous updatepanel that somebody planted inside the tree ... */\r\n\r\n/*\r\nui|tree#treefunctionparameters ui|treebody {\r\n\toverflow: hidden !important;\r\n\tpadding: 0;\r\n}\r\nui|tree#treefunctionparameters ui|updatepanel {\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tmin-height: 100%;\r\n\t-moz-outline: 1px solid white;\r\n}\r\nui|tree#treefunctionparameters ui|updatepanel ui|updatepanelbody {\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tpadding: 4px 6px 16px 6px;\r\n\toverflow: auto !important;\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionParameterDesigner.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"FunctionParameterDesigner.ascx.cs\" Inherits=\"CompositeFunctionParameterDesigner.FunctionParameterDesigner\" %>\r\n<ui:parametereditor stateprovider=\"<%= SessionStateProvider %>\" handle=\"<%= SessionStateId.ToString() %>\"/>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionParameterDesigner.ascx.cs",
    "content": "using System;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories;\r\n\r\n\r\nnamespace CompositeFunctionParameterDesigner\r\n{\r\n    public partial class FunctionParameterDesigner : FunctionParameterDesignerTemplateUserControlBase\r\n    {\r\n        public override string SessionStateProvider\r\n        {\r\n            get { return ViewState[\"SessionStateProvider\"] as string; }\r\n            set { ViewState[\"SessionStateProvider\"] = value; }\r\n        }\r\n\r\n        public override Guid SessionStateId\r\n        {\r\n            get { return (Guid)ViewState[\"SessionStateId\"]; }\r\n            set { ViewState[\"SessionStateId\"] = value; }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionParameterDesigner.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace CompositeFunctionParameterDesigner {\r\n    \r\n    \r\n    public partial class FunctionParameterDesigner {\r\n        \r\n        /// <summary>\r\n        /// EnterCreateModeButton control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.ToolbarButton EnterCreateModeButton;\r\n        \r\n        /// <summary>\r\n        /// DeleteButton control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.ToolbarButton DeleteButton;\r\n        \r\n        /// <summary>\r\n        /// FieldListRepeater control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.Repeater FieldListRepeater;\r\n        \r\n        /// <summary>\r\n        /// DetailsSplitPanelPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder DetailsSplitPanelPlaceHolder;\r\n        \r\n        \r\n        \r\n        /// <summary>\r\n        /// NameField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput NameField;\r\n        \r\n        /// <summary>\r\n        /// LabelField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput LabelField;\r\n        \r\n        /// <summary>\r\n        /// HelpField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput HelpField;\r\n        \r\n        /// <summary>\r\n        /// TypeSelector control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector TypeSelector;\r\n        \r\n        /// <summary>\r\n        /// DefaultValueFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.TextBox DefaultValueFunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// TestValueFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.TextBox TestValueFunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// WidgetFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.TextBox WidgetFunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// PositionField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector PositionField;\r\n        \r\n        /// <summary>\r\n        /// BaloonPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder BaloonPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// MakeDirtyEventPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder MakeDirtyEventPlaceHolder;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionParameterEditor.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" Inherits=\"Composite.controls.FormsControls.FormUiControlTemplates.DeveloperTools.FunctionParameterEditor\" ValidateRequest=\"false\" CodeFile=\"FunctionParameterEditor.aspx.cs\" %>\r\n<%@ Register TagPrefix=\"aspui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n<%@ Import Namespace=\"Composite.Functions.ManagedParameters\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<head>\r\n\t\t<title>Composite.Management.FunctionParameterEditor</title>\r\n\t\t<control:styleloader ID=\"Styleloader1\" runat=\"server\" />\r\n\t\t<control:scriptloader ID=\"Scriptloader1\" type=\"sub\" runat=\"server\" />\r\n\t\t<control:httpheaders id=\"Httpheaders1\" runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"FunctionParameterEditor.css.aspx\"/>\t\r\n\t</head>\r\n\t<body>\r\n\t\t<form id=\"Form1\" runat=\"server\" class=\"updateform updatezone\">\r\n\t\t\t<ui:page id=\"parametereditorpage\">\r\n\t\t\r\n\t\t\t\t<div style=\"display:none\" id=\"functionparamdesignerclientmessages\">\r\n\t\t\t\t\t<asp:PlaceHolder ID=\"MessagesPlaceHolder\" runat=\"server\" />\r\n\t\t\t\t\t<asp:PlaceHolder ID=\"MakeDirtyEventPlaceHolder\" runat=\"server\" Visible=\"false\">\r\n\t\t\t\t\t\t<ui:binding onattach=\"this.dispatchAction(Binding.ACTION_DIRTY);\" />\r\n\t\t\t\t\t</asp:PlaceHolder>\r\n\t\t\t\t</div>\r\n\t\t\t\t\r\n\t\t\t\t<aspui:Feedback runat=\"server\" \r\n                    ID=\"ctlFeedback\"\r\n                    OnCommand=\"OnMessage\" />\r\n\t\t\t\t\r\n\t\t\t\t<ui:splitbox layout=\"1:3\" orient=\"horizontal\" persist=\"layout\" id=\"FunctionParameterDesignerSplitbox\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:toolbar id=\"treetoolbar\">\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n                                \r\n                                    <aspui:Generic runat=\"server\"\r\n                                         ID=\"btnAddNew\"\r\n                                         HasCallbackId=\"true\"\r\n                                         OnServerClick=\"btnAddNew_Click\"\r\n\r\n                                         TagName=\"ui:toolbarbutton\"\r\n                                         label=\"${Composite.Web.FormControl.FunctionParameterDesigner, AddNewButtonLabel}\" \r\n                                         image=\"${icon:generic-add}\"  />\r\n\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t\r\n                                    <aspui:Generic runat=\"server\"\r\n                                         ID=\"btnDelete\"\r\n                                         HasCallbackId=\"true\"\r\n                                         OnServerClick=\"btnDelete_Click\"\r\n                                         TagName=\"ui:toolbarbutton\"\r\n                                         clientid=\"DeleteButton\" \r\n                                         label=\"${Composite.Web.FormControl.FunctionParameterDesigner, DeleteButtonLabel}\" \r\n                                         image=\"${icon:delete}\" \r\n                                         image-disabled=\"${icon:delete-disabled()}\" />\r\n\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t<ui:tree>\r\n\t\t\t\t\t\t\t<ui:treebody id=\"functionparamdesignertreebody\">\r\n\t\t\t\t\t\t\t\t<ui:treenode label=\"<%=GetString(\"TreeRootNodeLabel\") %>\" open=\"true\" image=\"${icon:<%= (this.HasFields ? \"folder_active\" : \"folder\" ) %>}\">\r\n\t\t\t\t\t\t\t\t\t<asp:Repeater runat=\"server\" ID=\"FieldListRepeater\" OnItemCommand=\"FieldDataList_ItemCommand\">\r\n\t\t\t\t\t\t\t\t\t\t<ItemTemplate>\r\n\t\t\t\t\t\t\t\t\t\t\t<aspui:TreeNode ImageUrl=\"${icon:parameter}\" CommandName=\"Select\" runat=\"server\" ID=\"FieldSelectLinkButton\" CommandArgument='<%# Eval(\"Id\") %>' Text='<%# Server.HtmlEncode(((ManagedParameterDefinition)Container.DataItem).Name) %>' Focused='<%# ((ManagedParameterDefinition)Container.DataItem).Id == this.CurrentlySelectedFieldId%>' OnClientClick=\"bindingMap.broadcasterInputFieldHasSelection.enable()\" />\r\n\t\t\t\t\t\t\t\t\t\t</ItemTemplate>\r\n\t\t\t\t\t\t\t\t\t</asp:Repeater>\r\n\t\t\t\t\t\t\t\t</ui:treenode>\r\n\t\t\t\t\t\t\t</ui:treebody>\r\n\t\t\t\t\t\t</ui:tree>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\r\n\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t        <ui:scrollbox class=\"padded\" id=\"funtionparamdesignerfields\">\r\n\t\t\t\t\t        <asp:PlaceHolder ID=\"DetailsSplitPanelPlaceHolder\" runat=\"server\">\r\n\t\t\t\t\t\t        <ui:fields>\r\n\t\t\t\t\t                <ui:fieldgroup label=\"<%=GetString(\"ParameterNamingGroupLabel\") %>\">\r\n\t\t\t\t\t                    <ui:field>\r\n\t\t\t\t\t\t                    <ui:fielddesc><%= GetString(\"Name\") %></ui:fielddesc>\r\n\t\t\t\t\t\t                    <ui:fieldhelp><%= GetString(\"NameHelp\") %></ui:fieldhelp>\r\n\t\t\t\t\t\t                    <ui:fielddata>\r\n\t\t\t\t\t\t\t                    <aspui:DataInput ID=\"NameField\" runat=\"server\" InputType=\"ProgrammingIdentifier\" client_autopost=\"true\" />\r\n\t\t\t\t\t\t                    </ui:fielddata>\r\n\t\t\t\t\t                    </ui:field>\r\n\t\t\t\t\r\n\t\t\t\t\t                    <ui:field>\r\n\t\t\t\t\t\t                    <ui:fielddesc><%= GetString(\"Label\") %></ui:fielddesc>\r\n\t\t\t\t\t\t                    <ui:fieldhelp><%= GetString(\"LabelHelp\")%></ui:fieldhelp>\r\n\t\t\t\t\t\t                    <ui:fielddata>\r\n\t\t\t\t\t\t                        <aspui:DataInput ID=\"LabelField\" runat=\"server\"></aspui:DataInput>\r\n\t\t\t\t\t\t                    </ui:fielddata>\r\n\t\t\t\t\t                    </ui:field>\r\n\t\t\t\t\r\n\t\t\t\t\t                    <ui:field>\r\n\t\t\t\t\t\t                    <ui:fielddesc><%= GetString(\"Help\") %></ui:fielddesc>\r\n\t\t\t\t\t\t                    <ui:fieldhelp><%= GetString(\"HelpHelp\")%></ui:fieldhelp>\r\n\t\t\t\t\t\t                    <ui:fielddata>\r\n                                                <aspui:TextArea ID=\"HelpField\" runat=\"server\" />\r\n\t\t\t\t\t\t                    </ui:fielddata>\r\n\t\t\t\t\t                    </ui:field>\r\n\t\t\t\t\t                </ui:fieldgroup>\r\n\t\t\t\t\r\n\t\t\t\t\t                <ui:fieldgroup label=\"<%=GetString(\"ParameterTypeValueGroupLabel\") %>\">\r\n\t\t\t\t\t                    <ui:field>\r\n\t\t\t\t\t\t                    <ui:fielddesc><%= GetString(\"Type\") %></ui:fielddesc>\r\n\t\t\t\t\t\t                    <ui:fieldhelp><%= GetString(\"TypeHelp\")%></ui:fieldhelp>\r\n\t\t\t\t\t\t                    <ui:fielddata>\r\n\t\t\t\t\t\t\t                    <aspui:Selector ID=\"TypeSelector\" runat=\"server\" AutoPostBack=\"True\" OnSelectedIndexChanged=\"TypeSelector_SelectedIndexChanged\">\r\n\t\t\t\t\t\t\t                    </aspui:Selector>\r\n\t\t\t\t\t\t                    </ui:fielddata>\r\n\t\t\t\t\t                    </ui:field>\r\n\t\t\r\n\t\t\t                            <ui:field>\r\n\t\t\t\t                            <ui:fielddesc><%= GetString(\"DefaultValue\") %></ui:fielddesc>\r\n\t\t\t\t                            <ui:fieldhelp><%= GetString(\"DefaultValueHelp\")%></ui:fieldhelp>\r\n\t\t\t                                <ui:fielddata>\r\n                                                <aspui:PostBackDialog runat=\"server\" ID=\"btnDefaultValueFunctionMarkup\" EncodeValue=\"True\" />\r\n\t\t\t                                </ui:fielddata>\r\n\t\t\t                            </ui:field>\r\n\t\t\r\n\t\t\t                            <ui:field>\r\n\t\t\t\t                            <ui:fielddesc><%= GetString(\"TestValue\") %></ui:fielddesc>\r\n\t\t\t\t                            <ui:fieldhelp><%= GetString(\"TestValueHelp\")%></ui:fieldhelp>\r\n\t\t\t                                <ui:fielddata>\r\n                                                <aspui:PostBackDialog runat=\"server\" ID=\"btnTestValueFunctionMarkup\" EncodeValue=\"True\" />\r\n\t\t\t                                </ui:fielddata>\r\n\t\t\t                            </ui:field>\r\n\t\t\t\t\r\n\t\t\t\t\t                </ui:fieldgroup>\r\n\t\t\t\t\r\n\t\t\t\t\t                <ui:fieldgroup label=\"<%=GetString(\"ParameterPresentationGroupLabel\") %>\">\r\n\t\t\t\t                        <ui:field>\r\n\t\t\t\t                            <ui:fielddesc><%= GetString(\"Widget\") %></ui:fielddesc>\r\n\t\t\t\t                            <ui:fieldhelp><%= GetString(\"WidgetHelp\")%></ui:fieldhelp>\r\n\t\t\t\t                            <ui:fielddata>\r\n                                                <aspui:PostBackDialog runat=\"server\" ID=\"btnWidgetFunctionMarkup\" EncodeValue=\"True\" />\r\n\t\t\t\t                            </ui:fielddata>\r\n\t\t\t\t                        </ui:field>\r\n\t\t\t\t\r\n\t\t\t\t\t                    <ui:field>\r\n\t\t\t\t                            <ui:fielddesc><%= GetString(\"Position\") %></ui:fielddesc>\r\n\t\t\t\t                            <ui:fieldhelp><%= GetString(\"PositionHelp\")%></ui:fieldhelp>\r\n\t\t\t\t\t\t                    <ui:fielddata>\r\n\t\t\t\t    \t\t                    <aspui:Selector ID=\"PositionField\" runat=\"server\" AutoPostBack=\"True\" OnSelectedIndexChanged=\"PositionField_SelectedIndexChanged\" />\r\n\t\t\t\t\t\t                    </ui:fielddata>\r\n\t\t\t\t\t                    </ui:field>\r\n\t\t\t\t\r\n\t\t\t\t\t                </ui:fieldgroup>\r\n\t\t\t\t\t            </ui:fields>\r\n\t\t\t\t\t        </asp:PlaceHolder>\r\n\t\t\t\t        </ui:scrollbox>        \r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t\t\r\n\t\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionParameterEditor.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI.WebControls;\r\nusing System.Xml.Linq;\r\nusing Composite.Core;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Functions;\r\nusing Composite.Functions.ManagedParameters;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.FunctionCallEditor;\r\nusing Composite.Core.WebClient.State;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient.UiControlLib;\r\nusing Composite.Core.Extensions;\r\n\r\n\r\nnamespace Composite.controls.FormsControls.FormUiControlTemplates.DeveloperTools\r\n{\r\n\r\n    public partial class FunctionParameterEditor : XhtmlPage\r\n    {\r\n        private static readonly string SessionStateProviderQueryKey = \"StateProvider\";\r\n        private static readonly string StateIdQueryKey = \"Handle\";\r\n\r\n        private const string _defaultFieldNamePrefix = \"NewField\";\r\n        private bool nameChanged;\r\n\r\n\r\n        private List<ManagedParameterDefinition> Parameters { get; set; }\r\n        private List<Type> TypeOptions { get; set; }\r\n\r\n        private IParameterEditorState _state;\r\n\r\n        private Guid? _stateId;\r\n        private Guid StateId\r\n        {\r\n            get\r\n            {\r\n                if (_stateId == null)\r\n                {\r\n                    string stateIdStr = Request.QueryString[StateIdQueryKey];\r\n\r\n                    Guid stateId;\r\n                    if (!SessionStateProviderName.IsNullOrEmpty()\r\n                        && !stateIdStr.IsNullOrEmpty()\r\n                        && Guid.TryParse(stateIdStr, out stateId))\r\n                    {\r\n                        _stateId = stateId;\r\n                    }\r\n                    else\r\n                    {\r\n                        _stateId = Guid.Empty;\r\n                    }\r\n                }\r\n\r\n                return _stateId.Value;\r\n            }\r\n        }\r\n\r\n\r\n        private string SessionStateProviderName\r\n        {\r\n            get\r\n            {\r\n                return Request.QueryString[SessionStateProviderQueryKey];\r\n            }\r\n        }\r\n\r\n        protected string GetString(string localPart)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Web.FormControl.FunctionParameterDesigner\", localPart);\r\n        }\r\n\r\n        protected void Page_Load(object sender, EventArgs e)\r\n        {\r\n            LoadData();\r\n\r\n            if (!IsPostBack)\r\n            {\r\n                InitializeViewState();\r\n            }\r\n\r\n            if (!DetailsSplitPanelPlaceHolder.Visible && this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                InitializeDetailsSplitPanel();\r\n            }\r\n\r\n            if (!Page.IsPostBack)\r\n            {\r\n                DetailsSplitPanelPlaceHolder.Visible = false;\r\n                UpdateTypeList();\r\n            }\r\n\r\n            if (this.ViewState[\"Fields\"] == null)\r\n            {\r\n                CurrentFields = new List<ManagedParameterDefinition>();\r\n            }\r\n\r\n            if (Page.IsPostBack\r\n                && this.Request.Form[\"__EVENTTARGET\"] == string.Empty\r\n                && CurrentlySelectedFieldId != Guid.Empty\r\n                && ValidateSave())\r\n            {\r\n                Field_Save();\r\n            }\r\n        }\r\n\r\n        public void OnMessage()\r\n        {\r\n            string message = ctlFeedback.GetPostedMessage();\r\n\r\n            if(message == \"save\" || message == \"persist\" )\r\n            {\r\n                bool success = ValidateSave();\r\n                ctlFeedback.SetStatus(success);\r\n\r\n                if(success)\r\n                {\r\n                    Field_Save();\r\n                }\r\n            }\r\n        }\r\n\r\n        private void LoadData()\r\n        {\r\n            var provider = SessionStateManager.GetProvider(SessionStateProviderName);\r\n\r\n            Verify.IsTrue(provider.TryGetState(StateId, out _state), \"Failed to get session state\");\r\n\r\n            var parameters = _state.Parameters;\r\n            var typeOptions = _state.ParameterTypeOptions; \r\n\r\n            Verify.IsNotNull(parameters, \"Failed to get 'Parameters' binding from related workflow\");\r\n            Verify.IsNotNull(typeOptions, \"Failed to get 'ParameterTypeOptions' binding from related workflow\");\r\n\r\n            Parameters = new List<ManagedParameterDefinition>(parameters);\r\n            TypeOptions = new List<Type>(typeOptions);\r\n        }\r\n\r\n        protected void Page_PreRender(object sender, EventArgs e)\r\n        {\r\n            if(CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                var defaultFunction = StandardFunctions.GetDefaultFunctionByType(this.CurrentlySelectedType);\r\n\r\n                btnDefaultValueFunctionMarkup.Attributes[\"label\"] = GetString(btnDefaultValueFunctionMarkup.Value.IsNullOrEmpty() ? \"DefaultValueSpecify\" : \"DefaultValueEdit\");\r\n                btnDefaultValueFunctionMarkup.Attributes[\"url\"] =\r\n                    \"${root}/content/dialogs/functions/editFunctionCall.aspx?type=\" + this.CurrentlySelectedType.FullName +\r\n                    \"&dialoglabel=\" + HttpUtility.UrlEncode(GetString(\"DefaultValueDialogLabel\"), Encoding.UTF8) + \"&multimode=false&functionmarkup=\";\r\n\r\n\r\n                btnTestValueFunctionMarkup.Attributes[\"label\"] = GetString(btnTestValueFunctionMarkup.Value.IsNullOrEmpty() ? \"TestValueSpecify\" : \"TestValueEdit\");\r\n                btnTestValueFunctionMarkup.Attributes[\"url\"] =\r\n                    \"${root}/content/dialogs/functions/editFunctionCall.aspx?type=\" + this.CurrentlySelectedType.FullName +\r\n                    \"&dialoglabel=\" + HttpUtility.UrlEncode(GetString(\"TestValueDialogLabel\"), Encoding.UTF8) + \"&multimode=false&functionmarkup=\";\r\n\r\n                btnWidgetFunctionMarkup.Attributes[\"label\"] = CurrentlySelectedWidgetText;\r\n                btnWidgetFunctionMarkup.Attributes[\"url\"] =\r\n                    \"${root}/content/dialogs/functions/editFunctionCall.aspx?functiontype=widget&type=\" + this.CurrentlySelectedWidgetReturnType.FullName +\r\n                    \"&dialoglabel=\" + HttpUtility.UrlEncode(GetString(\"WidgetDialogLabel\"), Encoding.UTF8) + \"&multimode=false&functionmarkup=\";\r\n\r\n                if (defaultFunction != null)\r\n                {\r\n                    string defaultValue = new FunctionRuntimeTreeNode(defaultFunction).Serialize().ToString();\r\n\r\n                    btnDefaultValueFunctionMarkup.DefaultValue = defaultValue;\r\n                    btnTestValueFunctionMarkup.DefaultValue = defaultValue;\r\n                }\r\n            }\r\n\r\n            btnDelete.Attributes[\"isdisabled\"] = CurrentlySelectedFieldId == Guid.Empty ? \"true\" : \"false\";\r\n\r\n            if (nameChanged)\r\n            {\r\n                UpdateFieldsPanel();\r\n            }\r\n\r\n            _state.Parameters = this.CurrentFields.ToList();\r\n            SessionStateManager.GetProvider(SessionStateProviderName).SetState(StateId, _state, DateTime.Now.AddDays(7.0));\r\n        }\r\n\r\n\r\n        private void InitializeDetailsSplitPanel()\r\n        {\r\n            UpdateDetailsSplitPanel(true);\r\n            UpdatePositionFieldOptions();\r\n        }\r\n\r\n\r\n        private void UpdateDetailsSplitPanel(bool detailsSplitPanel )\r\n        {\r\n            DetailsSplitPanelPlaceHolder.Visible = detailsSplitPanel;\r\n        }\r\n\r\n\r\n        private void UpdatePositionFieldOptions()\r\n        {\r\n            var positionOptions = new Dictionary<int, string>();\r\n\r\n            for (int i = 0; i < this.CurrentFields.Count; i++)\r\n            {\r\n                positionOptions.Add(i, (i + 1).ToString() + \".\");\r\n            }\r\n\r\n            positionOptions.Add(-1, GetString(\"PositionLast\"));\r\n\r\n            this.PositionField.DataSource = positionOptions;\r\n            this.PositionField.DataTextField = \"Value\";\r\n            this.PositionField.DataValueField = \"Key\";\r\n            this.PositionField.DataBind();\r\n        }\r\n\r\n\r\n\r\n        private void ResetWidgetSelector()\r\n        {\r\n            string widgetFunctionMarkup = \"\";\r\n\r\n            WidgetFunctionProvider widgetFunctionProvider = StandardWidgetFunctions.GetDefaultWidgetFunctionProviderByType(this.CurrentlySelectedWidgetReturnType);\r\n            if (widgetFunctionProvider != null)\r\n            {\r\n                widgetFunctionMarkup = widgetFunctionProvider.SerializedWidgetFunction.ToString(SaveOptions.DisableFormatting);\r\n            } \r\n\r\n            btnWidgetFunctionMarkup.Value = widgetFunctionMarkup;\r\n\r\n            if (widgetFunctionMarkup == \"\")\r\n            {\r\n                if (FunctionFacade.GetWidgetFunctionNamesByType(this.CurrentlySelectedWidgetReturnType).Any())\r\n                {\r\n                    Baloon(btnWidgetFunctionMarkup.ClientID, GetString(\"SpecifyWidgetTip\"));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected void PositionField_SelectedIndexChanged(object sender, EventArgs e)\r\n        {\r\n            FieldSettingsChanged(sender, e);\r\n            UpdateFieldsPanel();\r\n        }\r\n\r\n\r\n\r\n        protected void TypeSelector_SelectedIndexChanged(object sender, EventArgs e)\r\n        {\r\n            FieldSettingsChanged(sender, e);\r\n\r\n            ResetWidgetSelector();\r\n        }\r\n\r\n\r\n\r\n        protected void FieldDataList_ItemCommand(Object sender, EventArgs e)\r\n        {\r\n            var repeaterEventArgs = (RepeaterCommandEventArgs)e;\r\n            Guid fieldId = new Guid(repeaterEventArgs.CommandArgument.ToString());\r\n\r\n            if (ValidateSave())\r\n            {\r\n                switch (repeaterEventArgs.CommandName)\r\n                {\r\n                    case \"Select\":\r\n                        Field_Select(fieldId);\r\n                        break;\r\n                    default:\r\n                        throw new Exception(\"unhandled item command name: \" + repeaterEventArgs.CommandName);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                UpdateFieldsPanel();\r\n            }\r\n        }\r\n\r\n\r\n        private void Field_Delete(Guid fieldId)\r\n        {\r\n            var fields = CurrentFields;\r\n\r\n            var field = fields.Single(f => f.Id == fieldId);\r\n\r\n            fields.RemoveAll(f => f.Id == fieldId);\r\n\r\n            if (CurrentlySelectedFieldId == fieldId)\r\n            {\r\n                CurrentlySelectedFieldId = Guid.Empty;\r\n            }\r\n\r\n            foreach (ManagedParameterDefinition laterField in this.CurrentFields.Where(f => f.Position > field.Position))\r\n            {\r\n                laterField.Position--;\r\n            }\r\n\r\n\r\n            UpdatePositionFieldOptions();\r\n\r\n            this.PositionField.SelectedValue = \"-1\";\r\n            this.NameField.Text = \"\";\r\n\r\n            UpdateFieldsPanel();\r\n\r\n            UpdateDetailsSplitPanel(false);\r\n        }\r\n\r\n\r\n\r\n        private void UpdateTypeList()\r\n        {\r\n            var typeList = \r\n                from type in this.TypeOptions\r\n                orderby type.Name\r\n                select new { HashCode = type.FullName.GetHashCode(), Label = type.GetShortLabel() };\r\n\r\n            TypeSelector.DataSource = typeList;\r\n            TypeSelector.DataTextField = \"Label\";\r\n            TypeSelector.DataValueField = \"HashCode\";\r\n            TypeSelector.DataBind();\r\n        }\r\n\r\n\r\n\r\n        private void Field_Select(Guid fieldId)\r\n        {\r\n            if (ValidateSave())\r\n            {\r\n                if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n                {\r\n                    Field_Save();\r\n                }\r\n\r\n                InitializeDetailsSplitPanel();\r\n\r\n                var selectedField = CurrentFields.Single(f => f.Id == fieldId);\r\n\r\n                this.CurrentlySelectedFieldId = fieldId;\r\n\r\n                this.NameField.Text = selectedField.Name;\r\n\r\n                this.LabelField.Text = selectedField.Label;\r\n                this.HelpField.Text = selectedField.HelpText;\r\n\r\n                string typeName = selectedField.Type.FullName.GetHashCode().ToString();\r\n\r\n                if (this.TypeSelector.Items.FindByValue(typeName) != null)\r\n                {\r\n                    this.TypeSelector.SelectedValue = typeName;\r\n                }\r\n                else\r\n                {\r\n                    this.TypeSelector.Items.Insert( 0, new ListItem( \"UNKNOWN TYPE: \" + selectedField.Type.Name ));\r\n                }\r\n\r\n                btnWidgetFunctionMarkup.Value = selectedField.WidgetFunctionMarkup;\r\n\r\n                btnDefaultValueFunctionMarkup.Value = selectedField.DefaultValueFunctionMarkup;\r\n\r\n                btnTestValueFunctionMarkup.Value = selectedField.TestValueFunctionMarkup;\r\n\r\n                this.PositionField.SelectedValue = (selectedField.Position == this.CurrentFields.Count - 1 ? \"-1\" : selectedField.Position.ToString());\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected Guid CurrentlySelectedFieldId\r\n        {\r\n            get\r\n            {\r\n                var editedFieldId = ViewState[\"editedFieldId\"];\r\n                return editedFieldId  == null ? Guid.Empty : (Guid) editedFieldId;\r\n            }\r\n            set\r\n            {\r\n                this.ViewState[\"editedFieldId\"] = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected bool HasFields\r\n        {\r\n            get { return this.CurrentFields.Count > 0; }\r\n        }\r\n\r\n\r\n        private List<ManagedParameterDefinition> CurrentFields\r\n        {\r\n            get\r\n            {\r\n                var value = this.ViewState[\"Fields\"];\r\n                if (value == null) throw new Exception(\"ViewState element 'Fields' does not exist\");\r\n                return (List<ManagedParameterDefinition>)value;\r\n            }\r\n\r\n            set\r\n            {\r\n                this.ViewState[\"Fields\"] = value;\r\n            }\r\n        }\r\n\r\n\r\n        protected Type CurrentlySelectedWidgetReturnType\r\n        {\r\n            get\r\n            {\r\n                Type selectedType = this.CurrentlySelectedType;\r\n\r\n                return selectedType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected string CurrentlySelectedWidgetText\r\n        {\r\n            get\r\n            {\r\n                string widgetMarkup = btnWidgetFunctionMarkup.Value;\r\n\r\n                if (widgetMarkup.IsNullOrEmpty())\r\n                {\r\n                    return GetString(\"NoWidgetSpecifiedLabel\");\r\n                }\r\n\r\n                XElement functionElement = XElement.Parse(widgetMarkup);\r\n                if (functionElement.Name.Namespace!=Namespaces.Function10)\r\n                    functionElement = functionElement.Elements().First();\r\n\r\n                try\r\n                {\r\n                    var widgetNode = (BaseFunctionRuntimeTreeNode)FunctionFacade.BuildTree(functionElement);\r\n                    return widgetNode.GetName();\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogError(\"FunctionParameter\", ex);\r\n                    Baloon(btnWidgetFunctionMarkup,\"Error: \"+ex.Message);\r\n                    return GetString(\"NoWidgetSpecifiedLabel\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected Type CurrentlySelectedType\r\n        {\r\n            get\r\n            {\r\n                var typeNameHash = Int32.Parse(this.TypeSelector.SelectedValue);\r\n                return this.TypeOptions.First(t => t.FullName.GetHashCode() == typeNameHash); \r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ShowMessage(string targetFieldName, string p)\r\n        {\r\n            var fm = new FieldMessage(targetFieldName, p);\r\n\r\n            // TODO: implement\r\n        }\r\n\r\n\r\n\r\n        public void btnAddNew_Click()\r\n        {\r\n            if (ValidateSave())\r\n            {\r\n                if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n                {\r\n                    Field_Save();\r\n                }\r\n\r\n                InitializeDetailsSplitPanel();\r\n\r\n                this.CurrentlySelectedFieldId = Guid.NewGuid();\r\n                this.NameField.Text = _defaultFieldNamePrefix;\r\n\r\n                int i = 2;\r\n                while (this.CurrentFields.Any(f => f.Name == this.NameField.Text))\r\n                {\r\n                    this.NameField.Text = _defaultFieldNamePrefix + i++;\r\n                }\r\n\r\n                this.TypeSelector.SelectedValue = typeof(string).FullName.GetHashCode().ToString();\r\n                btnDefaultValueFunctionMarkup.Value = \"\";\r\n                btnTestValueFunctionMarkup.Value = \"\";\r\n                this.LabelField.Text = \"\";\r\n                this.HelpField.Text = \"\";\r\n                this.PositionField.SelectedValue = \"-1\";\r\n\r\n                ResetWidgetSelector();\r\n\r\n                Field_Save();\r\n\r\n                UpdatePositionFieldOptions();\r\n                UpdateFieldsPanel();\r\n                MakeClientDirty();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private bool ValidateSave()\r\n        {\r\n            if (this.CurrentlySelectedFieldId == Guid.Empty) return true;\r\n\r\n            if (this.NameField.Text.Contains(\" \"))\r\n            {\r\n                Baloon(this.NameField, GetString(\"SpaceInNameError\"));\r\n                return false;\r\n            }\r\n\r\n            if (string.IsNullOrEmpty(this.NameField.Text))\r\n            {\r\n                Baloon(this.NameField, GetString(\"NameEmptyError\"));\r\n                return false;\r\n            }\r\n\r\n            if (this.CurrentFields.Any(f => f.Name == this.NameField.Text && f.Id != this.CurrentlySelectedFieldId))\r\n            {\r\n                Baloon(this.NameField, GetString(\"NameAlreadyInUseError\"));\r\n                return false;\r\n            }\r\n\r\n            string toValidate = this.NameField.Text.StartsWith(\"@\") ? this.NameField.Text.Substring(1) : this.NameField.Text;\r\n            string err;\r\n            if (!NameValidation.TryValidateName(toValidate, out err))\r\n            {\r\n                Baloon(this.NameField, err);\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private void Baloon(System.Web.UI.Control c, string message)\r\n        {\r\n            Baloon(c.UniqueID, message);\r\n        }\r\n\r\n        private void Baloon(string fieldName, string message)\r\n        {\r\n            var fm = new FieldMessage(fieldName, message);\r\n\r\n            MessagesPlaceHolder.Controls.Add(fm);\r\n        }\r\n\r\n        private void UpdateFieldsPanel()\r\n        {\r\n            this.FieldListRepeater.DataSource = CurrentFields;\r\n            this.FieldListRepeater.DataBind();\r\n        }\r\n\r\n\r\n\r\n        private void Field_Save()\r\n        {\r\n            if (CurrentlySelectedFieldId == Guid.Empty)\r\n            {\r\n                return;\r\n            }\r\n\r\n            if (this.CurrentFields.Count(f => f.Id == this.CurrentlySelectedFieldId) == 0)\r\n            {\r\n                var newField = new ManagedParameterDefinition\r\n                {\r\n                    Id = this.CurrentlySelectedFieldId,\r\n                    Name = this.NameField.Text,\r\n                    Type = this.CurrentlySelectedType,\r\n                    Position = this.CurrentFields.Count\r\n                };\r\n                this.CurrentFields.Add(newField);\r\n            }\r\n\r\n            if (!FieldNameSyntaxValid(this.NameField.Text))\r\n            {\r\n                ShowMessage(this.NameField.ClientID, GetString(\"FieldNameSyntaxInvalid\"));\r\n                return;\r\n            }\r\n\r\n            if (this.CurrentFields.Count(f => String.Equals(f.Name, this.NameField.Text, StringComparison.OrdinalIgnoreCase) \r\n                                              && f.Id != this.CurrentlySelectedFieldId) > 0)\r\n            {\r\n                ShowMessage(this.NameField.ClientID, GetString(\"CannotSave\"));\r\n                return;\r\n            }\r\n\r\n            var field = this.CurrentFields.Single(f => f.Id == this.CurrentlySelectedFieldId);\r\n\r\n            if (field.Name != this.NameField.Text)\r\n            {\r\n                nameChanged = true;\r\n            }\r\n\r\n            field.Name = this.NameField.Text;\r\n            field.Type = this.CurrentlySelectedType;\r\n\r\n            bool generateLabel = this.LabelField.Text == \"\" && !this.NameField.Text.StartsWith(_defaultFieldNamePrefix);\r\n            string label = generateLabel ? this.NameField.Text : this.LabelField.Text;\r\n\r\n            field.Label = label;\r\n            field.HelpText = this.HelpField.Text;\r\n\r\n            if (!btnWidgetFunctionMarkup.Value.IsNullOrEmpty())\r\n            {\r\n                XElement functionElement = XElement.Parse(btnWidgetFunctionMarkup.Value);\r\n                if (functionElement.Name.Namespace != Namespaces.Function10)\r\n                    functionElement = functionElement.Elements().First();\r\n\r\n                field.WidgetFunctionMarkup = functionElement.ToString(SaveOptions.DisableFormatting);\r\n            }\r\n            else\r\n            {\r\n                field.WidgetFunctionMarkup = \"\";\r\n            }\r\n\r\n\r\n            if (!btnDefaultValueFunctionMarkup.Value.IsNullOrEmpty())\r\n            {\r\n                var functionElement = XElement.Parse(btnDefaultValueFunctionMarkup.Value);\r\n                if (functionElement.Name.Namespace != Namespaces.Function10)\r\n                    functionElement = functionElement.Elements().First();\r\n\r\n                field.DefaultValueFunctionMarkup = functionElement.ToString(SaveOptions.DisableFormatting);\r\n            }\r\n            else\r\n            {\r\n                field.DefaultValueFunctionMarkup = null;\r\n            }\r\n\r\n\r\n            if (!btnTestValueFunctionMarkup.Value.IsNullOrEmpty())\r\n            {\r\n                var functionElement = XElement.Parse(btnTestValueFunctionMarkup.Value);\r\n                if (functionElement.Name.Namespace != Namespaces.Function10)\r\n                    functionElement = functionElement.Elements().First();\r\n\r\n                field.TestValueFunctionMarkup = functionElement.ToString(SaveOptions.DisableFormatting);\r\n            }\r\n            else\r\n            {\r\n                field.TestValueFunctionMarkup = null;\r\n            }\r\n\r\n\r\n            int newPosition = int.Parse(this.PositionField.SelectedValue);\r\n            if (newPosition == -1) newPosition = this.CurrentFields.Count - 1;\r\n\r\n            if (field.Position != newPosition)\r\n            {\r\n                this.CurrentFields.Remove(field);\r\n\r\n                foreach (ManagedParameterDefinition laterField in this.CurrentFields.Where(f => f.Position > field.Position))\r\n                {\r\n                    laterField.Position--;\r\n                }\r\n\r\n                foreach (ManagedParameterDefinition laterField in this.CurrentFields.Where(f => f.Position >= newPosition))\r\n                {\r\n                    laterField.Position++;\r\n                }\r\n\r\n                field.Position = newPosition;\r\n                this.CurrentFields.Insert(newPosition, field);\r\n            }\r\n\r\n        }\r\n\r\n\r\n        public void btnDelete_Click()\r\n        {\r\n            if (CurrentlySelectedFieldId == Guid.Empty)\r\n            {\r\n                return;\r\n            }\r\n\r\n            List<Guid> fieldIDs = CurrentFields.Select(field => field.Id).ToList();\r\n\r\n            int currentFieldOffset = fieldIDs.IndexOf(CurrentlySelectedFieldId);\r\n\r\n            Field_Delete(this.CurrentlySelectedFieldId);\r\n            MakeClientDirty();\r\n\r\n            if (currentFieldOffset < fieldIDs.Count - 1)\r\n            {\r\n                CurrentlySelectedFieldId = Guid.Empty;\r\n                Field_Select(fieldIDs[currentFieldOffset + 1]);\r\n            }\r\n        }\r\n\r\n\r\n        private void MakeClientDirty()\r\n        {\r\n            MakeDirtyEventPlaceHolder.Visible = true;\r\n        }\r\n\r\n        private bool FieldNameSyntaxValid(string name)\r\n        {\r\n            return !string.IsNullOrWhiteSpace(name);\r\n        }\r\n\r\n\r\n \r\n        // one of the \"post backing\" fields has been changed on the client\r\n        protected void FieldSettingsChanged(object sender, EventArgs e)\r\n        {\r\n            if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                if (ValidateSave())\r\n                {\r\n                    Field_Save();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        // Saving data to the form dictionary...\r\n        protected void BindStateToProperties()\r\n        {\r\n            // TODO: to be used\r\n            if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                if (ValidateSave())\r\n                {\r\n                    Field_Save();\r\n                }\r\n            }\r\n\r\n\r\n\r\n            foreach (var field in this.CurrentFields)\r\n            {\r\n                if (string.IsNullOrEmpty(field.Label))\r\n                {\r\n                    field.Label = field.Name;\r\n                }\r\n            }\r\n\r\n\r\n            this.Parameters = this.CurrentFields;\r\n        }\r\n\r\n\r\n\r\n        // First time we run - we are attached to a parent System.Web.Control \r\n        protected void InitializeViewState()\r\n        {\r\n            var fields = new List<ManagedParameterDefinition>();\r\n            if (this.Parameters != null) fields.AddRange(this.Parameters);\r\n\r\n            // ensure positioning is in place\r\n            int position = 0;\r\n            foreach (ManagedParameterDefinition field in fields.OrderBy(f => f.Position))\r\n            {\r\n                field.Position = position++;\r\n            }\r\n\r\n            CurrentFields = fields;\r\n\r\n            UpdateFieldsPanel();\r\n        }\r\n\r\n        protected string EventTarget\r\n        {\r\n            get\r\n            {\r\n                return IsPostBack ? Request.Form[\"__EVENTTARGET\"] : string.Empty;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionParameterEditor.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace Composite.controls.FormsControls.FormUiControlTemplates.DeveloperTools {\r\n    \r\n    \r\n    public partial class FunctionParameterEditor {\r\n        \r\n        /// <summary>\r\n        /// Styleloader1 control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::StyleLoaderControl Styleloader1;\r\n        \r\n        /// <summary>\r\n        /// Scriptloader1 control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::ScriptLoaderControl Scriptloader1;\r\n        \r\n        /// <summary>\r\n        /// Httpheaders1 control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::HttpHeadersControl Httpheaders1;\r\n        \r\n        /// <summary>\r\n        /// Form1 control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.HtmlControls.HtmlForm Form1;\r\n        \r\n        /// <summary>\r\n        /// BaloonPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder MessagesPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// MakeDirtyEventPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder MakeDirtyEventPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// ctlFeedback control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Feedback ctlFeedback;\r\n        \r\n        /// <summary>\r\n        /// btnAddNew control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Generic btnAddNew;\r\n        \r\n        /// <summary>\r\n        /// btnDelete control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Generic btnDelete;\r\n        \r\n        /// <summary>\r\n        /// FieldListRepeater control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.Repeater FieldListRepeater;\r\n        \r\n        /// <summary>\r\n        /// DetailsSplitPanelPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder DetailsSplitPanelPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// NameField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput NameField;\r\n        \r\n        /// <summary>\r\n        /// LabelField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput LabelField;\r\n        \r\n        /// <summary>\r\n        /// HelpField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.TextArea HelpField;\r\n        \r\n        /// <summary>\r\n        /// TypeSelector control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector TypeSelector;\r\n        \r\n        /// <summary>\r\n        /// btnDefaultValueFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.PostBackDialog btnDefaultValueFunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// btnTestValueFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.PostBackDialog btnTestValueFunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// btnWidgetFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.PostBackDialog btnWidgetFunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// PositionField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector PositionField;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionParameterEditor.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|toolbar#treetoolbar {\r\n\tborder-right: 1px solid $(color:threedlightshadow);\t\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/MarkupEditor.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.XhtmlEditorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script type=\"C#\" runat=\"server\">\r\n\r\n\tprivate string _currentStringValue = null;\r\n\r\n    protected override void BindStateToProperties()\r\n    {\r\n        _currentStringValue = Request.Form[this.UniqueID];\r\n        this.Xhtml = HttpContext.Current.Server.UrlDecode(_currentStringValue);\r\n    }\r\n    protected override void InitializeViewState()\r\n    {\r\n       _currentStringValue = HttpContext.Current.Server.UrlEncode ( this.Xhtml ).Replace(\"+\", \"%20\");\r\n    }\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.UniqueID;\r\n    }\r\n    \r\n</script>\r\n\r\n<!-- This should be deprecated for the more generalized \"SorceEditor\"! -->\r\n\r\n<ui:sourceeditor syntax=\"html\" \r\n\tvalue=\"<%= _currentStringValue %>\"\r\n\tid=\"<%= this.UniqueID %>\"\r\n\tname=\"<%= this.UniqueID %>\"\r\n\tcallbackid=\"<%= this.UniqueID %>\"/>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/SqlEditor.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TextEditorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Import Namespace=\"System.Xml.Linq\" %>\r\n\r\n<script type=\"C#\" runat=\"server\">\r\n\r\n\tprivate string _currentStringValue = null;\r\n\t\r\n\tprotected override void BindStateToProperties()\r\n\t{\r\n        _currentStringValue = Request.Form[this.UniqueID];\r\n\t    this.Text = HttpContext.Current.Server.UrlDecode ( _currentStringValue );\r\n\t}\r\n\tprotected override void InitializeViewState()\r\n\t{\r\n        _currentStringValue = Context.Server.UrlEncode(this.Text ?? string.Empty).Replace(\"+\", \"%20\");\r\n\t}\r\n\tpublic override string GetDataFieldClientName()\r\n\t{\r\n\t    return this.UniqueID;\r\n\t}\r\n\r\n</script>\r\n\r\n<!-- This should be deprecated for the more generalized \"SorceEditor\"! -->\r\n\r\n<ui:sourceeditor syntax=\"sql\" \r\n\tvalue=\"<%= _currentStringValue %>\"\r\n\tid=\"<%= this.UniqueID %>\"\r\n\tname=\"<%= this.UniqueID %>\"\r\n\tcallbackid=\"<%= this.UniqueID %>\"/>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/TextEditor.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TextEditorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Import Namespace=\"System.Xml.Linq\" %>\r\n\r\n<script type=\"C#\" runat=\"server\">\r\n\r\n\tprivate string _currentStringValue = null;\r\n\t\r\n\tprotected override void BindStateToProperties()\r\n\t{\r\n        _currentStringValue = Request.Form[this.UniqueID];\r\n        this.Text = HttpContext.Current.Server.UrlDecode(_currentStringValue);\r\n\t}\r\n\tprotected override void InitializeViewState()\r\n\t{\r\n        _currentStringValue = HttpContext.Current.Server.UrlEncode(this.Text).Replace(\"+\", \"%20\"); ;\r\n\t}\r\n\tpublic override string GetDataFieldClientName()\r\n\t{\r\n\t    return this.UniqueID;\r\n\t}\r\n\r\n    private string GetFileSyntax()\r\n    {\r\n        switch (this.MimeType)\r\n        {\r\n            case \"text/html\":\r\n                return \"html\";\r\n            case \"text/xml\":\r\n                return \"xml\";\r\n            case \"text/css\":\r\n                return \"css\";\r\n            case \"text/javascript\":\r\n            case \"text/js\":\r\n                return \"js\";\r\n            case \"application/x-ashx\":\r\n            case \"text/x-csharp\":\r\n                return \"cs\";\r\n            case \"application/x-cshtml\":\r\n                return \"cshtml\";\r\n            case \"application/x-aspx\":\r\n            case \"application/x-asax\":\r\n            case \"application/x-ascx\":\r\n            case \"application/x-master-page\":\r\n                return \"aspx\";\r\n            case \"text/x-sass\":\r\n                return \"sass\";\r\n            default:\r\n                return \"text\";\r\n        }\r\n    }\r\n    \r\n    // html, text, xml, css, javascript, cs, cshtml\r\n</script>\r\n\r\n<!-- This should be deprecated for the more generalized \"SorceEditor\"! -->\r\n\r\n<ui:sourceeditor syntax=\"<%= GetFileSyntax() %>\" \r\n\tvalue=\"<%= _currentStringValue %>\"\r\n\tid=\"<%= this.UniqueID %>\"\r\n\tname=\"<%= this.UniqueID %>\"\r\n\tcallbackid=\"<%= this.UniqueID %>\"\r\n\tstrictsave=\"false\"\r\n\t/>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/TypeFieldDesigner.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"True\" Inherits=\"CompositeTypeFieldDesigner.TypeFieldDesigner\"\r\n    CodeFile=\"TypeFieldDesigner.ascx.cs\" %>\r\n<%@ Import Namespace=\"Composite.Data.DynamicTypes\" %>\r\n<%@ Import namespace=\"Texts=Composite.Core.ResourceSystem.LocalizationFiles.Composite_Web_FormControl_TypeFieldDesigner\" %>\r\n\r\n<formscontrol:styleloader adminrelativepath=\"controls/FormsControls/FormUiControlTemplates/DeveloperTools/TypeFieldDesigner.css.aspx\"\r\n    runat=\"server\" />\r\n<ui:broadcasterset>\r\n    <ui:broadcaster id=\"broadcasterInputFieldHasSelection\" isdisabled=\"<%= (this.CurrentlySelectedFieldId == Guid.Empty).ToString().ToLower() %>\" />\r\n</ui:broadcasterset>\r\n<div style=\"display: none\" id=\"clientmessages\">\r\n    <asp:PlaceHolder ID=\"BaloonPlaceHolder\" runat=\"server\" />\r\n    <asp:PlaceHolder ID=\"MakeDirtyEventPlaceHolder\" runat=\"server\" Visible=\"false\">\r\n        <ui:binding onattach=\"this.dispatchAction(Binding.ACTION_DIRTY);\" />\r\n    </asp:PlaceHolder>\r\n</div>\r\n<ui:splitbox layout=\"1:3\" orient=\"horizontal\">\r\n\r\n\t<ui:splitpanel id=\"typefielddesignerleft\">\r\n\t\t<ui:toolbar>\r\n\t\t\t<ui:toolbarbody>\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<aspui:ToolbarButton ID=\"EnterCreateModeButton\" runat=\"server\" \r\n\t\t\t\t\tText=\"${Composite.Web.FormControl.TypeFieldDesigner, AddNewButtonLabel}\" \r\n\t\t\t\t\tOnClick=\"AddNewButton_Click\" \r\n\t\t\t\t\tclient_image=\"${icon:parameter}\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t<aspui:ToolbarButton ID=\"DeleteButton\" runat=\"server\" \r\n\t\t\t\t\tText=\"${Composite.Web.FormControl.TypeFieldDesigner, DeleteButtonLabel}\" \r\n\t\t\t\t\tOnClick=\"DeleteButton_Click\"\r\n\t\t\t\t\tclient_image=\"${icon:delete}\" \r\n\t\t\t\t\tclient_image-disabled=\"${icon:delete-disabled}\"\r\n\t\t\t\t\tclient_observes=\"broadcasterInputFieldHasSelection\" />\r\n\t\t\t\t</ui:toolbargroup>\r\n\t\t\t</ui:toolbarbody>\r\n\t\t</ui:toolbar>\r\n\t\t<ui:tree>\r\n\t\t\t<ui:treebody id=\"typefielddesignertreebody\">\r\n\t\t\t\t\t<ui:treenode callbackid=\"folder\" label=\"<%= Texts.LabelDataTypeFields %>\" open=\"true\" image=\"${icon:<%= (this.HasFields ? \"data-interface-open\" : \"data-interface-closed\" ) %>}\">\r\n                       <asp:Repeater runat=\"server\" ID=\"FieldListRepeater\" OnItemCommand=\"FieldDataList_ItemCommand\">\r\n\t\t\t\t\t\t\t<ItemTemplate>\r\n\t\t\t\t\t\t\t<aspui:TreeNode runat=\"server\" ID=\"FieldSelectLinkButton\" CommandName=\"Select\" \r\n                                ImageUrl='<%# GetTreeIcon((DataFieldDescriptor)Container.DataItem) %>'\r\n                                CommandArgument='<%# Eval(\"Id\") %>' \r\n                                Text='<%# Server.HtmlEncode(((DataFieldDescriptor)Container.DataItem).Name) %>' \r\n                                Focused='<%# ((DataFieldDescriptor)Container.DataItem).Id == this.CurrentlySelectedFieldId %>' /> \r\n                              </ItemTemplate>\r\n                           \r\n                           <%--ImageUrl=\"<%# GetTreeIcon((DataFieldDescriptor)Container.DataItem) %>\"--%>\r\n\t\t\t\t\t\t</asp:Repeater>\r\n\t\t\t\t\t</ui:treenode>\r\n\t\t\t</ui:treebody>\r\n\t\t</ui:tree>\r\n\t</ui:splitpanel>\r\n\r\n\t<ui:splitter />\r\n\r\n\t<ui:splitpanel>\r\n\t\t\r\n\t\t<ui:flexbox id=\"updatemanagerhelperflexbox\">\r\n\t\t\r\n\t\t\t\t<asp:PlaceHolder ID=\"DetailsSplitPanelPlaceHolder\" runat=\"server\">\r\n\t\t\t\t\t<ui:tabbox>\r\n\t\t\t\t\t\t<ui:tabs>\r\n\t\t\t\t\t\t\t<ui:tab label=\"<%= Texts.BasicTabLabel %>\" />\r\n\t\t\t\t\t\t\t<ui:tab label=\"<%= Texts.AdvancedTabLabel %>\" />\r\n\t\t\t\t\t\t</ui:tabs>\r\n\t\t\t\t\t\t<ui:tabpanels>\r\n\t\t\t\t\t\t\t<ui:tabpanel>\r\n\t\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\" forcefitness=\"true\" id=\"typefielddesignerscrollboxleft\">\r\n\t\t\t\t\t\t\t\t\t<ui:fields id=\"typefielddesignerfieldsleft\">\r\n\t\t\t\t\t\t\t\t\t    \r\n                                            <asp:PlaceHolder runat=\"server\" Visible=\"<%# SelectedFieldIsKeyField %>\" ID=\"plhKeyFieldProperties\">\r\n                                                \r\n                                                 <ui:fieldgroup label=\"<%= Texts.KeyFieldDetailsGroupLabel %>\">\r\n                                                     \r\n                                                    <ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Name %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.NameHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n                                                            <!-- <aspui:DataInput  ... InputType=\"ProgrammingIdentifier\" ... /> -->\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:DataInput ID=\"txtKeyFieldName\" runat=\"server\" InputType=\"ProgrammingIdentifier\" Client_autopost=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\r\n                                                     <ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.KeyFieldType %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.KeyFieldTypeHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:Selector ID=\"lstKeyType\" runat=\"server\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</aspui:Selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\r\n                                                  </ui:fieldgroup>\r\n                                            </asp:PlaceHolder>\r\n                                        \r\n                                        <asp:PlaceHolder runat=\"server\" Visible=\"<%# !SelectedFieldIsKeyField %>\" ID=\"plhFieldProperties\">\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"<%= Texts.FieldDetailsGroupLabel %>\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Name %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.NameHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n                                                            <!-- <aspui:DataInput  ... InputType=\"ProgrammingIdentifier\" ... /> -->\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:DataInput ID=\"NameField\" runat=\"server\" InputType=\"ProgrammingIdentifier\" Client_autopost=\"true\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Label %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.LabelHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:DataInput ID=\"LabelField\" runat=\"server\"></aspui:DataInput>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Help %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.HelpHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:DataInput ID=\"HelpField\" runat=\"server\"></aspui:DataInput>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Position %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.PositionHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:Selector ID=\"PositionField\" runat=\"server\" AutoPostBack=\"True\" OnSelectedIndexChanged=\"PositionField_SelectedIndexChanged\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"<%= Texts.FieldTypeGroupLabel %>\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.FieldType %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.FieldTypeHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:Selector ID=\"TypeSelector\" runat=\"server\" AutoPostBack=\"True\" OnSelectedIndexChanged=\"TypeSelector_SelectedIndexChanged\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:ListItem value=\"System.String\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, System.String}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:ListItem value=\"XHTML\" Text=\"XHTML\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:ListItem value=\"Reference\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, Reference}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:ListItem value=\"System.Boolean\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, System.Boolean}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:ListItem value=\"System.DateTime\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, System.DateTime}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:ListItem value=\"System.Int32\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, System.Int32}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:ListItem value=\"System.Decimal\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, System.Decimal}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:ListItem value=\"System.Guid\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, System.Guid}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</aspui:Selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:PlaceHolder ID=\"TypeDetailsPlaceHolder\" runat=\"server\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:Label id=\"TypeDetailsLabel\" runat=\"server\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.TypeDetailsHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:Selector ID=\"TypeDetailsSelector\" runat=\"server\" OnSelectedIndexChanged=\"TypeDetailsSelector_Reference_SelectedIndexChanged\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</aspui:Selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</asp:PlaceHolder>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<asp:PlaceHolder ID=\"TypeDetailsOptionalPlaceHolder\" runat=\"server\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t    <ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <ui:fielddesc><%= Texts.Optional %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <ui:fieldhelp><%= Texts.OptionalHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <aspui:Selector ID=\"OptionalSelector\" runat=\"server\" AutoPostBack=\"true\" OnSelectedIndexChanged=\"OptionalSelector_SelectedIndexChanged\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <asp:ListItem value=\"false\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, OptionalFalseLabel}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <asp:ListItem value=\"true\" Text=\"${Composite.Web.FormControl.TypeFieldDesigner, OptionalTrueLabel}\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    </aspui:Selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t    </ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t    </ui:field>\r\n                                                    </asp:PlaceHolder>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n                                        </asp:PlaceHolder>\r\n\t\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\r\n\t\t\t\t\t\t\t<ui:tabpanel> \r\n\t\t\t\t\t\t\t\t<ui:scrollbox class=\"padded\" forcefitness=\"true\">\r\n\t\t\t\t\t\t\t\t\t<ui:fields id=\"typefielddesignerfieldsright\">\r\n\t\r\n                                        <asp:PlaceHolder runat=\"server\" Visible=\"<%# !SelectedFieldIsKeyField %>\" ID=\"plhAdvancedFieldProperties\">\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"<%= Texts.FieldPresentationGroupLabel %>\">\r\n\t\t\t\t\t\t\t\t\t                \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Widget %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.WidgetHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n                                                            <aspui:PostBackDialog runat=\"server\" ID=\"btnWidgetFunctionMarkup\" EncodeValue=\"True\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"<%= Texts.FieldValidationGroupLabel %>\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.ValidationRules %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.ValidationRulesHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n                                                            <aspui:PostBackDialog runat=\"server\" ID=\"btnValidationRulesFunctionMarkup\" EncodeValue=\"True\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"<%= Texts.FieldStructureGroupLabel %>\">\r\n\t\t\t\t\t\t                        <ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.IsTitleField %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.IsTitleFieldHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup timestamp=\"<%= DateTime.Now.Ticks %>\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:CheckBox client_callbackid=\"IsTitleFieldDateTimeSelector\" ItemLabel=\"${Composite.Web.FormControl.TypeFieldDesigner, IsTitleFieldLabel}\" ID=\"IsTitleFieldDateTimeSelector\" runat=\"server\" OnCheckChanged=\"IsTitleFieldDateTimeSelector_OnCheckChanged\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.TreeOrdering %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.TreeOrderingHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:Selector ID=\"TreeOrderingField\" runat=\"server\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.GroupByPriority %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.GroupByPriorityHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:Selector ID=\"GroupByPriorityField\" runat=\"server\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t\r\n\t\t\t\t\t\t\t\t\t\t\t<ui:fieldgroup label=\"<%= Texts.DefaultValueGroupLabel %>\">\r\n\t\t\t\t\t\t\t\t\t                \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.DefaultValue %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.DefaultValueHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n                                                            <aspui:PostBackDialog runat=\"server\" ID=\"btnDefaultValueFunctionMarkup\" EncodeValue=\"True\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t</ui:fieldgroup>\r\n\t                                    </asp:PlaceHolder>\r\n                                        \r\n                                        <asp:PlaceHolder runat=\"server\" ID=\"plhDataUrl\">\r\n                                            <ui:fieldgroup label=\"<%= Texts.DataUrlGroupLabel %>\">\r\n                                            \t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.AppearsInUrlLabel %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.AppearsInUrlHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup timestamp=\"<%= DateTime.Now.Ticks %>\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:CheckBox ID=\"chkShowInDataUrl\" runat=\"server\" AutoPostBack=\"True\"\r\n                                                                ItemLabel=\"<%# Texts.AppearsInUrlItemLabel %>\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n                                                \r\n                                                <asp:PlaceHolder runat=\"server\" Visible=\"<%# chkShowInDataUrl.Checked %>\">\r\n                                                    <ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.DataUrlOrderLabel %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.DataUrlOrderHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:Selector ID=\"lstDataUrlOrder\" runat=\"server\" AutoPostBack=\"True\">\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</aspui:Selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n                                                    \r\n                                                    <asp:PlaceHolder runat=\"server\" Visible=\"<%# SelectedField != null && SelectedField.InstanceType == typeof(DateTime) %>\">\r\n                                                        <ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <ui:fielddesc><%= Texts.DataUrlDateFormatLabel%></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <ui:fieldhelp><%= Texts.DataUrlDateFormatHelp %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    <aspui:Selector ID=\"lstDataUrlDateFormat\" runat=\"server\" AutoPostBack=\"True\">\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    </aspui:Selector>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t    </ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t    </ui:field>\r\n                                                    </asp:PlaceHolder>\r\n                                                </asp:PlaceHolder>\r\n                                            </ui:fieldgroup>\r\n                                        </asp:PlaceHolder>\r\n\t\t\t\t\t\t\t\t\t\t\r\n                                        <asp:PlaceHolder runat=\"server\" ID=\"plhSearch\">\r\n                                            <ui:fieldgroup label=\"<%= Texts.SearchGroupLabel %>\">\r\n\t                                            \r\n\t\t\t\t\t\t\t\t\t\t\t\t<asp:PlaceHolder runat=\"server\" ID=\"plhSearch_IndexText\">\r\n                                            \t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Search_TextSearch %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.Search_IndexText_Help%></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup timestamp=\"<%= DateTime.Now.Ticks %>\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:CheckBox ID=\"chkIndexText\" runat=\"server\" \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tItemLabel=\"<%# Texts.Search_IndexText_Label%>\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</asp:PlaceHolder> \r\n\t\t\t\t\t\t\t\t\t\t\t\t<asp:PlaceHolder runat=\"server\" ID=\"plhSearch_FieldPreview\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Search_SearchResults %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.Search_FieldPreview_Help %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup timestamp=\"<%= DateTime.Now.Ticks %>\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:CheckBox ID=\"chkSearchPreview\" runat=\"server\" \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tItemLabel=\"<%# Texts.Search_FieldPreview_Label%>\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</asp:PlaceHolder> \r\n\t\t\t\t\t\t\t\t\t\t\t\t<asp:PlaceHolder runat=\"server\" ID=\"plhSearch_FacetedSearch\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddesc><%= Texts.Search_FacetedSearch %></ui:fielddesc>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fieldhelp><%= Texts.Search_Facet_Help %></ui:fieldhelp>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ui:checkboxgroup timestamp=\"<%= DateTime.Now.Ticks %>\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<aspui:CheckBox ID=\"chkFacetField\" runat=\"server\" \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tItemLabel=\"<%# Texts.Search_Facet_Label%>\" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:fielddata>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ui:field>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</asp:PlaceHolder> \r\n                                            </ui:fieldgroup>\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n                                        </asp:PlaceHolder>\r\n\t\t\t\t\t\t\t\t\t</ui:fields>\r\n\t\t\t\t\t\t\t\t</ui:scrollbox>\r\n\t\t\t\t\t\t\t</ui:tabpanel>\r\n\t\t\t\t\t\t</ui:tabpanels>\r\n\t\t\t\t\t</ui:tabbox>\r\n\t\r\n\t\t\t\t</asp:PlaceHolder>\r\n\t\t\t\r\n\t\t</ui:flexbox>\r\n\r\n\t</ui:splitpanel>\r\n</ui:splitbox>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/TypeFieldDesigner.ascx.cs",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing System.Xml.Linq;\r\nusing Composite;\r\nusing Composite.Core;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Data.GeneratedTypes;\r\nusing Composite.Plugins.Elements.ElementProviders.Common;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories;\r\nusing Composite.Functions;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data.Validation;\r\nusing Composite.Core.WebClient.UiControlLib;\r\n\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Web_FormControl_TypeFieldDesigner;\r\n\r\nnamespace CompositeTypeFieldDesigner\r\n{\r\n\r\n    public partial class TypeFieldDesigner : TypeFieldDesignerTemplateUserControlBase\r\n    {\r\n        private static readonly string LogTitle = typeof(TypeFieldDesigner).Name;\r\n\r\n        private const string _defaultFieldNamePrefix = \"NewField\";\r\n        private bool _nameChanged;\r\n        private bool _dataUrlOrderUpdated;\r\n\r\n        protected string GetString(string localPart)\r\n        {\r\n            return StringResourceSystemFacade.GetString(\"Composite.Web.FormControl.TypeFieldDesigner\", localPart);\r\n        }\r\n\r\n\r\n        protected void Page_Load(object sender, EventArgs e)\r\n        {\r\n            if (!DetailsSplitPanelPlaceHolder.Visible && this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                InitializeDetailsSplitPanel();\r\n            }\r\n\r\n            if (!Page.IsPostBack)\r\n            {\r\n                DetailsSplitPanelPlaceHolder.Visible = false;\r\n            }\r\n\r\n            if (this.ViewState[\"Fields\"] == null)\r\n            {\r\n                CurrentFields = new List<DataFieldDescriptor>();\r\n            }\r\n        }\r\n\r\n        protected void Page_PreRender(object sender, EventArgs e)\r\n        {\r\n            if (IsPostBack && this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                string eventTarget = Request.Form[\"__EVENTTARGET\"];\r\n\r\n                // Refreshing\r\n                if (eventTarget == \"\")\r\n                {\r\n                    if (ValidateSave())\r\n                    {\r\n                        Field_Save();\r\n                        _nameChanged = true;\r\n                    }\r\n                }\r\n\r\n                // Selecting \"folder\"\r\n                if (eventTarget == \"folder\" && ValidateSave())\r\n                {\r\n                    Field_Save();\r\n                    CurrentlySelectedFieldId = Guid.Empty;\r\n\r\n                    DetailsSplitPanelPlaceHolder.Visible = false;\r\n                }\r\n\r\n                // TODO: fix the type reference!\r\n\r\n                const string editFunctionUrl = \"${root}/content/dialogs/functions/editFunctionCall.aspx\";\r\n                Func<Type, string> zipType = type => UrlUtils.ZipContent(TypeManager.SerializeType(type));\r\n\r\n                btnWidgetFunctionMarkup.Attributes[\"label\"] = CurrentlySelectedWidgetText;\r\n                btnWidgetFunctionMarkup.Attributes[\"url\"] = editFunctionUrl +\"?functiontype=widget&zip_type=\"\r\n                    + zipType(CurrentlySelectedWidgetReturnType)\r\n                    + \"&dialoglabel=\" + HttpUtility.UrlEncode(Texts.WidgetDialogLabel, Encoding.UTF8) + \"&multimode=false&functionmarkup=\";\r\n\r\n                btnValidationRulesFunctionMarkup.Attributes[\"label\"] =\r\n                    GetString(btnValidationRulesFunctionMarkup.Value.IsNullOrEmpty()\r\n                                  ? \"ValidationRulesAdd\"\r\n                                  : \"ValidationRulesEdit\");\r\n                // TODO: some of the query parameters may not be used at the moment\r\n                btnValidationRulesFunctionMarkup.Attributes[\"url\"] = editFunctionUrl + \"?zip_type=\"\r\n                     + zipType(this.CurrentlySelectedTypeValidatorType)\r\n                     + \"&dialoglabel=\" + HttpUtility.UrlEncode(Texts.ValidationRulesDialogLabel, Encoding.UTF8)\r\n                     + \"&multimode=true&addnewicon=Composite.Icons,validationrules-add&addnewicondisabled=Composite.Icons,validationrules-add-disabled\"\r\n                     + \"&functionicon=Composite.Icons,validationrule&containericon=Composite.Icons,validationrules&functionmarkup=\";\r\n\r\n                btnDefaultValueFunctionMarkup.Attributes[\"label\"] = CurrentlySelectedDefaultValueText;\r\n                btnDefaultValueFunctionMarkup.Attributes[\"url\"] =\r\n                    editFunctionUrl + \"?zip_type=\"\r\n                    + zipType(this.CurrentlySelectedDefaultValueFunctionReturnType)\r\n                    + \"&dialoglabel=\" + HttpUtility.UrlEncode(Texts.DefaultValueDialogLabel, Encoding.UTF8)\r\n                    + \"&multimode=false&functionmarkup=\";\r\n\r\n                if (eventTarget == chkShowInDataUrl.UniqueID)\r\n                {\r\n                    bool isChecked = chkShowInDataUrl.Checked;\r\n\r\n                    SelectedField.DataUrlProfile = isChecked ? new DataUrlProfile() : null;\r\n                }\r\n\r\n                RepopulateDataUrlSegmentOrder(false);\r\n                plhDataUrl.DataBind();\r\n            }\r\n\r\n            if (_nameChanged)\r\n            {\r\n                UpdateFieldsPanel();\r\n            }\r\n\r\n            plhDataUrl.Visible = CanAppearInDataRoute;\r\n        }\r\n\r\n        private void InitializeDetailsSplitPanel()\r\n        {\r\n            UpdateDetailsSplitPanel(true);\r\n\r\n            if (SelectedFieldIsKeyField)\r\n            {\r\n                if (lstKeyType.Items.Count == 0)\r\n                {\r\n                    lstKeyType.Items.AddRange(KeyFieldHelper.GetKeyFieldOptions().Select(kvp => new ListItem(kvp.Value, kvp.Key)).ToArray());\r\n                }\r\n\r\n                var field = SelectedField;\r\n\r\n                var keyType = KeyFieldHelper.GetKeyFieldType(field);\r\n                Verify.That(keyType != GeneratedTypesHelper.KeyFieldType.Undefined, \"Failed to parse key field type\");\r\n\r\n                lstKeyType.SelectedValue = keyType.ToString();\r\n\r\n                txtKeyFieldName.Text = CurrentKeyFieldName;\r\n\r\n                lstKeyType.IsDisabled = KeyFieldReadOnly;\r\n                txtKeyFieldName.Enabled = !KeyFieldReadOnly;\r\n            }\r\n            else\r\n            {\r\n                UpdatePositionFieldOptions();\r\n                UpdateGroupByPriorityFieldOptions();\r\n                UpdateTreeOrderingFieldOptions();\r\n                UpdateFieldTypeDetailsSelector();\r\n            }\r\n\r\n            InitDataUrlProperties();\r\n            InitSearchProperties();\r\n\r\n            DeleteButton.Enabled = !SelectedFieldIsKeyField;\r\n\r\n            // Databinding placeholders so they can change visibility\r\n            plhKeyFieldProperties.DataBind();\r\n            plhFieldProperties.DataBind();\r\n            plhDataUrl.DataBind();\r\n            plhAdvancedFieldProperties.DataBind();\r\n            plhSearch.DataBind();\r\n        }\r\n\r\n\r\n        private void UpdateDetailsSplitPanel(bool detailsSplitPanel)\r\n        {\r\n            DetailsSplitPanelPlaceHolder.Visible = detailsSplitPanel;\r\n        }\r\n\r\n\r\n        private void UpdatePositionFieldOptions()\r\n        {\r\n            var positionOptions = new Dictionary<int, string>();\r\n\r\n            for (int i = 0; i < PositionableFieldsCount; i++)\r\n            {\r\n                positionOptions.Add(i, (i + 1).ToString() + \".\");\r\n            }\r\n\r\n            positionOptions.Add(-1, GetString(\"PositionLast\"));\r\n\r\n            this.PositionField.DataSource = positionOptions;\r\n            this.PositionField.DataTextField = \"Value\";\r\n            this.PositionField.DataValueField = \"Key\";\r\n            this.PositionField.DataBind();\r\n        }\r\n\r\n\r\n        private void UpdateGroupByPriorityFieldOptions()\r\n        {\r\n            var groupByPriorityOptions = new Dictionary<int, string>\r\n            {\r\n                {0, GetString(\"GroupByPriorityNone\")},\r\n                {1, GetString(\"GroupByPriorityFirst\")}\r\n            };\r\n\r\n            int existingGroupedFieldCount = this.CurrentFields.Count(f => f.GroupByPriority > 0);\r\n\r\n            if (existingGroupedFieldCount > 0)\r\n            {\r\n                for (int i = 2; i <= existingGroupedFieldCount; i++)\r\n                {\r\n                    groupByPriorityOptions.Add(i, string.Format(GetString(\"GroupByPriorityN\"), i));\r\n                }\r\n\r\n                if (!CurrentFields.Any(f => f.Id == this.CurrentlySelectedFieldId && f.GroupByPriority > 0))\r\n                {\r\n                    groupByPriorityOptions.Add(existingGroupedFieldCount + 1, string.Format(GetString(\"GroupByPriorityN\"), existingGroupedFieldCount + 1));\r\n                }\r\n            }\r\n\r\n            this.GroupByPriorityField.DataSource = groupByPriorityOptions;\r\n            this.GroupByPriorityField.DataTextField = \"Value\";\r\n            this.GroupByPriorityField.DataValueField = \"Key\";\r\n            this.GroupByPriorityField.DataBind();\r\n        }\r\n\r\n\r\n        private void UpdateTreeOrderingFieldOptions()\r\n        {\r\n            var treeOrderingFieldOptions = new Dictionary<DataFieldTreeOrderingProfile, string>\r\n            {\r\n                {\r\n                    new DataFieldTreeOrderingProfile {OrderPriority = null}, \r\n                    GetString(\"TreeOrderingNone\")\r\n                },\r\n                {\r\n                    new DataFieldTreeOrderingProfile {OrderPriority = 1, OrderDescending = false},\r\n                    GetString(\"TreeOrderingFirstAscending\")\r\n                },\r\n                {\r\n                    new DataFieldTreeOrderingProfile {OrderPriority = 1, OrderDescending = true},\r\n                    GetString(\"TreeOrderingFirstDescending\")\r\n                }\r\n            };\r\n\r\n            int existingOrderedFieldCount = this.CurrentFields.Count(f => f.TreeOrderingProfile != null && f.TreeOrderingProfile.OrderPriority.HasValue);\r\n\r\n            if (existingOrderedFieldCount > 0)\r\n            {\r\n                for (int i = 2; i <= existingOrderedFieldCount; i++)\r\n                {\r\n                    treeOrderingFieldOptions.Add(\r\n                        new DataFieldTreeOrderingProfile { OrderPriority = i, OrderDescending = false }\r\n                        , string.Format(GetString(\"TreeOrderingNAscending\"), i));\r\n\r\n                    treeOrderingFieldOptions.Add(\r\n                        new DataFieldTreeOrderingProfile { OrderPriority = i, OrderDescending = true }\r\n                        , string.Format(GetString(\"TreeOrderingNDescending\"), i));\r\n                }\r\n\r\n                if (!CurrentFields.Any(f => f.Id == CurrentlySelectedFieldId && f.TreeOrderingProfile.OrderPriority > 0))\r\n                {\r\n                    treeOrderingFieldOptions.Add(\r\n                        new DataFieldTreeOrderingProfile { OrderPriority = existingOrderedFieldCount + 1, OrderDescending = false }\r\n                        , string.Format(GetString(\"TreeOrderingNAscending\"), existingOrderedFieldCount + 1));\r\n\r\n                    treeOrderingFieldOptions.Add(\r\n                        new DataFieldTreeOrderingProfile { OrderPriority = existingOrderedFieldCount + 1, OrderDescending = true }\r\n                        , string.Format(GetString(\"TreeOrderingNDescending\"), existingOrderedFieldCount + 1));\r\n                }\r\n            }\r\n\r\n            this.TreeOrderingField.DataSource = treeOrderingFieldOptions;\r\n            this.TreeOrderingField.DataTextField = \"Value\";\r\n            this.TreeOrderingField.DataValueField = \"Key\";\r\n            this.TreeOrderingField.DataBind();\r\n        }\r\n\r\n\r\n\r\n        private void UpdateFieldTypeDetailsSelector()\r\n        {\r\n            TypeDetailsSelector.ClearSelection();\r\n            TypeDetailsSelector.Items.Clear();\r\n\r\n            TypeDetailsPlaceHolder.Visible = true;\r\n            TypeDetailsOptionalPlaceHolder.Visible = true;\r\n\r\n            switch (this.TypeSelector.SelectedValue)\r\n            {\r\n                case \"System.String\":\r\n                    TypeDetailsLabel.Text = GetString(\"StringMaximumLength\");\r\n\r\n                    TypeDetailsSelector.AutoPostBack = true;\r\n                    TypeDetailsSelector.Items.AddRange(new []\r\n                    {\r\n                        new ListItem(Texts._16CharMax, \"16\"),\r\n                        new ListItem(Texts._32CharMax, \"32\"),\r\n                        new ListItem(Texts._64CharMax, \"64\"),\r\n                        new ListItem(Texts._128CharMax, \"128\"),\r\n                        new ListItem(Texts._256CharMax, \"256\"),\r\n                        new ListItem(Texts._512CharMax, \"512\"),\r\n                        new ListItem(Texts._1024CharMax, \"1024\"),\r\n                        new ListItem(Texts.Unlimited, \"max\")\r\n                    });\r\n                    \r\n                    TypeDetailsSelector.SelectedValue = \"64\";\r\n                    break;\r\n                case \"System.Decimal\":\r\n                    TypeDetailsLabel.Text = Texts.DecimalNumberFormat;\r\n                    TypeDetailsSelector.AutoPostBack = false; // this is a fix to plug bug in update manager (client)\r\n                    TypeDetailsSelector.Items.Add(new ListItem(Texts._1DecimalPlace, \"1\"));\r\n                    for (int i = 1; i < 16; i++)\r\n                    {\r\n                        TypeDetailsSelector.Items.Add(new ListItem(Texts.nDecimalPlaces(i), i.ToString()));\r\n                    }\r\n                    TypeDetailsSelector.SelectedValue = \"2\";\r\n                    break;\r\n                case \"Reference\":\r\n                    TypeDetailsLabel.Text = Texts.ReferenceType;\r\n                    TypeDetailsSelector.AutoPostBack = true;\r\n\r\n                    var typeList =\r\n                            from dataType in DataFacade.GetAllKnownInterfaces(UserType.Developer)\r\n                            where !dataType.IsNotReferenceable()\r\n                            orderby dataType.FullName\r\n                            select new { TypeManagerName = TypeManager.SerializeType(dataType), Label = dataType.GetShortLabel() };\r\n\r\n                    TypeDetailsSelector.DataSource = typeList;\r\n                    TypeDetailsSelector.DataTextField = \"Label\";\r\n                    TypeDetailsSelector.DataValueField = \"TypeManagerName\";\r\n                    TypeDetailsSelector.SelectedValue = null;\r\n                    TypeDetailsSelector.DataBind();\r\n                    break;\r\n                case \"System.Boolean\":\r\n                    TypeDetailsOptionalPlaceHolder.Visible = false;\r\n                    TypeDetailsPlaceHolder.Visible = false;\r\n                    break;\r\n                case \"XHTML\":\r\n                    TypeDetailsOptionalPlaceHolder.Visible = false;\r\n                    TypeDetailsPlaceHolder.Visible = false;\r\n                    break;\r\n                default:\r\n                    TypeDetailsPlaceHolder.Visible = false;\r\n                    break;\r\n            }\r\n        }\r\n\r\n        private void InitDataUrlProperties()\r\n        {\r\n            var field = SelectedField;\r\n\r\n            if (field == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            chkShowInDataUrl.Checked = field.DataUrlProfile != null;\r\n\r\n            RepopulateDataUrlSegmentOrder(true);\r\n\r\n            if (lstDataUrlDateFormat.Items.Count == 0)\r\n            {\r\n                Func<string, string> format = s => string.Format(s, \r\n                    Texts.DataUrlDateFormat_Year, Texts.DataUrlDateFormat_Month, Texts.DataUrlDateFormat_Day);\r\n\r\n                lstDataUrlDateFormat.Items.AddRange(new[]\r\n                {\r\n                    new ListItem(format(\"/{0}\"), DataUrlSegmentFormat.DateTime_Year.ToString()),\r\n                    new ListItem(format(\"/{0}/{1}\"), DataUrlSegmentFormat.DateTime_YearMonth.ToString()),\r\n                    new ListItem(format(\"/{0}/{1}/{2}\"), DataUrlSegmentFormat.DateTime_YearMonthDay.ToString())\r\n                });\r\n            }\r\n\r\n            var selectedValue = field.DataUrlProfile != null && field.DataUrlProfile.Format != null\r\n                                ?  field.DataUrlProfile.Format.Value\r\n                                : DataUrlSegmentFormat.DateTime_YearMonthDay;\r\n\r\n            lstDataUrlDateFormat.SelectedValue = selectedValue.ToString();\r\n        }\r\n\r\n\r\n        private void RepopulateDataUrlSegmentOrder(bool updateSelection)\r\n        {\r\n            var field = SelectedField;\r\n\r\n            if (_dataUrlOrderUpdated || field == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            int existingSelection = lstDataUrlOrder.SelectedIndex;\r\n\r\n            var otherUrlSegments = CurrentFields\r\n                .Where(f => f.DataUrlProfile != null && f.Id != field.Id)\r\n                .OrderBy(f => f.DataUrlProfile.Order)\r\n                .ToList();\r\n\r\n            lstDataUrlOrder.Items.Clear();\r\n            // Populating the selector\r\n            for (int i = 0; i <= otherUrlSegments.Count; i++)\r\n            {\r\n                var fieldsInUrlPreviewOrder =\r\n                    otherUrlSegments.Take(i)\r\n                    .Concat(new[] { field })\r\n                    .Concat(otherUrlSegments.Skip(i));\r\n\r\n                var previewStr = string.Join(\"/\", fieldsInUrlPreviewOrder.Select(GetUrlSegmentPreview));\r\n\r\n                lstDataUrlOrder.Items.Add(new ListItem(previewStr, i.ToString()));\r\n            }\r\n\r\n            if (updateSelection)\r\n            {\r\n                int selectedIndex = otherUrlSegments.Count;\r\n\r\n                if (field.DataUrlProfile != null && field.DataUrlProfile.Order <= otherUrlSegments.Count)\r\n                {\r\n                    selectedIndex = field.DataUrlProfile.Order;\r\n                }\r\n\r\n                lstDataUrlOrder.SelectedIndex = selectedIndex;\r\n            }\r\n            else\r\n            {\r\n                lstDataUrlOrder.SelectedIndex = existingSelection;\r\n            }\r\n\r\n            _dataUrlOrderUpdated = true;\r\n        }\r\n\r\n\r\n\r\n        private void InitSearchProperties()\r\n        {\r\n            var field = SelectedField;\r\n\r\n            if (field == null) return;\r\n\r\n            bool fieldIsSearchable = IsSearchable && !SelectedFieldIsKeyField;\r\n\r\n            Type fieldType = field.InstanceType;\r\n            bool isDataReference = !string.IsNullOrEmpty(field.ForeignKeyReferenceTypeName);\r\n\r\n            bool indexTextEnabled = fieldIsSearchable\r\n                && !isDataReference \r\n                && (fieldType == typeof(string));\r\n\r\n            bool searchPreviewEnabled = fieldIsSearchable\r\n                && !isDataReference\r\n                && (fieldType == typeof(string)\r\n                || fieldType == typeof(DateTime)\r\n                || fieldType == typeof(DateTime?)\r\n                || fieldType == typeof(decimal)\r\n                || fieldType == typeof(decimal?)\r\n                || fieldType == typeof(int)\r\n                || fieldType == typeof(int?)\r\n                || fieldType == typeof(bool));\r\n\r\n            bool facetedSearchEnabled = fieldIsSearchable\r\n                && (isDataReference \r\n                    || fieldType == typeof(string)\r\n                    || fieldType == typeof(DateTime)\r\n                    || fieldType == typeof(DateTime?)\r\n                    || fieldType == typeof(bool));\r\n\r\n            plhSearch.Visible = indexTextEnabled || searchPreviewEnabled || facetedSearchEnabled;\r\n\r\n            plhSearch_IndexText.Visible = indexTextEnabled;\r\n            plhSearch_FieldPreview.Visible = searchPreviewEnabled;\r\n            plhSearch_FacetedSearch.Visible = facetedSearchEnabled;\r\n\r\n            chkIndexText.Checked = indexTextEnabled && field.SearchProfile != null && field.SearchProfile.IndexText;\r\n            chkSearchPreview.Checked = searchPreviewEnabled && field.SearchProfile != null && field.SearchProfile.EnablePreview;\r\n            chkFacetField.Checked = facetedSearchEnabled && field.SearchProfile != null && field.SearchProfile.IsFacet;\r\n        }\r\n\r\n\r\n\r\n        private string GetUrlSegmentPreview(DataFieldDescriptor field)\r\n        {\r\n            string formatString = \"\";\r\n\r\n            //if (field.InstanceType == typeof (DateTime))\r\n            //{\r\n            //    string year = Texts.DataUrlDateFormat_Year;\r\n            //    string month = Texts.DataUrlDateFormat_Month;\r\n            //    string day = Texts.DataUrlDateFormat_Day;\r\n\r\n            //    var format = DataUrlSegmentFormat.DateTime_YearMonthDay;\r\n            //    if (field.DataUrlProfile != null && field.DataUrlProfile.Format != null)\r\n            //    {\r\n            //        format = field.DataUrlProfile.Format.Value;\r\n            //    }\r\n\r\n            //    switch (format)\r\n            //    {\r\n            //        case DataUrlSegmentFormat.DateTime_Year:\r\n            //            formatString = \":\" + year;\r\n            //            break;\r\n            //        case DataUrlSegmentFormat.DateTime_YearMonth:\r\n            //            formatString = \":\" + year + \",\" + month;\r\n            //            break;\r\n            //        case DataUrlSegmentFormat.DateTime_YearMonthDay:\r\n            //            formatString = \":\" + year + \",\" + month + \",\" + day;\r\n            //            break;\r\n            //    }\r\n            //}\r\n\r\n            return \"{\" + field.Name + formatString + \"}\";\r\n        }\r\n\r\n\r\n        protected void TypeDetailsSelector_Reference_SelectedIndexChanged(object sender, EventArgs e)\r\n        {\r\n            CheckAndFixWrongOptionalSelection();\r\n\r\n            if (TypeSelector.SelectedValue == \"Reference\")\r\n            {\r\n                ResetWidgetSelector();\r\n                ResetDefaultValueSelector();\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        private void ResetWidgetSelector()\r\n        {\r\n            string widgetFunctionMarkup = \"\";\r\n\r\n            WidgetFunctionProvider widgetFunctionProvider = StandardWidgetFunctions.GetDefaultWidgetFunctionProviderByType(this.CurrentlySelectedWidgetReturnType);\r\n            if (widgetFunctionProvider != null)\r\n            {\r\n                widgetFunctionMarkup = widgetFunctionProvider.SerializedWidgetFunction.ToString(SaveOptions.DisableFormatting);\r\n            } \r\n\r\n            btnWidgetFunctionMarkup.Value = widgetFunctionMarkup;\r\n\r\n            if (widgetFunctionMarkup == \"\")\r\n            {\r\n                Baloon(btnWidgetFunctionMarkup.ClientID, GetString(\"NoWidgetSelected\")); \r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void ResetDefaultValueSelector()\r\n        {\r\n            if (this.TypeSelector.SelectedValue == \"XHTML\")\r\n            {\r\n                var functionParameters = new Dictionary<string,object>\r\n                {\r\n                    {\"Constant\", new XhtmlDocument()}\r\n                };\r\n                var functionTree = FunctionFacade.BuildTree(StandardFunctions.XhtmlDocumentFunction, functionParameters);\r\n                btnDefaultValueFunctionMarkup.Value = functionTree.Serialize().ToString();\r\n\r\n                return;\r\n            }\r\n            if (btnDefaultValueFunctionMarkup.Value.IsNullOrEmpty())\r\n            {\r\n                return;\r\n            }\r\n            \r\n            try\r\n            {\r\n                XElement functionElement = XElement.Parse(btnDefaultValueFunctionMarkup.Value);\r\n                if (functionElement.Name.Namespace != Namespaces.Function10)\r\n                {\r\n                    functionElement = functionElement.Elements().First();\r\n                }\r\n                    \r\n                var functionNode = (BaseFunctionRuntimeTreeNode) FunctionFacade.BuildTree(functionElement);\r\n\r\n\r\n                IFunction function = FunctionFacade.GetFunction(functionNode.GetCompositeName());\r\n\r\n                if (function.ReturnType != this.CurrentlySelectedDefaultValueFunctionReturnType)\r\n                {\r\n                    btnDefaultValueFunctionMarkup.Value = \"\";\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, \"Default value settings reset. Existing function markup failed to validate with the following message: '{0}'\", ex.Message);\r\n                btnDefaultValueFunctionMarkup.Value = \"\";\r\n            }\r\n        }\r\n\r\n\r\n        protected void PositionField_SelectedIndexChanged(object sender, EventArgs e)\r\n        {\r\n            FieldSettingsChanged(sender, e);\r\n            UpdateFieldsPanel();\r\n        }\r\n\r\n\r\n\r\n        protected void TypeSelector_SelectedIndexChanged(object sender, EventArgs e)\r\n        {\r\n            UpdateFieldTypeDetailsSelector();\r\n            CheckAndFixWrongOptionalSelection();\r\n\r\n            var fields = CurrentFields;\r\n\r\n            DataFieldDescriptor selectedField = fields.Single(f => f.Id == this.CurrentlySelectedFieldId);\r\n            selectedField.ValidationFunctionMarkup = null;\r\n            btnValidationRulesFunctionMarkup.Value = \"\";\r\n\r\n            FieldSettingsChanged(sender, e);\r\n\r\n            ResetWidgetSelector();\r\n            ResetDefaultValueSelector();\r\n        }\r\n\r\n\r\n\r\n        protected void OptionalSelector_SelectedIndexChanged(object sender, EventArgs e)\r\n        {\r\n            CheckAndFixWrongOptionalSelection();\r\n\r\n            if (this.TypeSelector.SelectedValue == \"Reference\" \r\n                || (this.CurrentlySelectedType != typeof(string) && this.CurrentlySelectedType != typeof(DateTime)))\r\n            {\r\n                ResetWidgetSelector();\r\n            }\r\n\r\n            FieldSettingsChanged(sender, e);\r\n        }\r\n\r\n\r\n\r\n        private void CheckAndFixWrongOptionalSelection()\r\n        {\r\n            if (this.OptionalSelector.SelectedValue == \"true\")\r\n            {\r\n                this.OptionalSelector.SelectedValue = \"false\";\r\n                bool notOptional = this.CurrentlySelectedType == typeof(bool) || this.TypeSelector.SelectedValue == \"XHTML\";\r\n\r\n                if (notOptional)\r\n                {\r\n                    UpdateDetailsSplitPanel(true);\r\n                }\r\n                else\r\n                {\r\n                    this.OptionalSelector.SelectedValue = \"true\";\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n\r\n        protected void FieldDataList_ItemCommand(Object sender, EventArgs e)\r\n        {\r\n            var repeaterEventArgs = (RepeaterCommandEventArgs)e;\r\n            Guid fieldId = new Guid(repeaterEventArgs.CommandArgument.ToString());\r\n\r\n            if (ValidateSave())\r\n            {\r\n                switch (repeaterEventArgs.CommandName)\r\n                {\r\n                    case \"Select\":\r\n                        Field_Select(fieldId);\r\n                        break;\r\n                    default:\r\n                        throw new Exception(\"unhandled item command name: \" + repeaterEventArgs.CommandName);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                UpdateFieldsPanel();\r\n            }\r\n        }\r\n\r\n\r\n        private void Field_Delete(Guid fieldId)\r\n        {\r\n            var field = CurrentFields.Single(f => f.Id == fieldId);\r\n\r\n            if (CurrentLabelFieldName == field.Name)\r\n            {\r\n                CurrentLabelFieldName = \"\";\r\n            }\r\n\r\n            CurrentFields.RemoveAll(f => f.Id == fieldId);\r\n\r\n            if (CurrentlySelectedFieldId == fieldId)\r\n            {\r\n                CurrentlySelectedFieldId = Guid.Empty;\r\n            }\r\n\r\n            foreach (DataFieldDescriptor laterField in this.CurrentFields.Where(f => f.Position > field.Position))\r\n            {\r\n                laterField.Position--;\r\n            }\r\n\r\n            EnsureGroupByPrioritySequence();\r\n            EnsureTreeOrderPrioritySequence();\r\n\r\n            UpdatePositionFieldOptions();\r\n            UpdateTreeOrderingFieldOptions();\r\n            UpdateGroupByPriorityFieldOptions();\r\n\r\n            this.PositionField.SelectedValue = \"-1\";\r\n            this.GroupByPriorityField.SelectedValue = \"0\";\r\n            this.TreeOrderingField.SelectedValue = null;\r\n            this.NameField.Text = \"\";\r\n\r\n            UpdateFieldsPanel();\r\n\r\n            UpdateDetailsSplitPanel(false);\r\n        }\r\n\r\n\r\n\r\n        private void Field_Select(Guid fieldId)\r\n        {\r\n            if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                if (!ValidateSave())\r\n                {\r\n                    return;\r\n                }\r\n\r\n                Field_Save();\r\n            }\r\n\r\n            this.CurrentlySelectedFieldId = fieldId;\r\n            var selectedField = SelectedField;\r\n\r\n            InitializeDetailsSplitPanel();\r\n\r\n            this.NameField.Text = selectedField.Name;\r\n\r\n            if (!SelectedFieldIsKeyField)\r\n            {\r\n                this.IsTitleFieldDateTimeSelector.Checked = (this.CurrentLabelFieldName == selectedField.Name);\r\n\r\n                this.LabelField.Text = selectedField.FormRenderingProfile.Label;\r\n                this.HelpField.Text = selectedField.FormRenderingProfile.HelpText;\r\n                btnWidgetFunctionMarkup.Value = selectedField.FormRenderingProfile.WidgetFunctionMarkup;\r\n                btnDefaultValueFunctionMarkup.Value = selectedField.NewInstanceDefaultFieldValue;\r\n\r\n                if (string.IsNullOrEmpty(selectedField.ForeignKeyReferenceTypeName))\r\n                {\r\n                    if (selectedField.InstanceType.IsGenericType\r\n                        && selectedField.InstanceType.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n                    {\r\n                        Type underlying = selectedField.InstanceType.GetGenericArguments()[0];\r\n                        this.TypeSelector.SelectedValue = underlying.FullName;\r\n                    }\r\n                    else\r\n                    {\r\n                        this.TypeSelector.SelectedValue = selectedField.InstanceType.FullName;\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    this.TypeSelector.SelectedValue = \"Reference\";\r\n                }\r\n\r\n                // XHTML compensate\r\n                if (selectedField.InstanceType == typeof(string) && selectedField.StoreType.IsLargeString \r\n                    && !string.IsNullOrEmpty(selectedField.FormRenderingProfile.WidgetFunctionMarkup))\r\n                {\r\n                    var visualEditorWidgetName = StandardWidgetFunctions.VisualXhtmlDocumentEditorWidget.WidgetFunctionCompositeName;\r\n                    var widgetFunction = XElement.Parse(selectedField.FormRenderingProfile.WidgetFunctionMarkup);\r\n                    if ((string)widgetFunction.Attribute(\"name\") == visualEditorWidgetName)\r\n                    {\r\n                        this.TypeSelector.SelectedValue = \"XHTML\";\r\n                    }\r\n                }\r\n\r\n                this.OptionalSelector.SelectedValue = selectedField.IsNullable ? \"true\" : \"false\";\r\n\r\n                UpdateFieldTypeDetailsSelector();\r\n\r\n                btnValidationRulesFunctionMarkup.Value = \"\";\r\n\r\n                if (selectedField.ValidationFunctionMarkup != null && selectedField.ValidationFunctionMarkup.Count > 0)\r\n                {\r\n                    btnValidationRulesFunctionMarkup.Value = string.Format(\"<functions>{0}</functions>\", String.Concat(selectedField.ValidationFunctionMarkup.ToArray()));\r\n                }\r\n\r\n                if (this.TypeSelector.SelectedValue != \"Reference\")\r\n                {\r\n                    if (selectedField.InstanceType == typeof(string))\r\n                    {\r\n                        if (selectedField.StoreType.IsLargeString)\r\n                        {\r\n                            this.TypeDetailsSelector.SelectedValue = \"max\";\r\n                        }\r\n                        else\r\n                        {\r\n                            ListItem selected = this.TypeDetailsSelector.Items.FindByValue(selectedField.StoreType.MaximumLength.ToString());\r\n                            if (selected == null)\r\n                            {\r\n                                selected = new ListItem(selectedField.StoreType.MaximumLength.ToString());\r\n                                this.TypeDetailsSelector.Items.Add(selected);\r\n                            }\r\n                            this.TypeDetailsSelector.ClearSelection();\r\n                            selected.Selected = true;\r\n                        }\r\n                    }\r\n                    if (selectedField.InstanceType == typeof(decimal) || selectedField.InstanceType == typeof(decimal?))\r\n                    {\r\n                        ListItem selected = this.TypeDetailsSelector.Items.FindByValue(selectedField.StoreType.NumericScale.ToString());\r\n                        if (selected == null)\r\n                        {\r\n                            selected = new ListItem(selectedField.StoreType.NumericScale.ToString());\r\n                            this.TypeDetailsSelector.Items.Add(selected);\r\n                        }\r\n                        this.TypeDetailsSelector.SelectedValue = selected.Value;\r\n                        //selected.Selected = true;\r\n                    }\r\n                }\r\n\r\n                if (!string.IsNullOrEmpty(selectedField.ForeignKeyReferenceTypeName))\r\n                {\r\n                    try\r\n                    {\r\n                        this.TypeDetailsSelector.SelectedValue = selectedField.ForeignKeyReferenceTypeName;\r\n                    }\r\n                    catch (Exception)\r\n                    {\r\n                        Baloon(this.TypeDetailsSelector, string.Format(\"Unable to set original value. '{0}' is not known.\", selectedField.ForeignKeyReferenceTypeName));\r\n                    }\r\n                }\r\n\r\n                this.PositionField.SelectedValue = (selectedField.Position == PositionableFieldsCount - 1 ? \"-1\" : selectedField.Position.ToString());\r\n\r\n                UpdateGroupByPriorityFieldOptions();\r\n                UpdateTreeOrderingFieldOptions();\r\n                this.GroupByPriorityField.SelectedValue = selectedField.GroupByPriority.ToString();\r\n                this.TreeOrderingField.SelectedValue = selectedField.TreeOrderingProfile.ToString();\r\n            }\r\n        }\r\n\r\n\r\n\r\n        \r\n        private string CurrentKeyFieldName\r\n        {\r\n            get\r\n            {\r\n                return (string)this.ViewState[\"CurrentKeyFieldName\"] ?? \"\";\r\n            }\r\n            set\r\n            {\r\n                this.ViewState[\"CurrentKeyFieldName\"] = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private string CurrentLabelFieldName\r\n        {\r\n            get\r\n            {\r\n                return (string)this.ViewState[\"LabelFieldName\"] ?? \"\";\r\n            }\r\n            set\r\n            {\r\n                this.ViewState[\"LabelFieldName\"] = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected Guid CurrentlySelectedFieldId\r\n        {\r\n            get\r\n            {\r\n                object editorFieldId = this.ViewState[\"editedFieldId\"];\r\n                return (Guid?) editorFieldId ?? Guid.Empty;\r\n            }\r\n            set\r\n            {\r\n                this.ViewState[\"editedFieldId\"] = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected bool HasFields\r\n        {\r\n            get { return this.CurrentFields.Count > 0; }\r\n        }\r\n\r\n        protected bool CanAppearInDataRoute\r\n        {\r\n            get\r\n            {\r\n                var field = SelectedField;\r\n                if (field == null || field.IsNullable) return false;\r\n\r\n                if (TypeSelector.SelectedValue == \"Reference\")\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                var instanceType = field.InstanceType;\r\n                \r\n                if (instanceType == typeof (string))\r\n                {\r\n                    var selectedValue = TypeDetailsSelector.SelectedValue;\r\n\r\n                    return selectedValue != \"max\" && selectedValue != \"\" && int.Parse(selectedValue) <= 128;\r\n                }\r\n\r\n                return instanceType == typeof (Guid)\r\n                        || instanceType == typeof (Int16)\r\n                        || instanceType == typeof (Int32)\r\n                        || instanceType == typeof (Int64)\r\n                        || instanceType == typeof (decimal)\r\n                        || instanceType == typeof (DateTime);\r\n            }\r\n        }\r\n\r\n\r\n        protected bool SelectedFieldIsKeyField\r\n        {\r\n            get\r\n            {\r\n                Guid fieldId = CurrentlySelectedFieldId;\r\n                return fieldId != Guid.Empty && CurrentFields.Any(f => f.Id == fieldId && f.Name == CurrentKeyFieldName);\r\n            }\r\n        }\r\n\r\n\r\n        protected DataFieldDescriptor SelectedField\r\n        {\r\n            get\r\n            {\r\n                Guid fieldId = CurrentlySelectedFieldId;\r\n                return CurrentFields.FirstOrDefault(f => f.Id == fieldId);\r\n            }\r\n        }\r\n\r\n\r\n        protected int PositionableFieldsCount\r\n        {\r\n            get { return this.CurrentFields.Count(f => f.Name != CurrentKeyFieldName); }\r\n        }\r\n\r\n\r\n        private List<DataFieldDescriptor> CurrentFields\r\n        {\r\n            get\r\n            {\r\n                var value = this.ViewState[\"Fields\"];\r\n                Verify.IsNotNull(value, \"ViewState element 'Fields' does not exist\");\r\n                return (List<DataFieldDescriptor>) value;\r\n            }\r\n\r\n            set\r\n            {\r\n                this.ViewState[\"Fields\"] = value;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private string CurrentForeignKeyReferenceTypeName\r\n        {\r\n            get\r\n            {\r\n                switch (this.TypeSelector.SelectedValue)\r\n                {\r\n                    case \"Reference\":\r\n                        return this.TypeDetailsSelector.SelectedValue;\r\n                    default:\r\n                        return null;\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private Type GetInstanceTypeForReference(Type referencedType)\r\n        {\r\n            var keyProperties = DataAttributeFacade.GetKeyProperties(referencedType);\r\n\r\n            if (keyProperties.Count == 1)\r\n            {\r\n                return keyProperties[0].PropertyType;\r\n            }\r\n            \r\n            // with multi key types we go with a string\r\n            return typeof(string);\r\n        }\r\n\r\n\r\n\r\n        protected Type CurrentlySelectedTypeValidatorType\r\n        {\r\n            get\r\n            {\r\n                Type builderGenericBase = typeof(PropertyValidatorBuilder<>);\r\n\r\n                Type selectedType = this.CurrentlySelectedType;\r\n                // Nullable<T> handling\r\n                if (selectedType.IsGenericType && selectedType.GetGenericTypeDefinition() == typeof(Nullable<>))\r\n                {\r\n                    selectedType = selectedType.GetGenericArguments()[0];\r\n                }\r\n\r\n                return builderGenericBase.MakeGenericType(selectedType);\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected Type CurrentlySelectedWidgetReturnType\r\n        {\r\n            get\r\n            {\r\n                if (TypeSelector.SelectedValue == \"XHTML\")\r\n                {\r\n                    return typeof(XhtmlDocument);\r\n                }\r\n\r\n                Type selectedType = this.CurrentlySelectedType;\r\n\r\n                if (this.CurrentForeignKeyReferenceTypeName != null)\r\n                {\r\n                    Type referencedType = TypeManager.GetType(this.CurrentForeignKeyReferenceTypeName);\r\n                    if (referencedType == null) throw new InvalidOperationException(\"Missing value for referenced type!\" + this.CurrentForeignKeyReferenceTypeName);\r\n                    Type[] typeArg = { referencedType };\r\n\r\n                    if (this.OptionalSelector.SelectedValue == \"true\")\r\n                    {\r\n                        selectedType = typeof(NullableDataReference<>).MakeGenericType(typeArg);\r\n                    }\r\n                    else\r\n                    {\r\n                        selectedType = typeof(DataReference<>).MakeGenericType(typeArg);\r\n                    }\r\n                }\r\n\r\n\r\n                return selectedType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected Type CurrentlySelectedDefaultValueFunctionReturnType\r\n        {\r\n            get\r\n            {\r\n                Type selectedType = this.CurrentlySelectedType;\r\n\r\n                if (this.CurrentForeignKeyReferenceTypeName != null)\r\n                {\r\n                    Type referencedType = TypeManager.GetType(this.CurrentForeignKeyReferenceTypeName);\r\n                    if (referencedType == null) throw new InvalidOperationException(\"Missing value for referenced type!\" + this.CurrentForeignKeyReferenceTypeName);\r\n\r\n                    selectedType = typeof(DataReference<>).MakeGenericType(new[]{ referencedType });\r\n                }\r\n\r\n\r\n                return selectedType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected string CurrentlySelectedWidgetText\r\n        {\r\n            get\r\n            {\r\n                if (!btnWidgetFunctionMarkup.Value.IsNullOrEmpty())\r\n                {\r\n                    try\r\n                    {\r\n                        XElement functionElement = XElement.Parse(btnWidgetFunctionMarkup.Value);\r\n                        if (functionElement.Name.Namespace != Namespaces.Function10)\r\n                        {\r\n                            functionElement = functionElement.Elements().First();\r\n                        }\r\n                        var widgetNode = (BaseFunctionRuntimeTreeNode) FunctionFacade.BuildTree(functionElement);\r\n                        return widgetNode.GetName();\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(LogTitle, \"Widget settings reset. Existing widget failed to validate with the following message: '{0}'\", ex.Message);\r\n                        btnWidgetFunctionMarkup.Value = string.Empty;\r\n                    }\r\n                }\r\n\r\n                return GetString(\"NoWidgetSelectedLabel\");\r\n            }\r\n        }\r\n\r\n\r\n\r\n        protected string CurrentlySelectedDefaultValueText\r\n        {\r\n            get\r\n            {\r\n                if (!btnDefaultValueFunctionMarkup.Value.IsNullOrEmpty())\r\n                {\r\n                    try\r\n                    {\r\n                        XElement functionElement = XElement.Parse(btnDefaultValueFunctionMarkup.Value);\r\n                        if (functionElement.Name.Namespace != Namespaces.Function10)\r\n                            functionElement = functionElement.Elements().First();\r\n                        var widgetNode = (BaseFunctionRuntimeTreeNode)FunctionFacade.BuildTree(functionElement);\r\n                        return widgetNode.GetName();\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(LogTitle, \"Widget settings reset. Existing widget failed to validate with the following message: '{0}'\", ex.Message);\r\n                        btnWidgetFunctionMarkup.Value = \"\";\r\n                    }\r\n                }\r\n\r\n                return \"(no default value)\";\r\n            }\r\n        }\r\n\r\n        private Type CurrentlySelectedType\r\n        {\r\n            get\r\n            {\r\n                Type selectedType;\r\n                switch (this.TypeSelector.SelectedValue)\r\n                {\r\n                    case \"Reference\":\r\n                        Type referencedType = TypeManager.GetType(this.CurrentForeignKeyReferenceTypeName);\r\n                        selectedType = GetInstanceTypeForReference(referencedType);\r\n                        break;\r\n                    case \"XHTML\":\r\n                        selectedType = typeof(string);\r\n                        break;\r\n                    default:\r\n                        selectedType = TypeManager.GetType(this.TypeSelector.SelectedValue);\r\n                        break;\r\n                }\r\n\r\n                if (this.OptionalSelector.SelectedValue == \"true\")\r\n                {\r\n                    if (selectedType == typeof(string)) return typeof(string);\r\n\r\n                    if (selectedType == typeof(Guid)) return typeof(Guid?);\r\n                    if (selectedType == typeof(int)) return typeof(int?);\r\n                    if (selectedType == typeof(decimal)) return typeof(decimal?);\r\n                    if (selectedType == typeof(DateTime)) return typeof(DateTime?);\r\n\r\n                    if (selectedType == typeof(bool)) throw new InvalidOperationException(\"bool can not be nullable\");\r\n\r\n                    throw new InvalidOperationException(\"an unhandled nullable type\");\r\n                }\r\n\r\n                return selectedType;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private StoreFieldType CurrentlySelectedStoreFieldType\r\n        {\r\n            get\r\n            {\r\n                switch (this.TypeSelector.SelectedValue)\r\n                {\r\n                    case \"System.String\":\r\n                        if (this.TypeDetailsSelector.SelectedValue == \"max\") return StoreFieldType.LargeString;\r\n                        return StoreFieldType.String(Int32.Parse(this.TypeDetailsSelector.SelectedValue));\r\n                    case \"XHTML\":\r\n                        return StoreFieldType.LargeString;\r\n                    case \"System.Int32\":\r\n                        return StoreFieldType.Integer;\r\n                    case \"System.Decimal\":\r\n                        int decimalPlaces = Int32.Parse(this.TypeDetailsSelector.SelectedValue);\r\n                        return StoreFieldType.Decimal(28, decimalPlaces);\r\n                    case \"System.DateTime\":\r\n                        return StoreFieldType.DateTime;\r\n                    case \"System.Boolean\":\r\n                        return StoreFieldType.Boolean;\r\n                    case \"System.Guid\":\r\n                        return StoreFieldType.Guid;\r\n                    case \"Reference\":\r\n                        Type referencedType = TypeManager.GetType(this.CurrentForeignKeyReferenceTypeName);\r\n                        var keyProperties = referencedType.GetKeyProperties();\r\n\r\n                        if (keyProperties.Count == 1)\r\n                        {\r\n                            object[] storeFieldTypeAttributes = keyProperties[0].GetCustomAttributes(typeof(StoreFieldTypeAttribute), true);\r\n                            if (storeFieldTypeAttributes.Length == 1)\r\n                            {\r\n                                return ((StoreFieldTypeAttribute)storeFieldTypeAttributes[0]).StoreFieldType;\r\n                            }\r\n                            \r\n                            throw new InvalidOperationException(\"Referenced types key field is missing an StoreFieldType attribute.\");\r\n                            \r\n                        }\r\n                        \r\n                        // with multi key types we go with a string\r\n                        return StoreFieldType.LargeString;\r\n                    default:\r\n                        throw new InvalidOperationException(\"can not locate store type - unmapped type\");\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        protected void AddNewButton_Click(object sender, EventArgs e)\r\n        {\r\n            if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                if (!ValidateSave())\r\n                {\r\n                    return;\r\n                }\r\n\r\n                Field_Save();\r\n\r\n                CurrentlySelectedFieldId = Guid.Empty;\r\n            }\r\n\r\n            string newFieldName = _defaultFieldNamePrefix;\r\n\r\n            int i = 2;\r\n            while (this.CurrentFields.Any(f => f.Name == newFieldName))\r\n            {\r\n                newFieldName = _defaultFieldNamePrefix + i++;\r\n            }\r\n\r\n            var stringSelectorWidgetFunctionMarkup =\r\n                StandardWidgetFunctions.GetDefaultWidgetFunctionProviderByType(typeof (string))\r\n                    .SerializedWidgetFunction.ToString(SaveOptions.DisableFormatting);\r\n\r\n            Guid newFieldId = Guid.NewGuid();\r\n            this.CurrentFields.Add(new DataFieldDescriptor(newFieldId, newFieldName, StoreFieldType.String(64), typeof(string))\r\n            {\r\n                Position = PositionableFieldsCount,\r\n                FormRenderingProfile = new DataFieldFormRenderingProfile\r\n                {\r\n                    WidgetFunctionMarkup = stringSelectorWidgetFunctionMarkup\r\n                }\r\n            });\r\n\r\n            if (string.IsNullOrEmpty(this.CurrentLabelFieldName))\r\n            {\r\n                this.CurrentLabelFieldName = newFieldName;\r\n            }\r\n\r\n\r\n            Field_Select(newFieldId);\r\n            \r\n            UpdateFieldsPanel();\r\n            MakeClientDirty();\r\n        }\r\n\r\n\r\n\r\n        private bool ValidateSave()\r\n        {\r\n            if (this.CurrentlySelectedFieldId == Guid.Empty) return true;\r\n\r\n            var nameField = SelectedFieldIsKeyField ? this.txtKeyFieldName : this.NameField;\r\n\r\n            if (nameField.Text.Contains(\" \"))\r\n            {\r\n                Baloon(nameField, Texts.SpaceInNameError);\r\n                return false;\r\n            }\r\n\r\n            if (string.IsNullOrEmpty(this.NameField.Text))\r\n            {\r\n                Baloon(nameField, Texts.NameEmptyError);\r\n                return false;\r\n            }\r\n\r\n            if (this.CurrentFields.Any(f => f.Name == this.NameField.Text && f.Id != this.CurrentlySelectedFieldId))\r\n            {\r\n                Baloon(nameField, Texts.NameAlreadyInUseError);\r\n                return false;\r\n            }\r\n\r\n            string err;\r\n            if (!NameValidation.TryValidateName(nameField.Text, out err))\r\n            {\r\n                Baloon(nameField, err);\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private void Baloon(Control c, string message)\r\n        {\r\n            Baloon(c.UniqueID, message);\r\n        }\r\n\r\n        private void Baloon(string fieldName, string message)\r\n        {\r\n            var fm = new FieldMessage(fieldName, message);\r\n\r\n            BaloonPlaceHolder.Controls.Add(fm);\r\n        }\r\n\r\n        private void UpdateFieldsPanel()\r\n        {\r\n            this.FieldListRepeater.DataSource = CurrentFields;\r\n            this.FieldListRepeater.DataBind();\r\n        }\r\n\r\n        private void Field_Save()\r\n        {\r\n            var field = this.CurrentFields.Single(f => f.Id == this.CurrentlySelectedFieldId);\r\n\r\n\r\n            if (SelectedFieldIsKeyField)\r\n            {\r\n                Field_Save_UpdateDataUrl(field, true);\r\n\r\n                if (KeyFieldReadOnly)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                if (!Field_Save_UpdateName(field, this.txtKeyFieldName))\r\n                {\r\n                    return;\r\n                }\r\n\r\n                var currentFieldType = KeyFieldHelper.GetKeyFieldType(field);\r\n\r\n                GeneratedTypesHelper.KeyFieldType selectedFieldType;\r\n\r\n                bool parsedOk = Enum.TryParse(lstKeyType.SelectedValue, out selectedFieldType);\r\n                Verify.That(parsedOk, \"Failed to parse key field type\");\r\n\r\n                if (currentFieldType != selectedFieldType)\r\n                {\r\n                    KeyFieldHelper.UpdateKeyType(field, selectedFieldType);\r\n                }\r\n\r\n                return;\r\n            }\r\n\r\n\r\n            if (!Field_Save_UpdateName(field, this.NameField))\r\n            {\r\n                return;\r\n            }\r\n\r\n            field.InstanceType = this.CurrentlySelectedType;\r\n            field.ForeignKeyReferenceTypeName = this.CurrentForeignKeyReferenceTypeName;\r\n\r\n            field.StoreType = this.CurrentlySelectedStoreFieldType;\r\n\r\n            if (this.IsTitleFieldDateTimeSelector.Checked)\r\n            {\r\n                this.CurrentLabelFieldName = field.Name;\r\n            }\r\n            else\r\n            {\r\n                if (this.CurrentLabelFieldName == field.Name)\r\n                {\r\n                    this.CurrentLabelFieldName = \"\";\r\n                }\r\n            }\r\n\r\n            bool generateLabel = this.LabelField.Text == \"\" && !this.NameField.Text.StartsWith(_defaultFieldNamePrefix);\r\n            string label = generateLabel ? this.NameField.Text : this.LabelField.Text;\r\n\r\n            field.IsNullable = bool.Parse(this.OptionalSelector.SelectedValue);\r\n\r\n            field.FormRenderingProfile.Label = label;\r\n            field.FormRenderingProfile.HelpText = this.HelpField.Text;\r\n\r\n            if (!btnWidgetFunctionMarkup.Value.IsNullOrEmpty())\r\n            {\r\n                var functionElement = XElement.Parse(btnWidgetFunctionMarkup.Value);\r\n                if (functionElement.Name.Namespace != Namespaces.Function10)\r\n                {\r\n                    functionElement = functionElement.Elements().First();\r\n                }\r\n\r\n                field.FormRenderingProfile.WidgetFunctionMarkup = functionElement.ToString(SaveOptions.DisableFormatting);\r\n            }\r\n            else\r\n            {\r\n                field.FormRenderingProfile.WidgetFunctionMarkup = \"\";\r\n            }\r\n\r\n            if (!btnDefaultValueFunctionMarkup.Value.IsNullOrEmpty())\r\n            {\r\n                var functionElement = XElement.Parse(btnDefaultValueFunctionMarkup.Value);\r\n\r\n                if (functionElement.Name.Namespace != Namespaces.Function10)\r\n                    functionElement = functionElement.Elements().First();\r\n\r\n                field.NewInstanceDefaultFieldValue = functionElement.ToString(SaveOptions.DisableFormatting);\r\n            }\r\n            else\r\n            {\r\n                field.NewInstanceDefaultFieldValue = null;\r\n            }\r\n\r\n            field.ValidationFunctionMarkup = null;\r\n\r\n            if (!field.IsNullable)\r\n            {\r\n                switch (this.CurrentlySelectedStoreFieldType.PhysicalStoreType)\r\n                {\r\n                    case PhysicalStoreFieldType.Integer:\r\n                    case PhysicalStoreFieldType.Long:\r\n                        field.DefaultValue = DefaultValue.Integer(0);\r\n                        break;\r\n                    case PhysicalStoreFieldType.Decimal:\r\n                        field.DefaultValue = DefaultValue.Decimal(0);\r\n                        break;\r\n                    case PhysicalStoreFieldType.String:\r\n                    case PhysicalStoreFieldType.LargeString:\r\n                        field.DefaultValue = DefaultValue.String(\"\");\r\n                        break;\r\n                    case PhysicalStoreFieldType.DateTime:\r\n                        field.DefaultValue = DefaultValue.Now;\r\n                        break;\r\n                    case PhysicalStoreFieldType.Guid:\r\n                        field.DefaultValue = DefaultValue.Guid(Guid.Empty);\r\n                        break;\r\n                    case PhysicalStoreFieldType.Boolean:\r\n                        field.DefaultValue = DefaultValue.Boolean(false);\r\n                        break;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                field.DefaultValue = null;\r\n            }\r\n\r\n            if (!btnValidationRulesFunctionMarkup.Value.IsNullOrEmpty())\r\n            {\r\n                field.ValidationFunctionMarkup =\r\n                    (from element in XElement.Parse(btnValidationRulesFunctionMarkup.Value).Elements()\r\n                     select element.ToString()).ToList();\r\n            }\r\n\r\n            Field_Save_UpdatePosition(field);\r\n\r\n            Field_Save_UpdateGroupByPriority(field);\r\n\r\n            Field_Save_UpdateTreeOrderingProfile(field);\r\n\r\n            Field_Save_UpdateDataUrl(field, CanAppearInDataRoute);\r\n\r\n            Field_Save_SearchProfile(field);\r\n        }\r\n\r\n        private bool Field_Save_UpdateName(DataFieldDescriptor field, DataInput nameInput)\r\n        {\r\n            string newName = nameInput.Text;\r\n            if (!FieldNameSyntaxValid(newName))\r\n            {\r\n                Baloon(nameInput, Texts.FieldNameSyntaxInvalid);\r\n                return false;\r\n            }\r\n\r\n            if (this.CurrentFields.Any(f => String.Equals(f.Name, newName, StringComparison.InvariantCultureIgnoreCase)\r\n                                              && f.Id != field.Id))\r\n            {\r\n                Baloon(nameInput.ClientID, Texts.CannotSave);\r\n                return false;\r\n            }\r\n\r\n            if (field.Name != newName)\r\n            {\r\n                _nameChanged = true;\r\n            }\r\n\r\n            if (field.Name == CurrentKeyFieldName)\r\n            {\r\n                CurrentKeyFieldName = newName;\r\n            }\r\n\r\n            field.Name = newName;\r\n            return true;\r\n        }\r\n\r\n\r\n        private void Field_Save_UpdatePosition(DataFieldDescriptor field)\r\n        {\r\n            var visibleFields = CurrentFields.Where(f => f.Name != CurrentKeyFieldName).ToList();\r\n            int idFieldsCount = CurrentFields.Count(f => f.Name == CurrentKeyFieldName);\r\n\r\n            int newPosition = int.Parse(this.PositionField.SelectedValue);\r\n            if (newPosition == -1) newPosition = visibleFields.Count - 1;\r\n\r\n            if (field.Position != newPosition)\r\n            {\r\n                this.CurrentFields.Remove(field);\r\n\r\n                foreach (DataFieldDescriptor laterField in visibleFields.Where(f => f.Position > field.Position))\r\n                {\r\n                    laterField.Position--;\r\n                }\r\n\r\n                foreach (DataFieldDescriptor laterField in visibleFields.Where(f => f.Position >= newPosition))\r\n                {\r\n                    laterField.Position++;\r\n                }\r\n\r\n                field.Position = newPosition;\r\n                this.CurrentFields.Insert(newPosition + idFieldsCount, field);\r\n            }\r\n        }\r\n\r\n\r\n        private void Field_Save_UpdateGroupByPriority(DataFieldDescriptor field)\r\n        {\r\n            int newGroupByPriority = int.Parse(this.GroupByPriorityField.SelectedValue);\r\n\r\n            if (field.GroupByPriority != newGroupByPriority)\r\n            {\r\n                int assignGroupByPriority = 1;\r\n                foreach (DataFieldDescriptor otherField in this.CurrentFields.Where(f => f.GroupByPriority > 0 && f.Id != field.Id).OrderBy(f => f.GroupByPriority))\r\n                {\r\n                    if (assignGroupByPriority == newGroupByPriority) assignGroupByPriority++;\r\n                    otherField.GroupByPriority = assignGroupByPriority;\r\n                    assignGroupByPriority++;\r\n                }\r\n            }\r\n            field.GroupByPriority = newGroupByPriority;\r\n            EnsureGroupByPrioritySequence();\r\n        }\r\n\r\n\r\n        private void Field_Save_UpdateTreeOrderingProfile(DataFieldDescriptor field)\r\n        {\r\n            if (field.TreeOrderingProfile.ToString() != this.TreeOrderingField.SelectedValue)\r\n            {\r\n                field.TreeOrderingProfile = DataFieldTreeOrderingProfile.FromString(this.TreeOrderingField.SelectedValue);\r\n                int assignTreeOrderPriority = 1;\r\n                foreach (DataFieldDescriptor otherField in this.CurrentFields.Where(f => f.TreeOrderingProfile.OrderPriority > 0 && f.Id != field.Id).OrderBy(f => f.TreeOrderingProfile.OrderPriority))\r\n                {\r\n                    if (assignTreeOrderPriority == field.TreeOrderingProfile.OrderPriority) assignTreeOrderPriority++;\r\n                    otherField.TreeOrderingProfile.OrderPriority = assignTreeOrderPriority;\r\n                    assignTreeOrderPriority++;\r\n                }\r\n            }\r\n            EnsureTreeOrderPrioritySequence();\r\n        }\r\n\r\n        private void Field_Save_UpdateDataUrl(DataFieldDescriptor field, bool dataUrlApplicable)\r\n        {\r\n            bool enabled = chkShowInDataUrl.Checked;\r\n            if (!dataUrlApplicable || !enabled)\r\n            {\r\n                field.DataUrlProfile = null;\r\n                return;\r\n            }\r\n\r\n            int order = lstDataUrlOrder.SelectedIndex;\r\n\r\n            DataUrlSegmentFormat? format = null;\r\n\r\n            if (field.InstanceType == typeof (DateTime))\r\n            {\r\n                string selectedValue = lstDataUrlDateFormat.SelectedValue;\r\n                if (!string.IsNullOrEmpty(selectedValue))\r\n                {\r\n                    format = (DataUrlSegmentFormat)Enum.Parse(typeof(DataUrlSegmentFormat), selectedValue);\r\n                }\r\n            }\r\n\r\n            field.DataUrlProfile = new DataUrlProfile { Order = order, Format = format };\r\n\r\n            // Updating order of theother fields\r\n            var otherUrlSegments = CurrentFields\r\n                .Where(f => f.DataUrlProfile != null && f.Id != field.Id)\r\n                .OrderBy(f => f.DataUrlProfile.Order)\r\n                .ToList();\r\n\r\n            int index = 0;\r\n\r\n            foreach (var urlSegment in otherUrlSegments)\r\n            {\r\n                if (index == order) index++;\r\n\r\n                urlSegment.DataUrlProfile.Order = index++;\r\n            }\r\n        }\r\n\r\n\r\n        private void Field_Save_SearchProfile(DataFieldDescriptor field)\r\n        {\r\n            bool indexText = chkIndexText.Checked;\r\n            bool searchPreview = chkSearchPreview.Checked;\r\n            bool facet = chkFacetField.Checked;\r\n\r\n            SearchProfile profile = null;\r\n            if (indexText || searchPreview || facet)\r\n            {\r\n                profile = new SearchProfile\r\n                {\r\n                    IndexText = indexText,\r\n                    EnablePreview = searchPreview,\r\n                    IsFacet = facet\r\n                };\r\n            }\r\n\r\n            field.SearchProfile = profile;\r\n        }\r\n\r\n\r\n        private void EnsureGroupByPrioritySequence()\r\n        {\r\n            int assignGroupByPriority = 1;\r\n            foreach (DataFieldDescriptor field in this.CurrentFields.Where(f => f.GroupByPriority > 0).OrderBy(f => f.GroupByPriority))\r\n            {\r\n                field.GroupByPriority = assignGroupByPriority;\r\n                assignGroupByPriority++;\r\n            }\r\n        }\r\n\r\n\r\n        private void EnsureTreeOrderPrioritySequence()\r\n        {\r\n            int assignTreeOrderPriority = 1;\r\n            foreach (DataFieldDescriptor field in this.CurrentFields.Where(f => f.TreeOrderingProfile.OrderPriority > 0).OrderBy(f => f.TreeOrderingProfile.OrderPriority))\r\n            {\r\n                field.TreeOrderingProfile.OrderPriority = assignTreeOrderPriority;\r\n                assignTreeOrderPriority++;\r\n            }\r\n        }\r\n\r\n\r\n        protected void DeleteButton_Click(object sender, EventArgs e)\r\n        {\r\n            if (this.CurrentlySelectedFieldId == Guid.Empty)\r\n            {\r\n                return;\r\n            }\r\n\r\n            List<Guid> fieldIds = CurrentFields.Select(field => field.Id).ToList();\r\n            int fieldIndex = fieldIds.IndexOf(this.CurrentlySelectedFieldId);\r\n\r\n            Field_Delete(this.CurrentlySelectedFieldId);\r\n            MakeClientDirty();\r\n\r\n            if(fieldIndex < fieldIds.Count - 1 /* Not the last element */)\r\n            {\r\n                Field_Select(fieldIds[fieldIndex + 1]); // Selecting the next element)\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private void MakeClientDirty()\r\n        {\r\n            MakeDirtyEventPlaceHolder.Visible = true;\r\n        }\r\n\r\n        private bool FieldNameSyntaxValid(string name)\r\n        {\r\n            return !string.IsNullOrWhiteSpace(name);\r\n        }\r\n\r\n\r\n        protected void NameFieldChanged(object sender, EventArgs e)\r\n        {\r\n            bool refreshTree = false;\r\n            if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                string existingName = this.CurrentFields.Single(f => f.Id == this.CurrentlySelectedFieldId).Name;\r\n\r\n                refreshTree = (existingName != this.NameField.Text);\r\n            }\r\n\r\n            FieldSettingsChanged(sender, e);\r\n\r\n            if (refreshTree)\r\n            {\r\n                UpdateFieldsPanel();\r\n            }\r\n        }\r\n\r\n\r\n        // one of the \"post backing\" fields has been changed on the client\r\n        protected void FieldSettingsChanged(object sender, EventArgs e)\r\n        {\r\n            if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                if (ValidateSave())\r\n                {\r\n                    Field_Save();\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n\r\n        // Saving data to the form dictionary...\r\n        protected override void BindStateToProperties()\r\n        {\r\n            if (this.CurrentlySelectedFieldId != Guid.Empty)\r\n            {\r\n                if (ValidateSave())\r\n                {\r\n                    Field_Save();\r\n                }\r\n            }\r\n\r\n            foreach (var field in this.CurrentFields)\r\n            {\r\n                if (string.IsNullOrEmpty(field.FormRenderingProfile.Label))\r\n                {\r\n                    field.FormRenderingProfile.Label = field.Name;\r\n                }\r\n            }\r\n\r\n            this.Fields = this.CurrentFields;\r\n            this.KeyFieldName = this.CurrentKeyFieldName;\r\n            this.LabelFieldName = this.CurrentLabelFieldName;\r\n        }\r\n\r\n\r\n\r\n        // First time we run - we are attached to a parent System.Web.Control \r\n        protected override void InitializeViewState()\r\n        {\r\n            var fields = new List<DataFieldDescriptor>();\r\n            if (this.Fields != null) fields.AddRange(this.Fields);\r\n\r\n            // ensure positioning is in place\r\n            int position = 0;\r\n            foreach (DataFieldDescriptor field in fields.Where(f => f.Name != KeyFieldName).OrderBy(f => f.Position))\r\n            {\r\n                field.Position = position++;\r\n            }\r\n\r\n            CurrentFields = fields;\r\n            CurrentKeyFieldName = KeyFieldName;\r\n            CurrentLabelFieldName = LabelFieldName;\r\n\r\n            UpdateFieldsPanel();\r\n        }\r\n\r\n\r\n        public override string GetDataFieldClientName()\r\n        {\r\n            return null;\r\n        }\r\n\r\n        protected string GetTreeIcon(DataFieldDescriptor dataItem)\r\n        {\r\n            return \"${icon:\" + (dataItem.Name == CurrentKeyFieldName ? \"key\" : \"parameter\") + \"}\";\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/TypeFieldDesigner.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace CompositeTypeFieldDesigner {\r\n    \r\n    \r\n    public partial class TypeFieldDesigner {\r\n        \r\n        /// <summary>\r\n        /// BaloonPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder BaloonPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// MakeDirtyEventPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder MakeDirtyEventPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// EnterCreateModeButton control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.ToolbarButton EnterCreateModeButton;\r\n        \r\n        /// <summary>\r\n        /// DeleteButton control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.ToolbarButton DeleteButton;\r\n        \r\n        /// <summary>\r\n        /// FieldListRepeater control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.Repeater FieldListRepeater;\r\n        \r\n        /// <summary>\r\n        /// DetailsSplitPanelPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder DetailsSplitPanelPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// NameField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput NameField;\r\n        \r\n        /// <summary>\r\n        /// LabelField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput LabelField;\r\n        \r\n        /// <summary>\r\n        /// HelpField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput HelpField;\r\n        \r\n        /// <summary>\r\n        /// PositionField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector PositionField;\r\n        \r\n        /// <summary>\r\n        /// TypeSelector control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector TypeSelector;\r\n\r\n        /// <summary>\r\n        /// TypeDetailsPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder TypeDetailsPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// TypeDetailsLabel control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.Label TypeDetailsLabel;\r\n        \r\n        /// <summary>\r\n        /// TypeDetailsSelector control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector TypeDetailsSelector;\r\n        \r\n        /// <summary>\r\n        /// TypeDetailsOptionalPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder TypeDetailsOptionalPlaceHolder;\r\n        \r\n        /// <summary>\r\n        /// OptionalSelector control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector OptionalSelector;\r\n        \r\n        /// <summary>\r\n        /// btnWidgetFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.PostBackDialog btnWidgetFunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// btnValidationRulesFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.PostBackDialog btnValidationRulesFunctionMarkup;\r\n        \r\n        /// <summary>\r\n        /// IsTitleFieldDateTimeSelector control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.CheckBox IsTitleFieldDateTimeSelector;\r\n        \r\n        /// <summary>\r\n        /// GroupByPriorityField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector GroupByPriorityField;\r\n\r\n        /// <summary>\r\n        /// GroupByPriorityField control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector TreeOrderingField;\r\n        \r\n        /// <summary>\r\n        /// btnDefaultValueFunctionMarkup control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.PostBackDialog btnDefaultValueFunctionMarkup;\r\n\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector lstKeyType;\r\n\r\n        protected global::Composite.Core.WebClient.UiControlLib.DataInput txtKeyFieldName;\r\n\r\n        protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkShowInDataUrl;\r\n\r\n        protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkIndexText;\r\n\r\n        protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkSearchPreview;\r\n\r\n        protected global::Composite.Core.WebClient.UiControlLib.CheckBox chkFacetField;\r\n\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhKeyFieldProperties;\r\n\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhFieldProperties;\r\n\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhDataUrl;\r\n\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhSearch;\r\n\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhSearch_IndexText;\r\n\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhSearch_FieldPreview;\r\n\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhSearch_FacetedSearch;\r\n\r\n        protected global::System.Web.UI.WebControls.PlaceHolder plhAdvancedFieldProperties;\r\n\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector lstDataUrlOrder;\r\n\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector lstDataUrlDateFormat;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/TypeFieldDesigner.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|splitpanel#typefielddesignerleft {\r\n\tborder-right: 1px solid $(color:threedshadow);\r\n}\r\nui|splitpanel#typefielddesignerright {\r\n\tborder-left: 1px solid $(color:threedhighlight);\t\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/DeveloperTools/XsltEditor.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.XhtmlEditorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script type=\"C#\" runat=\"server\">\r\n\r\n\tprivate string _currentStringValue = null;\r\n\r\n    protected override void BindStateToProperties()\r\n    {\r\n        _currentStringValue = Request.Form[this.UniqueID];\r\n        this.Xhtml = HttpContext.Current.Server.UrlDecode(_currentStringValue);\r\n    }\r\n    protected override void InitializeViewState()\r\n    {\r\n       _currentStringValue = HttpContext.Current.Server.UrlEncode ( this.Xhtml ).Replace(\"+\", \"%20\");;\r\n    }\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.UniqueID;\r\n    }\r\n</script>\r\n\r\n<!-- This should be deprecated for the more generalized \"SorceEditor\"! -->\r\n\r\n<ui:sourceeditor syntax=\"xsl\" \r\n\tvalue=\"<%= _currentStringValue %>\"\r\n\tid=\"<%= this.UniqueID %>\"\r\n\tname=\"<%= this.UniqueID %>\"\r\n\tcallbackid=\"<%= this.UniqueID %>\"/>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/EnumSelectors/EnumSelector.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.EnumSelectorTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script runat=\"server\">    \r\n    protected override void BindStateToProperties()\r\n    {\r\n        this.Selected = optionsRepeater.SelectedValue;\r\n    }\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n        optionsRepeater.DataSource = this.Options;\r\n        optionsRepeater.SelectedValue = this.Selected;\r\n        optionsRepeater.DataBind();\r\n    }\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.optionsRepeater.UniqueID;\r\n    }\r\n    \r\n</script>\r\n\r\n    <aspui:Selector runat=\"server\" ID=\"optionsRepeater\" AutoPostBack=\"false\" Visible=\"true\">\r\n    </aspui:Selector>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/FileUploaders/FileUpload.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.FileUploadTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n    protected override void BindStateToProperties()\r\n    {\r\n        this.UploadedFile.HasFile = fileUpload.HasFile;\r\n        \r\n        if (fileUpload.HasFile == true)\r\n        {\r\n            this.UploadedFile.ContentLength = fileUpload.PostedFile.ContentLength;\r\n            this.UploadedFile.ContentType = fileUpload.PostedFile.ContentType;\r\n            this.UploadedFile.FileName = System.IO.Path.GetFileName(fileUpload.PostedFile.FileName);\r\n            this.UploadedFile.FileStream = fileUpload.PostedFile.InputStream;\r\n        }\r\n    }\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n    }\r\n\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return null;\r\n    }\r\n</script>\r\n<ui:filepicker required=\"true\">\r\n\t<ui:datainput class=\"fake\" isdisabled=\"true\" spellcheck=\"false\" />\r\n\t<ui:clickbutton image=\"${icon:popup}\" width=\"30\"/>\r\n    <asp:FileUpload runat=\"server\" ID=\"fileUpload\" CssClass=\"real\" onkeydown=\"return false;\"/>\r\n</ui:filepicker>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/RichContent/InlineXhtmlEditor.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.XhtmlEditorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Import Namespace=\"System.Xml.Linq\" %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient.Services.WysiwygEditor\" %>\r\n<%@ Import Namespace=\"Composite.Core.Types\" %>\r\n\r\n<script type=\"C#\" runat=\"server\">\r\n\r\n\tprivate string _currentStringValue = null;\r\n\r\n\tprotected void Page_Init(object sender, EventArgs e)\r\n    {\r\n        if (_currentStringValue == null)\r\n        {\r\n            _currentStringValue = Request.Form[this.UniqueID];\r\n        }\r\n    }\r\n\r\n    protected override void BindStateToProperties()\r\n    {\r\n        _currentStringValue = Request.Form[this.UniqueID];\r\n        this.Xhtml = HttpContext.Current.Server.UrlDecode(_currentStringValue).Replace(\"&nbsp;\", \"&#160;\");\r\n    }\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n\t\tif (string.IsNullOrEmpty(this.Xhtml) == false)\r\n        {\r\n            _currentStringValue = this.Xhtml;\r\n        }\r\n        else\r\n        {\r\n            _currentStringValue = \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\\t<head></head>\\n\\t<body></body>\\n</html>\";\r\n        }\r\n\t\t_currentStringValue = HttpContext.Current.Server.UrlEncode(_currentStringValue).Replace(\"+\", \"%20\");\r\n    }\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.UniqueID;\r\n    }\r\n\r\n    private string EmbedableFieldsTypesString\r\n    {\r\n        get\r\n        {\r\n            if (this.EmbedableFieldsTypes == null)\r\n            {\r\n                return \"\";\r\n            }\r\n            else\r\n            {\r\n                var serializedNames =\r\n                    from t in this.EmbedableFieldsTypes\r\n                    select TypeManager.SerializeType(t);\r\n\r\n                return string.Join(\"|\", serializedNames.ToArray());\r\n            }\r\n        }\r\n    }\r\n</script>\r\n\r\n<ui:htmldatadialog\r\n\tlabel=\"<%= HttpUtility.HtmlAttributeEncode(String.Format( Composite.Core.ResourceSystem.StringResourceSystemFacade.GetString(\"Composite.Web.VisualEditor\",\"LaunchButton.Label\"), FormControlLabel)) %>\" \r\n\tvalue=\"<%= _currentStringValue %>\" \r\n\tformattingconfiguration=\"<%= this.ClassConfigurationName %>\"\r\n    containerclasses=\"<%= this.ContainerClasses %>\"\r\n    embedablefieldstypenames=\"<%= HttpUtility.HtmlAttributeEncode(this.EmbedableFieldsTypesString) %>\"\r\n\tname=\"<%= this.UniqueID %>\"\r\n\tcallbackid=\"<%= this.UniqueID %>\"\r\n    previewpageid=\"<%= PreviewPageId %>\"\r\n    previewtemplateid=\"<%= PreviewTemplateId %>\"\r\n    previewplaceholder=\"<%= PreviewPlaceholder %>\"\r\n    image=\"${icon:edit}\"\r\n    />"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/RichContent/MultiContentXhtmlEditor.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"CompositeMultiContentXhtmlEditor.MultiContentXhtmlEditor\" CodeFile=\"MultiContentXhtmlEditor.ascx.cs\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Import Namespace=\"System.Xml.Linq\" %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient.Services.WysiwygEditor\" %>\r\n<%@ Import Namespace=\"Composite.Core.Types\" %>\r\n\r\n<script runat=\"server\">\r\n    private string EmbedableFieldsTypesString\r\n    {\r\n        get\r\n        {\r\n            if (this.EmbedableFieldsTypes == null)\r\n            {\r\n                return \"\";\r\n            }\r\n            else\r\n            {\r\n                var serializedNames =\r\n                    from t in this.EmbedableFieldsTypes\r\n                    select TypeManager.SerializeType(t);\r\n\r\n                return string.Join(\"|\", serializedNames.ToArray());\r\n            }\r\n        }\r\n    }\r\n</script>\r\n\r\n<ui:visualmultieditor \r\n\tformattingconfiguration=\"common\"\r\n\tembedablefieldstypenames=\"<%= HttpUtility.HtmlAttributeEncode(this.EmbedableFieldsTypesString) %>\"\r\n\tid=\"<%= this.UniqueID %>\">\r\n    <!-- THIS CAN NOW BE REMOVED (INCLUDING CODEBEHIND SUPPORT!) -->\r\n   \t<aspui:Selector SimpleSelectorMode=\"false\" ID=\"TemplateSelector\" runat=\"server\">\r\n   \t    <asp:ListItem>default</asp:ListItem>\r\n   \t</aspui:Selector> \r\n\t<div>\r\n\t    <asp:PlaceHolder ID=\"ContentsPlaceHolder\" runat=\"server\"/>\r\n    </div>\r\n</ui:visualmultieditor>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/RichContent/MultiContentXhtmlEditor.ascx.cs",
    "content": "﻿using System;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Security;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Web.UI.WebControls;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Logging;\r\nusing Composite.Plugins.Forms.WebChannel.UiControlFactories;\r\n\r\nnamespace CompositeMultiContentXhtmlEditor\r\n{\r\n    public partial class MultiContentXhtmlEditor : MultiContentXhtmlEditorTemplateUserControlBase\r\n    {\r\n        protected void Page_Load(object sender, EventArgs e)\r\n        {\r\n            if (this.ContentsPlaceHolder.Controls.Count == 0)\r\n            {\r\n                SetUpTextAreas(false);\r\n            }\r\n        }\r\n\r\n        protected override void BindStateToProperties()\r\n        {\r\n            Dictionary<string, string> newNamedXhtmlFragments = new Dictionary<string, string>();\r\n            foreach (Control c in this.ContentsPlaceHolder.Controls)\r\n            {\r\n                if (IsRealContent(((TextBox)c).Text))\r\n                {\r\n                    newNamedXhtmlFragments.Add(c.ID, ((TextBox)c).Text.Replace(\"&nbsp;\", \"&#160;\"));\r\n                }\r\n            }\r\n\r\n            this.NamedXhtmlFragments = newNamedXhtmlFragments;\r\n        }\r\n\r\n\r\n        protected override void InitializeViewState()\r\n        {\r\n            SetUpTextAreas(true);\r\n        }\r\n\r\n        public override string GetDataFieldClientName()\r\n        {\r\n            return null;\r\n        }\r\n\r\n\r\n        private void SetUpTextAreas(bool flush)\r\n        {\r\n            List<string> handledIds = new List<string>();\r\n\r\n            ContentsPlaceHolder.Controls.Clear();\r\n\t\t\t\r\n\t\t\tbool isFirst = true;\r\n\t\t\t\r\n            foreach (string placeHolderId in this.PlaceholderDefinitions.Keys)\r\n            {\r\n                if (handledIds.Contains(placeHolderId) == false)\r\n                {\r\n                    string containerClasses = this.PlaceholderContainerClasses.ContainsKey(placeHolderId) ? this.PlaceholderContainerClasses[placeHolderId] : \"\";\r\n                    TextBox contentTextBox = new Composite.Core.WebClient.UiControlLib.TextBox();\r\n                    contentTextBox.TextMode = TextBoxMode.MultiLine;\r\n                    contentTextBox.ID = placeHolderId;\r\n                    contentTextBox.Attributes.Add(\"placeholderid\", placeHolderId);\r\n                    contentTextBox.Attributes.Add(\"placeholdername\", this.PlaceholderDefinitions[placeHolderId]);\r\n                    contentTextBox.Attributes.Add(\"containerclasses\", containerClasses);\r\n\r\n                    if ( isFirst )\r\n                    {\r\n                        contentTextBox.Attributes.Add(\"selected\", \"true\");\r\n                        isFirst = false;\r\n                    }\r\n                    if (flush == true)\r\n                    {\r\n                        if (this.NamedXhtmlFragments.ContainsKey(placeHolderId))\r\n                        {\r\n                            contentTextBox.Text = this.NamedXhtmlFragments[placeHolderId];\r\n                        }\r\n                        else\r\n                        {\r\n                            contentTextBox.Text = \"\";\r\n                        }\r\n                    }\r\n                    ContentsPlaceHolder.Controls.Add(contentTextBox);\r\n                    handledIds.Add(placeHolderId);\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        private bool IsRealContent(string content)\r\n        {\r\n            if (content.Length > 50) return true;\r\n            string testContent = content.Replace(\"<p>\", \"\");\r\n            testContent = testContent.Replace(\"</p>\", \"\");\r\n            testContent = testContent.Replace(\"&nbsp;\", \"\");\r\n            testContent = testContent.Replace(\"&#160;\", \"\");\r\n            testContent = testContent.Replace(\" \", \"\");\r\n            testContent = testContent.Replace(\"<br/>\", \"\");\r\n\r\n            if (string.IsNullOrEmpty(testContent) == true)\r\n            {\r\n                return false;\r\n            }\r\n            else\r\n            {\r\n                return true;\r\n            }\r\n\r\n        }\r\n\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/RichContent/MultiContentXhtmlEditor.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace CompositeMultiContentXhtmlEditor {\r\n    \r\n    \r\n    public partial class MultiContentXhtmlEditor {\r\n        \r\n        /// <summary>\r\n        /// TemplateSelector control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::Composite.Core.WebClient.UiControlLib.Selector TemplateSelector;\r\n        \r\n        /// <summary>\r\n        /// ContentsPlaceHolder control.\r\n        /// </summary>\r\n        /// <remarks>\r\n        /// Auto-generated field.\r\n        /// To modify move field declaration from designer file to code-behind file.\r\n        /// </remarks>\r\n        protected global::System.Web.UI.WebControls.PlaceHolder ContentsPlaceHolder;\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/RichContent/XhtmlEditor.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.XhtmlEditorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Import Namespace=\"System.Xml.Linq\" %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient.Services.WysiwygEditor\" %>\r\n<%@ Import Namespace=\"Composite.Core.Types\" %>\r\n\r\n<script language=\"C#\" runat=\"server\">\r\n\r\n\tprivate string _currentStringValue = null;\r\n\r\n    protected override void BindStateToProperties()\r\n    {\r\n        _currentStringValue = Request.Form[this.UniqueID];\r\n        this.Xhtml = HttpContext.Current.Server.UrlDecode(_currentStringValue).Replace(\"&nbsp;\", \"&#160;\");\r\n    }\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n    \tif (string.IsNullOrEmpty(this.Xhtml) == false)\r\n        {\r\n            _currentStringValue = this.Xhtml;\r\n        }\r\n        else\r\n        {\r\n            _currentStringValue = \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\\t<head></head>\\n\\t<body>\\n\\t</body>\\n</html>\";\r\n        }\r\n\t\t_currentStringValue = HttpContext.Current.Server.UrlEncode(_currentStringValue).Replace(\"+\", \"%20\");\r\n    }\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n         return this.UniqueID;\r\n    }\r\n\r\n    private string EmbedableFieldsTypesString\r\n    {\r\n        get\r\n        {\r\n            if (this.EmbedableFieldsTypes == null)\r\n            {\r\n                return \"\";\r\n            }\r\n            else\r\n            {\r\n                var serializedNames =\r\n                    from t in this.EmbedableFieldsTypes\r\n                    select TypeManager.SerializeType(t);\r\n\r\n                return string.Join(\"|\", serializedNames.ToArray());\r\n            }\r\n        }\r\n    }\r\n    \r\n</script>\r\n\r\n<ui:visualeditor \r\n\tformattingconfiguration=\"<%= this.ClassConfigurationName %>\"\r\n    containerclasses=\"<%=this.ContainerClasses %>\"\r\n    embedablefieldstypenames=\"<%= HttpUtility.HtmlAttributeEncode(this.EmbedableFieldsTypesString) %>\"\r\n\tvalue=\"<%= _currentStringValue %>\"\r\n\tid=\"<%= this.UniqueID %>\"\r\n\tname=\"<%= this.UniqueID %>\"\r\n\tcallbackid=\"<%= this.UniqueID %>\"/>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/ComboBox.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.SelectorTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n<%@ Import Namespace=\"System.Security.Policy\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient.UiControlLib.Foundation\" %>\r\n\r\n<script runat=\"server\">\r\n\r\n    public override void BindStateToProperties()\r\n    {\r\n        this.SelectedKeys = new List<string> { clientSelector.SelectedValue };\r\n    }\r\n\r\n\r\n    protected override void OnLoad(EventArgs e)\r\n    {\r\n        this.CopyClientAttributesTo(clientSelector);\r\n\r\n        base.OnLoad(e);\r\n\r\n        if (this.SelectedIndexChangedEventHandler != null)\r\n        {\r\n            clientSelector.SelectedIndexChanged += this.SelectedIndexChangedEventHandler;\r\n            clientSelector.AutoPostBack = true;\r\n        }\r\n    }\r\n\r\n\r\n    public override void InitializeViewState()\r\n    {\r\n        List<KeyLabelPair> options = this.GetOptions();\r\n\r\n        clientSelector.DataSource = options;\r\n        clientSelector.DataTextField = \"Label\";\r\n        clientSelector.DataValueField = \"Key\";\r\n        clientSelector.DataBind();\r\n\r\n        string key = this.SelectedKeys.FirstOrDefault();\r\n        if (key != null)\r\n        {\r\n            clientSelector.SelectedValue = key;\r\n        }\r\n\r\n        clientSelector.SelectionRequired = this.Required;\r\n    }\r\n\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return clientSelector.UniqueID;\r\n    }\r\n</script>\r\n\r\n<aspui:ComboBox ID=\"clientSelector\" runat=\"server\" />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/DataReferenceSelector.ascx",
    "content": "﻿<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.DataReferenceSelectorTemplateUserControlBase\"  %>\r\n<%@ Register TagPrefix=\"ui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n<%@ Import Namespace=\"Composite.Core.Extensions\" %>\r\n<%@ Import Namespace=\"Composite.Data\" %>\r\n<%@ Import Namespace=\"Composite.Data.Types\" %>\r\n\r\n<script runat=\"server\">\r\n    protected override void BindStateToProperties()\r\n    {\r\n        Type dataReferenceType = typeof(DataReference<>).MakeGenericType(new [] {this.DataType});\r\n\r\n        object[] activationParameters = { DataReferenceSelector.SelectedValue };\r\n        \r\n        var dataReference = (IDataReference) Activator.CreateInstance(dataReferenceType, activationParameters);\r\n\r\n        this.Selected = dataReference;\r\n    }\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n        // This widget is currently 'code bound' to IMediaFileFolder. Rename or - even better - put this out of it's misery.\r\n        if (this.DataType == typeof(IMediaFileFolder))\r\n        {\r\n            DataReferenceSelector.DataSource = DataFacade.GetData<IMediaFileFolder>().OrderBy(f => f.Path).ToDataList();\r\n        }\r\n        else\r\n        {\r\n            throw new NotSupportedException(\"Type '{0}' not supported by this widget\".FormatWith(DataType.FullName));\r\n        }\r\n\r\n        DataReferenceSelector.DataTextField = \"Path\";\r\n        DataReferenceSelector.DataValueField = \"KeyPath\";\r\n        DataReferenceSelector.DataBind();\r\n\r\n        if (this.Selected != null && this.Selected.IsSet)\r\n        {\r\n            ListItem selectedItem = DataReferenceSelector.Items.FindByValue(this.Selected.KeyValue.ToString());\r\n            if (selectedItem != null) selectedItem.Selected = true;\r\n        }\r\n    }\r\n    \r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.DataReferenceSelector.UniqueID;\r\n    }\r\n    \r\n</script>\r\n\r\n<ui:Selector ID=\"DataReferenceSelector\" runat=\"server\" />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/DataReferenceTreeSelector.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.DataReferenceTreeSelectorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.Core.Routing\" %>\r\n<%@ Import Namespace=\"Composite.Data\" %>\r\n<%@ Import Namespace=\"Composite.Data.Types\" %>\r\n<%@ Import Namespace=\"Composite.Core.Extensions\" %>\r\n<%@ Import Namespace=\"Composite.Core.ResourceSystem\" %>\r\n\r\n<script runat=\"server\">\r\n    private bool _loaded;\r\n    private string _value;\r\n\r\n    protected override void BindStateToProperties()\r\n    {\r\n        LoadPostData();\r\n\r\n        Selected = _value == string.Empty ? null : _value;\r\n    }\r\n\r\n    private void LoadPostData()\r\n    {\r\n        if(IsPostBack && !_loaded)\r\n        {\r\n            _value = ctlSelectorDialog.Value;\r\n            MediaUrlData mediaUrlData;\r\n\r\n            if(!_value.IsNullOrEmpty()\r\n                && IsMediaReference()\r\n                && TryExtractMedia(_value, out mediaUrlData))\r\n            {\r\n                Guid mediaId = mediaUrlData.MediaId;\r\n                string storeId = mediaUrlData.MediaStore;\r\n\r\n                IMediaFile media = DataFacade.GetData<IMediaFile>(file => file.Id == mediaId && file.StoreId == storeId).FirstOrDefault();\r\n                if (media != null)\r\n                {\r\n                    _value = new DataReference<IMediaFile>(media).ToString();\r\n                }\r\n            }\r\n\r\n\r\n            _loaded = true;\r\n        }\r\n    }\r\n\r\n    static bool TryExtractMedia(string value, out MediaUrlData mediaUrlData)\r\n    {\r\n        mediaUrlData = MediaUrls.ParseUrl(value);\r\n\r\n        return mediaUrlData != null;\r\n    }\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n        _value = Selected;\r\n        _loaded = true;\r\n    }\r\n\r\n    private IDataReference BuildReference(string serializedValue)\r\n    {\r\n        Type dataReferenceType = DataType == typeof(IPage) ? typeof(PageDataReference)\r\n            : typeof(DataReference<>).MakeGenericType(new[] { this.DataType });\r\n        object[] activationParameters = new object[1];\r\n        activationParameters[0] = serializedValue;\r\n        return (IDataReference)Activator.CreateInstance(dataReferenceType, activationParameters);\r\n    }\r\n\r\n    protected override void  OnPreRender(EventArgs e)\r\n    {\r\n        base.OnPreRender(e);\r\n\r\n        ctlSelectorDialog.Nullable = this.NullValueAllowed;\r\n        if(NullValueAllowed)\r\n        {\r\n            ctlSelectorDialog.Attributes.Remove(\"binding\");\r\n        }\r\n\r\n        LoadPostData();  // Persistance\r\n\r\n        ctlSelectorDialog.Attributes[\"handle\"] = this.Handle;\r\n        ctlSelectorDialog.Attributes[\"providersearch\"] = this.SearchToken;\r\n\r\n        string label = null;\r\n        bool brokenReference = false;\r\n\r\n        bool valueSet = false;\r\n\r\n        if (!_value.IsNullOrEmpty())\r\n        {\r\n            IDataReference reference = BuildReference(_value);\r\n\r\n            valueSet = reference != null && reference.IsSet;\r\n\r\n            if (valueSet)\r\n            {\r\n                try\r\n                {\r\n                    label = reference.Data.GetLabel(true);\r\n                    ctlSelectorDialog.Attributes[\"selectedtoken\"] = Composite.C1Console.Security.EntityTokenSerializer.Serialize(reference.Data.GetDataEntityToken(), true);\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    brokenReference = true;\r\n                    label = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AspNetUiControl.Selector.BrokenReference\");\r\n                }\r\n            }\r\n        }\r\n\r\n        if (!this.NullValueAllowed && !valueSet)\r\n        {\r\n            ctlSelectorDialog.Attributes[\"required\"] = \"true\";\r\n        }\r\n\r\n        if (label == null)\r\n        {\r\n            ctlSelectorDialog.Attributes[\"label\"] = StringResourceSystemFacade.GetString(\"Composite.Management\", \"AspNetUiControl.Selector.NoSelection\");\r\n            ctlSelectorDialog.Attributes[\"tooltip\"] = \"\";\r\n            return;\r\n        }\r\n\r\n        if (!brokenReference && IsMediaReference())\r\n        {\r\n            int fileNameIndex = label.LastIndexOf('/');\r\n            if(fileNameIndex > 0 && label.Length > fileNameIndex + 1)\r\n            {\r\n                label = label.Substring(fileNameIndex + 1);\r\n            }\r\n        }\r\n\r\n        ctlSelectorDialog.Attributes[\"label\"] = label;\r\n        ctlSelectorDialog.Value = _value ?? string.Empty;\r\n    }\r\n\r\n    private bool IsMediaReference()\r\n    {\r\n        return DataType == typeof (IImageFile) || DataType == typeof (IMediaFile);\r\n    }\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return ctlSelectorDialog.UniqueID;\r\n    }\r\n\r\n    /// <summary>\r\n    /// Represents a reference to a C1 CMS IPage item.\r\n    /// </summary>\r\n    [DataReferenceConverter]\r\n    public class PageDataReference : IDataReference\r\n    {\r\n        private IPage _cachedValue;\r\n        private readonly Guid _pageId;\r\n\r\n        /// <summary>\r\n        /// Constructs a DataReference using a key value.\r\n        /// </summary>\r\n        /// <param name=\"keyValue\">The key value, like the Guid for a page's Id.</param>\r\n        public PageDataReference(string keyValue)\r\n        {\r\n            if(Guid.TryParse(keyValue, out Guid pageId))\r\n            {\r\n                _pageId = pageId;\r\n            }\r\n        }\r\n\r\n        public string Serialize()\r\n        {\r\n            if (_pageId == Guid.Empty) return \"\";\r\n\r\n            return _pageId.ToString();\r\n        }\r\n\r\n        public Type ReferencedType => typeof(IPage);\r\n\r\n\r\n\r\n        public bool IsSet => _pageId != Guid.Empty;\r\n\r\n        public object KeyValue => _pageId;\r\n\r\n        public IData Data\r\n        {\r\n            get\r\n            {\r\n                if (!IsSet)\r\n                {\r\n                    return default(IPage);\r\n                }\r\n\r\n                if (_cachedValue != null)\r\n                {\r\n                    return _cachedValue;\r\n                }\r\n\r\n                using (var connection = new DataConnection())\r\n                {\r\n                    return _cachedValue = connection.SitemapNavigator.GetPageNodeById(_pageId)?.Page;\r\n                }\r\n                \r\n            }\r\n        }\r\n    }\r\n\r\n</script>\r\n\r\n<aspui:PostBackDialog \r\n    runat=\"server\"\r\n    EnableViewState=\"false\"\r\n\tID=\"ctlSelectorDialog\"  \r\n\tvalue=\"\"\r\n    binding=\"ViewDefinitionPostBackDataDialogBinding\" />\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/DoubleKeySelector.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TemplatedDoubleKeySelectorUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n\r\n\r\n<script runat=\"server\">\r\n \r\n    protected override void BindStateToProperties()\r\n    {\r\n        var match = Options.FirstOrDefault(tuple => clientSelector.SelectedValue == GetKey(tuple));\r\n        \r\n        if(match != null)\r\n        {\r\n            FirstKey = match.Item1;\r\n            SecondKey = match.Item2;\r\n        }\r\n        else\r\n        {\r\n            FirstKey = SecondKey = null;\r\n        }\r\n    }\r\n\r\n\r\n    protected override void OnLoad(EventArgs e)\r\n    {\r\n        base.OnLoad(e);\r\n\r\n        /*if (this.SelectedIndexChangedEventHandler != null)\r\n        {\r\n            clientSelector.SelectedIndexChanged += this.SelectedIndexChangedEventHandler;\r\n            clientSelector.AutoPostBack = true;\r\n        }*/\r\n    }\r\n\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n        List<KeyLabelPair> options = this.GetOptions();\r\n\r\n        clientSelector.DataSource = options;\r\n        clientSelector.DataTextField = \"Label\";\r\n        clientSelector.DataValueField = \"Key\";\r\n        clientSelector.DataBind();\r\n\r\n        string key = GetKey(this.FirstKey, this.SecondKey);\r\n        \r\n        if (key != null && options.Any(f => f.Key == key))\r\n        {\r\n            clientSelector.SelectedValue = key;\r\n        }\r\n        else\r\n        {\r\n            clientSelector.SelectionRequired = this.Required;\r\n        }\r\n    }\r\n\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return clientSelector.UniqueID;\r\n    }\r\n</script>\r\n\r\n<aspui:Selector ID=\"clientSelector\" runat=\"server\" />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/FontIconSelector.ascx",
    "content": "﻿<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.FontIconSelectorTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<script runat=\"server\">\r\n\t\r\n\tprivate string _currentStringValue = null;\r\n\r\n\tprotected void Page_Init(object sender, EventArgs e)\r\n\t{\r\n\t\tif (_currentStringValue == null)\r\n\t\t{\r\n\t\t\t_currentStringValue = Request.Form[this.UniqueID]??string.Empty;\r\n\t\t}\r\n\t}\r\n\r\n\tprotected override void BindStateToProperties()\r\n\t{\r\n\t\tthis.SelectedClassName = _currentStringValue;\r\n\t}\r\n\r\n\tprotected override void InitializeViewState()\r\n\t{\r\n\t\t_currentStringValue = this.SelectedClassName;\r\n\t}\r\n\r\n\tpublic override string GetDataFieldClientName()\r\n\t{\r\n\t\treturn this.UniqueID;\r\n\t}\r\n\r\n</script>\r\n\r\n<ui:selector name=\"<%= this.UniqueID  %>\" local=\"true\" >\r\n\t<ui:selection selected=\"true\" label=\"&lt;NONE&gt;\" value=\"\" tooltip=\"&lt;NONE&gt;\" required=\"<%= this.Required.ToString().ToLower() %>\" />\r\n\t<% \r\n\t\tforeach (var icon in this.ClassNameOptions)\r\n\t\t{ %>\r\n\t\t\t<ui:selection image=\"${class:<%= this.ClassNamePrefix+HttpUtility.HtmlAttributeEncode(icon.Key) %>}\" label=\"<%=HttpUtility.HtmlAttributeEncode(icon.Value) %>\" value=\"<%=HttpUtility.HtmlAttributeEncode(icon.Key) %>\" <%=(icon.Key==_currentStringValue)?\"selected=\\\"true\\\"\":\"\" %>/>\r\n\t<%  } %>\r\n</ui:selector>\r\n\r\n<ui:stylesheet id=\"stylebinding\"  link=\"<%= Composite.Core.WebClient.UrlUtils.ResolvePublicUrl( this.StylesheetPath )  %>\" />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/HierarchicalSelector.ascx",
    "content": "﻿<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.HierarchicalSelectorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.C1Console.Forms.CoreUiControls\" %>\r\n<%@ Import Namespace=\"Composite.Core.Extensions\" %>\r\n<%@ Import Namespace=\"Composite.Core.Types\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script runat=\"server\">\r\n\tprotected override void InitializeViewState()\r\n\t{\r\n\r\n\t}\r\n\r\n\r\n\tprotected override void BindStateToProperties()\r\n\t{\r\n\t\tvar result = new List<object>();\r\n\r\n\t\tstring postedValue = Request.Form[this.ClientID];\r\n\t\tif (!string.IsNullOrEmpty(postedValue))\r\n\t\t{\r\n\t\t\tresult.AddRange(postedValue.Split(','));\r\n\t\t}\r\n\t\tthis.SelectedKeys = result;\r\n\r\n\r\n\t}\r\n\r\n\r\n\tpublic override string GetDataFieldClientName()\r\n\t{\r\n\t\treturn this.ClientID;\r\n\t}\r\n\r\n\tprivate string _treeXhml;\r\n\r\n\tprotected override void OnPreRender(EventArgs args)\r\n\t{\r\n\t\tvar sb = new StringBuilder();\r\n\r\n\t\tforeach (var node in TreeNodes)\r\n\t\t{\r\n\t\t\tRenderTree(sb, node);\r\n\t\t}\r\n\r\n\t\t_treeXhml = sb.ToString();\r\n\t}\r\n\r\n\tprivate void RenderTree(StringBuilder sb, SelectionTreeNode treeNode)\r\n\t{\r\n\t\tsb.Append(string.Format(\"<ui:selection label=\\\"{0}\\\"\", Server.HtmlEncode(treeNode.Label)));\r\n\t\tif (treeNode.Key != null)\r\n\t\t{\r\n\t\t\tsb.AppendFormat(\" value=\\\"{0}\\\"\", Server.HtmlEncode(ValueTypeConverter.Convert<string>(treeNode.Key)));\r\n\r\n\t\t\tif (SelectedKeys.Contains(treeNode.Key))\r\n\t\t\t{\r\n\t\t\t\tsb.AppendFormat(\" selected=\\\"true\\\"\");\r\n\t\t\t}\r\n\r\n\t\t\tif (treeNode.Selectable)\r\n\t\t\t{\r\n\t\t\t\tsb.AppendFormat(\" selectable=\\\"true\\\"\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!treeNode.Icon.IsNullOrEmpty())\r\n\t\t{\r\n\t\t\tsb.AppendFormat(\" image=\\\"{0}\\\"\", treeNode.Icon);\r\n\t\t}\r\n\r\n\t\tif (treeNode.Readonly)\r\n\t\t{\r\n\t\t\tsb.AppendFormat(\" readonly=\\\"true\\\"\");\r\n\t\t}\r\n\r\n\t\tif (treeNode.Children == null || !treeNode.Children.Any())\r\n\t\t{\r\n\t\t\tsb.AppendLine(\"/>\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tsb.AppendLine(\">\");\r\n\r\n\t\t\tforeach (var child in treeNode.Children)\r\n\t\t\t{\r\n\t\t\t\tRenderTree(sb, child);\r\n\t\t\t}\r\n\r\n\t\t\tsb.AppendLine(\"</ui:selection>\");\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n\r\n<ui:hierarchicalselector name=\"<%= this.ClientID %>\"\r\n\t required=\"<%= Required ? \"true\" : \"false\" %>\"\r\n\t autoselectchildren=\"<%= AutoSelectChildren ? \"true\" : \"false\" %>\"\r\n\t autoselectparents=\"<%= AutoSelectParents ? \"true\" : \"false\" %>\"\r\n     hascounter=\"true\"\r\n    >\r\n\t<%= _treeXhml %>\r\n</ui:hierarchicalselector>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/MultiKeySelector.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.SelectorTemplateUserControlBase\" %>\r\n\r\n<script runat=\"server\">\r\n\tprivate List<string> _selectedKeys = new List<string>();\r\n\r\n\r\n    public override void InitializeViewState()\r\n    {\r\n        compactModePlaceHolder.Visible = CompactMode;\r\n        verboseModePlaceHolder.Visible = !CompactMode;\r\n\r\n        _selectedKeys = new List<string>(this.SelectedKeys);\r\n\r\n        PopulateRepeater(_selectedKeys);\r\n    }\r\n    \r\n    \r\n    public override void BindStateToProperties()\r\n    {\r\n        var result = new List<string>();\r\n\r\n        if (!this.CompactMode)\r\n        {\r\n            for (int i = 0; i < CheckBoxRepeater.Items.Count; i++)\r\n            {\r\n                Control control = CheckBoxRepeater.Items[i].FindControl(\"CheckBox\");\r\n\r\n                var checkBox = (Composite.Core.WebClient.UiControlLib.CheckBox)control;\r\n\r\n                if (checkBox.Checked) result.Add(HttpUtility.HtmlDecode(checkBox.Text));\r\n            }\r\n        }\r\n        else\r\n        {\r\n            string postedValue = Request.Form[this.ClientID];\r\n            if (!string.IsNullOrEmpty(postedValue))\r\n            {\r\n                result.AddRange(postedValue.Split(','));\r\n            }\r\n\r\n            _selectedKeys = result;\r\n\r\n            PopulateRepeater(result);\r\n        }\r\n\r\n        this.SelectedKeys = result;\r\n    }\r\n\r\n\tprivate void PopulateRepeater(List<string> selectedKeys)\r\n\t{\r\n\t\tvar repeater = CompactMode ? OptionsRepeater : CheckBoxRepeater;\r\n\r\n\t\tvar options = GetOptions();\r\n\t\tif (CompactMode)\r\n\t\t{\r\n\t\t\t// Preserving the order of selection in compact mode\r\n\t\t\tint index = 0;\r\n\t\t\tvar order = selectedKeys.ToDictionary(option => option, option => index++);\r\n\t\t\toptions = options.OrderBy(kvp => order.ContainsKey(kvp.Key) ? order[kvp.Key] : -1).ToList();\r\n\t\t}\r\n\r\n\t\trepeater.DataSource = options;\r\n\t\trepeater.DataBind();\r\n\t}\r\n\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        if (this.CompactMode)\r\n        {\r\n            return this.ClientID;\r\n        }\r\n\r\n        if (CheckBoxRepeater.Items.Count > 0)\r\n        {\r\n            return CheckBoxRepeater.Items[0].UniqueID + \"$CheckBox\";\r\n        }\r\n\r\n        return null;\r\n    }\r\n\r\n\r\n    protected string CustomUiSelectorTagParams(KeyLabelPair keyLabelPair)\r\n    {\r\n        return IsChecked(keyLabelPair.Key) ? \"selected=\\\"true\\\"\" : \"\";\r\n    }\r\n\r\n    protected bool IsChecked(string key)\r\n    {\r\n        return _selectedKeys.Contains(key);\r\n    }\r\n    \r\n</script>\r\n\r\n<asp:PlaceHolder ID=\"verboseModePlaceHolder\" runat=\"server\" Visible=\"false\">\r\n    <ui:checkboxgroup name=\"<%= this.ClientID %>\" required=\"<%= Required ? \"true\" : \"false\" %>\">\r\n    <asp:Repeater runat=\"server\" ID=\"CheckBoxRepeater\">\r\n        <ItemTemplate>\r\n            <aspui:CheckBox ID=\"CheckBox\" runat=\"server\"\r\n              ToolTip=\"<%# HttpUtility.HtmlAttributeEncode(((KeyLabelPair)Container.DataItem).Label) %>\" \r\n              ItemLabel=\"<%# HttpUtility.HtmlAttributeEncode(((KeyLabelPair)Container.DataItem).Label) %>\" \r\n              Text=\"<%# HttpUtility.HtmlAttributeEncode(((KeyLabelPair)Container.DataItem).Key) %>\" \r\n              Checked=\"<%# IsChecked(((KeyLabelPair)Container.DataItem).Key) %>\"/>\r\n        </ItemTemplate>\r\n    </asp:Repeater>\r\n</ui:checkboxgroup>\r\n</asp:PlaceHolder>\r\n\r\n<asp:PlaceHolder ID=\"compactModePlaceHolder\" runat=\"server\" Visible=\"false\">\r\n    <ui:multiselector name=\"<%= this.ClientID %>\" required=\"<%= Required ? \"true\" : \"false\" %>\">\r\n        <asp:Repeater runat=\"server\" ID=\"OptionsRepeater\">\r\n            <ItemTemplate>\r\n                      <ui:selection \r\n                          label=\"<%# Server.HtmlEncode(((KeyLabelPair)Container.DataItem).Label) %>\" \r\n                          value=\"<%# Server.HtmlEncode(((KeyLabelPair)Container.DataItem).Key) %>\"\r\n                          <%# CustomUiSelectorTagParams( (KeyLabelPair)Container.DataItem ) %> />\r\n            </ItemTemplate>\r\n        </asp:Repeater>\r\n</ui:multiselector>\r\n</asp:PlaceHolder>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/PageSelector.ascx",
    "content": "﻿<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.PageReferenceSelectorTemplateUserControlBase\" %>\r\n<%@ Import Namespace=\"Composite.Core.Routing\" %>\r\n<%@ Import Namespace=\"Composite.Data\" %>\r\n<%@ Import Namespace=\"Composite.Data.Types\" %>\r\n\r\n<script runat=\"server\">\r\n    // NOTE: This control is not used anymore\r\n   \r\n    private bool _initialized = false;\r\n    \r\n    protected override void BindStateToProperties()\r\n    {\r\n        if (!string.IsNullOrEmpty(pageSelectorDialog.Value))\r\n        {\r\n            Guid pageId = Guid.Parse(pageSelectorDialog.Value);\r\n            this.Selected = DataReferenceFacade.BuildDataReference(typeof(IPage), pageId) as DataReference<IPage>;\r\n        }\r\n        else\r\n        {\r\n            this.Selected = null;\r\n        }\r\n        _initialized = true;\r\n    }\r\n\r\n        \r\n    protected override void InitializeViewState()\r\n    {\r\n        _initialized = true;\r\n    }\r\n\r\n    protected override void OnPreRender(EventArgs e)\r\n    {\r\n        if (!_initialized)\r\n        {\r\n            BindStateToProperties();\r\n        }\r\n        \r\n        base.OnPreRender(e);\r\n\r\n        DataReference<IPage> reference = this.Selected;\r\n\r\n        if (reference == null || reference.IsSet != true)\r\n        {\r\n            pageSelectorDialog.Value = string.Empty;\r\n            pageSelectorDialog.Attributes[\"label\"] = \"Select a page\";\r\n            pageSelectorDialog.Attributes[\"tooltip\"] = \"\";\r\n            return;\r\n        }\r\n        \r\n        Guid pageId = (Guid) reference.KeyValue;\r\n        IPage page = DataFacade.GetData<IPage>(f => f.Id == pageId).FirstOrDefault();\r\n        string pageTitle = page != null ? page.Title : null;\r\n        if (!string.IsNullOrEmpty(pageTitle))\r\n        {\r\n            pageSelectorDialog.Value = pageId.ToString();\r\n            pageSelectorDialog.Attributes[\"label\"] = pageTitle;\r\n\r\n            string pageUrl = PageUrls.BuildUrl(page);\r\n            if (pageUrl != null)\r\n            {\r\n                int aspxOffset = pageUrl.IndexOf(\".aspx\");\r\n                if (aspxOffset > -1)\r\n                {\r\n                    pageUrl = pageUrl.Substring(0, aspxOffset);\r\n                }\r\n                pageSelectorDialog.Attributes[\"tooltip\"] = pageUrl;\r\n            }\r\n        }\r\n    }\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return pageSelectorDialog.UniqueID;\r\n    }\r\n    \r\n</script>\r\n\r\n<aspui:PostBackDialog \r\n    runat=\"server\"\r\n\tid=\"pageSelectorDialog\"  \r\n\tlabel=\"\" \r\n\ttooltip=\"\"\r\n\thandle=\"Composite.Management.PageIdSelectorDialog\"\r\n\tvalue=\"\"/>\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/Selector.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.SelectorTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n\r\n<script runat=\"server\">\r\n    \r\n    public override void BindStateToProperties()\r\n    {\r\n        this.SelectedKeys = new List<string> { clientSelector.SelectedValue };\r\n    }\r\n\r\n\r\n    protected override void OnLoad(EventArgs e)\r\n    {\r\n        base.OnLoad(e);\r\n\r\n        if (this.SelectedIndexChangedEventHandler != null)\r\n        {\r\n            clientSelector.SelectedIndexChanged += this.SelectedIndexChangedEventHandler;\r\n            clientSelector.AutoPostBack = true;\r\n        }\r\n    }\r\n\r\n    protected override void OnPreRender(EventArgs e)\r\n    {\r\n        base.OnPreRender(e);\r\n\r\n        clientSelector.IsDisabled = ReadOnly;\r\n    }\r\n\r\n\r\n    public override void InitializeViewState()\r\n    {\r\n        List<KeyLabelPair> options = this.GetOptions();\r\n\r\n        clientSelector.DataSource = options;\r\n        clientSelector.DataTextField = \"Label\";\r\n        clientSelector.DataValueField = \"Key\";\r\n        clientSelector.DataBind();\r\n\r\n        string key = this.SelectedKeys.FirstOrDefault();\r\n        if (key != null && options.Any(f => f.Key == key))\r\n        {\r\n            clientSelector.SelectedValue = key;\r\n        }\r\n        else\r\n        {\r\n            clientSelector.SelectionRequired = this.Required;\r\n        }\r\n    }\r\n\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return clientSelector.UniqueID;\r\n    }\r\n</script>\r\n\r\n<aspui:Selector ID=\"clientSelector\" runat=\"server\" />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/SvgIconSelector.ascx",
    "content": "﻿<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.SvgIconSelectorTemplateUserControlBase\"  %>\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\n<script runat=\"server\">\n\t\n\tprivate string _currentStringValue = null;\n\n\tprotected void Page_Init(object sender, EventArgs e)\n\t{\n\t\tif (_currentStringValue == null)\n\t\t{\n\t\t\t_currentStringValue = Request.Form[this.UniqueID]??string.Empty;\n\t\t}\n\t}\n\n\tprotected override void BindStateToProperties()\n\t{\n\t\tthis.Selected = _currentStringValue;\n\t}\n\n\tprotected override void InitializeViewState()\n\t{\n\t\t_currentStringValue = this.Selected;\n\t}\n\n\tpublic override string GetDataFieldClientName()\n\t{\n\t\treturn this.UniqueID;\n\t}\n\n</script>\n\n<ui:selector name=\"<%= this.UniqueID  %>\" local=\"true\" >\n\t<ui:selection selected=\"true\" label=\"&lt;NONE&gt;\" value=\"\" tooltip=\"&lt;NONE&gt;\" required=\"<%= this.Required.ToString().ToLower() %>\" />\n\t<% \n\t\tforeach (var icon in this.SvgIdsOptions)\n\t\t{ %>\n\t\t\t<ui:selection image=\"${icon:<%= HttpUtility.HtmlAttributeEncode(icon.Key) %>}\" label=\"<%=HttpUtility.HtmlAttributeEncode(icon.Value) %>\" value=\"<%=HttpUtility.HtmlAttributeEncode(icon.Key) %>\" <%=(icon.Key==_currentStringValue)?\"selected=\\\"true\\\"\":\"\" %>/>\n\t<%  } %>\n</ui:selector>\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/TreeSelector.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TreeSelectorTemplateUserControlBase\"  %>\n\n<script runat=\"server\">\n\n\tprivate string _currentStringValue;\n\n\tprotected override void InitializeViewState()\n\t{\n\t\t_currentStringValue = this.SelectedKey;\n\t}\n\n\tpublic override bool LoadPostData(string postDataKey, NameValueCollection postCollection)\n\t{\n\t\t_currentStringValue = postCollection[postDataKey];\n\t\treturn true;\n\t}\n\n\tprotected override void BindStateToProperties()\n\t{\n\t\tthis.SelectedKey = _currentStringValue;\n\t}\n\n\tpublic override string GetDataFieldClientName()\n\t{\n\t\treturn this.UniqueID;\n\t}\n\n\tprivate string ValidationParams()\n\t{\n\t\tvar paramsBuilder = new StringBuilder();\n\n\t\tif (this.Required) paramsBuilder.Append(@\" required=\"\"true\"\"\");\n\n\t\treturn paramsBuilder.ToString();\n\t}\n\n\tpublic string FilterCharactersAndEncode(string text)\n\t{\n\t\t// Filtering '\\0' character, browsers' xml readers cannot parse neither '\\0' nor \"&#x0;\"\n\t\treturn Server.HtmlEncode((text ?? string.Empty).Replace('\\0', ' '));\n\t}\n\n\n</script>\n<ui:datainputdialog\n\treadonly=\"true\"\n\tid=\"<%= this.UniqueID  %>\"\n\tname=\"<%= this.UniqueID  %>\"\n\telement-provider=\"<%= FilterCharactersAndEncode(this.ElementProvider)  %>\"\n\tselection-property=\"<%= FilterCharactersAndEncode(this.SelectableElementPropertyName)  %>\"\n\tselection-value=\"<%= FilterCharactersAndEncode(this.SelectableElementPropertyValue)  %>\"\n\tselection-result=\"<%= FilterCharactersAndEncode(this.SelectableElementReturnValue)  %>\"\n\tserialized-search-token=\"<%= FilterCharactersAndEncode(this.SerializedSearchToken)  %>\"\n\tvalue=\"<%= FilterCharactersAndEncode(_currentStringValue) %>\" binding=\"TreeSelectorDialogBinding\"\n\t<%= ValidationParams() %> />\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Selectors/UrlComboBox.ascx",
    "content": "﻿<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TextInputTemplateUserControlBase\"  %>\r\n\r\n<script runat=\"server\">\r\n    \r\n    private string _currentStringValue;\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n        _currentStringValue = this.Text;\r\n    }\r\n    \r\n    public override bool LoadPostData(string postDataKey, NameValueCollection postCollection)\r\n    {\r\n        _currentStringValue = postCollection[postDataKey];\r\n        return true;\r\n    }\r\n    \r\n    protected override void BindStateToProperties()\r\n    {\r\n        this.Text = _currentStringValue;\r\n    }\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.UniqueID;\r\n    }\r\n\r\n    private string ValidationParams()\r\n    {\r\n        var paramsBuilder = new StringBuilder();\r\n\r\n        if (this.Required) paramsBuilder.Append(@\" required=\"\"true\"\"\");\r\n\r\n        return paramsBuilder.ToString();\r\n    }\r\n\r\n    public string FilterCharactersAndEncode(string text)\r\n    {\r\n        // Filtering '\\0' character, browsers' xml readers cannot parse neither '\\0' nor \"&#x0;\"\r\n        return Server.HtmlEncode((text ?? string.Empty).Replace('\\0', ' '));\r\n    }\r\n    \r\n\r\n</script>\r\n<ui:urlinputdialog id=\"<%= this.UniqueID  %>\" type=\"url\" handle=\"Composite.Management.LinkableSelectorDialog\" name=\"<%= this.UniqueID  %>\" value=\"<%= FilterCharactersAndEncode(_currentStringValue) %>\"  <%= ValidationParams() %> />"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Text/Heading.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.HeadingTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script runat=\"server\">    \r\n    protected override void InitializeViewState(){}\r\n</script>\r\n\r\n<ui:pagehead>\r\n\t<ui:pageheading><%= this.Title %></ui:pageheading>\r\n\t<ui:pagedescription><%= this.Description %></ui:pagedescription>\r\n</ui:pagehead>\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Text/HtmlBlob.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.HtmlBlobTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script runat=\"server\">    \r\n    protected override void BindStateToProperties(){}\r\n\r\n    protected override void InitializeViewState(){}\r\n\r\n    string ConvertRenderingUrls(string html)\r\n    {\r\n        html = PageUrlHelper.ChangeRenderingPageUrlsToPublic(html);\r\n        html = MediaUrlHelper.ChangeInternalMediaUrlsToPublic(html);\r\n        \r\n        return html;\r\n    }\r\n</script>\r\n\r\n<ui:scrollbox>\r\n    <%= ConvertRenderingUrls(this.Html) %>\r\n</ui:scrollbox>\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Text/InfoTable.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.InfoTableTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"System.Collections.Generic\" %>\r\n<%@ Import Namespace=\"System.Xml.Linq\" %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n<%@ Register Src=\"../../Helpers/StyleFileLoaderControl.ascx\" TagPrefix=\"control\" TagName=\"StyleLoader\" %>\r\n\r\n<control:StyleLoader adminRelativePath=\"controls/FormsControls/FormUiControlTemplates/Text/InfoTable.css\" runat=\"server\" />\r\n\r\n<script runat=\"server\">    \r\n    protected override void InitializeViewState(){}\r\n\r\n    private string BuildTable()\r\n    {\r\n    \tstring result = \"\";\r\n    \r\n    \tif (this.Rows != null && this.Rows.Count > 0)\r\n        {\r\n            foreach (List<string> row in this.Rows)\r\n            {\r\n            \tforeach (string columnText in row) {\r\n\t                result += \"<br/><br/>\" + Server.HtmlEncode(columnText);\r\n\t            }\r\n            }\r\n        }\r\n    \r\n    \treturn result;\r\n    \r\n    \t/*\r\n        if ((this.Rows == null || this.Rows.Count == 0) && (this.Headers == null || this.Headers.Count == 0))\r\n            return \"\";\r\n\r\n        StringBuilder tableClassNamesBuilder = new StringBuilder(\"infoTableUiControl\");\r\n        if (this.Border == true) tableClassNamesBuilder.Append(\" infoTableUiControl_border\");\r\n\r\n        XElement tableElement = new XElement(\"table\", new XAttribute(\"class\", tableClassNamesBuilder.ToString()));\r\n\r\n        if (string.IsNullOrEmpty(this.Caption) == false)\r\n        {\r\n            tableElement.Add(new XElement(\"caption\", this.Caption));\r\n        }\r\n        \r\n        if (this.Headers != null && this.Headers.Count > 0)\r\n        {\r\n            XElement tableHead = new XElement(\"thead\");\r\n            XElement tableHeadRow = new XElement(\"tr\");\r\n            \r\n            foreach (string columnHeaderText in this.Headers)\r\n                tableHeadRow.Add(new XElement(\"th\", columnHeaderText));\r\n\r\n            tableHead.Add(tableHeadRow);\r\n            tableElement.Add(tableHead);\r\n        }\r\n\r\n        if (this.Rows != null && this.Rows.Count > 0)\r\n        {\r\n            XElement tableBody = new XElement(\"tbody\");\r\n\r\n            foreach (List<string> row in this.Rows)\r\n            {\r\n                XElement tableRow = new XElement(\"tr\");\r\n                foreach (string columnText in row)\r\n                    tableRow.Add(new XElement(\"td\", columnText ));\r\n\r\n                tableBody.Add(tableRow);\r\n            }\r\n\r\n            tableElement.Add(tableBody);\r\n        }\r\n        \r\n        return tableElement.ToString();\r\n        */\r\n    }\r\n</script>\r\n\r\n\r\n<%= BuildTable() %>\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Text/InfoTable.css",
    "content": "﻿table.infoTableUiControl {\r\n\tborder-collapse: collapse;\t\r\n}\r\ntable.infoTableUiControl td, \r\ntable.infoTableUiControl th {\r\n\tpadding: 5px;\r\n}\r\ntable.infoTableUiControl td {\r\n\tvertical-align: top;\r\n\tcursor: text;\r\n}\r\ntable.infoTableUiControl th {\r\n\ttext-align: left;\r\n\tfont-weight: bold;\r\n\tbackground-color: $(color:threedface);\r\n}\r\n\r\n\r\ntable.infoTableUiControl_border,\r\ntable.infoTableUiControl_border td {\r\n\tborder: 1px solid black;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Text/LongText.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TextTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script runat=\"server\">    \r\n    protected override void BindStateToProperties(){}\r\n\r\n    protected override void InitializeViewState(){}\r\n</script>\r\n\r\n<div style=\"height:8em; background-color:White; padding: 0.3em; border:solid 1px ThreeDShadow; overflow: auto; margin-bottom:1em\">\r\n  <%= \"<span>\" + HttpUtility.HtmlEncode(this.Text ?? \"\").Replace(\"\\n\", \"</span><br/><span>\") + \"</span>\" %>\r\n</div>\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/Text/Text.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TextTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Plugins.Forms.WebChannel.UiControlFactories\" %>\r\n\r\n<script runat=\"server\">    \r\n    protected override void BindStateToProperties(){}\r\n\r\n    protected override void InitializeViewState(){}\r\n</script>\r\n\r\n<%= \"<span>\" + HttpUtility.HtmlEncode(this.Text ?? \"\").Replace(\"\\n\", \"</span><br/><span>\") + \"</span>\" %>\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/TextInput/TextArea.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TextInputTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Data.Validation.ClientValidationRules\" %>\r\n\r\n<script runat=\"server\">\r\n    private string _currentStringValue;\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n        _currentStringValue = this.Text;\r\n    }\r\n    \r\n\r\n    public override bool LoadPostData(string postDataKey, NameValueCollection postCollection)\r\n    {\r\n        _currentStringValue = postCollection[postDataKey];\r\n        return true;\r\n    }\r\n    \r\n    \r\n    protected override void BindStateToProperties()\r\n    {\r\n        this.Text = _currentStringValue;\r\n    }\r\n\r\n    \r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.UniqueID;\r\n    }\r\n    \r\n    \r\n    \r\n    private string IsRequired()\r\n    {\r\n        return ClientValidationRules != null && ClientValidationRules.Any(rule => rule is NotNullClientValidationRule) ? \"true\" : \"false\";\r\n    }\r\n    \r\n    \r\n    private string TypeParam()\r\n    {\r\n        switch (this.Type)\r\n        {\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.ReadOnly:\r\n                return @\"readonly=\"\"true\"\"\";\r\n            default:\r\n                return \"\";\r\n        }        \r\n    }\r\n\r\n\r\n    public string FilterCharactersAndHtmlEncode(string text)\r\n     {\r\n         // Filtering '\\0' character, browsers' xml readers cannot parse neither '\\0' nor \"&#x0;\"\r\n         return Server.HtmlEncode((text ?? string.Empty).Replace('\\0', ' '));\r\n     }    \r\n</script>\r\n\r\n<ui:textbox required=\"<%= IsRequired() %>\" name=\"<%= this.UniqueID  %>\" spellcheck=\"<%= this.SpellCheck.ToString().ToLower() %>\" <%= TypeParam() %>>\r\n    <textarea><%= FilterCharactersAndHtmlEncode(_currentStringValue) %></textarea>\r\n</ui:textbox>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/TextInput/TextBox.ascx",
    "content": "﻿<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TextInputTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"Composite.Data.Validation.ClientValidationRules\" %>\r\n\r\n<script runat=\"server\">\r\n    private string _currentStringValue;\r\n\r\n    protected override void InitializeViewState()\r\n    {\r\n        _currentStringValue = this.Text;\r\n    }\r\n\r\n    \r\n    public override bool LoadPostData(string postDataKey, NameValueCollection postCollection)\r\n    {\r\n        _currentStringValue = postCollection[postDataKey];\r\n        return true;\r\n    }\r\n\r\n    \r\n    protected override void BindStateToProperties()\r\n    {\r\n        this.Text = _currentStringValue;\r\n    }\r\n\r\n        \r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.UniqueID;\r\n    }\r\n\r\n    private string TypeParam()\r\n    {\r\n        switch (this.Type)\r\n        {\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.Password:\r\n                return @\"password=\"\"true\"\"\";\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.Integer:\r\n                return @\"type=\"\"integer\"\"\";\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.Decimal:\r\n                return @\"type=\"\"number\"\"\";\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.Guid:\r\n                return @\"type=\"\"guid\"\"\";\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.ProgrammingIdentifier:\r\n                return @\"type=\"\"programmingidentifier\"\"\";\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.ProgrammingNamespace:\r\n                return @\"type=\"\"programmingnamespace\"\"\";\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.ReadOnly:\r\n                return @\"readonly=\"\"true\"\"\";\r\n            case Composite.C1Console.Forms.CoreUiControls.TextBoxType.String:\r\n            default:\r\n                return \"\";\r\n        }        \r\n    }\r\n\r\n\r\n    private string ValidationParams()\r\n    {\r\n        bool required = this.Required;\r\n        int maxLength = Int32.MaxValue;\r\n        int minLength = 0;\r\n        bool hasLengthRule = false;\r\n\r\n        if (this.ClientValidationRules != null)\r\n        {\r\n            foreach (var rule in this.ClientValidationRules)\r\n            {\r\n                if (rule is NotNullClientValidationRule) required = true;\r\n\r\n                if (rule is StringLengthClientValidationRule)\r\n                {\r\n                    hasLengthRule = true;\r\n                    var lengthRule = (StringLengthClientValidationRule)rule;\r\n                    minLength = Math.Max(minLength, lengthRule.LowerBound);\r\n                    maxLength = Math.Min(maxLength, lengthRule.UpperBound);\r\n\r\n                    if (minLength > 0) required = true;\r\n                }\r\n            }\r\n        }\r\n\r\n        var paramsBuilder = new StringBuilder();\r\n\r\n        if (required) paramsBuilder.Append(@\" required=\"\"true\"\"\");\r\n        if (hasLengthRule) paramsBuilder.AppendFormat(@\" minlength=\"\"{0}\"\" maxlength=\"\"{1}\"\"\", minLength, maxLength);\r\n        \r\n        return paramsBuilder.ToString();\r\n    }\r\n\r\n    public string FilterCharactersAndEncode(string text)\r\n    {\r\n        // Filtering '\\0' character, browsers' xml readers cannot parse neither '\\0' nor \"&#x0;\"\r\n        return Server.HtmlEncode((text ?? string.Empty).Replace('\\0', ' '));\r\n    }\r\n    \r\n</script>\r\n<ui:datainput name=\"<%= this.UniqueID  %>\" value=\"<%= FilterCharactersAndEncode(_currentStringValue) %>\" spellcheck=\"<%= this.SpellCheck.ToString().ToLower() %>\" <%= ValidationParams() %> <%= TypeParam() %> />\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/FormUiControlTemplates/TypeSelectors/TypeSelector.ascx",
    "content": "<%@ Control Language=\"C#\" Inherits=\"Composite.Plugins.Forms.WebChannel.UiControlFactories.TypeSelectorTemplateUserControlBase\"  %>\r\n<%@ Import Namespace=\"System.Linq\" %>\r\n<%@ Import Namespace=\"Composite.Core.Types\" %>\r\n\r\n<script runat=\"server\">\r\n    \r\n    protected override void BindStateToProperties()\r\n    {\r\n        this.SelectedType = TypeManager.GetType(typeSelector.SelectedValue);\r\n    }\r\n\r\n    private IEnumerable<KeyValuePair> GetTypeKeyValues()\r\n    {\r\n        return this.TypeOptions.Select(type => new KeyValuePair(TypeManager.SerializeType(type), type.GetShortLabel()));\r\n    }\r\n\r\n    \r\n    protected override void InitializeViewState()\r\n    {\r\n        typeSelector.ToolTip = this.FormControlLabel;\r\n        typeSelector.DataSource = GetTypeKeyValues().OrderBy(f => f.Value);\r\n        typeSelector.DataValueField = \"Key\";\r\n        typeSelector.DataTextField = \"Value\";\r\n        typeSelector.DataBind();\r\n\r\n        if (this.SelectedType != null)\r\n        {\r\n            try\r\n            {\r\n                typeSelector.SelectedValue = TypeManager.SerializeType(this.SelectedType);\r\n            }\r\n            catch (Exception) \r\n            {\r\n                this.Controls.Add(new LiteralControl(\"Failed to locate selected value\"));\r\n            }\r\n        }\r\n    }\r\n\r\n    public override string GetDataFieldClientName()\r\n    {\r\n        return this.typeSelector.UniqueID;\r\n    }\r\n\r\n\r\n</script>\r\n\r\n<aspui:Selector runat=\"server\" ID=\"typeSelector\">\r\n</aspui:Selector>\r\n"
  },
  {
    "path": "Website/Composite/controls/FormsControls/Helpers/StyleFileLoaderControl.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"StyleFileLoaderControl.ascx.cs\" Inherits=\"Composite.controls.helpers.StyleFileLoaderControl\" %>"
  },
  {
    "path": "Website/Composite/controls/FormsControls/Helpers/StyleFileLoaderControl.ascx.cs",
    "content": "using System;\r\nusing System.Web.UI;\r\n\r\nnamespace Composite.controls.helpers\r\n{\r\n    public partial class StyleFileLoaderControl : System.Web.UI.UserControl\r\n    {\r\n        public string adminRelativePath = \"\";\r\n\r\n        protected void Page_Load(object sender, EventArgs e)\r\n        {\r\n            string path = Composite.Core.WebClient.UrlUtils.ResolveAdminUrl(adminRelativePath);\r\n            string tagGoo = string.Format(\"<link rel='stylesheet' type='text/css' href='{0}'/>\\n\", path);\r\n\r\n            Control headerElementsPlaceHolder = this.FindControl(this.Page, \"HeaderPlaceHolder\");\r\n            if (headerElementsPlaceHolder == null) throw new InvalidOperationException(\"Missing 'HeaderPlaceHolder' placeholder on page\");\r\n            headerElementsPlaceHolder.Controls.Add(new LiteralControl(tagGoo));\r\n        }\r\n\r\n\r\n        private Control FindControl(Control toSearch, string idToFind)\r\n        {\r\n            Control c = toSearch.FindControl(idToFind);\r\n            if (c == null && toSearch.Controls != null)\r\n            {\r\n                foreach (Control subControl in toSearch.Controls)\r\n                {\r\n                    c = FindControl(subControl, idToFind);\r\n                    if (c != null) break;\r\n                }\r\n            }\r\n\r\n            return c;\r\n        }\r\n\r\n\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/FormsControls/Helpers/StyleFileLoaderControl.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class StyleFileLoaderControl\r\n{\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/HttpHeadersControl.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"HttpHeadersControl.ascx.cs\" Inherits=\"HttpHeadersControl\" %>\r\n"
  },
  {
    "path": "Website/Composite/controls/HttpHeadersControl.ascx.cs",
    "content": "using System;\r\nusing System.Data;\r\nusing System.Configuration;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Web;\r\nusing System.Web.Security;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing System.Web.UI.WebControls.WebParts;\r\nusing System.Web.UI.HtmlControls;\r\nusing Composite.Core.WebClient.Presentation;\r\n\r\npublic partial class HttpHeadersControl : System.Web.UI.UserControl\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        ViewServices.RegisterCommonTransformations();\r\n        ViewServices.RegisterMimeType();\r\n\r\n\t\t// Force NET mumbojumbo scripts to appear - needed for UpdateManager.js\r\n\t\tthis.Page.ClientScript.GetPostBackEventReference ( this, string.Empty );\r\n    }\r\n    \r\n\tprotected override void Render(HtmlTextWriter writer)\r\n    {\r\n    \t// Make hidden field \"__EVENTVALIDATION\" appear - needed for UpdateManager.js\r\n\t\tthis.Page.ClientScript.RegisterForEventValidation ( \"TemporaryIdForEventValidation\" );\r\n\t\tbase.Render (writer);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/HttpHeadersControl.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class HttpHeadersControl {\r\n    \r\n    /// <summary>\r\n    /// CoreOutputTransformation control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::Composite_controls_RegisterOutputTransformation CoreOutputTransformation;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/Misc/MarkupInOutView.ascx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"MarkupInOutView.ascx.cs\" Inherits=\"CompositeMarkupInOutView\" %>\r\n<%@ Register TagPrefix=\"aspui\" Namespace=\"Composite.Core.WebClient.UiControlLib\" Assembly=\"Composite\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<control:httpheaders id=\"Httpheaders1\" runat=\"server\" />\r\n\t<head>\r\n\t\t<title>Composite.Management.FunctionEditor.InputOutputMarkup</title>\r\n\t\t<control:styleloader runat=\"server\" />\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"<%= Composite.Core.WebClient.UrlUtils.ResolveAdminUrl(\"controls/Misc/MarkupInOutView.css.aspx\" ) %>\"/>\r\n\t</head>\r\n\t<body>\r\n\t\t<form id=\"Form1\" runat=\"server\">\r\n\t\t\t<ui:page>\r\n\t\t    <asp:Placeholder runat=\"server\" id=\"InputRelated01\">\r\n\t\t\t\t<ui:splitbox id=\"functioneditorinputoutputsplitbox\" orient=\"vertical\" layout=\"1:1\" persist=\"layout\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarlabel label=\"${string:Website.Misc.SourceCodeViewer.LabelInput}\" image=\"${icon:input}\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t\t\t\t\t<ui:sourcecodeviewer syntax=\"xml\">\r\n\t\t\t\t\t\t\t<aspui:TextBox TextMode=\"MultiLine\" ID=\"inMarkupHolder\" runat=\"server\" Wrap=\"false\" />\r\n\t\t\t\t\t\t</ui:sourcecodeviewer>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter />\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:toolbar>\r\n\t\t\t\t\t\t\t<ui:toolbarbody>\r\n\t\t\t\t\t\t\t\t<ui:toolbargroup>\r\n\t\t\t\t\t\t\t\t\t<ui:toolbarlabel label=\"${string:Website.Misc.SourceCodeViewer.LabelOutput}\" image=\"${icon:output}\"/>\r\n\t\t\t\t\t\t\t\t</ui:toolbargroup>\r\n\t\t\t\t\t\t\t</ui:toolbarbody>\r\n\t\t\t\t\t\t</ui:toolbar>\r\n\t\t    </asp:Placeholder>\r\n\t\t\t\t\t\t<asp:PlaceHolder ID=\"ErrorDetailsPlaceHolder\" Visible=\"false\" runat=\"server\">\r\n\t\t\t\t\t\t\t<div id=\"error\">\r\n\t\t\t\t\t\t\t\t<div id=\"erroricon\"><!-- emptydiv --></div>\r\n\t\t\t\t\t\t\t\t<div id=\"errortype\">\r\n\t\t\t\t\t\t\t\t\t<asp:Label ID=\"ErrorTypeLabel\" runat=\"server\" />\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div id=\"errortext\">\r\n\t\t\t\t\t\t\t\t\t<asp:Label ID=\"ErrorDescriptionLabel\" runat=\"server\" />\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</asp:PlaceHolder>\r\n\t\t\t\t\t\t<asp:PlaceHolder id=\"OutputSourceViewerPlaceHolder\" runat=\"server\">\r\n\t\t\t\t\t\t    <ui:sourcecodeviewer syntax=\"xml\">\r\n\t\t\t\t\t\t\t    <aspui:TextBox TextMode=\"MultiLine\" ID=\"outMarkupHolder\" runat=\"server\" Wrap=\"false\" />\r\n\t\t\t\t\t\t    </ui:sourcecodeviewer>\r\n\t\t\t\t\t\t</asp:PlaceHolder>\r\n\t\t    <asp:Placeholder runat=\"server\" id=\"InputRelated02\">\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n                    <ui:toolbar class=\"statusbar\">\r\n                        <ui:toolbarbody>\r\n                            <ui:toolbargroup>\r\n                                <ui:toolbarlabel style=\"color:ThreeDDarkShadow;\" label=\"<%= this.Attributes[\"statusmessage\"] %>\" image=\"${icon:message}\" />\r\n                            </ui:toolbargroup>\r\n                        </ui:toolbarbody>\r\n                    </ui:toolbar>\r\n\t\t\t</asp:Placeholder>\r\n\t\t\t</ui:page>\r\n\t\t</form>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/controls/Misc/MarkupInOutView.ascx.cs",
    "content": "﻿using System;\r\nusing System.Data;\r\nusing System.Configuration;\r\nusing System.Collections;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Security;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing System.Web.UI.WebControls.WebParts;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Xml.Linq;\r\n\r\npublic partial class CompositeMarkupInOutView : System.Web.UI.UserControl\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        if (string.IsNullOrEmpty(this.Attributes[\"in\"]) == false)\r\n        {\r\n            this.inMarkupHolder.Text = this.Attributes[\"in\"];\r\n        }\r\n        else\r\n        {\r\n            this.InputRelated01.Visible = false;\r\n            this.InputRelated02.Visible = false;\r\n            this.inMarkupHolder.Visible = false;\r\n            this.outMarkupHolder.Height = 400;\r\n        }\r\n\r\n        this.outMarkupHolder.Text = this.Attributes[\"out\"];\r\n\r\n        if (string.IsNullOrEmpty(this.Attributes[\"error\"]) == false)\r\n        {\r\n            string error = this.Attributes[\"error\"];\r\n\r\n            string errorType = error.Substring(0, error.IndexOf('\\n'));\r\n            string errorDescription = error.Substring(error.IndexOf('\\n')+1);\r\n\r\n            this.ErrorTypeLabel.Text = HttpUtility.HtmlEncode( errorType );\r\n            this.ErrorDescriptionLabel.Text = HttpUtility.HtmlEncode( errorDescription );\r\n\r\n            this.ErrorDetailsPlaceHolder.Visible = true;\r\n            this.OutputSourceViewerPlaceHolder.Visible = false;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/Misc/MarkupInOutView.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class CompositeMarkupInOutView {\r\n    \r\n    /// <summary>\r\n    /// Httpheaders1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::HttpHeadersControl Httpheaders1;\r\n    \r\n    /// <summary>\r\n    /// Form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm Form1;\r\n    \r\n    /// <summary>\r\n    /// InputRelated01 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder InputRelated01;\r\n    \r\n    /// <summary>\r\n    /// inMarkupHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.TextBox inMarkupHolder;\r\n    \r\n    /// <summary>\r\n    /// ErrorDetailsPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder ErrorDetailsPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// ErrorTypeLabel control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Label ErrorTypeLabel;\r\n    \r\n    /// <summary>\r\n    /// ErrorDescriptionLabel control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Label ErrorDescriptionLabel;\r\n    \r\n    /// <summary>\r\n    /// OutputSourceViewerPlaceHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder OutputSourceViewerPlaceHolder;\r\n    \r\n    /// <summary>\r\n    /// outMarkupHolder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.TextBox outMarkupHolder;\r\n    \r\n    /// <summary>\r\n    /// InputRelated02 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder InputRelated02;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/Misc/MarkupInOutView.css",
    "content": "div#error {\r\n\tpadding: 24px;\t\r\n}\r\ndiv#erroricon {\r\n\theight: 32px;\r\n\twidth: 32px;\r\n\tfloat: left;\r\n\tmargin-right: 10px;\r\n\t#alphabackdrop: url(\"${root}/images/icons/harmony/composite/error_32.png\");\r\n}\r\ndiv#errortype {\r\n\tfont-weight: bold;\t\r\n\tpadding-top: 3px;\r\n}"
  },
  {
    "path": "Website/Composite/controls/Razor/RazorLayout.cshtml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n\r\n@{\r\n      \r\n    Composite.Core.WebClient.Presentation.ViewServices.RegisterCommonTransformations();\r\n    Composite.Core.WebClient.Presentation.ViewServices.RegisterMimeType();\r\n\r\n    dynamic state;\r\n    \r\n}\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n    <title>Composite.Management.ServerLog</title>\r\n\r\n    @Html.Raw(Composite.Core.WebClient.ScriptLoader.Render(\"sub\"))\r\n    @Html.Raw(Composite.Core.WebClient.StyleLoader.Render())\r\n\r\n\t<script type=\"text/javascript\">\r\n\t    DocumentManager.isDocumentSelectable = true;\r\n\t</script>\r\n    <script type=\"text/javascript\">\r\n        //\r\n        function __doPostBack(eventTarget, eventArgument) {\r\n            var theForm = document.forms['Form1'];\r\n            if (!theForm) {\r\n                theForm = document.Form1;\r\n            }\r\n            if (!theForm.onsubmit || (theForm.onsubmit() != false)) {\r\n                theForm.__EVENTTARGET.value = eventTarget;\r\n                theForm.__EVENTARGUMENT.value = eventArgument;\r\n                theForm.submit();\r\n            }\r\n        }\r\n        //\r\n\t</script>\r\n\r\n\r\n    @RenderSection(\"HtmlHead\", false)\r\n\r\n</head>\r\n    <body>\r\n        <form name=\"Form1\" id=\"Form1\" class=\"updateform updatezone\" method=\"POST\"> <!-- simulate dot net --> \r\n           <input type=\"hidden\" name=\"__EVENTTARGET\" id=\"__EVENTTARGET\" />\r\n           <input type=\"hidden\" name=\"__EVENTARGUMENT\" id=\"__EVENTARGUMENT\"  />\r\n          @if(PageData.TryGetValue(\"__STATE\", out state)){ <input type=\"hidden\" name=\"__STATE\" id=\"__STATE\"  value=\"@state.Serialize()\" /> } @* If used it should implement Serialize*@\r\n\r\n                @RenderSection(\"BodyHead\", false)\r\n\r\n                @RenderBody()\r\n\r\n                @RenderSection(\"BodyFoot\", false)\r\n        </form>\r\n    </body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/controls/RegisterOutputTransformation.ascx",
    "content": "﻿<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"RegisterOutputTransformation.ascx.cs\" Inherits=\"Composite_controls_RegisterOutputTransformation\" %>\r\n"
  },
  {
    "path": "Website/Composite/controls/RegisterOutputTransformation.ascx.cs",
    "content": "﻿using System;\r\nusing System.Web.UI;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Presentation;\r\n\r\npublic partial class Composite_controls_RegisterOutputTransformation : System.Web.UI.UserControl\r\n{\r\n    public string path = \"\";\r\n    public string position = \"10\";\r\n\r\n    public Composite_controls_RegisterOutputTransformation()\r\n    {\r\n        OutputTransformationManager.Activate();\r\n    }\r\n\r\n\r\n    // Overriding render - making it NOT run during ASP.NET Ajax UpdatePanel updtates\r\n    protected override void Render(HtmlTextWriter writer)\r\n    {\r\n        if (string.IsNullOrEmpty(this.path) == true)\r\n        {\r\n            throw new InvalidOperationException(\"RegisterOutputTransformation.ascx missing path param\");\r\n        }\r\n\r\n        //LoggingService.LogVerbose(\"RegisterOutputTransformation.ascx\", \"Running\");\r\n        int positionParsed = Int32.Parse(this.position);\r\n        string webPath = UrlUtils.ResolveAdminUrl(this.path);\r\n\r\n        OutputTransformationManager.RegisterTransformation(this.MapPath(webPath), positionParsed);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/RegisterOutputTransformation.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_controls_RegisterOutputTransformation {\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/ScriptLoaderControl.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"ScriptLoaderControl.ascx.cs\" Inherits=\"ScriptLoaderControl\" %>"
  },
  {
    "path": "Website/Composite/controls/ScriptLoaderControl.ascx.cs",
    "content": "using System;\r\nusing System.Web.UI;\r\nusing Composite.Core.WebClient;\r\n\r\npublic partial class ScriptLoaderControl : System.Web.UI.UserControl\r\n{\r\n\r\n    public string type;\r\n    public string directive;\r\n    public bool updateManagerDisabled;\r\n\r\n    private ScriptLoader _scriptloader; \r\n\r\n    /**\r\n     * Notice that automatic compression doesn't work!\r\n     */\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        _scriptloader = new ScriptLoader(type, directive, updateManagerDisabled);\r\n    }\r\n\t\r\n\r\n\r\n    protected override void Render(HtmlTextWriter writer)\r\n    {\r\n        writer.Write(_scriptloader.Render());\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/ScriptLoaderControl.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class ScriptLoaderControl {\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/StageDeckControl.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"StageDeckControl.ascx.cs\" Inherits=\"StageDeckControl\" %>"
  },
  {
    "path": "Website/Composite/controls/StageDeckControl.ascx.cs",
    "content": "using System;\r\nusing System.Web.UI;\r\nusing System.Xml;\r\nusing Composite.Core.Xml;\r\n\r\n\r\npublic partial class StageDeckControl : System.Web.UI.UserControl\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n\t}\r\n\r\n    protected override void Render(HtmlTextWriter writer) \r\n    {\r\n\r\n        string path = Server.MapPath(\"../../../templates/defaultstagedeck.xml\");\r\n        \r\n        XmlDocument doc = new XmlDocument();\r\n\t\tXmlReaderSettings settings = new XmlReaderSettings();\r\n        settings.IgnoreComments = true;\r\n\r\n        using (XmlReader reader = XmlReaderUtils.Create(path, settings))\r\n        {\r\n            doc.Load(reader);\r\n        }\r\n        writer.Write( doc.DocumentElement.OuterXml );\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/StageDeckControl.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class StageDeckControl {\r\n}\r\n"
  },
  {
    "path": "Website/Composite/controls/StyleLoaderControl.ascx",
    "content": "<%@ Control Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"StyleLoaderControl.ascx.cs\" Inherits=\"Composite.controls.StyleLoaderControl\" %>"
  },
  {
    "path": "Website/Composite/controls/StyleLoaderControl.ascx.cs",
    "content": "using System.Web.Hosting;\r\nusing System.Web.UI;\r\nusing Composite.Core.WebClient;\r\n\r\nnamespace Composite.controls\r\n{\r\n    public partial class StyleLoaderControl : System.Web.UI.UserControl\r\n    {\r\n        public string Directive { get; set; }\r\n\r\n        protected override void Render(HtmlTextWriter writer)\r\n        {\r\n            writer.Write(StyleLoader.Render(Directive));\r\n        }\r\n\r\n \r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/controls/StyleLoaderControl.ascx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class StyleLoaderControl {\r\n}\r\n"
  },
  {
    "path": "Website/Composite/dead.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>    \r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<title>Composite.Management.Dead</title>\r\n\t\t<style type=\"text/css\">\r\n\t\t\thtml,\r\n\t\t\tbody {\r\n\t\t\t\theight: 100%;\r\n\t\t\t}\r\n\t\t\thtml {\r\n\t\t\t\tbackground-color: ThreeDFace;\r\n\t\t\t\tcolor: WindowText;\r\n\t\t\t}\r\n\t\t\thtml,\r\n\t\t\tbody {\r\n\t\t\t\tborder: none;\r\n\t\t\t\tmargin: 0;\r\n\t\t\t\tpadding: 0;\r\n\t\t\t}\r\n\t\t</style>\r\n\t</head>\r\n\t<body>\r\n\t\t<!-- \r\n\t\t\tWhen a WindowBinding gets disposed, we need to load an empty document \r\n\t\t\tinto the associated iframe in order to fix a bug in Explorer where \r\n\t\t\tthe primary window content could be observed to hang around eerily. \r\n\t\t\tNote that we cannot use an \"about:blank\" on a HTTPS protocol.\r\n\t\t-->\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/default.aspx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<!DOCTYPE html>\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<%@ Import Namespace=\"Composite.Core.WebClient\" %>\r\n<%\r\n    if (Composite.RuntimeInformation.IsDebugBuild\r\n        && (Request.UrlReferrer == null || Request.UrlReferrer.AbsolutePath == \"/\")\r\n        && ScriptLoader.UnbundledScriptsAvailable())\r\n    {\r\n        Response.Redirect(\"develop.aspx\");\r\n    }\r\n%>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<head>\r\n    <title>Start Composite</title>\r\n    <meta name=\"robots\" content=\"noindex, nofollow\" />\r\n    <control:styleloader runat=\"server\"/>\r\n    <control:brandingSnippet runat=\"server\" SnippetName=\"includes\" />\r\n     <% Response.WriteFile(\"favicon.inc\"); %>\r\n    <script type=\"text/javascript\" src=\"default.js\"></script>\r\n</head>\r\n<body>\r\n    <div class=\"splash-cover\">\r\n        <div class=\"splash-bg\"></div>\r\n        <div class=\"splash\">\r\n            <div class=\"splash-inner\">\r\n                <control:brandingSnippet runat=\"server\" SnippetName=\"logo\" />\r\n                <div id=\"welcome\">\r\n                    <p>Welcome to your <%= Composite.Core.Configuration.GlobalSettingsFacade.ApplicationName %> website. You can start the Console or go back to your website <a href=\"..\" title=\"Go to the main page\">frontpage</a>.</p>\r\n                </div>\r\n                <div id=\"start\">\r\n                    <a class=\"clickbutton mt-40\" href=\"javascript:Composite.start();\" title=\"Open in a new window\">Start <%= Composite.Core.Configuration.GlobalSettingsFacade.ApplicationName %></a>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/default.js",
    "content": "var Composite = new function () {\r\n\t\r\n\tvar isDevelop = window.location.toString ().indexOf ( \"develop.aspx\" ) >-1;\r\n\t\r\n\twindow.onload = function () {\r\n\t\t\r\n\t\tdocument.onkeyup = function ( e ) {\r\n\t\t\t\r\n\t\t\te = e ? e : window.event;\r\n\t\t\tif ( e.keyCode == 16 ) {\r\n\t\t\t\twindow.timeout = setTimeout ( function () {\r\n\t\t\t\t\twindow.location = isDevelop ? \"default.aspx\" : \"develop.aspx\";\r\n\t\t\t\t}, 50 );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\twindow.onbeforeunload = function () {\r\n\t\t\r\n\t\tif ( window.timeout != null ) {\r\n\t\t\tclearTimeout ( window.timeout );\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis.start = function ( isDeveloperMode ) {\r\n\t\t\r\n\t\tvar url = \"top.aspx\";\r\n\t\tif ( isDeveloperMode ) {\r\n\t\t\turl += \"?mode=develop\";\r\n\t\t}\r\n\t\twindow.open ( url, \"\", \"resizable=1,status=1\" );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/develop.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<script runat=\"server\">\r\n    bool HasDeveloperModeSupport\r\n    {\r\n        get { return Composite.Core.IO.C1File.Exists(this.MapPath(\"scripts/source/top/core/Application.js\")); }\r\n    }\r\n\r\n    bool isCSSCompiled\r\n    {\r\n        get { return Composite.Core.IO.C1File.Exists(this.MapPath(\"styles/styles.min.css\")) && Composite.Core.IO.C1File.Exists(this.MapPath(\"styles/styles.css\")); }\r\n    }\r\n    \r\n</script>\r\n<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<head>\r\n    <title>Start Developer Mode</title>\r\n    <meta name=\"robots\" content=\"noindex, nofollow\" />\r\n    <control:styleloader runat=\"server\" />\r\n    <control:brandingSnippet runat=\"server\" SnippetName=\"includes\" />\r\n     <% Response.WriteFile(\"favicon.inc\"); %>\r\n    <script type=\"text/javascript\" src=\"default.js\"></script>\r\n    <style type=\"text/css\">\r\n        div#welcome {\r\n            display: <%= (this.HasDeveloperModeSupport ? \"block\" : \"none\" ) %>;\r\n        }\r\n\r\n        div#start {\r\n            display: <%= (this.HasDeveloperModeSupport ? \"block\" : \"none\" ) %>;\r\n        }\r\n\r\n        div#developermodeprb {\r\n            display: <%= (this.HasDeveloperModeSupport ? \"none\" : \"block\" ) %>;\r\n        }\r\n\r\n        div#grunt {\r\n            display: <%= (this.isCSSCompiled ? \"none\" : \"block\" ) %>;\r\n        }\r\n\r\n        div#splash {\r\n            display: <%= (this.isCSSCompiled ? \"block\" : \"none\" ) %>;\r\n        }\r\n    </style>\r\n</head>\r\n<body>\r\n    <div id=\"grunt\">\r\n        <% Response.WriteFile(\"grunt.inc\"); %>\r\n    </div>\r\n    <div id=\"splash\" class=\"splash-cover\">\r\n        <div class=\"splash-bg\"></div>\r\n        <div class=\"splash\">\r\n            <div class=\"splash-inner\">\r\n                <control:brandingSnippet runat=\"server\" SnippetName=\"logo\" />\r\n                <div id=\"welcome\">\r\n                    <p>Welcome to your <%= Composite.Core.Configuration.GlobalSettingsFacade.ApplicationName %> website. You can start the Console or go back to your website <a href=\"..\" title=\"Go to the main page\">frontpage</a>.</p>\r\n                </div>\r\n                <div id=\"developermodeprb\">\r\n                    <p>C1 DeveloperMode has not been installed on this site.</p>\r\n                    <p>Press <kbd>SHIFT</kbd> for OperationalMode</p>\r\n                </div>\r\n                <div id=\"start\">\r\n                    <a class=\"clickbutton mt-40\" href=\"javascript:Composite.start(true);\" title=\"Open in a new window\">Start Developer Mode</a>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/extensions/BACKUP/compositec1/chrome/content/CompositeC1.js",
    "content": "var CompositeC1 = new function () {\r\n\t\r\n\tconst STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;\r\n\tconst STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP;\r\n\t\r\n\tvar browser = null;\r\n\tvar appwin = null;\r\n\tvar isFirstTime = true;\r\n\t\r\n\t/*\r\n\t * Compute whether or not we can hide the browser on startup. The entry in  \r\n\t * globalStorage is filed when the show-browser event is first intercepted, \r\n\t * so the browser may not be hidden on very first run. \r\n\t */\r\n\tvar sessionHost = null;\r\n\tvar uri = window.WebAppProperties.uri;\r\n\tsessionHost = uri.split ( \"//\" )[ 1 ].split ( \"/\" )[ 0 ];\r\n\tvar isBrowserHideable = window.globalStorage [ sessionHost ].isPrismBrowserHideable == \"true\";\r\n\t\r\n\t/*\r\n\t * Read the default cache setting. \r\n\t * This is most likey set to 2.\r\n\t */ \r\n\tvar prefs = Components.classes[\"@mozilla.org/preferences-service;1\"].\r\n\t\tgetService(Components.interfaces.nsIPrefBranch);\r\n\tvar defaultCache = parseInt ( prefs.getIntPref ( \"browser.cache.check_doc_frequency\" ));\r\n\t\r\n\t/*\r\n\t * Clear the cache!\r\n\t * @param {boolean} isNotify\r\n\t */\r\n\tthis.clearCache = function ( isNotify ) {\r\n\t\t\r\n\t\tvar cache = Components.classes [ \"@mozilla.org/network/cache-service;1\" ].\r\n    \tgetService(Components.interfaces.nsICacheService);\r\n\t    try {\r\n\t    \tcache.evictEntries ( Components.interfaces.nsICache.STORE_ANYWHERE );\r\n\t    \tif ( isNotify ) {\r\n\t    \t\talert ( \"The cache has been cleared.\\nPress Ctrl+R to reload.\" );\r\n\t    \t}\r\n\t    } catch ( exception ) {\r\n\t    \tif ( isNotify ) {\r\n\t    \t\talert ( \"Cache could not be cleared!\" );\r\n\t    \t}\r\n\t    }\r\n\t}\r\n\t\r\n\t/**\r\n\t * @param {Event} e\r\n\t */\r\n\tthis.handleEvent = function ( e ) {\r\n\t\r\n\t\tswitch ( e.type ) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Fires locally when the XUL main document is loaded. \r\n\t\t\t * Note the we hide the main Prism window!\r\n\t\t\t */\r\n\t\t\tcase \"load\" :\r\n\t\t\t\t\r\n\t\t\t\twindow.removeEventListener ( \"load\", this, false );\r\n\t\t\t\tbrowser = document.getElementById ( \"browser_content\" );\r\n\t\t\t\tbrowser.addProgressListener( this,\r\n\t\t\t\t\tComponents.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT\r\n\t\t\t\t);\r\n\t\t\t\tif ( isBrowserHideable == true ) {\r\n\t\t\t\t\tbrowser.style.visibility = \"hidden\";\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * The main window has been hidden to avoid the \"splash of white\" \r\n\t\t\t * on startup. This may be changed if future versions of Prism \r\n\t\t\t * standardize the splash screen...\r\n\t\t\t */\r\n\t\t\tcase \"contenttochrome-presentable\" :\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * If chaos ensues, we can kill the splash screen hack by \r\n\t\t\t\t * setting the isPrismBrowserHideable entry to \"false\". \r\n\t\t\t\t */\r\n\t\t\t\tif ( window.globalStorage [ sessionHost ].isPrismBrowserHideable == null ) {\r\n\t\t\t\t\twindow.globalStorage [ sessionHost ].isPrismBrowserHideable = \"true\";\r\n\t\t\t\t}\r\n\t\t\t\tbrowser = document.getElementById ( \"browser_content\" );\r\n\t\t\t\tif ( browser.style.visibility != \"visible\" ) {\r\n\t\t\t\t\tbrowser.style.visibility = \"visible\";\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Clear the cache. Fired by content.\r\n\t\t\t * @see {_Chrome#clearCache}\r\n\t\t\t */\r\n\t\t\tcase \"contenttochrome-clearcache\" :\r\n\t\t        this.clearCache ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * @see {CompositeC1#onLocationChange}\r\n\t */\r\n\tthis.initialize = function () {\r\n\t\t\r\n\t\tbrowser.contentWindow.addEventListener ( \"contenttochrome-presentable\", this, false );\r\n\t\tbrowser.contentWindow.addEventListener ( \"contenttochrome-clearcache\", this, false );\r\n\t}\r\n\t\r\n\t/**\r\n\t * @implements {nsIWebProgressListener} \r\n\t */\r\n\tthis.QueryInterface = function ( aIID ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tif ( aIID.equals( Components.interfaces.nsIWebProgressListener ) ||\r\n\t\t\t\taIID.equals ( Components.interfaces.nsISupportsWeakReference ) ||\r\n\t\t\t\taIID.equals ( Components.interfaces.nsISupports )) {\r\n\t\t\tresult = this;\r\n\t\t} else {\r\n\t\t\tthrow Components.results.NS_NOINTERFACE;\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/**\r\n\t * @implements {nsIWebProgressListener} \r\n\t */\r\n\tthis.onStateChange = function ( aWebProgress, aRequest, aFlag, aStatus ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * If you use myListener for more than one tab/window, use aWebProgress.DOMWindow \r\n\t\t * to obtain the tab/window which triggers the state change\r\n\t\t */\r\n\t\tif ( aFlag & STATE_START ) {\r\n\t\t\t// This fires when the load event is initiated\r\n\t\t}\r\n\t\tif ( aFlag & STATE_STOP ) {\r\n\t\t\t// This fires when the load finishes\r\n\t\t}\r\n\t\treturn 0;\r\n\t}\r\n\r\n\t/**\r\n\t * @implements {nsIWebProgressListener} \r\n\t */\r\n\tthis.onLocationChange = function ( aProgress, aRequest, aURI ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Setup content-to-chrome messaging \r\n\t\t * when the app is operational.\r\n\t\t */\r\n\t\tvar url = aURI.spec;\r\n\t\t//sessionHost = aURI.hostPort;\r\n\t\t\r\n\t\tif ( url.indexOf ( \"top.aspx\" ) >-1 || url.indexOf ( \"updated.aspx\" ) >-1 ) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * If developermode, clear the cache on first startup. \r\n\t\t\t * The cache will also be cleared on app reload.\r\n\t\t\t */\r\n\t\t\tif ( isFirstTime == true ) {\r\n\t\t\t\tif ( url.indexOf ( \"mode=develop\" ) >-1 ) {\r\n\t\t\t\t\tthis.clearCache ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.initialize ();\r\n\t\t\tisFirstTime = false;\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * This fires when the location bar changes; i.e load event is confirmed\r\n\t\t * or when the user switches tabs. If you use myListener for more than one tab/window,\r\n\t\t * use aProgress.DOMWindow to obtain the tab/window which triggered the change.\r\n\t\t */\r\n\t\treturn 0;\r\n\t}\r\n\r\n\t// For definitions of the remaining functions see XULPlanet.com\r\n\tthis.onProgressChange = function() {return 0;}\r\n\tthis.onStatusChange = function() {return 0;}\r\n\tthis.onSecurityChange = function() {return 0;}\r\n\tthis.onLinkIconAvailable = function() {return 0;}\r\n}\r\n\r\n/*\r\n * Ignite to fire onload.\r\n */\r\nwindow.addEventListener ( \"load\", CompositeC1, false );"
  },
  {
    "path": "Website/Composite/extensions/BACKUP/compositec1/chrome/content/compositec1.css",
    "content": "menuitem#menuitem_print,\r\nmenuitem#menuitem_pageSetup,\r\nmenuitem#menuitem_pageSetup + menuseparator,\r\nmenuitem#menuitem_addons,\r\nmenuitem#menuitem_addons + menuseparator {\r\n\tdisplay: none;\r\n}"
  },
  {
    "path": "Website/Composite/extensions/BACKUP/compositec1/chrome/content/compositec1.xul",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<?xml-stylesheet type=\"text/css\" href=\"compositec1.css\"?>\r\n<overlay id=\"compositec1\" xmlns=\"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\">\r\n\t<script type=\"application/javascript\" src=\"CompositeC1.js\"/>\r\n\t<menupopup id=\"popup_tools\">\r\n\t\t<menuitem insertafter=\"menuitem_console\" label=\"Clear Cache\" oncommand=\"CompositeC1.clearCache ( true )\"/>\r\n\t</menupopup>\r\n</overlay>"
  },
  {
    "path": "Website/Composite/extensions/BACKUP/compositec1/chrome.manifest",
    "content": "content\tcompositec1 chrome/content/\r\noverlay chrome://webrunner/content/webrunner.xul chrome://compositec1/content/compositec1.xul"
  },
  {
    "path": "Website/Composite/extensions/BACKUP/compositec1/compositec1.txt",
    "content": "c1@composite.net"
  },
  {
    "path": "Website/Composite/extensions/BACKUP/compositec1/install.rdf",
    "content": "<?xml version=\"1.0\"?>\r\n<RDF xmlns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\r\n\t<Description about=\"urn:mozilla:install-manifest\">\r\n\t\t<em:id>c1@composite.net</em:id>\r\n\t\t<em:version>1.0</em:version>\r\n\t\t<em:type>2</em:type>\r\n\t\t<em:targetApplication>\r\n\t\t\t<Description>\r\n\t\t\t\t<em:id>prism@developer.mozilla.org</em:id>\r\n\t\t\t\t<em:minVersion>0.8</em:minVersion>\r\n\t\t\t\t<em:maxVersion>1.0.0.*</em:maxVersion>\r\n\t\t\t</Description>\r\n\t\t</em:targetApplication>\r\n\t\t<em:name>Composite C1 for Prism</em:name>\r\n\t\t<em:description>Manages C1 cache settings.</em:description>\r\n\t\t<em:creator>Composite</em:creator>\r\n\t\t<em:homepageURL>http://www.composite.net/</em:homepageURL>\r\n\t</Description>\r\n</RDF>"
  },
  {
    "path": "Website/Composite/extensions/compositec1/chrome/content/CompositeC1.js",
    "content": "var CompositeC1 = new function () {\r\n\t\r\n\tconst STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;\r\n\tconst STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP;\r\n\t\r\n\tvar browser = null;\r\n\tvar isFirstTime = true;\r\n\t\r\n\tvar prefs = Components.classes[\"@mozilla.org/preferences-service;1\"].\r\n\t\tgetService(Components.interfaces.nsIPrefBranch);\r\n\t\r\n\t/**\r\n\t * Wipe all cache.\r\n\t * @param {boolean} isNotify\r\n\t */\r\n\tthis.clearCache = function ( isNotify ) {\r\n\t\t\r\n\t\tvar cache = Components.classes [ \"@mozilla.org/network/cache-service;1\" ].\r\n    \tgetService(Components.interfaces.nsICacheService);\r\n\t    try {\r\n\t    \tcache.evictEntries ( Components.interfaces.nsICache.STORE_ANYWHERE );\r\n\t    \tif ( isNotify ) {\r\n\t    \t\talert ( \"Cache has been cleared.\" );\r\n\t    \t}\r\n\t    } catch ( exception ) {\r\n\t    \tif ( isNotify ) {\r\n\t    \t\talert ( \"Cache could not be cleared!\" );\r\n\t    \t}\r\n\t    }\r\n\t}\r\n\t\r\n\t/**\r\n\t * Enable or disable all sorts of cache.\r\n\t * @param {boolean} hasCache\r\n\t */\r\n\tthis._enableCache = function ( hasCache ) {\r\n\t\t\r\n\t\tprefs.setBoolPref ( \"browser.cache.disk.enable\", hasCache );\r\n\t\tprefs.setBoolPref ( \"browser.cache.memory.enable\", hasCache );\r\n\t\tprefs.setIntPref ( \"browser.cache.check_doc_frequency\", hasCache ? 3 : 1 );\r\n\t}\r\n\t\r\n\t/**\r\n\t * @param {Event} e\r\n\t */\r\n\tthis.handleEvent = function ( e ) {\r\n\t\r\n\t\tswitch ( e.type ) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Fires locally when the XUL main document is loaded. \r\n\t\t\t * Note the we hide the main Prism window!\r\n\t\t\t */\r\n\t\t\tcase \"load\" :\r\n\t\t\t\t\r\n\t\t\t\twindow.removeEventListener ( \"load\", this, false );\r\n\t\t\t\tbrowser = document.getElementById ( \"browser_content\" );\r\n\t\t\t\tbrowser.addProgressListener( this,\r\n\t\t\t\t\tComponents.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Clear the cache. Fired by content.\r\n\t\t\t * @see {_Prism#clearCache}\r\n\t\t\t */\r\n\t\t\tcase \"contenttochrome-clearcache\" :\r\n\t\t        this.clearCache ();\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase \"contenttochrome-cache-enable\" :\r\n\t\t\t\tthis._enableCache ( true );\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase \"contenttochrome-cache-disable\" :\r\n\t\t\t\tthis._enableCache ( false );\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * @see {CompositeC1#onLocationChange}\r\n\t */\r\n\tthis.initialize = function () {\r\n\t\t\r\n\t\tbrowser.contentWindow.addEventListener ( \"contenttochrome-clearcache\", this, false );\r\n\t\tbrowser.contentWindow.addEventListener ( \"contenttochrome-cache-enable\", this, false );\r\n\t\tbrowser.contentWindow.addEventListener ( \"contenttochrome-cache-disable\", this, false );\r\n\t}\r\n\t\r\n\t/**\r\n\t * @implements {nsIWebProgressListener} \r\n\t */\r\n\tthis.QueryInterface = function ( aIID ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tif ( aIID.equals( Components.interfaces.nsIWebProgressListener ) ||\r\n\t\t\t\taIID.equals ( Components.interfaces.nsISupportsWeakReference ) ||\r\n\t\t\t\taIID.equals ( Components.interfaces.nsISupports )) {\r\n\t\t\tresult = this;\r\n\t\t} else {\r\n\t\t\tthrow Components.results.NS_NOINTERFACE;\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/**\r\n\t * @implements {nsIWebProgressListener} \r\n\t */\r\n\tthis.onStateChange = function ( aWebProgress, aRequest, aFlag, aStatus ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * If you use myListener for more than one tab/window, use aWebProgress.DOMWindow \r\n\t\t * to obtain the tab/window which triggers the state change\r\n\t\t */\r\n\t\tif ( aFlag & STATE_START ) {\r\n\t\t\t// This fires when the load event is initiated\r\n\t\t}\r\n\t\tif ( aFlag & STATE_STOP ) {\r\n\t\t\t// This fires when the load finishes\r\n\t\t}\r\n\t\treturn 0;\r\n\t}\r\n\r\n\t/**\r\n\t * @implements {nsIWebProgressListener} \r\n\t */\r\n\tthis.onLocationChange = function ( aProgress, aRequest, aURI ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Setup content-to-chrome messaging when the app is operational.\r\n\t\t */\r\n\t\tvar url = aURI.spec;\r\n\t\t//sessionHost = aURI.hostPort;\r\n\t\t\r\n\t\tif ( url.indexOf ( \"top.aspx\" ) >-1 || url.indexOf ( \"updated.aspx\" ) >-1 ) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * If developermode, clear the cache on first startup. \r\n\t\t\t * The cache will also be cleared on app reload.\r\n\t\t\t */\r\n\t\t\tif ( isFirstTime == true ) {\r\n\t\t\t\tif ( url.indexOf ( \"mode=develop\" ) >-1 ) {\r\n\t\t\t\t\tthis.clearCache ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.initialize ();\r\n\t\t\tisFirstTime = false;\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * This fires when the location bar changes; i.e load event is confirmed\r\n\t\t * or when the user switches tabs. If you use myListener for more than one tab/window,\r\n\t\t * use aProgress.DOMWindow to obtain the tab/window which triggered the change.\r\n\t\t */\r\n\t\treturn 0;\r\n\t}\r\n\r\n\t// For definitions of the remaining functions see XULPlanet.com\r\n\tthis.onProgressChange = function() { return 0; }\r\n\tthis.onStatusChange = function() { return 0; }\r\n\tthis.onSecurityChange = function() { return 0; }\r\n\tthis.onLinkIconAvailable = function() { return 0; }\r\n\t\r\n\t/*\r\n\t * On startup, enable memory and disk cache. Note that an XUL overlay \r\n\t * has equipped the statusbar menu with an option to clear the cache.\r\n\t */\r\n\tthis._enableCache ( true );\r\n}\r\n\r\n/*\r\n * Ignite to fire onload.\r\n */\r\nwindow.addEventListener ( \"load\", CompositeC1, false );"
  },
  {
    "path": "Website/Composite/extensions/compositec1/chrome/content/compositec1.css",
    "content": "menuitem#menuitem_print,\r\nmenuitem#menuitem_pageSetup,\r\nmenuitem#menuitem_pageSetup + menuseparator {\r\n\tdisplay: none;\r\n}"
  },
  {
    "path": "Website/Composite/extensions/compositec1/chrome/content/compositec1.xul",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<?xml-stylesheet type=\"text/css\" href=\"compositec1.css\"?>\r\n<overlay id=\"compositec1\" xmlns=\"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\">\r\n\t<script type=\"application/javascript\" src=\"CompositeC1.js\"/>\r\n\t<menupopup id=\"popup_tools\">\r\n\t\t<menuitem insertafter=\"menuitem_console\" label=\"Clear Cache\" oncommand=\"CompositeC1.clearCache(true);\"/>\r\n\t</menupopup>\r\n</overlay>"
  },
  {
    "path": "Website/Composite/extensions/compositec1/chrome.manifest",
    "content": "content\tcompositec1 chrome/content/\r\noverlay chrome://webrunner/content/webrunner.xul chrome://compositec1/content/compositec1.xul"
  },
  {
    "path": "Website/Composite/extensions/compositec1/install.rdf",
    "content": "<?xml version=\"1.0\"?>\r\n<RDF xmlns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\r\n\t<Description about=\"urn:mozilla:install-manifest\">\r\n\t\t<em:id>c1@composite.net</em:id>\r\n\t\t<em:version>1.0</em:version>\r\n\t\t<em:type>2</em:type>\r\n\t\t<em:targetApplication>\r\n\t\t\t<Description>\r\n\t\t\t\t<em:id>prism@developer.mozilla.org</em:id>\r\n\t\t\t\t<em:minVersion>0.8</em:minVersion>\r\n\t\t\t\t<em:maxVersion>1.0.0.*</em:maxVersion>\r\n\t\t\t</Description>\r\n\t\t</em:targetApplication>\r\n\t\t<em:name>Composite C1</em:name>\r\n\t\t<em:description>Manages C1 cache settings.</em:description>\r\n\t\t<em:creator>Composite</em:creator>\r\n\t\t<em:homepageURL>http://www.composite.net/</em:homepageURL>\r\n\t</Description>\r\n</RDF>"
  },
  {
    "path": "Website/Composite/favicon.inc",
    "content": "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"images/branding/favicon.ico\" />"
  },
  {
    "path": "Website/Composite/grunt.html",
    "content": "﻿<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n    <title>Setting up GRUNT with Visual Studio</title>\r\n    <style type=\"text/css\">\r\n        body, html {\r\n            height: 100%;\r\n            background: #ececec;\r\n            font-size: 16px;\r\n            font-family: Arial, sans-serif;\r\n            line-height: 1.4;\r\n        }\r\n\r\n        .container {\r\n            width: 900px;\r\n            margin: 5% auto;\r\n            border: solid 1px #ccc;\r\n            background: #fff;\r\n            padding: 30px;\r\n        }\r\n\r\n        ol li {\r\n            margin-bottom: 20px;\r\n        }\r\n\r\n        .command {\r\n            background: #000;\r\n            color: #fff;\r\n            padding: 3px 5px;\r\n            width: 300px;\r\n            font-size: 14px;\r\n        }\r\n\r\n        .small {\r\n            font-size: 80%;\r\n            margin-top: 5px;\r\n        }\r\n    </style>\r\n</head>\r\n<body>\r\n    <div class=\"container\">\r\n        <h1>Setting up Grunt with Visual Studio 2015</h1>\r\n        <ol>\r\n            <li>You need to install <strong>Node.JS</strong> which you can get from here <a href=\"https://nodejs.org/en/download/\">https://nodejs.org/en/download/</a></li>\r\n            <li>\r\n                You need to install Grunt globally which you do by running this command\r\n                <p class=\"command\">npm install -g grunt-cli</p>\r\n                <p class=\"small\">\r\n                    You can do that on your command shell as Administrator (for Windows).\r\n                    For more details read here - <a href=\"http://gruntjs.com/getting-started\">http://gruntjs.com/getting-started</a>\r\n                </p>\r\n            </li>\r\n            <li>\r\n                Open <strong>CompositeC1</strong> solution in Visual Studio.\r\n                <p class=\"small\">\r\n                    The <strong>Website</strong> project contains NPM configuration file, called <code>package.json</code> and Grunt configuration file, called <code>gruntfile.js</code>.\r\n                    When you open a project with a <code>package.json</code> in Visual Studio 2015, an NPM installs packages automatically into the project folder <code>node_modules</code>.\r\n                </p>\r\n            </li>\r\n            <li>\r\n                On the <strong>Website</strong> project locate the file <code>gruntfile.js</code>, right click and select <code>Task Runner Explorer</code>.\r\n                <p class=\"small\">On \"Task Runner Explorer\" window you will see the list of <code>Grunt</code> tasks, like <code>less, mergeSvg, uglifyCompileScripts ...</code></p>\r\n            </li>\r\n            <li>On \"Task Runner Explorer\" window run <strong><code>build</code></strong> task.</li>\r\n            <li>\r\n                <strong>You are done</strong>\r\n                <p>\r\n                    <a href=\"top.aspx\">Start console</a> and press F5 in your Browser.\r\n                </p>\r\n            </li>\r\n\r\n        </ol>\r\n    </div>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/grunt.inc",
    "content": "<div style=\"margin: 10% auto; width: 500px; text-align: center;\">\r\n  <h1>\r\n    CSS files not compiled\r\n  </h1>\r\n  <p>\r\n    You are probably seeing this because CSS has not been compiled – please <a href=\"grunt.html\">read here</a> how to compile.\r\n  </p>\r\n</div>\r\n"
  },
  {
    "path": "Website/Composite/help/help.ashx",
    "content": "<%@ WebHandler Language=\"C#\" Class=\"HelpHandler\" %>\r\n\r\nusing System;\r\nusing System.IO;\r\nusing System.Configuration;\r\nusing System.Text;\r\nusing System.Net;\r\nusing System.Xml.Linq;\r\nusing System.Web;\r\nusing System.Xml;\r\nusing System.Xml.Xsl;\r\nusing System.Xml.XPath;\r\nusing System.Web.Configuration;\r\nusing Composite;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient;\r\n\r\n\r\npublic class HelpHandler : IHttpHandler \r\n{\r\n    public void ProcessRequest (HttpContext context) \r\n    {\r\n        ResponseContent responseContent = RequestHelpPage(context);\r\n\r\n        context.Response.ContentType = responseContent.ContentType;\r\n        context.Response.Write(responseContent.Content);\r\n    }\r\n\r\n\r\n\r\n    private ResponseContent RequestHelpPage(HttpContext context)\r\n    {\r\n        string sourceUriString = BuildHelpServerUrl(context);\r\n        Uri sourceUri = new Uri(sourceUriString);\r\n\r\n        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(sourceUri);\r\n        request.UserAgent = context.Request.Headers[\"User-Agent\"];\r\n        request.Timeout = 2000;\r\n\r\n        WebResponse webResponse = request.GetResponse();\r\n\r\n        using (Stream responseStream = webResponse.GetResponseStream())\r\n        {\r\n            using(C1StreamReader sr = new C1StreamReader(responseStream))\r\n            {\r\n                return new ResponseContent { Content = sr.ReadToEnd(), ContentType = webResponse.ContentType };\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n\r\n    private string BuildHelpServerUrl(HttpContext context)\r\n    {\r\n        string baseUriString = ConfigurationManager.AppSettings[\"Composite.Help.Contents.Url\"];\r\n        string contentRequestId = (context.Request.QueryString[\"id\"].IsNullOrEmpty() ? \"Composite.Help.Contents.Url\" : context.Request.QueryString[\"id\"]);\r\n        bool isDeepContentRequest = true;\r\n\r\n        switch (contentRequestId)\r\n        {\r\n            case \"Composite.Help.Contents.Url\":\r\n                isDeepContentRequest = false;\r\n                break;\r\n            case \"Composite.Help.Bookmarks.Url\":\r\n                baseUriString = ConfigurationManager.AppSettings[\"Composite.Help.Bookmarks.Url\"];\r\n                isDeepContentRequest = false;\r\n                break;\r\n            case \"Composite.Help.Search.Url\":\r\n                baseUriString = ConfigurationManager.AppSettings[\"Composite.Help.Search.Url\"];\r\n                isDeepContentRequest = false;\r\n                break;\r\n            case \"Composite.Help.Index.Url\":\r\n                baseUriString = ConfigurationManager.AppSettings[\"Composite.Help.Index.Url\"];\r\n                isDeepContentRequest = false;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n\r\n        if (isDeepContentRequest)\r\n        {\r\n            Uri helpPageUri = new Uri(baseUriString);\r\n            baseUriString = string.Format(\"{0}://{1}/{2}\", helpPageUri.Scheme, helpPageUri.Host, context.Request.QueryString[\"id\"]);\r\n        }\r\n\r\n        string userCultureName = Composite.C1Console.Users.UserSettings.CultureInfo.Name;\r\n        string productVersion = RuntimeInformation.ProductVersion.ToString(4);\r\n        string installationId = InstallationInformationFacade.InstallationId.ToString();\r\n        string browser = context.Request.UserAgent.IndexOf(\"Gecko\") > -1 ? \"mozilla\" : \"explorer\";\r\n        string platform = context.Request.Browser.Platform;\r\n\r\n        string sourceUriString = string.Format(\"{0}?culture={1}&version={2}&installation={3}&browser={4}&platform={5}\",\r\n            baseUriString,\r\n\t\t\tHttpUtility.UrlEncode(userCultureName, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(productVersion, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(installationId, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(browser, Encoding.UTF8),\r\n\t\t\tHttpUtility.UrlEncode(platform, Encoding.UTF8));\r\n\r\n        return sourceUriString;\r\n    }\r\n    \r\n \r\n    public bool IsReusable \r\n    {\r\n        get \r\n        {\r\n            return false;\r\n        }\r\n    }\r\n\r\n\r\n    private class ResponseContent\r\n    {\r\n        public string Content { get; set; }\r\n        public string ContentType { get; set; }\r\n    }\r\n\r\n}"
  },
  {
    "path": "Website/Composite/help/help.css",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nhtml,\r\nbody {\r\n\t/*background-color: #F8F8F5 !important;*/\r\n\tbackground-color: white !important;\r\n\tcolor: black;\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\tborder: none;\r\n\theight: 100%;\r\n}\r\nbody {\r\n\tpadding: 22px 16px 22px 18px;\r\n\toverflow: auto;\r\n\tline-height: 1.3em;\r\n\t#region default\r\n\t \tfont-family: Tahoma, sans-serif;\r\n\t \tfont-size: 11px;\r\n\t \tfont-size: 13px;\r\n\t#endregion\r\n\t#region vista\r\n\t \tfont-family: \"Segoe UI\", Tahoma, sans-serif;\r\n \t\tfont-size: 12px;\r\n \t\tfont-size: 13px;\r\n\t#endregion\r\n\t#region osx\r\n\t \tfont-family: \"Lucida Grande\", sans-serif;\r\n \t\tfont-size: 11px;\r\n \t\tfont-size: 12px;\r\n\t#endregion\r\n\t\r\n}\r\na {\r\n\tcursor: pointer;\r\n\tcolor: blue;\r\n}\r\na:hover {\r\n\ttext-decoration: underline !important;\r\n}\r\np,\r\nul,\r\nol {\r\n\tmargin-top: 0;\r\n\tmargin-bottom: 1.3em;\t\r\n}\r\nh1 {\r\n\tfont-size: 140%;\r\n\tpadding: 0;\r\n\tmargin: 0 0 20px 0;\r\n}\r\nh4 {\r\n\tfont-size: 100%;\r\n\tmargin: 1.3em 0 0 0;\r\n}\r\nh4:first-child {\r\n\tmargin-top: 0;\t\r\n}\r\ndiv.links {\r\n\tmargin-top: 3.9em;\r\n}\r\nli {\r\n\tmargin-left: 1.4em;\t\r\n}\r\nul.nl {\r\n\tmargin: 0 0 1.3em -1.4em;\r\n\t-moz-user-select: none;\r\n}\r\nul.nl ul {\r\n\tmargin-left: 0em;\r\n\tmargin-bottom: 0;\r\n}\r\nul.nl,\r\nul.nl ul {\r\n\tpadding: 0;\r\n\tlist-style: none;\r\n}\r\nul.nl a {\r\n\ttext-decoration: none;\r\n\tpadding-left: 16px;\r\n}\r\nul.nl a.label {\r\n\tcolor: black;\r\n\tbackground-image: url(\"content/_images/navlist-plus.png\");\r\n\tbackground-repeat: no-repeat;\r\n\tbackground-position: 0 4px;\r\n\t#region vista\r\n\t\tbackground-position: 0 5px;\r\n\t#endregion\r\n}\r\nul.nl a:focus {\r\n\t-moz-outline: none;\r\n\ttext-decoration: underline;\r\n}\r\nul.nl a.on {\r\n\tbackground-image: url(\"content/_images/navlist-minus.png\");\t\r\n}\r\nul.nl ul {\r\n\tdisplay: none;\t\r\n}\r\nul.nl ul.on {\r\n\tdisplay: block;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/* TREES */\r\n\r\n\r\n/*\r\nui|tree {\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\twidth: 100%;\r\n\toverflow: hidden;\r\n\tposition: relative;\r\n}\r\nui|tree,\r\nui|treebody {\r\n\theight: auto !important;\r\n\twidth: auto;\r\n}\r\nui|tree {\r\n\tmargin-bottom: 1.3em;\t\r\n\tmargin-top: 1.3em;\r\n}\r\nui|treebody {\r\n\tbackground-color: transparent;\r\n\tpadding: 0;\r\n\toverflow: hidden !important;\r\n}\r\nui|treenode a {\r\n\tcolor: #222222;\r\n}\r\nui|treenode a:hover ui|labeltext {\r\n\tcolor: blue !important;\r\n\ttext-decoration: underline;\r\n}\r\nui|treenode a * {\r\n\t#moz cursor: pointer !important;\r\n\t#ie cursor: hand !important;\t\r\n}\r\nui|tree.focused ui|treenode a ui|labelbox.focused ui|labeltext {\r\n\tcolor: white !important;\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/help/help.js",
    "content": "var Help = new function () {\r\n\t\r\n\t/**\r\n\t * Initialize.\r\n\t */\r\n\tthis.initialize = function () {\r\n\t\t\r\n\t\t/*\r\n\t\t * Handle navigationlists.\r\n\t\t */\r\n\t\tvar i = 0, ul, uls = document.getElementsByTagName ( \"ul\" );\r\n\t\twhile ( ul = uls.item ( i++ )) {\r\n\t\t\tif ( ul.className.indexOf ( \"nl\" ) >-1 ) {\r\n\t\t\t\tnavigationlist ( ul );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Applied to navigationlist links as event handler.\r\n\t * @param {MouseEvent} e\r\n\t */\r\n\tfunction navigationlistaction ( e ) {\r\n\t\t\r\n\t\tvar isValid = true;\r\n\t\te = e ? e : window.event; \r\n\t\tif ( e.type == \"keydown\" && e.keyCode != 13 ) {\r\n\t\t\tisValid = false;\r\n\t\t}\r\n\t\tif ( isValid ) {\r\n\t\t\tvar a = e.target ? e.target : e.srcElement;\r\n\t\t\tif ( a.nodeName.toLowerCase () == \"a\" ) {\r\n\t\t\t\tvar ul = a.parentNode.getElementsByTagName ( \"ul\" ).item ( 0 );\r\n\t\t\t\tif ( ul ) {\r\n\t\t\t\t\tswitch ( a.className ) {\r\n\t\t\t\t\t\tcase \"label\" :\r\n\t\t\t\t\t\t\ta.className = \"label on\";\r\n\t\t\t\t\t\t\tul.className = \"on\";\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"label on\" :\r\n\t\t\t\t\t\t\ta.className = \"label\";\r\n\t\t\t\t\t\t\tul.className = \"\";\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( e.stopPropagation ) {\r\n\t\t\te.stopPropagation ();\r\n\t\t} else {\r\n\t\t\te.cancelBubble = true;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Convert list to navigationlist.\r\n\t * @param {HTMLUListElement}\r\n\t */\r\n\tfunction navigationlist ( ul ) {\r\n\t\t\r\n\t\tul.onmousedown = navigationlistaction;\r\n\t\tul.onkeydown = navigationlistaction;\r\n\t}\r\n\t\r\n}\r\n\r\n/*\r\n * Initialize onload.\r\n */\r\nwindow.onload = Help.initialize;"
  },
  {
    "path": "Website/Composite/help/help.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\"\r\n\txmlns=\"http://www.w3.org/1999/xhtml\" \r\n\txmlns:x2=\"http://www.w3.org/2002/06/xhtml2\"\r\n\texclude-result-prefixes=\"x2\">\r\n\t\r\n\t<xsl:template match=\"comment()\"/>\r\n\t\r\n\t<xsl:template match=\"@*|*\">\r\n\t\t<xsl:copy>\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t</xsl:copy>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"*\">\r\n\t\t<xsl:element name=\"{name()}\">\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t\t<xsl:variable name=\"name\" select=\"local-name()\"/>\r\n\t\t\t<xsl:if test=\"$name='script' or $name='div' or $name='textarea' or $name='a'\">\r\n\t\t\t\t<xsl:call-template name=\"uncollapse\"/>\r\n\t\t\t</xsl:if>\r\n\t\t</xsl:element>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"x2:html\">\r\n\t\t<html>\r\n\t\t\t<head>\r\n\t\t\t\t<title>\r\n\t\t\t\t\t<xsl:value-of select=\"x2:head/x2:title\"/>\r\n\t\t\t\t</title>\r\n\t\t\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"help.css.aspx\"/>\r\n\t\t\t\t<script type=\"text/javascript\" src=\"help.js\">\r\n\t\t\t\t\t<xsl:call-template name=\"uncollapse\"/>\r\n\t\t\t\t</script>\r\n\t\t\t\t<xsl:apply-templates select=\"x2:head[not(x2:title)]\"/>\r\n\t\t\t</head>\r\n\t\t\t<body>\r\n\t\t\t\t<xsl:apply-templates select=\"x2:body/*\"/>\r\n\t\t\t</body>\r\n\t\t</html>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"x2:section\">\r\n\t\t<div class=\"section\">\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t</div>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- \r\n\t<xsl:template match=\"x2:section[last()]\">\r\n\t\t<div class=\"section\">\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t</div>\r\n\t</xsl:template>\r\n\t-->\r\n\t\r\n\t<!-- matching both a and li tags! -->\r\n\t<xsl:template match=\"@href\">\r\n\t\t<xsl:attribute name=\"href\">\r\n\t\t\t<xsl:choose>\r\n\t\t\t\t<xsl:when test=\"contains(.,':')\">\r\n\t\t\t\t\t<xsl:value-of select=\".\"/>\r\n\t\t\t\t</xsl:when>\r\n\t\t\t\t<xsl:otherwise>\r\n\t\t\t\t\t<xsl:text>?id=</xsl:text>\r\n\t\t\t\t\t<xsl:value-of select=\".\"/>\r\n\t\t\t\t</xsl:otherwise>\r\n\t\t\t</xsl:choose>\r\n\t\t</xsl:attribute>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"x2:h\">\r\n\t\t<h1>\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t</h1>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"x2:section/x2:h\">\r\n\t\t<h4>\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t</h4>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"x2:nl\">\r\n\t\t<ul class=\"nl\">\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t</ul>\r\n\t</xsl:template>\r\n\t\r\n\t<!--  \r\n\t<xsl:template match=\"x2:nl/x2:label\">\r\n\t\t<li class=\"label\">\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t</li>\r\n\t</xsl:template>\r\n\t-->\r\n\t\r\n\t<xsl:template match=\"x2:nl/x2:label\"/>\r\n\t\r\n\t<xsl:template match=\"x2:nl/x2:li\">\r\n\t\t<li>\r\n\t\t\t<xsl:choose>\r\n\t\t\t\t<xsl:when test=\"@href\">\r\n\t\t\t\t\t<a>\r\n\t\t\t\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t\t\t\t</a>\r\n\t\t\t\t</xsl:when>\r\n\t\t\t\t<xsl:otherwise>\r\n\t\t\t\t\t<xsl:apply-templates select=\"*|@*|text()\" />\r\n\t\t\t\t</xsl:otherwise>\r\n\t\t\t</xsl:choose>\r\n\t\t</li>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"x2:nl/x2:li[x2:nl/x2:label]\">\r\n\t\t<li>\r\n\t\t\t<a class=\"label\" href=\"javascript:void(false)\">\r\n\t\t\t\t<xsl:value-of select=\"x2:nl/x2:label\"/>\r\n\t\t\t</a>\r\n\t\t\t<xsl:apply-templates select=\"x2:nl\"/>\r\n\t\t</li>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- image objects -->\r\n\t<xsl:template match=\"x2:object[@type='image/png' or @type='image/gif' or @type='image/jpg' or @type='image/jpeg' or @type='image/bmp' or @type='image/tiff']\">\r\n\t\t<xsl:variable name=\"url\">\r\n\t\t\t<xsl:text>content/</xsl:text>\r\n\t\t\t<xsl:value-of select=\"@data\"/>\r\n\t\t</xsl:variable>\r\n\t\t<xsl:variable name=\"alt\" select=\".\"/>\r\n\t\t<img src=\"{$url}\" alt=\"{$alt}\">\r\n\t\t\t<xsl:choose>\r\n\t\t\t\t<xsl:when test=\"@title\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"@title\"/>\r\n\t\t\t\t</xsl:when>\r\n\t\t\t\t<xsl:otherwise>\r\n\t\t\t\t\t<xsl:attribute name=\"title\"/>\r\n\t\t\t\t</xsl:otherwise>\r\n\t\t\t</xsl:choose>\r\n\t\t\t<xsl:apply-templates select=\"@*[name()!='data' and name()!='type']\"/>\r\n\t\t</img>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template name=\"uncollapse\">\r\n\t\t<xsl:value-of select=\"./@ensureUncollapse\" />\r\n\t</xsl:template>\r\n\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/images/loading.svg.ashx",
    "content": "﻿<%@ WebHandler Language=\"C#\" Class=\"loading\" %>\r\n\r\nusing System;\r\nusing System.Web;\r\n\r\npublic class loading : IHttpHandler {\r\n    \r\n    public void ProcessRequest (HttpContext context) {\r\n        TimeSpan cacheDuration = TimeSpan.FromDays(7);\r\n        \r\n        context.Response.Cache.SetCacheability(HttpCacheability.Private);\r\n        context.Response.Cache.SetExpires(DateTime.Now.Add(cacheDuration));\r\n        context.Response.Cache.SetMaxAge(cacheDuration);\r\n        context.Response.CacheControl = HttpCacheability.Private.ToString();\r\n        context.Response.Cache.SetValidUntilExpires(true);\r\n\r\n        HttpBrowserCapabilities browser = context.Request.Browser;\r\n\r\n\t\tif (browser.Browser == \"IE\" || browser.Browser == \"InternetExplorer\" || context.Request.UserAgent.IndexOf(\"Edge\") > -1) // IE or Microsoft Edge\r\n        {\r\n            context.Response.ContentType = \"image/gif\";\r\n            context.Response.WriteFile(context.Request.MapPath(\"loading.gif\"));\r\n        }\r\n        else\r\n        {\r\n            context.Response.ContentType = \"image/svg+xml\";\r\n            context.Response.WriteFile(context.Request.MapPath(\"loading.svg\"));\r\n        }\r\n    }\r\n \r\n    public bool IsReusable {\r\n        get {\r\n            return false;\r\n        }\r\n    }\r\n\r\n}"
  },
  {
    "path": "Website/Composite/localization/Composite.C1Console.SecurityViolation.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"LayoutLabel\" value=\"Security violation\" />\r\n\t<string key=\"Title\" value=\"Not allowed\" />\r\n\t<string key=\"Description\" value=\"You do not have permission to execute the action. Contact your administrator for more information.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.C1Console.Trees.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"KeyFacade.ErrorTreeNode.Label\" value=\"Error in tree\" />\r\n  <string key=\"KeyFacade.ErrorTreeNode.ShowMessage.Label\" value=\"Show Message\" />\r\n  <string key=\"KeyFacade.ErrorTreeNode.ShowMessage.ToolTip\" value=\"Show Error Message\" />\r\n  <string key=\"KeyFacade.ErrorTreeNode.ShowMessage.Title\" value=\"Error message\" />\r\n  \r\n  <!-- Validation -->\r\n  <string key=\"TreeValidationError.Common.UnknownException\" value=\"Unknown exception happened: '{0}'\" />\r\n  <string key=\"TreeValidationError.Common.UnknownElement\" value=\"Unknown element '{0}'\" />\r\n  <string key=\"TreeValidationError.Common.MissingAttribute\" value=\"The required attribute '{0}' is missing\" />\r\n  <string key=\"TreeValidationError.Common.WrongAttributeValue\" value=\"The attribute '{0}' has a value that is not allowed\" />  \r\n  <string key=\"TreeValidationError.Common.MissingProperty\" value=\"The type '{0}' does not contain a property named '{1}'\" />\r\n  <string key=\"TreeValidationError.Common.UnknownInterfaceType\" value=\"The type '{0}' could not be found\" />\r\n  <string key=\"TreeValidationError.Common.NotImplementingIData\" value=\"The type '{0}' does not implement the interface '{1}'\" />\r\n  <string key=\"TreeValidationError.Common.WrongPermissionValue\" value=\"The value '{0}' is not allowed as a permission type value\" />\r\n  <string key=\"TreeValidationError.Common.WrongLocationValue\" value=\"The value '{0}' is not allowed as a location value\" />\r\n  <string key=\"TreeValidationError.Common.MissingFunctionMarkup\" value=\"No function markup provided as a child element\" />\r\n  <string key=\"TreeValidationError.Common.WrongFunctionMarkup\" value=\"The function could not be created for the provided function markup\" />\r\n\r\n  <string key=\"TreeValidationError.Markup.NoRootElement\" value=\"Missing root element in tree markup\" />\r\n  <string key=\"TreeValidationError.Markup.SchemaError\" value=\"Syntax error: {0} at line {1} position {2}\" />\r\n  \r\n  <string key=\"TreeValidationError.AutoAttachments.UnknownAttachmentPoint\" value=\"The attachment point '{0}' is unknown\" />\r\n  <string key=\"TreeValidationError.AutoAttachments.UnknownAttachmentPosition\" value=\"The attachment position '{0}' is unknown\" />\r\n  <string key=\"TreeValidationError.DataAttachments.NoElementsAllowed\" value=\"No elements are allowed in trees that are used with data attached trees\" />\r\n\r\n  <string key=\"TreeValidationError.ElementRoot.ShareRootElementByIdNotAllowed\" value=\"ShareRootElementById is only allowed if the tree has a single named attachment point\" />\r\n\r\n  <string key=\"TreeValidationError.SimpleElement.WrongIdValue\" value=\"The value of the Id is not allowed. The Id should be non-empty, not start with NodeAutoId_ and not be RootTreeNode\" />\r\n  <string key=\"TreeValidationError.SimpleElement.AlreadyUsedId\" value=\"The id value '{0}' has already been used in this tree\" />\r\n\r\n  <string key=\"TreeValidationError.DataElementsTreeNode.SameInterfaceUsedTwice\" value=\"The data interface '{0}' is used more than once as a child under the same parent element and this is not allowed\" />\r\n  <string key=\"TreeValidationError.DataElementsTreeNode.SameParentFilterInterfaceUsedTwice\" value=\"The same interface '{0}' is used as parent type as parent filter and this is not allowed\" />\r\n  <string key=\"TreeValidationError.DataElementsTreeNode.MoreThanOnParentFilterIsPointingToMe\" value=\"More than one parent filter is pointing to the interface '{0}'. Change the Display value to Lazy\" />\r\n\r\n  <string key=\"TreeValidationError.DataFolderElements.MissingInterfaceType\" value=\"Type attribute is missing\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.WrongInterfaceType\" value=\"The interface type '{0}' does not match the parent elements interface type '{1}'\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.DateFormetNotAllowed\" value=\"DateFormat attribute requires that the property '{0}' should be of type '{1}' but is type '{2}'\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.DateFormetIsMissing\" value=\"The property '{0}' is of type Date and this requires the DateFormat attribute to be present\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.RangesAndFirstLetterOnlyNotAllowed\" value=\"Ranges and first-letter-only not allowed at the same time\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.WrongFirstLetterOnlyPropertyType\" value=\"First-letter-only requires that the property '{0}' should be of type '{1}' but is type '{2}'\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.WrongDateChildInterfaceType\" value=\"Only data child elements with the same interface type as the folder grouping ('{0}') are allowed\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.InterfaceTypeSwitchNotAllowed\" value=\"Switching from the interface type '{0}' to a different interface type '{1}' is not allowed in the same folder grouping group\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.SameFieldUsedTwice\" value=\"Using the field name '{0}' twice in the same grouping tree is not allowed\" />\r\n  <string key=\"TreeValidationError.DataFolderElements.TooManyParentIdFilters\" value=\"Maximum one parent id filter node can be used on data elements used in groupings\" />\r\n\r\n  <string key=\"TreeValidationError.ParentIdFilterNode.TypeIsNotInParentTree\" value=\"The type '{0}' is not in the parent tree of this node or specified as an attachment points type\" />\r\n  <string key=\"TreeValidationError.FieldFilter.UnknownOperatorName\" value=\"The operator '{0}' is unknown or not supported\" />\r\n  <string key=\"TreeValidationError.FieldFilter.ValueCouldNotBeConverted\" value=\"The string value '{0}' could not be converted to the type '{1}'\" />\r\n  <string key=\"TreeValidationError.FieldFilter.OperatorNotSupportedForType\" value=\"The operator '{0}' is not supported for the type '{1}'\" />\r\n\r\n  <string key=\"TreeValidationError.FunctionFilter.MissingFunctionMarkup\" value=\"Function markup is missing\" />\r\n  <string key=\"TreeValidationError.FunctionFilter.WrongFunctionMarkup\" value=\"The function could not be created for the provided function markup\" />\r\n  <string key=\"TreeValidationError.FunctionFilter.WrongReturnValue\" value=\"The function does not return value of the type '{0}'\" />\r\n  <string key=\"TreeValidationError.FunctionFilter.WrongFunctionReturnType\" value=\"The return type of the expression returned by the function is '{0}', '{1}' was expected\" />\r\n  <string key=\"TreeValidationError.FunctionFilter.WrongFunctionParameterCount\" value=\"The parameter count of expression returned by the function is '{0}', 1 was expected\" />\r\n  <string key=\"TreeValidationError.FunctionFilter.WrongFunctionParameterType\" value=\"The expressions parameter type returned by the function is '{0}', '{1}' was expected\" />\r\n\r\n\t<string key=\"TreeValidationError.CustomFormMarkup.MissingFile\" value=\"The file '{0}' does not exist\" />\r\n\t<string key=\"TreeValidationError.CustomFormMarkup.BadMarkupPath\" value=\"The custom markup path '{0}' is wrongly formatted. Use ~/Dir1/Dir2/File.xml\" />\r\n\t<string key=\"TreeValidationError.CustomFormMarkup.InvalidXml\" value=\"The file '{0}' does not contain valid XML markup.\" />\r\n  <string key=\"TreeValidationError.ReportFunctionAction.WrongReturnValue\" value=\"The function does not return value of the type '{0}'\" />\r\n  <string key=\"TreeValidationError.GenericEditDataAction.OwnerIsNotDataNode\" value=\"The edit data action only applies to elements that produce data elements\" />\r\n  <string key=\"TreeValidationError.GenericDeleteDataAction.OwnerIsNotDataNode\" value=\"The delete data action only applies to elements that produce data elements\" />\r\n  <string key=\"TreeValidationError.MessageBoxAction.UnknownDialogType\" value=\"The dialog type '{0}' is not supported\" />\r\n  <string key=\"TreeValidationError.CustomUrlAction.TooManyPostParameterElements\" value=\"Too many '{0}' elements, only one is allowed\" />\r\n  <string key=\"TreeValidationError.CustomUrlAction.UnknownViewType\" value=\"The view type '{0}' is not supported\" />\r\n\r\n  <string key=\"TreeValidationError.FieldOrderBy.UnknownDirection\" value=\"The direction value '{0}' is wrong, should be either 'ascending' or 'descending'\" />\r\n  <string key=\"TreeValidationError.FieldOrderBy.UnknownField\" value=\"The type '{0}' does not contain a field named '{1}'\" />\r\n\r\n  <string key=\"TreeValidationError.DataFieldValueHelper.WrongFormat\" value=\"'{0}' is in wrong format, use the format {1} for raw values or {2} for formatted values. For format options, see the .ToString() oprions for the field type, ex 'yyyy MMM' for DateTime\" />\r\n  <string key=\"TreeValidationError.DataFieldValueHelper.InterfaceNotInParentTree\" value=\"The interface '{0}' is not contained in the current element or any of its parents\" />\r\n\r\n  <string key=\"TreeValidationError.Range.WrongFormat\" value=\"The range value is wrongly formatted\" />\r\n  <string key=\"TreeValidationError.Range.UnsupportedType\" value=\"The property '{0}' is of type '{1}' which does not support ranges\" />\r\n\r\n  <string key=\"TreeValidationError.Range.MinMaxError\" value=\"The value first value ({0}) in a range should be lesser than second value ({1})\" />\r\n  <string key=\"TreeValidationError.Range.NextRangeError\" value=\"The max value of a range should be less than the min value of the succeeding range\" />\r\n\r\n  \r\n  <!-- Ranges -->\r\n  \r\n  <string key=\"TreeRanges.IntRange.Closed\" value=\"From {0} to {1}\" />\r\n  <string key=\"TreeRanges.IntRange.MinOpenEnded\" value=\"{0} or less\" />\r\n  <string key=\"TreeRanges.IntRange.MaxOpenEnded\" value=\"{0} or more\" />\r\n  <string key=\"TreeRanges.IntRange.Other\" value=\"Other\" />\r\n\r\n  <string key=\"TreeRanges.StringRange.Closed\" value=\"From {0} to {1}\" />\r\n  <string key=\"TreeRanges.StringRange.MinOpenEnded\" value=\"{0} and before\" />\r\n  <string key=\"TreeRanges.StringRange.MaxOpenEnded\" value=\"{0} and after\" />\r\n  <string key=\"TreeRanges.StringRange.Other\" value=\"Other\" />\r\n\r\n  \r\n  <!-- Other -->\r\n  <string key=\"GenericAddDataAction.DefaultLabel\" value=\"Add\" />\r\n  <string key=\"GenericEditDataAction.DefaultLabel\" value=\"Edit\" />\r\n  <string key=\"GenericDeleteDataAction.DefaultLabel\" value=\"Delete\" />\r\n  <string key=\"GenericDuplicateDataAction.DefaultLabel\" value=\"Duplicate\" />\r\n  \r\n  \r\n  <string key=\"TreeGenericDelete.CascadeDeleteErrorTitle\" value=\"Cascade delete error\" />\r\n  <string key=\"TreeGenericDelete.CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  \r\n  <string key=\"TreeGenericDeleteConfirm.LabelFieldGroup\" value=\"Delete Data?\" />\r\n  <string key=\"TreeGenericDeleteConfirm.Text\" value=\"Delete\" />\r\n  \r\n  <string key=\"TreeGenericDeleteConfirmDeletingRelatedData.LabelFieldGroup\" value=\"Delete data?\" />\r\n  <string key=\"TreeGenericDeleteConfirmDeletingRelatedData.ConfirmationText\" value=\"There is some referenced data that will also be deleted, do you want to continue?\" />\r\n\r\n\r\n  <string key=\"TreeAddTreeDefinitionWorkflow.AddNew.Label\" value=\"Add\" />\r\n  <string key=\"TreeAddTreeDefinitionWorkflow.AddNew.ToolTip\" value=\"Add new tree definition\" />           \r\n  <string key=\"TreeAddTreeDefinition.Layout.Label\" value=\"Add new tree definition\" />\r\n  <string key=\"TreeAddTreeDefinition.FieldGroup.Label\" value=\"Add new tree definition\" />\r\n  <string key=\"TreeAddTreeDefinition.NameTextBox.Label\" value=\"Definition name\" />\r\n  <string key=\"TreeAddTreeDefinition.NameTextBox.Help\" value=\"Definition name\" />\r\n  <string key=\"TreeAddTreeDefinition.TemplateSelector.Label\" value=\"Template\" />\r\n  <string key=\"TreeAddTreeDefinition.TemplateSelector.Help\" value=\"Select a template to start with\" />\r\n  <string key=\"TreeAddTreeDefinition.PositionSelector.Label\" value=\"Position\" />\r\n  <string key=\"TreeAddTreeDefinition.PositionSelector.Help\" value=\"Position\" />\r\n\r\n  <string key=\"TreeDeleteTreeDefinitionWorkflow.Delete.Label\" value=\"Delete\" />\r\n  <string key=\"TreeDeleteTreeDefinitionWorkflow.Delete.ToolTip\" value=\"Delete tree definition\" />\r\n  <string key=\"TreeDeleteTreeDefinition.Layout.Label\" value=\"Delete tree definition\" />\r\n  <string key=\"TreeDeleteTreeDefinition.Title\" value=\"Delete selected tree definition\" />\r\n  <string key=\"TreeDeleteTreeDefinition.Description\" value=\"Delete selected tree definition?\" />\r\n\r\n  <string key=\"TreeDeleteTreeDefinitionWorkflow.Edit.Label\" value=\"Edit\" />\r\n  <string key=\"TreeDeleteTreeDefinitionWorkflow.Edit.ToolTip\" value=\"Edit tree definition\" />\r\n\r\n  <string key=\"AddApplicationWorkflow.AddApplication.Label\" value=\"Add Application\" />\r\n  <string key=\"AddApplicationWorkflow.AddApplication.ToolTip\" value=\"Add new application\" />\r\n  <string key=\"AddApplication.Layout.Label\" value=\"Add application\" />\r\n  <string key=\"AddApplication.FieldGroup.Label\" value=\"Select application\" />\r\n  <string key=\"AddApplication.TreeIdSelector.Label\" value=\"Application\" />\r\n  <string key=\"AddApplication.TreeIdSelector.Help\" value=\"Select the application that you wish to add\" />\r\n  <string key=\"AddApplication.PositionSelector.Label\" value=\"Position\" />\r\n  <string key=\"AddApplication.PositionSelector.Help\" value=\"The position to insert this application\" />\r\n  <string key=\"AddApplication.NoTrees.Title\" value=\"No applications\" />\r\n  <string key=\"AddApplication.NoTrees.Message\" value=\"You have added all available applications\" />\r\n\r\n  <string key=\"RemoveApplicationWorkflow.RemoveApplication.Label\" value=\"Remove Application\" />\r\n  <string key=\"RemoveApplicationWorkflow.RemoveApplication.ToolTip\" value=\"Remove existing application\" />\r\n  <string key=\"RemoveApplication.Layout.Label\" value=\"Remove application\" />\r\n  <string key=\"RemoveApplication.FieldGroup.Label\" value=\"Remove application\" />\r\n  <string key=\"RemoveApplication.TreeIdSelector.Label\" value=\"Application\" />\r\n  <string key=\"RemoveApplication.TreeIdSelector.Help\" value=\"Select the application that you wish to remove\" />\r\n  <string key=\"RemoveApplication.NoTrees.Title\" value=\"No applications\" />\r\n  <string key=\"RemoveApplication.NoTrees.Message\" value=\"You have removed all available applications\" />\r\n\r\n  <string key=\"LocalizeDataWorkflow.LocalizeDataLabel\" value=\"Translate data\" />\r\n  <string key=\"LocalizeDataWorkflow.LocalizeDataToolTip\" value=\"Translate data\" />\r\n  <string key=\"LocalizeDataWorkflow.DisabledData\" value=\"Not yet approved or published\" />\r\n  <string key=\"LocalizeData.ShowError.Layout.Label\" value=\"Failed to translate data\" />\r\n  <string key=\"LocalizeData.ShowError.InfoTable.Caption\" value=\"Translation errors\" />  \r\n  <string key=\"LocalizeData.ShowError.Description\" value=\"The following fields has a reference to a data type. You should translate these data items before you can translate this data item\" />\r\n  <string key=\"LocalizeData.ShowError.FieldErrorFormat\" value=\"The field '{0}' is referencing data of type '{1}' with the label '{2}'\" />\r\n  <string key=\"LocalizeData.ShowError.AlreadyTranslated\" value=\"This data has already been translated. The translated version belongs to a different group.\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.C1Console.Users.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<strings>\r\n\t<!-- change password -->\r\n\t<string key=\"ChangeOwnPasswordWorkflow.ElementActionLabel\" value=\"Change Password...\"/>\r\n\t<string key=\"ChangeOwnPasswordWorkflow.ElementActionToolTip\" value=\"Change your password\"/>\r\n\t<string key=\"ChangeOwnPasswordWorkflow.Dialog.Label\" value=\"Change Password\"/>\r\n\t<string key=\"ChangeOwnPasswordWorkflow.Dialog.ExistingPassword.Label\" value=\"Existing password\"/>\r\n\t<string key=\"ChangeOwnPasswordWorkflow.Dialog.ExistingPassword.Help\" value=\"For security reasons you must present your existing password before you can continue.\"/>\r\n\t<string key=\"ChangeOwnPasswordWorkflow.Dialog.NewPassword.Label\" value=\"New password\"/>\r\n\t<string key=\"ChangeOwnPasswordWorkflow.Dialog.NewPassword.Help\" value=\"The password specified in this field must match the confirmation below.\"/>\r\n\t<string key=\"ChangeOwnPasswordWorkflow.Dialog.NewPasswordConfirmed.Label\" value=\"Confirm new password\"/>\r\n\t<string key=\"ChangeOwnPasswordWorkflow.Dialog.NewPasswordConfirmed.Help\" value=\"The password specified in this field must match the one specified above.\"/>\r\n  <string key=\"ChangeOwnPasswordWorkflow.Dialog.Validation.IncorrectPassword\" value=\"The specified password is incorrect.\"/>\r\n  <string key=\"ChangeOwnPasswordWorkflow.Dialog.Validation.NewPasswordFieldsNotMatch\" value=\"The new passwords you typed do not match.\"/>\r\n  <string key=\"ChangeOwnPasswordWorkflow.Dialog.Validation.PasswordsAreTheSame\" value=\"The old and the new passwords are the same.\"/>\r\n  <string key=\"ChangeOwnPasswordWorkflow.Dialog.Validation.NewPasswordIsEmpty\" value=\"The new password may not be an empty string.\"/>\r\n  <string key=\"ChangeOwnPasswordWorkflow.Dialog.Validation.NewPasswordTooShort\" value=\"The new password must be at least {0} characters long.\"/>\r\n  <string key=\"ChangeOwnPasswordWorkflow.NotSupportedErrorLabel\" value=\"Password change isn't supported.\"/>\r\n  <string key=\"ChangeOwnPasswordWorkflow.NotSupportedErrorText\" value=\"Password change isn't supported in current configuration.\"/>\r\n\r\n\r\n  <!-- change culture -->\r\n\t<string key=\"ChangeOwnCultureWorkflow.ElementActionLabel\" value=\"Profile Settings...\"/>\r\n\t<string key=\"ChangeOwnCultureWorkflow.ElementActionToolTip\" value=\"Set the C1 Console language and formatting of numbers, times and dates\"/>\r\n\t<string key=\"ChangeOwnCultureWorkflow.Dialog.Label\" value=\"Profile Settings\"/>\r\n\t<string key=\"ChangeOwnCultureWorkflow.Dialog.CultureSelector.Label\" value=\"Display Preferences\"/>\r\n\t<string key=\"ChangeOwnCultureWorkflow.Dialog.CultureSelector.Help\" value=\"Display for time, date, and number formats within the console\" />\r\n  <string key=\"ChangeOwnCultureWorkflow.Dialog.C1ConsoleLanguageSelector.Label\" value=\"Console Language Preferences\"/>\r\n  <string key=\"ChangeOwnCultureWorkflow.Dialog.C1ConsoleLanguageSelector.Help\" value=\"Language displayed within your console for labels, help texts, dialogs, etc. The available options are limited to language packages installed. See Composite.Localization packages for more language options.\" />\r\n  <string key=\"ChangeOwnCultureWorkflow.Dialog.Confirm.Title\" value=\"Change application language\"/>\r\n  <string key=\"ChangeOwnCultureWorkflow.Dialog.Confirm.Text\" value=\"Are your sure you wish to change the settings? The application will restart and all your unsaved changes will be lost.\"/>\r\n\t<string key=\"AdministratorAutoCreator.DefaultGroupName\" value=\"Administrators\"/>\r\n\r\n\t<!-- change own active and foreign locale -->\r\n\t<string key=\"ChangeForeignLocaleWorkflow.ActionLabel\" value=\"Translation...\"/>\r\n\t<string key=\"ChangeForeignLocaleWorkflow.ActionToolTip\" value=\"Change source language\"/>\r\n\t<string key=\"ChangeForeignLocaleWorkflow.NoForeignLocaleLabel\" value=\"None\"/>\r\n\t<string key=\"ChangeForeignLocaleWorkflow.Dialog.Label\" value=\"Translation\"/>\r\n\t<string key=\"ChangeForeignLocaleWorkflow.FieldGroup.Label\" value=\"Select language to translate from\"/>\r\n\t<string key=\"ChangeForeignLocaleWorkflow.NoOrOneActiveLocales.Title\" value=\"Multiple languages not installed\"/>\r\n\t<string key=\"ChangeForeignLocaleWorkflow.NoOrOneActiveLocales.Description\" value=\"Two or more languages must be installed in order to support translations. Administrators can add more languages in the 'System' perspective.\"/>\r\n\t<string key=\"ChangeForeignLocaleWorkflow.ForeignCultureSelector.Label\" value=\"From-language\"/>\r\n\t<string key=\"ChangeForeignLocaleWorkflow.ForeignCultureSelector.Help\" value=\"Pages written in the from-language will be indicated by globe icons in the Content tree. The associated &quot;Translate Page&quot; action imports the page into the current working language.\"/>\r\n\r\n  <string key=\"ChangeOwnActiveLocaleWorkflow.CloseAllViews.Message\" value=\"The active language has been changed\"/>\r\n  \r\n  <string key=\"PasswordRules.MinimumLength\" value=\"Password should be at least {0} characters long.\" />\r\n  <string key=\"PasswordRules.EnforcePasswordHistory\" value=\"Password should not match any of the previously used {0} passwords.\" />\r\n  <string key=\"PasswordRules.DifferentCharacterGroups\" value=\"Password should contain 3/4 of the following items: uppercase letters, lowercase letters, numbers, symbols.\" />\r\n  <string key=\"PasswordRules.DoNotUseUserName\" value=\"Password should not be based on a user name.\" />\r\n\r\n\t<string key=\"ChangePasswordForm.ConfirmationPasswordMimatch\" value=\"Confirmation password mismatch\" />\r\n\t<string key=\"ChangePasswordForm.Username\" value=\"Username\" />\r\n\t<string key=\"ChangePasswordForm.OldPassword\" value=\"Old Password\" />\r\n\t<string key=\"ChangePasswordForm.NewPassword\" value=\"New Password\" />\r\n\t<string key=\"ChangePasswordForm.ConfirmPassword\" value=\"Confirm Password\" />\r\n\t<string key=\"ChangePasswordForm.ChangePasswordButton\" value=\"Change Password\" />\r\n\t<string key=\"ChangePasswordForm.PasswordExpiredMessage\" value=\"Password is older than {0} days. Please change your password.\" />\r\n  <string key=\"ChangePasswordForm.IncorrectOldPassword\" value=\"The old password is incorrect.\" />\r\n\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Core.PackageSystem.PackageFragmentInstallers.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"PackageManager.CompositeVersionMisMatch\" value=\"The package composite version requirements does not match the current composite version '{0}'. Expected version range [{1} - {2}]\" />\r\n  <string key=\"PackageManager.PackageAlreadyInstalled\" value=\"Package is already installed\" />\r\n  <string key=\"PackageManager.NewerVersionInstalled\" value=\"A newer version of the package is already installed\" />\t\r\n  <string key=\"PackageManager.MissingPackageDirectory\" value=\"Could not locate the package directory path '{0}'\" />\r\n  <string key=\"PackageManager.Uninstallable\" value=\"The package is marked as non uninstallable\" />\r\n  <string key=\"PackageManager.MissingZipFile\" value=\"Could not locate the package zip file path '{0}'\" />\r\n  <string key=\"PackageManager.MissingUninstallFile\" value=\"Could not locate the package uninstall file path '{0}'\" />\r\n  <string key=\"PackageManager.MissingElement\" value=\"Missing '{0}' element.\" />\r\n  <string key=\"PackageManager.MissingAttribute\" value=\"Missing '{0}' attribute.\" />\r\n  <string key=\"PackageManager.InvalidAttributeValue\" value=\"'{0}' attribute value is not a valid value.\" />\r\n  <string key=\"PackageManager.InvalidElementValue\" value=\"'{0}' element value is not a valid value\" />\r\n  <string key=\"ConfigurationTransformationPackageFragmentInstaller.ExpectedExactlyTwoElements\" value=\"Expected exactly two elements, '{0}' and '{1}'\" />\r\n  <string key=\"ConfigurationTransformationPackageFragmentInstaller.MissingElement\" value=\"Missing '{0}' element.\" />\r\n  <string key=\"ConfigurationTransformationPackageFragmentInstaller.MissingAttribute\" value=\"Missing '{0}' attribute.\" />\r\n  <string key=\"ConfigurationTransformationPackageFragmentInstaller.PathDoesNotExist\" value=\"The path '{0}' does not exist in the ZIP.\" />\r\n  <string key=\"ConfigurationTransformationPackageFragmentInstaller.UnableToParsXslt\" value=\"Unable to parse ZIP'ed XSLT file '{0}'. {1}\" />\r\n  <string key=\"ConfigurationTransformationPackageFragmentInstaller.XsltWillGeneratedInvalid\" value=\"The XSLT file '{0}' will generate an invalid Configuration file. {1}\" />\r\n  <string key=\"DataPackageFragmentInstaller.OnlyOneElement\" value=\"Only one 'Types' element allowed\" />\r\n  <string key=\"DataPackageFragmentInstaller.MissingElement\" value=\"Missing 'Types' element\" />\r\n  <string key=\"DataPackageFragmentInstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"DataPackageFragmentInstaller.WrongDataScopeIdentifier\" value=\"Wrong DataScopeIdentifier ({0}) name in the configuration\" />\r\n  <string key=\"DataPackageFragmentInstaller.WrongLocale\" value=\"Wrong culture ({0}) name in the configuration\" />\r\n  <string key=\"DataPackageFragmentInstaller.MissingFile\" value=\"Missing file '{0}' in the package zip\" />\r\n  <string key=\"DataPackageFragmentInstaller.TypeNotConfigured\" value=\"The data interface type '{0}' has not been configured in the system\" />\r\n  <string key=\"DataPackageFragmentInstaller.TypeNotInheriting\" value=\"The data interface type '{0}' does not inherit the interface '{1}'\" />\r\n  <string key=\"DataPackageFragmentInstaller.MissingProperty\" value=\"The data interface type '{0}' does not have a property named '{1}'\" />\r\n  <string key=\"DataPackageFragmentInstaller.MissingWritableProperty\" value=\"The data interface type '{0}' does not have a writable property named '{1}'\" />\r\n  <string key=\"DataPackageFragmentInstaller.ConversionFailed\" value=\"Could not convert the value '{0}' to the type '{1}'\" />\r\n  <string key=\"DataPackageFragmentInstaller.MissingPropertyVaule\" value=\"The property '{0}' on the interface '{1}' is missing a value.\" />\r\n  <string key=\"DataPackageFragmentInstaller.DataExists\" value=\"Data type '{0}': {1} record(s) already installed\" />\r\n  <string key=\"DataPackageFragmentInstaller.MissingTypeDescriptor\" value=\"Missing data type descriptor for the type {0}\" />\r\n  <string key=\"DataPackageFragmentInstaller.TypeNonLocalizedWithLocale\" value=\"The data type '{0}' is not localized but a locale is specified in the configuration\" />\r\n  <string key=\"DataPackageFragmentInstaller.TypeLocalizedWithoutLocale\" value=\"The data type '{0}' is localized but no locale is specified in the configuration\" />\r\n  <string key=\"DataPackageFragmentInstaller.ReferencedDataMissing\" value=\"Referenced data missing. Type: {0}, {1}: '{2}'\" />\r\n  <string key=\"DataPackageFragmentUninstaller.OnlyOneElement\" value=\"Only one 'Types' element allowed\" />\r\n  <string key=\"DataPackageFragmentUninstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"DataPackageFragmentUninstaller.MissingKeyProperty\" value=\"The data type '{0}' does not contain a key property named '{1}'\" />\r\n  <string key=\"DataPackageFragmentUninstaller.DataIsReferenced\" value=\"Data item '{0}' of type {1} is referenced from a data item '{2}' of type '{3}'\" />\r\n  <string key=\"DataPackageFragmentUninstaller.PageTypeIsReferenced\" value=\"Page type '{0}' is referenced by page '{1}'\" />\r\n  <string key=\"DataTypePackageFragmentInstaller.OnlyOneElement\" value=\"Only one 'Types' element allowed\" />\r\n  <string key=\"DataTypePackageFragmentInstaller.MissingElement\" value=\"Missing 'Types' element\" />\r\n  <string key=\"DataTypePackageFragmentInstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"DataTypePackageFragmentInstaller.TypeNotConfigured\" value=\"The data interface type '{0}' has not been configured in the system\" />\r\n  <string key=\"DataTypePackageFragmentInstaller.TypeNotInheriting\" value=\"The data interface type '{0}' does not inherit the interface '{1}'\" />\r\n  <string key=\"DataTypePackageFragmentInstaller.TypeExists\" value=\"The interface type '{0}' is already exists in the system\" />\r\n  <string key=\"DataTypePackageFragmentInstaller.InterfaceCodeError\" value=\"Failed to build a data type descriptor for interface '{0}'\" />\r\n  <string key=\"DataTypePackageFragmentUninstaller.OnlyOneElement\" value=\"Only one 'Types' element allowed\" />\r\n  <string key=\"DataTypePackageFragmentUninstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"DataTypePackageFragmentUninstaller.WrongAttributeFormat\" value=\"Wrong attribute format in the configuration\" />\r\n  <string key=\"DynamicDataTypePackageFragmentInstaller.OnlyOneElement\" value=\"Only one 'Types' element allowed\" />\r\n  <string key=\"DynamicDataTypePackageFragmentInstaller.MissingElement\" value=\"Missing 'Types' element\" />\r\n  <string key=\"DynamicDataTypePackageFragmentInstaller.DataTypeDescriptorParseError\" value=\"Error xml parsing the dataTypeDescriptor attribute\" />\r\n  <string key=\"DynamicDataTypePackageFragmentInstaller.DataTypeDescriptorDeserializeError\" value=\"Error while deserializing a DataType. Error text: {0}.\" />\r\n  <string key=\"DynamicDataTypePackageFragmentInstaller.MissingReferencedType\" value=\"Cannot find a referenced type '{0}'.\" />\r\n  <string key=\"DynamicDataTypePackageFragmentInstaller.TypeExists\" value=\"The interface type '{0}' is already exists in the system\" />\r\n  <string key=\"DynamicDataTypePackageFragmentUninstaller.OnlyOneElement\" value=\"Only one 'Types' element allowed\" />\r\n  <string key=\"DynamicDataTypePackageFragmentUninstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"DynamicDataTypePackageFragmentUninstaller.WrongAttributeFormat\" value=\"Wrong attribute format in the configuration\" />\r\n  <string key=\"FilePackageFragmentInstaller.OnlyOneFilesElement\" value=\"Only one 'Files' element allowed\" />\r\n  <string key=\"FilePackageFragmentInstaller.OnlyOneDirectoriesElement\" value=\"Only one 'Directories' element allowed\" />\r\n  <string key=\"FilePackageFragmentInstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"FilePackageFragmentInstaller.DeleteTargetDirectoryNotAllowed\" value=\"The 'deleteTargetDirectory' attribute can only be applied to directories, not files\" />\r\n  <string key=\"FilePackageFragmentInstaller.WrongAttributeBoolFormat\" value=\"Wrong attribute value format, bool value expected\" />\r\n  <string key=\"FilePackageFragmentInstaller.MissingFile\" value=\"The install zip-file does not contain the file '{0}'\" />\r\n  <string key=\"FilePackageFragmentInstaller.FileExists\" value=\"The file '{0}' already exists\" />\r\n  <string key=\"FilePackageFragmentInstaller.FileReadOnly\" value=\"File '{0}' marked as 'Read Only' and therefore cannot be overwritten.\" />\r\n  <string key=\"FilePackageFragmentInstaller.AssemblyLoadNotAllowed\" value=\"The 'assemblyLoad' attribute can only be applied to files, not directories\" />\r\n  <string key=\"FilePackageFragmentInstaller.OnlyUpdateNotAllowed\" value=\"The 'onlyUpdate' attribute can only be applied to files, not directories\" />\r\n  <string key=\"FilePackageFragmentInstaller.OnlyUpdateNotAllowedWithLoadAssemlby\" value=\"The 'onlyUpdate' attribute is not allowed in combination with the 'loadAssembly' attribute\" />\r\n  <string key=\"FilePackageFragmentInstaller.OnlyUpdateAndOnlyAddNotAllowed\" value=\"The 'onlyUpdate' and 'onlyAdd' attributes are now allowed on the same element\" />\r\n  <string key=\"FilePackageFragmentInstaller.OnlyAddAndAllowOverwriteNotAllowed\" value=\"The 'onlyAdd' and 'allowOverwrite' attributes are now allowed on the same element\" />\r\n  <string key=\"FilePackageFragmentInstaller.MissingDirectory\" value=\"The install zip-file does not contain the directory '{0}'\" />\r\n  <string key=\"FilePackageFragmentInstaller.WrongBasePath\" value=\"Uninstall.xml contains file pathes, binded to the original website location, and therefore the package cannot be uninstalled safely.\" />\r\n  <string key=\"FilePackageFragmentUninstaller.OnlyOneFilesElement\" value=\"Only one 'Files' element allowed\" />\r\n  <string key=\"VirtualElementProviderNodePackageFragmentInstaller.OnlyOneElement\" value=\"Only one 'Areas' element allowed\" />\r\n  <string key=\"VirtualElementProviderNodePackageFragmentInstaller.MissingType\" value=\"Could not find the type '{0}'\" />\r\n  <string key=\"VirtualElementProviderNodePackageFragmentInstaller.MissingIcon\" value=\"Could not find the icon '{0}'\" />\r\n  <string key=\"VirtualElementProviderNodePackageFragmentUninstaller.OnlyOneElement\" value=\"Only one 'Areas' element allowed\" />\r\n  <string key=\"VirtualElementProviderNodePackageFragmentUninstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"FileXslTransformationPackageFragmentInstaller.FileNotFound\" value=\"File '{0}' not found\" />\r\n  <string key=\"FileXslTransformationPackageFragmentInstaller.FileReadOnly\" value=\"File '{0}' marked as 'Read Only' and therefore cannot be overwritten.\" />\r\n  <string key=\"FileXslTransformationPackageFragmentInstaller.FileReadOnlyOverride\" value=\"File '{0}' was marked as 'Read Only'. This file attribute was explicitly removed and the file was updated normally.\" />\r\n\r\n  <string key=\"PackageVersionBumperFragmentInstaller.OnlyOneElement\" value=\"Only one 'PackageVersions' element allowed\" />\r\n  <string key=\"PackageVersionBumperFragmentInstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"PackageVersionBumperFragmentInstaller.WrongAttributeGuidFormat\" value=\"Wrong attribute value format, Guid value expected\" />\r\n  <string key=\"PackageVersionBumperFragmentInstaller.PackageIdDuplicate\" value=\"The package id duplicate: '{0}'\" />\r\n  <string key=\"PackageVersionBumperFragmentInstaller.WrongAttributeVersionFormat\" value=\"Wrong attribute value format, Version value expected (x.y.z)\" />\r\n  <string key=\"PackageVersionBumperFragmentUninstaller.OnlyOneElement\" value=\"Only one 'PackageVersions' element allowed\" />\r\n  <string key=\"PackageVersionBumperFragmentUninstaller.MissingAttribute\" value=\"Missing {0} attribute in the configuration\" />\r\n  <string key=\"PackageVersionBumperFragmentUninstaller.WrongAttributeGuidFormat\" value=\"Wrong attribute value format, Guid value expected\" />\r\n  <string key=\"PackageVersionBumperFragmentUninstaller.PackageIdDuplicate\" value=\"The package id duplicate: '{0}'\" />\r\n  <string key=\"PackageVersionBumperFragmentUninstaller.WrongAttributeVersionFormat\" value=\"Wrong attribute value format, Version value expected (x.y.z)\" />\r\n  <string key=\"PackageLicenseFragmentInstaller.MissingPublicKeyElement\" value=\"A public RSA key is missing in the package configuration\" />\r\n\r\n  <string key=\"FileModifyPackageFragmentInstaller.FileDoesNotExist\" value=\"File '{0}' does not exist.\" />\r\n\r\n  <string key=\"License.InvalidKeyTitle\" value=\"Invalid license key\" />\r\n  <string key=\"License.InvalidKeyMessage\" value=\"The license key is invalid. You need to obtain a valid license key.\" />\r\n  <string key=\"License.ExpiredTitle\" value=\"Trial period has expired\" />\r\n  <string key=\"License.ExpiredMessage\" value=\"The trial period of the package has expired. You need to obtain a valid license.\" />\r\n  <string key=\"License.Failed\" value=\"Failed to get license information. ProductId: {0}\" />\r\n\r\n  <string key=\"NotEnoughNtfsPermissions\" value=\"The Windows user under which this C1 instance is running does not have write permission to file or folder '{0}'.\" />\r\n\r\n  <string key=\"PackageFragmentInstaller.OnlyOneElementAllowed\" value=\"Only one '{0}' element allowed\" />\r\n  <string key=\"PackageFragmentInstaller.IncorrectElement\" value=\"Unexpected element name '{0}', only allowed element name is '{1}'\" />\r\n  <string key=\"PackageFragmentInstaller.MissingAttribute\" value=\"Missing '{0}' attribute.\" />\r\n  <string key=\"PackageFragmentInstaller.MissingElement\" value=\"Missing element '{0}'.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Cultures.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"af-ZA\" value=\"Afrikaans, South Africa\" />\r\n  <string key=\"sq-AL\" value=\"Albanian, Albania\" />\r\n  <string key=\"ar-DZ\" value=\"Arabic, Algeria\" />\r\n  <string key=\"ar-BH\" value=\"Arabic, Bahrain\" />\r\n  <string key=\"ar-EG\" value=\"Arabic, Egypt\" />\r\n  <string key=\"ar-IQ\" value=\"Arabic, Iraq\" />\r\n  <string key=\"ar-JO\" value=\"Arabic, Jordan\" />\r\n  <string key=\"ar-KW\" value=\"Arabic, Kuwait\" />\r\n  <string key=\"ar-LB\" value=\"Arabic, Lebanon\" />\r\n\r\n  <string key=\"ar-LY\" value=\"Arabic, Libya\" />\r\n  <string key=\"ar-MA\" value=\"Arabic, Morocco\" />\r\n  <string key=\"ar-OM\" value=\"Arabic, Oman\" />\r\n  <string key=\"ar-QA\" value=\"Arabic, Qatar\" />\r\n  <string key=\"ar-SA\" value=\"Arabic, Saudi Arabia\" />\r\n  <string key=\"ar-SY\" value=\"Arabic, Syria\" />\r\n  <string key=\"ar-TN\" value=\"Arabic, Tunisia\" />\r\n  <string key=\"ar-AE\" value=\"Arabic, U.A.E.\" />\r\n  <string key=\"ar-YE\" value=\"Arabic, Yemen\" />\r\n\r\n  <string key=\"hy-AM\" value=\"Armenian, Armenia\" />\r\n  <string key=\"az-Cyrl-AZ\" value=\"Azeri, Cyrillic Azerbaijan\" />\r\n  <string key=\"az-Latn-AZ\" value=\"Azeri, Latin Azerbaijan\" />\r\n  <string key=\"eu-ES\" value=\"Basque, Basque\" />\r\n  <string key=\"be-BY\" value=\"Belarusian, Belarus\" />\r\n  <string key=\"bs-Latn-BA\" value=\"Bosnian, Bosnia and Herzegovina\" />\r\n  <string key=\"bs-Cyrl-BA\" value=\"Bosnian (Cyrillic) (Bosnia and Herzegovina)\" />\r\n  <string key=\"bg-BG\" value=\"Bulgarian, Bulgaria\" />\r\n  <string key=\"ca-ES\" value=\"Catalan, Catalan\" />\r\n\r\n  <string key=\"zh-HK\" value=\"Chinese, Hong Kong S.A.R.\" />\r\n  <string key=\"zh-MO\" value=\"Chinese, Macao S.A.R.\" />\r\n  <string key=\"zh-CN\" value=\"Chinese, People's Republic of China\" />\r\n  <string key=\"zh-SG\" value=\"Chinese, Singapore\" />\r\n  <string key=\"zh-TW\" value=\"Chinese, Taiwan\" />\r\n  <string key=\"hr-BA\" value=\"Croatian, Bosnia and Herzegovina\" />\r\n  <string key=\"hr-HR\" value=\"Croatian, Croatia\" />\r\n  <string key=\"cs-CZ\" value=\"Czech, Czech Republic\" />\r\n  <string key=\"da-DK\" value=\"Danish\" />\r\n\r\n  <string key=\"dv-MV\" value=\"Divehi, Maldives\" />\r\n  <string key=\"nl-BE\" value=\"Dutch, Belgium\" />\r\n  <string key=\"nl-NL\" value=\"Dutch\" />\r\n  <string key=\"en-AU\" value=\"English, Australia\" />\r\n  <string key=\"en-BZ\" value=\"English, Belize\" />\r\n  <string key=\"en-CA\" value=\"English, Canada\" />\r\n  <string key=\"en-029\" value=\"English, Caribbean\" />\r\n  <string key=\"en-IE\" value=\"English, Ireland\" />\r\n  <string key=\"en-JM\" value=\"English, Jamaica\" />\r\n\r\n  <string key=\"en-NZ\" value=\"English, New Zealand\" />\r\n  <string key=\"en-PH\" value=\"English, Republic of the Philippines\" />\r\n  <string key=\"en-ZA\" value=\"English, South Africa\" />\r\n  <string key=\"en-TT\" value=\"English, Trinidad and Tobago\" />\r\n  <string key=\"en-GB\" value=\"English, UK\" />\r\n  <string key=\"en-US\" value=\"English, US\" />\r\n  <string key=\"en-ZW\" value=\"English, Zimbabwe\" />\r\n  <string key=\"et-EE\" value=\"Estonian, Estonia\" />\r\n  <string key=\"fo-FO\" value=\"Faroese, Faroe Islands\" />\r\n\r\n  <string key=\"fil-PH\" value=\"Filipino, Philippines\" />\r\n  <string key=\"fi-FI\" value=\"Finnish\" />\r\n  <string key=\"fr-BE\" value=\"French, Belgium\" />\r\n  <string key=\"fr-CA\" value=\"French, Canada\" />\r\n  <string key=\"fr-FR\" value=\"French\" />\r\n  <string key=\"fr-LU\" value=\"French, Luxembourg\" />\r\n  <string key=\"fr-MC\" value=\"French, Principality of Monaco\" />\r\n  <string key=\"fr-CH\" value=\"French, Switzerland\" />\r\n  <string key=\"fy-NL\" value=\"Frisian, Netherlands\" />\r\n\r\n  <string key=\"gd-GB\" value=\"Gaelic, United Kingdom\" />\r\n  <string key=\"gl-ES\" value=\"Galician, Galician\" />\r\n  <string key=\"ka-GE\" value=\"Georgian, Georgia\" />\r\n  <string key=\"de-AT\" value=\"German, Austria\" />\r\n  <string key=\"de-DE\" value=\"German\" />\r\n  <string key=\"de-LI\" value=\"German, Liechtenstein\" />\r\n  <string key=\"de-LU\" value=\"German, Luxembourg\" />\r\n  <string key=\"de-CH\" value=\"German, Switzerland\" />\r\n  <string key=\"el-GR\" value=\"Greek, Greece\" />\r\n  <string key=\"kl-GL\" value=\"Greenlandic\" />\r\n\r\n  <string key=\"gu-IN\" value=\"Gujarati, India\" />\r\n  <string key=\"he-IL\" value=\"Hebrew, Israel\" />\r\n  <string key=\"hi-IN\" value=\"Hindi, India\" />\r\n  <string key=\"hu-HU\" value=\"Hungarian, Hungary\" />\r\n  <string key=\"is-IS\" value=\"Icelandic, Iceland\" />\r\n  <string key=\"id-ID\" value=\"Indonesian, Indonesia\" />\r\n  <string key=\"iu-Latn-CA\" value=\"Inuktitut (Latin) (Canada)\" />\r\n  <string key=\"ga-IE\" value=\"Irish, Ireland\" />\r\n  <string key=\"it-IT\" value=\"Italian\" />\r\n\r\n  <string key=\"it-CH\" value=\"Italian, Switzerland\" />\r\n  <string key=\"ja-JP\" value=\"Japanese, Japan\" />\r\n  <string key=\"kn-IN\" value=\"Kannada, India\" />\r\n  <string key=\"kk-KZ\" value=\"Kazakh, Kazakhstan\" />\r\n  <string key=\"sw-KE\" value=\"Kiswahili, Kenya\" />\r\n  <string key=\"kok-IN\" value=\"Konkani, India\" />\r\n  <string key=\"ko-KR\" value=\"Korean, Korea\" />\r\n  <string key=\"ky-KG\" value=\"Kyrgyz, Kyrgyzstan\" />\r\n  <string key=\"lv-LV\" value=\"Latvian, Latvia\" />\r\n\r\n  <string key=\"lt-LT\" value=\"Lithuanian, Lithuania\" />\r\n  <string key=\"lb-LU\" value=\"Luxembourgish, Luxembourg\" />\r\n  <string key=\"mk-MK\" value=\"Macedonian, Former Yugoslav Republic of Macedonia\" />\r\n  <string key=\"ms-BN\" value=\"Malay, Brunei Darussalam\" />\r\n  <string key=\"ms-MY\" value=\"Malay, Malaysia\" />\r\n  <string key=\"mt-MT\" value=\"Maltese, Malta\" />\r\n  <string key=\"mi-NZ\" value=\"Maori, New Zealand\" />\r\n  <string key=\"arn-CL\" value=\"Mapudungun, Chile\" />\r\n  <string key=\"mr-IN\" value=\"Marathi, India\" />\r\n\r\n  <string key=\"moh-CA\" value=\"Mohawk, Canada\" />\r\n  <string key=\"mn-MN\" value=\"Mongolian, Cyrillic Mongolia\" />\r\n  <string key=\"nb-NO\" value=\"Norwegian Bokmål\" />\r\n  <string key=\"nn-NO\" value=\"Norwegian Nynorsk, Norway\" />\r\n  <string key=\"fa-IR\" value=\"Persian, Iran\" />\r\n  <string key=\"pl-PL\" value=\"Polish, Poland\" />\r\n  <string key=\"pt-BR\" value=\"Portuguese, Brazil\" />\r\n  <string key=\"pt-PT\" value=\"Portuguese, Portugal\" />\r\n  <string key=\"pa-IN\" value=\"Punjabi, India\" />\r\n\r\n  <string key=\"quz-BO\" value=\"Quechua, Bolivia\" />\r\n  <string key=\"quz-EC\" value=\"Quechua, Ecuador\" />\r\n  <string key=\"quz-PE\" value=\"Quechua, Peru\" />\r\n  <string key=\"ro-RO\" value=\"Romanian, Romania\" />\r\n  <string key=\"rm-CH\" value=\"Romansh, Switzerland\" />\r\n  <string key=\"ru-RU\" value=\"Russian, Russia\" />\r\n  <string key=\"smn-FI\" value=\"Sami (Inari) (Finland)\" />\r\n  <string key=\"smj-NO\" value=\"Sami (Lule) (Norway)\" />\r\n  <string key=\"smj-SE\" value=\"Sami (Lule) (Sweden)\" />\r\n\r\n  <string key=\"se-FI\" value=\"Sami (Northern) (Finland)\" />\r\n  <string key=\"se-NO\" value=\"Sami (Northern) (Norway)\" />\r\n  <string key=\"se-SE\" value=\"Sami\" />\r\n  <string key=\"sms-FI\" value=\"Sami (Skolt) (Finland)\" />\r\n  <string key=\"sma-NO\" value=\"Sami (Southern) (Norway)\" />\r\n  <string key=\"sma-SE\" value=\"Sami (Southern) (Sweden)\" />\r\n  <string key=\"sa-IN\" value=\"Sanskrit, India\" />\r\n\r\n  <string key=\"sr-Cyrl-BA\" value=\"Serbian, Cyrillic (Bosnia and Herzegovina)\" />\r\n  <string key=\"sr-Cyrl-ME\" value=\"Serbian, Cyrillic (Montenegro)\" />\r\n  <string key=\"sr-Cyrl-CS\" value=\"Serbian, Cyrillic (Serbia and Montenegro - former)\" />\r\n  <string key=\"sr-Cyrl-RS\" value=\"Serbian, Cyrillic (Serbia)\" />\r\n  <string key=\"sr-Latn-BA\" value=\"Serbian, Latin (Bosnia and Herzegovina)\" />\r\n  <string key=\"sr-Latn-ME\" value=\"Serbian, Latin (Montenegro)\" />\r\n  <string key=\"sr-Latn-CS\" value=\"Serbian, Latin (Serbia and Montenegro - former)\" />\r\n  <string key=\"sr-Latn-RS\" value=\"Serbian, Latin (Serbia)\" />\r\n\r\n  <string key=\"ns-ZA\" value=\"Sesotho sa Leboa, South Africa\" />\r\n  <string key=\"tn-ZA\" value=\"Setswana, South Africa\" />\r\n  <string key=\"sk-SK\" value=\"Slovak, Slovakia\" />\r\n  <string key=\"sl-SI\" value=\"Slovenian, Slovenia\" />\r\n  <string key=\"es-AR\" value=\"Spanish, Argentina\" />\r\n  <string key=\"es-BO\" value=\"Spanish, Bolivia\" />\r\n  <string key=\"es-CL\" value=\"Spanish, Chile\" />\r\n\r\n  <string key=\"es-CO\" value=\"Spanish, Colombia\" />\r\n  <string key=\"es-CR\" value=\"Spanish, Costa Rica\" />\r\n  <string key=\"es-DO\" value=\"Spanish, Dominican Republic\" />\r\n  <string key=\"es-EC\" value=\"Spanish, Ecuador\" />\r\n  <string key=\"es-SV\" value=\"Spanish, El Salvador\" />\r\n  <string key=\"es-GT\" value=\"Spanish, Guatemala\" />\r\n  <string key=\"es-HN\" value=\"Spanish, Honduras\" />\r\n  <string key=\"es-MX\" value=\"Spanish, Mexico\" />\r\n  <string key=\"es-NI\" value=\"Spanish, Nicaragua\" />\r\n\r\n  <string key=\"es-PA\" value=\"Spanish, Panama\" />\r\n  <string key=\"es-PY\" value=\"Spanish, Paraguay\" />\r\n  <string key=\"es-PE\" value=\"Spanish, Peru\" />\r\n  <string key=\"es-PR\" value=\"Spanish, Puerto Rico\" />\r\n  <string key=\"es-ES\" value=\"Spanish\" />\r\n  <string key=\"es-UY\" value=\"Spanish, Uruguay\" />\r\n  <string key=\"es-VE\" value=\"Spanish, Venezuela\" />\r\n  <string key=\"sv-FI\" value=\"Swedish, Finland\" />\r\n  <string key=\"sv-SE\" value=\"Swedish\" />\r\n\r\n  <string key=\"syr-SY\" value=\"Syriac, Syria\" />\r\n  <string key=\"ta-IN\" value=\"Tamil, India\" />\r\n  <string key=\"tt-RU\" value=\"Tatar, Russia\" />\r\n  <string key=\"te-IN\" value=\"Telugu, India\" />\r\n  <string key=\"th-TH\" value=\"Thai, Thailand\" />\r\n  <string key=\"tr-TR\" value=\"Turkish, Turkey\" />\r\n  <string key=\"uk-UA\" value=\"Ukrainian, Ukraine\" />\r\n  <string key=\"ur-PK\" value=\"Urdu, Islamic Republic of Pakistan\" />\r\n  <string key=\"uz-Cyrl-UZ\" value=\"Uzbek, Cyrillic Uzbekistan\" />\r\n\r\n  <string key=\"uz-Latn-UZ\" value=\"Uzbek, Latin Uzbekistan\" />\r\n  <string key=\"vi-VN\" value=\"Vietnamese, Vietnam\" />\r\n  <string key=\"cy-GB\" value=\"Welsh, United Kingdom\" />\r\n  <string key=\"xh-ZA\" value=\"Xhosa, South Africa\" />\r\n  <string key=\"zu-ZA\" value=\"Zulu, South Africa\" />\r\n\r\n  <string key=\"gsw-FR\" value=\"Alsatian, France\" />\r\n  <string key=\"am-ET\" value=\"Amharic, Ethiopia\" />\r\n  <string key=\"as-IN\" value=\"Assamese, India\" />\r\n  <string key=\"ba-RU\" value=\"Bashkir, Russia\" />\r\n  <string key=\"bn-BD\" value=\"Bengali, Bangladesh\" />\r\n  <string key=\"bn-IN\" value=\"Bengali, India\" />\r\n  <string key=\"br-FR\" value=\"Breton, France\" />\r\n  <string key=\"co-FR\" value=\"Corsican, France\" />\r\n  <string key=\"prs-AF\" value=\"Dari, Afghanistan\" />\r\n  <string key=\"en-IN\" value=\"English, India\" />\r\n  <string key=\"en-MY\" value=\"English, Malaysia\" />\r\n  <string key=\"en-SG\" value=\"English, Singapore\" />\r\n  <string key=\"ha-Latn-NG\" value=\"Hausa (Latin) (Nigeria)\" />\r\n  <string key=\"ig-NG\" value=\"Igbo, Nigeria\" />\r\n  <string key=\"iu-Cans-CA\" value=\"Inuktitut, Canada\" />\r\n  <string key=\"km-KH\" value=\"Khmer, Cambodia\" />\r\n  <string key=\"qut-GT\" value=\"K'iche, Guatemala\" />\r\n  <string key=\"rw-RW\" value=\"Kinyarwanda, Rwanda\" />\r\n  <string key=\"lo-LA\" value=\"Lao, Lao P.D.R.\" />\r\n  <string key=\"dsb-DE\" value=\"Lower Sorbian, Germany\" />\r\n  <string key=\"ml-IN\" value=\"Malayalam, India\" />\r\n  <string key=\"mn-Mong-CN\" value=\"Mongolian (Traditional Mongolian) (People's Republic of China)\" />\r\n  <string key=\"ne-NP\" value=\"Nepali, Nepal\" />\r\n  <string key=\"oc-FR\" value=\"Occitan, France\" />\r\n  <string key=\"or-IN\" value=\"Oriya, India\" />\r\n  <string key=\"ps-AF\" value=\"Pashto, Afghanistan\" />\r\n  <string key=\"nso-ZA\" value=\"Sesotho sa Leboa, South Africa\" />\r\n  <string key=\"si-LK\" value=\"Sinhala, Sri Lanka\" />\r\n  <string key=\"es-US\" value=\"Spanish, United States\" />\r\n  <string key=\"tg-Cyrl-TJ\" value=\"Tajik (Cyrillic) (Tajikistan)\" />\r\n  <string key=\"tzm-Latn-DZ\" value=\"Tamazight (Latin) (Algeria)\" />\r\n  <string key=\"bo-CN\" value=\"Tibetan, People's Republic of China\" />\r\n  <string key=\"tk-TM\" value=\"Turkmen, Turkmenistan\" />\r\n  <string key=\"ug-CN\" value=\"Uighur, People's Republic of China\" />\r\n  <string key=\"hsb-DE\" value=\"Upper Sorbian, Germany\" />\r\n  <string key=\"wo-SN\" value=\"Wolof, Senegal\" />\r\n  <string key=\"sah-RU\" value=\"Yakut, Russia\" />\r\n  <string key=\"ii-CN\" value=\"Yi, People's Republic of China\" />\r\n  <string key=\"yo-NG\" value=\"Yoruba, Nigeria\" />\r\n  \r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.EntityTokenLocked.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"LayoutLabel\" value=\"This item is currently being edited\" />\r\n  <string key=\"LockedByUsername.FieldGroupLabel\" value=\"Information\" />\r\n  <string key=\"LockedByUsername.Label\" value=\"The item is edited by:\" />\r\n\t<string key=\"LockedByUsername.Help\" value=\"Another user is editing this item. Press OK to proceed or cancel to abort.\" />\r\n\t<string key=\"SameUserHeading.Title\" value=\"You are editing this item in another tab - continue?\" />\r\n\t<string key=\"SameUserHeading.Description\" value=\"Press OK to proceed opening the item or Cancel to abort.\" />\r\n\t<string key=\"AnotherUserHeading.Title\" value=\"Another user is editing this item - continue?\" />\r\n\t<string key=\"AnotherUserHeading.Description\" value=\"If the item is changed simultaneously by multiple users changes may get lost. Press OK to proceed or cancel to abort.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.GeneratedTypes.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"TypesAreReferencing\" value=\"One or more types are referencing this type. Renaming is not possible\" />\r\n  <string key=\"TypeNameInNamespace\" value=\"The type name '{0}' appears in the namespace '{1}' - this is not allowed\" />\r\n  <string key=\"TypesNameClash\" value=\"A type with the same name already exists\" />\r\n\t<string key=\"MissingFields\" value=\"No fields added\" />\r\n\t<string key=\"TypeNameIsInvalidIdentifier\" value=\"The type name '{0}' is not a valid identifier.\" />\r\n\t<string key=\"FieldNameCannotBeUsed\" value=\"The field name '{0}' can not be used\" />\r\n  <string key=\"NameSpaceIsTypeTypeName\" value=\"The specified 'Type namespace' is already in use as a 'Type name' (namespace + name). Consider changing the name of '{0}' to '{0}.Item'.\" />\r\n\t<string key=\"NamespaceIsReserved\" value=\"Type name belongs to a reserved namespace.\" />\r\n\t<string key=\"CompileErrorWhileAddingType\" value=\"Cannot add a data type since it will cause some compilation errors.\" />\r\n\t<string key=\"CompileErrorWhileChangingType\" value=\"Cannot change a data type since it will cause some compilation errors.\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Management.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"ManageUserPermissions.ManageUserPermissionsOnBranchLabel\" value=\"Edit Permissions\" />\r\n  <string key=\"ManageUserPermissions.ManageUserPermissionsOnItemLabel\" value=\"Edit Permissions\" />\r\n  <string key=\"ManageUserPermissions.ManageGlobalUserPermissionsLabel\" value=\"User Permission Settings\" />\r\n  <string key=\"ManageUserPermissions.ManageUserPermissionsToolTip\" value=\"Manage user permissions\" />\r\n  <string key=\"DataCompositionVisabilityFacade.DefaultContainerLabel\" value=\"Metadata\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteUserStep1.LabelFieldGroup\" value=\"Delete User?\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteUserStep1.Text\" value=\"Delete the selected user?\" />\r\n  <string key=\"DeleteUserWorkflow.CascadeDeleteErrorTitle\" value=\"Cascade delete error\" />\r\n  <string key=\"DeleteUserWorkflow.CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  <string key=\"DeleteUserWorkflow.DeleteSelfTitle\" value=\"Cannot delete a user\" />\r\n  <string key=\"DeleteUserWorkflow.DeleteSelfErrorMessage\" value=\"You can not delete an account you logged in as.\" />\r\n  <string key=\"Website.Function.SelectDialog.Title\" value=\"Select Function\" />\r\n  <string key=\"Website.Widget.SelectDialog.Title\" value=\"Select Widget\" />\r\n  <string key=\"Website.ContentLink.SelectDialog.Title\" value=\"Select Page or File\" />\r\n  <string key=\"Website.Page.SelectDialog.Title\" value=\"Select Page\" />\r\n  <string key=\"Website.FrontendFile.SelectDialog.Title\" value=\"Select Frontend File\" />\r\n  <string key=\"Website.Media.SelectDialog.Title\" value=\"Select Media\" />\r\n  <string key=\"Website.Image.SelectDialog.Title\" value=\"Select Image\" />\r\n  <string key=\"Website.Folder.SelectDialog.Title\" value=\"Select Folder\" />\r\n  <string key=\"PublishingStatus.draft\" value=\"Draft\" />\r\n  <string key=\"PublishingStatus.awaitingApproval\" value=\"Awaiting Approval\" />\r\n  <string key=\"PublishingStatus.awaitingPublication\" value=\"Awaiting Publication\" />\r\n  <string key=\"PublishingStatus.published\" value=\"Published\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.LabelFieldGroup\" value=\"General settings\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.UserNameLabel\" value=\"User name\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.UserNameHelp\" value=\"User names can not be changed. This is a 'read only' field.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.PasswordLabel\" value=\"Password\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.PasswordHelp\" value=\"The password has to be more than 6 characters long.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.NameLabel\" value=\"Name\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.NameHelp\" value=\"The full name of the person using this account.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.EmailLabel\" value=\"Email\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.EmailHelp\" value=\"The e-mail address of the user (optional).\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.GroupLabel\" value=\"Folder\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.GroupHelp\" value=\"If you enter a folder name that does not already exist a new folder will be created.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.LabelLocalizationFieldGroup\" value=\"C1 Console Localization\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.CultureLabel\" value=\"Display Preferences\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.CultureHelp\" value=\"Display for time, date, and number formats within the console\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.C1ConsoleLanguageLabel\" value=\"Console Language Preferences\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.C1ConsoleLanguageHelp\" value=\"Language displayed within your console for labels, help texts, dialogs, etc. The available options are limited to language packages installed. See Composite.Localization packages for more language options.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveFieldLabel\" value=\"Perspectives\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveMultiSelectLabel\" value=\"Visible perspectives\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActivePerspectiveMultiSelectHelp\" value=\"Select which perspectives should be visible when the user starts the C1 Console.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.GlobalPermissionsFieldLabel\" value=\"Global permissions\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.GlobalPermissionsMultiSelectLabel\" value=\"Global permissions\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.GlobalPermissionsMultiSelectHelp\" value=\"The Administrate permission grants the user access to manage user permissions and execute other administrative tasks. The Configure permission grants access to super user tasks.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.GlobalPermissions.IgnoredOwnAdministrativeRemoval\" value=\"The removal of your own administrative permission has been ignored. You still have administrative privileges.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesFieldLabel\" value=\"Data language access\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesMultiSelectLabel\" value=\"Data Languages\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActiveLocalesMultiSelectHelp\" value=\"User has access to manage data in the selected languages.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActiveLocaleLabel\" value=\"Active content language\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActiveLocaleHelp\" value=\"The content language this user will edit.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.ActiveLocaleNotChecked\" value=\"The selected language is not checked in the data language section.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.NoActiveLocaleSelected\" value=\"You must select at least one active language.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.GenerelTabLabel\" value=\"General\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.PermissionsTabLabel\" value=\"Permissions\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.PerspectivesTabLabel\" value=\"Perspectives\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.UserGroupsFieldLabel\" value=\"User Groups\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.UserGroupsMultiSelectHelp\" value=\"Select the user groups that the selected user should be a member of.\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.IsLockedLabel\" value=\"Is Locked\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.IsLockedItemLabel\" value=\"User can not log in\" />\r\n  <string key=\"Website.Forms.Administrative.EditUserStep1.IsLockedHelp\" value=\"When checked the user will be forbidden from logging in.\" />\r\n  <string key=\"EditUserWorkflow.EditErrorTitle\" value=\"Error\" />\r\n  <string key=\"EditUserWorkflow.EditOwnAccessToSystemPerspective\" value=\"You can not delete your own access rights to 'System' perspective.\" />\r\n  <string key=\"EditUserWorkflow.LockingOwnUserAccount\" value=\"You can not lock your own account.\" />\r\n  <string key=\"UserElementProvider.RootLabel\" value=\"Users\" />\r\n  <string key=\"UserElementProvider.RootToolTip\" value=\"Users\" />\r\n  <string key=\"UserElementProvider.AddUserLabel\" value=\"Add User\" />\r\n  <string key=\"UserElementProvider.AddUserToolTip\" value=\"Add new user\" />\r\n  <string key=\"UserElementProvider.EditUserLabel\" value=\"Edit User\" />\r\n  <string key=\"UserElementProvider.EditUserToolTip\" value=\"Edit selected user\" />\r\n  <string key=\"UserElementProvider.DeleteUserLabel\" value=\"Delete User\" />\r\n  <string key=\"UserElementProvider.DeleteUserToolTip\" value=\"Delete the selected user\" />\r\n  <string key=\"UserElementProvider.ChangeOtherActiveLocaleTitle\" value=\"Warning\" />\r\n  <string key=\"UserElementProvider.ChangeOtherActiveLocaleMessage\" value=\"You have change the active language for a user that is currently logged on. The users console will be reloaded and data might be lost.\" />\r\n  <string key=\"UserElementProvider.ChangeOtherActiveLocaleDialogTitle\" value=\"Cleanup Required\" />\r\n  <string key=\"UserElementProvider.ChangeOtherActiveLocaleDialogText\" value=\"This requires a stage cleanup. Active editors will be saved and closed.\" />\r\n  <string key=\"AddNewUserWorkflow.UsernameDuplicateError\" value=\"A user with the same name already exists\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.LabelFieldGroup\" value=\"Add New User\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.UserNameLabel\" value=\"User name\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.UserNameHelp\" value=\"When you have created a new user the username cannot be changed.\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.PasswordLabel\" value=\"Password\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.PasswordHelp\" value=\"The password has to be more than 6 characters long.\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.NameLabel\" value=\"Name\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.NameHelp\" value=\"The full name of the person using this account.\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.EmailLabel\" value=\"Email address\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.EmailHelp\" value=\"The e-mail address of the user (optional).\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.GroupLabel\" value=\"Folder\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.GroupHelp\" value=\"If you enter a folder name that does not already exist a new folder will be created.\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.CultureLabel\" value=\"Display Preferences\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.CultureHelp\" value=\"Display for time, date, and number formats within the console\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.C1ConsoleLanguageLabel\" value=\"Console Language Preferences\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewUserStep1.C1ConsoleLanguageHelp\" value=\"Language displayed within your console for labels, help texts, dialogs, etc. The available options are limited to language packages installed. See Composite.Localization packages for more language options.\" />\r\n  <string key=\"UserElementProvider.MissingActiveLanguageTitle\" value=\"A language is required\" />\r\n  <string key=\"UserElementProvider.MissingActiveLanguageMessage\" value=\"To create a user a language is required, but no languages have been added yet. You can add one under the System perspective.\" />\r\n  <string key=\"UserElementProvider.UserLoginIsAlreadyUsed\" value=\"User with the same login already exist\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderTypeLabel\" value=\"Add Datafolder\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderTypeToolTip\" value=\"Add Datafolder\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddAssociatedDataLabel\" value=\"Add Data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddAssociatedDataToolTip\" value=\"Add data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditAssociatedDataLabel\" value=\"Edit Data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditAssociatedDataToolTip\" value=\"Edit data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteAssociatedDataLabel\" value=\"Delete Data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteAssociatedDataToolTip\" value=\"Delete data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DuplicateAssociatedDataLabel\" value=\"Duplicate Data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DuplicateAssociatedDataToolTip\" value=\"Duplicate data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.LocalizeData\" value=\"Localize\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.LocalizeDataToolTip\" value=\"Localize data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DisabledData\" value=\"Not yet approved or published\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExSelectType.FieldLabel\" value=\"Add Datafolder\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExSelectType.SelectorLabel\" value=\"Datafolder type\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExSelectType.SelectorHelp\" value=\"Create new datatype or use an existing datatype (if present).\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelNewType\" value=\"Settings\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeName\" value=\"Type name\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeName\" value=\"The technical name of the data type (ex. Product). This is used to identify this type in code and should not be changed once used externally.\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeNamespace\" value=\"Type namespace\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeNamespace\" value=\"The namespace (module / category name) of the type. This is used to identify this type in code and should not be changed.\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelTypeTitle\" value=\"Title\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HelpTypeTitle\" value=\"Use this entry to specify a user friendly name. You can change this field as you like.\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.LabelFields\" value=\"Fields\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.ServicesLabel\" value=\"Services\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HasPublishing\" value=\"Has publishing\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.HasLocalization\" value=\"Has localization\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoTypesTitle\" value=\"No page datafolders exists\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoTypesMessage\" value=\"No page datafolders have been created yet. You can create a page datafolder in the 'Data' perspective.\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoUnusedTypesTitle\" value=\"No Unused Page Datafolders Exist\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExWorkflow.NoUnusedTypesMessage\" value=\"All available page datafolders have been added already. To create a new page datafolder go to the 'Data' perspective.\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderExCreateNewType.ErrorTitle\" value=\"Error\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderSelectType.FieldLabel\" value=\"Select existing data folder type to add\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderSelectType.SelectorLabel\" value=\"Existing data folder types\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddDataFolderSelectType.SelectorHelp\" value=\"Select existing data folder type to add\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.RemoveMetaDataTypeLabel\" value=\"Remove Metadata Field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.RemoveMetaDataTypeToolTip\" value=\"Remove metadata field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.LabelFieldGroup\" value=\"Remove Datafolder from Page\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.FieldGroupLabel\" value=\"Data cleanup\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataLabel\" value=\"Delete data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataCheckBoxLabel\" value=\"Yes, delete folder data\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow.DeleteFolderDataHelp\" value=\"If you want data in this folder to stay in the database, you should uncheck this option.\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataSelectType.LayoutLabel\" value=\"Add Metadata Field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataTypeLabel\" value=\"Add Metadata Field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataTypeToolTip\" value=\"Add metadata field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataSelectType.FieldLabel\" value=\"Select existing metadata type to add\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataSelectType.SelectorLabel\" value=\"Existing metadata types\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataSelectType.SelectorHelp\" value=\"Select existing metadata type to add\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.NoTypesTitle\" value=\"No page metadata types exists\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.NoTypesMessage\" value=\"No page metatypes have been created yet. You can create a Page metatype in the 'Data' perspective.\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.NamingFieldLabel\" value=\"Metadata field group naming\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupNameLabel\" value=\"Name\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupNameHelp\" value=\"Enter a unique name identifying this metadata field group\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupLabelLabel\" value=\"Label\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.FieldGroupLabelHelp\" value=\"Enter a user friendly label for this metadata field group\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.VisabilityFieldLabel\" value=\"Metadata field group visibility\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.ContainerSelectorLabel\" value=\"Tab\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.ContainerSelectorHelp\" value=\"Select the tab for which this metadata should exists\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.StartDisplaySelectorLabel\" value=\"Start display from\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.StartDisplaySelectorHelp\" value=\"Start display from\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.InheritDisplaySelectorLabel\" value=\"Inherit display\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataCreateFieldGroup.InheritDisplaySelectorHelp\" value=\"Inherit display\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.NoItems.Title\" value=\"The metadata field group has no items in scope\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.NoItems.Description\" value=\"There are currently no items within the specified display range. Press Previous to change the display range or Finish to create the metadata field group.\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption0\" value=\"This item\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption1\" value=\"Children\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption2\" value=\"2nd generation descendants\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption3\" value=\"3rd generation descendants\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption4\" value=\"4th generation descendants\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.StartDisplayOption5\" value=\"5th generation descendants\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption0\" value=\"Do not inherit\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption1\" value=\"Inherit 1 generation\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption2\" value=\"Inherit 2 generations\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption3\" value=\"Inherit 3 generations\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.InheritDisplayOption4\" value=\"Always inherit\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.AddMetaDataWorkflow.FieldGroupNameNotValid\" value=\"The field group name is in use\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteMetaDataSelectType.LayoutLabel\" value=\"Remove Metadata Field Group\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.FieldLabel\" value=\"Select a metadata field group to remove\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.SelectorLabel\" value=\"Field group\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteMetaDataSelectFieldGroupName.SelectorHelp\" value=\"Select a metadata field group to remove\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataTypeLabel\" value=\"Edit Metadata Field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataTypeToolTip\" value=\"Edit metadata field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.Layout.Label\" value=\"Edit Page Metadata Field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.FieldGroup.Label\" value=\"Page metadata field settings\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.LabelTextBox.Label\" value=\"Label\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.LabelTextBox.Help\" value=\"The label of the metadata field. Used when editing pages\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerSelector.Label\" value=\"Tab\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerSelector.Help\" value=\"Select the tab for which this metadata should exists\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.StartDisplaySelectorLabel\" value=\"Start display from\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.StartDisplaySelectorHelp\" value=\"Start display from\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.InheritDisplaySelectorLabel\" value=\"Inherit display\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.InheritDisplaySelectorHelp\" value=\"Inherit display\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataDefinitionSelector.Label\" value=\"Metadata field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataDefinitionSelector.Help\" value=\"Select the metadata field to edit\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoMetaDataDefinitionsExists.Title\" value=\"No Metadata Fields to Edit\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoMetaDataDefinitionsExists.Message\" value=\"There is no metadata fields defined on this item to edit\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataFieldNameAlreadyUsed\" value=\"The metadata type is used another place with same name but different label\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.MetaDataContainerChangeNotAllowed\" value=\"There exists one or more definitions with the same name, container change is not allowed\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoDefaultValuesNeeded.Title\" value=\"Press finish to save\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.EditMetaDataWorkflow.NoDefaultValuesNeeded.Description\" value=\"All required information has been gathered. Press Finish to update the metadata field\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow.NoDefinedTypesExists.Title\" value=\"No Metadata Fields to Remove\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.DeleteMetaDataWorkflow.NoDefinedTypesExists.Message\" value=\"There is no metadata fields defined on this item to remove\" />\r\n  <string key=\"DeleteAssociatedDataWorkflow.CascadeDeleteErrorTitle\" value=\"Cascade delete error\" />\r\n  <string key=\"DeleteAssociatedDataWorkflow.CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelNewType\" value=\"Settings\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeName\" value=\"Type name\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeName\" value=\"The name of the new type that you are creating (ex. product)\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeNamespace\" value=\"Type namespace\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeNamespace\" value=\"The name of the module, category or namespace that you are creating\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelTypeTitle\" value=\"Title\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HelpTypeTitle\" value=\"Use this entry to specify a user friendly name\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.LabelFields\" value=\"Fields\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.ServicesLabel\" value=\"Services\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HasVersioning\" value=\"Has versioning\" />\r\n  <string key=\"Website.Forms.Administrative.CreateNewAssociatedTypeStep1.HasPublishing\" value=\"Has publishing\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteAssociatedTypeDataStep1.FieldGroupLabel\" value=\"Delete Data?\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteAssociatedTypeDataStep1.Text\" value=\"Delete data?\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedDataWorkflow.FieldGroupLabel\" value=\"Add page data\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedDataWorkflow.TypeSelectorLabel\" value=\"Select a datatype to add\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedDataWorkflow.TypeSelectorHelp\" value=\"Select one of the existing types to add data to\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeWorkflow.FieldGroupLabel\" value=\"Add page datatype\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeAddExisting.TypeSelectorLabel\" value=\"Select type to add\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeAddExisting.TypeSelectorHelp\" value=\"Select one of the existing types in the system\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeAddExistingSelectForeignKey.KeySelectorLabel\" value=\"Select a foreign key\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeAddExistingSelectForeignKey.KeySelectorHelp\" value=\"Select one of the fields from the type to use as foreign key\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeAddingTypeSelection.KeySelectorLabel\" value=\"Add a\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeAddingTypeSelection.KeySelectorHelp\" value=\"Creating a new type or using an existing type\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeAssociationTypeSelection.KeySelectorLabel\" value=\"Select type:\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeAssociationTypeSelection.KeySelectorHelp\" value=\"Regular data is a new type that are created under a page. Metadata is a new field that are created on a page\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleNameLabel\" value=\"Rule name\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleNameHelp\" value=\"Rule name are saved with the metadata and are a part of the metadata key. The name must be unique.\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleLabelLabel\" value=\"Rule label\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeRuleHelpHelp\" value=\"Rule label is used as a user friendly name for the instance. Can be localized\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ContainerKeySelectorLabel\" value=\"Select composition container\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ContainerKeySelectorHelp\" value=\"Select container for the new rule.\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeKeySelectorLabel\" value=\"Select composition scope\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeCompositionScopeSelection.ScopeKeySelectorHelp\" value=\"Select the scope for the new composition\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeLevelsScopeSelection.LevelsLabel\" value=\"Levels\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeLevelsScopeSelection.LevelsHelp\" value=\"The depth of sub pages in which the composition will be visible\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AssociationTypeLabel\" value=\"Confirm new datatype:\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AssociationTypeHelp\" value=\"Metadata is a new field that are created on a page\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleNameLabel\" value=\"Composition scope rule name\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleNameHelp\" value=\"Rule name are saved with the metadata and are a part of the metadata key. The name must be unique.\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleLabelLabel\" value=\"Composition scope rule label\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeRuleHelpHelp\" value=\"Rule label is used as a user friendly name for the instance. Can be localized\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeLabel\" value=\"Composition scope\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.CompositionScopeHelp\" value=\"This is the scope in which the new composition will be visible when editing pages\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AddingTypeLabel\" value=\"Adding type\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.AddingTypeHelp\" value=\"Create a new type or use an existing type\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ExistingTypeNameLabel\" value=\"Existing type name\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ExistingTypeNameHelp\" value=\"The name of the selected existing type in the system to use\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ForeignKeyFieldNameLabel\" value=\"Foreign key field name\" />\r\n  <string key=\"Website.Forms.Administrative.AddAssociatedTypeFinalInfo.ForeignKeyFieldNameHelp\" value=\"The name of the field of the existing type to use as a foreign key \" />\r\n  <string key=\"AssociatedDataElementProviderHelper.RemoveAssociatedTypeLabel\" value=\"Remove Datafolder\" />\r\n  <string key=\"AssociatedDataElementProviderHelper.RemoveAssociatedTypeToolTip\" value=\"Remove datafolder\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedType.FieldGroupLabel\" value=\"Remove page datatype\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedTypeFinalInfo.AssociationTypeLabel\" value=\"Remove page datatype\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedTypeFinalInfo.CompositionScopeRuleNameLabel\" value=\"Composition scope rule name\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedTypeSelectRuleName.KeySelectorLabel\" value=\"Select a rule\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedTypeSelectRuleName.KeySelectorHelp\" value=\"The name of the rule to remove\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedTypeSelectAssociationType.KeySelectorLabel\" value=\"Select page datatype\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedTypeSelectAssociationType.KeySelectorHelp\" value=\"\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedTypeSelectType.TypeSelectorLabel\" value=\"Select datatype\" />\r\n  <string key=\"Website.Forms.Administrative.RemoveAssociatedTypeSelectType.TypeSelectorHelp\" value=\"Select one of the existing types\" />\r\n  <string key=\"VirtualElementProviderElementProvider.ID01\" value=\"Virtual root\" />\r\n  <string key=\"VirtualElementProviderElementProvider.PermissionsPerspective\" value=\"Users and Permissions\" />\r\n  <string key=\"VirtualElementProviderElementProvider.UserPerspective\" value=\"Users\" />\r\n  <string key=\"VirtualElementProviderElementProvider.DeveloperApplicationPerspective\" value=\"Developer Apps\" />\r\n  <string key=\"VirtualElementProviderElementProvider.UserGroupPerspective\" value=\"User Groups\" />\r\n  <string key=\"VirtualElementProviderElementProvider.SystemPerspective\" value=\"System\" />\r\n  <string key=\"VirtualElementProviderElementProvider.ContentPerspective\" value=\"Content\" />\r\n  <string key=\"VirtualElementProviderElementProvider.DatasPerspective\" value=\"Data\" />\r\n  <string key=\"VirtualElementProviderElementProvider.DesignPerspective\" value=\"Layout\" />\r\n  <string key=\"VirtualElementProviderElementProvider.FunctionsPerspective\" value=\"Functions\" />\r\n  <string key=\"VirtualElementProviderElementProvider.MediaFilePerspective\" value=\"All Media Files\" />\r\n  <string key=\"VirtualElementProviderElementProvider.MediaPerspective\" value=\"Media\" />\r\n  <string key=\"VirtualElementProviderElementProvider.ReadOnlyFunctionPerspective\" value=\"All Functions\" />\r\n  <string key=\"VirtualElementProviderElementProvider.ReadOnlyWidgetFunctionPerspective\" value=\"All Widget Functions\" />\r\n  <string key=\"VirtualElementProviderElementProvider.SqlFunctionPerspective\" value=\"SQL Functions\" />\r\n  <string key=\"VirtualElementProviderElementProvider.XsltBasedFunctionPerspective\" value=\"Xslt Based Functions\" />\r\n  <string key=\"VirtualElementProviderElementProvider.RootActions.SendMessageLabel\" value=\"Broadcast Message\" />\r\n  <string key=\"VirtualElementProviderElementProvider.RootActions.SendMessageTooltip\" value=\"Send a message to all running consoles\" />\r\n  <string key=\"VirtualElementProviderElementProvider.RootActions.SetTimezoneLabel\" value=\"Time Zone Settings\" />\r\n  <string key=\"VirtualElementProviderElementProvider.RootActions.SetTimezoneTooltip\" value=\"Time zone to be displayed for all users within the console\" />\r\n  <string key=\"VirtualElementProviderElementProvider.RootActions.GlobalSetting\" value=\"Global Settings\" />\r\n\t<string key=\"VirtualElementProviderElementProvider.RootActions.RebuildSearchIndexLabel\" value=\"Rebuild search index\" />\r\n\t<string key=\"VirtualElementProviderElementProvider.RootActions.RebuildSearchIndexTooltip\" value=\"Initiate search index rebuilding\" />\r\n\t<string key=\"VirtualElementProviderElementProvider.RootActions.RestartApplicationLabel\" value=\"Restart server\" />\r\n  <string key=\"VirtualElementProviderElementProvider.RootActions.RestartApplicationTooltip\" value=\"Restart the server\" />\r\n  <string key=\"SendMessageToConsolesWorkflow.Layout.Label\" value=\"Broadcast Message to All {applicationname} Consoles\" />\r\n  <string key=\"SendMessageToConsolesWorkflow.TitleTextBox.Label\" value=\"Title\" />\r\n  <string key=\"SendMessageToConsolesWorkflow.TitleTextBox.Help\" value=\"Dialog title of broadcast message\" />\r\n  <string key=\"SendMessageToConsolesWorkflow.MessageTextArea.Label\" value=\"Message\" />\r\n  <string key=\"SendMessageToConsolesWorkflow.MessageTextArea.Help\" value=\"The message to broadcast\" />\r\n  <string key=\"SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedTitle\" value=\"Time Zone Updated\" />\r\n  <string key=\"SendMessageToConsolesWorkflow.SuccessMessage.TimezoneChangedMessage\" value=\"Time zone has been successfully updated\" />\r\n  <string key=\"SetTimezoneWorkflow.Layout.Label\" value=\"Set Time Zone Display\" />\r\n  <string key=\"SetTimezoneWorkflow.TitleTextBox.Label\" value=\"Select Time Zone\" />\r\n  <string key=\"SetTimezoneWorkflow.TitleTextBox.Help\" value=\"Time zone to be displayed for all users within the console. The console will restart once time zone updated. Any unsaved changes will be lost.\" />\r\n  <string key=\"SetTimezoneWorkflow.WarningText.Text\" value=\"Time zone update requires a console restart. Any unsaved changes will be lost.\" />\r\n  <string key=\"LoginWebRequestHandler.Login\" value=\"Login\" />\r\n  <string key=\"LoginWebRequestHandler.Header\" value=\"Login to {0}\" />\r\n  <string key=\"LoginWebRequestHandler.LoginFailed\" value=\"Incorrect user name or password\" />\r\n  <string key=\"LoginWebRequestHandler.Password\" value=\"Password\" />\r\n  <string key=\"LoginWebRequestHandler.Username\" value=\"Username\" />\r\n  <string key=\"LoginWebRequestHandler.LogInAsOtherUser\" value=\"Log in as another user.\" />\r\n  <string key=\"LoginWebRequestHandler.WrongUserNameOrPassword\" value=\"Wrong username or password.\" />\r\n  <string key=\"LoginWebRequestHandler.UserNameNotRegistered\" value=\"The supplied Windows login, {0}\\{1} is not registered in the user database. You must use a different login.\" />\r\n  <string key=\"DataInterfaceValidator.TypeNotAnInterface\" value=\"The type {0} is not an interface.\" />\r\n  <string key=\"DataInterfaceValidator.TypeDoesNotImplementInterface\" value=\"The interface type {0} does not implement the interface {1}.\" />\r\n  <string key=\"DataInterfaceValidator.NotAcceptedType\" value=\"The property {0} on the interface type {1} is not a accepted type.\" />\r\n  <string key=\"DataInterfaceValidator.NotValidIDataInterface\" value=\"The interface {0} is not a valid IData interface.\" />\r\n  <string key=\"DeleteMediaFileWorkflow.CascadeDeleteErrorTitle\" value=\"Cascade delete error\" />\r\n  <string key=\"DeleteMediaFileWorkflow.CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  <string key=\"DeleteMediaFolderWorkflow.CascadeDeleteErrorTitle\" value=\"Cascade delete error\" />\r\n  <string key=\"DeleteMediaFolderWorkflow.CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  <string key=\"MediaFileProviderElementProvider.RootToolTip\" value=\"Add folders and files to the media archive\" />\r\n  <string key=\"MediaFileProviderElementProvider.AddMediaFolder\" value=\"Add Folder\" />\r\n  <string key=\"MediaFileProviderElementProvider.AddMediaFolderToolTip\" value=\"Add new media folder\" />\r\n  <string key=\"MediaFileProviderElementProvider.AddMediaFile\" value=\"Upload File\" />\r\n  <string key=\"MediaFileProviderElementProvider.AddMediaFileToolTip\" value=\"Add new media file\" />\r\n  <string key=\"MediaFileProviderElementProvider.DeleteMediaFile\" value=\"Delete File\" />\r\n  <string key=\"MediaFileProviderElementProvider.DeleteMediaFileToolTip\" value=\"Delete the selected media file\" />\r\n  <string key=\"MediaFileProviderElementProvider.DeleteMediaFolder\" value=\"Delete Folder\" />\r\n  <string key=\"MediaFileProviderElementProvider.DeleteMediaFolderToolTip\" value=\"Delete the media folder and all items under it.\" />\r\n  <string key=\"MediaFileProviderElementProvider.Download\" value=\"Download\" />\r\n  <string key=\"MediaFileProviderElementProvider.DownloadToolTip\" value=\"Download file\" />\r\n  <string key=\"MediaFileProviderElementProvider.EditMediaFile\" value=\"File Properties\" />\r\n  <string key=\"MediaFileProviderElementProvider.EditMediaFileToolTip\" value=\"Rename the selected media file\" />\r\n  <string key=\"MediaFileProviderElementProvider.EditMediaFileTextContent\" value=\"Edit text\" />\r\n  <string key=\"MediaFileProviderElementProvider.EditMediaFileTextContentToolTip\" value=\"Edit text content\" />\r\n  <string key=\"MediaFileProviderElementProvider.EditImage\" value=\"Image Editor\" />\r\n  <string key=\"MediaFileProviderElementProvider.EditImageToolTip\" value=\"Open the selected media file in the image editor\" />\r\n  <string key=\"MediaFileProviderElementProvider.EditMediaFolder\" value=\"Folder Properties\" />\r\n  <string key=\"MediaFileProviderElementProvider.EditMediaFolderToolTip\" value=\"Edit media folder properties\" />\r\n  <string key=\"MediaFileProviderElementProvider.ChangeMediaFile\" value=\"Replace File\" />\r\n  <string key=\"MediaFileProviderElementProvider.ChangeMediaFileToolTip\" value=\"Replace the selected with another media file\" />\r\n  <string key=\"MediaFileProviderElementProvider.UploadZipFile\" value=\"Upload Multiple\" />\r\n  <string key=\"MediaFileProviderElementProvider.UploadZipFileToolTip\" value=\"Upload Zip file\" />\r\n  <string key=\"MediaFileProviderElementProvider.MediaFileItemToolTip\" value=\"Media Item\" />\r\n  <string key=\"MediaFileProviderElementProvider.OrganizedFilesAndFoldersToolTip\" value=\"Organize folders and files\" />\r\n  <string key=\"MediaFileProviderElementProvider.ErrorMessageTitle\" value=\"Error\" />\r\n  <string key=\"MediaFileProviderElementProvider.FileAlreadyExistsMessage\" value=\"File '{0}' already exists in folder '{1}'\" />\r\n  <string key=\"UploadNewMediaFileWorkflow.UploadFailure\" value=\"Failure\" />\r\n  <string key=\"UploadNewMediaFileWorkflow.UploadFailureMessage\" value=\"The uploaded file must be of the same type as the original. The file you uploaded is of a different type.\" />\r\n  <string key=\"RelationshipGraphActionExecutor.ShowGraph\" value=\"Show Graph\" />\r\n  <string key=\"RelationshipGraphActionExecutor.ShowGraphToolTip\" value=\"Show relationship graph\" />\r\n  <string key=\"RelationshipGraphActionExecutor.ShowOrientedGraph\" value=\"Show Oriented Graph\" />\r\n  <string key=\"RelationshipGraphActionExecutor.ShowOrientedGraphToolTip\" value=\"Show Oriented Relationship graph\" />\r\n  <string key=\"ShowElementInformationActionExecutor.ShowElementInformation.Label\" value=\"Show Element Information\" />\r\n  <string key=\"ShowElementInformationActionExecutor.ShowElementInformation.ToolTip\" value=\"Show Element Information\" />\r\n  <string key=\"RelationshipGraphActionExecutor.Search\" value=\"Search elements\" />\r\n  <string key=\"RelationshipGraphActionExecutor.SearchToolTip\" value=\"Search for elements\" />\r\n  <string key=\"RelationshipGraphActionExecutor.SearchElements\" value=\"Search elements\" />\r\n  <string key=\"RelationshipGraphActionExecutor.SearchElementsToolTip\" value=\"Search for elements\" />\r\n  <!-- WEBSITE -->\r\n  <string key=\"Website.General.LabelVersionNumber\" value=\"Version No.\" />\r\n  <string key=\"Website.Application.DialogReload.Title\" value=\"Restart?\" />\r\n  <string key=\"Website.Application.DialogReload.Text\" value=\"Restart {applicationname}? All unsaved changes will be lost.\" />\r\n  <string key=\"WebSite.Application.DialogSaveResource.Title\" value=\"Save Resource?\" />\r\n  <string key=\"WebSite.Application.DialogSaveResource.Text\" value=\"&quot;${resourcename}&quot; has been modified. Save changes?\" />\r\n  <string key=\"Website.Dialogs.SaveAll.LabelSaveResources\" value=\"Save Resources?\" />\r\n  <string key=\"Website.Dialogs.SaveAll.LabelUnsavedResources\" value=\"Unsaved resources\" />\r\n  <string key=\"Website.Dialogs.LabelYes\" value=\"Yes\" />\r\n  <string key=\"Website.Dialogs.LabelNo\" value=\"No\" />\r\n  <string key=\"Website.Dialogs.LabelAccept\" value=\"OK\" />\r\n  <string key=\"Website.Dialogs.LabelCancel\" value=\"Cancel\" />\r\n  <string key=\"Website.Dialogs.LabelDisclosure\" value=\"More Info\" />\r\n  <string key=\"Website.Dialogs.About.Title\" value=\"About {applicationname}\" />\r\n  <string key=\"Website.Dialogs.About.LabelCredits\" value=\"Credits\" />\r\n  <string key=\"Website.Dialogs.About.LabelBack\" value=\"Back\" />\r\n  <string key=\"Website.Dialogs.About.LabelCredits2\" value=\"Credits\" />\r\n  <string key=\"Website.Dialogs.NoAccessTitle\" value=\"No access\" />\r\n  <string key=\"Website.Dialogs.NoAccessText\" value=\"You have not been granted access rights to the system. Please contact your administrator.\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.Unit\" value=\"Unit\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.Width\" value=\"Width\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.Height\" value=\"Height\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.LabelScaleImage\" value=\"Scale Image\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.LabelDimensions\" value=\"Dimensions\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.LabelImageSize\" value=\"Image Size\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.LabelFixedRatio\" value=\"Fixed Ratio\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.LabelFreeResize\" value=\"Free Resize\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.LabelPixels\" value=\"Pixels\" />\r\n  <string key=\"Website.Dialogs.ImageEditor.ScaleImage.LabelPercent\" value=\"Percent\" />\r\n  <string key=\"Website.Dialogs.Options.LoginScreen\" value=\"Login screen\" />\r\n  <string key=\"Website.Dialogs.Options.LabelOptions\" value=\"Options\" />\r\n  <string key=\"Website.Dialogs.Options.LabelGeneral\" value=\"General\" />\r\n  <string key=\"Website.Dialogs.Options.LabelAdvanced\" value=\"Advanced\" />\r\n  <string key=\"Website.Dialogs.Options.LabelLoginPreferences\" value=\"Login Preferences\" />\r\n  <string key=\"Website.Dialogs.Options.LabelFakeLoginScreen\" value=\"Fake login screen\" />\r\n  <string key=\"Website.Dialogs.Options.LabelNoLoginScreen\" value=\"No login screen\" />\r\n  <string key=\"Website.Dialogs.WebServices.Error\" value=\"Error in web service method \" />\r\n  <string key=\"Website.Dialogs.WebServices.LabelWebServiceError\" value=\"Web Service Error\" />\r\n  <string key=\"Website.Dialogs.SystemTree.DetailedPaste.Title\" value=\"Insert Where?\" />\r\n  <string key=\"Website.Dialogs.SystemTree.DetailedPaste.LabelPosition\" value=\"Position\" />\r\n  <string key=\"Website.Dialogs.SystemTree.DetailedPaste.LabelInsertBefore\" value=\"Insert before\" />\r\n  <string key=\"Website.Dialogs.SystemTree.DetailedPaste.LabelInsertAfter\" value=\"Insert after\" />\r\n  <string key=\"Website.Dialogs.EditFunction.BasicView\" value=\"Basic view\" />\r\n  <string key=\"Website.Dialogs.EditFunction.AdvancedView\" value=\"Advanced view\" />\r\n  <string key=\"Website.Dialogs.EditFunction.BasicView.NoParameters\" value=\"This function has no parameters\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelTitle\" value=\"Edit image\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFile\" value=\"File\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelSave\" value=\"Save\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelSaveAs\" value=\"Save As...\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRevert\" value=\"Revert\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelView\" value=\"View\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoom\" value=\"Zoom\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoomIn\" value=\"Zoom In\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelZoomOut\" value=\"Zoom Out\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label800\" value=\"800%\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label400\" value=\"400%\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label200\" value=\"200%\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label100\" value=\"100%\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label50\" value=\"50%\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label25\" value=\"25%\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.Label12\" value=\"12%\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelImage\" value=\"Image\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelTransform\" value=\"Transform\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFlipHorizontal\" value=\"Flip Horizontally\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelFlipVertical\" value=\"Flip Vertically\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate90CW\" value=\"Rotate 90 Degrees CW\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate90CCW\" value=\"Rotate 90 Degrees CCW\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelRotate180\" value=\"Rotate 180 Degrees\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelScale\" value=\"Scale Image...\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.LabelCrop\" value=\"Crop Image\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBox.ToolTipSelect\" value=\"Select\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBox.ToolTipZoom\" value=\"Zoom\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelSave\" value=\"Save\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelScale\" value=\"Scale image\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelCrop\" value=\"Crop image\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelUndo\" value=\"Undo\" />\r\n  <string key=\"Website.Content.Views.Editors.ImageEditor.ImageEditor.ToolBar.LabelRedo\" value=\"Redo\" />\r\n  <string key=\"Website.Content.Views.Editors.PermissionEditor.LabelTitle\" value=\"Permissions\" />\r\n  <string key=\"Website.Content.Views.Editors.PermissionEditor.LabelTabUsers\" value=\"Users\" />\r\n  <string key=\"Website.Content.Views.Editors.PermissionEditor.LabelTabUserGroups\" value=\"User Groups\" />\r\n  <string key=\"Website.Content.Views.Editors.PermissionEditor.LabelButtonSave\" value=\"Save\" />\r\n  <string key=\"Website.Content.Views.Help.ToolTipBack\" value=\"Go back one page\" />\r\n  <string key=\"Website.Content.Views.Help.ToolTipForward\" value=\"Go forward one page\" />\r\n  <string key=\"Website.Content.Views.Help.ToolTipRefresh\" value=\"Refresh page\" />\r\n  <string key=\"Website.Content.Views.Help.LabelContents\" value=\"Contents\" />\r\n  <string key=\"Website.Content.Views.Help.ToolTipContents\" value=\"Help contents\" />\r\n  <string key=\"Website.Content.Views.SystemView.ToolTipCollapseAll\" value=\"Collapse All\" />\r\n  <string key=\"Website.Content.Views.SystemView.ToolTipLinkWithEditor\" value=\"Link with Editor\" />\r\n  <string key=\"Website.Content.Views.Search.Search.LabelNewSearch\" value=\"New Search...\" />\r\n  <string key=\"Website.Content.Views.ViewSource.LabelFormatted\" value=\"Formatted\" />\r\n  <string key=\"Website.Content.Views.ViewSource.LabelRaw\" value=\"Raw\" />\r\n  <string key=\"ServerLog.Element.Label\" value=\"Server Log\" />\r\n  <string key=\"ServerLog.Element.Tooltip\" value=\"The server log contain security and system health related messages.\" />\r\n  <string key=\"ServerLog.Element.View.Label\" value=\"View Server Log\" />\r\n  <string key=\"ServerLog.Element.View.Tooltip\" value=\"View recent server events\" />\r\n  <string key=\"ServerLog.LabelTitle\" value=\"Server Log\" />\r\n  <string key=\"ServerLog.LabelButtonDeleteOld\" value=\"Delete old\" />\r\n  <string key=\"ServerLog.LabelButtonRefresh\" value=\"Refresh\" />\r\n  <string key=\"ServerLog.EmptyLabel\" value=\"No log data available...\" />\r\n  <string key=\"ServerLog.LogEntriesRemovedBrowserViewLabel\" value=\"Only the {0} most recent log entries are shown. Open the log for more entries.\" />\r\n  <string key=\"ServerLog.LogEntriesRemovedLabel\" value=\"Only the {0} most recent log entries are shown. {1} entries exists for the current search. Either narrow the search or use the log viewer tool from http://docs.composite.net/Configuration/Logging for full log access.\" />\r\n  <string key=\"ServerLog.LogEntry.DateLabel\" value=\"Date\" />\r\n  <string key=\"ServerLog.LogEntry.MessageLabel\" value=\"Message\" />\r\n  <string key=\"ServerLog.LogEntry.TitleLabel\" value=\"Title\" />\r\n  <string key=\"ServerLog.LogEntry.EventTypeLabel\" value=\"EventType\" />\r\n  <string key=\"ServerLog.Severity.Verbose\" value=\"Verbose\" />\r\n  <string key=\"ServerLog.Severity.Information\" value=\"Information\" />\r\n  <string key=\"ServerLog.Severity.Warning\" value=\"Warning\" />\r\n  <string key=\"ServerLog.Severity.Error\" value=\"Error\" />\r\n  <string key=\"ServerLog.Severity.Critical\" value=\"Critical\" />\r\n  <string key=\"FunctionDocumentation.LabelButtonRefresh\" value=\"Refresh\" />\r\n  <string key=\"FunctionDocumentation.LabelButtonPrint\" value=\"Print\" />\r\n  <string key=\"Website.FlowUICompleted.ExecutionEndedTitle\" value=\"Execution Ended\" />\r\n  <string key=\"Website.FlowUICompleted.ExecutionEndedMessage\" value=\"The action executed in this window has ended.\" />\r\n  <string key=\"Website.ServerError.ServerErrorTitle\" value=\"Server Error\" />\r\n  <string key=\"Website.ServerError.ServerErrorMessage\" value=\"An unfortunate error has occurred.\" />\r\n  <string key=\"Website.ServerError.ServerErrorDetails\" value=\"Details\" />\r\n  <string key=\"Website.LicenseViolation.LicenseViolationTitle\" value=\"License Violation\" />\r\n  <string key=\"Website.LicenseViolation.LicenseViolationMessage\" value=\"The requested action is in violates with your current license.\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelFlashOptions\" value=\"Flash options\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelHigh\" value=\"High\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelLow\" value=\"Low\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutohigh\" value=\"Autohigh\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutolow\" value=\"Autolow\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelBest\" value=\"Best\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelWindow\" value=\"Window\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelOpaque\" value=\"Opaque\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelTransparent\" value=\"Transparent\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelShowall\" value=\"Showall\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelNoborder\" value=\"Noborder\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelExactfit\" value=\"Exactfit\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutoPlay\" value=\"Auto play\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelLoop\" value=\"Loop\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelShowMenu\" value=\"Show menu\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelSWLiveConnect\" value=\"SWLiveConnect\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelQuickTimeOptions\" value=\"Quicktime options\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelLoop\" value=\"Loop\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelCache\" value=\"Cache\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelNoCorrection\" value=\"No correction\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelKioskMode\" value=\"Kiosk mode\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelPlayEveryFrame\" value=\"Play every frame\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelAutoPlay\" value=\"Auto play\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelController\" value=\"Controller\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelEnableJavaScript\" value=\"Enable Javascript\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelAutoHRef\" value=\"AutoHREF\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelTargetCache\" value=\"Target cache\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShockWaveOptions\" value=\"Shockwave options\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelHigh\" value=\"High\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelLow\" value=\"Low\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoHigh\" value=\"Autohigh\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoLow\" value=\"Autolow\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelBest\" value=\"Best\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelWindow\" value=\"Window\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelOpaque\" value=\"Opaque\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelTransparent\" value=\"Transparent\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShowAll\" value=\"Showall\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelNoBorder\" value=\"Noborder\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelExactFit\" value=\"Exactfit\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoPlay\" value=\"Auto play\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelLoop\" value=\"Loop\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShowMenu\" value=\"Show menu\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelSWLiveConnect\" value=\"SWLiveConnect\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelQuickTimeOptions\" value=\"Quicktime options\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelAutoStart\" value=\"Auto Start\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelShowMenu\" value=\"Show menu\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelInvokeURLs\" value=\"Invoke URLs\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelStretchToFit\" value=\"Stretch to fit\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelEnabled\" value=\"Enabled\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelFullScreen\" value=\"Fullscreen\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelMute\" value=\"Mute\" />\r\n  <string key=\"Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelWindowLessVideo\" value=\"Windowless video\" />\r\n  <string key=\"Website.App.LabelSave\" value=\"Save\" />\r\n  <string key=\"Website.App.LabelSaveAndPublish\" value=\"Save and Publish\" />\r\n  <string key=\"Website.App.LabelCloseTab\" value=\"Close Tab\" />\r\n  <string key=\"Website.App.LabelCloseOthers\" value=\"Close Others\" />\r\n  <string key=\"Website.App.LabelRefreshView\" value=\"Refresh View\" />\r\n  <string key=\"Website.App.LabelMakeDirty\" value=\"Make Dirty\" />\r\n  <string key=\"Website.App.LabelViewSource\" value=\"View Source\" />\r\n  <string key=\"Website.App.LabelViewGenerated\" value=\"View Generated\" />\r\n  <string key=\"Website.App.LabelViewSerialized\" value=\"View Serialized\" />\r\n  <string key=\"Website.App.LabelClose\" value=\"Close\" />\r\n  <string key=\"Website.App.LabelFile\" value=\"File\" />\r\n  <string key=\"Website.App.LabelFileClose\" value=\"Close\" />\r\n  <string key=\"Website.App.LabelFileCloseAll\" value=\"Close All\" />\r\n  <string key=\"Website.App.LabelFileSaveAll\" value=\"Save All...\" />\r\n  <string key=\"Website.App.LabelFileExit\" value=\"Sign out\" />\r\n  <string key=\"Website.App.LabelView\" value=\"View\" />\r\n  <string key=\"Website.App.LabelViewCompositeStart\" value=\"Composite Start\" />\r\n  <string key=\"Website.App.LabelSystemLog\" value=\"System Log\" />\r\n  <string key=\"Website.App.LabelDeveloperPanel\" value=\"Developer Panel\" />\r\n  <string key=\"Website.App.LabelTools\" value=\"Tools\" />\r\n  <string key=\"Website.App.LabelHelp\" value=\"Help\" />\r\n  <string key=\"Website.App.LabelSettings\" value=\"Settings\" />\r\n  <string key=\"Website.App.LabelHelpContents\" value=\"Help Contents\" />\r\n  <string key=\"Website.App.LabelFeedback\" value=\"Provide Feedback...\" />\r\n  <string key=\"Website.App.LabelAbout\" value=\"About {applicationname}\" />\r\n  <string key=\"Website.App.LabelCut\" value=\"Cut\" />\r\n  <string key=\"Website.App.LabelCopy\" value=\"Copy\" />\r\n  <string key=\"Website.App.LabelPaste\" value=\"Paste\" />\r\n  <string key=\"Website.App.LabelRefresh\" value=\"Refresh\" />\r\n  <string key=\"Website.App.LimitedElementsShown\" value=\"Only first {0} elements are shown in the tree.\" />\r\n  <string key=\"Website.App.LabelLoading\" value=\"Loading...\" />\r\n  <string key=\"Website.App.LabelLoaded\" value=\"Loaded\" />\r\n  <string key=\"Website.App.LabelSaved\" value=\"Saved\" />\r\n  <string key=\"Website.App.ToolTipMinimize\" value=\"Minimize\" />\r\n  <string key=\"Website.App.ToolTipMaximize\" value=\"Maximize\" />\r\n  <string key=\"Website.App.ToolTipUnMaximize\" value=\"Restore\" />\r\n  <string key=\"Website.App.ToolTipUnMinimize\" value=\"Restore\" />\r\n  <string key=\"Website.App.ToolTipClose\" value=\"Close\" />\r\n  <string key=\"Website.App.StatusBar.Opening\" value=\"Opening {0}...\" />\r\n  <string key=\"Website.App.StatusBar.Refreshing\" value=\"Refreshing {0}...\" />\r\n  <string key=\"Website.App.StatusBar.Loading\" value=\"Loading {0}...\" />\r\n  <string key=\"Website.App.StatusBar.Error\" value=\"Error\" />\r\n  <string key=\"Website.App.StatusBar.Warn\" value=\"Warning\" />\r\n  <string key=\"Website.App.StatusBar.Busy\" value=\"Working...\" />\r\n  <string key=\"Website.App.StatusBar.Ready\" value=\"Ready!\" />\r\n  <string key=\"Website.App.StatusBar.ErrorInField\" value=\"Error in\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.Layout.Label\" value=\"Add New Media File\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.FileUpload.Label\" value=\"Filename\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.FileUpload.Help\" value=\"Select the file to upload\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.OverwriteCheckBox.Label\" value=\"Allow overwrite\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.OverwriteCheckBox.Help\" value=\"Replace existing file\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.FilenameTextBox.Label\" value=\"Filename\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.FilenameTextBox.Help\" value=\"The name of the file in the media library\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.TitleTextBox.Label\" value=\"Title\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.TitleTextBox.Help\" value=\"Use this field for an image title\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.DescriptionTextBox.Label\" value=\"Description\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.DescriptionTextBox.Help\" value=\"Use this field for a short description of the image\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.MissingUploadedFile.Message\" value=\"Please select a file to upload\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.FileExists.Message\" value=\"A file with the same name exists. Check allow overwrite or change the filename\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.TotalFilenameToLong.Message\" value=\"The total length of the filename (folder and filename) is too long\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.TagsTextBox.Help\" value=\"Add tags to your media item seperated by a comma (,)\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFile.TagsTextBox.Label\" value=\"Tags\" />  \r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.Label.AddNewMediaFolder\" value=\"Add New Media Folder\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.LabelFolderName\" value=\"Folder Name\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.HelpFolderName\" value=\"\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.LabelTitle\" value=\"Title\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.HelpTitle\" value=\"\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.LabelDescription\" value=\"Description\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.HelpDescription\" value=\"\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.FolderNameAlreadyUsed\" value=\"The folder already exists\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.FolderNameTooLong\" value=\"The total length of the folder name is too long\" />\r\n  <string key=\"Website.Forms.Administrative.AddNewMediaFolder.FolderNotOnlySlash\" value=\"The folder name can not only be '/' or '\\'\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.LabelDialog\" value=\"Upload Multiple Files via a Zip File\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.LabelFile\" value=\"Zip file\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.HelpFile\" value=\"Create a Zip file (right click local folder and select Send to -&gt; Compressed folder) and select it using the Browse button\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.LabelRecreateStructure\" value=\"Create folders\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.HelpRecreateStructure\" value=\"Selecting this option will copy the exact folder structure from your Zip file\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.LabelRecreateStructureCheckBox\" value=\"Extract folders from Zip file\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.LabelOverwriteExsisting\" value=\"Overwrite existing\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.HelpOverwriteExsisting\" value=\"Selecting this option will overwrite existing files in the media archive with matching file names\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.Error.Title\" value=\"Error\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.LabelOverwriteExsistingCheckBox\" value=\"Overwrite existing files\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.MissingUploadedFile.Message\" value=\"Please select a file to upload\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.CannotUploadDocxFile\" value=\"Please use the normal upload command to upload .docx files\" />\r\n  <string key=\"Website.Forms.Administrative.AddZipMediaFile.WrongUploadedFile.Message\" value=\"The selected file was not a correct zip file\" />\r\n  <string key=\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelFunctionSearch\" value=\"Function search\" />\r\n  <string key=\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelKeyword\" value=\"Keyword\" />\r\n  <string key=\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelKeywordHelp\" value=\"Write a keyword to search for.\" />\r\n  <string key=\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelReturnType\" value=\"Return type\" />\r\n  <string key=\"Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelReturnTypeHelp\" value=\"Select a return type to search for.\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteMediaFile.LabelFieldGroup\" value=\"Delete This File?\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteMediaFile.Text\" value=\"Delete this file?\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteMediaFile.DeleteDataConfirmationHeader\" value=\"Deleting a file\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteMediaFile.DeleteDataConfirmationText\" value=\"There is some referenced data that will also be deleted, do you want to continue?\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteMediaFolder.LabelFieldGroup\" value=\"Delete This Folder?\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteMediaFolder.Text\" value=\"Delete this folder?\" />\r\n  <string key=\"Website.Forms.Administrative.DeleteMediaFolder.HasChildringText\" value=\"This folder contains one or more files or subfolders. Deleting this folder will also delete all sub files and folders. Delete this folder?\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.LabelFieldGroup\" value=\"Media Properties\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.LabelTitle\" value=\"Title\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.HelpTitle\" value=\"A human friendly short text describing the content of the media file\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.LabelFileName\" value=\"File Name\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.HelpFileName\" value=\"The file name to use when the media file is downloaded.\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.LabelDescription\" value=\"Description\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.HelpDescription\" value=\"A description of the media file content\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.LabelTags\" value=\"Tags\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.HelpTags\" value=\"Provide tags for the media file content (Delimited by commas (,))\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.LabelMediaURL\" value=\"URL\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.HelpMediaURL\" value=\"This is the URL for your media File\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.TotalFilenameToLong.Message\" value=\"The total length of the filename (folder and filename) is too long\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFile.FileExists.Message\" value=\"A file with the same name already exists in this folder.\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFolder.LabelFieldGroup\" value=\"Folder Properties\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFolder.LabelFolderName\" value=\"Folder Name\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFolder.HelpFolderName\" value=\"\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFolder.LabelTitle\" value=\"Title\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFolder.HelpTitle\" value=\"Use this field for a folder title\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFolder.LabelDescription\" value=\"Description\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFolder.HelpDescription\" value=\"\" />\r\n  <string key=\"Website.Forms.Administrative.EditMediaFolder.TotalFilenameToLong.Message\" value=\"The folder contains a file where the total length of the filename and the new folder name is too long\" />\r\n  <string key=\"Website.Forms.Administrative.EditPage.PublishDatePreventPublishTitle\" value=\"Saved, but not published\" />\r\n  <string key=\"Website.Forms.Administrative.EditPage.PublishDatePreventPublish\" value=\"Your page has been saved, but not published since you have a future publish date set on the 'Settings' tab.\" />\r\n  <string key=\"Website.Forms.Administrative.ElementKeywordSearch.LabelFieldGroup\" value=\"Search\" />\r\n  <string key=\"Website.Forms.Administrative.ElementKeywordSearch.LabelKeyword\" value=\"Keyword\" />\r\n  <string key=\"Website.Forms.Administrative.ElementKeywordSearch.LabelSearchKeyword\" value=\"Write a keyword to search for.\" />\r\n  <string key=\"Website.Forms.Administrative.UploadMediaFile.LabelFieldGroup\" value=\"Upload New Media File\" />\r\n  <string key=\"Website.Forms.Administrative.UploadMediaFile.LabelFile\" value=\"File name:\" />\r\n  <string key=\"Website.Forms.Administrative.UploadMediaFile.HelpFile\" value=\"\" />\r\n  <string key=\"Website.Forms.Administrative.UploadMediaFile.EmptyFileErrorTitle\" value=\"File missing or empty\" />\r\n  <string key=\"Website.Forms.Administrative.UploadMediaFile.EmptyFileErrorMessage\" value=\"No file data was received. Please use the browse button and ensure that the selected file is not empty.\" />\r\n  <string key=\"Website.Forms.Administrative.UploadNewMediaFile.LabelFieldGroup\" value=\"Upload New Media File to Existing File\" />\r\n  <string key=\"Website.Forms.Administrative.UploadNewMediaFile.LabelFile\" value=\"File name:\" />\r\n  <string key=\"Website.Forms.Administrative.UploadNewMediaFile.HelpFile\" value=\"\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.Document.LabelSave\" value=\"Save\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.Document.LabelSaveAs\" value=\"Save As...\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelPrevious\" value=\"Previous\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelNext\" value=\"Next\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelFinish\" value=\"Finish\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.Wizard.LabelCancel\" value=\"Cancel\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.DataDialog.LabelOk\" value=\"OK\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.DataDialog.LabelCancel\" value=\"Cancel\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.ConfirmDialog.LabelOk\" value=\"OK\" />\r\n  <string key=\"Website.Forms.Administrative.AdministrativeTemplates.ConfirmDialog.LabelCancel\" value=\"Cancel\" />\r\n  <string key=\"Website.Misc.SourceCodeViewer.LabelInput\" value=\"Input\" />\r\n  <string key=\"Website.Misc.SourceCodeViewer.LabelOutput\" value=\"Output\" />\r\n  <string key=\"Website.Misc.Trees.DialogTitle.PasteNotAllowed\" value=\"Not allowed.\" />\r\n  <string key=\"Website.Misc.Trees.DialogText.PasteNotAllowed\" value=\"Paste not allowed in this context.\" />\r\n  <string key=\"Website.Misc.Trees.DialogTitle.PasteTypeNotAllowed\" value=\"Not allowed\" />\r\n  <string key=\"Website.Misc.Trees.DialogText.PasteTypeNotAllowed\" value=\"Folder won't accept document type.\" />\r\n  <string key=\"Website.Misc.MultiSelector.LabelEditSelections\" value=\"Edit Selections\" />\r\n  <string key=\"Website.Misc.Toolbar.LabelShowMoreActions\" value=\"More\" />\r\n  <string key=\"GenericVersionProcessController.Version\" value=\"Version information\" />\r\n  <string key=\"GenericVersionProcessController.VersionToolTip\" value=\"Show version information\" />\r\n  <string key=\"AspNetUiControl.Selector.SelectValueLabel\" value=\"Select a value\" />\r\n  <string key=\"AspNetUiControl.Selector.BrokenReference\" value=\"&lt; broken reference &gt;...\" />\r\n  <string key=\"AspNetUiControl.Selector.NoSelection\" value=\"(no selection)\" />\r\n  <string key=\"AspNetUiControl.Selector.NoMatchesFor\" value=\"No matches for '{0}'\" />\r\n  <string key=\"Validation.BrokenReference\" value=\"This field contains a broken reference\" />\r\n  <string key=\"Validation.RequiredField\" value=\"This field is required.\" />\r\n  <string key=\"Validation.Decimal.SymbolsAfterPointAllowed\" value=\"Only {0} digit(s) after decimal point allowed\" />\r\n  <string key=\"Validation.Decimal.SymbolsBeforePointAllowed\" value=\"Only {0} digit(s) before decimal point allowed\" />\r\n  <string key=\"Validation.DateTime.InvalidDateFormat\" value=\"Invalid date string: '{0}'. Use the format '{1}'.\" />\r\n  <string key=\"Validation.Int32.Overflow\" value=\"The specified value is either too big or too small. The acceptable range is from -2,147,483,648 to 2,147,483,647\" />\r\n  <string key=\"Validation.Required\" value=\"Required\" />\r\n  <string key=\"Validation.InvalidField.Number\" value=\"Numbers only\" />\r\n  <string key=\"Validation.InvalidField.Integer\" value=\"Integers only\" />\r\n  <string key=\"Validation.InvalidField.ProgrammingIdentifier\" value=\"Invalid identifier\" />\r\n  <string key=\"Validation.InvalidField.ProgrammingNamespace\" value=\"Invalid namespace\" />\r\n  <string key=\"Validation.InvalidField.Url\" value=\"Invalid URL\" />\r\n  <string key=\"Validation.InvalidField.Currency\" value=\"Invalid notation\" />\r\n  <string key=\"Validation.InvalidField.Email\" value=\"Invalid e-mail\" />\r\n  <string key=\"Validation.InvalidField.Guid\" value=\"Invalid GUID\" />\r\n  <string key=\"Validation.StringLength.Min\" value=\"{0} characters minimum\" />\r\n  <string key=\"Validation.StringLength.Max\" value=\"{0} characters maximum\" />\r\n  <string key=\"Browser.Label\" value=\"Page Browser\" />\r\n  <string key=\"Browser.ToolTip\" value=\"Browse unpublished pages\" />\r\n  <string key=\"Duplication.Text\" value=\"Copy{count} of {0}\" />\r\n  <string key=\"DefaultVersionName\" value=\"Original\" />\r\n  <string key=\"Selector.Count\" value=\"{0} selected\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.NameValidation.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"EmptyName\" value=\"Name can not be an empty string\" />\r\n\t<string key=\"EmptyNamespace\" value=\"Namespace can not be an empty string\" />\r\n  <string key=\"DuplicateElementNamespace\" value=\"Namespace can not contain the same name part multiple times\" />\r\n  <string key=\"InvalidIdentifier\" value=\"The name '{0}' is not a valid identifier\" />\r\n\t<string key=\"InvalidIdentifierDigit\" value=\"The name '{0}' is not a valid identifier. Identifiers may not start with digits.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Permissions.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"ReadLabel\" value=\"Read\" />\r\n\t<string key=\"EditLabel\" value=\"Edit\" />\r\n\t<string key=\"AddLabel\" value=\"Add\" />\r\n\t<string key=\"DeleteLabel\" value=\"Delete\" />\r\n\t<string key=\"ApproveLabel\" value=\"Approve\" />\r\n\t<string key=\"PublishLabel\" value=\"Publish\" />\r\n  <string key=\"ConfigureLabel\" value=\"Configure\" />\r\n  <string key=\"AdministrateLabel\" value=\"Administrate\" />\r\n\t<string key=\"ClearPermissionsLabel\" value=\"ClearPermissions\" />\r\n\t<string key=\"AdminLockoutMessage\" value=\"This operation would remove your administrative permissions from this entity. You can not remove your own administrative permissions.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.AllFunctionsElementProvider.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"Plugins.AllFunctionsElementProvider.FunctionRootFolderLabel\" value=\"All Functions\" />\r\n\t<string key=\"Plugins.AllFunctionsElementProvider.FunctionRootFolderToolTip\" value=\"All functions\" />\r\n\t<string key=\"Plugins.AllFunctionsElementProvider.WidgetFunctionRootFolderLabel\" value=\"All Widget Functions\" />\r\n\t<string key=\"Plugins.AllFunctionsElementProvider.WidgetFunctionRootFolderToolTip\" value=\"All widget functions\" />\r\n\t<string key=\"AllFunctionsElementProvider.GenerateDocumentation\" value=\"Generate Documentation\" />\r\n\t<string key=\"AllFunctionsElementProvider.GenerateDocumentationTooltip\" value=\"Generate documentation for all functions below this folder\" />\r\n  <string key=\"AllFunctionsElementProvider.ViewFunctionInformation\" value=\"Information\" />\r\n  <string key=\"AllFunctionsElementProvider.ViewFunctionInformationTooltip\" value=\"View function information\" />\r\n\r\n  <string key=\"FunctionTesterWorkflow.Layout.Label\" value=\"Test: {0}\" />\r\n  <string key=\"FunctionTesterWorkflow.FunctionCalls.Label\" value=\"Functions\" />  \r\n  <string key=\"FunctionTesterWorkflow.Preview.Label\" value=\"Results\" />\r\n  <string key=\"FunctionTesterWorkflow.Runtime.FieldGroup.Label\" value=\"Runtime\" />\r\n  <string key=\"FunctionTesterWorkflow.DebugFieldGroup.Label\" value=\"Settings\" />\r\n  <string key=\"FunctionTesterWorkflow.DebugPage.Label\" value=\"Page\" />\r\n  <string key=\"FunctionTesterWorkflow.DebugPage.Help\" value=\"When executing the function, this page is used as current page\" />\r\n  <string key=\"FunctionTesterWorkflow.DebugPageDataScope.Label\" value=\"Data scope\" />\r\n  <string key=\"FunctionTesterWorkflow.DebugPageDataScope.Help\" value=\"When executing the function, this is used as current data scope\" />\r\n  <string key=\"FunctionTesterWorkflow.DebugActiveLocale.Label\" value=\"Language\" />\r\n  <string key=\"FunctionTesterWorkflow.DebugActiveLocale.Help\" value=\"When executing the function, this is used as the current language\" />\r\n  <string key=\"FunctionTesterWorkflow.AdminitrativeScope.Label\" value=\"Administrative\" />\r\n  <string key=\"FunctionTesterWorkflow.PublicScope.Label\" value=\"Public\" />\r\n  \r\n\r\n  <string key=\"AllFunctionsElementProvider.FunctionTester.Label\" value=\"Test Function\" />\r\n  <string key=\"AllFunctionsElementProvider.FunctionTester.ToolTip\" value=\"Test function\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.Components.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"Tags.Ecommerce\" value=\"E-Commerce\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.GeneratedDataTypesElementProvider.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"GlobalDataFolderLabel\" value=\"Global Datatypes\" />\r\n  <string key=\"GlobalDataFolderToolTip\" value=\"Global datatypes\" />\r\n  <string key=\"GlobalDataFolderLabel_OnlyGlobalData\" value=\"Website Items\" />\r\n  <string key=\"GlobalDataFolderToolTip_OnlyGlobalData\" value=\"Website Items (Data)\" />\r\n  <string key=\"PageDataFolderDataFolderLabel\" value=\"Page Datafolders\" />\r\n  <string key=\"PageDataFolderDataFolderToolTip\" value=\"Page datafolders\" />\r\n  <string key=\"PageMetaDataFolderLabel\" value=\"Page Metatypes\" />\r\n  <string key=\"PageMetaDataFolderToolTip\" value=\"Page metatypes\" />\r\n  <string key=\"Add\" value=\"Add Datatype\" />\r\n  <string key=\"AddToolTip\" value=\"Add new global datatype\" />\r\n  <string key=\"ViewUnpublishedItems\" value=\"List Unpublished Content\" />\r\n  <string key=\"ViewUnpublishedItemsToolTip\" value=\"Get an overview of data that haven't been published yet\" />\r\n  <string key=\"ViewUnpublishedItems-document-title\" value=\"Unpublished data\" />\r\n  <string key=\"ViewUnpublishedItems-document-description\" value=\"The list below display data items which are currently being edited or are ready to be approved / published.\" />\r\n  <string key=\"ViewUnpublishedItems-document-empty-label\" value=\"No unpublished data.\" />\r\n  <string key=\"AddDataFolder\" value=\"Add Datafolder\" />\r\n  <string key=\"AddDataFolderToolTip\" value=\"Add new datafolder\" />\r\n  <string key=\"AddMetaDataLabel\" value=\"Add Metatype\" />\r\n  <string key=\"AddMetaDataToolTip\" value=\"Add metatype\" />\r\n  <string key=\"Edit\" value=\"Edit Datatype\" />\r\n  <string key=\"EditToolTip\" value=\"Edit selected datatype\" />\r\n  <string key=\"EditDataFolderTypeLabel\" value=\"Edit\" />\r\n  <string key=\"EditDataFolderTypeToolTip\" value=\"Edit selected datafolder\" />\r\n  <string key=\"EditMetaDataTypeLabel\" value=\"Edit\" />\r\n  <string key=\"EditMetaDataTypeToolTip\" value=\"Edit selected metadata\" />\r\n  <string key=\"Delete\" value=\"Delete Datatype\" />\r\n  <string key=\"DeleteToolTip\" value=\"Delete selected datatype\" />\r\n  <string key=\"DeleteDataFolderTypeLabel\" value=\"Delete\" />\r\n  <string key=\"DeleteDataFolderTypeToolTip\" value=\"Delete selected datafolder\" />\r\n  <string key=\"DeleteMetaDataTypeLabel\" value=\"Delete\" />\r\n  <string key=\"DeleteMetaDataTypeToolTip\" value=\"Delete selected metadata\" />\r\n  <string key=\"EditFormMarkup\" value=\"Edit Form Markup\" />\r\n  <string key=\"EditFormMarkupToolTip\" value=\"Modify the layout of the data form using markup\" />\r\n  <string key=\"EnableLocalization\" value=\"Enable Localization\" />\r\n  <string key=\"EnableLocalizationToolTip\" value=\"Enable localization\" />\r\n  <string key=\"DisableLocalization\" value=\"Disable Localization\" />\r\n  <string key=\"DisableLocalizationToolTip\" value=\"Disable localization\" />\r\n  <string key=\"DisabledData\" value=\"Not yet approved or published\" />\r\n  <string key=\"UndefinedLabelTemplate\" value=\"(undefined [{0}])\" />\r\n  <string key=\"UndefinedDataLavelTemplate\" value=\"(undefined)\" />\r\n  <string key=\"ShowInContent\" value=\"Show in Content perspective\" />\r\n  <string key=\"ShowInContentToolTip\" value=\"Show in Content perspective\" />\r\n  <string key=\"AddData\" value=\"Add Data\" />\r\n  <string key=\"AddDataToolTip\" value=\"Add new data\" />\r\n  <string key=\"EditData\" value=\"Edit Data\" />\r\n  <string key=\"EditDataToolTip\" value=\"Edit selected data\" />\r\n  <string key=\"DeleteData\" value=\"Delete Data\" />\r\n  <string key=\"DeleteDataToolTip\" value=\"Delete selected data\" />\r\n  <string key=\"DuplicateData\" value=\"Duplicate Data\" />\r\n  <string key=\"DuplicateDataToolTip\" value=\"Duplicate selected data\" />\r\n  <string key=\"LocalizeData\" value=\"Translate Data\" />\r\n  <string key=\"LocalizeDataToolTip\" value=\"Translate selected data\" />\r\n  <string key=\"PublicationSettings.FieldGroupLabel\" value=\"Publication settings\" />\r\n  <string key=\"PublicationStatus.Label\" value=\"Status\" />\r\n  <string key=\"PublicationStatus.Help\" value=\"Send the data to another publication status.\" />\r\n  <string key=\"PublishDate.Label\" value=\"Publish date\" />\r\n  <string key=\"PublishDate.Help\" value=\"Specify at which date and time you want the data to be published automatically.\" />\r\n  <string key=\"DateCreated.Label\" value=\"Date Created\" />\r\n  <string key=\"DateModified.Label\" value=\"Date Modified\" />\r\n  <string key=\"CreatedBy.Label\" value=\"Author\" />\r\n  <string key=\"ChangedBy.Label\" value=\"Author\" />\r\n  <string key=\"UnpublishDate.Label\" value=\"Unpublish date\" />\r\n  <string key=\"UnpublishDate.Help\" value=\"Specify at which date and time you want the data to be unpublished automatically.\" />\r\n  <string key=\"AddNewInterfaceTypeStep1.DocumentTitle\" value=\"New Datatype\" />\r\n  <string key=\"AddNewCompositionTypeWorkflow.DocumentTitle\" value=\"New Page Metatype\" />\r\n  <string key=\"AddNewAggregationTypeWorkflow.DocumentTitle\" value=\"New Page Datafolder\" />\r\n  <string key=\"EditorCommon.SettingsTab\" value=\"Settings\" />\r\n  <string key=\"EditorCommon.LabelTitleGroup\" value=\"Type title\" />\r\n  <string key=\"EditorCommon.LabelProgrammaticNamingAndServices\" value=\"Programmatic naming and services\" />\r\n  <string key=\"EditorCommon.LabelProgrammaticNaming\" value=\"Programmatic naming\" />\r\n  <string key=\"EditorCommon.LabelTypeName\" value=\"Type name\" />\r\n  <string key=\"EditorCommon.HelpTypeName\" value=\"The technical name of the data type (ex. Product). This is used to identify this type in code and should not be changed once used externally.\" />\r\n  <string key=\"EditorCommon.LabelTypeNamespace\" value=\"Type namespace\" />\r\n  <string key=\"EditorCommon.HelpTypeNamespace\" value=\"The namespace (module / category name) of the type. This is used to identify this type in code and should not be changed once used externally.\" />\r\n  <string key=\"EditorCommon.LabelTitle\" value=\"Title\" />\r\n  <string key=\"EditorCommon.HelpTitle\" value=\"Use this entry to specify a user friendly name. This name is used in most UI.\" />\r\n  <string key=\"EditorCommon.LabelFields\" value=\"Fields\" />\r\n  <string key=\"EditorCommon.KeyFieldTypeLabel\" value=\"Key field type\"/>\r\n  <string key=\"EditorCommon.KeyFieldTypeHelp\" value=\"The type of the primary key. Use the default 'Guid' type for optimal performance and 'RandomString' for shorter data urls.\"/>\r\n  <string key=\"EditorCommon.KeyFieldType.Guid\" value=\"Guid\"/>\r\n  <string key=\"EditorCommon.KeyFieldType.RandomString4\" value=\"Random String, 4 characters long\"/>\r\n  <string key=\"EditorCommon.KeyFieldType.RandomString8\" value=\"Random String, 8 characters long\"/>\r\n  <string key=\"EditorCommon.ServicesLabel\" value=\"Services\" />\r\n  <string key=\"EditorCommon.InternalUrlPrefixLabel\" value=\"Short URL name\" />\r\n  <string key=\"EditorCommon.InternalUrlPrefixHelp\" value=\"When specified, allows data items of the current type to be referenced in content. The internal links will have format '~/{ShortURLName}({id})', f.e. '~/product(aIkH34F)\" />\r\n  <string key=\"EditorCommon.HasCaching\" value=\"Has caching\" />\r\n\t<string key=\"EditorCommon.IsSearchable\" value=\"Is searchable\" />\r\n  <string key=\"EditorCommon.HasPublishing\" value=\"Has publishing\" />\r\n  <string key=\"EditorCommon.HasLocalization\" value=\"Is localizable data\" />\r\n  <string key=\"DeleteGeneratedDataStep1.LabelFieldGroup\" value=\"Delete Data?\" />\r\n  <string key=\"DeleteGeneratedDataStep1.Text\" value=\"Delete data?\" />\r\n  <string key=\"DeleteDataConfirmationText\" value=\"There is some referenced data that will also be deleted, do you want to continue?\" />\r\n  <string key=\"DeleteGeneratedInterfaceStep1.LabelFieldGroup\" value=\"Delete Datatype\" />\r\n  <string key=\"DeleteGeneratedInterfaceStep1.Text\" value=\"Delete the datatype\" />\r\n  <string key=\"CascadeDeleteErrorTitle\" value=\"Cascade delete error\" />\r\n  <string key=\"CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  <string key=\"DeleteAggregationTypeWorkflow.LabelFieldGroup\" value=\"Delete Datatype\" />\r\n  <string key=\"DeleteAggregationTypeWorkflow.Text\" value=\"Delete the datatype\" />\r\n  <string key=\"DeleteAggregationTypeWorkflow.ErrorTitle\" value=\"Error\" />\r\n  <string key=\"DeleteAggregationTypeWorkflow.IsUsedByPageType\" value=\"Cannot delete type '{0}' since it is used by a page type.\" />  \r\n  <string key=\"DeleteCompositionTypeWorkflow.LabelFieldGroup\" value=\"Delete Datatype\" />\r\n  <string key=\"DeleteCompositionTypeWorkflow.Text\" value=\"Delete the datatype\" />\r\n  <string key=\"DeleteCompositionTypeWorkflow.ErrorTitle\" value=\"Error\" />\r\n  <string key=\"DeleteCompositionTypeWorkflow.TypeIsReferenced\" value=\"Cannot delete type '{0}' since there're types that referenced to it.\" />\r\n  <string key=\"DeleteCompositionTypeWorkflow.IsUsedByPageType\" value=\"Cannot delete type '{0}' since it is used by a page type.\" />  \r\n  <string key=\"ToXmlLabel\" value=\"To Xml\" />\r\n  <string key=\"ToXmlToolTip\" value=\"To Xml\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Dialog.Label\" value=\"Enable Localization\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Step1.FieldGroup.Label\" value=\"Enable localization\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Step1.CultureSelector.Label\" value=\"Move existing data to ...\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Step1.CultureSelector.Help\" value=\"When you enable 'localization' on a data type, all data must belong to a language. Select the language existing data should now be moved to.\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Step2.Title\" value=\"Confirmation\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Step2.Description\" value=\"Data type will be localized and data copied to selected locale. Click Finish to continue.\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Step3.Title\" value=\"Warning\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Step3.Description\" value=\"There's some datatypes which have references to the type. While localizing the data will be copied to all languages in order to prevent appearing of broken references.\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Abort.Title\" value=\"Missing active locales\" />\r\n  <string key=\"EnableTypeLocalizationWorkflow.Abort.Description\" value=\"There are no added active locales. Add at least one before localization this datatype.\" />\r\n  <string key=\"DisableTypeLocalizationWorkflow.Dialog.Label\" value=\"Disable Localization\" />\r\n  <string key=\"DisableTypeLocalizationWorkflow.Step1.FieldGroup.Label\" value=\"Disable localization\" />\r\n  <string key=\"DisableTypeLocalizationWorkflow.Step1.CultureSelector.Label\" value=\"Keep data from ...\" />\r\n  <string key=\"DisableTypeLocalizationWorkflow.Step1.CultureSelector.Help\" value=\"When localization is disabled on a datatype only one translation can be kept. Data from other languages will be lost.\" />\r\n  <string key=\"DisableTypeLocalizationWorkflow.Step2.Title\" value=\"Confirmation\" />\r\n  <string key=\"DisableTypeLocalizationWorkflow.Step2.Description\" value=\"All data from other locales than the one selected will be lost. Click Finish to continue.\" />\r\n  <string key=\"LocalizeDataWorkflow.ShowError.LayoutLabel\" value=\"Failed to translate data\" />\r\n  <string key=\"LocalizeDataWorkflow.ShowError.InfoTableCaption\" value=\"Translation errors\" />\r\n  <string key=\"LocalizeDataWorkflow.ShowError.AlreadyTranslated\" value=\"This data has already been translated. The translated version belongs to a different group.\" />\r\n  <string key=\"LocalizeDataWorkflow.ShowError.Description\" value=\"The following fields has a reference to a data type. You should translate these data items before you can translate this data item\" />\r\n  <string key=\"LocalizeDataWorkflow.ShowError.FieldErrorFormat\" value=\"The field '{0}' is referencing data of type '{1}' with the label '{2}'\" />\r\n  <string key=\"AddNewInterfaceTypeStep1.ErrorTitle\" value=\"Error\" />\r\n  <string key=\"EditInterfaceTypeStep1.ErrorTitle\" value=\"Error\" />\r\n  <string key=\"AddNewCompositionTypeWorkflow.ErrorTitle\" value=\"Error\" />\r\n  <string key=\"EditCompositionTypeWorkflow.ErrorTitle\" value=\"Error\" />\r\n  <string key=\"DataTypeDescriptorToXmlLabel\" value=\"XML Result\" />\r\n\r\n  <string key=\"FormMarkupInfo.Dialog.Label\" value=\"This type has custom form markup\" />\r\n  <string key=\"FormMarkupInfo.Message\" value=\"Your field changes will not affect the form for editing data.\r\nDo '{0}' to change the form or delete the file '{1}'.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.GenericPublishProcessController.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"SendToDraft\" value=\"Send to Draft\" />\r\n\t<string key=\"SendToDraftToolTip\" value=\"\" />\r\n\t<string key=\"Publish\" value=\"Publish\" />\r\n\t<string key=\"PublishToolTip\" value=\"Publish to site\" />\r\n\t<string key=\"Unpublish\" value=\"Unpublish\" />\r\n\t<string key=\"UnpublishToolTip\" value=\"Set to draft status and remove the published version\" />\r\n\t<string key=\"SendForApproval\" value=\"Send for Approval\" />\r\n\t<string key=\"SendForApprovalToolTip\" value=\"Send for approval\" />\r\n\t<string key=\"SendForPublication\" value=\"Send for Publication\" />\r\n\t<string key=\"SendForPublicationToolTip\" value=\"Send for publication\" />\r\n\t<string key=\"UndoPublishedChanges\" value=\"Undo Changes\" />\r\n\t<string key=\"UndoPublishedChangesToolTip\" value=\"Undo unpublished changes\" />\r\n\t<string key=\"ValidationErrorTitle\" value=\"Action Not Possible\" />\r\n\t<string key=\"ValidationErrorMessage\" value=\"The data did not validate with the following errors:\" />\t\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.LocalizationElementProvider.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"ElementProvider.RootFolderLabel\" value=\"Languages\" />\r\n  <string key=\"ElementProvider.RootFolderToolTip\" value=\"Explore and manage installed languages\" />\r\n  <string key=\"ElementProvider.DefaultLabel\" value=\"Default\" />\r\n  <string key=\"AddSystemLocaleWorkflow.NoMoreLocalesTitle\" value=\"No Languages Available\" />\r\n  <string key=\"AddSystemLocaleWorkflow.NoMoreLocalesMessage\" value=\"You have installed all possible languages.\" />\r\n  <string key=\"AddSystemLocaleWorkflow.AddElementActionLabel\" value=\"Add Language\" />\r\n  <string key=\"AddSystemLocaleWorkflow.AddElementActionToolTip\" value=\"Add new language\" />\r\n  <string key=\"AddSystemLocaleWorkflow.Dialog.Label\" value=\"Add Language\" />\r\n  <string key=\"AddSystemLocaleWorkflow.CultureSelector.Label\" value=\"Languages\" />\r\n  <string key=\"AddSystemLocaleWorkflow.CultureSelector.Help\" value=\"The list of available, uninstalled languages. Language packages may be installed for additional options.\" />\r\n  <string key=\"AddSystemLocaleWorkflow.UrlMappingName.Label\" value=\"URL mapping name\" />\r\n  <string key=\"AddSystemLocaleWorkflow.UrlMappingName.Help\" value=\"This string will be inserted into the URL of pages published in a given language. The website &quot;default&quot; language may leave this entry blank.\" />\r\n  <string key=\"AddSystemLocaleWorkflow.AllUsersAccess.Label\" value=\"User access\" />\r\n  <string key=\"AddSystemLocaleWorkflow.AllUsersAccess.ItemLabel\" value=\"Give access to all users\" />\r\n  <string key=\"AddSystemLocaleWorkflow.AllUsersAccess.Help\" value=\"If checked, the language will be made available to all registered users for viewing and editing\" />\r\n  <string key=\"AddSystemLocaleWorkflow.UrlMappingName.InUseMessage\" value=\"URL mapping name is already in use\" />\r\n  <string key=\"EditSystemLocaleWorkflow.EditElementActionLabel\" value=\"Edit Language\" />\r\n  <string key=\"EditSystemLocaleWorkflow.EditElementActionToolTip\" value=\"Edit language\" />\r\n  <string key=\"EditSystemLocaleWorkflow.Dialog.Label\" value=\"Edit Language\" />\r\n  <string key=\"EditSystemLocaleWorkflow.FieldGroup.Label\" value=\"Language properties\" />\r\n  <string key=\"EditSystemLocaleWorkflow.UrlMappingName.Label\" value=\"URL mapping name\" />\r\n  <string key=\"EditSystemLocaleWorkflow.UrlMappingName.Help\" value=\"URL mapping name\" />\r\n  <string key=\"EditSystemLocaleWorkflow.UrlMappingName.InUseMessage\" value=\"URL mapping name is already in use\" />\r\n  <string key=\"DefineDefaultActiveLocaleWorkflow.ElementActionLabel\" value=\"Set as Default\" />\r\n  <string key=\"DefineDefaultActiveLocaleWorkflow.ElementActionToolTip\" value=\"Set as default language\" />\r\n  <string key=\"RemoveSystemLocaleWorkflow.RemoveElementActionLabel\" value=\"Remove Language\" />\r\n  <string key=\"RemoveSystemLocaleWorkflow.RemoveElementActionToolTip\" value=\"Remove language\" />\r\n  <string key=\"RemoveSystemLocaleWorkflow.Dialog.Label\" value=\"Remove Language?\" />\r\n  <string key=\"RemoveSystemLocaleWorkflow.Abort.Title\" value=\"Cannot Remove Last Language\" />\r\n  <string key=\"RemoveSystemLocaleWorkflow.Abort.Description\" value=\"You are about to remove a language that is the only language for one or more users. Please add other languages to these users and try again.\" />\r\n  <string key=\"RemoveSystemLocaleWorkflow.Confirm.Description\" value=\"Remove this language?\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.MasterPagePageTemplate.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n  <string key=\"AddNewMasterPagePageTemplateWorkflow.LabelDialog\" value=\"Add New Master Page\" />\r\n\r\n  <string key=\"EditMasterPageAction.Label\" value=\"Edit Master Page\" />\r\n  <string key=\"EditMasterPageAction.ToolTip\" value=\"Edit source code of the master page\" />\r\n\r\n  <string key=\"DeleteMasterPageAction.Label\" value=\"Delete\" />\r\n  <string key=\"DeleteMasterPageAction.ToolTip\" value=\"Delete page template\" />\r\n\r\n  <string key=\"EditTemplate.Validation.DialogTitle\" value=\"Validation error\" />\r\n  <string key=\"EditTemplate.Validation.CompilationFailed\" value=\"Compilation failed: {0}\" />\r\n  <string key=\"EditTemplate.Validation.IncorrectBaseClass\" value=\"Page template class does not inherit '{0}'\" />\r\n  <string key=\"EditTemplate.Validation.PropertyError\" value=\"Failed to evaluate page template property '{0}'. Exception: {1}\" />\r\n  <string key=\"EditTemplate.Validation.TemplateIdChanged\" value=\"It is not allowed to change the template ID through the current workflow. The original template ID is '{0}'\" />\r\n\r\n\r\n  <string key=\"AddNewMasterPagePageTemplate.LabelDialog\" value=\"Add New Master Page Template\" />\r\n  <string key=\"AddNewMasterPagePageTemplate.LabelTemplateTitle\" value=\"Template Title\" />\r\n  <string key=\"AddNewMasterPagePageTemplate.LabelTemplateTitleHelp\" value=\"The title identifies this template in lists. Consider selecting a short but meaningful name.\" />\r\n  <string key=\"AddNewMasterPagePageTemplate.LabelCopyFrom\" value=\"Copy from\" />\r\n  <string key=\"AddNewMasterPagePageTemplate.LabelCopyFromHelp\" value=\"You can copy the markup from another Layout Template by selecting it in this list.\" />\r\n  <string key=\"AddNewMasterPagePageTemplate.LabelCopyFromEmptyOption\" value=\"(New template)\" />\r\n  <string key=\"AddNewMasterPagePageTemplateWorkflow.TitleInUseTitle\" value=\"Title already used\" />\r\n  <string key=\"AddNewMasterPagePageTemplateWorkflow.TitleTooLong\" value=\"The title is too long (used as part of a filename).\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.MethodBasedFunctionProviderElementProvider.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"RootFolderLabel\" value=\"C# Functions\" />\r\n  <string key=\"RootFolderToolTip\" value=\"Method functions\" />\r\n  <string key=\"DeleteFunction.LabelFieldGroup\" value=\"Delete This Function\" />\r\n  <string key=\"DeleteFunction.Text\" value=\"Delete this function\" />\r\n  <string key=\"Add\" value=\"Add External C# function\" />\r\n  <string key=\"AddToolTip\" value=\"Add an external C# method based function.\" />\r\n  <string key=\"Create\" value=\"Add Inline C# function\" />\r\n  <string key=\"CreateToolTip\" value=\"Add an inline C# method based function.\" />\r\n  <string key=\"Edit\" value=\"Edit\" />\r\n  <string key=\"EditToolTip\" value=\"Edit Function.\" />\r\n  <string key=\"Delete\" value=\"Delete\" />\r\n  <string key=\"DeleteToolTip\" value=\"Delete Function.\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep1.LabelType\" value=\"Type\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep1.LabelTypeHelp\" value=\"The type that contains the method in question\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep2.LabelMethodName\" value=\"Method name\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep2.HelpMethodName\" value=\"\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep3.LabelMethodName\" value=\"Method Name\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep3.HelpMethodName\" value=\"\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep3.LabelNamespaceName\" value=\"Namespace Name\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep3.HelpNamespaceName\" value=\"\" />\r\n  <string key=\"AddNewMethodBasedFunctionStep3.LabelError\" value=\"Error\" />\r\n  <string key=\"CascadeDeleteErrorTitle\" value=\"Cascade delete error\" />\r\n  <string key=\"CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  <string key=\"AddFunction.CouldNotFindType\" value=\"Could not find type\" />\r\n  <string key=\"AddFunction.TypeHasNoValidMethod\" value=\"The type does not contain any valid method\" />\r\n  <string key=\"AddFunction.TypeIsAbstractOrStatic\" value=\"The type is marked as either abstract or static. Calling methods on abstract or static types is not supported.\" />\r\n  <string key=\"AddFunction.TypeMustNotHaveOverloads\" value=\"The type must not have overloads\" />\r\n  <string key=\"AddFunction.MethodNameIsEmpty\" value=\"Method name must be non-empty\" />\r\n  <string key=\"AddFunction.InvalidNamespace\" value=\"Namespace must be like A.B.C - not start and end with .\" />\r\n  <string key=\"AddFunction.NameAlreadyUsed\" value=\"The function name '{0}' is already used\" />\r\n  <string key=\"EditMethodBasedFunction.LabelFieldGroup\" value=\"Edit Method Based Query\" />\r\n  <string key=\"EditMethodBasedFunction.LabelMethodName\" value=\"Method Name\" />\r\n  <string key=\"EditMethodBasedFunction.LabelMethodNameHelp\" value=\"The name that the function should be know under.\" />\r\n  <string key=\"EditMethodBasedFunction.LabelNamespaceName\" value=\"Namespace Name\" />\r\n  <string key=\"EditMethodBasedFunction.LabelNamespaceNameHelp\" value=\"The namespace to place the method under.\" />\r\n  <string key=\"EditMethodBasedFunction.LabelType\" value=\"Type\" />\r\n  <string key=\"EditMethodBasedFunction.LabelTypeHelp\" value=\"The type that contains the method in question.\" />\r\n  <string key=\"EditMethodBasedFunction.LabelMethod\" value=\"Method\" />\r\n  <string key=\"EditMethodBasedFunction.LabelMethodHelp\" value=\"The method to invoke on the type.\" />\r\n  <string key=\"EditMethodBasedFunction.LabelError\" value=\"Error\" />\r\n  <string key=\"EditFunction.MethodNameEmpty\" value=\"Method name must be non-empty\" />\r\n  <string key=\"EditFunction.InvalidNamespace\" value=\"Namespace must not start and end with . - example A.B.C\" />\r\n  <string key=\"EditFunction.TypeNotFound\" value=\"Could not find type\" />\r\n  <string key=\"EditFunction.MethodNotInType\" value=\"The type does not contain the method\" />\r\n  <string key=\"EditFunction.NoValidMethod\" value=\"The type does not contain any valid method\" />\r\n  <string key=\"EditFunction.MethodOverloadsNotAllowed\" value=\"The type must not have overloads\" />\r\n  <string key=\"AddInlineFunctionWorkflow.FieldGroup.Label\" value=\"Settings\" />\r\n  <string key=\"AddInlineFunctionWorkflow.MethodName.Label\" value=\"Name\" />\r\n  <string key=\"AddInlineFunctionWorkflow.MethodName.Help\" value=\"The name of the method you want to create\" />\r\n  <string key=\"AddInlineFunctionWorkflow.MethodNamespace.Label\" value=\"Namespace\" />\r\n  <string key=\"AddInlineFunctionWorkflow.MethodNamespace.Help\" value=\"The namespace of the method you want to create\" />\r\n  <string key=\"AddInlineFunctionWorkflow.MethodDescription.Label\" value=\"Description\" />\r\n  <string key=\"AddInlineFunctionWorkflow.MethodDescription.Help\" value=\"A short description of the function\" />\r\n  <string key=\"AddInlineFunctionWorkflow.InlineFunctionMethodTemplate.Label\" value=\"Template\" />\r\n  <string key=\"AddInlineFunctionWorkflow.InlineFunctionMethodTemplate.Help\" value=\"Select the template that you want to use for the new method.\" />\r\n  <string key=\"EditInlineFunctionWorkflow.FieldGroup.Label\" value=\"Settings\" />\r\n  <string key=\"EditInlineFunctionWorkflow.MethodName.Label\" value=\"Name\" />\r\n  <string key=\"EditInlineFunctionWorkflow.MethodName.Help\" value=\"The name of the method you want to create\" />\r\n  <string key=\"EditInlineFunctionWorkflow.MethodNamespace.Label\" value=\"Namespace\" />\r\n  <string key=\"EditInlineFunctionWorkflow.MethodNamespace.Help\" value=\"The namespace of the method you want to create\" />\r\n  <string key=\"EditInlineFunctionWorkflow.MethodDescription.Label\" value=\"Description\" />\r\n  <string key=\"EditInlineFunctionWorkflow.MethodDescription.Help\" value=\"A short description of the function\" />\r\n  <string key=\"EditInlineFunctionWorkflow.DebugFieldGroup.Label\" value=\"Debug\" />\r\n  <string key=\"EditInlineFunctionWorkflow.DebugPage.Label\" value=\"Page\" />\r\n  <string key=\"EditInlineFunctionWorkflow.DebugPage.Help\" value=\"When debugging, this page is used as current page\" />\r\n  <string key=\"EditInlineFunctionWorkflow.DebugPageDataScope.Label\" value=\"Data scope\" />\r\n  <string key=\"EditInlineFunctionWorkflow.DebugPageDataScope.Help\" value=\"When debugging, this is used as current data scope\" />\r\n  <string key=\"EditInlineFunctionWorkflow.DebugActiveLocale.Label\" value=\"Language\" />\r\n  <string key=\"EditInlineFunctionWorkflow.DebugActiveLocale.Help\" value=\"When debugging, this is used as the current language\" />\r\n  <string key=\"EditInlineFunctionWorkflow.Code.Label\" value=\"Source\" />\r\n  <string key=\"EditInlineFunctionWorkflow.AssembliesFieldGroup.Label\" value=\"Assembly References\" />\r\n  <string key=\"EditInlineFunctionWorkflow.Preview.Label\" value=\"Preview\" />\r\n  <string key=\"EditInlineFunctionWorkflow.ParameterFieldGroup.Label\" value=\"Input Parameters\" />\r\n  <string key=\"EditInlineFunctionWorkflow.AdminitrativeScope.Label\" value=\"Administrative\" />\r\n  <string key=\"EditInlineFunctionWorkflow.PublicScope.Label\" value=\"Public\" />\r\n  <string key=\"InlineFunctionMethodTemplate.Clean\" value=\"Empty method\" />\r\n  <string key=\"InlineFunctionMethodTemplate.WithParameters\" value=\"Method with parameters\" />\r\n  <string key=\"InlineFunctionMethodTemplate.DataConnection\" value=\"Method using data connection\" />\r\n  <string key=\"CSharpInlineFunction.OnMissingContainerType\" value=\"A public static class named {0} is missing from the code. This class should contain the function method.\" />\r\n  <string key=\"CSharpInlineFunction.OnNamespaceMismatch\" value=\"The namespace in the code '{0}' does not match the given function namespace '{1}'.\" />\r\n  <string key=\"CSharpInlineFunction.OnMissionMethod\" value=\"The given function name '{0}' was not found or not public static in the class '{1}'.\" />\r\n  <string key=\"CSharpInlineFunction.MissingParameterDefinition\" value=\"The parameter '{0}' has not been added to 'Input Parameters' - to call your function you need to add the parameter and give it either a test or default value.\" />\r\n  <string key=\"CSharpInlineFunction.WrongParameterTestValueType\" value=\"The parameter '{0}' is expecting test value of type '{1}', got value of type '{2}'.\" />\r\n  <string key=\"CSharpInlineFunction.MissingParameterTestOrDefaultValue\" value=\"The parameter '{0}' defined on 'Input Parameters' must have a test or default value before your function can be evaluated.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.PackageElementProvider.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"RootFolderLabel\" value=\"Packages\" />\r\n  <string key=\"RootFolderToolTip\" value=\"Explore and manage installed packages\" />\r\n  <string key=\"AvailablePackagesFolderLabel\" value=\"Available Packages\" />\r\n  <string key=\"AvailablePackagesFolderToolTip\" value=\"Available packages\" />\r\n  <string key=\"InstalledPackageFolderLabel\" value=\"Installed Packages\" />\r\n  <string key=\"InstalledPackageFolderToolTip\" value=\"Installed packages\" />\r\n  <string key=\"LocalPackagesFolderLabel\" value=\"Local Packages\" />\r\n  <string key=\"LocalPackagesFolderToolTip\" value=\"Local packages\" />\r\n  <string key=\"PackageSourcesFolderLabel\" value=\"Package Sources\" />\r\n  <string key=\"PackageSourcesFolderToolTip\" value=\"Package sources\" />\r\n  <string key=\"ViewAvailableInformationLabel\" value=\"Package Info\" />\r\n  <string key=\"ViewAvailableInformationToolTip\" value=\"View package information\" />\r\n  <string key=\"InstallLabel\" value=\"Install\" />\r\n  <string key=\"InstallToolTip\" value=\"Install this C1 Package on your system\" />\r\n  <string key=\"ViewInstalledInformationLabel\" value=\"Package Info\" />\r\n  <string key=\"ViewInstalledInformationToolTip\" value=\"View package information\" />\r\n  <string key=\"InstallLocalPackageLabel\" value=\"Install Local Package...\" />\r\n  <string key=\"InstallLocalPackageToolTip\" value=\"Install package from local file system\" />\r\n  <string key=\"AddPackageSourceLabel\" value=\"Add Package Source\" />\r\n  <string key=\"AddPackageSourceToolTip\" value=\"Add package source\" />\r\n  <string key=\"DeletePackageSourceLabel\" value=\"Delete Package Source\" />\r\n  <string key=\"DeletePackageSourceToolTip\" value=\"Delete package source\" />\r\n  <string key=\"ClearServerCacheLabel\" value=\"Clear Cache\" />\r\n  <string key=\"ClearServerCacheToolTip\" value=\"Clear cache to get the newest packages\" />\r\n  <string key=\"ViewAvailableInformation.FieldGroupLabel\" value=\"Package Info\" />\r\n  <string key=\"ViewAvailableInformation.NameTextLabel\" value=\"Name\" />\r\n  <string key=\"ViewAvailableInformation.DescriptionTextLabel\" value=\"Description\" />\r\n  <string key=\"ViewAvailableInformation.AuthorTextLabel\" value=\"Author\" />\r\n\r\n  <string key=\"ViewAvailableInformation.TrialInfoFieldGroupLabel\" value=\"Free Trial Info\" />\r\n  <string key=\"ViewAvailableInformation.TrialInformationLabel\" value=\"Trial information\" />\r\n  <string key=\"ViewAvailableInformation.TrialInformationText\" value=\"This is a commercial package, available for free in the trial period. When the trial period has expired functionality may be degraded, unless you choose to purchase a license.\" />\r\n  <string key=\"ViewAvailableInformation.TrialDaysLabel\" value=\"Free trial period (days)\" />\r\n\t\r\n\t<string key=\"ViewAvailableInformation.LicenseInformationGroupLabel\" value=\"License Information\" />\r\n\t<string key=\"ViewAvailableInformation.SubscriptionNameLabel\" value=\"Subscription Name\" />\r\n\t<string key=\"ViewAvailableInformation.LicenseExpirationDateLabel\" value=\"License Expiration Date\" />\r\n\r\n\r\n  <string key=\"ViewAvailableInformation.InstallationInfoFieldGroupLabel\" value=\"Installation Info\" />\r\n  <string key=\"ViewAvailableInformation.VersionTextLabel\" value=\"Version\" />\r\n  <string key=\"ViewAvailableInformation.TechicalDescriptionTextLabel\" value=\"Technical Description\" />\r\n  <string key=\"ViewAvailableInformation.PackageSourceTextLabel\" value=\"Source\" />\r\n\r\n\r\n  <string key=\"ViewAvailableInformation.PriceTextLabel\" value=\"Price\" />\r\n  <string key=\"ViewAvailableInformation.SubscriptionListLabel\" value=\"Subscriptions that include this package\" />\r\n  <string key=\"ViewAvailableInformation.Toolbar.InstallLabel\" value=\"Install\" />\r\n  <string key=\"ViewAvailableInformation.Toolbar.ReadMoreLabel\" value=\"Read more\" />\r\n  <string key=\"ViewAvailableInformation.ShowError.MessageTitle\" value=\"Already Installed\" />\r\n  <string key=\"ViewAvailableInformation.ShowError.MessageMessage\" value=\"The package is already installed, cannot install the selected package.\" />\r\n  <string key=\"ViewAvailableInformation.ShowServerError.MessageTitle\" value=\"Package server did not respond\" />\r\n  <string key=\"ViewAvailableInformation.ShowServerError.MessageMessage\" value=\"The package server did not respond, try again or contact the system administrator\" />\r\n  <string key=\"ViewInstalledInformation.FieldGroupLabel\" value=\"Package Info\" />\r\n  <string key=\"ViewInstalledInformation.NameTextLabel\" value=\"Name\" />\r\n  <string key=\"ViewInstalledInformation.DateTextLabel\" value=\"Installation date\" />\r\n  <string key=\"ViewInstalledInformation.UserTextLabel\" value=\"Installed by\" />\r\n  <string key=\"ViewInstalledInformation.AuthorTextLabel\" value=\"Author\" />\r\n  <string key=\"ViewInstalledInformation.VersionTextLabel\" value=\"Version\" />\r\n  <string key=\"ViewInstalledInformation.TrialInfoFieldGroupLabel\" value=\"Trial info\" />\r\n  <string key=\"ViewInstalledInformation.TrialInformationLabel\" value=\"Trial information\" />\r\n  <string key=\"ViewInstalledInformation.TrialInformationText\" value=\"This is a commercial package, available for free in the trial period. When the trial period has expired functionality may be degraded, unless you choose to purchase a license.\" />\r\n  <string key=\"ViewInstalledInformation.TrialExpireLabel\" value=\"Trial expiration date\" />\r\n\t\r\n\t<string key=\"ViewInstalledInformation.LicenseInformationGroupLabel\" value=\"License Information\" />\r\n\t<string key=\"ViewInstalledInformation.SubscriptionNameLabel\" value=\"Subscription Name\" />\r\n\t<string key=\"ViewInstalledInformation.LicenseExpirationDateLabel\" value=\"License Expiration Date\" />\r\n\r\n  <string key=\"ViewInstalledInformation.Toolbar.UninstallLabel\" value=\"Uninstall\" />\r\n  <string key=\"ViewInstalledInformation.Toolbar.PurchaseLabel\" value=\"Purchase this!\" />\r\n  <string key=\"ViewInstalledInformation.ShowError.MessageTitle\" value=\"Already Uninstalled\" />\r\n  <string key=\"ViewInstalledInformation.ShowError.MessageMessage\" value=\"The package is already uninstalled, cannot uninstall the selected package.\" />\r\n  <string key=\"InstallRemotePackage.Step1.LayoutLabel\" value=\"Install Package\" />\r\n  <string key=\"InstallRemotePackage.Step1.HeadingTitle\" value=\"This is a trial/payment package\" />\r\n  <string key=\"InstallRemotePackage.Step1.HeadingDescription\" value=\"This package is subject to payment - please examine the EULA on the next screen for details about trial period and payment terms.\" />\r\n  <string key=\"InstallRemotePackage.Step2.LayoutLabel\" value=\"Install Package\" />\r\n  <string key=\"InstallRemotePackage.Step2.HeadingTitle\" value=\"License agreement\" />\r\n  <string key=\"InstallRemotePackage.Step2.HeadingDescription\" value=\"If you accept the terms of the agreement, click the check box below. You must accept the agreement to install.\" />\r\n  <string key=\"InstallRemotePackage.Step2.IAcceptItemLabel\" value=\"I accept the license agreement\" />\r\n  <string key=\"InstallRemotePackage.Step2.AcceptMissing\" value=\"You must accept the terms of the license agreement before you can proceed.\" />\r\n  <string key=\"InstallRemotePackage.Step3.LayoutLabel\" value=\"Install Package\" />\r\n  <string key=\"InstallRemotePackage.Step3.HeadingTitle\" value=\"Download and validate package\" />\r\n  <string key=\"InstallRemotePackage.Step3.HeadingDescription\" value=\"The package will be downloaded and validated. Please note that this may take several minutes. Click Next to continue.\" />\r\n  <string key=\"InstallRemotePackage.Step4.LayoutLabel\" value=\"Install Local Package\" />\r\n  <string key=\"InstallRemotePackage.Step4.HeadingTitle\" value=\"Ready to install\" />\r\n  <string key=\"InstallRemotePackage.Step4.HeadingDescription\" value=\"Ready to install the package. Please note that the installation may take several minutes. Click Next to continue.\" />\r\n  <string key=\"InstallRemotePackage.Step4.NonUninstallableHeadingTitle\" value=\"Ready to install\" />\r\n  <string key=\"InstallRemotePackage.Step4.NonUninstallableHeadingDescription\" value=\"Ready to install the package. Please note that the installation may take several minutes. Also note that this package can not be uninstalled. Click Next to continue.\" />\r\n  <string key=\"InstallRemotePackage.Step5.LayoutLabel\" value=\"Package Installed\" />\r\n  <string key=\"InstallRemotePackage.Step5.HeadingTitle\" value=\"Package installed successfully\" />\r\n  <string key=\"InstallRemotePackage.Step5.HeadingDescription\" value=\"Package installed successfully.\" />\r\n  <string key=\"InstallRemotePackage.ShowError.LayoutLabel\" value=\"Package installation failed\" />\r\n  <string key=\"InstallRemotePackage.ShowError.InfoTableCaption\" value=\"Package Installation Failed\" />\r\n  <string key=\"InstallRemotePackage.ShowError.MessageTitle\" value=\"Message\" />\r\n  <string key=\"InstallRemotePackage.ShowWarning.LayoutLabel\" value=\"The package Did Not Validate\" />\r\n  <string key=\"InstallRemotePackage.ShowWarning.InfoTableCaption\" value=\"The package did not validate\" />\r\n  <string key=\"InstallLocalPackage.Step1.LayoutLabel\" value=\"Install Local Package\" />\r\n  <string key=\"InstallLocalPackage.Step1.FileUploadLabel\" value=\"Package file\" />\r\n  <string key=\"InstallLocalPackage.Step1.FileUploadHelp\" value=\"Browse to and select the local package file\" />\r\n  <string key=\"InstallLocalPackage.Step2.LayoutLabel\" value=\"Install Local Package\" />\r\n  <string key=\"InstallLocalPackage.Step2.HeadingTitle\" value=\"Ready to install\" />\r\n  <string key=\"InstallLocalPackage.Step2.HeadingDescription\" value=\"Ready to install the package. Please note that the installation may take several minutes. Click Next to continue.\" />\r\n  <string key=\"InstallLocalPackage.Step3.LayoutLabel\" value=\"Package Installed\" />\r\n  <string key=\"InstallLocalPackage.Step3.HeadingTitle\" value=\"Package installed successfully\" />\r\n  <string key=\"InstallLocalPackage.Step3.HeadingDescription\" value=\"Package installed successfully.\" />\r\n  <string key=\"InstallLocalPackage.ShowError.LayoutLabel\" value=\"Package Installation Failed\" />\r\n  <string key=\"InstallLocalPackage.ShowError.InfoTableCaption\" value=\"Package installation failed\" />\r\n  <string key=\"InstallLocalPackage.ShowError.MessageTitle\" value=\"Message\" />\r\n  <string key=\"InstallLocalPackage.ShowWarning.LayoutLabel\" value=\"The package Did Not Validate\" />\r\n  <string key=\"InstallLocalPackage.ShowWarning.InfoTableCaption\" value=\"The package did not validate\" />\r\n  <string key=\"UninstallRemotePackage.Step1.LayoutLabel\" value=\"Uninstall Package\" />\r\n  <string key=\"UninstallRemotePackage.Step1.HeadingTitle\" value=\"Ready to check uninstallation process\" />\r\n  <string key=\"UninstallRemotePackage.Step1.HeadingDescription\" value=\"Ready to check the uninstall process of the package. Click Next to continue.\" />\r\n  <string key=\"UninstallRemotePackage.Step2.LayoutLabel\" value=\"Uninstall Package\" />\r\n  <string key=\"UninstallRemotePackage.Step2.HeadingTitle\" value=\"Ready to uninstall\" />\r\n  <string key=\"UninstallRemotePackage.Step2.HeadingDescription\" value=\"Ready to uninstall the package. Please note that the installation may take several minutes. Click Next to continue.\" />\r\n  <string key=\"UninstallRemotePackage.Step3.LayoutLabel\" value=\"Package Uninstalled\" />\r\n  <string key=\"UninstallRemotePackage.Step3.HeadingTitle\" value=\"Package uninstalled successfully\" />\r\n  <string key=\"UninstallRemotePackage.Step3.HeadingDescription\" value=\"Package uninstalled successfully.\" />\r\n  <string key=\"UninstallRemotePackage.ShowError.LayoutLabel\" value=\"Package Uninstallation Failed\" />\r\n  <string key=\"UninstallRemotePackage.ShowError.InfoTableCaption\" value=\"Package uninstallation failed\" />\r\n  <string key=\"UninstallRemotePackage.ShowError.MessageTitle\" value=\"Message\" />\r\n  <string key=\"UninstallRemotePackage.ShowUnregistre.LayoutLabel\" value=\"Uninstall Package\" />\r\n  <string key=\"UninstallRemotePackage.ShowUnregistre.HeadingTitle\" value=\"Registration of uninstallation failed\" />\r\n  <string key=\"UninstallRemotePackage.ShowUnregistre.HeadingDescription\" value=\"The registration of uninstallation failed. Contact the package vendor for manual unregistration.\" />\r\n  <string key=\"UninstallLocalPackage.Step1.LayoutLabel\" value=\"Uninstall Local Package\" />\r\n  <string key=\"UninstallLocalPackage.Step1.HeadingTitle\" value=\"Ready to check uninstallation process\" />\r\n  <string key=\"UninstallLocalPackage.Step1.HeadingDescription\" value=\"Ready to check the uninstall process of the package. Click Next to continue.\" />\r\n  <string key=\"UninstallLocalPackage.Step2.LayoutLabel\" value=\"Uninstall Local Package\" />\r\n  <string key=\"UninstallLocalPackage.Step2.HeadingTitle\" value=\"Ready to uninstall\" />\r\n  <string key=\"UninstallLocalPackage.Step2.HeadingDescription\" value=\"Ready to uninstall the package. Please note that the installation may take several minutes. Click Next to continue.\" />\r\n  <string key=\"UninstallLocalPackage.Step3.LayoutLabel\" value=\"Package Uninstalled\" />\r\n  <string key=\"UninstallLocalPackage.Step3.HeadingTitle\" value=\"Package uninstalled successfully\" />\r\n  <string key=\"UninstallLocalPackage.Step3.HeadingDescription\" value=\"Package uninstalled successfully.\" />\r\n  <string key=\"UninstallLocalPackage.ShowError.LayoutLabel\" value=\"Package Uninstallation Failed\" />\r\n  <string key=\"UninstallLocalPackage.ShowError.InfoTableCaption\" value=\"Package uninstallation failed\" />\r\n  <string key=\"UninstallLocalPackage.ShowError.MessageTitle\" value=\"Message\" />\r\n  <string key=\"AddPackageSource.Step1.LayoutLabel\" value=\"New Package Source\" />\r\n  <string key=\"AddPackageSource.Step1.FieldGroupLabel\" value=\"Package source data\" />\r\n  <string key=\"AddPackageSource.Step1.UrlLabel\" value=\"Package web service URL\" />\r\n  <string key=\"AddPackageSource.Step1.UrlHelp\" value=\"Packages can be hosted on remote servers. The package web service URL will be validated in the next step.\" />\r\n  <string key=\"AddPackageSource.Step1.UrlNotValid\" value=\"The entered text was not a valid URL\" />\r\n  <string key=\"AddPackageSource.Step1.UrlNonPackageServer\" value=\"The server is not a C1 CMS package server\" />\r\n  <string key=\"AddPackageSource.Step2.LayoutLabel\" value=\"Add Package Server Source\" />\r\n  <string key=\"AddPackageSource.Step2.HeadingTitle\" value=\"Server URL is valid\" />\r\n  <string key=\"AddPackageSource.Step2.HeadingNoHttpsDescription\" value=\"Note that the HTTP protocol is used on this connection. This implies that all information will be send unencrypted. Click Finish to add the source.\" />\r\n  <string key=\"AddPackageSource.Step2.HeadingWithHttpsDescription\" value=\"Click Finish to add the source.\" />\r\n  <string key=\"DeletePackageSource.Step1.LayoutLabel\" value=\"Delete Confirmation\" />\r\n  <string key=\"DeletePackageSource.Step1.Text\" value=\"Delete the selected server source\" />\r\n\r\n  <string key=\"ConfirmLicense.ExpiredTitle\" value=\"Trial Period Has Expired\" />\r\n  <string key=\"ConfirmLicense.ExpiredMessage\" value=\"The trial period of the package has expired. You need to obtain a valid license.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.PageElementProvider.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"AddNewPageStep1.DialogLabel\" value=\"Add New Page\" />\r\n  <string key=\"AddNewPageStep1.DialogLabelFormat\" value=\"Add New {0}\" />\r\n  <string key=\"GeneralSettings.FieldGroupLabel\" value=\"General settings\" />\r\n  <string key=\"PublicationSettings.FieldGroupLabel\" value=\"Publication settings\" />\r\n  <string key=\"AdvancedSettings.FieldGroupLabel\" value=\"Advanced settings\" />\r\n  <string key=\"AddNewPageStep1.LabelTitle\" value=\"Page title\" />\r\n  <string key=\"AddNewPageStep1.LabelTitleHelp\" value=\"The entry specified in this field is shown in the browser window title bar. The field is used by search engines and sitemaps\" />\r\n  <string key=\"AddNewPageStep1.LabelAbstract\" value=\"Description\" />\r\n  <string key=\"AddNewPageStep1.LabelAbstractHelp\" value=\"Use this field for at short description of the page\" />\r\n  <string key=\"AddNewPageStep1.LabelTemplate\" value=\"Page type\" />\r\n  <string key=\"AddNewPageStep1.HelpTemplate\" value=\"The page type selection influences the behavior and features of your page, like 'a normal page' or 'a blog'. The options available depend on features installed.\" />\r\n  <string key=\"AddNewPageStep1.LabelPosition\" value=\"Position\" />\r\n  <string key=\"AddNewPageStep1.HelpPosition\" value=\"Select where in the content tree you want the page to be placed.\" />\r\n  <string key=\"AddNewPageStep1.LabelAddToTop\" value=\"Insert at the top\" />\r\n  <string key=\"AddNewPageStep1.LabelAddToBottom\" value=\"Insert at the bottom\" />\r\n  <string key=\"AddNewPageStep1.LabelAddAlphabetic\" value=\"Insert alphabetically\" />\r\n  <string key=\"AddNewPageStep1.LabelAddBelowOtherPage\" value=\"Select position...\" />\r\n  <string key=\"AddNewPageStep2.LabelUrlTitle\" value=\"URL title\" />\r\n  <string key=\"AddNewPageStep2.HelpUrlTitle\" value=\"The entry specified in this field is shown in the browser address bar. The field is used by search engines\" />\r\n  <string key=\"AddNewPageStep2.LabelMenuTitle\" value=\"Menu title\" />\r\n  <string key=\"AddNewPageStep2.HelpMenuTitle\" value=\"The entry specified in this field can be used in the navigation on the website\" />\r\n  <string key=\"AddNewPageStep2.LabelPositionSelectorPanel\" value=\"Select detailed page position\" />\r\n  <string key=\"AddNewPageStep2.LabelPositionSelector\" value=\"Position below\" />\r\n  <string key=\"AddNewPageStep2.HelpPositionSelector\" value=\"\" />\r\n  <string key=\"AddNewPageStep1.TitleTooLong\" value=\"The specified title is too long. Make it shorter and try again\" />\r\n  <string key=\"AddNewPageStep1.MenuTitleTooLong\" value=\"The specified menu title is too long. Make it shorter and try again\" />\r\n  <string key=\"EditPage.LabelPaneSettings\" value=\"Settings\" />\r\n  <string key=\"EditPage.LabelPublicationState\" value=\"Status\" />\r\n  <string key=\"EditPage.HelpPublicationState\" value=\"Send the page to another status\" />\r\n  <string key=\"EditPage.LabelPageTitle\" value=\"Page title\" />\r\n  <string key=\"EditPage.LabelPageTitleHelp\" value=\"The entry specified in this field is shown in the browser window title bar. The field is used by search engines and sitemaps\" />\r\n  <string key=\"EditPage.LabelMenuTitle\" value=\"Menu title\" />\r\n  <string key=\"EditPage.HelpMenuTitle\" value=\"The entry specified in this field can be used in the navigation on the website\" />\r\n  <string key=\"EditPage.LabelUrlTitle\" value=\"URL title\" />\r\n  <string key=\"EditPage.UrlTitleFormattedTitle\" value=\"URL title was rewritten\" />\r\n  <string key=\"EditPage.UrlTitleFormattedMessage\" value=\"According to the current URL replacement rules, URL title was changed to '{0}'\" />\r\n  <string key=\"EditPage.HelpUrlTitle\" value=\"The entry specified in this field is shown in the browser address bar as a part of the URL address. The field is used by search engines\" />\r\n  <string key=\"EditPage.LabelFriendlyUrl\" value=\"Friendly URL\" />\r\n  <string key=\"EditPage.HelpFriendlyUrl\" value=\"The entry specified in this field is a shorter version of the actual page URL and redirects to it, when entered in the browser address bar. Note that some servers may have to be configured to support this feature.\" />\r\n  <string key=\"EditPage.LabelAbstract\" value=\"Description\" />\r\n  <string key=\"EditPage.LabelAbstractHelp\" value=\"Use this field for a short description of the page\" />\r\n  <string key=\"EditPage.LabelContent\" value=\"Content\" />\r\n  <string key=\"EditPage.LabelPreview\" value=\"Preview\" />\r\n  <string key=\"EditPage.PageTypeSelectorLabel\" value=\"Page type\" />\r\n  <string key=\"EditPage.PageTypeSelectorHelp\" value=\"The page type selection defines the role of the page, like 'a normal page' or 'a blog'. The options available depend on features installed.\" />\r\n  <string key=\"EditPage.MaxLength\" value=\"{0} characters maximum\" />\r\n  <string key=\"DeletePage.LabelFieldGroup\" value=\"Delete page?\" />\r\n  <string key=\"DeletePageStep1.Title\" value=\"Delete page and all subpages\" />\r\n  <string key=\"DeletePageStep1.Description\" value=\"All subpages will also be deleted. Continue?\" />\r\n  <string key=\"DeletePageStep2.Text\" value=\"Delete page '{0}'?\" />\r\n  <string key=\"UrlTitleNotUniqueError\" value=\"Another page is using the specified URL title. URL titles must be unique among pages with the same parent.\" />\r\n  <string key=\"UrlTitleNotValidError\" value=\"The specified URL title contains invalid characters. Since this field is used to build the web address for the page, certain special characters (like question mark, slash and dot) are not allowed. You can use letters, digits and dash.\" />\r\n  <string key=\"UrlTitleTooLong\" value=\"The specified URL title is too long. Make it shorter and try again\" />\r\n  <string key=\"FriendlyUrlNotUniqueError\" value=\"Another page is using the specified Friendly URL. Friendly URL's must be unique.\" />\r\n  <string key=\"TitleMissingError\" value=\"The title can not be empty.\" />\r\n  <string key=\"PageSaveValidationFailedTitle\" value=\"Page not saved\" />\r\n  <string key=\"PageSaveValidationFailedMessage\" value=\"The page did not validate and has not been saved. Please examine field messages.\" />\r\n  <string key=\"PageElementProvider.RootLabel\" value=\"Websites\" />\r\n  <string key=\"PageElementProvider.RootLabelToolTip\" value=\"Websites\" />\r\n  <string key=\"PageElementProvider.AddPageAtRoot\" value=\"Add Website\" />\r\n  <string key=\"PageElementProvider.AddPageAtRootFormat\" value=\"Add {0}\" />\r\n  <string key=\"PageElementProvider.AddPageAtRootToolTip\" value=\"Add new homepage\" />\r\n  <string key=\"PageElementProvider.ViewUnpublishedItems\" value=\"List Unpublished Content\" />\r\n  <string key=\"PageElementProvider.ViewUnpublishedItemsToolTip\" value=\"Get an overview of pages and other content that haven't been published yet.\" />\r\n  <string key=\"PageElementProvider.ViewUnpublishedItems-document-title\" value=\"Unpublished Content\" />\r\n  <string key=\"PageElementProvider.ViewUnpublishedItems-document-description\" value=\"The list below displays pages and other content which are currently in draft or are ready to be approved / published.\" />\r\n  <string key=\"PageElementProvider.EditPage\" value=\"Edit Page\" />\r\n  <string key=\"PageElementProvider.EditPageToolTip\" value=\"Edit selected page\" />\r\n  <string key=\"PageElementProvider.Delete\" value=\"Delete\" />\r\n  <string key=\"PageElementProvider.DeleteToolTip\" value=\"Delete the selected page\" />\r\n  <string key=\"PageElementProvider.Duplicate\" value=\"Duplicate Page\" />\r\n  <string key=\"PageElementProvider.DuplicateToolTip\" value=\"Duplicate the selected page\" />\r\n  <string key=\"PageElementProvider.LocalizePage\" value=\"Translate Page\" />\r\n  <string key=\"PageElementProvider.LocalizePageToolTip\" value=\"Translate selected page\" />\r\n  <string key=\"PageElementProvider.UnLocalizePage\" value=\"Undo Translation\" />\r\n  <string key=\"PageElementProvider.UnLocalizePageToolTip\" value=\"Delete translation for the selected page\" />\r\n  <string key=\"PageElementProvider.AddSubPage\" value=\"Add page\" />\r\n  <string key=\"PageElementProvider.AddSubPageFormat\" value=\"Add {0}\" />\r\n  <string key=\"PageElementProvider.AddSubPageToolTip\" value=\"Add new page below the selected\" />\r\n  <string key=\"PageElementProvider.DisplayLocalOrderingLabel\" value=\"Show page local orderings\" />\r\n  <string key=\"PageElementProvider.DisplayLocalOrderingToolTip\" value=\"Show page local orderings\" />\r\n  <string key=\"PageElementProvider.DisabledPage\" value=\"Not yet approved or published\" />\r\n  <string key=\"PageElementProvider.MissingTemplateTitle\" value=\"Website Template required\" />\r\n  <string key=\"PageElementProvider.MissingTemplateMessage\" value=\"You should create a 'Page Template' first. Go to the 'Layout' perspective and create one.\" />\r\n  <string key=\"PageElementProvider.MissingActiveLanguageTitle\" value=\"Language required\" />\r\n  <string key=\"PageElementProvider.MissingActiveLanguageMessage\" value=\"To add a page, you should firstly add at least one language. It can be done in the 'System' perspective.\" />\r\n  <string key=\"PageElementProvider.NoPageTypesAvailableTitle\" value=\"No page type available\" />\r\n  <string key=\"PageElementProvider.NoPageTypesAvailableMessage\" value=\"You should create a 'Page Type' first. Go to the 'Layout' perspective and create one.\" />\r\n  <string key=\"PageElementProvider.MissingPageTypeTitle\" value=\"Page type required\" />\r\n  <string key=\"PageElementProvider.MissingPageTypeHomepageMessage\" value=\"To create a homepage, a page type without the &quot;only subpages&quot; restriction is required, but none have been added yet. You can add one under the Layout perspective.\" />\r\n  <string key=\"PageElementProvider.MissingPageTypeSubpageMessage\" value=\"To create a subpage, a page type without the the only homepages restriction is required, but none have been added yet. You can add one under the Layout perspective.\" />\r\n  <string key=\"PageElementProvider.RuleDontAllowPageAddTitle\" value=\"Unable to add a page!\" />\r\n  <string key=\"PageElementProvider.RuleDontAllowPageAddMessage\" value=\"The rules that define availability for Page Types prohibit adding a page here.\" />\r\n  <string key=\"ManageHostNames.Add.DialogLabel\" value=\"Manage host name\" />\r\n  <string key=\"ManageHostNames.Add.HeadingTitle\" value=\"Add host name association to page\" />\r\n  <string key=\"ManageHostNames.Add.HeadingDescription\" value=\"You can associate a host name (or a domain name) to a page by specifying it in the field below. Please note that the DNS settings for the specified host name must also be configured, which is done outside this system.\" />\r\n  <string key=\"ManageHostNames.Add.FieldGroupLabel\" value=\"Host name association to page\" />\r\n  <string key=\"ManageHostNames.Add.HostNameTextBoxLabel\" value=\"Host name\" />\r\n  <string key=\"ManageHostNames.Add.HostNametextBoxHelp\" value=\"Specify the host name (like 'www.composite.net' or 'composite.net') you want to associate with this page\" />\r\n  <string key=\"ManageHostNames.Add.InvalidHostNameSyntaxError\" value=\"The syntax of the host name is not valid\" />\r\n  <string key=\"ManageHostNames.Add.HostNameNotUniqueError\" value=\"This host name is already associated to a page. You must remove the existing association first.\" />\r\n  <string key=\"ManageHostNames.Remove.DialogLabel\" value=\"Manage host name\" />\r\n  <string key=\"ManageHostNames.Remove.FieldGroupLabel\" value=\"Remove host name association from page\" />\r\n  <string key=\"ManageHostNames.Remove.MultiSelectorLabel\" value=\"Host names to remove\" />\r\n  <string key=\"ManageHostNames.Remove.MultiSelectorHelp\" value=\"The host names you select will no longer be associated with the page\" />\r\n  <string key=\"DeletePageWorkflow.MissingConfirmErrorMessage\" value=\"Please confirm deletion of all sub pages\" />\r\n  <string key=\"DeletePageWorkflow.CascadeDeleteErrorTitle\" value=\"Cascade delete error\" />\r\n  <string key=\"DeletePageWorkflow.CascadeDeleteErrorMessage\" value=\"The page is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  <string key=\"DeletePageWorkflow.HasCompositionsTitle\" value=\"Can not delete page\" />\r\n\t<string key=\"DeletePageWorkflow.HasCompositionsMessage\" value=\"This page has one or more page folders or metadata fields defined on it. Delete these first.\" />\r\n\t<string key=\"DeletePageWorkflow.ConfirmAllVersionsDeletion.DialogLabel\" value=\"Delete page versions\" />\r\n\t<string key=\"DeletePageWorkflow.ConfirmAllVersionsDeletion.Text\" value=\"This page contains multiple versions\" />\r\n\t<string key=\"DeletePageWorkflow.ConfirmAllVersionsDeletion.DeleteAllVersions\" value=\"Delete all versions\" />\r\n\t<string key=\"DeletePageWorkflow.ConfirmAllVersionsDeletion.DeleteCurrentVersion\" value=\"Delete only current version\" />\r\n  <string key=\"ViewUnpublishedItems.PageTitleLabel\" value=\"Title\" />\r\n  <string key=\"ViewUnpublishedItems.VersionLabel\" value=\"Version\" />\r\n  <string key=\"ViewUnpublishedItems.StatusLabel\" value=\"Status\" />\r\n  <string key=\"ViewUnpublishedItems.LabelChangedBy\" value=\"Author\" />\r\n  <string key=\"ViewUnpublishedItems.PublishDateLabel\" value=\"Publish Date\" />\r\n  <string key=\"ViewUnpublishedItems.PublishDateHelp\" value=\"Date and time the page has been scheduled to publish automatically. To edit, see the Publication Schedule in Edit Page mode.\" />\r\n  <string key=\"ViewUnpublishedItems.UnpublishDateLabel\" value=\"Unpublish Date\" />\r\n  <string key=\"ViewUnpublishedItems.UnpublishDateHelp\" value=\"Date and time the page has been scheduled to unpublish automatically. To edit, see the Publication Schedule in Edit Page mode.\" />\r\n  <string key=\"ViewUnpublishedItems.DateCreatedLabel\" value=\"Date Created\" />\r\n  <string key=\"ViewUnpublishedItems.DateModifiedLabel\" value=\"Date Modified\" />\r\n  <string key=\"ViewUnpublishedItems.PublishConfirmTitle\" value=\"Publish Pages\" />\r\n  <string key=\"ViewUnpublishedItems.PublishConfirmText\" value=\"You are about to publish these pages. Continue?\" />\r\n\r\n\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.PageTemplateElementProvider.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n  <string key=\"PageTemplateElementProvider.RootLabel\" value=\"Page Templates\" />\r\n  <string key=\"PageTemplateElementProvider.RootLabelToolTip\" value=\"You can find the sites XHTML templates here\" />\r\n  <string key=\"PageTemplateElementProvider.AddTemplate\" value=\"Add Template\" />\r\n  <string key=\"PageTemplateElementProvider.AddTemplateToolTip\" value=\"Add new template\" />\r\n  <string key=\"PageTemplateElementProvider.DeleteTemplate\" value=\"Delete\" />\r\n\t<string key=\"PageTemplateElementProvider.DeleteTemplateToolTip\" value=\"Delete this item\" />\r\n\r\n  <string key=\"PageTemplateElementProvider.SharedCodeFolder.Title\" value=\"Shared Code\" />\r\n  <string key=\"PageTemplateElementProvider.SharedCodeFolder.ToolTip\" value=\"Files used by layout files\" />\r\n  \r\n  <string key=\"EditSharedCodeFile.Label\" value=\"Edit\" /> \r\n  <string key=\"EditSharedCodeFile.ToolTip\" value=\"Edit the file\" />\r\n\r\n  <string key=\"PageTemplateElementProvider.EditXmlTemplate\" value=\"Edit XML Template\" />\r\n  <string key=\"PageTemplateElementProvider.EditXmlTemplateToolTip\" value=\"Edit the selected XML template\" />\r\n\r\n  <string key=\"AddNewXmlPageTemplate.LabelDialog\" value=\"Add New XML Page Template\" />\r\n  <string key=\"AddNewXmlPageTemplate.LabelTemplateTitle\" value=\"Template Title\" />\r\n  <string key=\"AddNewXmlPageTemplate.LabelTemplateTitleHelp\" value=\"The title identifies this template in lists. Consider selecting a short but meaningful name.\" />\r\n  <string key=\"AddNewXmlPageTemplate.LabelCopyFrom\" value=\"Copy from\" />\r\n  <string key=\"AddNewXmlPageTemplate.LabelCopyFromHelp\" value=\"You can copy the markup from another XML Page Template by selecting it in this list.\" />\r\n  <string key=\"AddNewXmlPageTemplate.LabelCopyFromEmptyOption\" value=\"(New template)\" />\r\n  <string key=\"AddNewXmlPageTemplateWorkflow.TitleInUseTitle\" value=\"Title already used\" />\r\n  <string key=\"AddNewXmlPageTemplateWorkflow.TitleTooLong\" value=\"The title is too long (used as part of the XML filename).\" />\r\n\r\n  <string key=\"EditXmlPageTemplate.LabelMarkUpCode\" value=\"Markup Code\" />\r\n  <string key=\"EditXmlPageTemplate.LabelTemplateIdentification\" value=\"Template Info\" />\r\n  <string key=\"EditXmlPageTemplate.LabelTemplateTitle\" value=\"Template Title\" />\r\n  <string key=\"EditXmlPageTemplate.LabelTemplateTitleHelp\" value=\"The title identifies this template in lists. Consider selecting a short but meaningful name.\" />\r\n\r\n  <string key=\"EditXmlPageTemplateWorkflow.InvalidXmlTitle\" value=\"Unable to Save Template\" />\r\n  <string key=\"EditXmlPageTemplateWorkflow.InvalidXmlMessage\" value=\"The page template markup did not validate. {0}\" />\r\n  <string key=\"EditXmlPageTemplateWorkflow.CannotRenameFileExists\" value=\"Cannot rename a template - the file with the name '{0}' already exists.\" />\r\n  <string key=\"EditXmlPageTemplateWorkflow.TitleInUseTitle\" value=\"Title already used\" />\r\n\r\n  <string key=\"DeletePageTemplateStep1.LabelFieldGroup\" value=\"Delete This Page Template?\" />\r\n\t<string key=\"DeletePageTemplateStep1.Text\" value=\"Delete page template?\" />\r\n\t\r\n\t<string key=\"DeletePageTemplateWorkflow.CascadeDeleteErrorTitle\" value=\"Cascade Delete Error\" />\r\n\t<string key=\"DeletePageTemplateWorkflow.CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted.\" />\r\n\r\n  <string key=\"DeletePageTemplateWorkflow.PageReference\" value=\"There are {0} page[s] referencing this template: {1}\" /> \r\n  <string key=\"DeletePageTemplateWorkflow.PageTypeReference\" value=\"There are {0} page type[s] referencing this template: {1}\" />\r\n\r\n  <string key=\"AddNewPageTemplate.LabelDialog\" value=\"Add New Page Template\" />\r\n  <string key=\"AddNewPageTemplate.TemplateTypeHelp\" value=\"Choose one of the possible types of page templates\" />\r\n  <string key=\"AddNewPageTemplate.TemplateTypeLabel\" value=\"Template type\" />\r\n\r\n  <string key=\"AddNewPageTemplate.TemplateType.Razor\" value=\"Razor\" />\r\n  <string key=\"AddNewPageTemplate.TemplateType.MasterPage\" value=\"Master Page\" />\r\n  <string key=\"AddNewPageTemplate.TemplateType.XML\" value=\"XML\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.PageTemplateFeatureElementProvider.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n    <string key=\"ElementProvider.RootLabel\" value=\"Page Template Features\" />\r\n    <string key=\"ElementProvider.RootToolTip\" value=\"Here you can find features - snippets of HTML and functionality - included in the website templates.\" />\r\n    <string key=\"ElementProvider.AddTemplateFeature\" value=\"Add Template Feature\" />\r\n    <string key=\"ElementProvider.AddTemplateFeatureToolTip\" value=\"Add a new page template feature\" />\r\n    <string key=\"ElementProvider.DeleteTemplateFeature\" value=\"Delete Template Feature\" />\r\n    <string key=\"ElementProvider.DeleteTemplateFeatureToolTip\" value=\"Delete this template feature\" />\r\n    <string key=\"ElementProvider.EditTemplateFeature\" value=\"Edit Template Feature\" />\r\n    <string key=\"ElementProvider.EditTemplateFeatureToolTip\" value=\"Edit the selected template feature\" />\r\n    <string key=\"ElementProvider.EditVisually\" value=\"Use Visual Editor\" />\r\n    <string key=\"ElementProvider.EditVisuallyToolTip\" value=\"When enabled the visual editor will be used to manage this feature\" />\r\n\r\n    <string key=\"AddWorkflow.LabelDialog\" value=\"Add New Page Template Feature\" />\r\n    <string key=\"AddWorkflow.LabelTemplateFeatureName\" value=\"Feature name\" />\r\n    <string key=\"AddWorkflow.LabelTemplateFeatureNameHelp\" value=\"The name is used to identify this feature when included in templates\" />\r\n    <string key=\"AddWorkflow.LabelTemplateFeatureEditorType\" value=\"Editor type\" />\r\n    <string key=\"AddWorkflow.LabelTemplateFeatureEditorTypeHelp\" value=\"Choose which type of editor to use when maintaining this feature. You can always switch the editor type in the tree later.\" />\r\n    <string key=\"AddWorkflow.LabelTemplateFeatureEditorType.html\" value=\"Visual Editor\" />\r\n    <string key=\"AddWorkflow.LabelTemplateFeatureEditorType.xml\" value=\"Markup Editor\" />\r\n    <string key=\"AddWorkflow.NameInUse\" value=\"The name is already used by another feature\" />\r\n    <string key=\"AddWorkflow.NameTooLong\" value=\"The title is too long (max 50 characters)\" />\r\n    <string key=\"AddWorkflow.NameNotValidInFilename\" value=\"The name must be usable in a file name - you have invalid characters you need to remove\" />\r\n\r\n    <string key=\"DeleteWorkflow.Title\" value=\"Delete This Page Template Feature?\" />\r\n    <string key=\"DeleteWorkflow.Text\" value=\"If this feature is in use by page templates, this action could lead to errors.\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.PageTypeElementProvider.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"PageType.Tree.Root.Label\" value=\"Page Types\" />\r\n  <string key=\"PageType.Tree.DefaultContentElement.Label\" value=\"Placeholder Content\" />\r\n  <string key=\"PageType.Tree.MetaDataFieldsElement.Label\" value=\"Metadata Fields\" />\r\n  <string key=\"PageType.Tree.AddNewPageType.Label\" value=\"Add Page Type\" />\r\n  <string key=\"PageType.Tree.AddNewPageType.ToolTip\" value=\"Add new page type\" />\r\n  <string key=\"PageType.Tree.EditPageType.Label\" value=\"Edit Page Type\" />\r\n  <string key=\"PageType.Tree.EditPageType.ToolTip\" value=\"Edit selected page type\" />\r\n  <string key=\"PageType.Tree.DeletePageType.Label\" value=\"Delete Page Type\" />\r\n  <string key=\"PageType.Tree.DeletePageType.ToolTip\" value=\"Delete selected page type\" />\r\n  <string key=\"PageType.Tree.AddDefaultPageContent.Label\" value=\"Add Default Content\" />\r\n  <string key=\"PageType.Tree.AddDefaultPageContent.ToolTip\" value=\"Add placeholder default content\" />\r\n  <string key=\"PageType.Tree.EditDefaultPageContent.Label\" value=\"Edit Default Content\" />\r\n  <string key=\"PageType.Tree.EditDefaultPageContent.ToolTip\" value=\"Edit placeholder default content\" />\r\n  <string key=\"PageType.Tree.DeleteDefaultPageContent.Label\" value=\"Delete Default Content\" />\r\n  <string key=\"PageType.Tree.DeleteDefaultPageContent.ToolTip\" value=\"Delete default content\" />\r\n  <string key=\"PageType.Tree.AddMetaDataField.Label\" value=\"Add Metadata Field\" />\r\n  <string key=\"PageType.Tree.AddMetaDataField.ToolTip\" value=\"Add new Metadata field\" />\r\n  <string key=\"PageType.Tree.EditMetaDataField.Label\" value=\"Edit Metadata Field\" />\r\n  <string key=\"PageType.Tree.EditMetaDataField.ToolTip\" value=\"Edit selected Metadata field\" />\r\n  <string key=\"PageType.Tree.DeleteMetaDataField.Label\" value=\"Delete Metadata Field\" />\r\n  <string key=\"PageType.Tree.DeleteMetaDataField.ToolTip\" value=\"Delete selected Metadata field\" />\r\n  <string key=\"PageType.AddNewPageTypeWorkflow.Layout.Label\" value=\"Add New Page Type\" />\r\n  <string key=\"PageType.AddNewPageTypeWorkflow.FieldGroup.Label\" value=\"New page type settings\" />\r\n  <string key=\"PageType.AddNewPageTypeWorkflow.NameTextBox.Label\" value=\"Name\" />\r\n  <string key=\"PageType.AddNewPageTypeWorkflow.NameTextBox.Help\" value=\"The name of the new page type\" />\r\n  <string key=\"PageType.AddNewPageTypeWorkflow.DescriptionTextArea.Label\" value=\"Description\" />\r\n  <string key=\"PageType.AddNewPageTypeWorkflow.DescriptionTextArea.Help\" value=\"The description of the new page type\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.SettingsPlaceHolder.Label\" value=\"Settings\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.SettingsFieldGroup.Label\" value=\"Page type settings\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.NameTextBox.Label\" value=\"Name\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.NameTextBox.Help\" value=\"The name of the page type\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DescriptionTextArea.Label\" value=\"Description\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DescriptionTextArea.Help\" value=\"The description of the page type\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.AvailableCheckBox.Label\" value=\"Available\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.AvailableCheckBox.Help\" value=\"Unchecking this will make this page non-selectable on any page\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.PresetMenuTitleCheckBox.Label\" value=\"Preset menu title\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.PresetMenuTitleCheckBox.Help\" value=\"If this is checked a default value for the menu title on pages is preset\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.Label\" value=\"Default child page type\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.Help\" value=\"Select a page type to be the default page type for child pages created with this page type\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DefaultChildPageTypeKeySelector.NoneSelectedLabel\" value=\"[None]\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.PageTemplatePlaceHolder.Label\" value=\"Layout\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.PageTemplateRestrictionFieldGroup.Label\" value=\"Layout\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.PageTemplateRestrictionMultiKeySelector.Label\" value=\"Layout restrictions\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.PageTemplateRestrictionMultiKeySelector.Help\" value=\"Select layouts to be only available when editing pages of this page type. If none is selected (default), all will be available.\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.Label\" value=\"Default layout\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.Help\" value=\"Select a layout to be the default layout for pages created with this page type\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DefaultPageTemplateKeySelector.NoneSelectedLabel\" value=\"[None]\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.AvailabilityPlaceHolder.Label\" value=\"Availability\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.AvailabilityFieldGroup.Label\" value=\"Availability\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.Label\" value=\"Homepage relation\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.Help\" value=\"Homepage relation\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.NoRestrictionLabel\" value=\"No restrictions\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.OnlySubPagesLabel\" value=\"Only sub pages\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.HomepageRelationKeySelector.OnlyHomePagesLabel\" value=\"Only home pages\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.PageTypeChildRestrictionMultiKeySelector.Label\" value=\"Page type parent restriction\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.PageTypeChildRestrictionMultiKeySelector.Help\" value=\"Only allow this page type as for child pages with the selected page types\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DataFolderApplicationPlaceHolder.Label\" value=\"DataFolders / Applications\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DataFolderFieldGroup.Label\" value=\"Data folders\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DataFolderMultiKeySelector.Label\" value=\"Data folders\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.DataFolderMultiKeySelector.Help\" value=\"Select the data folders that should automatically be added to pages using this page type\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.ApplicationFieldGroup.Label\" value=\"Applications\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.ApplicationMultiKeySelector.Label\" value=\"Applications\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.ApplicationMultiKeySelector.Help\" value=\"Select the applications that should automatically be added to pages using this page type\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.ValidationError.DefaultTemplateNotInRestrictions\" value=\"The default layout is not one of the selected restricted layouts\" />\r\n  <string key=\"PageType.EditPageTypeWorkflow.ValidationError.HomepageRelationConflictsWithParentRestrictions\" value=\"Page type parent restrictions are not allowed with home pages only\" />\r\n  <string key=\"PageType.DeletePageTypeWorkflow.Confirm.Layout.Label\" value=\"Delete This Page Type?\" />\r\n  <string key=\"PageType.DeletePageTypeWorkflow.Confirm.Layout.Messeage\" value=\"Delete the page type {0}?\" />\r\n  <string key=\"PageType.DeletePageTypeWorkflow.PagesRefering.Layout.Label\" value=\"Page Type in Use\" />\r\n  <string key=\"PageType.DeletePageTypeWorkflow.PagesRefering.Layout.Message\" value=\"The page type {0} is in use and it is not possible to delete it\" />\r\n  <string key=\"PageType.AddPageTypeDefaultPageContentWorkflow.Layout.Label\" value=\"Add Default Content\" />\r\n  <string key=\"PageType.AddPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Label\" value=\"Placeholder ID\" />\r\n  <string key=\"PageType.AddPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Help\" value=\"The ID of the placeholder. You can write a non-existing ID and create the placeholder afterwards (by editing Page Template markup).\" />\r\n  <string key=\"PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Title\" value=\"No templates with {0}\" />\r\n  <string key=\"PageType.AddPageTypeDefaultPageContentWorkflow.NonExistingPlaceholderId.Message\" value=\"Please note that the Placeholder ID you specified '{0}', is currently not in any Layout Template.\" />\r\n  <string key=\"PageType.EditPageTypeDefaultPageContentWorkflow.Layout.Label\" value=\"Edit default content\" />\r\n  <string key=\"PageType.EditPageTypeDefaultPageContentWorkflow.SettingsPlaceHolder.Label\" value=\"Settings\" />\r\n  <string key=\"PageType.EditPageTypeDefaultPageContentWorkflow.SettingsFieldGroup.Label\" value=\"Placeholder Settings\" />\r\n  <string key=\"PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Label\" value=\"Placeholder ID\" />\r\n  <string key=\"PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderIdTextBox.Help\" value=\"The ID of the placeholder. You can write a non-existing ID and create the placeholder afterwards (edit Page Template markup).\" />\r\n  <string key=\"PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderContainerClassesTextBox.Label\" value=\"Container Classes\" />\r\n  <string key=\"PageType.EditPageTypeDefaultPageContentWorkflow.PlaceHolderContainerClassesTextBox.Help\" value=\"Extra 'Container Classes' to add to this placeholder when user is editing this type of page. Container classes let you style the editor and control which components can be added.\" />\r\n  <string key=\"PageType.EditPageTypeDefaultPageContentWorkflow.ContentXhtmlEditor.Label\" value=\"Content\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.Layout.Label\" value=\"Add Metadata Field\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.FieldGroup.Label\" value=\"\" />\r\n  <!-- \"Metadata settings\" - but too much text! -->\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.NameTextBox.Label\" value=\"Programmatic name\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.NameTextBox.Help\" value=\"The unique name of the Metadata field. This can not be changed later!\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.LabelTextBox.Label\" value=\"Show with label\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.LabelTextBox.Help\" value=\"The label of the Metadata field. Used for UI.\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataTypeKeySelector.Label\" value=\"Metadata type\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataTypeKeySelector.Help\" value=\"The Metadata type\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Label\" value=\"Display on tab\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Help\" value=\"Select the tab to display the Metadata when editing a page.\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.AddingDefaultMetaData.Title\" value=\"Add Metadata default values\" />\r\n  <string key=\"PageType.AddPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataFieldNameAlreadyUsed\" value=\"The field name with another type is already used.\" />\r\n  <string key=\"PageType.DeletePageTypeMetaDataFieldWorkflow.Confirm.Layout.Label\" value=\"Delete This Metadata Field?\" />\r\n  <string key=\"PageType.DeletePageTypeMetaDataFieldWorkflow.Confirm.Layout.Message\" value=\"Delete the Metadata field {0}? Warning: all its existing Metadata items will also be deleted\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.Layout.Label\" value=\"Edit Metadata Field\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.FieldGroup.Label\" value=\"Metadata field settings\" />\r\n  <!--<string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.NameTextBox.Label\" value=\"Name\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.NameTextBox.Help\" value=\"The uniqueue name of the Metadata field\" />-->\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.LabelTextBox.Label\" value=\"Label\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.LabelTextBox.Help\" value=\"The label of the Metadata field. Used for UI\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Label\" value=\"Tab\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.MetaDataContainerKeySelector.Help\" value=\"Select the tab to put the Metadata when editing a page\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.MetaTypeName.Label\" value=\"Metatype\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.MetaTypeName.Help\" value=\"The name of the metatype.\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataFieldNameAlreadyUsed\" value=\"The Metadata type is used another place with same name but different label\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataContainerChangeNotAllowed\" value=\"There exists one or more definitions with the same name, container change is not allowed\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataTypeNotExisting.Title\" value=\"Metadata type has been deleted\" />\r\n  <string key=\"PageType.EditPageTypeMetaDataFieldWorkflow.ValidationError.MetaDataTypeNotExisting.Message\" value=\"The Metadata type has been deleted from the system and can no longer be added to any page types\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.RazorFunction.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"RootElement.Label\" value=\"Razor Functions\" />\r\n  <string key=\"RootElement.ToolTip\" value=\"Razor functions\" />\r\n\r\n  <string key=\"AddNewRazorFunction.Label\" value=\"Add Razor Function\" />\r\n  <string key=\"AddNewRazorFunction.ToolTip\" value=\"Add a new Razor function\" />\r\n  <string key=\"EditRazorFunction.Label\" value=\"Edit\" />\r\n  <string key=\"EditRazorFunction.ToolTip\" value=\"Edit Razor Function\" />\r\n  <string key=\"DeleteRazorFunction.Label\" value=\"Delete\" />\r\n  <string key=\"DeleteRazorFunction.ToolTip\" value=\"Delete this Razor function\" />\r\n\r\n  <string key=\"AddNewRazorFunction.LabelDialog\" value=\"Add Razor Function\" />\r\n  <string key=\"AddNewRazorFunction.LabelName\" value=\"Name\" />\r\n  <string key=\"AddNewRazorFunction.HelpName\" value=\"\" />\r\n  <string key=\"AddNewRazorFunction.LabelNamespace\" value=\"Namespace\" />\r\n  <string key=\"AddNewRazorFunction.HelpNamespace\" value=\"\" />\r\n  <string key=\"AddNewRazorFunction.LabelCopyFrom\" value=\"Copy from\" />\r\n  <string key=\"AddNewRazorFunction.LabelCopyFromHelp\" value=\"You can copy the code from another Razor function by selecting it in this list.\" />\r\n  <string key=\"AddNewRazorFunction.LabelCopyFromEmptyOption\" value=\"(New Razor function)\" />\r\n\r\n\r\n  <string key=\"AddNewRazorFunctionWorkflow.DuplicateName\" value=\"A C1 function with the same name already exists.\" />\r\n  <string key=\"AddNewRazorFunctionWorkflow.EmptyName\" value=\"The function name is empty\" />\r\n  <string key=\"AddNewRazorFunctionWorkflow.NamespaceEmpty\" value=\"The function namespace is empty\" />\r\n  <string key=\"AddNewRazorFunctionWorkflow.InvalidNamespace\" value=\"The namespace must be like A.B.C - not starting or ending with a period (.)\" />\r\n  <string key=\"AddNewRazorFunctionWorkflow.TotalNameTooLang\" value=\"The total length of the name and the namespace is too long (used to name the .cshtml file).\" />\r\n\r\n  <string key=\"EditRazorFunctionWorkflow.Validation.DialogTitle\" value=\"Validation Error\" />\r\n  <string key=\"EditRazorFunctionWorkflow.Validation.CompilationFailed\" value=\"Compilation failed: {0}\" />\r\n  <string key=\"EditRazorFunctionWorkflow.Validation.IncorrectBaseClass\" value=\"Razor function should inherit '{0}'\" />\r\n\r\n  <string key=\"DeleteRazorFunctionWorkflow.ConfirmDeleteTitle\" value=\"Delete Razor Function?\" />\r\n  <string key=\"DeleteRazorFunctionWorkflow.ConfirmDeleteMessage\" value=\"Delete the selected Razor function?\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.RazorPageTemplate.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n  <string key=\"EditRazorFileAction.Label\" value=\"Edit Razor File\" />\r\n  <string key=\"EditRazorFileAction.ToolTip\" value=\"Edit the cshtml file\" />\r\n\r\n  <string key=\"EditRazorTemplateAction.Label\" value=\"Edit Razor Template\" />\r\n  <string key=\"EditRazorTemplateAction.ToolTip\" value=\"Edit the cshtml file behind the template\" />\r\n\r\n  <string key=\"DeleteRazorPageTemplateAction.Label\" value=\"Delete\" />\r\n  <string key=\"DeleteRazorPageTemplateAction.ToolTip\" value=\"Delete page template\" />\r\n\r\n  <string key=\"AddNewRazorPageTemplate.LabelDialog\" value=\"Add New Razor Template\" />\r\n  <string key=\"AddNewRazorPageTemplate.LabelTemplateTitle\" value=\"Template Title\" />\r\n  <string key=\"AddNewRazorPageTemplate.LabelTemplateTitleHelp\" value=\"The title identifies this template in lists. Consider selecting a short but meaningful name.\" />\r\n  <string key=\"AddNewRazorPageTemplate.LabelCopyFrom\" value=\"Copy from\" />\r\n  <string key=\"AddNewRazorPageTemplate.LabelCopyFromHelp\" value=\"You can copy the markup from another Layout Template by selecting it in this list.\" />\r\n  <string key=\"AddNewRazorPageTemplate.LabelCopyFromEmptyOption\" value=\"(New template)\" />\r\n  <string key=\"AddNewRazorPageTemplateWorkflow.TitleInUseTitle\" value=\"Title already used\" />\r\n  <string key=\"AddNewRazorPageTemplateWorkflow.TitleTooLong\" value=\"The title is too long (used as part of the .cshtml filename).\" />\r\n\r\n  <string key=\"EditTemplate.Validation.DialogTitle\" value=\"Validation error\" />\r\n  <string key=\"EditTemplate.Validation.CompilationFailed\" value=\"Compilation failed: {0}\" />\r\n  <string key=\"EditTemplate.Validation.IncorrectBaseClass\" value=\"Page template class does not inherit '{0}'\" />\r\n  <string key=\"EditTemplate.Validation.PropertyError\" value=\"Failed to evaluate page template property '{0}'. Excepton: {1}\" />\r\n  <string key=\"EditTemplate.Validation.TemplateIdChanged\" value=\"It is not allowed to change template id through current workflow. Original template id is '{0}'\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.SqlFunction.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"SqlFunctionElementProvider.RootLabel\" value=\"SQL Functions\" />\r\n  <string key=\"SqlFunctionElementProvider.RootLabelToolTip\" value=\"Add Connections and then queries to connections\" />\r\n  <string key=\"SqlFunctionElementProvider.AddConnection\" value=\"Add SQL Connection\" />\r\n  <string key=\"SqlFunctionElementProvider.AddConnectionToolTip\" value=\"Add new SQL connection\" />\r\n  <string key=\"SqlFunctionElementProvider.EditConnection\" value=\"Edit\" />\r\n  <string key=\"SqlFunctionElementProvider.EditConnectionToolTip\" value=\"Edit SQL connection\" />\r\n  <string key=\"SqlFunctionElementProvider.DeleteConnection\" value=\"Delete\" />\r\n  <string key=\"SqlFunctionElementProvider.DeleteConnectionToolTip\" value=\"Delete SQL connection\" />\r\n  <string key=\"SqlFunctionElementProvider.AddQuery\" value=\"Add New SQL Query\" />\r\n  <string key=\"SqlFunctionElementProvider.AddQueryToolTip\" value=\"Add a new SQL XML Provider\" />\r\n  <string key=\"SqlFunctionElementProvider.EditQuery\" value=\"Edit\" />\r\n  <string key=\"SqlFunctionElementProvider.EditQueryToolTip\" value=\"Edit SQL Query\" />\r\n  <string key=\"SqlFunctionElementProvider.DeleteQuery\" value=\"Delete\" />\r\n  <string key=\"SqlFunctionElementProvider.DeleteQueryToolTip\" value=\"Delete SQL Query\" />\r\n  <string key=\"AddNewSqlFunction.LabelDialog\" value=\"Add New SQL Query\" />\r\n  <string key=\"AddNewSqlFunction.LabelNamingPanel\" value=\"Function naming\" />\r\n  <string key=\"AddNewSqlFunction.LabelName\" value=\"Name\" />\r\n  <string key=\"AddNewSqlFunction.HelpName\" value=\"\" />\r\n  <string key=\"AddNewSqlFunction.LabelNamespace\" value=\"Namespace\" />\r\n  <string key=\"AddNewSqlFunction.HelpNamespace\" value=\"\" />\r\n  <string key=\"AddNewSqlFunction.LabelQueryCOmmand\" value=\"SQL command text\" />\r\n  <string key=\"AddNewSqlFunction.HelpQueryCOmmand\" value=\"\" />\r\n  <!-- shared on add and edit -->\r\n  <string key=\"AddEditSqlFunction.LabelIsStoredProcedure\" value=\"Is a Stored Procedure\" />\r\n  <string key=\"AddEditSqlFunction.LabelIsStoredProcedureCheckBox\" value=\"Yes, the command is a procedure\" />\r\n  <string key=\"AddEditSqlFunction.LabelReturnsXml\" value=\"Returns result as XML\" />\r\n  <string key=\"AddEditSqlFunction.LabelReturnsXmlCheckBox\" value=\"Yes, the command returns XML\" />\r\n  <string key=\"AddEditSqlFunction.LabelIsQuery\" value=\"Is a query\" />\r\n  <string key=\"AddEditSqlFunction.LabelIsQueryCheckBox\" value=\"Yes, the command returns data\" />\r\n  <string key=\"AddEditSqlFunction.LabelCommandBehaviour\" value=\"SQL Command behaviour\" />\r\n  <string key=\"AddEditSqlFunction.LabelSqlEditor\" value=\"SQL Command\" />\r\n  <string key=\"AddNewSqlFunctionConnection.LabelDialog\" value=\"Add New SQL Connection\" />\r\n  <string key=\"AddNewSqlFunctionConnection.LabelName\" value=\"Name\" />\r\n  <string key=\"AddNewSqlFunctionConnection.HelpName\" value=\"\" />\r\n  <string key=\"AddNewSqlFunctionConnection.LabelConnectionString\" value=\"Connection String\" />\r\n  <string key=\"AddNewSqlFunctionConnection.HelpConnectionString\" value=\"\" />\r\n  <string key=\"AddNewSqlFunctionConnection.LabelIsMSSQL\" value=\"MS SQL Server\" />\r\n  <string key=\"AddNewSqlFunctionConnection.LabelIsMSSQLCheckBox\" value=\"Database is a MS SQL Server\" />\r\n  <string key=\"EditSqlFunctionConnection.LabelFieldGroup\" value=\"SQL Connection settings\" />\r\n  <string key=\"EditSqlFunction.LabelInputParameters\" value=\"Input Parameters\" />\r\n  <string key=\"EditSqlFunction.LabelSettings\" value=\"Settings\" />\r\n  <string key=\"EditSqlFunction.LabelNamingAndDescription\" value=\"Function name and description\" />\r\n  <string key=\"EditSqlFunction.LabelName\" value=\"Name\" />\r\n  <string key=\"EditSqlFunction.HelpName\" value=\"\" />\r\n  <string key=\"EditSqlFunction.LabelNamespace\" value=\"Namespace\" />\r\n  <string key=\"EditSqlFunction.HelpNamespace\" value=\"\" />\r\n  <string key=\"EditSqlFunction.LabelDescription\" value=\"Description\" />\r\n  <string key=\"EditSqlFunction.HelpDescription\" value=\"\" />\r\n  <string key=\"EditSqlFunction.LabelPreview\" value=\"Preview\" />\r\n  <string key=\"EditSqlFunctionConnection.LabelName\" value=\"Name\" />\r\n  <string key=\"EditSqlFunctionConnection.HelpName\" value=\"\" />\r\n  <string key=\"EditSqlFunctionConnection.LabelConnectionString\" value=\"Connection String\" />\r\n  <string key=\"EditSqlFunctionConnection.HelpConnectionString\" value=\"\" />\r\n  <string key=\"EditSqlFunctionConnection.LabelIsMSSQL\" value=\"MS SQL Server\" />\r\n  <string key=\"EditSqlFunctionConnection.LabelIsMSSQLCheckBox\" value=\"Database is a MS SQL Server\" />\r\n  <string key=\"DeleteSqlConnection.LabelFieldGroup\" value=\"Delete This SQL Connection?\" />\r\n  <string key=\"DeleteSqlConnection.Text\" value=\"Delete this SQL connection?\" />\r\n  <string key=\"DeleteSqlFunction.LabelFieldGroup\" value=\"Delete This SQL Function?\" />\r\n  <string key=\"DeleteSqlFunction.Text\" value=\"Delete this SQL function?\" />\r\n  <string key=\"CascadeDeleteErrorTitle\" value=\"Cascade Delete Error\" />\r\n  <string key=\"CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.StandardFunctions.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n\t<string key=\"Composite.AspNet.LoadUserControl.description\" value=\"Loads an ASP.NET User Control\" />\r\n\t<string key=\"Composite.AspNet.LoadUserControl.param.Path.help\" value=\"The path to the User Controls .ascx file, like “~/Controls/MyControl.ascx”\" />\r\n\t<string key=\"Composite.AspNet.LoadUserControl.param.Path.label\" value=\"Path\" />\r\n\t<string key=\"Composite.Constant.Boolean.description\" value=\"Lets you specify constant boolean value\" />\r\n\t<string key=\"Composite.Constant.Boolean.param.Constant.help\" value=\"\" />\r\n\t<string key=\"Composite.Constant.Boolean.param.Constant.label\" value=\"Value\" />\r\n\t<string key=\"Composite.Constant.DateTime.description\" value=\"Lets you specify constant date and time value\" />\r\n\t<string key=\"Composite.Constant.DateTime.param.Constant.help\" value=\"\" />\r\n\t<string key=\"Composite.Constant.DateTime.param.Constant.label\" value=\"Value\" />\r\n\t<string key=\"Composite.Constant.Decimal.description\" value=\"Lets you specify constant decimal value\" />\r\n\t<string key=\"Composite.Constant.Decimal.param.Constant.help\" value=\"\" />\r\n\t<string key=\"Composite.Constant.Decimal.param.Constant.label\" value=\"Value\" />\r\n\t<string key=\"Composite.Constant.Guid.description\" value=\"Lets you specify constant Guid value\" />\r\n\t<string key=\"Composite.Constant.Guid.param.Constant.help\" value=\"\" />\r\n\t<string key=\"Composite.Constant.Guid.param.Constant.label\" value=\"Value\" />\r\n\t<string key=\"Composite.Constant.Integer.description\" value=\"Lets you specify constant integer value\" />\r\n\t<string key=\"Composite.Constant.Integer.param.Constant.help\" value=\"\" />\r\n\t<string key=\"Composite.Constant.Integer.param.Constant.label\" value=\"Value\" />\r\n\t<string key=\"Composite.Constant.String.description\" value=\"Lets you specify constant string value\" />\r\n\t<string key=\"Composite.Constant.String.param.Constant.help\" value=\"\" />\r\n\t<string key=\"Composite.Constant.String.param.Constant.label\" value=\"Value\" />\r\n\t<string key=\"Composite.Constant.XhtmlDocument.description\" value=\"Lets you visually specify a Xhtml document constant\" />\r\n\t<string key=\"Composite.Constant.XhtmlDocument.param.Constant.help\" value=\"\" />\r\n\t<string key=\"Composite.Constant.XhtmlDocument.param.Constant.label\" value=\"Value\" />\r\n\r\n\t<string key=\"Composite.IDataGenerated.AddDataInstance.description\" value=\"Adds a new instance of the given type.\" />\r\n\t<string key=\"Composite.IDataGenerated.UpdateDataInstance.description\" value=\"Updates instance(s) with the given values.\" />\r\n\t<string key=\"Composite.IDataGenerated.UpdateDataInstance.param.Filter.help\" value=\"\" />\r\n\t<string key=\"Composite.IDataGenerated.UpdateDataInstance.param.Filter.label\" value=\"Filter\" />\r\n\t<string key=\"Composite.IDataGenerated.DeleteDataInstance.description\" value=\"Deletes instance(s) with the given filter.\" />\r\n\t<string key=\"Composite.IDataGenerated.DeleteDataInstance.param.Filter.help\" value=\"\" />\r\n\t<string key=\"Composite.IDataGenerated.DeleteDataInstance.param.Filter.label\" value=\"Filter\" />\r\n\t<string key=\"Composite.IDataGenerated.GetDataReference.description\" value=\"Creates a DataReference based on a key value.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetDataReference.param.KeyValue.help\" value=\"The key value of the data to reference.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetDataReference.param.KeyValue.label\" value=\"Key value\" />\r\n\t<string key=\"Composite.IDataGenerated.GetNullableDataReference.description\" value=\"Creates a NullableDataReference based on a key value. The default value is 'null', no reference.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetNullableDataReference.param.KeyValue.help\" value=\"The key value of the data to reference.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetNullableDataReference.param.KeyValue.label\" value=\"Key value\" />\r\n\r\n\t<string key=\"Composite.IDataGenerated.Filter.DataReferenceFilter.description\" value=\"Converts a DataReference into a single element filter. This filter will select a maximum of one item.\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.DataReferenceFilter.param.DataReference.help\" value=\"The Data Reference to use when selecting data.\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.DataReferenceFilter.param.DataReference.label\" value=\"Data Reference\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.ActivePageReferenceFilter.description\" value=\"Lets you select data based on its reference to the currently rendered page.\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.ActivePageReferenceFilter.param.SitemapScope.help\" value=\"Select what relation the current page must have with the data you wish to retrieve.\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.ActivePageReferenceFilter.param.SitemapScope.label\" value=\"Page scope\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.CompoundFilter.description\" value=\"Defines an “and” or “or” query, combining two other filters.\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.CompoundFilter.param.IsAndQuery.label\" value=\"And / or filter\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.CompoundFilter.param.IsAndQuery.help\" value=\"If you select “And” both filters are applied to the data. Selecting “Or” will give you the data that matches just one of the filters.\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.CompoundFilter.param.Left.help\" value=\"One of the two filters (the one to evaluate first)\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.CompoundFilter.param.Left.label\" value=\"Left filter\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.CompoundFilter.param.Right.help\" value=\"One of the two filters (the one to evaluate last)\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.CompoundFilter.param.Right.label\" value=\"Right filter\" />\r\n\t<string key=\"Composite.IDataGenerated.Filter.FieldPredicatesFilter.description\" value=\"Lets you specify a filter on data by specifying requirements for the individual fields. If you set requirements on multiple fields, they are all enforced (and query).\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.description\" value=\"Retrieves an XML representation of the data. \" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.ElementName.label\" value=\"Element name\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.ElementNamespace.label\" value=\"Element namespace\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.Filter.help\" value=\"\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.Filter.label\" value=\"Filter\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.IncludePagingInfo.help\" value=\"When selected the data XML will be preceded by a &lt;PagingInfo /&gt; element detailing number of pages, items and more.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.IncludePagingInfo.label\" value=\"Include paging info\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.OrderByField.help\" value=\"The field to order data by\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.OrderByField.label\" value=\"Order by\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.OrderAscending.help\" value=\"When set to true results are delivered in ascending order, otherwise descending order is used. Default is ascending order.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.OrderAscending.label\" value=\"Order ascending\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.PageNumber.help\" value=\"If the number of data elements exceed the page size you can use paging to move to the other pages. See the Page size parameter.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.PageNumber.label\" value=\"Page number\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.PageSize.help\" value=\"The number of items to display on one page – the maximum number of elements to return. \" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.PageSize.label\" value=\"Page size\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.PropertyNames.help\" value=\"The data fields to output in the XML. Fewer fields can yield faster renderings.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.PropertyNames.label\" value=\"Selected fields\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.ShowReferencesInline.help\" value=\"If you include reference data in the 'Selected properties' setting, you can use this option to control how the referenced data is included. 'Inline' is easy to use, but may bloat the size of the XML document.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.ShowReferencesInline.label\" value=\"Show reference data inline\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.Randomized.help\" value=\"When true data can be ordered randomly. Specify the number of random results you require by setting the 'Page size'. If a filter is specified, this is applied before the random selection. If you specify an 'Order by' value, you should specify a low 'Page size' or the randomization will become void.\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.Randomized.label\" value=\"Randomized\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.CachePriority.help\" value=\"Determines if result XML has to be cached, and what priority those cache records should have\" />\r\n\t<string key=\"Composite.IDataGenerated.GetXml.param.CachePriority.label\" value=\"Cache Priority\" />\r\n\t<string key=\"Composite.Pages.GetPageId.description\" value=\"Fetches the ID of the current page or a page relative to the current page.\" />\r\n\t<string key=\"Composite.Pages.GetPageId.param.SitemapScope.help\" value=\"What page to get id from. The default is from the current page.\" />\r\n\t<string key=\"Composite.Pages.GetPageId.param.SitemapScope.label\" value=\"Page association\" />\r\n\t<string key=\"Composite.Pages.QuickSitemap.description\" value=\"Quick and raw sitemap xhtml.\" />\r\n\t<string key=\"Composite.Pages.SitemapXml.description\" value=\"Returns a hierarchical XML structure of pages. When executed as part of a page rendering XML elements representing the current and ancestor pages will be appended the attributes isopen=”true” and iscurrent=”true”\" />\r\n\t<string key=\"Composite.Pages.SitemapXml.param.SourcePage.label\" value=\"Source page\" />\r\n\t<string key=\"Composite.Pages.SitemapXml.param.SourcePage.help\" value=\"By default the source page is the page currently being rendered. Specify a value if you want to get sitemap information relative to another page. The source page controls how page elements are annotated with 'isopen' and 'iscurrent' and is the starting point when calculating the page scope.\" />\r\n\t<string key=\"Composite.Pages.SitemapXml.param.SitemapScope.label\" value=\"Page scope\" />\r\n\t<string key=\"Composite.Pages.SitemapXml.param.SitemapScope.help\" value=\"The scope of pages to extract from the sitemap. The default is 'all pages'. You can use this parameter to extract the structure you need to complete your task.\" />\r\n\t<string key=\"Composite.Pages.GetForeignPageInfo.description\" value=\"Gets information about current page in all the languages.\" />\r\n\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.description\" value=\"Defines a 'cache zone' around a function call or markup (typically containing function calls). This function can be used to enhance page rendering performance by caching sections of a web page. The 'Object Cache Id' value should be unique to the content being cached.\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.ObjectToCache.label\" value=\"Object to cache\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.ObjectToCache.help\" value=\"What you want to cache - this can be a single function call or a section of markup containing one or more function calls.\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.ObjectCacheId.label\" value=\"Unique cache id\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.ObjectCacheId.help\" value=\"Specify an ID unique to the content being cached. This value is used - in conjunction with the Page scope - to define a unique cache key.\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.SitemapScope.label\" value=\"Page scope\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.SitemapScope.help\" value=\"The page scope the cached data should be shared on. By default the page scope is 'this website', but you can change it to page specific caching and more.\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.SecondsToCache.label\" value=\"Cache duration (seconds)\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.SecondsToCache.help\" value=\"The number of seconds the cached object should be reused. Default is 1 minute (60 seconds).\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.LanguageSpecific.label\" value=\"Language specific\" />\r\n\t<string key=\"Composite.Utils.Caching.PageObjectCache.param.LanguageSpecific.help\" value=\"Choose if the cached object should be uniquely cached per website language or commonly shared among languages.\" />\r\n\r\n\t<string key=\"Composite.Utils.Compare.AreEqual.description\" value=\"AreEqual\" />\r\n\t<string key=\"Composite.Utils.Compare.AreEqual.param.ValueA.help\" value=\"Compares two objects for equality. Returns true if the two objects are equal.\" />\r\n\t<string key=\"Composite.Utils.Compare.AreEqual.param.ValueA.label\" value=\"Value A to compare.\" />\r\n\t<string key=\"Composite.Utils.Compare.AreEqual.param.ValueB.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Compare.AreEqual.param.ValueB.label\" value=\"Value B to compare.\" />\r\n\t<string key=\"Composite.Utils.Compare.IsLessThan.description\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Compare.IsLessThan.param.ValueA.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Compare.IsLessThan.param.ValueA.label\" value=\"Value A to compare.\" />\r\n\t<string key=\"Composite.Utils.Compare.IsLessThan.param.ValueB.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Compare.IsLessThan.param.ValueB.label\" value=\"Value B to compare.\" />\r\n\t<string key=\"Composite.Utils.Configuration.AppSettingsValue.description\" value=\"Reads a string from the application configuration file (web.config or app.config)\" />\r\n\t<string key=\"Composite.Utils.Configuration.AppSettingsValue.param.KeyName.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Configuration.AppSettingsValue.param.KeyName.label\" value=\"Key Name\" />\r\n\t<string key=\"Composite.Utils.Date.AddDays.description\" value=\"Add a number of days to the current date and get the resulting date.\" />\r\n\t<string key=\"Composite.Utils.Date.AddDays.param.DaysToAdd.help\" value=\"Specify a negative or positive number of days to add to the current date.\" />\r\n\t<string key=\"Composite.Utils.Date.AddDays.param.DaysToAdd.label\" value=\"Days to add\" />\r\n\t<string key=\"Composite.Utils.Date.Now.description\" value=\"The current date and time\" />\r\n\t<string key=\"Composite.Utils.GetInputParameter.description\" value=\"Returns an input parameter from executing function context. Use this in developing to copy an input value to a new function call.\" />\r\n\t<string key=\"Composite.Utils.GetInputParameter.param.InputParameterName.help\" value=\"Specify the name of the input parameter which value you wish to use here.\" />\r\n\t<string key=\"Composite.Utils.GetInputParameter.param.InputParameterName.label\" value=\"Parameter name\" />\r\n\r\n\t<string key=\"Composite.Utils.ParseStringToObject.description\" value=\"Parses a string into an object. The type of object depends on the receiver. Using this function to deliver a value to a DateTime parameter, will make the system parse the string as a DateTime etc.\" />\r\n\t<string key=\"Composite.Utils.ParseStringToObject.param.StringToParse.help\" value=\"Specify the string to parse. Note that the string must be formatted in a way that can be converted into the type of object that is expected.\" />\r\n\t<string key=\"Composite.Utils.ParseStringToObject.param.StringToParse.label\" value=\"String to parse\" />\r\n\r\n\t<string key=\"Composite.Utils.Guid.NewGuid.description\" value=\"Returns a new random Guid.\" />\r\n\t<string key=\"Composite.Utils.Globalization.AllCultures.description\" value=\"A list of all cultures\" />\r\n\t<string key=\"Composite.Utils.Globalization.CurrentCulture.description\" value=\"The culture for the current user / request.\" />\r\n\t<string key=\"Composite.Utils.Integer.Sum.description\" value=\"Returns the sum from a list of integers\" />\r\n\t<string key=\"Composite.Utils.Integer.Sum.param.Ints.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Integer.Sum.param.Ints.label\" value=\"Integer list\" />\r\n\t<string key=\"Composite.Utils.Predicates.BoolEquals.description\" value=\"Check if a boolean is true or false. \" />\r\n\t<string key=\"Composite.Utils.Predicates.BoolEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.BoolEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeEquals.description\" value=\"Check if a date equals a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeGreaterThan.description\" value=\"Check if a date is greater than a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeGreaterThan.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeGreaterThan.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeLessThan.description\" value=\"Check if a date is less than a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeLessThan.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.DateTimeLessThan.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalEquals.description\" value=\"Check is a decimal has a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalGreaterThan.description\" value=\"Check if a decimal is greater than a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalGreaterThan.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalGreaterThan.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalLessThan.description\" value=\"Check if a decimal is less than a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalLessThan.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.DecimalLessThan.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.GuidEquals.description\" value=\"Check if a Guid equals a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.GuidEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.GuidEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\r\n\t<string key=\"Composite.Utils.Predicates.GuidInCommaSeparatedList.description\" value=\"Check if a Guid exists in a comma separated string list\" />\r\n\t<string key=\"Composite.Utils.Predicates.GuidInCommaSeparatedList.param.CommaSeparatedGuids.label\" value=\"List of Guid\" />\r\n\t<string key=\"Composite.Utils.Predicates.GuidInCommaSeparatedList.param.CommaSeparatedGuids.help\" value=\"A string containing zero or more Guids separated by commas\" />\r\n\r\n\t<string key=\"Composite.Utils.Predicates.StringInCommaSeparatedList.description\" value=\"Check if a string field matches one of the terms in a comma separated string list\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringInCommaSeparatedList.param.CommaSeparatedSearchTerms.label\" value=\"Search terms\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringInCommaSeparatedList.param.CommaSeparatedSearchTerms.help\" value=\"A string containing search terms separated by commas, like 'c1,cms,linq'\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringInCommaSeparatedList.param.IgnoreCase.label\" value=\"Ignore case\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringInCommaSeparatedList.param.IgnoreCase.help\" value=\"When 'false', casing of the words must match exactly. Default is 'true', case insensitive search\" />\r\n\r\n\t<string key=\"Composite.Utils.Predicates.StringInList.description\" value=\"Check if a string field matches one of the strings in the supplied list\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringInList.param.SearchTerms.label\" value=\"Search terms\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringInList.param.SearchTerms.help\" value=\"A list of strings to match up against the searched string field.\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringInList.param.IgnoreCase.label\" value=\"Ignore case\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringInList.param.IgnoreCase.help\" value=\"When 'false', casing of the words must match exactly. Default is 'true', case insensitive search\" />\r\n\r\n\r\n\t<string key=\"Composite.Utils.Predicates.IntegerEquals.description\" value=\"Check if an integer equals a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.IntegerEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.IntegerEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.IntegerGreaterThan.description\" value=\"Check if an integer is greater than a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.IntegerGreaterThan.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.IntegerGreaterThan.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.IntegerLessThan.description\" value=\"Check if an integer is less than a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.IntegerLessThan.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.IntegerLessThan.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringContains.description\" value=\"Check if a string contains a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringContains.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringContains.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringEndsWith.description\" value=\"Check if a string ends with a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringEndsWith.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringEndsWith.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringEquals.description\" value=\"Check if a string equals a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringStartsWith.description\" value=\"Check if a string starts with a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringStartsWith.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringStartsWith.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableGuidEquals.description\" value=\"Check if a Guid equals a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableGuidEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableGuidEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableGuidNoValue.description\" value=\"Check if a nullable Guid has no value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableIntegerEquals.description\" value=\"Check if an integer equals a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableIntegerEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableIntegerEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableIntegerNoValue.description\" value=\"Check if an nullable integer has no value\" />\r\n\t<string key=\"Composite.Utils.Predicates.StringNoValue.description\" value=\"Check if a string has no value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableBoolEquals.description\" value=\"Check if a boolean is true or false. \" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableBoolEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableBoolEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableBoolNoValue.description\" value=\"Check if a nullable boolean has no value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeEquals.description\" value=\"Check if a date equals a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeGreaterThan.description\" value=\"Check if a date is greater than a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeGreaterThan.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeGreaterThan.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeLessThan.description\" value=\"Check if a date is less than a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeLessThan.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeLessThan.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDateTimeNoValue.description\" value=\"Check if a nullable date has no value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDecimalEquals.description\" value=\"Check is a decimal has a certain value\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDecimalEquals.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDecimalEquals.param.Value.label\" value=\"The value to compare with\" />\r\n\t<string key=\"Composite.Utils.Predicates.NullableDecimalNoValue.description\" value=\"Check is a nullable decimal has no value\" />\r\n\r\n\t<string key=\"Composite.Utils.String.Join.description\" value=\"Joins a list of strings to a single string\" />\r\n\t<string key=\"Composite.Utils.String.Join.param.Separator.help\" value=\"The separator to insert between strings.\" />\r\n\t<string key=\"Composite.Utils.String.Join.param.Separator.label\" value=\"Separator\" />\r\n\t<string key=\"Composite.Utils.String.Join.param.Strings.help\" value=\"The list of strings to join\" />\r\n\t<string key=\"Composite.Utils.String.Join.param.Strings.label\" value=\"Strings to join\" />\r\n\t<string key=\"Composite.Utils.String.JoinTwo.description\" value=\"Joins two strings to a simple string\" />\r\n\t<string key=\"Composite.Utils.String.JoinTwo.param.StringA.help\" value=\"The string to put first\" />\r\n\t<string key=\"Composite.Utils.String.JoinTwo.param.StringA.label\" value=\"String A\" />\r\n\t<string key=\"Composite.Utils.String.JoinTwo.param.StringB.help\" value=\"The string to put last\" />\r\n\t<string key=\"Composite.Utils.String.JoinTwo.param.StringB.label\" value=\"String B\" />\r\n\t<string key=\"Composite.Utils.String.JoinTwo.param.Separator.help\" value=\"A string to insert in between String A and String B. Default is no separator\" />\r\n\t<string key=\"Composite.Utils.String.JoinTwo.param.Separator.label\" value=\"Separator\" />\r\n\t<string key=\"Composite.Utils.String.Split.description\" value=\"Splits a string into a list of string.\" />\r\n\t<string key=\"Composite.Utils.String.Split.param.Separator.help\" value=\"The separator to use when splitting the string. Default is comma (&quot;,&quot;)\" />\r\n\t<string key=\"Composite.Utils.String.Split.param.Separator.label\" value=\"Separator\" />\r\n\t<string key=\"Composite.Utils.String.Split.param.String.help\" value=\"The string you wish to split into a list.\" />\r\n\t<string key=\"Composite.Utils.String.Split.param.String.label\" value=\"String to split\" />\r\n\t<string key=\"Composite.Utils.Validation.DateTimeNotNullValidation.description\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Validation.DecimalNotNullValidation.description\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Validation.DecimalPrecisionValidation.description\" value=\"Validates the precision of digits (the number of decimals the user has specified)\" />\r\n\t<string key=\"Composite.Utils.Validation.DecimalPrecisionValidation.param.MaxDigits.help\" value=\"The maximum number of digits to allow on the decimal\" />\r\n\t<string key=\"Composite.Utils.Validation.DecimalPrecisionValidation.param.MaxDigits.label\" value=\"Max number of decimal digits\" />\r\n\t<string key=\"Composite.Utils.Validation.GuidNotNullValidation.description\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Validation.Int32NotNullValidation.description\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Validation.IntegerRangeValidation.description\" value=\"Validates than an integer is within a certain range.\" />\r\n\t<string key=\"Composite.Utils.Validation.IntegerRangeValidation.param.max.help\" value=\"The maximum number allowed in this field.\" />\r\n\t<string key=\"Composite.Utils.Validation.IntegerRangeValidation.param.max.label\" value=\"Maximum number\" />\r\n\t<string key=\"Composite.Utils.Validation.IntegerRangeValidation.param.min.help\" value=\"The minimum number allowed in this field.\" />\r\n\t<string key=\"Composite.Utils.Validation.IntegerRangeValidation.param.min.label\" value=\"Minimum number\" />\r\n\t<string key=\"Composite.Utils.Validation.RegularExpressionValidation.description\" value=\"Validates that a string conforms to the specified regular expression\" />\r\n\t<string key=\"Composite.Utils.Validation.RegularExpressionValidation.param.pattern.help\" value=\"The regular expression pattern to use\" />\r\n\t<string key=\"Composite.Utils.Validation.RegularExpressionValidation.param.pattern.label\" value=\"RegEx pattern\" />\r\n\t<string key=\"Composite.Utils.Validation.StringLengthValidation.description\" value=\"Validates that the length of a string is within the specified range\" />\r\n\t<string key=\"Composite.Utils.Validation.StringLengthValidation.param.max.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Validation.StringLengthValidation.param.max.label\" value=\"Maximum length\" />\r\n\t<string key=\"Composite.Utils.Validation.StringLengthValidation.param.min.help\" value=\"\" />\r\n\t<string key=\"Composite.Utils.Validation.StringLengthValidation.param.min.label\" value=\"Minimum length\" />\r\n\t<string key=\"Composite.Utils.Validation.StringNotNullValidation.description\" value=\"\" />\r\n\t<string key=\"Composite.Web.Client.BrowserPlatform.description\" value=\"\" />\r\n\t<string key=\"Composite.Web.Client.BrowserString.description\" value=\"\" />\r\n\t<string key=\"Composite.Web.Client.BrowserType.description\" value=\"\" />\r\n\t<string key=\"Composite.Web.Client.BrowserVersion.description\" value=\"\" />\r\n\t<string key=\"Composite.Web.Client.EcmaScriptVersion.description\" value=\"\" />\r\n\t<string key=\"Composite.Web.Client.IsCrawler.description\" value=\"True if the current request is identified as coming from a crawler (search engine).\" />\r\n\t<string key=\"Composite.Web.Client.IsMobileDevice.description\" value=\"True if the current request is identified as coming from a mobile device.\" />\r\n\t<string key=\"Composite.Web.Html.Template.CommonMetaTags.description\" value=\"Common HTML meta tags you probably want in your html head\" />\r\n\t<string key=\"Composite.Web.Html.Template.CommonMetaTags.param.ContentType.label\" value=\"Content-Type\" />\r\n\t<string key=\"Composite.Web.Html.Template.CommonMetaTags.param.ContentType.help\" value=\"By default this is 'text/html; charset=utf-8'. If you serve something else you should overwrite this.\" />\r\n\t<string key=\"Composite.Web.Html.Template.CommonMetaTags.param.Designer.label\" value=\"Designer\" />\r\n\t<string key=\"Composite.Web.Html.Template.CommonMetaTags.param.Designer.help\" value=\"Who designed this website? Show it in the 'Designer' meta tag. Default is not to emit the meta tag.\" />\r\n\t<string key=\"Composite.Web.Html.Template.CommonMetaTags.param.ShowGenerator.label\" value=\"Show generator\" />\r\n\t<string key=\"Composite.Web.Html.Template.CommonMetaTags.param.ShowGenerator.help\" value=\"Show the world you support C1 CMS Foundation - free open source!\" />\r\n\t<string key=\"Composite.Web.Html.Template.LangAttribute.description\" value=\"Appends a lang='(language code)' attribute the the parent element, reflecting the language of the current page. You can put this just below the &lt;html /&gt; tag.\" />\r\n  <string key=\"Composite.Web.Html.Template.PageTemplateFeature.description\" value=\"Includes a named Page Template Feature at this location. Page Template Features can contain HTML and functional snippets and are managed on the Layout perspective.\" />\r\n  <string key=\"Composite.Web.Html.Template.PageTemplateFeature.param.FeatureName.label\" value=\"Feature name\" />\r\n  <string key=\"Composite.Web.Html.Template.PageTemplateFeature.param.FeatureName.help\" value=\"The name of the Page Template Feature you wish to include.\" />\r\n\t<string key=\"Composite.Web.Html.Template.HtmlTitleValue.description\" value=\"Emits the 'definitive title' of the current page; the same value that ends up in the page title tag. This title may originate from the page being rendered or from a C1 Function/ASP.NET control which changed the title to match specific data being featured on the page.\" />\r\n\t<string key=\"Composite.Web.Html.Template.HtmlTitleValue.param.PrefixToRemove.label\" value=\"Prefix to be removed\" />\r\n\t<string key=\"Composite.Web.Html.Template.HtmlTitleValue.param.PrefixToRemove.help\" value=\"If the HTML title has a prefix value you wish to get rid of, specify the prefix here. If the prefix is not found in the title, this value is ignored.\" />\r\n\t<string key=\"Composite.Web.Html.Template.HtmlTitleValue.param.PostfixToRemove.label\" value=\"Postfix to be removed\" />\r\n\t<string key=\"Composite.Web.Html.Template.HtmlTitleValue.param.PostfixToRemove.help\" value=\"If the HTML title has a postfix value you wish to get rid of, specify the postfix here. If the postfix is not found in the title, this value is ignored.\" />\r\n\t<string key=\"Composite.Web.Html.Template.MetaDescriptionValue.description\" value=\"Emits the 'definitive description' of the current page; the same value that ends up in the page meta description tag. This value may originate from the page being rendered or from a C1 Function/ASP.NET control which changed the description to match specific data being featured on the page.\" />\r\n\t<string key=\"Composite.Web.Html.Template.MetaDescriptionValue.param.Element.label\" value=\"Element to wrap description\" />\r\n\t<string key=\"Composite.Web.Html.Template.MetaDescriptionValue.param.Element.help\" value=\"To have the description wrapped in an element (like &lt;p class=&quot;description&quot; /&gt;) specify it here. The element with only be emitted when a description text exist.\" />\r\n\r\n\r\n  <string key=\"Composite.Web.Request.CookieValue.description\" value=\"Gets a value from the current users cookie collection.\" />\r\n\t<string key=\"Composite.Web.Request.CookieValue.param.CookieName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.CookieValue.param.CookieName.label\" value=\"Cookie name\" />\r\n\t<string key=\"Composite.Web.Request.CookieValue.param.FallbackValue.help\" value=\"If the user does not have this cookie, use this field to specify what value to default to.\" />\r\n\t<string key=\"Composite.Web.Request.CookieValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.FormPostBoolValue.description\" value=\"Gets a boolean value from a form post (HTTP POST)\" />\r\n\t<string key=\"Composite.Web.Request.FormPostBoolValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostBoolValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.FormPostBoolValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostBoolValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.FormPostDecimalValue.description\" value=\"Gets a decimal value from a form post (HTTP POST)\" />\r\n\t<string key=\"Composite.Web.Request.FormPostDecimalValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostDecimalValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.FormPostDecimalValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostDecimalValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.FormPostGuidValue.description\" value=\"Gets a Guid value from a form post (HTTP POST)\" />\r\n\t<string key=\"Composite.Web.Request.FormPostGuidValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostGuidValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.FormPostGuidValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostGuidValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.FormPostIntegerValue.description\" value=\"Gets an integer value from a form post (HTTP POST)\" />\r\n\t<string key=\"Composite.Web.Request.FormPostIntegerValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostIntegerValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.FormPostIntegerValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostIntegerValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.FormPostValue.description\" value=\"Gets a string value from a form post (HTTP POST)\" />\r\n\t<string key=\"Composite.Web.Request.FormPostValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.FormPostValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.description\" value=\"Gets a date and time value from a form post (HTTP POST). The incoming date string is expected to be XML formatted (like “2003-09-26T13:30:00”)\" />\r\n\t<string key=\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.param.FallbackValue.help\" value=\"The value to use if the post did not contain the specified parameter name.\" />\r\n\t<string key=\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.FormPostXmlFormattedDateTimeValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringBoolValue.description\" value=\"Gets a boolean value from a Url parameter (HTTP GET)\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringBoolValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringBoolValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringBoolValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringBoolValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringDecimalValue.description\" value=\"Gets a decimal value from a Url parameter (HTTP GET)\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringDecimalValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringDecimalValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringDecimalValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringDecimalValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringGuidValue.description\" value=\"Gets a Guid value from a Url parameter (HTTP GET)\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringGuidValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringGuidValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringGuidValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringGuidValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringIntegerValue.description\" value=\"Gets an integer value from a Url parameter (HTTP GET)\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringIntegerValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringIntegerValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringIntegerValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringIntegerValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringValue.description\" value=\"Gets a string value from a Url parameter (HTTP GET)\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringValue.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.description\" value=\"Gets a date and time value from a Url parameter (HTTP GET). The incoming date string is expected to be XML formatted (like “2003-09-26T13:30:00”)\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.param.FallbackValue.help\" value=\"The value to use if the Url did not contain the specified parameter name.\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.param.ParameterName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.QueryStringXmlFormattedDateTimeValue.param.ParameterName.label\" value=\"Parameter name\" />\r\n\t<string key=\"Composite.Web.Request.PathInfo.description\" value=\"Returns additional information passed in a URL along with the page link.\" />\r\n\t<string key=\"Composite.Web.Request.PathInfo.param.Segment.help\" value=\"The segment of the path info to retrieve, using the format '/(0)/(1)/(2)/...'. Specify -1 to get the entire string.\" />\r\n\t<string key=\"Composite.Web.Request.PathInfo.param.Segment.label\" value=\"Segment\" />\r\n\t<string key=\"Composite.Web.Request.PathInfo.param.AutoApprove.help\" value=\"When true, any path info string will be accepted. Default is true.\" />\r\n\t<string key=\"Composite.Web.Request.PathInfo.param.AutoApprove.label\" value=\"AutoApprove\" />\r\n\t<string key=\"Composite.Web.Request.PathInfo.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.PathInfo.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoInt.description\" value=\"Extracts an integer value from a PathInfo segment.\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoInt.param.Segment.help\" value=\"The segment of the path info to retrieve, using the format '/(0)/(1)/(2)/...'.\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoInt.param.Segment.label\" value=\"Segment\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoInt.param.AutoApprove.help\" value=\"When true, any path info string will be accepted. Default is true.\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoInt.param.AutoApprove.label\" value=\"AutoApprove\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoInt.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoInt.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoGuid.description\" value=\"Extracts a GUID from a PathInfo segment.\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoGuid.param.Segment.help\" value=\"The segment of the path info to retrieve, using the format '/(0)/(1)/(2)/...'. \" />\r\n\t<string key=\"Composite.Web.Request.PathInfoGuid.param.Segment.label\" value=\"Segment\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoGuid.param.AutoApprove.help\" value=\"When true, accept any path info string will be accepted. Default is true.\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoGuid.param.AutoApprove.label\" value=\"AutoApprove\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoGuid.param.FallbackValue.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.PathInfoGuid.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.RegisterPathInfoUsage.description\" value=\"Notifies the system of PathInfo being used, so that the request is not redirected to the 'Page not found' page.\" />\r\n\t<string key=\"Composite.Web.Request.SessionVariable.description\" value=\"Retrieves a variable from the current users session as a string.\" />\r\n\t<string key=\"Composite.Web.Request.SessionVariable.param.FallbackValue.help\" value=\"The value to use if the session variable was not found\" />\r\n\t<string key=\"Composite.Web.Request.SessionVariable.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Request.SessionVariable.param.VariableName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Request.SessionVariable.param.VariableName.label\" value=\"Variable name\" />\r\n\t<string key=\"Composite.Web.Response.Redirect.description\" value=\"Redirects the website visitor to another URL. URL redirects are suppressed when this function executes inside the C1 console.\" />\r\n\t<string key=\"Composite.Web.Response.Redirect.param.Url.help\" value=\"The URL the user should be redirected to, either absolute (http://contoso.com/default.aspx) or relative (/Login.aspx)).\" />\r\n\t<string key=\"Composite.Web.Response.Redirect.param.Url.label\" value=\"URL\" />\r\n\t<string key=\"Composite.Web.Response.SetCookieValue.description\" value=\"Sets a cookie value for the current user\" />\r\n\t<string key=\"Composite.Web.Response.SetCookieValue.param.CookieName.help\" value=\"The name of the cookie to set / overwrite\" />\r\n\t<string key=\"Composite.Web.Response.SetCookieValue.param.CookieName.label\" value=\"Cookie name\" />\r\n\t<string key=\"Composite.Web.Response.SetCookieValue.param.Value.help\" value=\"The value to store in the cookie\" />\r\n\t<string key=\"Composite.Web.Response.SetCookieValue.param.Value.label\" value=\"Cookie value\" />\r\n\t<string key=\"Composite.Web.Response.SetCookieValue.param.Expires.help\" value=\"When the cookie should expire (stop to exist). The default value is 'session', when the user closes the browser.\" />\r\n\t<string key=\"Composite.Web.Response.SetCookieValue.param.Expires.label\" value=\"Expiration\" />\r\n\r\n\t<string key=\"Composite.Web.Response.SetServerPageCacheDuration.description\" value=\"Sets the maximum number of seconds the current page should be publicly cached on the server. To ensure that the page response is not cached set the &quot;Maximum seconds&quot; to &quot;0&quot;. If multiple sources set the server cache duration, the smallest number is used. Note that the file &quot;~/Renderers/Page.aspx&quot; contains a default value for cache duration – you can edit this file to change the default.\" />\r\n\t<string key=\"Composite.Web.Response.SetServerPageCacheDuration.param.MaxSeconds.help\" value=\"The maximum number of seconds the page currently being rendered should be publicly cached. A high value yield good performance, a low value make changes show up faster. A value of '0' ensure that all visitors get a unique response.\" />\r\n\t<string key=\"Composite.Web.Response.SetServerPageCacheDuration.param.MaxSeconds.label\" value=\"Maximum seconds\" />\r\n\r\n\t<string key=\"Composite.Web.Response.SetSessionVariable.description\" value=\"Sets a session variable for the current user\" />\r\n\t<string key=\"Composite.Web.Response.SetSessionVariable.param.Value.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Response.SetSessionVariable.param.Value.label\" value=\"Value\" />\r\n\t<string key=\"Composite.Web.Response.SetSessionVariable.param.VariableName.help\" value=\"The name of the session variable to set.\" />\r\n\t<string key=\"Composite.Web.Response.SetSessionVariable.param.VariableName.label\" value=\"Variable name\" />\r\n\t<string key=\"Composite.Web.Server.ApplicationPath.description\" value=\"Gets the web application virtual path. Typically this is '' - the empty string, when running in the website root, but if {applicationname} is running in a sub folder this can be '/MySubfolder'. You can use this value to prefix URL's so they will work no matter is {applicationname} is running is a subfolder or not. Sample XSLT usage: &lt;img src=&quot;{/in:inputs/in:result[@name='ApplicationPath']}/images/myImage.png&quot; /&gt;\" />\r\n\t<string key=\"Composite.Web.Server.ApplicationVariable.description\" value=\"Gets an IIS application variable\" />\r\n\t<string key=\"Composite.Web.Server.ApplicationVariable.param.FallbackValue.help\" value=\"Value to use if the application variable was not located\" />\r\n\t<string key=\"Composite.Web.Server.ApplicationVariable.param.FallbackValue.label\" value=\"Fallback value\" />\r\n\t<string key=\"Composite.Web.Server.ApplicationVariable.param.VariableName.help\" value=\"\" />\r\n\t<string key=\"Composite.Web.Server.ApplicationVariable.param.VariableName.label\" value=\"Variable name\" />\r\n\t<string key=\"Composite.Web.Server.ServerVariable.description\" value=\"Gets the value of an IIS Server variable\" />\r\n\t<string key=\"Composite.Web.Server.ServerVariable.param.VariableName.help\" value=\"The IIS Server variable to get.\" />\r\n\t<string key=\"Composite.Web.Server.ServerVariable.param.VariableName.label\" value=\"Variable name\" />\r\n\t<string key=\"Composite.Xml.LoadFile.description\" value=\"Loads a local XML file given a relative path\" />\r\n\t<string key=\"Composite.Xml.LoadFile.param.RelativePath.help\" value=\"The relative path of the XML file to load\" />\r\n\t<string key=\"Composite.Xml.LoadFile.param.RelativePath.label\" value=\"Relative path\" />\r\n\t<string key=\"Composite.Xml.LoadXhtmlFile.description\" value=\"Loads a local XHTML file given a relative path\" />\r\n\t<string key=\"Composite.Xml.LoadXhtmlFile.param.RelativePath.help\" value=\"The relative path of the XHTML file to load\" />\r\n\t<string key=\"Composite.Xml.LoadXhtmlFile.param.RelativePath.label\" value=\"Relative path\" />\r\n\t<string key=\"Composite.Xml.LoadUrl.description\" value=\"Loads a remote XML file given a Url\" />\r\n\t<string key=\"Composite.Xml.LoadUrl.param.Url.help\" value=\"\" />\r\n\t<string key=\"Composite.Xml.LoadUrl.param.Url.label\" value=\"Url\" />\r\n\t<string key=\"Composite.Xml.LoadUrl.param.CacheTime.help\" value=\"Time period in seconds for which the result should is cached. Default is 0 (no caching).\" />\r\n\t<string key=\"Composite.Xml.LoadUrl.param.CacheTime.label\" value=\"Seconds to cache\" />\r\n\t<string key=\"Composite.Xslt.Extensions.DateFormatting.description\" value=\"Provides localized date formatting functions for XSLT use. \" />\r\n\t<string key=\"Composite.Xslt.Extensions.Globalization.description\" value=\"Provides globalization functions for XSLT use.\" />\r\n\t<string key=\"Composite.Xslt.Extensions.MarkupParser.description\" value=\"Provides functions that parse encoded XML documents or XHTML fragments into nodes. Use this extension when you have XML or XHTML as a string and need to copy it to the output or do transformations on it.\" />\r\n\r\n\t<string key=\"Composite.Mail.SendMail.description\" value=\"Sends an e-mail. Remember to configure SMTP server connection in the web.config file.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.From.label\" value=\"From\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.From.help\" value=\"Sender's address.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.To.label\" value=\"To\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.To.help\" value=\"Recipient. A list of comma separated email addresses.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.Subject.label\" value=\"Subject\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.Subject.help\" value=\"Email subject.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.Body.label\" value=\"Body\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.Body.help\" value=\"Email body.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.IsHtml.label\" value=\"IsHtml\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.IsHtml.help\" value=\"Defines whether email to be sent is an HTML email or a text email.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.CC.label\" value=\"CC\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.CC.help\" value=\"Carbon Copy. A list of comma separated email addresses that are secondary recipients of a message.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.ReplyTo.label\" value=\"ReplyTo\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.ReplyTo.help\" value=\"Address that should be used to reply to the message.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.BCC.label\" value=\"BCC\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.BCC.help\" value=\"Blind Carbon Copy. A list of recipients which will receive a mail but their individual email addresses will be concealed from the complete list of recipients.\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.Attachment.label\" value=\"Attachment\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.Attachment.help\" value=\"List of attached files.\r\n\\n\t\t\t\t\tFormat it the following [{name}=]{filepath}[,{mime-type] [ | .... ]. \r\n\\n\t\t\t\t\tFile path can be either relative or absolute path f.e. &quot;C:\\someimage.jpg&quot; or &quot;/coolpicture.jpg&quot; \r\n\\n\t\t\t\t\tIf file path starts with &quot;Composite/&quot;, it will be recognized as a path to Composite media, f.e. 'Composite/MediaArchive:someImage.gif'\r\n\\n\t\t\t\t\t\r\n\\n\t\t\t\t\tExamples: \r\n\\n\t\t\t\t\t   /attachment.jpg\r\n\\n\t\t\t\t\t\t image.jpg=/attachment.jpg\r\n\\n\t\t\t\t\t\t image.jpg=/attachment.jpg,image/jpg\r\n\\n\t\t\t\t\t\t image1.jpg=/attachment1.jpg,image/jpg|image2.jpg=/attachment2.jpg,image/jpg\" />\r\n\r\n\t<string key=\"Composite.Mail.SendMail.param.AttachmentFromMedia.label\" value=\"AttachmentFromMedia\" />\r\n\t<string key=\"Composite.Mail.SendMail.param.AttachmentFromMedia.help\" value=\"A file from media library to be attached.\" />\r\n\r\n\t<string key=\"Composite.Data.Types.IImageFile.MediaFolderFilter.description\" value=\"Filters images by it's folder path\" />\r\n\t<string key=\"Composite.Data.Types.IImageFile.MediaFolderFilter.param.MediaFolder.label\" value=\"Media Folder\" />\r\n\t<string key=\"Composite.Data.Types.IImageFile.MediaFolderFilter.param.MediaFolder.help\" value=\"A reference to a media folder\" />\r\n\t<string key=\"Composite.Data.Types.IImageFile.MediaFolderFilter.param.IncludeSubfolders.label\" value=\"Include Subfolders\" />\r\n\t<string key=\"Composite.Data.Types.IImageFile.MediaFolderFilter.param.IncludeSubfolders.help\" value=\"Determines whether images from subfolders should be included.\" />\r\n\r\n\t<string key=\"Composite.Data.Types.IMediaFile.MediaFolderFilter.description\" value=\"Filters images by it's folder path\" />\r\n\t<string key=\"Composite.Data.Types.IMediaFile.MediaFolderFilter.param.MediaFolder.label\" value=\"Media Folder\" />\r\n\t<string key=\"Composite.Data.Types.IMediaFile.MediaFolderFilter.param.MediaFolder.help\" value=\"A reference to a media folder\" />\r\n\t<string key=\"Composite.Data.Types.IMediaFile.MediaFolderFilter.param.IncludeSubfolders.label\" value=\"Include Subfolders\" />\r\n\t<string key=\"Composite.Data.Types.IMediaFile.MediaFolderFilter.param.IncludeSubfolders.help\" value=\"Determines whether media files from subfolders should be included.\" />\r\n\r\n  <string key=\"Composite.Utils.Dictionary.XElementsToDictionary.description\" value=\"Converts an enumerable of XElements to a Dictionary using named attributes for keys and values.\" />\r\n  <string key=\"Composite.Utils.Dictionary.XElementsToDictionary.param.XElements.label\" value=\"XElements\" />\r\n  <string key=\"Composite.Utils.Dictionary.XElementsToDictionary.param.XElements.help\" value=\"An enumerable of XElements that will be used to create a dictionary from.\" />\r\n  <string key=\"Composite.Utils.Dictionary.XElementsToDictionary.param.KeyAttributeName.label\" value=\"Key Attribute Name\" />\r\n  <string key=\"Composite.Utils.Dictionary.XElementsToDictionary.param.KeyAttributeName.help\" value=\"The name of the attribute on each XElement which value will be used for keys in the dictionary.\" />\r\n  <string key=\"Composite.Utils.Dictionary.XElementsToDictionary.param.ValueAttributeName.label\" value=\"Value Attribute Name\" />\r\n  <string key=\"Composite.Utils.Dictionary.XElementsToDictionary.param.ValueAttributeName.help\" value=\"The name of the attribute on each XElement which value will be used for values in the dictionary.\" />\r\n\r\n  <string key=\"Composite.Utils.Dictionary.EnumerableToDictionary.description\" value=\"Converts an enumerable of objects to a Dictionary using named property names for keys and values.\" />\r\n  <string key=\"Composite.Utils.Dictionary.EnumerableToDictionary.param.Elements.label\" value=\"Objects\" />\r\n  <string key=\"Composite.Utils.Dictionary.EnumerableToDictionary.param.Elements.help\" value=\"An enumerable of objects that will be used to create a dictionary from.\" />\r\n  <string key=\"Composite.Utils.Dictionary.EnumerableToDictionary.param.KeyPropertyName.label\" value=\"Key Property Name\" />\r\n  <string key=\"Composite.Utils.Dictionary.EnumerableToDictionary.param.KeyPropertyName.help\" value=\"The name of the property on each object which value will be used for keys in the dictionary.\" />\r\n  <string key=\"Composite.Utils.Dictionary.EnumerableToDictionary.param.ValuePropertyName.label\" value=\"Value Property Name\" />\r\n  <string key=\"Composite.Utils.Dictionary.EnumerableToDictionary.param.ValuePropertyName.help\" value=\"The name of the property on each object which value will be used for values in the dictionary.\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.TimezoneAbbreviations.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n  <string key = \"TimezoneAbbreviations.Dateline Standard Time\" value = \"Etc/GMT+12\" />\r\n  <string key = \"TimezoneAbbreviations.UTC-11\" value = \"Etc/GMT+11\" />\r\n  <string key = \"TimezoneAbbreviations.Aleutian Standard Time\" value = \"UTC-10\" />\r\n  <string key = \"TimezoneAbbreviations.Hawaiian Standard Time\" value = \"HST\" />\r\n  <string key = \"TimezoneAbbreviations.Marquesas Standard Time\" value = \"MART\" />\r\n  <string key = \"TimezoneAbbreviations.Alaskan Standard Time\" value = \"AKST\" />\r\n  <string key = \"TimezoneAbbreviations.UTC-09\" value = \"UTC-09\" />\r\n  <string key = \"TimezoneAbbreviations.Pacific Standard Time (Mexico)\" value = \"PST\" />\r\n  <string key = \"TimezoneAbbreviations.UTC-08\" value = \"UTC-08\" />\r\n  <string key = \"TimezoneAbbreviations.Pacific Standard Time\" value = \"PST\" />\r\n  <string key = \"TimezoneAbbreviations.US Mountain Standard Time\" value = \"MST\" />\r\n  <string key = \"TimezoneAbbreviations.Mountain Standard Time (Mexico)\" value = \"MST\" />\r\n  <string key = \"TimezoneAbbreviations.Mountain Standard Time\" value = \"MST\" />\r\n  <string key = \"TimezoneAbbreviations.Central America Standard Time\" value = \"CST\" />\r\n  <string key = \"TimezoneAbbreviations.Central Standard Time\" value = \"CST\" />\r\n  <string key = \"TimezoneAbbreviations.Easter Island Standard Time\" value = \"EASST\" />\r\n  <string key = \"TimezoneAbbreviations.Central Standard Time (Mexico)\" value = \"CST\" />\r\n  <string key = \"TimezoneAbbreviations.Canada Central Standard Time\" value = \"CST\" />\r\n  <string key = \"TimezoneAbbreviations.SA Pacific Standard Time\" value = \"SAPST\" />\r\n  <string key = \"TimezoneAbbreviations.Eastern Standard Time (Mexico)\" value = \"EST\" />\r\n  <string key = \"TimezoneAbbreviations.Eastern Standard Time\" value = \"EST\" />\r\n  <string key = \"TimezoneAbbreviations.Haiti Standard Time\" value = \"EST\" />\r\n  <string key = \"TimezoneAbbreviations.Cuba Standard Time\" value = \"UTC-05\" />\r\n  <string key = \"TimezoneAbbreviations.US Eastern Standard Time\" value = \"EST\" />\r\n  <string key = \"TimezoneAbbreviations.Venezuela Standard Time\" value = \"VET\" />\r\n  <string key = \"TimezoneAbbreviations.Paraguay Standard Time\" value = \"PYST\" />\r\n  <string key = \"TimezoneAbbreviations.Atlantic Standard Time\" value = \"AST\" />\r\n  <string key = \"TimezoneAbbreviations.Central Brazilian Standard Time\" value = \"AMST\" />\r\n  <string key = \"TimezoneAbbreviations.SA Western Standard Time\" value = \"SAWST\" />\r\n  <string key = \"TimezoneAbbreviations.Pacific SA Standard Time\" value = \"CLST\" />\r\n  <string key = \"TimezoneAbbreviations.Turks And Caicos Standard Time\" value = \"UTC-04\" />\r\n  <string key = \"TimezoneAbbreviations.Newfoundland Standard Time\" value = \"NST\" />\r\n  <string key = \"TimezoneAbbreviations.Tocantins Standard Time\" value = \"UTC-03\" />\r\n  <string key = \"TimezoneAbbreviations.E. South America Standard Time\" value = \"BRST\" />\r\n  <string key = \"TimezoneAbbreviations.SA Eastern Standard Time\" value = \"GFT\" />\r\n  <string key = \"TimezoneAbbreviations.Argentina Standard Time\" value = \"ART\" />\r\n  <string key = \"TimezoneAbbreviations.Greenland Standard Time\" value = \"WGT\" />\r\n  <string key = \"TimezoneAbbreviations.Montevideo Standard Time\" value = \"UYT\" />\r\n  <string key = \"TimezoneAbbreviations.Saint Pierre Standard Time\" value = \"UTC-03\" />\r\n  <string key = \"TimezoneAbbreviations.Bahia Standard Time\" value = \"BRT\" />\r\n  <string key = \"TimezoneAbbreviations.UTC-02\" value = \"Etc/GMT+2\" />\r\n  <string key = \"TimezoneAbbreviations.Mid-Atlantic Standard Time\" value = \"AST\" />\r\n  <string key = \"TimezoneAbbreviations.Azores Standard Time\" value = \"AZOT\" />\r\n  <string key = \"TimezoneAbbreviations.Cape Verde Standard Time\" value = \"CVT\" />\r\n  <string key = \"TimezoneAbbreviations.Morocco Standard Time\" value = \"WET\" />\r\n  <string key = \"TimezoneAbbreviations.UTC\" value = \"Etc/GMT\" />\r\n  <string key = \"TimezoneAbbreviations.GMT Standard Time\" value = \"GMT\" />\r\n  <string key = \"TimezoneAbbreviations.Greenwich Standard Time\" value = \"GMT\" />\r\n  <string key = \"TimezoneAbbreviations.W. Europe Standard Time\" value = \"CET\" />\r\n  <string key = \"TimezoneAbbreviations.Central Europe Standard Time\" value = \"CET\" />\r\n  <string key = \"TimezoneAbbreviations.Romance Standard Time\" value = \"CET\" />\r\n  <string key = \"TimezoneAbbreviations.Central European Standard Time\" value = \"CET\" />\r\n  <string key = \"TimezoneAbbreviations.W. Central Africa Standard Time\" value = \"WAT\" />\r\n  <string key = \"TimezoneAbbreviations.Namibia Standard Time\" value = \"WAST\" />\r\n  <string key = \"TimezoneAbbreviations.Jordan Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.GTB Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.Middle East Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.Egypt Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.Syria Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.E. Europe Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.West Bank Standard Time\" value = \"UTC+02\" />\r\n  <string key = \"TimezoneAbbreviations.South Africa Standard Time\" value = \"SAST\" />\r\n  <string key = \"TimezoneAbbreviations.FLE Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.Turkey Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.Israel Standard Time\" value = \"IST\" />\r\n  <string key = \"TimezoneAbbreviations.Kaliningrad Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.Libya Standard Time\" value = \"EET\" />\r\n  <string key = \"TimezoneAbbreviations.Arabic Standard Time\" value = \"AST\" />\r\n  <string key = \"TimezoneAbbreviations.Arab Standard Time\" value = \"AST\" />\r\n  <string key = \"TimezoneAbbreviations.Belarus Standard Time\" value = \"MSK\" />\r\n  <string key = \"TimezoneAbbreviations.Russian Standard Time\" value = \"MSK\" />\r\n  <string key = \"TimezoneAbbreviations.E. Africa Standard Time\" value = \"EAT\" />\r\n  <string key = \"TimezoneAbbreviations.Astrakhan Standard Time\" value = \"MSK\" />\r\n  <string key = \"TimezoneAbbreviations.Iran Standard Time\" value = \"IRST\" />\r\n  <string key = \"TimezoneAbbreviations.Arabian Standard Time\" value = \"GST\" />\r\n  <string key = \"TimezoneAbbreviations.Azerbaijan Standard Time\" value = \"AZT\" />\r\n  <string key = \"TimezoneAbbreviations.Russia Time Zone 3\" value = \"SAMT\" />\r\n  <string key = \"TimezoneAbbreviations.Mauritius Standard Time\" value = \"MUT\" />\r\n  <string key = \"TimezoneAbbreviations.Georgian Standard Time\" value = \"GET\" />\r\n  <string key = \"TimezoneAbbreviations.Caucasus Standard Time\" value = \"AMT\" />\r\n  <string key = \"TimezoneAbbreviations.Afghanistan Standard Time\" value = \"AFT\" />\r\n  <string key = \"TimezoneAbbreviations.West Asia Standard Time\" value = \"UZT\" />\r\n  <string key = \"TimezoneAbbreviations.Ekaterinburg Standard Time\" value = \"YEKT\" />\r\n  <string key = \"TimezoneAbbreviations.Pakistan Standard Time\" value = \"PKT\" />\r\n  <string key = \"TimezoneAbbreviations.India Standard Time\" value = \"IST\" />\r\n  <string key = \"TimezoneAbbreviations.Sri Lanka Standard Time\" value = \"IST\" />\r\n  <string key = \"TimezoneAbbreviations.Nepal Standard Time\" value = \"NPT\" />\r\n  <string key = \"TimezoneAbbreviations.Central Asia Standard Time\" value = \"ALMT\" />\r\n  <string key = \"TimezoneAbbreviations.Bangladesh Standard Time\" value = \"BDT\" />\r\n  <string key = \"TimezoneAbbreviations.N. Central Asia Standard Time\" value = \"NOVT\" />\r\n  <string key = \"TimezoneAbbreviations.Altai Standard Time\" value = \"MSK+3\" />\r\n  <string key = \"TimezoneAbbreviations.Myanmar Standard Time\" value = \"MMT\" />\r\n  <string key = \"TimezoneAbbreviations.SE Asia Standard Time\" value = \"ICT\" />\r\n  <string key = \"TimezoneAbbreviations.W. Mongolia Standard Time\" value = \"UTC+07\" />\r\n  <string key = \"TimezoneAbbreviations.North Asia Standard Time\" value = \"KRAT\" />\r\n  <string key = \"TimezoneAbbreviations.Tomsk Standard Time\" value = \"UTC+07\" />\r\n  <string key = \"TimezoneAbbreviations.China Standard Time\" value = \"CST\" />\r\n  <string key = \"TimezoneAbbreviations.North Asia East Standard Time\" value = \"IRKT\" />\r\n  <string key = \"TimezoneAbbreviations.Singapore Standard Time\" value = \"SGT\" />\r\n  <string key = \"TimezoneAbbreviations.W. Australia Standard Time\" value = \"AWST\" />\r\n  <string key = \"TimezoneAbbreviations.Taipei Standard Time\" value = \"CST\" />\r\n  <string key = \"TimezoneAbbreviations.Ulaanbaatar Standard Time\" value = \"ULAT\" />\r\n  <string key = \"TimezoneAbbreviations.North Korea Standard Time\" value = \"KST\" />\r\n  <string key = \"TimezoneAbbreviations.Transbaikal Standard Time\" value = \"UTC+09\" />\r\n  <string key = \"TimezoneAbbreviations.Tokyo Standard Time\" value = \"JST\" />\r\n  <string key = \"TimezoneAbbreviations.Korea Standard Time\" value = \"KST\" />\r\n  <string key = \"TimezoneAbbreviations.Yakutsk Standard Time\" value = \"YAKT\" />\r\n  <string key = \"TimezoneAbbreviations.Cen. Australia Standard Time\" value = \"ACDT\" />\r\n  <string key = \"TimezoneAbbreviations.AUS Central Standard Time\" value = \"ACST\" />\r\n  <string key = \"TimezoneAbbreviations.E. Australia Standard Time\" value = \"AEST\" />\r\n  <string key = \"TimezoneAbbreviations.AUS Eastern Standard Time\" value = \"AEDT\" />\r\n  <string key = \"TimezoneAbbreviations.West Pacific Standard Time\" value = \"PGT\" />\r\n  <string key = \"TimezoneAbbreviations.Tasmania Standard Time\" value = \"AEDT\" />\r\n  <string key = \"TimezoneAbbreviations.Magadan Standard Time\" value = \"MAGT\" />\r\n  <string key = \"TimezoneAbbreviations.Vladivostok Standard Time\" value = \"VLAT\" />\r\n  <string key = \"TimezoneAbbreviations.Russia Time Zone 10\" value = \"SRET\" />\r\n  <string key = \"TimezoneAbbreviations.Norfolk Standard Time\" value = \"UTC+11\" />\r\n  <string key = \"TimezoneAbbreviations.Sakhalin Standard Time\" value = \"UTC+11\" />\r\n  <string key = \"TimezoneAbbreviations.Central Pacific Standard Time\" value = \"SBT\" />\r\n  <string key = \"TimezoneAbbreviations.Russia Time Zone 11\" value = \"PETT\" />\r\n  <string key = \"TimezoneAbbreviations.New Zealand Standard Time\" value = \"NZDT\" />\r\n  <string key = \"TimezoneAbbreviations.UTC+12\" value = \"Etc/GMT-12\" />\r\n  <string key = \"TimezoneAbbreviations.Fiji Standard Time\" value = \"FJST\" />\r\n  <string key = \"TimezoneAbbreviations.Kamchatka Standard Time\" value = \"PETT\" />\r\n  <string key = \"TimezoneAbbreviations.Chatham Islands Standard Time\" value = \"CHAST\" />\r\n  <string key = \"TimezoneAbbreviations.Tonga Standard Time\" value = \"TOT\" />\r\n  <string key = \"TimezoneAbbreviations.Samoa Standard Time\" value = \"WSDT\" />\r\n  <string key = \"TimezoneAbbreviations.Line Islands Standard Time\" value = \"LINT\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.TimezoneDisplayNames.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n  <string key = \"TimezoneDisplayName.Dateline Standard Time\" value = \"(UTC-12:00) International Date Line West\" />\r\n  <string key = \"TimezoneDisplayName.UTC-11\" value = \"(UTC-11:00) Coordinated Universal Time-11\" />\r\n  <string key = \"TimezoneDisplayName.Aleutian Standard Time\" value = \"(UTC-10:00) Aleutian Islands\" />\r\n  <string key = \"TimezoneDisplayName.Hawaiian Standard Time\" value = \"(UTC-10:00) Hawaii\" />\r\n  <string key = \"TimezoneDisplayName.Marquesas Standard Time\" value = \"(UTC-09:30) Marquesas Islands\" />\r\n  <string key = \"TimezoneDisplayName.Alaskan Standard Time\" value = \"(UTC-09:00) Alaska\" />\r\n  <string key = \"TimezoneDisplayName.UTC-09\" value = \"(UTC-09:00) Coordinated Universal Time-09\" />\r\n  <string key = \"TimezoneDisplayName.Pacific Standard Time (Mexico)\" value = \"(UTC-08:00) Baja California\" />\r\n  <string key = \"TimezoneDisplayName.UTC-08\" value = \"(UTC-08:00) Coordinated Universal Time-08\" />\r\n  <string key = \"TimezoneDisplayName.Pacific Standard Time\" value = \"(UTC-08:00) Pacific Time (US &amp; Canada)\" />\r\n  <string key = \"TimezoneDisplayName.US Mountain Standard Time\" value = \"(UTC-07:00) Arizona\" />\r\n  <string key = \"TimezoneDisplayName.Mountain Standard Time (Mexico)\" value = \"(UTC-07:00) Chihuahua, La Paz, Mazatlan\" />\r\n  <string key = \"TimezoneDisplayName.Mountain Standard Time\" value = \"(UTC-07:00) Mountain Time (US &amp; Canada)\" />\r\n  <string key = \"TimezoneDisplayName.Yukon Standard Time\" value = \"(UTC-07:00) Yukon\" />\r\n  <string key = \"TimezoneDisplayName.Central America Standard Time\" value = \"(UTC-06:00) Central America\" />\r\n  <string key = \"TimezoneDisplayName.Central Standard Time\" value = \"(UTC-06:00) Central Time (US &amp; Canada)\" />\r\n  <string key = \"TimezoneDisplayName.Easter Island Standard Time\" value = \"(UTC-06:00) Easter Island\" />\r\n  <string key = \"TimezoneDisplayName.Central Standard Time (Mexico)\" value = \"(UTC-06:00) Guadalajara, Mexico City, Monterrey\" />\r\n  <string key = \"TimezoneDisplayName.Canada Central Standard Time\" value = \"(UTC-06:00) Saskatchewan\" />\r\n  <string key = \"TimezoneDisplayName.SA Pacific Standard Time\" value = \"(UTC-05:00) Bogota, Lima, Quito, Rio Branco\" />\r\n  <string key = \"TimezoneDisplayName.Eastern Standard Time (Mexico)\" value = \"(UTC-05:00) Chetumal\" />\r\n  <string key = \"TimezoneDisplayName.Eastern Standard Time\" value = \"(UTC-05:00) Eastern Time (US &amp; Canada)\" />\r\n  <string key = \"TimezoneDisplayName.Haiti Standard Time\" value = \"(UTC-05:00) Haiti\" />\r\n  <string key = \"TimezoneDisplayName.Cuba Standard Time\" value = \"(UTC-05:00) Havana\" />\r\n  <string key = \"TimezoneDisplayName.US Eastern Standard Time\" value = \"(UTC-05:00) Indiana (East)\" />\r\n  <string key = \"TimezoneDisplayName.Paraguay Standard Time\" value = \"(UTC-04:00) Asuncion\" />\r\n  <string key = \"TimezoneDisplayName.Atlantic Standard Time\" value = \"(UTC-04:00) Atlantic Time (Canada)\" />\r\n  <string key = \"TimezoneDisplayName.Venezuela Standard Time\" value = \"(UTC-04:00) Caracas\" />\r\n  <string key = \"TimezoneDisplayName.Central Brazilian Standard Time\" value = \"(UTC-04:00) Cuiaba\" />\r\n  <string key = \"TimezoneDisplayName.SA Western Standard Time\" value = \"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan\" />\r\n  <string key = \"TimezoneDisplayName.Pacific SA Standard Time\" value = \"(UTC-04:00) Santiago\" />\r\n  <string key = \"TimezoneDisplayName.Turks And Caicos Standard Time\" value = \"(UTC-04:00) Turks and Caicos\" />\r\n  <string key = \"TimezoneDisplayName.Newfoundland Standard Time\" value = \"(UTC-03:30) Newfoundland\" />\r\n  <string key = \"TimezoneDisplayName.Tocantins Standard Time\" value = \"(UTC-03:00) Araguaina\" />\r\n  <string key = \"TimezoneDisplayName.E. South America Standard Time\" value = \"(UTC-03:00) Brasilia\" />\r\n  <string key = \"TimezoneDisplayName.SA Eastern Standard Time\" value = \"(UTC-03:00) Cayenne, Fortaleza\" />\r\n  <string key = \"TimezoneDisplayName.Argentina Standard Time\" value = \"(UTC-03:00) City of Buenos Aires\" />\r\n  <string key = \"TimezoneDisplayName.Greenland Standard Time\" value = \"(UTC-03:00) Greenland\" />\r\n  <string key = \"TimezoneDisplayName.Montevideo Standard Time\" value = \"(UTC-03:00) Montevideo\" />\r\n  <string key = \"TimezoneDisplayName.Magallanes Standard Time\" value = \"(UTC-03:00) Punta Arenas\" />\r\n  <string key = \"TimezoneDisplayName.Saint Pierre Standard Time\" value = \"(UTC-03:00) Saint Pierre and Miquelon\" />\r\n  <string key = \"TimezoneDisplayName.Bahia Standard Time\" value = \"(UTC-03:00) Salvador\" />\r\n  <string key = \"TimezoneDisplayName.UTC-02\" value = \"(UTC-02:00) Coordinated Universal Time-02\" />\r\n  <string key = \"TimezoneDisplayName.Mid-Atlantic Standard Time\" value = \"(UTC-02:00) Mid-Atlantic - Old\" />\r\n  <string key = \"TimezoneDisplayName.Azores Standard Time\" value = \"(UTC-01:00) Azores\" />\r\n  <string key = \"TimezoneDisplayName.Cape Verde Standard Time\" value = \"(UTC-01:00) Cabo Verde Is.\" />\r\n  <string key = \"TimezoneDisplayName.UTC\" value = \"(UTC) Coordinated Universal Time\" />\r\n  <string key = \"TimezoneDisplayName.Morocco Standard Time\" value = \"(UTC+00:00) Casablanca\" />\r\n  <string key = \"TimezoneDisplayName.GMT Standard Time\" value = \"(UTC+00:00) Dublin, Edinburgh, Lisbon, London\" />\r\n  <string key = \"TimezoneDisplayName.Greenwich Standard Time\" value = \"(UTC+00:00) Monrovia, Reykjavik\" />\r\n  <string key = \"TimezoneDisplayName.Sao Tome Standard Time\" value = \"(UTC+00:00) Sao Tome\" />\r\n  <string key = \"TimezoneDisplayName.W. Europe Standard Time\" value = \"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\" />\r\n  <string key = \"TimezoneDisplayName.Central Europe Standard Time\" value = \"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague\" />\r\n  <string key = \"TimezoneDisplayName.Romance Standard Time\" value = \"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris\" />\r\n  <string key = \"TimezoneDisplayName.Central European Standard Time\" value = \"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb\" />\r\n  <string key = \"TimezoneDisplayName.W. Central Africa Standard Time\" value = \"(UTC+01:00) West Central Africa\" />\r\n  <string key = \"TimezoneDisplayName.Namibia Standard Time\" value = \"(UTC+01:00) Windhoek\" />\r\n  <string key = \"TimezoneDisplayName.Jordan Standard Time\" value = \"(UTC+02:00) Amman\" />\r\n  <string key = \"TimezoneDisplayName.GTB Standard Time\" value = \"(UTC+02:00) Athens, Bucharest\" />\r\n  <string key = \"TimezoneDisplayName.Middle East Standard Time\" value = \"(UTC+02:00) Beirut\" />\r\n  <string key = \"TimezoneDisplayName.Egypt Standard Time\" value = \"(UTC+02:00) Cairo\" />\r\n  <string key = \"TimezoneDisplayName.E. Europe Standard Time\" value = \"(UTC+02:00) Chisinau\" />\r\n  <string key = \"TimezoneDisplayName.Syria Standard Time\" value = \"(UTC+02:00) Damascus\" />\r\n  <string key = \"TimezoneDisplayName.West Bank Standard Time\" value = \"(UTC+02:00) Gaza, Hebron\" />\r\n  <string key = \"TimezoneDisplayName.South Africa Standard Time\" value = \"(UTC+02:00) Harare, Pretoria\" />\r\n  <string key = \"TimezoneDisplayName.FLE Standard Time\" value = \"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius\" />\r\n  <string key = \"TimezoneDisplayName.Turkey Standard Time\" value = \"(UTC+02:00) Istanbul\" />\r\n  <string key = \"TimezoneDisplayName.Israel Standard Time\" value = \"(UTC+02:00) Jerusalem\" />\r\n  <string key = \"TimezoneDisplayName.South Sudan Standard Time\" value = \"(UTC+02:00) Juba\" />\r\n  <string key = \"TimezoneDisplayName.Kaliningrad Standard Time\" value = \"(UTC+02:00) Kaliningrad\" />\r\n  <string key = \"TimezoneDisplayName.Sudan Standard Time\" value = \"(UTC+02:00) Khartoum\" />\r\n  <string key = \"TimezoneDisplayName.Libya Standard Time\" value = \"(UTC+02:00) Tripoli\" />\r\n  <string key = \"TimezoneDisplayName.Arabic Standard Time\" value = \"(UTC+03:00) Baghdad\" />\r\n  <string key = \"TimezoneDisplayName.Arab Standard Time\" value = \"(UTC+03:00) Kuwait, Riyadh\" />\r\n  <string key = \"TimezoneDisplayName.Belarus Standard Time\" value = \"(UTC+03:00) Minsk\" />\r\n  <string key = \"TimezoneDisplayName.Russian Standard Time\" value = \"(UTC+03:00) Moscow, St. Petersburg, Volgograd\" />\r\n  <string key = \"TimezoneDisplayName.E. Africa Standard Time\" value = \"(UTC+03:00) Nairobi\" />\r\n  <string key = \"TimezoneDisplayName.Volgograd Standard Time\" value = \"(UTC+03:00) Volgograd\" />\r\n  <string key = \"TimezoneDisplayName.Iran Standard Time\" value = \"(UTC+03:30) Tehran\" />\r\n  <string key = \"TimezoneDisplayName.Arabian Standard Time\" value = \"(UTC+04:00) Abu Dhabi, Muscat\" />\r\n  <string key = \"TimezoneDisplayName.Astrakhan Standard Time\" value = \"(UTC+04:00) Astrakhan, Ulyanovsk\" />\r\n  <string key = \"TimezoneDisplayName.Azerbaijan Standard Time\" value = \"(UTC+04:00) Baku\" />\r\n  <string key = \"TimezoneDisplayName.Russia Time Zone 3\" value = \"(UTC+04:00) Izhevsk, Samara\" />\r\n  <string key = \"TimezoneDisplayName.Mauritius Standard Time\" value = \"(UTC+04:00) Port Louis\" />\r\n  <string key = \"TimezoneDisplayName.Saratov Standard Time\" value = \"(UTC+04:00) Saratov\" />\r\n  <string key = \"TimezoneDisplayName.Georgian Standard Time\" value = \"(UTC+04:00) Tbilisi\" />\r\n  <string key = \"TimezoneDisplayName.Caucasus Standard Time\" value = \"(UTC+04:00) Yerevan\" />\r\n  <string key = \"TimezoneDisplayName.Afghanistan Standard Time\" value = \"(UTC+04:30) Kabul\" />\r\n  <string key = \"TimezoneDisplayName.West Asia Standard Time\" value = \"(UTC+05:00) Ashgabat, Tashkent\" />\r\n  <string key = \"TimezoneDisplayName.Ekaterinburg Standard Time\" value = \"(UTC+05:00) Ekaterinburg\" />\r\n  <string key = \"TimezoneDisplayName.Pakistan Standard Time\" value = \"(UTC+05:00) Islamabad, Karachi\" />\r\n  <string key = \"TimezoneDisplayName.Qyzylorda Standard Time\" value = \"(UTC+05:00) Qyzylorda\" />\r\n  <string key = \"TimezoneDisplayName.India Standard Time\" value = \"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi\" />\r\n  <string key = \"TimezoneDisplayName.Sri Lanka Standard Time\" value = \"(UTC+05:30) Sri Jayawardenepura\" />\r\n  <string key = \"TimezoneDisplayName.Nepal Standard Time\" value = \"(UTC+05:45) Kathmandu\" />\r\n  <string key = \"TimezoneDisplayName.Central Asia Standard Time\" value = \"(UTC+06:00) Astana\" />\r\n  <string key = \"TimezoneDisplayName.Bangladesh Standard Time\" value = \"(UTC+06:00) Dhaka\" />\r\n  <string key = \"TimezoneDisplayName.Omsk Standard Time\" value = \"(UTC+06:00) Omsk\" />\r\n  <string key = \"TimezoneDisplayName.N. Central Asia Standard Time\" value = \"(UTC+06:00) Novosibirsk\" />\r\n  <string key = \"TimezoneDisplayName.Myanmar Standard Time\" value = \"(UTC+06:30) Yangon (Rangoon)\" />\r\n  <string key = \"TimezoneDisplayName.SE Asia Standard Time\" value = \"(UTC+07:00) Bangkok, Hanoi, Jakarta\" />\r\n  <string key = \"TimezoneDisplayName.Altai Standard Time\" value = \"(UTC+07:00) Barnaul, Gorno-Altaysk\" />\r\n  <string key = \"TimezoneDisplayName.W. Mongolia Standard Time\" value = \"(UTC+07:00) Hovd\" />\r\n  <string key = \"TimezoneDisplayName.North Asia Standard Time\" value = \"(UTC+07:00) Krasnoyarsk\" />\r\n  <string key = \"TimezoneDisplayName.Tomsk Standard Time\" value = \"(UTC+07:00) Tomsk\" />\r\n  <string key = \"TimezoneDisplayName.China Standard Time\" value = \"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi\" />\r\n  <string key = \"TimezoneDisplayName.North Asia East Standard Time\" value = \"(UTC+08:00) Irkutsk\" />\r\n  <string key = \"TimezoneDisplayName.Singapore Standard Time\" value = \"(UTC+08:00) Kuala Lumpur, Singapore\" />\r\n  <string key = \"TimezoneDisplayName.W. Australia Standard Time\" value = \"(UTC+08:00) Perth\" />\r\n  <string key = \"TimezoneDisplayName.Taipei Standard Time\" value = \"(UTC+08:00) Taipei\" />\r\n  <string key = \"TimezoneDisplayName.Ulaanbaatar Standard Time\" value = \"(UTC+08:00) Ulaanbaatar\" />\r\n  <string key = \"TimezoneDisplayName.North Korea Standard Time\" value = \"(UTC+08:30) Pyongyang\" />\r\n  <string key = \"TimezoneDisplayName.Aus Central W. Standard Time\" value = \"(UTC+08:45) Eucla\" />\r\n  <string key = \"TimezoneDisplayName.Transbaikal Standard Time\" value = \"(UTC+09:00) Chita\" />\r\n  <string key = \"TimezoneDisplayName.Tokyo Standard Time\" value = \"(UTC+09:00) Osaka, Sapporo, Tokyo\" />\r\n  <string key = \"TimezoneDisplayName.Korea Standard Time\" value = \"(UTC+09:00) Seoul\" />\r\n  <string key = \"TimezoneDisplayName.Yakutsk Standard Time\" value = \"(UTC+09:00) Yakutsk\" />\r\n  <string key = \"TimezoneDisplayName.Cen. Australia Standard Time\" value = \"(UTC+09:30) Adelaide\" />\r\n  <string key = \"TimezoneDisplayName.AUS Central Standard Time\" value = \"(UTC+09:30) Darwin\" />\r\n  <string key = \"TimezoneDisplayName.E. Australia Standard Time\" value = \"(UTC+10:00) Brisbane\" />\r\n  <string key = \"TimezoneDisplayName.AUS Eastern Standard Time\" value = \"(UTC+10:00) Canberra, Melbourne, Sydney\" />\r\n  <string key = \"TimezoneDisplayName.West Pacific Standard Time\" value = \"(UTC+10:00) Guam, Port Moresby\" />\r\n  <string key = \"TimezoneDisplayName.Tasmania Standard Time\" value = \"(UTC+10:00) Hobart\" />\r\n  <string key = \"TimezoneDisplayName.Vladivostok Standard Time\" value = \"(UTC+10:00) Vladivostok\" />\r\n  <string key = \"TimezoneDisplayName.Lord Howe Standard Time\" value = \"(UTC+10:30) Lord Howe Island\" />\r\n  <string key = \"TimezoneDisplayName.Bougainville Standard Time\" value = \"(UTC+11:00) Bougainville Island\" />\r\n  <string key = \"TimezoneDisplayName.Russia Time Zone 10\" value = \"(UTC+11:00) Chokurdakh\" />\r\n  <string key = \"TimezoneDisplayName.Magadan Standard Time\" value = \"(UTC+11:00) Magadan\" />\r\n  <string key = \"TimezoneDisplayName.Norfolk Standard Time\" value = \"(UTC+11:00) Norfolk Island\" />\r\n  <string key = \"TimezoneDisplayName.Sakhalin Standard Time\" value = \"(UTC+11:00) Sakhalin\" />\r\n  <string key = \"TimezoneDisplayName.Central Pacific Standard Time\" value = \"(UTC+11:00) Solomon Is., New Caledonia\" />\r\n  <string key = \"TimezoneDisplayName.Russia Time Zone 11\" value = \"(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky\" />\r\n  <string key = \"TimezoneDisplayName.New Zealand Standard Time\" value = \"(UTC+12:00) Auckland, Wellington\" />\r\n  <string key = \"TimezoneDisplayName.UTC+12\" value = \"(UTC+12:00) Coordinated Universal Time+12\" />\r\n  <string key = \"TimezoneDisplayName.Fiji Standard Time\" value = \"(UTC+12:00) Fiji\" />\r\n  <string key = \"TimezoneDisplayName.Kamchatka Standard Time\" value = \"(UTC+12:00) Petropavlovsk-Kamchatsky - Old\" />\r\n  <string key = \"TimezoneDisplayName.Chatham Islands Standard Time\" value = \"(UTC+12:45) Chatham Islands\" />\r\n  <string key = \"TimezoneDisplayName.Tonga Standard Time\" value = \"(UTC+13:00) Nuku'alofa\" />\r\n  <string key = \"TimezoneDisplayName.Samoa Standard Time\" value = \"(UTC+13:00) Samoa\" />\r\n  <string key = \"TimezoneDisplayName.Line Islands Standard Time\" value = \"(UTC+14:00) Kiritimati Island\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.UserControlFunction.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"RootElement.Label\" value=\"User Control Functions\" />\r\n  <string key=\"RootElement.ToolTip\" value=\"Functions based on .ascx controls\" />\r\n\r\n  <string key=\"AddNewUserControlFunction.Label\" value=\"Add User Control Function\" />\r\n  <string key=\"AddNewUserControlFunction.ToolTip\" value=\"Add a new User Control function\" />\r\n  <string key=\"EditUserControlFunction.Label\" value=\"Edit\" />\r\n  <string key=\"EditUserControlFunction.ToolTip\" value=\"Edit the User Control Function\" />\r\n  <string key=\"DeleteUserControlFunction.Label\" value=\"Delete\" />\r\n  <string key=\"DeleteUserControlFunction.ToolTip\" value=\"Delete the User Control function\" />\r\n  \r\n  <string key=\"AddNewUserControlFunction.LabelDialog\" value=\"Add User Control Function\" />\r\n  <string key=\"AddNewUserControlFunction.LabelName\" value=\"Name\" />\r\n  <string key=\"AddNewUserControlFunction.HelpName\" value=\"\" />\r\n  <string key=\"AddNewUserControlFunction.LabelNamespace\" value=\"Namespace\" />\r\n  <string key=\"AddNewUserControlFunction.HelpNamespace\" value=\"\" />\r\n  <string key=\"AddNewUserControlFunction.LabelCopyFrom\" value=\"Copy from\" />\r\n  <string key=\"AddNewUserControlFunction.LabelCopyFromHelp\" value=\"You can copy the code from another User Control function by selecting it in this list.\" />\r\n  <string key=\"AddNewUserControlFunction.LabelCopyFromEmptyOption\" value=\"(New User Control function)\" />\r\n\r\n  <string key=\"AddNewUserControlFunctionWorkflow.DuplicateName\" value=\"A C1 function with the same name already exists.\" />\r\n  <string key=\"AddNewUserControlFunctionWorkflow.EmptyName\" value=\"Function name is empty\" />\r\n  <string key=\"AddNewUserControlFunctionWorkflow.NamespaceEmpty\" value=\"Function namespace is empty\" />\r\n  <string key=\"AddNewUserControlFunctionWorkflow.InvalidNamespace\" value=\"Namespace must be like A.B.C - not start and end with .\" />\r\n  <string key=\"AddNewUserControlFunctionWorkflow.TotalNameTooLang\" value=\"The total length of the name and the namespace is too long (used to name the ASCX file).\" />\r\n\r\n  <string key=\"EditUserControlFunctionWorkflow.Validation.DialogTitle\" value=\"Validation Error\" />\r\n  <string key=\"EditUserControlFunctionWorkflow.Validation.CompilationFailed\" value=\"Compilation failed: {0}\" />\r\n  <string key=\"EditUserControlFunctionWorkflow.Validation.IncorrectBaseClass\" value=\"The User Control function should inherit '{0}'\" />\r\n\r\n  <string key=\"DeleteUserControlFunctionWorkflow.ConfirmDeleteTitle\" value=\"Delete User Control Function?\" />\r\n  <string key=\"DeleteUserControlFunctionWorkflow.ConfirmDeleteMessage\" value=\"Delete the selected User Control?\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.UserGroupElementProvider.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<strings>\r\n\t<string key=\"UserGroupElementProvider.RootLabel\" value=\"User Groups\"/>\r\n  <string key=\"UserGroupElementProvider.RootToolTip\" value=\"User Groups\"/>\r\n  <string key=\"UserGroupElementProvider.AddNewUserGroupLabel\" value=\"Add User Group\"/>  \r\n  <string key=\"UserGroupElementProvider.AddNewUserGroupToolTip\" value=\"Add new User Group\"/>\r\n  <string key=\"UserGroupElementProvider.EditUserGroupLabel\" value=\"Edit User Group\"/>\r\n  <string key=\"UserGroupElementProvider.EditUserGroupToolTip\" value=\"Edit User Group\"/>\r\n  <string key=\"UserGroupElementProvider.DeleteUserGroupLabel\" value=\"Delete User Group\"/>\r\n  <string key=\"UserGroupElementProvider.DeleteUserGroupToolTip\" value=\"Delete User Group\"/>\r\n\r\n  <string key=\"AddNewUserGroup.AddNewUserGroupStep1.LabelFieldGroup\" value=\"Add User Group\"/>\r\n  <string key=\"AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameLabel\" value=\"User group name\"/>\r\n  <string key=\"AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameHelp\" value=\"The name of the new user group\"/>\r\n  <string key=\"AddNewUserGroup.AddNewUserGroupStep1.UserGroupNameAlreadyExists\" value=\"A user group with the same name already exists\"/>\r\n\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.LabelFieldGroup\" value=\"Edit User Group\"/>\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.UserGroupNameLabel\" value=\"User group name\"/>\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.UserGroupNameHelp\" value=\"The name of the user group\"/>\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.UserGroupNameAlreadyExists\" value=\"A user group with the same name already exists\"/>\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.ActivePerspectiveFieldLabel\" value=\"Perspectives\" />\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.ActivePerspectiveMultiSelectLabel\" value=\"Perspectives\" />\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.ActivePerspectiveMultiSelectHelp\" value=\"Select which perspectives the users of this group gets access to view\" />\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.GlobalPermissionsFieldLabel\" value=\"Global permissions\"/>\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.GlobalPermissionsMultiSelectLabel\" value=\"Global permissions\"/>\r\n  <string key=\"EditUserGroup.EditUserGroupStep1.GlobalPermissionsMultiSelectHelp\" value=\"Global permissions that users in this group should have. The Administrate permission grants the user group access to manage user group permissions and execute other administrative tasks.  The Configure permission grants access to super user tasks.\"/>\r\n\t<string key=\"EditUserGroup.EditUserGroupStep1.ActiveLocalesFieldLabel\" value=\"Data Language Access\"/>\r\n\t<string key=\"EditUserGroup.EditUserGroupStep1.ActiveLocalesMultiSelectLabel\" value=\"Data Languages\"/>\r\n\t<string key=\"EditUserGroup.EditUserGroupStep1.ActiveLocalesMultiSelectHelp\" value=\"Users in this group has access to manage data in the selected languages.\"/>\r\n\r\n\r\n\r\n\t<string key=\"DeleteUserGroup.DeleteUserGroupInitialStep.UserGroupHasUsersTitle\" value=\"User Group Has Users\"/>\r\n  <string key=\"DeleteUserGroup.DeleteUserGroupInitialStep.UserGroupHasUsersMessage\" value=\"You cannot delete a user group that has users.\"/>\r\n  \r\n  <string key=\"DeleteUserGroup.DeleteUserGroupStep1.LabelFieldGroup\" value=\"Delete User Group\"/>\r\n  <string key=\"DeleteUserGroup.DeleteUserGroupStep1.Text\" value=\"Delete the selected user group?\"/>\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.VisualFunction.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"DeleteStep1.FieldGroupLabel\" value=\"Delete Visual Function?\" />\r\n  <string key=\"DeleteStep1.Text\" value=\"Are you sure you wish to delete the selected function?\" />\r\n  <string key=\"AddNew.DialogLabel\" value=\"Add Visual Function\" />\r\n  <string key=\"AddNew.NoTypesExistsErrorTitle\" value=\"No Datatypes to Visualize\" />\r\n  <string key=\"AddNew.NoTypesExistsErrorMessage\" value=\"No datatypes have been created yet. You must first create a datatype to visualize before you can create a visualization.\" />\r\n  <string key=\"AddNew.NoDataExistsErrorTitle\" value=\"No Data to Visualize and Preview\" />\r\n  <string key=\"AddNew.NoDataExistsErrorMessage\" value=\"Data must exist before you can create a rendering. Add some data to this type and try again.\" />\r\n  <string key=\"AddNew.NoPageTemplatesExistsErrorTitle\" value=\"No Templates\" />\r\n  <string key=\"AddNew.NoPageTemplatesExistsErrorMessage\" value=\"At least one template must exist before you can create a rendering. Create one template and try again.\" />\r\n  <string key=\"AddNew.MissingActiveLanguageTitle\" value=\"A Language Is Required\" />\r\n  <string key=\"AddNew.MissingActiveLanguageMessage\" value=\"To create a visual function a language is required, but no languages have been added yet. You can add one under the System perspective.\" />\r\n  <string key=\"AddNewStep1.TypeSelectorLabel\" value=\"Datatype\" />\r\n  <string key=\"AddNewStep1.TypeSelectorHelp\" value=\"\" />\r\n  <string key=\"AddNewStep2.FuncitonNameLabel\" value=\"Function name\" />\r\n  <string key=\"AddNewStep2.FuncitonNameHelp\" value=\"\" />\r\n  <string key=\"AddNewStep2.FuncitonNamespaceLabel\" value=\"Function namespace\" />\r\n  <string key=\"AddNewStep2.FuncitonNamespaceHelp\" value=\"\" />\r\n  <string key=\"Edit.PlaceHolderLabel\" value=\"Visual Function Settings\" />\r\n  <string key=\"Edit.HeadingTitel\" value=\"Visual function\" />\r\n  <string key=\"Edit.FieldGroupLabel\" value=\"Visual function settings\" />\r\n  <string key=\"Edit.FunctionNameLabel\" value=\"Function name\" />\r\n  <string key=\"Edit.FunctionNameHelp\" value=\"The name of the function. Names must be unique with a namespace.\" />\r\n  <string key=\"Edit.FunctionNamespaceLabel\" value=\"Function namespace\" />\r\n  <string key=\"Edit.FunctionNamespaceHelp\" value=\"The 'package' this function belongs to.\" />\r\n  <string key=\"Edit.FunctionDescriptionLabel\" value=\"Description\" />\r\n  <string key=\"Edit.FunctionDescriptionHelp\" value=\"A description of the function that can help people understand what it does.\" />\r\n  <string key=\"Edit.ItemListLenghtLabel\" value=\"Item list length\" />\r\n  <string key=\"Edit.ItemListLenghtHelp\" value=\"The maximum number of items to show.\" />\r\n  <string key=\"Edit.ItemSortingLabel\" value=\"Item sorting\" />\r\n  <string key=\"Edit.ItemSortingHelp\" value=\"Select which field to use when sorting the list. Use '(random)' to pick randomly from the list.\" />\r\n  <string key=\"Edit.ListSortingLabel\" value=\"List sort order\" />\r\n  <string key=\"Edit.ListSortingTrueLabel\" value=\"Ascending\" />\r\n  <string key=\"Edit.ListSortingFalseLabel\" value=\"Descending\" />\r\n  <string key=\"Edit.ListSortingHelp\" value=\"Select the sorted order. Ascending order is alphabetically, chronological. This field is ignored when '(random)' sorting is active.\" />\r\n  <string key=\"Edit.PreviewTemplateLabel\" value=\"Preview template\" />\r\n  <string key=\"Edit.PreviewTemplateHelp\" value=\"This information is only used when previewing the function.\" />\r\n  <string key=\"Edit.WYSIWYGLayoutLabel\" value=\"Visual Layout\" />\r\n  <string key=\"Edit.LabelPreview\" value=\"Preview\" />\r\n  <string key=\"Edit.NoPageTemplatesExistsErrorTitle\" value=\"No templates\" />\r\n  <string key=\"Edit.NoPageTemplatesExistsErrorMessage\" value=\"At least one template must exist before you can edit a rendering. Create one template and try again.\" />\r\n  <string key=\"Edit.MissingActiveLanguageTitle\" value=\"A language is required\" />\r\n  <string key=\"Edit.MissingActiveLanguageMessage\" value=\"To edit a visual function a language is required, but no languages have been added yet. You can add one under the System perspective.\" />\r\n  <string key=\"Select.FieldGroupLabel\" value=\"Select a visual function\" />\r\n  <string key=\"Select.FunctionFunctionsLabel\" value=\"Select a function\" />\r\n  <string key=\"Select.FunctionFunctionsHelp\" value=\"Select a visual function to edit or delete\" />\r\n  <string key=\"AddVisualFunctionWorkflow.FunctionNameValidatoinErrorMessage\" value=\"Another function with this name exists. Names must be unique.\" />\r\n  <string key=\"EditVisualFunctionWorkflow.FunctionNameValidatoinErrorMessage\" value=\"Another function with this name exists. Names must be unique.\" />\r\n  <string key=\"VisualFunctionElementProvider.RootFolderLabel\" value=\"Visual Functions\" />\r\n  <string key=\"VisualFunctionElementProvider.RootFolderToolTip\" value=\"Visual functions\" />\r\n  <string key=\"VisualFunctionElementProvider.AddNewLabel\" value=\"Add Visual Function\" />\r\n  <string key=\"VisualFunctionElementProvider.AddNewToolTip\" value=\"Add new visual function\" />\r\n  <string key=\"VisualFunctionElementProvider.EditLabel\" value=\"Edit Visual Function\" />\r\n  <string key=\"VisualFunctionElementProvider.EditToolTip\" value=\"Edit visual function\" />\r\n  <string key=\"VisualFunctionElementProvider.DeleteLabel\" value=\"Delete Visual Function\" />\r\n  <string key=\"VisualFunctionElementProvider.DeleteToolTip\" value=\"Delete visual function\" />\r\n  <string key=\"VisualFunctionElementProvider.FunctionNameNotUniqueError\" value=\"Another function with this name exists. Names must be unique.\" />\r\n  <string key=\"VisualFunctionElementProviderHelper.AddNewLabel\" value=\"New visual function\" />\r\n  <string key=\"VisualFunctionElementProviderHelper.AddNewToolTip\" value=\"New visual function\" />\r\n  <string key=\"VisualFunctionElementProviderHelper.EditLabel\" value=\"Edit visual function\" />\r\n  <string key=\"VisualFunctionElementProviderHelper.EditToolTip\" value=\"Edit visual function\" />\r\n  <string key=\"VisualFunctionElementProviderHelper.DeleteLabel\" value=\"Delete visual function\" />\r\n  <string key=\"VisualFunctionElementProviderHelper.DeleteToolTip\" value=\"Delete visual function\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.WebsiteFileElementProvider.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<strings>\r\n\t<string key=\"WebsiteFilesRootElement.Label\" value=\"/\" />\r\n\t<string key=\"LayoutResourcesRootElement.Label\" value=\"/\" /> <!-- Layout Resources -->\r\n\t<string key=\"LayoutResourcesKeyNameLabel\" value=\"Layout\" />\r\n\t\r\n\t<string key=\"DeleteFile.LabelFieldGroup\" value=\"Delete File?\" />\r\n\t<string key=\"DeleteFile.Text\" value=\"Delete file?\" />\r\n\t<string key=\"DeleteFolder.LabelFieldGroup\" value=\"Delete Folder?\" />\r\n\t<string key=\"DeleteFolder.Text\" value=\"Delete folder?\" />\r\n\t<string key=\"AddNewFolder.LabelFieldGroup\" value=\"Add New Folder\" />\r\n\t<string key=\"AddNewFolder.Text\" value=\"Folder name\" />\r\n\t<string key=\"AddNewFolder.Help\" value=\"Enter the name of the new folder\" />\r\n\t<string key=\"AddNewFolder.Error.FolderExist\" value=\"A folder with the same name already exists\" />\r\n\t<string key=\"AddNewFile.LabelFieldGroup\" value=\"Add New File\" />\r\n\t<string key=\"AddNewFile.Text\" value=\"File name\" />\r\n\t<string key=\"AddNewFile.Help\" value=\"Enter the name of the new file\" />\r\n\t<string key=\"AddNewFile.Error.FileExist\" value=\"A file with the same name already exists\" />\r\n\t<string key=\"UploadNewWebsiteFile.LabelFieldGroup\" value=\"Upload File\" />\r\n\t<string key=\"UploadNewWebsiteFile.LabelFile\" value=\"Select file\" />\r\n\t<string key=\"UploadNewWebsiteFile.HelpFile\" value=\"Select file to upload\" />\r\n  <string key=\"UploadNewWebsiteFile.ConfirmOverwriteTitle\" value=\"Overwrite existing file\" />\r\n  <string key=\"UploadNewWebsiteFile.ConfirmOverwriteDescription\" value=\"A file with the same name already exists, overwrite?\" />\r\n\t<string key=\"UploadFile.Error.WrongTypeTitle\" value=\"Wrong File Type\" />\r\n\t<string key=\"UploadFile.Error.WrongTypeMessage\" value=\"Wrong file type\" />\r\n\r\n  <string key=\"UploadAndExtractZipFileTitle\" value=\"Upload and Extract Zip\" />\r\n  <string key=\"UploadAndExtractZipFileToolTip\" value=\"Upload multiple files and folders by providing a Zip file\" />\r\n  <string key=\"UploadAndExtractZipFile.DialogLabel\" value=\"Upload and Extract Zip File\" />\r\n  <string key=\"UploadAndExtractZipFile.FileLabel\" value=\"Zip file\" />\r\n  <string key=\"UploadAndExtractZipFile.FileHelp\" value=\"The file/folder structure of the zip file you select will be extracted and copied to the website\" />\r\n  <string key=\"UploadAndExtractZipFile.OverwriteExistingLabel\" value=\"Overwrite existing\" />\r\n  <string key=\"UploadAndExtractZipFile.OverwriteExistingHelp\" value=\"If you select this option, existing files will be overwritten\" />\r\n  <string key=\"UploadAndExtractZipFile.OverwriteExistingItemLabel\" value=\"Overwrite existing files\" />\r\n\r\n  <string key=\"UploadAndExtractZipFile.FileExistsError\" value=\"File '{0}' exists both in the zip and on the website. Choose to overwrite files to complete this action\" />\r\n  <string key=\"UploadAndExtractZipFile.FileNotUploaded\" value=\"No file was uploaded\" />\r\n  <string key=\"UploadAndExtractZipFile.NotZip\" value=\"The uploaded file is not a valid Zip archive\" />\r\n  <string key=\"UploadAndExtractZipFile.ErrorDialogLabel\" value=\"Zip upload could not be completed\" />\r\n  <string key=\"UploadAndExtractZipFile.UnexpectedError\" value=\"Upload failed unexpectedly. Please see log for details\" />\r\n  <string key=\"UploadAndExtractZipFile.ExistingFileReadOnly\" value=\"Existing file '{0}' is marked as read only. No files were uploaded\" />\r\n\r\n\r\n  <string key=\"AddWebsiteFolderTitle\" value=\"New Folder\" />\r\n\t<string key=\"AddWebsiteFolderToolTip\" value=\"Add new folder\" />\r\n\t<string key=\"AddWebsiteFileTitle\" value=\"New File\" />\r\n\t<string key=\"AddWebsiteFileToolTip\" value=\"Create new file\" />\r\n\t<string key=\"DeleteWebsiteFileTitle\" value=\"Delete File\" />\r\n\t<string key=\"DeleteWebsiteFileToolTip\" value=\"Delete file\" />\r\n  <string key=\"DownloadFileTitle\" value=\"Download\" />\r\n  <string key=\"DownloadFileToolTip\" value=\"Download file\" />\r\n  <string key=\"DeleteWebsiteFolderTitle\" value=\"Delete Folder\" />\r\n\t<string key=\"DeleteWebsiteFolderToolTip\" value=\"Delete folder\" />\r\n\t<string key=\"EditWebsiteFileTitle\" value=\"Edit File\" />\r\n\t<string key=\"EditWebsiteFileToolTip\" value=\"Edit file\" />\r\n\t<string key=\"UploadWebsiteFileTitle\" value=\"Upload File\" />\r\n\t<string key=\"UploadWebsiteFileToolTip\" value=\"Upload file\" />\r\n\t<string key=\"AddFolderToWhiteListTitle\" value=\"Show in &quot;{0}&quot;\" />\r\n\t<string key=\"AddFolderToWhiteListToolTip\" value=\"Control if this folder should be visible in &quot;{0}&quot;\" />\r\n\t<string key=\"RemoveFolderFromWhiteListTitle\" value=\"Show in &quot;{0}&quot;\" />\r\n\t<string key=\"RemoveFolderFromWhiteListToolTip\" value=\"Control if this folder should be visible in &quot;{0}&quot;\" />\r\n\r\n\t<string key=\"DeleteWebsiteFileWorkflow.DeleteErrorTitle\" value=\"Error\" />\r\n\t<string key=\"DeleteWebsiteFileWorkflow.DeleteErrorMessage\" value=\"Could not delete the file\" />\r\n\t<string key=\"DeleteWebsiteFolderWorkflow.DeleteErrorTitle\" value=\"Error\" />\r\n\t<string key=\"DeleteWebsiteFolderWorkflow.DeleteErrorMessage\" value=\"Could not delete the folder\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Plugins.XsltBasedFunction.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"Plugins.XsltBasedFunctionProviderElementProvider.RootFolderLabel\" value=\"XSLT Functions\" />\r\n  <string key=\"Plugins.XsltBasedFunctionProviderElementProvider.RootFolderToolTip\" value=\"XSLT functions\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.DuplicateName\" value=\"An XSLT function with the same name already exists.\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.MethodEmpty\" value=\"Method name must be non-empty\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.NamespaceEmpty\" value=\"Namespace must be non-empty\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.InvalidNamespace\" value=\"Namespace must be like A.B.C - not start and end with .\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.MissingActiveLanguageTitle\" value=\"A language is required\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.MissingActiveLanguageMessage\" value=\"To create a XSLT function a language is required, but no languages have been added yet. You can add one under the System perspective.\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.MissingPageTitle\" value=\"A page is required\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.MissingPageMessage\" value=\"To create a XSLT function at least one page has to be added.\" />\r\n  <string key=\"AddNewXsltFunctionWorkflow.TotalNameTooLang\" value=\"The total length of the name and the namespace is too long (used to name the XSL file).\" />\r\n  <string key=\"DeleteXsltFunctionWorkflow.ConfirmDeleteTitle\" value=\"Delete XSLT Function?\" />\r\n  <string key=\"DeleteXsltFunctionWorkflow.ConfirmDeleteMessage\" value=\"Delete the selected XSLT?\" />\r\n  <string key=\"DeleteXsltFunctionWorkflow.CascadeDeleteErrorTitle\" value=\"Cascade Delete Error\" />\r\n  <string key=\"DeleteXsltFunctionWorkflow.CascadeDeleteErrorMessage\" value=\"The type is referenced by another type that does not allow cascade deletes. This operation is halted\" />\r\n  <string key=\"EditXsltFunctionWorkflow.DuplicateName\" value=\"An XSLT function with the same name already exists.\" />\r\n  <string key=\"EditXsltFunctionWorkflow.EmptyMethodName\" value=\"The method name must be non-empty\" />\r\n  <string key=\"EditXsltFunctionWorkflow.NamespaceEmpty\" value=\"The namespace must be non-empty\" />\r\n  <string key=\"EditXsltFunctionWorkflow.InvalidNamespace\" value=\"The namespace must be like A.B.C - not start and end with '.' (period)\" />\r\n  <string key=\"EditXsltFunctionWorkflow.InvalidFileName\" value=\"XslFilePath must start with \\ or /\" />\r\n  <string key=\"EditXsltFunctionWorkflow.InvalidName\" value=\"Invalid function name\" />\r\n  <string key=\"EditXsltFunctionWorkflow.CannotRenameFileExists\" value=\"Cannot rename the function, file '{0}' already exists.\" />\r\n  <string key=\"EditXsltFunctionWorkflow.TotalNameTooLang\" value=\"The total length of the name and the namespace is too long (used to name the XSL file).\" />\r\n\r\n  <string key=\"EditXsltFunctionWorkflow.SameLocalFunctionNameClashTitle\" value=\"Duplicate local function names\" />\r\n  <string key=\"EditXsltFunctionWorkflow.SameLocalFunctionNameClashMessage\" value=\"Two or more function calls has the same local name. Change the names so that all are different.\" />\r\n  \r\n  <string key=\"XsltBasedFunctionProviderElementProvider.Add\" value=\"Add XSLT Function\" />\r\n  <string key=\"XsltBasedFunctionProviderElementProvider.AddToolTip\" value=\"Add new XSLT function\" />\r\n  <string key=\"XsltBasedFunctionProviderElementProvider.Edit\" value=\"Edit\" />\r\n  <string key=\"XsltBasedFunctionProviderElementProvider.EditToolTip\" value=\"Edit XSLT function\" />\r\n  <string key=\"XsltBasedFunctionProviderElementProvider.Delete\" value=\"Delete\" />\r\n  <string key=\"XsltBasedFunctionProviderElementProvider.DeleteToolTip\" value=\"Delete XSLT function\" />\r\n  <string key=\"AddNewXsltFunctionStep1.LabelDialog\" value=\"Add New XSLT Function\" />\r\n  <string key=\"AddNewXsltFunctionStep1.LabelName\" value=\"Name\" />\r\n  <string key=\"AddNewXsltFunctionStep1.HelpName\" value=\"\" />\r\n  <string key=\"AddNewXsltFunctionStep1.LabelNamespace\" value=\"Namespace\" />\r\n  <string key=\"AddNewXsltFunctionStep1.HelpNamespace\" value=\"\" />\r\n  <string key=\"AddNewXsltFunctionStep1.LabelOutputType\" value=\"Output type\" />\r\n  <string key=\"AddNewXsltFunctionStep1.LabelCopyFrom\" value=\"Copy from\" />\r\n  <string key=\"AddNewXsltFunctionStep1.LabelCopyFromEmptyOption\" value=\"(New XSLT function)\" />\r\n\r\n\r\n  <string key=\"EditXsltFunction.LabelSettings\" value=\"Settings\" />\r\n  <string key=\"EditXsltFunction.LabelName\" value=\"Name\" />\r\n  <string key=\"EditXsltFunction.HelpName\" value=\"\" />\r\n  <string key=\"EditXsltFunction.LabelNamespace\" value=\"Namespace\" />\r\n  <string key=\"EditXsltFunction.HelpNamespace\" value=\"\" />\r\n  <string key=\"EditXsltFunction.LabelDescription\" value=\"Description\" />\r\n  <string key=\"EditXsltFunction.HelpDescription\" value=\"\" />\r\n  <string key=\"EditXsltFunction.LabelDebug\" value=\"Debug\" />\r\n  <string key=\"EditXsltFunction.LabelPage\" value=\"Page\" />\r\n  <string key=\"EditXsltFunction.HelpPage\" value=\"When debugging, this page is used as context for the rendering.\" />\r\n  <string key=\"EditXsltFunction.LabelAdminitrativeScope\" value=\"Administrative\" />\r\n  <string key=\"EditXsltFunction.LabelPublicScope\" value=\"Public\" />\r\n  <string key=\"EditXsltFunction.LabelPageDataScope\" value=\"Data scope\" />\r\n  <string key=\"EditXsltFunction.HelpPageDataScope\" value=\"Choose public or development version as context for the rendering.\" />\r\n  <string key=\"EditXsltFunction.LabelActiveLocales\" value=\"Language\" />\r\n  <string key=\"EditXsltFunction.HelpActiveLocales\" value=\"Select language to be used while debugging the function.\" />\r\n  <string key=\"EditXsltFunction.OutputType\" value=\"Output type\" />\r\n  <string key=\"EditXsltFunction.LabelInputParameters\" value=\"Input Parameters\" />\r\n  <string key=\"EditXsltFunction.LabelFunctionCalls\" value=\"Function Calls\" />\r\n  <string key=\"EditXsltFunction.LabelTemplate\" value=\"Template\" />\r\n  <string key=\"EditXsltFunction.LabelPreview\" value=\"Preview\" />\r\n  <string key=\"EditXsltFunctionWorkflow.MissingActiveLanguageTitle\" value=\"A Language Is Required\" />\r\n  <string key=\"EditXsltFunctionWorkflow.MissingActiveLanguageMessage\" value=\"To edit a XSLT function a language is required, but no languages have been added yet. You can add one under the System perspective.\" />\r\n  <string key=\"EditXsltFunctionWorkflow.MissingPageTitle\" value=\"A Page Is Required\" />\r\n  <string key=\"EditXsltFunctionWorkflow.MissingPageMessage\" value=\"To edit a XSLT function at least one page has to be added.\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Search.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n\t<string key=\"SearchPerspective.Label\" value=\"Search\" />\r\n\r\n\t<string key=\"SearchPage.SearchHerePlaceholder\" value=\"Search here...\" />\r\n\t<string key=\"SearchPage.NoResultFound\" value=\"No results found for '{0}'\" />\r\n\t<string key=\"SearchPage.SingleResultFound\" value=\"1 result found for '{0}'\" />\r\n\t<string key=\"SearchPage.MultipleResultsFound\" value=\"{1} results for '{0}'\" />\r\n\r\n\t<string key=\"DataType.Page\" value=\"Page\" />\r\n\t<string key=\"DataType.MediaFile\" value=\"Media File\" />\r\n\r\n\t<string key=\"FieldNames.PageTypeId\" value=\"Page Type\" />\r\n\t<string key=\"FieldNames.Label\" value=\"Label\" />\r\n\t<string key=\"FieldNames.Description\" value=\"Description\" />\r\n\t<string key=\"FieldNames.DataType\" value=\"Data Type\" />\r\n\t<string key=\"FieldNames.LastUpdated\" value=\"Last Updated\" />\r\n\t<string key=\"FieldNames.UpdatedBy\" value=\"Updated By\" />\r\n\t<string key=\"FieldNames.PublicationStatus\" value=\"Publication Status\" />\r\n\t<string key=\"FieldNames.MimeType\" value=\"Media Type\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Web.FormControl.FunctionCallsDesigner.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"DialogTitle\" value=\"Function Properties\" />\r\n  <string key=\"FunctionLocalNameGroupLabel\" value=\"Function result local name\" />\r\n  <string key=\"FunctionLocalNameLabel\" value=\"Local name\" />\r\n  <string key=\"FunctionLocalNameHelp\" value=\"If you include a function multiple times this field can help you distinguish the individual results by their local name. \" />\r\n  <string key=\"ParameterValueLabel\" value=\"Parameter Value\" />\r\n  <string key=\"AddNewFunctionDialogLabel\" value=\"Select Function\" />\r\n  <string key=\"SetNewFunctionDialogLabel\" value=\"Select Function\" />\r\n  <string key=\"ComplexFunctionCallDialogLabel\" value=\"Value for parameter '{0}'\" />\r\n  <string key=\"ParameterTypeLabel\" value=\"Parameter Type\" />\r\n  <string key=\"ParameterNameLabel\" value=\"Parameter Name\" />\r\n  <string key=\"ReturnTypeLabel\" value=\"Return type\" />\r\n  <string key=\"ValidationFailedAlertTitle\" value=\"Validation failed\" />\r\n  <string key=\"FunctionNotFound\" value=\"Function '{0}' does not exist.\" />\r\n  <string key=\"RequiredParameterNotDefined\" value=\"Required parameter '{0}' has not been defined.\" />\r\n  <string key=\"IncorrectTypeCast\" value=\"Incorrect type cast. Parameter name: '{0}', function name: '{1}'.\" />\r\n  <string key=\"ParameterTypeDefaultLabel\" value=\"Default\" />\r\n  <string key=\"ParameterTypeConstantLabel\" value=\"Constant\" />\r\n  <string key=\"ParameterTypeInputParameterLabel\" value=\"Input Parameter\" />\r\n  <string key=\"ParameterTypeFunctionLabel\" value=\"Function\" />\r\n  <string key=\"AddNewButtonLabel\" value=\"Add New\" />\r\n  <string key=\"DeleteButtonLabel\" value=\"Delete\" />\r\n  <string key=\"SetNewButtonLabel\" value=\"Set New\" />\r\n  <string key=\"ToolBar.LabelSource\" value=\"Source\" />\r\n  <string key=\"ToolBar.LabelDesign\" value=\"Design\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Web.FormControl.FunctionParameterDesigner.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<strings>\r\n  \r\n  <string key=\"AddNewButtonLabel\" value=\"Add New\" />\r\n  <string key=\"DeleteButtonLabel\" value=\"Delete\" />\r\n\r\n  <string key=\"TreeRootNodeLabel\" value=\"List of input parameters\" />\r\n\r\n  <string key=\"ParameterNamingGroupLabel\" value=\"Parameter naming and help\" />\r\n  <string key=\"Name\" value=\"Parameter name\" />\r\n  <string key=\"NameHelp\" value=\"The name of the parameter. The name is used by the system to identify this parameter. Names must be unique and may not contain spaces and other special characters. Use names like 'Title', 'StartDate', 'LargeImage' etc.\" />\r\n  <string key=\"Label\" value=\"Label\" />\r\n  <string key=\"LabelHelp\" value=\"The text that users should see when specifying a value for this parameter. This is the 'human name' for the parameter.\" />\r\n  <string key=\"Help\" value=\"Help\" />\r\n  <string key=\"HelpHelp\" value=\"Write a short text that tells the user what to do with the parameter.\" />\r\n\r\n  <string key=\"ParameterTypeValueGroupLabel\" value=\"Parameter type and values\" />\r\n  <string key=\"Type\" value=\"Parameter type\" />\r\n  <string key=\"TypeHelp\" value=\"The type of this parameter.\" />\r\n  <string key=\"DefaultValue\" value=\"Default value\" />\r\n  <string key=\"DefaultValueHelp\" value=\"You can specify a default value for this parameter. If a parameter has a default value, users are not required to specify it when calling the function.\" />\r\n  <string key=\"DefaultValueSpecify\" value=\"Specify default value\" />\r\n  <string key=\"DefaultValueEdit\" value=\"Edit default value\" />\r\n  <string key=\"DefaultValueDialogLabel\" value=\"Parameter Default Value\" />\r\n  \r\n  <string key=\"TestValue\" value=\"Test value\" />\r\n  <string key=\"TestValueHelp\" value=\"When previewing you can test with different input parameter values using this field. If this is left blank, the default value will be used for previews.\" />\r\n  <string key=\"TestValueSpecify\" value=\"Specify test value\" />\r\n  <string key=\"TestValueEdit\" value=\"Edit test value\" />\r\n  <string key=\"TestValueDialogLabel\" value=\"Parameter Test Value\" />\r\n\r\n  <string key=\"ParameterPresentationGroupLabel\" value=\"Parameter presentation\" />\r\n  <string key=\"Widget\" value=\"Widget\" />\r\n  <string key=\"WidgetHelp\" value=\"You can select which type of input widget (like a textbox) to use when specifying a value for this parameter. Widgets are only available for simple types.\" />\r\n  <string key=\"NoWidgetSpecifiedLabel\" value=\"(no widget specified)\" />\r\n  <string key=\"WidgetDialogLabel\" value=\"Parameter Widget\" />\r\n  <string key=\"Position\" value=\"Position\" />\r\n  <string key=\"PositionLast\" value=\"Last\" />\r\n  <string key=\"PositionHelp\" value=\"The position of the parameter. This controls the order of the parameters.\" />\r\n\r\n  <string key=\"SpecifyWidgetTip\" value=\"Remember to specify a widget...\" />\r\n\r\n  <string key=\"FieldNameSyntaxInvalid\" value=\"The specified name is not valid.\" />\r\n  <string key=\"CannotSave\" value=\"Can not save... Another parameter has the same name. Please change the name.\" />\r\n\r\n  <string key=\"SpaceInNameError\" value=\"Invalid name. Parameter names can not contain spaces. You can write a readable name in the Label field below.\" />\r\n  <string key=\"NameEmptyError\" value=\"Parameter names can not be empty. Please specify a name.\" />\r\n  <string key=\"NameAlreadyInUseError\" value=\"Another parameter uses this name. Parameter names must be unique.\" />\r\n\r\n\r\n\r\n</strings>\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Web.FormControl.TypeFieldDesigner.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<strings>\r\n  <string key=\"BasicTabLabel\" value=\"Basic\" />\r\n  <string key=\"AdvancedTabLabel\" value=\"Advanced\" />\r\n\r\n  <string key=\"AddNewButtonLabel\" value=\"Add New\" />\r\n  <string key=\"DeleteButtonLabel\" value=\"Delete\" />\r\n  <string key=\"LabelDataTypeFields\" value=\"Datatype Fields\" />\r\n\r\n  <string key=\"KeyFieldDetailsGroupLabel\" value=\"Key field properties\" />\r\n  <string key=\"KeyFieldType\" value=\"Key field type\" />\r\n  <string key=\"KeyFieldTypeHelp\" value=\"The data type of the key field. Guid fields feature optimal performance, string key fields are usefull when the id values have to be exposed in urls.\" />\r\n  \r\n  <string key=\"FieldDetailsGroupLabel\" value=\"Field properties\" />\r\n  <string key=\"Name\" value=\"Name\" />\r\n  <string key=\"NameHelp\" value=\"The name of the field is used by the system to identify this field. Names must be unique and can not contain spaces and other special characters. Use names like 'Title', 'StartDate', 'LargeImage' etc.\" />\r\n  <string key=\"Label\" value=\"Label\" />\r\n  <string key=\"LabelHelp\" value=\"Label text are showed to users when adding a new item based on the datatype.\" />\r\n  <string key=\"Help\" value=\"Help\" />\r\n  <string key=\"HelpHelp\" value=\"Use this entry for a short help text to the user.\" />\r\n\r\n  <string key=\"FieldTypeGroupLabel\" value=\"Field type and requirements\" />\r\n  <string key=\"FieldType\" value=\"Field type\" />\r\n  <string key=\"FieldTypeHelp\" value=\"Select a data type for the field. The type determine which kind of data the field can hold.\" />\r\n  <string key=\"System.String\" value=\"String\" />\r\n  <string key=\"System.Int32\" value=\"Integer\" />\r\n  <string key=\"System.Decimal\" value=\"Decimal number\" />\r\n  <string key=\"System.DateTime\" value=\"Date\" />\r\n  <string key=\"System.Boolean\" value=\"Boolean\" />\r\n  <string key=\"System.Guid\" value=\"Unique Identifier (GUID)\" />\r\n  <string key=\"Reference\" value=\"Data reference\" />\r\n  <string key=\"TypeDetailsHelp\" value=\"Use this field to further configure your selected type.\" />\r\n  <string key=\"Optional\" value=\"Optional\" />\r\n  <string key=\"OptionalHelp\" value=\"Optional fields may be left blank.\" />\r\n  <string key=\"OptionalFalseLabel\" value=\"No\" />\r\n  <string key=\"OptionalTrueLabel\" value=\"Yes\" />\r\n  <string key=\"ValidationRules\" value=\"Validation rules\" />\r\n  <string key=\"ValidationRulesHelp\" value=\"You can specify strict rules on the data that is entered in this field, i.e. &quot;must be at least 5 characters long&quot;, &quot;must be a valid e-mail address&quot;, &quot;must be a date in the past&quot; etc.\" />\r\n  <string key=\"ValidationRulesAdd\" value=\"Add validation rules...\" />\r\n  <string key=\"ValidationRulesEdit\" value=\"Edit validation rules\" />\r\n  <string key=\"ValidationRulesDialogLabel\" value=\"Field Validation Rules Configuration\" />\r\n\r\n  \r\n  <string key=\"FieldValidationGroupLabel\" value=\"Field validation\" />\r\n  <string key=\"FieldPresentationGroupLabel\" value=\"Form field presentation\" />\r\n  <string key=\"FieldStructureGroupLabel\" value=\"Structural presentation\" />\r\n  \r\n  <string key=\"Widget\" value=\"Widget type\" />\r\n  <string key=\"WidgetHelp\" value=\"You can select which type of input widget (like a textbox) to use when editing this field.\" />\r\n  <string key=\"WidgetDialogLabel\" value=\"Field Widget Configuration\" />\r\n  <string key=\"Position\" value=\"Position\" />\r\n  <string key=\"PositionLast\" value=\"Last\" />\r\n  <string key=\"PositionHelp\" value=\"The position of the field. This controls the order of the fields.\" />\r\n  <string key=\"GroupByPriority\" value=\"Tree grouping\" />\r\n  <string key=\"GroupByPriorityNone\" value=\"(no grouping)...\" />\r\n  <string key=\"GroupByPriorityFirst\" value=\"Group by this field\" />\r\n  <string key=\"GroupByPriorityN\" value=\"Group as {0}. priority\" />\r\n  <string key=\"GroupByPriorityHelp\" value=\"You can specify that a field should be used to group data - this can improve readability when viewing long lists. Use priority when multiple fields are used for grouping.\" />\r\n  <string key=\"TreeOrdering\" value=\"Tree ordering\" />\r\n  <string key=\"TreeOrderingNone\" value=\"(no ordering)...\" />\r\n  <string key=\"TreeOrderingFirstAscending\" value=\"Order ascending (A-Z)\" />\r\n  <string key=\"TreeOrderingFirstDescending\" value=\"Order descending (Z-A)\" />\r\n  <string key=\"TreeOrderingNAscending\" value=\"Order {0}. ascending\" />\r\n  <string key=\"TreeOrderingNDescending\" value=\"Order {0}. descending\" />\r\n  <string key=\"TreeOrderingHelp\" value=\"You can specify that a field should be used to order data in the tree view - this can improve readability when a field is used to position elements on the website.\" />\r\n  <string key=\"IsTitleField\" value=\"Is title field\" />\r\n  <string key=\"IsTitleFieldHelp\" value=\"Check this if you wish this field to be used as the title field. Title fields are used when listing data, like in the tree to the left.\" />\r\n  <string key=\"IsTitleFieldLabel\" value=\"Use this as title field in lists\" />\r\n\r\n  \r\n  <string key=\"DefaultValueGroupLabel\" value=\"Field default value\" />\r\n  <string key=\"DefaultValue\" value=\"Default value\" />\r\n  <string key=\"DefaultValueHelp\" value=\"You can define a default value for this field.\" />\r\n  <string key=\"DefaultValueDialogLabel\" value=\"Field default value configuration\" />\r\n\r\n\r\n  <string key=\"DataUrlGroupLabel\" value=\"Data url\" />\r\n  <string key=\"AppearsInUrlLabel\" value=\"Field appears in data url\" />\r\n  <string key=\"AppearsInUrlItemLabel\" value=\"Use in data urls\" />\r\n  <string key=\"AppearsInUrlHelp\" value=\"When checked the field will appear in data urls\" />\r\n  <string key=\"DataUrlOrderLabel\" value=\"Order\" />\r\n  <string key=\"DataUrlOrderHelp\" value=\"Order in which the field appear in data url route\" />\r\n\r\n  <string key=\"DataUrlDateFormatLabel\" value=\"Format\" />\r\n  <string key=\"DataUrlDateFormatHelp\" value=\"Chose in what format the date field will appear in url\" />\r\n  <string key=\"DataUrlDateFormat_Year\" value=\"Year\" />\r\n  <string key=\"DataUrlDateFormat_Month\" value=\"Month\" />\r\n  <string key=\"DataUrlDateFormat_Day\" value=\"Day\" />\r\n  \r\n\r\n  <string key=\"StringMaximumLength\" value=\"String maximum length\" />\r\n  <string key=\"16CharMax\" value=\"16 character maximum\" />\r\n  <string key=\"32CharMax\" value=\"32 character maximum\" />\r\n  <string key=\"64CharMax\" value=\"64 character maximum\" />\r\n  <string key=\"128CharMax\" value=\"128 character maximum\" />\r\n  <string key=\"256CharMax\" value=\"256 character maximum\" />\r\n  <string key=\"512CharMax\" value=\"512 character maximum\" />\r\n  <string key=\"1024CharMax\" value=\"1024 character maximum\" />\r\n  <string key=\"Unlimited\" value=\"Unlimited length\" />\r\n\r\n\t<string key=\"SearchGroupLabel\" value=\"Search\" />\r\n\t<string key=\"Search.TextSearch\" value=\"Text Search\" />\r\n\t<string key=\"Search.IndexText.Label\" value=\"Index text content\" />\r\n\t<string key=\"Search.IndexText.Help\" value=\"When checked, the text content of the field will be searchable.\" />\r\n\t<string key=\"Search.SearchResults\" value=\"Search Results\" />\r\n\t<string key=\"Search.FieldPreview.Label\" value=\"Enable field preview\" />\r\n\t<string key=\"Search.FieldPreview.Help\" value=\"When checked, the field will appear in the search results table as a column.\" />\r\n\t<string key=\"Search.FacetedSearch\" value=\"Faceted Search\" />\r\n\t<string key=\"Search.Facet.Label\" value=\"Enable faceted search\" />\r\n\t<string key=\"Search.Facet.Help\" value=\"When checked, the field will appear in search results as a facet.\" />\r\n\r\n\t<string key=\"DecimalNumberFormat\" value=\"Decimal number format\" />\r\n  <string key=\"1DecimalPlace\" value=\"1 decimal place\" />\r\n  <string key=\"nDecimalPlaces\" value=\"{0} decimal places\" />\r\n\r\n  <string key=\"ReferenceType\" value=\"Reference Type\" />\r\n  \r\n  <string key=\"FieldNameSyntaxInvalid\" value=\"The specified name is not valid.\" />\r\n  <string key=\"CannotSave\" value=\"Can not save... Another Field has the same name. Please change the name.\" />\r\n\r\n  <string key=\"SpaceInNameError\" value=\"Invalid name. Data field names can not contain spaces. You can write a readable name in the Label field below.\" />\r\n  <string key=\"NameEmptyError\" value=\"Data field names can not be empty. Please specify a name.\" />\r\n  <string key=\"NameAlreadyInUseError\" value=\"Another field uses this name. Data field names must be unique.\" />\r\n  <string key=\"NotAnOptionalTypeError\" value=\"The selected type can not be optional.\" />\r\n  <string key=\"NoWidgetSelected\" value=\"Remember to specify a widget...\" />\r\n  <string key=\"NoWidgetSelectedLabel\" value=\"(no widget specified)\" />\r\n</strings>\r\n\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/localization/Composite.Web.PageBrowser.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<strings>\r\n\r\n  <!-- menus -->\r\n  <string key=\"Menu.ViewSource\" value=\"Page source\" />\r\n  <string key=\"Menu.ViewMode\" value=\"View mode\" />\r\n  <string key=\"ContextMenu.Back\" value=\"Back\" />\r\n  <string key=\"ContextMenu.Forward\" value=\"Forward\" />\r\n  <string key=\"ContextMenu.Refresh\" value=\"Refresh\" />\r\n  <string key=\"ContextMenu.ViewSource\" value=\"View Page Source\" />\r\n\r\n\r\n  <!-- buttons -->\r\n\t<string key=\"ToolBarButton.Back.ToolTip\" value=\"Go back one page\" />\r\n\t<string key=\"ToolBarButton.Forward.ToolTip\" value=\"Go forward one page\" />\r\n\t<string key=\"ToolBarButton.Refresh.ToolTip\" value=\"Refresh page\" />\r\n  <string key=\"ToolBarButton.TreeView.ToolTip\" value=\"Show Tree\" />\r\n  <string key=\"ToolBarButton.Go.ToolTip\" value=\"Go to the address in the location bar\" />\r\n  <string key=\"ToolBarButton.Home.ToolTip\" value=\"Go to the Start page\" /> <!-- TODO: Show URL instead! -->\r\n\t\r\n\t<!-- URL errors -->\r\n\t<string key=\"AddressBar.Invalid.DialogTitle.External\" \t\tvalue=\"Access denied\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogText.External\" \t\tvalue=\"External URL cannot loaded.\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogTitle.BadRequest\" \tvalue=\"Bad URL\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogText.BadRequest\" \t\tvalue=\"The URL is invalid and cannot be loaded.\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogTitle.Unauthorized\" \tvalue=\"Not authorized\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogText.Unauthorized\" \tvalue=\"You are not authorized to view the page on specified URL.\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogTitle.NotFound\" \t\tvalue=\"Page not found\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogText.NotFound\" \t\tvalue=\"Page not found on the specified URL.\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogTitle.InternalError\" \tvalue=\"Server error\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogText.InternalError\" \tvalue=\"The server has reported an error on the specified URL. The page cannot be loaded.\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogTitle.Default\" \t\tvalue=\"Page not loaded\"/>\r\n\t<string key=\"AddressBar.Invalid.DialogText.Default\" \t\tvalue=\"An error prevents the URL from being loaded.\"/>\t\r\n\t\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Web.SEOAssistant.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <string key=\"SEOAssistant\" value=\"SEO Assistant\" />\r\n  <string key=\"SEOAssistant.ToolTip\" value=\"Search engine optimization\" />\r\n  <string key=\"IntroText\" value=\"Generate a page preview to compute the SEO indication.\" />\r\n  <string key=\"TabResult\" value=\"Result\" />\r\n  <string key=\"TabKeywords\" value=\"Keywords\" />\r\n  <string key=\"ResultHeading\" value=\"Keywords found in page preview:\" />\r\n  <string key=\"NoKeywordsWarning\" value=\"No keywords configured.\" />\r\n  <string key=\"isInTitle\" value=\"In title\" />\r\n  <string key=\"isInURL\" value=\"In URL\" />\r\n  <string key=\"isInMenuTitle\" value=\"In menu title\" />\r\n  <string key=\"isInDescription\" value=\"In description\" />\r\n  <string key=\"isInHeading\" value=\"In heading\" />\r\n  <string key=\"isInContent\" value=\"In content\" />\r\n  <string key=\"NoKeywords\" value=\"No keywords found in page preview\" />\r\n\t<string key=\"IncorrectHtml\" value=\"Failed to analyze the keywords because the markup is not valid\" />\r\n  <string key=\"AddKeywordInputPlaceholder\" value=\"Add SEO word ...\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Web.SourceEditor.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<strings>\r\n\r\n\t<!-- preload precaution -->\r\n\t<string key=\"Preload.Key\" value=\"Retrieved on SourceEditorBinding startup to make sure strings are loaded :)\"/>\r\n\t\r\n\t<!-- validation messages -->\r\n\t<string key=\"Invalid.HTML.DialogTitle\" value=\"Invalid XHTML\" />\r\n\t<string key=\"Invalid.HTML.MissingHtml\" value=\"The root &lt;html&gt; tag is missing.\" />\r\n\t<string key=\"Invalid.HTML.MissingHead\" value=\"The &lt;head&gt; tag is missing.\" />\r\n\t<string key=\"Invalid.HTML.MissingBody\" value=\"The &lt;body&gt; tag is missing.\" />\r\n\t<string key=\"Invalid.HTML.HeadBodyIndex\" value=\"The &lt;head&gt; tag must precede &lt;body&gt;.\" />\r\n\t<string key=\"Invalid.HTML.NamespaceURI\" value=\"The root namespace is wrong.\" />\r\n\t<string key=\"Invalid.HTML.MultipleBody\" value=\"Only one &lt;body&gt; tag allowed.\"/>\r\n\t<string key=\"Invalid.HTML.MultipleHead\" value=\"Only one &lt;head&gt; tag allowed.\"/>\r\n  <string key=\"Invalid.HTML.NotAllowedHtmlChild\" value=\"The root &lt;html&gt; tag can only have &lt;head&gt; and &lt;body&gt; tags as children.\"/>\r\n  \r\n\r\n  <string key=\"Format.XML.ErrorDialog.Title\" value=\"Source format aborted\"/> \r\n\t<string key=\"Format.XML.ErrorDialog.Text\" value=\"XML source formatting requires a well-formed document structure.\"/>\r\n\t\r\n\t<!-- plain/colored switch button -->\r\n\t<string key=\"Switch.PlainEdit.Label\" value=\"Plain Edit\"/>\r\n\t<string key=\"Switch.PlainEdit.ToolTip\" value=\"No syntax highlight, faster performance\"/>\r\n\t<string key=\"Switch.ColoredEdit.Label\" value=\"Colored Edit\"/>\r\n\t<string key=\"Switch.ColoredEdit.ToolTip\" value=\"Syntax highlight, slower performance\"/>\r\n\r\n  <!-- toolbar menus -->\r\n  <string key=\"Toolbar.Insert.Label\" value=\"Insert\"/>\r\n  <string key=\"Toolbar.Format.Label\" value=\"Format\"/>\r\n  <string key=\"Toolbar.Format.ToolTip\" value=\"Format XML source\"/>\r\n  <string key=\"Toolbar.ToggleWordWrap.Label\" value=\"Toggle word wrap\"/>\r\n  <string key=\"Toolbar.FindAndReplace.Label\" value=\"Find and replace\"/>\r\n  \r\n  <!-- insert dropdown -->\r\n\t<string key=\"Insert.PageURL.Label\" value=\"Page URL\"/>\r\n\t<string key=\"Insert.ImageURL.Label\" value=\"Image URL\"/>\r\n\t<string key=\"Insert.MediaURL.Label\" value=\"Media URL\"/>\r\n\t<string key=\"Insert.FrontendURL.Label\" value=\"Frontend URL\"/>\r\n\t<string key=\"Insert.FunctionMarkup.Label\" value=\"Function Markup\"/>\r\n\t\r\n  <!--Resx editor strings-->\r\n\t<string key=\"ResxEditor.TranslateTo.Label\" value=\"Translate To {0}\"/>\r\n\t<string key=\"ResxEditor.TranslateTo.Tooltip\" value=\"Translate To {0}\"/>\r\n\t<string key=\"ResxEditor.Label\" value=\"Label\"/>\r\n\t<string key=\"ResxEditor.OriginalText\" value=\"Original Text\"/>\r\n\t<string key=\"ResxEditor.TranslatedText\" value=\"Translated Text\"/>\r\n\t<string key=\"ResxEditor.Save\" value=\"Save\"/>\r\n\r\n  <!-- find and replace -->\r\n  <string key=\"FindAndReplace.LabelTitle\" value=\"Find and replace\" />\r\n  <string key=\"FindAndReplace.LabelFind\" value=\"Find\" />\r\n  <string key=\"FindAndReplace.LabelReplaceWith\" value=\"Replace with\" />\r\n  <string key=\"FindAndReplace.LabelMatchCase\" value=\"Match case\" />\r\n  <string key=\"FindAndReplace.LabelWholeWords\" value=\"Whole words\" />\r\n  <string key=\"FindAndReplace.ButtonFind\" value=\"Find Next\" />\r\n  <string key=\"FindAndReplace.ButtonReplace\" value=\"Replace\" />\r\n  <string key=\"FindAndReplace.ButtonReplaceAll\" value=\"Replace all\" />\r\n  <string key=\"FindAndReplace.LaunchButton.Label\" value=\"Find and Replace\" />\r\n\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Composite.Web.VisualEditor.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n  <!-- preload precaution -->\r\n  <string key=\"Preload.Key\" value=\"Retrieved on VisualEditorBinding startup to make sure strings are loaded :)\" />\r\n  <!-- simple toolbar -->\r\n  <string key=\"ToolBar.ToolTipStrong\" value=\"Strong text\" />\r\n  <string key=\"ToolBar.ToolTipEmphasize\" value=\"Emphasize text\" />\r\n  <string key=\"ToolBar.ToolTipUnderline\" value=\"Underline text\" />\r\n  <string key=\"ToolBar.ToolTipStrike\" value=\"Strike text\" />\r\n  <string key=\"ToolBar.ToolTipAlignLeft\" value=\"Align left\" />\r\n  <string key=\"ToolBar.ToolTipAlignRight\" value=\"Align right\" />\r\n  <string key=\"ToolBar.ToolTipJustifyLeft\" value=\"Justify left\" />\r\n  <string key=\"ToolBar.ToolTipJustifyRight\" value=\"Justify right\" />\r\n  <string key=\"ToolBar.ToolTipJustifyCenter\" value=\"Justify center\" />\r\n  <string key=\"ToolBar.ToolTipJustifyFull\" value=\"Justify full\" />\r\n  <string key=\"ToolBar.ToolTipUnorderedList\" value=\"Unordered list\" />\r\n  <string key=\"ToolBar.ToolTipOrderedList\" value=\"Ordered list\" />\r\n  <string key=\"ToolBar.ToolTipLink\" value=\"Link\" />\r\n  <string key=\"ToolBar.ToolTipDeleteLink\" value=\"Delete link\" />\r\n  <string key=\"ToolBar.ToolTipCleanup\" value=\"Cleanup messy code\" />\r\n  <string key=\"ToolBar.ToolTipUndo\" value=\"Undo\" />\r\n  <string key=\"ToolBar.ToolTipRedo\" value=\"Redo\" />\r\n  <string key=\"ToolBar.LabelSource\" value=\"Source\" />\r\n  <string key=\"ToolBar.LabelWysiwyg\" value=\"Visual\" />\r\n  <!-- format selector -->\r\n  <string key=\"FormatSelector.LabelParagraph\" value=\"Paragraph\" />\r\n  <string key=\"FormatSelector.LabelAddress\" value=\"Address\" />\r\n  <string key=\"FormatSelector.LabelBlockQuote\" value=\"Blockquote\" />\r\n  <string key=\"FormatSelector.LabelDivision\" value=\"Division\" />\r\n  <string key=\"FormatSelector.LabelHeading1\" value=\"Heading 1\" />\r\n  <string key=\"FormatSelector.LabelHeading2\" value=\"Heading 2\" />\r\n  <string key=\"FormatSelector.LabelHeading3\" value=\"Heading 3\" />\r\n  <string key=\"FormatSelector.LabelHeading4\" value=\"Heading 4\" />\r\n  <string key=\"FormatSelector.LabelHeading5\" value=\"Heading 5\" />\r\n  <string key=\"FormatSelector.LabelHeading6\" value=\"Heading 6\" />\r\n  <!-- classname selector -->\r\n  <string key=\"ClassSelector.LabelNone\" value=\"(None)\" />\r\n  <!-- contextmenu (duplicated in toolbar) -->\r\n  <string key=\"ContextMenu.LabelInsert\" value=\"Insert\" />\r\n  <string key=\"ContextMenu.LabelPaste\" value=\"Paste\" />\r\n  <string key=\"ContextMenu.LabelLink\" value=\"Link\" />\r\n  <string key=\"ContextMenu.LabelUnLink\" value=\"Unlink\" />\r\n  <string key=\"ContextMenu.LabelLinkProperties\" value=\"Link Properties\" />\r\n  <string key=\"ContextMenu.LabelTable\" value=\"Table…\" />\r\n  <string key=\"ContextMenu.LabelTableManage\" value=\"Manage Table\" />\r\n  <string key=\"ContextMenu.LabelImage\" value=\"Image…\" />\r\n  <string key=\"ContextMenu.LabelAsText\" value=\"As Simple Text…\" />\r\n  <string key=\"ContextMenu.LabelField\" value=\"Field\" />\r\n  <string key=\"ContextMenu.LabelFieldDelete\" value=\"Delete Field\" />\r\n  <string key=\"ContextMenu.LabelRendering\" value=\"Function…\" />\r\n  <string key=\"ContextMenu.LabelCharacter\" value=\"Character…\" />\r\n  <string key=\"ContextMenu.LabelImageProperties\" value=\"Image Properties…\" />\r\n  <string key=\"ContextMenu.LabelRenderingProperties\" value=\"Function Properties…\" />\r\n  <string key=\"ContextMenu.LabelCutRow\" value=\"Cut Row\" />\r\n  <string key=\"ContextMenu.LabelCopyRow\" value=\"Copy Row\" />\r\n  <string key=\"ContextMenu.LabelPasteRow\" value=\"Paste Row\" />\r\n  <string key=\"ContextMenu.LabelBefore\" value=\"Before\" />\r\n  <string key=\"ContextMenu.LabelAfter\" value=\"After\" />\r\n  <string key=\"ContextMenu.LabelTableProperties\" value=\"Table Properties\" />\r\n  <string key=\"ContextMenu.LabelCellProperties\" value=\"Cell Properties\" />\r\n  <string key=\"ContextMenu.LabelRowProperties\" value=\"Row Properties\" />\r\n  <string key=\"ContextMenu.LabelInsertRow\" value=\"Insert Row\" />\r\n  <string key=\"ContextMenu.LabelDeleteRow\" value=\"Delete Row\" />\r\n  <string key=\"ContextMenu.LabelInsertcolumn\" value=\"Insert Column\" />\r\n  <string key=\"ContextMenu.LabelDeleteColumn\" value=\"Delete Column\" />\r\n  <string key=\"ContextMenu.LabelMergeTableCells\" value=\"Merge Table Cells\" />\r\n  <string key=\"ContextMenu.LabelSplitMergedCells\" value=\"Split Merged Cells\" />\r\n  <string key=\"ContextMenu.LabelDeleteTable\" value=\"Delete Table\" />\r\n  <string key=\"ContextMenu.LabelAlignImage\" value=\"Align Image\" />\r\n  <string key=\"ContextMenu.LabelAlignImageRight\" value=\"Right\" />\r\n  <string key=\"ContextMenu.LabelAlignImageLeft\" value=\"Left\" />\r\n  <string key=\"ContextMenu.LabelAlignImageNone\" value=\"None\" />\r\n  <!-- error dialog -->\r\n  <string key=\"ContentError.DialogTitle\" value=\"Source code error\" />\r\n  <string key=\"ContentError.DialogText\" value=\"Error in source code:\" />\r\n  <!-- template selector -->\r\n  <string key=\"TemplateTree.NoTemplateWarning\" value=\"No placeholders in template.\" />\r\n  <!-- PLUGINS ............................................................... -->\r\n  <!-- general -->\r\n  <string key=\"LabelTabBasic\" value=\"Basic\" />\r\n  <string key=\"LabelTabAdvanced\" value=\"Advanced\" />\r\n  <string key=\"LabelClass\" value=\"Class\" />\r\n  <string key=\"HelpClass\" value=\"The class attribute specifies a CSS classname for an element.\" />\r\n  <string key=\"LabelId\" value=\"ID\" />\r\n  <string key=\"HelpId\" value=\"The id attribute can be used by JavaScript or CSS to make changes to an element.\" />\r\n  <string key=\"MozSecurityNote.LabelSecurityStuff\" value=\"Clipboard disabled\" />\r\n  <string key=\"MozSecurityNote.TextSecurityStuff\" value=\"For security reasons, access to the clipboard was blocked by your browser. Please use standard keyboard shortcuts. For a technical description of, how to configure your browser for use with {applicationname}, press the &quot;More Info&quot; button.\" />\r\n  <!-- link -->\r\n  <string key=\"Link.LabelInsertLink\" value=\"Insert Link\" />\r\n  <string key=\"Link.LabelLinkProperties\" value=\"Link Properties\" />\r\n  <string key=\"Link.LinkDestination\" value=\"URL\" />\r\n  <string key=\"Link.LinkRole\" value=\"Role\" />\r\n  <string key=\"Link.TitleText\" value=\"Title\" />\r\n  <string key=\"Link.LinkTarget\" value=\"Target\" />\r\n  <string key=\"Link.LinkTarget.LabelCheckBox\" value=\"Open in new window\" />\r\n  <string key=\"Link.TitleTextToolTip\" value=\"The title text is rendered as a tooltip when the mouse hovers over the link. This can be used to let your customers know where the link is going without disturbing the flow of your text.\" />\r\n  <string key=\"Link.LabelLink\" value=\"Link properties\" />\r\n  <!-- table -->\r\n  <string key=\"Tables.Cell.CellType\" value=\"Cell type\" />\r\n  <string key=\"Tables.Cell.LabelWidth\" value=\"Cell width\" />\r\n  <string key=\"Tables.Cell.HorizontalAlignment\" value=\"Horizontal alignment\" />\r\n  <string key=\"Tables.Cell.VerticalAlignment\" value=\"Vertical alignment\" />\r\n  <string key=\"Tables.Cell.ApplyTo\" value=\"Apply changes to\" />\r\n  <string key=\"Tables.Cell.LabelCellProperties\" value=\"Cell Properties\" />\r\n  <string key=\"Tables.Cell.LabelLayout\" value=\"Layout\" />\r\n  <string key=\"Tables.Cell.LabelDataCell\" value=\"Data Cell\" />\r\n  <string key=\"Tables.Cell.LabelHeaderCell\" value=\"Header Cell\" />\r\n  <string key=\"Tables.Cell.LabelLeft\" value=\"Left\" />\r\n  <string key=\"Tables.Cell.LabelRight\" value=\"Right\" />\r\n  <string key=\"Tables.Cell.LabelTop\" value=\"Top\" />\r\n  <string key=\"Tables.Cell.LabelCenter\" value=\"Center\" />\r\n  <string key=\"Tables.Cell.LabelBottom\" value=\"Bottom\" />\r\n  <string key=\"Tables.Cell.LabelScope\" value=\"Scope\" />\r\n  <string key=\"Tables.Cell.LabelCurrentCell\" value=\"Current cell\" />\r\n  <string key=\"Tables.Cell.LabelAllRowCells\" value=\"All cells in row\" />\r\n  <string key=\"Tables.Cell.LabelAllTableCells\" value=\"All cells in table\" />\r\n  <string key=\"Tables.Merge.Columns\" value=\"Columns\" />\r\n  <string key=\"Tables.Merge.Rows\" value=\"Rows\" />\r\n  <string key=\"Tables.Merge.LabelMergeCells\" value=\"Merge Table Cells\" />\r\n  <string key=\"Tables.Row.Rows\" value=\"Row in table part\" />\r\n  <string key=\"Tables.Row.HorizontalAlignment\" value=\"Horizontal Alignment\" />\r\n  <string key=\"Tables.Row.VerticalAlignment\" value=\"Vertical Alignment\" />\r\n  <string key=\"Tables.Row.ApplyTo\" value=\"Apply changes to\" />\r\n  <string key=\"Tables.Row.LabelRowProperties\" value=\"Row Properties\" />\r\n  <string key=\"Tables.Row.LabelLayout\" value=\"Layout\" />\r\n  <string key=\"Tables.Row.LabelTableHead\" value=\"Table Head\" />\r\n  <string key=\"Tables.Row.LabelTableBody\" value=\"Table Body\" />\r\n  <string key=\"Tables.Row.LabelTableFoot\" value=\"Table Foot\" />\r\n  <string key=\"Tables.Row.LabelLeft\" value=\"Left\" />\r\n  <string key=\"Tables.Row.LabelCenter\" value=\"Center\" />\r\n  <string key=\"Tables.Row.LabelRight\" value=\"Right\" />\r\n  <string key=\"Tables.Row.LabelTop\" value=\"Top\" />\r\n  <string key=\"Tables.Row.LabelBottom\" value=\"Bottom\" />\r\n  <string key=\"Tables.Row.LabelScope\" value=\"Scope\" />\r\n  <string key=\"Tables.Row.LabelCurrentRow\" value=\"Current row\" />\r\n  <string key=\"Tables.Row.LabelOddRows\" value=\"Odd rows in table\" />\r\n  <string key=\"Tables.Row.LabelEvenRows\" value=\"Even rows in table\" />\r\n  <string key=\"Tables.Row.LabelAllRows\" value=\"All rows in table\" />\r\n  <string key=\"Tables.Table.TitleInsert\" value=\"Insert Table\" />\r\n  <string key=\"Tables.Table.TitleUpdate\" value=\"Table Properties\" />\r\n  <string key=\"Tables.Table.Columns\" value=\"Columns\" />\r\n  <string key=\"Tables.Table.Rows\" value=\"Rows\" />\r\n  <string key=\"Tables.Table.Summary\" value=\"Summary\" />\r\n  <string key=\"Tables.Table.SummaryHelp\" value=\"The summary explains the table content and structure so that people using non-visual browsers (such as blind people) may better understand it. This is especially important for tables without captions.\" />\r\n  <string key=\"Tables.Table.LabelLayout\" value=\"Table layout\" />\r\n  <string key=\"Tables.Table.LabelMeta\" value=\"Table description\" />\r\n  <!-- image -->\r\n  <string key=\"Image.Source\" value=\"Source\" />\r\n  <string key=\"Image.AlternativeText\" value=\"Alternate text\" />\r\n  <string key=\"Image.AlternativeTextToolTip\" value=\"The alternate text is displayed as visible text in browsers where images cannot be rendered normally. This may be the case for mobile phone browsers and special browsers for the visually impaired. The alt attribute should clearly describe the content of the image.\" />\r\n  <string key=\"Image.TitleText\" value=\"Title text\" />\r\n  <string key=\"Image.TitleTextToolTip\" value=\"The title text is rendered as a tooltip when the mouse hovers over the image. An image that might be confusing for the viewer can be instantly clarified by a title.\" />\r\n  <string key=\"Image.LabelImage\" value=\"Image properties\" />\r\n  <string key=\"Image.LabelInsertImage\" value=\"Insert Image\" />\r\n  <string key=\"Image.LabelImageProperties\" value=\"Image Properties\" />\r\n  <string key=\"Image.MaxWidth\" value=\"Maximum Width\" />\r\n  <string key=\"Image.MaxWidthToolTip\" value=\"If the width of the image is bigger that the specified value, it will be downsized to the specified value.\" />\r\n  <string key=\"Image.MaxHeight\" value=\"Maximum Height\" />\r\n  <string key=\"Image.MaxHeightToolTip\" value=\"If the height of the image is bigger that the specified value, it will be downsized to the specified value.\" />\r\n\r\n\t<!-- charmap -->\r\n  <string key=\"CharMap.LabelSelectSpecialChar\" value=\"Select Character\" />\r\n  <string key=\"CharMap.LabelGeneral\" value=\"General\" />\r\n  <string key=\"CharMap.LabelAlphabetical\" value=\"Alphabetical\" />\r\n  <string key=\"CharMap.LabelMathSymbols\" value=\"Math &amp; Symbols\" />\r\n  <string key=\"CharMap.LabelCommon\" value=\"Common\" />\r\n  <string key=\"CharMap.LabelQuotation\" value=\"Quotation\" />\r\n  <string key=\"CharMap.LabelCurrency\" value=\"Currency\" />\r\n  <string key=\"CharMap.LabelLatin\" value=\"Latin\" />\r\n  <string key=\"CharMap.LabelGreek\" value=\"Greek\" />\r\n  <string key=\"CharMap.LabelMathAndLogic\" value=\"Math and Logic\" />\r\n  <string key=\"CharMap.LabelSymbols\" value=\"Symbols\" />\r\n  <string key=\"CharMap.LabelArrows\" value=\"Arrows\" />\r\n  <!-- text paste -->\r\n  <string key=\"TextPaste.Label\" value=\"Paste as Text\" />\r\n  <string key=\"TextPaste.PasteHereContent\" value=\"Paste content here. Then press OK.\" />\r\n\r\n  <!-- spellcheck-->\r\n  <string key=\"SpellCheck.InfoLabel\" value=\"How to spell check ...\" />\r\n  <string key=\"SpellCheck.InfoCaption\" value=\"How to spell check in the Visual Editor\" />\r\n  <string key=\"SpellCheck.InfoText\" value=\"To get suggestions for a misspelled word, press your SHIFT key down when you invoke the context menu.\" />\r\n\r\n  <!-- search and replace -->\r\n\t<string key=\"SearchAndReplace.LaunchButton.Label\" value=\"Find and Replace\" />\r\n\t<string key=\"SearchAndReplace.LabelTitle\" value=\"Find and replace\" />\r\n  <string key=\"SearchAndReplace.LabelFind\" value=\"Find\" />\r\n  <string key=\"SearchAndReplace.LabelReplaceWith\" value=\"Replace with\" />\r\n  <string key=\"SearchAndReplace.LabelMatchCase\" value=\"Match case\" />\r\n  <string key=\"SearchAndReplace.LabelWholeWords\" value=\"Whole words\" />\r\n  <string key=\"SearchAndReplace.ButtonFind\" value=\"Find Next\" />\r\n  <string key=\"SearchAndReplace.ButtonReplace\" value=\"Replace\" />\r\n  <string key=\"SearchAndReplace.ButtonReplaceAll\" value=\"Replace all\" />\r\n  <string key=\"SearchAndReplace.NothingFoundMessage\" value=\"nothing was found\" />  \r\n  <string key=\"SearchAndReplace.ItemsWereFoundMessage\" value=\"item(s) found\" />    \r\n  \r\n\r\n  <string key=\"Function.Edit\" value=\"Edit\" />\r\n\r\n  <!-- inline editor button -->\r\n  <string key=\"LaunchButton.Label\" value=\"Edit {0}\" />\r\n\r\n  <!-- Components -->\r\n  <string key=\"Components.LaunchButton.Label\" value=\"Components\" />\r\n  <string key=\"ContextMenu.LabelComponent\" value=\"Component...\" />\r\n  <string key=\"Components.Window.Headline\" value=\"Select a component\" />\r\n  <string key=\"Components.Window.NoItems\" value=\"No selectable components\" />\r\n  <string key=\"Components.Window.DialogFilterPlaceholder\" value=\"Filter...\" />\r\n  <string key=\"Components.Window.Ok\" value=\"OK\" />\r\n  <string key=\"Components.Window.Cancel\" value=\"Cancel\" />\r\n</strings>\r\n"
  },
  {
    "path": "Website/Composite/localization/MimeTypes.en-us.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<strings>\r\n\t<string key=\"image/jpeg\" value=\"JPEG Image\" />\r\n\t<string key=\"image/png\" value=\"PNG Image\" />\r\n\t<string key=\"image/gif\" value=\"GIF Image\" />\r\n\t<string key=\"image/bmp\" value=\"BMP Image\" />\r\n\t<string key=\"image/tiff\" value=\"TIFF Image\" />\r\n\t<string key=\"image/svg+xml\" value=\"SVG Image\" />\r\n\t\r\n\t<string key=\"application/pdf\" value=\"Adobe PDF\" />\r\n\t<string key=\"application/msword\" value=\"Microsoft Word Document\" />\r\n\t<string key=\"application/vnd.ms-excel\" value=\"Microsoft Excel\" />\r\n\t<string key=\"application/vnd.ms-powerpoint\" value=\"Microsoft PowerPoint\" />\r\n\t<string key=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" value=\"Word Document\" />\t\r\n\t<string key=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" value=\"Spreadsheet\" />\r\n\t<string key=\"application/vnd.openxmlformats-officedocument.presentationml.presentation\" value=\"Presentation\" />\r\n\t<string key=\"application/vnd.openxmlformats-officedocument.presentationml.slideshow\" value=\"Presentation (Slideshow)\" />\r\n\t<string key=\"application/x-shockwave-flash\" value=\"Adobe Flash\" />\r\n\t<string key=\"application/zip\" value=\"ZIP Archive\" />\r\n\t<string key=\"application/octet-stream\" value=\"Binary File\" />\r\n\r\n\t<string key=\"video/x-ms-wmv\" value=\"WMV Video\" />\r\n\t<string key=\"video/mp4\" value=\"MP4 Video\" />\r\n\t<string key=\"video/quicktime\" value=\"QuickTime Video\" />\r\n\t<string key=\"audio/mpeg\" value=\"MPEG Audio\" />\r\n\r\n\t<string key=\"text/html\" value=\"HTML\" />\r\n\t<string key=\"text/plain\" value=\"Plain Text\" />\r\n\t<string key=\"text/xml\" value=\"XML\" />\r\n</strings>"
  },
  {
    "path": "Website/Composite/localization/Orckestra.Tools.UrlConfiguration.en-us.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<strings>\n\t<!-- Element tree -->\n\t<string key=\"Tree.ConfigurationElementLabel\" value=\"URL Configuration\" />\n\t<string key=\"Tree.ConfigurationElementToolTip\" value=\"This section allows configuring shorter and friendlier urls\" />\n\t<string key=\"Tree.ConfigurationElementEditLabel\" value=\"Edit URL Configuration\" />\n\t<string key=\"Tree.ConfigurationElementEditToolTip\" value=\"Edit URL Configuration\" />\n\t<string key=\"Tree.HostnamesFolderLabel\" value=\"Hostnames\" />\n\t<string key=\"Tree.HostnamesFolderToolTip\" value=\"Here you can map a hostname to a site\" />\n\t<string key=\"Tree.AddHostnameLabel\" value=\"Add Hostname\" />\n\t<string key=\"Tree.AddHostnameToolTip\" value=\"Add a new hostname mapping\" />\n\t<string key=\"Tree.EditHostnameLabel\" value=\"Edit Hostname\" />\n\t<string key=\"Tree.EditHostnameToolTip\" value=\"Edit this hostname mapping\" />\n\t<string key=\"Tree.DeleteHostnameLabel\" value=\"Delete Hostname\" />\n\t<string key=\"Tree.DeleteHostnameToolTip\" value=\"Delete this hostname mapping\" />\n\t<string key=\"Tree.UrlConfigurationLabel\" value=\"UrlConfiguration\" />\n\n\t<!-- Url configuration -->\n\t<string key=\"UrlConfiguration.Title\" value=\"URL Configuration\" />\n\t<string key=\"UrlConfiguration.PageUrlSuffix.Label\" value=\"Page URL Suffix\" />\n\t<string key=\"UrlConfiguration.PageUrlSuffix.Help\" value=\"A string that will be appended to all page urls. F.e. '.aspx' or '.html', leaving this field empty will produce extensionless urls\" />\n\n\t<!-- Hostname binding editing -->\n\t<string key=\"HostnameBinding.AddNewHostnameTitle\" value=\"New Hostname\" />\n\t<string key=\"HostnameBinding.Hostname.Label\" value=\"Hostname\" />\n\t<string key=\"HostnameBinding.Hostname.Help\" value=\"Hostname to which current url building rules will be applied\" />\n\t<string key=\"HostnameBinding.Page.Label\" value=\"Page\" />\n\t<string key=\"HostnameBinding.Page.Help\" value=\"Root page that will be the default page for the current hostname\" />\n\t<string key=\"HostnameBinding.IncludeHomepageUrlTitle.Label\" value=\"URL\" />\n\t<string key=\"HostnameBinding.IncludeHomepageUrlTitle.ItemLabel\" value=\"Include homepage URL Title\" />\n\t<string key=\"HostnameBinding.IncludeHomepageUrlTitle.Help\" value=\"Determines whether root page's title should be a part of url. Not having it checked produces shorter urls\" />\n\t<string key=\"HostnameBinding.IncludeLanguageUrlMapping.ItemLabel\" value=\"Include language URL mapping\" />\n\t<string key=\"HostnameBinding.IncludeLanguageUrlMapping.Help\" value=\"Determines whether language code should be a part of a url\" />\n\t<string key=\"HostnameBinding.EnforceHttps.ItemLabel\" value=\"Enforce HTTPS\" />\n\t<string key=\"HostnameBinding.EnforceHttps.Help\" value=\"When checked, all the HTTP requests will be redirected to HTTPS links\" />\n\t<string key=\"HostnameBinding.Custom404Page.Label\" value=\"Custom 404 Page\" />\n\t<string key=\"HostnameBinding.Custom404Page.Help\" value=\"Url to which request will be redirected in the case there's a request to non-existent c1 page\" />\n\t<string key=\"HostnameBinding.Aliases.Label\" value=\"Alias hostnames\" />\n\t<string key=\"HostnameBinding.Aliases.Help\" value=\"Hostnames from which all requests will be redirected to the current hostname\" />\n\t<string key=\"HostnameBinding.UsePermanentRedirect.Label\" value=\"Alias Redirect\" />\n\t<string key=\"HostnameBinding.UsePermanentRedirect.ItemLabel\" value=\"Use permanent redirect (HTTP 301)\" />\n\t<string key=\"HostnameBinding.UsePermanentRedirect.Help\" value=\"When redirecting from an alias to the common hostname, a permanent redirect will tell visitors (browsers and search engines) that this redirect should be considered permanent and may be cached. Checking this box has a positive effect on SEO, provided the alias rule do not change in the near future\" />\n</strings>"
  },
  {
    "path": "Website/Composite/login.inc",
    "content": "<div class=\"loginpage\">\n\t<ui:splash id=\"splash\" class=\"splash\">\n\t\t<ui:decks id=\"decks\" flex=\"false\" class=\"splash-inner\">\n\t\t\t<ui:brandsnippet snippetname=\"logo\" />\n\t\t\t<ui:deck id=\"introdeck\"/>\n\t\t\t<ui:deck id=\"logindeck\">\n\t\t\t\t<ui:fields id=\"loginfields\" >\n\t\t\t\t\t<div id=\"loginerror\" class=\"text-error text-sm hide\">\n\t\t\t\t\t\t<ui:text label=\"Username or password incorrect!\"/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ui:field class=\"no-bg\">\n\t\t\t\t\t\t<ui:fielddata>\n\t\t\t\t\t\t\t<ui:labelbox class=\"icon text-primary\" image=\"${icon:user}\"></ui:labelbox>\n\t\t\t\t\t\t\t<ui:datainput name=\"username\" required=\"true\" autoselect=\"true\" placeholder=\"Username\" />\n\t\t\t\t\t\t</ui:fielddata>\n\t\t\t\t\t</ui:field>\n\t\t\t\t\t<ui:field  class=\"no-bg\">\n\t\t\t\t\t\t<ui:fielddata>\n\t\t\t\t\t\t\t<ui:labelbox class=\"icon text-primary\" image=\"${icon:users-changeownpassword}\"></ui:labelbox>\n\t\t\t\t\t\t\t<ui:datainput name=\"password\" password=\"true\" required=\"true\" autoselect=\"true\" placeholder=\"Password\"/>\n\t\t\t\t\t\t</ui:fielddata>\n\t\t\t\t\t</ui:field>\n\t\t\t\t</ui:fields>\n\t\t\t\t<ui:dialogtoolbar>\n\t\t\t\t\t<ui:clickbutton label=\"SIGN IN\" id=\"loginButton\" focusable=\"true\" oncommand=\"KickStart.login()\"/>\n\t\t\t\t</ui:dialogtoolbar>\n\t\t\t</ui:deck>\n\t\t\t<ui:deck id=\"changepassworddeck\" lazy=\"true\">\n\t\t\t\t<div class=\"buzzwords\">\n\t\t\t\t\t<div id=\"passwordexpired\" class=\"text-muted mb-20\">\n\t\t\t\t\t\t<ui:text label=\"${string:Composite.C1Console.Users:ChangePasswordForm.PasswordExpiredMessage}\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<ui:fields id=\"passwordfields\">\n\t\t\t\t\t<div id=\"passworderror\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<ui:field>\n\t\t\t\t\t\t<ui:fielddata>\n\t\t\t\t\t\t\t<ui:labelbox class=\"icon text-primary\" image=\"${icon:user}\"></ui:labelbox>\n\t\t\t\t\t\t\t<ui:datainput name=\"usernameold\" required=\"true\" readonly=\"true\" placeholder=\"${string:Composite.C1Console.Users:ChangePasswordForm.Username}\"/>\n\t\t\t\t\t\t</ui:fielddata>\n\t\t\t\t\t</ui:field>\n\t\t\t\t\t<ui:field>\n\t\t\t\t\t\t<ui:fielddata>\n\t\t\t\t\t\t\t<ui:labelbox class=\"icon text-primary\" image=\"${icon:users-changeownpassword}\" title=\"Old Password\"></ui:labelbox>\n\t\t\t\t\t\t\t<ui:datainput name=\"passwordold\" password=\"true\" required=\"true\" autoselect=\"true\" placeholder=\"${string:Composite.C1Console.Users:ChangePasswordForm.OldPassword}\"/>\n\t\t\t\t\t\t</ui:fielddata>\n\t\t\t\t\t</ui:field>\n\t\t\t\t\t<ui:field>\n\t\t\t\t\t\t<ui:fielddata>\n\t\t\t\t\t\t\t<ui:labelbox class=\"icon text-primary\" image=\"${icon:users-changeownpassword}\" title=\"New Password\"></ui:labelbox>\n\t\t\t\t\t\t\t<ui:datainput name=\"passwordnew\" password=\"true\" required=\"true\" autoselect=\"true\" placeholder=\"${string:Composite.C1Console.Users:ChangePasswordForm.NewPassword}\"/>\n\t\t\t\t\t\t</ui:fielddata>\n\t\t\t\t\t</ui:field>\n\t\t\t\t\t<ui:field>\n\t\t\t\t\t\t<ui:fielddata>\n\t\t\t\t\t\t\t<ui:labelbox class=\"icon text-primary\" image=\"${icon:users-changeownpassword}\" title=\"Confirm Password\"></ui:labelbox>\n\t\t\t\t\t\t\t<ui:datainput name=\"passwordnew2\" password=\"true\" required=\"true\" autoselect=\"true\" placeholder=\"${string:Composite.C1Console.Users:ChangePasswordForm.ConfirmPassword}\"/>\n\t\t\t\t\t\t</ui:fielddata>\n\t\t\t\t\t</ui:field>\n\t\t\t\t</ui:fields>\n\t\t\t\t<ui:dialogtoolbar>\n\t\t\t\t\t<ui:clickbutton label=\"${string:Composite.C1Console.Users:ChangePasswordForm.ChangePasswordButton}\" focusable=\"true\" oncommand=\"KickStart.changePassword()\"/>\n\t\t\t\t</ui:dialogtoolbar>\n\t\t\t</ui:deck>\n\t\t\t<ui:deck id=\"loadingdeck\" class=\"loading-deck\">\n\t\t\t\t<div class=\"progress\">\n\t\t\t\t\t<p class=\"progressbar-msg\">\n\t\t\t\t\t\tDepending on your internet connection speed, <span class=\"js-applicationname\"></span> may take a few moments to load.\n\t\t\t\t\t</p>\n\t\t\t\t\t<div id=\"progressbar\" class=\"progressbar\">\n\t\t\t\t\t\tInitializing <span class=\"js-applicationname\"></span>\n\t\t\t\t\t\t<ui:progressbar/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</ui:deck>\n\t\t\t<ui:deck id=\"shutdowndeck\">\n\t\t\t\t<p>Shutting down...</p>\n\t\t\t</ui:deck>\n\t\t\t<ui:brandsnippet snippetname=\"company-logo\" />\n\t\t</ui:decks>\n\t</ui:splash>\n</div>\n"
  },
  {
    "path": "Website/Composite/ping.ashx",
    "content": "<%@ WebHandler Language=\"C#\" Class=\"PingTester\" %>\r\nusing System;\r\nusing System.Net;\r\nusing System.Web;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient.Setup;\r\nusing Composite.C1Console.Users;\r\n\r\npublic class PingTester : IHttpHandler\r\n{\r\n    public void ProcessRequest(HttpContext context)\r\n    {\r\n        context.Response.ContentType = \"text/plain\";\r\n        \r\n        if (SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n        {\r\n            try\r\n            {\r\n                if (string.IsNullOrEmpty(UserSettings.Username))\r\n                {\r\n                    context.Response.Write(\"Log in to use this feature\\n\");\r\n                    return;\r\n                }\r\n            }\r\n            catch (Exception)\r\n            {\r\n                context.Response.Write(\"Log in to use this feature\\n\");\r\n                return;\r\n            }\r\n            \r\n            context.Response.Write(\"This C1 CMS site has been initialized (info)\\n\\n\");\r\n        }\r\n\r\n        IPHostEntry packageServerAddress;\r\n\r\n        const string packageServerHostName = \"package.composite.net\";\r\n        \r\n        try\r\n        {\r\n            packageServerAddress = Dns.GetHostEntry(packageServerHostName);\r\n        }\r\n        catch (Exception ex)\r\n        {\r\n            context.Response.Write(\"Failed to resolve IP address of '{0}'\\n\".FormatWith(packageServerHostName) + ex);\r\n            return;\r\n        }\r\n\r\n        context.Response.Write(\"IP address{0}: \".FormatWith(packageServerAddress.AddressList.Length > 1 ? \"es\" : string.Empty));\r\n        foreach(var address in packageServerAddress.AddressList)\r\n        {\r\n            context.Response.Write(address + \"; \");\r\n        }\r\n        \r\n        context.Response.Write(\"\\n\");\r\n\r\n        bool pingSuccessful;\r\n        \r\n        try\r\n        {\r\n            // This is expected to return either 'true' or throw an exception\r\n            pingSuccessful = SetupServiceFacade.PingServer();\r\n        }\r\n        catch(Exception ex)\r\n        {\r\n            context.Response.Write(ex.ToString());\r\n            return;\r\n        }\r\n        \r\n        context.Response.Write(\"Ping result: \" + pingSuccessful);\r\n    }\r\n\r\n    public bool IsReusable\r\n    {\r\n        get\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/postback.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n    \r\n<%@ Page Language=\"C#\" %>\r\n<%\r\n\tResponse.Cache.SetExpires(DateTime.Now.AddHours(1));\r\n\tResponse.Cache.SetCacheability(HttpCacheability.Private);\r\n%>\r\n\r\n\t<control:httpheaders runat=\"server\"/>\r\n\t<head>\r\n\t\t<!-- dont change this title! -->\r\n\t\t<title>Composite.Management.DefaultPostBack</title>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"postback.css\"/>\r\n\t\t<control:scriptloader type=\"sub\" runat=\"server\"/>\r\n\t\t<script type=\"text/javascript\" src=\"postback.js\"></script>\r\n\t</head>\r\n\t<body> \r\n\t\t<form action=\"javascript:void(false);\" method=\"post\" target=\"_self\"/>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/postback.css",
    "content": "html,\r\nbody {\r\n\tbackground-color: $(color:threedface);\r\n\tborder: none;\r\n\tpadding: 0;\r\n\tmargin: 0;\r\n}\r\nform {\r\n\tvisibility: hidden;\r\n}"
  },
  {
    "path": "Website/Composite/postback.js",
    "content": "/**\r\n * Inspectors can recognize the postback document by looking for this global boolean.\r\n * @type {boolean}\r\n */\r\nwindow.isPostBackDocument = true;\r\n\r\n/**\r\n * Track postback map.\r\n * @type {List<object>} \r\n */\r\nwindow.postBackList = null;\r\n\r\n/**\r\n * Track postback URL.\r\n * @type {string} \r\n */\r\nwindow.postBackURL = null;\r\n\r\n\r\n/**\r\n * Populate form and submit to specified url. Note that we use a List instead \r\n * of a Map, which may sound more appealing, because server could expect multiple \r\n * fields with same name but different value; as may be the case for checkboxes.\r\n * @param {List<object>} map\r\n * @param {string} url\r\n */\r\nfunction submit ( list, url ) {\r\n\t\r\n\tif ( !list instanceof List ) {\r\n\t\talert ( \"POSTBACK.JS REFACTORED!\" );\r\n\t}\r\n\t\r\n\tvar form = document.forms [ 0 ];\r\n\tform.action = top.Resolver.resolve ( url );\r\n\tvar debug = \"Posting to: \" + form.action +\"\\n\\n\";\r\n\r\n\tlist.each(function (object) {\r\n\t\tif (object.value != null && object.value.indexOf('\\n') > -1) {\r\n\t\t\tvar textarea = document.createElement(\"textarea\");\r\n\t\t\ttextarea.name = object.name;\r\n\t\t\ttextarea.value = object.value;\r\n\r\n\t\t\tform.appendChild(textarea);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tvar input = document.createElement(\"input\");\r\n\t\t\tinput.name = object.name;\r\n\t\t\tinput.value = object.value;\r\n\r\n\t\t\t// DELETE THIS NOW???\r\n\t\t\tinput.setAttribute(\"name\", new String(object.name)); // FF4.0 beta bug!!!\r\n\t\t\tinput.setAttribute(\"value\", new String(object.value)); // FF4.0 beta bug!!!\r\n\r\n\t\t\tform.appendChild(input);\r\n\t\t}\r\n\t\tdebug += object.name + \": \" + object.value + \"\\n\";\r\n\t});\r\n\t\r\n\t/*\r\n\t * Debug form post.\r\n\t */\r\n\ttop.SystemLogger.getLogger ( document.title ).debug ( debug );\r\n\t\r\n\t/*\r\n\t * You can read these on window.unload in case you need to resubmit the data. \r\n\t */\r\n\twindow.postBackList = list;\r\n\twindow.postBackURL = url;\r\n\t\r\n\t/*\r\n\t * Submit the form. Because other parties may have an interest in our local \r\n\t * window.load event, we submit on a short timeout. Otherwise this document  \r\n\t * may cease to exist before they get a chance to handle it...\r\n\t */\r\n// maw: sry, but this was too annoying :)\r\n//\talert ( form.method )\r\n\tsetTimeout ( function () {\r\n\t\ttop.Application.logger.debug ( DOMSerializer.serialize ( document.documentElement, true ));\r\n\t\tform.submit ();\r\n\t}, 100 );\r\n}"
  },
  {
    "path": "Website/Composite/schemas/FormsControls/AspNetManagement__www_composite_net_ns_management_bindingforms_internal_ui_controls_lib_1_0.xsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" targetNamespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" xmlns=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" elementFormDefault=\"qualified\">\r\n  <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\r\n  <xsd:import namespace=\"http://www.composite.net/ns/management/bindingforms/1.0\" schemaLocation=\"bindingforms10.xsd\" />\r\n  <xsd:element name=\"TypeFieldDesigner\" type=\"TypeFieldDesigner\" />\r\n  <xsd:element name=\"Debug\" type=\"Debug\" />\r\n  <xsd:element name=\"DocumentBody\" type=\"DocumentBody\" />\r\n  <xsd:element name=\"FinishButton\" type=\"FinishButton\" />\r\n  <xsd:element name=\"OkButton\" type=\"OkButton\" />\r\n  <xsd:element name=\"FunctionCallsDesigner\" type=\"FunctionCallsDesigner\" />\r\n  <xsd:element name=\"ParameterDesigner\" type=\"ParameterDesigner\" />\r\n  <xsd:element name=\"NextButton\" type=\"NextButton\" />\r\n  <xsd:element name=\"PreviousButton\" type=\"PreviousButton\" />\r\n  <xsd:element name=\"SaveAsButton\" type=\"SaveAsButton\" />\r\n  <xsd:element name=\"SaveButton\" type=\"SaveButton\" />\r\n  <xsd:element name=\"Toolbar\" type=\"Toolbar\" />\r\n  <xsd:element name=\"DialogCanvas\" type=\"DialogCanvas\" />\r\n  <xsd:element name=\"ConfirmDialogCanvas\" type=\"ConfirmDialogCanvas\" />\r\n  <xsd:element name=\"DialogToolbar\" type=\"DialogToolbar\" />\r\n  <xsd:element name=\"CancelButton\" type=\"CancelButton\" />\r\n  <xsd:element name=\"WizardCancelButton\" type=\"WizardCancelButton\" />\r\n  <xsd:element name=\"EmbeddedForm\" type=\"EmbeddedForm\" />\r\n  <xsd:element name=\"PreviewPanel\" type=\"PreviewPanel\" />\r\n  <xsd:element name=\"PageContentEditor\" type=\"PageContentEditor\" />\r\n  <xsd:group name=\"ElementList\">\r\n    <xsd:sequence>\r\n      <xsd:choice minOccurs=\"0\">\r\n        <xsd:element name=\"TypeFieldDesigner\" type=\"TypeFieldDesigner\" />\r\n        <xsd:element name=\"Debug\" type=\"Debug\" />\r\n        <xsd:element name=\"DocumentBody\" type=\"DocumentBody\" />\r\n        <xsd:element name=\"FinishButton\" type=\"FinishButton\" />\r\n        <xsd:element name=\"OkButton\" type=\"OkButton\" />\r\n        <xsd:element name=\"FunctionCallsDesigner\" type=\"FunctionCallsDesigner\" />\r\n        <xsd:element name=\"ParameterDesigner\" type=\"ParameterDesigner\" />\r\n        <xsd:element name=\"NextButton\" type=\"NextButton\" />\r\n        <xsd:element name=\"PreviousButton\" type=\"PreviousButton\" />\r\n        <xsd:element name=\"SaveAsButton\" type=\"SaveAsButton\" />\r\n        <xsd:element name=\"SaveButton\" type=\"SaveButton\" />\r\n        <xsd:element name=\"Toolbar\" type=\"Toolbar\" />\r\n        <xsd:element name=\"DialogCanvas\" type=\"DialogCanvas\" />\r\n        <xsd:element name=\"ConfirmDialogCanvas\" type=\"ConfirmDialogCanvas\" />\r\n        <xsd:element name=\"DialogToolbar\" type=\"DialogToolbar\" />\r\n        <xsd:element name=\"CancelButton\" type=\"CancelButton\" />\r\n        <xsd:element name=\"WizardCancelButton\" type=\"WizardCancelButton\" />\r\n        <xsd:element name=\"EmbeddedForm\" type=\"EmbeddedForm\" />\r\n        <xsd:element name=\"PreviewPanel\" type=\"PreviewPanel\" />\r\n        <xsd:element name=\"PageContentEditor\" type=\"PageContentEditor\" />\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n  </xsd:group>\r\n  <xsd:complexType name=\"TypeFieldDesigner\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"TypeFieldDesigner.Fields\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeFieldDesigner.LabelFieldName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeFieldDesigner.KeyFieldReadOnly\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeFieldDesigner.KeyFieldName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeFieldDesigner.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeFieldDesigner.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Fields\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"LabelFieldName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"KeyFieldReadOnly\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"KeyFieldName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"Debug\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"Debug.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"Debug.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"DocumentBody\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"DocumentBody.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DocumentBody.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"FinishButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"FinishButton.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FinishButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FinishButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"OkButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"OkButton.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"OkButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"OkButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"FunctionCallsDesigner\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"FunctionCallsDesigner.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FunctionCallsDesigner.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"ParameterDesigner\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"ParameterDesigner.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ParameterDesigner.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"NextButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"NextButton.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"NextButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"NextButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"PreviousButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"PreviousButton.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PreviousButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PreviousButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"SaveAsButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"SaveAsButton.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SaveAsButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SaveAsButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"SaveButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"SaveButton.SaveEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SaveButton.SaveAndPublishEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SaveButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SaveButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"SaveEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"SaveAndPublishEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"Toolbar\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"Toolbar.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"Toolbar.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"DialogCanvas\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"DialogCanvas.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DialogCanvas.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"ConfirmDialogCanvas\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"ConfirmDialogCanvas.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ConfirmDialogCanvas.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"DialogToolbar\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"DialogToolbar.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DialogToolbar.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"CancelButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"CancelButton.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"CancelButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"CancelButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"WizardCancelButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"WizardCancelButton.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"WizardCancelButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"WizardCancelButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"EmbeddedForm\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"EmbeddedForm.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"PreviewPanel\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"PreviewPanel.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PreviewPanel.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PreviewPanel.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"PageContentEditor\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"PageContentEditor.PageId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageContentEditor.TemplateId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageContentEditor.SelectableTemplateIds\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageContentEditor.NamedXhtmlFragments\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageContentEditor.ClassConfigurationName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageContentEditor.ContainerClasses\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageContentEditor.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageContentEditor.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"PageId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"TemplateId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"NamedXhtmlFragments\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClassConfigurationName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ContainerClasses\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n</xsd:schema>"
  },
  {
    "path": "Website/Composite/schemas/FormsControls/AspNetManagement__www_composite_net_ns_management_bindingforms_std_ui_controls_lib_1_0.xsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" targetNamespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" elementFormDefault=\"qualified\">\r\n  <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\r\n  <xsd:import namespace=\"http://www.composite.net/ns/management/bindingforms/1.0\" schemaLocation=\"bindingforms10.xsd\" />\r\n  <xsd:element name=\"ToolbarButton\" type=\"ToolbarButton\" />\r\n  <xsd:element name=\"DateSelector\" type=\"DateSelector\" />\r\n  <xsd:element name=\"DateTimeSelector\" type=\"DateTimeSelector\" />\r\n  <xsd:element name=\"CheckBox\" type=\"CheckBox\" />\r\n  <xsd:element name=\"BoolSelector\" type=\"BoolSelector\" />\r\n  <xsd:element name=\"DataReferenceSelector\" type=\"DataReferenceSelector\" />\r\n  <xsd:element name=\"EnumSelector\" type=\"EnumSelector\" />\r\n  <xsd:element name=\"PlaceHolder\" type=\"PlaceHolder\" />\r\n  <xsd:element name=\"InfoBox\" type=\"InfoBox\" />\r\n  <xsd:element name=\"FileUpload\" type=\"FileUpload\" />\r\n  <xsd:element name=\"KeySelector\" type=\"KeySelector\" />\r\n  <xsd:element name=\"ComboBox\" type=\"ComboBox\" />\r\n  <xsd:element name=\"DoubleKeySelector\" type=\"DoubleKeySelector\" />\r\n  <xsd:element name=\"PageSelector\" type=\"PageSelector\" />\r\n  <xsd:element name=\"UrlComboBox\" type=\"UrlComboBox\" />\r\n  <xsd:element name=\"DataReferenceTreeSelector\" type=\"DataReferenceTreeSelector\" />\r\n  <xsd:element name=\"MultiKeySelector\" type=\"MultiKeySelector\" />\r\n  <xsd:element name=\"MarkupEditor\" type=\"MarkupEditor\" />\r\n  <xsd:element name=\"XsltEditor\" type=\"XsltEditor\" />\r\n  <xsd:element name=\"FieldGroup\" type=\"FieldGroup\" />\r\n  <xsd:element name=\"SqlEditor\" type=\"SqlEditor\" />\r\n  <xsd:element name=\"TabPanels\" type=\"TabPanels\" />\r\n  <xsd:element name=\"Heading\" type=\"Heading\" />\r\n  <xsd:element name=\"Text\" type=\"Text\" />\r\n  <xsd:element name=\"HtmlBlob\" type=\"HtmlBlob\" />\r\n  <xsd:element name=\"LongText\" type=\"LongText\" />\r\n  <xsd:element name=\"InfoTable\" type=\"InfoTable\" />\r\n  <xsd:element name=\"TextArea\" type=\"TextArea\" />\r\n  <xsd:element name=\"TextBox\" type=\"TextBox\" />\r\n  <xsd:element name=\"TextEditor\" type=\"TextEditor\" />\r\n  <xsd:element name=\"TypeSelector\" type=\"TypeSelector\" />\r\n  <xsd:element name=\"XhtmlEditor\" type=\"XhtmlEditor\" />\r\n  <xsd:element name=\"MultiContentXhtmlEditor\" type=\"MultiContentXhtmlEditor\" />\r\n  <xsd:element name=\"InlineXhtmlEditor\" type=\"InlineXhtmlEditor\" />\r\n  <xsd:element name=\"FontIconSelector\" type=\"FontIconSelector\" />\r\n  <xsd:element name=\"SvgIconSelector\" type=\"SvgIconSelector\" />\r\n  <xsd:element name=\"ConsoleIconSelector\" type=\"ConsoleIconSelector\" />\r\n  <xsd:element name=\"HierarchicalSelector\" type=\"HierarchicalSelector\" />\r\n  <xsd:group name=\"ElementList\">\r\n    <xsd:sequence>\r\n      <xsd:choice minOccurs=\"0\">\r\n        <xsd:element name=\"ToolbarButton\" type=\"ToolbarButton\" />\r\n        <xsd:element name=\"DateSelector\" type=\"DateSelector\" />\r\n        <xsd:element name=\"DateTimeSelector\" type=\"DateTimeSelector\" />\r\n        <xsd:element name=\"CheckBox\" type=\"CheckBox\" />\r\n        <xsd:element name=\"BoolSelector\" type=\"BoolSelector\" />\r\n        <xsd:element name=\"DataReferenceSelector\" type=\"DataReferenceSelector\" />\r\n        <xsd:element name=\"EnumSelector\" type=\"EnumSelector\" />\r\n        <xsd:element name=\"PlaceHolder\" type=\"PlaceHolder\" />\r\n        <xsd:element name=\"InfoBox\" type=\"InfoBox\" />\r\n        <xsd:element name=\"FileUpload\" type=\"FileUpload\" />\r\n        <xsd:element name=\"KeySelector\" type=\"KeySelector\" />\r\n        <xsd:element name=\"ComboBox\" type=\"ComboBox\" />\r\n        <xsd:element name=\"DoubleKeySelector\" type=\"DoubleKeySelector\" />\r\n        <xsd:element name=\"PageSelector\" type=\"PageSelector\" />\r\n        <xsd:element name=\"UrlComboBox\" type=\"UrlComboBox\" />\r\n        <xsd:element name=\"DataReferenceTreeSelector\" type=\"DataReferenceTreeSelector\" />\r\n        <xsd:element name=\"MultiKeySelector\" type=\"MultiKeySelector\" />\r\n        <xsd:element name=\"MarkupEditor\" type=\"MarkupEditor\" />\r\n        <xsd:element name=\"XsltEditor\" type=\"XsltEditor\" />\r\n        <xsd:element name=\"FieldGroup\" type=\"FieldGroup\" />\r\n        <xsd:element name=\"SqlEditor\" type=\"SqlEditor\" />\r\n        <xsd:element name=\"TabPanels\" type=\"TabPanels\" />\r\n        <xsd:element name=\"Heading\" type=\"Heading\" />\r\n        <xsd:element name=\"Text\" type=\"Text\" />\r\n        <xsd:element name=\"HtmlBlob\" type=\"HtmlBlob\" />\r\n        <xsd:element name=\"LongText\" type=\"LongText\" />\r\n        <xsd:element name=\"InfoTable\" type=\"InfoTable\" />\r\n        <xsd:element name=\"TextArea\" type=\"TextArea\" />\r\n        <xsd:element name=\"TextBox\" type=\"TextBox\" />\r\n        <xsd:element name=\"TextEditor\" type=\"TextEditor\" />\r\n        <xsd:element name=\"TypeSelector\" type=\"TypeSelector\" />\r\n        <xsd:element name=\"XhtmlEditor\" type=\"XhtmlEditor\" />\r\n        <xsd:element name=\"MultiContentXhtmlEditor\" type=\"MultiContentXhtmlEditor\" />\r\n        <xsd:element name=\"InlineXhtmlEditor\" type=\"InlineXhtmlEditor\" />\r\n        <xsd:element name=\"FontIconSelector\" type=\"FontIconSelector\" />\r\n        <xsd:element name=\"SvgIconSelector\" type=\"SvgIconSelector\" />\r\n        <xsd:element name=\"ConsoleIconSelector\" type=\"ConsoleIconSelector\" />\r\n        <xsd:element name=\"HierarchicalSelector\" type=\"HierarchicalSelector\" />\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n  </xsd:group>\r\n  <xsd:complexType name=\"ToolbarButton\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"ToolbarButton.IconHandle\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ToolbarButton.DisabledIconHandle\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ToolbarButton.IsDisabled\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ToolbarButton.LaunchUrl\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ToolbarButton.SaveBehaviour\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ToolbarButton.ClickEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ToolbarButton.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ToolbarButton.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"IconHandle\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"DisabledIconHandle\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"IsDisabled\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"LaunchUrl\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"SaveBehaviour\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClickEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"DateSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"DateSelector.Date\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DateSelector.ReadOnly\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DateSelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DateSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DateSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Date\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ReadOnly\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"DateTimeSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"DateTimeSelector.Date\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DateTimeSelector.ReadOnly\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DateTimeSelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DateTimeSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DateTimeSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Date\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ReadOnly\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"CheckBox\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"CheckBox.Checked\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"CheckBox.ItemLabel\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"CheckBox.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"CheckBox.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Checked\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"ItemLabel\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"BoolSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"BoolSelector.IsTrue\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"BoolSelector.TrueLabel\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"BoolSelector.FalseLabel\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"BoolSelector.SelectionChangedEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"BoolSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"BoolSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"IsTrue\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"TrueLabel\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"FalseLabel\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"SelectionChangedEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"DataReferenceSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"DataReferenceSelector.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceSelector.DataType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"DataType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"EnumSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"EnumSelector.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"EnumSelector.EnumType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"EnumSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"EnumSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"EnumType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"PlaceHolder\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"PlaceHolder.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PlaceHolder.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"InfoBox\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"InfoBox.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InfoBox.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"FileUpload\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"FileUpload.UploadedFile\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FileUpload.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FileUpload.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"UploadedFile\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"KeySelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"KeySelector.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.Options\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.OptionsKeyField\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.OptionsLabelField\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.BindingType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.ReadOnly\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.SelectedIndexChangedEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"KeySelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Options\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"OptionsKeyField\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"OptionsLabelField\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"BindingType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"ReadOnly\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"SelectedIndexChangedEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"ComboBox\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"ComboBox.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.Options\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.OptionsKeyField\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.OptionsLabelField\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.BindingType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.ReadOnly\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.SelectedIndexChangedEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ComboBox.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Options\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"OptionsKeyField\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"OptionsLabelField\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"BindingType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"ReadOnly\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"SelectedIndexChangedEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"DoubleKeySelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"DoubleKeySelector.Options\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DoubleKeySelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DoubleKeySelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DoubleKeySelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Options\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"PageSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"PageSelector.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"PageSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"UrlComboBox\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"UrlComboBox.Text\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"UrlComboBox.Type\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"UrlComboBox.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"UrlComboBox.SpellCheck\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"UrlComboBox.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"UrlComboBox.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Text\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Type\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"SpellCheck\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"DataReferenceTreeSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"DataReferenceTreeSelector.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceTreeSelector.Handle\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceTreeSelector.RootEntityToken\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceTreeSelector.SearchToken\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceTreeSelector.DataType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceTreeSelector.NullValueAllowed\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceTreeSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"DataReferenceTreeSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Handle\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"RootEntityToken\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"SearchToken\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"DataType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"NullValueAllowed\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"MultiKeySelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"MultiKeySelector.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.SelectedAsString\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.CompactMode\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.Options\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.OptionsKeyField\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.OptionsLabelField\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.BindingType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.ReadOnly\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.SelectedIndexChangedEventHandler\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiKeySelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"SelectedAsString\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"CompactMode\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Options\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"OptionsKeyField\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"OptionsLabelField\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"BindingType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"ReadOnly\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"SelectedIndexChangedEventHandler\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"MarkupEditor\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"MarkupEditor.Xhtml\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MarkupEditor.ClassConfigurationName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MarkupEditor.ContainerClasses\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MarkupEditor.EmbedableFieldsTypes\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MarkupEditor.PreviewPageId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MarkupEditor.PreviewTemplateId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MarkupEditor.PreviewPlaceholder\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MarkupEditor.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MarkupEditor.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Xhtml\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClassConfigurationName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ContainerClasses\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"EmbedableFieldsTypes\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewPageId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewTemplateId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewPlaceholder\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"XsltEditor\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"XsltEditor.Xhtml\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XsltEditor.ClassConfigurationName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XsltEditor.ContainerClasses\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XsltEditor.EmbedableFieldsTypes\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XsltEditor.PreviewPageId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XsltEditor.PreviewTemplateId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XsltEditor.PreviewPlaceholder\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XsltEditor.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XsltEditor.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Xhtml\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClassConfigurationName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ContainerClasses\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"EmbedableFieldsTypes\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewPageId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewTemplateId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewPlaceholder\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"FieldGroup\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"FieldGroup.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FieldGroup.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"SqlEditor\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"SqlEditor.Text\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SqlEditor.MimeType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SqlEditor.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SqlEditor.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Text\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"MimeType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"TabPanels\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"TabPanels.PreSelectedIndex\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TabPanels.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TabPanels.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"PreSelectedIndex\" type=\"xsd:int\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"Heading\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"Heading.Title\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"Heading.Description\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"Heading.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"Heading.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Title\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Description\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"Text\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"Text.Text\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"Text.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"Text.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Text\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"HtmlBlob\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"HtmlBlob.Html\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"HtmlBlob.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"HtmlBlob.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Html\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"LongText\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"LongText.Text\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"LongText.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"LongText.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Text\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"InfoTable\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"InfoTable.Headers\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InfoTable.Rows\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InfoTable.Caption\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InfoTable.Border\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InfoTable.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InfoTable.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Caption\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Border\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"TextArea\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"TextArea.Text\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextArea.Type\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextArea.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextArea.SpellCheck\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextArea.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextArea.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Text\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Type\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"SpellCheck\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"TextBox\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"TextBox.Text\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextBox.Type\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextBox.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextBox.SpellCheck\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextBox.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextBox.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Text\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Type\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"SpellCheck\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"TextEditor\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"TextEditor.Text\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextEditor.MimeType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextEditor.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TextEditor.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Text\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"MimeType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"TypeSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"TypeSelector.SelectedType\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeSelector.TypeOptions\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeSelector.AssignableTo\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeSelector.Mode\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"TypeSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"SelectedType\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"TypeOptions\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"AssignableTo\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Mode\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"XhtmlEditor\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"XhtmlEditor.Xhtml\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XhtmlEditor.ClassConfigurationName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XhtmlEditor.ContainerClasses\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XhtmlEditor.EmbedableFieldsTypes\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XhtmlEditor.PreviewPageId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XhtmlEditor.PreviewTemplateId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XhtmlEditor.PreviewPlaceholder\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XhtmlEditor.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"XhtmlEditor.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Xhtml\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClassConfigurationName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ContainerClasses\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"EmbedableFieldsTypes\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewPageId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewTemplateId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewPlaceholder\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"MultiContentXhtmlEditor\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"MultiContentXhtmlEditor.PlaceholderDefinitions\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiContentXhtmlEditor.PlaceholderContainerClasses\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiContentXhtmlEditor.DefaultPlaceholderId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiContentXhtmlEditor.NamedXhtmlFragments\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiContentXhtmlEditor.ClassConfigurationName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiContentXhtmlEditor.EmbedableFieldsTypes\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiContentXhtmlEditor.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"MultiContentXhtmlEditor.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"PlaceholderDefinitions\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PlaceholderContainerClasses\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"DefaultPlaceholderId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"NamedXhtmlFragments\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClassConfigurationName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"EmbedableFieldsTypes\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"InlineXhtmlEditor\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"InlineXhtmlEditor.Xhtml\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InlineXhtmlEditor.ClassConfigurationName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InlineXhtmlEditor.ContainerClasses\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InlineXhtmlEditor.EmbedableFieldsTypes\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InlineXhtmlEditor.PreviewPageId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InlineXhtmlEditor.PreviewTemplateId\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InlineXhtmlEditor.PreviewPlaceholder\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InlineXhtmlEditor.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"InlineXhtmlEditor.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Xhtml\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClassConfigurationName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ContainerClasses\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"EmbedableFieldsTypes\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewPageId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewTemplateId\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"PreviewPlaceholder\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"FontIconSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"FontIconSelector.SelectedClassName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FontIconSelector.ClassNameOptions\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FontIconSelector.StylesheetPath\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FontIconSelector.ClassNamePrefix\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FontIconSelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FontIconSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"FontIconSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"SelectedClassName\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClassNameOptions\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"StylesheetPath\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"ClassNamePrefix\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"SvgIconSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"SvgIconSelector.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SvgIconSelector.SvgSpritePath\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SvgIconSelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SvgIconSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"SvgIconSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"SvgSpritePath\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"ConsoleIconSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"ConsoleIconSelector.Selected\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ConsoleIconSelector.SvgSpritePath\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ConsoleIconSelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ConsoleIconSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"ConsoleIconSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Selected\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"SvgSpritePath\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"HierarchicalSelector\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"HierarchicalSelector.SelectedKeys\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"HierarchicalSelector.TreeNodes\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"HierarchicalSelector.AutoSelectChildren\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"HierarchicalSelector.Required\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"HierarchicalSelector.Label\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"HierarchicalSelector.Help\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"SelectedKeys\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"TreeNodes\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"AutoSelectChildren\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Required\" type=\"xsd:boolean\" use=\"optional\" />\r\n    <xsd:attribute name=\"Label\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Help\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n</xsd:schema>"
  },
  {
    "path": "Website/Composite/schemas/FormsControls/GenerateDynamicSchemas.aspx",
    "content": "﻿<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"GenerateDynamicSchemas.aspx.cs\"\r\n    Inherits=\"Composite_schemas_FormsControls_GenerateDynamicSchemas\" %>\r\n\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head runat=\"server\">\r\n    <title>C1 CMS Form UI Schemas</title>\r\n</head>\r\n<body>\r\n    <form id=\"form1\" runat=\"server\">\r\n    <asp:PlaceHolder ID=\"XsdTable\" runat=\"server\"></asp:PlaceHolder>\r\n    <hr />\r\n    <div>\r\n        <asp:Button Text=\"Re-generate all Form UI schemas\" ID=\"GenerateButton\" runat=\"server\" />\r\n    </div>\r\n    </form>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/schemas/FormsControls/GenerateDynamicSchemas.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Web.UI;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Forms;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Xml;\r\n\r\n\r\npublic partial class Composite_schemas_FormsControls_GenerateDynamicSchemas : System.Web.UI.Page\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        var xsdFiles = C1Directory.GetFiles(this.MapPath(\"\"), \"*.xsd\");\r\n\r\n        XElement xsdFilesTable = new XElement(\"table\",\r\n            new XElement(\"tr\",\r\n                new XElement(\"td\", \"Namespace\"),\r\n                new XElement(\"td\", \"Last generated\")));\r\n\r\n        foreach( string xsdFile in xsdFiles)\r\n        {\r\n            DateTime lastWrite = C1File.GetLastWriteTime(xsdFile);\r\n\r\n            XDocument schemaDocument = XDocumentUtils.Load(xsdFile);\r\n            string targetNamespace = schemaDocument.Root.Attribute(\"targetNamespace\").Value;\r\n\r\n            xsdFilesTable.Add(\r\n                new XElement(\"tr\",\r\n                    new XElement(\"td\", \r\n                        new XElement(\"a\",\r\n                            new XAttribute(\"href\", Path.GetFileName(xsdFile)),\r\n                            targetNamespace)),\r\n                    new XElement(\"td\", lastWrite)));\r\n        }\r\n\r\n        XsdTable.Controls.Add( new LiteralControl(xsdFilesTable.ToString()));\r\n\r\n        GenerateButton.Click += new EventHandler(GenerateButton_Click);\r\n        \r\n    }\r\n\r\n    void GenerateButton_Click(object sender, EventArgs e)\r\n    {\r\n        IEnumerable<SchemaInfo> schemaInfos = SchemaBuilder.GenerateAllDynamicSchemas();\r\n\r\n        foreach (SchemaInfo schemaInfo in schemaInfos)\r\n        {\r\n            XDocumentUtils.Save(schemaInfo.Schema, this.MapPath(BuildFileName(schemaInfo)));\r\n        }\r\n\r\n        GenerateButton.Text = \"Done\";\r\n    }\r\n\r\n\r\n    private string BuildFileName(SchemaInfo schemaInfo)\r\n    {\r\n        StringBuilder sb = new StringBuilder( schemaInfo.Namespace.NamespaceName );\r\n\r\n        sb.Replace(\"http://\", \"\");\r\n        sb.Replace(\"/\", \"_\");\r\n        sb.Replace(\".\", \"_\");\r\n\r\n        if (schemaInfo.SchemaType == SchemaInfo.FormSchemaType.Uicontrols)\r\n        {\r\n            return string.Format(\"{0}__{1}.xsd\", schemaInfo.ChannelIdentifier.ChannelName.Replace(\".\", \"\"), sb);\r\n        }\r\n        else\r\n        {\r\n            return string.Format(\"functions__{0}.xsd\",  sb);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/schemas/FormsControls/GenerateDynamicSchemas.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_schemas_FormsControls_GenerateDynamicSchemas {\r\n    \r\n    /// <summary>\r\n    /// form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm form1;\r\n    \r\n    /// <summary>\r\n    /// XsdTable control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder XsdTable;\r\n    \r\n    /// <summary>\r\n    /// GenerateButton control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.Button GenerateButton;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/schemas/FormsControls/bindingforms10.xsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xs:schema xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" targetNamespace=\"http://www.composite.net/ns/management/bindingforms/1.0\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\r\n  <xs:element name=\"formdefinition\">\r\n    <xs:complexType>\r\n      <xs:sequence>\r\n        <xs:element name=\"bindings\">\r\n          <xs:complexType>\r\n            <xs:sequence>\r\n              <xs:element maxOccurs=\"unbounded\" name=\"binding\" minOccurs=\"0\">\r\n                <xs:complexType>\r\n                  <xs:attribute name=\"name\" type=\"xs:string\" use=\"required\" />\r\n                  <xs:attribute name=\"type\" type=\"xs:string\" use=\"required\" />\r\n                  <xs:attribute name=\"optional\" type=\"xs:boolean\" use=\"optional\" />\r\n                </xs:complexType>\r\n              </xs:element>\r\n            </xs:sequence>\r\n          </xs:complexType>\r\n        </xs:element>\r\n\r\n        <xs:element name=\"layout\">\r\n          <xs:complexType>\r\n            <xs:sequence>\r\n              <xs:element name=\"layout.label\" maxOccurs=\"1\" minOccurs=\"0\">\r\n                <xs:complexType>\r\n                  <xs:sequence>\r\n                    <xs:element name=\"read\">\r\n                      <xs:complexType>\r\n                        <xs:attribute name=\"source\" type=\"xs:string\" use=\"required\" />\r\n                      </xs:complexType>\r\n                    </xs:element>\r\n                  </xs:sequence>\r\n                </xs:complexType>\r\n              </xs:element>\r\n              <xs:element name=\"layout.iconhandle\" maxOccurs=\"1\" minOccurs=\"0\">\r\n                <xs:complexType>\r\n                  <xs:sequence>\r\n                    <xs:element name=\"read\">\r\n                      <xs:complexType>\r\n                        <xs:attribute name=\"source\" type=\"xs:string\" use=\"required\" />\r\n                      </xs:complexType>\r\n                    </xs:element>\r\n                  </xs:sequence>\r\n                </xs:complexType>\r\n              </xs:element>\r\n              <xs:sequence>\r\n                <xs:choice>\r\n                  <xs:any namespace=\"##other\" />\r\n                </xs:choice>\r\n              </xs:sequence>\r\n            </xs:sequence>\r\n            <xs:attribute name=\"label\" type=\"xs:string\" use=\"optional\" />\r\n            <xs:attribute name=\"iconhandle\" type=\"xs:string\" use=\"optional\" />\r\n          </xs:complexType>\r\n        </xs:element>\r\n      </xs:sequence>\r\n    </xs:complexType>\r\n  </xs:element>\r\n  <xs:element name=\"bind\">\r\n    <xs:complexType>\r\n      <xs:attribute name=\"source\" type=\"xs:string\" use=\"required\" />\r\n    </xs:complexType>\r\n  </xs:element>\r\n  <xs:element name=\"read\">\r\n    <xs:complexType>\r\n      <xs:attribute name=\"source\" type=\"xs:string\" use=\"required\" />\r\n    </xs:complexType>\r\n  </xs:element>\r\n</xs:schema>"
  },
  {
    "path": "Website/Composite/schemas/FormsControls/functions__www_composite_net_ns_management_bindingforms_std_function_lib_1_0.xsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\" targetNamespace=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" xmlns=\"http://www.composite.net/ns/management/bindingforms/std.function.lib/1.0\" elementFormDefault=\"qualified\">\r\n  <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\r\n  <xsd:import namespace=\"http://www.composite.net/ns/management/bindingforms/1.0\" schemaLocation=\"bindingforms10.xsd\" />\r\n  <xsd:element name=\"Binding\" type=\"Binding\" />\r\n  <xsd:element name=\"BooleanCheck\" type=\"BooleanCheck\" />\r\n  <xsd:element name=\"GetData\" type=\"GetData\" />\r\n  <xsd:element name=\"ListDataInterfaces\" type=\"ListDataInterfaces\" />\r\n  <xsd:element name=\"NullCheck\" type=\"NullCheck\" />\r\n  <xsd:element name=\"Replicator\" type=\"Replicator\" />\r\n  <xsd:element name=\"StaticMethodCall\" type=\"StaticMethodCall\" />\r\n  <xsd:element name=\"CompositeFunctionCall\" type=\"CompositeFunctionCall\" />\r\n  <xsd:group name=\"ElementList\">\r\n    <xsd:sequence>\r\n      <xsd:choice minOccurs=\"0\">\r\n        <xsd:element name=\"Binding\" type=\"Binding\" />\r\n        <xsd:element name=\"BooleanCheck\" type=\"BooleanCheck\" />\r\n        <xsd:element name=\"GetData\" type=\"GetData\" />\r\n        <xsd:element name=\"ListDataInterfaces\" type=\"ListDataInterfaces\" />\r\n        <xsd:element name=\"NullCheck\" type=\"NullCheck\" />\r\n        <xsd:element name=\"Replicator\" type=\"Replicator\" />\r\n        <xsd:element name=\"StaticMethodCall\" type=\"StaticMethodCall\" />\r\n        <xsd:element name=\"CompositeFunctionCall\" type=\"CompositeFunctionCall\" />\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n  </xsd:group>\r\n  <xsd:complexType name=\"Binding\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"Binding.Value\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"Binding.Name\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Value\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Name\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"BooleanCheck\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"BooleanCheck.WhenTrue\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"BooleanCheck.WhenFalse\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"BooleanCheck.CheckValue\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"WhenTrue\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"WhenFalse\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"CheckValue\" type=\"xsd:boolean\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"GetData\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"GetData.TypeName\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"TypeName\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"ListDataInterfaces\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"NullCheck\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"NullCheck.WhenNull\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"NullCheck.WhenNotNull\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"NullCheck.CheckValue\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"WhenNull\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"WhenNotNull\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"CheckValue\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"Replicator\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"Replicator.Value\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:bind\" />\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:bind\" />\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Value\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"StaticMethodCall\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"StaticMethodCall.Type\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"StaticMethodCall.Method\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:element name=\"StaticMethodCall.Parameters\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n                <xsd:group ref=\"ElementList\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n                <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n        <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n          <xsd:choice>\r\n            <xsd:element ref=\"cms:read\" />\r\n            <xsd:group ref=\"ElementList\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/internal.ui.controls.lib/1.0\" />\r\n            <xsd:any namespace=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" />\r\n          </xsd:choice>\r\n        </xsd:sequence>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Type\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Method\" type=\"xsd:string\" use=\"optional\" />\r\n    <xsd:attribute name=\"Parameters\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n  <xsd:complexType name=\"CompositeFunctionCall\" mixed=\"true\">\r\n    <xsd:sequence maxOccurs=\"unbounded\" minOccurs=\"0\">\r\n      <xsd:choice>\r\n        <xsd:element name=\"CompositeFunctionCall.Name\">\r\n          <xsd:complexType mixed=\"true\">\r\n            <xsd:sequence maxOccurs=\"1\" minOccurs=\"0\">\r\n              <xsd:choice>\r\n                <xsd:element ref=\"cms:read\" />\r\n              </xsd:choice>\r\n            </xsd:sequence>\r\n          </xsd:complexType>\r\n        </xsd:element>\r\n      </xsd:choice>\r\n    </xsd:sequence>\r\n    <xsd:attribute name=\"Name\" type=\"xsd:string\" use=\"optional\" />\r\n  </xsd:complexType>\r\n</xsd:schema>"
  },
  {
    "path": "Website/Composite/schemas/Functions/Function.xsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xs:schema id=\"Function\"\r\n    targetNamespace=\"http://www.composite.net/ns/function/1.0\"\r\n    elementFormDefault=\"qualified\"\r\n    xmlns=\"http://www.composite.net/ns/function/1.0\"\r\n    xmlns:mstns=\"http://www.composite.net/ns/function/1.0\"\r\n    xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n>\r\n\r\n\t<xs:complexType name=\"FunctionType\">\r\n\t\t<xs:sequence>\r\n\t\t\t<xs:element name=\"param\" type=\"ParamType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n\t\t</xs:sequence>\r\n\r\n\t\t<xs:attribute name=\"name\" type=\"xs:string\" use=\"required\"/>\r\n    <xs:attribute name=\"localname\" type=\"xs:string\" use=\"optional\"/>\r\n  </xs:complexType>\r\n\r\n\t<xs:complexType name=\"ParamType\">\r\n\t\t<xs:choice>\r\n\t\t\t<xs:element name=\"function\" type=\"FunctionType\" minOccurs=\"0\" maxOccurs=\"1\" />\r\n\r\n\t\t\t<xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n\t\t\t\t<xs:element name=\"paramelement\" type=\"ParametersValueElement\" />\r\n\t\t\t</xs:sequence>\r\n      <xs:any namespace=\"##other\" minOccurs=\"0\"/>\r\n      <xs:any namespace=\"##local\" minOccurs=\"0\"/>\r\n    </xs:choice>\r\n\r\n\t\t<xs:attribute name=\"name\" type=\"xs:string\" use=\"required\"/>\r\n\t\t<xs:attribute name=\"value\" type=\"xs:string\" use=\"optional\"/>\r\n\t</xs:complexType>\r\n\r\n\t<xs:complexType name=\"ParametersValueElement\">\r\n\t\t<xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\r\n\t</xs:complexType>\r\n\r\n\r\n\t<xs:element name=\"function\" type=\"FunctionType\" />\r\n</xs:schema>\r\n"
  },
  {
    "path": "Website/Composite/schemas/Trees/Tree.xsd",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xs:schema id=\"Tree\"\r\n    targetNamespace=\"http://www.composite.net/ns/management/trees/treemarkup/1.0\"\r\n    elementFormDefault=\"qualified\"\r\n    xmlns=\"http://www.composite.net/ns/management/trees/treemarkup/1.0\"\r\n    xmlns:mstns=\"http://www.composite.net/ns/management/trees/treemarkup/1.0\"\r\n    xmlns:func=\"http://www.composite.net/ns/function/1.0\"\r\n    xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n>\r\n  <xs:import namespace=\"http://www.composite.net/ns/function/1.0\" schemaLocation=\"../Functions/Function.xsd\"/>\r\n\r\n  <!-- ========================= \"Header\" types ======================== -->\r\n\r\n  <xs:complexType name=\"ElementStructure.AutoAttachmentsType\">\r\n    <xs:annotation>\r\n      <xs:documentation xml:lang=\"en-us\">The children of this element describes where to insert this tree in the existing tree</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n      <xs:element name=\"NamedParent\" type=\"NamedParentType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"DataType\" type=\"DataTypeType\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\r\n    </xs:choice>\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"NamedParentType\">\r\n    <xs:annotation>\r\n      <xs:documentation xml:lang=\"en-us\">Name of the perspective</xs:documentation>\r\n    </xs:annotation>\r\n    <xs:attribute name=\"Name\" use=\"required\" type=\"AttachmentPointName\" />\r\n    <xs:attribute name=\"Position\" use=\"optional\" default=\"Top\">\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"Top\" />\r\n          <xs:enumeration value=\"Bottom\" />\r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n  </xs:complexType>\r\n\r\n  <xs:simpleType name=\"AttachmentPointName\">\r\n    <xs:union memberTypes=\"BuildInAttachmentPointName CustomAttachmentPointName\" />\r\n  </xs:simpleType>\r\n\r\n    <xs:simpleType name=\"BuildInAttachmentPointName\">\r\n    <xs:restriction base=\"xs:string\">\r\n      <xs:enumeration value=\"Content\" />\r\n      <xs:enumeration value=\"Content.WebsiteItems\" />\r\n      <xs:enumeration value=\"Media\" />\r\n      <xs:enumeration value=\"Layout\" />\r\n      <xs:enumeration value=\"Function\" />\r\n      <xs:enumeration value=\"Data\" />\r\n      <xs:enumeration value=\"User\" />\r\n      <xs:enumeration value=\"System\" />\r\n      <xs:enumeration value=\"PerspectivesRoot\" />\r\n    </xs:restriction>\r\n  </xs:simpleType>\r\n\r\n  <xs:simpleType name=\"CustomAttachmentPointName\">\r\n    <xs:restriction base=\"xs:string\">\r\n      <xs:pattern value=\"[a-zA-Z.]+\" />\r\n    </xs:restriction>\r\n  </xs:simpleType>\r\n\r\n  <xs:complexType name=\"ElementStructure.AllowedAttachmentsType\">\r\n    <xs:annotation>\r\n      <xs:documentation xml:lang=\"en-us\">Using this element will add two actions add/delete application that will enable the user to add (and remove) this tree to the elements specified in the children of this element</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n      <xs:element name=\"DataType\" type=\"DataTypeType\" />\r\n    </xs:choice>\r\n\r\n    <xs:attribute name=\"ApplicationName\" use=\"required\" type=\"xs:string\" />\r\n  </xs:complexType>\r\n\r\n\r\n\r\n  <xs:complexType name=\"DataTypeType\">\r\n    <xs:annotation>\r\n      <xs:documentation xml:lang=\"en-us\">A C1 CMS data type</xs:documentation>\r\n    </xs:annotation>\r\n    <xs:attribute name=\"Type\" use=\"required\" type=\"xs:string\" />\r\n\r\n    <xs:attribute name=\"Position\" use=\"optional\" default=\"Top\">\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"Top\" />\r\n          <xs:enumeration value=\"Bottom\" />\r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n  </xs:complexType>\r\n\r\n  <!-- ========================= Structure types ======================== -->\r\n\r\n  <xs:complexType name=\"ElementRootType\">\r\n    <xs:annotation>\r\n      <xs:documentation>Children of this node is the root children of the points where the tree is inserted</xs:documentation>\r\n    </xs:annotation>    \r\n    \r\n    <xs:all>\r\n      <xs:element name=\"Children\" type=\"ChildrenType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"Actions\" type=\"ActionsType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n    </xs:all>\r\n\r\n    <xs:attribute name=\"ShareRootElementById\" use=\"optional\" default=\"false\" type=\"xs:boolean\" />\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"ChildrenType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This element defines what children the parent element should have</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n      <xs:element name=\"Element\" type=\"ElementType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <!--<xs:element name=\"FunctionElementGenerator\" type=\"FunctionElementGeneratorType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />-->\r\n      <xs:element name=\"DataFolderElements\" type=\"DataFolderElementRootType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"DataElements\" type=\"DataElementsType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n    </xs:choice>\r\n  </xs:complexType>\r\n\r\n\r\n  <!-- This is used for data folder elements only. This is because the type attribute should only be on the most parent element -->\r\n  <xs:complexType name=\"DataFolderChildrenType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This element defines what children the parent element should have</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n      <xs:element name=\"DataFolderElements\" type=\"DataFolderElementType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"DataElements\" type=\"DataElementsType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n    </xs:choice>\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"ActionsType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This element defines actions that that should be added to the parent element</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n      <xs:element name=\"AddDataAction\" type=\"AddDataActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"ReportFunctionAction\" type=\"ReportFunctionActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"MessageBoxAction\" type=\"MessageBoxActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"CustomUrlAction\" type=\"CustomUrlActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"ConfirmAction\" type=\"ConfirmActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"WorkflowAction\" type=\"WorkflowActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n    </xs:choice>\r\n  </xs:complexType>\r\n\r\n  <xs:complexType name=\"DataActionsType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This element defines actions that that should be added to the parent element</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n      <xs:element name=\"AddDataAction\" type=\"AddDataActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"EditDataAction\" type=\"EditDataActionType\" minOccurs=\"0\" maxOccurs=\"1\" />\r\n      <xs:element name=\"DeleteDataAction\" type=\"DeleteDataActionType\" minOccurs=\"0\" maxOccurs=\"1\" />\r\n      <xs:element name=\"DuplicateDataAction\" type=\"DuplicateDataActionType\" minOccurs=\"0\" maxOccurs=\"1\" />\r\n      <xs:element name=\"ReportFunctionAction\" type=\"ReportFunctionActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"MessageBoxAction\" type=\"MessageBoxActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"CustomUrlAction\" type=\"CustomUrlActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"ConfirmAction\" type=\"ConfirmActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"WorkflowAction\" type=\"WorkflowActionType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n    </xs:choice>\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"FiltersType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This element defines filters that will filter data elements of this data element</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n      <xs:element name=\"ParentIdFilter\" type=\"ParentIdFilterType\" minOccurs=\"0\" maxOccurs=\"1\" />\r\n      <xs:element name=\"FieldFilter\" type=\"FieldFilterType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n      <xs:element name=\"FunctionFilter\" type=\"FunctionFilterType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n    </xs:choice>\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"OrderByType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This element defines how the resulting data elements should be ordered</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n      <xs:element name=\"Field\" type=\"FieldOrderByType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\r\n    </xs:choice>\r\n  </xs:complexType>\r\n\r\n\r\n  <!-- ========================= Attribute types ======================== -->\r\n\r\n\r\n  <xs:attributeGroup name=\"DisplayGroup\">\r\n    <xs:attribute name=\"Display\" use=\"optional\" default=\"Lazy\">\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"Compact\">\r\n            <xs:annotation>\r\n              <xs:documentation>Only shows the element if it has any parent relation children</xs:documentation>\r\n            </xs:annotation>\r\n          </xs:enumeration>\r\n          <xs:enumeration value=\"Lazy\">\r\n            <xs:annotation>\r\n              <xs:documentation>Shows all elements ragardless of parent relations of any children</xs:documentation>\r\n            </xs:annotation>\r\n          </xs:enumeration>\r\n          <xs:enumeration value=\"Auto\">\r\n            <xs:annotation>\r\n              <xs:documentation>Shows all elements, but only shows 'plus' if the element has any parent relation children</xs:documentation>\r\n            </xs:annotation>\r\n          </xs:enumeration>\r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n  </xs:attributeGroup>\r\n\r\n  \r\n  <xs:attributeGroup name=\"SortDirection\">\r\n    <xs:attribute name=\"SortDirection\" use=\"optional\" default=\"Ascending\">\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"Ascending\">\r\n            <xs:annotation>\r\n              <xs:documentation>Sort from smallest to largest. For example, A to Z.</xs:documentation>\r\n            </xs:annotation>\r\n          </xs:enumeration>\r\n          <xs:enumeration value=\"Descending\">\r\n            <xs:annotation>\r\n              <xs:documentation>Sort from largest to smallest. For example, Z to A.</xs:documentation>\r\n            </xs:annotation>\r\n          </xs:enumeration>\r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n  </xs:attributeGroup>\r\n\r\n\r\n  <xs:attributeGroup name=\"LocationGroup\">\r\n    <xs:attribute name=\"Location\" use=\"optional\" default=\"Other\">\r\n      <xs:annotation>\r\n        <xs:documentation>The location of the action in the toolbar</xs:documentation>\r\n      </xs:annotation>\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"Add\" />\r\n          <xs:enumeration value=\"Edit\" />\r\n          <xs:enumeration value=\"Delete\" />\r\n          <xs:enumeration value=\"Other\" />          \r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n  </xs:attributeGroup>\r\n\r\n  <xs:attributeGroup name=\"IconGroup\">\r\n    <xs:attribute name=\"Icon\" use=\"optional\" type=\"xs:string\" >\r\n      <xs:annotation>\r\n        <xs:documentation>The icon of the element(s).</xs:documentation>\r\n      </xs:annotation>\r\n      <!--<xs:simpleType>        \r\n        <xs:restriction base=\"xs:string\">          \r\n          <xs:enumeration value=\"blank\" />\r\n          <xs:enumeration value=\"perspective-content\" />\r\n          <xs:enumeration value=\"perspective-design\" />\r\n          <xs:enumeration value=\"perspective-datas\" />\r\n          <xs:enumeration value=\"perspective-config\" />\r\n          <xs:enumeration value=\"perspective-users\" />\r\n          <xs:enumeration value=\"perspective-usergroups\" />\r\n          <xs:enumeration value=\"perspective-mocks\" />\r\n          <xs:enumeration value=\"perspective-media\" />\r\n          <xs:enumeration value=\"perspective-system\" />\r\n          <xs:enumeration value=\"perspective-developerapplication\" />\r\n          <xs:enumeration value=\"perspectivetools\" />\r\n          <xs:enumeration value=\"perspectivetools-disabled\" />\r\n          <xs:enumeration value=\"generic-edit\" />\r\n          <xs:enumeration value=\"generic-delete\" />\r\n          <xs:enumeration value=\"generic-add\" />\r\n          <xs:enumeration value=\"generic-search\" />\r\n          <xs:enumeration value=\"generic-refresh\" />\r\n          <xs:enumeration value=\"generic-set-security\" />\r\n          <xs:enumeration value=\"generic-show-history\" />\r\n          <xs:enumeration value=\"generic-show-report\" />\r\n          <xs:enumeration value=\"refresh\" />\r\n          <xs:enumeration value=\"home\" />\r\n          <xs:enumeration value=\"refresh-disabled\" />\r\n          <xs:enumeration value=\"recycle\" />\r\n          <xs:enumeration value=\"clock\" />\r\n          <xs:enumeration value=\"lock\" />\r\n          <xs:enumeration value=\"data-draft\" />\r\n          <xs:enumeration value=\"data-awaiting-approval\" />\r\n          <xs:enumeration value=\"data-awaiting-publication\" />\r\n          <xs:enumeration value=\"data-published\" />\r\n          <xs:enumeration value=\"data\" />\r\n          <xs:enumeration value=\"earth\" />\r\n          <xs:enumeration value=\"folder-disabled\" />\r\n          <xs:enumeration value=\"folder-open\" />\r\n          <xs:enumeration value=\"report\" />\r\n          <xs:enumeration value=\"template\" />\r\n          <xs:enumeration value=\"user\" />\r\n          <xs:enumeration value=\"user-disabled\" />\r\n          <xs:enumeration value=\"user-group\" />\r\n          <xs:enumeration value=\"cancel\" />\r\n          <xs:enumeration value=\"cancel-disabled\" />\r\n          <xs:enumeration value=\"close\" />\r\n          <xs:enumeration value=\"popup\" />\r\n          <xs:enumeration value=\"tools\" />\r\n          <xs:enumeration value=\"options\" />\r\n          <xs:enumeration value=\"advanced\" />\r\n          <xs:enumeration value=\"up\" />\r\n          <xs:enumeration value=\"up-disabled\" />\r\n          <xs:enumeration value=\"down\" />\r\n          <xs:enumeration value=\"down-disabled\" />\r\n          <xs:enumeration value=\"forward\" />\r\n          <xs:enumeration value=\"forward-disabled\" />\r\n          <xs:enumeration value=\"back\" />\r\n          <xs:enumeration value=\"back-disabled\" />\r\n          <xs:enumeration value=\"synchronize\" />\r\n          <xs:enumeration value=\"collapseall\" />\r\n          <xs:enumeration value=\"page-template-root-closed\" />\r\n          <xs:enumeration value=\"page-template-root-open\" />\r\n          <xs:enumeration value=\"page-template-template\" />\r\n          <xs:enumeration value=\"page-template-add\" />\r\n          <xs:enumeration value=\"page-template-edit\" />\r\n          <xs:enumeration value=\"page-template-delete\" />\r\n          <xs:enumeration value=\"base-function-function\" />\r\n          <xs:enumeration value=\"method-based-function-add\" />\r\n          <xs:enumeration value=\"method-based-function-edit\" />\r\n          <xs:enumeration value=\"method-based-function-delete\" />\r\n          <xs:enumeration value=\"sql-based-function\" />\r\n          <xs:enumeration value=\"sql-based-connection\" />\r\n          <xs:enumeration value=\"sql-based-connection-add\" />\r\n          <xs:enumeration value=\"sql-based-connection-edit\" />\r\n          <xs:enumeration value=\"sql-based-connection-delete\" />\r\n          <xs:enumeration value=\"sql-based-function-add\" />\r\n          <xs:enumeration value=\"sql-based-function-edit\" />\r\n          <xs:enumeration value=\"sql-based-function-delete\" />\r\n          <xs:enumeration value=\"xslt-based-function\" />\r\n          <xs:enumeration value=\"xslt-based-function-add\" />\r\n          <xs:enumeration value=\"xslt-based-function-edit\" />\r\n          <xs:enumeration value=\"xslt-based-function-delete\" />\r\n          <xs:enumeration value=\"all-functions-generatedocumentation\" />\r\n          <xs:enumeration value=\"generated-root-open\" />\r\n          <xs:enumeration value=\"generated-root-closed\" />\r\n          <xs:enumeration value=\"data-interface-open\" />\r\n          <xs:enumeration value=\"data-interface-closed\" />\r\n          <xs:enumeration value=\"generated-type-add\" />\r\n          <xs:enumeration value=\"generated-type-edit\" />\r\n          <xs:enumeration value=\"generated-type-delete\" />\r\n          <xs:enumeration value=\"generated-type-localize\" />\r\n          <xs:enumeration value=\"generated-type-delocalize\" />\r\n          <xs:enumeration value=\"generated-type-data-add\" />\r\n          <xs:enumeration value=\"generated-type-data-edit\" />\r\n          <xs:enumeration value=\"generated-type-data-delete\" />\r\n          <xs:enumeration value=\"generated-type-data-localize\" />\r\n          <xs:enumeration value=\"generated-type-form-markup-edit\" />\r\n          <xs:enumeration value=\"generated-type-to-xml\" />\r\n          <xs:enumeration value=\"generated-type-list-unpublished-items\" />\r\n          <xs:enumeration value=\"associated-data-add\" />\r\n          <xs:enumeration value=\"associated-data-edit\" />\r\n          <xs:enumeration value=\"associated-data-delete\" />\r\n          <xs:enumeration value=\"generated-type-showincontentarea\" />\r\n          <xs:enumeration value=\"item-send-back-to-draft\" />\r\n          <xs:enumeration value=\"item-send-to-draft-disabled\" />\r\n          <xs:enumeration value=\"item-send-forward-for-approval\" />\r\n          <xs:enumeration value=\"item-send-back-for-approval\" />\r\n          <xs:enumeration value=\"item-send-for-approval-disabled\" />\r\n          <xs:enumeration value=\"item-send-forward-for-publication\" />\r\n          <xs:enumeration value=\"item-send-back-for-publication\" />\r\n          <xs:enumeration value=\"item-send-for-publication-disabled\" />\r\n          <xs:enumeration value=\"item-publish\" />\r\n          <xs:enumeration value=\"item-publish-disabled\" />\r\n          <xs:enumeration value=\"item-unpublish\" />\r\n          <xs:enumeration value=\"item-undo-unpublished-changes\" />\r\n          <xs:enumeration value=\"page-root-open\" />\r\n          <xs:enumeration value=\"page-root-closed\" />\r\n          <xs:enumeration value=\"page-draft\" />\r\n          <xs:enumeration value=\"page-awaiting-approval\" />\r\n          <xs:enumeration value=\"page-awaiting-publication\" />\r\n          <xs:enumeration value=\"page-publication\" />\r\n          <xs:enumeration value=\"page-ghosted\" />\r\n          <xs:enumeration value=\"page-disabled\" />\r\n          <xs:enumeration value=\"page-edit-page\" />\r\n          <xs:enumeration value=\"page-localize-page\" />\r\n          <xs:enumeration value=\"page-add-page\" />\r\n          <xs:enumeration value=\"page-delete-page\" />\r\n          <xs:enumeration value=\"page-add-sub-page\" />\r\n          <xs:enumeration value=\"page-view-public-scope\" />\r\n          <xs:enumeration value=\"page-view-public-scope-disabled\" />\r\n          <xs:enumeration value=\"page-view-administrated-scope\" />\r\n          <xs:enumeration value=\"page-manage-host-names\" />\r\n          <xs:enumeration value=\"page-activatelocalization\" />\r\n          <xs:enumeration value=\"page-deactivatelocalization\" />\r\n          <xs:enumeration value=\"page-list-unpublished-items\" />\r\n          <xs:enumeration value=\"media-add-media-folder\" />\r\n          <xs:enumeration value=\"media-add-media-file\" />\r\n          <xs:enumeration value=\"media-replace-media-file\" />\r\n          <xs:enumeration value=\"media-upload-zip-file\" />\r\n          <xs:enumeration value=\"media-edit-image-file\" />\r\n          <xs:enumeration value=\"media-edit-media-folder\" />\r\n          <xs:enumeration value=\"media-edit-media-file\" />\r\n          <xs:enumeration value=\"media-delete-media-folder\" />\r\n          <xs:enumeration value=\"media-delete-media-file\" />\r\n          <xs:enumeration value=\"media-download-file\" />\r\n          <xs:enumeration value=\"media-read-only-folder-open\" />\r\n          <xs:enumeration value=\"media-read-only-folder-closed\" />\r\n          <xs:enumeration value=\"website-add-website-folder\" />\r\n          <xs:enumeration value=\"website-create-website-file\" />\r\n          <xs:enumeration value=\"website-upload-website-file\" />\r\n          <xs:enumeration value=\"website-edit-website-file\" />\r\n          <xs:enumeration value=\"website-delete-website-folder\" />\r\n          <xs:enumeration value=\"website-delete-website-file\" />\r\n          <xs:enumeration value=\"website-read-only-folder-open\" />\r\n          <xs:enumeration value=\"website-read-only-folder-closed\" />\r\n          <xs:enumeration value=\"website-add-folder-to-whitelist\" />\r\n          <xs:enumeration value=\"website-remove-folder-from-whitelist\" />\r\n          <xs:enumeration value=\"configuration-root-open\" />\r\n          <xs:enumeration value=\"configuration-root-closed\" />\r\n          <xs:enumeration value=\"unknown\" />\r\n          <xs:enumeration value=\"unregistered\" />\r\n          <xs:enumeration value=\"default\" />\r\n          <xs:enumeration value=\"loading\" />\r\n          <xs:enumeration value=\"cut\" />\r\n          <xs:enumeration value=\"cut-disabled\" />\r\n          <xs:enumeration value=\"copy\" />\r\n          <xs:enumeration value=\"copy-disabled\" />\r\n          <xs:enumeration value=\"paste\" />\r\n          <xs:enumeration value=\"paste-disabled\" />\r\n          <xs:enumeration value=\"delete\" />\r\n          <xs:enumeration value=\"delete-disabled\" />\r\n          <xs:enumeration value=\"print\" />\r\n          <xs:enumeration value=\"save\" />\r\n          <xs:enumeration value=\"save-disabled\" />\r\n          <xs:enumeration value=\"saveas\" />\r\n          <xs:enumeration value=\"saveas-disabled\" />\r\n          <xs:enumeration value=\"undo\" />\r\n          <xs:enumeration value=\"undo-disabled\" />\r\n          <xs:enumeration value=\"redo\" />\r\n          <xs:enumeration value=\"redo-disabled\" />\r\n          <xs:enumeration value=\"link\" />\r\n          <xs:enumeration value=\"link-disabled\" />\r\n          <xs:enumeration value=\"unlink\" />\r\n          <xs:enumeration value=\"unlink-disabled\" />\r\n          <xs:enumeration value=\"accept\" />\r\n          <xs:enumeration value=\"accept-disabled\" />\r\n          <xs:enumeration value=\"sizeondisk\" />\r\n          <xs:enumeration value=\"sizeonscreen\" />\r\n          <xs:enumeration value=\"nodes\" />\r\n          <xs:enumeration value=\"fields\" />\r\n          <xs:enumeration value=\"fields-disabled\" />\r\n          <xs:enumeration value=\"field\" />\r\n          <xs:enumeration value=\"field-disabled\" />\r\n          <xs:enumeration value=\"deletefield\" />\r\n          <xs:enumeration value=\"insert\" />\r\n          <xs:enumeration value=\"insert-disabled\" />\r\n          <xs:enumeration value=\"help\" />\r\n          <xs:enumeration value=\"composite\" />\r\n          <xs:enumeration value=\"placeholder\" />\r\n          <xs:enumeration value=\"input\" />\r\n          <xs:enumeration value=\"input-disabled\" />\r\n          <xs:enumeration value=\"output\" />\r\n          <xs:enumeration value=\"browser\" />\r\n          <xs:enumeration value=\"cleanup\" />\r\n          <xs:enumeration value=\"cleanup-disabled\" />\r\n          <xs:enumeration value=\"scale\" />\r\n          <xs:enumeration value=\"crop\" />\r\n          <xs:enumeration value=\"crop-disabled\" />\r\n          <xs:enumeration value=\"zoom\" />\r\n          <xs:enumeration value=\"zoomin\" />\r\n          <xs:enumeration value=\"zoomout\" />\r\n          <xs:enumeration value=\"editor-sourceview\" />\r\n          <xs:enumeration value=\"editor-sourceview-disabled\" />\r\n          <xs:enumeration value=\"editor-designview\" />\r\n          <xs:enumeration value=\"editor-designview-disabled\" />\r\n          <xs:enumeration value=\"editor-plainedit\" />\r\n          <xs:enumeration value=\"editor-fancyedit\" />\r\n          <xs:enumeration value=\"editor-classselector\" />\r\n          <xs:enumeration value=\"editor-classselector-disabled\" />\r\n          <xs:enumeration value=\"editor-formatselector\" />\r\n          <xs:enumeration value=\"editor-formatselector-disabled\" />\r\n          <xs:enumeration value=\"editor-formatsource\" />\r\n          <xs:enumeration value=\"editor-formatsource-disabled\" />\r\n          <xs:enumeration value=\"error\" />\r\n          <xs:enumeration value=\"message\" />\r\n          <xs:enumeration value=\"message-disabled\" />\r\n          <xs:enumeration value=\"warning\" />\r\n          <xs:enumeration value=\"question\" />\r\n          <xs:enumeration value=\"balloon\" />\r\n          <xs:enumeration value=\"wizard\" />\r\n          <xs:enumeration value=\"next\" />\r\n          <xs:enumeration value=\"next-disabled\" />\r\n          <xs:enumeration value=\"previous\" />\r\n          <xs:enumeration value=\"previous-disabled\" />\r\n          <xs:enumeration value=\"finish\" />\r\n          <xs:enumeration value=\"finish-disabled\" />\r\n          <xs:enumeration value=\"bookmark\" />\r\n          <xs:enumeration value=\"systemlog\" />\r\n          <xs:enumeration value=\"developer\" />\r\n          <xs:enumeration value=\"icon\" />\r\n          <xs:enumeration value=\"page\" />\r\n          <xs:enumeration value=\"image\" />\r\n          <xs:enumeration value=\"specialchar\" />\r\n          <xs:enumeration value=\"media\" />\r\n          <xs:enumeration value=\"namespace_section\" />\r\n          <xs:enumeration value=\"namespace_section_active\" />\r\n          <xs:enumeration value=\"functioncall\" />\r\n          <xs:enumeration value=\"functioncall-disabled\" />\r\n          <xs:enumeration value=\"functioncall_list\" />\r\n          <xs:enumeration value=\"parameter\" />\r\n          <xs:enumeration value=\"parameter_missing\" />\r\n          <xs:enumeration value=\"parameter_overloaded\" />\r\n          <xs:enumeration value=\"deleteditems\" />\r\n          <xs:enumeration value=\"folder\" />\r\n          <xs:enumeration value=\"folder_active\" />\r\n          <xs:enumeration value=\"seoassistant\" />\r\n          <xs:enumeration value=\"mimetype-unknown\" />\r\n          <xs:enumeration value=\"mimetype-asf\" />\r\n          <xs:enumeration value=\"mimetype-mdb\" />\r\n          <xs:enumeration value=\"mimetype-pdf\" />\r\n          <xs:enumeration value=\"mimetype-ppt\" />\r\n          <xs:enumeration value=\"mimetype-zip\" />\r\n          <xs:enumeration value=\"mimetype-vaw\" />\r\n          <xs:enumeration value=\"mimetype-exe\" />\r\n          <xs:enumeration value=\"mimetype-asax\" />\r\n          <xs:enumeration value=\"mimetype-ascx\" />\r\n          <xs:enumeration value=\"mimetype-asm\" />\r\n          <xs:enumeration value=\"mimetype-asp\" />\r\n          <xs:enumeration value=\"mimetype-aspx\" />\r\n          <xs:enumeration value=\"mimetype-bmp\" />\r\n          <xs:enumeration value=\"mimetype-cat\" />\r\n          <xs:enumeration value=\"mimetype-chm\" />\r\n          <xs:enumeration value=\"mimetype-cfg\" />\r\n          <xs:enumeration value=\"mimetype-css\" />\r\n          <xs:enumeration value=\"mimetype-db\" />\r\n          <xs:enumeration value=\"mimetype-dib\" />\r\n          <xs:enumeration value=\"mimetype-disc\" />\r\n          <xs:enumeration value=\"mimetype-doc\" />\r\n          <xs:enumeration value=\"mimetype-docm\" />\r\n          <xs:enumeration value=\"mimetype-docx\" />\r\n          <xs:enumeration value=\"mimetype-dot\" />\r\n          <xs:enumeration value=\"mimetype-dotm\" />\r\n          <xs:enumeration value=\"mimetype-dotx\" />\r\n          <xs:enumeration value=\"mimetype-dvd\" />\r\n          <xs:enumeration value=\"mimetype-dwp\" />\r\n          <xs:enumeration value=\"mimetype-eml\" />\r\n          <xs:enumeration value=\"mimetype-est\" />\r\n          <xs:enumeration value=\"mimetype-fwp\" />\r\n          <xs:enumeration value=\"mimetype-gif\" />\r\n          <xs:enumeration value=\"mimetype-hlp\" />\r\n          <xs:enumeration value=\"mimetype-hta\" />\r\n          <xs:enumeration value=\"mimetype-htm\" />\r\n          <xs:enumeration value=\"mimetype-html\" />\r\n          <xs:enumeration value=\"mimetype-htt\" />\r\n          <xs:enumeration value=\"mimetype-inf\" />\r\n          <xs:enumeration value=\"mimetype-ini\" />\r\n          <xs:enumeration value=\"mimetype-jfif\" />\r\n          <xs:enumeration value=\"mimetype-jpe\" />\r\n          <xs:enumeration value=\"mimetype-jpeg\" />\r\n          <xs:enumeration value=\"mimetype-jpg\" />\r\n          <xs:enumeration value=\"mimetype-js\" />\r\n          <xs:enumeration value=\"mimetype-jse\" />\r\n          <xs:enumeration value=\"mimetype-log\" />\r\n          <xs:enumeration value=\"mimetype-ram\" />\r\n          <xs:enumeration value=\"mimetype-mht\" />\r\n          <xs:enumeration value=\"mimetype-mpd\" />\r\n          <xs:enumeration value=\"mimetype-mpp\" />\r\n          <xs:enumeration value=\"mimetype-mps\" />\r\n          <xs:enumeration value=\"mimetype-mpt\" />\r\n          <xs:enumeration value=\"mimetype-mpw\" />\r\n          <xs:enumeration value=\"mimetype-mpx\" />\r\n          <xs:enumeration value=\"mimetype-msg\" />\r\n          <xs:enumeration value=\"mimetype-msi\" />\r\n          <xs:enumeration value=\"mimetype-msp\" />\r\n          <xs:enumeration value=\"mimetype-ocx\" />\r\n          <xs:enumeration value=\"mimetype-one\" />\r\n          <xs:enumeration value=\"mimetype-png\" />\r\n          <xs:enumeration value=\"mimetype-pot\" />\r\n          <xs:enumeration value=\"mimetype-potm\" />\r\n          <xs:enumeration value=\"mimetype-potx\" />\r\n          <xs:enumeration value=\"mimetype-ppa\" />\r\n          <xs:enumeration value=\"mimetype-pps\" />\r\n          <xs:enumeration value=\"mimetype-ppsx\" />\r\n          <xs:enumeration value=\"mimetype-psp\" />\r\n          <xs:enumeration value=\"mimetype-ptm\" />\r\n          <xs:enumeration value=\"mimetype-ptt\" />\r\n          <xs:enumeration value=\"mimetype-pub\" />\r\n          <xs:enumeration value=\"mimetype-rtf\" />\r\n          <xs:enumeration value=\"mimetype-dir\" />\r\n          <xs:enumeration value=\"mimetype-swf\" />\r\n          <xs:enumeration value=\"mimetype-stt\" />\r\n          <xs:enumeration value=\"mimetype-tif\" />\r\n          <xs:enumeration value=\"mimetype-tiff\" />\r\n          <xs:enumeration value=\"mimetype-css\" />\r\n          <xs:enumeration value=\"mimetype-txt\" />\r\n          <xs:enumeration value=\"mimetype-vbe\" />\r\n          <xs:enumeration value=\"mimetype-vbs\" />\r\n          <xs:enumeration value=\"mimetype-vdx\" />\r\n          <xs:enumeration value=\"mimetype-vsd\" />\r\n          <xs:enumeration value=\"mimetype-vaw\" />\r\n          <xs:enumeration value=\"mimetype-vsl\" />\r\n          <xs:enumeration value=\"mimetype-vss\" />\r\n          <xs:enumeration value=\"mimetype-vst\" />\r\n          <xs:enumeration value=\"mimetype-vsv\" />\r\n          <xs:enumeration value=\"mimetype-vsw\" />\r\n          <xs:enumeration value=\"mimetype-vsx\" />\r\n          <xs:enumeration value=\"mimetype-vtx\" />\r\n          <xs:enumeration value=\"mimetype-wm\" />\r\n          <xs:enumeration value=\"mimetype-wma\" />\r\n          <xs:enumeration value=\"mimetype-wmd\" />\r\n          <xs:enumeration value=\"mimetype-wmp\" />\r\n          <xs:enumeration value=\"mimetype-wms\" />\r\n          <xs:enumeration value=\"mimetype-wmv\" />\r\n          <xs:enumeration value=\"mimetype-wmx\" />\r\n          <xs:enumeration value=\"mimetype-wmf\" />\r\n          <xs:enumeration value=\"mimetype-wmz\" />\r\n          <xs:enumeration value=\"mimetype-xlam\" />\r\n          <xs:enumeration value=\"mimetype-xls\" />\r\n          <xs:enumeration value=\"mimetype-xlsb\" />\r\n          <xs:enumeration value=\"mimetype-xlsm\" />\r\n          <xs:enumeration value=\"mimetype-xlt\" />\r\n          <xs:enumeration value=\"mimetype-xltm\" />\r\n          <xs:enumeration value=\"mimetype-xltx\" />\r\n          <xs:enumeration value=\"mimetype-xml\" />\r\n          <xs:enumeration value=\"mimetype-resx\" />\r\n          <xs:enumeration value=\"mimetype-xsd\" />\r\n          <xs:enumeration value=\"mimetype-xsl\" />\r\n          <xs:enumeration value=\"mimetype-xsn\" />\r\n          <xs:enumeration value=\"mimetype-xslt\" />\r\n          <xs:enumeration value=\"mimetype-xlsx\" />\r\n          <xs:enumeration value=\"mimetype-avi\" />\r\n          <xs:enumeration value=\"mimetype-mov\" />\r\n          <xs:enumeration value=\"mimetype-mpeg\" />\r\n          <xs:enumeration value=\"mimetype-mp3\" />\r\n          <xs:enumeration value=\"mimetype-rar\" />\r\n          <xs:enumeration value=\"validationrule\" />\r\n          <xs:enumeration value=\"validationrules\" />\r\n          <xs:enumeration value=\"validationrules-add\" />\r\n          <xs:enumeration value=\"validationrules-add-disabled\" />\r\n          <xs:enumeration value=\"dataassociation-rootfolder-closed\" />\r\n          <xs:enumeration value=\"dataassociation-rootfolder-open\" />\r\n          <xs:enumeration value=\"dataassociation-add-association\" />\r\n          <xs:enumeration value=\"dataassociation-edit-association\" />\r\n          <xs:enumeration value=\"dataassociation-remove-association\" />\r\n          <xs:enumeration value=\"users-changeownpassword\" />\r\n          <xs:enumeration value=\"users-changeownculture\" />\r\n          <xs:enumeration value=\"users-changepublicculture\" />\r\n          <xs:enumeration value=\"users-changetreeculture\" />\r\n          <xs:enumeration value=\"users-rootfolder-closed\" />\r\n          <xs:enumeration value=\"users-rootfolder-open\" />\r\n          <xs:enumeration value=\"users-group-closed\" />\r\n          <xs:enumeration value=\"users-group-open\" />\r\n          <xs:enumeration value=\"users-user\" />\r\n          <xs:enumeration value=\"users-user-disabled\" />\r\n          <xs:enumeration value=\"users-adduser\" />\r\n          <xs:enumeration value=\"users-edituser\" />\r\n          <xs:enumeration value=\"users-deleteuser\" />\r\n          <xs:enumeration value=\"usergroups-rootfolder-closed\" />\r\n          <xs:enumeration value=\"usergroups-rootfolder-open\" />\r\n          <xs:enumeration value=\"usergroups-usergroup\" />\r\n          <xs:enumeration value=\"usergroups-addusergroup\" />\r\n          <xs:enumeration value=\"usergroups-editusergroup\" />\r\n          <xs:enumeration value=\"usergroups-deleteusergroup\" />\r\n          <xs:enumeration value=\"log-perspective\" />\r\n          <xs:enumeration value=\"log-folder-closed\" />\r\n          <xs:enumeration value=\"log-showlog\" />\r\n          <xs:enumeration value=\"restart-application\" />\r\n          <xs:enumeration value=\"security-manage-permissions\" />\r\n          <xs:enumeration value=\"wysiwyg-function\" />\r\n          <xs:enumeration value=\"visual-function-add\" />\r\n          <xs:enumeration value=\"visual-function-edit\" />\r\n          <xs:enumeration value=\"visual-function-delete\" />\r\n          <xs:enumeration value=\"package-installer-install\" />\r\n          <xs:enumeration value=\"package-installer-uninstall\" />\r\n          <xs:enumeration value=\"package-installer-readmore\" />\r\n          <xs:enumeration value=\"package-element-closed-root\" />\r\n          <xs:enumeration value=\"package-element-opened-root\" />\r\n          <xs:enumeration value=\"package-element-closed-available\" />\r\n          <xs:enumeration value=\"package-element-opened-available\" />\r\n          <xs:enumeration value=\"package-element-closed-installed\" />\r\n          <xs:enumeration value=\"package-element-opened-installed\" />\r\n          <xs:enumeration value=\"package-element-closed-sources\" />\r\n          <xs:enumeration value=\"package-element-opened-sources\" />\r\n          <xs:enumeration value=\"package-element-closed-sourceitem\" />\r\n          <xs:enumeration value=\"package-element-closed-availablegroup\" />\r\n          <xs:enumeration value=\"package-element-opened-availablegroup\" />\r\n          <xs:enumeration value=\"package-element-closed-local\" />\r\n          <xs:enumeration value=\"package-element-opened-local\" />\r\n          <xs:enumeration value=\"package-element-closed-installedgroup\" />\r\n          <xs:enumeration value=\"package-element-opened-installedgroup\" />\r\n          <xs:enumeration value=\"package-element-closed-availableitem\" />\r\n          <xs:enumeration value=\"package-element-closed-installeditem\" />\r\n          <xs:enumeration value=\"package-clear-servercache\" />\r\n          <xs:enumeration value=\"package-view-installedinfo\" />\r\n          <xs:enumeration value=\"package-view-installedinfo\" />\r\n          <xs:enumeration value=\"package-view-availableinfo\" />\r\n          <xs:enumeration value=\"package-install-package\" />\r\n          <xs:enumeration value=\"package-install-local-package\" />\r\n          <xs:enumeration value=\"package-uninstall-package\" />\r\n          <xs:enumeration value=\"package-uninstall-local-package\" />\r\n          <xs:enumeration value=\"package-add-source\" />\r\n          <xs:enumeration value=\"package-delete-source\" />\r\n          <xs:enumeration value=\"datagroupinghelper-folder-closed\" />\r\n          <xs:enumeration value=\"datagroupinghelper-folder-open\" />\r\n          <xs:enumeration value=\"localization-element-closed-root\" />\r\n          <xs:enumeration value=\"localization-element-opened-root\" />\r\n          <xs:enumeration value=\"localization-element-localeitem\" />\r\n          <xs:enumeration value=\"localization-element-defaultlocaleitem\" />\r\n          <xs:enumeration value=\"localization-addsystemlocale\" />\r\n          <xs:enumeration value=\"localization-editsystemlocale\" />\r\n          <xs:enumeration value=\"localization-setasdefault\" />\r\n          <xs:enumeration value=\"localization-removesystemlocale\" />\r\n          <xs:enumeration value=\"localization-changelocale\" />\r\n          <xs:enumeration value=\"versioning-view\" />\r\n          <xs:enumeration value=\"versioning-view-disabled\" />\r\n          <xs:enumeration value=\"versioning-compare\" />\r\n          <xs:enumeration value=\"versioning-compare-disabled\" />\r\n          <xs:enumeration value=\"versioning-restore\" />\r\n          <xs:enumeration value=\"versioning-restore-disabled\" />\r\n          <xs:enumeration value=\"tree-add-application\" />\r\n          <xs:enumeration value=\"tree-remove-application\" />\r\n          <xs:enumeration value=\"reportFunctioncction-defaulticon\" />\r\n          <xs:enumeration value=\"developerapplication-treedefinitionroot\" />\r\n          <xs:enumeration value=\"developerapplication-treedefinition\" />\r\n          <xs:enumeration value=\"developerapplication-treedefinition-add\" />\r\n          <xs:enumeration value=\"developerapplication-treedefinition-delete\" />          \r\n        </xs:restriction>\r\n      </xs:simpleType>-->\r\n    </xs:attribute>\r\n  </xs:attributeGroup>\r\n\r\n  <xs:attributeGroup name=\"ViewIconGroup\">\r\n    <xs:attribute name=\"ViewIcon\" use=\"optional\" type=\"xs:string\" >\r\n      <xs:annotation>\r\n        <xs:documentation>The icon of the view</xs:documentation>\r\n      </xs:annotation>    \r\n    </xs:attribute>\r\n  </xs:attributeGroup>\r\n  \r\n  <xs:attributeGroup name=\"OpenedIconGroup\">\r\n    <xs:attribute name=\"OpenedIcon\" use=\"optional\" type=\"xs:string\" >\r\n      <xs:annotation>\r\n        <xs:documentation>The icon of the element(s).</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n  </xs:attributeGroup>\r\n\r\n\r\n  <xs:attributeGroup name=\"PermissionTypeGroup\">\r\n    <xs:attribute name=\"PermissionTypes\" type=\"xs:string\" use=\"optional\">\r\n      <xs:annotation>\r\n        <xs:documentation>\r\n          A comma speperated list of one or more of the following values: read, edit, add, delete, approve, publish, administrate. Default value is read\r\n        </xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n  </xs:attributeGroup>\r\n\r\n  <xs:attributeGroup name=\"DataFolderElementCommonGroup\">\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n    <xs:attribute name=\"FieldGroupingName\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>Field name of the given data interface (property name)</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"DateFormat\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>Date format used when grouping. Year: y, yy, yyy, yyyy. Month: M, MM, MMM, MMM. Day: d, dd, ddd, dddd. Hour: h, H, hh, HH. Minute: m, mm. Second: s, ss</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"Range\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>Defining ranges for the folders. Ex: \"0>10, 11>20, 21>\" or \"A>F, G>Z\"</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"FirstLetterOnly\" use=\"optional\" type=\"xs:boolean\">\r\n      <xs:annotation>\r\n        <xs:documentation>This attribute will make the grouping be done with the first letter only</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n  </xs:attributeGroup>\r\n\r\n  <!-- ========================= Element types ======================== -->\r\n\r\n  <xs:complexType name=\"ElementType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This defines a simple element (or folder)</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:all>\r\n      <xs:element name=\"Children\" type=\"ChildrenType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"Actions\" type=\"ActionsType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n    </xs:all>\r\n\r\n    <xs:attribute name=\"Id\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>This should be a unique string with the tree. Changing this id will render any security settings set on the element non valid</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"Label\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the element. Use ${C1:Data:[TypeName]:[FieldName]} to get a field value of a parent (or self) data element. Use ${C1:Data:[TypeName]:[FieldName]:[Format]} to format dates, decimals and ints using a format supported by .NET ToString() for the type.</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the element. Use ${C1:Data:[TypeName]:[FieldName]} to get a field value of a parent (or self) data element. Defaults to the label. Use ${C1:Data:[TypeName]:[FieldName]:[Format]} to format dates, decimals and ints using a format supported by .NET ToString() for the type.</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n\t\t<xs:attribute name=\"BrowserUrl\" use=\"optional\" type=\"xs:string\">\r\n\t\t\t<xs:annotation>\r\n\t\t\t\t<xs:documentation>Custom URL to display in the console browser when this element is focused.</xs:documentation>\r\n\t\t\t</xs:annotation>\r\n\t\t</xs:attribute>\r\n\r\n\t\t<xs:attribute name=\"BrowserImage\" use=\"optional\" type=\"xs:string\">\r\n\t\t\t<xs:annotation>\r\n\t\t\t\t<xs:documentation>Custom image (URL) to display in the console browser when this element is shown in lists / focused.</xs:documentation>\r\n\t\t\t</xs:annotation>\r\n\t\t</xs:attribute>\r\n\r\n\t\t<xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n    <xs:attributeGroup ref=\"OpenedIconGroup\" />\r\n    \r\n  </xs:complexType>\r\n\r\n\r\n\r\n\r\n\r\n  <!--<xs:complexType name=\"FunctionElementGeneratorType\">\r\n    <xs:annotation>\r\n      <xs:documentation></xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:all>\r\n      <xs:element name=\"FunctionMarkup\" minOccurs=\"1\" maxOccurs=\"1\">\r\n        <xs:complexType>\r\n          <xs:sequence minOccurs=\"1\" maxOccurs=\"1\">\r\n            <xs:element ref=\"func:function\" minOccurs=\"1\" maxOccurs=\"1\" />\r\n          </xs:sequence>\r\n        </xs:complexType>\r\n      </xs:element>\r\n      <xs:element name=\"Children\" type=\"ChildrenType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"Actions\" type=\"ActionsType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n    </xs:all>  \r\n\r\n    <xs:attribute name=\"Label\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the element</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the element. Defaults to the label</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n  </xs:complexType>-->\r\n\r\n\r\n\r\n\r\n  <xs:complexType name=\"DataFolderElementRootType\">\r\n    <xs:all>\r\n      <xs:element name=\"Children\" type=\"DataFolderChildrenType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"Actions\" type=\"DataActionsType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n    </xs:all>\r\n\r\n    <xs:attribute name=\"Type\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>Data interface type name</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"DataFolderElementCommonGroup\" />\r\n\r\n    <xs:attributeGroup ref=\"DisplayGroup\" />\r\n\r\n    <xs:attributeGroup ref=\"SortDirection\" />\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"DataFolderElementType\">\r\n    <xs:all>\r\n      <xs:element name=\"Children\" type=\"DataFolderChildrenType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"Actions\" type=\"DataActionsType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n    </xs:all>\r\n\r\n    <xs:attributeGroup ref=\"DataFolderElementCommonGroup\" />\r\n\r\n    <xs:attribute name=\"ShowForeignItems\" use=\"optional\" type=\"xs:boolean\" default=\"true\">\r\n      <xs:annotation>\r\n        <xs:documentation>When this is set to true, data items not yet localized are shown with a localize action.</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n    \r\n    <xs:attributeGroup ref=\"DisplayGroup\" />\r\n\r\n    <xs:attributeGroup ref=\"SortDirection\" />\r\n  </xs:complexType>\r\n\r\n\r\n\r\n  <xs:complexType name=\"DataElementsType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This defines a simple element (or folder)</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:all>\r\n      <xs:element name=\"OrderBy\" type=\"OrderByType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"Filters\" type=\"FiltersType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"Actions\" type=\"DataActionsType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n      <xs:element name=\"Children\" type=\"ChildrenType\" minOccurs=\"0\" maxOccurs=\"1\"/>\r\n    </xs:all>\r\n\r\n    <xs:attribute name=\"Type\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>Data interface type name</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n\r\n    <xs:attribute name=\"Label\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>Custom label for each data item. Use ${C1:Data:[TypeName]:[FieldName]} to get a field value of a parent (or self) data element. Default is the data types label field value</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>Custom tooltip for each data item. Use ${C1:Data:[TypeName]:[FieldName]} to get a field value of a parent (or self) data element. Default is the data types label field value or if specified, the value of the custom label</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n\r\n    <xs:attribute name=\"ShowForeignItems\" use=\"optional\" type=\"xs:boolean\" default=\"true\">\r\n      <xs:annotation>\r\n        <xs:documentation>When this is set to true, data items not yet localized are shown with a localize action.</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n\r\n\t\t<xs:attribute name=\"BrowserUrl\" use=\"optional\" type=\"xs:string\">\r\n\t\t\t<xs:annotation>\r\n\t\t\t\t<xs:documentation>Custom URL for each data item, to display in the console browser when this element is focused. Use ${C1:Data:[TypeName]:[FieldName]} to get a field value of a parent (or self) data element.</xs:documentation>\r\n\t\t\t</xs:annotation>\r\n\t\t</xs:attribute>\r\n\r\n\t\t\r\n\t\t<xs:attribute name=\"BrowserImage\" use=\"optional\" type=\"xs:string\">\r\n\t\t\t<xs:annotation>\r\n\t\t\t\t<xs:documentation>Custom image (URL) for each data item, to display in the console browser when this element is focused. Use ${C1:Data:[TypeName]:[FieldName]} to get a field value of a parent (or self) data element.</xs:documentation>\r\n\t\t\t</xs:annotation>\r\n\t\t</xs:attribute>\r\n\r\n\t\t\r\n\t\t<xs:attributeGroup ref=\"DisplayGroup\" />\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n    <xs:attributeGroup ref=\"OpenedIconGroup\" />\r\n    \r\n  </xs:complexType>\r\n\r\n\r\n  <!-- ========================= Action types ======================== -->\r\n\r\n  <xs:complexType name=\"AddDataActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This defines a simple element (or folder)</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"Type\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The type of the data to add</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"Label\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action. Defaults to localized version of the string 'Add'</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the label</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n    <xs:attribute name=\"CustomFormMarkupPath\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>A path to an alternate C1 Form UI XML file</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n  </xs:complexType>\r\n\r\n\r\n\r\n  <xs:complexType name=\"EditDataActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This defines a simple element (or folder)</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"Label\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action. Defaults to the localized version of the string 'Edit'</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the label</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n    <xs:attribute name=\"CustomFormMarkupPath\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>A path to an alternate C1 Form UI XML file</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"DeleteDataActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This defines a simple element (or folder)</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"Label\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action. Defaults to the localized version of the string 'delete'</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the label</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n  </xs:complexType>\r\n\r\n  <xs:complexType name=\"DuplicateDataActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This defines a simple element (or folder)</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"Label\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action. Defaults to the localized version of the string 'delete'</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the label</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"ReportFunctionActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>\r\n        Use this element to show a document with custom conternt.\r\n        The content of the element should be a C1 function call that returns XHTML\r\n      </xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:sequence minOccurs=\"1\" maxOccurs=\"1\">\r\n      <xs:element ref=\"func:function\" minOccurs=\"1\" maxOccurs=\"1\" />\r\n    </xs:sequence>\r\n\r\n    <xs:attribute name=\"Label\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the value of the Label attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n    <xs:attribute name=\"DocumentLabel\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the document. Use ${C1:Data:[TypeName]:[FieldName]} to get a field value of a parent (or self) data element. Defaults to the value of the Label attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"DocumentIcon\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The icon of the document. Defaults to the value of the Icon attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"PermissionTypeGroup\" />\r\n  </xs:complexType>\r\n\r\n\r\n\r\n  <xs:complexType name=\"MessageBoxActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>\r\n        Use this element to show a simple message box.\r\n      </xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"Label\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the value of the Label attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n\r\n    <xs:attribute name=\"MessageBoxTitle\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The title of the message box</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"MessageBoxMessage\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The message of the message box</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"MessageDialogType\" use=\"optional\">\r\n      <xs:annotation>\r\n        <xs:documentation>The type of the message box</xs:documentation>\r\n      </xs:annotation>\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"message\" />\r\n          <xs:enumeration value=\"question\" />\r\n          <xs:enumeration value=\"warning\" />\r\n          <xs:enumeration value=\"error\" />\r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"PermissionTypeGroup\" />\r\n  </xs:complexType>\r\n\r\n\r\n\r\n  <xs:complexType name=\"CustomUrlActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>\r\n        Use this element to open a custom url.\r\n      </xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:sequence minOccurs=\"0\" maxOccurs=\"1\">\r\n      <xs:element name=\"PostParameters\" minOccurs=\"0\" maxOccurs=\"1\">\r\n        <xs:complexType>\r\n          <xs:sequence minOccurs=\"1\" maxOccurs=\"unbounded\">\r\n            <xs:element name=\"Parameter\">\r\n              <xs:complexType>\r\n\r\n                <xs:attribute name=\"Key\" use=\"required\" type=\"xs:string\">\r\n                  <xs:annotation>\r\n                    <xs:documentation>The label of the action</xs:documentation>\r\n                  </xs:annotation>\r\n                </xs:attribute>\r\n\r\n                <xs:attribute name=\"Value\" use=\"required\" type=\"xs:string\">\r\n                  <xs:annotation>\r\n                    <xs:documentation>The label of the action</xs:documentation>\r\n                  </xs:annotation>\r\n                </xs:attribute>\r\n\r\n              </xs:complexType>\r\n            </xs:element>\r\n          </xs:sequence>\r\n        </xs:complexType>\r\n      </xs:element>\r\n    </xs:sequence>\r\n\r\n    <xs:attribute name=\"Label\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the value of the Label attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n    <xs:attribute name=\"Url\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The url to open</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ViewLabel\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the view. Defaults to the value of the Label attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ViewToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the view. Defaults to the value of the ToolTip attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"ViewIconGroup\" />    \r\n\r\n    <xs:attribute name=\"ViewType\" use=\"optional\" default=\"genericview\">\r\n      <xs:annotation>\r\n        <xs:documentation>The view type</xs:documentation>\r\n      </xs:annotation>\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"genericview\" />\r\n          <xs:enumeration value=\"documentview\" />\r\n          <xs:enumeration value=\"pagebrowser\" />\r\n          <xs:enumeration value=\"filedownload\" />\r\n          <xs:enumeration value=\"externalview\" />\r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"PermissionTypeGroup\" />\r\n\r\n  </xs:complexType>\r\n\r\n\r\n\r\n  <xs:complexType name=\"ConfirmActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>\r\n        Use this element to show a confirm box and if the user presses 'Ok' the embedded C1 function is executed\r\n      </xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:sequence minOccurs=\"1\" maxOccurs=\"1\">\r\n      <xs:element ref=\"func:function\" minOccurs=\"1\" maxOccurs=\"1\" />\r\n    </xs:sequence>\r\n\r\n    <xs:attribute name=\"Label\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the value of the Label attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n\r\n    <xs:attribute name=\"ConfirmTitle\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The title of the confirm box</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ConfirmMessage\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The message of the confirm box</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"RefreshTree\" use=\"optional\" type=\"xs:boolean\" default=\"false\">\r\n      <xs:annotation>\r\n        <xs:documentation>Make a tree refresh if the user presses 'Ok'</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n\r\n    <xs:attributeGroup ref=\"PermissionTypeGroup\" />\r\n\r\n    <xs:attributeGroup ref=\"LocationGroup\" />\r\n  </xs:complexType>\r\n\r\n\r\n\r\n  <xs:complexType name=\"WorkflowActionType\">\r\n    <xs:annotation>\r\n      <xs:documentation>\r\n        Use this element to start an existing workflow\r\n      </xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"Label\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The label of the action</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ToolTip\" use=\"optional\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The tool tip of the action. Defaults to the value of the Label attribute</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"IconGroup\" />\r\n\r\n    <xs:attribute name=\"WorkflowType\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The type of the workflow</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attributeGroup ref=\"PermissionTypeGroup\" />\r\n\r\n    <xs:attributeGroup ref=\"LocationGroup\" />\r\n  </xs:complexType>\r\n\r\n  <!-- ========================= Filter types ======================== -->\r\n\r\n  <xs:complexType name=\"ParentIdFilterType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This filter specifies that only those data elements that have the parent pointed to in the current tree will be shown.</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"ParentType\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The type of the parent to filter on</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"ReferenceFieldName\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The name of the field that is the reference to the parent type</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"FieldFilterType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This filter specifies that only those data elements which field given by the FieldName attribute has the value given by the FieldValue attribute will be shown</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"FieldName\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The name of the field to filter byon</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"FieldValue\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The value of the field for which the elements will be shown</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"Operator\" use=\"optional\" default=\"equal\" >\r\n      <xs:annotation>\r\n        <xs:documentation>The name of the field that is the reference to the parent type</xs:documentation>\r\n      </xs:annotation>\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"equal\" />\r\n          <xs:enumeration value=\"inequal\" />\r\n          <xs:enumeration value=\"greater\" />\r\n          <xs:enumeration value=\"lesser\" />\r\n          <xs:enumeration value=\"greaterequal\" />\r\n          <xs:enumeration value=\"lesserequal\" />\r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n  </xs:complexType>\r\n\r\n\r\n  <xs:complexType name=\"FunctionFilterType\">\r\n    <xs:annotation>\r\n      <xs:documentation>Use this element to insert a C1 function as a filter function</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:sequence minOccurs=\"1\" maxOccurs=\"1\">\r\n      <xs:element ref=\"func:function\" minOccurs=\"1\" maxOccurs=\"1\" />\r\n    </xs:sequence>\r\n  </xs:complexType>\r\n\r\n  <!-- ========================= OrderBy types ======================== -->\r\n\r\n  <xs:complexType name=\"FieldOrderByType\">\r\n    <xs:annotation>\r\n      <xs:documentation>This will order the resulting data elements by the given field ascending or descending.</xs:documentation>\r\n    </xs:annotation>\r\n\r\n    <xs:attribute name=\"FieldName\" use=\"required\" type=\"xs:string\">\r\n      <xs:annotation>\r\n        <xs:documentation>The name of the field that should be used to order by</xs:documentation>\r\n      </xs:annotation>\r\n    </xs:attribute>\r\n\r\n    <xs:attribute name=\"Direction\" use=\"optional\" default=\"ascending\" >\r\n      <xs:annotation>\r\n        <xs:documentation>The name of the field that is the reference to the parent type</xs:documentation>\r\n      </xs:annotation>\r\n      <xs:simpleType>\r\n        <xs:restriction base=\"xs:string\">\r\n          <xs:enumeration value=\"ascending\" />\r\n          <xs:enumeration value=\"descending\" />\r\n        </xs:restriction>\r\n      </xs:simpleType>\r\n    </xs:attribute>\r\n  </xs:complexType>\r\n\r\n\r\n  <!-- ========================= Main document ======================== -->\r\n\r\n  <xs:element name=\"ElementStructure\">\r\n    <xs:annotation>\r\n      <xs:documentation xml:lang=\"en-us\">This is the root of the tree markup</xs:documentation>\r\n    </xs:annotation>\r\n    <xs:complexType>\r\n      <xs:all>\r\n        <xs:element name=\"ElementStructure.AutoAttachments\" type=\"ElementStructure.AutoAttachmentsType\" maxOccurs=\"1\" minOccurs=\"0\" />\r\n        <xs:element name=\"ElementStructure.AllowedAttachments\" type=\"ElementStructure.AllowedAttachmentsType\" maxOccurs=\"1\" minOccurs=\"0\" />\r\n        <xs:element name=\"ElementRoot\" type=\"ElementRootType\" minOccurs=\"1\" maxOccurs=\"1\" />\r\n      </xs:all>\r\n    </xs:complexType>\r\n  </xs:element>\r\n</xs:schema>\r\n"
  },
  {
    "path": "Website/Composite/schemas/default.aspx",
    "content": "﻿<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"default.aspx.cs\" Inherits=\"Composite_schemas_default\" %>\r\n\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" >\r\n<head runat=\"server\">\r\n    <title>Untitled Page</title>\r\n</head>\r\n<body>\r\n    <form id=\"form1\" runat=\"server\">\r\n    <div>\r\n    \r\n    </div>\r\n    </form>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/schemas/default.aspx.cs",
    "content": "﻿using System;\r\nusing System.Collections;\r\nusing System.Configuration;\r\nusing System.Data;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Security;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\nusing System.Web.UI.WebControls;\r\nusing System.Web.UI.WebControls.WebParts;\r\nusing System.Xml.Linq;\r\n\r\npublic partial class Composite_schemas_default : System.Web.UI.Page\r\n{\r\n    protected void Page_Load(object sender, EventArgs e)\r\n    {\r\n        Response.Redirect(\"FormsControls/GenerateDynamicSchemas.aspx\");\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/schemas/default.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:2.0.50727.3082\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_schemas_default {\r\n    \r\n    /// <summary>\r\n    /// form1 control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.HtmlControls.HtmlForm form1;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/folder-info-readme.txt",
    "content": "Understand folder structure:\r\n\r\n\t1) Scripts in \"top\" folder are only included in root window.\r\n\t2) Scrips in \"page\" folder are included in subframes and popups.\r\n\r\nObserve folder agenda:\r\n\r\n\t1) Please no global functions in this folder!\r\n\t2) You should only define \"classes\" and methods around here.\r\n\t3) If in doubt, consult the generated JSDoc output.\r\n\t4) Restrictions don't apply to scripts in the \"/content\" folder.\r\n\r\nNote syntactic conventions:\r\n\r\n\tFiles have been coded to play well with the Eclipse Web Tools 3.0 platform.\r\n\tThis offeers cool features for Javascript authoring such as code-insight (intellisense) \r\n\tand class exploration. These features requires a certain authoring style otherwise  \r\n\tnot recommended; but this is the limitation of the platform. \r\n\t\r\n\tRead more: http://www.eclipse.org/atf/"
  },
  {
    "path": "Website/Composite/scripts/source/page/data/DataManager.js",
    "content": "/**\r\n * Accessed through instance variable \"WindowManager\" declared below.\r\n */\r\nfunction _DataManager () {}\r\n_DataManager.prototype = {\r\n\t\r\n\t/**\r\n\t * Flip to enable Ajax style postback and update.\r\n\t * @type {boolean}\r\n\t */\r\n\tisPostBackFun : false,\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"DataManager [\" + document.title + \"]\" ),\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><IData>}\r\n\t */\r\n\t_dataBindings : {},\r\n\t\r\n\t/**\r\n\t * This dirty flag will be falsed by a \"persist\" or \"save\" postMessage. \r\n\t * If true, something was changed in this document since last postMessage.\r\n\t * @see {PageBinding#postMessage}  \r\n\t * @type {boolean}\r\n\t */\r\n\tisDirty : false,\r\n\t\r\n\t/**\r\n\t * Make binding AND DataManager dirty. \r\n\t * 1) The binding will remain dirty until \"save\" is successful (note success!) \r\n\t * 2) DataManager is dirty until a \"save\" or \"persist\" postMessage is attempted. \r\n\t * @param {DataBinding} binding\r\n\t * @return {boolen} True if the binding switched to dirty\r\n\t */\r\n\tdirty : function ( binding ) {\r\n\t\t\r\n\t\tthis.isDirty = true;\r\n\t\t\r\n\t\tvar result = false;\r\n\t\tif ( binding != null && !binding.isDirty ) {\t\r\n\t\t\tbinding.isDirty = true;\r\n\t\t\tbinding.dispatchAction ( Binding.ACTION_DIRTY );\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\t\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Make binding clean.\r\n\t * @param {DataBinding} binding\r\n\t */\r\n\tclean : function ( binding ) {\r\n\t\t\r\n\t\tif ( binding.isDirty ) {\r\n\t\t\tbinding.isDirty = false;\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Register DataBinding. Remember that this will only happen \r\n\t * automatically if and when the DataBinding has a name property.\r\n\t * @param {string} name\r\n\t * @param {DataBinding} binding\r\n\t */\r\n\tregisterDataBinding : function ( name, binding ) {\r\n\t\t\r\n\t\tif ( Interfaces.isImplemented ( IData, binding, true )) {\r\n\t\t\tif ( this._dataBindings [ name ] != null ) {\r\n\t\t\t\tthrow \"no proper support for checkbox multiple values! \" + name ;\r\n\t\t\t} else {\r\n\t\t\t\tthis._dataBindings [ name ] = binding;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthrow \"Invalid DataBinding: \" + binding;\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Unregister DataBinding.\r\n\t * @param {string} name\r\n\t */\r\n\tunRegisterDataBinding : function ( name ) {\r\n\t\t\r\n\t\tif ( this._dataBindings [ name ] != null ) {\r\n\t\t\tdelete this._dataBindings [ name ];\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Get DataBinding by name.\r\n\t * @return {DataBinding}\r\n\t */\r\n\tgetDataBinding : function ( name ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tif ( this._dataBindings [ name ] != null ) {\r\n\t\t\tresult = this._dataBindings [ name ];\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Get list of all DataBindings - possibly even from descendant windows.\r\n\t * @param {boolean} isTraverse\r\n\t * @return {List<DataBinding>}\r\n\t */\r\n\tgetAllDataBindings : function ( isTraverse ) {\r\n\t\t\r\n\t\tvar list = new List ();\r\n\t\tfor ( var name in this._dataBindings ) {\r\n\t\t\tvar binding = this._dataBindings [ name ];\r\n\t\t\tlist.add ( binding );\r\n\t\t\tif ( isTraverse && binding instanceof WindowBinding ) {\r\n\t\t\t\tvar manager = binding.getContentWindow ().DataManager;\r\n\t\t\t\tif ( manager != null ) {\r\n\t\t\t\t\tlist.merge ( manager.getAllDataBindings ());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn list;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Has DataBindings?\r\n\t * @return {boolean}\r\n\t */\r\n\thasDataBindings : function () {\r\n\t\t\r\n\t\tvar result = false;\r\n\t\tfor ( var name in this._dataBindings ) {\r\n\t\t\tresult = true;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Populate DataBindings.\r\n\t * @param {DataBindingMap} map\r\n\t */\r\n\tpopulateDataBindings : function ( map ) {\r\n\t\t\r\n\t\tif ( map instanceof DataBindingMap ) {\r\n\t\t\tmap.each ( function ( name, value ) {\r\n\t\t\t\tvar dataBinding = this._dataBindings [ name ];\r\n\t\t\t\tif ( dataBinding != null ) {\r\n\t\t\t\t\tswitch ( map.type ) {\r\n\t\t\t\t\t\tcase DataBindingMap.TYPE_RESULT :\r\n\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\tdataBinding.setResult ( value );\r\n\t\t\t\t\t\t\t} catch ( exception ) {\r\n\t\t\t\t\t\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\t\t\t\t\t\talert ( dataBinding );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tthrow exception;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase DataBindingMap.TYPE_VALUE :\r\n\t\t\t\t\t\t\tthrow \"Not implemented!\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Collect all DataBinding values in a single name-value hashmap.\r\n\t * @return {HashMap<string><string>}\r\n\t */\r\n\tgetDataBindingValueMap : function () {\r\n\t\t\r\n\t\tvar result = new DataBindingMap ();\r\n\t\tresult.type = DataBindingMap.TYPE_VALUE;\r\n\t\t\r\n\t\tfor ( var name in this._dataBindings ) {\r\n\t\t\tvar dataBinding = this._dataBindings [ name ];\r\n\t\t\tif ( dataBinding instanceof DataDialogBinding ) {\r\n\t\t\t\tthrow \"DataDialogBinding valuemap not supported!\";\r\n\t\t\t}\r\n\t\t\tresult [ name ] = dataBinding.getValue ();\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Collect and combine all DataBinding results in a single DataBindingMap.\r\n\t * Notice that we call the getResult method instead of getValue. The \"value\"\r\n\t * is for the serverside while the \"result\" is automatically typecasted \r\n\t * for clientside handling and/or can be set to complex objects.\r\n\t * @return {DataBindingMap} \r\n\t */\r\n\tgetDataBindingResultMap : function () {\r\n\t\t\r\n\t\tvar result = new DataBindingMap ();\r\n\t\tresult.type = DataBindingMap.TYPE_RESULT;\r\n\t\t\r\n\t\tfor ( var name in this._dataBindings ) {\r\n\t\t\tvar binding = this._dataBindings [ name ];\r\n\t\t\tvar res = binding.getResult ();\r\n\t\t\tif ( res instanceof DataBindingMap ) {\r\n\t\t\t\tres.each ( function ( name, value ) {\r\n\t\t\t\t\tresult.set ( name, value );\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tresult.set ( name, res );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Harvest form elements to produce a humongous querystring. This will collect  \r\n\t * all form elements, not just those produced by the DataBinding manifest method.\r\n\t */\r\n\tgetPostBackString : function () {\r\n\t\t\r\n\t\tvar result = \"\";\r\n\t\tvar form = document.forms [ 0 ];\r\n\t\t\r\n\t\tif ( form != null ) {\r\n\t\t\tvar lastname = \"\";\r\n\t\t\tnew List ( form.elements ).each ( function ( element ) {\r\n\t\t\t\t\r\n\t\t\t\tvar name = element.name;\r\n\t\t\t\tvar value = encodeURIComponent ( element.value );\r\n\t\t\t\t\r\n\t\t\t\tswitch ( element.type ) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tcase \"text\":\r\n\t\t\t\t\tcase \"hidden\":\r\n\t\t\t\t\tcase \"password\":\r\n\t\t\t\t\tcase \"textarea\":\r\n\t\t\t\t\tcase \"select-one\" :\r\n\t\t\t\t\t\tresult += name + \"=\" + value + \"&\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tcase \"submit\" :\r\n\t\t\t\t\t\tif ( document.activeElement == element ) { // or what?\r\n\t\t\t\t\t\t\tresult += name + \"=\" + value + \"&\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tcase \"radio\":\r\n\t\t\t\t\t\tif ( element.checked ) {\r\n\t\t\t\t\t\t\tresult += name + \"=\" + value + \"&\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tcase \"checkbox\":\r\n\t\t\t\t\t\tif ( element.checked ) {\r\n\t\t\t\t\t\t\tif ( element.name == lastname ) {\r\n\t\t\t\t\t\t\t\tif ( result.lastIndexOf ( \"&\" ) == result.length - 1 ) {\r\n\t\t\t\t\t\t\t\t\tresult = result.substr ( 0, result.length - 1 );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tresult += \",\" + value;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tresult += name + \"=\" + element.value;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tlastname = name;\r\n\t\t\t\t\t\t\tresult += \"&\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\t\r\n\t\treturn result.substr ( 0, result.length - 1 ); // trailing \"&\"\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_DataManager}\r\n */\r\nvar DataManager = new _DataManager ();"
  },
  {
    "path": "Website/Composite/scripts/source/page/document/DocumentCrawler.js",
    "content": "DocumentCrawler.prototype = new ElementCrawler;\r\nDocumentCrawler.prototype.constructor = DocumentCrawler;\r\nDocumentCrawler.superclass = ElementCrawler.prototype;\r\n\r\nDocumentCrawler.ID = \"documentcrawler\";\r\nDocumentCrawler.MODE_REGISTER = \"register\";\r\nDocumentCrawler.MODE_ATTACH = \"attach\";\r\nDocumentCrawler.MODE_DETACH = \"detach\";\r\n\r\n/**\r\n * @class\r\n * This be the crawler that attaches and detaches bindings. When a binding has \r\n * the DocumentCrawler.ID included in it's \"crawlerFilters\" property, it means \r\n * that the binding is not supposed to have descendant bindings (or that the  \r\n * binding will handle descendant bindings registration and attachment itself).\r\n */\r\nfunction DocumentCrawler () {\r\n\t\r\n\tthis.mode = DocumentCrawler.MODE_REGISTER;\r\n\tthis.id = DocumentCrawler.ID;\r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * @overloads {Crawler#_construct} \r\n */\r\nDocumentCrawler.prototype._construct = function () {\r\n\t\r\n\tDocumentCrawler.superclass._construct.call ( this );\r\n\t\r\n\tvar self = this;\r\n\tthis.addFilter ( function ( element, list ) {\r\n\t\t\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\tvar result = null;\r\n\t\t\r\n\t\tswitch ( self.mode ) {\r\n\t\t\t\r\n\t\t\tcase DocumentCrawler.MODE_REGISTER :\r\n\t\t\t\tif ( binding == null ) {\r\n\t\t\t\t\tUserInterface.registerBinding ( element );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DocumentCrawler.MODE_ATTACH :\r\n\t\t\t\tif ( binding != null ) {\r\n\t\t\t\t\tif ( !binding.isAttached ) {\r\n\t\t\t\t\t\tlist.add ( binding );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( binding.isLazy == true ) {\r\n\t\t\t\t\t\tresult = NodeCrawler.SKIP_CHILDREN;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DocumentCrawler.MODE_DETACH :\r\n\t\t\t\tif ( binding != null ) {\r\n\t\t\t\t\tlist.add ( binding );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/page/document/DocumentManager.js",
    "content": "/**\r\n * Accessed through instance variable \"DocumentManager\" declared below.\r\n */\r\nfunction _DocumentManager () {\r\n\t\r\n\tthis._construct ();\r\n}\r\n\r\n_DocumentManager.prototype = {\r\n\t\r\n\t_logger\t: SystemLogger.getLogger ( \"DocumentManager [\" + document.title + \"]\" ),\r\n\t_maxIndex : -1, // MOVE THIS!\r\n\t\r\n\t/**\r\n\t * Exposes special binding associations for the {@link UserInterface}.\r\n\t * @type {UserInterfaceMapping} \r\n\t */\r\n\tcustomUserInterfaceMapping : null,\r\n\t\r\n\t/**\r\n\t * Determines whether or not document text is selectable.\r\n\t * @type {boolean}\r\n\t */\r\n\tisDocumentSelectable : false,\r\n\t\r\n\t/**\r\n\t * Determines whether or not to display the browsers own contextmenu on rightclick.\r\n\t * Note that the contextmenu will *not* be disabled for textareas and inputfields.\r\n\t * @type {boolean}\r\n\t */\r\n\thasNativeContextMenu : false,\r\n\t\r\n\t/**\r\n\t * Constructor action.\r\n\t */\r\n\t_construct : function () {\r\n\t\r\n\t\t/*\r\n\t\t * Setup standard framework event listeners.\r\n\t\t * Intercepting mousedown, mousemov, mouseup, keydown, keyup.\r\n\t\t */\r\n\t\tApplication.framework ( document );\r\n\t\t\r\n\t\t/*\r\n\t\t * Initializing when window is fully loaded.\r\n\t\t * 1) Setup textcontent selection.\r\n\t\t * 2) Setup contextmenu handling\r\n\t\t * 3) Resolve custom bindings\r\n\t\t * 4) Resolve lazy bindings\r\n\t\t * 5) Attach bindings.\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( WindowManager.WINDOW_LOADED_BROADCAST, this );\r\n\t\t\r\n\t\t/*\r\n\t\t * For explorer, disable audible clicks when navigating dummy hypertext links.\r\n\t\t */\r\n\t\tif ( Client.isExplorer ) {\r\n\t\t\tDOMEvents.addEventListener ( document, DOMEvents.CLICK, this );\r\n\t\t}\r\n\t\t\r\n\t},\r\n\t\r\n\t/**\r\n\t * @implements {IBroadcastListener}\r\n\t * @param {String} broadcast\r\n\t * @param {Object} arg\r\n\t */\r\n\thandleBroadcast : function ( broadcast, arg ) {\r\n\t\t\r\n\t\tif ( !this.isDocumentSelectable ) {\r\n\t\t\tthis._makeDocumentUnselectable ();\r\n\t\t}\r\n\t\tif ( !this.hasNativeContextMenu ) {\r\n\t\t\tDOMEvents.addEventListener ( document, DOMEvents.CONTEXTMENU, this );\r\n\t\t}\r\n\t\tif ( !Application.isMalFunctional ) {\r\n\t\t\tthis._resolveCustomBindingMappings ();\r\n\t\t\tthis.attachBindings ( document.documentElement);\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * @implements {IEventListener}\r\n\t * @param {Event} e\r\n\t */\r\n\thandleEvent : function ( e ) {\r\n\t\t\r\n\t\tvar target = DOMEvents.getTarget ( e );\r\n\t\t\r\n\t\tswitch ( e.type ) {\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.SELECTSTART :\r\n\t\t\tcase DOMEvents.CONTEXTMENU :\r\n\t\t\t\tif ( !this._isTextInputElement ( target )) {\r\n\t\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase DOMEvents.CLICK :\r\n\t\t\t\tif ( Client.isExplorer ) {\r\n\t\t\t\t\tif ( target != null ) {\r\n\t\t\t\t\t\tif ( target.href != null && target.href.indexOf ( Constants.DUMMY_LINK ) >-1 ) {\r\n\t\t\t\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\t\r\n\t\r\n\t/** \r\n\t * Resolve custom bindingmappings scoped for this window. \r\n\t * This is done here, not in a ordinary Binding, because \r\n\t * we need this stuff to be evaluated max pronto up front.\r\n\t */\r\n\t_resolveCustomBindingMappings : function () {\r\n\t\t\r\n\t\tvar bindingset = DOMUtil.getElementsByTagName ( document.documentElement, \"bindingmappingset\" ).item ( 0 );\r\n\t\tif ( bindingset != null ) {\r\n\t\t\tvar map = {};\r\n\t\t\tvar mappings = DOMUtil.getElementsByTagName ( bindingset, \"bindingmapping\" );\r\n\t\t\tnew List ( mappings ).each (\r\n\t\t\t\tfunction ( mapping ) {\r\n\t\t\t\t\tvar element = mapping.getAttribute ( \"element\" );\r\n\t\t\t\t\tvar binding = mapping.getAttribute ( \"binding\" );\r\n\t\t\t\t\tmap [ element ] = eval ( binding );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\tthis.setCustomUserInterfaceMapping (\r\n\t\t\t\tnew UserInterfaceMapping ( map )\r\n\t\t\t);\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Register custom bindingmapping. This will merge with any previously registerd mapping.\r\n\t * @param {UserInterfaceMapping} mapping\r\n\t */\r\n\tsetCustomUserInterfaceMapping : function ( mapping ) {\r\n\t\t\r\n\t\tif ( this.customUserInterfaceMapping == null ) {\r\n\t\t\tthis.customUserInterfaceMapping = mapping;\r\n\t\t} else {\r\n\t\t\tthis.customUserInterfaceMapping.merge ( mapping );\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Register bindings on and within a given container.\r\n\t * @param {DOMElement} element\r\n\t */\r\n\t_registerBindings : function ( element ) {\r\n\t\t\r\n\t\tvar crawler = new DocumentCrawler ();\r\n\t\tcrawler.mode = DocumentCrawler.MODE_REGISTER;\r\n\t\tcrawler.crawl ( element );\r\n\t\tcrawler.dispose ();\r\n\t},\r\n\t\r\n\t/**\r\n\t * Attach bindings on and within a given container.\r\n\t * @param {DOMElement} container\r\n\t */\r\n\t_attachBindings : function ( container ) {\r\n\t\t\r\n\t\tvar crawler = new DocumentCrawler ();\r\n\t\tcrawler.mode = DocumentCrawler.MODE_ATTACH;\r\n\t\t\r\n\t\tvar list = new List ();\r\n\t\tcrawler.crawl ( container, list );\r\n\t\t\r\n\t\t/*\r\n\t\t * Because bindings may modify DOM structure upon \r\n\t\t * attachment (confusing the crawler), we collect them \r\n\t\t * all in a list before we invoke the onBindingAttach.\r\n\t\t */\r\n\t\tvar wasDataBinding = false;\r\n\t\twhile ( list.hasNext ()) {\r\n\t\t\tvar binding = list.getNext ();\r\n\t\t\tif ( !binding.isAttached ) {\r\n\t\t\t\tbinding.onBindingAttach ();\r\n\t\t\t\tif ( !binding.memberDependencies ) {\r\n\t\t\t\t\tbinding.onBindingInitialize ();\r\n\t\t\t\t}\r\n\t\t\t\tif ( Interfaces.isImplemented ( IData, binding )) {\r\n\t\t\t\t\twasDataBinding = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * TODO: NOT ON DISPOSE PAGE!\r\n\t\t * Update the focus list. Technically, the binding itself \r\n\t\t * should dispatch this (root may be located to high in the tree), \r\n\t\t * but this will stress up on bulk attachment via UpdateManager.  \r\n\t\t */\r\n\t\tif ( wasDataBinding ) {\r\n\t\t\tvar root = UserInterface.getBinding ( document.body );\r\n\t\t\tif ( root != null ) {\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tif ( Binding.exists ( root )) {\r\n\t\t\t\t\t\troot.dispatchAction ( FocusBinding.ACTION_UPDATE );\r\n\t\t\t\t\t}\r\n\t\t\t\t}, 250 );\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tcrawler.dispose ();\r\n\t\tlist.dispose ();\r\n\t},\r\n\r\n\t/** \r\n\t * Attach bindings on and within a given element.\r\n\t * @param {DOMElement} element\r\n\t * @param {boolean} isTiming\r\n\t */\r\n\tattachBindings : function ( element ) {\r\n\t\t\r\n\t\tthis._registerBindings ( element );\r\n\t\tthis._attachBindings ( element );\r\n\t},\r\n\r\n\t/** \r\n\t * Detach bindings within and on a given element.\r\n\t * @param {DOMElement} element\r\n\t * @param {boolean} isElemnentSafe If true, only element descendants will detach.\r\n\t */\r\n\tdetachBindings : function ( element, isElementSafe ) {\r\n\t\r\n\t\tvar crawler = new DocumentCrawler ();\r\n\t\tcrawler.mode = DocumentCrawler.MODE_DETACH;\r\n\t\t\r\n\t\tvar list = new List ();\r\n\t\tcrawler.crawl ( element, list );\r\n\t\t\r\n\t\t/*\r\n\t\t * Preserve binding on container element?\r\n\t\t */\r\n\t\tif ( isElementSafe == true ) {\r\n\t\t\tlist.extractFirst ();\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * Reverse collection, disposing bindings from deepest position in DOM tree.\r\n\t\t * This way, bindings will still have access to parent bindings when disposed. \r\n\t\t * Please not that we only nuke the Binding objects here, not the DOMElements, \r\n\t\t * as designated by the boolean argument passed to Binding#dispose.\r\n\t\t */\r\n\t\tvar wasDataBinding = false;\r\n\t\tlist.reverse ().each ( function ( binding ) {\r\n\t\t\tif ( Interfaces.isImplemented ( IData, binding )) {\r\n\t\t\t\twasDataBinding = true;\r\n\t\t\t}\r\n\t\t\tbinding.dispose ( true );\r\n\t\t});\r\n\t\t\r\n\t\t/*\r\n\t\t * TODO: NOT ON DISPOSE PAGE!\r\n\t\t * Update the focus list. Technically, the binding itself \r\n\t\t * should dispatch this (root may be located to high in the tree), \r\n\t\t * but this will stress up on bulk detachment via UpdateManager.  \r\n\t\t */\r\n\t\tif ( wasDataBinding ) {\r\n\t\t\tvar root = UserInterface.getBinding ( document.body );\r\n\t\t\tif ( root != null ) {\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tif ( Binding.exists ( root )) {\r\n\t\t\t\t\t\troot.dispatchAction ( FocusBinding.ACTION_UPDATE );\r\n\t\t\t\t\t}\r\n\t\t\t\t}, 250 );\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * Cleanup.\r\n\t\t */\r\n\t\tcrawler.dispose ();\r\n\t\tlist.dispose ();\r\n\t},\r\n\t\r\n\t/**\r\n\t * Detach all bindings in document. Invoked when disposing the containing WindowBinding. \r\n\t * Local instances of WindowBinding will detach their bindings recursively, chain reaction.\r\n\t * @see {WindowBinding#onBindingDispose}\r\n\t */\r\n\tdetachAllBindings : function () {\r\n\t\t\r\n\t\tthis.detachBindings ( document.documentElement);\r\n\t},\r\n\t\r\n\t/**\r\n\t * Scann all z-index values and compute a new, highest value. \r\n\t * Elements are actually only scanned when first called;\r\n\t * henceforth the value is simply incremented.\r\n\t * TODO: deprecate?\r\n\t * @return {int}\r\n\t */\r\n\tcomputeMaxIndex : function () {\r\n\t\t\r\n\t\tif ( this._maxIndex == -1 ) {\r\n\t\t\tthis._maxIndex = DOMUtil.getMaxIndex ( document );\r\n\t\t}\r\n\t\treturn this._maxIndex ++;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Test whether or not an element is an interactive text input field.\r\n\t * TODO: optimize\r\n\t * @param {DOMElement} element\r\n\t * @return {boolean}\r\n\t */\r\n\t_isTextInputElement : function ( element ) {\r\n\t\r\n\t\treturn ( /textarea|input/.test ( \r\n\t\t\tDOMUtil.getLocalName ( element )\r\n\t\t));\r\n\t},\r\n\t\r\n\t/*\r\n\t * Prevent non-relevant GUI elements from being selected with the mouse.\r\n\t */\r\n\t_makeDocumentUnselectable : function () {\r\n\t\r\n\t\tif ( Client.isExplorer ) {\r\n\t\t\t\r\n\t\t\tDOMEvents.addEventListener ( document, DOMEvents.SELECTSTART, this );\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t// Ideally, we would say: document.body.style.MozUserSelect = \"none\";\r\n\t\t\t// But if we disable user-selection on root element, a bug \r\n\t\t\t// prevents descendant nodes from being selected (bug 203291).\r\n\t\t\t// Instead, all ui:label elements have been made unselectable via CSS.\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_DocumentManager}\r\n */\r\nvar DocumentManager = new _DocumentManager ();"
  },
  {
    "path": "Website/Composite/scripts/source/page/document/DocumentUpdatePlugin.js",
    "content": "/**\r\n * Integrate the UpdateManager framework with the amazing world of Bindings.\r\n * Accessed through instance variable \"DocumentManager\" declared below.\r\n */\r\nfunction _DocumentUpdatePlugin () {\r\n\r\n\tif ( window.UpdateManager != null ) {\r\n\t\tUpdateManager.plugins.push ( this );\r\n\t\tthis._setup ();\r\n\t}\r\n}\r\n\r\n_DocumentUpdatePlugin.prototype = {\r\n\r\n\t/**\r\n\t * Identification.\r\n\t * @return {String}\r\n\t */\r\n\ttoString : function () {\r\n\r\n\t\treturn \"[DocumentUpdatePlugin]\";\r\n\t},\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"DocumentUpdatePlugin [\" + document.title + \"]\" ),\r\n\r\n\t/**\r\n\t * True while UpdateManager is in action.\r\n\t * @type {boolean}\r\n\t */\r\n\t_isUpdating : false,\r\n\r\n\t/**\r\n\t * Used to delegate element updates of type \"attribute\" to the associated binding.\r\n\t * In other words, let the binding know that the elements attributes were updated.\r\n\t * Remember that this must be wired up using the bindings \"propertyMethodMap\" thingy.\r\n\t * @type {Map<String><String>}\r\n\t */\r\n\t_attributesbuffer : null,\r\n\r\n\t/**\r\n\t * Instead of attaching bindings on sight - when new elements are inserted - we\r\n\t * collect elements in a buffer and attach bindings them in the final phase.\r\n\t * This way, newly attached bindings may be fully aware of document structure.\r\n\t * Note: Updated attributes are evaluated \"on sight\", should this be changed?\r\n\t * @type {List<Element>}\r\n\t */\r\n\t_elementsbuffer : null,\r\n\r\n\t/**\r\n\t * Debug DOM before and after? This throws out a pretty\r\n\t * verbose log statement, so let's not keep it enabled.\r\n\t */\r\n\tisDebugging : Application.isDeveloperMode, // Application.isDeveloperMode\r\n\r\n\t/**\r\n\t * Store before-DOM serialization here so that we\r\n\t * may debug before and after in a single output.\r\n\t * @type {String}\r\n\t */\r\n\t_oldDOM : null,\r\n\r\n\t/**\r\n\t * Refocus last focused binding after replace.\r\n\t * @type {String}\r\n\t */\r\n\t_focusID : null,\r\n\r\n\t/**\r\n\t * UpdateManager configuration and modification.\r\n\t */\r\n\t_setup : function () {\r\n\r\n\t\t/*\r\n\t\t * Prepare UpdatManager for hard work.\r\n\t\t */\r\n\t\tUpdateManager.isDebugging = Application.isDeveloperMode;\r\n\t\tUpdateManager.hasSoftAttributes = true;\r\n\t\tUpdateManager.hasSoftSiblings = true;\r\n\r\n\t\t/*\r\n\t\t * Setup update listeners and handle potential errors.\r\n\t\t */\r\n\t\tDOMEvents.addEventListener ( document, DOMEvents.BEFOREUPDATE, this );\r\n\t\tDOMEvents.addEventListener ( document, DOMEvents.AFTERUPDATE, this );\r\n\t\tDOMEvents.addEventListener ( document, DOMEvents.ERRORUPDATE, this );\r\n\t\tDOMEvents.addEventListener ( window, DOMEvents.UNLOAD, this );\r\n\r\n\t\t/*\r\n\t\t * This evil hackery fixes the glitch where a the Gecko serializer\r\n\t\t * would mess up the prefixes on HTML and UI elements. Since these\r\n\t\t * elements reside in the same namespace, Gecko is perfectly\r\n\t\t * entitled to do so. Unfortunately, it is also perfectly entitled\r\n\t\t * to ignore the evil hack presented below, but it does seem to work.\r\n\t\t * TODO: Verify this after https://bugzilla.mozilla.org/show_bug.cgi?id=368437\r\n\t\t */\r\n\t\tif ( Client.isFirefox ) {\r\n\t\t\tUpdateAssistant.serialize = function ( element ) {\r\n\t\t\t\telement = element.cloneNode ( true ); // don't modify UpdateManager.currentDOM!\r\n\t\t\t\telement.setAttributeNS ( Constants.NS_NS, \"xmlns\", Constants.NS_XHTML );\r\n\t\t\t\telement.setAttributeNS ( Constants.NS_NS, \"xmlns:ui\", Constants.NS_UI );\r\n\t\t\t\treturn this._serializer.serializeToString ( element );\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t},\r\n\r\n\t/**\r\n\t * @implements {IEventListener}\r\n\t * @param {Event} e\r\n\t */\r\n\thandleEvent : function ( e ) {\r\n\r\n\t\tvar target = DOMEvents.getTarget ( e );\r\n\r\n\t\tswitch ( e.type ) {\r\n\r\n\t\t\tcase DOMEvents.BEFOREUPDATE :\r\n\t\t\t\tthis._beforeUpdate ( target );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase DOMEvents.AFTERUPDATE :\r\n\t\t\t\tthis._afterUpdate ( target );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase DOMEvents.ERRORUPDATE :\r\n\t\t\t\tthis._errorUpdate ();\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase DOMEvents.UNLOAD :\r\n\t\t\t\tif ( Application.hasLock ( this )) {\r\n\t\t\t\t\tApplication.unlock ( this );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Invoked before an update AND before any updates.\r\n\t * @param {Element} target\r\n\t */\r\n\t_beforeUpdate : function ( target ) {\r\n\r\n\t\tvar isBeginUpdate = ( target == document.documentElement );\r\n\r\n\t\tif ( isBeginUpdate ) {\r\n\r\n\t\t\tthis._elementsbuffer = new List ();\r\n\r\n\t\t\tthis._isUpdating = true;\r\n\t\t\tApplication.lock ( this ); // TODO: doesn't work in IE\r\n\r\n\t\t\t// notify containing page\r\n\t\t\t// TODO: nice method to locate the page!\r\n\t\t\tvar root = UserInterface.getBinding ( document.body );\r\n\t\t\tif ( root != null ) {\r\n\t\t\t\tvar page = root.getDescendantBindingByType ( PageBinding );\r\n\t\t\t\tif ( page != null ) {\r\n\t\t\t\t\tpage.onBeforeUpdates ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar binding = FocusBinding.focusedBinding;\r\n\t\t\tif ( binding != null ) {\r\n\t\t\t\tthis._focusID = binding.getID ();\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.isDebugging ) {\r\n\t\t\t\tthis._oldDOM = DOMSerializer.serialize ( UpdateManager.currentDOM, true );\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tswitch ( target.__updateType ) {\r\n\t\t\t\tcase Update.TYPE_REPLACE :\r\n\t\t\t\tcase Update.TYPE_REMOVE :\r\n\t\t\t\t\tDocumentManager.detachBindings ( target );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Update.TYPE_ATTRIBUTES :\r\n\t\t\t\t\tthis._backupattributes ( target, false );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Invoked after an update AND after all updates.\r\n\t * @param {Element} target\r\n\t */\r\n\t_afterUpdate : function ( target ) {\r\n\r\n\t\tvar isFinishedUpdate = ( target == document.documentElement );\r\n\r\n\t\tif ( isFinishedUpdate ) {\r\n\r\n\t\t\t/*\r\n\t\t\t * Register and attach new bindings.\r\n\t\t\t */\r\n\t\t\tvar buffer = this._elementsbuffer;\r\n\r\n\t\t\tif ( buffer.hasEntries ()) {\r\n\t\t\t\tbuffer.each(function (element) {\r\n\t\t\t\t\tDocumentManager.attachBindings(element);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * Unlock UI.\r\n\t\t\t */\r\n\t\t\tthis._isUpdating = false;\r\n\t\t\tApplication.unlock ( this );\r\n\r\n\t\t\t// notify containing page\r\n\t\t\t// TODO: nice method to locate the page!\r\n\t\t\tvar root = UserInterface.getBinding ( document.body );\r\n\t\t\tif ( root != null ) {\r\n\t\t\t\tvar page = root.getDescendantBindingByType ( PageBinding );\r\n\t\t\t\tif ( page != null ) {\r\n\t\t\t\t\tpage.onAfterUpdates ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar binding = FocusBinding.focusedBinding;\r\n\t\t\tif ( binding == null ) {\r\n\t\t\t\tvar element = document.getElementById ( this._focusID );\r\n\t\t\t\tif ( element != null ) {\r\n\t\t\t\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\t\t\tif ( binding != null ) {\r\n\t\t\t\t\t\tbinding.focus ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis._focusID = null;\r\n\r\n\t\t\t// debug before and after DOM\r\n\t\t\tif ( UpdateManager.summary != \"\" ) {\r\n\t\t\t\tif ( this.isDebugging ) {\r\n\t\t\t\t\tvar newDOM = DOMSerializer.serialize ( UpdateManager.currentDOM, true );\r\n\t\t\t\t\tvar debug = \"NEW DOM: \" + document.title + \"\\n\\n\" + newDOM + \"\\n\\n\";\r\n\t\t\t\t\tdebug += \"OLD DOM: \" + document.title + \"\\n\\n\" + this._oldDOM;\r\n\t\t\t\t\tthis._logger.debug ( debug );\r\n\t\t\t\t\tthis._oldDOM = null;\r\n\t\t\t\t}\r\n\t\t\t\tthis._logger.fine ( UpdateManager.summary );\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tswitch ( target.__updateType ) {\r\n\t\t\t\tcase Update.TYPE_REPLACE :\r\n\t\t\t\tcase Update.TYPE_INSERT :\r\n\t\t\t\t\tif( target.__isAttached !== false)\r\n\t\t\t\t\t\tthis._elementsbuffer.add ( target );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Update.TYPE_ATTRIBUTES :\r\n\t\t\t\t\tthis._backupattributes ( target, true );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * Dispatch updated status from nearest Binding.\r\n\t\t\t * TODO: Stamp the __updateType for any reason?\r\n\t\t\t */\r\n\t\t\tswitch ( target.id ) {\r\n\r\n\t\t\t\tcase \"__VIEWSTATE\" :\r\n\t\t\t\tcase \"__EVENTTARGET\" :\r\n\t\t\t\tcase \"__EVENTARGUMENT\" :\r\n\t\t\t\tcase \"__EVENTVALIDATION\" :\r\n\t\t\t\tcase \"__LASTFOCUS\" :\r\n\t\t\t\tcase \"__REQUEST\" :\r\n\t\t\t\tcase \"__RESPONSE\" :\r\n\t\t\t\tcase \"__CONSOLEID\" :\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault :\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Note that the Binding.ACTION_UPDATED action is not\r\n\t\t\t\t\t * always targetted at the binding that got updated;\r\n\t\t\t\t\t * but it will let a dialog know that layout was changed...\r\n\t\t\t\t\t */\r\n\t\t\t\t\tvar binding = UserInterface.getBinding ( target );\r\n\t\t\t\t\twhile ( binding == null && target != null ) {\r\n\t\t\t\t\t\tbinding = UserInterface.getBinding ( target );\r\n\t\t\t\t\t\ttarget = target.parentNode;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( binding != null ) {\r\n\t\t\t\t\t\tbinding.dispatchAction ( Binding.ACTION_UPDATED );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Update error!\r\n\t */\r\n\t_errorUpdate : function () {\r\n\r\n\t\tApplication.unlock ( this );\r\n\t\tvar cry = \"UpdateManager dysfunction:\\n\\n\" + UpdateManager.errorsmessage;\r\n\t\tthis._logger.error ( cry + \"\\n\\n\" + UpdateManager.pendingResponse );\r\n\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\talert ( cry );\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Backup attributes for comparison with updated attributes.\r\n\t * @param {Element} element\r\n\t * @param {boolean} isRestore\r\n\t */\r\n\t_backupattributes : function ( element, isRestore ) {\r\n\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\tif ( binding != null ) {\r\n\r\n\t\t\tif ( isRestore ) {\r\n\r\n\t\t\t\tvar buffer = this._attributesbuffer;\r\n\t\t\t\tvar map = new Map ();\r\n\r\n\t\t\t\tbuffer.each ( function ( name, old ) {\r\n\t\t\t\t\tvar now = element.getAttribute ( name );\r\n\t\t\t\t\tif ( now != null ) {\r\n\t\t\t\t\t\tif ( now != old ) {\r\n\t\t\t\t\t\t\tmap.set ( name, Types.castFromString ( now ));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tmap.set ( name, null );\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tnew List ( element.attributes ).each ( function ( att ) {\r\n\t\t\t\t\tif ( att.specified ) {\r\n\t\t\t\t\t\tif ( !buffer.has ( att.nodeName )) {\r\n\t\t\t\t\t\t\tmap.set ( att.nodeName, Types.castFromString ( att.nodeValue ));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tmap.each ( function ( name, value ) {\r\n\t\t\t\t\tvar method = binding.propertyMethodMap [ name ];\r\n\t\t\t\t\tif ( method != null ) {\r\n\t\t\t\t\t\tmethod.call ( binding, value );\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar map = new Map ();\r\n\t\t\t\tnew List ( element.attributes ).each ( function ( att ) {\r\n\t\t\t\t\tif ( att.specified ) {\r\n\t\t\t\t\t\tmap.set ( att.nodeName, att.nodeValue );\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tthis._attributesbuffer = map;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\r\n\t// UPDATEPLUGIN METHODS ..............................................\r\n\r\n\t/**\r\n\t * Handle element?\r\n\t * @implements {IUpdateHandler}\r\n\t * @param {Element} newelement\r\n\t * @param {Element} oldelement\r\n\t * @return {boolean}\r\n\t */\r\n\thandleElement : function ( newelement, oldelement ) {\r\n\r\n\t\t// since we know that the element has a specied ID...\r\n\t\tvar binding = window.bindingMap [ newelement.getAttribute ( \"id\" )];\r\n\t\tif ( binding != null ) {\r\n\t\t\treturn binding.handleElement ( newelement, oldelement );\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Update element.\r\n\t *\t@implements {IUpdateHandler}\r\n\t * @param {Element} newelement\r\n\t * @param {Element} oldelement\r\n\t * @return {boolean}\r\n\t */\r\n\tupdateElement : function ( newelement, oldelement ) {\r\n\r\n\t\tvar binding = window.bindingMap [ newelement.getAttribute ( \"id\" )];\r\n\t\tif ( binding != null ) {\r\n\t\t\treturn binding.updateElement ( newelement, oldelement );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_DocumentUpdatePlugin}\r\n */\r\nvar DocumentUpdatePlugin = new _DocumentUpdatePlugin ();\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/page/updates/AttributesUpdate.js",
    "content": "AttributesUpdate.prototype = new Update();\r\nAttributesUpdate.superclass = Update.prototype;\r\n\r\n/**\r\n * @type {Element}  \r\n */\r\nAttributesUpdate.prototype.currentElement = null;\r\n\r\n/**\r\n * Remember: The before and after element MUST have same id for this to work.\r\n * @param {String} type\r\n * @param {String} id\r\n * @param {Element} element\r\n * @return\r\n */\r\nfunction AttributesUpdate ( id, element, oldelement ) {\r\n\t\r\n\tthis.type = type = Update.TYPE_ATTRIBUTES;\r\n\tthis.id = id;\r\n\tthis.element = element;\r\n\tthis.currentElement = oldelement;\r\n\tthis._summary = [];\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Update attributes.\r\n */\r\nAttributesUpdate.prototype.update = function () {\r\n\t\r\n\tvar element = document.getElementById ( this.id );\r\n\tif ( this._beforeUpdate ( element )) {\r\n\t\tthis._updateAttributes ( element );\r\n\t\tthis._afterUpdate ( element );\r\n\t}\r\n};\r\n\r\n/**\r\n * Performs the actual attribute synchronization.\r\n */\r\nAttributesUpdate.prototype._updateAttributes = function ( element ) {\r\n\t\r\n\t// add and update attributes\r\n\tArray.forEach ( this.element.attributes, function ( newatt ) {\r\n\t\tvar oldatt = this.currentElement.getAttribute ( newatt.nodeName );\r\n\t\tif ( oldatt == null || oldatt != newatt.nodeValue ) {\r\n\t\t\tthis._setAttribute ( element, newatt.nodeName, newatt.nodeValue );\r\n\t\t\tthis._summary.push ( \"@\" + newatt.nodeName );\r\n\t\t}\r\n\t}, this );\r\n\t\r\n\t// delete attributes\r\n\tArray.forEach ( this.currentElement.attributes, function ( oldatt ) {\r\n\t\tif ( this.element.getAttribute ( oldatt.nodeName ) == null ) {\r\n\t\t\tthis._setAttribute ( element, oldatt.nodeName, null );\r\n\t\t\tthis._summary.push ( \"@\" + oldatt.nodeName );\r\n\t\t}\r\n\t}, this );\r\n};\r\n\r\n/**\r\n * Set element attribute. For Internet Explorer, this may not be as simple as it sounds. \r\n * @param {Element} element\r\n * @param {String} name\r\n * @param {String} value\r\n * @return\r\n */\r\nAttributesUpdate.prototype._setAttribute = function ( element, name, value ) {\r\n\t\r\n\t\r\n\tif ( element == null ) {\r\n\t\t// id_FlowUI$Document$DocumentBody$TabPanels_lazybindingactivated2\r\n\t\talert ( this.id + \": \" + document.getElementById ( this.id )+ \"\\n\\n\" + name + \"=\" + value )\r\n\t\tSystemLogger.getLogger ( \"AttributesUpdate\" ).fine ( document.body.innerHTML )\r\n\t}\r\n\t\r\n\t\r\n\tvar isDel = ( value == null );\r\n\t\r\n\tif ( isDel ) {\r\n\t\telement.removeAttribute ( name );\r\n\t} else {\r\n\t\telement.setAttribute ( name, value );\r\n\t}\r\n\t\r\n\tif ( document.all != null ) { // TODO: Think of more properties on the IE handicap list?\r\n\t\tif ( isDel ) {\r\n\t\t\tvalue = \"\";\r\n\t\t}\r\n\t\tswitch ( name.toLowerCase ()) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Since matching IDs is a prerequisite for this to   \r\n\t\t\t * happen, we don't need to hack support for ID updates.\r\n\t\t\t */\r\n\t\t\t\r\n\t\t\tcase \"class\" :\r\n\t\t\t\telement.className = value;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"disabled\" :\r\n\t\t\t\telement.disabled = !isDel;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"checked\" :\r\n\t\t\t\telement.checked = !isDel;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"readonly\" :\r\n\t\t\t\telement.readOnly = !isDel;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * @overloads {Update#_afterUpdate}\r\n * @param {Element} element\r\n */\r\nAttributesUpdate.prototype._afterUpdate = function ( element ) {\r\n\t\r\n\tAttributesUpdate.superclass._afterUpdate.call ( this, element );\r\n\tUpdateManager.report ( \"Attributes updated on element id=\\\"\" + this.id + \"\\\": \" + this._summary.toString ());\r\n}\r\n\r\n/**\r\n * Better not keep a reference to any DOM element around here.\r\n * @overloads {Update#dispose}\r\n */\r\nAttributesUpdate.prototype.dispose = function () {\r\n\t\r\n\tUpdate.prototype.dispose.call ( this );\r\n\tthis.currentElement = null;\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/page/updates/ReplaceUpdate.js",
    "content": "ReplaceUpdate.prototype = new Update ();\r\nReplaceUpdate.superclass = Update.prototype;\r\n\r\n/**\r\n * Simple update.\r\n * @param {String} id\r\n * @param {Element} element\r\n */\r\nfunction ReplaceUpdate ( id, element ) {\r\n\t\r\n\tthis.type = Update.TYPE_REPLACE;\r\n\tthis.id = id;\r\n\tthis.element = element;\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Replace current element with new element.\r\n */\r\nReplaceUpdate.prototype.update = function () {\r\n\r\n\tvar target, container, update = UpdateAssistant.toHTMLElement(this.element);\r\n\r\n\tif ((target = document.getElementById(this.id)) != null) {\r\n\t\tif ((container = target.parentNode) != null) {\r\n\t\t\tvar targetbinding = UserInterface.getBinding(target);\r\n\t\t\tif (targetbinding != null) {\r\n\t\t\t\tupdate.__isAttached = targetbinding.isAttached;\r\n\t\t\t}\r\n\t\t\tif (this._beforeUpdate(target)) {\r\n\t\t\t\tcontainer.replaceChild(update, target);\r\n\t\t\t\tthis._afterUpdate(update);\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tUpdateManager.error(\"Element null point: \" + this.id);\r\n\t}\r\n};\r\n\r\n/**\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nReplaceUpdate.prototype._afterUpdate = function ( element ) {\r\n\t\r\n\tvar result = ReplaceUpdate.superclass._afterUpdate.call ( this, element );\r\n\tUpdateManager.report ( \"Replaced element id=\\\"\" + this.id + \"\\\"\" );\r\n\tif ( element.nodeName == \"form\" || element.getElementsByTagName ( \"form\" ).item ( 0 ) != null ) {\r\n\t\tUpdateManager.setupForms ();\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/page/updates/SiblingUpdate.js",
    "content": "SiblingUpdate.prototype = new Update ();\r\nSiblingUpdate.superclass = Update.prototype;\r\n\r\n/**\r\n * Sibling update.\r\n * @param {String} type\r\n * @param {String} id\r\n * @param {Element} element\r\n * @return\r\n */\r\nfunction SiblingUpdate ( type, id, element, isFirst ) {\r\n\t\r\n\tthis.type = type;\r\n\tthis.id = id;\r\n\tthis.element = element;\r\n\tthis.isFirst = isFirst;\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Update by either inserting or removing an element.\r\n */\r\nSiblingUpdate.prototype.update = function () {\r\n\t\t\r\n\tvar element = document.getElementById ( this.id );\r\n\t\r\n\tswitch ( this.type ) {\r\n\t\tcase Update.TYPE_REMOVE :\r\n\t\t\tthis._remove ( element );\r\n\t\t\tbreak;\t\t\r\n\t\tcase Update.TYPE_INSERT :\r\n\t\t\tthis._insert ( this.element, element );\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n/**\r\n * Remove element.\r\n * @param {Element} element\r\n * @return\r\n */\r\nSiblingUpdate.prototype._remove = function ( element ) {\r\n\t\r\n\tvar parent = element.parentNode;\r\n\tif ( parent != null ) {\r\n\t\tif ( this._beforeUpdate ( element )) {\r\n\t\t\tparent.removeChild ( element );\r\n\t\t\tthis._afterUpdate ( parent );\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Insert new element after existing element.\r\n * @param {Element} element The new (XML) element\r\n * @param {Element} otherelement An existing (HTML) element\r\n * @return\r\n */\r\nSiblingUpdate.prototype._insert = function ( element, otherelement ) {\r\n\t\r\n\tvar update = UpdateAssistant.toHTMLElement ( element );\r\n\t\r\n\tif ( this.isFirst ) {\r\n\t\tvar parent = otherelement;\r\n\t\tif ( parent != null ) {\r\n\t\t\tif ( this._beforeUpdate ( parent )) {\r\n\t\t\t\tparent.insertBefore ( update, parent.firstChild );\r\n\t\t\t\tthis._afterUpdate ( update );\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tvar parent = otherelement.parentNode;\r\n\t\tif ( parent != null ) {\r\n\t\t\tif ( this._beforeUpdate ( parent )) {\r\n\t\t\t\tparent.insertBefore ( update, otherelement.nextSibling );\r\n\t\t\t\tthis._afterUpdate ( update );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * @param {Element} element\r\n */\r\nSiblingUpdate.prototype._beforeUpdate = function ( element ) {\r\n\t\r\n\tvar result = SiblingUpdate.superclass._beforeUpdate.call ( this, element );\r\n\tif ( this.type == Update.TYPE_REMOVE ) {\r\n\t\tUpdateManager.report ( \"Removed element id=\\\"\" + element.id + \"\\\"\" );\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/**\r\n * @param {Element} element\r\n */\r\nSiblingUpdate.prototype._afterUpdate = function ( element ) {\r\n\t\r\n\tvar result = true;\r\n\tif ( element != null ) {\r\n\t\tresult = SiblingUpdate.superclass._afterUpdate.call ( this, element );\r\n\t\tif ( this.type == Update.TYPE_INSERT ) {\r\n\t\t\tUpdateManager.report ( \"Inserted element id=\\\"\" + element.id + \"\\\"\" );\r\n\t\t\tif ( element.nodeName == \"form\" || element.getElementsByTagName ( \"form\" ).item ( 0 ) != null ) {\r\n\t\t\t\tUpdateManager.setupForms ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/page/updates/Update.js",
    "content": "/**\r\n * Default replacement update with which a section of the  \r\n * DOM subtree is simply replaced with something new. \r\n * {@see ReplaceUpdate}\r\n * @type {String}\r\n */\r\nUpdate.TYPE_REPLACE = \"replace\";\r\n\r\n/**\r\n * Optional attribute update. Using this, elements may have their \r\n * attributes updated without replacing the element DOM branch. \r\n * The element must have a id attribute specified for this to work. \r\n * {@see UpdateManager#hasSoftAttributes}\r\n * {@see AttributesUpdate}\r\n * @type {String}\r\n */\r\nUpdate.TYPE_ATTRIBUTES = \"attributes\";\r\n\r\n/**\r\n * Optional removal update: Removes a child without replacing the parent. \r\n * Child siblings must all be elements and they must all have an id specified.\r\n * {@see UpdateManager#hasSoftSiblings}\r\n * {@see SiblingUpdate}\r\n * @type {String}\r\n */\r\nUpdate.TYPE_REMOVE = \"remove\";\r\n\r\n/**\r\n * Optional insertion update: Inserts a child without replacing the parent.\r\n * Child siblings must all be elements and they must all have an id specified.\r\n * {@see UpdateManager#hasSoftSiblings}\r\n * {@see SiblingUpdate}\r\n * @type {String}\r\n */\r\nUpdate.TYPE_INSERT = \"insert\";\r\n\r\n/**\r\n * This event is dispatched before an update. Event target depends on update type: \r\n *   \"replace\" - event target is about to be deleted.\r\n *   \"attributes\" - event target is going to have attributes updated.\r\n *   \"remove\" - event target is about to be deleted.\r\n *   \"insert\" - event target is the PARENT node of an expected child.\r\n * @see {Update#_beforeUpdate}\r\n * @type {String}\r\n */\r\nUpdate.EVENT_BEFOREUPDATE = \"beforeupdate\";\r\n\r\n/**\r\n * This event is dispatched after an update. Event target depends on update type:\r\n *   \"replace\" - event target was just inserted.\r\n *   \"attributes\" - event target just had some attributes updated.\r\n *   \"remove\" - event target is the PARENT node of a deleted child.\r\n *   \"insert\" - event target was just inserted. \r\n * @see {Update#_afterUpdate}\r\n * @type {String}\r\n */\r\nUpdate.EVENT_AFTERUPDATE  = \"afterupdate\";\r\n\r\n/**\r\n * The action is all about the subclasses.\r\n * @see {ReplaceUpdate}\r\n * @see {AttributesUpdate}\r\n * @see {SiblingUpdate}\r\n */\r\nfunction Update () {\r\n\t\r\n\treturn this;\r\n}\r\n\r\nUpdate.prototype = {\r\n\t\r\n\t/**\r\n\t * Update type.\r\n\t * @type {String}\r\n\t */\r\n\ttype : null,\r\n\t\r\n\t/**\r\n\t * Identifies each unique Update instance.\r\n\t * @see {UpdateManager#getUpdate}\r\n\t * @type {String}\r\n\t */\r\n\tkey : null,\r\n\t\r\n\t/**\r\n\t * Id of the current page element that is about to be updated.\r\n\t * @type {String}\r\n\t */\r\n\tid : null,\r\n\t\r\n\t/**\r\n\t * The (XML) element used to replace or otherwise update the current element. \r\n\t * @type {Element}\r\n\t */\r\n\telement : null,\r\n\t\r\n\t/**\r\n\t * The update method performs the actual update. Count on methods  \r\n\t * _beforeUpdate and _afterUpdate to be invoked at this pount.\r\n\t */\r\n\tupdate : function () {},\r\n\r\n\t/**\r\n\t * Better not keep references to any DOM element around here.\r\n\t */\r\n\tdispose : function () {\r\n\t\t\r\n\t\tthis.element = null;\r\n\t},\r\n\t\r\n\t/**\r\n\t * When something changed, dispatch pre-update event. \r\n\t * The __updateType expando property can be used to act on this. \r\n\t * @param {Element} element\r\n\t * @return {boolean}\r\n\t */\r\n\t_beforeUpdate : function ( element ) {\r\n\t\t\r\n\t\tvar result = true;\r\n\t\tif ( element != null ) {\r\n\t\t\telement.__updateType = this.type;\r\n\t\t\tresult = UpdateAssistant.dispatchEvent ( element, Update.EVENT_BEFOREUPDATE );\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * When something changed, dispatch post-update event. \r\n\t * The __updateType expando property can be used to act on this.\r\n\t * @param {Element} element\r\n\t * @return {boolean}\r\n\t */\r\n\t_afterUpdate : function ( element ) {\r\n\t\t\r\n\t\tvar result = true;\r\n\t\tif ( element != null ) {\r\n\t\t\telement.__updateType = this.type;\r\n\t\t\tresult = UpdateAssistant.dispatchEvent ( element, Update.EVENT_AFTERUPDATE );\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/page/updates/UpdateAssistant.js",
    "content": "﻿/**\r\n * This fellow has nifty utility functions that may come in handy for the UpdateManager.  \r\n * This has been coded as a newable class to maximize visibility in your JS-aware IDE, \r\n * but there should in fact be only one instance running: It is declared near the end \r\n * of this file (scroll down) and accessed through instance variable \"UpdateAssistant\".\r\n */\r\nfunction _UpdateAssistant () {\r\n\t\r\n\tvar instance = null;\r\n\tif ( !window.UpdateAssistant ) {\r\n\t\tthis._construct ();\r\n\t\tinstance = this;\r\n\t}\r\n\treturn instance;\r\n}\r\n\r\n_UpdateAssistant.prototype = {\r\n\r\n\t/**\r\n\t* XML serializer.\r\n\t* @type {XMLSerializer}\r\n\t*/\r\n\t_serializer:\r\n\t\twindow.XMLSerializer != null ?\r\n\t\tnew XMLSerializer() :\r\n\t\tnull,\r\n\r\n\t/**\r\n\t* DOM parser.\r\n\t* @type {DOMParser}\r\n\t*/\r\n\t_parser:\r\n\t\t(window.DOMParser != null && window.XPathResult != null) ?\r\n\t\tnew DOMParser() :\r\n\t\tnull,\r\n\r\n\t/**\r\n\t* Used to emulating document.activeElement for non-supporting browsers. \r\n\t* @type {Element}\r\n\t*/\r\n\t_activeElement: null,\r\n\r\n\t/**\r\n\t* Constructor action. Tuning the DOM and JS engines while \r\n\t* patching sketchy WebKit implementation of activeElement. \r\n\t*/\r\n\t_construct: function () {\r\n\r\n\t\t// DOM Node interface\r\n\t\tif (!window.Node) {\r\n\t\t\twindow.Node = { ELEMENT_NODE: 1, TEXT_NODE: 3, DOCUMENT_NODE: 9 };\r\n\t\t}\r\n\r\n\t\t// Array.every\r\n\t\tif (!Array.every) {\r\n\t\t\tArray.every = function (array, fun) {\r\n\t\t\t\tvar result = true;\r\n\t\t\t\tvar len = array.length >>> 0;\r\n\t\t\t\tif (typeof fun != \"function\") {\r\n\t\t\t\t\tthrow new TypeError();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar thisp = arguments[2];\r\n\t\t\t\t\tfor (var i = 0; i < len; i++) {\r\n\t\t\t\t\t\tif (typeof array[i] != \"undefined\") {\r\n\t\t\t\t\t\t\tif (!fun.call(thisp, array[i], i, array)) {\r\n\t\t\t\t\t\t\t\tresult = false;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn result;\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Array.prototype.every\r\n\t\tif (!Array.prototype.every) {\r\n\t\t\tArray.prototype.every = function (fun) {\r\n\t\t\t\tvar thisp = arguments[1];\r\n\t\t\t\treturn Array.every(this, fun, thisp);\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Array.forEeach\r\n\t\tif (!Array.forEach) {\r\n\t\t\tArray.forEach = function (array, fun) {\r\n\t\t\t\tvar len = array.length >>> 0;\r\n\t\t\t\tif (typeof fun != \"function\") {\r\n\t\t\t\t\tthrow new TypeError();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar thisp = arguments[2];\r\n\t\t\t\t\tfor (var i = 0; i < len; i++) {\r\n\t\t\t\t\t\tif (typeof array[i] != \"undefined\") {\r\n\t\t\t\t\t\t\tfun.call(thisp, array[i], i, array);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// Array.prototype.forEeach\r\n\t\tif (!Array.prototype.forEach) {\r\n\t\t\tArray.prototype.forEach = function (fun) {\r\n\t\t\t\tvar thisp = arguments[1];\r\n\t\t\t\tArray.forEach(this, fun, thisp);\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// String.prototype.trip\r\n\t\tif (!String.prototype.trim) {\r\n\t\t\tString.prototype.trim = function () {\r\n\t\t\t\treturn this.replace(/^\\s*/, \"\").replace(/\\s*$/, \"\");\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t// tracking active element for current Webkit and old Firefox versions. \r\n\t\t// mousedown is needed becuase WebKit buttons are bugged and do not focus.\r\n\t\tif (document.addEventListener != null) {\r\n\t\t\tdocument.addEventListener(\"focus\", this, false);\r\n\t\t\tdocument.addEventListener(\"blur\", this, false);\r\n\t\t\tdocument.addEventListener(\"mousedown\", this, false);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Tracking and hacking the active element; retrieved using method getActiveElement.\r\n\t* @param {Event} e\r\n\t*/\r\n\thandleEvent: function (e) {\r\n\r\n\t\tswitch (e.type) {\r\n\t\t\tcase \"focus\":\r\n\t\t\tcase \"mousedown\":\r\n\t\t\t\tthis._activeElement = e.target;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"blur\":\r\n\t\t\t\tif (this._activeElement == e.target) {\r\n\t\t\t\t\tthis._activeElement = null;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Build a XMLHttpRequest.\r\n\t* TODO: This is used in multiple scenarios, but hacked to fit one in particular.\r\n\t* @param {String} method\r\n\t* @param {String} target\r\n\t* @param {object} handler\r\n\t* @return {XMLHttpRequest}\r\n\t*/\r\n\tgetXMLHttpRequest: function (method, target, handler) {\r\n\r\n\t\tvar request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject(\"Msxml2.XMLHTTP.3.0\");\r\n\r\n\t\tif (request != null) {\r\n\t\t\trequest.open(method, target, (handler != null ? true : false));\r\n\t\t\tif (handler != null) {\r\n\t\t\t\tApplication.lock(target);\r\n\t\t\t\tfunction action() {\r\n\t\t\t\t\tif (request.readyState == 4) {\r\n\t\t\t\t\t\tvar errorType = request.getResponseHeader(\"X-Error-Type\");\r\n\t\t\t\t\t\t// Handle error\r\n\t\t\t\t\t\tif (errorType) {\r\n\t\t\t\t\t\t\tvar message = \"\";\r\n\t\t\t\t\t\t\tfor (var i = 0; i < 10; i++)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar indexStr = i ? i : \"\";\r\n\t\t\t\t\t\t\t\tvar errorType = request.getResponseHeader(\"X-Error-Type\" + indexStr);\r\n\t\t\t\t\t\t\t\tif (!errorType)\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tvar errorMessage = request.getResponseHeader(\"X-Error-Message\" + indexStr);\r\n\t\t\t\t\t\t\t\tmessage += errorType + \"\\n\" + errorMessage + \"\\n\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tDialog.error(\"Error\", message);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tvar text = request.responseText;\r\n\t\t\t\t\t\t\tUpdateManager.pendingResponse = text;\r\n\t\t\t\t\t\t\tvar dom = UpdateAssistant.parse(text);\r\n\t\t\t\t\t\t\tif (dom != null) {\r\n\t\t\t\t\t\t\t\thandler.handleResponse(dom);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tApplication.unlock(target);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t/*\r\n\t\t\t\t* TODO: Does IE9 beta entere first case? \r\n\t\t\t\t* And if yes - does this work?\r\n\t\t\t\t*/\r\n\t\t\t\tif (request.addEventListener != null) {\r\n\t\t\t\t\trequest.addEventListener(\"readystatechange\", {\r\n\t\t\t\t\t\thandleEvent: function () {\r\n\t\t\t\t\t\t\taction();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, false);\r\n\t\t\t\t} else {\r\n\t\t\t\t\trequest.onreadystatechange = action;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn request;\r\n\t},\r\n\r\n\t/**\r\n\t* Dispatch bubbling DOM event. Note that IE does not accept  \r\n\t* document nodes or window objects as targets for the event.\r\n\t* @param {Element} element\r\n\t* @param {String} name\r\n\t* @return {boolean} Returns false if event was canceled\r\n\t*/\r\n\tdispatchEvent: function (element, name) {\r\n\r\n\t\tvar result = true;\r\n\r\n\t\tvar event = document.createEvent(\"UIEvents\");\r\n\t\tevent.initEvent(name, true, true);\r\n\t\tresult = element.dispatchEvent(event);\r\n\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Locate update zones in given document context.\r\n\t* @param {Document} dom\r\n\t* @return {Array<Element>}\r\n\t*/\r\n\tgetUpdateZones: function (dom) {\r\n\r\n\t\tvar xpath = \"//*[@id and contains(@class,'updatezone')]\";\r\n\t\tvar result = [];\r\n\t\tvar search = null;\r\n\t\tvar element = null;\r\n\r\n\t\tif (window.XPathResult != null) {\r\n\t\t\tvar type = XPathResult.ORDERED_NODE_ITERATOR_TYPE;\r\n\t\t\tsearch = dom.evaluate(xpath, dom, null, type, null);\r\n\t\t\twhile ((element = search.iterateNext()) != null) {\r\n\t\t\t\tresult.push(element);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tsearch = dom.documentElement.selectNodes(xpath);\r\n\t\t\tArray.forEach(search, function (element) {\r\n\t\t\t\tresult.push(element);\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Get element by ID in given document context.\r\n\t* @param {Document} dom\r\n\t* @param {String} id\r\n\t* @return {Element}\r\n\t*/\r\n\tgetElementById: function (dom, id) {\r\n\r\n\t\tvar xpath = \"//*[@id='\" + id + \"']\";\r\n\t\tvar search = null;\r\n\t\tvar result = null;\r\n\r\n\t\tif (window.XPathResult != null) {\r\n\t\t\tvar type = XPathResult.FIRST_ORDERED_NODE_TYPE;\r\n\t\t\tsearch = dom.evaluate(xpath, dom, null, type, null);\r\n\t\t\tresult = search.singleNodeValue;\r\n\t\t} else {\r\n\t\t\tresult = dom.documentElement.selectNodes(xpath)[0];\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Collect all id attributes used in a document so that  \r\n\t* we can check for multiple occurances of the same id. \r\n\t* @param {Document} dom\r\n\t* @return {Array<String>}\r\n\t*/\r\n\t_getIds: function (dom) {\r\n\r\n\t\tvar xpath = \"//*[@id]\";\r\n\t\tvar search = null;\r\n\t\tvar result = [];\r\n\r\n\t\tif (window.XPathResult != null) {\r\n\t\t\tvar type = XPathResult.ORDERED_NODE_ITERATOR_TYPE;\r\n\t\t\tsearch = dom.evaluate(xpath, dom, null, type, null);\r\n\t\t\twhile ((element = search.iterateNext()) != null) {\r\n\t\t\t\tresult.push(element.getAttribute(\"id\"));\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tsearch = dom.documentElement.selectNodes(xpath);\r\n\t\t\tArray.forEach(search, function (element) {\r\n\t\t\t\tresult.push(element.getAttribute(\"id\"));\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Transform an \"abstract\" XML DOM element into a HTML element. \r\n\t* Method document.importNode can not be used in Firefox, it \r\n\t* will break stuff such as the document.forms object.\r\n\t* @param {Element} element\r\n\t*/\r\n\ttoHTMLElement: function (element) {\r\n\r\n\t\tvar markup = this.serialize(element);\r\n\t\tvar temp = document.createElement(\"temp\");\r\n\t\ttemp.innerHTML = markup;\r\n\t\treturn temp.firstChild;\r\n\t},\r\n\r\n\t/**\r\n\t* Patching a bug or questionable feature in Webkit where document   \r\n\t* activeElement is only supported for input and textarea elements. \r\n\t* bugs.webkit.org/show_bug.cgi?id=28630 \r\n\t* bugs.webkit.org/show_bug.cgi?id=22261\r\n\t* @return {Element}\r\n\t*/\r\n\tgetActiveElement: function () {\r\n\r\n\t\tvar result = document.activeElement;\r\n\t\tif (result == null || result == document.body) {\r\n\t\t\tresult = this._activeElement;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Serialize DOM intro XML string.\r\n\t* @param {Element} element\r\n\t* @return {String}\r\n\t*/\r\n\tserialize: function (element) {\r\n\r\n\t\t/*\r\n\t\t* Note to C1 developers: This method gets the  \r\n\t\t* overwrite treatment in DocumentUpdatePlugin.js!\r\n\t\t*/\r\n\t\tvar result = null;\r\n\t\tif (element.xml != null) {\r\n\t\t\tresult = element.xml;\r\n\t\t}\r\n\t\telse if (this._serializer != null) {\r\n\t\t\tresult = this._serializer.serializeToString(element);\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* This is never used by the UpdateManager itself, but plugins may \r\n\t* use this service to see if any two XML elements are different.\r\n\t* @param {Element} newelement\r\n\t* @param {Element} oldelement\r\n\t* @return {boolean}\r\n\t*/\r\n\thasDifferences: function (newelement, oldelement) {\r\n\r\n\t\tvar s1 = null;\r\n\t\tvar s2 = null;\r\n\t\tif (newelement.xml != null)\r\n\t\t{\r\n\t\t\ts1 = newelement.xml;\r\n\t\t\ts2 = oldelement.xml;\r\n\t\t}\r\n\t\telse if (this._serializer != null) {\r\n\t\t\ts1 = this._serializer.serializeToString(newelement);\r\n\t\t\ts2 = this._serializer.serializeToString(oldelement);\r\n\t\t} \r\n\t\treturn s1 != s2;\r\n\t},\r\n\r\n\t/**\r\n\t* Parse XML string into DOM document.\r\n\t* @param {String} markup\r\n\t* @return {Document}\r\n\t*/\r\n\tparse: function (markup) {\r\n\r\n\t\tvar result = null;\r\n\t\tif (this._parser != null && window.XPathResult != null) {\r\n\t\t\tresult = this._parser.parseFromString(markup, \"text/xml\");\r\n\t\t} else {\r\n\t\t\tresult = new ActiveXObject(\"Msxml2.DOMDocument.3.0\");\r\n\t\t\tresult.setProperty(\"SelectionLanguage\", \"XPath\");\r\n\t\t\tresult.loadXML(markup);\r\n\t\t}\r\n\t\treturn this._validate(result);\r\n\t},\r\n\r\n\t/**\r\n\t* Validate document and return it. UpdateManager.isDebugging can be  \r\n\t* set to true in order to get notified about these possible errors:  \r\n\t* 1) The XHTML is not well-formed\r\n\t* 2) There are multiple elements with the same id\r\n\t* @param {Document} dom\r\n\t* @return {Document}\r\n\t*/\r\n\t_validate: function (dom) {\r\n\r\n\t\tvar out = null;\r\n\t\tif (dom.parseError != null && dom.parseError.errorCode != 0) {\r\n\t\t\tout = dom.parseError.reason;\r\n\t\t} else {\r\n\t\t\tvar error = dom.getElementsByTagName(\"parsererror\").item(0);\r\n\t\t\tif (error != null) {\r\n\t\t\t\tout = error.textContent.\r\n\t\t\t\t\treplace(/\\^/g, \"\").\r\n\t\t\t\t\treplace(/\\-/g, \"\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (out == null) {\r\n\t\t\tvar has = {}, ids = this._getIds(dom);\r\n\t\t\tids.every(function (id) {\r\n\t\t\t\tvar result = !has[id];\r\n\t\t\t\thas[id] = true;\r\n\t\t\t\tif (!result) {\r\n\t\t\t\t\tout = \"Element \\\"\" + id + \"\\\" encountered twice.\";\r\n\t\t\t\t}\r\n\t\t\t\treturn result;\r\n\t\t\t});\r\n\t\t}\r\n\t\tif (out != null) {\r\n\t\t\tUpdateManager.error(out);\r\n\t\t\tdom = null;\r\n\t\t}\r\n\t\treturn dom;\r\n\t}\r\n};\r\n\r\n/*\r\n * The single working instance is declared here!\r\n */\r\nvar UpdateAssistant = new _UpdateAssistant ();"
  },
  {
    "path": "Website/Composite/scripts/source/page/updates/UpdateManager.js",
    "content": "/**\r\n * This fellow will manage form request and server response to produce an AJAH-style \r\n * webpage interface. The form is posted without reloading the page, the response is \r\n * compared to the previous response and differing sections will be updated on the page. \r\n * This has been coded as a newable class to maximize visibility in your JS-aware IDE, \r\n * but there should in fact be only one instance running; it is declared near the end \r\n * of this file (scroll down) and accessed through instance variable \"UpdateManager\".\r\n */\r\nfunction _UpdateManager () { // notice the underscore!\r\n\t\r\n\tvar instance = null;\r\n\tif ( !window.UpdateManager ) {\r\n\t\tthis._construct ();\r\n\t\tinstance = this;\r\n\t}\r\n\treturn instance;\r\n}\r\n\r\n_UpdateManager.prototype = {\r\n\r\n\t/** \r\n\t* Version string.\r\n\t* @type {string}\r\n\t*/\r\n\tversion: \"0.1\",\r\n\r\n\t/**\r\n\t* Attach this classname to any form on the page to make it postback without page refresh.\r\n\t* @type {string}\r\n\t*/\r\n\tCLASSNAME_FORM: \"updateform\",\r\n\r\n\t/**\r\n\t* Attach this classname to one or more elements to make them update without page refresh.\r\n\t* @type {string} \r\n\t*/\r\n\tCLASSNAME_ZONE: \"updatezone\",\r\n\r\n\t/**\r\n\t* Considered experimental until further notice: Attach this classname to block updates!\r\n\t* @type {string}\r\n\t*/\r\n\tCLASSNAME_GONE: \"updategone\",\r\n\r\n\t/**\r\n\t* This event is dispatched from the documentElement BEFORE any new request to the \r\n\t* server is made. The event is fired regardless of whether or not the page is \r\n\t* actually being updated. Note the the event is also fired once for each page \r\n\t* update, though not with the documentElement as target. Note that we use  \r\n\t* the same event name because IE handles a limited list of available names. \r\n\t* @see {Update#EVENT_BEFOREUPDATE}\r\n\t* @type {string}\r\n\t*/\r\n\tEVENT_BEFOREUPDATE: \"beforeupdate\",\r\n\r\n\t/**\r\n\t* This event is dispatched from the documentElement AFTER any new request to the \r\n\t* server has been handled. The event is fired regardless of whether or not the \r\n\t* page was actually updated. Note the the event is also fired once for each \r\n\t* page update, though not with the documentElement as target\r\n\t* @see {Update#EVENT_AFTERUPDATE}\r\n\t* @type {string}\r\n\t*/\r\n\tEVENT_AFTERUPDATE: \"afterupdate\",\r\n\r\n\t/**\r\n\t* Fires when an error occurs - one that is recognized by the code, that is. \r\n\t* If you intercept this DOM event, you can ask for the error message as a \r\n\t* property of the UpdateManager.\r\n\t* @see {UpdateManager#error}\r\n\t* @see {UpdateManager#errormessage}\r\n\t* @type {string}\r\n\t*/\r\n\tEVENT_ERRORUPDATE: \"errorupdate\",\r\n\r\n\t/**\r\n\t* If this property is specified by serverside magic, we can avoid rendering the page  \r\n\t* twice. Note that the page may be rendered twice by the server, not on the client.\r\n\t* @type {string}\r\n\t*/\r\n\txhtml: null,\r\n\r\n\t/**\r\n\t* An summary is collected here during the update phase. \r\n\t* @type {string}\r\n\t*/\r\n\tsummary: null,\r\n\r\n\t/**\r\n\t* Flip this property to enable normal form post.\r\n\t* @type {boolean}\r\n\t*/\r\n\tisEnabled: true,\r\n\r\n\t/**\r\n\t* You should set this to true while developing. This will allow  \r\n\t* the UpdateManager to inform you about possible execution errors.  \r\n\t* @type {boolean}\r\n\t*/\r\n\tisDebugging: false,\r\n\r\n\t/**\r\n\t* True while posting request or parsing response. While true, all further postback is disabled.\r\n\t* TODO: Disabling further postback, is this a good idea?\r\n\t* @type {boolean}\r\n\t*/\r\n\tisUpdating: false,\r\n\r\n\t/**\r\n\t* Are elements candidates for \"soft\" attribute update? When true, elements may have \r\n\t* their attributes updated WITHOUT replacing the original element with a new one - \r\n\t* though if something in the descendant DOM tree changed, replacement may still occur. \r\n\t* 1) The element must have an id attribute specified for this to work. \r\n\t* @type {boolean}\r\n\t*/\r\n\thasSoftAttributes: false,\r\n\r\n\t/**\r\n\t* Are elements candidates for \"soft\" insertion or deletion? Instead of simly replacing \r\n\t* the parent, child elements may by be appended or removed using delicate DOM methods. \r\n\t* Switching the ordinal position of elements is NOT supported, only insert and delete, \r\n\t* since movement of existing elements is destructive the \"hard\" way. Requirements are: \r\n\t* 1) All children must be Element nodes (or whitespace text).\r\n\t* 2) All children must have an id attribute specified.\r\n\t* @type {boolean}hasSoftChildren\r\n\t*/\r\n\thasSoftSiblings: false,\r\n\r\n\t/**\r\n\t* The latest response string sent from server (before it is  \r\n\t* converted into DOM). This can be analyzed in case of errors.\r\n\t* @see {UpdateAssistant#getXMLHttpRequest}\r\n\t* @type {string}\r\n\t*/\r\n\tpendingResponse: null,\r\n\r\n\t/**\r\n\t* This holds the latest document DOM as it was sent \r\n\t* from the server. It is updated on each request.\r\n\t* @type {DOMDocument}\r\n\t*/\r\n\tcurrentDOM: null,\r\n\r\n\t/**\r\n\t* Holds the latest error message string, if any. \r\n\t* @see {UpdateManager#error}\r\n\t* @type {string}\r\n\t*/\r\n\terrormessage: null,\r\n\r\n\t/**\r\n\t* The assistant performs the stuff we don't want to focus on here.  \r\n\t* @type {UpdateAssistant}\r\n\t*/\r\n\t_assistant: null,\r\n\r\n\t/**\r\n\t* Objects with two props: ID of Element to delete, Element to insert instead.\r\n\t* @type {Array<Update>}\r\n\t*/\r\n\t_updates: null,\r\n\r\n\t/**\r\n\t* Keep track of ReplaceUpdate element IDs to minimize crawling efforts.\r\n\t* @type {HasMap<boolean>}\r\n\t*/\r\n\t_replaced: null,\r\n\r\n\t/**\r\n\t* NET special: These form element will be updated on each  \r\n\t* request, although it is possible not needed for all of them.\r\n\t* @type {Array<String>}\r\n\t*/\r\n\t_dotnetnames: [\r\n\t                 \"__VIEWSTATE\",\r\n\t                 \"__EVENTVALIDATION\",\r\n\t                 \"__EVENTTARGET\",\r\n\t                 \"__EVENTARGUMENT\",\r\n\t                 \"__LASTFOCUS\"],\r\n\r\n\t/**\r\n\t* List of plugins should be assembled on startup (before window.onload)\r\n\t* @type {Array<object>}\r\n\t*/\r\n\tplugins: [],\r\n\r\n\t/**\r\n\t* Identification.\r\n\t* @return {string}\r\n\t*/\r\n\ttoString: function () {\r\n\r\n\t\treturn \"[object UpdateManager]\";\r\n\t},\r\n\r\n\t/**\r\n\t* Constructor action: Confirming well-formed markup.\r\n\t*/\r\n\t_construct: function (xhtml) {\r\n\r\n\t\tvar root = document.documentElement;\r\n\t\tvar xmlns = root.namespaceURI;\r\n\t\tif (xmlns == null) {\r\n\t\t\txmlns = new String(root.getAttribute(\"xmlns\"));\r\n\t\t}\r\n\t\tif (xmlns == \"http://www.w3.org/1999/xhtml\") {\r\n\t\t\tthis._addListener(window, \"load\");\r\n\t\t\tthis._addListener(window, \"unload\");\r\n\t\t} else {\r\n\t\t\tthis.error(\"Not an XHTML document!\");\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Invoked once, on window load. If the xhtml property is specified,  \r\n\t* we can now parse it into a DOM document. Otherwise we request it.\r\n\t*/\r\n\t_setup: function () {\r\n\r\n\t\tif (this.isEnabled) {\r\n\t\t\tthis.isEnabled = this.setupForms();\r\n\t\t\tif (this.isEnabled) {\r\n\t\t\t\tif (this.xhtml != null) {\r\n\t\t\t\t\tif (typeof this.xhtml == \"string\") {\r\n\t\t\t\t\t\tvar markup = decodeURIComponent(this.xhtml);\r\n\t\t\t\t\t\tthis.currentDOM = UpdateAssistant.parse(markup);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthrow new TypeError();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar _this = this;\r\n\t\t\t\t\tUpdateAssistant.getXMLHttpRequest(\"get\", window.location.toString(), {\r\n\t\t\t\t\t\thandleResponse: function (dom) {\r\n\t\t\t\t\t\t\t_this.currentDOM = dom;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}).send(null);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Setup all forms on window load. Also invoked after some \r\n\t* page updates, since the update may have replaced a form.\r\n\t* @see {Update#_afterUpdate}\r\n\t* @return {boolean} True when forms were setup\r\n\t*/\r\n\tsetupForms: function () {\r\n\r\n\t\tvar hasSetup = false;\r\n\t\tArray.forEach(document.forms, function (form) {\r\n\t\t\tif (form.className.indexOf(this.CLASSNAME_FORM) > -1) {\r\n\t\t\t\tif (!form.__isSetup) {\r\n\t\t\t\t\tthis._setupForm(form);\r\n\t\t\t\t\tform.__isSetup = true;\r\n\t\t\t\t}\r\n\t\t\t\thasSetup = true;\r\n\t\t\t}\r\n\t\t}, this);\r\n\t\treturn hasSetup;\r\n\t},\r\n\r\n\t/**\r\n\t* Intercepting form submit.\r\n\t* @param {HTMLFormElement} form\r\n\t*/\r\n\t_setupForm: function (form) {\r\n\r\n\t\tvar _this = this;\r\n\t\tthis._addListener(form, \"submit\");\r\n\r\n\t\tform.__submit = form.submit;\r\n\t\tform.submit = function () {\r\n\t\t\tif (_this.isEnabled) {\r\n\t\t\t\t_this._submit(form);\r\n\t\t\t} else {\r\n\t\t\t\tform.__submit();\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t* Add event listener.\r\n\t* @param {object} target\r\n\t* @param {string} type\r\n\t* @param {object} handler\r\n\t*/\r\n\t_addListener: function (target, type) {\r\n\r\n\t\tif (target.addEventListener != null) {\r\n\t\t\ttarget.addEventListener(type, this, false);\r\n\t\t} else {\r\n\t\t\tvar _this = this;\r\n\t\t\ttarget.attachEvent(\"on\" + type, function () {\r\n\t\t\t\t_this.handleEvent(window.event);\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* DOM event listener.\r\n\t* @param {Event} e\r\n\t*/\r\n\thandleEvent: function (e) {\r\n\r\n\t\tswitch (e.type) {\r\n\r\n\t\t\tcase \"load\":\r\n\t\t\t\tif (this.isEnabled) {\r\n\t\t\t\t\tthis._setup();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"unload\":\r\n\t\t\t\tthis.isEnabled = false;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"submit\":\r\n\t\t\t\tif (this.isEnabled) {\r\n\t\t\t\t\tif (document.all) {\r\n\t\t\t\t\t\te.returnValue = false;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar form = e.target ? e.target : e.srcElement;\r\n\t\t\t\t\tthis._submit(form);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Submit form. Note that we block further postback until response is handled.\r\n\t* @param {HTMLFormElement} form\r\n\t*/\r\n\t_submit: function (form) {\r\n\r\n\t\tif (!this.isUpdating) {\r\n\t\t\tthis.isUpdating = true; // reversed in method handleResponse below\r\n\t\t\tUpdateAssistant.dispatchEvent(document.documentElement, this.EVENT_BEFOREUPDATE);\r\n\t\t\tthis._postRequest(form);\r\n\t\t}\r\n\t},\r\n\r\n\t/** \r\n\t* Update the page.\r\n\t* @param {Document} dom\r\n\t*/\r\n\thandleResponse: function (dom) {\r\n\r\n\t\tif (this.isEnabled) { // the window might have been unloaded while response was pending\r\n\r\n\t\t\tthis.summary = new String(\"\");\r\n\t\t\tthis.errors = new String(\"\");\r\n\r\n\t\t\tif (dom != null) {\r\n\r\n\t\t\t\t// isolate update zones\r\n\t\t\t\tvar newzones = UpdateAssistant.getUpdateZones(dom);\r\n\t\t\t\tvar oldzones = UpdateAssistant.getUpdateZones(this.currentDOM);\r\n\r\n\t\t\t\t// clear old updates\r\n\t\t\t\tthis._updates = [];\r\n\t\t\t\tthis._replaced = {};\r\n\r\n\t\t\t\t// collect updates\r\n\t\t\t\tnewzones.forEach(function (newzone, index) {\r\n\t\t\t\t\tvar oldzone = oldzones[index];\r\n\t\t\t\t\tthis._crawl(newzone, oldzone);\r\n\t\t\t\t}, this);\r\n\r\n\t\t\t\t// apply updates\r\n\t\t\t\tthis._updates.forEach(function (update, index) {\r\n\t\t\t\t\tupdate.update();\r\n\t\t\t\t\tupdate.dispose();\r\n\t\t\t\t}, this);\r\n\r\n\t\t\t\t// NET specials\r\n\t\t\t\tthis._dotnetnames.forEach(function (name) {\r\n\t\t\t\t\tthis._fixdotnet(dom, name);\r\n\t\t\t\t}, this);\r\n\r\n\t\t\t\t// prepare next update\r\n\t\t\t\tthis.currentDOM = dom;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// request end stuff\r\n\t\tthis.isUpdating = false;\r\n\t\tUpdateAssistant.dispatchEvent(document.documentElement, this.EVENT_AFTERUPDATE);\r\n\t},\r\n\r\n\t/**\r\n\t* Don't update the page. But we may still need to tell the world... \r\n\t*/\r\n\thandleSimilarResponse: function () {\r\n\r\n\t\tUpdateAssistant.dispatchEvent(document.documentElement, this.EVENT_AFTERUPDATE);\r\n\t},\r\n\r\n\t/**\r\n\t* Crawl elements.\r\n\t* @param {Element} newnode\r\n\t* @param {Element} oldnode\r\n\t* @param {Element} element While iterating, this elements has the last specified ID. \r\n\t* @param {string} id The ID of aforementioned element.\r\n\t* @return {boolean}\r\n\t*/\r\n\t_crawl: function (newnode, oldnode, element, id) {\r\n\r\n\t\tvar result = true;\r\n\r\n\t\tvar classname = oldnode.getAttribute(\"class\");\r\n\t\tif (classname == null || classname.indexOf(this.CLASSNAME_GONE) == -1) {\r\n\t\t\tif (oldnode.nodeType == Node.ELEMENT_NODE) {\r\n\t\t\t\tvar oldid = oldnode.getAttribute(\"id\");\r\n\t\t\t\tif (oldid != null) {\r\n\t\t\t\t\telement = newnode;\r\n\t\t\t\t\tid = oldid;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (result = this._check(newnode, oldnode, element, id)) {\r\n\t\t\t\tvar child1 = newnode.firstChild;\r\n\t\t\t\tvar child2 = oldnode.firstChild;\r\n\t\t\t\twhile (child1 != null && child2 != null && !this._replaced[id]) {\r\n\t\t\t\t\tswitch (child1.nodeType) {\r\n\t\t\t\t\t\tcase Node.TEXT_NODE:\r\n\t\t\t\t\t\t\tresult = this._check(child1, child2, element, id);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Node.DOCUMENT_NODE:\r\n\t\t\t\t\t\tcase Node.ELEMENT_NODE:\r\n\t\t\t\t\t\t\tresult = this._crawl(child1, child2, element, id);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (this._replaced[id]) {\r\n\t\t\t\t\t\tresult = false;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tchild1 = child1.nextSibling;\r\n\t\t\t\t\t\tchild2 = child2.nextSibling;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Are two nodes similar? If not, push new update to this._updates.\r\n\t* @param {Node} newnode\r\n\t* @param {Node} oldnode\r\n\t* @param {Element} element\r\n\t* @param {string} id\r\n\t* @return {boolean}\r\n\t*/\r\n\t_check: function (newnode, oldnode, element, id) {\r\n\r\n\t\tvar result = true;\r\n\t\tvar plugin = null;\r\n\t\tvar isSoftUpdate = false;\r\n\t\tvar isPluginUpdate = false;\r\n\r\n\t\tif ((newnode != null && oldnode == null) || (newnode == null && oldnode != null)) {\r\n\t\t\tresult = false;\r\n\t\t} else if (result = newnode.nodeType == oldnode.nodeType) {\r\n\t\t\tswitch (oldnode.nodeType) {\r\n\t\t\t\tcase Node.ELEMENT_NODE:\r\n\t\t\t\t\tif (newnode.namespaceURI != oldnode.namespaceURI || newnode.nodeName != oldnode.nodeName) {\r\n\t\t\t\t\t\tresult = false;\r\n\t\t\t\t\t} else if (result = (newnode.nodeName == oldnode.nodeName)) {\r\n\t\t\t\t\t\tvar oldid = oldnode.getAttribute(\"id\");\r\n\t\t\t\t\t\tvar newid = newnode.getAttribute(\"id\");\r\n\t\t\t\t\t\tif (oldid != null && newid != null) {\r\n\t\t\t\t\t\t\tif (oldid != newid) {\r\n\t\t\t\t\t\t\t\tresult = false;\r\n\t\t\t\t\t\t\t} else if ((plugin = this._getPlugin(newnode, oldnode)) != null) {\r\n\t\t\t\t\t\t\t\tif (plugin.updateElement(newnode, oldnode)) {\r\n\t\t\t\t\t\t\t\t\tisPluginUpdate = true; // dont replace (but maybe plugin did)\r\n\t\t\t\t\t\t\t\t\tresult = false; // stop crawling\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (result) {\r\n\t\t\t\t\t\t\tif (result = this._checkAttributes(newnode, oldnode)) {\r\n\t\t\t\t\t\t\t\tif (this.hasSoftSiblings && this._hasSoftChildren(newnode) && this._hasSoftChildren(oldnode)) {\r\n\t\t\t\t\t\t\t\t\tif (this._validateSoftChildren(newnode, oldnode)) {\r\n\t\t\t\t\t\t\t\t\t\tthis._updateSoftChildren(newnode, oldnode);\r\n\t\t\t\t\t\t\t\t\t\tisSoftUpdate = true; // dont replace\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tresult = false; // stop crawling - but continue in _updateSoftChildren\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tresult = newnode.childNodes.length == oldnode.childNodes.length;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Node.TEXT_NODE:\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* Trimming is needed because serverside scripting      \r\n\t\t\t\t\t* may spontaneously insert whitespace text. oh Lord.\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tif (newnode.data.trim() != oldnode.data.trim()) {\r\n\t\t\t\t\t\tresult = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// when in doubt, the default action is to simply replace...\r\n\t\tif (result == false && !isSoftUpdate && !isPluginUpdate) {\r\n\t\t\tif (id != null && element != null) {\r\n\t\t\t\tthis.addUpdate(\r\n\t\t\t\t\tnew ReplaceUpdate(id, element)\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Are attributes similar? If property hasSoftAttributes is on, this may result \r\n\t* in a \"soft\" update of element attributes (tree structure is not modified).\r\n\t* @param {Element} newnode\r\n\t* @param {Element} oldnode\r\n\t* @return {boolean} When false, replace \"hard\" and stop iteration.\r\n\t*/\r\n\t_checkAttributes: function (newnode, oldnode) {\r\n\r\n\t\tvar result = true;\r\n\t\tvar changed = false;\r\n\r\n\t\tvar atts1 = newnode.attributes;\r\n\t\tvar atts2 = oldnode.attributes;\r\n\r\n\t\tif (atts1.length != atts2.length) {\r\n\t\t\tchanged = true;\r\n\t\t} else {\r\n\t\t\tchanged = !Array.every(atts1, function (att1, i) {\r\n\t\t\t\tvar att2 = atts2.item(i);\r\n\t\t\t\treturn att1.nodeName == att2.nodeName && att1.nodeValue == att2.nodeValue;\r\n\t\t\t});\r\n\t\t}\r\n\t\tif (changed) {\r\n\t\t\tvar newid = newnode.getAttribute(\"id\");\r\n\t\t\tvar oldid = oldnode.getAttribute(\"id\");\r\n\t\t\tif (this.hasSoftAttributes && newid != null && newid == oldid) {\r\n\t\t\t\tthis.addUpdate(\r\n\t\t\t\t\tnew AttributesUpdate(oldid, newnode, oldnode)\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tresult = false; // addUpdate ReplaceUpdate!\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Are element children candidates for \"soft\" sibling updates?\r\n\t* 1) All children must be of element nodetype (or whitespace textnodes).\r\n\t* 2) All children must have an ID attribute specified.\r\n\t* @param {Element} element\r\n\t* @return {boolean}\r\n\t*/\r\n\t_hasSoftChildren: function (element) {\r\n\r\n\t\tvar result = true;\r\n\t\tif (element.hasChildNodes()) {\r\n\t\t\tresult = Array.every(element.childNodes, function (node) {\r\n\t\t\t\tvar res = true;\r\n\t\t\t\tswitch (node.nodeType) {\r\n\t\t\t\t\tcase Node.TEXT_NODE:\r\n\t\t\t\t\t\tres = !/[^\\t\\n\\r ]/.test(node.nodeValue);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase Node.ELEMENT_NODE:\r\n\t\t\t\t\t\tres = node.getAttribute(\"id\") != null;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\treturn res;\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* \"Soft\" siblings can be INSERTED and DELETED. Changing the ordinal position of  \r\n\t* existing elements is NOT supported, since this is destructive the \"hard\" way \r\n\t* (moving eg. an iframe using DOM method insertBefore would reload the iframe). \r\n\t* This method will verify that new elements retain their relative positioning. \r\n\t* @param {Element} newnode\r\n\t* @param {Element} oldnode\r\n\t* @return {boolean}\r\n\t*/\r\n\t_validateSoftChildren: function (newnode, oldnode) {\r\n\r\n\t\tvar result = true;\r\n\t\tvar prevold = -1;\r\n\t\tvar prevnew = -1;\r\n\t\tvar newindex = -1;\r\n\r\n\t\tvar news = this._toMap(newnode.childNodes, true);\r\n\t\tvar olds = this._toMap(oldnode.childNodes, true);\r\n\r\n\t\tfor (var id in olds) {\r\n\t\t\tif (result) {\r\n\t\t\t\tvar oldindex = olds[id];\r\n\t\t\t\tresult = oldindex >= prevold;\r\n\t\t\t\tif (news[id] != null) {\r\n\t\t\t\t\tnewindex = news[id];\r\n\t\t\t\t\tresult = newindex >= prevnew;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprevold = oldindex;\r\n\t\t\tif (newindex > -1) {\r\n\t\t\t\tprevnew = newindex;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* @param {Element} newnode\r\n\t* @param {Element} oldnode\r\n\t* @return {boolean}\r\n\t*/\r\n\t_updateSoftChildren: function (newnode, oldnode) {\r\n\r\n\t\tvar news = this._toMap(newnode.childNodes);\r\n\t\tvar olds = this._toMap(oldnode.childNodes);\r\n\r\n\t\tfor (var id in olds) {\r\n\t\t\tif (news[id] == null) {\r\n\t\t\t\tthis.addUpdate(\r\n\t\t\t\t\tnew SiblingUpdate(Update.TYPE_REMOVE, id, null, null)\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tthis._crawl(news[id], olds[id]); // crawling continued here!\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar previd = null;\r\n\t\tfor (id in news) {\r\n\t\t\tif (olds[id] == null) {\r\n\t\t\t\tvar xmlelement = news[id];\r\n\t\t\t\tif (previd == null) { // TODO: refactor this tedious fork\r\n\t\t\t\t\tvar parentid = oldnode.getAttribute(\"id\");\r\n\t\t\t\t\tthis.addUpdate(\r\n\t\t\t\t\t\tnew SiblingUpdate(Update.TYPE_INSERT, parentid, xmlelement, true)\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.addUpdate(\r\n\t\t\t\t\t\tnew SiblingUpdate(Update.TYPE_INSERT, previd, xmlelement, false)\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprevid = id;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Add update.\r\n\t* @param {Update} update\r\n\t*/\r\n\taddUpdate: function (update) {\r\n\r\n\t\tthis._updates.push(update);\r\n\t\tif (update instanceof ReplaceUpdate) {\r\n\t\t\tthis._replaced[update.id] = true;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* @param {Element} element\r\n\t* @param {Element} oldelement\r\n\t* @return {object}\r\n\t*/\r\n\t_getPlugin: function (element, oldelement) {\r\n\r\n\t\tvar result = null;\r\n\t\tthis.plugins.every(function (plugin) {\r\n\t\t\tif (plugin.handleElement(element, oldelement)) {\r\n\t\t\t\tresult = plugin;\r\n\t\t\t}\r\n\t\t\treturn result == null;\r\n\t\t});\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Convert an nodelist into an ID-to-element or ID-to-index hashmap.\r\n\t* @param {NodeList<Node>} nodes\r\n\t* @return {object<String><Element>}\r\n\t*/\r\n\t_toMap: function (nodes, isIndex) {\r\n\r\n\t\tvar result = {};\r\n\t\tArray.forEach(nodes, function (node, index) {\r\n\t\t\tif (node.nodeType == Node.ELEMENT_NODE) {\r\n\t\t\t\tresult[node.getAttribute(\"id\")] = isIndex ? index : node;\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Harvest form elements.\r\n\t* @param {HTMLFormElement} form\r\n\t* @return {string}\r\n\t*/\r\n\t_getPost: function (form) {\r\n\r\n\t\tvar result = new String(\"\");\r\n\r\n\t\tif (form != null) {\r\n\t\t\tvar last = \"\";\r\n\t\t\tArray.forEach(form.elements, function (element) {\r\n\r\n\t\t\t\tif (element.name == null || element.name == \"\") return;\r\n\r\n\t\t\t\tvar name = element.name;\r\n\t\t\t\tvar value = encodeURIComponent(element.value);\r\n\r\n\t\t\t\tswitch (element.type) {\r\n\r\n\t\t\t\t\tcase \"button\":\r\n\t\t\t\t\tcase \"submit\":\r\n\t\t\t\t\t\tvar active = UpdateAssistant.getActiveElement();\r\n\t\t\t\t\t\tif (element == active && name != \"\") {\r\n\t\t\t\t\t\t\tresult += name + \"=\" + value + \"&\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"radio\":\r\n\t\t\t\t\t\tif (element.checked) {\r\n\t\t\t\t\t\t\tresult += name + \"=\" + value + \"&\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"checkbox\":\r\n\t\t\t\t\t\tif (element.checked) {\r\n\t\t\t\t\t\t\tif (element.name == last) {\r\n\t\t\t\t\t\t\t\tif (result.lastIndexOf(\"&\") == result.length - 1) {\r\n\t\t\t\t\t\t\t\t\tresult = result.substr(0, result.length - 1);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tresult += \",\" + value;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tresult += name + \"=\" + element.value;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tlast = name;\r\n\t\t\t\t\t\t\tresult += \"&\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase \"text\":\r\n\t\t\t\t\tcase \"hidden\":\r\n\t\t\t\t\tcase \"password\":\r\n\t\t\t\t\tcase \"textarea\":\r\n\t\t\t\t\tcase \"select-one\":\r\n\t\t\t\t\t\tresult += name + \"=\" + value + \"&\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn result.substr(0, result.length - 1);\r\n\t},\r\n\r\n\t/**\r\n\t* Post form data and parse document response.\r\n\t* @param {HTMLFormElement} form\r\n\t*/\r\n\t_postRequest: function (form) {\r\n\r\n\t\t// collect post data\r\n\t\tvar method = form.method != \"\" ? form.method : \"get\";\r\n\t\tvar action = form.action != \"\" ? form.action : window.location.toString();\r\n\t\tvar format = this._getPost(form);\r\n\r\n\t\tif (method == \"get\") {\r\n\t\t\tif (action.indexOf(\"?\") > -1) {\r\n\t\t\t\taction = action + \"&\" + format;\r\n\t\t\t} else {\r\n\t\t\t\taction + \"?\" + format;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// invoke request\r\n\t\tvar _this = this;\r\n\t\tvar request = UpdateAssistant.getXMLHttpRequest(method, action, this);\r\n\t\tif (method == \"post\") {\r\n\t\t\trequest.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\r\n\t\t}\r\n\r\n\t\trequest.send(method == \"post\" ? format : null);\r\n\t},\r\n\r\n\t/**\r\n\t* ASP.NET requires viewstate and eventvalidation to be updated on each  \r\n\t* page update, even though they may not be placed inside an updatezone.\r\n\t* @param {Document} dom  \r\n\t* @param {string} id\r\n\t*/\r\n\t_fixdotnet: function (dom, id) {\r\n\r\n\t\tvar input = document.getElementById(id);\r\n\t\tif (input != null) {\r\n\t\t\tvar nextinput = UpdateAssistant.getElementById(dom, id);\r\n\t\t\tif (nextinput != null) {\r\n\t\t\t\tvar value = nextinput.getAttribute(\"value\");\r\n\t\t\t\tif (value !== input.value) {\r\n\t\t\t\t\tinput.value = value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/** \r\n\t* Debug something. Does nothing by default, but while developing \r\n\t* you can yield an alert by flipping the isDebugging property.\r\n\t* @param {string} out\r\n\t*/\r\n\tdebug: function (out) {\r\n\r\n\t\tif (this.isDebugging) {\r\n\t\t\talert(\"UpdateManager dysfunction. \\n\\n\" + out);\r\n\t\t}\r\n\t},\r\n\r\n\t/** \r\n\t* Debug something that went wrong. You can tap into  \r\n\t* the dispatched DOM event in order to handle the error.\r\n\t* @param {string} out\r\n\t*/\r\n\terror: function (out) {\r\n\r\n\t\tthis.errorsmessage = out;\r\n\t\tUpdateAssistant.dispatchEvent(document.documentElement, UpdateManager.EVENT_ERRORUPDATE);\r\n\t\tthis.debug(out);\r\n\t},\r\n\r\n\t/**\r\n\t* Append update info to the \"summary\" property.  \r\n\t* @param {string} string This should be a one-liner.\r\n\t*/\r\n\treport: function (string) {\r\n\r\n\t\tthis.summary += string + \"\\n\";\r\n\t}\r\n};\r\n\r\n/*\r\n * The single working instance is declared here. Notice no _underscore!\r\n */\r\nvar UpdateManager = new _UpdateManager ();"
  },
  {
    "path": "Website/Composite/scripts/source/page/updates/UpdatePlugin.js",
    "content": "/* \r\n * A plugin may be registered like this - note the optional compact syntax: \r\n * \r\n * UpdateManager.plugins.push ({\r\n * \t\thandleElement : function ( element ) { return true; },\r\n * \t\tupdateElement : function ( element ) { return false; }\r\n * });\r\n */\r\n\r\n/**\r\n * Handle input and textarea elements (with an ID attribute specified). \r\n * The plugin is registered with the UpdateManager in the end of this file. \r\n */\r\nfunction UpdatePlugin () {\r\n\t\t\r\n\t/**\r\n\t * Handle element? Return true to invoke method updateElement below.\r\n\t * @param {Element} element Remember, this is an XML element, not HTML\r\n\t * @param {Element} oldelement\r\n\t * @return {boolean} \r\n\t */\r\n\tthis.handleElement = function ( element, oldelement ) {\r\n\t\t\r\n\t\tvar result = false;\r\n\t\t\r\n\t\tswitch ( element.nodeName.toLowerCase ()) {\r\n\t\t\t\r\n\t\t\tcase \"input\" :\r\n\t\t\tcase \"textarea\" :\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * By default, we handle any input element with a given ID. \r\n\t\t\t\t * Special input IDs are better left to the UpdateManager.\r\n\t\t\t\t * We have ASP.NET hardcoded into this stuff, so you may \r\n\t\t\t\t * choose to adapt the setup to any preferred framework.\r\n\t\t\t\t */\r\n\t\t\t\tswitch ( element.getAttribute ( \"id\" )) {\r\n\t\t\t\t\tcase \"__EVENTTARGET\" :\r\n\t\t\t\t\tcase \"__EVENTARGUMENT\" :\r\n\t\t\t\t\tcase \"__VIEWSTATE\" :\r\n\t\t\t\t\tcase \"__EVENTVALIDATION\" :\r\n\t\t\t\t\t\tresult = false;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn result;\r\n\t};\r\n\t\r\n\t/**\r\n\t * Update element. Return true if the UpdateManager should stop \r\n\t * crawling the DOM subtree in search for further updates.\r\n\t * @param {Element} element\r\n\t * @param {Element} oldelement\r\n\t * @return {boolean} True to stop crawling\r\n\t */\r\n\tthis.updateElement = function ( element, oldelement ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Compare the server XML response to the actual HTML input \r\n\t\t * field values on page. If the server sends another value, \r\n\t\t * we assume that it REALLY wants to update fields values.\r\n\t\t */\r\n\t\tvar id = element.getAttribute ( \"id\" );\r\n\t\tvar input = document.getElementById ( id );\r\n\t\tif ( input != null ) {\r\n\t\t\tvar value = null;\r\n\t\t\tswitch ( input.nodeName.toLowerCase ()) {\r\n\t\t\t\tcase \"input\" :\r\n\t\t\t\t\tvalue = element.getAttribute ( \"value\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"textarea\" :\r\n\t\t\t\t\tvalue = element.textContent ? element.textContent : element.text;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Fallback value.\r\n\t\t\t */\r\n\t\t\tif ( value == null ) {\r\n\t\t\t\tvalue = \"\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * TODO: Other attributes could have been  \r\n\t\t\t * updated, they are now skipped completely!!!\r\n\t\t\t */\r\n\t\t\tif ( value != input.value ) {\r\n\t\t\t\tinput.value = value; \r\n\t\t\t\tUpdateManager.report ( \"Property [value] updated on field \\\"\" + id  + \"\\\"\" );\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * Return true to stop crawling (no need for input and textarea). \r\n\t\t * False will come in handy if you choose to do a ReplaceUpdate...\r\n\t\t */\r\n\t\treturn true;\r\n\t};\r\n};\r\n\r\n/**\r\n * Register plugin.\r\n */\r\nUpdateManager.plugins.push ( new UpdatePlugin ());\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/page/window/WindowAssistant.js",
    "content": "/**\r\n * Assist the WindowManager in evaluation of the DOMContentLoaded event in  \r\n * Internet Explorer. This script is loaded with \"defer\" attribute, you see.\r\n */\r\nnew function WindowAssistant () {\r\n\t\r\n\t/*\r\n\t * TODO: Will IE9 support DOMContentLoaded event?\r\n\t */\r\n\tif ( Client.isExplorer ) {\r\n\t\tWindowManager.onDOMContentLoaded ();\r\n\t}\r\n};\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/page/window/WindowManager.js",
    "content": "/*\r\n * Pseudoimplement DOM2 Node interface.\r\n */\r\nif ( !window.Node ) {\r\n\twindow.Node = {\r\n\t\tELEMENT_NODE\t\t\t\t: 1,\r\n\t\tATTRIBUTE_NODE\t\t\t\t: 2,\r\n\t\tTEXT_NODE\t\t\t\t\t: 3,\r\n\t\tCDATA_SECTION_NODE\t\t\t: 4,\r\n\t\tENTITY_REFERENCE_NODE\t\t: 5,\r\n\t\tENTITY_NODE\t\t\t\t\t: 6,\r\n\t\tPROCESSING_INSTRUCTION_NODE\t: 7,\r\n\t\tCOMMENT_NODE\t\t\t\t: 8,\r\n\t\tDOCUMENT_NODE\t\t\t\t: 9,\r\n\t\tDOCUMENT_TYPE_NODE\t\t\t: 10,\r\n\t\tDOCUMENT_FRAGMENT_NODE\t\t: 11,\r\n\t\tNOTATION_NODE\t\t\t\t: 12\r\n\t};\r\n}\r\n\r\n/*\r\n * Clone Java Swing KeyEvent interface.\r\n * TODO: investigate ALT and INSERT.\r\n */\r\nwindow.KeyEventCodes = {\r\n\t\r\n\tVK_BACK\t\t\t\t\t\t: 8,\r\n\tVK_TAB\t\t\t\t\t\t: 9,\r\n\tVK_ENTER\t\t\t\t\t: 13,\r\n\tVK_SHIFT\t\t\t\t\t: 16,\r\n\tVK_CONTROL\t\t\t\t\t: 17,\r\n\tVK_ALT\t\t\t\t\t\t: 18,\r\n\tVK_ESCAPE\t\t\t\t\t: 27,\r\n\tVK_SPACE\t\t\t\t\t: 32,\r\n\tVK_PAGE_UP\t\t\t\t\t: 33,\r\n\tVK_PAGE_DOWN\t\t\t\t: 34,\r\n\tVK_END\t\t\t\t\t\t: 35,\r\n\tVK_HOME\t\t\t\t\t\t: 36,\r\n\tVK_LEFT\t\t\t\t\t\t: 37,\r\n\tVK_UP\t\t\t\t\t\t: 38,\r\n\tVK_RIGHT\t\t\t\t\t: 39,\r\n\tVK_DOWN\t\t\t\t\t\t: 40,\r\n\tVK_COMMAND\t\t\t\t\t: 91,\r\n\tVK_INSERT\t\t\t\t\t: null,\r\n\tVK_DELETE\t\t\t\t\t: 127,\r\n\tVK_PLUS\t\t\t\t\t\t: 187,\r\n\tVK_MINUS\t\t\t\t\t: 189,\r\n\tVK_NUMPLUS\t\t\t\t\t: 107,\r\n\tVK_NUMMINUS\t\t\t\t\t: 109,\r\n\tVK_F1\t\t\t\t\t\t: 112\r\n};\r\n\r\n/**\r\n * Global pointer to the root application window object. \r\n * Please don't use too many of these global variables! \r\n * @type {DOMDocumentView>\r\n */\r\nif ( window == top ) {\r\n\twindow.app = this;\r\n} else {\r\n\twindow.app = top.app;\r\n}\r\n\r\n/**\r\n * All bindings with a specified ID will be mapped here. \r\n * @see {Binding#_updateBindingMap}\r\n * @type {HashMap<string><Binding>\r\n */\r\nwindow.bindingMap = {};\r\n\r\n/** \r\n * @see {Application#framework}\r\n * @type {StandardEventHandler}\r\n */\r\nwindow.standardEventHandler = null;\r\n\r\n/*\r\n * Localize top level objects. From this point on, top level \r\n * objects may be addressed without the \"top\" notation. This  \r\n * requires that the object is named identically to the file \r\n * that loads it (Java convention). See ScriptLoaderControl.\r\n */\r\nif ( window != window.top ) {\r\n\t\r\n\ttop.Application.declareTopLocal ( window );\r\n}\r\n\r\n/*\r\n * Uncomment this to hunt down stray alerts.\r\n * \r\nnew function () {\r\n\tvar oldalert = window.alert;\r\n\twindow.alert = function ( string ) {\r\n\t\tSystemLogger.getLogger ( \"window.alert\" ).debug ( string );\r\n\t\toldalert ( string );\r\n\t\tSystemDebug.stack ( arguments );\r\n\t}\r\n}\r\n*/\r\n\r\n/**\r\n * Accessed through instance variable \"WindowManager\" declared below.\r\n */\r\nfunction _WindowManager () {\r\n\t\r\n\tthis._construct ( KeyMaster.getUniqueKey ());\r\n}\r\n\r\n_WindowManager.prototype = {\r\n\t\t\r\n\t/*\r\n\t * TODO: These are not really constants any more.\r\n\t */\r\n\tWINDOW_LOADED_BROADCAST\t\t: null,\r\n\tWINDOW_UNLOADED_BROADCAST\t: null,\r\n\tWINDOW_EVALUATED_BROADCAST\t: null,\r\n\tWINDOW_RESIZED_BROADCAST \t: null,\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tisWindowLoaded : false,\r\n\t\r\n\t_logger\t\t\t\t\t\t: SystemLogger.getLogger ( \"WindowManager [\" + document.title + \"]\" ),\r\n\t_ondomstatements \t\t\t: new List (),\r\n\t_onloadstatements \t\t\t: new List (),\r\n\t_onresizestatements \t\t: new List (),\r\n\t\r\n\t_currentDimensions\t\t\t: null,\r\n\t_newDimensions\t\t\t\t: null,\r\n\t_broadcastTimeout\t\t\t: null,\r\n\t_isHorizontalResize \t\t: false,\r\n\t_isVerticalResize \t\t\t: false,\r\n\t_broadcastTimeout\t\t\t: null,\r\n\t\r\n\t/**\r\n\t * Using unique key to compute various other keys.\r\n\t * @param {string} string\r\n\t * @return {string} \r\n\t */\r\n\t_compute : function ( string, key ) {\r\n\t\r\n\t\treturn string.replace ( \"${windowkey}\", document.location + \":\" + key );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Constructor action.\r\n\t */\r\n\t_construct : function ( key ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Define broadcast \"constants\".\r\n\t\t */\r\n\t\tthis.WINDOW_LOADED_BROADCAST\t= this._compute ( BroadcastMessages.$WINKEY_LOADED, key );\r\n\t\tthis.WINDOW_UNLOADED_BROADCAST\t= this._compute ( BroadcastMessages.$WINKEY_UNLOADED, key );\r\n\t\tthis.WINDOW_EVALUATED_BROADCAST\t= this._compute ( BroadcastMessages.$WINKEY_EVALUATED, key );\r\n\t\tthis.WINDOW_RESIZED_BROADCAST \t= this._compute ( BroadcastMessages.$WINKEY_RESIZED, key );\r\n\t\t\r\n\t\t/*\r\n\t\t * Action on load and unload.\r\n\t\t */\r\n\t\tDOMEvents.addEventListener ( window, DOMEvents.DOM, this );\r\n\t\tDOMEvents.addEventListener ( window, DOMEvents.LOAD, this );\r\n\t\tDOMEvents.addEventListener ( window, DOMEvents.UNLOAD, this );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Implements {IEventListener}\r\n\t * @param {Event} e\r\n\t */\r\n\thandleEvent : function ( e ) {\r\n\t\r\n\t\tswitch ( e.type ) {\r\n\t\t\t\r\n\t\t\tcase DOMEvents.DOM :\r\n\t\t\t\tthis.onDOMContentLoaded ();\r\n\t\t\t\tbreak;\r\n\t\t\r\n\t\t\tcase DOMEvents.LOAD :\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Can this happen twice? \r\n\t\t\t\t * Maybe descendant frames loading?\r\n\t\t\t\t */\r\n\t\t\t\tif ( !this.isWindowLoaded ) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tthis.isWindowLoaded = true;\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Intercepted by DocumentManager. Register and attach Bindings.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tEventBroadcaster.broadcast ( this.WINDOW_LOADED_BROADCAST, this );\r\n\t\t\t\t\t\r\n\t\t\t\t\twhile ( this._onloadstatements.hasNext ()) {\r\n\t\t\t\t\t\tthis._onloadstatements.getNext ().fireOnLoad ();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Setup resize and unload events.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tthis._currentDimensions = this.getWindowDimensions ();\r\n\t\t\t\t\tDOMEvents.addEventListener ( window, DOMEvents.RESIZE, this );\r\n\t\t\t\t\tEventBroadcaster.broadcast ( this.WINDOW_EVALUATED_BROADCAST, this );\r\n\t\t\t\t\tDOMEvents.removeEventListener ( window, DOMEvents.LOAD, this );\r\n\t\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.RESIZE :\r\n\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Handling the top browser window will consume the mousedown event.\r\n\t\t\t\t * Let's fire a global broadcast to close open menus and stuff.\r\n\t\t\t\t */\r\n\t\t\t\tif ( window == top ) {\r\n\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN, document.body );\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * These statements will be executed RIGHT NOW. As of Firefox 3.6, \r\n\t\t\t\t * this implies that both browsers will fire them a million times \r\n\t\t\t\t * while resizing.\r\n\t\t\t\t */\r\n\t\t\t\tthis._onresizestatements.reset ();\r\n\t\t\t\twhile ( this._onresizestatements.hasNext ()) {\r\n\t\t\t\t\tthis._onresizestatements.getNext ().fireOnResize ();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * EventBroadcasts are executed after a short timeout. \r\n\t\t\t\t * The timeout cancels itself on each resize event. \r\n\t\t\t\t * This will make sure that onresize methods aren't \r\n\t\t\t\t * executed a million times when user resizes window.\r\n\t\t\t\t */\r\n\t\t\t\tthis._newDimensions = WindowManager.getWindowDimensions ();\r\n\t\t\t\tvar isHorizontalResize = this._newDimensions.w != this._currentDimensions.w;\r\n\t\t\t\tvar isVerticalResize = this._newDimensions.h != this._currentDimensions.h;\r\n\t\t\t\t\r\n\t\t\t\tif ( isHorizontalResize || isVerticalResize ) {\r\n\t\t\t\t\tif ( this._broadcastTimeout != null ) {\r\n\t\t\t\t\t\tclearTimeout ( this._broadcastTimeout );\r\n\t\t\t\t\t\tthis._broadcastTimeout = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tthis._broadcastTimeout = setTimeout ( function () { \r\n\t\t\t\t\t\tself._broadcastResizeEvent ();\r\n\t\t\t\t\t}, 250 );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.UNLOAD :\r\n\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Currently not intercepted by nothing.\r\n\t\t\t\t */\r\n\t\t\t\tEventBroadcaster.broadcast ( this.WINDOW_UNLOADED_BROADCAST );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Broadcast resize event globally. \r\n\t */\r\n\t_broadcastResizeEvent : function () {\r\n\t\t\r\n\t\tclearTimeout ( this._broadcastTimeout );\r\n\t\tthis._broadcastTimeout = null;\r\n\t\tEventBroadcaster.broadcast ( this.WINDOW_RESIZED_BROADCAST );\r\n\t\tthis._currentDimensions = this._newDimensions;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Add DOMContentLoaded observer.\r\n\t * @param {IDOMHandler} onDomHandler\r\n\t */\r\n\tfireOnDOM : function ( onDomHandler ) {\r\n\t\t\r\n\t\tif ( Interfaces.isImplemented ( IDOMHandler, onDomHandler, true )) {\r\n\t\t\tthis._ondomstatements.add ( onDomHandler );\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Add onload observer.\r\n\t * @param {ILoadHandler} onLoadHandler\r\n\t */\r\n\tfireOnLoad : function ( onLoadHandler ) {\r\n\t\t\r\n\t\tif ( Interfaces.isImplemented ( ILoadHandler, onLoadHandler, true )) {\r\n\t\t\tthis._onloadstatements.add ( onLoadHandler );\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Add onresize observer.\r\n\t * @param {IResizeHandler} onResizeHandler\r\n\t */\r\n\tfireOnResize : function ( onResizeHandler ) {\r\n\t\t\r\n\t\tif ( Interfaces.isImplemented ( IResizeHandler, onResizeHandler, true )) {\r\n\t\t\tthis._onresizestatements.add ( onResizeHandler );\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Note that in IE, this method will be invoked by the WindowAsssitant.\r\n\t * TODO: Will IE9 support DOMContentLoaded event?\r\n\t */\r\n\tonDOMContentLoaded : function () {\r\n\t\t\r\n\t\twhile ( this._ondomstatements.hasNext ()) {\r\n\t\t\tthis._ondomstatements.getNext ().fireOnDOM ();\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * @return {Dimension}\r\n\t */\r\n\tgetWindowDimensions : function () {\r\n\t\r\n\t\treturn new Dimension (\r\n\t\t\tClient.isMozilla ? window.innerWidth : document.body.clientWidth,\r\n\t\t\tClient.isMozilla ? window.innerHeight : document.body.clientHeight\r\n\t\t);\r\n\t},\r\n\t\r\n\t/*\r\n\t * In Mozilla strict error parsing mode, eval must be performed locally  \r\n\t * not to fire a warning. You cannot invoke \"anotherWindow.eval(xxx)\" ...\r\n\t * http://groups.google.com/group/jquery-en/browse_thread/thread/9e6ed95bce10e2a4\r\n\t * bug #359159 \r\n\t */\r\n\tevaluate : function ( string ) {\r\n\t\treturn eval ( string );\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_WindowManager}\r\n */\r\nvar WindowManager = new _WindowManager ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Application.js",
    "content": "/**\r\n * Referencing the window object now loading inside the app frame.\r\n * This get registered as soon as the file \"app.aspx\" gets loaded.\r\n * @type {DOMDocumentView}\r\n */\r\ntop.app = null;\r\n\r\n/*\r\nTODO: timeout - scope\r\nTODO: lists -scope\r\nTODO: maps -scope\r\nTODO: window.rootBInding / window.pageBinding\r\n*/\r\n\r\n/**\r\n * @class\r\n * Don't instantiate this class manually. Access through\r\n * instance variable \"Application\" declared below. This\r\n * instance should be considered a singleton class.\r\n */\r\nfunction _Application () {\r\n\r\n\tthis._construct ();\r\n}\r\n\r\n_Application.prototype = {\r\n\r\n\t// PUBLIC ..........................................................\r\n\r\n\t/**\r\n\t * Identifies this management console instance on the server.\r\n\t * There is a fair chance that no two users get the same ID.\r\n\t * @type {string}\r\n\t */\r\n\tCONSOLE_ID : KeyMaster.getUniqueKey (),\r\n\r\n\t/**\r\n\t * Timeout in milliseconds before we proclaim a global application blur event.\r\n\t * @type {number}\r\n\t */\r\n\t_TIMEOUT_LOSTFOCUS : 250,\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tlogger : SystemLogger.getLogger ( \"Application\" ),\r\n\r\n\t/**\r\n\t * @type {SystemTimer}\r\n\t */\r\n\ttimer : SystemTimer.getTimer ( \"Application\" ),\r\n\r\n\t/**\r\n\t * Set by ScriptLoaderControl.\r\n\t * @type {boolean}\r\n\t */\r\n\tisDeveloperMode : false,\r\n\r\n\t/**\r\n\t * Set by ScriptLoaderControl.\r\n\t * @type {boolean}\r\n\t */\r\n\tisLocalHost : false,\r\n\r\n\t/**\r\n\t * Set by ScriptLoaderControl.\r\n\t * @type {boolean}\r\n\t */\r\n\thasExternalConnection : false,\r\n\r\n\t/**\r\n\t * Flipped on login and logout.\r\n\t * @type {boolean}\r\n\t */\r\n\tisLoggedIn : false,\r\n\r\n\t/**\r\n\t * Flipped on logout (only).\r\n\t * @type {boolean}\r\n\t */\r\n\tisLoggedOut : false,\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tisLocked : false,\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n \thasStartPage : true,\r\n\r\n\t/**\r\n\t * Flipped when certain critical errors are encountered.\r\n\t * TODO: Is this used?\r\n\t */\r\n\tisMalFunctional : false,\r\n\r\n\t/**\r\n\t * Flipped when the stage is initialized.\r\n\t * @type {boolean}\r\n\t */\r\n \tisOperational : false,\r\n\r\n \t/**\r\n\t * Flipped when top window is closed or reloaded.\r\n\t * @type {boolean}\r\n\t */\r\n \tisShuttingDown : false,\r\n\r\n \t/**\r\n \t * Indicates that the server was shut down (add-on upgrade or something).\r\n \t * @type {boolean}\r\n \t */\r\n \tisOffLine : false,\r\n\r\n \t/**\r\n \t * True when any window has the focus. To check if NO window has focus,\r\n \t * ie the C1 Console has lost focus, better use property \"isBlurred\".\r\n \t * @type {boolean}\r\n \t */\r\n \tisFocused : true,\r\n\r\n \t/**\r\n \t * True when NO window has had focus for some milliseconds. This will\r\n \t * trigger a broadcast of message BroadcastMessages.APPLIATION_BLURRED.\r\n \t * Be advised, however, that this setup is highly dysfunctional in IE.\r\n \t * @type {boolean}\r\n \t */\r\n \tisBlurred: false,\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n \tisTestEnvironment: true,\r\n\r\n \t// PRIVATE ..........................................................\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\t_isMousePositionTracking : false,\r\n\r\n\t/**\r\n\t * @type {Point}\r\n\t */\r\n\t_mousePosition : null,\r\n\r\n\t/**\r\n\t * @type {Point}\r\n\t */\r\n\t_cursorStartPoint : null,\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\t_isDragging : false,\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\t_isShutDownAllowed : true,\r\n\r\n\t/**\r\n\t * Counting lockers.\r\n\t * @type {int}\r\n\t */\r\n\t_lockers : 0,\r\n\r\n\t/**\r\n\t * Used for debug when locking gets stuck.\r\n \t * @type {HashMap<object><boolean>}\r\n \t */\r\n \t_lockthings : {},\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\t_isRegistered : null,\r\n\r\n\t/**\r\n\t * The most recently activated binding.\r\n\t * @type {IActivatable}\r\n\t * @see {DockBinding}\r\n\t * @see {DialogBinding}\r\n\t */\r\n\t_activeBinding : null,\r\n\r\n\t/**\r\n\t * Bookkeeping the chronology of activated bindings. Whenever\r\n\t * a binding looses activation status, this will help us select\r\n\t * the most appropriate binding to activate next.\r\n\t * @type {List}\r\n\t */\r\n\t_activatedBindings : new List (),\r\n\r\n\t/**\r\n\t * Bookkeeping list of dirty tabs.\r\n\t * @type {Map<string><DockTabBinding>}\r\n\t */\r\n\t_dirtyTabs : new Map (),\r\n\r\n\t/**\r\n\t * EXPLAIN HERE!\r\n\t */\r\n\t_topLevelClasses : typeof topLevelClassNames != \"undefined\" ?\r\n\t\t\tnew List ( topLevelClassNames ) : null,\r\n\r\n\r\n\t// METHODS ..........................................................\r\n\r\n\t/**\r\n\t * Construct.\r\n\t */\r\n\t_construct : function () {\r\n\r\n\t\t/*\r\n\t\t * Executed first.\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( WindowManager.WINDOW_EVALUATED_BROADCAST, {\r\n\t\t\thandleBroadcast : function () {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tApplication.initialize ();\r\n\t\t\t\t} catch ( exception ) {\r\n\t\t\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\t\t\tthrow ( exception );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t * Executed on startup if log is open; otherwise called when log opens.\r\n\t\t * This cannot be placed in the \"SystemLogger.js\" because of script\r\n\t\t * loading dependancies in the file.\r\n\t\t * @see {SystemLogPageBinding#onBindingRegister}\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMLOG_OPENED, {\r\n\t\t\thandleBroadcast : function ( broadcast, outputwindow ) {\r\n\t\t\t\tSystemLogger.unsuspend ( outputwindow );\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t * Executed when the systemlog wiew closes.\r\n\t\t * @see {SystemLogPageBinding#onBindingDispose}\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMLOG_CLOSED, {\r\n\t\t\thandleBroadcast : function () {\r\n\t\t\t\tSystemLogger.suspend ();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t * Executed last - when the stage is ready and login performed.\r\n\t\t * A short timeout prevents an occasional layout bug in Explorer.\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.STAGE_INITIALIZED, {\r\n\t\t\thandleBroadcast : function () {\r\n\r\n\t\t\t\t///*\r\n\t\t\t\t// * Launching system developer panels.\r\n\t\t\t\t// */\r\n\t\t\t\t//if (Application.isDeveloperMode && !Client.isPad) {\r\n\t\t\t\t//\tStageBinding.handleViewPresentation ( \"Composite.Management.SystemLog\" );\r\n\t\t\t\t//\tStageBinding.handleViewPresentation ( \"Composite.Management.Developer\" );\r\n\t\t\t\t//}\r\n\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tProgressBarBinding.notch ( 4 );\r\n\t\t\t\t\tApplication.isOperational = true;\r\n\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.APPLICATION_OPERATIONAL );\r\n\t\t\t\t}, PageBinding.TIMEOUT );\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t * Setup ESCAPE to act as a panic button to close\r\n\t\t * the mastercover when a server error occurred.\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.KEY_ESCAPE, {\r\n\t\t\thandleBroadcast : function () {\r\n\t\t\t\tif ( Application.isLocked ) {\r\n\t\t\t\t\tApplication.unlock ( Application, true );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/**\r\n\t\t * Flag server offline status.\r\n\t\t * Probably broadcasted by a {@link SOAPRequest}.\r\n\t\t * The \"Working\" cover screen is handled by {@link MessageQueue}\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.SERVER_OFFLINE, {\r\n\t\t\thandleBroadcast : function () {\r\n\t\t\t\tApplication.isOffLine = true;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t * Flag server online status.\r\n\t\t * Probably broadcasted by a {@link SOAPRequest}\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.SERVER_ONLINE, {\r\n\t\t\thandleBroadcast : function () {\r\n\t\t\t\tApplication.isOffLine = false;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t * Index dirty tab. Enable \"save all\"\r\n\t\t * when first tab is registered dirty.\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.DOCKTAB_DIRTY, {\r\n\t\t\thandleBroadcast : function ( broadcast, arg ) {\r\n\t\t\t\tvar list = Application._dirtyTabs;\r\n\t\t\t\tlist.set ( arg.key, arg );\r\n\t\t\t\tif ( list.countEntries () == 1 ) {\r\n\t\t\t\t\tvar broadcaster = top.app.bindingMap.broadcasterHasDirtyTabs;\r\n\t\t\t\t\tbroadcaster.enable ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t * Un-index dirty tab.\r\n\t\t */\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.DOCKTAB_CLEAN, {\r\n\t\t\thandleBroadcast : function ( broadcast, arg ) {\r\n\t\t\t\tvar list = Application._dirtyTabs;\r\n\t\t\t\tlist.del ( arg.key );\r\n\t\t\t\tif ( list.countEntries () == 0 ) {\r\n\t\t\t\t\tvar broadcaster = top.app.bindingMap.broadcasterHasDirtyTabs;\r\n\t\t\t\t\tbroadcaster.disable ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Identifies.\r\n\t */\r\n\ttoString : function  () {\r\n\r\n\t\treturn \"[Application]\";\r\n\t},\r\n\r\n\t/**\r\n\t * Login initializes webservices.\r\n\t * @see {KickStart}\r\n\t */\r\n\tlogin : function () {\r\n\r\n\t\tthis.isLoggedIn = true;\r\n\r\n\t\t// Add Autobahn startup here. Obtain session, subscribe to messages\r\n\r\n\t\tConfigurationService\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_CONFIGURATION );\r\n\t\tConsoleMessageQueueService\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_MESSAGEQUEUE );\r\n\t\tEditorConfigurationService \t= WebServiceProxy.createProxy ( Constants.URL_WSDL_EDITORCONFIG );\r\n\t\tFlowControllerService \t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_FLOWCONTROLLER );\r\n\t\tStringService\t\t\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_STRINGSERVICE );\r\n\t\tTreeService\t\t\t\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_TREESERVICE );\r\n\t\tSecurityService\t\t\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_SECURITYSERVICE );\r\n\t\tXhtmlTransformationsService = WebServiceProxy.createProxy ( Constants.URL_WSDL_XHTMLTRANSFORM );\r\n\t\tPageTemplateService\t\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_PAGETEMPLATE );\r\n\t\tFunctionService\t\t\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_FUNCTIONSERVICE );\r\n\t\tLocalizationService\t\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_LOCALIZATION );\r\n\t\tSourceValidationService\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_SOURCEVALIDATION );\r\n\t\tMarkupFormatService\t\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_MARKUPFORMAT );\r\n\t\tPageService\t\t\t\t\t= WebServiceProxy.createProxy ( Constants.URL_WSDL_PAGESERVICE );\r\n\r\n\t\tProgressBarBinding.notch ( 4 );\r\n\r\n\t\t/*\r\n\t\t * WebKit needs a short break here...\r\n\t\t */\r\n\t\tfunction next () {\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.APPLICATION_LOGIN );\r\n\t\t}\r\n\t\tif ( Client.isWebKit ) {\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tnext ();\r\n\t\t\t}, 0 );\r\n\t\t} else {\r\n\t\t\tnext ();\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Log out.\r\n     * @return {Promise}\r\n\t */\r\n\tlogout: function () {\r\n\t\tvar self = this;\r\n\t\tvar promise = new Promise(function (resolve, reject) {\r\n\t\t\tif (self.isLoggedIn) {\r\n\t\t\t\tself.isLoggedIn = false;\r\n\t\t\t\tself.isLoggedOut = true;\r\n\t\t\t\tLoginService.Logout(true, function (result, fault) {\r\n\t\t\t\t\tif (fault) {\r\n\t\t\t\t\t\tself.isLoggedIn = true;\r\n\t\t\t\t\t\tself.isLoggedOut = false;\r\n\t\t\t\t\t\talert(\"Logout failed.\");\r\n\t\t\t\t\t\treject();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tresolve(result);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn promise;\r\n\t},\r\n\r\n\t/**\r\n\t * Blocking all interaction with the application interface.\r\n\t * We count all lockers so that we know when to unlock.\r\n\t * We also require a reference to the entity that caused the\r\n\t * lock. This may help in debugging stuck locks.\r\n\t * @param {object} Whatever invoked the lock.\r\n\t */\r\n\tlock : function ( object ) {\r\n\r\n\t\tif ( object != null ) {\r\n\t\t\tthis._lockthings [ object ] = true;\r\n\t\t\tif ( top.bindingMap.mastercover != null ) {\r\n\t\t\t\tif ( this._lockers >= 0 ) {\r\n\t\t\t\t\tthis._lockers ++;\r\n\t\t\t\t\tif ( this._lockers == 1 ) {\r\n\t\t\t\t\t\tthis.isLocked = true;\r\n\t\t\t\t\t\ttop.bindingMap.mastercover.show ();\r\n\t\t\t\t\t\tif ( top.app != null && top.app.bindingMap.throbber != null ) {\r\n\t\t\t\t\t\t\ttop.app.bindingMap.throbber.play ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthrow \"Application: No locker specified.\";\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Unblocking interaction when all lockers are ready.\r\n\t * @param {object} object Whatever invoked the unlock.\r\n\t * @param @optional {boolean} isForcedUnlock\r\n\t */\r\n\tunlock : function ( object, isForcedUnlock ) {\r\n\r\n\t\tif ( object != null ) {\r\n\t\t\tdelete this._lockthings [ object ];\r\n\t\t\tif ( top.bindingMap.mastercover != null ) {\r\n\t\t\t\tif ( isForcedUnlock || this._lockers > 0 ) {\r\n\t\t\t\t\tif ( isForcedUnlock ) {\r\n\t\t\t\t\t\tvar out = \"Unlocked by \" + new String ( object )+ \"\\n\";\r\n\t\t\t\t\t\tfor ( var locker in this._lockthings ) {\r\n\t\t\t\t\t\t\tout += \"Locked by \" + new String ( locker ) + \". \";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.logger.debug ( out );\r\n\t\t\t\t\t\tthis._lockers = 0;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis._lockers --;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( this._lockers == 0 ) {\r\n\t\t\t\t\t\tthis.isLocked = false;\r\n\t\t\t\t\t\ttop.bindingMap.mastercover.hide ();\r\n\t\t\t\t\t\tif ( top.app != null && top.app.bindingMap.throbber != null ) {\r\n\t\t\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\t\t\ttop.app.bindingMap.throbber.stop ();\r\n\t\t\t\t\t\t\t}, 250 );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthrow \"Application: No unlocker specified.\";\r\n\t\t}\r\n\t},\r\n\r\n\thasLock : function ( locker ) {\r\n\r\n\t\treturn this._lockthings [ locker ] == true;\r\n\t},\r\n\r\n\t/**\r\n\t * Bookkeeping activated bindings so that an active-status\r\n\t * \"undo\" history can be maintained.\r\n\t * @param {IActivatable} binding\r\n\t */\r\n\tactivate: function (binding) {\r\n\r\n\t\tif (binding !== this._activeBinding) {\r\n\t\t\tvar lastBinding = this._activeBinding;\r\n\t\t\tthis._activeBinding = binding;\r\n\t\t\tthis._activatedBindings.add(binding);\r\n\t\t\tif (lastBinding && lastBinding.isActive) {\r\n\t\t\t\tlastBinding.deActivate();\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * If the currently activated binding get's deactivated, select the last\r\n\t * activated binding for activation. This defaults to the explorer dock.\r\n\t * @param {IActivatable} binding\r\n\t */\r\n\tdeActivate : function ( binding ) {\r\n\r\n\t\tvar nextBinding = null;\r\n\t\tvar bestBinding = null;\r\n\r\n\t\tif ( binding == this._activeBinding ) {\r\n\t\t\twhile ( !bestBinding && this._activatedBindings.hasEntries ()) {\r\n\t\t\t\tnextBinding = this._activatedBindings.extractLast ();\r\n\t\t\t\tif ( nextBinding != binding && nextBinding.isActivatable ) {\r\n\t\t\t\t\tbestBinding = nextBinding;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( bestBinding ) {\r\n\t\t\t\tbestBinding.activate();\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Tracking global focused status. NOTE that you cannot trust these things in IE.\r\n\t * Specifically because IE may decide to declare a blur event (one one object)\r\n\t * AFTER the focus event (of another object). You should in fact never trust IE.\r\n\t * @param isFocused\r\n\t */\r\n\tfocused : function ( isFocused ) {\r\n\r\n\t\tthis.isFocused = isFocused;\r\n\r\n\t\tif ( isFocused ) {\r\n\t\t\tif ( this.isBlurred ) {\r\n\t\t\t\tthis.isBlurred = false;\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.APPLICATION_FOCUSED );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tif ( !Application.isFocused ) {\r\n\t\t\t\t\tApplication.isBlurred = true;\r\n\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.APPLICATION_BLURRED );\r\n\t\t\t\t}\r\n\t\t\t}, Application._TIMEOUT_LOSTFOCUS )\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Initialize.\r\n\t */\r\n\tinitialize : function () {\r\n\r\n\t\t/*\r\n\t\t * Setup shutdown stuff\r\n\t\t * TODO: make beforeunloadd stuff work reliably in both engines!\r\n\t\t */\r\n\t\tDOMEvents.addEventListener ( top, DOMEvents.UNLOAD, {\r\n\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.APPLICATION_ONSHUTDOWN );\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.APPLICATION_SHUTDOWN );\r\n\t\t\t\tif ( !Application.isShuttingDown ) { // this may be set by quit method already\r\n\t\t\t\t\tApplication.isShuttingDown = true;\r\n\t\t\t\t\tif ( FlowControllerService != null ) {\r\n\t\t\t\t\t\tFlowControllerService.ReleaseAllConsoleResources ( Application.CONSOLE_ID );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif ( this.isLoggedIn && !Application.isDeveloperMode ) {\r\n\t\t\t\t\tApplication.logout ();\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\tDOMEvents.addEventListener ( top, DOMEvents.BLUR, {\r\n\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\tApplication.logger.debug ( Math.random ())\r\n\t\t\t}\r\n\t\t});\r\n\t\t*/\r\n\r\n\t\t/*\r\n\t\ttop.onblur = function () {\r\n\t\t\tApplication.logger.debug ( Math.random ())\r\n\t\t}\r\n\t\t*/\r\n\r\n\t\t// broadcast startup\r\n\t\tEventBroadcaster.broadcast (\r\n\t\t\tBroadcastMessages.APPLICATION_STARTUP\r\n\t\t);\r\n\t},\r\n\r\n\t/**\r\n\t * Cancel shutdown. Although we can't really\r\n\t * cancel the shutdown, so don't use this.\r\n\t */\r\n\tcancelShutDown : function () {\r\n\r\n\t\tthis._isShutDownAllowed = false;\r\n\t},\r\n\r\n\t/**\r\n\t * Setup standard framework mouseeventlisteners.\r\n\t * Intercepting mousedown, mousemove, mouseup, keydown, keyup.\r\n\t * @param {DOMDocument} doc\r\n\t */\r\n\tframework : function ( doc ) {\r\n\r\n\t\tvar win = DOMUtil.getParentWindow ( doc );\r\n\t\tif ( win != null ) {\r\n\t\t\tif ( !win.standardEventHandler ) {\r\n\t\t\t\twin.standardEventHandler = new StandardEventHandler ( doc );\r\n\t\t\t} else {\r\n\t\t\t\t// throw \"StandardEventHandler added twice!\";\r\n\t\t\t\t// TODO: investigate why editor-documents fall in this trap!\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Normalize input and textarea elements.\r\n\t * @param {DOMDocument} doc\r\n\t */\r\n\tnormalize : function ( doc ) {\r\n\r\n\t\t/*\r\n\t\tif ( !this.heyho ) {\r\n\r\n\t\t\tthis.heyho = setInterval ( function () {\r\n\t\t\t\tApplication.logger.debug ( StandardEventHandler.isBackAllowed );\r\n\t\t\t}, 3000 );\r\n\t\t}\r\n\r\n\t\tvar win = DOMUtil.getParentWindow ( doc );\r\n\t\tif ( win != null ) {\r\n\t\t\tif ( !win.standardEventHandlerFixer ) {\r\n\t\t\t\twin.standardEventHandlerFixer = new StandardEventHandlerFixer ( doc );\r\n\t\t\t}\r\n\t\t}\r\n\t\t*/\r\n\t},\r\n\r\n\t/**\r\n\t * @implements {IActionListener}\r\n\t * @param {Action} action\r\n\t */\r\n\thandleAction : function ( action ) {\r\n\r\n\t\tswitch ( action.type ) {\r\n\t\t\tcase Application.REFRESH :\r\n\t\t\t\tthis.refresh ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Declare top level application classes as local variables in another window.\r\n\t * This way, authors can address eg. the SystemLogger as such instead of top.SystemLogger\r\n\t * Only the classes from the \"top\" folder are included (exluding \"page\" folder classes).\r\n\t * Note that this is only relevant for developermode!\r\n\t * @param {DocumentView} win\r\n\t */\r\n\tdeclareTopLocal : function ( win ) {\r\n\r\n\t\t/*\r\n\t\t * TODO: SCRIPLOADERCONTROL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n\t\t */\r\n\t\tvar TOP_SCRIPTS = Resolver.resolve ( \"/scripts/source/top/\" );\r\n\r\n\t\t/*\r\n\t\t * Please observe that we follow the Java convention of naming\r\n\t\t * any code file according to the single class it contains!\r\n\t\t */\r\n\t\tif ( this._topLevelClasses == null ) {\r\n\t\t\tthis._topLevelClasses = new List ();\r\n\t\t\tvar self = this;\r\n\t\t\tnew List (\r\n\t\t\t\tDOMUtil.getElementsByTagName ( document, \"script\" )\r\n\t\t\t).each ( function ( script ) {\r\n\t\t\t\tvar src = script.src;\r\n\t\t\t\tif ( src.indexOf ( TOP_SCRIPTS ) >-1 ) {\r\n\t\t\t\t\tvar name = src.substring (\r\n\t\t\t\t\t\tsrc.lastIndexOf ( \"/\" ) + 1,\r\n\t\t\t\t\t\tsrc.lastIndexOf ( \".js\" )\r\n\t\t\t\t\t);\r\n\t\t\t\t\tself._topLevelClasses.add ( name );\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\tthis._topLevelClasses.each ( function ( name ) {\r\n\t\t\tif ( window [ name ] != null ) {\r\n\t\t\t\twin [ name ] = window [ name ];\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * TODO: Explain this method.\r\n\t * @param {MouseEvent} e\r\n\t * @return {boolean}\r\n\t */\r\n\ttrackMousePosition : function ( e ) {\r\n\r\n\t\tvar isTracking = false;\r\n\t\tif ( this._isMousePositionTracking ) {\r\n\t\t\tisTracking = true;\r\n\t\t\tif ( Client.isExplorer && e.button != 1 ) {\r\n\t\t\t\tisTracking = false;\r\n\t\t\t}\r\n\t\t\tif ( isTracking ) {\r\n\t\t\t\tthis._mousePosition = DOMUtil.getUniversalMousePosition ( e );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn isTracking;\r\n\t},\r\n\r\n\r\n\t// MOUSE TRACKING ............................................................\r\n\r\n\t/**\r\n\t * Enable mouse position tracking.\r\n\t * @param {MouseEvent} e\r\n\t */\r\n\tenableMousePositionTracking : function ( e ) {\r\n\r\n\t\tif ( e ) {\r\n\t\t\tthis._isMousePositionTracking = true;\r\n\t\t\tthis._mousePosition = DOMUtil.getUniversalMousePosition ( e );\r\n\t\t} else {\r\n\t\t\tthrow new Error (\r\n\t\t\t\t\"Application: MouseEvent undefined.\"\r\n\t\t\t);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Disable mouse position tracking.\r\n\t */\r\n\tdisableMousePositionTracking : function () {\r\n\r\n\t\tthis._isMousePositionTracking = false;\r\n\t\tthis._mouseposition = null;\r\n\t},\r\n\r\n\t/**\r\n\t * Get mouse position.\r\n\t * @return {Point}\r\n\t */\r\n\tgetMousePosition : function () {\r\n\r\n\t\treturn this._mousePosition;\r\n\t},\r\n\r\n\r\n\t// DRAG AND DROP ............................................................\r\n\r\n\t/**\r\n\t * Drag start.\r\n\t * @implements {IDragHandler}\r\n\t * @param {Point} point\r\n\t */\r\n\tonDragStart : function ( point ) {\r\n\r\n\t\tvar binding = BindingDragger.draggedBinding;\r\n\r\n\r\n\t\tif ( Interfaces.isImplemented ( IDraggable, binding, true ) == true ) {\r\n\t\t\tif ( !this._isDragging ) {\r\n\t\t\t\tapp.bindingMap.dragdropcursor.setImage (\r\n\t\t\t\t\tbinding.getImage ()\r\n\t\t\t\t);\r\n\t\t\t\tthis._cursorStartPoint = point;\r\n\t\t\t\tapp.bindingMap.dragdropcursor.setPosition (\r\n\t\t\t\t\tthis._cursorStartPoint\r\n\t\t\t\t);\r\n\t\t\t\tCursorBinding.fadeIn ( app.bindingMap.dragdropcursor );\r\n\t\t\t\tif ( binding.showDrag ) {\r\n\t\t\t\t\tbinding.showDrag ();\r\n\t\t\t\t}\r\n\t\t\t\tEventBroadcaster.broadcast (\r\n\t\t\t\t\tBroadcastMessages.TYPEDRAG_START,\r\n\t\t\t\t\tbinding.dragType\r\n\t\t\t\t);\r\n\t\t\t\tthis._isDragging = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Dragging.\r\n\t * @implements {IDragHandler}\r\n\t * @param {Point} diff\r\n\t */\r\n\tonDrag : function ( diff ) {\r\n\r\n\t\tif ( this._isDragging ) {\r\n\t\t\tvar point = new Point (\r\n\t\t\t\tthis._cursorStartPoint.x + diff.x,\r\n\t\t\t\tthis._cursorStartPoint.y + diff.y\r\n\t\t\t);\r\n\t\t\tapp.bindingMap.dragdropcursor.setPosition (\r\n\t\t\t\tpoint\r\n\t\t\t);\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Drag stop.\r\n\t * @implements {IDragHandler}\r\n\t * @param {Point} diff\r\n\t */\r\n\tonDragStop : function ( diff ) {\r\n\r\n\t\tif ( this._isDragging ) {\r\n\r\n\t\t\tvar binding = BindingDragger.draggedBinding;\r\n\r\n\t\t\tif ( binding.hideDrag ) {\r\n\t\t\t\tbinding.hideDrag ();\r\n\t\t\t}\r\n\r\n\t\t\tEventBroadcaster.broadcast (\r\n\t\t\t\tBroadcastMessages.TYPEDRAG_STOP,\r\n\t\t\t\tbinding.dragType\r\n\t\t\t)\r\n\r\n\t\t\tthis._isDragging = false;\r\n\r\n\t\t\tbinding = BindingAcceptor.acceptingBinding;\r\n\r\n\t\t\t/*\r\n\t\t\t * Accept dragged binding.\r\n\t\t\t */\r\n\t\t\tif ( binding != null ) {\r\n\t\t\t\tif ( Interfaces.isImplemented ( IAcceptable, binding, true ) == true ) {\r\n\t\t\t\t\tbinding.accept (\r\n\t\t\t\t\t\tBindingDragger.draggedBinding\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow new Error ( \"Application: IAcceptable not implemented \" + binding );\r\n\t\t\t\t}\r\n\t\t\t\tBindingAcceptor.acceptingBinding = null;\r\n\t\t\t\tCursorBinding.fadeOut ( app.bindingMap.dragdropcursor );\r\n\r\n\t\t\t/*\r\n\t\t\t * Reject dragged binding.\r\n\t\t\t */\r\n\t\t\t} else {\r\n\r\n\t\t\t\tapp.bindingMap.dragdropcursor.hide ();\r\n\r\n\t\t\t\t/*\r\n\t\t\t\tif ( app.bindingMap.dragdropcursor.getOpacity () == 1 ) {\r\n\t\t\t\t\tvar cursorEndPoint = new Point (\r\n\t\t\t\t\t\tthis._cursorStartPoint.x + diff.x,\r\n\t\t\t\t\t\tthis._cursorStartPoint.y + diff.y\r\n\t\t\t\t\t);\r\n\t\t\t\t\tCursorBinding.moveOut (\r\n\t\t\t\t\t\tapp.bindingMap.dragdropcursor,\r\n\t\t\t\t\t\tthis._cursorEndPoint,\r\n\t\t\t\t\t\tthis._cursorStartPoint\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tapp.bindingMap.dragdropcursor.hide ();\r\n\t\t\t\t}\r\n\t\t\t\t*/\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\r\n\t// SHORTCUTS .................................................................\r\n\r\n\t/**\r\n\t * Reloading application window [control+R].\r\n\t * See the KeySetBinding in file \"index.aspx\".\r\n\t * @param {boolean} isForcedReload\r\n\t */\r\n\treload : function ( isForcedReload ) {\r\n\r\n\t\t/*\r\n\t\t * When developermode in Prism, this will clear the file cache.\r\n\t\t */\r\n\t\tif ( this.isDeveloperMode || isForcedReload ) {\r\n\t\t\tif ( this.isDeveloperMode && Client.isPrism ) {\r\n\t\t\t\tPrism.clearCache ();\r\n\t\t\t}\r\n\t\t\tApplication.lock ( Application );\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\ttop.window.location.reload ( true );\r\n\t\t\t}, 0 );\r\n\t\t} else {\r\n\t\t\tif ( Application.isOperational ) {\r\n\t\t\t\tDialog.question (\r\n\t\t\t\t\tStringBundle.getString ( \"ui\", \"Website.Application.DialogReload.Title\" ),\r\n\t\t\t\t\tStringBundle.getString ( \"ui\", \"Website.Application.DialogReload.Text\" ),\r\n\t\t\t\t\tDialog.BUTTONS_ACCEPT_CANCEL,\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\thandleDialogResponse : function ( response ) {\r\n\t\t\t\t\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\t\t\t\t\tApplication.reload ( true );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tApplication.reload ( true );\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Quit application. This will automatically log off. When\r\n\t * running in developermode, closing or reloading the main\r\n\t * browserwindow will *not* log off unless we call this method!\r\n\t */\r\n\tquit : function () {\r\n\r\n\t\t/*\r\n\t\t * Note that Prism cannot actually close the window (because it\r\n\t\t * is the main browser window), but at least we can hide the interface.\r\n\t\t */\r\n\t\tApplication.isShuttingDown = true;\r\n\t\tif ( FlowControllerService != null ) {\r\n\t\t\tFlowControllerService.ReleaseAllConsoleResources ( Application.CONSOLE_ID );\r\n\t\t}\r\n\r\n\t\tthis.logout().then(function (redirectLocation) {\r\n\t\t\tif (redirectLocation) {\r\n\t\t\t\tlocation = redirectLocation;\r\n\t\t\t} else {\r\n\t\t\t\tlocation.reload();\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Has dirty tabs?\r\n\t * @return {boolean}\r\n\t */\r\n\thasDirtyDockTabs : function () {\r\n\r\n\t\treturn this._dirtyTabs.countEntries () > 0;\r\n\t},\r\n\r\n\t/**\r\n\t * Get dirty tabs.\r\n\t * @return {List<string><DockTabBinding>}\r\n\t */\r\n\tgetDirtyDockTabsTabs : function () {\r\n\r\n\t\treturn this._dirtyTabs;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_Application}\r\n */\r\nvar Application = new _Application ();\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/BroadcastMessages.js",
    "content": "/**\r\n * @class\r\n * Global broadcast messages.\r\n * @see {EventBroadcaster}\r\n * \r\n * Don't instantiate this class manually. Access through \r\n * instance variable \"BroadcastMessages\" declared below.\r\n * This instance should be considered a singleton class.\r\n */\r\nfunction _BroadcastMessages () {}\r\n\r\n/*\r\n * Public fields.\r\n */\r\n_BroadcastMessages.prototype = {\r\n\t\r\n\t/*\r\n\t * Application status\r\n\t */\r\n\tAPPLICATION_STARTUP\t\t\t\t\t: \"application startup\",\r\n\tAPPLICATION_LOGIN\t\t\t\t\t: \"application login\",\r\n\tAPPLICATION_LOGOUT\t\t\t\t\t: \"application logout\",\r\n\tAPPLICATION_OPERATIONAL\t\t\t\t: \"application operational\",\r\n\tAPPLICATION_ONSHUTDOWN\t\t\t\t: \"application onshutdown\",\r\n\tAPPLICATION_SHUTDOWN\t\t\t\t: \"application shutdown\",\r\n\tAPPLICATION_ERROR\t\t\t\t\t: \"application error\",\r\n\tAPPLICATION_BLURRED\t\t\t\t\t: \"application blurred\",\r\n\tAPPLICATION_FOCUSED\t\t\t\t\t: \"application focused\",\r\n\tAPPLICATION_KICKSTART\t\t\t\t: \"application kickstart\",\r\n\t\r\n\t/*\r\n\t * Experimental\r\n\t */\r\n\tCODEMIRROR_LOADED\t\t\t\t\t: \"codemirror loaded\",\r\n\r\n\t/*\r\n\t * Mouse events\r\n\t */\r\n\tMOUSEEVENT_MOUSEDOWN \t\t\t\t: \"mouseevent mousedown\",\r\n\tMOUSEEVENT_MOUSEUP \t\t\t\t\t: \"mouseevent mouseup\",\r\n\tMOUSEEVENT_MOUSEMOVE \t\t\t\t: \"mouseevent mousemove\",\r\n\r\n\tTOUCHEVENT_TOUCHSTART\t\t\t\t: \"touchevent touchstart\",\r\n\t\r\n\t/*\r\n\t * WindowManager keys\r\n\t */\r\n\t$WINKEY_LOADED\t\t\t\t\t\t: \"${windowkey} loaded\",\r\n\t$WINKEY_UNLOADED\t\t\t\t\t: \"${windowkey} unloaded\",\r\n\t$WINKEY_EVALUATED\t\t\t\t\t: \"${windowkey} evaluated\",\r\n\t$WINKEY_RESIZED\t\t\t\t\t\t: \"${windowkey} resized\",\r\n\t$WINKEY_HRESIZED\t\t\t\t\t: \"${windowkey} horizontally resized\",\r\n\t$WINKEY_VRESIZED\t\t\t\t\t: \"${windowkey} vertically resized\",\r\n\t\r\n\t/*\r\n\t * Startup milestones\r\n\t */\r\n\tLOADED_NAVIGATOR\t\t\t\t\t: \"navigator loaded\",\r\n\tLOADED_MAINSTAGE\t\t\t\t\t: \"mainstage loaded\",\r\n\tLOCALSTORE_INITIALIZED\t\t\t\t: \"localstore initialized\",\r\n\tPERSISTANCE_INITIALIZED\t\t\t\t: \"persistance initialized\",\r\n\tSTAGE_INITIALIZED\t\t\t\t\t: \"stage initialized\",\r\n\t\r\n\t/*\r\n\t * Keys\r\n\t */\r\n\tKEY_SHIFT_DOWN\t\t\t\t\t\t: \"shiftkeydown\",\r\n\tKEY_SHIFT_UP\t\t\t\t\t\t: \"shiftkeyup\",\r\n\tKEY_CONTROL_DOWN\t\t\t\t\t: \"controlkeydown\",\r\n\tKEY_CONTROL_UP\t\t\t\t\t\t: \"controlkeyup\",\r\n\tKEY_ARROW\t\t\t\t\t\t\t: \"arrowkey\",\r\n\tKEY_ENTER\t\t\t\t\t\t\t: \"enterkeydown\",\r\n\tKEY_ESCAPE\t\t\t\t\t\t\t: \"escapekeydown\",\r\n\tKEY_SPACE\t\t\t\t\t\t\t: \"spacekeydown\",\r\n\tKEY_TAB\t\t\t\t\t\t\t\t: \"tabkeydown\",\r\n\tKEY_ALT\t\t\t\t\t\t\t\t: \"altkeydown\",\r\n\tKEY_CONTROLTAB\t\t\t\t\t\t: \"controltabkeysdown\",\r\n\t\r\n\t/*\r\n\t * Dragndrop\r\n\t */\r\n\tTYPEDRAG_START\t\t\t\t\t\t: \"typedrag start\",\r\n\tTYPEDRAG_STOP\t\t\t\t\t\t: \"typedrag stop\",\r\n\tTYPEDRAG_PAUSE\t\t\t\t\t\t: \"typedrag pause\",\r\n\t\r\n\t/*\r\n\t * Dock events\r\n\t */\r\n\tDOCK_MAXIMIZED\t\t\t\t\t\t: \"dockmaximized\",\r\n\tDOCK_MINIMIZED\t\t\t\t\t\t: \"dockminimized\",\r\n\tDOCK_NORMALIZED\t\t\t\t\t\t: \"docknormalized\",\r\n\tDOCKTABBINDING_SELECT\t\t\t\t: \"docktab select\",\r\n\t\r\n\t/*\r\n\t * Tree events\r\n\t */\r\n\tSYSTEMTREEBINDING_REFRESH\t\t\t: \"systemtree refresh\",\r\n\tSYSTEMTREEBINDING_REFRESHALL\t\t: \"systemtree refresh all\",\r\n\tSYSTEMTREEBINDING_REFRESHING\t\t: \"systemtree refreshing\",\r\n\tSYSTEMTREEBINDING_REFRESHED\t\t\t: \"systemtree refreshed\",\r\n\tSYSTEMTREEBINDING_REFRESHED_AFTER\t: \"systemtree refreshed after\",\r\n\tSYSTEMTREEBINDING_FOCUS\t\t\t\t: \"systemtree focus\",\r\n\tSYSTEMTREEBINDING_CUT  \t\t\t\t: \"systemtree cut\",\r\n\tSYSTEMTREEBINDING_COPY\t\t\t\t: \"systemtree copy\",\r\n\tSYSTEMTREEBINDING_PASTE \t\t\t: \"systemtree paste\",\r\n\tSYSTEMTREEBINDING_COLLAPSEALL\t\t: \"systemtree collapse all\",\r\n\tSYSTEMTREENODEBINDING_FOCUS\t\t\t: \"systemtreenode focus\",\r\n\tSYSTEMTREEBINDING_LOCKTOEDITOR\t\t: \"systemtreenode lock to editor\",\r\n\tSYSTEMTREENODEBINDING_FORCE_OPEN\t: \"systemtreenode force open\",\r\n\tSYSTEMTREENODEBINDING_FORCING_OPEN\t: \"systemtreenode forcing open\",\r\n\tSYSTEMTREENODEBINDING_FORCED_OPEN\t: \"systemtreenode forced open\",\r\n\t\r\n\t/*\r\n\t * Start page\r\n\t */\r\n\tSTART_COMPOSITE\t\t\t\t\t\t: \"startcomposite\",\r\n\tSTOP_COMPOSITE\t\t\t\t\t\t: \"stopcomposite\",\r\n\tCOMPOSITE_START\t\t\t\t\t\t: \"compositestart\",\r\n\tCOMPOSITE_STOP\t\t\t\t\t\t: \"compositestop\",\r\n\t\r\n\t/*\r\n\t * View events.\r\n\t */\r\n\tVIEW_OPENING\t\t\t\t\t\t: \"view opening\",\r\n\tVIEW_OPENED\t\t\t\t\t\t\t: \"view opened\",\r\n\tVIEW_COMPLETED\t\t\t\t\t\t: \"view completed\",\r\n\tCLOSE_VIEW\t\t\t\t\t\t\t: \"close view\",\r\n\tCLOSE_VIEWS\t\t\t\t\t\t\t: \"close views\", // close all views at DockBinding.MAIN\r\n\tVIEW_CLOSED\t\t\t\t\t\t\t: \"view closed\",\r\n\t\r\n\t/*\r\n\t * Editor events\r\n\t */\r\n\tTINYMCE_INITIALIZED\t\t\t\t\t: \"tinymce initialized\",\r\n\tCODEPRESS_INITIALIZED\t\t\t\t: \"codepress initialized\",\r\n\tVISUALEDITOR_FOCUSED\t\t\t\t: \"visualeditor focused\", // TODO?\r\n\tVISUALEDITOR_BLURRED\t\t\t\t: \"visualditor blurred\", // TODO?\r\n\t\r\n\t/*\r\n\t * Misc events\r\n\t */\r\n\tPERSPECTIVE_CHANGED\t\t\t\t\t: \"perspective changed\",\r\n\tPERSPECTIVES_NONE\t\t\t\t\t: \"no perspectives\",\r\n\tSYSTEMLOG_OPENED\t\t\t\t\t: \"systemlog opened\",\r\n\tSYSTEMLOG_CLOSED\t\t\t\t\t: \"systemlog closed\",\r\n\tSYSTEMACTION_INVOKE\t\t\t\t\t: \"systemaction invoke\",\r\n\tSYSTEMACTION_INVOKED\t\t\t\t: \"systemaction invoked\",\r\n\tSYSTEM_ACTIONPROFILE_PUBLISHED\t\t: \"system actionprofile published\",\r\n\tNAVIGATOR_TREENODE_SELECTED\t\t\t: \"navigator treenode selected\",\r\n\tMODAL_DIALOG_OPENED\t\t\t\t\t: \"modal dialog invoked\",\r\n\tMODAL_DIALOG_CLOSED\t\t\t\t\t: \"modal dialog closed\",\r\n\tCOVERBINDING_MOUSEDOWN \t\t\t\t: \"userinterfacecoverbinding mousedown\",\r\n\tSERVER_OFFLINE\t\t\t\t\t\t: \"server offline\",\r\n\tSERVER_ONLINE\t\t\t\t\t\t: \"server online\",\r\n\tOFFLINE_FLASH_INITIALIZED\t\t\t: \"offline flash initialized\",\r\n\tCLOSE_CURRENT\t\t\t\t\t\t: \"close current\",\r\n\tCLOSE_ALL\t\t\t\t\t\t\t: \"close all\",\r\n\tCLOSE_ALL_DONE\t\t\t\t\t\t: \"close all done\",\r\n\tSAVE_CURRENT\t\t\t\t\t\t: \"save current\",\r\n\tCURRENT_SAVED\t\t\t\t\t\t: \"current saved\",\r\n\tSAVE_ALL\t\t\t\t\t\t\t: \"save all\",\r\n\tSAVE_ALL_DONE\t\t\t\t\t\t: \"save all done\",\r\n\tDOCKTAB_DIRTY\t\t\t\t\t\t: \"docktab dirty\",\r\n\tDOCKTAB_CLEAN\t\t\t\t\t\t: \"docktab clean\",\r\n\tBINDING_RELATE\t\t\t\t\t\t: \"binding relate\",\r\n\tLOCALIZATION_CHANGED\t\t\t\t: \"localization changed\",\r\n\tXHTML_MARKUP_ON\t\t\t\t\t\t: \"xhtml markup on\",\r\n\tXHTML_MARKUP_OFF\t\t\t\t\t: \"xhtml markup off\",\r\n\tXHTML_MARKUP_ACTIVATE\t\t\t\t: \"xhtml markup activate\",\r\n\tXHTML_MARKUP_DEACTIVATE\t\t\t\t: \"xhtml markup deactivate\",\r\n\tHIGHLIGHT_KEYWORDS\t\t\t\t\t: \"highlight keywords\",\r\n\tBIND_TOKEN_TO_VIEW\t\t\t\t\t: \"bind entitytoken to view\",\r\n\tSTAGEDIALOG_OPENED\t\t\t\t\t: \"stage dialog opened\",\r\n\tINVOKE_DEFAULT_ACTION\t\t\t\t: \"invoke default action\",\r\n\tSTAGEDECK_CHANGED\t\t\t\t\t: \"stage deck changed\",\r\n\t/*\r\n\t * Server messages for EventBroadcaster.\r\n\t */\r\n\tLANGUAGES_UPDATED\t\t\t\t\t: \"LocalesUpdated\",\r\n\tFROMLANGUAGE_UPDATED\t\t\t\t: \"ForeignLocaleChanged\", // tree builder language\r\n\tTOLANGUAGE_UPDATED\t\t\t\t\t: \"ActiveLocaleChanged\", // page authoring language\r\n\t\r\n\t/*\r\n\t * MessageQueue.\r\n\t */\r\n\tMESSAGEQUEUE_REQUESTED\t\t\t\t: \"messagequeue requested\", // when new actions are requested\r\n\tMESSAGEQUEUE_EVALUATED\t\t\t\t: \"messagequeue evaluated\", // when all actions are done executing\r\n\t\r\n\t/*\r\n\t * Mostly systemperformance\r\n\t *\r\n\tMICROSOFTAJAXREQUEST\t\t\t\t: \"microsoft ajax request\",\r\n\tPOSTBACK_START\t\t\t\t\t\t: \"postback start\",\r\n\tPOSTBACK_STOP\t\t\t\t\t\t: \"postback stop\",\r\n\tUPDATEPANEL_UPDATING\t\t\t\t: \"updatepanel updating\",\r\n\tUPDATEPANELS_UPDATING\t\t\t\t: \"updatepanels updating\",\r\n\tUPDATEPANELS_UPDATED\t\t\t\t: \"updatepanels updated\",\r\n\t*/\r\n\t\r\n\tUPDATE_LANGUAGES\t\t\t\t\t: \"update languages\"\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_BroadcastMessages}\r\n */\r\nvar BroadcastMessages = new _BroadcastMessages ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Client.js",
    "content": "/**\r\n * @class\r\n * Don't instantiate this class manually. Access through \r\n * instance variable \"Client\" declared below. This \r\n * instance should be considered a singleton class.\r\n */\r\nfunction _Client () {\r\n\t\r\n\tvar agent = navigator.userAgent.toLowerCase ();\r\n\tvar platform = navigator.platform.toLowerCase ();\r\n\r\n\tvar isExplorer = navigator.appName == \"Microsoft Internet Explorer\"; // IE<=10 OR IE11\r\n\tvar isMozilla = !isExplorer && typeof document.createTreeWalker != \"undefined\" ;\r\n\tvar isPrism = isMozilla && ( agent.indexOf ( \"webrunner\" ) >-1 || agent.indexOf ( \"prism\" ) >-1 );\r\n\tvar hasTransitions = history.pushState != null;\r\n\r\n\tthis.isMozilla = isMozilla;\r\n\tthis.isFirefox = agent.indexOf(\"firefox\") > -1;\r\n\tthis.isWebKit = agent.indexOf(\"webkit\") > -1;\r\n\tthis.isPerformanceTest = agent.indexOf(\"performance\") > -1;\r\n\tthis.isExplorer = isExplorer;\r\n\tthis.isExplorer6 = this.isExplorer && ( agent.indexOf ( \"msie 6.0\" ) > -1 || agent.indexOf ( \"msie 6.1\" ) > -1 );\r\n\tthis.isExplorer8 = this.isExplorer && window.XDomainRequest != null;\r\n\tthis.isExplorer11 = !!navigator.userAgent.match(/Trident\\/7\\./);\r\n\tthis.isEdge = !!navigator.userAgent.match(/Edge\\/\\d+/g);\r\n\tthis.isAnyExplorer = this.isExplorer || this.isExplorer11 || this.isEdge;\r\n\tthis.isPrism = isPrism;\r\n\tthis.isWindows = platform.indexOf ( \"win\" ) > -1;\r\n\tthis.isVista = this.isWindows && agent.indexOf(\"windows nt 6\") > -1;\r\n\tthis.isMac = platform.indexOf(\"mac\") > -1;\r\n\tthis.isPad = navigator.userAgent.match(/iPad/i) != null;\r\n\tthis.isOS7 = navigator.userAgent.match(/CPU.*OS 7_\\d/i) != null;\r\n\t\r\n\tvar version = this._getFlashVersion ();\r\n\tthis.hasFlash = ( version && version >= 9 );\r\n\tthis.hasTransitions = hasTransitions;\r\n\r\n\tthis.canvas = !!document.createElement('canvas').getContext;\r\n\r\n\tthis.hasSpellcheck = true;\r\n\tthis.hasXSLTProcessor = this.isMozilla && !this.isExplorer11;\r\n\r\n\treturn this;\r\n}\r\n/*\r\n * Public fields.\r\n */\r\n_Client.prototype = {\r\n\r\n\t/** \r\n\t* Is Internet Explorer?\r\n\t* @type {boolean} \r\n\t*/\r\n\tisExplorer: false,\r\n\r\n\t/**\r\n\t* Is Gecko derivate? \r\n\t* @type {boolean} \r\n\t*/\r\n\tisMozilla: false,\r\n\r\n\t/** \r\n\t* True for Mozilla Prism.\r\n\t* @type {boolean} \r\n\t*/\r\n\tisPrism: false,\r\n\r\n\t/**\r\n\t* Has Flash version 10 minimum? \r\n\t* @type {boolean} \r\n\t*/\r\n\thasFlash: false,\r\n\r\n\t/**\r\n\t* Is Microsoft Windows? Macintosh and Linux \r\n\t* distros uniformely treated as not-Windows.\r\n\t* @type {boolean}\r\n\t*/\r\n\tisWindows: false,\r\n\r\n\t/**\r\n\t* Is Vista or Windows 7? As opposed to Windows XP.\r\n\t* @type {boolean}\r\n\t*/\r\n\tisVista: false,\r\n\r\n\t/**\r\n\t* Supports CSS transitions?\r\n\t* @type {boolean}\r\n\t*/\r\n\thasTransitions: false,\r\n\r\n\t/**\r\n\t* Get Flash version.\r\n\t* @return {int}\r\n\t*/\r\n\t_getFlashVersion: function () {\r\n\r\n\t\tvar result = null;\r\n\t\tvar maxversion = 10; // maximum version tested for\r\n\r\n\t\t// detect flash version\r\n\t\ttry {\r\n\t\t\tif (this.isMozilla == true) {\r\n\t\t\t\tif (typeof navigator.plugins[\"Shockwave Flash\"] != \"undefined\") {\r\n\t\t\t\t\tvar plugin = navigator.plugins[\"Shockwave Flash\"];\r\n\t\t\t\t\tif (plugin) {\r\n\t\t\t\t\t\tvar desc = plugin.description;\r\n\t\t\t\t\t\tif (desc != null) {\r\n\t\t\t\t\t\t\tresult = desc.charAt(desc.indexOf(\".\") - 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tfor (var i = 2; i <= maxversion; i++) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tnew ActiveXObject(\"ShockwaveFlash.ShockwaveFlash.\" + i);\r\n\t\t\t\t\t\tresult = i;\r\n\t\t\t\t\t} catch (exception) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (exception) { };\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Client qualified for the awesome C1 CMS experience?\r\n\t* @return {boolean}\r\n\t*/\r\n\tqualifies: function () {\r\n\r\n\t\tvar result = true;\r\n\t\tvar isOldFox = false;\r\n\t\tif (this.isMozilla && !this.isWebKit && !this.isExplorer11) {\r\n\t\t\tisOldFox = (document.documentElement.mozMatchesSelector === undefined);\r\n\t\t}\r\n\t\tif (window.opera != null || isOldFox || this.isExplorer && !this.canvas) {\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\tfixUI: function (html) {\r\n\t\tif (Client.isExplorer) {\r\n\t\t\thtml = html.replace(/<ui:/g, \"<\").replace(/<\\/ui:/g, \"</\");\r\n\t\t\thtml = html.replace(/(<(\\w+)[^>]*)\\/>/g, \"$1></$2>\");\r\n\t\t}\r\n\t\treturn html;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_Client}\r\n */\r\nvar Client = new _Client ();\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Commands.js",
    "content": "/**\r\n * @class\r\n * Simply because we need to wrap some code up in short method   \r\n * names that can be accessed easily in inline markup.\r\n */\r\nfunction _Commands () {\r\n\t\r\n\tthis._construct ();\r\n}\r\n\r\n/**\r\n * Code.\r\n */\r\n_Commands.prototype = {\r\n\t\r\n\t_URL_ABOUTDIALOG : \"${root}/content/dialogs/about/about.aspx\",\r\n\t_URL_PREFERENCES : \"${root}/content/dialogs/preferences/preferences.aspx\",\r\n\t\r\n\t/**\r\n\t * Construct.\r\n\t */\r\n\t_construct : function () {\r\n\t\t\r\n\t\tvar self = this;\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.SAVE_ALL, {\r\n\t\t\thandleBroadcast : function ( broadcast, arg ) {\r\n\t\t\t\tself.saveAll ( arg );\r\n\t\t\t}\r\n\t\t})\r\n\t},\r\n\r\n\t/**\r\n\t * Opens the About dialog.\r\n\t */\r\n\tabout : function () {\r\n\t\t\r\n\t\tthis._dialog ( this._URL_ABOUTDIALOG );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Opens the Preferences dialog.\r\n\t */\r\n\tpreferences : function () {\r\n\t\t\r\n\t\tthis._dialog ( this._URL_PREFERENCES );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Taking care to fadeout menus before opening dialogs, otherwise   \r\n\t * fading may be jaggy. But what if nobody was using a menu?...\r\n\t */\r\n\t_dialog : function ( url ) {\r\n\t\t\r\n\t\tif ( Client.hasTransitions ) {\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tDialog.invokeModal ( url );\r\n\t\t\t}, Animation.DEFAULT_TIME );\r\n\t\t} else {\r\n\t\t\tDialog.invokeModal ( url );\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Close current editor. This broadcast is intercepted by the DockTabBinding. \r\n\t */\r\n\tclose : function () {\r\n\t\t\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.CLOSE_CURRENT );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Close all (editors). \r\n\t */\r\n\tcloseAll : function () {\r\n\t\t\r\n\t\tthis.saveAll ( true );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Save current editor [CTRL+S].  This broadcast is intercepted by the DockTabBinding.\r\n\t */\r\n\tsave: function () {\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.SAVE_CURRENT );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Save all dirty tabs (in all perspectives), prompting a list.\r\n\t * @param {boolean} isCloseAll\r\n\t */\r\n\tsaveAll : function ( isCloseAll ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Invoke dialog and collect \r\n\t\t * selected tabs in a list.\r\n\t\t */\r\n\t\tvar self = this;\r\n\t\tvar docktabs = Application.getDirtyDockTabsTabs ();\r\n\t\tif ( docktabs.hasEntries ()) {\r\n\t\t\tDialog.invokeModal ( \"${root}/content/dialogs/save/saveall.aspx\", {\r\n\t\t\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\t\t\tswitch ( response ) {\r\n\t\t\t\t\t\tcase Dialog.RESPONSE_ACCEPT :\r\n\t\t\t\t\t\t\tself._handleSaveAllResult ( result, isCloseAll );\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Dialog.RESPONSE_CANCEL :\r\n\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t * Needed for language-change scenario...\r\n\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SAVE_ALL_DONE );\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, docktabs );\r\n\t\t} else if ( isCloseAll ){\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.CLOSE_ALL );\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Handle result from \"save all\" dialog.\r\n\t * @param {DataBindingResultMap} result\r\n\t * @param {boolean} isCloseAll\r\n\t * @return {boolean} True if something was dirty...\r\n\t */\r\n\t_handleSaveAllResult : function ( result, isCloseAll ) {\r\n\t\r\n\t\tvar returnable = false;\r\n\t\t\r\n\t\tvar list = new List ();\r\n\t\tresult.each ( function ( name, tab ) {\r\n\t\t\tif ( tab != false ) {\r\n\t\t\t\tlist.add ( tab );\r\n\t\t\t}\r\n\t\t});\r\n\t\t/*\r\n\t\t * Save tabs from list.\r\n\t\t */\r\n\t\tif ( list.hasEntries ()) {\r\n\t\t\treturnable = true;\r\n\t\t\tvar count = list.getLength ();\r\n\t\t\tvar handler = { \r\n\t\t\t\thandleBroadcast : function ( broadcast, tab ) {\r\n\t\t\t\t\tif ( --count == 0 ) {\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe ( BroadcastMessages.DOCKTAB_CLEAN, this );\r\n\t\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SAVE_ALL_DONE );\r\n\t\t\t\t\t\tif ( isCloseAll ) {\r\n\t\t\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.CLOSE_ALL );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.DOCKTAB_CLEAN, handler );\r\n\t\t\tlist.each ( function ( tab ) {\r\n\t\t\t\ttab.saveContainedEditor ();\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t/*\r\n\t\t\t * Needed for language-change scenario...\r\n\t\t\t */\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SAVE_ALL_DONE );\r\n\t\t}\r\n\t\t\r\n\t\treturn returnable;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Flip display of the system log [control+shift+L]. If an error prevented \r\n\t * the system from starting normally, you'll be happy to know that the log \r\n\t * is still able to open in a regular browser window.\r\n\t */\r\n\tsystemLog : function () {\r\n\t\t\r\n\t\tif ( Application.isOperational ) {\r\n\t\t\tStageBinding.handleViewPresentation ( \"Composite.Management.SystemLog\" );\r\n\t\t} else {\r\n\t\t\tvar win = window.open ( Constants.APPROOT + \"/content/views/dev/systemlog/systemlogoutput.html\" );\r\n\t\t\twin.onload = function () {\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SYSTEMLOG_OPENED, this );\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Launch the Help view.\r\n\t */\r\n\thelp : function () {\r\n\t\t\r\n\t\tvar handle = \"Composite.Management.Help\";\r\n\t\tif ( !StageBinding.isViewOpen ( handle )) {\r\n\t\t\tStageBinding.handleViewPresentation ( handle );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar Commands = new _Commands ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Constants.js",
    "content": "﻿/**\r\n * @class\r\n * Don't instantiate this class manually. Access through \r\n * instance variable \"Constants\" declared below. This \r\n * instance should be considered a singleton class.\r\n */\r\nfunction _Constants () {}\r\n\r\n/*\r\n * Don't use these variables. They will \r\n * be nulled by the end of this file.\r\n */\r\nvar temppath = document.location.pathname;\r\nvar temproot = temppath.substring ( 0, temppath.lastIndexOf ( \"/\" ));\r\n\r\n/*\r\n * Public fields.\r\n */\r\n_Constants.prototype = {\r\n\t\t\r\n\tCOMPOSITE_HOME\t\t\t\t: \"http://www.composite.net\",\r\n\tDUMMY_LINK\t\t\t\t\t: \"javascript:void(false);\",\r\n\t\r\n\tAPPROOT     \t\t\t\t: temproot,\r\n\tWEBSITEROOT\t\t\t\t\t: temproot.substring(0, temproot.length - 9),\r\n\tCONFIGROOT\t\t\t\t\t: temproot.substring(0, temproot.length - 9) + \"Frontend/Config/VisualEditor/\",\r\n\tTEMPLATESROOT     \t\t\t: temproot + \"/templates\",\r\n\tSKINROOT     \t\t\t\t: temproot + \"/skins/system\", // TODO: unhardcode this!\r\n\tTINYROOT\t\t\t\t\t: temproot + \"/content/misc/editors/visualeditor/tinymce\",\r\n\r\n\t/*\r\n\t * Web service desciptions.\r\n\t */\r\n\tURL_WSDL_SETUPSERVICE\t\t: temproot + \"/services/Setup/SetupService.asmx?WSDL\",\r\n\tURL_WSDL_CONFIGURATION\t\t: temproot + \"/services/Configuration/ConfigurationService.asmx?WSDL\", \r\n\tURL_WSDL_LOGINSERVICE\t\t: temproot + \"/services/Login/Login.asmx?WSDL\",\r\n\tURL_WSDL_INSTALLSERVICE\t\t: temproot + \"/services/Installation/InstallationService.asmx?WSDL\",\r\n\tURL_WSDL_MESSAGEQUEUE \t\t: temproot + \"/services/ConsoleMessageQueue/ConsoleMessageQueueServices.asmx?WSDL\",\r\n\tURL_WSDL_EDITORCONFIG \t\t: temproot + \"/services/WysiwygEditor/ConfigurationServices.asmx?WSDL\",\r\n\tURL_WSDL_FLOWCONTROLLER\t\t: temproot + \"/services/FlowController/FlowControllerServices.asmx?WSDL\",\r\n\tURL_WSDL_STRINGSERVICE \t\t: temproot + \"/services/StringResource/StringService.asmx?WSDL\",\r\n\tURL_WSDL_TREESERVICE  \t\t: temproot + \"/services/Tree/TreeServices.asmx?WSDL\",\r\n\tURL_WSDL_XHTMLTRANSFORM\t\t: temproot + \"/services/WysiwygEditor/XhtmlTransformations.asmx?WSDL\",\r\n\tURL_WSDL_PAGETEMPLATE\t\t: temproot + \"/services/WysiwygEditor/PageTemplate.asmx?WSDL\",\r\n\tURL_WSDL_FUNCTIONSERVICE\t: temproot + \"/services/WysiwygEditor/FunctionService.asmx?WSDL\",\r\n\tURL_WSDL_SECURITYSERVICE\t: temproot + \"/services/Tree/SecurityServices.asmx?WSDL\",\r\n\tURL_WSDL_READYSERVICE\t\t: temproot + \"/services/Ready/ReadyService.asmx?WSDL\",\r\n\tURL_WSDL_LOCALIZATION\t\t: temproot + \"/services/Localization/LocalizationService.asmx?WSDL\",\r\n\tURL_WSDL_SOURCEVALIDATION\t: temproot + \"/services/SourceEditor/SourceValidationService.asmx?WSDL\",\r\n\tURL_WSDL_MARKUPFORMAT\t\t: temproot + \"/services/SourceEditor/MarkupFormatService.asmx?WSDL\",\r\n\tURL_WSDL_SEOSERVICE\t\t\t: temproot + \"/services/SearchEngineOptimizationKeyword/SearchEngineOptimizationKeyword.asmx?WSDL\",\r\n\tURL_WSDL_PAGESERVICE\t\t: temproot + \"/services/Page/PageService.asmx?WSDL\",\r\n\tURL_WSDL_DIFFSERVICE\t\t: temproot + \"/services/StringResource/DiffService.asmx?WSDL\",\r\n\t\r\n\t/*\r\n\t * Namespaces.\r\n\t */ \r\n\tNS_XHTML\t\t\t\t\t: \"http://www.w3.org/1999/xhtml\",\r\n\tNS_UI\t\t\t\t\t\t: \"http://www.w3.org/1999/xhtml\",\r\n\tNX_XUL\t\t\t\t\t\t: \"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\",\r\n\tNS_XBL\t\t\t\t\t\t: \"http://www.mozilla.org/xbl\",\r\n\tNS_WSDL\t\t\t\t\t\t: \"http://schemas.xmlsoap.org/wsdl/\",\r\n\tNS_SOAP\t\t\t\t\t\t: \"http://schemas.xmlsoap.org/wsdl/soap/\",\r\n\tNS_ENVELOPE\t\t\t\t\t: \"http://schemas.xmlsoap.org/soap/envelope/\",\r\n\tNS_ENCODING\t\t\t\t\t: \"http://schemas.xmlsoap.org/soap/encoding/\",\r\n\tNS_SCHEMA\t\t\t\t\t: \"http://www.w3.org/2001/XMLSchema\",\r\n\tNS_SCHEMA_INSTANCE\t\t\t: \"http://www.w3.org/1999/XMLSchema-instance\",\r\n\tNS_DOMPARSEERROR\t\t\t: \"http://www.mozilla.org/newlayout/xml/parsererror.xml\",\r\n\tNS_NS\t\t\t\t\t\t: \"http://www.w3.org/2000/xmlns/\",\r\n\tNS_PERSISTANCE\t\t\t\t: \"http://www.composite.net/ns/localstore/persistance\",\r\n\tNS_FUNCTION\t\t\t\t\t: \"http://www.composite.net/ns/function/1.0\",\r\n\t\r\n\t/*\r\n\t * Estimates the size of a scrollbar on various systems, platforms and settings.\r\n\t * The estimate is considered correct within a factor of plus/minus 19 pixels.\r\n\t */\r\n\tSCROLLBAR_DIMENSION_HARDCODED_VALUE : 19\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_Constants}\r\n */\r\nvar Constants = new _Constants ();\r\n\r\n/*\r\n * Cleaning up the global scope.\r\n */\r\ntemppath = null;\r\ntemproot = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/ContextContainer.js",
    "content": "﻿\nContextContainer.getContextContainer = function (binding) {\n\n\tvar result = null;\n\tif (binding.getContextContainer) {\n\t\tresult = binding.getContextContainer();\n\t}\n\tif (result == null) {\n\t\tresult = ContextContainer.getAncestorContextContainer(binding);\n\t}\n\treturn result;\n}\n\nContextContainer.getAncestorContextContainer = function(binding) {\n\n\tvar ancestoContextContainerBinding = BindingFinder.getAncestorBindingByInterface(binding, IContextContainerBinding, true);\n\tif (ancestoContextContainerBinding != null) {\n\t\tvar contextContainer = ancestoContextContainerBinding.getContextContainer();\n\t\tif (contextContainer == null) {\n\t\t\treturn ContextContainer.getAncestorContextContainer(ancestoContextContainerBinding);\n\t\t} else {\n\t\t\treturn contextContainer;\n\t\t}\n\t}\n\treturn null;\n}\n\nContextContainer.resolve = function (url, contextContainer) {\n\n\tif (typeof url != \"string\")\n\t\treturn url;\n\tif (contextContainer == undefined)\n\t\treturn url;\n\tvar re = /\\{context\\:([^\\}]+)\\}/gm;\n\tvar matches = url.match(re);\n\tnew List(matches).each(function(match) {\n\t\tvar result = /\\{context\\:([^\\}]+)\\}/gm.exec(match);;\n\t\tvar property = result[1];\n\t\turl = url.replace(match, contextContainer.getProperty(property));\n\t});\n\treturn url;\n}\n\n\nContextContainer.CONTAINER_CLASSES = \"containerClasses\";\n\n/**\n * @class\n * @param {object} data\n */\nfunction ContextContainer () {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger ( \"ContextContainer\" );\n\n\t/**\n\t * @type {object}\n\t * @private\n\t */\n\tthis._data = {};\n\n}\n\n/**\n * Identifies ContextContainer.\n */\nContextContainer.prototype.toString = function () {\n\n\treturn \"[ContextContainer]\";\n}\n\n\n/**\n * @returns {void}\n */\nContextContainer.prototype.setProperty = function (name, value) {\n\n\tthis._data[name] = value;\n}\n\n\n/**\n * @returns {object}\n */\nContextContainer.prototype.getProperty = function (name) {\n\n\treturn this._data[name];\n}\n\n/**\n * @returns {object}\n */\nContextContainer.prototype.getData = function () {\n\n\treturn this._data;\n}\n\n/**\n * @return {string}\n */\nContextContainer.prototype.getContainerClasses = function () {\n\n\treturn this._data[ContextContainer.CONTAINER_CLASSES];\n}\n\n/**\n * @return {List<string>}\n */\nContextContainer.prototype.getContainerClassesList = function () {\n\n\tvar containerClasses = this._data[ContextContainer.CONTAINER_CLASSES];\n\tif (!containerClasses)\n\t\treturn new List();\n\treturn new List(containerClasses.split(\",\").map(function(str) { return str.trim()}));\n}\n\nContextContainer.prototype.getContainerClassesList = function () {\n\n\tvar containerClasses = this._data[ContextContainer.CONTAINER_CLASSES];\n\tif (!containerClasses)\n\t\treturn new List();\n\treturn new List(containerClasses.split(\",\").map(function (str) { return str.trim() }));\n}\n\nContextContainer.prototype.setContainerClasses = function (containerClasses) {\n\n\tthis.setProperty(ContextContainer.CONTAINER_CLASSES, containerClasses);\n\treturn this;\n}\n\nContextContainer.prototype.clone = function() {\n\tvar result = new ContextContainer();\n\tvar contextContainer = this;\n\tfor (var prop in contextContainer) {\n\t\tif (contextContainer.hasOwnProperty(prop)) {\n\t\t\tresult[prop] = ViewDefinition.cloneProperty(contextContainer[prop]);\n\t\t}\n\t}\n\treturn result;\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Cookies.js",
    "content": "/**\r\n * @class\r\n * TODO: Dont use cookies! Define a functional Persistance instead.\r\n */\r\nfunction _Cookies () {}\r\n\r\n_Cookies.prototype = {\r\n\t\r\n\t/**\r\n\t * Create new cookie.\r\n\t * @param {string} name\r\n\t * @param {string} value\r\n\t * @param {string} days\r\n\t */\r\n\tcreateCookie : function ( name, value, days ) {\r\n\t\r\n\t\tvar expires = \"\";\r\n\t\tif ( days ) {\r\n\t\t\tvar date = new Date ();\r\n\t\t\tdate.setTime ( date.getTime () + ( days * 24 * 60 * 60 * 1000 ));\r\n\t\t\texpires = \"; expires=\" + date.toGMTString ();\r\n\t\t}\r\n\t\tdocument.cookie = name + \"=\" + escape ( value ) + expires + \"; path=/\";\r\n\t\treturn this.readCookie ( name );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Read existing cookie.\r\n\t * @param {string} name\r\n\t * @return {string}\r\n\t */\r\n\treadCookie : function ( name ) {\r\n\t\r\n\t\tvar result = null;\r\n\t\tvar nameEQ = name + \"=\";\r\n\t\tvar ca = document.cookie.split ( \";\" );\r\n\t\tfor( var i=0; i < ca.length; i++ ) {\r\n\t\t\tvar c = ca [i];\r\n\t\t\twhile ( c.charAt ( 0 )== \" \" ) c = c.substring ( 1, c.length );\r\n\t\t\tif ( c.indexOf ( nameEQ ) == 0 ) {\r\n\t\t\t\tresult = unescape ( c.substring ( nameEQ.length, c.length ));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * No more cookie.\r\n\t * @param {string} name\r\n\t */\r\n\teraseCookie : function ( name ) {\r\n\t\r\n\t\tthis.createCookie ( name, \"\", -1 );\r\n\t}\r\n}\r\nvar Cookies = new _Cookies();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Dialog.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction _Dialog () {\r\n}\r\n\r\n_Dialog.prototype = {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"Dialog\" ),\r\n\r\n\t/*\r\n\t * Standard dialogs are loaded from here.\r\n\t */\r\n\t_URL_STANDARDDIALOG : \"${root}/content/dialogs/standard/standard.aspx\",\r\n\r\n\t/*\r\n\t * Two basic types of dialogs.\r\n\t */\r\n\tMODAL : \"modal\",\r\n\tNON_MODAL : \"nonmodal\",\r\n\r\n\t/*\r\n\t * Some URL constants for common dialogs.\r\n\t */\r\n\tURL_TREESELECTOR: \"${root}/content/dialogs/treeselector/treeselector.aspx\",\r\n\tURL_TREESEARCH \t\t\t: \"${root}/content/dialogs/treesearch/treeSearchForm.aspx\",\r\n\tURL_IMAGESELECTOR: \"${root}/content/dialogs/treeselector/treeselector.aspx\",\r\n\tURL_TREEACTIONSELECTOR: \"${root}/content/dialogs/treeselector/treeselector.aspx\",\r\n\tURL_SERVICEFAULT \t\t: \"${root}/content/dialogs/webservices/error.aspx\",\r\n\r\n\t/*\r\n\t * Some predefined button configurations\r\n\t */\r\n\tBUTTONS_YES_NO_CANCEL \t: [ \"yes:default\", \"no\", \"cancel\" ],\r\n\tBUTTONS_ACCEPT_CANCEL \t: [ \"accept:default\", \"cancel\" ],\r\n\tBUTTONS_ACCEPT \t\t\t: [ \"accept:default\" ],\r\n\r\n\t/*\r\n\t * Some predefined button response values\r\n\t */\r\n\tRESPONSE_YES \t\t: \"yes\",\r\n\tRESPONSE_NO \t\t: \"no\",\r\n\tRESPONSE_ACCEPT \t: \"accept\",\r\n\tRESPONSE_CANCEL \t: \"cancel\",\r\n\tRESPONSE_DEFAULT\t: \"default\",\r\n\r\n\t/*\r\n\t * Some predefined standard dialog types\r\n\t */\r\n\t_TYPE_WARNING \t: \"warning\",\r\n\t_TYPE_MESSAGE\t: \"message\",\r\n\t_TYPE_ERROR \t: \"error\",\r\n\t_TYPE_QUESTION \t: \"question\",\r\n\r\n\t/*\r\n\t * Hm. If these are defined by code, maybe the\r\n\t * dialog vignette should be expelled from CSS?\r\n\t */\r\n\t_dialogImages : {\r\n\r\n\t\t\"warning\" \t: \"${icon:warning}\",\r\n\t\t\"message\" \t: \"${icon:message}\",\r\n\t\t\"error\" \t: \"${icon:error}\",\r\n\t\t\"question\" \t: \"${icon:question}\"\r\n\t},\r\n\r\n\t/**\r\n\t* Build dialog button.\r\n\t* @param {entry} entry\r\n\t* @return {DialogButton}\r\n\t*/\r\n\tdialogButton: function (entry) {\r\n\t\tif (this._dialogButtons == undefined) {\r\n\t\t\tthis._dialogButtons = {\r\n\r\n\t\t\t\t\"yes\": new DialogButton({ label: StringBundle.getString(\"ui\", \"Website.Dialogs.LabelYes\"), response: this.RESPONSE_YES }),\r\n\t\t\t\t\"no\": new DialogButton({ label: StringBundle.getString(\"ui\", \"Website.Dialogs.LabelNo\"), response: this.RESPONSE_NO }),\r\n\t\t\t\t\"accept\": new DialogButton({ label: StringBundle.getString(\"ui\", \"Website.Dialogs.LabelAccept\"), response: this.RESPONSE_ACCEPT }),\r\n\t\t\t\t\"cancel\": new DialogButton({ label: StringBundle.getString(\"ui\", \"Website.Dialogs.LabelCancel\"), response: this.RESPONSE_CANCEL })\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn Dialog._dialogButtons[entry];\r\n\t},\r\n\r\n\t/**\r\n\t * Invoke dialog by URL.\r\n\t * @param {string} url\r\n\t * @param {IDialogResponseHandler} handler\r\n\t * @param {object} argument\r\n\t * @return {DialogViewDefinition}\r\n\t */\r\n\tinvoke : function  ( url, handler, argument ) {\r\n\r\n\t\tthis._logger.error ( \"Not implemented\" );\r\n\t},\r\n\r\n\t/**\r\n\t * Invoke modal dialog by URL.\r\n\t * @param {string} url\r\n\t * @param {IDialogResponseHandler} handler\r\n\t * @param {object} argument\r\n\t * @param {Binding?} contextSource\r\n\t * @return {DialogViewDefinition}\r\n\t */\r\n\tinvokeModal: function (url, handler, argument, contextSource) {\r\n\r\n\t\tvar definition = new DialogViewDefinition ({\r\n\t\t\thandle \t\t: KeyMaster.getUniqueKey (),\r\n\t\t\tposition\t: Dialog.MODAL,\r\n\t\t\turl \t\t: url,\r\n\t\t\thandler\t\t: handler,\r\n\t\t\targument\t: argument\r\n\t\t});\r\n\r\n\t\tStageBinding.presentViewDefinition(definition, contextSource);\r\n\t\treturn definition;\r\n\t},\r\n\r\n\t/**\r\n\t * Invoke dialog by definition.\r\n\t * @param {DialogViewDefinition} definition\r\n\t * @param {Binding?} contextSource\r\n\t * @return {DialogViewDefinition}\r\n\t */\r\n\tinvokeDefinition: function (definition, contextSource) {\r\n\r\n\t\tif ( definition instanceof DialogViewDefinition ) {\r\n\t\t\tStageBinding.presentViewDefinition(definition, contextSource);\r\n\t\t}\r\n\t\treturn definition;\r\n\t},\r\n\r\n\t/**\r\n\t * Invoke question dialog.\r\n\t * @param {string} title\r\n\t * @param {string} text\r\n\t * @param {array<DialogButton>} buttons\r\n\t * @param {IDialogResponseHandler} handler\r\n\t */\r\n\tquestion : function ( title, text, buttons, handler ) {\r\n\r\n\t\tif ( !buttons ) {\r\n\t\t\tbuttons = this.BUTTONS_ACCEPT_CANCEL;\r\n\t\t}\r\n\t\tthis._standardDialog ( this._TYPE_QUESTION, title, text, buttons, handler );\r\n\t},\r\n\r\n\t/**\r\n\t * Invoke message dialog.\r\n\t * @param {string} title\r\n\t * @param {string} text\r\n\t * @param {array<DialogButton>} buttons\r\n\t * @param {IDialogResponseHandler} handler\r\n\t */\r\n\tmessage : function ( title, text, buttons, handler ) {\r\n\r\n\t\tif ( !buttons ) {\r\n\t\t\tbuttons = this.BUTTONS_ACCEPT;\r\n\t\t}\r\n\t\tthis._standardDialog ( this._TYPE_MESSAGE, title, text, buttons, handler );\r\n\t},\r\n\r\n\t/**\r\n\t * Invoke error dialog.\r\n\t * @param {string} title\r\n\t * @param {string} text\r\n\t * @param {array<DialogButton>} buttons Defaults to Accept button.\r\n\t * @param {IDialogResponseHandler} handler\r\n\t */\r\n\terror : function ( title, text, buttons, handler ) {\r\n\r\n\t\tif ( !buttons ) {\r\n\t\t\tbuttons = this.BUTTONS_ACCEPT;\r\n\t\t}\r\n\t\tthis._standardDialog ( this._TYPE_ERROR, title, text, buttons, handler );\r\n\t},\r\n\r\n\t/**\r\n\t * Invoke warning dialog.\r\n\t * @param {string} title\r\n\t * @param {string} text\r\n\t * @param {array<DialogButton>} buttons\r\n\t * @param {IDialogResponseHandler} handler\r\n\t */\r\n\twarning :  function ( title, text, buttons, handler ) {\r\n\r\n\t\tif ( !buttons ) {\r\n\t\t\tbuttons = this.BUTTONS_ACCEPT;\r\n\t\t}\r\n\t\tthis._standardDialog ( this._TYPE_WARNING, title, text, buttons, handler );\r\n\t},\r\n\r\n\t/**\r\n\t * TODO: example on how to invoke with custom buttons.\r\n\t * @param {string} type\r\n\t * @param {string} title\r\n\t * @param {string} text\r\n\t * @param {array<DialogButton>} buttons\r\n\t * @param {IDialogResponseHandler} handler\r\n\t * @ignore\r\n\t */\r\n\t_standardDialog : function ( type, title, text, buttons, handler ) {\r\n\r\n\t\tvar buttonList = null;\r\n\r\n\t\tif ( !buttons ) {\r\n\t\t\tbuttonList = new List (\r\n\t\t\t\tDialog.BUTTONS_ACCEPT\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tbuttonList = new List ();\r\n\t\t\tnew List ( buttons ).each (\r\n\t\t\t\tfunction ( entry ) {\r\n\t\t\t\t\tvar config = null;\r\n\t\t\t\t\tswitch ( typeof entry ) {\r\n\t\t\t\t\t\tcase \"object\" :\r\n\t\t\t\t\t\t\tconfig = entry;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"string\" :\r\n\t\t\t\t\t\t\tvar isDefault = false;\r\n\t\t\t\t\t\t\tif ( entry.indexOf ( \":\" ) >-1 ) {\r\n\t\t\t\t\t\t\t\tentry = entry.split ( \":\" )[ 0 ];\r\n\t\t\t\t\t\t\t\tisDefault = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tconfig = Dialog.dialogButton(entry);\r\n\t\t\t\t\t\t\tif ( isDefault ) {\r\n\t\t\t\t\t\t\t\tconfig.isDefault = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbuttonList.add ( config );\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tvar argument = {\r\n\t\t\ttitle\t: title,\r\n\t\t\ttext\t: text,\r\n\t\t\ttype\t: type,\r\n\t\t\timage\t: this._dialogImages [ type ],\r\n\t\t\tbuttons : buttonList\r\n\t\t}\r\n\r\n\t\tvar definition = new DialogViewDefinition ({\r\n\t\t\thandle \t\t: \"standarddialog:\" + type,\r\n\t\t\tposition\t: Dialog.MODAL,\r\n\t\t\turl \t\t: this._URL_STANDARDDIALOG,\r\n\t\t\thandler\t\t: handler,\r\n\t\t\targument\t: argument\r\n\t\t})\r\n\r\n\t\tStageBinding.presentViewDefinition ( definition );\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar Dialog = new _Dialog ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/DialogButton.js",
    "content": "/** \r\n * Actually just a simple configuration which can be \r\n * used to construct a real {@link ClickButtonBinding}.\r\n * @param {object} obj Optional constructor object\r\n */\r\nfunction DialogButton ( obj ) {\r\n\r\n\t/**\r\n     * The button label.\r\n\t * @type {string}\r\n\t */\r\n\tthis.label = null;\r\n\t\r\n\t/**\r\n     * The button image.\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = null;\r\n\t\r\n\t/**\r\n\t * The button response. This can be anything object; although usually a string.\r\n\t * @type {object}\r\n\t */\r\n\tthis.response = null;\r\n\t\r\n\t/**\r\n\t * Always focusable!\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\t\r\n\t/**\r\n\t * Is default button?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDefault = false;\r\n\t\r\n\t/**\r\n\t * Is focused?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\r\n\t/*\r\n\t * Initialize values from constructor\r\n\t */\r\n\tif ( obj ) {\r\n\t\tfor ( var prop in obj ) {\r\n\t\t\tif ( typeof this [ prop ] != \"undefined\" ) {\r\n\t\t\t\tthis [ prop ] = obj [ prop ];\r\n\t\t\t} \r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Download.js",
    "content": "/**\r\n * @class\r\n * Download stuff.\r\n */\r\nfunction _Download () {}\r\n\r\n/**\r\n * Init download. The server must be rigged up to display a download dialog.\r\n * @param {string} url\r\n */\r\n_Download.prototype.init = function ( url ) {\r\n\t\r\n\tvar win = top.app.bindingMap.downloadwindow;\r\n\twin.setURL ( url );\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar Download = new _Download ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/EventBroadcaster.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction _EventBroadcaster () {}\r\n\r\n_EventBroadcaster.prototype = {\r\n\r\n\t/**\r\n\t * @type {HashMap<string><array<IBroadcastListener>>}\r\n\t */\r\n\t_broadcasts : {},\r\n\t\r\n\t/**\r\n\t * Add subscription.\r\n\t * @param {string} message The subscription message.\r\n\t * @param {object} subscriber The subscribing object. \r\n\t * Should implement method <code>handleBroadcast</code>.\r\n\t */\r\n\tsubscribe : function ( message, subscriber ) {\r\n\t\r\n\t\tif ( message != null ) {\r\n\t\t\tif ( !Interfaces.isImplemented ( IBroadcastListener, subscriber, true )) {\r\n\t\t\t\tthrow ( \"IBroadcastListener not implemented: \" + message );\r\n\t\t\t} else if ( !this._broadcasts [ message ]) {\r\n\t\t\t\tthis._broadcasts [ message ] = [ subscriber ];\r\n\t\t\t} else {\r\n\t\t\t\tthis._broadcasts [ message ].push ( subscriber );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\tthrow \"Undefined broadcast: \" + subscriber;\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Remove subscription.\r\n\t * @param {string} message\r\n\t * @param {object} unsubscriber\r\n\t */\r\n\tunsubscribe : function ( message, unsubscriber ) {\r\n\t\r\n\t\tif ( message != null ) {\r\n\t\t\tif ( Interfaces.isImplemented ( IBroadcastListener, unsubscriber )) {\r\n\t\t\t\tvar i = 0, subscriber, subscribers = this._broadcasts [ message ];\r\n\t\t\t\tif ( subscribers ) {\r\n\t\t\t\t\twhile ( i < subscribers.length ) {\r\n\t\t\t\t\t\tsubscriber = subscribers [ i ];\r\n\t\t\t\t\t\tif ( subscriber == unsubscriber ) {\r\n\t\t\t\t\t\t\tsubscribers.splice ( i, 1 );\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ti++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthrow \"Undefined broadcast\" + unsubscriber;\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Message has subscribers?\r\n\t * @param {string} message\r\n\t * @return {boolean}\r\n\t */\r\n\thasSubscribers : function ( message ) {\r\n\t\t\r\n\t\tvar subscribers = this._broadcasts [ message ];\r\n\t\treturn subscribers != null && subscribers.length > 0; \r\n\t},\r\n\t\r\n\t/**\r\n\t * Broadcast message to subscribers. \r\n\t * @param {string} message\r\n\t * @param @optional {object} Passed as argument to subscribers\r\n\t */\r\n\tbroadcast : function ( message, optional ) {\r\n\t\t\r\n\t\tif ( message != null ) {\r\n\t\t\tvar i = 0, subscribers = this._broadcasts [ message ];\r\n\t\t\tvar list = [];\r\n\t\t\tif ( subscribers != null ) {\r\n\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * This will store possible failed subscribers.\r\n\t\t\t\t */\r\n\t\t\t\tvar exceptions = new List();\r\n\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * First collect in a temp list. This will \r\n\t\t\t\t * prevent sudden unsubscribers from modifying \r\n\t\t\t\t * the length of the list while we iterate.\r\n\t\t\t\t */\r\n\t\t\t\twhile ( i < subscribers.length ) {\r\n\t\t\t\t\tlist.push ( subscribers [ i++ ]);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\ti = 0;\r\n\t\t\t\twhile ( i < list.length ) {\r\n\t\t\t\t\tvar subscriber = list [ i ];\r\n                    if ( Application.isDeveloperMode ) {\r\n                        subscriber.handleBroadcast(message, optional); \r\n                    } else {\r\n\t\t\t\t\t    try {\r\n\t\t\t\t\t\t    subscriber.handleBroadcast ( message, optional );\r\n\t\t\t\t\t    }\r\n\t\t\t\t\t    catch ( exception ) {\r\n\t\t\t\t\t\t    exceptions.add ( subscriber );\r\n\t\t\t\t\t\t    var cry = \"Exception in \" + new String ( subscriber ) + \r\n\t\t\t\t\t\t\t    \" on broadcast '\" + message + \"':\" +  \r\n\t\t\t\t\t\t\t    new String ( exception );\r\n\t\t\t\t\t\t    SystemLogger.getLogger ( \"EventBroadcaster\" ).error ( cry );\r\n\t\t\t\t\t\t    SystemDebug.stack ( arguments );\r\n\t\t\t\t\t    }\r\n                    }\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t\tif ( exceptions.hasEntries ()) { // brutally exclude subscribers that raised exceptions\r\n\t\t\t\t\texceptions.each ( function ( subscriber ) {\r\n\t\t\t\t\t \tEventBroadcaster.unsubscribe ( message, subscriber );\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\tthrow \"Undefined broadcast\";\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*\r\n * The instance that does it.\r\n */\r\nvar EventBroadcaster = new _EventBroadcaster ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/ImageProvider.js",
    "content": "/**\r\n * @class\r\n * Image provider.\r\n */\r\nfunction _ImageProvider () {}\r\n\r\n_ImageProvider.prototype = {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"ImageProvider\" ),\r\n\r\n\t/**\r\n\t * Default icon provider.\r\n\t */\r\n\tUI : \"Composite.Icons\",\r\n\t\r\n\t/**\r\n\t * @param {object} object\r\n\t */\r\n\tgetImageURL: function (object, size) {\r\n\t\tif (typeof object === \"string\") {\r\n\t\t\treturn object;\r\n\t\t} else if (object.ResourceName) {\r\n\t\t\treturn object.ResourceName;\r\n\t\t} else {\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar ImageProvider = new _ImageProvider ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Installation.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction _Installation () {\r\n\t\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.APPLICATION_KICKSTART, this ); \r\n}\r\n\r\n_Installation.prototype = {\r\n\r\n\t/** Application Name like \"C1 CMS\"\r\n\t* @type {string}\r\n\t*/\r\n\tapplicationName: null,\r\n\r\n    /**\r\n    * Robot readable build version \"1.2.3505.18361\".\r\n    * @type {string}\r\n    */\r\n    versionString: null,\r\n\r\n    /**\r\n    * Human readable product version \"C1 CMS 1.2 SP2\".\r\n    * @type {string}\r\n    */\r\n    versionPrettyString: null,\r\n\r\n    /**\r\n    * @type {string}\r\n    */\r\n    installationID: null,\r\n\r\n\r\n\t/**\r\n\t* @type {string}\r\n\t*/\r\n    passwordExpirationTimeInDays: null,\r\n\r\n    /**\r\n    * Constructor action: Get installation info.\r\n    * @return {_Installation}\r\n    */\r\n    handleBroadcast: function (broadcast) {\r\n\r\n        switch (broadcast) {\r\n            case BroadcastMessages.APPLICATION_KICKSTART:\r\n                var list = new List(InstallationService.GetInstallationInfo(true));\r\n                list.each(function (entry) {\r\n                \tswitch (entry.Key) {\r\n                \t\tcase \"ApplicationName\":\r\n                \t\t\tthis.applicationName = entry.Value;\r\n                \t\t\tbreak;\r\n                        case \"ProductVersion\":\r\n                            this.versionString = entry.Value;\r\n                            break;\r\n                        case \"ProductTitle\":\r\n                            this.versionPrettyString = entry.Value;\r\n                            break;\r\n                        case \"InstallationId\":\r\n                            this.installationID = entry.Value;\r\n                            break;\r\n                    \tcase \"PasswordExpirationTimeInDays\":\r\n                    \t\tthis.passwordExpirationTimeInDays = entry.Value;\r\n                    \t\tbreak;\r\n                    }\r\n                }, this);\r\n                break;\r\n        }\r\n    }\r\n};\r\n\r\n/*\r\n * Here we go.\r\n */\r\nvar Installation = new _Installation ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Interfaces.js",
    "content": "/**\r\n * @class\r\n * Primitively checks an object instance for an interface implementation. \r\n * TODO: build up some sort of status repport for debugging.\r\n */\r\nfunction _Interfaces () {\r\n\t\r\n\t/**\r\n\t * This logger could probably report a detailed result.\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tvar logger = SystemLogger.getLogger ( \"Interfaces\" );\r\n\t\r\n\t/**\r\n\t * Is interface implemented by instance object?\r\n\t * @param {object} interfais (not using reserved keyword here)\r\n\t * @param {object} instance\r\n\t * @param {object} isLogging\r\n\t * @return {boolean}\r\n\t */\r\n\tthis.isImplemented = function ( interfais, instance, isLogging ) {\r\n\t\t\r\n\t\tvar isImplemented = true;\r\n\t\tfor ( var property in interfais ) {\r\n\t\t\tif ( typeof instance [ property ] == Types.UNDEFINED ) {\r\n\t\t\t\tisImplemented = false;\r\n\t\t\t} else if ( typeof interfais [ property ] != typeof instance [ property ]) {\r\n\t\t\t\tisImplemented = false;\r\n\t\t\t}\r\n\t\t\tif ( !isImplemented ) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( !isImplemented ) {\r\n\t\t\tif ( isLogging ) {\r\n\t\t\t\tlogger.fine ( instance + \" invalid. Interface check abandoned at: \" + property );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn isImplemented;\r\n\t}\r\n}\r\n\r\nvar Interfaces = new _Interfaces;"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/KeyMaster.js",
    "content": "/**\r\n * Building unique keys.\r\n */\r\nfunction _KeyMaster () {}\r\n\r\n_KeyMaster.prototype = {\r\n\t\r\n\t_uniqueKeys : {},\r\n\t\t\r\n\t/**\r\n\t * Build a unique key string for whoever may be interrested.\r\n\t * @return {string}\r\n\t */\r\n\tgetUniqueKey : function () {\r\n\t\tvar key = new String ( \"key\" + Math.random ().toString ().split ( \".\" )[ 1 ]);\r\n\t\tif ( this._uniqueKeys [ key ] != null ) {\r\n\t\t\treturn this.getUniqueKey ();\r\n\t\t}\r\n\t\tthis._uniqueKeys [ key ] = true;\r\n\t\treturn key;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Is string generated by KeyMaster?\r\n\t * @param {string} key\r\n\t * @return {boolean}\r\n\t */\r\n\thasKey : function ( key ) {\r\n\t\t\r\n\t\tvar result = false;\r\n\t\tif ( this._uniqueKeys [ key ]) {\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar KeyMaster = new _KeyMaster ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Keyboard.js",
    "content": "/**\r\n * @class\r\n * Broadcasting keys globally. This class is closely connected to the \r\n * KeyGroupBinding going on in the root application file \"top.aspx\".\n */\r\nfunction _Keyboard () {}\r\n\r\n_Keyboard.prototype = {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"Keyboard\" ),\r\n\t\r\n\t/** \r\n\t * @type {boolean}\r\n\t */\r\n\tisShiftPressed : false,\r\n\t\r\n\t/** \r\n\t * @type {boolean}\r\n\t */\r\n\tisControlPressed : false,\r\n\t\r\n\t/**\r\n\t * Enter key pressed.\r\n\t */\r\n\tkeyEnter : function () {\r\n\t\t\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_ENTER );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Escape key pressed.\r\n\t */\r\n\tkeyEscape : function () {\r\n\t\t\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_ESCAPE );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Space key pressed.\r\n\t */\r\n\tkeySpace : function () {\r\n\t\t\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_SPACE );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Shift key pressed. Another broadcast is \r\n\t * transmitted when the shift key is released.\r\n\t * @see {Keyboard#keyUp} \n\t */\r\n\tkeyShift : function () {\r\n\t\t\r\n\t\tthis.isShiftPressed = true;\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_SHIFT_DOWN );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Control key pressed. Another broadcast is \r\n\t * transmitted when the control key is released.\r\n\t * @see {Keyboard#keyUp}\r\n\t */\r\n\tkeyControl : function () {\r\n\t\t\r\n\t\tthis.isControlPressed = true;\t\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_CONTROL_DOWN );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Arrow key pressed.\r\n\t */\r\n\tkeyArrow : function ( key ) {\r\n\t\t\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_ARROW, key );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Arrow key pressed.\r\n\t */\r\n\tkeyAlt : function () {\r\n\t\t\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_ALT );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Tab key pressed.\r\n\t */\r\n\tkeyTab : function () {\r\n\t\t\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_TAB );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Special broadcast whenever the shift or control key is released. \r\n\t * This method is invoked by the local {@link DocumentManager}.\r\n\t * @param {KeyEvent} e\r\n\t */\r\n\tkeyUp : function ( e ) {\r\n\t\t\r\n\t\tif ( this.isShiftPressed && e.keyCode == window.KeyEventCodes.VK_SHIFT ) {\r\n\t\t\tthis.isShiftPressed = false;\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_SHIFT_UP );\r\n\t\t} else if ( this.isControlPressed && e.keyCode == window.KeyEventCodes.VK_CONTROL ) {\r\n\t\t\tthis.isControlPressed = false;\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_CONTROL_UP );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar Keyboard = new _Keyboard ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/KickStart.js",
    "content": "/**\r\n * Kickstarting the entire shebang.\r\n */\r\nvar KickStart = new function () {\r\n\r\n\tvar isLocalStoreReady = false;\r\n\tvar isQualified = Client.qualifies();\r\n\r\n\tvar DEFAULT_USERNAME = \"admin\";\r\n\tvar DEFAULT_PASSWORD = \"123456\";\r\n\r\n\r\n\tif (!isQualified) {\r\n\t\tdocument.location = \"unsupported.aspx\";\r\n\t\treturn;\r\n\t}\r\n\r\n\t/*\r\n\t\t* Fire on load!\r\n\t\t*/\r\n\tthis.fireOnLoad = function () {\r\n\r\n\t\t// iPad IOS7 hack\r\n\t\tif (Client.isPad && Client.isOS7 && window.innerHeight != document.documentElement.clientHeight) {\r\n\t\t\tdocument.documentElement.style.height = window.innerHeight + \"px\";\r\n\t\t}\r\n\r\n\t\tApplication.lock(this);\r\n\t\tfileEventBroadcasterSubscriptions(true);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.APPLICATION_SHUTDOWN, this);\r\n\r\n\t\tSetupService = WebServiceProxy.createProxy(Constants.URL_WSDL_SETUPSERVICE);\r\n\t\tReadyService = WebServiceProxy.createProxy(Constants.URL_WSDL_READYSERVICE);\r\n\t\tLoginService = WebServiceProxy.createProxy(Constants.URL_WSDL_LOGINSERVICE);\r\n\t\tInstallationService = WebServiceProxy.createProxy(Constants.URL_WSDL_INSTALLSERVICE);\r\n\t\tStringService = WebServiceProxy.createProxy(Constants.URL_WSDL_STRINGSERVICE);\r\n\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.APPLICATION_KICKSTART);\r\n\r\n\t\tsetTimeout(function () {\r\n\t\t\tPersistance.initialize(); // NOTE: We are not using this stuff!\r\n\t\t}, 0);\r\n\t};\r\n\t/*\r\n\t * Indicate user just logged to console\r\n\t */\r\n\tthis.justLogged = false;\r\n\r\n\t/**\r\n\t * @implements {IBroadcastListener}\r\n\t * @param {string} broadcast\r\n\t */\r\n\tthis.handleBroadcast = function (broadcast) {\r\n\r\n\t\tswitch (broadcast) {\r\n\r\n\t\t\tcase BroadcastMessages.PERSISTANCE_INITIALIZED:\r\n\t\t\t\tkickStart(broadcast);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase BroadcastMessages.APPLICATION_STARTUP:\r\n\t\t\t\t// doStartUp (); hmmmm....\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase BroadcastMessages.KEY_ENTER:\r\n\t\t\t\tif (bindingMap.decks != null) {\r\n\t\t\t\t\tvar selecteddeck = bindingMap.decks.getSelectedDeckBinding();\r\n\t\t\t\t\tif (selecteddeck != null) {\r\n\t\t\t\t\t\tswitch (selecteddeck.getID()) {\r\n\t\t\t\t\t\t\tcase \"logindeck\":\r\n\t\t\t\t\t\t\t\tthis.login();\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase \"changepassworddeck\":\r\n\t\t\t\t\t\t\t\tthis.changePassword();\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase BroadcastMessages.APPLICATION_LOGIN:\r\n\t\t\t\tvar appwindow = window.bindingMap.appwindow;\r\n\t\t\t\t//Workarrond for iPad - \"div layout creashed on some reflex\"\r\n\t\t\t\tif (Client.isPad) {\r\n\t\t\t\t\tappwindow.bindingElement.style.borderLeft = \"1px solid #333\";\r\n\t\t\t\t}\r\n\t\t\t\tappwindow.setURL(\"app.aspx\");\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase BroadcastMessages.APPLICATION_OPERATIONAL:\r\n\t\t\t\tshowWorkbench();\r\n\r\n\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\tStageBinding.bindingInstance.handleHash(window);\r\n\t\t\t\t}, 0);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase BroadcastMessages.APPLICATION_SHUTDOWN:\r\n\t\t\t\tif (bindingMap.decks != null) {\r\n\t\t\t\t\tbindingMap.decks.select(\"shutdowndeck\");\r\n\t\t\t\t}\r\n\t\t\t\tbindingMap.cover.show();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * File and unfile EventBroadcaster subscriptions.\r\n\t * @param {boolean} isSubscribe\r\n\t */\r\n\tfunction fileEventBroadcasterSubscriptions(isSubscribe) {\r\n\r\n\t\tnew List([\r\n\r\n\t\t\tBroadcastMessages.PERSISTANCE_INITIALIZED,\r\n\t\t\tBroadcastMessages.APPLICATION_STARTUP,\r\n\t\t\tBroadcastMessages.APPLICATION_LOGIN,\r\n\t\t\tBroadcastMessages.APPLICATION_OPERATIONAL\r\n\r\n\t\t]).each(\r\n\t\t\tfunction (broadcast) {\r\n\t\t\t\tif (isSubscribe) {\r\n\t\t\t\t\tEventBroadcaster.subscribe(broadcast, KickStart);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tEventBroadcaster.unsubscribe(broadcast, KickStart);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Freeze storyboard until Localstore initialize.\r\n\t * If not registered, show registration. Otherwise show login.\r\n\t * @param {string} broadcast\r\n\t */\r\n\tfunction kickStart(broadcast) {\r\n\r\n\t\tswitch (broadcast) {\r\n\t\t\tcase BroadcastMessages.PERSISTANCE_INITIALIZED:\r\n\t\t\t\tisLocalStoreReady = true;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tif (isLocalStoreReady) {\r\n\t\t\tif (bindingMap.decks != null && LoginService.IsLoggedIn(true)) {\r\n\t\t\t\taccessGranted();\r\n\t\t\t} else {\r\n\t\t\t\tif (bindingMap.decks != null) {\r\n\t\t\t\t\tshowLogin();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshowWelcome();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsplashScreenData();\r\n\t}\r\n\r\n\t/**\r\n\t * Splash screen data.\r\n\t */\r\n\tfunction splashScreenData() {\r\n\t\tvar elems = document.getElementsByClassName(\"js-applicationname\");\r\n\t\tfor (var index = 0; index < elems.length; ++index) {\r\n\t\t\telems[index].innerHTML = Installation.applicationName;\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Show welcome screens on first time startup.\r\n\t */\r\n\tfunction showWelcome() {\r\n\r\n\t\tApplication.unlock(KickStart);\r\n\t\tif (window.Welcome != null) {\r\n\t\t\tWelcome.test();\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Show login screen.\r\n\t */\r\n\tfunction showLogin() {\r\n\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.KEY_ENTER, KickStart);\r\n\t\tApplication.unlock(KickStart);\r\n\t\tbindingMap.decks.select(\"logindeck\");\r\n\r\n\t\tsetTimeout(function () {\r\n\t\t\tif (Application.isLocalHost) {\r\n\t\t\t\tif (Application.isDeveloperMode || Client.isPerformanceTest) {\r\n\t\t\t\t\tDataManager.getDataBinding(\"username\").setValue(DEFAULT_USERNAME);\r\n\t\t\t\t\tDataManager.getDataBinding(\"password\").setValue(DEFAULT_PASSWORD);\r\n\t\t\t\t}\r\n\t\t\t\t// Auto login for the performance test\r\n\t\t\t\tif (Client.isPerformanceTest) {\r\n\t\t\t\t\tKickStart.login();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tDataManager.getDataBinding(\"username\").focus();\r\n\t\t\t}, 250);\r\n\t\t}, 0);\r\n\t}\r\n\r\n\t/**\r\n\t * When registered, monitor the servers readystate and continue to login screen when done.\r\n\t */\r\n\tfunction watchProgress() {\r\n\r\n\t\twindow.progressOnRegistrationInterval = window.setInterval(function () {\r\n\t\t\tif (ReadyService.IsServerReady(true)) {\r\n\t\t\t\twindow.clearInterval(window.progressOnRegistrationInterval);\r\n\t\t\t\twindow.progressOnRegistrationInterval = null;\r\n\t\t\t\tsplashScreenData();\r\n\t\t\t\tshowLogin();\r\n\t\t\t}\r\n\t\t}, 2000);\r\n\t}\r\n\r\n\t/**\r\n\t * Show it.\r\n\t */\r\n\tfunction showWorkbench() {\r\n\r\n\t\tsetTimeout(function () {\r\n\t\t\tbindingMap.cover.hide();\r\n\t\t\tfileEventBroadcasterSubscriptions(false);\r\n\t\t\tApplication.unlock(KickStart);\r\n\t\t}, PageBinding.TIMEOUT);\r\n\t}\r\n\r\n\r\n\tthis.changePassword = function () {\r\n\r\n\t\tif (bindingMap.toppage.validateAllDataBindings()) {\r\n\r\n\t\t\tvar username = DataManager.getDataBinding(\"username\").getResult();\r\n\t\t\tvar oldpassword = DataManager.getDataBinding(\"passwordold\").getResult();\r\n\t\t\tvar newpassword = DataManager.getDataBinding(\"passwordnew\").getResult();\r\n\t\t\tvar newpassword2 = DataManager.getDataBinding(\"passwordnew2\").getResult();\r\n\r\n\r\n\t\t\tif (newpassword == newpassword2) {\r\n\t\t\t\tvar wasEnabled = WebServiceProxy.isLoggingEnabled;\r\n\t\t\t\tWebServiceProxy.isLoggingEnabled = false;\r\n\t\t\t\tWebServiceProxy.isFaultHandler = false;\r\n\r\n\t\t\t\tvar result = LoginService.ChangePassword(username, oldpassword, newpassword);\r\n\r\n\t\t\t\tif (result instanceof SOAPFault) {\r\n\t\t\t\t\talert(result.getFaultString());\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (result.length == 0) {\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\ttop.window.location.reload(true);\r\n\t\t\t\t\t\t}, 0);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.showPasswordErrors(result);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tWebServiceProxy.isFaultHandler = true;\r\n\t\t\t\tif (wasEnabled) {\r\n\t\t\t\t\tWebServiceProxy.isLoggingEnabled = true;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\r\n\r\n\t\t\t\tthis.showPasswordErrors([Resolver.resolve(\"${string:Composite.C1Console.Users:ChangePasswordForm.ConfirmationPasswordMimatch}\")]);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tthis.showPasswordErrors = function (errors) {\r\n\t\terrors = new List(errors);\r\n\t\tvar errorsElement = document.getElementById(\"passworderror\");\r\n\t\terrorsElement.innerHTML = \"\";\r\n\r\n\t\terrors.each(function (error) {\r\n\t\t\tvar errorElement = document.createElement(\"div\");\r\n\t\t\terrorElement.textContent = error;\r\n\t\t\terrorElement.className = \"text-error text-sm\";\r\n\t\t\terrorsElement.appendChild(errorElement);\r\n\r\n\t\t});\r\n\r\n\r\n\r\n\t\terrorsElement.style.display = \"block\";\r\n\r\n\r\n\t\tvar handler = {\r\n\t\t\thandleAction: function (action) {\r\n\t\t\t\tdocument.getElementById(\"passworderror\").style.display = \"none\";\r\n\t\t\t\taction.target.removeActionListener(\r\n\t\t\t\t\tBinding.ACTION_DIRTY, handler\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbindingMap.passwordfields.addActionListener(\r\n\t\t\tBinding.ACTION_DIRTY, handler\r\n\t\t);\r\n\r\n\t\tDataManager.getDataBinding(\"passwordold\").clean();\r\n\t\tDataManager.getDataBinding(\"passwordnew\").clean();\r\n\t\tDataManager.getDataBinding(\"passwordnew2\").clean();\r\n\t}\r\n\r\n\r\n\r\n\t/** \r\n\t * Note that we disable SOAP debugging during login. \r\n\t * Note that we may be able to do something intelligent with the SOAP response.\r\n\t * Note that we didn't manage to come up with intelligent handling of the SOAP response.\r\n\t */\r\n\tthis.login = function () {\r\n\r\n\t\tApplication.lock(KickStart); // unlocked by showWorkbench or if fields don't validate\r\n\r\n\t\t/*\r\n\t\t * The timeout is here to block GUI with wait cursor.\r\n\t\t */\r\n\t\tsetTimeout(function () {\r\n\r\n\t\t\tif (bindingMap.toppage.validateAllDataBindings()) {\r\n\t\t\t\tKickStart.doLogin(\r\n\t\t\t\t\tDataManager.getDataBinding(\"username\").getResult(),\r\n\t\t\t\t\tDataManager.getDataBinding(\"password\").getResult()\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tApplication.unlock(KickStart);\r\n\t\t\t}\r\n\r\n\t\t}, 25);\r\n\t}\r\n\r\n\t/**\r\n\t * Isolated in order to be invoked by {@link Welcome}\r\n\t * @param {String} username\r\n\t * @param {String} password\r\n\t */\r\n\tthis.doLogin = function (username, password) {\r\n\r\n\t\tvar wasEnabled = WebServiceProxy.isLoggingEnabled;\r\n\t\tWebServiceProxy.isLoggingEnabled = false;\r\n\t\tWebServiceProxy.isFaultHandler = false;\r\n\r\n\t\tvar isAllowed = false;\r\n\t\tvar isChangePasswordRequired = false;\r\n\t\tvar result = LoginService.ValidateAndLogin(username, password);\r\n\t\tif (result instanceof SOAPFault) {\r\n\t\t\talert(result.getFaultString());\r\n\t\t} else {\r\n\t\t\tif (result == \"lockedAfterMaxAttempts\") {\r\n\t\t\t\t// TODO: unhardcode\r\n\t\t\t\talert(\"The account was locked after maximum login attempts. Please contact administrator.\");\r\n\t\t\t}\r\n\r\n\t\t\tif (result == \"lockedByAnAdministrator\") {\r\n\t\t\t\t// TODO: unhardcode\r\n\t\t\t\talert(\"The account was locked by an administrator.\");\r\n\t\t\t}\r\n\r\n\t\t\tif (result == \"passwordUpdateRequired\") {\r\n\t\t\t\tisChangePasswordRequired = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif (result == \"success\") {\r\n\t\t\t\tisAllowed = true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (isChangePasswordRequired) {\r\n\t\t\tchangePasswordRequired();\r\n\t\t} else if (isAllowed) {\r\n\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.KEY_ENTER, KickStart);\r\n\t\t\tthis.justLogged = true;\r\n\t\t\taccessGranted();\r\n\t\t} else {\r\n\t\t\tApplication.unlock(KickStart);\r\n\t\t\tif (bindingMap.decks != null) { // on Welcome we may get trapped here!\r\n\t\t\t\taccesssDenied();\r\n\t\t\t}\r\n\t\t}\r\n\t\tWebServiceProxy.isFaultHandler = true;\r\n\t\tif (wasEnabled) {\r\n\t\t\tWebServiceProxy.isLoggingEnabled = true;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Access granted.\r\n\t */\r\n\tfunction accessGranted() {\r\n\t\tsetTimeout(function () {\r\n\t\t\tif (bindingMap.decks != null) {\r\n\t\t\t\tbindingMap.decks.select(\"loadingdeck\");\r\n\t\t\t}\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tApplication.login();\r\n\t\t\t}, 0);\r\n\t\t}, 0);\r\n\t}\r\n\r\n\t/**\r\n\t * Change Password Required.\r\n\t */\r\n\tfunction changePasswordRequired() {\r\n\r\n\t\tsetTimeout(function () {\r\n\t\t\tApplication.unlock(KickStart);\r\n\t\t\tif (bindingMap.decks != null) {\r\n\t\t\t\tbindingMap.decks.select(\"changepassworddeck\");\r\n\t\t\t\tbindingMap.cover.attachClassName(\"widesplash\");\r\n\r\n\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\tvar passwordexpired = document.getElementById(\"passwordexpired\");\r\n\t\t\t\t\tpasswordexpired.textContent = passwordexpired.textContent.replace(\"{0}\", Installation.passwordExpirationTimeInDays);\r\n\r\n\t\t\t\t\tDataManager.getDataBinding(\"usernameold\").setValue(DataManager.getDataBinding(\"username\").getResult());\r\n\t\t\t\t\tDataManager.getDataBinding(\"passwordold\").focus();\r\n\t\t\t\t}, 0);\r\n\r\n\t\t\t}\r\n\t\t}, 25);\r\n\t}\r\n\r\n\t/**\r\n\t * Access denied.\r\n\t */\r\n\tfunction accesssDenied() {\r\n\r\n\t\tvar username = DataManager.getDataBinding(\"username\");\r\n\t\tvar password = DataManager.getDataBinding(\"password\");\r\n\r\n\t\tusername.blur();\r\n\t\tpassword.blur();\r\n\t\tusername.setValue(\"\");\r\n\t\tpassword.setValue(\"\");\r\n\t\tusername.clean();\r\n\t\tpassword.clean();\r\n\t\tusername.focus();\r\n\r\n\t\tdocument.getElementById(\"loginerror\").style.display = \"block\";\r\n\r\n\t\tvar handler = {\r\n\t\t\thandleAction: function (action) {\r\n\t\t\t\tdocument.getElementById(\"loginerror\").style.display = \"none\";\r\n\t\t\t\taction.target.removeActionListener(\r\n\t\t\t\t\tBinding.ACTION_DIRTY, handler\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\tbindingMap.loginfields.addActionListener(\r\n\t\t\tBinding.ACTION_DIRTY, handler\r\n\t\t);\r\n\t}\r\n\r\n\t/*\r\n\t * Fire on load!\r\n\t */\r\n\tWindowManager.fireOnLoad(this);\r\n\r\n\t/*\r\n\t * Non-qualified browsers would run into a javascript  \r\n\t * error in the UpdateManager when switching to the \r\n\t * not supported page. Let's disable the UpdateManager.\r\n\t */\r\n\tif (!isQualified) {\r\n\t\tUpdateManager.isEnabled = false;\r\n\t}\r\n}\r\n\r\n/*\r\n* Fix chrome interval focus on a username and a password for the saved password, issue #504\r\n*/\r\nif (typeof KickStart !== 'undefined' && typeof EventBroadcaster !== 'undefined' && EventBroadcaster.subscribe && /Chrome/.test(navigator.userAgent)) {\r\n\tKickStart.subscribeToRemoveObsoleteDecks = function () {\r\n\t\tif (!this.isSubscribedToRemoveObsoleteDecks) {\r\n\t\t\tthis.isSubscribedToRemoveObsoleteDecks = true;\r\n\t\t\tEventBroadcaster.subscribe(BroadcastMessages.APPLICATION_LOGIN, {\r\n\t\t\t\thandleBroadcast: function () {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tif (typeof top !== 'undefined' && top.bindingMap && typeof DocumentManager !== 'undefined' && DocumentManager.detachBindings) {\r\n\t\t\t\t\t\t\tvar obsoletedDecks = [\"logindeck\", \"changepassworddeck\"];\r\n\t\t\t\t\t\t\tfor (var i = 0; i < obsoletedDecks.length; i++) {\r\n\t\t\t\t\t\t\t\tobsoletedDeckName = obsoletedDecks[i];\r\n\t\t\t\t\t\t\t\tif (top.bindingMap[obsoletedDeckName]) {\r\n\t\t\t\t\t\t\t\t\tobsoletedDeck = top.bindingMap[obsoletedDeckName];\r\n\t\t\t\t\t\t\t\t\tif (obsoletedDeck && obsoletedDeck.bindingElement) {\r\n\t\t\t\t\t\t\t\t\t\tDocumentManager.detachBindings(obsoletedDeck.bindingElement, true);\r\n\t\t\t\t\t\t\t\t\t\tobsoletedDeck.bindingElement.innerHTML = \"\";\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} catch (e) { };\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t};\r\n\tKickStart.subscribeToRemoveObsoleteDecks();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/License.DEPRECATED.js",
    "content": "/**\r\n * @class\r\n */\r\nwindow.License = new function () {\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRegistered = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isExpired = false;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.registrationName = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.registrationURL = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.statusURL = null;\r\n\t\r\n\t/**\r\n\t * Robot readable build version \"1.2.3505.18361\".\r\n\t * @type {string}\r\n\t */\r\n\tthis.versionString = null;\r\n\t\r\n\t/**\r\n\t * Human readable product version \"C1 1.2 SP2\".\r\n\t * @type {string}\r\n\t */\r\n\tthis.versionPrettyString = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.installationID = null;\r\n\t\r\n\t/**\r\n\t * Refresh license. This is done at least once, on Application startup.\r\n\t * @param {boolean} isHardUpdate This will trigger the server to discover any new lisense.\r\n\t */\r\n\tthis.refresh = function ( isHardUpdate ) {\r\n\t\t\r\n\t\t/*\r\n\t\tif ( isHardUpdate ) {\r\n\t\t\tLicensingService.InvokeLicenseFetch ( true );\r\n\t\t}\r\n\t\t*/\r\n\t\t\r\n\t\tthis.isRegistered = true; // HARDCODED FOR NOW. WAS: LicensingService.Registered ( true );\r\n\t\t\r\n\t\tvar self = this;\r\n\t\tnew List ( InstallationService.GetLicenseInfo ( true )).each ( function ( entry ) {\r\n\t\t\tswitch ( entry.Key ) {\r\n\t\t\t\tcase \"RegistrationURL\" :\r\n\t\t\t\t\tself.registrationURL = entry.Value;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"StatusURL\" :\r\n\t\t\t\t\tself.statusURL = entry.Value;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"ProductVersion\" :\r\n\t\t\t\t\tself.versionString = entry.Value;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"ProductTitle\" :\r\n\t\t\t\t\tself.versionPrettyString = entry.Value;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"RegisteredTo\" :\r\n\t\t\t\t\tself.registrationName = entry.Value;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"Expired\" :\r\n\t\t\t\t\tself.isExpired = entry.Value == \"True\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"InstallationId\" :\r\n\t\t\t\t\tself.installationID = entry.Value;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/LocalStore.js",
    "content": "/*\r\n * TEMP!\r\n */\r\nvar LocalStore = new function () {\r\n\t\r\n\t\r\n\tthis.isInitialized = true;\t\r\n\tthis.isEnabled = false;\r\n\t\r\n\t/*\r\n\t *Save last opened nodes.\r\n\t */\r\n\tthis.openedNodes = new SystemNodeList();\r\n\r\n\t/*\r\n\t * Save last focused nodes.\r\n\t */\r\n\tthis.focuseNodes = new SystemNodeList();\r\n\t\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Localization.js",
    "content": "/**\r\n * @class\r\n * This fellow handles localisation of the public\r\n * website (and not the admininstration module).\r\n */\r\nfunction _Localization () {\r\n\t\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.APPLICATION_LOGIN, this );\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.LANGUAGES_UPDATED, this );\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.FROMLANGUAGE_UPDATED, this );\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.TOLANGUAGE_UPDATED, this );\r\n}\r\n\r\n_Localization.prototype = {\r\n\t\r\n\t/**\r\n\t * Available languages. Each entry in the list has the following properties: \r\n\t * Name\r\n     * IsoName\r\n     * UrlMappingName\r\n     * IsCurrent\r\n     * SerializedActionToken         \r\n\t * @type {List<object>}\r\n\t */\r\n\tlanguages : null,\r\n\t\t\r\n\t/**\r\n\t * The source language.\r\n\t * @type {string}\r\n\t */\r\n\tsource : null,\r\n\t\r\n\t/**\r\n\t * The target language.\r\n\t * @type {string}\r\n\t */\r\n\ttarget : null,\r\n\r\n\t/**\r\n\t * Is RTL UI Direction.\r\n\t * @type {Boolean}\r\n\t */\r\n\tisUIRtl: false,\r\n\r\n\t/**\r\n\t * Is RTL tDirection.\r\n\t * @type {Boolean}\r\n\t */\r\n\tisRtl: false,\r\n\t\r\n\t/**\r\n\t * @implements {IBroadcastListener}\r\n\t * @param {string} broadcast\r\n\t * @param {object} arg\r\n\t */\r\n\thandleBroadcast : function ( broadcast, arg ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Get list of languages.\r\n\t\t */\r\n\t\tswitch ( broadcast ) {\r\n\t\t\tcase BroadcastMessages.APPLICATION_LOGIN :\r\n\t\t\tcase BroadcastMessages.LANGUAGES_UPDATED:\r\n\t\t\tcase BroadcastMessages.TOLANGUAGE_UPDATED:\r\n\t\t\t\tthis.isUIRtl = LocalizationService.GetUITextDirection(true) == \"rtl\";\r\n\t\t\t\tthis.isRtl = LocalizationService.GetTextDirection(true) == \"rtl\";\r\n\t\t\t\tvar languages = LocalizationService.GetActiveLocales ( true );\r\n\t\t\t\tif ( languages.length >= 1 ) {\r\n\t\t\t\t\tthis.languages = new List ( languages );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.languages = null;\r\n\t\t\t\t}\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.UPDATE_LANGUAGES, this.languages );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * Get current languages.\r\n\t\t */\r\n\t\tswitch ( broadcast ) {\r\n\t\t\tcase BroadcastMessages.APPLICATION_LOGIN :\r\n\t\t\tcase BroadcastMessages.FROMLANGUAGE_UPDATED :\r\n\t\t\t\tvar locales = LocalizationService.GetLocales ( true );\r\n\t\t\t\tthis.source = locales.ForeignLocaleName;\r\n\t\t\t\tthis.target = locales.ActiveLocaleName;\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Who needs this? Delete?\r\n\t\t\t\t */\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.LOCALIZATION_CHANGED, {\r\n\t\t\t\t\tsource : locales.ForeignLocaleName,\r\n\t\t\t\t\ttarget : locales.ActiveLocaleName\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Return current lang in short format\r\n\t */\r\n\tcurrentLang : function()\r\n\t{\r\n\t\tif (this.languages != null) {\r\n\t\t\tvar languages = this.languages.copy();\r\n\t\t\twhile (languages.hasNext()) {\r\n\t\t\t\tvar lang = languages.getNext();\r\n\t\t\t\tif (lang.IsCurrent) {\r\n\t\t\t\t\treturn lang.IsoName;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it!\r\n * @type {_Localization}\r\n */\r\nvar Localization = new _Localization ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/MessageQueue.js",
    "content": "/**\r\n* MessageQueue!\r\n*/\r\nwindow.MessageQueue = new function () {\r\n\r\n\t/**\r\n\t* Update interval in milliseconds when server is online.\r\n\t* @type {int}\r\n\t*/\r\n\tthis.INTERVAL_ONLINE = 5 * 1000;\r\n\r\n\t/**\r\n\t* Update interval in milliseconds when server is offline.\r\n\t* @type {int}\r\n\t*/\r\n\tthis.INTERVAL_OFFLINE = 1 * 1000;\r\n\r\n\t/**\r\n\t* List of actions waiting to be executed.\r\n\t* @type {List<object>}\r\n\t*/\r\n\tthis._actions = new List();\r\n\r\n\t/**\r\n\t* Indexing action ID's to make sure we don't execute the same action twice.\r\n\t* This would happen on server restart, where server resets the sequencenumber.\r\n\t* @type {HashMap<String><boolean>}\r\n\t*/\r\n\tthis._index = {};\r\n\r\n\t/**\r\n\t* Holds the hightest action sequencenumber sent from the server.\r\n\t* @type {int}\r\n\t*/\r\n\tthis.index = 0; // NOT equal to private variable \"sequencenumber\"\r\n\r\n\t/*\r\n\t* Privates\r\n\t*/\r\n\tvar logger = SystemLogger.getLogger(\"MessageQueue\");\r\n\tvar service = null;\r\n\tvar sequenceNumber = 0;\r\n\tvar triggerhandle = null;\r\n\tvar refreshingtrees = new Map();\r\n\tvar openingtreenodes = new Map();\r\n\tvar isOffline = false;\r\n\tvar isAutoUpdate = false;\r\n\tvar isReceivingMessages = false;\r\n\tvar orderMessages = false;\r\n\r\n\t/*\r\n\t* Mapping dock locations. Hashmap keys correspond\r\n\t* to values of the servers \"ViewType\" property.\r\n\t*/\r\n\tvar docklocation = {\r\n\r\n\t\t\"Main\": DockBinding.MAIN,\r\n\t\t\"External\": DockBinding.EXTERNAL,\r\n\t\t\"BottomLeft\": DockBinding.BOTTOMLEFT,\r\n\t\t\"BottomRight\": DockBinding.BOTTOMRIGHT,\r\n\t\t\"RightTop\": DockBinding.RIGHTTOP,\r\n\t\t\"RightBottom\": DockBinding.RIGHTBOTTOM,\r\n\t\t\"AbsBottomLeft\": DockBinding.ABSBOTTOMLEFT,\r\n\t\t\"AbsBottomRight\": DockBinding.ABSBOTTOMRIGHT,\r\n\t\t\"Slide\": DockBinding.SLIDE,\r\n\t}\r\n\r\n\t/**\r\n\t* Initialize.\r\n\t*/\r\n\tthis.initialize = function () {\r\n\r\n\t\tservice = ConsoleMessageQueueService;\r\n\t\tsequenceNumber = service.GetCurrentSequenceNumber(\"dummyparam!\");\r\n\r\n\t\tthis.index = sequenceNumber;\r\n\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.VIEW_COMPLETED, this);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.VIEW_CLOSED, this);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.SERVER_OFFLINE, this);\r\n\t\tEventBroadcaster.subscribe(BroadcastMessages.SERVER_ONLINE, this);\r\n\r\n\t\twindow.messageQueueInterval = window.setInterval(\r\n\t\t\tMessageQueue._autoupdate,\r\n\t\t\tMessageQueue.INTERVAL_ONLINE\r\n\t\t);\r\n\t};\r\n\r\n\t/**\r\n\t* Fetching actions from server. Note that\r\n\t* we don't request new actions while we are\r\n\t* already executing a list of actions.\r\n\t*/\r\n\tthis._autoupdate = function () {\r\n\r\n\t\t/*\r\n\t\t* Note that you should not use the \"this\" keyword\r\n\t\t* around here since we are executed on a setInterval.\r\n\t\t*/\r\n\t\tif (!isOffline) {\r\n\r\n\t\t\t/*\r\n\t\t\t* While an action sequence is being evaluated,\r\n\t\t\t* to further actions are retrieved from server.\r\n\t\t\t*/\r\n\t\t\tif (!MessageQueue._actions.hasEntries()) {\r\n\t\t\t\tvar isEnabled = WebServiceProxy.isLoggingEnabled;\r\n\t\t\t\tif (Application.isLoggedIn) {\r\n\t\t\t\t\tisAutoUpdate = true;\r\n\t\t\t\t\tWebServiceProxy.isLoggingEnabled = false; // not logging the SOAP request\r\n\t\t\t\t\tMessageQueue.update();\r\n\t\t\t\t\tWebServiceProxy.isLoggingEnabled = isEnabled;\r\n\t\t\t\t\tisAutoUpdate = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t* When server is offline, this will be executed\r\n\t* on an interval to unlock GUI when ready.\r\n\t* @see {MessageQueue#_lockSystem}\r\n\t*/\r\n\tthis._pokeserver = function () {\r\n\r\n\t\tif (isOffline == true) {\r\n\t\t\tif (ReadyService.IsServerReady(true)) {\r\n\t\t\t\tMessageQueue._lockSystem(false);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Fetch list of actions from server.\r\n\t* @param {bool} syncRequest\r\n\t*/\r\n\tthis.update = function (syncRequest) {\r\n\r\n\t\tif (Application.isLoggedIn) { // otherwise no service...\r\n\r\n\t\t\t/*\r\n\t\t\t* Note that we broadcast the boolean argument: isAutoUpdate\r\n\t\t\t*/\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.MESSAGEQUEUE_REQUESTED, isAutoUpdate);\r\n\r\n\t\t\tthis._updateMessages(syncRequest);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* @param {bool} syncRequest\r\n\t*/\r\n\tthis._updateMessages = function(syncRequest) {\r\n\r\n\t\tif (isReceivingMessages) {\r\n\t\t\torderMessages = true;\r\n\t\t} else {\r\n\t\t\tisReceivingMessages = true;\r\n\t\t\tvar self = this;\r\n\t\t\t/*\r\n\t\t\t* Fetch new actions; append them to current actions in execution chain.\r\n\t\t\t* Response has two properties: The servers highest known action number\r\n\t\t\t* and a list of actions. The first property is needed because the server\r\n\t\t\t* will RESET the actionindex on restart.\r\n\t\t\t*/\r\n\t\t\tvar handleResponce = function(response) {\r\n\t\t\t\tif (response != null) {\r\n\t\t\t\t\tif (Types.isDefined(response.CurrentSequenceNumber)) {\r\n\t\t\t\t\t\tvar newindex = response.CurrentSequenceNumber;\r\n\t\t\t\t\t\tif (newindex < self.index) {\r\n\t\t\t\t\t\t\tlogger.debug(\"SERVER WAS RESTARTED! old messagequeue index: \" + self.index + \", new messagequeue index: \" + newindex);\r\n\t\t\t\t\t\t\t// the server was restarted!\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tself.index = newindex;\r\n\r\n\t\t\t\t\t\tvar actions = new List(response.ConsoleActions);\r\n\t\t\t\t\t\tif (actions.hasEntries()) {\r\n\t\t\t\t\t\t\tself.evaluate(actions);\r\n\t\t\t\t\t\t} else if (!self._actions.hasEntries()) {\r\n\t\t\t\t\t\t\tbroadcastUpdateEvaluated();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tlogger.error(\"No sequencenumber in MessageQueue response!\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tisReceivingMessages = false;\r\n\t\t\t\tif (orderMessages) {\r\n\t\t\t\t\torderMessages = false;\r\n\t\t\t\t\tself._updateMessages();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tif (syncRequest) {\r\n\t\t\t\thandleResponce(service.GetMessages(Application.CONSOLE_ID, this.index));\r\n\t\t\t} else {\r\n\t\t\t\tservice.GetMessages(Application.CONSOLE_ID, this.index, handleResponce);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Evaluate a list of actions. These will be appended\r\n\t* to any actions currently scheduled for execution.\r\n\t* @param {List} actions\r\n\t*/\r\n\tthis.evaluate = function (actions) {\r\n\r\n\t\tvar newactions = new List();\r\n\r\n\t\tif (actions.hasEntries()) {\r\n\r\n\t\t\t/*\r\n\t\t\t* Filter out actions that were already queued\r\n\t\t\t* up for evaluation (server restart scenario).\r\n\t\t\t*/\r\n\t\t\tactions.each(function (action) {\r\n\t\t\t\tif (this._index[action.Id] != true) {\r\n\t\t\t\t\tnewactions.add(action);\r\n\t\t\t\t}\r\n\t\t\t\tthis._index[action.Id] = true;\r\n\t\t\t}, this);\r\n\r\n\t\t\tif (newactions.hasEntries()) {\r\n\r\n\t\t\t\t// merge into existing actionlist?\r\n\t\t\t\tif (this._actions.hasEntries()) {\r\n\t\t\t\t\tthis._actions.merge(newactions);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._actions = newactions;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// execute first action!\r\n\t\t\t\tthis._nextAction();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t* Close all views - with a flowHandle (important)!\r\n\t* @param {object} params\r\n\t*/\r\n\tthis._closeAllViews = function (params) {\r\n\r\n\t\tvar reason = \"(No reason)\";\r\n\t\tif (params != null) {\r\n\t\t\treason = params.Reason;\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* TODO: externalize strings!\r\n\t\t*/\r\n\t\tvar title = \"Warning\";\r\n\t\tvar text = \"The server has requested a close of all active editors for the following reason: \\\"${reason}\\\". It is recommended that you accept this request by clicking OK.\";\r\n\t\ttext = text.replace(\"${reason}\", reason);\r\n\r\n\t\tvar self = this;\r\n\t\tDialog.warning(title, text, Dialog.BUTTONS_ACCEPT_CANCEL, {\r\n\t\t\thandleDialogResponse: function (response) {\r\n\t\t\t\tif (response == Dialog.RESPONSE_ACCEPT) {\r\n\t\t\t\t\tEventBroadcaster.broadcast(BroadcastMessages.CLOSE_VIEWS);\r\n\t\t\t\t}\r\n\t\t\t\tself._nextAction();\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\t/**\r\n\t* Evaluate next action. This will update the sequencenumber.\r\n\t*/\r\n\tthis._nextAction = function () {\r\n\r\n\t\tvar params = null;\r\n\r\n\t\tif (this._actions.hasEntries()) {\r\n\r\n\t\t\tvar action = this._actions.extractFirst();\r\n\t\t\tsequenceNumber = action.SequenceNumber;\r\n\t\t\tlogger.debug(\"MessageQueue action: \" + action.ActionType + \" > QUEUE-MAX-SEQNUM: \" + this.index + \" > CURRENT SEQNUM: \" + sequenceNumber + \" > ACTIONS-LEFT: \" + this._actions.getLength());\r\n\r\n\t\t\t/*\r\n\t\t\t* Parse action.\r\n\t\t\t*/\r\n\t\t\tswitch (action.ActionType) {\r\n\r\n\t\t\t\tcase \"OpenView\":\r\n\t\t\t\t\tparams = action.OpenViewParams;\r\n\t\t\t\t\tif (params.ViewType == \"ModalDialog\") {\r\n\t\t\t\t\t\topenDialogView(params);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ttriggerhandle = params.ViewId;\r\n\t\t\t\t\t\topenView(params);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"CloseView\":\r\n\t\t\t\t\tparams = action.CloseViewParams;\r\n\t\t\t\t\ttriggerhandle = params.ViewId;\r\n\t\t\t\t\tcloseView(params);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"RefreshTree\":\r\n\t\t\t\t\tEventBroadcaster.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this);\r\n\t\t\t\t\tEventBroadcaster.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED, this);\r\n\t\t\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\t\t\tBroadcastMessages.SYSTEMTREEBINDING_REFRESH,\r\n\t\t\t\t\t\taction.RefreshTreeParams.EntityToken\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tvar debug = \"REFRESHING TREES: \" + refreshingtrees.countEntries() + \"\\n\";\r\n\t\t\t\t\trefreshingtrees.each(function (token) {\r\n\t\t\t\t\t\tdebug += \"\\n\\tTOKEN: \" + token;\r\n\t\t\t\t\t})\r\n\t\t\t\t\tlogger.debug(debug);\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* The trees perform a timeout before refreshing\r\n\t\t\t\t\t* so that this code gets evaluted straight away\r\n\t\t\t\t\t* and not when the trees are done refreshing.\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tif (!refreshingtrees.hasEntries()) {\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this);\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED, this);\r\n\t\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"SelectElement\":\r\n\r\n\t\t\t\t\tvar perspectiveElementKey = action.SelectElementParams.PerspectiveElementKey;\r\n\t\t\t\t\tvar entityToken = action.SelectElementParams.EntityToken;\r\n\r\n\t\t\t\t\tStageBinding.select(perspectiveElementKey)\r\n\t\t\t\t\t\t.then(\r\n\t\t\t\t\t\tfunction () {\r\n\t\t\t\t\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\t\t\t\t\tBroadcastMessages.SYSTEMTREEBINDING_FOCUS,\r\n\t\t\t\t\t\t\t\tentityToken\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"MessageBox\":\r\n\t\t\t\t\topenMessageBox(action.MessageBoxParams);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"OpenViewDefinition\":\r\n\t\t\t\t\tparams = action.OpenViewDefinitionParams;\r\n\t\t\t\t\ttriggerhandle = params.Handle;\r\n\t\t\t\t\topenViewDefinition(params);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"LogEntry\":\r\n\t\t\t\t\tlogEntry(action.LogEntryParams);\r\n\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"Reboot\":\r\n\t\t\t\t\tApplication.reload(true);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"LockSystem\":\r\n\t\t\t\t\tMessageQueue._lockSystem(true);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"BroadcastMessage\":\r\n\t\t\t\t\tparams = action.BroadcastMessageParams;\r\n\t\t\t\t\tlogger.debug(\"Server says: EventBroadcaster.broadcast ( \\\"\" + params.Name + \"\\\", \" + params.Value + \" )\");\r\n\t\t\t\t\tEventBroadcaster.broadcast(params.Name, params.Value);\r\n\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"CollapseAndRefresh\":\r\n\t\t\t\t\tEventBroadcaster.broadcast(BroadcastMessages.SYSTEMTREEBINDING_COLLAPSEALL);\r\n\t\t\t\t\tEventBroadcaster.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this);\r\n\t\t\t\t\tEventBroadcaster.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED, this);\r\n\t\t\t\t\tEventBroadcaster.broadcast(BroadcastMessages.SYSTEMTREEBINDING_REFRESHALL);\r\n\t\t\t\t\tif (!refreshingtrees.hasEntries()) {\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this);\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED, this);\r\n\t\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"CloseAllViews\":\r\n\t\t\t\t\tthis._closeAllViews(action.CloseAllViewsParams);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"SaveStatus\":\r\n\t\t\t\t\tsaveStatus(action.SaveStatusParams);\r\n\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"DownloadFile\":\r\n\t\t\t\t\tDownload.init(action.DownloadFileParams.Url);\r\n\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"ExpandTreeNode\": // TODO: CLEAR THIS!\r\n\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\t/*\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMTREENODEBINDING_FORCING_OPEN, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMTREENODEBINDING_FORCED_OPEN, this );\r\n\t\t\t\t\tEventBroadcaster.broadcast (\r\n\t\t\t\t\tBroadcastMessages.SYSTEMTREENODEBINDING_FORCE_OPEN,\r\n\t\t\t\t\taction.ExpandTreeNodeParams.EntityToken\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif ( !openingtreenodes.hasEntries ()) {\r\n\t\t\t\t\tEventBroadcaster.unsubscribe ( BroadcastMessages.SYSTEMTREENODEBINDING_FORCING_OPEN, this );\r\n\t\t\t\t\tEventBroadcaster.unsubscribe ( BroadcastMessages.SYSTEMTREENODEBINDING_FORCED_OPEN, this );\r\n\t\t\t\t\tthis._nextAction ();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"BindEntityTokenToView\":\r\n\t\t\t\t\tparams = action.BindEntityTokenToViewParams;\r\n\t\t\t\t\tEventBroadcaster.broadcast(BroadcastMessages.BIND_TOKEN_TO_VIEW, {\r\n\t\t\t\t\t\thandle: params.ViewId,\r\n\t\t\t\t\t\tentityToken: params.EntityToken\r\n\t\t\t\t\t});\r\n\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"OpenGenericView\":\r\n\t\t\t\t\tparams = action.OpenGenericViewParams;\r\n\t\t\t\t\topenGenericView(params);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"OpenExternalView\":\r\n\t\t\t\t\tparams = action.OpenExternalViewParams;\r\n\t\t\t\t\topenExternalView(params);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"OpenSlideView\":\r\n\t\t\t\t\tparams = action.OpenSlideViewParams;\r\n\t\t\t\t\topenSlideView(params);\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tDialog.error(\"Dysfunction\", \"Unhandled action: \" + action.ActionType);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} else {\r\n\r\n\t\t\tbroadcastUpdateEvaluated();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Note that we broadcast the boolean argument: isAutoUpdate\r\n\t*/\r\n\tfunction broadcastUpdateEvaluated() {\r\n\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.MESSAGEQUEUE_EVALUATED, isAutoUpdate);\r\n\t}\r\n\r\n\t/**\r\n\t* Parse log entry.\r\n\t* @param {object} params\r\n\t*/\r\n\tfunction logEntry(params) {\r\n\r\n\t\tvar method = params.Level.toLowerCase();\r\n\t\tSystemLogger.getLogger(params.SenderId)[method](params.Message);\r\n\t}\r\n\r\n\t/**\r\n\t* Parse view opening. Views targeted for editors dock\r\n\t* are presented with a \"Loading...\" label on startup,\r\n\t* this is handled by the DockTabBinding.\r\n\t* @param {object} params\r\n\t*/\r\n\tfunction openView(params) {\r\n\r\n\t\tvar list = paramsToList(params.Argument);\r\n\r\n\t\tif (list.hasEntries()) {\r\n\r\n\t\t\tvar def = ViewDefinition.clone(\"Composite.Management.PostBackView\", params.ViewId);\r\n\t\t\tdef.entityToken = params.EntityToken;\r\n\t\t\tdef.flowHandle = params.FlowHandle;\r\n\t\t\tdef.position = docklocation[params.ViewType],\r\n\t\t\tdef.label = params.Label;\r\n\t\t\tdef.image = params.Image;\r\n\t\t\tdef.toolTip = params.ToolTip;\r\n\t\t\tdef.argument = {\r\n\t\t\t\t\"url\": params.Url,\r\n\t\t\t\t\"list\": list\r\n\t\t\t};\r\n\t\t\tStageBinding.presentViewDefinition(def);\r\n\r\n\t\t} else {\r\n\r\n\t\t\tStageBinding.presentViewDefinition(\r\n\t\t\t\tnew HostedViewDefinition({\r\n\t\t\t\t\thandle: params.ViewId,\r\n\t\t\t\t\tentityToken: params.EntityToken,\r\n\t\t\t\t\tflowHandle: params.FlowHandle,\r\n\t\t\t\t\tposition: docklocation[params.ViewType],\r\n\t\t\t\t\turl: params.Url,\r\n\t\t\t\t\tlabel: params.Label,\r\n\t\t\t\t\timage: params.Image,\r\n\t\t\t\t\ttoolTip: params.ToolTip\r\n\t\t\t\t})\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t* Open modal dialog. This will delay next action until the dialog is closed!\r\n\t* @param {object} params/\r\n\t*/\r\n\tfunction openDialogView(params) {\r\n\r\n\t\tStageBinding.presentViewDefinition(\r\n\t\t\tnew DialogViewDefinition({\r\n\t\t\t\thandle: params.ViewId,\r\n\t\t\t\tflowHandle: params.FlowHandle,\r\n\t\t\t\tposition: Dialog.MODAL,\r\n\t\t\t\turl: params.Url,\r\n\t\t\t\thandler: {\r\n\t\t\t\t\thandleDialogResponse: function () {\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\tMessageQueue._nextAction();\r\n\t\t\t\t\t\t}, 250);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t* Open standard dialog of type error, info or warning.\r\n\t* Question type dialogs not supported here. This will\r\n\t* delay next action until the dialog is closed!\r\n\t* @param {object} params\r\n\t*/\r\n\tfunction openMessageBox(params) {\r\n\r\n\t\tvar method = params.DialogType.toLowerCase();\r\n\t\tif (method == \"question\") {\r\n\t\t\tthrow \"Not supported!\";\r\n\t\t} else {\r\n\t\t\tDialog[method](params.Title, params.Message, null, {\r\n\t\t\t\thandleDialogResponse: function () {\r\n\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\tMessageQueue._nextAction();\r\n\t\t\t\t\t}, 250);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Open ViewDefinition.\r\n\t* @param {object} params\r\n\t*/\r\n\tfunction openViewDefinition(params) {\r\n\r\n\t\t// var list = paramsToList ( params.Argument );\r\n\r\n\t\t/*\r\n\t\t* TODO: Note on how this stuff differs from the paramsToList stuff...\r\n\t\t*/\r\n\t\tvar map = {};\r\n\t\tvar hasMap = false;\r\n\t\tnew List(params.Argument).each(function (entry) {\r\n\t\t\tmap[entry.Key] = entry.Value;\r\n\t\t\thasMap = true;\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t* Determine whether or not to open a new view or to reuse any opened view.\r\n\t\t* The Page Browser is a view-reuse example - it opens new tabs INSIDE a\r\n\t\t* singluar open instance.\r\n\t\t*/\r\n\t\tvar proto = ViewDefinitions[params.Handle];\r\n\r\n\t\tif (proto != null) {\r\n\r\n\t\t\tvar def = null;\r\n\r\n\t\t\tif (proto.isMutable == false) { // reuse the same view\r\n\r\n\t\t\t\tdef = proto; // keeping original handle, ignoring server handle\r\n\r\n\t\t\t} else { // create new view by cloning the old\r\n\r\n\t\t\t\tdef = new HostedViewDefinition();\r\n\t\t\t\tfor (var prop in proto) {\r\n\t\t\t\t\tdef[prop] = proto[prop];\r\n\t\t\t\t}\r\n\t\t\t\tdef.handle = params.ViewId; // assigning new handle, unique from server\r\n\t\t\t}\r\n\r\n\t\t\t//def.argument = list.hasEntries () ? list : null;\r\n\t\t\tdef.argument = hasMap ? map : null;\r\n\t\t\tStageBinding.presentViewDefinition(def);\r\n\r\n\t\t} else {\r\n\t\t\tthrow \"Unknown ViewDefinition: \" + param.Handle;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Open generic view. That is, a PageBinding with a WindowBinding that will\r\n\t* 1) Open a given URL - or, if params are specified...\r\n\t* 2) Polulate a form with given params and post to a given URL\r\n\t*/\r\n\tfunction openGenericView(params) {\r\n\r\n\t\tvar def = ViewDefinition.clone(\"Composite.Management.GenericView\", params.ViewId);\r\n\t\tdef.label = params.Label;\r\n\t\tdef.toolTip = params.ToolTip;\r\n\t\tdef.image = params.Image;\r\n\t\tdef.argument = {\r\n\t\t\t\"url\": params.Url,\r\n\t\t\t\"list\": paramsToList(params.UrlPostArguments)\r\n\t\t};\r\n\t\tStageBinding.presentViewDefinition(def);\r\n\r\n\t}\r\n\r\n\t/**\r\n\t* Open external view. That is, a PageBinding with a WindowBinding that will\r\n\t* 1) Open a given URL ...\r\n\t*/\r\n\tfunction openExternalView(params) {\r\n\r\n\t\tvar def = ViewDefinition.clone(\"Composite.Management.ExternalView\", params.ViewId);\r\n\t\tdef.label = params.Label;\r\n\t\tdef.toolTip = params.ToolTip;\r\n\t\tdef.image = params.Image;\r\n\t\tdef.url = params.Url,\r\n\r\n\t\tStageBinding.presentViewDefinition(def);\r\n\t}\r\n\r\n\t/**\r\n\t* Open slide view.\r\n\t*/\r\n\tfunction openSlideView(params) {\r\n\t\ttry {\r\n\r\n\r\n\t\t\tvar def = ViewDefinition.clone(\"Composite.Management.SlideView\", params.ViewId);\r\n\t\t\tdef.label = params.Label;\r\n\t\t\tdef.toolTip = params.ToolTip;\r\n\t\t\tdef.image = params.Image;\r\n\t\t\tdef.url = params.Url,\r\n\t\t\t\tStageBinding.presentViewDefinition(def);\r\n\t\t} catch (e) {\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t* Close view.\r\n\t* @param {object} params\r\n\t*/\r\n\tfunction closeView(params) {\r\n\r\n\t\tif (StageBinding.isViewOpen(params.ViewId)) {\r\n\t\t\t// This broadcast will be intercepted by the ViewBinding.\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.CLOSE_VIEW, params.ViewId);\r\n\t\t} else {\r\n\t\t\t// If the view is a dialog, user may have cancelled it already.\r\n\t\t\t// In that case, we execute the next action straight away...\r\n\t\t\tMessageQueue._nextAction();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Handle save status.\r\n\t* @param {object} params\r\n\t*/\r\n\tfunction saveStatus(params) {\r\n\r\n\t\t/*\r\n\t\t* This broadcast will be intercepted by the DockTabBinding and\r\n\t\t* possibly the DockBinding.\r\n\t\t*/\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.CURRENT_SAVED, {\r\n\t\t\thandle: params.ViewId,\r\n\t\t\tisSuccess: params.Succeeded\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t* Lock and unlock the system when\r\n\t* server goes offline and online.\r\n\t* @param {boolean} isLock\r\n\t*/\r\n\tthis._lockSystem = function (isLock) {\r\n\r\n\t\tvar theatre = top.bindingMap.offlinetheatre;\r\n\r\n\t\tif (isLock) {\r\n\t\t\ttheatre.play(true);\r\n\t\t\twindow.clearInterval(window.messageQueueInterval);\r\n\t\t\twindow.messageQueueInterval = window.setInterval(\r\n\t\t\t\tMessageQueue._pokeserver,\r\n\t\t\t\tMessageQueue.INTERVAL_OFFLINE\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\ttheatre.stop();\r\n\t\t\twindow.clearInterval(window.messageQueueInterval);\r\n\t\t\twindow.messageQueueInterval = window.setInterval(\r\n\t\t\t\tMessageQueue._autoupdate,\r\n\t\t\t\tMessageQueue.INTERVAL_ONLINE\r\n\t\t\t);\r\n\t\t\t/*\r\n\t\t\t* Note that we now execute any actions that were\r\n\t\t\t* stacked on the list BEFORE offline mode started.\r\n\t\t\t*/\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tif (self._actions.hasEntries()) {\r\n\t\t\t\t\tself._nextAction();\r\n\t\t\t\t}\r\n\t\t\t}, 0);\r\n\t\t}\r\n\t\tisOffline = isLock;\r\n\t}\r\n\r\n\r\n\tthis.placeConsoleCommand = function (serializedMessageOrder) {\r\n\r\n\t    service.PlaceConsoleCommand(Application.CONSOLE_ID, serializedMessageOrder);\r\n\t}\r\n\r\n\t// EVENTBROADCASTERSTUFF ...................................................\r\n\r\n\t/**\r\n\t* @implements {IBroadcastListener}\r\n\t* @param {string} broadcast\r\n\t* @param {object} arg\r\n\t*/\r\n\tthis.handleBroadcast = function (broadcast, arg) {\r\n\r\n\t\tswitch (broadcast) {\r\n\r\n\t\t\tcase BroadcastMessages.APPLICATION_LOGIN:\r\n\t\t\t\tthis.initialize();\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase BroadcastMessages.VIEW_COMPLETED:\r\n\t\t\tcase BroadcastMessages.VIEW_CLOSED:\r\n\t\t\t\tif (triggerhandle != null && arg == triggerhandle) {\r\n\t\t\t\t\ttriggerhandle = null;\r\n\t\t\t\t\tthis._nextAction();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t/*\r\n\t\t\t* Multiple trees may report in on this. We count\r\n\t\t\t* them all and await the broadcast seen below.\r\n\t\t\t*/\r\n\t\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESHING:\r\n\r\n\t\t\t\tif (arg != null) {\r\n\t\t\t\t\trefreshingtrees.set(arg, true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlogger.debug(\"Saa har vi balladen!\");\r\n\t\t\t\t}\r\n\t\t\t\t//logger.debug ( \"REFRESHING! ... \" + refreshingtrees.countEntries ());\r\n\t\t\t\t//logger.fatal ( \"REFRESHING \" + arg );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t/*\r\n\t\t\t* Continue when all trees are reported refreshed.\r\n\t\t\t*/\r\n\t\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESHED:\r\n\r\n\t\t\t\t//logger.debug ( \"REFRESHED! ... \" + refreshingtrees.countEntries ());\r\n\t\t\t\t//logger.fatal ( \"REFRESHED \" + arg );\r\n\r\n\t\t\t\tif (refreshingtrees.hasEntries()) {\r\n\r\n\t\t\t\t\trefreshingtrees.del(arg);\r\n\r\n\t\t\t\t\tlogger.debug(\"Refreshed tree: \" + arg + \"\\n(\" + refreshingtrees.countEntries() + \" trees left!)\");\r\n\r\n\t\t\t\t\t//logger.debug ( \"AND NOW: \" + refreshingtrees.countEntries ());\r\n\r\n\t\t\t\t\tif (!refreshingtrees.hasEntries()) {\r\n\r\n\t\t\t\t\t\t//logger.debug ( \"ALL REFRESHED! NEXT...\" )\r\n\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this);\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED, this);\r\n\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t* This timeout allows trees to calm down in case\r\n\t\t\t\t\t\t* the next action is another refreshtree request.\r\n\t\t\t\t\t\t*/\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\tMessageQueue._nextAction();\r\n\t\t\t\t\t\t}, 0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t* Multiple treenodes may report in on this. We count\r\n\t\t\t\t* them all and await the broadcast seen below.\r\n\t\t\t\t*/\r\n\t\t\tcase BroadcastMessages.SYSTEMTREENODEBINDING_FORCING_OPEN:\r\n\r\n\t\t\t\topeningtreenodes.set(arg, true);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t/*\r\n\t\t\t* Continue only when all treenodes are reported open.\r\n\t\t\t*/\r\n\t\t\tcase BroadcastMessages.SYSTEMTREENODEBINDING_FORCED_OPEN:\r\n\r\n\t\t\t\tif (openingtreenodes.hasEntries() == true) {\r\n\t\t\t\t\topeningtreenodes.del(arg);\r\n\t\t\t\t\tif (!openingtreenodes.hasEntries()) {\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.SYSTEMTREENODEBINDING_FORCING_OPEN, this);\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.SYSTEMTREENODEBINDING_FORCED_OPEN, this);\r\n\t\t\t\t\t\tMessageQueue._nextAction();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t* Probably broadcasted by a {@link SOAPRequest}.\r\n\t\t\t\t*/\r\n\t\t\tcase BroadcastMessages.SERVER_OFFLINE:\r\n\t\t\t\tMessageQueue._lockSystem(true);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t/*\r\n\t\t\t* Probably broadcasted by a {@link SOAPRequest}.\r\n\t\t\t*/\r\n\t\t\tcase BroadcastMessages.SERVER_ONLINE:\r\n\t\t\t\tMessageQueue._lockSystem(false);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t* Convert array-of-key-value-objects into a plain old list.\r\n\t* @param {Array} params Array of objects with \"Key\" and \"Value\" props.\r\n\t* @return {List<object>} a list of objects with \"name\" and \"value\" props\r\n\t*/\r\n\tfunction paramsToList(params) {\r\n\r\n\t\tvar list = new List();\r\n\t\tnew List(params).each(function (entry) {\r\n\t\t\tlist.add({\r\n\t\t\t\tname: entry.Key,\r\n\t\t\t\tvalue: entry.Value\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\treturn list;\r\n\t}\r\n\r\n\t/*\r\n\t* File subscriptions.\r\n\t*/\r\n\tEventBroadcaster.subscribe(BroadcastMessages.APPLICATION_LOGIN, this);\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/MimeTypes.js",
    "content": "/**\r\n * Mimetypes.\r\n */\r\nvar MimeTypes = {\r\n\t\r\n\tJPG\t\t\t\t\t\t: \"image/jpeg\",\r\n\tGIF\t\t\t\t\t\t: \"image/gif\", \r\n\tPNG\t\t\t\t\t\t: \"image/png\",\r\n\t\r\n\tCSS\t\t\t\t\t\t: \"text/css\",\r\n\tJAVASCRIPT\t\t\t\t: \"text/javascript\",\r\n\tTEXT\t\t\t\t\t: \"text/plain\",\r\n\tHTML\t\t\t\t\t: \"text/html\",\r\n\tXHTML\t\t\t\t\t: \"applcication/xhtml+xml\",\r\n\t\r\n\tFLASH \t\t\t\t\t: \"application/x-shockwave-flash\",\r\n\tQUICKTIME \t\t\t\t: \"video/quicktime\",\r\n\tSHOCKWAVE \t\t\t\t: \"application/x-director\",\r\n\tWINMEDIA \t\t\t\t: \"application/x-mplayer2\",\r\n\t\r\n\tCOMPOSITEPAGES\t\t\t: \"application/x-composite-page\",\r\n\tCOMPOSITEFUNCTION \t\t: \"application/x-composite-function\"\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Persistance.js",
    "content": "/**\r\n * @class\r\n * This is the public interface for persistance management.\r\n * Don't instantiate this class manually. Access through \r\n * instance variable \"Persistance\" declared below. This \r\n * instance should be considered a singleton class.\r\n */\r\nfunction _Persistance () {}\r\n_Persistance.prototype = {\r\n\t\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"Persistance\" ),\t\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><HashMap<string><string>>}\r\n\t */\r\n\t_persistance : null,\r\n\r\n\t/**\r\n\t * Flip to activate!\r\n\t */\r\n\t_isEnabled : false,\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tisInitialized : false,\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tisEnabled : false,\r\n\t\t\r\n\t/**\r\n\t * Get persisted property.\r\n\t * @param {string} id\r\n\t * @param {string} prop\r\n\t * @return {string}\r\n\t */\r\n\tgetPersistedProperty : function ( id, prop ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tif ( this.isInitialized == true ) {\r\n\t\t\tif ( this._persistance ) {\r\n\t\t\t\tvar entry = this._persistance [ id ];\r\n\t\t\t\tif ( entry ) {\r\n\t\t\t\t\tresult = entry [ prop ];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthrow \"Persistance not initialized!\";\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Set persisted property.\r\n\t * @param {string} id\r\n\t * @param {string} prop\r\n\t * @param {string} value\r\n\t */\r\n\tsetPersistedProperty : function ( id, prop, value ) {\r\n\t\t\r\n\t\tif ( this.isInitialized == true ) {\r\n\t\t\tif ( this._persistance ) {\r\n\t\t\t\tif ( value != null ) {\r\n\t\t\t\t\tif ( !this._persistance [ id ]) {\r\n\t\t\t\t\t\tthis._persistance [ id ] = {};\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis._persistance [ id ][ prop ] = String ( value );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._logger.error ( \"Cannot persist \" + prop + \" with value: null\" );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthrow \"Persistance not initialized!\";\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Clear all persisted properties.\r\n\t * TODO: Actually clear all persisted properties.\r\n\t */\r\n\tclearAllPersistedProperties : function () {\r\n\t\t\r\n\t\tthis._logger.debug ( \"TODO: clearAllPersistedProperties\" );\r\n\t},\r\n\t\r\n\t/**\r\n\t * @implements {IBroadcastListener}\r\n\t * @param {string} broadcast\r\n\t */\r\n\thandleBroadcast : function ( broadcast ) {\r\n\t\t\r\n\t\tswitch ( broadcast ) {\r\n\t\t\tcase BroadcastMessages.APPLICATION_SHUTDOWN :\r\n\t\t\t\tvar binding = top.bindingMap.persistance; \r\n\t\t\t\tbinding.persist ( this._persistance );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Initialize. This is invoked by the {@link PersistanceBinding}.\r\n\t * @param {HashMap<string><HashMap<string><string>>} map\r\n\t */\r\n\tinitialize : function () {\r\n\t\t\r\n\t\t/*\r\n\t\t * Fetching persistance from PersistanceBinding.\r\n\t\t */\r\n\t\tif ( !this.isInitialized ) {\r\n\t\t\tthis.isInitialized = true;\r\n\t\t\tif ( this._isEnabled == true ) {\r\n\t\t\t\tvar binding = top.bindingMap.persistance;\r\n\t\t\t\tvar map = binding.getPersistanceMap ();\r\n\t\t\t\tif ( map ) {\r\n\t\t\t\t\tthis.isEnabled = true;\r\n\t\t\t\t\tthis._persistance = map;\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.APPLICATION_SHUTDOWN, this );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis.isEnabled = false;\r\n\t\t\t}\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.PERSISTANCE_INITIALIZED );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_Chrome}\r\n */\r\nvar Persistance = new _Persistance ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Preferences.js",
    "content": "/**\r\n * @class\r\n * @see {Options}\r\n */\r\nwindow.Preferences = new function () {\r\n\t\r\n\tvar logger = SystemLogger.getLogger ( \"Preferences\" );\r\n\t\r\n\t/*\r\n\t * Preferrably using defined constants to avoid spelling mistakes.\r\n\t */\r\n\tthis.LOGIN = \"login\";\r\n\t\r\n\t/* \r\n\t * Default preferences.\r\n\t */\r\n\tvar preferences = {\r\n\t\t\"login\" : true\r\n\t};\r\n\t\r\n\t/* \r\n\t * Fetch preferences on startup.\r\n\t */\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.LOCALSTORE_INITIALIZED, {\r\n\t\thandleBroadcast : function () {\r\n\t\t\tif ( LocalStore.isEnabled ) {\r\n\t\t\t\tvar store = LocalStore.getProperty ( LocalStore.PREFERENCES );\r\n\t\t\t\tif ( store ) {\r\n\t\t\t\t\tfor ( var key in store ) { // \"overloading\" not replacing!\r\n\t\t\t\t\t\tpreferences [ key ] = store [ key ];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdebug ( true );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdebug ( false );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tdebug ( false );\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\t\r\n\t/* \r\n\t * Store preferences on shutdown.\r\n\t */\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.APPLICATION_SHUTDOWN, {\r\n\t\thandleBroadcast : function () {\r\n\t\t\tif ( LocalStore.isEnabled ) {\r\n\t\t\t\tLocalStore.setProperty ( \r\n\t\t\t\t\tLocalStore.PREFERENCES,\r\n\t\t\t\t\tpreferences\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\t\r\n\t/**\r\n\t * Get preference.\r\n\t * @param {string} key\r\n\t * @return {object}\r\n\t */\r\n\tthis.getPref = function ( key ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tif ( key ) {\r\n\t\t\tresult = preferences [ key ];\r\n\t\t} else {\r\n\t\t\tthrow \"No such preference.\";\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Set preference.\r\n\t * @param {string} key\r\n\t * @param {object} value\r\n\t */\r\n\tthis.setPref = function ( key, value ) {\r\n\t\t\r\n\t\tif ( key ) {\r\n\t\t\tpreferences [ key ] = value;\r\n\t\t} else {\r\n\t\t\tthrow \"No such preference.\";\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Logging preferences on startup.\r\n\t * @param {boolean} hasStoredPreferences \r\n\t */\r\n\tfunction debug ( hasStoredPreferences ) {\r\n\t\t\r\n\t\tvar output = hasStoredPreferences ? \r\n\t\t\t\"Persisted preferences\" : \r\n\t\t\t\"No persisted preferences. Using defaults\";\r\n\t\t\t\r\n\t\toutput += \":\\n\";\r\n\t\tfor ( var key in preferences ) {\r\n\t\t\tvar pref = preferences [ key ];\r\n\t\t\toutput += \"\\n\\t\" + \r\n\t\t\t\tkey + \": \" + \r\n\t\t\t\tpref + \" [\" + \r\n\t\t\t\ttypeof pref + \"]\";\r\n\t\t}\r\n\t\tlogger.fine ( output );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Prism.js",
    "content": "/**\r\n * @class\r\n * Allows basic communication between C1 and the Prism host. \r\n * The C1 CMS extension must be installed in Prism.\r\n */\r\nfunction _Prism () {}\r\n_Prism.prototype = {\r\n\t\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"Prism\" ),\r\n\t\r\n\t/**\r\n\t * This will clear the cache (in Prism only).\r\n\t */\r\n\tclearCache : function () {\r\n\t\r\n\t\tthis._logger.fine ( \"Clearing the cache\" );\r\n\t\tthis._dispatchToPrism ( \"contenttochrome-clearcache\" );\r\n\t},\r\n\t\r\n\t/**\r\n\t * This will disable forced cache in Prism. Forced. \r\n\t * cache is a setup were files are NEVER checked \r\n\t * for newer versions on server unless expired.\r\n\t */\r\n\tdisableCache : function () {\r\n\t\t\r\n\t\tthis._logger.fine ( \"Disabling cache\" );\r\n\t\tthis._dispatchToPrism ( \"contenttochrome-cache-disable\" );\r\n\t},\r\n\t\r\n\t/**\r\n\t * This will enable forced cache in Prism (see note above).\r\n\t */\r\n\tenableCache : function () {\r\n\t\t\r\n\t\tthis._logger.fine ( \"Enabling cache\" );\r\n\t\tthis._dispatchToPrism ( \"contenttochrome-cache-enable\" );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Dispatch event to Prism host.\r\n\t * @param {string} type\r\n\t */\r\n\t_dispatchToPrism : function ( type ) {\r\n\t\t\r\n\t\tif ( Client.isPrism ) {\r\n\t\t\tvar event = document.createEvent ( \"Events\" );\r\n\t\t\tevent.initEvent ( type, true, true );\r\n\t\t\twindow.dispatchEvent ( event );\r\n\t\t} else {\r\n\t\t\tthis._logger.warn ( \"Prism methods should only be invoked in Prism! (\" + type + \")\" );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_Chrome}\r\n */\r\nvar Prism = new _Prism ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Resolver.js",
    "content": "/**\r\n * @class\r\n * Resolving dollar dollar super syntax.\r\n */\r\nfunction _Resolver () {}\r\n\r\n_Resolver.prototype = {\r\n\t\r\n\t_logger : SystemLogger.getLogger ( \"Resolver\" ),\r\n\t\r\n\t/**\r\n\t * Resolve that string.\r\n\t * @param {string} string\r\n\t * @return {string}\r\n\t */\r\n \tresolve : function ( string ) {\r\n\t\t\r\n\t\tif ( typeof string != Types.UNDEFINED ) {\r\n\t\t\t\r\n\t\t\t// could be interpretated as a number by Javascript.\r\n\t\t\tstring = String ( string );\r\n\t\t\r\n\t\t\t// TODO: refactor these - introduce generalized prefix such as \"shortcut:root\" or something.\r\n\t\t\tstring = string.replace ( \"${root}\", Constants.APPROOT );\r\n\t\t\tstring = string.replace ( \"${skin}\", Constants.SKINROOT );\r\n\t\t\tstring = string.replace ( \"${tiny}\", Constants.TINYROOT );\r\n\t\t\t\r\n\t\t\t// ${icon:Composite.Icons,fister-loeg-sovs(32)}\r\n\t\t\t\r\n\t\t\tif ( string.indexOf ( \"${icon:\" ) >-1 ) {\r\n\t\t\t\tstring = this._resolveImage ( string );\r\n\t\t\t}\r\n\t\t\telse if (string.indexOf(\"${class:\") > -1) {\r\n\t\t\t\tstring = this._resolveClasses(string);\r\n\t\t\t}\r\n\t\t\telse if ( string.indexOf ( \"${string:\" ) >-1 ) {\r\n\t\t\t\tstring = this._resolveString ( string );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn string;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Substitue string of type \"loading {0} to {1} and {2}\" with array entries.\r\n\t * @param {string} string\r\n\t * @param {array} vars\r\n\t * @return {string}\r\n\t */\r\n\tresolveVars : function ( string, vars ) {\r\n\t\t\r\n\t\tvar i = 0;\r\n\t\twhile ( i < vars.length ) {\r\n\t\t\tstring = string.replace ( \"{\" + i + \"}\", vars [ i ]);\r\n\t\t\ti++;\r\n\t\t}\r\n\t\treturn string;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Resolve string of syntax ${string:ProviderName:ResourceName} \r\n\t * where ProviderName is optional and will default.\r\n\t * @param {string} string\r\n\t * @return {string}\r\n\t */\r\n\t_resolveString : function ( string ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tvar provider = null;\r\n\t\tvar key = string.split ( \"${string:\" )[ 1 ].split ( \"}\" )[ 0 ];\r\n\t\t\r\n\t\tif ( key.indexOf ( \":\" ) >-1 ) {\r\n\t\t\tprovider = key.split ( \":\" ) [ 0 ];\r\n\t\t\tkey = key.split ( \":\" ) [ 1 ];\r\n\t\t} else {\r\n\t\t\tprovider = StringBundle.UI;\r\n\t\t}\r\n\t\tresult = StringBundle.getString ( provider, key );\r\n\t\tif ( !result ) {\r\n\t\t\tresult = \"(?)\";\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Resolve image of syntax ${icon:ProviderName:ResourceName(size)}\r\n\t * where ProviderName and size are optional and will default.\r\n\t * Example: \"${icon:previous(large)}\"\r\n\t * @param {string} string\r\n\t * @return {string}\r\n\t */\r\n\t_resolveImage: function (string) {\r\n\r\n\t\tvar result = null;\r\n\t\tvar provider = null;\r\n\t\tvar resource = null;\r\n\t\tvar size = null;\r\n\r\n\t\tresource = string.split(\"${icon:\")[1].split(\"}\")[0];\r\n\r\n\t\tif (resource.indexOf(\":\") > -1) {\r\n\t\t\tprovider = resource.split(\":\")[0];\r\n\t\t\tresource = resource.split(\":\")[1];\r\n\t\t} else {\r\n\t\t\tprovider = ImageProvider.UI;\r\n\t\t}\r\n\t\tif (resource.indexOf(\"(\") > -1) {\r\n\t\t\tsize = resource.split(\"(\")[1].split(\")\")[0];\r\n\t\t\tresource = resource.split(\"(\")[0];\r\n\t\t}\r\n\r\n\t\tresult = ImageProvider.getImageURL({\r\n\t\t\tResourceNamespace: provider,\r\n\t\t\tResourceName: resource\r\n\t\t}, size);\r\n\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Resolve class of syntax ${class:class1 class2 ...}\r\n\t * where ProviderName and size are optional and will default.\r\n\t * Example: \"${class:class1 class2}\"\r\n\t * @param {string} string\r\n\t * @return {string}\r\n\t */\r\n\t_resolveClasses : function ( string ) {\r\n\t\t\r\n\t\tvar result = {};\r\n\t\tresource = string.split(\"${class:\")[1].split(\"}\")[0];\r\n\t\tresult.classes = resource;\r\n\t\treturn result;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar Resolver = new _Resolver ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/SearchTokens.js",
    "content": "/**\r\n * @class\r\n * Search tokens are used to filter the content of a {@link SystemTreeBinding}.\r\n */\r\nwindow.SearchTokens = new function () {\r\n\t\r\n\t/*\r\n\t * Tokens indexed by key. This list should be manually maintained \r\n\t * to match available search tokens provided by the mighty server. \r\n\t * This will make sure that we don't misspell these strings.\r\n\t */\r\n\tvar tokens = {\r\n\t\t\r\n\t\t// searching gif, jpeg and png files.\r\n\t\t\"MediaFileElementProvider.WebImages\" : null,\r\n\t\t// searching flash, quicktime, director and windows media files.\r\n\t\t\"MediaFileElementProvider.EmbeddableMedia\": null,\r\n\t\t// searching only writable folders.\r\n\t\t\"MediaFileElementProvider.WritableFolders\": null,\r\n\t\t// searching functions that return XhtmlDocument (suitable for rendering) \r\n\t\t\"AllFunctionsElementProvider.VisualEditorFunctions\": null,\r\n\t\t// searching functions that are sutable for Xslt function's function call section\r\n\t\t\"AllFunctionsElementProvider.XsltFunctionCall\": null\r\n\t}\r\n\t\r\n\t/**\r\n\t * Get token by key.\r\n\t * @param {string} key \r\n\t */\r\n\tthis.getToken = function ( key ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tif ( this.hasToken ( key )) {\r\n\t\t\tresult = tokens [ key ];\r\n\t\t} else {\r\n\t\t\tthrow \"Unknown search token key: \" + key;\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Has token?\r\n\t * @param {string} key\r\n\t * @return {boolean}\r\n\t */\r\n\tthis.hasToken = function ( key ) {\r\n\t\t\r\n\t\treturn typeof tokens [ key ] != Types.UNDEFINED;\r\n\t}\r\n\t\r\n\t/*\r\n\t * Fetch tokens on login.\r\n\t */\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.APPLICATION_LOGIN, {\r\n\t\thandleBroadcast : function () {\r\n\t\t\tnew List ( TreeService.GetSearchTokens ( true )).each ( \r\n\t\t\t\tfunction ( token ) {\r\n\t\t\t\t\tif ( SearchTokens.hasToken ( token.Key )) {\r\n\t\t\t\t\t\ttokens [ token.Key ] = token.Value;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\talert ( \"SearchTokens need updating!\" );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Snippets.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction _Snippets () {};\r\n\r\n/**\r\n * Get snippet.\r\n * @param {string} category\r\n * @param {string} name\r\n * @return {string}\r\n */\r\n_Snippets.prototype.getSnippet = function ( category, name ) {\r\n\t\r\n\treturn \"\";\r\n};\r\n\r\n/**\r\n * Set snippet.\r\n * @param {string} category\r\n * @param {string} name\r\n * @return {string}\r\n */\r\n_Snippets.prototype.setSnippet = function ( category, name, snippet ) {\r\n\t\r\n\t\r\n};\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar Snippets = new _Snippets ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/StandardEventHandler.js",
    "content": "/**\r\n * Apparently this needs to adjusted on a system scope scale, although it\r\n * simply get's switched whenever native keys are toggled for any document.\r\n */\r\nStandardEventHandler.isBackAllowed = false;\r\n\r\n/**\r\n * @param {DOMDocument} doc\r\n * @param {boolean} isMouseHandlerOnly\r\n */\r\nfunction StandardEventHandler ( doc, isMouseHandlerOnly ) {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StandardEventHandler [\" + doc.title +\"]\" );\r\n\r\n\t/**\r\n\t * @type {DOMDocument}\r\n\t */\r\n\tthis._contextDocument = doc;\r\n\r\n\t/**\r\n\t * @type {DOMDocumentView}\r\n\t */\r\n\tthis._contextWindow = DOMUtil.getParentWindow ( doc );\r\n\r\n\t/**\r\n\t * Don't set this property directly! Please use methods below.\r\n\t * @see {StandardEventHandler#enableNativeKeys}\r\n\t * @see {StandardEventHandler#disableNativeKeys}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasNativeKeys = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isAllowTabs = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isMouseHandlerOnly = isMouseHandlerOnly;\r\n\r\n\t/*\r\n\t * Add listeners.\r\n\t */\r\n\tthis._addListeners ();\r\n}\r\n\r\n/*\r\n * Add listeners.\r\n */\r\nStandardEventHandler.prototype._addListeners = function () {\r\n\r\n\tvar doc = this._contextDocument;\r\n\r\n\tDOMEvents.addEventListener( doc, DOMEvents.MOUSEDOWN, this);\r\n\tDOMEvents.addEventListener ( doc, DOMEvents.MOUSEUP, this );\r\n\tDOMEvents.addEventListener ( doc, DOMEvents.MOUSEMOVE, this );\r\n\tDOMEvents.addEventListener ( doc, DOMEvents.TOUCHSTART, this);\r\n\r\n\r\n\t/*\r\n\t * Disable F1 to launch OS help in IE.\r\n\t */\r\n\tif ( Client.isExplorer || Client.isExplorer11 ) {\r\n\t\tDOMEvents.addEventListener(this._contextDocument, DOMEvents.HELP, {\r\n\t\t\thandleEvent: function (e) {\r\n\t\t\t\tDOMEvents.stopPropagation(e);\r\n\t\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\t}\r\n\t\t})\r\n\t\tDOMEvents.addEventListener(this._contextWindow, DOMEvents.HELP, {\r\n\t\t\thandleEvent: function (e) {\r\n\t\t\t\tDOMEvents.stopPropagation(e);\r\n\t\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\tif ( !this._isMouseHandlerOnly ) {\r\n\r\n\t\tDOMEvents.addEventListener ( doc, DOMEvents.KEYDOWN, this );\r\n\t\tDOMEvents.addEventListener ( doc, DOMEvents.KEYUP, this );\r\n\r\n\t\tif ( this._contextWindow.WindowManager == null ) {\r\n\t\t\tif (Client.isExplorer || Client.isExplorer11) {\r\n\t\t\t\tDOMEvents.addEventListener ( doc, DOMEvents.FOCUSIN, this );\r\n\t\t\t\tDOMEvents.addEventListener ( doc, DOMEvents.FOCUSOUT, this );\r\n\t\t\t} else {\r\n\t\t\t\tif ( this._contextDocument.designMode != \"on\" ) {\r\n\t\t\t\t\tDOMEvents.addEventListener ( doc, DOMEvents.FOCUS, this, true );\r\n\t\t\t\t\tDOMEvents.addEventListener ( doc, DOMEvents.BLUR, this, true );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Setup global focus listeners.\r\n\t\t * TODO: Make reliable for IE!\r\n\t\t * @see {Application#focused}\r\n\t\t */\r\n\t\tvar handler = {\r\n\t\t\thandleEvent : function ( e ){\r\n\t\t\t\tswitch ( e.type ) {\r\n\t\t\t\t\tcase DOMEvents.BLUR :\r\n\t\t\t\t\t\tApplication.focused ( false );\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase DOMEvents.FOCUS :\r\n\t\t\t\t\t\tApplication.focused ( true );\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tDOMEvents.addEventListener ( this._contextWindow, DOMEvents.BLUR, handler );\r\n\t\tDOMEvents.addEventListener ( this._contextWindow, DOMEvents.FOCUS, handler );\r\n\t}\r\n\r\n\t/*\r\n\t * Supress CTRL+S (TODO: handle this elsewhere!)\r\n\t */\r\n\tif ( Client.isMozilla ) {\r\n\t\tdoc.addEventListener ( DOMEvents.KEYDOWN, {\r\n\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\tvar s = 83;\r\n\t\t\t\tif (Client.isMac) {\r\n\t\t\t\t\tif (e.metaKey && e.keyCode == s && !e.altKey) {\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (e.ctrlKey && e.keyCode == s && !e.altKey) {\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, true );\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @param {MouseEvent} e\r\n */\r\nStandardEventHandler.prototype.handleEvent = function ( e ) {\r\n\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\tthis._handleMouseDown ( e );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.MOUSEUP :\r\n\t\t\tthis._handleMouseUp ( e );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.MOUSEMOVE :\r\n\t\t\tthis._handleMouseMove ( e );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.TOUCHSTART:\r\n\t\t\tthis._handleTouchStart(e);\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.KEYDOWN :\r\n\t\t\tthis._handleKeyDown ( e );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.KEYUP :\r\n\t\t\tthis._handleKeyUp ( e );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.FOCUS :\r\n\t\tcase DOMEvents.BLUR :\r\n\t\tcase DOMEvents.FOCUSIN :\r\n\t\tcase DOMEvents.FOCUSOUT :\r\n\t\t\tthis._handleFocus ( e );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Broadcast mousedown globally. For framework pages, locate nearest binding\r\n * instance to make it dispatch the \"bindingactivated\" action. This action is\r\n * probably consumed by nearest containing {@link DockBinding}.\r\n * @param {MouseEvent} e\r\n */\r\nStandardEventHandler.prototype._handleMouseDown = function ( e ) {\r\n\r\n\tApplication.trackMousePosition ( e );\r\n\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN, e );\r\n\r\n\t/*\r\n\t * Only left mouse button will activate and migrate.\r\n\t */\r\n\tif ( e.button != ButtonStateManager.RIGHT_BUTTON ) {\r\n\r\n\t\tvar node = DOMEvents.getTarget ( e );\r\n\t\twhile ( node != null ) {\r\n\t\t\tswitch ( node.nodeType ) {\r\n\t\t\t\tcase Node.ELEMENT_NODE :\r\n\t\t\t\t\tvar binding = UserInterface.getBinding ( node );\r\n\t\t\t\t\tif ( binding != null ) {\r\n\t\t\t\t\t\tbinding.dispatchAction (\r\n\t\t\t\t\t\t\tBinding.ACTION_ACTIVATED\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tnode = binding != null ? null : node.parentNode;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Node.DOCUMENT_NODE :\r\n\t\t\t\t\tnode = DOMUtil.getParentWindow ( node ).frameElement;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tnode = null;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*\r\n * Broadcast mouseup globally.\r\n * @param {MouseEvent} e\r\n */\r\nStandardEventHandler.prototype._handleMouseUp = function ( e ) {\r\n\r\n\tApplication.trackMousePosition ( e );\r\n\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEUP, e );\r\n}\r\n\r\n/**\r\n * Broadcast mousemove globally *only* while mousetracking.\r\n * TODO: Broadcast mouseup if button is not pressed!\r\n * @param {MouseEvent} e\r\n */\r\nStandardEventHandler.prototype._handleMouseMove = function ( e ) {\r\n\r\n\ttry {\r\n\r\n\t\tvar isTracking = Application.trackMousePosition ( e );\r\n\t\tif ( isTracking ) {\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEMOVE, e );\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * IE may spontaneously believe that no window has focus. If the\r\n\t\t * mousemove event is registered, this is not obviously not the case.\r\n\t\t * Therefore we can safely FOCUS our window, kicking IE back on track.\r\n\t\t * This fixes a bug where the backspace key stopped working.\r\n\t\t * TODO: Figure out why this was disabled...\r\n\t\t *\r\n\t\tif ( Client.isExplorer ) {\r\n\r\n\t\t\tif ( Application.isBlurred ) {\r\n\r\n\t\t\t\tvar doc = this._contextDocument;\r\n\t\t\t\tvar win = this._contextWindow;\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t * The contentEditable document MUST be activated by a\r\n\t\t\t\t * mousedown WHEN another window has the focus. That's\r\n\t\t\t\t * why we focus the parent window in this case.\r\n\t\t\t\t *\r\n\t\t\t\tif ( doc.body.contentEditable == \"true\" ) {\r\n\t\t\t\t\twin = DOMUtil.getParentWindow ( win.frameElement );\r\n\t\t\t\t}\r\n\t\t\t\twin.focus ();\r\n\t\t\t}\r\n\t\t}\r\n\t\t*/\r\n\r\n\t} catch ( exception ) { // don't want to throw errors continually onmousemove\r\n\t\tDOMEvents.removeEventListener (\r\n\t\t\tthis._contextDocument,\r\n\t\t\tDOMEvents.MOUSEMOVE,\r\n\t\t\tthis\r\n\t\t);\r\n\t\tthrow ( exception );\r\n\t}\r\n}\r\n\r\n/*\r\n * Broadcast touchstart globally.\r\n * @param {MouseEvent} e\r\n */\r\nStandardEventHandler.prototype._handleTouchStart = function (e) {\r\n\r\n\tEventBroadcaster.broadcast(BroadcastMessages.TOUCHEVENT_TOUCHSTART, e);\r\n}\r\n\r\n/**\r\n * @param {KeyEvent} e\r\n */\r\nStandardEventHandler.prototype._handleKeyDown = function ( e, isTabHandled, fromNativeKeys ) {\r\n\r\n\t/*\r\n\t * This should only happen in the currently active window,\r\n\t * but the keypress should still be propagated for KeyBinding.\r\n\t */\r\n\tif ( e.keyCode == KeyEventCodes.VK_TAB ) {\r\n\t\tif ( !this._isAllowTabs ) {\r\n\t\t\tif ( !isTabHandled ) {\r\n\t\t\t\tthis._handleTab ( e );\r\n\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif ( e.shiftKey || e.ctrlKey ) {\r\n\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t}\r\n\t\t}\r\n\t\tisTabHandled = true;\r\n\t}\r\n\r\n\t/*\r\n\t * Prevent standard browser page navigation keys. Theorectically, the check\r\n\t * for shift and controls keys should *not* be performed. For some unknown\r\n\t * reason, however, pressing these keys will switch the value of hasNativeKeys...\r\n\t * TODO: Investigate why!\r\n\t */\r\n\tif (!this.hasNativeKeys && !e.shiftKey && !e.ctrlKey && !fromNativeKeys) {\r\n\t\tswitch ( e.keyCode ) {\r\n\t\t\tcase KeyEventCodes.VK_UP :\r\n\t\t\tcase KeyEventCodes.VK_DOWN :\r\n\t\t\tcase KeyEventCodes.VK_LEFT :\r\n\t\t\tcase KeyEventCodes.VK_RIGHT :\r\n\t\t\tcase KeyEventCodes.VK_SPACE :\r\n\t\t\tcase KeyEventCodes.VK_PAGE_UP :\r\n\t\t\tcase KeyEventCodes.VK_PAGE_DOWN :\r\n\t\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t \tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tif ( e.keyCode == KeyEventCodes.VK_BACK ) {\r\n\t\tif (!StandardEventHandler.isBackAllowed || UserInterface.hasBinding(e.target)) {\r\n\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t}\r\n\t}\r\n\r\n\tvar isHandled = KeySetBinding.handleKey ( this._contextDocument, e );\r\n\tif ( !isHandled ) {\r\n\t\tswitch ( e.keyCode ) {\r\n\r\n\t\t\tcase KeyEventCodes.VK_PAGE_UP :\r\n\t\t\tcase KeyEventCodes.VK_PAGE_DOWN :\r\n\t\t\t\t/*\r\n\t\t\t\t * Strangely, these keys may stop working in this._contextWindow,\r\n\t\t\t\t * even while allowed, when an ANCESTOR frame preventDefaults them.\r\n\t\t\t\t */\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tvar frame = this._contextWindow.frameElement;\r\n\t\t\t\tif ( frame != null ) {\r\n\t\t\t\t\tvar parent = DOMUtil.getParentWindow ( frame );\r\n\t\t\t\t\tif ( parent.standardEventHandler != null ) {\r\n\t\t\t\t\t\tparent.standardEventHandler._handleKeyDown(e, isTabHandled, fromNativeKeys ? fromNativeKeys : this.hasNativeKeys);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * TAB is handled especial.\r\n * @param {KeyEvent} e\r\n */\r\nStandardEventHandler.prototype._handleTab = function ( e ) {\r\n\r\n\tif ( !this._isAllowTabs ) {\r\n\t\tif ( !e.ctrlKey ) {\r\n\t\t\tif ( e.shiftKey ) {\r\n\t\t\t\tFocusBinding.navigatePrevious ();\r\n\t\t\t} else {\r\n\t\t\t\tFocusBinding.navigateNext ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle focus and blur.\r\n * @param {Event} e\r\n */\r\nStandardEventHandler.prototype._handleFocus = function ( e ) {\r\n\r\n\tvar isFocus = false;\r\n\tvar target = DOMEvents.getTarget ( e );\r\n\tvar name = target.nodeName.toLowerCase ();\r\n\r\n\tswitch ( name ) {\r\n\t\tcase \"input\" :\r\n\t\tcase \"textarea\" :\r\n\t\tcase \"select\" :\r\n\t\t\tisFocus = ( e.type == DOMEvents.FOCUS || e.type == DOMEvents.FOCUSIN );\r\n\t\t\tif ( name == \"input\" || name == \"textarea\" ) {\r\n\t\t\t\tStandardEventHandler.isBackAllowed = isFocus;\r\n\t\t\t}\r\n\t\t\tif ( isFocus ) {\r\n\t\t\t\tif ( !this.hasNativeKeys ) {\r\n\t\t\t\t\tthis.enableNativeKeys ();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif ( this.hasNativeKeys ) {\r\n\t\t\t\t\tthis.disableNativeKeys ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {KeyEvent} e\r\n */\r\nStandardEventHandler.prototype._handleKeyUp = function ( e ) {\r\n\r\n\t/*\r\n\t * Simply broadcast the keyup event globally\r\n\t * via the {@link Keyboard} singleton.\r\n\t */\r\n\tKeyboard.keyUp ( e );\r\n}\r\n\r\n/**\r\n * Enable native keys.\r\n * @param {boolean} isAllowTabs Relevant for editors\r\n */\r\nStandardEventHandler.prototype.enableNativeKeys = function ( isAllowTabs ) {\r\n\r\n\tthis._isAllowTabs = ( isAllowTabs == true ? true : false );\r\n\r\n\t/* Timeout hack prevents open dialogs from closing when\r\n\t * a SelectBoxBinding changes selection. Also, it allows\r\n\t * one control to disable keys *before* another enables it.\r\n\t */\r\n\tvar self = this;\r\n\ttop.setTimeout ( function () {\r\n\t\tself.hasNativeKeys = true;\r\n\t\tStandardEventHandler.isBackAllowed = true;\r\n\t}, 0 );\r\n}\r\n\r\n/**\r\n * Disable native keys. This will always dissalow tabs.\r\n */\r\nStandardEventHandler.prototype.disableNativeKeys = function () {\r\n\r\n\tthis._isAllowTabs = false;\r\n\tthis.hasNativeKeys = false;\r\n\tStandardEventHandler.isBackAllowed = false;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/StatusBar.js",
    "content": "/**\r\n * @class\r\n * This would control the statusbar near the bottom of the app window. \r\n * Access this fellow through instance variable StatusBar declared below.\r\n */\r\nfunction _StatusBar () {\r\n\t\r\n\t/**\r\n\t * Time in milliseconds before \r\n\t * text gets faded out.\r\n\t */\r\n\tthis.AUTOCLEAR_TIMEOUT = 5 * 1000;\r\n\t\r\n\t/**\r\n\t * Toolbar groups.\r\n\t */\r\n\tthis.GROUP_LANGUAGETOOLS = \"languagetools\";\r\n\t\r\n\t/**\r\n\t * Handy when statusbar bindings are to be constructed from other windows.\r\n\t * @type {HTMLDocument}\r\n\t */\r\n\tthis.document = null;\r\n\t\r\n\t/*\r\n\t * Read current statusbar state.\r\n\t */\r\n\tthis.state = null;\r\n\tthis.ERROR = \"error\";\r\n\tthis.WARN = \"warn\";\r\n\tthis.BUSY = \"busy\";\r\n\tthis.READY = \"ready\";\r\n\t\r\n\t/*\r\n\t * statusbar tool groups.\r\n\t * @type {Map<string><ToolBarGroupBinding>}\r\n\t */\r\n\tthis._groups = new Map ();\r\n\t\r\n\t/*\r\n\t * Privates.\r\n\t */\r\n\tvar logger = SystemLogger.getLogger ( \"StatusBar\" );\r\n\tvar statusbar = null;\r\n\t\r\n\tvar icon_error \t\t= \"${icon:error}\";\r\n\tvar icon_warn \t\t= \"${icon:warning}\";\r\n\tvar icon_busy \t\t= \"${icon:loading}\";\r\n\tvar icon_ready \t\t= \"${icon:message}\";\r\n\t\r\n\tvar message_error \t= null;\r\n\tvar message_warn \t= null;\r\n\tvar message_busy \t= null;\r\n\tvar message_ready \t= null;\r\n\t\r\n\t/**\r\n\t * Initialize.\r\n\t * @param {StageStatusBarBinding} binding\r\n\t */\r\n\tthis.initialize = function ( binding ) {\r\n\t\t\r\n\t\tmessage_error \t= StringBundle.getString ( \"ui\", \"Website.App.StatusBar.Error\" );\r\n\t\tmessage_warn \t= StringBundle.getString ( \"ui\", \"Website.App.StatusBar.Warn\" );\r\n\t\tmessage_busy \t= StringBundle.getString ( \"ui\", \"Website.App.StatusBar.Busy\" );\r\n\t\tmessage_ready \t= StringBundle.getString ( \"ui\", \"Website.App.StatusBar.Ready\" );\r\n\t\t\r\n\t\tstatusbar = binding;\r\n\t\tthis.document = binding.bindingDocument;\r\n\t}\r\n\t\r\n\t// STATUSBAR MESSAGES .............................................................\r\n\t\r\n\t/**\r\n\t * Show error. Clear manually!\r\n\t * @param {string} message\r\n\t * @param {array} vars\r\n\t */\r\n\tthis.error = function ( message, vars ) {\r\n\t\t\r\n\t\tthis.state = StatusBar.ERROR;\r\n\t\tmessage = message ? message : message_error;\r\n\t\tshow ( message, icon_error, vars, false );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Show warning. Clear manually!\r\n\t * @param {string} message\r\n\t * @param {array} vars\r\n\t */\r\n\tthis.warn = function ( message, vars ) {\r\n\t\t\r\n\t\tthis.state = StatusBar.WARN;\r\n\t\tmessage = message ? message : message_warn;\r\n\t\tshow ( message, icon_warn, vars, false );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Indicate busy. Clear manually!\r\n\t * @param {string} message\r\n\t * @param {array} vars\r\n\t */\r\n\tthis.busy = function ( message, vars ) {\r\n\t\t\r\n\t\tthis.state = StatusBar.BUSY;\r\n\t\tmessage = message ? message : message_busy;\r\n\t\tshow ( message, icon_busy, vars, false );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Indicate ready. This will clear itself automatically.\r\n\t * @param {string} message\r\n\t * @param {array} vars\r\n\t */\r\n\tthis.ready = function ( message, vars ) {\r\n\t\t\r\n\t\tthis.state = StatusBar.READY;\r\n\t\tmessage = message ? message : message_ready;\r\n\t\tshow ( message, icon_ready, vars, true );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Show custom message and icon.\r\n\t * @param {string} message\r\n\t * @param {string} icon\r\n\t * @param {array} vars\r\n\t * @param {boolean} isAutoClear\r\n\t */\r\n\tthis.report = function ( message, icon, vars, isAutoClear ) {\r\n\t\t\r\n\t\tthis.state = null;\r\n\t\tshow ( message, icon, vars, isAutoClear );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Clear message and icon.\r\n\t */\r\n\tthis.clear = function () {\r\n\t\t\r\n\t\tthis.state = null;\r\n\t\tif ( statusbar ) {\r\n\t\t\tstatusbar.clear ();\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Show message.\r\n\t * @param {string} message\r\n\t * @param {string} icon\r\n\t * @param {array} vars\r\n\t * @param {boolean} isAutoClear\r\n\t */\r\n\tfunction show ( message, icon, vars, isAutoClear ) {\r\n\t\t\r\n\t\tif ( vars ) {\r\n\t\t\tmessage = Resolver.resolveVars ( message, vars );\r\n\t\t}\r\n\t\tif ( statusbar ) {\r\n\t\t\tstatusbar.setLabel ( message );\r\n\t\t\tstatusbar.setImage ( icon );\r\n\t\t\tif ( isAutoClear ) {\r\n\t\t\t\tstatusbar.startFadeOut ( StatusBar.AUTOCLEAR_TIMEOUT );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlogger.error ( \"Message not initialized for display: \" + message );\r\n\t\t}\r\n\t}\r\n\t\r\n\t\r\n\t// STATUSBAR TOOLS ................................................................\r\n\t\r\n\t/** \r\n\t * @param {string} name\r\n\t * @param {Binding} binding\r\n\t */\r\n\tthis.addToGroup = function ( name, binding ) {\r\n\t\t\r\n\t\tif ( !this._groups.has ( name )) {\r\n\t\t\tthis._groups.set ( name, statusbar.addRight (\r\n\t\t\t\tToolBarGroupBinding.newInstance ( this.document )\r\n\t\t\t));\r\n\t\t}\r\n\t\tthis._groups.get ( name ).add ( binding );\r\n\t}\r\n}\r\n\r\n/*\r\n * The instance that does it.\r\n */\r\nvar StatusBar = new _StatusBar ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/StringBundle.js",
    "content": "/**\r\n * @class\r\n */\r\nwindow.StringBundle = new function () {\r\n\t\r\n\tvar logger = SystemLogger.getLogger ( \"StringBundle\" );\r\n\t\r\n\t/*\r\n\t * Provider shorthand.\r\n\t */\r\n\tthis.UI = \"Composite.Management\";\r\n\t\r\n\t/*\r\n\t * Mapping providers.\r\n\t * @type {HashMap<string><HashMap<string><string>>}\r\n\t */\r\n\tvar providers = {};\r\n\t\r\n\t/**\r\n\t * Populate provider via webservice.\r\n\t * @param {string} providername\r\n\t * @param {HashMap} provider\r\n\t * @param {HashMap}\r\n\t */\r\n\tfunction resolve ( providername, provider ) {\r\n\t\t\r\n\t\tvar list = new List (\r\n\t\t\tStringService.GetLocalisation ( providername )\r\n\t\t);\r\n\t\tif ( list.hasEntries ()) {\r\n\t\t\tlist.each (\r\n\t\t\t\tfunction ( entry ) {\r\n\t\t\t\t\tprovider [ entry.Key ] = entry.Value;\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tthrow \"No strings from provider: \" + providername;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Get string!\r\n\t * @param {string} providername\r\n\t * @param {string} stringkey\r\n\t * @return {string}\r\n\t */\r\n\tthis.getString = function ( providername, stringkey ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\t\r\n\t\tif ( window.StringService != null ) {\r\n\t\t\ttry {\r\n\t\t\t\tif ( providername == \"ui\" ) {\r\n\t\t\t\t\tprovidername = StringBundle.UI;\r\n\t\t\t\t}\r\n\t\t\t\tif ( !providers [ providername ] ) {\r\n\t\t\t\t\tvar provider = providers [ providername ] = {};\r\n\t\t\t\t\tresolve ( providername, provider );\r\n\t\t\t\t}\r\n\t\t\t\tif ( providers [ providername ]) {\r\n\t\t\t\t\tresult = providers [ providername ][ stringkey ]\r\n\t\t\t\t}\r\n\t\t\t\tif ( !result ) {\r\n\t\t\t\t\tthrow \"No such string: \" + stringkey;\r\n\t\t\t\t}\r\n\t\t\t} catch ( exception ) {\r\n\t\t\t\tvar cry = \"StringBundle exception in string \" + providername + \":\" + stringkey;\r\n\t\t\t\tlogger.error ( cry );\r\n\t\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\t\talert ( cry );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Templates.js",
    "content": "/**\r\n * @class\r\n * This can retrieve all sorts of stuff located in the root \"templates\" folder. \r\n * Stuff can be retrieved as either pure text, DOMDocuments and DOMElements.\r\n */\r\nfunction _Templates () {}\r\n\r\n_Templates.prototype = {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"Templates\" ),\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><object>}\r\n\t */\r\n\t_cache : {},\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\t_mode : null,\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\t_modes : {\r\n\t\tMODE_PLAINTEXT\t\t: 0,\r\n\t\tMODE_DOCUMENT\t\t: 1,\r\n\t\tMODE_ELEMENT\t\t: 2,\r\n\t\tMODE_DOCUMENTTEXT\t: 3,\r\n\t\tMODE_ELEMENTTEXT\t: 4\r\n\t},\r\n\t\r\n\t/**\r\n\t * Get template as DOMDocument.\r\n\t * @param {string} name\r\n\t * @return {DOMDocument}\r\n\t */\r\n\tgetTemplateDocument : function ( name ) {\r\n\t\r\n\t\tthis._mode = this._modes.MODE_DOCUMENT;\r\n\t\treturn this._getIt ( name );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Get template as DOMElement.\r\n\t * @param {string} name\r\n\t * @return {DOMElement}\r\n\t */\r\n\tgetTemplateElement : function ( name ) {\r\n\t\r\n\t\tthis._mode = this._modes.MODE_ELEMENT;\r\n\t\treturn this._getIt ( name );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Get template as serialized DOMDocument.\r\n\t * @param {string} name\r\n\t * @return {string}\r\n\t */\r\n\tgetTemplateDocumentText : function ( name ) {\r\n\t\r\n\t\tthis._mode = this._modes.MODE_DOCUMENTTEXT;\r\n\t\treturn this._getIt ( name );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Get template as serialized DOMElement.\r\n\t * @param {string} name\r\n\t * @return {string}\r\n\t */\r\n\tgetTemplateElementText : function ( name ) {\r\n\t\r\n\t\tthis._mode = this._modes.MODE_ELEMENTTEXT;\r\n\t\treturn this._getIt ( name );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Superhacked method to fetch multiple \"root\" \r\n\t * nodes in textual form. The document structure \r\n\t * must take the form of an XHTML document...\r\n\t * @param {string} name\r\n\t * @return {string}\r\n\t */\r\n\tgetTemplateBodyText : function ( name ) {\r\n\t\t\r\n\t\tvar tmp = this.getTemplateDocumentText ( name );\r\n\t\ttmp = tmp.split ( \"<body>\" )[ 1 ].split ( \"</body>\" )[ 0 ];\r\n\t\treturn tmp;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Get template as plain text. This can read non-welformed templates.\r\n\t * @param {string} name\r\n\t * @return {string}\r\n\t */\r\n\tgetPlainText : function ( name ) {\r\n\t\r\n\t\tthis._mode = this._modes.MODE_PLAINTEXT;\r\n\t\treturn this._getIt ( name );\r\n\t},\r\n\t\r\n\t/**\r\n\t * @param {string} name\r\n\t * @return {object}\r\n\t * @ignore\r\n\t */ \r\n\t_getIt : function ( name ) {\r\n\t\r\n\t\tvar result = null;\r\n\t\tvar entry = null;\r\n\t\tvar isFresh = false;\r\n\t\t\r\n\t\tif ( !this._cache [ name ]) {\r\n\t\t\t\r\n\t\t\tisFresh = true;\r\n\t\t\t\r\n\t\t\tvar uri = Constants.TEMPLATESROOT + \"/\" + name;\r\n\t\t\tvar request = DOMUtil.getXMLHTTPRequest ();\r\n\t\t\trequest.open ( \"get\", uri,  false );\r\n\t\t\trequest.setRequestHeader ( \"Content-Type\", \"text/xml; charset=UTF-8\" );\r\n\t\t\trequest.send ( null );\r\n\t\t\t\r\n\t\t\tswitch ( this._mode ) {\t\r\n\t\t\t\tcase this._modes.MODE_PLAINTEXT :\r\n\t\t\t\t\tentry = request.responseText;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tentry = request.responseXML;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tif ( entry == null ) {\r\n\t\t\t\tthrow new Error ( \"Templates: Could not read template. Malformed XML?\" );\r\n\t\t\t} else {\r\n\t\t\t\tthis._cache [ name ] = entry;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tentry = this._cache [ name ];\r\n\t\t\r\n\t\tswitch ( this._mode ) {\r\n\t\t\tcase this._modes.MODE_PLAINTEXT :\r\n\t\t\t\tresult = entry;\r\n\t\t\t\tbreak;\r\n\t\t\tcase this._modes.MODE_DOCUMENT :\r\n\t\t\t\tresult = DOMUtil.cloneNode ( entry, true );\r\n\t\t\t\tbreak;\r\n\t\t\tcase this._modes.MODE_ELEMENT :\r\n\t\t\t\tresult = DOMUtil.cloneNode ( entry.documentElement, true );\r\n\t\t\t\tbreak;\r\n\t\t\tcase this._modes.MODE_DOCUMENTTEXT :\r\n\t\t\t\tresult = DOMSerializer.serialize ( entry, true );\r\n\t\t\t\tbreak;\r\n\t\t\tcase this._modes.MODE_ELEMENTTEXT :\r\n\t\t\t\tresult = DOMSerializer.serialize ( entry.documentElement, true );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\t/**\r\n\t\t * Debug output for developers.\r\n\t\t */\r\n\t\tif ( isFresh && Application.isDeveloperMode ) {\r\n\t\t\t//this._logger.fine ( new String ( \"Import \\\"\" + name + \"\\\":\\n\\n\" + result ));\r\n\t\t}\r\n\t\t\r\n\t\treturn result;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n */\r\nvar Templates = new _Templates ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Types.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction _Types () {}\r\n\r\n_Types.prototype = {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\t_logger : SystemLogger.getLogger ( \"Types\" ),\r\n\t\r\n\tBOOLEAN \t: \"boolean\",\r\n\tSTRING \t \t: \"string\",\r\n\tNUMBER \t\t: \"number\",\r\n\tFUNCTION \t: \"function\",\r\n\tUNDEFINED\t: \"undefined\",\r\n\t\r\n\t/**\r\n\t * Autocast string to an inferred type.\r\n\t * To be used with caution and scepsis. \n\t * @param {string} string\r\n\t * @return {object}\r\n\t */\r\n\tcastFromString : function ( string ) {\r\n\t\t\r\n\t\tvar result = string;\r\n\t\t\r\n\t\tif ( parseInt ( result ).toString () === result ) {\r\n\t\t\tresult = parseInt ( result );\r\n\t\t} else if ( parseFloat ( result ).toString () === result ) {\r\n\t\t\tresult = parseFloat ( result );\r\n\t\t} else if ( result === \"true\" || result === \"false\" ) {\r\n\t\t\tresult = ( result === \"true\" );\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Is it defined?\r\n\t * @param {object} arg\r\n\t * @return {boolean}\r\n\t */\r\n\tisDefined : function ( arg ) {\r\n\t\t\r\n\t\treturn typeof arg != Types.UNDEFINED;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Is it a function?\r\n\t * @param {object} arg\r\n\t * @return {boolean}\r\n\t */\r\n\tisFunction : function ( arg ) {\r\n\t\t\r\n\t\treturn typeof arg == Types.FUNCTION;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it!\r\n * @type {_Types}\r\n */\r\nvar Types = new _Types ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Uri.js",
    "content": "﻿/**\r\n*@class\r\n* @param @url {string} url.\r\n* @constructor\r\n*/\r\n//TODO Add escaping\r\nfunction Uri(url) {\r\n\r\n\turl = url ? url : \"\";\r\n\tvar mediaExpr = /^(~?\\/|(\\.\\.\\/)+|https?:\\/\\/[\\w\\d-\\.:]*\\/)(media|page)(\\(|%28)[\\w\\d-\\:]+(\\)|%29)/;\r\n\tvar result = mediaExpr.exec(url);\r\n\r\n\tif (result) {\r\n\t\tif (result[3] == \"media\") {\r\n\t\t\tthis.isMedia = true;\r\n\t\t} else if (result[3] == \"page\") {\r\n\t\t\tthis.isPage = true;\r\n\t\t}\r\n\t}\r\n\tvar queryString = {};\r\n\turl.replace(/^[^\\?]*/g, \"\").replace(\r\n\t\t/([^?=&]+)(=([^&]*))?/g,\r\n\t\tfunction ($0, $1, $2, $3) { queryString[$1] = $3; }\r\n\t);\r\n\r\n\tthis.queryString = queryString;\r\n\r\n\tthis.path = url.replace(/\\?.*/g, \"\");\r\n\r\n\tthis.isInternalUrl = url.indexOf(\"~/\") === 0;\r\n\r\n\treturn this;\r\n}\r\n\r\n\r\nUri.isMedia = function(url) {\r\n\treturn new Uri(url).isMedia;\r\n};\r\n\r\n/**\r\n* Get media path without parameters\r\n* @return {string}\r\n*/\r\nUri.prototype.getPath = function() {\r\n\treturn this.path;\r\n};\r\n\r\n/**\r\n* Get media path without parameters\r\n* @return {string}\r\n*/\r\nUri.prototype.getQueryString = function () {\r\n\treturn new Map(this.queryString);\r\n};\r\n\r\n/**\r\n* Has param in query string?\r\n* @param {object} key\r\n* @return {boolean}\r\n*/\r\nUri.prototype.hasParam = function(key) {\r\n\treturn this.queryString[key] != null;\r\n};\r\n\r\n/**\r\n* Get param in query string\r\n* @param {object} key\r\n* @return {boolean}\r\n*/\r\nUri.prototype.getParam = function(key) {\r\n\treturn this.queryString[key];\r\n};\r\n/**\r\n* Set param in query string\r\n* @param {object} key\r\n*/\r\nUri.prototype.setParam = function(key, value) {\r\n\tif (value == undefined) {\r\n\t\tdelete this.queryString[key];\r\n\t} else {\r\n\t\tthis.queryString[key] = value;\r\n\t}\r\n};\r\n\r\n/**\r\n* @return {string}\r\n*/\r\nUri.prototype.toString = function () {\r\n\tvar url = this.path;\r\n\r\n\tvar querystring = [];\r\n\tfor (var key in this.queryString) {\r\n\t\tquerystring.push(key + \"=\" + this.queryString[key]);\r\n\t}\r\n\r\n\tif (querystring.length > 0)\r\n\t\turl += \"?\" + querystring.join(\"&\");\r\n\r\n\treturn url;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/Validator.js",
    "content": "function _Validator () {}\r\n\r\n_Validator.prototype = {\r\n\t\t\r\n\t/**\r\n\t * Validate.\r\n\t * @param {String} string\r\n\t * @param {String} key\r\n\t * @param {boolean} isInformed\r\n\t * @returns {boolean}\r\n\t */\r\n\tvalidate : function ( string, key, isInformed ) {\r\n\t\r\n\t\tvar result = true;\r\n\t\tvar response = SourceValidationService.ValidateSource ( string, key );\r\n\t\tif ( response != \"True\" ) {\r\n\t\t\tif ( isInformed == true ) {\r\n\t\t\t\tthis._dialog ( response );\r\n\t\t\t}\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Validate by presenting a dialog in case of non-validating input.\r\n\t * @param {String} string\r\n\t * @param {String} key\r\n\t * @param {boolean} isInformed\r\n\t * @returns {boolean}\r\n\t */\r\n\tvalidateInformed : function ( string, key ) {\r\n\t\t\r\n\t\treturn this.validate ( string, key, true );\r\n\t},\r\n\t\r\n\t/**\r\n\t * In case of non-validating source, present a clarifying dialog. \r\n\t * @param {String} string\r\n\t */\r\n\t_dialog : function ( string ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Timeout allows any previous method to returnvalue first.\r\n\t\t */\r\n\t\tsetTimeout ( function () {\r\n\t\t\tDialog.error ( \"Source Invalid\", string );\r\n\t\t}, 0 );\r\n\t}\r\n};\r\n\r\nvar Validator = new _Validator ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/core/ViewDefinitions.js",
    "content": "/**\r\n * @type {HashMap<string><ViewDefinition>}\r\n */\r\nvar ViewDefinitions = {\r\n\r\n\t/*\r\n\t * The \"null\" definition is substituted for other definitions\r\n\t * when a view gets released from server control.\r\n\t */\r\n\t\"Composite.Management.Null\" : new HostedViewDefinition ({\r\n\t\tisMutable\t: true,\r\n\t\thandle \t\t: \"Composite.Management.Null\"\r\n\t}),\r\n\r\n\t/*\r\n\t * Postback dialog.\r\n\t */\r\n\t\"Composite.Management.PostBackDialog\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.PostBackDialog\",\r\n\t\tisMutable\t: true,\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl\t\t\t: \"${root}/content/dialogs/postback/postbackdialog.aspx\",\r\n\t\targument \t: {\r\n\t\t\t\"url\"\t: null,\r\n\t\t\t\"list\"\t: null\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Postback view. Load framework file using HTTP post (in addition to GET).\r\n\t * Use this to display framework stuff. Pages with a PageBinding, that is.\r\n\t */\r\n\t\"Composite.Management.PostBackView\" : new HostedViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.PostBackView\",\r\n\t\tisMutable\t: true,\r\n\t\tposition \t: DockBinding.MAIN,\r\n\t\turl\t\t\t: \"${root}/postback.aspx\",\r\n\t\targument \t: {\r\n\t\t\t\"url\"\t: null,\r\n\t\t\t\"list\"\t: null\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Generic views. Load PageBinding and inject any URL into a WindowBinding.\r\n\t * Use this to display non-framework stuff such as previews and thingies.\r\n\t */\r\n\t\"Composite.Management.GenericView\" : new HostedViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.GenericView\",\r\n\t\tisMutable\t: true,\r\n\t\tposition \t: DockBinding.MAIN,\r\n\t\turl \t\t: \"${root}/content/views/generic/generic.aspx\",\r\n\t\tlabel \t\t: null,\r\n\t\timage \t\t: null,\r\n\t\ttoolTip\t\t: null,\r\n\t\targument \t: {\r\n\t\t\t\"url\"\t: null,\r\n\t\t\t\"list\"\t: null\r\n\t\t}\r\n\t}),\r\n\r\n\t\"Composite.Management.ExternalView\" : new HostedViewDefinition ({\r\n\t\thandle\t\t: \"Composite.Management.ExternalView\",\r\n\t\tisMutable\t: true,\r\n\t\tposition\t: DockBinding.EXTERNAL,\r\n\t\turl\t\t\t: null,\r\n\t\tlabel\t\t: null,\r\n\t\timage\t\t: null,\r\n\t\ttoolTip\t\t: null\r\n\t}),\r\n\r\n\t\"Composite.Management.SlideView\": new HostedViewDefinition({\r\n\t\thandle: \"Composite.Management.SlideView\",\r\n\t\tisMutable: true,\r\n\t\tposition: DockBinding.SLIDE,\r\n\t\turl: null,\r\n\t\tlabel: null,\r\n\t\timage: null,\r\n\t\ttoolTip: null\r\n\t}),\r\n\r\n\t/*\r\n\t * Start.\r\n\t */\r\n\t\"Composite.Management.Start\" : new HostedViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.Start\",\r\n\t\tposition \t: DockBinding.START,\r\n\t\tlabel \t\t: \"Welcome Travellers\",\r\n\t\tisFloating\t: false,\r\n\t\turl \t\t: \"${root}/content/views/start/start.aspx\"\r\n\t}),\r\n\r\n\t/*\r\n\t * About.\r\n\t */\r\n\t\"Composite.Management.About\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.About\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: \"${root}/content/dialogs/about/about.aspx\"\r\n\t}),\r\n\r\n\t/*\r\n\t * Permission editor.\r\n\t */\r\n\t\"Composite.Management.PermissionEditor\" :  new HostedViewDefinition ({\r\n\t\tisMutable\t: true,\r\n\t\thandle \t\t: \"Composite.Management.PermissionEditor\",\r\n\t\tposition \t: DockBinding.MAIN,\r\n\t\turl \t\t: \"${root}/content/views/editors/permissioneditor/permissioneditor.aspx\",\r\n\t\targument \t: {\r\n\t\t\tserializedEntityToken : \"entityTokenType='Composite\\\\.Plugins\\\\.Elements\\\\.ElementProviders\\\\.VirtualElementProvider\\\\.VirtualElementProviderEntityToken,Composite'entityToken='_EntityToken_Type_=\\\\'Composite\\\\\\\\\\\\.Plugins\\\\\\\\\\\\.Elements\\\\\\\\\\\\.ElementProviders\\\\\\\\\\\\.VirtualElementProvider\\\\\\\\\\\\.VirtualElementProviderEntityToken,Composite\\\\'_EntityToken_Source_=\\\\'VirtualElementProvider\\\\'_EntityToken_Id_=\\\\'DesignPerspective\\\\''\\\"\"\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * System Log.\r\n\t */\r\n\t\"Composite.Management.SystemLog\" : new HostedViewDefinition ({\r\n\t\thandle\t\t: \"Composite.Management.SystemLog\",\r\n\t\tposition \t: DockBinding.ABSBOTTOMLEFT,\r\n\t\tlabel \t\t: \"System Log\",\r\n\t\turl \t\t: \"${root}/content/views/dev/systemlog/systemlog.aspx\"\r\n\t}),\r\n\r\n\t/*\r\n\t * Developer Panel.\r\n\t */\r\n\t\"Composite.Management.Developer\" : new HostedViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.Developer\",\r\n\t\tposition \t: DockBinding.ABSBOTTOMRIGHT,\r\n\t\tlabel \t\t: \"Developer\",\r\n\t\turl \t\t: \"${root}/content/views/dev/developer/developer.aspx\"\r\n\t}),\r\n\r\n\t/*\r\n\t * Icon Pack Sprite SVG.\r\n\t */\r\n\t\"Composite.Management.IconPack.SpriteSVG\": new HostedViewDefinition({\r\n\t\thandle: \"Composite.Management.IconPack.SpriteSVG\",\r\n\t\tposition: DockBinding.MAIN,\r\n\t\tlabel: \"Sprite SVG\",\r\n\t\timage: \"${icon:icon}\",\r\n\t\turl: \"${root}/console/?pageId=svg-sprites\"\r\n\t}),\r\n\r\n\t/*\r\n\t * Options dialog.\r\n\t */\r\n\t\"Composite.Management.Options\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.Options\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: \"${root}/content/dialogs/options/options.aspx\",\r\n\t\tlabel\t\t: \"Options\"\r\n\t}),\r\n\r\n\t/*\r\n\t * VisualEditor dialog.\r\n\t */\r\n\t\"Composite.Management.VisualEditorDialog\" : new DialogViewDefinition ({\r\n\t\tisMutable\t: true,\r\n\t\thandle \t\t: \"Composite.Management.VisualEditorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: \"${root}/content/dialogs/wysiwygeditor/wysiwygeditordialog.aspx\",\r\n\t\twidth\t\t: 1280, height : 800,\r\n\t\targument\t: {\r\n\t\t\t\"formattingconfiguration\"\t: null,\r\n\t\t\t\"embedablefieldstypenames\"\t: null\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * MultiSelector dialog.\r\n\t */\r\n\t\"Composite.Management.MultiSelectorDialog\" : new DialogViewDefinition ({\r\n\t\tisMutable\t: true,\r\n\t\thandle \t\t: \"Composite.Management.MultiSelectorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: \"${root}/content/dialogs/multiselector/multiselectordialog.aspx\"\r\n\t}),\r\n\r\n\t/*\r\n\t * Search view.\r\n\t */\r\n\t\"Composite.Management.Search\" : new HostedViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.Search\",\r\n\t\tposition\t: DockBinding.RIGHTBOTTOM,\r\n\t\turl\t\t\t: \"${root}/content/views/search/search.aspx\",\r\n\t\tlabel\t\t: \"Search\",\r\n\t\timage\t\t: \"${icon:view_search}\",\r\n\t\targument\t: null\r\n\t}),\r\n\r\n\t/*\r\n\t * Page Browser.\r\n\t */\r\n\t\"Composite.Management.Browser\" : new HostedViewDefinition ({\r\n\t\tisMutable\t: false,\r\n\t\tisPinned\t: true,\r\n\t\thandle \t\t: \"Composite.Management.Browser\",\r\n\t\tposition\t: DockBinding.MAIN,\r\n\t\tperspective\t: ExplorerBinding.PERSPECTIVE_CONTENT,\r\n\t\tlabel       : \"${string:Composite.Management:Browser.Label}\",\r\n\t\timage\t\t: \"${icon:page-view-administrated-scope}\",\r\n\t\ttoolTip     : \"${string:Composite.Management:Browser.ToolTip}\",\r\n\t\turl\t\t\t: \"${root}/content/views/browser/browser.aspx\",\r\n\t\targument\t: { \"URL\" : null }\r\n\t}),\r\n\r\n\t/*\r\n\t * SEO Assistant.\r\n\t */\r\n\t\"Composite.Management.SEOAssistant\" : new HostedViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.SEOAssistant\",\r\n\t\tposition: DockBinding.ABSBOTTOMRIGHT,\r\n\t\tperspective\t: ExplorerBinding.PERSPECTIVE_CONTENT,\r\n\t\turl\t\t\t: \"${root}/content/views/seoassist/seoassist.aspx\",\r\n\t\tlabel\t\t: \"${string:Composite.Web.SEOAssistant:SEOAssistant}\",\r\n\t\timage\t\t: \"${icon:seoassistant}\",\r\n\t\ttoolTip\t\t: \"${string:Composite.Web.SEOAssistant:SEOAssistant.ToolTip}\"\r\n\t}),\r\n\r\n\t/*\r\n\t * Source code viewer.\r\n\t */\r\n\t\"Composite.Management.SourceCodeViewer\" : new HostedViewDefinition ({\r\n\t\tisMutable\t: true,\r\n\t\thandle \t\t: \"Composite.Management.SourceCodeViewer\",\r\n\t\tposition\t:  DockBinding.ABSBOTTOMLEFT,\r\n\t\turl\t\t\t: \"${root}/content/views/dev/viewsource/viewsource.aspx\",\r\n\t\targument \t: {\r\n\t\t\t\"action\" : null, // {string}\r\n\t\t\t\"viewBinding\" : null // {ViewBinding}\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * User source code viewer.\r\n\t */\r\n\t\"Composite.User.SourceCodeViewer\" : new HostedViewDefinition ({\r\n\t\tisMutable\t: true,\r\n\t\thandle \t\t: \"Composite.User.SourceCodeViewer\",\r\n\t\tposition\t:  DockBinding.BOTTOMLEFT,\r\n\t\turl\t\t\t: \"${root}/content/views/dev/viewsource/viewsource.aspx\",\r\n\t\targument \t: {\r\n\t\t\t\"action\" : null, // {string}\r\n\t\t\t\"viewBinding\" : null // {ViewBinding}\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Help.\r\n\t */\r\n\t\"Composite.Management.Help\" : new HostedViewDefinition ({\r\n\t\tlabel\t\t: \"${string:Website.App.LabelHelp}\",\r\n\t\timage\t\t: \"${icon:help}\", // ${root}/images/icons/republic/republic_0534/0534_16px_Republic_32bit_PNG.png\r\n\t\thandle \t\t: \"Composite.Management.Help\",\r\n\t\tposition\t:  DockBinding.ABSRIGHTTOP,\r\n\t\turl\t\t\t: \"${root}/content/views/help/help.aspx\"\r\n\t}),\r\n\r\n\t/*\r\n\t * Translations.\r\n\t */\r\n\t\"Composite.Management.Dialog.Translations\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.TranslationsDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: \"${root}/content/dialogs/translations/translations.aspx\",\r\n\t\tlabel\t\t: \"Translations\",\r\n\t\timage\t\t: \"${icon:users-changepublicculture}\"\r\n\t}),\r\n\r\n\r\n\t// SELECTORS ......................................................................\r\n\r\n\t/*\r\n\t * Image selector.\r\n\t */\r\n    \"Composite.Management.ImageSelectorDialog\": new DialogViewDefinition({\r\n        isMutable   : true,\r\n\t\thandle \t\t: \"Composite.Management.ImageSelectorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: Dialog.URL_IMAGESELECTOR,\r\n\t\targument : {\r\n\t\t    label               : \"${string:Composite.Management:Website.Image.SelectDialog.Title}\",\r\n\t\t\timage\t\t\t\t: \"${icon:image}\",\r\n\t\t\tselectionProperty \t: \"ElementType\",\r\n\t\t\tselectionValue      : \"image/jpeg image/gif image/png image/bmp image/tiff image/svg+xml\",\r\n\t\t\tselectionResult\t\t: \"Uri\",\r\n\t\t\tnodes : [{\r\n\t\t\t\tkey : \"MediaFileElementProvider\",\r\n\t\t\t\tsearch : \"MediaFileElementProvider.WebImages\"\r\n\t\t\t}]\r\n\t\t}\r\n    }),\r\n\r\n\t/*\r\n\t* Writable Media Folder selector.\r\n\t*/\r\n\t\"Composite.Management.MediaWritableFolderSelectorDialog\": new DialogViewDefinition({\r\n\t\tisMutable: true,\r\n\t\thandle: \"Composite.Management.MediaWritableFolderSelectorDialog\",\r\n\t\tposition: Dialog.MODAL,\r\n\t\turl: Dialog.URL_TREEACTIONSELECTOR,\r\n\t\targument: {\r\n\t\t\tlabel: \"${string:Composite.Management:Website.Folder.SelectDialog.Title}\",\r\n\t\t\timage: \"${icon:image}\",\r\n\t\t\tselectionProperty: \"ReadOnly\",\r\n\t\t\tselectionValue: \"False\",\r\n\t\t\tselectionResult: \"EntityToken\",\r\n\t\t\tactionGroup: \"Folder\",\r\n\t\t\tnodes: [{\r\n\t\t\t\tkey: \"MediaFileElementProvider\",\r\n\t\t\t\tsearch: \"MediaFileElementProvider.WritableFolders\"\r\n\t\t\t}]\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Embeddable media selector.\r\n\t */\r\n\"Composite.Management.EmbeddableMediaSelectorDialog\": new DialogViewDefinition({\r\n        isMutable   : true,\r\n\t\thandle \t\t: \"Composite.Management.EmbeddableMediaSelectorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: Dialog.URL_TREEACTIONSELECTOR,\r\n\t\targument : {\r\n\t\t    label               : \"${string:Composite.Management:Website.Media.SelectDialog.Title}\",\r\n\t\t\timage\t\t\t\t: \"${icon:media}\",\r\n\t\t\tselectionProperty \t: \"ElementType\",\r\n\t\t\tselectionValue\t\t: null,\r\n\t\t\tselectionResult\t\t: \"Uri\",\r\n\t\t\tnodes : [{\r\n\t\t\t\tkey : \"MediaFileElementProvider\",\r\n\t\t\t\tsearch : null //\"MediaFileElementProvider.EmbeddableMedia\" - kaput!\r\n\t\t\t}]\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Frontend file selector.\r\n\t */\r\n\t\"Composite.Management.FrontendFileSelectorDialog\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.EmbeddableMediaSelectorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl\t\t\t: Dialog.URL_TREEACTIONSELECTOR,\r\n\t\targument : {\r\n\t\t    label               : \"${string:Composite.Management:Website.FrontendFile.SelectDialog.Title}\",\r\n\t\t\timage\t\t\t\t: \"${icon:media}\",\r\n\t\t\tselectionProperty \t: \"ElementType\",\r\n\t\t\tselectionValue\t\t: null,\r\n\t\t\tselectionResult\t\t: \"Uri\",\r\n\t\t\tnodes : [{\r\n\t\t\t\tkey : \"LayoutFileElementProvider\"\r\n\t\t\t}]\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Page URL selector.\r\n\t */\r\n\t\"Composite.Management.PageSelectorDialog\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.PageSelectorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: Dialog.URL_TREESELECTOR,\r\n\t\targument : {\r\n\t\t    label               : \"${string:Composite.Management:Website.Page.SelectDialog.Title}\",\r\n\t\t    image               : \"${icon:page}\",\r\n\t\t\tselectionProperty \t: \"Uri\",\r\n\t\t\tselectionValue\t\t: null, // MimeTypes.COMPOSITEPAGES\r\n\t\t\tselectionResult\t\t: \"Uri\",\r\n\t\t\thasPreview: true,\r\n\t\t\tnodes : [{\r\n\t\t\t\tkey : \"PageElementProvider\"\r\n\t\t\t}]\r\n\t\t}\r\n\t}),\r\n\r\n    /*\r\n    * Page Id selector.\r\n    */\r\n    \"Composite.Management.PageIdSelectorDialog\": new DialogViewDefinition({\r\n        handle: \"Composite.Management.PageIdSelectorDialog\",\r\n        isMutable: true,\r\n        position: Dialog.MODAL,\r\n        url: Dialog.URL_TREESELECTOR,\r\n        argument: {\r\n            label               : \"${string:Composite.Management:Website.Page.SelectDialog.Title}\",\r\n            image               : \"${icon:page}\",\r\n            selectionProperty   : \"DataId\",\r\n            selectionValue      : null, // MimeTypes.COMPOSITEPAGES\r\n            selectionResult     : \"DataId\",\r\n            nodes: [{\r\n                key: \"PageElementProvider\"\r\n            }]\r\n        }\r\n    }),\r\n\r\n\t/*\r\n\t * Linkable element selector (selecting pages and media files).\r\n\t */\r\n\t\"Composite.Management.LinkableSelectorDialog\" : new DialogViewDefinition ({\r\n\t    handle: \"Composite.Management.LinkableSelectorDialog\",\r\n\t    isMutable   : true,\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl\t\t\t: Dialog.URL_TREEACTIONSELECTOR,\r\n\t\targument : {\r\n\t\t    label               : \"${string:Composite.Management:Website.ContentLink.SelectDialog.Title}\",\r\n\t\t    image               : \"${icon:link}\",\r\n\t\t\tselectionProperty \t: \"Uri\",\r\n\t\t\tselectionValue\t\t: null,\r\n\t\t\tselectionResult\t\t: \"Uri\",\r\n\t\t\thasPreview\t\t\t: true,\r\n\t\t\tnodes : [\r\n\t\t\t\t{ key : \"PageElementProvider\" },\r\n\t\t\t\t{ key : \"MediaFileElementProvider\" }\r\n\t\t\t]\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Media selector (images and other stuff).\r\n\t */\r\n\t\"Composite.Management.MediaSelectorDialog\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.MediaSelectorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: Dialog.URL_TREESELECTOR,\r\n\t\targument : {\r\n\t\t    label               : \"${string:Composite.Management:Website.ContentLink.SelectDialog.Title}\",\r\n\t\t\timage\t\t\t\t: \"${icon:link}\",\r\n\t\t\tselectionProperty \t: \"Uri\",\r\n\t\t\tselectionValue\t\t: null,\r\n\t\t\tselectionResult\t\t: \"Uri\",\r\n\t\t\tnodes : [\r\n\t\t\t\t{ key : \"MediaFileElementProvider\" }\r\n\t\t\t]\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Stub for tree selector.\r\n\t */\r\n\t\"Composite.Management.TreeSelectorDialog\": new DialogViewDefinition({\r\n\t\thandle: \"Composite.Management.TreeSelectorDialog\",\r\n\t\tisMutable\t: true,\r\n\t\tposition: Dialog.MODAL,\r\n\t\turl: Dialog.URL_TREESELECTOR,\r\n\t\targument: {\r\n\t\t\tlabel: \"\",\r\n\t\t\timage: \"${icon:link}\",\r\n\t\t\tselectionProperty: \"ElementType\",\r\n\t\t\tselectionValue: null,\r\n\t\t\tselectionResult: null,\r\n\t\t\tnodes: [\r\n\t\t\t\t{ key: null }\r\n\t\t\t]\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Function selector (ALL TYPES).\r\n\t */\r\n\t\"Composite.Management.FunctionSelectorDialog\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.FunctionSelectorDialog\",\r\n\t\tisMutable\t: true,\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: Dialog.URL_TREESELECTOR,\r\n\t\targument : {\r\n\t\t    label               : \"${string:Composite.Management:Website.Function.SelectDialog.Title}\",\r\n\t\t\timage\t\t\t\t: \"${icon:functioncall}\",\r\n\t\t\tselectionProperty \t: \"ElementType\",\r\n\t\t\tselectionValue\t\t: MimeTypes.COMPOSITEFUNCTION,\r\n\t\t\tselectionResult\t\t: \"ElementId\",\r\n\t\t\tnodes : [{\r\n\t\t\t\tkey : \"AllFunctionsElementProvider\"\r\n\t\t\t}]\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Function selector (widget functions).\r\n\t */\r\n\t\"Composite.Management.WidgetFunctionSelectorDialog\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.WidgetFunctionSelectorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: Dialog.URL_TREESELECTOR,\r\n\t\targument : {\r\n\t\t    label               : \"${string:Composite.Management:Website.Widget.SelectDialog.Title}\",\r\n\t\t    image               : \"${icon:functioncall}\",\r\n\t\t\tselectionProperty \t: \"ElementType\",\r\n\t\t\tselectionValue\t\t: MimeTypes.COMPOSITEFUNCTION,\r\n\t\t\tselectionResult\t\t: \"ElementId\",\r\n\t\t\tnodes : [{\r\n\t\t\t\tkey : \"AllWidgetFunctionsElementProvider\"\r\n\t\t\t}]\r\n\t\t}\r\n\t}),\r\n\r\n\t/*\r\n\t * Function selector (XHTML types).\r\n\t */\r\n\t\"Composite.Management.XhtmlDocumentFunctionSelectorDialog\" : new DialogViewDefinition ({\r\n\t\thandle \t\t: \"Composite.Management.XhtmlDocumentFunctionSelectorDialog\",\r\n\t\tposition \t: Dialog.MODAL,\r\n\t\turl \t\t: Dialog.URL_TREESELECTOR,\r\n\t\targument : {\r\n\t\t\tlabel \t\t\t\t: \"${string:Composite.Management:Website.Function.SelectDialog.Title}\",\r\n\t\t\timage\t\t\t\t: \"${icon:functioncall}\",\r\n\t\t\tselectionProperty \t: \"ElementType\",\r\n\t\t\tselectionValue\t\t: MimeTypes.COMPOSITEFUNCTION,\r\n\t\t\tselectionResult\t\t: \"ElementId\",\r\n\t\t\tnodes : [{\r\n\t\t\t\tkey : \"AllFunctionsElementProvider\",\r\n\t\t\t\tsearch : \"AllFunctionsElementProvider.VisualEditorFunctions\"\r\n\t\t\t}]\r\n\t\t}\r\n\t})\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/css/CSSComputer.js",
    "content": "/**\r\n * @class \r\n * This class functions primarily as an assistant for {@link FlexBoxBinding}.\r\n */\r\nfunction _CSSComputer () {}\r\n\r\n_CSSComputer.prototype = {\r\n\t\r\n\t_margins : {\r\n\t\ttop\t\t: Client.isExplorer ? \"marginTop\" : \"margin-top\",\r\n\t\tright\t: Client.isExplorer ? \"marginRight\" : \"margin-right\",\r\n\t\tbottom\t: Client.isExplorer ? \"marginBottom\" : \"margin-bottom\",\r\n\t\tleft\t: Client.isExplorer ? \"marginLeft\" : \"margin-left\"\r\n\t},\r\n\t\r\n\t_paddings : {\r\n\t\ttop\t\t: Client.isExplorer ? \"paddingTop\" : \"padding-top\",\r\n\t\tright\t: Client.isExplorer ? \"paddingRight\" : \"padding-right\",\r\n\t\tbottom\t: Client.isExplorer ? \"paddingBottom\" : \"padding-bottom\",\r\n\t\tleft\t: Client.isExplorer ? \"paddingLeft\" : \"padding-left\"\r\n\t},\r\n\t\r\n\t_borders : {\r\n\t\ttop\t\t: Client.isExplorer ? \"borderTopWidth\" : \"border-top-width\",\r\n\t\tright\t: Client.isExplorer ? \"borderRightWidth\" : \"border-right-width\",\r\n\t\tbottom\t: Client.isExplorer ? \"borderBottomWidth\" : \"border-bottom-width\",\r\n\t\tleft\t: Client.isExplorer ? \"borderLeftWidth\" : \"border-left-width\"\r\n\t},\r\n\t\r\n\t/** \r\n\t * @param {object} comples\r\n\t * @param {DOMElement} element\r\n\t * @return {object}\r\n\t */\r\n\t_getComplexResult : function ( complex, element ) {\r\n\t\r\n\t\tvar result = {};\r\n\t\tfor ( var entry in complex ) {\r\n\t\t\tvar ent = parseInt ( \r\n\t\t\t\tDOMUtil.getComputedStyle ( element, complex [ entry ])\r\n\t\t\t);\r\n\t\t\tresult [ entry ] = isNaN ( ent ) ? 0 : ent;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\t\r\n\t/**\r\n\t * This should only be expected to work well for \"px\" units.\r\n\t * Returns an object with four properties: top, right, bottom, left.\r\n\t * @param {DOMElement} element\r\n\t * @return {object}\r\n\t */\r\n\tgetMargin : function ( element ) {\r\n\t\treturn this._getComplexResult ( this._margins, element );\r\n\t},\r\n\t\r\n\t/**\r\n\t * This should only be expected to work well for \"px\" units.\r\n\t * Returns an object with four properties: top, right, bottom, left.\r\n\t * @param {DOMElement} element\r\n\t * @return {object}\r\n\t */\r\n\tgetPadding : function ( element ) {\r\n\t\treturn this._getComplexResult ( this._paddings, element );\r\n\t},\r\n\t\r\n\t/**\r\n\t * This should only be expected to work well for \"px\" units.\r\n\t * Returns an object with four properties: top, right, bottom, left.\r\n\t * @param {DOMElement} element\r\n\t * @return {object}\r\n\t */\r\n\tgetBorder : function ( element ) {\r\n\t\treturn this._getComplexResult ( this._borders, element );\r\n\t},\r\n\t\r\n\t/**\r\n\t * TODO: Rename this.\r\n\t * @param {DOMElement} element\r\n\t * @return {string}\r\n\t */\r\n\tgetPosition : function ( element ) {\r\n\t\treturn DOMUtil.getComputedStyle ( element, \"position\" );\r\n\t},\r\n\t\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @return {string}\r\n\t */\r\n\tgetFloat : function ( element ) {\r\n\t\treturn DOMUtil.getComputedStyle ( element, Client.isExplorer ? \"styleFloat\" : \"float\" );\r\n\t},\r\n\t\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @return {int}\r\n\t */\r\n\tgetZIndex : function ( element ) {\r\n\t\treturn parseInt (\r\n\t\t\tDOMUtil.getComputedStyle ( element, Client.isExplorer ? \"zIndex\" : \"z-index\" )\r\n\t\t);\r\n\t},\r\n\t\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @return {string}\r\n\t */\r\n\tgetBackgroundColor : function ( element ) {\r\n\t\treturn DOMUtil.getComputedStyle ( element, Client.isExplorer ? \"backgroundColor\" : \"background-color\" );\r\n\t},\r\n\r\n\t/**\r\n * @param {DOMElement} element\r\n * @return {string}\r\n */\r\n\tgetWidth : function(element) {\r\n\t\treturn DOMUtil.getComputedStyle(element, \"width\");\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_CSSComputer}\r\n */\r\nvar CSSComputer = new _CSSComputer ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/css/CSSUtil.js",
    "content": "/**\r\n * Handy interface for messing what an elements classname. \r\n */ \r\nfunction _CSSUtil () {}\r\n\r\n_CSSUtil.prototype = {\r\n\t\r\n\t/**\r\n\t * Get the current CSS classname of a DOM element.\r\n\t * @param {DOMElement} element\r\n\t * @return {string}\r\n\t */\r\n\t_getCurrent : function ( element ) {\r\n\t\tvar current = element.style ? element.className : element.getAttribute ( \"class\" );\r\n\t\tcurrent = current ? current : \"\";\r\n\t\treturn current;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Check for occurance of substring.\r\n\t * @param {string} current\r\n\t * @param {string} sub\r\n\t * @return boolean\r\n\t */\r\n\t_contains : function ( current, sub ) {\r\n\t\treturn current.indexOf ( sub ) >-1;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Cumulative builder for whitespace-separated strings\r\n\t * @param {string} current\r\n\t * @param {string} sub\r\n\t * @return {string}\r\n\t */\r\n\t_attach : function ( current, sub ) {\r\n\t\treturn current + ( current == \"\" ? \"\" : \" \" ) + sub;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Cumulative destroyer of whitespace-separated strings. \r\n\t * @param {string} current\r\n\t * @param {string} sub\r\n\t * @return {string}\r\n\t */\r\n\t_detach : function ( current, sub ) {\r\n\t\tif ( this._contains ( current, \" \" + sub )) {\r\n\t\t\tsub = \" \" + sub;\r\n\t\t}\r\n\t\treturn current.replace ( sub, \"\" );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Attach CSS classname to a DOM element.\r\n\t * @param {DOMElement} element\r\n\t * @param {string} classname\r\n\t */\r\n\tattachClassName : function ( element, classname ) {\r\n\t\r\n\t\tif ( element.classList != null ) {\r\n\t\t\tif ( !element.classList.contains ( classname )) {\r\n\t\t\t\telement.classList.add ( classname );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar current = this._getCurrent ( element );\r\n\t\t\tif ( !this._contains ( current, classname )) {\r\n\t\t\t\tcurrent = this._attach ( current, classname );\r\n\t\t\t}\r\n\t\t\tif ( element.style != null ) {\r\n\t\t\t\telement.className = current;\r\n\t\t\t} else {\r\n\t\t\t\telement.setAttribute ( \"class\", current );\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Detach CSS classname from a DOM element.\r\n\t * @param {DOMElement} element\r\n\t * @param {string} classname\r\n\t */\r\n\tdetachClassName : function ( element, classname ) {\r\n\t\t\r\n\t\tif ( element.classList != null ) {\r\n\t\t\tif ( element.classList.contains ( classname )) {\r\n\t\t\t\telement.classList.remove ( classname );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar current = this._getCurrent ( element );\r\n\t\t\tif ( this._contains ( current, classname )) {\r\n\t\t\t\tcurrent = this._detach ( current, classname );\r\n\t\t\t}\r\n\t\t\tif ( element.style != null ) {\r\n\t\t\t\telement.className = current;\r\n\t\t\t} else {\r\n\t\t\t\tif ( current == \"\" ) {\r\n\t\t\t\t\telement.removeAttribute ( \"class\" );\r\n\t\t\t\t} else {\r\n\t\t\t\t\telement.setAttribute ( \"class\", current );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @param {string} classname\r\n\t */\r\n\thasClassName : function ( element, classname ) {\r\n\t\t\r\n\t\tvar result = false;\r\n\t\tif ( element.classList != null ) {\r\n\t\t\tresult = element.classList.contains ( classname );\r\n\t\t} else {\r\n\t\t\tresult = this._contains ( this._getCurrent ( element ), classname );\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_CSSUtil}\r\n */\r\nvar CSSUtil = new _CSSUtil ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/dev/SystemDebug.js",
    "content": "/**\r\n * @class\r\n * Debug that system.\r\n */\r\nfunction _SystemDebug () {}\r\n\r\n_SystemDebug.prototype = {\r\n\t\r\n\t_logger : SystemLogger.getLogger ( \"SystemDebug\" ),\r\n\t_stacklength : parseInt ( 5 ),\r\n\r\n\t/**\r\n\t * Print sort of a strack trace.\r\n\t * @param {object} args\r\n\t * @param @optional {int} length\r\n\t * @return\r\n\t */\r\n\tstack : function ( args, length ) {\r\n\t\t\r\n\t\tthis._stackMozilla ( args, length );\r\n\t\t/*\r\n\t\tif ( Client.isMozilla == true ) {\r\n\t\t\tthis._stackMozilla ( args, length );\r\n\t\t} else {\r\n\t\t\tthis._logger.debug ( \"TODO!\" );\r\n\t\t}\r\n\t\t*/\r\n\t},\r\n\r\n\t/**\r\n\t * Stack Mozilla.\r\n\t * @param {object} args\r\n\t * @param @optional {int} length\r\n\t */\r\n\t_stackMozilla : function ( args, length ) {\r\n\t\t\r\n\t\tlength = length ? length : this._stacklength;\r\n\t\tif ( Client.isMozilla && args.callee || args.caller ) {\r\n\t\t\tvar caller = Client.isMozilla ? args.callee.caller : args.caller.callee;\r\n\t\t\tvar stack = \"\";\r\n\t\t\t\r\n\t\t\tvar i = 0;\r\n\t\t\twhile ( caller != null && i++ < length ) {\r\n\t\t\t\tstack += \"\\n#\" + i + \"\\n\";\r\n\t\t\t\tstack += caller.toString ();\r\n\t\t\t\tcaller = caller.caller;\r\n\t\t\t\tstack += \"\\n\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis._logger.error ( stack );\r\n\t\t} else {\r\n\t\t\tthis._logger.error ( \"(Error stack unreachable!)\" );\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n/*\r\n * The instance that does it.\r\n * @type {_SystemDebug}\r\n */\r\nvar SystemDebug = new _SystemDebug;\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/dev/SystemLogger.js",
    "content": "SystemLogger.TAB_SEQUENCE = \"&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\";\r\n\r\nSystemLogger.LEVEL_INFO\t\t= \"info\";\r\nSystemLogger.LEVEL_DEBUG\t= \"debug\";\r\nSystemLogger.LEVEL_ERROR\t= \"error\";\r\nSystemLogger.LEVEL_WARN\t\t= \"warn\";\r\nSystemLogger.LEVEL_FATAL\t= \"fatal\";\r\nSystemLogger.LEVEL_FINE\t\t= \"fine\";\r\n\r\n/**\r\n * @type {boolean}\r\n */\r\nSystemLogger.isFlushing = false;\r\n\r\n/**\r\n * @class\r\n * Don't use constructor! Please use syntax SystemLogger.getLogger ( \"string\" )\r\n * @param {string} indentifier\r\n */\r\nfunction SystemLogger ( identifier ) {\r\n\t\r\n\t/**\r\n\t * @private\r\n\t * @type {string}\r\n\t */\r\n\tthis.identifier = identifier;\r\n}\r\n\r\n/**\r\n * Info.\r\n */\r\nSystemLogger.prototype.info = function ( message ) {\r\n\tSystemLogger.log ( this.identifier, SystemLogger.LEVEL_INFO, message );\r\n}\r\n\r\n/**\r\n * Debug.\r\n */\r\nSystemLogger.prototype.debug = function ( message ) {\r\n\t\r\n\tif ( message == \"page\" ) {\r\n\t\talert ( arguments.caller.callee );\r\n\t}\r\n\t\r\n\tSystemLogger.log ( this.identifier, SystemLogger.LEVEL_DEBUG, message );\r\n}\r\n\r\n/**\r\n * Error.\r\n */\r\nSystemLogger.prototype.error = function ( message ) {\r\n\tSystemLogger.log ( this.identifier, SystemLogger.LEVEL_ERROR, message );\r\n}\r\n\r\n/**\r\n * Message.\r\n */\r\nSystemLogger.prototype.warn = function ( message ) {\r\n\tSystemLogger.log ( this.identifier, SystemLogger.LEVEL_WARN, message );\r\n}\r\n\r\n/**\r\n * Fatal.\r\n */\r\nSystemLogger.prototype.fatal = function ( message ) {\r\n\tSystemLogger.log ( this.identifier, SystemLogger.LEVEL_FATAL, message );\r\n}\r\n\r\n/**\r\n * Fine.\r\n */\r\nSystemLogger.prototype.fine = function ( message ) {\r\n\tSystemLogger.log ( this.identifier, SystemLogger.LEVEL_FINE, message );\r\n}\r\n\r\n\r\n\r\n// STATIC PROPERTIES AND METHODS ....................................\r\n\r\n/*\r\n * @type {HashMap<string><SystemLogger>}\r\n */\r\nSystemLogger.loggers = {};\r\n\r\n/**\r\n * TODO: datatype this!\r\n * @type {List}\r\n */\r\nSystemLogger.buffer = new List ();\r\n\r\n/**\r\n * Collect logs in buffer only.\r\n * Invoked by {@link Application}\r\n */\r\nSystemLogger.suspend = function () {\r\n\t\r\n\tSystemLogger.outputWindow\t= null;\r\n\tSystemLogger.outputDocument = null;\r\n\tSystemLogger.outputElement \t= null;\r\n\t\r\n\tSystemLogger.log = SystemLogger.bufferLog;\r\n}\r\n\r\n/**\r\n * Flush buffer to screen.\r\n * Invoked by {@link Application}\r\n * @param {DOMDocumentView} win\r\n */\r\nSystemLogger.unsuspend = function ( win ) {\r\n\t\r\n\tSystemLogger.outputWindow\t= win;\r\n\tSystemLogger.outputDocument = win.document;\r\n\tSystemLogger.outputElement \t= win.document.body;\r\n\t\r\n\tSystemLogger.log = SystemLogger.outputLog;\r\n\tSystemLogger.flushBuffer ();\r\n}\r\n\r\n/**\r\n * @param {string} indentifier\r\n */\r\nSystemLogger.getLogger = function ( identifier ) {\r\n\r\n\tvar logger = SystemLogger.loggers [ identifier ];\r\n\tif ( !logger ) {\r\n\t\tlogger = new SystemLogger ( identifier );\r\n\t\tSystemLogger.loggers [ identifier ] = logger;\r\n\t}\r\n\treturn logger;\r\n}\r\n\r\n/**\r\n * During starup, all logs are collected in a buffer. The buffer \r\n * can be flushed to screen by calling this method.\r\n */\r\nSystemLogger.flushBuffer = function () {\r\n\t\r\n\tSystemLogger.buffer.reset ();\r\n\tSystemLogger.isFlushing = true;\r\n\t\r\n\tif ( SystemLogger.buffer.hasEntries ()) {\r\n\t\twhile ( SystemLogger.buffer.hasNext ()) {\r\n\t\t\tvar entry = SystemLogger.buffer.getNext ();\r\n\t\t\tthis.log ( \r\n\t\t\t\tentry.identifier,\r\n\t\t\t\tentry.level,\r\n\t\t\t\tentry.message\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tSystemLogger.isFlushing = false;\r\n}\r\n\r\n/**\r\n * Simply collect logs in a buffer.\r\n * @param {string} identifier\r\n * @param {string} level\r\n * @param {string} message\r\n */\r\nSystemLogger.bufferLog = function (identifier, level, message) {\r\n\r\n\tif (Application.isDeveloperMode) {\r\n\t\tmessage = String(message);\r\n\r\n\t\tSystemLogger.buffer.add({\r\n\t\t\tidentifier: identifier,\r\n\t\t\tlevel: level,\r\n\t\t\tmessage: message\r\n\t\t});\r\n\t}\r\n}\r\n\r\n/**\r\n * Display logs on screen (while still collecting them in a buffer).\r\n * @param {string} level\r\n * @param {string} message\r\n */\r\nSystemLogger.outputLog = function ( identifier, level, message ) {\r\n\r\n\tmessage = String ( message );\r\n\t \r\n\tif ( !SystemLogger.isFlushing ) {\r\n\t\tSystemLogger.bufferLog ( \r\n\t\t\tidentifier, \r\n\t\t\tlevel, \r\n\t\t\tmessage \r\n\t\t);\r\n\t}\r\n\t\r\n\tvar win\t\t= SystemLogger.outputWindow;\r\n\tvar doc\t\t= SystemLogger.outputDocument;\r\n\tvar elm\t\t= SystemLogger.outputElement;\r\n\tvar div \t= doc.createElement ( \"div\" );\r\n\tvar span \t= doc.createElement ( \"span\" );\r\n\tvar pre \t= doc.createElement ( \"pre\" );\r\n\t\r\n\t/*\r\n\t * Only mozilla seems to grok the intention \r\n\t * of tabs and newlines in PRE elements....\r\n\t */\r\n\tif ( Client.isExplorer ) {\r\n\t\tmessage = message.replace ( /</g, \"&lt;\" );\r\n\t\tmessage = message.replace ( />/g, \"&gt;\" );\r\n\t\tmessage = message.replace ( /\\n/g, \"<br/>\" );\r\n\t\tmessage = message.replace ( /\\t/g, SystemLogger.TAB_SEQUENCE );\r\n\t\tpre.innerHTML = message;\r\n\t} else {\r\n\t\tpre.textContent = message;\r\n\t}\r\n\t\r\n\tdiv.className = level;\r\n\tspan.innerHTML = identifier;\r\n\tdiv.appendChild ( span );\r\n\tdiv.appendChild ( pre );\r\n\t//if ( level == SystemLogger.LEVEL_FATAL ) { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n\t\telm.insertBefore ( div, elm.firstChild );\r\n\t//}\r\n\t\r\n\twin.scrollTo ( 0, 0 );\r\n}\r\n\r\n/** \r\n * By default, collecting logs in buffer.\r\n * @param {string} level\r\n * @param {string} message\r\n */\r\nSystemLogger.log = SystemLogger.bufferLog;\r\n\r\n/**\r\n * Clear all log entries.\r\n */\r\nSystemLogger.clear = function () {\r\n\t\r\n\tSystemLogger.buffer = new List ();\r\n\tvar doc = SystemLogger.outputDocument;\r\n\tif ( doc ) {\r\n\t\tdoc.body.innerHTML = \"\";\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/dev/SystemPerformance.DEPRECATED.js",
    "content": "/**\r\n * @class\r\n */\r\nwindow.SystemPerformance = new function () {\r\n\t\r\n\t/*\r\n\t * Markers. Simply because we want them isolated here.\r\n\t */\r\n\tthis.PHASE_LOAD \t\t\t\t= \"Load\";\r\n\tthis.PHASE_REGISTER \t\t\t= \"Register\";\r\n\tthis.PHASE_ATTACH \t\t\t\t= \"Attach\";\r\n\tthis.PHASE_FLEX \t\t\t\t= \"Flex\";\r\n\tthis.PHASE_DIALOG \t\t\t\t= \"Layout (dialog)\";\r\n\tthis.PHASE_TREEFINDNODES \t\t= \"Analyze tree\";\r\n\tthis.PHASE_TREEGETSYSTEMNODES \t= \"Fetch SystemNodes\";\r\n\tthis.PHASE_TREEBUILDNODES \t\t= \"Build treenodes\";\r\n\tthis.PHASE_TREESERVICE \t\t\t= \"(Contacting TreeService)\";\r\n\tthis.PHASE_MICROSOFTREQUEST\t\t= \"Ready for FIRST updatepanel refresh (only measuring the first)\";\r\n\tthis.PHASE_UPDATEPANEL\t\t\t= \"Updatepanel\";\r\n\tthis.PHASE_MANIFEST\t\t\t\t= \"DataBinding manifest\";\r\n\t\r\n\t/*\r\n\t * Privates\r\n\t */\r\n\tvar logger = SystemLogger.getLogger ( \"SystemPerformance\" );\r\n\tvar timer = SystemTimer.getTimer ( \"SystemPerformance\" );\r\n\tvar isEnabled = true;\r\n\tvar markers = new Map ();\r\n\tvar labels = new Map ();\r\n\tvar systemactionlabel = null;\r\n\tvar isTracking = false;\r\n\t\r\n\t/*\r\n\t * Publics\r\n\t */\r\n\tthis.isEnabled = false;\r\n\t\t\r\n\t/**\r\n\t * Note that the entire setup only gets enabled in developermode.\r\n\t * @implements {IBroadcastListener}\r\n\t * @param {string} broadcast\r\n\t * @param {object} arg\r\n\t */\r\n\tthis.handleBroadcast = function ( broadcast, arg ) {\r\n\t\t\r\n\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\ttry {\r\n\t\t\t\tthis._handleBroadcast ( broadcast, arg );\r\n\t\t\t} catch ( exception ) {\r\n\t\t\t\talert ( exception );\r\n\t\t\t\talert ( exception.stack );\r\n\t\t\t\tthrow ( exception );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * @param {string} broadcast\r\n\t * @param {object} arg\r\n\t */\r\n\tthis._handleBroadcast = function ( broadcast, arg ) {\r\n\t\t\r\n\t\tswitch ( broadcast ) {\r\n\t\t\t\t\r\n\t\t\t/*\r\n\t\t\t * App startup time.\r\n\t\t\t */\r\n\t\t\tcase BroadcastMessages.APPLICATION_OPERATIONAL :\r\n\t\t\t\tif ( isEnabled ) {\r\n\t\t\t\t\tthis.isEnabled = true;\r\n\t\t\t\t\ttimer.report ( \"Application operational\" );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.VIEW_OPENING, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.VIEW_COMPLETED, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMACTION_INVOKE, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMACTION_INVOKED, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.UPDATEPANELS_UPDATED, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.POSTBACK_START, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.POSTBACK_STOP, this );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Reset timer on these events.\r\n\t\t\t */\r\n\t\t\tcase BroadcastMessages.SYSTEMACTION_INVOKE :\r\n\t\t\tcase BroadcastMessages.VIEW_OPENING :\r\n\t\t\tcase BroadcastMessages.POSTBACK_START :\r\n\t\t\t\treset ();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase BroadcastMessages.UPDATEPANELS_UPDATED :\r\n\t\t\t\tif ( isTracking ) {\r\n\t\t\t\t\ttimer.report ( \"Ajax update completed\" + getMarkers ());\r\n\t\t\t\t\tfinish ();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\tcase BroadcastMessages.POSTBACK_STOP :\r\n\t\t\t\tif ( isTracking ) {\r\n\t\t\t\t\ttimer.report ( \"Postback completed\" + getMarkers ());\r\n\t\t\t\t\tfinish ();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t*/\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Backend view completed.\r\n\t\t\t * @see {DockBinding#_setupPageBindingListeners}\r\n\t\t\t */\r\n\t\t\tcase BroadcastMessages.VIEW_COMPLETED :\r\n\t\t\t\tif ( isTracking ) {\r\n\t\t\t\t\tvar label = getLabelForHandle ( arg );\r\n\t\t\t\t\ttimer.report ( \"Completed \\\"\" + label + \"\\\"\" + getMarkers ());\r\n\t\t\t\t\tfinish ();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * New action response.\r\n\t\t\t */\r\n\t\t\tcase BroadcastMessages.SYSTEMACTION_INVOKED :\r\n\t\t\t\tif ( isTracking ) {\r\n\t\t\t\t\ttimer.report ( \"SystemAction \\\"\" + arg + \"\\\" invoked on server\" );\r\n\t\t\t\t\tfinish ();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Tree refreshing.\r\n\t\t\t */\r\n\t\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESHING :\r\n\t\t\t\tEventBroadcaster.unsubscribe ( BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this );\r\n\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMTREEBINDING_REFRESHED, this );\r\n\t\t\t\treset ();\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Tree refreshed.\r\n\t\t\t */\t\r\n\t\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESHED :\r\n\t\t\t\tif ( isTracking ) {\r\n\t\t\t\t\tEventBroadcaster.unsubscribe ( BroadcastMessages.SYSTEMTREEBINDING_REFRESHED, this );\r\n\t\t\t\t\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this );\r\n\t\t\t\t\ttimer.report ( \"Tree refreshed\" + getMarkers ());\r\n\t\t\t\t\tfinish ();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Mark time.\r\n\t * @param {string} marker\r\n\t * @param {SystemTimer} timer\r\n\t */\r\n\tthis.mark = function ( marker, markertimer ) {\r\n\t\t\r\n\t\tif ( this.isEnabled ) {\r\n\t\t\tif ( !markers.has ( marker )) {\r\n\t\t\t\tvar time = markertimer ? markertimer.getTime () : timer.getTime ();\r\n\t\t\t\tmarkers.set ( marker, String ( time ));\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Reset timer and markers (not during startup).\r\n\t */\r\n\tfunction reset () {\r\n\t\t\r\n\t\tif ( SystemPerformance.isEnabled ) {\r\n\t\t\ttimer.reset ();\r\n\t\t\tmarkers = new Map ();\r\n\t\t\tisTracking = true;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Finish.\r\n\t */\r\n\tfunction finish () {\r\n\t\r\n\t\tisTracking = false;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Get markers.\r\n\t */\r\n\tfunction getMarkers () {\r\n\t\t\r\n\t\tvar result = \"\";\r\n\t\tmarkers.each ( function ( marker, time ) {\r\n\t\t\ttime = String ( time );\r\n\t\t\tswitch ( time.length ) {\r\n\t\t\t\tcase 1 :\r\n\t\t\t\t\ttime = \"000\" + time;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2 :\r\n\t\t\t\t\ttime = \"00\" + time;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3 :\r\n\t\t\t\t\ttime = \"0\" + time;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tresult += \"\\n\\t\\t\" + time + \": \" + marker;\r\n\t\t});\r\n\t\treturn result\r\n\t}\r\n\t\r\n\t/**\r\n\t * Them backend definitions don't always have labels. \r\n\t * This will attempt to fetch a human readable label.\r\n\t * @param {string} handle\r\n\t * @return {string}\r\n\t */\r\n\tfunction getLabelForHandle ( handle ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tif ( labels.has ( handle )) {\r\n\t\t\tresult = labels.get ( handle );\r\n\t\t} else {\r\n\t\t\tvar view = ViewBinding.getInstance ( handle );\r\n\t\t\tvar def = view.getDefinition ();\r\n\t\t\tif ( def.label ) {\r\n\t\t\t\tresult = def.label;\r\n\t\t\t} else {\r\n\t\t\t\tvar page = view.getContentWindow ().bindingMap.formcontrolpage;\r\n\t\t\t\tif ( page ) {\r\n\t\t\t\t\tresult = page.label;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( result ) {\r\n\t\t\t\tlabels.set ( handle, result );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\t\r\n\t/**\r\n\t * Start reporting on \r\n\t * application start.\r\n\t */\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.APPLICATION_OPERATIONAL, this );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/dev/SystemTimer.js",
    "content": "/**\r\n * Factory method in order to emulate SystemLogger syntax.\r\n * @param {object} object\r\n */\r\nSystemTimer.getTimer = function ( object ) {\r\n\t\r\n\treturn new SystemTimer ( object.toString ());\r\n}\r\n\r\n/**\r\n * @class\r\n * Simple stopwatch utility. Note that timing in \r\n * Javascript should never be considered 100% reliable.\r\n */\r\nfunction SystemTimer ( id ) {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SystemTimer\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._id = id;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._time = new Date ().getTime ();\r\n}\r\n\r\n/**\r\n * Reset timer.\r\n */\r\nSystemTimer.prototype.reset = function () {\r\n\t\r\n\tthis._time = new Date ().getTime ();\r\n}\r\n\r\n/**\r\n * Report time to system log.\r\n * @param {string} message\r\n */\r\nSystemTimer.prototype.report = function ( message ) {\r\n\t\r\n\tthis.logger.debug ( this._id +\": \" + this.getTime () + ( message ? \": \" + message : \"\" ));\r\n}\r\n\r\n/**\r\n * Get time in milliseconds.\r\n * @return {int}\r\n */\r\nSystemTimer.prototype.getTime = function () {\r\n\t\r\n\treturn new Date ().getTime () - this._time;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/dom/DOMEvents.js",
    "content": "/**\r\n * @class\r\n * Gateway for common DOM event management, emulating\r\n * DOM2 EventListener interface for Internet Explorer\r\n */\r\nfunction _DOMEvents() { }\r\n\r\n_DOMEvents.prototype = {\r\n\t_logger: SystemLogger.getLogger(\"DOMEvents\"),\r\n\r\n\t/*\r\n\t* In order to avoid spelling mistakes, please use these constants.\r\n\t*/\r\n\tMOUSEDOWN: \"mousedown\",\r\n\tMOUSEUP: \"mouseup\",\r\n\tMOUSEOVER: \"mouseover\",\r\n\tMOUSEOUT: \"mouseout\",\r\n\tMOUSEMOVE: \"mousemove\",\r\n\tCLICK: \"click\",\r\n\tDOUBLECLICK: \"dblclick\",\r\n\tKEYPRESS: \"keypress\",\r\n\tKEYDOWN: \"keydown\",\r\n\tKEYUP: \"keyup\",\r\n\tCONTEXTMENU: \"contextmenu\",\r\n\tSCROLL: \"scroll\",\r\n\tLOAD: \"load\",\r\n\tBEFOREUNLOAD: \"beforeunload\",\r\n\tUNLOAD: \"unload\",\r\n\tRESIZE: \"resize\",\r\n\tFOCUS: \"focus\",\r\n\tBLUR: \"blur\",\r\n\tSUBMIT: \"submit\",\r\n\tCUT: \"cut\",\r\n\tCOPY: \"copy\",\r\n\tPASTE: \"paste\",\r\n\tDOM: \"DOMContentLoaded\",\r\n\tDRAGOVER: \"dragover\",\r\n\tDROP: \"drop\",\r\n\tWHEEL: \"wheel\",\r\n\tHASHCHANGE: \"hashchange\",\r\n\r\n\tTOUCHSTART: \"touchstart\",\r\n\tTOUCHEND: \"touchend\",\r\n\tTOUCHMOVE: \"touchmove\",\r\n\r\n\t/*\r\n\t* Explorer specific events. Note that \"mouseenter\" and\r\n\t* \"mouseleave\" pseudosupport has been hacked into Mozilla.\r\n\t*/\r\n\tACTIVATE: \"activate\",\r\n\tDEACTIVATE: \"deactivate\",\r\n\tMOUSEENTER: \"mouseenter\",\r\n\tMOUSELEAVE: \"mouseleave\",\r\n\tSELECTSTART: \"selectstart\",\r\n\tFOCUSIN: \"focusin\",\r\n\tFOCUSOUT: \"focusout\",\r\n\tHELP: \"help\",\r\n\r\n\t/*\r\n\t* These are Explorer native, but can be emulated in Mozilla.\r\n\t*/\r\n\tBEFOREUPDATE: \"beforeupdate\",\r\n\tAFTERUPDATE: \"afterupdate\",\r\n\tERRORUPDATE: \"errorupdate\",\r\n\r\n\t/*\r\n\t* Tracking event listeners attached.\r\n\t*/\r\n\t_count: 0,\r\n\r\n\t/**\r\n\t* Add event Listener.\r\n\t* @param {DOMElement} target\r\n\t* @param {string} event\r\n\t* @param {IEventListener} handler\r\n\t* @param {boolean} isReverse Don't use this Mozilla-only flag!\r\n\t*/\r\n\taddEventListener: function (target, event, handler, isReverse) {\r\n\r\n\t\tthis._count++;\r\n\r\n\t\tthis._eventListener(\r\n\t\t\ttrue,\r\n\t\t\ttarget,\r\n\t\t\tevent,\r\n\t\t\thandler,\r\n\t\t\tisReverse\r\n\t\t);\r\n\t},\r\n\r\n\t/**\r\n\t* Remove event listener.\r\n\t* @param {DOMElement} target\r\n\t* @param {string} event\r\n\t* @param {IEventListener} handler\r\n\t* @param {boolean} isReverse\r\n\t*/\r\n\tremoveEventListener: function (target, event, handler, isReverse) {\r\n\r\n\t\tthis._count--;\r\n\r\n\t\tthis._eventListener(\r\n\t\t\tfalse,\r\n\t\t\ttarget,\r\n\t\t\tevent,\r\n\t\t\thandler,\r\n\t\t\tisReverse\r\n\t\t);\r\n\t},\r\n\r\n\t/**\r\n\t* @param {Event} e\r\n\t* @return {DOMElement}\r\n\t*/\r\n\tgetTarget: function (e) {\r\n\r\n\t\treturn e ? (e.target ? e.target : e.srcElement) : null;\r\n\t},\r\n\r\n\t/**\r\n\t* Stop event propagation.\r\n\t* @param {Event} e\r\n\t*/\r\n\tstopPropagation: function (e) {\r\n\r\n\t\ttry {\r\n\t\t\tif (e.stopPropagation != null) {\r\n\t\t\t\te.stopPropagation();\r\n\t\t\t} else {\r\n\t\t\t\te.cancelBubble = true;\r\n\t\t\t}\r\n\t\t} catch (exception) {\r\n\t\t\t/*\r\n\t\t\t* May happen in explorer if the event window has been unloaded.\r\n\t\t\t*/\r\n\t\t\tif (Application.isDeveloperMode == true) {\r\n\t\t\t\tthis._logger.error(exception);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Prevent event default.\r\n\t* @param {Event} e\r\n\t*/\r\n\tpreventDefault: function (e) {\r\n\r\n\t\ttry {\r\n\t\t\tif (e.preventDefault) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t} else {\r\n\t\t\t\te.returnValue = false;\r\n\t\t\t}\r\n\t\t} catch (exception) {\r\n\t\t\t/*\r\n\t\t\t* May happen in explorer if the event window has been unloaded.\r\n\t\t\t*/\r\n\t\t\tif (Application.isDeveloperMode == true) {\r\n\t\t\t\tthis._logger.error(exception);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Was it a right click? Can never remember the \"2\" involved here...\r\n\t* @param {MouseEvent} e\r\n\t*/\r\n\tisRightButton: function (e) {\r\n\r\n\t\treturn e.button == 2 ? true : false;\r\n\t},\r\n\r\n\t/**\r\n\t* @param {MouseEvent} e\r\n\t*/\r\n\tisButtonPressed: function (e) {\r\n\t\tif ((Client.isFirefox || Client.isExplorer11) && e.buttons === 0)\r\n\t\t\treturn false;\r\n\t\telse if (Client.isWebKit && e.which === 0)\r\n\t\t\treturn false;\r\n\t\treturn undefined;\r\n\t},\r\n\r\n\t/**\r\n\t* @param {IEventListener} handler\r\n\t*/\r\n\tcleanupEventListeners: function (handler) {\r\n\r\n\t\tthis._deleteWrappedHandler(handler);\r\n\t},\r\n\r\n\t/**\r\n\t* Not recommended ( mozilla only).\r\n\t* @param {Event} e\r\n\t*/\r\n\tisCurrentTarget: function (e) {\r\n\r\n\t\tvar result = false;\r\n\t\tif (Client.isMozilla == true) {\r\n\t\t\tresult = e.target == e.currentTarget;\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n\r\n\t// PRIVATE FUNCTIONS ......................................................\r\n\r\n\t/**\r\n\t* Is node child of parent? Used to emulate\r\n\t* IE native \"mouseenter\" and \"mouseleave\".\r\n\t* TODO: Move to DOMUtil?\r\n\t* @param {DOMElement} parent\r\n\t* @param {DOMElement} child\r\n\t* @return {boolean}\r\n\t*/\r\n\t_isChildOf: function (parent, child) {\r\n\r\n\t\tvar result = true;\r\n\t\tif (parent == child) {\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t\tif (result == true) {\r\n\t\t\twhile (child != null && child.nodeType != Node.DOCUMENT_NODE && child != parent) {\r\n\t\t\t\tchild = child.parentNode;\r\n\t\t\t}\r\n\t\t\tresult = (child == parent);\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* @param {boolean} isAdd\r\n\t* @param {DOMElement} target\r\n\t* @param {string} event\r\n\t* @param {IEventListener} handler\r\n\t* @param {function} caller\r\n\t*/\r\n\t_eventListener: function (isAdd, target, event, handler, isReverse, caller) {\r\n\r\n\t\tif (Interfaces.isImplemented(IEventListener, handler, true)) {\r\n\t\t\tif (typeof event != Types.UNDEFINED) {\r\n\t\t\t\tvar action = this._getAction(isAdd);\r\n\t\t\t\tif (target[action]) {\r\n\t\t\t\t\tif (Client.isPad && event == DOMEvents.DOUBLECLICK) {\r\n\t\t\t\t\t\tif (isAdd) {\r\n\t\t\t\t\t\t\tvar lastTouch = null;\r\n\t\t\t\t\t\t\tvar doubletaphandler = {\r\n\t\t\t\t\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\t\t\t\t\tvar now = new Date().getTime();\r\n\t\t\t\t\t\t\t\t\tif (lastTouch && now - lastTouch < 500) {\r\n\t\t\t\t\t\t\t\t\t\tDOMEvents.stopPropagation(e); //?\r\n\t\t\t\t\t\t\t\t\t\tDOMEvents.preventDefault(e); //?\r\n\t\t\t\t\t\t\t\t\t\tvar newevent = new MouseEvent(DOMEvents.DOUBLECLICK, e);\r\n\t\t\t\t\t\t\t\t\t\thandler.handleEvent(newevent);\r\n\t\t\t\t\t\t\t\t\t\tlastTouch = null;\r\n\t\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tlastTouch = now;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttarget[action](DOMEvents.TOUCHSTART, doubletaphandler, isReverse ? true : false);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (Client.isExplorer || Client.isExplorer11) {\r\n\t\t\t\t\t\tswitch (event) {\r\n\t\t\t\t\t\t\tcase DOMEvents.MOUSEDOWN:\r\n\t\t\t\t\t\t\tcase DOMEvents.MOUSEUP:\r\n\t\t\t\t\t\t\tcase DOMEvents.MOUSEOVER:\r\n\t\t\t\t\t\t\tcase DOMEvents.MOUSEOUT:\r\n\t\t\t\t\t\t\tcase DOMEvents.MOUSEMOVE:\r\n\t\t\t\t\t\t\t\thandler = this._getWrappedHandler(target, event, handler, caller);\r\n\t\t\t\t\t\t\t\ttarget[action](event, handler, false);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\ttarget[action](event, handler, false);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tswitch (event) {\r\n\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t* Note that the \"mouseenter\" and \"mouseleave\" events are\r\n\t\t\t\t\t\t\t* registered in Mozilla as \"mouseover\" and \"mouseout\"\r\n\t\t\t\t\t\t\t* event though the IE native behavior is emulated. This\r\n\t\t\t\t\t\t\t* implies that you have to listen for both \"mouseover\"\r\n\t\t\t\t\t\t\t* and \"mouseenter\" event event though only the latter was added!\r\n\t\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t\tcase DOMEvents.MOUSEENTER:\r\n\t\t\t\t\t\t\tcase DOMEvents.MOUSELEAVE:\r\n\t\t\t\t\t\t\t\tevent = event == DOMEvents.MOUSEENTER ? DOMEvents.MOUSEOVER : DOMEvents.MOUSEOUT;\r\n\t\t\t\t\t\t\t\ttarget[action](event, {\r\n\t\t\t\t\t\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\t\t\t\t\t\tvar rel = e.relatedTarget;\r\n\t\t\t\t\t\t\t\t\t\tif (e.currentTarget == rel || DOMEvents._isChildOf(e.currentTarget, rel)) { }\r\n\t\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\t\thandler.handleEvent(e);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}, isReverse ? true : false);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\ttarget[action](event, handler, isReverse ? true : false);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthrow \"No such event allowed!\";\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Get that action.\r\n\t* @param {boolean} isAdd\r\n\t* @return {string}\r\n\t*/\r\n\t_getAction: function (isAdd) {\r\n\r\n\t\tvar result = null;\r\n\t\tswitch (isAdd) {\r\n\t\t\tcase true:\r\n\t\t\t\tresult = \"addEventListener\";\r\n\t\t\t\tbreak;\r\n\t\t\tcase false:\r\n\t\t\t\tresult = \"removeEventListener\";\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t// EXPLORER SPECIFIC ...............................................\r\n\r\n\t/**\r\n\t* Explorer expects functions, not objects, as event handlers.\r\n\t* This fellow will return a function which in turn invokes the\r\n\t* designated method <code>handleEvent</code> on the object.\r\n\t* The error handling is especially elaborate around here.\r\n\t* @param {DOMElement} target\r\n\t* @param {string} event\r\n\t* @param {IEventListener} handler\r\n\t* @param {function} caller\r\n\t* @return {function}\r\n\t*/\r\n\t_getWrappedHandler: function (target, event, handler, caller) {\r\n\r\n\t\tvar result = null;\r\n\t\ttry {\r\n\t\t\tif (!handler._domEventHandlers) {\r\n\t\t\t\thandler._domEventHandlers = {};\r\n\t\t\t}\r\n\t\t\tif (!handler._domEventHandlers[target]) {\r\n\t\t\t\thandler._domEventHandlers[target] = {};\r\n\t\t\t}\r\n\t\t\tif (!handler._domEventHandlers[target][event]) {\r\n\t\t\t\tvar win = target.nodeType ? DOMUtil.getParentWindow(target) : target;\r\n\t\t\t\tif (win) {\r\n\t\t\t\t\thandler._domEventHandlers[target][event] = function (e) {\r\n\t\t\t\t\t\tif (win.event != null && handler != null) {\r\n\t\t\t\t\t\t\thandler.handleEvent(win.event);\r\n\t\t\t\t\t\t} else if (handler != null) {\r\n\t\t\t\t\t\t\thandler.handleEvent(e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tresult = handler._domEventHandlers[target][event];\r\n\t\t} catch (exception) {\r\n\t\t\tthis._report(target, event, handler, caller);\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t},\r\n\r\n\t_deleteWrappedHandler: function (handler) {\r\n\r\n\t\tfor (var target in handler._domEventHandlers) {\r\n\t\t\tif (target) {\r\n\t\t\t\tfor (var event in handler._domEventHandlers[target]) {\r\n\t\t\t\t\tif (event) {\r\n\t\t\t\t\t\tdelete handler._domEventHandlers[target][event];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdelete handler._domEventHandlers[target];\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t* Patching Explorers miserable error repporting.\r\n\t* @param {DOMElement} target\r\n\t* @param {string} event\r\n\t* @param {IEventListener} handler\r\n\t* @param {function} caller\r\n\t*/\r\n\t_report: function (target, event, handler, caller) {\r\n\r\n\t\talert(\r\n\t\t\t\"DOMEvents.getWrappedHandler malfunction.\\n\\n\" +\r\n\t\t\t\"\\ttarget: \" + (target ? target.nodeName : target) + \"\\n\" +\r\n\t\t\t\"\\tevent: \" + event + \"\\n\" +\r\n\t\t\t\"\\thandler: \" + handler + \"\\n\\n\" +\r\n\t\t\t\"Offending invoker: \" + (\r\n\t\t\t\tcaller.callee ? caller.callee.toString() : caller.constructor\r\n\t\t\t)\r\n\t\t);\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_DOMEvents}\r\n */\r\nvar DOMEvents = new _DOMEvents();"
  },
  {
    "path": "Website/Composite/scripts/source/top/dom/DOMFormatter.js",
    "content": "/** \r\n * @class\r\n * DOMFormatter. Only to be used for debugging purposes - works only in Mozilla.\r\n */\r\nwindow.DOMFormatter = new function () {\r\n\r\n\tvar TAB = \"\\t\";\r\n\tvar NEW = \"\\n\";\r\n\tvar WHITESPACE = new RegExp ( /[^\\t\\n\\r ]/ );\r\n\tthis.ignoreCDATASections = false;\r\n\r\n\t/**\r\n\t * Nodetree indenter.\r\n\t * @param {DOMElement} oElement\r\n\t * @return {DOMElement} oElement indented\r\n\t * @ignore\r\n\t */\r\n\tfunction indent ( oElement ) {\r\n\t\r\n\t\tvar doc = oElement.ownerDocument;\r\n\t\r\n\t\tvar doindent = function ( node, iTabs ) {\r\n\t\t\tif ( node.hasChildNodes () && node.firstChild.nodeType != Node.TEXT_NODE ) {\r\n\t\t\t\tvar sTabs = \"\", i = 0; \r\n\t\t\t\twhile ( i++ < iTabs ) {\r\n\t\t\t\t\tsTabs += TAB;\r\n\t\t\t\t}\r\n\t\t\t\tvar nextnode = node.firstChild;\r\n\t\t\t\twhile ( nextnode ) {\r\n\t\t\t\t\tswitch ( nextnode.nodeType ) {\r\n\t\t\t\t\t\tcase Node.ELEMENT_NODE :\r\n\t\t\t\t\t\t\tif ( nextnode == node.lastChild ) {\r\n\t\t\t\t\t\t\t\tnode.appendChild ( doc.createTextNode ( NEW + sTabs ));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tnode.insertBefore ( doc.createTextNode ( NEW + sTabs + TAB ), nextnode );\r\n\t\t\t\t\t\t\tdoindent ( nextnode, iTabs + 1 );\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Node.COMMENT_NODE :\r\n\t\t\t\t\t\tcase Node.PROCESSING_INSTRUCTION_NODE :\r\n\t\t\t\t\t\tcase Node.CDATA_SECTION_NODE : \r\n\t\t\t\t\t\t\tnode.insertBefore ( doc.createTextNode ( NEW + sTabs + TAB ), nextnode );\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( nextnode.nodeType ==  Node.CDATA_SECTION_NODE ) {\r\n\t\t\t\t\t\tif ( !this.ignoreCDATASections ) {\r\n\t\t\t\t\t\t\tformatCDATASection ( nextnode, sTabs + TAB );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tnextnode = nextnode.nextSibling;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tdoindent ( oElement, 0 );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Whitespace stripper.\r\n\t * @param {DOMElement} oElement\r\n\t * @return {DOMElement} oElement stripped\r\n\t * @ignore\r\n\t *\r\n\t * TODO: check status on normalize method \r\n\t * TODO: check isElementContentWhitespace\r\n\t * TODO: handle intext carriage returns\r\n\t */\r\n\tfunction strip ( oElement ) {\r\n\r\n\t\tvar aFilter = [];\r\n\t\tvar oFilter = {\r\n\t\t\tacceptNode : function ( oElement ) {\r\n\t\t\t\treturn ( !WHITESPACE.test ( oElement.nodeValue )) ? \r\n\t\t\t\tNodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar oWalker = oElement.ownerDocument.createTreeWalker ( \r\n\t\t\toElement, \r\n\t\t\tNodeFilter.SHOW_TEXT, \r\n\t\t\toFilter, \r\n\t\t\ttrue \r\n\t\t);\r\n\t\twhile ( oWalker.nextNode ()) aFilter.push ( oWalker.currentNode );\r\n\t\tvar i = 0, oNode;\r\n\t\twhile (( oNode = aFilter [ i++ ]) != null ) {\r\n\t\t\toNode.parentNode.removeChild ( oNode );\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Format CDATA section text. Depending on the content scenario, this can be \r\n\t * controversial. For most common use (scripting language embedding) it will work \r\n\t * out fine. User can disable the feature by setting property ignoreCDATASections.\r\n\t * @param {DOMCDATASectionNode} node\r\n\t * @param {string} indent\r\n\t * @ignore\r\n\t *\r\n\t * TODO: too many assumptions in routine?\r\n\t * TODO: leaves a trailing empty line\r\n\t * TODO: qa this routine\r\n\t */\r\n\tfunction formatCDATASection ( node, indent ) {\r\n\t\r\n\t\tif ( node.textContent.indexOf ( NEW ) >-1 ) {\r\n\t\t\r\n\t\t\tvar split = node.textContent.split ( NEW );\r\n\t\t\tvar result = \"\", line, level = 0, isFirst = true;\r\n\t\t\t\r\n\t\t\twhile (( line = split.shift ()) != null ) {\r\n\t\t\t\t\r\n\t\t\t\t// first line indentation level is now base reference level\r\n\t\t\t\tif ( level == 0 && line.charAt ( 0 ) == TAB ) {\r\n\t\t\t\t\twhile ( line.charAt ( level++ ) == TAB ) {}\r\n\t\t\t\t}\r\n\t\t\t\tline = line.substring ( level, line.length );\r\n\t\t\t\tif ( split.length > 0 ) {\r\n\t\t\t\t\tresult += indent + TAB + line;\r\n\t\t\t\t\tresult += isFirst ? \"\" : \"\\n\";\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tresult += indent + line;\r\n\t\t\t\t\tindent = indent.slice ( 1, indent.length );\r\n\t\t\t\t\tnode.parentNode.appendChild ( doc.createTextNode ( NEW + indent ));\r\n\t\t\t\t}\r\n\t\t\t\tisFirst = false;\r\n\t\t\t}\r\n\t\t\tnode.textContent = result;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/**\r\n\t * Format that element.\r\n\t * @param {DOMElement} oElement\r\n\t * @param {int} iType Optional, stripped or indented (default)\r\n\t * @return {DOMElement} oElement\r\n\t */\r\n\tthis.format = function ( oElement, iType ) {\r\n\t\t\r\n\t\tvar STRIPPED_TYPE_RESULT = 1;\r\n\r\n\t\tif (document.createTreeWalker && !Client.isExplorer && !Client.isExplorer11) {\r\n\t\t\ttry {\r\n\t\t\t\tstrip ( oElement );\r\n\t\t\t\tif ( iType != STRIPPED_TYPE_RESULT ) {\r\n\t\t\t\t\tindent ( oElement );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch ( exception ) {\r\n\t\t\t\tthrow new Error ( exception );\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ( oElement );\r\n\t}\r\n}\r\n\r\nDOMFormatter.INDENTED_TYPE_RESULT = 0;\r\nDOMFormatter.STRIPPED_TYPE_RESULT = 1;"
  },
  {
    "path": "Website/Composite/scripts/source/top/dom/DOMSerializer.js",
    "content": "/**\r\n * @class\r\n * DOMSerialzier.\r\n */\r\nfunction _DOMSerializer () {}\r\n\r\n_DOMSerializer.prototype = {\r\n\r\n\t_serializer: (window.XMLSerializer ? new XMLSerializer() : null),\r\n\r\n\t/**\r\n\t * @param {DOMNode} node This should be an element or a document node.\r\n\t * @param {boolean} isPrettyPrint Works in Mozilla only!\r\n\t * @return {string}\r\n\t */\r\n\tserialize : function ( node, isPrettyPrint ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tvar element = node;\r\n\t\t\r\n\t\tif ( node.nodeType == Node.DOCUMENT_NODE ) {\r\n\t\t\telement = node.documentElement;\r\n\t\t}\r\n\r\n\t\tif (element.xml != null)\r\n\t\t{\r\n\t\t\treturn element.xml;\r\n\t\t}\r\n\t\telse if ( this._serializer != null) {\r\n\t\t\tif ( isPrettyPrint == true ) {\r\n\t\t\t\telement = element.cloneNode ( true );\r\n\t\t\t\telement = DOMFormatter.format ( element, DOMFormatter.INDENTED_TYPE_RESULT );\r\n\t\t\t}\r\n\t\t\tresult = this._serializer.serializeToString ( element );\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_DOMSerializer}\r\n */\r\nvar DOMSerializer = new _DOMSerializer ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/dom/DOMUtil.js",
    "content": "/**\r\n * Accessed through instance variable \"DOMUtil\" defined way below.\r\n */\r\nfunction _DOMUtil () {}\r\n_DOMUtil.prototype = {\r\n\r\n\t_logger\t: SystemLogger.getLogger ( \"DOMUtil\" ),\r\n\r\n\tMSXML_MAXVERSION\t: 6,\r\n\tMSXML_MINVERSION \t: 1,\r\n\tMSXML_HTTPREQUEST\t: \"MSXML2.XMLHTTP.{$version}.0\",\r\n\tMSXML_DOMDOCUMENT\t: \"MSXML2.DOMDocument.{$version}.0\",\r\n\tMSXML_FREETHREADED\t: \"MSXML2.FreeThreadedDOMDocument.{$version}.0\",\r\n\tMSXML_XSLTEMPLATE\t: \"MSXML2.XSLTemplate.{$version}.0\",\r\n\r\n\t/**\r\n\t * You've been ActiveX'ed.\r\n\t * @param {string} signature\r\n\t */\r\n\tgetMSComponent : function ( signature ) {\r\n\r\n\t\tvar sig, result = null, version = this.MSXML_MAXVERSION;\r\n\t\twhile ( !result && version >= this.MSXML_MINVERSION ) {\r\n\t\t\ttry {\r\n\t\t\t\tsig = signature.replace ( \"{$version}\", version );\r\n\t\t\t\tresult = new ActiveXObject ( sig );\r\n\t\t\t} catch ( exception ) {}\r\n\t\t\tversion--;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Builds a XmlHttpRequest.\r\n\t * @return {XMLHTTPRequest}\r\n\t */\r\n\tgetXMLHTTPRequest : function () {\r\n\r\n\t\tvar result = null;\r\n\t\tif (Client.isExplorer || Client.isExplorer11) {\r\n\t\t\tresult = this.getMSComponent ( this.MSXML_HTTPREQUEST );\r\n\t\t} else {\r\n\t\t\tresult = new XMLHttpRequest ();\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Builds a DOM document.\r\n\t * @return {DOMDocument}\r\n\t * @param {boolean} isFreeThreaded\r\n\t */\r\n\tgetDOMDocument : function ( isFreeThreaded ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif (Client.isExplorer || Client.isExplorer11) {\r\n\t\t\tresult = this.getMSComponent ( isFreeThreaded ? this.MSXML_FREETHREADED : this.MSXML_DOMDOCUMENT );\r\n\t\t} else {\r\n\t\t\t/*\r\n\t\t\t * There is an encoding fokup in Firefox 3 when using the command\r\n\t\t\t * document.implementation.createDocument ( \"\", \"\", null ).\r\n\t\t\t * See bug 431701 (claimed fixed for FF 3.0.4, but that's a lie).\r\n\t\t\t */\r\n\t\t\tvar doc = XMLParser.parse ( \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><ROOT/>\" );\r\n\t\t\tdoc.removeChild ( doc.documentElement );\r\n\t\t\tresult = doc;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * @return {MSXMLXSLTemplate}\r\n\t */\r\n\tgetMSXMLXSLTemplate : function () {\r\n\r\n\t\tvar result = null;\r\n\t\tif (Client.isAnyExplorer) {\r\n\t\t\tresult = this.getMSComponent ( this.MSXML_XSLTEMPLATE );\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get the localname of a DOM element.\r\n\t * @param {DOMElement} element\r\n\t * @return {string}\r\n\t */\r\n\tgetLocalName : function ( element ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( element.localName ) {\r\n\t\t\tresult = element.localName.replace(\"ui:\",\"\");\r\n\t\t} else if ( element.baseName ) {\r\n\t\t\tresult = element.baseName;\r\n\t\t} else {\r\n\t\t\tresult = element.nodeName.toLowerCase (); // HTMLElement in explorer!\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get computed style.\r\n\t * @param {DOMElement} element\r\n\t * @param {string} styleprop\r\n\t */\r\n\tgetComputedStyle : function ( element, styleprop ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( Client.isExplorer ) {\r\n\t\t\tif ( element.currentStyle != null ) {\r\n\t\t\t\tresult = element.currentStyle [ styleprop ];\r\n\t\t\t} else {\r\n\t\t\t\tthis._logger.error ( \"Could not compute style for element \" + element.nodeName );\r\n\t\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar computedStyle = element.ownerDocument.defaultView\r\n\t\t\t\t\t\t\t.getComputedStyle(element, null);\r\n\t\t\tif (computedStyle != null) {\r\n\t\t\t\tresult = computedStyle.getPropertyValue(styleprop);\r\n\t\t\t} else {\r\n\t\t\t\tthis._logger.error(\"Could not compute style for element \" + element.nodeName);\r\n\t\t\t\tSystemDebug.stack(arguments);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get max z-index.\r\n\t * @param {DOMDocument} doc\r\n\t */\r\n\tgetMaxIndex : function ( doc ) {\r\n\r\n\t\tvar max = 0, elements = new List ( doc.getElementsByTagName ( \"*\" ));\r\n\t\telements.each ( function ( element ) {\r\n\t\t\tvar index = CSSComputer.getZIndex ( element );\r\n\t\t\tif ( index > max ) {\r\n\t\t\t\tmax = index;\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn max;\r\n\t},\r\n\r\n\t/**\r\n\t * Get the ordinal position of a DOM element within it's container (skipping textnodes).\r\n\t * @param {DOMElement} element\r\n\t * @param {boolean} isSimilar If set to true, count only elements of equal nodeName.\r\n\t * @return {int}\r\n\t */\r\n\tgetOrdinalPosition : function ( element, isSimilar ) {\r\n\r\n\t\tvar result = null;\r\n\t\tvar position = -1;\r\n\t\tvar localName = this.getLocalName ( element );\r\n\t\tvar children = new List ( element.parentNode.childNodes );\r\n\r\n\t\twhile ( children.hasNext ()) {\r\n\t\t\tvar child = children.getNext ();\r\n\t\t\tif ( child.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\t\tif ( !isSimilar || this.getLocalName ( child ) == localName ) {\r\n\t\t\t\t\tposition ++;\r\n\t\t\t\t\tif ( child == element || ( child.id != \"\" && child.id == element.id )) { // spell it out for ie!\r\n\t\t\t\t\t\tresult = position;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @param {boolean} isSimilar If set to true, count only elements of equal nodeName.\r\n\t * @return {boolean}\r\n\t */\r\n\tisFirstElement : function ( element, isSimilar ) {\r\n\r\n\t\treturn ( this.getOrdinalPosition ( element, isSimilar ) == 0 );\r\n\t},\r\n\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @param {boolean} isSimilar If set to true, count only elements of equal nodeName.\r\n\t * @return {boolean}\r\n\t */\r\n\tisLastElement : function ( element, isSimilar ) {\r\n\r\n\t\tvar elements = element.parentNode.getElementsByTagName (\r\n\t\t\tisSimilar ? this.getLocalName ( element ) : \"*\"\r\n\t\t);\r\n\t\treturn ( this.getOrdinalPosition ( element ) == elements.length );\r\n\t},\r\n\r\n\t/**\r\n\t * Get the window object associated to a given node.\r\n\t * @param {DOMNode} node\r\n\t * @return {window}\r\n\t */\r\n\tgetParentWindow : function ( node ) {\r\n\r\n\t\tvar doc = node.nodeType == Node.DOCUMENT_NODE ? node : node.ownerDocument;\r\n\t\treturn doc.defaultView ? doc.defaultView : doc.parentWindow;\r\n\t},\r\n\r\n\t/**\r\n\t * Get the text content of a node.\r\n\t * @param {DOMNode} node\r\n\t * @return {string}\r\n\t */\r\n\tgetTextContent : function ( node ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( node.textContent ) {\r\n\t\t\tresult = node.textContent;\r\n\t\t} else if ( node.text ) {\r\n\t\t\tresult = node.text;\r\n\t\t} else {\r\n\t\t\tresult = node.innerText;\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Set the text content of a node.\r\n\t * @param {DOMNode} node\r\n\t * @param {string} text\r\n\t */\r\n\tsetTextContent : function ( node, text ) {\r\n\r\n\t\ttext = String ( text );\r\n\t\tif ( node.textContent ) {\r\n\t\t\tnode.textContent = text;\r\n\t\t} else if ( node.text ) {\r\n\t\t\tnode.text = text;\r\n\t\t} else {\r\n\t\t\tnode.innerText = text;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Get ancestor by localname (nodename with no namespace prefix).\r\n\t * @param {string} nodeName\r\n\t * @param {DOMNode} node\r\n\t * @param {boolean} isTraverse If true, cross iframe boundaries\r\n\t * @return {DOMElement}\r\n\t */\r\n\tgetAncestorByLocalName : function ( nodeName, node, isTraverse ) {\r\n\r\n\t\tvar result = null;\r\n\t\twhile ( result == null ) {\r\n\t\t\tnode = node.parentNode;\r\n\t\t\tif ( node.nodeType == Node.DOCUMENT_NODE ) {\r\n\t\t\t\tif ( isTraverse == true ) {\r\n\t\t\t\t\tvar win = this.getParentWindow ( node );\r\n\t\t\t\t\tnode = win.frameElement;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( this.getLocalName ( node ) == nodeName ) {\r\n\t\t\t\tresult = node;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Does element contain a node?\r\n\t * @param {DOMElement} element\r\n\t * @param {DOMNode} node\r\n\t */\r\n\tcontains : function ( element, node ) {\r\n\r\n\t\treturn element.contains ?\r\n\t\t\telement != node && element.contains ( node ) :\r\n\t\t\t!!( element.compareDocumentPosition ( node ) & 16 );\r\n\t},\r\n\r\n\t/**\r\n\t * CreateElementNS. For HTML documents, this is simply simulated in explorer.\r\n\t * @param {URI} namespaceURI\r\n\t * @param {string} nodeName\r\n\t * @parm {DOMDocument} ownerDocument\r\n\t * @return {DOMElement}\r\n\t */\r\n\tcreateElementNS : function ( namespaceURI, nodeName, ownerDocument ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( ownerDocument == null ) { // always forget this argument...\r\n\t\t\talert ( \"DOMUtil#createElementNS : Missing argument (DOMDocument)\" );\r\n\t\t} else {\r\n\t\t\tif ( !Client.isExplorer && !Client.isExplorer11) {\r\n\t\t\t\tresult = ownerDocument.createElementNS ( namespaceURI, nodeName );\r\n\t\t\t} else {\r\n\t\t\t\tif ( ownerDocument.xml != null ) {\r\n\t\t\t\t\tresult = ownerDocument.createNode (\r\n\t\t\t\t\t\tNode.ELEMENT_NODE, nodeName, namespaceURI\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresult = ownerDocument.createElement(nodeName.replace(\"ui:\", \"\"));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get elements by tagname in the XHTML namespace. DOM3 style\r\n\t * qualified namespaces seems to be required for Gecko 1.9 alpha.\r\n\t * TODO: DEPRECATE THIS UNIVERSALLY AT SOME POINT! - MARKING @DEPRECATED FOR NOW!\r\n\t * @deprecated\r\n\t * @param {DOMNode} node\r\n\t * @param {string} tagname\r\n\t * @return {NodeList} this would be an simple array in explorer...\r\n\t */\r\n\tgetElementsByTagName : function ( node, tagname ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( Client.isMozilla ) {\r\n\t\t\tresult = node.getElementsByTagNameNS ( Constants.NS_XHTML, tagname );\r\n\t\t} else {\r\n\t\t\tresult = node.getElementsByTagName ( tagname );\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Get child elements by nodename.\r\n\t* @param {DOMNode} node\r\n\t* @param {string} nodeName\r\n\t* @return {List<DOMElement>}\r\n\t*/\r\n\tgetChildElementsByLocalName: function (node, nodeName) {\r\n\r\n\t\tvar result = new List();\r\n\t\tvar children = node.childNodes;\r\n\t\tnew List(children).each(function (child) {\r\n\t\t\tif (child.nodeType == Node.ELEMENT_NODE) {\r\n\t\t\t\tif (nodeName == \"*\" || DOMUtil.getLocalName(child) == nodeName) {\r\n\t\t\t\t\tresult.add(child);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get next element sibling.\r\n\t * @param {DOMElement} element\r\n\t * @return {DOMElement}\r\n\t */\r\n\tgetNextElementSibling : function ( element ) {\r\n\r\n\t\treturn Client.isExplorer ? element.nextSibling : element.nextElementSibling;\r\n\t},\r\n\r\n\t/**\r\n\t * Get previous element sibling.\r\n\t * @param {DOMElement} element\r\n\t * @return {DOMElement}\r\n\t */\r\n\tgetPreviousElementSibling : function ( element ) {\r\n\r\n\t\treturn Client.isExplorer ? element.previousSibling : element.previousElementSibling;\r\n\t},\r\n\r\n\t/**\r\n\t * Clone node. This seems to terminate encoding in Firefox 3.0.4,\r\n\t * so we slip it through a serializer and suck it back up with a parser.\r\n\t * The bug is verified fixed in Firefox 3.1 - no known bug number!\r\n\t * TODO: DEPRECATE THIS UNIVERSALLY - MARKING @DEPRECATED FOR NOW\r\n\t * @deprecated\r\n\t * @param {DOMNode} node\r\n\t */\r\n\tcloneNode : function ( node ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( Client.isMozilla == true ) {\r\n\t\t\tresult = XMLParser.parse ( DOMSerializer.serialize ( node ));\r\n\t\t} else {\r\n\t\t\tresult = node.cloneNode ( true );\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Find position of element in local coordinate space\r\n\t * (relative to the nearest positioned ancestor).\r\n\t * @param {DOMElement} element\r\n\t * @return {Point}\r\n\t */\r\n\tgetLocalPosition : function ( element ) {\r\n\r\n\t\tvar result = new Point ( element.offsetLeft, element.offsetTop );\r\n\r\n\t\tif ( Client.isExplorer && element.parentNode && element.parentNode.currentStyle ) {\r\n\t\t\tif ( element.parentNode.currentStyle.position == \"static\" ) {\r\n\t\t\t\tvar point = this.getLocalPosition ( element.parentNode );\r\n\t\t\t\tresult.x += point.x;\r\n\t\t\t\tresult.y += point.y;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Find position of element relative to the elements viewport.\r\n\t * @param {DOMElement} element\r\n\t * @return {Point}\r\n\t */\r\n\tgetGlobalPosition : function ( element ) {\r\n\r\n\t\treturn this._getPosition ( element, false );\r\n\t},\r\n\r\n\t/**\r\n\t * Find position of element relative to the top viewport.\r\n\t * @param {DOMElement} element\r\n\t * @return {Point}\r\n\t */\r\n\tgetUniversalPosition : function ( element ) {\r\n\r\n\t\treturn this._getPosition ( element, true );\r\n\t},\r\n\r\n\t/**\r\n\t * Find position.\r\n\t * @param {DOMElement} element\r\n\t * @param {boolean} isUniversal\r\n\t * @return {Point}\r\n\t * @ignore\r\n\t */\r\n\t_getPosition : function ( element, isUniversal ) {\r\n\r\n\t\tvar result = null;\r\n\r\n\t\t/*\r\n\t\t * Explorer and Firefox 3.0\r\n\t\t */\r\n\t\tif ( typeof element.getBoundingClientRect != Types.UNDEFINED ) {\r\n\r\n\t\t\tvar rect = element.getBoundingClientRect ();\r\n\t\t\tresult = {\r\n\t\t\t\tx : rect.left,\r\n\t\t\t \ty : rect.top\r\n\t\t\t}\r\n\t\t\tif ( Client.isMozilla ) {\r\n\t\t\t\t// why would mozilla steal this method and implement it differently?\r\n\t\t\t\tresult.x -= element.scrollLeft;\r\n\t\t\t\tresult.y -= element.scrollTop;\r\n\t\t\t}\r\n\r\n\t\t/*\r\n\t\t * Firefox 2.0\r\n\t\t */\r\n\t\t} else {\r\n\t\t\tresult = {\r\n\t\t\t\tx : element.offsetLeft - element.scrollLeft,\r\n\t\t\t\ty : element.offsetTop - element.scrollTop\r\n\t\t\t}\r\n\t\t\twhile ( element.offsetParent ) {\r\n\t\t\t\telement = element.offsetParent;\r\n\t\t\t\tresult.x += ( element.offsetLeft - element.scrollLeft );\r\n\t\t\t\tresult.y += ( element.offsetTop - element.scrollTop );\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\tif ( isUniversal ) {\r\n\t\t\tvar win = DOMUtil.getParentWindow ( element );\r\n\t\t\tif ( win ) {\r\n\t\t\t\tvar frame = win.frameElement;\r\n\t\t\t\tif ( frame ) {\r\n\t\t\t\t\tvar add = DOMUtil.getUniversalPosition ( frame );\r\n\t\t\t\t\tresult.x += add.x;\r\n\t\t\t\t\tresult.y += add.y;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn new Point ( result.x, result.y );\r\n\t},\r\n\r\n\t/**\r\n\t * @param {MouseEvent} e\r\n\t */\r\n\tgetGlobalMousePosition : function ( e ) {\r\n\r\n\t\treturn this._getMousePosition ( e, false );\r\n\t},\r\n\r\n\t/**\r\n\t * @param {MouseEvent} e\r\n\t */\r\n\tgetUniversalMousePosition : function ( e ) {\r\n\r\n\t\treturn this._getMousePosition ( e, true );\r\n\t},\r\n\r\n\t/**\r\n\t * @param {MouseEvent} e\r\n\t * @param {boolean} isUniversal\r\n\t * @ignore\r\n\t */\r\n\t_getMousePosition : function ( e, isUniversal ) {\r\n\r\n\t\tvar element = DOMEvents.getTarget ( e );\r\n\r\n\t\tvar result = {\r\n\t\t\tx : e.clientX,\r\n\t\t\ty : e.clientY\r\n\t\t}\r\n\r\n\t\tif ( isUniversal ) {\r\n\t\t\tvar frame = this.getParentWindow ( element ).frameElement;\r\n\t\t\tif ( frame ) {\r\n\t\t\t\tvar add = this.getUniversalPosition ( frame );\r\n\t\t\t\tresult.x += add.x;\r\n\t\t\t\tresult.y += add.y;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_DOMUtil}\r\n */\r\nvar DOMUtil = new _DOMUtil ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/dom/XMLParser.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction _XMLParser () {}\r\n\r\n_XMLParser.prototype = {\r\n\r\n\t_logger: SystemLogger.getLogger(\"XMLParser\"),\r\n\t_domParser: (window.DOMParser != null && window.XPathResult != null ? new DOMParser() : null),\r\n\r\n\t/**\r\n\t* @param {string} xml\r\n\t* @param @optional {boolean} If true, ignore all parse errors.\r\n\t* @return {DOMDocument}\r\n\t*/\r\n\tparse: function (xml, isIgnore) {\r\n\r\n\t\tvar doc = null;\r\n\r\n\t\tif (xml != null) {\r\n\t\t\tif (this._domParser != null) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tdoc = this._domParser.parseFromString(xml, \"text/xml\");\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\talert(xml)\r\n\t\t\t\t}\r\n\t\t\t\tif (doc.documentElement.namespaceURI == Constants.NS_DOMPARSEERROR) {\r\n\t\t\t\t\tif (!isIgnore) {\r\n\t\t\t\t\t\tthis._logger.error(DOMSerializer.serialize(doc.documentElement, true));\r\n\t\t\t\t\t\tif (Application.isDeveloperMode) {\r\n\t\t\t\t\t\t\talert(\"XMLParser failed: \\n\\n\" + DOMSerializer.serialize(doc.documentElement, true));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdoc = null;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tdoc = DOMUtil.getDOMDocument();\r\n\t\t\t\tdoc.setProperty(\"ProhibitDTD\", false);\r\n\t\t\t\tdoc.validateOnParse = false;\r\n\t\t\t\tdoc.async = false;\r\n\t\t\t\tdoc.loadXML(xml);\r\n\t\t\t\tif (doc.parseError.errorCode != 0) {\r\n\t\t\t\t\tif (!isIgnore) {\r\n\t\t\t\t\t\tthis._logger.error(\"XMLParser failed!\");\r\n\t\t\t\t\t\tif (Application.isDeveloperMode) {\r\n\t\t\t\t\t\t\talert(\"XMLParser failed!\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdoc = null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthrow \"XMLParser: No XML input to parse!\";\r\n\t\t}\r\n\r\n\t\treturn doc;\r\n\t},\r\n\r\n\t/**\r\n\t* Is xml parsable as full document? Note that we allow a string  \r\n\t* with no XML declaration. This may not be the best idea... \r\n\t* @param {string} xml\r\n\t* @param @optional {boolean} hasDialog If true, automatically show a dialog\r\n\t*/\r\n\tisWellFormedDocument: function (xml, hasDialog, isConfirmDialog) {\r\n\r\n\t\tvar result = true;\r\n\t\tvar dec = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\r\n\t\tif (xml.indexOf(\"<?xml \") == -1) {\r\n\t\t\txml = dec + xml;\r\n\t\t}\r\n\t\tvar string = SourceValidationService.IsWellFormedDocument(xml);\r\n\r\n\t\tif (string != \"True\") {\r\n\t\t\tresult = false;\r\n\t\t\tif (hasDialog == true) {\r\n\t\t\t\tif (isConfirmDialog) {\r\n\t\t\t\t\tif (confirm(\"Not well-formed\\n\" + string + \"\\nContinue?\")) {\r\n\t\t\t\t\t\tresult = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}else {\r\n\t\t\t\t\tthis._illFormedDialog(string);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* Is xml parsable as full document fragment?\r\n\t* @param {string} xml\r\n\t* @param @optional {boolean} hasDialog  If true, automatically show a dialog\r\n\t*/\r\n\tisWellFormedFragment: function (xml, hasDialog) {\r\n\r\n\t\tvar result = true;\r\n\t\tvar string = SourceValidationService.IsWellFormedFragment(xml);\r\n\r\n\t\tif (string != \"True\") {\r\n\t\t\tresult = false;\r\n\t\t\tif (hasDialog == true) {\r\n\t\t\t\tthis._illFormedDialog(string);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t* In case of malformed XML, analyze server parser \r\n\t* exception and present a clarifying dialog. \r\n\t* @param {String} string\r\n\t*/\r\n\t_illFormedDialog: function (string) {\r\n\r\n\t\t/*\r\n\t\t* Timeout allows any previous method to returnvalue first.\r\n\t\t*/\r\n\t\tsetTimeout(function () {\r\n\t\t\tDialog.error(\"Not well-formed\", string);\r\n\t\t}, 0);\r\n\t}\r\n}\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_XMLParser}\r\n */\r\nvar XMLParser = new _XMLParser ();"
  },
  {
    "path": "Website/Composite/scripts/source/top/dom/XPathResolver.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction XPathResolver () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"XPathResolver\" );\r\n\r\n\t/**\r\n\t * @type {XPathEvaluator}\r\n\t */\r\n\tthis._evaluator = window.XPathEvaluator ? new XPathEvaluator () : null;\r\n\t\r\n\t/**\r\n \t * @type {HashMap<string><string>}\r\n \t */\r\n\tthis._nsResolver = null;\r\n}\r\n\r\n/**\r\n * @param {HashMap<string><string>} hashMap\r\n */\r\nXPathResolver.prototype.setNamespacePrefixResolver = function ( hashMap ) {\r\n\r\n\tif ( this._evaluator ) {\r\n\t\tthis._nsResolver = {\r\n\t\t\tlookupNamespaceURI : function ( prefix ) {\r\n\t\t\t\treturn hashMap [ prefix ];\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tthis._nsResolver = hashMap;\r\n\t }\r\n}\r\n\r\n/**\r\n * In effect implementing Microsofts \"selectSingleNode\" method.\r\n * @param {string} xpath\r\n * @param {DOMNode} node\r\n * @param {boolean} isMultiple\r\n * @return {DOMElement)\r\n */\r\nXPathResolver.prototype.resolve = function ( xpath, node, isMultiple ) {\r\n\t\r\n\tvar result = null;\r\n\ttry {\r\n\t\tif ( this._evaluator ) {\r\n\t\t\tresult = this._evaluateDOMXpath ( xpath, node, isMultiple ? true : false );\t\r\n\t\t} else {\r\n\t\t\tresult = this._evaluateMSXpath ( xpath, node, isMultiple ? true : false );\r\n\t\t}\r\n\t} catch ( exception ) {\r\n\t\talert ( \"XPathResolver#resolve: \" + exception );\r\n\t\tif ( exception.stack ) {\r\n\t\t\talert ( exception.stack );\r\n\t\t} else {\r\n\t\t\talert ( arguments.caller.callee.toString ());\r\n\t\t}\r\n\t\tthrow exception;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * In effect implementing Microsofts \"selectNode\" method.\r\n * @param {string} xpath\r\n * @param {DOMNode} node\r\n * @return {List)\r\n */\r\nXPathResolver.prototype.resolveAll = function ( xpath, node ) {\r\n\r\n\treturn this.resolve ( xpath, node, true );\r\n}\r\n\r\n/**\r\n * Evaluate DOM3 style.\r\n * @param {string} xpath\r\n * @param {DOMNode} node\r\n * @param {boolean} isMultiple\r\n * @return {object) Either a DOMElement or a List (depends on isMultiple).\r\n * @private\r\n */\r\nXPathResolver.prototype._evaluateDOMXpath = function ( xpath, node, isMultiple ) {\r\n\t\r\n\tvar result = null;\r\n\t\r\n\tif ( node ) {\r\n\t\tvar result = this._evaluator.evaluate ( \r\n\t\t\txpath, node, this._nsResolver, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null \r\n\t\t);\r\n\t\tif ( isMultiple ) {\r\n\t\t\tvar list = new List ();\r\n\t\t\twhile (( node = result.iterateNext ()) != null ) {\r\n\t\t\t\tlist.add ( node );\r\n\t\t\t}\r\n\t\t\tresult = list;\r\n\t\t} else {\r\n\t\t\tresult = result.iterateNext ();\r\n\t\t}\r\n\t} else {\r\n\t\tvar cry = \"XPathResolver#_evaluateDOMXpath: No DOMNode to evaluate!\";\r\n\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\talert ( cry );\r\n\t\t} else {\r\n\t\t\tthis.logger.fatal ( cry );\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Evaluate Microsoft style.\r\n * @param {string} xpath\r\n * @param {DOMNode} node\r\n * @param {boolean} isMultiple\r\n * @return {object) Either a DOMElement or a List\r\n * @private\r\n */\r\nXPathResolver.prototype._evaluateMSXpath = function ( xpath, node, isMultiple ) {\r\n\t\r\n\tvar doc = ( node.nodeType == Node.DOCUMENT_NODE ? node : node.ownerDocument );\r\n\t\r\n\t/*\r\n\t * define selectionnamespaces on each xpath evaluation. this way, one \r\n\t * single XPathResolver can be used to evaluate multiple documents. \r\n\t * TODO: why doesnt it work when reading getProperty?\r\n\t */\r\n\tvar nsDeclarations = \"\";\r\n\tfor ( var prefix in this._nsResolver ) {\r\n\t\tnsDeclarations += \"xmlns:\" + prefix + \"=\\\"\" + this._nsResolver [ prefix ] + \"\\\" \";\t\r\n\t}\r\n\tdoc.setProperty ( \"SelectionNamespaces\", nsDeclarations );\t\r\n\t\r\n\tif ( isMultiple ) {\r\n\t\tvar list = new List ();\r\n\t\tvar i = 0, nodes = node.selectNodes ( xpath );\r\n\t\twhile ( i < nodes.length ) {\r\n\t\t\tlist.add ( nodes.item ( i++ ));\r\n\t\t}\r\n\t\tresult = list;\r\n\t} else {\r\n\t\tresult = node.selectSingleNode ( xpath );\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/dom/XSLTransformer.js",
    "content": "/**\r\n * @class\r\n * XSL transformers rule.\r\n */\r\nfunction XSLTransformer () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"XSLTransformer\" );\r\n\t\r\n\t/**\r\n\t * @type {MSXMLXSLTemplate}\r\n\t */\r\n\tthis._processor = null;\r\n\t\r\n\t/**\r\n\t * @type {MSXMLXSLTemplate}\r\n\t */\r\n\tthis._cache = null;\r\n}\r\n\r\n/**\r\n * Import stylesheet.\r\n * @param {string} url\r\n */\r\nXSLTransformer.prototype.importStylesheet = function ( url ) {\r\n\t\r\n\tvar stylesheet = this._import ( \r\n\t\tResolver.resolve ( url )\r\n\t);\r\n\t\r\n\tif (Client.hasXSLTProcessor) {\r\n\t\tthis._processor = new XSLTProcessor ();\r\n\t\tthis._processor.importStylesheet ( stylesheet );\r\n\t} else {\t\r\n\t\tthis._cache = DOMUtil.getMSXMLXSLTemplate ();\r\n\t\tthis._cache.stylesheet = stylesheet;\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {string} url\r\n * @return {DOMDocument}\r\n */\r\nXSLTransformer.prototype._import = function ( url ) {\r\n\r\n\tvar result = null;\r\n\r\n\tif (Client.hasXSLTProcessor) {\r\n\t\r\n\t\tvar request = DOMUtil.getXMLHTTPRequest ();\r\n\t\trequest.open ( \"get\", Resolver.resolve ( url ),  false );\r\n\t\trequest.send ( null );\r\n\t\tresult = request.responseXML;\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tvar result = DOMUtil.getDOMDocument ( true );\r\n\t\tresult.async = false;\r\n\t\tresult.load ( url );\r\n\t}\r\n\t\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {DOMDocument} dom\r\n * @return {DOMDocument}\r\n */\r\nXSLTransformer.prototype.transformToDocument = function ( dom ) {\r\n\t\r\n\tvar result = null;\r\n\tif (Client.hasXSLTProcessor) {\r\n\t\tresult = this._processor.transformToDocument ( dom );\r\n\t} else {\r\n\t\talert ( \"TODO!\" );\r\n\t}\r\n\treturn result;\r\n\t\r\n}\r\n\r\n/**\r\n * @param {DOMDocument} dom\r\n * @param {boolean} isPrettyPrint\r\n * @return {string}\r\n */\r\nXSLTransformer.prototype.transformToString = function ( dom, isPrettyPrint ) {\r\n\t\r\n\tvar result = null;\r\n\tif (Client.hasXSLTProcessor) {\r\n\t\tvar doc = this.transformToDocument ( dom );\r\n\t\tresult = DOMSerializer.serialize ( doc, isPrettyPrint ); \r\n\t} else {\r\n\t\tvar proc = this._cache.createProcessor ();\r\n\t\tproc.input = dom;\r\n\t\tproc.transform ();\r\n\t\tresult = proc.output;\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IAcceptable.js",
    "content": "/**\r\n * @class\r\n * Acceptable.\r\n */\r\nvar IAcceptable = new function () {\r\n\t\r\n\t/** \r\n\t * Whitespace separated.\r\n\t * @type {string}\r\n\t */\r\n\tthis.dragAccept = \"type1 type2 type3\";\r\n\t\r\n\t/**\r\n\t * @param {IDraggable} binding\r\n\t */\r\n\tthis.accept = function ( binding ) {}\r\n\t\r\n\t/**\r\n\t * Indicate acceptance when drag starts (whereever drag starts). OPTIONAL!\r\n\t *\r\n\tthis.showGeneralAcceptance = function () {}\r\n\t*/\r\n\t\r\n\t/**\r\n\t * Don't indicate acceptance (whereever drag started). OPTIONAL!\r\n\t *\r\n\tthis.hideGeneralAcceptance = function () {}\r\n\t*/\r\n\t\r\n\t/**\r\n\t * Indicate acceptance (onmouseover). OPTIONAL!\r\n\t *\r\n\tthis.showAcceptance = function () {}\r\n\t*/\r\n\t\r\n\t/**\r\n\t * Don't indicate acceptance (onmouseout). OPTIONAL!\r\n\t *\r\n\tthis.hideAcceptance = function () {}\r\n\t*/\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IActionListener.js",
    "content": "/**\r\n * @class\r\n * Action listener.\r\n */\r\nvar IActionListener = new function () {\r\n\r\n\t/**\r\n\t * @param {Action} action\r\n\t */\r\n\tthis.handleAction = function ( action ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IActivatable.js",
    "content": "/**\r\n * @class\r\n * Activatable binding.\r\n * @see {DockBinding}\r\n * @see {DialogBinding}\r\n */\r\nvar IActivatable = new function () {\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivatable = true;\r\n\t\r\n\t/**\r\n\t * Activate.\r\n\t */\r\n\tthis.activate = function () {}\r\n\t\r\n\t/**\r\n\t * Deactivate\r\n\t */\r\n\tthis.deActivate = function () {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IActivationAware.js",
    "content": "/**\r\n * @class\r\n * Activation-aware binding.\r\n * @see {DockBinding}\r\n * @see {DialogBinding}\r\n */\r\nvar IActivationAware = new function () {\r\n\t\r\n\t/**\r\n\t * @implements {IActivationAware}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivationAware = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivated = false;\r\n\t\r\n\t/**\r\n\t * Invoked when the nearest containing \r\n\t * {@link IActivatable} gets activated.\r\n\t */\r\n\tthis.onActivate = function () {}\r\n\t\r\n\t/**\r\n\t * Invoked when the nearest containing \r\n\t * {@link IActivatable} gets activated.\r\n\t */\r\n\tthis.onDeactivate = function () {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IBroadcastListener.js",
    "content": "/**\r\n * @class\r\n * BroadcastListener. \r\n * @see {EventBroadcaster}\r\n */\r\nvar IBroadcastListener = new function () {\r\n\t\r\n\t/**\r\n\t * Handle broadcast.\r\n\t * @param {string} broadcast\r\n\t * param {object} optional\r\n\t */\r\n\tthis.handleBroadcast = function ( broadcast, optional ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IContextContainerBinding.js",
    "content": "﻿/**\n * @class\n * ContextContainerBinding\n */\nvar IContextContainerBinding = new function () {\n\n\t/**\n\t */\n\tthis.getContextContainer = function () { }\n\n\t/**\n\t * @param {Binding} binding\n\t */\n\tthis.setContextContainer = function (contextContainer) { }\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/ICrawlerHandler.js",
    "content": "/**\r\n * @class\r\n * Crawler handler. \r\n * @see {UICrawler}\r\n */\r\nvar ICrawlerHandler = new function () {\r\n\r\n\t/**\r\n\t * @param {Crawler} crawler\r\n\t */\r\n\tthis.handleCrawler = function ( crawler ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IDOMHandler.js",
    "content": "/**\r\n * Load handler.\r\n */\r\nvar IDOMHandler = new function () {\r\n\t\r\n\t/**\r\n\t * Fire on DOMContentLoaded.\r\n\t */\r\n\tthis.fireOnDOM = function () {};\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IData.js",
    "content": "/**\r\n * @class\r\n * @implements {IFocusable}\r\n */\r\nvar IData = new function () {\r\n\t\r\n\t/**\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\t\r\n\t/**\r\n\t * Validate.\r\n\t * @return {boolean}\r\n\t */\r\n\tthis.validate = function () {};\r\n\t\r\n\t/**\r\n\t * Manifest. This will write form elements into page DOM \r\n\t * so that the server recieves something on form submit.\r\n\t * @return {Binding} Although we probably return null...\r\n\t */\r\n\tthis.manifest = function () {};\r\n\t\r\n\t/**\r\n\t * Mark binding dirty and set a flag in the local DataManager. \r\n\t */\r\n\tthis.dirty = function () {};\r\n\t\r\n\t/**\r\n\t * Remove the dirty mark.\r\n\t */\r\n\tthis.clean = function () {};\r\n\t\r\n\t/**\r\n\t * Focus.\r\n\t * @implements {IFocusable}\r\n\t */\r\n\tthis.focus = function () {};\r\n\t\r\n\t/**\r\n\t * Blur.\r\n\t * @implements {IFocusable}\r\n\t */\r\n\tthis.blur = function () {};\r\n\t\r\n\t/**\r\n\t * Get name.\r\n\t * @return {string}\r\n\t */\r\n\tthis.getName = function () {};\r\n\t\r\n\t/**\r\n\t * Get value. This is intended for serverside processing.\r\n\t * @return {string}\r\n\t */\r\n\tthis.getValue = function () {};\r\n\t\r\n\t/**\r\n\t * Set value.\r\n\t * @param {string} value\r\n\t */\r\n\tthis.setValue = function ( value ) {};\r\n\t\r\n\t/**\r\n\t * Get result. This is intended for clientside processing.\r\n\t * @return {object}\r\n\t */\r\n\tthis.getResult = function () {};\r\n\t\r\n\t/**\r\n\t * Set result.\r\n\t * @see {DataManager#populateDataBindings}\r\n\t * @param {object} result\r\n\t */\r\n\tthis.setResult = function ( result ) {};\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IDialogResponseHandler.js",
    "content": "/**\r\n * @class\r\n * DialogHandler.\r\n */\r\nvar IDialogResponseHandler = new function () {\r\n\t\r\n\t/**\r\n\t * Handle broadcast.\r\n\t * @param {object} response\r\n\t * @param {object} result Optional\r\n\t */\r\n\tthis.handleDialogResponse = function () { response, result }\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IDragHandler.js",
    "content": "/**\r\n * @class\r\n * Drag handler.\r\n */\r\nvar IDragHandler = new function () {\r\n\t\r\n\t/**\r\n\t * @param {Point} point\r\n\t */\r\n\tthis.onDragStart = function ( point ) {}\r\n\t\r\n\t/**\r\n\t * @param {Point} diff\r\n\t */\r\n\tthis.onDrag = function ( diff ) {}\r\n\t\r\n\t/**\r\n\t * @param {Point} diff\r\n\t */\r\n\tthis.onDragStop = function ( diff ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IDraggable.js",
    "content": "/**\r\n * @class\r\n * Draggable.\r\n */\r\nvar IDraggable = new function () {\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.dragType = \"type\";\r\n\t\r\n\t/**\r\n\t * @return {string}\r\n\t */\r\n\tthis.getImage = function () {}\r\n\t\r\n\t/**\r\n\t * Indicate drag. OPTIONAL!\r\n\t *\r\n\tthis.showDrag = function () {}\r\n\t*/\r\n\t\r\n\t/**\r\n\t * Don't indicate drag. OPTIONAL!\r\n\t *\r\n\tthis.hideDrag = function () {}\r\n\t*/\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IEditorControlBinding.js",
    "content": "/**\r\n * @class\r\n */\r\nvar IEditorControlBinding = new function () {\r\n\t\r\n\t/**\r\n\t * Indicates that editors should not blur \r\n\t * the toolbars when binding is handled.\r\n\t * @see {TinyMCE_CompositeTheme#initialize}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEditorControlBinding = true;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IEventListener.js",
    "content": "/**\r\n * @class\r\n * DOM2 EventListener interface.\r\n */\r\nvar IEventListener = new function () {\r\n\r\n\t/**\r\n\t * @param {Event} e\r\n\t */\r\n\tthis.handleEvent = function ( e ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IFit.js",
    "content": "/**\r\n * @class\r\n */\r\nvar IFit = new function () {\r\n\r\n\t/**\r\n\t * Is fit?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFit = true;\r\n\t\r\n\t/**\r\n\t * Fit!\r\n\t * @return {boolean} True if dimension changed\r\n\t */\r\n\tthis.fit = function () {\r\n\t\t\r\n\t\treturn true;\r\n\t};\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IFlexible.js",
    "content": "/**\r\n * @class\r\n */\r\nvar IFlexible = new function () {\r\n\r\n\t/**\r\n\t * Flex.\r\n\t */\r\n\tthis.flex = function () {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IFocusable.js",
    "content": "/**\r\n * @class\r\n * This fellow is supposed to be focused specifically by use of the tab key. \r\n */\r\nvar IFocusable = new function () {\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\t\r\n\t/**\r\n\t * Focus.\r\n\t */\r\n\tthis.focus = function () {\r\n\t\r\n\t\tthis.dispatchAction ( Binding.ACTION_FOCUSED );\r\n\t}\r\n\t\r\n\t/**\r\n\t * Blur.\r\n\t */\r\n\tthis.blur = function () {\r\n\t\r\n\t\tthis.dispatchAction ( Binding.ACTION_BLURRED );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IImageProfile.js",
    "content": "/**\r\n * @class\r\n * Image profile interface.\r\n */\r\nvar IImageProfile = new function () {\r\n\r\n\t/**\r\n\t * Get default image.\r\n\t * @return {string}\r\n\t */\r\n\tthis.getDefaultImage = function () {}\r\n\r\n\t/**\r\n\t * Get hover image.\r\n\t * @return {string}\r\n\t */\r\n\tthis.getHoverImage = function () {}\r\n\t\r\n\t/**\r\n\t * Get active image.\r\n\t * @return {string}\r\n\t */\r\n\tthis.getActiveImage = function () {}\r\n\t\r\n\t/**\r\n\t * Get disabled image.\r\n\t * @return {string}\r\n\t */\r\n\tthis.getDisabledImage = function () {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IKeyEventHandler.js",
    "content": "/**\r\n * @class\r\n * Key event handler.\r\n */\r\nvar IKeyEventHandler = new function () {\r\n\t\r\n\t/**\r\n\t * Handle key event.\r\n\t */\r\n\tthis.handleKeyEvent = function () {};\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/ILabel.js",
    "content": "/**\r\n * @class\r\n * Label interface.\r\n */\r\nvar ILabel = new function () {\r\n\t\r\n\t/**\r\n\t * @return {string}.\r\n\t */\r\n\tthis.getLabel = function () {}\r\n\t\r\n\t/**\r\n\t * @return {string}.\r\n\t */\r\n\tthis.getImage = function () {}\r\n\t\r\n\t/**\r\n\t * @return {string}.\r\n\t */\r\n\tthis.getToolTip = function () {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/ILoadHandler.js",
    "content": "/**\r\n * @class\r\n * Load handler.\r\n */\r\nvar ILoadHandler = new function () {\r\n\t\r\n\t/**\r\n\t * Fire on load.\r\n\t */\r\n\tthis.fireOnLoad = function () {}\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IMenuContainer.js",
    "content": "/**\r\n * @class\r\n * Menucontainer.\r\n */\r\nvar IMenuContainer = new function () {\r\n\t\r\n\t/**\r\n\t * @return {boolean}\r\n\t */\r\n\tthis.isOpen = function () {}\r\n\t\r\n\t/**\r\n\t * @param {Binding} binding\r\n\t */\r\n\tthis.setOpenElement = function ( binding ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IResizeHandler.js",
    "content": "/**\r\n * @class\r\n * Resize handler.\r\n */\r\nvar IResizeHandler = new function () {\r\n\t\r\n\t/**\r\n\t * Fire on load.\r\n\t */\r\n\tthis.fireOnResize = function () {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/ISourceEditorComponent.js",
    "content": "/**\r\n * @class\r\n */\r\nvar ISourceEditorComponent = new function () {\r\n\t\r\n\t/**\r\n\t * TODO: REPLACE WITH BESPINEDITORCOMPONENT! \r\n\t * @param {SourceEditorBinding} editor\r\n\t * @param {HTMLIframeElement} frame\r\n\t * @type {CodePress} engine\r\n\t */\r\n\tthis.initializeSourceEditorComponent = function ( editor, frame, engine ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IUpdateHandler.js",
    "content": "/**\r\n * Update handler interface.\r\n */\r\nvar IUpdateHandler = new function () {\r\n\r\n\t/**\r\n\t * Handle element update?\r\n\t * @param {Element} newelement\r\n\t * @param {Element} oldelement\r\n\t * @returns {boolean} \r\n\t */\r\n\tthis.handleElement = function ( newelement, oldelement ) {};\r\n\t\r\n\t/**\r\n\t * Update element.\r\n\t * @implements {IUpdateHandler}\r\n\t * @param {Element} newelement\r\n\t * @param {Element} oldelement\r\n\t * @returns {boolean} \r\n\t */\r\n\tthis.updateElement = function ( newelement, oldelement ) {};\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IWysiwygEditorComponent.js",
    "content": "/**\r\n * @class\r\n */\r\nvar IWysiwygEditorComponent = new function () {\r\n\t\r\n\t/**\r\n\t * @param {WysiwygEditorBinding} editor\r\n\t * @param {TinyMCE_Engine} engine\r\n \t * @param {TinyMCE_Control} instance\r\n \t * @param {TinyMCE_CompositeTheme} theme\r\n\t */\r\n\tthis.initializeComponent = function ( editor, engine, instance, theme ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IWysiwygEditorContentChangeHandler.js",
    "content": "/**\r\n * @class\r\n */\r\nvar IWysiwygEditorContentChangeHandler = new function () {\r\n\t\r\n\t/**\r\n\t * Handle content change.\r\n\t */\r\n\tthis.handleContentChange = function () {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/interfaces/IWysiwygEditorNodeChangeHandler.js",
    "content": "/**\r\n * @class\r\n */\r\nvar IWysiwygEditorNodeChangeHandler = new function () {\r\n\t\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t */\r\n\tthis.handleNodeChange = function ( element ) {}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/namespaces/Namespaces.js",
    "content": ""
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/ConfigurationService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar ConfigurationService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/ConsoleMessageQueueService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar ConsoleMessageQueueService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/DiffService.js",
    "content": "/**\r\n * This fellow is NOT ANIMATED on startup!\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar DiffService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/EditorConfigurationService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar EditorConfigurationService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/FlowControllerService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar FlowControllerService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/FunctionService.js",
    "content": "﻿/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar FunctionService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/InstallationService.js",
    "content": "/**\r\n * Animated when KickStart kicks in.\r\n * @see {KickStart#fireOnLoad}\r\n * @type {WebServiceProxy}\r\n */\r\nvar InstallationService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/LocalizationService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar LocalizationService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/LoginService.js",
    "content": "/**\r\n * Animated when KickStart kicks in.\r\n * @see {KickStart#fireOnLoad}\r\n * @type {WebServiceProxy}\r\n */\r\nvar LoginService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/MarkupFormatService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar MarkupFormatService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/PageService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar PageService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/PageTemplateService.js",
    "content": "﻿/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar PageTemplateService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/ReadyService.js",
    "content": "/**\r\n * Animated when KickStart kicks in.\r\n * @see {KickStart#fireOnLoad}\r\n * @type {WebServiceProxy}\r\n */\r\nvar ReadyService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/SEOService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar SEOService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/SecurityService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar SecurityService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/SetupService.js",
    "content": "/**\r\n * Animated when KickStart kicks in.\r\n * @see {KickStart#fireOnLoad}\r\n * @type {WebServiceProxy}\r\n */\r\nvar SetupService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/SourceValidationService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar SourceValidationService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/StringService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar StringService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/TreeService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar TreeService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/proxies/XhtmlTransformationsService.js",
    "content": "/**\r\n * Animated when user logs in.\r\n * @see {Application#login}\r\n * @type {WebServiceProxy}\r\n */\r\nvar XhtmlTransformationsService = null;"
  },
  {
    "path": "Website/Composite/scripts/source/top/schema/Schema.js",
    "content": "Schema.prototype = new XPathResolver;\r\nSchema.prototype.constructor = Schema;\r\nSchema.superclass = XPathResolver.prototype;\r\n\r\n/**\r\n * @type {HashMap<string><string>}\r\n */\r\nSchema.types = {\r\n\tSTRING\t: \"string\",\r\n\tINT\t\t: \"int\",\r\n\tFLOAT\t: \"float\",\r\n\tDOUBLE\t: \"double\",\r\n\tBOOLEAN\t: \"boolean\"\r\n}\r\n\r\n/**\r\n * @type {Error}\r\n */\r\nSchema.notSupportedException = new Error ( \r\n\t\"Schema: Schema structure not supported!\"\r\n);\r\n\r\n/**\r\n * @class\r\n * @param {DOMElement} element\r\n */\r\nfunction Schema ( element ) {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"Schema\" );\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><object>)\r\n\t */\r\n\tthis._map = this._parseSchema ( element );\r\n}\r\n\r\n/**\r\n * @param {DOMElement} element\r\n * @return {HashMmap<string><object>}\r\n */\r\nSchema.prototype._parseSchema = function ( element ) {\r\n\t\r\n\tthis.setNamespacePrefixResolver ({\r\n\t\t\"wsdl\"\t: Constants.NS_WSDL,\r\n\t\t\"soap\"\t: Constants.NS_SOAP,\r\n\t\t\"s\" \t: Constants.NS_SCHEMA\r\n\t});\r\n\t\r\n\tvar result = {};\r\n\tvar entry = null;\r\n\tvar rules = this.resolveAll ( \"s:*[@name]\", element );\r\n\t\r\n\twhile ( rules.hasNext ()) {\t\r\n\t\tvar rule = rules.getNext ();\r\n\t\tswitch ( DOMUtil.getLocalName ( rule )) {\r\n\t\t\tcase \"element\" :\r\n\t\t\t\tentry = new SchemaElementType ( this, rule );\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"complexType\" :\r\n\t\t\t\tentry = new SchemaComplexType ( this, rule );\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"simpleType\" :\r\n\t\t\t\tentry = new SchemaSimpleType ( this, rule );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tresult [ rule.getAttribute ( \"name\" )] = entry;\r\n\t};\r\n\t\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {string} name\r\n * @return {SchemaType}\r\n */\r\nSchema.prototype.lookup = function ( name ) {\r\n\t\r\n\treturn this._map [ name ];\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/schema/SchemaComplexType.js",
    "content": "SchemaComplexType.prototype = new SchemaType;\r\nSchemaComplexType.prototype.constructor = SchemaComplexType;\r\nSchemaComplexType.superclass = SchemaType.prototype;\r\n\r\n/**\r\n * @param {Schema} schema\r\n * @param {DOMElement} element\r\n */\r\nfunction SchemaComplexType ( schema, element ) {\r\n\t\r\n\t/** \r\n\t * @type {List} \r\n\t * @private\r\n\t */\r\n\tthis._definitions = new List ();\r\n\tthis._parseListedDefinitions ( schema, element );\r\n\t\r\n\t/**\r\n\t * TODO: Use schema structure instead of name? This could be very MS specific...\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isArray = element.getAttribute ( \"name\" ).indexOf ( \"ArrayOf\" ) >-1;\r\n}\r\n\r\n/**\r\n * @param {Schema} schema\r\n * @param {DOMElement} element\r\n * @throws Schema.notSupportedException \r\n * @private\r\n */\r\nSchemaComplexType.prototype._parseListedDefinitions = function ( schema, element ) {\r\n\r\n\tvar els = schema.resolveAll ( \"s:sequence/s:element\", element );\r\n\t\r\n\tif ( els.hasEntries ()) {\r\n\t\twhile ( els.hasNext ()) {\r\n\t\t\tvar el = els.getNext ();\r\n\t\t\tthis._definitions.add ( \r\n\t\t\t\tnew SchemaDefinition ( el )\r\n\t\t\t);\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\tvar name = el.getAttribute ( \"name\" );\r\n\t\t\tthis [ name ] = new SchemaDefinition ( el );\r\n\t\t\talert ( el.nodeName + \": \" + name );\r\n\t\t\t*/\r\n\t\t}\r\n\t} else throw Schema.notSupportedException;\t\r\n}\r\n\r\n/** \r\n * @return {List} \r\n */\r\nSchemaComplexType.prototype.getListedDefinitions = function () {\r\n\r\n\treturn this._definitions.copy ();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/schema/SchemaDefinition.js",
    "content": "/**\r\n * TODO: place this around here?\r\n */\r\nSchemaDefinition.TYPE_XML_DOCUMENT = \"xmldocument\";\r\n\r\n\r\n/**\r\n * @class\r\n * @param {DOMElement} element\r\n */\r\nfunction SchemaDefinition ( element ) {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SchemaDefinition\" );\r\n\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isRequired\t= null;\r\n\t\r\n\t/** \r\n\t * @type {string} \r\n\t */\r\n\tthis.type = null;\r\n\t\r\n\t/*\r\n\t * Populate me! \r\n\t */\r\n\tthis._parse ( element );\r\n}\r\n\r\n/**\r\n * @param {DOMElement} element\r\n * @private\r\n */\r\nSchemaDefinition.prototype._parse = function ( element ) {\r\n\t\r\n\tvar min \t= element.getAttribute ( \"minOccurs\" );\r\n\tvar max \t= element.getAttribute ( \"maxOccurs\" );\r\n\tvar type\t= element.getAttribute ( \"type\" );\r\n\t\r\n\tthis.name = element.getAttribute ( \"name\" );\r\n\tthis.isRequired\t= min != \"0\";\r\n\t\r\n\tif ( type ) {\r\n\t\r\n\t\tvar split\t= type.split ( \":\" );\r\n\t\tvar sort\t= split [ 0 ];\r\n\t\tvar typedef\t= split [ 1 ];\r\n\t\t\r\n\t\tthis.isSimpleValue  = sort != \"tns\";\r\n\t\tthis.type \t\t\t= typedef;\t\r\n\t\r\n\t\t//alert ( \"OK\\n\" + DOMSerializer.serialize ( element, true ));\r\n\t\r\n\t} else {\r\n\t\t\r\n\t\t/* \r\n\t\t * TODO: rewrite to xpath, fetch a resolver somehow...\r\n\t\t */\r\n\t\tvar elm = element.getElementsByTagName ( \"*\" ).item ( 0 );\r\n\t\tif ( elm && DOMUtil.getLocalName ( elm ) == \"complexType\" && elm.getAttribute ( \"mixed\" ) == \"true\" ) {\r\n\t\t\telm = elm.getElementsByTagName ( \"*\" ).item ( 0 );\r\n\t\t\tif ( elm && DOMUtil.getLocalName ( elm ) == \"sequence\" ) {\r\n\t\t\t\telm = elm.getElementsByTagName ( \"*\" ).item ( 0 );\r\n\t\t\t\tif ( DOMUtil.getLocalName ( elm ) == \"any\" ) {\r\n\t\t\t\t\tthis.type = SchemaDefinition.TYPE_XML_DOCUMENT;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/schema/SchemaElementType.js",
    "content": "SchemaElementType.prototype = new SchemaType;\r\nSchemaElementType.prototype.constructor = SchemaElementType;\r\nSchemaElementType.superclass = SchemaType.prototype;\r\n\r\n/**\r\n * @param {Schema} schema\r\n * @param {DOMElement} element\r\n */\r\nfunction SchemaElementType ( schema, element ) {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SchemaElementType\" );\r\n\t\r\n\t/** \r\n\t * @type {List} \r\n\t * @private\r\n\t */\r\n\tthis._definitions = new List ();\r\n\tthis._parseListedDefinitions ( schema, element );\r\n}\r\n\r\n/**\r\n * @param {Schema} schema\r\n * @param {DOMElement} element\r\n * @throws Schema.notSupportedException \r\n * @private\r\n */\r\nSchemaElementType.prototype._parseListedDefinitions = function ( schema, element ) {\r\n\r\n\tvar els = schema.resolveAll ( \"s:complexType/s:sequence/s:element\", element );\r\n\t\r\n\tif ( els.hasEntries ()) {\r\n\t\twhile ( els.hasNext ()) {\r\n\t\t\tthis._definitions.add ( \r\n\t\t\t\tnew SchemaDefinition ( els.getNext ())\r\n\t\t\t);\r\n\t\t}\r\n\t} else {\r\n\t\tthis.logger.warn ( \"SchemaElementType: Unparsed SchemaDefinition encountered.\" );\r\n\t\tthrow Schema.notSupportedException;\r\n\t}\r\n}\r\n\r\n/** \r\n * @return {List} \r\n */\r\nSchemaElementType.prototype.getListedDefinitions = function () {\r\n\r\n\treturn this._definitions.copy ();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/schema/SchemaSimpleType.js",
    "content": "SchemaSimpleType.prototype = new SchemaType;\r\nSchemaSimpleType.prototype.constructor = SchemaSimpleType;\r\nSchemaSimpleType.superclass = SchemaType.prototype;\r\n\r\n/**\r\n * @class\r\n * @param {Schema} schema\r\n * @param {DOMElement} element\r\n * @throws Schema.notSupportedException \r\n */\r\nfunction SchemaSimpleType ( schema, element ) {\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.restrictionType = null;\r\n\t\r\n\tthis._parse ( schema, element );\r\n}\r\n\r\n/**\r\n * TODO: Investigate what needs to be supported here besides enumerations.\r\n * @param {Schema} schema\r\n * @param {DOMElement} element\r\n * @throws Schema.notSupportedException \r\n */\r\nSchemaSimpleType.prototype._parse = function ( schema, element ) {\r\n\t\r\n\tvar restriction = schema.resolve ( \"s:restriction\", element );\r\n\tif ( restriction ) {\r\n\t\tthis.restrictionType = restriction.getAttribute ( \"base\" ).split ( \":\" )[ 1 ];\t\r\n\t} else {\r\n\t\tthrow Schema.notSupportedException;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/schema/SchemaType.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction SchemaType () {}\r\nSchemaType.prototype = {};"
  },
  {
    "path": "Website/Composite/scripts/source/top/services/WebServiceOperation.js",
    "content": "/**\r\n * @class\r\n * @param {string} name\r\n * @param {string} address\r\n * @param {SOAPEncoder} encoder\r\n * @param {SOAPDecoder} decoder\r\n */\r\nfunction WebServiceOperation ( name, address, encoder, decoder ) {\r\n\t\r\n\tthis.name\t\t= name;\r\n\tthis.address\t= address;\r\n\tthis.encoder \t= encoder;\r\n\tthis.decoder \t= decoder;\r\n}\r\n\r\nWebServiceOperation.prototype = {\r\n\t\r\n\tname : null,\r\n\taddress : null,\r\n\tencoder : null,\r\n\tdecoder : null\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/services/WebServiceProxy.js",
    "content": "/**\r\n * Logging SOAP? This has NO EFFECT in operational mode (only in developer mode)!\r\n * @type {boolean}\r\n */\r\nWebServiceProxy.isLoggingEnabled = true;\r\n\r\n/**\r\n * Flip this when webservice requests should return instances \r\n * of DOMDocument instead of javascript objects. \r\n * Remember to flip it back again!\r\n * @type {boolean}\r\n */\r\nWebServiceProxy.isDOMResult = false;\r\n\r\n/**\r\n * If set to true, the WebServiceProxy will display a special dialog on soap faults.\r\n * Whenever you adjust this property, remember to reset the value to true.\r\n * TODO: come up with some sort of SOAPFaultHandler to provide in webservice calls?\r\n * @type {boolean}\r\n */\r\nWebServiceProxy.isFaultHandler = true;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction WebServiceProxy () {\r\n\t\r\n\tthis.logger = SystemLogger.getLogger ( \"WebServiceProxy\" );\r\n}\r\n\r\n/**\r\n * Create webservice proxy.\r\n * @param {string} url\r\n * @return {WebServiceProxy}\r\n */\r\nWebServiceProxy.createProxy = function ( url ) {\r\n\t\r\n\tvar wsdl = new WebServiceResolver ( url );\r\n\tvar proxy = new WebServiceProxy ();\r\n\t\r\n\tvar operations \t= wsdl.getOperations ();\t\r\n\toperations.each ( function ( operation ) {\r\n\t\tproxy[operation.name] = WebServiceProxy.createProxyOperation(operation);\r\n\t});\r\n\t\r\n\treturn proxy;\r\n}\r\n\r\n/** \r\n * Logging SOAP in developermode.\r\n * @param {WebServiceOperation} operation\r\n * @param {SOAPMessage} soapMessage\r\n */\r\nWebServiceProxy.prototype._log = function ( operation, soapMessage ) {\r\n\t\r\n\tif ( WebServiceProxy.isLoggingEnabled && Application.isDeveloperMode && soapMessage ) {\r\n\t\tvar log = soapMessage instanceof SOAPRequest ? \"SOAPRequest for \" : \"SOAPResponse from \"; \r\n\t\tlog += operation.address + \": \" + operation.name + \"\\n\\n\";\r\n\t\tlog += DOMSerializer.serialize ( soapMessage.document, true )\r\n\t\tthis.logger.fine ( log );\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {WebServiceOperation} operation\r\n * @return {function}\r\n */\r\nWebServiceProxy.createProxyOperation = function (operation) {\r\n\r\n\t/*\r\n\t* Method returns a function which in turn returns:\r\n\t* On request success, an {Object} or a {DOMDocument}.\r\n\t* On request error, a {SOAPFault}.\r\n\t*/\r\n\treturn function () {\r\n\t\tvar parameters = new List(arguments);\r\n\t\tvar result = null;\r\n\t\tif (typeof (parameters.getLast()) == \"function\") {\r\n\t\t\tvar onresponse = parameters.extractLast();\r\n\t\t\tvar request = operation.encoder.encode(\r\n\t\t\t\tparameters\r\n\t\t\t);\r\n\t\t\tthis._log(operation, request);\r\n\t\t\tvar self = this;\r\n\t\t\tvar response = request.asyncInvoke(operation.address, function (response) {\r\n\t\t\t\tself._log(operation, response);\r\n\t\t\t\tvar soapFault = null;\r\n\t\t\t\tif (response) {\r\n\t\t\t\t\tif (response.fault) {\r\n\t\t\t\t\t\tsoapFault = SOAPFault.newInstance(operation, response.fault);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (WebServiceProxy.isDOMResult) {\r\n\t\t\t\t\t\t\tresult = response.document;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tresult = operation.decoder.decode(response);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trequest.dispose();\r\n\t\t\t\tonresponse(result, soapFault);\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tvar request = operation.encoder.encode(\r\n\t\t\t\tnew List(arguments)\r\n\t\t\t);\r\n\t\t\tthis._log(operation, request);\r\n\t\t\tvar response = request.invoke(operation.address);\r\n\t\t\tthis._log(operation, response);\r\n\r\n\t\t\tif (response) {\r\n\t\t\t\tif (response.fault) {\r\n\t\t\t\t\tresult = SOAPFault.newInstance(operation, response.fault);\r\n\t\t\t\t\tif (WebServiceProxy.isFaultHandler) {\r\n\t\t\t\t\t\tWebServiceProxy.handleFault(result, request, response);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (WebServiceProxy.isDOMResult) {\r\n\t\t\t\t\t\tresult = response.document;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tresult = operation.decoder.decode(response);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\trequest.dispose();\r\n\t\t\treturn result;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle SOAP fault.\r\n * @param {SOAPFault} soapFault\r\n * @param {SOAPRequest} soapRequest\r\n * @param {SOAPRequestResponse} soapResponse\r\n */\r\nWebServiceProxy.handleFault = function ( soapFault, soapRequest, soapResponse ) {\r\n\t\r\n\ttry {\r\n\t\tDialog.invokeModal ( \r\n\t\t\tDialog.URL_SERVICEFAULT,\r\n\t\t\tnull, \r\n\t\t\t{\r\n\t\t\t\tsoapFault \t\t: soapFault,\r\n\t\t\t\tsoapRequest \t: soapRequest,\r\n\t\t\t\tsoapResponse \t: soapResponse\r\n\t\t\t}\r\n\t\t);\r\n\t} catch ( exception ) {\r\n\t\talert ( \r\n\t\t\tsoapFault.getFaultString ()\r\n\t\t);\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/services/WebServiceResolver.js",
    "content": "WebServiceResolver.prototype = new XPathResolver;\r\nWebServiceResolver.prototype.constructor = WebServiceResolver;\r\nWebServiceResolver.superclass = XPathResolver.prototype;\r\n\r\n/**\r\n * @class\r\n * @param {string} url\r\n */\r\nfunction WebServiceResolver ( url ) {\r\n\r\n\t/**\r\n\t * @type {Logge\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"WebServiceResolver\" );\r\n\t\r\n\t/**\r\n\t * @type {DOMElement}\r\n\t */\r\n\tthis._root = this._getDocumentElement ( url );\r\n\t\r\n\t/**\r\n\t * @type {Schema}\r\n\t */\r\n\tthis._schema = null;\r\n\t\r\n\t\r\n\tif ( this._root ) {\r\n\t\r\n\t\tthis.setNamespacePrefixResolver ({\r\n\t\t\t\"wsdl\"\t: Constants.NS_WSDL,\r\n\t\t\t\"soap\"\t: Constants.NS_SOAP,\r\n\t\t\t\"s\" \t: Constants.NS_SCHEMA\r\n\t\t});\r\n\t\t\r\n\t\tthis._schema = new Schema ( \r\n\t\t\tthis.resolve ( \"wsdl:types/s:schema\", this._root )\r\n\t\t);\r\n\t}\r\n\t\r\n\t/**\r\n\t * We store this in order to hack the \"getPortAddress\" method below...\r\n\t * @param {string} url\r\n\t */\r\n\tthis._WSDLURL = url;\r\n}\r\n\r\n/**\r\n * @param {string} url\r\n * return {DOMElement}\r\n */\r\nWebServiceResolver.prototype._getDocumentElement = function ( url ) {\r\n\r\n\tvar result = null;\r\n\tvar request = DOMUtil.getXMLHTTPRequest ();\r\n\trequest.open ( \"get\", url, false );\r\n\trequest.send ( null );\r\n\tif ( request.responseXML ) {\r\n\t\tresult = request.responseXML.documentElement;\r\n\t} else {\r\n\t\talert ( request.responseText );\r\n\t\tthrow new Error ( \"WebServiceResolver: Could not read WSDL: \" + url );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get webservice address.\r\n * @return {string}\r\n */\r\nWebServiceResolver.prototype.getPortAddress = function () {\r\n\t\r\n\t/*\r\n\t * Because of issues with certain cheap proxy servers, we don't extract  \r\n\t * the webservice address from the WSDL. Instead we retrieve from the \r\n\t * from the given WSDL-address by hacking it the hardcode way... \r\n\t * \r\n\tvar soapAddress = this.resolve ( \"wsdl:service/wsdl:port/soap:address\", this._root );\r\n\treturn soapAddress.getAttribute ( \"location\" );\r\n\t*/\r\n\t\r\n\t/*\r\n\t * Hope MS doesn't change this convention...\r\n\t */\r\n\treturn this._WSDLURL.split ( \"?WSDL\" )[ 0 ];\r\n}\r\n\r\n/**\r\n * Get webservice namespace.\r\n * @return {string}\r\n */\r\nWebServiceResolver.prototype.getTargetNamespace = function () {\r\n\r\n\treturn this._root.getAttribute ( \"targetNamespace\" );\r\n}\r\n\r\n/**\r\n * Get webservice operations.\r\n * @return {List}\r\n */\r\nWebServiceResolver.prototype.getOperations = function () {\r\n\r\n\tvar result\t\t= new List ();\r\n\tvar elements \t= this.resolveAll ( \"wsdl:portType/wsdl:operation\", this._root ); // \"wsdl:portType[@name='WebServicesSoap']/wsdl:operation\"\r\n\t\r\n\tif ( elements.hasEntries ()) { \r\n\t\twhile ( elements.hasNext ()) {\r\n\t\t\r\n\t\t\tvar element\t= elements.getNext ();\r\n\t\t\tvar name = element.getAttribute ( \"name\" );\r\n\t\t\t\r\n\t\t\tresult.add (\r\n\t\t\t\tnew WebServiceOperation ( \r\n\t\t\t\t\tname,\r\n\t\t\t\t\tthis.getPortAddress (),\r\n\t\t\t\t\tnew SOAPEncoder ( this, name ),\r\n\t\t\t\t\tnew SOAPDecoder ( this, name )\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t\t}\r\n\t} else {\r\n\t\t\r\n\t\t/*\r\n\t\t * This specific portype name is autogenerated by the NET webservice engine.\r\n\t\t */\r\n\t\tthrow new Error ( \"WebServiceResolver: No portType found.\" );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @return {Schema}\r\n */\r\nWebServiceResolver.prototype.getSchema = function () {\r\n\t\r\n\treturn this._schema;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/soap/SOAPDecoder.js",
    "content": "/**\r\n * @class\r\n * @param {WSDLParser} wsdl\r\n * @param {string} operationName\r\n */\r\n\r\nfunction SOAPDecoder ( wsdl, operation ) {\r\n\t\r\n\t/** \r\n\t * @type {WSDLParser} \r\n\t * @private\r\n\t */\r\n\tthis._wsdl = wsdl;\r\n\t\r\n\t/** \r\n\t * @type {string} \r\n\t * @private\r\n\t */\r\n\tthis._operation = operation;\r\n\t\r\n\t/** \r\n\t * @type {XpathResolver} \r\n\t * @private\r\n\t */\r\n\tthis._resolver = new XPathResolver ();\r\n\tthis._resolver.setNamespacePrefixResolver ({\r\n\t\t\"result\" : wsdl.getTargetNamespace ()\r\n\t});\r\n}\r\n\r\n/**\r\n * @param {string} xpath\r\n * @param {DOMNode} node\r\n * @return {DOMElement)\r\n */\r\nSOAPDecoder.prototype.resolve = function ( xpath, node ) {\r\n\treturn this._resolver.resolve ( \"result:\" + xpath, node );\r\n}\r\n\r\n/**\r\n * @param {string} xpath\r\n * @param {DOMNode} node\r\n * @return {List)\r\n */\r\nSOAPDecoder.prototype.resolveAll = function ( xpath, node ) {\r\n\treturn this._resolver.resolveAll ( \"result:\" + xpath, node );\r\n}\r\n\r\n/**\r\n * We assume the webservice to follow this convention: If a request element is \r\n * called \"GetSomething\", the result element will be wrapped in two elements \r\n * called \"GetSomethingResponse\" and \"GetSomethingResult\". This is always the \r\n * case for NET services, but it is possible to  extract this information from \r\n * the WSDL.\r\n * @param {SOAPRequestResponse} soapResponse\r\n * @return {object}\r\n */\r\nSOAPDecoder.prototype.decode = function ( soapResponse ) {\r\n\r\n\tvar result\t= null;\r\n\tvar schema\t= this._wsdl.getSchema ();\r\n\t\r\n\t// find the \"response\" element\r\n\tvar id = this._operation + \"Response\";\r\n\tvar responseElm = this.resolve ( id, soapResponse.body ); \r\n\t\r\n\t// lookup the matching schema entity\r\n\tvar schemaType = schema.lookup ( id );\r\n\tvar definitions = schemaType.getListedDefinitions ();\r\n\t\r\n\twhile ( !result && definitions.hasNext ()) {\r\n\t\r\n\t\t// find the \"result\" element and lookup the matching definition\r\n\t\tvar def = definitions.getNext ();\r\n\t\tvar elm = this.resolve(def.name, responseElm);\r\n\t\t\r\n\t\tif ( def.type == SchemaDefinition.TYPE_XML_DOCUMENT ) {\r\n\t\t\tresult = DOMUtil.getDOMDocument ();\r\n\t\t\tvar e = elm.getElementsByTagName ( \"*\" ).item ( 0 );\r\n\t\t\t//if ( typeof result.importNode != Types.UNDEFINED ) { // case for Moz and IE7\r\n\t\t\t\tresult.appendChild ( \r\n\t\t\t\t\tresult.importNode ( e, true )\r\n\t\t\t\t);\r\n\t\t\t//} else { // case for IE6\r\n\t\t\t//\tresult.loadXML ( \r\n\t\t\t//\t\tDOMSerializer.serialize ( e )\r\n\t\t\t//\t);\r\n\t\t\t//}\r\n\t\t} else { // start recursive process, following same pattern\r\n\t\t\tresult = this._compute ( elm, def );\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {DOMElement} element\r\n * @param {SchemaDefinition} definition\r\n */\r\nSOAPDecoder.prototype._compute = function ( element, definition ) {\r\n\r\n\tvar result = null;\r\n\tvar schema = this._wsdl.getSchema ();\r\n\r\n\tif ( definition.isSimpleValue ) {\r\n\t\tresult = this._getSimpleValue ( element, definition.type );\r\n\t} else {\r\n\t\tvar schemaType = schema.lookup ( definition.type );\r\n\t\tif ( schemaType instanceof SchemaSimpleType ) {\r\n\t\t\tresult = this._getSimpleValue ( element, schemaType.restrictionType );\r\n\t\t} else {\r\n\t\t\tvar defs = schemaType.getListedDefinitions ();\r\n\t\t\tif ( schemaType.isArray ) {\r\n\t\t\t\tresult = [];\r\n\t\t\t\tvar def = defs.getNext ();\r\n\t\t\t\tvar elms = this.resolveAll ( def.type, element );\r\n\t\t\t\twhile ( elms.hasNext ()) {\r\n\t\t\t\t\tvar elm = elms.getNext ();\r\n\t\t\t\t\tresult.push (\r\n\t\t\t\t\t\t this._compute ( elm, def )\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t    \r\n\t\t\t    if (element == null) {\r\n\t\t\t        result = null;\r\n\t\t\t    } else {\r\n\t\t\t\t    result = {};\r\n\t\t\t\t    defs.reset();\r\n\t\t\t    \r\n\t\t\t\t    while ( defs.hasNext ()) {\r\n\t\t\t\t\t    var def = defs.getNext ();\r\n\t\t\t\t\t    var elm = this.resolve ( def.name, element );\r\n\t\t\t\t\t    if ( elm ) {\r\n\t\t\t\t\t\t    result [ def.name ] = this._compute ( elm, def );\r\n\t\t\t\t\t    } else if ( def.isRequired ) {\r\n\t\t\t\t\t\t    throw new Error ( \"SOAPDecoder: invalid SOAP response.\" );\r\n\t\t\t\t\t    }\r\n\t\t\t\t    }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {DOMElement} element\r\n * @param {string} type\r\n * @return {object}\r\n */\r\nSOAPDecoder.prototype._getSimpleValue = function ( element, type ) {\r\n\r\n\tvar result = null;\r\n\t\r\n\tif (element !=null && element.firstChild && element.firstChild.nodeType == Node.TEXT_NODE ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Mozilla will split a 4K+ texnode into multiple smaller \r\n\t\t * textnodes. This will reassemble them into a single node.\r\n\t\t */\r\n\t\tif ( Client.isMozilla && element.childNodes.length > 1 ) {\r\n\t\t\telement.normalize ();\r\n\t\t}\r\n\t\t\r\n\t\tresult = element.firstChild.data;\r\n\t\t\r\n\t\tswitch ( type ) {\r\n\t\t\tcase Schema.types.STRING :\r\n\t\t\t\tresult = result;\r\n\t\t\t\tbreak;\r\n\t\t\tcase Schema.types.INT :\r\n\t\t\tcase Schema.types.FLOAT :\r\n\t\t\tcase Schema.types.DOUBLE :\r\n\t\t\t\tresult = Number ( result );\r\n\t\t\t\tbreak;\r\n\t\t\tcase Schema.types.BOOLEAN :\r\n\t\t\t\tresult = result == \"true\";\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tthrow ( \"SOAPDecoder: schema type \\\"\" + type + \"\\\" not handled.\" );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/soap/SOAPEncoder.js",
    "content": "/**\r\n * @class\r\n * @param {WSDLParser} wsdl\r\n * @param {string} operationName\r\n */\r\n\r\nfunction SOAPEncoder ( wsdl, operation ) {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SOAPEncoder\" );\r\n\t\r\n\t/** \r\n\t * @type {WSDLParser} \r\n\t * @private\r\n\t */\r\n\tthis._wsdl = wsdl;\r\n\t\r\n\t/** \r\n\t * @type {string} \r\n\t * @private\r\n\t */\r\n\tthis._operation = operation;\r\n\t\r\n\t/** \r\n\t * @type {string} \r\n\t * @private\r\n\t */\r\n\tthis._namespace = wsdl.getTargetNamespace ();\r\n}\r\n\r\n/**\r\n * @param {List} args\r\n * @return {SOAPMessage}\r\n */\r\nSOAPEncoder.prototype.encode = function ( args ) {\r\n\t\r\n\tvar message\t\t= SOAPRequest.newInstance ( this._namespace, this._operation );\r\n\tvar root \t\t= this._appendElement ( message.body, this._operation );\r\n\tvar schema \t\t= this._wsdl.getSchema ();\r\n\tvar schemaType \t= schema.lookup ( this._operation );\r\n\tvar definitions\t= schemaType.getListedDefinitions ();\r\n\t\r\n\twhile ( definitions.hasNext ()) {\r\n\t\tvar def = definitions.getNext ();\r\n\t\tvar elm = this._appendElement ( root, def.name );\r\n\t\tvar val = args.getNext ();\r\n\t\tthis._resolve ( elm, def, val );\r\n\t}\r\n\treturn message;\r\n}\r\n\r\n/**\r\n * @param {DOMElement} element\r\n * @param {SchemaDefinition} definition\r\n * @param {object} value\r\n */\r\nSOAPEncoder.prototype._resolve = function ( element, definition, value ) {\r\n\r\n\tvar schema = this._wsdl.getSchema ();\r\n\t\r\n\tif ( definition.isSimpleValue ) {\r\n\t\tthis._appendText ( element, value, definition.type == \"string\" );\r\n\t} else {\r\n\t\r\n\t\tvar schemaType \t= schema.lookup ( definition.type );\r\n\t\tif ( schemaType instanceof SchemaSimpleType ) {\r\n\t\t\talert ( \"SOAPEncoder: SchemaSimpleType support not implemented!\" );\r\n\t\t} else {\r\n\t\t\tvar defs = schemaType.getListedDefinitions ();\r\n\t\t\tif ( schemaType.isArray ) {\r\n\t\t\t\tvar entries = new List ( value );\r\n\t\t\t\tvar def = defs.getNext ();\r\n\t\t\t\twhile ( entries.hasNext ()) {\r\n\t\t\t\t\tvar elm = this._appendElement ( element, def.name );\r\n\t\t\t\t\tvar val = entries.getNext ();\r\n\t\t\t\t\tthis._resolve ( elm, def, val );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\r\n\t\t\t    if (typeof value === \"undefined\") {\r\n\t\t\t        this.logger.error(\"SOAPEncoder: value is undefined\");\r\n\t\t\t    } else {\r\n\t\t\t        while (defs.hasNext()) {\r\n\r\n\t\t\t            try {\r\n\t\t\t                var def = defs.getNext();\r\n\t\t\t                var elm = this._appendElement(element, def.name);\r\n\r\n\t\t\t                var val = value[def.name];\r\n\t\t\t                this._resolve(elm, def, val);\r\n\t\t\t            } catch(exception) {\r\n\r\n\t\t\t                // This can happen when opening dataitems in particular.\r\n\t\t\t                // Apparently, we recieve no OpenIcon but attempt to send it back...\r\n\t\t\t                this.logger.error(\"Mysterius malfunction in \" + this._operation + \":\\n\\n\" + def.name + \": \" + value);\r\n\t\t\t            }\r\n\t\t\t        }\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {DOMNode} node\r\n * @return {DOMElement}\r\n */\r\nSOAPEncoder.prototype._appendElement = function ( node, name ) {\r\n\t\r\n\tvar child = DOMUtil.createElementNS ( \r\n\t\tthis._namespace, name, node.ownerDocument \r\n\t);\r\n\tnode.appendChild ( child );\r\n\treturn child;\r\n}\r\n\r\n/**\r\n * Text stripped according to http://www.w3.org/TR/REC-xml/#charsets because \r\n * delicious Office applications may throw in all sorts of illegal characters. \r\n * @param {DOMElement} element\r\n * @param {object} value\r\n * @param {boolean} isString - not really used...\r\n */\r\nSOAPEncoder.prototype._appendText = function ( element, value, isString ) {\r\n\t\r\n\tif ( value != null ) {\r\n\t\t\r\n\t\tvalue = new String ( value );\r\n\t\tvar safe = new String ( \"\" );\r\n\t\tvar chars = value.split ( \"\" );\r\n\t\tvar wasDeleted = false;\r\n\t\tvar i = 0, c;\r\n\t\t\r\n\t\twhile ( c = chars [ i++ ]) {\r\n\t\t\t\r\n\t\t\tvar isAbort = true;\r\n\t\t\tvar code = c.charCodeAt ( 0 );\r\n\t\t\t\r\n\t\t\t// case 0x10 :\r\n\t\t\t// case 0x13 :\r\n\t\t\t\r\n\t\t\tswitch ( code ) {\r\n\t\t\t\tcase 0x9 :\r\n\t\t\t\tcase 0xA :\r\n\t\t\t\tcase 0xD :\r\n\t\t\t\t\tisAbort = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\t( code >= 0x20 && code <= 0xD7FF ) ||\r\n\t\t\t\t\t\t( code >= 0xE000 && code  <= 0xFFFD ) || \r\n\t\t\t\t\t\t( code >= 0x10000 && code <= 0x10FFFF )\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tisAbort = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tif ( !isAbort ) {\r\n\t\t\t\tsafe += c;\r\n\t\t\t} else {\r\n\t\t\t\twasDeleted = true;\r\n\t\t\t}\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tif ( wasDeleted ) {\r\n\t\t\tthis.logger.debug ( \"Illegal XML character(s) was deleted from the string: \" + value )\r\n\t\t}\r\n\t\t\r\n\t\telement.appendChild ( element.ownerDocument.createTextNode ( safe ));\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/soap/SOAPFault.js",
    "content": "/**\r\n * @class\r\n * Please use factory method below.\r\n * @param {string} operationName\r\n * @param {string} operationAddress\r\n * @param {string} faultString\r\n */\r\nfunction SOAPFault ( operationName, operationAddress, faultString ) {\r\n\t\r\n\tthis._operationName = operationName;\r\n\tthis._operationAddress = operationAddress;\r\n\tthis._faultString = faultString;\r\n}\r\n\r\n/**\r\n * Get operation name.\r\n * @return {string}\r\n */\r\nSOAPFault.prototype.getOperationName = function () {\r\n\t\r\n\treturn this._operationName;\r\n}\r\n\r\n/**\r\n * Get operation address.\r\n * @return {string}\r\n */\r\nSOAPFault.prototype.getOperationAddress = function () {\r\n\t\r\n\treturn this._operationAddress;\r\n}\r\n\r\n/**\r\n * Get fault string.\r\n * @return {string}\r\n */\r\nSOAPFault.prototype.getFaultString = function () {\r\n\r\n\treturn this._faultString;\r\n}\r\n\r\n/**\r\n * SOAPFault factory.\r\n * @param {WebServiceOperation} operation\r\n * @param {object} fault\r\n */\r\nSOAPFault.newInstance = function ( operation, fault ) {\r\n\t\r\n\treturn new SOAPFault ( \r\n\t\toperation.name, \r\n\t\toperation.address, \r\n\t\tfault.faultString \r\n\t);\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/soap/SOAPMessage.js",
    "content": "/**\r\n * @class\r\n */\r\nfunction SOAPMessage () {}\r\n\r\nSOAPMessage.prototype = {\r\n\t\r\n\t/** @type {DOMDocument} */\r\n\tdocument : null,\r\n\t\t\r\n\t/** @type {DOMElement} */\r\n\tenvelope : null,\r\n\t\t\r\n\t/** @type {DOMElement} */\r\n\theader : null,\r\n\t\t\r\n\t/** @type {DOMElement} */\r\n\tbody : null,\r\n\t\t\r\n\t/** @type {DOMElement} */\r\n\tfault : null\r\n} \r\n\t"
  },
  {
    "path": "Website/Composite/scripts/source/top/soap/SOAPRequest.js",
    "content": "SOAPRequest.prototype = new SOAPMessage;\r\nSOAPRequest.prototype.constructor = SOAPRequest;\r\nSOAPRequest.superclass = SOAPMessage.prototype;\r\n\r\n/**\r\n * @type {XPathResolver}\r\n */\r\nSOAPRequest.resolver = new XPathResolver ();\r\nSOAPRequest.resolver.setNamespacePrefixResolver ({\r\n\t\"soap\" : Constants.NS_ENVELOPE,\r\n\t\"xhtml\" : Constants.NS_XHTML\r\n});\r\n\r\n/**\r\n * SOAPRequest factory method. Making sure that \r\n * we instantiate only a single XPathResolver.\r\n * @param {string} namespace\r\n * @param {string} operation\r\n * @return {SOAPRequest}\r\n */\r\nSOAPRequest.newInstance = function ( namespace, operation ) {\r\n\t\r\n\tvar action\t\t\t= namespace + \"/\" + operation;\r\n\tvar request\t\t\t= new SOAPRequest ( action );\r\n\tvar resolver\t\t= SOAPRequest.resolver;\r\n\t\r\n\trequest.document\t= Templates.getTemplateDocument ( \"soapenvelope.xml\" );\r\n\trequest.envelope\t= resolver.resolve ( \"soap:Envelope\", request.document );\r\n\trequest.header\t\t= resolver.resolve ( \"soap:Header\", request.envelope );\r\n\trequest.body\t\t= resolver.resolve ( \"soap:Body\", request.envelope );\r\n\t\r\n\treturn request;\r\n}\r\n\r\n/**\r\n * Parse response.\r\n * @param {XMLHttpRequest} request\r\n * @return\r\n */\r\nSOAPRequest._parseResponse = function ( request ) {\r\n\t\r\n\tvar result = null;\r\n\tvar isOffLine = false;\r\n\tvar doc = request.responseXML;\r\n\t\r\n\t/*\r\n\t * XML was returned.\r\n\t */\r\n\tif ( doc != null && doc.documentElement != null ) {\r\n\t\tswitch ( doc.documentElement.namespaceURI ) {\r\n\t\t\r\n\t\t\t/*\r\n\t\t\t * Case SOAP - request success!\r\n\t\t\t */\r\n\t\t\tcase Constants.NS_ENVELOPE :\r\n\t\t\t\tresult = SOAPRequestResponse.newInstance ( \r\n\t\t\t\t\trequest.responseXML \r\n\t\t\t\t);\r\n\t\t\t\tif ( Application.isOffLine ) {\r\n\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SERVER_ONLINE );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Case XHTML. Probably the server went offline.\r\n\t\t\t * Only Mozilla will intercept this; Explorer \r\n\t\t\t * sees only text garbage in this case, see below.\r\n\t\t\t */\r\n\t\t\tcase Constants.NS_XHTML :\r\n\t\t\t\tif ( !Application.isOffLine ) {\r\n\t\t\t\t\tvar body = SOAPRequest.resolver.resolve ( \r\n\t\t\t\t\t\t\"xhtml:html/xhtml:body\", \r\n\t\t\t\t\t\trequest.responseXML \r\n\t\t\t\t\t);\r\n\t\t\t\t\tif ( body && body.getAttribute ( \"id\" ) == \"offline\" ) {\r\n\t\t\t\t\t\tisOffLine = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase Constants.NS_DOMPARSEERROR :\r\n\t\t\t\tvar cry = DOMSerializer.serialize ( doc );\r\n\t\t\t\tSystemLogger.getLogger ( \"SOAPRequest._parseResponse (static)\" ).error ( cry );\r\n\t\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\t\talert ( \"SOAPRequest parseerror! \\n\\n\" + cry );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tdefault :\r\n\t\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\t\talert ( \"SOAPRequest: \" + doc.documentElement.namespaceURI )\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t/*\r\n\t * Garbage was returned.\r\n\t */\r\n\t} else {\r\n\t\t\r\n\t\t/*\r\n\t\t * Analyze garbage - is it the offline page?\r\n\t\t */\r\n\t\tif ( !Application.isOffLine && !Application.isLoggedOut ) {\r\n\t\t\tvar text = request.responseText;\r\n\t\t\tif (request.status == 503 || text.indexOf(\"id=\\\"offline\\\"\") > -1) {\r\n\t\t\t    isOffLine = true;\r\n\t\t\t} else if (request.status == 403) {\r\n\t\t\t\tif (Application.isLoggedIn) {\r\n\t\t\t\t\tApplication.isLoggedIn = false;\r\n\t\t\t\t\tvar title = \"Warning\";\r\n\t\t\t\t\tvar text = \"You have been logged out\";\r\n\t\t\t\t\tDialog.warning(title, text, Dialog.BUTTONS_ACCEPT, {\r\n\t\t\t\t\t\thandleDialogResponse: function (response) {\r\n\t\t\t\t\t\t\t//if (response == Dialog.RESPONSE_ACCEPT) {\r\n\t\t\t\t\t\t\t\twindow.location.reload();\r\n\t\t\t\t\t\t\t//}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tvar cry = \"Invalid SOAP response: \\n\\n\" + request.responseText;\r\n\t\t\t\tSystemLogger.getLogger ( \"SOAPRequest._parseResponse (static)\" ).error ( cry );\r\n\t\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\t\talert ( \"Invalid SOAP response\" );\r\n\t\t\t\t\twindow.open ( \"about:blank\" ).document.write ( request.responseText );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * Broadcast intercepted by MessageQueue and Application.\r\n\t */\r\n\tif ( isOffLine == true ) {\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.SERVER_OFFLINE );\r\n\t}\r\n\t\r\n\treturn result;\r\n}\r\n\r\n\r\n/**\r\n * @class\r\n * @param {string} action\r\n * Please use factory method!\r\n */\r\nfunction SOAPRequest ( action ) {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SOAPRequest\" );\r\n\t\r\n\t/** \r\n\t * @type {String} \r\n\t */\r\n\tthis.action = action;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Invoke request.\r\n * @param {string} url\r\n * @return {SOAPRequestResponse}\r\n */\r\nSOAPRequest.prototype.invoke = function ( url ) {\r\n\t\r\n\tvar request = DOMUtil.getXMLHTTPRequest ();\r\n\tvar response = null;\r\n\t\r\n\trequest.open ( \"post\", url,  false );\r\n\trequest.setRequestHeader ( \"Content-Type\", \"text/xml; charset=UTF-8\" );\r\n\trequest.setRequestHeader ( \"SOAPAction\", this.action );\r\n\t\r\n\ttry {\r\n\t\trequest.send ( this.document );\r\n\t\tresponse = SOAPRequest._parseResponse ( request );\r\n\t} catch ( exception ) {\r\n\t\tvar error = \"Dysfuntion in SOAP invoke: \" + url;\r\n\t\tif ( this.document != null ) {\r\n\t\t\terror += \"\\n\" + DOMSerializer.serialize ( this.document, true );\r\n\t\t}\r\n\t\tthis.logger.error ( error );\r\n\t\tthrow exception;\r\n\t}\r\n\t\r\n\trequest = null;\r\n\treturn response;\r\n}\r\n\r\n/**\r\n* Invoke request.\r\n* @param {string} url\r\n* @return {SOAPRequestResponse}\r\n*/\r\nSOAPRequest.prototype.asyncInvoke = function (url, onresponse) {\r\n\r\n\tvar request = DOMUtil.getXMLHTTPRequest();\r\n\r\n\trequest.open(\"post\", url, true);\r\n\trequest.setRequestHeader(\"Content-Type\", \"text/xml; charset=UTF-8\");\r\n\trequest.setRequestHeader(\"SOAPAction\", this.action);\r\n\r\n\trequest.onreadystatechange = function () {\r\n\t\tif (request.readyState == 4) {\r\n\t\t\tvar response = SOAPRequest._parseResponse(request);\r\n\t\t\tonresponse(response);\r\n\t\t\trequest = null;\r\n\t\t}\r\n\t}\r\n\r\n\trequest.send(this.document);\r\n}\r\n\r\n/**\r\n * Each request wraps a full DOM document. \r\n * No time to wait for the garbage collector.\r\n */\r\nSOAPRequest.prototype.dispose = function () {\r\n\t\r\n\tfor ( var property in this ) {\r\n\t\tthis [ property ] = null;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/soap/SOAPRequestResponse.js",
    "content": "SOAPRequestResponse.prototype = new SOAPMessage;\r\nSOAPRequestResponse.prototype.constructor = SOAPRequestResponse;\r\nSOAPRequestResponse.superclass = SOAPMessage.prototype;\r\n\r\n/**\r\n * @class\r\n * Please use static factory method, see below. The word \"SOAPResponse\" is reserved \r\n * for a Mozilla native javascript object, unfortunately we cannot use it.\r\n * TODO: Soap has been discontinued in Firefox 3.0, so maybe we can use it soon...\r\n */\r\nfunction SOAPRequestResponse () {}\r\n\r\n/**\r\n * @type {SystemLogger}\r\n */\r\nSOAPRequestResponse.logger = SystemLogger.getLogger ( \"SOAPRequestResponse\" );\r\n\r\n/**\r\n * @type {XPathResolver}\r\n */\r\nSOAPRequestResponse.resolver = new XPathResolver ();\r\nSOAPRequestResponse.resolver.setNamespacePrefixResolver ({\r\n\t\"soap\" : Constants.NS_ENVELOPE\r\n});\r\n\r\n/**\r\n * @param {DOMDocument} doc\r\n */\r\nSOAPRequestResponse.newInstance = function ( doc ) {\r\n\t\r\n\tvar response = null;\r\n\t\r\n\tif ( doc && doc.documentElement ) {\r\n\t\r\n\t\tresponse = new SOAPRequestResponse ();\r\n\t\tvar resolver = SOAPRequestResponse.resolver;\r\n\t\t\r\n\t\tresponse.document\t= doc;\r\n\t\tresponse.envelope\t= resolver.resolve ( \"soap:Envelope\", response.document );\r\n\t\tresponse.header\t\t= resolver.resolve ( \"soap:Header\", response.envelope );\r\n\t\tresponse.body\t\t= resolver.resolve ( \"soap:Body\", response.envelope );\r\n\t\t\r\n\t\tvar fault = resolver.resolve ( \"soap:Fault\", response.body );\r\n\t\tif ( fault ) {\r\n\t\t\tSOAPRequestResponse.logger.fatal ( \r\n\t\t\t\tDOMSerializer.serialize ( fault, true )\r\n\t\t\t);\r\n\t\t\tresponse.fault = {\r\n\t\t\t\telement \t\t\t: fault,\r\n\t\t\t\tfaultNamespaceURI\t: fault.namespaceURI,\r\n\t\t\t\tfaultCode\t\t \t: DOMUtil.getTextContent ( resolver.resolve ( \"faultcode\", fault )),\r\n\t\t\t\tfaultString\t\t \t: DOMUtil.getTextContent ( resolver.resolve ( \"faultstring\", fault )),\r\n\t\t\t\tdetail\t\t\t\t: fault.getElementsByTagName ( \"detail\" ).item ( 0 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn response;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/system/System.js",
    "content": "/**\r\n * @class\r\n * Centralizes interaction with TreeService.\r\n */\r\nvar System = new function () {\r\n\r\n\tvar logger = SystemLogger.getLogger(\"System\");\r\n\tvar root = null;\r\n\tvar defaultEntityTokens = null;\r\n\r\n\t/**\r\n\t* Has perspectives mounted?\r\n\t*/\r\n\tthis.hasActivePerspectives = false;\r\n\r\n\t/**\r\n\t * Cache tree\r\n\t */\r\n\tthis.nodes = new Map();\r\n\r\n\t/**\r\n\t * Cache parents\r\n\t */\r\n\tthis.parents = new Map();\r\n\r\n\t/**\r\n\t* Get default EntityToken for perspective.\r\n\t* @return {EntityToken}\r\n\t*/\r\n\tthis.getDefaultEntityToken = function (perspectiveEntityToken) {\r\n\r\n\t\tif (defaultEntityTokens == null) {\r\n\t\t\tdefaultEntityTokens = {};\r\n\t\t\tnew List(TreeService.GetDefaultEntityTokens(true)).each(\r\n\t\t\t\tfunction (token) {\r\n\t\t\t\t\tdefaultEntityTokens[token.Key] = token.Value;\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn defaultEntityTokens[perspectiveEntityToken];\r\n\t}\r\n\r\n\t/**\r\n\t* Get the alpha node.\r\n\t* @return {SystemNode}\r\n\t*/\r\n\tthis.getRootNode = function () {\r\n\r\n\t\tif (root == null) {\r\n\t\t\troot = new SystemNode(TreeService.GetRootElements(\"\")[0]);\r\n\t\t}\r\n\t\treturn root;\r\n\t}\r\n\r\n\t/**\r\n\t* Get the main \"area\" nodes (the buttons in the outlook menu).\r\n\t* For some security related reason, this must be done especial.\r\n\t* @return {List<SystemNode>}\r\n\t*/\r\n\tthis.getPerspectiveNodes = function () {\r\n\r\n\t\tvar result = new List();\r\n\t\tvar response = TreeService.GetActivePerspectiveElements(\"dummy\");\r\n\r\n\t\tvar list = new List(response);\r\n\t\tif (list.hasEntries()) {\r\n\t\t\tthis.hasActivePerspectives = true;\r\n\t\t\tlist.each(function (element) {\r\n\t\t\t\tresult.add(\r\n\t\t\t\t\tnew SystemNode(element)\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.PERSPECTIVES_NONE);\r\n\t\t}\r\n\t\treturn result;\r\n\r\n\t}\r\n\r\n\t/**\r\n\t* Get child nodes, optionally by search token.\r\n\t* @param {SystemNode} node\r\n\t* @param {string} searchToken Optional\r\n\t* @return {List<SystemNode>}\r\n\t*/\r\n\tthis.getChildNodes = function (node, searchToken) {\r\n\t\tvar result = new List();\r\n\t\tvar response = null;\r\n\r\n\t\tvar self = this;\r\n\t\t//disabel cache prototype\r\n\t\t//var handle = node.getHandle();\r\n\t\t//if (!this.nodes.has(handle) || searchToken) {\r\n\t\t\tif (searchToken) {\r\n\t\t\t\tif (SearchTokens.hasToken(searchToken)) {\r\n\t\t\t\t\tsearchToken = SearchTokens.getToken(searchToken);\r\n\t\t\t\t}\r\n\t\t\t\tresponse = TreeService.GetElementsBySearchToken(node.getData(), searchToken);\r\n\t\t\t} else {\r\n\t\t\t\tresponse = TreeService.GetElements(node.getData());\r\n\t\t\t}\r\n\t\t\tnew List(response).each(function(element) {\r\n\t\t\t\tvar newnode = new SystemNode(element);\r\n\t\t\t\tif (searchToken) {\r\n\t\t\t\t\tnewnode.searchToken = searchToken;\r\n\t\t\t\t}\r\n\t\t\t\tresult.add(newnode);\r\n\r\n\t\t\t\t//Add parents to cache\r\n\t\t\t\tif (!searchToken) {\r\n\t\t\t\t\tself.parents.set(newnode.getHandle(), node);\r\n\t\t\t\t}\r\n\r\n\t\t\t});\r\n\r\n\r\n\t\t//\tif (!searchToken) {\r\n\t\t//\t\tthis.nodes.set(handle, result.copy());\r\n\t\t//\t}\r\n\t\t//} else {\r\n\t\t//\tresult = this.nodes.get(handle).copy();\r\n\t\t//}\r\n\t\treturn this.groupListByBundles(result);\r\n\t}\r\n\r\n\tthis.getParents = function (handle) {\r\n\t\tvar handles = new List();\r\n\t\tvar result = new List();\r\n\r\n\t\twhile (this.parents.has(handle) && !handles.has(handle)) {\r\n\t\t\tvar parent = this.parents.get(handle);\r\n\t\t\thandles.add(handle);\r\n\t\t\tresult.add(parent);\r\n\t\t\thandle = parent.getHandle();\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\r\n\t/**\r\n\t* Get branch. This will *not* return a tree structure, but the structure \r\n\t* can be inferred from a sequential parsing of the returned map. \r\n\t* @param {List<SystemNode>} nodes A list of open sub-treenodes.\r\n\t* @return {Map<string><List<SystemNode>>}\r\n\t*/\r\n\tthis.getDescendantBranch = function (nodes) {\r\n\r\n\t\tvar map = new Map();\r\n\t\tvar arg = [];\r\n\r\n\t\tnodes.each(function (node) {\r\n\t\t\targ.push({\r\n\t\t\t\tProviderName: node.getProviderName(),\r\n\t\t\t\tEntityToken: node.getEntityToken(),\r\n\t\t\t\tPiggybag: node.getPiggyBag(),\r\n\t\t\t\tSearchToken: node.searchToken,\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\tvar response = TreeService.GetMultipleChildren(arg);\r\n\t\tvar triples = new List(response);\r\n\r\n\t\twhile (triples.hasNext()) {\r\n\t\t\tthis._listNodesInMap(triples.getNext(), map);\r\n\t\t}\r\n\r\n\t\treturn this.groupMapByBundles(map);\r\n\t}\r\n\r\n\t/**\r\n\t* This will *not* return a tree structure, but the structure \r\n\t* can be inferred from a sequential parsing of the returned map. \r\n\t* @param {string} rootToken The current perspective token.\r\n\t* @param {string} token \r\n\t* @param {List<SystemNode>} nodes A list of open treenodes in the whole tree.\r\n\t* @return {Map<string><List<SystemNode>>}\r\n\t*/\r\n\tthis.getInvisibleBranch = function (rootToken, token, nodes) {\r\n\r\n\t\tvar map = new Map();\r\n\t\tvar arg = [];\r\n\r\n\t\tnodes.each(function (node) {\r\n\t\t\targ.push({\r\n\t\t\t\tProviderName: node.getProviderName(),\r\n\t\t\t\tEntityToken: node.getEntityToken(),\r\n\t\t\t\tPiggybag: node.getPiggyBag()\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\tvar response = TreeService.FindEntityToken(rootToken, token, arg);\r\n\r\n\t\tif (response instanceof SOAPFault) {\r\n\r\n\t\t\tlogger.error(response.getFaultString());\r\n\t\t\tif (Application.isDeveloperMode) {\r\n\t\t\t\talert(response.getFaultString());\r\n\t\t\t}\r\n\t\t\tmap = null;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar triples = new List(response);\r\n\t\t\twhile (triples.hasNext()) {\r\n\t\t\t\tthis._listNodesInMap(triples.getNext(), map);\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\treturn this.groupMapByBundles(map);\r\n\t}\r\n\r\n\t/**\r\n\t* @param {object} triple\r\n\t* @param {Map<string><List<SystemNode>>} map\r\n\t*/\r\n\tthis._listNodesInMap = function (triple, map) {\r\n\r\n\t\tvar list = new List();\r\n\t\tvar key = triple.ElementKey; //triple.ProviderName + triple.EntityToken;\r\n\t\tvar elements = new List(triple.ClientElements);\r\n\r\n\t\tmap.set(key, list);\r\n\t\twhile (elements.hasNext()) {\r\n\t\t\tvar element = elements.getNext();\r\n\t\t\tlist.add(new SystemNode(element));\r\n\t\t}\r\n\r\n\t\tvar self = this;\r\n\t\tmap.each(function(key, list) {\r\n\t\t\tself.nodes.set(key, list.copy());\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t* Get child nodes by search token.\r\n\t* @param {SystemNode} node\r\n\t* @param {string} searchToken Optional\r\n\t* @return {List<SystemNode>}\r\n\t*/\r\n\tthis.getChildNodesBySearchToken = function (node, searchToken) {\r\n\r\n\t\treturn this.getChildNodes(node, searchToken);\r\n\t}\r\n\r\n\t/**\r\n\t* Get named roots (nodes for a given root).\r\n\t* @param {string} key\r\n\t* @param {string} searchToken Optional\r\n\t* @return {List<SystemNode>}\r\n\t*/\r\n\tthis.getNamedRoots = function (key, searchToken) {\r\n\r\n\t\tvar result = new List();\r\n\t\tvar response = null;\r\n\r\n\t\tif (searchToken) {\r\n\t\t\tif (SearchTokens.hasToken(searchToken)) {\r\n\t\t\t\tsearchToken = SearchTokens.getToken(searchToken);\r\n\t\t\t}\r\n\t\t\tresponse = TreeService.GetNamedRootsBySearchToken(key, searchToken);\r\n\t\t} else {\r\n\t\t\tresponse = TreeService.GetNamedRoots(key);\r\n\t\t}\r\n\r\n\t\tnew List(response).each(function (element) {\r\n\t\t\tvar node = new SystemNode(element);\r\n\t\t\tif (searchToken) {\r\n\t\t\t\tnode.searchToken = searchToken;\r\n\t\t\t}\r\n\t\t\tresult.add(node);\r\n\t\t});\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/**\r\n\t* Get named roots by search token.\r\n\t* @param {string} key\r\n\t* @param {string} searchToken\r\n\t* @return {List<SystemNode>}\r\n\t*/\r\n\tthis.getNamedRootsBySearchToken = function (key, searchToken) {\r\n\r\n\t\treturn this.getNamedRoots(key, searchToken);\r\n\t}\r\n\r\n\t/**\r\n\t* Compile action list.\r\n\t* @param {SystemNode} node\r\n\t* @param {object} element\r\n\t* @param {List} actions\r\n\t* @ignore\r\n\t*/\r\n\tfunction compileActionList(node, element, actions) {\r\n\r\n\t\tvar index = element.ClientElementActionGroupId;\r\n\t\tif (index != null) {\r\n\t\t\tvar items = actions.get(index).ClientElementActionGroupItems;\r\n\t\t\tif (items && items.length > 0) {\r\n\t\t\t\tnode.setActionList(\r\n\t\t\t\t\tnew List(items)\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Group by bundles\r\n\t * @param {List<SystemNode>} nodes\r\n\t */\r\n\tthis.groupListByBundles = function (nodes) {\r\n\t\tvar result = new List();\r\n\t\tvar bundles = new Map();\r\n\r\n\t\twhile (nodes.hasEntries()) {\r\n\t\t\tvar node = nodes.extractFirst();\r\n\t\t\tvar elementBundle = node.getData().ElementBundle;\r\n\t\t\tif (elementBundle) {\r\n\t\t\t\tvar bundle = null;\r\n\t\t\t\tif (bundles.has(elementBundle)) {\r\n\t\t\t\t\tbundle = bundles.get(elementBundle);\r\n\t\t\t\t\tbundle.add(node);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresult.add(node);\r\n\t\t\t\t\tbundles.set(elementBundle, node);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tresult.add(node);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/**\r\n\t * Group by bundles\r\n\t * @param {Map<string><List<SystemNode>>} nodes\r\n\t */\r\n\tthis.groupMapByBundles = function (map) {\r\n\t\tvar result = new Map();\r\n\t\tmap.each(function (key) {\r\n\t\t\tresult.set(key, this.groupListByBundles(map.get(key)));\r\n\t\t}, this);\r\n\t\treturn result;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/system/SystemAction.js",
    "content": "/*\r\n * Action types.\r\n */\r\nSystemAction.OPEN_DOCUMENT =\"OpenDocument\";\r\nSystemAction.OPEN_MODAL_DIALOG =\"OpenModalDialog\";\r\n\r\n/*\r\n * Action tags.\r\n */\r\nSystemAction.TAG_CHANGEFROMLANGUAGE = \"ChangeFromLocale\";\r\nSystemAction.TAG_USER = \"User\";\r\n\r\n/**\r\n * Determines allowed categories and category display order.isInToolBar\r\n * @type {HashMap}\r\n */\r\nSystemAction.categories = {\r\n\r\n\tEdit\t\t\t: \"Edit\",\r\n\tAdd\t\t\t\t: \"Add\",\r\n\tDelete\t\t\t: \"Delete\",\r\n\tOther\t\t\t: \"Other\",\r\n\tDeveloperMode\t: \"DeveloperMode\"\r\n}\r\n\r\n/**\r\n* Determines active positions to display in navgation and selector (ElementActionActive)\r\n* @type {Enum}\r\n*/\r\nSystemAction.activePositions = { NavigatorTree: 1, SelectorTree: 2 }\r\n\r\n/**\r\n * Tagged actions go here.\r\n * @type {Map<string><SystemAction>}\r\n */\r\nSystemAction.taggedActions = new Map ();\r\n\r\n/**\r\n * This is maintained by the SystemNodes.\r\n * @see {SystemNode#_registerSystemActions}\r\n * @type {Map<string><SystemAction>}\r\n */\r\nSystemAction.actionMap = new Map ();\r\n\r\n/**\r\n * Invoke that action.\r\n * @param {SystemAction} action\r\n * @param {object} arg This can be either a SystemNode or a List of SystemNodes.\r\n */\r\nSystemAction.invoke = function ( action, arg ) {\r\n\r\n\tvar node = arg;\r\n\r\n\tif ( node instanceof SystemNode ) {\r\n\t\tApplication.lock ( SystemAction );\r\n\t\taction.logger.debug ( \"Execute \\\"\" + action.getLabel () + \"\\\" on \\\"\" + node.getLabel () + \"\\\".\" );\r\n\r\n\t\tTreeService.ExecuteSingleElementAction (\r\n\t\t\tnode.getData (),\r\n\t\t\taction.getHandle (),\r\n\t\t\tApplication.CONSOLE_ID\r\n\t\t);\r\n\t\tMessageQueue.update(action.isSyncedRequest());\r\n\t\tApplication.unlock ( SystemAction );\r\n\t} else {\r\n\t\tthrow \"Multiple actiontargets not supported.\";\r\n\t}\r\n\r\n\t/*\r\n\t * A list of nodehandles.\r\n\t * @type {array<object>}\r\n\t *\r\n\tvar nodeHandleList = [];\r\n\r\n\tMULTIPLE SELECTIONS SETUP!\r\n\r\n\tExplorerBinding.getFocusedTreeNodeBindings ().each (\r\n\t\tfunction ( treeNodeBinding ) {\r\n\t\t\tvar systemNode = treeNodeBinding.node;\r\n\t\t\tnodeHandleList.push (\r\n\t\t\t\tsystemNode.getHandle ()\r\n\t\t\t);\r\n\t\t}\r\n\t);\r\n\r\n\tif ( nodeHandleList.length > 0 ) {\r\n\r\n\t\tvar actionHandle = action.getHandle ();\r\n\t\tvar serviceResponse = TreeService.ExecuteElementAction (\r\n\t\t\tnodeHandleList,\r\n\t\t\tactionHandle,\r\n\t\t\tApplication.CONSOLE_ID\r\n\t\t);\r\n\r\n\t\tMessageQueue.update ();\r\n\t}\r\n\t*/\r\n\r\n\t/*\r\n\tvar systemNode = null;\r\n\r\n\tvar list = ExplorerBinding.getFocusedTreeNodeBindings ();\r\n\tif ( list.hasEntries ()) {\r\n\t\tvar treeNodeBinding = list.getFirst ();\r\n\t\tvar systemNode = treeNodeBinding.node;\r\n\t}\r\n\r\n\tif ( systemNode ) {\r\n\t\tvar serviceResponse = TreeService.ExecuteSingleElementAction (\r\n\t\t\tnode.getData (),\r\n\t\t\taction.getHandle (),\r\n\t\t\tApplication.CONSOLE_ID\r\n\t\t);\r\n\t\tMessageQueue.update ();\r\n\t}\r\n\t*/\r\n}\r\n\r\n/**\r\n * Invoke tagged action.\r\n * @param {string} taggednode\r\n * @param {string} taggedaction\r\n */\r\nSystemAction.invokeTagged = function ( taggedaction, taggednode ) {\r\n\r\n\taction = SystemAction.taggedActions.get ( taggedaction );\r\n\tnode = SystemNode.taggedNodes.get ( taggednode );\r\n\tSystemAction.invoke ( action, node );\r\n}\r\n\r\n/**\r\n * Check action category before displaying in GUI. So that we\r\n * don't wonder what happens to newly introduced categories.\r\n * @param {string} string\r\n * @return {boolean}\r\n */\r\nSystemAction.hasCategory = function ( category ) {\r\n\r\n\treturn SystemAction.categories [ category ] ? true : false;\r\n}\r\n\r\n/**\r\n * @param {object} object\r\n */\r\nfunction SystemAction ( object ) {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SystemAction\" );\r\n\r\n\t/**\r\n\t * @type {object}\r\n\t * @private\r\n\t */\r\n\tthis._data = object;\r\n\r\n\t/*\r\n\t * Register tagged action.\r\n\t */\r\n\tif ( this._data.TagValue != null ) {\r\n\t\tSystemAction.taggedActions.set (\r\n\t\t\tthis._data.TagValue,\r\n\t\t\tthis\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Identifies object.\r\n */\r\nSystemAction.prototype.toString = function () {\r\n\r\n\treturn \"[SystemAction]\";\r\n}\r\n\r\n/**\r\n * Get the actionProfilehHandle.\r\n * @return {object}\r\n */\r\nSystemAction.prototype.getHandle = function () {\r\n\r\n\treturn this._data.ActionToken;\r\n}\r\n\r\n/**\r\n * Get the ActionKey. TODO: DID THIS WORK?\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getKey = function () {\r\n\r\n\treturn this._data.ActionKey;\r\n}\r\n\r\n/**\r\n * Get the action label.\r\n * @implements {ILabel}\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getLabel = function () {\r\n\r\n\treturn this._data.Label;\r\n}\r\n\r\n/**\r\n * Get the image associated to the action.\r\n * @implements {ILabel}\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getImage = function () {\r\n\r\n\treturn ImageProvider.getImageURL ( this._data.Icon );\r\n}\r\n\r\n/**\r\n * Get the disabled-image.\r\n * TODO: Implement this feature on server!\r\n * @see {SystemAction#isDisabled}\r\n * @implements {ILabel}\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getDisabledImage = function () {\r\n\r\n\treturn null;\r\n}\r\n\r\n/**\r\n * Get the action description.\r\n * @implements {ILabel}\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getToolTip = function () {\r\n\r\n\treturn this._data.ToolTip;\r\n}\r\n\r\n/**\r\n * Get action category.\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getCategory = function () {\r\n\r\n\treturn this._data.ActionCategory.Name;\r\n}\r\n\r\n/**\r\n * Get group Id.\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getGroupID = function () {\r\n\r\n\treturn this._data.ActionCategory.GroupId;\r\n}\r\n\r\n/**\r\n * Get group name.\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getGroupName = function () {\r\n\r\n\treturn this._data.ActionCategory.GroupName;\r\n}\r\n\r\n\r\n/**\r\n* Get active positions.\r\n* @return {string}\r\n*/\r\nSystemAction.prototype.getActivePositions = function () {\r\n\r\n\treturn this._data.ActivePositions;\r\n}\r\n\r\n/**\r\n * Is in toolbar?\r\n * @return {boolean}\r\n */\r\nSystemAction.prototype.isInToolBar = function () {\r\n\r\n\treturn this._data.ActionCategory.IsInToolbar;\r\n}\r\n\r\n/**\r\n * Is in folder?\r\n * @return {boolean}\r\n */\r\nSystemAction.prototype.isInFolder = function () {\r\n\r\n\treturn this._data.ActionCategory.IsInFolder;\r\n}\r\n\r\n/**\r\n * Is require sync requests for invoke action?\r\n * @return {boolean}\r\n */\r\nSystemAction.prototype.isSyncedRequest = function () {\r\n\r\n\treturn true;\r\n}\r\n\r\n\r\n/**\r\n * Get Bundle Name\r\n * @return {boolean}\r\n */\r\nSystemAction.prototype.getBundleName = function () {\r\n\r\n\treturn this._data.ActionCategory.ActionBundle;\r\n}\r\n\r\n/**\r\n * Get dialog information for bulk execution\r\n * @return {boolean}\r\n */\r\nSystemAction.prototype.getBulkExecutionDialog = function () {\r\n\r\n\treturn this._data.BulkExecutionDialog;\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getFolderName = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.isInFolder ()) {\r\n\t\tresult = this._data.ActionCategory.FolderName;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Is action disabled?\r\n * @return {boolean}\r\n */\r\nSystemAction.prototype.isDisabled = function () {\r\n\r\n\treturn this._data.Disabled;\r\n}\r\n\r\n/**\r\n * Is checkbox?\r\n * @return {boolean}\r\n */\r\nSystemAction.prototype.isCheckBox = function () {\r\n\r\n\treturn typeof this._data.CheckboxStatus != Types.UNDEFINED;\r\n}\r\n\r\n/**\r\n * Get tag value.\r\n * @return {string}\r\n */\r\nSystemAction.prototype.getTag = function () {\r\n\r\n\tvar result = null;\r\n\tif ( typeof this._data.TagValue != \"undefined\" ) {\r\n\t\tresult = this._data.TagValue;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Is checked?\r\n * @return {boolean}\r\n */\r\nSystemAction.prototype.isChecked = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.isCheckBox ()) {\r\n\t\tresult = this._data.CheckboxStatus == \"Checked\";\r\n\t} else {\r\n\t\tthrow \"Not a checkbox!\";\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/system/SystemNode.js",
    "content": "/**\r\n * This doesn't really do much for us.\r\n * @param {SystemNode} node\r\n */\r\nSystemNode.dispose = function ( node ) {\r\n\r\n\tfor ( var prop in node ) {\r\n\t\tnode [ prop ] = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * Tagged actions go here.\r\n * @type {Map<string><SystemNode>}\r\n */\r\nSystemNode.taggedNodes = new Map ();\r\n\r\n/**\r\n * @class\r\n * @param {object} data\r\n */\r\nfunction SystemNode ( data ) {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SystemNode\" );\r\n\r\n\t/**\r\n\t * @type {object}\r\n\t * @private\r\n\t */\r\n\tthis._data = data;\r\n\r\n\t/**\r\n\t * @type {List<object>}\r\n\t * @private\r\n\t */\r\n\tthis._datas = null;\r\n\r\n\t/**\r\n\t * Exposes associated actions ordered by group name.\r\n\t * @type {Map<string><List<SystemAction>>}\r\n\t */\r\n\tthis._actionProfile = null;\r\n\r\n\t/**\r\n\t * @type {HashMap<string><string>}\r\n\t * @private\r\n\t */\r\n\tthis._propertyBag = null;\r\n\r\n\t/*\r\n\t * Note that we register all actions in the constructor!\r\n\t */\r\n\tthis._registerSystemActions ();\r\n\r\n\t/*\r\n\t * Set by {@link System} when the SystemNode is first created.\r\n\t */\r\n\tthis.searchToken = null;\r\n\r\n\t/*\r\n\t * Register tagged node.\r\n\t */\r\n\tif ( this._data.TagValue != null ) {\r\n\t\tSystemNode.taggedNodes.set (\r\n\t\t\tthis._data.TagValue,\r\n\t\t\tthis\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Identifies systemnode.\r\n */\r\nSystemNode.prototype.toString = function () {\r\n\r\n\treturn \"[SystemNode]\";\r\n}\r\n\r\n/**\r\n * Scan the associated action keys and register\r\n * all SystemActions not already indexed.\r\n */\r\nSystemNode.prototype._registerSystemActions = function () {\r\n\r\n\tvar self = this;\r\n\r\n\tnew List ( this._data.ActionKeys ).each ( function ( key ) {\r\n\t\tif ( !SystemAction.actionMap.has ( key )) {\r\n\t\t\tnew List ( self._data.Actions ).each ( function ( action ) {\r\n\t\t\t\tvar category = action.ActionCategory.Name;\r\n\t\t\t\tif ( SystemAction.hasCategory ( category )) {\r\n\t\t\t\t\tvar systemAction = new SystemAction ( action );\r\n\t\t\t\t\tSystemAction.actionMap.set (\r\n\t\t\t\t\t\taction.ActionKey,\r\n\t\t\t\t\t\tsystemAction\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow \"No such action category: \" + category;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Expose the data structure for serialization back into SOAP.\r\n * @returns {object}\r\n */\r\nSystemNode.prototype.getData = function () {\r\n\r\n\treturn this._data;\r\n}\r\n\r\n/**\r\n * Get children. Notice that searchTokens are automatically inherited by child nodes!\r\n * @return {List<object>} where object is SystemNode or SystemNode\r\n */\r\nSystemNode.prototype.getChildren = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.searchToken ) {\r\n\t\tresult = System.getChildNodesBySearchToken ( this, this.searchToken );\r\n\t} else {\r\n\t\tresult = System.getChildNodes ( this );\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get branch. This will *not* return a tree structure, but the structure\r\n * can be inferred from a sequential parsing of the returned map. More\r\n * nodes may be returned than are actually present in the branch at\r\n * this exact moment.\r\n * @param {List<SystemNode>} list\r\n * @return {Map<string><List<SystemNode>>}\r\n */\r\nSystemNode.prototype.getDescendantBranch = function ( list ) {\r\n\r\n\treturn System.getDescendantBranch ( list );\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nSystemNode.prototype.getLabel = function () {\r\n\r\n\treturn this._data.Label;\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nSystemNode.prototype.getProviderName = function () {\r\n\r\n\treturn this._data.ProviderName;\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nSystemNode.prototype.getEntityToken = function () {\r\n\r\n\treturn this._data.EntityToken;\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nSystemNode.prototype.getPiggyBag = function () {\r\n\r\n\tvar result = this._data.Piggybag;\r\n\tif ( result == null ) {\r\n\t\tresult = \"\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Used to uniquely identify the SystemNode, the handle is\r\n * simply a concatenation of ProviderName and EntityToken.\r\n * @return {string}\r\n */\r\nSystemNode.prototype.getHandle = function () {\r\n\r\n\treturn this._data.ElementKey;\r\n}\r\n\r\n/**\r\n * @return {List<string>}\r\n */\r\nSystemNode.prototype.getHandles = function () {\r\n\r\n\tvar result = new List();\r\n\tif (this._datas != null) {\r\n\t\tthis._datas.each(function (data) {\r\n\t\t\tresult.add(data.ElementKey);\r\n\t\t});\r\n\t} else {\r\n\t\tresult.add(this._data.ElementKey);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Not all nodes may be tagged!\r\n * @return {string}\r\n */\r\nSystemNode.prototype.getTag = function () {\r\n\r\n\treturn this._data.TagValue;\r\n}\r\n\r\n/**\r\n * @return {ImageProfile}\r\n * @param {string} size\r\n * @return {ImageProfile}\r\n */\r\nSystemNode.prototype.getImageProfile = function ( size ) {\r\n\r\n \treturn new ImageProfile ({\r\n\t\timage : ImageProvider.getImageURL (\r\n\t\t\tthis._data.Icon,\r\n\t\t\tsize\r\n\t\t),\r\n\t\timageActive :  ImageProvider.getImageURL (\r\n\t\t\tthis._data.OpenedIcon ? this._data.OpenedIcon : this._data.Icon,\r\n\t\t\tsize\r\n\t\t)\r\n\t});\r\n}\r\n\r\n/**\r\n * Get the node description.\r\n * @return {string}\r\n */\r\nSystemNode.prototype.getToolTip = function () {\r\n\r\n\tvar result = null;\r\n\tif ( typeof this._data.ToolTip != \"undefined\" ) {\r\n\t\tresult = this._data.ToolTip;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get propertybag.\r\n * @return {HashMap<string><string>}\r\n */\r\nSystemNode.prototype.getPropertyBag = function () {\r\n\r\n\tif ( !this._propertyBag && this._data.PropertyBag && this._data.PropertyBag.length != 0 ) {\r\n\t\tvar map = {}\r\n\t\tnew List ( this._data.PropertyBag ).each ( function ( entry ) {\r\n\t\t\tmap [ entry.Key ] = entry.Value;\r\n\t\t});\r\n\t\tthis._propertyBag = map;\r\n\t}\r\n\treturn this._propertyBag;\r\n}\r\n\r\n/**\r\n * @return {boolean}\r\n */\r\nSystemNode.prototype.hasChildren = function () {\r\n\r\n\treturn this._data.HasChildren;\r\n}\r\n\r\n/**\r\n * Get the actionProfile assoicated the this node.\r\n * Actions of the category DeveloperMode will\r\n * not be included in operational mode.\r\n */\r\nSystemNode.prototype.getActionProfile = function () {\r\n\r\n\tif ( this._actionProfile == null && this._data.ActionKeys != null && this._data.ActionKeys.length > 0 ) {\r\n\r\n\t\tvar map = new Map ();\r\n\t\tvar self = this;\r\n\r\n\t\tnew List ( this._data.ActionKeys ).each ( function ( key ) {\r\n\t\t\tif ( SystemAction.actionMap.has ( key )) {\r\n\r\n\t\t\t\tvar action = SystemAction.actionMap.get ( key );\r\n\t\t\t\tvar isValid = true;\r\n\r\n\t\t\t\tif ( action.getCategory () == SystemAction.categories.DeveloperMode ) {\r\n\t\t\t\t\tif ( !Application.isDeveloperMode ) {\r\n\t\t\t\t\t\tisValid = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif ( isValid ) {\r\n\t\t\t\t\tvar id = action.getGroupID ();\r\n\t\t\t\t\tif ( !map.has ( id )) {\r\n\t\t\t\t\t\tmap.set ( id, new List ());\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar list = map.get ( id );\r\n\t\t\t\t\tlist.add ( action );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthrow \"No details for action key: \" + key;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis._actionProfile = map;\r\n\t}\r\n\r\n\treturn this._actionProfile;\r\n}\r\n\r\n/**\r\n * Test for drag type.\r\n * @return {boolean}\r\n */\r\nSystemNode.prototype.hasDragType = function () {\r\n\r\n\treturn this._data.DragType != null;\r\n}\r\n\r\n/**\r\n * Test for drag type.\r\n * @return {string}\r\n */\r\nSystemNode.prototype.getDragType = function () {\r\n\r\n\treturn this._data.DragType;\r\n}\r\n\r\n\r\n/**\r\n * Test for drag accept.\r\n * @return {boolean}\r\n */\r\nSystemNode.prototype.hasDragAccept = function () {\r\n\r\n\treturn this._data.DropTypeAccept != null;\r\n}\r\n\r\n/**\r\n * Get drag accept.\r\n * @return {List<string>}\r\n */\r\nSystemNode.prototype.getDragAccept = function () {\r\n\r\n\treturn new List (\r\n\t\tthis._data.DropTypeAccept\r\n\t);\r\n}\r\n\r\n/**\r\n * Test for detailed drag support.\r\n * @return {boolean}\r\n */\r\nSystemNode.prototype.hasDetailedDropSupport = function () {\r\n\r\n\t//alert ( \"We don't yet support detailed drag on individual treenodes!\" );\r\n\treturn this._data.DetailedDropSupported == true;\r\n}\r\n\r\n/*\r\n * Is from-language node?\r\n * @return {boolean}\r\n *\r\nSystemNode.prototype.isFromLanguage = function () {\r\n\r\n\treturn this._data.IsForeignLocale == true;\r\n}\r\n*/\r\n\r\n/**\r\n * Is disabled?\r\n * @return {boolean}\r\n */\r\nSystemNode.prototype.isDisabled = function () {\r\n\r\n\treturn this._data.IsDisabled == true;\r\n}\r\n\r\n/**\r\n * The controversial property the decides whether\r\n * or not thee treenode may recieve auto-focus.\r\n * @return {boolean}\r\n */\r\nSystemNode.prototype.isTreeLockEnabled = function () {\r\n\r\n\treturn this._data.TreeLockEnabled == true;\r\n}\r\n\r\n/**\r\n * @return {Boolean}\r\n */\r\nSystemNode.prototype.isMultiple = function () {\r\n\r\n\treturn (this._datas != null);\r\n}\r\n\r\n/**\r\n * @return {Boolean}\r\n */\r\nSystemNode.prototype.getDatas = function () {\r\n\r\n\treturn this._datas;\r\n}\r\n\r\n/**\r\n * @param {string} handle\r\n * @return {void}\r\n */\r\nSystemNode.prototype.select = function (handle) {\r\n\r\n\tif (this._datas != null) {\r\n\t\tthis._datas.each(function (data) {\r\n\t\t\tif (data.ElementKey === handle) {\r\n\t\t\t\tthis._data = data;\r\n\t\t\t\tthis._actionProfile = null;\r\n\t\t\t\tthis._registerSystemActions();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}, this);\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * @param {string} entityToken\r\n * @return {void}\r\n */\r\nSystemNode.prototype.selectByToken = function (entityToken) {\r\n\r\n\tif (this._datas != null) {\r\n\t\tthis._datas.each(function (data) {\r\n\t\t\tif (data.EntityToken === entityToken) {\r\n\t\t\t\tthis._data = data;\r\n\t\t\t\tthis._actionProfile = null;\r\n\t\t\t\tthis._registerSystemActions();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}, this);\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {List<string>}\r\n */\r\nSystemNode.prototype.getEntityTokens = function () {\r\n\r\n\tvar result = new List();\r\n\tif (this._datas != null) {\r\n\t\tthis._datas.each(function (data) {\r\n\t\t\tresult.add(data.EntityToken);\r\n\t\t});\r\n\t} else {\r\n\t\tresult.add(this._data.EntityToken);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n\r\n/**\r\n * @param {SystemNode} node\r\n * @return {SystemNode}\r\n */\r\nSystemNode.prototype.add = function (node) {\r\n\r\n\tif (this._datas == null) {\r\n\t\tthis._datas = new List();\r\n\t\tthis._datas.add(this._data);\r\n\t}\r\n\r\n\tthis._datas.add(node.getData());\r\n\r\n\treturn this;\r\n}\r\n\r\n\r\n/**\r\n * Dispose. INVOKING THIS MAY INTRODUCE ERRORS!\r\n * TODO: Of course this should be made to work.\r\n */\r\nSystemNode.prototype.dispose = function () {\r\n\r\n\tSystemNode.dispose ( this );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/UserInterface.js",
    "content": "/**\r\n * @class\r\n * UserInterface.\r\n */\r\nvar UserInterface = new function () {\r\n\r\n\t/*\r\n\t * This binding implementation is browser specific!\r\n\t */\r\n\tvar editortextboximpl = ( Client.isMozilla ? MozEditorTextBoxBinding : IEEditorTextBoxBinding );\r\n\r\n\t/*\r\n\t * Application scope binding mappings.\r\n\t * These may be overruled locally.\r\n\t */\r\n\tvar mapping = new UserInterfaceMapping ({\r\n\r\n\t\t\"body\"\t\t\t\t\t\t\t: RootBinding,\r\n\t\t\"ui:binding\"\t\t\t\t\t: Binding,\r\n\t\t\"ui:box\"\t\t\t\t\t\t: Binding,\r\n\t\t\"ui:brandsnippet\"\t\t\t\t: BrandSnippetBinding,\r\n\t\t\"ui:dialog\"\t\t\t\t\t\t: DialogBinding,\r\n\t\t\"ui:dialoghead\"\t\t\t\t\t: DialogHeadBinding,\r\n\t\t\"ui:dialogbody\"\t\t\t\t\t: DialogBodyBinding,\r\n\t\t\"ui:dialogset\"\t\t\t\t\t: DialogSetBinding,\r\n\t\t\"ui:dialogborder\"\t\t\t\t: DialogBorderBinding,\r\n\t\t\"ui:dialogcover\"\t\t\t\t: DialogCoverBinding,\r\n\t\t\"ui:titlebar\"\t\t\t\t\t: DialogTitleBarBinding,\r\n\t\t\"ui:titlebarbody\"\t\t\t\t: DialogTitleBarBodyBinding,\r\n\t\t\"ui:window\"\t\t\t\t\t\t: WindowBinding,\r\n\t\t\"ui:controlgroup\"\t\t\t\t: ControlGroupBinding,\r\n\t\t\"ui:control\"\t\t\t\t\t: ControlBinding,\r\n\t\t\"ui:menubar\" \t\t\t\t\t: MenuBarBinding,\r\n\t\t\"ui:menu\" \t\t\t\t\t\t: MenuBinding,\r\n\t\t\"ui:menubody\" \t\t\t\t\t: MenuBodyBinding,\r\n\t\t\"ui:menugroup\" \t\t\t\t\t: MenuGroupBinding,\r\n\t\t\"ui:menuitem\" \t\t\t\t\t: MenuItemBinding,\r\n\t\t\"ui:menupopup\" \t\t\t\t\t: MenuPopupBinding,\r\n\t\t\"ui:tabbox\" \t\t\t\t\t: TabBoxBinding,\r\n\t\t\"ui:tabs\" \t\t\t\t\t\t: TabsBinding,\r\n\t\t\"ui:tab\" \t\t\t\t\t\t: TabBinding,\r\n\t\t\"ui:tabpanels\" \t\t\t\t\t: TabPanelsBinding,\r\n\t\t\"ui:tabpanel\" \t\t\t\t\t: TabPanelBinding,\r\n\t\t\"ui:splitbox\" \t\t\t\t\t: SplitBoxBinding,\r\n\t\t\"ui:splitpanel\" \t\t\t\t: SplitPanelBinding,\r\n\t\t\"ui:splitter\" \t\t\t\t\t: SplitterBinding,\r\n\t\t\"ui:decks\" \t\t\t\t\t\t: DecksBinding,\r\n\t\t\"ui:deck\" \t\t\t\t\t\t: DeckBinding,\r\n\t\t\"ui:toolbar\" \t\t\t\t\t: ToolBarBinding,\r\n\t\t\"ui:toolbargroup\"\t\t\t\t: ToolBarGroupBinding,\r\n\t\t\"ui:toolbarbody\"\t\t\t\t: ToolBarBodyBinding,\r\n\t\t\"ui:toolbarbutton\" \t\t\t\t: ToolBarButtonBinding,\r\n\t\t\"ui:toolbarlabel\" \t\t\t\t: ToolBarLabelBinding,\r\n\t\t\"ui:labelbox\" \t\t\t\t\t: LabelBinding,\r\n\t\t\"ui:text\" \t\t\t\t\t\t: TextBinding,\r\n\t\t\"ui:clickbutton\" \t\t\t\t: ClickButtonBinding,\r\n\t\t\"ui:tree\" \t\t\t\t\t\t: TreeBinding,\r\n\t\t\"ui:treebody\" \t\t\t\t\t: TreeBodyBinding,\r\n\t\t\"ui:treenode\" \t\t\t\t\t: TreeNodeBinding,\r\n\t\t\"ui:flexbox\" \t\t\t\t\t: FlexBoxBinding,\r\n\t\t\"ui:scrollbox\" \t\t\t\t\t: ScrollBoxBinding,\r\n\t\t\"ui:popupset\" \t\t\t\t\t: PopupSetBinding,\r\n\t\t\"ui:popup\" \t\t\t\t\t\t: PopupBinding,\r\n\t\t\"ui:sourceeditor\"\t\t\t\t: CodeMirrorEditorBinding,\r\n\t\t\"ui:visualeditor\" \t\t\t\t: VisualEditorBinding,\r\n\t\t\"ui:visualmultieditor\" \t\t\t: VisualMultiEditorBinding,\r\n\t\t\"ui:visualmultitemplateeditor\" \t: VisualMultiTemplateEditorBinding,\r\n\t\t\"ui:wysiwygeditortoolbarbutton\" : EditorToolBarButtonBinding, // needed?\r\n\t\t\"ui:dock\" \t\t\t\t\t\t: DockBinding,\r\n\t\t\"ui:docktabs\" \t\t\t\t\t: DockTabsBinding,\r\n\t\t\"ui:docktab\" \t\t\t\t\t: DockTabBinding,\r\n\t\t\"ui:dockpanels\" \t\t\t\t: DockPanelsBinding,\r\n\t\t\"ui:dockpanel\"\t\t\t\t\t: DockPanelBinding,\r\n\t\t\"ui:page\"\t\t\t\t\t\t: PageBinding,\r\n\t\t\"ui:editorpage\"\t\t\t\t\t: EditorPageBinding,\r\n\t\t\"ui:dialogpage\"\t\t\t\t\t: DialogPageBinding,\r\n\t\t\"ui:pagebody\"\t\t\t\t\t: DialogPageBodyBinding,\r\n\t\t\"ui:wizardpage\"\t\t\t\t\t: WizardPageBinding,\r\n\t\t\"ui:explorer\" \t\t\t\t\t: ExplorerBinding,\r\n\t\t\"ui:explorermenu\" \t\t\t\t: ExplorerMenuBinding,\r\n\t\t\"ui:explorertoolbar\" \t\t\t: ExplorerToolBarBinding,\r\n\t\t\"ui:explorertoolbarbutton\"\t\t: ExplorerToolBarButtonBinding,\r\n\t\t\"ui:stagecontainer\"\t\t\t\t: StageContainerBinding,\r\n\t\t\"ui:stage\"\t\t\t\t\t\t: StageBinding,\r\n\t\t\"ui:stagedecks\"\t\t\t\t\t: StageDecksBinding,\r\n\t\t\"ui:stagedeck\"\t\t\t\t\t: StageDeckBinding,\r\n\t\t\"ui:viewset\"\t\t\t\t\t: ViewSetBinding,\r\n\t\t\"ui:view\"\t\t\t\t\t\t: ViewBinding,\r\n\t\t\"ui:broadcasterset\"\t\t\t\t: BroadcasterSetBinding,\r\n\t\t\"ui:broadcaster\"\t\t\t\t: BroadcasterBinding,\r\n\t\t\"ui:fields\"\t\t\t\t\t\t: FieldsBinding,\r\n\t\t\"ui:fieldgroup\"\t\t\t\t\t: FieldGroupBinding,\r\n\t\t\"ui:field\"\t\t\t\t\t\t: FieldBinding,\r\n\t\t\"ui:fielddesc\"\t\t\t\t\t: FieldDescBinding,\r\n\t\t\"ui:fielddata\"\t\t\t\t\t: FieldDataBinding,\r\n\t\t\"ui:fieldhelp\"\t\t\t\t\t: FieldHelpBinding,\r\n\t\t\"ui:datainput\"\t\t\t\t\t: DataInputBinding,\r\n\t\t\"ui:selector\"\t\t\t\t\t: SelectorBinding,\r\n\t\t\"ui:simpleselector\"\t\t\t\t: SimpleSelectorBinding,\r\n\t\t\"ui:multiselector\"\t\t\t\t: MultiSelectorBinding,\r\n\t\t\"ui:hierarchicalselector\"\t\t: HierarchicalSelectorBinding,\r\n\t\t\"ui:datainputselector\"\t\t\t: DataInputSelectorBinding,\r\n\t\t\"ui:datainputdialog\"\t\t\t: DataInputDialogBinding,\r\n\t\t\"ui:urlinputdialog\"\t\t\t\t: UrlInputDialogBinding,\r\n\t\t\"ui:datainputbutton\"\t\t\t: DataInputButtonBinding,\r\n\t\t\"ui:textbox\"\t\t\t\t\t: TextBoxBinding,\r\n\t\t\"ui:editortextbox\"\t\t\t\t: editortextboximpl,\r\n\t\t\"ui:radiodatagroup\"\t\t\t\t: RadioDataGroupBinding,\r\n\t\t\"ui:radio\"\t\t\t\t\t\t: RadioDataBinding,\r\n\t\t\"ui:checkbutton\"\t\t\t\t: CheckButtonBinding,\r\n\t\t\"ui:checkbox\"\t\t\t\t\t: CheckBoxBinding,\r\n\t\t\"ui:checkboxgroup\"\t\t\t\t: CheckBoxGroupBinding,\r\n\t\t\"ui:datadialog\"\t\t\t\t\t: DataDialogBinding,\r\n\t\t\"ui:postbackdialog\"\t\t\t\t: PostBackDataDialogBinding,\r\n\t\t\"ui:nullpostbackdialog\"\t\t\t: NullPostBackDataDialogBinding,\r\n\t\t\"ui:htmldatadialog\"\t\t\t\t: HTMLDataDialogBinding,\r\n\t\t\"ui:functioneditor\"\t\t\t\t: FunctionEditorDataBinding,\r\n\t\t\"ui:parametereditor\"\t\t\t: ParameterEditorDataBinding,\r\n\t\t\"ui:keyset\"\t\t\t\t\t\t: KeySetBinding,\r\n\t\t\"ui:cover\"\t\t\t\t\t\t: CoverBinding,\r\n\t\t\"ui:uncover\"\t\t\t\t\t: UncoverBinding,\r\n\t\t\"ui:cursor\"\t\t\t\t\t\t: CursorBinding,\r\n\t\t\"ui:dialogtoolbar\"\t\t\t\t: DialogToolBarBinding,\r\n\t\t\"ui:focus\"\t\t\t\t\t\t: FocusBinding,\r\n\t\t\"ui:balloonset\"\t\t\t\t\t: BalloonSetBinding,\r\n\t\t\"ui:balloon\"\t\t\t\t\t: BalloonBinding,\r\n\t\t\"ui:error\"\t\t\t\t\t\t: ErrorBinding,\r\n\t\t\"ui:progressbar\"\t\t\t\t: ProgressBarBinding,\r\n\t\t\"ui:lazybinding\"\t\t\t\t: LazyBindingBinding,\r\n\t\t\"ui:sourcecodeviewer\"\t\t\t: SourceCodeViewerBinding,\r\n\t\t\"ui:theatre\"\t\t\t\t\t: TheatreBinding,\r\n\t\t\"ui:persistance\"\t\t\t\t: PersistanceBinding,\r\n\t\t\"ui:filepicker\"\t\t\t\t\t: FilePickerBinding,\r\n\t\t\"ui:request\"\t\t\t\t\t: RequestBinding,\r\n\t\t\"ui:response\"\t\t\t\t\t: ResponseBinding,\r\n\t\t\"ui:stylesheet\"\t\t\t\t\t: StyleBinding,\r\n\t\t\"ui:resolvercontainer\"\t\t\t: ResolverContainerBinding\r\n\t});\r\n\r\n\t/*\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tvar logger = SystemLogger.getLogger ( \"UserInterface\" );\r\n\r\n\t/*\r\n\t * Indexing an object with two properties, \"element\" and \"binding\".\r\n\t * @type {HashMap<string><object>}\r\n\t */\r\n\tvar keys = {};\r\n\r\n\t/**\r\n\t * Regsiter element with binding implementation. If you omit the binding\r\n\t * implementation, we will search the element environment for the most\r\n\t * likely binding to register with.\r\n\t * @param {DOMElement} element\r\n\t * @param {Binding} impl Optional\r\n\t * @return {Binding} Returns null if no suitable Binding was found.\r\n\t */\r\n\tthis.registerBinding = function ( element, impl ) {\r\n\r\n\t\tvar binding = null;\r\n\r\n\t\tif ( !this.hasBinding ( element )) {\r\n\r\n\t\t\tvar parentWindow = DOMUtil.getParentWindow ( element );\r\n\r\n\t\t\tif ( DOMUtil.getLocalName ( element ) != \"bindingmapping\" ) {\r\n\r\n\t\t\t\t// setup the quick and dirty way of assigning a custom binding\r\n\t\t\t\tif ( !impl && element.getAttribute ( \"binding\" ) != null ) {\r\n\t\t\t\t\tvar bindingstring = element.getAttribute ( \"binding\" );\r\n\t\t\t\t\timpl = parentWindow [ bindingstring ];\r\n\t\t\t\t\tif ( impl == null ) {\r\n\t\t\t\t\t\tthrow \"No such binding in scope: \" + bindingstring;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// check for local scope binding mapping\r\n\t\t\t\tif ( !impl ) {\r\n\t\t\t\t\tvar manager = parentWindow.DocumentManager;\r\n\t\t\t\t\tif ( manager ) {\r\n\t\t\t\t\t\tvar custom = manager.customUserInterfaceMapping;\r\n\t\t\t\t\t\tif ( custom ) {\r\n\t\t\t\t\t\t\timpl = custom.getBindingImplementation ( element );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// check for global scope binding mapping\r\n\t\t\t\tif ( !impl ) {\r\n\t\t\t\t\timpl = mapping.getBindingImplementation ( element );\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// instantiate new binding\r\n\t\t\t\tif ( impl != null && !Application.isMalFunctional ) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tbinding = new impl ();\r\n\t\t\t\t\t} catch ( exception ) {\r\n\t\t\t\t\t\tApplication.isMalFunctional = true;\r\n\t\t\t\t\t\talert ( \"No such binding!\\n\" + exception.message + ( exception.stack ? \"\\n\" + exception.stack : \"\" ));\r\n\t\t\t\t\t\tthrow ( exception );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// register element and binding, invoking the bindings onBindingRegister method.\r\n\t\t\t\tif ( binding ) {\r\n\r\n\t\t\t\t\tvar key = KeyMaster.getUniqueKey ();\r\n\t\t\t\t\telement.setAttribute ( \"key\", key );\r\n\t\t\t\t\tbinding.key = key;\r\n\t\t\t\t\tif ( !element.id ) {\r\n\t\t\t\t\t\telement.id = key;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tkeys [ key ] = {\r\n\t\t\t\t\t\telement : element,\r\n\t\t\t\t\t\tbinding : binding\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbinding.onBindingRegister ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Finally return the binding.\r\n\t\t */\r\n\t\treturn binding;\r\n\t}\r\n\r\n\t/**\r\n\t * Unregister binding. This will destroy the binding.\r\n\t * @param {Binding} binding\r\n\t */\r\n\tthis.unRegisterBinding = function ( binding ) {\r\n\r\n\t\tterminate ( binding );\r\n\t}\r\n\r\n\t/**\r\n\t * Terminate Binding.\r\n\t */\r\n\tfunction terminate ( binding ) {\r\n\r\n\t\tif ( Binding.exists ( binding ) == true ) {\r\n\t\t\tvar key = binding.key;\r\n\t\t\tBinding.destroy ( binding );\r\n\t\t\tif ( key ) {\r\n\t\t\t\tif ( keys [ key ]) {\r\n\t\t\t\t\tkeys [ key ].binding = null;\r\n\t\t\t\t\tkeys [ key ].element = null;\r\n\t\t\t\t\tdelete keys [ key ];\r\n\t\t\t\t\tbinding = null;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlogger.error ( \"URGH: \" + key );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @param {Binding} binding\r\n\t * @return {DOMElement}\r\n\t * @deprecated\r\n\t */\r\n\tthis.getElement = function ( binding ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( keys [ binding.key ]) {\r\n\t\t\tresult = keys [ binding.key ].element;\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/**\r\n\t * Get binding by bound element.\r\n\t * @param {DOMElement} element\r\n\t * @return {Binding}\r\n\t */\r\n\tthis.getBinding = function ( element ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( element && element.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\ttry {\r\n\t\t\t\tvar key = element.getAttribute ( \"key\" );\r\n\t\t\t\tif ( key && keys [ key ]) {\r\n\t\t\t\t\tresult = keys [ key ].binding;\r\n\t\t\t\t}\r\n\t\t\t} catch ( exception ) { // if this happens, you can usually solve with a timeout\r\n\t\t\t\talert ( \"getBinding exception occurred on element:\\n\\n\\t\\t\" + element );\r\n\t\t\t\tif ( exception.stack ) {\r\n\t\t\t\t\talert ( exception.stack );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/**\r\n\t * Get binding by key.\r\n\t * @param {string} key\r\n\t * @return {Binding}\r\n\t */\r\n\tthis.getBindingByKey = function ( key ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( keys [ key ]) {\r\n\t\t\tresult = keys [ key ].binding;\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @return {boolean}\r\n\t */\r\n\tthis.hasBinding = function ( element ) {\r\n\r\n\t\treturn this.getBinding ( element ) != null;\r\n\t}\r\n\r\n\t/**\r\n\t * TODO: explain this!\r\n\t */\r\n\tthis.isBindingVisible = function ( binding ) {\r\n\r\n\t\t/*\r\n\t\t * Note that we return false while startup up\r\n\t\t * for reasons of very small performance gain.\r\n\t\t */\r\n\t\tvar result = Application.isOperational;\r\n\r\n\t\tif ( result == true ) {\r\n\r\n\t\t\t/*\r\n\t\t\t * TODO: construct this crawler only once!\r\n\t\t\t */\r\n\t\t\tvar crawler = new Crawler ();\r\n\t\t\tcrawler.type = NodeCrawler.TYPE_ASCENDING;\r\n\t\t\tcrawler.id = \"visibilitycrawler\";\r\n\t\t\tcrawler.addFilter ( function ( element ) {\r\n\t\t\t\tvar b = UserInterface.getBinding ( element );\r\n\t\t\t\tvar res = 0;\r\n\t\t\t\tif ( !b.isVisible ) {\r\n\t\t\t\t\tresult = false;\r\n\t\t\t\t\tres = NodeCrawler.STOP_CRAWLING;\r\n\t\t\t\t}\r\n\t\t\t\treturn res;\r\n\t\t\t});\r\n\t\t\tcrawler.crawl ( binding.bindingElement );\r\n\t\t\tcrawler.dispose ();\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// DEBUG STUFF ................................................................\r\n\r\n\tvar debugKeys = null;\r\n\r\n\t/**\r\n\t * Counting active Binding instances.\r\n\t * @return {int}\r\n\t */\r\n\tthis.getBindingCount = function () {\r\n\r\n\t\tvar count = 0;\r\n\t\tfor ( var key in keys ) {\r\n\t\t\tcount ++;\r\n\t\t}\r\n\t\treturn count;\r\n\t}\r\n\r\n\t/*\r\n\t * Copy all keys to a reference hashmap.\r\n\t */\r\n\tthis.setPoint = function () {\r\n\r\n\t\tdebugKeys = {};\r\n\t\tfor ( var key in keys ) {\r\n\t\t\tdebugKeys [ key ] = true;\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Return list of NEW keys since point was set (see setPoint).\r\n\t * This can be used to pinpoint bindings not properly disposed.\r\n\t * @return {List<string>}\r\n\t */\r\n\tthis.getPoint = function () {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( debugKeys ) {\r\n\t\t\tresult = new List ();\r\n\t\t\tfor ( var key in keys ) {\r\n\t\t\t\tif ( !debugKeys [ key ]) {\r\n\t\t\t\t\tresult.add ( key );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/*\r\n\t * Enough point.\r\n\t */\r\n\tthis.clearPoint = function () {\r\n\r\n\t\tdebugKeys = null;\r\n\t}\r\n\r\n\t/**\r\n\t * Tracking undisposed bindings.\r\n\t */\r\n\tthis.trackUndisposedBindings = function () {\r\n\r\n\t\tvar report = null;\r\n\r\n\t\tfor ( var key in keys ) {\r\n\t\t\tvar entry = keys [ key ];\r\n\t\t\tif ( !entry.binding || !entry.element || !Binding.exists ( entry.binding )) {\r\n\t\t\t\tif ( !report ) {\r\n\t\t\t\t\treport = \"Bindings illdisposed: \";\r\n\t\t\t\t}\r\n\t\t\t\treport += entry.binding + \" \";\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( report != null ) {\r\n\t\t\tlogger.error ( report );\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Autotrack.\r\n\t * @param {boolean} isTrack\r\n\t */\r\n\tthis.autoTrackDisposedBindings = function ( isTrack ) {\r\n\r\n\t\tif ( isTrack ) {\r\n\t\t\tif ( !window.disposedbindingtrackinterval ) {\r\n\t\t\t\twindow.disposedbindingtrackinterval = window.setInterval (\r\n\t\t\t\t\tUserInterface.trackUndisposedBindings, 10000\r\n\t\t\t\t);\r\n\t\t\t\tthis.trackUndisposedBindings ();\r\n\t\t\t}\r\n\t\t} else if ( window.disposedbindingtrackinterval ) {\r\n\t\t\twindow.clearInterval ( window.disposedbindingtrackinterval );\r\n\t\t\twindow.disposedbindingtrackinterval = null;\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/UserInterfaceMapping.js",
    "content": "/**\r\n * @class\r\n * @param {HashMap<string><BindingImplementation>} map\r\n */\r\nfunction UserInterfaceMapping ( map ) {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"UserInterfaceMapping\" );\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><BindingImplementation>}\r\n\t */\r\n\tthis.map = {};\r\n\r\n\tfor (var m in map) {\r\n\t\tthis.map[m.replace('ui:', '')] = map[m];\r\n\t\tthis.map[m] = map[m];\r\n\t}\r\n}\r\n\r\n/**\r\n * Merge with another mapping.\r\n * @param {UserInterfaceMapping} mapping\r\n */\r\nUserInterfaceMapping.prototype.merge = function ( mapping ) {\r\n\t\r\n\tfor ( var nodename in mapping.map ) {\r\n\t\tthis.map [ nodename ] = mapping.getBindingImplementation ( nodename );\r\n\t}\r\n}\r\n\r\n/**\r\n * Get binding implementation for a given element.\r\n * @param {DOMElement} element\r\n * @return {BindingImplementation}\r\n */\r\nUserInterfaceMapping.prototype.getBindingImplementation = function ( element ) {\r\n\t\r\n\tvar result = null;\r\n\tvar name = element.nodeName.toLowerCase();\r\n\r\n\tif ( this.map [ name ]) {\r\n\t\tresult = this.map [ name ];\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/Binding.js",
    "content": "/*\r\n * Note that all bindings meddle with the constructor property thusly.\r\n */\r\nBinding.prototype.constructor = Binding;\r\n\r\n/*\r\n * Attribute names reserved for NET server postback.\r\n */\r\nBinding.CALLBACKID = \"callbackid\"; // __EVENTTARGET\r\nBinding.CALLBACKARG = \"callbackarg\"; // __EVENTARGUMENT\r\n\r\n/*\r\n * Special classname to clear the float using CSS hacks.\r\n * These are added dynamically, although it is not the\r\n * best way to performance-optimize Internet Explorer.\r\n * @see \"base.css\"\r\n */\r\nBinding.CLASSNAME_CLEARFLOAT = \"clearfix\";\r\nBinding.CLASSNAME_FOCUSED = \"focused\";\r\n\r\n/*\r\n * Standard timeout in milliseconds before a lazy binding\r\n * wakes up properly. This prevents jumping layouts. The\r\n * binding may define a different timeout if desired.\r\n * @see {Binding#wakeUp}\r\n */\r\nBinding.SNOOZE = Client.isMozilla == true ? 125: 250;\r\n\r\n/*\r\n * Actions common to all Bindings.\r\n */\r\nBinding.ACTION_DRAG = \"bindingdrag\";\r\nBinding.ACTION_DROP = \"bindingdrop\";\r\nBinding.ACTION_DIRTY = \"bindingdirty\";\r\nBinding.ACTION_VALID = \"bindingvalid\";\r\nBinding.ACTION_UPDATED = \"bindingupdated\";\r\nBinding.ACTION_INVALID = \"bindinginvalid\";\r\nBinding.ACTION_RESIZED = \"bindingresized\";\r\nBinding.ACTION_FOCUSED = \"bindingfocused\";\r\nBinding.ACTION_BLURRED = \"bindingblurred\";\r\nBinding.ACTION_ATTACHED = \"bindingattached\";\r\nBinding.ACTION_DETACHED = \"bindingdetached\";\r\nBinding.ACTION_DISPOSED = \"bindingdisposed\";\r\nBinding.ACTION_MOVETOTOP = \"bindingmovetotop\";\r\nBinding.ACTION_ACTIVATED = \"bindingactivated\";\r\nBinding.ACTION_REGISTERED = \"bindingregistered\";\r\nBinding.ACTION_MOVEDONTOP = \"bindingmovedontop\";\r\nBinding.ACTION_INITIALIZED = \"bindinginitialized\";\r\nBinding.ACTION_FORCE_REFLEX = \"bindingforcereflex\";\r\nBinding.ACTION_DIMENSIONCHANGED = \"bindingdimensionchanged\";\r\nBinding.ACTION_VISIBILITYCHANGED = \"bindingvisibilitychanged\";\r\n\r\n/**\r\n * Abstract method \"placeholder\" function. Indicates\r\n * that subclasses should overwrite the particular method.\r\n * @type {function}\r\n */\r\nBinding.ABSTRACT_METHOD = function () {\r\n\r\n\tSystemDebug.stack ( arguments );\r\n\tthrow ( this.toString () + \" abstract method not implemented\" );\r\n}\r\n\r\n/**\r\n * Evaluate inline script (declared in markup) in binding context.\r\n * @param {String} script\r\n * @param {Binding} binding\r\n * @return {object}\r\n */\r\nBinding.evaluate = function ( script, binding ) {\r\n\r\n\tvar result = null;\r\n\tvar manager = binding.bindingWindow.WindowManager;\r\n\tif ( manager != null ) {\r\n\t\tvar statement = Binding.parseScriptStatement ( script, binding.key );\r\n\t\tresult = manager.evaluate ( statement );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Due to differences in the implementation of \"eval\" in different browsers, it may be\r\n * nescessary to replace the \"this\" keyword in a script string with a global pointer.\r\n * This is needed for all versions of IE and for Firefox starting from version 3.7\r\n * TODO: Doesn't handle string \"alert(this)\" !!!\r\n * @see {ButtonBinding}\r\n * @see {TreeNodeBinding}\r\n * @param {String} script\r\n * @param {String} key\r\n */\r\nBinding.parseScriptStatement = function ( script, key ) {\r\n\r\n\tif ( script != null && key != null ) {\r\n\t\tvar replacement = \"UserInterface.getBindingByKey ( \\\"\" + key + \"\\\" )\";\r\n\t\tscript = script.replace ( /(\\W|^)this(,| +|\\)|;)/g, replacement );\r\n\t\tscript = script.replace ( /(\\W|^)this(\\.)/g, replacement + \".\" );\r\n\t}\r\n\treturn script;\r\n}\r\n\r\n/**\r\n * Nowadays, with Dot Net Ajax and what, you can never\r\n * be sure that your Binding hasn't been spirited away behind\r\n * your back. This method will verify the integrity of your\r\n * binding before you attempt to invoke it's methods.\r\n * @param {Binding} binding\r\n * @return {boolean}\r\n */\r\nBinding.exists = function ( binding ) {\r\n\r\n\tvar result = false;\r\n\ttry {\r\n\t\tif ( binding && binding.bindingElement && binding.bindingElement.nodeType && binding.isDisposed == false ) {\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t} catch ( accessDeniedException ) {\r\n\t\tresult = false;\r\n\t} finally {\r\n\t\treturn result;\r\n\t}\r\n}\r\n\r\n/**\r\n * Destroy binding. Somewhat overdestructively in order to patch memory leaks.\r\n * Note that the DOM element is not removed, only the binding gets nuked.\r\n * @param {Binding} binding\r\n */\r\nBinding.destroy = function ( binding ) {\r\n\r\n\tif ( !binding.isDisposed ) {\r\n\r\n\t\tif ( binding.acceptor != null ) {\r\n\t\t\tbinding.acceptor.dispose ();\r\n\t\t}\r\n\t\tif ( binding.dragger != null ) {\r\n\t\t\tbinding.disableDragging ();\r\n\t\t}\r\n\t\tif ( binding.boxObject != null ) {\r\n\t\t\tbinding.boxObject.dispose ();\r\n\t\t}\r\n\t\tif (binding._domEventHandlers != null) {\r\n\t\t\tDOMEvents.cleanupEventListeners(binding);\r\n\t\t}\r\n\t\tfor ( var branch in binding.shadowTree ) {\r\n\t\t\tvar entry = binding.shadowTree [ branch ];\r\n\t\t\tif ( entry instanceof Binding && Binding.exists ( entry )) {\r\n\t\t\t\tentry.dispose ( true );\r\n\t\t\t}\r\n\t\t\tbinding.shadowTree [ branch ] = null;\r\n\t\t}\r\n\t\tbinding.isDisposed = true;\r\n\t\tbinding = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * Inject the binding with a hidden field so that the ASP.NET server may recognize it.\r\n * The binding may access the field as \"this.shadowTree.dotnetinput\" to mofify its value.\r\n * Note this: The ID attribute is for the client while the callbackid is for the server.\r\n * @param {Binding} binding\r\n * @param {String} value\r\n * @returns\r\n */\r\nBinding.dotnetify = function ( binding, value ) {\r\n\r\n\tvar callbackid = binding.getCallBackID ();\r\n\r\n\tif ( callbackid != null ) {\r\n\t\tvar input = DOMUtil.createElementNS ( Constants.NS_XHTML, \"input\", binding.bindingDocument );\r\n\t\tinput.type = \"hidden\";\r\n\t\tinput.id = callbackid;\r\n\t\tinput.name = callbackid;\r\n\t\tinput.value = value != null ? value : \"\";\r\n\t\tbinding.bindingElement.appendChild ( input );\r\n\t\tbinding.shadowTree.dotnetinput = input;\r\n\t} else {\r\n\t\tthrow binding.toString () + \": Missing callback ID\";\r\n\t}\r\n}\r\n\r\n/**\r\n * Build image profile.\r\n * @param {Binding} binding\r\n */\r\nBinding.imageProfile = function ( binding ) {\r\n\r\n\tvar image = binding.getProperty ( \"image\" );\r\n\tvar imageHover = binding.getProperty ( \"image-hover\" );\r\n\tvar imageActive = binding.getProperty ( \"image-active\" );\r\n\tvar imageDisabled = binding.getProperty ( \"image-disabled\" );\r\n\r\n\t/*\r\n\t * Note that we don't overwrite properties\r\n\t * that were already assigned programatically.\r\n\t */\r\n\tif ( binding.imageProfile == null ) {\r\n\t\tif ( binding.image == null && image != null ) {\r\n\t\t\tbinding.image = image;\r\n\t\t}\r\n\t\tif ( binding.imageHover == null && imageHover != null ) {\r\n\t\t\tbinding.imageHover = imageHover;\r\n\t\t}\r\n\t\tif ( binding.imageActive == null && imageActive != null ) {\r\n\t\t\tbinding.imageActive = imageActive;\r\n\t\t}\r\n\t\tif ( binding.imageDisabled == null && imageDisabled != null ) {\r\n\t\t\tbinding.imageDisabled = imageDisabled;\r\n\t\t}\r\n\t\tif ( binding.image || binding.imageHover || binding.imageActive || binding.imageDisabled ) {\r\n\t\t\tbinding.imageProfile = new ImageProfile ( binding );\r\n\t\t}\r\n\t}\r\n};\r\n\r\n// BINDING CLASS ..................................................................\r\n\r\n/**\r\n * @class\r\n * The <code>Binding</code> is the base class for all objects\r\n * that control UI namespaced DOM elements on the rendering canvas.\r\n * @implements {IEventListener}\r\n * @implements {IActionListener}\r\n * @implements {IBroadcastListener}\r\n */\r\nfunction Binding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"binding\" );\r\n\r\n\t/**\r\n\t * This property is set by {@link UserInterface} when the binding\r\n\t * is registered. The bound element is assigned a DOM attribute\r\n\t * \"key\" with a corresponding value.\r\n\t * @type {string}\r\n\t */\r\n\tthis.key = null;\r\n\r\n\t/**\r\n\t * The DOM element wrapped by the Binding.\r\n\t * @type {DOMElement}\r\n\t */\r\n\tthis.bindingElement\t= null;\r\n\r\n\t/**\r\n\t * The ownerDocument of the bound element.\r\n\t * @type {DOMDocument}\r\n\t */\r\n\tthis.bindingDocument = null;\r\n\r\n\t/**\r\n\t * The parent window of the bound element.\r\n\t * @type {DocumentView}\r\n\t */\r\n\tthis.bindingWindow = null;\r\n\r\n\t/**\r\n\t * Pointers to DOMElements generated by the Binding.\r\n\t * @type {HashMap<string><DOMElement>}\r\n\t */\r\n\tthis.shadowTree = null;\r\n\r\n\t/**\r\n\t * A collection of actionlisteners.\r\n\t * @type {HashMap<string><array>}\r\n\t * @private\r\n\t */\r\n\tthis.actionListeners = null;\r\n\r\n\t/**\r\n\t * @type {PopupBinding}\r\n\t * @private\r\n\t */\r\n\tthis.contextMenuBinding = null;\r\n\r\n\t/**\r\n\t * Switched to true when the bindings <code>onBindingRegister</code> method executes.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRegistered = false;\r\n\r\n\t/**\r\n\t * Switched to true when the bindings <code>onBindingAttach</code> method executes.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isAttached = false;\r\n\r\n\t/**\r\n\t * Switched to true when the bindings <code>onBindingInitialize</code> method executes.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isInitialized = false;\r\n\r\n\t/**\r\n\t * Switched to true when the bindings <code>onBindingDispose</code> method executes\r\n\t * (although technically the switch is performed elsewhere).\r\n\t * @see {Binding#dispose}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisposed = false;\r\n\r\n\t/**\r\n\t * If set to true, the binding element will dispatch a special action on drag gesture.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDraggable = false;\r\n\r\n\t/**\r\n\t * This one handles dragging action.\r\n\t * @type {Dragger}\r\n\t */\r\n\tthis.dragger = null;\r\n\r\n\t/**\r\n\t * This depends on...\r\n\t * @type {HashMap<string><boolean>}\r\n\t */\r\n\tthis.memberDependencies = null;\r\n\r\n\t/**\r\n\t * Depends on this...\r\n\t * @type {HashMap<string><Binding>}\r\n\t */\r\n\tthis.dependentBindings = null;\r\n\r\n\t/**\r\n\t * This maps binding DOM properties to binding methods. When the property\r\n\t * is modified, the method will be invoked with the property value as an\r\n\t * argument. To avoid an excessive amount of mutation event listeners,\r\n\t * you *must* change the property using the setProperty method. This property\r\n\t * should be specified when you wire the binding to a {@link BroadcasterBinding}\r\n\t * @type {HashMap<string><function>}\r\n\t */\r\n\tthis.propertyMethodMap = null;\r\n\r\n\t/**\r\n\t * If set to true, this binding may still dispatch an {@link Action} but\r\n\t * it will not relay events dispatched by any descendant binding.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isBlockingActions = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = true;\r\n\r\n\t/**\r\n\t * Presents a simpliefied API for dealing with this bindings size and position on stage.\r\n\t * @type {BindingBoxObject}\r\n\t */\r\n\tthis.boxObject = null;\r\n\r\n\t/**\r\n\t * Identifies the type of this binding while dragging.\r\n\t * @see {Binding#dragAccept}\r\n\t * @type {string}\r\n\t */\r\n\tthis.dragType = null;\r\n\r\n\t/**\r\n\t * Whitespace-separated list of draggable types to accept.\r\n\t * @see {Binding#dragType}\r\n\t * @type {string}\r\n\t */\r\n\tthis.dragAccept = null;\r\n\r\n\t/**\r\n\t * If set to true, this binding will not accept any dragged bindings.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.dragReject = false;\r\n\r\n\t/**\r\n\t * Handles binding acceptance end rejection while dragging.\r\n\t * @type {BindingAcceptor}\r\n\t */\r\n\tthis.acceptor = null;\r\n\r\n\t/**\r\n\t * Flags lazy attachment.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isLazy = false;\r\n\r\n\t/**\r\n\t * The property \"persistance\" must be markup up as a whitespace\r\n\t * separated list of persisted properties. Internally we use a hashmap.\r\n\t * @type {HashMap<string><string>}\r\n\t */\r\n\tthis._persist = null;\r\n\r\n\t/**\r\n\t * True if DOM content was expanded server side.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isBindingBuild = false;\r\n\r\n\t/**\r\n\t * Used to cleanup activationaware bindings.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasActivationAwareness = false;\r\n\r\n\t/**\r\n\t * While flexing, minimize the amount of DOM iterations by flipping this.\r\n\t * @see {FlexBoxCrawler}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFlexSuspended = false;\r\n\r\n\t/**\r\n\t * Blocking crawler progression by matching the crawler ID with a list.\r\n\t * This way, bindings may fasttrack simple rejection of common crawlers.\r\n\t * Advanced handling of crawlers should be done with method handleCrawler.\r\n\t * Note that the crawler filter property is null untill subclass constructs it.\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters = null;\r\n\r\n\t/**\r\n\t * EventBroadcaster subscriptions.\r\n\t * @type {Map<string><boolean>}\r\n\t */\r\n\tthis._subscriptions = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBinding.prototype.toString = function () {\r\n\r\n\treturn \"[Binding]\";\r\n}\r\n\r\n/**\r\n * Register binding. Must only be invoked by the DocumentManager.\r\n */\r\nBinding.prototype.onBindingRegister = function () {\r\n\r\n\tif ( !this.isRegistered ) {\r\n\r\n\t\tthis.bindingElement\t\t\t= UserInterface.getElement ( this );\r\n\t\tthis.bindingDocument \t\t= this.bindingElement.ownerDocument;\r\n\t\tthis.bindingWindow\t\t\t= DOMUtil.getParentWindow ( this.bindingDocument );\r\n\t\tthis.shadowTree \t\t\t= {};\r\n\t\tthis.actionListeners\t\t= {};\r\n\t\tthis.propertyMethodMap\t\t= {};\r\n\t\tthis.isRegistered \t\t\t= true;\r\n\t\tthis._subscriptions\t\t\t= new Map ();\r\n\r\n\t\tthis._updateBindingMap ( true );\r\n\t\tif ( this.getProperty ( \"lazy\" )) {\r\n\t\t\tthis.isLazy = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Attach binding. Must only be invoked by the DocumentManager or via the attach method.\r\n */\r\nBinding.prototype.onBindingAttach = function () {\r\n\r\n\tif ( !this.isAttached ) {\r\n\t\tif ( !this.bindingElement.parentNode ) {\r\n\t\t\talert ( this + \" onBindingAttach: Binding must be positioned in document structure before attachment can be invoked.\" );\r\n\t\t} else {\r\n\t\t\tthis.boxObject = new BindingBoxObject(this);\r\n\t\t\tthis._initializeBindingTestFeatures();\r\n\t\t\tthis._initializeBindingPersistanceFeatures ();\r\n\t\t\tthis._initializeBindingGeneralFeatures ();\r\n\t\t\tthis._initializeBindingDragAndDropFeatures ();\r\n\t\t\tthis._updateBindingMap ( true );\r\n\t\t\tthis.isAttached = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Initialize binding. Must only be invoked by the DocumentManager or via the attach method.\r\n */\r\nBinding.prototype.onBindingInitialize = function () {\r\n\r\n\t/*\r\n\t * When overloading, place your code here!!!!\r\n\t */\r\n\r\n\tif ( this.dependentBindings != null ) {\r\n\t\tfor ( var key in this.dependentBindings ) {\r\n\t\t\tvar dependentBinding = this.dependentBindings [ key ];\r\n\t\t\tdependentBinding.onMemberInitialize ( this );\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Flag initialized status.\r\n\t */\r\n\tthis.isInitialized = true;\r\n}\r\n\r\n/**\r\n * Evaluated when a dependent members onBindingInitialize method is invoked.\r\n * @param {Binding} binding\r\n */\r\nBinding.prototype.onMemberInitialize = function ( binding ) {\r\n\r\n\t/*\r\n\t * When overloading, place your code here!!!!\r\n\t */\r\n\r\n\tif ( binding ) {\r\n\t\tthis.memberDependencies [ binding.key ] = true;\r\n\t\tvar isReady = true;\r\n\t\tfor ( var key in this.memberDependencies ) {\r\n\t\t\tif ( this.memberDependencies [ key ] == false ) {\r\n\t\t\t\tisReady = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( isReady ) {\r\n\t\t\tthis.onBindingInitialize ();\r\n\t\t}\r\n\t} else {\r\n\t\tthrow new Error ( this + \" onMemberInitialize: Expected argument.\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Invokes onBindingAttach and onBindingInitialize; then returns the binding.\r\n * @return {Binding}\r\n */\r\nBinding.prototype.attach = function () {\r\n\r\n\tif ( !this.isAttached ) {\r\n\t\tthis.onBindingAttach ();\r\n\t\tif ( this.memberDependencies == null ) {\r\n\t\t\tthis.onBindingInitialize ();\r\n\t\t}\r\n\t}\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Recursivley attach this and any descendant binding not already attached.\r\n */\r\nBinding.prototype.attachRecursive = function () {\r\n\r\n\tthis.bindingWindow.DocumentManager.attachBindings ( this.bindingElement );\r\n}\r\n\r\n/**\r\n * Recursivley dispose all descendant bindings, possibly even this binding.\r\n * Please note this will not destroy the associated DOMElements!\r\n * @param {boolean} isDetachMyself If set to true, dispose this binding.\r\n */\r\nBinding.prototype.detachRecursive = function ( isDetachMyself ) {\r\n\r\n\tif ( isDetachMyself == null ) {\r\n\t\tisDetachMyself = false;\r\n\t}\r\n\tthis.bindingWindow.DocumentManager.detachBindings (\r\n\t\tthis.bindingElement, !isDetachMyself\r\n\t);\r\n}\r\n\r\n/**\r\n * Add single member.\r\n * @param {Binding} binding\r\n * @return {Binding}\r\n */\r\nBinding.prototype.addMember = function ( binding ) {\r\n\r\n\tif ( !this.isAttached ) {\r\n\t\tthrow \"Cannot add members to unattached binding\";\r\n\t} else if ( !binding.isInitialized ){\r\n\t\tif ( !this.memberDependencies ) {\r\n\t\t\tthis.memberDependencies = {};\r\n\t\t}\r\n\t\tthis.memberDependencies [ binding.key ] = false;\r\n\t\tbinding.registerDependentBinding ( this );\r\n\t}\r\n\treturn binding;\r\n}\r\n\r\n/**\r\n * Add list of members.\r\n * @param {List} bindings\r\n * @return {List}\r\n */\r\nBinding.prototype.addMembers = function ( bindings ) {\r\n\r\n\twhile ( bindings.hasNext ()) {\r\n\t\tvar binding = bindings.getNext ();\r\n\t\tif ( !binding.isInitialized ) {\r\n\t\t\tthis.addMember ( binding );\r\n\t\t}\r\n\t}\r\n\treturn bindings;\r\n}\r\n\r\n/**\r\n * Register dependant binding.\r\n * @param {Binding} binding\r\n */\r\nBinding.prototype.registerDependentBinding = function ( binding ) {\r\n\r\n\tif ( !this.dependentBindings ) {\r\n\t\tthis.dependentBindings = {};\r\n\t}\r\n\tthis.dependentBindings [ binding.key ] = binding;\r\n}\r\n\r\n/**\r\n * Initialize attributes for test.\r\n */\r\nBinding.prototype._initializeBindingTestFeatures = function () {\r\n\r\n\tif (Application.isTestEnvironment) {\r\n\t\tvar label = this.getProperty(\"label\");\r\n\t\tif (label && label.indexOf && label.indexOf(\"${string:\") > -1) {\r\n\t\t\tthis.setProperty(\"data-qa\", label);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Initialize persistance.\r\n */\r\nBinding.prototype._initializeBindingPersistanceFeatures = function () {\r\n\r\n\tvar persist = this.getProperty ( \"persist\" );\r\n\r\n\tif ( persist && Persistance.isEnabled ) {\r\n\t\tvar id = this.bindingElement.id;\r\n\t\tif ( !KeyMaster.hasKey ( id )) {\r\n\t\t\tthis._persist = {};\r\n\t\t\tvar props = new List ( persist.split ( \" \" ));\r\n\t\t\twhile ( props.hasNext ()) {\r\n\t\t\t\tvar prop = props.getNext ();\r\n\t\t\t\tvar value = Persistance.getPersistedProperty ( id, prop );\r\n\t\t\t\tif ( value != null ) {\r\n\t\t\t\t\tthis._persist [ prop ] = value;\r\n\t\t\t\t\tthis.setProperty ( prop, value );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvalue = this.getProperty ( prop );\r\n\t\t\t\t\t// alert ( this.toString() + \" \" + id + \" \" + prop +\":\" + value );\r\n\t\t\t\t\tif ( value != null ) {\r\n\t\t\t\t\t\tthis._persist [ prop ] = value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\tthrow \"Persistable bindings must have a specified ID.\";\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Intitialize general features.\r\n */\r\nBinding.prototype._initializeBindingGeneralFeatures = function () {\r\n\r\n\tvar disabled \t\t\t= this.getProperty \t( \"disabled\" );\r\n\tvar contextmenu \t\t= this.getProperty \t( \"contextmenu\" );\r\n\tvar observes \t\t\t= this.getProperty \t( \"observes\" );\r\n\tvar onattach \t\t\t= this.getProperty \t( \"onattach\" );\r\n\tvar hidden\t\t\t\t= this.getProperty \t( \"hidden\" );\r\n\tvar isBlocking \t\t\t= this.getProperty \t( \"blockactionevents\" );\r\n\r\n\tif ( hidden == true && this.isVisible == true ) {\r\n\t\tthis.hide ();\r\n\t}\r\n\tif ( disabled && this.logger != null ) {\r\n\t\tthis.logger.error ( \"The 'disabled' property has been renamed 'isdisbaled'\" );\r\n\t}\r\n\tif ( contextmenu ) {\r\n\t\tthis.setContextMenu ( contextmenu );\r\n\t}\r\n\tif ( observes ) {\r\n\t\tthis.observe (\r\n\t\t\tthis.getBindingForArgument ( observes )\r\n\t\t);\r\n\t}\r\n\tif ( isBlocking == true ) {\r\n\t\tthis.isBlockingActions = true;\r\n\t}\r\n\tif ( this.isActivationAware == true ) {\r\n\t\tvar root = UserInterface.getBinding ( this.bindingDocument.body );\r\n\t\troot.makeActivationAware ( this );\r\n\t\tthis._hasActivationAwareness = true;\r\n\t}\r\n\tif ( onattach != null ) {\r\n\t\tBinding.evaluate ( onattach, this );\r\n\t}\r\n\r\n\t// TODO: investigate why explorer apparently stops evaluating statements at this point!\r\n}\r\n\r\n/**\r\n * Intitialize drag and drop features. Notice that a dragtype\r\n * implies that the binding is draggable unless specifically\r\n * stated otherwise (draggable property set to false).\r\n * TODO: This may not be a good idea regarding persistance!\r\n * TODO: require draggable set to true!\r\n */\r\nBinding.prototype._initializeBindingDragAndDropFeatures = function () {\r\n\r\n\tvar isDraggable = this.getProperty \t( \"draggable\" );\r\n\tvar dragtype\t= this.getProperty \t( \"dragtype\" );\r\n\tvar dragaccept\t= this.getProperty \t( \"dragaccept\" );\r\n\tvar dragreject\t= this.getProperty \t( \"dragreject\" );\r\n\r\n\tif ( isDraggable != null ) {\r\n\t\tthis.isDraggable = isDraggable; // but see below...\r\n\t}\r\n\tif ( dragtype != null ) {\r\n\t\tthis.dragType = dragtype;\r\n\t\tif ( isDraggable != false ) {\r\n\t\t\tthis.isDraggable = true; // dragtype enables drag, unless explicitely denied.\r\n\t\t}\r\n\t}\r\n\tif ( dragaccept != null ){\r\n\t\tthis.dragAccept = dragaccept;\r\n\t}\r\n\tif ( dragreject\t!= null ) {\r\n\t\tthis.dragReject = dragreject;\r\n\t}\r\n\r\n\t/*\r\n\t * Setup drag type stuff.\r\n\t */\r\n\tif ( this.isDraggable ) {\r\n\t\tthis.enableDragging ();\r\n\t}\r\n\tif ( this.dragger != null && this.dragType != null ) {\r\n\t\tthis.dragger.registerHandler (\r\n\t\t\tApplication\r\n\t\t);\r\n\t}\r\n\r\n\t/*\r\n\t * Note that we construct a BindingAcceptor even for rejecting bindings!\r\n\t */\r\n\tif ( this.dragAccept != null && this.dragReject == true ) {\r\n\t\tthrow new Error ( \"Binding cannot both accept and reject \" + this );\r\n\t} else if ( this.dragAccept != null || this.dragReject != null ) {\r\n\t\tthis.acceptor = new BindingAcceptor ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Update bindingMap (see WindowManager). Notice that this method gets invoked\r\n * from both onBindingRegister, onBindingAttach and onBindingDispose methods.\r\n * @param {boolean} isRegistration\r\n */\r\nBinding.prototype._updateBindingMap = function ( isRegistration ) {\r\n\r\n\ttry {\r\n\t\tif ( this.bindingWindow != null ) {\r\n\r\n\t\t\tvar id = this.bindingElement.id;\r\n\t\t\tvar map = this.bindingWindow.bindingMap;\r\n\t\t\tvar registered = null;\r\n\r\n\t\t\tif ( isRegistration ) {\r\n\t\t\t\tregistered = map [ id ];\r\n\t\t\t\tif ( registered != null && registered != this ) {\r\n\t\t\t\t\tvar cry = this.toString () + \" duplicate binding ID: \" + id;\r\n\t\t\t\t\tthis.logger.error ( cry );\r\n\t\t\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\t\t\tthrow ( cry );\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmap [ id ] = this;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tregistered = map [ id ];\r\n\t\t\t\tif ( registered != null && registered == this ) {\r\n\t\t\t\t\tdelete map [ id ];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar fault = new String ( \"Binding#_updateBindingMap odd dysfunction: \" + this.toString () + \": \" + isRegistration );\r\n\t\t\tif ( Application.isDeveloperMode == true ) {\r\n\t\t\t\talert ( fault );\r\n\t\t\t} else {\r\n\t\t\t\tthis.logger.error ( fault );\r\n\t\t\t}\r\n\t\t}\r\n\t} catch ( exception ) {\r\n\t\tthis.logger.error ( exception );\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle DOM event. To eliminate doubts when subclassing,\r\n * all bindings have been fitted with this method to overload.\r\n * @implements {IEventListener}\r\n * @param {Event} e\r\n */\r\nBinding.prototype.handleEvent = function ( e ) {};\r\n\r\n/**\r\n * Handle Action. To eliminate doubts when subclassing,\r\n * all bindings have been fitted with this method to overload.\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n */\r\nBinding.prototype.handleAction = function ( action ) {};\r\n\r\n/**\r\n * Handle broadcast. To eliminate doubts when subclassing,\r\n * all bindings have been fitted with this method to overload.\r\n * @see {EventBroadcaster}\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object] arg\r\n */\r\nBinding.prototype.handleBroadcast = function ( broadcast, arg ) {};\r\n\r\n/**\r\n * Handle element update?\r\n * @implements {IUpdateHandler}\r\n * @param {Element} element\r\n * @returns {boolean} Return true to trigger method handleElement.\r\n */\r\nBinding.prototype.handleElement = function ( element ) {\r\n\r\n\treturn false;\r\n}\r\n\r\n/**\r\n * Update element. And stop crawling DOM subtree?\r\n * @implements {IUpdateHandler}\r\n * @param {Element} element\r\n * @returns {boolean} Return true to stop crawling.\r\n */\r\nBinding.prototype.updateElement = function ( element ) {\r\n\r\n\treturn false;\r\n}\r\n\r\n/**\r\n * This utility function allows you to address a binding instance using\r\n * a number of argument types. If you provide an element or a binding\r\n * there's no trick to it. But if you provide a string it will either resolve\r\n * to the id of an element in the current document context OR be evaluated\r\n * as a javascript call which can retrieve a binding from somewhere in the\r\n * application hierarchy.\r\n * @param {object} arg\r\n */\r\nBinding.prototype.getBindingForArgument = function ( arg ) {\r\n\r\n\tvar result = null;\r\n\r\n\tswitch ( typeof arg ) {\r\n\t\tcase \"object\" : // the result was assigned using javascript\r\n\t\t\tresult = arg;\r\n\t\t\tbreak;\r\n\t\tcase \"string\" : // the result was declared in inline markup\r\n\r\n\t\t\t// fetch binding by simple id in current document scope\r\n\t\t\tresult = this.bindingDocument.getElementById ( arg );\r\n\r\n\t\t\t// or evaluate the attribute as some kind of javascript\r\n\t\t\tif ( result == null ) {\r\n\t\t\t\tresult = Binding.evaluate ( arg, this );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\t// at this point, the result can be either a DOMElement or a Binding.\r\n\tif ( result != null && result.nodeType != null ) {\r\n\t\tresult = UserInterface.getBinding ( result );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Serialize binding. Returns a hashmap of properties to be included in the\r\n * serialization result tree. Return false to prevent binding entirely from\r\n * appearing in the result tree (anonymously generated shadow content).\r\n * @return {HashMap<string><object>} well - could also return null or false!\r\n */\r\nBinding.prototype.serialize = function () {\r\n\r\n\t/*\r\n\t * All properties of this object will be translated\r\n\t * to attributes on the serialized result element.\r\n\t */\r\n\tvar result = {};\r\n\r\n\t/**\r\n\t * Always include non-autogenerated id attribute.\r\n\t */\r\n\tvar id = this.bindingElement.id;\r\n\tif ( id && id != this.key ) {\r\n\t\tresult.id = id;\r\n\t}\r\n\r\n\tvar binding = this.getProperty ( \"binding\" );\r\n\tif ( binding ) {\r\n\t\tresult.binding = binding;\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nBinding.prototype.serializeToString = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.isAttached ) {\r\n\t\tresult = new BindingSerializer ().serializeBinding ( this );\r\n\t} else {\r\n\t\tthrow \"cannot serialize unattached binding\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Generate binding subtree from string input.\r\n * TODO: RUN VIA MASTERFILTER.XSL?\r\n * @param {string} string\r\n */\r\nBinding.prototype.subTreeFromString = function ( markup ) {\r\n\r\n\tthis.detachRecursive ();\r\n\tthis.bindingElement.innerHTML = Client.fixUI(markup);\r\n\tthis.attachRecursive ();\r\n}\r\n\r\n/**\r\n * Get bound element attribute. The attribute value (in DOM always a string) is\r\n * analyzed  and converted to an appropriate js primitive of type number,\r\n * string or boolean, making it simpler to work with in a scripting environment.\r\n * @param {string} attname\r\n */\r\nBinding.prototype.getProperty = function ( attname ) {\r\n\r\n\tvar value = this.bindingElement.getAttribute ( attname.toLowerCase() );\r\n\r\n\tif ( value ) {\r\n\t\tvalue = Types.castFromString ( value );\r\n\t}\r\n\treturn value;\r\n}\r\n\r\n/**\r\n * Set bound element attribute. The value is converted to a string.\r\n * If set to a null value, the property will be removed. By specifying\r\n * the propertyMethodMap, this method can automatically invoke a specified\r\n * method on the binding using the formatted value as an argument. This setup\r\n * was engineered specifically to support the {@link BroadcasterBinding}.\r\n * @param {string} attname The name of the attribute\r\n * @param {object} value The attribute value.\r\n */\r\nBinding.prototype.setProperty = function (attname, value ) {\r\n\r\n\tif ( value != null ) {\r\n\r\n\t\t// DOM attributes are always stored as strings\r\n\t\tvalue = value.toString ();\r\n\r\n\t\t/*\r\n\t\t * Dont't do anything unless the property is actually changed.\r\n\t\t * This will prevent recursive calls to methods which in turn\r\n\t\t * modifies the properties of the binding.\r\n\t\t */\r\n\t\tif ( String ( this.bindingElement.getAttribute ( attname.toLowerCase() )) != value ) {\r\n\r\n\t\t\tthis.bindingElement.setAttribute ( attname.toLowerCase(), value );\r\n\t\t\tif ( this.isAttached == true ) {\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t * Handle persistance.\r\n\t\t\t\t */\r\n\t\t\t\tif ( Persistance.isEnabled && value != null ) {\r\n\t\t\t\t\tif ( this._persist != null && this._persist [ attname ]) {\r\n\t\t\t\t\t\tthis._persist [ attname ] = value;\r\n\t\t\t\t\t\tPersistance.setPersistedProperty (\r\n\t\t\t\t\t\t\tthis.bindingElement.id,\r\n\t\t\t\t\t\t\tattname,\r\n\t\t\t\t\t\t\tvalue\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t * Handle \"setters\" (methods invoked when setting the property).\r\n\t\t\t\t */\r\n\t\t\t\tvar method = this.propertyMethodMap [ attname ];\r\n\t\t\t\tif ( method ) {\r\n\t\t\t\t\tmethod.call ( this, this.getProperty ( attname ));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tthis.deleteProperty ( attname );\r\n\t}\r\n}\r\n\r\n/**\r\n * Remove bound element attribute.\r\n * @param {string} prop The name of the attribute\r\n */\r\nBinding.prototype.deleteProperty = function ( attname ) {\r\n\r\n\tthis.bindingElement.removeAttribute ( attname.toLowerCase() );\r\n}\r\n\r\n/**\r\n * Get the ID of the associated element.\r\n * @return {string}\r\n */\r\nBinding.prototype.getID = function () {\r\n\r\n\tvar result = null;\r\n\tif ( Binding.exists ( this )) {\r\n\t\tresult = this.bindingElement.id;\r\n\t} else {\r\n\t\tSystemDebug.stack ( arguments );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Attach CSS classname to bound element.\r\n * @param {string} classname\r\n */\r\nBinding.prototype.attachClassName = function ( classname ) {\r\n\r\n\tCSSUtil.attachClassName ( this.bindingElement, classname );\r\n}\r\n\r\n/**\r\n * Detach CSS classname from bound element.\r\n * @param {string} classname\r\n */\r\nBinding.prototype.detachClassName = function ( classname ) {\r\n\r\n\tCSSUtil.detachClassName ( this.bindingElement, classname );\r\n}\r\n\r\n/**\r\n * Check bound element classname.\r\n * @param {string} classname\r\n * @return {boolean}\r\n */\r\nBinding.prototype.hasClassName = function ( classname ) {\r\n\r\n\treturn CSSUtil.hasClassName ( this.bindingElement, classname );\r\n}\r\n\r\n/**\r\n * Add Action listener, not to be confused with real DOM events.\r\n * @param {string} type The event type should match (TODO: setup certain event types to match?)\r\n * @param {IActionListener} listener An object implementing {IActionListener} - optional.\r\n */\r\nBinding.prototype.addActionListener = function ( type, listener ) {\r\n\r\n\tlistener = listener != null ? listener : this;\r\n\r\n\tif ( Action.isValid ( type )) {\r\n\t\tif ( Interfaces.isImplemented ( IActionListener, listener )) {\r\n\t\t\tif ( !this.actionListeners [ type ]) {\r\n\t\t\t\tthis.actionListeners [ type ] = [];\r\n\t\t\t}\r\n\t\t\tthis.actionListeners [ type ].push ( listener );\r\n\t\t} else throw new Error (\r\n\t\t\t\"Could not add action-event listener. Method handleAction not implemented.\"\r\n\t\t);\r\n\t} else {\r\n\t\talert ( this + \"\\nCould not add undefined Action (\" + listener + \")\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Remove action listener\r\n * @param {string} type\r\n * @param {IActionListener} unListener\r\n */\r\nBinding.prototype.removeActionListener = function ( type, unListener ) {\r\n\r\n\tunListener = unListener ? unListener : this;\r\n\r\n\tif ( Action.isValid ( type )) {\r\n\t\tvar listeners = this.actionListeners [ type ];\r\n\t\tif ( listeners ) {\r\n\t\t\tvar i = 0, listener;\r\n\t\t\twhile (( listener = listeners [ i ]) != null ) {\r\n\t\t\t\tif ( listener == unListener ) {\r\n\t\t\t\t\tlisteners.splice ( i, 1 );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Add DOM event listener, not to be confused with Action listeners,\r\n * to this bindingElement. If handler argument is omitted, the handler\r\n * defaults to the binding itself.\r\n * @param {string} type\r\n * @param {IEventListener} handler Optional.\r\n */\r\nBinding.prototype.addEventListener = function ( type, handler ) {\r\n\r\n\thandler = handler ? handler : this;\r\n\tDOMEvents.addEventListener ( this.bindingElement, type, handler );\r\n\r\n}\r\n\r\n/**\r\n * Remove DOM event listener from this bindingElement.\r\n * @param {string} type\r\n * @param {IEventListener} handler Optional.\r\n */\r\nBinding.prototype.removeEventListener = function ( type, handler ) {\r\n\r\n\thandler = handler ? handler : this;\r\n\tDOMEvents.removeEventListener ( this.bindingElement, type, handler );\r\n\r\n}\r\n\r\n/**\r\n * Subscribe EventBroadcaster transmission.\r\n * @param {string} broadcast\r\n */\r\nBinding.prototype.subscribe = function ( broadcast ) {\r\n\r\n\tif ( !this.hasSubscription ( broadcast )) {\r\n\t\tthis._subscriptions.set ( broadcast, true );\r\n\t\tEventBroadcaster.subscribe ( broadcast, this );\r\n\t} else {\r\n\t\tthis.logger.error ( \"Dubplicate subscription aborted:\" + broadcast );\r\n\t}\r\n}\r\n\r\n/**\r\n * Unsubscribe EventBroadcaster transmission.\r\n * @param {string} broadcast\r\n */\r\nBinding.prototype.unsubscribe = function ( broadcast ) {\r\n\r\n\tif ( this.hasSubscription ( broadcast )) {\r\n\t\tthis._subscriptions.del ( broadcast );\r\n\t\tEventBroadcaster.unsubscribe ( broadcast, this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Has EventBroadcaster subscription?\r\n * @return {boolean}\r\n */\r\nBinding.prototype.hasSubscription = function ( broadcast ) {\r\n\r\n\treturn this._subscriptions.has ( broadcast );\r\n}\r\n\r\n/**\r\n * Observe broadcaster.\r\n * @param {BroadcasterBinding} broadcaster\r\n * @param {string} properties\r\n */\r\nBinding.prototype.observe = function ( broadcaster, properties ) {\r\n\r\n\tbroadcaster.addObserver ( this, properties );\r\n}\r\n\r\n/**\r\n * Unobserve broadcaster.\r\n * @param {BroadcasterBinding} broadcaster\r\n * @param {string} properties\r\n */\r\nBinding.prototype.unObserve = function ( broadcaster, properties ) {\r\n\r\n\tbroadcaster.removeObserver ( this, properties );\r\n}\r\n\r\n/**\r\n * Setup the contextmenu. For binding to handle contextmenu\r\n * selection, it should implement the handleAction method.\r\n * @param {object} arg\r\n */\r\nBinding.prototype.handleContextEvent = function (e) {\r\n\tvar self = this;\r\n\tvar menu = this.contextMenuBinding;\r\n\tif (Interfaces.isImplemented(IActionListener, self) == true) {\r\n\t\tvar actionHandler = {\r\n\t\t\thandleAction: function () {\r\n\t\t\t\tmenu.removeActionListener(MenuItemBinding.ACTION_COMMAND, self);\r\n\t\t\t\tmenu.removeActionListener(PopupBinding.ACTION_HIDE, actionHandler);\r\n\t\t\t}\r\n\t\t}\r\n\t\tmenu.addActionListener(MenuItemBinding.ACTION_COMMAND, self);\r\n\t\tmenu.addActionListener(PopupBinding.ACTION_HIDE, actionHandler);\r\n\t}\r\n\tmenu.snapToMouse(e);\r\n}\r\n\r\n/**\r\n * Setup the contextmenu. For binding to handle contextmenu\r\n * selection, it should implement the handleAction method.\r\n * @param {object} arg\r\n */\r\nBinding.prototype.setContextMenu = function ( arg ) {\r\n\r\n\tthis.contextMenuBinding = this.getBindingForArgument ( arg );\r\n\r\n\tif ( this.contextMenuBinding ) {\r\n\r\n\t\tvar self = this;\r\n\r\n\t\tif (Client.isPad) {\r\n\t\t\tvar touchStart = false;\r\n\t\t\tvar touchTimeout = false;\r\n\t\t\tthis.addEventListener(DOMEvents.TOUCHSTART, {\r\n\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\ttouchTimeout = setTimeout(function () {\r\n\t\t\t\t\t\tself.handleContextEvent(e);\r\n\t\t\t\t\t}, 800);\r\n\t\t\t\t\ttouchStart = true;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tthis.addEventListener(DOMEvents.TOUCHMOVE, {\r\n\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\tif (touchStart) {\r\n\t\t\t\t\t\tclearTimeout(touchTimeout);\r\n\t\t\t\t\t\ttouchStart = false;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tthis.addEventListener(DOMEvents.TOUCHEND, {\r\n\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\tif (touchStart) {\r\n\t\t\t\t\t\tclearTimeout(touchTimeout);\r\n\t\t\t\t\t\ttouchStart = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis.addEventListener(DOMEvents.CONTEXTMENU, {\r\n\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\tself.handleContextEvent(e);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t} else {\r\n\t\tthrow \"No such contextmenu: \" + arg;\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @return {PopupBinding}\r\n */\r\nBinding.prototype.getContextMenu = function () {\r\n\r\n\treturn this.contextMenuBinding;\r\n}\r\n\r\n/**\r\n * Dispatch event, triggering actionlisteners associated to event type.\r\n * The event \"bubbles up\" to parent Bindings in a DOM-like way.\r\n * @param {object} arg This can be either a string or an {@link Action}.\r\n * @return {Action}\r\n */\r\nBinding.prototype.dispatchAction = function (arg) {\r\n\r\n\t//console.log(arg);\r\n\r\n\tvar action = null;\r\n\tvar result = null;\r\n\tvar isMyAction = false;\r\n\r\n\t/*\r\n\t * Are we dispatching a new event or relaying a descendant event?\r\n\t */\r\n\tif ( arg instanceof Action ) {\r\n\t\taction = arg;\r\n\t} else if ( Action.isValid ( arg )) {\r\n\t\taction = new Action ( this, arg );\r\n\t\tisMyAction = true;\r\n\t}\r\n\r\n\t/*\r\n\t * Pass event to relevant listeners; then migrate the event to containing binding.\r\n\t */\r\n\tif ( action != null && Action.isValid ( action.type ) == true ) {\r\n\t\tif ( action.isConsumed == true ) {\r\n\t\t\tresult = action;\r\n\t\t} else {\r\n\t\t\tvar listeners = this.actionListeners [ action.type ];\r\n\t\t\tif ( listeners != null ) {\r\n\t\t\t\taction.listener = this;\r\n\t\t\t\tvar i = 0, listener;\r\n\t\t\t\twhile (( listener = listeners [ i++ ]) != null ) {\r\n\t\t\t\t\tif ( listener && listener.handleAction ) {\r\n\t\t\t\t\t\tlistener.handleAction ( action );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * Migrate action?\r\n\t\t\t */\r\n\t\t\tvar isMigrate = true;\r\n\r\n\t\t\t/*\r\n\t\t\t * Note that selected actions are allowed to bypass the\r\n\t\t\t * action block system, notably the \"activated\" action.\r\n\t\t\t * The postback action was added to please the\r\n\t\t\t * wysiwygeditor (template update selector).\r\n\t\t\t */\r\n\t\t\tif ( this.isBlockingActions == true ) {\r\n\t\t\t\tswitch ( action.type ) {\r\n\t\t\t\t\tcase Binding.ACTION_FOCUSED : // EXPERIMENTAL!\r\n\t\t\t\t\tcase Binding.ACTION_BLURRED : // EXPERIMENTAL!\r\n\t\t\t\t\tcase Binding.ACTION_ACTIVATED :\r\n\t\t\t\t\tcase Binding.ACTION_FORCE_REFLEX :\r\n\t\t\t\t\tcase DockTabBinding.ACTION_UPDATE_VISUAL :\r\n\t\t\t\t\tcase PageBinding.ACTION_DOPOSTBACK :\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault :\r\n\t\t\t\t\t\tif ( !isMyAction ) {\r\n\t\t\t\t\t\t\tisMigrate = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ( isMigrate ) {\r\n\t\t\t\tresult = this.migrateAction ( action );\r\n\t\t\t} else {\r\n\t\t\t\tresult = action;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Migrate action to ancestor binding.\r\n * @param {Action} action\r\n * @return {Action}\r\n */\r\nBinding.prototype.migrateAction = function ( action ) {\r\n\r\n\tvar binding\t= null;\r\n\tvar result \t= null;\r\n\tvar node \t= this.getMigrationParent ();\r\n\r\n\tif ( node ) {\r\n\t\twhile ( node && !binding && node.nodeType != Node.DOCUMENT_NODE ) {\r\n\t\t\tbinding = UserInterface.getBinding ( node );\r\n\t\t\tnode = node.parentNode;\r\n\t\t}\r\n\t\tif ( binding ) {\r\n\t\t\tresult = binding.dispatchAction ( action );\r\n\t\t} else {\r\n\t\t\tresult = action;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Invoke the flex method (if specified) on this binding and all descendant bindings.\r\n * @param @optional {boolean} isForce\r\n */\r\nBinding.prototype.reflex = function ( isForce ) {\r\n\r\n\tif ( Application.isOperational == true ) {\r\n\t\tFlexBoxBinding.reflex ( this, isForce );\r\n\t}\r\n}\r\n\r\n/**\r\n * Note that the {@link RootBinding} overwrites this method\r\n * in order to migrate the event across iframe boundaries.\r\n * @return {DOMElement}\r\n */\r\nBinding.prototype.getMigrationParent = function () {\r\n\r\n\tvar result = null;\r\n\tif ( true ) { // Binding.exists ( this )\r\n\t\ttry {\r\n\t\t\tvar parent = this.bindingElement.parentNode;\r\n\t\t\tif ( parent != null ) {\r\n\t\t\t\tresult = parent;\r\n\t\t\t}\r\n\t\t} catch ( wtfException ) { // Explorer may collapse any day now - especially around here\r\n\t\t\tthis.logger.error ( \"Binding#getMigrationParent exception\" );\r\n\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\tresult = null;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {Binding} binding\r\n * @return {Binding}\r\n */\r\nBinding.prototype.add = function ( binding ) {\r\n\r\n\tif ( binding.bindingDocument == this.bindingDocument ) {\r\n\t\tthis.bindingElement.appendChild (\r\n\t\t\tbinding.bindingElement\r\n\t\t);\r\n\t} else {\r\n\t\tthrow \"Could not add \" + binding.toString () + \" of different document origin.\";\r\n\t}\r\n\treturn binding;\r\n}\r\n\r\n/**\r\n * @param {Binding} binding\r\n * @return {Binding}\r\n */\r\nBinding.prototype.addFirst = function ( binding ) {\r\n\r\n\tif ( binding.bindingDocument == this.bindingDocument ) {\r\n\t\tthis.bindingElement.insertBefore (\r\n\t\t\tbinding.bindingElement,\r\n\t\t\tthis.bindingElement.firstChild\r\n\t\t);\r\n\t} else {\r\n\t\tthrow \"Could not add \" + binding.toString () + \" of different document origin.\";\r\n\t}\r\n\treturn binding;\r\n}\r\n\r\n/**\r\n * Get ancestor binding by nodename.\r\n * @param {boolean} isTraverse If set to true, crossing iframe boundaries.\r\n * @return {Binding}\r\n */\r\nBinding.prototype.getAncestorBindingByLocalName = function ( nodeName, isTraverse ) {\r\n\r\n\treturn BindingFinder.getAncestorBindingByLocalName ( this, nodeName, isTraverse );\r\n}\r\n\r\n/**\r\n * Get ancestor binding by implementation type.\r\n * @param {Class} impl\r\n * @param {boolean} isTraverse If set to true, crossing iframe boundaries.\r\n * @return {Binding}\r\n */\r\nBinding.prototype.getAncestorBindingByType = function ( impl, isTraverse ) {\r\n\r\n\treturn BindingFinder.getAncestorBindingByType ( this, impl, isTraverse );\r\n}\r\n\r\n/**\r\n * Get first child binding of a specified type.\r\n * @param {Class} impl\r\n * @return {Binding}\r\n */\r\nBinding.prototype.getChildBindingByType = function ( impl ) {\r\n\r\n\treturn BindingFinder.getChildBindingByType ( this, impl );\r\n}\r\n\r\n/**\r\n * Get child elements by localname.\r\n * @param {string} nodeName\r\n * @return {List<DOMElement>}\r\n */\r\nBinding.prototype.getChildElementsByLocalName = function ( nodeName ) {\r\n\r\n\treturn BindingFinder.getChildElementsByLocalName ( this, nodeName );\r\n}\r\n/**\r\n * Get first child element by localname.\r\n * @param {string} nodeName\r\n * @return {DOMElement}\r\n */\r\nBinding.prototype.getChildElementByLocalName = function ( nodeName ) {\r\n\r\n\treturn this.getChildElementsByLocalName ( nodeName ).getFirst ();\r\n}\r\n\r\n/**\r\n * Get descendant elements by localname.\r\n * @param {string} nodeName\r\n * @return {List<Binding>}\r\n */\r\nBinding.prototype.getDescendantElementsByLocalName = function ( nodeName ) {\r\n\r\n\treturn new List (\r\n\t\tDOMUtil.getElementsByTagName ( this.bindingElement, nodeName )\r\n\t);\r\n}\r\n\r\n/**\r\n * Get multiple child bindings by localname.\r\n * @param {string} nodeName\r\n * @return {List<Binding>}\r\n */\r\nBinding.prototype.getChildBindingsByLocalName = function ( nodeName ) {\r\n\r\n\treturn this.getDescendantBindingsByLocalName ( nodeName, true );\r\n}\r\n\r\n/**\r\n * Get first child binding by localname.\r\n * @param {string} nodeName\r\n * @return {Binding}\r\n */\r\nBinding.prototype.getChildBindingByLocalName = function ( nodeName ) {\r\n\r\n\treturn this.getChildBindingsByLocalName ( nodeName ).getFirst ();\r\n}\r\n\r\n/**\r\n * Get descendant bindings by localname.\r\n * @param {string} nodeName\r\n * @param {boolean} isChildrenOnly If set to true, return only direct children bindings.\r\n * @return {List<Binding>}\r\n */\r\nBinding.prototype.getDescendantBindingsByLocalName = function ( nodeName, isChildrenOnly ) {\r\n\r\n\treturn BindingFinder.getDescendantBindingsByLocalName ( this, nodeName, isChildrenOnly );\r\n}\r\n\r\n/**\r\n * Get first descendant binding by localname.\r\n * TODO: optimize for speed by not collecting all first?\r\n * @param {string} nodeName\r\n * @return {Binding}\r\n */\r\nBinding.prototype.getDescendantBindingByLocalName = function ( nodeName ) {\r\n\r\n\treturn this.getDescendantBindingsByLocalName ( nodeName, false ).getFirst ();\r\n}\r\n\r\n/**\r\n * Get ALL descendant binding of a specified type.\r\n * @param {Class} impl\r\n * @return {List<Binding>}\r\n */\r\nBinding.prototype.getDescendantBindingsByType = function ( impl, isTraverse ) {\r\n\r\n\treturn BindingFinder.getDescendantBindingsByType ( this, impl, isTraverse );\r\n}\r\n\r\n/**\r\n * Get FIRST descendant binding of a specified type.\r\n * @param {Class} impl\r\n * @return {Binding}\r\n */\r\nBinding.prototype.getDescendantBindingByType = function ( impl ) {\r\n\r\n\treturn BindingFinder.getDescendantBindingByType ( this, impl );\r\n}\r\n\r\n/**\r\n * Get next binding by localname.\r\n * @param {string} nodeName\r\n * @return {Binding}\r\n */\r\nBinding.prototype.getNextBindingByLocalName = function ( nodeName ) {\r\n\r\n\treturn BindingFinder.getNextBindingByLocalName ( this, nodeName );\r\n};\r\n\r\n/**\r\n * Get next binding by localname.\r\n * @param {string} nodeName\r\n * @return {Binding}\r\n */\r\nBinding.prototype.getPreviousBindingByLocalName = function ( nodeName ) {\r\n\r\n\treturn BindingFinder.getPreviousBindingByLocalName ( this, nodeName );\r\n};\r\n\r\n/**\r\n * Because of a seriously weird bug in Explorer, this may be\r\n * the preferred way to obtain a handle on the bound element.\r\n * @return {DOMElement}\r\n */\r\nBinding.prototype.getBindingElement = function () {\r\n\r\n\treturn this.bindingDocument.getElementById ( this.bindingElement.id );\r\n}\r\n\r\n/**\r\n * Get the ordinal position of a Binding within it's container (skipping textnodes).\r\n * @param {DOMElement} element\r\n * @param {boolean} isSimilar If set to true, count only similar bindings.\r\n * @return {int}\r\n */\r\nBinding.prototype.getOrdinalPosition = function ( isSimilar ) {\r\n\r\n\treturn DOMUtil.getOrdinalPosition ( this.bindingElement, isSimilar );\r\n}\r\n\r\n/**\r\n * Is first child of container?\r\n * @param {boolean} isSimilar If set to true, count only similar bindings.\r\n * @return {boolean}\r\n */\r\nBinding.prototype.isFirstBinding = function ( isSimilar ) {\r\n\r\n\treturn ( this.getOrdinalPosition ( isSimilar ) == 0 );\r\n}\r\n\r\n/**\r\n * Is last child of container?\r\n * @param {boolean} isSimilar If set to true, count only similar bindings.\r\n * @return {boolean}\r\n */\r\nBinding.prototype.isLastBinding = function ( isSimilar ) {\r\n\r\n\treturn DOMUtil.isLastElement ( this.bindingElement, isSimilar );\r\n}\r\n\r\n/**\r\n * Has callback ID? If true, the server is probably watching this Binding.\r\n * @return {boolean}\r\n */\r\nBinding.prototype.hasCallBackID = function () {\r\n\r\n\treturn this.getProperty ( Binding.CALLBACKID ) != null;\r\n}\r\n\r\n/**\r\n * Get callback ID. On server postback, this will be transmitted as parameter __EVENTTARGET.\r\n * @return {String}\r\n */\r\nBinding.prototype.getCallBackID = function () {\r\n\r\n\treturn this.getProperty ( Binding.CALLBACKID );\r\n}\r\n\r\n/**\r\n * Set callback ID.\r\n * @param {String} id\r\n */\r\nBinding.prototype.setCallBackID = function ( id ) {\r\n\r\n\tthis.setProperty ( Binding.CALLBACKID, id );\r\n}\r\n\r\n/**\r\n * Has callback argument?\r\n * @return {boolean}\r\n */\r\nBinding.prototype.hasCallBackArg = function () {\r\n\r\n\treturn this.getCallBackArg () != null;\r\n}\r\n\r\n/**\r\n * Get callback argument. On server postback, this will be transmitted as parameter __EVENTARGUMENT.\r\n * @return {String}\r\n */\r\nBinding.prototype.getCallBackArg = function () {\r\n\r\n\treturn this.getProperty ( Binding.CALLBACKARG );\r\n}\r\n\r\n/**\r\n * Set callback argument.\r\n * @param {String} argument\r\n */\r\nBinding.prototype.setCallBackArg = function ( string ) {\r\n\r\n\tthis.setProperty ( Binding.CALLBACKARG, string );\r\n}\r\n\r\n/**\r\n * Removes the bindingElement from stage and nulls all Binding properties,\r\n * freeing delicious memory. Recursively destroys bindings withind DOM subtree.\r\n * @param {boolean} isDerivedDisposal\r\n */\r\nBinding.prototype.dispose = function ( isDerivedDisposal ) {\r\n\r\n\tif ( !this.isDisposed ) {\r\n\r\n\t\tif ( !isDerivedDisposal ) {\r\n\r\n\t\t\t/*\r\n\t\t\t * Destroy Binding objects recursively, starting from\r\n\t\t\t * the deepest position in descendant DOM structure.\r\n\t\t\t * The DocumentManager will invoke this method again,\r\n\t\t\t * this time with the method argument set to true.\r\n\t\t\t */\r\n\t\t\tthis.bindingWindow.DocumentManager.detachBindings ( this.bindingElement );\r\n\r\n\t\t\t/*\r\n\t\t\t * If this is the first Binding being disposed, remove bindingElement from DOM.\r\n\t\t\t * We need to use getElementById here because explorer gets it fugged.\r\n\t\t\t */\r\n\t\t\tvar bindingElement = this.bindingDocument.getElementById ( this.bindingElement.id );\r\n\t\t\tif ( bindingElement ) {\r\n\t\t\t\tif ( Client.isExplorer ) {\r\n\t\t\t\t\tbindingElement.outerHTML = \"\"; // removeChild will memoryleak explorer (!)\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbindingElement.parentNode.removeChild ( bindingElement );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t/*\r\n\t\t\t * Unregister EventBroadcaster subscriptions.\r\n\t\t\t */\r\n\t\t\tif ( this._subscriptions.hasEntries ()) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tvar list = new List ();\r\n\t\t\t\tthis._subscriptions.each ( function ( broadcast ) {\r\n\t\t\t\t\tlist.add ( broadcast );\r\n\t\t\t\t});\r\n\t\t\t\tlist.each ( function ( broadcast ) {\r\n\t\t\t\t\tself.unsubscribe ( broadcast );\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * Note that even on the first disposed binding, the DocumentManager re-invokes\r\n\t\t\t * this method with an argument value of true, triggering the onBindingDispose.\r\n\t\t\t */\r\n\t\t\tthis.onBindingDispose ();\r\n\r\n\t\t\t/*\r\n\t\t\t * This will attempt to kill the binding for good.\r\n\t\t\t * Currently, though, it doesn't release memory!\r\n\t\t\t */\r\n\t\t\tUserInterface.unRegisterBinding ( this );\r\n\t\t}\r\n\t}\r\n\r\n\t// Note that the property \"isDisposed\" is finally set\r\n\t// to true around the static method Binding.destroy...\r\n}\r\n\r\n/**\r\n * Place your cleanup code around here.\r\n */\r\nBinding.prototype.onBindingDispose = function () {\r\n\r\n\t/**\r\n\t * Cleanup activation awareness.\r\n\t */\r\n\tif ( this._hasActivationAwareness ) {\r\n\t\tvar root = UserInterface.getBinding ( this.bindingDocument.body );\r\n\t\troot.makeActivationAware ( this, false );\r\n\t\tthis._hasActivationAwareness = false;\r\n\t}\r\n\r\n\t/**\r\n\t * Delete from window scope bindingMap.\r\n\t */\r\n\tthis._updateBindingMap ( false );\r\n}\r\n\r\n/**\r\n * Enable dragging.\r\n */\r\nBinding.prototype.enableDragging = function () {\r\n\r\n\tif ( this.dragger == null ) {\r\n\t\tthis.dragger = new BindingDragger ( this );\r\n\t\tthis.addEventListener ( DOMEvents.MOUSEDOWN, this.dragger );\r\n\t\tthis.addEventListener ( DOMEvents.MOUSEMOVE, this.dragger );\r\n\t\tthis.addEventListener ( DOMEvents.MOUSEUP, this.dragger );\r\n\t}\r\n\tthis.isDraggable = true;\r\n}\r\n\r\n/**\r\n * Disable dragging.\r\n */\r\nBinding.prototype.disableDragging = function () {\r\n\r\n\tif ( this.dragger != null ) {\r\n\t\tthis.removeEventListener ( DOMEvents.MOUSEDOWN, this.dragger );\r\n\t\tthis.removeEventListener ( DOMEvents.MOUSEMOVE, this.dragger );\r\n\t\tthis.removeEventListener ( DOMEvents.MOUSEUP, this.dragger );\r\n\t\tthis.dragger.dispose ();\r\n\t\tthis.dragger = null;\r\n\t}\r\n\tthis.isDraggable = false;\r\n}\r\n\r\n/**\r\n * Show.\r\n */\r\nBinding.prototype.show = function () {\r\n\r\n\tif ( !this.isVisible ) {\r\n\t\tthis.bindingElement.style.display = \"block\";\r\n\t\tthis.setProperty ( \"hidden\", true );\r\n\t\tthis.isVisible = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide.\r\n */\r\nBinding.prototype.hide = function () {\r\n\r\n\tif ( this.isVisible == true ) {\r\n\t\tthis.bindingElement.style.display = \"none\";\r\n\t\tthis.deleteProperty ( \"hidden\" );\r\n\t\tthis.isVisible = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Wake up lazy binding (and perform the action provided as argument).\r\n * @param @optional {string|function} action The action to take when awoke.\r\n */\r\nBinding.prototype.wakeUp = function ( action, timeout ) {\r\n\r\n\ttimeout = timeout ? timeout : Binding.SNOOZE;\r\n\r\n\tif ( this.isLazy == true ) {\r\n\r\n\t\tthis.deleteProperty ( \"lazy\" );\r\n\t\tthis.isLazy = false;\r\n\t\tApplication.lock ( this );\r\n\r\n\t\t/*\r\n\t\t * Force new indexation of focusable elements.\r\n\t\t */\r\n\t\tthis.dispatchAction ( FocusBinding.ACTION_UPDATE );\r\n\r\n\t\t/*\r\n\t\t * Timeout fixes freezing sensation.\r\n\t\t */\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tself.attachRecursive ();\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tif ( typeof action === 'string' ) {\r\n\t\t\t\t\tself [ action ] ();\r\n\t\t\t\t} else if (typeof action === 'function') {\r\n\t\t\t\t\taction();\r\n\t\t\t\t}\r\n\t\t\t\t// Update any related LazyBindingDataBinding so that the server knows we are awake.\r\n\t\t\t\tLazyBindingBinding.wakeUp ( self );\r\n\t\t\t\tApplication.unlock ( self );\r\n\t\t\t\t/*\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tApplication.focused ( true );\r\n\t\t\t\t},  Application._TIMEOUT_LOSTFOCUS * 2 );\r\n\t\t\t\t*/\r\n\t\t\t}, timeout ); // explorer cannot flex unless we timeout here - look into this!\r\n\t\t}, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle crawler.\r\n * @implements {ICrawlerHandler}\r\n * @param {Crawler} crawler\r\n */\r\nBinding.prototype.handleCrawler = function ( crawler ) {\r\n\r\n\t/*\r\n\t * Lazy bindings will accept the DocumentCrawler\r\n\t * for purposes of binding registration only.\r\n\t */\r\n\tif ( crawler.response == null && this.isLazy == true ) {\r\n\t\tif ( crawler.id == DocumentCrawler.ID && crawler.mode == DocumentCrawler.MODE_REGISTER ) {\r\n\t\t\tcrawler.response = NodeCrawler.NORMAL;\r\n\t\t} else {\r\n\t\t\tcrawler.response = NodeCrawler.SKIP_CHILDREN;\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Search binding crawler filters.\r\n\t */\r\n\tif ( crawler.response == null && this.crawlerFilters != null ) {\r\n\t\tif ( this.crawlerFilters.has ( crawler.id )) {\r\n\t\t\tcrawler.response = NodeCrawler.SKIP_CHILDREN;\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * These common crawlers should no iterate into hidden bindings.\r\n\t */\r\n\tif ( crawler.response == null ) {\r\n\t\tswitch ( crawler.id ) {\r\n\t\t\tcase FlexBoxCrawler.ID :\r\n\t\t\tcase FocusCrawler.ID :\r\n\t\t\t\tif ( !this.isVisible ) {\r\n\t\t\t\t\tcrawler.response = NodeCrawler.SKIP_CHILDREN;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Binding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {Binding}\r\n */\r\nBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:binding\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, Binding );\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/balloons/BalloonBinding.js",
    "content": "BalloonBinding.prototype = new Binding;\r\nBalloonBinding.prototype.constructor = BalloonBinding;\r\nBalloonBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * Time before each position update in milliseconds.\r\n * Also the timeout before balloon is shown, for some reason.\r\n */\r\nBalloonBinding.TIMEOUT = parseInt ( 200 );\r\n\r\n/*\r\n * Position offsets. Attempting to place\r\n * the balloon elegantly relative to binding.\r\n */\r\nBalloonBinding.OFFSET_X =  parseInt ( 14 );\r\nBalloonBinding.OFFSET_Y =  parseInt ( 6 );\r\n\r\n/*\r\n *\r\n */\r\nBalloonBinding.ACTION_SNAP = \"balloon snap\";\r\n\r\n/**\r\n * Classname attached to a left hand balloon.\r\n */\r\nBalloonBinding.CLASSNAME_LEFT = \"left\";\r\n\r\n/**\r\n * Used to locate an appropriate balloon environment.\r\n * TODO: Design para-frame binding type locator? For now,\r\n * environments need to be made aware of the BallonBinding.\r\n */\r\nBalloonBinding.ACTION_INITIALIZE = \"ballon initialize\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction BalloonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BalloonBinding\" );\r\n\r\n\t/**\r\n\t * We snap to this binding.\r\n\t * @type {IData}\r\n\t */\r\n\tthis._snapTargetBinding = null;\r\n\r\n\t/**\r\n\t * We nondisplay the balloon when outside the boundaries of this binding.\r\n\t * Typically a DockBinding, a DialogBinding or a ScrollBoxBinding.\r\n\t * @type {Binding}\r\n\t */\r\n\tthis._environmentBinding = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBalloonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[BalloonBinding]\";\r\n}\r\n\r\n/**\r\n * Note that the binding is *invisible* when created!\r\n * @see {BalloonBinding#newInstance}\r\n * @overloads {Binding#onBindintAttach}\r\n */\r\nBalloonBinding.prototype.onBindingAttach = function () {\r\n\r\n\tBalloonBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tthis.addActionListener ( Binding.ACTION_ACTIVATED );\r\n\tthis.addActionListener ( ControlBinding.ACTION_COMMAND );\r\n\r\n\t/*\r\n\t * Build close button.\r\n\t */\r\n\tthis._controlGroupBinding = this.add (\r\n\t\tControlGroupBinding.newInstance ( this.bindingDocument )\r\n\t);\r\n\tvar controlBinding = DialogControlBinding.newInstance ( this.bindingDocument );\r\n\tcontrolBinding.setControlType ( ControlBinding.TYPE_CLOSE );\r\n\tthis._controlGroupBinding.add ( controlBinding );\r\n\tthis._controlGroupBinding.attachRecursive ();\r\n\r\n\t/*\r\n\t * Build speak elements.\r\n\t */\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:balloonspeak\", this.bindingDocument );\r\n\tthis.bindingElement.appendChild ( element );\r\n\r\n\tvar label = this.getLabel ();\r\n\tif ( label != null ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindintAttach}\r\n */\r\nBalloonBinding.prototype.onBindingDispose = function () {\r\n\r\n\tBalloonBinding.superclass.onBindingDispose.call ( this );\r\n\r\n\tif ( this._updateInterval ) {\r\n\t\twindow.clearInterval ( this._updateInterval );\r\n\t\tthis._updateInterval = null;\r\n\t}\r\n\r\n\tvar binding = this._snapTargetBinding;\r\n\tif ( Binding.exists ( binding ) == true ) {\r\n\t\tbinding.removeActionListener ( Binding.ACTION_BLURRED, this );\r\n\t\tbinding.removeActionListener ( Binding.ACTION_VALID, this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Snap to databinding.\r\n * @param {IData} binding\r\n */\r\nBalloonBinding.prototype.snapTo = function ( binding ) {\r\n\r\n\tif ( Interfaces.isImplemented ( IData, binding )) {\r\n\r\n\t\tthis._snapTargetBinding = binding;\r\n\r\n\t\tvar action = binding.dispatchAction ( BalloonBinding.ACTION_INITIALIZE );\r\n\t\tif ( action && action.isConsumed ) {\r\n\t\t\tthis._environmentBinding = action.listener;\r\n\t\t}\r\n\t\tif ( this._environmentBinding ) {\r\n\r\n\t\t\tbinding.addActionListener ( Binding.ACTION_BLURRED, this );\r\n\t\t\tbinding.addActionListener ( Binding.ACTION_VALID, this );\r\n\t\t\tthis.subscribe ( BroadcastMessages.VIEW_CLOSED );\r\n\r\n\t\t\t/*\r\n\t\t\t * Position and update on timed interval.\r\n\t\t\t * TODO: why is the position wrong if we invoke _updatePosition now?\r\n\t\t\t */\r\n\t\t\tvar self = this;\r\n\t\t\tthis._updateInterval = window.setInterval ( function () {\r\n\t\t\t\tif ( Binding.exists ( binding ) == true ) {\r\n\t\t\t\t\tself._updatePosition ();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tself.dispose ();\r\n\t\t\t\t}\r\n\t\t\t}, BalloonBinding.TIMEOUT );\r\n\r\n\t\t\t/*\r\n\t\t\t * Note that the target, not the balloon,\r\n\t\t\t * is dispatching this action...\r\n\t\t\t */\r\n\t\t\tbinding.dispatchAction ( BalloonBinding.ACTION_SNAP );\r\n\r\n\t\t} else {\r\n\t\t\tthrow \"No environment fit for balloons!\";\r\n\t\t}\r\n\t}\r\n}\r\n\r\nBalloonBinding.prototype.isSnapTo = function (binding) {\r\n\r\n\treturn binding === this._snapTargetBinding;\r\n}\r\n\r\n/**\r\n * @param {Point} point\r\n */\r\nBalloonBinding.prototype._updatePosition = function () {\r\n\r\n\tvar target = this._snapTargetBinding;\r\n\tvar environment = this._environmentBinding;\r\n\tvar root = UserInterface.getBinding ( target.bindingDocument.body );\r\n\r\n\tif ( Binding.exists ( target ) && Binding.exists ( environment )) {\r\n\r\n\t\tif ( !root.isActivated ) {\r\n\t\t\tif ( this.isVisible == true ) {\r\n\t\t\t\tthis.hide ();\r\n\t\t\t}\r\n\t\t} else if ( target.isAttached && environment.isAttached ) {\r\n\r\n\t\t\tvar tPoint = target.boxObject.getUniversalPosition ();\r\n\t\t\tvar ePoint = environment.boxObject.getUniversalPosition ();\r\n\r\n\t\t\tePoint.y += environment.bindingElement.scrollTop;\r\n\t\t\tePoint.x += environment.bindingElement.scrollLeft;\r\n\r\n\t\t\tvar tDim = target.boxObject.getDimension ();\r\n\t\t\tvar eDim = environment.boxObject.getDimension ();\r\n\r\n\t\t\t/*\r\n\t\t\t * Calculations to undispay balloon if target is not\r\n\t\t\t * visible within the boudaries of the environment.\r\n\t\t\t */\r\n\t\t\tvar isAbort = false;\r\n\t\t\tif ( tPoint.y + tDim.h < ePoint.y ) {\r\n\t\t\t\tisAbort = true;\r\n\t\t\t} else if ( tPoint.x + tDim.w < ePoint.x ) {\r\n\t\t\t\tisAbort = true;\r\n\t\t\t} else if ( tPoint.y > ePoint.y + eDim.h ) {\r\n\t\t\t\tisAbort = true;\r\n\t\t\t} else if ( tPoint.x > ePoint.x + eDim.w ) {\r\n\t\t\t\tisAbort = true;\r\n\t\t\t}\r\n\r\n\t\t\tif ( !isAbort ) {\r\n\t\t\t\tthis._setComputedPosition ( tPoint, ePoint, tDim, eDim );\r\n\t\t\t\tif ( !this.isVisible ) {\r\n\t\t\t\t\tthis.show ();\r\n\t\t\t\t}\r\n\t\t\t} else if ( this.isVisible == true ) {\r\n\t\t\t\tthis.hide ();\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tthis.dispose ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Compute position so that balloon is always visible.\r\n * @param {Point} tPoint\r\n * @param {Point} ePoint\r\n * @param {Dimension} tDim\r\n * @param {Dimension} eDim\r\n */\r\nBalloonBinding.prototype._setComputedPosition = function ( tPoint, ePoint, tDim, eDim ) {\r\n\r\n\tvar wDim = WindowManager.getWindowDimensions ();\r\n\tvar bDim = this._getDimension ();\r\n\tvar point = tPoint;\r\n\tvar isLeft = false;\r\n\r\n\t/*\r\n\t * Display balloon on the left side?\r\n\t */\r\n\tif ( tPoint.x + tDim.w + bDim.w + BalloonBinding.OFFSET_X >= wDim.w ) { // ballon outside app window?\r\n\t\tisLeft = true;\r\n\t} else if ( tPoint.x + tDim.w >= ePoint.x + eDim.w ) { // target cut by environment box (on the right side)?\r\n\t\tisLeft = true;\r\n\t}\r\n\r\n\tif ( isLeft ) {\r\n\t\tif (point.x < bDim.w + BalloonBinding.OFFSET_X) { // ballon outside app window from left\r\n\t\t\tpoint.x += BalloonBinding.OFFSET_X * 2;\r\n\t\t\tthis.detachClassName(BalloonBinding.CLASSNAME_LEFT);\r\n\t\t} else {\r\n\t\t\tpoint.x -= (bDim.w + BalloonBinding.OFFSET_X);\r\n\t\t\tthis.attachClassName(BalloonBinding.CLASSNAME_LEFT);\r\n\t\t}\r\n\t} else {\r\n\t\tpoint.x += tDim.w + BalloonBinding.OFFSET_X;\r\n\t \tthis.detachClassName ( BalloonBinding.CLASSNAME_LEFT );\r\n\t}\r\n\r\n\t/*\r\n\t * Make the balloon appear above the target.\r\n\t */\r\n\tpoint.y -= ( bDim.h );\r\n\tpoint.y += BalloonBinding.OFFSET_Y;\r\n\tpoint.y = Math.round(point.y);\r\n\r\n\tthis._setPosition ( point );\r\n}\r\n\r\n/**\r\n * Dispose the balloon when associated view closes and\r\n * whenever a new view is opened (otherwise the balloon\r\n * may block the opened view).\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nBalloonBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tBalloonBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\r\n\t\t/*\r\n\t\t * If our view closed, close the balloon now.\r\n\t\t * Don't wait for interval to find out.\r\n\t\t */\r\n\t\tcase BroadcastMessages.VIEW_CLOSED :\r\n\t\t\tif ( this._isAssociatedView ( arg ) == true ) {\r\n\t\t\t\tthis.dispose ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Does a ViewBinding with a certain handle contain my snaptarget Binding?\r\n * @param {string} handle\r\n * @return {boolean}\r\n */\r\nBalloonBinding.prototype._isAssociatedView = function ( handle ) {\r\n\r\n\tvar result = false;\r\n\tif ( this._snapTargetBinding ) {\r\n\t\tvar view = this._snapTargetBinding.getAncestorBindingByType ( ViewBinding, true );\r\n\t\tif ( view && view.getHandle () == handle ) {\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set position. This has been fitted with a mechanism that\r\n * doesn't update the position while CSS transforms are running.\r\n * @param {Point} point\r\n */\r\nBalloonBinding.prototype._setPosition = function ( point ) {\r\n\r\n\tvar isAbort = false;\r\n\tvar pos = this.boxObject.getLocalPosition ();\r\n\tif ( this._point != null ) {\r\n\t\tif ( pos.x != this._point.x || pos.y != this._point.y ) {\r\n\t\t\tisAbort = true;\r\n\t\t}\r\n\t}\r\n\r\n\tif (!isAbort) {\r\n\t\tthis.bindingElement.style.left = point.x + \"px\";\r\n\t\tthis.bindingElement.style.top = point.y + \"px\";\r\n\t\tthis._point = point;\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {Point}\r\n */\r\nBalloonBinding.prototype._getPosition = function () {\r\n\r\n\treturn new Point (\r\n\t\tthis.bindingElement.offsetLeft,\r\n\t\tthis.bindingElement.offsetTop\r\n\t);\r\n}\r\n\r\n /**\r\n * @return {Dimension}\r\n */\r\nBalloonBinding.prototype._getDimension = function () {\r\n\r\n\treturn new Dimension (\r\n\t\tthis.bindingElement.offsetWidth,\r\n\t\tthis.bindingElement.offsetHeight\r\n\t);\r\n}\r\n\r\n/**\r\n * Cannot use \"display\" property because we need to compute on width and height.\r\n * @overwrites {Binding#hide}\r\n */\r\nBalloonBinding.prototype.hide = function () {\r\n\r\n\tif ( this.isVisible ) {\r\n\t\tthis.bindingElement.style.visibility = \"hidden\";\r\n\t\tthis.isVisible = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overwrites {Binding#show}\r\n */\r\nBalloonBinding.prototype.show = function () {\r\n\r\n\tif ( !this.isVisible ) {\r\n\t\tthis.bindingElement.style.visibility = \"visible\";\r\n\t\tthis.isVisible = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nBalloonBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tBalloonBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\tcase Binding.ACTION_ACTIVATED :\r\n\t\t\tif ( this._snapTargetBinding ) {\r\n\t\t\t\tthis._snapTargetBinding.dispatchAction (\r\n\t\t\t\t\tBinding.ACTION_ACTIVATED\r\n\t\t\t\t);\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\r\n\t\t/**\r\n\t\t * Note that the binding may be blurred when the server (not the\r\n\t\t * client) deems it invalid. In that case, a dialog may be opened,\r\n\t\t * blurring the binding, but the call to method validate will\r\n\t\t * still return true (because only the server knows for sure).\r\n\t\t * In that case, we have to make sure not to dispose the balloon.\r\n\t\t */\r\n\t\tcase Binding.ACTION_BLURRED :\r\n\t\tcase Binding.ACTION_VALID :\r\n\t\t\tif ( binding == this._snapTargetBinding ) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tif ( !Binding.exists ( binding )) {\r\n\t\t\t\t\t\tself.dispose ();\r\n\t\t\t\t\t} else if ( binding.validate ()) {\r\n\t\t\t\t\t\tvar isDispose = true;\r\n\t\t\t\t\t\tif ( action.type == Binding.ACTION_BLURRED ) {\r\n\t\t\t\t\t\t\tvar root = binding.bindingDocument.body;\r\n\t\t\t\t\t\t\tvar bind = UserInterface.getBinding ( root );\r\n\t\t\t\t\t\t\tif ( !root.isActivated ) { // dialog was opened\r\n\t\t\t\t\t\t\t\tisDispose = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif ( isDispose ) {\r\n\t\t\t\t\t\t\tself.dispose ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase ControlBinding.ACTION_COMMAND :\r\n\t\t\tthis.dispose ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label\r\n * @param {string} label\r\n */\r\nBalloonBinding.prototype.setLabel = function ( label ) {\r\n\r\n\tif (this.isAttached) {\r\n\t\tif (!this.shadowTree.balloontext) {\r\n\t\t\tthis.shadowTree.balloontext = DOMUtil.createElementNS(Constants.NS_UI, \"ui:balloontext\", this.bindingDocument);\r\n\t\t\tthis.bindingElement.appendChild(this.shadowTree.balloontext);\r\n\t\t}\r\n\t\twhile (this.shadowTree.balloontext.firstChild) {\r\n\t\t\tthis.shadowTree.balloontext.removeChild(this.shadowTree.balloontext.firstChild);\r\n\t\t}\r\n\t\tvar text = this.bindingDocument.createTextNode ( label );\r\n\t\tthis.shadowTree.balloontext.appendChild(text);\r\n\t}\r\n\tthis.setProperty ( \"label\", label );\r\n}\r\n\r\n/**\r\n * Get label.\r\n * @return {string}\r\n */\r\nBalloonBinding.prototype.getLabel = function () {\r\n\r\n\treturn this.getProperty ( \"label\" );\r\n}\r\n\r\n/**\r\n * BalloonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {BalloonBinding}\r\n */\r\nBalloonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:balloon\", ownerDocument );\r\n\tvar binding = UserInterface.registerBinding ( element, BalloonBinding );\r\n\tbinding.hide ();\r\n\treturn binding;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/balloons/BalloonSetBinding.js",
    "content": "BalloonSetBinding.prototype = new Binding;\r\nBalloonSetBinding.prototype.constructor = BalloonSetBinding;\r\nBalloonSetBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction BalloonSetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BalloonSetBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBalloonSetBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[BalloonSetBinding]\";\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/bindingmappings/BindingMappingSetBinding.js",
    "content": "BindingMappingSetBinding.prototype = new Binding;\r\nBindingMappingSetBinding.prototype.constructor = BindingMappingSetBinding;\r\nBindingMappingSetBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * Note that this is *not* a real binding. We contructed this file \r\n * specifically to inform you of this. The markup \"ui:bindingmappingset\" \r\n * is parsed by the DocumentManager as sort of a processing instruction \r\n * directing how Bindings should be associated to elements in this window.\r\n * @see {DocumentManager}\r\n */\r\nfunction BindingMappingSetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BindingMappingSetBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBindingMappingSetBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[BindingMappingSetBinding]\";\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/block/BlockBinding.js",
    "content": "BlockBinding.prototype = new Binding;\r\nBlockBinding.prototype.constructor = BlockBinding;\r\nBlockBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction BlockBinding () {\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isBlocking = false;\r\n\t\r\n\t/*\r\n\t * Returnable \r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding\r\n * @return {string}\r\n */\r\nBlockBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[BlockBinding]\";\r\n}\r\n\r\n/**\r\n * Block GUI.\r\n */\r\nBlockBinding.prototype.block = function () {\r\n\t\r\n\tif ( !this._isBlocking ) {\r\n\t\tApplication.lock ( this );\r\n\t\tthis._isBlocking = true;\r\n\t\tthis.show ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Unblock gui.\r\n */\r\nBlockBinding.prototype.unblock = function () {\r\n\t\r\n\tif ( this._isBlocking == true ) {\r\n\t\tthis.hide ();\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/branding/BrandSnippetBinding.js",
    "content": "BrandSnippetBinding.prototype = new Binding;\nBrandSnippetBinding.prototype.constructor = BrandSnippetBinding;\nBrandSnippetBinding.superclass = Binding.prototype;\n\nBrandSnippetBinding.SHIPPET_URL = \"${root}/content/branding/{0}.inc?\" + Application.CONSOLE_ID;\nBrandSnippetBinding.SHIPPETBRANDED_URL = \"${root}/content/branding/{0}-branded.inc?\" + Application.CONSOLE_ID;\n\n/**\n * @type {String}\n */\nBrandSnippetBinding.SnippetName = null;\n\n/**\n * Indicate that loading starterd\n * @type {bool}\n */\nBrandSnippetBinding.snippetLoading = false;\n\n/**\n * @type {bool}\n */\nBrandSnippetBinding.snippetLoaded = false;\n\n/**\n * Load SVG images\n */\nBrandSnippetBinding.snippetLoad = function (binding) {\n\n\tfunction onsnippetload() {\n\t\tvar request = this;\n\t\tif (request.responseText) {\n\t\t\tBrandSnippetBinding.snippetLoading = false;\n\t\t\tbinding.bindingElement.innerHTML = request.responseText;\n\t\t} else {\n\t\t\trequest.open('GET', Resolver.resolve(binding.getSnippetUrl()));\n\t\t\trequest.send();\n\t\t}\n\t}\n\n\t\tBrandSnippetBinding.snippetLoading = true;\n\t\tvar request = new XMLHttpRequest();\n\t\trequest.onload = onsnippetload;\n\t\trequest.open('GET', Resolver.resolve(binding.getSnippetBrandedUrl()));\n\t\trequest.send();\n\n}\n\n/**\n * @class\n */\nfunction BrandSnippetBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"BrandSnippetBinding\");\n\n\t/*\n\t * Returnable.\n\t */\n\treturn this;\n}\n\n/**\n * Identifies binding.\n */\nBrandSnippetBinding.prototype.toString = function () {\n\n\treturn \"[BrandSnippetBinding]\";\n}\n\n\n/**\n * @overloads {Binding#onBindingRegister}\n */\nBrandSnippetBinding.prototype.onBindingRegister = function () {\n\n\tBrandSnippetBinding.superclass.onBindingRegister.call(this);\n\tBrandSnippetBinding.snippetLoad(this);\n}\n\n/**\n * @overloads {Binding#onBindingAttach}\n */\nBrandSnippetBinding.prototype.onBindingAttach = function () {\n\n\tBrandSnippetBinding.superclass.onBindingAttach.call(this);\n}\n/**\n * @return {string}\n */\nBrandSnippetBinding.prototype.getSnippetBrandedUrl = function () {\n\n\treturn BrandSnippetBinding.SHIPPETBRANDED_URL.replace(\"{0}\", this.getProperty(\"snippetname\"));\n}\n\n/**\n * @return {string}\n */\nBrandSnippetBinding.prototype.getSnippetUrl = function () {\n\n\treturn BrandSnippetBinding.SHIPPET_URL.replace(\"{0}\", this.getProperty(\"snippetname\"));\n}\n\n/**\n * BrandSnippetBinding factory.\n * @param {DOMDocument} ownerDocument\n * @return {BrandSnippetBinding}\n */\nBrandSnippetBinding.newInstance = function (ownerDocument) {\n\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:brandsnippet\", ownerDocument);\n\treturn UserInterface.registerBinding(element, BrandSnippetBinding);\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/broadcasters/BroadcasterBinding.js",
    "content": "BroadcasterBinding.prototype = new Binding;\r\nBroadcasterBinding.prototype.constructor = BroadcasterBinding;\r\nBroadcasterBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * The broadcaster can mysteriously project its properties onto other bindings. \r\n * By updating a single broadcaster, multiple other bindings will update. This \r\n * setup is handled using the (other) bindings \"observes\" property.\r\n */\r\nfunction BroadcasterBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BroadcasterBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><List<Binding>>}\r\n\t */\r\n\tthis._observers = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBroadcasterBinding.prototype.toString = function () {\r\n\r\n\treturn \"[BroadcasterBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nBroadcasterBinding.prototype.onBindingRegister = function () {\r\n\r\n\tBroadcasterBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this.setDisabled;\r\n\tthis._observers = new List ();\r\n}\r\n\r\n/**\r\n * All broadcaster property updates will be transmitted to observers. \r\n * @overloads {Binding#setProperty}\r\n * @param {string} attname The name of the attribute\r\n * @param {object} value The attribute value.\r\n */\r\nBroadcasterBinding.prototype.setProperty = function ( attname, value ) {\r\n\t\r\n\tBroadcasterBinding.superclass.setProperty.call ( this, attname, value );\r\n\t\r\n\tfunction update ( list ) {\r\n\t\tif ( list ) {\r\n\t\t\tlist.each ( function ( binding ) {\r\n\t\t\t\tbinding.setProperty ( attname, value );\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tif ( this._observers [ \"*\" ] != null ) {\r\n\t\tupdate ( this._observers [ \"*\" ]);\r\n\t}\r\n\tvar observers = this._observers [ attname ];\r\n\tif ( observers ) {\r\n\t\tupdate ( observers );\r\n\t}\r\n}\r\n\r\n/**\r\n * All broadcaster property deletions will be mimicked by observers. \r\n * @overloads {Binding#deleteProperty}\r\n * @param {string} attname The name of the attribute\r\n */\r\nBroadcasterBinding.prototype.deleteProperty = function ( attname ) {\r\n\t\r\n\tBroadcasterBinding.superclass.deleteProperty.call ( this, attname );\r\n\t\r\n\tfunction update ( list ) {\r\n\t\tif ( list ) {\r\n\t\t\tlist.each ( function ( binding ) {\r\n\t\t\t\tbinding.deleteProperty ( attname );\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tif ( this._observers [ \"*\" ] != null ) {\r\n\t\tupdate ( this._observers [ \"*\" ]);\r\n\t}\r\n\tvar observers = this._observers [ attname ];\r\n\tif ( observers ) {\r\n\t\tupdate ( observers );\r\n\t}\r\n}\r\n\r\n/**\r\n * Add observer binding.\r\n * @param {Binding} binding\r\n * @param {string} properties A whitespace-separated list of properties to watch\r\n */\r\nBroadcasterBinding.prototype.addObserver = function ( binding, properties ) {\r\n\t\r\n\tproperties = properties ? properties : \"*\";\r\n\tproperties = new List ( properties.split ( \" \" ));\r\n\t\r\n\twhile ( properties.hasNext ()) {\r\n\t\tvar property = properties.getNext ();\r\n\t\tswitch ( property ) {\r\n\t\t\tcase \"*\" :\r\n\t\t\t\tthis._setAllProperties ( binding );\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tvar value = this.getProperty ( property );\r\n\t\t\t\tbinding.setProperty ( property, value );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif ( !this._observers [ property ]) {\r\n\t\t\tthis._observers [ property ] = new List ();\r\n\t\t}\r\n\t\tthis._observers [ property ].add ( binding );\r\n\t}\r\n}\r\n\r\n/**\r\n * Transmit all properties to specified binding.\r\n * @param {Binding} binding\r\n */\r\nBroadcasterBinding.prototype._setAllProperties = function ( binding ) {\r\n\t\r\n\tvar atts = new List ( this.bindingElement.attributes );\r\n\twhile ( atts.hasNext ()) {\r\n\t\tvar att = atts.getNext ();\r\n\t\tif ( att.specified ) {\r\n\t\t\tvar property = att.nodeName;\r\n\t\t\tswitch ( property ) {\r\n\t\t\t\tcase \"id\" :\r\n\t\t\t\tcase \"key\" :\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tvar value = this.getProperty ( property );\r\n\t\t\t\t\tbinding.setProperty ( \r\n\t\t\t\t\t\tproperty,\r\n\t\t\t\t\t\tvalue\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Remove observer binding.\r\n * TODO: Test this method!\r\n * @param {Binding} binding\r\n * @param {string} properties A whitespace-separated list of properties to watch\r\n */\r\nBroadcasterBinding.prototype.removeObserver = function ( binding, properties ) {\r\n\t\r\n\tproperties = properties ? properties : \"*\";\r\n\tproperties = new List ( properties.split ( \" \" ));\r\n\t\r\n\twhile ( properties.hasNext ()) {\r\n\t\tvar list = this._observers [ properties.getNext ()];\r\n\t\tif ( list ) {\r\n\t\t\twhile ( list.hasNext ()) {\r\n\t\t\t\tvar entry = list.getNext ();\r\n\t\t\t\tif ( entry == binding ) {\r\n\t\t\t\t\tlist.del ( entry );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * This method provides a prettified interface for \r\n * updating the always popular disabled property. \r\n */\r\nBroadcasterBinding.prototype.disable = function () {\r\n\t\r\n\tthis.setDisabled ( true );\r\n}\r\n\r\n/**\r\n * This method provides a prettified interface for \r\n * updating the always popular disabled property. \r\n */\r\nBroadcasterBinding.prototype.enable = function () {\r\n\t\r\n\tthis.setDisabled ( false );\r\n}\r\n\r\n/**\r\n * This method provides a prettified interface for \r\n * updating the always popular disabled property. \r\n * @param {boolean} isDisabled\r\n */\r\nBroadcasterBinding.prototype.setDisabled = function ( isDisabled ) {\r\n\t\r\n\tthis.setProperty ( \"isdisabled\", isDisabled );\r\n}\r\n\r\n/**\r\n * This method provides a prettified interface for \r\n * checking the always popular disabled property. \r\n * @return {boolean}\r\n */\r\nBroadcasterBinding.prototype.isDisabled = function () {\r\n\t\r\n\treturn this.getProperty ( \"isdisabled\" ) == true;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/broadcasters/BroadcasterSetBinding.js",
    "content": "BroadcasterSetBinding.prototype = new Binding;\r\nBroadcasterSetBinding.prototype.constructor = BroadcasterSetBinding;\r\nBroadcasterSetBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * Why not have binding for this?\r\n */\r\nfunction BroadcasterSetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BroadcasterSetBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nBroadcasterSetBinding.prototype.toString = function () {\r\n\r\n\treturn \"[BroadcasterSetBinding]\";\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/ButtonBinding.js",
    "content": "ButtonBinding.prototype = new Binding;\r\nButtonBinding.prototype.constructor = ButtonBinding;\r\nButtonBinding.superclass = Binding.prototype;\r\n\r\nButtonBinding.ACTION_COMMAND = \"buttoncommand\";\r\nButtonBinding.ACTION_RADIOBUTTON_ATTACHED = \"radiobutton attached\";\r\n\r\nButtonBinding.TYPE_CHECKBUTTON = \"checkbox\"; /* TODO: RENAME THIS TO CHECKBUTTON! */\r\nButtonBinding.TYPE_RADIOBUTTON = \"radio\";\r\n\r\nButtonBinding.CLASSNAME_FOCUSABLE = \"focusable\";\r\nButtonBinding.CLASSNAME_FOCUSED = \"focused\";\r\nButtonBinding.CLASSNAME_DEFAULT = \"primary\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isCheckButton = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRadioButton = false;\r\n\r\n\t/**\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis.isComboButton = false;\r\n\t\r\n\t/**\r\n\t * Flip this exotic property to invoke hover state onmouseover even when \r\n\t * a radiobutton or checkbutton is checked. No effect for normal buttons.\r\n\t * @see {ButtonStateManager#handleEvent}\r\n\t */\r\n\tthis.isCheckBox = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActive = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isChecked = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisabled = false;\r\n\t\r\n\t/**\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = false;\r\n\t\r\n\t/**\r\n\t * When disabled, this will backup the value of isFocusable.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isFocusableButton = false;\r\n\t\r\n\t/**\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\t\r\n\t/**\r\n\t * Relevant for focusable dialog buttons...\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDefault = false;\r\n\t\r\n\t/**\r\n\t * @type {PopupBinding}\r\n\t */\r\n\tthis.popupBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {LabelBinding}\r\n\t */\r\n\tthis.labelBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageHover = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageActive = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageDisabled = null;\r\n\t\r\n\t/**\r\n\t * @type {ImageProfile}\r\n\t */\r\n\tthis.imageProfile = null;\r\n\t\r\n\t/**\r\n\t * @type {ButtonStateManager}\r\n\t */\r\n\tthis._stateManager = null;\r\n\t\r\n\t/**\r\n\t * Used in dialogs.\r\n\t * @type {object} \r\n\t */\r\n\tthis.response = null;\r\n\t\r\n\t/**\r\n\t * @type {DOMElement}\r\n\t */\r\n\tthis.popupBindingTargetElement = null;\r\n\t\r\n\t/**\r\n\t * Subclasses can owerwrite this to \r\n\t * dispatch an unique Action type.\r\n\t */\r\n\tthis.commandAction = ButtonBinding.ACTION_COMMAND;\r\n\t\r\n\t/**\r\n\t * Image and text position reversed?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFlipped = false;\r\n\t\r\n\t/**\r\n\t * @implements {IData}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ DocumentCrawler.ID, FlexBoxCrawler.ID, FocusCrawler.ID, FitnessCrawler.ID ]);\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ButtonBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister} \r\n */\r\nButtonBinding.prototype.onBindingRegister = function () {\r\n\r\n\tButtonBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this.setDisabled;\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach} \r\n */\r\nButtonBinding.prototype.onBindingAttach = function () {\r\n\r\n\tButtonBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.parseDOMProperties ();\r\n\tthis.buildDOMContent ();\r\n\t\r\n\tif ( this.isRadioButton == true ) {\r\n\t\tthis.dispatchAction ( ButtonBinding.ACTION_RADIOBUTTON_ATTACHED );\r\n\t}\r\n}\r\n\r\n/**\r\n * Cleanup button.\r\n * @overloads {Binding#onBindingDispose} \r\n */\r\nButtonBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tButtonBinding.superclass.onBindingDispose.call ( this );\r\n\tif ( this._stateManager != null ) {\r\n\t\tthis._stateManager.dispose ();\r\n\t\tthis._stateManager = null;\r\n\t}\r\n\r\n    var callbackid = this.getProperty(\"callbackid\");\r\n    if (callbackid != null) {\r\n        this.bindingWindow.DataManager.unRegisterDataBinding(callbackid);\r\n    }\r\n}\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nButtonBinding.prototype.parseDOMProperties = function () {\r\n\r\n\tBinding.imageProfile ( this );\r\n\t\r\n\t/*\r\n\tif ( !this.imageProfile ) {\r\n\r\n\t\tvar image = this.getProperty ( \"image\" );\r\n\t\tvar imageHover = this.getProperty ( \"image-hover\" );\r\n\t\tvar imageActive = this.getProperty ( \"image-active\" );\r\n\t\tvar imageDisabled = this.getProperty ( \"image-disabled\" );\r\n\t\t\r\n\t\tif ( !this.image && image ) {\r\n\t\t\tthis.image = image;\r\n\t\t}\r\n\t\tif ( !this.imageHover && imageHover ) {\r\n\t\t\tthis.imageHover = image;\r\n\t\t}\r\n\t\tif ( !this.imageActive && imageActive ) {\r\n\t\t\tthis.imageActive = imageActive;\r\n\t\t}\r\n\t\tif ( !this.imageDisabled && imageDisabled ) {\r\n\t\t\tthis.imageDisabled = imageDisabled;\r\n\t\t}\r\n\t\tthis.imageProfile = new ImageProfile ( this );\r\n\t}\r\n\t*/\r\n}\r\n\r\n/**\r\n * Building DOM content.\r\n */\r\nButtonBinding.prototype.buildDOMContent = function () {\r\n\r\n\tvar tree\t\t= this.shadowTree;\r\n\tvar width\t\t= this.getProperty ( \"width\" );\r\n\tvar label \t\t= this.getProperty ( \"label\" );\r\n\tvar type\t\t= this.getProperty ( \"type\" );\r\n\tvar popup\t\t= this.getProperty ( \"popup\" );\r\n\tvar tooltip \t= this.getProperty ( \"tooltip\" );\r\n\tvar disabled\t= this.getProperty ( \"isdisabled\" );\r\n\tvar response\t= this.getProperty ( \"response\" );\r\n\tvar oncommand\t= this.getProperty ( \"oncommand\" );\r\n\tvar value \t\t= this.getProperty ( \"value\" );\r\n\tvar checked\t\t= this.getProperty ( \"ischecked\" );\r\n\tvar callbackid\t= this.getProperty ( \"callbackid\" );\r\n\tvar isFocusable\t= this.getProperty ( \"focusable\" );\r\n\tvar isFocused\t= this.getProperty ( \"focused\" );\r\n\tvar isDefault   = this.getProperty ( \"default\" );\r\n\tvar url\t\t\t= this.getProperty ( \"url\" );\r\n\tvar isFlipped\t= this.getProperty ( \"flip\" );\r\n\r\n\t/*\r\n\t * Build the label.\r\n\t */\r\n\tthis.labelBinding = LabelBinding.newInstance ( this.bindingDocument );\r\n\tthis.add ( this.labelBinding );\r\n\tthis.labelBinding.attach ();\r\n\tthis.shadowTree.labelBinding = this.labelBinding;\r\n\tif ( isFlipped ) {\r\n\t\tthis.flip ( true );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Buld the rest.\r\n\t */\r\n\tif ( !this._stateManager ) {\r\n\t\tthis._stateManager = new ButtonStateManager ( this );\r\n\t}\r\n\tif ( this.imageProfile != null && this.imageProfile.getDefaultImage () != null ) {\r\n\t\tthis.setImage ( this.imageProfile.getDefaultImage ());\r\n\t}\r\n\tif ( label != null ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\tif ( type != null ) {\r\n\t\tthis.setType ( type );\r\n\t}\r\n\tif ( tooltip != null ) {\r\n\t\tthis.setToolTip ( tooltip );\r\n\t}\r\n\tif ( width != null ) {\r\n\t\tthis.setWidth ( width );\r\n\t}\r\n\tif ( popup != null ) {\r\n\t\tthis.setPopup ( popup );\r\n\t} \r\n\tif ( response != null ) {\r\n\t\tthis.response = response;\r\n\t}\r\n\tif ( checked == true ) {\r\n\t\tif ( this.isCheckButton || this.isRadioButton ) {\r\n\t\t\tthis.check ( true );\r\n\t\t}\r\n\t}\r\n\tif ( oncommand != null && this.oncommand == null ) {\r\n\t\tthis.oncommand = function () {\r\n\t\t\tBinding.evaluate ( oncommand, this );\r\n\t\t};\r\n\t}\r\n\tif ( isFocusable || this.isFocusable ) {\r\n\t\tthis._makeFocusable ();\r\n\t\tif ( isDefault || this.isDefault ) {\r\n\t\t\tthis.isDefault = true;\r\n\t\t}\r\n\t\tif ( isFocused ) {\r\n\t\t\tthis.focus ();\r\n\t\t}\r\n\t}\r\n\tif ( disabled == true ) {\r\n\t\tthis.disable ();\r\n\t}\r\n\tif ( url != null ) {\r\n\t\tthis.setURL ( url );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Setup ASP.NET callback.\r\n\t */\r\n\tif ( callbackid != null ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Register as DataBinding.\r\n\t\t */\r\n\t\tthis.bindingWindow.DataManager.registerDataBinding ( callbackid, this );\r\n\t\t\r\n\t\t/*\r\n\t\t * Unless they have a value, buttons should not inject a hidden field.\r\n\t\t * NOTE: The value must NOT be an empty string, since this is treated \r\n\t\t * as null for inscrutable historic reasons.\r\n\t\t */\r\n\t\tif ( value != null ) {\r\n\t\t\tBinding.dotnetify ( this, value );\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * By default, callbackid will instantiate a postback  \r\n\t\t * on button click while marking the binding dirty. \r\n\t\t * Note: It may be quite important for backend buttons \r\n\t\t * not to have an oncommand specified.\r\n\t\t */\r\n\t\tif ( this.oncommand == null ) {\r\n\t\t\tthis.oncommand = function () {\r\n\t\t\t\tthis.dirty ();\r\n\t\t\t\tif ( this.getProperty ( \"validate\" ) == true ) {\r\n\t\t\t\t\tthis.dispatchAction ( PageBinding.ACTION_DOVALIDATEDPOSTBACK );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Make focusable.\r\n */\r\nButtonBinding.prototype._makeFocusable = function () {\r\n \r\n\tthis.isFocusable = true;\r\n\tthis.attachClassName ( ButtonBinding.CLASSNAME_FOCUSABLE );\r\n\tthis._isFocusableButton = true;\r\n}\r\n\r\n/**\r\n * Set image.\r\n * @param {string} image\r\n */\r\nButtonBinding.prototype.setImage = function ( image ) {\r\n\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setImage ( image );\r\n\t}\r\n\tthis.setProperty ( \"image\", image );\r\n}\r\n\r\n/**\r\n * Get image.\r\n * @return {string}\r\n */\r\nButtonBinding.prototype.getImage = function () {\r\n\r\n\treturn this.getProperty ( \"image\" );\r\n}\r\n\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nButtonBinding.prototype.setLabel = function ( label ) {\r\n\t\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setLabel ( label );\r\n\t}\r\n\tthis.setProperty ( \"label\", label );\t\r\n}\r\n\r\n/** \r\n * Get label.\r\n * @return {string}\r\n */\r\nButtonBinding.prototype.getLabel = function () {\r\n\t\r\n\treturn this.getProperty ( \"label\" );\r\n}\r\n\r\n\r\n/**\r\n * This should probably only be set during initialization.\r\n * @param {string} type\r\n */\r\nButtonBinding.prototype.setType = function ( type ) {\r\n\r\n\tswitch ( type ) {\r\n\t\tcase ButtonBinding.TYPE_CHECKBUTTON :\r\n\t\t\tthis.isCheckButton = true;\r\n\t\t\tbreak;\r\n\t\tcase ButtonBinding.TYPE_RADIOBUTTON :\r\n\t\t\tthis.isRadioButton = true;\r\n\t\t\tbreak;\r\n\t}\r\n\tthis.setProperty ( \"type\", type );\r\n}\r\n\r\n/**\r\n * Set tooltip.\r\n * @param {string} type\r\n */\r\nButtonBinding.prototype.setToolTip = function ( tooltip ) {\r\n\t\r\n\tthis.setProperty ( \"tooltip\", tooltip );\r\n\tif ( this.isAttached == true ) {\r\n\t\tthis.setProperty ( \"title\", Resolver.resolve ( tooltip ));\r\n\t}\r\n}\r\n\r\n/** \r\n * Get tooltip.\r\n * @return {string}\r\n */\r\nButtonBinding.prototype.getToolTip = function () {\r\n\t\r\n\treturn this.getProperty ( \"tooltip\" );\r\n}\r\n\r\n/**\r\n * Set image profile. The button constructs a default imageprofile, \r\n * so this should only be used in special cases.\r\n * @param {Class} imageProfileImplementation\r\n */\r\nButtonBinding.prototype.setImageProfile = function ( imageProfileImplementation ) {\r\n\t\r\n\tthis.imageProfile = new imageProfileImplementation ( this );\r\n}\r\n\r\n/**\r\n * Note that this will convert the button to a checkboxbutton.\r\n * @param {object} arg This can be either a string or a {@link PopupBinding}.\r\n */\r\nButtonBinding.prototype.setPopup = function ( arg ) {\r\n\r\n\tthis.popupBinding = this.getBindingForArgument ( arg );\r\n\r\n\tif ( this.popupBinding ) {\r\n\t\tthis.setType ( ButtonBinding.TYPE_CHECKBUTTON );\r\n\t\tif ( !this.popupBindingTargetElement ) {\r\n\t\t\tthis.popupBindingTargetElement = this.bindingElement;\r\n\t\t}\r\n\t\tvar self = this;\r\n\t\tthis.popupBinding.addActionListener ( PopupBinding.ACTION_HIDE, {\r\n\t\t\thandleAction : function () {\r\n\t\t\t\tif ( self.isChecked == true ) {\r\n\t\t\t\t\tself.uncheck ( true );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}\r\n\r\n/**\r\n * This wil rig up the button to launch an URL in a new browserwindow when clicked.\r\n * This is *not* done by window.open. Instead, we place a simple link inside the button. \r\n * This will trigger Prism to launch the default browser instead of a new Prism window.\r\n * @param {string} url\r\n */\r\nButtonBinding.prototype.setURL = function ( url ) {\r\n\t\r\n\tif ( this.isAttached == true ) {\r\n\t\tif ( !this.shadowTree.buttonurl ) {\r\n\t\t\tvar a = this.bindingDocument.createElement ( \"a\" );\r\n\t\t\ta.className = \"buttonurl\";\r\n\t\t\ta.target = \"_blank\";\r\n\t\t\tthis.shadowTree.buttonurl = a;\r\n\t\t\tthis.bindingElement.appendChild ( a );\r\n\t\t}\r\n\t\tthis.shadowTree.buttonurl.href = url;\r\n\t}\r\n\tthis.setProperty ( \"url\", url );\r\n}\r\n\r\n/**\r\n * Get URL.\r\n * @return {string}\r\n */\r\nButtonBinding.prototype.getURL = function () {\r\n\t\r\n\treturn this.getProperty ( \"url\" );\r\n}\r\n\r\n/**\r\n * Flip image and text position. This is not supported in IE6.\r\n * @param @optional {boolean} isFlipped.\r\n */\r\nButtonBinding.prototype.flip = function ( isFlipped ) {\r\n\t\r\n\tisFlipped = isFlipped == null ? true : isFlipped;\r\n\tthis.isFlipped = isFlipped;\r\n\tthis.setProperty ( \"flip\", isFlipped );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.flip ( isFlipped );\r\n\t}\r\n}\r\n\r\n/**\r\n * Fire command.\r\n */\r\nButtonBinding.prototype.fireCommand = function () {\r\n\r\n\tif (!this.isDisabled) {\r\n\r\n\t\tif (this.oncommand != null) {\r\n\t\t\tthis.oncommand();\r\n\t\t}\r\n\t\tthis.dispatchAction(this.commandAction);\r\n\r\n\t\tthis.invokePopup();\r\n\r\n\t}\r\n}\r\n\r\n/**\r\n* Invoke popup.\r\n*/\r\nButtonBinding.prototype.invokePopup = function () {\r\n\r\n\tif (!this.isDisabled) {\r\n\r\n\t\tif (this.popupBinding) {\r\n\t\t\tif (!this.isCheckButton || this.isChecked) {\r\n\t\t\t\tthis.popupBinding.snapTo(this.popupBindingTargetElement);\r\n\t\t\t\tthis.popupBinding.show();\r\n\t\t\t\tthis.popupBinding.grabKeyboard();\r\n\t\t\t} else {\r\n\t\t\t\tthis.popupBinding.hide();\r\n\t\t\t\tthis.popupBinding.releaseKeyboard();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * User may define this.\r\n */\r\nButtonBinding.prototype.oncommand = null;\r\n\r\n/**\r\n * Invoke button action. Unlike the fireCommand method, this \r\n * considers whether or not the button is a checkbox-button.\r\n */\r\nButtonBinding.prototype.invoke = function () {\r\n\r\n\tif ( !this.isCheckButton ) {\r\n\t\tthis.fireCommand ();\r\n\t} else {\r\n\t\tif ( this.isChecked ) {\r\n\t\t\tthis.uncheck ();\r\n\t\t} else {\r\n\t\t\tthis.check ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Check button.\r\n * @param {boolean} isDisableCommand\r\n */\r\nButtonBinding.prototype.check = function ( isDisableCommand ) {\r\n\t\r\n\tif (( this.isCheckButton || this.isRadioButton ) && !this.isChecked ) {\r\n\t\tif ( this.isAttached == true ) {\r\n\t\t\tthis._check ();\r\n\t\t\tif ( !isDisableCommand == true ) {\r\n\t\t\t\tthis.fireCommand ();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.setProperty(\"ischecked\", true);\r\n\t\t}\r\n\t\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Isolated so that ButtonStateManager may control these properties.\r\n * @param {boolean} isStateManager\r\n */\r\nButtonBinding.prototype._check = function ( isStateManager ) {\r\n\r\n\tthis.isActive = true;\r\n\tthis.isChecked = true;\r\n\tif ( !isStateManager ) {\r\n\t\tthis._stateManager.invokeActiveState ();\r\n\t}\r\n\tthis.setProperty(\"ischecked\", true);\r\n}\r\n\r\n/**\r\n * Uncheck button.\r\n * @param {boolean} isDisableCommand\r\n */\r\nButtonBinding.prototype.uncheck = function ( isDisableCommand ) {\r\n\r\n\tif (( this.isCheckButton || this.isRadioButton ) && this.isChecked ) {\r\n\t\tif (this.isAttached == true && !this.isDisposed) {\r\n\t\t\tthis._uncheck();\r\n\t\t\tif (!isDisableCommand == true) {\r\n\t\t\t\tthis.fireCommand();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.setProperty(\"ischecked\", false);\r\n\t\t}\r\n\r\n\t}\r\n}\r\n\r\n/**\r\n * Isolated so that ButtonStateManager may control these properties.\r\n * @param {boolean} isStateManager\r\n */\r\nButtonBinding.prototype._uncheck = function ( isStateManager ) {\r\n\r\n\tthis.isActive = false;\r\n\tthis.isChecked = false;\r\n\tif ( !isStateManager ) {\r\n\t\tthis._stateManager.invokeNormalState ();\r\n\t}\r\n\tthis.setProperty(\"ischecked\", false);\r\n}\r\n\r\n/**\r\n * Check / uncheck button.\r\n * @param {boolean} isChecked\r\n * @param {boolean} isDisableCommand\r\n */\r\nButtonBinding.prototype.setChecked = function ( isChecked, isDisableCommand ) {\r\n\t\r\n\tif ( isChecked == null ) {\r\n\t\tisChecked == false;\r\n\t}\r\n\t\r\n\tif ( this.isCheckButton || this.isRadioButton ) {\r\n\t\tswitch ( isChecked ) {\r\n\t\t\tcase true :\r\n\t\t\t\tthis.check ( isDisableCommand );\r\n\t\t\t\tbreak;\r\n\t\t\tcase false :\r\n\t\t\t\tthis.uncheck ( isDisableCommand );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Set button disabled status.\r\n * @param {boolean} bool\r\n */\r\nButtonBinding.prototype.setDisabled = function ( bool ) {\r\n\t\r\n\tif ( bool == null ) { // for automated propertyMethodMap to function, see DocumentManager#_backupattributes\r\n\t\tbool = false;\r\n\t}\r\n\t\r\n\tthis.isDisabled = bool;\r\n\t\r\n\tswitch ( bool ) {\r\n\t\tcase true :\r\n\t\t\tthis.bindingElement.setAttribute ( \"title\", \"\" );\r\n\t\t\tthis.setProperty ( \"isdisabled\", true );\r\n\t\t\tif ( this._stateManager != null ) {\r\n\t\t\t\tthis._stateManager.invokeDisabledState ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase false :\r\n\t\t\tthis.deleteProperty ( \"isdisabled\" );\r\n\t\t\tvar tooltip = this.getProperty ( \"tooltip\" );\r\n\t\t\tif ( tooltip ) {\r\n\t\t\t\tthis.setToolTip ( tooltip );\r\n\t\t\t}\r\n\t\t\tif ( this._stateManager != null ) {\r\n\t\t\t\tthis._stateManager.invokeNormalState ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tif ( this._isFocusableButton == true ) {\r\n\t\tthis.isFocusable = !this.isDisabled;\r\n\t\tthis.dispatchAction ( FocusBinding.ACTION_UPDATE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Disable button.\r\n */\r\nButtonBinding.prototype.disable = function () {\r\n\r\n\tthis.setDisabled ( true );\r\n}\r\n\r\n/**\r\n * Enable button.\r\n */\r\nButtonBinding.prototype.enable = function () {\r\n\r\n\tthis.setDisabled ( false );\r\n}\r\n\r\n/**\r\n * Focus.\r\n * @implements {IFocusable}\r\n */\r\nButtonBinding.prototype.focus = function () {\r\n\t\r\n\tif ( this.isFocusable && !this.isFocused ) {\r\n\t\tthis.isFocused = true;\r\n\t\tFocusBinding.focusElement ( this.bindingElement );\r\n\t\tthis.dispatchAction ( Binding.ACTION_FOCUSED );\r\n\t}\r\n}\r\n\r\n/**\r\n * Blur.\r\n * @implements {IFocusable}\r\n */\r\nButtonBinding.prototype.blur = function () {\r\n\t\r\n\tif ( this.isFocusable && this.isFocused ) {\r\n\t\tthis.isFocused = false;\r\n\t\tthis.dispatchAction ( Binding.ACTION_BLURRED );\r\n\t}\r\n}\r\n\r\n/**\r\n * Action on mouse down. Invoked by the ButtonStageManager.\r\n * @see {ButtonStateManager#handleEvent}\r\n */\r\nButtonBinding.prototype.onMouseDown = function () {\r\n\r\n\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN, this );\r\n\tthis.dispatchAction ( Binding.ACTION_ACTIVATED );\r\n}\r\n\r\n/**\r\n * Action on mouse up.\r\n * @see {ButtonStateManager#handleEvent}\r\n */\r\nButtonBinding.prototype.onMouseUp = function () {\r\n\r\n\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEUP, this );\r\n}\r\n\r\n/**\r\n * Get width. Actually, get width of the labelbinding. Used for equalsizing buttons. \r\n * Notice that this getter changes the layout, so we should ONLY use it for equalsizing!\r\n * @see {ToolBarBodyBinding#_enforceEqualSize}\r\n * @return {int}\r\n */\r\nButtonBinding.prototype.getEqualSizeWidth = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.isAttached == true ) {\r\n\t\tthis.labelBinding.shadowTree.labelBody.style.marginLeft = \"0\";\r\n\t\tthis.labelBinding.shadowTree.labelBody.style.marginRight = \"0\";\r\n\t\tresult = this.labelBinding.bindingElement.offsetWidth;\r\n\t} else {\r\n\t\tthrow \"ButtonBinding: getEqualSizeWidth failed for non-attached button.\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set width. Actually; in order to center labelbinding, this will \r\n * be computed around and applied as margins on the label. This method \r\n * should only be invoked while equalsizing buttons.\r\n * @see {ToolBarBodyBinding#_enforceEqualSize} \r\n * @param {int} goal\r\n */\r\nButtonBinding.prototype.setEqualSizeWidth = function ( goal ) {\r\n\t\r\n\tif ( this.isAttached == true ) {\r\n\t\tvar width = this.getEqualSizeWidth ();\r\n\t\tif ( goal > width ) {\r\n\t\t\tvar diff = goal - width;\r\n\t\t\tvar marg = Math.floor ( diff * 0.5 );\r\n\t\t\tthis.labelBinding.shadowTree.labelBody.style.setProperty(\"margin-left\", marg + \"px\", \"important\");\r\n\t\t\tthis.labelBinding.shadowTree.labelBody.style.setProperty(\"margin-right\", marg + \"px\", \"important\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get width.\r\n * @return {int} width\r\n */\r\nButtonBinding.prototype.getWidth = function () {\r\n\t\r\n\tvar result = null;\r\n\treturn this.bindingElement.offsetWidth;\r\n}\r\n\r\n/**\r\n * Set width (technically by adjusting the width of the center tablecell).\r\n * @param {int} width\r\n */\r\nButtonBinding.prototype.setWidth = function ( width ) {\r\n\t\r\n\r\n\tif (width >= 0) {\r\n\t\tthis.bindingElement.style.width = new String(width + \"px\");\r\n\t}\r\n\r\n\tthis.setProperty ( \"width\", width );\r\n}\r\n\r\n//IMPLEMENT IDATA..........................................\r\n\r\n/**\r\n * Validate.\r\n * @return {boolean}\r\n */\r\nButtonBinding.prototype.validate = function () {\r\n\t\r\n\treturn true; // hardcoded!\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n */\r\nButtonBinding.prototype.manifest = function () {}\r\n\r\n/**\r\n * Pollute dirty flag.\r\n */\r\nButtonBinding.prototype.dirty = DataBinding.prototype.dirty;\r\n\r\n/**\r\n * Clean dirty flag.\r\n */\r\nButtonBinding.prototype.clean = DataBinding.prototype.clean;\r\n\r\n/**\r\n * Get name.\r\n * @return {string}\r\n */\r\nButtonBinding.prototype.getName = function () {}\r\n\r\n/**\r\n * Get value. This is intended for serverside processing.\r\n * @return {string}\r\n */\r\nButtonBinding.prototype.getValue = function () {\r\n\t\r\n\treturn this.shadowTree.dotnetinput.value;\r\n}\r\n\r\n/**\r\n * Set value.\r\n * @param {string} value\r\n */\r\nButtonBinding.prototype.setValue = function ( value ) {\r\n\t\r\n\tthis.shadowTree.dotnetinput.value = value;\r\n}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @return {object}\r\n */\r\nButtonBinding.prototype.getResult = function () {\r\n\t\r\n\treturn this.getValue ();\r\n}\r\n\r\n/**\r\n * Set result.\r\n * @see {DataManager#populateDataBindings}\r\n * @param {object} result\r\n */\r\nButtonBinding.prototype.setResult = function ( result ) {\r\n\t\r\n\tthis.setValue ( result );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/ButtonStateManager.js",
    "content": "ButtonStateManager.STATE_NORMAL\t= 0;\r\nButtonStateManager.STATE_HOVER\t= 1;\r\nButtonStateManager.STATE_ACTIVE\t= 2;\r\nButtonStateManager.RIGHT_BUTTON = 2;\r\n\r\n/**\r\n * @class\r\n * Better externalize this complex stuff from the ButtonBinding.\r\n * @param {ButtonBinding} binding\r\n */\r\nfunction ButtonStateManager ( binding ) {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ButtonStateManager\" );\r\n\t\r\n\t/**\r\n\t * @type {ButtonBinding}\r\n\t */\r\n\tthis.binding = binding;\r\n\t\r\n\t/**\r\n\t * @type {ImageProfile}\r\n\t */\r\n\tthis.imageProfile = binding.imageProfile;\r\n\r\n\t/* \r\n\t * Assigning event listener.\r\n\t */\r\n\tthis.assignDOMEvents(true);\r\n\r\n\t/*\r\n\t* Returnable.\r\n\t*/\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Assigning DOM event listeners.\r\n */\r\nButtonStateManager.prototype.assignDOMEvents = function ( isAssign ) {\r\n\t\r\n\tvar action = isAssign ? \"addEventListener\" : \"removeEventListener\";\r\n\t\r\n\tthis.binding [ action ] ( DOMEvents.MOUSEENTER, this );\r\n\tthis.binding [ action ] ( DOMEvents.MOUSELEAVE, this );\r\n\tthis.binding [ action ] ( DOMEvents.MOUSEDOWN, this );\r\n\tthis.binding [ action ] ( DOMEvents.MOUSEUP, this );\r\n}\r\n\r\n/**\r\n * Cleanup.\r\n * @see {ButtonBinding#onBindingDispose}\r\n */\r\nButtonStateManager.prototype.dispose = function () {\r\n\t\r\n\tthis.assignDOMEvents ( false );\r\n\tthis.binding = null;\r\n\tthis.imageProfile = null;\r\n}\r\n\r\n/** \r\n * TODO: Split into multiple methods.\r\n * @mplements {IEventListener}.\r\n * @param {MouseEvent} e\r\n */\r\nButtonStateManager.prototype.handleEvent = function (e) {\r\n\r\n\tif (Binding.exists(this.binding) && !this.binding.isDisabled && !BindingDragger.isDragging) {\r\n\r\n\t\tvar isCommand = false, isPopup = false, state = null;\r\n\r\n\t\tif (e.button == ButtonStateManager.RIGHT_BUTTON) {\r\n\t\t\t// do nothing - right clicks are handled by the contextmenu property\r\n\t\t}\r\n\t\telse if (this.binding.isCheckBox) {\r\n\r\n\t\t\tswitch (e.type) {\r\n\t\t\t\tcase DOMEvents.MOUSEENTER:\r\n\t\t\t\tcase DOMEvents.MOUSEOVER:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_HOVER; // image decision left to imageprofile!\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSELEAVE:\r\n\t\t\t\tcase DOMEvents.MOUSEOUT:\r\n\t\t\t\t\tstate = this.binding.isChecked ? ButtonStateManager.STATE_ACTIVE : ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEDOWN:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_HOVER;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEUP:\r\n\t\t\t\t\tthis.binding.isChecked = !this.binding.isChecked;\r\n\t\t\t\t\tstate = this.binding.isChecked ? ButtonStateManager.STATE_ACTIVE : ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\tif (state == ButtonStateManager.STATE_ACTIVE) {\r\n\t\t\t\t\t\tthis.binding._check(true);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.binding._uncheck(true);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tisCommand = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (this.binding.isComboButton) {\r\n\t\t\tswitch (e.type) {\r\n\t\t\t\tcase DOMEvents.MOUSEENTER:\r\n\t\t\t\tcase DOMEvents.MOUSEOVER:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_HOVER;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSELEAVE:\r\n\t\t\t\tcase DOMEvents.MOUSEOUT:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEDOWN:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_ACTIVE;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEUP:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\tvar targetBinding = UserInterface.getBinding(e.target ? e.target : e.srcElement);\r\n\t\t\t\t\tif (targetBinding instanceof ComboBoxBinding) {\r\n\t\t\t\t\t\tthis.binding.isChecked = !this.binding.isChecked;\r\n\t\t\t\t\t\tstate = this.binding.isChecked ? ButtonStateManager.STATE_ACTIVE : ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\t\tif (state == ButtonStateManager.STATE_ACTIVE) {\r\n\t\t\t\t\t\t\tthis.binding._check(true);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.binding._uncheck(true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tisPopup = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tif (this.binding.isChecked)\r\n\t\t\t\t\t\t\tthis.binding._uncheck(true);\r\n\t\t\t\t\t\tstate = ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\t\tisCommand = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (this.binding.isCheckButton || this.binding.isRadioButton) {\r\n\r\n\t\t\tswitch (e.type) {\r\n\t\t\t\tcase DOMEvents.MOUSEENTER:\r\n\t\t\t\tcase DOMEvents.MOUSEOVER:\r\n\t\t\t\t\tif (!this.binding.isChecked) {\r\n\t\t\t\t\t\tstate = ButtonStateManager.STATE_HOVER;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSELEAVE:\r\n\t\t\t\tcase DOMEvents.MOUSEOUT:\r\n\t\t\t\t\tif (!this.binding.isChecked) { // TODO: CHECK DESCENDANT TARGET!\r\n\t\t\t\t\t\tstate = ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEDOWN:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_ACTIVE;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEUP:\r\n\t\t\t\t\tif (this.binding.isCheckButton || !this.binding.isChecked) {\r\n\t\t\t\t\t\tthis.binding.isChecked = !this.binding.isChecked;\r\n\t\t\t\t\t\tstate = this.binding.isChecked ? ButtonStateManager.STATE_ACTIVE : ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\t\tif (state == ButtonStateManager.STATE_ACTIVE) {\r\n\t\t\t\t\t\t\tthis.binding._check(true);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.binding._uncheck(true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tisCommand = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tswitch (e.type) {\r\n\t\t\t\tcase DOMEvents.MOUSEENTER:\r\n\t\t\t\tcase DOMEvents.MOUSEOVER:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_HOVER;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSELEAVE:\r\n\t\t\t\tcase DOMEvents.MOUSEOUT:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEDOWN:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_ACTIVE;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEUP:\r\n\t\t\t\t\tstate = ButtonStateManager.STATE_NORMAL;\r\n\t\t\t\t\tisCommand = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tswitch (state) {\r\n\t\t\tcase ButtonStateManager.STATE_NORMAL:\r\n\t\t\t\tthis.invokeNormalState();\r\n\t\t\t\tbreak;\r\n\t\t\tcase ButtonStateManager.STATE_HOVER:\r\n\t\t\t\tthis.invokeHoverState();\r\n\t\t\t\tbreak;\r\n\t\t\tcase ButtonStateManager.STATE_ACTIVE:\r\n\t\t\t\tthis.invokeActiveState();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* Please note that the button command is invoked here!\r\n\t\t*/\r\n\t\tif (isCommand) {\r\n\t\t\tthis.binding.fireCommand();\r\n\t\t}\r\n\r\n\t\tif (isPopup) {\r\n\t\t\tthis.binding.invokePopup();\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* Check patches explorer in case fireCommand \r\n\t\t* closed the containing window.\r\n\t\t*/\r\n\t\tif (Binding.exists(this.binding) == true) {\r\n\r\n\t\t\t/*\r\n\t\t\t* Consuming the event!\r\n\t\t\t*/\r\n\t\t\tDOMEvents.stopPropagation(e);\r\n\r\n\t\t\t/*\r\n\t\t\t* Broadcast mousedown and mouseup to close open popups and menupopups. \r\n\t\t\t* Notice that our binding is broadcasted as argument. This will prevent \r\n\t\t\t* popups associated to *our* binding from closing as soon as it opens. \r\n\t\t\t* The broadcast argument should really be a MouseEvent, so this is \r\n\t\t\t* really a terrible way to handle the popup display status problem. \r\n\t\t\t* UPDATE: we now use Bindings as arguments in other scenarios.\r\n\t\t\t* @see {PopupBinding#handleBroadcast}\r\n\t\t\t*/\r\n\t\t\tswitch (e.type) {\r\n\t\t\t\tcase DOMEvents.MOUSEDOWN:\r\n\t\t\t\t\tthis.binding.onMouseDown();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEUP:\r\n\t\t\t\t\tthis.binding.onMouseUp();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoke normal state.\r\n */\r\nButtonStateManager.prototype.invokeNormalState = function () {\r\n\r\n\tthis.binding.detachClassName ( \"hover\" );\r\n\tthis.binding.detachClassName ( \"active\" );\r\n\tthis.binding.detachClassName ( \"isdisabled\" );\r\n}\r\n\r\n/**\r\n * Invoke hover state.\r\n */\r\nButtonStateManager.prototype.invokeHoverState = function () {\r\n\r\n\tthis.binding.attachClassName ( \"hover\" );\r\n\tthis.binding.detachClassName ( \"active\" );\r\n}\r\n\r\n/**\r\n * Invoke active state.\r\n */\r\nButtonStateManager.prototype.invokeActiveState = function () {\r\n\r\n\tthis.binding.attachClassName ( \"active\" );\r\n\tthis.binding.detachClassName ( \"hover\" );\r\n}\r\n\r\n/**\r\n * Invoke disabled state. This method gets invoked by the button.\r\n * @see {ButtonBinding#setDisabled}\r\n */\r\nButtonStateManager.prototype.invokeDisabledState = function () {\r\n\r\n\tthis.binding.detachClassName ( \"hover\" );\r\n\tthis.binding.detachClassName ( \"active\" );\r\n\tthis.binding.attachClassName ( \"isdisabled\" );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/checkbutton/CheckButtonBinding.js",
    "content": "CheckButtonBinding.prototype = new ButtonBinding;\r\nCheckButtonBinding.prototype.constructor = CheckButtonBinding;\r\nCheckButtonBinding.superclass = ButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction CheckButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"CheckButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * @overwrites {ButtonBinding#isCheckButton}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isCheckButton = true;\r\n\t\r\n\t/**\r\n\t * Invoke hover state onmouseover even when checked.\r\n\t * @overwrites {ButtonBinding#isCheckBox}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isCheckBox = true;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCheckButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[CheckButtonBinding]\";\r\n}\r\n\r\n/**\r\n * CheckButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {CheckButtonBinding}\r\n */\r\nCheckButtonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:checkbutton\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, CheckButtonBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/clickbutton/ClickButtonBinding.js",
    "content": "ClickButtonBinding.prototype = new ButtonBinding;\r\nClickButtonBinding.prototype.constructor = ClickButtonBinding;\r\nClickButtonBinding.superclass = ButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ClickButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ClickButtonBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nClickButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ClickButtonBinding]\";\r\n}\r\n\r\n/**\r\n * ClickButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ClickButtonBinding}\r\n */\r\nClickButtonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:clickbutton\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, ClickButtonBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/combobutton/ComboBoxBinding.js",
    "content": "﻿ComboBoxBinding.prototype = new Binding;\r\nComboBoxBinding.prototype.constructor = ComboBoxBinding;\r\nComboBoxBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n* @class\r\n* Here's a weird binding that will replace itself with a text node!\r\n*/\r\nfunction ComboBoxBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"ComboBoxBinding\");\r\n\r\n\t/*\r\n\t* Returnable.\r\n\t*/\r\n\treturn this;\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nComboBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ComboBoxBinding]\";\r\n}\r\n\r\n/**\r\n* ComboBoxBinding factory.\r\n* @param {DOMDocument} ownerDocument\r\n* @return {ComboBoxBinding}\r\n*/\r\nComboBoxBinding.newInstance = function (ownerDocument) {\r\n\r\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:combobox\", ownerDocument);\r\n\treturn UserInterface.registerBinding(element, ComboBoxBinding);\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/combobutton/SelectorButtonBinding.js",
    "content": "﻿SelectorButtonBinding.prototype = new SelectorBinding;\nSelectorButtonBinding.prototype.constructor = SelectorButtonBinding;\nSelectorButtonBinding.superclass = SelectorBinding.prototype;\n\n/**\n* @class\n*/\nfunction SelectorButtonBinding() {\n\n\t/**\n\t* @type {SystemLogger}\n\t*/\n\tthis.logger = SystemLogger.getLogger(\"SelectorButtonBinding\");\n\n\tthis.isSingle = false;\n\n\tthis.singleValue = null;\n\n\t/*\n\t* Returnable.\n\t*/\n\treturn this;\n}\n\n/**\n* Identifies binding.\n*/\nSelectorButtonBinding.prototype.toString = function () {\n\n\treturn \"[SelectorButtonBinding]\";\n}\n\n/**\n* @overloads {ToolBarButtonBinding#onBindingAttach}\n*/\nSelectorButtonBinding.prototype.onBindingAttach = function () {\n\n\tSelectorButtonBinding.superclass.onBindingAttach.call(this);\n\n\tthis.isSearchSelectionEnabled = false;\n};\n\n/**\n* @overloads {SelectorBinding#handleBroadcast}\n* @param {string} broadcast\n* @param {object} arg\n*/\nSelectorButtonBinding.prototype.handleBroadcast = function (broadcast, arg) {\n\n\tSelectorButtonBinding.superclass.handleBroadcast.call(this, broadcast, arg);\n}\n\n\n/**\n * @implements {IActionListener}\n * @overloads {Binding#handleAction}\n * @param {Action} action\n */\nSelectorButtonBinding.prototype.handleAction = function (action) {\n\n\tif (action.type === ButtonBinding.ACTION_COMMAND && this.isSingle) {\n\t\tthis._selectionValue = this.singleValue;\n\t\tthis.onValueChange();\n\t} else {\n\t\tSelectorButtonBinding.superclass.handleAction.call(this, action);\n\t}\n}\n\nSelectorButtonBinding.prototype.dirty = function () { }\n\n\nSelectorButtonBinding.prototype.populateFromList = function (list) {\n\n\tvar singleunselected = null;\n\tlist.each(function (item) {\n\t\tif (!item.isSelected ) {\n\t\t\tif (singleunselected == null) {\n\t\t\t\tsingleunselected = item;\n\t\t\t} else {\n\t\t\t\tsingleunselected = null;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}, this);\n\n\tif (singleunselected != null) {\n\t\tthis.isSingle = true;\n\t\tthis._buttonBinding.setLabel(singleunselected.label);\n\t\tthis.singleValue = singleunselected.value;\n\n\t\tthis._buttonBinding.setPopup();\n\t\tthis.setProperty(\"single\", true);\n\t} else {\n\t\tthis.isSingle = false;\n\t\tthis._buttonBinding.setPopup(this._popupBinding);\n\t\tthis.deleteProperty(\"single\");\n\t\tSelectorButtonBinding.superclass.populateFromList.call(this, list);\n\t}\n}\n\nSelectorButtonBinding.prototype.clear = function (isClearAll) {\n\n\tSelectorButtonBinding.superclass.clear.call(this, isClearAll);\n\tthis.isSingle = false;\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/combobutton/ToolBarComboButtonBinding.js",
    "content": "﻿ToolBarComboButtonBinding.prototype = new ToolBarButtonBinding;\r\nToolBarComboButtonBinding.prototype.constructor = ToolBarComboButtonBinding;\r\nToolBarComboButtonBinding.superclass = ToolBarButtonBinding.prototype;\r\n\r\nToolBarComboButtonBinding.CLASSNAME_COMBOBUTTON = \"combobutton\";\r\nToolBarComboButtonBinding.STORAGE_PREFFIX = \"STORAGEBUTTONHANDLE\";\r\n\r\n/**\r\n* @class\r\n*/\r\nfunction ToolBarComboButtonBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"ToolBarComboButtonBinding\");\r\n\r\n\r\n\t/**\r\n\t* @overwrites {ButtonBinding#isComboButton}\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis.isComboButton = true;\r\n\r\n\t/**\r\n\t* @overwrites {ButtonBinding#isCheckButton}\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis.isCheckButton = true;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.keepState = true;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasPopupItems = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.alignWidth = false;\r\n\r\n\t/*\r\n\t* Returnable.\r\n\t*/\r\n\treturn this;\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nToolBarComboButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ToolBarComboButtonBinding]\";\r\n}\r\n\r\n/**\r\n* @overloads {ToolBarButtonBinding#onBindingAttach}\r\n*/\r\nToolBarComboButtonBinding.prototype.onBindingAttach = function () {\r\n\r\n\tToolBarComboButtonBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tthis.buildCombobox();\r\n\r\n\tthis.attachClassName(ToolBarComboButtonBinding.CLASSNAME_COMBOBUTTON);\r\n\r\n\tthis.keepState = this.getProperty(\"keepstate\") !== false;\r\n};\r\n\r\n/**\r\n* Build popup when perspective changes. If no\r\n* views are associated, the button will disable.\r\n* @overloads {ToolBarButtonBinding#handleBroadcast}\r\n* @param {string} broadcast\r\n* @param {object} arg\r\n*/\r\nToolBarComboButtonBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tToolBarComboButtonBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n}\r\n\r\n/**\r\n* @overloads {ToolBarButtonBinding#setPopup}\r\n* @param {object} arg This can be either a string or a {@link PopupBinding}.\r\n*/\r\nToolBarComboButtonBinding.prototype.setPopup = function (arg) {\r\n\r\n\tToolBarComboButtonBinding.superclass.setPopup.call(this, arg);\r\n\r\n\tvar self = this;\r\n\tvar menuItemBindings = this.popupBinding.getDescendantBindingsByType(MenuItemBinding);\r\n\tmenuItemBindings.each(\r\n\t\tfunction (menuItemBinding) {\r\n\t\t\tvar hiddenCommand = menuItemBinding.getProperty(\"oncommand\");\r\n\t\t\tmenuItemBinding.setProperty(\"hiddencommand\", hiddenCommand);\r\n\t\t\tmenuItemBinding.deleteProperty(\"oncommand\");\r\n\t\t\tmenuItemBinding.oncommand = function () {\r\n\t\t\t\tself.setAndFireButton(this);\r\n\t\t\t};\r\n\t\t}, this\r\n\t);\r\n\tvar latestMenuItemBinding = null;\r\n\tif (this.keepState) {\r\n\t\tvar latestMenuItemHandle = this.getActiveMenuHandle();\r\n\r\n\t\tmenuItemBindings.each(function (menuItemBinding) {\r\n\t\t\tif (this.getMenuHandle(menuItemBinding) === latestMenuItemHandle && !menuItemBinding.isDisabled) {\r\n\t\t\t\tlatestMenuItemBinding = menuItemBinding;\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}, this);\r\n\t}\r\n\r\n\tif (latestMenuItemBinding == null) {\r\n\t\tmenuItemBindings.each(function (menuItemBinding) {\r\n\t\t\tif (!menuItemBinding.isDisabled) {\r\n\t\t\t\tlatestMenuItemBinding = menuItemBinding;\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}, this);\r\n\t}\r\n\r\n\tif (latestMenuItemBinding != null)\r\n\t\tthis.setButton(latestMenuItemBinding);\r\n\r\n\tthis.updateCombobox(menuItemBindings.getLength() > 1);\r\n}\r\n\r\n\r\nToolBarComboButtonBinding.prototype.buildCombobox = function () {\r\n\r\n\tif (!this.comboBoxBinding) {\r\n\t\tthis.comboBoxBinding = ComboBoxBinding.newInstance(this.bindingDocument);\r\n\t\tthis.add(this.comboBoxBinding);\r\n\t\tthis.comboBoxBinding.attach();\r\n\t\tthis.updateCombobox();\r\n\t}\r\n}\r\n\r\nToolBarComboButtonBinding.prototype.updateCombobox = function (hasPopupItems) {\r\n\r\n\tif (hasPopupItems != undefined) {\r\n\t\tthis.hasPopupItems = hasPopupItems;\r\n\t}\r\n\r\n\tif (this.comboBoxBinding) {\r\n\t\tif (this.hasPopupItems) {\r\n\t\t\tthis.comboBoxBinding.show();\r\n\t\t} else {\r\n\t\t\tthis.comboBoxBinding.hide();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n* Set and Fire Commmand from MenuItem\r\n* @param {MenuItemBinding} menuitem\r\n*/\r\nToolBarComboButtonBinding.prototype.setButton = function (menuitem) {\r\n\r\n\tif (menuitem instanceof MenuItemBinding) {\r\n\t\tvar label = menuitem.getProperty(\"label\");\r\n\t\tvar image = menuitem.getProperty(\"image\");\r\n\t\tvar hiddenCommand = menuitem.getProperty(\"hiddencommand\");\r\n\r\n\t\tthis.setLabel(label ? label : \"\");\r\n\r\n\t\tthis.setImage(image);\r\n\t\tif (!this.isDisabled && menuitem.isDisabled) {\r\n\t\t\tthis.setDisabled(true);\r\n\t\t} else if (this.isDisabled && !menuitem.isDisabled) {\r\n\t\t\tthis.setDisabled(false);\r\n\t\t}\r\n\r\n\t\tif (menuitem.associatedSystemAction) {\r\n\t\t\tthis.associatedSystemAction = menuitem.associatedSystemAction;\r\n\t\t}\r\n\r\n\t\tthis.oncommand = function () {\r\n\t\t\tBinding.evaluate(hiddenCommand, this);\r\n\t\t};\r\n\r\n\t\tthis.hideActiveItem(menuitem);\r\n\t}\r\n}\r\n\r\nToolBarComboButtonBinding.prototype.getAssociatedSystemActions = function () {\r\n\r\n\tvar result = new List();\r\n\r\n\tthis.popupBinding.getDescendantBindingsByType(MenuItemBinding).each(function(menuitem) {\r\n\t\tif (menuitem.associatedSystemAction) {\r\n\t\t\tresult.add(menuitem.associatedSystemAction);\r\n\t\t}\r\n\t});\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n* Set and Fire Commmand from MenuItem\r\n* @param {MenuItemBinding} menuitem\r\n*/\r\nToolBarComboButtonBinding.prototype.setAndFireButton = function (menuitem) {\r\n\r\n\tif (menuitem instanceof MenuItemBinding) {\r\n\t\tif (this.keepState) {\r\n\t\t\tthis.setButton(menuitem);\r\n\t\t\tthis.saveActiveMenuHandle(this.getMenuHandle(menuitem));\r\n\t\t\tthis.fireCommand();\r\n\t\t} else {\r\n\t\t\tthis.dispatchAction( new Action (menuitem, this.commandAction));\r\n\t\t}\r\n\r\n\t}\r\n}\r\n\r\n/**\r\n* Set and Fire Commmand from MenuItem\r\n* @param {MenuItemBinding} menuitem\r\n*/\r\nToolBarComboButtonBinding.prototype.hideActiveItem = function (activeMenuitem) {\r\n\r\n\tthis.popupBinding.getDescendantBindingsByType(MenuItemBinding).each(\r\n\t\tfunction (menuitem) {\r\n\t\t\tif (menuitem === activeMenuitem) {\r\n\t\t\t\tBinding.prototype.hide.call(menuitem);\r\n\t\t\t} else {\r\n\t\t\t\tBinding.prototype.show.call(menuitem);\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n}\r\n\r\n/**\r\n* Set active menuitem handle\r\n* @param {MenuItemBinding} menuitem id\r\n*/\r\nToolBarComboButtonBinding.prototype.saveActiveMenuHandle = function (handle) {\r\n\r\n\tLocalStorage.set(ToolBarComboButtonBinding.STORAGE_PREFFIX + this.getBundleName(), handle);\r\n}\r\n\r\n/**\r\n* Get active menuitem handle\r\n*/\r\nToolBarComboButtonBinding.prototype.getActiveMenuHandle = function () {\r\n\r\n\treturn LocalStorage.get(ToolBarComboButtonBinding.STORAGE_PREFFIX + this.getBundleName());\r\n}\r\n\r\nToolBarComboButtonBinding.prototype.getMenuHandle = function (menuitem) {\r\n\r\n\treturn menuitem.menuHandle ? menuitem.menuHandle : menuitem.getProperty(\"id\");\r\n}\r\n\r\nToolBarComboButtonBinding.prototype.getBundleName = function () {\r\n\r\n\treturn this.getProperty(\"bundle\") ? this.getProperty(\"bundle\") : this.getProperty(\"id\");\r\n}\r\n\r\n/**\r\n * ToolBarButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ToolBarButtonBinding}\r\n */\r\nToolBarComboButtonBinding.newInstance = function (ownerDocument) {\r\n\r\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:toolbarbutton\", ownerDocument);\r\n\treturn UserInterface.registerBinding(element, ToolBarComboButtonBinding);\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/radiobutton/RadioButtonBinding.js",
    "content": "RadioButtonBinding.prototype = new ButtonBinding;\r\nRadioButtonBinding.prototype.constructor = RadioButtonBinding;\r\nRadioButtonBinding.superclass = ButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction RadioButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"RadioButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * @overwrites {ButtonBinding#isRadioButton}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRadioButton = true;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nRadioButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[RadioButtonBinding]\";\r\n}\r\n\r\n/**\r\n * RadioButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {RadioButtonBinding}\r\n */\r\nRadioButtonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:radiobutton\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, RadioButtonBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/radiobutton/RadioGroupBinding.js",
    "content": "RadioGroupBinding.prototype = new Binding;\r\nRadioGroupBinding.prototype.constructor = RadioGroupBinding;\r\nRadioGroupBinding.superclass = Binding.prototype;\r\nRadioGroupBinding.ACTION_SELECTIONCHANGED = \"radiogroupselectionchanged\";\r\n\r\n/**\r\n * @class\r\n * Manages checked radiobuttons within descendant element scope.\r\n */\r\nfunction RadioGroupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"RadioGroupBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {Binding}\r\n\t */\r\n\tthis._checkedRadioBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {List<ButtonBinding>}\r\n\t */\r\n\tthis._radioButtonBindings = null;\r\n\t\r\n\t/**\r\n\t * Flipped when new radiobutton is added.\r\n\t * @see {ButtonBinding#onBindingAttach}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isUpToDate = false;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nRadioGroupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[RadioGroupBinding]\";\r\n}\r\n\r\n/** \r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nRadioGroupBinding.prototype.onBindingRegister = function () {\r\n\r\n\tRadioGroupBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.addActionListener ( ButtonBinding.ACTION_RADIOBUTTON_ATTACHED, this );\r\n\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND, this );\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingInitialize}\r\n */\r\nRadioGroupBinding.prototype.onBindingInitialize = function () {\r\n\r\n\tvar checkedRadioBinding = null;\r\n\tthis._getRadioButtonBindings ().each ( function ( binding ) {\r\n\t\tif ( binding.getProperty ( \"ischecked\" )) {\r\n\t\t\tcheckedRadioBinding = binding;\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t});\r\n\tif ( checkedRadioBinding ) {\r\n\t\tthis._checkedRadioBinding = checkedRadioBinding;\r\n\t}\r\n\t\r\n\tRadioGroupBinding.superclass.onBindingInitialize.call ( this );\r\n}\r\n\r\n/** \r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nRadioGroupBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tRadioGroupBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\t\r\n\t\tcase ButtonBinding.ACTION_RADIOBUTTON_ATTACHED :\r\n\t\t\tthis._isUpToDate = false;\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\tif ( binding.isRadioButton && !binding.isDisabled ) {\r\n\t\t\t\tif ( this._checkedRadioBinding ) {\r\n\t\t\t\t\tthis._unCheckRadioBindingsExcept ( binding );\r\n\t\t\t\t}\r\n\t\t\t\tthis._checkedRadioBinding = binding;\r\n\t\t\t\tthis.dispatchAction ( RadioGroupBinding.ACTION_SELECTIONCHANGED );\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Sorry - you have to place your listener on the radiogroup!\r\n\t\t\t\t */\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set checked button.\r\n * @param {ButtonBinding} binding\r\n * @param {boolean} isDisableCommand\r\n */\r\nRadioGroupBinding.prototype.setCheckedButtonBinding = function ( binding, isDisableCommand ) {\r\n\t\r\n\tif ( binding instanceof RadioDataBinding ) { // not really supposed to go on here!\r\n\t\tbinding = binding.getButton ();\r\n\t}\r\n\t\r\n\tif ( binding.isRadioButton ) {\r\n\t\tswitch ( isDisableCommand ) {\r\n\t\t\tcase true :\r\n\t\t\t\tthis._unCheckRadioBindingsExcept ( binding );\r\n\t\t\t\tthis._checkedRadioBinding = binding;\r\n\t\t\t\tbinding.check ( true );\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tbinding.check ();\r\n\t\t\t\tbreak;\r\n\t\t}\t\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Get checked button.\r\n * @return {ButtonBinding}\r\n */\r\nRadioGroupBinding.prototype.getCheckedButtonBinding = function () {\r\n\t\r\n\treturn this._checkedRadioBinding;\r\n}\r\n\r\n/**\r\n * Uncheck descendant radiobutton execept the one supplied as argument.\r\n * @param (Binding} selectedBinding\r\n * @private\r\n */\r\nRadioGroupBinding.prototype._unCheckRadioBindingsExcept = function ( selectedBinding ) {\r\n\t \r\n\tvar radioButtons = this._getRadioButtonBindings ();\r\n\tradioButtons.each ( function ( binding ) {\r\n\t\tif ( binding.isChecked && binding != selectedBinding ) {\r\n\t\t\tbinding.uncheck ( true );\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * @return {List<ButtonBinding>}\r\n */\r\nRadioGroupBinding.prototype._getRadioButtonBindings = function () {\r\n\t\r\n\tif ( this._radioButtonBindings === null || !this._isUpToDate ) {\r\n\t\t\r\n\t\tvar crawler = new Crawler ();\r\n\t\tvar list = new List ();\r\n\t\t\r\n\t\tcrawler.addFilter ( function ( element ) {\r\n\t\t\t\r\n\t\t\tvar result = true;\r\n\t\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\tif ( binding instanceof RadioGroupBinding ) {\r\n\t\t\t\tresult = NodeCrawler.SKIP_CHILDREN;\r\n\t\t\t} else {\r\n\t\t\t\tif ( binding instanceof ButtonBinding && binding.isRadioButton ) {\r\n\t\t\t\t\tlist.add ( binding );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t});\r\n\t\t\r\n\t\tcrawler.crawl ( this.bindingElement );\r\n\t\tthis._radioButtonBindings = list;\r\n\t\t\r\n\t\t/*\r\n\t\tvar result = new List ();\r\n\t\tvar descendants = this.getDescendantBindingsByLocalName ( \"*\" );\r\n\t\tdescendants.each ( function ( binding ) {\r\n\t\t\tif ( binding instanceof ButtonBinding && binding.isRadioButton ) {\r\n\t\t\t\tresult.add ( binding );\r\n\t\t\t}\r\n\t\t});\r\n\t\tthis._radioButtonBindings = result;\r\n\t\t*/\r\n\t}\r\n\treturn this._radioButtonBindings;\r\n\r\n}\r\n\r\n/**\r\n * RadioGroupBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {RadioGroupBinding}\r\n */\r\nRadioGroupBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:radiogroup\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, RadioGroupBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/toolboxbutton/ToolBoxToolBarButtonBinding.js",
    "content": "ToolBoxToolBarButtonBinding.prototype = new ToolBarButtonBinding;\r\nToolBoxToolBarButtonBinding.prototype.constructor = ToolBoxToolBarButtonBinding;\r\nToolBoxToolBarButtonBinding.superclass = ToolBarButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ToolBoxToolBarButtonBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ToolBoxToolBarButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * Associates viewdefinitions to perspective tags. \r\n\t * @type {Map<string><List<<ViewDefinition>>}\r\n\t */\r\n\tthis._views = new Map ();\r\n\t\r\n\t/**\r\n\t * Avoid excessive popup building.\r\n\t * @type {string}\r\n\t */\r\n\tthis._lastGeneratedPerspective = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nToolBoxToolBarButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ToolBoxToolBarButtonBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {ButtonBinding#onBindingAttach}\r\n */\r\nToolBoxToolBarButtonBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tToolBoxToolBarButtonBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tif ( System.hasActivePerspectives ) {\r\n\t\r\n\t\tthis.subscribe ( BroadcastMessages.PERSPECTIVE_CHANGED );\r\n\t\t\r\n\t\t/**\r\n\t\t * Scan ViewDefinitions, indexing definitions associated  \r\n\t\t * to a perspective (by the \"perspective\" property no less).\r\n\t\t */\r\n\t\tvar views = this._views;\r\n\t\tfor ( var handle in ViewDefinitions ) {\r\n\t\t\tvar def = ViewDefinitions [ handle ];\r\n\t\t\tvar key = def.perspective; \r\n\t\t\tif ( key != null ) {\r\n\t\t\t\tif ( !views.has ( key )) {\r\n\t\t\t\t\tviews.set ( key, new List ());\r\n\t\t\t\t}\r\n\t\t\t\tvar list = views.get ( key );\r\n\t\t\t\tlist.add ( def );\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tthis.hide ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Build popup when perspective changes. If no \r\n * views are associated, the button will disable.\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nToolBoxToolBarButtonBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tToolBoxToolBarButtonBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tswitch (broadcast) {\r\n\t\tcase BroadcastMessages.PERSPECTIVE_CHANGED:\r\n\t\t\tvar tag = arg;\r\n\t\t\t//\r\n\r\n\t\t\tif (tag != this._lastGeneratedPerspective) {\r\n\r\n\t\t\t\tthis._lastGeneratedPerspective = tag;\r\n\r\n\t\t\t\tvar popup = this.bindingWindow.bindingMap.toolboxpopupgroup;\r\n\t\t\t\tpopup.empty();\r\n\r\n\t\t\t\tif (this._views.has(tag)) {\r\n\t\t\t\t\tvar list = this._views.get(tag);\r\n\t\t\t\t\tlist.each(function (def) {\r\n\t\t\t\t\t\tvar item = popup.add(StageViewMenuItemBinding.newInstance(popup.bindingDocument));\r\n\t\t\t\t\t\titem.setType(MenuItemBinding.TYPE_CHECKBOX);\r\n\t\t\t\t\t\titem.setHandle(def.handle);\r\n\t\t\t\t\t\titem.setLabel(def.label);\r\n\t\t\t\t\t\titem.setImage(def.image);\r\n\t\t\t\t\t\titem.setToolTip(def.toolTip);\r\n\t\t\t\t\t\titem.attach();\r\n\t\t\t\t\t});\r\n\t\t\t\t\tpopup.show();\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tpopup.hide();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/viewbutton/SlideInButtonBinding.js",
    "content": "﻿SlideInButtonBinding.prototype = new ToolBarButtonBinding;\nSlideInButtonBinding.prototype.constructor = SlideInButtonBinding;\nSlideInButtonBinding.superclass = ToolBarButtonBinding.prototype;\n\n\n\n/**\n* @class\n*/\nfunction SlideInButtonBinding() {\n\n\t/**\n\t* @type {SystemLogger}\n\t*/\n\tthis.logger = SystemLogger.getLogger(\"SlideInButtonBinding\");\n\n\n\n\t/*\n\t* Returnable.\n\t*/\n\treturn this;\n}\n\n/**\n* Identifies binding.\n*/\nSlideInButtonBinding.prototype.toString = function () {\n\n\treturn \"[SlideInButtonBinding]\";\n}\n\n/**\n* @overloads {ToolBarButtonBinding#onBindingAttach}\n*/\nSlideInButtonBinding.prototype.onBindingAttach = function () {\n\n\tSlideInButtonBinding.superclass.onBindingAttach.call(this);\n};\n\n/**\n* Build popup when perspective changes. If no\n* views are associated, the button will disable.\n* @overloads {ToolBarButtonBinding#handleBroadcast}\n* @param {string} broadcast\n* @param {object} arg\n*/\nSlideInButtonBinding.prototype.handleBroadcast = function (broadcast, arg) {\n\n\tSlideInButtonBinding.superclass.handleBroadcast.call(this, broadcast, arg);\n}\n\n\n/**\n * Open view when clicked.\n * @overwrites {ButtonBinding#oncommand}\n */\nSlideInButtonBinding.prototype.oncommand = function () {\n\n\tvar handle = this.getProperty(\"handle\");\n\tvar url = this.getProperty(\"url\");\n\tvar definition = null;\n\n\tif (handle != null) {\n\t\tdefinition = ViewDefinitions[handle];\n\t}\n\telse if (url != null) {\n\t\tdefinition = new HostedViewDefinition({\n\t\t\turl: url\n\t\t});\n\t}\n\n\tif (definition != null) {\n\t\tvar bodyBinding = UserInterface.getBinding(this.bindingDocument.body);\n\t\tthis._viewBinding = SlideInViewBinding.newInstance(this.bindingDocument);\n\t\tthis._viewBinding.setDefinition(definition);\n\t\tthis._viewBinding.attach();\n\t\tthis._viewBinding.snapToBinding(bodyBinding);\n\t}\n}\n\n/**\n * @overloads {ButtonBinding#setURL}\n * @param {string} url\n */\nSlideInButtonBinding.prototype.setURL = function (url) {\n\n\tthis.setProperty(\"url\", url);\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/buttons/viewbutton/ViewButtonBinding.js",
    "content": "ViewButtonBinding.prototype = new ButtonBinding;\r\nViewButtonBinding.prototype.constructor = ViewButtonBinding;\r\nViewButtonBinding.superclass = ButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * This buttons has been hardwired to openening a view. There is no \r\n * unique tagname involved, you simply specify the \"binding\" attribute.\r\n */\r\nfunction ViewButtonBinding () {\r\n\t\r\n\t/*\r\n\t * Returnable \r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding\r\n * @return {string}\r\n */\r\nViewButtonBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ViewButtonBinding]\";\r\n}\r\n\r\n/**\r\n * Open view when clicked.\r\n * @overwrites {ButtonBinding#oncommand}\r\n */\r\nViewButtonBinding.prototype.oncommand = function () {\r\n\t\r\n\talert ( this );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/controls/ControlBinding.js",
    "content": "ControlBinding.prototype = new ButtonBinding;\r\nControlBinding.prototype.constructor = ControlBinding;\r\nControlBinding.superclass = ButtonBinding.prototype;\r\n\r\nControlBinding.ACTION_COMMAND\t\t= \"controlcommand\";\r\nControlBinding.TYPE_MINIMIZE \t\t= \"minimize\";\r\nControlBinding.TYPE_MAXIMIZE \t\t= \"maximize\";\r\nControlBinding.TYPE_UNMAXIMIZE \t\t= \"unmaximize\";\r\nControlBinding.TYPE_UNMINIMIZE \t\t= \"unminimize\";\r\nControlBinding.TYPE_CLOSE \t\t\t= \"close\";\r\n\r\nControlBinding.TOOLTIP = {\r\n\t\"minimize\"\t\t: \"${string:Website.App.ToolTipMinimize}\",\r\n\t\"maximize\" \t\t: \"${string:Website.App.ToolTipMaximize}\",\r\n\t\"unmaximize\" \t: \"${string:Website.App.ToolTipUnMaximize}\",\r\n\t\"unminimize\" \t: \"${string:Website.App.ToolTipUnMinimize}\",\r\n\t\"close\" \t\t: \"${string:Website.App.ToolTipClose}\"\r\n};\r\n\r\n/**\r\n * @class\r\n * The ControlBinding is a simple button-type binding  \r\n * specific for controlling panel behavior.\r\n */\r\nfunction ControlBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ControlBinding\" );\r\n\t\r\n\t/**\r\n\t * Carefully named not to conflict with regular ButtonBinding type property.\r\n\t * @type {string}\r\n\t */\r\n\tthis.controlType = null;\r\n\t\r\n\t/**\r\n\t * Overwrites super property to dispatch an unique command type.\r\n\t * @type {string}\r\n\t */\r\n\tthis.commandAction = ControlBinding.ACTION_COMMAND;\r\n\t\r\n\t/**\r\n\t * @type {ControlBoxBinding}\r\n\t */\r\n\tthis.containingControlBoxBinding = null;\r\n\t\r\n\t/** \r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isGhostable = false;\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ DocumentCrawler.ID, FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nControlBinding.prototype.toString = function () { \r\n\r\n\treturn \"[ControlBinding]\";\r\n}\r\n\r\n/**\r\n * Note that we assign a hardcoded image profile to the control instance. That's \r\n * because IE6.0 cannot handle both alphatransparency and background positioning.\r\n */\r\nControlBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tthis.controlType = this.getProperty ( \"controltype\" );\r\n\tthis.setProperty ( \"tooltip\", ControlBinding.TOOLTIP [ this.controlType ]);\r\n\t\r\n\tif ( !this.isAttached ) {\r\n\t\tif ( this.controlType ) {\r\n\t\t\tthis.containingControlBoxBinding = this.getAncestorBindingByType ( \r\n\t\t\t\tControlBoxBinding \r\n\t\t\t);\r\n\t\t\tif ( this.containingControlBoxBinding ) {\r\n\t\t\t\tthis.containingControlBoxBinding.addActionListener ( \r\n\t\t\t\t\tControlBoxBinding.ACTION_STATECHANGE, this \r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tControlBinding.superclass.onBindingAttach.call ( this );\r\n\t\t\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\t\r\n\t\t} else {\r\n\t\t\tthrow \"ControlBinding: type not specified.\";\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Makes it possible to close the controlbox without activating it.\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nControlBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tControlBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set control type. This changes whenever \r\n * the control is handled.\r\n * @param {string} type\r\n */\r\nControlBinding.prototype.setControlType = function ( type ) {\r\n\r\n\tthis.controlType = type;\r\n\tthis.setProperty ( \"controltype\", type );\r\n\tthis.setToolTip ( ControlBinding.TOOLTIP [ type ]);\r\n}\r\n\r\n/**\r\n * Intercepts panel state change and updates control type accordingly.\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nControlBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tControlBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase ControlBoxBinding.ACTION_STATECHANGE :\r\n\t\t\tthis._handleStateChange ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/** \r\n * Handle state change.\r\n */\r\nControlBinding.prototype._handleStateChange = function () {\r\n\t\r\n\tswitch ( this.containingControlBoxBinding.getState ()) {\r\n\t\tcase ControlBoxBinding.STATE_MAXIMIZED :\r\n\t\t\tif ( this.controlType == ControlBinding.TYPE_MAXIMIZE ) {\r\n\t\t\t\tthis.setControlType ( ControlBinding.TYPE_UNMAXIMIZE );\r\n\t\t\t}\r\n\t\t\tif ( this.controlType == ControlBinding.TYPE_UNMINIMIZE ) {\r\n\t\t\t\tthis.setControlType ( ControlBinding.TYPE_MINIMIZE );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase ControlBoxBinding.STATE_MINIMIZED :\r\n\t\t\tif ( this.controlType == ControlBinding.TYPE_MINIMIZE ) {\r\n\t\t\t\tthis.setControlType ( ControlBinding.TYPE_UNMINIMIZE );\r\n\t\t\t}\r\n\t\t\tif ( this.controlType == ControlBinding.TYPE_UNMAXIMIZE ) {\r\n\t\t\t\tthis.setControlType ( ControlBinding.TYPE_MAXIMIZE );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase ControlBoxBinding.STATE_NORMAL :\r\n\t\t\tif ( this.controlType == ControlBinding.TYPE_UNMAXIMIZE ) {\r\n\t\t\t\tthis.setControlType ( ControlBinding.TYPE_MAXIMIZE );\r\n\t\t\t}\r\n\t\t\tif ( this.controlType == ControlBinding.TYPE_UNMINIMIZE ) {\r\n\t\t\t\tthis.setControlType ( ControlBinding.TYPE_MINIMIZE );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Unlike other bindings, handling the control should not \r\n * activate docks or close open selectboxes and stuff. This \r\n * method is invoked by the ButtonStageManager.\r\n * @see {ButtonStateManager#handleEvent}\r\n * @overwrites {Button#onMouseDown}\r\n */\r\nControlBinding.prototype.onMouseDown = function () {\r\n\r\n\t// do nothing\r\n}\r\n\r\n/**\r\n * No action on mouse up.\r\n * @see {ButtonStateManager#handleEvent}\r\n * @overwrites {Button#onMouseDown}\r\n */\r\nControlBinding.prototype.onMouseUp = function () {\r\n\r\n\t// do nothing\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/controls/ControlBoxBinding.js",
    "content": "ControlBoxBinding.prototype = new FlexBoxBinding;\r\nControlBoxBinding.prototype.constructor = ControlBoxBinding;\r\nControlBoxBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nControlBoxBinding.STATE_NORMAL\t\t\t= \"normal\";\r\nControlBoxBinding.STATE_MAXIMIZED \t\t= \"maximized\";\r\nControlBoxBinding.STATE_MINIMIZED \t\t= \"minimized\";\r\nControlBoxBinding.ACTION_NORMALIZE \t\t= \"controlbox normalizeaction\";\r\nControlBoxBinding.ACTION_MAXIMIZE \t\t= \"controlbox maximizeaction\";\r\nControlBoxBinding.ACTION_MINIMIZE \t\t= \"controlbox minimizeaction\";\r\nControlBoxBinding.ACTION_STATECHANGE\t= \"controlbox statechangeacton\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ControlBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ControlBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isNormalized = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMaximized = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMinimized = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nControlBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ControlBoxBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nControlBoxBinding.prototype.onBindingAttach = function () {\r\n\r\n\tControlBoxBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.addActionListener ( ControlBinding.ACTION_COMMAND, this );\r\n\tthis.attachClassName ( ControlBoxBinding.STATE_NORMAL );\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {FlexBoxBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nControlBoxBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tControlBoxBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tswitch ( action.type ) {\r\n\t\tcase ControlBinding.ACTION_COMMAND :\r\n\t\t\tvar controlBinding = action.target;\r\n\t\t\tApplication.lock ( this );\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tself.handleInvokedControl ( controlBinding );\r\n\t\t\t\tApplication.unlock ( self );\r\n\t\t\t}, 0 );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked when descendant controls fire.\r\n * @param {ControlBinding} control\r\n */\r\nControlBoxBinding.prototype.handleInvokedControl = function ( control ) {\r\n\t\r\n\tswitch ( control.controlType ) {\r\n\t\tcase ControlBinding.TYPE_MAXIMIZE :\r\n\t\t\tthis.maximize ();\r\n\t\t\tbreak;\r\n\t\tcase ControlBinding.TYPE_MINIMIZE :\r\n\t\t\tthis.minimize ();\r\n\t\t\tbreak;\r\n\t\tcase ControlBinding.TYPE_UNMAXIMIZE :\r\n\t\tcase ControlBinding.TYPE_UNMINIMIZE :\r\n\t\t\tthis.normalize ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Minimize.\r\n */\r\nControlBoxBinding.prototype.maximize = function () {\r\n\r\n\tthis.dispatchAction ( ControlBoxBinding.ACTION_MAXIMIZE );\r\n\tthis.setState ( ControlBoxBinding.STATE_MAXIMIZED );\r\n\tthis.isNormalized = false;\r\n\tthis.isMaximized = true;\r\n\tthis.isMinimized = false;\r\n}\r\n\r\n/**\r\n * Minimize.\r\n */\r\nControlBoxBinding.prototype.minimize = function () {\r\n\r\n\tthis.dispatchAction ( ControlBoxBinding.ACTION_MINIMIZE );\r\n\tthis.setState ( ControlBoxBinding.STATE_MINIMIZED );\r\n\tthis.isNormalized = false;\r\n\tthis.isMaximized = false;\r\n\tthis.isMinimized = true;\r\n}\r\n\r\n/**\r\n * Normalize.\r\n */\r\nControlBoxBinding.prototype.normalize = function () {\r\n\r\n\tthis.dispatchAction ( ControlBoxBinding.ACTION_NORMALIZE );\r\n\tthis.setState ( ControlBoxBinding.STATE_NORMAL );\r\n\tthis.isNormalized = true;\r\n\tthis.isMaximized = false;\r\n\tthis.isMinimized = false;\r\n}\r\n\r\n/**\r\n * Updates the value of the \"state\" property. This also sets a specific CSS classname.\r\n * @param {string} state\r\n */\r\nControlBoxBinding.prototype.setState = function ( state ) {\r\n\t\r\n\t// backup the old value\r\n\tvar prestate = this.getState ();\r\n\r\n\t// assert the new value\r\n\tthis.setProperty ( \"state\", state );\r\n\t\r\n\t// synchronize the CSS classname\r\n\tthis.detachClassName ( prestate );\r\n\tthis.attachClassName ( state );\r\n\t\r\n\t// dispatching common action for all state changes\r\n\tthis.dispatchAction ( ControlBoxBinding.ACTION_STATECHANGE );\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nControlBoxBinding.prototype.getState = function () {\r\n\r\n\tvar result = this.getProperty ( \"state\" );\r\n\tif ( !result ) {\r\n\t\tresult = ControlBoxBinding.STATE_NORMAL;\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/controls/ControlGroupBinding.js",
    "content": "ControlGroupBinding.prototype = new Binding;\r\nControlGroupBinding.prototype.constructor = ControlGroupBinding;\r\nControlGroupBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ControlGroupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ControlGroupBinding\" );\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nControlGroupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ControlGroupBinding]\";\r\n}\r\n\r\n/**\r\n * Setup event listeners.\r\n */\r\nControlGroupBinding.prototype.onBindingAttach = function () {\r\n\r\n\tControlGroupBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.assignDOMEvents ();\r\n}\r\n\r\n/**\r\n * Mouseevents should not be propagated to the titlebar when handling controls.\r\n * These listeners will take care of it.\r\n */\r\nControlGroupBinding.prototype.assignDOMEvents = function () {\r\n\r\n\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n\tthis.addEventListener ( DOMEvents.MOUSEUP );\r\n}\r\n\r\n/**\r\n * Activate. Forces a refresh on contained controls. This may \r\n * update control image if containing ControlBoxBinding changed \r\n * active state AND control isGhostable.\r\n */\r\nControlGroupBinding.prototype.onActivate = function () {\r\n\t\r\n\tvar controls = this.getDescendantBindingsByLocalName ( \"control\" );\r\n\tcontrols.each ( function ( control ) {\r\n\t\t//if ( control.isGhostable ) {\r\n\t\t\tcontrol.setControlType ( control.controlType );\r\n\t\t//}\r\n\t});\r\n}\r\n\r\n/**\r\n * Deactivate.\r\n */\r\nControlGroupBinding.prototype.onDeactivate = ControlGroupBinding.prototype.onActivate;\r\n\r\n/**\r\n * Blocks event propagation.\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nControlGroupBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tControlGroupBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tDOMEvents.stopPropagation ( e );\r\n\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN, e );\r\n\t\t\tthis.dispatchAction ( Binding.ACTION_ACTIVATED );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.MOUSEUP :\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEUP, e );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * ControlGroupBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ControlGroupBinding}\r\n */\r\nControlGroupBinding.newInstance = function ( ownerDocument ) {\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:controlgroup\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, ControlGroupBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/cover/CoverBinding.js",
    "content": "CoverBinding.prototype = new Binding;\r\nCoverBinding.prototype.constructor = CoverBinding;\r\nCoverBinding.superclass = Binding.prototype;\r\n\r\nCoverBinding.CLASSNAME_TRANSPARENT = \"transparent\";\r\n\r\n/**\r\n * Fade out cover.\r\n * TODO: move to higher order utility - an universal fade system?\r\n * TODO: Replace cover DIV with CSS transforms, canvas tag and/or IE transitions.\r\n * @param {CoverBinding} cover\r\n */\r\nCoverBinding.fadeOut = function ( cover ) {\r\n\t\r\n\tfunction setOpacity ( opacity ) {\r\n\t\tcover.bindingElement.style.opacity = new String ( opacity );\r\n\t}\r\n\r\n\tif (cover instanceof CoverBinding) {\r\n\t\tnew Animation ({\r\n\t\t\tmodifier : 18,\r\n\t\t\tonstep : function ( iterator ) {\r\n\t\t\t\tif ( Binding.exists ( cover )) {\r\n\t\t\t\t\tsetOpacity ( \r\n\t\t\t\t\t\tMath.cos ( \r\n\t\t\t\t\t\t\titerator * Math.PI / 180\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tonstop : function () {\r\n\t\t\t\tif ( Binding.exists ( cover )) {\r\n\t\t\t\t\tcover.hide ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}).play ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Fade in cover\r\n * TODO: move to higher order utility.\r\n * @param {CoverBinding} cover\r\n */\r\nCoverBinding.fadeIn = function ( cover ) {\r\n\t\r\n\tfunction setOpacity ( opacity ) {\r\n\t\tcover.bindingElement.style.MozOpacity = new String ( opacity );\r\n\t}\r\n\r\n\tif (cover instanceof CoverBinding) {\r\n\t\tnew Animation ({\r\n\t\t\tmodifier : 18,\r\n\t\t\tonstart : function () {\r\n\t\t\t\tif ( Binding.exists ( cover )) {\r\n\t\t\t\t\tsetOpacity ( 0 );\r\n\t\t\t\t\tcover.show ();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tonstep : function ( iterator ) {\r\n\t\t\t\tif ( Binding.exists ( cover )) {\r\n\t\t\t\t\tsetOpacity ( \r\n\t\t\t\t\t\tMath.sin ( \r\n\t\t\t\t\t\t\titerator * Math.PI / 180\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tonstop : function () {\r\n\t\t\t\tsetOpacity ( 1 );\r\n\t\t\t}\r\n\t\t}).play ();\r\n\t}\r\n};\r\n\r\n/**\r\n * @class\r\n */\r\nfunction CoverBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"CoverBinding\" );\r\n\t\r\n\t/**\r\n\t * Indicates that the cover should display a \"wait\" cursor when visible.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isBusy = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isTransparent = false;\r\n\r\n\t/**\r\n\t * @type {DateTime}\r\n\t */\r\n\tthis.lastTouch = null;\r\n\t\r\n\t/**\r\n\t * Stores the mouse position in a panicked attempt \r\n\t * to gain control of the rendered cursor.\r\n\t * @type {Position}\r\n\t */\r\n\tthis._position = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCoverBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[CoverBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nCoverBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tCoverBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\t/*\r\n\t * Remember that this will interfere with the StandardEventHandler. \r\n\t * Event blocking should probably only be used on the mastercover.\r\n\t */\r\n\tif ( this.getProperty ( \"blockevents\" )) {\r\n\t\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n\t\tthis.addEventListener ( DOMEvents.MOUSEUP );\r\n\t\tthis.addEventListener ( DOMEvents.MOUSEMOVE );\r\n\t\tthis.addEventListener ( DOMEvents.CLICK );\r\n\t\tthis.addEventListener ( DOMEvents.DOUBLECLICK );\r\n\r\n\r\n\t}\r\n\r\n\tif (this.getProperty(\"doubletouchunlock\")) {\r\n\t\tthis.addEventListener(DOMEvents.TOUCHEND);\r\n\t}\r\n\t\r\n\tif ( this.getProperty ( \"transparent\" ) == true ) {\r\n\t\tthis.setTransparent ( true );\r\n\t}\r\n\t\r\n\tif ( this.getProperty ( \"busy\" ) == false ) {\r\n\t\tthis._isBusy = false;\r\n\t}\r\n\t\r\n\tif ( this._isBusy ) {\r\n\t\tthis.bindingElement.style.cursor = \"wait\";\r\n\t}\r\n\r\n\r\n}\r\n\r\n/**\r\n * @overloads {Binding#show}\r\n */\r\nCoverBinding.prototype.show = function () {\r\n\t\r\n\tCoverBinding.superclass.show.call ( this );\r\n\tif ( this._isBusy && this.isVisible ) {\r\n\t\tthis.addEventListener ( DOMEvents.MOUSEMOVE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Busy cover will summon the UncoverBinding.\r\n * @overloads {Binding#hide}\r\n */\r\nCoverBinding.prototype.hide = function () {\r\n\t\r\n\tCoverBinding.superclass.hide.call ( this );\r\n\tif ( this._isBusy && !this.isVisible && this._position ) {\r\n\t\tUncoverBinding.uncover ( this._position );\r\n\t\tthis.removeEventListener ( DOMEvents.MOUSEMOVE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Tracking mouse position so that we know where to position the UncoverBinding.\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nCoverBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tCoverBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tDOMEvents.stopPropagation ( e );\r\n\t\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.MOUSEMOVE :\r\n\t\t\tthis._position = DOMUtil.getUniversalMousePosition(e);\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.TOUCHEND:\r\n\t\t\t//Check double tap\r\n\t\t\tif (this.lastTouch && Date.now() - this.lastTouch < 300)\r\n\t\t\t{\r\n\t\t\t\tif (Application.isLocked) {\r\n\t\t\t\t\tApplication.unlock(Application, true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.lastTouch = Date.now();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Control busy cursor.\r\n * @param {boolean} isBusy\r\n */\r\nCoverBinding.prototype.setBusy = function ( isBusy ) {\r\n\t\r\n\tif ( isBusy != this._isBusy ) {\r\n\t\tif ( isBusy ) {\r\n\t\t\tthis.bindingElement.style.cursor = \"wait\";\r\n\t\t} else {\r\n\t\t\tthis.bindingElement.style.cursor = \"default\";\r\n\t\t}\r\n\t\tthis._isBusy = isBusy;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set transparency (it either is or it isn't).\r\n * @param {boolean} isTransparent\r\n */\r\nCoverBinding.prototype.setTransparent = function ( isTransparent ) {\r\n\t\r\n\tif ( isTransparent != this._isTransparent ) {\r\n\t\tif ( isTransparent ) {\r\n\t\t\tthis.attachClassName ( CoverBinding.CLASSNAME_TRANSPARENT );\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( CoverBinding.CLASSNAME_TRANSPARENT );\r\n\t\t}\r\n\t\tthis._isTransparent = isTransparent;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set width. Progressbar uses this...\r\n * @see {ProgressBarBinding}\r\n * @param {int} width\r\n */\r\nCoverBinding.prototype.setWidth = function ( width ) {\r\n\t\r\n\tif ( width >= 0 ) {\r\n\t\tthis.bindingElement.style.width = new String ( width + \"px\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Get width.\r\n * @return {int}\r\n */\r\nCoverBinding.prototype.getWidth = function () {\r\n\t\r\n\treturn this.bindingElement.offsetWidth;\r\n}\r\n\r\n/**\r\n * Set height.\r\n * @param {int} width\r\n */\r\nCoverBinding.prototype.setHeight = function ( height ) {\r\n\t\r\n\tif ( height >= 0 ) {\r\n\t\tthis.bindingElement.style.height = new String ( height + \"px\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Get height.\r\n * @return {int}\r\n */\r\nCoverBinding.prototype.getHeight = function () {\r\n\t\r\n\treturn this.bindingElement.offsetHeight;\r\n}\r\n\r\n/**\r\n * CoverBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {CoverBinding}\r\n */\r\nCoverBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:cover\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, CoverBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/cover/UncoverBinding.js",
    "content": "UncoverBinding.prototype = new Binding;\r\nUncoverBinding.prototype.constructor = UncoverBinding;\r\nUncoverBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * Considered private.\r\n * @type {UncoverBinding}\r\n */\r\nUncoverBinding._bindingInstance = null;\r\n\r\n/**\r\n * Invoke to normalize cursor.\r\n * @param {Position} pos\r\n */\r\nUncoverBinding.uncover = function ( pos ) {\r\n\t\r\n\tvar binding = UncoverBinding._bindingInstance;\r\n\tif ( Binding.exists ( binding )) {\r\n\t\tbinding.setPosition ( pos );\r\n\t}\r\n}\r\n\r\n/**\r\n * @class\r\n * When a \"busy\" cover gets hidden, the wait cursor may \r\n * hang on, indicating activity until the mouse is moved. \r\n * We force a cursor update by positioning the uncover \r\n * at exact mouse position.\r\n */\r\nfunction UncoverBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"UncoverBinding\" );\r\n\t\r\n\t/*\r\n\t * Register globally.\r\n\t */\r\n\tUncoverBinding._bindingInstance = this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nUncoverBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[UncoverBinding]\";\r\n}\r\n\r\n/**\r\n * This will place the bindings CENTER at the specified position.\r\n * @param {Position} pos\r\n */\r\nUncoverBinding.prototype.setPosition = function ( pos ) {\r\n\t\r\n\tthis.bindingElement.style.display = \"block\";\r\n\tvar dim = this.boxObject.getDimension ();\r\n\t\r\n\tpos.x -= 0.5 * dim.w;\r\n\tpos.y -= 0.5 * dim.h;\r\n\t\r\n\tpos.x = pos.x < 0 ? 0 : pos.x;\r\n\tpos.y = pos.y < 0 ? 0 : pos.y;\r\n\t\r\n\tthis.bindingElement.style.left = String ( pos.x ) + \"px\";\r\n\tthis.bindingElement.style.top = String ( pos.y ) + \"px\";\r\n\tthis.bindingElement.style.cursor = \"wait\";\r\n\t\r\n\t/*\r\n\t * Flashing the cursor property, \r\n\t * forcing IE to update rendering.\r\n\t */\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tself.bindingElement.style.cursor = \"default\";\r\n\t\tself.bindingElement.style.display = \"none\";\r\n\t}, 0 );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/cursors/CursorBinding.js",
    "content": "CursorBinding.prototype = new Binding;\r\nCursorBinding.prototype.constructor = CursorBinding;\r\nCursorBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * Fade in cursor.\r\n * @param {CursorBinding} cursor\r\n */\r\nCursorBinding.fadeIn = function ( cursor ) {\r\n\t\r\n\tif ( cursor instanceof CursorBinding ) {\r\n\t\tcursor.setOpacity ( 0 );\r\n\t\tcursor.show ();\r\n\t\tnew Animation (\r\n\t\t\t{\r\n\t\t\t\tmodifier : 9,\r\n\t\t\t\tonstep : function ( iterator ) {\r\n\t\t\t\t\tcursor.setOpacity ( \r\n\t\t\t\t\t\tMath.sin ( iterator * Math.PI / 180 )\r\n\t\t\t\t\t);\r\n\t\t\t\t},\r\n\t\t\t\tonstop : function () {\r\n\t\t\t\t\tcursor.setOpacity ( 1 );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t).play ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Fade out cursor.\r\n * @param {CursorBinding} cursor\r\n */\r\nCursorBinding.fadeOut = function ( cursor ) {\r\n\t\r\n\tif ( cursor instanceof CursorBinding ) {\r\n\t\tnew Animation ({\r\n\t\t\tmodifier : 9,\r\n\t\t\tonstep : function ( iterator ) {\r\n\t\t\t\tcursor.setOpacity ( \r\n\t\t\t\t\tMath.cos ( \r\n\t\t\t\t\t\titerator * Math.PI / 180\r\n\t\t\t\t\t)\r\n\t\t\t\t);\r\n\t\t\t},\r\n\t\t\tonstop : function () {\r\n\t\t\t\tcursor.hide ();\r\n\t\t\t}\r\n\t\t}).play ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Move cursor from one point to another whilst fading it out.\r\n * @param {CursorBinding} cursor\r\n */\r\nCursorBinding.moveOut = function ( cursor, startpoint, endpoint ) {\r\n\t\r\n\tif ( cursor instanceof CursorBinding ) {\r\n\t\t\r\n\t\t// compensate for cursor icons visual displacement\r\n\t\tendpoint.x -= 16;\r\n\t\tendpoint.y -= 16;\r\n\t\r\n\t\tnew Animation ({\r\n\t\t\tmodifier : 3,\r\n\t\t\tonstep : function ( iterator ) {\r\n\t\t\t\tvar tal = Math.sin ( iterator * Math.PI / 180 );\r\n\t\t\t\tcursor.setPosition ( new Point (\r\n\t\t\t\t\t(( 1 - tal ) * startpoint.x ) + (( 0 + tal ) * endpoint.x ),\r\n\t\t\t\t\t(( 1 - tal ) * startpoint.y ) + (( 0 + tal ) * endpoint.y )\r\n\t\t\t\t));\r\n\t\t\t},\r\n\t\t\tonstop : function () {\r\n\t\t\t\tCursorBinding.fadeOut ( cursor )\r\n\t\t\t}\r\n\t\t}).play ();\r\n\t}\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction CursorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"CursorBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {LabelBinding}\r\n\t */\r\n\tthis._labelBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {number}\r\n\t */\r\n\tthis._opacity = 1;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isAccepting = true;\r\n\t\r\n\t/*\r\n\t * @returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCursorBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[CursorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nCursorBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tCursorBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis._labelBinding = this.add (\r\n\t\tLabelBinding.newInstance ( \r\n\t\t\tthis.bindingDocument \r\n\t\t)\r\n\t);\r\n\t\r\n\tvar image = this.getProperty ( \"image\" );\r\n\tif ( image != null ) {\r\n\t\tthis.setImage ( image );\r\n\t}\r\n\t\r\n\tthis._stopIndicatorBinding = this.add (\r\n\t\tLabelBinding.newInstance ( \r\n\t\t\tthis.bindingDocument \r\n\t\t)\r\n\t);\r\n\t\r\n\tthis._stopIndicatorBinding.attachClassName ( \"indicator\" );\r\n\tthis._stopIndicatorBinding.setImage ( \r\n\t\t\"${icon:cancel}\" \r\n\t);\r\n\t\r\n\tthis.hide ();\r\n\tthis._stopIndicatorBinding.hide ();\r\n}\r\n\r\n/**\r\n * @param {string} url\r\n */\r\nCursorBinding.prototype.setImage = function ( url ) {\r\n\t\r\n\tthis._labelBinding.setImage ( url );\r\n}\r\n\r\n/**\r\n * Show acceptance.\r\n */\r\nCursorBinding.prototype.showAcceptance = function () {\r\n\t\r\n\tthis.isAccepting = true;\r\n\t\r\n\tif ( Client.isMozilla ) {\r\n\t\tthis._stopIndicatorBinding.hide ();\r\n\t} else {\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tif ( self.isAccepting ) {\r\n\t\t\t\tself._stopIndicatorBinding.hide ();\r\n\t\t\t}\r\n\t\t}, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide acceptance.\r\n */\r\nCursorBinding.prototype.hideAcceptance = function () {\r\n\r\n\tthis.isAccepting = false;\r\n\t\r\n\tif ( Client.isMozilla ) {\r\n\t\tthis._stopIndicatorBinding.show ();\r\n\t} else {\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tif ( !self.isAccepting ) {\r\n\t\t\t\tself._stopIndicatorBinding.show ();\r\n\t\t\t}\r\n\t\t}, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {Binding#show}\r\n */\r\nCursorBinding.prototype.show = function () {\r\n\r\n\tCursorBinding.superclass.show.call ( this );\r\n\t\r\n\t/*\r\n\tthis._stopIndicatorBinding.show ()\r\n\tthis._isAccepting = false;\r\n\t*/\r\n}\r\n\r\n/**\r\n * @param {number} opacity From zero to one!\r\n */\r\nCursorBinding.prototype.setOpacity = function ( opacity ) {\r\n\r\n\tthis.bindingElement.style.opacity = new String ( opacity );\r\n\r\n\tthis._opacity = opacity;\r\n}\r\n\r\n/**\r\n * @return {number}\r\n */\r\nCursorBinding.prototype.getOpacity = function () {\r\n\t\r\n\treturn this._opacity;\r\n}\r\n\r\n/**\r\n * @param {Position} pos\r\n */\r\nCursorBinding.prototype.setPosition = function ( pos ) {\r\n\t\r\n\tthis.bindingElement.style.left = pos.x + \"px\";\r\n\tthis.bindingElement.style.top = pos.y + \"px\";\r\n}\r\n\r\n/**\r\n * @return {Position}\r\n */\r\nCursorBinding.prototype.getPosition = function () {\r\n\t\r\n\treturn new Point (\r\n\t\tthis.bindingElement.offsetLeft,\r\n\t\tthis.bindingElement.offsetTop\r\n\t);\r\n}\r\n\r\n/**\r\n * Fade in.\r\n */\r\nCursorBinding.prototype.fadeIn = function () {\r\n\t\r\n\tCursorBinding.fadeIn ( this ); \r\n}\r\n\r\n/**\r\n * Fade out.\r\n */\r\nCursorBinding.prototype.fadeOut = function () {\r\n\t\r\n\tCursorBinding.fadeOut ( this ); \r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/DataBinding.js",
    "content": "DataBinding.prototype = new Binding;\r\nDataBinding.prototype.constructor = DataBinding;\r\nDataBinding.superclass = Binding.prototype;\r\n\r\nDataBinding.AUTOGENERATED = \"autogenerateddatabindingname\";\r\n\r\nDataBinding.TYPE_NUMBER = \"number\";\r\nDataBinding.TYPE_INTEGER = \"integer\";\r\nDataBinding.TYPE_STRING = \"string\";\r\n\r\nDataBinding.CLASSNAME_INVALID = \"invalid\";\r\nDataBinding.CLASSNAME_INFOBOX = \"infobox\";\r\nDataBinding.CLASSNAME_WARNING = \"warning\";\r\nDataBinding.CLASSNAME_FOCUSED = \"focused\";\r\nDataBinding.CLASSNAME_DISABLED = \"disabled\";\r\n\r\n\r\n/**\r\n * Populating expressions when user logs in.\r\n * Becuase they may be language dependant.\r\n */\r\nEventBroadcaster.subscribe ( BroadcastMessages.APPLICATION_LOGIN, {\r\n\thandleBroadcast : function () {\r\n\t\tvar expressions = new List ( ConfigurationService.GetValidatingRegularExpressions ( \"dummy\" ));\r\n\t\texpressions.each ( function ( entry ) {\r\n\t\t\tDataBinding.expressions [ entry.Key ] = new RegExp ( entry.Value );\r\n\t\t});\r\n\r\n\t\tvar localizedWarnings = {\r\n\t\t\t\"required\": StringBundle.getString(\"ui\", \"Validation.Required\"),\r\n\t\t\t\"number\": StringBundle.getString(\"ui\", \"Validation.InvalidField.Number\"),\r\n\t\t\t\"integer\": StringBundle.getString(\"ui\", \"Validation.InvalidField.Integer\"),\r\n\t\t\t\"programmingidentifier\": StringBundle.getString(\"ui\", \"Validation.InvalidField.ProgrammingIdentifier\"),\r\n\t\t\t\"programmingnamespace\": StringBundle.getString(\"ui\", \"Validation.InvalidField.ProgrammingNamespace\"),\r\n\t\t\t\"url\": StringBundle.getString(\"ui\", \"Validation.InvalidField.Url\"),\r\n\t\t\t\"minlength\": StringBundle.getString(\"ui\", \"Validation.StringLength.Min\"),\r\n\t\t\t\"maxlength\": StringBundle.getString(\"ui\", \"Validation.StringLength.Max\"),\r\n\t\t\t\"currency\": StringBundle.getString(\"ui\", \"Validation.InvalidField.Currency\"),\r\n\t\t\t\"email\": StringBundle.getString(\"ui\", \"Validation.InvalidField.Email\"),\r\n\t\t\t\"guid\": StringBundle.getString(\"ui\", \"Validation.InvalidField.Guid\")\r\n\t\t}\r\n\r\n\t\tfor (var prop in localizedWarnings) {\r\n\t\t\tDataBinding.warnings[prop] = localizedWarnings[prop];\r\n\t\t}\r\n\t}\r\n});\r\n\r\n\r\n/**\r\n * Regular expressions used for validating. Populated \r\n * by ConfigurationService on login (see abowe).\r\n * @type {HashMap<string><RegExp>}\r\n */\r\nDataBinding.expressions = {\r\n\t\r\n\t// populated by server - just to illustrate the structure...\r\n\t\r\n\t/*\r\n\t\"number\" \t: /^[0-9]+(\\,[0-9]+)?$/,\r\n\t\"integer\" \t: /^[0-9]+$/,\r\n\t\"currency\" \t: /^[0-9]{1,3}(\\.[0-9]{3})*(\\,[0-9]{1,2})?$/,\r\n\t\"email\"\t\t: /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,})+$/,\r\n\t\"string\"\t: /[a-å]|[A-Å]|[0-9]/\r\n\t\"url\"\t\t: /^/|://|mailto:|javascript:/\r\n\t*/\r\n}\r\n\r\n/**\r\n * Warnings. This is written *inside* the control, not in a balloon. Not all DataBindings \r\n * may support warnings; only bindings that rely on direct keyboard input.\r\n * @see {DataInputBinding}\r\n * @see {TextBoxBinding} \r\n * TODO: Move to ConfigurationService?\r\n */\r\nDataBinding.warnings = {\r\n\r\n\t\"required\" \t                : \"Required\",\r\n\t\"number\" \t                : \"Numbers only\",\r\n\t\"integer\" \t                : \"Integers only\",\r\n\t\"programmingidentifier\"     : \"Invalid identifier\",\r\n\t\"programmingnamespace\"      : \"Invalid namespace\",\r\n\t\"url\"\t\t\t\t\t\t: \"Invalid URL\",\r\n\t\"minlength\"\t\t\t\t\t: \"{0} characters minimum\",\r\n\t\"maxlength\"\t\t\t\t\t: \"{0} characters maximum\",\r\n\t\"currency\"\t\t\t\t\t: \"Invalid notation\",\r\n\t\"email\"\t\t\t\t\t\t: \"Invalid e-mail\",\r\n\t\"guid\"\t\t\t\t\t\t: \"Invalid GUID\",\r\n\t\"character\"\t\t\t\t: \"'{0}', hexadecimal value {1}, is an invalid character.\"\r\n}\r\n\r\n/**\r\n * Errors (balloons texts). All DataBindings support errors. \r\n * Remember that error presentation is handled by the FieldBinding.\r\n * @see {FieldBinding#handleAction} \r\n * TODO: Move to ConfigurationService?\r\n */\r\nDataBinding.errors = {\r\n\t\r\n\t\"programmingidentifier\"     : \"An identifier must not contain spaces or special characters. Only characters a-z, A-Z, 0-9 and '_' are allowed. An identifier must begin with a letter (not a number).\",\r\n\t\"programmingnamespace\"      : \"A namespace must take the form Example.Name.Space where only characters a-z, A-Z, 0-9, '_' and dots (.) are allowed. Each part of the namespace must begin with a letter (not a number).\",\r\n\t\"url\"\t\t\t\t\t\t: \"A valid URL must begin with a forward slash, designating the site root, or an URL scheme name such as http://. Simpliefied addresses such as www.example.com cannot be resolved reliably by the browser. Relative URLs are not supported.\"\r\n}\r\n\r\n/**\r\n * Retrieve the string label of the FieldDescBinding hosting any given binding.\r\n * @param {Binding} binding \r\n * @return {string}\r\n */\r\nDataBinding.getAssociatedLabel = function ( binding ) {\r\n\t\r\n\tvar result = null;\r\n\tvar field = binding.getAncestorBindingByLocalName ( \"field\" );\r\n\t\r\n\tif ( field && field instanceof FieldBinding ) {\r\n\t\tvar desc = field.getDescendantBindingByLocalName ( \"fielddesc\" );\r\n\t\tif ( desc && desc instanceof FieldDescBinding ) {\r\n\t\t\tresult = desc.getLabel ();\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @class\r\n * This is sort of an abstract class. The real stuff goes on in subclasses.\r\n * @implements {IData}\r\n */\r\nfunction DataBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DataBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._name = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\t\r\n\t/**\r\n\t * @implements {IData}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\t\r\n\t/**\r\n\t * @implements {IData}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\t\r\n\t/**\r\n\t * The errortext associated, popularly known as balloons. \r\n\t * Remember that errors may also be injected by the server \r\n\t * in a special UpdatePanelBinding.\r\n\t * @type {string} \r\n\t */\r\n\tthis.error = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDataBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DataBinding]\";\r\n}\r\n\r\n/**\r\n * Register binding with DocumentManager.\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nDataBinding.prototype.onBindingRegister = function () {\r\n\r\n\tDataBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this.setDisabled; // HIGHLY QUESTIONABLE!\r\n\t\r\n\t/*\r\n\t * Register name (backendish concept) with DataManager.\r\n\t */\r\n\tvar name = this._name ? this._name : this.getProperty ( \"name\" );\r\n\tif ( name == null ) {\r\n\t\tname = DataBinding.AUTOGENERATED + KeyMaster.getUniqueKey ();\r\n\t}\r\n \tthis.setName ( name );\r\n}\r\n\r\n/**\r\n * Associate an error (balloon) to this bindings invalid state?\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nDataBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tDataBinding.superclass.onBindingAttach.call ( this );\r\n \tif ( this.getProperty ( \"error\" )) {\r\n\t \tthis.error = this.getProperty ( \"error\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Unregister binding with the window-scope {@link DataManager}.\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nDataBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tDataBinding.superclass.onBindingDispose.call ( this );\r\n\t\r\n\tif ( this.isFocused == true ) {\r\n\t\tthis.blur ();\r\n\t}\r\n\t\r\n\tvar dataManager = this.bindingWindow.DataManager;\r\n\tdataManager.unRegisterDataBinding ( this._name );\r\n}\r\n\r\n/**\r\n * Set name. The DataBinding is registered with the window-scope  \r\n * {@link DocumentManager} for easy retrieval in other contexts.\r\n * @param {string} name\r\n */\r\nDataBinding.prototype.setName = function ( name ) {\r\n\t\r\n\tvar dataManager = this.bindingWindow.DataManager;\r\n\r\n\tif ( dataManager.getDataBinding ( name )) {\r\n\t\tdataManager.unRegisterDataBinding ( name );\r\n\t}\r\n\tdataManager.registerDataBinding ( name, this );\r\n\tthis.setProperty ( \"name\", name );\r\n\tthis._name = name;\r\n}\r\n\r\n/**\r\n * Get name.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nDataBinding.prototype.getName = function () {\r\n\t\r\n\treturn this._name;\r\n}\r\n\r\n/**\r\n * Focus.\r\n * @implements {IData}\r\n */\r\nDataBinding.prototype.focus = function () {\r\n\t\r\n\tif ( this.isFocusable && !this.isFocused ) {\r\n\t\tthis.isFocused = true;\r\n\t\tthis.dispatchAction ( Binding.ACTION_FOCUSED );\r\n\t\tthis.attachClassName ( DataBinding.CLASSNAME_FOCUSED );\r\n\t}\r\n};\r\n\r\n/**\r\n * Blur.\r\n * @implements {IData}\r\n */\r\nDataBinding.prototype.blur = function () {\r\n\t\r\n\tif ( this.isFocused ) {\r\n\t\tthis.isFocused = false;\r\n\t\tthis.dispatchAction ( Binding.ACTION_BLURRED );\r\n\t\tthis.detachClassName ( DataBinding.CLASSNAME_FOCUSED );\r\n\t}\r\n};\r\n\r\n/**\r\n * Pollute dirty flag.\r\n */\r\nDataBinding.prototype.dirty = function () {\r\n\t\r\n\tthis.bindingWindow.DataManager.dirty ( this );\r\n};\r\n\r\n/**\r\n * Clear dirty flag.\r\n */\r\nDataBinding.prototype.clean = function () {\r\n\t\r\n\tthis.bindingWindow.DataManager.clean ( this );\r\n};\r\n\r\n// ABSTRACT METHODS ............................................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nDataBinding.prototype.validate = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nDataBinding.prototype.manifest = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nDataBinding.prototype.getValue = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Set value.\r\n * @implements {IData}\r\n * @param {string} value\r\n */\r\nDataBinding.prototype.setValue = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nDataBinding.prototype.getResult = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} value\r\n */\r\nDataBinding.prototype.setResult = Binding.ABSTRACT_METHOD;\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/DataBindingMap.js",
    "content": "DataBindingMap.prototype = new Map;\r\nDataBindingMap.prototype.constructor = DataBindingMap;\r\nDataBindingMap.superclass = Map.prototype;\r\n\r\nDataBindingMap.TYPE_VALUE = \"databindingmap valuetype\";\r\nDataBindingMap.TYPE_RESULT = \"databindingmap resulttype\";\r\n\r\n/**\r\n * @class\r\n * Notice that this is an utility, not a binding!\r\n * @param @optional {Map} map\r\n */\r\nfunction DataBindingMap ( map ) {\r\n\t\r\n\t/*\r\n\t * Re-declare super property so that we don't all populate the same Map.\r\n\t */\r\n\tthis._map = map ? map : {};\r\n\t\r\n\t/**\r\n\t * Indicates whether or not content is intended \r\n\t * for serverside or clientside processing.\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = DataBindingMap.TYPE_RESULT;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/DataDialogBinding.js",
    "content": "DataDialogBinding.prototype = new DataBinding;\r\nDataDialogBinding.prototype.constructor = DataDialogBinding;\r\nDataDialogBinding.superclass = DataBinding.prototype;\r\n\r\nDataDialogBinding.ACTION_COMMAND = \"datadialog command\";\r\n\r\n/**\r\n * @class\r\n * Notice that this fellow works only as a clientside conrol.  \r\n * Use the PostBackDataDialogBinding for serverside work.\r\n * @implements {IData}\r\n */ \r\nfunction DataDialogBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DataDialogBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {ButtonBinding}\r\n\t */\r\n\tthis._buttonBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {IDialogResponseHandler}\r\n\t */\r\n\tthis._handler = null;\r\n\t\r\n\t/**\r\n\t * This will be served to the associated dialog as argument \r\n\t * and returned as result when a getResult is invoked.\r\n\t * @type {DataBindingMap}\r\n\t */\r\n\tthis._map = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._dialogViewHandle = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasKeyboard = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasFocus = false;\r\n\r\n    /**\r\n     * @type {boolean}\r\n     */\r\n\tthis.isRequired = false;\r\n\r\n    /**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isValid = true;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDataDialogBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[DataDialogBinding]\";\r\n}\r\n\r\nDataDialogBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tDataDialogBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.propertyMethodMap [ \"image\" ] = this.setImage;\r\n\tthis.propertyMethodMap [ \"label\" ] = this.setLabel;\r\n\tthis.propertyMethodMap [ \"tooltip\" ] = this.setToolTip;\r\n\tthis.propertyMethodMap [ \"handle\" ] = this.setHandle;\r\n\tthis.propertyMethodMap [ \"url\" ] = this.setURL;\r\n\tthis.propertyMethodMap [ \"value\" ] = this.setValue;\r\n}\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nDataDialogBinding.prototype.parseDOMProperties = function () {\r\n\r\n    var isRequired = this.getProperty(\"required\") == true;\r\n    if (isRequired) {\r\n        this.isRequired = true;\r\n    }\r\n}\r\n\r\n\r\n/**\r\n * Overloads {@link Binding#onBindingAttach}\r\n */\r\nDataDialogBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tDataDialogBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tBinding.imageProfile(this);\r\n\tthis._buildButton();\r\n\tthis.parseDOMProperties();\r\n\t\r\n\tif ( this.getProperty ( \"handle\" ) != null || this.getProperty ( \"url\" )) {\r\n\t\t//this._buildIndicator ();\r\n\t\tthis._buttonBinding.setImage(\"${icon:popup}\");\r\n\t\tthis._buttonBinding.labelBinding.attachClassName(\"flipped\");\r\n\t}\r\n\t\r\n\tthis.bindingElement.tabIndex = 0;\r\n\tif ( Client.isExplorer ) {\r\n\t\tthis.bindingElement.hideFocus = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Building button.\r\n */\r\nDataDialogBinding.prototype._buildButton = function () {\r\n\r\n\tvar label\t= this.getProperty ( \"label\" );\r\n\tvar tooltip = this.getProperty ( \"tooltip\" );\r\n\t\r\n\tthis._buttonBinding = this.add ( \r\n\t\tClickButtonBinding.newInstance ( this.bindingDocument ) \r\n\t);\r\n\tif ( label != null ) {\r\n\t\tif ( this.getProperty ( \"handle\" ) != null || this.getProperty ( \"url\" ) != null ) {\r\n\t\t\tthis._buttonBinding.setLabel ( label + LabelBinding.DIALOG_INDECATOR_SUFFIX );\r\n\t\t} else {\r\n\t\t\tthis._buttonBinding.setLabel ( label );\r\n\t\t}\r\n\t}\r\n\tif ( this.imageProfile ) {\r\n\t\tthis._buttonBinding.imageProfile = this.imageProfile;\r\n\t}\r\n\tif ( tooltip != null ) {\r\n\t\tthis._buttonBinding.setToolTip ( tooltip );\r\n\t}\r\n\tthis._buttonBinding.addActionListener ( \r\n\t\tButtonBinding.ACTION_COMMAND, this \r\n\t);\r\n\tthis._buttonBinding.attach ();\r\n}\r\n\r\n/**\r\n * Building dialog indicator image.\r\n */\r\nDataDialogBinding.prototype._buildIndicator = function () {\r\n\t\r\n\t//var img = this.bindingDocument.createElement ( \"img\" );\r\n\t//img.src = Resolver.resolve ( \"${icon:popup}\" );\r\n\t//img.className = \"dialogindicatorimage\";\r\n\t//this._buttonBinding.bindingElement.appendChild ( img );\r\n\t//this.shadowTree.indicatorimage = img;\r\n\r\n\r\n\r\n\tvar xmlns = \"http://www.w3.org/2000/svg\";\r\n\t\r\n\tthis.shadowTree.indicatorimage = this.bindingDocument.createElementNS(xmlns, \"svg\");\r\n\r\n\tthis.shadowTree.indicatorimage.setAttribute(\"viewBox\", \"0 0 24 24\");\r\n\tthis.shadowTree.indicatorimage.setAttribute(\"class\",\"dialogindicatorimage\");\r\n\t\r\n\tvar g = KickStart.sprites.querySelector(\"#popup\");\r\n\tif (g) {\r\n\t\tvar viewBox = g.getAttribute('viewBox'),\r\n\t\t\t\tfragment = document.createDocumentFragment(),\r\n\t\t\t\tclone = g.cloneNode(true);\r\n\r\n\t\tif (viewBox) {\r\n\t\t\tthis.shadowTree.indicatorimage.setAttribute('viewBox', viewBox);\r\n\t\t}\r\n\t\tfragment.appendChild(clone);\r\n\r\n\t\tthis.shadowTree.indicatorimage.appendChild(fragment);\r\n\t}\r\n\r\n\tthis._buttonBinding.bindingElement.appendChild(this.shadowTree.indicatorimage);\r\n}\r\n\r\n/**\r\n * @implemenents {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nDataDialogBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tDataDialogBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\tvar self = this;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\t\r\n\t\t\tif ( this._handler == null ) {\r\n\t\t\t\tthis._handler = {\r\n\t\t\t\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\t\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\t\t\t\tif ( result instanceof DataBindingMap ) {\r\n\t\t\t\t\t\t\t\tself._map = result;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tthrow \"Invalid dialog result\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif ( binding == this._buttonBinding ) {\r\n\t\t\t\taction.consume ();\r\n\t\t\t\tthis.focus ();\t\r\n\t\t\t\tthis.fireCommand ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n */\r\nDataDialogBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tDataDialogBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.KEY_SPACE :\r\n\t\t\tthis.fireCommand ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Open that dialog! An optional ViewDefinition can be build by subclass.\r\n * @param @optional {ViewDefinition} def\r\n */\r\nDataDialogBinding.prototype.fireCommand = function ( def ) {\r\n\t\r\n\t/* \r\n\t * This can be intercepted by someone \r\n\t * waiting to change the dialog handler.\r\n\t */\r\n\tthis.dispatchAction ( this.constructor.ACTION_COMMAND );\r\n\t\r\n\tvar handle = this.getProperty ( \"handle\" );\r\n\tvar url\t= this.getURL ();\r\n\tvar definition = null;\r\n\t\r\n\tif ( handle != null || def != null ) {\r\n\t\tif (def != null) {\r\n\t\t\tdefinition = def;\r\n\t\t} else {\r\n\t\t\tdefinition = ViewDefinitions[handle];\r\n\t\t}\r\n\t\tif ( definition instanceof DialogViewDefinition ) {\r\n\t\t\tdefinition.handler = this._handler;\r\n\t\t\tif ( this._map != null ) { // otherwise mess up StringDataDialogBinding\r\n\t\t\t\tdefinition.argument = this._map;\r\n\t\t\t}\r\n\t\t\tStageBinding.presentViewDefinition ( definition );\r\n\t\t}\r\n\t} else if ( url != null ) {\r\n\t\tdefinition = Dialog.invokeModal ( \r\n\t\t\turl,\r\n\t\t\tthis._handler, \r\n\t\t\tthis._map\r\n\t\t);\r\n\t}\r\n\t\r\n\t/*\r\n\t * Release keyboard and be prepared to \r\n\t * grab it again when the dialog closes.\r\n\t */\r\n\tif ( definition != null ) {\r\n\t\tthis._dialogViewHandle = definition.handle;\r\n\t\tthis._releaseKeyboard ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nDataDialogBinding.prototype.setLabel = function ( label ) {\r\n\t\r\n\tthis.setProperty ( \"label\", label );\r\n\tif ( this.isAttached ) {\r\n\t\tthis._buttonBinding.setLabel ( \r\n\t\t\tlabel + LabelBinding.DIALOG_INDECATOR_SUFFIX \r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Get label \r\n * @return {string}\r\n */\r\nDataDialogBinding.prototype.getLabel = function () {\r\n\r\n    return this.getProperty(\"label\");\r\n}\r\n\r\n/**\r\n * Set image.\r\n * @param {string} image\r\n */\r\nDataDialogBinding.prototype.setImage = function ( image ) {\r\n\t\r\n\tthis.setProperty ( \"image\", image );\r\n\t\r\n\t/*\r\n\t * TODO: Refactor this setup!\r\n\t */\r\n\tif ( this.imageProfile != null ) {\r\n\t\tthis.imageProfile.setDefaultImage ( image );\r\n\t\tif ( this._buttonBinding != null ) {\r\n\t\t\tthis._buttonBinding.imageProfile = this.imageProfile;\r\n\t\t\tthis._buttonBinding.setImage ( this._buttonBinding.imageProfile.getDefaultImage ());\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Set label.\r\n * @param {string} tooltip\r\n */\r\nDataDialogBinding.prototype.setToolTip = function ( tooltip ) {\r\n\t\r\n\tthis.setProperty ( \"tooltip\", tooltip );\r\n\tif ( this.isAttached ) {\r\n\t\tthis._buttonBinding.setToolTip ( tooltip );\r\n\t}\t\r\n\t\r\n}\r\n\r\n/**\r\n * Set handle.\r\n * @param {string} handle\r\n */\r\nDataDialogBinding.prototype.setHandle = function ( handle ) {\r\n\r\n\tthis.setProperty ( \"handle\", handle );\r\n}\r\n\r\n/**\r\n * Set that URL.\r\n * @param {string} url\r\n */\r\nDataDialogBinding.prototype.setURL = function ( url ) {\r\n\t\r\n\tthis.setProperty ( \"url\", url );\r\n}\r\n\r\n/**\r\n * Get that URL. Isolated so that subclasses may hack it.\r\n * @return {string}\r\n */\r\nDataDialogBinding.prototype.getURL = function () {\r\n\r\n\treturn this.getProperty ( \"url\" );\r\n}\r\n\r\n/**\r\n * Set handler.\r\n * @param {IDialogResponseHandler} handler\r\n */\r\nDataDialogBinding.prototype.setHandler = function ( handler ) {\r\n\t\r\n\tthis._handler = handler;\r\n}\r\n\r\n/**\r\n * Focus.\r\n * @implements {IData}\r\n */\r\nDataDialogBinding.prototype.focus = function () {\r\n\t\r\n\tif ( !this.isFocused ) {\r\n\t\tDataBinding.prototype.focus.call ( this );\r\n\t\tFocusBinding.focusElement ( this.bindingElement );\r\n\t\tif ( this.isFocused ) {\r\n\t\t\tthis._grabKeyboard ();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Blur.\r\n * @implements {IData}\r\n */\r\nDataDialogBinding.prototype.blur = function () {\r\n\t\r\n\tif ( this.isFocused ) {\r\n\t\tDataBinding.prototype.blur.call ( this );\r\n\t\tif ( this._hasKeyboard ) {\r\n\t\t\tthis._releaseKeyboard ();\r\n\t\t}\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Grab keyboard.\r\n */\r\nDataDialogBinding.prototype._grabKeyboard = function () {\r\n\t\r\n\tif ( !this._hasKeyboard ) {\r\n\t\tthis.subscribe ( BroadcastMessages.KEY_SPACE );\r\n\t\tthis._hasKeyboard = true;\r\n\t}\r\n\t\r\n}\r\n\r\n/**\r\n * Release keyboard.\r\n */\r\nDataDialogBinding.prototype._releaseKeyboard = function () {\r\n\t\r\n\tif ( this._hasKeyboard ) {\r\n\t\tthis.unsubscribe ( BroadcastMessages.KEY_SPACE );\r\n\t\tthis._hasKeyboard = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nDataDialogBinding.prototype.validate = function () {\r\n\t\r\n    var isValid = true;\r\n    if (this.isRequired == true) {\r\n        var value = this.getValue();\r\n\r\n        if (value == null || value == \"\") {\r\n            isValid = false;\r\n        }\r\n\r\n        if (isValid != this._isValid) {\r\n            if (isValid) {\r\n                this.dispatchAction(Binding.ACTION_VALID);\r\n                this.detachClassName(DataBinding.CLASSNAME_INVALID);\r\n            } else {\r\n                this.dispatchAction(Binding.ACTION_INVALID);\r\n                this.attachClassName(DataBinding.CLASSNAME_INVALID);\r\n                this._buttonBinding.setLabel(DataBinding.warnings[\"required\"]);\r\n            }\r\n        }\r\n        this._isValid = isValid;\r\n    }\r\n    return isValid;\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nDataDialogBinding.prototype.manifest = function () {\r\n\t\r\n\t// do nothing\r\n}\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nDataDialogBinding.prototype.getValue = function () {\r\n\t\r\n\treturn null;\r\n}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {DataBindingMap}\r\n */\r\nDataDialogBinding.prototype.getResult = function () {\r\n\t\r\n\treturn this._map;\r\n}\r\n\r\n/**\r\n * Set result. Notice that the result is automatically \r\n * deployed as argument for the associated dialog.\r\n * @param {DataBindingMap} map\r\n */\r\nDataDialogBinding.prototype.setResult = function ( map ) {\r\n\r\n\tif ( map instanceof DataBindingMap ) {\r\n\t\tthis._map = map;\r\n\t} else {\r\n\t\tthrow \"Invalid argument\";\r\n\t}\r\n}\r\n\r\n/**\r\n * DataDialogBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DataDialogBinding}\r\n */\r\nDataDialogBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:datadialog\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DataDialogBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/DataInputButtonBinding.js",
    "content": "﻿DataInputButtonBinding.prototype = new DataInputBinding;\r\nDataInputButtonBinding.prototype.constructor = DataInputButtonBinding;\r\nDataInputButtonBinding.superclass = DataInputBinding.prototype;\r\n\r\n/**\r\n* @class\r\n* @implements {IData}\r\n*/\r\nfunction DataInputButtonBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"DataInputButtonBinding\");\r\n\r\n\t/**\r\n\t* @type {ToolBarButtonBinding}\r\n\t*/\r\n\tthis._dialogButtonBinding = null;\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nDataInputButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DataInputButtonBinding]\";\r\n}\r\n\r\n/**\r\n* @overloads {DataInputBinding#onBindingAttach}\r\n*/\r\nDataInputButtonBinding.prototype.onBindingAttach = function () {\r\n\tDataInputButtonBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tif (this.hasCallBackID()) {\r\n\t\tBinding.dotnetify(this);\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n* Build button, build popup and populate by selection elements.\r\n* @overloads {DataInputBinding#_buildDOMContent}\r\n*/\r\nDataInputButtonBinding.prototype._buildDOMContent = function () {\r\n\r\n\tDataInputButtonBinding.superclass._buildDOMContent.call(this);\r\n\tthis.buildButton();\r\n}\r\n\r\n/**\r\n* Build button.\r\n*/\r\nDataInputButtonBinding.prototype.buildButton = function () {\r\n\r\n\tvar button = ToolBarButtonBinding.newInstance(this.bindingDocument);\r\n\tvar image = this.getProperty(\"image\");\r\n\tif (image != null) {\r\n\t\tbutton.setImage(image);\r\n\t} else {\r\n\t\tbutton.setImage(\"${icon:popup}\");\r\n\t}\r\n\tthis.addFirst(button);\r\n\tbutton.attach();\r\n\r\n\tvar self = this;\r\n\r\n\tbutton.oncommand = function () {\r\n\t\tself.dispatchAction(PageBinding.ACTION_DOPOSTBACK);\r\n\t}\r\n\r\n\tif (this.isReadOnly) {\r\n\t\tbutton.hide();\r\n\t}\r\n\r\n\tthis._dialogButtonBinding = button;\r\n};\r\n\r\n/**\r\n* Invoke dialog programatically.\r\n*/\r\nDataInputButtonBinding.prototype.oncommand = function () {\r\n\r\n\tvar button = this._dialogButtonBinding;\r\n\tif (button != null) {\r\n\t\tbutton.oncommand();\r\n\t}\r\n};\r\n\r\n/**\r\n* @param {boolean} isReadOnly\r\n* @overloads {DataInputBinding#_buildDOMContent}\r\n*/\r\nDataInputButtonBinding.prototype.setReadOnly = function (isReadOnly) {\r\n\r\n\tDataInputButtonBinding.superclass.setReadOnly.call(this, isReadOnly);\r\n\r\n\tvar button = this._dialogButtonBinding;\r\n\tif (button != null) {\r\n\t\tif (isReadOnly) {\r\n\t\t\tbutton.hide();\r\n\t\t} else {\r\n\t\t\tbutton.show();\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/DataInputDialogBinding.js",
    "content": "DataInputDialogBinding.prototype = new DataInputBinding;\r\nDataInputDialogBinding.prototype.constructor = DataInputDialogBinding;\r\nDataInputDialogBinding.superclass = DataInputBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction DataInputDialogBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DataInputDialogBinding\" );\r\n\t\r\n\t/**\r\n\t * ViewDefinition handle.\r\n\t * @type {string}\r\n\t */\r\n\tthis._handle = null;\r\n\t\r\n\t/**\r\n\t * @type {ToolBarButtonBinding}\r\n\t */\r\n\tthis._dialogButtonBinding = null;\r\n\t\r\n\t/**\r\n\t * Used to hack the input: No validation when while button is handled.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isButtonClicked = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDataInputDialogBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[DataInputDialogBinding]\";\r\n}\r\n\r\n/**\r\n * Build button, build popup and populate by selection elements.\r\n * @overloads {DataInputBinding#_buildDOMContent}\r\n */\r\nDataInputDialogBinding.prototype._buildDOMContent = function () {\r\n\t \r\n\tDataInputSelectorBinding.superclass._buildDOMContent.call ( this );\r\n\tthis.buildButton ();\r\n}\r\n\r\n/**\r\n * Build button.\r\n */\r\nDataInputDialogBinding.prototype.buildButton = function () {\r\n\r\n\tvar button = ToolBarButtonBinding.newInstance(this.bindingDocument);\r\n\tbutton.setImage(\"${icon:popup}\");\r\n\tthis.addFirst(button);\r\n\tbutton.attach();\r\n\r\n\tvar self = this;\r\n\r\n\tbutton.oncommand = function () {\r\n\r\n\t\tself._isButtonClicked = true;\r\n\t\tsetTimeout(function () {\r\n\t\t\tself._isButtonClicked = false;\r\n\t\t}, 1000);\r\n\r\n\r\n\t\tvar definition = self.getDefinition();\r\n\r\n\t\tif (definition instanceof DialogViewDefinition) {\r\n\r\n\t\t\tdefinition.handler = {\r\n\t\t\t\thandleDialogResponse: function (response, result) {\r\n\t\t\t\t\tself._isButtonClicked = false;\r\n\t\t\t\t\tif (response == Dialog.RESPONSE_ACCEPT) {\r\n\r\n\t\t\t\t\t\tself.logger.debug(\"Usecase scenario was hardcoded into DataInputDialogBinding#buildButton\");\r\n\t\t\t\t\t\tvar value = result.getFirst();\r\n\t\t\t\t\t\tself.setValue(value); // SETUP SPECIFIC - THIS MAY NOT BE SO!!!!\r\n\t\t\t\t\t\tself.validate(true);\r\n\t\t\t\t\t\tself.checkDirty();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tself.focus();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tdefinition.argument.selectedResult = self.getValue();\r\n\t\t\tStageBinding.presentViewDefinition(definition);\r\n\r\n\t\t} else {\r\n\t\t\tthrow \"Definition was either undefine or of a non-dialog type.\";\r\n\t\t}\r\n\t}\r\n\r\n\tDOMEvents.addEventListener(button.getBindingElement(), DOMEvents.MOUSEDOWN, {\r\n\t\thandleEvent: function (e) {\r\n\t\t\tself._isButtonClicked = true;\r\n\t\t}\r\n\t});\r\n\tthis._dialogButtonBinding = button;\r\n};\r\n\r\n/**\r\n * Get definition to invoke.\r\n */\r\nDataInputDialogBinding.prototype.getDefinition = function () {\r\n\r\n\tvar handle = this.getProperty(\"handle\");\r\n\r\n\tvar definition = ViewDefinition.clone(\r\n\t\thandle,\r\n\t\t\"Generated.ViewDefinition.Handle.\" + KeyMaster.getUniqueKey()\r\n\t);\r\n\r\n\treturn definition;\r\n};\r\n\r\n\r\n/**\r\n * Invoke dialog programatically.\r\n */\r\nDataInputDialogBinding.prototype.oncommand = function () {\r\n\t\r\n\tvar button = this._dialogButtonBinding;\r\n\tif ( button != null ) {\r\n\t\tbutton.oncommand ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Hack to circumvent validation while dialog is handled.\r\n * @param {boolean} arg\r\n * @overloads {DataInputBinding#validate}\r\n */\r\nDataInputDialogBinding.prototype.validate = function ( arg ) {\r\n\t\r\n\tvar result = true;\r\n\tif ( this._isButtonClicked == true ) {\r\n\t\tthis._isButtonClicked = false;\r\n\t} else {\r\n\t\tresult = DataInputDialogBinding.superclass.validate.call ( this, arg );\r\n\t}\r\n\treturn result;\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/HTMLDataDialogBinding.js",
    "content": "HTMLDataDialogBinding.prototype = new PostBackDataDialogBinding;\r\nHTMLDataDialogBinding.prototype.constructor = HTMLDataDialogBinding;\r\nHTMLDataDialogBinding.superclass = PostBackDataDialogBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * This will open a {@link WysiwygEditorBinding} in a dialog.\r\n */\r\nfunction HTMLDataDialogBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"HTMLDataDialogBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nHTMLDataDialogBinding.prototype.toString = function () {\r\n\r\n\treturn \"[HTMLDataDialogBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {StringDataDialogBinding#onBindingAttach}\r\n */\r\nHTMLDataDialogBinding.prototype.onBindingAttach = function () {\r\n\r\n\tif ( this.getProperty ( \"label\" ) == null ) {\r\n\t\tthis.setProperty ( \"label\", \"Edit HTML\" ); // TODO: stringbundle this!\r\n\t}\r\n\tHTMLDataDialogBinding.superclass.onBindingAttach.call ( this );\r\n}\r\n\r\n/**\r\n * @overwrites {DataDialogBinding#fireCommand}\r\n */\r\nHTMLDataDialogBinding.prototype.fireCommand = function () {\r\n\r\n\tthis.dispatchAction ( DataDialogBinding.ACTION_COMMAND );\r\n\r\n\t/*\r\n\t * Build argument for editor configuration.\r\n\t */\r\n\tvar argument = {\r\n\t\tlabel : DataBinding.getAssociatedLabel ( this ),\r\n\t\tvalue : decodeURIComponent ( this.getValue ()),\r\n\t\tconfiguration : {\r\n\t\t\t\"formattingconfiguration\"\t: this.getProperty ( \"formattingconfiguration\" ),\r\n\t\t\t\"embedablefieldstypenames\"  : this.getProperty ( \"embedablefieldstypenames\"),\r\n            \"previewtemplateid\"\t        : this.getProperty ( \"previewtemplateid\" ),\r\n            \"previewplaceholder\"\t    : this.getProperty ( \"previewplaceholder\" ),\r\n            \"previewpageid\"\t            : this.getProperty ( \"previewpageid\" )\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * The dialoghandler is defined by superclass.\r\n\t * @see {DataDialogBinding}\r\n\t */\r\n\tvar definition = ViewDefinitions [ \"Composite.Management.VisualEditorDialog\" ];\r\n\tdefinition.handler = this._handler;\r\n\tdefinition.argument = argument;\r\n\r\n\tStageBinding.presentViewDefinition ( definition , this);\r\n\r\n\tthis._releaseKeyboard ();\r\n}\r\n\r\nHTMLDataDialogBinding.prototype.getContextContainer = function () {\r\n\r\n\tvar result = null;\r\n\tif (this.getProperty(\"containerclasses\") != undefined) {\r\n\t\tvar ancestorContainer = ContextContainer.getAncestorContextContainer(this);\r\n\t\tresult = (ancestorContainer == null) ? new ContextContainer() : ancestorContainer.clone();\r\n\t\tresult.setContainerClasses(this.getProperty(\"containerclasses\"));\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/MultiSelectorDataDialogBinding.js",
    "content": "MultiSelectorDataDialogBinding.prototype = new DataDialogBinding;\r\nMultiSelectorDataDialogBinding.prototype.constructor = MultiSelectorDataDialogBinding;\r\nMultiSelectorDataDialogBinding.superclass = DataDialogBinding.prototype;\r\n\r\nMultiSelectorDataDialogBinding.ACTION_RESULT = \"multiselectordatadialog result\";\r\n\r\n/**\r\n * @class\r\n * This is intended for use by the {@link MultiSelectorBinding} as \r\n * an internal binding only. Don't use it for anything else.\r\n */\r\nfunction MultiSelectorDataDialogBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MultiSelectorDataDialogBinding\" );\r\n\t\r\n\t/**\r\n\t * Hardwired viewdefinition!\r\n\t * @overwrites {DataDialogBinding#_dialogViewHandle}\r\n\t * @type {string}\r\n\t */\r\n\tthis._dialogViewHandle = \"Composite.Management.MultiSelectorDialog\";\r\n\t\r\n\t/**\r\n\t * @overwrites {DataBinding#isFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = false;\r\n\t\r\n\t/**\r\n\t * This property is set by the MultiSelectorBinding.\r\n\t * @see {MultiSelectorBinding#_buildEditorButton}\r\n\t * @type {List<SelectorBindingSelection>}\r\n\t */\r\n\tthis.selections = null;\r\n\t \r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMultiSelectorDataDialogBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[MultiSelectorDataDialogBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {StringDataDialogBinding#onBindingAttach}\r\n */\r\nMultiSelectorDataDialogBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tthis.setProperty ( \"label\", StringBundle.getString ( \"ui\", \"Website.Misc.MultiSelector.LabelEditSelections\" ) );\r\n\tMultiSelectorDataDialogBinding.superclass.onBindingAttach.call ( this );\r\n}\r\n\r\n/**\r\n * @overwrites {DataDialogBinding#fireCommand}\r\n */\r\nMultiSelectorDataDialogBinding.prototype.fireCommand = function () {\r\n\t\r\n\tthis.dispatchAction ( DataDialogBinding.ACTION_COMMAND );\r\n\t\r\n\t/*\r\n\t * Build argument for selections editor.\r\n\t */\r\n\tvar argument = {\r\n\t\tlabel : DataBinding.getAssociatedLabel ( this ),\r\n\t\tselections : this.selections\r\n\t}\r\n\t\r\n\t/*\r\n\t * Build dialog handler. Action intercepted \r\n\t * by hosting MultiSelecotorBinding.\r\n\t */\r\n\tvar self = this;\r\n\tvar handler = {\r\n\t\thandleDialogResponse : function ( response, result ) {\r\n\t\t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t\t\t\tself.result = result;\r\n\t\t\t\tself.dispatchAction ( MultiSelectorDataDialogBinding.ACTION_RESULT );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * Launch dialog.\r\n\t */\r\n\tvar definition = ViewDefinitions [ this._dialogViewHandle ];\r\n\tdefinition.handler = handler;\r\n\tdefinition.argument = argument;\r\n\tStageBinding.presentViewDefinition ( definition );\r\n}\r\n\r\n/**\r\n * MultiSelectorDataDialogBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {MultiSelectorDataDialogBinding}\r\n */\r\nMultiSelectorDataDialogBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:datadialog\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, MultiSelectorDataDialogBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/NullPostBackDataDialogBinding.js",
    "content": "NullPostBackDataDialogBinding.prototype = new DataBinding;\r\nNullPostBackDataDialogBinding.prototype.constructor = NullPostBackDataDialogBinding;\r\nNullPostBackDataDialogBinding.superclass = DataBinding.prototype;\r\n\r\nNullPostBackDataDialogBinding.LABEL_NULL = \"(No selection)\";\r\nNullPostBackDataDialogBinding.LABEL_DEFAULT = \"Select\";\r\n\r\nNullPostBackDataDialogBinding.VALUE_NULL = \"null\";\r\nNullPostBackDataDialogBinding.VALUE_SELECTED = \"selected\";\r\n\r\nNullPostBackDataDialogBinding.ACTION_COMMAND = \"nullpostbackdatadialog command\";\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction NullPostBackDataDialogBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"NullPostBackDataDialogBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {ViewDefinitionPostBackDataDialogBinding}\r\n\t */\r\n\tthis._datathing = null;\r\n\t\r\n\t/**\r\n\t * @type {NullPostBackDataDialogSelectorBinding}\r\n\t */\r\n\tthis._selector = null;\r\n\t\r\n\t/**\r\n\t* Focus works on internal selecter\r\n\t* @overwrites {SelectorBinding#isFocusable}\r\n\t*/\r\n\tthis.isFocusable = false;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nNullPostBackDataDialogBinding.prototype.toString = function () {\r\n\r\n\treturn \"[NullPostBackDataDialogBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nNullPostBackDataDialogBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tNullPostBackDataDialogBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.propertyMethodMap [ \"label\" ] = this.setLabel;\r\n\tvar self = this;\r\n\tthis.propertyMethodMap [ \"value\" ] = function ( value ) {\r\n\t\tself._datathing.setValue ( value );\r\n\t};\r\n\tthis.propertyMethodMap [ \"selectorlabel\" ] = function () {\r\n\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\talert ( \"Selectorlabel property not supported yet!\" )\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis.addActionListener ( PageBinding.ACTION_DOPOSTBACK );\r\n\tthis._buildDataDialog ();\r\n\tthis._buildSelector ();\r\n}\r\n\r\n/**\r\n * Build PostBackDataDialogBinding.\r\n */\r\nNullPostBackDataDialogBinding.prototype._buildDataDialog = function () {\r\n\t\r\n\tthis._datathing = this.add ( ViewDefinitionPostBackDataDialogBinding.newInstance ( this.bindingDocument ));\r\n\t\r\n\t// transfer properties to datathing\r\n\tnew List ([ \"callbackid\", \"handle\", \"name\", \"providersearch\", \"providerkey\", \"value\" ]).each ( function ( prop ) {\r\n\t\tthis._datathing.setProperty ( prop, this.getProperty ( prop ));\r\n\t\tthis.setProperty ( prop, null );\r\n\t}, this );\r\n\t\r\n\tvar self = this;\r\n\tthis._datathing.ondialogcancel = function () {\r\n\t\tvar value = self.getValue (); \r\n\t\tif ( value == \"\" || value == null ) {\r\n\t\t\tself._selector.setLabel ( NullPostBackDataDialogBinding.LABEL_NULL );\r\n\t\t} else {\r\n\t\t\tself._selector.setLabel ( self.getLabel ());\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis._datathing.hide ();\r\n\tthis._datathing.attach ();\r\n}\r\n\r\n/**\r\n * Build selector thingy.\r\n */\r\nNullPostBackDataDialogBinding.prototype._buildSelector = function () {\r\n\r\n\tthis._selector = this.add ( NullPostBackDataDialogSelectorBinding.newInstance ( this.bindingDocument ));\r\n\t\r\n\tvar value = this.getProperty ( \"value\" );\r\n\tvar label = this.getProperty ( \"selectorlabel\" );\r\n\t\r\n\tif ( label == null ) {\r\n\t\tlabel = NullPostBackDataDialogBinding.LABEL_DEFAULT;\r\n\t}\r\n\t\r\n\tvar list = new List ();\r\n\tlist.add ( \r\n\t\tnew SelectorBindingSelection ( \r\n\t\t\tNullPostBackDataDialogBinding.LABEL_NULL, \r\n\t\t\tNullPostBackDataDialogBinding.VALUE_NULL,\r\n\t\t\tvalue == null\r\n\t\t)\r\n\t);\r\n\tlist.add ( \r\n\t\tnew SelectorBindingSelection (\r\n\t\t\tlabel + LabelBinding.DIALOG_INDECATOR_SUFFIX, \r\n\t\t\tNullPostBackDataDialogBinding.VALUE_SELECTED,\r\n\t\t\tvalue != null,\r\n\t\t\tnew ImageProfile ({\r\n\t\t\t\timage : \"${icon:popup}\"\r\n\t\t\t})\r\n\t\t)\r\n\t);\r\n\t\r\n\tthis._selector.master = this;\r\n\tthis._selector.attach ();\r\n\tthis._selector.populateFromList ( list );\r\n\t\r\n\t// override label from default selection!\r\n\tvar value = this.getValue (); \r\n\tif ( value == \"\" || value == null ) {\r\n\t\tthis._selector.setLabel ( NullPostBackDataDialogBinding.LABEL_NULL );\r\n\t} else {\r\n\t\tthis._selector.setLabel ( this.getLabel ());\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionHandler}\r\n * @param {Action} action\r\n */\r\nNullPostBackDataDialogBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tNullPostBackDataDialogBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase PageBinding.ACTION_DOPOSTBACK :\r\n\t\t\tif ( action.target == this._datathing ) {\r\n\t\t\t\t\r\n\t\t\t\t// we are waiting for server \r\n\t\t\t\t// to update label property...\r\n\t\t\t\t\r\n\t\t\t\tvar label = this.getProperty ( \"label\" );\r\n\t\t\t\tthis._selector.setLabel ( \"\" );\r\n\t\t\t\tthis.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * ... but if user selected the SAME item, the \r\n\t\t\t\t * UpdateManager sees no update and we must \r\n\t\t\t\t * manually restore the old label. This should \r\n\t\t\t\t * be moved to an evented setup at some point... \r\n\t\t\t\t */\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tif ( self.getProperty ( \"label\" ) == label ) {\r\n\t\t\t\t\t\tself._selector.setLabel ( label );\r\n\t\t\t\t\t}\r\n\t\t\t\t}, 500 );\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\tvar value = this._datathing.getValue ();\r\n\t\t\t\tvar label = decodeURIComponent ( value );\r\n\t\t\t\t\r\n\t\t\t\tthis._selector.setLabel ( label );\r\n\t\t\t\tthis._selector.setToolTip ( label );\r\n\t\t\t\tthis.setValue ( value );\r\n\t\t\t\t*/\r\n\t\t\t\t\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {String}\r\n */\r\nNullPostBackDataDialogBinding.prototype.getLabel = function () {\r\n\t\r\n\treturn this.getProperty ( \"label\" );\r\n}\r\n\r\n/**\r\n * @param {String} label\r\n */\r\nNullPostBackDataDialogBinding.prototype.setLabel = function ( label ) {\r\n\t\r\n\tthis.setProperty ( \"label\", label );\r\n\tif ( this._selector != null ) {\r\n\t\tthis._selector.setLabel ( label );\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {String}\r\n */\r\nNullPostBackDataDialogBinding.prototype.getValue = function () {\r\n\t\r\n\treturn this._datathing.getValue ();\r\n}\r\n\r\n/**\r\n * @param {String} value\r\n */\r\nNullPostBackDataDialogBinding.prototype.setValue = function ( value ) {\r\n\t\r\n\tthis._datathing.setValue ( value );\r\n\tthis.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n}\r\n\r\nNullPostBackDataDialogBinding.prototype.action = function () {\r\n    new List([\"selectedtoken\"]).each(function (prop) {\r\n        this._datathing.setProperty(prop, this.getProperty(prop));\r\n    }, this);\r\n\tthis._datathing.fireCommand ();\r\n}\r\n\r\n\r\n// MUST IMPLEMENT! .............................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nNullPostBackDataDialogBinding.prototype.validate = function () {\r\n\t\r\n\treturn true;\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nNullPostBackDataDialogBinding.prototype.manifest = function () {}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nNullPostBackDataDialogBinding.prototype.getResult = function () {}\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} value\r\n */\r\nNullPostBackDataDialogBinding.prototype.setResult = function () {}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/NullPostBackDataDialogSelectorBinding.js",
    "content": "NullPostBackDataDialogSelectorBinding.prototype = new SelectorBinding;\r\nNullPostBackDataDialogSelectorBinding.prototype.constructor = NullPostBackDataDialogSelectorBinding;\r\nNullPostBackDataDialogSelectorBinding.superclass = SelectorBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction NullPostBackDataDialogSelectorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"NullPostBackDataDialogSelectorBinding\" );\r\n\r\n\t/**\r\n\t * @type {NullPostBackDataDialogBinding}\r\n\t */\r\n\tthis.master = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nNullPostBackDataDialogSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[NullPostBackDataDialogSelectorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {SelectorBinding#select}\r\n * @param {MenuItemBinding} itemBinding\r\n * @param {boolean} isActionBlocked True while initializing to block action.\r\n * @return {boolean} True if something (new) was selected\r\n */\r\nNullPostBackDataDialogSelectorBinding.prototype.select = function ( itemBinding, isActionBlocked ) {\r\n\r\n\tif ( NullPostBackDataDialogSelectorBinding.superclass.select.call ( this, itemBinding, true )) {\r\n\t\tthis._buttonBinding.setImage ( null );\r\n\t\tthis._updateImageLayout ();\r\n\t\tif ( this._selectionValue == NullPostBackDataDialogBinding.VALUE_SELECTED ) {\r\n\t\t\tif ( this.master.getValue () != null ) {\r\n\t\t\t\t\r\n\t\t\t\t//this._buttonBinding.setLabel ( this.master.getLabel ());\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nNullPostBackDataDialogSelectorBinding.prototype.setLabel = function ( label ) {\r\n\t\r\n\tthis._buttonBinding.setLabel ( label );\r\n}\r\n\r\nNullPostBackDataDialogSelectorBinding.prototype.setToolTip = function ( tooltip ) {\r\n\t\r\n\tthis._buttonBinding.setToolTip ( tooltip );\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {SelectorBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nNullPostBackDataDialogSelectorBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tNullPostBackDataDialogSelectorBinding.superclass.handleAction.call ( this, action )\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\t\t\tvar menuitem = action.target;\r\n\t\t\tvar master = this.master;\r\n\t\t\tif ( menuitem.selectionValue == NullPostBackDataDialogBinding.VALUE_SELECTED ) {\r\n\t\t\t\tthis.setLabel ( menuitem.getLabel ());\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tmaster.action ();\r\n\t\t\t\t}, 0 );\r\n\t\t\t} else {\r\n\t\t\t    if (master.getValue()) {\r\n\t\t\t        master.dirty();\r\n\t\t\t    }\r\n\t\t\t    master.setValue(\"\");\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overwrites {SelectorBinding#manifest}\r\n */\r\nNullPostBackDataDialogSelectorBinding.prototype.manifest = function () {\r\n\t\r\n\t// do nothing\r\n}\r\n\r\n/**\r\n * NullPostBackDataDialogSelectorBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {NullPostBackDataDialogSelectorBinding}\r\n */\r\nNullPostBackDataDialogSelectorBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:selector\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, NullPostBackDataDialogSelectorBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/PostBackDataDialogBinding.js",
    "content": "PostBackDataDialogBinding.prototype = new DataDialogBinding;\r\nPostBackDataDialogBinding.prototype.constructor = PostBackDataDialogBinding;\r\nPostBackDataDialogBinding.superclass = DataDialogBinding.prototype;\r\n\r\nPostBackDataDialogBinding.ACTION_COMMAND = \"postbackdialog command\";\r\n\r\n/**\r\n * Engineered to carry a single string value.\r\n */\r\nfunction PostBackDataDialogBinding () {\r\n    \r\n    /**\r\n     * @type {DOMElement}\r\n     */\r\n    this.input = null;\r\n    \r\n    /*\r\n     * Returnable.\r\n     */\r\n    return this;\r\n}\r\n\r\n/**\r\n * Overloads {@link Binding#onBindingAttach}\r\n */\r\nPostBackDataDialogBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tPostBackDataDialogBinding.superclass.onBindingAttach.call ( this ); \r\n\t\r\n\tBinding.dotnetify ( this );\r\n\t\r\n\tvar self = this;\r\n\tthis._handler = {\r\n    \thandleDialogResponse : function ( response, result ) {\r\n    \t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n    \t\t\tself._onDialogAccept ( result );\r\n    \t\t} else {\r\n    \t\t\tself._onDialogCancel ();\r\n    \t\t}\r\n    \t}\r\n    }\r\n}\r\n\r\n/**\r\n * @param {WHAT?} result THIS CAN BE A LIST (TREESELECTORS) PLEAR CLEAR THIS UP!\r\n * @returns\r\n */\r\nPostBackDataDialogBinding.prototype._onDialogAccept = function ( result ) {\r\n\t\r\n\tresult = new String ( result );\r\n\t\r\n\tthis.dirty ();\r\n\tthis.setValue(encodeURIComponent(result));\r\n\tthis.validate(true);\r\n\t\r\n\tvar self = this;\r\n    setTimeout ( function () { // close dialog first!\r\n    \tif ( self.ondialogaccept != null ) {\r\n    \t\tself.ondialogaccept ();\r\n    \t}\r\n    \tself.dispatchAction( PageBinding.ACTION_DOPOSTBACK ); \r\n\t}, 0 );\r\n};\r\n\r\nPostBackDataDialogBinding.prototype._onDialogCancel = function () {\r\n\t\r\n\tif ( this.ondialogcancel != null ) {\r\n\t\tthis.ondialogcancel ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Get that URL. The URL must follow our plan, which is to have an url \r\n * property \"hello?hey=\" to which we append the VALUE of the control, \r\n * \"howdy\", order to launch the dialog residing on the url \"hello?hey=howdy\".  \r\n * @overwrites {DataDialogBinding#getURL}\r\n */\r\nPostBackDataDialogBinding.prototype.getURL = function () {\r\n\r\n\tvar url = this.getProperty ( \"url\" );\r\n\tvar suf = this.getValue(); // encodeURIComponent now on server!\r\n\tif (suf == null)\r\n\t\tsuf = this.getProperty(\"defaultValue\");\r\n\treturn new String ( url + suf );\r\n}\r\n\r\n/**\r\n * @overwrites {DataDialogBinding#manifest}\r\n * @implements {IData}\r\n */\r\nPostBackDataDialogBinding.prototype.manifest = function () {\r\n\t\r\n\tvar value = this.getValue ();\r\n\tif ( value == null ) {\r\n\t\tvalue = \"\";\r\n\t}\r\n\tthis.shadowTree.dotnetinput.value = value;\r\n};\r\n\r\n/**\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nPostBackDataDialogBinding.prototype.setValue = function ( value ) {\r\n\t\r\n\tthis.setProperty ( \"value\", value );\r\n};\r\n\r\n/**\r\n * @overwrites {DataDialogBinding#getValue}\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nPostBackDataDialogBinding.prototype.getValue = function () {\r\n\t\r\n\treturn this.getProperty ( \"value\" );\r\n};\r\n\r\n/**\r\n * NOT FOR CLIENTSIDE USE.\r\n * @overwrites {DataDialogBinding#getResult}\r\n * @implements {IData}\r\n */\r\nPostBackDataDialogBinding.prototype.getResult = function () {\r\n\t\r\n\treturn null;\r\n};\r\n\r\n/**\r\n * NOT FOR CLIENTSIDE USE.\r\n * @overwrites {DataDialogBinding#setResult}\r\n * @param {String} result\r\n * @implements {IData}\r\n */\r\nPostBackDataDialogBinding.prototype.setResult = function ( result ) {};\r\n\r\n/**\r\n * PostBackDataDialogBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {PostBackDataDialogBinding}\r\n */\r\nPostBackDataDialogBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:postbackdialog\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, PostBackDataDialogBinding );\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/StringDataDialogBinding.js",
    "content": "StringDataDialogBinding.prototype = new DataDialogBinding;\r\nStringDataDialogBinding.prototype.constructor = StringDataDialogBinding;\r\nStringDataDialogBinding.superclass = DataDialogBinding.prototype;\r\n\r\n/**\r\n * Engineered to carry a single string value.\r\n * @deprecated\r\n */\r\nfunction StringDataDialogBinding () {\r\n    \r\n    /**\r\n     * @type {DOMElement}\r\n     */\r\n    this.input = null;\r\n    \r\n    /*\r\n     * Returnable.\r\n     */\r\n    return this;\r\n}\r\n\r\n/**\r\n * Overloads {@link Binding#onBindingAttach}\r\n */\r\nStringDataDialogBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tStringDataDialogBinding.superclass.onBindingAttach.call ( this ); \r\n\t\r\n\tthis.input = this.getChildElementsByLocalName ( \"input\" ).getFirst ();\r\n\t\r\n\t// alert ( \"DEPRECATED: \" + this.toString () + \": \" + input.name );\r\n\t\r\n\tif ( this.input != null ) {\r\n\t\t\r\n\t\t/**\r\n\t\t * Special label setup.\r\n\t\t */\r\n\t    this._setLabelSpeialSetup ();\r\n\t    \r\n\t    /*\r\n\t     * Construct a custom dialog handler. Cannot be done in constructor \r\n\t     * (as first implemented) because we need to subclass.\r\n\t     */\r\n\t    var self = this;\r\n\t    \r\n\t    /**\r\n\t     * @overwrites {DataDialogBinding#_handler}\r\n\t\t * @type {IDialogResponseHandler}\r\n\t\t */\r\n\t    this._handler = {\r\n\t    \thandleDialogResponse : function ( response, result ) {\r\n\t    \t\tif ( response == Dialog.RESPONSE_ACCEPT ) {\r\n\t    \t\t\tself._onDialogAccept ( result );\r\n\t    \t\t} else {\r\n\t    \t\t\tself._onDialogCancel ();\r\n\t    \t\t}\r\n\t    \t}\r\n\t    }\r\n\t} else {\r\n\t\tthrow \"Missing input element!\";\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {WHAT?} result THIS CAN BE A LIST (TREESELECTORS) PLEAR CLEAR THIS UP!\r\n * @returns\r\n */\r\nStringDataDialogBinding.prototype._onDialogAccept = function ( result ) {\r\n\t\r\n\tresult = new String ( result );\r\n\tif ( this.input.value != result ) {\r\n\t\tthis.dispatchAction( Binding.ACTION_DIRTY );\r\n\t}\r\n\tthis.input.value = result; // SHOULD THIS BE result.getFirst () ???\r\n\tthis._setLabelSpeialSetup ();\r\n\tif ( this.getCallBackID () != null ) {\r\n\t\tvar self = this;\r\n\t    setTimeout ( function () {\r\n\t    \tself.dispatchAction( PageBinding.ACTION_DOPOSTBACK );\r\n\t\t}, 0 );\r\n\t}\r\n};\r\n\r\nStringDataDialogBinding.prototype._onDialogCancel = function () {};\r\n\r\n/**\r\n * Get that URL. This is highly specialized for backend purposes. \r\n * URL parameters have been embedded in the hidden input element.\r\n * @overwrites {DataDialogBinding#getURL}\r\n */\r\nStringDataDialogBinding.prototype.getURL = function () {\r\n\r\n\tvar url = this.getProperty ( \"url\" );\r\n\tvar suf = encodeURIComponent ( this.input.value );\r\n\treturn new String ( url + suf );\r\n}\r\n\r\n/**\r\n * @overwrites {DataDialogBinding#manifest}\r\n * @implements {IData}\r\n */\r\nStringDataDialogBinding.prototype.manifest = function () {\r\n\t\r\n\t// do nothing\r\n};\r\n\r\n/**\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nStringDataDialogBinding.prototype.setValue = function ( value ) {\r\n\t\r\n\tthis.input.value = value;\r\n};\r\n\r\n/**\r\n * @overwrites {DataDialogBinding#getValue}\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nStringDataDialogBinding.prototype.getValue = function () {\r\n\t\r\n\treturn this.input.value;\r\n};\r\n\r\n/**\r\n * Special label setup.\r\n */\r\nStringDataDialogBinding.prototype._setLabelSpeialSetup = function () {\r\n\r\n    if ( this.input.value == \"\" && this.getProperty ( \"label-onempty\" ) ) {\r\n        this._buttonBinding.setLabel ( this.getProperty ( \"label-onempty\" ) );\r\n    } else {\r\n        this._buttonBinding.setLabel ( this.getProperty ( \"label\" ) );\r\n    }\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/TreeSelectorDialogBinding.js",
    "content": "TreeSelectorDialogBinding.prototype = new DataInputDialogBinding;\nTreeSelectorDialogBinding.prototype.constructor = TreeSelectorDialogBinding;\nTreeSelectorDialogBinding.superclass = DataInputDialogBinding.prototype;\n\n/**\n* @class\n* @implements {IData}\n*/\nfunction TreeSelectorDialogBinding() {\n\n\t/**\n\t* @type {SystemLogger}\n\t*/\n\tthis.logger = SystemLogger.getLogger(\"TreeSelectorDialogBinding\");\n\n\t/**\n\t* @type {LabelBinding}\n\t*/\n\tthis.labelBinding = null;\n\n\n}\n\n/**\n* Identifies binding.\n*/\nTreeSelectorDialogBinding.prototype.toString = function () {\n\n\treturn \"[TreeSelectorDialogBinding]\";\n}\n\n/**\n * Get definition to invoke.\n * @overloads {DataInputDialogBinding#getDefinition}\n */\nTreeSelectorDialogBinding.prototype.getDefinition = function () {\n\n\tvar definition = ViewDefinition.clone(\n\t\t\"Composite.Management.TreeSelectorDialog\",\n\t\t\"Generated.ViewDefinition.Handle.\" + KeyMaster.getUniqueKey()\n\t);\n\tdefinition.argument.selectionProperty = this.getProperty(\"selection-property\");\n\tdefinition.argument.selectionValue = this.getProperty(\"selection-value\");\n\tdefinition.argument.selectionResult = this.getProperty(\"selection-result\");\n\tdefinition.argument.nodes = [\n\t\t{\n\t\t\tkey: this.getProperty(\"element-provider\"),\n\t\t\tsearch: this.getProperty('serialized-search-token')\n\t\t}\n\t];\n\n\treturn definition;\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/UrlInputDialogBinding.js",
    "content": "﻿UrlInputDialogBinding.prototype = new DataInputDialogBinding;\r\nUrlInputDialogBinding.prototype.constructor = UrlInputDialogBinding;\r\nUrlInputDialogBinding.superclass = DataInputDialogBinding.prototype;\r\n\r\nUrlInputDialogBinding.URL_SELECTED = \"input link selected\";\r\n\r\n/**\r\n* @class\r\n* @implements {IData}\r\n*/\r\nfunction UrlInputDialogBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"UrlInputDialogBinding\");\r\n\r\n\t/**\r\n\t* @type {ToolBarButtonBinding}\r\n\t*/\r\n\tthis.editButtonBinding = null;\r\n\r\n\t/**\r\n\t* @type {LabelBinding}\r\n\t*/\r\n\tthis.labelBinding = null;\r\n\r\n\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nUrlInputDialogBinding.prototype.toString = function () {\r\n\r\n\treturn \"[UrlInputDialogBinding]\";\r\n}\r\n\r\n/**\r\n* @overloads {Binding#onBindingRegister}\r\n*/\r\nUrlInputDialogBinding.prototype.onBindingRegister = function () {\r\n\r\n\tUrlInputDialogBinding.superclass.onBindingRegister.call(this);\r\n\tthis.addActionListener(PageBinding.ACTION_DOPOSTBACK);\r\n};\r\n\r\n/**\r\n* Build button, build popup and populate by selection elements.\r\n* @overloads {DataInputBinding#_buildDOMContent}\r\n*/\r\nUrlInputDialogBinding.prototype._buildDOMContent = function () {\r\n\r\n\tUrlInputDialogBinding.superclass._buildDOMContent.call(this);\r\n\r\n}\r\n\r\n\r\n\r\n/**\r\n* Build button.\r\n*/\r\nUrlInputDialogBinding.prototype.buildButtonAndLabel = function () {\r\n\r\n\t/*\r\n\t* Build the label.\r\n\t*/\r\n\tif (this.shadowTree.labelInput == null) {\r\n\r\n\t\tthis.shadowTree.labelInput = DOMUtil.createElementNS(Constants.NS_XHTML, \"input\", this.bindingDocument);\r\n\t\tthis.shadowTree.box.appendChild(this.shadowTree.labelInput);\r\n\t\tthis.shadowTree.labelInput.style.display = \"none\";\r\n\t\tthis.shadowTree.labelInput.readOnly = true;\r\n\r\n\t\tvar self = this;\r\n\t\t\r\n\t\tDOMEvents.addEventListener(this.shadowTree.labelInput, DOMEvents.DOUBLECLICK, {\r\n\t\t\thandleEvent: function (e) {\r\n\t\t\t\tself.clearLabel();\r\n\t\t\t\tself.focus();\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\t/*\r\n\t* Build the edit button.\r\n\t*/\r\n\tif (this.editButtonBinding == null) {\r\n\r\n\t\tvar button = ToolBarButtonBinding.newInstance(this.bindingDocument);\r\n\t\tbutton.setImage(\"${icon:editor-sourceview}\");\r\n\t\tbutton.bindingElement.style.left = \"3px\";\r\n\t\tbutton.bindingElement.style.width = \"29px\";\r\n\t\tthis.addFirst(button);\r\n\t\tbutton.attach();\r\n\t\tbutton.hide();\r\n\r\n\t\tvar self = this;\r\n\r\n\t\tbutton.oncommand = function () {\r\n\t\t\tself.clearLabel();\r\n\t\t\tself.focus();\r\n\t\t}\r\n\r\n\t\tthis.editButtonBinding = button;\r\n\t}\r\n};\r\n\r\n\r\n/**\r\n* OnBlur event\r\n* @overloads {DataInputBinding#onblur}\r\n*/\r\nUrlInputDialogBinding.prototype.onblur = function () {\r\n\r\n\tUrlInputDialogBinding.superclass.onblur.call(this);\r\n\tthis.setValue(this.getValue());\r\n}\r\n\r\n/**\r\n* Set value.\r\n* @param {String} value\r\n* @overloads {DataInputBinding#setValue}\r\n*/\r\nUrlInputDialogBinding.prototype.setValue = function (value) {\r\n\r\n\tUrlInputDialogBinding.superclass.setValue.call(this, value);\r\n\r\n\tif (this.isAttached) {\r\n\r\n\t\tthis.compositeUrl = new Uri(value);\r\n\r\n\t\tif (this.compositeUrl.isMedia || this.compositeUrl.isPage || this.compositeUrl.isInternalUrl) {\r\n\t\t\tvar label = TreeService.GetCompositeUrlLabel(value);\r\n\t\t\tif (label != value) {\r\n\t\t\t\tthis.setLabel(label);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.clearLabel();\r\n\t\t}\r\n\t\tthis.dispatchAction(UrlInputDialogBinding.URL_SELECTED);\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n* Set Label for input\r\n* @param {String} value\r\n* @overloads {DataInputBinding#setValue}\r\n*/\r\nUrlInputDialogBinding.prototype.setLabel = function (label) {\r\n\r\n\tthis.buildButtonAndLabel();\r\n\r\n\tif (this.shadowTree.labelInput) {\r\n\t\tif (label) {\r\n\t\t\tthis.setReadOnly(true);\r\n\t\t\tthis.editButtonBinding.show();\r\n\t\t\tthis.shadowTree.input.style.display = \"none\";\r\n\t\t\tthis.shadowTree.labelInput.style.display = \"block\";\r\n\t\t\tthis.shadowTree.labelInput.value = label;\r\n\t\t} else {\r\n\t\t\tthis.setReadOnly(false);\r\n\t\t\tthis.editButtonBinding.hide();\r\n\t\t\tthis.shadowTree.input.style.display = \"block\";\r\n\t\t\tthis.shadowTree.labelInput.style.display = \"none\";\r\n\t\t} \r\n\t}\r\n}\r\n\r\n/**\r\n* Unset Label for input\r\n*/\r\nUrlInputDialogBinding.prototype.clearLabel = function () {\r\n\tthis.setLabel();\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/dialogs/ViewDefinitionPostBackDataDialogBinding.js",
    "content": "ViewDefinitionPostBackDataDialogBinding.prototype = new PostBackDataDialogBinding;\r\nViewDefinitionPostBackDataDialogBinding.prototype.constructor = ViewDefinitionPostBackDataDialogBinding;\r\nViewDefinitionPostBackDataDialogBinding.superclass = PostBackDataDialogBinding.prototype;\r\n\r\n/**\r\n * This fellow will clone a ViewDefinition while  \r\n * allowing user to modify search properties and more.\r\n */\r\nfunction ViewDefinitionPostBackDataDialogBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ViewDefinitionPostBackDataDialogBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nViewDefinitionPostBackDataDialogBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ViewDefinitionPostBackDataDialogBinding]\";\r\n}\r\n\r\n/**\r\n * Temporarliy modify the all-functions dialog definition.\r\n * @overloads {DataDialogBinding#fireCommand}\r\n */\r\nViewDefinitionPostBackDataDialogBinding.prototype.fireCommand = function () {\r\n\r\n\tvar label = this.getProperty(\"dialoglabel\");\r\n\tvar search = this.getProperty(\"providersearch\");\r\n\tvar key = this.getProperty(\"providerkey\");\r\n\tvar handle = this.getProperty(\"handle\");\r\n\tvar selectedToken = this.getProperty(\"selectedtoken\");\r\n\r\n\tif (handle != null) {\r\n\r\n\t\tvar def = ViewDefinition.clone(\r\n\t\t\thandle,\r\n\t\t\t\"Generated.ViewDefinition.Handle.\" + KeyMaster.getUniqueKey()\r\n\t\t);\r\n\r\n\t\t/*\r\n\t\t* Label\r\n\t\t*/\r\n\t\tif (label != null) {\r\n\t\t\tif (def.argument == null) {\r\n\t\t\t\tdef.argument = {};\r\n\t\t\t}\r\n\t\t\tdef.argument.label = label;\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* Search\r\n\t\t*/\r\n\t\tif (search != null) {\r\n\t\t\tif (def.argument == null) {\r\n\t\t\t\tdef.argument = {};\r\n\t\t\t}\r\n\t\t\tif (def.argument.nodes == null) {\r\n\t\t\t\tdef.argument.nodes = [];\r\n\t\t\t}\r\n\t\t\tdef.argument.nodes[0].search = search;\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* Key\r\n\t\t*/\r\n\t\tif (key != null) {\r\n\t\t\tif (def.argument == null) {\r\n\t\t\t\tdef.argument = {};\r\n\t\t\t}\r\n\t\t\tif (def.argument.nodes == null) {\r\n\t\t\t\tdef.argument.nodes = [];\r\n\t\t\t}\r\n\t\t\tdef.argument.nodes[0].key = key;\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* Token\r\n\t\t*/\r\n\t\tif (selectedToken != null) {\r\n\t\t\tif (def.argument == null) {\r\n\t\t\t\tdef.argument = {};\r\n\t\t\t}\r\n\t\t\tdef.argument.selectedToken = selectedToken;\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* Super\r\n\t\t*/\r\n\t\tViewDefinitionPostBackDataDialogBinding.superclass.fireCommand.call(this, def);\r\n\r\n\t} else {\r\n\t\tthrow \"Attribute \\\"handle\\\" required.\";\r\n\t}\r\n};\r\n\r\n/**\r\n * ViewDefinitionPostBackDataDialogBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ViewDefinitionPostBackDataDialogBinding}\r\n */\r\nViewDefinitionPostBackDataDialogBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:postbackdialog\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, ViewDefinitionPostBackDataDialogBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/editors/EditorDataBinding.js",
    "content": "EditorDataBinding.prototype = new WindowBinding;\r\nEditorDataBinding.prototype.constructor = EditorDataBinding;\r\nEditorDataBinding.superclass = WindowBinding.prototype;\r\n\r\n\r\n/**\r\n * This WindowBinding implements the DataBinding interface.\r\n * @implements {IData}\r\n * @class\r\n */\r\nfunction EditorDataBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorDataBinding\" );\r\n\t\r\n\t/**\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = false; // HUH?\r\n\t\r\n\t/**\r\n\t * Sublcasses will define this.\r\n\t * @type {string}\r\n\t */\r\n\tthis._url = WindowBinding.DEFAULT_URL;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorDataBinding.prototype.toString = function () {\r\n\r\n\treturn \"[EditorDataBinding]\";\r\n};\r\n\r\n/**\r\n * @overloads {WindowBinding#onBindingRegister}\r\n * @overloads {DataBinding#onBindingRegister}\r\n */\r\nEditorDataBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tEditorDataBinding.superclass.onBindingRegister.call ( this );\r\n\tDataBinding.prototype.onBindingRegister.call ( this );\r\n\t\r\n\t/*\r\n\t * Hide IE flash-of-white when loading.\r\n\t */\r\n\tthis._coverBinding = this.add ( \r\n\t\tCoverBinding.newInstance ( this.bindingDocument )\r\n\t).attach ();\r\n\t\r\n\tvar url = this._url;\r\n\tvar provider = this.getProperty ( \"stateprovider\" );\r\n\tvar handle = this.getProperty ( \"handle\" );\r\n\tif ( provider != null && handle != null ) {\r\n\t\turl = url.replace ( \"${stateprovider}\", provider ).replace ( \"${handle}\", handle );\r\n\t} else {\r\n\t\turl = url.split ( \"?\" )[ 0 ];\r\n\t}\r\n\tthis.logger.debug ( \"Loading URL: \" + url );\r\n\tthis.setURL ( url );\r\n};\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingAttach}\r\n */\r\nEditorDataBinding.prototype.onBindingAttach = function () {\r\n\r\n\tEditorDataBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.addActionListener ( Binding.ACTION_DIRTY );\r\n\tApplication.lock ( this ); // unlocked by method _onPageInitialize\r\n};\r\n\r\n/**\r\n * Unlock when contained page initializes.\r\n * @overloads {WindowBinding#_onPageInitialize}\r\n * @param {PageBinding} binding\r\n */\r\nEditorDataBinding.prototype._onPageInitialize = function ( binding ) {\r\n\t\r\n\tEditorDataBinding.superclass._onPageInitialize.call ( this, binding );\r\n\t\r\n\tif ( this._pageBinding != null ) {\r\n\t\tApplication.unlock ( this );\r\n\t\tthis._coverBinding.hide ();\r\n\t}\r\n} \r\n\r\n/**\r\n * TODO: Should this fellow be transferred to IData?\r\n * @param {String} name\r\n */\r\nEditorDataBinding.prototype.setName = DataBinding.prototype.setName;\r\n\r\n\r\n\r\n// IMPLEMENT IDATA ...........................................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nEditorDataBinding.prototype.validate = function () {\r\n\t\r\n\treturn this._pageBinding.validateAllDataBindings ();\r\n};\r\n\r\n/**\r\n * @overloads {WindowBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n */\r\nEditorDataBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tEditorDataBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\t/*\r\n\t * Collect dirty actions and assign them to myself. \r\n\t */\r\n\tswitch ( action.type ) {\r\n\t\tcase Binding.ACTION_DIRTY :\r\n\t\t\tif ( action.target != this ) {\r\n\t\t\t\tif ( !this.isDirty ) {\r\n\t\t\t\t\tthis.dirty ();\r\n\t\t\t\t}\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * This binding does not manifest itself in current context window, but it  \r\n * may instruct contained window to instigate a postback. Long story, but  \r\n * the return value will instruct the {PageBinding} to stop the press and wait.\r\n * @see {PageBinding#_setupDotNet}\r\n * @overloads {DataBinding#manifest}\r\n * @implements {IData}\r\n * @return {EditorDataBinding}\r\n */\r\nEditorDataBinding.prototype.manifest = function () {}\r\n\r\n/**\r\n * Pollute dirty flag. Note that the local DataManager is NOT informed about this \r\n * since the dirty event should not count as a real update to this.contextDocument. \r\n * This way, we know how to save only frames that were really updated... \r\n * @implements {IData}\r\n */\r\nEditorDataBinding.prototype.dirty = function () {\r\n\t\r\n\tif ( !this.isDirty ) {\r\n\t\tthis.isDirty = true;\r\n\t\tthis.dispatchAction ( Binding.ACTION_DIRTY );\r\n\t}\r\n}\r\n\r\n/**\r\n * Clean dirty flag. Note recursive iframe infiltration!\r\n * @implements {IData}\r\n */\r\nEditorDataBinding.prototype.clean = function () {\r\n\t\r\n\tthis._pageBinding.cleanAllDataBindings ();\r\n\tDataBinding.prototype.clean.call ( this );\r\n}\r\n\r\n/**\r\n * Focus.\r\n * @implements {IFocusable}\r\n */\r\nEditorDataBinding.prototype.focus = function () {\r\n\t\r\n\t// TODO: focus first focusable!!!!\r\n};\r\n\r\n/**\r\n * Blur.\r\n * @implements {IFocusable}\r\n */\r\nEditorDataBinding.prototype.blur = function () {};\r\n\r\n/**\r\n * Get name.\r\n * @return {string}\r\n */\r\nEditorDataBinding.prototype.getName = function () {};\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nEditorDataBinding.prototype.getValue = function () {};\r\n\r\n/**\r\n * Set value.\r\n * @implements {IData}\r\n * @param {string} value\r\n */\r\nEditorDataBinding.prototype.setValue = function ( value ) {};\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nEditorDataBinding.prototype.getResult = function () {\r\n\t\r\n\treturn null;\r\n};\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} result\r\n */\r\nEditorDataBinding.prototype.setResult = function ( result ) {};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/editors/FunctionEditorDataBinding.js",
    "content": "FunctionEditorDataBinding.prototype = new EditorDataBinding;\r\nFunctionEditorDataBinding.prototype.constructor = FunctionEditorDataBinding;\r\nFunctionEditorDataBinding.superclass = EditorDataBinding.prototype;\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FunctionEditorDataBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FunctionEditorDataBinding\" );\r\n\t\r\n\t/**\r\n\t * @overwrites {EditorDataBinding#_url}\r\n\t */\r\n\tthis._url = \"${root}/content/misc/editors/functioncalleditor/functioncalleditor.aspx?StateProvider=${stateprovider}&Handle=${handle}\";\r\n\t\r\n\t/**\r\n\t * @type {bool}\r\n\t */\r\n\tthis.hasBasic = false;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFunctionEditorDataBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FunctionEditorDataBinding]\";\r\n};\r\n\r\n\r\n/**\r\n * @overloads {FocusManagerBinding#onBindingAttach}\r\n */\r\nFunctionEditorDataBinding.prototype.onBindingAttach = function () {\r\n\r\n\tFunctionEditorDataBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tif (this.getProperty(\"hasbasic\"))\r\n\t\tthis.hasBasic = this.getProperty(\"hasbasic\");\r\n\r\n};\r\n\r\n/**\r\n * @overloads {WindowBinding#_onPageInitialize}\r\n * @param {PageBinding} binding\r\n */\r\nFunctionEditorDataBinding.prototype._onPageInitialize = function (binding) {\r\n\r\n\tFunctionEditorDataBinding.superclass._onPageInitialize.call(this, binding);\r\n\r\n\tif (this.hasBasic === false) {\r\n\t\tvar basicgroup = this.getContentWindow().bindingMap.basicgroup;\r\n\t\tif (basicgroup)\r\n\t\t\tbasicgroup.hide();\r\n\t}\r\n\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/editors/ParameterEditorDataBinding.js",
    "content": "ParameterEditorDataBinding.prototype = new EditorDataBinding;\r\nParameterEditorDataBinding.prototype.constructor = ParameterEditorDataBinding;\r\nParameterEditorDataBinding.superclass = EditorDataBinding.prototype;\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ParameterEditorDataBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ParameterEditorDataBinding\" );\r\n\t\r\n\t/**\r\n\t * @overwrites {EditorDataBinding#_url}\r\n\t */\r\n\tthis._url = \"${root}/controls/FormsControls/FormUiControlTemplates/DeveloperTools/FunctionParameterEditor.aspx?StateProvider=${stateprovider}&handle=${handle}\";\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nParameterEditorDataBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ParameterEditorDataBinding]\";\r\n};\r\n\r\n/**\r\n * @implements {IData}\r\n */\r\nParameterEditorDataBinding.prototype.getValue = function () {\r\n\t\r\n\treturn Math.random ();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/keyboard/DataInputBinding.js",
    "content": "DataInputBinding.prototype = new DataBinding;\r\nDataInputBinding.prototype.constructor = DataInputBinding;\r\nDataInputBinding.superclass = DataBinding.prototype;\r\n\r\n\r\nDataInputBinding.invalidXmlChar = /((?:[\\0-\\x08\\x0B\\f\\x0E-\\x1F\\uFFFD\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]))/g;\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction DataInputBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DataInputBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRequired = false;\r\n\r\n\t/**\r\n\t * @type {RegExp}\r\n\t */\r\n\tthis.expression = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isPassword = false;\r\n\r\n\t/**\r\n\t * Used to cache value while displaying error messages.\r\n\t * @type {string}\r\n\t */\r\n\tthis._value = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isValid = true;\r\n\r\n\t/**\r\n\t * When invalid, this property flags whether or not _testDirty\r\n\t * we are invalid because we are \"required\". Not to\r\n\t * be confused with isRequired.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isInvalidBecauseRequired = false;\r\n\r\n\t/**\r\n\t * True when invalid because contains invalid Xml Char.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isInvalidBecauseInvalidXmlChar = false;\r\n\r\n\t/**\r\n\t * The invalid Xml Char.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._invalidXmlChar = null;\r\n\r\n\t/**\r\n\t * True when invalid because of minlength.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isInvalidBecauseMinLength == true;\r\n\r\n\t/**\r\n\t * True when invalid because of minlength.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isInvalidBecauseMinLength == true;\r\n\r\n\t/**\r\n\t * True when invalid because of maxlength.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isInvalidBecauseMaxLength == true;\r\n\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis._sessionResult = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisabled = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isReadOnly = false;\r\n\r\n\t/**\r\n\t * @type {function}\r\n\t */\r\n\tthis._dirtyinterval = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isAutoSelect = false;\r\n\r\n\t/**\r\n\t * @type {integer}\r\n\t */\r\n\tthis.minlength = null;\r\n\r\n\t/**\r\n\t * @type {integer}\r\n\t */\r\n\tthis.maxlength = null;\r\n\r\n\t/**\r\n\t * Is autopostback?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isAutoPost = false;\r\n\r\n\t/**\r\n\t * Autopost timeout.\r\n\t * @type {function}\r\n\t */\r\n\tthis._timeout = null;\r\n\r\n\t/**\r\n\t * Autopost time (start when idle, reset onkeydown).\r\n\t * @type {int}\r\n\t */\r\n\tthis._time = 1500;\r\n\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters = new List([DocumentCrawler.ID, FocusCrawler.ID]);\r\n\r\n\r\n\t/**\r\n\t* Enable spellcheck?\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis.spellcheck = true;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDataInputBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DataInputBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingRegister}\r\n */\r\nDataInputBinding.prototype.onBindingRegister = function () {\r\n\r\n\tDataInputBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"value\" ] = this.setValue;\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingAttach}\r\n */\r\nDataInputBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDataInputBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tthis._parseDOMProperties ();\r\n\tthis._buildDOMContent ();\r\n\tthis._attachDOMEvents ();\r\n}\r\n\r\n/**\r\n * Disposing an invalid DataInputBinding will automatically\r\n * make it valid in the greater scheme of this.\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nDataInputBinding.prototype.onBindingDispose = function () {\r\n\r\n\tDataInputBinding.superclass.onBindingDispose.call ( this );\r\n\r\n\t//if ( Client.isExplorer && this.isFocused ) {\r\n\t//\tthis.unsubscribe ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN, this );\r\n\t//}\r\n\tif ( this._dirtyinterval ) {\r\n\t\twindow.clearInterval ( this._dirtyinterval );\r\n\t}\r\n\tif ( !this._isValid ) {\r\n\t\tthis.dispatchAction ( Binding.ACTION_VALID );\r\n\t}\r\n}\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nDataInputBinding.prototype._parseDOMProperties = function () {\r\n\r\n\tthis.type = this.getProperty(\"type\");\r\n\tthis.isRequired = this.getProperty(\"required\");\r\n\tthis.isPassword = this.getProperty(\"password\") == true;\r\n\tthis.minlength = this.getProperty(\"minlength\");\r\n\tthis.maxlength = this.getProperty(\"maxlength\");\r\n\tthis._isAutoPost = this.getProperty(\"autopost\") == true;\r\n\tthis.spellcheck = this.getProperty(\"spellcheck\") !== false;\r\n\tif (this.type == \"programmingidentifier\") this.spellcheck = false;\r\n\tif (this.type == \"programmingnamespace\") this.spellcheck = false;\r\n\r\n\t/*\r\n\t* Regular expression?\r\n\t*/\r\n\tvar regexrule = this.getProperty(\"regexrule\");\r\n\tif (regexrule != null) {\r\n\t\tthis.expression = new RegExp(regexrule)\r\n\t}\r\n\r\n\t/*\r\n\t* Here's a quick hack - we should probably formalize this.\r\n\t*/\r\n\tvar onblur = this.getProperty(\"onbindingblur\");\r\n\tif (onblur != null) {\r\n\t\tthis.onblur = function () {\r\n\t\t\tBinding.evaluate(onblur, this);\r\n\t\t};\r\n\t}\r\n\r\n\t/*\r\n\t* Here's another quick hack.\r\n\t*/\r\n\tvar onvaluechange = this.getProperty(\"onvaluechange\");\r\n\tif (onvaluechange != null) {\r\n\t\tthis.onValueChange = function () {\r\n\t\t\tBinding.evaluate(onvaluechange, this);\r\n\t\t};\r\n\t}\r\n\r\n\t/*\r\n\t* Certain types should present a default error (balloon). Specifying\r\n\t* the error *directly* on the binding will overwrite the default error.\r\n\t*/\r\n\tif (this.error == null && this.type != null) {\r\n\t\tvar error = DataBinding.errors[this.type];\r\n\t\tif (error != null) {\r\n\t\t\tthis.error = error;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nDataInputBinding.prototype._buildDOMContent = function () {\r\n\r\n\tthis.shadowTree.input = this._getInputElement();\r\n\tthis.shadowTree.box = DOMUtil.createElementNS(Constants.NS_UI, \"ui:box\", this.bindingDocument);\r\n\r\n\tif (Client.isExplorer == true) {\r\n\t\tthis.bindingElement.hideFocus = true;\r\n\t}\r\n\r\n\tvar value = this.getProperty(\"value\");\r\n\tif (value != null) {\r\n\t\tthis.setValue(String(value));\r\n\t}\r\n\r\n\tvar name = this.getProperty(\"name\");\r\n\tif (name != null) {\r\n\t\tthis.setName(name);\r\n\t}\r\n\r\n\tvar isDisabled = this.getProperty(\"isdisabled\");\r\n\tif (isDisabled == true) {\r\n\t\tthis.setDisabled(true);\r\n\t}\r\n\r\n\tvar isReadOnly = this.getProperty(\"readonly\");\r\n\tif (isReadOnly == true) {\r\n\t\tthis.setReadOnly(true);\r\n\t}\r\n\r\n\tvar isAutoSelect = this.getProperty(\"autoselect\");\r\n\tif (isAutoSelect == true) {\r\n\t\tthis._isAutoSelect = true;\r\n\t}\r\n\r\n\tthis.shadowTree.box.appendChild(\r\n\t\tthis.shadowTree.input\r\n\t);\r\n\r\n\tthis.bindingElement.appendChild(\r\n\t\tthis.shadowTree.box\r\n\t);\r\n\r\n\tvar placeholder = this.getProperty(\"placeholder\");\r\n\tif (placeholder) {\r\n\t\tthis.shadowTree.input.setAttribute(\"placeholder\", Resolver.resolve ( placeholder ));\r\n\t}\r\n\r\n\tif (this.spellcheck && Client.hasSpellcheck) {\r\n        var currentLang = Localization.currentLang();\r\n        var parentLangAttribute = null;\r\n        if (this.shadowTree.input.parentNode != null) {\r\n            if (this.shadowTree.input.parentNode.parentElement!=null) {\r\n                parentLangAttribute = this.shadowTree.input.parentNode.parentElement.getAttribute(\"lang\");\r\n\t        }\r\n        }\r\n\t\tif (parentLangAttribute != null) {\r\n\t\t\tthis.shadowTree.input.setAttribute(\"spellcheck\", \"true\");\r\n\t\t\tthis.shadowTree.input.setAttribute(\"lang\", parentLangAttribute);\r\n\t\t} else if (currentLang != null) {\r\n\t\t\tthis.shadowTree.input.setAttribute(\"spellcheck\", \"true\");\r\n\t\t\tthis.shadowTree.input.setAttribute(\"lang\", Localization.currentLang());\r\n\t\t} else {\r\n\t\t\tthis.shadowTree.input.setAttribute(\"spellcheck\", \"false\");\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tthis.shadowTree.input.setAttribute(\"spellcheck\", \"false\");\r\n\t}\r\n\r\n\tif (Localization.isRtl !== Localization.isUIRtl)\r\n\t{\r\n\t\tthis.shadowTree.input.setAttribute(\"dir\", Localization.isRtl?\"rtl\":\"ltr\");\r\n\t}\r\n\t/*\r\n\t* Setup ASP.NET identity.\r\n\t*/\r\n\tif (this.hasCallBackID()) {\r\n\t\t// Binding.dotnetify not needed - we already have an input element!\r\n\t} else if (this._isAutoPost) {\r\n\t\tthis.logger.warn(\"Autopost \" + this.toString() + \" without a callbackid?\");\r\n\t}\r\n}\r\n\r\n/**\r\n * Get input element! Isolated for subclasses to overwrite.\r\n * @return {HTMLInputElement}\r\n */\r\nDataInputBinding.prototype._getInputElement = function () {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_XHTML, \"input\", this.bindingDocument );\r\n\telement.type = this.isPassword == true ? \"password\" : \"text\";\r\n\telement.tabIndex = -1;\r\n\treturn element;\r\n}\r\n\r\n/**\r\n * Attach DOM events.\r\n */\r\nDataInputBinding.prototype._attachDOMEvents = function () {\r\n\r\n\tDOMEvents.addEventListener ( this.shadowTree.input, DOMEvents.FOCUS, this );\r\n\tDOMEvents.addEventListener ( this.shadowTree.input, DOMEvents.BLUR, this );\r\n\tDOMEvents.addEventListener ( this.shadowTree.input, DOMEvents.KEYDOWN, this );\r\n\tDOMEvents.addEventListener ( this.shadowTree.input, DOMEvents.KEYPRESS, this );\r\n\r\n\tDOMEvents.addEventListener ( this.shadowTree.input, DOMEvents.DRAGOVER, this);\r\n\tDOMEvents.addEventListener ( this.shadowTree.input, DOMEvents.DROP, this );\r\n\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {Event} e\r\n */\r\nDataInputBinding.prototype.handleEvent = function (e) {\r\n\r\n\tDataInputBinding.superclass.handleEvent.call(this, e);\r\n\r\n\tif (this.isFocusable == true) {\r\n\t\tswitch (e.type) {\r\n\t\t\tcase DOMEvents.DRAGOVER:\r\n\t\t\t\t// the dragover event needs to be canceled to allow firing the drop event\r\n\t\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\t\tbreak;\r\n\t\t\tcase DOMEvents.DROP:\r\n\t\t\t\tif (e.dataTransfer) {\r\n\t\t\t\t\tthis.setValue(e.dataTransfer.getData(\"Text\"));\r\n\t\t\t\t\tthis.checkDirty();\r\n\t\t\t\t\tthis.validate(true);\r\n\t\t\t\t}\r\n\t\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\t\tbreak;\r\n\t\t\tcase DOMEvents.FOCUS:\r\n\t\t\tcase DOMEvents.BLUR:\r\n\t\t\t\tthis._handleFocusAndBlur(e.type == DOMEvents.FOCUS);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase DOMEvents.KEYPRESS:\r\n\t\t\t\tswitch (e.keyCode) {\r\n\t\t\t\t\tcase KeyEventCodes.VK_BACK:\r\n\t\t\t\t\tcase KeyEventCodes.VK_INSERT:\r\n\t\t\t\t\tcase KeyEventCodes.VK_DELETE:\r\n\t\t\t\t\t\tthis._testDirty();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase DOMEvents.KEYDOWN:\r\n\r\n\t\t\t\tthis._testDirty();\r\n\r\n\t\t\t\tswitch (e.keyCode) {\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* Prevent ENTER from submitting containing form.\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tcase KeyEventCodes.VK_ENTER:\r\n\t\t\t\t\t\tthis._handleEnterKey(e);\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* Prevent ESC from reverting new value to original\r\n\t\t\t\t\t* value (we create input with JS, so our original\r\n\t\t\t\t\t* is empty). This behavior is seen in Explorer only.\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tcase KeyEventCodes.VK_ESCAPE:\r\n\t\t\t\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t* Autopost stuff.\r\n\t\t\t\t*/\r\n\t\t\t\tif (this.isFocusable && this._isAutoPost) {\r\n\t\t\t\t\tif (this._timeout != null) {\r\n\t\t\t\t\t\ttop.window.clearTimeout(this._timeout);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tthis._timeout = top.window.setTimeout(function () {\r\n\t\t\t\t\t\tif (Binding.exists(self)) {\r\n\t\t\t\t\t\t\tself.dispatchAction(PageBinding.ACTION_DOPOSTBACK);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, this._time);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle DOM focus and blur.\r\n * @param {boolean} isFocus\r\n */\r\nDataInputBinding.prototype._handleFocusAndBlur = function ( isFocus ) {\r\n\r\n\tif ( isFocus ) {\r\n\t\tthis.focus ( true );\r\n\t\tthis.bindingWindow.standardEventHandler.enableNativeKeys ();\r\n\t\t//if ( Client.isExplorer == true ) {\r\n\t\t//\tvar self = this;\r\n\t\t//\tsetTimeout ( function () {\r\n\t\t//\t\tif ( Binding.exists ( self ) == true ) {\r\n\t\t//\t\t\tself.subscribe ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN );\r\n\t\t//\t\t}\r\n\t\t//\t}, 0 );\r\n\t\t//}\r\n\t} else {\r\n\t\tthis.blur ( true );\r\n\t\tthis.bindingWindow.standardEventHandler.disableNativeKeys ();\r\n\t\t//if ( Client.isExplorer == true ) {\r\n\t\t//\tthis.unsubscribe ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN );\r\n\t\t//}\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle ENTER key, preventing form submit. Isolated so that subclasses can overwrite.\r\n * @param {KeyEvent} e\r\n */\r\nDataInputBinding.prototype._handleEnterKey = function ( e ) {\r\n\r\n\tDOMEvents.preventDefault ( e );\r\n\tDOMEvents.stopPropagation ( e );\r\n\tEventBroadcaster.broadcast ( BroadcastMessages.KEY_ENTER );\r\n}\r\n\r\n///**\r\n// * Due to some cataclysmic malfunction in Explorer, the input element may still\r\n// * be registered as document.activeElement when the help popup is opened - even\r\n// * though the focus is obviously lost! This setup will force it to blur. Don't\r\n// * enable this in Mozilla - it will cause stuff to loose focus spontaniously.\r\n// * @implements {IBroadcastListener}\r\n// * @param {string} broadcast\r\n// * @param {object} arg\r\n// */\r\n//DataInputBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n//\tDataInputBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n//\tvar self = this;\r\n\r\n//\tswitch ( broadcast ) {\r\n\r\n//\t\t/*\r\n//\t\t * The timeout allows another databinding to claim the focus first.\r\n//\t\t * Remember that the arg can be a Binding (untill we rafactor), so\r\n//\t\t * it actually doesn't make sanse that this operation doesn't fail.\r\n//\t\t */\r\n//\t\tcase BroadcastMessages.MOUSEEVENT_MOUSEDOWN :\r\n\r\n//\t\t\tif ( Client.isExplorer == true ) {\r\n//\t\t\t\tvar target = DOMEvents.getTarget ( arg );\r\n//\t\t\t\tif ( target != this.shadowTree.input ) {\r\n//\t\t\t\t\tsetTimeout ( function () {\r\n//\t\t\t\t\t\tif ( Binding.exists ( self ) == true ) {  // what devilship could require this?\r\n//\t\t\t\t\t\t\tif ( self.isFocused == true ) {\r\n//\t\t\t\t\t\t\t\tself.blur ();\r\n//\t\t\t\t\t\t\t}\r\n//\t\t\t\t\t\t}\r\n//\t\t\t\t\t}, 100 );\r\n//\t\t\t\t}\r\n//\t\t\t}\r\n//\t\t\tbreak;\r\n//\t}\r\n//}\r\n\r\n/**\r\n * Focus.\r\n * @overloads {DataBinding#focus}\r\n * @param {boolean} isDomEvent\r\n */\r\nDataInputBinding.prototype.focus = function ( isDomEvent ) {\r\n\r\n\tif ( !this.isFocused && !this.isReadOnly && !this.isDisabled ) {\r\n\t\tDataInputBinding.superclass.focus.call ( this );\r\n\t\tif ( this.isFocused == true ) {\r\n\t\t\tthis._focus ();\r\n\t\t\tif ( this._isAutoSelect == true ) {\r\n\t\t\t\tif ( isDomEvent ) {\r\n\t\t\t\t\tvar self = this, element = this.bindingElement, handler = {\r\n\t\t\t\t\t\thandleEvent : function () {\r\n\t\t\t\t\t\t\tself.select ();\r\n\t\t\t\t\t\t\tDOMEvents.removeEventListener ( element, DOMEvents.MOUSEUP, this );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tDOMEvents.addEventListener ( element, DOMEvents.MOUSEUP, handler );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.select ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.onfocus ();\r\n\t\t\tif ( !isDomEvent ) {\r\n\t\t\t\t/*\r\n\t\t\t\t * Timeout fixes a few strange problems...\r\n\t\t\t\t */\r\n\t\t\t\tvar input = this.shadowTree.input;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tFocusBinding.focusElement ( input );\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Select contained text.\r\n */\r\nDataInputBinding.prototype.select = function () {\r\n\r\n\tvar input = this.shadowTree.input;\r\n\r\n\tsetTimeout ( function () {\r\n\t\tif ( Client.isExplorer == true ) {\r\n\t\t\tvar range = input.createTextRange();\r\n\t\t\trange.moveStart ( \"character\", 0 );\r\n\t\t\trange.moveEnd ( \"character\", input.value.length );\r\n\t\t\trange.select ();\r\n\t\t} else {\r\n\t    \tinput.setSelectionRange ( 0, input.value.length );\r\n\t\t}\r\n\t}, 0 );\r\n}\r\n\r\n/**\r\n * Blur.\r\n * @overloads {DataBinding#blur}\r\n * @param {boolean} isDomEvent\r\n */\r\nDataInputBinding.prototype.blur = function ( isDomEvent ) {\r\n\r\n\tif ( this.isFocused == true ) {\r\n\t\tDataInputBinding.superclass.blur.call ( this );\r\n\t\tif ( !isDomEvent ) {\r\n\t\t\tthis.shadowTree.input.blur ();\r\n\t\t}\r\n\t\tthis._blur ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Setup validation on focus.\r\n * @private\r\n */\r\nDataInputBinding.prototype._focus = function () {\r\n\r\n\tif ( !this._isValid ) {\r\n\t\tif ( this.isPassword ) {\r\n\t\t\tif ( Client.isMozilla ) {\r\n\t\t\t\tthis.shadowTree.input.type = \"password\";\r\n\t\t\t\tthis.setValue ( this._value );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.setValue ( this._value );\r\n\t\t}\r\n\t\tthis.shadowTree.input.className = \"\";\r\n\t}\r\n\r\n\tthis._sessionResult = this.getResult ();\r\n\r\n\tvar self = this;\r\n\r\n\tthis._dirtyinterval = window.setInterval ( function () {\r\n\t\tif ( Binding.exists ( self ) == true ) {\r\n\t\t\tself.checkDirty ();\r\n\t\t\tif ( !self._isValid ) {\r\n\t\t\t\tself.validate ( true );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\twindow.clearInterval ( self._dirtyinterval );\r\n\t\t\tself._dirtyinterval = null;\r\n\t\t}\r\n\t}, 500 );\r\n}\r\n\r\n/**\r\n * Validate on blur.\r\n * @private\r\n */\r\nDataInputBinding.prototype._blur = function () {\r\n\r\n\tif ( this._dirtyinterval ) {\r\n\t\twindow.clearInterval ( this._dirtyinterval );\r\n\t\tthis._dirtyinterval = null;\r\n\t}\r\n\r\n\tthis.checkDirty();\r\n\r\n\tthis._isValid = true; // prepare for next validation\r\n\tthis._normalizeToValid(); // reset styling and stuff\r\n\tthis.validate ( true );\r\n\r\n\tif ( Types.isFunction ( this.onblur )) {\r\n\t\tthis.onblur ();\r\n\t}\r\n\tif ( this._isValid ) {\r\n\t\tif ( this.getResult () != this._sessionResult ) {\r\n\t\t\t/*\r\n\t\t\t * If autopostback, remember that this._timeout may still be active now!\r\n\t\t\t */\r\n\t\t\tthis.onValueChange ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Overwrite this!\r\n */\r\nDataInputBinding.prototype.onfocus = function () {}\r\n\r\n/**\r\n * Overwrite this!\r\n */\r\nDataInputBinding.prototype.onblur = function () {}\r\n\r\n/**\r\n * Check dirty.\r\n */\r\nDataInputBinding.prototype.checkDirty = function () {\r\n\r\n\tif ( !this.isDirty ) {\r\n\t\tif ( this.getResult () != this._sessionResult ) {\r\n\t\t\tthis.dirty ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * TODO: This seems to do more or less the same\r\n * as the method declared above. Fix this please.\r\n */\r\nDataInputBinding.prototype._testDirty = function () {\r\n\r\n\tvar val = this.getValue ();\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tif ( Binding.exists ( self )) {\r\n\t\t\tif ( self.getValue () != val ) {\r\n\t\t\t\tself.dirty ();\r\n\t\t\t}\r\n\t\t}\r\n\t}, 0 );\r\n};\r\n\r\n/**\r\n * Fires when input looses focus and value is changed.\r\n * Does nothing by default. Feel free to overwrite.\r\n */\r\nDataInputBinding.prototype.onValueChange = function () {}\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @param {boolean} isInternal Regrettably, this was added to fix bugs when\r\n * \t\tthe blur event would update the text content  immideately followed by\r\n * \t\ta page validation. This would cause glitches with minlength etc...\r\n * @return {boolean}\r\n */\r\nDataInputBinding.prototype.validate = function ( isInternal ) {\r\n\r\n\tif ( isInternal == true || this._isValid ) {\r\n\r\n\t\tvar isValid = this.isValid ();\r\n\r\n\t\tif ( isValid != this._isValid ) {\r\n\r\n\t\t\tthis._isValid = isValid;\r\n\r\n\t\t\tif ( !isValid ) {\r\n\r\n\t\t\t\tthis.attachClassName ( DataBinding.CLASSNAME_INVALID );\r\n\t\t\t\tthis._value = this.getValue ();\r\n\t\t\t\tthis.dispatchAction ( Binding.ACTION_INVALID );\r\n\r\n\t\t\t\tif ( !this.isFocused ) {\r\n\r\n\t\t\t\t\tvar message = null;\r\n\t\t\t\t\tif ( this._isInvalidBecauseInvalidXmlChar == true && this._invalidXmlChar ) {\r\n\t\t\t\t\t\tmessage = DataBinding.warnings [ \"character\" ];\r\n\t\t\t\t\t\tmessage = message.replace ( \"{0}\", String ( this._invalidXmlChar ));\r\n\t\t\t\t\t\tmessage = message.replace ( \"{1}\", String (\"0x\" + this._invalidXmlChar.charCodeAt(0).toString(16) ));\r\n\t\t\t\t\t} else\r\n\t\t\t\t\tif ( this._isInvalidBecauseRequired == true ) {\r\n\t\t\t\t\t\tmessage = DataBinding.warnings [ \"required\" ];\r\n\t\t\t\t\t} else if ( this._isInvalidBecauseMinLength == true ) {\r\n\t\t\t\t\t\tmessage = DataBinding.warnings [ \"minlength\" ];\r\n\t\t\t\t\t\tmessage = message.replace ( \"{0}\", String ( this.minlength ));\r\n\t\t\t\t\t} else if ( this._isInvalidBecauseMaxLength == true ) {\r\n\t\t\t\t\t\tmessage = DataBinding.warnings [ \"maxlength\" ];\r\n\t\t\t\t\t\tmessage = message.replace ( \"{0}\", String ( this.maxlength ));\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tmessage = DataBinding.warnings [ this.type ];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.shadowTree.input.className = DataBinding.CLASSNAME_WARNING;\r\n\t\t\t\t\tif ( message != null ) {\r\n\t\t\t\t\t\tif ( this.isPassword ) {\r\n\t\t\t\t\t\t\tif ( Client.isMozilla ) {\r\n\t\t\t\t\t\t\t\tthis.shadowTree.input.type = \"text\";\r\n\t\t\t\t\t\t\t\tthis.setValue ( message );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.setValue ( message );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\t\t\t\tthis._normalizeToValid ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn this._isValid;\r\n}\r\n\r\n/**\r\n * Normalize invalid binding, marking the binding valid.\r\n */\r\nDataInputBinding.prototype._normalizeToValid = function () {\r\n\r\n\tif ( this._isValid ) {\r\n\t\tif ( this.hasClassName ( DataBinding.CLASSNAME_INVALID )) {\r\n\t\t\tthis.detachClassName ( DataBinding.CLASSNAME_INVALID );\r\n\t\t}\r\n\t\tthis.shadowTree.input.className = \"\";\r\n\t\tthis.dispatchAction ( Binding.ACTION_VALID );\r\n\t}\r\n};\r\n\r\n\r\n\r\n/**\r\n * @return {boolean}\r\n */\r\nDataInputBinding.prototype.isValid = function () {\r\n\r\n\tvar isValid = true;\r\n\tthis._isInvalidBecauseRequired = false;\r\n\tthis._isInvalidBecauseInvalidXmlChar = false;\r\n\tthis._invalidXmlChar = \"\";\r\n\tthis._isInvalidBecauseMinLength = false;\r\n\tthis._isInvalidaBecuaseMaxLength = false;\r\n\tvar value = this.getValue ();\r\n\tvar invalidCharMatch = DataInputBinding.invalidXmlChar.exec(value);\r\n\r\n\r\n\tif (invalidCharMatch) {\r\n\t\tisValid = false;\r\n\t\tthis._isInvalidBecauseInvalidXmlChar = true;\r\n\t\tthis._invalidXmlChar = invalidCharMatch[0];\r\n\t} else if ( value == \"\" ) {\r\n\t\tif ( this.isRequired == true ) {\r\n\t\t\tisValid = false;\r\n\t\t\tthis._isInvalidBecauseRequired = true;\r\n\t\t}\r\n\t} else if ( this.type != null ) {\r\n\t\tvar expression = DataBinding.expressions [ this.type ];\r\n\t\tif ( !expression.test ( value )) {\r\n\t\t\tisValid = false;\r\n\t\t}\r\n\t} else if ( this.expression != null ) {\r\n\t\tif ( !this.expression.test ( value )) {\r\n\t\t\tisValid = false;\r\n\t\t}\r\n\t}\r\n\tif ( isValid && this.minlength != null ) {\r\n\t\tif ( value.length < this.minlength ) {\r\n\t\t\tthis._isInvalidBecauseMinLength = true;\r\n\t\t\tisValid = false;\r\n\t\t}\r\n\t}\r\n\tif ( isValid && this.maxlength != null ) {\r\n\t\tif ( value.length > this.maxlength ) {\r\n\t\t\tthis._isInvalidBecauseMaxLength = true;\r\n\t\t\tisValid = false;\r\n\t\t}\r\n\t}\r\n\treturn isValid;\r\n}\r\n\r\n/**\r\n * @param {boolean} isDisabled\r\n */\r\nDataInputBinding.prototype.setDisabled = function ( isDisabled ) {\r\n\r\n\tif ( isDisabled != this.isDisabled ) {\r\n\t\tif ( isDisabled ) {\r\n\t\t\tthis.attachClassName ( \"isdisabled\" );\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( \"isdisabled\" );\r\n\t\t}\r\n\t\tvar input = this.shadowTree.input;\r\n\t\tif ( isDisabled ) {\r\n\t\t\tthis._disabledHandler = {\r\n\t\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tDOMEvents.addEventListener ( input, DOMEvents.MOUSEDOWN, this._disabledHandler );\r\n\t\t} else {\r\n\t\t\tDOMEvents.removeEventListener ( input, DOMEvents.MOUSEDOWN, this._disabledHandler );\r\n\t\t\tthis._disabledHandler = null;\r\n\t\t}\r\n\t\tif ( Client.isExplorer ) { // is this needed?\r\n\t\t\tthis.shadowTree.input.disabled = isDisabled;\r\n\t\t\tthis.shadowTree.input.unselectable = isDisabled ? \"on\" : \"off\";\r\n\t\t}\r\n\t\tthis.isDisabled = isDisabled;\r\n\t\tthis.isFocusable = !isDisabled;\r\n\t\tthis.dispatchAction ( FocusBinding.ACTION_UPDATE );\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {boolean} isReadOnly\r\n */\r\nDataInputBinding.prototype.setReadOnly = function ( isReadOnly ) {\r\n\r\n\tif ( isReadOnly != this.isReadOnly ) {\r\n\t\tif ( isReadOnly ) {\r\n\t\t\tthis.attachClassName ( \"readonly\" );\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( \"readonly\" );\r\n\t\t}\r\n\t\tif (this.shadowTree.input) {\r\n\t        this.shadowTree.input.readOnly = isReadOnly;\r\n\t    }\r\n\t    this.isReadOnly = isReadOnly;\r\n\t}\r\n}\r\n\r\n/**\r\n * Disable.\r\n */\r\nDataInputBinding.prototype.disable = function () {\r\n\r\n\tif ( !this.isDisabled ) {\r\n\t\tthis.setDisabled ( true );\r\n\t}\r\n}\r\n\r\n/**\r\n * Enable.\r\n */\r\nDataInputBinding.prototype.enable = function () {\r\n\r\n\tif ( this.isDisabled ) {\r\n\t\tthis.setDisabled ( false );\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle element update.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#handleElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nDataInputBinding.prototype.handleElement = function ( element ) {\r\n\r\n\treturn true;\r\n};\r\n\r\n/**\r\n * Update element.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#updateElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nDataInputBinding.prototype.updateElement = function ( element ) {\r\n\r\n\tvar newval = element.getAttribute ( \"value\" );\r\n\tvar newtype = element.getAttribute ( \"type\" );\r\n\tvar newmax = element.getAttribute ( \"maxlength\" );\r\n\tvar newmin = element.getAttribute ( \"minlength\" );\r\n\tvar newrequired = element.getAttribute(\"required\") === \"true\";\r\n\tvar newreadonly = element.getAttribute(\"readonly\") === \"true\";\r\n\r\n\tif ( newval == null ) {\r\n\t\tnewval = \"\";\r\n\t}\r\n\r\n\tif (this.isReadOnly != newreadonly) {\r\n\t\tthis.setReadOnly(newreadonly);\r\n\t}\r\n\r\n\tvar manager = this.bindingWindow.UpdateManager;\r\n\tif ( this.getValue () != newval ) {\r\n\t\tmanager.report ( \"Property [value] updated on binding \\\"\" + this.getID () + \"\\\"\" );\r\n\t\tthis.setValue ( newval );\r\n\t}\r\n\tif ( this.type != newtype ) {\r\n\t\tmanager.report ( \"Property [type] updated on binding \\\"\" + this.getID () + \"\\\"\" );\r\n\t\tthis.type = newtype;\r\n\t}\r\n\tif ( this.maxlength != newmax ) {\r\n\t\tmanager.report ( \"Property [maxlength] updated on binding \\\"\" + this.getID () + \"\\\"\" );\r\n\t\tthis.maxlength = newmax;\r\n\t}\r\n\tif ( this.minlength != newmin ) {\r\n\t\tmanager.report ( \"Property [minlength] updated on binding \\\"\" + this.getID () + \"\\\"\" );\r\n\t\tthis.minlength = newmin;\r\n\t}\r\n\tif (this.isRequired != newrequired) {\r\n\t    manager.report(\"Property [required] updated on binding \\\"\" + this.getID() + \"\\\"\");\r\n\t    this.isRequired = newrequired;\r\n\t}\r\n\r\n\treturn true;\r\n};\r\n\r\n\r\n/**\r\n * Manifest. Because postback without validation may happen,\r\n * we may need override validation message and post an empty\r\n * string to the server. \"Save\" is a validated postback, so\r\n * the non-validating string is not made permanent by this.\r\n * @implements {IData}\r\n */\r\nDataInputBinding.prototype.manifest = function () {\r\n    if (this._timeout != null) {\r\n        top.window.clearTimeout(this._timeout);\r\n    }\r\n\tif ( !this._isValid ) {\r\n\t\tthis.setValue ( \"\" ); // post empty to the server\r\n\t\tthis._isValid = true; // prepare for next validation\r\n\t\tthis._normalizeToValid (); // reset styling and stuff\r\n\t}\r\n}\r\n\r\n/**\r\n * Clean.\r\n * @overloads {DataBinding#clean}\r\n * @implements {IData}\r\n */\r\nDataInputBinding.prototype.clean = function () {\r\n\r\n\tDataInputBinding.superclass.clean.call ( this );\r\n\tthis._sessionResult = this.getResult ();\r\n}\r\n\r\n/**\r\n * Set value.\r\n * @param {String} value\r\n */\r\nDataInputBinding.prototype.setValue = function ( value ) {\r\n\r\n\tif ( value === null ) {\r\n\t\tvalue = \"\";\r\n\t}\r\n\tif ( value != this.getValue ()) {\r\n\t\tthis.setProperty ( \"value\", value );\r\n\t\tif ( this.shadowTree.input != null ) {\r\n\t\t\tthis.shadowTree.input.value = String ( value );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get value.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nDataInputBinding.prototype.getValue = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.shadowTree.input != null ) {\r\n\t\tresult = this.shadowTree.input.value;\r\n\t} else {\r\n\t\tresult = this.getProperty ( \"value\" );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set name.\r\n * Overloads {DataBinding#setName}\r\n * @param {string} name\r\n */\r\nDataInputBinding.prototype.setName = function ( name ) {\r\n\r\n\tDataInputBinding.superclass.setName.call ( this, name );\r\n\r\n\tif ( this.isAttached == true ) {\r\n\t\tthis.shadowTree.input.name = name;\r\n\t}\r\n}\r\n\r\n/**\r\n * Get result. Unlike getValue, the result is qualified according to type property.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nDataInputBinding.prototype.getResult = function () {\r\n\r\n\tvar result = this.getValue ();\r\n\r\n\tswitch ( this.type ) {\r\n\t\tcase DataBinding.TYPE_NUMBER :\r\n\t\tcase DataBinding.TYPE_INTEGER :\r\n\t\t\tresult = Number ( result );\r\n\t\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} result\r\n */\r\nDataInputBinding.prototype.setResult = DataInputBinding.prototype.setValue;\r\n\r\n/**\r\n * DataInputBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DataInputBinding}\r\n */\r\nDataInputBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:datainput\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DataInputBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/keyboard/EditorTextBoxBinding.js",
    "content": "EditorTextBoxBinding.prototype = new TextBoxBinding;\r\nEditorTextBoxBinding.prototype.constructor = EditorTextBoxBinding;\r\nEditorTextBoxBinding.superclass = TextBoxBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * Tab indent, tab preservation, no soft text wrap. Because of extremely different implementations, \r\n * this has been split into two different bindings. Note that the box must be placed inside an \r\n * <ui:flexbox> element to maximize it's sreen estate.\r\n * @see {MozEditorTextBoxBinding}\r\n * @see {IEEditorTextBoxBinding}\r\n */\r\nfunction EditorTextBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorTextBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * @overloads {TextBoxBinding#_hasWordWrap}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasWordWrap = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorTextBoxBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[EditorTextBoxBinding]\";\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overwrites {TextBoxBinding#handleEvent}\r\n * @param {Event} e\r\n */\r\nEditorTextBoxBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tif ( this.isFocusable == true ) {\r\n\t\tswitch ( e.type ) {\r\n\t\t\t\r\n\t\t\tcase DOMEvents.FOCUS :\r\n\t\t\tcase DOMEvents.BLUR :\r\n\t\t\t\tthis._handleFocusAndBlur ( e.type == DOMEvents.FOCUS );\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.KEYDOWN :\r\n\t\t\t\tthis._handleKeyEvent ( e );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {KeyEvent} e\r\n * @overloads {TextBoxBinding#_handleKeyEvent}\r\n */\r\nEditorTextBoxBinding.prototype._handleKeyEvent = function ( e ) {\r\n\t\r\n\tswitch ( e.keyCode ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Handle TAB.\r\n\t\t */\r\n\t\tcase KeyEventCodes.VK_TAB :\r\n\t\t\tthis._handleTabKey ( e.shiftKey );\r\n\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\tbreak;\r\n\t\t\r\n\t\t/*\r\n\t\t * Handle ENTER.\r\n\t\t */\r\n\t\tcase KeyEventCodes.VK_ENTER :\r\n\t\t\tthis._handleEnterKey ();\r\n\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\t/*\r\n\t\t * Prevent ESC from reverting new value to original \r\n\t\t * value. This is default behavior in Explorer only. \r\n\t\t * We create input with JS, so our original is empty.\r\n\t\t * TODO: This should also escape keyboard nav from editor!\r\n\t\t */\r\n\t\tcase KeyEventCodes.VK_ESCAPE :\r\n\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Subclass must define this.\r\n * @param {boolean} isReverse\r\n */\r\nEditorTextBoxBinding.prototype._handleTabKey = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Subclass must define this.\r\n */\r\nEditorTextBoxBinding.prototype._handleEnterKey = Binding.ABSTRACT_METHOD;"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/keyboard/IEEditorTextBoxBinding.js",
    "content": "IEEditorTextBoxBinding.prototype = new EditorTextBoxBinding;\r\nIEEditorTextBoxBinding.prototype.constructor = IEEditorTextBoxBinding;\r\nIEEditorTextBoxBinding.superclass = EditorTextBoxBinding.prototype;\r\n\r\n/**\r\n * Tab indent, tab preservation, no soft text wrap.\r\n * @class\r\n */\r\nfunction IEEditorTextBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"IEEditorTextBoxBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nIEEditorTextBoxBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[IEEditorTextBoxBinding]\";\r\n}\r\n\r\n/**\r\n * Handle TAB key.\r\n * @param {boolean} isReverse\r\n */\r\nIEEditorTextBoxBinding.prototype._handleTabKey = function ( isReverse ) {\r\n\t\r\n\tvar range = this.bindingDocument.selection.createRange ();\r\n\tvar isCollapsed = range.text == \"\";\r\n\t\r\n\tif ( isCollapsed && !isReverse ) {\r\n\t\r\n\t\trange.text = \"\\t\"; // TODO: unindent single line on reverse!\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tvar text = \"\";\r\n\t\tvar length = range.text.length;\r\n\t\t\r\n\t\twhile (( range.moveStart ( \"word\", -1 ) && range.text.charAt ( 1 ) != \"\\n\" ));\r\n\t\trange.moveStart ( \"character\", 1 );\r\n\t\t\r\n\t\tvar count = 0;\r\n\t\t\t\t\r\n\t\tvar i = 0, line, lines = range.text.split ( \"\\n\" );\r\n\t\twhile (( line = lines [ i++ ]) != null ) {\r\n\t\t\tif ( isReverse ) {\r\n\t\t\t\tline = line.replace ( /^(\\s)/mg, \"\" );\r\n\t\t\t\tcount ++;\r\n\t\t\t} else {\r\n\t\t\t\tline = line.replace ( /^(.)/mg, \"\\t$1\" );\r\n\t\t\t}\r\n\t\t\ttext += line + ( lines [ i + 1 ] ? \"\\n\" : \"\" )\r\n\t\t}\r\n\t\t\r\n\t\trange.text = text;\r\n\t\trange.moveStart ( \"character\", - length );\r\n\t\tif ( isReverse ) {\r\n\t\t\trange.moveStart ( \"character\", 2 * lines.length - 2 ); // seems to work...\r\n\t\t}\r\n\t\trange.select ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle ENTER key.\r\n */\r\nIEEditorTextBoxBinding.prototype._handleEnterKey = function () {\r\n\r\n\tvar range = this.bindingDocument.selection.createRange ();\r\n\tvar clone = range.duplicate ();\r\n\r\n\twhile (( clone.moveStart ( \"word\", -1 ) && clone.text.indexOf ( \"\\n\" ) ==-1 ));\r\n\tclone.moveStart ( \"character\", 1 );\r\n\t\r\n\trange.text = \"\\n\" + clone.text.match ( /^(\\s)*/ )[ 0 ] + \"!\";\r\n\trange.moveStart ( \"character\", -1 );\r\n\trange.select ();\r\n\trange.text = \"\";\r\n\trange.select ();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/keyboard/MozEditorTextBoxBinding.js",
    "content": "MozEditorTextBoxBinding.prototype = new EditorTextBoxBinding;\r\nMozEditorTextBoxBinding.prototype.constructor = MozEditorTextBoxBinding;\r\nMozEditorTextBoxBinding.superclass = EditorTextBoxBinding.prototype;\r\n\r\n/**\r\n * Tab indent, tab preservation, no soft text wrap.\r\n * @class\r\n */\r\nfunction MozEditorTextBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MozEditorTextBoxBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMozEditorTextBoxBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[MozEditorTextBoxBinding]\";\r\n}\r\n\r\n/**\r\n * Handle TAB key.\r\n * @param {boolean} isReverse\r\n */\r\nMozEditorTextBoxBinding.prototype._handleTabKey = function ( isReverse ) {\r\n\t\r\n\tvar lastx;\r\n\tvar lasty;\r\n\tvar oss;\r\n\tvar osy;\r\n\tvar i;\r\n\tvar fnd;\r\n\tvar selectedText = this._getSelectedText ();\r\n\tvar el = this.shadowTree.input;\r\n\t\r\n\tlastx = el.scrollLeft;\r\n\tlasty = el.scrollTop;\r\n\t\r\n\tif (!selectedText.match(/\\n/)) {\r\n\t\toss = el.selectionStart;\r\n\t\tel.value = el.value.substr(0, el.selectionStart) + \"\\t\" + el.value.substr(el.selectionEnd);\r\n\t\tel.selectionStart = oss + 1;\r\n\t\tel.selectionEnd = oss + 1;\r\n\t} else {\r\n\t\toss = el.selectionStart;\r\n\t\tosy = el.selectionEnd;\r\n\t\tfnd = 0;\r\n\t\tfor (i = oss - 1; i >= 0; i --) {\r\n\t\t\tif (el.value.charAt(i) == \"\\n\") {\r\n\t\t\t\toss = i + 1;\r\n\t\t\t\tfnd = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} if (fnd == 0) {\r\n\t\t\toss = 0;\r\n\t\t}\r\n\t\tfnd = 0;\r\n\t\tfor (i = osy; i < el.value.length; i ++) {\r\n\t\t\tif (el.value.charAt(i) == \"\\n\") {\r\n\t\t\t\tosy = i;\r\n\t\t\t\tfnd = 1;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} if (fnd == 0) {\r\n\t\t\tosy = el.value.length;\r\n\t\t}\r\n\t\tel.selectionStart = oss;\r\n\t\tel.selectionEnd = osy;\r\n\t\tselectedText = this._getSelectedText ();\r\n\t\t\r\n\t\tif ( isReverse ) {\r\n\t\t\tntext = selectedText.replace( /^(\\s)/mg, \"\" );\r\n\t\t} else {\r\n\t\t\tntext = selectedText.replace( /^(.)/mg, \"\\t$1\" );\r\n\t\t}\r\n\t\tel.value = el.value.substr(0, el.selectionStart) + ntext + el.value.substr(el.selectionEnd);\r\n\t\tel.selectionStart = oss;\r\n\t\tel.selectionEnd = osy + (ntext.length - selectedText.length);\r\n\t}\r\n\tel.scrollLeft = lastx;\r\n\tel.scrollTop  = lasty;\t\t\r\n}\r\n\r\n/**\r\n * Handle ENTER key.\r\n */\r\nMozEditorTextBoxBinding.prototype._handleEnterKey = function () {\r\n\t\r\n\tvar lastx;\r\n\tvar lasty;\r\n\tvar oss;\r\n\tvar osy;\r\n\tvar el = this.shadowTree.input;\r\n\r\n\tlastx = el.scrollLeft;\r\n\tlasty = el.scrollTop;\r\n\toss = el.selectionStart;\r\n\tosy = el.selectionEnd;\r\n\tvar bfs = el.value.substr(0, el.selectionStart);\r\n\tvar bfsm = bfs.split(/\\r|\\n/g);\r\n\r\n\tvar spm = bfsm[bfsm.length - 1].match(/^(\\s)*/);\r\n\tel.value = el.value.substr(0, el.selectionStart) + \"\\n\" + spm[0] + el.value.substr(el.selectionEnd);\r\n\tel.selectionStart = oss + 1 + spm[0].length;\r\n\tel.selectionEnd = oss + 1 + spm[0].length;\r\n\t\r\n\tel.scrollLeft = lastx;\r\n\tel.scrollTop  = lasty;\r\n}\r\n\r\n/**\r\n * Get selected text.\r\n * @return {string}\r\n */\r\nMozEditorTextBoxBinding.prototype._getSelectedText = function () {\r\n\t\r\n\tvar value \t= this.shadowTree.input.value;\r\n\tvar start \t= this.shadowTree.input.selectionStart;\r\n\tvar end \t= this.shadowTree.input.selectionEnd;\r\n\t\r\n\treturn value.substr ( start, end - start );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/keyboard/TextBoxBinding.BACKUP.js",
    "content": "TextBoxBinding.prototype = new DataBinding;\r\nTextBoxBinding.prototype.constructor = TextBoxBinding;\r\nTextBoxBinding.superclass = DataBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n * TODO: Refactor this whole lot to simply subclass the DataInputBinding!\r\n */\r\nfunction TextBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TextBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRequired = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isReadonly = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisabled = false;\r\n\r\n\t/**\r\n\t * Used to cache value while displaying error messages.\r\n\t * @type {string}\r\n\t */\r\n\tthis._value = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isValid = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._invalidRequiredField = false;\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis._sessionResult = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasWordWrap = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isAutoSelect = false;\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ DocumentCrawler.ID, FocusCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n\t\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTextBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TextBoxBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTextBoxBinding.prototype.onBindingAttach = function () {\r\n\r\n\tTextBoxBinding.superclass.onBindingAttach.call ( this );\t\r\n\tthis.propertyMethodMap [ \"value\" ] = this.setValue;\r\n\tthis._buildDOMContent ();\r\n\tthis._attachDOMEvents ();\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nTextBoxBinding.prototype.onBindingDispose = DataInputBinding.prototype.onBindingDispose;\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nTextBoxBinding.prototype._buildDOMContent = function () {\r\n\t\r\n\t/*\r\n\t * Notice that only a subset of DataInputBinding \r\n\t * properties are parsed for this binding. \r\n\t * @see {DataInputBinding#_parseDOMProperties}\r\n\t */\r\n\t\r\n\tvar value = null;\r\n\tvar defaultarea = DOMUtil.getElementsByTagName ( this.bindingElement, \"textarea\" ).item ( 0 );\r\n\t\r\n\tif ( defaultarea ) {\r\n\t\tvalue = defaultarea.value;\r\n\t\tthis.bindingElement.removeChild ( defaultarea );\r\n\t}\r\n\t\r\n\tvar\tarea = DOMUtil.createElementNS ( Constants.NS_XHTML, \"textarea\", this.bindingDocument );\r\n\tthis.shadowTree.input = area;\r\n\t\r\n\tarea.setAttribute ( \"spellcheck\", \"false\" );\r\n\tif ( !this._hasWordWrap ) {\r\n\t\tarea.setAttribute ( \"wrap\", \"off\" );\r\n\t}\r\n\r\n\tthis.shadowTree.box = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:box\", this.bindingDocument );\r\n\t\r\n\tif ( !value ) {\r\n\t\tvalue = this.getProperty ( \"value\" );\r\n\t}\r\n\tif ( value ) {\r\n\t\tarea.value = value;\r\n\t}\r\n\t\r\n\tvar name = this.getName ();\r\n\tif ( name ) {\r\n\t\tarea.name = name;\r\n\t}\r\n\t\r\n\tvar isAutoSelect = this.getProperty ( \"autoselect\" );\r\n\tif ( isAutoSelect ) {\r\n\t\tthis._isAutoSelect = true;\r\n\t}\r\n\r\n\tthis.isRequired = this.getProperty ( \"required\" ) ? true : false;\t\r\n\tvar isDisabled = this.getProperty ( \"isdisabled\" );\r\n\tif ( isDisabled ) {\r\n\t\tthis.setDisabled ( true );\r\n\t}\r\n\t\r\n\tvar isReadOnly = this.getProperty ( \"readonly\" );\r\n\tif ( isReadOnly ) {\r\n\t\tthis.setReadOnly ( true );\r\n\t}\r\n\t\r\n\tthis.shadowTree.input.tabIndex = -1;\r\n\tthis.shadowTree.box.appendChild ( area );\r\n\tthis.bindingElement.appendChild ( this.shadowTree.box );\r\n}\r\n\r\n/** \r\n * Handle element update.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#handleElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nTextBoxBinding.prototype.handleElement = function ( element ) {\r\n\t\r\n\treturn true;\r\n};\r\n\r\n/** \r\n * Update element.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#updateElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nTextBoxBinding.prototype.updateElement = function ( element ) {\r\n\t\r\n\tvar newval, area = element.getElementsByTagName ( \"textarea\" ).item ( 0 );\r\n\tif ( area != null && area.hasChildNodes ()) {\r\n\t\tnewval = DOMUtil.getTextContent ( area );\r\n\t}\r\n\tif ( newval == null ) {\r\n\t\tnewval = \"\";\r\n\t}\r\n\tif ( this.getValue () != newval ) {\r\n\t\tvar manager = this.bindingWindow.UpdateManager;\r\n\t\tmanager.report ( \"Property [value] updated on binding \\\"\" + this.getID () + \"\\\"\" );\r\n\t\tthis.setValue ( newval );\r\n\t}\r\n\treturn true;\r\n};\r\n\r\n/**\r\n * Attach DOM events.\r\n */\r\nTextBoxBinding.prototype._attachDOMEvents = DataInputBinding.prototype._attachDOMEvents;\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @param {Event} e\r\n */\r\nTextBoxBinding.prototype.handleEvent = DataInputBinding.prototype.handleEvent;\r\n\r\n/**\r\n * Handle DOM focus and blur.\r\n * @param {boolean} isFocus\r\n */\r\nTextBoxBinding.prototype._handleFocusAndBlur = DataInputBinding.prototype._handleFocusAndBlur;\r\n\r\n/**\r\n * Handle ENTER key. Unlike {@link DataInputBinding}, we won't preventDefault the event! \r\n * @param {KeyEvent} e\r\n */\r\nTextBoxBinding.prototype._handleEnterKey = function ( e ) {\r\n\t\r\n\tDOMEvents.stopPropagation ( e );\r\n\t// EventBroadcaster.broadcast ( BroadcastMessages.KEY_ENTER ); this would submit an open dialog!\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n */\r\nTextBoxBinding.prototype.handleBroadcast = DataInputBinding.prototype.handleBroadcast;\r\n\r\n/**\r\n * @see {DataInputBinding#setReadOnly}\r\n * @param {boolean} isReadOnly\r\n */\r\nTextBoxBinding.prototype.setReadOnly = DataInputBinding.prototype.setReadOnly;\r\n\r\n/**\r\n * @see {DataInputBinding#setDisabled}\r\n * @param {boolean} isDisabled\r\n */\r\nTextBoxBinding.prototype.setDisabled = DataInputBinding.prototype.setDisabled;\r\n\r\n/**\r\n * @see {DataInputBinding#onValueChange}\r\n */\r\nTextBoxBinding.prototype.onValueChange = DataInputBinding.prototype.onValueChange;\r\n\r\n/**\r\n * @see {DataInputBinding#select}\r\n */\r\nTextBoxBinding.prototype.select = DataInputBinding.prototype.select;\r\n\r\n/**\r\n * Check dirty.\r\n */\r\nTextBoxBinding.prototype.checkDirty = DataInputBinding.prototype.checkDirty;\r\n\r\n/**\r\n * Clean.\r\n * @overloads {DataBinding#clean}\r\n * @implements {IData}\r\n */\r\nTextBoxBinding.prototype.clean = DataInputBinding.prototype.clean;\r\n\r\n/**\r\n * Focus.\r\n * @implements {IData}\r\n */\r\nTextBoxBinding.prototype.focus = DataInputBinding.prototype.focus;\r\n\r\n/**\r\n * Blur.\r\n * @implements {IData}\r\n */\r\nTextBoxBinding.prototype.blur = DataInputBinding.prototype.blur;\r\n\r\n/**\r\n * Setup validation on focus.\r\n * @private\r\n */\r\nTextBoxBinding.prototype._focus = DataInputBinding.prototype._focus;\r\n\r\n/**\r\n * Validate on blur.\r\n * @private\r\n */\r\nTextBoxBinding.prototype._blur = DataInputBinding.prototype._blur;\r\n\r\n/**\r\n * Overwrite this!\r\n */\r\nTextBoxBinding.prototype.onfocus = DataInputBinding.prototype.onfocus;\r\n\r\n/**\r\n * Overwrite this!\r\n */\r\nTextBoxBinding.prototype.onblur = DataInputBinding.prototype.onblur;\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nTextBoxBinding.prototype.validate = DataInputBinding.prototype.validate;\r\n\r\n/**\r\n * @return {boolean}\r\n */\r\nTextBoxBinding.prototype.isValid = DataInputBinding.prototype.isValid;\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nTextBoxBinding.prototype.manifest = function () {\r\n\r\n\t// do nothing\r\n};\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nTextBoxBinding.prototype.getValue = DataInputBinding.prototype.getValue;\r\n\r\n/**\r\n * Set value.\r\n * @param {string} value\r\n */\r\nTextBoxBinding.prototype.setValue = DataInputBinding.prototype.setValue;\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nTextBoxBinding.prototype.getResult = TextBoxBinding.prototype.getValue;\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} result\r\n */\r\nTextBoxBinding.prototype.setResult = TextBoxBinding.prototype.setValue;"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/keyboard/TextBoxBinding.js",
    "content": "TextBoxBinding.prototype = new DataInputBinding;\r\nTextBoxBinding.prototype.constructor = TextBoxBinding;\r\nTextBoxBinding.superclass = DataInputBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction TextBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TextBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * For subclasses to negate.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasWordWrap = true;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n\t\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTextBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TextBoxBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DataInputBinding#_buildDOMContent}\r\n */\r\nTextBoxBinding.prototype._buildDOMContent = function () {\r\n\r\n\t/*\r\n\t* Note that we nuke the textarea that may have been used to populate  \r\n\t* our value. That's because we'll replace it with our own area...\r\n\t*/\r\n\tvar defaultarea = DOMUtil.getElementsByTagName(this.bindingElement, \"textarea\").item(0);\r\n\tif (defaultarea != null) {\r\n\t\tthis.setValue(defaultarea.value);\r\n\t\tdefaultarea.parentNode.removeChild(defaultarea);\r\n\t}\r\n\r\n\t/*\r\n\t* Super goes here!\r\n\t*/\r\n\tTextBoxBinding.superclass._buildDOMContent.call(this);\r\n\r\n\t/*\r\n\t* Textarea specials.\r\n\t*/\r\n\r\n\tif (!this._hasWordWrap) {\r\n\t\tthis.shadowTree.input.setAttribute(\"wrap\", \"off\");\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Get input element. A textarea, in this case.\r\n * @return {HTMLInputElement}\r\n */\r\nTextBoxBinding.prototype._getInputElement = function() {\r\n\tvar element;\r\n\t// By default, explorer create textarea which convert \\n to <br />\r\n\t// This hack create normal textarea\r\n\tif (Client.isExplorer || Client.isExplorer11) {\r\n\t\tvar div = this.bindingDocument.createElement(\"div\");\r\n\t\tdiv.innerHTML = \"<textarea></textarea>\";\r\n\t\telement = div.firstChild;\r\n\t} else {\r\n\t\telement = DOMUtil.createElementNS(Constants.NS_XHTML, \"textarea\", this.bindingDocument);\r\n\t}\r\n\telement.tabIndex = -1;\r\n\r\n\treturn element;\r\n} \r\n\r\n\r\n/** \r\n * Handle element update.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#handleElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nTextBoxBinding.prototype.handleElement = function ( element ) {\r\n\t\r\n\treturn true;\r\n};\r\n\r\n/** \r\n * Update element.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#updateElement}\r\n * TODO: handle \"value\" property, though not normally used by server ???!!!\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nTextBoxBinding.prototype.updateElement = function ( element ) {\r\n\t\r\n\tvar newval, area = element.getElementsByTagName ( \"textarea\" ).item ( 0 );\r\n\tif ( area != null && area.hasChildNodes ()) {\r\n\t\tnewval = DOMUtil.getTextContent ( area );\r\n\t}\r\n\tif ( newval == null ) {\r\n\t\tnewval = \"\";\r\n\t}\r\n\t\r\n\tvar manager = this.bindingWindow.UpdateManager;\r\n\tif ( this.getValue () != newval ) {\r\n\t\tmanager.report ( \"Property [value] updated on binding \\\"\" + this.getID () + \"\\\"\" );\r\n\t\tthis.setValue ( newval );\r\n\t}\r\n\t\r\n\tvar newtype = element.getAttribute ( \"type\" );\r\n\tif ( this.type != newtype ) {\r\n\t\tmanager.report ( \"Property [type] updated on binding \\\"\" + this.getID () + \"\\\"\" );\r\n\t\tthis.type = newtype;\r\n\t}\r\n\t\r\n\treturn true;\r\n};\r\n\r\n/**\r\n * Handle ENTER key. Lets not preventDefault the event!\r\n * @overwrites {DataInputBinding#_handleEnterKey} \r\n * @param {KeyEvent} e\r\n */\r\nTextBoxBinding.prototype._handleEnterKey = function ( e ) {\r\n\t\r\n\tDOMEvents.stopPropagation ( e );\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/lazy/LazyBindingBinding.js",
    "content": "LazyBindingBinding.prototype = new DataBinding;\r\nLazyBindingBinding.prototype.constructor = LazyBindingBinding;\r\nLazyBindingBinding.superclass = DataBinding.prototype;\r\n\r\n/*\r\n * Used when constructing IDs for LazyBindings.\r\n */\r\nLazyBindingBinding.ID_APPENDIX = \"lazybinding\";\r\n\r\n/**\r\n * Change LazyBinding server submit value.\r\n * @param {Binding} binding\r\n */\r\nLazyBindingBinding.wakeUp = function ( binding ) {\r\n\r\n\tvar id = binding.bindingElement.id + LazyBindingBinding.ID_APPENDIX;\r\n\tvar element = binding.bindingDocument.getElementById ( id );\r\n\tif ( element != null ) {\r\n\t\tvar lazyBinding = UserInterface.getBinding ( element );\r\n\t\tlazyBinding.setResult ( true );\r\n\t}\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction LazyBindingBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"LazyBindingBinding\" );\r\n\t\r\n\t/**\r\n\t * @overwrites {DataBinding#isFocusable}\r\n\t */\r\n\tthis.isFocusable = false;\r\n\t\r\n\t/**\r\n\t * Flipped when lazy binding wakes up.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isLazy = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nLazyBindingBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[LazyBindingBinding]\";\r\n}\r\n\r\n/**\r\n * Mark lazy bindings in containing document. \r\n * Attached bindings will not be affected.\r\n * @overloads {DataBinding#onBindingRegister}\r\n */\r\nLazyBindingBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tLazyBindingBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tvar id = this.getProperty ( \"bindingid\" );\r\n\tif ( id != null ) {\r\n\t\t\r\n\t\t// generation of the lazybindings ID attribute has been moved to XSLT! \r\n\t\t// this.bindingElement.id = id + LazyBindingBinding.ID_APPENDIX;\r\n\t\t\r\n\t\tvar element = this.bindingDocument.getElementById ( id );\r\n\t\tif ( element != null ) {\r\n\t\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\tif ( binding && !binding.isAttached ) {\r\n\t\t\t\tbinding.isLazy = true;\t\r\n\t\t\t} else {\r\n\t\t\t\telement.setAttribute ( \"lazy\", true );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nLazyBindingBinding.prototype.validate = function () {\r\n\t\r\n\treturn true;\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nLazyBindingBinding.prototype.manifest = function () {\r\n\t\r\n\t/*\r\n\t * TODO: Migrate to Binding.dotnetify!\r\n\t */\r\n\tif ( this.isAttached ) {\r\n\t\tif ( this.shadowTree.input == null ) {\r\n\t\t\tthis.shadowTree.input = DOMUtil.createElementNS ( Constants.NS_XHTML, \"input\", this.bindingDocument );\r\n\t\t\tthis.shadowTree.input.type = \"hidden\";\r\n\t\t\tthis.shadowTree.input.name = this.getName ();\r\n\t\t\tthis.bindingElement.appendChild ( this.shadowTree.input );\r\n\t\t}\t\r\n\t\tthis.shadowTree.input.value = this.getValue ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nLazyBindingBinding.prototype.getValue = function () {\r\n\t\r\n\treturn String ( this._isLazy );\r\n}\r\n\r\n/**\r\n * Set value.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nLazyBindingBinding.prototype.setValue = function () {\r\n\t\r\n\tthrow \"Not implemented\";\r\n}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nLazyBindingBinding.prototype.getResult = function () {\r\n\t\r\n\treturn this._isLazy;\r\n}\r\n\r\n/**\r\n * Set result. This is intended for clientside processing.\r\n * @see {LazyBindingBinding#wakeUp}\r\n * @implements {IData}\r\n * @param {boolean} isLazy\r\n */\r\nLazyBindingBinding.prototype.setResult = function ( isLazy ) {\r\n\t\r\n\tthis._isLazy = isLazy\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/lazy/LazyBindingSetBinding.js",
    "content": "LazyBindingSetBinding.prototype = new Binding;\r\nLazyBindingSetBinding.prototype.constructor = LazyBindingSetBinding;\r\nLazyBindingSetBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction LazyBindingSetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"LazyBindingSetBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nLazyBindingSetBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[LazyBindingSetBinding]\";\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/misc/FilePickerBinding.js",
    "content": "FilePickerBinding.prototype = new DataBinding;\r\nFilePickerBinding.prototype.constructor = FilePickerBinding;\r\nFilePickerBinding.superclass = DataBinding.prototype;\r\n\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction FilePickerBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FilePickerBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isReadOnly = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isValid = true;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFilePickerBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FilePickerBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingAttach}\r\n * @return\r\n */\r\nFilePickerBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tFilePickerBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tvar real = this.getDescendantElementsByLocalName ( \"input\" ).getLast ();\r\n\tvar fake = this.getDescendantBindingByLocalName( \"datainput\" );\r\n\t\r\n\tfake.isFocusable = false;\r\n\t\r\n\tvar self = this;\r\n\treal.onchange = function () {\r\n\t\tvar val = this.value;\r\n\t\tif ( val.indexOf ( \"/\" ) >-1 ) { // unix maybe?\r\n\t\t\tval = val.substring ( val.lastIndexOf ( \"/\" ) + 1 );\r\n\t\t} else if ( val.indexOf ( \"\\\\\" ) >-1 ) { // windows\r\n\t\t\t\tval = val.substring ( val.lastIndexOf ( \"\\\\\" ) + 1 );\r\n\t\t}\r\n\t\tfake.setValue ( val );\r\n\t\tself.dirty ();\r\n\t\tif ( !self._isValid ) {\r\n\t\t\tself.validate ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// IMPLEMENT IDATA .............................................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nFilePickerBinding.prototype.validate = function () {\r\n\t\r\n\tvar result = true;\r\n\tif ( this.getProperty ( \"required\" )) {\r\n\t\tvar fake = this.getDescendantBindingByLocalName( \"datainput\" );\r\n\t\tresult = fake.getValue () != \"\";\r\n\t}\r\n\tif ( !result && this._isValid ) {\r\n\t\tthis._isValid = false;\r\n\t\tthis.dispatchAction ( Binding.ACTION_INVALID );\r\n\t} else if ( result && !this._isValid ) {\r\n\t\tthis.dispatchAction ( Binding.ACTION_VALID );\r\n\t}\t\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Focus.\r\n * @overloads {DataBinding#focus}\r\n */\r\nFilePickerBinding.prototype.focus = function () {\r\n\t\r\n\tFilePickerBinding.superclass.focus.call ( this );\r\n\t\r\n\tif ( this.isFocused ) {\r\n\t\tvar fake = this.getDescendantBindingByLocalName ( \"datainput\" );\r\n\t\tif ( fake != null ) {\r\n\t\t\tfake.attachClassName ( DataBinding.CLASSNAME_FOCUSED );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Blur.\r\n * @overloads {DataBinding#focus}\r\n */\r\nFilePickerBinding.prototype.blur = function () {\r\n\t\r\n\tFilePickerBinding.superclass.blur.call ( this );\r\n\r\n\tif ( !this.isFocused ) {\r\n\t\tvar fake = this.getDescendantBindingByLocalName ( \"datainput\" );\r\n\t\tif ( fake != null ) { // how could it be? A mystery...\r\n\t\t\tfake.detachClassName ( DataBinding.CLASSNAME_FOCUSED );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nFilePickerBinding.prototype.manifest = function () {\r\n\t\r\n\t// do nothing\r\n}\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nFilePickerBinding.prototype.getValue = function () {\r\n\t\r\n\t// do nothing - highly specialized setup\r\n}\r\n\r\n/**\r\n * Set value.\r\n * @implements {IData}\r\n * @param {string} value\r\n */\r\nFilePickerBinding.prototype.setValue = function () {\r\n\t\r\n\t// do nothing\r\n}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nFilePickerBinding.prototype.getResult = function () {\r\n\t\r\n\t// do nothing\r\n}\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} value\r\n */\r\nFilePickerBinding.prototype.setResult = function () {\r\n\t\r\n\t// do nothing\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/radiocheck/CheckBoxBinding.js",
    "content": "CheckBoxBinding.prototype = new Binding;\r\nCheckBoxBinding.prototype.constructor = CheckBoxBinding;\r\nCheckBoxBinding.superclass = Binding.prototype;\r\n\r\nCheckBoxBinding.ACTION_COMMAND = \"checkbox command\";\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction CheckBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"CheckBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {CheckButtonBinding}\r\n\t */\r\n\tthis._buttonBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._name = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isChecked = false;\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis._result = null;\r\n\t\r\n\t/**\r\n\t * @implements {IData}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\t\r\n\t/**\r\n\t * @implements {IData}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCheckBoxBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[CheckBoxBinding]\";\r\n}\r\n\r\n/**\r\n * Register databinding.\r\n * @overloads {Binding#onBindingRegister}.\r\n */\r\nCheckBoxBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\t/*\r\n\t * The button must be buld now so that we can check it before attachment...\r\n\t */\r\n\tCheckBoxBinding.superclass.onBindingRegister.call ( this );\r\n\tDataBinding.prototype.onBindingRegister.call ( this );\r\n\tthis._buildButtonBinding ();\r\n\r\n};\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nCheckBoxBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tCheckBoxBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.attachClassName ( Binding.CLASSNAME_CLEARFLOAT );\r\n\t\r\n\tthis.bindingElement.tabIndex = 0;\r\n\tif ( Client.isExplorer ) {\r\n\t\tthis.bindingElement.hideFocus = true;\r\n\t}\r\n\t\r\n\tthis._buildDOMContent ();\r\n}\r\n\r\n/**\r\n * Unregister binding with the window-scope {@link DataManager}.\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nCheckBoxBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tCheckBoxBinding.superclass.onBindingRegister.call ( this );\r\n\tDataBinding.prototype.onBindingDispose.call ( this );\r\n}\r\n\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nCheckBoxBinding.prototype._buildDOMContent = RadioDataBinding.prototype._buildDOMContent;\r\n\r\n/**\r\n * Makes the label active.\r\n * @implements {IEventListener}\r\n * @param {Event} e\r\n */\r\nCheckBoxBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tCheckBoxBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tif ( e.type == DOMEvents.CLICK ) {\r\n\t\tvar target = DOMEvents.getTarget ( e );\r\n\t\tswitch( target ) {\r\n\t\t\tcase this.shadowTree.labelText :\r\n\t\t\t\tthis.setChecked ( !this.isChecked );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Relate binding.\r\n */\r\nCheckBoxBinding.prototype.relate = RadioDataBinding.prototype.relate;\r\n\r\n/**\r\n * Listens for [space] keypress.\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nCheckBoxBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tCheckBoxBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.KEY_SPACE :\r\n\t\t\tthis.setChecked ( !this.isChecked );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Build button.\r\n */\r\nCheckBoxBinding.prototype._buildButtonBinding = function () {\r\n\r\n\tthis._buttonBinding = this.add ( \r\n\t\tCheckButtonBinding.newInstance ( this.bindingDocument )\r\n\t);\r\n\t\r\n\t/*\r\n\t * Consume the button action. \r\n\t * Dispatch more specific action.\r\n\t */\r\n\tvar self = this;\r\n\tthis._buttonBinding.addActionListener ( \r\n\t\tButtonBinding.ACTION_COMMAND, {\r\n\t\t\thandleAction : function ( action ) {\r\n\t\t\t\taction.consume ();\r\n\t\t\t\tself.dispatchAction ( \r\n\t\t\t\t\tCheckBoxBinding.ACTION_COMMAND \r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\r\n\tthis._hack ();\r\n\tthis._buttonBinding.attach ();\r\n\t\r\n\tif ( this.getProperty ( \"ischecked\" )) {\r\n\t\tthis.check ( true );\r\n\t}\r\n}\r\n\r\n/**\r\n * Shameful hack, all because of Explorers CSS rendering challanges.\r\n */\r\nCheckBoxBinding.prototype._hack = function () {\r\n\r\n\tvar self = this;\r\n\tvar callbackid = this.getCallBackID ();\r\n\t\r\n\tthis._buttonBinding.check = function ( isDisableCommand ) {\r\n\t\tButtonBinding.prototype.check.call ( this, isDisableCommand );\r\n\t\tself.setProperty ( \"ischecked\", true );\r\n\t\tself.isChecked = true;\r\n\t\tself.relate ();\r\n\t\tif ( !isDisableCommand ) {\r\n\t\t\tself.focus ();\r\n\t\t}\r\n\t};\r\n\t\r\n\tthis._buttonBinding.uncheck = function ( isDisableCommand ) {\r\n\t\tButtonBinding.prototype.uncheck.call ( this, isDisableCommand );\r\n\t\tself.setProperty ( \"ischecked\", false );\r\n\t\tself.isChecked = false;\r\n\t\tself.relate ();\r\n\t};\r\n\r\n\tthis._buttonBinding.oncommand = function () {\r\n\t\tself.isChecked = this.isChecked;\r\n\t\tself.setProperty(\"ischecked\", self.isChecked);\r\n\t\tself.focus ();\r\n\t\tself.relate ();\r\n\t\tif ( self.oncommand ) {\r\n\t\t\tself.oncommand ();\r\n\t\t}\r\n\t\tself.dirty ();\r\n\t\tif ( callbackid != null ) {\r\n\t\t\tself.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\t\t}\r\n\t};\r\n}\r\n\r\n/**\r\n * @param {boolean} isChecked\r\n * @param {boolean} isDisableCommand Optional.\r\n */\r\nCheckBoxBinding.prototype.setChecked = RadioDataBinding.prototype.setChecked;\r\n\r\n/**\r\n * @param {boolean} isDisableCommand Optional.\r\n */\r\nCheckBoxBinding.prototype.check = RadioDataBinding.prototype.check\r\n\r\n/**\r\n * @param {boolean} isDisableCommand Optional.\r\n */\r\nCheckBoxBinding.prototype.uncheck = RadioDataBinding.prototype.uncheck\r\n\r\n/**\r\n * Build label.\r\n */\r\nCheckBoxBinding.prototype._buildLabelText = RadioDataBinding.prototype._buildLabelText;\r\n\r\n/**\r\n * Set label. \r\n * @param {string} label\r\n */\r\nCheckBoxBinding.prototype.setLabel = RadioDataBinding.prototype.setLabel;\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @param {MouseEvent} e\r\n *\r\nCheckBoxBinding.prototype.handleEvent = RadioDataBinding.prototype.handleEvent;\r\n*/\r\n\r\n\r\n// IMPLEMENT IDATA ...................................................................\r\n\r\n/**\r\n * Set name. The name property is registered with the window-scope  \r\n * {@link DocumentManager} for easy retrieval in other contexts.\r\n * @param {string} name\r\n */\r\nCheckBoxBinding.prototype.setName = DataBinding.prototype.setName;\r\n\r\n/**\r\n * Get name.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nCheckBoxBinding.prototype.getName = DataBinding.prototype.getName;\r\n\r\n/**\r\n * Set dirty flag.\r\n * @implements {IData}\r\n */\r\nCheckBoxBinding.prototype.dirty = DataBinding.prototype.dirty;\r\n\r\n/**\r\n * Reset dirty flag.\r\n * @implements {IData}\r\n */\r\nCheckBoxBinding.prototype.clean = DataBinding.prototype.clean;\r\n\r\n/**\r\n * Focus.\r\n * @implements {IData}\r\n */\r\nCheckBoxBinding.prototype.focus = function () {\r\n\t\r\n\tif ( !this.isFocused ) {\r\n\t\tDataBinding.prototype.focus.call ( this );\r\n\t\tif ( this.isFocused ) {\r\n\t\t\tFocusBinding.focusElement ( this.bindingElement );\r\n\t\t\tthis.subscribe ( BroadcastMessages.KEY_SPACE );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Blur.\r\n * @implements {IData}\r\n */\r\nCheckBoxBinding.prototype.blur = function () {\r\n\t\r\n\tif ( this.isFocused ) {\r\n\t\tDataBinding.prototype.blur.call ( this );\r\n\t\tthis.unsubscribe ( BroadcastMessages.KEY_SPACE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nCheckBoxBinding.prototype.validate = function () {\r\n\t\r\n\tvar result = true;\r\n\tvar parent = this.bindingElement.parentNode;\r\n\r\n\tif ( parent ) {\r\n\t\tvar binding = UserInterface.getBinding ( parent );\r\n\t\tif ( binding && binding instanceof CheckBoxGroupBinding ) {\r\n\t\t\tif ( binding.isRequired ) {\r\n\t\t\t\tif ( binding.isValid ) {\r\n\t\t\t\t\tresult = binding.validate ();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresult = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn result\r\n}\r\n\r\n\r\n/**\r\n * Handle element update.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#handleElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nCheckBoxBinding.prototype.handleElement = RadioDataBinding.prototype.handleElement;\r\n\r\n\r\n/** \r\n * Update element.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#updateElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nCheckBoxBinding.prototype.updateElement = RadioDataBinding.prototype.updateElement;\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nCheckBoxBinding.prototype.manifest = function () {\r\n\t\r\n\tif ( this.isAttached ) {\r\n\t\tswitch ( this.isChecked ) {\r\n\t\t\tcase true :\r\n\t\t\t\tif ( !this.shadowTree.input ) {\r\n\t\t\t\t\tvar input = DOMUtil.createElementNS ( \r\n\t\t\t\t\t\tConstants.NS_XHTML, \"input\", this.bindingDocument\r\n\t\t\t\t\t);\r\n\t\t\t\t\tinput.type = \"hidden\";\r\n\t\t\t\t\tinput.name = this._name;\r\n\t\t\t\t\tinput.style.display = \"none\";\r\n\t\t\t\t\tthis.bindingElement.appendChild ( input );\r\n\t\t\t\t\tthis.shadowTree.input = input;\r\n\t\t\t\t}\r\n\t\t\t\tthis.shadowTree.input.value = this.getValue ();\r\n\t\t\t\tbreak;\r\n\t\t\tcase false :\r\n\t\t\t\tif ( this.shadowTree.input ) {\r\n\t\t\t\t\tthis.bindingElement.removeChild ( this.shadowTree.input );\r\n\t\t\t\t\tthis.shadowTree.input = null;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get value. This is intended for serverside processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nCheckBoxBinding.prototype.getValue = function () {\r\n\t\r\n\tvar result = null;\r\n\tvar value = this.getProperty ( \"value\" );\r\n\tif ( this.isChecked ) {\r\n\t\tresult = value ? value : \"on\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set value.\r\n * @implements {IData}\r\n * @param {string} value\r\n */\r\nCheckBoxBinding.prototype.setValue = function ( value ) {\r\n\t\r\n\tif ( value == this.getValue () || value == \"on\" ) {\r\n\t\tthis.check ( true );\r\n\t} else if ( value != \"on\" ) {\r\n\t\tthis.setPropety ( \"value\", value );\r\n\t}\r\n}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing. \r\n * If a result is set, it will return false or result. \r\n * If not, it will return false or true.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nCheckBoxBinding.prototype.getResult = function () {\r\n\t\r\n\tvar result = false;\r\n\tif ( this.isChecked ) {\r\n\t\tresult = this._result != null ? this._result : true;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} object\r\n */\r\nCheckBoxBinding.prototype.setResult = function ( object ) {\r\n\t\r\n\tif ( typeof object == \"boolean\" ) {\r\n\t\tthis.setChecked ( object, true );\r\n\t} else {\r\n\t\tthis._result = object;\r\n\t}\r\n}\r\n\r\n/**\r\n * CheckBoxBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {CheckBoxBinding}\r\n */\r\nCheckBoxBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:checkbox\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, CheckBoxBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/radiocheck/CheckBoxGroupBinding.js",
    "content": "CheckBoxGroupBinding.prototype = new Binding;\r\nCheckBoxGroupBinding.prototype.constructor = CheckBoxGroupBinding;\r\nCheckBoxGroupBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction CheckBoxGroupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"CheckBoxGroupBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRequired = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isValid = true;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCheckBoxGroupBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[CheckBoxGroupBinding]\";\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCheckBoxGroupBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tCheckBoxGroupBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.isRequired = this.getProperty ( \"required\" ) == true;\r\n}\r\n\r\n/**\r\n * @return {boolean}\r\n */\r\nCheckBoxGroupBinding.prototype.validate = function () {\r\n\t\r\n\tvar result = true;\r\n\tif ( this.isRequired ) {\r\n\t\tvar checkboxes = this.getDescendantBindingsByLocalName ( \"checkbox\" );\r\n\t\tif ( checkboxes.hasEntries ()) {\r\n\t\t\tresult = false;\r\n\t\t\twhile ( checkboxes.hasNext () && !result ) {\r\n\t\t\t\tif ( checkboxes.getNext ().isChecked ) {\r\n\t\t\t\t\tresult = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( result == false ) {\r\n\t\t\tthis._showWarning ( true );\r\n\t\t\tthis.dispatchAction ( Binding.ACTION_INVALID );\r\n\t\t\tthis.addActionListener ( CheckBoxBinding.ACTION_COMMAND );\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Show or hide warning.\r\n * @param {boolean} isShow\r\n */\r\nCheckBoxGroupBinding.prototype._showWarning = function ( isShow ) {\r\n\t\r\n\tif ( isShow ) {\r\n\t\tif ( !this._labelBinding ) {\r\n\t\t\tvar labelBinding = LabelBinding.newInstance ( this.bindingDocument );\r\n\t\t\tlabelBinding.attachClassName ( \"invalid\" );\r\n\t\t\tlabelBinding.setImage ( \"${icon:error}\" );\r\n\t\t\tlabelBinding.setLabel ( \"Selection required\" );\r\n\t\t\tthis._labelBinding = this.addFirst ( labelBinding );\r\n\t\t\tthis._labelBinding.attach ();\r\n\t\t}\r\n\t} else if ( this._labelBinding ) {\r\n\t\tthis._labelBinding.dispose ();\r\n\t\tthis._labelBinding = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nCheckBoxGroupBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tCheckBoxGroupBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase CheckBoxBinding.ACTION_COMMAND :\r\n\t\t\tthis._showWarning ( false );\r\n\t\t\tthis.dispatchAction ( Binding.ACTION_VALID );\r\n\t\t\tthis.removeActionListener ( CheckBoxBinding.ACTION_COMMAND );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * CheckBoxGroupBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {CheckBoxGroupBinding}\r\n */\r\nCheckBoxGroupBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:checkboxgroup\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, CheckBoxGroupBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/radiocheck/CheckTreeBinding.js",
    "content": "﻿CheckTreeBinding.prototype = new TreeBinding;\nCheckTreeBinding.prototype.constructor = CheckTreeBinding;\nCheckTreeBinding.superclass = TreeBinding.prototype;\n\n\n/**\n * @class\n */\nfunction CheckTreeBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"CheckTreeBinding\");\n\n\treturn this;\n}\n\n/**\n * Identifies binding.\n */\nCheckTreeBinding.prototype.toString = function () {\n\n\treturn \"[CheckTreeBinding]\";\n}\n\n/**\n * Grab keyboard.\n */\nCheckTreeBinding.prototype._grabKeyboard = function () {\n\n\tthis.subscribe(BroadcastMessages.KEY_SPACE);\n\n\tCheckTreeBinding.superclass._grabKeyboard.call(this);\n};\n\n/**\n * Release keyboard.\n */\nCheckTreeBinding.prototype._releaseKeyboard = function () {\n\n\tthis.unsubscribe(BroadcastMessages.KEY_SPACE);\n\n\tCheckTreeBinding.superclass._releaseKeyboard.call(this);\n};\n\n\n/**\n * @implements {IBroadcastListener}\n * @param {string} broadcast\n * @param {object} arg\n */\nCheckTreeBinding.prototype.handleBroadcast = function (broadcast, arg) {\n\n\tCheckTreeBinding.superclass.handleBroadcast.call(this, broadcast, arg);\n\n\tswitch (broadcast) {\n\n\t\tcase BroadcastMessages.KEY_SPACE:\n\t\t\tvar focused = this.getFocusedTreeNodeBindings();\n\t\t\tif (focused.hasEntries()) {\n\t\t\t\tvar node = focused.getFirst();\n\t\t\t\tif (node instanceof CheckTreeNodeBinding) {\n\t\t\t\t\tif (!node.isReadOnly) {\n\t\t\t\t\t\tnode.invoke();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\n\n/**\n * @param {DOMDocument} ownerDocument\n * @return {TreeNodeBinding}\n */\nCheckTreeBinding.newInstance = function (ownerDocument) {\n\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:tree\", ownerDocument);\n\tvar binding = UserInterface.registerBinding(element, CheckTreeBinding);\n\tbinding.treeBodyBinding = TreeBodyBinding.newInstance(ownerDocument);\n\treturn binding;\n}\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/radiocheck/CheckTreeNodeBinding.js",
    "content": "﻿CheckTreeNodeBinding.prototype = new TreeNodeBinding;\nCheckTreeNodeBinding.prototype.constructor = CheckTreeNodeBinding;\nCheckTreeNodeBinding.superclass = TreeNodeBinding.prototype;\n\nCheckTreeNodeBinding.CLASS_NAME = \"checkbox\";\n\nCheckTreeNodeBinding.ACTION_COMMAND = \"checkbox treenode command\";\n\n/**\n * @class\n */\nfunction CheckTreeNodeBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"CheckTreeNodeBinding\");\n\n\t/**\n\t * @type {DOMNode}\n\t */\n\tthis.selectionElement = null;\n\n\t/**\n\t * @type {string}\n\t */\n\tthis.selectionValue = null;\n\n\t/**\n\t * @type {boolean}\n\t */\n\tthis.isSelectable = true;\n\n\t/**\n\t * @type {boolean}\n\t */\n\tthis.isReadOnly = false;\n\n\treturn this;\n}\n\n/**\n * Identifies binding.\n */\nCheckTreeNodeBinding.prototype.toString = function () {\n\n\treturn \"[CheckTreeNodeBinding]\";\n}\n\n/**\n * @overloads {TreeNodeBinding#onBindingRegister}\n */\nCheckTreeNodeBinding.prototype.onBindingRegister = function () {\n\n\tCheckTreeNodeBinding.superclass.onBindingRegister.call(this);\n\n}\n\n/**\n * @overloads {TreeNodeBinding#onBindingAttach}\n */\nCheckTreeNodeBinding.prototype.onBindingAttach = function () {\n\n\tCheckTreeNodeBinding.superclass.onBindingAttach.call(this);\n\n\tthis._parseDOMProperties();\n\tthis._buildCheckButtonBinding();\n\n\tif (this.isReadOnly) {\n\t\tthis.labelBinding.attachClassName(LabelBinding.CLASSNAME_GRAYTEXT);\n\t}\n}\n\n/**\n * Parse DOM properties, instantiating editation and selectation.\n */\nCheckTreeNodeBinding.prototype._parseDOMProperties = function () {\n\n\tthis.isSelectable = this.isSelectable ? true : this.getProperty(\"selectable\");\n}\n\n/**\n * Build button.\n */\nCheckTreeNodeBinding.prototype._buildCheckButtonBinding = function () {\n\n\tif (this.isSelectable) {\n\t\tthis._buttonBinding = CheckButtonBinding.newInstance(this.bindingDocument);\n\t\tthis.bindingElement.insertBefore(\n\t\t\tthis._buttonBinding.bindingElement,\n\t\t\tthis.labelBinding.bindingElement.nextSibling\n\t\t);\n\t\tif (this.getProperty(\"selected\") === true) {\n\t\t\tthis._buttonBinding.check(true);\n\t\t}\n\t\tif (this.isReadOnly) {\n\t\t\tthis._buttonBinding.setDisabled(true);\n\t\t}\n\n\t\tvar self = this;\n\t\tthis._buttonBinding.addActionListener(\n\t\t\tButtonBinding.ACTION_COMMAND, {\n\t\t\t\thandleAction: function(action) {\n\t\t\t\t\taction.consume();\n\t\t\t\t\tself.dispatchAction(\n\t\t\t\t\t\tCheckTreeNodeBinding.ACTION_COMMAND\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis._buttonBinding.attach();\n\n\t\tthis.attachClassName(CheckTreeNodeBinding.CLASS_NAME);\n\t}\n}\n\nCheckTreeNodeBinding.prototype.isChecked = function () {\n\n\tif (this.isSelectable) {\n\t\treturn this._buttonBinding.isChecked;\n\t}\n\treturn undefined;\n}\n\nCheckTreeNodeBinding.prototype.setChecked = function (isChecked, isDisableCommand) {\n\n\tif (this.isSelectable) {\n\t\tthis._buttonBinding.setChecked(isChecked, isDisableCommand);\n\t}\n}\n\nCheckTreeNodeBinding.prototype.invoke = function () {\n\n\tif (this.isSelectable) {\n\t\tthis._buttonBinding.invoke();\n\t}\n}\n\n/**\n * TreeNodeBinding factory.\n * @param {DOMDocument} ownerDocument\n * @return {TreeNodeBinding}\n */\nCheckTreeNodeBinding.newInstance = function(ownerDocument) {\n\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:treenode\", ownerDocument);\n\treturn UserInterface.registerBinding(element, CheckTreeNodeBinding);\n}\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/radiocheck/RadioDataBinding.js",
    "content": "RadioDataBinding.prototype = new Binding;\r\nRadioDataBinding.prototype.constructor = RadioDataBinding;\r\nRadioDataBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * TODO: note on how RadioGroupBindings handles only buttons\r\n */\r\nfunction RadioDataBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"RadioDataBinding\" );\r\n\t\r\n\t/** \r\n\t * This has something to do with the mechanics of the containing RadioDataGroup.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRadioButton = false;\r\n\t\r\n\t/** \r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isChecked = false;\r\n\t\r\n\t/** \r\n\t * TODO: implement this some day!\r\n\t * @type {object}\r\n\t */\r\n\tthis._result = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.bindingRelate = null;\r\n\t\r\n\t/*\r\n\t * Returnable. \r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nRadioDataBinding.prototype.toString = function () {\r\n\r\n\treturn \"[RadioDataBinding]\";\r\n}\r\n\r\n/*\r\n * Build radiobutton on REGISTER already. This because of radiogroup initialization.\r\n */\r\nRadioDataBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tRadioDataBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis._buttonBinding = this.add ( \r\n\t\tRadioButtonBinding.newInstance ( this.bindingDocument )\r\n\t);\r\n\tthis._hack ();\r\n\t\r\n\tif ( this.getProperty ( \"ischecked\" ) == true ) {\r\n\t\tthis.check ( true );\r\n\t}\r\n\t\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nRadioDataBinding.prototype.onBindingAttach = function () {\r\n\r\n\tRadioDataBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.attachClassName ( Binding.CLASSNAME_CLEARFLOAT );\r\n\tthis._buttonBinding.attach ();\r\n\tthis._buildDOMContent ();\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nRadioDataBinding.prototype._buildDOMContent = function () {\r\n\t\r\n\tvar relate = this.getProperty ( \"relate\" );\r\n\tvar oncommand = this.getProperty(\"oncommand\");\r\n\tvar disabled = this.getProperty(\"isdisabled\");\r\n\t\r\n\tif ( relate ) {\r\n\t\tthis.bindingRelate = relate;\r\n\t\tthis.relate ();\r\n\t}\r\n\tif ( oncommand ) {\r\n\t\tthis.oncommand = function () {\r\n\t\t\tBinding.evaluate ( oncommand, this );\r\n\t\t};\r\n\t}\r\n\r\n\tif (disabled == true) {\r\n\t\tthis.disable();\r\n\t}\r\n\r\n\t/*\r\n\t * Setup ASP.NET callback.\r\n\t */\r\n\tif ( this.hasCallBackID ()) {\r\n\t\tBinding.dotnetify ( this );\r\n\t}\r\n\t\r\n\tthis._buildLabelText ();\r\n}\r\n\r\n/**\r\n * Broadcast relation.\r\n */\r\nRadioDataBinding.prototype.relate = function () {\r\n\t\r\n\tif ( this.bindingRelate != null ) {\r\n\t\tthis.logger.warn ( \"Relations not properly implemented!\" ); // see method setChecked...\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.BINDING_RELATE, {\r\n\t\t\trelate : this.bindingRelate,\r\n\t\t\torigin : this.bindingDocument,\r\n\t\t\tresult : this.isChecked\r\n\t\t});\r\n\t}\r\n}\r\n\r\n/**\r\n * TODO: note on how RadioGroupBindings handles only buttons\r\n * {@see RadioGroupBinding#setCheckedButtonBinding}\r\n * @return {RadioButtonBinding}\r\n */\r\nRadioDataBinding.prototype.getButton = function () {\r\n\t\r\n\treturn this._buttonBinding;\r\n}\r\n\r\n/**\r\n * Shameful hack, all because of Explorers CSS rendering challanges.\r\n */\r\nRadioDataBinding.prototype._hack = function () {\r\n\r\n\tvar self = this;\r\n\tvar callbackid = this.getCallBackID ();\r\n\t\r\n\tthis._buttonBinding.check = function ( isDisableCommand ) {\r\n\t\tRadioButtonBinding.prototype.check.call ( this, isDisableCommand );\r\n\t\tself.setProperty ( \"ischecked\", true );\r\n\t\tself.isChecked = true;\r\n\t\tself.relate ();\r\n\t}\r\n\t\r\n\tthis._buttonBinding.uncheck = function ( isDisableCommand ) {\r\n\t\tRadioButtonBinding.prototype.uncheck.call ( this, isDisableCommand );\r\n\t\tself.deleteProperty ( \"ischecked\" );\r\n\t\tself.isChecked = false;\r\n\t\tself.relate ();\r\n\t}\r\n\t\r\n\tthis._buttonBinding.oncommand = function () {\r\n\t\tself.isChecked = this.isChecked;\r\n\t\tself.setProperty(\"ischecked\", self.isChecked);\r\n\t\tself.relate ();\r\n\t\tif ( Types.isFunction ( self.oncommand )) {\r\n\t\t\tself.oncommand ();\r\n\t\t}\t\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {boolean} isChecked\r\n * @param {boolean} isDisableCommand Optional.\r\n */\r\nRadioDataBinding.prototype.setChecked = function ( isChecked, isDisableCommand ) {\r\n\t\r\n\t//if ( this.isAttched == true ) {\r\n\tthis._buttonBinding.setChecked ( isChecked, isDisableCommand );\r\n\tif ( this.bindingRelate != null ) {\r\n\t\tthis.relate (); // TOOOOOOOOOOOOOOO EARLY ON REGISTER!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n\t}\r\n\t//}\r\n\tthis.setProperty ( \"ischecked\", isChecked );\r\n}\r\n\r\n/**\r\n * @param {boolean} isDisableCommand Optional.\r\n */\r\nRadioDataBinding.prototype.check = function ( isDisableCommand ) {\r\n\t\r\n\tthis.setChecked ( true, isDisableCommand );\t\r\n}\r\n\r\n/**\r\n * @param {boolean} isDisableCommand Optional.\r\n */\r\nRadioDataBinding.prototype.uncheck = function ( isDisableCommand ) {\r\n\t\r\n\tthis.setChecked ( false, isDisableCommand );\t\r\n}\r\n\r\n/**\r\n * Flip disabled.\r\n * @param {boolean} isDisabled\r\n */\r\nRadioDataBinding.prototype.setDisabled = function ( isDisabled ) {\r\n\t\r\n\tif ( isDisabled != this.isDisabled ) {\r\n\t\tthis.isDisabled = isDisabled;\r\n\t\tthis._buttonBinding.setDisabled ( isDisabled );\r\n\t\tif ( isDisabled ) {\r\n\t\t\tthis.attachClassName ( DataBinding.CLASSNAME_DISABLED );\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( DataBinding.CLASSNAME_DISABLED );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Disable.\r\n */\r\nRadioDataBinding.prototype.disable = function () {\r\n\r\n\tif ( !this.isDisabled ) {\r\n\t\tthis.setDisabled ( true );\r\n\t}\r\n}\r\n\r\n/**\r\n * Enable.\r\n */\r\nRadioDataBinding.prototype.enable = function () {\r\n\t\r\n\tif ( this.isDisabled ) {\r\n\t\tthis.setDisabled ( false );\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nRadioDataBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tRadioDataBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tif ( e.type == DOMEvents.CLICK ) {\r\n\t\tvar target = DOMEvents.getTarget ( e );\r\n\t\tswitch( target ) {\r\n\t\t\tcase this.shadowTree.labelText :\r\n\t\t\t\tif ( !this.isChecked && !this.isDisabled ) {\r\n\t\t\t\t\tthis.check ();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Explorer cannot overwrite inherited \"white-space: nowrap\" \r\n * in a regular button, so we need to build a special label.\r\n */\r\nRadioDataBinding.prototype._buildLabelText = function () {\r\n\t\r\n\tvar label = this.getProperty ( \"label\" );\r\n\tif ( label ) {\r\n\t\tthis.shadowTree.labelText = DOMUtil.createElementNS ( \r\n\t\t\tConstants.NS_UI, \r\n\t\t\t\"ui:datalabeltext\", \r\n\t\t\tthis.bindingDocument \r\n\t\t);\r\n\t\tthis.shadowTree.labelText.appendChild ( \r\n\t\t\tthis.bindingDocument.createTextNode ( \r\n\t\t\t\tResolver.resolve ( label )\r\n\t\t\t)\r\n\t\t);\r\n\t\tDOMEvents.addEventListener ( \r\n\t\t\tthis.shadowTree.labelText, \r\n\t\t\tDOMEvents.CLICK, \r\n\t\t\tthis \r\n\t\t);\r\n\t\tthis.bindingElement.appendChild ( \r\n\t\t\tthis.shadowTree.labelText \r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nRadioDataBinding.prototype.setLabel = function ( label ) {\r\n\t\r\n\tif ( this.shadowTree.labelText != null ) {\r\n\t\tthis.shadowTree.labelText.firstChild.data = label;\r\n\t}\r\n\tthis.setProperty ( \"label\", label );\r\n}\r\n\r\n\r\n/**\r\n * Handle element update.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#handleElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nRadioDataBinding.prototype.handleElement = function (element) {\r\n\r\n\treturn true;\r\n};\r\n\r\n/** \r\n * Update element.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#updateElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nRadioDataBinding.prototype.updateElement = function (element) {\r\n\r\n\tvar ischecked = element.getAttribute(\"ischecked\") === \"true\";\r\n\tif (this.isChecked != ischecked) {\r\n\t\tthis.setChecked(ischecked, true);\r\n\t}\r\n\treturn true;\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/radiocheck/RadioDataGroupBinding.js",
    "content": "RadioDataGroupBinding.prototype = new RadioGroupBinding;\r\nRadioDataGroupBinding.prototype.constructor = RadioDataGroupBinding;\r\nRadioDataGroupBinding.superclass = RadioGroupBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction RadioDataGroupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"RadioDataGroupBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._name = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasFocus = false;\r\n\t\r\n\t/**\r\n\t * @implements {IData}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\t\r\n\t/**\r\n\t * @implements {IData}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nRadioDataGroupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[RadioDataGroupBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {RadioGroupBinding#onBindingRegister}\r\n */\r\nRadioDataGroupBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tRadioDataGroupBinding.superclass.onBindingRegister.call ( this );\r\n\tDataBinding.prototype.onBindingRegister.call ( this );\r\n\tthis.addActionListener ( RadioGroupBinding.ACTION_SELECTIONCHANGED, this );\r\n}\r\n\r\n/**\r\n * @overloads {RadioGroupBinding#onBindingAttach}\r\n */\r\nRadioDataGroupBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tRadioDataGroupBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.bindingElement.tabIndex = 0;\r\n\tif ( Client.isExplorer ) {\r\n\t\tthis.bindingElement.hideFocus = true;\r\n\t}\r\n\t\r\n\tvar self = this;\r\n\tDOMEvents.addEventListener ( this.bindingElement, DOMEvents.FOCUS, {\r\n\t\thandleEvent : function () {\r\n\t\t\tself.focus ( true );\r\n\t\t}\r\n\t});\r\n\r\n\tvar onchange = this.getProperty(\"onchange\");\r\n\tif (onchange) {\r\n\t\tthis.onValueChange = function () {\r\n\t\t\tBinding.evaluate(onchange, this);\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nRadioDataGroupBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tRadioDataGroupBinding.superclass.onBindingDispose.call ( this );\r\n\tDataBinding.prototype.onBindingDispose.call ( this );\r\n}\r\n\r\n/**\r\n * Dispatching dirty events.\r\n * @implements {IActionListener}\r\n * @overloads {RadioGroupBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nRadioDataGroupBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tRadioDataGroupBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase RadioGroupBinding.ACTION_SELECTIONCHANGED :\r\n\t\t\tthis.dirty();\r\n\t\t\tthis.onValueChange();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * We need to trap the arrowkey events in order to stop the page from scrolling \r\n * when radiobuttons are keyboardnavigated. Notice that keyboardhandling by itself \r\n * is handled similarly to other DataBindings (using the EventBroadcaster).\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {KeyEvent} e\r\n */\r\nRadioDataGroupBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tRadioDataGroupBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tif ( e.type == DOMEvents.KEYDOWN ) {\r\n\t\tswitch ( e.keyCode ) {\r\n\t\t\tcase KeyEventCodes.VK_DOWN :\r\n\t\t\tcase KeyEventCodes.VK_UP :\r\n\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t\tKeyboard.keyArrow ( e.keyCode ); // will trigger EventBroadcaster\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nRadioDataGroupBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tRadioDataGroupBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.KEY_ARROW :\r\n\t\t\r\n\t\t\tvar current = null;\r\n\t\t\tvar next = null;\r\n\t\t\tvar radios = null;\r\n\t\t\t\r\n\t\t\tswitch ( arg ) {\r\n\t\t\t\tcase KeyEventCodes.VK_DOWN :\r\n\t\t\t\tcase KeyEventCodes.VK_UP :\r\n\t\t\t\t\tradios = this.getChildBindingsByLocalName ( \"radio\" );\r\n\t\t\t\t\twhile ( !current && radios.hasNext ()) { \r\n\t\t\t\t\t\tvar radio = radios.getNext ();\r\n\t\t\t\t\t\tif ( radio.getProperty ( \"ischecked\" )) {\r\n\t\t\t\t\t\t\tcurrent = radio;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tif ( current ) {\r\n\t\t\t\tswitch ( arg ) {\r\n\t\t\t\t\tcase KeyEventCodes.VK_DOWN :\r\n\t\t\t\t\t\tnext = radios.getFollowing ( current );\r\n\t\t\t\t\t\twhile ( next != null && next.isDisabled ) {\r\n\t\t\t\t\t\t\tnext = radios.getFollowing ( next );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase KeyEventCodes.VK_UP :\r\n\t\t\t\t\t\tnext = radios.getPreceding ( current );\r\n\t\t\t\t\t\twhile ( next != null && next.isDisabled ) {\r\n\t\t\t\t\t\t\tnext = radios.getPreceding ( next );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( next != null ) {\r\n\t\t\t\tthis.setCheckedButtonBinding ( next );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set name. The name property is registered with the window-scope  \r\n * {@link DocumentManager} for easy retrieval in other contexts.\r\n * @param {string} name\r\n */\r\nRadioDataGroupBinding.prototype.setName = DataBinding.prototype.setName;\r\n\r\n/**\r\n * Get name.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nRadioDataGroupBinding.prototype.getName = DataBinding.prototype.getName;\r\n\r\n/**\r\n * Set dirty flag.\r\n * @implements {IData}\r\n */\r\nRadioDataGroupBinding.prototype.dirty = DataBinding.prototype.dirty;\r\n\r\n/**\r\n * Reset dirty flag.\r\n * @implements {IData}\r\n */\r\nRadioDataGroupBinding.prototype.clean = DataBinding.prototype.clean;\r\n\r\n/**\r\n * Focus.\r\n * @param {boolean} isDOMEvent\r\n * @implements {IData}\r\n */\r\nRadioDataGroupBinding.prototype.focus = function ( isDOMEvent ) {\r\n\t\r\n\tif ( !this.isFocused ) {\r\n\t\tDataBinding.prototype.focus.call ( this );\r\n\t\tif ( this.isFocused ) {\r\n\t\t\tif ( !isDOMEvent ) {\r\n\t\t\t\tFocusBinding.focusElement ( this.bindingElement );\r\n\t\t\t}\r\n\t\t\tthis.addEventListener ( DOMEvents.KEYDOWN );\r\n\t\t\tthis.subscribe ( BroadcastMessages.KEY_ARROW );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Blur.\r\n * @implements {IData}\r\n */\r\nRadioDataGroupBinding.prototype.blur = function () {\r\n\t\r\n\tif ( this.isFocused ) {\r\n\t\tDataBinding.prototype.blur.call ( this );\r\n\t\tthis.removeEventListener ( DOMEvents.KEYDOWN );\r\n\t\tthis.unsubscribe ( BroadcastMessages.KEY_ARROW );\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nRadioDataGroupBinding.prototype.validate = function () {\r\n\t\r\n\treturn true; // TODO: validate \"required\"! Do we even wan't to support this?\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nRadioDataGroupBinding.prototype.manifest = function () {\r\n\t\r\n\tif ( this.isAttached ) {\r\n\t\tif ( !this.shadowTree.input ) {\r\n\t\t\tvar input = DOMUtil.createElementNS ( \r\n\t\t\t\tConstants.NS_XHTML, \"input\", this.bindingDocument\r\n\t\t\t);\r\n\t\t\tinput.type = \"hidden\";\r\n\t\t\tinput.name = this._name;\r\n\t\t\tthis.bindingElement.appendChild ( input );\r\n\t\t\tthis.shadowTree.input = input;\r\n\t\t}\r\n\t\tthis.shadowTree.input.value = this.getValue ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nRadioDataGroupBinding.prototype.getValue = function () {\r\n\t\r\n\tvar result = null;\r\n\tvar radios = this.getChildBindingsByLocalName ( \"radio\" );\r\n\twhile ( !result && radios.hasNext ()) { \r\n\t\tvar radio = radios.getNext ();\r\n\t\tif ( radio.isChecked ) {\r\n\t\t\tresult = radio.getProperty ( \"value\" );\r\n\t\t}\r\n\t};\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nRadioDataGroupBinding.prototype.getResult = RadioDataGroupBinding.prototype.getValue;\r\n\r\n/**\r\n * Set value.\r\n * TODO!\r\n * @implements {IData}\r\n * @param {string} value\r\n */\r\nRadioDataGroupBinding.prototype.setValue = function ( value ) {}\r\n\r\n/**\r\n * Set result.\r\n * TODO!\r\n * @implements {IData}\r\n * @param {object} result\r\n */\r\nRadioDataGroupBinding.prototype.setResult = function (result) { }\r\n\r\nRadioDataGroupBinding.prototype.onValueChange = function () { }"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/selectors/DataInputSelectorBinding.js",
    "content": "DataInputSelectorBinding.prototype = new DataInputBinding;\r\nDataInputSelectorBinding.prototype.constructor = DataInputSelectorBinding;\r\nDataInputSelectorBinding.superclass = DataInputBinding.prototype;\r\n\r\nDataInputSelectorBinding.INDICATOR_IMAGE = \"popup\";\r\nDataInputSelectorBinding.ACTION_SELECTIONCHANGED = \"datainputselectorselectionchanged\";\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction DataInputSelectorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DataInputSelectorBinding\" );\r\n\r\n\t/**\r\n\t * @type {ToolBarButtonBinding}\r\n\t */\r\n\tthis._buttonBinding = null;\r\n\r\n\t/**\r\n\t * @type {PopupBinding}\r\n\t */\r\n\tthis._popupBinding = null;\r\n\r\n\t/**\r\n\t * @type {MenuBodyBinding}\r\n\t */\r\n\tthis._menuBodyBinding = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._selectionValue = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasKeyboard = false;\r\n\r\n\t/**\r\n\t * Flipped when menitems need to be reattached.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isUpToDate = false;\r\n\r\n\t/**\r\n\t * @type {MenuItemBinding}\r\n\t */\r\n\tthis._selectedItemBinding = null;\r\n\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters = new List([DocumentCrawler.ID, FocusCrawler.ID]);\r\n\r\n\t/**\r\n\t* Used for saving value in readonly mode.\r\n\t* @type {string}\r\n\t*/\r\n\tthis.value = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDataInputSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DataInputSelectorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingDispose}\r\n * @see {SelectorBinding#onBindingDispose}\r\n */\r\nDataInputSelectorBinding.prototype.onBindingDispose = SelectorBinding.prototype.onBindingDispose;\r\n\r\n/**\r\n * Build button, build popup and populate by selection elements.\r\n * @overloads {DataBinding#_buildDOMContent}\r\n */\r\nDataInputSelectorBinding.prototype._buildDOMContent = function () {\r\n\r\n\tDataInputSelectorBinding.superclass._buildDOMContent.call(this);\r\n\r\n\tthis.buildButton();\r\n\tthis.buildPopup();\r\n\tthis.buildSelections();\r\n}\r\n\r\n\r\n/**\r\n* @overloads {Binding#onBindingAttach}\r\n*/\r\nDataInputSelectorBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDataInputSelectorBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tvar image = this.getProperty(\"image\");\r\n\tif (image) {\r\n\t\tthis.setImage(image);\r\n\t}\r\n\r\n\tvar self = this;\r\n\tDOMEvents.addEventListener(this.shadowTree.input, DOMEvents.DOUBLECLICK, {\r\n\t\thandleEvent: function (e) {\r\n\t\t\tif (self.isReadOnly) {\r\n\t\t\t\tself.shadowTree.input.value = self.value;\r\n\t\t\t\tself.setReadOnly(false);\r\n\t\t\t\tself.focus();\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Build button.\r\n */\r\nDataInputSelectorBinding.prototype.buildButton = function () {\r\n\r\n\tvar button = this.addFirst (\r\n\t\tToolBarButtonBinding.newInstance ( this.bindingDocument )\r\n\t);\r\n\tbutton.popupBindingTargetElement = this.shadowTree.box;\r\n\tbutton.setImage ( DataInputSelectorBinding.INDICATOR_IMAGE );\r\n\tbutton.attach ();\r\n\r\n\tvar self = this;\r\n\tbutton.oncommand = function () {\r\n\t \tself._attachSelections ();\r\n\t}\r\n\r\n\tthis._buttonBinding = button;\r\n}\r\n\r\n/**\r\n * Build popup.\r\n * @see {SelectorBinding#buildPopup}\r\n */\r\nDataInputSelectorBinding.prototype.buildPopup = SelectorBinding.prototype.buildPopup;\r\n\r\n\r\n/**\r\n * Build selections.\r\n */\r\nDataInputSelectorBinding.prototype.buildSelections = function () {\r\n\r\n\t/*\r\n\t * Parse DOM content.\r\n\t */\r\n\tvar list = new List ();\r\n\tvar selections = DOMUtil.getElementsByTagName ( this.bindingElement, \"selection\" );\r\n\tnew List ( selections ).each ( function ( selection ) {\r\n\t\tif ( selection.getAttribute ( \"label\" )) {\r\n\t\t\tthrow \"label not supported - use value property!\";\r\n\t\t} else {\r\n\t\t\tvar value \t= selection.getAttribute ( \"value\" );\r\n\t\t\tvar select \t= selection.getAttribute ( \"selected\" );\r\n\t\t\tvar toolTip = selection.getAttribute ( \"tooltip\" );\r\n\t\t\tlist.add ({\r\n\t\t\t\tvalue \t\t: value ? value : null,\r\n\t\t\t\ttoolTip\t\t: toolTip ? toolTip : null,\r\n\t\t\t\tisSelected\t: ( select && select == \"true\" ) ? true : false\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\tthis.populateFromList ( list );\r\n}\r\n\r\n/**\r\n * @param {List} list\r\n */\r\nDataInputSelectorBinding.prototype.populateFromList = function (list) {\r\n\r\n\tvar bodyBinding = this._menuBodyBinding;\r\n\tvar bodyDocument = bodyBinding.bindingDocument;\r\n\r\n\t/*\r\n\t* Dispose existing content, remembering that bindings\r\n\t* may not be attached (before the button is pressed).\r\n\t*/\r\n\twhile (bodyBinding.bindingElement.hasChildNodes()) {\r\n\t\tvar node = bodyBinding.bindingElement.lastChild;\r\n\t\tif (node.nodeType == Node.ELEMENT_NODE && UserInterface.hasBinding(node)) {\r\n\t\t\tUserInterface.getBinding(node).dispose();\r\n\t\t} else {\r\n\t\t\tbodyBinding.removeChild(node);\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t* Add new content.\r\n\t*/\r\n\tif (list.hasEntries()) {\r\n\r\n\t\tthis._isUpToDate = false;\r\n\r\n\t\tif (!this._buttonBinding.isVisible) {\r\n\t\t\tthis._buttonBinding.show();\r\n\t\t}\r\n\r\n\t\tvar emptyEntryLabel = this.getProperty(\"emptyentrylabel\")\r\n\t\tif (emptyEntryLabel)\r\n\t\t{\r\n\t\t\tvar itemBinding = MenuItemBinding.newInstance(bodyDocument);\r\n\t\t\titemBinding.setLabel(emptyEntryLabel);\r\n\t\t\titemBinding.selectionValue = \"\";\r\n\t\t\tbodyBinding.add(itemBinding);\r\n\t\t}\r\n\r\n\t\twhile (list.hasNext()) {\r\n\t\t\tvar entry = list.getNext();\r\n\t\t\tvar itemBinding = MenuItemBinding.newInstance(bodyDocument);\r\n\t\t\titemBinding.setLabel(entry.label ? entry.label : entry.value);\r\n\t\t\titemBinding.selectionValue = entry.value;\r\n\t\t\tif (entry.image) {\r\n\t\t\t\titemBinding.setImage(entry.image);\r\n\t\t\t}\r\n\t\t\tif (entry.toolTip) {\r\n\t\t\t\titemBinding.setToolTip(entry.toolTip);\r\n\t\t\t}\r\n\t\t\tif (entry.isSelected) {\r\n\t\t\t\tthis.select(_selectedItemBinding, true);\r\n\t\t\t} else {\r\n\t\t\t\tif (entry.value && entry.value === this.getValue()) {\r\n\t\t\t\t\tthis._selectedItemBinding = itemBinding;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbodyBinding.add(itemBinding);\r\n\t\t}\r\n\t} else {\r\n\t\tthis._buttonBinding.hide();\r\n\t}\r\n}\r\n\r\n/**\r\n * @see {SelectorBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nDataInputSelectorBinding.prototype.handleAction = SelectorBinding.prototype.handleAction;\r\n\r\n/**\r\n * On button command.\r\n * @see {SelectorBinding#handleAction}\r\n */\r\nDataInputSelectorBinding.prototype._onButtonCommand = function () {\r\n\r\n\tthis.focus ();\r\n\tthis._restoreSelection ();\r\n\tthis.dispatchAction ( SelectorBinding.ACTION_COMMAND );\r\n}\r\n\r\n/**\r\n * On popup showing.\r\n * @see {SelectorBinding#handleAction}\r\n */\r\nDataInputSelectorBinding.prototype._onPopupShowing = function () {\r\n\r\n\tthis._fitMenuToSelector ();\r\n\tthis._restoreSelection ();\r\n\tthis._releaseKeyboard ();\r\n}\r\n\r\n/**\r\n * On menuitem command.\r\n * @param {MenuItemBinding} binding\r\n * @see {SelectorBinding#handleAction}\r\n */\r\nDataInputSelectorBinding.prototype._onMenuItemCommand = function ( binding ) {\r\n\r\n\tthis.select ( binding );\r\n\tFocusBinding.focusElement ( this.bindingElement );\r\n\tthis._grabKeyboard ();\r\n}\r\n\r\n/**\r\n * Note that we evaluate this method in the context of\r\n * both the superclass and the SelectorBinding class.\r\n * @implements {IBroadcastListener}\r\n * @see {SelectorBinding#handleAction}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nDataInputSelectorBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tSelectorBinding.prototype.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\t/*\r\n\t * The DataInputBinding has been hacked to blur when a mousedown\r\n\t * is registered. This should obviously not extend to our button.\r\n\t */\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.MOUSEEVENT_MOUSEDOWN :\r\n\t\t\tif ( arg != this._buttonBinding ) {\r\n\t\t\t\tDataInputSelectorBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Grab keyboard.\r\n * @see {SelectorBinding#_grabKeyboard}\r\n */\r\nDataInputSelectorBinding.prototype._grabKeyboard = SelectorBinding.prototype._grabKeyboard;\r\n\r\n/**\r\n * Release keyboard.\r\n * @see {SelectorBinding#_releaseKeyboard}\r\n */\r\nDataInputSelectorBinding.prototype._releaseKeyboard = SelectorBinding.prototype._releaseKeyboard;\r\n\r\n/**\r\n * Keyboard navigation stuff.\r\n * @see {SelectorBinding#_handleArrowKey}\r\n * @param {int} key\r\n */\r\nDataInputSelectorBinding.prototype._handleArrowKey = SelectorBinding.prototype._handleArrowKey;\r\n\r\n/**\r\n * Focus.\r\n * @implements {IData}\r\n * @param {boolean} isDomEvent\r\n */\r\nDataInputSelectorBinding.prototype.focus = function ( isDomEvent ) {\r\n\r\n\tif ( !this.isFocused ) {\r\n\t\tDataInputSelectorBinding.superclass.focus.call ( this, isDomEvent );\r\n\t\tif ( this.isFocused == true ) {\r\n\t\t\tthis._grabKeyboard ();\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\tif ( !this._hasKeyboard ) {\r\n\t\tthis._grabKeyboard ();\r\n\t}\r\n\tDataInputSelectorBinding.superclass.focus.call ( this, isDomEvent );\r\n\t*/\r\n}\r\n\r\n/**\r\n * Blur.\r\n * @implements {IData}\r\n * @param {boolean} isDomEvent\r\n */\r\nDataInputSelectorBinding.prototype.blur = function ( isDomEvent ) {\r\n\r\n\tif ( this.isFocused == true ) {\r\n\t\tDataInputSelectorBinding.superclass.blur.call ( this, isDomEvent );\r\n\t\tthis._releaseKeyboard ();\r\n\t\tif ( this._popupBinding.isVisible ) {\r\n\t\t\tthis._popupBinding.hide ();\r\n\t\t}\r\n\t}\r\n\t/*\r\n\tif ( this._hasKeyboard ) {\r\n\t\tthis._releaseKeyboard ();\r\n\t}\r\n\tif ( this._popupBinding.isVisible ) {\r\n\t\tthis._popupBinding.hide ();\r\n\t}\r\n\tDataInputSelectorBinding.superclass.blur.call ( this, isDomEvent );\r\n\t*/\r\n}\r\n\r\n/**\r\n * For cosmetic reasons, attempting to make\r\n * the opening menu as wide as the selector.\r\n * @see {SelectorBinding#handleAction}\r\n */\r\nDataInputSelectorBinding.prototype._fitMenuToSelector = function () {\r\n\r\n\tvar selectorWidth = this.bindingElement.offsetWidth + \"px\";\r\n\tvar popupElement = this._popupBinding.bindingElement;\r\n\r\n\tpopupElement.style.minWidth = selectorWidth;\r\n}\r\n\r\n/**\r\n * Restore selection.\r\n */\r\nDataInputSelectorBinding.prototype._restoreSelection = function () {\r\n\r\n\tif ( !this._isUpToDate ) {\r\n\t\tthis._attachSelections ();\r\n\t}\r\n\r\n\tvar items = this._menuBodyBinding.getDescendantBindingsByLocalName ( \"menuitem\" );\r\n\tvar value = this.getValue ();\r\n\tvar selected = null;\r\n\r\n\titems.each ( function ( item ) {\r\n\t\tif ( item.getLabel () == value ) {\r\n\t\t\tselected = item;\r\n\t\t}\r\n\t});\r\n\tif ( selected ) {\r\n\t\tselected.focus ();\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @param {MenuItemBinding} item\r\n * @param {boolean} isDefault Set while initializing to block action.\r\n */\r\nDataInputSelectorBinding.prototype.select = function ( item, isDefault ) {\r\n\r\n\tif ( item != this._selectedItemBinding ) {\r\n\r\n\t\tthis._selectedItemBinding = item;\r\n\r\n\t\tthis.setValue(item.selectionValue);\r\n\t\tthis.validate(true);\r\n\r\n\t\tif ( !isDefault ) {\r\n\t\t\tthis.dirty();\r\n\t\t\tvar onselectionchange = this.getProperty(\"onselectionchange\");\r\n\t\t\tif (onselectionchange) {\r\n\t\t\t\tBinding.evaluate(onselectionchange, this);\r\n\t\t\t}\r\n\t\t\tthis.dispatchAction (\r\n\t\t\t\tDataInputSelectorBinding.ACTION_SELECTIONCHANGED\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tthis.shadowTree.input.focus ();\r\n}\r\n\r\n/**\r\n * Build selections. For faster page load time, the popup bindings\r\n * get attached only when user handles the selector button.\r\n */\r\nDataInputSelectorBinding.prototype._attachSelections = SelectorBinding.prototype._attachSelections;\r\n\r\n/**\r\n * Set result (alias set value).\r\n * @implements {IData}\r\n * @param {object} result\r\n */\r\nDataInputSelectorBinding.prototype.setResult = DataInputSelectorBinding.prototype.setValue;\r\n\r\n/**\r\n* OnBlur event\r\n* @overloads {DataInputBinding#onblur}\r\n*/\r\nDataInputSelectorBinding.prototype.onblur = function () {\r\n\r\n\tDataInputSelectorBinding.superclass.onblur.call(this);\r\n\r\n\tif (!self.isReadOnly) {\r\n\t\tthis.setValue(this.getValue());\r\n\t}\r\n}\r\n\r\n/**\r\n* Set value.\r\n* @param {String} value\r\n* @overloads {DataInputBinding#setValue}\r\n*/\r\nDataInputSelectorBinding.prototype.setValue = function (value) {\r\n\r\n\tvar oldIsListValue = this.isReadOnly;\r\n\tvar label = null;\r\n\r\n\tif (value != null && value != \"\") {\r\n\t\tif (this._menuBodyBinding) {\r\n\t\t\tvar items = this._menuBodyBinding.getDescendantBindingsByLocalName(\"menuitem\");\r\n\t\t\twhile (items.hasNext()) {\r\n\t\t\t\tvar item = items.getNext();\r\n\t\t\t\tif (item.selectionValue === value) {\r\n\t\t\t\t\tlabel = item.getLabel();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (label != null) {\r\n\t\tthis.value = value;\r\n\t\tthis.shadowTree.input.value = label;\r\n\t\tif (!this.isReadOnly)\r\n\t\t\tthis.setReadOnly(true);\r\n\r\n\t} else {\r\n\t\tDataInputSelectorBinding.superclass.setValue.call(this, value);\r\n\t\tif (this.isReadOnly)\r\n\t\t\tthis.setReadOnly(false);\r\n\t}\r\n}\r\n\r\n/**\r\n* Get value.\r\n* @overloads {DataInputBinding#getValue}\r\n* @return {string}\r\n*/\r\nDataInputSelectorBinding.prototype.getValue = function () {\r\n\r\n\tif (this.isReadOnly) {\r\n\t\tresult = this.value;\r\n\t} else {\r\n\t\tresult = DataInputSelectorBinding.superclass.getValue.call(this);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n* Set image.\r\n* @param {string} url Eh - this could be a boolean!\r\n* @param {boolean} isNotBuildingClassName Set to true for faster screen update.\r\n*/\r\nDataInputSelectorBinding.prototype.setImage = function (url) {\r\n\r\n\tvar className = \"with-image\";\r\n\r\n\tif (url != false) {\r\n\t    url = url ? url : LabelBinding.DEFAULT_IMAGE;\r\n\t    var label = LabelBinding.newInstance(this.bindingDocument);\r\n\t    label.setImage(url);\r\n\t    this.shadowTree.box.appendChild(label.bindingElement);\r\n\t    label.attach();\r\n\t\tthis.setProperty(\"image\", url);\r\n\t\tthis.hasImage = true;\r\n\t\tthis.attachClassName(className);\r\n\t} else {\r\n\t\tthis.deleteProperty(\"image\");\r\n\t\tthis.hasImage = false;\r\n\t\tthis.detachClassName(className);\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/selectors/HierarchicalSelectorBinding.js",
    "content": "﻿HierarchicalSelectorBinding.prototype = new DataBinding;\nHierarchicalSelectorBinding.prototype.constructor = HierarchicalSelectorBinding;\nHierarchicalSelectorBinding.superclass = DataBinding.prototype;\n\nHierarchicalSelectorBinding.DISPLAY_SELECTED = \"selected\";\nHierarchicalSelectorBinding.DISPLAY_UNSELECTED = \"unselected\";\nHierarchicalSelectorBinding.ACTION_COMMAND = \"HierarchicalSelector command\";\nHierarchicalSelectorBinding.ACTION_SELECTIONCHANGED = \"HierarchicalSelector selection changed\";\n\n/**\n * @class\n * @implements {IData}\n */\nfunction HierarchicalSelectorBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"HierarchicalSelectorBinding\");\n\n\t/**\n\t * Block common crawlers.\n\t * @overwrites {Binding#crawlerFilters}\n\t * @type {List<string>}\n\t */\n\tthis.crawlerFilters = new List([DocumentCrawler.ID, FocusCrawler.ID]);\n\n\t/**\n\t* @type {boolean}\n\t*/\n\tthis.autoSelectChildren = false;\n\n\t/**\n\t* @type {boolean}\n\t*/\n\tthis.autoSelectParents = true;\n\n\t/**\n\t * @type {boolean}\n\t */\n\tthis.isRequired = false;\n\n\t/**\n\t * @type {boolean}\n\t */\n\tthis.hasCounter = false;\n}\n\n/**\n * Identifies binding.\n */\nHierarchicalSelectorBinding.prototype.toString = function () {\n\n\treturn \"[HierarchicalSelectorBinding]\";\n}\n\n/**\n * @overloads {DataBinding#onBindingAttach}\n */\nHierarchicalSelectorBinding.prototype.onBindingAttach = function () {\n\n\tHierarchicalSelectorBinding.superclass.onBindingAttach.call(this);\n\n\tthis.addActionListener(CheckTreeNodeBinding.ACTION_COMMAND);\n\n\tthis._buildDOMContent();\n\tthis._parseDOMProperties();\n\tthis._populate();\n\n\tvar parent = UserInterface.getBinding(this.bindingElement.parentNode);\n\tif (parent != null && parent instanceof DialogPageBodyBinding && parent.bindingElement.children.length === 1) {\n\t\tparent.attachClassName(DialogPageBodyBinding.FILLED_CLASSNAME);\n\t}\n\n\tthis.updateCounter();\n\n}\n\n/**\n * @overloads {ToolBarBinding#onBindingInitialize}\n */\nHierarchicalSelectorBinding.prototype.onBindingInitialize = function () {\n\n\tHierarchicalSelectorBinding.superclass.onBindingInitialize.call(this);\n\tthis.shadowTree.tree.attachRecursive();\n}\n\n/**\n * Build DOM content.\n */\nHierarchicalSelectorBinding.prototype._buildDOMContent = function () {\n\n\t// build box for result display\n\tthis.shadowTree.box = DOMUtil.createElementNS(Constants.NS_UI, \"ui:box\", this.bindingDocument);\n\tthis.bindingElement.appendChild(this.shadowTree.box);\n}\n\n/**\n * Parse DOM properties, instantiating editation and selectation.\n */\nHierarchicalSelectorBinding.prototype._parseDOMProperties = function () {\n\n\tthis.autoSelectChildren = this.getProperty(\"autoselectchildren\") === true;\n    this.autoSelectParents = this.getProperty(\"autoselectparents\") === true;\n\tthis.isRequired = this.getProperty(\"required\") === true;\n\tthis.hasCounter = this.getProperty(\"hascounter\") === true;\n}\n\nHierarchicalSelectorBinding.prototype._populate = function () {\n\n\tthis.shadowTree.tree = CheckTreeBinding.newInstance(this.bindingDocument);\n\tthis.shadowTree.box.appendChild(this.shadowTree.tree.bindingElement);\n\tthis._populateFromSelections(this.shadowTree.tree, this.bindingElement);\n\tthis.shadowTree.tree.attachRecursive();\n\n\tthis.shadowTree.tree.addActionListener(TreeNodeBinding.ACTION_OPEN, this);\n\n}\n\nHierarchicalSelectorBinding.prototype._populateFromSelections = function (treeNodeContainer, selectionContainer) {\n\n\tvar selections = DOMUtil.getChildElementsByLocalName(selectionContainer, \"selection\");\n\tvar treenode = null;;\n\n\tselections.each(function (selection) {\n\n\t\ttreenode = CheckTreeNodeBinding.newInstance(this.bindingDocument);\n\t\tvar label = selection.getAttribute(\"label\");\n\t\tvar value = selection.getAttribute(\"value\");\n\t\tvar isSelected = selection.getAttribute(\"selected\") === \"true\";\n\t\tvar image = selection.getAttribute(\"image\");\n\t\tvar isSelectable = selection.getAttribute(\"selectable\") === \"true\";\n\t\tvar isReadonly = selection.getAttribute(\"readonly\") === \"true\";\n\n\t\ttreenode.setLabel(label);\n\t\ttreenode.setImage(image);\n\t\ttreenode.imageProfile = new ImageProfile({\n\t\t\timage: image,\n\t\t\timageHover: null,\n\t\t\timageActive: null,\n\t\t\timageDisabled: null\n\t\t});\n\t\ttreenode.setProperty(\"selected\", isSelected);\n\t\ttreenode.selectionElement = selection;\n\t\ttreenode.selectionValue = value;\n\t\ttreenode.isSelectable = isSelectable;\n\t\ttreenode.isReadOnly = isReadonly;\n\n\t\ttreenode.isContainer = selection.hasChildNodes();\n\n\t\ttreeNodeContainer.add(treenode);\n\n\t}, this);\n\n\tif (treeNodeContainer instanceof CheckTreeBinding && selections.getLength() === 1) {\n\t\ttreenode.setProperty(\"open\", true);\n\t\ttreenode.setProperty(\"pin\", true);\n\t\tthis._populateFromSelections(treenode, treenode.selectionElement);\n\t\ttreenode.hasBeenOpened = true;\n\t}\n}\n\n/**\n * Focus when button is handled; and hide the internal DataDialogBinding.\n * @implements {IActionListener}\n * @overloads {Binding#handleAction}\n * @param {Action} action\n */\nHierarchicalSelectorBinding.prototype.handleAction = function (action) {\n\n\tHierarchicalSelectorBinding.superclass.handleAction.call(this, action);\n\n\tvar binding = action.target;\n\n\tswitch (action.type) {\n\n\t\tcase CheckTreeNodeBinding.ACTION_COMMAND:\n\n\t\t\tthis.dirty();\n\n\t\t\tvar checkTreeNode = action.target;\n\t\t\tvar isChecked = checkTreeNode.isChecked();\n\n\t\t\tcheckTreeNode.selectionElement.setAttribute(\"selected\", isChecked);\n\n\t\t\tif (this.autoSelectChildren || this.autoSelectParents && !isChecked) {\n\n\t\t\t\tthis.checkChildrenLazySelections(checkTreeNode, isChecked);\n\n\t\t\t\tcheckTreeNode.getDescendantBindingsByType(CheckTreeNodeBinding).each(function (child) {\n\t\t\t\t\tif (child.isSelectable && !child.isReadOnly) {\n\t\t\t\t\t\tchild.setChecked(isChecked, true);\n\t\t\t\t\t\tchild.selectionElement.setAttribute(\"selected\", isChecked);\n\t\t\t\t\t\tthis.checkChildrenLazySelections(child, isChecked);\n\t\t\t\t\t}\n\t\t\t\t}, this);\n\t\t\t}\n\n\t\t\tif (this.autoSelectParents && isChecked) {\n\t\t\t\tvar parent = checkTreeNode;\n\t\t\t\twhile (((parent = UserInterface.getBinding(parent.bindingElement.parentNode)) && parent instanceof CheckTreeNodeBinding)) {\n\t\t\t\t\tif (parent.isSelectable && !parent.isReadOnly) {\n\t\t\t\t\t\tparent.setChecked(isChecked, true);\n\t\t\t\t\t\tparent.selectionElement.setAttribute(\"selected\", isChecked);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.hasClassName(DataBinding.CLASSNAME_INVALID)) {\n\t\t\t\tthis.detachClassName(DataBinding.CLASSNAME_INVALID);\n\t\t\t}\n\n\t\t\tthis.updateCounter();\n\n\t\t\taction.consume();\n\t\t\tbreak;\n\n\t\tcase TreeNodeBinding.ACTION_OPEN:\n\t\t\tvar treenode = action.target;\n\t\t\tif (!treenode.hasBeenOpened) {\n\t\t\t\tthis._populateFromSelections(treenode, treenode.selectionElement);\n\t\t\t\ttreenode.attachRecursive();\n\t\t\t}\n\t\t\taction.consume();\n\t\t\tbreak;\n\t}\n}\n\n\n\nHierarchicalSelectorBinding.prototype.updateCounter = function () {\n\n\tif (this.hasCounter) {\n\t\tvar count = 0;\n\t\tvar selections = DOMUtil.getElementsByTagName(this.bindingElement, \"selection\");\n\t\tnew List(selections).each(function (selection) {\n\t\t\tvar isSelectable = selection.getAttribute(\"selectable\") === \"true\";\n\t\t\tvar isSelected = selection.getAttribute(\"selected\") === \"true\";\n\t\t\tvar isReadonly = selection.getAttribute(\"readonly\") === \"true\";\n\t\t\tif (isSelectable && !isReadonly && isSelected) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}, this);\n\t\tthis.setCounter(count);\n\t\tconsole.log(count);\n\t}\n}\n\n\nHierarchicalSelectorBinding.prototype.setCounter = function (value) {\n\n\tif (this.hasCounter) {\n\t\tif (this.shadowTree.countLabelBinding == null) {\n\t\t\tthis.shadowTree.countLabelBinding = LabelBinding.newInstance(\n\t\t\t\tthis.bindingDocument\n\t\t\t);\n\t\t\tthis.add(this.shadowTree.countLabelBinding);\n\t\t}\n\t\tvar label = StringBundle.getString(\"ui\", \"Selector.Count\");\n\t\tif (!label) return;\n\t\tthis.shadowTree.countLabelBinding.setLabel(label.replace(\"{0}\", value));\n\t}\n}\n\nHierarchicalSelectorBinding.prototype.checkChildrenLazySelections = function (treenode, isChecked) {\n\n\tif (treenode.isContainer && !treenode.hasBeenOpened) {\n\t\tvar selections = DOMUtil.getElementsByTagName(treenode.selectionElement, \"selection\");\n\t\tnew List(selections).each(function (selection) {\n\t\t\tvar isSelectable = selection.getAttribute(\"selectable\") === \"true\";\n\t\t\tvar isReadonly = selection.getAttribute(\"readonly\") === \"true\";\n\t\t\tif (isSelectable && !isReadonly) {\n\t\t\t\tselection.setAttribute(\"selected\", isChecked);\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @implements {IUpdateHandler}\n * @overwrites {Binding#handleElement}\n * @param {Element} element\n */\nHierarchicalSelectorBinding.prototype.handleElement = function (element) {\n\n\treturn true; // do handle element update\n}\n\n/**\n * @implements {IUpdateHandler}\n * @overwrites {Binding#updateElement}\n * @param {Element} element\n */\nHierarchicalSelectorBinding.prototype.updateElement = function (element) {\n\n\treturn true; // stop crawling descendants\n}\n\n\n// IMPLEMENT IDATA ...........................................................\n\n/**\n * Validate.\n * @implements {IData}\n * @return {boolean}\n */\nHierarchicalSelectorBinding.prototype.validate = function () {\n\tvar isValid = true;\n\tif (this.isRequired) {\n\t\tisValid = false;\n\t\tthis.getDescendantBindingsByType(CheckTreeNodeBinding).each(function (treenode) {\n\t\t\tif (treenode.isSelectable && !treenode.isReadOnly && treenode.isChecked()) {\n\t\t\t\tisValid = true;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\n\t\tif (isValid === false) {\n\t\t\tthis.attachClassName(DataBinding.CLASSNAME_INVALID);\n\t\t}\n\n\t}\n\treturn isValid;\n}\n\n/**\n * Manifest. This will write form elements into page DOM\n * so that the server recieves something on form submit.\n * @implements {IData}\n */\nHierarchicalSelectorBinding.prototype.manifest = function () {\n\n\t/*\n\t * We need to submit an \"array\" sort of thing.\n\t * First clear possible existing form elements.\n\t */\n\tvar inputs = new List(DOMUtil.getElementsByTagName(this.bindingElement, \"input\"));\n\tif (inputs.hasEntries()) {\n\t\tinputs.each(function (input) {\n\t\t\tinput.parentNode.removeChild(input);\n\t\t});\n\t}\n\n\t/*\n\t * Build inputs for selected selections.\n\t */\n\tvar selections = DOMUtil.getElementsByTagName(this.bindingElement, \"selection\");\n\tnew List(selections).each(function (selection) {\n\t\tvar isSelectable = selection.getAttribute(\"selectable\") === \"true\";\n\t\tvar isSelected = selection.getAttribute(\"selected\") === \"true\";\n\t\tvar value = selection.getAttribute(\"value\");\n\t\tif (isSelectable && isSelected) {\n\t\t\tvar input = DOMUtil.createElementNS(Constants.NS_XHTML, \"input\", this.bindingDocument);\n\t\t\tinput.name = this._name;\n\t\t\tinput.value = value;\n\t\t\tthis.bindingElement.appendChild(input);\n\t\t}\n\t}, this);\n}\n\n/**\n * Get value. This is intended for serversice processing.\n * @implements {IData}\n * @return {string}\n */\nHierarchicalSelectorBinding.prototype.getValue = function () {\n\n\treturn null;\n}\n\n/**\n * Set value.\n * @implements {IData}\n * @param {string} value\n */\nHierarchicalSelectorBinding.prototype.setValue = function (value) {\n\n}\n\n/**\n * Get result. This is intended for clientside processing.\n * @implements {IData}\n * @return {array\n */\nHierarchicalSelectorBinding.prototype.getResult = function () {\n\n\treturn new Array();\n}\n\n/**\n * Set result.\n * @implements {IData}\n * @param {array} array\n */\nHierarchicalSelectorBinding.prototype.setResult = function (array) {\n\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/selectors/MultiSelectorBinding.js",
    "content": "MultiSelectorBinding.prototype = new DataBinding;\r\nMultiSelectorBinding.prototype.constructor = MultiSelectorBinding;\r\nMultiSelectorBinding.superclass = DataBinding.prototype;\r\n\r\nMultiSelectorBinding.DISPLAY_SELECTED = \"selected\";\r\nMultiSelectorBinding.DISPLAY_UNSELECTED = \"unselected\";\r\nMultiSelectorBinding.ACTION_COMMAND = \"multiselector command\";\r\nMultiSelectorBinding.ACTION_SELECTIONCHANGED = \"multiselector selection changed\";\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction MultiSelectorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MultiSelectorBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEditable = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isSelectable = false;\r\n\t\r\n\t/**\r\n\t * @type {DataDialogBinding}\r\n\t */\r\n\tthis._dataDialogBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {List<SelectorBindingSelection>}\r\n\t */\r\n\tthis.selections = null;\r\n\t\r\n\t/**\r\n\t * Mapping selected entries (highlighted entries, that is).\r\n\t * type {Map<string><HTMLDivElement>}\r\n\t */\r\n\tthis._selectionMap = null;\r\n\t\r\n\t/**\r\n\t * What to display - selected or unselected \r\n\t * selections? Defaults to selected.\r\n\t * @type {string}\r\n\t */\r\n\tthis._display = MultiSelectorBinding.DISPLAY_SELECTED;\r\n\t\r\n\t/**\r\n\t * @type {HTMLDivElement}\r\n\t */\r\n\tthis._lastSelectedElement = null;\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ DocumentCrawler.ID, FocusCrawler.ID ]);\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMultiSelectorBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[MultiSelectorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingAttach}\r\n */\r\nMultiSelectorBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tMultiSelectorBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.selections = this._getSelectionsList ();\r\n\tthis.addActionListener ( DataDialogBinding.ACTION_COMMAND );\r\n\tthis.addActionListener ( MultiSelectorDataDialogBinding.ACTION_RESULT );\r\n\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n\tthis._buildDOMContent ();\r\n\tthis._parseDOMProperties ();\r\n\tthis.populateFromList ( this.selections );\r\n\t\r\n\t/*\r\n\t * Setup doubleclick.\r\n\t */\r\n\tvar dataDialog = this._dataDialogBinding;\r\n\tif ( dataDialog != null ) {\r\n\t\tDOMEvents.addEventListener ( this.shadowTree.box, DOMEvents.DOUBLECLICK, {\r\n\t\t\thandleEvent : function () {\r\n\t\t\t\tdataDialog.fireCommand ();\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nMultiSelectorBinding.prototype._buildDOMContent = function () {\r\n\t\r\n\t// build box for result display\r\n\tthis.shadowTree.box = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:box\", this.bindingDocument );\r\n\tthis.bindingElement.appendChild ( this.shadowTree.box );\r\n}\r\n\r\n/**\r\n * Parse DOM properties, instantiating editation and selectation.\r\n */\r\nMultiSelectorBinding.prototype._parseDOMProperties = function () {\r\n\t\r\n\tvar editable = this.getProperty ( \"editable\" );\r\n\tvar selectable = this.getProperty ( \"selectable\" );\r\n\tvar display = this.getProperty ( \"display\" );\r\n\t\r\n\tif ( editable != false ) {\r\n\t\tthis._buildEditorButton ();\r\n\t} else {\r\n\t\tthis.isEditable = false;\r\n\t}\r\n\tif ( selectable ) {\r\n\t\tthis.isSelectable = true;\r\n\t\tthis._selectionMap = new Map ();\r\n\t}\r\n\tif ( display ) {\r\n\t\tthis._display = display;\r\n\t}\r\n}\r\n\r\n/**\r\n * Build button to launch editor. The button is actually a {@link MultiSelectorDataDialogBinding}.\r\n */ \r\nMultiSelectorBinding.prototype._buildEditorButton = function () {\r\n\t\r\n\tif ( this.isEditable ) {\r\n\t\r\n\t\tvar datadialog = MultiSelectorDataDialogBinding.newInstance ( this.bindingDocument );\r\n\t\tdatadialog.selections = this.selections;\r\n\t\tthis.add ( datadialog );\r\n\t\tdatadialog.attach ();\r\n\t\t\r\n\t\tthis._dataDialogBinding = datadialog;\r\n\t\tthis.shadowTree.datadialog = datadialog;\r\n\t}\r\n}\r\n\r\n/**\r\n * Populate multiselector. Clearing existing selections.\r\n * @param {List<SelectorBindingSelection>} list\r\n */\r\nMultiSelectorBinding.prototype.populateFromList = function ( list ) {\r\n\t\r\n\tlist.reset ();\r\n\tvar isDisplay = false;\r\n\t\r\n\tthis.shadowTree.box.innerHTML = \"\";\r\n\t\r\n\twhile ( list.hasNext ()) {\r\n\t\tvar selection = list.getNext ();\r\n\t\tswitch ( this._display ) {\r\n\t\t\tcase MultiSelectorBinding.DISPLAY_SELECTED :\r\n\t\t\t\tisDisplay = selection.isSelected;\r\n\t\t\t\tbreak;\r\n\t\t\tcase MultiSelectorBinding.DISPLAY_UNSELECTED :\r\n\t\t\t\tisDisplay = selection.isSelected != true;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif ( isDisplay ) {\r\n\t\t\tthis.shadowTree.box.appendChild (\r\n\t\t\t\tthis._getElementForSelection ( selection )\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis.selections = list;\r\n\tif ( this._dataDialogBinding ) {\r\n\t\tthis._dataDialogBinding.selections = this.selections;\r\n\t}\r\n}\r\n\r\n/**\r\n * Append selections to existing selections. Note that \r\n * automatic selection has been hardcoded into this.\r\n * @param {List<SelectorBindingSelection>} list\r\n * @param {boolean} isAssimilate If set to true, selection.isSelected is forced to adapt.\r\n */\r\nMultiSelectorBinding.prototype.cumulateFromList = function ( list, isAssimilate ) {\r\n\r\n\tvar box = this.shadowTree.box;\r\n\tvar isDisplay = false;\r\n\t\r\n\tif ( list.hasEntries ()) {\r\n\t\r\n\t\tlist.reverse ().reset ();\r\n\t\twhile ( list.hasNext ()) { \r\n\t\t\tvar selection = list.getNext ();\t\r\n\t\t\tif ( isAssimilate ) {\r\n\t\t\t\tselection.isSelected = this._display == MultiSelectorBinding.DISPLAY_SELECTED;\r\n\t\t\t\tisDisplay = true;\r\n\t\t\t} else {\r\n\t\t\t\tswitch ( this._display ) {\r\n\t\t\t\t\tcase MultiSelectorBinding.DISPLAY_SELECTED :\r\n\t\t\t\t\t\tisDisplay = selection.isSelected;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase MultiSelectorBinding.DISPLAY_UNSELECTED :\r\n\t\t\t\t\t\tisDisplay = selection.isSelected != true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( isDisplay ) {\r\n\t\t\t\tvar element = this._getElementForSelection ( selection );\r\n\t\t \t\tbox.insertBefore ( element, box.firstChild );\r\n\t\t \t\tCSSUtil.attachClassName ( element, \"selected\" );\r\n\t\t\t\tthis._selectionMap.set ( selection.value, element );\r\n\t\t \t}\r\n\t\t}\r\n\t\t\r\n\t\t// Because we autoselect, we can fire this.\r\n\t\tthis.dispatchAction ( MultiSelectorBinding.ACTION_SELECTIONCHANGED );\r\n\t}\r\n}\r\n\r\n/**\r\n * Build a DIV element. This is very popular.\r\n * @param {SelectorBindingSelection} selection\r\n * @return {HTMLDivElement}\r\n */\r\nMultiSelectorBinding.prototype._getElementForSelection = function ( selection ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_XHTML, \"div\", this.bindingDocument );\r\n\telement.appendChild ( this.bindingDocument.createTextNode ( selection.label ));\r\n\telement.setAttribute ( \"label\", selection.label );\r\n\telement.setAttribute ( \"value\", selection.value );\r\n\treturn element;\r\n}\r\n\r\n/**\r\n * Has selection (highlighted entry)?\r\n * @return {boolean}\r\n */\r\nMultiSelectorBinding.prototype.hasHighlight = function () {\r\n\t\r\n\treturn this._selectionMap && this._selectionMap.hasEntries ();\r\n}\r\n\r\n/**\r\n * Focus on mousedown.\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {Action} action\r\n */\r\nMultiSelectorBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tMultiSelectorBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\tif ( !this.isFocused ) {\r\n\t\t\t\tthis.focus ();\r\n\t\t\t}\r\n\t\t\tif ( this.isSelectable ) {\r\n\t\t\t\tvar element = DOMEvents.getTarget ( e );\r\n\t\t\t\tvar nodename = DOMUtil.getLocalName ( element );\r\n\t\t\t\tif ( nodename == \"div\" ) {\r\n\t\t\t\t\tthis._handleMouseDown ( element );\r\n\t\t\t\t\tthis.dispatchAction ( MultiSelectorBinding.ACTION_SELECTIONCHANGED );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Mousedown. Handling multiselect on shiftdown.\r\n * @param {HTMLDivElement} element\r\n */\r\nMultiSelectorBinding.prototype._handleMouseDown = function ( element ) {\r\n\r\n\tif ( Keyboard.isShiftPressed && this._lastSelectedElement ) {\r\n\t\t\r\n\t\tvar elements = this._getElements ();\r\n\t\tvar value1 = element.getAttribute ( \"value\" );\r\n\t\tvar value2 = this._lastSelectedElement.getAttribute ( \"value\" );\r\n\t\t\r\n\t\tvar isSelect = false;\r\n\t\twhile ( elements.hasNext ()) {\r\n\t\t\tvar el = elements.getNext ();\r\n\t\t\tswitch ( el.getAttribute ( \"value\" )) {\r\n\t\t\t\tcase value1 :\r\n\t\t\t\tcase value2 :\r\n\t\t\t\t\tisSelect = !isSelect;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n \t\t\tif ( isSelect ) {\r\n \t\t\t\tthis._hilite ( el );\r\n \t\t\t} else {\r\n \t\t\t\tthis._unhilite ( el );\r\n \t\t\t}\r\n \t\t\tthis._hilite ( this._lastSelectedElement );\r\n \t\t\tthis._hilite ( element );\r\n\t\t}\r\n\t} else {\r\n\t\tif ( Keyboard.isControlPressed && this._isHilited ( element )) {\r\n\t\t\tthis._unhilite ( element );\r\n\t\t} else {\r\n\t\t\tthis._hilite ( element );\r\n\t\t}\r\n\t\tif ( !Keyboard.isControlPressed ) {\r\n\t\t\tvar self = this;\r\n\t\t\tthis._getElements ().each ( function ( el ) {\r\n\t\t\t\tif ( el != element ) {\r\n\t\t\t\t\tself._unhilite ( el );\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis._lastSelectedElement = element;\r\n}\r\n\r\n/**\r\n * Highlight element.\r\n * @param {HTMLDivElement} element\r\n */\r\nMultiSelectorBinding.prototype._hilite = function ( element ) {\r\n\t\r\n\tvar value = element.getAttribute ( \"value\" );\r\n\tif ( !this._selectionMap.has ( value )) {\r\n\t\tCSSUtil.attachClassName ( element, \"selected\" );\r\n\t\tthis._selectionMap.set ( value, element );\r\n\t}\r\n}\r\n\r\n/**\r\n * Don't highlight element.\r\n * @param {HTMLDivElement} element\r\n */\r\nMultiSelectorBinding.prototype._unhilite = function ( element ) {\r\n\r\n\tvar value = element.getAttribute ( \"value\" );\r\n\tif ( this._selectionMap.has ( value )) {\r\n\t\tCSSUtil.detachClassName ( element, \"selected\" );\r\n\t\tthis._selectionMap.del ( value );\r\n\t}\r\n}\r\n\r\n/**\r\n * Is element highlighted?\r\n * @param {HTMLDivElement} element\r\n */\r\nMultiSelectorBinding.prototype._isHilited = function ( element ) {\r\n\r\n\treturn CSSUtil.hasClassName ( element, \"selected\" );\r\n}\r\n\r\n/**\r\n * Focus when button is handled; and hide the internal DataDialogBinding.\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nMultiSelectorBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tMultiSelectorBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Invoked when dialog is opened.\r\n\t\t */\r\n\t\tcase DataDialogBinding.ACTION_COMMAND :\r\n\t\t\tif ( binding == this._dataDialogBinding ) {\r\n\t\t\t\tif ( !this.isFocused ) {\r\n\t\t\t\t\tthis.focus ();\r\n\t\t\t\t}\r\n\t\t\t\tthis.dispatchAction ( MultiSelectorBinding.ACTION_COMMAND );\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\t/*\r\n\t\t * Invoked when dialog is closed.\r\n\t\t */\r\n\t\tcase MultiSelectorDataDialogBinding.ACTION_RESULT :\r\n\t\t\tthis.populateFromList ( binding.result );\r\n\t\t\tthis.dirty ();\r\n\t\t\tbinding.result = null;\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * \r\n * @return {List<SelectorBindingSelection}\r\n */\r\nMultiSelectorBinding.prototype.extractSelected = function () {\r\n\t\r\n\tvar result = null;\r\n\tif ( this.isSelectable ) {\r\n\t\tresult = new List ();\r\n\t\tif ( this._selectionMap && this._selectionMap.hasEntries ()) {\r\n\t\t\r\n\t\t\t/*\r\n\t\t\tTHIS WOULD EXTRACT IN RANDOM ORDER!\r\n\t\t\tthis._selectionMap.each ( function ( key, element ) {\r\n\t\t\t\telement.parentNode.removeChild ( element );\r\n\t\t\t\tresult.add ( new SelectorBindingSelection (\r\n\t\t\t\t\telement.getAttribute ( \"label\" ),\r\n\t\t\t\t\telement.getAttribute ( \"value\" ),\r\n\t\t\t\t\ttrue // hmmm....\r\n\t\t\t\t));\r\n\t\t\t});\r\n\t\t\t*/\r\n\t\t\t\r\n\t\t\tvar self = this;\r\n\t\t\tthis._getElements ().each ( function ( element ) {\r\n\t\t\t\tif ( self._isHilited ( element )) {\r\n\t\t\t\t\telement.parentNode.removeChild ( element );\r\n\t\t\t\t\tresult.add ( new SelectorBindingSelection (\r\n\t\t\t\t\t\telement.getAttribute ( \"label\" ),\r\n\t\t\t\t\t\telement.getAttribute ( \"value\" ),\r\n\t\t\t\t\t\ttrue // hmmm....\r\n\t\t\t\t\t));\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tthis._selectionMap = new Map ();\r\n\t\t\tthis.dispatchAction ( MultiSelectorBinding.ACTION_SELECTIONCHANGED );\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n} \r\n \r\n/**\r\n * Reposition selected elements. Move either up or down.\r\n * @param {boolean} isUp\r\n */\r\nMultiSelectorBinding.prototype.reposition = function ( isUp ) {\r\n\t\r\n\t/*\r\n\t * Cannot use selectionMap because we need \r\n\t * to process sequentially in DOM node order.\r\n\t */\r\n\tvar elements = this._getElements ();\r\n\tif ( !isUp ) {\r\n\t\telements.reverse ();\r\n\t}\r\n\t\r\n\tvar isContinue = true;\r\n\twhile ( isContinue && elements.hasNext ()) {\r\n\t\tvar element = elements.getNext ();\r\n\t\tif ( this._isHilited ( element )) {\r\n\t\t\tswitch ( isUp ) {\r\n\t\t\t\tcase true :\r\n\t\t\t\t\tif ( element.previousSibling ) {\r\n\t\t\t\t\t\telement.parentNode.insertBefore ( element, element.previousSibling );\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tisContinue = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase false :\r\n\t\t\t\t\tif ( element.nextSibling ) {\r\n\t\t\t\t\t\telement.parentNode.insertBefore ( element, element.nextSibling.nextSibling );\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tisContinue = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Parse DIV elements into a list of SelectorBindingSelection instances. \r\n * Eeach SelectorBindingSelection is annotated with DIV highlighted status.\r\n * @see {MultiSelectorDialogPageBinding#_updateUpDownBroadcasters} \r\n */\r\nMultiSelectorBinding.prototype.toSelectionList = function () {\r\n\t\r\n\tvar result = new List ();\r\n\tvar isSelected = this._display == MultiSelectorBinding.DISPLAY_SELECTED;\r\n\tvar self = this;\r\n\t\r\n\tthis._getElements ().each ( function ( element ) {\r\n\t\tvar selection = new SelectorBindingSelection (\r\n\t\t\telement.getAttribute ( \"label\" ),\r\n\t\t\telement.getAttribute ( \"value\" ),\r\n\t\t\tisSelected\r\n\t\t);\r\n\t\tselection.isHighlighted = self._isHilited ( element );\r\n\t\tresult.add ( selection );\r\n\t});\r\n\t\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get those DIV elements.\r\n * @return {List<HTMLDivElement>}\r\n */\r\nMultiSelectorBinding.prototype._getElements = function () {\r\n\r\n    if (!this.shadowTree.box) {\r\n        return new List(); // IE work around - on close this gets called, this.shadowTree.box is null. No side effect here.\r\n    }\r\n    return new List(\r\n\t\tDOMUtil.getElementsByTagName(\r\n\t\t\tthis.shadowTree.box, \"div\"\r\n\t\t)\r\n\t);\r\n}\r\n\r\n/**\r\n * Parse ui:selection elements into instances of SelectorBindingSelection. \r\n * This is used to populate the selector on startup.\r\n * @return {List<SelectorBindingSelection}\r\n */\r\nMultiSelectorBinding.prototype._getSelectionsList = SelectorBinding.prototype._getSelectionsList;\r\n\r\n\r\n// IMPLEMENT IDATA ...........................................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nMultiSelectorBinding.prototype.validate = function () {\r\n\t\r\n\treturn true;\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nMultiSelectorBinding.prototype.manifest = function () {\r\n\t\r\n\t/*\r\n\t * We need to submit an \"array\" sort of thing. \r\n\t * First clear possible existing form elements.\r\n\t */\r\n\tvar inputs = new List ( DOMUtil.getElementsByTagName ( this.bindingElement, \"input\" ));\r\n\tif ( inputs.hasEntries ()) {\r\n\t\tinputs.each ( function ( input ) {\r\n\t\t\tinput.parentNode.removeChild ( input );\r\n\t\t});\r\n\t}\r\n\t\r\n\t/*\r\n\t * Build inputs for selected selections.\r\n\t */\r\n\tthis.selections.reset ();\r\n\twhile ( this.selections.hasNext ()) {\r\n\t\tvar selection = this.selections.getNext ();\r\n\t\tif ( selection.isSelected ) {\r\n\t\t\tvar input = DOMUtil.createElementNS ( Constants.NS_XHTML, \"input\", this.bindingDocument );\r\n\t\t\tinput.name = this._name;\r\n\t\t\tinput.value = selection.value;\r\n\t\t\tthis.bindingElement.appendChild ( input );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nMultiSelectorBinding.prototype.getValue = function () {\r\n\t\r\n\treturn \"HEJ!\";\r\n}\r\n\r\n/**\r\n * Set value.\r\n * @implements {IData}\r\n * @param {string} value\r\n */\r\nMultiSelectorBinding.prototype.setValue = function ( value ) {\r\n\t\r\n\talert ( value );\r\n}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {array\r\n */\r\nMultiSelectorBinding.prototype.getResult = function () {\r\n\t\r\n\talert ( \"TODO: MultiSelectorBinding#getResult\" );\r\n\treturn new Array ();\r\n}\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {array} array\r\n */\r\nMultiSelectorBinding.prototype.setResult = function ( array ) {\r\n\r\n\talert ( \"TODO: MultiSelectorBinding#setResult\" );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/selectors/SelectorBinding.js",
    "content": "SelectorBinding.prototype = new DataBinding;\r\nSelectorBinding.prototype.constructor = SelectorBinding;\r\nSelectorBinding.superclass = DataBinding.prototype;\r\n\r\nSelectorBinding.ACTION_SELECTIONCHANGED = \"selectorselectionchanged\";\r\nSelectorBinding.ACTION_COMMAND = \"selectorcommand\";\r\nSelectorBinding.CLASSNAME_POPUP = \"selectorpopup\";\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction SelectorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SelectorBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = null;\r\n\r\n\t/**\r\n\t * @type {ToolBarButtonBinding}\r\n\t */\r\n\tthis._buttonBinding = null;\r\n\r\n\t/**\r\n\t * @type {PopupBinding}\r\n\t */\r\n\tthis._popupBinding = null;\r\n\r\n\t/**\r\n\t * @type {bool}\r\n\t */\r\n\tthis._isLocal = false;\r\n\r\n\t/**\r\n\t * @type {MenuBodyBinding}\r\n\t */\r\n\tthis._menuBodyBinding = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._selectionValue = null;\r\n\r\n\r\n\t/**\r\n\t* @type {string}\r\n\t*/\r\n\tthis._selectionLabel = null;\r\n\r\n\t/**\r\n\t* @type {string}\r\n\t*/\r\n\tthis._searchString = \"\";\r\n\r\n\t/**\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis.isSearchSelectionEnabled = true;\r\n\r\n\r\n\t/**\r\n\t * @type {List<SelectorBindingSelection>}\r\n\t */\r\n\tthis.selections = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisabled = false;\r\n\r\n\t/**\r\n\t * This will be used as default label.\r\n\t * @type {string}\r\n\t */\r\n\tthis.label = null;\r\n\r\n\t/**\r\n\t * This will be used as default value.\r\n\t * @type {string}\r\n\t */\r\n\tthis.value = null;\r\n\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.width = null;\r\n\r\n\t/**\r\n\t * @type {SelectorBindingSelection}\r\n\t */\r\n\tthis.defaultSelection = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageHover = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageActive = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageDisabled = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\r\n\t/**\r\n\t * Flipped when menitems need to be reindexed.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isUpToDate = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasKeyboard = false;\r\n\r\n\t/*\r\n\t * Overwritable button implementation.\r\n\t * @see {EditorSelectorBinding}\r\n\t * @type {class}\r\n\t */\r\n\tthis.BUTTON_IMPLEMENTATION = ClickButtonBinding;\r\n\r\n\t/*\r\n\t * Overwritable menuitem implementation.\r\n\t * @see {EditorSelectorBinding}\r\n\t * @type {class}\r\n\t */\r\n\tthis.MENUITEM_IMPLEMENTATION = MenuItemBinding;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isImageLayout = true;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRequired = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isValid = true;\r\n\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ DocumentCrawler.ID, FocusCrawler.ID ]);\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SelectorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingAttach}\r\n */\r\nSelectorBinding.prototype.onBindingAttach = function () {\r\n\r\n\tSelectorBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tthis.selections = new List();\r\n\r\n\tthis.parseDOMProperties();\r\n\tthis.buildDOMContent();\r\n\tthis.addEventListener(DOMEvents.FOCUS);\r\n\tthis.addEventListener(DOMEvents.KEYPRESS);\r\n\tthis.addEventListener(DOMEvents.KEYDOWN);\r\n\tthis.addActionListener(ButtonBinding.ACTION_COMMAND);\r\n\r\n\tvar isDisabled = this.getProperty(\"isdisabled\");\r\n\tif (this.isDisabled || isDisabled) {\r\n\t\tthis.disable();\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingDispose}\r\n */\r\nSelectorBinding.prototype.onBindingDispose = function () {\r\n\r\n\tSelectorBinding.superclass.onBindingDispose.call ( this );\r\n\r\n\tif ( this._popupBinding && Binding.exists ( this._popupBinding )) {\r\n\t\tthis._popupBinding.dispose ();\r\n\t}\r\n\tif ( this._hasKeyboard == true ) {\r\n\t\tthis._releaseKeyboard ();\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nSelectorBinding.prototype.parseDOMProperties = function () {\r\n\r\n\tvar type\t\t\t= this.getProperty ( \"type\" );\r\n\tvar label \t\t\t= this.getProperty ( \"label\" );\r\n\tvar value \t\t\t= this.getProperty ( \"value\" );\r\n\tvar width \t\t\t= this.getProperty ( \"width\" );\r\n\tvar onchange\t\t= this.getProperty ( \"onchange\" );\r\n\tvar isRequired\t\t= this.getProperty ( \"required\" ) == true;\r\n\tvar isLocal = this.getProperty(\"local\");\r\n\r\n\tif ( !this.type && type ) {\r\n\t\tthis.type = type;\r\n\t}\r\n\tif ( !this.label && label != null ) {\r\n\t\tthis.label = label;\r\n\t}\r\n\tif ( !this.value && value != null ) {\r\n\t\tthis.value = value;\r\n\t}\r\n\tif ( !this.width && width ) {\r\n\t\tthis.width = width;\r\n\t}\r\n\tif ( isRequired ) {\r\n\t\tthis.isRequired = true;\r\n\t}\r\n\tif ( isLocal ) {\r\n\t\tthis._isLocal = true;\r\n\t}\r\n\tif ( onchange ) {\r\n\t\tthis.onValueChange = function () {\r\n\t\t\tBinding.evaluate ( onchange, this );\r\n\t\t};\r\n\t}\r\n\tthis._computeImageProfile ();\r\n}\r\n\r\n/*\r\n * Compute image profile.\r\n * TODO: Please formalize and explain how selector imageprofile relates to selection imageprofile!\r\n */\r\nSelectorBinding.prototype._computeImageProfile = function () {\r\n\r\n\tBinding.imageProfile ( this );\r\n}\r\n\r\n/**\r\n * Build button and popup. Finally populate by selection elements.\r\n */\r\nSelectorBinding.prototype.buildDOMContent = function () {\r\n\r\n\tthis.buildButton ();\r\n\tthis.buildPopup ();\r\n\tthis.buildSelections ();\r\n\r\n\tthis.bindingElement.tabIndex = 0;\r\n\tif ( Client.isExplorer === true ) {\r\n\t\tthis.bindingElement.hideFocus = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Build form field for serverside processing.\r\n */\r\nSelectorBinding.prototype.buildFormField = function () {\r\n\r\n\tvar input = DOMUtil.createElementNS ( Constants.NS_XHTML, \"input\", this.bindingDocument );\r\n\tinput.name = this.getName ();\r\n\tinput.value\t= this.getValue ();\r\n\tinput.type = \"hidden\";\r\n\r\n\tif ( this.hasCallBackID ()) {\r\n\t\tinput.id = this.getCallBackID ();\r\n\t}\r\n\r\n\tthis.shadowTree.input = input;\r\n\tthis.bindingElement.appendChild ( input );\r\n}\r\n\r\n/**\r\n * Build button.\r\n */\r\nSelectorBinding.prototype.buildButton = function () {\r\n\r\n\t/*\r\n\t * Subclasses can use a different button around here.\r\n\t */\r\n\tvar buttonImplementation = this.BUTTON_IMPLEMENTATION;\r\n\r\n\tvar button = this.add (\r\n\t\tbuttonImplementation.newInstance ( this.bindingDocument )\r\n\t);\r\n\tif ( this.imageProfile != null ) {\r\n\t\tbutton.imageProfile = this.imageProfile;\r\n\t}\r\n\tif ( this.width != null ) {\r\n\t\tbutton.setWidth ( this.width );\r\n\t}\r\n\tthis._buttonBinding = button;\r\n\tthis.shadowTree.button = button; /* don't serialize */\r\n\tbutton.attach ();\r\n}\r\n\r\n/**\r\n * Build selections.\r\n */\r\nSelectorBinding.prototype.buildPopup = function () {\r\n\r\n\t/*\r\n\t * Build the popup.\r\n\t */\r\n\tvar popupSetBinding;\r\n\tif (this._isLocal) {\r\n\t\tif (!this.bindingWindow.bindingMap.selectorpopupset) {\r\n\r\n\t\t\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:popupset\", this.bindingDocument);\r\n\t\t\telement.id = \"selectorpopupset\";\r\n\t\t\tpopupSetBinding = UserInterface.registerBinding(element, PopupSetBinding);\r\n\r\n\t\t\tthis.bindingDocument.body.appendChild(popupSetBinding.bindingElement);\r\n\t\t} else {\r\n\t\t\tpopupSetBinding = this.bindingWindow.bindingMap.selectorpopupset;\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tpopupSetBinding = top.app.bindingMap.selectorpopupset\r\n\t};\r\n\tvar doc = popupSetBinding.bindingDocument;\r\n\tvar popupBinding = popupSetBinding.add (\r\n\t\tPopupBinding.newInstance ( doc )\r\n\t);\r\n\tvar popupclassname = this.getProperty(\"popupclass\");\r\n\tif (popupclassname) {\r\n\t\tpopupBinding.setProperty(\"class\", popupclassname);\r\n\t}\r\n\tvar bodyBinding = popupBinding.add (\r\n\t\tMenuBodyBinding.newInstance ( doc )\r\n\t);\r\n\tthis._popupBinding = popupBinding;\r\n\tthis._menuBodyBinding = bodyBinding;\r\n\tthis._popupBinding.attachClassName ( SelectorBinding.CLASSNAME_POPUP );\r\n\tthis._popupBinding.attachRecursive(); // TODO: not yet?\r\n\r\n\tif (this.getProperty(\"textonly\") === true) {\r\n\t\tthis._popupBinding.showTextOnly();\r\n\t}\r\n\r\n\t/*\r\n\t * Unhardcode this when we decide to support submenus in popup.\r\n\t */\r\n\tthis._popupBinding.type = PopupBinding.TYPE_FIXED;\r\n\r\n\t/*\r\n\t * Assigninging popup to button.\r\n\t */\r\n\tpopupBinding.attachClassName ( \"selectorpopup\" );\r\n\tpopupBinding.addActionListener ( PopupBinding.ACTION_SHOW, this );\r\n\tpopupBinding.addActionListener ( MenuItemBinding.ACTION_COMMAND, this );\r\n\tpopupBinding.addActionListener ( PopupBinding.ACTION_HIDE, this );\r\n\tthis._buttonBinding.setPopup(popupBinding);\r\n\r\n\tthis._popupBinding.isManaged = true;\r\n}\r\n\r\n/**\r\n * Build selections.\r\n */\r\nSelectorBinding.prototype.buildSelections = function () {\r\n\r\n\t/*\r\n\t * Compute default selection.\r\n\t */\r\n\tif ( this.defaultSelection == null && ( this.label || this.value )) {\r\n\t\tthis.defaultSelection = new SelectorBindingSelection (\r\n\t\t\tthis.label,\r\n\t\t\tthis.value,\r\n\t\t\ttrue,\r\n\t\t\tnull // this.imageprofile!\r\n\t\t);\r\n\t}\r\n\r\n\t/*\r\n\t * Retrieve selections from markup.\r\n\t */\r\n\tvar list = this._getSelectionsList ();\r\n\r\n\t/*\r\n\t * Even if list is empty, this will\r\n\t * still build the default selection.\r\n\t */\r\n\tthis.populateFromList ( list );\r\n}\r\n\r\n/**\r\n * Parse ui:selection elements into instances of SelectorBindingSelection.\r\n * This will be used to populate the selector.\r\n * @return {List<SelectorBindingSelection>}\r\n */\r\nSelectorBinding.prototype._getSelectionsList = function () {\r\n\r\n\tvar list = new List ();\r\n\tvar selections = DOMUtil.getElementsByTagName ( this.bindingElement, \"selection\" );\r\n\tnew List ( selections ).each ( function ( selection ) {\r\n\r\n\t\tvar label \t\t\t= selection.getAttribute ( \"label\" );\r\n\t\tvar value \t\t\t= selection.getAttribute ( \"value\" );\r\n\t\tvar isSelected \t\t= selection.getAttribute ( \"selected\" );\r\n\t\tvar image\t\t\t= selection.getAttribute ( \"image\" );\r\n\t\tvar imageHover\t\t= selection.getAttribute ( \"image-hover\" );\r\n\t\tvar imageActive\t\t= selection.getAttribute ( \"image-active\" );\r\n\t\tvar imageDisabled\t= selection.getAttribute ( \"image-disabled\" );\r\n\r\n\t\tvar imageProfile = null;\r\n\r\n\t\tif ( image || imageHover || imageActive || imageDisabled ) {\r\n\t\t\timageProfile = new ImageProfile ({\r\n\t\t\t\timage : image,\r\n\t\t\t\timageHover : imageHover,\r\n\t\t\t\timageActive : imageActive,\r\n\t\t\t\timageDisabled : imageDisabled\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tlist.add (\r\n\t\t\tnew SelectorBindingSelection (\r\n\t\t\t\tlabel ? label : null,\r\n\t\t\t\tvalue ? value : null,\r\n\t\t\t\tisSelected && isSelected == \"true\",\r\n\t\t\t\timageProfile\r\n\t\t\t)\r\n\t\t);\r\n\t});\r\n\r\n\treturn list;\r\n}\r\n\r\n/**\r\n * @param {List<SelectorBindingSelection>} list\r\n */\r\nSelectorBinding.prototype.populateFromList = function ( list ) {\r\n\r\n\tif ( this.isAttached ) {\r\n\r\n\t\t/*\r\n\t\t * Clear existing content, leaving only the default selection.\r\n\t\t */\r\n\t\tthis.clear ();\r\n\r\n\t\t/*\r\n\t\t * Add new content.\r\n\t\t */\r\n\t\tif ( list.hasEntries ()) {\r\n\t\t\tvar firstItem = null;\r\n\t\t\twhile ( list.hasNext ()) {\r\n\t\t\t\tvar selection = list.getNext ();\r\n\t\t\t\tvar item = this.addSelection(selection);\r\n\t\t\t\tif (selection.isSelected) {\r\n\t\t\t\t\tthis.select(item, true);\r\n\t\t\t\t}\r\n\t\t\t\tif ( !firstItem ) {\r\n\t\t\t\t\tfirstItem = item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( !this._selectedItemBinding ) {\r\n\t\t\t\tthis.select ( firstItem, true );\r\n\t\t\t}\r\n\t\t} else {\r\n\r\n\t\t}\r\n\t} else {\r\n\r\n\t\tthrow \"Could not populate unattached selector\"; // TODO: Cache the list and wait?\r\n\t}\r\n}\r\n\r\n/**\r\n * Add selection, returning the created MenuItemBinding.\r\n * @param {SelectorBindingSelection} selection\r\n * @param {boolean} isPositionFirst\r\n * @return {MenuItemBinding}\r\n */\r\nSelectorBinding.prototype.addSelection = function ( selection, isPositionFirst ) {\r\n\r\n\tvar menuItemImplementation = this.MENUITEM_IMPLEMENTATION;\r\n\r\n\tvar bodyBinding = this._menuBodyBinding;\r\n\tvar bodyDocument = bodyBinding.bindingDocument;\r\n\r\n\tvar itemBinding = menuItemImplementation.newInstance ( bodyDocument );\r\n\titemBinding.imageProfile = selection.imageProfile;\r\n\titemBinding.setLabel ( selection.label );\r\n\tif ( selection.tooltip != null ) {\r\n\t\titemBinding.setToolTip ( selection.tooltip )\r\n\t}\r\n\titemBinding.selectionValue = selection.value;\r\n\r\n\tselection.menuItemBinding = itemBinding;\r\n\tif ( isPositionFirst ) {\r\n\t\tbodyBinding.addFirst ( itemBinding );\r\n\t\tthis.selections.addFirst ( selection );\r\n\t} else {\r\n\t\tbodyBinding.add ( itemBinding );\r\n\t\tthis.selections.add ( selection );\r\n\t}\r\n\r\n\tthis._isUpToDate = false;\r\n\treturn itemBinding;\r\n}\r\n\r\n/**\r\n * Add selection first.\r\n * @param {SelectorBindingSelection} selection\r\n * @return {MenuItemBinding}\r\n */\r\nSelectorBinding.prototype.addSelectionFirst = function ( selection ) {\r\n\r\n\treturn this.addSelection ( selection, true );\r\n}\r\n/**\r\n * Dispose existing content. Leave default selection.\r\n * @param {boolean} isClearAll\r\n */\r\nSelectorBinding.prototype.clear = function ( isClearAll ) {\r\n\r\n\tthis._selectedItemBinding = null;\r\n\r\n\tif ( this._popupBinding ) {\r\n\r\n\t\tthis._popupBinding.clear ();\r\n\t\tthis.selections.clear ();\r\n\r\n\t\t/*\r\n\t\t * If not clear all, add default selection.\r\n\t\t * Checking that multiple calls to clear\r\n\t\t * will not add multiple default selections.\r\n\t\t */\r\n\t\tif ( !isClearAll && this.defaultSelection != null ) {\r\n\t\t\tvar menuItemBinding = this.addSelection (\r\n\t\t\t\tthis.defaultSelection\r\n\t\t\t);\r\n\t\t\tthis.select ( menuItemBinding, true );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Clear all.\r\n */\r\nSelectorBinding.prototype.clearAll = function () {\r\n\r\n\tthis.clear ( true );\r\n}\r\n\r\n/**\r\n * Disable.\r\n */\r\nSelectorBinding.prototype.disable = function () {\r\n\r\n\tthis.setDisabled ( true );\r\n}\r\n\r\n/**\r\n * Enable.\r\n */\r\nSelectorBinding.prototype.enable = function () {\r\n\r\n\tthis.setDisabled ( false );\r\n}\r\n\r\n/**\r\n * Focus.\r\n * @implements {IData}\r\n */\r\nSelectorBinding.prototype.focus = function () {\r\n\r\n\tif ( !this.isFocused ) {\r\n\t\tDataBinding.prototype.focus.call ( this );\r\n\t\tif ( this.isFocused == true ) {\r\n\t\t\tFocusBinding.focusElement ( this.bindingElement );\r\n\t\t\tthis._grabKeyboard ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Blur.\r\n * @implements {IData}\r\n */\r\nSelectorBinding.prototype.blur = function () {\r\n\r\n\tif ( this.isFocused == true ) {\r\n\t\tDataBinding.prototype.blur.call ( this );\r\n\t\tthis._releaseKeyboard ();\r\n\t\tif ( this._popupBinding.isVisible ) {\r\n\t\t\tthis._popupBinding.hide ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Grab keyboard.\r\n */\r\nSelectorBinding.prototype._grabKeyboard = function () {\r\n\r\n\tif ( !this._hasKeyboard ) {\r\n\t\tthis.subscribe ( BroadcastMessages.KEY_ARROW );\r\n\t\tthis._hasKeyboard = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Release keyboard.\r\n */\r\nSelectorBinding.prototype._releaseKeyboard = function () {\r\n\r\n\tif ( this._hasKeyboard == true ) {\r\n\t\tthis.unsubscribe ( BroadcastMessages.KEY_ARROW );\r\n\t\tthis._hasKeyboard = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set disabled status.\r\n * @param {boolean} isDisabled\r\n */\r\nSelectorBinding.prototype.setDisabled = function ( isDisabled ) {\r\n\r\n\tif ( this.isAttached == true ) {\r\n\t\tvar button = this._buttonBinding;\r\n\t\tbutton.setDisabled ( isDisabled );\r\n\t}\r\n\tif ( isDisabled ) {\r\n\t\tthis.setProperty ( \"isdisabled\", true );\r\n\t} else {\r\n\t\tthis.deleteProperty ( \"isdisabled\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Reset.\r\n * @param {boolean} isActionBlocked\r\n */\r\nSelectorBinding.prototype.reset = function ( isActionBlocked ) {\r\n\r\n\tif ( this.defaultSelection != null ) {\r\n\t\tthis.selectByValue (\r\n\t\t\tthis.defaultSelection.value,\r\n\t\t\tisActionBlocked\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nSelectorBinding.prototype.handleAction = function (action) {\r\n\r\n\tSelectorBinding.superclass.handleAction.call(this, action);\r\n\r\n\tswitch (action.type) {\r\n\r\n\t\tcase ButtonBinding.ACTION_COMMAND:\r\n\t\t\tthis._onButtonCommand();\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t\tcase PopupBinding.ACTION_SHOW:\r\n\t\t\tthis._onPopupShowing();\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t\tcase MenuItemBinding.ACTION_COMMAND:\r\n\t\t\tthis._onMenuItemCommand(action.target);\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t\tcase PopupBinding.ACTION_HIDE:\r\n\t\t\t/*\r\n\t\t\t* If TAB key was pressed, closing the popup, we no\r\n\t\t\t* longer have focus and should not grab the keyboard.\r\n\t\t\t*/\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tif (self.isFocused) {\r\n\t\t\t\t\tself._grabKeyboard();\r\n\t\t\t\t}\r\n\t\t\t}, 0);\r\n\t\t\tif(this._clearSearchSelection) this._clearSearchSelection();\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * On button command.\r\n */\r\nSelectorBinding.prototype._onButtonCommand = function () {\r\n\r\n\tthis.focus();\r\n\tthis._attachSelections();\r\n\tthis._restoreSelection ();\r\n\tthis.dispatchAction ( SelectorBinding.ACTION_COMMAND );\r\n}\r\n\r\n/**\r\n * On popup showing.\r\n */\r\nSelectorBinding.prototype._onPopupShowing = function () {\r\n\r\n\tthis._fitMenuToSelector();\r\n\tthis._releaseKeyboard();\r\n}\r\n\r\n/**\r\n * On menuitem command.\r\n * @param {MenuItemBinding} binding\r\n */\r\nSelectorBinding.prototype._onMenuItemCommand = function ( binding ) {\r\n\r\n\tthis.select ( binding );\r\n\tFocusBinding.focusElement ( this.bindingElement );\r\n\tthis._grabKeyboard ();\r\n}\r\n\r\n/**\r\n * Restore selection.\r\n */\r\nSelectorBinding.prototype._restoreSelection = function () {\r\n\r\n\tif ( this._selectedItemBinding ) {\r\n\t\tthis._selectedItemBinding.focus ();\r\n\t}\r\n}\r\n\r\n/**\r\n * For cosmetic reasons, attempting to make\r\n * the opening menu as wide as the selector.\r\n */\r\nSelectorBinding.prototype._fitMenuToSelector = function () {\r\n\r\n\tvar selectorWidth = this._buttonBinding.bindingElement.offsetWidth + \"px\";\r\n\tvar popupElement = this._popupBinding.bindingElement;\r\n\r\n\tpopupElement.style.minWidth = selectorWidth;\r\n}\r\n\r\n/**\r\n *\r\n * @param {Event} e\r\n */\r\nSelectorBinding.prototype.handleEvent = function (e) {\r\n\r\n\tSelectorBinding.superclass.handleEvent.call(this, e);\r\n\r\n\tswitch (e.type) {\r\n\t\tcase DOMEvents.FOCUS:\r\n\t\t\tthis.focus();\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.KEYDOWN:\r\n\t\t\tvar charCode = Client.isExplorer ? e.keyCode : e.which;\r\n\t\t\tif (charCode == 8) {\r\n\t\t\t\tthis._popSearchSelection();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.KEYPRESS:\r\n\t\t\tvar charCode = Client.isExplorer ? e.keyCode : e.which;\r\n\t\t\tif (charCode >= 32) {\r\n\t\t\t\tthis._buttonBinding.check();\r\n\t\t\t\tvar letter = String.fromCharCode(charCode);\r\n\t\t\t\tthis._pushSearchSelection(letter);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t}\r\n}\r\n\r\n/**\r\n  * @param {char} letter\r\n */\r\nSelectorBinding.prototype._pushSearchSelection = function (letter) {\r\n\r\n\tthis._searchString += letter.toLowerCase();\r\n\tthis._applySearchSelection();\r\n}\r\n\r\n/**\r\n* @param {char} letter\r\n*/\r\nSelectorBinding.prototype._popSearchSelection = function (letter) {\r\n\r\n\tthis._searchString = this._searchString.substring(0, this._searchString.length - 1);\r\n\tthis._applySearchSelection();\r\n}\r\n\r\n/**\r\n* Clear search string\r\n*/\r\nSelectorBinding.prototype._clearSearchSelection = function () {\r\n\tif (this._searchString != null && this._searchString != \"\") {\r\n\t\tthis._searchString = \"\";\r\n\t\tthis._applySearchSelection();\r\n\t}\r\n}\r\n\r\n/**\r\n* Filter selection list by filteringString\r\n*/\r\nSelectorBinding.prototype._applySearchSelection = function () {\r\n\r\n\tif (this.isSearchSelectionEnabled) {\r\n\r\n\t\tvar bodyBinding = this._menuBodyBinding;\r\n\t\tif (bodyBinding != null) {\r\n\r\n\t\t\tvar menuItemImplementation = this.MENUITEM_IMPLEMENTATION;\r\n\t\t\tvar bodyDocument = bodyBinding.bindingDocument;\r\n\r\n\r\n\r\n\t\t\tvar list = this._getSelectionsList();\r\n\r\n\t\t\tif (this._searchString != null && this._searchString != \"\") {\r\n\r\n\t\t\t\tthis._popupBinding.clear();\r\n\r\n\t\t\t\tthis._buttonBinding.setLabel(this._searchString);\r\n\r\n\t\t\t\tif (list.hasEntries()) {\r\n\t\t\t\t\twhile (list.hasNext()) {\r\n\t\t\t\t\t\tvar selection = list.getNext();\r\n\t\t\t\t\t\tif (selection.label.toLowerCase().indexOf(this._searchString) > -1)\r\n\t\t\t\t\t\t\tthis.addSelection(selection);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._attachSelections();\r\n\r\n\t\t\t\t// Hightlight search text\r\n\t\t\t\tvar pattern = new RegExp(this._searchString.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, \"\\\\$&\"), \"gi\");\r\n\t\t\t\tvar menuitems = bodyBinding.getDescendantBindingsByType(menuItemImplementation);\r\n\t\t\t\tif (menuitems.hasEntries()) {\r\n\r\n\t\t\t\t\twhile (menuitems.hasNext()) {\r\n\t\t\t\t\t\tvar menuitem = menuitems.getNext();\r\n\t\t\t\t\t\tvar labelBinding = menuitem.labelBinding;\r\n\t\t\t\t\t\tif (labelBinding != null && labelBinding.shadowTree != null && labelBinding.shadowTree.labelText != null) {\r\n\t\t\t\t\t\t\tlabelBinding.shadowTree.labelText.innerHTML = labelBinding.shadowTree.labelText.innerHTML.replace(pattern, \"<b>$&</b>\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmenuitems.getFirst().focus();\r\n\r\n\t\t\t\t\tthis.attachClassName(DataBinding.CLASSNAME_INFOBOX);\r\n\t\t\t\t\tthis.detachClassName(DataBinding.CLASSNAME_INVALID);\r\n\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\r\n\t\t\t\t\tlabelBinding = LabelBinding.newInstance(bodyDocument);\r\n\t\t\t\t\tlabelBinding.setLabel(StringBundle.getString(\"ui\", \"AspNetUiControl.Selector.NoMatchesFor\").replace(\"{0}\", this._searchString ? this._searchString.replace(/\\$/g,'$$$$') : ''));\r\n\t\t\t\t\tbodyBinding.add(labelBinding);\r\n\t\t\t\t\tthis._attachSelections();\r\n\r\n\t\t\t\t\tthis.detachClassName(DataBinding.CLASSNAME_INFOBOX);\r\n\t\t\t\t\tthis.attachClassName(DataBinding.CLASSNAME_INVALID);\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\r\n\t\t\t\tthis._popupBinding.clear();\r\n\r\n\t\t\t\tthis._buttonBinding.setLabel(this._selectionLabel);\r\n\r\n\t\t\t\tif (list.hasEntries()) {\r\n\t\t\t\t\twhile (list.hasNext()) {\r\n\t\t\t\t\t\tvar selection = list.getNext();\r\n\t\t\t\t\t\tvar item = this.addSelection(selection);\r\n\t\t\t\t\t\tif (this._selectionValue == selection.value) {\r\n\t\t\t\t\t\t\tthis._selectedItemBinding = item;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis._attachSelections();\r\n\t\t\t\tthis._restoreSelection();\r\n\r\n\t\t\t\tthis.detachClassName(DataBinding.CLASSNAME_INFOBOX);\r\n\t\t\t\tthis.detachClassName(DataBinding.CLASSNAME_INVALID);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif (this._bodyBinding instanceof MenuBodyBinding) {\r\n\t\t\t\tthis._bodyBinding.refreshMenuGroups();\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t* Enable keyboard navigation.\r\n\t\t\t*/\r\n\t\t\tthis._popupBinding._enableTab(true);\r\n\r\n\t\t\tthis._popupBinding.snapTo(this._buttonBinding.bindingElement);\r\n\t\t\tthis._popupBinding.fitOnScreen();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nSelectorBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tSelectorBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.KEY_ARROW :\r\n\t\t\tthis.logger.debug ( this._buttonBinding.getLabel ());\r\n\t\t\tthis._handleArrowKey ( arg );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Keyboard navigation stuff.\r\n * @param {int} key\r\n */\r\nSelectorBinding.prototype._handleArrowKey = function ( key ) {\r\n\r\n\tif ( !this._popupBinding.isVisible ) {\r\n\t\tswitch ( key ) {\r\n\t\t\tcase KeyEventCodes.VK_DOWN :\r\n\t\t\tcase KeyEventCodes.VK_UP :\r\n\t\t\t\tthis._buttonBinding.check ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Select by MenuItemBinding.\r\n * @param {MenuItemBinding} itemBinding\r\n * @param {boolean} isActionBlocked True while initializing to block action.\r\n * @return {boolean} True if something (new) was selected\r\n */\r\nSelectorBinding.prototype.select = function ( itemBinding, isActionBlocked ) {\r\n\r\n\tvar isSuccess = false;\r\n\r\n\tif ( itemBinding != this._selectedItemBinding ) {\r\n\r\n\t\tthis._selectedItemBinding = itemBinding;\r\n\t\tisSuccess = true;\r\n\r\n\t\tvar button = this._buttonBinding;\r\n\t\tthis._selectionValue = itemBinding.selectionValue;\r\n\t\tthis._selectionLabel = itemBinding.getLabel();\r\n\t\tbutton.setLabel ( itemBinding.getLabel ());\r\n\r\n\t\tif ( itemBinding.imageProfile != null ) {\r\n\t\t\tbutton.imageProfile = itemBinding.imageProfile;\r\n\t\t}\r\n\t\tif ( button.imageProfile != null ) {\r\n\t\t\tbutton.setImage (\r\n\t\t\t\tthis.isDisabled == true ?\r\n\t\t\t\t\tbutton.imageProfile.getDisabledImage () :\r\n\t\t\t\t\tbutton.imageProfile.getDefaultImage ()\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis._updateImageLayout ();\r\n\r\n\t\tif ( !isActionBlocked ) {\r\n\t\t\tthis.onValueChange ();\r\n\t\t\tthis.dispatchAction (\r\n\t\t\t\tSelectorBinding.ACTION_SELECTIONCHANGED\r\n\t\t\t);\r\n\r\n\t\t\t/*\r\n\t\t\t * TODO: Enable this when dialogs and wizards go AJAX!\r\n\t\t\t *\r\n\t\t\tif ( this.getProperty ( \"callbackid\" ) != null ) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () { // allow selector to close...\r\n\t\t\t\t\tself.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t\t*/\r\n\r\n\t\t\tthis.dirty ();\r\n\t\t}\r\n\t\tif ( !this._isValid || ( this.isRequired && !isActionBlocked )) {\r\n\t\t\tthis.validate ();\r\n\t\t}\r\n\t}\r\n\r\n\treturn isSuccess;\r\n}\r\n\r\n/**\r\n * Hide or show related binding.\r\n */\r\nSelectorBinding.prototype._relate = function () {\r\n\r\n\tvar relate = this.getProperty ( \"relate\" );\r\n\r\n\tif ( relate ) {\r\n\t\tvar element = this.bindingDocument.getElementById ( relate );\r\n\t\tif ( element ) {\r\n\t\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\tif ( binding ) {\r\n\t\t\t\tif ( this.isChecked ) {\r\n\t\t\t\t\tbinding.show ();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tbinding.hide ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Update image layput.\r\n */\r\nSelectorBinding.prototype._updateImageLayout = function () {\r\n\r\n\tif ( this._buttonBinding.getImage () == null ) {\r\n\t\tif ( this._isImageLayout == true ) {\r\n\t\t\tthis._buttonBinding.attachClassName ( ToolBarBinding.CLASSNAME_TEXTONLY );\r\n\t\t\tthis._isImageLayout = false;\r\n\t\t}\r\n\t} else {\r\n\t\tif ( !this._isImageLayout ) {\r\n\t\t\tthis._buttonBinding.detachClassName ( ToolBarBinding.CLASSNAME_TEXTONLY );\r\n\t\t\tthis._isImageLayout = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Fires when selection changes. Does nothing by default. Feel free\r\n * to overwrite. And maybe refactor this methods name some day...\r\n */\r\nSelectorBinding.prototype.onValueChange = function () {}\r\n\r\n/**\r\n * This will select the *first* selection with a given value.\r\n * @param {object} value\r\n * @param {boolean} isActionBlocked\r\n * @return {boolean} True if something (new) was selected\r\n */\r\nSelectorBinding.prototype.selectByValue = function ( value, isActionBlocked ) {\r\n\r\n\tvar isSuccess = false;\r\n\tvar bodyBinding = this._menuBodyBinding;\r\n\r\n\t/*\r\n\t * Remember that bindings may not have been attached.\r\n\t */\r\n\tvar itemElementList = bodyBinding.getDescendantElementsByLocalName ( \"menuitem\" );\r\n\twhile ( itemElementList.hasNext ()) {\r\n\t\tvar itemBinding = UserInterface.getBinding (\r\n\t\t\titemElementList.getNext ()\r\n\t\t);\r\n\t\tif ( itemBinding.selectionValue == value ) {\r\n\t\t\tisSuccess = this.select ( itemBinding, isActionBlocked );\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn isSuccess;\r\n}\r\n\r\n/**\r\n * Remember that the value is hidden around here. The button label is not the value!\r\n * @return {string}\r\n */\r\nSelectorBinding.prototype.getValue = function () {\r\n\r\n\tvar result = this._selectionValue;\r\n\tif ( result != null ) {\r\n\t\tresult = String ( result );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set value. This will change the selectbox selection.\r\n * @implements {IData}\r\n * @param {object} value\r\n */\r\nSelectorBinding.prototype.setValue = function ( value ) {\r\n\r\n\tthis.selectByValue ( String ( value ), true );\r\n}\r\n\r\n\r\n/**\r\n * Get result. Unlike getValue, the result may be any object (though only numbers for now).\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nSelectorBinding.prototype.getResult = function () {\r\n\r\n\tvar result = this._selectionValue;\r\n\r\n\tif ( result == \"null\" ) { // javascript apocalypse!\r\n\t\tresult = null;\r\n\t}\r\n\tif ( result ) {\r\n\t\tswitch ( this.type ) {\r\n\t\t\tcase DataBinding.TYPE_NUMBER :\r\n\t\t\tcase DataBinding.TYPE_INTEGER :\r\n\t\t\t\tresult = Number ( result );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set result. This will change the selectbox selection.\r\n * @implements {IData}\r\n * @param {object} result\r\n */\r\nSelectorBinding.prototype.setResult = function ( result ) {\r\n\r\n\tthis.selectByValue ( result, true );\r\n}\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nSelectorBinding.prototype.validate = function () {\r\n\r\n\tvar isValid = true;\r\n\tif ( this.isRequired == true && this.defaultSelection != null ) {\r\n\t\tvar value = this.getValue ();\r\n\t\tif ( value == this.defaultSelection.value ) {\r\n\t\t\tisValid = false;\r\n\t\t}\r\n\t\tif ( isValid != this._isValid ) {\r\n\t\t\tif ( isValid ) {\r\n\t\t\t\tthis.dispatchAction ( Binding.ACTION_VALID );\r\n\t\t\t\tthis.detachClassName ( DataBinding.CLASSNAME_INVALID );\r\n\t\t\t} else {\r\n\t\t\t\tthis.dispatchAction ( Binding.ACTION_INVALID );\r\n\t\t\t\tthis.attachClassName ( DataBinding.CLASSNAME_INVALID );\r\n\t\t\t\tthis._buttonBinding.setLabel ( DataBinding.warnings [ \"required\" ]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis._isValid = isValid;\r\n\t}\r\n\treturn isValid;\r\n}\r\n\r\n/**\r\n * Manifest. If no value, remove element from post result.\r\n * @implements {IData}\r\n */\r\nSelectorBinding.prototype.manifest = function () {\r\n\r\n\tif ( this.isAttached == true ) {\r\n\t\tif ( this.getResult ()) {\r\n\t\t\tif ( !this.shadowTree.input ) {\r\n\t\t\t\tthis.buildFormField ();\r\n\t\t\t}\r\n\t\t\tthis.shadowTree.input.value = this.getValue ();\r\n\t\t} else if ( this.shadowTree.input ) {\r\n\t\t\tthis.shadowTree.input.parentNode.removeChild ( this.shadowTree.input );\r\n\t\t\tthis.shadowTree.input = null;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Build selections. For faster page load time, the popup bindings\r\n * get attached only when user handles the selector button or presses\r\n * the enter key.\r\n */\r\nSelectorBinding.prototype._attachSelections = function () {\r\n\r\n\tvar popup = this._popupBinding;\r\n\tif ( !this._isUpToDate ) {\r\n\t\tpopup.attachRecursive ();\r\n\t\tthis._isUpToDate = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Always update selector!\r\n * TODO: Not a good idea, since this control is pretty render-heavy...\r\n * @overwrites {Binding#handleElement}\r\n * @implements {IUpdateHandler}\r\n * @param {Element} element\r\n * @returns {boolean} Return true to trigger method handleElement.\r\n */\r\nSelectorBinding.prototype.handleElement = function () {\r\n\r\n\treturn true;\r\n}\r\n\r\n/**\r\n * Always update selector!\r\n * TODO: Check for changes by comparing curent CLIENTSIDE value (selection) with server response!!!\r\n * TODO: See Bug 3115.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#updateElement}\r\n * @param {Element} element\r\n * @param {Element} oldelement\r\n * @returns {boolean} Return true to stop crawling.\r\n */\r\nSelectorBinding.prototype.updateElement = function ( element, oldelement ) {\r\n\r\n\t/*\r\n\t * ALWAYS update selector (full replace)\r\n\t */\r\n\tthis.bindingWindow.UpdateManager.addUpdate (\r\n\t\tnew this.bindingWindow.ReplaceUpdate ( this.getID (), element )\r\n\t);\r\n\treturn true;\r\n}\r\n\r\n/**\r\n * SelectorBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {SelectorBinding}\r\n */\r\nSelectorBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:selector\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, SelectorBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/selectors/SelectorBindingSelection.js",
    "content": "/**\r\n * @class\r\n * This is *not* a binding! It is simply an object that \r\n * can be fed to a SelectorBinding in order to populate it.\r\n * @implements {IData}\r\n * @param {string} label\r\n * @param {object} value\r\n * @param {boolean} isSelected\r\n * @param {ImageProfile} imageProfile\r\n */ \r\nfunction SelectorBindingSelection ( label, value, isSelected, imageProfile, tooltip ) {\r\n\t\r\n\tthis._init ( label, value, isSelected, imageProfile, tooltip );\r\n}\r\n\r\nSelectorBindingSelection.prototype = {\r\n\t\r\n\t/**\r\n\t * The visible label on the selection.\r\n\t * @type {string}\r\n\t */\r\n\tlabel : null,\r\n\t\r\n\t/**\r\n\t * Value is stored internally as a string. You can extract the typecasted value, \r\n\t * dependant on the selectors type property, by using the getResult method.\r\n\t * @see {SelectorBinding#getResult}\r\n\t * @type {string}\r\n\t */\r\n\tvalue : null,\r\n\t\r\n\t/**\r\n\t * @type {String}\r\n\t */\r\n\ttooltip : null,\r\n\t\r\n\t/**\r\n\t * If set to true, the selection will be selected.\r\n\t * @type {boolean}\r\n\t */\r\n\tisSelected : null,\r\n\t\r\n\t/**\r\n\t * Das image profile.\r\n\t * @type {ImageProfile}\r\n\t */\r\n\timageProfile : null,\r\n\t\r\n\t/**\r\n\t * This property is set by the SelectorBinding when selection is resolved.\r\n\t * @type {MenuItemBinding}\r\n\t */\r\n\tmenuItemBinding : null,\r\n\t\r\n\t/**\r\n\t * Initialize all of the above.\r\n\t * @param {string} label\r\n\t * @param {object} value\r\n\t * @param {boolean} isSelected\r\n\t * @param {ImageProfile} imageProfile\r\n\t * @param {String} tooltip\r\n\t */\r\n\t_init : function ( label, value, isSelected, imageProfile, tooltip ) {\r\n\t\t\r\n\t\tif ( label != null ) {\r\n\t\t\tthis.label = String ( label );\r\n\t\t}\r\n\t\tif ( value != null ) {\r\n\t\t\tthis.value = String ( value );\r\n\t\t}\r\n\t\tif ( imageProfile != null ) {\r\n\t\t\tthis.imageProfile = imageProfile;\r\n\t\t}\r\n\t\tif ( tooltip != null ) {\r\n\t\t\tthis.tooltip = tooltip;\r\n\t\t}\r\n\t\tthis.isSelected = isSelected ? true : false;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/data/selectors/SimpleSelectorBinding.js",
    "content": "SimpleSelectorBinding.prototype = new DataBinding;\r\nSimpleSelectorBinding.prototype.constructor = SimpleSelectorBinding;\r\nSimpleSelectorBinding.superclass = DataBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @implements {IData}\r\n */\r\nfunction SimpleSelectorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SimpleSelectorBinding\" ); \r\n\t\r\n\t/**\r\n\t * @type {HTMLSelectElement}\r\n\t */\r\n\tthis._select = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRequired = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isValid = true;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._cachewidth = 0;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSimpleSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SimpleSelectorBinding]\";\r\n}\r\n\r\n/**\r\n * Find name, then register binding with DocumentManager.\r\n * @overwrites {Binding#onBindingRegister}\r\n */\r\nSimpleSelectorBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tSimpleSelectorBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tvar name = this.getProperty ( \"name\" );\r\n\tif ( name != null ) {\r\n\t\tthis.setName ( name );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {DataBinding#onBindingAttach}\r\n */\r\nSimpleSelectorBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tSimpleSelectorBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis._select = this.getChildElementByLocalName ( \"select\" );\r\n\tvar name = this.getName ();\r\n\tif ( name != null ) {\r\n\t\tthis._select.name = name;\r\n\t}\r\n\t\r\n\tthis._parseDOMProperties ();\r\n\tthis._buildDOMContent ();\r\n}\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nSimpleSelectorBinding.prototype._parseDOMProperties = function () {\r\n\t\r\n\tvar onchange = this.getProperty ( \"onchange\" );\r\n\tthis.isRequired = this.getProperty ( \"required\" ) == true;\r\n\t\r\n\tif ( this.hasCallBackID ()) {\r\n\t\tthis._select.id = this.getCallBackID ();\r\n\t}\r\n\tif ( onchange ) {\r\n\t\tthis.onValueChange = function () {\r\n\t\t\tBinding.evaluate ( onchange, this );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nSimpleSelectorBinding.prototype._buildDOMContent = function () {\r\n\t\r\n\tthis.bindingElement.tabIndex = 0;\r\n\tif ( Client.isExplorer == true ) {\r\n\t\tthis.bindingElement.hideFocus = true;\r\n\t}\r\n\t\r\n\t/*\r\n\t * Rig up select element.\r\n\t */\r\n\tvar self = this;\r\n\tthis._select.onchange = function () {\r\n\t\tself.onValueChange ();\r\n\t\tself.dirty ();\r\n\t\tif ( !self._isValid ) {\r\n\t\t\tself.validate ();\r\n\t\t}\r\n\t};\r\n\tthis._select.onfocus = function () {\r\n\t\tself.focus ( true );\r\n\t}\r\n\tif ( Client.isExplorer ) {\r\n\t\tthis._buildDOMContentIE ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Build DOM content especial for Internet Explorer.\r\n */\r\nSimpleSelectorBinding.prototype._buildDOMContentIE = function () {\r\n\r\n\tif ( Client.isExplorer ) {\r\n\t\r\n\t\t/*\r\n\t\t * Fix height for IE. We are hacking select elements  \r\n\t\t * to expand when focused, showing long option texts. \r\n\t\t * Why should this be nescessary? It boggles the mind.\r\n\t\t */\r\n\t\tthis.bindingElement.style.height = this.bindingElement.offsetHeight + \"px\";\r\n\t\tthis._cachewidth = this._select.offsetWidth;\r\n\t\tthis._select.style.position = \"absolute\";\r\n\t\t\r\n\t\t/*\r\n\t\t * This stuff must be done on mouseover and mouseout since    \r\n\t\t * width must not be modified while evaluating focus and blur. \r\n\t\t */\r\n\t\tvar self = this;\r\n\t\tthis._select.onmouseover = function () {\r\n\t\t\tif ( !self.isFocused ) {\r\n\t\t\t\tself._hack ( true );\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tthis._select.onmouseout = function () {\r\n\t\t\tif ( !self.isFocused ) {\r\n\t\t\t\tself._hack ( false );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Fires when selection changes. Does nothing by default. Feel free \r\n * to overwrite. And maybe refactor this methods name some day...\r\n */\r\nSimpleSelectorBinding.prototype.onValueChange = function () {}\r\n\r\n/**\r\n * Focus.\r\n * @overloads {DataBinding#focus}\r\n * @param {boolean} isMouseEvent\r\n * @implements {IData}\r\n */\r\nSimpleSelectorBinding.prototype.focus = function ( isMouseEvent ) {\r\n\t\r\n\tSimpleSelectorBinding.superclass.focus.call ( this );\r\n\t\r\n\tif ( this.isFocused ) {\r\n\t\tif ( !isMouseEvent ) {\r\n\t\t\tFocusBinding.focusElement ( this._select );\r\n\t\t\tif ( Client.isExplorer ) {\r\n\t\t\t\tthis._hack ( true );\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.bindingWindow.standardEventHandler.enableNativeKeys ( false );\r\n\t}\r\n};\r\n\r\n/**\r\n * Blur.\r\n * @overloads {DataBinding#focus}\r\n * @implements {IData}\r\n */\r\nSimpleSelectorBinding.prototype.blur = function () {\r\n\t\r\n\tSimpleSelectorBinding.superclass.blur.call ( this );\r\n\t\r\n\tif ( !this.isFocused ) {\r\n\t\tthis._select.blur ();\r\n\t\tthis.bindingWindow.standardEventHandler.disableNativeKeys ();\r\n\t\tif ( Client.isExplorer ) {\r\n\t\t\tthis._hack ( false ); \r\n\t\t}\r\n\t\tif ( this.isRequired ) {\r\n\t\t\tthis.validate ();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Let's hack!\r\n * @param {boolean} isHack\r\n */\r\nSimpleSelectorBinding.prototype._hack = function ( isHack ) {\r\n\t\r\n\tif ( Client.isExplorer ) {\r\n\t\tthis._select.style.width = isHack ? \"auto\" : this._cachewidth + \"px\";\r\n\t\t/*\r\n\t\t * If hack wasn't really nescessary, we hack it right back.\r\n\t\t */\r\n\t\tif ( isHack ) {\r\n\t\t\tif ( this._select.offsetWidth <= this._cachewidth ) {\r\n\t\t\t\tthis._hack ( false );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//ABSTRACT METHODS ............................................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nSimpleSelectorBinding.prototype.validate = function () {\r\n\t\r\n\tvar isValid = true;\r\n\t\r\n\tif ( this.isRequired ) {\r\n\t\tif ( this.getValue () == null ) {\r\n\t\t\tisValid = false;\r\n\t\t}\r\n\t}\r\n\tif ( isValid != this._isValid ) {\r\n\t\tif ( isValid ) {\r\n\t\t\tthis.detachClassName ( DataBinding.CLASSNAME_INVALID );\r\n\t\t} else {\r\n\t\t\tthis.attachClassName ( DataBinding.CLASSNAME_INVALID );\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Only \"required\" could have brought us here...\r\n\t\t\t * Warning: This stuff is pretty hacked up!\r\n\t\t\t */\r\n\t\t\tvar select = this._select;\r\n\t\t\tvar option = select.options [ select.selectedIndex ];\r\n\t\t\tvar text = DOMUtil.getTextContent ( option );\r\n\t\t\t\r\n\t\t\tselect.blur (); \r\n\t\t\tselect.style.color = \"#A40000\";\r\n\t\t\tselect.style.fontWeight = \"bold\";\r\n\t\t\tif ( !Client.isExplorer6 ) {\r\n\t\t\t\tDOMUtil.setTextContent ( option, DataBinding.warnings [ \"required\" ]);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tselect.onfocus = function () {\r\n\t\t\t\tthis.style.color = \"black\";\r\n\t\t\t\tthis.style.fontWeight = \"normal\";\r\n\t\t\t\tthis.onfocus = null;\r\n\t\t\t\tif ( !Client.isExplorer6 ) {\r\n\t\t\t\t\tDOMUtil.setTextContent ( option, text );\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t\tthis._isValid = isValid;\r\n\t}\r\n\t\r\n\treturn isValid;\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM \r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nSimpleSelectorBinding.prototype.manifest = function () {}\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nSimpleSelectorBinding.prototype.getValue = function () {\r\n\t\r\n\tvar result = null;\r\n\tvar select = this._select;\r\n\tvar option = select.options [ select.selectedIndex ];\r\n\tvar hasValue = true;\r\n\tif ( Client.isExplorer ) { // hasAttribute must be new to IE8. We hack it.\r\n\t\tvar html = option.outerHTML.toLowerCase ();\r\n\t\tif ( html.indexOf ( \"value=\" ) ==-1 ) {\r\n\t\t\thasValue = false;\r\n\t\t}\r\n\t}\r\n\tif ( hasValue ) {\r\n\t\tresult = option.getAttribute ( \"value\" ); // option.value returns the textContent!\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set value.\r\n * @implements {IData}\r\n * @param {string} value\r\n */\r\nSimpleSelectorBinding.prototype.setValue = function ( value ) {}\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nSimpleSelectorBinding.prototype.getResult = function () {\r\n\t\r\n\treturn this.getValue ();\r\n}\r\n\r\n/**\r\n * Set result.\r\n * @implements {IData}\r\n * @param {object} value\r\n */\r\nSimpleSelectorBinding.prototype.setResult = function ( value ) {\r\n\t\r\n\tthis.setValue ( value );\r\n}\r\n\r\n/**\r\n * SimpleSelectorBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {SimpleSelectorBinding}\r\n */\r\nSimpleSelectorBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_XHTML, \"select\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, SimpleSelectorBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/decks/DeckBinding.js",
    "content": "DeckBinding.prototype = new FlexBoxBinding;\r\nDeckBinding.prototype.constructor = DeckBinding;\r\nDeckBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nDeckBinding.ACTION_SELECTED = \"deck selected\";\r\nDeckBinding.ACTION_UNSELECTED = \"deck unselected\";\r\nDeckBinding.NODENAME_DECKS = \"decks\";\r\nDeckBinding.CLASSNAME = \"deckelement\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DeckBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DeckBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isSelected = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = false;\r\n\t\r\n\t/**\r\n\t * @type {DecksBinding}\r\n\t */\r\n\tthis.containingDecksBinding = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDeckBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DeckBinding]\";\r\n}\r\n\r\n/**\r\n * Assign special classname.\r\n * Overloads {Binding#onBindingRegister}\r\n */\r\nDeckBinding.prototype.onBindingRegister = function () {\r\n\r\n\tDeckBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.addActionListener ( BalloonBinding.ACTION_INITIALIZE );\r\n\tthis.attachClassName ( DeckBinding.CLASSNAME );\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nDeckBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDeckBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.containingDecksBinding = this.getAncestorBindingByLocalName ( this.constructor.NODENAME_DECKS );\r\n\tif ( this.getProperty ( \"selected\" ) == true ) {\r\n\t\tthis.containingDecksBinding.select ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {FlexBoxBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nDeckBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tDeckBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\tswitch ( action.type ) {\r\n\t\tcase BalloonBinding.ACTION_INITIALIZE :\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Select deck. This method is invoked by the {@link DecksBinding}.\r\n */\r\nDeckBinding.prototype.select = function () {\r\n\t\r\n\tif ( !this.isSelected ) {\r\n\t\r\n\t\tif ( this.isLazy == true ) {\t\r\n\t\t\tthis.wakeUp ( \"select\" );\r\n\t\t} else {\r\n\t\t\t\r\n\t\t\tthis.isSelected = true;\r\n\t\t\tthis.isVisible = true;\t\r\n\t\t\tthis.setProperty ( \"selected\", \"true\" );\r\n\t\t\tthis.bindingElement.style.position = \"static\";\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Start flex iterator?\r\n\t\t\t */\r\n\t\t\tthis._invokeManagedRecursiveFlex ();\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Proudly announce.\r\n\t\t\t */\r\n\t\t\tthis.dispatchAction ( DeckBinding.ACTION_SELECTED );\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * TODO: Even if seleted, focus shift should only be invoked   \r\n\t\t\t * when no VISIBLE binding inside the dock has the current focus. \r\n\t\t\t */\r\n\t\t\tvar root = UserInterface.getBinding ( this.bindingDocument.body );\r\n\t\t\tif ( root.isActivated ) {\r\n\t\t\t\tthis.dispatchAction ( FocusBinding.ACTION_FOCUS );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Unselect deck. This method is invoked by the {@link DecksBinding}.\r\n */\r\nDeckBinding.prototype.unselect = function () {\r\n\t\r\n\tif ( this.isSelected ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Blur any focused binding within the tabpanel.\r\n\t\t */\r\n\t\tthis.dispatchAction ( FocusBinding.ACTION_BLUR );\r\n\t\t\r\n\t\tthis.deleteProperty ( \"selected\" );\r\n\t\tthis.isSelected = false;\r\n\t\tthis.isVisible = false;\r\n\t\tthis.bindingElement.style.position = \"absolute\";\r\n\t\t\r\n\t\tthis.dispatchAction ( DeckBinding.ACTION_UNSELECTED );\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoke recursive flex ONLY IF decks height \r\n * has changed since last show (or when first shown).\r\n * TODO: This doesn't work!\r\n * TODO: Make this work!\r\n */\r\nDeckBinding.prototype._invokeManagedRecursiveFlex = function () {\r\n\t\r\n\tthis.reflex ( true ); // why true? Otherwise explorer decks dont work...\r\n\t\r\n\t/*\r\n\tif ( this.isAttached == true ) {\r\n\t\tif ( this.containingDecksBinding.hasDimensionsChanged ()) {\r\n\t\t\tthis.reflex ();\r\n\t\t}\r\n\t}\r\n\t*/\r\n}\r\n\r\n/**\r\n * DeckBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DeckBinding}\r\n */\r\nDeckBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:deck\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DeckBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/decks/DecksBinding.js",
    "content": "DecksBinding.prototype = new FlexBoxBinding;\r\nDecksBinding.prototype.constructor = DecksBinding;\r\nDecksBinding.superclass = FlexBoxBinding.prototype;\r\nDecksBinding.ACTION_SELECTED = \"decks deck selected\";\r\nDecksBinding.NODENAME_DECK = \"deck\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DecksBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DecksBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {DeckBinding}\r\n\t */\r\n\tthis._selectedDeckBinding = null;\r\n\t\r\n\t/**\r\n\t * Storing decks dimensions in order to economize flex iterations.\r\n\t * @see {DeckBinding#_invokeManagedRecursiveFlex}\r\n\t * @type {Dimension}\r\n\t */\r\n\tthis._lastKnownDimension = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDecksBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DecksBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nDecksBinding.prototype.onBindingRegister = function () {\r\n\r\n\tDecksBinding.superclass.onBindingRegister.call ( this );\r\n\tthis._lastKnownDimension = new Dimension ( 0, 0 );\r\n\tthis.attachClassName ( \"deckselement\" );\r\n}\r\n\r\n/**\r\n * If no selected deck is specified, default select the first deck. The \r\n * actual selection is invoked by the DeckBindings onBindingAttach method.\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nDecksBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDecksBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tvar selectedindex = this.getProperty ( \"selectedindex\" );\r\n\t\r\n\tvar decks = this.getDeckElements ();\r\n\tif ( decks.hasEntries ()) {\r\n\t\tvar hasSelected = false;\r\n\t\tvar index = 0;\r\n\t\twhile ( decks.hasNext ()) {\r\n\t\t\tvar deck = decks.getNext ();\r\n\t\t\tif ( selectedindex && index == selectedindex ) {\r\n\t\t\t\tdeck.setAttribute ( \"selected\", \"true\" );\r\n\t\t\t\thasSelected = true;\r\n\t\t\t} else if ( deck.getAttribute ( \"selected\" ) == \"true\" ) {\r\n\t\t\t\thasSelected = true;\r\n\t\t\t}\r\n\t\t\tindex ++;\r\n\t\t}\r\n\t\tif ( !hasSelected ) {\r\n\t\t\tdecks.getFirst ().setAttribute ( \"selected\", \"true\" );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get deck elements.\r\n * @return {List<DOMElement>}\r\n */\r\nDecksBinding.prototype.getDeckElements = function () {\r\n\r\n\treturn this.getChildElementsByLocalName ( this.constructor.NODENAME_DECK );\r\n}\r\n\r\n/**\r\n * Select deck by one of three parameter types.\r\n * @param {object} arg This can be either an DOMElement, a DeckBinding or a string (element id).\r\n */\r\nDecksBinding.prototype.select = function ( arg ) {\r\n\r\n\tvar deckBinding = this.getBindingForArgument ( arg );\r\n\t\r\n\tif ( deckBinding != null ) {\r\n\t\tif ( deckBinding != this._selectedDeckBinding ) {\r\n\t\t\tif ( this._selectedDeckBinding ) {\r\n\t\t\t\tthis._selectedDeckBinding.unselect ();\r\n\t\t\t}\r\n\t\t\tthis._selectedDeckBinding = deckBinding;\r\n\t\t\tdeckBinding.select ();\r\n\t\t\tvar selectedindex = this.getProperty ( \"selectedindex\" );\r\n\t\t\tif ( selectedindex != null ) {\r\n\t\t\t\tthis.setProperty ( \r\n\t\t\t\t\t\"selectedindex\", \r\n\t\t\t\t\tDOMUtil.getOrdinalPosition ( deckBinding.bindingElement, true )\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tthis.dispatchAction ( DecksBinding.ACTION_SELECTED );\r\n\t\t\tthis.dispatchAction ( FocusBinding.ACTION_UPDATE );\r\n\t\t}\r\n\t} else {\r\n\t\tthrow \"No deck for argument \" + arg;\r\n\t}\r\n}\r\n\r\n/**\r\n * Returns true if dimensions changed \r\n * since method was lastly invoked.\r\n * @see {DeckBinding#_invokeManagedRecursiveFlex}\r\n * @return {boolean}\r\n */\r\nDecksBinding.prototype.hasDimensionsChanged = function () {\r\n\t\r\n\tvar result = false;\r\n\tvar dim1 = this.boxObject.getDimension ();\r\n\tvar dim2 = this._lastKnownDimension;\r\n\t\r\n\tif ( !Dimension.isEqual ( dim1, dim2 )) {\r\n\t\tresult = true;\r\n\t\tthis._lastKnownDimension = dim1;\r\n\t}\r\n\t\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get selected deck.\r\n * @return {DeckBinding}\r\n */\r\nDecksBinding.prototype.getSelectedDeckBinding = function () {\r\n\t\r\n\treturn this._selectedDeckBinding;\r\n}\r\n\r\n/**\r\n * DecksBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DecksBinding}\r\n */\r\nDecksBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:decks\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DecksBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogBinding.js",
    "content": "DialogBinding.prototype = new ControlBoxBinding;\r\nDialogBinding.prototype.constructor = DialogBinding;\r\nDialogBinding.superclass = ControlBoxBinding.prototype;\r\n\r\nDialogBinding.MODE_DRAGGING\t= \"dialogdragging\";\r\nDialogBinding.MODE_RESIZING = \"dialogresizing\";\r\nDialogBinding.ACTION_OPEN = \"dialogopen\";\r\nDialogBinding.ACTION_CLOSE = \"dialogclose\";\r\nDialogBinding.DEFAULT_WIDTH = 540;\r\nDialogBinding.DEFAULT_HEIGHT = 100;\r\n\r\n/**\r\n * @class\r\n * @implements {IActivatable}\r\n */\r\nfunction DialogBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogBinding\" );\r\n\r\n\t/**\r\n\t * Don't flex unless maximized - and we do not yet support maximization.\r\n\t * @overloads {FlexBoxBinding#isFlexible}\r\n\t */\r\n\tthis.isFlexible = false;\r\n\r\n\t/**\r\n\t * @type {DialogHeadBinding}\r\n\t */\r\n\tthis._head = null;\r\n\r\n\t/**\r\n\t * @type {DialogBodyBinding}\r\n\t */\r\n\tthis._body = null;\r\n\r\n\t/**\r\n\t * @type {DialogCoverBinding}\r\n\t */\r\n\tthis._cover = null;\r\n\r\n\t/**\r\n\t * @type {TitleBarBinding}\r\n\t */\r\n\tthis._titlebar = null;\r\n\r\n\t/**\r\n\t * This property is set to an instance of {@link DialogBorderBinding} when resizing.\r\n\t * @type {DialogBorderBinding}\r\n\t */\r\n\tthis._border = null;\r\n\r\n\t/**\r\n\t * Relevant for dragging scenario.\r\n\t * @type {Point}\r\n\t */\r\n\tthis.startPoint = null;\r\n\r\n\t/**\r\n\t * Stores position and dimension data.\r\n\t * @type {object}\r\n\t */\r\n\tthis.geometry = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActive = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivatable = false;\r\n\r\n\t/**\r\n\t * TODO: RENAME ISOPEN!\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isResizable = true;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDialogResizable = true;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isModal = false;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.mode = null;\r\n\r\n\t/**\r\n\t * @type {HashMap<string><ControlBinding>}\r\n\t */\r\n\tthis.controlBindings = {};\r\n\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._index = null;\r\n\r\n\t/**\r\n\t * THIS SHOULD BE DECLARED\r\n\t * @type {Dimension}\r\n\t *\r\n\tthis.startDimension = null;\r\n\t*/\r\n\r\n\t/**\r\n\t * Use fancy CSS transitions? Disabled for now...\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasTransitions = false; // Client.hasTransitions\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogBinding]\";\r\n}\r\n\r\n/*\r\n * Overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nDialogBinding.prototype.onBindingRegister = function () {\r\n\r\n\tDialogBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\tthis.addActionListener ( Binding.ACTION_DRAG, this );\r\n\tthis.addActionListener ( FocusBinding.ACTION_ACTIVATED );\r\n\tthis.subscribe ( this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST );\r\n\r\n\tthis.buildDescendantBindings ();\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nDialogBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDialogBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.geometry = this.computeDefaultGeometry ();\r\n\r\n\tthis.parseDOMProperties ();\r\n\tthis.buildControlBindings ();\r\n\tthis.buildBorderBindings ();\r\n\tthis.attachRecursive ();\r\n\r\n\tif ( this._isResizable ) {\r\n\t\tthis.attachClassName ( \"resizable\" );\r\n\t}\r\n\r\n\tif ( this._hasTransitions ) {\r\n\t\tthis.bindingElement.style.opacity = \"0\";\r\n\t}\r\n\r\n\tthis.setPosition ( new Point ( 0, 0 ));\r\n\tthis.setDimension ( new Dimension ( DialogBinding.DEFAULT_WIDTH, DialogBinding.DEFAULT_HEIGHT ));\r\n\tif ( this.getProperty ( \"open\" )) {\r\n\t\tthis.open ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Build descendant bindings.\r\n * TODO: finally overwrite the add method?\r\n */\r\nDialogBinding.prototype.buildDescendantBindings = function () {\r\n\r\n\t// these are always appended dynamically\r\n\tthis._head = DialogHeadBinding.newInstance ( this.bindingDocument );\r\n\tthis._titlebar = DialogTitleBarBinding.newInstance ( this.bindingDocument );\r\n\r\n\tthis.addFirst ( this._head );\r\n\tthis._head.add ( this._titlebar );\r\n\r\n\t// the dialog body may be declared; if not, we append it dynamically\r\n\tvar dialogbody = DOMUtil.getElementsByTagName ( this.bindingElement, \"dialogbody\" ).item ( 0 );\r\n\tif ( dialogbody ) {\r\n\t\tthis._body = UserInterface.getBinding ( dialogbody );\r\n\t} else {\r\n\t\tthis._body = DialogBodyBinding.newInstance ( this.bindingDocument );\r\n\t\tthis.add ( this._body );\r\n\t}\r\n}\r\n\r\n/**\r\n * Build borders.\r\n */\r\nDialogBinding.prototype.buildBorderBindings = function () {\r\n\r\n\tvar directions = new List ([\r\n\t\tDialogBorderBinding.TYPE_NORTH,\r\n\t\tDialogBorderBinding.TYPE_SOUTH,\r\n\t\tDialogBorderBinding.TYPE_EAST,\r\n\t\tDialogBorderBinding.TYPE_WEST\r\n\t]);\r\n\twhile ( directions.hasNext ()) {\r\n\t\tvar border = DialogBorderBinding.newInstance ( this.bindingDocument );\r\n\t\tborder.setType ( directions.getNext ());\r\n\t\tthis.add ( border );\r\n\t}\r\n}\r\n\r\n/**\r\n * Build dialog controls.\r\n */\r\nDialogBinding.prototype.buildControlBindings = function () {\r\n\r\n\tvar controls = this.getProperty ( \"controls\" );\r\n\tif ( controls ) {\r\n\t\tvar types = new List ( controls.split ( \" \" ));\r\n\t\twhile ( types.hasNext ()) {\r\n\t\t\tvar type = types.getNext ();\r\n\t\t\tswitch ( type ) {\r\n\t\t\t\tcase ControlBinding.TYPE_MAXIMIZE :\r\n\t\t\t\tcase ControlBinding.TYPE_MINIMIZE :\r\n\t\t\t\tcase ControlBinding.TYPE_CLOSE :\r\n\t\t\t\t\tvar controlBinding = DialogControlBinding.newInstance ( this.bindingDocument );\r\n\t\t\t\t\tcontrolBinding.setControlType ( type );\r\n\t\t\t\t\tthis._titlebar.addControl ( controlBinding );\r\n\t\t\t\t\tthis.controlBindings [ type ] = controlBinding;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tthrow new Error (\r\n\t\t\t\t\t\t\"DialogBinding: Control not added: \" + type\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Build and configure a {@link DialogCoverBinding}\r\n */\r\nDialogBinding.prototype.buildDialogCoverBinding = function () {\r\n\r\n\tthis._cover = DialogCoverBinding.newInstance ( this.bindingDocument );\r\n\tthis.getAncestorBindingByLocalName ( \"dialogset\" ).add ( this._cover );\r\n\tthis._cover.cover ( this);\r\n}\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nDialogBinding.prototype.parseDOMProperties = function () {\r\n\r\n\tvar image \t\t= this.getProperty ( \"image\" );\r\n\tvar label \t\t= this.getProperty ( \"label\" );\r\n\tvar draggable \t= this.getProperty ( \"draggable\" );\r\n\tvar resizable \t= this.getProperty ( \"resizable\" );\r\n\tvar modal \t\t= this.getProperty ( \"modal\" );\r\n\r\n\tif ( image ) {\r\n\t\tthis.setImage ( image );\r\n\t}\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\tif ( draggable == false ) {\r\n\t\tthis.isDialogDraggable = false;\r\n\t}\r\n\tif ( resizable == false ) {\r\n\t\tthis.isPanelResizable = false;\r\n\t}\r\n\tif ( modal == true ) {\r\n\t\tthis.setModal ( true );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set modal.\r\n * @param {boolean} isModal\r\n */\r\nDialogBinding.prototype.setModal = function ( isModal ) {\r\n\r\n\tthis.isModal = isModal;\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nDialogBinding.prototype.setLabel = function ( label ) {\r\n\r\n\tthis.setProperty ( \"label\", label );\r\n\tif ( this.isAttached == true ) {\r\n\t\tthis._titlebar.setLabel (\r\n\t\t\tResolver.resolve ( label )\r\n\t\t)\r\n\t};\r\n}\r\n\r\n/**\r\n * Get label.\r\n * @return {string}\r\n */\r\nDialogBinding.prototype.getLabel = function () {\r\n\r\n\treturn this.getProperty ( \"label\" );\r\n}\r\n\r\n/**\r\n * Set image.\r\n * @param {string} url\r\n */\r\nDialogBinding.prototype.setImage = function ( url ) {\r\n\r\n\tthis.setProperty ( \"image\", url );\r\n\tif ( this.isAttached ) {\r\n\t\tthis._titlebar.setImage (\r\n\t\t\tResolver.resolve ( url )\r\n\t\t)\r\n\t};\r\n}\r\n\r\n/**\r\n * @overloads {ControlBoxBinding#handleAction}\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n */\r\nDialogBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tDialogBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\tcase Binding.ACTION_DRAG :\r\n\r\n\t\t\tvar binding = action.target;\r\n\t\t\tif ( this.getState () == ControlBoxBinding.STATE_NORMAL ) {\r\n\t\t\t\tswitch ( binding.constructor ) {\r\n\t\t\t\t\tcase DialogTitleBarBinding :\r\n\t\t\t\t\t\tthis.mode = DialogBinding.MODE_DRAGGING;\r\n\t\t\t\t\t\tbinding.dragger.registerHandler ( this );\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase DialogBorderBinding :\r\n\t\t\t\t\t\tif ( this._isResizable ) {\r\n\t\t\t\t\t\t\tthis.mode = DialogBinding.MODE_RESIZING;\r\n\t\t\t\t\t\t\tthis._border = binding;\r\n\t\t\t\t\t\t\tbinding.dragger.registerHandler ( this );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase Binding.ACTION_ACTIVATED :\r\n\t\t\tif ( !this.isActive ) {\r\n\t\t\t\tthis.activate ();\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\tcase FocusBinding.ACTION_ACTIVATED :\r\n\r\n\t\t\t/*\r\n\t\t\t * Simply consume the action. The FocusBinding\r\n\t\t\t * can now analyze the action to get a handle on\r\n\t\t\t * this DialogBinding.\r\n\t\t\t *\r\n\t\t\tthis.focusBinding = binding;\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t*/\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nDialogBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tDialogBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\t\tcase this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST :\r\n\t\t\tthis.startPoint = this.getPosition ();\r\n\t\t\tthis._setComputedPosition (\r\n\t\t\t\tnew Point ( 0, 0 )\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked when descendant controls fire.\r\n * @overloads {ControlBoxBinding#handleInvokedControl}\r\n * @param {ControlBinding} control\r\n */\r\nDialogBinding.prototype.handleInvokedControl = function ( control ) {\r\n\r\n\tDialogBinding.superclass.handleInvokedControl.call ( this, control );\r\n\r\n\tswitch ( control.controlType ) {\r\n\t\tcase ControlBinding.TYPE_CLOSE :\r\n\t\t\tthis.close ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Open dialog.\r\n * @param {boolean} isAutoHeight Needed to fix an IE bug, see {@link StageDialogBinding#_parsePageBinding}\r\n */\r\nDialogBinding.prototype.open = function ( isAutoHeight ) {\r\n\r\n\tif ( this.isModal && this._cover == null ) {\r\n\t\tthis.buildDialogCoverBinding ();\r\n\t}\r\n\tif ( !this.isVisible ) { // WHEN RENAMING THIS TO ISOPEN, SEE STAGEDIALOGBINDING ESCAPE STUFF\r\n\r\n\t\tthis.setProperty ( \"open\", \"true\" );\r\n\t\tthis.isVisible = true;\r\n\t\tthis.isActivatable = true;\r\n\t\tthis.activate ();\r\n\r\n\t\tif ( isAutoHeight ) {\r\n\t\t\t/*\r\n\t\t\t * centering and flexing needs to be performed\r\n\t\t\t * after this method, see StageDialogBinding\r\n\t\t\t */\r\n\t\t} else {\r\n\t\t\tthis.centerOnScreen ();\r\n\t\t\tthis.reflex ( true );\r\n\t\t}\r\n\r\n\t\tthis.bindingElement.style.marginTop = \"0\";\r\n\t\tthis.dispatchAction ( DialogBinding.ACTION_OPEN );\r\n\t\tthis.dispatchAction ( Binding.ACTION_VISIBILITYCHANGED );\r\n\r\n\t\tif ( this._hasTransitions ) {\r\n\t\t\tthis.bindingElement.style.opacity = \"1\";\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Close dialog.\r\n */\r\nDialogBinding.prototype.close = function () {\r\n\r\n\tif ( this.isVisible ) {\r\n\r\n\t\tthis.isActivatable = false;\r\n\t\tthis.deActivate ();\r\n\r\n\t\tvar self = this;\r\n\t\tfunction doit () {\r\n\r\n\t\t\tself.dispatchAction(DialogBinding.ACTION_CLOSE);\r\n\r\n\t\t\tself.isVisible = false;\r\n\t\t\tself.deleteProperty ( \"open\" );\r\n\r\n\t\t\tself.bindingElement.style.marginTop = \"-10000px\";\r\n\t\t}\r\n\r\n\t\tif ( !this._hasTransitions ) {\r\n\t\t\tsetTimeout(function () { doit(); }, 0);\r\n\t\t} else {\r\n\t\t\tvar element = self.bindingElement;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\telement.style.opacity = \"0\";\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tdoit ();\r\n\t\t\t\t}, Animation.DEFAULT_TIME );\r\n\t\t\t}, Animation.DEFAULT_TIME );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Activate.\r\n * @implements {IActivatable}\r\n */\r\nDialogBinding.prototype.activate = function () {\r\n\r\n\tif ( !this.isActive ) {\r\n\t\tthis.isActive = true;\r\n\t\tthis.attachClassName ( \"active\" );\r\n\t\tthis.moveToTop ();\r\n\t\tthis._titlebar.onActivate ();\r\n\t\tApplication.activate ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Deactivate.\r\n * @implements {IActivatable}\r\n */\r\nDialogBinding.prototype.deActivate = function () {\r\n\r\n\tif ( this.isActive == true ) {\r\n\t\tthis.isActive = false;\r\n\t\tthis.detachClassName ( \"active\" );\r\n\t\tthis._titlebar.onDeactivate ();\r\n\t\tApplication.deActivate ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Move panel to highest z-index. Invoked when dialog is activated.\r\n */\r\nDialogBinding.prototype.moveToTop = function () {\r\n\r\n\t/*\r\n\t * First event intercepted by the DialogSetBinding.\r\n\t * Second event intercepted by the DialogCoverBinding (if present).\r\n\t */\r\n\tthis.dispatchAction ( Binding.ACTION_MOVETOTOP );\r\n\tthis.dispatchAction ( Binding.ACTION_MOVEDONTOP );\r\n}\r\n\r\n/**\r\n * Get z-index.\r\n * @return {int}\r\n */\r\nDialogBinding.prototype.getZIndex = function () {\r\n\r\n\treturn CSSComputer.getZIndex ( this.bindingElement );\r\n}\r\n\r\n/**\r\n * Set z-index.\r\n * @param {int} index\r\n */\r\nDialogBinding.prototype.setZIndex = function ( index ) {\r\n\r\n\tthis.bindingElement.style.zIndex = new String ( index );\r\n}\r\n\r\n/**\r\n * @param {Point} point This argument is not used.\r\n */\r\nDialogBinding.prototype.onDragStart = function ( point ) {\r\n\r\n\tswitch ( this.mode ) {\r\n\t\tcase DialogBinding.MODE_DRAGGING :\r\n\t\tcase DialogBinding.MODE_RESIZING :\r\n\t\t\tthis.startPoint = new Point (\r\n\t\t\t\tthis.bindingElement.offsetLeft,\r\n\t\t\t\tthis.bindingElement.offsetTop\r\n\t\t\t);\r\n\t\t\tthis.startDimension = new Dimension (\r\n\t\t\t\tthis.bindingElement.offsetWidth,\r\n\t\t\t\tthis.bindingElement.offsetHeight\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {Point} diff\r\n */\r\nDialogBinding.prototype.onDrag = function ( diff ) {\r\n\r\n\tswitch ( this.mode ) {\r\n\t\tcase DialogBinding.MODE_DRAGGING :\r\n\t\t\tthis._setComputedPosition ( diff );\r\n\t\t\tbreak;\r\n\t\tcase DialogBinding.MODE_RESIZING :\r\n\t\t\tswitch ( this._border.getType ()) {\r\n\t\t\t\tcase DialogBorderBinding.TYPE_NORTH :\r\n\t\t\t\t\tthis.resizeNorth ( diff );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DialogBorderBinding.TYPE_SOUTH :\r\n\t\t\t\t\tthis.resizeSouth ( diff );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DialogBorderBinding.TYPE_EAST :\r\n\t\t\t\t\tthis.resizeEast ( diff );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DialogBorderBinding.TYPE_WEST :\r\n\t\t\t\t\tthis.resizeWest ( diff );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * notice the boolean parameter, invoking fast screen update.\r\n\t\t\t * This could potentially threaten Explorer if the dialog\r\n\t\t\t * contains lots of stuff. This works terrible in Mozilla!\r\n\t\t\t */\r\n\t\t\tthis.reflex ( true );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {Point} diff\r\n */\r\nDialogBinding.prototype.onDragStop = function ( diff ) {\r\n\r\n\tswitch ( this.mode ) {\r\n\t\tcase DialogBinding.MODE_DRAGGING :\r\n\t\t\tthis._setComputedPosition ( diff );\r\n\t\t\tbreak;\r\n\t\tcase DialogBinding.MODE_RESIZING :\r\n\t\t\tbreak;\r\n\t}\r\n\tthis.mode = null;\r\n}\r\n\r\n/**\r\n * Resize north.\r\n * @param {Point} diff\r\n */\r\nDialogBinding.prototype.resizeNorth = function ( diff ) {\r\n\r\n\tthis.setPosition ( new Point ( this.startPoint.x, this.startPoint.y + diff.y ));\r\n\tthis.setDimension ( new Dimension ( this.startDimension.w, this.startDimension.h - diff.y ));\r\n}\r\n\r\n/**\r\n * Resize south.\r\n * @param {Point} diff\r\n */\r\nDialogBinding.prototype.resizeSouth = function ( diff ) {\r\n\r\n\tthis.setDimension ( new Dimension ( this.startDimension.w, this.startDimension.h + diff.y ));\r\n}\r\n\r\n/**\r\n * Resize east.\r\n * @param {Point} diff\r\n */\r\nDialogBinding.prototype.resizeEast = function ( diff ) {\r\n\r\n\tthis.setDimension ( new Dimension ( this.startDimension.w + diff.x, this.startDimension.h ));\r\n}\r\n\r\n/**\r\n * Resize west.\r\n * @param {Point} diff\r\n */\r\nDialogBinding.prototype.resizeWest = function ( diff ) {\r\n\r\n\tthis.setPosition ( new Point ( this.startPoint.x + diff.x, this.startPoint.y ));\r\n\tthis.setDimension ( new Dimension ( this.startDimension.w - diff.x, this.startDimension.h ));\r\n\r\n}\r\n\r\n/**\r\n * Keep dialog on screen.\r\n * @param {Point} diff\r\n */\r\nDialogBinding.prototype._setComputedPosition = function ( diff ) {\r\n\r\n \tvar win = this.bindingWindow.WindowManager.getWindowDimensions ();\r\n \tvar dim = this.getDimension ();\r\n\r\n\tvar x = this.startPoint.x + diff.x;\r\n\tvar y = this.startPoint.y + diff.y;\r\n\r\n\tx = x < 0 ? 0 : x + dim.w > win.w ? win.w - dim.w : x;\r\n\ty = y < 0 ? 0 : y + dim.h > win.h ? win.h - dim.h : y;\r\n\r\n\tthis.setPosition ( new Point (  x, y ));\r\n}\r\n\r\n/**\r\n * Set position.\r\n * @param {Point} p\r\n */\r\nDialogBinding.prototype.setPosition = function ( p ) {\r\n\r\n\tvar x = p.x;\r\n\tvar y = p.y;\r\n\r\n\tx = Math.round ( x );\r\n\tthis.bindingElement.style.left = x + \"px\";\r\n\tthis.geometry.x = x;\r\n\r\n\ty = Math.round ( y );\r\n\tthis.bindingElement.style.top = y + \"px\";\r\n\tthis.geometry.y = y;\r\n\r\n}\r\n\r\n/**\r\n * Get position.\r\n * @return {Point}\r\n */\r\nDialogBinding.prototype.getPosition = function () {\r\n\r\n\treturn new Point (\r\n\t\tthis.geometry.x,\r\n\t\tthis.geometry.y\r\n\t);\r\n}\r\n\r\n/**\r\n * Set Dimension.\r\n * @param {number} w\r\n * @param {number} h\r\n */\r\nDialogBinding.prototype.setDimension = function ( dim ) {\r\n\r\n\tif ( !dim ) {\r\n\t\tSystemDebug.stack ( arguments );\r\n\t}\r\n\r\n\tvar w = dim.w;\r\n\tvar h = dim.h;\r\n\r\n\tw = Math.round ( w );\r\n\tthis.bindingElement.style.width = w + \"px\";\r\n\tthis.geometry.w = w;\r\n\th = Math.round ( h );\r\n\tthis.bindingElement.style.height = h + \"px\";\r\n\tthis.geometry.h = h;\r\n\r\n}\r\n\r\n/**\r\n * Get dimension.\r\n * @return {Dimension}\r\n */\r\nDialogBinding.prototype.getDimension = function () {\r\n\r\n\treturn new Dimension (\r\n\t\tthis.geometry.w,\r\n\t\tthis.geometry.h\r\n\t);\r\n}\r\n\r\n/**\r\n * Set resizable.\r\n * @param {boolean} isResizable\r\n */\r\nDialogBinding.prototype.setResizable = function ( isResizable ) {\r\n\r\n\tif ( this._isResizable != isResizable ) {\r\n\t\tif ( isResizable ) {\r\n\t\t\tthis.attachClassName ( \"resizable\" );\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( \"resizable\" );\r\n\t\t}\r\n\t\tthis._isResizable = isResizable;\r\n\t}\r\n}\r\n\r\n/**\r\n * Compute default geometry. This is pretty lame.\r\n * @return {object}\r\n */\r\nDialogBinding.prototype.computeDefaultGeometry = function () {\r\n\r\n\tvar result\t= null;\r\n\tvar width \t= this.bindingDocument.body.offsetWidth;\r\n\tvar height \t= this.bindingDocument.body.offsetHeight;\r\n\r\n\tresult = {\r\n\t\tx : 0.125 * width,\r\n\t\ty : 0.125 * height,\r\n\t\tw : 0.750 * width,\r\n\t\th : 0.500 * height\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * This actually centers the dialog in the containing *window*.\r\n */\r\nDialogBinding.prototype.centerOnScreen = function () {\r\n\r\n\tvar winDim = this.bindingWindow.WindowManager.getWindowDimensions ();\r\n\tvar dim = this.getDimension ();\r\n\r\n\tthis.setPosition ( new Point (\r\n\t\t\t0.5 * ( winDim.w - dim.w ),\r\n\t\t\t0.5 * ( winDim.h - dim.h )\r\n\t\t)\r\n\t)\r\n}\r\n\r\n/**\r\n * This method is invoked on modal panels by the {@link DialogCoverBinding}.\r\n */\r\nDialogBinding.prototype.alert = function () {\r\n\r\n\tvar binding = this;\r\n\tvar i = 0;\r\n\r\n\tfunction blink () {\r\n\t\tif ( i % 2 == 0 ) {\r\n\t\t\tbinding.detachClassName ( \"active\" );\r\n\t\t} else {\r\n\t\t\tbinding.attachClassName ( \"active\" );\r\n\t\t}\r\n\t\tif ( i++ < 7 ) {\r\n\t\t\tsetTimeout ( blink, 50 );\r\n\t\t}\r\n\t};\r\n\tblink ();\r\n}\r\n\r\n/**\r\n * Set dialog controls, disposing existing controls.\r\n * TODO: method not tested.\r\n * @param {List<string>} list\r\n */\r\nDialogBinding.prototype.setControls = function ( list ) {\r\n\r\n\tfor ( var type in this.controlBindings ) {\r\n\t\tthis.controlBindings [ type ].dispose ();\r\n\t}\r\n\tvar controls = \"\";\r\n\twhile ( list.hasNext ()) {\r\n\t\tvar type = list.getNext ();\r\n\t\tcontrols += type + list.hasNext () ? \" \" : \"\";\r\n\t}\r\n\tthis.setProperty ( \"controls\", controls );\r\n\r\n\tif ( this.isAttached ) {\r\n\t\tthis.buildControlBindings ();\r\n\t}\r\n}\r\n\r\n/**\r\n * DialogBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DialogBinding}\r\n */\r\nDialogBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:dialog\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DialogBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogBodyBinding.js",
    "content": "DialogBodyBinding.prototype = new FlexBoxBinding;\r\nDialogBodyBinding.prototype.constructor = DialogBodyBinding;\r\nDialogBodyBinding.superclass = FlexBoxBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DialogBodyBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogBodyBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {DialogBinding}\r\n\t */\r\n\tthis.panelBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = true;\r\n\t\r\n\t/**\r\n\t * @type {DialogBinding}\r\n\t */\r\n\tthis._dialogBinding = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogBodyBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogBodyBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nDialogBodyBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDialogBodyBinding.superclass.onBindingAttach.call ( this );\r\n\tthis._dialogBinding = UserInterface.getBinding ( this.bindingElement.parentNode );\r\n}\r\n\r\n/**\r\n * Get position as requested by the {@link ViewBinding} \r\n * compensating for dialog border dimensions.\r\n * @return {Dimension}\r\n */\r\nDialogBodyBinding.prototype.getPosition = function () {\r\n\t\r\n\tvar pos = this._dialogBinding.getPosition ();\r\n\t\r\n\treturn new Position ( \r\n\t\tpos.x + this.offsetLeft + DialogBorderBinding.DIMENSION,\r\n\t\tpos.y + this.offsetTop\r\n\t);\r\n}\r\n\r\n/**\r\n * Get dimension as requested by the {@link ViewBinding} \r\n * compensating for dialog border dimensions.\r\n * @return {Dimension}\r\n */\r\nDialogBodyBinding.prototype.getDimension = function () {\r\n\r\n\tvar dim = this.boxObject.getDimension ();\r\n\t\r\n\treturn new Dimension (\r\n\t\tdim.w - 2 * DialogBorderBinding.DIMENSION,\r\n\t\tdim.h - DialogBorderBinding.DIMENSION\r\n\t);\r\n}\r\n\r\n/**\r\n * DialogBodyBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DialogBodyBinding}\r\n */\r\nDialogBodyBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:dialogbody\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DialogBodyBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogBorderBinding.js",
    "content": "DialogBorderBinding.prototype = new Binding;\r\nDialogBorderBinding.prototype.constructor = DialogBorderBinding;\r\nDialogBorderBinding.superclass = Binding.prototype;\r\n\r\nDialogBorderBinding.TYPE_NORTH\t= \"n\";\r\nDialogBorderBinding.TYPE_SOUTH \t= \"s\";\r\nDialogBorderBinding.TYPE_EAST \t= \"e\";\r\nDialogBorderBinding.TYPE_WEST \t= \"w\";\r\nDialogBorderBinding.DIMENSION \t= 4;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DialogBorderBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogBorderBinding\" );\r\n\t\r\n\t/**\r\n\t * Overwrites super property.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDraggable = true;\r\n\t\r\n\t/**\r\n\t * This property is set by the containing {@link DialogBinding}.\r\n\t * @type {string}\r\n\t * @private\r\n\t */\r\n\tthis._type = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogBorderBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogBorderBinding]\";\r\n}\r\n\r\n/**\r\n * @param {string} type\r\n */\r\nDialogBorderBinding.prototype.setType = function ( type ) {\r\n \r\n\tthis.attachClassName ( type );\r\n\tthis._type = type;\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nDialogBorderBinding.prototype.getType = function () {\r\n\r\n\treturn this._type;\r\n}\r\n\r\n/**\r\n * DialogBorderBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DialogBorderBinding}\r\n */\r\nDialogBorderBinding.newInstance = function ( ownerDocument ) {\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:dialogborder\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DialogBorderBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogControlBinding.js",
    "content": "DialogControlBinding.prototype = new ControlBinding;\r\nDialogControlBinding.prototype.constructor = DialogControlBinding;\r\nDialogControlBinding.superclass = ControlBinding.prototype;\r\n\r\nDialogControlBinding.CLASSNAME = \"dialogcontrol\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DialogControlBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogControlBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isGhostable = true;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogControlBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogControlBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nDialogControlBinding.prototype.onBindingRegister = function () {\r\n\r\n\tDialogControlBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.attachClassName ( DialogControlBinding.CLASSNAME );\r\n}\r\n\r\n/**\r\n * ControlBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DialogControlBinding}\r\n */\r\nDialogControlBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:control\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DialogControlBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogCoverBinding.js",
    "content": "DialogCoverBinding.prototype = new Binding;\r\nDialogCoverBinding.prototype.constructor = DialogCoverBinding;\r\nDialogCoverBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DialogCoverBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogCoverBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {DialogBinding}\r\n\t */\r\n\tthis._dialogBinding = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogCoverBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogCoverBinding]\";\r\n}\r\n\r\n/**\r\n * @param {DialogBinding} panelBinding\r\n */ \r\nDialogCoverBinding.prototype.cover = function ( dialogBinding ) {\r\n\t\r\n\tthis._dialogBinding = dialogBinding;\r\n\tthis._dialogBinding.addActionListener ( DialogBinding.ACTION_OPEN, this );\r\n\tthis._dialogBinding.addActionListener ( DialogBinding.ACTION_CLOSE, this );\r\n\tthis._dialogBinding.addActionListener ( Binding.ACTION_MOVEDONTOP, this );\r\n\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nDialogCoverBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tDialogCoverBinding.superclass.handleEvent.call ( this, e );\r\n\tthis._dialogBinding.alert ();\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nDialogCoverBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tDialogCoverBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\t/* \r\n\t * Don't consume - StageDialogSetBinding is listening!\r\n\t */\r\n\tif ( this._dialogBinding.isModal ) {\r\n\t\tswitch ( action.type ) {\r\n\t\t\tcase DialogBinding.ACTION_OPEN :\r\n\t\t\t\tthis.show ();\r\n\t\t\t\tbreak;\r\n\t\t\tcase DialogBinding.ACTION_CLOSE :\r\n\t\t\t\tthis.hide ();\r\n\t\t\t\tbreak;\r\n\t\t\tcase Binding.ACTION_MOVEDONTOP :\r\n\t\t\t\tif ( binding == this._dialogBinding ) {\r\n\t\t\t\t\tthis.bindingElement.style.zIndex = new String ( \r\n\t\t\t\t\t\tbinding.getZIndex () - 1 \r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListner}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nDialogCoverBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tDialogCoverBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST :\r\n\t\t\tthis._max ()\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Span entire screen estate.\r\n */\r\nDialogCoverBinding.prototype._max = function () {\r\n\t\r\n\tvar dim = this.bindingWindow.WindowManager.getWindowDimensions ();\r\n\tthis.bindingElement.style.width = dim.w + \"px\";\r\n\tthis.bindingElement.style.height = dim.h + \"px\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#show}\r\n */\r\nDialogCoverBinding.prototype.show = function () {\r\n\t\r\n\tthis._max ();\r\n\t\r\n\tvar broadcast = this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST;\r\n\tthis.subscribe ( broadcast );\r\n\tDialogCoverBinding.superclass.show.call ( this );\r\n}\r\n\r\n/**\r\n * @overloads {Binding#hide}\r\n */\r\nDialogCoverBinding.prototype.hide = function () {\r\n\t\r\n\tvar broadcast = this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST;\r\n\tthis.unsubscribe ( broadcast );\r\n\tDialogCoverBinding.superclass.hide.call ( this );\r\n}\r\n\r\n\r\n/**\r\n * DialogCoverBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DialogCoverBinding}\r\n */\r\nDialogCoverBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:dialogcover\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DialogCoverBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogHeadBinding.js",
    "content": "DialogHeadBinding.prototype = new Binding;\r\nDialogHeadBinding.prototype.constructor = DialogHeadBinding;\r\nDialogHeadBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DialogHeadBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogHeadBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogHeadBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogHeadBinding]\";\r\n}\r\n\r\n/**\r\n * DialogHeadBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DialogHeadBinding}\r\n */\r\nDialogHeadBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:dialoghead\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DialogHeadBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogSetBinding.js",
    "content": "DialogSetBinding.prototype = new Binding;\r\nDialogSetBinding.prototype.constructor = DialogSetBinding;\r\nDialogSetBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DialogSetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogSetBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogSetBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogSetBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nDialogSetBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tDialogSetBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.addActionListener ( Binding.ACTION_MOVETOTOP, this );\r\n\tthis.addActionListener ( Binding.ACTION_MOVEDONTOP, this );\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nDialogSetBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tDialogSetBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\t\tcase Binding.ACTION_MOVETOTOP :\r\n\t\t\tif ( binding instanceof DialogBinding ) {\r\n\t\t\t\tthis._moveToTop ( binding );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase Binding.ACTION_MOVEDONTOP :\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Move dialog to highest z-index. Increment index by three so that the \r\n * {@link DialogCoverBinding} can fit the slot between two dialogs.\r\n * @param {DialogBinding} binding\r\n */\r\nDialogSetBinding.prototype._moveToTop = function ( binding ) {\r\n\t\r\n\tvar maxIndex = 0;\r\n\tvar dialogs = this.getChildBindingsByLocalName ( \"dialog\" );\r\n\t\r\n\tdialogs.each ( function ( dialog ) {\r\n\t\tvar index = dialog.getZIndex ();\r\n\t\tmaxIndex = index > maxIndex ? index : maxIndex;\r\n\t});\r\n\t\r\n\tbinding.setZIndex ( maxIndex + 2 );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogTitleBarBinding.js",
    "content": "DialogTitleBarBinding.prototype = new Binding;\r\nDialogTitleBarBinding.prototype.constructor = DialogTitleBarBinding;\r\nDialogTitleBarBinding.superclass = Binding.prototype;\r\n\r\nfunction DialogTitleBarBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogTitleBarBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {TitleBarBodyBinding}\r\n\t */\r\n\tthis.bodyBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {LabelBinding}\r\n\t */\r\n\tthis.labelBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {ControlGroupBinding}\r\n\t */\r\n\tthis._controlGroupBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDraggable = true;\r\n}\r\n\r\nDialogTitleBarBinding.prototype.toString = function () {\r\n\treturn \"[DialogTitleBarBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingRegister}\r\n */\r\nDialogTitleBarBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tDialogTitleBarBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.bodyBinding = this.add (\r\n\t\tDialogTitleBarBodyBinding.newInstance ( this.bindingDocument )\r\n\t);\r\n\tthis.labelBinding = this.bodyBinding.add (\r\n\t\tLabelBinding.newInstance ( this.bindingDocument )\r\n\t);\r\n\tthis.labelBinding.attachClassName ( \"dialogtitle\" );\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nDialogTitleBarBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDialogTitleBarBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tvar image = this.getProperty ( \"image\" );\r\n\tif ( image ) {\r\n\t\tthis.setImage ( image );\r\n\t}\r\n\tvar label = this.getProperty ( \"label\" );\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nDialogTitleBarBinding.prototype.setLabel = function ( label ) {\r\n\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setLabel ( label ) \r\n\t};\r\n\tthis.setProperty ( \"label\", label );\r\n}\r\n\r\n/**\r\n * Set image.\r\n * @param {string} url\r\n */\r\nDialogTitleBarBinding.prototype.setImage = function ( url ) {\r\n\r\n\tthis.labelBinding.setImage ( url ) \r\n\tthis.setProperty ( \"image\", url );\r\n}\r\n\r\n/**\r\n * Add control.\r\n * @param {ControlBinding} controlBinding\r\n */\r\nDialogTitleBarBinding.prototype.addControl = function ( controlBinding ) {\r\n\r\n\tif ( !this._controlGroupBinding ) {\r\n\t\tthis._controlGroupBinding = this.bodyBinding.addFirst (\r\n\t\t\tControlGroupBinding.newInstance ( this.bindingDocument ) \r\n\t\t);\r\n\t}\r\n\tthis._controlGroupBinding.add ( controlBinding );\r\n}\r\n\r\n/**\r\n * Invoked by the DialogBinding on activation.\r\n */\r\nDialogTitleBarBinding.prototype.onActivate = function () {\r\n\t\r\n\tif ( this._controlGroupBinding ) {\r\n\t\tthis._controlGroupBinding.onActivate ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked by the DialogBinding on deactivation.\r\n */\r\nDialogTitleBarBinding.prototype.onDeactivate = function () {\r\n\t\r\n\tif ( this._controlGroupBinding ) {\r\n\t\tthis._controlGroupBinding.onDeactivate ();\r\n\t}\r\n}\r\n\r\n/**\r\n * DialogTitleBarBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {MYBinding}\r\n */\r\nDialogTitleBarBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:titlebar\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DialogTitleBarBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogTitleBarBodyBinding.js",
    "content": "DialogTitleBarBodyBinding.prototype = new Binding;\r\nDialogTitleBarBodyBinding.prototype.constructor = DialogTitleBarBodyBinding;\r\nDialogTitleBarBodyBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DialogTitleBarBodyBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogTitleBarBodyBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogTitleBarBodyBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogTitleBarBodyBinding]\";\r\n}\r\n\r\n/**\r\n * Attach clear-float classname.\r\n */\r\nDialogTitleBarBodyBinding.prototype.onBindingRegister = function () {\r\n\r\n\tDialogTitleBarBodyBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.attachClassName ( Binding.CLASSNAME_CLEARFLOAT );\r\n}\r\n\r\n\r\n/**\r\n * DialogTitleBarBodyBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DialogTitleBarBodyBinding}\r\n */\r\nDialogTitleBarBodyBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:titlebarbody\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DialogTitleBarBodyBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/dialogs/DialogTitleBarPopupBinding.js",
    "content": "DialogTitleBarPopupBinding.prototype = new PopupBinding;\r\nDialogTitleBarPopupBinding.prototype.constructor = DialogTitleBarPopupBinding;\r\nDialogTitleBarPopupBinding.superclass = PopupBinding.prototype;\r\n\r\nDialogTitleBarPopupBinding.CMD_RESTORE \t\t\t= \"restore\";\r\nDialogTitleBarPopupBinding.CMD_MINIMIZE \t\t= \"minimize\";\r\nDialogTitleBarPopupBinding.CMD_MAXIMIZE \t\t= \"maximize\";\r\nDialogTitleBarPopupBinding.CMD_REFRESH \t\t\t= \"refreshview\";\r\nDialogTitleBarPopupBinding.CMD_CLOSE \t\t\t= \"closedialog\";\r\nDialogTitleBarPopupBinding.CMD_VIEWSOURCE \t\t= \"viewsource\";\r\nDialogTitleBarPopupBinding.CMD_VIEWGENERATED \t= \"viewgenerated\";\r\nDialogTitleBarPopupBinding.CMD_VIEWSERIALIZED\t= \"viewserialized\";\r\n\r\nfunction DialogTitleBarPopupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogTitleBarPopupBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogTitleBarPopupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogTitleBarPopupBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PopupBinding#onBindingAttach}\r\n */\r\nDialogTitleBarPopupBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tDialogTitleBarPopupBinding.superclass.onBindingAttach.call ( this );\r\n\tthis._indexMenuContent ();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/docks/DockBinding.js",
    "content": "DockBinding.prototype = new TabBoxBinding;\r\nDockBinding.prototype.constructor = DockBinding;\r\nDockBinding.superclass = TabBoxBinding.prototype;\r\n\r\nDockBinding.START\t\t\t\t\t= \"start\";\r\nDockBinding.EXTERNAL                = \"external\";\r\nDockBinding.EXPLORER\t\t\t\t= \"explorer\";\r\nDockBinding.MAIN\t\t\t\t\t= \"main\";\r\nDockBinding.BOTTOMLEFT\t\t\t\t= \"bottomleft\";\r\nDockBinding.BOTTOMRIGHT\t\t\t\t= \"bottomright\";\r\nDockBinding.RIGHTTOP\t\t\t\t= \"righttop\";\r\nDockBinding.RIGHTBOTTOM\t\t\t\t= \"rightbottom\";\r\nDockBinding.ABSBOTTOMLEFT\t\t\t= \"absbottomleft\";\r\nDockBinding.ABSBOTTOMRIGHT\t\t\t= \"absbottomright\";\r\nDockBinding.ABSRIGHTTOP\t\t\t\t= \"absrighttop\";\r\nDockBinding.ABSRIGHTBOTTOM\t\t\t= \"absrightbottom\";\r\nDockBinding.SLIDE\t\t\t\t\t= \"slide\";\r\n\r\nDockBinding.TYPE_START\t\t\t\t= \"start\";\r\nDockBinding.TYPE_EXPLORER\t\t\t= \"explorer\";\r\nDockBinding.TYPE_EDITORS\t\t\t= \"editors\";\r\nDockBinding.TYPE_TOOLS\t\t\t\t= \"tools\";\r\n\r\nDockBinding.ACTION_OPENED\t\t\t= \"dockopened\";\r\nDockBinding.ACTION_EMPTIED \t\t\t= \"dockemptied\";\r\n\r\nDockBinding.CLASSNAME_ACTIVE \t\t= \"active\";\r\n\r\n\r\n/**\r\n * @class\r\n * @implements {IActivatable}\r\n */\r\nfunction DockBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DockBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActive = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivatable = true;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.reference = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isCollapsed = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEmpty = true;\r\n\t\r\n\t/**\r\n\t * @type {StageSplitPanelBinding}\r\n\t */\r\n\tthis._containingSplitPanelBinding = null;\r\n\t\r\n\t/**\r\n\t * List of all open views associated to this dock. \r\n\t * Chages must be synched with {@link DialogStageBinding}\r\n\t * @type {List<ViewBinding>}\r\n\t */\r\n\tthis._viewBindingList = null;\r\n\t\r\n\t/**\r\n\t * Associates the deck to the selected perspective (area). \r\n\t * This property is set by the {@link StageDeckBinding}.\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.perspectiveNode = null;\r\n\t\r\n\t/*\r\n\t * Overwrite TabBoxBinding element names.\r\n\t */\r\n\tthis._nodename_tab = \"docktab\";\r\n\tthis._nodename_tabs = \"docktabs\";\r\n\tthis._nodename_tabpanel = \"dockpanel\";\r\n\tthis._nodename_tabpanels = \"dockpanels\";\r\n\t\r\n\t/*\r\n\t * Overwrite TabBoxBinding binding implementations.\r\n\t */\r\n\tthis._impl_tab = DockTabBinding;\r\n\tthis._impl_tabs = DockTabsBinding;\r\n\tthis._impl_tabpanel = DockPanelBinding;\r\n\tthis._impl_tabpanels = DockPanelsBinding;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDockBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DockBinding]\";\r\n}\r\n\r\n/**\r\n * Serialize binding.\r\n * @return {HashMap<string><object>}\r\n */\r\nDockBinding.prototype.serialize = function () {\r\n\t\r\n\tvar result = DockBinding.superclass.serialize.call ( this );\r\n\tif ( result ) {\r\n\t\tresult.active = this.isActive ? true : null;\r\n\t\tresult.collapsed = this.isCollapsed ? true : null;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @overloads {TabBoxBinding#onBindingRegsister}\r\n */\r\nDockBinding.prototype.onBindingRegister = function () {\r\n\r\n\tDockBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( Binding.ACTION_ACTIVATED, this );\r\n\tthis.addActionListener ( TabBoxBinding.ACTION_UPDATED, this );\r\n\tthis.addActionListener ( ViewBinding.ACTION_LOADED );\r\n\tthis.addActionListener ( ViewBinding.ACTION_CLOSED )\r\n\t\r\n\r\n\t\r\n\tthis._viewBindingList = new List ();\r\n\t\r\n\tthis.reference = this.getProperty(\"reference\");\r\n\r\n\tif (this.reference == DockBinding.MAIN) {\r\n\t\tthis.subscribe(BroadcastMessages.SYSTEMTREENODEBINDING_FOCUS);\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {TabBoxBinding#onBindingAttach}\r\n */\r\nDockBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDockBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis._containingSplitPanelBinding = this.getAncestorBindingByLocalName ( \"splitpanel\" );\r\n\t\r\n\tif ( this.getTabBindings ().hasEntries ()) {\r\n\t\tthis.isEmpty = false;\r\n\t\tthis.isActivatable = true;\r\n\t} else {\r\n\t\tthis.dispatchAction ( DockBinding.ACTION_EMPTIED );\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide editorsdock dockcontrols.\r\n * @overloads {TabBoxBinding#onMembersAttached}\r\n *\r\nDockBinding.prototype.onMembersAttached = function () {\r\n\r\n\tDockBinding.superclass.onMembersAttached.call ( this );\r\n\tif ( this.type == DockBinding.TYPE_EDITORS ) {\r\n\t\tthis.showControls ( false );\r\n\t}\r\n}\r\n*/\r\n\r\n/**\r\n * A graphic accessory element is appended to the *parentnode* of the dock element.\r\n * Notice that this method overwrites the super method (no need for docktabs below).\r\n * @overwrites {TabBoxBinding#buildDOMContent}\r\n */\r\nDockBinding.prototype.buildDOMContent = function () {\r\n\t\r\n\tvar type = this.getProperty ( \"type\" );\r\n\tthis.type = type ? type : DockBinding.TYPE_TOOLS;;\r\n\tthis.attachClassName ( this.type );\r\n\tif ( this.getProperty ( \"active\" ) == true ) {\r\n\t\tthis.activate ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Lots of stuff can affect the apparent visibility of docks. But since \r\n * the {@link ViewBinding} is not contained within the dock (it floats in a \r\n * separate layber above everything else} you should always call this method \r\n * to make sure that it gets properly notified of visibility changes.\r\n * TODO: Consider deprecating this in favour of traditional action system.\r\n * @param {boolean} Should be set to true if the dock is now visible.\r\n */\r\nDockBinding.prototype.interceptDisplayChange = function ( wasDisplayed ) {\r\n\t\r\n\tvar dockPanelBinding = this.getSelectedTabPanelBinding ();\r\n\tif ( dockPanelBinding ) {\r\n\t\tdockPanelBinding.isVisible = wasDisplayed;\r\n\t\tdockPanelBinding.dispatchAction ( \r\n\t\t\tBinding.ACTION_VISIBILITYCHANGED\r\n\t\t);\r\n\t\t\r\n\t\t//dockPanelBinding.updateVisibility ( wasDisplayed );\r\n\t}\r\n}\r\n\r\n/**\r\n * Prepare new view.\r\n * @param {ViewDefinition} definition\r\n * @return DockTabBinding\r\n */\r\nDockBinding.prototype.prepareNewView = function ( definition ) {\r\n\t\r\n\t// reate and append ViewBinding. \r\n\tvar viewBinding = this._getBindingForDefinition ( definition );\r\n\t\r\n\t// create and append DockTabBinding.\r\n\t// notice setup with tab label\r\n\tvar tabBinding = DockTabBinding.newInstance ( this.bindingDocument );\r\n\ttabBinding.setHandle ( definition.handle );\r\n\ttabBinding.setLabel( definition.flowHandle ? null : definition.label);\r\n\ttabBinding.setImage ( definition.image );\r\n\ttabBinding.setToolTip ( definition.toolTip );\r\n\ttabBinding.setEntityToken ( definition.entityToken );\r\n\ttabBinding.setAssociatedView ( viewBinding );\r\n\tif (definition.isPinned) {\r\n\t\ttabBinding.setProperty(\"pinned\", true);\r\n\t}\r\n\tif (Application.isTestEnvironment) {\r\n\t\ttabBinding.setProperty(\"data-qa\", definition.entityToken);\r\n\t}\r\n\tthis.appendTabByBindings ( tabBinding, null );\r\n\t\r\n\t// listen for dirty events and loaded pages\r\n\tthis._setupPageBindingListeners ( tabBinding );\r\n\t\r\n\t// snap view to tabpanel position\r\n\tvar tabPanelBinding = this.getTabPanelBinding ( tabBinding );\r\n\tviewBinding.snapToBinding ( tabPanelBinding, definition.isFloating );\r\n\t\r\n\t// TODO: construct a viewset binding for hosting this fellow?\r\n\t/*\r\n\tvar bodyBinding = UserInterface.getBinding ( this.bindingDocument.body );\r\n\tbodyBinding.add ( viewBinding );\r\n\t*/\r\n\tvar viewset = this.bindingWindow.bindingMap.views;\r\n\tviewset.add ( viewBinding );\r\n\t\r\n\tif ( !this.isActive ) {\r\n\t\tthis.activate ();\r\n\t}\r\n\t\r\n\t/*\r\n\t * Odd fact: if this is done on a timeout, mozilla will \r\n\t * summon a bug that hides the dock after a few seconds.\r\n\t */\r\n\tviewBinding.attach();\r\n\r\n\treturn tabBinding;\r\n}\r\n\r\n/**\r\n * Prepare open ViewBinding.\r\n * TODO: _setupDirtyStuff???? (only if open views contains editors!)\r\n * @param {ViewDefinition} definition\r\n * @param {DockTabBinding} tabBinding\r\n */\r\nDockBinding.prototype.prepareOpenView = function ( definition, tabBinding ) {\r\n\t\r\n\tthis.logger.debug ( \"DockBinding.prototype.prepareOpenView: _setupDirtyStuff required?\" );\r\n\t\r\n\t// initially, set tab appearance from definition\r\n\ttabBinding.setLabel ( definition.label );\r\n\ttabBinding.setImage ( definition.image );\r\n\ttabBinding.setToolTip ( definition.toolTip );\r\n\t\r\n\t// secondly, setup tab to grab appearance from loaded page\r\n\tthis._setupPageBindingListeners ( tabBinding );\r\n\t\r\n\tvar tabPanelBinding = this.getTabPanelBinding ( tabBinding );\r\n\tvar viewBinding = this._getBindingForDefinition ( definition );\r\n\ttabBinding.setAssociatedView ( viewBinding );\r\n\t\r\n\tviewBinding.snapToBinding(tabPanelBinding, definition.isFloating);\r\n\tUserInterface.getBinding ( this.bindingDocument.body ).add ( viewBinding );\r\n\tviewBinding.attach ();\r\n\t\r\n}\r\n\r\n/**\r\n * Create ViewBinding to match ViewDefinition.\r\n * @param {ViewDefinition} definition\r\n * @return {ViewBinding}\r\n */\r\nDockBinding.prototype._getBindingForDefinition = function ( definition ) {\r\n\t\r\n\tvar viewset = this.bindingWindow.bindingMap.views;\r\n\tvar view = ViewBinding.newInstance ( viewset.bindingDocument ); // this.bindingDocument \r\n\tview.setDefinition ( definition );\r\n\t\r\n\treturn view;\t\r\n}\r\n\r\n/**\r\n * Attach actionlisteners to the tabpanel associated to a given tab.\r\n * @param {DockTabBinding} tabBinding\r\n */\r\nDockBinding.prototype._setupPageBindingListeners = function ( tabBinding ) {\r\n\t\r\n\tvar tabPanelBinding = this.getTabPanelBinding ( tabBinding );\r\n\t\r\n\tvar self = this;\r\n\t\r\n\t/*\r\n\t * Declare action handler for tabBinding.\r\n\t */\r\n\tvar handler = {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\r\n\t\t\tvar binding = action.target;\r\n\t\t\r\n\t\t\tswitch ( action.type ) {\r\n\t\t\t\t\r\n\t\t\t\tcase PageBinding.ACTION_ATTACHED :\r\n\t\t\t\t\tTabBoxBinding.currentActiveInstance = self;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t\tcase PageBinding.ACTION_INITIALIZED :\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Page reflex phase starts here!\r\n\t\t\t\t\t */\r\n\t\t\t\t\tbinding.reflex ( true );\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Page label and image transferred to docktab. Notice the \r\n\t\t\t\t\t * Eventbroadcaster transmission! For dialogs, this gets\r\n\t\t\t\t\t * broadcasted by this StageDialogBinding.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tvar view = tabBinding.getAssociatedView ();\r\n\t\t\t\t\tif ( binding.bindingWindow == view.getContentWindow ()) {\r\n\t\t\t\t\t\ttabBinding.updateDisplay ( binding );\r\n\t\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.VIEW_COMPLETED, view.getHandle ());\r\n\t\t\t\t\t\tif ( StatusBar.state == StatusBar.BUSY ) {\r\n\t\t\t\t\t\t\tStatusBar.clear ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Final stuff handled by the docktab.\r\n\t\t\t\t\t */\r\n\t\t\t\t\ttabBinding.onPageInitialize ( binding );\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase PageBinding.ACTION_UPDATED:\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* Page label and image transferred to docktab. Notice the \r\n\t\t\t\t\t* Eventbroadcaster transmission! For dialogs, this gets\r\n\t\t\t\t\t* broadcasted by this StageDialogBinding.\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tvar view = tabBinding.getAssociatedView();\r\n\t\t\t\t\tif (binding.bindingWindow == view.getContentWindow()) {\r\n\t\t\t\t\t\ttabBinding.updateDisplay(binding);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase DockTabBinding.ACTION_UPDATE_VISUAL :\r\n\t\t\t\t\ttabBinding.updateDisplay ( binding );\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase DockTabBinding.ACTION_UPDATE_TOKEN :\r\n\t\t\t\t\ttabBinding.updateEntityToken ( binding );\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase EditorPageBinding.ACTION_DIRTY :\r\n\t\t\t\t\ttabBinding.setDirty ( true );\r\n\t\t\t\t\t// TODO: dont consume - top app menu should listen here!\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase EditorPageBinding.ACTION_SAVE:\r\n\t\t\t\tcase EditorPageBinding.ACTION_SAVE_AND_PUBLISH:\r\n\t\t\t\t\ttabBinding.onSaveStart ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase ViewBinding.ACTION_ONCLOSE :\r\n\t\t\t\t\tself.closeTab ( tabBinding );\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase ViewBinding.ACTION_ONCLOSE_FORCE :\r\n\t\t\t\t\tself.closeTab ( tabBinding, true );\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase DockPanelBinding.ACTION_FORCE_SELECT :\r\n\t\t\t\t\tself.select ( tabBinding );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase Binding.ACTION_FORCE_REFLEX :\r\n\t\t\t\t\ttabPanelBinding.reflex ( true );\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase DockTabBinding.ACTION_FORCE_CLEAN :\r\n\t\t\t\tcase EditorPageBinding.ACTION_CLEAN :\r\n\t\t\t\t\tif ( tabBinding.isDirty ) {\r\n\t\t\t\t\t\ttabBinding.setDirty ( false );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase WindowBinding.ACTION_ONLOAD :\r\n\t\t\t\t\talert ( \"HWEJ\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\t/*\r\n\t * Attach action listeners to tabBinding.\r\n\t */\r\n\tnew List ([\r\n\t           DockTabBinding.ACTION_UPDATE_VISUAL,\r\n\t           DockTabBinding.ACTION_UPDATE_TOKEN,\r\n\t           PageBinding.ACTION_ATTACHED,\r\n\t           PageBinding.ACTION_INITIALIZED,\r\n\t           PageBinding.ACTION_UPDATED,\r\n\t           EditorPageBinding.ACTION_DIRTY,\r\n\t           EditorPageBinding.ACTION_CLEAN,\r\n\t           EditorPageBinding.ACTION_SAVE,\r\n               EditorPageBinding.ACTION_SAVE_AND_PUBLISH,\r\n\t           ViewBinding.ACTION_ONCLOSE,\r\n\t           ViewBinding.ACTION_ONCLOSE_FORCE,\r\n\t           DockPanelBinding.ACTION_FORCE_SELECT,\r\n\t           Binding.ACTION_FORCE_REFLEX,\r\n\t           DockTabBinding.ACTION_FORCE_CLEAN,\r\n\t           WindowBinding.ACTION_ONLOAD\r\n\t]).each ( \r\n\t\tfunction ( action ) {\r\n\t\t\ttabPanelBinding.addActionListener ( action, handler );\r\n\t\t}\r\n\t);\r\n}\r\n\r\n/** \r\n * Creates a new DockTabBinding instance.\r\n * @overwrites {TabBoxBinding#summonTabBinding}\r\n * @return {DockTabBinding}\r\n *\r\nDockBinding.prototype.summonTabBinding = function () {\r\n\t\r\n\treturn DockTabBinding.newInstance ( this.bindingDocument );\r\n}\r\n*/\r\n\r\n/**\r\n * Creates a new DockPanelBinding instance.\r\n * @overwrites {TabBoxBinding#summonTabPanelBinding}\r\n * @return {DockPanelBinding}\r\n */\r\nDockBinding.prototype.summonTabPanelBinding = function () {\r\n\t\r\n\treturn DockPanelBinding.newInstance ( this.bindingDocument );\r\n}\r\n\r\n/**\r\n * @overloads {TabBoxBinding#handleAction}\r\n * @param {Action} action \r\n */\r\nDockBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tDockBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\t\t\r\n\t\tcase Binding.ACTION_ACTIVATED :\r\n\t\t\tif ( !this.isActive ) {\r\n\t\t\t\tthis.activate ();\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase TabBoxBinding.ACTION_UPDATED :\r\n\t\t\tif ( binding instanceof DockBinding ) {\r\n\t\t\t\tif ( binding.updateType == TabBoxBinding.UPDATE_DETACH ) {\r\n\t\t\t\t\tif ( !this.getTabElements ().hasEntries ()) {\r\n\t\t\t\t\t\tthis.isEmpty = true;\r\n\t\t\t\t\t\tthis.isActivatable = false;\r\n\t\t\t\t\t\tif ( this.isActive == true ) {\r\n\t\t\t\t\t\t\tthis.deActivate ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.dispatchAction ( DockBinding.ACTION_EMPTIED );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// dont consume\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase ViewBinding.ACTION_LOADED :\r\n\t\t\tthis._viewBindingList.add ( binding );\r\n\t\t\tif ( this.isActive ) {\r\n\t\t\t\tbinding.onActivate ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase ViewBinding.ACTION_CLOSED :\r\n\t\t\tthis._viewBindingList.del ( binding );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nDockBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tDockBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.SYSTEMTREENODEBINDING_FOCUS :\r\n\t\t\tvar treenode = arg;\r\n\t\t\tif (arg == this.perspectiveNode) {\r\n\t\t\t\tthis._highlightTabByEntityToken()\r\n\t\t\t} else if (treenode.perspectiveNode && treenode.perspectiveNode == this.perspectiveNode ) {\r\n\t\t\t\tthis._highlightTabByEntityToken(treenode.node.getEntityToken());\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Find a tab with a given entityToken and highlight it.\r\n * @param {string} entityToken\r\n */\r\nDockBinding.prototype._highlightTabByEntityToken = function (entityToken) {\r\n\r\n\tvar tabs = this.getTabBindings();\r\n\twhile (tabs.hasNext()){\r\n\t\tvar tab = tabs.getNext();\r\n\t\tvar token = tab.getEntityToken();\r\n\t\tif (entityToken && token != null && token == entityToken) {\r\n\t\t\ttab.highlight(true);\r\n\t\t} else {\r\n\t\t\ttab.highlight(false);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Find a tab with a given view and select it.\r\n * @param {ViewBinding} view\r\n */\r\nDockBinding.prototype._selectTabByView = function ( view ) {\r\n\t\r\n\tvar tabs = this.getTabBindings (); \r\n\tvar hasSelected = false;\r\n\t\r\n\twhile ( tabs.hasNext () && !hasSelected ) {\r\n\t\tvar tab = tabs.getNext ();\r\n\t\tvar associatedView = tab.getAssociatedView();\r\n\t\tif (associatedView != null && associatedView == view) {\r\n\t\t\tif ( !tab.isSelected ) {\r\n\t\t\t\tthis.select ( tab, true );\r\n\t\t\t}\r\n\t\t\thasSelected = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Collapse tabpanels. Invoked by the {@link StageSplitPanelBinding}\r\n * @param {boolean} isHorizontal\r\n */\r\nDockBinding.prototype.collapse = function ( isHorizontal ) {\r\n\t\r\n\tthis._handleCollapse ( true, isHorizontal );\r\n}\r\n\r\n/**\r\n * Uncollapse tabpanels. Invoked by the {@link StageSplitPanelBinding}\r\n */\r\nDockBinding.prototype.unCollapse = function ( isHorizontal ) {\r\n\t\r\n\tthis._handleCollapse ( false, isHorizontal );\r\n}\r\n\r\n/**\r\n * Notice that flex and activation is handled by containing @link StageSplitPanelBinding}\r\n * @param {boolean} isCollapse\r\n * @param {boolean} isHorizontal\r\n */\r\nDockBinding.prototype._handleCollapse = function ( isCollapse, isHorizontal ) {\r\n\t\r\n\tvar dockPanelsBinding = this.getChildBindingByLocalName ( \"dockpanels\" );\r\n\tvar containingSplitBoxBinding = this.getAncestorBindingByLocalName ( \"splitbox\" );\r\n\t\r\n\tif ( isCollapse ) {\r\n\t\tdockPanelsBinding.hide ();\r\n\t\tthis.bindingElement.style.height = \"auto\";\r\n\t\tthis.isFlexible = false;\r\n\t\tthis.isActivatable = false;\r\n\t\tthis.setProperty ( \"collapsed\", true );\r\n\t\tif ( isHorizontal && containingSplitBoxBinding.hasBothPanelsVisible ()) { /***/\r\n\t\t\tthis.setWidth ( 200 );\r\n\t\t}\r\n\t} else {\r\n\t\tdockPanelsBinding.show ();\r\n\t\tthis.isFlexible = true;\r\n\t\tthis.isActivatable = true;\r\n\t\tthis.deleteProperty ( \"collapsed\" );\r\n\t\tif ( isHorizontal ) { /***/\r\n\t\t\tthis.setWidth ( false );\r\n\t\t}\r\n\t}\r\n\tthis.interceptDisplayChange ( !isCollapse );\r\n\tthis.isCollapsed = isCollapse;\r\n}\r\n\r\n/**\r\n * Activate.\r\n * @implements {IActivatable}\r\n */\r\nDockBinding.prototype.activate = function () {\r\n\t\r\n\tif ( !this.isActive ) {\r\n\t\t\r\n\t\tthis.isActive = true;\r\n\t\tthis.attachClassName ( DockBinding.CLASSNAME_ACTIVE );\r\n\t\tthis.setProperty ( \"active\", true );\r\n\t\t\r\n\t\tif ( this._containingSplitPanelBinding ) {\r\n\t\t\tthis._containingSplitPanelBinding.isActive = true;\r\n\t\t}\r\n\t\t\r\n\t\tthis.getTabBindings ().each ( function ( tab ) {\r\n\t\t\ttab.onActivate ();\r\n\t\t});\r\n\t\t\r\n\t\tthis._viewBindingList.each ( function ( view ) {\r\n\t\t\tview.onActivate ();\r\n\t\t});\r\n\t\r\n\t\tApplication.activate ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Deactivate.\r\n * @implements {IActivatable}\r\n */\r\nDockBinding.prototype.deActivate = function () {\r\n\r\n\tif ( this.isActive == true ) {\r\n\t\r\n\t\tthis.isActive = false;\r\n\t\tthis.detachClassName ( DockBinding.CLASSNAME_ACTIVE );\r\n\t\tthis.deleteProperty ( \"active\" );\r\n\t\t\r\n\t\tif ( this._containingSplitPanelBinding ) {\r\n\t\t\tthis._containingSplitPanelBinding.isActive = false;\r\n\t\t}\r\n\t\t\r\n\t\t// this and views activation should be combined!\r\n\t\tthis.getTabBindings ().each ( function ( tab ) {\r\n\t\t\ttab.onDeactivate ();\r\n\t\t});\r\n\t\t\r\n\t\tthis._viewBindingList.each ( function ( view ) {\r\n\t\t\tview.onDeactivate ();\r\n\t\t});\r\n\t\t\r\n\t\tApplication.deActivate ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Close tab.\r\n * @param {DockTabBinding} tabBinding\r\n * @param {boolean} isForce\r\n */\r\nDockBinding.prototype.closeTab = function (tabBinding, isForce) {\r\n\tif (tabBinding.isPinned)\r\n\t\treturn;\r\n\t\r\n\tif ( tabBinding.isDirty && !isForce ) { \r\n\t\tvar resourcename = Resolver.resolve ( tabBinding.getLabel ());\r\n\t\tvar self = this;\r\n\t\tDialog.question ( \r\n\t\t\tStringBundle.getString ( \"ui\", \"WebSite.Application.DialogSaveResource.Title\" ), \r\n\t\t\tStringBundle.getString ( \"ui\", \"WebSite.Application.DialogSaveResource.Text\" ).replace ( \"${resourcename}\", resourcename ),\r\n\t\t\tDialog.BUTTONS_YES_NO_CANCEL, {\r\n\t\t\thandleDialogResponse : function ( response ) {\r\n\t\t\t\tswitch ( response ) {\r\n\t\t\t\t\tcase Dialog.RESPONSE_YES :\r\n\t\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\t\tself.saveContainedEditor ( tabBinding );\r\n\t\t\t\t\t\t}, 0 );\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase Dialog.RESPONSE_NO :\r\n\t\t\t\t\t\tself.removeTab ( tabBinding );\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t} else {\r\n\t\tthis.removeTab ( tabBinding );\r\n\t}\r\n}\r\n\r\n/**\r\n * Close tabs except.\r\n * @param {DockTabBinding} tabBinding\r\n */\r\nDockBinding.prototype.closeTabsExcept = function ( tabBinding ) {\r\n\t\r\n\tvar tabs = this.getTabBindings ();\r\n\twhile ( tabs.hasNext ()) {\r\n\t\tvar tab = tabs.getNext ();\r\n\t\tif ( tab != tabBinding ) {\r\n\t\t\tthis.closeTab ( tab );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Save editor associated to a give tab. A success will trigger tab close.\r\n * @param {DockTabBinding} tabBinding\r\n */ \r\nDockBinding.prototype.saveContainedEditor = function ( tabBinding ) {\r\n\t\r\n\tvar viewBinding = tabBinding.getAssociatedView ();\r\n\tviewBinding.saveContainedEditor ();\r\n\t\r\n\tvar self = this; \r\n\tvar handler = {\r\n\t\thandleBroadcast : function ( broadcast, arg ) {\r\n\t\t\tswitch ( broadcast ) {\r\n\t\t\t\tcase BroadcastMessages.CURRENT_SAVED :\r\n\t\t\t\t\tif ( arg.handle == viewBinding.getHandle ()) {\r\n\t\t\t\t\t\tEventBroadcaster.unsubscribe ( BroadcastMessages.CURRENT_SAVED, handler );\r\n\t\t\t\t\t\tif ( arg.isSuccess ) {\r\n\t\t\t\t\t\t\tself.removeTab ( tabBinding );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.CURRENT_SAVED, handler );\r\n}\r\n\r\n/**\r\n * @overloads {TabBoxBinding#appendTabByBindings}\r\n * @param {TabBinding} tabBinding\r\n * @param {object} tabPanelContent This can be either a Binding or a DOMElement\r\n */\r\nDockBinding.prototype.appendTabByBindings = function ( tabBinding, tabPanelContent ) {\r\n\t\r\n\tif ( this.isEmpty ) {\r\n\t\t\r\n\t\tthis.isEmpty = false;\r\n\t\tthis.isActivatable = true;\r\n\t\tthis.setWidth ( false ); // check for collapsed first?\r\n\t\tthis.dispatchAction ( DockBinding.ACTION_OPENED );\r\n\t}\r\n\tDockBinding.superclass.appendTabByBindings.call ( this, tabBinding, tabPanelContent );\r\n}\r\n\r\n/**\r\n * This is queried by the containing splitpanel when minimized\r\n * @see {StageSplitPanelBinding#minimize}\r\n * return {int}\r\n */\r\nDockBinding.prototype.getHeight = function () {\r\n\t\r\n\treturn this.bindingElement.offsetHeight;\r\n}\r\n\r\n/**\r\n * This is queried by Internet Explorer in the (@link DockTabsBinding} \r\n * in order to fix a rendering engine bug.\r\n * @see {DockTabsBinding#flex}\r\n  * return {int}\r\n */\r\nDockBinding.prototype.getWidth = function () {\r\n\t\r\n\treturn this.bindingElement.offsetWidth;\r\n}\r\n\r\n/**\r\n  * @param {int} width\r\n */\r\nDockBinding.prototype.setWidth = function ( width ) {\r\n\t\r\n\twidth = width ? width + \"px\" : \"100%\";\r\n\tthis.bindingElement.style.width = width;\r\n}\r\n\r\n/**\r\n * @overloads {Binding#show}\r\n */\r\nDockBinding.prototype.show = function () {\r\n\t\r\n\tif ( this.isVisible ) {\r\n\t\tDockBinding.superclass.show.call ( this );\r\n\t\tthis.isFlexible = true;\r\n\t\t//this.shadowTree.dockLiner.style.display = \"block\";\r\n\t}\r\n}\r\n\r\n/**\r\n * This is probably only used for the Start Dock...\r\n * @overloads {Binding#hide}\r\n */\r\nDockBinding.prototype.hide = function () {\r\n\t\r\n\tif ( !this.isVisible ) {\r\n\t\tDockBinding.superclass.hide.call ( this );\r\n\t\t//this.shadowTree.dockLiner.style.display = \"none\";\r\n\t\tthis.isFlexible = false;\r\n\t\tif ( this.isActive ) {\r\n\t\t\tthis.deActivate ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {TabBoxBinding#getBestTab}\r\n */\r\nDockBinding.prototype.getBestTab = function () {\r\n\r\n\tvar bestTabBinding = null;\r\n\tvar tabBindings = this.getTabBindings();\r\n\tvar tabsLength = tabBindings.getLength();\r\n\t\r\n\tif (tabsLength == 1) { // first tab\r\n\t\tbestTabBinding = null;\r\n\t} else { \r\n\t\tbestTabBinding = tabBindings.get(0);\r\n\t}\r\n\treturn bestTabBinding;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/docks/DockPanelBinding.js",
    "content": "DockPanelBinding.prototype = new TabPanelBinding;\r\nDockPanelBinding.prototype.constructor = DockPanelBinding;\r\nDockPanelBinding.superclass = TabPanelBinding.prototype;\r\n\r\n/*\r\n * Descendant bindings may dispatch this  \r\n * action to select the associated tab.\r\n */\r\nDockPanelBinding.ACTION_FORCE_SELECT = \"dockpanel force select\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DockPanelBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DockPanelBinding\" );\r\n\t\r\n\t/**\r\n\t * The ViewBinding currently snapped to this  \r\n\t * dockpanel. This property is set by the view. \r\n\t * @see {ViewBinding#snapToBinding}\r\n\t * @type {ViewBinding}\r\n\t */\r\n\tthis.viewBinding = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDockPanelBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DockPanelBinding]\";\r\n}\r\n\r\n/**\r\n * When closing, dispose associated view.\r\n */\r\nDockPanelBinding.prototype.onBindingDispose = function () {\r\n\r\n\tDockPanelBinding.superclass.onBindingDispose.call ( this );\r\n\tthis.dispatchAction ( Binding.ACTION_DISPOSED );\r\n}\r\n\r\n/**\r\n * @overloads {TabPanelBinding#select}.\r\n * @param {boolean} isManaged If set to true, application focus will not be updated.\r\n */\r\nDockPanelBinding.prototype.select = function ( isManaged ) {\r\n\t\r\n\tDockPanelBinding.superclass.select.call ( this, isManaged );\r\n\tthis.dispatchAction ( Binding.ACTION_VISIBILITYCHANGED );\r\n}\r\n\r\n/**\r\n * @overloads {TabPanelBinding#unselect}.\r\n */\r\nDockPanelBinding.prototype.unselect = function () {\r\n\t\r\n\tDockPanelBinding.superclass.unselect.call ( this );\r\n\tthis.dispatchAction ( Binding.ACTION_VISIBILITYCHANGED );\r\n}\r\n\r\n/**\r\n * Action dispatched to be intercepted by the {@link ViewBinding}.\r\n * @implements {IFlexible} \r\n */\r\nDockPanelBinding.prototype.flex = function () {\r\n\t\r\n\tthis.dispatchAction ( Binding.ACTION_DIMENSIONCHANGED );\r\n} \r\n\r\n\r\n/**\r\n * Handle crawler. \r\n * @implements {ICrawlerHandler}\r\n * @overloads {Binding#handleCrawler}\r\n * @param {Crawler} crawler\r\n */\r\nDockPanelBinding.prototype.handleCrawler = function ( crawler ) {\r\n\r\n\tDockPanelBinding.superclass.handleCrawler.call ( this, crawler );\r\n\t\r\n\t/*\r\n\t * Relay descending crawlers to view. The view has been rigged \r\n\t * up to return the crawler back here when it has been crawled.\r\n\t * @see {ViewBinding#handleCrawler}\r\n\t */\r\n\tif ( crawler.response == null ) {\r\n\t\tif ( crawler.type == NodeCrawler.TYPE_DESCENDING ) {\r\n\t\t\tif ( this.viewBinding != null ) {\r\n\t\t\t\tif ( crawler.id == FocusCrawler.ID ) {\r\n\t\t\t\t\tcrawler.nextNode = this.viewBinding.bindingElement;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * DockPanelBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DockPanelBinding}\r\n */\r\nDockPanelBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:dockpanel\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DockPanelBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/docks/DockPanelsBinding.js",
    "content": "DockPanelsBinding.prototype = new TabPanelsBinding;\r\nDockPanelsBinding.prototype.constructor = DockPanelsBinding;\r\nDockPanelsBinding.superclass = TabPanelsBinding.prototype;\r\n//DockPanelsBinding.NODENAME_TABBOX = \"tabbox\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DockPanelsBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DockPanelsBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = true;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDockPanelsBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DockPanelsBinding]\";\r\n}\r\n\r\n/**\r\n * DockPanelsBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DockPanelsBinding}\r\n */\r\nDockPanelsBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:dockpanels\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DockPanelsBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/docks/DockTabBinding.js",
    "content": "DockTabBinding.prototype = new TabBinding;\r\nDockTabBinding.prototype.constructor = DockTabBinding;\r\nDockTabBinding.superclass = TabBinding.prototype;\r\n\r\nDockTabBinding.ACTION_FORCE_CLEAN = \"docktab force clean\";\r\nDockTabBinding.ACTION_UPDATE_VISUAL = \"docktab update visual\";\r\nDockTabBinding.ACTION_UPDATE_TOKEN = \"docktab update token\";\r\n\r\nDockTabBinding.NODENAME_TABBOX = \"dock\";\r\n\r\nDockTabBinding.LABEL_TABLOADING = \"${string:Website.App.LabelLoading}\";\r\nDockTabBinding.LABEL_TABDEFAULT = \"${string:Website.App.LabelLoaded}\";\r\nDockTabBinding.LABEL_TABSAVED = \"${string:Website.App.LabelSaved}\";\r\nDockTabBinding.LABEL_OVERFLOWED_CLASSNAME = \"overflowed\";\r\n\r\nDockTabBinding.IMG_TABLOADING = \"${icon:loading}\";\r\nDockTabBinding.IMG_TABDEFAULT = \"${icon:default}\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DockTabBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DockTabBinding\" );\r\n\t\r\n\t/**\r\n\t * Associates the deck to the selected perspective. \r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.perspectiveNode = null;\r\n\t\r\n\t/**\r\n\t * @type {ControlGroupBinding}\r\n\t */\r\n\tthis._controlGroupBinding = null;\r\n\t\r\n\t/**\r\n\t * EXPLAIN!\r\n\t * @type {Binding}\r\n\t */\r\n\tthis._viewBinding = null;\r\n\t\r\n\t/**\r\n\t * Relevant for docks containing editors.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isPinned = false;\r\n\t\r\n\t/**\r\n\t * Flipped when DockTabs have invoked the \"manage\" routine.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isInitiallyHidden = true;\r\n\t\r\n\t/**\r\n\t * Associates the tab to a tree item.\r\n\t * @type {string}\r\n\t */\r\n\tthis._entityToken = null;\r\n\t\r\n\t/**\r\n\t * When a tree update is triggered by the tab, this flag  \r\n\t * is flipped to lock further updates for a short time. \r\n\t * @type {boolean}\r\n\t */\r\n\tthis._canUpdateTree = true;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDockTabBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DockTabBinding]\";\r\n}\r\n\r\n/**\r\n * Set contextmenu on startup.\r\n * @overloads {TabBinding#onBindingAttach}\r\n */\r\nDockTabBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tDockTabBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.subscribe ( BroadcastMessages.BIND_TOKEN_TO_VIEW );\r\n\tthis.perspectiveNode = this.containingTabBoxBinding.perspectiveNode;\r\n\tthis.addActionListener ( ControlBinding.ACTION_COMMAND, this );\r\n\tif ( this.containingTabBoxBinding.type != DockBinding.EXPLORER ) {\r\n\t\tthis.setContextMenu ( \r\n\t\t\ttop.app.bindingMap.docktabpopup \r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Set associated ViewBinding.\r\n * @param {Binding} viewBinding\r\n */\r\nDockTabBinding.prototype.setAssociatedView = function ( viewBinding ) {\r\n\r\n\tthis._viewBinding = viewBinding;\r\n}\r\n\r\n/**\r\n * Get associated ViewBinding.\r\n * @return {Binding}\r\n */\r\nDockTabBinding.prototype.getAssociatedView = function () {\r\n\t\r\n\treturn this._viewBinding;\r\n}\r\n\r\n/**\r\n * Serialize binding.\r\n * @overloads {TabBinding#serialize}\r\n * @return {HashMap<string><object>}\r\n */\r\nDockTabBinding.prototype.serialize = function () {\r\n\t\r\n\tvar result = DockTabBinding.superclass.serialize.call ( this );\r\n\tif ( result ) {\r\n\t\tresult.label = null;\r\n\t\tresult.image = null;\r\n\t\tresult.handle = this.getHandle ();\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set handle.\r\n * @param {string} handle\r\n */\r\nDockTabBinding.prototype.setHandle = function ( handle ) {\r\n\t\r\n\tthis.setProperty ( \"handle\", handle );\r\n}\r\n\r\n/**\r\n * Get handle.\r\n * @return {string}\r\n */\r\nDockTabBinding.prototype.getHandle = function () {\r\n\t\r\n\treturn this.getProperty ( \"handle\" );\r\n}\r\n\r\n/**\r\n * Set entityToken, associating the tab to a tree item.\r\n * @return\r\n */\r\nDockTabBinding.prototype.setEntityToken = function ( token ) {\r\n\t\r\n\tif ( this._entityToken == null ) {\r\n\t\tthis.subscribe ( BroadcastMessages.SYSTEMTREEBINDING_LOCKTOEDITOR );\r\n\t}\r\n\tthis._entityToken = token;\r\n\t\r\n\t/*\r\n\t * During initialization, _updateTree is invoked other places. After  \r\n\t * initialization, setting the entityToken will FORCE an _updateTree. \r\n\t */\r\n\tif ( this.isAttached ) {\r\n\t\tif ( this.isSelected ) { // hmm... and activated...\r\n\t\t\tthis._updateTree ( true ); // force by boolean arg\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get entityToken.\r\n * @return {string}\r\n */\r\nDockTabBinding.prototype.getEntityToken = function () {\r\n\t\r\n\treturn this._entityToken;\r\n}\r\n\r\n/**\r\n * @overloads {TabBinding#buildDOMContent}\r\n */\r\nDockTabBinding.prototype.buildDOMContent = function () {\r\n\r\n\tDockTabBinding.superclass.buildDOMContent.call ( this );\r\n\r\n\tif (this.getProperty(\"pinned\") != true) {\r\n\r\n\t\tthis._controlGroupBinding = this.labelBinding.add(\r\n\t\t\tControlGroupBinding.newInstance(this.bindingDocument)\r\n\t\t);\r\n\t\tvar controlBinding = DialogControlBinding.newInstance(this.bindingDocument);\r\n\t\tcontrolBinding.setControlType(ControlBinding.TYPE_CLOSE);\r\n\t\tcontrolBinding.attachClassName(\"closecontrol\");\r\n\t\tthis._controlGroupBinding.add(controlBinding);\r\n\t\tthis._controlGroupBinding.attachRecursive();\r\n\t} else {\r\n\t\tthis.isPinned = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked by actionlisteners setup in DockBinding.\r\n * @see {DockBinding#_setupPageBindingListeners}\r\n * @param {boolean} isDirty\r\n */\r\nDockTabBinding.prototype.setDirty = function ( isDirty ) {\r\n\t\r\n\tif ( this.containingTabBoxBinding.type == DockBinding.TYPE_EDITORS ) {\r\n\t\tif ( this.isDirty != isDirty ) {\r\n\t\t\tthis.isDirty = isDirty;\r\n\t\t\tif ( Binding.exists ( this.labelBinding )) { // happens while closing the tab...\r\n\t\t\t\tvar label = this.labelBinding.getLabel ();\r\n\t\t\t\tif ( label != null ) {\r\n\t\t\t\t\tthis.labelBinding.setLabel ( \r\n\t\t\t\t\t\tisDirty ? \"*\" + label : label.slice ( 1, label.length )\t\t\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.labelBinding.setLabel ( isDirty ? \"*\" : \"\" );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar broadcaster = top.app.bindingMap.broadcasterCurrentTabDirty;\r\n\t\tif ( this.isDirty == true ) {\r\n\t\t\tthis.subscribe ( BroadcastMessages.SAVE_CURRENT );\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.DOCKTAB_DIRTY, this );\r\n\t\t\tbroadcaster.enable ();\r\n\t\t} else {\r\n\t\t\tthis.unsubscribe ( BroadcastMessages.SAVE_CURRENT  );\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.DOCKTAB_CLEAN, this );\r\n\t\t\tbroadcaster.disable ();\r\n\t\t}\r\n\t} else {\r\n\t\tDialog.warning ( \"Dirty denied\", \"Only editor docks should invoke the dirty state!\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Grab label, image and tooltip from another binding (presumably a loaded PageBinding).\r\n * @see {DockBinding_setupPageBindingListeners}\r\n * @param {Binding} binding\r\n */\r\nDockTabBinding.prototype.updateDisplay = function ( binding ) {\r\n\t\r\n\tthis.setLabel ( binding.getLabel ());\r\n\tthis.setImage ( binding.getImage ());\r\n\tthis.setToolTip ( binding.getToolTip ());\r\n}\r\n\r\n/**\r\n * Update entityToken.\r\n * @see {DockBinding_setupPageBindingListeners}\r\n */\r\nDockTabBinding.prototype.updateEntityToken = function ( binding ) {\r\n\t\r\n\tthis.setEntityToken ( binding.getEntityToken ());\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nDockTabBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tDockTabBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase ControlBinding.ACTION_COMMAND :\r\n\t\t\tif ( binding.controlType == ControlBinding.TYPE_CLOSE ) {\r\n\t\t\t\tthis.close ()\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\t\t \tif ( action.listener == this.contextMenuBinding ) {\r\n\t\t \t\tthis._handleContextMenuItemBinding ( binding );\r\n\t\t \t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {MenuItemBinding} menuItemBinding\r\n */\r\nDockTabBinding.prototype._handleContextMenuItemBinding = function ( menuItemBinding ) {\r\n\t\r\n\tvar cmd = menuItemBinding.getProperty ( \"cmd\" );\r\n\t\r\n\tswitch ( cmd ) {\r\n\t\tcase DockTabPopupBinding.CMD_REFRESH :\r\n\t\t\tif ( this.containingTabBoxBinding.type != DockBinding.TYPE_TOOLS ) {\r\n\t\t\t\tthis.setLabel ( DockTabBinding.LABEL_TABLOADING );\r\n\t\t\t}\r\n\t\t\tthis.setImage ( DockTabBinding.IMG_TABLOADING );\r\n\t\t\tthis._viewBinding.reload ( Application.isDeveloperMode );\r\n\t\t\tthis.isDirty = false;\r\n\t\t\tbreak;\r\n\t\tcase DockTabPopupBinding.CMD_MAKEDIRTY :\r\n\t\t\tthis.setDirty ( true );\r\n\t\t\tbreak;\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSOURCE :\r\n\t\tcase DockTabPopupBinding.CMD_VIEWGENERATED :\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSERIALIZED :\r\n\t\t\tthis._viewSource ( cmd );\r\n\t\t\tbreak;\r\n\t\tcase DockTabPopupBinding.CMD_CLOSETAB :\r\n\t\t\tthis.close ()\r\n\t\t\tbreak;\r\n\t\tcase DockTabPopupBinding.CMD_CLOSEOTHERS :\r\n\t\t\tthis.containingTabBoxBinding.closeTabsExcept ( this );\r\n\t\t\tbreak;\r\n\t\tdefault :\r\n\t\t\talert ( \"TODO!\" );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/** \r\n * Rigged up for default tab labels. Always invoked at least twice: \r\n * 1) When the tab is constructed (by DockBinding) \r\n * 2) When the PageBinding is inititlized (in associated tab panel).\r\n * @overloads {TabBinding#setLabel}\r\n * @param {string} label\r\n */\r\nDockTabBinding.prototype.setLabel = function ( label ) {\r\n\r\n\tif ( !label ) {\r\n\t\tif ( !this.getLabel ()) {\r\n\t\t\tlabel = DockTabBinding.LABEL_TABLOADING;\r\n\t\t} else if ( this.getLabel () == DockTabBinding.LABEL_TABLOADING ) {\r\n\t\t\tlabel = DockTabBinding.LABEL_TABDEFAULT;\r\n\t\t}\r\n\t}\r\n\tlabel = this.isDirty ? \"*\" + label : label;\r\n\tDockTabBinding.superclass.setLabel.call ( this, label );\r\n}\r\n\r\n/** \r\n * Rigged up for default tab images. Always invoked at least twice: \r\n * 1) When the tab is constructed (by DockBinding) \r\n * 2) When the PageBinding is inititlized (in associated tab panel).\r\n * @overloads {TabBinding#setImage}\r\n * @param {string} image\r\n */\r\nDockTabBinding.prototype.setImage = function ( image ) {\r\n\r\n\tif ( !image ) {\r\n\t\tif ( !this.getImage ()) {\r\n\t\t\timage = DockTabBinding.IMG_TABLOADING;\r\n\t\t} else if ( this.getImage () == DockTabBinding.IMG_TABLOADING ) {\r\n\t\t\timage = DockTabBinding.IMG_TABDEFAULT;\r\n\t\t}\r\n\t}\r\n\tDockTabBinding.superclass.setImage.call ( this, image );\r\n}\r\n\r\n/**\r\n * View contained source.\r\n * @param {string} cmd\r\n */\r\nDockTabBinding.prototype._viewSource = function ( cmd ) {\r\n\r\n\tvar def = ViewDefinitions [ \"Composite.Management.SourceCodeViewer\" ];\r\n\tdef.argument = { \r\n\t\taction: cmd, \r\n\t\tdoc : this._viewBinding.windowBinding.getContentDocument ()\r\n\t};\r\n\tvar label = Resolver.resolve ( this.getLabel ());\r\n\tswitch ( cmd ) {\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSOURCE :\r\n\t\t\tdef.label = \"Source: \" + label;\r\n\t\t\tbreak;\r\n\t\tcase DockTabPopupBinding.CMD_VIEWGENERATED :\r\n\t\t\tdef.label = \"Generated: \"  + label;\r\n\t\t\tbreak;\r\n\t\tcase DockTabPopupBinding.CMD_VIEWSERIALIZED :\r\n\t\t\tdef.label = \"Serialized: \" + label;\r\n\t\t\tbreak;\r\n\t}\r\n\tStageBinding.presentViewDefinition ( def );\r\n}\r\n\r\n/**\r\n * Invoked by the DockBinding on activation.\r\n */\r\nDockTabBinding.prototype.onActivate = function () {\r\n\t\r\n\tthis._updateBroadcasters ();\r\n\tif ( this.isSelected ) {\r\n\t\tthis._updateTree ();\r\n\t}\r\n\tif ( this._controlGroupBinding ) {\r\n\t\tthis._controlGroupBinding.onActivate ();\r\n\t}\r\n\tif ( this.isSelected ) {\r\n\t\tthis._updateGlobalEntityToken ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked by the DockBinding on deactivation.\r\n */\r\nDockTabBinding.prototype.onDeactivate = function () {\r\n\t\r\n\tif ( this._controlGroupBinding ) {\r\n\t\tthis._controlGroupBinding.onDeactivate ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked when associated page initializes.\r\n * @see {DockBinding#_setupPageBindingListeners}\r\n */\r\nDockTabBinding.prototype.onPageInitialize = function ( page ) {\r\n\t\r\n\tthis._updateBroadcasters ();\r\n\tif ( this._isEditorDockTab ()) {\r\n\t\tif ( !this.hasSubscription ( BroadcastMessages.CLOSE_ALL )) { // reload tab!\r\n\t\t\tthis.subscribe ( BroadcastMessages.CLOSE_CURRENT );\r\n\t\t\tthis.subscribe ( BroadcastMessages.CLOSE_ALL );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Save contained editor.\r\n * @see {ViewBinding#handleAction}\r\n */\r\nDockTabBinding.prototype.saveContainedEditor = function () {\r\n\t\r\n\tif ( this._isEditorDockTab () && this.isDirty == true ) {\r\n\t\tthis._viewBinding.saveContainedEditor ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Dock tabs are initially hidden by CSS in order to prevent jumping tabs. It's a \r\n * timeout issue (takes browser a millisecond to compute tab width exactly).\r\n * TODO: This should in theory be backported to super class.\r\n * @see {TabsBinding#manage}\r\n * @overloads {TabBinding#show}\r\n */\r\nDockTabBinding.prototype.show = function () {\r\n\t\r\n\tDockTabBinding.superclass.show.call ( this );\r\n\t\r\n\tif ( this.isVisible && this.isInitiallyHidden && Binding.exists ( this )) {\r\n\t\t\r\n\t\tthis.isInitiallyHidden = false;\r\n\t\t\r\n\t\t/*\r\n\t\t * Timeout to completely stabilize.\r\n\t\t */\r\n\t\tvar element = this.bindingElement;\r\n\t\tsetTimeout ( function () {\r\n\t\t\telement.style.bottom = \"auto\";\r\n\t\t}, 25 );\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {\r\n */\r\nDockTabBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tDockTabBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\r\n\tif (this._viewBinding == null)\r\n\t\treturn;\r\n\r\n\tvar body = this._viewBinding.getContentDocument ().body;\r\n\tvar root = UserInterface.getBinding ( body );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\t\r\n\t\tcase BroadcastMessages.SAVE_CURRENT :\r\n\t\t\tif ( this.isDirty && this.isSelected && root.isActivated ) {\r\n\t\t\t\tthis.saveContainedEditor ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.CURRENT_SAVED :\r\n\t\t\tif ( arg.handle == this.getAssociatedView ().getHandle ()) {\r\n\t\t\t\tthis.unsubscribe ( BroadcastMessages.CURRENT_SAVED );\r\n\t\t\t\tif ( arg.isSuccess ) {\r\n\t\t\t\t\tthis._onSaveSuccess ();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._onSaveFailure ();\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase BroadcastMessages.CLOSE_CURRENT :\r\n\t\t\tif ( this._isEditorDockTab ()) {\r\n\t\t\t\tif ( this.isSelected && root.isActivated ) {\r\n\t\t\t\t\tthis.close ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase BroadcastMessages.CLOSE_ALL :\r\n\t\t\tif ( this._isEditorDockTab ()) {\r\n\t\t\t\tthis.close ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_LOCKTOEDITOR :\r\n\t\t\tif ( this.isSelected ) {\r\n\t\t\t\tif ( UserInterface.isBindingVisible ( this )) {\r\n\t\t\t\t\tthis._updateTree ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.BIND_TOKEN_TO_VIEW :\r\n\t\t\tif ( arg.handle == this._viewBinding.getDefinition ().handle ) {\r\n\t\t\t\tthis.setEntityToken ( arg.entityToken );\r\n\t\t\t\tif ( this.isSelected ) {\r\n\t\t\t\t\tthis._updateTree ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked by the TabPanelBinding - but the code for \r\n * the actionlistener is found somewhere in DockBinding.\r\n * @see {DockBinding#_setupPageBindingListeners}\r\n * @return\r\n */\r\nDockTabBinding.prototype.onSaveStart = function () {\r\n\t\r\n\tthis.subscribe ( BroadcastMessages.CURRENT_SAVED );\r\n}\r\n\r\n/**\r\n * Invoked on successful save.\r\n */\r\nDockTabBinding.prototype._onSaveSuccess = function () {\r\n\t\r\n\t/*\r\n\t * If you are here looking for a resetting of property \r\n\t * this.isDirty, note that it will be flipped by \r\n\t * interception of EditorPageBinding.ACTION_CLEAN ...\r\n\t */\r\n\t\r\n\t/*\r\n\t * Update associated page.\r\n\t */\r\n\tvar page = this._viewBinding.getPageBinding ();\r\n\tif ( page != null && page instanceof EditorPageBinding ) {\r\n\t\tpage.onSaveSuccess ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked on failed save.\r\n */\r\nDockTabBinding.prototype._onSaveFailure = function () {\r\n\t\r\n\t// TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n}\r\n\r\n/**\r\n * @overwrites {TabBinding#select}\r\n */\r\nDockTabBinding.prototype.select = function ( isManaged ) {\r\n\t\r\n\tDockTabBinding.superclass.select.call ( this, isManaged );\r\n\t\r\n\t/* \r\n\t * Update top level broadcaster to enable the main menu \"save\" command.\r\n\t */\r\n\tthis._updateBroadcasters ();\r\n\t\r\n\t/*\r\n\t * Update tree focus.\r\n\t */\r\n\t//if ( isManaged != true ) {\r\n\t\tthis._updateTree ();\r\n\t//}\r\n\t\r\n\t/*\r\n\t * TODO: Technically this should only be done when the dock is activated...\r\n\t */\r\n\tthis._updateGlobalEntityToken ();\r\n}\r\n\r\n\r\n/**\r\n * Close the tab. Does not check for dirty content - use with caution!\r\n */\r\nDockTabBinding.prototype.close = function () {\r\n\t\r\n\tif (!this.isPinned) {\r\n\t\tthis.containingTabBoxBinding.closeTab(this);\r\n\t}\r\n}\r\n\r\n/**\r\n * Update broadcasters.\r\n */\r\nDockTabBinding.prototype._updateBroadcasters = function () {\r\n\t\r\n\tif ( this.isSelected ) {\r\n\t\t\r\n\t\tvar dirtyBroadcaster = top.app.bindingMap.broadcasterCurrentTabDirty;\r\n\t\tvar editorBroadcaster = top.app.bindingMap.broadcasterCurrentIsEditor;\r\n\t\t\r\n\t\tif ( this._isEditorDockTab ()) {\t\r\n\t\t\teditorBroadcaster.enable ();\r\n\t\t\tif ( this.isDirty ) {\r\n\t\t\t\tdirtyBroadcaster.enable ();\r\n\t\t\t} else {\r\n\t\t\t\tdirtyBroadcaster.disable ();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\teditorBroadcaster.disable ();\r\n\t\t\tdirtyBroadcaster.disable ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Update tree (if locked to editor). Note that this is done at three distinct \r\n * points in a DockTabBinding lifecycle: When entityToken is updated, when \r\n * the tab is selected and when the tab is activated (and selected). This may \r\n * happen all at once, for example during tab creation, so the operation has \r\n * been fitted with a short timeout to prevent multiple webservice invokations.\r\n * @param {boolean} isForce \r\n */\r\nDockTabBinding.prototype._updateTree = function ( isForce ) {\r\n\t\r\n\tif ( this._canUpdateTree || isForce ) {\r\n\t\t\r\n\t\tEventBroadcaster.broadcast ( \r\n\t\t\tBroadcastMessages.DOCKTABBINDING_SELECT, \r\n\t\t\tthis\r\n\t\t);\r\n\t\t\r\n\t\t/*\r\n\t\t * Eh. This seems to habe been disabled for some reason... \r\n\t\t *\r\n\t\t//this._canUpdateTree = false;\r\n\t\t\r\n\t\t// ... so we disabled this also!\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tself._canUpdateTree = true;\r\n\t\t}, 250 );\r\n\t\t*/\r\n\t}\r\n}\r\n\r\n/**\r\n * Hacked method to determine if we are an editor tab: \r\n * Simply look for a save-button inside the document.\r\n * @return {boolean}\r\n */\r\nDockTabBinding.prototype._isEditorDockTab = function () {\r\n\t\r\n\tvar result = false;\r\n\tif ( this._viewBinding != null ) {\r\n\t\tvar win = this._viewBinding.getContentWindow ();\r\n\t\tif ( win != null && win.bindingMap != null ) {\r\n\t\t\tvar button = win.bindingMap.savebutton;\r\n\t\t\tif ( button != null ) {\r\n\t\t\t\tresult = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Update a global reference to the currently selected tabs associated \r\n * serializedEntityToken. This is used to restore focus in trees when refreshed. \r\n * @return\r\n */\r\nDockTabBinding.prototype._updateGlobalEntityToken = function () {\r\n\t\r\n\tStageBinding.entityToken = this._entityToken;\r\n}\r\n\r\n/**\r\n * DockTabBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DockTabBinding}\r\n */\r\nDockTabBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:docktab\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DockTabBinding );\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/docks/DockTabPopupBinding.js",
    "content": "DockTabPopupBinding.prototype = new PopupBinding;\r\nDockTabPopupBinding.prototype.constructor = DockTabPopupBinding;\r\nDockTabPopupBinding.superclass = PopupBinding.prototype;\r\n\r\nDockTabPopupBinding.CMD_RESTORE \t\t= \"restore\";\r\nDockTabPopupBinding.CMD_MINIMIZE \t\t= \"minimize\";\r\nDockTabPopupBinding.CMD_MAXIMIZE \t\t= \"maximize\";\r\nDockTabPopupBinding.CMD_REFRESH \t\t= \"refreshview\";\r\nDockTabPopupBinding.CMD_MAKEDIRTY \t\t= \"makedirty\";\r\nDockTabPopupBinding.CMD_CLOSETAB \t\t= \"closetab\";\r\nDockTabPopupBinding.CMD_CLOSEOTHERS \t= \"closeothers\";\r\nDockTabPopupBinding.CMD_CLOSEALL \t\t= \"closeall\";\r\nDockTabPopupBinding.CMD_VIEWSOURCE \t\t= \"viewsource\";\r\nDockTabPopupBinding.CMD_VIEWGENERATED \t= \"viewgenerated\";\r\nDockTabPopupBinding.CMD_VIEWSERIALIZED \t= \"viewserialized\";\r\n\r\nfunction DockTabPopupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DockTabPopupBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDockTabPopupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DockTabPopupBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PopupBinding#onBindingAttach}\r\n */\r\nDockTabPopupBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tDockTabPopupBinding.superclass.onBindingAttach.call ( this );\r\n\tthis._indexMenuContent ();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/docks/DockTabsBinding.js",
    "content": "DockTabsBinding.prototype = new TabsBinding;\r\nDockTabsBinding.prototype.constructor = DockTabsBinding;\r\nDockTabsBinding.superclass = TabsBinding.prototype;\r\nDockTabsBinding.NODENAME_TABBOX = \"dock\";\r\nDockTabsBinding.TABBUTTON_IMPLEMENTATION = DockTabsButtonBinding;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DockTabsBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DockTabsBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDockTabsBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DockTabsBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {TabsBinding#flex}\r\n * @implements {IFlexible}\r\n */\r\nDockTabsBinding.prototype.flex = function () {\r\n\r\n\t/*\r\n\t * This fixes a horrendous rendering engine malfunction in Explorer.\r\n\t * Notice that a borderwidth (or whatever) has been hardcoded into this!\r\n\t */\r\n\tif ( Client.isExplorer && this.containingTabBoxBinding != null ) {\r\n\t\r\n\t\tvar self = this;\r\n\t\tfunction fix () {\r\n\t\t\tvar width = self.containingTabBoxBinding.getWidth ();\r\n\t\t\tif ( !isNaN ( width )) {\r\n\t\t\t\twidth = width > 0 ? width - 1 : 0; // hardcode!\r\n\t\t\t\tself.bindingElement.style.width = new String ( width ) + \"px\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tsetTimeout ( fix, 250 );\r\n\t\tfix ();\r\n\t}\r\n\t\r\n\tDockTabsBinding.superclass.flex.call ( this );\r\n}\r\n\r\n/**\r\n * Handle crawler.\r\n * @implements {ICrawlerHandler}\r\n * @param {Crawler} crawler\r\n */\r\nDockTabsBinding.prototype.handleCrawler = function ( crawler ) {\r\n\t\r\n\tDockTabsBinding.superclass.handleCrawler.call ( this, crawler );\r\n\t\r\n\tswitch ( crawler.id ) {\t\r\n\t\tcase FlexBoxCrawler.ID :\r\n\t\t\tthis._explorerFlexHack ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/*\r\n * This fixes a horrendous rendering engine malfunction in Explorer.\r\n * Notice that a borderwidth (or whatever) has been hardcoded into this!\r\n */\r\nDockTabsBinding.prototype._explorerFlexHack = function () {\r\n\t\r\n\tif ( Client.isExplorer && this.containingTabBoxBinding != null ) {\r\n\t\r\n\t\tvar self = this;\r\n\t\tfunction fix () {\r\n\t\t\tvar width = self.containingTabBoxBinding.getWidth ();\r\n\t\t\tif ( !isNaN ( width )) {\r\n\t\t\t\twidth = width > 0 ? width - 1 : 0; // hardcode!\r\n\t\t\t\tself.bindingElement.style.width = new String ( width ) + \"px\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tsetTimeout ( fix, 250 );\r\n\t\tfix ();\r\n\t}\r\n}\r\n\r\n/**\r\n * DockTabsBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DockTabsBinding}\r\n */\r\nDockTabsBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:docktabs\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, DockTabsBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/docks/DockTabsButtonBinding.js",
    "content": "DockTabsButtonBinding.prototype = new TabsButtonBinding;\r\nDockTabsButtonBinding.prototype.constructor = DockTabsButtonBinding;\r\nDockTabsButtonBinding.superclass = TabsButtonBinding.prototype;\r\nDockTabsButtonBinding.RESERVED_SPACE = 50;\r\nDockTabsButtonBinding.NODENAME_TABBOX = \"dock\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DockTabsButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DockTabsButtonBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDockTabsButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DockTabsButtonBinding]\";\r\n}\r\n\r\n/**\r\n * DockTabsButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {DockTabsButtonBinding}\r\n */\r\nDockTabsButtonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar toolbarbutton = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbarbutton\", ownerDocument );\r\n\ttoolbarbutton.setAttribute ( \"type\", \"checkbox\" );\r\n\ttoolbarbutton.setAttribute ( \"popup\", \"app.bindingMap.tabsbuttonpopup\" );\r\n\ttoolbarbutton.className = \"tabbutton\";\t\r\n\treturn UserInterface.registerBinding ( toolbarbutton, DockTabsButtonBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/EditorBinding.js",
    "content": "/*\r\n * This fellow is a superclass for editors based on the contentEditable interface.\r\n * This should give us a unified way of accessing the editable document, and\r\n * to setup contextmenus and stuff for the editor. @see {BespinEditorBinding}\r\n */\r\n\r\nEditorBinding.prototype = new WindowBinding;\r\nEditorBinding.prototype.constructor = EditorBinding;\r\nEditorBinding.superclass = WindowBinding.prototype;\r\n\r\n/**\r\n * True while an EditorBinding instance has focus.\r\n * @see {EditorBinding._activateEditor}\r\n * @type {boolean}\r\n */\r\nEditorBinding.isActive = false;\r\n\r\n/**\r\n * Subclasses should define these.\r\n */\r\nEditorBinding.ACTION_ATTACHED = null;\r\n\r\n/**\r\n * Clipboard security configuration dialog URL.\r\n */\r\nEditorBinding.URL_DIALOG_MOZ_CONFIGURE = \"${root}/content/dialogs/wysiwygeditor/mozsecuritynote/mozsecuritynote.aspx\";\r\n\r\n/**\r\n *\r\n */\r\nEditorBinding.URL_UPDATERENDERING = \"${root}/content/dialogs/functions/editFunctionCall.aspx?type={0}&pageId={context:pageId}&containerClasses={context:containerClasses}\";\r\n\r\n/**\r\n * The number of the beast.\r\n * @type {int}\r\n */\r\nEditorBinding.ABSURD_NUMBER = -999999999;\r\n\r\n/**\r\n * Used to preserve line-break entity &#xA; in source code.\r\n * @type {String}\r\n */\r\nEditorBinding.LINE_BREAK_ENTITY_HACK = \"C1.LINE.BREAK.ENTITY.HACK\";\r\n\r\n\r\n\r\n// EDITITOR COMPONENT STUFF ..............................................\r\nEditorBinding.invokeFunctionEditorDialog = function (markup, handler, type, contextSource)\r\n{\r\n    type = type?type:'';\r\n    var settings = FunctionService.GetCustomEditorSettingsByMarkup(markup);\r\n\r\n    var def = ViewDefinitions[\"Composite.Management.PostBackDialog\"];\r\n    if (!settings) {\r\n        def.width = 500;\r\n        def.height = 520;\r\n    } else {\r\n        var dim = top.WindowManager.getWindowDimensions();\r\n        def.width = settings.Width ? (settings.Width > dim.w ? dim.w : settings.Width) : undefined;\r\n        def.height = settings.Height ? (settings.Height > dim.h ? dim.h : settings.Height) : undefined;\r\n        if (settings.Url)\r\n            settings.Url = settings.Url.indexOf(\"?\") > -1 ? settings.Url + \"&consoleId=\" + Application.CONSOLE_ID : settings.Url + \"?consoleId=\" + Application.CONSOLE_ID;\r\n    }\r\n\r\n    def.label = \"${string:Composite.Web.FormControl.FunctionCallsDesigner:DialogTitle}\";\r\n    def.image = \"${icon:parameter_overloaded}\";\r\n    def.handler = handler;\r\n    def.argument = {\r\n    \turl: settings ? settings.Url : EditorBinding.URL_UPDATERENDERING.replace('{0}', type),\r\n        list: new List([{ name: \"functionmarkup\", value: markup }])\r\n    }\r\n    StageBinding.presentViewDefinition(def, contextSource);\r\n}\r\n\r\n\r\n\r\n/**\r\n * Considered private to the EditorBinding.\r\n * @type {Map<string><List<IWysiwygEditorComponent>>}\r\n */\r\nEditorBinding._components = new Map ();\r\n\r\n/**\r\n * Considered private to the EditorBinding.\r\n * @type {Map<string><EditorBinding>}\r\n */\r\nEditorBinding._editors = new Map ();\r\n\r\n/**\r\n * Editor compontens can register themselves around here\r\n * to be initialized when TinyMCE or CodePress is loaded.\r\n * @param {IWysiwygEditorComponent} binding\r\n * @param {WindowBinding} windowBinding\r\n */\r\nEditorBinding.registerComponent = function ( binding, windowBinding ) {\r\n\r\n\tvar components = EditorBinding._components;\r\n\tvar editors = EditorBinding._editors;\r\n\tvar key = windowBinding.key;\r\n\r\n\t/*\r\n\t * This if-else is ugly - refactor!\r\n\t */\r\n\tvar isImplemented = Interfaces.isImplemented ( IWysiwygEditorComponent, binding );\r\n\tif ( !isImplemented ) {\r\n\t\tisImplemented = Interfaces.isImplemented ( ISourceEditorComponent, binding );\r\n\t}\r\n\r\n\tif ( isImplemented ) {\r\n\t\tif ( editors.has ( key )) { // already initialized\r\n\t\t\teditors.get ( key ).initializeEditorComponent ( binding );\r\n\t\t}  else { // not yet initialized\r\n\t\t\tif ( !components.has ( key )) {\r\n\t\t\t\tcomponents.set ( key, new List ());\r\n\t\t\t}\r\n\t\t\tcomponents.get ( key ).add ( binding );\r\n\t\t}\r\n\t} else {\r\n\t\tthrow \"Editor component interface not implemented: \" + binding;\r\n\t}\r\n}\r\n\r\n/**\r\n * When an editor instance is initialized, it will\r\n * fetch associated components and initialize them.\r\n * @param {EditorBinding} editor\r\n * @param {WindowBinding} windowBinding\r\n * @return {List<IWysiwygEditorComponent>}\r\n */\r\nEditorBinding.claimComponents = function ( editor, windowBinding ) {\r\n\r\n\tvar components = EditorBinding._components;\r\n\tvar editors = EditorBinding._editors;\r\n\tvar key = windowBinding.key;\r\n\r\n\t// Register editor as initialized.\r\n\teditors.set ( key, editor );\r\n\r\n\t// Fetch associated components\r\n\tvar list = null;\r\n\tif ( components.has ( key )) {\r\n\t\tlist = components.get ( key ).copy ();\r\n\t\tcomponents.del ( key ); // deleting entries!\r\n\t}\r\n\treturn list;\r\n}\r\n\r\n\r\n/**\r\n * @class\r\n * In order to function elegantly as a DataBinding, we should probably refactor\r\n * the inheritance chain. For now, we simply implement the required interface.\r\n * @implements {@link IData}\r\n */\r\nfunction EditorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorBinding\" );\r\n\r\n\t/**\r\n\t * Subclass must define.\r\n\t * @type {string}\r\n\t */\r\n\tthis.action_initialized = null;\r\n\r\n\t/**\r\n\t * Subclass must define.\r\n\t * @type {string}\r\n\t */\r\n\tthis.url_default = null;\r\n\r\n\t/**\r\n\t * @type {EditorPopupBinding}\r\n\t */\r\n\tthis._popupBinding = null;\r\n\r\n\t/**\r\n\t * This is the string value of postbackable textarea.\r\n\t * @type {string}\r\n\t */\r\n\tthis._startContent = null;\r\n\r\n\t/**\r\n\t * An object with two properties, start and length. Used to cache\r\n\t * and restore the selection while document is out of focus.\r\n\t * @type {object}\r\n\t */\r\n\tthis._explorerBookmark = null;\r\n\r\n\t/**\r\n\t * Flipped when editor content changes first time.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\r\n\t/**\r\n\t * Flipped when editor launches and closed a dialog.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDialogMode = false;\r\n\r\n\t/**\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\r\n\t/**\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\r\n\t/**\r\n\t * Flipped when editable document is handled.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isActivated = false;\r\n\r\n\t/**\r\n\t * This will hide the \"flash of white\" in Explorer.\r\n\t * @type {Binding}\r\n\t */\r\n\tthis._Binding = null;\r\n\r\n\t/**\r\n\t * The URL to load. Defined during initialization\r\n\t * so that subclasses don't inherit the value.\r\n\t */\r\n\tthis._url = null;\r\n\r\n\t/**\r\n\t * Dont relay events dispatched by any descendant binding.\r\n\t * @overloads {Binding#isBlockingActions}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isBlockingActions = true;\r\n\r\n\t/**\r\n\t * Flipped when the finalize method invokes.\r\n\t * TODO: Investigate - do we still need this?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isFinalized = false;\r\n\r\n\t/**\r\n\t * The bookmark thingy.\r\n\t * @type {object}\r\n\t */\r\n\tthis._bookmark = null;\r\n\r\n\t/**\r\n\t * Used to determine when a dirty flag should be raised.\r\n\t * @type {string}\r\n\t */\r\n\tthis._checksum = null;\r\n\r\n\t/**\r\n\t * Divert focus crawler.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FocusCrawler.ID, FitnessCrawler.ID ]);\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[EditorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {WindowBinding#onBindingRegister}\r\n */\r\nEditorBinding.prototype.onBindingRegister = function () {\r\n\r\n\tEditorBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\t/*\r\n\t * Mount the URL.\r\n\t */\r\n\tthis._url = this.url_default;\r\n\r\n\t/*\r\n\t * Hides the \"flash of white\" when loading in explorer.\r\n\t */\r\n\tthis._coverBinding = this.add (\r\n\t\tCoverBinding.newInstance ( this.bindingDocument )\r\n\t);\r\n\r\n\t/*\r\n\t* Register as DataBinding so that we\r\n\t* may masquerade as a DataBinding.\r\n\t*/\r\n\tvar name = this.getProperty(\"name\");\r\n\tif (name == null || name == \"\") {\r\n\t\tname = \"generated\" + KeyMaster.getUniqueKey();\r\n\t}\r\n\tthis._registerWithDataManager(name);\r\n}\r\n\r\n/**\r\n * @overloads {WindowBinding#onBindingAttach}\r\n */\r\nEditorBinding.prototype.onBindingAttach = function () {\r\n\r\n\tApplication.lock ( this ); // unlocked by method _initialize!\r\n\r\n\t// Hello.\r\n\tif ( this.hasCallBackID ()) {\r\n\t\tBinding.dotnetify ( this );\r\n\t}\r\n\r\n\tthis._setup ();\r\n\tthis.setURL ( this._url );\r\n\r\n\t/*\r\n\t * Relay dirty events. Remember that this.isBlockingActions!\r\n\t */\r\n\tthis.addActionListener ( Binding.ACTION_DIRTY );\r\n\tEditorBinding.superclass.onBindingAttach.call ( this );\r\n}\r\n\r\n/**\r\n * Find start content\r\n */\r\nEditorBinding.prototype._setup = function () {\r\n\r\n\t/*\r\n\t * Extract content from the textarea, unless\r\n\t * already specified programatically.\r\n\t */\r\n\tvar value = this.getProperty ( \"value\" );\r\n\tif ( value != null ) {\r\n\t\tvalue = decodeURIComponent ( value );\r\n\t\t//value = value.replace ( /\\&#xA;/g, EditorBinding.LINE_BREAK_ENTITY_HACK );\r\n\t\tthis._startContent = value;\r\n\t}\r\n}\r\n\r\n/**\r\n * Unregister when disposed.\r\n * TODO: UNREGISTER PAGE EDITOR!\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nEditorBinding.prototype.onBindingDispose = function () {\r\n\r\n\tEditorBinding.superclass.onBindingDispose.call ( this );\r\n\r\n\tvar name = this.getProperty ( \"name\" );\r\n\tif ( name != null ) {\r\n\t\tvar dataManager = this.bindingWindow.DataManager;\r\n\t\tdataManager.unRegisterDataBinding ( name ); // TODO: PAGEEDITOR???\r\n\t}\r\n}\r\n\r\n/**\r\n * Initialize editor.\r\n */\r\nEditorBinding.prototype._initialize = function () {\r\n\r\n\tthis.subscribe ( BroadcastMessages.STAGEDIALOG_OPENED );\r\n\tthis.subscribe ( BroadcastMessages.MOUSEEVENT_MOUSEUP );\r\n\r\n\t// if all else failed, at least we have a string\r\n\tif ( this._startContent == null ) {\r\n\t\tthis._startContent = new String ( \"\" );\r\n\t}\r\n\r\n\t// setup internal events\r\n\tthis.addEditorEvents ();\r\n\r\n\t// present startcontent - explorer needs a short break here\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tself._finalize ();\r\n\t}, 0 );\r\n}\r\n\r\n/**\r\n * Finalize initialization.\r\n */\r\nEditorBinding.prototype._finalize = function () {\r\n\r\n\tthis.resetUndoRedo ();\r\n\tthis._popupBinding = this.getEditorPopupBinding ();\r\n\tApplication.unlock ( this );\r\n\tthis._isFinalized = true;\r\n\tthis.dispatchAction ( this.action_initialized );\r\n}\r\n\r\n/*\r\n * Initialize components collected during startup.\r\n * @param {WindowBinding} windowBinding\r\n */\r\nEditorBinding.prototype.initializeEditorComponents = function ( windowBinding ) {\r\n\r\n\tvar components = EditorBinding.claimComponents ( this, windowBinding );\r\n\tif ( components != null ) {\r\n\t\twhile ( components.hasNext ()) {\r\n\t\t\tthis.initializeEditorComponent (\r\n\t\t\t\tcomponents.getNext ()\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * We need this to masquerade the editor as a DataBinding!\r\n * @param {string} name\r\n */\r\nEditorBinding.prototype._registerWithDataManager = function ( name ) {\r\n\r\n\tif ( name && name != \"\" ) {\r\n\t\tvar dataManager = this.bindingWindow.DataManager;\r\n\t\tif ( dataManager.getDataBinding ( name )) {\r\n\t\t\tdataManager.unRegisterDataBinding ( name );\r\n\t\t}\r\n\t\tdataManager.registerDataBinding ( name, this );\r\n\t}\r\n}\r\n\r\n/*\r\n * Setup event handling inside the editable document.\r\n */\r\nEditorBinding.prototype.addEditorEvents = function () {\r\n\r\n\tvar editorDocument = this.getEditorDocument ();\r\n\r\n\tif ( editorDocument != null ) {\r\n\t\tApplication.framework ( editorDocument );\r\n\t\tDOMEvents.addEventListener ( editorDocument, DOMEvents.CONTEXTMENU, this );\r\n\t\tDOMEvents.addEventListener ( editorDocument, DOMEvents.KEYPRESS, this );\r\n\t\tDOMEvents.addEventListener ( editorDocument, DOMEvents.MOUSEDOWN, this );\r\n\t\tDOMEvents.addEventListener ( editorDocument, DOMEvents.MOUSEMOVE, this );\r\n\t}\r\n\r\n\t/*\r\n\t * Why this?\r\n\t */\r\n\tDOMEvents.addEventListener ( this.bindingElement, DOMEvents.MOUSEDOWN, {\r\n\t\thandleEvent: function ( e ) {\r\n\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Check for dirty. Note that VisualEditorPageBinding invokes this\r\n * method on an interval (at least in Internet Explorer).\r\n * @param {boolean} isHiddenChange\r\n */\r\nEditorBinding.prototype.checkForDirty = function ( isHiddenChange ) {\r\n\r\n\tif (!this.isDirty || !this.bindingWindow.DataManager.isDirty) {\r\n\t\tif ( isHiddenChange == true ) {\r\n\t\t\tthis.bindingWindow.DataManager.dirty(this);\r\n\t\t} else {\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tself._checkForRealDirty ();\r\n\t\t\t}, 0 );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * The real dirty check.\r\n * @return\r\n */\r\nEditorBinding.prototype._checkForRealDirty = function () {\r\n\r\n\tvar checksum = this.getCheckSum ();\r\n\tif (checksum != this._checksum) {\r\n\t\tthis.bindingWindow.DataManager.dirty(this);\r\n\t\tthis._checksum = checksum;\r\n\t}\r\n}\r\n\r\n/**\r\n * Used to determine when a dirty flag should be raised.\r\n * @return {string}\r\n */\r\nEditorBinding.prototype.getCheckSum = function () {\r\n\r\n\tvar result = null;\r\n\tif ( Binding.exists ( this._pageBinding )) {\r\n\t\tresult = this._pageBinding.getCheckSum ( this._checksum );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {eEvent} e\r\n */\r\nEditorBinding.prototype.handleEvent = function (e) {\r\n\r\n\tEditorBinding.superclass.handleEvent.call(this, e);\r\n\r\n\tvar target = DOMEvents.getTarget(e);\r\n\r\n\tswitch (e.type) {\r\n\r\n\t\t/*\r\n\t\t* Note that the contextmenu is build when first shown.\r\n\t\t*/\r\n\t\tcase DOMEvents.CONTEXTMENU:\r\n\t\t\tif (Client.isFirefox && e.ctrlKey) {\r\n\t\t\t\t// nothing, default FF contextmenu\r\n\t\t\t} else {\r\n\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t\tthis._popupBinding.editorBinding = this;\r\n\t\t\t\tthis.handleContextMenu ( e );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t* Check for dirty on all keystrokes.\r\n\t\t*/\r\n\t\tcase DOMEvents.KEYPRESS:\r\n\t\t\tthis.checkForDirty();\r\n\t\t\tif (!this._isActivated || this.isFocusable && !this.isFocused) {\r\n\t\t\t\tthis._activateEditor(true);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t* Activate editor on editor mousedown.\r\n\t\t*/\r\n\t\tcase DOMEvents.MOUSEDOWN:\r\n\r\n\t\t\tif (target.ownerDocument == this.getEditorDocument()) {\r\n\t\t\t\tif (!this._isActivated || this.isFocusable && !this.isFocused) {\r\n\t\t\t\t\tthis._activateEditor(true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t* A pityful and desperate attempt to fix the case where IE thinks\r\n\t\t* that no window has the current focus combined with IE's assumption\r\n\t\t* that mousedown on a contenteditable document should not invoke focus.\r\n\t\t*/\r\n\t\tcase DOMEvents.MOUSEMOVE:\r\n\t\t\tif (Client.isAnyExplorer) {\r\n\t\t\t\tif (Application.isBlurred) {\r\n\t\t\t\t\tif (!this._isActivated) {\r\n\t\t\t\t\t\tthis.getContentWindow().focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Subclass can overload this to update contextmenu before displaying it.\r\n * @param {MouseEvent} e\r\n */\r\nEditorBinding.prototype.handleContextMenu = function ( e ) {\r\n\r\n\tthis.createBookmark ();\r\n\tthis._popupBinding.snapToMouse ( e );\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nEditorBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tEditorBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tvar target = null;\r\n\r\n\tswitch ( broadcast ) {\r\n\r\n\t\tcase BroadcastMessages.STAGEDIALOG_OPENED:\r\n\r\n\t\t\tif (this._isActivated) {\r\n\t\t\t\tthis._activateEditor(false);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t/*\r\n\t\t * When a mouseup was performed on something, we need to analyze\r\n\t\t * whether or not this something should deactivate the editor.\r\n\t\t */\r\n\t\tcase BroadcastMessages.MOUSEEVENT_MOUSEUP :\r\n\r\n\t\t\tif ( !this.isDialogMode ) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tvar isDeactivate = true;\r\n\t\t\t\t\tif ( arg instanceof Binding ) {\r\n\t\t\t\t\t\tif ( Interfaces.isImplemented ( IEditorControlBinding, arg ) == true ) {\r\n\t\t\t\t\t\t\tif ( arg.isEditorControlBinding ) {\r\n\t\t\t\t\t\t\t\tisDeactivate = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ttarget = DOMEvents.getTarget ( arg );\r\n\t\t\t\t\t\tif ( target && target.ownerDocument == this.getEditorDocument ()) {\r\n\t\t\t\t\t\t\tisDeactivate = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( isDeactivate ) {\r\n\t\t\t\t\t\tif ( this._isActivated ) {\r\n\t\t\t\t\t\t\tthis._activateEditor ( false );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch ( exception ) {\r\n\t\t\t\t\tthis.unsubscribe ( BroadcastMessages.MOUSEEVENT_MOUSEUP );\r\n\t\t\t\t\tthrow exception;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Activate editor.\r\n * @param {boolean} isActivate\r\n */\r\nEditorBinding.prototype._activateEditor = function ( isActivate ) {\r\n\r\n\tif ( isActivate != this._isActivated ) {\r\n\r\n\t\tthis._isActivated = isActivate;\r\n\t\tEditorBinding.isActive = isActivate;\r\n\r\n\t\tvar handler = this.getEditorWindow ().standardEventHandler;\r\n\t\tvar broadcaster = this.getContentWindow ().bindingMap.broadcasterIsActive;\r\n\r\n\t\tif ( broadcaster != null ) {\r\n\t\t\tif ( isActivate ) {\r\n\r\n\t\t\t\tif ( this.hasBookmark ()) {\r\n\t\t\t\t\tthis.deleteBookmark (); // no need to keep old bookmarks around\r\n\t\t\t\t}\r\n\t\t\t\tbroadcaster.enable ();\r\n\r\n\t\t\t\tif ( Client.isExplorer ) { // fixes a glitch where Explorer needs multiple activations.\r\n\t\t\t\t\tthis._sanitizeExplorer ();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.focus ();\r\n\t\t\t\thandler.enableNativeKeys ( true );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbroadcaster.disable ();\r\n\t\t\t\thandler.disableNativeKeys ();\r\n\t\t\t\tthis.blur ();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthrow \"Required broadcaster not found\";\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoke this whenever Explorer appears not to fully\r\n * realize that we are in contentEditable mode.\r\n */\r\nEditorBinding.prototype._sanitizeExplorer = function () {\r\n\r\n\tif ( Client.isExplorer ) {\r\n\t\tvar range = this.getEditorDocument ().selection.createRange ();\r\n\t\trange.select ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoke this whenever Mozilla appears not to fully\r\n * realize that we are in contentEditable mode.\r\n *\r\n * @see {https://bugzilla.mozilla.org/show_bug.cgi?id=520395}\r\n * @see {https://bugzilla.mozilla.org/show_bug.cgi?id=429308}\r\n * @see {https://bugzilla.mozilla.org/show_bug.cgi?id=454191}\r\n * @see {https://bugzilla.mozilla.org/show_bug.cgi?id=571694}\r\n * @see {https://bugzilla.mozilla.org/show_bug.cgi?id=439808}\r\n * @see {http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=73988}\r\n * @see {http://tinymce.moxiecode.com/punbb/viewtopic.php?id=9153}\r\n * @see {http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=2860}\r\n * @see {http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=3278}\r\n * @see {http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=604}\r\n * @see {http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=3556}\r\n * @see {http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=13366}\r\n */\r\nEditorBinding.prototype._sanitizeMozilla = function () {\r\n\r\n\t/*\r\n\t * This has now been hacked into TinyMCE source code by\r\n\t * adding a timeout to the place in \"Editor.js\" where it says:\r\n\t *\r\n\t * // Design mode must be set here once again to fix a bug where\r\n\t * // Ctrl+A/Delete/Backspace didn't work if the editor was added\r\n\t * // using mceAddControl then removed then added again\r\n\t */\r\n}\r\n\r\n/**\r\n * Returns true if text is selected or in IE - strangely - if an\r\n * image is selected (even simply right-clicked).\r\n * This method is not really handled elegantly.\r\n * @return {boolean}\r\n */\r\nEditorBinding.prototype.hasSelection = function () {\r\n\tvar result = false;\r\n\ttry {\r\n\r\n\t\tvar selection = this.getEditorWindow().getSelection();\r\n\t\tif (selection != null) {\r\n\t\t\tresult = selection.toString().length > 0;\r\n\t\t\tif (!result) {\r\n\t\t\t\tvar range = selection.getRangeAt(0);\r\n\t\t\t\tvar frag = range.cloneContents();\r\n\t\t\t\tvar element = this.getEditorDocument().createElement(\"element\");\r\n\t\t\t\twhile (frag.hasChildNodes()) {\r\n\t\t\t\t\telement.appendChild(frag.firstChild);\r\n\t\t\t\t}\r\n\t\t\t\tvar img = element.getElementsByTagName(\"img\").item(0);\r\n\t\t\t\tif (img != null) {\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* Major hack. Should not be performed here, but the\r\n\t\t\t\t\t* class check will at least prevent the Link button\r\n\t\t\t\t\t* from being enabled when a Function is selected.\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tif (!VisualEditorBinding.isReservedElement(img)) {\r\n\t\t\t\t\t\tresult = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t} catch (exception) {\r\n\t\t// may happen in WebKit when inserting eg. a table from the Insert>Table dialog\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {EditorBinding} editorBinding\r\n * @param {string} command\r\n * @return {boolean}\r\n */\r\nEditorBinding.prototype.isCommandEnabled = function ( command ) {\r\n\r\n\tvar result = true; // by default enabling all commands!\r\n\r\n\tswitch ( command ) {\r\n\t\tcase \"Cut\" :\r\n\t\tcase \"Copy\" :\r\n\t\tcase \"Paste\" :\r\n\t\t\tresult = this.getEditorDocument ().queryCommandEnabled ( command );\r\n\t\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Handle command. Subclass may overload this.\r\n * @param {string} cmd\r\n * @param {boolean} gui\r\n * @param {string} val\r\n */\r\nEditorBinding.prototype.handleCommand = function ( cmd, gui, val ) {\r\n\r\n\tvar isCommandHandled = false;\r\n\r\n\t// IE neeeds this!\r\n\tthis.restoreBookmark ();\r\n\r\n\tswitch ( cmd ) {\r\n\r\n\t\tcase \"Cut\" :\r\n\t\tcase \"Copy\" :\r\n\t\tcase \"Paste\" :\r\n\r\n\t\t\tvar value = null;\r\n\t\t\tif ( cmd == \"Paste\" ) {\r\n\t\t\t\tvalue = null;\r\n\t\t\t} else {\r\n\t\t\t\tvalue = this.hasSelection ();\r\n\t\t\t}\r\n\r\n\t\t\ttry { // mozilla may throw a clipboard security exception here\r\n\t\t\t\tthis.getEditorDocument ().execCommand ( cmd, gui, value );\r\n\t\t\t} catch ( mozillaSecurityException ) {\r\n\t\t\t\tif ( Client.isMozilla == true ) {\r\n\t\t\t\t\tDialog.invokeModal ( EditorBinding.URL_DIALOG_MOZ_CONFIGURE );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthrow \"Clipboard operation malfunction. Contact your developer.\";\r\n\t\t\t\t}\r\n\t\t\t} finally {\r\n\t\t\t\tisCommandHandled = true;\r\n\t\t\t}\r\n\t\tbreak;\r\n\t}\r\n\r\n\treturn isCommandHandled;\r\n}\r\n\r\n/**\r\n * Get button for command. Probably the contextmenu want's to know, but TinyMCE plugins may also ask.\r\n * @param {string} cmd\r\n * @return {EditorToolBarButtonBinding}\r\n */\r\nEditorBinding.prototype.getButtonForCommand = function ( cmd ) {\r\n\r\n\tvar toolbar = this.getContentWindow ().bindingMap.toolbar;\r\n\tvar button = toolbar.getButtonForCommand ( cmd );\r\n\tif ( !button ) {\r\n\t\tthrow \"No button for command \" + cmd;\r\n\t}\r\n\treturn button;\r\n}\r\n\r\n/**\r\n * Get name.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nEditorBinding.prototype.getName = function () {\r\n\r\n\treturn this.getProperty ( \"name\" );\r\n}\r\n\r\n/**\r\n * Set dirty flag.\r\n * @implements {IData}\r\n */\r\nEditorBinding.prototype.dirty = DataBinding.prototype.dirty;\r\n\r\n/**\r\n * Reset dirty flag.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nEditorBinding.prototype.clean = function () {\r\n\r\n\tthis.isDirty = false;\r\n\tthis._checksum = this.getCheckSum ();\r\n}\r\n\r\n/**\r\n * Enable dialog mode.\r\n */\r\nEditorBinding.prototype.enableDialogMode = function () {\r\n\r\n\tif ( !this.isDialogMode ) {\r\n\t\tthis.isDialogMode = true;\r\n\t\tif ( !this.hasBookmark ()) {\r\n\t\t\tthis.createBookmark ();\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * The activate-stuff seems required for Mozilla to keep track\r\n\t\t * on, whether or not backspace should be allowed. We bet it\r\n\t\t * could be fixed in a better way. Backspace is switched back on\r\n\t\t * when user focuses the editor window with the mouse...\r\n\t\t */\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () { // otherwise the insert selector may not disable...\r\n\t\t\tself._activateEditor ( false );\r\n\t\t}, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Disable dialog mode.\r\n */\r\nEditorBinding.prototype.disableDialogMode = function () {\r\n\r\n\tif ( this.isDialogMode ) {\r\n\t\tif ( this.hasBookmark ()) {\r\n\t\t\tthis.restoreBookmark ();\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Allows for the popup to close before any\r\n\t\t * buttonclick disables editor toolbar.\r\n\t\t * Maybe invoke this method AFTER dialog\r\n\t\t * is closed somehow?\r\n\t\t */\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tself.isDialogMode = false;\r\n\t\t\tself.blurEditor (); // force new activation to synch it all\r\n\t\t}, 100 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Blur editor. Simply by transferring the focus\r\n * to an inputfield, then hiding the inputfield.\r\n */\r\nEditorBinding.prototype.blurEditor = function () {\r\n\r\n\tvar input = this.getContentDocument ().getElementById ( \"focusableinput\" );\r\n\r\n\tif ( input != null ) {\r\n\t\tinput.style.display = \"block\";\r\n\t\tFocusBinding.focusElement ( input );\r\n\t\tinput.style.display = \"none\";\r\n\t} else {\r\n\t\tthrow \"Required element not found: focusableinput\";\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide cover when page initializes.\r\n * @implements {IActionListener}\r\n * @param {Action} action\r\n * @overloads {WindowBinding#handleAction}\r\n */\r\nEditorBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tEditorBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\tvar self = this;\r\n\tvar iframe = this.shadowTree.iframe;\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\t/*\r\n\t\t * Dispatch dirty events. Remember that this.isBlockingActions!\r\n\t\t */\r\n\t\tcase Binding.ACTION_DIRTY :\r\n\r\n\t\t\tif ( action.target != this ) {\r\n\t\t\t\tthis.checkForDirty ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked when contained page initializes.\r\n * @overloads {WindowBinding#_onPageInitialze}\r\n * @param {PageBinding} binding\r\n */\r\nEditorBinding.prototype._onPageInitialize = function ( binding ) {\r\n\r\n\t/*\r\n\t * Flex the content and hide the cover. Note that flex is repeated\r\n\t * on the finalize method in order to fix editors in lazy tabpanels.\r\n\t */\r\n\tif ( this._pageBinding == null ) {\r\n\r\n\t\tthis.reflex ();\r\n\t\tif ( this._coverBinding != null && this._coverBinding.isVisible ) {\r\n\t\t\tthis._coverBinding.hide ();\r\n\t\t}\r\n\t}\r\n\r\n\tEditorBinding.superclass._onPageInitialize.call ( this, binding );\r\n}\r\n\r\n/**\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#handleElement}\r\n * @param {Element} element\r\n */\r\nEditorBinding.prototype.handleElement = function ( element ) {\r\n\r\n\treturn true; // do handle element update\r\n};\r\n\r\n/**\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#updateElement}\r\n * @param {Element} element\r\n */\r\nEditorBinding.prototype.updateElement = function ( element ) {\r\n\r\n\treturn true; // stop crawling descendants\r\n};\r\n\r\n\r\n// IDATA .......................................................\r\n\r\n/**\r\n * Focus.\r\n * @implements {IFocusable}\r\n */\r\nEditorBinding.prototype.focus = DataBinding.prototype.focus;\r\n\r\n/**\r\n * Blur.\r\n * @implements {IFocusable}\r\n */\r\nEditorBinding.prototype.blur = DataBinding.prototype.blur;\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM\r\n * so that the server recieves something on form submit.\r\n * @implements {IData}\r\n */\r\nEditorBinding.prototype.manifest = function () {\r\n\r\n\tthis.shadowTree.dotnetinput.value = encodeURIComponent ( this.getValue ());\r\n};\r\n\r\n\r\n/**\r\n * @implements {IContextContainerBinding}\r\n */\r\n// ContextContainer ......................................................\r\nEditorBinding.prototype.getContextContainer = HTMLDataDialogBinding.prototype.getContextContainer;\r\n\r\n/**\r\n * @implements {IContextContainerBinding}\r\n */\r\nEditorBinding.prototype.setContextContainer = function (contextContainer) {\r\n\r\n\t//nothing now;\r\n}\r\n\r\n// ABSTRACT METHODS ......................................................\r\n\r\n/**\r\n * Get the editable window.\r\n * @return {DOMDocumentView}\r\n */\r\nEditorBinding.prototype.getEditorWindow = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Get the editable document.\r\n * @return {DOMDocument}\r\n */\r\nEditorBinding.prototype.getEditorDocument = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Get the associated contextmenu.\r\n * @return {EditorPopupBinding}\r\n */\r\nEditorBinding.prototype.getEditorPopupBinding = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Create selection bookmark, patching explorer focus dysfunction.\r\n */\r\nEditorBinding.prototype.createBookmark = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Restore selection focus for explorer.\r\n */\r\nEditorBinding.prototype.restoreBookmark = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Has bookmark\r\n * @return {boolean}\r\n */\r\nEditorBinding.prototype.hasBookmark = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Delete bookmark.\r\n */\r\nEditorBinding.prototype.deleteBookmark = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Reset undo-redo history.\r\n */\r\nEditorBinding.prototype.resetUndoRedo = Binding.ABSTRACT_METHOD;\r\n\r\n\r\n// ABSTRACT IDATA METHODS ............................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nEditorBinding.prototype.validate = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nEditorBinding.prototype.getValue = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nEditorBinding.prototype.getResult = Binding.ABSTRACT_METHOD;"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/EditorClickButtonBinding.js",
    "content": "EditorClickButtonBinding.prototype = new ClickButtonBinding;\r\nEditorClickButtonBinding.prototype.constructor = EditorClickButtonBinding;\r\nEditorClickButtonBinding.superclass = ClickButtonBinding.prototype;\r\n\r\n/**\r\n * We need a special binding for buttons in the editor because IE will loose focus on  \r\n * the editor selection if any HTML element is clicked *except* form elements, IMG \r\n * and A elements. We overload the method {@link ButtonBinding#buildDOMContent} \r\n * to inject an IMG element absolutely positioned on top of the toolbarbutton subchildren.\r\n * @implements {IWysiwygEditorComponent}\r\n * @implements {IEditorControlBinding}\r\n * @class\r\n */\r\nfunction EditorClickButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorClickButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {WysiwygEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * Indicates that editors should not blur \r\n\t * the toolbars when binding is handled.\r\n\t * @implements {IEditorControlBinding}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEditorControlBinding = true;\r\n\t\r\n\t/**\r\n\t * Indicates that editor should refocus \r\n\t * on the mouseup event.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEditorSimpleControl = true;\r\n\t\r\n\t/**\r\n\t * Shorthand the \"cmd\" property.\r\n\t * @type {string}\r\n\t */\r\n\tthis.cmd = null;\r\n\t\r\n\t/**\r\n\t * Shorthand the \"val\" property (not always used).\r\n\t * @type {string}\r\n\t */\r\n\tthis.val = null;\r\n\t\r\n\t/**\r\n\t * Shorthand the \"gui\" property (not always used).\r\n\t * @type {string}\r\n\t */\r\n\tthis.gui = null;\r\n\t\r\n\t\r\n\t// TINYMCE CONTROL .............................................\r\n\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {TinyMCE_Engine} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE instance.\r\n\t * @type {TinyMCE_Control}\r\n\t */\r\n\tthis._tinyInstance = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {TinyMCE_CompositeTheme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\t\r\n\t\r\n\t// CODEPRESS CONTROL .............................................\r\n\t\r\n\t/**\r\n\t * This element has been spirited with some extendo  \r\n\t * functions constituting the core CorePress ballyhoo.  \r\n\t * @type {HTMLIframeElement}\r\n\t */\r\n\tthis._codePressFrame = null;\r\n\t\r\n\t/**\r\n\t * Somehow there are two CodePress objects in this \r\n\t * version of CodePress. This is the \"engine\" version.\r\n\t * @type {CodePress}\r\n\t */\r\n\tthis._codePressEngine = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorClickButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[EditorClickButtonBinding]\";\r\n}\r\n\r\n/**\r\n * Register as editor component.\r\n * @overloads {ClickButtonBinding#onBindingAttach}\r\n */\r\nEditorClickButtonBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tEditorClickButtonBinding.superclass.onBindingAttach.call ( this );\r\n\tthis._setupEditorButton ();\r\n}\r\n\r\n/**\r\n * Setup as editor button.\r\n */\r\nEditorClickButtonBinding.prototype._setupEditorButton = function () {\r\n\r\n\tthis.cmd = this.getProperty ( \"cmd\" );\r\n\tthis.val = this.getProperty ( \"val\" );\r\n\tthis.gui = this.getProperty ( \"gui\" );\r\n\t\r\n\tif ( this.getProperty ( \"editorcontrol\" ) == false ) {\r\n\t\tthis.isEditorControlBinding = false;\r\n\t}\r\n\t\r\n\t/*\r\n\t * THIS WILL FAIL IN SOURCECODEEDITOR!\r\n\t */\r\n\tvar tinywindow = this.bindingWindow.bindingMap.tinywindow;\r\n\tvar codepresswin = this.bindingWindow.bindingMap.codepresswindow;\r\n\t\r\n\tif ( tinywindow ) {\r\n\t\tEditorBinding.registerComponent ( this, tinywindow );\r\n\t} else if ( codepresswin ) {\r\n\t\tEditorBinding.registerComponent ( this, codepresswin );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {ButtonBinding#buildDOMContent}\r\n */\r\nEditorClickButtonBinding.prototype.buildDOMContent = function () {\r\n\r\n\tEditorClickButtonBinding.superclass.buildDOMContent.call ( this );\r\n\tthis._buildDesignModeSanitizer();\r\n\r\n}\r\n\r\n/**\r\n * Initialize as editor component.\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {WysiwygEditorBinding} editor\r\n * @param {TinyMCE_Engine} engine\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_CompositeTheme} theme\r\n */\r\nEditorClickButtonBinding.prototype.initializeComponent = function ( editor, engine, instance, theme ) {\r\n\r\n\tthis._editorBinding = editor;\r\n\tthis._tinyEngine\t= engine;\r\n\tthis._tinyInstance \t= instance;\r\n\tthis._tinyTheme \t= theme;\r\n\t\r\n\tthis._setupEditorBookmarking ();\r\n}\r\n\r\n/**\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {SourceEditorBinding} editor\r\n * @param {HTMLIframeElement} frame\r\n * @param {CodePress} engine\r\n */\r\nEditorClickButtonBinding.prototype.initializeSourceEditorComponent = function ( editor, frame, engine ) {\r\n\t\r\n\tthis._editorBinding = editor;\r\n\tthis._codePressFrame = frame;\r\n\tthis._codePressEngine = engine;\r\n}\r\n\r\n/**\r\n * Places an IMG element on top of all other elements. This feature is \r\n * disabled for Mozilla because it makes the button draggable; it's not \r\n * needed in Mozilla anyway.\r\n */\r\nEditorClickButtonBinding.prototype._buildDesignModeSanitizer = function () {\r\n\r\n\tif (Client.isAnyExplorer) {\r\n\t\tvar img = this.bindingDocument.createElement ( \"img\" );\r\n\t\timg.className = \"designmodesanitizer\";\r\n\t\timg.src = Resolver.resolve(\"${root}/images/blank.png\");\r\n\t\timg.ondragstart = function (e) { e.preventDefault(); }\r\n\t\tthis.shadowTree.designmodesanitizer = img;\r\n\t\tthis.bindingElement.appendChild(img);\r\n\t}\r\n\t\r\n}\r\n\r\n\r\n/**\r\n * Bookmark editor selection when the button is handled. \r\n * @see {EditorClickButtonBinding#_setupEditorBookmarking}\r\n */\r\nEditorClickButtonBinding.prototype._setupEditorBookmarking = function () {\r\n\t\r\n\tvar editor = this._editorBinding;\r\n\t\r\n\tif ( editor != null ) {\r\n\t\t\r\n\t\tvar self = this;\r\n\t\tvar handler = { \r\n\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\tswitch ( e.type ) {\r\n\t\t\t\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\t\t\t\tif ( !editor.hasBookmark ()) {\r\n\t\t\t\t\t\t\teditor.createBookmark ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase DOMEvents.MOUSEUP :\r\n\t\t\t\t\t\tif ( self.isEditorSimpleControl ) {\r\n\t\t\t\t\t\t\tif ( self.popupBinding == null ) { // hacking a bit here...\r\n\t\t\t\t\t\t\t\tif ( editor.hasBookmark ()) {\r\n\t\t\t\t\t\t\t\t\teditor.restoreBookmark ();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tDOMEvents.addEventListener ( this.bindingElement, DOMEvents.MOUSEDOWN, handler );\r\n\t\tDOMEvents.addEventListener ( this.bindingElement, DOMEvents.MOUSEUP, handler );\r\n\t}\r\n}\r\n\r\n/**\r\n * EditorClickButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {EditorClickButtonBinding}\r\n */\r\nEditorClickButtonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:clickbutton\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, EditorClickButtonBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/EditorMenuItemBinding.js",
    "content": "EditorMenuItemBinding.prototype = new MenuItemBinding;\r\nEditorMenuItemBinding.prototype.constructor = EditorMenuItemBinding;\r\nEditorMenuItemBinding.superclass = MenuItemBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * @deprecated\r\n * @implements {IEditorControlBinding}\r\n */\r\nfunction EditorMenuItemBinding () {\r\n\r\n\t/** \r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorMenuItemBinding\" );\r\n\t\r\n\t/**\r\n\t * Indicates that editors should not blur \r\n\t * the toolbars when binding is handled.\r\n\t * @implements {IEditorControlBinding}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEditorControlBinding = true;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorMenuItemBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[EditorMenuItemBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {EditorMenuItemBinding#buildDOMContent}\r\n */\r\nEditorMenuItemBinding.prototype.buildDOMContent = function () {\r\n\t\r\n\tEditorMenuItemBinding.superclass.buildDOMContent.call ( this );\r\n\t\r\n\tif (Client.isAnyExplorer) {\r\n\t\tthis._buildDesignModeSanitizer ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Places an IMG element on top of all other elements. This feature is \r\n * disabled for Mozilla because it makes the button draggable; it's not \r\n * needed in Mozilla anyway.\r\n */\r\nEditorMenuItemBinding.prototype._buildDesignModeSanitizer = function () {\r\n\t\r\n\tif (Client.isAnyExplorer) {\r\n\t\tvar img = this.bindingDocument.createElement ( \"img\" );\r\n\t\timg.className = \"designmodesanitizer\";\r\n\t\timg.src = Resolver.resolve(\"${root}/images/blank.png\");\r\n\t\timg.ondragstart = function (e) { e.preventDefault(); }\r\n\t\tthis.shadowTree.designmodesanitizer = img;\r\n\t\tthis.bindingElement.appendChild ( img );\r\n\t}\r\n}\r\n\r\n/**\r\n * EditorMenuItemBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {EditorMenuItemBinding}\r\n */\r\nEditorMenuItemBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:menuitem\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, EditorMenuItemBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/EditorPopupBinding.js",
    "content": "EditorPopupBinding.prototype = new PopupBinding;\r\nEditorPopupBinding.prototype.constructor = EditorPopupBinding;\r\nEditorPopupBinding.superclass = PopupBinding.prototype;\r\n\r\n/*\r\n * Subclass defines this.\r\n */\r\nEditorPopupBinding.CONTENT_TEMPLATE = null;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction EditorPopupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorPopupBinding\" );\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isEditorPopupBindingInitialized = false;\r\n\t\r\n\t/** \r\n\t * This is set by the EditorBinding. Remember that   \r\n\t * all editor instances use the same popup.\r\n\t * @see {EditorBinding#handleEvent}\r\n\t * @type {EditorBinding}\r\n\t */\r\n\tthis.editorBinding = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorPopupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[EditorPopupBinding]\";\r\n}\r\n\r\n/**\r\n * To reduce startup time, menu generation is delayed until first show.\r\n * @overloads {PopupBinding#show}\r\n */\r\nEditorPopupBinding.prototype.show = function () {\r\n\t\r\n\tif ( !this._isEditorPopupBindingInitialized ) {\r\n\t\tvar self = this;\r\n\t\tApplication.lock ( this );\r\n\t\tsetTimeout ( function () { // timeout allows mastercover to appear\r\n\t\t\tself._initialize ();\r\n\t\t\tApplication.unlock ( self );\r\n\t\t}, 0 );\r\n\t} else {\r\n\t\tEditorPopupBinding.superclass.show.call ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Initialize menu content.\r\n * {@see EditorBinding#handleEvent}\r\n */\r\nEditorPopupBinding.prototype._initialize = function () {\r\n\t\r\n\tif ( !this._isEditorPopupBindingInitialized ) {\r\n\t\tthis.subTreeFromString ( \r\n\t\t\tTemplates.getTemplateElementText ( \r\n\t\t\t\tthis.constructor.CONTENT_TEMPLATE \r\n\t\t\t)\r\n\t\t);\r\n\t\tthis._bodyBinding = this.getChildBindingByLocalName ( \"menubody\" );\r\n\t\tthis.addActionListener ( MenuItemBinding.ACTION_COMMAND, this );\r\n\t\tthis._indexMenuContent ();\r\n\t\tthis._isEditorPopupBindingInitialized = true;\r\n\t\tthis._onInitialize ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Show popup when initialized. Move to separate method \r\n * so that subclasses may overload at this point.\r\n */\r\nEditorPopupBinding.prototype._onInitialize = function () {\r\n\t\r\n\tthis._configure ();\r\n\tthis.show ();\r\n}\r\n\r\n/**\r\n * Configure.\r\n */\r\nEditorPopupBinding.prototype.configure = function () {\r\n\t\r\n\tif ( this._isEditorPopupBindingInitialized ) {\r\n\t\tthis._configure ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Subclass must overwrite this.\r\n */\r\nEditorPopupBinding.prototype._configure = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * Hide menugroups.\r\n * @param {string} rel\r\n */\r\nEditorPopupBinding.prototype._showMenuGroups = function ( rel ) {\r\n\tvar menuGroup = this._menuGroups[rel];\r\n\tif(menuGroup instanceof List)\r\n\t{\r\n\t\tmenuGroup.each(function (group) {\r\n\t\t\tgroup.show ();\r\n\t\t});\r\n\t}\r\n}\r\n\r\n/**\r\n * Show menugroups.\r\n * @param {string} rel\r\n */\r\nEditorPopupBinding.prototype._hideMenuGroups = function (rel) {\r\n\tvar menuGroup = this._menuGroups[rel];\r\n\tif (menuGroup instanceof List) {\r\n\t\tmenuGroup.each(function (group) {\r\n\t\t\tgroup.hide();\r\n\t\t});\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Subclass may overload this.\r\n * @overloads {PopupBinding#handleAction}\r\n * @param {Action} action\r\n * @return {boolean}\r\n */\r\nEditorPopupBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tEditorPopupBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tif ( action.type == MenuItemBinding.ACTION_COMMAND ) {\r\n\t\t\r\n\t\tthis.hide (); // this should happen automatically, but ie doesn't get it\r\n\t\t\r\n\t\tvar cmd = binding.getProperty ( \"cmd\" );\r\n\t\tvar gui = binding.getProperty ( \"gui\" );\r\n\t\tvar val = binding.getProperty ( \"val\" );\r\n\t\t\r\n\t\tthis.handleCommand ( cmd, gui, val );\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle that command.\r\n * @param {string} cmd\r\n * @param [string} gui\r\n * @param {string} val\r\n */\r\nEditorPopupBinding.prototype.handleCommand = Binding.ABSTRACT_METHOD;"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/EditorSelectorBinding.js",
    "content": "EditorSelectorBinding.prototype = new SelectorBinding;\r\nEditorSelectorBinding.prototype.constructor = EditorSelectorBinding;\r\nEditorSelectorBinding.superclass = SelectorBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * Bookmarking cursor position and selection status in \r\n * the editor whenever the selector is handled. \r\n * Restore selection when done.\r\n * @implements {IWysiwygEditorComponent}\r\n */\r\nfunction EditorSelectorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorSelectorBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {WysiwygEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {TinyMCE_Engine} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE instance.\r\n\t * @type {TinyMCE_Control}\r\n\t */\r\n\tthis._tinyInstance = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {TinyMCE_CompositeTheme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\t\t\r\n\t/**\r\n\t * TODO: since this property is obviously not constant, lowercase it!\r\n\t * @overwrites {SelectorBinding#BUTTON_IMPLEMENTATION}\r\n\t * @type {class}\r\n\t */\r\n\tthis.BUTTON_IMPLEMENTATION = EditorClickButtonBinding;\r\n\t\r\n\t/*\r\n\t * @overwrites {SelectorBinding#MENUITEM_IMPLEMENTATION}\r\n\t * @type {class}\r\n\t */\r\n\tthis.MENUITEM_IMPLEMENTATION = EditorMenuItemBinding;\r\n\t\r\n\t/* \r\n\t * Never recieve the focus!\r\n\t * @overwrites {SelectorBinding#isFocusable}\r\n\t */\r\n\tthis.isFocusable = false;\r\n\t\r\n\t/**\r\n\t * Indicates that editors should not blur \r\n\t * the toolbars when binding is handled.\r\n\t * @implements {IEditorControlBinding}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEditorControlBinding = true;\r\n\r\n\t/**\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis.isSearchSelectionEnabled = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[EditorSelectorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {SelectorBinding#onBindingAttach}\r\n */\r\nEditorSelectorBinding.prototype.onBindingAttach = function () {\r\n\r\n\t/*\r\n\t * Should editor activation be maintained while handling this selector? \r\n\t */\r\n\tif ( this.getProperty ( \"editorcontrol\" ) == false ) {\r\n\t\tthis.isEditorControlBinding = false;\r\n\t\tthis.BUTTON_IMPLEMENTATION = ClickButtonBinding;\r\n\t\tthis.MENUITEM_IMPLEMENTATION = MenuItemBinding;\r\n\t}\r\n\t\r\n\t/*\r\n\t * THIS WILL FAIL IN SOURCECODEEDITOR!\r\n\t */\r\n\tvar tinywindow = this.bindingWindow.bindingMap.tinywindow;\r\n\tEditorBinding.registerComponent ( this, tinywindow );\r\n\t\r\n\tif (Client.isPad) {\r\n\t\tthis.setProperty(\"width\", 140);\r\n\t}\r\n\t\r\n\t/*\r\n\t * Executed last so that isEditorControlBinding \r\n\t * is determined before we build the button.\r\n\t */\r\n\tEditorSelectorBinding.superclass.onBindingAttach.call ( this );\r\n}\r\n\r\n/** \r\n * Button must inherit IEditorControlBinding status.\r\n * @overloads {SelectorBinding#buildButton}\r\n */\r\nEditorSelectorBinding.prototype.buildButton = function () {\r\n\r\n\tEditorSelectorBinding.superclass.buildButton.call(this);\r\n\tthis._buttonBinding.isEditorSimpleControl = false;\r\n\tif ( this.isEditorControlBinding == false ) {\r\n\t\tthis._buttonBinding.isEditorControlBinding = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Register as node change handler when TinyMCE is initialized.\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {WysiwygEditorBinding} editor\r\n * @param {TinyMCE_Engine} engine\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_CompositeTheme} theme\r\n */\r\nEditorSelectorBinding.prototype.initializeComponent = function ( editor, engine, instance, theme ) {\r\n\r\n\tthis._editorBinding = editor;\r\n\tthis._tinyEngine\t= engine;\r\n\tthis._tinyInstance \t= instance;\r\n\tthis._tinyTheme \t= theme;\r\n}\r\n\r\n/**\r\n * Restore selection just after action invoked - unless a dialog was opened...\r\n * @overloads {SelectorBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nEditorSelectorBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tEditorSelectorBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\t\t\tif ( this._editorBinding.hasBookmark ()) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tif ( !self._editorBinding.isDialogMode ) {\r\n\t\t\t\t\t\tself._editorBinding.restoreBookmark();\r\n\t\t\t\t\t\tself._tinyInstance.focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Never grab keyboard!\r\n * @overwrites {SelectorBinding#_grabKeyboard}\r\n */\r\nEditorSelectorBinding.prototype._grabKeyboard = function () {}\r\n\r\n/**\r\n * Never release keyboard!\r\n * @overwrites {SelectorBinding#_releaseKeyboard}\r\n */\r\nEditorSelectorBinding.prototype._releaseKeyboard = function () {}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/EditorToolBarButtonBinding.js",
    "content": "EditorToolBarButtonBinding.prototype = new ToolBarButtonBinding;\r\nEditorToolBarButtonBinding.prototype.constructor = EditorToolBarButtonBinding;\r\nEditorToolBarButtonBinding.superclass = ToolBarButtonBinding.prototype;\r\n\r\n/**\r\n * We need a special binding for buttons in the editor because IE will loose focus on  \r\n * the editor selection if any HTML element is clicked *except* form elements, IMG \r\n * and A elements. We overload the method {@link ButtonBinding#buildDOMContent} \r\n * to inject an IMG element absolutely positioned on top of the toolbarbutton subchildren.\r\n * @implements {IWysiwygEditorComponent}\r\n * @implements {IEditorControlBinding}\r\n * @class\r\n */\r\nfunction EditorToolBarButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorToolBarButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {WysiwygEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {TinyMCE_Engine} \r\n\t */\r\n\tthis._tinyEngine = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE instance.\r\n\t * @type {TinyMCE_Control}\r\n\t */\r\n\tthis._tinyInstance = null;\r\n\t\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {TinyMCE_CompositeTheme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\t\r\n\t/**\r\n\t * Indicates that editor should refocus \r\n\t * on the mouseup event.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEditorSimpleControl = true;\r\n\t\r\n\t/**\r\n\t * Indicates that editors should not blur \r\n\t * the toolbars when binding is handled.\r\n\t * @implements {IEditorControlBinding}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEditorControlBinding = true;\r\n\t\r\n\t/**\r\n\t * Shorthand the \"cmd\" property.\r\n\t * @type {string}\r\n\t */\r\n\tthis.cmd = null;\r\n\t\r\n\t/**\r\n\t * Shorthand the \"val\" property (not always used).\r\n\t * @type {string}\r\n\t */\r\n\tthis.val = null;\r\n\t\r\n\t/**\r\n\t * Shorthand the \"gui\" property (not always used).\r\n\t * @type {string}\r\n\t */\r\n\tthis.gui = null;\r\n\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorToolBarButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[EditorToolBarButtonBinding]\";\r\n}\r\n\r\n/**\r\n * Register as editor component.\r\n * @overloads {ToolBarButtonBinding#onBindingAttach}\r\n */\r\nEditorToolBarButtonBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tEditorToolBarButtonBinding.superclass.onBindingAttach.call ( this );\r\n\tthis._setupEditorButton ();\r\n}\r\n\r\n/**\r\n * Setup as editor button.\r\n */\r\nEditorToolBarButtonBinding.prototype._setupEditorButton = EditorClickButtonBinding.prototype._setupEditorButton;\r\n\r\n/**\r\n * @overloads {ButtonBinding#buildDOMContent}\r\n */\r\nEditorToolBarButtonBinding.prototype.buildDOMContent = function () {\r\n\r\n\tEditorToolBarButtonBinding.superclass.buildDOMContent.call ( this );\r\n\tthis._buildDesignModeSanitizer ();\r\n}\r\n\r\n/**\r\n * Initialize as editor component.\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {WysiwygEditorBinding} editor\r\n * @param {TinyMCE_Engine} engine\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_CompositeTheme} theme\r\n */\r\nEditorToolBarButtonBinding.prototype.initializeComponent = EditorClickButtonBinding.prototype.initializeComponent;\r\n\r\n/**\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {SourceEditorBinding} editor\r\n * @param {HTMLIframeElement} frame\r\n * @param {CodePress} engine\r\n */\r\nEditorToolBarButtonBinding.prototype.initializeSourceEditorComponent = EditorClickButtonBinding.prototype.initializeSourceEditorComponent;\r\n\r\n/**\r\n * Places an IMG element on top of all other elements. This feature is \r\n * disabled for Mozilla because it makes the button draggable; it's not \r\n * needed in Mozilla anyway.\r\n * @see {EditorClickButtonBinding#_buildDesignModeSanitizer}\r\n */\r\nEditorToolBarButtonBinding.prototype._buildDesignModeSanitizer = EditorClickButtonBinding.prototype._buildDesignModeSanitizer;\r\n\r\n/**\r\n * Bookmark editor selection when the button is handled.\r\n * @see {EditorClickButtonBinding#_setupEditorBookmarking}\r\n */\r\nEditorToolBarButtonBinding.prototype._setupEditorBookmarking = EditorClickButtonBinding.prototype._setupEditorBookmarking;\r\n\r\n/**\r\n * EditorToolBarButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {EditorToolBarButtonBinding}\r\n */\r\nEditorToolBarButtonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbarbutton\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, EditorToolBarButtonBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/codemirroreditor/CodeMirrorEditorBinding.js",
    "content": "﻿CodeMirrorEditorBinding.prototype = new EditorBinding;\r\nCodeMirrorEditorBinding.prototype.constructor = CodeMirrorEditorBinding;\r\nCodeMirrorEditorBinding.superclass = EditorBinding.prototype;\r\n\r\nCodeMirrorEditorBinding.ACTION_INITIALIZED = \"codemirroreditor initialized\";\r\n\r\n/**\r\n* Supported syntax list (although not checked for).\r\n* TODO: CONSTRUCT CODEMIRROR SYNTAX PLUGINS!\r\n* type {object}\r\n*/\r\nCodeMirrorEditorBinding.syntax = {\r\n\r\n\tTEXT: \"text\",\r\n\tXML: \"xml\",\r\n\tXSL: \"xsl\",\r\n\tHTML: \"html\",\r\n\tCSS: \"css\",\r\n\tJAVASCRIPT: \"js\",\r\n\tCSHARP: \"cs\",\r\n\tCSHTML: \"cshtml\",\r\n\tASPX: \"aspx\",\r\n\tSQL: \"sql\",\r\n\tSASS: \"sass\"\r\n}\r\n\r\n/**\r\n* @class\r\n*/\r\nfunction CodeMirrorEditorBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"CodeMirrorEditorBinding\");\r\n\r\n\t/**\r\n\t* @type {string}\r\n\t*/\r\n\tthis.action_initialized = CodeMirrorEditorBinding.ACTION_INITIALIZED;\r\n\r\n\t/**\r\n\t* Hosted document.\r\n\t* @type {string}\r\n\t*/\r\n\tthis.url_default = \"${root}/content/misc/editors/codemirroreditor/codemirroreditor.aspx\"; // language=${syntax} \r\n\r\n\t/**\r\n\t* TODO: Is this used?\r\n\t* @type {DocumentView}\r\n\t*/\r\n\tthis._editorWindowBinding = null;\r\n\r\n\t/**\r\n\t* @type {DocumentView}\r\n\t*/\r\n\tthis._codemirrorWindow = null;\r\n\r\n\t/**\r\n\t* @type {CodeMirror}\r\n\t*/\r\n\tthis._codemirrorEditor = null;\r\n\r\n\t/**\r\n\t* @type {codemirrorWrapperElement}\r\n\t*/\r\n\tthis._codemirrorWrapperElement = null;\r\n\r\n\t/**\r\n\t* Syntax defaults to plain text.\r\n\t* @type {string}\r\n\t*/\r\n\tthis.syntax = new String(CodeMirrorEditorBinding.syntax.TEXT);\r\n\r\n\t/**\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis._isPlainEditMode = false;\r\n\r\n\t/**\r\n\t* @implements {IData}\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis.isFocusable = true;\r\n\r\n\t/**\r\n\t* True when embedded inside the visual editor. \r\n\t* TODO: Convert to public property - remove the underscore!\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis._isEmbedded = false;\r\n\r\n\t/**\r\n\t* Flip this by the \"validate\" property. When true, content \r\n\t* will be validated according to a stricter ruleset. For now, \r\n\t* this is only enabled for HTML syntax files.\r\n\t*/\r\n\tthis._hasStrictValidation = false;\r\n\r\n\t/**\r\n\t*  If false then editor can save invalid document, but ask this from user.\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis._strictSave = true;\r\n\r\n\t/**\r\n\t* This new thingy will rule all validation.\r\n\t* TODO: Deprecate _hasStrictValidation eventually...\r\n\t* @type {String}\r\n\t*/\r\n\tthis._validator = null;\r\n\r\n\t/**\r\n\t* Firefox 4 beta seems to have a problem with completely empty \r\n\t* documents (the root PRE tag is missing) so we will fallback \r\n\t* to this zero-width-space. Removed again on save.\r\n\t* @see {CodeMirrorEditorBinding#getContent}\r\n\t* @overwrites {EditorBinding#_startContent}\r\n\t*\r\n\tthis._startContent = \"\\u200B\";\r\n\t*/\r\n\r\n\tthis._startContent = \"\";\r\n\r\n\t/*\r\n\t* Returnable.\r\n\t*/\r\n\treturn this;\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nCodeMirrorEditorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[CodeMirrorEditorBinding]\";\r\n}\r\n\r\n/**\r\n* @overloads {EditorBinding#onBindingRegister}\r\n*/\r\nCodeMirrorEditorBinding.prototype.onBindingRegister = function () {\r\n\r\n\t/* \r\n\t* Force an early indexation of CodeMirrorEditorBinding strings  \r\n\t* to supress occasional glitches in string fetching.\r\n\t*/\r\n\tCodeMirrorEditorBinding.superclass.onBindingRegister.call(this);\r\n\tStringBundle.getString(\"Composite.Web.SourceEditor\", \"Preload.Key\");\r\n}\r\n\r\n/**\r\n* @overloads {Binding#onBindingAttach}\r\n*/\r\nCodeMirrorEditorBinding.prototype.onBindingAttach = function () {\r\n\r\n\tthis.subscribe(BroadcastMessages.CODEMIRROR_LOADED);\r\n\r\n\r\n\t/*\r\n\t* This has something to do with the editor \r\n\t* being embedded inside the visual editor.\r\n\t* TODO: Refactor out this weird hardcode.\r\n\t*/\r\n\tif (this.getProperty(\"embedded\") == true) {\r\n\t\tthis._isEmbedded = true;\r\n\t}\r\n\r\n\t/*\r\n\t* Enable strict validation?\r\n\t*/\r\n\tvar validate = this.getProperty(\"validate\");\r\n\tif (validate == true) {\r\n\t\tthis._hasStrictValidation = true;\r\n\t}\r\n\t\r\n\t/*\r\n\t* Disable strict validation?\r\n\t*/\r\n\tvar strictsave = this.getProperty(\"strictsave\");\r\n\tif (strictsave === false) {\r\n\t\tthis._strictSave = false;\r\n\t}\r\n\r\n\t/*\r\n\t* Assign a validator?\r\n\t*/\r\n\tvar validator = this.getProperty(\"validator\");\r\n\tif (validator != null) {\r\n\t\tthis._validator = validator;\r\n\t}\r\n\r\n\t/*\r\n\t* Assign syntax\r\n\t*/\r\n\tthis.syntax = this.getProperty(\"syntax\");\r\n\r\n\t/*\r\n\t* While developing, mount test file based on current syntax\r\n\t*/\r\n\tif (this.getProperty(\"debug\")) {\r\n\t\tthis._startContent = Templates.getPlainText(\r\n\t\t\t\"sourcecodeeditor/\" + this.syntax + \".txt\"\r\n\t\t);\r\n\t}\r\n\r\n\t// finally call super method.\r\n\tCodeMirrorEditorBinding.superclass.onBindingAttach.call(this);\r\n}\r\n\r\n/**\r\n* @implements {IBroadcastListener}\r\n* @param {string} broadcast\r\n* @param {object} arg\r\n*/\r\nCodeMirrorEditorBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tCodeMirrorEditorBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\tswitch (broadcast) {\r\n\r\n\t\tcase BroadcastMessages.CODEMIRROR_LOADED:\r\n\r\n\t\t\tvar windowBinding = this.getContentWindow().bindingMap.codemirrorwindow;\r\n\r\n\t\t\tif (windowBinding != null) {\r\n\r\n\t\t\t\tvar contentWindow = windowBinding.getContentWindow();\r\n\r\n\t\t\t\tif (arg.broadcastWindow == contentWindow) {\r\n\r\n\r\n\t\t\t\t\t// identification\r\n\t\t\t\t\tthis._codemirrorWindow = contentWindow;\r\n\t\t\t\t\tthis._codemirrorEditor = arg.codemirrorEditor;\r\n\t\t\t\t\tthis._codemirrorWrapperElement = arg.codemirrorEditor.getWrapperElement();\r\n\r\n\t\t\t\t\t// syntax\r\n\t\t\t\t\tswitch (this.syntax) {\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.XML:\r\n\t\t\t\t\t\t\tthis._codemirrorEditor.setOption(\"mode\", \"application/xml\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.XSL:\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.HTML:\r\n\t\t\t\t\t\t\tthis._codemirrorEditor.setOption(\"mode\", \"text/html\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.CSS:\r\n\t\t\t\t\t\t\tthis._codemirrorEditor.setOption(\"mode\", \"text/css\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t    case CodeMirrorEditorBinding.syntax.CSHARP:\r\n\t\t\t\t\t        this._codemirrorEditor.setOption(\"mode\", \"text/x-csharp\");\r\n\t\t\t\t\t        break;\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.CSHTML:\r\n\t\t\t\t\t\t\tthis._codemirrorEditor.setOption(\"mode\", \"application/x-cshtml\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.JAVASCRIPT:\r\n\t\t\t\t\t\t\tthis._codemirrorEditor.setOption(\"mode\", \"text/javascript\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.ASPX:\r\n\t\t\t\t\t\t\tthis._codemirrorEditor.setOption(\"mode\", \"application/x-aspx\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.SASS:\r\n\t\t\t\t\t\t\tthis._codemirrorEditor.setOption(\"mode\", \"text/x-sass\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t    case CodeMirrorEditorBinding.syntax.SQL:\r\n\t\t\t\t\t    \tthis._codemirrorEditor.setOption(\"mode\", \"text/x-mssql\");\r\n\t\t\t\t\t        break;\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.TEXT:\r\n\t\t\t\t\t\t\tthis._codemirrorEditor.setOption(\"mode\", \"\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// init components \r\n\t\t\t\t\tthis.initializeEditorComponents(windowBinding);\r\n\r\n\t\t\t\t\t// dirtyfication\r\n\t\t\t\t\tvar self = this;\r\n\r\n\t\t\t\t\tthis._codemirrorEditor.on(\"change\",\r\n\t\t\t\t\t\tfunction (e) {\r\n\t\t\t\t\t\t\tself.checkForDirty();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tthis._codemirrorEditor.on(\"focus\",\r\n\t\t\t\t\t\tfunction (e) {\r\n\t\t\t\t\t\t\tself._activateEditor(true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* We have the editor but do we have the page? \r\n\t\t\t\t\t* if yes, initialize, otherwise wait for page.\r\n\t\t\t\t\t* @see {CodeMirrorEditorBinding#_onPageInitialize}\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tif (this._pageBinding != null) {\r\n\t\t\t\t\t\tthis._initialize();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.unsubscribe(broadcast);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n* Invoked when contained page initializes.\r\n* @overloads {EditorBinding#_onPageInitialze}\r\n* @param {PageBinding} binding\r\n*/\r\nCodeMirrorEditorBinding.prototype._onPageInitialize = function (binding) {\r\n\r\n\tCodeMirrorEditorBinding.superclass._onPageInitialize.call(this, binding);\r\n\r\n\t/*\r\n\t* Mozilla depends on CodePress for initialize. Explorer may go ahead.\r\n\t*/\r\n\tif (Client.isExplorer || this._codemirrorEditor != null) {\r\n\t\tthis._initialize();\r\n\t}\r\n}\r\n\r\n/**\r\n* Activate editor.\r\n* @param {boolean} isActivate \r\n*/\r\nCodeMirrorEditorBinding.prototype._activateEditor = function (isActivate) {\r\n\tif (isActivate != this._isActivated || this.isFocusable && !this.isFocused) {\r\n\r\n\t\tthis._isActivated = isActivate;\r\n\t\tEditorBinding.isActive = isActivate;\r\n\r\n\t\t/*\r\n\t\t* Enable all keyboard keys.\r\n\t\t*/\r\n\t\tvar handler = this._codemirrorWindow.standardEventHandler;\r\n\r\n\t\tif (isActivate) {\r\n\t\t\thandler.enableNativeKeys(true);\r\n\t\t} else {\r\n\t\t\thandler.disableNativeKeys();\r\n\t\t}\r\n\r\n\r\n\t\t/*\r\n\t\t* Update \"active\" broadcaster.\r\n\t\t*/\r\n\t\tvar broadcaster = this.getContentWindow().bindingMap.broadcasterIsActive;\r\n\t\tif (broadcaster != null) {\r\n\t\t\tif (isActivate) {\r\n\t\t\t\tbroadcaster.enable();\r\n\t\t\t} else {\r\n\t\t\t\tbroadcaster.disable();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t* Update focus status.\r\n\t\t*/\r\n\t\tif (isActivate) {\r\n\t\t\tthis.focus();//IE\r\n\t\t\tthis._codemirrorWindow.focus();//Webkit\r\n\t\t} else {\r\n\t\t\tthis._codemirrorWindow.blur();//Webkit\r\n\t\t\tthis.blur();//IE\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n* @param {string} cmd\r\n* @param {boolean} gui\r\n* @param {string} val\r\n*/\r\nCodeMirrorEditorBinding.prototype.handleCommand = function (cmd, gui, val) {\r\n\r\n\tvar isCommandHandled = CodeMirrorEditorBinding.superclass.handleCommand.call(this, cmd, val);\r\n\r\n\treturn isCommandHandled;\r\n}\r\n\r\n\r\n\r\n\r\n/**\r\n* Finalize initialization.\r\n* @overloads {EditorBinding._finalize}\r\n*/\r\nCodeMirrorEditorBinding.prototype._finalize = function () {\r\n\r\n\tthis.setContent(this._startContent);\r\n\tCodeMirrorEditorBinding.superclass._finalize.call(this);\r\n}\r\n\r\n/**\r\n* Initialize component. After startup, this method is invoked \r\n* directly by method EditorBinding.registerComponent.\r\n* @param {IEditorComponent} binding\r\n*/\r\nCodeMirrorEditorBinding.prototype.initializeEditorComponent = function (binding) {\r\n\r\n\tbinding.initializeSourceEditorComponent(\r\n\t\tthis,\r\n\t\tthis._codemirrorEditor\r\n\t);\r\n}\r\n\r\n/**\r\n* @param {MouseEvent} e\r\n*/\r\nCodeMirrorEditorBinding.prototype.handleContextMenu = function (e) {\r\n\r\n\t/*\r\n\tthis._popupBinding.configure ( this, this._codePressFrame, this._codePressEngine );\r\n\tCodeMirrorEditorBinding.superclass.handleContextMenu.call ( this, e );\r\n\t*/\r\n}\r\n\r\n/**\r\n* @return {SourceCodeEditorPopupBinding}\r\n*/\r\nCodeMirrorEditorBinding.prototype.getEditorPopupBinding = function () {\r\n\r\n\treturn top.app.bindingMap.sourcecodeeditorpopup;\r\n}\r\n\r\n/**\r\n* Get editor window.\r\n* @return {DOMDocumentView}\r\n*/\r\nCodeMirrorEditorBinding.prototype.getEditorWindow = function () {\r\n\r\n\treturn this._codemirrorWindow;\r\n}\r\n\r\n/**\r\n* Get editor document.\r\n* @return {DOMDocument}\r\n*/\r\nCodeMirrorEditorBinding.prototype.getEditorDocument = function () {\r\n\r\n\tif (this._codemirrorWrapperElement != null)\r\n\t\treturn this._codemirrorWrapperElement.ownerDocument;\r\n\treturn null;\r\n}\r\n\r\n/**\r\n* Set content.\r\n* @param {string} string\r\n* @return {boolean} True if content can be mounted. HARDCODED for now.\r\n*/\r\nCodeMirrorEditorBinding.prototype.setContent = function (string) {\r\n\r\n\tif (!this._isFinalized) {\r\n\t\tif (string != this._startContent) {\r\n\t\t\tthis._startContent = string;\r\n\t\t}\r\n\t}\r\n\r\n\tif (this.isInitialized && this.getContentWindow().bindingMap != null) {\r\n\r\n\t\t/* \r\n\t\t* In structured content, newlines are indicated by &#xA; \r\n\t\t* We replace this now, but it should be done elsewhere...\r\n\t\t*\r\n\t\tstring = string.replace ( /&#xA;/g, \"\\n\" );\r\n\t\t*/\r\n\t\tthis.getContentWindow().bindingMap.editorpage.setContent(string);\r\n\t\tthis.resetUndoRedo();\r\n\r\n\t\t/*\r\n\t\t* Reset checksum system.\r\n\t\t*/\r\n\t\tthis._checksum = this.getCheckSum();\r\n\t}\r\n\r\n\t/*\r\n\t* HARDCODED!\r\n\t* TODO: Validate stuff here?\r\n\t*/\r\n\treturn true; // \r\n}\r\n\r\n/**\r\n* Get content.\r\n* @return {string}\r\n*/\r\nCodeMirrorEditorBinding.prototype.getContent = function () {\r\n\r\n\tvar result = this.getContentWindow().bindingMap.editorpage.getContent();\r\n\r\n\treturn result ? result : \"\";\r\n}\r\n\r\n/**\r\n* Reset undo-redo history.\r\n*/\r\nCodeMirrorEditorBinding.prototype.resetUndoRedo = function () {\r\n\r\n    this._codemirrorEditor.clearHistory();\r\n}\r\n\r\n/**\r\n* Cover the editor (toolbars not covered). Used when the editor  \r\n* is embedded inside VisualEditorBinding; and other places.\r\n* @see {VisualEditorPageBinding#showEditor}\r\n* @param {boolean} isCover\r\n*/\r\nCodeMirrorEditorBinding.prototype.cover = function (isCover) {\r\n\r\n\tif (this._pageBinding != null) {\r\n\t\tthis._pageBinding.cover(isCover);\r\n\t}\r\n}\r\n\r\n/**\r\n* TODO: MOVE TO SUPER! And implement for VisualEditor as well...\r\n* @implements {IUpdateHandler}\r\n* @overwrites {EditorBinding#updateElement}\r\n* @param {Element} element\r\n*/\r\nCodeMirrorEditorBinding.prototype.updateElement = function (element) {\r\n\r\n\tif (element != null && this.shadowTree.dotnetinput != null) {\r\n\t\tvar value = element.getAttribute(\"value\");\r\n\t\tif (value != null && value != this.shadowTree.dotnetinput.value) {\r\n\t\t\tthis.setValue(decodeURIComponent(value));\r\n\t\t}\r\n\t}\r\n\r\n\treturn true; // stop crawling\r\n};\r\n\r\n\r\n/**\r\n* Not relevant for canvas-based editor!\r\n* TODO: Refactor this method chain.\r\n* @overwrites {EditorBinding#blurEditor}\r\n*/\r\nCodeMirrorEditorBinding.prototype.blurEditor = function () { }\r\n\r\n\r\n\r\n// ABSTRACT METHODS ..........................................................\r\n\r\n/**\r\n* Validate. This is currently only done for  \r\n* XML dialect syntax. Otherwise hardcoded \"true\".\r\n* @implements {IData}\r\n* @return {boolean}\r\n*/\r\nCodeMirrorEditorBinding.prototype.validate = function () {\r\n\r\n\tvar result = true;\r\n\tvar source = this.getContent();\r\n\r\n\tif (this._validator != null) { // server side validation?\r\n\r\n\t\tresult = Validator.validateInformed(source, this._validator);\r\n\r\n\t} else {\r\n\r\n\t\tswitch (this.syntax) {\r\n\r\n\t\t\t/*\r\n\t\t\t* Validate markup languages.\r\n\t\t\t*/ \r\n\t\t\tcase CodeMirrorEditorBinding.syntax.XML:\r\n\t\t\tcase CodeMirrorEditorBinding.syntax.XSL:\r\n\t\t\tcase CodeMirrorEditorBinding.syntax.HTML:\r\n\r\n\t\t\t\tvar newSource = source\r\n\t\t\t\t\t.replace(\"&nbsp;\", \"&#160;\")\r\n                    .replace(\"&ldquo;\", \"“\")\r\n                    .replace(\"&rdguo;\", \"”\")\r\n                    .replace(\"&lsquo;\", \"‘\")\r\n                    .replace(\"&rsquo;\", \"’\")\r\n                    .replace(\"&laquo;\", \"«\")\r\n                    .replace(\"&raquo;\", \"»\")\r\n                    .replace(\"&lsaquo;\", \"‹\")\r\n                    .replace(\"&rsaquo;\", \"›\")\r\n                    .replace(\"&bull;\", \"•\")\r\n                    .replace(\"&deg;\", \"°\")\r\n                    .replace(\"&hellip;\", \"…\")\r\n                    .replace(\"&trade;\", \"™\")\r\n                    .replace(\"&copy;\", \"©\")\r\n                    .replace(\"&reg;\", \"®\")\r\n                    .replace(\"&mdash;\", \"—\")\r\n                    .replace(\"&ndash;\", \"–\")\r\n                    .replace(\"&sup2;\", \"²\")\r\n                    .replace(\"&sup3;\", \"³\")\r\n                    .replace(\"&frac14;\", \"¼\")\r\n                    .replace(\"&frac12;\", \"½\")\r\n                    .replace(\"&frac34;\", \"¾\")\r\n\t\t\t\t\t.replace(\"&times;\", \"×\")\r\n\t\t\t\t\t.replace(\"&larr;\", \"←\")\r\n\t\t\t\t\t.replace(\"&rarr;\", \"→\")\r\n\t\t\t\t\t.replace(\"&uarr;\", \"↑\")\r\n\t\t\t\t\t.replace(\"&darr;\", \"↓\")\r\n\t\t\t        .replace(\"&middot;\", \"·\")\r\n\t\t\t\t\t.replace(\"<!doctype\", \"<!DOCTYPE\");\r\n\t\t\t\tif (newSource != source)\r\n\t\t\t\t{\r\n\t\t\t\t\tsource = newSource;\r\n\t\t\t\t\tthis.setContent(newSource);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tresult = XMLParser.isWellFormedDocument(source, true, !this._strictSave);\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t* Strict validation?\r\n\t\t\t\t*/\r\n\t\t\t\tif (result == true && this._hasStrictValidation) {\r\n\t\t\t\t\tswitch (this.syntax) {\r\n\t\t\t\t\t\tcase CodeMirrorEditorBinding.syntax.HTML:\r\n\t\t\t\t\t\t\tresult = this._isValidHTML(source);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/**\r\n* Basic XHTML checker.\r\n* TODO: Schema-validate this stuff on the server!\r\n* @return {boolean}\r\n*/\r\nCodeMirrorEditorBinding.prototype._isValidHTML = function (xml) {\r\n\r\n\tvar result = true;\r\n\tvar doc = XMLParser.parse(xml);\r\n\tvar errors = new List();\r\n\r\n\t/*\r\n\t* Collect errors.\r\n\t*/\r\n\tif (doc != null) {\r\n\r\n\t\tvar root = doc.documentElement;\r\n\t\tif (root.nodeName != \"html\") {\r\n\t\t\terrors.add(\"MissingHtml\");\r\n\t\t}\r\n\t\tif (root.namespaceURI != Constants.NS_XHTML) {\r\n\t\t\terrors.add(\"NamespaceURI\");\r\n\t\t}\r\n\t\tvar head = null, body = null;\r\n\t\tvar children = new List(root.childNodes);\r\n\t\twhile (children.hasNext()) {\r\n\t\t\tvar child = children.getNext();\r\n\t\t\tif (child.nodeType == Node.ELEMENT_NODE) {\r\n\t\t\t\tswitch (child.nodeName) {\r\n\t\t\t\t\tcase \"head\":\r\n\t\t\t\t\t\tif (head != null) {\r\n\t\t\t\t\t\t\terrors.add(\"MultipleHead\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (body != null) {\r\n\t\t\t\t\t\t\terrors.add(\"HeadBodyIndex\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\thead = child;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"body\":\r\n\t\t\t\t\t\tif (body != null) {\r\n\t\t\t\t\t\t\terrors.add(\"MultipleBody\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbody = child;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t    default:\r\n\t\t\t\t        errors.add(\"NotAllowedHtmlChild\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (head == null) {\r\n\t\t\terrors.add(\"MissingHead\");\r\n\t\t}\r\n\t\tif (body == null) {\r\n\t\t\terrors.add(\"MissingBody\");\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t* Show dialog if errors.\r\n\t*/\r\n\tif (errors.hasEntries()) {\r\n\t\tresult = false;\r\n\t\tDialog.error(\r\n\t\t\tStringBundle.getString(\"Composite.Web.SourceEditor\", \"Invalid.HTML.DialogTitle\"),\r\n\t\t\tStringBundle.getString(\"Composite.Web.SourceEditor\", \"Invalid.HTML.\" + errors.getFirst())\r\n\t\t);\r\n\t\t\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n* Basic XSL checker. Result is HARDCODED for now.\r\n* @return {boolean}\r\n*/\r\nCodeMirrorEditorBinding.prototype._isValidXSL = function () {\r\n\r\n\treturn true;\r\n}\r\n\r\n/**\r\n* Get value. This is intended for serverside processing.\r\n* @implements {IData}\r\n* @return {string}\r\n*/\r\nCodeMirrorEditorBinding.prototype.getValue = CodeMirrorEditorBinding.prototype.getContent;\r\n\r\n/**\r\n* Set value.\r\n* @implements {IData}\r\n* @param {string} value\r\n*/\r\nCodeMirrorEditorBinding.prototype.setValue = CodeMirrorEditorBinding.prototype.setContent;\r\n\r\n/**\r\n* Get result. This is intended for clientside processing.\r\n* @implements {IData}\r\n* @return {object}\r\n*/\r\nCodeMirrorEditorBinding.prototype.getResult = CodeMirrorEditorBinding.prototype.getContent;\r\n\r\n/**\r\n* Set result.\r\n* @implements {IData}\r\n* @param {object} result\r\n*/\r\nCodeMirrorEditorBinding.prototype.setResult = CodeMirrorEditorBinding.prototype.setContent;\r\n\r\n\r\n/**\r\n* TODO!\r\n* Create selection bookmark, patching explorer focus dysfunction.\r\n*/\r\nCodeMirrorEditorBinding.prototype.createBookmark = function () { };\r\n\r\n/** \r\n* TODO!\r\n* Restore selection focus for explorer.\r\n*/\r\nCodeMirrorEditorBinding.prototype.restoreBookmark = function () { };\r\n\r\n/**\r\n* TODO!\r\n* Has bookmark?\r\n* @return {boolean}\r\n*/\r\nCodeMirrorEditorBinding.prototype.hasBookmark = function () { };\r\n\r\n/**\r\n* TODO!\r\n* Delete bookmark.\r\n*/\r\nCodeMirrorEditorBinding.prototype.deleteBookmark = function () { };\r\n\r\n/**\r\n* Used to determine when a dirty flag should be raised.\r\n* @return {string}\r\n*/\r\nCodeMirrorEditorBinding.prototype.getCheckSum = function () {\r\n\r\n\tvar result = null;\r\n\tvar page = this._pageBinding;\r\n\r\n\tif (page != null) {\r\n\t\tresult = page.getCheckSum();\r\n\t}\r\n\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/codemirroreditor/CodeMirrorEditorPopupBinding.js",
    "content": "CodeMirrorEditorPopupBinding.prototype = new EditorPopupBinding;\r\nCodeMirrorEditorPopupBinding.prototype.constructor = CodeMirrorEditorPopupBinding;\r\nCodeMirrorEditorPopupBinding.superclass = EditorPopupBinding.prototype;\r\n\r\nCodeMirrorEditorPopupBinding.CONTENT_TEMPLATE = \"sourceeditor/popup.xml\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction CodeMirrorEditorPopupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"CodeMirrorEditorPopupBinding\" );\r\n\t\r\n\t/**\r\n\t * The containing editor.\r\n\t * @type {SourceEditorBinding}\r\n\t */\r\n\tthis._editorBinding = null;\r\n\t\r\n\t/**\r\n\t * This element has been spirited with some extendo  \r\n\t * functions constituting the core CorePress ballyhoo.  \r\n\t * @type {HTMLIframeElement}\r\n\t */\r\n\tthis._codePressFrame = null;\r\n\t\r\n\t/**\r\n\t * Somehow there are two CodePress objects in this \r\n\t * version of CodePress. This is the \"engine\" version.\r\n\t * @type {CodePress}\r\n\t */\r\n\tthis._codePressEngine = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nCodeMirrorEditorPopupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[CodeMirrorEditorPopupBinding]\";\r\n}\r\n\r\n/**\r\n * Configure contextmenu for the current source code editor.\r\n * @implements {IWysiwygEditorComponent}\r\n * @param {SourceEditorBinding} editor\r\n * @param {HTMLIframeElement} frame\r\n * @param {CodePress} engine\r\n */\r\nCodeMirrorEditorPopupBinding.prototype.configure = function ( editor, frame, engine ) {\r\n\r\n\tthis._editorBinding = editor;\r\n\tthis._codePressFrame = frame;\r\n\tthis._codePressEngine = engine;\r\n\t\r\n\tWysiwygEditorPopupBinding.superclass.configure.call ( this );\r\n}\r\n\r\n/**\r\n * Configure stuff.\r\n */\r\nCodeMirrorEditorPopupBinding.prototype._configure = function () {\r\n\t\r\n\t/*\r\n\t * Show XML tools?\r\n\t */\r\n\tswitch ( this._editorBinding.syntax ) {\r\n\t\tcase SourceEditorBinding.syntax.XML :\r\n\t\tcase SourceEditorBinding.syntax.XSL :\r\n\t\tcase SourceEditorBinding.syntax.HTML :\r\n\t\t\tthis._showMenuGroups ( \"xml\" );\r\n\t\t\tbreak;\r\n\t\tdefault :\r\n\t\t\tthis._hideMenuGroups ( \"xml\" );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle that command.\r\n * @param {string} cmd\r\n * @param [string} gui\r\n * @param {string} val\r\n */\r\nCodeMirrorEditorPopupBinding.prototype.handleCommand = function ( cmd, gui, val ) {\r\n\t\r\n\tvar win = this._editorBinding.getContentWindow ();\r\n\tvar but = null;\r\n\t\r\n\tswitch ( cmd ) {\r\n\t\t\r\n\t\tcase \"compositeInsert\" :\t\r\n\t\t\tbut = win.bindingMap.insertbutton;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase \"compositeFormat\" :\r\n\t\t\tbut = win.bindingMap.formatbutton;\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tif ( but != null ) {\r\n\t\tbut.handleCommand ( cmd, gui, val );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/visualeditor/VisualEditorBinding.js",
    "content": "VisualEditorBinding.prototype = new EditorBinding;\r\nVisualEditorBinding.prototype.constructor = VisualEditorBinding;\r\nVisualEditorBinding.superclass = EditorBinding.prototype;\r\n\r\nVisualEditorBinding.FUNCTION_CLASSNAME = \"compositeFunctionWysiwygRepresentation\";\r\nVisualEditorBinding.FIELD_CLASSNAME = \"compositeFieldReferenceWysiwygRepresentation\";\r\nVisualEditorBinding.HTML_CLASSNAME = \"compositeHtmlWysiwygRepresentation\";\r\n\r\nVisualEditorBinding.ACTION_INITIALIZED = \"visualeditor initialized\";\r\nVisualEditorBinding.DEFAULT_CONTENT = \"<p></p>\";\r\nVisualEditorBinding.URL_DIALOG_CONTENTERROR = \"${root}/content/dialogs/wysiwygeditor/errors/contenterror.aspx\";\r\nVisualEditorBinding.XHTML = \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\\t<head></head>\\n\\t<body>\\n${body}\\n\\t</body>\\n</html>\";\r\n\r\n/*\r\n * It ain't pretty, but we had to put this somewhere.\r\n * @param {string} classname\r\n * @return {string}\r\n */\r\nVisualEditorBinding.getTinyLessClassName = function (classname) {\r\n\r\n\tvar i = 0, singlename, result = [], split = classname.split(\" \");\r\n\twhile ((singlename = split[i++]) != null) {\r\n\t\tif (singlename.length >= 3 && singlename.substring(0, 3) == \"mce\") {\r\n\t\t\tcontinue;\r\n\t\t} else if (singlename.length >= 14 && singlename.substring(0, 14) == \"compositemedia\") {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tresult.push(singlename);\r\n\t}\r\n\treturn result.join(\" \");\r\n}\r\n\r\n/**\r\n * Convert tinymarkup to structured markup.\r\n * @param {string} content\r\n * @return {string}\r\n */\r\nVisualEditorBinding.getStructuredContent = function ( content ) {\r\n\r\n\tvar result = null;\r\n\tWebServiceProxy.isFaultHandler = false;\r\n\tvar soap = XhtmlTransformationsService.TinyContentToStructuredContent ( content );\r\n\tif ( soap instanceof SOAPFault ) {\r\n\t\t// DO SOMETHING!?\r\n\t} else {\r\n\t\tresult = soap.XhtmlFragment;\r\n\t\tif ( !result ) {\r\n\t\t\tresult = \"\";\r\n\t\t}\r\n\t}\r\n\tWebServiceProxy.isFaultHandler = true;\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Convert structured markup to tinymarkup.\r\n * @param {string} content Structured markup\r\n * @param {VisualEditorBinding} binding\r\n * @return {string}\r\n */\r\nVisualEditorBinding.getTinyContent = function ( content, binding ) {\r\n\r\n\tvar result = null;\r\n\r\n\t/*\r\n\t * Some content seems to be needed for the webservice to return valid fragment.\r\n\t */\r\n\tif (content == null || !content.replace(/\\s*/gm, '').length) {\r\n\t\tcontent = VisualEditorBinding.DEFAULT_CONTENT;\r\n\t}\r\n\r\n\t/*\r\n\t * If webservice fails to convert structured markup,\r\n\t * a dialog will be presented and null will be returned.\r\n\t */\r\n\tWebServiceProxy.isFaultHandler = false;\r\n\tvar soap = binding.getSoapTinyContent ( content );\r\n\tif ( soap instanceof SOAPFault ) {\r\n\t\tvar dialogArgument = soap;\r\n\t\tvar dialogHandler = {\r\n\t\t\thandleDialogResponse : function () {\r\n\t\t\t\t/*\r\n\t\t\t\t * Otherwise the save button could be disabled\r\n\t\t\t\t * indefinitely during save scenario\r\n\t\t\t\t */\r\n\t\t\t\tbinding.dispatchAction ( Binding.ACTION_VALID );\r\n\t\t\t}\r\n\t\t};\r\n\t\tDialog.invokeModal (\r\n\t\t\tVisualEditorBinding.URL_DIALOG_CONTENTERROR,\r\n\t\t\tdialogHandler,\r\n\t\t\tdialogArgument\r\n\t\t);\r\n\t} else {\r\n\t\tresult = soap.XhtmlFragment;\r\n\t\tif ( result == null ) { // always return a string!\r\n\t\t\tresult = new String ( \"\" );\r\n\t\t}\r\n\r\n\t\t//whitespaces beatween li ignore TAB/Shift+TAB event\r\n\t\t//TODO: check this at next version tinyMCE\r\n\t\t//Delete spaces between LI\r\n\t\tresult = result.replace(/\\s+<li>/g, '<li>');\r\n\t}\r\n\tWebServiceProxy.isFaultHandler = true;\r\n\treturn result;\r\n};\r\n\r\n/**\r\n * Is image?\r\n * @param {DOMElement} element\r\n * @return {boolean}\r\n */\r\nVisualEditorBinding.isImage = function (element) {\r\n\r\n\treturn element && element.nodeName == \"IMG\";\r\n}\r\n\r\n/**\r\n* Is image and not rendering?\r\n* @param {DOMElement} element\r\n* @return {boolean}\r\n*/\r\nVisualEditorBinding.isImageElement = function (element) {\r\n\treturn VisualEditorBinding.isImage(element) && !VisualEditorBinding.isReservedElement(element);\r\n}\r\n\r\n/**\r\n * Is internal image element?\r\n * @param {DOMElement} element\r\n * @return {boolean}\r\n */\r\nVisualEditorBinding.isReservedElement = function (element) {\r\n\tif (VisualEditorBinding.isFunctionElement(element))\r\n\t\treturn true;\r\n\tif (VisualEditorBinding.isFieldElement(element))\r\n\t\treturn true;\r\n\tif (VisualEditorBinding.isHtmlElement(element))\r\n\t\treturn true;\r\n\treturn false;\r\n}\r\n\r\n\r\n/**\r\n * Is function element?\r\n * @param {DOMElement} element\r\n * @return {boolean}\r\n */\r\nVisualEditorBinding.isFunctionElement = function (element) {\r\n\r\n\treturn VisualEditorBinding.isImage(element) &&\r\n\t\tCSSUtil.hasClassName (\r\n\t\t\telement,\r\n\t\t\tVisualEditorBinding.FUNCTION_CLASSNAME\r\n\t\t);\r\n}\r\n\r\n\r\n/**\r\n * Is field element?\r\n * @param {DOMElement} element\r\n * @return {boolean}\r\n */\r\nVisualEditorBinding.isFieldElement = function (element) {\r\n\r\n\treturn VisualEditorBinding.isImage(element) &&\r\n\t\tCSSUtil.hasClassName (\r\n\t\t\telement,\r\n\t\t\tVisualEditorBinding.FIELD_CLASSNAME\r\n\t\t);\r\n}\r\n\r\n/**\r\n * Is html element?\r\n * @param {DOMElement} element\r\n * @return {boolean}\r\n */\r\nVisualEditorBinding.isHtmlElement = function (element) {\r\n\r\n\treturn VisualEditorBinding.isImage(element) &&\r\n\t\tCSSUtil.hasClassName (\r\n\t\t\telement,\r\n\t\t\tVisualEditorBinding.HTML_CLASSNAME\r\n\t\t);\r\n}\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction VisualEditorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.action_initialized = VisualEditorBinding.ACTION_INITIALIZED;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.url_default = \"${root}/content/misc/editors/visualeditor/visualeditor.aspx\";\r\n\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {TinyMCE_Engine}\r\n\t */\r\n\tthis._tinyEngine = null;\r\n\r\n\t/**\r\n\t * The TinyMCE instance.\r\n\t * @type {tinymce.Editor}\r\n\t */\r\n\tthis._tinyInstance = null;\r\n\r\n\t/**\r\n\t * The TinyMCE theme.\r\n\t * @type {TinyMCE_CompositeTheme}\r\n\t */\r\n\tthis._tinyTheme = null;\r\n\r\n\t/**\r\n\t * @type {VisualEditorFieldGroupConfiguration}\r\n\t */\r\n\tthis.embedableFieldConfiguration = null;\r\n\r\n\t/**\r\n\t * Stores xhtml without body.\r\n\t * @type {string}\r\n\t */\r\n\tthis._xhtml = null;\r\n\r\n    /**\r\n\t * Preview page id.\r\n\t * @type {string}\r\n\t */\r\n\tthis._previewPageId = null;\r\n\r\n    /**\r\n\t * Preview template id.\r\n\t * @type {string}\r\n\t */\r\n\tthis._previewTemplateId = null;\r\n\r\n    /**\r\n\t * Preview placeholder.\r\n\t * @type {string}\r\n\t */\r\n    this._previewPlaceholder = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * @overloads {EditorBinding#onBindingRegister}\r\n */\r\nVisualEditorBinding.prototype.onBindingRegister = function () {\r\n\r\n\t/*\r\n\t * Force an early indexation of VisualEditorBinding strings\r\n\t * to supress occasional glitches in string fetching.\r\n\t */\r\n\tVisualEditorBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\t// load strings\r\n\tStringBundle.getString ( \"Composite.Web.VisualEditor\", \"Preload.Key\" );\r\n\r\n\r\n}\r\n\r\n/**\r\n * @overloads {WindowBinding#onBindingAttach}\r\n */\r\nVisualEditorBinding.prototype.onBindingAttach = function () {\r\n\r\n\t// fields config\r\n\tvar fieldsconfig = this.getProperty ( \"embedablefieldstypenames\" );\r\n\tif ( fieldsconfig != null ) {\r\n\t\tthis.embedableFieldConfiguration = VisualEditorFieldGroupConfiguration.getConfiguration ( fieldsconfig );\r\n\t}\r\n\r\n\t// formatting config\r\n\tvar config = this.getProperty ( \"formattingconfiguration\" );\r\n\tif ( config != null ) {\r\n\t\tthis._url += \"?config=\" + config;\r\n\t}\r\n\r\n\tthis._previewPageId = this.getProperty (\"previewpageid\");\r\n\tif (this._previewPageId == null) {\r\n\t    this._previewPageId = '00000000-0000-0000-0000-000000000000';\r\n\t}\r\n\r\n\tthis._previewTemplateId = this.getProperty(\"previewtemplateid\");\r\n\tif (this._previewTemplateId == null) {\r\n\t    this._previewTemplateId = '00000000-0000-0000-0000-000000000000';\r\n\t}\r\n\r\n\tthis._previewPlaceholder = this.getProperty(\"previewplaceholder\");\r\n\r\n\tVisualEditorBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tthis.subscribe ( BroadcastMessages.TINYMCE_INITIALIZED );\r\n\tthis.subscribe ( this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST);\r\n\r\n};\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[VisualEditorBinding]\";\r\n};\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nVisualEditorBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tVisualEditorBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tvar windowBinding = this.getContentWindow().bindingMap.tinywindow;\r\n\tvar contentWindow = windowBinding.getContentWindow ();\r\n\r\n\tswitch ( broadcast ) {\r\n\r\n\t\t/*\r\n\t\t * TinyMCE initialized.\r\n\t\t */\r\n\t\tcase BroadcastMessages.TINYMCE_INITIALIZED :\r\n\r\n\t\t\tif ( arg.broadcastWindow == contentWindow ) {\r\n\r\n\t\t\t\tthis._tinyEngine = arg.tinyEngine;\r\n\t\t\t\tthis._tinyInstance = arg.tinyInstance;\r\n\t\t\t\tthis._tinyTheme = arg.tinyTheme;\r\n\r\n\t\t\t\tthis._tinyTheme.initC1(\r\n\t\t\t\t\tthis,\r\n\t\t\t\t\tthis._tinyEngine,\r\n\t\t\t\t\tthis._tinyInstance\r\n\t\t\t\t);\r\n\r\n\t\t\t\tthis.initializeEditorComponents ( windowBinding );\r\n\t\t\t\tthis._initialize ();\r\n\r\n\t\t\t\tthis.unsubscribe ( BroadcastMessages.TINYMCE_INITIALIZED );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST:\r\n\t\t\tthis.handleCommand(\"CompositeUpdateLayout\", false, null);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n/**\r\n * Initialize components collected during startup. After startup,\r\n * this method is invoked directly when bindings register themselves\r\n * through method EditorBinding.registerComponent.\r\n * @param {IEditorComponent} binding\r\n */\r\nVisualEditorBinding.prototype.initializeEditorComponent = function ( binding ) {\r\n\r\n\tbinding.initializeComponent (\r\n\t\tthis,\r\n\t\tthis._tinyEngine,\r\n\t\tthis._tinyInstance,\r\n\t\tthis._tinyTheme\r\n\t);\r\n};\r\n\r\n/**\r\n * @overloads {EditorBinding#finalize}\r\n */\r\nVisualEditorBinding.prototype._finalize = function () {\r\n\r\n\tVisualEditorBinding.superclass._finalize.call(this);\r\n\r\n\t/*\r\n\t* Normalize start content and extract HEAD and BODY section before we\r\n\t* feed it to TinyMCE. Normalization is required while old solutions\r\n\t* are upgraded to the new setup (with HEAD and BODY sections).\r\n\t*/\r\n\tthis._startContent = this.normalizeToDocument(this._startContent);\r\n\tthis._startContent = this.extractBody(this._startContent);\r\n\r\n\t/*\r\n\t* Inject BODY markup into TinyMCE. From now on, injection\r\n\t* is handled by the VisualEditorPageBinding.\r\n\t*/\r\n\tvar tinyContent = VisualEditorBinding.getTinyContent(this._startContent, this);\r\n\tif (tinyContent.replace(/\\s*/gm, '').length == 0) {\r\n\t\ttinyContent = VisualEditorBinding.DEFAULT_CONTENT;\r\n\t}\r\n\r\n\tthis._tinyInstance.setContent(tinyContent, { format: 'raw' });\r\n\tthis._tinyInstance.undoManager.clear();\r\n\tthis._tinyInstance.undoManager.add();\r\n\r\n\tthis.updateBodyWidth();\r\n\tthis.updateCssClasses();\r\n\r\n\tthis._maybeShowEditor();\r\n\r\n};\r\n\r\n/**\r\n * Invoked when contained page initializes.\r\n * @overloads {EditorBinding#_onPageInitialze}\r\n * @param {PageBinding} binding\r\n */\r\nVisualEditorBinding.prototype._onPageInitialize = function ( binding ) {\r\n\r\n\tVisualEditorBinding.superclass._onPageInitialize.call ( this, binding );\r\n\tthis._maybeShowEditor ();\r\n};\r\n\r\n/**\r\n * Stuff is not always loaded in a tight sequence arund here, so\r\n * we make sure not to show the editor until we are ready.\r\n */\r\nVisualEditorBinding.prototype._maybeShowEditor = function () {\r\n\r\n\tif ( this._isFinalized && this._pageBinding != null ) {\r\n\t\tthis._checksum = this.getCheckSum ();\r\n\t\tthis._pageBinding.showEditor ( true );\r\n\t}\r\n};\r\n\r\n/**\r\n * Extract BODY section and return it. TinyMCE\r\n * should alwasy be fed BODY content only.\r\n * @param {string} html\r\n * @return {string}\r\n */\r\nVisualEditorBinding.prototype.extractBody = function ( html ) {\r\n\r\n\tvar result = null;\r\n\tvar re = /(<body\\s*[^>]*>)([\\S\\s]*)(<\\/body>)/i;\r\n\tvar match = html.match(re);\r\n\tif (match) {\r\n\t\tresult = match[2];\r\n\t\tthis._xhtml = html.replace(re, \"$1\\n${body}\\n\\t$3\");\r\n\t} else {\r\n\t\tresult = new String(\"\");\r\n\t\tthis._xhtml = VisualEditorBinding.XHTML;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Restore HTML markup and convert HTML fragment to normalized HTML document.\r\n * This must be done whenever content is extracted from TinyMCE.\r\n * @param {string} body\r\n * @return {string}\r\n */\r\nVisualEditorBinding.prototype.normalizeToDocument = function ( markup ) {\r\n\r\n\tvar result = markup;\r\n\tif ( !this._isNormalizedDocument ( markup )) {\r\n\t\tresult = this._getHtmlMarkup().replace('${body}', markup.replace(/\\$/g,'$$$$'));\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Is markup a valid HTML document; or simply a fragment?\r\n * @param {string} markup\r\n * @return {boolean}\r\n */\r\nVisualEditorBinding.prototype._isNormalizedDocument = function ( markup ) {\r\n\r\n\tvar result = false;\r\n\tvar doc = XMLParser.parse ( markup, true );\r\n\tif ( doc != null ) {\r\n\t\tif ( doc.documentElement.nodeName == \"html\" ) {\r\n\t\t\tresult = true;\r\n\t\t}\r\n\t}\r\n\t//When markup start with <!-- --> then parser return html document in chrome\r\n\t//TODO: Investigate it to make function more niced\r\n\tif (Client.isWebKit) {\r\n\t\tif (markup.indexOf(\"<html\") !== 0) {\r\n\t\t\tresult = false;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get cached HTML Markup. Method isolated so that subclasses may overwrite.\r\n * @return {string}\r\n */\r\nVisualEditorBinding.prototype._getHtmlMarkup = function () {\r\n\r\n\treturn this._xhtml != null ? this._xhtml : VisualEditorBinding.XHTML;\r\n}\r\n\r\n/**\r\n * Handle command.\r\n * @overwrites {EditorBinding#handleCommand}\r\n * @param {string} cmd\r\n * @param {boolean} gui\r\n * @param {string} val\r\n * @return {boolean} ... This is always true; maybe refactor something?\r\n */\r\nVisualEditorBinding.prototype.handleCommand = function ( cmd, gui, val ) {\r\n\r\n\t/*\r\n\t * The superclass handles special commmands \"copy\" and \"paste\"\r\n\t * thay may invoke a warning dialog in unprivileged Mozillas.\r\n\t */\r\n\tvar isCommandHandled = VisualEditorBinding.superclass.handleCommand.call ( this, cmd, gui, val );\r\n\r\n\t/*\r\n\t * Otherwise, the command gets realyed to the TinyMCE instance.\r\n\t */\r\n\tif ( !isCommandHandled ) {\r\n\t\ttry {\r\n\t\t\tthis._tinyInstance.execCommand(cmd, gui, val, { skip_focus: true });\r\n\t\t\tthis.checkForDirty ();\r\n\t\t} catch ( e ) {\r\n\t\t\tSystemDebug.stack ( arguments );\r\n\t\t}\r\n\t\tisCommandHandled = true;\r\n\t}\r\n\r\n\treturn isCommandHandled;\r\n};\r\n\r\n/**\r\n * Configure contextmenu before showing it.\r\n * @overloads {EditorBinding#handleContextMenu}\r\n * @param {MouseEvent} e\r\n */\r\nVisualEditorBinding.prototype.handleContextMenu = function ( e ) {\r\n\r\n\tvar element = DOMEvents.getTarget ( e );\r\n\tthis._popupBinding.configure ( this._tinyInstance, this._tinyEngine, element );\r\n\tVisualEditorBinding.superclass.handleContextMenu.call ( this, e );\r\n}\r\n\r\n\r\n\r\n// ABSTRACT METHODS IMPLEMENTED .............................................\r\n\r\n/**\r\n * Get the editable window.\r\n * @return {DOMDocumentView}\r\n */\r\nVisualEditorBinding.prototype.getEditorWindow = function () {\r\n\r\n\treturn DOMUtil.getParentWindow ( this.getEditorDocument ());\r\n};\r\n\r\n/**\r\n * Get the editable document.\r\n * @return {DOMDocument}\r\n */\r\nVisualEditorBinding.prototype.getEditorDocument = function () {\r\n\r\n\treturn this._tinyInstance.getDoc ();\r\n};\r\n\r\n/**\r\n * Get the contextmenu associated.\r\n * @return {VisualEditorPopupBinding}\r\n */\r\nVisualEditorBinding.prototype.getEditorPopupBinding = function () {\r\n\r\n\treturn app.bindingMap.visualeditorpopup;\r\n};\r\n\r\n/**\r\n * Create selection bookmark.\r\n */\r\nVisualEditorBinding.prototype.createBookmark = function () {\r\n\r\n\tthis._bookmark = this._tinyInstance.selection.getBookmark ( true );\r\n};\r\n\r\n/**\r\n * Restore selection from bookmark. This will delete the bookmark!\r\n */\r\nVisualEditorBinding.prototype.restoreBookmark = function () {\r\n\r\n\tif ( this.hasBookmark ()) {\r\n\t\tthis._tinyInstance.selection.moveToBookmark ( this._bookmark );\r\n\t\tthis.deleteBookmark ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Has bookmark?\r\n * @return {boolean}\r\n */\r\nVisualEditorBinding.prototype.hasBookmark = function () {\r\n\r\n\treturn this._bookmark != null;\r\n};\r\n\r\n/**\r\n * Delete bookmark.\r\n */\r\nVisualEditorBinding.prototype.deleteBookmark = function () {\r\n\r\n\tthis._bookmark = null;\r\n};\r\n\r\n/**\r\n * Reset undo-redo history.\r\n */\r\nVisualEditorBinding.prototype.resetUndoRedo = function () {\r\n\r\n    this._tinyInstance.undoManager.clear();\r\n    this._tinyInstance.undoManager.add();\r\n\tif ( this._pageBinding != null ) {\r\n\t\tthis._pageBinding.updateUndoBroadcasters ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Used to determine when a dirty flag should be raised.\r\n * @return {string}\r\n *\r\nVisualEditorBinding.prototype.getCheckSum = function () {\r\n\r\n\tvar result = null;\r\n\tif ( Binding.exists ( this._pageBinding )) {\r\n\t\tresult = this._pageBinding.getCheckSum ( this._checksum );\r\n\t}\r\n\treturn result;\r\n}\r\n*/\r\n\r\n\r\n// IMPLEMENT AS DATABINDING .............................................\r\n\r\n/**\r\n * Validate.\r\n * @implements {IData}\r\n * @return {boolean}\r\n */\r\nVisualEditorBinding.prototype.validate = function () {\r\n\r\n\treturn this._pageBinding.validate ();\r\n};\r\n\r\n/**\r\n * Get value. This is intended for serversice processing.\r\n * @implements {IData}\r\n * @return {string}\r\n */\r\nVisualEditorBinding.prototype.getValue = function () {\r\n\r\n\t/*\r\n\t * The content is probably valid at this point because the validate\r\n\t * method has been invoked. We can save some time here by not duplicating\r\n\t * validation, although theoretically we should.\r\n\t */\r\n\treturn this._pageBinding.getContent ();\r\n};\r\n\r\n/**\r\n * Set value. This resets the undo stack.\r\n * @param {string} value\r\n */\r\nVisualEditorBinding.prototype.setValue = function ( value ) {\r\n\r\n\tif ( this._isFinalized ) {\r\n\t\tif ( Binding.exists ( this._pageBinding )) {\r\n\t\t\tthis._pageBinding.setContent ( value );\r\n\t\t\t// resetUndoRedo invoked by page!\r\n\t\t\t// _checksum reset by page! (how ugly!)\r\n\t\t}\r\n\t} else if ( this._startContent == null ){\r\n\t\tthis._startContent = value;\r\n\t}\r\n};\r\n\r\n/**\r\n * Get result. This is intended for clientside processing.\r\n * @implements {IData}\r\n * @return {object}\r\n */\r\nVisualEditorBinding.prototype.getResult = function () {};\r\n\r\n/**\r\n * Clean must be realyed to sourcecodeeditor.\r\n * @overloads {EditorBinding#clean}\r\n */\r\nVisualEditorBinding.prototype.clean = function () {\r\n\r\n\tVisualEditorBinding.superclass.clean.call ( this );\r\n\r\n\tif ( this._pageBinding != null ) {\r\n\t\tthis._pageBinding.clean ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Convert structured content to tiny content on server.\r\n * @param {string} content Structured markup\r\n * @return {SOAP}\r\n */\r\nVisualEditorBinding.prototype.getSoapTinyContent = function (content) {\r\n\tvar width = this.getEffectiveWidth();\r\n    return XhtmlTransformationsService.StructuredContentToTinyContentMultiTemplate(content, this._previewPageId, this._previewTemplateId, this._previewPlaceholder, width);\r\n}\r\n\r\n/**\r\n * Convert structured content to tiny content on server.\r\n * @param {string} content Structured markup\r\n * @return {SOAP}\r\n */\r\nVisualEditorBinding.prototype.getImageTagForFunctionCall = function (markup) {\r\n\tvar width = this.getEffectiveWidth();\r\n\treturn XhtmlTransformationsService.GetImageTagForFunctionCall2(markup, this._previewPageId, this._previewTemplateId, this._previewPlaceholder, width);\r\n}\r\n\r\n/**\r\n * Get effective width\r\n * @return {int}\r\n */\r\n\r\nVisualEditorBinding.prototype.getEffectiveWidth = function () {\r\n\tvar body = this._tinyInstance.getBody();\r\n\tvar padding = CSSComputer.getPadding(body);\r\n\tvar editorsplitpanel = this.getContentWindow().bindingMap.editorsplitpanel;\r\n\tvar width = editorsplitpanel.bindingElement.offsetWidth - 52; //Hack for \"- padding.right - padding.left\";\r\n\treturn Math.floor(width / 32) * 32;\r\n}\r\n\r\n/**\r\n * Get placeholder width\r\n * @return {int}\r\n */\r\nVisualEditorBinding.prototype.getPlaceholderWidth = function () {\r\n\r\n\treturn StageBinding.placeholderWidth;\r\n}\r\n\r\n/**\r\n * Update TinyMCE body width\r\n * @param {int} content Structured markup\r\n  */\r\nVisualEditorBinding.prototype.updateBodyWidth = function (width) {\r\n\r\n\tif (width == undefined) {\r\n\t\twidth = this.getPlaceholderWidth();\r\n\t}\r\n\tif (width) {\r\n\t\tthis._tinyInstance.getBody().style.maxWidth = (width + 52) + \"px\";\r\n\t} else {\r\n\t\tthis._tinyInstance.getBody().style.maxWidth = \"\";\r\n\t}\r\n}\r\n\r\nVisualEditorBinding.prototype.updateCssClasses = function () {\r\n\r\n\tvar contextContainer = ContextContainer.getContextContainer(this);\r\n\tif (contextContainer != null) {\r\n\t\tvar body = this._tinyInstance.getBody();\r\n\t\tbody.className = \"\";\r\n\t\tcontextContainer.getContainerClassesList().each(function(className) {\r\n\t\t\tCSSUtil.attachClassName(body, className);\r\n\t\t});\r\n\t}\r\n}\r\n\r\n/**\r\n* Focus\r\n* @overloads {EditorBinding#focus}\r\n*/\r\nVisualEditorBinding.prototype.focus = function () {\r\n\r\n\tVisualEditorBinding.superclass.focus.call(this);\r\n\r\n\t//Hack for IE\r\n\tif (Client.isExplorer && this._tinyInstance) {\r\n\t\tthis._tinyInstance.selection.setRng(this._tinyInstance.selection.getRng());\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n* RestoreFocus\r\n*/\r\nVisualEditorBinding.prototype.restoreEditorFocus = function () {\r\n\r\n\tthis._tinyInstance.focus();\r\n}\r\n\r\n/**\r\n * Set result. This is intended for clientside processing.\r\n * @param {string} result\r\n */\r\nVisualEditorBinding.prototype.setResult = function ( result ) {};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/visualeditor/VisualEditorFieldGroupConfiguration.js",
    "content": "/**\r\n * Considered internal to this class.\r\n * @type {Map<string><VisualEditorFieldGroupConfiguration>}\r\n */\r\nVisualEditorFieldGroupConfiguration._configurations = new Map ();\r\n\r\n/**\r\n * Caching configurations to \r\n * save a few server requests.\r\n * @param {string} classconfig\r\n * @return {VisualEditorFieldGroupConfiguration}\r\n */\r\nVisualEditorFieldGroupConfiguration.getConfiguration = function ( fieldsconfig ) {\r\n\t\r\n\tvar result = null;\r\n\tvar configs = VisualEditorFieldGroupConfiguration._configurations;\r\n\tif ( !configs.has ( fieldsconfig )) {\r\n\t\tconfigs.set ( fieldsconfig, new VisualEditorFieldGroupConfiguration (\r\n\t\t\tEditorConfigurationService.GetEmbedableFieldGroupConfigurations ( fieldsconfig )\r\n\t\t));\r\n\t};\r\n\treturn configs.get ( fieldsconfig );\r\n}\r\n\r\n\r\n/**\r\n * VisualEditor field config.\r\n * @param {object} object Provided by SOAP\r\n */\r\nfunction VisualEditorFieldGroupConfiguration ( object ) {\r\n\t\r\n\tvar groups = new Map ();\r\n\tnew List ( object ).each ( function ( group ) {\r\n\t\tvar map = new Map ();\r\n\t\tnew List ( group.Fields ).each ( function ( field ) {\r\n\t\t\tmap.set ( field.Name, {\r\n\t\t\t\txhtml : field.XhtmlRepresentation,\r\n\t\t\t\txml\t: field.XhtmlRepresentation\r\n\t\t\t});\r\n\t\t});\r\n\t\tgroups.set ( group.GroupName, map );\r\n\t});\r\n\t\r\n\t/**\r\n\t * @type {Map<string><Map<string><object>>}\r\n\t */\r\n\tthis._groups = groups;\r\n}\r\n\r\n/**\r\n * Get field names for a group.\r\n * @return {List<string>}\r\n */\r\nVisualEditorFieldGroupConfiguration.prototype.getGroupNames = function () {\r\n\t\r\n\treturn this._groups.toList ( true );\r\n}\r\n\r\n/**\r\n * Get field names for a group.\r\n * @param {string} groupname\r\n * @return {List<string>}\r\n */\r\nVisualEditorFieldGroupConfiguration.prototype.getFieldNames = function ( groupname ) {\r\n\t\r\n\treturn this._groups.get ( groupname ).toList ( true );\r\n}\r\n\r\n/**\r\n * Get the VisualEditor markup for a given field.\r\n * @param {string} groupname\r\n * @param {string} fieldname\r\n * @return {string}\r\n */\r\nVisualEditorFieldGroupConfiguration.prototype.getTinyMarkup = function ( groupname, fieldname ) {\r\n\t\r\n\treturn this._groups.get ( groupname ).get ( fieldname ).xhtml;\r\n}\r\n\r\n/**\r\n * Get the sourcodeeditor markup for a given field.\r\n * @param {string} groupname\r\n * @param {string} fieldname\r\n * @return {string}\r\n */\r\nVisualEditorFieldGroupConfiguration.prototype.getStructuredMarkup = function ( name ) {\r\n\r\n\treturn this._groups.get ( groupname ).get ( fieldname ).xml;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/visualeditor/VisualEditorFormattingConfiguration.js",
    "content": "/**\r\n * Considered internal to this class.\r\n * @type {Map<string><VisualEditorFormattingConfiguration>}\r\n */\r\nVisualEditorFormattingConfiguration._configurations = new Map ();\r\n\r\n/**\r\n * Populated when the editor is first loaded, see below.\r\n * @type {HashMap<string><string>}\r\n */\r\nVisualEditorFormattingConfiguration._options = null;\r\n\r\n/**\r\n * Caching configurations to save a few server requests.\r\n * @param {string} formatconfig\r\n * @return {VisualEditorFormattingConfiguration}\r\n */\r\nVisualEditorFormattingConfiguration.getConfiguration = function ( formatconfig ) {\r\n\t\r\n\tvar configs = VisualEditorFormattingConfiguration._configurations;\r\n\tif ( !configs.has ( formatconfig )) {\r\n\t\tconfigs.set ( formatconfig, new VisualEditorFormattingConfiguration ());\r\n\t};\r\n\treturn configs.get ( formatconfig );\r\n};\r\n\r\n/**\r\n * Get all POSSIBLE formatting options.\r\n */\r\nVisualEditorFormattingConfiguration._getOptions = function () {\r\n\t\r\n\tif ( VisualEditorFormattingConfiguration._options == null ) {\r\n\t\t\r\n\t\tvar p = \"Composite.Web.VisualEditor\";\t\r\n\t\tVisualEditorFormattingConfiguration._options = {\r\n\t\t\t\t\"p\" \t\t\t: StringBundle.getString ( p, \"FormatSelector.LabelParagraph\" ),\r\n\t\t\t\t\"address\" \t\t: StringBundle.getString ( p, \"FormatSelector.LabelAddress\" ),\r\n\t\t\t\t\"blockquote\" \t: StringBundle.getString ( p, \"FormatSelector.LabelBlockQuote\" ),\r\n\t\t\t\t\"div\"\t\t\t: StringBundle.getString ( p, \"FormatSelector.LabelDivision\" ),\r\n\t\t\t\t\"h1\"\t\t\t: StringBundle.getString ( p, \"FormatSelector.LabelHeading1\" ),\r\n\t\t\t\t\"h2\"\t\t\t: StringBundle.getString ( p, \"FormatSelector.LabelHeading2\" ),\r\n\t\t\t\t\"h3\"\t\t\t: StringBundle.getString ( p, \"FormatSelector.LabelHeading3\" ),\r\n\t\t\t\t\"h4\"\t\t\t: StringBundle.getString ( p, \"FormatSelector.LabelHeading4\" ),\r\n\t\t\t\t\"h5\"\t\t\t: StringBundle.getString ( p, \"FormatSelector.LabelHeading5\" ),\r\n\t\t\t\t\"h6\"\t\t\t: StringBundle.getString ( p, \"FormatSelector.LabelHeading6\" )\r\n\t\t};\r\n\t}\r\n\t\r\n\treturn VisualEditorFormattingConfiguration._options;\r\n}\r\n\r\n/**\r\n * @class\r\n * @param {string} config\r\n */\r\nfunction VisualEditorFormattingConfiguration ( config ) {\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><string>}\r\n\t */\r\n\tthis._options = VisualEditorFormattingConfiguration._getOptions ();\r\n}\r\n\r\n/**\r\n * Get formatting.\r\n */\r\nVisualEditorFormattingConfiguration.prototype.getFormattingOptions = function () {\r\n\t\r\n\treturn this._options;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/visualeditor/VisualEditorPopupBinding.js",
    "content": "VisualEditorPopupBinding.prototype = new EditorPopupBinding;\r\nVisualEditorPopupBinding.prototype.constructor = VisualEditorPopupBinding;\r\nVisualEditorPopupBinding.superclass = EditorPopupBinding.prototype;\r\n\r\nVisualEditorPopupBinding.CONTENT_TEMPLATE = \"wysiwygeditor/popup.xml\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction VisualEditorPopupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualEditorPopupBinding\" );\r\n\r\n\t/**\r\n\t * @type {HTMLElement} \r\n\t */\r\n\tthis.tinyElement = null;\r\n\r\n\t/**\r\n\t * The TinyMCE engine.\r\n\t * @type {tinymce.EngineManager} \r\n\t */\r\n\tthis.tinyEngine = null;\r\n\t\r\n\t/** \r\n\t * A TinyMCE instance.\r\n\t * @type {tinymce.Engine}\r\n\t */\r\n\tthis.tinyInstance = null;\r\n\r\n\t/**\r\n\t * Flags whether or not a selection was made in the editor.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasSelection = false;\r\n\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualEditorPopupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[VisualEditorPopupBinding]\";\r\n}\r\n\r\n/**\r\n * Configures the menu. See also method _configure.\r\n * @param {TinyMCE_Control} instance\r\n * @param {TinyMCE_Engine} engine \r\n * @param {HTMLElement} element\r\n */\r\nVisualEditorPopupBinding.prototype.configure = function ( instance, engine, element ) {\r\n\t\r\n\tvar hasSelection = this.editorBinding.hasSelection ();\r\n\t\r\n\tthis.tinyInstance\t= instance;\r\n\tthis.tinyEngine \t= engine;\r\n\tthis.tinyElement\t= element;\r\n\tthis.hasSelection \t= hasSelection;\r\n\t\r\n\tVisualEditorPopupBinding.superclass.configure.call ( this );\r\n}\r\n\r\n/**\r\n * Handle that command.\r\n * @param {string} cmd\r\n * @param [string} gui\r\n * @param {string} val\r\n */\r\nVisualEditorPopupBinding.prototype.handleCommand = function ( cmd, gui, val ) {\r\n\t\r\n\tthis.editorBinding.blurEditor ();\r\n\tthis.editorBinding.handleCommand ( cmd, gui ? gui : false, val );\r\n}\r\n\r\n/**\r\n * Configure in separate method so that we may \r\n * delay invokation until menu is initialized. \r\n * Purpose of delay is to show the busy cursor.\r\n */\r\nVisualEditorPopupBinding.prototype._configure = function () {\r\n\r\n\tif (this._isEditorPopupBindingInitialized) {\r\n\t\tthis._configureLinkGroup();\r\n\t\tthis._configureInsertGroup();\r\n\t\tthis._configureTableGroup();\r\n\t\tthis._configureRenderingGroup();\r\n\t\tthis._configureFieldGroup();\r\n\t\tthis._configureImageGroup();\r\n\t\tthis._configureSpellCheckGroup();\r\n\t}\r\n}\r\n\r\n/**\r\n * Configures and displays the linkgroup.\r\n */\r\nVisualEditorPopupBinding.prototype._configureLinkGroup = function () {\r\n\r\n\tvar isVisible = false;\r\n\t\r\n\tif ( this.hasSelection ) {\r\n\t\tisVisible = true;\r\n\t} else if ( this.tinyElement ) {\r\n\t\tif ( this.tinyElement.nodeName == \"A\" && !this.tinyElement.getAttribute ( \"name\" )) {\r\n\t\t\tisVisible = true;\r\n\t\t} else if ( this.tinyElement.nodeName == \"IMG\" ) {\r\n\t\t\tisVisible = true;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif ( isVisible ) {\r\n\t\tthis._showMenuGroups ( \"link\" );\r\n\t\tthis._configureLinkGroupDetails ();\r\n\t} else {\r\n\t\tthis._hideMenuGroups ( \"link\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Configure link group details.\r\n */\r\nVisualEditorPopupBinding.prototype._configureLinkGroupDetails = function () {\r\n\t\r\n\tvar linkitem = this.getMenuItemForCommand ( \"compositeInsertLink\" );\r\n\tvar unlinkitem = this.getMenuItemForCommand ( \"unlink\" );\r\n\tvar linkbutton = this.editorBinding.getButtonForCommand ( \"compositeInsertLink\" );\r\n\tvar unlinkbutton = this.editorBinding.getButtonForCommand ( \"unlink\" );\r\n\t\r\n\tunlinkitem.setDisabled ( unlinkbutton.isDisabled );\r\n\t\t\r\n\tif ( unlinkitem.isDisabled ) {\r\n\t    linkitem.setLabel( \"${string:Composite.Web.VisualEditor:ContextMenu.LabelLink}\" );\r\n\t} else {\r\n    linkitem.setLabel( \"${string:Composite.Web.VisualEditor:ContextMenu.LabelLinkProperties}\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Configure insert group. This is mostly \r\n * a question of handling the fields menu.\r\n * TODO: Don't rebuild this on each show!\r\n */\r\nVisualEditorPopupBinding.prototype._configureInsertGroup = function () {\r\n\t\r\n\tvar config = this.editorBinding.embedableFieldConfiguration;\r\n\tvar item = this.getMenuItemForCommand ( \"compositeInsertFieldParent\" );\r\n\tvar doc = this.bindingDocument;\r\n\t\r\n\tif ( item ) {\r\n\t\titem.dispose ();\r\n\t}\r\n\t\r\n\titem = MenuItemBinding.newInstance ( doc );\r\n\titem.setLabel( \"${string:Composite.Web.VisualEditor:ContextMenu.LabelField}\" );\r\n\titem.image = \"${icon:fields}\";\r\n\titem.imageDisabled = \"${icon:fields-disabled}\";\r\n\titem.setProperty ( \"cmd\", \"compositeInsertFieldParent\" );\r\n\t\r\n\tif ( config ) {\r\n\t\tvar groupnames = config.getGroupNames ();\r\n\t\tif ( groupnames.hasEntries ()) {\r\n\t\t\r\n\t\t\tvar popup \t= MenuPopupBinding.newInstance ( doc );\r\n\t\t\tvar body \t= popup.add ( MenuBodyBinding.newInstance ( doc ));\r\n\t\t\tvar group \t= body.add ( MenuGroupBinding.newInstance ( doc ));\r\n\t\t\t\r\n\t\t\tgroupnames.each ( function ( groupname ) {\r\n\t\t\t\tvar fields = config.getFieldNames ( groupname );\r\n\t\t\t\tfields.each ( function ( fieldname ) {\r\n\t\t\t\t\tvar i = group.add ( MenuItemBinding.newInstance ( doc ));\r\n\t\t\t\t\ti.setLabel ( fieldname );\r\n\t\t\t\t\ti.setImage ( \"${icon:field}\" );\r\n\t\t\t\t\ti.setProperty ( \"cmd\", \"compositeInsertField\" );\r\n\t\t\t\t\ti.setProperty ( \"val\", groupname + \":\" + fieldname );\r\n\t\t\t\t\tgroup.add ( i );\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t\titem.add ( popup );\r\n\t\t}\r\n\t} else {\r\n\t\titem.disable ();\r\n\t}\r\n\t\r\n\tthis._menuGroups [ \"insertions\" ].getFirst ().add ( item );\r\n\titem.attachRecursive ();\r\n\tthis._menuItems [ \"compositeInsertFieldParent\" ] = item;\r\n}\r\n\r\n/**\r\n * Configures and displays the tablegroup.\r\n */\r\nVisualEditorPopupBinding.prototype._configureTableGroup = function () {\r\n\r\n\tvar element = this.tinyInstance.dom.getParent ( this.tinyElement, \"table,td\" );\r\n\tvar colspan = null;\r\n\tvar rowspan = null;\r\n\t\r\n\tif ( element ) {\r\n\t\tif ( element.nodeName == \"TD\" ) {\r\n\t\t\tcolspan = element.getAttribute ( \"colspan\" );\r\n\t\t\trowspan = element.getAttribute ( \"rowspan\" )\r\n\t\t}\r\n\t\tthis._menuItems [ \"mceTableSplitCells\" ].setDisabled ( colspan == \"1\" && rowspan == \"1\" );\r\n\t\tthis._menuItems [ \"mceTablePasteRowBefore\" ].setDisabled ( this.tinyInstance.tableRowClipboard == null );\r\n\t\tthis._menuItems [ \"mceTablePasteRowAfter\" ].setDisabled ( this.tinyInstance.tableRowClipboard == null );\r\n\t}\r\n\tif ( element ) {\r\n\t\tthis._showMenuGroups ( \"table\" );\r\n\t} else {\r\n\t\tthis._hideMenuGroups ( \"table\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Configures and displays the rendering group.\r\n */\r\nVisualEditorPopupBinding.prototype._configureRenderingGroup = function () {\r\n\r\n\tif ( VisualEditorBinding.isFunctionElement(this.tinyElement) ) {\r\n\t\tthis._showMenuGroups ( \"rendering\" );\r\n\t} else {\r\n\t\tthis._hideMenuGroups ( \"rendering\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Configures and displays the field group.\r\n */\r\nVisualEditorPopupBinding.prototype._configureFieldGroup = function () {\r\n\tif ( VisualEditorBinding.isFieldElement(this.tinyElement) ) {\r\n\t\tthis._showMenuGroups ( \"field\" );\r\n\t} else {\r\n\t\tthis._hideMenuGroups ( \"field\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Configures and displays the tablegroup. This should\r\n * be done *after* rendering configuration.\r\n */\r\nVisualEditorPopupBinding.prototype._configureImageGroup = function () {\r\n\r\n\tif (VisualEditorBinding.isImageElement(this.tinyElement)) {\r\n\t\tthis._showMenuGroups ( \"image\" );\r\n\t} else {\r\n\t\tthis._hideMenuGroups ( \"image\" );\r\n\t}\r\n}\r\n\r\n\r\n\r\n/**\r\n* Configures and displays the spellcheckgroup.\r\n*/\r\nVisualEditorPopupBinding.prototype._configureSpellCheckGroup = function () {\r\n\r\n\tif (Client.isFirefox) {\r\n\t\tthis._showMenuGroups(\"spellcheck\");\r\n\t} else {\r\n\t\tthis._hideMenuGroups(\"spellcheck\");\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/visualeditor/multieditor/VisualMultiEditorBinding.js",
    "content": "VisualMultiEditorBinding.prototype = new VisualEditorBinding;\r\nVisualMultiEditorBinding.prototype.constructor = VisualMultiEditorBinding;\r\nVisualMultiEditorBinding.superclass = VisualEditorBinding.prototype;\r\n\r\n/**\r\n * The VisualMultiTemplateEditorBinding supports multiple content areas.\r\n * @class\r\n */\r\nfunction VisualMultiEditorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualMultiEditorBinding\" );\r\n\r\n\t/**\r\n\t * Any placeholders in template?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasPlaceHolders = false;\r\n\r\n\t/**\r\n\t * Currently selected template placeholder.\r\n\t * @type {string}\r\n\t */\r\n\tthis._textareaname = null;\r\n\r\n\t/**\r\n\t * Map content of current template placeholders.\r\n\t * @type {Map<string><string>}\r\n\t */\r\n\tthis._textareas = null;\r\n\r\n\t/**\r\n\t * Index HTML markup of multiple documents.\r\n\t * @type {Map<string><string>}\r\n\t */\r\n\tthis._xhtmls = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualMultiEditorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[VisualMultiEditorBinding]\";\r\n};\r\n\r\n/**\r\n * Make sure that we have som placeholders to show.\r\n * @overloads {VisualEditorBining#_maybeShowEditor}\r\n */\r\nVisualMultiEditorBinding.prototype._maybeShowEditor = function () {\r\n\r\n\tif ( this._hasPlaceHolders ) {\r\n\t\tVisualMultiEditorBinding.superclass._maybeShowEditor.call ( this );\r\n\t}\r\n};\r\n\r\n/**\r\n * @overwrites {VisualEditorBinding#_setup}\r\n */\r\nVisualMultiEditorBinding.prototype._setup = function () {\r\n\r\n\t/*\r\n\t * Prepare for multiple head sections.\r\n\t */\r\n\tthis._xhtmls = new Map();\r\n\r\n\t/*\r\n\t * Extract start content and determine key for storing HTML Markup.\r\n\t */\r\n\tvar textareas = this.getDescendantElementsByLocalName ( \"textarea\" );\r\n\twhile ( textareas.hasNext ()) {\r\n\t\tvar textarea = textareas.getNext ();\r\n\t\tif ( textarea.getAttribute ( \"selected\" ) == \"true\" ) {\r\n\t\t\tthis._startContent = textarea.value;\r\n\t\t\tthis._textareaname = textarea.getAttribute ( \"placeholderid\" );\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Fallback start content.\r\n\t * TODO: Can this be fixed in super or even superduper class?\r\n\t */\r\n\tif ( this._startContent == null ) {\r\n\t\tthis._startContent = VisualEditorBinding.DEFAULT_CONTENT;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {VisualEditorBinding#_initialize}\r\n */\r\nVisualMultiEditorBinding.prototype._initialize = function () {\r\n\r\n\tvar self = this;\r\n\r\n\t/*\r\n\t * Rig up the templates tree to update editor\r\n\t * content when a new placeholder is selected.\r\n\t */\r\n\tvar templatetree = this.getContentWindow ().bindingMap.templatetree;\r\n\ttemplatetree.addActionListener ( TreeBinding.ACTION_SELECTIONCHANGED, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tvar treenode = templatetree.getSelectedTreeNodeBindings ().getFirst ();\r\n\t\t\tself._placeHolderSelected ( treenode.textareaname );\r\n\t\t\taction.consume ();\r\n\t\t}\r\n\t});\r\n\r\n\ttemplatetree.addActionListener ( Binding.ACTION_FOCUSED, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tself._activateEditor ( false );\r\n\t\t}\r\n\t})\r\n\r\n\t/*\r\n\t * Inject startup content.\r\n\t */\r\n\tthis._updatePlaceHolders ();\r\n\r\n\t/*\r\n\t * Show the tools panel.\r\n\t * TODO: Maybe move this somewhere else so that uncollapse isn't noticable?\r\n\t */\r\n\tvar splitter = this.getContentWindow ().bindingMap.toolsplitter;\r\n\tsplitter.unCollapse ();\r\n\r\n\t/*\r\n\t * Finally invoke super method.\r\n\t */\r\n\tVisualMultiEditorBinding.superclass._initialize.call ( this );\r\n};\r\n\r\n/**\r\n * Parse textareas into treenodes.\r\n */\r\nVisualMultiEditorBinding.prototype._updatePlaceHolders = function () {\r\n\r\n\ttemplatetree = this.getContentWindow ().bindingMap.templatetree;\r\n\tvar textareas = this.getDescendantElementsByLocalName ( \"textarea\" );\r\n\r\n\ttemplatetree.empty ();\r\n\r\n\tif ( textareas.hasEntries ()) {\r\n\t\tthis._hasPlaceHolders = true;\r\n\t\tthis._parsePlaceHolders ( textareas );\r\n\t\tif ( this._isFinalized ) {\r\n\t\t\tthis._pageBinding.showEditor ( true );\r\n\t\t}\r\n\t} else {\r\n\t\tthis._hasPlaceHolders = false;\r\n\t\tthis._noPlaceHolders ();\r\n\t\tif ( this._isFinalized ) {\r\n\t\t\tthis._pageBinding.showEditor ( false );\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Actually parse textareas into treenodes.\r\n * @param {List<DOMElement>}\r\n */\r\nVisualMultiEditorBinding.prototype._parsePlaceHolders = function ( textareas ) {\r\n\r\n\tthis._textareas = new Map ();\r\n\r\n\t/*\r\n\t * Rig up textareas.\r\n\t */\r\n\twhile ( textareas.hasNext ()) {\r\n\t\tvar textarea = textareas.getNext ();\r\n\t\tvar placeholderid = textarea.getAttribute ( \"placeholderid\" );\r\n\t\tthis._textareas.set ( placeholderid,\r\n\t\t\t{\r\n\t\t\t\tplaceholderid       : placeholderid,\r\n\t\t\t\tplaceholdername \t: textarea.getAttribute ( \"placeholdername\" ),\r\n\t\t\t\tplaceholdermarkup \t: textarea.value,\r\n\t\t\t\ttextareaelement\t\t: textarea,\r\n\t\t\t\tisSelected \t\t\t: textarea.getAttribute ( \"selected\" ) == \"true\"\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n\r\n\t/*\r\n\t * Populate the tree and locate the selected treenode.\r\n\t */\r\n\tvar treenodes = new Map ();\r\n\tthis._textareas.each ( function ( name, object ) {\r\n\t\tvar treenode = templatetree.add (\r\n\t\t\tTreeNodeBinding.newInstance (\r\n\t\t\t\ttemplatetree.bindingDocument\r\n\t\t\t)\r\n\t\t);\r\n\t\ttreenode.setLabel ( object.placeholdername );\r\n\t\ttreenode.setImage ( \"${icon:placeholder}\" );\r\n\t\ttreenode.setProperty ( \"placeholder\", true );\r\n\t\ttreenode.textareaname = name;\r\n\t\ttreenodes.set ( object.placeholdername, treenode );\r\n\t\tif ( object.isSelected ) {\r\n\t\t\tselected = treenode;\r\n\t\t}\r\n\t});\r\n\r\n\ttemplatetree.attachRecursive ();\r\n\r\n\t/*\r\n\t * Select treenode and mount editor content.\r\n\t */\r\n\tif ( selected != null ) {\r\n\t\tvar object = this._textareas.get ( selected.textareaname );\r\n\t\tthis._textareaname = selected.textareaname;\r\n\t\tthis._placeholdername = object.placeholdername;\r\n\t\tthis._setContentFromPlaceHolder ( selected.textareaname );\r\n\t\tselected.focus ();\r\n\t}\r\n};\r\n\r\n/**\r\n * No placeholders in template: Display warning.\r\n */\r\nVisualMultiEditorBinding.prototype._noPlaceHolders = function () {\r\n\r\n\t/*\r\n\t * Build warning treenode.\r\n\t */\r\n\tvar templatetree = this.getContentWindow ().bindingMap.templatetree;\r\n\tvar treenode = templatetree.add (\r\n\t\tTreeNodeBinding.newInstance (\r\n\t\t\ttemplatetree.bindingDocument\r\n\t\t)\r\n\t);\r\n\ttreenode.setLabel ( StringBundle.getString ( \"Composite.Web.VisualEditor\", \"TemplateTree.NoTemplateWarning\" ));\r\n\ttreenode.setImage ( \"${icon:warning}\" );\r\n\ttreenode.attach ();\r\n\r\n\t/*\r\n\t * Neutralize statusbar\r\n\t */\r\n\tvar statusbar = this.getContentWindow ().bindingMap.statusbar;\r\n\tstatusbar.setPlaceHolderName ( null );\r\n};\r\n\r\n/**\r\n * Set editor content based on placeholder name. Currently,\r\n * this will reset the undo history for all placeholders.\r\n * @param {string} name\r\n */\r\nVisualMultiEditorBinding.prototype._setContentFromPlaceHolder = function ( name ) {\r\n\r\n\t/*\r\n\t * While initializing, content is presented in TinyMCE independantly from\r\n\t * the current placeholder selction. Content is only updated when finalized.\r\n\t */\r\n\tif ( this._isFinalized == true ) {\r\n\t\tvar object = this._textareas.get ( name );\r\n\t\tvar content = object.placeholdermarkup;\r\n\t\tthis.setValue ( this.normalizeToDocument ( content ));\r\n\t\tthis.resetUndoRedo ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Do stuff when tree selection changes.\r\n * @param {string} textareaname\r\n */\r\nVisualMultiEditorBinding.prototype._placeHolderSelected = function ( textareaname ) {\r\n\r\n\t/*\r\n\t * Unless we are initializing, backup current placeholdermarkup.\r\n\t */\r\n\tif ( this._isFinalized == true ) {\r\n\t\tif ( this._textareaname && this._textareas.has ( this._textareaname )) {\r\n\t\t\tthis._textareas.get ( this._textareaname ).placeholdermarkup = this.getValue ();\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Register new placeholdernames\r\n\t * and update the statusbar.\r\n\t */\r\n\tthis._textareaname = textareaname;\r\n\tthis._placeholdername = this._textareas.get ( this._textareaname ).placeholdername;\r\n\tvar statusbar = this.getContentWindow ().bindingMap.statusbar;\r\n\tstatusbar.setPlaceHolderName ( this._placeholdername );\r\n\r\n\t/*\r\n\t * Unless we are initializing,\r\n\t * update TinyMCE contentarea.\r\n\t */\r\n\tif ( this._isFinalized == true ) {\r\n\t\tvar self = this;\r\n\t\tApplication.lock ( self );\r\n\t\tsetTimeout ( function () {\r\n\t\t\tself._setContentFromPlaceHolder ( textareaname );\r\n\t\t\tApplication.unlock ( self );\r\n\t\t}, 0 );\r\n\t}\r\n\r\n\tthis.updateCssClasses();\r\n}\r\n\r\n/**\r\n * Cache Html markup.\r\n * @overloads {VisualEditorBinding#extractBody}\r\n * @param {string} html\r\n */\r\nVisualMultiEditorBinding.prototype.extractBody = function ( html ) {\r\n\r\n\tvar result = VisualMultiEditorBinding.superclass.extractBody.call(this, html);\r\n\tthis._xhtmls.set(this._textareaname, this._xhtml);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get cached html markup.\r\n * @overwrites {VisualEditorBinding#_getHtmlMarkup}\r\n * @return {string}\r\n */\r\nVisualMultiEditorBinding.prototype._getHtmlMarkup = function () {\r\n\r\n\tvar result = VisualEditorBinding.XHTML;\r\n\tif ( this._xhtmls.has ( this._textareaname )) {\r\n\t\tresult = this._xhtmls.get(this._textareaname);\r\n\t\tif ( result == null ) {\r\n\t\t\tresult = VisualEditorBinding.XHTML;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Manifest. This will write form elements into page DOM\r\n * so that the server recieves something on form submit.\r\n * @overwrites {VisualEditorBinding#manifest}\r\n * @implements {IData}\r\n */\r\nVisualMultiEditorBinding.prototype.manifest = function () {\r\n\r\n\tif ( this._textareas != null && this._textareas.hasEntries ()) {\r\n\t\tthis._textareas.get ( this._textareaname ).placeholdermarkup = this.getValue ();\r\n\t\tthis._textareas.each ( function ( name, object ) {\r\n\t\t\tobject.textareaelement.value = object.placeholdermarkup;\r\n\t\t});\r\n\t}\r\n};\r\n\r\n/**\r\n * TODO: Fix this horrendous uglyfication.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {EditorBinding#updateElement}\r\n * @param {Element} newelement\r\n * @param {Element} oldelement\r\n * @return {boolean}\r\n */\r\nVisualMultiEditorBinding.prototype.updateElement = function (newelement, oldelement, hasChanges) {\r\n\r\n\tvar newdiv = newelement.getElementsByTagName ( \"div\" ).item ( 0 );\r\n\tvar olddiv = oldelement.getElementsByTagName ( \"div\" ).item ( 0 );\r\n\tvar newareas = new List ( newdiv.getElementsByTagName ( \"textarea\" ));\r\n\tvar oldareas = new List ( olddiv.getElementsByTagName ( \"textarea\" ));\r\n\r\n\tif ( newareas.getLength () != oldareas.getLength ()) {\r\n\t\thasChanges = true;\r\n\t} else {\r\n\t\tvar index = 0;\r\n\t\tnewareas.each ( function ( newarea, index ) {\r\n\t\t\tvar oldarea = oldareas.get ( index );\r\n\t\t\tvar newid = newarea.getAttribute ( \"placeholderid\" );\r\n\t\t\tvar oldid = oldarea.getAttribute ( \"placeholderid\" );\r\n\t\t\tvar newname = newarea.getAttribute ( \"placeholdername\" );\r\n\t\t\tvar oldname = oldarea.getAttribute ( \"placeholdername\" );\r\n\t\t\tif ( newid != oldid || newname != oldname ) {\r\n\t\t\t\thasChanges = true;\r\n\t\t\t}\r\n\t\t\treturn !hasChanges;\r\n\t\t})\r\n\t}\r\n\r\n\tif ( hasChanges ) {\r\n\r\n\t\tvar html = null;\r\n\t\tif ( newdiv.innerHTML != null ) {\r\n\t\t\thtml = newdiv.innerHTML;\r\n\t\t} else {\r\n\t\t\thtml = DOMSerializer.serialize ( newdiv );\r\n\t\t\thtml = html.substring ( html.indexOf ( \">\" ) + 1, html.length );\r\n\t\t\thtml = html.substring ( 0, html.lastIndexOf ( \"<\" ));\r\n\t\t}\r\n\r\n\t\tvar div = this.bindingElement.getElementsByTagName ( \"div\" ).item ( 0 );\r\n\t\tif ( div != null ) {\r\n\t\t\tdiv.innerHTML = html;\r\n\t\t}\r\n\r\n\t\tthis._updatePlaceHolders ();\r\n\t}\r\n\r\n\treturn true;\r\n}\r\n\r\nVisualMultiEditorBinding.prototype.getContextContainer = function () {\r\n\r\n\tvar result = null;\r\n\tvar containerClasses = this.getContainerClasses();\r\n\tif (containerClasses != undefined) {\r\n\t\tvar ancestorContainer = ContextContainer.getAncestorContextContainer(this);\r\n\t\tresult = (ancestorContainer == null) ? new ContextContainer() : ancestorContainer.clone();\r\n\t\tresult.setContainerClasses(containerClasses);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nVisualMultiEditorBinding.prototype.getContainerClasses = function () {\r\n\r\n\tvar result = null;\r\n\tvar object = this._textareas.get(this._textareaname);\r\n\tif (object != null) {\r\n\t\tresult = object.containerclasses;\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/editors/visualeditor/multieditor/VisualMultiTemplateEditorBinding.js",
    "content": "VisualMultiTemplateEditorBinding.prototype = new VisualMultiEditorBinding;\r\nVisualMultiTemplateEditorBinding.prototype.constructor = VisualMultiTemplateEditorBinding;\r\nVisualMultiTemplateEditorBinding.superclass = VisualMultiEditorBinding.prototype;\r\n\r\n/**\r\n * The VisualMultiTemplateEditorBinding supports multiple GROUPED content areas.\r\n * @class\r\n */\r\nfunction VisualMultiTemplateEditorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"VisualMultiTemplateEditorBinding\" );\r\n\r\n\t/**\r\n\t * Cache content of deselected template placeholders, restore on reselection.\r\n\t * @type {Map<string><string>}\r\n\t */\r\n\tthis._oldtextareas = null;\r\n\r\n\t/**\r\n\t * Page id.\r\n\t * @type {Guid}\r\n\t */\r\n\tthis._pageId = null;\r\n\r\n\t/**\r\n\t * Template preview information.\r\n\t * @type {Object}\r\n\t */\r\n\tthis._templatePreview = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nVisualMultiTemplateEditorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[VisualMultiTemplateEditorBinding]\";\r\n};\r\n\r\n/**\r\n * @overloads {VisualEditorBinding#onBindingAttach}\r\n * @return\r\n */\r\nVisualMultiTemplateEditorBinding.prototype.onBindingAttach = function () {\r\n\r\n\tVisualMultiTemplateEditorBinding.superclass.onBindingAttach.call ( this );\r\n\tthis._oldtextareas = new Map ();\r\n\r\n\tif (this.getProperty(\"pageid\"))\r\n\t\tthis._pageId = this.getProperty(\"pageid\");\r\n}\r\n\r\n/**\r\n * @overloads {VisualEditorBinding#_onPageInitialize}\r\n * @return\r\n */\r\nVisualMultiTemplateEditorBinding.prototype._onPageInitialize = function ( binding ) {\r\n\r\n\tVisualMultiTemplateEditorBinding.superclass._onPageInitialize.call(this, binding);\r\n\r\n\tif (this.bindingElement.offsetWidth > 1000) {\r\n\t\tthis.getContentWindow().bindingMap.visualeditorsplitbox.setLayout(\"4:1\");\r\n\t}\r\n\r\n\tvar self = this;\r\n\tthis.getContentWindow().bindingMap.visualeditorsplitbox.addActionListener(SplitterBinding.ACTION_DRAGGED,\r\n\t\t{\r\n\t\t\thandleAction: function () {\r\n\t\t\t\tself.handleCommand(\"CompositeUpdateLayout\", false, null);\r\n\t\t\t}\r\n\t\t});\r\n}\r\n\r\n\r\n\r\n/**\r\n * @overloads {VisualMultiEditorBinding#_initialize}\r\n */\r\nVisualMultiTemplateEditorBinding.prototype._initialize = function () {\r\n\r\n\tvar self = this;\r\n\r\n\t/*\r\n\t * Rig up selector.\r\n\t */\r\n\tvar selector = this.getDescendantBindingByLocalName ( \"selector\" );\r\n\tselector.attach ();\r\n\tthis._populateTemplateSelector ();\r\n\r\n\t/*\r\n\t * Contained page selector is wired to control main page selector.\r\n\t * When selection changes, main page performs a postback.\r\n\t */\r\n\tvar templateselector = this.getContentWindow ().bindingMap.templateselector;\r\n\ttemplateselector.addActionListener ( SelectorBinding.ACTION_SELECTIONCHANGED, {\r\n\t\thandleAction : function () {\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tself._onTemplateSelectionChanged ();\r\n\t\t\t}, 0 );\r\n\t\t}\r\n\t});\r\n\r\n\t/*\r\n\t * Show the template toolbar.\r\n\t */\r\n\tthis.getContentWindow ().bindingMap.templatetoolbar.show ();\r\n\r\n\t/*\r\n\t * Invoke super method.\r\n\t */\r\n\tVisualMultiTemplateEditorBinding.superclass._initialize.call(this);\r\n\r\n\tthis.updateTemplatePreview();\r\n\r\n};\r\n\r\n/**\r\n * Populate template selector from hidden selector selections.\r\n */\r\nVisualMultiTemplateEditorBinding.prototype._populateTemplateSelector = function () {\r\n\r\n\tvar hiddenselector = this.getDescendantBindingByLocalName ( \"selector\" );\r\n\tvar templateselector = this.getContentWindow ().bindingMap.templateselector;\r\n\thiddenselector.selections.each ( function ( selection ) {\r\n\t\tselection.imageProfile = new ImageProfile ({\r\n\t\t\timage : \"${icon:page-template-template}\"\r\n\t\t});\r\n\t});\r\n\ttemplateselector.populateFromList ( hiddenselector.selections );\r\n}\r\n\r\n/**\r\n * Template selection changed. This event must be channelized to the hidden selector.\r\n */\r\nVisualMultiTemplateEditorBinding.prototype._onTemplateSelectionChanged = function () {\r\n\r\n\tvar hiddenselector = this.getDescendantBindingByLocalName ( \"selector\" );\r\n\tvar templateselector = this.getContentWindow ().bindingMap.templateselector;\r\n\thiddenselector.selectByValue ( templateselector.getValue ());\r\n\thiddenselector.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\tthis.checkForDirty ( true );\r\n}\r\n\r\n/**\r\n * Actually parse textareas into treenodes.\r\n * @param {List<DOMElement>}\r\n */\r\nVisualMultiTemplateEditorBinding.prototype._parsePlaceHolders = function (textareas) {\r\n\r\n\t/*\r\n\t * Reset textareas Map but keep a copy of the old\r\n\t * map content in order to persist content changes.\r\n\t * Similarly named placeholder will inherit cache.\r\n\t */\r\n\tvar nev = this._textareas;\r\n\tvar old = this._oldtextareas;\r\n\r\n\tif ( nev != null ) {\r\n\t\tnev.each ( function ( key, value ) {\r\n\t\t\told.set ( key, value );\r\n\t\t});\r\n\t}\r\n\r\n\tthis._textareas = new Map ();\r\n\r\n\t/*\r\n\t * Nifty function to persist changes.\r\n\t * @param {string} placeholderid\r\n\t * @param {string} placeholdermarkup\r\n\t * @return {string}\r\n\t */\r\n\tfunction compute ( placeholderid, placeholdermarkup ) {\r\n\t\tvar result = placeholdermarkup;\r\n\t\tif ( old.has ( placeholderid )) {\r\n\t\t\tresult = old.get ( placeholderid ).placeholdermarkup;\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\r\n\t/*\r\n\t * Rig up textareas.\r\n\t */\r\n\twhile ( textareas.hasNext ()) {\r\n\t\tvar textarea = textareas.getNext ();\r\n\t\tvar placeholderid = textarea.getAttribute ( \"placeholderid\" );\r\n\t\tthis._textareas.set ( placeholderid,\r\n\t\t\t{\r\n\t\t\t\tplaceholderid       : placeholderid,\r\n\t\t\t\tplaceholdername \t: textarea.getAttribute ( \"placeholdername\" ),\r\n\t\t\t\tplaceholdermarkup \t: compute ( placeholderid, textarea.value ),\r\n\t\t\t\ttextareaelement\t\t: textarea,\r\n\t\t\t\tisSelected \t\t\t: textarea.getAttribute ( \"selected\" ) == \"true\",\r\n\t\t\t\tcontainerclasses\t: textarea.getAttribute ( \"containerclasses\" )\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n\r\n\t/*\r\n\t * Populate the tree and locate the selected treenode.\r\n\t * TODO: Don't copy paste this step from super class!\r\n\t */\r\n\tvar selected = null;\r\n\tvar templatetree = this.getContentWindow ().bindingMap.templatetree;\r\n\r\n\tvar treenodes = new Map ();\r\n\tthis._textareas.each ( function ( name, object ) {\r\n\t\tvar treenode = templatetree.add (\r\n\t\t\tTreeNodeBinding.newInstance (\r\n\t\t\t\ttemplatetree.bindingDocument\r\n\t\t\t)\r\n\t\t);\r\n\t\ttreenode.setLabel ( object.placeholdername );\r\n\t\ttreenode.setImage ( \"${icon:placeholder}\" );\r\n\t\ttreenode.setProperty ( \"placeholder\", true );\r\n\t\ttreenode.textareaname = name;\r\n\t\ttreenodes.set ( object.placeholdername, treenode );\r\n\t\tif ( object.isSelected ) {\r\n\t\t\tselected = treenode;\r\n\t\t}\r\n\t});\r\n\r\n\ttemplatetree.attachRecursive ();\r\n\r\n\t/*\r\n\t * This convoluted setup ensures that a placeholder\r\n\t * will be selected that matches the last selected\r\n\t * placeholder (before template was changed).\r\n\t */\r\n\tif ( selected != null ) {\r\n\r\n\t\tvar isDefaultBehavior = true;\r\n\r\n\t\tif ( this._oldtextareas.hasEntries ()) {\r\n\r\n\t\t\tisDefaultBehavior = false;\r\n\t\t\tvar map = new Map ();\r\n\t\t\tthis._textareas.each ( function ( id, object ) {\r\n\t\t\t\tmap.set ( object.placeholdername, true );\r\n\t\t\t});\r\n\t\t\tif ( !map.has ( this._placeholdername )) {\r\n\t\t\t\tisDefaultBehavior = true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ( isDefaultBehavior ) {\r\n\t\t\tvar object = this._textareas.get ( selected.textareaname );\r\n\t\t\tthis._textareaname = selected.textareaname;\r\n\t\t\tthis._placeholdername = object.placeholdername;\r\n\t\t\tthis._setContentFromPlaceHolder ( selected.textareaname );\r\n\t\t\tselected.focus ();\r\n\t\t} else {\r\n\t\t\tvar treenode = treenodes.get ( this._placeholdername );\r\n\t\t\tthis._textareaname = treenode.textareaname;\r\n\t\t\ttreenode.focus ();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * @overloads {VisualMultiEditorBinding#_placeHolderSelected}\r\n * @param {string} name\r\n */\r\nVisualMultiTemplateEditorBinding.prototype._placeHolderSelected = function (name) {\r\n\r\n\tVisualMultiTemplateEditorBinding.superclass._placeHolderSelected.call(this, name);\r\n\r\n\tthis.updateBodyWidth();\r\n}\r\n\r\n\r\n/**\r\n\t * Get elements by tagname in IXMLDOMElement\r\n\t * @param {DOMNode} node\r\n\t * @param {string} tagname\r\n\t * @return {NodeList} this would be an simple array in explorer...\r\n\t */\r\nVisualMultiTemplateEditorBinding.prototype._getElementsByTagName = function (node, tagname) {\r\n\tvar result = null;\r\n\tif (Client.isWebKit || Client.isExplorer) {\r\n\t\tresult = node.getElementsByTagName(tagname);\r\n\t} else {\r\n\t\tresult = node.getElementsByTagName(\"ui:\" + tagname);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n\r\n/**\r\n * Some pretty hacked stuff going on here. Stuff like this should not be communicated\r\n * through the page DOM, but via a dedicated service offering structured data. Oh well...\r\n * @implements {IUpdateHandler}\r\n * @overloads {VisualMultiEditorBinding#updateElement}\r\n * @param {Element} newelement\r\n * @param {Element} oldelement\r\n * @return {boolean}\r\n */\r\nVisualMultiTemplateEditorBinding.prototype.updateElement = function ( newelement, oldelement ) {\r\n\r\n\tvar newselector = this._getElementsByTagName(newelement, \"selector\" ).item ( 0 );\r\n\tvar oldselector = this._getElementsByTagName(oldelement, \"selector\" ).item ( 0 );\r\n\r\n\tvar hasChanges = false;\r\n\tvar templateChanged = false;\r\n\r\n\tif ( newselector != null && oldselector != null ) {\r\n\t\tvar newselections = new List ( this._getElementsByTagName(newselector, \"selection\" ));\r\n\t\tvar oldselections = new List ( this._getElementsByTagName(oldselector, \"selection\" ));\r\n\t\tif ( newselections.getLength () != oldselections.getLength ()) {\r\n\t\t\thasChanges = true;\r\n\t\t\ttemplateChanged = true;\r\n\t\t} else {\r\n\t\t\tnewselections.each ( function ( element, index ) {\r\n\t\t\t\tvar newvalue = element.getAttribute ( \"value\" );\r\n\t\t\t\tvar oldvalue = oldselections.get ( index ).getAttribute ( \"value\" );\r\n\t\t\t\tif ( newvalue != oldvalue ) {\r\n\t\t\t\t\thasChanges = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn !hasChanges;\r\n\t\t\t});\r\n\t\t\tnewselections.each(function (element, index) {\r\n\t\t\t\tvar newselected = element.getAttribute(\"selected\");\r\n\t\t\t\tvar oldselected = oldselections.get(index).getAttribute(\"selected\");\r\n\t\t\t\tif (newselected != oldselected) {\r\n\t\t\t\t\ttemplateChanged = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn !templateChanged;\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tif ( hasChanges ) {\r\n\t\tvar div = this.bindingElement.getElementsByTagName ( \"div\" ).item ( 1 );\r\n\t\tthis.bindingWindow.DocumentManager.detachBindings ( div, true );\r\n\t\tdiv.innerHTML = DOMSerializer.serialize ( newselector );\r\n\t\tthis.bindingWindow.DocumentManager.attachBindings ( div );\r\n\t\tthis._populateTemplateSelector ();\r\n\t}\r\n\r\n\tif (templateChanged) {\r\n\t\tthis.updateTemplatePreview();\r\n\t}\r\n\r\n\r\n\treturn VisualMultiTemplateEditorBinding.superclass.updateElement.call(this, newelement, oldelement, templateChanged);\r\n\r\n\r\n}\r\n\r\n/**\r\n @overloads {EditorBinding#updateElement}\r\n */\r\nVisualMultiTemplateEditorBinding.prototype.enableDialogMode = function () {\r\n\r\n\tStageBinding.placeholderWidth = this.getPlaceholderWidth();\r\n\r\n\tVisualMultiTemplateEditorBinding.superclass.enableDialogMode.call(this);\r\n}\r\n\r\n/**\r\n @overloads {EditorBinding#disableDialogMode}\r\n */\r\nVisualMultiTemplateEditorBinding.prototype.disableDialogMode = function () {\r\n\r\n\tStageBinding.placeholderWidth = null;\r\n\r\n\tVisualMultiTemplateEditorBinding.superclass.disableDialogMode.call(this);\r\n}\r\n\r\n/**\r\n * Get placeholder width\r\n * @return {int}\r\n */\r\nVisualMultiTemplateEditorBinding.prototype.getPlaceholderWidth = function (placeholderId) {\r\n\tvar placeholderWidth = null;\r\n\tif (placeholderId == undefined) {\r\n\t\tplaceholderId = this._textareaname;\r\n\t}\r\n\tvar self = this;\r\n\tif (this._templatePreview) {\r\n\t\tnew List(this._templatePreview.Placeholders).each(function (placeholder) {\r\n\t\t\tif (placeholder.PlaceholderId == placeholderId) {\r\n\t\t\t\tplaceholderWidth = placeholder.ClientRectangle.Width;\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\treturn placeholderWidth;\r\n}\r\n\r\n\r\n/**\r\n * Update template preview information\r\n */\r\nVisualMultiTemplateEditorBinding.prototype.updateTemplatePreview = function (sync) {\r\n\tvar pageId = this._pageId;\r\n\tvar templateId = this.getDescendantBindingByLocalName ( \"selector\" ).getValue();\r\n\tthis._templatePreview = null;\r\n\tvar self = this;\r\n\tPageTemplateService.GetTemplatePreviewInformation(pageId, templateId,\r\n\t\tfunction(result) {\r\n\t\t\tself._templatePreview = result;\r\n\t\t\tself.updateBodyWidth();\r\n\t\t});\r\n\r\n}\r\n\r\n\r\n/**\r\n * @overloads {VisualEditorBinding#getSoapTinyContent}\r\n * @return {SOAP}\r\n */\r\nVisualMultiTemplateEditorBinding.prototype.getSoapTinyContent = function (content) {\r\n\tvar pageId = this._pageId;\r\n\tvar placeholder = this._textareaname;\r\n\tvar templateId = this.getDescendantBindingByLocalName(\"selector\").getValue();\r\n\tvar width = this.getEffectiveWidth();\r\n\treturn XhtmlTransformationsService.StructuredContentToTinyContentMultiTemplate(content, pageId, templateId, placeholder, width);\r\n}\r\n\r\n/**\r\n * @overloads {VisualEditorBinding#getImageTagForFunctionCall}\r\n * @return {SOAP}\r\n */\r\n\r\nVisualMultiTemplateEditorBinding.prototype.getImageTagForFunctionCall = function (markup) {\r\n\tvar pageId = this._pageId;\r\n\tvar placeholder = this._textareaname;\r\n\tvar templateId = this.getDescendantBindingByLocalName(\"selector\").getValue();\r\n\tvar width = this.getEffectiveWidth();\r\n\treturn XhtmlTransformationsService.GetImageTagForFunctionCall2(markup, pageId, templateId, placeholder, width);\r\n}\r\n\r\nVisualMultiTemplateEditorBinding.prototype.getContextContainer = function () {\r\n\r\n\tvar result = null;\r\n\tvar pageId = this._pageId;\r\n\tvar containerClasses = this.getContainerClasses();\r\n\r\n\tvar ancestorContainer = ContextContainer.getAncestorContextContainer(this);\r\n\tresult = (ancestorContainer == null) ? new ContextContainer() : ancestorContainer.clone();\r\n\tif (containerClasses != undefined) {\r\n\t\tresult.setContainerClasses(containerClasses);\r\n\t}\r\n\tresult.setProperty(\"pageId\", pageId);\r\n\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/errors/ErrorBinding.js",
    "content": "ErrorBinding.prototype = new Binding;\r\nErrorBinding.prototype.constructor = ErrorBinding;\r\nErrorBinding.superclass = Binding.prototype;\r\n\r\nErrorBinding.ACTION_INITIALIZE = \"error initialize\";\r\n\r\n/**\r\n * Display error in BalloonBinding somewhere near a DataBinding.\r\n * @param {object} error A simple object with one property \"text\" (for now).\r\n * @param {IData} binding\r\n */\r\nErrorBinding.presentError = function ( error, binding ) {\r\n\r\n\tif ( Interfaces.isImplemented ( IData, binding ) == true ) {\r\n\r\n\t\t/*\r\n\t\t * Analyze environment in order to determine whether or not we are\r\n\t\t * in a dialog, in which case another BalloonSetBinding is used.\r\n\t\t * TODO: refactor with getAncestorBindingByType ( xxx, true )???\r\n\t\t */\r\n\t\tvar isDialog, action = binding.dispatchAction ( ErrorBinding.ACTION_INITIALIZE );\r\n\t\tif ( action && action.isConsumed ) {\r\n\t\t\tswitch ( action.listener.constructor ) {\r\n\t\t\t\tcase StageBinding :\r\n\t\t\t\t\tisDialog = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase StageDialogBinding :\r\n\t\t\t\t\tisDialog = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar balloonset = isDialog ?\r\n\t\t\ttop.app.bindingMap.dialogballoonset :\r\n\t\t\ttop.app.bindingMap.balloonset;\r\n\r\n\t\tvar balloon = null;\r\n\r\n\t\tballoonset.getDescendantBindingsByType(BalloonBinding).each(function (balloonBinding) {\r\n\t\t\tif (balloonBinding.isSnapTo(binding)) {\r\n\t\t\t\tballoon = balloonBinding;\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}, this);\r\n\r\n\t\tif (balloon != null) {\r\n\t\t\tballoon.setLabel(error.text);\r\n\t\t} else {\r\n\t\t\tballoon = balloonset.add(\r\n\t\t\t\tBalloonBinding.newInstance(top.app.document)\r\n\t\t\t);\r\n\t\t\tballoon.setLabel(error.text);\r\n\t\t\tballoon.snapTo(binding);\r\n\t\t\tballoon.attach();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ErrorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ErrorBinding\" );\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nErrorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ErrorBinding]\";\r\n}\r\n\r\n/**\r\n * Notice that the binding disposes as soon as it attaches.\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nErrorBinding.prototype.onBindingAttach = function () {\r\n\r\n\tErrorBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tvar dataManager = this.bindingWindow.DataManager;\r\n\tvar text = this.getProperty ( \"text\" );\r\n\tvar name = this.getProperty ( \"targetname\" );\r\n\r\n\tvar binding = dataManager.getDataBinding ( name );\r\n\tif ( binding ) {\r\n\t\tErrorBinding.presentError ({\r\n\t\t\ttext : text\r\n\t\t}, binding );\r\n\t} else if (window.console) {\r\n\t\tconsole.error ( \"ErrorBinding dysfunction: No such DataBinding!\\n\" + name );\r\n\t\tif ( name.indexOf ( \"_\" ) >-1 ) {\r\n\t\t\tconsole.error ( \"Name contains '_' - replace with '$' ?\" );\r\n\t\t}\r\n\t}\r\n\tthis.dispose ();\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/explorer/ExplorerBinding.js",
    "content": "﻿ExplorerBinding.prototype = new FlexBoxBinding;\r\nExplorerBinding.prototype.constructor = ExplorerBinding;\r\nExplorerBinding.superclass = FlexBoxBinding.prototype;\r\nExplorerBinding.ACTION_INITIALIZED = \"explorer initialized\";\r\n\r\n\r\n/*\r\n * Perspective tags.\r\n * TODO: These should be updated to something more ... particular!\r\n */\r\nExplorerBinding.PERSPECTIVE_CONTENT\t\t= \"Content\";\r\nExplorerBinding.PERSPECTIVE_MEDIA \t\t= \"Media\";\r\nExplorerBinding.PERSPECTIVE_DATA \t\t= \"Datas\";\r\nExplorerBinding.PERSPECTIVE_DESIGN \t\t= \"Design\";\r\nExplorerBinding.PERSPECTIVE_FUNCTIONS \t= \"Functions\";\r\nExplorerBinding.PERSPECTIVE_USERS \t\t= \"Users\";\r\nExplorerBinding.PERSPECTIVE_SYSTEM \t\t= \"System\";\r\n\r\n/**\r\n * Static reference to the ExplorerBinding instance. Assigned on startup.\r\n * @see {ExplorerBinding#onBindingInitialize}\r\n * @type {ExplorerBinding}\r\n */\r\nExplorerBinding.bindingInstance = null;\r\n\r\n/**\r\n * Get focused treenodes.\r\n * @return {List}\r\n */\r\nExplorerBinding.getFocusedTreeNodeBindings = function () {\r\n\r\n\tvar selectedDeck = ExplorerBinding.bindingInstance.getSelectedDeckBinding();\r\n\tvar selectedTree = selectedDeck.getSystemTree();\r\n\tif (!selectedTree) {\r\n\t\treturn new List();\r\n\t}\r\n\tvar focusedTreeNodeBinding = selectedTree.getFocusedTreeNodeBindings();\r\n\r\n\t//TODO: Refactor this\r\n\t//if nothing selected in tabs try find in dialog tree\r\n\tif (!focusedTreeNodeBinding.hasEntries() && StageBinding.treeSelector)\r\n\t\tfocusedTreeNodeBinding = StageBinding.treeSelector.getFocusedTreeNodeBindings();\r\n\r\n\treturn focusedTreeNodeBinding;\r\n};\r\n\r\n\r\n/**\r\n * Save focused Nodes.\r\n * @return {List}\r\n */\r\nExplorerBinding.saveFocusedNodes = function () {\r\n\tvar treeNodeBindings = this.getFocusedTreeNodeBindings();\r\n\tLocalStore.focuseNodes.clear();\r\n\ttreeNodeBindings.each(function (treeNodeBinding) {\r\n\t\tLocalStore.focuseNodes.add(treeNodeBinding.node);\r\n\t});\r\n\r\n};\r\n\r\n\r\n/**\r\n * Restore selected Nodes.\r\n * @return {List}\r\n */\r\nExplorerBinding.restoreFocuseNodes = function () {\r\n\tvar entityTokens = LocalStore.focuseNodes.getEntityTokens();\r\n\t\r\n\tvar selectedDeck = ExplorerBinding.bindingInstance.getSelectedDeckBinding();\r\n\tvar selectedTree = selectedDeck.getSystemTree();\r\n\t\r\n\tentityTokens =  new List ( TreeService.GetCurrentLocaleEntityTokens(entityTokens.toArray()) );\r\n\t\r\n\tentityTokens.each(function(entityToken) {\r\n\t\tselectedTree._focusTreeNodeByEntityToken(entityToken);\r\n\t});\r\n\t\r\n\tLocalStore.focuseNodes.clear();\r\n};\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ExplorerBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ExplorerBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {ExplorerMenuBinding}\r\n\t */\r\n\tthis._menuBinding = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nExplorerBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ExplorerBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nExplorerBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tExplorerBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis._menuBinding = this.addMember ( \r\n\t\tthis.getDescendantBindingByLocalName ( \"explorermenu\" )\r\n\t);\r\n}\r\n\r\n\r\n/**\r\n * @overloads {TreeBinding#onBindingRegister}\r\n */\r\nExplorerBinding.prototype.onBindingRegister = function () {\r\n\r\n\tExplorerBinding.superclass.onBindingRegister.call(this);\r\n\r\n\tthis.setContextMenu(top.app.bindingMap.explorerpopup);\r\n}\r\n\r\n\r\n/**\r\n * @overloads {Binding#onBindingInitialize}\r\n */\r\nExplorerBinding.prototype.onBindingInitialize = function () {\r\n\t\r\n\tExplorerBinding.bindingInstance = this;\r\n\tExplorerBinding.superclass.onBindingInitialize.call ( this );\r\n\tthis.dispatchAction(ExplorerBinding.ACTION_INITIALIZED);\r\n\t//update scroll after init\r\n\tthis._menuBinding.updateScroll();\r\n}\r\n\r\n/**\r\n * Set selection by handle.\r\n * public API\r\n * @param {string} handle\r\n */\r\nExplorerBinding.prototype.setSelectionByHandle = function ( handle ) {\r\n\r\n\tthis._menuBinding.setSelectionByHandle ( handle );\r\n}\r\n\r\n/**\r\n * Get selection handle.\r\n * public API\r\n */\r\nExplorerBinding.prototype.getSelectionHandle = function () {\r\n\r\n\treturn this._menuBinding.getSelectionHandle();\r\n}\r\n\r\n/**\r\n * Selecting default (the first button).\r\n */\r\nExplorerBinding.prototype.setSelectionDefault = function () {\r\n\t\r\n\tthis._menuBinding.setSelectionDefault ();\r\n}\r\n\r\n/**\r\n * Get Perspectives\r\n * public API\r\n */\r\nExplorerBinding.prototype.getPerspectives = function () {\r\n\r\n\treturn this._menuBinding.getButtons();\r\n}\r\n\r\n/**\r\n * Get selected deck.\r\n * @return {DeckBinding}\r\n */\r\nExplorerBinding.prototype.getSelectedDeckBinding = function () {\r\n\t\r\n\treturn app.bindingMap.stagedecks.getSelectedDeckBinding();\r\n}\r\n\r\n/**\r\n * Building explorer content on startup.\r\n * @param {SystemViewDefinition} definition\r\n */\r\nExplorerBinding.prototype.mountDefinition = function ( definition ) {\r\n\t\r\n\tif ( definition instanceof SystemViewDefinition ) {\r\n\t\tthis._menuBinding.mountDefinition ( definition );\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/explorer/ExplorerMenuBinding.js",
    "content": "ExplorerMenuBinding.prototype = new Binding;\r\nExplorerMenuBinding.prototype.constructor = ExplorerMenuBinding;\r\nExplorerMenuBinding.superclass = Binding.prototype;\r\nExplorerMenuBinding.ACTION_SELECTIONCHANGED = \"explorermenu selectionchanged\";\r\n\r\nExplorerMenuBinding.SCROLLUP_CLASSNAME = \"scrollup\";\r\nExplorerMenuBinding.SCROLLDOWN_CLASSNAME = \"scrolldown\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ExplorerMenuBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"ExplorerMenuBinding\");\r\n\r\n\t/**\r\n\t * Associating buttons to handles.\r\n\t * @type {Map<string><ToolBarButtonBinding>}\r\n\t */\r\n\tthis._buttons = new Map();\r\n\r\n\t/**\r\n\t * @type {List<ToolBarButtonBinding}\r\n\t */\r\n\tthis._list = new List();\r\n\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._index = -1;\r\n\r\n\t/**\r\n\t * The small toolbargroup\r\n\t * @type {ToolBarGroupBinding}\r\n\t */\r\n\tthis._group = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._selectedHandle = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._selectedTag = null;\r\n\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nExplorerMenuBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ExplorerMenuBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nExplorerMenuBinding.prototype.onBindingRegister = function () {\r\n\r\n\tExplorerMenuBinding.superclass.onBindingRegister.call(this);\r\n\tthis.addActionListener(RadioGroupBinding.ACTION_SELECTIONCHANGED, this);\r\n\tthis.subscribe(this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST);\r\n\tthis.addEventListener(DOMEvents.SCROLL);\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nExplorerMenuBinding.prototype.onBindingAttach = function () {\r\n\r\n\tExplorerMenuBinding.superclass.onBindingAttach.call(this);\r\n\tthis.addMember ( this.getChildBindingByLocalName ( \"explorertoolbar\" ));\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onMemberInitialize}\r\n * @param {Binding} binding\r\n */\r\nExplorerMenuBinding.prototype.onMemberInitialize = function (binding) {\r\n\r\n\tswitch (binding.constructor) {\r\n\t\tcase ExplorerToolBarBinding:\r\n\t\t\tthis._group = binding.getToolBarGroupByIndex(0);\r\n\t\t\tbreak;\r\n\t}\r\n\tExplorerMenuBinding.superclass.onMemberInitialize.call(this, binding);\r\n}\r\n\r\n/**\r\n * Mount viewDefinition, building menu items.\r\n * @param {SystemViewDefinition} definition\r\n */\r\nExplorerMenuBinding.prototype.mountDefinition = function (definition) {\r\n\r\n\tthis._buttons.set(definition.handle, this._mountMinButton(definition));\r\n\tthis._index++;\r\n}\r\n\r\n/**\r\n * get buttons.\r\n * @return Map<string><ToolBarButtonBinding>\r\n */\r\nExplorerMenuBinding.prototype.getButtons = function () {\r\n\r\n\treturn this._buttons;\r\n}\r\n\r\n/**\r\n * Building small menubutton.\r\n * @param {SystemViewDefinition} definition\r\n * @return {ExplorerToolBarButtonBinding}\r\n */\r\nExplorerMenuBinding.prototype._mountMinButton = function (definition) {\r\n\r\n\tvar button = ExplorerToolBarButtonBinding.newInstance(\r\n\t\t\tthis.bindingDocument,\r\n\t\t\tExplorerToolBarButtonBinding.TYPE_NORMAL\r\n\t);\r\n\tbutton.setLabel(definition.label);\r\n\tbutton.setToolTip(definition.label); // use label as tooltip\r\n\tbutton.handle = definition.handle;\r\n\tbutton.node = definition.node;\r\n\tif (Application.isTestEnvironment) {\r\n\t\tbutton.setProperty(\"data-qa\", definition.node.getTag());\r\n\t}\r\n\tthis._group.add(button);\r\n\tthis._list.add(button);\r\n\tbutton.attach();\r\n\treturn button;\r\n}\r\n\r\n/**\r\n * Fires when selection changes in either one of the menus.\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nExplorerMenuBinding.prototype.handleAction = function (action) {\r\n\r\n\tExplorerMenuBinding.superclass.handleAction.call(this, action);\r\n\r\n\tswitch (action.type) {\r\n\t\tcase RadioGroupBinding.ACTION_SELECTIONCHANGED:\r\n\r\n\t\t\tthis.collapse();\r\n\t\t\tvar radioGroupBinding = action.target;\r\n\t\t\tvar buttonBinding = radioGroupBinding.getCheckedButtonBinding();\r\n\t\t\tvar handle = buttonBinding.handle;\r\n\r\n\t\t\tthis._selectedHandle = handle;\r\n\t\t\tthis._selectedTag = buttonBinding.node.getTag();\r\n\t\t\tthis.dispatchAction ( ExplorerMenuBinding.ACTION_SELECTIONCHANGED );\r\n\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IEventHandler}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nExplorerMenuBinding.prototype.handleEvent = function (e) {\r\n\r\n\tExplorerMenuBinding.superclass.handleEvent.call(this, e);\r\n\r\n\tswitch (e.type) {\r\n\r\n\t\tcase DOMEvents.SCROLL:\r\n\t\t\tthis.updateScroll();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nExplorerMenuBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tExplorerMenuBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tswitch (broadcast) {\r\n\t\tcase this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST:\r\n\t\t\tthis.collapse();\r\n\t\t\tthis.updateScroll();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Set selection by handle.\r\n * @param {string} handle\r\n */\r\nExplorerMenuBinding.prototype.setSelectionByHandle = function (handle) {\r\n\r\n\tvar buttonBinding = this._buttons.get(handle);\r\n\r\n\tif (buttonBinding) {\r\n\t\tbuttonBinding.check();\r\n\t} else {\r\n\t\tthis.setSelectionDefault();\r\n\t}\r\n}\r\n\r\n/**\r\n * Get handle on selected viewDefinition.\r\n * @return {string}\r\n */\r\nExplorerMenuBinding.prototype.getSelectionHandle = function () {\r\n\r\n\treturn this._selectedHandle;\r\n}\r\n\r\n/**\r\n * Get tag on selected viewDefinition (or the SystemNode associated to it).\r\n * @return {string}\r\n */\r\nExplorerMenuBinding.prototype.getSelectionTag = function () {\r\n\r\n\treturn this._selectedTag;\r\n}\r\n\r\n/**\r\n * Selecting first button by default.\r\n */\r\nExplorerMenuBinding.prototype.setSelectionDefault = function () {\r\n\r\n\tif (this._list.hasEntries()) {\r\n\t\tvar defaultButton = this._list.getFirst();\r\n\r\n\t\tthis._list.each(function(button) {\r\n\t\t\tif (button.node && button.node.getPropertyBag) {\r\n\t\t\t\tvar propertyBag = button.node.getPropertyBag();\r\n\t\t\t\tif (propertyBag && propertyBag.IsTool) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdefaultButton = button;\r\n\t\t\treturn false;\r\n\t\t}, this);\r\n\r\n\t\tdefaultButton.check();\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Toogle explorer\r\n */\r\nExplorerMenuBinding.prototype.toggle = function () {\r\n\tif (top.app.bindingMap.app.hasClassName(\"exploler-expanded\")) {\r\n\t\tthis.collapse();\r\n\t} else {\r\n\t\tthis.expand();\r\n\t}\r\n}\r\n\r\n/**\r\n * Collapse explorer\r\n */\r\nExplorerMenuBinding.prototype.collapse = function () {\r\n\ttop.app.bindingMap.app.detachClassName(\"exploler-expanded\");\r\n\ttop.app.bindingMap.menutogglebutton.setImage(\"${icon:menu}\");\r\n\r\n}\r\n\r\n\r\n/**\r\n * Expand explorer\r\n */\r\nExplorerMenuBinding.prototype.expand = function () {\r\n\ttop.app.bindingMap.app.attachClassName(\"exploler-expanded\");\r\n\ttop.app.bindingMap.menutogglebutton.setImage(\"${icon:arrow-left}\");\r\n}\r\n\r\n/**\r\n * Toogle explorer\r\n */\r\nExplorerMenuBinding.prototype.updateScroll = function () {\r\n\tvar scrollTop = this.bindingElement.scrollTop;\r\n\tvar scrollHeight = this.bindingElement.scrollHeight;\r\n\tvar clientHeight = this.bindingElement.clientHeight;\r\n\tif (scrollTop === 0){\r\n\t\tExplorerBinding.bindingInstance.detachClassName(ExplorerMenuBinding.SCROLLUP_CLASSNAME);\r\n\t} else {\r\n\t\tExplorerBinding.bindingInstance.attachClassName(ExplorerMenuBinding.SCROLLUP_CLASSNAME);\r\n\t}\r\n\r\n\tif (scrollTop + clientHeight < scrollHeight) {\r\n\t\tthis.attachClassName(ExplorerMenuBinding.SCROLLDOWN_CLASSNAME);\r\n\t} else {\r\n\t\tthis.detachClassName(ExplorerMenuBinding.SCROLLDOWN_CLASSNAME);\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/explorer/ExplorerPopupBinding.js",
    "content": "﻿ExplorerPopupBinding.prototype = new SystemTreePopupBinding;\nExplorerPopupBinding.prototype.constructor = ExplorerPopupBinding;\nExplorerPopupBinding.superclass = SystemTreePopupBinding.prototype;\n\n/**\n * @class\n */\nfunction ExplorerPopupBinding () {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger ( \"ExplorerPopupBinding\" );\n}\n\n/**\n * @overloads {Binding#onBindingRegister}\n */\nExplorerPopupBinding.prototype.onBindingRegister = function () {\n\n\tSystemTreePopupBinding.superclass.onBindingRegister.call ( this );\n\tthis.addActionListener ( MenuItemBinding.ACTION_COMMAND, this );\n}\n\n\n/**\n * Setup clipboard operation menuitems.\n */\nExplorerPopupBinding.prototype._setupClipboardItems = function () {\n\n}\n\n/**\n * @implements {IActionListener}\n * @overloads {PopupBinding#handleAction}\n * @param {Action} action\n */\nExplorerPopupBinding.prototype.handleAction = function ( action ) {\n\n\tswitch ( action.type ) {\n\n\t\tcase MenuItemBinding.ACTION_COMMAND :\n\n\t\t\tvar self = this;\n\t\t\tStageBinding.select(this._pespectiveKey)\n\t\t\t\t.then(\n\t\t\t\tfunction () {\n\t\t\t\t\tExplorerPopupBinding.superclass.handleAction.call(self, action);\n\t\t\t\t}\n\t\t\t)\n\t\t\tbreak;\n\t}\n}\n\n/**\n * @overwrites {PopupBinding#snapToMouse}\n * @param {MouseEvent} e\n */\nExplorerPopupBinding.prototype.snapToMouse = function ( e ) {\n\n\tvar node = e.target ? e.target : e.srcElement;\n\tvar name = DOMUtil.getLocalName ( node );\n\tvar binding = null;\n\n\tif ( name != \"tree\" ) {\n\t\tswitch ( name ) {\n\t\t\tdefault :\n\n\t\t\t\tvar target = DOMUtil.getAncestorByLocalName(\"explorertoolbarbutton\", node);\n\t\t\t\t\n\t\t\t\tif (target != null) {\n\t\t\t\t\tbinding = UserInterface.getBinding(target);\n\t\t\t\t\tif (binding.isDisabled) { // no contextmenu for disabled treenodes\n\t\t\t\t\t\tbinding = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\tif ( binding != null && binding.node != null && binding.node.getActionProfile () != null ) {\n\n\t\t\tthis._node = binding.node;\n\t\t\tthis._actionProfile = this.getCompiledActionProfile(binding.node);\n\t\t\tthis._pespectiveKey = binding.handle;\n\n\t\t\tSystemTreePopupBinding.superclass.snapToMouse.call(this, e);\n\t\t}\n\t}\n}\n\n\n/**\n * @return {Map<string><List<SystemAction>>}\n */\nExplorerPopupBinding.prototype.getCompiledActionProfile = function (node) {\n\tvar result = new Map();\n\n\tvar actionProfile = node.getActionProfile();\n\n\tif (actionProfile != null) {\n\t\tvar self = this;\n\t\tactionProfile.each(\n\t\t\tfunction (groupid, list) {\n\t\t\t\tvar newList = new List();\n\t\t\t\tlist.each(function (systemAction) {\n\t\t\t\t\tif (systemAction.getActivePositions() & 1) {\n\t\t\t\t\t\tnewList.add(systemAction);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif (newList.hasEntries()) {\n\t\t\t\t\tresult.set(groupid, newList);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\tresult.Node = node;\n\n\treturn result;\n}\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/explorer/ExplorerToolBarBinding.js",
    "content": "ExplorerToolBarBinding.prototype = new ToolBarBinding;\r\nExplorerToolBarBinding.prototype.constructor = ExplorerToolBarBinding;\r\nExplorerToolBarBinding.superclass = ToolBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ExplorerToolBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ExplorerToolBarBinding\" );\r\n\t\r\n\t/**\r\n\t * No default content. Toolbar should be completely collapsible.\r\n\t * @overwrites {ToolBarBinding#_hasDefaultContent}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasDefaultContent = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nExplorerToolBarBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ExplorerToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * Show large icons.\r\n */\r\nExplorerToolBarBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tExplorerToolBarBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.setImageSize(ToolBarBinding.ICONSIZE_22);\r\n\t\r\n}\r\n\r\n/**\r\n * ExplorerToolBarBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ExplorerToolBarBinding}\r\n */\r\nExplorerToolBarBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:explorertoolbar\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, ExplorerToolBarBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/explorer/ExplorerToolBarButtonBinding.js",
    "content": "﻿ExplorerToolBarButtonBinding.prototype = new ToolBarButtonBinding;\r\nExplorerToolBarButtonBinding.prototype.constructor = ExplorerToolBarButtonBinding;\r\nExplorerToolBarButtonBinding.superclass = ToolBarButtonBinding.prototype;\r\nExplorerToolBarButtonBinding.TYPE_NORMAL = \"normal\";\r\nExplorerToolBarButtonBinding.TYPE_LARGE = \"large\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ExplorerToolBarButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ExplorerToolBarButtonBinding\" );\r\n\t\r\n\t/** \r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRadioButton = true;\r\n\t\r\n\t/** \r\n\t * @type {string}\r\n\t */\r\n\tthis.explorerToolBarButtonType = null;\r\n\t\r\n\t/**\r\n\t * This property is set by the {@link ExplorerMenuBinding}\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.node = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nExplorerToolBarButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ExplorerToolBarButtonBinding]\";\r\n}\r\n\r\n/**\r\n * Compute button image.\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nExplorerToolBarButtonBinding.prototype.onBindingAttach = function () {\r\n\r\n\tthis.addEventListener(DOMEvents.MOUSEUP); \r\n\tvar isLargeButton = this.explorerToolBarButtonType == ExplorerToolBarButtonBinding.TYPE_LARGE;\r\n\tvar imageSizeParameter = isLargeButton ? ToolBarBinding.IMAGESIZE_LARGE : ToolBarBinding.IMAGESIZE_NORMAL;\r\n\tthis.imageProfile = this.node.getImageProfile(imageSizeParameter);\r\n\r\n\tExplorerToolBarButtonBinding.superclass.onBindingAttach.call ( this );\r\n}\r\n\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nExplorerToolBarButtonBinding.prototype.handleEvent = function (e) {\r\n\r\n\tExplorerToolBarButtonBinding.superclass.handleEvent.call(this, e);\r\n\r\n\tif (!this.isDisabled && !BindingDragger.isDragging) {\r\n\r\n\t\tswitch (e.type) {\r\n\t\t\tcase DOMEvents.MOUSEUP:\r\n\t\t\t\tif (e.button != ButtonStateManager.RIGHT_BUTTON) {\r\n\t\t\t\t\tif (this.isChecked) {\r\n\t\t\t\t\t\tStageBinding.bindingInstance.selectBrowserTab();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * ExplorerToolBarButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @param {string} explorerToolBarButtonType\r\n * @return {ExplorerToolBarButtonBinding}\r\n */\r\nExplorerToolBarButtonBinding.newInstance = function ( ownerDocument, explorerToolBarButtonType ) {\r\n\r\n\tvar nodename = \"ui:explorertoolbarbutton\";\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, nodename, ownerDocument );\r\n\tvar binding = UserInterface.registerBinding ( element, ExplorerToolBarButtonBinding );\r\n\tbinding.explorerToolBarButtonType = explorerToolBarButtonType;\r\n\treturn binding;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/fields/FieldBinding.js",
    "content": "FieldBinding.prototype = new Binding;\r\nFieldBinding.prototype.constructor = FieldBinding;\r\nFieldBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FieldBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FieldBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.bindingRelation = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFieldBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FieldBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nFieldBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tFieldBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.attachClassName ( Binding.CLASSNAME_CLEARFLOAT );\r\n\t\r\n\tvar relation = this.getProperty ( \"relation\" );\r\n\tif ( relation != null ) {\r\n\t\tthis.bindingRelation = relation;\r\n\t\tthis.subscribe ( BroadcastMessages.BINDING_RELATE );\r\n\t\tthis.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nFieldBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tFieldBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.BINDING_RELATE :\r\n\t\t\tif ( arg.relate == this.bindingRelation && arg.origin == this.bindingDocument ) {\r\n\t\t\t\tif ( arg.result == true ) {\r\n\t\t\t\t\tif ( !this.isVisible ) {\r\n\t\t\t\t\t\tthis.show ();\r\n\t\t\t\t\t\tthis.dispatchAction ( Binding.ACTION_UPDATED );\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif ( this.isVisible ) {\r\n\t\t\t\t\t\tthis.hide ();\r\n\t\t\t\t\t\tthis.dispatchAction ( Binding.ACTION_UPDATED );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * FieldBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {FieldBinding}\r\n */\r\nFieldBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:field\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, FieldBinding );\r\n}                                                          "
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/fields/FieldDataBinding.js",
    "content": "FieldDataBinding.prototype = new Binding;\r\nFieldDataBinding.prototype.constructor = FieldDataBinding;\r\nFieldDataBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * This doesn't really do anything. But it's nice to have...\r\n */\r\nfunction FieldDataBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FieldDataBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFieldDataBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FieldDataBinding]\";\r\n}\r\n\r\n/**\r\n * FieldDataBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {FieldDataBinding}\r\n */\r\nFieldDataBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:fielddata\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, FieldDataBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/fields/FieldDescBinding.js",
    "content": "FieldDescBinding.prototype = new Binding;\r\nFieldDescBinding.prototype.constructor = FieldDescBinding;\r\nFieldDescBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * The fielddescbinding constructs a {@link LabelBinding}  \r\n * in order to support alphatransparent PNG images.\r\n * @class\r\n */\r\nfunction FieldDescBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FieldDescBinding\" );\r\n\t\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFieldDescBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FieldDescBinding]\";\r\n}\r\n\r\n/** \r\n * @overloads {Bindong#onBindingAttach}\r\n */\r\nFieldDescBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\t// FieldDescBinding.superclass.onBindingAttach.call ( this );\r\n\tBinding.prototype.onBindingAttach.call ( this );\r\n\t\r\n\tthis.buildDOMContent (); \r\n\tthis.attachDOMEvents ();\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nFieldDescBinding.prototype.buildDOMContent = function () {\r\n\r\n\t// image\r\n\tvar image = this.getProperty ( \"image\" );\r\n\tif ( image ) {\r\n\t\tthis.setImage ( image );\r\n\t}\r\n\t\r\n\t// tooltip\r\n\tvar tooltip\t= this.getProperty ( \"tooltip\" );\r\n\tif ( tooltip ) {\r\n\t\tthis.setToolTip ( tooltip );\r\n\t}\r\n\t\r\n\t// label\r\n\tvar label = this.getProperty ( \"label\" );\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n}\r\n\r\n/**\r\n * Attach DOM events.\r\n * Attach listeners to focus DataBinding when label is clicked.\r\n */\r\nFieldDescBinding.prototype.attachDOMEvents = function () {\r\n\r\n\t/*\r\n\t * Don't use mousedown since this will simultaneously blur HTML input fields.\r\n\t */\r\n\tthis.addEventListener ( DOMEvents.CLICK );\r\n}\r\n\r\n/**\r\n * Focus related DataBinding when label is clicked.\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nFieldDescBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tFieldDescBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tswitch ( e.type ) { \r\n\t\tcase DOMEvents.CLICK :\r\n\t\t\tvar field = this.getAncestorBindingByLocalName ( \"field\" );\r\n\t\t\tif ( field ) {\r\n\t\t\t\tvar isContinue = true;\r\n\t\t\t\tfield.getDescendantBindingsByLocalName ( \"*\" ).each (\r\n\t\t\t\t\tfunction ( binding ) {\r\n\t\t\t\t\t\tif ( Interfaces.isImplemented ( IData, binding )) {\r\n\t\t\t\t\t\t\tbinding.focus ();\r\n\t\t\t\t\t\t\tisContinue = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn isContinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\t\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nFieldDescBinding.prototype.setLabel = function ( label ) {\r\n\t\r\n\tthis.setProperty ( \"label\", label );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.bindingElement.innerHTML = Resolver.resolve ( label );\r\n\t}\r\n}\r\n\r\n/**\r\n * Get label. First check label property; then analyze text content.\r\n * @return {string}\r\n */\r\nFieldDescBinding.prototype.getLabel = function () {\r\n\t\r\n\tvar label = this.getProperty ( \"label\" );\r\n\tif ( !label ) {\r\n\t\tvar node = this.bindingElement.firstChild;\r\n\t\tif ( node && node.nodeType == Node.TEXT_NODE ) {\r\n\t\t\tlabel = node.data;\r\n\t\t}\r\n\t}\r\n\treturn label;\r\n}\r\n\r\n/**\r\n * Set image.\r\n * TODO: getter?\r\n * @param {string} image\r\n */\r\nFieldDescBinding.prototype.setImage = function ( image ) {\r\n\t\r\n\tthis.setProperty ( \"image\", image );\r\n\tif ( this.isAttached ) {\r\n\t\tthrow \"FieldDescBinding: Images not suppoerted!\";\r\n\t}\r\n}\r\n\r\n/** \r\n * Set tooltip.\r\n * TODO: getter?\r\n * @param {string} tooltip\r\n */\r\nFieldDescBinding.prototype.setToolTip = function ( tooltip ) {\r\n\t\r\n\tthis.setProperty ( \"tooltip\", tooltip );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.bindingElement.title = tooltip;\r\n\t}\r\n}\r\n\r\n/**\r\n * FieldDescBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {FieldDescBinding}\r\n */\r\nFieldDescBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:fielddesc\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, FieldDescBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/fields/FieldGroupBinding.js",
    "content": "FieldGroupBinding.prototype = new Binding;\r\nFieldGroupBinding.prototype.constructor = FieldGroupBinding;\r\nFieldGroupBinding.superclass = Binding.prototype;\r\n\r\nFieldGroupBinding.ACTION_HIDE = \"fieldgrouphide\";\r\nFieldGroupBinding.CLASSNAME_NOLABEL = \"nolabel\";\r\nFieldGroupBinding.CLASSNAME_FIRST = \"first\"; // attached by FieldsBinding!\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FieldGroupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FieldGroupBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFieldGroupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FieldGroupBinding]\";\r\n}\r\n\r\n/**\r\n * Notice that we need to do this on register already!\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nFieldGroupBinding.prototype.onBindingRegister = function () {\r\n\r\n\tFieldGroupBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"label\" ] = this.setLabel;\r\n\tthis._buildDOMContent ();\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nFieldGroupBinding.prototype._buildDOMContent = function () {\r\n\r\n\tvar label = this.getProperty ( \"label\" );\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t} else {\r\n\t\tthis.attachClassName ( FieldGroupBinding.CLASSNAME_NOLABEL );\r\n\t}\r\n\tvar fields = this.bindingElement.getElementsByTagName('field');\r\n    if (!fields.length) {\r\n        fields = this.bindingElement.getElementsByTagName('ui:field'); // taht works for IE\r\n    }\r\n    var firstField = fields[0];\r\n    if (firstField) {\r\n        firstField.className += \" \" + \"first\";\r\n    }\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @parm {string} label\r\n */\r\nFieldGroupBinding.prototype.setLabel = function ( label ) {\r\n\t\r\n\tthis.setProperty ( \"label\", label );\r\n\t\r\n\tif ( this.shadowTree.labelBinding == null ) {\r\n\t\r\n\t\tvar labelBinding = LabelBinding.newInstance ( this.bindingDocument );\r\n\t\tvar cell = this.shadowTree [ FieldGroupBinding.NORTH ];\r\n\t\tlabelBinding.attachClassName ( \"fieldgrouplabel\" );\r\n\t\tthis.bindingElement.insertBefore(labelBinding.bindingElement, this.bindingElement.firstChild);\r\n\t\tlabelBinding.attach ();\r\n\t\tthis.shadowTree.labelBinding = labelBinding;\r\n\r\n\t\tthis.shadowTree.labelBinding.bindingElement.appendChild(DOMUtil.createElementNS(Constants.NS_XHTML, \"div\", this.bindingDocument));\r\n\t}\r\n\t\r\n\tthis.shadowTree.labelBinding.setLabel ( \r\n\t\tResolver.resolve ( label )\r\n\t);\r\n}\r\n\r\n/** \r\n * Get label.\r\n * @return {string}\r\n */\r\nFieldGroupBinding.prototype.getLabel = function () {\r\n\t\r\n\treturn this.getProperty ( \"label\" );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/fields/FieldHelpBinding.js",
    "content": "FieldHelpBinding.prototype = new Binding;\r\nFieldHelpBinding.prototype.constructor = FieldHelpBinding;\r\nFieldHelpBinding.superclass = Binding.prototype;\r\n\r\nFieldHelpBinding.INDICATOR_IMAGE = null;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FieldHelpBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FieldHelpBinding\" );\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFieldHelpBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FieldHelpBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nFieldHelpBinding.prototype.onBindingAttach = function () {\r\n\r\n\tFieldHelpBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tthis.buildPopupBinding ();\r\n\tthis.buildPopupButton ();\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nFieldHelpBinding.prototype.onBindingDispose = function () {\r\n\r\n\tFieldHelpBinding.superclass.onBindingDispose.call ( this );\r\n\r\n\tvar popup = this._fieldHelpPopupBinding;\r\n\tif ( popup ) {\r\n\t\tpopup.dispose ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Build popup.\r\n */\r\nFieldHelpBinding.prototype.buildPopupBinding = function () {\r\n\r\n\tvar popupSetBinding = app.bindingMap.fieldhelpopupset;\r\n\tvar doc = popupSetBinding.bindingDocument;\r\n\tvar popupBinding = popupSetBinding.add (\r\n\t\tPopupBinding.newInstance ( doc )\r\n\t);\r\n\tvar bodyBinding = popupBinding.add (\r\n\t\tPopupBodyBinding.newInstance ( doc )\r\n\t);\r\n\tpopupBinding.position = PopupBinding.POSITION_RIGHT;\r\n\tpopupBinding.attachClassName ( \"fieldhelppopup\" );\r\n\r\n\t/*\r\n\t * Help can be written inside the tag or supplied in the label attribute.\r\n\t */\r\n\tif ( this.bindingElement.hasChildNodes ()) {\r\n\t\tbodyBinding.bindingElement.innerHTML = this.bindingElement.innerHTML;\r\n\t} else {\r\n\t\tvar label = this.getProperty ( \"label\" );\r\n\t\tif ( label ) {\r\n\t\t\tbodyBinding.bindingElement.innerHTML = Resolver.resolve ( label );\r\n\t\t}\r\n\t}\r\n\r\n\tthis.bindingElement.innerHTML = \"\";\r\n\tthis._fieldHelpPopupBinding = popupBinding;\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nFieldHelpBinding.prototype.buildPopupButton = function () {\r\n\r\n\tvar field = this.getAncestorBindingByLocalName ( \"field\" );\r\n\tif (field) {\r\n\t\tfield.attachClassName(\"fieldhelp\");\r\n\t}\r\n\r\n\tvar button = ClickButtonBinding.newInstance ( this.bindingDocument );\r\n\tbutton.attachClassName ( \"fieldhelp\" );\r\n\tbutton.setImage ( FieldHelpBinding.INDICATOR_IMAGE );\r\n\tthis.add ( button );\r\n\tbutton.attach ();\r\n\r\n\tvar self = this;\r\n\tbutton.oncommand = function () {\r\n\t\tself.attachPopupBinding ();\r\n\t}\r\n\r\n\tbutton.setPopup ( this._fieldHelpPopupBinding );\r\n\tthis._fieldHelpButton = button;\r\n\r\n}\r\n\r\n/**\r\n * Attach popup. For faster page load time, the popup bindings\r\n * get attached only when user handles the button.\r\n */\r\nFieldHelpBinding.prototype.attachPopupBinding = function () {\r\n\r\n\tvar popup = this._fieldHelpPopupBinding;\r\n\tif ( popup && !popup.isAttached ) {\r\n\t\tpopup.attachRecursive ();\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/fields/FieldsBinding.js",
    "content": "FieldsBinding.prototype = new Binding;\r\nFieldsBinding.prototype.constructor = FieldsBinding;\r\nFieldsBinding.superclass = Binding.prototype;\r\n\r\nFieldsBinding.ACTION_LAYOUT_UPDATED = \"fieldslayoutupdated\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FieldsBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FieldsBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._invalidCount = 0;\r\n\t\r\n\t/**\r\n\t * Tracking invalid fields for user message.\r\n\t * @type {Map<string><string>}\r\n\t */\r\n\tthis._invalidFieldLabels = null;\r\n\t\r\n\t/**\r\n\t * Block flex crawler.\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID, FitnessCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFieldsBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FieldsBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}.\r\n */\r\nFieldsBinding.prototype.onBindingRegister = function () {\r\n\r\n\tFieldsBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( Binding.ACTION_INVALID );\r\n\tthis.addActionListener ( Binding.ACTION_VALID );\r\n\tthis.addActionListener ( FieldGroupBinding.ACTION_HIDE );\r\n\t\r\n\tthis._invalidFieldLabels = new Map ();\r\n}\r\n\r\n/**\r\n * Display block when initialized (display none in stylesheet).\r\n * @overloads {Binding#onBindingInitialize}.\r\n */\r\nFieldsBinding.prototype.onBindingInitialize = function () {\r\n\r\n\tFieldsBinding.superclass.onBindingInitialize.call ( this );\r\n\tthis.bindingElement.style.display = \"block\";\r\n\t\r\n\t/**\r\n\t * Emulate CSS first-child pseudoselector for IE... \r\n\t */\r\n\tvar firstgroup = this.getDescendantBindingByLocalName ( \"fieldgroup\" );\r\n\tif ( firstgroup != null ) {\r\n\t\tfirstgroup.attachClassName ( FieldGroupBinding.CLASSNAME_FIRST );\r\n\t}\r\n\r\n\t/**\r\n\t *  Limit width becouse Edge smooth non-breakable items in columns #620\r\n\t */\r\n\tif (Client.isEdge) {\r\n\t\tvar editopPage = this.getAncestorBindingByType(EditorPageBinding);\r\n\t\tif (editopPage && this.bindingElement.childElementCount > 0) {\r\n\t\t\tvar columnWidth = 430;\r\n\t\t\tthis.bindingElement.style.maxWidth = (this.bindingElement.childElementCount + 1) * columnWidth - 1 + 'px';\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Disposing an invalid FieldsBinding will automatically \r\n * make it valid in the greater scheme of things.\r\n * @overloads {Binding#onBindingDispose}.\r\n */\r\nFieldsBinding.prototype.onBindingDispose = function () {\r\n\r\n\tFieldsBinding.superclass.onBindingDispose.call ( this );\r\n\t\r\n\tif ( this._invalidCount > 0 ) {\r\n\t\tthis.dispatchAction ( Binding.ACTION_VALID );\r\n\t}\r\n}\r\n\r\n/**\r\n * Validate all contained bindings and return true only if everything validates.\r\n * @return {boolean}\r\n */\r\nFieldsBinding.prototype.validate = function () {\r\n\t\r\n\tvar isValid = true;\r\n\t\r\n\tvar bindings = this.getDescendantBindingsByLocalName ( \"*\" );\r\n\twhile ( bindings.hasNext ()) {\r\n\t\tvar binding = bindings.getNext ();\r\n\t\tif ( Interfaces.isImplemented ( IData, binding )) {\r\n\t\t\tvar isBindingValid = binding.validate ();\r\n\t\t\tif ( isValid && !isBindingValid ) {\r\n\t\t\t\tisValid = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn isValid;\r\n}\r\n\r\n/**\r\n * Get result. This returns a name-value hashmap for all contained DataBindings. \r\n * Notice that the {@link DocumentManager} has a equivalent method extract information \r\n * from *all* databindings within the local scope. Also notice that we call the getResult \r\n * method instead of getValue. The value is for the serverside while the \"result\" is \r\n * automatically typecasted for clientside handling.\r\n * @return {HashMap<string><object>}\r\n *\r\nFieldsBinding.prototype.getDataBindingResultMap = function () {\r\n\t\r\n\tthrow \"Method needs updating\";\r\n\t\r\n\tvar result = {};\r\n\t \r\n\tvar bindings = this.getDescendantBindingsByLocalName ( \"*\" );\r\n\twhile ( bindings.hasNext ()) {\r\n\t\tvar binding = bindings.getNext ();\r\n\t\tif ( Interfaces.isImplemented ( IData, binding )) {\r\n\t\t\tresult [ binding.getName ()] = binding.getResult ();\t\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n*/\r\n\r\n/**\r\n * Around here we simply collect and count valid/invalid actions in order \r\n * to dispatch a unified valid/invalid action for this entire binding.\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nFieldsBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tFieldsBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tif ( binding != this ) {\r\n\t\tswitch ( action.type ) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Tracking invalid DataBindings. Error display handled.\r\n\t\t\t */\r\n\t\t\tcase Binding.ACTION_INVALID :\r\n\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Tracking statusbar errors (displayed by EditorPageBinding).\r\n\t\t\t\t */\r\n\t\t\t\tvar label = DataBinding.getAssociatedLabel ( binding );\r\n\t\t\t\tif ( label ) {\r\n\t\t\t\t\tthis._invalidFieldLabels.set ( binding.key, label );\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Show balloon error? Note that balloons are supressed for \"required\" errors.\r\n\t\t\t\t */\r\n\t\t\t\tif ( binding.error ) {\r\n\t\t\t\t\tif ( !binding.isInvalidBecauseRequired ) {\r\n\t\t\t\t\t\tErrorBinding.presentError ({\r\n\t\t\t\t\t\t\ttext: binding.error\r\n\t\t\t\t\t\t}, binding );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Count invalid bindings.\r\n\t\t\t\t */\r\n\t\t\t\tif ( this._invalidCount == 0 ) {\r\n\t\t\t\t\tthis.dispatchAction ( Binding.ACTION_INVALID );\t\r\n\t\t\t\t}\r\n\t\t\t\tthis._invalidCount ++;\t\r\n\t\t\t\taction.consume ();\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase Binding.ACTION_VALID :\r\n\t\t\t\tif ( this._invalidFieldLabels.has ( binding.key )) {\r\n\t\t\t\t\tthis._invalidFieldLabels.del ( binding.key );\r\n\t\t\t\t}\r\n\t\t\t\tthis._invalidCount --;\r\n\t\t\t\tif ( this._invalidCount == 0 ) {\r\n\t\t\t\t\tthis.dispatchAction ( Binding.ACTION_VALID );\t\r\n\t\t\t\t}\r\n\t\t\t\taction.consume ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get labels of invalid bindings.\r\n * @return {List<string>}\r\n */\r\nFieldsBinding.prototype.getInvalidLabels =  function () {\r\n\t\r\n\tvar result = null;\r\n\tif ( this._invalidFieldLabels.hasEntries ()) {\r\n\t\tresult = this._invalidFieldLabels.toList ();\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * FieldsBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {FieldsBinding}\r\n */\r\nFieldsBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:fields\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, FieldsBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/fields/ResolverContainerBinding.js",
    "content": "﻿ResolverContainerBinding.prototype = new Binding;\nResolverContainerBinding.prototype.constructor = ResolverContainerBinding;\nResolverContainerBinding.superclass = Binding.prototype;\n\n/**\n * QA Staff\n * @class\n */\nfunction ResolverContainerBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"ResolverContainerBinding\");\n\n\treturn this;\n}\n\n/**\n * Identifies binding.\n */\nResolverContainerBinding.prototype.toString = function () {\n\n\treturn \"[ResolverContainerBinding]\";\n}\n\n/** \n * @overloads {Bindong#onBindingAttach}\n */\nResolverContainerBinding.prototype.onBindingAttach = function () {\n\n\tResolverContainerBinding.superclass.onBindingAttach.call(this);\n\n\tnew List(this.bindingElement.attributes).each(function (attribute) {\n\t\tif (attribute.name.startsWith(\"data-\")) {\n\t\t\tvar elements = this.bindingDocument.getElementsByName(attribute.value);\n\t\t\tnew List(elements).each(function (element) {\n\t\t\t\telement.setAttribute(\"data-qa\", attribute.name.substring(\"data-\".length));\n\t\t\t})\n\t\t}\n\t}, this);\n\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/flexboxes/FlexBoxBinding.js",
    "content": "FlexBoxBinding.prototype= new Binding;\r\nFlexBoxBinding.prototype.constructor = FlexBoxBinding;\r\nFlexBoxBinding.superclass = Binding.prototype;\r\n\r\nFlexBoxBinding.CLASSNAME = \"flexboxelement\";\r\n\r\nFlexBoxBinding.TIMEOUT = 250;\r\n\r\n/**\r\n * In case the reflex chain should invoke a new call to reflex, a clever timeout \r\n * system has been established to prevent multiple simultaneous flex iterators. \r\n * It works by switching the isFlexSuspended property on bindings. The timeout can \r\n * be supressed by passing a boolean value of true to the method. This can be desired, \r\n * but should be avoided since it adds a computational overhead that threatens Explorer. \r\n * Notice that reflex invokation is disabled during startup since the stage is hidden anyway.\r\n * @param {Binding} startBinding\r\n * @param @optional {boolean} isForce\r\n */\r\nFlexBoxBinding.reflex = function ( startBinding, isForce ) {\r\n\t\r\n\t/*\r\n\t * Collect flexible bindings in a list.  \r\n\t * Skip bindings with suspended flex.\r\n\t */\r\n\tvar list = new List ();\r\n\tvar crawler = new FlexBoxCrawler ();\r\n\tcrawler.mode = isForce ? FlexBoxCrawler.MODE_FORCE : FlexBoxCrawler.MODE_NORMAL;\r\n\tcrawler.startBinding = startBinding;\r\n\tcrawler.crawl ( startBinding.bindingElement, list );\r\n\t\r\n\t/*\r\n\t * Flex each binding in list, briefly suspending flexibility \r\n\t * (the binding may still flex in case the isForce param is true). \r\n\t * Note that the crawler SKIPS bindings with suspended flex.\r\n\t */\r\n\tlist.each ( function ( binding ) {\r\n\t\tbinding.flex ();\r\n\t});\r\n\t\r\n\t/*\r\n\t * This is ultra lame. But so is Internet Explorer. Note that \r\n\t * we don't respect the significance of suspended flex here,  \r\n\t * We simply flex again. The longer the timeout, the better  \r\n\t * the odds of IE computing an exact layout calculation...\r\n\t */\r\n\tif ( Client.isExplorer ) {\r\n\t\tsetTimeout ( function () {\r\n\t\t\tlist.each ( function ( binding ) {\r\n\t\t\t\tif ( Binding.exists ( binding )) {\r\n\t\t\t\t\tbinding.flex ();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}, 0.5 * FlexBoxBinding.TIMEOUT );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Reset binding flexibility after a short timeout.\r\n\t */\r\n\tsetTimeout ( function () {\r\n\t\tlist.each ( function ( binding ) {\r\n\t\t\tif ( Binding.exists ( binding )) {\r\n\t\t\t\tbinding.isFlexSuspended = false;\r\n\t\t\t}\r\n\t\t});\r\n\t\tlist.dispose ();\r\n\t}, FlexBoxBinding.TIMEOUT );\r\n\t\t\r\n\t/*\r\n\t * Creepy crawlers.\r\n\t */\r\n\tcrawler.dispose ();\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FlexBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FlexBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * This flag is switched off and and later switched back on by the binding \r\n\t * that started the iteration. This will prevent multiple flex invokations \r\n\t * with much computational stress but no visible effect.\r\n\t * @see {Binding#reflex}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFlexSuspended = false;\r\n\t\r\n\t/**\r\n\t * Enable flexbox behavior.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFlexible = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFit = true; \r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFlexBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[FlexBoxBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nFlexBoxBinding.prototype.onBindingRegister = function () {\r\n\r\n\tFlexBoxBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\t/*\r\n\t * Note that you can disable flex  \r\n\t * by twisting this property.\r\n\t */\r\n\tif ( this.getProperty ( \"flex\" ) == false ) {\r\n\t\tthis.isFlexible = false;\r\n\t}\r\n\r\n\tif ( this.isFlexible ) {\r\n\t\tthis.attachClassName(FlexBoxBinding.CLASSNAME);\r\n\t\tif (Client.isPad)\r\n\t\t\tthis.bindingElement.style.overflow = \"auto\";\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nFlexBoxBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tFlexBoxBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\t/*\r\n\t * For use with the fitness program. This allows dialogs \r\n\t * to expand in order to show content without scrollbars.\r\n\t */\r\n\tthis.addActionListener ( Binding.ACTION_UPDATED );\r\n\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nFlexBoxBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tFlexBoxBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase Binding.ACTION_UPDATED :\r\n\t\t\tthis.isFit = false;\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Get combined span of sibling elements.\r\n * @param @optional {boolean} isHorizontal\r\n */\r\nFlexBoxBinding.prototype._getSiblingsSpan = function ( isHorizontal ) {\r\n\t\r\n\tvar result = 0;\r\n\tvar children = new List ( this.bindingElement.parentNode.childNodes );\r\n\t\r\n\twhile ( children.hasNext ()) {\r\n\t\tvar child = children.getNext ();\r\n\t\tif ( child.nodeType == Node.ELEMENT_NODE && child != this.bindingElement ) {\r\n\t\t\tif ( !this._isOutOfFlow ( child )) {\r\n\t\t\t\tvar rect = child.getBoundingClientRect ();\r\n\t\t\t\tif ( isHorizontal ) {\r\n\t\t\t\t\theight += ( rect.right - rect.left );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tresult += ( rect.bottom - rect.top );\r\n\t\t\t\t}\r\n\t\t\t}\t\t\t\r\n\t\t}\r\n\t};\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Not counting absolutely positioned or floated elements.\r\n * @param {DOMElement} element\r\n * @return {boolean}\r\n * @private\r\n */\r\nFlexBoxBinding.prototype._isOutOfFlow = function ( element ) {\r\n\r\n\tvar position = CSSComputer.getPosition ( element );\r\n\tvar cssfloat = CSSComputer.getFloat ( element );\r\n\treturn ( position == \"absolute\" || cssfloat != \"none\" ? true : false );\r\n}\r\n\r\n/**\r\n * Compute height.\r\n */\r\nFlexBoxBinding.prototype._getCalculatedHeight = function () {\r\n\r\n\tvar parent\t= this.bindingElement.parentNode;\r\n\tvar rect = parent.getBoundingClientRect ();\r\n\tvar result = rect.bottom - rect.top;\r\n\r\n\tvar padding\t= CSSComputer.getPadding ( parent );\r\n\tvar border\t= CSSComputer.getBorder ( parent );\r\n\t\r\n\tresult -= ( padding.top + padding.bottom );\r\n\tresult -= ( border.top + border.bottom );\r\n\r\n\tvar margin = CSSComputer.getMargin(this.bindingElement);\r\n\r\n\tresult -= (margin.top + margin.bottom);\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Compute width. This is not currently in use.\r\n */\r\nFlexBoxBinding.prototype._getCalculatedWidth = function () {\r\n\r\n\tvar parent\t= this.bindingElement.parentNode;\r\n\tvar rect = parent.getBoundingClientRect ();\r\n\tvar result = rect.right - rect.left;\r\n\tvar padding\t= CSSComputer.getPadding ( parent );\r\n\tvar border\t= CSSComputer.getBorder ( parent );\r\n\t\r\n\tresult -= ( padding.left + padding.right );\r\n\tresult -= ( border.left + border.right );\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set flex behavior.\r\n */\r\nFlexBoxBinding.prototype.setFlexibility = function ( isFlexible ) {\r\n\t\r\n\tif ( isFlexible != this.isFlexible ) {\r\n\t\tif ( isFlexible ) {\r\n\t\t\tthis.attachClassName ( FlexBoxBinding.CLASSNAME );\r\n\t\t\tif (Client.isPad)\r\n\t\t\t\tthis.bindingElement.style.overflow = \"auto\";\r\n\t\t\tthis.deleteProperty ( \"flex\" );\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( FlexBoxBinding.CLASSNAME );\r\n\t\t\tif (Client.isPad)\r\n\t\t\t\tthis.bindingElement.style.removeProperty(\"overflow\");\r\n\t\t\tthis.setProperty ( \"flex\", false );\r\n\t\t}\r\n\t\tthis.isFlexible = isFlexible;\r\n\t}\r\n}\r\n\r\n/**\r\n * Performs the actual flexing. Note that  \r\n * isFlexSuspended is not accounted for here.\r\n * @implements {IFlexible}\r\n */\r\nFlexBoxBinding.prototype.flex = function ( ) {\r\n\t\r\n\tif ( Binding.exists ( this )) {\r\n\t\tif ( this.isFlexible == true ) {\r\n\t\t\tvar height = this._getSiblingsSpan ();\r\n\t\t\theight = this._getCalculatedHeight () - height;\r\n\t\t\tif ( !isNaN ( height ) && height >= 0 ) {\r\n\t\t\t\tthis.bindingElement.style.height = String ( height ) + \"px\";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\t\r\n/**\r\n * Expand flexbox vertically to eclose it's content. \r\n * Should only be invoked by the {@link StageDialogBinding}\r\n * @param {boolean} isForce\r\n * @implements {IFit}\r\n */\r\nFlexBoxBinding.prototype.fit = function ( isForce ) {\r\n\r\n\tif ( !this.isFit || isForce ) {\r\n\t\t\r\n\t\tvar height = 0;\r\n\t\t\r\n\t\tnew List ( this.bindingElement.childNodes ).each ( \r\n\t\t\tfunction ( child ) {\r\n\t\t\t\tif ( child.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\t\t\tif ( !this._isOutOfFlow ( child )) {\r\n\t\t\t\t\t\tvar rect = child.getBoundingClientRect ();\r\n\t\t\t\t\t\theight += ( rect.bottom - rect.top );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t, this );\r\n\t\t// if ( height > this._getFitnessHeight ()) { // check disabled!\r\n\t\t\tthis._setFitnessHeight ( height );\r\n\t\t// }\r\n\t\tthis.isFit = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Hardwired for method fit. \r\n * Note the {@link DialogPageBodyBinding} overwrites this!\r\n * @param {int} height\r\n */\r\nFlexBoxBinding.prototype._setFitnessHeight = function ( height ) {\r\n\r\n\tvar padding\t= CSSComputer.getPadding ( this.bindingElement );\r\n\tvar border\t= CSSComputer.getBorder ( this.bindingElement );\r\n\t\r\n\theight += padding.top + padding.bottom;\r\n\theight += border.top + border.bottom;\r\n\t\r\n\tthis.bindingElement.style.height = height + \"px\";\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/flexboxes/FlexBoxCrawler.js",
    "content": "FlexBoxCrawler.prototype = new Crawler;\r\nFlexBoxCrawler.prototype.constructor = FlexBoxCrawler;\r\nFlexBoxCrawler.superclass = Crawler.prototype;\r\n\r\nFlexBoxCrawler.ID = \"flexboxcrawler\";\r\nFlexBoxCrawler.MODE_FORCE = \"force\";\r\nFlexBoxCrawler.MODE_NORMAL = \"normal\";\r\n\r\n/**\r\n * @class\r\n * Crawler handles recursive flex.\r\n * @see {Binding#reflex}\r\n * @see {FlexBoxBinding.reflex}\r\n */\r\nfunction FlexBoxCrawler () {\r\n\t\r\n\t/**\r\n\t * Identifies the crawler.\r\n\t * @type {string}\r\n\t */\r\n\tthis.id = FlexBoxCrawler.ID;\r\n\t\r\n\t/**\r\n\t * Switching Crawler agressiveness.\r\n\t * @type {string}\r\n\t */\r\n\tthis.mode = FlexBoxCrawler.MODE_NORMAL;\r\n\t\r\n\t/**\r\n\t * This binding who instantiated the reflex action.\r\n\t * @type {Binding}\r\n\t */\r\n\tthis.startBinding = null;\r\n\t\r\n\t/*\r\n\t * Construction time again.\r\n\t */\r\n\tthis._construct ();\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * @overloads {Crawler#_construct} \r\n */\r\nFlexBoxCrawler.prototype._construct = function () {\r\n\t\r\n\tFlexBoxCrawler.superclass._construct.call ( this );\r\n\r\n\tvar self = this;\r\n\t\r\n\tthis.addFilter ( function ( element, list ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\r\n\t\tif ( Interfaces.isImplemented ( IFlexible, binding ) == true ) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Note that we don't check the value of property \r\n\t\t\t * isFlexible. That's because the flex method \r\n\t\t\t * may be used for other purposes than flexboxing.\r\n\t\t\t */\r\n\t\t\tswitch ( self.mode ) {\t\t\r\n\t\t\t\tcase FlexBoxCrawler.MODE_FORCE :\r\n\t\t\t\t\tlist.add ( binding );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase FlexBoxCrawler.MODE_NORMAL :\r\n\t\t\t\t\tif ( binding.isFlexSuspended == true ) {\r\n\t\t\t\t\t\tresult = NodeCrawler.SKIP_CHILDREN;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tlist.add ( binding );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn result;\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/flexboxes/ScrollBoxBinding.js",
    "content": "ScrollBoxBinding.prototype = new FlexBoxBinding;\r\nScrollBoxBinding.prototype.constructor = ScrollBoxBinding;\r\nScrollBoxBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nfunction ScrollBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ScrollBoxBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nScrollBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ScrollBoxBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindintRegister}\r\n */\r\nScrollBoxBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tScrollBoxBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.addActionListener ( BalloonBinding.ACTION_INITIALIZE );\r\n\t// this._isFit = this.getProperty ( \"fit\" ) == true;\r\n}\r\n\r\n/**\r\n * Register as environment for balloons.\r\n * @implements {IActionListener}\r\n * @overloads {FlexBoxBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nScrollBoxBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tScrollBoxBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\t/*\r\n\t * Balloon tricks a go go.\r\n\t */\r\n\tswitch ( action.type ) {\r\n\t\tcase BalloonBinding.ACTION_INITIALIZE :\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Pathces a glitch where scrollboxes would otherwise resort to visible scrollbars. \r\n * @param {int} height\r\n *\r\nScrollBoxBinding.prototype._setFitnessHeight = function ( height ) {\r\n\t\r\n\t/*\r\n\t * TODO: Figure out where these extra pixels are coming from!\r\n\t *\r\n\tScrollBoxBinding.superclass._setFitnessHeight.call ( this, height + 5 );\r\n}\r\n*/\r\n\r\n/**\r\n * Set scrollbox position.\r\n * @param {Point} point\r\n */\r\nScrollBoxBinding.prototype.setPosition = function ( point ) {\r\n\t\r\n\tthis.bindingElement.scrollLeft = point.x;\r\n\tthis.bindingElement.scrollTop = point.y;\r\n}\r\n\r\n/**\r\n * Get scrollbox position.\r\n * @return {Point}\r\n */\r\nScrollBoxBinding.prototype.getPosition = function () {\r\n\t\r\n\treturn new Point (\r\n\t\tthis.bindingElement.scrollLeft,\r\n\t\tthis.bindingElement.scrollTop\r\n\t);\t\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/focus/FocusBinding.js",
    "content": "FocusBinding.prototype = new FlexBoxBinding;\r\nFocusBinding.prototype.constructor = FocusBinding;\r\nFocusBinding.superclass = FlexBoxBinding.prototype;\r\n\r\n/**\r\n * This property is set to true on the currently focused binding. \r\n * TODO: Why was this exactly?\r\n * @type {string}\r\n */\r\nFocusBinding.MARKER = \"focusbindingcurrentfocus\";\r\n\r\n/**\r\n * @see {DockBinding}\r\n * @see {DialogBinding} TODO!\r\n */\r\nFocusBinding.ACTION_ACTIVATED = \"focusmanager activated\";\r\nFocusBinding.ACTION_ATTACHED = \"focusmanager attached\";\r\nFocusBinding.ACTION_UPDATE = \"focusmanager update required\";\r\nFocusBinding.ACTION_FOCUS = \"focusmanager focus\";\r\nFocusBinding.ACTION_BLUR = \"focusmanager blur\";\r\n\r\n/**\r\n * Since explorer doesn't react kindly to invisible or hidden \r\n * elements recieving the focus, better relay through here. \r\n * This will ensure some public damage control, but still \r\n * log an exception.\r\n * @param {DOMElement} element\r\n * @return {boolean} True on successful focus\r\n */\r\nFocusBinding.focusElement = function ( element ) {\r\n\t\r\n\tvar isSuccess = true;\r\n\t\r\n\ttry {\r\n\t\telement.focus ();\r\n\t\tApplication.focused ( true );\r\n\t} catch ( exception ) {\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\tvar logger = SystemLogger.getLogger ( \"FocusBinding.focusElement\" );\r\n\t\tlogger.warn ( \"Could not focus \" + ( binding ? binding.toString () : String ( element )));\r\n\t\tisSuccess = false;\r\n\t}\r\n\treturn isSuccess;\r\n}\r\n\r\n/**\r\n * @type {IFocus}\r\n */\r\nFocusBinding.focusedBinding = null;\r\n\r\n/**\r\n * @type {FocusBinding}\r\n */\r\nFocusBinding.activeInstance = null;\r\n\r\n/**\r\n * Because DOT NET will kill bindings spontaneously, we keep references\r\n * to focused bindings based on contextwindows and IDs. \r\n * @param {IFocusable} binding \r\n * @return {object} An object with a single method to extract the binding.\r\n */\r\nFocusBinding.getCachedFocus = function ( binding ) {\r\n\t\r\n\tvar win = binding.bindingWindow;\r\n\tvar id = binding.bindingElement.id;\r\n\t\r\n\treturn {\r\n\t\tgetBinding : function () {\r\n\t\t\tvar result = null;\r\n\t\t\ttry {\r\n\t\t\t\tif ( Binding.exists ( binding )) {\r\n\t\t\t\t\tresult = win.bindingMap [ id ]; // TODO: AVOID BINDINGMAP!\r\n\t\t\t\t}\r\n\t\t\t} catch ( exception ) {\r\n\t\t\t\t// explorer may still puke on this!\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Navigate next.\r\n * @param {boolean} isReverse\r\n */\r\nFocusBinding.navigateNext = function ( isReverse ) {\r\n\t\r\n\tif ( Binding.exists ( FocusBinding.activeInstance )) {\r\n\t\tFocusBinding.activeInstance.focusNext ( isReverse );\r\n\t}\r\n}\r\n\r\n/**\r\n * Navigate previous.\r\n */\r\nFocusBinding.navigatePrevious = function () {\r\n\t\r\n\tFocusBinding.navigateNext ( true );\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction FocusBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"FocusManangerBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {List<IFocusable>}\r\n\t */\r\n\tthis._focusableList = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isUpToDate = false;\r\n\t\r\n\t/**\r\n\t * If ancestor FocusBinding claims to be a (strong) focus manager, \r\n\t * this will be set to false. In that case, you may stop reading here, \r\n\t * none of the methods below will be invoked.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isFocusManager = true;\r\n\t\r\n\t/** \r\n\t * If set to false, descendant FocusBinding instances may construct \r\n\t * local focus zones. This is exactly the case for the top PageBinding \r\n\t * and the StageBinding. And that is probably how it should stay.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isStrongFocusManager = true;\r\n\t\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis._cachedFocus = null;\r\n\t \r\n\t/**\r\n\t * Note that flexibility is negated by default. Actually we only \r\n\t * need to subclass FlexBoxBinding around here because IE6 doesn't \r\n\t * support CSS min-height; this causes trouble inside dialogs.\r\n\t * @overwrites {FlexBoxBinding#isFlexible}\r\n\t */\r\n\tthis.isFlexible = false;\r\n\t\r\n\t/* \r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nFocusBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[FocusManangerBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nFocusBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tif ( this.getProperty ( \"focusmanager\" ) == false ) {\r\n\t\tthis._isFocusManager = false;\r\n\t} else {\r\n\t\tif ( this.getProperty ( \"strongfocusmanager\" ) == false ) {\r\n\t\t\tthis.isStrongFocusManager = false;\r\n\t\t}\r\n\t\tif ( this._isFocusManager ) {\r\n\t\t\tvar action = this.dispatchAction ( FocusBinding.ACTION_ATTACHED );\t\r\n\t\t\tif ( action && action.isConsumed ) {\r\n\t\t\t\tif ( action.listener.isStrongFocusManager ) {\r\n\t\t\t\t\tthis._isFocusManager = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( this._isFocusManager ) {\r\n\t\t\t\tthis.addActionListener ( Binding.ACTION_ACTIVATED );\r\n\t\t\t\tthis.addActionListener ( Binding.ACTION_FOCUSED );\r\n\t\t\t\tthis.addActionListener ( Binding.ACTION_BLURRED );\r\n\t\t\t\tthis.addActionListener ( FocusBinding.ACTION_UPDATE );\r\n\t\t\t\tthis.addActionListener ( FocusBinding.ACTION_FOCUS );\r\n\t\t\t\tthis.addActionListener ( FocusBinding.ACTION_BLUR );\r\n\t\t\t\t//this.addActionListener ( UpdatePanelBinding.ACTION_UPDATED );\r\n\t\t\t\tthis.addActionListener ( FocusBinding.ACTION_ATTACHED );\r\n\t\t\t}\r\n\t\t}\r\n\t}\t\r\n\tFocusBinding.superclass.onBindingAttach.call ( this );\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nFocusBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tFocusBinding.superclass.onBindingDispose.call ( this );\r\n\tif ( FocusBinding.activeInstance == this ) {\r\n\t\tFocusBinding.activeInstance = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nFocusBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tFocusBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\tvar crawler = null;\r\n\t\r\n\tif ( this._isFocusManager ) {\r\n\t\t\r\n\t\tswitch ( action.type ) {\r\n\t\t\r\n\t\t\tcase FocusBinding.ACTION_ATTACHED :\r\n\t\t\t\t\r\n\t\t\t\tif ( binding != this ) {\r\n\t\t\t\t\tthis._isUpToDate = false;\r\n\t\t\t\t}\r\n\t\t\t\taction.consume (); // by consuming this, we dictate the \"strength\" of descendant focusbinding. \r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase FocusBinding.ACTION_UPDATE :\r\n\t\t\t\t\r\n\t\t\t\tif ( binding != this ) {\r\n\t\t\t\t\tthis._isUpToDate = false;\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase FocusBinding.ACTION_BLUR :\r\n\t\t\t\t\r\n\t\t\t\tif ( Application.isOperational ) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tcrawler = new FocusCrawler ();\r\n\t\t\t\t\tcrawler.mode = FocusCrawler.MODE_BLUR;\r\n\t\t\t\t\tcrawler.crawl ( binding.bindingElement );\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Otherwise a hidden field (in a hidden \r\n\t\t\t\t\t * deck) could be refocused onActivate. \r\n\t\t\t\t\t * TODO: only if filter actually blurred something (?)\r\n\t\t\t\t\t */\r\n\t\t\t\t\tif ( this._cachedFocus != null ) {\r\n\t\t\t\t\t\tthis._cachedFocus = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\taction.consume ();\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase FocusBinding.ACTION_FOCUS :\r\n\t\t\t\t\r\n\t\t\t\tif ( Application.isOperational && binding != this ) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tcrawler = new FocusCrawler ();\r\n\t\t\t\t\tcrawler.mode = FocusCrawler.MODE_FOCUS;\r\n\t\t\t\t\tcrawler.crawl ( binding.bindingElement );\r\n\t\t\t\t}\r\n\t\t\t\taction.consume ();\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase Binding.ACTION_FOCUSED :\r\n\t\t\t\t\r\n\t\t\t\tif ( Interfaces.isImplemented ( IFocusable, binding )) {\r\n\t\t\t\t\tthis.claimFocus ();\r\n\t\t\t\t\tthis._onFocusableFocused ( binding );\r\n\t\t\t\t}\r\n\t\t\t\taction.consume ();\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase Binding.ACTION_BLURRED :\r\n\t\t\t\t\r\n\t\t\t\tif (  Interfaces.isImplemented ( IFocusable, binding )) {\r\n\t\t\t\t\tthis._onFocusableBlurred ( binding );\r\n\t\t\t\t}\r\n\t\t\t\taction.consume ();\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t/*\r\n\t\t\tcase UpdatePanelBinding.ACTION_UPDATED :\r\n\t\t\t\t\r\n\t\t\t\t/* \r\n\t\t\t\t * TODO: Re-enable this stuff! \r\n\t\t\t\t * TODO: don't speculate on FocusBinding.focusedBinding\r\n\t\t\t\t * TODO: support descendant WindowBindings\r\n\t\t\t\t *\r\n\t\t\t\tif ( !FocusBinding.focusedBinding ) {\r\n\t\t\t\t\tif ( this._cachedFocus ) {\r\n\t\t\t\t\t\tvar binding = this._cachedFocus.getBinding ();\r\n\t\t\t\t\t\tif ( binding && !binding.isFocused ) {\r\n\t\t\t\t\t\t\tbinding.focus ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\taction.consume (); // probably no need to propagate this furhter...\r\n\t\t\t\tbreak;\r\n\t\t\t*/\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Move focus to next {@link IFocusable} binding. If the last focused \r\n * binding has lost it's focus for some reason, focus this instead.\r\n * @param {boolean} isReverse\r\n */\r\nFocusBinding.prototype.focusNext = function ( isReverse ) {\r\n\t\r\n\tvar focused = null;\r\n\tvar list = this._getFocusableList ();\r\n\t\r\n\tif ( list.reset ().hasEntries ()) {\r\n\t\r\n\t\twhile ( focused == null && list.hasNext ()) {\r\n\t\t\tvar binding = list.getNext ();\r\n\t\t\tif ( this._cachedFocus && binding == this._cachedFocus.getBinding ()) {\r\n\t\t\t\tfocused = binding;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( focused != null ) {\r\n\t\t\tif ( binding.isFocused ) {\r\n\t\t\t\tvar next = isReverse ? \r\n\t\t\t\t\tlist.getPreceding ( focused ) :\r\n\t\t\t\t\tlist.getFollowing ( focused );\r\n\t\t\t\tif ( !next ) {\r\n\t\t\t\t\tnext = isReverse ?\r\n\t\t\t\t\t\tlist.getLast () :\r\n\t\t\t\t\t\tlist.getFirst ();\r\n\t\t\t\t}\r\n\t\t\t\tnext.focus ();\r\n\t\t\t} else {\r\n\t\t\t\tfocused.focus ();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlist.getFirst ().focus ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Claim focus!\r\n */\r\nFocusBinding.prototype.claimFocus = function () {\r\n\t\r\n\tFocusBinding.activeInstance = this;\r\n}\r\n\r\n/**\r\n * Build list and return it.\r\n * @return {List<IFocusable>}\r\n */\r\nFocusBinding.prototype._getFocusableList = function () {\r\n\t\r\n\t// TODO: overwrite StageBinding!\r\n\t\r\n\tif ( !this._isUpToDate ) {\r\n\t\t\r\n\t\tvar crawler = new FocusCrawler ();\r\n\t\tvar list = new List ();\r\n\t\t\r\n\t\tcrawler.mode = FocusCrawler.MODE_INDEX;\r\n\t\tcrawler.crawl ( this.bindingElement, list );\r\n\t\t\r\n\t\tthis._focusableList = list;\r\n\t\tthis._isUpToDate = true;\r\n\t}\r\n\t\r\n\treturn this._focusableList;\r\n}\r\n\r\n/**\r\n * Focus first focusable *if* our activatable is active!\r\n * TODO: move this check somewhere else?\r\n */\r\nFocusBinding.prototype._focusFirstFocusable = function () {\r\n\t\r\n\tif ( this._isFocusManager && this.isActivated ) {\r\n\t\t\r\n\t\tvar list = this._getFocusableList ();\r\n\t\t\r\n\t\tif ( list != null ) {\r\n\t\t\tif ( list.hasEntries ()) {\r\n\t\t\t\tlist.getFirst ().focus ();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.logger.warn ( \"Could not compute focusable list.\" );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Focus previously focused focusable binding. \r\n * Now say it three times really fast.\r\n */\r\nFocusBinding.prototype._focusPreviouslyFocused = function () {\r\n\t\r\n\t/*\r\n\t * Locate last focused binding.\r\n\t */\r\n\tif ( this._cachedFocus ) {\r\n\t\tvar binding = this._cachedFocus.getBinding ();\r\n\t\tif ( binding && !binding.isFocused ) {\r\n\t\t\tbinding.focus ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * On focusable focused.\r\n * @param {IFocusable} binding\r\n */\r\nFocusBinding.prototype._onFocusableFocused = function ( binding ) {\r\n\r\n\tif ( binding != FocusBinding.focusedBinding ) {\r\n\t\tif ( FocusBinding.focusedBinding != null ) {\r\n\t\t\tif ( Binding.exists ( FocusBinding.focusedBinding )) {\r\n\t\t\t\tFocusBinding.focusedBinding.blur ();\r\n\t\t\t}\r\n\t\t}\r\n\t\tFocusBinding.focusedBinding = binding;\r\n\t\tbinding.setProperty ( FocusBinding.MARKER, true );\r\n\t\t\r\n\t\tthis._cachedFocus = FocusBinding.getCachedFocus ( binding );\r\n\t}\r\n}\r\n\r\n/**\r\n * On focusable blurred.\r\n * @param {IFocusable} binding\r\n */\r\nFocusBinding.prototype._onFocusableBlurred = function ( binding ) {\r\n\t\r\n\tbinding.deleteProperty ( FocusBinding.MARKER );\r\n\tif ( binding == FocusBinding.focusedBinding ) {\r\n\t\tFocusBinding.focusedBinding = null;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/focus/FocusCrawler.js",
    "content": "FocusCrawler.prototype = new Crawler;\r\nFocusCrawler.prototype.constructor = FocusCrawler;\r\nFocusCrawler.superclass = Crawler.prototype;\r\n\r\nFocusCrawler.ID = \"focuscrawler\";\r\n\r\nFocusCrawler.MODE_INDEX = \"index\";\r\nFocusCrawler.MODE_FOCUS = \"focus\";\r\nFocusCrawler.MODE_BLUR = \"blur\";\r\n\r\n/**\r\n * This crawler handles focus and blur.\r\n * @class\r\n */\r\nfunction FocusCrawler () {\r\n\t \r\n\tthis.id = FocusCrawler.ID;\r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * @overloads {Crawler#_construct} \r\n */\r\nFocusCrawler.prototype._construct = function () {\r\n\t\r\n\tFocusCrawler.superclass._construct.call ( this );\r\n\t\r\n\tthis.addFilter ( function ( element, list ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\r\n\t\tif ( binding.isAttached == true ) {\r\n\t\t\tif ( Interfaces.isImplemented ( IFocusable, binding ) == true ) {\r\n\t\t\t\tif ( binding.isFocusable && binding.isVisible ) {\r\n\t\t\t\t\tswitch ( this.mode ) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcase FocusCrawler.MODE_INDEX :\t\r\n\t\t\t\t\t\t\tlist.add ( binding );\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tcase FocusCrawler.MODE_FOCUS :\r\n\t\t\t\t\t\t\tif ( !binding.isFocused ) {\r\n\t\t\t\t\t\t\t\tbinding.focus ();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tresult = NodeCrawler.STOP_CRAWLING;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\r\n\t\t\t\t\t\tcase FocusCrawler.MODE_BLUR :\r\n\t\t\t\t\t\t\tif ( binding.isFocused == true ) {\r\n\t\t\t\t\t\t\t\tbinding.blur ();\r\n\t\t\t\t\t\t\t\tresult = NodeCrawler.STOP_CRAWLING;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//self._string += binding.toString () + \": \" + result + \"\\n\";\r\n\t\t\r\n\t\treturn result;\r\n\t});\r\n}\r\n\r\n/*\r\nFocusCrawler.prototype.onCrawlStart = function (){\r\n\t\r\n\tthis._string = this.mode + \"\\n\\n\";\r\n}\r\n\r\nFocusCrawler.prototype.onCrawlStop = function (){\r\n\t\r\n\tthis.logger.debug ( this._string );\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/genericview/AddressBarBinding.js",
    "content": "﻿AddressBarBinding.prototype = new DataInputBinding;\nAddressBarBinding.prototype.constructor = AddressBarBinding;\nAddressBarBinding.superclass = DataInputBinding.prototype;\n\n/**\n * @class\n */\nfunction AddressBarBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"AddressBarBinding\");\n\n\t/**\n\t* @type {PathBinding}\n\t*/\n\tthis.pathBinding = null;\n\n\t/**\n\t * Key to validate that result of async request is actual\n\t * @type {string}\n\t */\n\tthis._stateKey = null;\n\n\t/*\n\t * Returnable.\n\t */\n\treturn this;\n}\n\n/**\n * Identifies binding.\n */\nAddressBarBinding.prototype.toString = function () {\n\n\treturn \"[AddressBarBinding]\";\n}\n\n/**\n * @overloads {DataInputBinding#onBindingAttach}\n */\nAddressBarBinding.prototype.onBindingAttach = function () {\n\n\tAddressBarBinding.superclass.onBindingAttach.call(this);\n\n\tthis.pathBinding = PathBinding.newInstance(this.bindingDocument);\n\tthis.shadowTree.box.appendChild(this.pathBinding.bindingElement);\n\tthis.pathBinding.attach();\n}\n\n\n\n/**\n * @implements {IEventListener}\n * @overloads {Binding#handleEvent}\n * @param {MouseEvent} e\n */\nAddressBarBinding.prototype.handleEvent = function (e) {\n\n\tAddressBarBinding.superclass.handleEvent.call(this, e);\n\n\tswitch (e.type) {\n\t\tcase DOMEvents.CLICK:\n\t\t\tif (e.target === this.pathBinding.bindingElement) {\n\t\t\t\tthis._hideBreadcrumb();\n\t\t\t\tthis.shadowTree.input.value = \"\";\n\t\t\t\tthis.shadowTree.input.focus();\n\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\n\n\n/**\n * Blur.\n * @implements {IData}\n */\nAddressBarBinding.prototype.blur = function () {\n\n\tAddressBarBinding.superclass.blur.call(this);\n\tif (this.isBreadcrumb && !this.shadowTree.input.value && !this.pathBinding.isVisible)\n\t\tthis._showBreadcrumb();\n}\n\n\n/**\n * Show breadcrumb\n */\nAddressBarBinding.prototype.showBreadcrumb = function (node, parents) {\n\n\tthis._stateKey = KeyMaster.getUniqueKey();\n\n\tvar pathBinding = this.pathBinding;\n\tpathBinding.detachRecursive();\n\tpathBinding.bindingElement.innerHTML = \"\";\n\n\tif (parents != undefined) {\n\t\tparents.reverse().each(\n\t\t\tfunction(parent) {\n\t\t\t\tvar button = ToolBarButtonBinding.newInstance(pathBinding.bindingDocument);\n\n\t\t\t\tbutton.setLabel(parent.getLabel());\n\n\t\t\t\tpathBinding.add(button);\n\t\t\t\tbutton.attach();\n\t\t\t\tbutton.entityToken = parent.getEntityToken();\n\t\t\t\tbutton.node = parent; //?\n\t\t\t\tbutton.oncommand = function() {\n\t\t\t\t\tthis.dispatchAction(PathBinding.ACTION_COMMAND);\n\t\t\t\t}\n\n\t\t\t}, this\n\t\t);\n\t}\n\n\tif (node != undefined) {\n\t\tvar button = ToolBarButtonBinding.newInstance(pathBinding.bindingDocument);\n\t\tbutton.setLabel(node.getLabel());\n\t\tpathBinding.add(button);\n\t\tbutton.attach();\n\t}\n\n\tthis.shadowTree.input.value = \"\";\n\tthis.shadowTree.input.style.display = \"none\";\n\tthis.pathBinding.show();\n\tthis.isBreadcrumb = true;\n}\n\n\n/**\n * Hide breadcrumb\n */\nAddressBarBinding.prototype.showAddreesbar = function (url) {\n\n\tthis.newState();\n\n\tvar stateKey = this.getState();\n\tvar self = this;\n\tPageService.ConvertRelativePageUrlToAbsolute(url, function (result) {\n\t\tif (stateKey === self.getState()) {\n\t\t\tself.setValue(result);\n\t\t}\n\t});\n\tthis._hideBreadcrumb();\n\tthis.isBreadcrumb = true;\n}\n\n\n/**\n * Hide breadcrumb\n */\nAddressBarBinding.prototype._hideBreadcrumb = function () {\n\tthis.pathBinding.hide();\n\tthis.shadowTree.input.style.display = \"block\";\n}\n\n\n/**\n * Hide breadcrumb\n */\nAddressBarBinding.prototype._showBreadcrumb = function () {\n\tthis.shadowTree.input.style.display = \"none\";\n\tthis.pathBinding.show();\n}\n\n\n/**\n * new State\n */\nAddressBarBinding.prototype.newState = function () {\n\n\tthis._stateKey = KeyMaster.getUniqueKey();\n\treturn this._stateKey;\n}\n\n/**\n * new State\n */\nAddressBarBinding.prototype.getState = function () {\n\n\treturn this._stateKey;\n}\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/genericview/GenericViewBinding.js",
    "content": "﻿GenericViewBinding.prototype = new TreeBinding;\r\nGenericViewBinding.prototype.constructor = GenericViewBinding;\r\nGenericViewBinding.superclass = TreeBinding.prototype;\r\n\r\nGenericViewBinding.CLASSNAME = \"genericview\";\r\nGenericViewBinding.CLASSNAME_SINGLE = \"single\";\r\nGenericViewBinding.CLASSNAME_ICONSIZE = \"icons-s-170\";\r\nGenericViewBinding.CLASSNAME_SINGLE_ICONSIZE = \"icons-s-400\";\r\nGenericViewBinding.IMAGE_MAXWIDTH = 300;\r\nGenericViewBinding.IMAGE_MAXHEIGHT = 170;\r\nGenericViewBinding.LIST_IMAGE = \"listimage\";\r\n\r\n\r\nGenericViewBinding.ACTION_COMMAND = \"generic action open\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction GenericViewBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"GenericViewBinding\");\r\n\r\n\t/**\r\n\t * Associates the tree to the selected perspective.\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.perspectiveNode = null;\r\n\r\n\t/**\r\n\t * Current Node\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.node = null;\r\n\r\n\t/**\r\n\t* Tree position \r\n\t* @type {int}\r\n\t*/\r\n\tthis._activePosition = SystemAction.activePositions.NavigatorTree;\r\n\r\n\t/**\r\n\t * @type {HashMap<string><boolean>}\r\n\t */\r\n\tthis._actionGroup = null;\r\n\r\n}\r\n\r\n\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nGenericViewBinding.prototype.toString = function () {\r\n\r\n\treturn \"[GenericViewBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {TreeBinding#onBindingRegister}\r\n */\r\nGenericViewBinding.prototype.onBindingRegister = function () {\r\n\r\n\tGenericViewBinding.superclass.onBindingRegister.call(this);\r\n\r\n\r\n\tthis.addActionListener(TreeNodeBinding.ACTION_COMMAND);\r\n\r\n\tthis.attachClassName(GenericViewBinding.CLASSNAME);\r\n\r\n\tthis.setContextMenu(top.app.bindingMap.systemtreepopup);\r\n\r\n\t/*\r\n\t * Mark the tree as resident on the currently selected perspective.\r\n\t */\r\n\tthis.perspectiveNode = StageBinding.perspectiveNode;\r\n\r\n\tif (this.getProperty(\"treeselector\") == true) {\r\n\t\tthis._activePosition = SystemAction.activePositions.SelectorTree;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {TreeBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nGenericViewBinding.prototype.handleAction = function (action) {\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch (action.type) {\r\n\t\tcase TreeNodeBinding.ACTION_COMMAND:\r\n\t\tcase TreeNodeBinding.ACTION_OPEN:\r\n\t\t\tthis.dispatchAction(new Action(action.target, GenericViewBinding.ACTION_COMMAND));\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t\tcase TreeNodeBinding.ACTION_COMMAND:\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tGenericViewBinding.superclass.handleAction.call(this, action);\r\n}\r\n\r\n/**\r\n * Set showing children of SystemNode\r\n  * @param {SystemNode} node\r\n */\r\nGenericViewBinding.prototype.setNode = function (node) {\r\n\r\n\tthis.node = node;\r\n\r\n\tthis.empty();\r\n\tthis.detachClassName(GenericViewBinding.CLASSNAME_SINGLE);\r\n\tthis.detachClassName(GenericViewBinding.CLASSNAME_SINGLE_ICONSIZE);\r\n\tthis.detachClassName(GenericViewBinding.CLASSNAME_ICONSIZE);\r\n\r\n\tif (this.node) {\r\n\t\tif (this.node.hasChildren()) {\r\n\t\t\t\r\n\t\t\tvar children = this.node.getChildren();\r\n\r\n\t\t\twhile (children.hasEntries()) {\r\n\t\t\t\tvar child = children.extractFirst();\r\n\t\t\t\tthis.addNode(child);\r\n\t\t\t\tthis.attachClassName(GenericViewBinding.CLASSNAME_ICONSIZE);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.attachClassName(GenericViewBinding.CLASSNAME_SINGLE);\r\n\t\t\tthis.attachClassName(GenericViewBinding.CLASSNAME_SINGLE_ICONSIZE);\r\n\t\t\tthis.addNode(this.node);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Add node to tree\r\n  * @param {SystemNode} node\r\n */\r\nGenericViewBinding.prototype.addNode = function (child) {\r\n\tvar treenode = TreeNodeBinding.newInstance(this.bindingDocument\r\n\t\t\t\t);\r\n\ttreenode.node = child;\r\n\tvar label = treenode.node.getLabel();\r\n\tif (label) {\r\n\t\ttreenode.setLabel(label);\r\n\t}\r\n\r\n\tvar bag = treenode.node.getPropertyBag();\r\n\tvar imageProfile = treenode.node.getImageProfile();\r\n\r\n\tif (bag && bag.ListViewImage) {\r\n\t\t\r\n\r\n\t    if (this.hasClassName(GenericViewBinding.CLASSNAME_SINGLE)) {\r\n\t        treenode.setImage(bag.ListViewImage.replace(\"{width}\", this.bindingElement.offsetWidth - 60).replace(\"{height}\", this.bindingElement.offsetHeight - 130));\r\n\t\t} else {\r\n\t\t    treenode.setImage(bag.ListViewImage.replace(\"{width}\", GenericViewBinding.IMAGE_MAXWIDTH).replace(\"{height}\", GenericViewBinding.IMAGE_MAXHEIGHT));\r\n\t\t\ttreenode.attachClassName(GenericViewBinding.LIST_IMAGE);\r\n\t\t}\r\n\t\t\r\n\t}else if (imageProfile) {\r\n\t\ttreenode.setImage(imageProfile.getDefaultImage());\r\n\t}\r\n\r\n\r\n\t/*\r\n\t * Drag type and other stuff. All key-value pairs in the\r\n\t * propertybag object is assigned to element as attributes.\r\n\t */\r\n\tif (bag) {\r\n\t\tfor (var key in bag) {\r\n\t\t\tswitch (key.toLowerCase()) {\r\n\t\t\t\tcase \"id\":\r\n\t\t\t\tcase \"key\":\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\ttreenode.setProperty(key, bag[key]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\ttreenode.isContainer = treenode.node.hasChildren();\r\n\tthis.add(treenode);\r\n\ttreenode.attach();\r\n}\r\n\r\n\r\n/**\r\n * Return perspective handle for tree\r\n */\r\nGenericViewBinding.prototype.getSyncHandle = function () {\r\n\r\n\treturn this.perspectiveNode.getHandle();\r\n}\r\n\r\n/**\r\n * Invoked when tree focus changes AND when tree itself recieves the focus  \r\n * AND when lock-tree-to-editor feature updates the treenode focus.\r\n */\r\nGenericViewBinding.prototype._handleSystemTreeFocus = function () {\r\n\r\n\tif (this.getFocusedTreeNodeBindings().hasEntries()) {\r\n\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\tBroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED,\r\n\t\t\t\t{\r\n\t\t\t\t\tactivePosition: this._activePosition,\r\n\t\t\t\t\tactionProfile: this.getCompiledActionProfile(),\r\n\t\t\t\t\tsyncHandle: this.getSyncHandle(),\r\n\t\t\t\t\tsource: this\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {TreeBinding#focusSingleTreeNodeBinding}\r\n * @param {TreeNodeBinding} binding;\r\n */\r\nGenericViewBinding.prototype.focusSingleTreeNodeBinding = function (binding) {\r\n\r\n\tGenericViewBinding.superclass.focusSingleTreeNodeBinding.call(this, binding);\r\n\tif (binding != null) {\r\n\t\tthis._handleSystemTreeFocus();\r\n\t}\r\n};\r\n\r\n/**\r\n * @overloads {TreeBinding#_navigateByKey}  \r\n * @param {int} key\r\n */\r\nGenericViewBinding.prototype._navigateByKey = function (key) {\r\n\r\n\tvar focused = this.getFocusedTreeNodeBindings()\r\n\r\n\tif (focused.hasEntries()) {\r\n\r\n\t\tvar node = focused.getFirst();\r\n\t\tvar next = null;\r\n\r\n\t\tswitch (key) {\r\n\t\t\tcase KeyEventCodes.VK_LEFT:\r\n\t\t\t\tnext = node.getPreviousBindingByLocalName(\"treenode\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase KeyEventCodes.VK_RIGHT:\r\n\t\t\t\tnext = node.getNextBindingByLocalName(\"treenode\");\r\n\t\t\t\tbreak;\r\n\t\t\tcase KeyEventCodes.VK_DOWN:\r\n\t\t\t\tnext = node.getNextBindingByLocalName(\"treenode\");\r\n\t\t\t\twhile (next && next.bindingElement.offsetTop == node.bindingElement.offsetTop) {\r\n\t\t\t\t\tnext = next.getNextBindingByLocalName(\"treenode\");\r\n\t\t\t\t}\r\n\t\t\t\twhile (next && next.bindingElement.offsetLeft < node.bindingElement.offsetLeft) {\r\n\t\t\t\t\tnext = next.getNextBindingByLocalName(\"treenode\");\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase KeyEventCodes.VK_UP:\r\n\t\t\t\tnext = node.getPreviousBindingByLocalName(\"treenode\");\r\n\t\t\t\twhile (next && next.bindingElement.offsetTop == node.bindingElement.offsetTop) {\r\n\t\t\t\t\tnext = next.getPreviousBindingByLocalName(\"treenode\");\r\n\t\t\t\t}\r\n\t\t\t\twhile (next && next.bindingElement.offsetLeft > node.bindingElement.offsetLeft) {\r\n\t\t\t\t\tnext = next.getPreviousBindingByLocalName(\"treenode\");\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tif (next != null) {\r\n\t\t\tthis.focusSingleTreeNodeBinding(next);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Compile actionprofile based on the individual actionprofile of all focused treenodes.\r\n * In case of multiple focused treenodes, only SystemActions relevant for *all* focused \r\n * treenodes will be included in the result.\r\n * @return {Map<string><List<SystemAction>>}\r\n */\r\nGenericViewBinding.prototype.getCompiledActionProfile = SystemTreeBinding.prototype.getCompiledActionProfile;\r\n\r\n/**\r\n * Set Action Profile Group\r\n * @param {function}\r\n */\r\nGenericViewBinding.prototype.setActionGroup = SystemTreeBinding.prototype.setActionGroup;\r\n\r\n/**\r\n * TreeBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TreeBinding}\r\n */\r\nGenericViewBinding.newInstance = function (ownerDocument) {\r\n\r\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:tree\", ownerDocument);\r\n\tvar binding = UserInterface.registerBinding(element, GenericViewBinding);\r\n\tbinding.treeBodyBinding = TreeBodyBinding.newInstance(ownerDocument);\r\n\treturn binding;\r\n}\r\n\r\n/**\r\n * Return perspective handle for tree\r\n */\r\nGenericViewBinding.prototype.getSyncHandle = function () {\r\n\r\n\tif (this.getProperty(\"treeselector\") == true) {\r\n\t\treturn this.getAncestorBindingByType(PageBinding).getID();\r\n\t} else {\r\n\t\treturn this.perspectiveNode.getHandle();\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/genericview/PathBinding.js",
    "content": "﻿PathBinding.prototype = new Binding;\nPathBinding.prototype.constructor = PathBinding;\nPathBinding.superclass = Binding.prototype;\n\nPathBinding.ACTION_COMMAND = \"pathcommand\";\n\n\n/**\n * @class\n */\nfunction PathBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"PathBinding\");\n\n\t/*\n\t * Returnable.\n\t */\n\treturn this;\n}\n\n/**\n * Identifies binding.\n */\nPathBinding.prototype.toString = function () {\n\n\treturn \"[PathBinding]\";\n}\n\n/**\n * @overloads {Binding#onBindingRegister}\n */\nPathBinding.prototype.onBindingRegister = function () {\n\n\tPathBinding.superclass.onBindingRegister.call(this);\n\n}\n\n/**\n * @overloads {Binding#onBindingAttach}\n */\nPathBinding.prototype.onBindingAttach = function () {\n\n\tPathBinding.superclass.onBindingAttach.call(this);\n\n}\n\n\n/**\n * ToolBarBodyBinding factory.\n * @param {DOMDocument} ownerDocument\n * @return {ToolBarBodyBinding}\n */\nPathBinding.newInstance = function (ownerDocument) {\n\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:path\", ownerDocument);\n\treturn UserInterface.registerBinding(element, PathBinding);\n}\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/keys/KeySetBinding.js",
    "content": "KeySetBinding.prototype = new Binding;\r\nKeySetBinding.prototype.constructor = KeySetBinding;\r\nKeySetBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * MODIFIERS IMPLEMENTED\r\n * shift: \tThe Shift key.\r\n * control:\tThe Control key.\r\n *\r\n * MODIFIERS NOT IMPLEMENTED\r\n * alt: \tThe Alt key. On the Macintosh, this is the Option key.\r\n * meta: \tThe Meta key. On the Macintosh, this is the Command key.\r\n * accel: \tThe key used for keyboard shortcuts on the user's platform. Usually, this would be the value you would use.\r\n * access: \tThe access key for activating menus and other elements. On Windows, this is the Alt key, used in conjuction with an element's accesskey.\r\n */\r\n\r\n\r\n/**\r\n * @ type {HashMap<DOMDocument><HashMap<int><HashMap<string><IKeyEventHandler>>>}\r\n */\r\nKeySetBinding.keyEventHandlers = {};\r\n\t\r\n/**\r\n * Register keyevent handler.\r\n * @param {DOMDocument} doc\r\n * @param {string} key\r\n * @param {string} modifiers\r\n * @param {IKeyEventHandler} handler\r\n */\r\nKeySetBinding.registerKeyEventHandler = function ( doc, key, modifiers, handler ) {\r\n\t\r\n\tvar handlers = KeySetBinding.keyEventHandlers;\r\n\t\r\n\tif ( Interfaces.isImplemented ( IKeyEventHandler, handler, true ) == true ) {\r\n\t\t\r\n\t\tif ( modifiers != \"*\" ) {\r\n\t\t\tmodifiers = KeySetBinding._sanitizeKeyModifiers ( modifiers );\r\n\t\t}\r\n\t\tvar code = window.KeyEventCodes [ key ];\r\n\t\tif ( !code ) {\r\n\t\t\tcode = key.charCodeAt ( 0 );\r\n\t\t}\r\n\t\tif ( !handlers [ doc ]) {\r\n\t\t\thandlers [ doc ] = {};\r\n\t\t}\r\n\t\tif ( !handlers [ doc ][ code ]) {\r\n\t\t\thandlers [ doc ][ code ] = {};\r\n\t\t}\r\n\t\thandlers [ doc ][ code ][ modifiers ] = handler;\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle key.\r\n * @see {StandardEventHandler#_handleKeyDown}\r\n * @param {DOMDocument} doc\r\n * @param {KeyEvent} e\r\n * @return {boolean}\r\n */\r\nKeySetBinding.handleKey = function ( doc, e ) {\r\n\t\r\n\tvar isHandled = false;\r\n\tvar code = e.keyCode;\r\n\tvar handlers = KeySetBinding.keyEventHandlers;\r\n\t\r\n\tif ( handlers [ doc ] && handlers [ doc ][ code ]) {\r\n\t\r\n\t\tvar modifiers = \"[default]\";\t\r\n\t\tmodifiers += code != KeyEventCodes.VK_SHIFT ? e.shiftKey ? \" shift\" : \"\" : \"\";\r\n\t\tif (Client.isMac) {\r\n\t\t\tmodifiers += code != KeyEventCodes.VK_COMMAND ? e.metaKey ? \" control\" : \"\" : \"\";\r\n\t\t} else {\r\n\t\t\tmodifiers += code != KeyEventCodes.VK_CONTROL ? e.ctrlKey ? \" control\" : \"\" : \"\";\r\n\t\t}\r\n\t\tmodifiers += code != KeyEventCodes.VK_ALT ? e.altKey ? \" alt\" : \"\" : \"\";\r\n\t\t\r\n\t\tvar handler = handlers [ doc ][ code ][ modifiers ];\r\n\t\tif ( handler == null ) {\r\n\t\t\thandler = handlers [ doc ][ code ][ \"*\" ];\r\n\t\t}\r\n\t\t\r\n\t\tif ( handler != null ) {\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * The handler also handles any \"preventDefault\" \r\n\t\t\t * that my be relevant. \"stopPropagation\" is always invoked. \r\n\t\t\t */\r\n\t\t\thandler.handleKeyEvent ( e );\r\n\t\t\tisHandled = true;\r\n\t\t}\r\n\t}\r\n\treturn isHandled;\r\n}\r\n\r\n/**\r\n * We need to index keyhandlers by modifiers in a clearly defined sequence.\r\n * @return {string}\r\n */\r\nKeySetBinding._sanitizeKeyModifiers = function ( modifiers ) {\r\n\t \r\n\t var result = \"[default]\";\r\n\t var mods = {};\r\n\t \r\n\t if ( modifiers ) {\r\n\t\t new List ( modifiers.split ( \" \" )).each ( \r\n\t\t \tfunction ( modifier ) {\r\n\t\t \t\tmods [ modifier ] = true;\r\n\t\t \t}\t\r\n\t\t );\r\n\t\t function check ( modifier ) {\r\n\t\t \tif ( mods [ modifier ]) {\r\n\t\t \t\tresult += \" \" + modifier;\r\n\t\t \t} \r\n\t\t }\r\n\t\t check ( \"shift\" );\r\n\t\t check ( \"control\" );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nfunction KeySetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"KeySetBinding\" );\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ DocumentCrawler.ID, FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nKeySetBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[KeySetBinding]\";\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nKeySetBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tKeySetBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tvar self = this;\r\n\tvar keys = new List ( \r\n\t\tDOMUtil.getElementsByTagName ( this.bindingElement, \"key\" )\r\n\t);\r\n\t\r\n\tkeys.each ( function ( key ) {\r\n\t\t\r\n\t\tvar oncommand = key.getAttribute ( \"oncommand\" );\r\n\t\tvar isPreventDefault = key.getAttribute ( \"preventdefault\" ) == \"true\";\r\n\t\t\r\n\t\t/*\r\n\t\t * Register handler.\r\n\t\t */\r\n\t\tKeySetBinding.registerKeyEventHandler (\r\n\t\t\t\t\r\n\t\t\tself.bindingDocument,\r\n\t\t\tkey.getAttribute ( \"key\" ),\r\n\t\t\tkey.getAttribute ( \"modifiers\" ), {\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * This executes the action. \r\n\t\t\t\t * @param {KeyEvent} e\r\n\t\t\t\t */\r\n\t\t\t\thandleKeyEvent : function ( e ) {\r\n\t\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\t\tif ( isPreventDefault ) {\r\n\t\t\t\t\t\tDOMEvents.preventDefault ( e );\r\n\t\t\t\t\t}\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * The timeout is needed for events \r\n\t\t\t\t\t * to properly cancel in Mozilla.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tvar manager = self.bindingWindow.WindowManager;\r\n\t\t\t\t\ttop.setTimeout ( function () {\r\n\t\t\t\t\t\tBinding.evaluate ( oncommand, self );\r\n\t\t\t\t\t}, 0 );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/labels/LabelBinding.js",
    "content": "LabelBinding.prototype = new Binding;\r\nLabelBinding.prototype.constructor = LabelBinding;\r\nLabelBinding.superclass = Binding.prototype;\r\n\r\n/*\r\n * Can be used to indicate that a dialog window will \r\n * open. Looks more elegant than three regular dots.\r\n */\r\nLabelBinding.DIALOG_INDECATOR_SUFFIX = String.fromCharCode(8230); // \"…\".charCodeAt ( 0 );\r\nLabelBinding.DEFAULT_IMAGE = \"blank\";\r\nLabelBinding.SPRITE_PATH = \"${root}/images/sprite.svg\";\r\nLabelBinding.CLASSNAME_GRAYTEXT = \"graytext\";\r\nLabelBinding.CLASSNAME_FLIPPED = \"flipped\";\r\n\r\nLabelBinding.DOCKTABLABEL_OVERFLOWED_CLASSNAME = \"overflowed\";\r\nLabelBinding.DOCKTABLABEL_WIDTH = 110; // If value is changed, then also make fix in css. See file docks.less\r\n\r\n/**\r\n * SVG Images\r\n * @type {Element}\r\n */\r\nLabelBinding.sprites = null;\r\n\r\n/**\r\n * Sprite whiting to load\r\n * @type {Element}\r\n */\r\nLabelBinding.spritesQueue = new Map();\r\n\r\n\r\n/**\r\n * Indicate that loading images starterd\r\n * @type {Element}\r\n */\r\nLabelBinding.spriteLoading = false;\r\n\r\n/**\r\n * Load SVG images \r\n */\r\nLabelBinding.spriteLoad = function () {\r\n\r\n\tfunction onspriteload() {\r\n\t\tvar request = this, sprites = document.createElement('x');\r\n\t\tsprites.innerHTML = request.responseText;\r\n\t\tvar uses = sprites.querySelectorAll(\"use\");\r\n\t\tfor (var i = 0; i < uses.length; ++i) {\r\n\t\t\tvar use = uses[i];\r\n\t\t\tvar def = use.parentNode;\r\n\t\t\tvar hash = use.getAttribute('xlink:href').split('#')[1];\r\n\t\t\tvar target = sprites.querySelector('#' + hash);\r\n\t\t\tif (target) {\r\n\t\t\t\tvar clone = target.cloneNode(true);\r\n\t\t\t\tclone.id = def.id;\r\n\t\t\t\tdef.parentNode.replaceChild(clone, def);\r\n\t\t\t}\r\n\t\t}\r\n\t\tLabelBinding.sprites = sprites;\r\n\t\tLabelBinding.spriteLoading = false;\r\n\r\n\t\tLabelBinding.spritesQueue.each(function (key, image) {\r\n\t\t\tvar binding = UserInterface.getBindingByKey(key);\r\n\t\t\tif (binding != null) {\r\n\t\t\t\tLabelBinding.setImageSvg(binding, image);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tLabelBinding.spritesQueue.empty();\r\n\t}\r\n\r\n\tif (!LabelBinding.spriteLoading) {\r\n\t\tLabelBinding.spriteLoading = true;\r\n\t\tvar request = new XMLHttpRequest();\r\n\t\trequest.open('GET', Resolver.resolve(LabelBinding.SPRITE_PATH));\r\n\t\trequest.onload = onspriteload;\r\n\t\trequest.send();\r\n\t}\r\n}\r\n\r\n/**\r\n * Set SVG Image \r\n * @param {LabelBinding} binding\r\n * @param {string} image\r\n */\r\nLabelBinding.setImageSvg = function (binding, image) {\r\n\t//validate that image is string and have valid Id\r\n\tif (image && typeof image == \"string\" && /^[A-Za-z]+[\\w\\-\\.]*$/.test(image)) {\r\n\t\tif (binding.shadowTree.labelBody) {\r\n\t\t\tif (!image) {\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif (LabelBinding.sprites) {\r\n\t\t\t\t\tvar isDisabled = image.toLowerCase().indexOf('-disabled') > 0;\r\n\t\t\t\t\timage = image.toLowerCase().replace('-disabled', '');\r\n\t\t\t\t\tvar g = LabelBinding.sprites.querySelector(\"#\" + image);\r\n\t\t\t\t\tif (g) {\r\n\t\t\t\t\t\tvar xmlns = \"http://www.w3.org/2000/svg\";\r\n\t\t\t\t\t\tif (!binding.shadowTree.svg) {\r\n\t\t\t\t\t\t\tbinding.shadowTree.svg = binding.bindingDocument.createElementNS(xmlns, \"svg\");\r\n\t\t\t\t\t\t\tbinding.shadowTree.labelBody.insertBefore(binding.shadowTree.svg, binding.shadowTree.labelBody.firstChild);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar svg = binding.shadowTree.svg;\r\n\t\t\t\t\t\tsvg.setAttribute(\"viewBox\", \"0 0 24 24\");\r\n\t\t\t\t\t\tif (isDisabled)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tsvg.setAttribute(\"class\", \"disabled\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar viewBox = g.getAttribute('viewBox'),\r\n\t\t\t\t\t\t\tfragment = document.createDocumentFragment(),\r\n\t\t\t\t\t\t\tclone = g.cloneNode(true);\r\n\r\n\t\t\t\t\t\tif (viewBox) {\r\n\t\t\t\t\t\t\tsvg.setAttribute('viewBox', viewBox);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tfragment.appendChild(clone);\r\n\t\t\t\t\t\twhile (svg.lastChild) {\r\n\t\t\t\t\t\t\tsvg.removeChild(svg.lastChild);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tsvg.appendChild(fragment);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tLabelBinding.spritesQueue.set(binding.getID(), image);\r\n\t\t\t\t\tLabelBinding.spriteLoad();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tvar svg = binding.shadowTree.svg;\r\n\t\tif (svg) {\r\n\t\t\tif (svg.parentNode) {\r\n\t\t\t\tsvg.parentNode.removeChild(svg);\r\n\t\t\t}\r\n\t\t\tbinding.shadowTree.svg = null;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction LabelBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"LabelBinding\");\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasImage = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasLabel = false;\r\n\r\n\t/**\r\n\t * Image and text position reversed?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFlipped = false;\r\n\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters = new List([DocumentCrawler.ID, FlexBoxCrawler.ID, FocusCrawler.ID]);\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/** \r\n * Identifies binding.\r\n */\r\nLabelBinding.prototype.toString = function () {\r\n\r\n\treturn \"[LabelBinding]\";\r\n}\r\n\r\n\r\n/** \r\n * Can't remember why we need to build DOM content in the registration phase...\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nLabelBinding.prototype.onBindingRegister = function () {\r\n\r\n\tLabelBinding.superclass.onBindingRegister.call(this);\r\n\r\n\tif (this.isBindingBuild) {\r\n\t\tthis.shadowTree.labelBody = this._getBuildElement(\"labelbody\");\r\n\t} else {\r\n\t\tthis.shadowTree.labelBody = DOMUtil.createElementNS(\r\n\t\t\tConstants.NS_UI, \"ui:labelbody\", this.bindingDocument\r\n\t\t);\r\n\t\tthis.bindingElement.appendChild(this.shadowTree.labelBody);\r\n\t}\r\n}\r\n\r\n/** \r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nLabelBinding.prototype.onBindingAttach = function () {\r\n\r\n\tLabelBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tif (this.isBindingBuild) {\r\n\t\tvar element = this._getBuildElement(\"labeltext\");\r\n\t\tif (element) {\r\n\t\t\tthis.shadowTree.labelText = element;\r\n\t\t\tthis.shadowTree.text = element.firstChild;\r\n\t\t\tthis.hasLabel = true;\r\n\t\t}\r\n\t} else {\r\n\r\n\t\tvar label = this.getProperty(\"label\");\r\n\t\tvar image = this.getProperty(\"image\");\r\n\t\tvar tooltip = this.getProperty(\"tooltip\");\r\n\r\n\t\tif (label) {\r\n\t\t\tthis.setLabel(label, false);\r\n\t\t}\r\n\t\tif (image) {\r\n\t\t\tthis.setImage(image, false);\r\n\t\t}\r\n\t\tif (tooltip) {\r\n\t\t\tthis.setToolTip(tooltip);\r\n\t\t}\r\n\t\tthis.buildClassName();\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {string} label\r\n * @param {boolean} isNotBuildingClassName Set to true for faster screen update.\r\n */\r\nLabelBinding.prototype.setLabel = function (label, isNotBuildingClassName) {\r\n\r\n\tlabel = label != null ? label : \"\";\r\n\r\n\tif (!this.hasLabel) {\r\n\t\tthis.buildLabel();\r\n\t}\r\n\tthis.shadowTree.text.data = Resolver.resolve(label);\r\n\tthis.setProperty(\"label\", label);\r\n\tif (!isNotBuildingClassName) {\r\n\t\tthis.buildClassName();\r\n\t}\r\n\r\n\tvar dockTabBinding = this.getAncestorBindingByType(DockTabBinding, true);\r\n\tif (dockTabBinding != null) {\r\n\t\tvar textEl = this.shadowTree.labelText;\r\n\t\tvar cssWidthStr = CSSComputer.getWidth(textEl);\r\n\t\ttextEl.style.width = \"auto\";\r\n\t\tvar actualWidth = textEl.clientWidth;\r\n\t\tvar cssWidth = Number(cssWidthStr.replace(/[^\\d\\.\\-]/g, ''));\r\n\t\tif (actualWidth > cssWidth) {\r\n\t\t\tthis.attachClassName(LabelBinding.DOCKTABLABEL_OVERFLOWED_CLASSNAME);\r\n\t\t}\r\n\t\ttextEl.style.width = cssWidthStr;\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nLabelBinding.prototype.getLabel = function () {\r\n\r\n\treturn this.getProperty(\"label\");\r\n}\r\n\r\n/**\r\n * Set image.\r\n * @param {string} url Eh - this could be a boolean!\r\n * @param {boolean} isNotBuildingClassName Set to true for faster screen update.\r\n */\r\nLabelBinding.prototype.setImage = function (url, isNotBuildingClassName) {\r\n\r\n\tif (url != false && url != undefined) {\r\n\t\turl = url ? url : LabelBinding.DEFAULT_IMAGE;\r\n\t\tvar resolverUrl = Resolver.resolve(url);\r\n\t\tif (resolverUrl.classes) {\r\n\t\t\tthis.setAlphaTransparentBackdrop();\r\n\t\t\tthis.setImageSvg();\r\n\t\t\tthis.setImageClasses(resolverUrl.classes);\r\n\t\t} else if (typeof resolverUrl == \"string\" && resolverUrl[0] == \"/\") {\r\n\t\t\tthis.setAlphaTransparentBackdrop(resolverUrl);\r\n\t\t\tthis.setImageSvg();\r\n\t\t\tthis.setImageClasses();\r\n\t\t} else {\r\n\t\t\tthis.setAlphaTransparentBackdrop();\r\n\t\t\tthis.setImageSvg(resolverUrl);\r\n\t\t\tthis.setImageClasses();\r\n\t\t}\r\n\t\tif (typeof resolverUrl == \"string\") {\r\n\t\t\tthis.setProperty(\"image\", url);\r\n\t\t}\r\n\t\tthis.hasImage = true;\r\n\t\tif (!isNotBuildingClassName) {\r\n\t\t\tthis.buildClassName();\r\n\t\t}\r\n\t} else {\r\n\t\tthis.setImageSvg();\r\n\t\tthis.setImageClasses();\r\n\t\tthis.deleteProperty(\"image\");\r\n\t\tthis.hasImage = false;\r\n\t\tthis.buildClassName();\r\n\t}\r\n}\r\n\r\n/**\r\n * Set image class.\r\n * @param {string} url\r\n */\r\nLabelBinding.prototype.setImageClasses = function (classes) {\r\n\r\n\tif (this.shadowTree.labelBody) {\r\n\t\tif (!classes) {\r\n\t\t\tif (this.shadowTree.icon) {\r\n\t\t\t\tthis.shadowTree.labelBody.removeChild(this.shadowTree.icon);\r\n\t\t\t\tthis.shadowTree.icon = null;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (!this.shadowTree.icon) {\r\n\t\t\t\tthis.shadowTree.icon = DOMUtil.createElementNS(\r\n\t\t\t\t\tConstants.NS_UI, \"ui:icon\", this.bindingDocument\r\n\t\t\t\t);\r\n\r\n\t\t\t\tthis.shadowTree.labelBody.insertBefore(this.shadowTree.icon, this.shadowTree.labelBody.firstChild);\r\n\t\t\t}\r\n\t\t\tthis.shadowTree.icon.className = classes;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Set image class.\r\n * @param {string} url\r\n */\r\nLabelBinding.prototype.setImageSvg = function (svg) {\r\n\r\n\tLabelBinding.setImageSvg(this, svg);\r\n}\r\n\r\n\r\n/**\r\n * Set image.\r\n * @param {string} url\r\n */\r\nLabelBinding.prototype.setDefaultImage = function (url) {\r\n\r\n\tthis.setImage(LabelBinding.DEFAULT_IMAGE);\r\n}\r\n\r\n/**\r\n * Attaches a background-image to the labelbody \r\n * element, supporting 24bit alphatransparency.\r\n * @param {string} url\r\n */\r\nLabelBinding.prototype.setAlphaTransparentBackdrop = function (url) {\r\n\r\n\tif (this.shadowTree.labelBody) { // sometimes it glitches in moz...\r\n\t\tif (url) {\r\n\t\t\turl = Resolver.resolve(url);\r\n\t\t\tthis.shadowTree.labelBody.style.backgroundImage = \"url('\" + url + \"')\";\r\n\r\n\t\t} else {\r\n\t\t\tthis.shadowTree.labelBody.style.removeProperty(\"background-image\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nLabelBinding.prototype.getImage = function () {\r\n\r\n\treturn this.getProperty(\"image\");\r\n}\r\n\r\n/**\r\n * For some reason, setting tooltip on the label may not work reliably \r\n * in Explorer. Always check the result if you use this method.\r\n * @param {string} tooltip\r\n */\r\nLabelBinding.prototype.setToolTip = function (tooltip) {\r\n\r\n\tthis.setProperty(\"tooltip\", tooltip);\r\n\r\n\t/*\r\n\t * Some guy keeps setting tooltips equal to the labels of things. \r\n\t * If a tooltip has nothing new to say, it's better not to show it,  \r\n\t * since the tooltip may obscure the view while navigating trees etc. \r\n\t * TODO: fix that guy instead!\r\n\t */\r\n\tif (tooltip != this.getLabel()) {\r\n\t\tthis.setProperty(\"title\", Resolver.resolve(tooltip));\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nLabelBinding.prototype.getToolTip = function (tooltip) {\r\n\r\n\treturn this.getProperty(\"tooltip\");\r\n}\r\n\r\n/**\r\n * Flip image and text position. This is not supported in IE6.\r\n * @param @optional {boolean} isFlipped.\r\n */\r\nLabelBinding.prototype.flip = function (isFlipped) {\r\n\r\n\tisFlipped = isFlipped == null ? true : isFlipped;\r\n\tvar classname = LabelBinding.CLASSNAME_FLIPPED;\r\n\r\n\tif (!Client.isExplorer6) {\r\n\t\tthis.isFlipped = isFlipped;\r\n\t\tif (isFlipped) {\r\n\t\t\tthis.attachClassName(classname);\r\n\t\t} else {\r\n\t\t\tthis.detachClassName(classname);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Build the various label elements: A \"labelbody\" element \r\n * containing a \"labeltext\" element containing a textnode. \r\n * These extra elements will come in handy for CSS purposes.\r\n */\r\nLabelBinding.prototype.buildLabel = function () {\r\n\r\n\tif (!this.hasLabel) {\r\n\t\tthis.shadowTree.labelText = DOMUtil.createElementNS(\r\n\t\t\tConstants.NS_UI, \"ui:labeltext\", this.bindingDocument\r\n\t\t);\r\n\t\tthis.shadowTree.text = this.bindingDocument.createTextNode(\"\");\r\n\t\tthis.shadowTree.labelText.appendChild(this.shadowTree.text);\r\n\t\tthis.shadowTree.labelBody.appendChild(this.shadowTree.labelText);\r\n\t\tthis.hasLabel = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Builds the CSS classname, taking care to preserve externally applied classnames.\r\n */\r\nLabelBinding.prototype.buildClassName = function () {\r\n\r\n\tvar class1 = \"textonly\";\r\n\tvar class2 = \"imageonly\";\r\n\tvar class3 = \"image-and-text\";\r\n\r\n\tif (this.hasLabel && this.hasImage) {\r\n\t\tthis.detachClassName(class1);\r\n\t\tthis.detachClassName(class2);\r\n\t\tthis.attachClassName(class3);\r\n\t} else if (this.hasLabel) {\r\n\t\tthis.detachClassName(class3);\r\n\t\tthis.detachClassName(class2);\r\n\t\tthis.attachClassName(class1);\r\n\t} else if (this.hasImage) {\r\n\t\tthis.detachClassName(class3);\r\n\t\tthis.detachClassName(class1);\r\n\t\tthis.attachClassName(class2);\r\n\t}\r\n}\r\n\r\n/**\r\n * LabelBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {LabelBinding}\r\n */\r\nLabelBinding.newInstance = function (ownerDocument) {\r\n\r\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:labelbox\", ownerDocument);\r\n\treturn UserInterface.registerBinding(element, LabelBinding);\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/labels/TextBinding.js",
    "content": "TextBinding.prototype = new Binding;\r\nTextBinding.prototype.constructor = TextBinding;\r\nTextBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * Here's a weird binding that will replace itself with a text node!\r\n */\r\nfunction TextBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TextBinding\" );\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ DocumentCrawler.ID, FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTextBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[TextBinding]\";\r\n}\r\n\r\n/**\r\n * Observe how the binding gets disposed and replaced by a simple text node.\r\n * TODO: This is silly, just keep the element and add some text!\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTextBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tTextBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tvar label = this.getProperty ( \"label\" );\r\n\tif ( !label ) {\r\n\t\tlabel = DOMUtil.getTextContent ( this.bindingElement );\r\n\t}\r\n\tvar text = this.bindingDocument.createTextNode ( \r\n\t\tResolver.resolve ( label )\r\n\t);\r\n\tthis.bindingElement.parentNode.replaceChild ( text, this.bindingElement );\r\n\tthis.dispose ();\r\n}\r\n\r\n/**\r\n * You should invoke this method before the binding attaches \r\n * (since attachment will effectively destroy the binding).\r\n */\r\nTextBinding.prototype.setLabel = function ( label ) {\r\n\t\r\n\tthis.setProperty ( \"label\", label );\r\n}\r\n\r\n/**\r\n * TextBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TextBinding}\r\n */\r\nTextBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:text\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, TextBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/localization/LocalizationSelectorBinding.js",
    "content": "LocalizationSelectorBinding.prototype = new MenuBinding;\r\nLocalizationSelectorBinding.prototype.constructor = LocalizationSelectorBinding;\r\nLocalizationSelectorBinding.superclass = MenuBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction LocalizationSelectorBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"LocalizationSelectorBinding\");\r\n\r\n\t/**\r\n\t * @type {EntityToken}\r\n\t */\r\n\tthis._token = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nLocalizationSelectorBinding.prototype.toString = function () {\r\n\r\n\treturn \"[LocalizationSelectorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {SelectorBinding#onBindingAttach}\r\n */\r\nLocalizationSelectorBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tLocalizationSelectorBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.subscribe ( BroadcastMessages.UPDATE_LANGUAGES );\r\n\tthis.subscribe ( BroadcastMessages.TOLANGUAGE_UPDATED );\r\n\tthis._populateFromLanguages(Localization.languages);\r\n\r\n\r\n\tthis.addActionListener(MenuItemBinding.ACTION_COMMAND);\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nLocalizationSelectorBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tLocalizationSelectorBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\t\r\n\t\tcase BroadcastMessages.TOLANGUAGE_UPDATED:\r\n\t\t\tExplorerBinding.restoreFocuseNodes();\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.UPDATE_LANGUAGES :\r\n\t\t\tthis._populateFromLanguages ( arg );\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.SAVE_ALL_DONE :\r\n\t\t\tthis.unsubscribe ( BroadcastMessages.SAVE_ALL_DONE );\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.CLOSE_VIEWS );\r\n\t\t\tthis._invokeAction ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nLocalizationSelectorBinding.prototype.handleAction = function (action) {\r\n\r\n\tLocalizationSelectorBinding.superclass.handleAction.call(this, action);\r\n\r\n\tswitch (action.type) {\r\n\t\tcase MenuItemBinding.ACTION_COMMAND:\r\n\t\t\tthis.onValueChange(action.target.selectionValue);\r\n\t\t\t//action.consume();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n\r\n\r\n/**\r\n * Populate selector. If no argument, then hide the selector.\r\n * @param {List<object>} list A list of objects with the following properties: \r\n * Name\r\n * IsoName\r\n * UrlMappingName\r\n * IsCurrent\r\n * SerializedActionToken         \r\n*/\r\nLocalizationSelectorBinding.prototype._populateFromLanguages = function ( list ) {\r\n\t\r\n\tif ( list != null && list.hasEntries () && list.getLength () > 1 ) {\r\n\t\tvar selections = new List ();\r\n\t\tlist.each ( function ( lang ) {\r\n\t\t\tselections.add ( \r\n\t\t\t\tnew SelectorBindingSelection (\r\n\t\t\t\t\tlang.Name,\r\n\t\t\t\t\tlang.SerializedActionToken,\r\n\t\t\t\t\tlang.IsCurrent,\r\n\t\t\t\t\tnull\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t\t});\r\n\t\tthis.populateFromList ( selections );\r\n\t\t//this.show ();\r\n\t\tthis.bindingElement.style.display = \"block\";\r\n\t} else {\r\n\t\t//this.hide ();\r\n\t\tthis.bindingElement.style.display = \"none\";\r\n\t}\r\n}\r\n\r\n/**\r\n * Backup old value so that we may cancel selector change.\r\n * @overwrites {SelectorBinding#populateFromList}\r\n * @param {List<SelectorBindingSelection>} list\r\n */\r\nLocalizationSelectorBinding.prototype.populateFromList = function ( list ) {\r\n\t\r\n\tif (this.isAttached) {\r\n\r\n\t\t/*\r\n\t\t * Clear existing content, leaving only the default selection.\r\n\t\t */\r\n\t\t//this.clear();\r\n\r\n\t\tvar self = this;\r\n\t\tvar menugroup = this.getDescendantBindingByLocalName(\"menugroup\");\r\n\t\t\r\n\t\tmenugroup.detachRecursive();\r\n\t\tmenugroup.bindingElement.innerHTML = \"\";\r\n\r\n\t\t/*\r\n\t\t * Add new content.\r\n\t\t */\r\n\t\tif (list.hasEntries()) {\r\n\t\t\twhile (list.hasNext()) {\r\n\t\t\t\tvar selection = list.getNext();\r\n\t\t\t\tif (selection.isSelected) {\r\n\t\t\t\t\tthis.setLabel(selection.label);\r\n\t\t\t\t}\r\n\t\t\t\tvar itemBinding = MenuItemBinding.newInstance(this.bindingDocument);\r\n\t\t\t\titemBinding.imageProfile = selection.imageProfile;\r\n\t\t\t\titemBinding.setLabel(selection.label);\r\n\t\t\t\tif (selection.tooltip != null) {\r\n\t\t\t\t\titemBinding.setToolTip(selection.tooltip);\r\n\t\t\t\t}\r\n\t\t\t\titemBinding.selectionValue = selection.value;\r\n\r\n\t\t\t\tmenugroup.add(itemBinding);\r\n\t\t\t\titemBinding.attach();\r\n\r\n\t\t\t}\r\n\t\t} else {\r\n\r\n\t\t}\r\n\t} else {\r\n\r\n\t\tthrow \"Could not populate unattached selector\"; // TODO: Cache the list and wait?\r\n\t}\r\n}\r\n\r\n/**\r\n * @overwrites {SelectorBinding#onValueChange}\r\n */\r\nLocalizationSelectorBinding.prototype.onValueChange = function (token) {\r\n\tExplorerBinding.saveFocusedNodes();\r\n\tvar self = this;\r\n\tDialog.warning ( \r\n\t\tStringBundle.getString ( StringBundle.UI, \"UserElementProvider.ChangeOtherActiveLocaleDialogTitle\" ), \r\n\t\tStringBundle.getString ( StringBundle.UI, \"UserElementProvider.ChangeOtherActiveLocaleDialogText\" ),\r\n\t\tDialog.BUTTONS_ACCEPT_CANCEL, {\r\n\t\thandleDialogResponse : function ( response ) {\r\n\t\t\tswitch ( response ) {\r\n\t\t\t\tcase Dialog.RESPONSE_ACCEPT:\r\n\t\t\t\t\tself._token = token;\r\n\t\t\t\t\tif ( Application.hasDirtyDockTabs ()) {\r\n\t\t\t\t\t\tself.subscribe ( BroadcastMessages.SAVE_ALL_DONE );\r\n\t\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SAVE_ALL );\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.CLOSE_VIEWS );\r\n\t\t\t\t\t\tself._invokeAction ();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Dialog.RESPONSE_CANCEL :\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n}\r\n\r\n/**\r\n * Invoke that action!\r\n */\r\nLocalizationSelectorBinding.prototype._invokeAction = function () {\r\n\t\r\n\tvar root = SystemNode.taggedNodes.get ( \"Root\" );\r\n\tvar action = new SystemAction ({\r\n\t\tLabel : \"Generated Action: Change Locale\",\r\n\t\tActionToken : this._token\r\n\t});\r\n\t\r\n\tSystemAction.invoke ( action, root );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/localstore/LocalStoreBinding.js",
    "content": "LocalStoreBinding.prototype = new Binding;\r\nLocalStoreBinding.prototype.constructor = LocalStoreBinding;\r\nLocalStoreBinding.superclass = Binding.prototype;\r\n\r\nLocalStoreBinding.STORE_PERSISTANCE = \"localstorepersistance\";\r\n\r\n/**\r\n * Get local store.\r\n * @param id\r\n * @return {DOMDocument}\r\n */\r\nLocalStoreBinding.getLocalStore = function ( id ) {\r\n\t\r\n\t\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction LocalStoreBinding () {\r\n\t\r\n\t/*\r\n\t * Global pointer.\r\n\t */\r\n\tLocalStore._bindingInstance = this;\r\n\t\r\n\t/*\r\n\t * Returnable \r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding\r\n * @return {string}\r\n */\r\nLocalStoreBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[LocalStoreBinding]\";\r\n}\r\n\r\n/**\r\n * @param {string} id\r\n */\r\nLocalStoreBinding.prototype.getLocalStore = function ( id ) {\r\n\t\r\n}\r\n\r\n\r\nLocalStoreBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tLocalStoreBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tif ( Client.isExplorer == true ) {\r\n\t\t\r\n\t\t/*\r\n\t\tthis.bindingElement.setAttribute ( \"fisse\", \"hej\" );\r\n\t\tthis.bindingElement.save ( \"test\" );\r\n\t\tthis.bindingElement.removeAttribute ( \"fisse\" );\r\n\t\t*/\r\n\t\t\r\n\t\tthis.bindingElement.load ( \"persistance\" );\r\n\t\t\r\n\t\tvar doc = this.bindingElement.XMLDocument;\r\n\t\t\r\n\t\t/*\r\n\t\tvar el = doc.createElement ( \"FISTER\" );\r\n\t\tdoc.replaceChild ( el, doc.documentElement );\r\n\t\t*/\r\n\t\t\r\n\t\talert ( DOMSerializer.serialize ( doc, true ));\r\n\t\t\r\n\t\t// this.bindingElement.save ( \"persistance\" );\r\n\t\t\r\n\t\t/*\r\n\t\tvar doc = this.bindingElement.XMLDocument;\r\n\t\tdoc.documentElement.removeChild ( doc.documentElement.firstChild );\r\n\t\talert ( DOMSerializer.serialize ( doc, true ));\r\n\t\t\r\n\t\tif ( !doc.documentElement.hasChildNodes ()) {\r\n\t\t\tdoc.documentElement.appendChild ( doc.createElement ( \"Fisse\" ));\r\n\t\t\tthis.bindingElement.save ( \"Fisterloegsovs\" );\r\n\t\t}\r\n\t\t*/\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tvar host = document.location.host;\r\n\t\tvar storage = window.globalStorage;\r\n\t\t// var doc = Templates.getTemplateDocument ( \"soapenvelope.xml\" );\r\n\t\t//alert ( DOMSerializer.serialize ( doc, true ));\r\n\t\t/*\r\n\t\ttry {\r\n\t\t\tstorage [ host ].TEST = doc;\r\n\t\t} catch ( e ) {\r\n\t\t\talert ( e );\r\n\t\t}\r\n\t\t*/\r\n\t\t//alert ( storage [ host ].TEST );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/localstore/LocalStoreWindowBinding.js",
    "content": "LocalStoreWindowBinding.prototype= new WindowBinding;\r\nLocalStoreWindowBinding.prototype.constructor = LocalStoreWindowBinding;\r\nLocalStoreWindowBinding.superclass = WindowBinding.prototype;\r\nLocalStoreWindowBinding.URL = \"${root}/content/misc/localstore/localstore.aspx\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction LocalStoreWindowBinding () {\r\n\t\r\n\t/**\r\n\t * @overloads {FlexBoxBinding#isFlexible}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFlexible = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n * @return {string}\r\n */\r\nLocalStoreWindowBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[LocalStoreWindowBinding]\";\r\n}\r\n\r\n/**\r\n * Load the localstore only if client has the correct Flash version installed.\r\n * @overloads {WindowBinding#onBindingRegister}\r\n */\r\nLocalStoreWindowBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tLocalStoreWindowBinding.superclass.onBindingRegister.call ( this );\r\n\tif ( Client.hasFlash ) {\r\n\t\tthis.setURL ( LocalStoreWindowBinding.URL );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/menus/MenuBarBinding.js",
    "content": "MenuBarBinding.prototype = new MenuContainerBinding;\r\nMenuBarBinding.prototype.constructor = MenuBarBinding;\r\nMenuBarBinding.superclass = MenuContainerBinding.prototype;\r\n\r\nfunction MenuBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MenuBarBinding\" );\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMenuBarBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[MenuBarBinding]\";\r\n}\r\n\r\n/**\r\n * Attach classname to clear stylesheet floats.\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nMenuBarBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tMenuBarBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.addActionListener ( MenuBodyBinding.ACTION_UNHANDLED_LEFTRIGHTKEY );\r\n\tthis.attachClassName ( Binding.CLASSNAME_CLEARFLOAT );\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nMenuBarBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tMenuBarBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase MenuBodyBinding.ACTION_UNHANDLED_LEFTRIGHTKEY :\r\n\t\t\t\r\n\t\t\tvar menuBody = action.target;\r\n\t\t\t\r\n\t\t\tvar menus = this.getChildBindingsByLocalName ( \"menu\" );\r\n\t\t\twhile ( menus.hasNext ()) {\r\n\t\t\t\tvar menu = menus.getNext ();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tswitch ( menuBody.arrowKey ) {\r\n\t\t\t\tcase KeyEventCodes.VK_LEFT :\r\n\t\t\t\t\tthis.logger.debug ( \"LEFTG\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase KeyEventCodes.VK_RIGHT :\r\n\t\t\t\t\tthis.logger.debug ( \"RIGHT\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/menus/MenuBinding.js",
    "content": "MenuBinding.prototype = new MenuContainerBinding;\r\nMenuBinding.prototype.constructor = MenuBinding;\r\nMenuBinding.superclass = MenuContainerBinding.prototype;\r\n\r\nfunction MenuBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MenuBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {LabelBinding}\r\n\t */\r\n\tthis.labelBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMenuBinding.prototype.toString = function () {\r\n\r\n\treturn \"[MenuBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nMenuBinding.prototype.onBindingAttach = function () {\r\n\r\n\tMenuBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.buildDOMContent ();\r\n\tthis.assignDOMEvents ();\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nMenuBinding.prototype.buildDOMContent = function () {\r\n\r\n\tvar image \t\t= this.getProperty ( \"image\" );\r\n\tvar label \t\t= this.getProperty ( \"label\" );\r\n\tvar tooltip \t= this.getProperty ( \"tooltip\" );\r\n\r\n\tthis.labelBinding = LabelBinding.newInstance ( this.bindingDocument );\r\n\tthis.labelBinding.attachClassName ( \"menulabel\" );\r\n\tthis.add ( this.labelBinding );\r\n\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\tif ( image ) {\r\n\t\tthis.setImage ( image );\r\n\t}\r\n\tif ( tooltip ) {\r\n\t\tthis.setToolTip ( tooltip );\r\n\t}\r\n}\r\n\r\n/**\r\n * Reset visual appearance when menus are closed. \r\n */\r\nMenuBinding.prototype.reset = function () {\r\n\t\r\n\tthis.detachClassName ( \"hover\" );\r\n}\r\n\r\n/**\r\n * Set image.\r\n * @param {string} url\r\n */\r\nMenuBinding.prototype.setImage = function ( url ) {\r\n\r\n\tthis.setProperty ( \"image\", url );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setImage ( \r\n\t\t\turl\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nMenuBinding.prototype.setLabel = function ( label ) {\r\n\r\n\tthis.setProperty ( \"label\", label );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setLabel ( \r\n\t\t\tResolver.resolve ( label )\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Set tooltip.\r\n * @param {string} tooltip\r\n */\r\nMenuBinding.prototype.setToolTip = function ( tooltip ) {\r\n\r\n\tthis.setProperty ( \"tooltip\", tooltip );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setToolTip ( \r\n\t\t\tResolver.resolve ( tooltip )\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Get image.\r\n * @return {string}\r\n */\r\nMenuBinding.prototype.getImage = function () {\r\n\r\n\treturn this.getProperty ( \"image\" );\r\n}\r\n\r\n/**\r\n * Get label.\r\n * @return {string}\r\n */\r\nMenuBinding.prototype.getLabel = function () {\r\n\r\n\treturn this.getProperty ( \"label\" );\r\n}\r\n\r\n\r\n/**\r\n * Get tooltip.\r\n * @return {string}\r\n */\r\nMenuBinding.prototype.getToolTip = function () {\r\n\r\n\treturn this.getProperty ( \"tooltip\" );\r\n}\r\n\r\n/**\r\n * Assigning DOM events.\r\n */\r\nMenuBinding.prototype.assignDOMEvents = function () {\r\n\t\r\n\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n\tthis.addEventListener ( DOMEvents.MOUSEOVER );\r\n\tthis.addEventListener ( DOMEvents.MOUSEOUT );\r\n\tthis.addEventListener ( DOMEvents.MOUSEUP );\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nMenuBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tMenuBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tvar container = this.getMenuContainerBinding ();\r\n\t\r\n\tif ( !BindingDragger.isDragging ) {\r\n\t\r\n\t\tswitch ( e.type ) {\r\n\t\t\t\r\n\t\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\t\tif ( container.isOpen ( this )) {\r\n\t\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\t\tif ( container.isOpen () && !container.isOpen ( this )) {\r\n\t\t\t\t\tthis.show ();\r\n\t\t\t\t\tthis.menuPopupBinding.grabKeyboard ();\r\n\t\t\t\t}\r\n\t\t\t\tthis.attachClassName ( \"hover\" );\r\n\t\t\t\tthis.isFocused = true;\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\t\tif ( !container.isOpen ()) {\r\n\t\t\t\t\tthis.hide ();\r\n\t\t\t\t}\r\n\t\t\t\tthis.isFocused = false;\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase DOMEvents.MOUSEUP :\r\n\t\t\t\tif ( !container.isOpen ( this )) {\r\n\t\t\t\t\tthis.show ();\r\n\t\t\t\t\tthis.menuPopupBinding.grabKeyboard ();\r\n\t\t\t\t}\r\n\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * Consuming the event!\r\n\t */\r\n\tDOMEvents.stopPropagation ( e );\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/menus/MenuBodyBinding.js",
    "content": "MenuBodyBinding.prototype = new Binding;\r\nMenuBodyBinding.prototype.constructor = MenuBodyBinding;\r\nMenuBodyBinding.superclass = Binding.prototype;\r\n\r\nMenuBodyBinding.CLASSNAME_CHECKBOXED = \"checkboxed\";\r\n\r\n/*\r\n * In case an arrowkeypress could not be handled responsibly, \r\n * we can dispatch this and hope that an ancestor binding can.\r\n */\r\nMenuBodyBinding.ACTION_UNHANDLED_LEFTRIGHTKEY = \"menubody unhandled arrowkey\";\r\n\r\n/**\r\n * Points to the currently active MenuBodyBinding instance. \r\n * Remember to reset this when the menupopup is closed.\r\n * @type {MenuBodyBinding}\r\n */\r\nMenuBodyBinding.activeInstance = null;\r\n\r\n/**\r\n * Relay arrowkeypress to the currently active instance.\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nMenuBodyBinding.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tvar body = MenuBodyBinding.activeInstance;\r\n\tvar key = arg;\r\n\t\r\n\tif ( body ) {\r\n\t\tswitch ( broadcast ) {\r\n\t\t\tcase BroadcastMessages.KEY_ARROW :\r\n\t\t\t\tbody.handleArrowKey ( key );\r\n\t\t\t\tbreak;\r\n\t\t\tcase BroadcastMessages.KEY_ENTER :\r\n\t\t\t\tbody.handleEnterKey ();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*\r\n * To avoid filing and unregistering an excessive amount of \r\n * EventBroadcaster subscriptions whenever a menu is opened \r\n * and closed, all keybaord menu handling is handled thusly.\r\n */\r\nEventBroadcaster.subscribe ( BroadcastMessages.KEY_ARROW, MenuBodyBinding );\r\nEventBroadcaster.subscribe ( BroadcastMessages.KEY_ENTER, MenuBodyBinding );\r\nEventBroadcaster.subscribe ( BroadcastMessages.KEY_ESCAPE, MenuBodyBinding );\r\n\r\n/**\r\n * @class\r\n */\r\nfunction MenuBodyBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MenuBodyBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {PopupBinding}\r\n\t */\r\n\tthis._containingPopupBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><MenuItemBinding>}\r\n\t */\r\n\tthis._focused = null;\r\n\t\r\n\t/**\r\n\t * @type {MenuItemBinding}\r\n\t */\r\n\tthis._lastFocused = null;\r\n\t\r\n\t/**\r\n\t * @type {function}\r\n\t */\r\n\tthis._showSubMenuTimeout = null;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.arrowKey = null;\r\n\t\r\n\t/*\r\n\t * If set to true, menuitems will be indexed anew.\r\n\t * Use when menuitems are dynamically added or removed.\r\n\t * @see {MenuItemBinding#onBindingAttach}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasImageLayout = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasCheckBoxLayout = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMenuBodyBinding.prototype.toString = function () {\r\n\r\n\treturn \"[MenuBodyBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nMenuBodyBinding.prototype.onBindingAttach = function () {\r\n\r\n\tMenuBodyBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\t/** \r\n\t * Show no images (until an image shows up).\r\n\t *\r\n\tthis.attachClassName ( ToolBarBinding.CLASSNAME_TEXTONLY );\r\n\t*/\r\n\t\r\n\t/*\r\n\t * Initialize focused registry.\r\n\t */\r\n\tthis._focused = {};\r\n\t\r\n\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n\tthis.addEventListener ( DOMEvents.MOUSEOVER );\r\n\tthis.addEventListener ( DOMEvents.MOUSEOUT );\r\n\tthis.addEventListener ( DOMEvents.MOUSEUP );\r\n\tthis.addEventListener ( DOMEvents.KEYDOWN );\r\n\tthis.addEventListener ( DOMEvents.TOUCHSTART );\r\n\t\r\n\t/*\r\n\t * Grab keyboard when left-right arrow key was \r\n\t * pressed in descendant menubody with no effect.\r\n\t */\r\n\tvar self = this;\r\n\tthis.addActionListener ( MenuBodyBinding.ACTION_UNHANDLED_LEFTRIGHTKEY, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tswitch ( action.target ) {\r\n\t\t\t\tcase self :\r\n\t\t\t\t\tself.releaseKeyboard ();\r\n\t\t\t\t\tself._containingPopupBinding.hide ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tvar mouseevent = null;\r\n\t\t\t\t\tvar isPreventFocus = true;\r\n\t\t\t\t\tself._lastFocused.focus ();\r\n\t\t\t\t\tself.grabKeyboard ();\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\t\r\n\t/*\r\n\t * Reset focus and release keyboard when popup is closed.\r\n\t */\r\n\tthis._containingPopupBinding = UserInterface.getBinding ( \r\n\t\tthis.bindingElement.parentNode\r\n\t);\r\n\tthis._containingPopupBinding.addActionListener ( \r\n\t\tPopupBinding.ACTION_HIDE, {\r\n\t\t\thandleAction : function () {\r\n\t\t\t\tself.resetFocusedItems ( true );\r\n\t\t\t\tself.releaseKeyboard ();\r\n\t\t\t}\r\n\t\t}\r\n\t)\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nMenuBodyBinding.prototype.onBindingDispose = function () {\r\n\r\n\tMenuBodyBinding.superclass.onBindingDispose.call ( this );\r\n\tif ( MenuBodyBinding.activeInstance == this ) {\r\n\t\tMenuBodyBinding.activeInstance = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * When keyboardgrab is assigned, consuming the mouseover event \r\n * will make sure that container binding doesn't grab our keyboard. \r\n * The other mouseevents get consumed simply because we can.\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nMenuBodyBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tMenuBodyBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tif ( e.type == DOMEvents.MOUSEOUT ) {\r\n\t\tthis.resetFocusedItems ();\r\n\t}\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\tcase DOMEvents.MOUSEOVER :\r\n\t\tcase DOMEvents.MOUSEOUT :\r\n\t\tcase DOMEvents.MOUSEUP:\r\n\t\tcase DOMEvents.TOUCHSTART:\r\n\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.KEYDOWN:\r\n\t\t\tswitch (e.keyCode) {\r\n\t\t\t\tcase KeyEventCodes.VK_DOWN:\r\n\t\t\t\tcase KeyEventCodes.VK_UP:\r\n\t\t\t\tcase KeyEventCodes.VK_LEFT:\r\n\t\t\t\tcase KeyEventCodes.VK_RIGHT:\r\n\t\t\t\t\tDOMEvents.stopPropagation(e);\r\n\t\t\t\t\tDOMEvents.preventDefault(e);\r\n\t\t\t\t\tthis.handleArrowKey(e.keyCode);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/** \r\n * Handle focused item. This would normally be done with \r\n * dispatching and catching Actions, but we consider \r\n * superfast screen update to be of maximum importance. \r\n * @see {MenuItemBinding#focus}\r\n * @param {MenuItemBinding} binding\r\n */\r\nMenuBodyBinding.prototype.handleFocusedItem = function ( binding ) {\r\n\t\r\n\tfor ( var key in this._focused ) {\r\n\t\tif ( key != binding.key ) {\r\n\t\t\tvar item = this._focused [ key ];\r\n\t\t\titem.blur ();\r\n\t\t}\r\n\t}\r\n\tthis._focused [ binding.key ] = binding;\r\n\tthis._lastFocused = binding;\r\n\r\n\t/*\r\n\t * Grab that keyboard.\r\n\t */\r\n\tif ( MenuBodyBinding.activeInstance != this ) {\r\n\t\tthis.grabKeyboard ();\r\n\t}\r\n} \r\n\r\n/** \r\n * Handle blurred item.\r\n * @see {MenuItemBinding#blur}\r\n * @param {MenuItemBinding} binding\r\n */\r\nMenuBodyBinding.prototype.handleBlurredItem = function ( binding ) {\r\n\t\r\n\tdelete this._focused [ binding.key ];\r\n}\r\n\r\n/**\r\n * Reset focused items.\r\n * @param {boolean} isTotalReset\r\n */\r\nMenuBodyBinding.prototype.resetFocusedItems = function ( isTotalReset ) {\r\n\t\r\n\tfor ( var key in this._focused ) {\r\n\t\tvar item = this._focused [ key ];\r\n\t\titem.blur ( isTotalReset );\r\n\t}\r\n\tif ( isTotalReset ) {\r\n\t\tthis._lastFocused = null;\r\n\t}\r\n}\r\n\r\n/** \r\n * Refresh the visual appearance of MenuGroupBindings, hiding the separators on \r\n * first and last menugroup. This because Explorer won't reckognize first-child \r\n * and last-child CSS pseudoselectors in quirksmode.\r\n */\r\nMenuBodyBinding.prototype.refreshMenuGroups = function () {\r\n\t\r\n\tif ( !this.isAttached ) { \r\n\t\r\n\t\tthrow \"refreshMenuGroups: MenuBodyBinding not attached!\";\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tvar groups = this.getChildBindingsByLocalName ( \"menugroup\" );\r\n\t\tvar firstGroup = null;\r\n\t\tvar lastGroup = null;\r\n\t\r\n\t\twhile ( groups.hasNext ()) {\r\n\t\t\tvar group = groups.getNext ();\r\n\t\t\tif ( !group.isDefaultContent ) {\r\n\t\t\t\tgroup.setLayout ( MenuGroupBinding.LAYOUT_DEFAULT );\r\n\t\t\t\tif ( !firstGroup && group.isVisible ) {\r\n\t\t\t\t\tfirstGroup = group;\r\n\t\t\t\t}\r\n\t\t\t\tif ( group.isVisible ) {\r\n\t\t\t\t\tlastGroup = group;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tif ( firstGroup && lastGroup ) {\r\n\t\t\tfirstGroup.setLayout ( MenuGroupBinding.LAYOUT_FIRST );\r\n\t\t\tlastGroup.setLayout ( MenuGroupBinding.LAYOUT_LAST );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Grab keyboard control. This method is invoked often, so be careful when editing.\r\n * @param {boolean} isDefaultAction\r\n */\r\nMenuBodyBinding.prototype.grabKeyboard = function ( isDefaultAction ) {\r\n\t\r\n\tMenuBodyBinding.activeInstance = this;\r\n\t\r\n\tif ( isDefaultAction ) {\r\n\t\tvar first = this._getMenuItems ().getFirst ();\r\n\t\tif ( first ) {\r\n\t\t\tfirst.focus ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Release keyboard control.  This method is invoked \r\n * by the containing {@link PopupBinding}.\r\n */\r\nMenuBodyBinding.prototype.releaseKeyboard = function () {\r\n\t\r\n\tif ( MenuBodyBinding.activeInstance == this ) {\r\n\t\tMenuBodyBinding.activeInstance = null;\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle enter key pressed. This will fire the command \r\n * associated to any focused MenuItemBinding.\r\n */\r\nMenuBodyBinding.prototype.handleEnterKey = function () {\r\n\r\n\tvar focused = this._lastFocused;\r\n\r\n\tif (( focused != null ) && (!focused.isMenuContainer )) {\r\n\t\r\n\t\tfocused.fireCommand ();\r\n\t\t\r\n\t\t/*\r\n\t\t * Technically not a mouse event, but  \r\n\t\t * we do wan't to close all open popups.\r\n\t\t */\r\n\t\tEventBroadcaster.broadcast ( \r\n\t\t\tBroadcastMessages.MOUSEEVENT_MOUSEDOWN \r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle escape key. This should close all open popups.\r\n *\r\nMenuBodyBinding.prototype.handleEscapeKey = function () {\r\n\t\r\n\talert ( \"ESCAPE NOW!\" );\r\n}\r\n*/\r\n\r\n/*\r\n * Compute next focus when the arrowkey is pressed.\r\n * TODO: handle menupopups that opened on the \r\n * wrong side because of missing screen estate!\r\n * @param {int} key\r\n */\r\nMenuBodyBinding.prototype.handleArrowKey = function ( key ) {\r\n\r\n\t/*\r\n\t * Store key so that others can know what was pressed.\r\n\t * @see {MenuBarBinding#handleAction}\r\n\t */\r\n\tthis.arrowKey = key;\r\n\r\n\tvar items \t= this._getMenuItems ();\r\n\tvar current\t= null;\r\n\tvar next \t= null;\r\n\t\r\n\tif ( this._lastFocused ) {\r\n\t\r\n\t\tcurrent = this._lastFocused\r\n\t\t\r\n\t\tswitch ( key ) {\r\n\t\t\tcase KeyEventCodes.VK_UP :\r\n\t\t\t\tnext = items.getPreceding ( current );\r\n\t\t\t\tbreak;\r\n\t\t\tcase KeyEventCodes.VK_DOWN :\r\n\t\t\t\tnext = items.getFollowing ( current );\r\n\t\t\t\tbreak;\r\n\t\t\tcase KeyEventCodes.VK_LEFT :\r\n\t\t\t\tthis.dispatchAction ( MenuBodyBinding.ACTION_UNHANDLED_LEFTRIGHTKEY );\r\n\t\t\t\tbreak;\r\n\t\t\tcase KeyEventCodes.VK_RIGHT :\r\n\t\t\t\tif ( this._lastFocused.isMenuContainer ) {\r\n\t\t\t\t\tthis.releaseKeyboard ();\r\n\t\t\t\t\tthis._lastFocused.show ();\r\n\t\t\t\t\tthis._lastFocused.menuPopupBinding.grabKeyboard ( true );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.dispatchAction ( MenuBodyBinding.ACTION_UNHANDLED_LEFTRIGHTKEY );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t} else {\r\n\t\tnext = items.getFirst ();\r\n\t}\r\n\tif ( next ) {\r\n\t\tnext.focus ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Carefully locate menuitems relevant for this menubody only.\r\n * A dirtyflag system compensates for added and removed items.\r\n * @return {List<MenuItemBinding>}\r\n */\r\nMenuBodyBinding.prototype._getMenuItems = function () {\r\n\t\r\n\tif ( !this._menuItemsList || this.isDirty ) {\r\n\t\tvar list = new List ();\r\n\t\tvar items = null;\r\n\t\tthis.getChildBindingsByLocalName ( \"menugroup\" ).each ( function ( group ) {\r\n\t\t\titems = group.getChildBindingsByLocalName ( \"menuitem\" );\r\n\t\t\titems.each ( function ( item ) {\r\n\t\t\t\tlist.add ( item );\r\n\t\t\t});\r\n\t\t});\r\n\t\titems = this.getChildBindingsByLocalName ( \"menuitem\" );\r\n\t\titems.each ( function ( item ) {\r\n\t\t\tlist.add ( item );\r\n\t\t});\r\n\t\tthis._menuItemsList = list;\r\n\t\tthis.isDirty = false;\r\n\t}\r\n\treturn this._menuItemsList;\r\n}\r\n\r\n/**\r\n * Make room for checkbox column. Called by descendant {@link MenuItemBinding}.\r\n */\r\nMenuBodyBinding.prototype.invokeCheckBoxLayout = function () {\r\n\t\r\n\tif ( !this.hasClassName ( MenuBodyBinding.CLASSNAME_CHECKBOXED )) {\r\n\t\tthis.attachClassName ( MenuBodyBinding.CLASSNAME_CHECKBOXED );\r\n\t}\r\n}\r\n\r\n/**\r\n * Make room for checkbox column. Called by descendant {@link MenuItemBinding}.\r\n * TODO: disable again at some point?\r\n */\r\nMenuBodyBinding.prototype.invokeImageLayout = function () {\r\n\t\r\n\tif ( !this._hasImageLayout ) {\r\n\t\tthis.detachClassName ( ToolBarBinding.CLASSNAME_TEXTONLY ); \r\n\t\tthis._hasImageLayout = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * MenuBodyBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {MenuBodyBinding}\r\n */\r\nMenuBodyBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:menubody\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, MenuBodyBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/menus/MenuContainerBinding.js",
    "content": "MenuContainerBinding.prototype = new Binding;\r\nMenuContainerBinding.prototype.constructor = MenuContainerBinding;\r\nMenuContainerBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @implements {IMenuContainer}\r\n */\r\nfunction MenuContainerBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MenuContainerBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t * @private\r\n\t */\r\n\tthis._isOpen = false;\r\n\t\r\n\t/**\r\n\t * @type {MenuBinding} \r\n\t * @private\r\n\t */\r\n\tthis._openElement = null;\r\n\t\r\n\t/**\r\n\t * @type {MenuContainerBinding}\r\n\t * @private\r\n\t */\r\n\tthis.menuContainerBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {MenuPopupBinding}\r\n\t * @private\r\n\t */\r\n\tthis.menuPopupBinding = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMenuContainerBinding.prototype.toString = function () {\r\n\r\n\treturn \"[MenuContainerBinding]\";\r\n}\r\n\r\n/**\r\n * Is open?\r\n * @param {Binding} object TODO: update documentation around here!\r\n * @return {boolean}\r\n */\r\nMenuContainerBinding.prototype.isOpen = function ( object ) {\r\n\r\n\tvar result = null;\r\n\tif ( !object ) {\r\n\t\tresult = this._isOpen;\r\n\t} else {\r\n\t\tresult = ( object == this._openElement );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {Binding} binding Ehm, this could actually also be a boolean value of false...\r\n */\r\nMenuContainerBinding.prototype.setOpenElement = function ( binding ) {\r\n\t\r\n\tif ( binding ) {\r\n\t\tif ( this._openElement ) {\r\n\t\t\tthis._openElement.hide ();\r\n\t\t}\r\n\t\tthis._openElement = binding;\r\n\t\tthis._isOpen = true;\r\n\t} else {\r\n\t\tthis._openElement = null;\r\n\t\tthis._isOpen = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Locating ancestor MenuContainerBinding.\r\n * @return {MenuContainerBinding}\r\n */\r\nMenuContainerBinding.prototype.getMenuContainerBinding = function () {\r\n\t\r\n\tif ( !this.menuContainerBinding ) {\r\n\t\tthis.menuContainerBinding = this.getAncestorBindingByType ( MenuContainerBinding );\r\n\t}\r\n\treturn this.menuContainerBinding;\r\n}\r\n\r\n/**\r\n * Locating child MenuPopupBinding. Code allows for the menupopup to be replaced runtime.\r\n * @return {MenuPopupBinding}\r\n */\r\nMenuContainerBinding.prototype.getMenuPopupBinding = function () {\r\n\t\r\n\tvar menuPopup = this.getChildBindingByLocalName ( \"menupopup\" );\r\n\tif ( menuPopup && menuPopup != this.menuPopupBinding ) {\r\n\t\tthis.menuPopupBinding = menuPopup;\r\n\t\tthis.menuPopupBinding.addActionListener ( PopupBinding.ACTION_HIDE, this );\r\n\t}\r\n\treturn this.menuPopupBinding;\r\n}\r\n\r\n/**\r\n * Show.\r\n * @overwrites {Binding#show}\r\n */\r\nMenuContainerBinding.prototype.show = function () {\r\n\t\r\n\tvar container = this.getMenuContainerBinding ();\r\n\tcontainer.setOpenElement ( this );\r\n\t\r\n\tvar popup = this.getMenuPopupBinding ();\r\n\tpopup.snapTo ( this.bindingElement );\r\n\tpopup.show ();\r\n}\r\n\r\n/**\r\n * Hide.\r\n * @overwrites {Binding#hide}\r\n */\r\nMenuContainerBinding.prototype.hide = function () {\r\n\t\r\n\tthis.reset ();\r\n\tthis.getMenuPopupBinding ().hide ();\r\n\tif ( this._isOpen ) {\r\n\t\tthis._openElement.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Reset visual appearance when menus are closed. Subclasses should define this method.\r\n */\r\nMenuContainerBinding.prototype.reset = Binding.ABSTRACT_METHOD;\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nMenuContainerBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tMenuContainerBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tif ( action.type == PopupBinding.ACTION_HIDE ) {\r\n\t\tvar container = this.getMenuContainerBinding ();\r\n\t\tcontainer.setOpenElement ( false );\r\n\t\tthis.reset ();\r\n\t\taction.consume ();\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/menus/MenuGroupBinding.js",
    "content": "MenuGroupBinding.prototype = new Binding;\r\nMenuGroupBinding.prototype.constructor = MenuGroupBinding;\r\nMenuGroupBinding.superclass = Binding.prototype;\r\n\r\nMenuGroupBinding.LAYOUT_DEFAULT = 0;\r\nMenuGroupBinding.LAYOUT_FIRST = 1;\r\nMenuGroupBinding.LAYOUT_LAST = 2;\r\n\r\nfunction MenuGroupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MenuGroupBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = true;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMenuGroupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[MenuGroupBinding]\";\r\n}\r\n\r\n/**\r\n * Set layout. This method is invoked by the {@link ToolBarBodyBinding}.\r\n * @param {int} layout\r\n */\r\nMenuGroupBinding.prototype.setLayout = function ( layout ) {\r\n\r\n\tswitch ( layout ) {\r\n\t\tcase MenuGroupBinding.LAYOUT_DEFAULT :\r\n\t\t\tthis.detachClassName ( \"first\" );\r\n\t\t\tthis.detachClassName ( \"last\" );\r\n\t\t\tbreak;\r\n\t\tcase MenuGroupBinding.LAYOUT_FIRST :\r\n\t\t\tthis.attachClassName ( \"first\" );\r\n\t\t\tbreak;\t\r\n\t\tcase MenuGroupBinding.LAYOUT_LAST :\r\n\t\t\tthis.attachClassName ( \"last\" );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Show group. The unnescessary visibility adjustment is nescessary for explorer.\r\n * @overwrites {Binding#show}\r\n */\r\nMenuGroupBinding.prototype.show = function () {\r\n\t\r\n\tif ( !this.isVisible ) {\r\n\t\tthis.bindingElement.style.display = \"block\";\r\n\t\tthis.bindingElement.style.visibility = \"visible\";\r\n\t\tthis.isVisible = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide group.\r\n * @overwrites {Binding#hide}\r\n */\r\nMenuGroupBinding.prototype.hide = function () {\r\n\t\r\n\tif ( this.isVisible ) {\r\n\t\tthis.bindingElement.style.display = \"none\";\r\n\t\tthis.bindingElement.style.visibility = \"hidden\";\r\n\t\tthis.isVisible = false;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n* Empty content (of body).\r\n*/\r\nMenuGroupBinding.prototype.empty = function () {\r\n\r\n\tthis.detachRecursive();\r\n\tthis.bindingElement.innerHTML = \"\";\r\n}\r\n\r\n/**\r\n * MenuGroupBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {MenuGroupBinding}\r\n */\r\nMenuGroupBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:menugroup\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, MenuGroupBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/menus/MenuItemBinding.js",
    "content": "MenuItemBinding.prototype = new MenuContainerBinding;\r\nMenuItemBinding.prototype.constructor = MenuItemBinding;\r\nMenuItemBinding.superclass = MenuContainerBinding.prototype;\r\n\r\nMenuItemBinding.ACTION_COMMAND\t\t= \"menuitemcommand\";\r\nMenuItemBinding.TYPE_CHECKBOX \t\t= \"checkbox\";\r\nMenuItemBinding.TYPE_MENUCONTAINER \t= \"menucontainer\";\r\nMenuItemBinding.CLASSNAME_CHECKBOX \t= \"checkboxindicator\";\r\nMenuItemBinding.CLASSNAME_HOVER \t= \"hover\";\r\nMenuItemBinding.CHAR_CHECKBOX \t\t= \"V\";\r\nMenuItemBinding.TIMEOUT\t\t\t\t= 150;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction MenuItemBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MenuItemBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = null;\r\n\r\n\t/**\r\n\t * User can implement this.\r\n\t * @type {function}\r\n\t */\r\n\tthis.oncommand = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisabled = false;\r\n\r\n\t/**\r\n\t * @type {LabelBinding}\r\n\t */\r\n\tthis.labelBinding = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageHover = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageActive = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageDisabled = null;\r\n\r\n\t/**setDisabled\r\n\t */\r\n\tthis.imageProfile = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMenuContainer = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasAction = true;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isTypeSet = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isChecked = false;\r\n\r\n\t/**\r\n\t * Flipped by either mouse or keyboard navigation.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\r\n\t/**\r\n\t * The containing menubody handles blur whenever a new item is focused.\r\n\t * This is done by direct method invokation because of maxed performance.\r\n\t * @type {MenuBodyBinding}\r\n\t */\r\n\tthis._containingMenuBodyBinding = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMenuItemBinding.prototype.toString = function () {\r\n\r\n\treturn \"[MenuItemBinding]\";\r\n}\r\n\r\n/**\r\n * Hookup broadcaster mapping and set type.\r\n */\r\nMenuItemBinding.prototype.onBindingRegister = function () {\r\n\r\n\tMenuItemBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.propertyMethodMap [ \"isdisabled\" ] = this.setDisabled;\r\n\tif ( this.type ) {\r\n\t\tthis.setProperty ( \"type\", this.type );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nMenuItemBinding.prototype.onBindingAttach = function () {\r\n\r\n\tMenuItemBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\t/*\r\n\t * Locate menubody and set a dirty flag. This\r\n\t * will force menubody to reindex menuitems.\r\n\t */\r\n\tthis._containingMenuBodyBinding = this.getAncestorBindingByLocalName ( \"menubody\" );\r\n\tthis._containingMenuBodyBinding.isDirty = true;\r\n\r\n\t/*\r\n\t * Build.\r\n\t */\r\n\tthis.parseDOMProperties ();\r\n\tthis.buildDOMContent ();\r\n\tthis.assignDOMEvents ();\r\n\r\n\t/**\r\n\t * Intercepted by PopupBinding in order to control overflow.\r\n\t */\r\n\tthis.dispatchAction ( Binding.ACTION_ATTACHED );\r\n\r\n}\r\n\r\n\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nMenuItemBinding.prototype.parseDOMProperties = function () {\r\n\r\n\tvar image = this.getProperty ( \"image\" );\r\n\tvar imageHover = this.getProperty ( \"image-hover\" );\r\n\tvar imageActive = this.getProperty ( \"image-active\" );\r\n\tvar imageDisabled = this.getProperty ( \"image-disabled\" );\r\n\r\n\tif ( !this.image && image ) {\r\n\t\tthis.image = image;\r\n\t}\r\n\tif ( !this.imageHover && imageHover ) {\r\n\t\tthis.imageHover = image;\r\n\t}\r\n\tif ( !this.imageActive && imageActive ) {\r\n\t\tthis.imageActive = imageActive;\r\n\t}\r\n\tif ( !this.imageDisabled && imageDisabled ) {\r\n\t\tthis.imageDisabled = imageDisabled;\r\n\t}\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nMenuItemBinding.prototype.buildDOMContent = function () {\r\n\r\n\tvar label \t\t\t= this.getProperty ( \"label\" );\r\n\tvar tooltip \t\t= this.getProperty ( \"tooltip\" );\r\n\tvar type \t\t\t= this.getProperty ( \"type\" );\r\n\tvar disabled \t\t= this.getProperty ( \"isdisabled\" );\r\n\tvar image \t\t\t= this.getProperty ( \"image\" );\r\n\tvar imageHover \t\t= this.getProperty ( \"image-hover\" );\r\n\tvar imageActive \t= this.getProperty ( \"image-active\" );\r\n\tvar imageDisabled = this.getProperty(\"image-disabled\");\r\n\tvar hasAction = this.getProperty(\"hasaction\");\r\n\r\n\tthis.labelBinding = LabelBinding.newInstance ( this.bindingDocument );\r\n\tthis.labelBinding.attachClassName ( \"menuitemlabel\" );\r\n\tthis.add ( this.labelBinding );\r\n\r\n\t// assign menupopup\r\n\tvar menuPopup = this.getMenuPopupBinding ();\r\n\tif ( menuPopup ) {\r\n\t\tthis.isMenuContainer = true;\r\n\t\tthis.setType ( MenuItemBinding.TYPE_MENUCONTAINER );\r\n\t\tthis.hasAction = hasAction === true;\r\n\t}\r\n\r\n\t// compute image profile\r\n\tif ( !this.imageProfile ) {\r\n\r\n\t\tif ( !this.image && image ) {\r\n\t\t\tthis.image = image;\r\n\t\t}\r\n\t\tif ( !this.imageHover && imageHover ) {\r\n\t\t\tthis.imageHover = image;\r\n\t\t}\r\n\t\tif ( !this.imageActive && imageActive ) {\r\n\t\t\tthis.imageActive = imageActive;\r\n\t\t}\r\n\t\tif ( !this.imageDisabled && imageDisabled ) {\r\n\t\t\tthis.imageDisabled = imageDisabled;\r\n\t\t}\r\n\t\tif ( this.image || this.imageHover || this.imageActive || this.imageDisabled ) {\r\n\t\t\tthis.imageProfile = new ImageProfile ( this );\r\n\t\t}\r\n\t}\r\n\r\n\tif ( this.imageProfile ) {\r\n\t\tthis.setImage ( this.imageProfile.getDefaultImage ());\r\n\t\t/*this._containingMenuBodyBinding.invokeImageLayout ();*/\r\n\t} else {\r\n\t\tthis.setImage ( null );\r\n\t}\r\n\r\n\tif ( label != null ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\tif ( tooltip ) {\r\n\t\tthis.setToolTip ( tooltip );\r\n\t}\r\n\tif ( type ) {\r\n\t\tthis.setType ( type );\r\n\t}\r\n\tif ( this.type == MenuItemBinding.TYPE_CHECKBOX ) {\r\n\t\tif ( this.getProperty ( \"ischecked\" ) == true ) {\r\n\t\t\tthis.check ( true );\r\n\t\t}\r\n\t}\r\n\tif ( disabled == true ) {\r\n\t\tthis.disable ();\r\n\t}\r\n\r\n\t/*\r\n\t * Setup command\r\n\t */\r\n\tvar oncommand = this.getProperty ( \"oncommand\" );\r\n\tif ( oncommand ) {\r\n\t\tthis.oncommand = function () {\r\n\t\t\tthis.bindingWindow.eval ( oncommand );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Assign DOM events.\r\n */\r\nMenuItemBinding.prototype.assignDOMEvents = function () {\r\n\r\n\t/*\r\n\t * Rebember that menubody handles blur!\r\n\t */\r\n\tthis.addEventListener ( DOMEvents.MOUSEOVER );\r\n\tthis.addEventListener ( DOMEvents.MOUSEUP );\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nMenuItemBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tMenuItemBinding.superclass.handleEvent.call ( this, e );\r\n\r\n\tif ( !this.isDisabled && !BindingDragger.isDragging ) {\r\n\r\n\t\tswitch ( e.type ) {\r\n\r\n\t\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\t\tthis.focus ( e );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase DOMEvents.MOUSEUP :\r\n\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t\tif (this.hasAction) {\r\n\t\t\t\t\tif ( this.type == MenuItemBinding.TYPE_CHECKBOX ) {\r\n\t\t\t\t\t\tthis.setChecked ( !this.isChecked );\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.fireCommand ();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\t\t\tBroadcastMessages.MOUSEEVENT_MOUSEDOWN, this\r\n\t\t\t\t\t);\r\n\t\t\t\t\tEventBroadcaster.broadcast (\r\n\t\t\t\t\t\tBroadcastMessages.MOUSEEVENT_MOUSEUP, this\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Fire command.\r\n */\r\nMenuItemBinding.prototype.fireCommand = function () {\r\n\r\n\tif ( this.hasAction ) {\r\n\t\tif ( this.oncommand ) {\r\n\t\t\t// TODO: Timeout to close first? Animation.DEFAULT_TIMEOUT?\r\n\t\t\tthis.oncommand ();\r\n\t\t}\r\n\t\tthis.dispatchAction ( MenuItemBinding.ACTION_COMMAND );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set image. Defaults to a blank image in order to align menuitems correctly.\r\n * TODO: modify menu layout if NO menuitems specify images.\r\n * @param {string} url\r\n */\r\nMenuItemBinding.prototype.setImage = function ( url ) {\r\n\r\n\turl = url ? url : LabelBinding.DEFAULT_IMAGE;\r\n\tthis.setProperty ( \"image\", url );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setImage (\r\n\t\t\turl\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nMenuItemBinding.prototype.setLabel = function ( label ) {\r\n\r\n\tthis.setProperty ( \"label\", label );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setLabel (\r\n\t\t\tResolver.resolve ( label )\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Set tooltip.\r\n * @param {string} tooltip\r\n */\r\nMenuItemBinding.prototype.setToolTip = function ( tooltip ) {\r\n\r\n\tthis.setProperty ( \"tooltip\", tooltip );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setToolTip (\r\n\t\t\tResolver.resolve ( tooltip )\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Reset visual appearance when menus are closed.\r\n */\r\nMenuItemBinding.prototype.reset = function () {\r\n\r\n\tif ( this.labelBinding.hasClassName ( \"hover\" )) {\r\n\t\tthis.labelBinding.detachClassName ( \"hover\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set type.\r\n * @param {string} type\r\n */\r\nMenuItemBinding.prototype.setType = function ( type ) {\r\n\r\n\tif ( this.isAttached ) {\r\n\t\tif ( !this.isTypeSet ) {\r\n\t\t\tswitch ( type ) {\r\n\t\t\t\tcase MenuItemBinding.TYPE_CHECKBOX :\r\n\r\n\t\t\t\t\tif ( this.hasAction ) {\r\n\r\n\t\t\t\t\t\t// update container appearance\r\n\t\t\t\t\t\tthis._containingMenuBodyBinding.invokeCheckBoxLayout ();\r\n\r\n\t\t\t\t\t\t// append checkbox symbol\r\n\t\t\t\t\t\tvar element = this.bindingDocument.createElement ( \"div\" );\r\n\t\t\t\t\t\telement.className = MenuItemBinding.CLASSNAME_CHECKBOX;\r\n\t\t\t\t\t\telement.appendChild ( this.bindingDocument.createTextNode ( MenuItemBinding.CHAR_CHECKBOX ));\r\n\t\t\t\t\t\tvar label = this.labelBinding.bindingElement;\r\n\t\t\t\t\t\tlabel.insertBefore ( element, label.firstChild );\r\n\t\t\t\t\t\telement.style.display = \"none\";\r\n\t\t\t\t\t\tthis.shadowTree.checkBoxIndicator = element;\r\n\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthrow new Error ( \"MenuItemBinding: checkboxes cannot contain menus\" );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase MenuItemBinding.TYPE_MENUCONTAINER :\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tthis.type = type;\r\n\t\t\tthis.isTypeSet = true;\r\n\r\n\t\t} else {\r\n\t\t\tthrow new Error ( \"MenuItemBinding: Cannot set type twice.\" );\r\n\t\t}\r\n\t}\r\n\r\n\tthis.setProperty ( \"type\", type );\r\n}\r\n\r\n/**\r\n * Get image.\r\n * @return {string}\r\n */\r\nMenuItemBinding.prototype.getImage = function () {\r\n\r\n\treturn this.getProperty ( \"image\" );\r\n}\r\n\r\n/**\r\n * Get label.\r\n * @return {string}\r\n */\r\nMenuItemBinding.prototype.getLabel = function () {\r\n\r\n\treturn this.getProperty ( \"label\" );\r\n}\r\n\r\n\r\n/**\r\n * Get tooltip.\r\n * @return {string}\r\n */\r\nMenuItemBinding.prototype.getToolTip = function () {\r\n\r\n\treturn this.getProperty ( \"tooltip\" );\r\n}\r\n\r\n/**\r\n * Disable menuitem.\r\n */\r\nMenuItemBinding.prototype.disable = function () {\r\n\r\n\tthis.setDisabled ( true );\r\n}\r\n\r\n/**\r\n * Enable menuitem.\r\n */\r\nMenuItemBinding.prototype.enable = function () {\r\n\r\n\tthis.setDisabled ( false );\r\n}\r\n\r\n/**\r\n * Set menuitem disabled status.\r\n * @param {boolean} bool\r\n */\r\nMenuItemBinding.prototype.setDisabled = function ( bool ) {\r\n\r\n\tthis.isDisabled = bool;\r\n\r\n\tif ( this.isDisabled ) {\r\n\t\tthis.setProperty ( \"isdisabled\", true );\r\n\t} else {\r\n\t\tthis.deleteProperty ( \"isdisabled\" );\r\n\t}\r\n\r\n\tif ( this.isAttached ) {\r\n\t\tif ( this.isDisabled ) {\r\n\t\t\tthis.labelBinding.detachClassName ( \"hover\" );\r\n\t\t\tthis.attachClassName ( \"isdisabled\" );\r\n\t\t\tif ( this.imageProfile ) {\r\n\t\t\t\tvar image = this.imageProfile.getDisabledImage ();\r\n\t\t\t\tif ( image ) {\r\n\t\t\t\t\tthis.setImage ( image );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( \"isdisabled\" );\r\n\t\t\tif ( this.imageProfile ) {\r\n\t\t\t\tvar image = this.imageProfile.getDefaultImage ();\r\n\t\t\t\tif ( image ) {\r\n\t\t\t\t\tthis.setImage ( image );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Focus.\r\n * @param {MouseEvent} e\r\n */\r\nMenuItemBinding.prototype.focus = function ( e ) {\r\n\r\n\t/*\r\n\t * Notice that only the label gets a classname assigned here!\r\n\t */\r\n\tthis.labelBinding.attachClassName ( MenuItemBinding.CLASSNAME_HOVER );\r\n\r\n\tvar container = this.getMenuContainerBinding ();\r\n\tif ( container.isOpen () && !container.isOpen ( this )) {\r\n\t\tcontainer._openElement.hide ();\r\n\t\tcontainer.setOpenElement ( false );\r\n\t}\r\n\r\n\t/*\r\n\t * Open submenu after short timeout (when mouse-navigating).\r\n\t */\r\n\tif ( this.isMenuContainer && e && e.type == DOMEvents.MOUSEOVER ) {\r\n\t\tvar container = this.getMenuContainerBinding ();\r\n\t\tif ( !container.isOpen ( this )) {\r\n\t\t\tvar self = this;\r\n\t\t\tthis._showSubMenuTimeout = window.setTimeout ( function () {\r\n\t\t\t\tself.show ();\r\n\t\t\t\tself._showSubMenuTimeout = null;\r\n\t\t\t}, MenuItemBinding.TIMEOUT );\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * When keyboard navigating, this will adjust any visible scrollbar.\r\n\t */\r\n\tif ( !e || e.type != DOMEvents.MOUSEOVER ) {\r\n\t\tif ( this.bindingElement.tabIndex != -1 ) {\r\n\t\t\tif ( Client.isMozilla ) {\r\n\t\t\t\tFocusBinding.focusElement ( this.bindingElement );\r\n\t\t\t} else {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tFocusBinding.focusElement ( self.bindingElement );\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tthis.isFocused = true;\r\n\tthis._containingMenuBodyBinding.handleFocusedItem ( this );\r\n}\r\n\r\n/**\r\n * Blur.\r\n * @param {boolean} isForceBlur\r\n */\r\nMenuItemBinding.prototype.blur = function ( isForceBlur ) {\r\n\r\n\t/*\r\n\t * Clear submenu timeout.\r\n\t */\r\n\tif ( this._showSubMenuTimeout ) {\r\n\t\twindow.clearTimeout ( this._showSubMenuTimeout );\r\n\t\tthis._showSubMenuTimeout = null;\r\n\t}\r\n\r\n\tif ( this.isFocused ) {\r\n\t\tvar container = this.getMenuContainerBinding ();\r\n\t\tif ( !container || !container.isOpen ( this ) || isForceBlur ) {\r\n\t\t\tthis.labelBinding.detachClassName ( MenuItemBinding.CLASSNAME_HOVER );\r\n\t\t\tthis.isFocused = false;\r\n\t\t\tthis._containingMenuBodyBinding.handleBlurredItem ( this );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Check.\r\n * @param {boolean} isPreventCommand\r\n */\r\nMenuItemBinding.prototype.check = function ( isPreventCommand ) {\r\n\r\n\tthis.setChecked ( true, isPreventCommand );\r\n}\r\n\r\n/**\r\n * Uncheck.\r\n * @param {boolean} isPreventCommand\r\n */\r\nMenuItemBinding.prototype.uncheck = function ( isPreventCommand ) {\r\n\r\n\tthis.setChecked ( false, isPreventCommand );\r\n}\r\n\r\n/**\r\n * Always attempt right side positioning of the submenu.\r\n * @overloads {MenuContainerBinding#show}\r\n */\r\nMenuItemBinding.prototype.show = function () {\r\n\r\n\tthis.menuPopupBinding.position = PopupBinding.POSITION_RIGHT;\r\n\tMenuItemBinding.superclass.show.call ( this );\r\n}\r\n\r\n/**\r\n * Set menuitem checked status.\r\n * @param {boolean} isChecked\r\n * @param {boolean} isPreventCommand\r\n */\r\nMenuItemBinding.prototype.setChecked = function ( isChecked, isPreventCommand ) {\r\n\r\n\tthis.setProperty ( \"ischecked\", isChecked );\r\n\tif ( this.isAttached ) {\r\n\t\tif ( this.type == MenuItemBinding.TYPE_CHECKBOX ) {\r\n\t\t\tif ( this.isChecked != isChecked ) {\r\n\t\t\t\tthis.isChecked = isChecked;\r\n\t\t\t\tthis.shadowTree.checkBoxIndicator.style.display =\r\n\t\t\t\t\tisChecked ? \"block\" : \"none\";\r\n\t\t\t\tif ( !isPreventCommand ) {\r\n\t\t\t\t\tthis.fireCommand ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * MenuItemBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n */\r\nMenuItemBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar menuitem = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:menuitem\", ownerDocument );\r\n\tUserInterface.registerBinding ( menuitem, MenuItemBinding );\r\n\treturn UserInterface.getBinding ( menuitem );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/menus/MenuPopupBinding.js",
    "content": "MenuPopupBinding.prototype = new PopupBinding;\r\nMenuPopupBinding.prototype.constructor = MenuPopupBinding;\r\nMenuPopupBinding.superclass = PopupBinding.prototype;\r\n\r\nfunction MenuPopupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MenuPopupBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMenuPopupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[MenuPopupBinding]\";\r\n}\r\n\r\n/**\r\n * Menupopups are always positioned in a local coordinate space.\r\n * @overwrites {PopupBinding#_getElementPosition}.\r\n * @param {DOMElement} element\r\n * @return {Point}\r\n */\r\nMenuPopupBinding.prototype._getElementPosition = function ( element ) {\r\n\r\n\treturn new Point ( element.offsetLeft, 0 );\r\n}\r\n\r\n/**\r\n * @overwrites {PopupBinding#fitOnScreen}.\r\n */\r\nMenuPopupBinding.prototype.fitOnScreen = function () {\r\n\tswitch (this.position) {\r\n\t\tcase PopupBinding.POSITION_BOTTOM:\r\n\r\n\t\t\tvar x = this.bindingElement.offsetLeft;\r\n\t\t\tvar y = this.bindingElement.offsetTop;\r\n\t\t\tvar w = this.bindingElement.offsetWidth;\r\n\t\t\tvar h = this.bindingElement.offsetHeight;\r\n\t\t\tvar dim = this.bindingWindow.WindowManager.getWindowDimensions();\r\n\t\t\tvar pos = this.boxObject.getGlobalPosition();\r\n\r\n\t\t\tx = this.targetElement.offsetLeft + this.targetElement.offsetWidth / 2 - this.bindingElement.offsetWidth / 2;\r\n\r\n\t\t\tthis.detachClassName(\"bottomright\");\r\n\t\t\tif ( x + w >= dim.w ) {\r\n\t\t\t\tx = this.targetElement.offsetLeft + this.targetElement.offsetWidth - this.bindingElement.offsetWidth;\r\n\t\t\t\tthis.attachClassName(\"bottomright\");\r\n\t\t\t}\r\n\r\n\t\t\tthis.setPosition(x, y);\r\n\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tMenuPopupBinding.superclass.fitOnScreen.call(this);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * MenuPopupBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {MenuPopupBinding}\r\n */\r\nMenuPopupBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:menupopup\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, MenuPopupBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/pages/DialogPageBinding.js",
    "content": "DialogPageBinding.prototype = new PageBinding;\r\nDialogPageBinding.prototype.constructor = DialogPageBinding;\r\nDialogPageBinding.superclass = PageBinding.prototype;\r\n\r\nDialogPageBinding.DEFAULT_WIDTH = 531;\r\nDialogPageBinding.DEFAULT_TABBOXED_WIDTH = 476;\r\nDialogPageBinding.DEFAULT_HEIGHT = \"auto\";\r\nDialogPageBinding.DEFAULT_CONTROLS = \"close\";\r\nDialogPageBinding.DEFAULT_RESIZABLE = false;\r\nDialogPageBinding.ACTION_RESPONSE = \"dialogpageresponse\";\r\nDialogPageBinding.ACTION_LAYOUT_D = \"dialoglayoutd\";\r\nDialogPageBinding.CLASSNAME_TABBOXED = \"tabboxed\";\r\n\r\n/**\r\n * @class\r\n * Note that a this fellow only has effect when loaded inside the {@link StageDialogBinding}.\r\n */\r\nfunction DialogPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogPageBinding\" );\r\n\t\r\n\t/**\r\n\t * The dialog will always return this property \r\n\t * to an instance of (@link IDialogResponseHandler}.\r\n\t * @type {object}\r\n\t */\r\n\tthis.response = null;\r\n\t\r\n\t/**\r\n\t * If this property is specified, usually when the dialog is accepted, \r\n\t * it will be returned to an instance of (@link IDialogResponseHandler}. \r\n\t * If the subclass doesn't handle it specifically, the response will \r\n\t * default to an instance of {@link DataBindingMap}.\r\n\t * @see {DialogPageBinding#onDialogAccept}\r\n\t * @type {object}\r\n\t */\r\n\tthis.result = null;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.width = null;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.height = null;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.minheight = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.controls = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isResizable = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isAutoHeightLayoutMode = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isNonAjaxPage = true;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogPageBinding]\";\r\n}\r\n\r\n/**\r\n *\r\n */\r\nDialogPageBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tDialogPageBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( PageBinding.ACTION_ATTACHED );\r\n\tthis.addActionListener ( Binding.ACTION_DIRTY );\r\n\tthis.addActionListener ( Binding.ACTION_VALID );\r\n\tthis.addActionListener ( Binding.ACTION_INVALID );\r\n\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND );\r\n}\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nDialogPageBinding.prototype.parseDOMProperties = function () {\r\n\r\n\t/*\r\n\t * This elaborate setup takes into consideration that some \r\n\t * properties may have been defined by stuff going on eg. \r\n\t * in the setPageArgument method.\r\n\t */\r\n\r\n\tDialogPageBinding.superclass.parseDOMProperties.call ( this );\r\n\t\r\n\tvar isBranded = this.getProperty(\"branded\");\r\n\tvar dialog = this.getAncestorBindingByType(DialogBinding, true);\r\n\tif (dialog) {\r\n\t\tif (isBranded) {\r\n\t\t\tdialog.attachClassName(\"branded\");\r\n\t\t} else {\r\n\t\t\tdialog.detachClassName(\"branded\");\r\n\t\t}\r\n\t}\r\n\r\n\tif ( this.width == null ) {\r\n\t\tvar width = this.getProperty ( \"width\" );\r\n\t\tif ( !width ) {\r\n\t\t\twidth = this.hasClassName ( DialogPageBinding.CLASSNAME_TABBOXED ) ? \r\n\t\t\t\tDialogPageBinding.DEFAULT_TABBOXED_WIDTH :\r\n\t\t\t\tDialogPageBinding.DEFAULT_WIDTH;\r\n\t\t}\r\n\t\tthis.width = width;\r\n\t}\r\n\tif ( this.height == null ) {\r\n\t\tvar height = this.getProperty ( \"height\" );\r\n\t\tthis.height = height ? height : DialogPageBinding.DEFAULT_HEIGHT;\r\n\t}\r\n\tif ( this.minheight == null ) {\r\n\t\tvar minheight = this.getProperty ( \"minheight\" );\r\n\t\tif ( minheight != null ) {\r\n\t\t\tthis.minheight = minheight;\r\n\t\t}\r\n\t}\r\n\tif ( this.controls == null ) {\r\n\t\tvar controls = this.getProperty ( \"controls\" );\r\n\t\tthis.controls = controls ? controls : DialogPageBinding.DEFAULT_CONTROLS;\r\n\t}\r\n\tif ( !this.isResizable ) {\r\n\t\tvar isResizable = this.getProperty ( \"resizable\" );\r\n\t\tthis.isResizable = isResizable ? isResizable : DialogPageBinding.DEFAULT_RESIZABLE;\r\n\t}\r\n\r\n\t/*\r\n\t * Comment here please!\r\n\t */\r\n\tif ( this.height == \"auto\" ) {\r\n\t\tthis.enableAutoHeightLayoutMode ( true );\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * @overloads {PageBinding#onBindingAttach}\r\n */\r\nDialogPageBinding.prototype.onBindingAttach = function () {\r\n\r\n\tDialogPageBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tvar image = this.getProperty(\"image\");\r\n\tvar dialogvignette = this.getDescendantElementsByLocalName(\"dialogvignette\").getFirst();\r\n\tif (image && dialogvignette) {\r\n\t\tthis.labelBinding = LabelBinding.newInstance(this.bindingDocument);\r\n\t\tthis.labelBinding.setImage(image);\r\n\t\tdialogvignette.appendChild(\r\n\t\t\tthis.labelBinding.bindingElement\r\n\t\t);\r\n\t\tthis.labelBinding.attach();\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {object} arg\r\n */\r\nDialogPageBinding.prototype.setPageArgument = function (arg) {\r\n\r\n\tDialogPageBinding.superclass.setPageArgument.call(this, arg);\r\n\r\n\tif (arg && arg.image)\r\n\t\tthis.setProperty(\"image\", arg.image);\r\n}\r\n\r\n/**\r\n * Check the MessageQueue after page load.\r\n * TODO: Remove this! Should be handled by ResponseBinding!!!\r\n * @overloads {PageBinding#onAfterPageInitialize}\r\n *\r\nDialogPageBinding.prototype.onAfterPageInitialize = function () {\r\n\t\r\n\tDialogPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\t\r\n\tif ( this._isDotNet ()) {\r\n\t\t\r\n\t\t/*\r\n\t\t * TODO: This should be handled by ResponseBinding!!!\r\n\t\t * Update: ResponseBinding is now supposed to work...\r\n\t\t * \"AJAX!\" - this is just a keyword we can sarch for :)\r\n\t\t *\r\n\t\tMessageQueue.update ();\r\n\t}\r\n}\r\n*/\r\n\r\n/**\r\n * @see {StageDialogBinding}\r\n * @param {boolean} isMode\r\n */\r\nDialogPageBinding.prototype.enableAutoHeightLayoutMode = function ( isMode ) {\r\n\t\r\n\tif ( isMode != this.isAutoHeightLayoutMode ) {\r\n\t\tif ( isMode ) {\r\n\t\t\tthis.attachClassName ( \"auto\" );\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( \"auto\" );\r\n\t\t}\r\n\t\tthis.isAutoHeightLayoutMode = isMode;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nDialogPageBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tDialogPageBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\r\n\t\tcase PageBinding.ACTION_ATTACHED :\r\n\t\t\r\n\t\t\t/*\r\n\t\t\t * TODO: check for this.height == \"auto\"?\r\n\t\t\t */\r\n\t\t\tif ( binding != this && binding.isFitAsDialogSubPage ) {\r\n\t\t\t\tbinding.makeDialogSubPage ();\r\n\t\t\t}\r\n\t\t\t// don't consume - ViewBinding is listening!\r\n\t\t\tbreak;\r\n\t\r\n\t\tcase ButtonBinding.ACTION_COMMAND : \r\n\t\t\t\r\n\t\t\t// no need to relay button commands to containing dialog\r\n\t\t\taction.consume ();\r\n\t\t\t\r\n\t\t\t// special handling of buttons with a \"response\" property set\r\n\t\t\tif ( binding.response != null ) {\r\n\t\t\t\t\r\n\t\t\t\t/* \r\n\t\t\t\t * Hide while handling response.\r\n\t\t\t\t *\r\n\t\t\t\tthis.bindingElement.style.visibility = \"hidden\";\r\n\t\t\t\t*/\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * By default, dialog response is identical to \r\n\t\t\t\t * button response. This can be changed later.\r\n\t\t\t\t */\r\n\t\t\t\tthis.response = binding.response;\r\n\t\t\t\t\r\n\t\t\t\tswitch ( binding.response ) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * The dialog ACCEPT button will validate the dialog  \r\n\t\t\t\t\t * before being accepted as a dialog response. If content  \r\n\t\t\t\t\t * is validated correctly, \"onDialogAccept\" is invoked.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tcase Dialog.RESPONSE_ACCEPT :\r\n\t\t\t\t\t\tif ( this.validateAllDataBindings () == true ) {\r\n\t\t\t\t\t\t\tthis.onDialogAccept ();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.onDialogInvalid ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * The dialog CANCEL button invokes another special method.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tcase Dialog.RESPONSE_CANCEL :\r\n\t\t\t\t\t\tthis.onDialogCancel ();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * All other buttons (with a specified response) invoke this method.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tdefault :\r\n\t\t\t\t\t\tthis.onDialogResponse ();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase Binding.ACTION_INVALID :\r\n\t\t\tthis._disableAcceptButton ( true );\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase Binding.ACTION_VALID :\r\n\t\t\tthis._disableAcceptButton ( false );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Disable or enable accept button.\r\n * @param {boolean} isDisable\r\n */\r\nDialogPageBinding.prototype._disableAcceptButton = function ( isDisable ) {\r\n\t\r\n\tvar acceptButton = this.bindingWindow.bindingMap.buttonAccept;\r\n\tif ( acceptButton != null ) {\r\n\t\tacceptButton.setDisabled ( isDisable );\r\n\t}\r\n}\r\n\r\n/**\r\n * Subclasses should overload this method if a special dialog result  \r\n * is required. Result defaults to the local dataBindingResultMap.\r\n * @see {DataManager#getDataBindingResultMap}\r\n */\r\nDialogPageBinding.prototype.onDialogAccept = function () {\r\n\t\r\n\t/*\r\n\t * Define your result around here. Otherwise \r\n\t * the default result will be set, see below.\r\n\t */\r\n\tif ( this.result === null ) {\r\n\t\ttry {\r\n\t\t\tthis.result = this.bindingWindow.DataManager.getDataBindingResultMap ();\r\n\t\t} catch ( exception ) {\r\n\t\t\talert ( exception );\r\n\t\t\tthrow exception;\r\n\t\t}\r\n\t}\r\n\tthis.onDialogResponse ();\r\n}\r\n\r\n/**\r\n * Subclasses should overwrite this method to setup invalid content scenario.\r\n */\r\nDialogPageBinding.prototype.onDialogInvalid = function () {\r\n\t\r\n\t// do nothing by default\r\n}\r\n\r\n/**\r\n * Subclasses should overload this method to perform  \r\n * cleanup before the dialog is closed.\r\n * @param {object} response\r\n */\r\nDialogPageBinding.prototype.onDialogCancel = function () {\r\n\t\r\n\tthis.onDialogResponse ();\r\n}\r\n\r\n/**\r\n * If response was neither accept nor cancel, this method will be invoked directly. \r\n * Otherwise, the corresponding methods will be invoked first, for you to hook into. \r\n * Remember that any relayed response will close the dialog automatically.\r\n * @param {object} response\r\n */\r\nDialogPageBinding.prototype.onDialogResponse = function () {\r\n\t\r\n\tthis.dispatchAction ( DialogPageBinding.ACTION_RESPONSE );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/pages/DialogPageBodyBinding.js",
    "content": "DialogPageBodyBinding.prototype = new FlexBoxBinding;\r\nDialogPageBodyBinding.prototype.constructor = DialogPageBodyBinding;\r\nDialogPageBodyBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nDialogPageBodyBinding.FILLED_CLASSNAME = \"filled\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction DialogPageBodyBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogPageBodyBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogPageBodyBinding.prototype.toString = function () {\r\n\r\n\treturn \"[DialogPageBodyBinding]\";\r\n};\r\n\r\n/**\r\n * Hardwired for method fit.\r\n * @overwrites {FlexBoxBinding#_setFitnessHeight}\r\n * @param {int} height\r\n */\r\nDialogPageBodyBinding.prototype._setFitnessHeight = function (height) {\r\n\r\n\tvar padding = CSSComputer.getPadding(this.bindingElement);\r\n\tvar border = CSSComputer.getBorder(this.bindingElement);\r\n\r\n\theight += padding.top + padding.bottom;\r\n\theight += border.top + border.bottom;\r\n\r\n\tif ( height > this.bindingElement.offsetHeight ) {\r\n\t\tthis.bindingElement.style.height = height + \"px\";\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/pages/EditorPageBinding.js",
    "content": "EditorPageBinding.prototype = new PageBinding;\r\nEditorPageBinding.prototype.constructor = EditorPageBinding;\r\nEditorPageBinding.superclass = PageBinding.prototype;\r\n\r\nEditorPageBinding.ACTION_ATTACHED \t= \"editorpage attached\";\r\nEditorPageBinding.ACTION_DIRTY\t\t= \"editorpage dirty\";\r\nEditorPageBinding.ACTION_CLEAN\t\t= \"editorpage clean\";\r\nEditorPageBinding.ACTION_SAVE\t\t= \"editorpage save\";\r\nEditorPageBinding.ACTION_SAVE_AND_PUBLISH = \"editorpage save and publish\";\r\n\r\n/*\r\n * Special binding IDs, hardcoded by the server goo.\r\n */\r\nEditorPageBinding.ID_SAVEASBUTTON \t= \"saveasbutton\";\r\nEditorPageBinding.ID_PREVIEWTAB\t\t= \"previewtab\";\r\nEditorPageBinding.ID_MAINTABBOX\t\t= \"maintabbox\";\r\nEditorPageBinding.ID_PREVIEWWINDOW \t= \"previewwindow\";\r\n\r\n/*\r\n * Postback directives. Matched serverside, don't change!\r\n */\r\nEditorPageBinding.MESSAGE_SAVE = \"save\";\r\nEditorPageBinding.MESSAGE_SAVE_AND_PUBLISH = \"saveandpublish\";\r\nEditorPageBinding.MESSAGE_PERSIST \t= \"persist\";\r\nEditorPageBinding.MESSAGE_REFRESH \t= \"refresh\";\r\n\r\n/**\r\n * Magic message.\r\n * @type {String}\r\n */\r\nEditorPageBinding.message = null;\r\n\r\n/**\r\n * True while tabbing.\r\n * @type {boolean}\r\n */\r\nEditorPageBinding.isTabbing = false;\r\n\r\n/**\r\n * Register open editorpages. Considered private.\r\n * @type {Map<string><EditorPageBinding>}\r\n */\r\nEditorPageBinding._registry = new Map ();\r\n\r\n/**\r\n * Register open editor.\r\n * @param {EditorPagebinding}\r\n */\r\nEditorPageBinding.register = function ( page ) {\r\n\r\n\tvar map = EditorPageBinding._registry;\r\n\tif ( !map.hasEntries ()) {\r\n\t\ttop.app.bindingMap.broadcasterHasOpenEditors.enable ();\r\n\t}\r\n\tmap.set ( page.key, page );\r\n}\r\n\r\n/**\r\n * Unregister open editor.\r\n * @param {EditorPagebinding}\r\n */\r\nEditorPageBinding.unregister = function ( page ) {\r\n\r\n\tvar map = EditorPageBinding._registry;\r\n\tmap.del ( page.key );\r\n\tif ( !map.hasEntries ()) {\r\n\t\ttop.app.bindingMap.broadcasterHasOpenEditors.disable ();\r\n\t}\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction EditorPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"EditorPageBinding\" );\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDirty = false;\r\n\r\n\t/** The main tabbox!\r\n\t * @type {TabBoxBinding}\r\n\t */\r\n\tthis._tabBoxBinding = null;\r\n\r\n\t/**\r\n\t * The preview tab!\r\n\t * @type {TabBinding}\r\n\t */\r\n\tthis._tabBinding = null;\r\n\r\n\t/**\r\n\t * The preview window!\r\n\t * @type {WindowBinding}\r\n\t */\r\n\tthis._windowBinding = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isGeneratingPreview = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isPreviewWindowVisible = false;\r\n\r\n\t/**\r\n\t * The current postMessage string matching \"save\" or \"persist\".\r\n\t */\r\n\tthis._message = null;\r\n\r\n\t/**\r\n\t * Messages waiting to be executed as soon\r\n\t * as this._messengers has been emptied.\r\n\t * @deprecated\r\n\t * @type {List<String>}\r\n\t */\r\n\tthis._messages = null;\r\n\r\n\t/**\r\n\t * While not empty, incoming postMessages\r\n\t * will be collected in this._messages.\r\n\t * @type {List<PageBinding>}\r\n\t */\r\n\tthis._messengers = null;\r\n\r\n\t/**\r\n\t * Hack the preview setup - don't instigate preview while persisting.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isWaitingForPreview = false;\r\n\r\n\t/**\r\n\t * True while the preview tab is selected. Note that there may not\r\n\t * be a preview window in editor, but only the backend knows this.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isPreviewing = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nEditorPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[EditorPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBindingRegister}\r\n */\r\nEditorPageBinding.prototype.onBindingRegister = function () {\r\n\r\n\tEditorPageBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\tthis.addActionListener ( Binding.ACTION_DIRTY );\r\n\tthis.addActionListener ( Binding.ACTION_VALID );\r\n\tthis.addActionListener ( Binding.ACTION_INVALID );\r\n\tthis.addActionListener ( EditorPageBinding.ACTION_SAVE );\r\n\tthis.addActionListener ( EditorPageBinding.ACTION_SAVE_AND_PUBLISH );\r\n\r\n\tthis.addActionListener ( ResponseBinding.ACTION_SUCCESS );\r\n\tthis.addActionListener ( ResponseBinding.ACTION_FAILURE );\r\n\tthis.addActionListener ( ResponseBinding.ACTION_OOOOKAY );\r\n\r\n\tEditorPageBinding.register ( this );\r\n\r\n\tthis._invalidBindings = new Map ();\r\n\tthis._messengers = new List ();\r\n\tthis._messages = new List ();\r\n}\r\n\r\n/**\r\n *\r\n * @overloads {FocusBinding#onBindingDispose}\r\n */\r\nEditorPageBinding.prototype.onBindingDispose = function () {\r\n\r\n\t/*\r\n\t * If editor documents gets replaced for whatever reason, this will make\r\n\t * sure that the tab can be closed without prompting a save dialog.\r\n\t */\r\n\tthis.dispatchAction ( EditorPageBinding.ACTION_CLEAN );\r\n\r\n\t/*\r\n\t * Cleaning up for various XHTML-aware panels.\r\n\t */\r\n\tif ( this._isPreviewWindowVisible == true ) {\r\n\t\tsetTimeout ( function () {\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.XHTML_MARKUP_OFF );\r\n\t\t}, 250 );\r\n\t}\r\n\r\n\tEditorPageBinding.unregister ( this );\r\n\tEditorPageBinding.superclass.onBindingDispose.call ( this );\r\n}\r\n\r\n/**\r\n * @overwrites {PageBinding#onPageInitialize}\r\n */\r\nEditorPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tthis._setupPreviewListeners ();\r\n\tEditorPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Inititalize save buttons.\r\n * @overloads {PageBinding#onPageInitialize}\r\n */\r\nEditorPageBinding.prototype.onPageInitialize = function () {\r\n\r\n\tEditorPageBinding.superclass.onPageInitialize.call ( this );\r\n\tthis.enableSaveAs ();\r\n}\r\n\r\n/**\r\n * Setup stuff to generate a preview when the related tab is selected.\r\n * This should really not be done on a general EditorPageBinding...\r\n * but we are trapped by the DocumentExecutionContainer.aspx hardcode.\r\n */\r\nEditorPageBinding.prototype._setupPreviewListeners = function () {\r\n\r\n\tvar box = this.bindingDocument.getElementById ( EditorPageBinding.ID_MAINTABBOX );\r\n\tvar tab = this.bindingDocument.getElementById ( EditorPageBinding.ID_PREVIEWTAB );\r\n\tvar win = this.bindingDocument.getElementById ( EditorPageBinding.ID_PREVIEWWINDOW );\r\n\r\n\tif ( box != null ) {\r\n\r\n\t\tthis._tabBoxBinding = UserInterface.getBinding ( box );\r\n\t\tthis._tabBoxBinding.addActionListener ( TabBoxBinding.ACTION_SELECTED, this );\r\n\t\tthis._tabBoxBinding.addActionListener ( TabBoxBinding.ACTION_UNSELECTED, this );\r\n\r\n\t\tif ( tab != null && win != null ) { // preview generating stuff\r\n\r\n\t\t\tthis._tabBinding\t= UserInterface.getBinding ( tab );\r\n\t\t\tthis._windowBinding = UserInterface.getBinding ( win );\r\n\r\n\t\t\tthis._windowBinding.addActionListener ( WindowBinding.ACTION_LOADED, this );\r\n\t\t\tthis._windowBinding.addActionListener ( WindowBinding.ACTION_ONLOAD, this );\r\n\r\n\t\t\tthis.subscribe ( BroadcastMessages.HIGHLIGHT_KEYWORDS );\r\n\r\n\t\t\tif ( this._tabBinding.isSelected ) {\r\n\t\t\t\tthis._startPreview ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * This gets invoked by the associated {@link DockTabBinding}\r\n * when a save was successfull. This is probably determined by a\r\n * message on the {@link MessageQueue}.\r\n */\r\nEditorPageBinding.prototype.onSaveSuccess = function () {\r\n\r\n\tthis.enableSave ( false );\r\n\tthis.enableSaveAs ();\r\n\tthis.cleanAllDataBindings ();\r\n\tthis.isDirty = false;\r\n\tEditorPageBinding.message = null; // could have been flipped by PageBinding!\r\n\tthis.dispatchAction ( EditorPageBinding.ACTION_CLEAN );\r\n}\r\n\r\n/**\r\n * When a dirty event is registered, update the relevant {@link BroadcasterBinding}.\r\n * A specialized dirty event is passed on to the containing {@link DockBinding}.\r\n * @implements {IActionListener}\r\n * @overloads {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nEditorPageBinding.prototype.handleAction = function (action) {\r\n\r\n\tEditorPageBinding.superclass.handleAction.call(this, action);\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch (action.type) {\r\n\r\n\t\tcase EditorPageBinding.ACTION_SAVE:\r\n\t\t\tthis.postMessage(EditorPageBinding.MESSAGE_SAVE);\r\n\t\t\t// don't consume - DockTabBinding is listening!\r\n\t\t\tbreak;\r\n\r\n\t\tcase EditorPageBinding.ACTION_SAVE_AND_PUBLISH:\r\n\t\t\tthis.postMessage(EditorPageBinding.MESSAGE_SAVE_AND_PUBLISH);\r\n\t\t\tbreak;\r\n\r\n\t\tcase ResponseBinding.ACTION_OOOOKAY:\r\n\t\t\tif (Application.isDeveloperMode) {\r\n\t\t\t\t// alert ( \"OOOOKAY \"  + binding.bindingDocument.title );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase ResponseBinding.ACTION_SUCCESS:\r\n\r\n\t\t\tif (Application.isDeveloperMode) {\r\n\t\t\t\t// alert ( \"SUCCESS \" + binding.bindingDocument.title );\r\n\t\t\t}\r\n\r\n\t\t\tif (this._messengers.hasEntries()) {\r\n\r\n\t\t\t\tvar index = -1;\r\n\t\t\t\tthis._messengers.each(function (page) {\r\n\t\t\t\t\tvar res = page.bindingWindow == binding.bindingWindow;\r\n\t\t\t\t\tif (res) {\r\n\t\t\t\t\t\tpage.bindingWindow.DataManager.isDirty = false;\r\n\t\t\t\t\t\tif (index == -1) {\r\n\t\t\t\t\t\t\tindex = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tindex++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn res;\r\n\t\t\t\t});\r\n\t\t\t\tif (index > -1) {\r\n\t\t\t\t\tthis._messengers.del(index);\r\n\t\t\t\t}\r\n\t\t\t\tif (!this._messengers.hasEntries()) {\r\n\t\t\t\t\tswitch (this._message) {\r\n\t\t\t\t\t\tcase EditorPageBinding.MESSAGE_SAVE:\r\n\t\t\t\t\t\t\tthis._saveEditorPage();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase EditorPageBinding.MESSAGE_SAVE_AND_PUBLISH:\r\n\t\t\t\t\t\t\tthis._saveAndPublishEditorPage();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase EditorPageBinding.MESSAGE_PERSIST:\r\n\t\t\t\t\t\t\tthis._refresh(); // refresh after \"persist\"\r\n\t\t\t\t\t\t\tthis._message = null;\r\n\t\t\t\t\t\t\tif (this._isWaitingForPreview) { // please unhack this!\r\n\t\t\t\t\t\t\t\tthis._isWaitingForPreview = false;\r\n\t\t\t\t\t\t\t\tthis._startPreview();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\t\t\t\tthis._refresh(); // refresh after \"save\"\r\n\t\t\t\tthis._message = null;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase ResponseBinding.ACTION_FAILURE:\r\n\t\t\tif (Application.isDeveloperMode) {\r\n\t\t\t\t// alert ( \"FAILURE \" + binding.bindingDocument.title );\r\n\t\t\t}\r\n\t\t\tthis._message = null;\r\n\t\t\tthis._messengers = new List();\r\n\t\t\tbreak;\r\n\r\n\t\tcase Binding.ACTION_DIRTY:\r\n\t\t\tif (this.canSave()) {\r\n\t\t\t\tif (!this.isDirty) {\r\n\t\t\t\t\tthis.enableSave(true);\r\n\t\t\t\t\tthis.isDirty = true;\r\n\t\t\t\t\tthis.dispatchAction(EditorPageBinding.ACTION_DIRTY);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\r\n\t\tcase Binding.ACTION_INVALID:\r\n\t\t\tthis.enableSave(false);\r\n\t\t\tthis._invalidBindings.set(binding.key, binding);\r\n\t\t\tif (binding instanceof FieldsBinding) {\r\n\t\t\t\tthis._updateStatusBar();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase Binding.ACTION_VALID:\r\n\t\t\tthis._invalidBindings.del(binding.key);\r\n\t\t\tif (binding instanceof FieldsBinding) {\r\n\t\t\t\tthis._updateStatusBar();\r\n\t\t\t}\r\n\t\t\tif (!this._invalidBindings.hasEntries()) {\r\n\t\t\t\tthis.enableSave(true);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase TabBoxBinding.ACTION_SELECTED:\r\n\t\t\tif (binding == this._tabBoxBinding) {\r\n\t\t\t\tif (this._windowBinding != null) { // preview stuff\r\n\t\t\t\t\tvar tab = binding.getSelectedTabBinding();\r\n\t\t\t\t\tif (tab.getID() == EditorPageBinding.ID_PREVIEWTAB) {\r\n\t\t\t\t\t\tthis._isPreviewing = true;\r\n\t\t\t\t\t\tif (this._messengers.hasEntries()) {\r\n\t\t\t\t\t\t\tthis._isWaitingForPreview = true;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis._startPreview();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (this._isPreviewing) {\r\n\t\t\t\t\t\tthis._isPreviewing = false;\r\n\t\t\t\t\t\tthis._stopPreview();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\r\n\t\tcase TabBoxBinding.ACTION_UNSELECTED:\r\n\t\t\tif (binding == this._tabBoxBinding) {\r\n\t\t\t\tthis.postMessage(EditorPageBinding.MESSAGE_PERSIST);\r\n\t\t\t}\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\r\n\t\tcase WindowBinding.ACTION_LOADED: // preview\r\n\r\n\t\t\tif (binding == this._windowBinding) {\r\n\t\t\t\tif (this._isGeneratingPreview == true) {\r\n\t\t\t\t\tthis._generatePreview();\r\n\t\t\t\t\tthis._isGeneratingPreview = false;\r\n\t\t\t\t}\r\n\t\t\t\taction.consume();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase WindowBinding.ACTION_ONLOAD: // preview\r\n\r\n\t\t\t/*\r\n\t\t\t* TODO: Consider how this might impact focus in layout...\r\n\t\t\t*/\r\n\t\t\tif (binding == this._windowBinding) {\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t* First hit is the postback document. This is neglected.\r\n\t\t\t\t*/\r\n\t\t\t\tif (binding.getContentWindow().isPostBackDocument != true) {\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* Disable new-version lookup. Cache enabled by\r\n\t\t\t\t\t* {@link EditorPageBinding#_startPreview}\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tif (Client.isPrism) {\r\n\t\t\t\t\t\tPrism.enableCache();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* Note that this here code is invoked twice\r\n\t\t\t\t\t* when the preview is first generated!\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tsetTimeout(function () { // COPYPASTED ABOVE!\r\n\t\t\t\t\t\tApplication.unlock(self);\r\n\t\t\t\t\t}, 100);\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t* Broadcast contained markup for\r\n\t\t\t\t\t* various panels to intercept.\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tif (EventBroadcaster.hasSubscribers(BroadcastMessages.XHTML_MARKUP_ON)) {\r\n\t\t\t\t\t\tvar markup = WindowBinding.getMarkup(this._windowBinding);\r\n\t\t\t\t\t\tEventBroadcaster.broadcast(BroadcastMessages.XHTML_MARKUP_ON, markup);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Can we save? This question has been made dependant on\r\n * the existance of a save-button inside the document.\r\n * TODO: should this reflect thie buttons isDisabled state?\r\n * @return {boolean}\r\n */\r\nEditorPageBinding.prototype.canSave = function () {\r\n\r\n\treturn this.bindingWindow.bindingMap.savebutton != null;\r\n}\r\n\r\n/**\r\n * Ignite the save routine. For reasons of NET postback drama,\r\n * this must be delegated by emulating a click on the save button.\r\n */\r\nEditorPageBinding.prototype.doSave = function () {\r\n\r\n\tvar button = this.bindingWindow.bindingMap.savebutton;\r\n\tif ( button != null && !button.isDisabled ) {\r\n\t\tbutton.fireCommand ();\r\n\t}\r\n}\r\n\r\nEditorPageBinding.prototype._wakeAndValidateAllDataBindings = function (callback) {\r\n\r\n\tvar dataBindings = this.bindingWindow.DataManager.getAllDataBindings();\r\n\tvar listLength = dataBindings.getLength();\r\n\tvar wokenBindings = 0;\r\n\r\n\tvar validateCallback = function () {\r\n\t\tif (this.validateAllDataBindings( true )) {\r\n\t\t\tcallback();\r\n\t\t}\r\n\t}.bind(this);\r\n\r\n\tfunction awakeCallback() {\r\n\t\twokenBindings += 1;\r\n\t\tif (wokenBindings === listLength) {\r\n\t\t\tvalidateCallback();\r\n\t\t}\r\n\t}\r\n\r\n\twhile (dataBindings.hasNext()) {\r\n\t\tvar binding = dataBindings.getNext();\r\n\t\tif (binding.isRequired || binding.getProperty('required')) {\r\n\t\t\twhile (binding && !binding.isLazy) {\r\n\t\t\t\tbinding = binding.getAncestorBindingByType(Binding);\r\n\t\t\t}\r\n\t\t\tif (!binding) {\r\n\t\t\t\t// No lazy ancestor\r\n\t\t\t\tawakeCallback();\r\n\t\t\t} else {\r\n\t\t\t\tbinding.wakeUp(awakeCallback);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tawakeCallback();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Performs the final save transaction.\r\n */\r\nEditorPageBinding.prototype._saveEditorPage = function (publish) {\r\n\r\n\tthis._wakeAndValidateAllDataBindings(function () {\r\n\t\tthis.bindingWindow.DataManager.isDirty = false;\r\n\t\tvar postback = this.bindingWindow.bindingMap.__REQUEST;\r\n\t\tif (postback != null) {\r\n\t\t\tvar signal = publish ?\r\n\t\t\t\tEditorPageBinding.MESSAGE_SAVE_AND_PUBLISH :\r\n\t\t\t\tEditorPageBinding.MESSAGE_SAVE;\r\n\t\t\tpostback.postback(signal);\r\n\t\t} else {\r\n\t\t\tthis.logger.error(\"Save \" + publish ? \"and publish \" : \"\" + \"aborted: \" +\r\n\t\t\t\t\"Could not locate RequestBinding\");\r\n\t\t}\r\n\t}.bind(this));\r\n};\r\n\r\n/**\r\n* Performs the final save and publish transaction.\r\n*/\r\nEditorPageBinding.prototype._saveAndPublishEditorPage = function () {\r\n\tthis._saveEditorPage(true);\r\n};\r\n\r\n/**\r\n * Refresh page!\r\n */\r\nEditorPageBinding.prototype._refresh = function () {\r\n\r\n\tif ( Application.isDeveloperMode ) {\r\n\t\t// alert ( \"REFRESHING ALL\" );\r\n\t}\r\n\tthis.postMessage ( EditorPageBinding.MESSAGE_REFRESH );\r\n}\r\n\r\n/**\r\n * Post message to this frame and descendant frames.\r\n * TODO: collect messages added while messaging?\r\n * @overwrites {PageBinding#postMessage}\r\n * @param {String} message\r\n * @param {List<Binding>} list\r\n */\r\nEditorPageBinding.prototype.postMessage = function (message) {\r\n\r\n\tthis._message = null;\r\n\r\n\tswitch (message) {\r\n\r\n\t\tcase EditorPageBinding.MESSAGE_SAVE:\r\n\t\tcase EditorPageBinding.MESSAGE_SAVE_AND_PUBLISH:\r\n\t\t\tthis._postMessageToDescendants(message, this._messengers);\r\n\t\t\tif (!this._messengers.hasEntries()) {\r\n\t\t\t\tif (message == EditorPageBinding.MESSAGE_SAVE_AND_PUBLISH) {\r\n\t\t\t\t\tthis._saveAndPublishEditorPage();\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthis._saveEditorPage();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis._message = message;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase EditorPageBinding.MESSAGE_PERSIST:\r\n\t\t\tthis._message = message;\r\n\t\t\tEditorPageBinding.superclass.postMessage.call(this, message, this._messengers);\r\n\t\t\tbreak;\r\n\r\n\t\tcase EditorPageBinding.MESSAGE_REFRESH:\r\n\t\t\tEditorPageBinding.superclass.postMessage.call(this, message, this._messengers);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @overloads {PageBinding#handleBroadcast}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nEditorPageBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tEditorPageBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.HIGHLIGHT_KEYWORDS :\r\n\t\t\tvar keywords = arg;\r\n\t\t\tif ( UserInterface.isBindingVisible ( this._windowBinding )) {\r\n\t\t\t\tWindowBinding.highlightKeywords ( this._windowBinding, keywords );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked be ancestor {IActivatable} when activated.\r\n * @overloads {FocusBinding#onActivate}\r\n */\r\nEditorPageBinding.prototype.onActivate = function () {\r\n\r\n\tEditorPageBinding.superclass.onActivate.call ( this );\r\n\r\n\tif ( this._isPreviewWindowVisible == true ) {\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.XHTML_MARKUP_ACTIVATE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked be ancestor {IActivatable} when deactivated.\r\n * @overloads {FocusBinding#onDectivate}\r\n */\r\nEditorPageBinding.prototype.onDeactivate = function () {\r\n\r\n\tEditorPageBinding.superclass.onDeactivate.call ( this );\r\n\r\n\tif ( this._isPreviewWindowVisible == true ) {\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.XHTML_MARKUP_DEACTIVATE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Display invalid labels in statusbar. The backend spawns a FieldsBinding\r\n * for each FieldGroupBinding, so this has been made slightly complicated.\r\n * This method is invoked whenever a FieldsBinding reports invalid or valid.\r\n * @param {boolean} isShow\r\n */\r\nEditorPageBinding.prototype._updateStatusBar = function () {\r\n\r\n\tvar labels = new List ();\r\n\tthis._invalidBindings.each ( function ( key, binding ) {\r\n\t\tvar list = binding.getInvalidLabels ();\r\n\t\tif ( list ) {\r\n\t\t\tlist.each ( function ( label ) {\r\n\t\t\t\tlabels.add ( label );\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\tif ( labels.hasEntries ()) {\r\n\t\tvar output = \"\";\r\n\t\twhile ( labels.hasNext ()) {\r\n\t\t\toutput += labels.getNext ().toLowerCase ();\r\n\t\t\tif ( labels.hasNext ()) {\r\n\t\t\t\toutput += \", \";\r\n\t\t\t} else {\r\n\t\t\t\toutput += \".\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar string = StringBundle.getString ( \"ui\", \"Website.App.StatusBar.ErrorInField\" );\r\n\t\tStatusBar.error ( string + \" \" + output );\r\n\t} else {\r\n\t\tStatusBar.clear ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Start preview process. This can be invoked by either a tab selection\r\n * or when the page inititalizes (if the tab is preselected).\r\n */\r\nEditorPageBinding.prototype._startPreview = function () {\r\n\r\n\t//Application.lock ( this ); // unlocked when preview is loaded\r\n\tthis._isGeneratingPreview = true;\r\n\r\n\tif ( Client.isPrism ) {\r\n\t\tPrism.disableCache (); // enable new-version lookup!\r\n\t}\r\n\r\n\tthis._windowBinding.setURL ( WindowBinding.POSTBACK_URL );\r\n}\r\n\r\n/**\r\n * Stop preview.\r\n */\r\nEditorPageBinding.prototype._stopPreview = function () {\r\n\r\n\tthis._windowBinding.reset ();\r\n\t//if ( Application.isLocked ) { // occurs on rapid tabshift using keyboard\r\n\t//\tApplication.unlock ( this );\r\n\t//}\r\n}\r\n\r\n/**\r\n * Enable-disable save button.\r\n * @param {boolean} isEnable\r\n */\r\nEditorPageBinding.prototype.enableSave = function ( isEnable ) {\r\n\r\n\tvar broadcasterElement = this.bindingDocument.getElementById ( \"broadcasterCanSave\" );\r\n\tif ( broadcasterElement ) {\r\n\t\tvar broadcasterBinding = UserInterface.getBinding ( broadcasterElement );\r\n\t\tif ( isEnable ) {\r\n\t\t\tbroadcasterBinding.enable ();\r\n\t\t} else {\r\n\t\t\tbroadcasterBinding.disable ();\r\n\t\t}\r\n\t} else {\r\n\t\tthrow new Error ( \"A required BroadcasterBinding could not be located.\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Manually enable saveas button (observes same broadcaster as save button).\r\n */\r\nEditorPageBinding.prototype.enableSaveAs = function () {\r\n\r\n\tvar button = this.bindingDocument.getElementById (\r\n\t\tEditorPageBinding.ID_SAVEASBUTTON\r\n\t);\r\n\tif ( button != null ) {\r\n\t\tUserInterface.getBinding ( button ).enable ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle invalid data.\r\n * TODO: Something intelligent.\r\n */\r\nEditorPageBinding.prototype.handleInvalidData = function () {\r\n\r\n\tthis.logger.error ( \"INVALID DATA :(\" );\r\n\tif ( this._isGeneratingPreview ) {\r\n\t\tthis._isGeneratingPreview = false;\r\n\t\tthis._windowBinding.error ();\r\n\t\tthis._message = null;\r\n\t\tthis._messengers = new List ();\r\n\t\tApplication.unlock ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Generate preview.\r\n */\r\nEditorPageBinding.prototype._generatePreview = function () {\r\n\r\n\tvar title = this._windowBinding.getContentDocument ().title;\r\n\r\n\tif ( title == WindowBinding.POSTBACK_TITLE ) {\r\n\r\n\t\tif ( this.validateAllDataBindings ()) {\r\n\r\n\t\t\tthis.manifestAllDataBindings ();\r\n\r\n\t\t\t/*\r\n\t\t\t * Collect form data for postback into alien document.\r\n\t\t\t * Notice that __EVENTTARGET data is handled manually.\r\n\t\t\t */\r\n\t\t\tvar callbackid = this._tabBinding.getCallBackID ();\r\n\r\n\t\t\tvar list = new List ();\r\n\t\t\tnew List ( this.bindingDocument.forms [ 0 ].elements ).each (\r\n\t\t\t\tfunction ( element ) {\r\n\t\t\t\t\tif ( element.name == \"__EVENTTARGET\" && callbackid ) {\r\n\t\t\t\t\t\telement.value = callbackid;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlist.add ({\r\n\t\t\t\t\t\tname : element.name,\r\n\t\t\t\t\t\tvalue : element.value\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\t/*\r\n\t\t\t * Submit to iframe. Note that we store the\r\n\t\t\t * list in a variable for later use.\r\n\t\t\t */\r\n\t\t\tvar url = String ( this.bindingDocument.location );\r\n\t\t\tthis._windowBinding.getContentWindow ().submit ( list, url );\r\n\t\t\tthis._latestPostbackList = list.reset ();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.handleInvalidData ();\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/pages/MarkupAwarePageBinding.js",
    "content": "MarkupAwarePageBinding.prototype = new PageBinding;\r\nMarkupAwarePageBinding.prototype.constructor = MarkupAwarePageBinding;\r\nMarkupAwarePageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction MarkupAwarePageBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"MarkupAwarePageBinding\" );\r\n\t\r\n\t/*\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isActivated = false;\r\n\t\r\n\t/*\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isWaiting = false;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nMarkupAwarePageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[MarkupAwarePageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBeforePageInitialize}\r\n */\r\nMarkupAwarePageBinding.prototype.onBeforePageInitialize = function () {\r\n\t\r\n\tMarkupAwarePageBinding.superclass.onBeforePageInitialize.call ( this );\r\n\t\r\n\tthis.subscribe ( BroadcastMessages.XHTML_MARKUP_ON );\r\n\tthis.subscribe ( BroadcastMessages.XHTML_MARKUP_OFF );\r\n\tthis.subscribe ( BroadcastMessages.XHTML_MARKUP_ACTIVATE );\r\n\tthis.subscribe ( BroadcastMessages.XHTML_MARKUP_DEACTIVATE );\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @overloads {PageBinding#handleBroadcast}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nMarkupAwarePageBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tMarkupAwarePageBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tvar self = this;\r\n\r\n\tswitch (broadcast) {\r\n\t\tcase BroadcastMessages.XHTML_MARKUP_ON:\r\n\t\t\tthis._activate(true);\r\n\t\t\tthis._handleMarkup(arg);\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.XHTML_MARKUP_OFF:\r\n\t\t\tthis._activate(false);\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.XHTML_MARKUP_ACTIVATE:\r\n\t\t\tthis._isWaiting = true;\r\n\t\t\tthis._activate(true);\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tself._isWaiting = false;\r\n\t\t\t}, 20);\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.XHTML_MARKUP_DEACTIVATE:\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tif (!self._isActivated) {\r\n\t\t\t\t\tself._activate(false);\r\n\t\t\t\t}\r\n\t\t\t}, 0);\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Mark panel activated.\r\n * @overloads {PageBinding#onActivate}\r\n */\r\nMarkupAwarePageBinding.prototype.onActivate = function () {\r\n\t\r\n\tMarkupAwarePageBinding.superclass.onActivate.call ( this );\r\n\t\r\n\tthis._activate ( true );\r\n\tthis._isActivated = true;\r\n}\r\n\r\n/**\r\n * Unmark panel activated.\r\n * @overloads {PageBinding#onDeactivate}\r\n */\r\nMarkupAwarePageBinding.prototype.onDeactivate = function () {\r\n\t\r\n\tMarkupAwarePageBinding.superclass.onDeactivate.call ( this );\r\n\t\r\n\tthis._isActivated = false;\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tif ( !self._isWaiting ) {\r\n\t\t\tself._activate ( false );\r\n\t\t}\r\n\t}, 0 );\r\n}\r\n\r\n/**\r\n * Handle markup. Subclass should define this.\r\n * @param {string} markup\r\n */\r\nMarkupAwarePageBinding.prototype._handleMarkup = function ( markup ) {}\r\n\r\n/**\r\n * Activate and deactivate whenever markup is available. Subclass should define this.\r\n * @param {boolean} isActivate\r\n */\r\nMarkupAwarePageBinding.prototype._activate = function ( isActivate ) {}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/pages/PageBinding.js",
    "content": "PageBinding.prototype = new FocusBinding;\r\nPageBinding.prototype.constructor = Binding;\r\nPageBinding.superclass = FocusBinding.prototype;\r\n\r\nPageBinding.ACTION_ATTACHED \t\t\t\t= \"page attached\";\r\nPageBinding.ACTION_DETACHED\t\t\t\t \t= \"page detached\";\r\nPageBinding.ACTION_INITIALIZED\t\t\t\t= \"page initialized\";\r\nPageBinding.ACTION_DOPOSTBACK \t\t\t\t= \"page do postback\";\r\nPageBinding.ACTION_VALIDATE \t\t\t\t= \"page validate\";\r\nPageBinding.ACTION_DOVALIDATEDPOSTBACK \t\t= \"page do validated postback\";\r\nPageBinding.ACTION_BLOCK_INIT\t\t\t\t= \"page block init\";\r\nPageBinding.ACTION_UNBLOCK_INIT\t\t\t\t= \"page unblock init\";\r\nPageBinding.ACTION_UPDATING\t\t\t\t\t= \"page updating\";\r\nPageBinding.ACTION_UPDATED\t\t\t\t\t= \"page updated\";\r\nPageBinding.ACTION_GETMESSAGES\t\t\t\t= \"page poll messagequeue\";\r\nPageBinding.ACTION_RESPONSE\t\t\t\t\t= \"page response\";\r\n\r\n/**\r\n * Classname to be attached when page is framed inside a dialog.\r\n * @type {String}\r\n */\r\nPageBinding.CLASSNAME_SUBPAGE = \"dialogsubpage\";\r\n\r\n/**\r\n * Timeout in milliseconds before an initialized page is made\r\n * interactive. Prevents flex malfunctions and stabilizes layout.\r\n */\r\nPageBinding.TIMEOUT = 250;\r\n\r\n/**\r\n * Remeber that the page has visibility set to \"hidden\" while initializing!\r\n * @see {PageBinding#onPageInitialize}\r\n * @class\r\n */\r\nfunction PageBinding () { // Note to self: This class can safely descend from FlexBoxBinding if required.\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PageBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.label = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.toolTip = null;\r\n\r\n\t/**\r\n\t * Flippen on inititalization.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isPageBindingInitialized = false;\r\n\r\n\t/**\r\n\t * Stuff can set this property so that the\r\n\t * PageBinding doesn't have to go look for it.\r\n\t * @type {object}\r\n\t */\r\n\tthis.pageArgument = null;\r\n\r\n\t/**\r\n\t * When loaded inside a dialog, this property will be switched\r\n\t * by the containing {@link DialogPageBinding} in ancestor frame.\r\n\t * @see {DialogPageBinding#handleAction}\r\n\t * @see {PageBinding#makeDialogSubPage}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDialogSubPage = false;\r\n\r\n\t/**\r\n\t * This will override the setup mentioned above.\r\n\t * Please consider how to refactor this stuff!\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFitAsDialogSubPage = true;\r\n\r\n\t/**\r\n\t * Collecting complex bindings while page initializes.\r\n\t * Won't show the the page until this map is empty.\r\n\t * @type {Map<Binding><boolean>}\r\n\t */\r\n\tthis._initBlockers = null;\r\n\r\n\t/**Binding.ACTION_UPDATED\r\n\t * Flipped when the page is ready to initialize.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isReadyForInitialize = false;\r\n\r\n\t/**\r\n\t * The PageBinding WILL be made activation aware,\r\n\t * but not until all content is loaded.\r\n\t * @see {PageBinding#onAfterPageInitialize}\r\n\t * @implements {IActivationAware}\r\n\t * @overwrites {Binding#isActivationAware}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivationAware = false;\r\n\r\n\t/**\r\n\t * @implements {IActivationAware}\r\n\t * @overwrites {Binding#isActivationAware}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivated = false;\r\n\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isNonAjaxPage = false;\r\n\r\n\t/**\r\n\t * When a server postback is fired, this flag will be reversed to\r\n\t * prevent further postback. The flag is reversed again as soon as\r\n\t * the MesssageQueue is updated manually (not on timed interval).\r\n\t */\r\n\tthis._canPostBack = true;\r\n\r\n\t/**\r\n\t * Dissecting a simulated postback response.\r\n\t * @type {XPathResolver}\r\n\t */\r\n\tthis._responseResolver = null;\r\n\r\n\t/**\r\n\t * True while the UpdateManager is busy doing updates.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isUpdating = false;\r\n};\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[PageBinding]\";\r\n};\r\n\r\n/**\r\n * @overloads {FocusManagerBinding#onBindingRegister}\r\n */\r\nPageBinding.prototype.onBindingRegister = function () {\r\n\r\n\tPageBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\tvar root = UserInterface.getBinding ( this.bindingDocument.body );\r\n\troot.addActionListener ( RootBinding.ACTION_PHASE_3, this );\r\n\r\n\tthis.addActionListener ( PageBinding.ACTION_DOPOSTBACK );\r\n\tthis.addActionListener ( PageBinding.ACTION_DOVALIDATEDPOSTBACK );\r\n\tthis.addActionListener ( BalloonBinding.ACTION_INITIALIZE );\r\n\tthis.addActionListener ( PageBinding.ACTION_BLOCK_INIT );\r\n\tthis.addActionListener ( PageBinding.ACTION_UNBLOCK_INIT );\r\n\tthis.addActionListener ( PageBinding.ACTION_GETMESSAGES );\r\n\tthis.subscribe ( BroadcastMessages.MESSAGEQUEUE_REQUESTED );\r\n};\r\n\r\n/**\r\n * @overloads {FocusManagerBinding#onBindingAttach}\r\n */\r\nPageBinding.prototype.onBindingAttach = function () {\r\n\r\n\tPageBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tApplication.lock ( this ); // unlocked onAfterPageInitialize\r\n\tthis.parseDOMProperties ();\r\n\tthis.dispatchAction ( PageBinding.ACTION_ATTACHED ); // for ViewBinding!\r\n};\r\n\r\n/**\r\n * Cleanup on dispose.\r\n * @overloads {FocusBinding#onBindingDispose}\r\n */\r\nPageBinding.prototype.onBindingDispose = function () {\r\n\r\n\tvar root = UserInterface.getBinding ( this.bindingDocument.body );\r\n\troot.removeActionListener ( RootBinding.ACTION_PHASE_3, this );\r\n\r\n\t/*\r\n\t * Unlock GUI before we die!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n\t *\r\n\tif ( this._hasLock ) {\r\n\t\tApplication.unlock ( this );\r\n\t}\r\n\t*/\r\n\r\n\t/*\r\n\t * Die.\r\n\t */\r\n\tthis.dispatchAction ( PageBinding.ACTION_DETACHED );\r\n};\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nPageBinding.prototype.parseDOMProperties = function () {\r\n\r\n\t/*\r\n\t * These values may have been defined already,\r\n\t * for example in the setPageArgument method.\r\n\t */\r\n\tif (this.getProperty(\"label\"))\r\n\t\tthis.label = this.getProperty(\"label\");\r\n\tif( this.getProperty(\"labelfield\"))\r\n\t\tthis.labelfield =  this.getProperty(\"labelfield\");\r\n\tif (this.getProperty(\"image\"))\r\n\t\tthis.image = this.getProperty(\"image\");\r\n\tthis.toolTip = this.getProperty ( \"tooltip\" );\r\n\r\n\t/*\r\n\t * Hacked setup. Please consider how to refactor this!\r\n\t */\r\n\tif ( this.getProperty ( \"fitasdialogsubpage\" ) == false ) {\r\n\t\tthis.isFitAsDialogSubPage = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Stuff can provide this property so that the PageBinding doesn't have to\r\n * go look for it. Note that bindings *may not* have been attached when\r\n * this method is invoked.\r\n * @param {object} arg\r\n */\r\nPageBinding.prototype.setPageArgument = function ( arg ) {\r\n\r\n\t/*\r\n\t * Note that any associated dock-tab is automatically selected\r\n\t * by this. This is usually desired, but who knows...\r\n\t */\r\n\tif ( Application.isOperational ) {\r\n\t\tthis.dispatchAction ( DockPanelBinding.ACTION_FORCE_SELECT );\r\n\t}\r\n\tthis.pageArgument = arg;\r\n};\r\n\r\n/**\r\n * For subclasses to overload. Primarily with the intention of\r\n * prolonging the invocation of <code>onPageInitialize</code>\r\n * for some reason (waiting for iframes to load and stuff).\r\n * Note that all bindings (in this bindingWindow) has been\r\n * fully attached when this method is invoked.\r\n * @param {object} arg\r\n */\r\nPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\t/*\r\n\t * When overloading, place your code around\r\n\t * here and invoke the super method lastly.\r\n\t */\r\n\tthis._isReadyForInitialize = true;\r\n\tif ( this._initBlockers == null ) {\r\n\t\tthis.onPageInitialize ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Invoked when everything is loaded satisfactorily.\r\n * @see {StageDialogBinding#_handleInitializedPageBinding}\r\n * @see {DockBinding#_setupPageBindingListeners}\r\n */\r\nPageBinding.prototype.onPageInitialize = function () {\r\n\r\n\tif ( !this._isPageBindingInitialized ) {\r\n\r\n\t\t/*\r\n\t\t * Flag initialized.\r\n\t\t */\r\n\t\tthis._isPageBindingInitialized = true;\r\n\r\n\t\t/*\r\n\t\t * Modify dot net setup.\r\n\t\t */\r\n\t\tif ( this._isDotNet ()) {\r\n\t\t\tthis._setupDotNet ();\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Populate DataBindings from DataBindingMap.\r\n\t\t * TODO: move this to separate method?\r\n\t\t */\r\n\t\tif ( this.pageArgument && this.pageArgument instanceof DataBindingMap ) {\r\n\t\t\tthis.bindingWindow.DataManager.populateDataBindings ( this.pageArgument );\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Dispatching an Action to be intercepted by ancestor bindings.\r\n\t\t * The ancestor will then invoke the reflex method on the page.\r\n\t\t * Timeouts stabilize the layout while page initializes. Be careful\r\n\t\t * not to dispose the PageBinding during timeouts!\r\n\t\t * TODO: move to special method so that DialogPageBinding can handle itself!\r\n\t\t */\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\ttry {\r\n\t\t\t\tif ( Binding.exists ( self ) == true ) {\r\n\t\t\t\t\tself.bindingElement.style.visibility = \"visible\";\r\n\t\t\t\t\tself.dispatchAction ( PageBinding.ACTION_INITIALIZED );\r\n\t\t\t\t\tself.onAfterPageInitialize ();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tApplication.unlock ( Application, true ); // something wrong - force unlock\r\n\t\t\t\t\tSystemLogger.getLogger ( \"PageBinding\" ).warn (\r\n\t\t\t\t\t\t\"Premature PageBinding dispose? Please consult your developer.\"\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t} catch ( exception ) {\r\n\t\t\t\tself.logger.error ( exception );\r\n\t\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\t\tthrow exception;\r\n\t\t\t}\r\n\t\t}, PageBinding.TIMEOUT );\r\n\r\n\t} else {\r\n\r\n\t\tif ( Client.isExplorer == true ) {\r\n\t\t\tthis.logger.error ( \"PageBinding: Somehow initialized twice\" );\r\n\t\t\tthis.logger.error ( arguments.caller.callee.toString ());\r\n\t\t} else {\r\n\t\t\tthrow \"PageBinding: Somehow initialized twice\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * After page initialize. Focus first focusable binding and unlock Application.\r\n * @see {FocusBinding#_initializeFocus}\r\n */\r\nPageBinding.prototype.onAfterPageInitialize = function () {\r\n\r\n\tthis.removeActionListener ( PageBinding.ACTION_BLOCK_INIT );\r\n\tthis.removeActionListener ( PageBinding.ACTION_UNBLOCK_INIT );\r\n\r\n\t/*\r\n\t * Must unlock first so that Explorer can handle focus properly.\r\n\t */\r\n\tApplication.unlock ( this );\r\n\r\n\t/*\r\n\t * Enable activation awareness.\r\n\t */\r\n\tthis.isActivationAware = true;\r\n\tvar root = UserInterface.getBinding ( this.bindingDocument.body );\r\n\troot.makeActivationAware ( this );\r\n\r\n\t/*\r\n\t * When loaded, this will force any ancestor FocusBinding to move focus\r\n\t * to us. For this to make sense, this PageBinding should be loaded inside\r\n\t * a WindowBinding occupying ALL visible space. This may need rethinking.\r\n\t */\r\n\tif ( UserInterface.isBindingVisible ( this )) {\r\n\t\tthis.dispatchAction ( FocusBinding.ACTION_FOCUS );\r\n\t}\r\n};\r\n\r\n/**\r\n * Invoked by the DocumentUpdatePlugin before any updates are applied.\r\n */\r\nPageBinding.prototype.onBeforeUpdates = function () {\r\n\r\n\tthis._isUpdating = true;\r\n\tthis.dispatchAction ( PageBinding.ACTION_UPDATING );\r\n};\r\n\r\n/**\r\n * Invoked by the DocumentUpdatePlugin after all updates are applied.\r\n */\r\nPageBinding.prototype.onAfterUpdates = function () {\r\n\r\n\tthis.parseDOMProperties();\r\n\tthis._isUpdating = false;\r\n\tthis.dispatchAction ( PageBinding.ACTION_UPDATED );\r\n};\r\n\r\n/**\r\n * Invoked when a page gets iframed inside a dialog.\r\n * Invoked by the {@link DialogPageBinding}.\r\n */\r\nPageBinding.prototype.makeDialogSubPage = function () {\r\n\r\n\tif ( this.isFitAsDialogSubPage ) {\r\n\t\tif ( Client.isExplorer ) {\r\n\t\t\tthis.setFlexibility ( true ); // since IE has no min-height...\r\n\t\t}\r\n\t\tthis.attachClassName ( PageBinding.CLASSNAME_SUBPAGE );\r\n\t\tthis.isDialogSubPage = true;\r\n\t}\r\n};\r\n\r\n/**\r\n * The global function \"doPostBack\" is overloaded in order\r\n * to manifest databindings reliably on every scripted submit.\r\n */\r\nPageBinding.prototype._setupDotNet = function () {\r\n\r\n\tvar self = this;\r\n\tvar form = this.bindingDocument.forms [ 0 ];\r\n\tvar oldPostBack = this.bindingWindow.__doPostBack;\r\n\tvar isLocked = false;\r\n\r\n\t/*\r\n\t * Unlock UI when page unloads (see below).\r\n\t * TODO: Remove this when dialogs go AJAX.\r\n\t * form.__isSetup was set by UpdateManager.\r\n\t */\r\n\tif (!form.__isSetup && this.isNonAjaxPage) {\r\n\t\tDOMEvents.addEventListener ( this.bindingWindow, DOMEvents.UNLOAD, {\r\n\t\t\thandleEvent : function () {\r\n\t\t\t\tif ( isLocked ) {\r\n\t\t\t\t\tApplication.unlock ( self );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\t/*\r\n\t * Setup postback.\r\n\t * @param {string} eventTarget\r\n\t * @param {string} eventArgument\r\n\t */\r\n\tthis.bindingWindow.__doPostBack = function ( eventTarget, eventArgument ) {\r\n\r\n\t\t/*\r\n\t\t * For non-AJAX pages (dialogs and wizards),\r\n\t\t * this stunt will lock the UI on form submit.\r\n\t\t */\r\n\t\tif ( !form.__isSetup && self.isNonAjaxPage) {\r\n\t\t\tApplication.lock ( self );\r\n\t\t\tisLocked = true;\r\n\t\t}\r\n\r\n\t\tself.manifestAllDataBindings ();\r\n\t\toldPostBack ( eventTarget, eventArgument );\r\n\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\tself._debugDotNetPostback ();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Post message in this window.\r\n * @param {String} message The message to post\r\n * @param {List<Binding>} list Collected by the EditorPageBinding.\r\n */\r\nPageBinding.prototype.postMessage = function ( message, list ) {\r\n\r\n\tvar postback = this.bindingWindow.bindingMap.__REQUEST;\r\n\r\n\tif ( postback != null && this._isDotNet ()) {\r\n\r\n\t\tswitch ( message ) {\r\n\t\t\tcase EditorPageBinding.MESSAGE_SAVE :\r\n\t\t\tcase EditorPageBinding.MESSAGE_PERSIST :\r\n\t\t\t\tif ( this.bindingWindow.DataManager.isDirty ) {\r\n\t\t\t\t\tif ( this.validateAllDataBindings ()) {\r\n\t\t\t\t\t\tif ( list != null ) {\r\n\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\t\t\t\t\tvar action = message == EditorPageBinding.MESSAGE_SAVE ? \"SAVING \" : \"PERSISTING \";\r\n\t\t\t\t\t\t\t\talert ( action + this.bindingDocument.title );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t\tlist.add ( this );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpostback.postback ( message );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tpostback.postback ( message );\r\n\t\t\t\tbreak;\r\n\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * If the List was contained in argument, the post was\r\n\t * initiated by the EditorPageBinding, in which case\r\n\t * we must repost the message to descendant windows...\r\n\t */\r\n\tif ( list != null ) {\r\n\t\tthis._postMessageToDescendants ( message, list );\r\n\t}\r\n}\r\n\r\n/**\r\n * Post message in descendant windows recursively ad infinitum and for ever.\r\n * @param {String} message The message to post\r\n * @param {List<Binding>} list Collected by the EditorPageBinding.\r\n */\r\nPageBinding.prototype._postMessageToDescendants = function ( message, list ) {\r\n\r\n\t// TODO: getElementsByTagName ( \"iframe\" ).parentNode to improve performance?\r\n\tvar windows = this.getDescendantBindingsByType ( WindowBinding );\r\n\twindows.each ( function ( win ) {\r\n\t\tvar page = win.getPageBinding ();\r\n\t\tif ( page != null ) {\r\n\t\t\tpage.postMessage ( message, list );\r\n\t\t}\r\n\t});\r\n}\r\n\r\n\r\n/**\r\n * Log postback entries.\r\n */\r\nPageBinding.prototype._debugDotNetPostback = function () {\r\n\r\n\tvar list = new List ();\r\n\tnew List ( this.bindingDocument.forms [ 0 ].elements ).each (\r\n\t\tfunction (element) {\r\n\t\t\tif (element.name == null || element.name == \"\") return;\r\n\t\t\tlist.add ({\r\n\t\t\t\tname : element.name,\r\n\t\t\t\tvalue : element.value\r\n\t\t\t});\r\n\t\t}\r\n\t);\r\n\tvar out = \"\";\r\n\tlist.each ( function ( entry ) {\r\n\t\tout += entry.name + \": \" + entry.value + \"\\n\";\r\n\t});\r\n\tthis.logger.debug ( out );\r\n};\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {FocusBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nPageBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tPageBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\tswitch ( action.type ) {\r\n\r\n\t\tcase RootBinding.ACTION_PHASE_3 :\r\n\t\t\tif ( binding == UserInterface.getBinding ( this.bindingDocument.body )) {\r\n\t\t\t\tbinding.removeActionListener ( RootBinding.ACTION_PHASE_3, this );\r\n\t\t\t\tif ( !this._isPageBindingInitialized ) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tthis.onBeforePageInitialize ();\r\n\t\t\t\t\t} catch ( exception ) {\r\n\t\t\t\t\t\talert ( exception );\r\n\t\t\t\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\t\t\t\tthrow exception;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_DOPOSTBACK :\r\n\r\n\t\t \tif ( this._isDotNet ()) {\r\n\t\t\t\tthis.doPostBack ( binding );\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_DOVALIDATEDPOSTBACK :\r\n\r\n\t\t\tif ( this._isDotNet ()) {\r\n\t\t\t\tvar isValid = this.validateAllDataBindings ();\r\n\t\t\t\tif ( isValid ) {\r\n\t\t\t\t\tthis.doPostBack ( binding );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase BalloonBinding.ACTION_INITIALIZE :\r\n\r\n\t\t\t// TODO: note here...\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_BLOCK_INIT :\r\n\t\t\tif ( this._initBlockers == null ) {\r\n\t\t\t\tthis._initBlockers = new Map ();\r\n\t\t\t}\r\n\t\t\tthis._initBlockers.set ( binding.key, true );\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_UNBLOCK_INIT :\r\n\r\n\t\t\tif ( this._initBlockers != null ) {\r\n\t\t\t\tif ( this._initBlockers.has ( binding.key )) {\r\n\t\t\t\t\tthis._initBlockers.del ( binding.key );\r\n\t\t\t\t\tif ( !this._initBlockers.hasEntries ()) {\r\n\t\t\t\t\t\tthis._initBlockers = null;\r\n\t\t\t\t\t\tif ( this._isReadyForInitialize == true ) {\r\n\t\t\t\t\t\t\tvar self = this;\r\n\t\t\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\t\t\tself.onBeforePageInitialize (); // push thread to completely stabilize\r\n\t\t\t\t\t\t\t}, 0 );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * WAS THIS\r\n\t\t\t *\r\n\t\t\tif ( this._initBlockers.has ( binding.key )) {\r\n\t\t\t\tthis._initBlockers.del ( binding.key );\r\n\t\t\t}\r\n\t\t\tif ( !this._initBlockers.hasEntries ()) {\r\n\t\t\t\tthis._initBlockers = null;\r\n\t\t\t\tif ( this._isReadyForInitialize == true ) {\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\tself.onBeforePageInitialize (); // push thread to completely stabilize\r\n\t\t\t\t\t}, 0 );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * TODO: move this stuff into proper methods.\r\n\t\t */\r\n\t\tcase PageBinding.ACTION_GETMESSAGES :\r\n\t\t\tif ( UpdateMananger.isUpdating ) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tvar handler = {\r\n\t\t\t\t\thandleAction : function ( action ) {\r\n\t\t\t\t\t\tif ( action.target == self ) {\r\n\t\t\t\t\t\t\tself.removeActionListener ( PageBinding.ACTION_UPDATED, handler );\r\n\t\t\t\t\t\t\tMessageQueue.udpdate ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.addActionListener ( PageBinding.ACTION_UPDATED, handler );\r\n\t\t\t} else {\r\n\t\t\t\tMessageQueue.udpdate ();\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nPageBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tPageBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\r\n\t\t/*\r\n\t\t * This broadcast means that we can unlock a\r\n\t\t * page that was performing a postback.\r\n\t\t */\r\n\t\tcase BroadcastMessages.MESSAGEQUEUE_REQUESTED :\r\n\t\t\tvar isAutoUpdate = arg;\r\n\t\t\tif ( !this._canPostBack && !isAutoUpdate ) {\r\n\t\t\t\tthis._canPostBack = true;\r\n\t\t\t\tApplication.unlock ( this );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n/**\r\n * To dot or not dot net.\r\n * @return {boolean}\r\n */\r\nPageBinding.prototype._isDotNet = function () {\r\n\r\n\tvar form = this.bindingDocument.forms [ 0 ];\r\n\r\n\treturn (\r\n\t\tform != null &&\r\n\t\ttypeof this.bindingWindow.__doPostBack != \"undefined\"\r\n\t);\r\n};\r\n\r\n/**\r\n * Do postback.\r\n * @param {binding} binding This lucky bindings callbackid will be transmitted to server.\r\n */\r\nPageBinding.prototype.doPostBack = function ( binding ) {\r\n\r\n\tif ( this._canPostBack ) {\r\n\t\tif ( binding != null && this._isDotNet ()) {\r\n\r\n\t\t\tvar callbackid = binding.getCallBackID ();\r\n\t\t\tvar callbackarg = binding.getCallBackArg ();\r\n\r\n\t\t\t/*\r\n\t\t\t * Did some guy use ClientID instead of UniqueID?\r\n\t\t\t */\r\n\t\t\tif ( callbackid != null ) {\r\n\t\t\t\tcallbackid = callbackid.replace ( /_/g, \"$\" );\r\n\t\t\t} else {\r\n\t\t\t\tcallbackid = \"\";\r\n\t\t\t}\r\n\r\n\t\t\tif ( callbackarg == null ) {\r\n\t\t\t\tcallbackarg = \"\";\r\n\t\t\t}\r\n\r\n\t\t\tthis.bindingWindow.__doPostBack ( callbackid, callbackarg );\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Validate all attached DataBindings. Discontinue validation\r\n * as soon as the first invalid binding is encountered.\r\n * @return {boolean}\r\n */\r\nPageBinding.prototype.validateAllDataBindings = function (activateTabWidthError) {\r\n\r\n\tvar isValid = true;\r\n\tvar dataBindings = this.bindingWindow.DataManager.getAllDataBindings();\r\n\r\n\twhile (dataBindings.hasNext() && isValid) {\r\n\t\tvar dataBinding = dataBindings.getNext();\r\n\t\tif (dataBinding.isAttached) { // could be nested in lazy binding\r\n\t\t\tvar isBindingValid = dataBinding.validate();\r\n\t\t\tif (isValid && !isBindingValid) {\r\n\t\t\t\tisValid = false;\r\n\t\t\t\tthis.logger.debug(\"Invalid DataBinding: \" + dataBinding.toString() + \" (\" + dataBinding.getName() + \")\");\r\n\t\t\t\tif (activateTabWidthError) {\r\n\t\t\t\t\tvar tabPanelBinding = dataBinding.getAncestorBindingByType(TabPanelBinding);\r\n\t\t\t\t\tif (tabPanelBinding != null && !tabPanelBinding.isVisible) {\r\n\t\t\t\t\t\tvar tabBoxBinding = tabPanelBinding.getAncestorBindingByType(TabBoxBinding);\r\n\t\t\t\t\t\tvar tabBinding = tabBoxBinding.getTabBinding(tabPanelBinding);\r\n\t\t\t\t\t\ttabBoxBinding.select(tabBinding);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\treturn isValid;\r\n};\r\n\r\n/**\r\n * Manifest all attached DataBindings.\r\n * This should always be invoked preceding server postback.\r\n * @return {List}\r\n */\r\nPageBinding.prototype.manifestAllDataBindings = function () {\r\n\r\n\tvar list = new List ();\r\n\tvar dataBindings = this.bindingWindow.DataManager.getAllDataBindings ();\r\n\r\n\twhile ( dataBindings.hasNext ()) {\r\n\t\tvar dataBinding = dataBindings.getNext ();\r\n\t\tif ( dataBinding.isAttached ) { // could be nested in lazy binding\r\n\t\t\tvar result = dataBinding.manifest ();\r\n\t\t\tif ( result != null ) {\r\n\t\t\t\tlist.add ( result );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn list;\r\n};\r\n\r\n/**\r\n * Clean all DataBindings.\r\n */\r\nPageBinding.prototype.cleanAllDataBindings = function () {\r\n\r\n\t// this.bindingWindow.DataManager.isDirty = false;\r\n\r\n\tvar dataBindings = this.bindingWindow.DataManager.getAllDataBindings ();\r\n\twhile ( dataBindings.hasNext ()) {\r\n\t\tvar dataBinding = dataBindings.getNext ();\r\n\t\tif ( dataBinding.isAttached ) { // otherwise still clean\r\n\t\t\tdataBinding.clean ();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Implements {ILabel}\r\n * @return {string}\r\n */\r\nPageBinding.prototype.getLabel = function () {\r\n\r\n\tvar label = \"\";\r\n\tif (!label && this.labelfield){\r\n\t\tvar binding = this.bindingWindow.DataManager.getDataBinding(this.labelfield);\r\n\t\tif (binding != null && binding.getLabel) {\r\n\t\t\tlabel = binding.getLabel();\r\n\t\t} else if (binding != null && binding.getValue) {\r\n\t\t\tlabel = binding.getValue();\r\n\t\t}\r\n\t}\r\n\tif (!label && this.label) {\r\n\t\tlabel = this.label;\r\n\t}\r\n\r\n\treturn label;\r\n};\r\n\r\n/**\r\n * Implements {ILabel}\r\n * @return {string}\r\n */\r\nPageBinding.prototype.getImage = function () {\r\n\r\n\treturn this.image;\r\n};\r\n\r\n/**\r\n * Implements {ILabel}\r\n * @return {string}\r\n */\r\nPageBinding.prototype.getToolTip = function () {\r\n\r\n\treturn this.toolTip;\r\n};\r\n\r\n/**\r\n * Relevant for dialog sub pages??????????????????????\r\n * @return {int}\r\n */\r\nPageBinding.prototype.getHeight = function () {\r\n\r\n\treturn this.bindingElement.offsetHeight;\r\n};\r\n\r\n/**\r\n * Focus last focused binding when the containing {@link IActivatable} gets activated.\r\n * @see {DockBinding#activate}\r\n * @see {DialogBinding#activate}\r\n * @see {FocusBinding#setActiveInstance}\r\n */\r\nPageBinding.prototype.onActivate = function () {\r\n\r\n\tif ( Binding.exists ( this )) { // the devils!\r\n\t\tif ( !this.isActivated ) {\r\n\t\t\tthis.isActivated = true;\r\n\t\t\tif ( this._isFocusManager ) {\r\n\t\t\t\tif ( UserInterface.isBindingVisible ( this )) {\r\n\t\t\t\t    /*\r\n\t\t\t\t    * For some strange reason, Explorer has lost\r\n\t\t\t\t    * the ability to focus inputs reliably unless\r\n\t\t\t\t    * focus was moved to something else first...\r\n\t\t\t\t    */\r\n\t\t\t\t    try {\r\n\t\t\t\t        var win = this.bindingWindow;\r\n\t\t\t\t        win.focus(); // this seems to fix it!\r\n\t\t\t\t    } catch (exception) {\r\n\t\t\t\t        // Explorer can always find an exception for the focus event...\r\n\t\t\t\t    }\r\n\t\t\t\t\tif ( this._cachedFocus != null ) {\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t * Timeout allows any mouse-targetted\r\n\t\t\t\t\t\t * focusable to focus first.\r\n\t\t\t\t\t\t */\r\n\t\t\t\t\t\tvar self = this;\r\n\t\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\t\tif ( FocusBinding.focusedBinding == null ) {\r\n\t\t\t\t\t\t\t\tself._focusPreviouslyFocused ();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, 0 );\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis._focusFirstFocusable ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Blur last focused binding when the containing {@link IActivatable} gets deactivated.\r\n * @see {DockBinding#deactivate}\r\n * @see {DialogBinding#deactivate}\r\n * @see {FocusBinding#setActiveInstance}\r\n */\r\nPageBinding.prototype.onDeactivate = function () {\r\n\r\n\tif ( this.isActivated == true ) {\r\n\t\tthis.isActivated = false;\r\n\t\tif ( this._cachedFocus != null ) {\r\n\t\t\tvar binding = this._cachedFocus.getBinding ();\r\n\t\t\tif ( binding ) {\r\n\t\t\t\tbinding.blur ();\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( FocusBinding.activeInstance == this ) {\r\n\t\t\tFocusBinding.activeInstance = null;\r\n\t\t}\r\n\t}\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/pages/ResponsePageBinding.js",
    "content": "﻿ResponsePageBinding.prototype = new DialogPageBinding;\r\nResponsePageBinding.prototype.constructor = ResponsePageBinding;\r\nResponsePageBinding.superclass = DialogPageBinding.prototype;\r\n\r\n/**\r\n* @class\r\n*/\r\nfunction ResponsePageBinding() {\r\n\r\n\t/**\r\n\t* @type {SystemLogger}\r\n\t*/\r\n\tthis.logger = SystemLogger.getLogger(\"ResponsePageBinding\");\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.responseid = null;\r\n}\r\n\r\n/**\r\n* Identifies binding.\r\n*/\r\nResponsePageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ResponsePageBinding]\";\r\n};\r\n\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nResponsePageBinding.prototype.parseDOMProperties = function() {\r\n\r\n\tResponsePageBinding.superclass.parseDOMProperties.call(this);\r\n\t\r\n\tvar responseid = this.getProperty(\"responseid\");\r\n\tthis.responseid = responseid;\r\n}\r\n\r\n/**\r\n* @overloads {DialogPageBinding#onBindingAttach}\r\n*/\r\nResponsePageBinding.prototype.onBindingAttach = function () {\r\n\r\n\tResponsePageBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tthis.addActionListener(ResponseBinding.ACTION_SUCCESS);\r\n\tthis.addActionListener(ResponseBinding.ACTION_FAILURE);\r\n\tthis.addActionListener(ResponseBinding.ACTION_OOOOKAY);\r\n};\r\n\r\n\r\n/**\r\n* @overloads {DialogPageBinding#handleAction}\r\n* @param {Action} action\r\n*/\r\nResponsePageBinding.prototype.handleAction = function (action) {\r\n\r\n\tResponsePageBinding.superclass.handleAction.call(this, action);\r\n\r\n\tswitch (action.type) {\r\n\r\n\t\tcase ResponseBinding.ACTION_SUCCESS:\r\n\t\t\tthis.onDialogAccept();\r\n\t\t\tbreak;\r\n\r\n\t\tcase ResponseBinding.ACTION_FAILURE:\r\n\t\t\t// server action expected!\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n/**\r\n* @overloads {DialogPageBinding#onBindingAccept}\r\n*/\r\nResponsePageBinding.prototype.onDialogAccept = function () {\r\n\r\n\tthis.response = Dialog.RESPONSE_ACCEPT;\r\n\tif (this.responseid && this.bindingDocument.getElementById(this.responseid)) {\r\n\t\tthis.result = this.bindingDocument.getElementById(this.responseid).value;\r\n\t}\r\n\r\n\tResponsePageBinding.superclass.onDialogAccept.call(this);\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/pages/WizardPageBinding.js",
    "content": "WizardPageBinding.prototype = new DialogPageBinding;\r\nWizardPageBinding.prototype.constructor = WizardPageBinding;\r\nWizardPageBinding.superclass = DialogPageBinding.prototype;\r\n\r\nWizardPageBinding.ID_NEXTBUTTON \t\t\t\t= \"nextbutton\";\r\nWizardPageBinding.ID_PREVIOUSBUTTON \t\t\t= \"previousbutton\";\r\nWizardPageBinding.ID_FINISHBUTTON \t\t\t\t= \"finishbutton\";\r\nWizardPageBinding.ACTION_NAVIGATE_NEXT \t\t\t= \"wizardnavigatenext\";\r\nWizardPageBinding.ACTION_NAVIGATE_PREVIOUS\t\t= \"wizardnavigateprevious\";\r\nWizardPageBinding.ACTION_FINISH \t\t\t\t= \"wizardfinish\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction WizardPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"WizardPageBinding\" );\r\n\t\r\n\t/**\r\n\t * Used to fix GUI lock while navigating between wizard pages.\r\n\t * @type {boolean}\r\n\t *\r\n\tthis._isNavigating = false;\r\n\t*/\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nWizardPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[WizardPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogPageBinding#onPageInitialize}\r\n */\r\nWizardPageBinding.prototype.onPageInitialize = function () {\r\n\t\r\n\tWizardPageBinding.superclass.onPageInitialize.call ( this );\r\n\t\r\n\tthis.addActionListener ( WizardPageBinding.ACTION_NAVIGATE_NEXT, this );\r\n\tthis.addActionListener ( WizardPageBinding.ACTION_NAVIGATE_PREVIOUS, this );\r\n\tthis.addActionListener ( WizardPageBinding.ACTION_FINISH, this );\r\n\t\r\n\t/*\r\n\t * TODO: These are not currently used!\r\n\t *\r\n\tthis.subscribe ( BroadcastMessages.WIZARD_NAVIGATE_NEXT );\r\n\tthis.subscribe ( BroadcastMessages.WIZARD_NAVIGATE_PREVIOUS );\r\n\tthis.subscribe ( BroadcastMessages.WIZARD_FINISH );\r\n\t*/\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overlods {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nWizardPageBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tWizardPageBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Moving forward will validate all databindings.\r\n\t\t */\r\n\t\tcase WizardPageBinding.ACTION_NAVIGATE_NEXT :\r\n\t\tcase WizardPageBinding.ACTION_FINISH :\r\n\t\t\tif ( this.validateAllDataBindings () == true ) {\r\n\t\t\t\tthis.doPostBack ( binding );\r\n\t\t\t} else {\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\t/*\r\n\t\t * Moving backwards allowed without validation.\r\n\t\t */\r\n\t\tcase WizardPageBinding.ACTION_NAVIGATE_PREVIOUS :\r\n\t\t\tthis.doPostBack ( binding );\r\n\t\t\t// dont consume - ViewBinding is listening\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase Binding.ACTION_INVALID :\r\n\t\t\tthis._enableNextAndFinish ( false );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase Binding.ACTION_VALID :\r\n\t\t\tthis._enableNextAndFinish ( true );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Enable-disable next and finish buttons.\r\n * @param {boolean} isEnable\r\n */\r\nWizardPageBinding.prototype._enableNextAndFinish = function ( isEnable ) {\r\n\t\r\n\tvar next = this.bindingWindow.bindingMap.nextbutton;\r\n\tvar finish = this.bindingWindow.bindingMap.finishbutton;\r\n\t\r\n\tif ( next ) {\r\n\t\tnext.setDisabled ( !isEnable );\r\n\t}\r\n\tif ( finish ) {\r\n\t\tfinish.setDisabled ( !isEnable );\r\n\t}\r\n}\r\n\r\n/**\r\n * Some wizard page transitions may take a looooong time, so we lock the interface  \r\n * whenever a transition is instigated. The GUI is unlocked when the page dets disposed.\r\n * @overwrites {PageBinding#doPostBack}\r\n * @see {WizardPageBinding#onBindingDispose}\r\n * @param {Binding} binding\r\n *\r\nWizardPageBinding.prototype.doPostBack = function ( binding ) {\r\n\t\r\n\tif ( this._canPostBack ) {\r\n\t\r\n\t\tWizardPageBinding.superclass.doPostBack.call ( this, binding );\r\n\t\t\r\n\t\tswitch ( binding ) {\r\n\t\t\tcase this.bindingWindow.bindingMap.nextbutton :\r\n\t\t\tcase this.bindingWindow.bindingMap.previousbutton :\r\n\t\t\tcase this.bindingWindow.bindingMap.finishbutton :\r\n\t\t\t\tthis._isNavigating = true;\r\n\t\t\t\tApplication.lock ( this ); // unlocked on dispose...\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/persistance/PersistanceBinding.js",
    "content": "PersistanceBinding.prototype = new Binding;\r\nPersistanceBinding.prototype.constructor = PersistanceBinding;\r\nPersistanceBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * Access ID for IEs \r\n * userdata behavior.\r\n */\r\nPersistanceBinding.USERDATAKEY = \"persistance\";\r\n\r\n/**\r\n * Access ID for Firefox\r\n * globalStorage object.\r\n */\r\nPersistanceBinding.GLOBALSTOREKEY = document.location.host;\r\n\r\n/**\r\n * Default persistance XML document.\r\n * Loaded for first time user.\r\n */\r\nPersistanceBinding.TEMPLATE = \"storagetemplates/persistance.xml\";\r\n\r\n/**\r\n * @class\r\n * Persistance comes bundled with an element and a binding because    \r\n * IE handles this stuff via the \"userdata behavior\". Anyway,  \r\n * it's good to externalize this code from {@link Persistance}.\r\n */\r\nfunction PersistanceBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PersistanceBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {XPathResolver}\r\n\t */\r\n\tthis._resolver = null; \r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPersistanceBinding.prototype.toString = function () {\r\n\r\n\treturn \"[PersistanceBinding]\";\r\n}\r\n\r\n/**\r\n * Get persistance.\r\n * @return {HashMap<string><HashMap<string><string>>} \r\n */\r\nPersistanceBinding.prototype.getPersistanceMap = function () {\r\n\t\r\n\tvar doc = null;\r\n\tvar map = null;\r\n\t\r\n\t/*\r\n\t * First we retrieve XML  \r\n\t * from user filesystem.\r\n\t */\r\n\tif ( Client.isExplorer == true ) {\r\n\t\tdoc = this._getDocExplorer ();\r\n\t} else {\r\n\t\tdoc = this._getDocMozilla ();\r\n\t}\r\n\t\r\n\t/*\r\n\t * Next we parse XML into a \r\n\t * hashmap like structure.\r\n\t */\r\n\tif ( doc != null ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * We store the doc on a variable \r\n\t\t * so that we can back it up later.\r\n\t\t */\r\n\t\tthis._document = doc;\r\n\t\tthis.logger.fine ( DOMSerializer.serialize ( doc, true ));\r\n\t\tmap = this._getPersistanceMap ( this._document );\r\n\t}\r\n\t\r\n\treturn map;\r\n}\r\n\r\n/**\r\n * Persist.\r\n * @param {HashMap<string><HashMap<string><string>>} map\r\n */\r\nPersistanceBinding.prototype.persist = function ( map ) {\r\n\t\r\n\tvar doc = this._getPersistanceDoc ( map );\r\n\talert ( DOMSerializer.serialize ( doc, true ));\r\n\tif ( Client.isExplorer == true ) {\r\n\t\tthis._persistDocExplorer ( doc );\r\n\t} else {\r\n\t\tthis._persistDocMozilla ( doc );\r\n\t}\r\n}\r\n\r\n/**\r\n * Parse XML document into a hashmap.\r\n * @param {DOMDocument} doc\r\n * @return {HashMap<string><HashMap<string><string>>}\r\n */\r\nPersistanceBinding.prototype._getPersistanceMap = function ( doc ) {\r\n\t\r\n\tvar map = {};\r\n\t\r\n\tif ( this._resolver == null ) {\r\n\t\tthis._resolver = new XPathResolver ();\r\n\t\tthis._resolver.setNamespacePrefixResolver ({\r\n\t\t\t\"p\" : Constants.NS_PERSISTANCE\r\n\t\t});\r\n\t}\r\n\t\r\n\tvar list = this._resolver.resolveAll ( \"p:persist\", doc.documentElement );\r\n\twhile ( list.hasNext ()) {\r\n\t\t\r\n\t\tvar persist = list.getNext ();\r\n\t\tvar id = persist.getAttribute ( \"id\" )\r\n\t\tmap [ id ] = {};\r\n\t\t\r\n\t\tvar atts = this._resolver.resolveAll ( \"p:att\", persist );\r\n\t\twhile ( atts.hasNext ()) {\r\n\t\t\t\r\n\t\t\tvar att = atts.getNext ();\r\n\t\t\tvar name = att.getAttribute ( \"name\" );\r\n\t\t\tvar value = att.getAttribute ( \"value\" );\r\n\t\t\t\r\n\t\t\tmap [ id ][ name ] = value;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn map;\r\n}\r\n\r\n/**\r\n * Parse hashmap into a XML document.\r\n * @param {HashMap<string><HashMap<string><string>>} map\r\n * @return {DOMDocument} doc\r\n */\r\nPersistanceBinding.prototype._getPersistanceDoc = function ( map ) {\r\n\t\r\n\tvar doc = this._document;\r\n\tvar elm = doc.documentElement;\r\n\t\r\n\t/*\r\n\t * Stamp the document with current build number. \r\n\t * Later builds may choose to delete persisted props.\r\n\t */\r\n\telm.setAttribute ( \"version\", Installation.versionString );\r\n\t\r\n\t/*\r\n\t * Empty document (loaded on startup).\r\n\t */\r\n\twhile ( elm.hasChildNodes ()) {\r\n\t\telm.removeChild ( elm.lastChild );\r\n\t}\r\n\t\r\n\t/*\r\n\t * Build document from map.\r\n\t */\r\n\tfor ( var id in map ) {\r\n\t\tvar persist = DOMUtil.createElementNS ( Constants.NS_PERSISTANCE, \"persist\", doc );\r\n\t\tpersist.setAttribute ( \"id\", id );\r\n\t\tfor ( var name in map [ id ]) {\r\n\t\t\tvar att = DOMUtil.createElementNS ( Constants.NS_PERSISTANCE, \"att\", doc );\r\n\t\t\tatt.setAttribute ( \"name\", name );\r\n\t\t\tatt.setAttribute ( \"value\", map [ id ][ name ]);\r\n\t\t\tpersist.appendChild ( att );\r\n\t\t}\r\n\t\telm.appendChild ( persist );\r\n\t}\r\n\t\r\n\treturn doc;\r\n}\r\n\r\n/**\r\n * Fetch the XML document in Explorer.\r\n * @return {DOMDocument}\r\n */\r\nPersistanceBinding.prototype._getDocExplorer = function () {\r\n\r\n\tthis.bindingElement.load ( PersistanceBinding.USERDATAKEY );\r\n\tvar doc = this.bindingElement.XMLDocument;\r\n\r\n\t/*\r\n\t * First time startup? Load clean \r\n\t * persistance template from filesystem.\r\n\t */\r\n\tif ( doc.documentElement.namespaceURI == \"\" ) {\r\n\t\r\n\t\tvar file = PersistanceBinding.TEMPLATE;\r\n\t\tvar text = Templates.getTemplateElementText ( file );\r\n\t\tdoc.loadXML ( text );\r\n\t\t\r\n\t\t/*\r\n\t\t * Delete the xml comment!\r\n\t\t */\r\n\t\tvar elm = doc.documentElement;\r\n\t\twhile ( elm.hasChildNodes ()) {\r\n\t\t\telm.removeChild ( elm.firstChild );\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn doc;\r\n}\r\n\r\n/**\r\n * Backup the XML document in Explorer.\r\n * @return {DOMDocument}\r\n */\r\nPersistanceBinding.prototype._persistDocExplorer = function ( doc ) {\r\n\t\r\n\tvar text = DOMSerializer.serialize ( doc, true );\r\n\tthis.bindingElement.XMLDocument.loadXML ( text );\r\n\tthis.bindingElement.save ( PersistanceBinding.USERDATAKEY );\r\n}\r\n\r\n/**\r\n * Fetch the XML document in Mozilla.\r\n * @return {DOMDocument}\r\n */\r\nPersistanceBinding.prototype._getDocMozilla = function () {\r\n\t\r\n\tdelete window.globalStorage [ PersistanceBinding.GLOBALSTOREKEY ].persistance; /* !!!!!!!!!!! */\r\n\t\r\n\tvar doc = null;\r\n\tvar serialized = window.globalStorage [ PersistanceBinding.GLOBALSTOREKEY ].persistance;\r\n\t\r\n\t/*\r\n\t * Parse the serialized storage \r\n\t * entry into a DOMDocument.\r\n\t */\r\n\tif ( serialized ) {\r\n\t\tdoc = XMLParser.parse ( serialized );\r\n\t\t\r\n\t/*\r\n\t * Fetch doc from templates,\r\n\t * removing the XML comment.\r\n\t */\r\n\t} else {\r\n\t\tvar file = PersistanceBinding.TEMPLATE;\r\n\t\tdoc = Templates.getTemplateDocument ( file );\r\n\t\tvar elm = doc.documentElement;\r\n\t\twhile ( elm.hasChildNodes ()) {\r\n\t\t\telm.removeChild ( elm.lastChild );\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn doc;\r\n}\r\n\r\n/**\r\n * Backup the XML document in Mozilla.\r\n */\r\nPersistanceBinding.prototype._persistDocMozilla = function ( doc ) {\r\n\t\r\n\t/*\r\n\t * We could - in theory - simply backup the hashmap structure. \r\n\t * But let's stick to the same setup as Internet Explorer, \r\n\t * the XML document is easier to debug and print out anyway. \r\n\t * We have to store it in serialized form...\r\n\t */\r\n\tvar serialized = DOMSerializer.serialize ( doc, true );\r\n\twindow.globalStorage [ PersistanceBinding.GLOBALSTOREKEY ].persistance = serialized;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/popups/PopupBinding.js",
    "content": "PopupBinding.prototype = new Binding;\r\nPopupBinding.prototype.constructor = PopupBinding;\r\nPopupBinding.superclass = Binding.prototype;\r\n\r\nPopupBinding.ACTION_SHOW \t\t= \"popupshow\";\r\nPopupBinding.ACTION_HIDE \t\t= \"popuphide\";\r\n\r\nPopupBinding.POSITION_TOP \t\t= \"top\";\r\nPopupBinding.POSITION_RIGHT \t= \"right\";\r\nPopupBinding.POSITION_BOTTOM \t= \"bottom\";\r\nPopupBinding.POSITION_LEFT \t\t= \"left\";\r\n\r\nPopupBinding.TYPE_NORMAL\t\t= \"normal\";\r\nPopupBinding.TYPE_FIXED\t\t\t= \"fixed\"; // scrollbars on overflow\r\nPopupBinding.FIXED_MAX\t\t\t= 7;\r\nPopupBinding.CLASSNAME_OVERFLOW = \"overflow\";\r\nPopupBinding.CLASSNAME_TEXTONLY = \"textonly\";\r\n\r\n/**\r\n * Indexing open popups.\r\n * @type {Map<string><PopupBinding>}\r\n */\r\nPopupBinding.activeInstances = new Map ();\r\n\r\n/**\r\n * Any popups open? Note that this method is only accurate\r\n * within an error margin of zero milliseconds.\r\n * @see {PopupBinding#hide}\r\n * @return {boolean}\r\n */\r\nPopupBinding.hasActiveInstances = function () {\r\n\r\n\treturn PopupBinding.activeInstances.hasEntries ();\r\n}\r\n\r\n/**\r\n * Close active popups when a mousedown or mouseup is broadcasted globally. When the\r\n * popup is associated to a ButtonBinding, an intricate setup prevents the popup\r\n * from closing as soon as it opens (since the mouse event will both open and\r\n * close the popup). Not pretty, but timing bugs were encoutered with other\r\n * methods of handling this.\r\n * @see {ButtonStateManager#handleEvent}\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg This is usually a MouseEvent but it can also be a Binding.\r\n */\r\nPopupBinding.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.MOUSEEVENT_MOUSEDOWN:\r\n\t\tcase BroadcastMessages.TOUCHEVENT_TOUCHSTART:\r\n\t\t\tif ( PopupBinding.activeInstances.hasEntries ()) {\r\n\t\t\t\tvar list = new List ();\r\n\t\t\t\tPopupBinding.activeInstances.each ( function ( key ) {\r\n\t\t\t\t\tvar popup = PopupBinding.activeInstances.get ( key );\r\n\t\t\t\t\tvar isAbort = ( arg && arg instanceof ButtonBinding && arg.popupBinding == popup );\r\n\t\t\t\t\tif ( !isAbort ) {\r\n\t\t\t\t\t\tlist.add ( popup );\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tlist.each ( function ( popup ) {\r\n\t\t\t\t\tpopup.hide ();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.KEY_ESCAPE :\r\n\t\t\tif ( PopupBinding.activeInstances.hasEntries ()) {\r\n\t\t\t\tPopupBinding.activeInstances.each ( function ( key ) {\r\n\t\t\t\t\tvar popup = PopupBinding.activeInstances.get ( key );\r\n\t\t\t\t\tpopup.hide ();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/*\r\n * Subscribing straight up.\r\n */\r\nEventBroadcaster.subscribe ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN, PopupBinding);\r\nEventBroadcaster.subscribe ( BroadcastMessages.TOUCHEVENT_TOUCHSTART, PopupBinding);\r\nEventBroadcaster.subscribe ( BroadcastMessages.KEY_ESCAPE, PopupBinding );\r\n\r\n/**\r\n * @class\r\n */\r\nfunction PopupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PopupBinding\" );\r\n\r\n\t/**\r\n\t * This should be either a MenuBodyBinding or a PopupBodyBinding.\r\n\t * @type {Binding}\r\n\t */\r\n\tthis._bodyBinding = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.position = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t * @private\r\n\t */\r\n\tthis.isVisible = false;\r\n\r\n\t/**\r\n\t * TODO: parse from markup\r\n\t * @type {function}\r\n\t */\r\n\tthis.onshow = null;\r\n\r\n\t/**\r\n\t * TODO: parse from markup\r\n\t * @type {function}\r\n\t */\r\n\tthis.onhide = null;\r\n\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis.geometry = null;\r\n\r\n\t/**\r\n\t * @see {PopupBinding#_indexMenuContent}\r\n\t * @type {HashMap<string><MenuItemBinding>}\r\n\t */\r\n\tthis._menuItems = null;\r\n\r\n\t/**\r\n\t * @see {PopupBinding#_indexMenuContent}\r\n\t * @type {HashMap<string><List<MenuGroupBinding>>}\r\n\t */\r\n\tthis._menuGroups = null;\r\n\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._menuItemCount = 0;\r\n\r\n\t/**\r\n\t * If set to fixed, scrollbars may appear.\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = PopupBinding.TYPE_NORMAL;\r\n\r\n\t/**\r\n\t * Scrollbars are go?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isOverflow = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasImages = true;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isManaged = false;\r\n\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPopupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[PopupBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nPopupBinding.prototype.onBindingAttach = function () {\r\n\r\n\tPopupBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.addActionListener ( Binding.ACTION_ATTACHED );\r\n\r\n\tthis.geometry = { // please consider erecting a class for this!\r\n\t\tx : 0,\r\n\t\ty : 0,\r\n\t\tw : 0,\r\n\t\th : 0\r\n\t}\r\n\r\n\tthis.buildDOMContent ();\r\n\tthis.parseDOMProperties ();\r\n\tthis.assignDOMEvents ();\r\n\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nPopupBinding.prototype.onBindingDispose = function () {\r\n\r\n\tPopupBinding.superclass.onBindingDispose.call ( this );\r\n\tif ( PopupBinding.activeInstances.has ( this.key )) {\r\n\t\tPopupBinding.activeInstances.del ( this.key );\r\n\t}\r\n}\r\n\r\n/**\r\n * Build DOM content. Verifies body element.\r\n */\r\nPopupBinding.prototype.buildDOMContent = function () {\r\n\r\n\tvar menubody = DOMUtil.getElementsByTagName ( this.bindingElement, \"menubody\" ).item ( 0 );\r\n\tvar popupbody = DOMUtil.getElementsByTagName ( this.bindingElement, \"popupbody\" ).item ( 0 );\r\n\r\n\tif ( menubody ) {\r\n\t\tthis._bodyBinding = UserInterface.getBinding ( menubody );\r\n\t} else if ( popupbody ) {\r\n\t\tthis._bodyBinding = UserInterface.getBinding ( popupbody );\r\n\t} else {\r\n\t\tif (this.bindingElement.childElementCount > 0) {\r\n\t\t\tthrow new Error ( this + \": DOM structure invalid.\" );\r\n\t\t} else {\r\n\t\t\tthis._bodyBinding = this.add (\r\n\t\t\t\tMenuBodyBinding.newInstance ( this.bindingDocument )\r\n\t\t\t).attach ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nPopupBinding.prototype.parseDOMProperties = function () {\r\n\r\n \tif ( !this.position ) {\r\n\t\tvar position = this.getProperty ( \"position\" );\r\n\t\tthis.position = position ? position : PopupBinding.POSITION_BOTTOM;\r\n\t}\r\n}\r\n\r\n/**\r\n * Assign DOM events.\r\n */\r\nPopupBinding.prototype.assignDOMEvents = function () {\r\n\r\n\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n\tthis.addEventListener ( DOMEvents.MOUSEUP );\r\n}\r\n\r\n/**\r\n * When adding bindings, in fact they are added to the bodybinding.\r\n * @overloads {Binding#add}\r\n * @param {Binding} binding\r\n * @returns {Binding}\r\n */\r\nPopupBinding.prototype.add = function ( binding ) {\r\n\r\n\tvar returnable = null;\r\n\tif ( this._bodyBinding ) {\r\n\t\tthis._bodyBinding.add ( binding );\r\n\t\treturnable = binding;\r\n\t} else {\r\n\t\treturnable = PopupBinding.superclass.add.call ( this, binding );\r\n\t}\r\n\treturn returnable;\r\n}\r\n\r\n/**\r\n * @overloads {Binding#add}\r\n * @param {Binding} binding\r\n * @returns {Binding}\r\n */\r\nPopupBinding.prototype.addFirst = function ( binding ) {\r\n\r\n\tvar returnable = null;\r\n\tif ( this._bodyBinding ) {\r\n\t\tthis._bodyBinding.addFirst ( binding );\r\n\t\treturnable = binding;\r\n\t} else {\r\n\t\treturnable = PopupBinding.superclass.addFirst.call ( this, binding );\r\n\t}\r\n\treturn returnable;\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nPopupBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tPopupBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\t\tcase Binding.ACTION_ATTACHED :\r\n\t\t\tif ( binding instanceof MenuItemBinding ) {\r\n\t\t\t\tthis._count ( true );\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase Binding.ACTION_DETACHED :\r\n\t\t\tif ( binding instanceof MenuItemBinding ) {\r\n\t\t\t\tthis._count ( false );\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Relevant for fixed popups.\r\n * @param {boolean} isPlus\r\n */\r\nPopupBinding.prototype._count = function ( isPlus ) {\r\n\r\n\tif ( this.type == PopupBinding.TYPE_FIXED ) {\r\n\t\tthis._menuItemCount = this._menuItemCount +  ( isPlus ? 1 : -1 );\r\n\t\tif ( !this._isOverflow ) {\r\n\t\t\tif (this._menuItemCount >= PopupBinding.FIXED_MAX) {\r\n\t\t\t\tthis.bindingElement.style.height = \"\";\r\n\t\t\t\tthis.attachClassName ( PopupBinding.CLASSNAME_OVERFLOW );\r\n\t\t\t\tthis._isOverflow = true;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif ( this._menuItemCount < PopupBinding.FIXED_MAX ) {\r\n\t\t\t\tthis.bindingElement.style.height = \"auto\";\r\n\t\t\t\tthis.detachClassName ( PopupBinding.CLASSNAME_OVERFLOW );\r\n\t\t\t\tthis._isOverflow = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Snapt to target element.\r\n * @param {DOMElement} element\r\n */\r\nPopupBinding.prototype.snapTo = function ( element ) {\r\n\r\n\tvar point = this._getElementPosition ( element );\r\n\r\n\tswitch ( this.position ) {\r\n\t\tcase PopupBinding.POSITION_TOP :\r\n\t\t\tpoint.y -= this.bindingElement.offsetHeight;\r\n\t\t\tbreak;\r\n\t\tcase PopupBinding.POSITION_RIGHT :\r\n\t\t\tpoint.x += element.offsetWidth;\r\n\t\t\tbreak;\r\n\t\tcase PopupBinding.POSITION_BOTTOM :\r\n\t\t\tpoint.y += element.offsetHeight;\r\n\t\t\tbreak;\r\n\t\tcase PopupBinding.POSITION_LEFT :\r\n\t\t\tpoint.x -= this.bindingElement.offsetWidth;\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tthis.targetElement = element;\r\n\tthis.bindingElement.style.display = \"block\";\r\n\tthis.setPosition ( point.x, point.y );\r\n}\r\n\r\n/**\r\n * Position near mouse event and show.\r\n * @param {MouseEvent} e\r\n */\r\nPopupBinding.prototype.snapToMouse = function ( e ) {\r\n\r\n\tthis.snapToPoint ( this._getMousePosition ( e ));\r\n}\r\n\r\n/**\r\n * Position near point and show.\r\n * @param {Point} point\r\n */\r\nPopupBinding.prototype.snapToPoint = function ( point ) {\r\n\r\n\tthis.bindingElement.style.display = \"block\";\r\n\tthis.setPosition ( point.x, point.y );\r\n\tthis.show ();\r\n}\r\n\r\n/**\r\n * @param {int} x\r\n * @param {int} y\r\n */\r\nPopupBinding.prototype.setPosition = function ( x, y ) {\r\n\r\n\tthis.geometry.x = x;\r\n\tthis.geometry.y = y;\r\n\r\n\tthis.bindingElement.style.left = this.geometry.x + \"px\";\r\n\tthis.bindingElement.style.top = this.geometry.y + \"px\";\r\n}\r\n\r\n/**\r\n * @return {Point}\r\n */\r\nPopupBinding.prototype.getPosition = function ( x, y ) {\r\n\r\n\treturn new Point (\r\n\t\tthis.geometry.x,\r\n\t\tthis.geometry.y\r\n\t);\r\n}\r\n\r\n/**\r\n * @returm {Dimension}\r\n */\r\nPopupBinding.prototype.getDimension = function () {\r\n\r\n\treturn new Dimension (\r\n\t\tthis.bindingElement.offsetWidth,\r\n\t\tthis.bindingElement.offsetHeight\r\n\t);\r\n}\r\n\r\n\r\n/**\r\n * Calculate position of target element. Result depends on whether or not\r\n * the target element is located in the same document as the popup element.\r\n * If not, we assume that the popup is located in the top frameset and use\r\n * universal positioning.\r\n * TODO: MenuPopupBinding overwrites this method - eliminate the _underscore!\r\n * @param {DOMElement} element\r\n * @return {object}\r\n */\r\nPopupBinding.prototype._getElementPosition = function ( element ) {\r\n\r\n\treturn element.ownerDocument == this.bindingDocument ?\r\n\t\tDOMUtil.getGlobalPosition ( element ) :\r\n\t\tDOMUtil.getUniversalPosition ( element );\r\n}\r\n\r\n/**\r\n * Calculate mouse position on click. To save calculations, result depends on whether\r\n * or not the clicked element is located in the same document as the popup element.\r\n * @param {MouseEvent} e\r\n */\r\nPopupBinding.prototype._getMousePosition = function ( e ) {\r\n\r\n\tvar element = DOMEvents.getTarget ( e );\r\n\treturn element.ownerDocument == this.bindingDocument ?\r\n\t\tDOMUtil.getGlobalMousePosition ( e ) :\r\n\t\tDOMUtil.getUniversalMousePosition ( e );\r\n}\r\n\r\n/**\r\n * Show.\r\n * @overwrites {Binding#show}\r\n */\r\nPopupBinding.prototype.show = function () {\r\n\r\n\tif ( this.isVisible == true) { // don't open an already open popup!\r\n\r\n\t\tthis.hide (); // why does this make sense?\r\n\t}\r\n\tif ( !this.isVisible ) {\r\n\r\n\t\tPopupBinding.activeInstances.set ( this.key, this );\r\n\t\tthis.bindingElement.style.display = \"block\";\r\n\r\n\t\tthis.dispatchAction ( PopupBinding.ACTION_SHOW );\r\n\t\tthis.fitOnScreen ();\r\n\t\tthis._makeVisible ( true );\r\n\r\n\t\tif ( this._bodyBinding instanceof MenuBodyBinding ) {\r\n\t\t\tthis._bodyBinding.refreshMenuGroups();\r\n\r\n\t\t\tif (!this.isManaged) {\r\n\t\t\t\tthis._bodyBinding.grabKeyboard();\r\n\t\t\t\tthis._bodyBinding.bindingElement.tabIndex = \"-1\";\r\n\t\t\t\tthis._bodyBinding.bindingElement.focus();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Enable keyboard navigation.\r\n\t\t */\r\n\t\tthis._enableTab ( true );\r\n\r\n\t}\r\n}\r\n\r\n/**\r\n * Make visible!\r\n * @param {boolean} isVisible\r\n */\r\nPopupBinding.prototype._makeVisible = function ( isVisible ) {\r\n\r\n\tvar element = this.bindingElement;\r\n\r\n\tif ( isVisible ) {\r\n\t\telement.style.visibility = \"visible\";\r\n\r\n\t} else {\r\n\t\telement.style.visibility = \"hidden\";\r\n\t\telement.style.display = \"none\";\r\n\t}\r\n\r\n\tthis.isVisible = isVisible;\r\n}\r\n\r\n/**\r\n * Enable tabbing. The timeout prevents current selection from blurring when the menu opens.\r\n * TODO: Move this method to MenuBodyBinding if and when popups are used for non-menu purposes.\r\n * TODO: Kill this method now that it turns out that none of the above fixes our problem.\r\n * @param {boolean} isEnable\r\n */\r\nPopupBinding.prototype._enableTab = function ( isEnable ) {\r\n\r\n\tvar self = this;\r\n\tvar menuItems = this.getDescendantBindingsByLocalName ( \"menuitem\" );\r\n\r\n\tsetTimeout ( function () {\r\n\t\tif ( Binding.exists ( self ) == true ) {\r\n\t\t\tmenuItems.each ( function ( menuItem ) {\r\n\t\t\t\tmenuItem.bindingElement.tabIndex = isEnable ? 0 : -1;\r\n\t\t\t});\r\n\t\t}\r\n\t}, 0 );\r\n}\r\n\r\n/**\r\n * Hide.\r\n * @overwrites {Binding#hide}\r\n\r\n */\r\nPopupBinding.prototype.hide = function () {\r\n\r\n\tthis.releaseKeyboard ();\r\n\r\n\tif ( this.isVisible ) {\r\n\r\n\t\t/*\r\n\t\tthis.bindingElement.style.visibility = \"hidden\";\r\n\t\tthis.bindingElement.style.display = \"none\";\r\n\t\t*/\r\n\t\tthis._makeVisible ( false );\r\n\t\tthis.targetElement = null;\r\n\r\n\t\tthis.dispatchAction ( Binding.ACTION_VISIBILITYCHANGED );\r\n\t\tthis.dispatchAction ( PopupBinding.ACTION_HIDE );\r\n\r\n\t\t/**\r\n\t\t * Disable keyboard navigation.\r\n\t\t */\r\n\t\tthis._enableTab ( false );\r\n\r\n\t\t/*\r\n\t\t * This hacky timeout prevents a dialog from closing on return keypress\r\n\t\t * while a selector or a dialog is being handled inside the dialog.\r\n\t\t * @see {DialogToolBarBinding#handleBroadcast}\r\n\t\t */\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tif ( !self.isVisible ) { // could have been reopened meanwhile!\r\n\t\t\t\tPopupBinding.activeInstances.del ( self.key );\r\n\t\t\t}\r\n\t\t}, 0 );\r\n\r\n\t}\r\n}\r\n\r\n/**\r\n * Dont open popups outside screen. Remember that MenuPopupBinding owerwrites this.\r\n * TODO: this adjusts position at odd times in Explorer!\r\n */\r\nPopupBinding.prototype.fitOnScreen = function () {\r\n\r\n\tvar x = this.bindingElement.offsetLeft;\r\n\tvar y = this.bindingElement.offsetTop;\r\n\tvar w = this.bindingElement.offsetWidth;\r\n\tvar h = this.bindingElement.offsetHeight;\r\n\r\n\tvar dim\t= this.bindingWindow.WindowManager.getWindowDimensions ();\r\n\tvar pos = this.boxObject.getGlobalPosition();\r\n\r\n\r\n\r\n\t/*\r\n\t * Snap to element.\r\n\t */\r\n\tif ( this.targetElement != null ) {\r\n\r\n\t\tif ( pos.y + h >= dim.h ) {\r\n\t\t\t/*\r\n\t\t\t * This is somewhat hacky - but the \"relative\" switch\r\n\t\t\t * is effective (for now) in order to hack menupopups\r\n\t\t\t */\r\n\t\t\tswitch ( CSSComputer.getPosition ( this.bindingElement.offsetParent )) {\r\n\t\t\t\tcase \"absolute\" :\r\n\t\t\t\t\ty = y - h - this.targetElement.offsetHeight;\r\n\t\t\t\t\tif (y < 0) {\r\n\t\t\t\t\t\ty = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"relative\" : // this *really* expects a menugroup...\r\n\t\t\t\t\ty = y - h + this.targetElement.offsetHeight + 9;\r\n\r\n\t\t\t\t\t//if no space in top set to the top\r\n\t\t\t\t\tvar targetPosition = DOMUtil.getGlobalPosition(this.targetElement);\r\n\t\t\t\t\tif (y + targetPosition.y < 0) {\r\n\t\t\t\t\t\ty = - targetPosition.y;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( pos.x + w >= dim.w ) {\r\n\t\t\tx -= w;\r\n\t\t\tswitch ( this.position ) {\r\n\t\t\t\tcase PopupBinding.POSITION_RIGHT :\r\n\t\t\t\t\tx -= this.targetElement.offsetWidth;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase PopupBinding.POSITION_BOTTOM :\r\n\t\t\t\t\tx += this.targetElement.offsetWidth;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t/*\r\n\t * Snap to mouse.\r\n\t */\r\n\telse {\r\n\t\tif ( pos.y + h >= dim.h ) {\r\n\t\t\ty -= h;\r\n\t\t\tif ( y < 0 ) {\r\n\t\t\t\ty = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( pos.x + w >= dim.w ) {\r\n\t\t\tx -= w;\r\n\t\t\tif ( x < 0 ) {\r\n\t\t\t\tx = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.setPosition ( x, y );\r\n}\r\n\r\n/**\r\n * Mousevents will be consumed in order not to close\r\n * the popup while handling menuitems. When clicking\r\n * a MenuItem, the mouseup event is broadcasted via\r\n * the EventBroadcaster, effectively closing the Popup.\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nPopupBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tPopupBinding.superclass.handleEvent.call ( this, e );\r\n\tDOMEvents.stopPropagation ( e );\r\n}\r\n\r\n/**\r\n * Empty content (of body).\r\n */\r\nPopupBinding.prototype.empty = function () {\r\n\r\n\tthis._bodyBinding.detachRecursive ();\r\n\tthis._bodyBinding.bindingElement.innerHTML = \"\";\r\n}\r\n\r\n/**\r\n * Grab keyboard control. This could theoretically be done automatically when\r\n * popup is opened, but this would conflict with keyboard navigation in menus\r\n * supposing it should work like os native menus.\r\n * @see {MenuBodyBinding#grabKeyboard}\r\n * @param {boolean} isDefaultAction\r\n */\r\nPopupBinding.prototype.grabKeyboard = function ( isDefaultAction ) {\r\n\r\n\t// EHM - WHO IS SUPPOSED TO CALL THIS METHOD?\r\n\r\n\t/*\r\n\t * Simpley relay keyboard control to the contained MenuBodyBinding.\r\n\t *\r\n\tif ( this._bodyBinding instanceof MenuBodyBinding ) {\r\n\t\tthis._bodyBinding.grabKeyboard ( isDefaultAction );\r\n\t}\r\n\t*/\r\n}\r\n\r\n/**\r\n * Release keyboard control.\r\n */\r\nPopupBinding.prototype.releaseKeyboard = function () {\r\n\r\n\t// alert ( \"PopupBinding.prototype.releaseKeyboard was deprecated - it seems we still use it!\" );\r\n\r\n\tif ( this._bodyBinding != null && this._bodyBinding instanceof MenuBodyBinding ) {\r\n\t\tthis._bodyBinding.releaseKeyboard ();\r\n\t}\r\n}\r\n\r\n/**\r\n * You should invoke this method manually in order to index menu content!\r\n */\r\nPopupBinding.prototype._indexMenuContent = function () {\r\n\r\n\tthis._menuItems = {};\r\n\tthis._menuGroups = {};\r\n\r\n\t// indexing menugroups\r\n\tvar list = this.getDescendantBindingsByLocalName ( \"menugroup\" );\r\n\twhile ( list.hasNext ()) {\r\n\t\tvar item = list.getNext ();\r\n\t\tvar rel = item.getProperty ( \"rel\" );\r\n\t\tif ( rel ) {\r\n\t\t\tif ( !this._menuGroups [ rel ]) {\r\n\t\t\t\tthis._menuGroups [ rel ] = new List ();\r\n\t\t\t}\r\n\t\t\tthis._menuGroups [ rel ].add ( item );\r\n\t\t}\r\n\t}\r\n\r\n\t// indexing menuitems\r\n\tlist = this.getDescendantBindingsByLocalName ( \"menuitem\" );\r\n\twhile ( list.hasNext ()) {\r\n\t\tvar item = list.getNext ();\r\n\t\tvar cmd = item.getProperty ( \"cmd\" );\r\n\t\tthis._menuItems [ cmd ] = item;\r\n\t}\r\n}\r\n\r\n/**\r\n * @see {PopupBinding#_indexMenuContent}\r\n * @return {MenuItemBinding}\r\n */\r\nPopupBinding.prototype.getMenuItemForCommand = function ( cmd ) {\r\n\r\n\tvar result = null;\r\n\r\n\tif ( this._menuItems ) {\r\n\t\tif ( this._menuItems [ cmd ]) {\r\n\t\t\tresult = this._menuItems [ cmd ];\r\n\t\t} else {\r\n\t\t\tthrow \"PopupBinding.getMenuItemForCommand: No binding for command \" + cmd;\r\n\t\t}\r\n\t} else {\r\n\t\tthrow \"Must invoke _indexMenuContent method first!\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Show text only.\r\n */\r\nPopupBinding.prototype.showTextOnly = function () {\r\n\r\n\tif (this._bodyBinding) {\r\n\t\tthis._bodyBinding.attachClassName(PopupBinding.CLASSNAME_TEXTONLY);\r\n\t\tthis.hasImages = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Show both images and text.\r\n */\r\nPopupBinding.prototype.showBoth = function () {\r\n\r\n\tif (this._bodyBinding) {\r\n\t\tthis._bodyBinding.detachClassName(PopupBinding.CLASSNAME_TEXTONLY);\r\n\t\tthis.hasImages = true;\r\n\t}\r\n}\r\n\r\n/*\r\n * Remembering that bindings may not be\r\n * attached we carefully avoid using the\r\n * getChildBindingsByLocalName method.\r\n */\r\nPopupBinding.prototype.clear = function () {\r\n\r\n\tvar bodyBinding = this._bodyBinding;\r\n\tif ( bodyBinding ) {\r\n\t\tbodyBinding.detachRecursive ();\r\n\t\tbodyBinding.bindingElement.innerHTML = \"\";\r\n\t}\r\n\r\n\tthis.bindingElement.style.height = \"auto\";\r\n\tthis.detachClassName(PopupBinding.CLASSNAME_OVERFLOW);\r\n\tthis._isOverflow = false;\r\n\tthis._menuItemCount = 0;\r\n}\r\n\r\n/**\r\n * MYBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {MYBinding}\r\n */\r\nPopupBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:popup\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, PopupBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/popups/PopupBodyBinding.js",
    "content": "PopupBodyBinding.prototype = new Binding;\r\nPopupBodyBinding.prototype.constructor = PopupBodyBinding;\r\nPopupBodyBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction PopupBodyBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PopupBodyBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPopupBodyBinding.prototype.toString = function () {\r\n\r\n\treturn \"[PopupBodyBinding]\";\r\n}\r\n\r\n/**\r\n * Emulates basic CSS support in Explorer. Invoked by the containing {@link PopupBinding}.\r\n * @param {Dimension} dim\r\n */\r\nPopupBodyBinding.prototype.setDimension = function ( dim ) {\r\n\t\r\n\tthis.getBindingElement ().style.width = new String ( dim.w ) + \"px\";\r\n}\r\n\r\n/**\r\n * PopupBodyBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {PopupBodyBinding}\r\n */\r\nPopupBodyBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:popupbody\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, PopupBodyBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/popups/PopupSetBinding.js",
    "content": "PopupSetBinding.prototype = new MenuContainerBinding;\r\nPopupSetBinding.prototype.constructor = PopupSetBinding;\r\nPopupSetBinding.superclass = MenuContainerBinding.prototype;\r\n\r\n\r\nPopupSetBinding.getPopupSet = function (ownerDocument, rel) {\r\n\r\n\tvar rootBinding = UserInterface.getBinding(ownerDocument.body);\r\n\tvar result = null;\r\n\trootBinding.getDescendantBindingsByType(PopupSetBinding).each(function(popupset) {\r\n\t\tif (popupset.getProperty(\"rel\") === rel) {\r\n\t\t\tresult = popupset;\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t});\r\n\r\n\tif (result == null) {\r\n\t\tresult = rootBinding.addFirst(PopupSetBinding.newInstance(ownerDocument));\r\n\t\tresult.setProperty(\"rel\", rel);\r\n\t\tresult.attach();\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction PopupSetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PopupSetBinding\" );\r\n\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPopupSetBinding.prototype.toString = function () {\r\n\r\n\treturn \"[PopupSetBinding]\";\r\n}\r\n\r\n/**\r\n* @overloads {Binding#onBindintAttach}\r\n*/\r\nPopupSetBinding.prototype.onBindingAttach = function () {\r\n\r\n\tPopupSetBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tif (this.bindingElement.parentNode.nodeName.toLowerCase() !== \"body\") {\r\n\t\tthis.bindingDocument.body.appendChild(this.bindingElement);\r\n\t}\r\n}\r\n\r\nPopupSetBinding.prototype.getPopupByRel = function (rel) {\r\n\r\n\tvar result = null;\r\n\r\n\tthis.getDescendantBindingsByType(PopupBinding).each(function (popup) {\r\n\t\tif (popup.getProperty(\"rel\") === rel) {\r\n\t\t\tresult = popup;\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t});\r\n\r\n\treturn result;\r\n};\r\n\r\nPopupSetBinding.prototype.createNewPopupByRel = function (rel) {\r\n\r\n\tvar popupBinding = this.getPopupByRel(rel);\r\n\r\n\tif (popupBinding) {\r\n\t\tpopupBinding.empty();\r\n\t} else {\r\n\t\tpopupBinding = this.add(\r\n\t\t\tPopupBinding.newInstance(this.bindingDocument)\r\n\t\t);\r\n\t\tpopupBinding.add(\r\n\t\t\tMenuBodyBinding.newInstance(this.bindingDocument)\r\n\t\t);\r\n\t\tpopupBinding.setProperty(\"rel\", rel);\r\n\t\tpopupBinding.attachRecursive();\r\n\t}\r\n\r\n\treturn popupBinding;\r\n}\r\n\r\n\r\n/**\r\n * PopupSetBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {PopupSetBinding}\r\n */\r\nPopupSetBinding.newInstance = function (ownerDocument) {\r\n\r\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:popupset\", ownerDocument);\r\n\treturn UserInterface.registerBinding(element, PopupSetBinding);\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/progressbar/ProgressBarBinding.js",
    "content": "ProgressBarBinding.prototype = new Binding;\r\nProgressBarBinding.prototype.constructor = ProgressBarBinding;\r\nProgressBarBinding.superclass = Binding.prototype;\r\n\r\nProgressBarBinding.WIDTH = 190;\r\nProgressBarBinding.NOTCH = 9;\r\n\r\n/**\r\n * Considered private.\r\n * @type {ProgressBarBinding}\r\n */\r\nProgressBarBinding._bindingInstance = null;\r\n\r\n/**\r\n * Notch progress.\r\n * @param {int} notches\r\n */\r\nProgressBarBinding.notch = function ( notches ) {\r\n\t\r\n\tvar bar = ProgressBarBinding._bindingInstance;\r\n\tif ( bar != null ) {\r\n\t\tbar.notch ( notches );\r\n\t}\r\n}\r\n\r\n/**\r\n * Reload progress - start from begin\r\n */\r\nProgressBarBinding.reload = function () {\r\n\tProgressBarBinding._bindingInstance._cover.setWidth(ProgressBarBinding.WIDTH);\r\n}\r\n\r\n/**\r\n * @class\r\n * This is actually quite a fake progressbar, used only on app initialization.\r\n */\r\nfunction ProgressBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ProgressBarBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {CoverBinding}\r\n\t */\r\n\tthis._cover = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nProgressBarBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ProgressBarBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nProgressBarBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tProgressBarBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tProgressBarBinding._bindingInstance = this;\r\n\t\r\n\tthis._cover = this.add ( CoverBinding.newInstance ( this.bindingDocument ));\r\n\tthis._cover.setBusy ( false );\r\n\tthis._cover.setWidth ( ProgressBarBinding.WIDTH );\r\n\tthis.shadowTree.cover = this._cover;\r\n}\r\n\r\n/**\r\n * Notch progress. Defaults to a single notch if no argument is supplied.\r\n * @param {int} notches\r\n */\r\nProgressBarBinding.prototype.notch = function ( notches ) {\r\n\t\r\n\tnotches = notches ? notches : 1;\r\n\tvar width = this._cover.getWidth () - ( ProgressBarBinding.NOTCH * notches );\r\n\tthis._cover.setWidth ( width >= 0 ? width : 0 );\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/request/RequestBinding.js",
    "content": "﻿RequestBinding.prototype = new Binding;\r\nRequestBinding.prototype.constructor = RequestBinding;\r\nRequestBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * This must be BOTH the client-id and the callback-id.\r\n * @type {String}\r\n */\r\nRequestBinding.CALLBACK_ID = \"__REQUEST\";\r\n\r\n/**\r\n * This is the client-id of the input field that we must \r\n * poluate in order to let the server know who we are...\r\n * @type {String}\r\n */\r\nRequestBinding.INPUT_ID = \"__CONSOLEID\";\r\n\r\nRequestBinding.VIEW_ID = \"__VIEWID\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction RequestBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"RequestBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nRequestBinding.prototype.toString = function () {\r\n\r\n\treturn \"[RequestBinding]\";\r\n}\r\n \r\n/**\r\n * @overloads {Binding#onBindintAttach}\r\n */\r\nRequestBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tRequestBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.setCallBackID ( RequestBinding.CALLBACK_ID );\r\n\tBinding.dotnetify ( this );\r\n\t\r\n\tvar input = this.bindingDocument.getElementById ( RequestBinding.INPUT_ID );\r\n\tif ( input != null ) {\r\n\t\tinput.value = Application.CONSOLE_ID;\r\n\t}\r\n\r\n\tinput = this.bindingDocument.getElementById(RequestBinding.VIEW_ID);\r\n\tif (input != null) {\r\n\r\n\t\tvar viewBinding = this.getAncestorBindingByType(ViewBinding, true);\r\n\t\tif (viewBinding != null && viewBinding.getHandle)\r\n\t\t{\r\n\t\t\tinput.value = viewBinding.getHandle();\r\n\t\t}\r\n\t\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Postback message. Defaults to current EditorPageBinding#message\r\n * @param {String} message\r\n */\r\nRequestBinding.prototype.postback = function ( message) {\r\n\t\r\n\tmessage = message != null ? message : EditorPageBinding.message;\r\n\tthis.shadowTree.dotnetinput.value = message;\r\n\tthis.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/response/ResponseBinding.js",
    "content": "ResponseBinding.prototype = new Binding;\r\nResponseBinding.prototype.constructor = ResponseBinding;\r\nResponseBinding.superclass = Binding.prototype;\r\n\r\nResponseBinding.ACTION_SUCCESS = \"response success\";\r\nResponseBinding.ACTION_OOOOKAY = \"response ooookay\";\r\nResponseBinding.ACTION_FAILURE = \"response failure\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ResponseBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ResponseBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nResponseBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ResponseBinding]\";\r\n}\r\n\r\n/**\r\n * Note that we evaluate status as soon as binding attaches.\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nResponseBinding.prototype.onBindingAttach = function () {\r\n\r\n\tResponseBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.propertyMethodMap [ \"checksum\" ] = this._update;\r\n\tthis._update ();\r\n}\r\n\r\n/**\r\n * Update stuff!\r\n */\r\nResponseBinding.prototype._update = function () {\r\n\r\n\t// Mark as Dirty\r\n\tif (this.getProperty(\"dirty\") === true) {\r\n\t\tthis.dispatchAction(Binding.ACTION_DIRTY);\r\n\t}\r\n\t/*\r\n\t* Any status updates? These ations get intercepted somewhere in PageBinding.\r\n\t* @see {PageBinding#_setupDotNet}\r\n\t*/\r\n\tvar status = this.getProperty(\"status\");\r\n\tif (status != null) {\r\n\t\tswitch (status) {\r\n\t\t\tcase \"success\":\r\n\t\t\t\tthis.dispatchAction(ResponseBinding.ACTION_SUCCESS);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"failure\":\r\n\t\t\t\tthis.dispatchAction(ResponseBinding.ACTION_FAILURE);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"ooookay\":\r\n\t\t\t\tthis.dispatchAction(ResponseBinding.ACTION_OOOOKAY);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t* Any messages?\r\n\t*/\r\n\tvar index = this.getProperty(\"messagequeueindex\");\r\n\tif (index != null) {\r\n\t\tif (index > MessageQueue.index) {\r\n\t\t\tMessageQueue.update(true);\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/roots/RootBinding.js",
    "content": "RootBinding.prototype = new Binding;\r\nRootBinding.prototype.constructor = RootBinding;\r\nRootBinding.superclass = Binding.prototype;\r\n\r\n/*\r\n * These actions get dispatched simultaneously on document\r\n * initialization. They have been split into three so that hosted\r\n * bindings get hook into different \"phases\" for fine-tuning.\r\n * They all get consumed by first ancestor {@link ViewBinding}.\r\n * TODO: Refactor > consume by WindowBinding.\r\n */\r\nRootBinding.ACTION_PHASE_1 = \"root init phase 1\";\r\nRootBinding.ACTION_PHASE_2 = \"root init phase 2\";\r\nRootBinding.ACTION_PHASE_3 = \"root init phase 3\";\r\n\r\n/*\r\n * Bindings can hook into these to know when the nearest ancestor\r\n * DockBinding or StageDialogBinding has been changed activation.\r\n * They both get consumed by first ancestor {@link WindowBinding}.\r\n * Alternatively, see method {RootBinding#makeActivationAware}.\r\n */\r\nRootBinding.ACTION_ACTIVATED = \"root activated\";\r\nRootBinding.ACTION_DEACTIVATED = \"root deactivated\";\r\n\r\n\r\nRootBinding.CLASSNAME_WEBKIT_DESKTOP = \"webkit-d\";\r\n\r\n/**\r\n * @class\r\n * This binds to the BODY tag!\r\n */\r\nfunction RootBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"RootBinding\" );\r\n\r\n\t/**\r\n\t * The root is always activation-aware ANYWAY!\r\n\t * TODO: normalize this scenario!\r\n\t * @implements {IActivationAware}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivationAware = false;\r\n\r\n\t/**\r\n\t * @implements {IActivationAware}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivated = false;\r\n\r\n\t/**\r\n\t * List of activation-aware bindings.\r\n\t * @type {List<IAcivationAware>}\r\n\t */\r\n\tthis._activationawares = null;\r\n\r\n\t/*\r\n\t * Returnable\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nRootBinding.prototype.toString = function () {\r\n\r\n\treturn \"[RootBinding]\";\r\n}\r\n\r\n/**\r\n * Setup to make sure that any freshly loaded window\r\n * is always flexed up from the root element.\r\n * @overloads {Binding#onBindingRegister}.\r\n */\r\nRootBinding.prototype.onBindingRegister = function() {\r\n\r\n\tRootBinding.superclass.onBindingRegister.call(this);\r\n\r\n\tthis.logger = SystemLogger.getLogger(this.bindingDocument.title.toString());\r\n\r\n\tif (this.bindingWindow.WindowManager) {\r\n\t\tthis.subscribe(this.bindingWindow.WindowManager.WINDOW_EVALUATED_BROADCAST);\r\n\t}\r\n\r\n\t/*\r\n\t * Make activation aware.\r\n\t */\r\n\tthis._activationawares = new List();\r\n\tthis.isActivated = false;\r\n\tthis._setupActivationAwareness(true);\r\n\r\n\tif (Localization.isUIRtl) {\r\n\t\tthis.setProperty(\"dir\", \"rtl\");\r\n\t\tthis.attachClassName(\"rtl\");\r\n\t}\r\n\r\n\tif (Client.isWebKit && !Client.isPad) {\r\n\t\tthis.attachClassName(RootBinding.CLASSNAME_WEBKIT_DESKTOP);\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nRootBinding.prototype.onBindingDispose = function () {\r\n\r\n\tRootBinding.superclass.onBindingDispose.call ( this );\r\n\tthis._setupActivationAwareness ( false );\r\n\tEventBroadcaster.unsubscribe (\r\n\t\tthis.bindingWindow.WindowManager.WINDOW_EVALUATED_BROADCAST,\r\n\t\tthis\r\n\t);\r\n}\r\n\r\n/**\r\n * On window load, dispatch three actions. If one binding is\r\n * required to do something before another binding, just let\r\n * them hook into different phases around here.\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nRootBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tRootBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tvar onloadBroadcast = this.bindingWindow.WindowManager.WINDOW_EVALUATED_BROADCAST;\r\n\r\n\tswitch ( broadcast ) {\r\n\t\tcase onloadBroadcast :\r\n\r\n\t\t\t/*\r\n\t\t\t * Dispatch phases.\r\n\t\t\t */\r\n\t\t\tthis.dispatchAction ( RootBinding.ACTION_PHASE_1 );\r\n\t\t\tthis.dispatchAction ( RootBinding.ACTION_PHASE_2 );\r\n\t\t\tthis.dispatchAction ( RootBinding.ACTION_PHASE_3 );\r\n\t\t\tthis.unsubscribe ( onloadBroadcast );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked when the nearest containing\r\n * {@link IActivatable} gets activated.\r\n * TODO: Disable during startup?\r\n * @implements {IActivationAware}\r\n */\r\nRootBinding.prototype.onActivate = function () {\r\n\r\n\tthis._onActivationChanged ( true );\r\n}\r\n\r\n/**\r\n * Invoked when the nearest containing\r\n * {@link IActivatable} gets deactivated.\r\n * TODO: Disable during startup?\r\n * @implements {IActivationAware}\r\n */\r\nRootBinding.prototype.onDeactivate = function () {\r\n\r\n\tthis._onActivationChanged ( false );\r\n}\r\n\r\n/**\r\n * Handle activation change.\r\n * @param {boolean} isActivated\r\n * @return\r\n */\r\nRootBinding.prototype._onActivationChanged = function ( isActivated ) {\r\n\r\n\tvar action = isActivated ? RootBinding.ACTION_ACTIVATED : RootBinding.ACTION_DEACTIVATED;\r\n\r\n\tif ( isActivated != this.isActivated ) {\r\n\r\n\t\tthis.isActivated = isActivated;\r\n\t\tthis.dispatchAction ( action );\r\n\t\tvar waste = new List ();\r\n\t\tvar self = this;\r\n\r\n\t\t/*\r\n\t\t * Bindings will cleanup themselves on disposal,\r\n\t\t * but other objects may forget to unregister\r\n\t\t * from the awareness list. We do a basic cleanup.\r\n\t\t */\r\n\t\tthis._activationawares.each ( function ( aware ) {\r\n\t\t\tif ( aware.isActivationAware ) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tif ( isActivated ) {\r\n\t\t\t\t\t\tif ( !aware.isActivated ) {\r\n\t\t\t\t\t\t\taware.onActivate ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif ( aware.isActivated ) {\r\n\t\t\t\t\t\t\taware.onDeactivate ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch ( exception ) {\r\n\t\t\t\t\tself.logger.error ( exception );\r\n\t\t\t\t\twaste.add ( aware );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/*\r\n\t\t * Cleanup waste from awareness list.\r\n\t\t */\r\n\t\twaste.each ( function ( aware ) {\r\n\t\t\tthis._activationawares.del ( aware );\r\n\t\t});\r\n\t\twaste.dispose ();\r\n\r\n\t} else {\r\n\t\tvar error = \"Activation dysfunction: \" + this.bindingDocument.title;\r\n\t\tif ( Application.isDeveloperMode == true ) {\r\n\t\t\t// alert ( error );\r\n\t\t\tthis.logger.error ( error );\r\n\t\t} else {\r\n\t\t\tthis.logger.error ( error );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Add or remove binding to be poked when activation changes.\r\n * @param {IActivationAware} binding\r\n * @param @optional {boolean} isAware\r\n */\r\nRootBinding.prototype.makeActivationAware = function ( binding, isAware ) {\r\n\r\n\tif ( Interfaces.isImplemented ( IActivationAware, binding, true ) == true ) {\r\n\t\tif ( isAware == false ) {\r\n\t\t\tthis._activationawares.del ( binding );\r\n\t\t} else {\r\n\t\t\tthis._activationawares.add ( binding );\r\n\t\t\tif ( this.isActivated == true ) {\r\n\t\t\t\tbinding.onActivate ();\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tif ( Application.isDeveloperMode == true ) {\r\n\t\t\talert ( \"RootBinding: IActivationAware not implemented (\" + binding + \")\");\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Add and remove activation awareness (on register and dispose).\r\n * @param {boolean} isSetup\r\n */\r\nRootBinding.prototype._setupActivationAwareness = function ( isSetup ) {\r\n\r\n\tvar frame = this.getMigrationParent ();\r\n\tif ( frame != null ) {\r\n\t\tvar root = frame.ownerDocument.body;\r\n\t\tvar binding = UserInterface.getBinding ( root );\r\n\t\tif ( binding != null ) {\r\n\t\t\tbinding.makeActivationAware ( this, isSetup );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Relay ascending crawle to containing document.\r\n * @implements {ICrawlerHandler}\r\n * @param {Crawler} crawler\r\n */\r\nRootBinding.prototype.handleCrawler = function ( crawler ) {\r\n\r\n\tRootBinding.superclass.handleCrawler.call ( this, crawler );\r\n\r\n\tif ( crawler.type == NodeCrawler.TYPE_ASCENDING ) {\r\n\t\tcrawler.nextNode = this.bindingWindow.frameElement;\r\n\t}\r\n}\r\n\r\n/**\r\n * Migrate the action to \"nearest\" binding in ancestor document.\r\n * @overwrites {Binding#getMigrationParent}.\r\n */\r\nRootBinding.prototype.getMigrationParent = function () {\r\n\r\n\tvar result = null;\r\n\ttry {\r\n\t\tif (this.bindingWindow.parent) {\r\n\t\t\tresult = this.bindingWindow.frameElement;\r\n\t\t}\r\n\t} catch (exception) {\r\n\t\t// MS EDGE throw 'Object expected' for some 'empty' Window properties\r\n\t}\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/roots/StyleBinding.js",
    "content": "﻿StyleBinding.prototype = new Binding;\r\nStyleBinding.prototype.constructor = StyleBinding;\r\nStyleBinding.superclass = Binding.prototype;\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StyleBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"StyleBinding\");\r\n\r\n\t/**\r\n\t * @type {HtmlElement}\r\n\t */\r\n\tthis.style = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.href = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStyleBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StyleBinding]\";\r\n}\r\n\r\n/**\r\n * Notice that the binding disposes as soon as it attaches.\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nStyleBinding.prototype.onBindingAttach = function () {\r\n\r\n\tStyleBinding.superclass.onBindingAttach.call(this);\r\n\r\n\tconsole.log(\"StyleBinding.prototype.onBindingAttach\");\r\n\r\n\tthis.href = this.getProperty(\"link\");\r\n\tthis.style = document.createElement('link');\r\n\tthis.style.rel = 'stylesheet';\r\n\tthis.style.type = 'text/css';\r\n\tthis.style.href = Resolver.resolve(this.href);\r\n\tthis.bindingDocument.getElementsByTagName('head')[0].appendChild(this.style);\r\n}\r\n\r\n/**\r\n * Handle element update.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#handleElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nStyleBinding.prototype.handleElement = function (element) {\r\n\r\n\treturn true;\r\n}\r\n\r\n/**\r\n * Update element.\r\n * @implements {IUpdateHandler}\r\n * @overwrites {Binding#updateElement}\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nStyleBinding.prototype.updateElement = function (element) {\r\n\r\n\tvar href = element.getAttribute(\"link\");\r\n\r\n\tif (this.href != href && this.style) {\r\n\t\tthis.href = href;\r\n\t\tthis.style.href = Resolver.resolve(this.href);\r\n\t}\r\n\treturn true;\r\n};\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nStyleBinding.prototype.onBindingDispose = function () {\r\n\r\n\tStyleBinding.superclass.onBindingDispose.call(this);\r\n\r\n\tif (this.style && this.style.parentNode) {\r\n\t\tthis.style.parentNode.removeChild(this.style);\r\n\t}\r\n\tthis.href = null;\r\n\tthis.style = null;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/splitboxes/SplitBoxBinding.js",
    "content": "SplitBoxBinding.prototype = new FlexBoxBinding;\r\nSplitBoxBinding.prototype.constructor = SplitBoxBinding;\r\nSplitBoxBinding.superclass = FlexBoxBinding.prototype;\r\nSplitBoxBinding.ORIENT_HORIZONTAL = \"horizontal\";\r\nSplitBoxBinding.ORIENT_VERTICAL = \"vertical\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SplitBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SplitBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * Defaults to horizontal layout.\r\n\t * @type {string}\r\n\t */\r\n\tthis._orient = SplitBoxBinding.ORIENT_HORIZONTAL;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isLayoutInitialized = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isFirstLayout = true;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSplitBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SplitBoxBinding]\";\r\n}\r\n\r\n/**\r\n * Serialize binding.\r\n * Overloads {FlexBoxBinding#serialize}\r\n * @return {HashMap<string><object>}\r\n */\r\nSplitBoxBinding.prototype.serialize = function () {\r\n\t\r\n\tvar result = SplitBoxBinding.superclass.serialize.call ( this );\r\n\tif ( result ) {\r\n\t \tresult.orient = this.getOrient ();\r\n\t\tresult.layout = this.getLayout ();\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nSplitBoxBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tif (this.isHorizontalOrient() && Localization.isUIRtl)\r\n\t{\r\n\t\tvar i = this.bindingElement.childNodes.length;\r\n\t\twhile (i--)\r\n\t\t\tthis.bindingElement.appendChild(this.bindingElement.childNodes[i]);\r\n\t}\r\n\r\n\tSplitBoxBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.addActionListener ( SplitterBinding.ACTION_DRAGGED, this );\t\r\n\tthis.addActionListener ( SplitterBinding.ACTION_COLLAPSE, this );\r\n\tthis.addActionListener ( SplitterBinding.ACTION_UNCOLLAPSE, this );\r\n\t\r\n\tthis._initializeLayout ();\r\n\tthis._initializeOrient ();\r\n\tthis._initializeSplitters ();\r\n}\r\n\r\n/** \r\n * The layout attribute is easy to work with for content authors, \r\n * but for internal work we prefer to split it up and assign it \r\n * as attributes on descendant splitpanels.\r\n */\r\nSplitBoxBinding.prototype._initializeLayout = function () {\r\n\r\n\tthis.isLayoutInitialized = false;\r\n\r\n\tvar splitPanels = this.getSplitPanelElements ();\r\n\tif ( splitPanels.hasEntries ()) { \r\n\t\tvar ratios = new List ( \r\n\t\t\tthis.getLayout ().split ( \":\" )\r\n\t\t);\r\n\t\tif ( ratios.getLength () != splitPanels.getLength ()) {\r\n\t\t\tthrow new Error ( this + \" DOM subree invalid\" ); \r\n\t\t} else {\r\n\t\t\tsplitPanels.each ( function ( splitPanel ) {\r\n\t\t\t\tsplitPanel.setAttribute ( \"ratio\", ratios.getNext ());\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\t\r\n\t// flag initialized status\r\n\tthis.isLayoutInitialized = true;\r\n}\r\n\r\n/**\r\n * Initialize splitbox orientation.\r\n */ \r\nSplitBoxBinding.prototype._initializeOrient = function () {\r\n\t\r\n\tvar orient = this.getProperty ( \"orient\" );\r\n\tif ( orient ) {\r\n\t\tthis._orient = orient;\r\n\t}\r\n\tthis.attachClassName ( this._orient );\r\n}\r\n\r\n/**\r\n * Initialize splitters.\r\n */ \r\nSplitBoxBinding.prototype._initializeSplitters = function () {\r\n\r\n\tvar splitters = this.getSplitterBindings ();\r\n\twhile ( splitters.hasNext ()) {\r\n\t\tvar splitterBinding = splitters.getNext ();\r\n\t\tif ( splitterBinding && splitterBinding.getProperty ( \"collapsed\" ) == true ) {\r\n\t\t\tsplitterBinding.collapse ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {FlexBoxBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nSplitBoxBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tSplitBoxBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tswitch ( action.type ) {\r\n\t\tcase SplitterBinding.ACTION_DRAGGED :\r\n\t\t\tthis.refreshLayout ();\r\n\t\t\tbreak;\r\n\t\tcase SplitterBinding.ACTION_COLLAPSE :\r\n\t\t\tthis.collapse ( action.target );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\tcase SplitterBinding.ACTION_UNCOLLAPSE :\r\n\t\t\tthis.unCollapse ( action.target );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Overload flex method to maintain splitpanel ratios when resizing.\r\n * @overloads {FlexBoxBinding#flex}\r\n * @implements {IFlexible}\r\n */\r\nSplitBoxBinding.prototype.flex = function () {\r\n\t\r\n\tSplitBoxBinding.superclass.flex.call ( this );\r\n\r\n\tif ( this.isAttached == true ) {\r\n\t\tthis.invokeLayout ( true ); // true arg blocks new reflex chain...\r\n\t}\r\n}\r\n\r\n/**\r\n * Collapse splitter. Note that you should always invoke collapse by \r\n * calling the corresponding method on the {@link SplitterBinding}.\r\n * @param {SplitterBinding} splitter\r\n */\r\nSplitBoxBinding.prototype.collapse = function ( splitterBinding ) {\r\n\t\r\n\tthis._getSplitPanelBindingForSplitter ( splitterBinding ).collapse ();\r\n\tthis.invokeLayout ();\r\n}\r\n\r\n/**\r\n * Uncollapse splitter.\r\n * @param {SplitterBinding} splitter\r\n */\r\nSplitBoxBinding.prototype.unCollapse = function ( splitterBinding ) {\r\n\t\r\n\tthis._getSplitPanelBindingForSplitter ( splitterBinding ).unCollapse ();\r\n\tthis.invokeLayout ();\r\n}\r\n\r\n/**\r\n * Get SplitPanelBinding dependant on the SplitterBindings \"collapse\" property.\r\n * @param {SplitterBinding} splitter\r\n */\r\nSplitBoxBinding.prototype._getSplitPanelBindingForSplitter = function ( splitterBinding ) {\r\n\r\n\tvar ordinal = DOMUtil.getOrdinalPosition ( splitterBinding.bindingElement, true );\r\n\tvar splitPanel, splitPanels = this.getSplitPanelElements ();\r\n\t\r\n\tswitch ( splitterBinding.getCollapseDirection ()) {\r\n\t\tcase SplitterBinding.COLLAPSE_BEFORE :\r\n\t\t\tsplitPanel = splitPanels.get ( ordinal );\t\r\n\t\t\tbreak;\r\n\t\tcase SplitterBinding.COLLAPSE_AFTER :\r\n\t\t\tsplitPanel = splitPanels.get ( ordinal + 1 );\r\n\t\t\tbreak;\r\n\t}\t\r\n\treturn UserInterface.getBinding ( splitPanel );\r\n\t\r\n}\r\n\r\n/**\r\n * Invoke current layout.\r\n * @param @optional {boolean} isFlexing True if layout was invoked by FlexBoxCrawler.\r\n */\r\nSplitBoxBinding.prototype.invokeLayout = function ( isFlexing ) {\r\n\r\n\tvar isHorizontal = this.isHorizontalOrient ();\r\n\tvar panelBindings = this.getSplitPanelBindings ();\r\n\tvar splitterBindings = this.getSplitterBindings ();\r\n\tvar ratios = new List ();\r\n\tvar ratio, sum = 0;\r\n\tvar fixedPanelSum = 0;\r\n\t\r\n\t/*\r\n\t * NOTE FOR STAGSPLITBOXES: the calculation of fixedPanelSum is only \r\n\t * accurate  because we have exactly two splitpanels in each stage splitbox. \r\n\t * If more panels are added, the calculation becomes inacurate.\r\n\t */\r\n\tpanelBindings.each ( function ( panelBinding ) {\r\n\t\tif ( panelBinding.isFixed == true ) {\r\n\t\t\tif ( !panelBindings.hasNext ()) {\r\n\t\t\t\tfixedPanelSum += panelBinding.getFix ();\r\n\t\t\t}\r\n\t\t\tratios.add ( 0 );\r\n\t\t\tsum += 0;\r\n\t\t} else {\r\n\t\t\tratio = panelBinding.getRatio ();\r\n\t\t\tratios.add ( ratio );\r\n\t\t\tsum += ratio;\r\n\t\t}\r\n\t});\r\n\tif ( sum == 0 ) { // TODO: this avoids division by zero, but can it break something?\r\n\t\tthis.logger.warn ( \"Division by zero was hacked\" );\r\n\t\tsum = 1;\r\n\t}\r\n\tif ( ratios.getLength () != panelBindings.getLength ()) {\r\n\t\tthrow new Error ( \r\n\t\t\tthis + \" Invalid property (ratio)\" \r\n\t\t);\r\n\t} else {\r\n\t\tvar total = isHorizontal ? this.getInnerWidth() : this.getInnerHeight();\r\n\t\ttotal -= fixedPanelSum;\r\n\t\tsplitterBindings.each ( function ( splitterBinding ) {\r\n\t\t\tif ( splitterBinding.isVisible ) {\r\n\t\t\t\ttotal -= SplitterBinding.DIMENSION;\r\n\t\t\t}\r\n\t\t});\r\n\t\tvar unit = total / sum;\r\n\t\tvar spancount = 0;\r\n\t\t\r\n\t\tvar self = this;\r\n\t\t\r\n\t\tpanelBindings.each ( function ( panelBinding ) {\r\n\t\t\tvar span = 0;\r\n\t\t\tvar ratio = ratios.getNext ();\r\n\t\t\tif ( panelBinding.isFixed ) {\r\n\t\t\t\tspan = panelBinding.getFix ();\r\n\t\t\t} else {\r\n\t\t\t    span = Math.floor (unit * ratio);\r\n\t\t\t\tif ( isNaN ( span )) {\r\n\t\t\t\t\talert ( \"isNaN ( span ) [\" + this.getProperty ( \"layout\" ) + \"]\" );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t// TODO: this correction should not be performed on fixed panels!\r\n\t\t\tspancount += span;\r\n\t\t\twhile ( spancount > total ) {\r\n\t\t\t\tspancount--;\r\n\t\t\t\tspan--;\r\n\t\t\t}\r\n\t\t\tif ( !panelBinding.isFixed ) {\r\n\t\t\t\tif ( isHorizontal ) {\r\n\t\t\t\t\tpanelBinding.setWidth ( span );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpanelBinding.setHeight ( span );\r\n\t\t\t\t}\r\n\t\t\t}\t\r\n\t\t});\r\n\t}\r\n\r\n\tif ( isFlexing != true ) {\r\n\t\tthis.reflex ();\r\n\t}\r\n\t\r\n\t/*\r\n\t * Handle persistance.\r\n\t */\r\n\tif ( this._persist && this._persist.layout ) {\r\n\t\tvar persistlayout = this.getLayout ();\r\n\t\tif ( persistlayout ) { // can this fail?\r\n \t\t\tthis.setProperty ( \"layout\", persistlayout );\r\n \t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Compute new layout.\r\n */\r\nSplitBoxBinding.prototype.computeLayout = function () {\r\n\t\r\n\tvar isHorizontal\t\t= this.isHorizontalOrient ();\r\n\tvar panelBindings\t\t= this.getSplitPanelBindings ();\r\n\tvar splitterBindings \t= this.getSplitterBindings ();\r\n\tvar splitterBinding \t= null;\r\n\tvar ratio \t\t\t\t= null;\r\n\tvar unit \t\t\t\t= null;\r\n\tvar offset \t\t\t\t= null;\r\n\tvar span \t\t\t\t= null;\r\n\t\r\n\tpanelBindings.each ( function ( panelBinding ) {\r\n\t\t\r\n\t\tif ( !unit ) { // TODO: collapsed first binding?\r\n\t\t\tunit = isHorizontal ? panelBinding.getWidth() : panelBinding.getHeight();\r\n\t\t}\r\n\t\tspan = isHorizontal ? panelBinding.getWidth() : panelBinding.getHeight();\r\n\t\tif ( offset ) {\r\n\t\t\tspan -= offset;\r\n\t\t\toffset = null;\r\n\t\t}\r\n\t\tsplitterBinding = splitterBindings.getNext ();\r\n\t\tif ( splitterBinding && splitterBinding.offset ) {\r\n\t\t\toffset = splitterBinding.offset;\r\n\t\t\tspan += offset;\r\n\t\t}\r\n\t\t\r\n\t\tpanelBinding.setRatio ( span / unit );\r\n\t});\r\n}\r\n\r\n/**\r\n * Refresh layout.\r\n */\r\nSplitBoxBinding.prototype.refreshLayout = function () {\r\n\r\n\tthis.computeLayout ();\r\n\tthis.invokeLayout ();\r\n}\r\n\r\n/**\r\n * Set layout. \r\n */\r\nSplitBoxBinding.prototype.setLayout = function ( layout ) {\r\n\r\n\tthis.logger.debug ( layout );\r\n\tthis.setProperty ( \"layout\", layout );\r\n\tthis._initializeLayout ();\r\n\tthis.invokeLayout ();\r\n}\r\n\r\n/**\r\n * Get layout.\r\n * @param {string} layout\r\n */\r\nSplitBoxBinding.prototype.getLayout = function () {\r\n\r\n\tif ( !this.isLayoutInitialized ) {\r\n\t\tif ( !this.getProperty ( \"layout\" )) {\r\n\t\t\tthis.setProperty ( \"layout\", this.getDefaultLayout ());\r\n\t\t}\r\n\t} else {\r\n\t\tvar layout = \"\", panelBindings = this.getSplitPanelBindings ();\r\n\t\t panelBindings.each ( function ( panelBinding ) {\r\n\t\t \tlayout += panelBinding.getRatio ().toString ();\r\n\t\t\tlayout += panelBindings.hasNext () ? \":\" : \"\";\r\n\t\t });\r\n\t\tthis.setProperty ( \"layout\", layout );\r\n\t}\r\n\treturn new String ( \r\n\t\tthis.getProperty ( \"layout\" )\r\n\t);\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nSplitBoxBinding.prototype.getDefaultLayout = function () {\r\n\r\n\tvar elements = this.getSplitPanelElements ();\r\n\telements.each ( function ( element ) {\r\n\t\tlayout += \"1\" + ( elements.hasNext () ? \":\" : \"\" );\r\n\t});\r\n\tthis.setProperty ( \"layout\", layout )\r\n}\r\n\r\n/**\r\n * Set width.\r\n * @param {number} width\r\n */\r\nSplitBoxBinding.prototype.setWidth = function ( width ) {\r\n\r\n\tthis.bindingElement.style.width = width + \"px\";\r\n}\r\n\r\n/**\r\n * Get width.\r\n * @return {number}\r\n */\r\nSplitBoxBinding.prototype.getInnerWidth = function () {\r\n\r\n\tif (Client.isFirefox)\r\n\t\treturn Math.floor(this.bindingElement.getBoundingClientRect().width);\r\n\r\n\treturn this.bindingElement.offsetWidth;\r\n}\r\n\r\n/**\r\n * Set width.\r\n * @param {number} height\r\n */\r\nSplitBoxBinding.prototype.setHeight = function ( height ) {\r\n\r\n\tthis.bindingElement.style.height = height + \"px\";\r\n}\r\n\r\n/**\r\n * Get height.\r\n * @return {number}\r\n */\r\nSplitBoxBinding.prototype.getInnerHeight = function () {\r\n\r\n\tif (Client.isFirefox)\r\n\t\treturn Math.floor(this.bindingElement.getBoundingClientRect().height);\r\n\r\n\treturn this.bindingElement.offsetHeight;\r\n}\r\n\r\n/**\r\n * Get orient property.\r\n * TODO: make a setter for this property (implies layout recalc)?\r\n */\r\nSplitBoxBinding.prototype.getOrient = function () {\r\n\r\n\treturn this.getProperty ( \"orient\" )\r\n}\r\n\r\n/**\r\n * Is horizontal orient?.\r\n * @return {boolean}\r\n */\r\nSplitBoxBinding.prototype.isHorizontalOrient = function () {\r\n\r\n\treturn this._orient == SplitBoxBinding.ORIENT_HORIZONTAL;\r\n}\r\n\r\n/**\r\n * Get splitpanel elements. Taking care not to include \r\n * splitpanels from descendant splitboxes in result.\r\n * TODO: store result untill some kind of dirty flag is set\r\n * @return {List<DOMElement>}\r\n */\r\nSplitBoxBinding.prototype.getSplitPanelElements = function () {\r\n\tvar splitpanels = this.getChildElementsByLocalName(\"splitpanel\")\r\n\tif (this.isHorizontalOrient() && Localization.isUIRtl)\r\n\t{\r\n\t\tsplitpanels.reverse();\r\n\t}\r\n\treturn splitpanels;\r\n}\r\n\r\n/**\r\n * Get splitpanel bindings.\r\n * @return {List<SplitPanelBinding>}\r\n */\r\nSplitBoxBinding.prototype.getSplitPanelBindings = function () {\r\n\r\n\treturn this.getChildBindingsByLocalName ( \"splitpanel\" );\r\n}\r\n\r\n/**\r\n * Get splitter elements.\r\n * TODO: store result untill some kind of dirty flag is set\r\n * @return {List<DOMElement>}\r\n */\r\nSplitBoxBinding.prototype.getSplitterElements = function () {\r\n\r\n\treturn this.getChildElementsByLocalName ( \"splitter\" );\r\n}\r\n\r\n/**\r\n * Get splitter bindings.\r\n * @return {List<SplitterBinding>}\r\n */\r\nSplitBoxBinding.prototype.getSplitterBindings = function () {\r\n\r\n\treturn this.getChildBindingsByLocalName ( \"splitter\" );\r\n}\r\n\r\n/**\r\n * @overloads {FlexBoxBinding#fit}\r\n * @param {boolean} isForce\r\n */\r\nSplitBoxBinding.prototype.fit = function ( isForce ) {\r\n\t\r\n\tif ( !this.isFit || isForce ) {\r\n\t\r\n\t\tif ( this.isHorizontalOrient ()) {\r\n\t\t\t\r\n\t\t\tvar max = 0;\r\n\t\t\tvar panels = this.getSplitPanelBindings ();\r\n\t\t\tpanels.each ( function ( panel ) {\r\n\t\t\t\tvar height = panel.bindingElement.offsetHeight;\r\n\t\t\t\tmax = height > max ? height : max;\r\n\t\t\t});\r\n\t\t\t//if ( max > this._getFitnessHeight ()) { // check disabled!\r\n\t\t\t\tthis._setFitnessHeight ( max );\r\n\t\t\t//}\r\n\t\t\r\n\t\t} else {\r\n\t\t\t\r\n\t\t\t// but wont this be easy to fix? just call super!\r\n\t\t\tthrow \"SplitBoxBinding enforceFitness not supported vertically!\";\r\n\t\t}\r\n\t\t\r\n\t\tthis.isFit = true;\r\n\t\r\n\t}\r\n}\r\n\r\n/**\r\n * SplitBoxBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {SplitBoxBinding}\r\n */\r\nSplitBoxBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:splitbox\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, SplitBoxBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/splitboxes/SplitPanelBinding.js",
    "content": "SplitPanelBinding.prototype = new ControlBoxBinding;\r\nSplitPanelBinding.prototype.constructor = SplitPanelBinding;\r\nSplitPanelBinding.superclass = ControlBoxBinding.prototype;\r\n//SplitPanelBinding.MIN_WIDTH = 220;\r\n\r\n/**\r\n * @class\r\n * Notice that we inherit ControlBoxBinding. This dependency can be assumed specific \r\n * for stage layout splitboxes. Consider refactoring this (postponed for now \r\n * because IE gets stressed by too many flexboxes).\r\n */\r\nfunction SplitPanelBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SplitPanelBinding\" );\r\n\t\r\n\t/** \r\n\t * @type {SplitBoxBinding} \r\n\t */\r\n\tthis._containingSplitBoxBinding = null;\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isCollapsed = false;\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isFixed = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = true;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._fixedSpan = null;\r\n\t\r\n\t/**\r\n\t * This could in theory be disabled, but it fixes a rendering bug in Explorer.\r\n\t * Notice that the property gets switched once in a while by the splitbox.\r\n\t * @see {SplitBoxBinding#invokeLayout} \r\n\t * @overwrites {FlexBoxBinding#isFlexible}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFlexible = true; //TRUE\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSplitPanelBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SplitPanelBinding]\";\r\n}\r\n\r\n/*\r\nSplitPanelBinding.prototype.serialize = function () {\r\n\t// ratio\r\n\t// ratiocache\r\n\t// collapsed\r\n}\r\n*/\r\n\r\n/**\r\n * @overloads {ControlBoxBinding#onBindingAttach}\r\n */\r\nSplitPanelBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tSplitPanelBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis._containingSplitBoxBinding = this.getAncestorBindingByLocalName ( \"splitbox\" );\r\n\tthis.attachClassName ( this._containingSplitBoxBinding.getOrient ());\r\n\tthis.parseDOMProperties ();\r\n}\r\n\r\n/**\r\n * Parse DOM properties.\r\n */\r\nSplitPanelBinding.prototype.parseDOMProperties = function () {\r\n\t\r\n\t// the type property is reflected in the CSS classname\r\n\tvar type = this.getProperty ( \"type\" );\r\n\tif ( type ) {\r\n\t\tthis.attachClassName ( type );\r\n\t}\r\n\r\n\t// implement fixed width\r\n\tvar fix = this.getProperty ( \"fix\" );\r\n\tif ( fix ) {\r\n\t\tthis.setFix ( fix );\r\n\t}\r\n\t\r\n\tvar hidden = this.getProperty ( \"hidden\" );\r\n\tif ( hidden ) {\r\n\t\tthis.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Collapse.\r\n */\r\nSplitPanelBinding.prototype.collapse = function () {\r\n\r\n\tthis.hide ();\r\n\tthis.isCollapsed = true;\r\n\tthis.setProperty ( \"collapsed\", \"true\" );\r\n}\r\n\r\n/**\r\n * Collapse.\r\n */\r\nSplitPanelBinding.prototype.unCollapse = function () {\r\n\r\n\tthis.show ();\r\n\tthis.isCollapsed = false;\r\n\tthis.deleteProperty ( \"collapsed\" );\r\n}\r\n\r\n/**\r\n * Hide.\r\n * @overwrites {Binding#hide}\r\n */\r\nSplitPanelBinding.prototype.hide = function () {\r\n\t\r\n\tif ( this.isVisible == true ) {\r\n\t\tthis.setProperty ( \"ratiocache\", this.getRatio ());\r\n\t\tthis.setRatio ( 0 );\r\n\t\tthis.bindingElement.style.display = \"none\"; // nescessary for Explorer!\r\n\t\tthis.setProperty ( \"hidden\" , true );\r\n\t\tthis.isVisible = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Show.\r\n * @overwrites {Binding#show}\r\n */\r\nSplitPanelBinding.prototype.show = function () {\r\n\r\n\tif ( !this.isVisible ) {\r\n\t\tvar ratiocache = this.getProperty ( \"ratiocache\" );\r\n\t\tif ( ratiocache ) {\r\n\t\t \tthis.setRatio ( ratiocache );\r\n\t\t\tthis.deleteProperty ( \"ratiocache\" );\r\n\t\t} else {\r\n\t\t\tthis._containingSplitBoxBinding.computeLayout (); // ADDED!\r\n\t\t}\r\n\t\tthis.bindingElement.style.display = \"block\";\r\n\t\tthis.deleteProperty ( \"hidden\" );\r\n\t\tthis.isVisible = true;\r\n\t\t\r\n\t\t/*\r\n\t\t} else {\r\n\t\t\tthrow new Error ( \"SplitPanelBinding: missing required property: ratiocache\" );\r\n\t\t}\r\n\t\t*/\r\n\t}\r\n}\r\n\r\n/**\r\n * Set width.\r\n * @param {number} width\r\n */\r\nSplitPanelBinding.prototype.setWidth = function ( width ) {\r\n\r\n\tif ( !this.isFixed  ) {\r\n\t\tif ( width != this.getWidth ()) {\r\n\t\t\tif ( width < 0 ) {\r\n\t\t\t\twidth = this.getWidth (); // TODO: EXPLORER BUG!\r\n\t\t\t\tthis.logger.warn ( \"SplitPanelBinding#setWidth bug in Internet Explorer!\" );\r\n\t\t\t}\r\n\t\t\ttry {\r\n\t\t\t\tthis.bindingElement.style.width = width + \"px\";\r\n\t\t\t} catch ( exception ) {\r\n\t\t\t\talert ( \"SplitPanelBinding#setWidth: Occult width: \" + width );\r\n\t\t\t\talert ( arguments.caller.callee );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get width.\r\n * @return {number}\r\n */\r\nSplitPanelBinding.prototype.getWidth = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.isFixed ) {\r\n\t\tresult = this.getFix ();\r\n\t} else {\r\n\t\tresult = this.bindingElement.offsetWidth;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set width.\r\n * @param {number} height\r\n */\r\nSplitPanelBinding.prototype.setHeight = function ( height ) {\r\n\t\r\n\t/*\r\n\tSystemDebug.stack ( arguments );\r\n\tthis.logger.debug ( Math.random ())\r\n\t*/\r\n\t\r\n\tif ( !this.isFixed ) {\r\n\t\tif ( height != this.getHeight ()) {\r\n\t\t\ttry {\r\n\t\t\t\tthis.bindingElement.style.height = height + \"px\";\r\n\t\t\t} catch ( exception ) {\r\n\t\t\t\talert ( \"SplitPanelBinding.prototype.setHeight\" + arguments.caller.callee );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get height.\r\n * @return {number}\r\n */\r\nSplitPanelBinding.prototype.getHeight = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.isFixed ) {\r\n\t\tresult = this.getFix ();\r\n\t} else {\r\n\t\tresult = this.bindingElement.offsetHeight;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set ratio. This property is set by the {@link SplitBoxBinding}\r\n * @param {number} value\r\n */\r\nSplitPanelBinding.prototype.setRatio = function ( value ) {\r\n\r\n\tthis.setProperty ( \"ratio\", value );\r\n}\r\n\r\n/**\r\n * Get ratio. Remember to consider fixation when using the ratio.\r\n * @return {number}\r\n */\r\nSplitPanelBinding.prototype.getRatio = function () {\r\n\r\n\treturn this.getProperty ( \"ratio\" );\r\n}\r\n\r\n/**\r\n * Set or remove fix.\r\n * TODO: something is wrong with horizontal splitboxes - should be investigated.\r\n * @param {int} fixedspan Fixed span in pixels - use null or false to unfix.\r\n */\r\nSplitPanelBinding.prototype.setFix = function ( fixedSpan ) {\r\n\t\r\n\tif ( fixedSpan ) {\r\n\t\tthis._fixedSpan = fixedSpan;\r\n\t\tswitch ( this._containingSplitBoxBinding.getOrient ()) {\r\n\t\t\tcase SplitBoxBinding.ORIENT_HORIZONTAL :\r\n\t\t\t\tthis.logger.warn ( \"Fix not properly supported on horizontal splitboxes!\" );\r\n\t\t\t\tthis.setWidth ( fixedSpan ); /***/\r\n\t\t\t\tbreak;\r\n\t\t\tcase SplitBoxBinding.ORIENT_VERTICAL :\r\n\t\t\t\tthis.setHeight ( fixedSpan );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tthis.isFixed = true;\r\n\t} else {\r\n\t\tthis._fixedSpan = null;\r\n\t\tthis.isFixed = false;\r\n\t\t// TODO: should this recalculate splitbox layout?\r\n\t}\r\n}\r\n\r\n/**\r\n * Get fixed width/height.\r\n * @return {int}\r\n */\r\nSplitPanelBinding.prototype.getFix = function () {\r\n\t\r\n\treturn this._fixedSpan;\r\n}\r\n\r\n/**\r\n * SplitPanelBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {SplitPanelBinding}\r\n */\r\nSplitPanelBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:splitpanel\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, SplitPanelBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/splitboxes/SplitterBinding.js",
    "content": "SplitterBinding.prototype = new Binding;\r\nSplitterBinding.prototype.constructor = SplitterBinding;\r\nSplitterBinding.superclass = Binding.prototype;\r\n\r\nSplitterBinding.DIMENSION = 0;\r\nSplitterBinding.BUFFER = 30;\r\n\r\nSplitterBinding.COLLAPSE_AFTER = \"after\";\r\nSplitterBinding.COLLAPSE_BEFORE = \"before\";\r\n\r\nSplitterBinding.ACTION_DRAGSTART = \"splitter dragstart\";\r\nSplitterBinding.ACTION_DRAGGED = \"splitter dragged\";\r\nSplitterBinding.ACTION_COLLAPSE = \"splitter collapse\";\r\nSplitterBinding.ACTION_UNCOLLAPSE = \"splitter uncollapse\";\r\n\r\nSplitterBinding.CLASSNAME_ACTIVE = \"active\";\r\nSplitterBinding.CLASSNAME_HOVER = \"hover\";\r\n\r\n/**\r\n * @class\r\n * TODO: extend FlexBoxBinding to fix rendering bug in explorer!\r\n */\r\nfunction SplitterBinding () {\r\n\r\n\t/** \r\n\t * @type {SystemLogger} \r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SplitterBinding\" );\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isDraggable = true;\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isDragging = false;\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isCollapsed = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisabled = true;\r\n\t\r\n\t/** \r\n\t * @type {SplitBoxBinding} \r\n\t */\r\n\tthis._containingSplitBoxBinding = null;\r\n\t\r\n\t/** \r\n\t * @type {string} \r\n\t */\r\n\tthis._collapseDirection = SplitterBinding.COLLAPSE_AFTER;\r\n\t\r\n\t/** \r\n\t * @type {int} \r\n\t */\r\n\tthis.offset = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSplitterBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SplitterBinding]\";\r\n}\r\n\r\n/**\r\n * Serialize binding.\r\n * Overloads {Binding#serialize}\r\n * @return {HashMap<string><object>}\r\n */\r\nSplitterBinding.prototype.serialize = function () {\r\n\t\r\n\tvar result = SplitBoxBinding.superclass.serialize.call ( this );\r\n\tif ( result ) {\r\n\t\tresult.collapse = this.getProperty ( \"collapse\" );\r\n\t\tresult.collapsed = this.getProperty ( \"collapsed\" );\r\n\t\tresult.disabled = this.getProperty ( \"isdisabled\" );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nSplitterBinding.prototype.onBindingAttach = function () {\r\n\r\n\tSplitterBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.addActionListener ( Binding.ACTION_DRAG );\r\n\t\r\n\tthis._containingSplitBoxBinding = this.getAncestorBindingByLocalName ( \"splitbox\" );\r\n\tthis.attachClassName ( this._containingSplitBoxBinding.getOrient ());\r\n\tthis._collapseDirection = this.getProperty ( \"collapse\" );\r\n\t\r\n\tthis.buildDOMContent ();\r\n\tthis.attachDOMEvents ();\r\n\t\r\n\tvar hidden = this.getProperty ( \"hidden\" );\r\n\tif ( hidden ) {\r\n\t\tthis.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nSplitterBinding.prototype.buildDOMContent = function () {\r\n\t\r\n\tthis.shadowTree.splitterBody = DOMUtil.createElementNS ( \r\n\t\tConstants.NS_UI, \"ui:splitterbody\", this.bindingDocument\r\n\t);\r\n\tthis.bindingElement.appendChild ( this.shadowTree.splitterBody );\r\n\t\r\n\t/*\r\n\t * When stage splitpanels are unmaximized, the splitter \r\n\t * may dissapear in Mozilla unless we append some content.\r\n\t */\r\n\tif ( Client.isMozilla == true ) {\r\n\t\tvar text = this.bindingDocument.createTextNode ( \"!\" );\r\n\t\tthis.bindingElement.appendChild ( text );\r\n\t}\r\n}\r\n\r\n/**\r\n * Attach DOM event listeners.\r\n */\r\nSplitterBinding.prototype.attachDOMEvents = function () {\r\n\t\r\n\tthis.addEventListener ( DOMEvents.MOUSEOVER );\r\n\tthis.addEventListener ( DOMEvents.MOUSEOUT );\r\n}\r\n\r\n/**\r\n * Collapse. Containing SplitBoxBinding handles the splitpanels. Remember to \r\n * uncollapse (ie, dont call this method twice with different directions). UDPATE TEXT????\r\n */\r\nSplitterBinding.prototype.collapse = function () {\r\n\t\r\n\tif ( !this.isCollapsed ) {\r\n\t\tthis.hide ();\r\n\t\tthis.setProperty ( \"collapsed\", \"true\" );\r\n\t\tthis.isCollapsed = true;\r\n\t\tthis.dispatchAction ( SplitterBinding.ACTION_COLLAPSE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Uncollapse.\r\n */\r\nSplitterBinding.prototype.unCollapse = function () {\r\n\t\r\n\tif ( this.isCollapsed == true ) {\r\n\t\tthis.show ();\r\n\t\tthis.deleteProperty ( \"collapsed\" );\r\n\t\tthis.isCollapsed = false;\r\n\t\tthis.dispatchAction ( SplitterBinding.ACTION_UNCOLLAPSE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Get collapse direction.\r\n * @return {string}\r\n */\r\nSplitterBinding.prototype.getCollapseDirection = function () {\r\n\t\r\n\treturn this._collapseDirection;\r\n}\r\n\r\n/**\r\n * Set collapse direction.\r\n * @param {string} direction\r\n */\r\nSplitterBinding.prototype.setCollapseDirection = function ( direction ) {\r\n\t\r\n\tthis.setProperty ( \"collapse\", direction );\r\n\tthis._collapseDirection = direction;\r\n}\r\n\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nSplitterBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tSplitterBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase Binding.ACTION_DRAG :\r\n\t\t\tthis.dragger.registerHandler ( this );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nSplitterBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tSplitterBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tvar binding = this;\r\n\t\r\n\tif ( !this.isDragging && !this.isDisabled ) {\r\n\t\tswitch ( e.type ) {\r\n\t\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\t\twindow.splitterTimeout = window.setTimeout ( function () {\r\n\t\t\t\t\tbinding.shadowTree.splitterBody.className = SplitterBinding.CLASSNAME_HOVER;\r\n\t\t\t\t}, 250 );\r\n\t\t\t\tbreak;\r\n\t\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\t\tif ( window.splitterTimeout ) {\r\n\t\t\t\t\twindow.clearTimeout ( window.splitterTimeout );\r\n\t\t\t\t}\r\n\t\t\t\tif ( binding.shadowTree.splitterBody.className == SplitterBinding.CLASSNAME_HOVER ) {\r\n\t\t\t\t\tthis.shadowTree.splitterBody.className = \"\";\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Notice that the {@link StageSplitterBinding} overwrites this method.\r\n * @param {Point} point\r\n */\r\nSplitterBinding.prototype.onDragStart = function ( point ) {\r\n\t\r\n    this.dispatchAction ( SplitterBinding.ACTION_DRAGSTART );\r\n\tthis.attachClassName ( SplitterBinding.CLASSNAME_ACTIVE );\r\n\tthis.shadowTree.splitterBody.className = SplitterBinding.CLASSNAME_ACTIVE;\r\n\tthis.isDragging = true;\r\n}\r\n\r\n/**\r\n * Notice that the {@link StageSplitterBinding} overwrites this method.\r\n * @param {Point} diff\r\n */\r\nSplitterBinding.prototype.onDrag = function ( diff ) {\r\n\r\n\tdiff = this.getEvaluatedDiff ( diff );\r\n\r\n\tif ( this._containingSplitBoxBinding.isHorizontalOrient ()) {\r\n\t\tthis.shadowTree.splitterBody.style.left = diff.x + \"px\";\r\n\t} else {\r\n\t\tthis.shadowTree.splitterBody.style.top = diff.y + \"px\";\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispatced action causes containing slitbox to redraw.\r\n * Notice that the {@link StageSplitterBinding} overwrites this method.\r\n * @see {SplitBoxBinding#handleAction}\r\n * @param {Point} diff\r\n */\r\nSplitterBinding.prototype.onDragStop = function ( diff ) {\r\n\r\n\tdiff = this.getEvaluatedDiff ( diff );\r\n\r\n\t/*\r\n\t * Redraw containing layout\r\n\t */\r\n\tthis.offset = this._containingSplitBoxBinding.isHorizontalOrient () ? diff.x : diff.y;\r\n\tthis.dispatchAction ( SplitterBinding.ACTION_DRAGGED );\r\n\tthis.offset = null;\r\n\t\r\n\t/* \r\n\t * Reset splitter setup\r\n\t */\r\n\tthis.detachClassName ( SplitterBinding.CLASSNAME_ACTIVE );\r\n\tthis.shadowTree.splitterBody.className = \"\";\r\n\tthis.isDragging = false;\r\n\t\r\n\tif ( this._containingSplitBoxBinding.isHorizontalOrient ()) {\r\n\t\tthis.shadowTree.splitterBody.style.left = \"0\";\r\n\t} else {\r\n\t\tthis.shadowTree.splitterBody.style.top = \"0\";\r\n\t}\r\n}\r\n\r\n/**\r\n * Given a point, returns a point withing the allowed positioning area of the splitter.\r\n * @param {Point} diff\r\n * @return {Point}\r\n */\r\nSplitterBinding.prototype.getEvaluatedDiff = function ( diff ) {\r\n\t\r\n\tswitch ( this._containingSplitBoxBinding.getOrient ()) {\r\n\t\r\n\t\tcase SplitBoxBinding.ORIENT_HORIZONTAL :\r\n\t\t\tvar x = this.bindingElement.offsetLeft;\r\n\t\t\tvar w = this.bindingElement.offsetWidth;\r\n\t\t\tvar t = this.bindingElement.parentNode.offsetWidth;\r\n\t\t\tvar min = - x + SplitterBinding.BUFFER;\r\n\t\t\tvar max = t - x - w - SplitterBinding.BUFFER;\r\n\t\t\tdiff.x = diff.x <= min ? min : diff.x;\r\n\t\t\tdiff.x =  diff.x >= max ? max : diff.x;\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase SplitBoxBinding.ORIENT_VERTICAL :\r\n\t\t\tvar y = this.bindingElement.offsetTop;\r\n\t\t\tvar h = this.bindingElement.offsetHeight;\r\n\t\t\tvar t = this.bindingElement.parentNode.offsetHeight;\r\n\t\t\tvar min = - y + SplitterBinding.BUFFER;\r\n\t\t\tvar max = t - y - h - SplitterBinding.BUFFER;\r\n\t\t\tdiff.y = diff.y <= min ? min : diff.y;\r\n\t\t\tdiff.y =  diff.y >= max ? max : diff.y;\r\n\t\t\tbreak;\r\n\t}\r\n\treturn diff;\r\n}\r\n\r\n/**\r\n * Disable.\r\n */\r\nSplitterBinding.prototype.disable = function () {\r\n\t\r\n\tif ( !this.isDisabled ) {\r\n\t\talert ( \"disable\" );\r\n\t\tthis.isDisabled = true;\r\n\t\tthis.disableDragging ();\r\n\t\tthis.setProperty ( \"isdisabled\", true );\r\n\t}\r\n}\r\n\r\n/**\r\n * Enable.\r\n */\r\nSplitterBinding.prototype.enable = function () {\r\n\t\r\n\tif ( this.isDisabled == true ) {\r\n\t\tthis.isDisabled = false;\r\n\t\tthis.enableDragging ();\r\n\t\tthis.deleteProperty ( \"isdisabled\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * SplitterBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {SplitterBinding}\r\n */\r\nSplitterBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:splitter\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, SplitterBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/StageBinding.js",
    "content": "StageBinding.prototype = new FocusBinding;\r\nStageBinding.prototype.constructor = StageBinding;\r\nStageBinding.superclass = FocusBinding.prototype;\r\n\r\nStageBinding.ACTION_DECK_LOADED = \"stage deck loaded\";\r\nStageBinding.CLASSNAME_EMPTY = \"empty\";\r\nStageBinding.ACTION_START_LOADED = \"stage start loaded\";\r\n\r\n\r\n/**\r\n * Static reference to the single StageBinding instance. Assigned on startup.\r\n * @type {StageBinding}\r\n */\r\nStageBinding.bindingInstance = null;\r\n\r\n/**\r\n * The {@link SystemNode} hat build the currently selected perspective.\r\n * Updated by method {@link StageDecksBinding#setSelectionByHandle}\r\n * @type {SystemNode}\r\n */\r\nStageBinding.perspectiveNode = null;\r\n\r\n/**\r\n * The serializedEntityToken associated to the {@link DockTabBinding}\r\n * that is selected AND activated on the current perspective. May be null.\r\n * Updated by method {@link DockTabBinding#_updateGlobalEntityToken}\r\n * @type {string}\r\n */\r\nStageBinding.entityToken = null;\r\n\r\n/**\r\n* The current tree selector binding\r\n* @type {SystemTreeBinding}\r\n*/\r\nStageBinding.treeSelector = null;\r\n\r\n\r\n/**\r\n* The current placeholder width\r\n* @type {SystemTreeBinding}\r\n*/\r\nStageBinding.placeholderWidth = null;\r\n\r\n\r\n/**\r\n * Hide OR show a ViewDefinition on stage (dependant on its current status).\r\n * @param {string} handle\r\n * @param {Binding?} contextSource\r\n */\r\nStageBinding.handleViewPresentation = function ( handle, contextSource) {\r\n\r\n\tif ( StageBinding.isViewOpen ( handle )) {\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.CLOSE_VIEW, handle );\r\n\t} else {\r\n\t\tvar definition = ViewDefinitions [ handle ];\r\n\t\tStageBinding.presentViewDefinition(definition, contextSource);\r\n\t}\r\n}\r\n\r\n/**\r\n * Is view open?\r\n * @param {string} handle\r\n */\r\nStageBinding.isViewOpen = function ( handle ) {\r\n\r\n\treturn StageBinding.bindingInstance._activeViewDefinitions [ handle ] != null;\r\n}\r\n\r\n/**\r\n * @param {string} handle\r\n */\r\nStageBinding.setSelectionByHandle = function (handle) {\r\n\t//TODO refactor this\r\n\tStageBinding.bindingInstance._explorerBinding.setSelectionByHandle(handle);\r\n}\r\n\r\n/**\r\n */\r\nStageBinding.getSelectionHandle = function () {\r\n\t//TODO refactor this\r\n\treturn StageBinding.bindingInstance._explorerBinding.getSelectionHandle();\r\n}\r\n\r\nStageBinding.selectBrowserTab = function () {\r\n\r\n\tStageBinding.bindingInstance.selectBrowserTab();\r\n}\r\n\r\n\r\n/**\r\n * Present ViewDefinition on stage.\r\n * @param {ViewDefinition} definition\r\n * @param {Binding?} contextSource\r\n */\r\nStageBinding.presentViewDefinition = function (definition, contextSource) {\r\n\r\n\tif ( definition.label != null ) {\r\n\t\tvar string = StringBundle.getString ( \"ui\", \"Website.App.StatusBar.Opening\" );\r\n\t\tStatusBar.busy ( string, [ definition.label ]);\r\n\t} else {\r\n\t\tStatusBar.busy ();\r\n\t}\r\n\tStageBinding.bindingInstance._presentViewDefinition(definition, contextSource);\r\n}\r\n\r\n\r\n/**\r\n * @param {string} handle\r\n * @return {Promise}\r\n */\r\nStageBinding.select = function (perspectiveElementKey) {\r\n\r\n\tvar promise = new Promise(function (resolve, reject) {\r\n\t\tif (perspectiveElementKey && perspectiveElementKey != StageBinding.getSelectionHandle()) {\r\n\t\t\tvar handler = {\r\n\t\t\t\thandleBroadcast: function (broadcast, arg) {\r\n\t\t\t\t\tswitch (broadcast) {\r\n\t\t\t\t\t\tcase BroadcastMessages.STAGEDECK_CHANGED:\r\n\t\t\t\t\t\t\tif (arg == perspectiveElementKey) {\r\n\t\t\t\t\t\t\t\tEventBroadcaster.unsubscribe(BroadcastMessages.STAGEDECK_CHANGED, this);\r\n\t\t\t\t\t\t\t\tStageBinding.selectBrowserTab();\r\n\t\t\t\t\t\t\t\tresolve();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tEventBroadcaster.subscribe(BroadcastMessages.STAGEDECK_CHANGED, handler);\r\n\t\t\tStageBinding.setSelectionByHandle(perspectiveElementKey);\r\n\t\t} else {\r\n\t\t\tresolve();\r\n\t\t}\r\n\t});\r\n\t\r\n\treturn promise;\r\n}\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageBinding\" );\r\n\r\n\t/**\r\n\t * Associating handles to presently active viewDefinitions.\r\n\t * @type {HashMap<string><ViewDefinition>}\r\n\t * @private\r\n\t */\r\n\tthis._activeViewDefinitions = {};\r\n\r\n\t/**\r\n\t * @type {StageDecksBinding}\r\n\t * @private\r\n\t */\r\n\tthis._decksBinding = null;\r\n\r\n\t/**\r\n\t * @type {ExplorerBinding}\r\n\t * @private\r\n\t */\r\n\tthis._explorerBinding = null;\r\n\r\n\t/**\r\n\t * Flipped when both explorer and decks are loaded.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isStageReady = false;\r\n\r\n\t/**\r\n\t * Flipped when a \"page\" is loaded in {@link ExplorerBinding}.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isExplorerReady = false;\r\n\r\n\t/**\r\n\t * Flipped when a deck is loaded in the {@link StageDecksBinding}.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isDecksReady = false;\r\n\r\n\t/**\r\n\t * Indexing system docks by reference property.\r\n\t * @type {Map<string><DockBinding>}\r\n\t */\r\n\tthis._dockBindings = new Map ();\r\n\r\n\t/**\r\n\t * True when Start screen is visible.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isShowingStart = false;\r\n\r\n\t/**\r\n\t * Makes no sense to handle activation in the app root.\r\n\t * @implements {IActivationAware}\r\n\t * @overwrites {FocusBinding#isActivationAware}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivationAware = false;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageBinding]\";\r\n}\r\n\r\n\r\n\r\n// INITIALIZATION ................................................................\r\n\r\n/**\r\n * Notice that we are simulating a {@link StageBoxHandlerAbstraction} in\r\n * the inheritance chain. That's because the {@link StageDeckBinding} is\r\n * interested in some of these functionalities as well.\r\n * Overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nStageBinding.prototype.onBindingRegister = function () {\r\n\r\n\tStageBinding.superclass.onBindingRegister.call ( this );\r\n\tStageBinding.bindingInstance = this;\r\n\r\n\t/*\r\n\t * This will add action listeners for:\r\n\t * ControlBoxBinding.ACTION_MAXIMIZE\r\n\t * ControlBoxBinding.ACTION_NORMALIZE\r\n\t * StageBoxAbstraction.ACTION_HIDDENSTUFF_UPDATED\r\n\t * StageSplitPanelBinding.ACTION_LAYOUTUPDATE\r\n\t */\r\n\tStageBoxHandlerAbstraction.onBindingRegister.call ( this );\r\n\r\n\t/*\r\n\t * Attach action listeners.\r\n\t */\r\n\r\n\tthis.addActionListener ( StageDecksBinding.ACTION_INITIALIZED );\r\n\tthis.addActionListener ( TabBoxBinding.ACTION_ATTACHED );\r\n\tthis.addActionListener ( TabBoxBinding.ACTION_SELECTED );\r\n\tthis.addActionListener ( WindowBinding.ACTION_LOADED );\r\n\tthis.addActionListener ( StageBinding.ACTION_DECK_LOADED );\r\n\tthis.addActionListener ( StageDeckBinding.ACTION_LOADED );\r\n\tthis.addActionListener ( ErrorBinding.ACTION_INITIALIZE );\r\n\r\n\tDOMEvents.addEventListener(top, DOMEvents.HASHCHANGE, this);\r\n\r\n\t/*\r\n\t * File EventBroadcaster subscriptions.\r\n\t */\r\n\tthis.subscribe ( BroadcastMessages.VIEW_CLOSED );\r\n\tthis.subscribe ( BroadcastMessages.VIEW_OPENED );\r\n\tthis.subscribe ( BroadcastMessages.COMPOSITE_START );\r\n\tthis.subscribe ( BroadcastMessages.COMPOSITE_STOP );\r\n\tthis.subscribe ( BroadcastMessages.DOCK_MAXIMIZED );\r\n\tthis.subscribe ( BroadcastMessages.DOCK_NORMALIZED );\r\n\r\n\tapp.bindingMap.explorer.addActionListener(ExplorerBinding.ACTION_INITIALIZED, this);\r\n\tapp.bindingMap.explorer.addActionListener(ExplorerMenuBinding.ACTION_SELECTIONCHANGED, this);\r\n\r\n\tapp.bindingMap.app.addActionListener(StageBinding.ACTION_START_LOADED, this);\r\n\r\n\t/*\r\n\t * Initialize root actions.\r\n\t */\r\n\tthis._initializeUsergroup();\r\n\tvar root = System.getRootNode ();\r\n\tthis._initializeRootActions ( root );\r\n\r\n\t/*\r\n\t * Hookup root refresh. The broadcast is intercepted by StageDeckBinding.\r\n\t * The associated tree is refreshed when deck gets selected.\r\n\t */\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.SYSTEMTREEBINDING_REFRESH, {\r\n\t\thandleBroadcast : function ( broadcast, arg ) {\r\n\t\t\tif ( arg == root.getEntityToken ()) {\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SYSTEMTREEBINDING_REFRESHALL );\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\r\n\t/*\r\n\t * Initialize perspectives (they may not be available for new user with no rights).\r\n\t */\r\n\tvar perspectives = System.getPerspectiveNodes ();\r\n\tif ( perspectives.hasEntries ()) {\r\n\t\tthis._initializeSystemViewDefinitions ( perspectives );\r\n\t} else {\r\n\t\ttop.app.bindingMap.stagecontainer.hide ();\r\n\t\ttop.app.bindingMap.app.attachClassName(StageBinding.CLASSNAME_EMPTY);\r\n\t\tthis._onStageReady ();\r\n\t\tDialog.message (\r\n\t\t\tStringBundle.getString ( \"ui\", \"Website.Dialogs.NoAccessTitle\" ),\r\n\t\t\tStringBundle.getString ( \"ui\", \"Website.Dialogs.NoAccessText\" )\r\n\t\t);\r\n\t}\r\n\r\n\t/*\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tvar dock = self._toolDockBinding;\r\n\t\tvar tab = UserInterface.getBinding ( dock.getTabElements().get ( 0 ));\r\n\t\t//self._editorDockBinding.importTabBinding ( tab );\r\n\t\t//tab  = UserInterface.getBinding ( document.getElementById ( \"temp\" ));\r\n\t\t//self._editorDockBinding.importTabBinding ( tab );\r\n\t\t//document.getElementById ( \"john\" ).appendChild ( document.getElementById ( \"aage\" ));\r\n\r\n\t}, 3500 );\r\n\t*/\r\n}\r\n\r\n/**\r\n * Fires when both members - ExplorerBinding and StageDecksBinding - are initialized.\r\n * When no Flash is installed, the workbench is ready to be initialized right now.\r\n * Otherwise we wait for the {@link LocalStore} to report readystate.\r\n */\r\nStageBinding.prototype._renameThisMethod = function () {\r\n\r\n\tif ( LocalStore.isInitialized ) {\r\n\t\tthis._initializeWorkbenchLayout ();\r\n\t} else {\r\n\t\tvar self = this;\r\n\t\tEventBroadcaster.subscribe (\r\n\t\t\tBroadcastMessages.LOCALSTORE_INITIALIZED, {\r\n\t\t\t\thandleBroadcast : function () {\r\n\t\t\t\t\tself._initializeWorkbenchLayout ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Initialize workbench layout.\r\n */\r\nStageBinding.prototype._initializeWorkbenchLayout = function () {\r\n\r\n\t/**\r\n\t * If LocalStore is operative, attempt to default select last edited perspective.\r\n\t */\r\n\tif ( this._explorerBinding ) {\r\n\t\tvar persistedHandle = null;\r\n\t\tif ( LocalStore.isEnabled ) {\r\n\t\t\tpersistedHandle = LocalStore.getProperty (\r\n\t\t\t\tLocalStore.SELECTED_PERSPECTIVE_HANDLE\r\n\t\t\t);\r\n\t\t}\r\n\t\tif ( persistedHandle && ViewDefinitions [ persistedHandle ]) { // perspective may be gone since last!\r\n\t\t\talert ( \"StageBinding#_initializeWorkbenchLayout !!!!\" );\r\n\t\t\tthis._explorerBinding.setSelectionByHandle (\r\n\t\t\t\tunescape ( persistedHandle )\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tthis._explorerBinding.setSelectionDefault ();\r\n\t\t}\r\n\t} else {\r\n\t\tthis._onStageReady ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Fires when the stage is ready.\r\n * TODO: The stage may not nescessarily be interactive here!\r\n */\r\nStageBinding.prototype._onStageReady = function () {\r\n\r\n\tif ( !this._isStageReady ) {\r\n\t\tif (top.app.bindingMap.maindecks) {\r\n\t\t\ttop.app.bindingMap.maindecks.select(\"stagedeck\");\r\n\t\t}\r\n\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.STAGE_INITIALIZED );\r\n\t\tthis._isStageReady = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label for usemenu group..\r\n */\r\nStageBinding.prototype._initializeUsergroup = function (root) {\r\n\r\n\tLoginService.GetUserDisplayName(true, function (name) {\r\n\t\ttop.app.bindingMap.usermenu.setLabel(name);\r\n\t});\r\n}\r\n\r\n/**\r\n * Root actions relayed to Tools menu. At least for now...\r\n * @param {SystemNode} root\r\n * @param {List<SystemNode>} perspectives\r\n */\r\nStageBinding.prototype._initializeRootActions = function ( root ) {\r\n\r\n\tvar actions = root.getActionProfile ();\r\n\r\n\tif ( actions && actions.hasEntries ()) {\r\n\r\n\t\t/*\r\n\t\t * The default menugroup\r\n\t\t * for root actions.\r\n\t\t */\r\n\t\tvar menugroup = top.app.bindingMap.toolsmenugroup;\r\n\r\n\t\tvar bundles = new Map();\r\n\r\n\t\tif ( menugroup ) {\r\n\t\t\tactions.each ( function ( groupid, list ) {\r\n\t\t\t\tlist.each ( function ( action ) {\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Build menuitem.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tvar item = MenuItemBinding.newInstance ( menugroup.bindingDocument );\r\n\t\t\t\t\titem.setLabel ( action.getLabel ());\r\n\t\t\t\t\titem.setToolTip ( action.getToolTip ());\r\n\t\t\t\t\titem.setImage ( action.getImage ());\r\n\t\t\t\t\titem.setDisabled ( action.isDisabled ());\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Stamp action on menuitem.\r\n\t\t\t\t\t */\r\n\t\t\t\t\titem.associatedSystemAction = action;\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Brialliant hardcoded setup for dispersing\r\n\t\t\t\t\t * root actions all over the main menubar.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tvar group = menugroup;\r\n\t\t\t\t\tvar tag = action.getTag ();\r\n\t\t\t\t\tif ( tag != null ) {\r\n\t\t\t\t\t\tswitch ( tag ) {\r\n\t\t\t\t\t\t\tcase SystemAction.TAG_CHANGEFROMLANGUAGE :\r\n\t\t\t\t\t\t\t\tgroup = top.app.bindingMap.translationsmenugroup;\r\n\t\t\t\t\t\t\tcase SystemAction.TAG_USER:\r\n\t\t\t\t\t\t\t\tgroup = top.app.bindingMap.usermenugroup;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar bundleName = action.getBundleName();\r\n\t\t\t\t\tif (bundleName) {\r\n\t\t\t\t\t\tif (!bundles.has(bundleName)) {\r\n\t\t\t\t\t\t\tvar bundleItem = MenuItemBinding.newInstance(menugroup.bindingDocument);\r\n\t\t\t\t\t\t\tbundleItem.setLabel(bundleName);\r\n\t\t\t\t\t\t\tbundleItem.setImage(action.getImage());\r\n\t\t\t\t\t\t\tgroup.add(bundleItem);\r\n\r\n\t\t\t\t\t\t\tvar popup = MenuPopupBinding.newInstance(menugroup.bindingDocument);\r\n\t\t\t\t\t\t\tvar body = popup.add(MenuBodyBinding.newInstance(menugroup.bindingDocument));\r\n\t\t\t\t\t\t\tvar menuitemgroup = body.add(MenuGroupBinding.newInstance(menugroup.bindingDocument));\r\n\t\t\t\t\t\t\tbundleItem.add(popup);\r\n\r\n\t\t\t\t\t\t\tbundles.set(bundleName, menuitemgroup);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tgroup = bundles.get(bundleName);;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tgroup.add ( item );\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t\tmenugroup.attachRecursive (); // TODO: lazy the entire menu!!!\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Initialize SystemViewDefinitions (the tree views!).\r\n * @param {List<SystemNode>} nodes\r\n */\r\nStageBinding.prototype._initializeSystemViewDefinitions = function ( nodes ) {\r\n\r\n\twhile ( nodes.hasNext ()) {\r\n\t\tvar node = nodes.getNext ();\r\n\t\tvar handle = node.getHandle ();\r\n\t\tViewDefinitions [ handle ] = new SystemViewDefinition ( node );\r\n\t}\r\n}\r\n\r\n// STARTUP ................................................................\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {FocusBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nStageBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tStageBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\t/*\r\n\t\t * See also next case.\r\n\t\t */\r\n\t\tcase StageDecksBinding.ACTION_INITIALIZED :\r\n\t\t\tif ( !Application.isOperational ) {\r\n\t\t\t\tProgressBarBinding.notch ( 4 );\r\n\t\t\t}\r\n\t\t\tthis._decksBinding = binding;\r\n\t\t\tthis._inflateBinding ( binding );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * See also previous case.\r\n\t\t */\r\n\t\tcase ExplorerBinding.ACTION_INITIALIZED :\r\n\t\t\tif ( !Application.isOperational ) {\r\n\t\t\t\tProgressBarBinding.notch ( 4 );\r\n\t\t\t}\r\n\t\t\tthis._explorerBinding = binding;\r\n\t\t\tthis._inflateBinding ( binding );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase ExplorerMenuBinding.ACTION_SELECTIONCHANGED :\r\n\t\t\tif ( !Application.isOperational ) {\r\n\t\t\t\tProgressBarBinding.notch ( 5 );\r\n\t\t\t}\r\n\t\t\tthis.handlePerspectiveChange(app.bindingMap.explorermenu);\r\n\t\t\tvar tag = app.bindingMap.explorermenu.getSelectionTag();\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.PERSPECTIVE_CHANGED, tag);\r\n\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase TabBoxBinding.ACTION_ATTACHED :\r\n\t\t\tif ( binding instanceof DockBinding ) {\r\n\t\t\t\tswitch ( binding.reference ) {\r\n\t\t\t\t\tcase DockBinding.START :\r\n\t\t\t\t\tcase DockBinding.ABSBOTTOMLEFT :\r\n\t\t\t\t\tcase DockBinding.ABSBOTTOMRIGHT :\r\n\t\t\t\t\tcase DockBinding.ABSRIGHTTOP :\r\n\t\t\t\t\tcase DockBinding.ABSRIGHTBOTTOM :\r\n\t\t\t\t\t\tthis._dockBindings.set ( binding.reference, binding );\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tthis.handleAttachedDock ( binding );\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase TabBoxBinding.ACTION_SELECTED :\r\n\t\t\tif ( binding instanceof DockBinding ) {\r\n\t\t\t\tthis.handleSelectedDockTab (\r\n\t\t\t\t\tbinding.getSelectedTabBinding ()\r\n\t\t\t\t);\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase WindowBinding.ACTION_LOADED :\r\n\r\n\t\t\t// this should really be handled on a lower level, but in case we forget...\r\n\t\t\t// this.logger.warn ( \"window load intercepted by stage: \" + binding.getURL ());\r\n\t\t\tbreak;\r\n\r\n\t\tcase StageBinding.ACTION_DECK_LOADED :\r\n\t\t\tthis._isExplorerReady = true;\r\n\t\t\tif ( this._isDecksReady == true ) {\r\n\t\t\t\tif ( !this._isStageReady ) {\r\n\t\t\t\t\tProgressBarBinding.notch ( 3 );\r\n\t\t\t\t\tthis._onStageReady ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase StageBinding.ACTION_START_LOADED:\r\n\t\t\tif (Application.hasStartPage && KickStart.justLogged && !Client.isPad) {\r\n\t\t\t\tEventBroadcaster.broadcast(BroadcastMessages.START_COMPOSITE);\r\n\t\t\t} else {\r\n\t\t\t\tif (ViewBinding.hasInstance(\"Composite.Management.Start\")) {\r\n\t\t\t\t\tViewBinding.getInstance(\"Composite.Management.Start\").hide();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t/**\r\n\t\t * @see {StageBoxHandlerAbstraction#handleAction}\r\n\t\t */\r\n\t\tcase StageSplitPanelBinding.ACTION_LAYOUTUPDATE :\r\n\r\n\t\t\t/*\r\n\t\t \t * Theoretically, this could be done at a much lower level.\r\n\t\t \t * This should be considered if panel handling gets too slow.\r\n\t\t \t * Explorer has some rendering update disabilities, though.\r\n\t\t \t */\r\n\t\t \tif ( !this._isFlexAbort && Application.isOperational ) {\r\n\r\n\t\t \t\tthis._isFlexAbort = true;\r\n\t\t \t\tthis.reflex ( true );\r\n\t\t \t\tvar self = this;\r\n\t\t \t\tsetTimeout ( function () {\r\n\t\t \t\t\tif ( Client.isMozilla == true ) {\r\n\t\t \t\t\t\tself.reflex ( true ); // why?\r\n\t\t \t\t\t}\r\n\t\t \t\t\tself._isFlexAbort = false;\r\n\t\t\t \t}, 0 );\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase StageDeckBinding.ACTION_LOADED :\r\n\t\t\tthis._isDecksReady = true;\r\n\t\t\tif ( this._isExplorerReady == true ) {\r\n\t\t\t\tif ( !this._isStageReady ) {\r\n\t\t\t\t\tthis._onStageReady ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (binding.isDefaultStageDeck) {\r\n\r\n\t\t\t\t//NEW UI: LOAD Browser to first tab\r\n\t\t\t\tvar deck = action.target;\r\n\r\n\t\t\t\tthis._activeViewDefinitions[\"Composite.Management.Browser\"] = deck.definition;\r\n\r\n\t\t\t\tvar browserViewDefinition = ViewDefinitions[\"Composite.Management.Browser\"];\r\n\t\t\t\tbrowserViewDefinition.image = deck.definition.image;\r\n\t\t\t\tbrowserViewDefinition.label = deck.definition.label;\r\n\t\t\t\tbrowserViewDefinition.toolTip = deck.definition.toolTip;\r\n\r\n\t\t\t\tbrowserViewDefinition.argument[\"SystemViewDefinition\"] = deck.definition;\r\n\t\t\t\tbrowserViewDefinition.argument[\"URL\"] = null;\r\n\t\t\t\tbrowserViewDefinition.argument.image = deck.definition.image;\r\n\t\t\t\tbrowserViewDefinition.argument.label = deck.definition.label;\r\n\t\t\t\tbrowserViewDefinition.argument.toolTip = deck.definition.toolTip;\r\n\t\t\t\tdeck._browserTab = deck._dockBindings.get(\"main\").prepareNewView(browserViewDefinition);\r\n\t\t\t\tdeck._browserTab.isExplorerTab = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * The ErrorBinding needs a consumer.\r\n\t\t */\r\n\t\tcase ErrorBinding.ACTION_INITIALIZE :\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\t/*\r\n\t * Notice this hack!\r\n\t */\r\n\tStageBoxHandlerAbstraction.handleAction.call ( this, action );\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} message\r\n * @param {object} arg\r\n */\r\nStageBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tStageBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\r\n\t\tcase BroadcastMessages.VIEW_OPENED :\r\n\t\t\tApplication.unlock ( this );\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.VIEW_CLOSED :\r\n\t\t \tvar handle = arg;\r\n\t\t\tthis._dontView ( handle );\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.COMPOSITE_START :\r\n\t\t\tthis._showStart ( true );\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.COMPOSITE_STOP :\r\n\t\t\tthis._showStart ( false );\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.DOCK_MAXIMIZED :\r\n\t\t\tthis._stabilizeExplorer ();\r\n\t\t\tif ( this._isShowingStart ) {\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.STOP_COMPOSITE );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.DOCK_NORMALIZED :\r\n\t\t\tthis._stabilizeExplorer ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {Event} e\r\n */\r\nStageBinding.prototype.handleEvent = function (e) {\r\n\r\n\tStageBinding.superclass.handleEvent.call(this, e);\r\n\r\n\tswitch (e.type) {\r\n\t\tcase DOMEvents.HASHCHANGE:\r\n\t\t\tthis.handleHash(e.target);\r\n\t\t\te.preventDefault();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\nStageBinding.prototype.handleHash = function (target) {\r\n\r\n\tif (target && target.location && target.location.hash) {\r\n\t\tvar serializedMessage = target.location.hash.replace(/^#/, '');\r\n\t\tif (serializedMessage) {\r\n\t\t\tif (target.history && target.history.replaceState) {\r\n\t\t\t\ttarget.history.replaceState({}, target.document.title, target.location.href.split('#')[0]);\r\n\t\t\t} else {\r\n\t\t\t\ttarget.location.hash = \"\";\r\n\t\t\t}\r\n\r\n\t\t\tMessageQueue.placeConsoleCommand(decodeURIComponent(serializedMessage));\r\n\t\t\tMessageQueue.update();\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.COMPOSITE_STOP);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Explorer may have difficulties computing stage layout\r\n * when docks are maximized and normalized. Let's hack it.\r\n */\r\nStageBinding.prototype._stabilizeExplorer = function () {\r\n\r\n\tif ( Client.isExplorer == true ) {\r\n\t\tvar self = this;\r\n\t\tif  ( Client.isExplorer == true ) {\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tself.reflex ( true );\r\n\t\t\t}, 0 )\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Show start?\r\n * @param {boolean} isShow\r\n */\r\nStageBinding.prototype._showStart = function ( isShow ) {\r\n\r\n\tif ( isShow != this._isShowingStart ) {\r\n\r\n\t\tvar view = ViewBinding.getInstance ( \"Composite.Management.Start\" );\r\n\t\tvar dock = this._dockBindings.get ( DockBinding.START );\r\n\t\tif ( isShow ) {\r\n\t\t\tview.show ();\r\n\t\t} else {\r\n\t\t\tview.hide ();\r\n\t\t\tif ( dock != null && dock.isActive ) {\r\n\t\t\t\tdock.deActivate ();\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis._isShowingStart = isShow;\r\n\t}\r\n}\r\n\r\n/**\r\n * This will inflate either the {@link ExplorerBinding} or the {@link StageDecksBinding}\r\n * @param {Binding} binding\r\n */\r\nStageBinding.prototype._inflateBinding = function ( binding ) {\r\n\r\n\tfor ( var handle in ViewDefinitions ) {\r\n\t\tvar definition = ViewDefinitions [ handle ];\r\n\t\tif ( definition instanceof SystemViewDefinition ) {\r\n\t\t\tbinding.mountDefinition ( definition );\r\n\t\t}\r\n\t}\r\n\tvar isReady = ( this._decksBinding != null && this._explorerBinding != null );\r\n\tif ( isReady ) {\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tself._renameThisMethod ();\r\n\t\t}, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Iterate stagebox bindings. This method is required by the StageBoxAbstractionHandler.\r\n * @see {StageBoxHandlerAbstraction#handleControlBoxAction}\r\n * @param {string} mode\r\n */\r\nStageBinding.prototype.iterateContainedStageBoxBindings = function ( mode ) {\r\n\r\n\tvar crawler = new StageCrawler ();\r\n\tcrawler.mode = mode;\r\n\tcrawler.crawl ( this.bindingElement );\r\n\tcrawler.dispose ();\r\n}\r\n\r\n/**\r\n * Fires when the ExplorerBinding selection changes, selecting associated StageDeckBinding.\r\n * @see {ExplorerBinding#handleSelectionChange}\r\n * @param {ExplorerMenuBinding} explorerMenuBinding\r\n */\r\nStageBinding.prototype.handlePerspectiveChange = function ( explorerMenuBinding ) {\r\n\r\n\tvar handle = explorerMenuBinding.getSelectionHandle ();\r\n\tthis._decksBinding.setSelectionByHandle ( handle );\r\n\tif ( LocalStore.isEnabled ) {\r\n\t\tLocalStore.setProperty (\r\n\t\t\tLocalStore.SELECTED_PERSPECTIVE_HANDLE,\r\n\t\t\tescape ( handle )\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Fires when a DockBinding gets attached during startup.\r\n * @param {DockBinding} dockBinding\r\n */\r\nStageBinding.prototype.handleAttachedDock = function ( dockBinding ) {\r\n\r\n\t/*\r\n\t * Initialize open views. Initialization of the\r\n\t * Start view is dependant on application settings.\r\n\t */\r\n\tvar tabBindings = dockBinding.getTabBindings ();\r\n\tif ( tabBindings.hasEntries ()) {\r\n\t\twhile ( tabBindings.hasNext ()) {\r\n\t\t\tvar tabBinding = tabBindings.getNext ();\r\n\t\t\tvar handle = tabBinding.getHandle ();\r\n\t\t\tif ( handle ) {\r\n\t\t\t\t\tvar viewDefinition = ViewDefinitions [ handle ];\r\n\t\t\t\t\tif ( viewDefinition ) {\r\n\t\t\t\t\t\tthis._view ( dockBinding, tabBinding, viewDefinition, false );\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\talert ( \"StageBinding: no such predefined viewdefinition (\" + handle + \")\" );\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * Please use the static method StageBinding.presentViewDefinition\r\n * Presenting the ViewDefinition on stage.\r\n * @param {ViewDefinition} viewDefinition\r\n */\r\nStageBinding.prototype._presentViewDefinition = function (viewDefinition, contextSource) {\r\n\r\n\tvar target = null;\r\n\tvar isAbort = false;\r\n\r\n\tswitch ( viewDefinition.position ) {\r\n\r\n\t\tcase Dialog.MODAL :\r\n\t\t\ttarget = app.bindingMap.masterdialogset.getModalInstance ();\r\n\t\t\tbreak;\r\n\t\tcase Dialog.NON_MODAL :\r\n\t\t\ttarget = app.bindingMap.masterdialogset.getInstance ();\r\n\t\t\tbreak;\r\n\r\n\t\tdefault :\r\n\t\t\tif ( this._dockBindings.hasEntries ()) { // somehow no docks when user has no perspectives mounted...\r\n\t\t\t\tswitch ( viewDefinition.position ) {\r\n\r\n\t\t\t\t\tcase DockBinding.ABSBOTTOMLEFT :\r\n\t\t\t\t\tcase DockBinding.ABSBOTTOMRIGHT :\r\n\t\t\t\t\tcase DockBinding.ABSRIGHTTOP :\r\n\t\t\t\t\tcase DockBinding.ABSRIGHTBOTTOM :\r\n\r\n\t\t\t\t\t\t// targetting the developer docks.\r\n\t\t\t\t\t\ttarget = this._dockBindings.get ( viewDefinition.position );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase DockBinding.EXTERNAL:\r\n\r\n\t\t\t\t\t\t// Open a new window/tab with the provided url\r\n\t\t\t\t\t\twindow.open(viewDefinition.url);\r\n\t\t\t\t\t\tisAbort = true;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase DockBinding.SLIDE:\r\n\t\t\t\t\t\tvar selectedDeck = this._decksBinding.getSelectedDeckBinding();\r\n\r\n\t\t\t\t\t\tvar dock = selectedDeck.getDockBindingByReference(DockBinding.MAIN);\r\n\t\t\t\t\t\tvar panel = dock.getSelectedTabPanelBinding();\r\n\r\n\t\t\t\t\t\tvar viewBinding = SlideInViewBinding.newInstance(panel.viewBinding.getContentDocument());\r\n\t\t\t\t\t\tviewBinding.setDefinition(viewDefinition);\r\n\t\t\t\t\t\tviewBinding.attach();\r\n\t\t\t\t\t\tviewBinding.snapToBinding(panel.viewBinding.getRootBinding());\r\n\r\n\t\t\t\t\t\tisAbort = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault :\r\n\r\n\t\t\t\t\t\t// targetting the main stage.\r\n\t\t\t\t\t\tvar selectedDeck = this._decksBinding.getSelectedDeckBinding();\r\n\t\t\t\t\t\tif (selectedDeck.isPlaceholder()) {\r\n\t\t\t\t\t\t\ttarget = this._dockBindings.get(DockBinding.ABSRIGHTTOP);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\ttarget = selectedDeck.getDockBindingByReference(\r\n\t\t\t\t\t\t\t\tviewDefinition.position\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// hide start stuff if present.\r\n\t\t\t\t\t\tif ( this._isShowingStart ) {\r\n\t\t\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.STOP_COMPOSITE );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tisAbort = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif ( !isAbort ) {\r\n\t\tif (target != null) {\r\n\t\t\tif (contextSource != undefined && Interfaces.isImplemented(IContextContainerBinding, target)) {\r\n\t\t\t\tvar contextContainer = ContextContainer.getContextContainer(contextSource);\r\n\t\t\t\tif (contextContainer != null) {\r\n\t\t\t\t\ttarget.setContextContainer(contextContainer);\r\n\r\n\t\t\t\t\t//TODO: Move resolving URL\r\n\t\t\t\t\tif (viewDefinition && viewDefinition.argument && viewDefinition.argument.url) {\r\n\t\t\t\t\t\tviewDefinition.argument.url = ContextContainer.resolve(viewDefinition.argument.url, contextContainer);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tthis._view(target, null, viewDefinition, true);\r\n\t\t} else {\r\n\t\t\tthrow \"StageBinding: Could not position view: \" + viewDefinition.handle;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Launches the view on stage while indexing view as an active view.\r\n * @param {Binding} target\r\n * @param {DockTabBinding} dockTabBinding Required when launching open views.\r\n * @param {ViewDefinition} viewDefinition\r\n * @param {boolean} isNewView True for newly launched views, false for views opened at startup.\r\n */\r\nStageBinding.prototype._view = function ( target, dockTabBinding, viewDefinition, isNewView ) {\r\n\r\n\tvar handle = viewDefinition.handle;\r\n\tif ( viewDefinition.isMutable ) {\r\n\t\thandle += KeyMaster.getUniqueKey ();\r\n\t}\r\n\r\n\tif ( this._activeViewDefinitions [ handle ] ) {\r\n\r\n\t\t/*\r\n\t\t * Update already open view.\r\n\t\t */\r\n\t\tvar viewBinding = ViewBinding.getInstance ( handle );\r\n\t\tif (viewBinding != null) {\r\n\t\t\ttarget._selectTabByView(viewBinding);\r\n\t\t\tviewBinding.update ();\r\n\t\t} else {\r\n\t\t\tthis.logger.error ( \"Could not update ViewBinding (declared open): \\n\" + handle );\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\t/*\r\n\t\t * Initialize new view.\r\n\t\t */\r\n\t\tthis._activeViewDefinitions [ handle ] = viewDefinition;\r\n\r\n\t\t/*\r\n\t\t * Lock interface. Unlocked around method handleBroadcast.\r\n\t\t */\r\n\t\tApplication.lock ( this );\r\n\r\n\t\tswitch ( target.constructor ) {\r\n\t\t\tcase DockBinding :\r\n\t\t\t\tif ( isNewView ) {\r\n\t\t\t\t\ttarget.prepareNewView ( viewDefinition );\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget.prepareOpenView ( viewDefinition, dockTabBinding );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase StageDialogBinding :\r\n\t\t\t\tif ( isNewView ) {\r\n\t\t\t\t\ttarget.prepareNewView ( viewDefinition );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Called whenever a view is disposed from stage, unregistering view as an active view.\r\n * @param {string} handle\r\n */\r\nStageBinding.prototype._dontView = function ( handle ) {\r\n\r\n\tif ( this._activeViewDefinitions [ handle ] != null ) {\r\n\t\tdelete this._activeViewDefinitions [ handle ];\r\n\t} else {\r\n\t\tthis.logger.debug ( \"Could not unregister active view: \" + handle );\r\n\t}\r\n}\r\n\r\n/**\r\n * Select Browser tab\r\n */\r\nStageBinding.prototype.selectBrowserTab = function () {\r\n\r\n\tvar deck = this._decksBinding.getSelectedDeckBinding();\r\n\tvar browserTab = deck.getBrowserTab();\r\n\tif (browserTab && !browserTab.isSelected) {\r\n\t\tvar tree = deck.getSystemTree();\r\n\t\tif (tree != null) {\r\n\t\t\ttree.setHandleToken(null);\r\n\t\t}\r\n\t\tbrowserTab.containingTabBoxBinding.select(browserTab, true);\r\n\t}\r\n}\r\n\r\n/**\r\n * Fires when a DockTabBinding get's selected. During\r\n * startup, the visible tab get's selected by default.\r\n * @param {DockTabBinding} tabBinding\r\n */\r\nStageBinding.prototype.handleSelectedDockTab = function ( tabBinding ) {\r\n\r\n\t// this.logger.warn ( \"TODO: StageBinding#handleSelectedDockTab\" );\r\n\t/*\r\n\tvar viewBinding = tabBinding.getAssociatedView ();\r\n\tif ( viewBinding && !viewBinding._isViewBindingInitialized ) {\r\n\t\tviewBinding.initialize ();\r\n\t}\r\n\t*/\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/StageContainerBinding.js",
    "content": "StageContainerBinding.prototype = new FlexBoxBinding;\r\nStageContainerBinding.prototype.constructor = StageContainerBinding;\r\nStageContainerBinding.superclass = FlexBoxBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * The stagecontainer is simply setup to flex all descendant bindings \r\n * (including bindings in descendant iframes) when the window is resized.\r\n * The really interesting stuff can be found in the {@link StageBinding}\r\n */\r\nfunction StageContainerBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageContainerBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageContainerBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageContainerBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nStageContainerBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tStageContainerBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.subscribe ( BroadcastMessages.APPLICATION_OPERATIONAL );\r\n}\r\n\r\n/** \r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nStageContainerBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tStageContainerBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tvar winmanager = this.bindingWindow.WindowManager;\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Flex on startup.\r\n\t\t */\r\n\t\tcase BroadcastMessages.APPLICATION_OPERATIONAL :\r\n\t\t\tthis.subscribe ( winmanager.WINDOW_RESIZED_BROADCAST );\r\n\t\t\tthis._fit ();\r\n\t\t\tthis.reflex ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\t/*\r\n\t\t * Flex on window resize.\r\n\t\t */\r\n\t\tcase winmanager.WINDOW_RESIZED_BROADCAST :\t\t\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Explorer is slow, so for IE we lock the layout in    \r\n\t\t\t * order to discourage UI interaction while resizing. \r\n\t\t\t */\r\n\t\t\tif ( Client.isMozilla == true ) {\r\n\t\t\t\tthis._fit ();\r\n\t\t\t\tthis.reflex ();\r\n\t\t\t} else {\r\n\t\t\t\tApplication.lock ( this );\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tself._fit ();\r\n\t\t\t\t\tself.reflex ();\r\n\t\t\t\t\tApplication.unlock ( self );\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Fit stage to window width. Doing this by   \r\n * script in order to tighten up the layout. \r\n */\r\nStageContainerBinding.prototype._fit = function () {\r\n\t\r\n\tvar winmanager = this.bindingWindow.WindowManager;\r\n\tthis.bindingElement.style.width = winmanager.getWindowDimensions ().w + \"px\";\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/StageCrawler.js",
    "content": "StageCrawler.prototype = new BindingCrawler;\r\nStageCrawler.prototype.constructor = StageCrawler;\r\nStageCrawler.superclass = BindingCrawler.prototype;\r\n\r\nStageCrawler.ID = \"stagecrawler\";\r\nStageCrawler.MODE_MAXIMIZE = \"maximize\";\r\nStageCrawler.MODE_UNMAXIMIZE = \"minimize\";\r\n\r\n/**\r\n * @class\r\n * The ElementCrawler sees only elements with Bindings attached.\r\n */\r\nfunction StageCrawler () {\r\n\t\r\n\tthis.mode = StageCrawler.MODE_MAXIMIZE;\r\n\tthis.id = StageCrawler.ID;\r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * * Filter all but Binding elements.\r\n * @overloads {ElementCrawler#_construct} \r\n */\r\nStageCrawler.prototype._construct = function () {\r\n\t\r\n\tStageCrawler.superclass._construct.call ( this );\r\n\t\r\n\tvar self = this;\r\n\tthis.addFilter ( function ( element ) {\r\n\t\t\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t \tvar result = null;\r\n\t\t\r\n\t\tif ( binding ) {\r\n\t\t\tswitch ( binding.constructor ) {\r\n\t\t\t\tcase StageSplitBoxBinding :\r\n\t\t\t\tcase StageSplitPanelBinding :\r\n\t\t\t\tcase StageSplitterBinding :\r\n\t\t\t\t\tswitch ( self.mode ) {\r\n\t\t\t\t\t\tcase StageCrawler.MODE_MAXIMIZE :\r\n\t\t\t\t\t\t\tbinding.handleMaximization ();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase StageCrawler.MODE_UNMAXIMIZE :\r\n\t\t\t\t\t\t\tbinding.handleUnMaximization ();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DockBinding :\r\n\t\t\t\t\tresult = NodeCrawler.SKIP_NODE;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/abstractions/StageBoxAbstraction.js",
    "content": "StageBoxAbstraction.ACTION_HIDDENSTUFF_UPDATED = \"hidden stagebox stuff updated\";\r\n\r\n/**\r\n * @class\r\n * This class is never instantiated, we just need to borrow it's methods for other \r\n * classes. This hack is very javascriptish, but it helps us not to copypaste some code.\r\n * @see {StageSplitBoxBinding}\r\n * @see {StageSplitPanelBinding}\r\n */\r\nfunction StageBoxAbstraction () {\r\n\r\n \t/**\r\n \t * \r\n \t * @type {boolean}\r\n \t */\r\n\tthis.isMaximizePrepared = false;\r\n\t\r\n\t/**\r\n \t * @type {boolean}\r\n \t */\r\n\tthis.isMaximizedForReal = null;\r\n\t\r\n\t/**\r\n \t * @type {boolean}\r\n \t */\r\n\tthis.isMinimizedForReal = null;\r\n\t\r\n\t/**\r\n \t * @type {boolean}\r\n \t */\r\n\tthis.isHiddenForReal = null;\r\n}\r\n\r\n/**\r\n * @see {StageSplitBoxBinding#onBindingRegister}\r\n * @see {StageSplitPanelBinding#onBindingRegister}\r\n */\r\nStageBoxAbstraction.onBindingRegister = function () {\r\n\r\n\tthis.addActionListener ( ControlBoxBinding.ACTION_MAXIMIZE );\r\n\tthis.addActionListener ( ControlBoxBinding.ACTION_MINIMIZE );\r\n\tthis.addActionListener ( ControlBoxBinding.ACTION_NORMALIZE );\r\n\tthis.addActionListener ( TabBoxBinding.ACTION_UPDATED );\r\n}\r\n\r\n/**\r\n * @see {StageSplitBoxBinding#handleAction}\r\n * @see {StageSplitPanelBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nStageBoxAbstraction.handleAction = function ( action ) {\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase ControlBoxBinding.ACTION_MAXIMIZE :\r\n\t\t \tthis.isMaximizePrepared = true;\r\n\t\t\tbreak;\r\n\t\tcase ControlBoxBinding.ACTION_MINIMIZE :\r\n\t\t \tthis.isMinimizedForReal = true;\r\n\t\t \tbreak;\r\n\t\tcase ControlBoxBinding.ACTION_NORMALIZE :\r\n\t\t \tthis.isMaximizePrepared = false;\r\n\t\t \tthis.isMinimizedForReal = null;\r\n\t\t \tbreak;\r\n\t\tcase TabBoxBinding.ACTION_UPDATED : // TODO: DockBinding.ACTION_ACTIVATED?\r\n\t\t\tif ( action.target instanceof DockBinding ) {\r\n\t\t\t\tif ( this.isHiddenForReal ) {\r\n\t\t\t\t\tthis.dispatchAction ( \r\n\t\t\t\t\t\tStageBoxAbstraction.ACTION_HIDDENSTUFF_UPDATED \r\n\t\t\t\t\t);\r\n\t\t\t\t} else if ( this.isMinimizedForReal ) {\r\n\t\t\t\t\tthis.normalize ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Maximize. This method is called by the StageCrawler.\r\n */\r\nStageBoxAbstraction.handleMaximization = function () {\r\n\r\n\tif ( this.isMaximizePrepared == true ) {\r\n\t \tthis.isMaximizedForReal = true;\r\n\t \tthis.isHiddenForReal = false;\r\n\t \tthis.isFlexible = false;\r\n\t \tif ( Client.isMozilla == true ) {\r\n\t \t\tvar style = this.bindingElement.style;\r\n\t \t\tstyle.position\t= \"absolute\";\r\n\t\t\tstyle.width\t\t= \"100%\";\r\n\t\t\tstyle.height\t= \"100%\";\r\n\t\t\tstyle.top \t\t= \"0\";\r\n\t\t\tstyle.left \t\t= \"0\";\r\n\t \t} else {\r\n\t\t \tthis.attachClassName ( \"maximized\" );\r\n\t \t\tif ( this instanceof StageSplitPanelBinding ) {\r\n\t \t\t\tStageBoxAbstraction._emulateBasicCSS ( this, true );\r\n\t \t\t}\r\n\t \t}\r\n\t} else {\r\n\t\tthis.isMaximizedForReal = false;\r\n\t\tthis.isHiddenForReal = true;\r\n\t\tif ( this instanceof StageSplitPanelBinding ) {\r\n\t\t\tthis.invisibilize ( true );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Unmaximize. This method is called by the StageCrawler.\r\n */\r\nStageBoxAbstraction.handleUnMaximization = function () {\r\n\t\r\n\tif ( this.isMaximizedForReal == true ) {\r\n\t\tthis.isFlexible = true;\r\n\t\tif ( Client.isMozilla == true ) {\r\n\t\t\tvar style = this.bindingElement.style;\r\n\t\t\tstyle.position\t= \"relative\";\r\n\t\t\tstyle.width\t\t= \"auto\";\r\n\t\t\tstyle.height\t= \"auto\";\r\n\t\t\tstyle.top \t\t= \"auto\";\r\n\t\t\tstyle.left \t\t= \"auto\";\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( \"maximized\" );\r\n\t\t\tif ( this instanceof StageSplitPanelBinding ) {\r\n\t\t\t\tStageBoxAbstraction._emulateBasicCSS ( this, false );\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tif ( this instanceof StageSplitPanelBinding ) {\r\n\t\t\tthis.invisibilize ( false );\r\n\t\t}\r\n\t}\r\n\tthis.isMaximizePrepared = false\r\n\tthis.isMaximizedForReal = null;\r\n\tthis.isHiddenForReal = null;\r\n}\r\n\r\n/**\r\n * Explorer sucks. This explains why IE cannot reliably resolve the meaning of  \r\n * width and height set to 100%. We hack it with Javascript and forget about it.\r\n * @param {StageSplitPanelBinding} binding\r\n * @param {boolean} isMimic\r\n */\r\nStageBoxAbstraction._emulateBasicCSS = function ( binding, isMimic ) {\r\n\t\r\n\tvar style = binding.bindingElement.style;\r\n\tvar parent = binding.bindingElement.parentNode;\r\n\tvar box = binding._containingSplitBoxBinding;\r\n\t\r\n\tif ( Client.isExplorer == true ) {\r\n\t\tif ( isMimic ) {\r\n\t\t\tbinding._unmodifiedFlexMethod = binding.flex;\r\n\t\t\tbinding.flex = function () {\r\n\t\t\t\tstyle.width = parent.offsetWidth + \"px\";\r\n\t\t\t\tstyle.height = parent.offsetHeight + \"px\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tstyle.width = \"100%\";\r\n\t\t\tstyle.height = \"100%\";\r\n\t\t\tif ( !box.isHorizontalOrient ()) { // now it gets really painful...\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tstyle.width = \"auto\";\r\n\t\t\t\t\tstyle.height = \"auto\";\r\n\t\t\t\t\tbox.reflex ( true );\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t\tbinding.flex = binding._unmodifiedFlexMethod;\r\n\t\t\tbinding._unmodifiedFlexMethod = null;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/*\r\nvar s = \"StageBoxAbstraction\\n\\n\"\r\ns += \"TODO: invisibilize main when unmaximize\\n\\n\";\r\ns += \"TODO: Reflex stage on maximize (timeout? max low panels to see)\\n\\n\";\r\ns += \"TODO: Reflex stage on unmaximize (maximize, resize, unmaximize to see)\";\r\nalert ( s );\r\n*/"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/abstractions/StageBoxHandlerAbstraction.js",
    "content": "/**\r\n * This class is never instantiated, we just need to borrow it's methods for other \r\n * classes (as if this class belonged in the inheritance chain of these classes).\r\n * This hack is very javascriptish, but it helps us not to copypaste some code.\r\n * @see {StageDeckBinding}\r\n * @see {StageBinding}\r\n */\r\nfunction StageBoxHandlerAbstraction () {\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isSubPanelMaximized = false;\r\n}\r\n\r\n/**\r\n * Registering listeners for maximization and unmaximization of panels.\r\n */\r\nStageBoxHandlerAbstraction.onBindingRegister = function () {\r\n\r\n\tthis.addActionListener ( ControlBoxBinding.ACTION_MAXIMIZE, this );\r\n\tthis.addActionListener ( ControlBoxBinding.ACTION_NORMALIZE, this );\r\n\tthis.addActionListener ( StageBoxAbstraction.ACTION_HIDDENSTUFF_UPDATED, this );\r\n\tthis.addActionListener ( StageSplitPanelBinding.ACTION_LAYOUTUPDATE, this );\r\n}\r\n\r\n/**\r\n * @param {Action} action\r\n */\r\nStageBoxHandlerAbstraction.handleAction = function ( action ) {\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase ControlBoxBinding.ACTION_MAXIMIZE :\r\n\t\tcase ControlBoxBinding.ACTION_NORMALIZE :\r\n\t\t\tif ( binding instanceof StageSplitPanelBinding ) {\r\n\t\t\t\tStageBoxHandlerAbstraction.handleControlBoxAction.call ( this, action );\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase StageBoxAbstraction.ACTION_HIDDENSTUFF_UPDATED :\r\n\t\t\tif ( this.isSubPanelMaximized ) {\r\n\t\t\t\t/*\r\n\t\t\t\tvar filter = StageBoxHandlerAbstraction.unMaximizeFilter;\r\n\t\t\t\t*/\r\n\t\t\t\tthis.iterateContainedStageBoxBindings ( StageCrawler.MODE_UNMAXIMIZE );\r\n\t\t\t\tthis.isSubPanelMaximized = false;\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\r\n\t\t/*\r\n\t\t * see {StageBinding#handleAction}\r\n\t\t */\r\n\t\tcase StageSplitPanelBinding.ACTION_LAYOUTUPDATE :\r\n\t\t \tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle {@link ControlBoxBinding} actions.\r\n * @param {Action} action\r\n * @return {function}\r\n */\r\nStageBoxHandlerAbstraction.handleControlBoxAction = function ( action ) {\r\n\t\r\n\tvar mode = null;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase ControlBoxBinding.ACTION_MAXIMIZE :\r\n\t\t\tif ( !this.isSubPanelMaximized ) {\r\n\t\t\t\tmode = StageCrawler.MODE_MAXIMIZE;\r\n\t\t\t\tthis.isSubPanelMaximized = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase ControlBoxBinding.ACTION_NORMALIZE :\r\n\t\t\tif ( this.isSubPanelMaximized ) {\r\n\t\t\t\tmode = StageCrawler.MODE_UNMAXIMIZE;\r\n\t\t\t\tthis.isSubPanelMaximized = false;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\tif ( mode != null ) {\r\n\t\tthis.iterateContainedStageBoxBindings ( mode );\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/decks/StageDeckBinding.js",
    "content": "﻿StageDeckBinding.prototype = new DeckBinding;\r\nStageDeckBinding.prototype.constructor = StageDeckBinding;\r\nStageDeckBinding.superclass = DeckBinding.prototype;\r\n\r\nStageDeckBinding.ACTION_LOADED = \"stagedeck loaded\";\r\nStageDeckBinding.NODENAME_DECKS = \"stagedecks\";\r\nStageDeckBinding.DEFAULT_URL = \"${root}/content/misc/stage/stagedeck.aspx\";\r\nStageDeckBinding.CLASSNAME_TOOLS_OPEN = \"toolsopen\";\r\n\r\n/**\r\n * @class\r\n * Please notice that some of these methods get evaluated in the\r\n * context of the {@link StageBoxHandlerAbstraction} in order\r\n * not to copy-paste code shared with the {@link StageBinding}.\r\n * @extends {StageBoxHandlerAbstraction}\r\n */\r\nfunction StageDeckBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageDeckBinding\" );\r\n\r\n\t/**\r\n\t * This property is set by the {@link StageDecksBinding}\r\n\t * when the deck is constructed.\r\n\t * @type {string}\r\n\t */\r\n\tthis.handle = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.path = null;\r\n\r\n\t/**\r\n\t * If true, contained tree needs to be refreshed.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isRefreshRequired = false;\r\n\r\n\t/**\r\n\t * Associates the deck to the selected perspective.\r\n\t * This property is set by the {@link StageDecksBinding} while building.\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.perspectiveNode = null;\r\n\r\n\t/**\r\n\t * This flag is flipped once the *initial* content is loaded.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isReady = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDefaultStageDeck = true;\r\n\r\n\t/**\r\n\t * This flag is flipped once the *real* content is loaded.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isStageDeckBindingInitialized = false;\r\n\r\n\t/**\r\n\t * Indexing docks by reference property.\r\n\t * @type {Map<string><DockBinding>}\r\n\t */\r\n\tthis._dockBindings = null;\r\n\r\n\t/**\r\n\t * Counting open docks in order\r\n\t * to show and hide dockcontrols.\r\n\t * @type {int}\r\n\t */\r\n\tthis._dockBindingCount = 0;\r\n\r\n\t/**\r\n\t * Gets assigned in the newInstance method.\r\n\t * @type {WindowBinding}\r\n\t */\r\n\tthis.windowBinding = null;\r\n\r\n\t/**\r\n\t * Flipped by the StageBoxHandlerAbstraction when a panel is maximized.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isSubPanelMaximized = false;\r\n\r\n\r\n\tthis.definition = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageDeckBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageDeckBinding]\";\r\n}\r\n\r\n/**\r\n * Notice that we are simulating a {@link StageBoxHandlerAbstraction} in\r\n * the inheritance chain. That's because the {@link StageBinding} is\r\n * interested in some of these functionalities as well.\r\n * @overloads {DecksBinding#onBindingRegister}\r\n */\r\nStageDeckBinding.prototype.onBindingRegister = function () {\r\n\r\n\tStageDeckBinding.superclass.onBindingRegister.call ( this );\r\n\tStageBoxHandlerAbstraction.onBindingRegister.call ( this );\r\n\r\n\tthis._dockBindings = new Map ();\r\n\r\n\tthis.addActionListener ( WindowBinding.ACTION_LOADED );\r\n\tthis.addActionListener ( TabBoxBinding.ACTION_ATTACHED );\r\n\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHALL);\r\n}\r\n\r\n/**\r\n * On first load event, the iframe is simply registered. On second load event,\r\n * the actual deck content has been loaded and the deck gets selected. Setup\r\n * ensures that there is no flash of white when Explorer loads deck content.\r\n * TODO: this url should probably be set already in the newInstance method\r\n * to avoid window content loading twice...\r\n * @implements {IActionListener}\r\n * @overloads {DeckBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nStageDeckBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tStageDeckBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\t/*\r\n\t\t * Startup.\r\n\t\t */\r\n\t\tcase WindowBinding.ACTION_LOADED :\r\n\t\t\tif ( binding == this.windowBinding ) {\r\n\t\t\t\ttop.app.bindingMap.stagedeckscover.hide ();\r\n\t\t\t\tthis.removeActionListener ( WindowBinding.ACTION_LOADED );\r\n\t\t\t\tthis.addActionListener ( StageSplitBoxBinding.ACTION_DOCK_EMPTIED );\r\n\t\t\t\tthis.addActionListener ( StageSplitBoxBinding.ACTION_DOCK_OPENED );\r\n\t\t\t\tthis.dispatchAction(StageDeckBinding.ACTION_LOADED);\r\n\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * Indexing docks on startup.\r\n\t\t */\r\n\t\tcase TabBoxBinding.ACTION_ATTACHED :\r\n\t\t\tif ( binding instanceof DockBinding ) {\r\n\t\t\t\tthis._dockBindings.set ( binding.reference, binding );\r\n\t\t\t\tbinding.perspectiveNode = this.perspectiveNode;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * Show dockcontrols when MORE than one dock is open.\r\n\t\t */\r\n\t\tcase StageSplitBoxBinding.ACTION_DOCK_OPENED :\r\n\t\t\tthis._dockBindingCount ++;\r\n\t\t\t//if ( this._dockBindingCount == 2 ) {\r\n\t\t\t//\tthis._dockBindings.get ( \"main\" ).showControls ( true );\r\n\t\t\t//}\r\n\t\t\taction.consume (); // StageBinding is no longer listening!\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * Hide dockcontrols only one deck is open.\r\n\t\t */\r\n\t\tcase StageSplitBoxBinding.ACTION_DOCK_EMPTIED :\r\n\t\t\tthis._dockBindingCount --;\r\n\t\t\t//if ( this._dockBindingCount == 1 ) {\r\n\t\t\t//\tthis._dockBindings.get ( \"main\" ).showControls ( false );\r\n\t\t\t//}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\t/*\r\n\t * Notice this hack!\r\n\t */\r\n\tStageBoxHandlerAbstraction.handleAction.call ( this, action );\r\n\tStageDeckBinding.superclass.handleAction.call ( this, action );\r\n}\r\n\r\n/**\r\n * Iterate stagebox bindings, starting inside the contained WindowBinding.\r\n * This method is required by the StageBoxAbstractionHandler.\r\n * @see {StageBoxHandlerAbstraction#handleControlBoxAction}\r\n * @param {string} mode\r\n */\r\nStageDeckBinding.prototype.iterateContainedStageBoxBindings = function ( mode ) {\r\n\r\n\tvar crawler = new StageCrawler ();\r\n\tcrawler.mode = mode;\r\n\tcrawler.crawl ( this.windowBinding.getContentDocument ().body );\r\n\tcrawler.dispose ();\r\n}\r\n\r\n/**\r\n * Load iframe content when first selected.\r\n * @overloads {DeckBinding#select}\r\n */\r\nStageDeckBinding.prototype.select = function () {\r\n\r\n\tif (!this._isStageDeckBindingInitialized) {\r\n\t\tthis.initialize();\r\n\t} else {\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.STAGEDECK_CHANGED, this.handle);\r\n\t}\r\n\tStageDeckBinding.superclass.select.call(this);\r\n\r\n\tif (this._isRefreshRequired == true) {\r\n\t\tthis._refreshTree();\r\n\t\tthis._isRefreshRequired = false;\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Get that DockBinding.\r\n * @param {string} reference\r\n * @return {DockBinding}\r\n */\r\nStageDeckBinding.prototype.getDockBindingByReference = function ( reference ) {\r\n\r\n\treturn this._dockBindings.get ( reference );\r\n}\r\n\r\nStageDeckBinding.prototype.isPlaceholder = function () {\r\n\treturn this.path != null;\r\n}\r\n\r\n/**\r\n * Load default stagedeck to initialize. Cover is made visible to avoid\r\n * flash of white in Explorer (hidden again by method handleActioEvent}.\r\n */\r\nStageDeckBinding.prototype.initialize = function () {\r\n\r\n\tif (!this._isStageDeckBindingInitialized) {\r\n\t\tthis.path = this.perspectiveNode.getPropertyBag() ? this.perspectiveNode.getPropertyBag().Path : null;\r\n\r\n\t\tthis.isDefaultStageDeck = this.path == undefined;\r\n\r\n\t\ttop.app.bindingMap.stagedeckscover.show();\r\n\r\n\t\tthis.windowBinding = this.add(\r\n\t\t\tWindowBinding.newInstance ( this.bindingDocument )\r\n\t\t);\r\n\t\tvar url = this.isDefaultStageDeck ? (StageDeckBinding.DEFAULT_URL + \"?handle=\" + this.handle) : this.path;\r\n\t\tthis.windowBinding.setURL ( url );\r\n\t\tthis.windowBinding.attach ();\r\n\t\tthis._isStageDeckBindingInitialized = true;\r\n\t\tif (!this.isDefaultStageDeck) {\r\n\t\t\ttop.app.bindingMap.stagedeckscover.hide();\r\n\t\t\tthis.dispatchAction(StageDeckBinding.ACTION_LOADED);\r\n\t\t\tthis.dispatchAction(StageBinding.ACTION_DECK_LOADED);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nStageDeckBinding.prototype.getBrowserTab = function () {\r\n\r\n\treturn this._browserTab;\r\n}\r\n\r\nStageDeckBinding.prototype.getBrowserPage = function () {\r\n\r\n\tvar browserTab = this.getBrowserTab();\r\n\tif (browserTab == null) return null;\r\n\tvar associatedView = browserTab.getAssociatedView();\r\n\tif (associatedView == null) return null;\r\n\tvar contentWindow = associatedView.getContentWindow();\r\n\tif (contentWindow == null) return null;\r\n\tif (contentWindow.bindingMap == null) return null;\r\n\treturn contentWindow.bindingMap.browserpage;\r\n}\r\n\r\nStageDeckBinding.prototype.getSystemTree = function () {\r\n\r\n\tvar result = null;\r\n\tvar page = this.getBrowserPage();\r\n\tif (page) {\r\n\t\tresult = page.getSystemTree();\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nStageDeckBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tStageDeckBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tswitch (broadcast) {\r\n\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESHALL:\r\n\t\t\tif (this.isSelected == true) {\r\n\t\t\t\tthis._refreshTree();\r\n\t\t\t} else if (this.perspectiveNode != null) {\r\n\t\t\t\tthis._isRefreshRequired = true;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESHED:\r\n\t\t\tthis.unsubscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED);\r\n\t\t\tthis.select();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Refresh the contained tree.\r\n */\r\nStageDeckBinding.prototype._refreshTree = function () {\r\n\r\n\t/*\r\n\t * The broadcast will be intercepted by SystemPageBinding.\r\n\t */\r\n\tif (this.perspectiveNode && this.perspectiveNode.getEntityToken) {\r\n\t\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESHED);\r\n\t\tEventBroadcaster.broadcast(\r\n\t\t\tBroadcastMessages.SYSTEMTREEBINDING_REFRESH,\r\n\t\t\tthis.perspectiveNode.getEntityToken()\r\n\t\t);\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * StageDeckBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {StageDeckBinding}\r\n */\r\nStageDeckBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:stagedeck\", ownerDocument )\r\n\tvar binding = UserInterface.registerBinding ( element, StageDeckBinding );\r\n\treturn binding;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/decks/StageDeckRootBinding.js",
    "content": "StageDeckRootBinding.prototype = new RootBinding;\r\nStageDeckRootBinding.prototype.constructor = StageDeckRootBinding;\r\nStageDeckRootBinding.superclass = RootBinding.prototype;\r\n\r\n/**\r\n * Default deck layout to be loaded from \"templates\" folder.\r\n * UPDATE: Remote loading has been disabled for now...\r\n */\r\nStageDeckRootBinding.DEFAULT_TEMPLATE = \"defaultstagedeck.xml\";\r\n\r\n/**\r\n * @class\r\n * The content of the deck is generated dynamically. Point being \r\n * that we can easily persist deck layout between sessions. We \r\n * still need to implement this feature, though. DISABLED NOW!\r\n */\r\nfunction StageDeckRootBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageDeckRootBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageDeckRootBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[StageDeckRootBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {RootBinding#onBindingAttach}\r\n *\r\nStageDeckRootBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tStageDeckRootBinding.superclass.onBindingAttach.call ( this );\r\n\tthis._defaultLayout ();\r\n}\r\n\r\n/**\r\n * Setup default layout.\r\n *\r\nStageDeckRootBinding.prototype._defaultLayout = function () {\r\n\t\r\n\tvar markup = Templates.getTemplateElementText ( \r\n\t\tStageDeckRootBinding.DEFAULT_TEMPLATE \r\n\t)\r\n\tthis.subTreeFromString ( markup );\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/decks/StageDecksBinding.js",
    "content": "StageDecksBinding.prototype = new DecksBinding;\r\nStageDecksBinding.prototype.constructor = StageDecksBinding;\r\nStageDecksBinding.superclass = DecksBinding.prototype;\r\nStageDecksBinding.NODENAME_DECK = \"stagedeck\";\r\nStageDecksBinding.ACTION_INITIALIZED = \"stagedecks initialized\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageDecksBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageDecksBinding\" );\r\n\t\r\n\t/**\r\n\t * Associating handles to decks.\r\n\t * @type {HashMap<string><StageDeckBinding>} \r\n\t */\r\n\tthis._decks = {};\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageDecksBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageDecksBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingInitialize}\r\n */\r\nStageDecksBinding.prototype.onBindingInitialize = function () {\r\n\r\n\tStageDecksBinding.superclass.onBindingInitialize.call ( this );\r\n\tthis.dispatchAction ( StageDecksBinding.ACTION_INITIALIZED );\r\n}\r\n\r\n/**\r\n * Mount viewDefinition, building decks.\r\n * @param {SystemViewDefinition} definition\r\n */\r\nStageDecksBinding.prototype.mountDefinition = function ( definition ) {\r\n\r\n\tvar deckBinding = StageDeckBinding.newInstance ( this.bindingDocument );\r\n\tdeckBinding.handle = definition.handle;\r\n\tdeckBinding.perspectiveNode = definition.node;\r\n\tdeckBinding.definition = definition;\r\n\tif (Application.isTestEnvironment) {\r\n\t\tdeckBinding.setProperty(\"data-qa\", \"perspective\" + definition.label);\r\n\t}\r\n\tthis._decks [ deckBinding.handle ] = deckBinding;\r\n\tthis.add ( deckBinding );\r\n\tdeckBinding.attach ();\r\n}\r\n\r\n/**\r\n * @param {string} handle\r\n */\r\nStageDecksBinding.prototype.setSelectionByHandle = function ( handle ) {\r\n\r\n\tvar deckBinding = this._decks [ handle ];\r\n\tStageBinding.perspectiveNode = deckBinding.perspectiveNode;\r\n\tthis.select ( deckBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/dialogs/FitnessCrawler.js",
    "content": "FitnessCrawler.prototype = new Crawler;\r\nFitnessCrawler.prototype.constructor = FitnessCrawler;\r\nFitnessCrawler.superclass = Crawler.prototype;\r\n\r\nFitnessCrawler.ID = \"fitnesscrawler\";\r\nFitnessCrawler.MODE_BRUTAL = \"brutal fitness\";\r\nFitnessCrawler.MODE_TRAINING = \"train fitness\";\r\n\r\n/**\r\n * This crawler handles focus and blur.\r\n * @class\r\n */\r\nfunction FitnessCrawler () {\r\n\t \r\n\tthis.id = FitnessCrawler.ID;\r\n\tthis.mode = FitnessCrawler.MODE_TRAINING; \r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * @overloads {Crawler#_construct} \r\n */\r\nFitnessCrawler.prototype._construct = function () {\r\n\t\r\n\tFitnessCrawler.superclass._construct.call ( this );\r\n\t\r\n\tthis.addFilter ( function ( element, list ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\r\n\t\tif ( !binding.isVisible ) {\r\n\t\t\tresult = NodeCrawler.SKIP_NODE + NodeCrawler.SKIP_CHILDREN; \r\n\t\t}\r\n\t\t\r\n\t\treturn result;\r\n\t});\r\n\t\r\n\t/*\r\n\t * Collecting unfit members.\r\n\t */\r\n\tthis.addFilter ( function ( element, list ) {\r\n\t\t\r\n\t\tvar result = null;\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\r\n\t\tif ( binding.isAttached ) {\r\n\t\t\tif ( Interfaces.isImplemented ( IFit, binding )) {\r\n\t\t\t\tif ( !binding.isFit || this.mode == FitnessCrawler.MODE_BRUTAL ) {\r\n\t\t\t\t\tlist.add ( binding );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/dialogs/StageDialogBinding.js",
    "content": "StageDialogBinding.prototype = new DialogBinding;\r\nStageDialogBinding.prototype.constructor = StageDialogBinding;\r\nStageDialogBinding.superclass = DialogBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * The StageDialogBinding builds a bridge between dialogs and pages.\r\n * TODO: Consider why and how some of this stuff can be moved to regular dialogs.\r\n */\r\nfunction StageDialogBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageDialogBinding\" );\r\n\r\n\t/**\r\n\t * @type {ViewBinding}\r\n\t */\r\n\tthis._viewBinding = null;\r\n\r\n\t/**\r\n\t * @type {ContextContainer}\r\n\t */\r\n\tthis._contextContainer = null;\r\n\r\n\t/**\r\n\t * @type {DialogPageBinding}\r\n\t */\r\n\tthis._pageBinding = null;\r\n\r\n\t/**\r\n\t * @type {IDialogResponseHandler}\r\n\t */\r\n\tthis._dialogResponseHandler = null;\r\n\r\n\t/**\r\n\t * First loaded PageBinding may set a width and height.\r\n\t * Subsequent PageBindings may only increase the height.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isFirstPage = true;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageDialogBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageDialogBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {DialogBinding#onBindingRegister}\r\n */\r\nStageDialogBinding.prototype.onBindingRegister = function () {\r\n\r\n\tStageDialogBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\tthis.addActionListener ( PageBinding.ACTION_INITIALIZED );\r\n\tthis.addActionListener ( PageBinding.ACTION_DETACHED );\r\n\tthis.addActionListener ( DialogPageBinding.ACTION_RESPONSE );\r\n\tthis.addActionListener ( Binding.ACTION_INVALID );\r\n\tthis.addActionListener ( Binding.ACTION_VALID );\r\n\tthis.addActionListener ( ViewBinding.ACTION_LOADED );\r\n\tthis.addActionListener ( ViewBinding.ACTION_ONCLOSE );\r\n\tthis.addActionListener ( ViewBinding.ACTION_CLOSED );\r\n\tthis.addActionListener ( ErrorBinding.ACTION_INITIALIZE );\r\n\tthis.addActionListener ( PageBinding.ACTION_UPDATING );\r\n\tthis.addActionListener ( PageBinding.ACTION_UPDATED );\r\n\tthis.addActionListener ( DialogBinding.ACTION_CLOSE );\r\n\r\n\tthis.subscribe ( BroadcastMessages.KEY_ESCAPE );\r\n}\r\n\r\n/**\r\n * By default, show only the close control.\r\n * @overloads {DialogBinding#onBindingAttach}\r\n */\r\nStageDialogBinding.prototype.onBindingAttach = function () {\r\n\r\n\tStageDialogBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.defaultSetup ();\r\n}\r\n\r\n/**\r\n * Prepare new ViewBinding.\r\n * @param {DialogViewDefinition} definition\r\n */\r\nStageDialogBinding.prototype.prepareNewView = function ( definition ) {\r\n\r\n\tif ( definition instanceof DialogViewDefinition ) {\r\n\r\n\t\tvar viewBinding = ViewBinding.newInstance ( this.bindingDocument );\r\n\t\tviewBinding.setDefinition ( definition );\r\n\t\tviewBinding.setType ( ViewBinding.TYPE_DIALOGVIEW );\r\n\r\n\t\t// TODO: move to method\r\n\t\tif ( definition.handler ) {\r\n\t\t\tif ( Interfaces.isImplemented ( IDialogResponseHandler, definition.handler )) {\r\n\t\t\t\tthis._dialogResponseHandler = definition.handler;\r\n\t\t\t} else {\r\n\t\t\t\tthrow \"IDialogResponseHandler not implemented\";\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\tFLOATING DOCKS!\r\n\t\tvar setBinding = UserInterface.getBinding ( this.bindingElement.parentNode );\r\n\t\tviewBinding.snapToBinding ( this._body );\r\n\t\tsetBinding.add ( viewBinding );\r\n\t\t*/\r\n\r\n\t\tthis._viewBinding = viewBinding;\r\n\t\tthis._body.add ( viewBinding );\r\n\t\tviewBinding.attach ();\r\n\t\tviewBinding.initialize ();\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {DialogBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nStageDialogBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tStageDialogBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\tcase PageBinding.ACTION_INITIALIZED :\r\n\t\t\tthis._handleInitializedPageBinding ( binding );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_DETACHED :\r\n\t\t\tif ( binding.bindingDocument == this._viewBinding.getContentDocument ()) {\r\n\t\t\t\tthis._pageBinding = null;\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase DialogPageBinding.ACTION_RESPONSE :\r\n\t\t\tif ( binding.response ) {\r\n\t\t\t\tthis._handleDialogPageResponse ( binding );\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase Binding.ACTION_INVALID :\r\n\t\t\tthis._disableDialogAcceptButton ( true );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase Binding.ACTION_VALID :\r\n\t\t\tthis._disableDialogAcceptButton ( false );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase ViewBinding.ACTION_ONCLOSE :\r\n\t\t\tthis.close ();\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase ViewBinding.ACTION_CLOSED :\r\n\t\t\tthis._isFirstPage = true;\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase ErrorBinding.ACTION_INITIALIZE :\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_UPDATING :\r\n\t\t\tthis._isUpdating = true;\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_UPDATED :\r\n\t\t\tif ( this._isUpdating ) {\r\n\t\t\t\tthis._isUpdating = false;\r\n\t\t\t\tthis._fit ();\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * TODO: Are we adding this listener in the first place?\r\n\t\t */\r\n\t\tcase Binding.ACTION_UPDATED :\r\n\t\t\tif ( !this._isUpdating ) {\r\n\t\t\t\tthis._fit ();\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase DialogBinding.ACTION_CLOSE :\r\n\t\t\tif ( binding == this ) {\r\n\t\t\t\tthis._viewBinding.dispose ();\r\n\t\t\t\tthis.defaultSetup ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nStageDialogBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tStageDialogBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\r\n\t\tcase BroadcastMessages.KEY_ESCAPE :\r\n\t\t\tif ( this.isVisible == true ) { // RENAME ISOPEN!\r\n\t\t\t\tif ( !PopupBinding.hasActiveInstances ()) {\r\n\t\t\t\t\tthis._defaultClose ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Release the FitnessCrawler. Fit all members.\r\n * @param {boolean} isForce\r\n */\r\nStageDialogBinding.prototype._fit = function ( isForce ) {\r\n\r\n\tvar crawler = new FitnessCrawler ();\r\n\tvar list = new List ();\r\n\tif ( isForce ) {\r\n\t\tcrawler.mode = FitnessCrawler.MODE_BRUTAL;\r\n\t}\r\n\tcrawler.crawl ( this.bindingElement, list );\r\n\tcrawler.dispose ();\r\n\r\n\tif ( list.hasEntries ()) {\r\n\t\t/*\r\n\t\t * Fit all fitness members, starting from the innermost\r\n\t\t * location in the subtree. Then dispose the member list.\r\n\t\t */\r\n\t\tlist.reverse ();\r\n\t\tlist.each ( function ( binding ) {\r\n\t\t\tbinding.fit ( isForce );\r\n\t\t});\r\n\t\tlist.dispose ();\r\n\t\tthis._fitMe ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Keeping myself fit.\r\n * @param {List<IFit>}\r\n */\r\nStageDialogBinding.prototype._fitMe = function () {\r\n\r\n\tif ( this._pageBinding != null ) {\r\n\r\n\t\tthis._pageBinding.enableAutoHeightLayoutMode ( true );\r\n\t\tthis._fixAutoHeight ( this._pageBinding );\r\n\t\tthis._pageBinding.enableAutoHeightLayoutMode ( false );\r\n\r\n\t\tvar height = this.getDimension ().h;\r\n\t\tthis.reflex ( true );\r\n\r\n\t\t// Still the same height? Explorer can mess it up here.\r\n\t\tvar self = this;\r\n\t\tif ( this.getDimension ().h == height ) {\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tself.reflex ( true );\r\n\t\t\t}, 0 );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {MenuItemBinding} menuItemBinding\r\n */\r\nStageDialogBinding.prototype._handleContextMenuItemBinding = function ( menuItemBinding ) {\r\n\r\n\tvar cmd = menuItemBinding.getProperty ( \"cmd\" );\r\n\r\n\tswitch ( cmd ) {\r\n\t\tcase DialogTitleBarPopupBinding.CMD_CLOSE :\r\n\t\t\tthis._defaultClose ();\r\n\t\t\tbreak;\r\n\t\tcase DialogTitleBarPopupBinding.CMD_REFRESH :\r\n\t\t\tthis._titlebar.setLabel ( DockTabBinding.LABEL_TABLOADING );\r\n\t\t\tthis._titlebar.setImage ( DockTabBinding.IMG_TABLOADING );\r\n\t\t\tthis._pageBinding = null;\r\n\t\t\tthis._viewBinding.reload ( Application.isDeveloperMode );\r\n\t\t\tbreak;\r\n\t\tcase DialogTitleBarPopupBinding.CMD_VIEWSOURCE :\r\n\t\tcase DialogTitleBarPopupBinding.CMD_VIEWGENERATED :\r\n\t\tcase DialogTitleBarPopupBinding.CMD_VIEWSERIALIZED :\r\n\t\t\tthis._viewSource ( cmd );\r\n\t\t\tbreak;\r\n\t\tdefault :\r\n\t\t\talert ( \"TODO!\" );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * View source.\r\n * @param {string} cmd\r\n */\r\nStageDialogBinding.prototype._viewSource = DockTabBinding.prototype._viewSource;\r\n\r\n/**\r\n * @param {PageBinding} pageBinding\r\n */\r\nStageDialogBinding.prototype._handleInitializedPageBinding = function ( pageBinding ) {\r\n\r\n\tif ( pageBinding.bindingDocument == this._viewBinding.getContentDocument ()) {\r\n\r\n\t\tif ( pageBinding instanceof DialogPageBinding ) {\r\n\t\t\tif ( this._pageBinding == null ) { // grab image and label only from first page!\r\n\t\t\t\tthis._parsePageBinding ( pageBinding );\r\n\t\t\t}\r\n\t\t\tthis._pageBinding = pageBinding;\r\n\t\t\tif ( pageBinding.height == \"auto\" ) {\r\n\t\t\t\tpageBinding.enableAutoHeightLayoutMode ( true );\r\n\t\t\t\tthis._fixAutoHeight ( pageBinding );\r\n\t\t\t\tpageBinding.enableAutoHeightLayoutMode ( false );\r\n\t\t\t\tthis.reflex ( true );\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( StatusBar.state == StatusBar.BUSY ) {\r\n\t\t\tStatusBar.clear ();\r\n\t\t}\r\n\t\tif ( this._isFirstPage ) {\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.VIEW_COMPLETED, this._viewBinding.getHandle ());\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.STAGEDIALOG_OPENED );\r\n\t\t}\r\n\r\n\t} else if ( pageBinding.isDialogSubPage ) {\r\n\r\n\t\tthis._pageBinding.enableAutoHeightLayoutMode ( true );\r\n\t\tthis._fixAutoHeight ( pageBinding );\r\n\t\tthis._pageBinding.enableAutoHeightLayoutMode ( false );\r\n\r\n\t\tthis._fit ( true );\r\n\t\tthis.reflex ( true );\r\n\t}\r\n\r\n\t/*\r\n\t * Flip this flag!\r\n\t */\r\n\tthis._isFirstPage = false;\r\n}\r\n\r\n/**\r\n * TODO: store a local isValid variable and re-do this on wizard page load!\r\n * @param {boolean} isDisabled\r\n */\r\nStageDialogBinding.prototype._disableDialogAcceptButton = function ( isDisabled ) {\r\n\r\n\tvar buttonElement = this._viewBinding.getContentDocument ().getElementById ( \"dialogacceptbutton\" );\r\n\tif ( buttonElement ) {\r\n\t\tvar buttonBinding = UserInterface.getBinding ( buttonElement );\r\n\t\tbuttonBinding.setDisabled ( isDisabled );\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle DialogPage response.\r\n * @param {DialogPageBinding} binding\r\n */\r\nStageDialogBinding.prototype._handleDialogPageResponse = function (binding) {\r\n\r\n\t// TODO: rig this up so that we close the dialog before handling the response!\r\n\tif (this._dialogResponseHandler != null) {\r\n\t\tthis._dialogResponseHandler.handleDialogResponse(\r\n\t\t\tbinding.response, binding.result != null ? binding.result : null\r\n\t\t);\r\n\t}\r\n\r\n\tvar self = this;\r\n\tsetTimeout(function () {\r\n\t\tself.close();\r\n\t}, 0);\r\n}\r\n\r\n/**\r\n * Make sure that the close button fires a returnvalue of \"cancel\".\r\n * @overloads {DialogBinding#handleInvokedControl}\r\n * @param {ControlBinding} control\r\n */\r\nStageDialogBinding.prototype.handleInvokedControl = function ( control ) {\r\n\r\n\tif ( control.controlType == ControlBinding.TYPE_CLOSE ) {\r\n\t\tthis._defaultClose ();\r\n\t}\r\n\r\n\tStageDialogBinding.superclass.handleInvokedControl.call ( this, control );\r\n}\r\n\r\n/**\r\n * Assinging contextmenu to titlebar.\r\n * @overloads {DialogBinding#buildDescendantBindings}\r\n */\r\nStageDialogBinding.prototype.buildDescendantBindings = function () {\r\n\r\n\tStageDialogBinding.superclass.buildDescendantBindings.call ( this );\r\n\tthis._titlebar.setContextMenu ( app.bindingMap.dialogtitlebarpopup );\r\n\r\n\t/*\r\n\t * Note that this overwrites!\r\n\t */\r\n\tvar self = this;\r\n\tthis._titlebar.handleAction = function ( action ) {\r\n\t\tswitch ( action.type ) {\r\n\t\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\t\t\t\tif ( action.listener == this.contextMenuBinding ) {\r\n\t\t\t \t\tself._handleContextMenuItemBinding ( action.target );\r\n\t\t\t \t}\r\n\t\t\t \tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Parse contained DialogPageBinding.\r\n * @param {DialogPageBinding} pageBinding\r\n */\r\nStageDialogBinding.prototype._parsePageBinding = function ( pageBinding ) {\r\n\r\n\tvar label\t\t= pageBinding.label;\r\n\tvar image \t\t= pageBinding.image;\r\n\tvar width \t\t= pageBinding.width;\r\n\tvar height\t\t= pageBinding.height;\r\n\tvar controls \t= pageBinding.controls;\r\n\tvar isResizable = pageBinding.isResizable;\r\n\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\tif ( image ) {\r\n\t\tthis.setImage ( image );\r\n\t}\r\n\tif ( width || height ) {\r\n\r\n\t\tvar old = this.getDimension ();\r\n\t\tvar nev = new Dimension ();\r\n\r\n\t\tif ( this._isFirstPage ) { // only set width on first page!\r\n\t\t\tnev.w = width ? width : old.w;\r\n\t\t} else {\r\n\t\t\tnev.w = old.w;\r\n\t\t}\r\n\t\tnev.h = ( height != null && height != \"auto\" ) ? height : old.h; // never set height on autoheight dialogs!\r\n\r\n\t\tif (this._isResizable) {\r\n\t\t\tnev.h = (top.window.innerHeight < nev.h) ? top.window.innerHeight : nev.h;\r\n\t\t\tnev.w = ( top.window.innerWidth < nev.w) ? top.window.innerWidth : nev.w;\r\n\t\t}\r\n\r\n\t\tthis.setDimension ( nev );\r\n\t}\r\n\tif ( controls ) {\r\n\t\tthis.controlBindings [ ControlBinding.TYPE_MAXIMIZE ].hide ();\r\n\t\tthis.controlBindings [ ControlBinding.TYPE_MINIMIZE ].hide ();\r\n\t\tthis.controlBindings [ ControlBinding.TYPE_CLOSE ].hide ();\r\n\t\tvar type, types = new List ( controls.split ( \" \" ));\r\n\t\twhile (( type = types.getNext ()) != null ) {\r\n\t\t\tthis.controlBindings [ type ].show ();\r\n\t\t}\r\n\t}\r\n\r\n\tif ( isResizable != this._isResizable ) {\r\n\t\tthis.setResizable ( isResizable );\r\n\t}\r\n\tif ( height == \"auto\" ) {\r\n\t\tthis._fixAutoHeight ( pageBinding );\r\n\t}\r\n\tif ( pageBinding == this._pageBinding ) { // only on dialog open!\r\n\t\tthis.centerOnScreen ();\r\n\t}\r\n\tif ( !this.isOpen ) {\r\n\t\tthis.reflex ( true );\r\n\t\tthis.open ( true );\r\n\t}\r\n}\r\n\r\n/**\r\n * Fix auto height.\r\n * @param {PageBinding} pageBinding\r\n */\r\nStageDialogBinding.prototype._fixAutoHeight = function ( pageBinding ) {\r\n\r\n\tvar dim = this.getDimension ();\r\n\tvar width = 0;\r\n\tvar height = 0;\r\n\r\n\tif ( pageBinding.isDialogSubPage ) {\r\n\t\tpageBinding = this._pageBinding;\r\n\t}\r\n\tif ( this._isFirstPage ) {\r\n\t\twidth = pageBinding.width != null ? pageBinding.width : dim.w;\r\n\t} else {\r\n\t\twidth = dim.w;\r\n\t}\r\n\theight = pageBinding.bindingElement.offsetHeight;\r\n\theight += this._titlebar.bindingElement.offsetHeight;\r\n\r\n\tvar padding = CSSComputer.getPadding(this.bindingElement);\r\n\tvar border = CSSComputer.getBorder(this.bindingElement);\r\n\theight += padding.top + padding.bottom;\r\n\theight += border.top + border.bottom;\r\n\r\n\r\n\r\n\t//if ( height < dim.h ) { // never shrink the dialog - only expand it.\r\n\t//\theight = dim.h;\r\n\t//}\r\n\tif ( pageBinding.minheight != null ) { // consider minheight!\r\n\t\tif ( height < pageBinding.minheight ) {\r\n\t\t\theight = pageBinding.minheight;\r\n\t\t}\r\n\t}\r\n\r\n\t//don't set height more than client height;\r\n\theight = (top.window.innerHeight < height) ? top.window.innerHeight : height;\r\n\r\n\tthis.setDimension(new Dimension(width, height));\r\n\r\n\t//fit position with new height\r\n\tthis.startPoint = this.getPosition();\r\n\tthis._setComputedPosition(\r\n\t\t\tnew Point(0, 0)\r\n\t);\r\n}\r\n\r\n/**\r\n * Default close. This will return a \"cancel\" to any response handler.\r\n * TODO: rig this up so that we close the dialog before handling the response!\r\n */\r\nStageDialogBinding.prototype._defaultClose = function () {\r\n\r\n\tif ( this._dialogResponseHandler != null ) {\r\n\t\tthis._dialogResponseHandler.handleDialogResponse (\r\n\t\t\tDialog.RESPONSE_CANCEL\r\n\t\t);\r\n\t}\r\n\tthis.close ();\r\n}\r\n\r\n/**\r\n * Focucs content when opened.\r\n */\r\nStageDialogBinding.prototype.open = function () {\r\n\r\n\tStageDialogBinding.superclass.open.call ( this );\r\n\tif ( this.isVisible == true ) {\r\n\t\tthis._viewBinding.onActivate ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Revert to default setup on dialog exit.\r\n * @overloads {DialogBinding#close}\r\n *\r\nStageDialogBinding.prototype.close = function () {\r\n\r\n\tStageDialogBinding.superclass.close.call ( this );\r\n\r\n\tif ( !Client.hasTransitions ) {\r\n\t\tthis._viewBinding.dispose ();\r\n\t\tthis.defaultSetup ();\r\n\t} else {\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () { // wait for CSS transition fadeout\r\n\t\t\tself._viewBinding.dispose ();\r\n\t\t\tself.defaultSetup ();\r\n\t\t}, Animation.DEFAULT_TIME );\r\n\t}\r\n}\r\n*/\r\n\r\n/**\r\n * Invoke default setup on dialog close.\r\n */\r\nStageDialogBinding.prototype.defaultSetup = function () {\r\n\r\n\tthis.setImage ( LabelBinding.DEFAULT_IMAGE );\r\n\tthis.setLabel ( \"\" );\r\n\tthis.setDimension ( new Dimension ( DialogBinding.DEFAULT_WIDTH, DialogBinding.DEFAULT_HEIGHT ));\r\n\r\n\tthis.controlBindings [ ControlBinding.TYPE_MAXIMIZE ].hide ();\r\n\tthis.controlBindings [ ControlBinding.TYPE_MINIMIZE ].hide ();\r\n\tthis.controlBindings [ ControlBinding.TYPE_CLOSE ].show ();\r\n\r\n\tthis._pageBinding = null;\r\n\tthis._dialogResponseHandler = null;\r\n\r\n\tif ( !this._isResizable ) {\r\n\t\tthis.setResizable ( true );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set position.\r\n * @param {Point} p\r\n */\r\nStageDialogBinding.prototype.setPosition = function ( p ) {\r\n\r\n\tStageDialogBinding.superclass.setPosition.call ( this, p );\r\n\tthis._body.dispatchAction (\r\n\t\tBinding.ACTION_POSITIONCHANGED\r\n\t);\r\n}\r\n\r\n\r\n/**\r\n * Set dimension.\r\n * @param {Dimension} dim\r\n */\r\nStageDialogBinding.prototype.setDimension = function ( dim ) {\r\n\r\n\tStageDialogBinding.superclass.setDimension.call ( this, dim );\r\n\tthis._body.dispatchAction (\r\n\t\tBinding.ACTION_DIMENSIONCHANGED\r\n\t);\r\n}\r\n\r\n/**\r\n * Activate.\r\n * @implements {IActivatable}\r\n * @overloads {DialogBinding#activate}\r\n */\r\nStageDialogBinding.prototype.activate = function () {\r\n\r\n\tif ( !this.isActive ) {\r\n\t\tStageDialogBinding.superclass.activate.call ( this );\r\n\t\tthis._viewBinding.onActivate ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Deactivate.\r\n * @implements {IActivatable}\r\n * @overloads {DialogBinding#activate}\r\n */\r\nStageDialogBinding.prototype.deActivate = function () {\r\n\r\n\tif ( this.isActive == true ) {\r\n\t\tStageDialogBinding.superclass.deActivate.call ( this );\r\n\t\tthis._viewBinding.onDeactivate ();\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IContextContainerBinding}\r\n */\r\nStageDialogBinding.prototype.getContextContainer = function () {\r\n\r\n\treturn this._contextContainer;\r\n}\r\n\r\n/**\r\n * @implements {IContextContainerBinding}\r\n */\r\nStageDialogBinding.prototype.setContextContainer = function (contextContainer) {\r\n\r\n\tthis._contextContainer = contextContainer;\r\n}\r\n\r\n\r\n/**\r\n * StageDialogBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {StageDialogBinding}\r\n */\r\nStageDialogBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:dialog\", ownerDocument );\r\n\tvar binding = UserInterface.registerBinding ( element, StageDialogBinding );\r\n\tbinding.setProperty ( \"controls\", \"minimize maximize close\" );\r\n\treturn binding;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/dialogs/StageDialogSetBinding.js",
    "content": "StageDialogSetBinding.prototype = new DialogSetBinding;\r\nStageDialogSetBinding.prototype.constructor = StageDialogSetBinding;\r\nStageDialogSetBinding.superclass = DialogSetBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageDialogSetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageDialogSetBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {List<StageDialogBinding>}\r\n\t */\r\n\tthis._dialogs = new List ();\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageDialogSetBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[StageDialogSetBinding]\";\r\n}\r\n\r\n/**\r\n * Get non-modal dialog.\r\n * @return {StageDialogBinding}\r\n */\r\nStageDialogSetBinding.prototype.getInstance = function () {\r\n\t\r\n\tvar dialog = null;\r\n\t\r\n\tthis._dialogs.each ( function ( member ) {\r\n\t\tif ( !member.isVisible ) {\r\n\t\t\tdialog = member;\r\n\t\t}\r\n\t\treturn dialog != null;\r\n\t});\r\n\tif ( !dialog ) {\r\n\t\tthis._newInstance ();\r\n\t\tdialog = this._dialogs.getLast ();\r\n\t}\r\n\tdialog.setModal ( false );\r\n\treturn dialog;\r\n}\r\n\r\n/**\r\n * Get modal dialog.\r\n * @return {StageDialogBinding}\r\n */\r\nStageDialogSetBinding.prototype.getModalInstance = function () {\r\n\t\r\n\tvar dialog = this.getInstance ();\r\n\tdialog.setModal ( true );\r\n\treturn dialog;\r\n}\r\n\r\n/**\r\n * Construct new dialog (but don't return it!).\r\n */\r\nStageDialogSetBinding.prototype._newInstance = function () {\r\n\r\n\tvar dialog = this.add ( \r\n\t\tStageDialogBinding.newInstance ( \r\n\t\t\tthis.bindingDocument \r\n\t\t)\r\n\t);\r\n\tthis._dialogs.add ( dialog );\r\n\tdialog.attach ();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/menus/StageMenuBarBinding.js",
    "content": "StageMenuBarBinding.prototype = new MenuBarBinding;\r\nStageMenuBarBinding.prototype.constructor = StageMenuBarBinding;\r\nStageMenuBarBinding.superclass = MenuBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageMenuBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageMenuBarBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis._rootNode = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageMenuBarBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[StageMenuBarBinding]\";\r\n}\r\n\r\n/**\r\n * Intercept for system-hooked menuitem commands.\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nStageMenuBarBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tStageMenuBarBinding.superclass.onBindingAttach.call ( this );\r\n\tif ( System.hasActivePerspectives ) {\r\n\t\tthis.addActionListener ( MenuItemBinding.ACTION_COMMAND );\r\n\t} else {\r\n\t\tvar self = this;\r\n\t\tsetTimeout(function () {\r\n\t\t\tvar menus = self.getChildBindingsByLocalName(\"menu\");\r\n\t\t\twhile (menus.hasNext()) {\r\n\t\t\t\tvar menu = menus.getNext();\r\n\t\t\t\tif (menu.bindingElement.id != \"usermenu\") {\r\n\t\t\t\t\tBinding.prototype.hide.call(menu); // this.hide () burned by MenuContainerBinding#hide\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, 0);\r\n\t}\r\n}\r\n\r\n/** \r\n * Invoke system actions. These are hardwired to act on the root SystemNode.\r\n * @implements {IActionListener}\r\n * @overloads {MenuBarBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nStageMenuBarBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tStageMenuBarBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase MenuItemBinding.ACTION_COMMAND :\r\n\t\t\tvar systemAction = action.target.associatedSystemAction;\r\n\t\t\tif ( Application.isLoggedIn ) { // otherwise this will trigger when \"Exit\" is pressed.\r\n\t\t\t\tif ( !this._rootNode ) {\r\n\t\t\t\t\tthis._rootNode = System.getRootNode ();\r\n\t\t\t\t}\r\n\t\t\t\tif ( systemAction ) {\r\n\t\t\t\t\tSystemAction.invoke ( systemAction, this._rootNode );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/menus/StageViewMenuItemBinding.js",
    "content": "StageViewMenuItemBinding.prototype = new MenuItemBinding;\r\nStageViewMenuItemBinding.prototype.constructor = StageViewMenuItemBinding;\r\nStageViewMenuItemBinding.superclass = MenuItemBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageViewMenuItemBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageViewMenuItemBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._handle = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageViewMenuItemBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageViewMenuItemBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {MenuItemBinding.#onBindingAttach}\r\n */\r\nStageViewMenuItemBinding.prototype.onBindingAttach = function () {\r\n\r\n\tStageViewMenuItemBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tif ( this.type == MenuItemBinding.TYPE_CHECKBOX ) {\r\n\t\tthis.subscribe ( BroadcastMessages.VIEW_OPENED );\r\n\t\tthis.subscribe ( BroadcastMessages.VIEW_CLOSED );\r\n\t\tthis.subscribe ( BroadcastMessages.STAGE_INITIALIZED );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {MenuItemBinding#buildDOMContent}\r\n */\r\nStageViewMenuItemBinding.prototype.buildDOMContent = function () {\r\n \t\r\n\tStageViewMenuItemBinding.superclass.buildDOMContent.call ( this );\r\n\t\r\n\tvar handle = this.getProperty ( \"handle\" );\r\n\tif ( handle ) {\r\n\t\t\r\n\t\tthis._handle = handle;\r\n\t\t\r\n\t\tif ( StageBinding.isViewOpen ( handle )) {\r\n\t\t\tif ( this.type == MenuItemBinding.TYPE_CHECKBOX ) {\r\n\t\t\t\tthis.check ( true );\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.oncommand = function () {\r\n\t\t\tvar self = this;\r\n\t\t\tApplication.lock ( self );\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tStageBinding.handleViewPresentation ( handle );\r\n\t\t\t\tApplication.unlock ( self );\r\n\t\t\t}, Client.hasTransitions ? Animation.DEFAULT_TIME : 0 );\r\n\t\t}\r\n\t\t\r\n\t} else {\r\n\t\tthrow new Error ( \"StageViewMenuItemBinding: missing handle\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set handle.\r\n * @param {string} handle\r\n */\r\nStageViewMenuItemBinding.prototype.setHandle = function ( handle ) {\r\n\t\r\n\tthis.setProperty ( \"handle\", handle );\r\n}\r\n\r\n/*\r\n * @implements {IBroadcastListener}\r\n * @param {string} message\r\n * @param {object} arg\r\n */\r\nStageViewMenuItemBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tStageViewMenuItemBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tif ( this.type == MenuItemBinding.TYPE_CHECKBOX ) {\r\n\t\tswitch ( broadcast ) {\r\n\t\t\tcase BroadcastMessages.STAGE_INITIALIZED :\r\n\t\t\t\tif ( this.isChecked ) {\r\n\t\t\t\t\tthis.fireCommand ();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase BroadcastMessages.VIEW_OPENED :\r\n\t\t\t\tif ( arg == this._handle ){\r\n\t\t\t\t\tthis.check ( true );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase BroadcastMessages.VIEW_CLOSED :\r\n\t\t\t\tif ( arg == this._handle ){\r\n\t\t\t\t\tthis.uncheck ( true );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * StageViewMenuItemBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {StageViewMenuItemBinding}\r\n */\r\nStageViewMenuItemBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:menuitem\", ownerDocument );\r\n\tUserInterface.registerBinding ( element, StageViewMenuItemBinding );\r\n\treturn UserInterface.getBinding ( element );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/splitboxes/StageSplitBoxBinding.js",
    "content": "StageSplitBoxBinding.prototype = new SplitBoxBinding;\r\nStageSplitBoxBinding.prototype.constructor = StageSplitBoxBinding;\r\nStageSplitBoxBinding.superclass = SplitBoxBinding.prototype;\r\n\r\nStageSplitBoxBinding.ACTION_HIDE = \"stagesplitboxbinding hide\";\r\nStageSplitBoxBinding.ACTION_SHOW = \"stagesplitboxbinding show\";\r\nStageSplitBoxBinding.ACTION_DOCK_EMPTIED = \"stagesplitbox says dock emptied\";\r\nStageSplitBoxBinding.ACTION_DOCK_OPENED = \"stagesplitbox says dock opened\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageSplitBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageSplitBoxBinding\" );\r\n\t\r\n\t/**\r\n\t * Flipped when a descendant panel gets maximized. This acts as preparation \r\n\t * for the actual maximization, which is handled by the StageCrawler.\r\n\t * @see {StageDeckBinding#handleControlBoxAction}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMaximizePrepared = false;\r\n\t\r\n\t/**\r\n\t * Flipped when the StageCrawler calls the handleMaximization method.\r\n\t * @see {StageDeckBinding#handleControlBoxAction}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMaximizedForReal = null;\r\n\t\r\n\t/**\r\n\t * Flipped when minimized.\r\n\t * @see {StageDeckBinding#handleControlBoxAction}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMinimizedForReal = null;\r\n\t\r\n\t/**\r\n\t * Indicates that style.visibility is set to hidden.\r\n\t * @type {boolean}\r\n\t *\r\n\tthis._isInvisibilized = false;\r\n\t*/\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageSplitBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageSplitBoxBinding]\";\r\n}\r\n\r\n/**\r\n * @see {StageBoxAbstraction#onBindingRegister}\r\n */\r\nStageSplitBoxBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tStageSplitBoxBinding.superclass.onBindingRegister.call ( this );\r\n\tStageBoxAbstraction.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( DockBinding.ACTION_EMPTIED, this );\r\n\tthis.addActionListener ( DockBinding.ACTION_OPENED, this );\r\n\tthis.addActionListener ( StageSplitBoxBinding.ACTION_SHOW, this );\r\n\tthis.addActionListener ( StageSplitBoxBinding.ACTION_HIDE, this );\r\n}\r\n\r\n/**\r\n * @see {StageBoxAbstraction#handleAction}\r\n * @implements {IActionListener}\r\n * @overloads {SplitBoxBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nStageSplitBoxBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tStageSplitBoxBinding.superclass.handleAction.call ( this, action );\r\n\tStageBoxAbstraction.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\tvar docks = null;\r\n\tvar splitter = null;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\r\n\t\t/*\r\n\t\t * DockBinding emptied\r\n\t\t */\r\n\t\tcase DockBinding.ACTION_EMPTIED :\r\n\t\t\t\r\n\t\t\tsplitter = this.getChildBindingByLocalName ( \"splitter\" );\r\n\t\t\tif ( splitter.isVisible ) {\r\n\t\t\t\tsplitter.hide ();\r\n\t\t\t}\r\n\t\t\tdocks = this.getDescendantBindingsByLocalName ( \"dock\" );\r\n\t\t\tif ( docks.getFirst ().isEmpty && docks.getLast ().isEmpty ) {\r\n\t\t\t\tif ( docks.getFirst ().type != DockBinding.TYPE_EDITORS ) { /* ADDED */\r\n\t\t\t\t\tthis.dispatchAction ( StageSplitBoxBinding.ACTION_HIDE );\r\n\t\t\t\t\tthis.hide ();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis.flex ();\r\n\t\t\t\tthis.invokeLayout ();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * We must consume this event, but the stagedeck needs to know.\r\n\t\t\t */\r\n\t\t\tthis.dispatchAction ( StageSplitBoxBinding.ACTION_DOCK_EMPTIED );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\r\n\t\t/*\r\n\t\t * DockBinding opened\r\n\t\t */\t\r\n\t\tcase DockBinding.ACTION_OPENED :\r\n\t\t\r\n\t\t\tdocks = this.getDescendantBindingsByLocalName ( \"dock\" );\r\n\t\t\tif ( !docks.getFirst ().isEmpty && !docks.getLast ().isEmpty ) {\r\n\t\t\t\tsplitter = this.getChildBindingByLocalName ( \"splitter\" );\r\n\t\t\t\tif ( !splitter.isVisible ){\r\n\t\t\t\t\tsplitter.show ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( !this.isVisible ) {\r\n\t\t\t\tthis.show ();\r\n\t\t\t\tthis.dispatchAction ( StageSplitBoxBinding.ACTION_SHOW );\r\n\t\t\t}\r\n\t\t\tthis.flex ();\r\n\t\t\tthis.invokeLayout ();\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * We must consume this action in order to hide it  \r\n\t\t\t * from the next StageSplitBoxBinding, but ancestor   \r\n\t\t\t * bindings need to know that a dock was opened.\r\n\t\t\t * @see {StageDeckBinding}\r\n\t\t\t */\r\n\t\t\tthis.dispatchAction ( StageSplitBoxBinding.ACTION_DOCK_OPENED );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\r\n\t\t/*\r\n\t\t * Sub-splitbox hiding\r\n\t\t */\r\n\t\tcase StageSplitBoxBinding.ACTION_HIDE :\r\n\t\t\r\n\t\t\tif ( binding != this ) {\r\n\t\t\t\tsplitter = this.getChildBindingByLocalName ( \"splitter\" );\r\n\t\t\t\tif ( splitter.isVisible ) {\r\n\t\t\t\t\tsplitter.hide ();\r\n\t\t\t\t}\r\n\t\t\t\tthis.invokeLayout ();\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\t/*\r\n\t\t * Sub-splitbox showing\r\n\t\t */\t\r\n\t\tcase StageSplitBoxBinding.ACTION_SHOW :\r\n\t\t\t\r\n\t\t\tif ( binding != this ) {\r\n\t\t\t\tvar splitPanels = this.getChildBindingsByLocalName ( \"splitpanel\" );\r\n\t\t\t\tif ( splitPanels.getFirst ().isVisible && splitPanels.getLast ().isVisible ) {\r\n\t\t\t\t\tsplitter = this.getChildBindingByLocalName ( \"splitter\" );\r\n\t\t\t\t\tif ( !splitter.isVisible ) {\r\n\t\t\t\t\t\tsplitter.show ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.invokeLayout ();\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle maximization. \n */\r\nStageSplitBoxBinding.prototype.handleMaximization = function () {\r\n\t\r\n\tStageBoxAbstraction.handleMaximization.call ( this );\r\n}\r\n\r\n/**\r\n * Handle unmaximization.\r\n */\r\nStageSplitBoxBinding.prototype.handleUnMaximization = function () {\r\n\t\r\n\tStageBoxAbstraction.handleUnMaximization.call ( this );\r\n}\r\n\r\n/**\r\n * The outcome of the flex method depends heavily on the current state of the splitbox.\r\n * @overwrites {SplitBoxBinding#flex}\r\n * @implements {IFlexible}\r\n */\r\nStageSplitBoxBinding.prototype.flex = function () {\r\n\t\r\n\tif ( this.isMaximizedForReal == null ) {\r\n\t\t\r\n\t\tStageSplitBoxBinding.superclass.flex.call ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle crawler.\r\n * @implements {ICrawlerHandler}\r\n * @param {Crawler} crawler\r\n */\r\nStageSplitBoxBinding.prototype.handleCrawler = function ( crawler ) {\r\n\t\r\n\tStageSplitBoxBinding.superclass.handleCrawler.call ( this, crawler );\r\n\t\r\n\tswitch ( crawler.id ) {\t\r\n\t\tcase FlexBoxCrawler.ID :\r\n\t\t\tif ( this.isMaximizedForReal == false ) { // Huh? Shouldn't this be TRUE?\r\n\t\t\t\tcrawler.response = NodeCrawler.SKIP_CHILDREN;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {boolean}\r\n */\r\nStageSplitBoxBinding.prototype.hasBothPanelsVisible = function () {\r\n\t\r\n\tvar splitPanels = this.getChildBindingsByLocalName ( \"splitpanel\" );\r\n\treturn splitPanels.getFirst ().isVisible && splitPanels.getLast ().isVisible;\r\n}\r\n\r\n/**\r\n * @return {boolean}\r\n */\r\nStageSplitBoxBinding.prototype.hasBothPanelsFixed = function () {\r\n\t\r\n\tvar splitPanels = this.getChildBindingsByLocalName ( \"splitpanel\" );\r\n\treturn splitPanels.getFirst ().isFixed && splitPanels.getLast ().isFixed;\r\n}\r\n\r\n/**\r\n * Make splitbox invisible.\r\n * @param {boolean} isHide\r\n *\r\nStageSplitBoxBinding.prototype.invisibilize = function ( isHide ) {\r\n\t\r\n\tif ( isHide != this._isInvisibilized ) {\r\n\t\tif ( isHide ) {\r\n\t\t\tthis.bindingElement.style.visibility = \"hidden\";\r\n\t\t} else {\r\n\t\t\tthis.bindingElement.style.visibility = \"visible\";\r\n\t\t}\r\n\t\tthis._isInvisibilized = !this._isInvisibilized;\r\n\t}\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/splitboxes/StageSplitPanelBinding.js",
    "content": "StageSplitPanelBinding.prototype = new SplitPanelBinding;\r\nStageSplitPanelBinding.prototype.constructor = StageSplitPanelBinding;\r\nStageSplitPanelBinding.superclass = SplitPanelBinding.prototype;\r\n\r\nStageSplitPanelBinding.ACTION_LAYOUTUPDATE = \"stagesplitpanel layout changed\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageSplitPanelBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageSplitPanelBinding\" );\r\n\t\r\n\t/**\r\n\t * Flipped when the panel gets maximized. This acts as preparation \r\n\t * for the actual maximization, which is handled by the StageCrawler.\r\n\t * @see {StageDeckBinding#handleControlBoxAction}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMaximizePrepared = false;\r\n\t\r\n\t/**\r\n\t * Flipped when the StageCrawler calls the handleMaximization method.\r\n\t * @see {StageDeckBinding#handleControlBoxAction}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMaximizedForReal = null;\r\n\t\r\n\t/**\r\n\t * Flipped when minimized.\r\n\t * @see {StageDeckBinding#handleControlBoxAction}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isMinimizedForReal = null;\r\n\t\r\n\t/**\r\n\t * Indicates that style.visibility is set to hidden.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isInvisibilized = false;\r\n\t\r\n\t/** \r\n\t * Computing \"ghosted\" controls. Modified by DockBinding.\r\n\t * @see {DockBinding#activate} \r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActive = true;\r\n\t \r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFixed = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageSplitPanelBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageSplitPanelBinding]\";\r\n}\r\n\r\n/**\r\n * @see {StageBoxAbstraction#onBindingRegister}\r\n */\r\nStageSplitPanelBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tStageSplitPanelBinding.superclass.onBindingRegister.call ( this );\r\n\tStageBoxAbstraction.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( DockBinding.ACTION_OPENED, this );\r\n\tthis.addActionListener ( DockBinding.ACTION_EMPTIED, this );\r\n\tthis.addActionListener ( StageSplitBoxBinding.ACTION_HIDE, this );\r\n\tthis.addActionListener ( StageSplitBoxBinding.ACTION_SHOW, this );\r\n\tthis.addActionListener ( StageSplitPanelBinding.ACTION_LAYOUTUPDATE, this );\r\n}\r\n\r\n/**\r\n * @see {StageBoxAbstraction#handleAction}\r\n * @implements {IactionListener}\r\n * @overloads {SplitPanelBinding#handleEvent}\r\n * @param {Action} action\r\n */\r\nStageSplitPanelBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tStageSplitPanelBinding.superclass.handleAction.call ( this, action );\r\n\tStageBoxAbstraction.handleAction.call ( this, action );\r\n \t\r\n\t// dont consume these actions, other bindings are listening!\r\n\tswitch ( action.type ) {\r\n\t\t\r\n\t\tcase DockBinding.ACTION_EMPTIED :\r\n\t\tcase StageSplitBoxBinding.ACTION_HIDE :\r\n\t\t\r\n\t\t\tif ( this.isMaximized == true ) {\r\n\t\t\t\tthis.normalize ();\r\n\t\t\t}\r\n\t\t\tvar dock = this.getContainedDock ();\r\n\t\t\tif ( dock && dock.type == DockBinding.TYPE_EDITORS ) {\r\n\t\t\t\tthis._invisibilize ( true );\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * StageSplitBoxBinding listens for DockBinding.ACTION_EMPTIED, \r\n\t\t\t\t * but at one point we were consuming this as well! Hmmmm...... \r\n\t\t\t\t */\r\n\t\t\t\tif ( action.type == StageSplitBoxBinding.ACTION_HIDE ) {\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis.hide ();\r\n\t\t\t\tif ( this.isFixed == true ) {\r\n\t\t\t\t\tthis.setFix ( false );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( action.type == DockBinding.ACTION_EMPTIED ) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tself.dispatchAction ( StageSplitPanelBinding.ACTION_LAYOUTUPDATE );\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase DockBinding.ACTION_OPENED :\r\n\t\tcase StageSplitBoxBinding.ACTION_SHOW :\r\n\t\t\r\n\t\t\tvar dock = this.getContainedDock ();\r\n\t\t\tif ( dock && dock.type == DockBinding.TYPE_EDITORS ) {\r\n\t\t\t\tthis._invisibilize ( false );\r\n\t\t\t\tif ( action.type == StageSplitBoxBinding.ACTION_SHOW ) {\r\n\t\t\t\t\taction.consume (); // is this required?\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis.show ();\r\n\t\t\t\tif ( this.isFixed == true ) {\r\n\t\t\t\t\tthis.setFix ( false );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase StageSplitPanelBinding.ACTION_LAYOUTUPDATE :\r\n\t\t\tvar binding = action.target;\r\n\t\t\tif ( binding != this && binding.getContainedDock ()) {\r\n\t\t\t\tif ( this._containingSplitBoxBinding.getOrient () == SplitBoxBinding.ORIENT_VERTICAL ) {\r\n\t\t\t\t\tvar subBox = binding._containingSplitBoxBinding;\r\n\t\t\t\t\tif ( subBox.getOrient () == SplitBoxBinding.ORIENT_HORIZONTAL ) {\r\n\t\t\t\t\t\tvar subPanels = subBox.getChildBindingsByLocalName ( \"splitpanel\" );\r\n\t\t\t\t\t\tvar subPanel1 = subPanels.getFirst ();\r\n\t\t\t\t\t\tvar subPanel2 = subPanels.getLast ();\r\n\t\t\t\t\t\tif ( this.isFixed == true ) {\r\n\t\t\t\t\t\t\tif ( !subPanel1.isFixed || !subPanel2.isFixed || ( !subBox.hasBothPanelsVisible () && binding.isMinimizedForReal ) ) {\r\n\t\t\t\t\t\t\t\tthis.setFix ( false );\r\n\t\t\t\t\t\t\t\taction.consume ();\r\n\t\t\t\t\t\t\t\tthis.dispatchAction ( StageSplitPanelBinding.ACTION_LAYOUTUPDATE );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif ( subBox.hasBothPanelsFixed () || ( !subBox.hasBothPanelsVisible () && binding.isMinimizedForReal )) {\r\n\t\t\t\t\t\t\t\tthis.setFix ( binding.getContainedDock ().getHeight ());\r\n\t\t\t\t\t\t\t\taction.consume ();\r\n\t\t\t\t\t\t\t\tthis.dispatchAction ( StageSplitPanelBinding.ACTION_LAYOUTUPDATE );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle maximization. Depending on the status of property \"isMaximizePrepared\",\r\n * this will either maximize or hide the splitpanel.\r\n */\r\nStageSplitPanelBinding.prototype.handleMaximization = function () {\r\n\t\r\n\t//this.isFlexible = false;\r\n\tStageBoxAbstraction.handleMaximization.call ( this );\r\n\t\r\n\tvar dockBinding = this.getContainedDock ();\r\n\tif ( dockBinding ) {\r\n\t\tif ( this.isMaximizePrepared == true ) {\r\n\t\t\t// do nothing\r\n\t\t} else {\r\n\t\t\tdockBinding.interceptDisplayChange ( false );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle unmaximization.\r\n */\r\nStageSplitPanelBinding.prototype.handleUnMaximization = function () {\r\n\t\r\n\tStageBoxAbstraction.handleUnMaximization.call ( this );\r\n\t//this.isFlexible = true;\r\n\r\n\tvar dockBinding = this.getContainedDock ();\r\n\tif ( dockBinding ) {\r\n\t\tif ( dockBinding.type == DockBinding.TYPE_EDITORS ) {\r\n\t\t\tif ( dockBinding.isEmpty ) {\r\n\t\t\t\tthis._invisibilize ( true );\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ( this.isMaximized == true ) {\r\n\t\t\tthis.normalize ();\r\n\t\t} else {\r\n\t\t\tdockBinding.interceptDisplayChange ( true );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Maximize.\r\n * @overloads {SplitPanelBinding#maximize}\r\n */\r\nStageSplitPanelBinding.prototype.maximize = function () {\r\n\t\r\n\tif ( this.isMinimized == true ) {\r\n\t\tthis.normalize ( true );\r\n\t}\r\n\tStageSplitPanelBinding.superclass.maximize.call ( this );\r\n\tthis.dispatchAction ( StageSplitPanelBinding.ACTION_LAYOUTUPDATE );\r\n\t\r\n\tvar dockBinding = this.getContainedDock ();\r\n\tif ( dockBinding ) {\r\n\t\tdockBinding.activate ();\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.DOCK_MAXIMIZED, dockBinding );\r\n\t}\r\n}\r\n\r\n/**\r\n * Minimize.\r\n * @overloads {SplitPanelBinding#minimize}\r\n */\r\nStageSplitPanelBinding.prototype.minimize = function () {\r\n\t\r\n\tvar isHorizontalOrient = \r\n\t\tthis._containingSplitBoxBinding.getOrient () == \r\n\t\tSplitBoxBinding.ORIENT_HORIZONTAL;\r\n\t\r\n\tvar dockBinding = this.getContainedDock ();\r\n\tif ( dockBinding ) {\r\n\t\tdockBinding.collapse ( isHorizontalOrient );\r\n\t\tif ( !isHorizontalOrient ) {\r\n\t\t\tthis.setFix ( dockBinding.getHeight ());\r\n\t\t} else {\r\n\t\t\tthis.setFix ( dockBinding.getWidth ());\r\n\t\t}\r\n\t}\r\n\tif ( this.isMaximized == true ) {\r\n\t\tthis.normalize ( true );\r\n\t}\r\n\tStageSplitPanelBinding.superclass.minimize.call ( this );\r\n\tthis.dispatchAction ( StageSplitPanelBinding.ACTION_LAYOUTUPDATE );\r\n\tif ( dockBinding && dockBinding.isActive ) {\r\n\t\tdockBinding.deActivate ();\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.DOCK_MINIMIZED, dockBinding );\r\n\t}\r\n}\r\n\r\n/**\r\n * Normalize.\r\n * @overloads {SplitPanelBinding#normalize}\r\n */\r\nStageSplitPanelBinding.prototype.normalize = function ( isDispatchPrevented ) {\r\n\r\n\tvar isHorizontalOrient = \r\n\t\tthis._containingSplitBoxBinding.getOrient () == \r\n\t\tSplitBoxBinding.ORIENT_HORIZONTAL;\r\n\r\n\tvar dockBinding = this.getContainedDock ();\r\n\tif ( dockBinding ) {\r\n\t\tif ( this.isMinimized == true ) {\r\n\t\t\tdockBinding.unCollapse ( isHorizontalOrient );\r\n\t\t\tthis.setFix ( false );\r\n\t\t}\r\n\t}\r\n\tStageSplitPanelBinding.superclass.normalize.call ( this );\r\n\tif ( !isDispatchPrevented ) {\r\n\t\tthis.dispatchAction ( StageSplitPanelBinding.ACTION_LAYOUTUPDATE );\r\n\t\tif ( dockBinding ) {\r\n\t\t\tdockBinding.activate ();\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.DOCK_NORMALIZED, dockBinding );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * In case we end up movie docks between splitpanels, better get \r\n * a fresh reading on the contained dock each time it is required.\r\n * @return {DockBinding}\r\n */\r\nStageSplitPanelBinding.prototype.getContainedDock = function () {\r\n\t\r\n\t// TODO: DONT INCLUDE START DOCK IN THIS?\r\n\t// TODO: DID WE FÅK THIS UP WITH THE START DOCK?\r\n\t\r\n\treturn this.getChildBindingByLocalName ( \"dock\" );\r\n}\r\n\r\n/**\r\n * Make splitpanel invisible. The visibility of the editors-dock \r\n * is not affected by this method, it is handled internally. \r\n * @param {boolean} isHide\r\n */\r\nStageSplitPanelBinding.prototype.invisibilize = function ( isHide ) {\r\n\r\n\tvar isContinue = true;\r\n\tvar dock = this.getContainedDock ();\r\n\tif ( dock != null && dock.type == DockBinding.TYPE_EDITORS ) {\r\n\t\tif ( dock.isEmpty == true ) {\r\n\t\t\tisContinue = false;\r\n\t\t}\r\n\t}\r\n\tif ( isContinue == true ) {\r\n\t\tthis._invisibilize ( isHide );\r\n\t}\r\n\t\r\n}\r\n\r\n/**\r\n * Make splitpanel invisible (private).\r\n * @param {boolean} isHide\r\n */\r\nStageSplitPanelBinding.prototype._invisibilize = function ( isHide ) {\r\n\t\r\n\tif ( isHide != this._isInvisibilized ) {\r\n\t\tif ( isHide ) {\r\n\t\t\tthis.bindingElement.style.visibility = \"hidden\";\r\n\t\t} else {\r\n\t\t\tthis.bindingElement.style.visibility = \"visible\";\r\n\t\t}\r\n\t\tthis._isInvisibilized = !this._isInvisibilized;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/splitboxes/StageSplitterBinding.js",
    "content": "StageSplitterBinding.prototype = new SplitterBinding;\r\nStageSplitterBinding.prototype.constructor = StageSplitterBinding;\r\nStageSplitterBinding.superclass = SplitterBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageSplitterBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageSplitterBinding\" );\r\n\t\r\n\t/** \r\n\t * @type {boolean}\r\n\t */\r\n\tthis._wasHidden = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageSplitterBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageSplitterBinding]\";\r\n}\r\n\r\n/**\r\n * Invoked by the {@link StageDeckBinding} when maximizing occurs.\r\n * @see {StageDeckBinding#handleControlBoxAction}\r\n */\r\nStageSplitterBinding.prototype.handleMaximization = function () {\r\n\t\r\n\tthis._wasHidden = !this.isVisible;\r\n\tthis.bindingElement.style.display = \"none\"; // why hide-show fail in mozilla?\r\n}\r\n\r\n/**\r\n * Invoked by the {@link StageDeckBinding} when unmaximizing occurs.\r\n * @see {StageDeckBinding#handleControlBoxAction}\r\n */\r\nStageSplitterBinding.prototype.handleUnMaximization = function () {\r\n\t\r\n\tif ( !this._wasHidden ) {\r\n\t\tthis.bindingElement.style.display = \"block\";\r\n\t\tthis._wasHidden = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {SplitterBinding#onDragStart}\r\n * @param {Point} point\r\n */\r\nStageSplitterBinding.prototype.onDragStart = function ( point ) {\r\n\r\n\tvar cover = top.app.bindingMap.stagesplittercover;\r\n\tvar orient = this._containingSplitBoxBinding.getOrient ();\r\n\t\r\n\tswitch ( orient ) {\r\n\t\tcase SplitBoxBinding.ORIENT_HORIZONTAL :\r\n\t\t\tcover.bindingElement.style.cursor = \"e-resize\";\r\n\t\t\tbreak;\r\n\t\tcase SplitBoxBinding.ORIENT_VERTICAL :\r\n\t\t\tcover.bindingElement.style.cursor = \"n-resize\";\r\n\t\t\tbreak;\r\n\t}\r\n\tcover.show ();\r\n\t\r\n\tvar body = top.app.bindingMap.stagesplitterbody;\r\n\tbody.setPosition ( this.getPosition ());\r\n\tbody.setDimension ( this.getDimension ());\r\n\tbody.setOrient ( orient );\r\n\tbody.show ();\r\n\t\r\n\tthis.isDragging = true;\r\n}\r\n\r\n/**\r\n * @overloads {SplitterBinding#onDrag}\r\n * @param {Point} diff\r\n */\r\nStageSplitterBinding.prototype.onDrag = function ( diff ) {\r\n\r\n\tthis._updateSplitterBodyPosition (\r\n\t\tthis.getEvaluatedDiff ( diff )\r\n\t);\r\n}\r\n\r\n/**\r\n * @overloads {SplitterBinding#onDragStop}\r\n * Dispatced action causes containing slitbox to redraw.\r\n * @see {SplitBoxBinding#handleAction}\r\n * @param {Point} diff\r\n */\r\nStageSplitterBinding.prototype.onDragStop = function ( diff ) {\r\n\r\n\tthis._updateSplitterBodyPosition (\r\n\t\tthis.getEvaluatedDiff ( diff )\r\n\t);\r\n\t\r\n\ttop.app.bindingMap.stagesplitterbody.hide ();\r\n\ttop.app.bindingMap.stagesplittercover.hide ();\r\n\t\r\n\tthis.isDragging = false;\r\n\tthis.offset = this._containingSplitBoxBinding.isHorizontalOrient () ? diff.x : diff.y;\r\n\tthis.dispatchAction ( SplitterBinding.ACTION_DRAGGED );\r\n}\r\n\r\n/**\r\n * @param {Point} diff\r\n */\r\nStageSplitterBinding.prototype._updateSplitterBodyPosition = function ( diff ) {\r\n\t\r\n\tvar pos = this.getPosition ();\r\n\tpos.x += diff.x;\r\n\tpos.y += diff.y;\r\n\t\r\n\tapp.bindingMap.stagesplitterbody.setPosition ( pos );\r\n}\r\n\r\n/**\r\n * @return {Position}\r\n */\r\nStageSplitterBinding.prototype.getPosition = function () {\r\n\t\r\n\treturn DOMUtil.getUniversalPosition ( this.bindingElement );\r\n}\r\n\r\n/**\r\n * @return {Dimension}\r\n */\r\nStageSplitterBinding.prototype.getDimension = function () {\r\n\t\r\n\treturn new Dimension ( \r\n\t\tthis.bindingElement.offsetWidth, \r\n\t\tthis.bindingElement.offsetHeight \r\n\t);\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/splitboxes/StageSplitterBodyBinding.js",
    "content": "StageSplitterBodyBinding.prototype = new Binding;\r\nStageSplitterBodyBinding.prototype.constructor = StageSplitterBodyBinding;\r\nStageSplitterBodyBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * When dragging stage splitters, this fellow needs to be rendered  \r\n * in a top level layer in order to appear above views.\r\n * @class\r\n */\r\nfunction StageSplitterBodyBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageSplitterBodyBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._orient = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageSplitterBodyBinding.prototype.toString = function () {\r\n\r\n\treturn \"[StageSplitterBodyBinding]\";\r\n}\r\n\r\n/**\r\n * Set orientation. This determines the draggable directions.\r\n */\r\nStageSplitterBodyBinding.prototype.setOrient = function ( orient ) {\r\n\t\r\n\tthis._orient = orient;\r\n\tthis.attachClassName ( orient );\r\n}\r\n\r\n/**\r\n * Set position.\r\n * @param {Position} pos\r\n */\r\nStageSplitterBodyBinding.prototype.setPosition = function ( pos ) {\r\n\t\r\n\tvar isHorizontal = true;\r\n\tvar isVertical = true;\r\n\t\r\n\tswitch ( this._orient ) {\r\n\t\tcase SplitBoxBinding.ORIENT_HORIZONTAL :\r\n\t\t\tisVertical = false;\r\n\t\t\tbreak;\r\n \t\tcase SplitBoxBinding.ORIENT_VERTICAL :\r\n\t\t\tisHorizontal = false;\r\n\t\t\tbreak;\r\n\t}\r\n\tif ( isHorizontal ) {\r\n\t\tthis.bindingElement.style.left = pos.x + \"px\";\r\n\t}\r\n\tif ( isVertical ) {\r\n\t\tthis.bindingElement.style.top = pos.y + \"px\";\r\n\t}\r\n}\r\n\r\n/**\r\n * Set dimension.\r\n * @param {Dimension} dim\r\n */\r\nStageSplitterBodyBinding.prototype.setDimension = function ( dim ) {\r\n\t\r\n\tthis.bindingElement.style.width = dim.w + \"px\";\r\n\tthis.bindingElement.style.height = dim.h + \"px\";\r\n}\r\n\r\n/**\r\n * Show.\r\n */\r\nStageSplitterBodyBinding.prototype.show = function () {\r\n\t\r\n\tthis.bindingElement.style.display = \"block\";\r\n}\r\n\r\n/**\r\n * Hide. This will automatically reset drag session settings.\r\n * @overwrites {Binding#hide}\r\n */\r\nStageSplitterBodyBinding.prototype.hide = function () {\r\n\t\r\n\tthis.bindingElement.style.display = \"none\";\r\n\tthis.detachClassName ( SplitBoxBinding.ORIENT_HORIZONTAL );\r\n\tthis.detachClassName ( SplitBoxBinding.ORIENT_VERTICAL );\r\n\tthis._orient = null;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/stage/statusbar/StageStatusBarBinding.js",
    "content": "StageStatusBarBinding.prototype = new ToolBarBinding;\r\nStageStatusBarBinding.prototype.constructor = StageStatusBarBinding;\r\nStageStatusBarBinding.superclass = ToolBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StageStatusBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StageStatusBarBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {ToolBarLabelBinding}\r\n\t */\r\n\tthis._label = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStageStatusBarBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[StageStatusBarBinding]\";\r\n}\r\n\r\n/**\r\n * Initialize top level StatusBar object when ready.\r\n * @overloads {Binding#onBindingInitialize} binding\r\n */\r\nStageStatusBarBinding.prototype.onBindingInitialize = function () {\r\n\t\r\n\tthis._label = this.bindingWindow.bindingMap.statusbarlabel;\r\n\tStatusBar.initialize ( this );\r\n\tStageStatusBarBinding.superclass.onBindingInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Set statusbar text.\r\n * @param {string} message\r\n */\r\nStageStatusBarBinding.prototype.setLabel = function ( message ) {\r\n\t\r\n\tthis._label.setLabel ( message );\r\n}\r\n\r\n/**\r\n * Set statusbar image.\r\n * @param {string} image\r\n */\r\nStageStatusBarBinding.prototype.setImage = function ( image ) {\r\n\t\r\n\tthis._label.setImage ( image );\r\n}\r\n\r\n/**\r\n * Clear statusbar.\r\n * @param {string} image\r\n */\r\nStageStatusBarBinding.prototype.clear = function () {\r\n\t\r\n\tthis._label.setLabel ( null );\r\n\tthis._label.setImage ( false );\r\n}\r\n\r\n/**\r\n * Fade out after a given amount of time. \r\n * TODO: IMPLEMENT THIS!\r\n * @param {int} timeout\r\n */\r\nStageStatusBarBinding.prototype.startFadeOut = function ( timeout ) {\r\n\t\r\n\tthis.logger.debug ( \"START FADEOUT\" );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/start/StartMenuItemBinding.js",
    "content": "StartMenuItemBinding.prototype = new MenuItemBinding;\r\nStartMenuItemBinding.prototype.constructor = StartMenuItemBinding;\r\nStartMenuItemBinding.superclass = MenuItemBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction StartMenuItemBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"StartMenuItemBinding\" );\r\n\t\r\n\t/**\r\n\t * @overwrites {MenuItemBinding#type}\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = MenuItemBinding.TYPE_CHECKBOX;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nStartMenuItemBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[StartMenuItemBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {MenuItemBinding#onBindingRegister}\r\n */\r\nStartMenuItemBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tStartMenuItemBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.subscribe ( BroadcastMessages.COMPOSITE_START );\r\n\tthis.subscribe ( BroadcastMessages.COMPOSITE_STOP );\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nStartMenuItemBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tStartMenuItemBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.COMPOSITE_START :\r\n\t\t\tif ( !this.isChecked ) {\r\n\t\t\t\tthis.check ( true );\r\n\t\t\t}\r\n\t\t \tbreak;\r\n\t\tcase BroadcastMessages.COMPOSITE_STOP :\r\n\t\t\tif ( this.isChecked ) {\r\n\t\t\t\tthis.uncheck ( true );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {MenuItemBinding#setChecked}\r\n * @param {boolean} isChecked\r\n * @param {boolean} isPreventCommand\r\n */\r\nStartMenuItemBinding.prototype.setChecked = function ( isChecked, isPreventCommand ) {\r\n\t\r\n\tStartMenuItemBinding.superclass.setChecked.call ( \r\n\t\tthis, \r\n\t\tisChecked, \r\n\t\tisPreventCommand \r\n\t);\r\n\t\r\n\tif ( !isPreventCommand ) {\r\n\t\tif ( this.isChecked ) {\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.START_COMPOSITE );\r\n\t\t} else {\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.STOP_COMPOSITE );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n* StartMenuItemBinding factory.\r\n* @param {DOMDocument} ownerDocument\r\n* @return {StartMenuItemBinding}\r\n*/\r\nStartMenuItemBinding.newInstance = function (ownerDocument) {\r\n\r\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:menuitem\", ownerDocument);\r\n\tUserInterface.registerBinding(element, StartMenuItemBinding);\r\n\treturn UserInterface.getBinding(element);\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/system/SystemPageBinding.js",
    "content": "SystemPageBinding.prototype = new PageBinding;\r\nSystemPageBinding.prototype.constructor = SystemPageBinding;\r\nSystemPageBinding.superclass = PageBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * This fellow runs a simple view on a system tree.\r\n */\r\nfunction SystemPageBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SystemPageBinding\" );\r\n\r\n\t/**\r\n\t * Supplied as page argument.\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.node = null;\r\n\r\n\t/**\r\n\t * @type {SystemTree}\r\n\t */\r\n\tthis._tree = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSystemPageBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SystemPageBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBindingRegister}\r\n */\r\nSystemPageBinding.prototype.onBindingRegister = function () {\r\n\r\n\tSystemPageBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.subscribe ( BroadcastMessages.SYSTEMTREEBINDING_REFRESH );\r\n\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND );\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#setPageArgument}\r\n * @param {SystemNode} systemNode\r\n */\r\nSystemPageBinding.prototype.setPageArgument = function ( systemNode ) {\r\n\r\n\tthis.node = systemNode;\r\n\tSystemPageBinding.superclass.setPageArgument.call ( this, systemNode );\r\n}\r\n\r\n/**\r\n * @overloads {PageBinding#onBeforePageInitialize}\r\n */\r\nSystemPageBinding.prototype.onBeforePageInitialize = function () {\r\n\r\n\tif ( this.node ) {\r\n\t\tthis._tree = this.bindingWindow.bindingMap.tree;\r\n\t\tif ( this._tree ) {\r\n\t\t\tthis._buildTree ();\r\n\t\t} else {\r\n\t\t\tthrow \"SystemPageBinding requires a SystemTreeBinding\";\r\n\t\t}\r\n\t} else {\r\n\t\tthrow \"SystemPageBinding requires a SystemNode\";\r\n\t}\r\n\r\n\tSystemPageBinding.superclass.onBeforePageInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Build tree.\r\n */\r\nSystemPageBinding.prototype._buildTree = function () {\r\n\r\n\tvar children = this.node.getChildren ();\r\n\tif ( children.hasEntries ()) {\r\n\t\twhile ( children.hasNext ()) {\r\n\t\t\tvar node = SystemTreeNodeBinding.newInstance (\r\n\t\t\t\tchildren.getNext (),\r\n\t\t\t\tthis.bindingDocument\r\n\t\t\t)\r\n\t\t\tthis._tree.add ( node );\r\n\t\t\tnode.attach ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Refresh tree.\r\n */\r\nSystemPageBinding.prototype._refreshTree = function () {\r\n\r\n\t/*\r\n\t * Preopen non-container root nodes. That aint right,\r\n\t * but they will get replaced by fresh nodes anyway.\r\n\t * This will let the user see a newly added treenode\r\n\t * without opening container, at least at root level.\r\n\t */\r\n\tvar roots = this._tree._treeBodyBinding.getChildBindingsByLocalName ( \"treenode\" );\r\n\troots.each ( function ( root ) {\r\n\t\tif ( !root.isContainer ) {\r\n\t\t\troot.isOpen = true;\r\n\t\t}\r\n\t});\r\n\r\n\r\n\t// Collect open treenodes.\r\n\tvar crawler = new TreeCrawler ();\r\n\tvar opens = new List ();\r\n\tcrawler.mode = TreeCrawler.MODE_GETOPEN;\r\n\tcrawler.crawl ( this.bindingElement, opens );\r\n\tcrawler.dispose ();\r\n\r\n\t// Extract open SystemNodes.\r\n\tvar list = new List ([ this.node ]);\r\n\topens.each ( function ( treenode ) {\r\n\t\tlist.add ( treenode.node );\r\n\t});\r\n\r\n\t// Empty tree and build new.\r\n\tthis._tree.empty ();\r\n\tvar branch = this.node.getDescendantBranch ( list );\r\n\r\n\tif ( branch.hasEntries ()) {\r\n\r\n\t\tvar self = this;\r\n\t\tvar map = new Map ();\r\n\r\n\t\t/*\r\n\t\t * Note that this is basically a copy-paste\r\n\t\t * of some stoff going on in SystemTreeNode.\r\n\t\t */\r\n\t\tbranch.each ( function ( key, nodes ) {\r\n\t\t\tnodes.each ( function ( node ) {\r\n\r\n\t\t\t\tvar treenode = SystemTreeNodeBinding.newInstance ( node, self.bindingDocument );\r\n\t\t\t\tmap.set ( node.getHandle (), treenode );\r\n\t\t\t\tif ( map.has ( key )) {\r\n\t\t\t\t\tvar parent = map.get ( key );\r\n\t\t\t\t\tparent.add ( treenode );\r\n\t\t\t\t\tparent.isOpen = true;\r\n\t\t\t\t} else if ( key == self.node.getHandle ()) {\r\n\t\t\t\t\tself._tree.add ( treenode );\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\tthis._tree.attachRecursive ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Executed when the page is shown. Select first treenode.\r\n */\r\nSystemPageBinding.prototype.onAfterPageInitialize = function () {\r\n\r\n\tSystemPageBinding.superclass.onAfterPageInitialize.call ( this );\r\n\tthis._tree.selectDefault();\r\n\r\n\tif (Application.isTestEnvironment) {\r\n\t\ttry {\r\n\t\t\tthis.setProperty(\"data-qa\", this.node.getTag());\r\n\t\t} catch (exception) { }\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nSystemPageBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tSystemPageBinding.superclass.handleAction.call ( this, action )\r\n\r\n\tswitch ( action.type ) {\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\tvar button = action.target;\r\n\t\t\tswitch ( button.getID ()) {\r\n\t\t\t\tcase \"locktreebutton\" :\r\n\t\t\t\t\tthis._tree.setLockToEditor ( button.isChecked );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"collapsebutton\" :\r\n\t\t\t\t\tthis._tree.collapse ();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nSystemPageBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tSystemPageBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\t/*\r\n\t * This is basically a copy of the procedure instiaged\r\n\t * at SystemTreeNodeBinding method \"refresh\".\r\n\t */\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESH :\r\n\r\n\t\t\tvar token = arg;\r\n\t\t\tif ( this.node && this.node.getEntityToken () == token ) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, token );\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tApplication.lock ( this );\r\n\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\tself._refreshTree ();\r\n\t\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SYSTEMTREEBINDING_REFRESHED, token );\r\n\t\t\t\t\t\tApplication.unlock ( self );\r\n\t\t\t\t\t}, 0 );\r\n\t\t\t\t} catch ( exception ) {\r\n\t\t\t\t\talert ( exception );\r\n\t\t\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/system/SystemToolBarBinding.js",
    "content": "SystemToolBarBinding.prototype = new ToolBarBinding;\r\nSystemToolBarBinding.prototype.constructor = SystemToolBarBinding;\r\nSystemToolBarBinding.superclass = ToolBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * This would be the giant toolbar at the top of the main window.\r\n */\r\nfunction SystemToolBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SystemToolBarBinding\" );\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._currentProfileKey = null;\r\n\r\n\t/**\r\n\t * @type {HashMap<string><ButtonBinding>}\r\n\t */\r\n\tthis._actionFolderNames = {};\r\n\r\n\t/**\r\n\t * @type {Map<string><List<SystemAction>>}\r\n\t */\r\n\tthis._actionProfile = null;\r\n\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._moreActionsWidth = 0;\r\n\r\n\t/**\r\n\t * Actions that wouldn't fit on the toolbar.\r\n\t * @type {List<SystemAction>}\r\n\t */\r\n\tthis._moreActions = null;\r\n\r\n\t/**\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis._node = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._syncHandle = null;\r\n\r\n\t/**\r\n\t* Tree position\r\n\t* @type {int}\r\n\t*/\r\n\tthis._activePosition = SystemAction.activePositions.NavigatorTree;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._keepBundleState = false;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSystemToolBarBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SystemToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * Setup toolbar rebuild when an actionProfile is published.\r\n * @overloads {ToolBarBinding#onBindingAttach}\r\n */\r\nSystemToolBarBinding.prototype.onBindingAttach = function () {\r\n\r\n\tSystemToolBarBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tif ( System.hasActivePerspectives ) {\r\n\t\tthis.subscribe ( BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED );\r\n\t\tthis.subscribe ( this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST );\r\n\t\tthis.subscribe ( BroadcastMessages.INVOKE_DEFAULT_ACTION );\r\n\t\tthis.addActionListener ( ButtonBinding.ACTION_COMMAND );\r\n\t} else {\r\n\t\tthis.hide ();\r\n\t}\r\n\r\n\tif (this.getProperty(\"target\") === \"perspective\") {\r\n\t\tthis._syncHandle = StageBinding.perspectiveNode.getHandle();\r\n\t}\r\n}\r\n\r\n/**\r\n * Do stuff with dimensions on startup (handles too many actions on toolbar).\r\n * @overloads {ToolBarBinding#onBindingInitialize}\r\n */\r\nSystemToolBarBinding.prototype.onBindingInitialize = function () {\r\n\r\n\t// lookup more-actions toolbarbody width - then hide it\r\n\tvar moreActionsBody = this.bindingWindow.bindingMap.moreactionstoolbargroup;\r\n\tthis._moreActionsWidth = moreActionsBody.boxObject.getDimension ().w;\r\n\tmoreActionsBody.hide ();\r\n\r\n\t// lock toolbar height to fix overflow issues.\r\n\tvar height = this.boxObject.getDimension ().h;\r\n\tthis.bindingElement.style.height = height + \"px\";\r\n\r\n\t// rigup more-actions button.\r\n\tvar self = this;\r\n\tvar button = this.bindingWindow.bindingMap.moreactionsbutton;\r\n\tbutton.addActionListener ( ButtonBinding.ACTION_COMMAND, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tself._showMoreActions ();\r\n\t\t\taction.consume ();\r\n\t\t}\r\n\t});\r\n\r\n\t// rigup more-actions popup\r\n\tvar popup = this.bindingWindow.bindingMap.moreactionspopup;\r\n\tpopup.addActionListener ( MenuItemBinding.ACTION_COMMAND, {\r\n\t\thandleAction : function ( action ) {\r\n\t\t\tvar item = action.target;\r\n\t\t\tself._handleSystemAction ( item.associatedSystemAction );\r\n\t\t}\r\n\t});\r\n\r\n\tSystemToolBarBinding.superclass.onBindingInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Handle EventBroadcaster transmissions. In particular, watch out for actionprofiles.\r\n * @see {SystemTreeBinding#_publishCompiledActionProfile}\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nSystemToolBarBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tSystemToolBarBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tswitch (broadcast) {\r\n\t\tcase BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED:\r\n\r\n\t\t\tvar self = this;\r\n\t\t\tif (arg != null && arg.syncHandle == this.getSyncHandle()) {\r\n\t\t\t\tif (arg.actionProfile != null && arg.actionProfile.hasEntries()) {\r\n\t\t\t\t\tthis._actionProfile = arg.actionProfile;\r\n\t\t\t\t\t//TODO: refactor with updating API\r\n\t\t\t\t\tthis._node = arg.actionProfile.Node;\r\n\t\t\t\t\tvar key = this._getProfileKey();\r\n\t\t\t\t\tif (key != this._currentProfileKey) {\r\n\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t* Timeout prevents \"freezing\" tree selection.\r\n\t\t\t\t\t\t\t*/\r\n\t\t\t\t\t\tsetTimeout(function() {\r\n\t\t\t\t\t\t\tself.emptyLeft();\r\n\t\t\t\t\t\t\tself._actionFolderNames = {};\r\n\t\t\t\t\t\t\tself.buildLeft();\r\n\t\t\t\t\t\t\tself._currentProfileKey = key;\r\n\t\t\t\t\t\t}, 0);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsetTimeout(function() {\r\n\t\t\t\t\t\tself.emptyLeft();\r\n\t\t\t\t\t\tself._actionFolderNames = {};\r\n\t\t\t\t\t\tself._currentProfileKey = null;\r\n\t\t\t\t\t\tself._node = null;\r\n\t\t\t\t\t\tvar mores = self.bindingWindow.bindingMap.moreactionstoolbargroup;\r\n\t\t\t\t\t\tif (mores != null) {\r\n\t\t\t\t\t\t\tmores.hide();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, 0);\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST:\r\n\r\n\t\t\tvar manager = this.bindingWindow.WindowManager;\r\n\t\t\tthis._toolBarBodyLeft.refreshToolBarGroups();\r\n\t\t\tthis._containAllButtons();\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.INVOKE_DEFAULT_ACTION:\r\n\t\t\tif (arg != null && arg.syncHandle == this.getSyncHandle()) {\r\n\t\t\t\tthis._invokeDefaultAction();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @see {SystemTreePopupBinding#_getProfileKey}\r\n * @return {string}\r\n */\r\nSystemToolBarBinding.prototype._getProfileKey = function () {\r\n\r\n\tvar result = new String ( \"\" );\r\n\tthis._actionProfile.each ( function ( groupid, list ) {\r\n\t    list.each( function (systemAction ) {\r\n\t        result += systemAction.getHandle() + \";\" + systemAction.getKey() + \";\";\r\n\t\t\t//Make different profile key for toolbar with enabled/disabled actions\r\n\t\t\tif (systemAction.isDisabled())\r\n\t\t\t\tresult += \"isDisabled='true';\";\r\n\t\t});\r\n\t});\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Invoke actions when toolbarbuttons gets clicked.\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nSystemToolBarBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tSystemToolBarBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tswitch ( action.type ) {\r\n\t\tcase ButtonBinding.ACTION_COMMAND :\r\n\t\t\tvar button = action.target;\r\n\t\t\tthis._handleSystemAction ( button.associatedSystemAction );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle system-action.\r\n * @param (SystemAction} action\r\n */\r\nSystemToolBarBinding.prototype._handleSystemAction = function ( action ) {\r\n\r\n\tif ( action != null ) {\r\n\t\tSystemAction.invoke(action, this._node);\r\n\t}\r\n}\r\n\r\n/**\r\n * Build left-aligned toolbar content based on last published actionProfile.\r\n */\r\nSystemToolBarBinding.prototype.buildLeft = function () {\r\n\r\n\tif (this.isInitialized && this._actionProfile != null && this._actionProfile.hasEntries()) {\r\n\r\n\t\tvar doc = this.bindingDocument;\r\n\t\tvar self = this;\r\n\r\n\t\tvar popupSetBinding = PopupSetBinding.getPopupSet(doc, \"bundlepopup\");\r\n\t\tvar bundles = new Map();\r\n\r\n\t\tthis._actionProfile.each ( function ( groupid, list ) {\r\n\r\n\t\t\tvar buttons = new List ();\r\n\r\n\t\t\tlist.reset ();\r\n\t\t\twhile ( list.hasNext ()) {\r\n\t\t\t\tvar action = list.getNext ();\r\n\t\t\t\tvar buttonBinding = null;\r\n\r\n\t\t\t\tif ( action.isInToolBar ()) {\r\n\t\t\t\t\tvar bundleName = action.getBundleName();\r\n\t\t\t\t\tif (bundleName) {\r\n\r\n\t\t\t\t\t\tvar popupBinding;\r\n\r\n\t\t\t\t\t\tif (bundles.has(bundleName)) {\r\n\t\t\t\t\t\t\tpopupBinding = popupSetBinding.getPopupByRel(bundleName);\r\n\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tbuttonBinding = ToolBarComboButtonBinding.newInstance(doc);\r\n\t\t\t\t\t\t\tbuttonBinding.setProperty(\"bundle\", bundleName);\r\n\t\t\t\t\t\t\tbuttonBinding.setProperty(\"keepstate\", this._keepBundleState);\r\n\t\t\t\t\t\t\tbundles.set(bundleName, buttonBinding);\r\n\t\t\t\t\t\t\tpopupBinding = popupSetBinding.createNewPopupByRel(bundleName);\r\n\t\t\t\t\t\t\tpopupBinding.showTextOnly();\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tvar item = SystemTreePopupBinding.prototype.getMenuItemBinding.call(this, action);\r\n\r\n\t\t\t\t\t\tpopupBinding.add(\r\n\t\t\t\t\t\t\titem\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\titem.attach();\r\n\t\t\t\t\t\titem.menuHandle = action.getHandle();\r\n\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tbuttonBinding = self.getToolBarButtonBinding(action);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif ( buttonBinding != null ) {\r\n\t\t\t\t\tbuttons.add ( buttonBinding );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ( buttons.hasEntries ()) {\r\n\t\t\t\tvar groupBinding = ToolBarGroupBinding.newInstance ( doc );\r\n\t\t\t\tbuttons.each ( function ( buttonBinding ) {\r\n\t\t\t\t\tgroupBinding.add ( buttonBinding );\r\n\t\t\t\t});\r\n\t\t\t\tself.addLeft ( groupBinding ); // TODO: BOOLEAN ARGUMENT HERE!\r\n\t\t\t}\r\n\t\t}, this);\r\n\r\n\t\tthis.attachRecursive();\r\n\r\n\t\tbundles.each(function(bundle, buttonBinding) {\r\n\t\t\tbuttonBinding.setPopup(popupSetBinding.getPopupByRel(bundle));\r\n\t\t});\r\n\t\tthis._containAllButtons ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Contain all buttons. Overflowing buttons are moved to a popup.\r\n */\r\nSystemToolBarBinding.prototype._containAllButtons = function () {\r\n\r\n    var mores = this.bindingWindow.bindingMap.moreactionstoolbargroup;\r\n    var paddings = CSSComputer.getPadding(this.bindingElement);\r\n    var avail = this.bindingElement.offsetWidth - paddings.left - paddings.right;\r\n \tif (Localization.isUIRtl) {\r\n \t\tavail = this.bindingElement.offsetWidth - paddings.left - paddings.right;\r\n\t}\r\n\r\n\tif (avail <= 0)\r\n\t\treturn;\r\n\r\n\tvar total = 0;\r\n\tvar hides = new List ();\r\n\r\n\tvar button, buttons = this._toolBarBodyLeft.getDescendantBindingsByLocalName ( \"toolbarbutton\" );\r\n\twhile (( button = buttons.getNext ()) != null ) {\r\n\t\tif ( !button.isVisible ) {\r\n\t\t\tbutton.show ();\r\n\t\t}\r\n\t\tvar margin = CSSComputer.getMargin(button.bindingElement);\r\n\t\ttotal += button.boxObject.getDimension().w + margin.left + margin.right;\r\n\t\tif (total >= avail || (total + this._moreActionsWidth >= avail && buttons.hasNext())) {\r\n\t\t\thides.add ( button );\r\n\t\t\tbutton.hide ();\r\n\t\t}\r\n\t}\r\n\r\n\tif ( hides.hasEntries ()) {\r\n\r\n\t\tvar group = hides.getFirst ().bindingElement.parentNode;\r\n\t\tUserInterface.getBinding ( group ).setLayout ( ToolBarGroupBinding.LAYOUT_LAST );\r\n\r\n\t\tthis._moreActions = new List ();\r\n\t\twhile (( button = hides.getNext ()) != null ) {\r\n\t\t\tif (button instanceof ToolBarComboButtonBinding) {\r\n\t\t\t\tbutton.getAssociatedSystemActions().each(function(associatedSystemAction) {\r\n\t\t\t\t\tthis._moreActions.add(associatedSystemAction);\r\n\t\t\t\t}, this);\r\n\t\t\t} else {\r\n\t\t\t\tthis._moreActions.add(button.associatedSystemAction);\r\n\t\t\t}\r\n\t\t}\r\n\t\tmores.show ();\r\n\r\n\t} else {\r\n\t\tthis._moreActions = null;\r\n\t\tmores.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Show more actions.\r\n */\r\nSystemToolBarBinding.prototype._showMoreActions = function () {\r\n\r\n\tif ( this._moreActions != null ) {\r\n\t\tvar popup = this.bindingWindow.bindingMap.moreactionspopup;\r\n\t\tpopup.empty ();\r\n\t\twhile (( action = this._moreActions.getNext ()) != null ) {\r\n\t\t\tvar item = MenuItemBinding.newInstance(popup.bindingDocument);\r\n\r\n\t\t\tSystemTreePopupBinding.prototype.setSystemAction.call(this, item, action);\r\n\t\t\tpopup.add ( item );\r\n\t\t}\r\n\t\tpopup.attachRecursive ();\r\n\t\tthis._moreActions = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * This method is mirrored by the explorer popupmenu - please coordinate changes.\r\n * @see {SystemPopupBinding#getMenuItemBinding}\r\n * @param {SystemAction} action\r\n * @return {ToolBarButtonBinding}\r\n */\r\nSystemToolBarBinding.prototype.getToolBarButtonBinding = function ( action) {\r\n\r\n\tvar binding\t\t= ToolBarButtonBinding.newInstance ( this.bindingDocument );\r\n\tvar label \t\t= action.getLabel ();\r\n\tvar tooltip\t\t= action.getToolTip ();\r\n\tvar image \t\t= action.getImage ();\r\n\tvar isDisabled\t= action.isDisabled ();\r\n\r\n\tif (image) {\r\n\t\tbinding.setImage(image);\r\n\t}\r\n\tif ( label ) {\r\n\t\tbinding.setLabel ( label );\r\n\t}\r\n\tif ( tooltip ) {\r\n\t\tbinding.setToolTip ( tooltip );\r\n\t}\r\n\tif ( action.isDisabled ()) {\r\n\t\tbinding.disable ();\r\n\t}\r\n\tif (Application.isTestEnvironment) {\r\n\t\tbinding.setProperty(\"data-qa\", action.getKey());\r\n\t}\r\n\r\n\t/*\r\n\t * Stamp the action as a property on the buttonbinding\r\n\t * so that we can retrieve it when the button is clicked.\r\n\t */\r\n\tbinding.associatedSystemAction = action;\r\n\r\n\treturn binding;\r\n};\r\n\r\n\r\n/**\r\n * Invoke default action. Currently, this is the action\r\n * associated to the first toolbarbutton on display.\r\n * @return\r\n */\r\nSystemToolBarBinding.prototype._invokeDefaultAction = function () {\r\n\r\n\tvar button = this.getDescendantBindingByLocalName ( \"toolbarbutton\" );\r\n\tif ( button != null ) {\r\n\t\tbutton.fireCommand ();\r\n\t}\r\n};\r\n\r\n\r\n/**\r\n* get activePosition.\r\n* @return {int}\r\n*/\r\nSystemToolBarBinding.prototype.getActivePosition = function () {\r\n\treturn this._activePosition;\r\n};\r\n\r\n/**\r\n * SystemToolBarBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {SystemToolBarBinding}\r\n */\r\nSystemToolBarBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbar\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, SystemToolBarBinding );\r\n}\r\n\r\n\r\n/**\r\n * @param {Point} point\r\n */\r\nSystemToolBarBinding.prototype.setPosition = function (point) {\r\n\r\n\tthis.bindingElement.style.left = point.x + \"px\";\r\n\tthis.bindingElement.style.top = point.y + \"px\";\r\n}\r\n\r\n/**\r\n * @param {Dimension} dimension\r\n */\r\nSystemToolBarBinding.prototype.setDimension = function (dimension) {\r\n\r\n\tdimension.h -= ViewBinding.VERTICAL_ADJUST;\r\n\tdimension.w -= ViewBinding.HORIZONTAL_ADJUST;\r\n\r\n\t/*\r\n\t * Something hardcoded here...\r\n\t */\r\n\tdimension.w -= 1;\r\n\r\n\tif (dimension.h < 0) { // not sure why this happens...\r\n\t\tdimension.h = 0;\r\n\t}\r\n\tif (dimension.w < 0) {\r\n\t\tdimension.w = 0;\r\n\t}\r\n\tthis.bindingElement.style.width = String(dimension.w) + \"px\";\r\n\tthis.bindingElement.style.height = String(dimension.h) + \"px\";\r\n}\r\n\r\n/**\r\n * set SyncHandle\r\n * @param {string} dimensionsyncHandle\r\n */\r\nSystemToolBarBinding.prototype.setSyncHandle = function (syncHandle) {\r\n\tthis._syncHandle = syncHandle;\r\n\r\n}\r\n\r\n/**\r\n * get SyncHandle\r\n */\r\nSystemToolBarBinding.prototype.getSyncHandle = function () {\r\n\treturn this._syncHandle;\r\n\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/system/SystemTreeBinding.js",
    "content": "SystemTreeBinding.prototype = new TreeBinding;\r\nSystemTreeBinding.prototype.constructor = SystemTreeBinding;\r\nSystemTreeBinding.superclass = TreeBinding.prototype;\r\n\r\n/**\r\n * Flag determines whether or not treebranches should always\r\n * refresh when the parent folder is closed and reopened.\r\n * @type {boolean}\r\n */\r\nSystemTreeBinding.HAS_NO_MEMORY = false;\r\n\r\n/**\r\n * @type {SystemTreeNodeBinding}\r\n */\r\nSystemTreeBinding.clipboard = null;\r\n\r\n/**\r\n * @type {string}\r\n */\r\nSystemTreeBinding.clipboardOperation = null;\r\n\r\n/*\r\n * Detailed paste dialog.\r\n */\r\nSystemTreeBinding.URL_DIALOG_DETAILEDPASTE = \"${root}/content/dialogs/systemtrees/detailedpaste.aspx\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SystemTreeBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"SystemTreeBinding\");\r\n\r\n\t/**\r\n\t * Associates the tree to the selected perspective.\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.perspectiveNode = null;\r\n\r\n\t/**\r\n\t * @type {SystemTreeNodeBinding}\r\n\t */\r\n\tthis._defaultTreeNode = null;\r\n\r\n\t/**\r\n\t * Publishing actionprofiles when treenodes get selected?\r\n\t * If set to false, no commands will be relayed to main toolbar.\r\n\t * TODO: Filter commands on server instead!\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isActionProfileAware = true;\r\n\r\n\t/**\r\n\t* Tree position\r\n\t* @type {int}\r\n\t*/\r\n\tthis._activePosition = SystemAction.activePositions.NavigatorTree;\r\n\r\n\t/**\r\n\t * @type {HashMap<string><boolean>}\r\n\t */\r\n\tthis._actionGroup = null;\r\n\r\n\t/**\r\n\t * This can be deprecated if we implement serverside treenode selection.\r\n\t * @type {string}\r\n\t */\r\n\tthis._backupfocushandle = null;\r\n\r\n\t/**\r\n\t * This can be deprecated if we implement serverside treenode selection.\r\n\t * @type {SystemTreeNodeBinding}\r\n\t */\r\n\tthis._tempSelectedNode = null;\r\n\r\n\t/**\r\n\t * This can be deprecated if we implement serverside treenode selection.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._tempSelectionTimeout = false;\r\n\r\n\t/**\r\n\t * While this._treeNodeBindings index treenodes by unique handle (ElementKey),\r\n\t * this will index groups of treenodes sharing the same EntityToken.\r\n\t * @type {Map<string><List<SystemTreeNodeBinding>>}\r\n\t */\r\n\tthis._entityTokenRegistry = null;\r\n\r\n\t/**\r\n\t * Counting refreshing treenodes so that we may poke the MessageQueue\r\n\t * once all nodes are finished (some timeouts involved here).\r\n\t * @type {Map<string><boolean>}\r\n\t */\r\n\tthis._refreshingTreeNodes = null;\r\n\r\n\t/**\r\n\t * When the tree is refreshed by MessageQueue, this stores the refreshtoken.\r\n\t * @type {string}\r\n\t */\r\n\tthis._refreshToken = null;\r\n\r\n\t/**\r\n\t * Lock tree to editor?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isLockedToEditor = false;\r\n\r\n\t/**\r\n\t * Points to the last treenode that was blurred in an\r\n\t * attempt, always to offer a sensible treenode focus.\r\n\t * @type {string}\r\n\t */\r\n\tthis._restorableFocusHandle = null;\r\n\r\n\t/**\r\n\t * Points to the parent of last treenode that was blurred\r\n\t * @type {string}\r\n\t */\r\n\tthis._restorableFocusParentHandle = null;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSystemTreeBinding.prototype.toString = function () {\r\n\r\n\treturn \"[SystemTreeBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {TreeBinding#onBindingRegister}\r\n */\r\nSystemTreeBinding.prototype.onBindingRegister = function () {\r\n\r\n\tSystemTreeBinding.superclass.onBindingRegister.call(this);\r\n\r\n\t/*\r\n\t * Mark the tree as resident on the currently selected perspective.\r\n\t */\r\n\tthis.perspectiveNode = StageBinding.perspectiveNode;\r\n\r\n\t/*\r\n\t * File subscriptions.\r\n\t */\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_REFRESH);\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_FOCUS);\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_CUT);\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_COPY);\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_PASTE);\r\n\tthis.subscribe(BroadcastMessages.SYSTEMTREEBINDING_COLLAPSEALL);\r\n\tthis.subscribe(BroadcastMessages.DOCKTABBINDING_SELECT);\r\n\tthis.subscribe(BroadcastMessages.STAGEDIALOG_OPENED);\r\n\r\n\t/*\r\n\t * Init stuff.\r\n\t */\r\n\tthis.addActionListener(SystemTreeNodeBinding.ACTION_REFRESHED_YEAH);\r\n\tthis.addActionListener(TreeNodeBinding.ACTION_COMMAND);\r\n\tthis._entityTokenRegistry = new Map();\r\n\tthis._refreshingTreeNodes = new Map();\r\n\r\n\t/*\r\n\t * Should tree selection update top toolbar?\r\n\t */\r\n\tif (this.getProperty(\"actionaware\") == false) {\r\n\t\tthis._isActionProfileAware = false;\r\n\t} else {\r\n\t\tthis.setContextMenu(top.app.bindingMap.systemtreepopup);\r\n\t}\r\n\r\n\r\n\tif (this.getProperty(\"treeselector\") == true) {\r\n\t\tthis._activePosition = SystemAction.activePositions.SelectorTree;\r\n\t}\r\n\r\n\r\n\t/*\r\n\t * Setup lock-to-editor.\r\n\t */\r\n\tif (this.getProperty(\"locktoeditor\") != null) {\r\n\t\tthis.isLockedToEditor = this.getProperty(\"locktoeditor\");\r\n\t}\r\n}\r\n\r\n/**\r\n * Register the first added treenode so that we can focus it when tree is ready.\r\n * @overloads {TreeBinding#add}\r\n * @param {Binding} binding\r\n * @return {Binding}\r\n */\r\nSystemTreeBinding.prototype.add = function (binding) {\r\n\r\n\tvar returnable = SystemTreeBinding.superclass.add.call(this, binding);\r\n\tif (this._defaultTreeNode === null) {\r\n\t\tif (binding instanceof SystemTreeNodeBinding) {\r\n\t\t\tthis._defaultTreeNode = binding;\r\n\t\t}\r\n\t}\r\n\treturn returnable;\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {TreeBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nSystemTreeBinding.prototype.handleAction = function (action) {\r\n\r\n\tSystemTreeBinding.superclass.handleAction.call(this, action);\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch (action.type) {\r\n\r\n\t\t/*\r\n\t\t* Publish actionprofile when selection changes.\r\n\t\t*/\r\n\t\tcase TreeNodeBinding.ACTION_ONFOCUS:\r\n\t\tcase TreeNodeBinding.ACTION_ONMULTIFOCUS:\r\n\t\t\tthis._restorableFocusHandle = null;\r\n\t\t\tthis._restorableFocusParentHandle = null;\r\n\t\t\tbreak;\r\n\r\n\t\t\t/**\r\n\t\t\t* Broadcast when treenodes are finished refreshing.\r\n\t\t\t* This is intercepted by the MessageQueue.\r\n\t\t\t*/\r\n\t\tcase SystemTreeNodeBinding.ACTION_REFRESHED_YEAH:\r\n\r\n\t\t\tthis._updateRefreshingTrees(binding.key);\r\n\t\t\tthis._updateFocusedNode();\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\r\n\t\tcase TreeNodeBinding.ACTION_DISPOSE:\r\n\t\tcase TreeNodeBinding.ACTION_BLUR:\r\n\r\n\t\t\t/*\r\n\t\t\t* This should probably be refactored along with the whole\r\n\t\t\t* _focusedTreeNodeBindings setup, but at least we clear\r\n\t\t\t* the toolbar when tree has no focused nodes...\r\n\t\t\t*/\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tif (!self._focusedTreeNodeBindings.hasEntries()) {\r\n\t\t\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\t\t\tBroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED,\r\n\t\t\t\t\t\t{ position: self._activePosition }\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}, 0);\r\n\r\n\t\t\t/*\r\n\t\t\t* Backup the node that blurred. This will allow us to\r\n\t\t\t* focus an appropriate treenode on tree focus, even\r\n\t\t\t* when some feature destroyed all tree selection.\r\n\t\t\t* @see {SystemTreeBinding#focus}\r\n\t\t\t*/\r\n\t\t\tif (action.type == TreeNodeBinding.ACTION_BLUR) {\r\n\t\t\t\tthis._restorableFocusHandle = binding.getHandle();\r\n\t\t\t\tvar parent = binding.getParent();\r\n\t\t\t\tif (parent) {\r\n\t\t\t\t\tthis._restorableFocusParentHandle = parent.getHandle();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase TreeNodeBinding.ACTION_COMMAND:\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.INVOKE_DEFAULT_ACTION, { syncHandle: this.getSyncHandle()});\r\n\t\t\taction.consume();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n///**\r\n// * @overloads {TreeBinding#focus}\r\n// */\r\n//SystemTreeBinding.prototype.focus = function () {\r\n\r\n//\tSystemTreeBinding.superclass.focus.call(this);\r\n//\tif (this.isFocused) {\r\n//\t\tthis._handleSystemTreeFocus();\r\n//\t}\r\n//}\r\n\r\n/**\r\n * Default focus action - focus LAST FOCUSED node in tree.\r\n * @overwrites {TreeBinding#_focusDefault}\r\n */\r\nSystemTreeBinding.prototype._focusDefault = function () {\r\n\r\n\tthis._attemptRestorableFocus();\r\n\tif (!this.getFocusedTreeNodeBindings().hasEntries()) {\r\n\t\tSystemTreeBinding.superclass._focusDefault.call(this);\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Return perspective handle for tree\r\n */\r\nSystemTreeBinding.prototype.getSyncHandle = function () {\r\n\r\n\tif (this.getProperty(\"treeselector\") == true) {\r\n\t\treturn this.getAncestorBindingByType(PageBinding).getID();\r\n\t} else {\r\n\t\treturn this.perspectiveNode.getHandle();\r\n\t}\r\n\r\n}\r\n\r\n\r\n/**\r\n * By now, something has probably eliminated all tree focus. But since\r\n * we back up the last blurred node, we can restore a sensible focus.\r\n */\r\nSystemTreeBinding.prototype._attemptRestorableFocus = function () {\r\n\r\n\tif (this._treeNodeBindings.has(this._restorableFocusHandle)) {\r\n\t\tvar treenode = this._treeNodeBindings.get(this._restorableFocusHandle);\r\n\t\tthis.focusSingleTreeNodeBinding(treenode);\r\n\t} else if (this._treeNodeBindings.has(this._restorableFocusParentHandle)) { // focused item removed\r\n\t\tvar treenode = this._treeNodeBindings.get(this._restorableFocusParentHandle);\r\n\t\tthis.focusSingleTreeNodeBinding(treenode);\r\n\t}\r\n\tthis._restorableFocusHandle = null;\r\n\tthis._restorableFocusParentHandle = null;\r\n}\r\n\r\n/**\r\n * Invoked when tree focus changes AND when tree itself recieves the focus\r\n * AND when lock-tree-to-editor feature updates the treenode focus.\r\n */\r\nSystemTreeBinding.prototype._handleSystemTreeFocus = function () {\r\n\r\n\tif (this.getFocusedTreeNodeBindings().hasEntries()) {\r\n\t\tthis._computeClipboardSetup();\r\n\t\tthis._computeRefreshSetup();\r\n\t\tif (this._isActionProfileAware) {\r\n\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\tBroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED,\r\n\t\t\t\t{\r\n\t\t\t\t\tactivePosition: this._activePosition,\r\n\t\t\t\t\tactionProfile: this.getCompiledActionProfile(),\r\n\t\t\t\t\tsyncHandle: this.getSyncHandle(),\r\n\t\t\t\t\tsource: this\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {SystemTreeNodeBinding} treenode\r\n */\r\nSystemTreeBinding.prototype.getTokens = function (treenode) {\r\n\r\n\treturn treenode.node.getEntityTokens();\r\n}\r\n\r\n/**\r\n * Register treenode.\r\n * @param {SystemTreeNodeBinding} treenode\r\n */\r\nSystemTreeBinding.prototype.registerTreeNodeBinding = function (treenode) {\r\n\r\n\ttreenode.getHandles().each(function(handle) {\r\n\t\tif (this._treeNodeBindings.has(handle)) {\r\n\t\t\tthrow \"Duplicate treenodehandles registered: \" + treenode.getLabel();\r\n\t\t} else {\r\n\t\t\tthis._treeNodeBindings.set(handle, treenode);\r\n\t\t\tvar map = this._openTreeNodesBackupMap;\r\n\t\t\tif (map != null && map.has(handle)) {\r\n\t\t\t\ttreenode.open();\r\n\t\t\t}\r\n\t\t}\r\n\t}, this);\r\n\r\n\t/*\r\n\t * Update entityToken registry so that we may quickly\r\n\t * find the treenode(s) based on this property.\r\n\t */\r\n\tvar reg = this._entityTokenRegistry;\r\n\tthis.getTokens(treenode).each(function (token) {\r\n\r\n\t\tif (reg.has(token)) {\r\n\t\t\treg.get(token).add(treenode);\r\n\t\t} else {\r\n\t\t\treg.set(token, new List([treenode]));\r\n\t\t}\r\n\t}, this);\r\n\r\n\tvar token = treenode.node.getEntityToken();\r\n\r\n\r\n\t/*\r\n\t * This will attempt to restore treenode selection when tree is refreshed.\r\n\t */\r\n\tvar focusnode = null;\r\n\tif (this.isLockedToEditor) {\r\n\r\n\t\t/*\r\n\t\t * Treenode re-focus should be determined by the\r\n\t\t * entityToken of the selected DockTabBinding.\r\n\t\t * Note that unlike the handle (the ElementKey), an\r\n\t\t * entityToken may occur multiple times in the same tree.\r\n\t\t */\r\n\t\tif (token == StageBinding.entityToken) {\r\n\t\t\tif (treenode.node.isTreeLockEnabled()) {\r\n\t\t\t\tfocusnode = treenode;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\t/*\r\n\t\t * Treenode gets focused when it matches a previously\r\n\t\t * unregistered, focused treenode.\r\n\t\t * @see {SystemTreeBinding#unRegisterTreeNodeBinding}\r\n\t\t */\r\n\t\tif (this._backupfocushandle != null) {\r\n\t\t\tif (this._backupfocushandle == treenode.node.getHandle()) {\r\n\t\t\t\tfocusnode = treenode;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * If found, focus the treenode.\r\n\t */\r\n\tif (focusnode != null) {\r\n\t\tthis.focusSingleTreeNodeBinding(focusnode);\r\n\t}\r\n}\r\n\r\n/**\r\n * Unregister treenode. If no selected treenodes are left after whatever operation\r\n * occurred, we empty the toolbar and contextmenu. This should be considered a\r\n * temporary hack until we implement serverside treeselection.\r\n * @overloads {TreeBinding#unRegisterTreeNodeBinding}\r\n * @param {SystemTreeNodeBinding} treeNodeBinding\r\n */\r\nSystemTreeBinding.prototype.unRegisterTreeNodeBinding = function (treenode) {\r\n\r\n\ttreenode.getHandles().each(function(handle) {\r\n\t\tthis._treeNodeBindings.del(handle);\r\n\t}, this);\r\n\r\n\t/*\r\n\t * Unregister from entityToken registry.\r\n\t */\r\n\tvar reg = this._entityTokenRegistry;\r\n\tthis.getTokens(treenode).each(function (token) {\r\n\r\n\t\tif (reg.has(token)) {\r\n\t\t\tvar list = reg.get(token);\r\n\t\t\tlist.del(treenode);\r\n\t\t\tif (!list.hasEntries()) {\r\n\t\t\t\treg.del(token);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.logger.fatal(\"SystemTreeBinding out of synch: unRegisterTreeNodeBinding\");\r\n\t\t\tif (Application.isDeveloperMode) {\r\n\t\t\t\tDialog.error(\"Attention Developer\", \"Tree is out of synch. Please reproduce this bug and file a report.\");\r\n\t\t\t}\r\n\t\t}\r\n\t}, this);\r\n\r\n\t/*\r\n\t * This relates to the treenode re-selection hack.\r\n\t * @see {SystemTreeBinding#registerTreeNodeBinding}\r\n\t */\r\n\tif (!this.isLockedToEditor) {\r\n\t\tif (treenode.isFocused && this._backupfocushandle == null) {\r\n\t\t\tthis._backupfocushandle = treenode.node.getHandle();\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tself._backupfocushandle = null;\r\n\t\t\t}, 200);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Refreshing treenodes count at zero?\r\n * @param {String} key\r\n */\r\nSystemTreeBinding.prototype._updateRefreshingTrees = function (key) {\r\n\r\n\tvar trees = this._refreshingTreeNodes;\r\n\r\n\tif (trees.hasEntries() && trees.has(key)) {\r\n\t\ttrees.del(key);\r\n\t\tif (!trees.hasEntries()) {\r\n\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\tBroadcastMessages.SYSTEMTREEBINDING_REFRESHED, this._refreshToken\r\n\t\t\t);\r\n\t\t\tthis._refreshToken = null;\r\n\t\t\tthis._attemptRestorableFocus();\r\n\r\n\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\tBroadcastMessages.SYSTEMTREEBINDING_REFRESHED_AFTER, { syncHandle: this.getSyncHandle() }\r\n\t\t\t);\r\n\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n* Update focused node based on selected Tab\r\n* @param {String} key\r\n*/\r\nSystemTreeBinding.prototype._updateFocusedNode = function () {\r\n\tif (!this._focusedTreeNodeBindings.hasEntries() && this._activePosition != SystemAction.activePositions.SelectorTree) {\r\n\t\tvar token = StageBinding.entityToken;\r\n\t\tif (token != null) {\r\n\t\t\tthis._focusTreeNodeByEntityToken(token);\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Enable contextmenu cut and paste?\r\n */\r\nSystemTreeBinding.prototype._computeClipboardSetup = function () {\r\n\r\n\tvar isCutAllowed = false;\r\n\tvar focusedBindings = this.getFocusedTreeNodeBindings();\r\n\tif (this._activePosition == SystemAction.activePositions.SelectorTree) {\r\n\t\tisCutAllowed = false;\r\n\t}\r\n\telse if (focusedBindings.hasEntries()) {\r\n\t\tisCutAllowed = true;\r\n\t\twhile (isCutAllowed && focusedBindings.hasNext()) {\r\n\t\t\tvar binding = focusedBindings.getNext();\r\n\t\t\tif (!binding.isDraggable) {\r\n\t\t\t\tisCutAllowed = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tSystemTreePopupBinding.isCutAllowed = isCutAllowed;\r\n}\r\n\r\n/**\r\n * Disabling refresh when clipboard is full. Otherwise, a refresh may cause tests\r\n * for treenode nesting to be corrupted; and parents can be moved to children nodes.\r\n * TODO: Fix nesting test instead?\r\n */\r\nSystemTreeBinding.prototype._computeRefreshSetup = function () {\r\n\r\n\tSystemTreePopupBinding.isRefreshAllowed = SystemTreeBinding.clipboard === null;\r\n}\r\n\r\n/**\r\n * Implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nSystemTreeBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tSystemTreeBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\t/**\r\n\t* Doublecheck that this tree is actually focused. Although if\r\n\t* the server transmits a refresh signal, this is not required.\r\n\t*/\r\n\tswitch (broadcast) {\r\n\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESH:\r\n\t\t\tif (arg != null || this.isFocused) { // arg is only provided when server is refreshing!\r\n\t\t\t\tthis._handleCommandBroadcast(broadcast, arg);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_CUT:\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_COPY:\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_PASTE:\r\n\t\t\tif (this.isFocused) {\r\n\t\t\t\tthis._handleCommandBroadcast(broadcast);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_COLLAPSEALL:\r\n\t\t\tthis.collapse(true);\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.DOCKTABBINDING_SELECT:\r\n\t\t\tif (this.isLockedToEditor) {\r\n\t\t\t\tvar tab = arg;\r\n\t\t\t\t//TODO: check this\r\n\t\t\t\tif (tab.getHandle() != \"Composite.Management.Explorer\") { // the tree dock!\r\n\t\t\t\t\tthis._handleDockTabSelect(tab);\r\n\t\t\t\t}\r\n\t\t\t\t// TODO: Othwise attempt restore focus!!!!!!!!!!!!!!!!!!!!!\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.STAGEDIALOG_OPENED:\r\n\t\t\tif (this.isLockedToEditor) {\r\n\t\t\t\tthis.blurSelectedTreeNodes();\r\n\t\t\t}\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED, { activePosition: this._activePosition });\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_FOCUS:\r\n\t\t\tif (StageBinding.perspectiveNode === this.perspectiveNode) {\r\n\t\t\t\tvar self = this, token = arg;\r\n\t\t\t\tsetTimeout(function() { // timeout to minimize freezing sensation\r\n\t\t\t\t\tif (token != null) {\r\n\t\t\t\t\t\tself._focusTreeNodeByEntityToken(token);\r\n\t\t\t\t\t}\r\n\t\t\t\t}, 250); // zero not always enough...\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * A tab was activated somewhere on screen. This should\r\n * update tree selection and thus toolbar actions.\r\n * @param {DockTabBinding} tab\r\n */\r\nSystemTreeBinding.prototype._handleDockTabSelect = function (tab) {\r\n\r\n\t/*\r\n\t * Is the activated tab visible on screen?\r\n\t */\r\n\tvar isVisible = tab.perspectiveNode == null;\r\n\tif (!isVisible) {\r\n\t\tisVisible = tab.perspectiveNode == this.perspectiveNode;\r\n\t}\r\n\r\n\t/*\r\n\t * If the tab was launched by the server, there is a chance we might\r\n\t * find a matching treenode.\r\n\t */\r\n\tif (isVisible) {\r\n\r\n\t\tif (tab.isExplorerTab) {\r\n\t\t\tvar token = this.getHandleToken();\r\n\t\t\tvar self = this;\r\n\t\t\tthis.setHandleToken(null);\r\n\t\t\tvar selectedTreeNode = this.getFocusedTreeNodeBindings().getFirst();\r\n\t\t\tif (selectedTreeNode && selectedTreeNode.node.getEntityToken() === token) {\r\n\t\t\t\tEventBroadcaster.broadcast(\r\n\t\t\t\t\tBroadcastMessages.SYSTEMTREENODEBINDING_FOCUS,\r\n\t\t\t\t\tselectedTreeNode\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tsetTimeout(function () { // timeout to minimize freezing sensation\r\n\t\t\t\t\tif (token != null) {\r\n\t\t\t\t\t\tself._focusTreeNodeByEntityToken(token);\r\n\t\t\t\t\t}\r\n\t\t\t\t}, 250); // zero not always enough...\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tthis.setHandleToken(tab.getEntityToken());\r\n\t\t}\r\n\r\n\t}\r\n}\r\n\r\nSystemTreeBinding.prototype.setHandleToken = function (token) {\r\n\r\n\tthis._handleToken = token;\r\n}\r\n\r\nSystemTreeBinding.prototype.getHandleToken = function () {\r\n\r\n\treturn this._handleToken;\r\n}\r\n\r\n\r\n/**\r\n * Focus the first encountered treenode with a given entityToken\r\n * in support of the lock-tree-to-editor feature.\r\n * @param {string} entityToken\r\n * @param {boolean} isSecondAttempt Discourage endless looping\r\n * @return\r\n */\r\nSystemTreeBinding.prototype._focusTreeNodeByEntityToken = function (entityToken, isSecondAttempt) {\r\n\r\n\t/*\r\n\t * Let's find the treenode to focues...\r\n\t */\r\n\tvar treenode = null;\r\n\r\n\t/*\r\n\t * Note that we simply select the first available treenode with the given\r\n\t * entityToken MARKED AS FOCUSABLE. This may not be the best, though...\r\n\t */\r\n\tif (this._entityTokenRegistry.has(entityToken)) {\r\n\t\tvar list = this._entityTokenRegistry.get(entityToken);\r\n\t\tlist.each(function (tn) {\r\n\t\t\tvar result = true;\r\n\t\t\tif (tn.node.isTreeLockEnabled()) {\r\n\t\t\t\ttreenode = tn;\r\n\t\t\t\tresult = false;\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t});\r\n\t\tif (treenode != null) {\r\n\r\n\t\t\tif (!treenode.isFocused || treenode.node.getEntityToken() !== entityToken) {\r\n\t\t\t\ttreenode.selectToken(entityToken);\r\n\t\t\t\tthis.focusSingleTreeNodeBinding(treenode, true);\r\n\t\t\t} else {\r\n\t\t\t\ttreenode.dispatchAction(TreeNodeBinding.ACTION_FOCUSED); // to reveal it!\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * But if no focusable treenode was found, we ask the server for more treenodes.\r\n\t */\r\n\tif (treenode == null && isSecondAttempt != true) {\r\n\r\n\t\tApplication.lock(this);\r\n\t\tStatusBar.busy();\r\n\r\n\t\t/*\r\n\t\t * We timeout to lock the GUI while tree is refreshed; this can take some time.\r\n\t\t */\r\n\t\tvar self = this;\r\n\t\tsetTimeout(function() {\r\n\t\t\tif (Binding.exists(self)) {\r\n\t\t\t\tself._fetchTreeForEntityToken(entityToken);\r\n\t\t\t\tself._focusTreeNodeByEntityToken(entityToken, true); // do it again!\r\n\t\t\t}\r\n\t\t\tApplication.unlock(self);\r\n\t\t\tStatusBar.clear();\r\n\t\t}, 0);\r\n\t} else if (treenode == null) {\r\n\t\tthis.getFocusedTreeNodeBindings().each(function(binding) {\r\n\t\t\tbinding.blur();\r\n\t\t});\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED, { activePosition: this._activePosition, syncHandle: this.getSyncHandle() });\r\n\t}\r\n}\r\n\r\n/**\r\n * Query the TreeService for a structure that exposes a given entityToken.\r\n * @param {string} entityToken\r\n */\r\nSystemTreeBinding.prototype._fetchTreeForEntityToken = function (entityToken) {\r\n\r\n\t/*\r\n\t* Summon fresh nodes from server.\r\n\t*/\r\n\tvar perspectiveEntityTokens = new List();\r\n\tif (this._activePosition == SystemAction.activePositions.SelectorTree) {\r\n\t\tvar rootTreeNodeBindings = this.getRootTreeNodeBindings();\r\n\t\twhile (rootTreeNodeBindings.hasNext()) {\r\n\t\t\tvar rootTreeNodeBinding = rootTreeNodeBindings.getNext();\r\n\t\t\tperspectiveEntityTokens.add(rootTreeNodeBinding.node.getEntityToken());\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tperspectiveEntityTokens.add(StageBinding.perspectiveNode.getEntityToken());\r\n\t}\r\n\r\n\twhile (perspectiveEntityTokens.hasNext()) {\r\n\t\tvar perspectiveEntityToken = perspectiveEntityTokens.getNext();\r\n\t\tvar openSystemNodes = this.getOpenSystemNodes();\r\n\t\tvar map = System.getInvisibleBranch(\r\n\t\t\tperspectiveEntityToken,\r\n\t\t\tentityToken,\r\n\t\t\topenSystemNodes\r\n\t\t);\r\n\r\n\t\t/*\r\n\t\t* If server goofed up, we quickly disable the lock-tree-to-editor feature.\r\n\t\t*/\r\n\t\tif (map == null) {\r\n\t\t\tthis.isLockedToEditor = false;\r\n\t\t\tif (Application.isDeveloperMode) {\r\n\t\t\t\tDialog.warning(\"Ouch!\",\r\n\t\t\t\t\t\"Because the web service failed, tree has disabled the lock-tree-to-editor \" +\r\n\t\t\t\t\t\"feature. Otherwise, re-focus would fire the error indefinitely. Please try again.\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t* Controversially, the TreeService exposes no nested tree\r\n\t\t\t* structure, so the parsing code can get a little complicated.\r\n\t\t\t*/\r\n\t\telse if (map.hasEntries()) {\r\n\r\n\t\t\tvar self = this;\r\n\t\t\tvar oldnodes = this._treeNodeBindings;\r\n\t\t\tvar newnodes = new Map();\r\n\r\n\t\t\t/*\r\n\t\t\t* Handy treenodebuilder function.\r\n\t\t\t* @param {TreeNodeBinding} treenode\r\n\t\t\t* @param {List<SystemNode>} list\r\n\t\t\t*/\r\n\t\t\tfunction fix(treenode, list) {\r\n\r\n\t\t\t\tif (!treenode.hasBeenOpened) { // true when a refresh is needed, even for old nodes...\r\n\t\t\t\t\tif (list.hasEntries()) {\r\n\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t* TODO: Since the oldnodes check is needed here,\r\n\t\t\t\t\t\t* do we risk fogging up the display order of nodes?\r\n\t\t\t\t\t\t*/\r\n\t\t\t\t\t\tlist.each(function (node) {\r\n\t\t\t\t\t\t\tif (!oldnodes.has(node.getHandle())) {\r\n\t\t\t\t\t\t\t\tvar newnode = SystemTreeNodeBinding.newInstance(node, self.bindingDocument);\r\n\t\t\t\t\t\t\t\tnewnodes.set(node.getHandle(), newnode);\r\n\t\t\t\t\t\t\t\ttreenode.add(newnode);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\ttreenode.attachRecursive();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttreenode.open(true); // open node (without causing a new refresh!)\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t* Iterate map, building treenodes. Fortunately,\r\n\t\t\t* each sequential entry in the map lists nodes that\r\n\t\t\t* must be appended to a *previously* build node...\r\n\t\t\t*/\r\n\t\t\tmap.each(function (handle, list) {\r\n\t\t\t\tif (oldnodes.has(handle)) {\r\n\t\t\t\t\tvar oldnode = oldnodes.get(handle);\r\n\t\t\t\t\tfix(oldnode, list);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (newnodes.has(handle)) {\r\n\t\t\t\t\t\tvar newnode = newnodes.get(handle);\r\n\t\t\t\t\t\tfix(newnode, list);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// we seem to have encountered a strange hole in the structure\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle tree command.\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nSystemTreeBinding.prototype._handleCommandBroadcast = function (broadcast, arg) {\r\n\r\n\tswitch (broadcast) {\r\n\r\n\t\t/*\r\n\t\t * Note that this broadcast can also be intercepted by the\r\n\t\t * {@link SystemPageBinding} in order to refresh the tree root.\r\n\t\t */\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_REFRESH:\r\n\r\n\t\t\t/*\r\n\t\t\t * If arg is present, it implies that MessageQueue invoked the refresh.\r\n\t\t\t * Otherwise the action was instantiated by the user (eg contextmenu).\r\n\t\t\t */\r\n\t\t\tvar token = arg;\r\n\t\t\tif (token != null) {\r\n\t\t\t\tthis._invokeServerRefresh(token);\r\n\t\t\t} else {\r\n\t\t\t\tthis._invokeManualRefresh();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t\t/*\r\n\t\t\t * TODO: support multiple selections!\r\n\t\t\t */\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_CUT:\r\n\t\t\tif (SystemTreeBinding.clipboard != null) {\r\n\t\t\t\tSystemTreeBinding.clipboard.hideDrag();\r\n\t\t\t}\r\n\t\t\tvar treenode = this.getFocusedTreeNodeBindings().getFirst();\r\n\t\t\tSystemTreeBinding.clipboardOperation = SystemTreePopupBinding.CMD_CUT;\r\n\t\t\tSystemTreeBinding.clipboard = treenode;\r\n\t\t\ttreenode.showDrag();\r\n\t\t\tbreak;\r\n\r\n\t\t\t/*\r\n\t\t\t * TODO: support multiple selections!\r\n\t\t\t */\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_COPY:\r\n\t\t\tvar treenode = this.getFocusedTreeNodeBindings().getFirst();\r\n\t\t\tSystemTreeBinding.clipboardOperation = SystemTreePopupBinding.CMD_COPY;\r\n\t\t\tSystemTreeBinding.clipboard = treenode;\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.SYSTEMTREEBINDING_PASTE:\r\n\t\t\tthis._handlePaste();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoke server refresh. This was probably caused by the MessageQueue.\r\n * @param {string} token\r\n */\r\nSystemTreeBinding.prototype._invokeServerRefresh = function (token) {\r\n\r\n\tif (token != null && token == \"null\") {\r\n\t\tif (Application.isDeveloperMode) {\r\n\t\t\talert(\"Saa har vi balladen.\");\r\n\t\t}\r\n\t}\r\n\r\n\tif (this._entityTokenRegistry.has(token)) {\r\n\r\n\t\tvar list = this._entityTokenRegistry.get(token).reset();\r\n\r\n\t\t/*\r\n\t\t * Broadcast instructs the MessageQueue to delay\r\n\t \t * action execution until tree is refreshed.\r\n\t \t */\r\n\t\tthis._refreshToken = token;\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, this._refreshToken);\r\n\r\n\t\twhile (list.hasNext()) {\r\n\t\t\tvar treenode = list.getNext();\r\n\t\t\tthis._refreshingTreeNodes.set(treenode.key, true);\r\n\r\n\t\t\t/*\r\n\t\t\t * Push to next thread in order to give MessageQueue a chance\r\n\t\t\t * to detect whether or not any trees are actually refreshing\r\n\t\t\t * (because if not, it needs to execute the next action now).\r\n\t\t\t */\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\ttreenode.refresh(true);\r\n\t\t\t}, 0);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {string} token\r\n */\r\nSystemTreeBinding.prototype.hasToken = function (token) {\r\n\r\n\treturn this._entityTokenRegistry.has(token)\r\n}\r\n\r\n\r\n/**\r\n * Invoke manual refresh. This was probably caused\r\n * by user clicking the contextmenu refresh item.\r\n * Note that we actually refresh the PARENT treenode.\r\n * @param {string} token\r\n */\r\nSystemTreeBinding.prototype._invokeManualRefresh = function () {\r\n\r\n\tvar treenode = this.getFocusedTreeNodeBindings().getFirst();\r\n\tif (treenode) {\r\n\t\tvar label = treenode.getLabel();\r\n\t\tvar parent = treenode.getAncestorBindingByLocalName(\"treenode\");\r\n\t\tif (parent) {\r\n\t\t\ttreenode = parent; // because the treenode itself may have changed!\r\n\t\t}\r\n\t\tthis._refreshToken = null;\r\n\t\tthis._refreshingTreeNodes.set(treenode.key, true);\r\n\t\tEventBroadcaster.broadcast(BroadcastMessages.SYSTEMTREEBINDING_REFRESHING, null);\r\n\t\tif (!StatusBar.state) {\r\n\t\t\tvar message = StringBundle.getString(\"ui\", \"Website.App.StatusBar.Refreshing\");\r\n\t\t\tStatusBar.busy(message, [label]);\r\n\t\t}\r\n\t\ttreenode.refresh();\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle paste.\r\n */\r\nSystemTreeBinding.prototype._handlePaste = function () {\r\n\r\n\tvar treenode = SystemTreeBinding.clipboard;\r\n\r\n\tif (treenode) {\r\n\r\n\t\t/*\r\n\t\t * TODO: ALLOW MULTIPLE!!!!\r\n\t\t */\r\n\t\tvar type = treenode.dragType;\r\n\t\tvar focused = this.getFocusedTreeNodeBindings().getFirst();\r\n\t\tif (focused.dragAccept) {\r\n\t\t\tif (focused.acceptor.isAccepting(type)) {\r\n\t\t\t\tthis._performPaste(focused);\r\n\t\t\t} else {\r\n\t\t\t\tDialog.message(\r\n\t\t\t\t\tStringBundle.getString(\"ui\", \"Website.Misc.Trees.DialogTitle.PasteTypeNotAllowed\"),\r\n\t\t\t\t\tStringBundle.getString(\"ui\", \"Website.Misc.Trees.DialogText.PasteTypeNotAllowed\")\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tDialog.message(\r\n\t\t\t\tStringBundle.getString(\"ui\", \"Website.Misc.Trees.DialogTitle.PasteNotAllowed\"),\r\n\t\t\t\tStringBundle.getString(\"ui\", \"Website.Misc.Trees.DialogText.PasteNotAllowed\")\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Perform paste (then refresh the MessageQueue).\r\n * @param {SystemTreeNodeBinding} treenode\r\n */\r\nSystemTreeBinding.prototype._performPaste = function (treenode) {\r\n\r\n\tvar self = this;\r\n\r\n\tfunction update() {\r\n\t\tMessageQueue.update();\r\n\t\tApplication.unlock(self);\r\n\t}\r\n\r\n\tif (treenode.node.hasDetailedDropSupport()) {\r\n\t\tif (treenode.node.hasChildren()) {\r\n\t\t\tvar argument = treenode.node.getChildren();\r\n\t\t\tDialog.invokeModal(SystemTreeBinding.URL_DIALOG_DETAILEDPASTE, {\r\n\t\t\t\thandleDialogResponse: function (response, result) {\r\n\t\t\t\t\tif (response == Dialog.RESPONSE_ACCEPT) {\r\n\t\t\t\t\t\tApplication.lock(self);\r\n\t\t\t\t\t\tvar position = result.get(\"switch\");\r\n\t\t\t\t\t\tvar index = result.get(\"sibling\");\r\n\t\t\t\t\t\tif (position == \"after\") {\r\n\t\t\t\t\t\t\tindex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar isAccept = treenode.accept(SystemTreeBinding.clipboard, index);\r\n\t\t\t\t\t\tif (isAccept) {\r\n\t\t\t\t\t\t\tSystemTreeBinding.clipboard = null;\r\n\t\t\t\t\t\t\tSystemTreeBinding.clipboardOperation = null;\r\n\t\t\t\t\t\t\tsetTimeout(update, 0);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tupdate();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, argument);\r\n\t\t} else {\r\n\t\t\tApplication.lock(self);\r\n\t\t\tvar isAccept = treenode.accept(SystemTreeBinding.clipboard, 0);\r\n\t\t\tif (isAccept) {\r\n\t\t\t\tSystemTreeBinding.clipboard = null;\r\n\t\t\t\tSystemTreeBinding.clipboardOperation = null;\r\n\t\t\t\tsetTimeout(update, 0);\r\n\t\t\t} else {\r\n\t\t\t\tupdate();\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tApplication.lock(self);\r\n\t\tvar isAccept = treenode.accept(SystemTreeBinding.clipboard, 0);\r\n\t\tif (isAccept) {\r\n\t\t\tSystemTreeBinding.clipboard = null;\r\n\t\t\tSystemTreeBinding.clipboardOperation = null;\r\n\t\t}\r\n\t\tupdate();\r\n\t}\r\n}\r\n\r\n/**\r\n * Focus the first treenode. This should only be called once.\r\n */\r\nSystemTreeBinding.prototype.selectDefault = function () {\r\n\tif (this._defaultTreeNode !== false) {\r\n\t\tvar defaultEntityToken = System.getDefaultEntityToken(this.perspectiveNode.getEntityToken());\r\n\t\tif (defaultEntityToken != null) {\r\n\t\t\tthis._focusTreeNodeByEntityToken(defaultEntityToken);\r\n\t\t} else if (this._defaultTreeNode) {\r\n\t\t\tthis._defaultTreeNode.focus();\r\n\t\t\tif (this._defaultTreeNode.isContainer && !this._defaultTreeNode.isOpen) {\r\n\t\t\t\tthis._defaultTreeNode.open();\r\n\t\t\t}\r\n\t\t\tthis._defaultTreeNode = null;\r\n\t\t} else {\r\n\t\t\tvar node = this.getDescendantBindingByType(TreeNodeBinding);\r\n\t\t\tif (node) {\r\n\t\t\t\tnode.focus();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Close tree (close root nodes and wipe their memory).\r\n * @overloads {TreeNodeBinding#collapse}\r\n * @param {boolean} isDestructive\r\n */\r\nSystemTreeBinding.prototype.collapse = function (isDestructive) {\r\n\r\n\tEventBroadcaster.broadcast(BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED, { activePosition: this._activePosition });\r\n\r\n\tif (isDestructive) {\r\n\t\tthis.blurSelectedTreeNodes();\r\n\t\tvar treenodes = this.getRootTreeNodeBindings();\r\n\t\ttreenodes.each(function (treenode) {\r\n\t\t\tif (treenode.isContainer && treenode.isOpen) {\r\n\t\t\t\ttreenode.close();\r\n\t\t\t\ttreenode.hasBeenOpened = false;\r\n\t\t\t\ttreenode.empty();\r\n\t\t\t}\r\n\t\t});\r\n\t} else {\r\n\t\tSystemTreeBinding.superclass.collapse.call(this);\r\n\t}\r\n}\r\n\r\n/**\r\n * Lock tree to editor?\r\n * @param {boolean} isLocked\r\n */\r\nSystemTreeBinding.prototype.setLockToEditor = function (isLocked) {\r\n\r\n\tif (isLocked != this.isLockedToEditor) {\r\n\t\tthis.isLockedToEditor = isLocked;\r\n\t\tif (isLocked) {\r\n\t\t\tEventBroadcaster.broadcast(BroadcastMessages.SYSTEMTREEBINDING_LOCKTOEDITOR);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get the list of all open nodes in this tree PLUS this tree node itself.\r\n * @list {List<SystemNode>}\r\n */\r\nSystemTreeBinding.prototype.getOpenSystemNodes = function () {\r\n\r\n\t/*\r\n\t* Add perspective node, ie. this tree (since the\r\n\t* perspective corresponds to this tree in the hierarchy).\r\n\t*/\r\n\tvar list = new List([StageBinding.perspectiveNode]);\r\n\r\n\tif (this._activePosition == SystemAction.activePositions.SelectorTree) {\r\n\t\tlist = new List();\r\n\t}\r\n\r\n\t/*\r\n\t* Add open treenodes.\r\n\t*/\r\n\tvar treenodes = this.getRootTreeNodeBindings();\r\n\ttreenodes.each(function (treenode) {\r\n\t\tvar opennodes = treenode.getOpenSystemNodes();\r\n\t\tif (opennodes != null && opennodes.hasEntries()) {\r\n\t\t\tlist.merge(opennodes);\r\n\t\t}\r\n\t\telse if (treenode.isOpen) {\r\n\t\t\tlist.add(treenode.node);\r\n\t\t}\r\n\r\n\t});\r\n\r\n\treturn list;\r\n};\r\n\r\n/**\r\n * @overloads {TreeBinding#focusSingleTreeNodeBinding}\r\n * @param {TreeNodeBinding} binding;\r\n */\r\nSystemTreeBinding.prototype.focusSingleTreeNodeBinding = function (binding) {\r\n\r\n\tSystemTreeBinding.superclass.focusSingleTreeNodeBinding.call(this, binding);\r\n\tif (binding != null) {\r\n\t\tthis._handleSystemTreeFocus();\r\n\t}\r\n};\r\n\r\n/**\r\n * Set Action Profile Group\r\n * @param {function}\r\n */\r\nSystemTreeBinding.prototype.setActionGroup = function (value) {\r\n\r\n\r\n\tif (value) {\r\n\t\tvar list = new List(value.split(\" \"));\r\n\t\tthis._actionGroup = {};\r\n\t\twhile (list.hasNext()) {\r\n\t\t\tthis._actionGroup[list.getNext()] = true;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n\r\n/**\r\n * Compile actionprofile based on the individual actionprofile of all focused treenodes.\r\n * In case of multiple focused treenodes, only SystemActions relevant for *all* focused\r\n * treenodes will be included in the result.\r\n * @return {Map<string><List<SystemAction>>}\r\n */\r\nSystemTreeBinding.prototype.getCompiledActionProfile = function () {\r\n\r\n\tvar result = new Map();\r\n\r\n\tvar focusedBinding = this.getFocusedTreeNodeBindings().getFirst();\r\n\r\n\tvar actionProfile = focusedBinding.node.getActionProfile();\r\n\r\n\tif (actionProfile != null) {\r\n\t\tvar self = this;\r\n\t\tactionProfile.each(\r\n\t\t\tfunction (groupid, list) {\r\n\t\t\t\tvar newList = new List();\r\n\t\t\t\tlist.each(function (systemAction) {\r\n\t\t\t\t\tif (systemAction.getActivePositions() & self._activePosition) {\r\n\t\t\t\t\t\tif (!self._actionGroup || self._actionGroup[systemAction.getGroupName()]) {\r\n\t\t\t\t\t\t\tnewList.add(systemAction);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tif (newList.hasEntries()) {\r\n\t\t\t\t\tresult.set(groupid, newList);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n\r\n\tresult.activePosition = this._activePosition;\r\n\r\n\t//TODO: remove using URI - obsolute\r\n\tvar propertyBag = focusedBinding.node.getPropertyBag();\r\n\tif (propertyBag && propertyBag.Uri && propertyBag.ElementType === \"application/x-composite-page\") {\r\n\t\tresult.Uri = propertyBag.Uri;\r\n\t}\r\n\t//TODO: remove using EnitityToken - node used\r\n\tresult.EnitityToken = focusedBinding.node.getEntityToken();\r\n\tresult.Node = focusedBinding.node;\r\n\r\n\treturn result;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/system/SystemTreeNodeBinding.js",
    "content": "SystemTreeNodeBinding.prototype = new TreeNodeBinding;\r\nSystemTreeNodeBinding.prototype.constructor = SystemTreeNodeBinding;\r\nSystemTreeNodeBinding.superclass = TreeNodeBinding.prototype;\r\n\r\nSystemTreeNodeBinding.ACTION_REFRESHED = \"systemtreenoderefreshed\";\r\nSystemTreeNodeBinding.ACTION_REFRESHED_YEAH = \"systemtreenoderefreshedyeah!\";\r\n\r\n/**\r\n * Max imported treenodes per request.\r\n * TODO: Implement this for real.\r\n * @type {int}\r\n */\r\nSystemTreeNodeBinding.MAX_CHILD_IMPORT = 10000; /* because not implemented! */\r\n\r\n/**\r\n * @extends {TreeNodeBinding}\r\n */\r\nfunction SystemTreeNodeBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SystemTreeNodeBinding\" );\r\n\r\n\t/**\r\n\t * Associates the treenode to the selected perspective.\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.perspectiveNode = null;\r\n\r\n\t/**\r\n\t * Flipped when the server opens the treenode.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isForcedOpen = false;\r\n\r\n\t/**\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.node = null;\r\n\r\n\t/**\r\n\t* @type {boolean}\r\n\t*/\r\n\tthis.autoExpand = false;\r\n}\r\n\r\n/**\r\n * @overloads {TreeNodeBinding#onBindingAttach}\r\n */\r\nSystemTreeNodeBinding.prototype.onBindingAttach = function () {\r\n\r\n\tthis.addActionListener ( SystemTreeNodeBinding.ACTION_REFRESHED );\r\n\tthis.subscribe ( BroadcastMessages.SYSTEMTREENODEBINDING_FORCE_OPEN );\r\n\r\n\t/*\r\n\t * Is container?\r\n\t *\r\n\tthis.isContainer = this.node.hasChildren ();\r\n\t*/\r\n\r\n\t/*\r\n\t * Is disabled?\r\n\t */\r\n\tthis.isDisabled = this.node.isDisabled ();\r\n\r\n\t/*\r\n\t * Label.\r\n\t */\r\n\tvar label = this.node.getLabel ();\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\r\n\t/*\r\n\t * Tooltip.\r\n\t */\r\n\tvar toolTip = this.node.getToolTip ();\r\n\tif ( toolTip ) {\r\n\t\tthis.setToolTip ( toolTip );\r\n\t}\r\n\r\n\t/*\r\n\t * Handle.\r\n\t */\r\n\tvar handle = this.node.getHandle ();\r\n\tif ( handle ) {\r\n\t\tthis.setHandle ( handle );\r\n\t}\r\n\r\n\t/*\r\n\t * Drag type and other stuff. All key-value pairs in the\r\n\t * propertybag object is assigned to element as attributes.\r\n\t */\r\n\tvar bag = this.node.getPropertyBag ();\r\n\tif ( bag ) {\r\n\t\tfor ( var key in bag ) {\r\n\t\t\tswitch ( key.toLowerCase ()) {\r\n\t\t\t\tcase \"id\" :\r\n\t\t\t\tcase \"key\" :\r\n\t\t\t\t\tthrow new Error ( \"Illegal propertybag key: \" + key );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault :\r\n\t\t\t\t\tthis.setProperty ( key, bag [ key ]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Invoke super method.\r\n\t */\r\n\tSystemTreeNodeBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\t/*\r\n\t * A sudden perspective awareness.\r\n\t */\r\n\tthis.perspectiveNode = this.containingTreeBinding.perspectiveNode;\r\n}\r\n\r\n/**\r\n * Initialize drag and drop.\r\n * @overloads {Binding#_initializeBindingDragAndDropFeatures}\r\n */\r\nSystemTreeNodeBinding.prototype._initializeBindingDragAndDropFeatures = function () {\r\n\r\n\t// Drag type.\r\n\tif ( this.node.hasDragType ()) {\r\n\t\tthis.setProperty (\r\n\t\t\t\"dragtype\",\r\n\t\t\tthis.node.getDragType ()\r\n\t\t);\r\n\t}\r\n\r\n\t// Drag accept.\r\n\tif ( this.node.hasDragAccept ()) {\r\n\t\tvar dragaccept = \"\";\r\n\t\tvar list = this.node.getDragAccept ();\r\n\t\twhile ( list.hasNext ()) {\r\n\t\t\tdragaccept += list.getNext ();\r\n\t\t\tif ( list.hasNext ()) {\r\n\t\t\t\tdragaccept += \" \";\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.setProperty (\r\n\t\t\t\"dragaccept\",\r\n\t\t\tdragaccept\r\n\t\t);\r\n\t}\r\n\r\n\tSystemTreeNodeBinding.superclass._initializeBindingDragAndDropFeatures.call ( this );\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {TreeNodeBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nSystemTreeNodeBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tSystemTreeNodeBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\t/*\r\n\t\t * TODO: consider this!..............................................\r\n\t\t */\r\n\t\tcase SystemTreeNodeBinding.ACTION_REFRESHED :\r\n\t\t\tif ( action.target == this ) { // TODO: specifically this .......\r\n\t\t\t\tif ( !this.isOpen ) {\r\n\t\t\t\t\tthis.hasBeenOpened = false;\r\n\t\t\t\t\taction.consume ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nSystemTreeNodeBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tSystemTreeNodeBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.SYSTEMTREENODEBINDING_FORCE_OPEN :\r\n\t\t\tif ( arg == this.node.getEntityToken ()) {\r\n\t\t\t\tif ( this.isContainer && !this.isOpen ) {\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Mark as forced opening.\r\n\t\t\t\t\t */\r\n\t\t\t\t\tthis._isForcedOpen = true;\r\n\t\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SYSTEMTREENODEBINDING_FORCING_OPEN, this );\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Push to next thread in order to give MessageQueue a chance\r\n\t\t\t\t\t * to detect whether or not any nodes are actually opening\r\n\t\t\t\t\t * (because if not, it needs to execute the next action now).\r\n\t\t\t\t\t */\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\tself.open ();\r\n\t\t\t\t\t}, 0 );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * The imageprofile is provided by the SystemNode assigned to this treenode.\r\n * @overwrites {TreeNodeBinding#_computeImageProfile}\r\n */\r\nSystemTreeNodeBinding.prototype._computeImageProfile = function () {}\r\n\r\n/**\r\n * Overloading {@link TreeNodeBinding#computeImage}\r\n * @return {string}\r\n */\r\nSystemTreeNodeBinding.prototype.computeImage = function () {\r\n\r\n\tvar result = null;\r\n\tvar profile = this.node.getImageProfile ();\r\n\tif ( profile ) {\r\n\t\tif ( this.isOpen ) {\r\n\t\t\tresult = profile.getActiveImage ();\r\n\t\t} else {\r\n\t\t\tresult = profile.getDefaultImage ();\r\n\t\t}\r\n\t}\r\n\tif ( !result ) {\r\n\t\tresult = SystemTreeNodeBinding.superclass.computeImage.call ( this );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Refresh when opened.\r\n * @overloads {TreeNodeBinding#open}\r\n * @param {boolean} isManaged If set to true, the tree will not refresh!\r\n */\r\nSystemTreeNodeBinding.prototype.open = function ( isManaged ) {\r\n\r\n\tvar wasOpened = this.isContainer && !this.isOpen;\r\n\tvar wasFresh = !this.hasBeenOpened;\r\n\r\n\tSystemTreeNodeBinding.superclass.open.call ( this );\r\n\r\n\tif ( wasOpened && ( wasFresh || SystemTreeBinding.HAS_NO_MEMORY ) && isManaged != true ) {\r\n\r\n\t\t/*\r\n\t\t * Fetch subtree from server.\r\n\t\t */\r\n\t\tthis.refresh ();\r\n\r\n\t\t/*\r\n\t\t * If forced open by server, notify the waiting MessageQueue.\r\n\t\t */\r\n\t\tif ( this._isForcedOpen ) {\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.SYSTEMTREENODEBINDING_FORCED_OPEN, this );\r\n\t\t\tthis._isForcedOpen = false;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Refreshing treenode content. This method is never executed for nodes\r\n * with !HasChildren. Method can be invoked as part of treenode opening\r\n * act, or when the server places a refresh signal on the MessageQueue.\r\n */\r\nSystemTreeNodeBinding.prototype.refresh = function () {\r\n\r\n\t// descendant treenodes already opened?\r\n\tvar branch = null;\r\n\tif (this.isContainer) {\r\n\t\tbranch = this.getOpenSystemNodes();\r\n\t}\r\n\r\n\t/*\r\n\t* Begin refresh...\r\n\t*/\r\n\tthis.isRefreshing = true;\r\n\tApplication.lock(this);\r\n\tStatusBar.busy();\r\n\r\n\t/*\r\n\t* We timeout to lock the GUI while tree\r\n\t* is refreshed; this can take some time.\r\n\t*/\r\n\tvar self = this;\r\n\tsetTimeout ( function () {\r\n\t\tif (Binding.exists(self)) {\r\n\t\t\tself._performRefresh(branch);\r\n\t\t\tApplication.unlock(self);\r\n\t\t} else {\r\n\t\t\tApplication.unlock(Application, true);\r\n\t\t}\r\n\t\tStatusBar.clear();\r\n\t}, 0);\r\n\r\n}\r\n\r\n/**\r\n * Perform refresh (isolated so that we can invoke on a timeout).\r\n * @param {List<SystemNode>} branch\r\n */\r\nSystemTreeNodeBinding.prototype._performRefresh = function (branch) {\r\n\r\n\t//TODO: Refactor this\r\n\tthis.activeBundles = new List();\r\n\tthis.getDescendantBindingsByType(SystemTreeNodeBinding).each(function (treenode) {\r\n\t\t//TODO refactor\r\n\t\tif (treenode.node.isMultiple()) {\r\n\t\t\tthis.activeBundles.add(treenode.node.getHandle());\r\n\t\t}\r\n\t},this);\r\n\r\n\t//this.empty ();\r\n\tif ( branch != null ) {\r\n\t\tthis._refreshBranch ( branch );\r\n\t} else {\r\n\t\tthis._refreshChildren ();\r\n\t}\r\n\r\n\tthis.isRefreshing = false;\r\n\r\n\tthis.activeBundles = null;\r\n\r\n\t/*\r\n\t * TODO: this is hacked! The ISCONTAINER state should be determined by the server!\r\n\t */\r\n\tthis.isContainer = DOMUtil.getElementsByTagName ( this.bindingElement, \"treenode\" ).item ( 0 ) != null;\r\n\tthis.updateClassNames ();\r\n\r\n\t/*\r\n\t * This will force any closed ancestor treenode to refresh when opened.\r\n\t * The action will be consumed by ancestor, so we need to dispatch yet\r\n\t * another action.\r\n\t */\r\n\tthis.dispatchAction ( SystemTreeNodeBinding.ACTION_REFRESHED );\r\n\r\n\t/*\r\n\t * This will inform the tree the we are finished,\r\n\t * which in turn will inform the MessageQueue.\r\n\t * TODO: Only on a MessageQueue-refresh?\r\n\t */\r\n\tthis.dispatchAction ( SystemTreeNodeBinding.ACTION_REFRESHED_YEAH );\r\n}\r\n\r\n/**\r\n * Import children only.\r\n */\r\nSystemTreeNodeBinding.prototype._refreshChildren = function () {\r\n\r\n\tvar buffer = new List ();\r\n\tvar children = this.node.getChildren();\r\n\r\n\tthis.empty ();\r\n\tif ( children.hasEntries ()) {\r\n\t\tthis._insertTreeNodesRegulated ( children );\r\n\t}\r\n}\r\n\r\n/**\r\n * Insert treenodes from a list of SystemNodes.\r\n * @param {List<SystemNode>} children\r\n */\r\nSystemTreeNodeBinding.prototype._insertTreeNodesRegulated = function ( children ) {\r\n\r\n\tvar count = 0;\r\n\tvar expandNodes = new List([]);\r\n\r\n\t/*\r\n\t * Constantly shortening the children list while\r\n\t * inserting treenodes. This will let us store\r\n\t * the remaining list in a buffer when max count\r\n\t * is reached.\r\n\t */\r\n\twhile ( children.hasEntries () && count <= SystemTreeNodeBinding.MAX_CHILD_IMPORT ) {\r\n\t\tvar treenode = SystemTreeNodeBinding.newInstance(\r\n\t\t\tchildren.extractFirst(),\r\n\t\t\tthis.bindingDocument\r\n\t\t);\r\n\t\tif (treenode.node.isMultiple()) {\r\n\t\t\ttreenode.node.getDatas().each(function (data) {\r\n\t\t\t\tif (this.activeBundles.has(data.ElementKey)) {\r\n\t\t\t\t\ttreenode.node.select(data.ElementKey);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}, this);\r\n\r\n\t\t}\r\n\r\n\t\ttreenode.autoExpand = this.autoExpand;\r\n\t\tthis.add(treenode);\r\n\t\ttreenode.attach();\r\n\t\tcount++;\r\n\r\n\t\t// Auto expand tree folders in selection dialogs, when only one folder can be expanded.\r\n\t\t// Expand last opened nodes\r\n\t\tif (this.autoExpand) {\r\n\t\t\tif (count == 1 && !children.hasEntries() || LocalStore.openedNodes.has(treenode.node)) {\r\n\t\t\t\texpandNodes.add(treenode);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif ( children.hasEntries ()) {\r\n\t\tthis._insertBufferTreeNode ( children );\r\n\t}\r\n\r\n\r\n\r\n\texpandNodes.each(function (node) {\r\n\t\tif (node.isContainer && !node.isOpen) {\r\n\t\t\tvar self = node;\r\n\t\t\tsetTimeout(function () {\r\n\t\t\t\tself.open();\r\n\t\t\t}, 0);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n\r\n\r\n/**\r\n * Insert buffer node. This will expand to a number of treenodes when navigated.\r\n * @param {List<SystemNode>} children\r\n */\r\nSystemTreeNodeBinding.prototype._insertBufferTreeNode = function ( children ) {\r\n\r\n\talert ( \"Max treenode count reached. This is not handled!\" );\r\n\talert ( \"TODO: SystemTreeNodeBinding#._insertBufferTreeNode\" );\r\n}\r\n\r\n/**\r\n * Import descendants with open parents. This is not regulated!\r\n * @param {List<SystemNode>} list A list of open SystemNodes...\r\n */\r\nSystemTreeNodeBinding.prototype._refreshBranch = function ( list ) {\r\n\r\n\tvar branch = this.node.getDescendantBranch ( list );\r\n\tif ( branch.hasEntries ()) {\r\n\t\tthis.XXX ( branch );\r\n\t}\r\n}\r\n\r\n/**\r\n * TODO: Rename this!\r\n * @param {List<SystemNode>} branch\r\n */\r\nSystemTreeNodeBinding.prototype.XXX = function ( branch ) {\r\n\r\n\tvar self = this;\r\n\tvar map = new Map ();\r\n\r\n\t/*\r\n\t * Note that the parsed branch may have \"holes\" in the structure. This implies\r\n\t * that not all may be positioned in the tree. Also note that this is NOT\r\n\t * regulated according to max child import restrictions!\r\n\t */\r\n\tthis.empty ();\r\n\tbranch.each(function (key, nodes) {\r\n\r\n\t\tvar bundles = new Map();\r\n\r\n\t\tif (nodes.hasEntries()) {\r\n\r\n\t\t\tnodes.each(function (node) {\r\n\r\n\t\t\t\tvar treenode = SystemTreeNodeBinding.newInstance(node, self.bindingDocument);\r\n\r\n\t\t\t\tif (treenode.node.isMultiple()) {\r\n\t\t\t\t\ttreenode.node.getDatas().each(function (data) {\r\n\t\t\t\t\t\tif (this.activeBundles.has(data.ElementKey)) {\r\n\t\t\t\t\t\t\ttreenode.node.select(data.ElementKey);\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}, this);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tmap.set ( node.getHandle (), treenode );\r\n\t\t\t\tif ( map.has ( key )) {\r\n\t\t\t\t\tvar parent = map.get ( key );\r\n\t\t\t\t\tparent.add ( treenode );\r\n\t\t\t\t\tparent.isOpen = true;\r\n\t\t\t\t\tparent.hasBeenOpened = true;\r\n\t\t\t\t\tnode.searchToken = parent.node.searchToken;\r\n\t\t\t\t} else if ( key == self.node.getHandle ()) {\r\n\t\t\t\t\tself.add ( treenode );\r\n\t\t\t\t\tnode.searchToken = self.node.searchToken;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Now there is a hole in the structure and the\r\n\t\t\t\t\t * SystemNode has no relevance in this context.\r\n\t\t\t\t\t * Maybe it was moved somewhere (cut paste scenario).\r\n\t\t\t\t\t */\r\n\t\t\t\t}\r\n\t\t\t}, this);\r\n\t\t}\r\n\t}, this);\r\n\r\n\tthis.attachRecursive ();\r\n\tbranch.dispose ();\r\n\tmap.dispose ();\r\n}\r\n\r\n/**\r\n * Get open descendants.\r\n * @list {List<SystemTreeNode>}\r\n */\r\nSystemTreeNodeBinding.prototype.getOpenDescendants = function () {\r\n\r\n\tvar crawler = new TreeCrawler ();\r\n\tvar result = new List ();\r\n\tcrawler.mode = TreeCrawler.MODE_GETOPEN;\r\n\tcrawler.crawl ( this.bindingElement, result );\r\n\tif ( result.hasEntries ()) { // exclude myself!\r\n\t\tresult.extractFirst ();\r\n\t}\r\n\tcrawler.dispose ();\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get the list of SystemNodes from all descandants. Including\r\n * myself in the result because the server needs to know me.\r\n * @list {List<SystemNode>}\r\n */\r\nSystemTreeNodeBinding.prototype.getOpenSystemNodes = function () {\r\n\r\n\tvar result = null;\r\n\tvar list = this.getOpenDescendants ();\r\n\r\n\tif ( list.hasEntries ()) {\r\n\t\tresult = new List ([ this.node ]); // include myself!\r\n\t\tlist.each ( function ( treenode ) {\r\n\t\t\tresult.add ( treenode.node );\r\n\t\t});\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Small trick to ensure that the treenode twisty will not\r\n */\r\nSystemTreeNodeBinding.prototype.updateClassNames = function () {\r\n\r\n\tif ( !this.isRefreshing ) {\r\n\t\tSystemTreeNodeBinding.superclass.updateClassNames.call ( this );\r\n\t}\r\n}\r\n\r\n/**\r\n * Accept dragged treenode.\r\n * @overwrites {TreeNodeBinding#acceptTreeNodeBinding}\r\n * @param {SystemTreeNodeBinding} binding\r\n * @param {int} index Optional (omit for drag and drop setup)\r\n */\r\nSystemTreeNodeBinding.prototype.acceptTreeNodeBinding = function ( binding, index ) {\r\n\r\n\tvar isCopy = ( SystemTreeBinding.clipboardOperation == SystemTreePopupBinding.CMD_COPY );\r\n\r\n\tif ( binding instanceof SystemTreeNodeBinding ) {\r\n\t\tif ( TreeService.ExecuteDropElementAction ) {\r\n\t\t\tTreeService.ExecuteDropElementAction (\r\n\t\t\t\tbinding.node.getData (),\r\n\t\t\t\tthis.node.getData (),\r\n\t\t\t\tindex ? index : this.containingTreeBinding.getDropIndex (),\r\n\t\t\t\tApplication.CONSOLE_ID,\r\n\t\t\t\tisCopy\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Broadcast entityToken on focus to support the \"lock tree to editor\" feature.\r\n * @overloads {TreeNodeBinding#invokeManagedFocus}\r\n */\r\nSystemTreeNodeBinding.prototype.invokeManagedFocus = function ( e ) {\r\n\r\n\tif ( !this.isFocused ) {\r\n\t\tSystemTreeNodeBinding.superclass.invokeManagedFocus.call ( this );\r\n\r\n\t\t/*\r\n\t\t * This broadcast is intercepted by the DockBinding\r\n\t\t * who then decides which corresponding tab to highlight.\r\n\t\t * @see {DockBinding#handleBroadcast}\r\n\t\t */\r\n\t\tvar tree = this.containingTreeBinding;\r\n\t\tif ( tree.isLockedToEditor ) {\r\n\t\t\tEventBroadcaster.broadcast (\r\n\t\t\t\tBroadcastMessages.SYSTEMTREENODEBINDING_FOCUS,\r\n\t\t\t\tthis\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Has children?\r\n * @overwrites {TreeNodeBinding#hasChildren}\r\n * @return {boolean}\r\n */\r\nSystemTreeNodeBinding.prototype.hasChildren = function () {\r\n\r\n\treturn this.node.hasChildren ();\r\n};\r\n\r\nSystemTreeNodeBinding.prototype.getHandles = function () {\r\n\r\n\treturn this.node.getHandles();\r\n}\r\n\r\n/**\r\n  * @param {string} entityToken\r\n */\r\nSystemTreeNodeBinding.prototype.selectToken = function (entityToken) {\r\n\r\n\tthis.node.selectByToken(entityToken);\r\n\tthis.isDisabled = this.node.isDisabled();\r\n\tthis.setLabel(this.node.getLabel());\r\n\tthis.setToolTip(this.node.getToolTip());\r\n\tthis.setImage(this.computeImage());\r\n\tthis.setHandle(this.node.getHandle());\r\n}\r\n\r\n/**\r\n * Get bound element attribute or EnityToken.\r\n * @overloads {Binding#getProperty}\r\n */\r\nSystemTreeNodeBinding.prototype.getProperty = function ( attname ) {\r\n\r\n\tif(attname == 'EntityToken' && this.node && this.node.getEntityToken()) {\r\n\t\treturn this.node.getEntityToken();\r\n\t}\r\n\r\n\treturn SystemTreeNodeBinding.superclass.getProperty.call ( this, attname );\r\n}\r\n\r\n/**\r\n * SystemTreeNodeBinding factory. Notice that we supply a {@link SystemNode} as argument here!\r\n * @param {SystemNode} node\r\n * @param {DOMDocument} ownerDocument\r\n * @return {SystemTreeNodeBinding}\r\n */\r\nSystemTreeNodeBinding.newInstance = function ( node, ownerDocument ) {\r\n\r\n\tvar treenode = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:treenode\", ownerDocument );\r\n\tvar binding = UserInterface.registerBinding ( treenode, SystemTreeNodeBinding );\r\n\tbinding.node = node;\r\n\treturn binding;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/system/SystemTreePopupBinding.js",
    "content": "﻿SystemTreePopupBinding.prototype = new PopupBinding;\r\nSystemTreePopupBinding.prototype.constructor = SystemTreePopupBinding;\r\nSystemTreePopupBinding.superclass = PopupBinding.prototype;\r\n\r\nSystemTreePopupBinding.CMD_CUT = \"cut\";\r\nSystemTreePopupBinding.CMD_COPY = \"copy\";\r\nSystemTreePopupBinding.CMD_PASTE = \"paste\";\r\nSystemTreePopupBinding.CMD_REFRESH = \"refresh\";\r\n\r\n/**\r\n * @type {boolean}\r\n */\r\nSystemTreePopupBinding.isCutAllowed = false;\r\nSystemTreePopupBinding.isRefreshAllowed = true;\r\n\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SystemTreePopupBinding() {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger(\"SystemTreePopupBinding\");\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._currentProfileKey = null;\r\n\r\n\t/**\r\n\t * @type {object}\r\n\t */\r\n\tthis._actionProfile = null;\r\n\r\n\t/**\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis._node = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._keepBundleState = false;\r\n\r\n\t/**\r\n\t * @type {TreeNodeBinding}\r\n\t */\r\n\tthis.selectedTreeNodeBinding = null;\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nSystemTreePopupBinding.prototype.onBindingRegister = function () {\r\n\r\n\tSystemTreePopupBinding.superclass.onBindingRegister.call(this);\r\n\tthis.subscribe(BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED);\r\n\tthis.addActionListener(MenuItemBinding.ACTION_COMMAND, this);\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nSystemTreePopupBinding.prototype.onBindingAttach = function () {\r\n\r\n\tSystemTreePopupBinding.superclass.onBindingAttach.call(this);\r\n\tthis._indexMenuContent();\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nSystemTreePopupBinding.prototype.handleBroadcast = function (broadcast, arg) {\r\n\r\n\tSystemTreePopupBinding.superclass.handleBroadcast.call(this, broadcast, arg);\r\n\r\n\tswitch (broadcast) {\r\n\t\tcase BroadcastMessages.SYSTEM_ACTIONPROFILE_PUBLISHED:\r\n\t\t\tif (arg != null && arg.actionProfile != null) {\r\n\t\t\t\t//TODO: refactor with updating API\r\n\t\t\t\tthis._node = arg.actionProfile.Node;\r\n\t\t\t\tthis._actionProfile = arg.actionProfile;\r\n\t\t\t} else {\r\n\t\t\t\tthis._currentProfileKey = null;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @see {SystemToolbarBinding#_getProfileKey}\r\n * @return {string}\r\n */\r\nSystemTreePopupBinding.prototype._getProfileKey = SystemToolBarBinding.prototype._getProfileKey\r\n\r\n/**\r\n * @overloads {PopupBinding#show}\r\n */\r\nSystemTreePopupBinding.prototype.show = function () {\r\n\r\n\t/*\r\n\t * Build content\r\n\t */\r\n\tvar key = this._getProfileKey();\r\n\r\n\tif (key != this._currentProfileKey) {\r\n\t\tthis.disposeContent();\r\n\t\tthis.constructContent();\r\n\t\tthis._currentProfileKey = key;\r\n\t}\r\n\r\n\tthis._setupClipboardItems();\r\n\tthis._setupRefreshItem();\r\n\r\n\t/*\r\n\t * Show.\r\n\t */\r\n\tSystemTreePopupBinding.superclass.show.call(this);\r\n}\r\n\r\n/**\r\n * Setup clipboard operation menuitems.\r\n */\r\nSystemTreePopupBinding.prototype._setupClipboardItems = function () {\r\n\r\n\tvar cut = this.getMenuItemForCommand(SystemTreePopupBinding.CMD_CUT);\r\n\tvar copy = this.getMenuItemForCommand(SystemTreePopupBinding.CMD_COPY);\r\n\tvar paste = this.getMenuItemForCommand(SystemTreePopupBinding.CMD_PASTE);\r\n\r\n\tcut.setDisabled(!SystemTreePopupBinding.isCutAllowed);\r\n\tcopy.setDisabled(!SystemTreePopupBinding.isCutAllowed);\r\n\tpaste.setDisabled(SystemTreeBinding.clipboard == null);\r\n}\r\n\r\n/**\r\n * Disable refresh on ghosted nodes.\r\n */\r\nSystemTreePopupBinding.prototype._setupRefreshItem = function () {\r\n\r\n\tvar refresh = this.getMenuItemForCommand(SystemTreePopupBinding.CMD_REFRESH);\r\n\trefresh.setDisabled(!SystemTreePopupBinding.isRefreshAllowed);\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {PopupBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nSystemTreePopupBinding.prototype.handleAction = function (action) {\r\n\r\n\tSystemTreePopupBinding.superclass.handleAction.call(this, action)\r\n\r\n\tswitch (action.type) {\r\n\r\n\t\t/*\r\n\t\t * Note to self: The first part is duplicated by SystemToolBarBinding!\r\n\t\t */\r\n\t\tcase MenuItemBinding.ACTION_COMMAND:\r\n\t\t\tvar menuitemBinding = action.target;\r\n\t\t\tvar systemAction = menuitemBinding.associatedSystemAction;\r\n\r\n\t\t\tif (systemAction) {\r\n\t\t\t\tSystemAction.invoke(systemAction, this._node);\r\n\r\n\t\t\t\tif (this._keepBundleState) {\r\n\t\t\t\t\tvar bundleName = systemAction.getBundleName();\r\n\t\t\t\t\tif (bundleName != null) {\r\n\t\t\t\t\t\tLocalStorage.set(ToolBarComboButtonBinding.STORAGE_PREFFIX + bundleName, systemAction.getHandle());\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tvar cmd = menuitemBinding.getProperty(\"cmd\");\r\n\t\t\t\tif (cmd) {\r\n\t\t\t\t\tthis._handleCommand(cmd);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Clean current profile key\r\n\t\t\tthis._currentProfileKey = null;\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle command.\r\n * @param {string} cmd\r\n */\r\nSystemTreePopupBinding.prototype._handleCommand = function (cmd) {\r\n\r\n\tvar broadcast = null;\r\n\r\n\tswitch (cmd) {\r\n\t\tcase SystemTreePopupBinding.CMD_CUT:\r\n\t\t\tbroadcast = BroadcastMessages.SYSTEMTREEBINDING_CUT;\r\n\t\t\tbreak;\r\n\t\tcase SystemTreePopupBinding.CMD_COPY:\r\n\t\t\tbroadcast = BroadcastMessages.SYSTEMTREEBINDING_COPY;\r\n\t\t\tbreak;\r\n\t\tcase SystemTreePopupBinding.CMD_PASTE:\r\n\t\t\tbroadcast = BroadcastMessages.SYSTEMTREEBINDING_PASTE;\r\n\t\t\tbreak;\r\n\t\tcase SystemTreePopupBinding.CMD_REFRESH:\r\n\t\t\tbroadcast = BroadcastMessages.SYSTEMTREEBINDING_REFRESH;\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (broadcast) { // allows the popup to close\r\n\t\tsetTimeout(function () {\r\n\t\t\tEventBroadcaster.broadcast(broadcast);\r\n\t\t}, 0);\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispose content; except clipboardoperations.\r\n */\r\nSystemTreePopupBinding.prototype.disposeContent = function () {\r\n\r\n\tvar members = new List(\r\n\t\tDOMUtil.getElementsByTagName(this.bindingElement, \"menugroup\")\r\n\t).reverse();\r\n\twhile (members.hasNext()) {\r\n\t\tvar binding = UserInterface.getBinding(members.getNext());\r\n\t\tif (!binding.getProperty(\"rel\")) {\r\n\t\t\tbinding.dispose();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Construct content.\r\n */\r\nSystemTreePopupBinding.prototype.constructContent = function () {\r\n\r\n\tif (this._actionProfile != null) {\r\n\r\n\t\tvar doc = this.bindingDocument;\r\n\t\tvar groups = new List();\r\n\t\tvar self = this;\r\n\r\n\t\tvar bundles = new Map();\r\n\r\n\t\tthis._actionProfile.each(function (group, list) {\r\n\t\t\tvar groupBinding = MenuGroupBinding.newInstance(doc);\r\n\t\t\tlist.each(function (action) {\r\n\r\n\t\t\t\tvar menuItemBinding = self.getMenuItemBinding(action);\r\n\r\n\t\t\t\tvar bundleName = action.getBundleName();\r\n\t\t\t\tif (bundleName) {\r\n\t\t\t\t\tif (bundles.has(bundleName)) {\r\n\r\n\t\t\t\t\t\tvar bundleMenuItemBinding = bundles.get(bundleName);\r\n\t\t\t\t\t\tif (bundleMenuItemBinding.getChildBindingByType(MenuPopupBinding) == null) {\r\n\t\t\t\t\t\t\tbundleMenuItemBinding.setProperty(\"hasaction\", true);\r\n\t\t\t\t\t\t\tvar popup = MenuPopupBinding.newInstance(doc);\r\n\t\t\t\t\t\t\tvar body = popup.add(MenuBodyBinding.newInstance(doc));\r\n\t\t\t\t\t\t\tvar group = body.add(MenuGroupBinding.newInstance(doc));\r\n\t\t\t\t\t\t\tbundleMenuItemBinding.add(popup);\r\n\t\t\t\t\t\t\tif (this._keepBundleState || bundleMenuItemBinding.isDisabled) {\r\n\t\t\t\t\t\t\t\tgroup.add(self.getMenuItemBinding(bundleMenuItemBinding.associatedSystemAction));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar bundleGroupMenuBinding = bundleMenuItemBinding.getDescendantBindingByType(MenuGroupBinding);\r\n\t\t\t\t\t\tif (bundleGroupMenuBinding) {\r\n\t\t\t\t\t\t\tbundleGroupMenuBinding.add(menuItemBinding);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tgroupBinding.add(menuItemBinding);\r\n\t\t\t\t\t\tbundles.set(bundleName, menuItemBinding);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tgroupBinding.add(menuItemBinding);\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t}, this);\r\n\t\t\tgroups.add(groupBinding);\r\n\t\t}, this);\r\n\r\n\t\t/*\r\n\t\t * Build in reverse order, so that clipboardoperations appear last.\r\n\t\t * Remember that clipboard menuitems has been hardcoded into menu.\r\n\t\t */\r\n\t\tgroups.reverse();\r\n\t\twhile (groups.hasNext()) {\r\n\t\t\tthis._bodyBinding.addFirst(groups.getNext());\r\n\t\t}\r\n\t\tthis._bodyBinding.attachRecursive();\r\n\r\n\t\tbundles.each(function (bundleName, bundleMenuItemBinding) {\r\n\t\t\tif (bundleMenuItemBinding.isMenuContainer) {\r\n\t\t\t\tif (this._keepBundleState || bundleMenuItemBinding.isDisabled) {\r\n\r\n\t\t\t\t\tvar bundleMenuItemsBinding = bundleMenuItemBinding.getDescendantBindingsByType(MenuItemBinding);\r\n\t\t\t\t\tvar latestBundleMenuItem = null;\r\n\r\n\t\t\t\t\tif (this._keepBundleState) {\r\n\t\t\t\t\t\tvar latestBundleHandle = LocalStorage.get(ToolBarComboButtonBinding.STORAGE_PREFFIX + bundleName);\r\n\t\t\t\t\t\tbundleMenuItemsBinding.each(function (menuItemBinding) {\r\n\t\t\t\t\t\t\tif (menuItemBinding.associatedSystemAction && menuItemBinding.associatedSystemAction.getHandle() === latestBundleHandle && !menuItemBinding.isDisabled) {\r\n\t\t\t\t\t\t\t\tlatestBundleMenuItem = menuItemBinding;\r\n\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (latestBundleMenuItem == null) {\r\n\t\t\t\t\t\tbundleMenuItemsBinding.each(function (menuItemBinding) {\r\n\t\t\t\t\t\t\tif (!menuItemBinding.isDisabled) {\r\n\t\t\t\t\t\t\t\tlatestBundleMenuItem = menuItemBinding;\r\n\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (latestBundleMenuItem == null) {\r\n\t\t\t\t\t\tlatestBundleMenuItem = bundleMenuItemsBinding.getFirst();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.setSystemAction(bundleMenuItemBinding, latestBundleMenuItem.associatedSystemAction);\r\n\t\t\t\t\tBinding.prototype.hide.call(latestBundleMenuItem);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, this);\r\n\r\n\t}\r\n}\r\n\r\n/**\r\n * @see {NavigatorToolBarBinding#getToolBarButtonBinding}\r\n * @param {SystemAction} action\r\n * @return {MenuItemBinding}\r\n */\r\nSystemTreePopupBinding.prototype.getMenuItemBinding = function (action) {\r\n\r\n\tvar binding = MenuItemBinding.newInstance(this.bindingDocument);\r\n\tSystemTreePopupBinding.prototype.setSystemAction.call(this, binding, action);\r\n\r\n\treturn binding;\r\n}\r\n\r\nSystemTreePopupBinding.prototype.setSystemAction = function (binding, action) {\r\n\tvar label = action.getLabel();\r\n\tvar tooltip = action.getToolTip();\r\n\tvar image = action.getImage();\r\n\tvar ximage = action.getDisabledImage();\r\n\tvar isCheckbox = action.isCheckBox();\r\n\r\n\tif (label) {\r\n\t\tbinding.setLabel(label);\r\n\t}\r\n\tif (tooltip) {\r\n\t\tbinding.setToolTip(tooltip);\r\n\t}\r\n\tif (image) {\r\n\t\tbinding.imageProfile = new ImageProfile({\r\n\t\t\timage: image,\r\n\t\t\timageDisabled: ximage\r\n\t\t});\r\n\t}\r\n\tif (isCheckbox) {\r\n\t\tbinding.setType(MenuItemBinding.TYPE_CHECKBOX);\r\n\t\tif (action.isChecked()) {\r\n\t\t\tbinding.check(true);\r\n\t\t} else {\r\n\t\t\tbinding.uncheck(true);\r\n\t\t}\r\n\t}\r\n\tif (action.isDisabled()) {\r\n\t\tbinding.disable();\r\n\t} else if (binding.isDisabled) {\r\n\t\tbinding.enable();\r\n\t}\r\n\r\n\t/*\r\n\t * Stamp the action as a property on the menuitem\r\n\t * so that we can retrieve it when the item is clicked.\r\n\t */\r\n\tbinding.associatedSystemAction = action;\r\n}\r\n\r\n/**\r\n * @overwrites {PopupBinding#snapToMouse}\r\n * @param {MouseEvent} e\r\n */\r\nSystemTreePopupBinding.prototype.snapToMouse = function (e) {\r\n\r\n\tvar node = e.target ? e.target : e.srcElement;\r\n\tvar name = DOMUtil.getLocalName(node);\r\n\tvar binding = null;\r\n\r\n\tif (name != \"tree\") {\r\n\t\tswitch (name) {\r\n\t\t\tcase \"treenode\":\r\n\t\t\t\t// visually empty space - this should not open the popup!\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tnode = DOMUtil.getAncestorByLocalName(\"treenode\", node);\r\n\t\t\t\tif (node != null) {\r\n\t\t\t\t\tbinding = UserInterface.getBinding(node);\r\n\t\t\t\t\tif (binding.isDisabled) { // no contextmenu for disabled treenodes\r\n\t\t\t\t\t\tbinding = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (binding != null && binding.node != null && binding.node.getActionProfile() != null) {\r\n\r\n\t\t\t/*\r\n\t\t\t * This timeout will allow a right-click to focus the treenode,\r\n\t\t\t * triggering a NEW action profile publish, before we show the menu.\r\n\t\t\t * OOPS: Internet Explorer looses track of the e argument... what to do?\r\n\t\t\t *\r\n\t\t\tvar self = this;\r\n\t\t\tsetTimeout ( function () {\r\n\t\t\t\tSystemTreePopupBinding.superclass.snapToMouse.call ( self, e );\r\n\t\t\t}, 0 );\r\n\t\t\t*/\r\n\r\n\t\t\tSystemTreePopupBinding.superclass.snapToMouse.call(this, e);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/tabboxes/TabBinding.js",
    "content": "TabBinding.prototype = new Binding;\r\nTabBinding.prototype.constructor = TabBinding;\r\nTabBinding.superclass = Binding.prototype;\r\n\r\nTabBinding.ACTION_SELECTED = \"tabselected\";\r\nTabBinding.ACTION_UNSELECTED = \"tabunselected\";\r\nTabBinding.NODENAME_TABBOX = \"tabbox\";\r\n\r\n/**\r\n * @class\r\n * TabBinding.\r\n */\r\nfunction TabBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TabBinding\" );\r\n\t\r\n\t/**\r\n\t * This property is set by the {@link TabBoxBinding}.\r\n\t * @type {string}\r\n\t */\r\n\tthis.tabboxkey = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isSelected\t= false;\r\n\t\r\n\t/**\r\n\t * @type {LabelBinding}\r\n\t */\r\n\tthis.labelBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {TabBoxBinding}\r\n\t * @private\r\n\t */\r\n\tthis.containingTabBoxBinding = null;\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @type {Map<string><boolean>}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ DocumentCrawler.ID, FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTabBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TabBinding]\";\r\n}\r\n\r\n/**\r\n * Serialize binding.\r\n * @return {HashMap<string><object>}\r\n */\r\nTabBinding.prototype.serialize = function () {\r\n\t\r\n\tvar result = TabBinding.superclass.serialize.call ( this );\r\n\tif ( result ) {\r\n\t\tresult.label = this.getLabel ();\r\n\t\tresult.image = this.getImage ();\r\n\t\tresult.tooltip = this.getToolTip ();\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Dispatching action to initialize containing tabboxbinding.\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nTabBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tTabBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.defaultElementPosition = DOMUtil.getComputedStyle ( this.bindingElement, \"position\" );\r\n\tthis.defaultElementLeft = DOMUtil.getComputedStyle ( this.bindingElement, \"left\" );\r\n\tthis.containingTabBoxBinding = this.getAncestorBindingByType ( TabBoxBinding );\r\n\tthis.buildDOMContent ();\r\n\tthis.assignDOMEvents ();\r\n\tthis.dispatchAction ( Binding.ACTION_ATTACHED );\r\n\t\r\n\tif ( this.getProperty ( \"selected\" ) == true ) {\r\n\t\tthis.containingTabBoxBinding.select ( this, true );\r\n\t}\t\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nTabBinding.prototype.buildDOMContent = function () {\r\n\r\n\tvar image \t\t= this.bindingElement.getAttribute ( \"image\" );\r\n\tvar label \t\t= this.bindingElement.getAttribute ( \"label\" );\r\n\tvar tooltip \t= this.bindingElement.getAttribute ( \"tooltip\" );\r\n\r\n\t/*\r\n\t * Assign default classname.\r\n\t */\r\n\tthis.bindingElement.className = \"default\";\r\n\r\n\tthis.labelBinding = LabelBinding.newInstance ( this.bindingDocument );\r\n\tthis.shadowTree.labelBinding = this.labelBinding;\r\n\tthis.labelBinding.attachClassName ( \"tablabel\" );\r\n\tthis.add ( this.labelBinding );\r\n\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\tif ( image ) {\r\n\t\tthis.setImage ( image );\r\n\t}\r\n\tif ( tooltip ) {\r\n\t\tthis.setToolTip ( tooltip );\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {string} string\r\n */\r\nTabBinding.prototype.setImage = function ( url ) {\r\n\t\r\n\tthis.setProperty ( \"image\", url );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setImage ( \r\n\t\t\turl\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nTabBinding.prototype.getImage = function () {\r\n\r\n\treturn this.getProperty ( \"image\" );\r\n}\r\n\r\n/**\r\n * @param {string} label\r\n */\r\nTabBinding.prototype.setLabel = function ( label ) {\r\n\r\n\tif ( label != null ) {\r\n\t\tthis.setProperty ( \"label\", label );\t\r\n\t\tif ( this.isAttached ) {\r\n\t\t\tthis.labelBinding.setLabel ( label )\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nTabBinding.prototype.getLabel = function () {\r\n\r\n\treturn this.getProperty ( \"label\" );\r\n}\r\n\r\n/**\r\n * @param {string} tooltip\r\n */\r\nTabBinding.prototype.setToolTip = function ( tooltip ) {\r\n\r\n\tif ( tooltip ) {\r\n\t\tthis.setProperty ( \"tooltip\", tooltip );\t\r\n\t\tif ( this.isAttached ) {\r\n\t\t\tthis.labelBinding.setToolTip ( tooltip )\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nTabBinding.prototype.getToolTip = function () {\r\n\r\n\treturn this.getProperty ( \"tooltip\" );\r\n}\r\n\r\n/**\r\n * Assigning DOM events.\r\n */\r\nTabBinding.prototype.assignDOMEvents = function () {\r\n\t\r\n\tthis.addEventListener ( DOMEvents.MOUSEDOWN );\r\n\tthis.addEventListener ( DOMEvents.MOUSEENTER );\r\n\tthis.addEventListener ( DOMEvents.MOUSELEAVE );\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}.\r\n * @overlads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nTabBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tTabBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tif ( !this.isSelected ) {\r\n\t\r\n\t\tvar isAbort = false;\r\n\t\tif ( Client.isMozilla == true ) {\r\n\t\t\t/*\r\n\t\t\t * something must be done!\r\n\t\t\tvar related = e.relatedTarget;\r\n\t\t\tvar current = e.currentTarget;\r\n\t\t\tthis.logger.debug ( current.parentNode == related );\r\n\t\t\t*/\r\n\t\t}\t\r\n\t\tif ( !isAbort ) {\r\n\t\t\tswitch ( e.type ) {\r\n\t\t\t\tcase DOMEvents.MOUSEENTER :\r\n\t\t\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\t\t\tif ( !this.isSelected ) {\r\n\t\t\t\t\t\tthis.bindingElement.className = \"hover\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSELEAVE :\r\n\t\t\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\t\t\tif ( !this.isSelected ) {\r\n\t\t\t\t\t\tthis.bindingElement.className = \"default\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\t\t\tif ( !DOMEvents.isRightButton ( e )) {\r\n\t\t\t\t\t\tthis.containingTabBoxBinding.select ( this );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Select tab. This method should only be invoked by the {@link TabBoxBinding}.\r\n * TODO: Rename to invokeManagedSelect\r\n */\r\nTabBinding.prototype.select = function ( isManaged ) {\r\n\r\n\tthis.show (); // here?\r\n\tthis.isSelected = true;\r\n\tthis.setProperty ( \"selected\", true );\r\n\tthis.bindingElement.className = \"selected\";\r\n}\r\n\r\n/**\r\n * Unselect tab. This method should only be invoked by the {@link TabBoxBinding}.\r\n * TODO: Rename to invokeManagedUnselect\r\n */\r\nTabBinding.prototype.unselect = function () {\r\n\r\n\tthis.isSelected = false;\r\n\tthis.deleteProperty ( \"selected\" );\r\n\tthis.bindingElement.className = \"default\";\r\n}\r\n\r\n/**\r\n * @param {boolean} isHighlight\r\n */\r\nTabBinding.prototype.highlight = function (isHighlight) {\r\n\tif (isHighlight) {\r\n\t\tthis.shadowTree.labelBinding.attachClassName(\"highlighted\");\r\n\t} else {\r\n\t\tthis.shadowTree.labelBinding.detachClassName(\"highlighted\");\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide tab. Notice that we cannot simply use \"display:none\" because we need access \r\n * to the offsetWidth property when managing tabstrip layout. Accessing style property \r\n * directly instead of assigning a CSS classname is preferred because its faster.\r\n * @overwrites {Binding#hide}\r\n */\r\nTabBinding.prototype.hide = function () {\r\n\r\n\tif ( this.isVisible ) {\r\n\t\tthis.bindingElement.style.position = \"absolute\";\r\n\t\tthis.bindingElement.style.left = \"-1000px\";\r\n\t\tthis.isVisible = false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Show tab. \r\n * @overwrites {Binding#show}\r\n */\r\nTabBinding.prototype.show = function () {\r\n\r\n\tif ( !this.isVisible ) {\r\n\t\tthis.bindingElement.style.position = this.defaultElementPosition;\r\n\t\tthis.bindingElement.style.left = this.defaultElementLeft;\r\n\t\tthis.isVisible = true;\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * TabBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TabBinding}\r\n */\r\nTabBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:tab\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, TabBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/tabboxes/TabBoxBinding.js",
    "content": "TabBoxBinding.prototype = new FlexBoxBinding;\r\nTabBoxBinding.prototype.constructor = TabBoxBinding;\r\nTabBoxBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nTabBoxBinding.ASSOCIATION_KEY \t= \"tabboxkey\";\r\n\r\nTabBoxBinding.ACTION_ATTACHED\t= \"tabbox attached\";\r\nTabBoxBinding.ACTION_SELECTED \t= \"tabbox selected\";\r\nTabBoxBinding.ACTION_UNSELECTED = \"tabbox unselected\";\r\nTabBoxBinding.ACTION_UPDATED \t= \"tabbox updated\";\r\nTabBoxBinding.UPDATE_ORDINAL\t= \"tabbox ordinalupdate\";\r\nTabBoxBinding.UPDATE_ATTACH\t\t= \"tabbox attachupdate\";\r\nTabBoxBinding.UPDATE_DETACH\t\t= \"tabbox detachupdate\";\r\n\r\nTabBoxBinding.INVALID_TAB_IMAGE = \"${icon:error}\";\r\nTabBoxBinding.BALLOON_TAB_IMAGE = \"${icon:balloon}\";\r\n\r\n/**\r\n * Setup keyboard navigation: Advance tab selection on an inferred current  \r\n * tabbox by pressing CTRL + TAB and hold SHIFT to travel backwards. \r\n * Any tabbox will register as current when: \r\n *     The onBindingAttach method is invoked\r\n *     A descendant binding dispatches Binding.ACTION_ACTIVATED\r\n *     A descendant binding dispatches Binding.ACTION_FOCUSED \r\n */\r\nEventBroadcaster.subscribe ( BroadcastMessages.KEY_TAB, {\r\n\thandleBroadcast : function () {\r\n\t\tif ( Keyboard.isControlPressed ) {\r\n\t\t\tvar current = TabBoxBinding.currentActiveInstance;\r\n\t\t\tif ( current != null && Binding.exists ( current )) {\r\n\t\t\t\t/*\r\n\t\t\t\t * Disabled because Firefox may sometimes think that \r\n\t\t\t\t * the CONTROL key is pressed - when it's not. \r\n\t\t\t\t * Let's wait a few Firefox versions before enabling...\r\n\t\t\t\t * \r\n\t\t\t\t * current.advanceSelection ( !Keyboard.isShiftPressed );\r\n\t\t\t\t */\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n});\r\n\r\n/**\r\n * @type {TabBoxBinding}\r\n */\r\nTabBoxBinding.currentActiveInstance = null;\r\n\r\n/**\r\n * @class\r\n * Go get'em tabbox.\r\n * TODO: Rewrite this oldschool stuff entirely! Subclass DecksBinding.\r\n */\r\nfunction TabBoxBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TabBoxBinding\" );\r\n\r\n\t/**\r\n\t * @type {HashMap}\r\n\t * @private\r\n\t */\r\n\tthis._tabBoxPairs = {};\r\n\t\r\n\t/**\r\n\t * @type {DOMElement}\r\n\t * @private\r\n\t */\r\n\tthis._selectedTabElement = null;\r\n\t\r\n\t/**\r\n\t * @type {TabBinding}\r\n\t * @private\r\n\t */\r\n\tthis._selectedTabBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {DOMElement}\r\n\t */\r\n\tthis._tabsElement = null;\r\n\t\r\n\t/**\r\n\t * @type {DOMElement}\r\n\t */\r\n\tthis._tabPanelsElement = null;\r\n\t\r\n\t/**\r\n\t * By default counting <tabs> and <tabpanels>.\r\n\t * @type {int}\r\n\t *\r\n\tthis._totalMemberCount = 2;\r\n\t*/\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._attachedMemberCount = 0;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isMembersAttached = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isEqualSize = false;\r\n\t\r\n\t/*\r\n\t * Prepare for tabboxes with completely different element names.\r\n\t */\r\n\tthis._nodename_tab = \"tab\";\r\n\tthis._nodename_tabs = \"tabs\";\r\n\tthis._nodename_tabpanel = \"tabpanel\";\r\n\tthis._nodename_tabpanels = \"tabpanels\";\r\n\t\r\n\t/*\r\n\t * Prepare for tabboxes with completely different binding constructors.\r\n\t */\r\n\tthis._impl_tab = TabBinding;\r\n\tthis._impl_tabs = TabsBinding;\r\n\tthis._impl_tabpanel = TabPanelBinding;\r\n\tthis._impl_tabpanels = TabPanelsBinding;\r\n\t\r\n\t/*\r\n\t * When the ACTION_UPDATE action is dispatched, \r\n\t * this property reflects the nature of update.\r\n\t * @type {string}\r\n\t */\r\n\tthis.updateType = null;\r\n\t\r\n\t/*\r\n\t * True when tabs or tabpanels was appended \r\n\t * or remove via UpdateManager updates.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasBastardUpdates = false;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTabBoxBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TabBoxBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nTabBoxBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tTabBoxBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( Binding.ACTION_ATTACHED );\r\n\tthis.addActionListener ( Binding.ACTION_DETACHED );\r\n\tthis.addActionListener ( Binding.ACTION_ACTIVATED );\r\n\tthis.addActionListener ( Binding.ACTION_FOCUSED );\r\n\tthis.addActionListener ( PageBinding.ACTION_INITIALIZED );\r\n\t\r\n\t/*\r\n\t * Intercept tabs and tabpanels appended \r\n\t * via UpdateManager updates.\r\n\t */\r\n\tDOMEvents.addEventListener ( this.bindingDocument.documentElement, DOMEvents.AFTERUPDATE, this );\r\n\tDOMEvents.addEventListener ( this.bindingElement, DOMEvents.AFTERUPDATE, this );\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTabBoxBinding.prototype.onBindingAttach = function () {\r\n\r\n\tTabBoxBinding.superclass.onBindingAttach.call ( this );\r\n\tTabBoxBinding.currentActiveInstance = this;\r\n\t\r\n\t/*\r\n\t * Shorthand <tabs> and <tabpanels>.\r\n\t */\r\n\tthis._tabsElement = this.getTabsElement ();\r\n\tthis._tabPanelsElement = this.getTabPanelsElement ();\r\n\t\r\n\t/*\r\n\t * Count tabbox members.\r\n\t */\r\n\tvar tabCount = this.getTabElements ().getLength ();\r\n\tvar tabPanelCount = this.getTabPanelElements ().getLength ();\r\n\t//this._totalMemberCount = this._totalMemberCount + tabCount + tabPanelCount;\r\n\t\r\n\t/*\r\n\t * Initialize.\r\n\t */\r\n\tif ( !this._tabsElement || !this._tabPanelsElement ) {\r\n\t\tthrow new Error ( this.toString () + \" DOM subtree invalid.\" );\r\n\t} else if ( tabCount != tabPanelCount ) {\r\n\t\tthrow new Error ( this.toString () + \" DOM subtree invalid.\" );\r\n\t} else {\r\n\t\t\r\n\t\tif ( this.getProperty ( \"type\" ) == \"boxed\" ) {\r\n\t\t\tthis.setFlexibility ( false );\r\n\t\t\tthis.attachClassName ( \"boxed\" );\r\n\t\t}\r\n\t\t\r\n\t\tthis.buildDOMContent ();\r\n\t\tthis._TEMPNAME ();\r\n\t\t\r\n\t\tif ( this.getProperty ( \"equalsize\" ) == true ) {\r\n\t\t\tthis.dispatchAction ( PageBinding.ACTION_BLOCK_INIT );\r\n\t\t\tthis.setFlexibility ( false );\r\n\t\t\tthis.attachClassName ( \"equalsize\" );\r\n\t\t\tthis.isEqualSize = true;\r\n\t\t\tthis.addMembers ( this.getDescendantBindingsByLocalName ( \"*\" ));\r\n\t\t} else {\r\n\t\t\tthis.addMember ( this.getTabsBinding ());\r\n\t\t\tthis.addMember ( this.getTabPanelsBinding ());\r\n\t\t\tthis.addMembers ( this.getTabBindings ());\r\n\t\t\tthis.addMembers ( this.getTabPanelBindings ());\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Go get'em tabbox.\r\n */\r\nTabBoxBinding.prototype.onBindingInitialize = function () {\r\n\t\r\n\t/*\r\n\t * Hack up warning system.\r\n\t */\r\n\tvar tabPanelElements = this.getTabPanelElements ();\r\n\twhile ( tabPanelElements.hasNext ()) {\r\n\t\tthis._setupWarningSystem ( \r\n\t\t\tUserInterface.getBinding ( \r\n\t\t\t\ttabPanelElements.getNext ()\r\n\t\t\t)\r\n\t\t);\r\n\t}\r\n\t\r\n\t/*\r\n\t * TODO: consider when to reinforce equalsize!\r\n\t */\r\n\tif ( this.isEqualSize ) {\r\n\t\tthis.enforceEqualSize ();\r\n\t\tthis.dispatchAction ( PageBinding.ACTION_UNBLOCK_INIT );\r\n\t}\r\n\t\r\n\tthis.dispatchAction ( TabBoxBinding.ACTION_ATTACHED );\r\n\t\r\n\tTabBoxBinding.superclass.onBindingInitialize.call ( this );\r\n}\r\n\r\n\r\n/**\r\n * IE6 cannot handle the nescessary css selectors to \r\n * style tabs below this without a special classname. \r\n * This method fixes it.\r\n */\r\nTabBoxBinding.prototype.buildDOMContent = function () {\r\n\t\r\n\tvar tabsPosition = DOMUtil.getOrdinalPosition ( this._tabsElement );\r\n\tvar tabPanelsPosition = DOMUtil.getOrdinalPosition ( this._tabPanelsElement );\r\n\t\r\n\tvar classname = tabsPosition > tabPanelsPosition ? \"tabsbelow\" : \"tabsontop\";\r\n\tthis.attachClassName ( classname );\r\n}\r\n\r\nTabBoxBinding.prototype._TEMPNAME = function () {\r\n\t\r\n\tvar tabs = this.getTabElements ();\r\n\tvar tabpanels = this.getTabPanelElements ();\r\n\tvar selectedTab = null;\r\n\t\r\n\tvar selectedindex = this.getProperty ( \"selectedindex\" );\r\n\tif ( selectedindex != null ) {\r\n\t\tif ( selectedindex > tabs.getLength () - 1 ) {\r\n\t\t\tthrow \"Selectedindex out of range\";\r\n\t\t}\r\n\t}\r\n\tif ( tabs.hasEntries ()) {\r\n\t\tvar index = 0;\r\n\t\twhile ( tabs.hasNext ()) {\r\n\t\t\tvar tab = tabs.getNext ();\r\n\t\t\tvar tabpanel = tabpanels.getNext ();\r\n\t\t\tthis.registerTabBoxPair ( tab, tabpanel );\r\n\t\t\tif ( selectedindex && index == selectedindex ) {\r\n\t\t\t\ttab.setAttribute ( \"selected\", \"true\" );\r\n\t\t\t} else if ( tab.getAttribute ( \"selected\" ) == \"true\" ) {\r\n\t\t\t\tselectedTab = tab;\t\r\n\t\t\t}\r\n\t\t\tindex ++;\r\n\t\t}\r\n\t\tif ( !selectedTab ) {\r\n\t\t\tselectedTab = tabs.getFirst ();\r\n\t\t\tselectedTab.setAttribute ( \"selected\", \"true\" );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Scale tabpanels to fit tallest contained tabpanel.\r\n * @param {boolean} isMaxingOut If set to true, tabbox can only grow taller.\r\n */\r\nTabBoxBinding.prototype.enforceEqualSize = function ( isMaxingOut ) {\r\n\t\r\n\tvar oldheight = null;\r\n\tvar newheight = null;\r\n\t\r\n\tif ( this.isEqualSize ) {\r\n\t\t\r\n\t\tvar padding = CSSComputer.getPadding ( this._tabPanelsElement );\r\n\t\tvar max = 0, tabPanels = this.getTabPanelElements ();\r\n\t\ttabPanels.each ( function ( tabPanel ) {\r\n\t\t\tmax = tabPanel.offsetHeight > max ? tabPanel.offsetHeight : max; \r\n\t\t});\r\n\t\tnewheight = max + padding.top + padding.bottom;\r\n\t\tif ( isMaxingOut && this._tabPanelsElement.style.height != null ) {\r\n\t\t\toldheight = this._tabPanelsElement.offsetHeight;\r\n\t\t}\r\n\t\tif ( oldheight != null || newheight > oldheight ) {\r\n\t\t\tthis._tabPanelsElement.style.height = newheight + \"px\";\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * A somewhat hacked system for the tabs to display notifications \r\n * when errors or balloons explode inside the associated tabpanel.\r\n * @param {TabPanelBinding} tabpanel\r\n */\r\nTabBoxBinding.prototype._setupWarningSystem = function ( tabpanel ) {\r\n\t\r\n\ttabpanel._invalidCount = 0;\r\n\ttabpanel.addActionListener ( Binding.ACTION_INVALID, this );\r\n\ttabpanel.addActionListener ( Binding.ACTION_VALID, this );\r\n\ttabpanel.addActionListener ( BalloonBinding.ACTION_SNAP, this );\r\n}\r\n\r\n/**\r\n * Elaborate setup to make sure that tabbox members are properly initialized \r\n * before the tabbox can announce to the outside world that is is ready to go.\r\n * TODO: DEPRECATE THIS SPECIALIZED SETUP IN FAVOUR OF STANDARD MEMBER DEPENDENCY!!! \r\n * @implements {IActionListener}\r\n * @overloads {FlexBoxBinding#handleAction}\r\n * @param {Action} action \r\n */\r\nTabBoxBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tTabBoxBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\tvar listener = action.listener;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\r\n\t\tcase Binding.ACTION_ATTACHED :\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\tif ( !this._isMembersAttached ) {\r\n\t\t\t\tswitch ( binding.constructor ) {\r\n\t\t\t\t\tcase this._impl_tab :\r\n\t\t\t\t\tcase this._impl_tabs :\r\n\t\t\t\t\tcase this._impl_tabpanel :\r\n\t\t\t\t\tcase this._impl_tabpanels :\r\n\t\t\t\t\t\tif ( ++ this._attachedMemberCount == this._totalMemberCount ) {\r\n\t\t\t\t\t\t\tthis._isMembersAttached = true;\r\n\t\t\t\t\t\t\tthis.onMembersAttached ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\taction.consume ();\t\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase Binding.ACTION_DETACHED :\r\n\t\t\tif ( binding.constructor == this._impl_tab ) {\r\n\t\t\t\tthis.updateType = TabBoxBinding.UPDATE_DETACH;\r\n\t\t\t\tthis.dispatchAction ( TabBoxBinding.ACTION_UPDATED );\r\n\t\t\t\taction.consume ();\t\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\r\n\t\tcase PageBinding.ACTION_INITIALIZED :\r\n\t\t\tif ( binding.isDialogSubPage && this.isEqualSize ) {\t\r\n\t\t\t\tthis.enforceEqualSize ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase Binding.ACTION_INVALID :\r\n\t\t\tlistener._invalidCount ++;\r\n\t\t\tif ( listener._invalidCount == 1 ) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\tif ( !listener.isSelected ) {\r\n\t\t\t\t\t\tself._showWarning ( listener, true );\r\n\t\t\t\t\t}\r\n\t\t\t\t}, 0 );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase Binding.ACTION_VALID :\r\n\t\t\tif ( listener._invalidCount > 0 ) {\r\n\t\t\t\tlistener._invalidCount --;\r\n\t\t\t\tif ( listener._invalidCount == 0 ) {\r\n\t\t\t\t\tif ( listener.isSelected ) {\r\n\t\t\t\t\t\tthis._showWarning ( listener, false ); \r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BalloonBinding.ACTION_SNAP :\r\n\t\t\tthis._showBalloon ( listener, true );\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase Binding.ACTION_ACTIVATED :\r\n\t\tcase Binding.ACTION_FOCUSED :\r\n\t\t\tif ( action._tabboxstamp == null ) {\r\n\t\t\t\tTabBoxBinding.currentActiveInstance = this;\r\n\t\t\t\taction._tabboxstamp = \"stamped\";\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Register tabs and tabpanels appended via UpdateManager updates.\r\n * @implements {IEventHandler}\r\n * @overloads {Binding#handleEvent}\r\n * @param {Event} e\r\n */\r\nTabBoxBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tTabBoxBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.AFTERUPDATE :\r\n\t\t\t\r\n\t\t\tvar target = DOMEvents.getTarget ( e );\r\n\t\t\t\r\n\t\t\tif ( target == this.bindingDocument.documentElement ) {\r\n\t\t\t\t\r\n\t\t\t\t// TODO: Check for validity of structure\r\n\t\t\t\t\r\n\t\t\t\tif ( this._hasBastardUpdates ) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tthis._hasBastardUpdates = false;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// welcome new tabs\r\n\t\t\t\t\tvar tabs = this.getTabElements ();\r\n\t\t\t\t\tvar tabpanels = this.getTabPanelElements ();\r\n\t\t\t\t\ttabs.each ( function ( tab, index ) {\r\n\t\t\t\t\t\tif ( tab.getAttribute ( TabBoxBinding.ASSOCIATION_KEY ) == null ) {\r\n\t\t\t\t\t\t\tvar tabPanel = tabpanels.get ( index );\r\n\t\t\t\t\t\t\tthis.registerTabBoxPair ( tab, tabPanel );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, this );\r\n\t\t\t\t\t\r\n\t\t\t\t\t// dismiss gone tabs\r\n\t\t\t\t\tvar pairs = this._tabBoxPairs;\r\n\t\t\t\t\tfor ( var key in pairs ) {\r\n\t\t\t\t\t\tvar tab = pairs [ key ].tab;\r\n\t\t\t\t\t\tif ( tab.parentNode == null ) {\r\n\t\t\t\t\t\t\tthis.unRegisterTabBoxPair ( tab )\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\t// TODO: Investigate double updates\r\n\t\t\t\t\r\n\t\t\t\tif ( !this._hasBastardUpdates ) {\r\n\t\t\t\t\tvar name = DOMUtil.getLocalName ( target );\r\n\t\t\t\t\tswitch ( target.__updateType ) {\r\n\t\t\t\t\t\tcase Update.TYPE_INSERT :\r\n\t\t\t\t\t\t\tswitch ( name ) {\r\n\t\t\t\t\t\t\t\tcase this._nodename_tab :\r\n\t\t\t\t\t\t\t\tcase this._nodename_tabpanel :\r\n\t\t\t\t\t\t\t\t\tvar parent = target.parentNode;\r\n\t\t\t\t\t\t\t\t\tif ( parent == this._tabsElement || parent == this._tabPanelsElement ) {\r\n\t\t\t\t\t\t\t\t\t\tthis._hasBastardUpdates = true;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase Update.TYPE_REMOVE :\r\n\t\t\t\t\t\t\tswitch ( name ) {\r\n\t\t\t\t\t\t\t\tcase this._nodename_tabs :\r\n\t\t\t\t\t\t\t\tcase this._nodename_tabpanels :\r\n\t\t\t\t\t\t\t\t\tif ( target == this._tabsElement || target == this._tabPanelsElement ) {\r\n\t\t\t\t\t\t\t\t\t\tthis._hasBastardUpdates = true;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Select tab by argument.\r\n * @param {object} arg This should be a string (tab id) or a TabBinding instance.\r\n * @param {boolean} isManaged If set to true, application focus will not be updated.\r\n */\r\nTabBoxBinding.prototype.select = function ( arg, isManaged ) {\r\n\t\r\n\tvar tabBinding = this.getBindingForArgument ( arg ); \r\n\t\r\n\tif ( tabBinding != null && !tabBinding.isSelected ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Deselect old selection.\r\n\t\t */\r\n\t\tif ( this._selectedTabBinding != null ) {\t\r\n\t\t\tthis._selectedTabBinding.unselect ();\r\n\t\t\tthis.getTabPanelBinding ( this._selectedTabBinding ).unselect ();\r\n\t\t}\r\n\t\t\r\n\t\tthis.dispatchAction ( TabBoxBinding.ACTION_UNSELECTED );\r\n\t\t\r\n\t\t/*\r\n\t\t * Show selected tab-tabpanel set.\r\n\t\t */\r\n\t\ttabBinding.select ( isManaged );\r\n\t\tthis.getTabPanelBinding ( tabBinding ).select ( isManaged );\r\n\t\t\r\n\t\t/*\r\n\t\t * Update selectedIndex property.\r\n\t\t */\r\n\t\tvar selectedindex = this.getProperty ( \"selectedindex\" );\r\n\t\tif ( selectedindex != null ) {\r\n\t\t\tthis.setProperty ( \r\n\t\t\t\t\"selectedindex\", \r\n\t\t\t\tDOMUtil.getOrdinalPosition ( tabBinding.bindingElement, true )\r\n\t\t\t);\r\n\t\t}\r\n\t\t\r\n\t\tthis._selectedTabBinding = tabBinding;\r\n\t\tthis.dispatchAction ( TabBoxBinding.ACTION_SELECTED );\r\n\t\tthis.dispatchAction ( FocusBinding.ACTION_UPDATE );\r\n\t\t \r\n\t\t/*\r\n\t\t * Error and balloon stuff.\r\n\t\t */\r\n\t\tif ( tabBinding.getImage () == TabBoxBinding.BALLOON_TAB_IMAGE ) {\r\n\t\t\tvar panel = this.getTabPanelBinding ( tabBinding );\r\n\t\t\tthis._showBalloon ( panel, false );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Building unique keys for each TabBinding and corresponding TabPanelBinding.\r\n * @param {DOMElement} tab\r\n * @param {DOMElement} tabPanel\r\n * @private\r\n */\r\nTabBoxBinding.prototype.registerTabBoxPair = function ( tab, tabPanel ) {\r\n\t\r\n\tvar key = KeyMaster.getUniqueKey ();\r\n\r\n\ttab.setAttribute ( TabBoxBinding.ASSOCIATION_KEY, key );\r\n\ttabPanel.setAttribute ( TabBoxBinding.ASSOCIATION_KEY, key );\r\n\t\r\n\tthis._tabBoxPairs [ key ] = {\r\n\t\ttab : tab,\r\n\t\ttabPanel : tabPanel\r\n\t}\r\n}\r\n\r\n/**\r\n * Unregister tab and associated tabpanel.\r\n * @param {DOMElement} tab\r\n */\r\nTabBoxBinding.prototype.unRegisterTabBoxPair = function ( tab ) {\r\n\t\r\n\tvar key = tab.getAttribute ( TabBoxBinding.ASSOCIATION_KEY );\r\n\tdelete this._tabBoxPairs [ key ];\r\n}\r\n\r\n/**\r\n * Get the TabPanelBinding associated to a given TabBinding.\r\n * @param {TabBinding} tabBinding\r\n * @return {TabPanelBinding}\r\n * @private\r\n */\r\nTabBoxBinding.prototype.getTabPanelBinding = function ( tabBinding ) {\r\n\t\r\n\tvar result = null;\r\n\ttry {\r\n\t\tvar key = tabBinding.getProperty ( TabBoxBinding.ASSOCIATION_KEY );\r\n\t\tvar tabPanelElement = this._tabBoxPairs [ key ].tabPanel;\r\n\t\tresult = UserInterface.getBinding ( tabPanelElement );\r\n\t} catch ( exception ) {\r\n\t\tthis.logger.error ( exception );\r\n\t\tSystemDebug.stack ( arguments )\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get the TabBinding associated to a given TabPanelBinding.\r\n * @param {TabPanelBinding} tabPanelBinding\r\n * @return {TabBinding}\r\n * @private\r\n */\r\nTabBoxBinding.prototype.getTabBinding = function ( tabPanelBinding ) {\r\n\r\n\tvar key = tabPanelBinding.getProperty ( TabBoxBinding.ASSOCIATION_KEY );\r\n\tvar tabElement = this._tabBoxPairs [ key ].tab;\r\n\treturn UserInterface.getBinding ( tabElement );\r\n}\r\n\r\n\r\n/** \r\n * Creates a new TabBinding instance. By isolating \r\n * the method, subclasses can overwrite it.\r\n * @return {TabBinding}\r\n */\r\nTabBoxBinding.prototype.summonTabBinding = function () {\r\n\t\r\n\treturn TabBinding.newInstance ( this.bindingDocument );\r\n}\r\n\r\n/**\r\n * Creates a new TabPanelBinding instance.\r\n * @return {TabPanelBinding}\r\n */\r\nTabBoxBinding.prototype.summonTabPanelBinding = function () {\r\n\t\r\n\tvar tabpanel = this._impl_tabpanel.newInstance ( this.bindingDocument );\r\n\tthis._setupWarningSystem ( tabpanel );\r\n\treturn tabpanel;\r\n}\r\n\r\n/**\r\n * This is the easy way to append a new tab: With a tab label and a nodetree to \r\n * be used as tabpanel content. When going from zero to one tab, the first tab is \r\n * selected. You can also use the appendTabByBindings method.\r\n * @see TabBoxBinding#appendTabByBindings\r\n * @param {string} label\r\n * @param {DOMElement} tabPanelSubTree\r\n * @return {TabBinding}\r\n *\r\nTabBoxBinding.prototype.appendTab = function ( label, tabPanelSubTree ) {\r\n\t\r\n\talert ( \"TabBoxBinding.appendTab: Refactor!\" );\r\n\t\r\n\t// build tab, autoselecting first tab.\r\n\tvar tabBinding = this.summonTabBinding ();\r\n\tvar tabElement = tabBinding.bindingElement;\r\n\ttabBinding.setLabel ( label );\r\n\tif ( !this.getTabElements ().hasEntries ()) {\r\n\t\ttabBinding.setProperty ( \"selected\", true );\r\n\t}\r\n\t\r\n\t// build tabpanel.\r\n\tvar tabPanelBinding = this.summonTabPanelBinding ();\r\n\tvar tabPanelElement = tabPanelBinding.bindingElement;\r\n\tif ( tabPanelSubTree ) { \r\n\t\ttabPanelElement.appendChild ( tabPanelSubTree );\r\n\t}\r\n\t\t\r\n\t// register and append.\r\n\tthis.registerTabBoxPair ( tabElement, tabPanelElement );\r\n\tthis._tabsElement.appendChild ( tabElement );\r\n\tthis._tabPanelsElement.appendChild ( tabPanelElement );\r\n\t\r\n\t// dispatch action and return tab binding.\r\n\tthis.updateType = TabBoxBinding.UPDATE_ATTACH;\r\n\tthis.dispatchAction ( TabBoxBinding.ACTION_UPDATED );\r\n\treturn tabBinding;\r\n}\r\n*/\r\n\r\n/**\r\n * Append new tab with a {@link TabBinding} instance and an object to be used as \r\n * tabpanel content. When going from zero to one tab, the first tab is selected. \r\n * @param {TabBinding} tabBinding\r\n * @param {object} tabPanelContent This can be either a Binding or a DOMElement\r\n */\r\nTabBoxBinding.prototype.appendTabByBindings = function ( tabBinding, tabPanelContent ) {\r\n\t\r\n\t// prepare tab, autoselecting first tab.\r\n\tvar tabElement = tabBinding.bindingElement;\r\n\ttabBinding.setProperty ( \"selected\", true );\r\n\t\r\n\t// build tabpanel.\r\n\tvar tabPanelBinding = this.summonTabPanelBinding ();\r\n\tvar tabPanelElement = tabPanelBinding.bindingElement;\r\n\tif ( tabPanelContent ) { \r\n\t\ttabPanelElement.appendChild ( \r\n\t\t\ttabPanelContent instanceof Binding ? \r\n\t\t\ttabPanelContent.bindingElement : tabPanelContent \r\n\t\t);\r\n\t}\r\n\r\n\t// register, append and attach\r\n\tthis.registerTabBoxPair ( tabElement, tabPanelElement );\r\n\t\r\n\t//this._tabsElement.appendChild ( tabElement );\r\n\tUserInterface.getBinding ( this._tabsElement ).add ( tabBinding );\r\n\tthis._tabPanelsElement.appendChild ( tabPanelElement );\r\n\t\r\n\ttabBinding.attach ();\r\n\tUserInterface.getBinding ( tabPanelElement ).attachRecursive ();\r\n\t\r\n\t// dispatch action and return tab binding.\r\n\tthis.updateType = TabBoxBinding.UPDATE_ATTACH;\r\n\tthis.dispatchAction ( TabBoxBinding.ACTION_UPDATED );\r\n\treturn tabBinding;\r\n}\r\n\r\n/**\r\n * Import tab.\r\n * @param {TabBinding} tabBinding\r\n */\r\nTabBoxBinding.prototype.importTabBinding = function ( tabBinding ) {\r\n\t\r\n\tvar that\t\t\t= tabBinding.containingTabBoxBinding;\r\n\tvar tabPanelBinding = that.getTabPanelBinding ( tabBinding );\r\n\tvar tabPanelElement = tabPanelBinding.getBindingElement ();\r\n\tvar tabElement \t\t= tabBinding.getBindingElement ();\r\n\t\r\n\tthat.dismissTabBinding ( tabBinding );\r\n\t\r\n\tthis._tabsElement.appendChild ( tabElement );\r\n\tthis._tabPanelsElement.appendChild ( tabPanelElement );\r\n\tthis.registerTabBoxPair ( tabElement, tabPanelElement );\r\n\t\r\n\ttabBinding.containingTabBoxBinding = this;\r\n\t\r\n\tthis.select ( tabBinding );\r\n\tthis.dispatchAction ( Binding.ACTION_ACTIVATED );\r\n\tthis.dispatchAction ( TabBoxBinding.ACTION_UPDATED );\r\n}\r\n\r\n/**\r\n * Remove tab - and the associated tabpanel!\r\n * @param {TabBinding} tabBinding\r\n */\r\nTabBoxBinding.prototype.removeTab = function ( tabBinding ) {\r\n\r\n\tvar bestTab = null; \r\n\tif ( tabBinding.isSelected ) {\r\n\t\tbestTab = this.getBestTab ( tabBinding );\r\n\t\tthis._selectedTabBinding = null;\r\n\t}\r\n\t\r\n\tvar tabPanelBinding = this.getTabPanelBinding ( tabBinding );\r\n\tthis.unRegisterTabBoxPair ( tabBinding.bindingElement );\r\n\r\n\ttabBinding.dispose ();\r\n\ttabPanelBinding.dispose ();\r\n\t\r\n\tif ( bestTab != null ){\r\n\t\tthis.select ( bestTab, true);\r\n\t}\r\n\t\r\n\tthis.updateType = TabBoxBinding.UPDATE_DETACH;\r\n\tthis.dispatchAction ( TabBoxBinding.ACTION_UPDATED );\r\n\r\n\tthis.deActivate();\r\n}\r\n\r\n/**\r\n * @param {TabBinding} tabBinding\r\n */ \r\nTabBoxBinding.prototype.dismissTabBinding = function ( tabBinding ) {\r\n\r\n\tif ( tabBinding.isSelected ) {\r\n\t\tthis.selectBestTab ( tabBinding );\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {TabBinding} missingTabBinding This binding IS ABOUT to be disposed...\r\n */\r\nTabBoxBinding.prototype.selectBestTab = function ( missingTabBinding ) {\r\n\t\r\n\tvar bestTab = this.getBestTab ( missingTabBinding );\r\n\t\r\n\tif ( bestTab ) {\r\n\t \tthis.select ( bestTab );\r\n\t} else {\r\n\t\tthis._selectedTabBinding = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {TabBinding} missingTabBinding This binding IS ABOUT to be disposed...\r\n */\r\nTabBoxBinding.prototype.getBestTab = function ( missingTabBinding ) {\r\n\r\n\tvar bestTabBinding \t= null;\r\n\tvar tabPosition \t= missingTabBinding.getOrdinalPosition ( true );\r\n\tvar tabBindings \t= this.getTabBindings ();\r\n\tvar tabsLength \t\t= tabBindings.getLength ();\r\n\tvar lastPosition \t= tabsLength - 1;\r\n\r\n\tif ( tabsLength == 1 ) { // first tab\r\n\t \tbestTabBinding \t= null;\r\n\t} else if ( tabPosition == lastPosition ) { // last tab\r\n\t\tbestTabBinding = tabBindings.get ( tabPosition - 1 );\r\n\t} else {\r\n\t\tbestTabBinding = tabBindings.get ( tabPosition + 1 );\r\n\t}\r\n\treturn bestTabBinding;\r\n}\r\n\r\n/**\r\n * Move tab and corresponding tabpanel to specified position.\r\n * @param {TabBinding}\r\n * @param {int} index\r\n */\r\nTabBoxBinding.prototype.moveToOrdinalPosition = function ( tabBinding, index ) {\r\n\t\r\n\tvar target = this.bindingDocument.getElementById ( tabBinding.bindingElement.id ); // ie!\r\n\tvar tab = this.getTabElements().get(index);\r\n\twhile (tab && tab.getAttribute(\"pinned\") === \"true\") {\r\n\t\ttab = this.getTabElements().get(++index);\r\n\t}\r\n\tif (tab) {\r\n\t\tthis._tabsElement.insertBefore(target, tab);\r\n\t}\r\n\tthis.updateType = TabBoxBinding.UPDATE_ORDINAL;\r\n\tthis.dispatchAction ( TabBoxBinding.ACTION_UPDATED );\r\n}\r\n\r\n/**\r\n * Get tabs element.\r\n * @return {DOMElement}\r\n */\r\nTabBoxBinding.prototype.getTabsElement = function () {\r\n\r\n\treturn DOMUtil.getElementsByTagName ( \r\n\t\tthis.bindingElement, \r\n\t\tthis._nodename_tabs \r\n\t).item ( 0 );\r\n}\r\n\r\n/**\r\n * Get tabpanels element.\r\n * @return {DOMElement}\r\n */\r\nTabBoxBinding.prototype.getTabPanelsElement = function () {\r\n\r\n\treturn DOMUtil.getElementsByTagName ( \r\n\t\tthis.bindingElement,\r\n\t\tthis._nodename_tabpanels \r\n\t).item ( 0 );\r\n}\r\n\r\n/**\r\n * Get tab elements. Taking care not to include tabs from descendant tabboxes in result.\r\n * @return {List<Element>}\r\n */\r\nTabBoxBinding.prototype.getTabElements = function () {\r\n\t\r\n\tvar nodename = this._nodename_tab;\r\n\tvar children = new List ( this._tabsElement.childNodes );\r\n\tvar result = new List ();\r\n\r\n\twhile ( children.hasNext ()) {\r\n\t\tvar child = children.getNext ();\r\n\t\tif ( child.nodeType == Node.ELEMENT_NODE && DOMUtil.getLocalName ( child ) == nodename ) {\r\n\t\t\tresult.add ( child );\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get tabpanel elements.\r\n * @return {List<Element>}\r\n */\r\nTabBoxBinding.prototype.getTabPanelElements = function () {\r\n\t\r\n\tvar nodename = this._nodename_tabpanel;\r\n\tvar children = new List ( this._tabPanelsElement.childNodes );\r\n\tvar result = new List ();\r\n\t\r\n\tchildren.each ( function ( child ) {\r\n\t\tif ( child.nodeType == Node.ELEMENT_NODE && DOMUtil.getLocalName ( child ) == nodename ) {\r\n\t\t\tresult.add ( child );\r\n\t\t}\r\n\t});\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get tabs binding.\r\n * @return {TabsBinding}\r\n */\r\nTabBoxBinding.prototype.getTabsBinding = function () {\r\n\t\r\n\treturn this.getChildBindingByLocalName ( this._nodename_tabs ); \r\n}\r\n\r\n/**\r\n * Get tabpanels binding.\r\n * @return {TabPanelsBinding}\r\n */\r\nTabBoxBinding.prototype.getTabPanelsBinding = function () {\r\n\t\r\n\treturn this.getChildBindingByLocalName ( this._nodename_tabpanels );\r\n}\r\n\r\n/**\r\n * Get tab bindings.\r\n * @return {List<TabBinding>}\r\n */\r\nTabBoxBinding.prototype.getTabBindings = function () {\r\n\r\n\tvar result = new List ();\r\n\tvar elements = this.getTabElements ();\r\n\t\r\n\telements.each ( function ( element ) {\r\n\t\tresult.add ( \r\n\t\t\tUserInterface.getBinding ( element )\r\n\t\t);\r\n\t});\r\n\t\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get tabpanel bindings.\r\n * @return {List<TabPanelBinding>\r\n */\r\nTabBoxBinding.prototype.getTabPanelBindings = function () {\r\n\t\r\n\tvar result = new List ();\r\n\tthis.getTabPanelElements ().each ( function ( element ) {\r\n\t\tresult.add ( UserInterface.getBinding ( element ));\r\n\t});\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get the selected TabBinding.\r\n * @return {TabBinding}\r\n */\r\nTabBoxBinding.prototype.getSelectedTabBinding = function () {\r\n\r\n\treturn this._selectedTabBinding;\r\n}\r\n\r\n/**\r\n * Get the selected TabPanelBinding.\r\n * @return {TabPanelBinding}\r\n */\r\nTabBoxBinding.prototype.getSelectedTabPanelBinding = function () {\r\n\t\r\n\tvar result = null;\r\n\tif ( this._selectedTabBinding ) {\r\n\t\tresult = this.getTabPanelBinding (\r\n\t\t\tthis._selectedTabBinding \r\n\t\t);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {TabPanelBinding} tabPanelBinding\r\n * @param {boolean} isShowWarning\r\n */\r\nTabBoxBinding.prototype._showWarning = function ( tabPanelBinding, isShowWarning ) {\r\n\t\r\n\tvar tabBinding = this.getTabBinding ( tabPanelBinding );\r\n\t\r\n\tif ( isShowWarning ) {\r\n\t\tif ( tabBinding.labelBinding.hasImage ) {\r\n\t\t\ttabBinding._backupImage = tabBinding.getImage ();\r\n\t\t}\r\n\t\ttabBinding.setImage ( TabBoxBinding.INVALID_TAB_IMAGE );\r\n\t} else {\r\n\t\tif ( tabBinding._backupImage ) {\r\n\t\t\ttabBinding.setImage ( tabBinding._backupImage );\r\n\t\t} else {\r\n\t\t\ttabBinding.setImage ( false );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** \r\n * TODO: Are we sure that errors get evaluated first?\r\n * @param {TabPanelBinding} tabPanelBinding\r\n * @param {boolean} isShowWarning\r\n */\r\nTabBoxBinding.prototype._showBalloon = function ( tabPanelBinding, isShow ) {\r\n\t\r\n\tvar tabBinding = this.getTabBinding ( tabPanelBinding );\r\n\t\r\n\tif (( isShow && !tabBinding.isSelected ) || !isShow ) { // don't put image on selected tab\r\n\t\t\r\n\t\t/*\r\n\t\t * Don't mess with error indicators...\r\n\t\t */\r\n\t\tif ( tabBinding.getImage () != TabBoxBinding.INVALID_TAB_IMAGE ) {\r\n\t\t\tif ( isShow ) {\r\n\t\t\t\tif ( tabBinding.labelBinding.hasImage ) {\r\n\t\t\t\t\ttabBinding._backupImage = tabBinding.getImage ();\r\n\t\t\t\t}\r\n\t\t\t\ttabBinding.setImage ( TabBoxBinding.BALLOON_TAB_IMAGE );\r\n\t\t\t} else {\r\n\t\t\t\tif ( tabBinding._backupImage != null ) {\r\n\t\t\t\t\ttabBinding.setImage ( tabBinding._backupImage );\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttabBinding.setImage ( false );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Advance tab selection.\r\n * @param {boolean} isForward\r\n */\r\nTabBoxBinding.prototype.advanceSelection = function ( isForward ) {\r\n\t\r\n\tvar tab = this.getSelectedTabBinding ();\r\n\tvar tabs = this.getTabBindings ();\r\n\tvar index = tab.getOrdinalPosition ( true );\r\n\tvar next = null;\r\n\t\r\n\tvar visible = new List ();\r\n\ttabs.each ( function ( t ) { // exclude hidden tabs\r\n\t\tif ( t.isVisible ) {\r\n\t\t\tvisible.add ( t );\r\n\t\t}\r\n\t});\r\n\t \r\n\tif ( visible.getLength () > 1 ) {\r\n\t\tif ( index == 0 && !isForward ) {\r\n\t\t\tnext = visible.getLast ();\r\n\t\t} else if ( index == visible.getLength () - 1 && isForward ) {\r\n\t\t\tnext = visible.getFirst ();\r\n\t\t} else {\r\n\t\t\tif ( isForward ) {\r\n\t\t\t\tnext = tab.getNextBindingByLocalName ( this._nodename_tab );\r\n\t\t\t} else {\r\n\t\t\t\tnext = tab.getPreviousBindingByLocalName ( this._nodename_tab );\r\n\t\t\t} \r\n\t\t}\r\n\t\tif ( next != null ) {\r\n\t\t\tthis.select ( next );\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/tabboxes/TabPanelBinding.js",
    "content": "TabPanelBinding.prototype = new Binding;\r\nTabPanelBinding.prototype.constructor = TabPanelBinding;\r\nTabPanelBinding.superclass = Binding.prototype;\r\n\r\nfunction TabPanelBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TabPanelBinding\" );\r\n\t\r\n\t/**\r\n\t * This property is set by the TabBoxBinding\r\n\t * @type {string}\r\n\t */\r\n\tthis.tabboxkey = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = false;\r\n\t\r\n\t/**\r\n\t * @type {IFocusable}\r\n\t */\r\n\tthis._focusedBinding = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTabPanelBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TabPanelBinding]\";\r\n}\r\n\r\n/**\r\n * Dispatching action to initialize containing tabboxbinding.\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nTabPanelBinding.prototype.onBindingAttach = function () {\r\n\r\n\tTabPanelBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.dispatchAction ( Binding.ACTION_ATTACHED );\r\n\tthis.addActionListener ( BalloonBinding.ACTION_INITIALIZE );\r\n}\r\n\r\n/**\r\n * Select tabpanel.\r\n * @param {boolean} isManaged If set to true, application focus will not be updated.\r\n */\r\nTabPanelBinding.prototype.select = function ( isManaged ) {\r\n\t\r\n\tif ( !this.isSelected ) {\r\n\t\t\r\n\t\tif ( this.isLazy ) {\r\n\t\t\t\r\n\t\t\tthis.wakeUp ( \"select\" );\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\r\n\t\t\tthis.isSelected = true;\r\n\t\t\tthis.isVisible = true;\r\n\t\t\tthis.bindingElement.style.position = \"static\";\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Start flex iterator?\r\n\t\t\t */\r\n\t\t\tthis._invokeManagedRecursiveFlex ();\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * TODO: Even if seleted, focus shift should only be invoked   \r\n\t\t\t * when no VISIBLE binding inside the dock has the current focus. \r\n\t\t\t */\r\n\t\t\tif ( isManaged != true ) {\r\n\t\t\t\tthis.dispatchAction ( FocusBinding.ACTION_FOCUS );\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\t}\r\n}\r\n\r\n/**\r\n * Unselect tabpanel.\r\n */\r\nTabPanelBinding.prototype.unselect = function () {\r\n\t\r\n\tif ( this.isSelected ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * Blur any focused binding within the tabpanel.\r\n\t\t */\r\n\t\tthis.dispatchAction ( FocusBinding.ACTION_BLUR );\r\n\t\t\r\n\t\tthis.isSelected = false;\r\n\t\tthis.isVisible = false;\r\n\t\t\r\n\t\tthis.bindingElement.style.position = \"absolute\";\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoke recursive flex ONLY IF tabpanels height \r\n * has changed since last show (or when first shown).\r\n * UPDATE: THIS HAS BEEN DISABLED\r\n */\r\nTabPanelBinding.prototype._invokeManagedRecursiveFlex = function () {\r\n\t\r\n\tif (this.isAttached == true) {\r\n\t\tthis.reflex(true);\r\n\t} else {\r\n\t\tvar tabpanels = UserInterface.getBinding(this.bindingElement.parentNode);\r\n\t\ttabpanels.reflex();\r\n\t}\r\n\t\r\n\t/*\r\n\t * There's an issue here with lazy panels waking up. \r\n\t * It may be nescessary simply to reflex!\r\n\t *\r\n\tif ( this.isAttached == true ) {\r\n\t\t\r\n\t\tvar tabpanels = UserInterface.getBinding ( this.bindingElement.parentNode );\r\n\t\tif ( tabpanels.hasDimensionsChanged ()) {\r\n\t\t\tthis.reflex ();\r\n\t\t}\r\n\t}\r\n\t*/\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nTabPanelBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tTabPanelBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase BalloonBinding.ACTION_INITIALIZE :\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * TabPanelBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TabPanelBinding}\r\n */\r\nTabPanelBinding.newInstance = function ( ownerDocument ) {\r\n\t\r\n\tvar tabpanel = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:tabpanel\", ownerDocument );\r\n\tUserInterface.registerBinding ( tabpanel, TabPanelBinding );\r\n\treturn UserInterface.getBinding ( tabpanel );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/tabboxes/TabPanelsBinding.js",
    "content": "TabPanelsBinding.prototype = new FlexBoxBinding;\r\nTabPanelsBinding.prototype.constructor = TabPanelsBinding;\r\nTabPanelsBinding.superclass = FlexBoxBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TabPanelsBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TabPanelsBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {TabBoxBinding}\r\n\t */\r\n\tthis.containingTabBoxBinding = null;\r\n\t\r\n\t/**\r\n\t * Storing tabpanels dimensions in order to economize flex iterations.\r\n\t * @see {TabPanelBinding#_invokeManagedRecursiveFlex}\r\n\t * @type {Dimension}\r\n\t */\r\n\tthis._lastKnownDimension = null;\r\n\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTabPanelsBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TabPanelsBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nTabPanelsBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tTabPanelsBinding.superclass.onBindingRegister.call ( this );\r\n\tthis._lastKnownDimension = new Dimension ( 0, 0 );\r\n}\r\n\r\n/**\r\n * Returns true if dimensions changed since method was lastly invoked.\r\n * @see {TabPanelBinding#_invokeManagedRecursiveFlex}\r\n * @return {boolean}\r\n */\r\nTabPanelsBinding.prototype.hasDimensionsChanged = function () {\r\n\t\r\n\tvar result = false;\r\n\tvar dim1 = this.boxObject.getDimension ();\r\n\tvar dim2 = this._lastKnownDimension;\r\n\t\r\n\tif ( dim2 == null || !Dimension.isEqual ( dim1, dim2 )) {\r\n\t\tresult = true;\r\n\t\tthis._lastKnownDimension = dim1;\r\n\t}\r\n\t\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTabPanelsBinding.prototype.onBindingAttach = function () {\r\n\r\n\tTabPanelsBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.containingTabBoxBinding = this.getAncestorBindingByType ( TabBoxBinding );\r\n\tthis.setFlexibility ( this.containingTabBoxBinding.isFlexible );\r\n\tthis.dispatchAction ( Binding.ACTION_ATTACHED );\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/tabboxes/TabsBinding.js",
    "content": "TabsBinding.prototype = new Binding;\r\nTabsBinding.prototype.constructor = TabsBinding;\r\nTabsBinding.superclass = Binding.prototype;\r\nTabsBinding.NODENAME_TABBOX = \"tabbox\";\r\nTabsBinding.TABBUTTON_IMPLEMENTATION = TabsButtonBinding;\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n */\r\nfunction TabsBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TabsBinding\" );\r\n\r\n\t/**\r\n\t * @type {TabBoxBinding}\r\n\t */\r\n\tthis.containingTabBoxBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {TabManagerBinding}\r\n\t */\r\n\tthis.tabsButtonBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._cachedOffsetWidth = parseInt ( 0 );\r\n\r\n\t/**\r\n\t * Prevents the occasiona \"too much recursion\"...\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isManaging = false;\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTabsBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TabsBinding]\";\r\n}\r\n\r\n/**\r\n * Attach classname to clear stylesheet floats.\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nTabsBinding.prototype.onBindingRegister = function () {\r\n\r\n\tTabsBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.attachClassName ( Binding.CLASSNAME_CLEARFLOAT );\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTabsBinding.prototype.onBindingAttach = function () {\r\n\r\n\tTabsBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.containingTabBoxBinding = this.getAncestorBindingByType ( TabBoxBinding );\r\n\tthis.containingTabBoxBinding.addActionListener ( TabBoxBinding.ACTION_UPDATED, this );\r\n\tthis.buildDOMContent ();\r\n\tthis.dispatchAction ( Binding.ACTION_ATTACHED );\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nTabsBinding.prototype.buildDOMContent = function () {\r\n\t\r\n\t// build the tabmanager\r\n\tthis.shadowTree.tabManager = this.bindingDocument.createElement ( \"div\" );\r\n\tthis.shadowTree.tabManager.className = \"tabmanager\";\r\n\t\r\n\tvar tabButtonImplementation = this.constructor.TABBUTTON_IMPLEMENTATION;\r\n\tthis.tabsButtonBinding = tabButtonImplementation.newInstance ( this.bindingDocument );\r\n\tthis.shadowTree.tabsButton = this.tabsButtonBinding;\r\n\tthis.add ( this.tabsButtonBinding );\r\n\tthis.tabsButtonBinding.attach ();\r\n}\r\n\r\n/**\r\n * Invoke tabmanager update when tabbox is modified.\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nTabsBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tTabsBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase TabBoxBinding.ACTION_UPDATED  :\r\n\t\t\tif ( !this.isManaging ) {\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tfunction manage () {\r\n\t\t\t\t\tself.manage ();\r\n\t\t\t\t}\r\n\t\t\t\tsetTimeout ( manage, 0 );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Update tabsbutton when tabbox environment is resized.\r\n * A size check is added to prevent unnescessary management.\r\n * A timeout is enforced for browser convenience.\r\n */\r\nTabsBinding.prototype.flex = function () {\r\n\t\r\n\tif ( this.isAttached == true ) {\r\n\t\tvar self = this;\r\n\t\tfunction manage () {\r\n\t\t\tif ( Binding.exists ( self ) == true ) {\r\n\t\t\t\tvar currentOffsetWidth = self.bindingElement.offsetWidth;\r\n\t\t\t\tif ( currentOffsetWidth != self._cachedOffsetWidth ) {\r\n\t\t\t\t\tself.manage ();\r\n\t\t\t\t}\r\n\t\t\t\tself._cachedOffsetWidth = currentOffsetWidth;\r\n\t\t\t}\r\n\t\t}\r\n\t\tsetTimeout ( manage, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide the tabsbutton when adding new tabs. This will \r\n * prevent the button from jumping around (timeout issue). \r\n * If necessary, the button is shown by manage method.\r\n * @overloads {Binding#add}\r\n * @param {Binding} binding\r\n * @return {Binding}\r\n */\r\nTabsBinding.prototype.add = function ( binding ) {\r\n\t\r\n\tif ( binding instanceof TabBinding ) {\r\n\t\tif ( this.tabsButtonBinding && this.tabsButtonBinding.isVisible ) {\r\n\t\t\tthis.tabsButtonBinding.hide ();\r\n\t\t}\r\n\t}\r\n\treturn TabsBinding.superclass.add.call ( this, binding );\r\n}\r\n\r\n/**\r\n * Manage tab layout.\r\n * TODO: this routine is way too complex - please refactor!\r\n */\r\nTabsBinding.prototype.manage = function () {\r\n\t\r\n\tif ( Binding.exists ( this ) == true && this.isVisible ) {\r\n\t\r\n\t\tthis.isManaging = true;\r\n\t\r\n\t\tvar isOverflow = false;\r\n\t\tvar tabBinding, tab, tabs = this.containingTabBoxBinding.getTabElements ();\r\n\t\tvar tabButtonImplementation = this.constructor.TABBUTTON_IMPLEMENTATION;\r\n\t\tvar width = this.bindingElement.offsetWidth - tabButtonImplementation.RESERVED_SPACE;\r\n\t\tvar lastVisibleTabBinding = null;\r\n\t\r\n\t\tvar sum = 0, visibleCount = 0;\r\n\t\tvar isContinue = true;\t\r\n\t\t\r\n\t\tif ( tabs.hasEntries ()) {\r\n\t\t\r\n\t\t\tthis.tabsButtonBinding.reset ();\r\n\t\t\t\r\n\t\t\twhile ( tabs.hasNext () && isContinue ) {\r\n\t\t\t\ttab = tabs.getNext ();\r\n\t\t\t\ttabBinding = UserInterface.getBinding ( tab );\r\n\t\t\t\tif ( !lastVisibleTabBinding ) {\r\n\t\t\t\t\tlastVisibleTabBinding = tabBinding;\r\n\t\t\t\t}\r\n\t\t\t\tsum += tab.offsetWidth;\r\n\t\t\t\tif ( sum >= width ) {\r\n\t\t\t\t\tisOverflow = true;\r\n\t\t\t\t\tif ( tabBinding.isSelected ) {\r\n\t\t\t\t\t\tif ( !DOMUtil.isFirstElement ( tabBinding.bindingElement, true )) {\r\n\t\t\t\t\t\t\tthis.isManaging = false;\r\n\t\t\t\t\t\t\tif ( lastVisibleTabBinding ) {\r\n\t\t\t\t\t\t\t\tlastVisibleTabBinding.hide (); // prevents jumping tabs!\r\n\t\t\t\t\t\t\t\tif ( this.tabsButtonBinding.isVisible ) {\r\n\t\t\t\t\t\t\t\t\tthis.tabsButtonBinding.hide ();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis.containingTabBoxBinding.moveToOrdinalPosition ( // this will invoke a new manage!\r\n\t\t\t\t\t\t\t\ttabBinding,\r\n\t\t\t\t\t\t\t\tvisibleCount - 1\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\tisContinue = false; \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ttabBinding.hide ();\r\n\t\t\t\t\t\tthis.tabsButtonBinding.registerHiddenTabBinding ( tabBinding );\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttabBinding.show ();\r\n\t\t\t\t\tlastVisibleTabBinding = tabBinding;\r\n\t\t\t\t\tvisibleCount ++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( isContinue ) {\r\n\t\t\t\tif ( isOverflow && this.tabsButtonBinding.hiddenTabBindings.hasEntries ()) {\r\n\t\t\t\t\tvar lastElement = lastVisibleTabBinding.getBindingElement ();\r\n\t\t\t\t\tvar xposition = lastElement.offsetLeft + lastElement.offsetWidth;\r\n\t\t\t\t\tvar button = this.tabsButtonBinding;\r\n\t\t\t\t\tsetTimeout ( function () {\r\n\t\t\t\t\t\tbutton.show ( xposition + 4 );\r\n\t\t\t\t\t}, 50 );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.tabsButtonBinding.hide ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tthis.isManaging = false;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/tabboxes/TabsButtonBinding.js",
    "content": "TabsButtonBinding.prototype = new ButtonBinding;\r\nTabsButtonBinding.prototype.constructor = TabsButtonBinding;\r\nTabsButtonBinding.superclass = ButtonBinding.prototype;\r\nTabsButtonBinding.RESERVED_SPACE = 36;\r\nTabsButtonBinding.NODENAME_TABBOX = \"tabbox\";\r\n\r\nTabsButtonBinding.CHAR_INDICATOR = String.fromCharCode ( 187 ); // \"»\".charCodeAt ( 0 )\r\n\r\nfunction TabsButtonBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TabsButtonBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {List}\r\n\t */\r\n\tthis.hiddenTabBindings = null;\r\n\t\r\n\t/**\r\n\t * @type {List}\r\n\t * @private\r\n\t */\r\n\tthis.menuItemBindings = null;\r\n\t\r\n\t/**\r\n\t * @type {TabBoxBinding}\r\n\t * @private\r\n\t */\r\n\tthis.containingTabBoxBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {TabBinding}\r\n\t */\r\n\tthis.selectedTabBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = false;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.snapshotWindowWidth = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTabsButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TabsButtonBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads {ButtonBinding#onBindingRegister}\r\n */\r\nTabsButtonBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tTabsButtonBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.hiddenTabBindings = new List ();\r\n\tthis.menuItemBindings = new List ();\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nTabsButtonBinding.prototype.buildDOMContent = function () {\r\n\r\n\tTabsButtonBinding.superclass.buildDOMContent.call ( this );\r\n\r\n\tthis.containingTabBoxBinding = this.getAncestorBindingByLocalName ( this.constructor.NODENAME_TABBOX );\r\n\t//this.addActionListener ( ButtonBinding.ACTION_COMMAND, this );\r\n\t\r\n\tvar span = this.bindingDocument.createElement ( \"span\" );\r\n\tspan.appendChild ( this.bindingDocument.createTextNode ( TabsButtonBinding.CHAR_INDICATOR ));\r\n\tspan.className = \"arrow\";\r\n\tthis.labelBinding.bindingElement.appendChild ( span );\r\n}\r\n\r\n/**\r\n * Show tabmanager. Automaticaly updates tabbutton tabcount.\r\n * @overwrites {Binding#show}\r\n * @param {int} xposition\r\n */\r\nTabsButtonBinding.prototype.show = function ( xposition ) {\r\n\r\n\tthis.bindingElement.style.left = xposition + \"px\";\r\n\tthis.setLabel ( \r\n\t\tthis.hiddenTabBindings.getLength ().toString ()\r\n\t);\r\n\tTabsButtonBinding.superclass.show.call ( this );\r\n}\r\n\r\n/**\r\n * Hide the button while resizing window horizontally. \r\n * TODO: find ud af det!\r\n * @implements {IResizeHandler}\r\n *\r\nTabsButtonBinding.prototype.fireOnResize = function () {\r\n\r\n\tvar width = this.bindingWindow.WindowManager.getWindowDimensions ().w;\r\n\tif ( this.isVisible && width != this.snapshotWindowWidth ) {\r\n\t\tthis.hide ();\r\n\t}\r\n\tthis.snapshotWindowWidth = width;\r\n}\r\n*/\r\n\r\n/**\r\n * This method is invoked by the {@link TabsBinding}\r\n */\r\nTabsButtonBinding.prototype.reset = function () {\r\n\t\r\n\tif ( this.menuItemBindings.hasEntries ()) {\r\n\t\twhile ( this.menuItemBindings.hasNext ()) {\r\n\t\t\tthis.menuItemBindings.getNext ().dispose ();\r\n\t\t}\r\n\t}\r\n\tthis.hiddenTabBindings.clear ();\r\n\tthis.menuItemBindings.clear ();\r\n\tthis.selectedTabBinding = null;\r\n\tthis.isPopulated = false;\r\n}\r\n\r\n/**\r\n * @param {TabBinding} tabBinding\r\n */\r\nTabsButtonBinding.prototype.registerHiddenTabBinding = function ( tabBinding ) {\r\n\r\n\tthis.hiddenTabBindings.add ( tabBinding );\r\n}\r\n\r\n/**\r\n * Overloads {ButtonBinding#fireCommand}\r\n */\r\nTabsButtonBinding.prototype.fireCommand = function () {\r\n\t\r\n\tif ( this.isChecked && !this.isPopulated ) {\t\r\n\t\tthis.hiddenTabBindings.reset ();\r\n\t\twhile ( this.hiddenTabBindings.hasNext ()) {\r\n\t\t\tvar tabBinding = this.hiddenTabBindings.getNext ();\r\n\t\t\tvar item = MenuItemBinding.newInstance ( \r\n\t\t\t\tthis.popupBinding.bindingDocument \r\n\t\t\t);\r\n\t\t\titem.setLabel ( tabBinding.getLabel ());\r\n\t\t\titem.setImage ( tabBinding.getImage ());\t\r\n\t\t\titem.associatedTabBinding = tabBinding;\r\n\t\t\tvar self = this;\r\n\t\t\titem.oncommand = function () {\r\n\t\t\t\tself.selectedTabBinding = this.associatedTabBinding;\r\n\t\t\t}\r\n\t\t\tthis.popupBinding.add ( item );\r\n\t\t\tthis.menuItemBindings.add ( item );\r\n\t\t\t\r\n\t\t\tthis.popupBinding.attachRecursive ();\r\n\t\t}\r\n\t\tthis.isPopulated = true;\r\n\t}\r\n\t\r\n\tthis.popupBinding.addActionListener ( PopupBinding.ACTION_HIDE, this );\r\n\tTabsButtonBinding.superclass.fireCommand.call ( this );\r\n}\r\n\r\n/**\r\n * Make the selected tabBinding visible!\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nTabsButtonBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tTabsButtonBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase PopupBinding.ACTION_HIDE :\r\n\t\t\tthis.popupBinding.removeActionListener ( PopupBinding.ACTION_HIDE, this );\r\n\t\t\tvar tabBinding = this.selectedTabBinding;\r\n\t\t\tif ( tabBinding ) {\r\n\t\t\t\tthis.containingTabBoxBinding.moveToOrdinalPosition ( tabBinding, 0 );\r\n\t\t\t\tthis.containingTabBoxBinding.select ( tabBinding );\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * TabsButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TabsButtonBinding}\r\n */\r\nTabsButtonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar toolbarbutton = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbarbutton\", ownerDocument );\r\n\ttoolbarbutton.setAttribute ( \"type\", \"checkbox\" );\r\n\ttoolbarbutton.setAttribute ( \"popup\", \"app.bindingMap.tabsbuttonpopup\" );\t\r\n\ttoolbarbutton.className = \"tabbutton\";\r\n\treturn UserInterface.registerBinding ( toolbarbutton, TabsButtonBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/theatre/TheatreBinding.js",
    "content": "TheatreBinding.prototype = new Binding;\r\nTheatreBinding.prototype.constructor = TheatreBinding;\r\nTheatreBinding.superclass = Binding.prototype;\r\n\r\nTheatreBinding.CLASSNAME_INITIALIZED = \"initialized\";\r\n\r\n/**\r\n * @class\r\n * The TheatreBinding currently handles only one scenario: The server offline show.\r\n */\r\nfunction TheatreBinding () {\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isPlaying = false;\r\n\t\r\n\t/**\r\n\t * Don't use fade while the browser is negoatiating a HTTP connection.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isFading = false;\r\n\t\r\n\t/**\r\n\t * @type {HTMLCanvasElement}\r\n\t */\r\n\tthis._canvas = null;\r\n\t\r\n\t/*\r\n\t * Returnable \r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding\r\n * @return {string}\r\n */\r\nTheatreBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[TheatreBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTheatreBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tTheatreBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis._canvas = document.createElement ( \"canvas\" );\r\n\tthis.bindingElement.appendChild ( this._canvas );\r\n}\r\n\r\n/**\r\n * Play.\r\n */\r\nTheatreBinding.prototype.play = function ( isFading ) {\r\n\t\r\n\tthis._isFading = isFading == true;\r\n\t\r\n\tif ( !this._isPlaying ) {\r\n\t\tApplication.lock ( this );\r\n\t\tthis.show ();\r\n\t\tthis._isPlaying = true;\r\n\t\tif ( this._isFading ) {\r\n\t\t\tthis._fade ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\nTheatreBinding.prototype._fade = function () {\r\n\t\r\n\tvar context = this._canvas.getContext ( \"2d\" );\r\n\tvar alpha = parseInt ( 0 );\r\n\r\n\tTheatreBinding._interval = top.setInterval ( function () {\r\n\t\tif ( alpha < 0.5 ) {\r\n\t\t\tcontext.fillStyle = \"rgba(0,0,0,\" + new String ( alpha ) + \")\";\r\n\t\t\tcontext.clearRect ( 0, 0, 300, 150 );\r\n\t\t\tcontext.fillRect ( 0, 0, 300, 150 );\r\n\t\t\talpha += 0.002;\r\n\t\t} else {\r\n\t\t\ttop.clearInterval ( TheatreBinding._interval );\r\n\t\t\tTheatreBinding._interval = null;\r\n\t\t}\r\n\t}, 50 );\r\n}\r\n\r\n/**\r\n * Stop.\r\n */\r\nTheatreBinding.prototype.stop = function () {\r\n\t\r\n\tif ( this._isPlaying ) {\r\n\t\t\r\n\t\tif ( this._isFading ) {\r\n\t\t\tif ( TheatreBinding._interval != null ) {\r\n\t\t\t\ttop.clearInterval ( TheatreBinding._interval );\r\n\t\t\t}\r\n\t\t\tvar context = this._canvas.getContext ( \"2d\" );\r\n\t\t\tcontext.clearRect ( 0, 0, 300, 150 );\r\n\t\t}\r\n\t\t\r\n\t\tApplication.unlock ( this, true ); // boolean arg because Explorer may stay locked...\r\n\t\tthis.hide ();\r\n\t\tthis._isPlaying = false;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/toolbars/DialogToolBarBinding.js",
    "content": "DialogToolBarBinding.prototype = new ToolBarBinding;\r\nDialogToolBarBinding.prototype.constructor = DialogToolBarBinding;\r\nDialogToolBarBinding.superclass = ToolBarBinding.prototype;\r\n\r\n/**\r\n * @class\r\n * TODO: move this file somewhere else...\r\n */\r\nfunction DialogToolBarBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"DialogToolBarBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {List<ClickButtonBinding>}\r\n\t */\r\n\tthis._buttons = null;\r\n\t\r\n\t/**\r\n\t * @type {ClickButtonBinding}\r\n\t */\r\n\tthis._defaultButton = null;\r\n\t\r\n\t/**\r\n\t * @type {ClickButtonBinding}\r\n\t */\r\n\tthis._focusedButton = null;\r\n\t\r\n\t/** \r\n\t * Listening for ENTER keypress?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isListening = false;\r\n\t\r\n\t/**\r\n\t * ALLOW focuscrawler! It was blocked by super class.\r\n\t * @overwrites {ToolBarBinding#crawlerFilters}\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nDialogToolBarBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[DialogToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {ToolBarBinding#onBindingRegister}\r\n */\r\nDialogToolBarBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tDialogToolBarBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis.addActionListener ( Binding.ACTION_FOCUSED );\r\n\tthis.addActionListener ( Binding.ACTION_BLURRED );\r\n}\r\n\r\n/**\r\n * @overloads {ToolBarBinding#onBindingDispose}\r\n */\r\nDialogToolBarBinding.prototype.onBindingDispose = function () {\r\n\r\n\tDialogToolBarBinding.superclass.onBindingDispose.call ( this );\r\n\tif ( this._isListening == true ) {\r\n\t\tthis.unsubscribe ( BroadcastMessages.KEY_ENTER );\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {ToolBarBinding#onBindingInitialize}\r\n */\r\nDialogToolBarBinding.prototype.onBindingInitialize = function () {\r\n\t\r\n\tthis.indexDialogButtons ();\r\n\tDialogToolBarBinding.superclass.onBindingInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Index dialog buttons. Invoke this manually when adding new buttons.\r\n */\r\nDialogToolBarBinding.prototype.indexDialogButtons = function () {\r\n\r\n\tvar buttons = this.getDescendantBindingsByLocalName ( \"clickbutton\" );\r\n\t\r\n\tif ( buttons.hasEntries ()) {\r\n\t\twhile ( buttons.hasNext ()) {\r\n\t\t\tvar button = buttons.getNext ();\r\n\t\t\tif ( button.isDefault ) {\r\n\t\t\t\tthis._defaultButton = button;\r\n\t\t\t\tbutton.attachClassName ( ButtonBinding.CLASSNAME_DEFAULT );\r\n\t\t\t}\r\n\t\t\tif ( !this._isListening && button.isFocusable ) {\r\n\t\t\t\tthis.subscribe ( BroadcastMessages.KEY_ENTER );\r\n\t\t\t\tthis._isListening = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis._buttons = buttons;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nDialogToolBarBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tDialogToolBarBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.KEY_ENTER :\r\n\t\t\t\r\n\t\t\t/*\r\n\t\t\t * Don't close the dialog while a popup is handled!\r\n\t\t\t */\r\n\t\t\tif ( !PopupBinding.hasActiveInstances () && !EditorBinding.isActive ) {\r\n\t\t\t\t\r\n\t\t\t\t/*\r\n\t\t\t\t * Only close active dialogs (don't close a chain of dialogs)!\r\n\t\t\t\t */\r\n\t\t\t\tif ( Binding.exists ( this )) {\r\n\t\t\t\t\tvar dialog = this.getAncestorBindingByType ( DialogBinding, true );\r\n\t\t\t\t\tif ( dialog != null && dialog.isActive ) {\r\n\t\t\t\t\t\tif ( this._focusedButton != null ) {\r\n\t\t\t\t\t\t\tif ( !this._focusedButton.isDisabled ) {\r\n\t\t\t\t\t\t\t\tthis.unsubscribe ( BroadcastMessages.KEY_ENTER );\r\n\t\t\t\t\t\t\t\tthis._focusedButton.fireCommand ();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif ( !this._defaultButton.isDisabled ) {\r\n\t\t\t\t\t\t\t\tthis.unsubscribe ( BroadcastMessages.KEY_ENTER );\r\n\t\t\t\t\t\t\t\tthis._defaultButton.fireCommand ();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.logger.error ( \"Ouch: DialogToolBarBinding#handleBroadcast\" );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nDialogToolBarBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tDialogToolBarBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\tvar isFocused = false;\r\n\tvar buttons = this._buttons.reset ();\r\n\t\r\n\tif ( binding instanceof ClickButtonBinding ) {\r\n\t\tswitch ( action.type ) {\r\n\t\t\tcase Binding.ACTION_FOCUSED :\r\n\t\t\t\tbinding.attachClassName ( ButtonBinding.CLASSNAME_FOCUSED );\r\n\t\t\t\tthis._focusedButton = binding;\r\n\t\t\t\tif ( this._defaultButton ) {\r\n\t\t\t\t\tthis._defaultButton.detachClassName ( ButtonBinding.CLASSNAME_DEFAULT );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase Binding.ACTION_BLURRED :\r\n\t\t\t\tbinding.detachClassName ( ButtonBinding.CLASSNAME_FOCUSED );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * When focus leaves the toolbar, restore default focus.\r\n\t */\r\n\tif ( this._defaultButton ) {\r\n\t\twhile ( !isFocused && buttons.hasNext ()) {\r\n\t\t\tvar button = buttons.getNext ();\r\n\t\t\tisFocused = button.isFocused;\r\n\t\t}\r\n\t\tif ( !isFocused ) {\r\n\t\t\tthis._defaultButton.attachClassName ( ButtonBinding.CLASSNAME_DEFAULT );\r\n\t\t\tthis._focusedButton = null;\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/toolbars/ToolBarBinding.js",
    "content": "ToolBarBinding.prototype = new Binding;\r\nToolBarBinding.prototype.constructor = ToolBarBinding;\r\nToolBarBinding.superclass = Binding.prototype;\r\n\r\nToolBarBinding.TYPE_TEXTONLY\t\t\t\t= \"textonly\";\r\nToolBarBinding.TYPE_IMAGESONLY\t\t\t\t= \"imagesonly\";\r\nToolBarBinding.TYPE_DEFAULT\t\t\t\t\t= \"imagesandtext\";\r\nToolBarBinding.CLASSNAME_TEXTONLY \t\t\t= \"textonly\";\r\nToolBarBinding.CLASSNAME_IMAGESONLY \t\t= \"imagesonly\";\r\nToolBarBinding.CLASSNAME_IMAGESIZELARGE \t= \"imagesizelarge\";\r\nToolBarBinding.CLASSNAME_IMAGESIZEXLARGE    = \"imagesizexlarge\";\r\nToolBarBinding.CLASSNAME_ICONSIZE_22        = \"icons-s-22\";\r\nToolBarBinding.IMAGESIZE_NORMAL \t\t\t= \"normal\";\r\nToolBarBinding.IMAGESIZE_LARGE \t\t\t\t= \"large\";\r\nToolBarBinding.ICONSIZE_22                  = \"icons-s-22\";\r\n\r\n/**\r\n * @class\r\n * TODO: The toolbar is rigged up for quick disabling of images \r\n * and text. This feature may be refactored out at some point...\r\n */\r\nfunction ToolBarBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ToolBarBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasImages = true;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasText = true;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._imageSize = ToolBarBinding.IMAGESIZE_NORMAL;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.type = ToolBarBinding.TYPE_DEFAULT;\r\n\t\r\n\t/**\r\n\t * Used to impose a default height to the toolbar.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasDefaultContent = true;\r\n\t\r\n\t/**\r\n\t * Right-aligned toolbarbody.\r\n\t * @type {ToolBarBodyBinding}\r\n\t * @private\r\n\t */\r\n\tthis._toolBarBodyRight = null;\r\n\t\r\n\t/**\r\n\t * Left-aligned toolbarbody.\r\n\t * @type {ToolBarBodyBinding}\r\n\t * @private\r\n\t */\r\n\tthis._toolBarBodyLeft = null;\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID, FocusCrawler.ID, FitnessCrawler.ID ]);\r\n\t\r\n\t/**\r\n\t * Enables us to invoke buildDOMContent already on binding registration. \r\n\t * This will come in handy when toolbar content is setup for lazy attachment.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasDOMContent = false;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nToolBarBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ToolBarBinding]\";\r\n}\r\n\r\n/**\r\n * Attach classname to clear stylesheet floats.\r\n */\r\nToolBarBinding.prototype.onBindingRegister = function () {\r\n\t\r\n\tToolBarBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.attachClassName ( Binding.CLASSNAME_CLEARFLOAT );\r\n}\r\n\r\n/**\r\n * Initialize layout settings.\r\n */\r\nToolBarBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tToolBarBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.parseDOMProperties ();\r\n\tthis.buildDOMContent ();\r\n\t\r\n\tthis.addMembers (\r\n\t\tthis.getChildBindingsByLocalName ( \"toolbarbody\" )\r\n\t);\r\n}\r\n\r\n/**\r\n * Invoked when toolbarbodys initialize. Indexes left and right \r\n * toolbarbody. More bodys can be added, but we don't handle them.\r\n * @param {ToolBarBodyBinding} binding\r\n */\r\nToolBarBinding.prototype.onMemberInitialize = function ( binding ) {\r\n\t\r\n\t/*\r\n\t * The left toolbarbody is the first toolbar encounted NOT righ-taligned.\r\n\t * The right toolbarbody is the first right-aligned toolbar encountered.\r\n\t */\r\n\tif ( binding instanceof ToolBarBodyBinding ) {\r\n\t\tif ( binding.isRightAligned ) {\r\n\t\t\tif ( !this._toolBarBodyRight ) {\r\n\t\t\t\tthis._toolBarBodyRight = binding;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif ( !this._toolBarBodyLeft ) {\r\n\t\t\t\tthis._toolBarBodyLeft = binding;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tToolBarBinding.superclass.onMemberInitialize.call ( this, binding );\r\n}\r\n\r\n/**\r\n * Initialize toolbar size and type.\r\n */\r\nToolBarBinding.prototype.parseDOMProperties = function () {\r\n\r\n\tvar imagesize = this.getProperty ( \"imagesize\" );\r\n\tvar type = this.getProperty ( \"type\" );\r\n\t\r\n\tif ( imagesize ) {\r\n\t\tthis.setImageSize ( imagesize );\r\n\t}\r\n\tif ( type ) {\r\n\t\tthis.setType ( type );\r\n\t} else {\r\n\t\tthis.setType ( this.type );\r\n\t}\r\n}\r\n\r\n/**\r\n * Build an invisible toolbargroup to set the default toolbar height. This way, \r\n * we don't need to specify a fixed toolbar height; we can let toolbarbuttons \r\n * padding and margin control the height. Notice that the group is added directly \r\n * to the toolbar itself and not to a toolbarbody. This way, the toolbargroup can \r\n * be ignored in future code, but it implies that toolbarbodies *should not* affect \r\n * the height of the toolbar (they should have no borders, margins and paddings).\r\n */\r\nToolBarBinding.prototype.buildDOMContent = function () {\r\n\t\r\n\tif ( this._hasDefaultContent == true && !this._hasDOMContent ) {\r\n\t\tvar groupBinding = ToolBarGroupBinding.newInstance ( this.bindingDocument );\r\n\t\tgroupBinding.add ( ToolBarButtonBinding.newInstance ( this.bindingDocument ));\r\n\t\tgroupBinding.isDefaultContent = true;\r\n\t\tthis.add ( groupBinding );\r\n\t\tgroupBinding.attachRecursive ();\r\n\t\tthis._hasDOMContent = true;\r\n\t\t\r\n\t}\r\n}\r\n\r\n/**\r\n * A special classname \"max\" will maximize a toolbargroups width.\r\n * @implements {IFlexible}\r\n */\r\nToolBarBinding.prototype.flex = function () {\r\n\t\r\n\tvar left = this._toolBarBodyLeft;\r\n\tvar right = this._toolBarBodyRight;\r\n\t\r\n\tif ( left != null && left.hasClassName ( \"max\" )) {\r\n\t\tthis._maxToolBarGroup ( left, right );\r\n\t}\r\n\t\r\n\tif ( right != null && right.hasClassName ( \"max\" )) {\r\n\t\tthis._maxToolBarGroup ( right, left );\r\n\t}\r\n}\r\n\r\n/**\r\n * This is pretty hacked...\r\n * @param {ToolBarGroupBinding} max\r\n * @param {ToolBarGroupBinding} other\r\n */\r\nToolBarBinding.prototype._maxToolBarGroup = function ( max, other ) {\r\n\t\r\n\tvar width = this.boxObject.getDimension ().w;\r\n\tvar padding = CSSComputer.getPadding ( this.bindingElement );\r\n\twidth -= ( padding.left + padding.right );\r\n\tif ( other != null ) {\r\n\t\twidth -= other.boxObject.getDimension ().w;\r\n\t\tif ( !Client.isWindows ) {\r\n\t\t\twidth -= 1; // eh!\r\n\t\t}\r\n\t\tif ( Client.isExplorer ) {\r\n\t\t\twidth -= 15; // // eeeeeeeeeeeeeeeeeeh!\r\n\t\t}\r\n\t}\r\n\t\r\n\tmax.bindingElement.style.width = width + \"px\";\r\n}\r\n\r\n/**\r\n * Handy fetch toolbargroup by index.\r\n * @param {int} index \r\n * @return {ToolBarGroupBinding}\r\n */\r\nToolBarBinding.prototype.getToolBarGroupByIndex = function ( index ) {\r\n\t\r\n\treturn this.getDescendantBindingsByLocalName ( \"toolbargroup\" ).get ( index );\r\n}\r\n\r\n/**\r\n * Add toolbargroup left-aligned.\r\n * @param {Binding} binding\r\n * @param {boolean} isBulkAdd Minimize css engine work\r\n * @return {Binding}\r\n */\r\nToolBarBinding.prototype.addLeft = function ( binding, isBulkAdd ) {\r\n\r\n\tvar returnable = null;\r\n\tif ( this._toolBarBodyLeft != null ) {\r\n\t\treturnable = this._toolBarBodyLeft.add ( binding, isBulkAdd );\r\n\t} else {\r\n\t\tthrow new Error ( \"No left toolbarbody\" );\r\n\t}\r\n\treturn returnable;\r\n}\r\n\r\n/**\r\n * Add toolbargroup left-aligned first.\r\n * @param {Binding} binding\r\n * @param {boolean} isBulkAdd\r\n * @return {Binding}\r\n */\r\nToolBarBinding.prototype.addLeftFirst = function ( binding, isBulkAdd ) {\r\n\r\n\tvar returnable = null;\r\n\tif ( this._toolBarBodyLeft ) {\r\n\t\treturnable = this._toolBarBodyLeft.addFirst ( binding, isBulkAdd );\r\n\t} else {\r\n\t\tthrow new Error ( \"No left toolbarbody\" );\r\n\t}\r\n\treturn returnable;\r\n}\r\n\r\n/**\r\n * Add toolbargroup right-aligned.\r\n */\r\nToolBarBinding.prototype.addRight = function ( binding ) {\r\n\r\n\tvar returnable = null;\r\n\tif ( this._toolBarBodyRight ) {\r\n\t\treturnable = this._toolBarBodyRight.add ( binding );\r\n\t} else {\r\n\t\tthrow new Error ( \"No left toolbarbody\" );\r\n\t}\r\n\treturn returnable;\r\n}\r\n\r\n/**\r\n * Please dispose toolbar content with this method, taking care not to dispose toolbarbodies.\r\n */\r\nToolBarBinding.prototype.empty = function () {\r\n\r\n\tthis.emptyLeft ();\r\n\tthis.emptyRight ();\r\n}\r\n\r\n/**\r\n * Dispose left-aligned toolbar content.\r\n */\r\nToolBarBinding.prototype.emptyLeft = function () {\r\n\r\n\tif ( this._toolBarBodyLeft ) {\r\n \t\tthis._toolBarBodyLeft.empty ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispose right-aligned toolbar content.\r\n */\r\nToolBarBinding.prototype.emptyRight = function () {\r\n\r\n\tif ( this._toolBarBodyRight ) {\r\n \t\tthis._toolBarBodyRight.empty ();\r\n\t}\r\n}\r\n\r\n/** \r\n * Set image size.\r\n * @param {string} size\r\n */\r\nToolBarBinding.prototype.setImageSize = function ( size ) {\r\n\r\n\tswitch ( size ) {\r\n\t\tcase ToolBarBinding.IMAGESIZE_LARGE :\r\n\t\t\tthis.attachClassName ( ToolBarBinding.CLASSNAME_IMAGESIZELARGE );\r\n\t\t\tthis.detachClassName ( ToolBarBinding.CLASSNAME_IMAGESIZEXLARGE );\r\n\t\t\tbreak;\r\n\t\tcase ToolBarBinding.IMAGESIZE_XLARGE :\r\n\t\t\tthis.attachClassName ( ToolBarBinding.CLASSNAME_IMAGESIZEXLARGE );\r\n\t\t\tthis.detachClassName ( ToolBarBinding.CLASSNAME_IMAGESIZELARGE );\r\n\t\t\tbreak;\r\n\t    case ToolBarBinding.ICONSIZE_22:\r\n\t        this.attachClassName(ToolBarBinding.CLASSNAME_ICONSIZE_22);\r\n\t        break;\r\n\t\tdefault :\r\n\t\t\tthis.detachClassName ( ToolBarBinding.CLASSNAME_IMAGESIZELARGE );\r\n\t\t\tthis.detachClassName ( ToolBarBinding.CLASSNAME_IMAGESIZEXLARGE );\r\n\t\t\tbreak;\r\n\t}\r\n\tthis._imageSize = size;\r\n\tthis.setProperty ( \"imagesize\", size );\r\n}\r\n\r\n/**\r\n * @return {string}\r\n */\r\nToolBarBinding.prototype.getImageSize = function () {\r\n\t\r\n\treturn this._imageSize;\r\n}\r\n\r\n/** \r\n * Show images only. Constructed so that you can't disable both images and text.\r\n */\r\nToolBarBinding.prototype.showImagesOnly = function () {\r\n\t\r\n\tthis.detachClassName ( ToolBarBinding.CLASSNAME_TEXTONLY );\r\n\tthis.attachClassName ( ToolBarBinding.CLASSNAME_IMAGESONLY );\r\n\tthis.hasImages = true;\r\n\tthis.hasText = false;\r\n}\r\n\r\n/**\r\n * Show text only.\r\n */\r\nToolBarBinding.prototype.showTextOnly = function () {\r\n\t\r\n\tthis.detachClassName ( ToolBarBinding.CLASSNAME_IMAGESONLY );\r\n\tthis.attachClassName ( ToolBarBinding.CLASSNAME_TEXTONLY );\r\n\tthis.hasImages = false;\r\n\tthis.hasText = true;\r\n}\r\n\r\n/**\r\n * Show both images and text.\r\n */\r\nToolBarBinding.prototype.showBoth = function () {\r\n\t\r\n\tthis.detachClassName ( ToolBarBinding.CLASSNAME_IMAGESONLY );\r\n\tthis.detachClassName ( ToolBarBinding.CLASSNAME_TEXTONLY );\r\n\tthis.hasImages = true;\r\n\tthis.hasText = true;\r\n}\r\n\r\n/**\r\n * Set type.\r\n * @param {string} type \n */\r\nToolBarBinding.prototype.setType = function ( type ) {\r\n\t\r\n\tswitch ( type ) {\r\n\t\tcase ToolBarBinding.TYPE_TEXTONLY :\r\n\t\t\tthis.showTextOnly ();\r\n\t\t\tbreak;\r\n\t\tcase ToolBarBinding.TYPE_IMAGESONLY :\r\n\t\t\tthis.showImagesOnly ();\r\n\t\t\tbreak;\r\n\t\tdefault :\r\n\t\t\tthis.showBoth ();\r\n\t\t\tbreak\r\n\t}\r\n\tthis.setProperty ( \"type\", type );\r\n}\r\n\r\n/**\r\n * ToolBarBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ToolBarBinding}\r\n */\r\nToolBarBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbar\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, ToolBarBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/toolbars/ToolBarBodyBinding.js",
    "content": "ToolBarBodyBinding.prototype = new Binding;\r\nToolBarBodyBinding.prototype.constructor = ToolBarBodyBinding;\r\nToolBarBodyBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ToolBarBodyBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ToolBarBodyBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isRightAligned = false;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nToolBarBodyBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ToolBarBodyBinding]\";\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nToolBarBodyBinding.prototype.onBindingAttach = function () {\r\n\r\n\tToolBarBodyBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.addMembers (\r\n\t\tthis.getChildBindingsByLocalName ( \"toolbargroup\" )\r\n\t);\r\n\tif ( this.getProperty ( \"align\" ) == \"right\" || this.isRightAligned ) {\r\n\t\tthis.alignRight ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Fires when children toolbargroups are initialized.\r\n * @overloads {Binding#onBindingInitialize}\r\n */\r\nToolBarBodyBinding.prototype.onBindingInitialize = function () {\r\n\r\n\tthis.refreshToolBarGroups ();\r\n\tToolBarBodyBinding.superclass.onBindingInitialize.call ( this );\r\n}\r\n\r\n/**\r\n * Invoke right-aligned layout.\r\n */\r\nToolBarBodyBinding.prototype.alignRight = function () {\r\n\r\n\tthis.attachClassName ( \"alignright\" );\r\n\tthis.setProperty ( \"align\", \"right\" );\r\n\tthis.isRightAligned = true;\r\n}\r\n\r\n\r\n/** \r\n * Refresh the visual appearance of toolbargroups. \r\n * First and last group shall not show toolbarseparators. \r\n * Explorer cannot fix this using CSS in retarded rendering mode.\r\n */\r\nToolBarBodyBinding.prototype.refreshToolBarGroups = function () {\r\n\r\n\tvar allGroups = this.getDescendantBindingsByLocalName ( \"toolbargroup\" );\r\n\tvar groups = new List ();\r\n\tvar isFirst = true;\r\n\t\r\n\t/*\r\n\t * Only counting visible groups. \r\n\t * Not counting default content.\r\n\t */\r\n\tallGroups.each ( function ( group ) {\r\n\t\tif ( group.isVisible && !group.isDefaultContent ) {\r\n\t\t\tgroups.add ( group );\r\n\t\t}\r\n\t});\r\n\t\r\n\twhile ( groups.hasNext ()) {\r\n\t\tvar group = groups.getNext ();\r\n\t\tgroup.setLayout ( ToolBarGroupBinding.LAYOUT_DEFAULT );\r\n\t\tif ( isFirst ) {\r\n\t\t\tgroup.setLayout ( ToolBarGroupBinding.LAYOUT_FIRST );\r\n\t\t\tisFirst = false;\r\n\t\t}\r\n\t\tif ( !groups.hasNext ()) {\r\n\t\t\tgroup.setLayout ( ToolBarGroupBinding.LAYOUT_LAST );\r\n\t\t}\r\n\t};\r\n\t\r\n\tif ( this.getProperty ( \"equalsize\" )) {\r\n\t\tthis.enforceEqualSize ();\r\n\t}\r\n}\r\n\r\n/**\r\n * TODO: cache max?\r\n * TODO: enable equalsize for toolbarbuttons (not just clickbuttons)? But we only use this in dialogs...\r\n */\r\nToolBarBodyBinding.prototype.enforceEqualSize = function () {\r\n\t\r\n\tvar max = 0, list = this.getDescendantBindingsByLocalName ( \"clickbutton\" );\r\n\t\r\n\twhile ( list.hasNext ()) {\r\n\t\tvar button = list.getNext ();\r\n\t\tvar width = button.getEqualSizeWidth ();\r\n\t\tif ( width > max ) {\r\n\t\t\tmax = width;\r\n\t\t}\r\n\t}\r\n\tif ( max != 0 ) {\r\n\t\tlist.reset ();\r\n\t\twhile ( list.hasNext ()) {\r\n\t\t\tvar button = list.getNext ();\r\n\t\t\tbutton.setEqualSizeWidth ( max );\t\t\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispose toolbarbody content.\r\n */\r\nToolBarBodyBinding.prototype.empty = function () {\r\n\t\r\n\tthis.detachRecursive ();\r\n\tthis.bindingElement.innerHTML = \"\";\r\n}\r\n\r\n/**\r\n * Update layout when new toolbargroup is added. \r\n * @overwrites {Binding#add}\r\n * @param {Binding} binding\r\n * @param {boolean} isBulkAdd Minimize css engine work\r\n * @return {Binding}\r\n */\r\nToolBarBodyBinding.prototype.add = function ( binding, isBulkAdd ) {\r\n\r\n\tvar returnable = ToolBarBinding.superclass.add.call ( this, binding );\r\n\tif ( !isBulkAdd ) {\r\n\t\tif ( binding instanceof ToolBarGroupBinding && this.isAttached ) {\r\n\t\t\tthis.refreshToolBarGroups ();\r\n\t\t}\r\n\t}\r\n\treturn returnable;\r\n}\r\n\r\n/**\r\n * Update layout when new toolbargroup is added.\r\n * @overwrites {Binding#addFirst}\r\n * @param {Binding} binding\r\n * @param {boolean} isBulkAdd\r\n * @return {Binding}\r\n */\r\nToolBarBodyBinding.prototype.addFirst = function ( binding, isBulkAdd ) {\r\n\r\n\tvar returnable = ToolBarBinding.superclass.addFirst.call ( this, binding );\r\n\tif ( !isBulkAdd ) {\r\n\t\tif ( binding instanceof ToolBarGroupBinding && this.isAttached ) {\r\n\t\t\tthis.refreshToolBarGroups ();\r\n\t\t}\r\n\t}\r\n\treturn returnable;\r\n}\r\n\r\n/**\r\n * This will enable or disable ALL contained bindings that implement IFocusable.\r\n * TODO: THIS IS NOT USED NOWHERE...\r\n * @param {boolean} isDisabled\r\n *\r\nToolBarBodyBinding.prototype.setDisabled = function ( isDisabled ) {\r\n\t\r\n\tvar bindings = this.getDescendantBindingsByLocalName ( \"*\" );\r\n\twhile ( bindings.hasNext ()) {\r\n\t\tvar binding = bindings.getNext ();\r\n\t\tif ( Interfaces.isImplemented ( IFocusable, binding )) {\r\n\t\t\tif ( typeof binding.setDisabled != Types.UNDEFINED ) {\r\n\t\t\t\tbinding.setDisabled ( isDisabled );\r\n\t\t\t} else {\r\n\t\t\t\tthrow \"Could not disable focusable \" + binding.toString ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n*/\r\n\r\n/**\r\n * ToolBarBodyBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ToolBarBodyBinding}\r\n */\r\nToolBarBodyBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbarbody\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, ToolBarBodyBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/toolbars/ToolBarButtonBinding.js",
    "content": "ToolBarButtonBinding.prototype = new ButtonBinding;\r\nToolBarButtonBinding.prototype.constructor = ToolBarButtonBinding;\r\nToolBarButtonBinding.superclass = ButtonBinding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ToolBarButtonBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ToolBarButtonBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nToolBarButtonBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ToolBarButtonBinding]\";\r\n}\r\n\r\n/**\r\n * ToolBarButtonBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ToolBarButtonBinding}\r\n */\r\nToolBarButtonBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbarbutton\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, ToolBarButtonBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/toolbars/ToolBarGroupBinding.js",
    "content": "ToolBarGroupBinding.prototype= new RadioGroupBinding;\r\nToolBarGroupBinding.prototype.constructor = ToolBarGroupBinding;\r\nToolBarGroupBinding.superclass = RadioGroupBinding.prototype;\r\n\r\nToolBarGroupBinding.LAYOUT_DEFAULT = 0;\r\nToolBarGroupBinding.LAYOUT_FIRST = 1;\r\nToolBarGroupBinding.LAYOUT_LAST = 2;\r\n\r\nToolBarGroupBinding.CLASSNAME_DEFAULTCONTENT = \"defaultcontent\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ToolBarGroupBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ToolBarGroupBinding\" );\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDefaultContent = false;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nToolBarGroupBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ToolBarGroupBinding]\";\r\n}\r\n\r\n/**\r\n * Assign special classname to defaultcontent toolbargroup.\r\n * Overloads {Binding#onBindingAttach}\r\n * @see {ToolBarBinding#addDefaultContent}\r\n */\r\nToolBarGroupBinding.prototype.onBindingAttach = function () {\r\n\r\n\tToolBarGroupBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tthis.addMembers (\r\n\t\tthis.getDescendantBindingsByLocalName ( \"toolbarbutton\" )\r\n\t);\r\n\tthis.addMembers (\r\n\t\tthis.getDescendantBindingsByLocalName ( \"toolbarlabel\" )\r\n\t);\r\n\tthis.addMembers (\r\n\t\tthis.getDescendantBindingsByLocalName ( \"clickbutton\" )\r\n\t);\r\n\tif ( this.isDefaultContent == true ) {\r\n\t\tthis.attachClassName ( ToolBarGroupBinding.CLASSNAME_DEFAULTCONTENT );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set layout. This method is invoked by the {@link ToolBarBodyBinding}.\r\n * @param {int} layout\r\n */\r\nToolBarGroupBinding.prototype.setLayout = function ( layout ) {\r\n\r\n\tswitch ( layout ) {\r\n\t\tcase ToolBarGroupBinding.LAYOUT_DEFAULT :\r\n\t\t\tthis.detachClassName ( \"first\" );\r\n\t\t\tthis.detachClassName ( \"last\" );\r\n\t\t\tbreak;\r\n\t\tcase ToolBarGroupBinding.LAYOUT_FIRST :\r\n\t\t\tthis.attachClassName ( \"first\" );\r\n\t\t\tbreak;\r\n\t\tcase ToolBarGroupBinding.LAYOUT_LAST :\r\n\t\t\tthis.attachClassName ( \"last\" );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Refresh toolbar layout when a group gets shown.\r\n * @overloads {Binding#show}\r\n */\r\nToolBarGroupBinding.prototype.show = function () {\r\n\r\n\tToolBarGroupBinding.superclass.show.call ( this );\r\n\tvar parent = this.bindingElement.parentNode;\r\n\tif ( DOMUtil.getLocalName ( parent ) == \"toolbarbody\" ) {\r\n\t\tUserInterface.getBinding ( parent ).refreshToolBarGroups ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Refresh toolbar layout when a group gets hidden.\r\n * @overloads {Binding#hide}\r\n */\r\nToolBarGroupBinding.prototype.hide = function () {\r\n\r\n\tToolBarGroupBinding.superclass.hide.call ( this );\r\n\tvar parent = this.bindingElement.parentNode;\r\n\tif ( DOMUtil.getLocalName ( parent ) == \"toolbarbody\" ) {\r\n\t\tUserInterface.getBinding ( parent ).refreshToolBarGroups ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispose toolbargroup content.\r\n */\r\nToolBarGroupBinding.prototype.empty = function () {\r\n\r\n\tthis.detachRecursive();\r\n\tthis.bindingElement.innerHTML = \"\";\r\n}\r\n\r\n/**\r\n * ToolBarGroupBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ToolBarGroupBinding}\r\n */\r\nToolBarGroupBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar toolbargroup = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbargroup\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( toolbargroup, ToolBarGroupBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/toolbars/ToolBarLabelBinding.js",
    "content": "ToolBarLabelBinding.prototype = new Binding;\r\nToolBarLabelBinding.prototype.constructor = ToolBarLabelBinding;\r\nToolBarLabelBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n * Simple text (and possibly an image) on the toolbar.\r\n */\r\nfunction ToolBarLabelBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ToolBarLabelBinding\" );\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nToolBarLabelBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[ToolBarLabelBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nToolBarLabelBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tToolBarLabelBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis._labelBinding = this.add ( LabelBinding.newInstance ( this.bindingDocument ));\r\n\tthis.shadowTree.label = this._labelBinding;\r\n\t\r\n\tvar label = this.getProperty ( \"label\" );\r\n\tvar image = this.getProperty ( \"image\" );\r\n\t\r\n\tif ( label ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\t\r\n\tif ( image ) {\r\n\t\tthis.setImage ( image );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n * @param {boolean} isNotBuildingClassName Set to true for faster screen update.\r\n */\r\nToolBarLabelBinding.prototype.setLabel = function ( label, isNotBuildingClassName ) {\r\n\t\r\n\tif ( this.isAttached ) {\r\n\t\tthis._labelBinding.setLabel ( label, isNotBuildingClassName );\r\n\t}\r\n\tthis.setProperty ( \"label\", label );\r\n}\r\n\r\n/**\r\n * Set image.\r\n * @param {string} image\r\n * @param {boolean} isNotBuildingClassName Set to true for faster screen update.\r\n */\r\nToolBarLabelBinding.prototype.setImage = function ( image, isNotBuildingClassName ) {\r\n\t\r\n\tif ( this.isAttached ) {\r\n\t\tthis._labelBinding.setImage ( image, isNotBuildingClassName );\r\n\t}\r\n\tthis.setProperty ( \"image\", image );\r\n}\r\n\r\n/**\r\n * ToolBarLabelBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ToolBarLabelBinding}\r\n */\r\nToolBarLabelBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:toolbarlabel\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, ToolBarLabelBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/trees/TreeBinding.js",
    "content": "TreeBinding.prototype = new FlexBoxBinding;\r\nTreeBinding.prototype.constructor = TreeBinding;\r\nTreeBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nTreeBinding.ACTION_SELECTIONCHANGED \t= \"tree selection changed\";\r\nTreeBinding.ACTION_NOSELECTION \t\t\t= \"tree selection none\";\r\nTreeBinding.SELECTIONTYPE_SINGLE \t\t= \"single\";\r\nTreeBinding.SELECTIONTYPE_MULTIPLE \t\t= \"multiple\";\r\n\r\n/**\r\n * Snap to nearest treenode position.\r\n * @param {int} value\r\n */\r\nTreeBinding.grid = function ( value ) {\r\n\t\r\n\tvar number = TreeNodeBinding.HEIGHT;\r\n\tvar ceil = Math.ceil ( value ); // TODO: Aren't we forgetting to use this?\r\n\tvar remainder = value % number;\r\n\tif ( remainder > 0 ) {\r\n\t\tvalue = value - remainder + number;\r\n\t}\r\n  \treturn value + TreeBodyBinding.PADDING_TOP;\r\n}\r\n\r\n\r\n\r\n/**\r\n * @class\r\n * @implements {IFocusable}\r\n */\r\nfunction TreeBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TreeBinding\" );\r\n\t\r\n\t/**\r\n\t * Disabled!!!\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocusable = true;\r\n\t\r\n\t/**\r\n\t * Disabled!!!\r\n\t * @implements {IFocusable}\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\t\r\n\t/**\r\n\t * @type {TreeBodyBinding}\r\n\t */\r\n\tthis._treeBodyBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {TreePositionIndicatorBinding}\r\n\t */\r\n\tthis._positionIndicatorBinding = null;\r\n\t\r\n\t/**\r\n\t * Added TreeNodes will be stored in this buffer \r\n\t * until the onBindingAttach method is called  \r\n\t * so that we can buld trees in off-DOM memory.\r\n\t */\r\n\tthis._treeNodeBuffer = null;\r\n\t\r\n\t/**\r\n\t * Tracking all treenodes present in the tree.\r\n\t * @param {Map<string><TreeNodeBinding>}\r\n\t */\r\n\tthis._treeNodeBindings = null;\r\n\r\n\t/**\r\n\t * TODO: Refactor this to a Map, maintaining a List is stressed out!\r\n\t * @type {List<TreeNodeBinding>}\r\n\t */\r\n\tthis._focusedTreeNodeBindings = null;\r\n\t\r\n\t/**\r\n\t * Are treenodes focusable?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isFocusable = true;\r\n\t\r\n\t/**\r\n\t * Special for tree selection stuff in dialogs. \r\n\t * Not to be confused with focusable stuff!\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isSelectable = false;\r\n\t\r\n\t/**\r\n\t * Special for tree selection stuff in dialogs.\r\n\t * @type {string>\r\n\t */\r\n\tthis._selectionProperty = null;\r\n\t\r\n\t/** \r\n\t * Special for tree selection stuff in dialogs.\r\n\t * @type {HashMap<string><boolean>}\r\n\t */\r\n\tthis._selectonValue = null;\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><TreeNodeBinding>}\r\n\t */\r\n\tthis._selectedTreeNodeBindings = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._selectionType = TreeBinding.SELECTIONTYPE_SINGLE;\r\n\t\r\n\t/**\r\n\t * @type {function}\r\n\t */\r\n\tthis._actionFilter = null;\r\n\t\r\n\t/**\r\n\t * @type {Position}\r\n\t */\r\n\tthis._acceptingPosition = null;\r\n\t\r\n\t/**\r\n\t * @type {Dimension}\r\n\t */\r\n\tthis._acceptingDimension = null;\r\n\t\r\n\t/**\r\n\t * @type {TreeNodeBinding}\r\n\t */\r\n\tthis._acceptingTreeNodeBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {HashMap<int><boolean>}\r\n\t */\r\n\tthis._acceptingPositions = null;\r\n\t\r\n\t/**\r\n\t * Block common crawlers.\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID, FocusCrawler.ID, FitnessCrawler.ID ]);\r\n\t\r\n\t/**\r\n\t * Intercepting keys for navigation?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasKeyboard = false;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._yposition = 0;\r\n\t\r\n\t/**\r\n\t * TEMP solution to backup treenodes open-state on UpdateManager refreshes.\r\n\t * @type {Map<String>}\r\n\t */\r\n\tthis._openTreeNodesBackupMap = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTreeBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TreeBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nTreeBinding.prototype.onBindingRegister = function () {\r\n\r\n\tTreeBinding.superclass.onBindingRegister.call ( this );\r\n\t\r\n\tthis._treeNodeBindings = new Map ();\r\n\tthis._treeNodeBuffer = new List ();\r\n\tthis._focusedTreeNodeBindings = new List ();\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTreeBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tTreeBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tvar focusable = this.getProperty ( \"focusable\" );\r\n\tif ( focusable != null ) {\r\n\t\tthis._isFocusable = focusable;\r\n\t}\r\n\r\n\tif (!this._treeBodyBinding && this.bindingElement.childElementCount === 0) {\r\n\t\tthis._treeBodyBinding = TreeBodyBinding.newInstance(this.bindingDocument);\r\n\t\tthis.bindingElement.appendChild(\r\n\t\t\tthis._treeBodyBinding.bindingElement\r\n\t\t);\r\n\t\tthis._treeBodyBinding.attach();\r\n\t}\r\n\r\n\tif ( !this._treeBodyBinding ) {\r\n\t\tthis._treeBodyBinding = this.addMember ( \r\n\t\t\tthis.getChildBindingByLocalName ( \"treebody\" )\r\n\t\t);\r\n\t}\r\n\tif ( !this._treeBodyBinding ) {\r\n\t\t\r\n\t\tvar cry = \"TreeBinding structure invalid. Missing TreeBodyBinding.\";\r\n\t\tthis.logger.error ( cry );\r\n\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\talert ( cry );\r\n\t\t}\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tthis.addActionListener ( Binding.ACTION_ACTIVATED );\r\n\t\tthis.addActionListener ( TreeNodeBinding.ACTION_OPEN );\r\n\t\tthis.addActionListener ( TreeNodeBinding.ACTION_CLOSE );\r\n\t\tthis.addActionListener ( TreeNodeBinding.ACTION_DISPOSE );\r\n\t\t\r\n\t\tif ( this._isFocusable ) {\r\n\t\t\tthis.addActionListener ( TreeNodeBinding.ACTION_ONFOCUS );\r\n\t\t\tthis.addActionListener ( TreeNodeBinding.ACTION_ONMULTIFOCUS );\r\n\t\t\tthis.addActionListener ( TreeNodeBinding.ACTION_BLUR );\r\n\t\t}\r\n\r\n\t\t// TODO: only if we contain typedraggable treenodes...\r\n\t\tthis.subscribe ( BroadcastMessages.TYPEDRAG_START );\r\n\t\tthis.subscribe ( BroadcastMessages.TYPEDRAG_STOP );\r\n\t\t\r\n\t\tthis.addEventListener ( DOMEvents.BEFOREUPDATE );\r\n\t\tthis.addEventListener ( DOMEvents.AFTERUPDATE );\r\n\t}\r\n}\r\n\r\n/**\r\n * Flush treenode buffer when the treebody is initalized. \r\n * Alternatively, populate tree from updatepanel builder.\r\n * @overloads {Binding#onBindingInitialize}\r\n */\r\nTreeBinding.prototype.onBindingInitialize = function () {\r\n\t\r\n\tTreeBinding.superclass.onBindingInitialize.call ( this );\r\n\t\r\n\tthis._setupTreeSelection ();\r\n\t\r\n\tvar builder = this.getProperty ( \"builder\" );\r\n\tif ( builder ) {\r\n\t\tthis._buildFromTextArea ( builder );\r\n\t} else if ( this._treeNodeBuffer.hasEntries ()) {\r\n\t\twhile ( this._treeNodeBuffer.hasNext ()) {\r\n\t\t\tthis.add ( this._treeNodeBuffer.getNext ());\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Setup selection.\r\n */\r\nTreeBinding.prototype._setupTreeSelection = function () {\r\n\r\n\tvar isSelectable = this.getProperty ( \"selectable\" );\r\n\tvar selectionProperty = this.getProperty ( \"selectionproperty\" );\r\n\tvar selectionValue = this.getProperty ( \"selectionvalue\" );\r\n\t\r\n\tif ( isSelectable ) {\r\n\t\tthis.setSelectable ( true );\r\n\t\tif ( selectionProperty ) {\r\n\t\t\tthis.setSelectionProperty ( selectionProperty );\r\n\t\t}\r\n\t\tif ( selectionValue ) {\r\n\t\t\tthis.setSelectionValue ( selectionValue );\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * This actually handles dragging, not selection. \r\n\t * TODO: only do this when treenodes are draggable.\r\n\t */\r\n\tthis._positionIndicatorBinding = this.add (\r\n\t\tTreePositionIndicatorBinding.newInstance ( \r\n\t\t\tthis.bindingDocument \r\n\t\t)\r\n\t)\r\n\tthis.shadowTree.positionIndicator = this._positionIndicatorBinding;\r\n\tthis._positionIndicatorBinding.attach ();\r\n}\r\n\r\n/**\r\n * Build tree content from textarea value. The value \r\n * value will be parsed into treenodes on each update.\r\n * TODO: Build an interface if we copy this setup...\r\n * @param {String} arg\r\n */\r\nTreeBinding.prototype._buildFromTextArea = function ( id ) {\r\n\t\r\n\tvar area = this.bindingDocument.getElementById ( id );\r\n\t\r\n\tif ( area != null ) {\r\n\t\t\r\n\t\tvar binding = UserInterface.getBinding ( area );\r\n\t\tvar treebody = this._treeBodyBinding;\r\n\t\tfunction build () {\r\n\t\t\ttreebody.subTreeFromString ( area.value );\r\n\t\t}\r\n\t\tbinding.addActionListener ( Binding.ACTION_UPDATED, {\r\n\t\t\thandleAction : function () {\r\n\t\t\t\tbuild ();\r\n\t\t\t}\r\n\t\t});\r\n\t\tsetTimeout ( build, 0 ); // timeout should really not be needed here...\r\n\t}\r\n}\r\n\r\n/**\r\n * Register treenode.\r\n * @param {TreeNodeBinding} treeNodeBinding\r\n */\r\nTreeBinding.prototype.registerTreeNodeBinding = function ( treeNodeBinding ) {\r\n\t\r\n\tvar handle = treeNodeBinding.getHandle ();\r\n\tif ( this._treeNodeBindings.has ( handle )) {\r\n\t\tthrow \"Duplicate treenodehandles registered: \" + treeNodeBinding.getLabel ();\r\n\t} else {\r\n\t\tthis._treeNodeBindings.set ( handle, treeNodeBinding );\r\n\t\tvar map = this._openTreeNodesBackupMap;\r\n\t\tif ( map != null && map.has ( handle )) {\r\n\t\t\ttreeNodeBinding.open ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/** \r\n * Unregister treenode.\r\n * @param {TreeNodeBinding} treeNodeBinding\r\n */\r\nTreeBinding.prototype.unRegisterTreeNodeBinding = function ( treeNodeBinding ) {\r\n\t\r\n\tthis._treeNodeBindings.del ( treeNodeBinding.getHandle ());\r\n}\r\n\r\n/**\r\n * @param {string} handle\r\n * @return {TreeNodeBinding}\r\n */\r\nTreeBinding.prototype.getTreeNodeBindingByHandle = function ( handle ) {\r\n\t\r\n\tvar result = null;\r\n\tif ( this._treeNodeBindings.has ( handle )) {\r\n\t\tresult = this._treeNodeBindings.get ( handle );\r\n\t} else {\r\n\t\tthrow \"No such treenode: \" + handle;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Carefully engineered to blur any focused treenodes *before* a new focus is invoked. \r\n * @implements {IActionListener}\r\n * @overloads {FlexBoxBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nTreeBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tTreeBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\t\t\r\n\t\tcase TreeNodeBinding.ACTION_OPEN :\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase TreeNodeBinding.ACTION_CLOSE :\r\n\t\t\tthis._blurDescendantBindings ( binding ); \r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\r\n\t\tcase TreeNodeBinding.ACTION_ONFOCUS : \r\n\t\t\tthis._nodePrimary = binding;\r\n\t\t\tthis.focusSingleTreeNodeBinding ( binding );\r\n\t\t\tif ( !this.isFocused ) {\r\n\t\t\t\tthis.focus ();\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase TreeNodeBinding.ACTION_ONMULTIFOCUS :\r\n\t\t\tswitch ( this._selectionType ) {\r\n\t\t\t\tcase TreeBinding.SELECTIONTYPE_SINGLE :\r\n\t\t\t\t\tthis._nodePrimary = binding;\r\n\t\t\t\t\tthis.focusSingleTreeNodeBinding ( binding );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\tcase TreeBinding.SELECTIONTYPE_SINGLE :\r\n\t\t\t\t\tthis._nodeSecondary = binding;\r\n\t\t\t\t\tif ( !this._nodePrimary || this._nodeSecondary == this._nodePrimary ) {\r\n\t\t\t\t\t\tthis._nodePrimary = binding;\r\n\t\t\t\t\t\tthis.focusSingleTreeNodeBinding ( binding );\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.focusMultipeTreeNodeBindings (\r\n\t\t\t\t\t\t\tthis._getVisibleTreeNodeBindingsInRange ( \r\n\t\t\t\t\t\t\t\tthis._nodePrimary, \r\n\t\t\t\t\t\t\t\tthis._nodeSecondary \r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tif ( !this.isFocused ) {\r\n\t\t\t\tthis.focus ();\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase TreeNodeBinding.ACTION_DISPOSE :\r\n\t\t\t\r\n\t\t\tif ( binding.isFocused ) {\r\n\t\t\t\tthis.blurSelectedTreeNodes (); // TODO: handle multiple selections!!!!!\r\n\t\t\t}\r\n\t\t\t/*\r\n\t\t\tvar i = 0;\r\n\t\t\tthis._focusedTreeNodeBindings.reset ();\r\n\t\t\twhile ( this._focusedTreeNodeBindings.hasNext ()) {\r\n\t\t\t\tvar item = this._focusedTreeNodeBindings.getNext ();\r\n\t\t\t\tif ( item == binding ) {\r\n\t\t\t\t\tthis.blurSelectedTreeNodes (); // TODO: handle multiple selections!\r\n\t\t\t\t\t\r\n\t\t\t\t\t// blurSelected... will also clear this._focusedTreeNodeBindings!!! \r\n\t\t\t\t\t// REFACTOR THIS SOME DAY!\r\n\t\t\t\t\t//this._focusedTreeNodeBindings.del ( i );\r\n\t\t\t\t}\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\t\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase TreeNodeBinding.ACTION_BLUR :\r\n\t\t\t// TODO: this should update the _focusedTreeNodeBindings index \r\n\t\t\t// along with ACTION_DISPOSE - skip all manual bookkeeping!\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase Binding.ACTION_ACTIVATED :\r\n\t\t\tif ( !this.isFocused ) {\r\n\t\t\t\tthis.focus ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Collecting all *visible* treenodes between two \r\n * treenodes. The two treenodes are included in result.\r\n * @param {TreeNodeBinding} binding1\r\n * @param {TreeNodeBinding} binding2\r\n * @return {List<TreeNodeBinding>}\r\n */\r\nTreeBinding.prototype._getVisibleTreeNodeBindingsInRange = function ( binding1, binding2 ) {\r\n\t\r\n\t// TODO: move this stuff to TreeCrawler once we need it... \r\n\talert ( \"TreeBinding#_getVisibleTreeNodeBindingsInRange\" );\r\n\t\r\n\t/*\r\n\tvar ElementIterator = this.bindingWindow.ElementIterator;\r\n\tvar list = new List ();\r\n\tvar isCollecting = false;\r\n\tvar firstBinding = null;\r\n\t\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @ignore\r\n\t *\r\n\tfunction elementIteratorfilter ( element ) {\r\n\t\r\n\t\tvar returnable = true;\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\tif ( binding && binding instanceof TreeNodeBinding ) {\r\n\t\t\tif ( binding == binding1 || binding == binding2 ) {\r\n\t\t\t\tisCollecting = !isCollecting;\r\n\t\t\t\tif ( !firstBinding ) {\r\n\t\t\t\t\tfirstBinding = binding;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ( isCollecting ) {\r\n\t\t\t\tif ( binding.isContainer && !binding.isOpen ) {\r\n\t\t\t\t\treturnable = ElementIterator.SKIP_CHILDREN;\r\n\t\t\t\t}\r\n\t\t\t\tlist.add ( binding );\r\n\t\t\t} else if ( firstBinding ) {\r\n\t\t\t\tlist.add ( binding );\r\n\t\t\t\tfirstBinding = null;\r\n\t\t\t\treturnable = ElementIterator.STOP_ITERATION;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn returnable;\r\n\t}\r\n\t\r\n\tElementIterator.iterate ( \r\n\t\tthis._treeBodyBinding.getBindingElement (), \r\n\t\telementIteratorfilter\r\n\t);\r\n\treturn list;\r\n\t\r\n\t*/\r\n}\r\n\r\n/**\r\n * @param {TreeNodeBinding} binding;\r\n */\r\nTreeBinding.prototype.focusSingleTreeNodeBinding = function ( binding ) {\r\n\t\r\n\tif ( binding != null && !binding.isFocused ) {\r\n\t\t\r\n\t\tthis.blurSelectedTreeNodes ();\r\n\t\tthis._focusedTreeNodeBindings.add ( binding );\r\n\t\tbinding.invokeManagedFocus ();\r\n\t\t\r\n\t\tif ( this._isSelectable ) {\r\n\t\t\tthis._manageSelections ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * TODO: THIS HAS BEEN OUT OF USE, MAY NEED UPDATING...\r\n * @param {List} bindings;\r\n */\r\nTreeBinding.prototype.focusMultipeTreeNodeBindings = function ( bindings ) {\r\n\t\r\n\tthis.blurSelectedTreeNodes ();\r\n\twhile ( bindings.hasNext ()) {\r\n\t\tvar binding = bindings.getNext ();\r\n\t\tthis._focusedTreeNodeBindings.add ( binding );\r\n\t\tbinding.invokeManagedFocus ();\r\n\t}\r\n\t\r\n\tif ( this._isSelectable ) {\r\n\t\tthis._manageSelections ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Manage selections. Compare focused treenodes to selection criterias, \r\n * determine whether or not to dispatch a selectionchange action.\r\n */\r\nTreeBinding.prototype._manageSelections = function () {\r\n\t\r\n\tvar previous = this._selectedTreeNodeBindings;\r\n\tthis._selectedTreeNodeBindings = {};\r\n\tvar isSelectionChanged = false;\r\n\tvar newEntry = null;\r\n\t\r\n\tthis._focusedTreeNodeBindings.reset ();\r\n\t\r\n\twhile ( this._focusedTreeNodeBindings.hasNext ()) {\r\n\t\tvar binding = this._focusedTreeNodeBindings.getNext ();\r\n\t\tvar value = binding.getProperty ( this._selectionProperty );\r\n\t\tif ( value != null ) {\r\n\t\t\tif ( !this._selectionValue || this._selectionValue [ value ]) {\r\n\t\t\t\tnewEntry = ( \r\n\t\t\t\t\tthis._selectedTreeNodeBindings [ binding.key ] = binding \r\n\t\t\t\t);\r\n\t\t\t\tvar oldEntry = previous [ binding.key ];\r\n\t\t\t\tif ( !oldEntry || oldEntry != newEntry ) {\r\n\t\t\t\t\tisSelectionChanged = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif ( newEntry ) {\r\n\t\tif ( isSelectionChanged ) {\r\n\t\t\tthis.dispatchAction ( TreeBinding.ACTION_SELECTIONCHANGED );\r\n\t\t}\r\n\t} else if ( previous ) {\r\n\t\tfor ( var key in previous ) {\r\n\t\t\tthis.dispatchAction ( TreeBinding.ACTION_NOSELECTION );\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Get selected treenode bindings.\r\n * @return {List<TreeNodeBinding>}\r\n */\r\nTreeBinding.prototype.getSelectedTreeNodeBindings = function () {\r\n\t\r\n\tvar result = new List ();\r\n\tfor ( var key in this._selectedTreeNodeBindings ) {\r\n\t\tresult.add ( this._selectedTreeNodeBindings [ key ]);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Blur focused bindings and clear the list.\r\n */\r\nTreeBinding.prototype.blurSelectedTreeNodes = function () {\r\n\r\n\tthis._focusedTreeNodeBindings.reset ().each (\r\n\t\tfunction ( binding ) {\r\n\t\t\tbinding.blur ();\r\n\t\t}\r\n\t);\r\n\tthis._focusedTreeNodeBindings.clear ();\r\n}\r\n\r\n/**\r\n * Blur treenodes descending from a give treenode.\r\n * @param {TreeNodeBinding} treenode\r\n */\r\nTreeBinding.prototype._blurDescendantBindings = function ( treenode ) {\r\n\t\r\n\tvar descendants = treenode.getDescendantBindingsByLocalName ( \"treenode\" );\r\n\t\r\n\t/*\r\n\t * TODO: Multiple selections - what happens?\r\n\t */\r\n\tvar result = true;\r\n\tvar self = this;\r\n\tdescendants.each ( function ( desc ) {\r\n\t\tif ( desc.isFocused ) {\r\n\t\t\tdesc.blur ();\r\n\t\t\tself._focusedTreeNodeBindings.del (\r\n\t\t\t\tself._focusedTreeNodeBindings.getIndex ( desc ) // the horror... \r\n\t\t\t);\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n}\r\n\r\n/**\r\n * @return {List}\r\n */\r\nTreeBinding.prototype.getFocusedTreeNodeBindings = function () {\r\n\r\n\treturn this._focusedTreeNodeBindings.reset ();\r\n}\r\n\r\n/**\r\n * @implements {IFocusable}\r\n */\r\nTreeBinding.prototype.focus = function () {\r\n\t\r\n\tif ( !this.isFocused ) {\r\n\t\t\r\n\t\tthis.isFocused = true;\r\n\t\tFocusBinding.focusElement ( this.bindingElement );\r\n\t\tthis.attachClassName ( Binding.CLASSNAME_FOCUSED );\r\n\t\tthis.dispatchAction ( Binding.ACTION_FOCUSED );\r\n\t\t\r\n\t\tif ( !this.getFocusedTreeNodeBindings ().hasEntries ()) {\r\n\t\t\tif ( this.isFocusable ) {\r\n\t\t\t\tthis._focusDefault ();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tthis._grabKeyboard ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Default focus action - focus first node in tree.\r\n */\r\nTreeBinding.prototype._focusDefault = function () {\r\n\t\r\n\tvar first = this._treeBodyBinding.getChildBindingByLocalName ( \"treenode\" );\r\n\tif ( first != null ) {\r\n\t\tthis.focusSingleTreeNodeBinding ( first );\r\n\t\tfirst.callback ();\r\n\t}\r\n};\r\n\r\n/**\r\n * @implements {IFocusable}\r\n */\r\nTreeBinding.prototype.blur = function () {\r\n\t\r\n\tif ( this.isFocused ) {\r\n\t\tthis.isFocused = false;\r\n\t\tthis.detachClassName ( Binding.CLASSNAME_FOCUSED );\r\n\t\tthis.dispatchAction ( Binding.ACTION_BLURRED );\r\n\t\tthis._releaseKeyboard ();\r\n\t}\r\n};\r\n\r\n/**\r\n * Grab keyboard.\r\n */\r\nTreeBinding.prototype._grabKeyboard = function () {\r\n\t\r\n\tthis.subscribe ( BroadcastMessages.KEY_ARROW );\r\n\tthis.subscribe ( BroadcastMessages.KEY_ENTER );\r\n\tthis._hasKeyboard = true;\r\n};\r\n\r\n/**\r\n * Release keyboard.\r\n */\r\nTreeBinding.prototype._releaseKeyboard = function () {\r\n\t\r\n\tthis.unsubscribe ( BroadcastMessages.KEY_ARROW );\r\n\tthis.unsubscribe ( BroadcastMessages.KEY_ENTER );\r\n\tthis._hasKeyboard = false;\r\n\t\r\n};\r\n\r\n/** \r\n * While initializing, added treenodes gets appended to a buffer.\r\n * @overwrites {Binding#add}\r\n * @param {Binding} binding\r\n * @return {Binding}\r\n */\r\nTreeBinding.prototype.add = function ( binding ) {\r\n\t\r\n\tvar returnable = null;\r\n\tif ( this._treeBodyBinding ) {\r\n\t\t returnable = this._treeBodyBinding.add ( binding );\r\n\t} else {\r\n\t\tthis._treeNodeBuffer.add ( binding );\r\n\t\treturnable = binding;\r\n\t}\r\n\treturn returnable;\r\n};\r\n\r\n/**\r\n * @overwrites {Binding#addFirst}\r\n * @param {Binding} binding\r\n * @return {Binding}\r\n */\r\nTreeBinding.prototype.addFirst = function ( binding ) {\r\n\r\n\tthrow new Error ( \"Not implemented\" );\r\n}\r\n\r\n/**\r\n * Empty all treenodes and reset stuff. \r\n */\r\nTreeBinding.prototype.empty = function () {\r\n\r\n\tthis._treeBodyBinding.detachRecursive ();\r\n\tvar element = this._treeBodyBinding.bindingElement;\r\n\telement.innerHTML = \"\";\r\n}\r\n\r\n/**\r\n * Is tree empty?\r\n * @return {boolean}\r\n */\r\nTreeBinding.prototype.isEmpty = function () {\r\n    \r\n    return this._treeNodeBindings.hasEntries () == false;\r\n}\r\n\r\n/**\r\n * Collapse all treenodes.\r\n */\r\nTreeBinding.prototype.collapse = function () {\r\n\t\r\n\tthis.blurSelectedTreeNodes ();\r\n\tthis._treeNodeBindings.each ( function ( handle, treenode ) {\r\n\t\tif ( treenode.isContainer && treenode.isOpen ) {\r\n\t\t\ttreenode.close ();\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Activate tree selection.\r\n * @param {boolean} isSelectable;\r\n */\r\nTreeBinding.prototype.setSelectable = function ( isSelectable ) {\r\n\t\r\n\tthis._isSelectable = isSelectable;\r\n\t\r\n\tif ( isSelectable ) {\r\n\t\tthis._selectedTreeNodeBindings = {};\r\n\t} else {\r\n\t\tthis._selectedTreeNodeBindings = null;\r\n\t\tthis._selectionProperty = null;\r\n\t\tthis._selectionValue = null;\r\n\t}\r\n}\r\n\t\r\n/**\r\n * Define selection property.\r\n * @param {string} property\r\n */\r\nTreeBinding.prototype.setSelectionProperty = function ( property ) {\r\n\t\r\n\tthis._selectionProperty = property;\r\n}\r\n\r\n\r\n/**\r\n * Define selection value(s).\r\n * @param {string} value White-space separated string\r\n */\r\nTreeBinding.prototype.setSelectionValue = function (value) {\r\n\r\n\tif (value) {\r\n\t\tvar list = new List(value.split(\" \"));\r\n\t\tthis._selectionValue = {};\r\n\t\twhile (list.hasNext()) {\r\n\t\t\tthis._selectionValue[list.getNext()] = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Setup drop when a drag is instantiated.\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nTreeBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tTreeBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\t\r\n\t\tcase BroadcastMessages.TYPEDRAG_START :\r\n\t\t\tthis.addEventListener ( DOMEvents.MOUSEMOVE );\r\n\t\t\tthis._yposition = this.boxObject.getGlobalPosition ().y;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.TYPEDRAG_STOP :\r\n\t\t\tthis.removeEventListener ( DOMEvents.MOUSEMOVE );\r\n\t\t\tthis._positionIndicatorBinding.hide ();\r\n\t\t\tthis._yposition = -1;\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.KEY_ARROW :\r\n\t\t\tthis._navigateByKey ( arg );\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.KEY_ENTER :\r\n\t\t\tvar focused = this.getFocusedTreeNodeBindings ()\r\n\t\t\tif ( focused.hasEntries ()) {\r\n\t\t\t\tvar node = focused.getFirst ();\r\n\t\t\t\tif ( node.isContainer ) {\r\n\t\t\t\t\tif ( node.isOpen ) { \r\n\t\t\t\t\t\tnode.close ();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tnode.open ();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnode.fireCommand ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Keyboard navigation studio.\r\n * @param {int} key\r\n */\r\nTreeBinding.prototype._navigateByKey = function ( key ) {\r\n\t\r\n\tvar focused = this.getFocusedTreeNodeBindings ()\r\n\t\r\n\tif ( focused.hasEntries ()) {\r\n\t\t\r\n\t\tvar node = focused.getFirst ();\r\n\t\tvar next = null;\r\n\t\t\r\n\t\tswitch ( key ) {\r\n\t\t\tcase KeyEventCodes.VK_UP :\r\n\t\t\t\tnext = node.getPreviousBindingByLocalName ( \"treenode\" );\r\n\t\t\t\tif ( next != null ) { \r\n\t\t\t\t\twhile ( next.isContainer && next.hasChildren () && next.isOpen ) {\r\n\t\t\t\t\t\tnext = next.getChildBindingsByLocalName ( \"treenode\" ).getLast ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif ( next == null ) {\r\n\t\t\t\t\tnext = node.getAncestorBindingByLocalName ( \"treenode\" );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase KeyEventCodes.VK_DOWN :\r\n\t\t\t\tif ( node.isContainer && node.hasChildren () && node.isOpen ) {\r\n\t\t\t\t\tnext = node.getChildBindingByLocalName ( \"treenode\" );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnext = node.getNextBindingByLocalName ( \"treenode\" );\r\n\t\t\t\t\tif ( next == null ) {\r\n\t\t\t\t\t\tvar parent = null;\r\n\t\t\t\t\t\twhile ( next == null && ( parent = node.getAncestorBindingByLocalName ( \"treenode\" )) != null ) {\r\n\t\t\t\t\t\t\tif ( parent != null ) {\r\n\t\t\t\t\t\t\t\tnext = parent.getNextBindingByLocalName ( \"treenode\" );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tnode = parent;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase KeyEventCodes.VK_RIGHT :\r\n\t\t\t\tif ( node.isContainer ) {\r\n\t\t\t\t\tif ( !node.isOpen ) {\r\n\t\t\t\t\t\tnode.open ();\r\n\t\t\t\t\t} else if ( node.hasChildren ()) {\r\n\t\t\t\t\t\tnext = node.getChildBindingByLocalName ( \"treenode\" );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase KeyEventCodes.VK_LEFT :\r\n\t\t\t\tif (node.isContainer && node.isOpen) {\r\n\t\t\t\t\tnode.close();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnext = node.getAncestorBindingByLocalName(\"treenode\");\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\r\n\t\tif ( next != null ) {\r\n\t\t\tthis.focusSingleTreeNodeBinding ( next );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nTreeBinding.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tTreeBinding.superclass.handleEvent.call ( this, e );\r\n\t\r\n\tvar target = DOMEvents.getTarget ( e );\r\n\t\r\n\tswitch ( e.type ) {\r\n\t\r\n\t\tcase DOMEvents.MOUSEMOVE :\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\tthis._updatePositionIndicator ( e );\r\n\t\t\t} catch ( exception ) {\r\n\t\t\t\tthis.removeEventListener ( DOMEvents.MOUSEMOVE );\r\n\t\t\t\tthrow ( exception );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase DOMEvents.BEFOREUPDATE :\r\n\t\t\tvar crawler = new TreeCrawler ();\r\n\t\t\tvar list = new List ();\r\n\t\t\tcrawler.mode = TreeCrawler.MODE_GETOPEN;\r\n\t\t\tcrawler.crawl ( this.bindingElement, list );\r\n\t\t\tvar map = new Map ();\r\n\t\t\tif ( list.hasEntries ()) {\r\n\t\t\t\twhile ( list.hasNext ()) {\r\n\t\t\t\t\tvar treenode = list.getNext ();\r\n\t\t\t\t\tmap.set ( treenode.getHandle (), true );\r\n\t\t\t\t}\r\n\t\t\t\tthis._openTreeNodesBackupMap = map;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase DOMEvents.AFTERUPDATE :\r\n\t\t\tthis._openTreeNodesBackupMap = null;\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Position indicator while dragging.\r\n * @param {MouseEvent} e\r\n */\r\nTreeBinding.prototype._updatePositionIndicator = function ( e ) {\r\n\t\r\n\tvar y = e.clientY - this._yposition;\r\n\tvar pos = this._acceptingPosition;\r\n\tvar dim = this._acceptingDimension;\r\n\tvar indicator = this._positionIndicatorBinding;\r\n\t\r\n\tif ( this._acceptingTreeNodeBinding ) {\r\n\t\r\n\t\tvar miny = pos.y;\r\n\t\tvar maxy = pos.y + dim.h;\r\n\t\t\r\n\t\tif ( y >= miny && y <= maxy ) {\r\n\t\t\r\n\t\t\t// snap position to nearest tree grid\r\n\t\t\ty = y < miny + TreeNodeBinding.HEIGHT ? miny + TreeNodeBinding.HEIGHT : y;\r\n\t\t\ty = y - TreeNodeBinding.HEIGHT;\r\n\t\t\ty = TreeBinding.grid ( y );\r\n\t\t\t\r\n\t\t\t// snap to nearest *accepted* tree grid\r\n\t\t\twhile ( !this._acceptingPositions [ y ]) {\r\n\t\t\t\ty += TreeNodeBinding.HEIGHT\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// position indicator\r\n\t\t\tif ( y != indicator.getPosition ().y ) {\r\n\t\t\t\tindicator.setPosition ( \r\n\t\t\t\t\tnew Point ( \r\n\t\t\t\t\t\tthis._acceptingPosition.x + TreeNodeBinding.INDENT,\r\n\t\t\t\t\t\ty\r\n\t\t\t\t\t)\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tif ( !indicator.isVisible ) {\r\n\t\t\t\tindicator.show ();\r\n\t\t\t}\r\n\t\t} else if ( indicator.isVisible ) {\r\n\t\t\tindicator.hide ();\r\n\t\t}\r\n\t} else if ( indicator.isVisible ) {\r\n\t\tindicator.hide ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked by an accepting treenode.\r\n * @param {TreeNodeBinding} binding\r\n */\r\nTreeBinding.prototype.enablePositionIndicator = function ( binding ) {\r\n\t\r\n\tthis._acceptingTreeNodeBinding = binding;\r\n\tthis._acceptingPosition = binding.boxObject.getLocalPosition ();\r\n\tthis._acceptingDimension = binding.boxObject.getDimension ();\r\n\tthis._acceptingPositions = this._getChildPositions ( binding );\r\n}\r\n\r\n/**\r\n * Invoked by an accepting treenode.\r\n */\r\nTreeBinding.prototype.disablePositionIndicator = function () {\r\n\t\r\n\tthis._acceptingTreeNodeBinding = null;\r\n\tthis._acceptingPosition = null;\r\n\tthis._acceptingDimension = null;\r\n}\r\n\r\n/**\r\n * Index position of folder children (or something equivaltent to position).\r\n * @param {TreeNodeBinding} binding\r\n * @return {HashMap<int><boolean>}\r\n */\r\nTreeBinding.prototype._getChildPositions = function ( binding ) {\r\n\r\n\tvar map = {};\r\n\tvar children = binding.getChildBindingsByLocalName ( \"treenode\" );\r\n\tvar child, pos, dim, y;\r\n\t\r\n\ty = TreeBinding.grid ( binding.boxObject.getLocalPosition ().y );\r\n\tmap [ y ] = true;\r\n\t\r\n\twhile ( children.hasNext ()) {\r\n\t\tchild = children.getNext ();\t\t\r\n\t\tpos = child.boxObject.getLocalPosition ();\r\n\t\tdim = child.boxObject.getDimension ();\r\n\t\ty = TreeBinding.grid ( pos.y + dim.h ) - TreeNodeBinding.HEIGHT;\r\n\t\tmap [ y ] = true;\r\n\t}\r\n\t\r\n\treturn map;\r\n}\r\n\r\n/**\r\n * Returns the index of latest treenode drag-drop session. A value of zero \r\n * indicates that the treenode was inserted as the first folder child.\r\n * @return {int]\r\n */\r\nTreeBinding.prototype.getDropIndex = function () {\r\n\r\n\tvar y = this._positionIndicatorBinding.getPosition ().y;\r\n\t\r\n\tvar drop = 0;\r\n\tfor ( var index in this._acceptingPositions ) {\r\n\t\tif ( index == y ) {\r\n\t\t\tbreak;\r\n\t\t} else {\r\n\t\t\tdrop++;\r\n\t\t}\r\n\t}\r\n\treturn Number ( drop );\r\n}\r\n\r\n/**\r\n * Get the root (first-level) treenodes.\r\n * @return {List<TreeNodeBinding>}\r\n */\r\nTreeBinding.prototype.getRootTreeNodeBindings = function () {\r\n\t\r\n\treturn this._treeBodyBinding.getChildBindingsByLocalName ( \"treenode\" );\r\n}\r\n\r\n/**\r\n * Get tree body binding.\r\n */\r\nTreeBinding.prototype.getTreeBodyBinding = function () {\r\n\r\n\treturn this._treeBodyBinding;\r\n}\r\n\r\n/**\r\n * TreeBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TreeBinding}\r\n */\r\nTreeBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:tree\", ownerDocument );\r\n\tvar binding = UserInterface.registerBinding ( element, TreeBinding );\r\n\tbinding.treeBodyBinding = TreeBodyBinding.newInstance ( ownerDocument );\r\n\treturn binding;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/trees/TreeBodyBinding.js",
    "content": "TreeBodyBinding.prototype = new FlexBoxBinding;\r\nTreeBodyBinding.prototype.constructor = TreeBodyBinding;\r\nTreeBodyBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nTreeBodyBinding.PADDING_TOP = 8;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TreeBodyBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TreeBodyBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {TreeBinding}\r\n\t */\r\n\tthis.containingTreeBinding = null;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTreeBodyBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TreeBodyBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTreeBodyBinding.prototype.onBindingAttach = function () {\r\n\r\n\tTreeBodyBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.addActionListener ( TreeNodeBinding.ACTION_FOCUSED );\r\n\tthis.containingTreeBinding = UserInterface.getBinding ( \r\n\t\tthis.bindingElement.parentNode\r\n\t);\r\n}\r\n\r\n/**\r\n * @implements {IAcceptable}\r\n * @param {Binding} binding\r\n */\r\nTreeBodyBinding.prototype.accept = function ( binding ) {\r\n\r\n\tif ( binding instanceof TreeNodeBinding ) {\r\n\t\tthis.logger.debug ( binding );\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nTreeBodyBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tTreeBodyBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase TreeNodeBinding.ACTION_FOCUSED :\r\n\t\t\tthis._scrollIntoView ( action.target );\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t\t\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Adjust scroll position so that focused treenodes are always visible.\r\n * @param {TreeNodeBinding} treenode\r\n */\r\nTreeBodyBinding.prototype._scrollIntoView = function ( treenode ) {\r\n\t\r\n\tvar label = treenode.labelBinding.bindingElement;\r\n\tvar a = this.bindingElement.clientHeight;\r\n\tvar b = this.bindingElement.clientWidth;\r\n\tvar y = treenode.boxObject.getGlobalPosition().y - this.boxObject.getGlobalPosition().y;\r\n\tvar x = DOMUtil.getGlobalPosition(label).x - this.boxObject.getGlobalPosition().x;\r\n\tvar h = label.offsetHeight;\r\n\tvar w = 100;\r\n\tvar t = this.bindingElement.scrollTop;\r\n\tvar l = this.bindingElement.scrollLeft;\r\n\r\n\t\r\n\t/*\r\n\t * Scroll top.\r\n\t */\r\n\tif ( y - t < 0 ) {\r\n\t\tthis.bindingElement.scrollTop = y;\r\n\t} else if ( y - t + h > a ) {\r\n\t\tthis.bindingElement.scrollTop = y + h - a;\r\n\t\t//label.scrollIntoView ( false );\r\n\t}\r\n\t/*\r\n\t * Scroll left.\r\n\t */\r\n\tif (x - l < 0) {\r\n\t\tthis.bindingElement.scrollLeft = x;\r\n\t}else if (x - l + w > b) {\r\n\t\tthis.bindingElement.scrollLeft = x + w - b;\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IAcceptable}\r\n *\r\nTreeBodyBinding.prototype.showAcceptance = function () {\r\n\t\r\n\tthis.bindingElement.style.backgroundColor = \"yellow\";\t\r\n}\r\n\r\n/**\r\n * @implements {IAcceptable}\r\n *\r\nTreeBodyBinding.prototype.hideAcceptance = function () {\r\n\t\r\n\tthis.bindingElement.style.backgroundColor = \"Window\";\t\r\n}\r\n*/\r\n\r\n/**\r\n * TreeBodyBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TreeBodyBinding}\r\n */\r\nTreeBodyBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:treebody\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, TreeBodyBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/trees/TreeContentBinding.js",
    "content": "TreeContentBinding.prototype = new Binding;\r\nTreeContentBinding.prototype.constructor = TreeContentBinding;\r\nTreeContentBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TreeContentBinding () {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TreeContentBinding\" );\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTreeContentBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TreeContentBinding]\";\r\n}\r\n\r\n/**\r\n * TreeContentBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TreeContentBinding}\r\n */\r\nTreeContentBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:treecontent\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, TreeContentBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/trees/TreeCrawler.js",
    "content": "TreeCrawler.prototype = new BindingCrawler;\r\nTreeCrawler.prototype.constructor = TreeCrawler;\r\nTreeCrawler.superclass = BindingCrawler.prototype;\r\n\r\nTreeCrawler.ID = \"treecrawler\";\r\nTreeCrawler.MODE_GETOPEN = \"get open treenodes\";\r\n\r\n/**\r\n * @class\r\n * The TreeCrawler sees only TreeNodeBindings.\r\n */\r\nfunction TreeCrawler () {\r\n\t\r\n\tthis.mode = TreeCrawler.MODE_GETOPEN;\r\n\tthis.id = TreeCrawler.ID;\r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * * Filter all but Binding elements.\r\n * @overloads {ElementCrawler#_construct} \r\n */\r\nTreeCrawler.prototype._construct = function () {\r\n\t\r\n\tTreeCrawler.superclass._construct.call ( this );\r\n\t\r\n\tvar self = this;\r\n\t\r\n\t/*\r\n\t * See only treenodes.\r\n\t */\r\n\tthis.addFilter ( function ( element ) {\r\n\t\t\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\tvar result = null;var result = null;\r\n\t\t\r\n\t\tif ( !binding instanceof TreeNodeBinding ) {\r\n\t\t\tresult = NodeCrawler.SKIP_NODE;\r\n\t\t}\r\n\t\t\r\n\t\treturn result;\r\n\t});\r\n\t\r\n\t/*\r\n\t * Analyze treenode. \r\n\t */\r\n\tthis.addFilter ( function ( element, list ) {\r\n\t\t\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\tvar result = null;\r\n\t\t\r\n\t\tswitch ( self.mode ) {\r\n\t\t\tcase TreeCrawler.MODE_GETOPEN :\r\n\t\t\t\tif ( binding.isOpen ) {\r\n\t\t\t\t\tlist.add ( binding );\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/trees/TreeNodeBinding.js",
    "content": "TreeNodeBinding.prototype = new Binding;\r\nTreeNodeBinding.prototype.constructor = TreeNodeBinding;\r\nTreeNodeBinding.superclass = Binding.prototype;\r\n\r\nTreeNodeBinding.DEFAULT_FOLDER_CLOSED \t\t= \"${icon:folder}\";\r\nTreeNodeBinding.DEFAULT_FOLDER_OPEN\t\t\t= \"${icon:folder_active}\";\r\nTreeNodeBinding.DEFAULT_FOLDER_DISABLED \t= \"${icon:default}\";\r\nTreeNodeBinding.DEFAULT_ITEM \t\t\t\t= \"${root}/images/icons/harmony/composite/default_16.png\";\r\nTreeNodeBinding.DEFAULT_ITEM_DISABLED\t\t= \"${icon:default}\";\r\n\r\nTreeNodeBinding.ACTION_OPEN\t\t\t\t\t= \"treenodeopen\";\r\nTreeNodeBinding.ACTION_CLOSE\t\t\t\t= \"treenodeclose\";\r\nTreeNodeBinding.ACTION_ONFOCUS\t\t\t\t= \"treenodeonfocus\";\r\nTreeNodeBinding.ACTION_ONMULTIFOCUS\t\t\t= \"treenodeonmultifocus\";\r\nTreeNodeBinding.ACTION_FOCUSED\t\t\t\t= \"treenodefocused\";\r\nTreeNodeBinding.ACTION_BLUR\t\t\t\t\t= \"treenodeblur\";\r\nTreeNodeBinding.ACTION_COMMAND\t\t\t\t= \"treenodecommand\";\r\nTreeNodeBinding.ACTION_DISPOSE\t\t\t\t= \"treenodedisposed\";\r\n\r\nTreeNodeBinding.CLASSNAME_DRAGGED = \"dragged\";\r\nTreeNodeBinding.HEIGHT = 19; /* TODO: doublecheck - was 16 */\r\nTreeNodeBinding.INDENT = 16 + 18;\r\n\r\n/**\r\n * @class\r\n * TreeNodeBinding.\r\n * @param {DOMElement} bindingElement\r\n */\r\nfunction TreeNodeBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TreeNodeBinding\" );\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.hasBeenOpened = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisabled\t= false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFocused = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isOpen = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isPinned = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isContainer = false;\r\n\r\n\t/**\r\n\t * @type {ImageProfile}\r\n\t */\r\n\tthis.imageProfile = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageHover = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageActive = null;\r\n\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.imageDisabled = null;\r\n\r\n\t/**\r\n\t * The ancestor TreeBinding.\r\n\t * @type {TreeBinding}\r\n\t */\r\n\tthis.containingTreeBinding = null;\r\n\r\n\t/*\r\n\t * Return this.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTreeNodeBinding.prototype.toString = function () {\r\n\r\n\treturn \"[TreeNodeBinding]\";\r\n}\r\n\r\n/**\r\n * Serialize binding.\r\n */\r\nTreeNodeBinding.prototype.serialize = function () {\r\n\r\n\tvar result = TreeNodeBinding.superclass.serialize.call ( this );\r\n\tif ( result ) {\r\n\r\n\t\tresult.label = this.getLabel ();\r\n\t\tresult.image = this.getImage ();\r\n\r\n\t\tvar handle = this.getHandle ();\r\n\t\tif ( handle && handle != this.key ) {\r\n\t\t\tresult.handle = handle;\r\n\t\t}\r\n\t\tif ( this.isOpen ) {\r\n\t\t\tresult.open = true;\r\n\t\t}\r\n\t\tif ( this.isDisabled ) {\r\n\t\t\tresult.disabled = true;\r\n\t\t}\r\n\t\tif ( this.dragType ) {\r\n\t\t\tresult.dragtype = this.dragType;\r\n\t\t}\r\n\t\tif ( this.dragAccept ) {\r\n\t\t\tresult.dragaccept = this.dragAccept;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingRegister}\r\n */\r\nTreeNodeBinding.prototype.onBindingRegister = function () {\r\n\r\n\tTreeNodeBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\tthis.propertyMethodMap [ \"label\" ] = this.setLabel;\r\n\tthis.propertyMethodMap [ \"image\" ] = this.setImage;\r\n\tthis.propertyMethodMap [ \"tooltip\" ] = this.setToolTip;\r\n\t// this.propertyMethodMap [ \"focus\" ] is handled by method handleElement...\r\n\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingAttach}\r\n */\r\nTreeNodeBinding.prototype.onBindingAttach = function () {\r\n\r\n\tTreeBinding.superclass.onBindingAttach.call ( this );\r\n\r\n\tthis.isOpen\t= this.isOpen ? true : this.getProperty ( \"open\" );\r\n\tthis.isPinned = this.isPinned ? true : this.getProperty(\"pin\");\r\n\tif ( !this.isContainer ) {\r\n\t\tthis.isContainer = this.hasChildren ();\r\n\t}\r\n\tthis.buildDOMContent ();\r\n\tthis.assignDOMEvents ();\r\n\tif ( this.isDisabled ) {\r\n\t\tthis.labelBinding.attachClassName ( LabelBinding.CLASSNAME_GRAYTEXT );\r\n\t}\r\n\tthis.addActionListener ( TreeNodeBinding.ACTION_FOCUSED );\r\n\tthis.addEventListener ( UpdateManager.EVENT_AFTERUPDATE );\r\n\r\n\t/*\r\n\t * We do this last so that the tree may at this point change label etc.\r\n\t */\r\n\tthis._registerWithAncestorTreeBinding ();\r\n}\r\n\r\n/**\r\n * Overloads {Binding#onBindingDispose}\r\n */\r\nTreeNodeBinding.prototype.onBindingDispose = function () {\r\n\r\n\tif ( this.isAttached ) {\r\n\t\tif ( this.dragger != null ) { // TODO: is this needed?\r\n\t\t\tthis.labelBinding.removeEventListener ( DOMEvents.MOUSEDOWN, this.dragger );\r\n\t\t\tthis.labelBinding.removeEventListener ( DOMEvents.MOUSEMOVE, this.dragger );\r\n\t\t\tthis.labelBinding.removeEventListener ( DOMEvents.MOUSEUP, this.dragger );\r\n\t\t\tthis.disableDragging ();\r\n\t\t\tthis.dragger.dispose ();\r\n\t\t}\r\n\t\tthis.dispatchAction ( TreeNodeBinding.ACTION_DISPOSE );\r\n\t\tthis.containingTreeBinding.unRegisterTreeNodeBinding ( this );\r\n\t\tthis.labelBinding.dispose ();\r\n\t}\r\n\tTreeNodeBinding.superclass.onBindingDispose.call ( this );\r\n}\r\n\r\n/**\r\n * Register with containing {@link TreeBinding}.\r\n * To conserve computations, a pointer to the tree\r\n * is copied from the nearest parent tree member.\r\n * We cannot simply target the parent element\r\n * since this could be a {@link UpdatePanelBinding}.\r\n */\r\nTreeNodeBinding.prototype._registerWithAncestorTreeBinding = function () {\r\n\r\n\tvar node = this.bindingElement;\r\n\twhile (( node = node.parentNode ) != null && !this.containingTreeBinding ) {\r\n\t\tvar binding = UserInterface.getBinding ( node );\r\n\t\tif ( binding && binding.containingTreeBinding ) {\r\n\t\t\tthis.containingTreeBinding = binding.containingTreeBinding;\r\n\t\t}\r\n\t}\r\n\tif ( this.containingTreeBinding ) {\r\n\t\tthis.containingTreeBinding.registerTreeNodeBinding ( this );\r\n\t} else  {\r\n\t\talert ( this.bindingElement.parentNode.nodeName );\r\n\t\tthrow \"TreeNodeBinding attached outside TreeBodyBinding\";\r\n\t}\r\n}\r\n\r\n/**\r\n * The treenode will get registered by this index.\r\n * Subclasses can overwrite this method for added pleasure.\r\n * @return {string}\r\n */\r\nTreeNodeBinding.prototype.getHandle = function () {\r\n\r\n\tvar result = this.key;\r\n\tvar handle = this.getProperty ( \"handle\" );\r\n\tif ( handle ) {\r\n\t\tresult = handle;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set handle.\r\n * @param {string} handle\r\n */\r\nTreeNodeBinding.prototype.setHandle = function ( handle ) {\r\n\r\n\tthis.setProperty ( \"handle\", handle );\r\n}\r\n\r\n/**\r\n * Build DOM content.\r\n */\r\nTreeNodeBinding.prototype.buildDOMContent = function () {\r\n\r\n\tvar url\t\t\t\t= this.getProperty ( \"url\" );\r\n\tvar label \t\t\t= this.getProperty ( \"label\" );\r\n\tvar tooltip \t\t= this.getProperty ( \"tooltip\" );\r\n\tvar oncommand \t\t= this.getProperty ( \"oncommand\" );\r\n\tvar onfocus \t\t= this.getProperty ( \"onbindingfocus\" );\r\n\tvar onblur \t\t\t= this.getProperty ( \"onbindingblur\" );\r\n\tvar focused \t\t= this.getProperty ( \"focused\" );\r\n\tvar callbackid \t\t= this.getProperty ( \"callbackid\" );\r\n\r\n\t/*\r\n\t * Build URL\r\n\t */\r\n\tif ( url ) {\r\n\t\tvar link = DOMUtil.createElementNS ( Constants.NS_XHTML, \"a\", this.bindingDocument );\r\n\t\tlink.href = url;\r\n\t\tthis.bindingElement.appendChild ( link );\r\n\t\tthis.shadowTree.link = link;\r\n\t}\r\n\r\n\t/*\r\n\t * Build label\r\n\t */\r\n\tthis.labelBinding = LabelBinding.newInstance ( this.bindingDocument )\r\n\tif ( url ) {\r\n\t\tthis.shadowTree.link.appendChild ( this.labelBinding.bindingElement );\r\n\t} else {\r\n\t\tthis.addFirst ( this.labelBinding );\r\n\t}\r\n\tthis.shadowTree.label = this.labelBinding; // in order to exclude from serialization!\r\n\r\n\tif ( this.dragger != null ) { // have to transfer listeners to make the setup work!\r\n\r\n\t\tthis.removeEventListener ( DOMEvents.MOUSEDOWN, this.dragger );\r\n\t\tthis.removeEventListener ( DOMEvents.MOUSEMOVE, this.dragger );\r\n\t\tthis.removeEventListener ( DOMEvents.MOUSEUP, this.dragger );\r\n\r\n\t\tthis.labelBinding.addEventListener ( DOMEvents.MOUSEDOWN, this.dragger );\r\n\t\tthis.labelBinding.addEventListener ( DOMEvents.MOUSEMOVE, this.dragger );\r\n\t\tthis.labelBinding.addEventListener ( DOMEvents.MOUSEUP, this.dragger );\r\n\r\n\t}\r\n\r\n\t// TEMP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n\t// Binding.prototype._initializeBindingDragAndDropFeatures overload??? DRAGREJECT!\r\n\tif ( this.isContainer && !this.dragAccept ) {\r\n\t\tthis.acceptor = new BindingAcceptor ( this );\r\n\t}\r\n\r\n\tif ( label != null ) {\r\n\t\tthis.setLabel ( label );\r\n\t}\r\n\tif ( tooltip != null ) {\r\n\t\tthis.setToolTip ( tooltip );\r\n\t}\r\n\tif ( !this.imageProfile ) {\r\n\t\tthis._computeImageProfile ();\r\n\t}\r\n\tthis.setImage (\r\n\t\tthis.computeImage ()\r\n\t);\r\n\tif ( this.isContainer ) {\r\n\t\tthis.updateClassNames ();\r\n\t}\r\n\r\n\tvar manager = this.bindingWindow.WindowManager;\r\n\r\n\tif ( oncommand != null ) {\r\n\t\tthis.oncommand = function () {\r\n\t\t\tBinding.evaluate ( oncommand, this );\r\n\t\t};\r\n\t}\r\n\tif ( onfocus != null ) {\r\n\t\tthis.onfocus = function () {\r\n\t\t\tBinding.evaluate ( onfocus, this );\r\n\t\t};\r\n\t}\r\n\tif ( onblur != null ) {\r\n\t\tthis.onblur = function () {\r\n\t\t\tBinding.evaluate ( onblur, this );\r\n\t\t};\r\n\t}\r\n\r\n\tif ( focused == true ) {\r\n\t\tthis.focus ();\r\n\t}\r\n\r\n\t/*\r\n\t * Setup ASP.NET callback. One can only wonder why we need a\r\n\t * hidden field in order to communicate with the server...\r\n\t */\r\n\tif ( callbackid != null ) {\r\n\t\tBinding.dotnetify ( this, callbackid );\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nTreeNodeBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tTreeNodeBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\t/*\r\n\t\t * Make sure that a focused treenode is always\r\n\t\t * visible by opening ancestor treenodes.\r\n\t\t */\r\n\t\tcase TreeNodeBinding.ACTION_FOCUSED :\r\n\t\t\tif ( action.target != this ) {\r\n\t\t\t\tif ( this.isContainer && !this.isOpen ) {\r\n\t\t\t\t\tthis.open ( true );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Enable dragging. Special setup, adding event listeners to\r\n * label, because treenodes consume the onmousedown event.\r\n * @overwrites {Binding#enableDragging}\r\n */\r\nTreeNodeBinding.prototype.enableDragging = function () {\r\n\r\n\t/*\r\n\t * DISABLED!\r\n\t *\r\n\tthis.isDraggable = true;\r\n\tif ( this.dragger == null ) {\r\n\t\tthis.dragger = new BindingDragger ( this );\r\n\t}\r\n\t*/\r\n}\r\n\r\n/**\r\n * Disable dragging.\r\n * @overwrites {Binding#disableDragging}\r\n */\r\nTreeNodeBinding.prototype.disableDragging = function () {\r\n\r\n\tthis.isDraggable = false;\r\n\t/*\r\n\tif ( this.dragger != null ) { handled by method onBindingDispose!\r\n\t\tthis.dragger = null;\r\n\t}\r\n\t*/\r\n}\r\n\r\n/**\r\n * Accept dragged binding.\r\n * @implements {IAcceptable}\r\n * @param {Binding} binding\r\n * @param @optional {int} index\r\n * @return {boolean}\r\n */\r\nTreeNodeBinding.prototype.accept = function ( binding, index ) {\r\n\r\n\tvar isAccept = true;\r\n\r\n\tif ( binding instanceof TreeNodeBinding ) {\r\n\r\n\t\tvar isAncestor = false;\r\n\t\tvar element = this.bindingElement;\r\n\t\tvar treeElement = this.containingTreeBinding.bindingElement;\r\n\r\n\t\twhile ( !isAncestor && element != treeElement ) {\r\n\t\t\tif ( element == binding.getBindingElement ()) {\r\n\t\t\t\tisAncestor = true;\r\n\t\t\t} else {\r\n\t\t\t\telement = element.parentNode;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ( isAncestor ) {\r\n\t\t\tDialog.error ( \"Not Allowed\", \"You cannot move a folder into itself.\" );\r\n\t\t\tisAccept = false;\r\n\t\t} else {\r\n\t\t\tthis.acceptTreeNodeBinding ( binding, index );\r\n\t\t}\r\n\t} else {\r\n\t\tisAccept = false;\r\n\t}\r\n\r\n\treturn isAccept;\r\n}\r\n\r\n/**\r\n * Accept treenode.If properties get lost in transfer, remember\r\n * to update the {@link TreeNodeBinding#serialize} method.\r\n * @param {Binding} binding\r\n * @param @optional {int}\r\n */\r\nTreeNodeBinding.prototype.acceptTreeNodeBinding = function ( binding, index ) {\r\n\r\n\tvar serial = binding.serializeToString ();\r\n\tvar parser = new BindingParser ( this.bindingDocument );\r\n\tvar element\t= parser.parseFromString ( serial ).getFirst ();\r\n\r\n\tindex = index ? index : this.containingTreeBinding.getDropIndex ();\r\n\tvar children = this.getChildElementsByLocalName ( \"treenode\" );\r\n\tthis.bindingElement.insertBefore ( element, children.get ( index ));\r\n\tthis.bindingWindow.DocumentManager.attachBindings (\r\n\t\tthis.bindingElement\r\n\t);\r\n\r\n\t/*\r\n\t * This part does not work because the \"image\" attribute\r\n\t * has been set on bindingElement opon binding attach.\r\n\t * Fortunately we don't need it just now.\r\n\t *\r\n\tif ( !this.isContainer ) {\r\n\t\tthis.isContainer = true;\r\n\t\tthis.isOpen = true;\r\n\t\tthis.updateClassNames ();\r\n\t\tthis._computeImageProfile ();\r\n\t\talert ( this.imageProfile.getDefaultImage ());\r\n\t\tthis.setImage (\r\n\t\t\tthis.computeImage ()\r\n\t\t);\r\n\t}\r\n\t*/\r\n\r\n\tbinding.dispose ();\r\n}\r\n\r\n/**\r\n * Show acceptance.\r\n * @implements {IAcceptable}\r\n */\r\nTreeNodeBinding.prototype.showAcceptance = function () {\r\n\r\n\tthis.containingTreeBinding.enablePositionIndicator ( this );\r\n}\r\n\r\n/**\r\n * Show acceptance.\r\n * @implements {IAcceptable}\r\n */\r\nTreeNodeBinding.prototype.hideAcceptance = function () {\r\n\r\n\tthis.containingTreeBinding.disablePositionIndicator ();\r\n}\r\n\r\n/**\r\n * Compute ImageProfile.\r\n */\r\nTreeNodeBinding.prototype._computeImageProfile = function () {\r\n\r\n\tvar image \t\t\t= this.getProperty ( \"image\" );\r\n\tvar imageActive \t= this.getProperty ( \"image-active\" );\r\n\tvar imageDisabled \t= this.getProperty ( \"image-disabled\" );\r\n\r\n\timageActive = imageActive ? imageActive : this.isContainer ?\r\n\t\timage ? image : TreeNodeBinding.DEFAULT_FOLDER_OPEN :\r\n\t\timage ? image : TreeNodeBinding.DEFAULT_ITEM;\r\n\r\n\timageDisabled = imageDisabled ? imageDisabled : this.isContainer ?\r\n\t\timage ? image : TreeNodeBinding.DEFAULT_FOLDER_DISABLED :\r\n\t\timage ? image : TreeNodeBinding.DEFAULT_ITEM_DISABLED;\r\n\r\n\timage = image ? image : this.isContainer ?\r\n\t\tTreeNodeBinding.DEFAULT_FOLDER_CLOSED : TreeNodeBinding.DEFAULT_ITEM;\r\n\r\n\tthis.imageProfile = new ImageProfile ({\r\n\t\timage \t\t\t: image,\r\n\t\timageHover \t\t: null,\r\n\t\timageActive \t: imageActive,\r\n\t\timageDisabled \t: imageDisabled\r\n\t});\r\n}\r\n\r\n/**\r\n * Assign DOM events.\r\n * @private\r\n */\r\nTreeNodeBinding.prototype.assignDOMEvents = function () {\r\n\r\n\t/*\r\n\t * Note that mouseover and mouseout are only relevant for folders.\r\n\t * TODO: erect a \"converttofolder\" method to handle this?\r\n\t */\r\n\tthis.labelBinding.addEventListener ( DOMEvents.DOUBLECLICK, this );\r\n\tthis.labelBinding.addEventListener ( DOMEvents.MOUSEDOWN, this );\r\n\tthis.labelBinding.addEventListener ( DOMEvents.MOUSEOVER, this );\r\n\tthis.labelBinding.addEventListener ( DOMEvents.MOUSEOUT, this );\r\n}\r\n\r\n/**\r\n * Set image.\r\n * @param {string} url\r\n */\r\nTreeNodeBinding.prototype.setImage = function ( url ) {\r\n\r\n\tthis.setProperty ( \"image\", url );\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setImage ( url );\r\n\t}\r\n}\r\n\r\n/**\r\n * Set label.\r\n * @param {string} label\r\n */\r\nTreeNodeBinding.prototype.setLabel = function ( label ) {\r\n\r\n\tthis.setProperty ( \"label\", String ( label ));\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setLabel ( String ( label ));\r\n\t}\r\n}\r\n\r\n/**\r\n * Set tooltip.\r\n * @param {string} tooltip\r\n */\r\nTreeNodeBinding.prototype.setToolTip = function ( tooltip ) {\r\n\r\n\tthis.setProperty ( \"tooltip\", String ( tooltip ));\r\n\tif ( this.isAttached ) {\r\n\t\tthis.labelBinding.setToolTip ( String ( tooltip ));\r\n\t}\r\n}\r\n\r\n/**\r\n * Get image.\r\n * @return {string}\r\n */\r\nTreeNodeBinding.prototype.getImage = function () {\r\n\r\n\treturn this.getProperty ( \"image\" );\r\n}\r\n\r\n/**\r\n * Get label.\r\n * @return {string}\r\n */\r\nTreeNodeBinding.prototype.getLabel = function () {\r\n\r\n\treturn this.getProperty ( \"label\" );\r\n}\r\n\r\n\r\n/**\r\n * Get tooltip.\r\n * @return {string}\r\n */\r\nTreeNodeBinding.prototype.getToolTip = function () {\r\n\r\n\treturn this.getProperty ( \"tooltip\" );\r\n}\r\n\r\n/**\r\n * Compute image.\r\n * @return {string}\r\n */\r\nTreeNodeBinding.prototype.computeImage = function () {\r\n\r\n\tvar defaultImage = this.imageProfile.getDefaultImage ();\r\n\tvar activeImage = this.imageProfile.getActiveImage ();\r\n\tactiveImage = activeImage ? activeImage : defaultImage;\r\n\r\n\treturn this.isOpen ? activeImage : defaultImage;\r\n}\r\n\r\n/**\r\n * @implements {IEventListener}\r\n * @overloads {Binding#handleEvent}\r\n * @param {MouseEvent} e\r\n */\r\nTreeNodeBinding.prototype.handleEvent = function ( e ) {\r\n\r\n\tTreeNodeBinding.superclass.handleEvent.call ( this, e );\r\n\r\n\tvar target \t\t= DOMEvents.getTarget ( e );\r\n\tvar label\t\t= this.labelBinding.bindingElement;\r\n\tvar labelBody \t= this.labelBinding.shadowTree.labelBody;\r\n\tvar labelText\t= this.labelBinding.shadowTree.labelText;\r\n\r\n\t/*\r\n\t * Tree navigation.\r\n\t */\r\n\tswitch ( e.type ) {\r\n\r\n\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\tif (target == label) {\r\n\t\t\t\tthis._onAction(e);\r\n\t\t\t} else {\r\n\t\t\t\tif (!this.isDisabled) {\r\n\t\t\t\t\tthis._onFocus(e);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase DOMEvents.DOUBLECLICK :\r\n\t\t\tthis._onAction ( e );\r\n\t\t\tbreak;\r\n\r\n\t\tcase UpdateManager.EVENT_AFTERUPDATE :\r\n\r\n\t\t\t/*\r\n\t\t\t * Hack a glitch where UpdateManager would\r\n\t\t\t * insert treenodes before our label.\r\n\t\t\t */\r\n\t\t\tif ( target.parentNode == this.bindingElement && target.__updateType == Update.TYPE_INSERT ) {\r\n\t\t\t\tvar label = this.labelBinding.bindingElement;\r\n\t\t\t\tif ( DOMUtil.getLocalName ( target ) == \"treenode\" ) {\r\n\t\t\t\t\tif ( target == this.bindingElement.firstChild ) {\r\n\t\t\t\t\t\tthis.bindingElement.insertBefore ( target, label.nextSibling );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\t/*\r\n\t * Drag session timeouts.\r\n\t */\r\n\tif ( BindingDragger.isDragging && this.isContainer && !this.isOpen ) {\r\n\t\tswitch ( e.type ) {\r\n\t\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\t \tswitch ( target ) {\r\n\t\t\t\t\tcase label :\r\n\t\t\t\t\tcase labelBody :\r\n\t\t\t\t\tcase labelText :\r\n\t\t\t\t\t\tthis._folderDragOverTimeout ( e );\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * When dragging over a closed folder, the folder should open.\r\n * Let's do it by setting and clearing a timeout.\r\n * @param {MouseEvent} e\r\n */\r\nTreeNodeBinding.prototype._folderDragOverTimeout = function ( e ) {\r\n\r\n\tvar self = this;\r\n\tswitch ( e.type ) {\r\n\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\tthis._dragTimeout = this.bindingWindow.setTimeout ( function () {\r\n\t\t\t\tself.open ();\r\n\t\t\t}, 500 );\r\n\t\t\tbreak;\r\n\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\tthis.bindingWindow.clearTimeout ( this._dragTimeout );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Treenode action.\r\n * @param {MouseEvent} e\r\n * @private\r\n */\r\nTreeNodeBinding.prototype._onAction = function ( e ) {\r\n\r\n\tvar isAction = true;\r\n\r\n\tif ( e.type == \"mousedown\" ) {\r\n\t\tvar isLeftButton = e.button == ( e.target ? 0 : 1 );\r\n\t\tif ( !isLeftButton ) {\r\n\t\t\tisAction = false;\r\n\t\t}\r\n\t}\r\n\tif ( isAction ) {\r\n\t\tif ( this.isContainer ) {\r\n\t\t\tif ( !this.isOpen ) {\r\n\t\t\t\tthis.open ();\r\n\t\t\t} else {\r\n\t\t\t\tthis.close ();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.fireCommand ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Fire treenode command.\r\n */\r\nTreeNodeBinding.prototype.fireCommand = function () {\r\n\r\n\tif ( this.oncommand ) {\r\n\t\tthis.oncommand ();\r\n\t}\r\n\tthis.dispatchAction ( TreeNodeBinding.ACTION_COMMAND );\r\n}\r\n\r\n/**\r\n * This will dispatch an event to the containing TreeBinding\r\n * which in turn will invoke the focus method below.\r\n * @param {MouseEvent}\r\n */\r\nTreeNodeBinding.prototype._onFocus = function ( e ) {\r\n\r\n\tvar isMultiSelection = false;\r\n\tif ( e != null ) {\r\n\t\tisMultiSelection = e.shiftKey;\r\n\t}\r\n\tthis.dispatchAction ( isMultiSelection ?\r\n\t\tTreeNodeBinding.ACTION_ONMULTIFOCUS :\r\n\t\tTreeNodeBinding.ACTION_ONFOCUS\r\n\t);\r\n\tif ( e != null ) {\r\n\t\tthis.stopPropagation ( e );\r\n\t}\r\n\tif ( this.onfocus != null ) {\r\n\t\tthis.onfocus ();\r\n\t}\r\n\tif ( e != null ) {\r\n\t\tif ( this.hasCallBackID ()) {\r\n\t\t\tthis.callback ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Call the server. This must be done whenever the client is\r\n * setting the focus; it should not be done when the server\r\n * is setting the focus. Also invoked by the TreeBinding!\r\n * @see {TreeBinding#_focusDefault}\r\n * @returns\r\n */\r\nTreeNodeBinding.prototype.callback = function () {\r\n\r\n\tif ( this.hasCallBackID ()) {\r\n\t\tvar self = this;\r\n\t\tsetTimeout ( function () { // minimize freezing sensation\r\n\t\t\tself.dispatchAction ( PageBinding.ACTION_DOPOSTBACK );\r\n\t\t}, 0 );\r\n\t}\r\n}\r\n\r\n/**\r\n * Focus the treenode managed. This method should only be invoked by the {@link TreeBinding}.\r\n */\r\nTreeNodeBinding.prototype.invokeManagedFocus = function () {\r\n\r\n\tif ( !this.isFocused ) {\r\n\t\tthis.isFocused = true;\r\n\t\tthis.setProperty ( \"focused\", true );\r\n\t\tthis.labelBinding.attachClassName ( \"focused\" );\r\n\t\tthis.dispatchAction ( TreeNodeBinding.ACTION_FOCUSED );\r\n\t}\r\n}\r\n\r\n/**\r\n * Focus the treenode (public access point).\r\n */\r\nTreeNodeBinding.prototype.focus = function () {\r\n\r\n\tthis.setProperty ( \"focused\", true );\r\n\tif ( this.isAttached ) {\r\n\t\tthis._onFocus ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Blur the treenode. This method is invoked by the {@link TreeBinding}.\r\n */\r\nTreeNodeBinding.prototype.blur = function () {\r\n\r\n\tif ( this.isFocused ) {\r\n\t\tthis.isFocused = false;\r\n\t\tthis.deleteProperty ( \"focused\" );\r\n\t\tthis.labelBinding.detachClassName ( \"focused\" );\r\n\t\tif ( this.onblur ) {\r\n\t\t\tthis.onblur ();\r\n\t\t}\r\n\t\tthis.dispatchAction ( TreeNodeBinding.ACTION_BLUR );\r\n\t}\r\n}\r\n\r\n/**\r\n * Preventing event propagation internally in the tree\r\n * while still broadcasting a global mousedown event.\r\n * @param {MouseEvent} e\r\n * @private\r\n */\r\nTreeNodeBinding.prototype.stopPropagation = function ( e ) {\r\n\r\n\tif ( e.type == \"mousedown\" ) {\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.MOUSEEVENT_MOUSEDOWN, e );\r\n\t\tthis.dispatchAction ( Binding.ACTION_ACTIVATED );\r\n\t}\r\n\tDOMEvents.stopPropagation ( e );\r\n}\r\n\r\n/**\r\n * Open container.\r\n */\r\nTreeNodeBinding.prototype.open = function () {\r\n\r\n\tif ( this.isContainer && !this.isOpen ) {\r\n\t\tthis.isOpen = true;\r\n\t\tthis.setProperty ( \"open\", true );\r\n\t\tthis.dispatchAction ( TreeNodeBinding.ACTION_OPEN\t);\r\n\t\tthis.setImage ( this.computeImage ());\r\n\t\tthis.updateClassNames ();\r\n\t\tthis.hasBeenOpened = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Close container.\r\n */\r\nTreeNodeBinding.prototype.close = function () {\r\n\r\n\tif ( this.isContainer && this.isOpen && !this.isPinned) {\r\n\t\tthis.isOpen = false;\r\n\t\tthis.setProperty ( \"open\", false );\r\n\t\tthis.dispatchAction ( TreeNodeBinding.ACTION_CLOSE );\r\n\t\tthis.setImage ( this.computeImage ());\r\n\t\tthis.updateClassNames ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Updates treenode classnames when a container type node is handled.\r\n */\r\nTreeNodeBinding.prototype.updateClassNames = function () {\r\n\r\n\tif ( this.isContainer ) {\r\n\t\tif ( !this.hasClassName ( \"container\" )) {\r\n\t\t\tthis.attachClassName ( \"container\" );\r\n\t\t}\r\n\t\tif ( this.isOpen ) {\r\n\t\t\tthis.detachClassName ( \"closed\" );\r\n\t\t\tthis.attachClassName ( \"open\" );\r\n\t\t\tthis.labelBinding.detachClassName ( \"closed\" );\r\n\t\t\tthis.labelBinding.attachClassName ( \"open\" );\r\n\t\t} else {\r\n\t\t\tthis.detachClassName ( \"open\" );\r\n\t\t\tthis.attachClassName ( \"closed\" );\r\n\t\t\tthis.labelBinding.detachClassName ( \"open\" );\r\n\t\t\tthis.labelBinding.attachClassName ( \"closed\" );\r\n\t\t}\r\n\t} else {\r\n\t\tif ( this.hasClassName ( \"container\" )) {\r\n\t\t\tthis.detachClassName ( \"container\" );\r\n\t\t\tthis.labelBinding.detachClassName ( \"closed\" );\r\n\t\t\tthis.labelBinding.detachClassName ( \"open\" );\r\n\t\t\t// TODO: modify this.isOpen property?\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispose descendant treenodes.\r\n */\r\nTreeNodeBinding.prototype.empty = function () {\r\n\r\n\tvar descendants = this.getDescendantBindingsByLocalName ( \"treenode\" );\r\n\tdescendants.each ( function ( treenode ) {\r\n\t\ttreenode.dispose ();\r\n\t});\r\n}\r\n\r\n/**\r\n * Show dragged status.\r\n * TODO: implement some interface around here!\r\n */\r\nTreeNodeBinding.prototype.showDrag = function () {\r\n\r\n\tthis.attachClassName ( TreeNodeBinding.CLASSNAME_DRAGGED );\r\n}\r\n\r\n/**\r\n * Hide dragged status.\r\n * TODO: implement some interface around here!\r\n */\r\nTreeNodeBinding.prototype.hideDrag = function () {\r\n\r\n\tthis.detachClassName ( TreeNodeBinding.CLASSNAME_DRAGGED );\r\n}\r\n\r\n/**\r\n * Has children?\r\n * @return {boolean}\r\n */\r\nTreeNodeBinding.prototype.hasChildren = function () {\r\n\r\n\treturn this.bindingElement.hasChildNodes ();\r\n}\r\n\r\n/**\r\n * Server trying to maintain focus on this treenode?\r\n * @overwrites {Binding#handleElement}\r\n * @param {Element} element\r\n */\r\nTreeNodeBinding.prototype.handleElement = function ( element ) {\r\n\r\n\t/*\r\n\t * The problem here is that the server may move focus to\r\n\t * this treenode in one postback response, but if the\r\n\t * next response KEEPS he focus there are no CHANGES\r\n\t * to the response. This way, user may be allowed to\r\n\t * change focus in second attempt. Always nice to have\r\n\t * the UI state on both the client and the server...\r\n\t */\r\n\tvar focused = element.getAttribute ( \"focused\" );\r\n\tif ( focused == \"true\" ) {\r\n\t\tif ( !this.isFocused ) {\r\n\t\t\tthis.focus ();\r\n\t\t}\r\n\t}\r\n\r\n\treturn false; // continue updates as normally!\r\n}\r\n\r\nTreeNodeBinding.prototype.getParent = function () {\r\n\r\n\treturn this.getAncestorBindingByLocalName(\"treenode\");\r\n}\r\n\r\n/**\r\n * TreeNodeBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TreeNodeBinding}\r\n */\r\nTreeNodeBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:treenode\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, TreeNodeBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/trees/TreePositionIndicatorBinding.js",
    "content": "TreePositionIndicatorBinding.prototype = new Binding;\r\nTreePositionIndicatorBinding.prototype.constructor = TreePositionIndicatorBinding;\r\nTreePositionIndicatorBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction TreePositionIndicatorBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"TreePositionIndicatorBinding\" );\r\n\t\r\n\t/**\r\n\t * TODO: REFACTOR TO POINT!\r\n\t * @type {object}\r\n\t */\r\n\tthis._geometry = {\r\n\t\tx : 0,\r\n\t\ty : 0\r\n\t}\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nTreePositionIndicatorBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[TreePositionIndicatorBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nTreePositionIndicatorBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tTreePositionIndicatorBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.hide ();\r\n}\r\n\r\n/**\r\n * @param {Point} point\r\n */\r\nTreePositionIndicatorBinding.prototype.setPosition = function ( point ) {\r\n\t\r\n\tthis.bindingElement.style.left = point.x + \"px\";\r\n\tthis.bindingElement.style.top = point.y + \"px\";\r\n\t\r\n\tthis._geometry.x = point.x;\r\n\tthis._geometry.y = point.y;\r\n}\r\n\r\n/**\r\n * @return {Point}\r\n */\r\nTreePositionIndicatorBinding.prototype.getPosition = function () {\r\n\r\n\treturn new Point ( \r\n\t\tthis._geometry.x,\r\n\t\tthis._geometry.y\r\n\t);\r\n}\r\n\r\n/**\r\n * TreePositionIndicatorBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {TreePositionIndicatorBinding}\r\n */\r\nTreePositionIndicatorBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:treepositionindicator\", ownerDocument );\r\n\treturn UserInterface.registerBinding ( element, TreePositionIndicatorBinding );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/viewers/SourceCodeViewerBinding.js",
    "content": "SourceCodeViewerBinding.prototype = new WindowBinding;\r\nSourceCodeViewerBinding.prototype.constructor = SourceCodeViewerBinding;\r\nSourceCodeViewerBinding.superclass = WindowBinding.prototype;\r\n\r\nSourceCodeViewerBinding.ACTION_INITIALIZED = \"sourcecodeviewer initialized\";\r\n\r\n/**\r\n * @type {string}\r\n */\r\nSourceCodeViewerBinding.URL_DEFAULT = \"${root}/content/misc/viewers/sourcecodeviewer/viewsourcecontent.aspx\";\r\n\r\n/*\r\n * Supported syntax list. Currently only XML supported!\r\n * type {object}\r\n */\r\nSourceCodeViewerBinding.syntax = {\r\n\r\n\tXML : \"xml\"\r\n}\r\n\r\n/*\r\n * Transformatrix stylesheets.\r\n * type {HashMap<string><string>}\r\n */\r\nSourceCodeViewerBinding.stylesheets = {\r\n\r\n\t\"xml\" : Resolver.resolve ( \"${root}/transformations/viewsource-xml.xsl\" )\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction SourceCodeViewerBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"SourceCodeViewerBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._syntax = null;\r\n\t\r\n\t/**\r\n\t * @type {XSLTransformer}\r\n\t */\r\n\tthis._transformer = null;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nSourceCodeViewerBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[SourceCodeViewerBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {WindowBinding#onBindingAttach}.\r\n */\r\nSourceCodeViewerBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tthis._syntax = this.getProperty ( \"syntax\" );\r\n\t\r\n\t/*\r\n\t * Verify syntax.\r\n\t */\r\n\tswitch ( this._syntax ) {\r\n\t\tcase SourceCodeViewerBinding.syntax.XML :\r\n\t\t\tvar stylesheet = SourceCodeViewerBinding.stylesheets [ this._syntax ];\r\n\t\t\tthis._transformer = new XSLTransformer ();\r\n\t\t\tthis._transformer.importStylesheet ( stylesheet );\r\n\t\t\tbreak;\r\n\t\tdefault :\r\n\t\t\tthrow \"SourceCodeViewer: Syntax error!\";\r\n\t\t\tthis._syntax = null;\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\t/*\r\n\t * Fetch the start content (serverside control scenario).\r\n\t */\r\n\tvar textarea = DOMUtil.getElementsByTagName ( this.bindingElement, \"textarea\" ).item ( 0 );\r\n\tif ( textarea ) {\r\n\t\tthis._startcontent = textarea.value;\r\n\t}\r\n\t\r\n\tthis.setURL ( SourceCodeViewerBinding.URL_DEFAULT );\r\n\tthis.addActionListener ( WindowBinding.ACTION_ONLOAD );\r\n\tSourceCodeViewerBinding.superclass.onBindingAttach.call ( this );\r\n}\r\n\r\n/** \r\n * @implements {IActionListener}\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nSourceCodeViewerBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tSourceCodeViewerBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\t/*\r\n\t * Show start content when iframe is loaded. Don't expose \r\n\t * the iframe, dispatching special action instead.\r\n\t */\r\n\tswitch ( action.type ) {\r\n\t\tcase WindowBinding.ACTION_ONLOAD :\r\n\t\t\tif ( action.target == this ) {\r\n\t\t\t\tif ( this._startcontent ) {\r\n\t\t\t\t\tthis.view ( this._startcontent );\r\n\t\t\t\t}\r\n\t\t\t\tthis.dispatchAction ( SourceCodeViewerBinding.ACTION_INITIALIZED );\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tSourceCodeViewerBinding.superclass.handleAction.call ( this, action );\r\n}\r\n\r\n/** \r\n * View source. \r\n * @param {object} arg Argument is loosely dependant on viewer syntax.\r\n */\r\nSourceCodeViewerBinding.prototype.view = function ( arg ) {\r\n\t\r\n\tswitch ( this._syntax ) {\r\n\t\tcase SourceCodeViewerBinding.syntax.XML :\r\n\t\t\tthis._viewXML ( arg );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/** \r\n * View XML source.\r\n * @param {object} arg This should be either a parsable string or an XMLDocument.\r\n */\r\nSourceCodeViewerBinding.prototype._viewXML = function ( arg ) {\r\n\t\r\n\tvar doc = null;\r\n\t\r\n\tif ( arg ) {\r\n\t\tif ( typeof arg == Types.STRING ) {\r\n\t\t\tdoc = XMLParser.parse ( arg );\r\n\t\t} else if ( arg.nodeType && arg.nodeType == Node.DOCUMENT_NODE ) {\r\n\t\t\tdoc = object;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif ( doc ) {\r\n\t\tvar result = this._transformer.transformToString ( doc );\r\n\t\tthis._inject ( result );\r\n\t}\r\n}\r\n\r\n/** \r\n * View HTML source.\r\n * @param {object} arg This should be either a parsable string or an HTMLDocument.\r\n */\r\nSourceCodeViewerBinding.prototype._viewHTML = function ( arg ) {\r\n\t\r\n\t// Note to self: This will require a call to HTMLTidy in Explorer.\r\n}\r\n\r\n/** \r\n * View HTML source.\r\n * @param {string} arg This should be a wellformed javascript.\r\n */\r\nSourceCodeViewerBinding.prototype._viewJavascript = function ( arg ) {\r\n\t\r\n\t// Note to self: This should probably NOT be done using XSLT.\r\n}\r\n\r\n/**\r\n * Injecting transformation result into iframe document.\r\n * @param {string} markup\r\n */\r\nSourceCodeViewerBinding.prototype._inject = function ( markup ) {\r\n\t\r\n\tthis.getContentDocument ().body.innerHTML = markup;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/views/SlideInViewBinding.js",
    "content": "﻿SlideInViewBinding.prototype = new ViewBinding;\nSlideInViewBinding.prototype.constructor = SlideInViewBinding;\nSlideInViewBinding.superclass = ViewBinding.prototype;\n\nSlideInViewBinding.TRANSITION_CLASSNAME = \"transition\";\n\nSlideInViewBinding.VIEWSET_ID = \"slideinviews\";\nSlideInViewBinding.VIEWSET_CLASSNAME = \"slidein\";\n\n/**\n * @class\n */\nfunction SlideInViewBinding() {\n\n\t/**\n\t * @type {SystemLogger}\n\t */\n\tthis.logger = SystemLogger.getLogger(\"SlideInViewBinding\");\n\n\tthis.responseAction = PageBinding.ACTION_RESPONSE;\n\n\t/*\n\t * Returnable.\n\t */\n\treturn this;\n};\n\n/**\n * Identifies binding.\n */\nSlideInViewBinding.prototype.toString = function () {\n\n\treturn \"[SlideInViewBinding]\";\n};\n\n/**\n * @overloads {ViewBinding#onBindingAttach}\n */\nSlideInViewBinding.prototype.onBindingAttach = function () {\n\n\tSlideInViewBinding.superclass.onBindingAttach.call(this);\n\n\tthis.subscribe(this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST);\n\n\tthis.addActionListener(this.responseAction, this);\n}\n\nSlideInViewBinding.prototype.slideToBinding = function (binding) {\n\n\tthis._snapBinding = binding;\n\n\t// Initialize when first shown, creating and loading the WindowBinding\n\tif ( !this._isViewBindingInitialized ) {\n\t\tthis.initialize ();\n\t}\n}\n\n\n/**\n * @overwrites {ViewBinding#show}\n */\nSlideInViewBinding.prototype.show = function () {\n\n\tif (!this.isVisible) {\n\t\tvar dimension = this._snapBinding.boxObject.getDimension();\n\t\tthis.bindingElement.style.left = String(dimension.w) + \"px\";\n\t\tthis.attachClassName(SlideInViewBinding.TRANSITION_CLASSNAME);\n\t}\n\n\tSlideInViewBinding.superclass.show.call(this);\n}\n\n/**\n * @implements {IActionListener}\n * @overloads {Binding#handleAction}\n * @param {Action} action\n */\nSlideInViewBinding.prototype.handleAction = function (action) {\n\n\tSlideInViewBinding.superclass.handleAction.call(this, action);\n\n\tvar binding = action.target;\n\n\tswitch (action.type) {\n\n\t\tcase this.responseAction:\n\t\t\tif (this.getContentWindow() === binding.bindingWindow) {\n\t\t\t\tvar self = this;\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tself.dispose();\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t\taction.consume();\n\t\t\tbreak;\n\t}\n}\n\n\n/**\n * @implements {IBroadcastListener}\n * @param {string} broadcast\n * @param {object} arg\n */\nSlideInViewBinding.prototype.handleBroadcast = function (broadcast, arg) {\n\n\tSlideInViewBinding.superclass.handleBroadcast.call(this, broadcast, arg);\n\n\tswitch (broadcast) {\n\n\t\tcase this.bindingWindow.WindowManager.WINDOW_RESIZED_BROADCAST:\n\t\t\tif (this.isVisible == true) {\n\t\t\t\tthis.updatePositionDimension();\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\n\n/**\n * SlideInViewBinding factory.\n * @param {DOMDocument} ownerDocument\n * @return {ViewBinding}\n */\nSlideInViewBinding.newInstance = function (ownerDocument) {\n\n\tvar element = DOMUtil.createElementNS(Constants.NS_UI, \"ui:view\", ownerDocument);\n\tvar binding = UserInterface.registerBinding(element, SlideInViewBinding);\n\tbinding.windowBinding = binding.add(WindowBinding.newInstance(ownerDocument));\n\n\tvar viewset = binding.bindingWindow.bindingMap[SlideInViewBinding.VIEWSET_ID];\n\tif (viewset == null) {\n\n\t\tvar bodyBinding = UserInterface.getBinding(binding.bindingDocument.body);\n\t\tvar viewsetelement = DOMUtil.createElementNS(Constants.NS_UI, \"ui:viewset\", binding.bindingDocument);\n\t\tviewsetelement.setAttribute(\"id\", SlideInViewBinding.VIEWSET_ID);\n\t\tviewset = UserInterface.registerBinding(viewsetelement, ViewSetBinding);\n\t\tviewset.bindingElement.style.zIndex = 5;\n\t\tviewset.attachClassName(SlideInViewBinding.VIEWSET_CLASSNAME);\n\n\t\tbodyBinding.bindingElement.insertBefore(\n\t\t\t\tviewset.bindingElement,\n\t\t\t\tbodyBinding.bindingElement.firstChild\n\t\t);\n\t\tviewset.attach();\n\t}\n\n\tviewset.add(binding);\n\n\treturn binding;\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/views/ViewBinding.js",
    "content": "ViewBinding.prototype = new FlexBoxBinding;\r\nViewBinding.prototype.constructor = ViewBinding;\r\nViewBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nViewBinding.ACTION_LOADED = \"view loaded\";\r\nViewBinding.ACTION_ONCLOSE = \"view onclose\";\r\nViewBinding.ACTION_ONCLOSE_FORCE = \"view onclose force\";\r\nViewBinding.ACTION_CLOSED = \"view closed\";\r\nViewBinding.ACTION_DETACH = \"view detach\";\r\n\r\nViewBinding.HORIZONTAL_ADJUST = 1;\r\nViewBinding.VERTICAL_ADJUST = 1;\r\n\r\n/*\r\n * These strings get attached to\r\n * respective views as classnames.\r\n */\r\nViewBinding.TYPE_EXPLORERVIEW = \"explorerview\";\r\nViewBinding.TYPE_DOCKVIEW = \"dockview\";\r\nViewBinding.TYPE_DIALOGVIEW = \"dialogview\";\r\n\r\n/*\r\n * Classname activated.\r\n */\r\nViewBinding.CLASSNAME_ACTIVE = \"active\";\r\n\r\n /**\r\n  * Timeout in seconds before assuming an ASPX error.\r\n  * @type {int}\r\n  */\r\nViewBinding.TIMEOUT = 15;\r\n\r\n/**\r\n * Considered private, see below.\r\n * @type {Map<string><ViewBinding>}\r\n */\r\nViewBinding._instances = new Map ();\r\n\r\n/**\r\n * Has Instance?\r\n * @param {string} handle\r\n * @return {Boolean};\r\n */\r\nViewBinding.hasInstance = function (handle) {\r\n\r\n\treturn ViewBinding._instances.has(ViewBinding.normalizeHandle(handle));\r\n}\r\n\r\n/**\r\n * Get instance by handle.\r\n * @param {string} handle\r\n * @return {ViewBinding}\r\n */\r\nViewBinding.getInstance = function ( handle ) {\r\n\r\n\tvar result = ViewBinding._instances.get (ViewBinding.normalizeHandle(handle));\r\n\t//if ( !result ) {\r\n\t//\tvar cry = \"ViewBinding.getInstance: No such instance: \" + handle;\r\n\t//\tSystemLogger.getLogger ( \"ViewBinding [static]\" ).error ( cry );\r\n\t//\tSystemDebug.stack ( arguments );\r\n\t//\tif ( Application.isDeveloperMode ) {\r\n\t//\t\talert ( cry );\r\n\t//\t}\r\n\t//}\r\n\treturn result;\r\n}\r\n\r\n\r\nViewBinding.normalizeHandle = function (handle) {\r\n\r\n\tif (handle === \"Composite.Management.Browser\" && StageBinding.perspectiveNode) {\r\n\t\treturn handle + \".\" + StageBinding.perspectiveNode.getHandle();\r\n\t}\r\n\treturn handle;\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ViewBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ViewBinding\" );\r\n\r\n\t/**\r\n\t * @type {ViewDefinition}\r\n\t */\r\n\tthis._viewDefinition = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isVisible = false;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isViewBindingInitialized = false;\r\n\r\n\t/**\r\n\t * @type {Binding}\r\n\t */\r\n\tthis._snapBinding = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isFreeFloating = false;\r\n\r\n\t/**\r\n\t * Remember that the window is hidden while attaching due to CSS.\r\n\t * @type {WindowBinding}\r\n\t */\r\n\tthis.windowBinding = null;\r\n\r\n\t/**\r\n\t * @type {CoverBinding}\r\n\t */\r\n\tthis._coverBinding = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isLoaded = false;\r\n\r\n\t/**\r\n\t * Patches a strange bug in mozilla.\r\n\t */\r\n\tthis._isFirstShow = true;\r\n\r\n\t/**\r\n\t * Defaults to dockview.\r\n\t * @type {string);\r\n\t */\r\n\tthis._type = ViewBinding.TYPE_DOCKVIEW;\r\n\r\n\t/**\r\n\t * Points to the currently hosted PageBinding.\r\n\t * @type {PageBinding);\r\n\t */\r\n\tthis._pageBinding = null;\r\n\r\n\t/**\r\n\t * Backup position to minimize updates.\r\n\t * @type {Point}\r\n\t */\r\n\tthis._lastknownposition = null;\r\n\r\n\t/**\r\n\t * Backup dimension to minimize updates.\r\n\t * @type {Dimension}\r\n\t */\r\n\tthis._lastknowndimension = null;\r\n\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isActivated = false;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nViewBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ViewBinding]\";\r\n}\r\n\r\n/**\r\n * @overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nViewBinding.prototype.onBindingRegister = function () {\r\n\r\n\tViewBinding.superclass.onBindingRegister.call ( this );\r\n\r\n\tthis.addActionListener ( RootBinding.ACTION_PHASE_1 );\r\n\tthis.addActionListener ( RootBinding.ACTION_PHASE_2 );\r\n\tthis.addActionListener ( RootBinding.ACTION_PHASE_3 );\r\n\tthis.addActionListener ( WindowBinding.ACTION_LOADED );\r\n\tthis.addActionListener ( WindowBinding.ACTION_ONLOAD );\r\n\tthis.addActionListener ( PageBinding.ACTION_ATTACHED );\r\n\tthis.addActionListener ( PageBinding.ACTION_INITIALIZED );\r\n\tthis.addActionListener ( ViewBinding.ACTION_DETACH );\r\n\r\n\t/*\r\n\t * Performance timing related.\r\n\t */\r\n\tthis.addActionListener ( WizardPageBinding.ACTION_NAVIGATE_NEXT );\r\n\tthis.addActionListener ( WizardPageBinding.ACTION_NAVIGATE_PREVIOUS );\r\n\tthis.addActionListener ( WizardPageBinding.ACTION_FINISH );\r\n\r\n\t/*\r\n\t * Tune in on broadcasted closing statements.\r\n\t */\r\n\tthis.subscribe ( BroadcastMessages.CLOSE_VIEW );\r\n\tthis.subscribe ( BroadcastMessages.APPLICATION_SHUTDOWN );\r\n}\r\n\r\n/**\r\n * Attach special classname depending on type.\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nViewBinding.prototype.onBindingAttach = function () {\r\n\r\n\tViewBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.attachClassName ( this._type );\r\n\r\n\t/*\r\n\t * Explorer shows a brief flash of white sometimes. Build cover\r\n\t * for smoother page transitions when window is loaded and unloaded.\r\n\t */\r\n\tif ( Client.isExplorer == true ) {\r\n\t\tthis._coverBinding = this.add (\r\n\t\t\tCoverBinding.newInstance ( this.bindingDocument )\r\n\t\t);\r\n\t\tthis._coverBinding.attach ();\r\n\t}\r\n\r\n\tif (this._viewDefinition && this._viewDefinition.position == DockBinding.START)\r\n\t{\r\n\t\tthis.setProperty(\"position\", DockBinding.START);\r\n\t}\r\n\r\n\t/*\r\n\t * Attach window.\r\n\t */\r\n\tthis.windowBinding.attach ();\r\n}\r\n\r\n/**\r\n * @overwrites {FlexBoxBinding#flex}\r\n * @return\r\n */\r\nViewBinding.prototype.updatePositionDimension = function () {\r\n\r\n\tvar snap = this._snapBinding;\r\n\r\n\t/*\r\n\t * For some reason, IE enters here when the user has\r\n\t * no perspectives. This should be considered a hack.\r\n\t * TODO: Mozilla is allowed to pass because he doesn't\r\n\t * fail. IE is blocked. But now the difference is that\r\n\t * IE is allowed to see the Start-screen. Synch this!\r\n\t */\r\n\tvar isAbort = !System.hasActivePerspectives && Client.isExplorer;\r\n\r\n\tif ( this.isFreeFloating == true && !isAbort ) {\r\n\t\tif ( snap.isVisible == true ) {\r\n\t\t\tif ( snap.isAttached == true ) {\r\n\r\n\t\t\t\tvar position = snap.boxObject.getGlobalPosition ();\r\n\t\t\t\tvar dimension = snap.boxObject.getDimension ();\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t * Update position.\r\n\t\t\t\t */\r\n\t\t\t\tif ( !Point.isEqual ( position, this._lastknownposition )) {\r\n\r\n\t\t\t\t\tthis.setPosition ( position );\r\n\t\t\t\t\tthis._lastknownposition = position;\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t * Update dimension.\r\n\t\t\t\t */\r\n\t\t\t\tif ( !Dimension.isEqual ( dimension, this._lastknowndimension )) {\r\n\r\n\t\t\t\t\tthis.setDimension ( dimension );\r\n\t\t\t\t\tthis._lastknowndimension = dimension;\r\n\r\n\t\t\t\t\tvar result = dimension.h - ViewBinding.VERTICAL_ADJUST;\r\n\t\t\t\t\tresult = result < 0 ? 0 : result;\r\n\r\n\t\t\t\t\tthis.windowBinding.getBindingElement ().style.height = new String ( result ) + \"px\";\r\n\t\t\t\t\tthis.windowBinding.reflex ();\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthrow \"Could not snap to unattached binding!\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nViewBinding.prototype.onBindingDispose = function () {\r\n\r\n\tViewBinding.superclass.onBindingDispose.call ( this );\r\n\r\n\t/*\r\n\t * Cancel the serverside flow in case dispose\r\n\t * was instantiated by a clientside action.\r\n\t */\r\n\tif ( this._viewDefinition != null ) {\r\n\t\tvar flowhandle = this._viewDefinition.flowHandle;\r\n\t\tif ( flowhandle != null ) {\r\n\t\t\tFlowControllerService.CancelFlow ( flowhandle );\r\n\t\t}\r\n\t}\r\n\r\n\tif ( this._viewDefinition != null ) {\r\n\r\n\t\tvar handle = this._viewDefinition.handle;\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.VIEW_CLOSED, handle );\r\n\t\tthis.logger.fine ( \"ViewBinding closed: \\\"\" + handle + \"\\\"\" );\r\n\t\t/*\r\n\t\t * Odd fact: Mozilla will evaluate this twice unless\r\n\t\t * wrapped in a timeout. You can also make it evaluate it\r\n\t\t * once by alerting just bofore, but that wont help us.\r\n\t\t *\r\n\t\tvar handle = this._viewDefinition.handle;\r\n\t\tsetTimeout ( function () {\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.VIEW_CLOSED, handle );\r\n\t\t\tSystemLogger.getLogger ( \"FISSE\" ).fatal ( handle );\r\n\t\t}, 0 );\r\n\t\t*/\r\n\t}\r\n\r\n\tthis.dispatchAction ( ViewBinding.ACTION_CLOSED );\r\n}\r\n\r\n/**\r\n * Set type.\r\n * @param {string} type\r\n */\r\nViewBinding.prototype.setType = function ( type ) {\r\n\r\n\tthis._type = type;\r\n}\r\n\r\n/**\r\n * Get type.\r\n * @return {string}\r\n */\r\nViewBinding.prototype.getType = function () {\r\n\r\n\treturn this._type;\r\n}\r\n\r\n/**\r\n * Get handle. Technically, handle of the associated ViewDefinition.\r\n * @return {string}\r\n */\r\nViewBinding.prototype.getHandle = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this._viewDefinition != null ) {\r\n\t\tresult = this._viewDefinition.handle;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * TODO: update this method description.\r\n * Initialize when associated tab is selected.\r\n * This method is called by the {@link StageBinding}.\r\n * SNAPTARGET views initialize when snapToBinding is invoked!!!\r\n */\r\nViewBinding.prototype.initialize = function () {\r\n\r\n\tif ( !this._isViewBindingInitialized ) {\r\n\t\tthis._isViewBindingInitialized = true;\r\n\t\tthis.windowBinding.setURL (\r\n\t\t\tthis._viewDefinition.url\r\n\t\t);\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.VIEW_OPENING, this.getHandle ());\r\n\t} else {\r\n\t\tthrow ( \"Somehow ViewBinding got initialized twice: \" + this.getHandle ());\r\n\t}\r\n}\r\n\r\n/**\r\n * Set associated ViewDefinition.\r\n * @param {ViewDefinition} definition\r\n */\r\nViewBinding.prototype.setDefinition = function ( definition ) {\r\n\r\n\tthis._viewDefinition = definition;\r\n\tif (definition.position == DockBinding.MAIN) {\r\n\t\tthis.subscribe ( BroadcastMessages.CLOSE_VIEWS );\r\n\t}\r\n}\r\n\r\n/**\r\n * Get associated ViewDefinition.\r\n * @return {ViewDefinition}\r\n */\r\nViewBinding.prototype.getDefinition = function () {\r\n\r\n\treturn this._viewDefinition;\r\n}\r\n\r\n/**\r\n * Implements (@link IActionListener}\r\n * @param {Action} action\r\n */\r\nViewBinding.prototype.handleAction = function ( action ) {\r\n\r\n\tViewBinding.superclass.handleAction.call ( this, action );\r\n\r\n\tvar binding = action.target;\r\n\r\n\tswitch ( action.type ) {\r\n\r\n\t\tcase RootBinding.ACTION_PHASE_1 :\r\n\t\tcase RootBinding.ACTION_PHASE_2 :\r\n\t\tcase RootBinding.ACTION_PHASE_3 :\r\n\r\n\t\t\t/*\r\n\t\t\t * Activate the root binding?\r\n\t\t\t */\r\n\t\t\tif ( action.type == RootBinding.ACTION_PHASE_1 ) {\r\n\t\t\t\tif ( this.isActivated && !binding.isActivated ) {\r\n\t\t\t\t\tbinding.onActivate ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * Consume these events. They are\r\n\t\t\t * intended for ViewBinding content.\r\n\t\t\t */\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase Binding.ACTION_DIMENSIONCHANGED :\r\n\t\t\tif ( this.isFreeFloating == true ) {\r\n\t\t\t\tif ( binding == this._snapBinding ) {\r\n\t\t\t\t \tif ( this.isVisible == true ) {\r\n\t\t\t\t\t\tthis.updatePositionDimension ();\r\n\t\t\t\t\t\taction.consume ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase Binding.ACTION_VISIBILITYCHANGED : // see {DockBinding#interceptDisplayChange}\r\n\t\t\tif ( this.isFreeFloating == true ) {\r\n\t\t\t\tif ( binding == this._snapBinding ) {\r\n\t\t\t\t\tif ( binding.isVisible == true ) {\r\n\t\t\t\t\t\tthis.show ();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.hide ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// can we consume this?\r\n\t\t\tbreak;\r\n\r\n\t\tcase WindowBinding.ACTION_LOADED :\r\n\t\tcase WindowBinding.ACTION_ONLOAD :\r\n\r\n\t\t\tif ( binding.getContentWindow ().isPostBackDocument ) {\r\n\t\t\t\t// @see {MessageQueue#openView}\r\n\t\t\t\tif ( action.type == WindowBinding.ACTION_ONLOAD ) {\r\n\t\t\t\t\tvar arg = this._viewDefinition.argument;\r\n\t\t\t\t\tif ( arg != null && arg.list != null && arg.url != null ) {\r\n\t\t\t\t\t\tbinding.post ( arg.list, arg.url );\r\n\t\t\t\t\t\targ.list = null;\r\n\t\t\t\t\t\targ.url = null;\r\n\t\t\t\t\t\t// note that this prevents a repeat! Otherwise,\r\n\t\t\t\t\t\t// the previewwindow would fire this stuff...\r\n\t\t\t\t\t\t// TODO: hack this elsehow...\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif ( Client.isExplorer == true ) {\r\n\t\t\t\t\tif ( binding == this.windowBinding ) {\r\n\t\t\t\t\t\tvar self = this;\r\n\t\t\t\t\t\tDOMEvents.addEventListener (\r\n\t\t\t\t\t\t\tbinding.getContentWindow (),\r\n\t\t\t\t\t\t\tDOMEvents.UNLOAD, { // beforeunload invoked at random in exploder!\r\n\t\t\t\t\t\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\t\t\t\t\t\tif ( Binding.exists ( self._coverBinding ) == true ) {\r\n\t\t\t\t\t\t\t\t\t\tself._coverBinding.show ();\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( action.type == WindowBinding.ACTION_ONLOAD ) {\r\n\t\t\t\t\t\tif ( this._coverBinding ) {\r\n\t\t\t\t\t\t\tthis._coverBinding.hide ();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * Show non-framework document now. Otherwise\r\n\t\t\t * we wait for the PageBinding to initialize.\r\n\t\t\t */\r\n\t\t\tif ( action.type == WindowBinding.ACTION_ONLOAD ) {\r\n\t\t\t\tvar win = binding.getContentWindow ();\r\n\t\t\t\tif ( win.WindowManager == null ) {\r\n\t\t\t\t\tif ( !this._isLoaded ) {\r\n\t\t\t\t\t\tthis._onLoadingCompleted ( binding );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\tcase PageBinding.ACTION_ATTACHED :\r\n\r\n\t\t\t// reload scenario - PLEASE REFACTOR!\r\n\t\t\tif ( !binding.label && this._viewDefinition.label ) {\r\n\t\t\t\tbinding.label = this._viewDefinition.label;\r\n\t\t\t}\r\n\t\t\tif ( !binding.image && this._viewDefinition.image ) {\r\n\t\t\t\tbinding.image = this._viewDefinition.image;\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\t * Pin a reference to the currently mounted PageBinding\r\n\t\t\t * and set the page argument. Notice that all loaded pages\r\n\t\t\t * get served the same argument (although not subpages).\r\n\t\t\t */\r\n\t\t\tif ( binding.bindingWindow == this.getContentWindow ()) {\r\n\t\t\t\tthis._pageBinding = binding;\r\n\t\t\t\tthis._injectPageArgument ();\r\n\t\t\t}\r\n\r\n\t\tcase PageBinding.ACTION_INITIALIZED :\r\n\r\n\t\t\t/*\r\n\t\t\t * Show myself when the root page initializes.\r\n\t\t\t */\r\n\t\t\tif ( binding.bindingWindow == this.getContentWindow ()) {\r\n\t\t\t\tif ( Client.isExplorer && this._coverBinding ) {\r\n\t\t\t\t\tthis._coverBinding.hide ();\r\n\t\t\t\t}\r\n\t\t\t\tif ( !this._isLoaded ) {\r\n\t\t\t\t\tthis._onLoadingCompleted ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// dont consume - DockBinding and StageDialogBinding are listening!\r\n\t\t\tbreak;\r\n\r\n\r\n\t\tcase Binding.ACTION_DISPOSED :\r\n\r\n\t\t\tif ( this.isFreeFloating && binding == this._snapBinding ) {\r\n\t\t\t\tthis.removeActionListener ( Binding.ACTION_DISPOSED );\r\n\t\t\t\tthis.dispose ();\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t *\r\n\t\t */\r\n\t\tcase WizardPageBinding.ACTION_NAVIGATE_NEXT :\r\n\t\tcase WizardPageBinding.ACTION_NAVIGATE_PREVIOUS :\r\n\t\tcase WizardPageBinding.ACTION_FINISH :\r\n\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.VIEW_OPENING, this.getHandle ());\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * Detach view from server control. This happens when the server error page\r\n\t\t * is shown (since workflow termination will automatically close the view).\r\n\t\t * Detach is done simply by switching the associated {@link ViewDefinition}.\r\n\t\t * TODO: Something more elegant?\r\n\t\t */\r\n\t\tcase ViewBinding.ACTION_DETACH :\r\n\t\t\tthis.setDefinition ( ViewDefinitions [ \"Composite.Management.Null\" ]);\r\n\t\t\tViewBinding._instances.set(ViewBinding.normalizeHandle(this._viewDefinition.handle), this);\r\n\t\t\t// don't consume - TabPanelBinding is listening (waiting to un-dirty the tab).\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Implements (@link IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nViewBinding.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\r\n\tViewBinding.superclass.handleBroadcast.call ( this, broadcast, arg );\r\n\r\n\tswitch ( broadcast ) {\r\n\r\n\t\tcase BroadcastMessages.CLOSE_VIEW :\r\n\t\t\tif ( arg == this._viewDefinition.handle ) {\r\n\t\t\t\tthis.dispatchAction ( ViewBinding.ACTION_ONCLOSE );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.CLOSE_VIEWS :\r\n\t\t\tif (this._viewDefinition.position == DockBinding.MAIN) {\r\n\t\t\t\tthis.dispatchAction ( ViewBinding.ACTION_ONCLOSE_FORCE );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase BroadcastMessages.APPLICATION_SHUTDOWN :\r\n\t\t\tthis.dispose (); // this should happen automatically, but no...\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * On loading completed.\r\n */\r\nViewBinding.prototype._onLoadingCompleted = function () {\r\n\r\n\tif ( !this._isLoaded ) {\r\n\t\tthis._open ();\r\n\t\tthis._isLoaded = true;\r\n\t}\r\n}\r\n\r\n/**\r\n * Do stuff when opened.\r\n * @see {ViewBinding#onBindingDispose}\r\n */\r\nViewBinding.prototype._open = function () {\r\n\r\n\tViewBinding._instances.set(ViewBinding.normalizeHandle(this._viewDefinition.handle), this);\r\n\tthis.dispatchAction ( ViewBinding.ACTION_LOADED );\r\n\tEventBroadcaster.broadcast ( BroadcastMessages.VIEW_OPENED, this._viewDefinition.handle );\r\n\tthis.show ();\r\n\r\n\tthis.logger.fine ( \"ViewBinding opened: \\\"\" + this._viewDefinition.handle + \"\\\"\" );\r\n}\r\n\r\n/**\r\n * This method is invoked by the StageBinding when an already open ViewBinding\r\n * gets re-opened. The associated ViewDefinition argument is yet again relayed\r\n * to the contained PageBinding (if changed since last).\r\n * @see {StageBinding#_view}\r\n */\r\nViewBinding.prototype.update = function () {\r\n\r\n\tthis.dispatchAction ( Binding.ACTION_ACTIVATED );\r\n\tthis._injectPageArgument ();\r\n}\r\n\r\n/**\r\n * Relay ViewDefinition argument to contained PageBinding.\r\n */\r\nViewBinding.prototype._injectPageArgument = function () {\r\n\r\n\tvar page = this._pageBinding;\r\n\tvar def = this._viewDefinition;\r\n\r\n\tif ( page != null ) {\r\n\r\n\t\tvar argument = def.argument;\r\n\t\tif ( argument != null ) {\r\n\t\t\tpage.setPageArgument ( argument );\r\n\t\t}\r\n\t\tvar width = def.width;\r\n\t\tif ( width != null ) {\r\n\t\t\tpage.width = width;\r\n\t\t}\r\n\t\tvar height = def.height;\r\n\t\tif ( height != null ) {\r\n\t\t\tpage.height = height;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Handle crawler.\r\n * @implements {ICrawlerHandler}\r\n * @param {Crawler} crawler\r\n */\r\nViewBinding.prototype.handleCrawler = function ( crawler ) {\r\n\r\n\tViewBinding.superclass.handleCrawler.call ( this, crawler );\r\n\r\n\tswitch ( crawler.type ) {\r\n\r\n\t\t/*\r\n\t\t * Redirect descending crawlers back to DockPanelBinding.\r\n\t\t * Otherwise the crawler would continue straight to the\r\n\t\t * next view (because it is now crawling the viewset).\r\n\t\t */\r\n\t\tcase NodeCrawler.TYPE_DESCENDING :\r\n\t\t\tif ( this.isFreeFloating == true ) {\r\n\t\t\t\tif ( crawler.id == FocusCrawler.ID ) {\r\n\t\t\t\t\tif ( crawler.previousNode != this._snapBinding.bindingElement ) {\r\n\t\t\t\t\t\tcrawler.response = NodeCrawler.SKIP_NODE;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\t/*\r\n\t\t * Relay ascending crawlers to DockPanelBinding.\r\n\t\t */\r\n\t\tcase NodeCrawler.TYPE_ASCENDING :\r\n\r\n\t\t\tif ( this.isFreeFloating == true ) {\r\n\t\t\t\tcrawler.nextNode = this._snapBinding.bindingElement;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Show. Specialized setup for free-floating views.\r\n * @overwrites {Binding#show}\r\n */\r\nViewBinding.prototype.show = function () {\r\n\r\n\tif ( !this.isVisible ) {\r\n\t\tif (this.isFreeFloating == true) {\r\n\r\n\t\t\t//Workaround for #4508\r\n\t\t\tif (Client.isWebKit)\r\n\t\t\t\tthis.bindingElement.style.display = \"\";\r\n\r\n\t\t\tif (this._type == ViewBinding.TYPE_DOCKVIEW && this.windowBinding != null) {\r\n\t\t\t\tthis.windowBinding.getBindingElement ().style.position = \"static\";\r\n\t\t\t}\r\n\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tsetTimeout(function () { //Edge require timeout #522\r\n\t\t\t\tself.updatePositionDimension();\r\n\t\t\t\tself.isVisible = true;\r\n\t\t\t}, 0);\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\tViewBinding.superclass.show.call ( this );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Hide. Specialized setup for free-floating views.\r\n * @overwrites {Binding#hide}\r\n */\r\nViewBinding.prototype.hide = function () {\r\n\r\n\tif ( this.isVisible == true ) {\r\n\t\tif ( this.isFreeFloating == true ) {\r\n\t\t\tif ( this.windowBinding ) {\r\n\t\t\t\tthis.windowBinding.getBindingElement ().style.position = \"absolute\";\r\n\t\t\t}\r\n\t\t\tthis.bindingElement.style.top = \"-10000px\";\r\n\r\n\t\t\t//Workaround for #4508\r\n\t\t\tif (Client.isWebKit)\r\n\t\t\t\tthis.bindingElement.style.display = \"none\";\r\n\r\n\t\t\tthis.isVisible = false;\r\n\t\t} else {\r\n\t\t\tViewBinding.superclass.hide.call ( this );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {Point} point\r\n */\r\nViewBinding.prototype.setPosition = function ( point ) {\r\n\r\n\tpoint.x += ViewBinding.HORIZONTAL_ADJUST;\r\n\r\n\tthis.bindingElement.style.left = point.x + \"px\";\r\n\tthis.bindingElement.style.top = point.y + \"px\";\r\n}\r\n\r\n/**\r\n * @param {Dimension} dimension\r\n */\r\nViewBinding.prototype.setDimension = function ( dimension ) {\r\n\r\n\tdimension.h -= ViewBinding.VERTICAL_ADJUST;\r\n\tdimension.w -= ViewBinding.HORIZONTAL_ADJUST;\r\n\r\n\t/*\r\n\t * Something hardcoded here...\r\n\t */\r\n\tdimension.w -= 1;\r\n\r\n\tif ( dimension.h < 0 ) { // not sure why this happens...\r\n\t\tdimension.h = 0;\r\n\t}\r\n\tif ( dimension.w < 0 ) {\r\n\t\tdimension.w = 0;\r\n\t}\r\n\tthis.bindingElement.style.width = String ( dimension.w ) + \"px\";\r\n\tthis.bindingElement.style.height = String ( dimension.h ) + \"px\";\r\n}\r\n\r\n/**\r\n * TODO: create an interface to check for.\r\n * @param {Binding} binding\r\n */\r\nViewBinding.prototype.snapToBinding = function (binding, floating) {\r\n\r\n\t// Disable standard flexbox behavior.\r\n\t// TODO: enable for floating docks????????????????????????????????????????????\r\n\tthis.isFlexBoxBehavior = false;\r\n\r\n\t// Listen for these events instead...\r\n\tbinding.addActionListener ( Binding.ACTION_DIMENSIONCHANGED, this );\r\n\tbinding.addActionListener ( Binding.ACTION_VISIBILITYCHANGED, this );\r\n\tbinding.addActionListener ( Binding.ACTION_DISPOSED, this );\r\n\r\n\t// Unregister any previous snap target.\r\n\tif ( this._snapBinding ) {\r\n\t\tthis._snapBinding.removeActionListener ( Binding.ACTION_DIMENSIONCHANGED, this );\r\n\t\tthis._snapBinding.removeActionListener ( Binding.ACTION_VISIBILITYCHANGED, this );\r\n\t\tthis._snapBinding.removeActionListener ( Binding.ACTION_DISPOSED, this );\r\n\t\tthis._snapBinding.viewBinding = null;\r\n\t}\r\n\tthis._snapBinding = binding;\r\n\tthis._snapBinding.viewBinding = this;\r\n\tthis.isFreeFloating = floating !== false; // dafault is true\r\n\r\n\t// Initialize when first shown, creating and loading the WindowBinding\r\n\tif ( !this._isViewBindingInitialized ) {\r\n\t\tthis.initialize ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Very special setup: Migrate all Actions to the snaptarget\r\n * binding! Please note that this breaks the convention of\r\n * Actions travelling upwards in the structural hierarchy.\r\n * @overwrites {Binding#getMigrationParent}.\r\n */\r\nViewBinding.prototype.getMigrationParent = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.isFreeFloating == true ) {\r\n\t\tresult = this._snapBinding.getBindingElement ();\r\n\t} else {\r\n\t\tresult = ViewBinding.superclass.getMigrationParent.call ( this );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get the window object hosted by this ViewBinding.\r\n * During startup, this may be undefined.\r\n * @return {DOMDocumentView}\r\n */\r\nViewBinding.prototype.getContentWindow = function () {\r\n\r\n\treturn this.windowBinding.getContentWindow ();\r\n}\r\n\r\n/**\r\n * Get the document object hosted by this ViewBinding.\r\n * During startup, this may be undefined.\r\n * @return {DOMDocument}\r\n */\r\nViewBinding.prototype.getContentDocument = function () {\r\n\r\n\treturn this.windowBinding.getContentDocument ();\r\n}\r\n\r\n/**\r\n * Get the {@link RootBinding} hosted by this ViewBinding.\r\n * During startup, this may be undefined.\r\n * @return {RootBinding}\r\n */\r\nViewBinding.prototype.getRootBinding = function () {\r\n\r\n\treturn this.windowBinding.getRootBinding ();\r\n}\r\n\r\n/**\r\n * Get the {@link RootBinding} hosted by this ViewBinding.\r\n * During startup, this may be undefined.\r\n * @return {PageBinding}\r\n */\r\nViewBinding.prototype.getPageBinding = function () {\r\n\r\n\treturn this._pageBinding;\r\n}\r\n\r\n/**\r\n * Reload view. For now, this is only a developer feature.\r\n * @param {boolean} isClearCache Clear the cache in Prism.\r\n */\r\nViewBinding.prototype.reload = function ( isClearCache ) {\r\n\r\n\tthis._isLoaded = false;\r\n\tthis.windowBinding.reload ( isClearCache );\r\n\tEventBroadcaster.broadcast ( BroadcastMessages.VIEW_OPENING, this.getHandle ());\r\n}\r\n\r\n/**\r\n * Save contained editor. Probably invoked by DockBinding.\r\n * @see {DockBinding#saveContainedEditor}\r\n */\r\nViewBinding.prototype.saveContainedEditor = function () {\r\n\r\n\tvar isSuccess = false;\r\n\tvar page = this._pageBinding;\r\n\tif ( page != null && page instanceof EditorPageBinding ) {\r\n\t\tif ( page.canSave ()) {\r\n\t\t\tpage.doSave ();\r\n\t\t\tisSuccess = true;\r\n\t\t}\r\n\t}\r\n\tif ( !isSuccess ) {\r\n\t\tthis.logger.error ( \"saveContainedEditor failed\" );\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked be ancestor {IActivatable} when activated.\r\n * Invokes similar method on root binding, igniting a\r\n * chain reaction on all descendant root bindings.\r\n */\r\nViewBinding.prototype.onActivate = function () {\r\n\r\n\tif ( !this.isActivated ) {\r\n\t\tthis.isActivated = true;\r\n\t\tvar root = this.getRootBinding ();\r\n\t\tif ( root != null ) {\r\n\t\t\troot.onActivate ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Invoked be ancestor {IActivatable} when deactivated.\r\n * See comment above.\r\n */\r\nViewBinding.prototype.onDeactivate = function () {\r\n\r\n\tif ( this.isActivated == true ) {\r\n\t\tthis.isActivated = false;\r\n\t\tvar root = this.getRootBinding ();\r\n\t\tif ( root != null ) {\r\n\t\t\tthis.getRootBinding ().onDeactivate ();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * ViewBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {ViewBinding}\r\n */\r\nViewBinding.newInstance = function ( ownerDocument ) {\r\n\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:view\", ownerDocument );\r\n\tvar binding = UserInterface.registerBinding ( element, ViewBinding );\r\n\tbinding.windowBinding = binding.add ( WindowBinding.newInstance ( ownerDocument ));\r\n\treturn binding;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/views/ViewSetBinding.js",
    "content": "ViewSetBinding.prototype = new Binding;\r\nViewSetBinding.prototype.constructor = ViewSetBinding;\r\nViewSetBinding.superclass = Binding.prototype;\r\n\r\n/**\r\n * @class\r\n */\r\nfunction ViewSetBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"ViewSetBinding\" );\r\n\t\r\n\t/**\r\n\t * Block common crawlers. Although views are children of this \r\n\t * binding, they APPEAR to be positioned elsewhere in the tree, \r\n\t * so this list should plausibly be extended for future crawlers. \r\n\t * Note: The crawler will be directed into view from the dockpanel.\r\n\t * @see {DockPanelBinding#handleCrawler}\r\n\t * @overwrites {Binding#crawlerFilters}\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis.crawlerFilters\t= new List ([ FlexBoxCrawler.ID, FocusCrawler.ID ]);\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nViewSetBinding.prototype.toString = function () {\r\n\r\n\treturn \"[ViewSetBinding]\";\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/windows/PreviewWindowBinding.js",
    "content": "﻿PreviewWindowBinding.prototype = new WindowBinding;\r\nPreviewWindowBinding.prototype.constructor = PreviewWindowBinding;\r\nPreviewWindowBinding.superclass = WindowBinding.prototype;\r\n\r\nPreviewWindowBinding.URL_FULL_STOP = \"${root}/content/misc/preview/stop.aspx\";\r\nPreviewWindowBinding.URL_ERROR = \"${root}/content/misc/preview/error.aspx\";\r\nPreviewWindowBinding.ACTION_RETURN = \"return\";\r\nPreviewWindowBinding.TIMEOUT_RETURN = parseInt ( 2300 );\r\n\r\n\r\n/**\r\n * @class\r\n * This window is hardwired for HTTP POST previews.\r\n */\r\nfunction PreviewWindowBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"PreviewWindowBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {Map<String><String>}\r\n\t */\r\n\tthis._postBackList = null;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._postBackURL = null;\r\n\t\r\n\t/**\r\n\t * @type {CoverBinding}\r\n\t */\r\n\tthis._coverBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {WindowBinding}\r\n\t */\r\n\tthis._windowBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {WindowBinding}\r\n\t */\r\n\tthis._errorBinding = null;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasFullStop = false;\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isReturning = false;\r\n\t \r\n\t/**\r\n\t * @type {ILoadHandler}\r\n\t */\r\n\tthis._loadhandler = null;\r\n\t\r\n\t/**\r\n\t * @type {function}\r\n\t */\r\n\tthis._timeout = null;\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nPreviewWindowBinding.prototype.toString = function () {\r\n\r\n\treturn \"[PreviewWindowBinding]\";\r\n}\r\n\r\n/**\r\n * Append a cover to hide flashes-of-white while navigating.\r\n */\r\nPreviewWindowBinding.prototype.onBindingAttach = function () {\r\n\t\r\n\tPreviewWindowBinding.superclass.onBindingAttach.call ( this );\r\n\t\r\n\tthis.bindingElement.style.backgroundColor = \"white\"; // Mozilla is transparent!\r\n\tthis._coverBinding = this.add ( CoverBinding.newInstance ( this.bindingDocument ));\r\n\tthis._coverBinding.attach ();\r\n}\r\n\r\n/**\r\n * @param {DOMDocumentView} win\r\n * @overloads {WindowBinding#onWindowLoaded}\r\n */\r\nPreviewWindowBinding.prototype.onWindowLoaded = function ( win ) {\r\n\r\n\tif (this.getURL() != WindowBinding.DEFAULT_URL) {\r\n\r\n\t\tif (this.hasAccess(win)) {\r\n\t\t\tif (!this._hasFullStop) {\r\n\t\t\t\tif (win.isPostBackDocument) {\r\n\t\t\t\t\tif (this._isReturning) {\r\n\t\t\t\t\t\twin.submit(this._postBackList, this._postBackURL);\r\n\t\t\t\t\t\tthis._isReturning = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._coverBinding.hide();\r\n\t\t\t\t}\r\n\t\t\t\tif (!win.isDefaultDocument) {\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tthis._loadhandler = {\r\n\t\t\t\t\t\thandleEvent: function (e) {\r\n\t\t\t\t\t\t\t//self._coverBinding.show ();\r\n\t\t\t\t\t\t\tif (win.isPostBackDocument) {\r\n\t\t\t\t\t\t\t\tself._postBackList = win.postBackList;\r\n\t\t\t\t\t\t\t\tself._postBackURL = win.postBackURL;\r\n\t\t\t\t\t\t\t} else if (!win.isDefaultDocument) {\r\n\t\t\t\t\t\t\t\tself._fullStop();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tDOMEvents.addEventListener(\r\n\t\t\t\t\t\twin,\r\n\t\t\t\t\t\tDOMEvents.BEFOREUNLOAD,\r\n\t\t\t\t\t\tthis._loadhandler\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis._coverBinding.hide();\r\n\t\t}\r\n\t}\r\n\t\r\n\tPreviewWindowBinding.superclass.onWindowLoaded.call ( this, win );\r\n}\r\n\r\n/**\r\n * Show full stop message. Note that the forbidden \r\n * page is in fact loaded behind the curtains. \r\n */\r\nPreviewWindowBinding.prototype._fullStop = function () {\r\n\r\n\tthis._coverBinding.show ();\r\n\t\r\n\tif ( this._windowBinding == null ) {\r\n\t\t\r\n\t\tthis._windowBinding = this._getWindowBinding ();\r\n\t\tthis._windowBinding.setURL ( PreviewWindowBinding.URL_FULL_STOP );\r\n\t\tthis._windowBinding.hide ();\r\n\t\tthis._windowBinding.attach ();\r\n\t\t\r\n\t\tthis._windowBinding.addActionListener ( WindowBinding.ACTION_LOADED, {\r\n\t\t\thandleAction : function ( action ) {\r\n\t\t\t\taction.target.show ();\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tthis._windowBinding.show ();\r\n\t}\r\n\r\n\tthis._hasFullStop = true;\r\n\tthis.addActionListener ( PreviewWindowBinding.ACTION_RETURN );\r\n\tthis.setURL ( WindowBinding.DEFAULT_URL ); // nuke the forbidden document!\r\n\t\r\n\t/*\r\n\t * Auto-return after a short timeout. Note that a mouseclick  \r\n\t * anywhere inside the stop page also triggers a return.\r\n\t */\r\n\tvar self = this;\r\n\tthis._timeout = setTimeout ( function () {\r\n\t\tself._return ();\r\n\t}, PreviewWindowBinding.TIMEOUT_RETURN );\r\n};\r\n\r\n/**\r\n * Show error message. Invoked by the {@link EditorPageBinding}\r\n * TODO: Fuse this._errorBinding with this._windowBinding?\r\n */\r\nPreviewWindowBinding.prototype.error = function () {\r\n\t\r\n\tthis._coverBinding.show ();\r\n\t\r\n\tif ( this._errorBinding == null ) {\r\n\t\t\r\n\t\tthis._errorBinding = this._getWindowBinding ();\r\n\t\tthis._errorBinding.setURL ( PreviewWindowBinding.URL_ERROR );\r\n\t\tthis._errorBinding.hide ();\r\n\t\tthis._errorBinding.attach ();\r\n\t\t\r\n\t\tthis._errorBinding.addActionListener ( WindowBinding.ACTION_LOADED, {\r\n\t\t\thandleAction : function ( action ) {\r\n\t\t\t\taction.target.show ();\r\n\t\t\t\taction.consume ();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t} else {\r\n\t\t\r\n\t\tthis._errorBinding.show ();\r\n\t}\r\n\r\n\tthis._hasError = true;\r\n\tthis.setURL ( WindowBinding.DEFAULT_URL );\r\n};\r\n\r\n/**\r\n * @return {WindowBinding}\r\n */\r\nPreviewWindowBinding.prototype._getWindowBinding = function () {\r\n\t\r\n\tvar win = this._coverBinding.add ( WindowBinding.newInstance ( this.bindingDocument ));\r\n\t\r\n\t/*\r\n\t * TODO: Move to (general) CSS\r\n\t */\r\n\twin.isFlexible = false;\r\n\twin.bindingElement.style.position = \"absolute\";\r\n\twin.bindingElement.style.width = \"100%\";\r\n\twin.bindingElement.style.height = \"100%\";\r\n\t\r\n\treturn win;\r\n}\r\n\r\n/**\r\n * @implements {IActionListener}\r\n * @overloads {PageBinding#handleAction}\r\n * @param {Action} action\r\n */\r\nPreviewWindowBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tPreviewWindowBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\tcase PreviewWindowBinding.ACTION_RETURN :\r\n\t\t\tthis._return ();\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Return from full stop page.\r\n */\r\nPreviewWindowBinding.prototype._return = function () {\r\n\t\r\n\tclearTimeout ( this._timeout );\r\n\tthis._timeout = null;\r\n\t\r\n\tthis.removeActionListener ( PreviewWindowBinding.ACTION_RETURN );\r\n\tthis._windowBinding.hide ();\r\n\tthis._hasFullStop = false;\r\n\tthis._isReturning = true;\r\n\tthis.setURL ( WindowBinding.POSTBACK_URL );\r\n}\r\n\r\n/**\r\n * Reset setup. This method is invoked by the  \r\n * {@link EditorPageBinding} when another tab is selected.\r\n */\r\nPreviewWindowBinding.prototype.reset = function () {\r\n\t\r\n\tif ( this._timeout != null ) {\r\n\t\tclearTimeout ( this._timeout );\r\n\t\tthis._timeout = null;\r\n\t}\r\n\t\r\n\tif ( this._errorBinding != null ) {\r\n\t\tif ( this._errorBinding.isVisible ) {\r\n\t\t\tthis._errorBinding.hide ();\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\tif ( this._windowBinding != null ) {\r\n\t\tif ( this._windowBinding.isVisible ) {\r\n\t\t\tthis._windowBinding.hide ();\r\n\t\t}\r\n\t}\r\n\t\r\n\tif ( this._loadhandler != null ) {\r\n\t\tif (this.getURL() != WindowBinding.DEFAULT_URL) {\r\n\t\t\tvar win = this.getContentWindow();\r\n\t\t\tif (this.hasAccess(win)) {\r\n\t\t\t\tDOMEvents.removeEventListener(\r\n\t\t\t\t\twin,\r\n\t\t\t\t\tDOMEvents.BEFOREUNLOAD,\r\n\t\t\t\t\tthis._loadhandler\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tthis._loadhandler = null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tthis._hasError = false;\r\n\tthis._hasFullStop = false;\r\n\tthis._isReturning = false;\r\n\t\r\n\t//this._coverBinding.show ();\r\n\tthis.setURL ( WindowBinding.DEFAULT_URL );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/windows/WindowBinding.js",
    "content": "﻿WindowBinding.prototype = new FlexBoxBinding;\r\nWindowBinding.prototype.constructor = WindowBinding;\r\nWindowBinding.superclass = FlexBoxBinding.prototype;\r\n\r\nWindowBinding.ACTION_LOADED\t\t= \"window loaded\";\r\nWindowBinding.ACTION_ONLOAD \t= \"alien window loaded\";\r\nWindowBinding.DEFAULT_URL \t\t= \"${root}/blank.aspx\";\r\nWindowBinding.DEFAULT_TITLE \t= \"Composite.Management.Blank\";\r\nWindowBinding.POSTBACK_URL \t\t= \"${root}/postback.aspx\"; \r\nWindowBinding.POSTBACK_TITLE \t= \"Composite.Management.DefaultPostBack\";\r\n\r\n/**\r\n * Extract well-formed XHTML source from WindowBinding instance. \r\n * This involves a roundtrip to the server, so use with caution. \r\n * TODO: handle namespace declarations in contained document?\r\n * @param {WindowBinding} windowBinding\r\n * @return {string}\r\n */\r\nWindowBinding.getMarkup = function ( windowBinding ) {\r\n\t\r\n\tvar result = null;\r\n\tif ( windowBinding.isAttached ) {\r\n\t\tvar doc = windowBinding.getContentDocument ();\r\n\t\tif (doc != null) {\r\n\t\t\tif (Client.isAnyExplorer) {\r\n\t\t\t\tresult = doc.documentElement.outerHTML;\r\n\t\t\t} else {\r\n\t\t\t\tresult = new XMLSerializer().serializeToString(doc);\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/** \r\n * Highlight a list of keywords inside a WindowBinding instance. \r\n * This stuff is used for SEOAssistant in preview and browser.\r\n * @param {WindowBinding} windowBinding\r\n * @param {List<string>} list\r\n */\r\nWindowBinding.highlightKeywords = function ( windowBinding, list ) {\r\n\t\r\n\tif ( WindowBinding._highlightcrawler == null ) {\r\n\t\tWindowBinding._highlightcrawler = new WindowBindingHighlightNodeCrawler ();\r\n\t}\r\n\t\r\n\tif ( windowBinding.isAttached ) {\r\n\t\tvar doc = windowBinding.getContentDocument ();\r\n\t\tif ( doc != null ) {\r\n\t\t\tvar crawler = WindowBinding._highlightcrawler;\r\n\t\t\tcrawler.reset ( doc.body );\r\n\t\t\tif ( list != null ) {\r\n\t\t\t\tcrawler.setKeys ( list );\r\n\t\t\t\tcrawler.crawl ( doc.body );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * This fellow handles inline highlighting of keywords in preview windows.\r\n * @type {WindowBindingHighlightNodeCrawler}\r\n * @see {WindowBinding.highlightKeywords}\r\n */\r\nWindowBinding._highlightcrawler = null;\r\n\r\n/**\r\n * @class\r\n * For some reason, iframe content pages must be loaded dynamically for \r\n * Mozilla to display them consistantly after page reload. The WindowBinding \r\n * does precisely that. We've added some {@link FlexBoxBinding} functionality.\r\n */\r\nfunction WindowBinding () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"WindowBinding\" );\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis._target = null;\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><string>}\r\n\t */\r\n\tthis._parameterMap = null;\r\n\t\r\n\t/**\r\n\t * Points to the currently hosted PageBinding. Note that this is now a \r\n\t * prequisite for bindings to be disposed when window gets unloaded!\r\n\t * @type {PageBinding);\r\n\t */\r\n\tthis._pageBinding = null;\r\n\t\r\n\t/**\r\n\t * True while reloading. This helps us control cache in Prism.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isReloading = false;\r\n\t\r\n\t/**\r\n\t * This one watches for the load event in the iframe document. If an  \r\n\t * alien document is loaded, it will automatically be adapted to fit \r\n\t * (event listeners and stuff is registered).\r\n\t * @type {IEventListener}\r\n\t */\r\n\tthis._onloadHandler = null;\r\n\t\r\n\t/**\r\n\t * @type {IEventListener}\r\n\t */\r\n\tthis._unloadHandler = null;\r\n\t\r\n\t/**\r\n\t * Used to fire the onload event as soon as possible. That is, \r\n\t * when the onload event is supposed to fire! Seems that \r\n\t * Firefox3 evaluates the WindowManager onload event first, \r\n\t * so that all bindings have been registered (and attached?) \r\n\t * when the onload event is fired on the iframe.\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._hasLoadActionFired = false;\r\n\t\r\n\t/**\r\n\t * indicate that iframe should not part of framework\r\n\t * @type {Boolean}\r\n\t */\r\n\tthis._native = false;\r\n\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n};\r\n\r\n/**\r\n * Identifies binding.\r\n */\r\nWindowBinding.prototype.toString = function () {\r\n\t\r\n\treturn \"[WindowBinding]\";\r\n};\r\n\r\n/**\r\n * Serialize binding.\r\n * @return {HashMap<string><object>}\r\n */\r\nWindowBinding.prototype.serialize = function () {\r\n\t\r\n\tvar result = WindowBinding.superclass.serialize.call ( this );\r\n\tif ( result ) {\r\n\t\tresult.url = this.getURL ();\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/**\r\n * @overloads {FlexBoxBinding#onBindingRegister}\r\n */\r\nWindowBinding.prototype.onBindingRegister = function () {\r\n\r\n\tWindowBinding.superclass.onBindingRegister.call ( this );\r\n\tthis.addActionListener ( RootBinding.ACTION_PHASE_3 );\r\n\tthis.addActionListener ( PageBinding.ACTION_INITIALIZED );\r\n\tthis.addActionListener ( RootBinding.ACTION_ACTIVATED );\r\n\tthis.addActionListener ( RootBinding.ACTION_DEACTIVATED );\r\n};\r\n\r\n/**\r\n * @overloads {Binding#onBindingAttach}\r\n */\r\nWindowBinding.prototype.onBindingAttach = function () {\r\n\r\n\tif (this.getProperty(\"native\"))\r\n\t\tthis._native = this.getProperty(\"native\");\r\n\r\n\tthis.buildDOMContent ();\r\n\tWindowBinding.superclass.onBindingAttach.call ( this );\r\n\tthis.setURL ( this.getURL ());\r\n};\r\n\r\n/**\r\n * Dispose content document on dispose.\r\n * @overloads {Binding#onBindingDispose}\r\n */\r\nWindowBinding.prototype.onBindingDispose = function () {\r\n\t\r\n\tWindowBinding.superclass.onBindingDispose.call ( this );\r\n\t\r\n\t/*\r\n\t * TODO: Aint this handled by  \r\n\t * the unloadlistener already?\r\n\t */\r\n\tthis._disposeContentDocument ();\r\n};\r\n\r\n/*\r\n * Ignite a chain reaction to dispose all bindings (in nested frames) within \r\n * contained window. Note that chain breaks when a window hosts no PageBinding!\r\n */\r\nWindowBinding.prototype._disposeContentDocument = function () {\r\n\t\r\n\tif ( this._pageBinding != null ) {\r\n\t\tvar win = this.getContentWindow ();\r\n\t\tif ( win != null ) {\r\n\t\t\tvar manager = this.getContentWindow ().DocumentManager;\r\n\t\t\tif ( manager != null ) {\r\n\t\t\t\tmanager.detachAllBindings ();\r\n\t\t\t\tthis._pageBinding = null;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Please notice that this implies that a WindowBinding will only dispatch \r\n * the ACTION_LOADED loaded event if an on-server file is loaded!!!\r\n * @overloads {Binding#handleAction}\r\n * @param {Action} action\r\n */\r\nWindowBinding.prototype.handleAction = function ( action ) {\r\n\t\r\n\tWindowBinding.superclass.handleAction.call ( this, action );\r\n\t\r\n\tvar binding = action.target;\r\n\t\r\n\tswitch ( action.type ) {\r\n\t\r\n\t\tcase RootBinding.ACTION_PHASE_3 :\r\n\t\t\t\r\n\t\t\tif ( binding.bindingDocument == this.getContentDocument ()) {\r\n\t\t\t\tif ( this._isReloading == true ) {\r\n\t\t\t\t\tthis._isReloading = false;\r\n\t\t\t\t\tif ( Client.isPrism == true ) {\r\n\t\t\t\t\t\tPrism.enableCache ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.dispatchAction ( WindowBinding.ACTION_LOADED );\r\n\t\t\t}\r\n\t\t\t// dont consume - pagebinding may be listening!\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase PageBinding.ACTION_INITIALIZED :\r\n\t\t\t\r\n\t\t\tthis._onPageInitialize ( binding );\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\t/*\r\n\t\t * Simply consume this event. Only descendant bindings   \r\n\t\t * will be listening. We can listen to the same event   \r\n\t\t * on the RootBinding in our own bindingDocument.\r\n\t\t */\r\n\t\tcase RootBinding.ACTION_ACTIVATED :\r\n\t\tcase RootBinding.ACTION_DEACTIVATED :\r\n\t\t\taction.consume ();\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n/**\r\n * @implements {IFit}\r\n * @overwrites {FlexBoxBinding#fit}\r\n * @param {boolean} isForce\r\n */\r\nWindowBinding.prototype.fit = function ( isForce ) {\r\n\t\r\n\tif ( !this.isFit || isForce ) {\r\n\t\tif ( this._pageBinding != null ) {\r\n\t\t\tthis.setHeight ( this._pageBinding.getHeight ());\r\n\t\t\tthis.isFit = true;\r\n\t\t}\r\n\t}\r\n};\r\n \r\n/**\r\n * Invoked when contained page initializes.\r\n * @param {PageBinding} binding\r\n */\r\nWindowBinding.prototype._onPageInitialize = function ( binding ) {\r\n\t\r\n\t/*\r\n\t * Fetch a pointer to the main page.\r\n\t */\r\n\tif ( this._pageBinding == null ) {\r\n\t\tif ( binding.bindingWindow == this.getContentWindow ()) {\r\n\t\t\tthis._pageBinding = binding;\t\r\n\t\t}\r\n\t}\r\n\t\r\n\t/*\r\n\t * Handle dialog sub pages ...\r\n\t * Remember that the page gets converted \r\n\t * to a subpage opon attachment already! \r\n\t * Also remember that the page property \r\n\t * \"fitasdialogsubpage\" can override this.\r\n\t *\r\n\tif ( binding.isDialogSubPage ) {\r\n\t\tif ( binding.bindingDocument == this.getContentDocument ()) {\r\n\t\t\tthis.setHeight (\r\n\t\t\t\tbinding.getHeight ()\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\t*/\r\n};\r\n\r\n/**\r\n * Build the iframe and setup alien watch.\r\n */\r\nWindowBinding.prototype.buildDOMContent = function () {\r\n\r\n\tthis.shadowTree.iframe = DOMUtil.createElementNS ( Constants.NS_XHTML, \"iframe\", this.bindingDocument );\r\n\tthis.shadowTree.iframe.setAttribute ( \"frameborder\", \"0\" );\r\n\tthis.shadowTree.iframe.frameBorder = 0;\r\n\tthis.shadowTree.iframe.id = KeyMaster.getUniqueKey();\r\n\tthis.shadowTree.iframe.name = this.shadowTree.iframe.id;\r\n\tthis.bindingElement.appendChild ( this.shadowTree.iframe );\r\n\tthis._registerOnloadListener(true);\r\n};\r\n\r\n/**\r\n * Register onload listener.\r\n * @param {boolean} isRegister\r\n */\r\nWindowBinding.prototype._registerOnloadListener = function ( isRegister ) {\r\n\t\r\n\tvar iframe = this.shadowTree.iframe;\r\n\tvar action = isRegister ? \"addEventListener\" : \"removeEventListener\";\r\n\r\n\tif ( this._onloadHandler == null ) {\r\n\t\tvar self = this;\r\n\t\tthis._onloadHandler = {\r\n\t\t\thandleEvent : function ( e ) {\r\n\t\t\t\t\r\n\t\t\t\t\tvar isComplete = true;\r\n\t\t\t\t\tif ( Client.isExplorer ) {\r\n\t\t\t\t\t\tisComplete = iframe.readyState == \"complete\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( isComplete == true ) {\r\n\t\t\t\t\t\tif ( self.getURL () != WindowBinding.DEFAULT_URL ) {\r\n\t\t\t\t\t\t\tif ( !self._hasLoadActionFired ) {\r\n\t\t\t\t\t\t\t\tself.onWindowLoaded ( \r\n\t\t\t\t\t\t\t\t\tself.getContentWindow ()\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tDOMEvents [ action ] ( \r\n\t\tthis.shadowTree.iframe,\r\n\t\tClient.isExplorer == true ? \"readystatechange\" : DOMEvents.LOAD, \r\n\t\tthis._onloadHandler\r\n\t);\r\n};\r\n\r\n/**\r\n * Setup to reset on unload. This involves binding detachment.\r\n * @param {boolean} isRegister\r\n * @return\r\n */\r\nWindowBinding.prototype._registerUnloadListener = function ( isRegister ) {\r\n\t\r\n\tvar action = isRegister ? \"addEventListener\" : \"removeEventListener\";\r\n\t\r\n\tif ( this._unloadHandler == null ) {\r\n\t\tvar self = this;\r\n\t\tthis._unloadHandler = {\r\n\t\t\thandleEvent : function () {\r\n\t\t\t\tself._disposeContentDocument ();\r\n\t\t\t\tself._hasLoadActionFired = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tDOMEvents [ action ] ( \r\n\t\tthis.getContentWindow (),\r\n\t\tDOMEvents.UNLOAD, \r\n\t\tthis._unloadHandler\r\n\t);\r\n};\r\n\r\n/**\r\n * Invoked when the contained document fires the onload event. \r\n * Note that the default URL doesn't dispatch actions (since \r\n * it is nearly always loaded on startup).\r\n * @param {DOMDocumentView} win\r\n */\r\nWindowBinding.prototype.onWindowLoaded = function ( win ) {\r\n\t\r\n\t/*\r\n\t * When overloading, PLACE YOUR CODE HERE! This \r\n\t * will respect the value of _hasLoadActionFired.\r\n\t */\r\n\t\r\n\t/*\r\n\t * Strange glitch can occur here. In both \r\n\t * browsers, apparently. Please investigate.\r\n\t */\r\n\tif ( win == null ) {\r\n\t\tthis.logger.error ( \"WindowBinding#onWindowLoaded: Bad argument: \" + this.getURL ());\r\n\t} else if ( this.getURL () != WindowBinding.DEFAULT_URL ) {\r\n\t\tif (!this._hasLoadActionFired && this.hasAccess(win)) {\r\n\t\t\tif ( win != null && win.document != null && win.document.body != null ) {\r\n\t\t\t\twin.document.body.style.border = \"none\";\r\n\t\t\t\tif ( win.WindowManager == undefined && !this._native) {\r\n\t\t\t\t\tApplication.framework(win.document);\r\n\t\t\t\t}\r\n\t\t\t\tif ( this._isReloading == true ) {\r\n\t\t\t\t\tthis._isReloading = false;\r\n\t\t\t\t\tif ( Client.isPrism ) {\r\n\t\t\t\t\t\tPrism.enableCache ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis._registerUnloadListener ( true );\r\n\t\t\tthis.dispatchAction ( WindowBinding.ACTION_ONLOAD );\r\n\t\t\tthis._hasLoadActionFired = true;\r\n\r\n\t\t\tthis.fitContentWindow();\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Set URL.\r\n * @param {string} url\r\n * @param {map} data\r\n */\r\nWindowBinding.prototype.setURL = function ( url, data) {\r\n\r\n\tthis.setProperty ( \"url\", url );\r\n\tthis._hasLoadActionFired = false;\r\n\t\r\n\tif ( this.isAttached == true ) {\r\n\t\r\n\t\t/*\r\n\t\t * Mozilla hardcore-caches the page from last page-refresh \r\n\t\t * unless we do this ugly hack. This bug is serious, but \r\n\t\t * apparently not documented anywhere!\r\n\t\t * TODO: File this hideous bug.\r\n\t\t * UPDATE: The bug seems to have been fixed...?\r\n\t\t *\r\n\t\tif ( this.shadowTree.iframe == null ) {\r\n\t\t\tthis.buildDOMContent ();\r\n\t\t} \r\n\t\t*/\r\n\t\t\r\n\t\t/*\r\n\t\t * Dispose possible contained bindings.\r\n\t\t * TODO: Aint this handled by the unloadlistener?\r\n\t\t */\r\n\t\tthis._disposeContentDocument ();\r\n\t\t\r\n\t\t/*\r\n\t\t * Load resolved URL.\r\n\t\t */\r\n\t\tif (url.length > 1900) {\r\n\t\t\tvar actionUrl = new Uri(Resolver.resolve(url));\r\n\t\t\tif (!data) data = new Map();\r\n\t\t\t\r\n\t\t\tactionUrl.getQueryString().each(function(name, value) {\r\n\t\t\t\tif (value.length > 512) {\r\n\t\t\t\t\tdata.set(name, value);\r\n\t\t\t\t\tactionUrl.setParam(name, null);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\turl = actionUrl.toString();\r\n\t\t}\r\n\t\t\r\n\t\tif (data) {\r\n\t\t\tvar self = this;\r\n\t\t\tvar iframe = this.getFrameElement();\r\n\r\n\t\t\tif(typeof this.shadowTree.form == 'undefined'){\r\n\t\t\t\t\r\n\t\t\t\tthis.shadowTree.form = DOMUtil.createElementNS ( Constants.NS_XHTML, \"form\", this.bindingDocument );\r\n\t\t\t\tthis.shadowTree.form.style.display = \"none\";\r\n\t\t\t\tthis.shadowTree.form.enctype = \"application/x-www-form-urlencoded\";\r\n\t\t\t\tthis.shadowTree.form.method = \"POST\";\r\n\t\t\t\tthis.bindingElement.appendChild(this.shadowTree.form);\r\n\t\t\t}\r\n\t\t\tvar form = this.shadowTree.form;\r\n\r\n\t\t\tform.action = url;\r\n\t\t\tform.target = iframe.id;\r\n\t\t\tform.setAttribute(\"target\", iframe.id);\r\n\t\t\twhile(form.firstChild){\r\n\t\t\t\t   form.removeChild(form.firstChild);\r\n\t\t\t}\r\n\r\n\t\t\tdata.each(function (name, value) {\r\n\t\t\t\tvar input = self.bindingDocument.createElement(\"input\");\r\n\t\t\t\tinput.name = name;\r\n\t\t\t\tinput.value = value;\r\n\t\t\t\tinput.type = \"hidden\";\r\n\t\t\t\tform.appendChild(input);\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tform.submit();\r\n\r\n\t\t} else {\r\n\t\t\tthis.getFrameElement().src = Resolver.resolve(url);\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Unlike an iframe \"src\" attribute, this doesn't \r\n * nescessarily include protocol, host and port information. \r\n * If the url was supplied with a \"${root}\" type pattern, \r\n * this will be reflected in the returned result.\r\n * @return {string}\r\n */\r\nWindowBinding.prototype.getURL = function () {\r\n\t\r\n\tvar result = WindowBinding.DEFAULT_URL;\r\n\tvar url = this.getProperty ( \"url\" );\r\n\tif ( url ) {\r\n\t\tresult = url;\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/**\r\n * Reload. TODO: handle the isClearCache stuff!!!!!!!!!!!!\r\n * @param {boolean} isClearCache Clears the cache in Prism.\r\n */\r\nWindowBinding.prototype.reload = function ( isClearCache ) {\r\n\t\r\n\tthis._disposeContentDocument ();\r\n\tif ( Client.isPrism ) {\r\n\t\tPrism.disableCache ();\r\n\t}\r\n\tthis._isReloading = true;\r\n\tthis.getContentDocument ().location.reload ();\r\n};\r\n\r\n/**\r\n * Get the iframe element associated to this WindowBinding.\r\n * @return {DOMElement}\r\n */\r\nWindowBinding.prototype.getFrameElement = function () {\r\n\t\r\n\tvar result = null;\r\n\tif ( this.shadowTree.iframe != null ) {\r\n\t\tresult = this.shadowTree.iframe;\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/**\r\n * @return {Boolean}\r\n */\r\nWindowBinding.prototype.hasAccess = function (win) {\r\n\r\n\tvar result = false;\r\n\tif (win) {\r\n\t\ttry {\r\n\t\t\tresult = win.document != null;\r\n\t\t} catch (e) {\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n\r\n/**\r\n * Get the window object hosted by this WindowBinding. \r\n * During startup, this may be undefined. \r\n * @return {DOMDocumentView}\r\n */\r\nWindowBinding.prototype.getContentWindow = function () {\r\n\t\r\n\tvar result = null, frame = this.getFrameElement ();\r\n\tif ( frame !== null ) {\r\n\t\ttry {\r\n\t\t\tresult = frame.contentWindow;\r\n\t\t} catch ( e ) {\r\n\t\t\tthis.logger.error ( \"WindowBinding#getContentWindow: strange IE9 error\" );\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/**\r\n * Get the document object hosted by this WindowBinding.\r\n * @return {DOMDocument}\r\n */\r\nWindowBinding.prototype.getContentDocument = function () {\r\n\t\r\n\tvar result = null, win = this.getContentWindow ();\r\n\tif (this.hasAccess(win) ) {\r\n\t\tresult = win.document;\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/**\r\n * Get the RootBinding contained in this WindowBinding.\r\n * @return {RootBinding}\r\n */\r\nWindowBinding.prototype.getRootBinding = function () {\r\n\t\r\n\tvar result = null, doc = this.getContentDocument ();\r\n\tif ( doc && doc.body ) {\r\n\t\tresult = UserInterface.getBinding ( \r\n\t\t\tdoc.body \r\n\t\t);\r\n\t}\r\n\treturn result;\r\n};\r\n\r\n/**\r\n * Get the PageBinding contained in this WindowBinding.\r\n * @return {PageBinding}\r\n */\r\nWindowBinding.prototype.getPageBinding = function () {\r\n\t\r\n\treturn this._pageBinding;\r\n};\r\n\r\n/**\r\n * @param {int} height\r\n */\r\nWindowBinding.prototype.setHeight = function ( height ) {\r\n\t\r\n\tthis.bindingElement.style.height = height + \"px\";\r\n};\r\n\r\n/**\r\n * Iframes should never undisplay. Contained  \r\n * document may not survive it (eg applets).\r\n * @overwrites {Binding#hide}\r\n */\r\nWindowBinding.prototype.hide = function () {\r\n\t\r\n\tif ( this.isVisible == true ) {\r\n\t\tthis.bindingElement.style.visibility = \"hidden\";\r\n\t\tthis.isVisible = false;\r\n\t}\r\n};\r\n\r\n/**\r\n * @overwrites {Binding#show}\r\n */\r\nWindowBinding.prototype.show = function () {\r\n\t\r\n\tif ( !this.isVisible ) {\r\n\t\tthis.bindingElement.style.visibility = \"visible\";\r\n\t\tthis.isVisible = true;\r\n\t}\r\n};\r\n\r\n/**\r\n * Directing all crawlers into contained document \r\n * only if it looks lile be a framework document.\r\n * @implements {ICrawlerHandler}\r\n * @param {Crawler} crawler\r\n */\r\nWindowBinding.prototype.handleCrawler = function ( crawler ) {\r\n\t\r\n\tWindowBinding.superclass.handleCrawler.call ( this, crawler );\r\n\t\r\n\tif ( crawler.type == NodeCrawler.TYPE_DESCENDING ) {\r\n\t\tvar root = this.getRootBinding ();\r\n\t\tif ( root != null ) {\r\n\t\t\tcrawler.nextNode = root.bindingElement;\r\n\t\t} else {\r\n\t\t\tcrawler.response = NodeCrawler.SKIP_CHILDREN;\r\n\t\t}\r\n\t}\t\r\n};\r\n\r\n/**\r\n * Performs a HTTP post to the given URL.\r\n * @param {List<object>} list\r\n * @param {String} url\r\n */\r\nWindowBinding.prototype.post = function ( list, url ) {\r\n\t\r\n\tvar win = this.getContentWindow ();\r\n\tif ( win.isPostBackDocument ) {\r\n\t\twin.submit ( list, url );\r\n\t} else  {\r\n\t\tthrow \"Post aborted\";\r\n\t}\r\n};\r\n\r\n/**\r\n * Action dispatched to be intercepted by the {@link ViewBinding}.\r\n * @implements {IFlexible}\r\n */\r\nWindowBinding.prototype.flex = function () {\r\n\r\n\tthis.fitContentWindow();\r\n\tWindowBinding.superclass.flex.call(this);\r\n}\r\n\r\n\r\n/**\r\n * Fit ContentWindows to WindowBinding.\r\n */\r\nWindowBinding.prototype.fitContentWindow = function () {\r\n\tif (Client.isPad) {\r\n\t\tvar contentWindow = this.getContentWindow();\r\n\t\tif (contentWindow != null && contentWindow.document != null\r\n\t\t\t&& contentWindow.document.body != null)\r\n\t\t{\r\n\t\t\tif(this.bindingElement.offsetHeight)\r\n\t\t\t\tcontentWindow.document.body.style.height = this.bindingElement.offsetHeight + \"px\";\r\n\t\t\tif (this.bindingElement.offsetWidth)\r\n\t\t\t\tcontentWindow.document.body.style.width = this.bindingElement.offsetWidth + \"px\";\r\n\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * WindowBinding factory.\r\n * @param {DOMDocument} ownerDocument\r\n * @return {WindowBinding}\r\n */\r\nWindowBinding.newInstance = function ( ownerDocument ) {\r\n\t\r\n\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, \"ui:window\", ownerDocument );\r\n\tvar binding = UserInterface.registerBinding ( element, WindowBinding );\r\n\treturn binding;\r\n};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/bindings/windows/WindowBindingHighlightNodeCrawler.js",
    "content": "WindowBindingHighlightNodeCrawler.prototype = new NodeCrawler;\r\nWindowBindingHighlightNodeCrawler.prototype.constructor = WindowBindingHighlightNodeCrawler;\r\nWindowBindingHighlightNodeCrawler.superclass = NodeCrawler.prototype;\r\n\r\nWindowBindingHighlightNodeCrawler.CLASSNAME_HIGHLIGHT = \"compositec1generatedhighlight\";\r\n\r\n/**\r\n * @class\r\n */\r\nfunction WindowBindingHighlightNodeCrawler () {\r\n\r\n\t/**\r\n\t * @type {List<string>}\r\n\t */\r\n\tthis._keywords = null;\r\n\t\r\n\t/**\r\n\t * @type {Map<string><RegExp>}\r\n\t */\r\n\tthis._map = new Map ();\r\n\t\r\n\t/**\r\n\t * @type {List<DOMTextNode}\r\n\t */\r\n\tthis._textnodes = null;\r\n\t\r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Filter all but Element nodes.\r\n * @overloads {NodeCrawler#_construct} \r\n */\r\nWindowBindingHighlightNodeCrawler.prototype._construct = function () {\r\n\t\r\n\tElementCrawler.superclass._construct.call ( this );\r\n\t\r\n\tthis.addFilter ( function ( node, arg ) {\r\n\t\tvar result = null;\r\n\t\tif ( node.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\tvar nodename = node.nodeName.toLowerCase ();\r\n\t\t\tswitch ( nodename ) {\r\n\t\t\t\tcase \"script\" :\r\n\t\t\t\tcase \"style\" :\r\n\t\t\t\tcase \"textarea\" :\r\n\t\t\t\t\tresult = NodeCrawler.SKIP_NODE + NodeCrawler.SKIP_CHILDREN;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n\t\r\n\t/*\r\n\t * While crawling, simply collect the suspect textnodes in a list \r\n\t * in order to avoud document updates that might confuse the crawler. \r\n\t * The textnodes are finally modified by method onCrawlStop below. \r\n\t */\r\n\tvar self = this;\r\n\tthis.addFilter ( function ( node, arg ) {\r\n\t\tif ( node.nodeType == Node.TEXT_NODE ) {\r\n\t\t\tvar text = node.nodeValue.toLowerCase ();\r\n\t\t\tself._map.each ( function ( key, exp ) {\r\n\t\t\t\tvar result = true;\r\n\t\t\t\tif ( exp.test ( text )) {\r\n\t\t\t\t\tself._textnodes.add ( node );\r\n\t\t\t\t\tresult = false;\r\n\t\t\t\t}\r\n\t\t\t\treturn result;\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n};\r\n\r\n/**\r\n * Start crawling.\r\n * @overloads {NodeCrawler#crawl}\r\n * @param {DOMElement} element\r\n * @param {object} arg\r\n */\r\nWindowBindingHighlightNodeCrawler.prototype.crawl = function ( element, arg ) {\r\n\t\r\n\tthis._textnodes = new List ();\r\n\tWindowBindingHighlightNodeCrawler.superclass.crawl.call ( this, element, arg );\r\n}\r\n\r\n/**\r\n * Set keywords.\r\n * @param {List<string>} list\r\n * @@see {SEODOMParser#setKeys}\r\n */\r\nWindowBindingHighlightNodeCrawler.prototype.setKeys = function ( list ) {\r\n\t\r\n\tlist.reset ();\r\n\tthis._map.empty ();\r\n\t\r\n\twhile ( list.hasNext ()) {\r\n\t\tvar key = list.getNext ();\r\n\t\tvar phrase = key.toLowerCase ().replace ( / /g, \"\\\\W\" );\r\n\t\tvar exp = new RegExp ( \"(\" + phrase + \")\" );\r\n\t\tthis._map.set ( key, exp );\r\n\t}\r\n};\r\n\r\n/**\r\n * @overwrites {NodeCrawler#onCrawlStop}\r\n */\r\nWindowBindingHighlightNodeCrawler.prototype.onCrawlStop = function () {\r\n\t\r\n\tvar self = this;\r\n\tif ( this._textnodes.hasEntries ()) {\r\n\t\tthis._textnodes.each ( function ( node ) {\r\n\t\t\t\r\n\t\t\tvar div = self.contextDocument.createElement ( \"div\" );\r\n\t\t\tvar frag = self.contextDocument.createDocumentFragment ();\r\n\t\t\t\r\n\t\t\tdiv.innerHTML = self._getMarkup ( node.nodeValue );\r\n\t\t\twhile ( div.hasChildNodes ()) {\r\n\t\t\t\tfrag.appendChild ( div.firstChild );\r\n\t\t\t}\r\n\t\t\tnode.parentNode.replaceChild ( frag, node );\r\n\t\t});\r\n\t}\r\n};\r\n\r\n/**\r\n * Get that markup!\r\n * @param {string} original\r\n * @return {string}\r\n */\r\nWindowBindingHighlightNodeCrawler.prototype._getMarkup = function ( original ) {\r\n\t\t\r\n\tvar markup = \"\";\r\n\tvar TAGSTART = \"<span class=\\\"\" + WindowBindingHighlightNodeCrawler.CLASSNAME_HIGHLIGHT + \"\\\" style=\\\"background-color:yellow;color:black;\\\">\";\r\n\tvar TAGSTOP = \"</span>\";\r\n\t\r\n\t/*\r\n\t * This recursive setup ensures that each multiple \r\n\t * keywords occurances is highlighted properly.\r\n\t */\r\n\tvar self = this;\r\n\tfunction iterate ( current ) {\r\n\t\t\r\n\t\tvar minindex = -1;\r\n\t\tvar minkey = null;\r\n\t\t\r\n\t\t/*\r\n\t\t * Isolate the regexp match with the lowest position index. \r\n\t\t */\r\n\t\tself._map.each ( function ( key, exp ) {\r\n\t\t\t\r\n\t\t\tvar low = current.toLowerCase ();\r\n\t\t\tvar index = low.search ( exp );\r\n\t\t\t\r\n\t\t\tif ( index >-1 ) {\r\n\t\t\t\tif ( minindex == -1 ) {\r\n\t\t\t\t\tminindex = index;\r\n\t\t\t\t}\r\n\t\t\t\tif ( index <= minindex ) {\r\n\t\t\t\t\tminindex = index;\r\n\t\t\t\t\tminkey = key;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\t/*\r\n\t\t * Markup the match, cut from string and iterate the rest.\r\n\t\t */\r\n\t\tif ( minindex > -1 && minkey != null ) {\r\n\t\t\t\r\n\t\t\tvar pre = current.substring ( 0, minindex );\r\n\t\t\tvar hit = current.substring ( minindex, minindex + minkey.length );\r\n\t\t\tvar pst = current.substring ( minindex + minkey.length, current.length );\r\n\t\t\t\r\n\t\t\tmarkup += pre + TAGSTART + hit + TAGSTOP;\t\t\t\t\t\r\n\t\t\titerate ( pst );\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t\r\n\t\t\tmarkup += current;\r\n\t\t}\r\n\t}\r\n\t\r\n\titerate ( original );\r\n\treturn markup;\r\n}\r\n\r\n/*\r\n * Remove traces of earlier highlight.\r\n * @param {HTMLElement} element\r\n */\r\nWindowBindingHighlightNodeCrawler.prototype.reset = function ( element ) {\r\n\t\r\n\tvar spans = new List ( element.getElementsByTagName ( \"span\" ));\r\n\tspans.each ( function ( span ) {\r\n\t\tif ( span.className == WindowBindingHighlightNodeCrawler.CLASSNAME_HIGHLIGHT ) {\r\n\t\t\tvar node = element.ownerDocument.createTextNode ( DOMUtil.getTextContent ( span ));\r\n\t\t\tspan.parentNode.replaceChild ( node, span );\r\n\t\t}\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/Action.js",
    "content": "/**\r\n * To avoid spelling mistakes, always use predefined constants  \r\n * (eg. TreeNodeBinding.ONFOCUS) when specifying the actions\r\n * \"type\" parameter. This method doublechecks that the predefined \r\n * constant is actually predefined.\r\n * @param {string} type\r\n */\r\nAction.isValid = function ( type ) {\r\n\r\n\treturn typeof type != Types.UNDEFINED;\r\n}\r\n\r\n/**\r\n * @class\r\n * @param {Binding} target\r\n * @param {string} type\r\n */\r\nfunction Action ( target, type ) {\r\n\t\r\n\t/** \r\n\t * @type {Binding} \r\n\t */\r\n\tthis.target\t= target;\r\n\t\r\n\t/** \r\n\t * @type {string} \r\n\t */\r\n\tthis.type = type;\r\n\t\r\n\t/** \r\n\t * @type {Binding} \r\n\t */\r\n\tthis.listener = null;\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isConsumed = false;\r\n\t\r\n\t/** \r\n\t * @type {boolean} \r\n\t */\r\n\tthis.isCancelled = false;\r\n}\r\n\r\n/**\r\n * A Binding can call this method to prevent ancestor \r\n * Bindings from dealing with the Action.\r\n */\r\nAction.prototype.consume = function () {\r\n\r\n\tthis.isConsumed = true;\r\n}\r\n\r\n/**\r\n * A Binding can call this method to cancel the action associated to \r\n * an event dispatch. But only if the dispatcher handles this scenario! \r\n * Actually it's just a flag, you decide what for. \r\n */\r\nAction.prototype.cancel = function () {\r\n\r\n\tthis.isCancelled = true;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/Animation.js",
    "content": "/**\r\n * This fellow should exceed the most popular \r\n * CSS transitions time used around stylesheets. \r\n * In fact it has nothing to do with stuff below.\r\n * @type {int}\r\n */\r\nAnimation.DEFAULT_TIME = parseInt ( 250 );\r\n\r\n/**\r\n * Presents a simple animation interface. When instantiated, user can modify properties interval, \r\n * iterator, modifier and endcount to control the animation. User should alsoe override methods \r\n * onstart, onstep and onstop before calling the <code>play</code> method. In the example below, \r\n * we define animation properties in an optional constructor object. Note that only \r\n * some properties are explicitely defined while others are left to default values.\r\n * <pre>\r\n *     var animation = new Animation ({\r\n *         modifier : 5,\r\n *         onstart : function () {\r\n *             foo.x = 0;\r\n *         },\r\n *         onstep : function ( i ) {\r\n *             foo.x += 10;\r\n *         }\r\n *     }).play ();\r\n * </pre>\r\n *\r\n * @param @optional {object} initializer Quickly configures animation properties.\r\n * @constructor\r\n */\r\nfunction Animation ( initializer ) {\r\n\r\n\t/** \r\n\t * uniquely identify this animation. \r\n\t * @ignore\r\n\t */\r\n\tthis.id = KeyMaster.getUniqueKey ();\r\n\t\r\n\t/** \r\n\t * Iteration interval in milliseconds \r\n\t * @type {int} \r\n\t */\r\n\tthis.interval = 25;\r\n\t\r\n\t/** \r\n\t * Iterator starting value \r\n\t * @type {number} \r\n\t */\r\n\tthis.iterator =  0;\r\n\t\r\n\t/** \r\n\t * Iterator increment value\r\n\t * @type {number} \r\n\t */\r\n\tthis.modifier =  1;\r\n\t\r\n\t/** \r\n\t * Iterator end value (animation will stop here) \r\n\t * @type {number}\r\n\t */\r\n\tthis.endcount = 90;\r\n\t\r\n\t// if an animation initializer was specified,\r\n\t// apply initializer properties.\r\n\tfor ( var property in initializer ) {\r\n\t\tthis [ property ] = initializer [ property ];\r\n\t}\r\n}\r\n\r\n/**\r\n * Starts the animation.\r\n */\r\nAnimation.prototype.play = function () {\r\n\r\n\t// start playing\r\n\tif ( !this.isPlaying ) {\r\n\t\tvar self = this;\r\n\t\tthis._nextframe = function () {\r\n\t\t\twindow [ this.id ] = setTimeout ( \r\n\t\t\t\tfunction () {\r\n\t\t\t\t\tself.play ();\r\n\t\t\t\t}\r\n\t\t\t, this.interval );\r\n\t\t}\r\n\t\tthis.onstart ( this.iterator );\r\n\t\tthis._nextframe ();\r\n\t\tthis.isPlaying = true;\r\n\t}\r\n\t\r\n\t// stop playing\r\n\telse if ( this.modifier > 0 ? this.iterator >= this.endcount : this.iterator <= this.endcount ) {\r\n\t\tthis.stop ();\r\n\t}\r\n\t\r\n\t// play it again\r\n\telse {\r\n\t\tvar it1 = this.iterator;\r\n\t\tvar it2 = this.onstep ( this.iterator );\r\n\t\tif ( it2 && it2 != it1 ) {\r\n\t\t\tthis.iterator = it2;\r\n\t\t} else {\r\n\t\t\tthis.iterator += this.modifier;\r\n\t\t}\r\n\t\tthis._nextframe ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Stops the animation (not to be confused with \"onstop\").\r\n * TODO: perhaps we should clear the timeout around here?\r\n */\r\nAnimation.prototype.stop = function () {\r\n\t\r\n\tthis.onstop ( this.iterator );\r\n\tthis.isPlaying = false;\r\n}\r\n\r\n/**\r\n * (User should overwrite this method) Action to take when starting animation.\r\n * @param {number} iterator\r\n * @return {number} nextIterator\r\n */\r\nAnimation.prototype.onstart = function ( iterator ) {};\r\n\r\n/**\r\n * (User should overwrite this method) Action to take on each animation sequence. \r\n * The iterator value is provided as method argument. Optionally, user can overwrite \r\n * the animation iterator by making these methods return a number; if a return value \r\n * is specified, this value will be used as argument for next iteration.\r\n * @param {number} iterator\r\n * @return {number} nextIterator\r\n */\r\nAnimation.prototype.onstep = function ( iterator ) {};\r\n\r\n/** \r\n * (User should overwrite this method) Action to take when stopping animation\r\n * @param {number} iterator\r\n * @return {number} nextIterator\r\n */\r\nAnimation.prototype.onstop = function ( iterator ) {};"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/BindingAcceptor.BACKUP.js",
    "content": "/**\r\n * @type {Binding}\r\n */\r\nBindingAcceptor.acceptingBinding = null;\r\n\r\n/**\r\n * THIS NEEDS REVISION!\r\n * @param {Binding} binding\r\n */\r\nfunction BindingAcceptor ( binding ) {\r\n\r\n\t/** \r\n\t * @type {SystemLogger} \r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BindingDragger\" );\r\n\r\n\t/** \r\n\t * @type {Binding} \r\n\t */\r\n\tthis._binding = binding;\t\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><boolean>}\r\n\t */\r\n\tthis._acceptedList = {};\r\n\t\r\n\t/* \r\n\t * Initialize.\r\n\t */\r\n\tthis._initialize ();\r\n}\r\n\r\n/**\r\n * Initialize.\r\n */\r\nBindingAcceptor.prototype._initialize = function () {\r\n\t\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.TYPEDRAG_START, this );\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.TYPEDRAG_STOP, this );\r\n\t\t\r\n\tif ( this._binding.dragAccept ) {\r\n\t\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.TYPEDRAG_PAUSE, this );\r\n\t\r\n\t\tvar types = new List ( \r\n\t\t\tthis._binding.dragAccept.split ( \" \" )\r\n\t\t);\r\n\t\twhile ( types.hasNext ()) {\r\n\t\t\tvar type = types.getNext ();\r\n\t\t\tthis._acceptedList [ type ] = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nBindingAcceptor.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tvar type = arg;\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\r\n\t\tcase BroadcastMessages.TYPEDRAG_START :\r\n\t\t\tif ( this.isAccepting ( type )) {\r\n\t\t\t\tthis._startAccepting ();\r\n\t\t\t} else {\r\n\t\t\t\tthis._startRejecting ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.TYPEDRAG_STOP :\r\n\t\t\tif ( this.isAccepting ( type )) {\r\n\t\t\t\tthis._stopAccepting ();\r\n\t\t\t} else {\r\n\t\t\t\tthis._stopRejecting ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.TYPEDRAG_PAUSE :\t\r\n\t\t\tif ( this.isAccepting ( type )) {\r\n\t\t\t\tthis._pauseAccepting ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Is accepting type?\r\n * @param {string} type\r\n * @return {boolean}\r\n */\r\nBindingAcceptor.prototype.isAccepting = function ( type ) {\r\n\t\r\n\treturn Types.isDefined ( this._acceptedList [ type ]);\r\n}\r\n\r\n/**\r\n * Start accepting binding.\r\n */\r\nBindingAcceptor.prototype._startAccepting = function () {\r\n\t\r\n\tthis._binding.addEventListener ( DOMEvents.MOUSEOVER, this );\r\n\tthis._binding.addEventListener ( DOMEvents.MOUSEOUT, this );\r\n\t\t\r\n\tif ( Types.isFunction ( this._binding.showGeneralAcceptance )) {\r\n\t\tthis._binding.showGeneralAcceptance ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Implements DOM2 EventListener.\r\n * @param {MouseEvent} e \r\n */\r\nBindingAcceptor.prototype.handleEvent = function ( e ) {\r\n\r\n\tswitch ( e.type ) {\r\n\t\r\n\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\tif ( BindingAcceptor.acceptingBinding != this._binding ) {\r\n\t\t\t\tBindingAcceptor.acceptingBinding = this._binding;\r\n\t\t\t\tapp.bindingMap.dragdropcursor.showAcceptance ();\r\n\t\t\t\tif ( Types.isFunction ( this._binding.showAcceptance )) {\r\n\t\t\t\t\tthis._binding.showAcceptance ();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\tvar elm = e.relatedTarget ? e.relatedTarget : e.toElement;\r\n\t\t\twhile ( elm ) {\r\n\t\t\t\tif ( elm == this._binding.bindingElement ) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\telm = elm.parentNode;\r\n\t\t\t}\r\n\t\t\tBindingAcceptor.acceptingBinding = null;\r\n\t\t\tapp.bindingMap.dragdropcursor.hideAcceptance ();\r\n\t\t\tif ( Types.isFunction ( this._binding.hideAcceptance )) {\r\n\t\t\t\tthis._binding.hideAcceptance ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tDOMEvents.stopPropagation ( e );\r\n}\r\n\r\n/**\r\n * Pause accepting binding.\r\n */\r\nBindingAcceptor.prototype._pauseAccepting = function () { \r\n\t\r\n\t/*\r\n\tif ( this._binding.hideGeneralAcceptance ) {\r\n \t\tthis._binding.hideGeneralAcceptance ();\r\n \t}\r\n \t*/\r\n \tif ( this._binding.hideAcceptance ) {\r\n\t\tthis._binding.hideAcceptance ();\r\n\t}\r\n\t\r\n\tapp.bindingMap.dragdropcursor.hideAcceptance ();\r\n\tBindingAcceptor.acceptingBinding = null;\r\n}\r\n \r\n/**\r\n * Stop accepting binding.\r\n */\r\nBindingAcceptor.prototype._stopAccepting = function () { \r\n\r\n\tthis._binding.removeEventListener ( DOMEvents.MOUSEOVER, this );\r\n\tthis._binding.removeEventListener ( DOMEvents.MOUSEOUT, this );\r\n\t\r\n\tif ( this._binding.hideGeneralAcceptance ) {\r\n \t\tthis._binding.hideGeneralAcceptance ();\r\n \t}\r\n \tif ( this._binding.hideAcceptance ) {\r\n\t\tthis._binding.hideAcceptance ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Start rejecting binding.\r\n * TODO: move to DOMEvents.\r\n */\r\nBindingAcceptor.prototype._startRejecting = function () {\r\n\t\r\n\t/*\r\n\t\r\n\tvar self = this;\r\n\t\r\n\tthis._binding.bindingElement.onmouseover = function ( e )  {\r\n\t\tEventBroadcaster.broadcast ( BroadcastMessages.TYPEDRAG_PAUSE );\r\n\t\te = e ? e : self._binding.bindingWindow.event;\r\n\t\tDOMEvents.stopPropagation ( e );\r\n\t}\r\n\t\r\n\tthis._binding.bindingElement.onmouseout = function ( e )  {\r\n\t\te = e ? e : self._binding.bindingWindow.event;\r\n\t\tDOMEvents.stopPropagation ( e );\r\n\t}\r\n\t*/\r\n\t\r\n}\r\n\r\n/**\r\n * Stop rejecting binding.\r\n * TODO: move to DOMEvents.\r\n */\r\nBindingAcceptor.prototype._stopRejecting = function () {\r\n\t\r\n\tthis._binding.bindingElement.onmouseover = null;\r\n\tthis._binding.bindingElement.onmouseout = null;\r\n}\r\n\t \r\n\r\n/**\r\n * Dispose (on binding dispose).\r\n */\r\nBindingAcceptor.prototype.dispose = function () {\r\n\t\r\n\tEventBroadcaster.unsubscribe ( BroadcastMessages.TYPEDRAG_START, this );\r\n\tEventBroadcaster.unsubscribe ( BroadcastMessages.TYPEDRAG_STOP, this );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/BindingAcceptor.js",
    "content": "/**\r\n * @type {Binding}\r\n */\r\nBindingAcceptor.acceptingBinding = null;\r\n\r\n/** \r\n * @param {Binding} binding\r\n */\r\nfunction BindingAcceptor ( binding ) {\r\n\r\n\t/** \r\n\t * @type {SystemLogger} \r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BindingDragger\" );\r\n\r\n\t/** \r\n\t * @type {Binding} \r\n\t */\r\n\tthis._binding = binding;\t\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><boolean>}\r\n\t */\r\n\tthis._acceptedList = {};\r\n\t\r\n\t/**\r\n\t * @type {boolean}\r\n\t */\r\n\tthis._isAccepting = false;\r\n\t\r\n\t/**\r\n\t * @type {CursorBinding}\r\n\t */\r\n\tthis._corsor = null;\r\n\t\r\n\t/* \r\n\t * Initialize.\r\n\t */\r\n\tthis._initialize ();\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Initialize.\r\n */\r\nBindingAcceptor.prototype._initialize = function () {\r\n\t\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.TYPEDRAG_START, this );\r\n\tEventBroadcaster.subscribe ( BroadcastMessages.TYPEDRAG_STOP, this );\r\n\t\r\n\tif ( this._binding.dragAccept ) {\r\n\t\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.TYPEDRAG_PAUSE, this );\r\n\t\r\n\t\tvar types = new List ( \r\n\t\t\tthis._binding.dragAccept.split ( \" \" )\r\n\t\t);\r\n\t\twhile ( types.hasNext ()) {\r\n\t\t\tvar type = types.getNext ();\r\n\t\t\tthis._acceptedList [ type ] = true;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} arg\r\n */\r\nBindingAcceptor.prototype.handleBroadcast = function ( broadcast, arg ) {\r\n\t\r\n\tvar type = arg;\r\n\t\r\n\ttry {\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\r\n\t\tcase BroadcastMessages.TYPEDRAG_START :\r\n\t\t\tif ( this._cursor == null ) {\r\n\t\t\t\tthis._cursor = app.bindingMap.dragdropcursor;\r\n\t\t\t}\r\n\t\t\tthis._binding.addEventListener ( DOMEvents.MOUSEENTER, this );\r\n\t\t\tthis._binding.addEventListener ( DOMEvents.MOUSELEAVE, this );\r\n\t\t\tif ( this.isAccepting ( type )) {\r\n\t\t\t\tthis._isAccepting = true;\r\n\t\t\t\tthis._startAccepting ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.TYPEDRAG_STOP :\r\n\t\t\tthis._binding.removeEventListener ( DOMEvents.MOUSEENTER, this );\r\n\t\t\tthis._binding.removeEventListener ( DOMEvents.MOUSELEAVE, this );\r\n\t\t\tif ( this.isAccepting ( type )) {\r\n\t\t\t\tthis._isAccepting = false;\r\n\t\t\t\tthis._stopAccepting ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase BroadcastMessages.TYPEDRAG_PAUSE :\t\r\n\t\t\tif ( this.isAccepting ( type )) {\r\n\t\t\t\tthis._pauseAccepting ();\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\t} catch ( exception ) {\r\n\t\tthis.logger.debug ( exception );\r\n\t}\r\n}\r\n\r\n/**\r\n * Is accepting type?\r\n * @param {string} type\r\n * @return {boolean}\r\n */\r\nBindingAcceptor.prototype.isAccepting = function ( type ) {\r\n\t\r\n\treturn Types.isDefined ( this._acceptedList [ type ]);\r\n}\r\n\r\n/**\r\n * Start accepting binding.\r\n */\r\nBindingAcceptor.prototype._startAccepting = function () {\r\n\t\r\n\tif ( Types.isFunction ( this._binding.showGeneralAcceptance )) {\r\n\t\tthis._binding.showGeneralAcceptance ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Pause accepting binding.\r\n */\r\nBindingAcceptor.prototype._pauseAccepting = function () { \r\n\t\r\n\t/*\r\n\tif ( this._binding.hideGeneralAcceptance ) {\r\n \t\tthis._binding.hideGeneralAcceptance ();\r\n \t}\r\n \t*/\r\n \tif ( this._binding.hideAcceptance ) {\r\n\t\tthis._binding.hideAcceptance ();\r\n\t}\r\n\t\r\n\tthis._cursor.hideAcceptance ();\r\n\tBindingAcceptor.acceptingBinding = null;\r\n}\r\n \r\n/**\r\n * Stop accepting binding.\r\n */\r\nBindingAcceptor.prototype._stopAccepting = function () { \r\n\t\r\n\tif ( this._binding.hideGeneralAcceptance ) {\r\n \t\tthis._binding.hideGeneralAcceptance ();\r\n \t}\r\n \tif ( this._binding.hideAcceptance ) {\r\n\t\tthis._binding.hideAcceptance ();\r\n\t}\r\n}\r\n\r\n/**\r\n * Implements DOM2 EventListener.\r\n * @param {MouseEvent} e \r\n */\r\nBindingAcceptor.prototype.handleEvent = function ( e ) {\r\n\r\n\tswitch ( e.type ) {\r\n\t\r\n\t\tcase DOMEvents.MOUSEENTER :\r\n\t\tcase DOMEvents.MOUSEOVER :\r\n\t\t\tif ( this._isAccepting ) {\r\n\t\t\t\tif ( BindingAcceptor.acceptingBinding != this._binding ) {\r\n\t\t\t\t\tBindingAcceptor.acceptingBinding = this._binding;\r\n\t\t\t\t\tthis._cursor.showAcceptance ();\r\n\t\t\t\t\tif ( Types.isFunction ( this._binding.showAcceptance )) {\r\n\t\t\t\t\t\tthis._binding.showAcceptance ();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tEventBroadcaster.broadcast ( BroadcastMessages.TYPEDRAG_PAUSE );\r\n\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase DOMEvents.MOUSELEAVE :\r\n\t\tcase DOMEvents.MOUSEOUT :\r\n\t\t\tif ( this._isAccepting ) {\r\n\t\t\t\tBindingAcceptor.acceptingBinding = null;\r\n\t\t\t\tthis._cursor.hideAcceptance ();\r\n\t\t\t\tif ( Types.isFunction ( this._binding.hideAcceptance )) {\r\n\t\t\t\t\tthis._binding.hideAcceptance ();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tDOMEvents.stopPropagation ( e );\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\t\r\n\tDOMEvents.stopPropagation ( e );\r\n}\r\n\r\n/**\r\n * Dispose (on binding dispose).\r\n */\r\nBindingAcceptor.prototype.dispose = function () {\r\n\t\r\n\tEventBroadcaster.unsubscribe ( BroadcastMessages.TYPEDRAG_START, this );\r\n\tEventBroadcaster.unsubscribe ( BroadcastMessages.TYPEDRAG_STOP, this );\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/BindingBoxObject.js",
    "content": "/**\r\n * @class\r\n * Presents a simpliefied API for dealing with a bindings size and position on stage.\r\n * @param {Binding} binding \r\n */\r\nfunction BindingBoxObject ( binding ) {\r\n\t\r\n\t/**\r\n\t * @type {DOMElement} \r\n\t */\r\n\tthis._domElement = binding.getBindingElement ();\r\n}\r\n\r\n/**\r\n * Get relative to top window.\r\n * @return {Point} \r\n */\r\nBindingBoxObject.prototype.getUniversalPosition = function () {\r\n\r\n\treturn DOMUtil.getUniversalPosition ( this._domElement );\r\n}\r\n\r\n/**\r\n * Get position relative to containing window.\r\n * @return {Point} \r\n */\r\nBindingBoxObject.prototype.getGlobalPosition = function () {\r\n\r\n\treturn DOMUtil.getGlobalPosition ( this._domElement );\r\n}\r\n\r\n/**\r\n * Get position relative to nearest positioned ancestor.\r\n * @return {Point} \r\n */\r\nBindingBoxObject.prototype.getLocalPosition = function () {\r\n\r\n\treturn DOMUtil.getLocalPosition ( this._domElement );\r\n}\r\n\r\n/**\r\n * @return {Dimension} \r\n */\r\nBindingBoxObject.prototype.getDimension = function () {\r\n\r\n\t/*\r\n\treturn new Dimension (\r\n\t\t this._domElement.offsetWidth,\r\n\t\t this._domElement.offsetHeight\r\n\t);\r\n\t*/\r\n\t\r\n\tvar rect = this._domElement.getBoundingClientRect ();\r\n\treturn new Dimension (\r\n\t\t rect.right - rect.left,\r\n\t\t rect.bottom - rect.top\r\n\t);\r\n}\r\n\r\n/**\r\n * Dispose.\r\n */\r\nBindingBoxObject.prototype.dispose = function () {\r\n\t\r\n\tthis._domElement = null;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/BindingDragger.js",
    "content": "/**\r\n * True while dragging. Certain GUI components should \r\n * modify their behavior dependant on this property.\r\n * @type {boolean}\r\n */\r\nBindingDragger.isDragging = false;\r\n\r\n/**\r\n * @type {Binding}\r\n */\r\nBindingDragger.draggedBinding = null;\r\n\r\n/**\r\n * @type {BindingDragger}\r\n */\r\nBindingDragger.bindingDragger = null;\r\n\r\n/**\r\n * @class\r\n * The main point with this class is to not register a \r\n * default method \"handleEvent\" to all Binding instances.\r\n * @param {Binding} binding\r\n */\r\nfunction BindingDragger ( binding ) {\r\n\r\n\t/** @type {SystemLogger} */\r\n\tthis.logger = SystemLogger.getLogger ( \"BindingDragger\" );\r\n\r\n\t/** @type {Binding} */\r\n\tthis.binding = binding;\r\n\t\r\n\t/** @type {boolean} */\r\n\tthis.isDragReady = false;\r\n\t\r\n\t/** @type {boolean} */\r\n\tthis.isDragging = false;\r\n\t\r\n\t/** @type {Point} */\r\n\tthis.startPoint = null;\r\n\t\r\n\t/** @type {MouseEvent} */\r\n\tthis.currentEvent = null\r\n}\r\n\r\n/**\r\n* Implements DOM2 EventListener.\r\n* @param {MouseEvent} e\r\n*/\r\nBindingDragger.prototype.handleEvent = function ( e ) {\r\n\t\r\n\tif ( e.type == DOMEvents.MOUSEUP ) {\r\n\t\tthis.isDragReady = false;\r\n\t}\r\n\telse if ( !BindingDragger.isDragging ) {\r\n\t\tswitch ( e.type ) {\r\n\t\t\tcase DOMEvents.MOUSEDOWN :\r\n\t\t\t\tif ( !DOMEvents.isRightButton ( e )) {\r\n\t\t\t\t\tthis.isDragReady = true;\r\n\t\t\t\t\tDOMEvents.preventDefault ( e ); // kills FF3 image dragging\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase DOMEvents.MOUSEMOVE :\r\n\t\t\t\tif ( this.isDragReady == true ) {\r\n\t\t\t\t\tthis.binding.dispatchAction ( \r\n\t\t\t\t\t\tBinding.ACTION_DRAG \r\n\t\t\t\t\t);\r\n\t\t\t\t\tif ( this.handler ) {\r\n\t\t\t\t\t\tthis.onDragStart ( e );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.isDragReady = false;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nBindingDragger.prototype.registerHandler = function ( handler ) {\r\n\t\r\n\tif ( Interfaces.isImplemented ( IDragHandler, handler ) == true ) {\r\n\t\tthis.handler = handler;\r\n\t} else {\r\n\t\tthrow new Error ( \r\n\t\t\t\"BindingDragger: Interface IDraghandler not implemented.\" \r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {MouseEvent} e\r\n */\r\nBindingDragger.prototype.onDragStart = function ( e ) {\r\n\t\r\n\tif ( !this.isDragging ) {\r\n\t\t\r\n\t\tApplication.enableMousePositionTracking ( e );\r\n\t\tthis.startPoint = Application.getMousePosition ();\r\n\t\tthis.isDragging = true;\r\n\t\tBindingDragger.isDragging = true;\r\n\t\tBindingDragger.draggedBinding = this.binding;\r\n\t\tthis.handler.onDragStart ( this.startPoint );\r\n\t\t\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.MOUSEEVENT_MOUSEMOVE, this );\r\n\t\tEventBroadcaster.subscribe ( BroadcastMessages.MOUSEEVENT_MOUSEUP, this );\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {MouseEvent} e\r\n */\r\nBindingDragger.prototype.onDrag = function ( e ) {\r\n\r\n\tif ( this.isDragging == true ) {\r\n\t\tvar isLeftButtonPressed = e.button == ( e.target ? 0 : 1 );\r\n\t\tif ( isLeftButtonPressed ) {\r\n\t\t\tthis.handler.onDrag ( this.getDiff ());\r\n\t\t} else {\r\n\t\t\tthis.onDragStop ( e );\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {MouseEvent} e\r\n */\r\nBindingDragger.prototype.onDragStop = function ( e ) {\r\n\r\n\tif ( this.isDragging == true ) {\r\n\t\t\r\n\t\tApplication.disableMousePositionTracking ();\r\n\t\tthis.handler.onDragStop ( this.getDiff ());\r\n\t\tthis.isDragging = false;\r\n\t\tBindingDragger.isDragging = false;\r\n\t\tBindingDragger.draggedBinding = null;\r\n\t\t\r\n\t\tEventBroadcaster.unsubscribe ( BroadcastMessages.MOUSEEVENT_MOUSEMOVE, this );\r\n\t\tEventBroadcaster.unsubscribe ( BroadcastMessages.MOUSEEVENT_MOUSEUP, this );\r\n\t}\r\n}\r\n\r\n/**\r\n * @param {MouseEvent} e\r\n * @return {Point}\r\n */\r\nBindingDragger.prototype.getDiff = function () {\r\n\r\n\tvar point = Application.getMousePosition ();\r\n\tvar dx = point.x - this.startPoint.x;\r\n\tvar dy = point.y - this.startPoint.y;\r\n\treturn new Point ( dx, dy );\r\n}\r\n\r\n/**\r\n * @implements {IBroadcastListener}\r\n * @param {string} broadcast\r\n * @param {object} e In this case, an instance of DOM MouseEvent\r\n */\r\nBindingDragger.prototype.handleBroadcast = function ( broadcast, e ) {\r\n\t\r\n\tswitch ( broadcast ) {\r\n\t\tcase BroadcastMessages.MOUSEEVENT_MOUSEMOVE :\r\n\t\t\tthis.onDrag ( e );\r\n\t\t\tbreak;\r\n\t\tcase BroadcastMessages.MOUSEEVENT_MOUSEUP :\r\n\t\t\tthis.onDragStop ( e );\r\n\t\t\tbreak;\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispose.\r\n */\r\nBindingDragger.prototype.dispose = function () {\r\n\t\r\n\tthis.binding = null;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/BindingFinder.js",
    "content": "/**\r\n * @class\r\n * Locating bindings.\r\n */\r\nfunction _BindingFinder () {}\r\n\r\n_BindingFinder.prototype = {\r\n\r\n\t/**\r\n\t * Get descendant bindings by nodename.\r\n\t * @param {Binding} source\r\n\t * @param {string} nodeName\r\n \t * @param {boolean} isChildrenOnly If set to true, return only children (not all descendants).\r\n \t * @return {List<Binding>}\r\n\t */\r\n\tgetDescendantBindingsByLocalName : function ( source, nodeName, isChildrenOnly ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( source.isAttached ) {\r\n\t\t\tresult = new List ();\r\n\t\t\tvar elements = isChildrenOnly ?\r\n\t\t\t\t source.getChildElementsByLocalName ( nodeName ) :\r\n\t\t\t\t source.getDescendantElementsByLocalName ( nodeName );\r\n\t\t\telements.each ( function ( element ) {\r\n\t\t\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\t\t\tif ( binding ) {\r\n\t\t\t\t\tresult.add ( binding );\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tvar ouch = \"Could not resolve descendants of unattached binding \" + source.toString ();\r\n\t\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\t\tthrow ouch;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get ancestor binding by type.\r\n\t * @param {Binding} source\r\n\t * @param {Class} impl\r\n\t * @param {boolean} isTraverse If set to true, cross iframe boundaries.\r\n \t * @return {Binding}\r\n\t */\r\n\tgetAncestorBindingByType : function ( source, impl, isTraverse ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( Binding.exists ( source )) {\r\n\t\t\tvar node = source.bindingElement;\r\n\t\t\twhile ( result == null && node != null ) {\r\n\t\t\t\tnode = node.parentNode;\r\n\t\t\t\tif ( node != null ) {\r\n\t\t\t\t\tif ( UserInterface.hasBinding ( node )) {\r\n\t\t\t\t\t\tvar binding = UserInterface.getBinding ( node );\r\n\t\t\t\t\t\tif ( binding instanceof impl ) {\r\n\t\t\t\t\t\t\tresult = binding;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if ( isTraverse && node.nodeType == Node.DOCUMENT_NODE ) {\r\n\t\t\t\t\t\tvar win = DOMUtil.getParentWindow ( node );\r\n\t\t\t\t\t\tif ( win != null ) {\r\n\t\t\t\t\t\t\tnode = win.frameElement;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tSystemDebug.stack ( arguments );\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get ancestor binding by Interface.\r\n\t * @param {Binding} source\r\n\t * @param {interface} intf\r\n\t * @param {boolean} isTraverse If set to true, cross iframe boundaries.\r\n \t * @return {Binding}\r\n\t */\r\n\tgetAncestorBindingByInterface: function (source, intf, isTraverse) {\r\n\r\n\t\tvar result = null;\r\n\t\tif (Binding.exists(source)) {\r\n\t\t\tvar node = source.bindingElement;\r\n\t\t\twhile (result == null && node != null) {\r\n\t\t\t\tnode = node.parentNode;\r\n\t\t\t\tif (node != null) {\r\n\t\t\t\t\tif (UserInterface.hasBinding(node)) {\r\n\t\t\t\t\t\tvar binding = UserInterface.getBinding(node);\r\n\t\t\t\t\t\tif ( Interfaces.isImplemented(intf, binding)) {\r\n\t\t\t\t\t\t\tresult = binding;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (isTraverse && node.nodeType == Node.DOCUMENT_NODE) {\r\n\t\t\t\t\t\tvar win = DOMUtil.getParentWindow(node);\r\n\t\t\t\t\t\tif (win != null) {\r\n\t\t\t\t\t\t\tnode = win.frameElement;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get ancestor binding by nodename.\r\n\t * @param {Binding} source\r\n\t * @param {string} nodename\r\n\t * @param {boolean} isTraverse If set to true, cross iframe boundaries.\r\n\t * @return {Binding}\r\n\t */\r\n\tgetAncestorBindingByLocalName : function ( source, nodeName, isTraverse ) {\r\n\r\n\t\tvar result = null;\r\n\t\tif ( nodeName == \"*\" ) {\r\n\t\t\tvar node = source.bindingElement;\r\n\t\t\twhile ( !result && ( node = node.parentNode ) != null ) {\r\n\t\t\t\tif ( UserInterface.hasBinding ( node )) {\r\n\t\t\t\t\tresult = UserInterface.getBinding ( node );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tresult = UserInterface.getBinding (\r\n\t\t\t\tDOMUtil.getAncestorByLocalName ( nodeName, source.bindingElement, isTraverse )\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get child elements by nodename.\r\n\t * @param {Binding} source\r\n\t * @param {string} nodeName\r\n\t * @return {List<DOMElement>}\r\n\t */\r\n\tgetChildElementsByLocalName : function ( source, nodeName ) {\r\n\r\n\t\tvar result = new List ();\r\n\t\tvar children = new List ( source.bindingElement.childNodes );\r\n\t\tchildren.each ( function ( child ) {\r\n\t\t\tif ( child.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\t\tif ( nodeName == \"*\" || DOMUtil.getLocalName ( child ) == nodeName ) {\r\n\t\t\t\t\tresult.add ( child );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get the FIRST child binding of a specified type.\r\n\t * @param {Binding} source\r\n\t * @param {Class} impl\r\n\t * @return {Binding}\r\n\t */\r\n\tgetChildBindingByType : function ( source, impl ) {\r\n\r\n\t\tvar result = null;\r\n\t\tsource.getChildElementsByLocalName ( \"*\" ).each (\r\n\t\t\tfunction ( child ) {\r\n\t\t\t\tvar binding = UserInterface.getBinding ( child );\r\n\t\t\t\tif ( binding != null && binding instanceof impl ) {\r\n\t\t\t\t\tresult = binding;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get the FIRST decendant binding of a specified type.\r\n\t * TODO: Merge with getChildBindingByType.\r\n\t * @param {Binding} source\r\n\t * @param {Class} impl\r\n\t * @return {Binding}\r\n\t */\r\n\tgetDescendantBindingByType : function ( source, impl ) {\r\n\r\n\t\tvar result = null;\r\n\t\tsource.getDescendantElementsByLocalName ( \"*\" ).each (\r\n\t\t\tfunction ( child ) {\r\n\t\t\t\tvar binding = UserInterface.getBinding ( child );\r\n\t\t\t\tif ( binding != null && binding instanceof impl ) {\r\n\t\t\t\t\tresult = binding;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get ALL decendant binding of a specified type.\r\n\t * @param {Binding} source\r\n\t * @param {Class} impl\r\n\t * @return {List<Binding>}\r\n\t */\r\n\tgetDescendantBindingsByType : function ( source, impl, isTraverse ) {\r\n\r\n\t\tvar result = new List ();\r\n\t\tsource.getDescendantElementsByLocalName ( \"*\" ).each (\r\n\t\t\tfunction ( descendant ) {\r\n\t\t\t\tvar binding = UserInterface.getBinding ( descendant );\r\n\t\t\t\tif ( binding != null && binding instanceof impl ) {\r\n\t\t\t\t\tresult.add ( binding );\r\n\t\t\t\t} else if( isTraverse  && binding instanceof WindowBinding && binding.getRootBinding()) {\r\n\t\t\t\t\tthis.getDescendantBindingsByType( binding.getRootBinding(), impl, isTraverse)\r\n\t\t\t\t\t.each(function (item){\r\n\t\t\t\t\t\tresult.add(item);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t, this);\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get next binding by name.\r\n\t * @param {Binding} binding\r\n\t * @param {string} name\r\n\t * @return {Binding}\r\n\t */\r\n\tgetNextBindingByLocalName : function ( binding, name ) {\r\n\r\n\t\tvar result = null;\r\n\t\tvar element = binding.bindingElement;\r\n\t\twhile (( element = DOMUtil.getNextElementSibling ( element )) != null && DOMUtil.getLocalName ( element ) != name ) {}\r\n\t\tif ( element != null ) {\r\n\t\t\tresult = UserInterface.getBinding ( element );\r\n\t\t}\r\n\t\treturn result;\r\n\t},\r\n\r\n\t/**\r\n\t * Get previous binding by name.\r\n\t * @param {Binding} binding\r\n\t * @param {string} name\r\n\t * @return {Binding}\r\n\t */\r\n\tgetPreviousBindingByLocalName : function ( binding, name ) {\r\n\r\n\t\tvar result = null;\r\n\t\tvar element = binding.bindingElement;\r\n\t\twhile (( element = DOMUtil.getPreviousElementSibling ( element )) != null && DOMUtil.getLocalName ( element ) != name ) {}\r\n\t\tif ( element != null ) {\r\n\t\t\tresult = UserInterface.getBinding ( element );\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n};\r\n\r\n/**\r\n * The instance that does it.\r\n * @type {_BindingFinder}\r\n */\r\nvar BindingFinder = new _BindingFinder ();\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/BindingParser.js",
    "content": "BindingParser.XML = \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\" xmlns:ui=\\\"http://www.w3.org/1999/xhtml\\\">${markup}</div>\";\r\n\r\n/**\r\n * @class\r\n * Parses markup into elements with all bindings preregistered.\r\n * @param {DOMDocument} ownerDocument\r\n */\r\nfunction BindingParser ( ownerDocument ) {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BindingParser\" );\r\n\t\r\n\t/**\r\n\t * @type {DOMDocument}\r\n\t */\r\n\tthis._ownerDocument = ownerDocument;\r\n\t\r\n\t/**\r\n\t * @type {DOMElement}\r\n\t */\r\n\tthis._rootElement = null;\r\n}\r\n\r\n/**\r\n * Since incoming markup may not be placed in a single root element, \r\n * this method returns a list of elements. Normally you would   \r\n * return a DOMDocumentFragment, but IE doesn't handle those. Notice \r\n * that we return a list of elements, not bindings.\r\n * @param {string} markup\r\n * @return {List<DOMElement>}\r\n */\r\nBindingParser.prototype.parseFromString = function ( markup ) {\r\n\t\r\n\tvar result = new List ();\r\n\tvar xml = BindingParser.XML.replace ( \"${markup}\", markup );\r\n\tvar doc = XMLParser.parse ( markup );\r\n\t\r\n\tif ( doc ) {\r\n\t\tvar solidroot = DOMUtil.createElementNS ( \r\n\t\t\tConstants.NS_XHTML, \r\n\t\t\t\"div\", \r\n\t\t\tthis._ownerDocument \r\n\t\t);\r\n\t\tthis._iterate ( doc.documentElement, solidroot );\r\n\t\tvar node = solidroot.firstChild;\r\n\t\twhile ( node ) {\r\n\t\t\tif ( node.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\t\tresult.add ( node );\r\n\t\t\t}\r\n\t\t\tnode = node.nextSibling;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Iterate an \"abstract\" DOM document and produce a solid XHTML nodetree.\r\n * @param {DOMNode} abstract\r\n * @param {DOMElement} collector\r\n */\r\nBindingParser.prototype._iterate = function ( abstractnode, collector ) {\r\n\t\r\n\tvar solidnode = null;\r\n\r\n\tswitch ( abstractnode.nodeType ) {\r\n\t\tcase Node.ELEMENT_NODE :\r\n\t\t\tsolidnode = this._cloneElement ( abstractnode );\r\n\t\t\tUserInterface.registerBinding ( solidnode );\r\n\t\t\tbreak;\r\n\t\tcase Node.TEXT_NODE :\t\t\r\n\t\t\tsolidnode = this._ownerDocument.createTextNode ( abstractnode.nodeValue );\r\n\t\t\tbreak;\r\n\t}\r\n\tif ( solidnode ) {\r\n\t\tcollector.appendChild ( solidnode );\r\n\t}\r\n\tif ( solidnode && abstractnode.hasChildNodes ()) { // SOLIDNODE?\r\n\t\tvar child = abstractnode.firstChild;\r\n\t\twhile ( child ) {\r\n\t\t\tthis._iterate ( child, solidnode );\r\n\t\t\tchild = child.nextSibling;\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Clone element and attributes from \"abstract\" node and return a solid XHTML node.\r\n * @param {DOMElement} abstractnode\r\n * @return {DOMElement}\r\n */\r\nBindingParser.prototype._cloneElement = function ( abstractnode ) {\r\n\t\r\n\t/*\r\n\t * Notice that null namespaces gets converted to XHTML because of Atlas fugup.\r\n\t */\r\n\tvar solidnode = DOMUtil.createElementNS (\r\n\t\tabstractnode.namespaceURI ? abstractnode.namespaceURI : Constants.NS_XHTML, \r\n\t\tabstractnode.nodeName, \r\n\t\tthis._ownerDocument \r\n\t);\r\n\tvar i = 0;\r\n\twhile ( i < abstractnode.attributes.length ) {\r\n\t\tvar attr = abstractnode.attributes.item ( i++ );\r\n\t\tsolidnode.setAttribute ( attr.nodeName, String ( attr.nodeValue ));\r\n\t}\r\n\treturn solidnode;\r\n}\r\n\r\n/**\r\n * Register binding if applicable.\r\n * @param {DOMElement} abstractnode\r\n * @param {DOMElement} solidnode\r\n *\r\nBindingParser.prototype._registerBinding = function ( abstractnode, solidnode ) {\r\n\t\r\n\tUserInterface.registerBinding ( solidnode );\r\n\tif ( abstractnode.prefix && abstractnode.prefix == \"ui\" ) {\r\n\t\tvar name = DOMUtil.getLocalName ( abstractnode );\r\n\t\tvar impl = null;\r\n\t\tif ( abstractnode.getAttribute ( \"binding\" ) != null ) {\r\n\t\t\timpl = eval ( abstractnode.getAttribute ( \"binding\" ));\r\n\t\t} else {\r\n\t\t\timpl = BindingParser.map [ name ];\r\n\t\t}\r\n\t\tif ( impl ) {\r\n\t\t\tUserInterface.registerBinding ( solidnode, impl );\r\n\t\t}\r\n\t}\r\n}\r\n*/"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/BindingSerializer.js",
    "content": "/**\r\n * @type {BindingSerializer}\r\n */\r\nBindingSerializer.activeInstance = null;\r\n\r\n/**\r\n * @type {string}\r\n */\r\nBindingSerializer.KEYPOINTER = \"bindingserializerkeypointer\";\r\n\r\n/**\r\n * This filter function is intended for the {@link ElementIterator}.\r\n * It's not elegant. But at least we get to use the ElementIterator! \r\n * TODO: REFACTOR now that extra arguments are provided to the filter!\n * @param {DOMElement} element\r\n */\r\nBindingSerializer.filter = function ( element ) {\r\n\r\n\tvar keyPointer = null;\r\n\tvar wasBindingSerializeable = false;\r\n\tvar parentKeyPointer = element.parentNode.getAttribute ( BindingSerializer.KEYPOINTER );\r\n\r\n\tif ( UserInterface.hasBinding ( element )) {\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\twasBindingSerializeable = BindingSerializer.activeInstance.indexBinding ( binding );\r\n\t\tif ( wasBindingSerializeable ) {\r\n\t\t\tkeyPointer = binding.key;\r\n\t\t\telement.setAttribute ( BindingSerializer.KEYPOINTER, keyPointer ) \r\n\t\t}\r\n\t}\r\n\tkeyPointer = keyPointer ? keyPointer : parentKeyPointer;\r\n\tvar children = new List ( element.childNodes );\r\n\tchildren.each ( function ( child ) {\r\n\t\tif ( child.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\tchild.setAttribute ( BindingSerializer.KEYPOINTER, keyPointer ) \r\n\t\t}\r\n\t});\r\n\tif ( wasBindingSerializeable ) {\r\n\t\tBindingSerializer.activeInstance.append ( keyPointer, parentKeyPointer );\r\n\t}\r\n}\r\n\r\n/**\r\n * @class\r\n */\r\nfunction BindingSerializer () {\r\n\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tthis.logger = SystemLogger.getLogger ( \"BindingSerializer\" );\r\n\r\n\t/**\r\n\t * @type {DOMDocument}\r\n\t */\r\n\tthis._dom = DOMUtil.getDOMDocument ();\r\n\t\r\n\t/*\r\n\t * TEMP!\r\n\t */\r\n\talert ( \"BindingSerializer: Convert to Crawler!\" );\r\n\t\r\n\t/**\r\n\t * @type {HashMap<string><DOMElement>}\r\n\t */\r\n\tthis._pointers = [];\r\n}\r\n\r\nBindingSerializer.prototype.serializeBinding = function ( binding ) {\r\n\r\n\tBindingSerializer.activeInstance = this;\r\n\tbinding.bindingWindow.ElementIterator.iterate ( \r\n\t\tbinding.bindingElement, \r\n\t\tBindingSerializer.filter\r\n\t);\r\n\treturn DOMSerializer.serialize ( this._dom, true );\r\n}\r\n\r\nBindingSerializer.prototype.indexBinding = function ( binding ) {\r\n\r\n\tvar wasBindingSerialized = false;\r\n \tvar properties = binding.serialize ();\r\n\t\r\n\tif ( properties != false ) {\r\n\t\t\r\n\t\t/*\r\n\t\t * The filter queries this return value.\r\n\t\t */\r\n\t\twasBindingSerialized = true;\r\n\t\t\r\n\t\t/*\r\n\t\t * create a new element in the serialization \r\n\t\t * document and index it with a pointer key.\r\n\t\t */\r\n\t\tvar nodeName = \"ui:\" + DOMUtil.getLocalName ( binding.bindingElement );\r\n\t\tvar element = DOMUtil.createElementNS ( Constants.NS_UI, nodeName, this._dom );\r\n\t\tthis._pointers [ binding.key ] = element;\r\n\t\t\r\n\t\t/*\r\n\t\t * Assign binding properties.\r\n\t\t */\r\n\t\tfor ( var prop in properties ) {\r\n\t\t\tif ( properties [ prop ] != null ) {\r\n\t\t\t\telement.setAttribute ( prop, String ( properties [ prop ]));\r\n\t\t\t}\r\n\t\t}\t\r\n\t}\r\n\treturn wasBindingSerialized;\r\n}\r\n\r\n/**\r\n * @param {string} keyPointer\r\n * @param {string} parentKeyPointer\r\n */\r\nBindingSerializer.prototype.append = function ( keyPointer, parentKeyPointer ) {\r\n\t\r\n\tvar childNode = this._pointers [ keyPointer ];\t\r\n\tvar parentNode = parentKeyPointer ? this._pointers [ parentKeyPointer ] : this._dom;\r\n\tparentNode.appendChild ( childNode );\t\r\n}\r\n"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/Dimension.js",
    "content": "/**\r\n * Compare two dimensions.\r\n * @param {Dimension} dim1\r\n * @param {Dimension} dim2\r\n * @return {boolean}\r\n */\r\nDimension.isEqual = function ( dim1, dim2 ) {\r\n\t\r\n\tvar result = false;\r\n\tif ( dim1 && dim2 ) {\r\n\t\tresult = ( dim1.w == dim2.w ) && ( dim1.h == dim2.h );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @class\r\n * @param {int} w\r\n * @param {int} h\r\n */\r\nfunction Dimension ( w, h ) {\r\n\r\n\tthis.w = w;\r\n\tthis.h = h;\r\n}\r\n\r\nDimension.prototype = {\r\n\t\r\n\t/**\r\n\t * Width.\r\n\t * @type {int}\r\n\t */\r\n\tw : 0,\r\n\t\r\n\t/**\r\n\t * Height.\r\n\t * @type {int}\r\n\t */\r\n\th : 0\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/Geometry.js",
    "content": "/**\r\n * @class\r\n * @param {int} x\r\n * @param {int} y\r\n * @param {int} w\r\n * @param {int} h\r\n */\r\nfunction Geometry ( x, y, w, h ) {\r\n\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n\tthis.w = w;\r\n\tthis.h = h;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/ImageProfile.js",
    "content": "/**\r\n * Button image handling have been separated out so that we \r\n * can hardcode-declare it for certain types of buttons.\r\n * @param {object} object Any type of object with four special properties.\r\n */\r\nfunction ImageProfile ( object ) {\r\n\t\r\n\tthis._default\t\t= object.image;\r\n\tthis._hover \t\t= object.imageHover;\r\n\tthis._active\t\t= object.imageActive;\r\n\tthis._disabled\t\t= object.imageDisabled;\r\n}\r\n\r\n/**\r\n * Get default image.\r\n * @return {string}\r\n */\r\nImageProfile.prototype.getDefaultImage = function () {\r\n\r\n\treturn this._default;\r\n}\r\n\r\n/**\r\n * Set default image.\r\n * @param {string} image\r\n */\r\nImageProfile.prototype.setDefaultImage = function ( image ) {\r\n\t\r\n\tthis._default = image;\r\n}\r\n\r\n/**\r\n * Get hover image.\r\n * @return {string}\r\n */\r\nImageProfile.prototype.getHoverImage = function () {\r\n\r\n\treturn this._default;\r\n}\r\n\r\n/**\r\n * Set default image.\r\n * @param {string} image\r\n */\r\nImageProfile.prototype.setHoverImage = function ( image ) {\r\n\t\r\n\tthis._hover = image;\r\n}\r\n\r\n/**\r\n * Get active image.\r\n * @return {string}\r\n */\r\nImageProfile.prototype.getActiveImage = function () {\r\n\r\n\treturn this._active;\r\n}\r\n\r\n/**\r\n * Set active image.\r\n * @param {string} image\r\n */\r\nImageProfile.prototype.setActiveImage = function ( image ) {\r\n\t\r\n\tthis._active = image;\r\n}\r\n\r\n/**\r\n * Get disabled image.\r\n * @return {string}\r\n */\r\nImageProfile.prototype.getDisabledImage = function () {\r\n\r\n\treturn this._default;\r\n}\r\n\r\n/**\r\n * Set disabled image.\r\n * @param {string} image\r\n */\r\nImageProfile.prototype.setDisabledImage = function ( image ) {\r\n\t\r\n\tthis._disabled = image;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/Point.js",
    "content": "/**\r\n * Compare two points.\r\n * @param {Point} p1\r\n * @param {Point} p2\r\n * @return {boolean}\r\n */\r\nPoint.isEqual = function ( p1, p2 ) {\r\n\t\r\n\tvar result = false;\r\n\tif ( p1 && p2 ) {\r\n\t\tresult = ( p1.x == p2.x ) && ( p1.y == p2.y );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @class\r\n * @param {int} x\r\n * @param {int} y\r\n */\r\nfunction Point ( x, y ) {\r\n\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n}\r\n\r\nPoint.prototype = {\r\n\t\r\n\t/**\r\n\t * X position.\r\n\t * @type {int}\r\n\t */\r\n\tx : 0,\r\n\t\r\n\t/**\r\n\t * Y position.\r\n\t * @type {int}\r\n\t */\r\n\ty : 0\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/crawlers/BindingCrawler.js",
    "content": "BindingCrawler.prototype = new ElementCrawler;\r\nBindingCrawler.prototype.constructor = BindingCrawler;\r\nBindingCrawler.superclass = ElementCrawler.prototype;\r\n\r\n/**\r\n * @class\r\n * The ElementCrawler sees only elements with Bindings attached.\r\n */\r\nfunction BindingCrawler () {\r\n\t\r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * * Filter all but Binding elements.\r\n * @overloads {ElementCrawler#_construct} \r\n */\r\nBindingCrawler.prototype._construct = function () {\r\n\t\r\n\tBindingCrawler.superclass._construct.call ( this );\r\n\t\r\n\tthis.addFilter ( function ( element, arg ) {\r\n\t\tvar result = null;\r\n\t\tif ( !UserInterface.hasBinding ( element )) {\r\n\t\t\tresult = NodeCrawler.SKIP_NODE;\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/crawlers/Crawler.js",
    "content": "Crawler.prototype = new BindingCrawler;\r\nCrawler.prototype.constructor = Crawler;\r\nCrawler.superclass = BindingCrawler.prototype;\r\n\r\n/**\r\n * @class\r\n * The Crawler will climb all binding elements and \r\n * invoke a method on the associated Binding.\r\n */\r\nfunction Crawler () {\r\n\t\r\n\t/**\r\n\t * The binding may recognize the intent of \r\n\t * the crawler by addressing the id property.\r\n\t * @type {string}\r\n\t */ \r\n\tthis.id = null;\r\n\r\n\t/**\r\n\t * The binding may control the bindings behavior - eg skip, \r\n\t * stop or skip children - by modifying this property. We \r\n\t * do it like this because a response type on the method \r\n\t * <code>handleCrawler</code> would surely get lost in \r\n\t * method overloading...\r\n\t * @type {string}\r\n\t */\r\n\tthis.response = null;\r\n\t\r\n\t/*\r\n\t * Construct.\r\n\t */\r\n\tthis._construct ();\r\n\t\r\n\t/*\r\n\t * Returnable.\r\n\t */\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Fires the method <code>handleCrawler</code> an any waiting binding. \r\n * @overloads {BindingCrawler#_construct} \r\n */\r\nCrawler.prototype._construct = function () {\r\n\t\r\n\tCrawler.superclass._construct.call ( this );\r\n\t\r\n\tthis.response = null;\r\n\r\n\tvar self = this;\r\n\tthis.addFilter ( function ( element, arg ) {\r\n\t\tvar result = null;\r\n\t\tvar binding = UserInterface.getBinding ( element );\r\n\t\tif ( Interfaces.isImplemented ( ICrawlerHandler, binding ) == true ) {\r\n\t\t\tself.response = null;\r\n\t\t\tbinding.handleCrawler ( self );\r\n\t\t\tresult = self.response;\t\t\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/crawlers/ElementCrawler.js",
    "content": "ElementCrawler.prototype = new NodeCrawler;\r\nElementCrawler.prototype.constructor = ElementCrawler;\r\nElementCrawler.superclass = NodeCrawler.prototype;\r\n\r\n/**\r\n * @class\r\n * The ElementCrawler sees only element nodes.\r\n */\r\nfunction ElementCrawler () {\r\n\r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Filter all but Element nodes.\r\n * @overloads {NodeCrawler#_construct} \r\n */\r\nElementCrawler.prototype._construct = function () {\r\n\t\r\n\tElementCrawler.superclass._construct.call ( this );\r\n\t\r\n\tthis.addFilter ( function ( node, arg ) {\r\n\t\tvar result = null;\r\n\t\tif ( node.nodeType != Node.ELEMENT_NODE ) {\r\n\t\t\tresult = NodeCrawler.SKIP_NODE;\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/utilities/crawlers/NodeCrawler.js",
    "content": "NodeCrawler.NORMAL = 1;\r\nNodeCrawler.SKIP_NODE = 2;\r\nNodeCrawler.SKIP_CHILDREN = 4;\r\nNodeCrawler.STOP_CRAWLING = 8;\r\n\r\nNodeCrawler.TYPE_DESCENDING = \"descending\";\r\nNodeCrawler.TYPE_ASCENDING = \"ascending\";\r\n\r\n/**\r\n * @class\r\n * The NodeCrawler will climb up and down the DOM tree.\r\n */\r\nfunction NodeCrawler () {\r\n\t\r\n\tthis._construct ();\r\n\treturn this;\r\n}\r\n\r\nNodeCrawler.prototype = {\r\n\t\r\n\t/**\r\n\t * @type {SystemLogger}\r\n\t */\r\n\tlogger: SystemLogger.getLogger ( \"NodeCrawler\" ),\r\n\t\t\r\n\t/**\r\n\t * Type (defaults to descending).\r\n\t * @type {string}\r\n\t */\r\n\ttype : NodeCrawler.TYPE_DESCENDING,\r\n\t\r\n\t/**\r\n\t * The current node.\r\n\t * @type {DOMElement}\r\n\t */\r\n\tcurrentNode : null,\r\n\t\r\n\t/**\r\n\t * The previous node.\r\n\t * @type {DOMElement}\r\n\t */\r\n\tpreviousNode : null,\r\n\t\r\n\t/**\r\n\t * @type {DOMDocument}\r\n\t */\r\n\tcontextDocument : null,\r\n\t\r\n\t/**\r\n\t * Filter list. Note that the filter list is not inherited to \r\n\t * subclasses, ie. all NodeCrawlers start with an empty list.\r\n\t * @type {List<function>\r\n\t */\r\n\t_filters : null,\r\n\t\r\n\t/**\r\n\t * This will allow us to subclass safely. \r\n\t */\r\n\t_construct : function () {\r\n\t\t\r\n\t\tthis.currentNode = null,\r\n\t\tthis.previousNode = null;\r\n\t\tthis.nextNode = null;\r\n\t\tthis._filters = new List ();\r\n\t\tthis.type = NodeCrawler.TYPE_DESCENDING;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Add node filter.\r\n\t * @param {function} filter\r\n\t */\r\n\taddFilter : function ( filter ) {\r\n\t\r\n\t\tthis._filters.add ( filter );\r\n\t},\r\n\t\r\n\t/**\r\n\t * Remove node filter.\r\n\t * TODO: Test this method.\r\n\t * @param {function} filter\r\n\t */\r\n\tremoveFilter : function ( filter ) {\r\n\t\t\r\n\t\tvar index = -1;\r\n\t\tthis._filters.each ( function ( fil ) {\r\n\t\t\tindex ++;\r\n\t\t\tvar result = true;\r\n\t\t\tif ( fil == filter ) {\r\n\t\t\t\tresult = false;\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t});\r\n\t\tif ( index >-1 ) {\r\n\t\t\tthis._filters.del ( index );\r\n\t\t}\r\n\t},\r\n\t\r\n\t/**\r\n\t * Apply functions to a given node. Return type info:\r\n\t * \r\n\t * SKIP_NODE and STOP_CRAWLING will discontinue both \r\n\t * filter execution and DOM traversal immediately.\r\n\t * \r\n\t * SKIP_CHILDREN will not stop the filter execution  \r\n\t * chain, it only affects the DOM traversal on next \r\n\t * iteration of the _crawl method. Note that this  \r\n\t * may itself be modified by a later function in the \r\n\t * filter chaing (by setting the response to NORMAL).\r\n\t * \r\n\t * @param {DOMNode} node\r\n\t * @return\r\n\t */\r\n\t_applyFilters : function ( node, arg ) {\r\n\t\t\r\n\t\tvar returnable = null;\r\n\t\tvar stop = NodeCrawler.STOP_CRAWLING;\r\n\t\tvar skip = NodeCrawler.SKIP_NODE;\r\n\t\tvar block = NodeCrawler.SKIP_CHILDREN;\r\n\t\t\r\n\t\tthis._filters.reset ();\r\n\t\tvar isContinue = true;\r\n\t\t\r\n\t\twhile ( this._filters.hasNext () && isContinue == true ) {\r\n\t\t\tvar filter = this._filters.getNext ();\r\n\t\t\t//var res = filter ( node, arg );\r\n\t\t\tvar res = filter.call ( this, node, arg );\r\n\t\t\tif ( res != null ) {\r\n\t\t\t\treturnable = res;\r\n\t\t\t\tswitch ( res ) {\r\n\t\t\t\t\tcase stop :\r\n\t\t\t\t\tcase skip :\r\n\t\t\t\t\tcase skip + block :\r\n\t\t\t\t\t\tisContinue = false;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn returnable;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Start crawling.\r\n\t * @param {DOMElement} element\r\n\t * @param {object} arg\r\n\t */\r\n\tcrawl : function ( element, arg ) {\r\n\t\t\r\n\t\tthis.contextDocument = element.ownerDocument;\r\n\t\tthis.onCrawlStart ();\r\n\t\t\r\n\t\t/*\r\n\t\t * TODO: Does ascending crawler evaluates first node twice?\r\n\t\t */\r\n\t\tvar isAscending = this.type == NodeCrawler.TYPE_ASCENDING;\r\n\t\tvar returnable = this._applyFilters ( element, arg );\r\n\t\t\r\n\t\t/*\r\n\t\t * Where to crawl next? Special setup when start crawling.\r\n\t\t */\r\n\t\tif ( returnable != NodeCrawler.STOP_CRAWLING ) {\r\n\t\t\tif ( isAscending && returnable == NodeCrawler.SKIP_CHILDREN ) {\r\n\t\t\t\t// stop here!\r\n\t\t\t} else {\r\n\t\t\t\tvar next = null;\r\n\t\t\t\tif ( this.nextNode != null ) {\r\n\t\t\t\t\tnext = this.nextNode;\r\n\t\t\t\t\tthis.nextNode = null;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnext = isAscending ? element.parentNode : element;\r\n\t\t\t\t}\r\n\t\t\t\tthis._crawl ( next, arg );\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tthis.onCrawlStop ();\r\n\t},\r\n\t\r\n\t/**\r\n\t * Invoked when crawl is instantiated. Doing nothing  \r\n\t * by default, this is for subclasses to overwrite.\r\n\t */\r\n\tonCrawlStart : function () {},\r\n\t\r\n\t/**\r\n\t * Invoked when crawl is terminated. Doing nothing  \r\n\t * by default, this is for subclasses to overwrite.\r\n\t */\r\n\tonCrawlStop : function () {},\r\n\t\r\n\t/**\r\n\t * @param {DOMElement} element\r\n\t * @param {object} arg\r\n\t * @return {String}\r\n\t */\r\n\t_crawl : function ( element, arg ) {\r\n\t\t\r\n\t\tvar returnable = null;\r\n\t\tswitch ( this.type ) {\r\n\t\t\tcase NodeCrawler.TYPE_DESCENDING :\r\n\t\t\t\treturnable = this._crawlDescending ( element, arg );\r\n\t\t\t\tbreak;\r\n\t\t\tcase NodeCrawler.TYPE_ASCENDING :\r\n\t\t\t\treturnable = this._crawlAscending ( element, arg );\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn returnable;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Crawl descending.\r\n\t * @param {DOMElement} element\r\n\t * @param {object} arg\r\n\t * @param {boolean} isInternal\r\n\t * @return {String}\r\n\t */\r\n\t_crawlDescending : function ( element, arg ) {\r\n\t\t\r\n\t\tvar skip = NodeCrawler.SKIP_NODE;\r\n\t\tvar block = NodeCrawler.SKIP_CHILDREN;\r\n\t\tvar stop = NodeCrawler.STOP_CRAWLING;\r\n\t\t\r\n\t\tvar returnable = null;\r\n\t\t\r\n\t\tif ( element.hasChildNodes ()) {\r\n\t\t\t\r\n\t\t\tvar node = element.firstChild;\r\n\t\t\twhile ( node != null && returnable != stop ) {\r\n\t\t\t\t\r\n\t\t\t\tthis.currentNode = node;\r\n\t\t\t\treturnable = this._applyFilters ( node, arg );\r\n\t\t\t\t\r\n\t\t\t\tswitch ( returnable ) {\r\n\t\t\t\t\tcase stop :\r\n\t\t\t\t\tcase block :\r\n\t\t\t\t\tcase skip + block :\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault :\r\n\t\t\t\t\t\tif ( node.nodeType == Node.ELEMENT_NODE ) {\r\n\t\t\t\t\t\t\tif ( this.nextNode == null ) {\r\n\t\t\t\t\t\t\t\tvar res = this._crawl ( node, arg ); \r\n\t\t\t\t\t\t\t\tif ( res == stop ) {\r\n\t\t\t\t\t\t\t\t\treturnable = stop;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif ( returnable != stop && returnable != skip ) {\r\n\t\t\t\t\t\t\tthis.previousNode = node; // .... move this up? Think about it...\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif ( returnable != stop ) {\r\n\t\t\t\t\tnode = this.nextNode ? this.nextNode : node.nextSibling;\r\n\t\t\t\t\tthis.nextNode = null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn returnable;\r\n\t},\r\n\t\r\n\t/**\r\n\t * Crawl ascending.\r\n\t * @param {DOMElement} element.\r\n\t * @param {object} arg\r\n\t * @return {String}\r\n\t */\r\n\t_crawlAscending : function ( element, arg ) {\r\n\t\t\r\n\t\tvar returnable = null;\r\n\t\tvar skip = NodeCrawler.SKIP_CHILDREN;\r\n\t\tvar stop = NodeCrawler.STOP_CRAWLING;\r\n\t\t\r\n\t\tif ( element != null ) {\r\n\t\t\tthis.currentNode = element;\r\n\t\t\treturnable = this._applyFilters ( element, arg );\r\n\t\t\tif ( returnable != stop ) {\r\n\t\t\t\tvar next = this.nextNode ? this.nextNode : element.parentNode;\r\n\t\t\t\tthis.nextNode = null;\r\n\t\t\t\tif ( next && next.nodeType != Node.DOCUMENT_NODE ) {\r\n\t\t\t\t\tthis.previousNode = element;\r\n\t\t\t\t\treturnable = this._crawl ( next, arg );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturnable = stop;\r\n\t\t}\r\n\t\treturn returnable;\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispose crawler. The benefit of this has not been documented, \r\n * but leaking closures may be hiding in the filters...\r\n */\r\nNodeCrawler.prototype.dispose = function () {\r\n\t\r\n\tthis._filters.dispose ();\r\n\tfor ( var property in this ) {\r\n\t\tthis [ property ] = null;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/viewdefinitions/DialogViewDefinition.js",
    "content": "DialogViewDefinition.prototype = new ViewDefinition;\r\nDialogViewDefinition.prototype.constructor = HostedViewDefinition;\r\nDialogViewDefinition.superclass = ViewDefinition.prototype;\r\n\r\n/**\r\n * @class \r\n * @param {object} arg Constructor argument properties maps directly into class properties.\r\n */\r\nfunction DialogViewDefinition ( arg ) {\r\n\t\r\n\t/**\r\n\t * Don't confuse with \"handle\".\r\n\t * @type {IDialogResponseHandler}\r\n\t */\r\n\tthis.handler = null;\r\n\t\r\n\t/**\r\n\t * The dialog default position.\r\n\t * @type {object}\r\n\t */\r\n\tthis.position = Dialog.MODAL;\r\n\t\r\n\t/**\r\n\t * @overwrites {ViewDefinition#label}\r\n\t * @type {string}\r\n\t */\r\n\tthis.label = null; //DockTabBinding.LABEL_TABLOADING;\r\n\t\r\n\t/**\r\n\t * @overwrites {ViewDefinition#image}\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = null; // DockTabBinding.IMG_TABLOADING;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.width = null;\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis.height = null;\r\n\t\r\n\t/*\r\n\t * Initialize all of the above from argument.\r\n\t */\r\n\tif ( arg ) {\r\n\t\tfor ( var prop in arg ) {\r\n\t\t\tif ( this [ prop ] || this.prop == null ) {\r\n\t\t\t\tthis [ prop ] = arg [ prop ];\r\n\t\t\t\tif ( this.url ) {\r\n\t\t\t\t\tthis.url = Resolver.resolve ( this.url );\r\n\t\t\t\t}\r\n\t\t\t\tif ( this.handler ) {\r\n\t\t\t\t\tif ( !Interfaces.isImplemented ( IDialogResponseHandler, this.handler )) {\r\n\t\t\t\t\t\tthrow \"IDialogResponseHandler not implemented\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthrow \"Property not recognized: \" + prop;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/viewdefinitions/HostedViewDefinition.js",
    "content": "HostedViewDefinition.prototype = new ViewDefinition;\r\nHostedViewDefinition.prototype.constructor = HostedViewDefinition;\r\nHostedViewDefinition.superclass = ViewDefinition.prototype;\r\nHostedViewDefinition.POSTBACK_URL = \"${root}/postback.aspx\";\r\n\r\n/**\r\n * @class \r\n * @param {object} arg Constructor argument properties maps directly into class properties.\r\n */\r\nfunction HostedViewDefinition ( arg ) {\r\n\t\r\n\t/**\r\n\t * The dock default position.\r\n\t * @type {object}\r\n\t */\r\n\tthis.position = DockBinding.MAIN;\r\n\t\r\n\t/**\r\n\t * Associates the View to a given perspective. This property matches \r\n\t * the \"TagValue\" property of the ClientElement objects sent from server.\r\n\t * @type {string}\r\n\t */\r\n\tthis.perspective = null;\r\n\t\r\n\t/**\r\n\t * @overwrites {ViewDefinition#entityToken}\r\n\t * @type {string}\r\n\t */\r\n\tthis.entityToken = null;\r\n\t\r\n\t/**\r\n\t * @overwrites {ViewDefinition#label}\r\n\t * @type {string}\r\n\t */\r\n\tthis.label = null;\r\n\t\r\n\t/**\r\n\t * @overwrites {ViewDefinition#image}\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = null;\r\n\t\r\n\t/*\r\n\t * Initialize all of the above from argument.\r\n\t */\r\n\tif ( arg ) {\r\n\t\tfor ( var prop in arg ) {\r\n\t\t\tif ( this [ prop ] || this.prop == null ) {\r\n\t\t\t\tthis [ prop ] = arg [ prop ];\r\n\t\t\t\tif ( this.url ) {\r\n\t\t\t\t\tthis.url = Resolver.resolve ( this.url );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthrow \"Property not recognized: \" + prop;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/viewdefinitions/SystemViewDefinition.js",
    "content": "SystemViewDefinition.prototype = new ViewDefinition;\r\nSystemViewDefinition.prototype.constructor = SystemViewDefinition;\r\nSystemViewDefinition.superclass = ViewDefinition.prototype;\r\nSystemViewDefinition.DEFAULT_URL = \"${root}/content/views/systemview/systemview.aspx\";\r\n\r\n/**\r\n * @class\r\n * @param {SystemNode} node\r\n */\r\nfunction SystemViewDefinition ( node ) {\r\n\t\r\n\t/**\r\n\t * Unique for system viewdefinitions.\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.node = node;\r\n\t\r\n\t/**\r\n\t * Served for the {@link SystemPageBinding}.\r\n\t * @overwrites {ViewDefinition#argument}\r\n\t * @type {SystemNode}\r\n\t */\r\n\tthis.argument = node;\r\n\t\r\n\t/**\r\n\t * All systemviews start with the same URL. The content is later\r\n\t * generated on basis of the the SystemNode supplied in constructor.\r\n\t * @overwrites {ViewDefinition#url}\r\n\t * @type {string}\t \r\n\t */\r\n\tthis.url = SystemViewDefinition.DEFAULT_URL;\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.handle\t= node.getHandle ();\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.label = node.getLabel ();\r\n\t\r\n\t/** \r\n\t * TODO: are we using this?\r\n\t * @type {string}\r\n\t */\r\n\tthis.image = node.getImageProfile ().getDefaultImage ();\r\n\t\r\n\t/**\r\n\t * @type {string}\r\n\t */\r\n\tthis.toolTip = node.getToolTip ();\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/ui/viewdefinitions/ViewDefinition.js",
    "content": "/**\r\n * @type {string}\r\n */\r\nViewDefinition.DEFAULT_URL = \"${root}/blank.aspx\";\r\n\r\n/**\r\n * Clone a ViewDefinition, assigning a new handle.\r\n * @param {String} handle\r\n * @param {String} newhandle\r\n * @return {ViewDefinition}\r\n */\r\nViewDefinition.clone = function (handle, newhandle) {\r\n\r\n\tvar result = null;\r\n\tvar proto = ViewDefinitions[handle];\r\n\r\n\tif (proto.isMutable) {\r\n\r\n\t\tvar impl = null;\r\n\t\tif (proto instanceof DialogViewDefinition) {\r\n\t\t\timpl = DialogViewDefinition;\r\n\t\t} else {\r\n\t\t\timpl = HostedViewDefinition;\r\n\t\t}\r\n\t\tif (newhandle != null && impl != null) {\r\n\t\t\tvar def = new impl();\r\n\t\t\tfor (var prop in proto) {\r\n\t\t\t\tdef[prop] = ViewDefinition.cloneProperty(proto[prop]);\r\n\t\t\t}\r\n\t\t\tdef.handle = newhandle;\r\n\t\t\tresult = def;\r\n\t\t} else {\r\n\t\t\tthrow \"Cannot clone without newhandle\";\r\n\t\t}\r\n\t} else {\r\n\t\tthrow \"Cannot clone non-mutable definition\";\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n* Clone .\r\n* @param {Object} propertye\r\n* @return {Object\r\n*/\r\nViewDefinition.cloneProperty = function (object) {\r\n\tif (null == object) return object;\r\n\r\n\tif (typeof object === 'object') {\r\n\t\tvar result = (object.constructor === Array)?[]:{};\r\n\t\tfor (var prop in object) {\r\n\t\t\tresult[prop] = ViewDefinition.cloneProperty(object[prop]);\r\n\t\t}\r\n\t\treturn result;\r\n\t}\r\n\treturn object;\r\n}\r\n\r\n\r\n/**\r\n * @class\r\n * Don't construct this fellow manually, please subclass first.\r\n */\r\nfunction ViewDefinition () {}\r\n\r\nViewDefinition.prototype = {\r\n\t\r\n\t/**\r\n\t * The URL to display.\r\n\t * @type {string}\r\n\t */\r\n\turl : ViewDefinition.DEFAULT_URL,\r\n\t\r\n\t/**\r\n\t * Served to PageBinding.\r\n\t * @see {PageBinding#setPageArgument}\r\n\t * @type {object}\r\n\t */\r\n\targument : null,\r\n\t\r\n\t/**\r\n\t * Backend handle (ElementKey).\r\n\t * @type {string}\r\n\t */\r\n\thandle : null,\r\n\t\r\n\t/**\r\n\t * May associate the definition to a tree item.\r\n\t * @type {string}\r\n\t */\r\n\tentityToken : null,\r\n\t\r\n\t/**\r\n\t * Backend flowhandle.\r\n\t * @type {string}\r\n\t */\r\n\tflowHandle : null,\r\n\t\r\n\t/**\r\n\t * The label.\r\n\t * @type {string}\r\n\t */\r\n\tlabel : null,\r\n\t\r\n\t/**\r\n\t * The image URL.\r\n\t * @type {string}\r\n\t */\r\n\timage : null,\r\n\t\r\n\t/**\r\n\t * The tooltip.\r\n\t * @type {string}\r\n\t */\r\n\ttoolTip : null\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/util/List.js",
    "content": "/**\r\n * @class\r\n * Sort of an array with added methods. Not as flexible, but easier to read. \r\n * All this stuff was written before the new Array methods of JS1.6 - otherwise \r\n * we would have attempted to simply simply emulate these by expando on Explorer.\r\n * @param {object} arg Optional\r\n */\r\nfunction List ( arg ) {\r\n\t\r\n\t/**\r\n\t * @type {int}\r\n\t */\r\n\tthis._index = 0;\r\n\t\r\n\t/**\r\n\t * @type {array}\r\n\t */\r\n\tthis._array = [];\r\n\t\r\n\t/**\r\n\t * Is disposed?\r\n\t * @type {boolean}\r\n\t */\r\n\tthis.isDisposed = false;\r\n\t\r\n\t/*\r\n\t * Initialize from argument.\r\n\t */\r\n\tif ( arg ) {\r\n\t\tthis.init ( arg );\r\n\t}\r\n\t\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Populate from specified array or NodeList.\r\n * @param {object} This should be either an array or a NodeList object.\r\n */\r\nList.prototype.init = function ( list ) {\r\n\r\n\tvar isArray = ( list !== undefined && list.splice !== undefined );\r\n\t\r\n\tif ( isArray ) {\r\n\t\tthis._array = list;\r\n\t} else if (list.length) {\r\n\t\tvar i = 0;\r\n\t\tfor (var i = 0; i < list.length; i++) {\r\n\t\t\tthis._array.push(list[i]);\r\n\t\t}\r\n\t} else {\r\n\t\tvar i = 0, entry;\r\n\t\twhile ((entry = list[i++]) != null) {\r\n\t\t\tthis._array.push(entry);\r\n\t\t}\r\n\t}\r\n\tthis.reset ();\r\n}\r\n\r\n/**\r\n * Add object and return it.\r\n * @param {object} object\r\n * @return {object}\r\n */\r\nList.prototype.add = function ( object ) {\r\n\r\n\tthis._array.push ( object );\r\n\treturn object;\r\n}\r\n\r\n/**\r\n * Add object first and return it.\r\n * @param {object} object\r\n * @return {object}\r\n */\r\nList.prototype.addFirst = function ( object ) {\r\n\r\n\tthis._array.unshift ( object );\r\n\treturn object;\r\n}\r\n\r\n/**\r\n * Delete entry by key.\r\n * @param {int} index\r\n */\r\nList.prototype.remove = function (entry) {\r\n\tvar i = 0, e;\r\n\twhile ((e = this._array[i++]) !== undefined) {\r\n\t\tif (e == entry) {\r\n\t\t\tthis._array.splice(i - 1, 1);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n}\r\n\r\n/**\r\n * @param {int} index\r\n * @return {object}\r\n */\r\nList.prototype.get = function ( index ) {\r\n\t\r\n\tvar result = null;\r\n\tif ( this._array [ index ]) {\r\n\t\tresult = this._array [ index ];\r\n\t} \r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @param {int} index\r\n * @param {object} value\r\n */\r\nList.prototype.set = function ( index, value ) {\r\n\r\n\tthis._array [ index ] = value;\r\n}\r\n\r\n/**\r\n * Delete entry at specified index.\r\n * @param {int} index\r\n */\r\nList.prototype.del = function ( index ) {\r\n\r\n\tthis._array.splice ( index, 1 );\r\n}\r\n\r\n/**\r\n * Is entry added?\r\n * @param {object} entry\r\n */\r\nList.prototype.has = function ( entry ) {\r\n\t\r\n\tvar result = false;\r\n\tvar i = 0, e;\r\n\twhile (( e = this._array [ i++ ]) !== undefined ) {\r\n\t\tif ( e == entry ) {\r\n\t\t\tresult = true;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\t\t\r\n\t\t\r\n/**\r\n * @return {int}\r\n */\r\nList.prototype.getLength = function () {\r\n\r\n\treturn this._array.length;\r\n}\r\n\r\n/**\r\n * @return {boolean}\r\n */\r\nList.prototype.hasEntries = function () {\r\n\r\n\treturn this.getLength () > 0;\r\n}\r\n\r\n/**\r\n * @return {boolean}\r\n */\r\nList.prototype.hasNext = function () {\r\n\r\n\tvar result = false;\r\n\tif ( this._array != null ) {\r\n\t\tresult = this._index < this._array.length;\r\n\t} else {\r\n\t\tSystemLogger.getLogger ( \"List\" ).error ( \"Mysterious List#hasNext exception in IE\" );\r\n\t\t// SystemDebug.stack ( arguments );\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @return {object}\r\n */\r\nList.prototype.getNext = function () {\r\n\r\n\tvar result = null;\r\n\tif ( this.hasNext ()) {\r\n\t\tresult = this._array [ this._index ++ ];\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get following entry.\r\n * @param {object} entry\r\n * @return {object}\r\n */\r\nList.prototype.getFollowing = function ( entry ) {\r\n\r\n\tvar result = null;\r\n\tvar i = 0, e = null;\r\n\t\r\n\twhile (( e = this._array [ i ]) != null && !result ) {\r\n\t\tif ( e == entry && this._array [ i + 1 ]) {\r\n\t\t\tresult = this._array [ i + 1 ];\r\n\t\t}\r\n\t\ti++;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get preceding.\r\n * @param {object} entry\r\n * @return {object}\r\n */\r\nList.prototype.getPreceding = function ( entry ) {\r\n\t\r\n\tvar result = null;\r\n\tvar i = 1, e = null;\r\n\t\r\n\twhile (( e = this._array [ i ]) != null && !result ) {\r\n\t\tif ( e == entry && this._array [ i - 1 ]) {\r\n\t\t\tresult = this._array [ i - 1 ];\r\n\t\t}\r\n\t\ti++;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get first occuring index of a given entry.  \r\n * @param {object} entry\r\n * @return {int}\r\n */\r\nList.prototype.getIndex = function ( entry ) {\r\n\t\r\n\tvar result = -1;\r\n\t\r\n\tif ( this._array.indexOf != null ) {\r\n\t\tresult = this._array.indexOf ( entry );\r\n\t} else {\r\n\t\tvar index = 0;\r\n\t\tthis.each ( function ( e ) {\r\n\t\t\tvar res = true;\r\n\t\t\tif ( e == entry ) {\r\n\t\t\t\tresult = index;\r\n\t\t\t\tres = false;\r\n\t\t\t}\r\n\t\t\tindex ++;\r\n\t\t\treturn res;\r\n\t\t});\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * @return {List}\r\n */\r\nList.prototype.reset = function () {\r\n\r\n\tthis._index = 0;\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * @return {List}\r\n */\r\nList.prototype.clear = function () {\r\n\r\n\tthis._array = [];\r\n\treturn this.reset ();\r\n}\r\n\r\n/**\r\n * @param {function} action The action can return false to discontinue iteration.\r\n * @param {object} thisp\r\n */\r\nList.prototype.each = function ( action, thisp ) {\r\n\r\n\tthis.reset ();\r\n\tvar next, is = true;\r\n\twhile ( is != false && this.hasNext ()) {\r\n\t\tif ( thisp === undefined ) {\r\n\t\t\tthisp = null;\r\n\t\t}\r\n\t\tvar index = this._index;\r\n\t\tvar entry = this.getNext ();\r\n\t\tis = action.call ( thisp, entry, index );\r\n\t}\r\n\tthis.reset ();\r\n}\r\n\r\n/**\r\n * @return {List}\r\n */\r\nList.prototype.copy = function () {\r\n\r\n\treturn new List ( this._array );\r\n}\r\n\r\n/**\r\n * @return {List}\r\n */\r\nList.prototype.reverse = function () {\r\n\r\n\tthis._array.reverse ();\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Extract first entry. This method changes the length of the list.\r\n * @return {object}\r\n */\r\nList.prototype.extractFirst = function () {\r\n\r\n\treturn this._array.shift ();\r\n}\r\n\r\n/**\r\n *  Extract last entry. This method changes the length of the list.\t\r\n * @return {object}\r\n */\r\nList.prototype.extractLast = function () {\r\n\r\n\treturn this._array.pop ();\r\n}\r\n\r\n/**\r\n * Get first entry.\r\n */\r\nList.prototype.getFirst = function () {\r\n\t\r\n\treturn this.get ( 0 );\r\n}\r\n\r\n/**\r\n * Get last entry.\r\n */\r\nList.prototype.getLast = function () {\r\n\t\r\n\treturn this.get ( this.getLength () - 1 );\r\n}\r\n\r\n/**\r\n * Amazing.\r\n */\r\nList.prototype.toString = function () {\r\n\t// To avoid errors that popup in Firebug\r\n    if (typeof this._array === 'undefined') {\r\n        return null;\r\n    }\r\n\r\n\treturn this._array.toString ();\r\n}\r\n\r\n/**\r\n * @return {array}\r\n */\r\nList.prototype.toArray = function () {\r\n\t\r\n\treturn this._array.concat ([]);\r\n}\r\n\r\n/**\r\n * Add all entries from another list.\r\n * @param {List} list\r\n * @return {List}\r\n */\r\nList.prototype.merge = function ( list ) {\r\n\r\n\tlist.reset ();\r\n\twhile ( list.hasNext ()) {\r\n\t\tthis.add ( list.getNext ());\r\n\t}\r\n\treturn this;\r\n}\r\n\r\n/**\r\n * Dispose.\r\n */\r\nList.prototype.dispose = function () {\r\n\t\r\n\tvar i = this._array.length - 1;\r\n\twhile ( i >= 0 ) {\r\n\t\tthis._array [ i-- ] = null;\r\n\t}\r\n\tthis._array = null;\r\n\tthis._index = null;\r\n\tthis._isDisposed = true;\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/util/LocalStorage.js",
    "content": "﻿/**\n * Local Storage Util\n */\nfunction _LocalStorage() { }\n\n_LocalStorage.prototype = {\n\n\tset: function (key, data) {\n\t\tif (!window.localStorage || !window.JSON || !key) {\n\t\t\treturn;\n\t\t}\n\t\tlocalStorage.setItem(key, JSON.stringify(data));\n\t},\n\n\tget: function (key) {\n\t\tif (!window.localStorage || !window.JSON || !key) {\n\t\t\treturn undefined;\n\t\t}\n\t\tvar item = localStorage.getItem(key);\n\n\t\tif (!item) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn JSON.parse(item);\n\t},\n\n\tremove: function (key) {\n\t\tif (!window.localStorage || !window.JSON || !key) {\n\t\t\treturn;\n\t\t}\n\t\tlocalStorage.removeItem(key);\n\t},\n\n\t//Obsolute\n\tstore_data: function(data, key) { this.set(key, data) },\n\t//Obsolute\n\tget_data: function (key) { return this.get(key)},\n\t//Obsolute\n\tremove_data: function(key) { this.remove(key)}\n\n}\n\n/**\n * The instance that does it.\n * @type {_LocalStorge}\n */\nvar LocalStorage = new _LocalStorage();"
  },
  {
    "path": "Website/Composite/scripts/source/top/util/Map.js",
    "content": "/**\r\n * @class\r\n * @param @optional {Hashmap} map\r\n */\r\nfunction Map ( map ) {\r\n\r\n\t/**\r\n\t * @type {HashMap<object><object>\r\n\t */\r\n\tthis._map = {};\r\n\r\n\t/*\r\n\t * Populate from optional constructor object.\r\n\t */\r\n\tif ( map != null ) {\r\n\t\tfor ( var key in map ) {\r\n\t\t\tthis.set ( key, map [ key ]);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nMap.prototype._map = {};\r\n\r\n/**\r\n * Get entry. Notice that an invalid key will not be tolerated\r\n * here. Always use method \"has\" to check for key existance first.\r\n * @param {object} key\r\n */\r\nMap.prototype.get = function ( key ) {\r\n\r\n\tvar result = null;\r\n\tif ( this.has ( key )) {\r\n\t\tresult = this._map [ key ];\r\n\t} else {\r\n\t\tvar cry = \"Map: Invalid key: \" + key;\r\n\t\tSystemLogger.getLogger ( \"Map\" ).error ( cry );\r\n\t\tSystemDebug.stack ( arguments );\r\n\t\tif ( Application.isDeveloperMode ) {\r\n\t\t\tconsole.log(cry);\r\n\t\t\tconsole.log(arguments);\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set entry.\r\n * @param {object} key\r\n * @param {object} value\r\n */\r\nMap.prototype.set = function ( key, value ) {\r\n\r\n\tthis._map [ key ] = value;\r\n}\r\n\r\n/**\r\n * Delete entry.\r\n * @param {object} key\r\n */\r\nMap.prototype.del = function ( key ) {\r\n\r\n\tdelete this._map [ key ];\r\n}\r\n\r\n/**\r\n * Has entry?\r\n * @param {object} key\r\n * @return {boolean}\r\n */\r\nMap.prototype.has = function ( key ) {\r\n\r\n\treturn typeof this._map [ key ] != \"undefined\";\r\n}\r\n\r\n/**\r\n * Each entry.\r\n * @param {function} action\r\n */\r\nMap.prototype.each = function ( action, thisp ) {\r\n\r\n\tfor ( var key in this._map ) {\r\n\t\tvar isContinue = action.call ( thisp,\r\n\t\t\tkey,\r\n\t\t\tthis._map [ key ]\r\n\t\t);\r\n\t\tif ( isContinue == false ) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Has entries?\r\n * @retun {boolean}\r\n */\r\nMap.prototype.hasEntries = function () {\r\n\r\n\tvar result = false;\r\n\tfor ( var key in this._map ) {\r\n\t\tresult = true;\r\n\t\tbreak;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * How many entries?\r\n * @retun {int}\r\n */\r\nMap.prototype.countEntries = function () {\r\n\r\n\tvar result = 0;\r\n\tfor ( var key in this._map ) {\r\n\t\tresult ++;\r\n\t}\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Convert to list (listing keys or values).\r\n * @param {boolean} isKey\r\n */\r\nMap.prototype.toList = function ( isKey ) {\r\n\r\n\tvar list = new List ();\r\n\tfor ( var key in this._map ) {\r\n\t\tlist.add (\r\n\t\t\tisKey ? key : this._map [ key ]\r\n\t\t);\r\n\t}\r\n\treturn list;\r\n}\r\n\r\n/**\r\n * Copy.\r\n * @return {Map}\r\n */\r\nMap.prototype.copy = function () {\r\n\r\n\tvar map = new Map ();\r\n\tfor ( var key in this._map ) {\r\n\t\tmap.set ( key, this._map [ key ]);\r\n\t}\r\n\treturn map;\r\n}\r\n\r\n/**\r\n * This will modify the original Map.\r\n * @return {Map}\r\n */\r\nMap.prototype.inverse = function () {\r\n\r\n\tvar map = new Map ();\r\n\tfor ( var key in this._map ) {\r\n\t\tmap.set ( this._map [ key ], key );\r\n\t}\r\n\treturn map;\r\n}\r\n\r\n/**\r\n * Empty map.\r\n */\r\nMap.prototype.empty = function () {\r\n\r\n\tfor ( var key in this._map ) {\r\n\t\tdelete this._map [ key ];\r\n\t}\r\n}\r\n\r\n/**\r\n * Dispose.\r\n * TODO: Invoke \"dispose\" on entries?\r\n */\r\nMap.prototype.dispose = function () {\r\n\r\n\tfor ( var key in this._map ) {\r\n\t\tthis._map [ key ] = null;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/scripts/source/top/util/SystemNodeList.js",
    "content": "/**\r\n * @class\r\n * SystemNode list\r\n * Save handlers\r\n */\r\nfunction SystemNodeList() {\r\n\r\n\tthis._entityTokens = new List([]);\r\n\treturn this;\r\n}\r\n\r\n/**\r\n* Clear nodes.\r\n*/\r\nSystemNodeList.prototype.clear = function () {\r\n\tthis._entityTokens.clear();\r\n};\r\n\r\n/**\r\n* Add node\r\n* @param {SystenNode} node\r\n*/\r\nSystemNodeList.prototype.add = function (node) {\r\n\tif (node.getEntityToken) {\r\n\t\tvar entityToken = node.getEntityToken();\r\n\t\tthis._entityTokens.add(entityToken);\r\n\t}\r\n};\r\n\r\n/**\r\n* Does list contain SystemNode?\r\n* @param {string} key\r\n*/\r\nSystemNodeList.prototype.has = function (node) {\r\n\tif (node.getEntityToken) {\r\n\t\tvar entityToken = node.getEntityToken();\r\n\t\treturn this._entityTokens.has(entityToken);\r\n\t}\r\n\treturn false;\r\n};\r\n\r\n/**\r\n* Return entityTokens\r\n*/\r\nSystemNodeList.prototype.getEntityTokens = function () {\r\n\treturn this._entityTokens.copy();\r\n};\r\n"
  },
  {
    "path": "Website/Composite/services/Admin/DownloadFile.ashx",
    "content": "<%@ WebHandler Language=\"C#\" Class=\"DownloadFile\" %>\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Runtime.Versioning;\r\nusing System.Runtime.InteropServices;\r\nusing System.Web;\r\nusing Composite;\r\nusing Composite.Core.IO;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider;\r\n\r\n\r\npublic class DownloadFile : IHttpHandler\r\n{\r\n    public void ProcessRequest(HttpContext context)\r\n    {\r\n        bool actionAllowed = false;\r\n\r\n        string fullFilePath = null;\r\n        bool isPreview = false;\r\n\r\n        if(UserValidationFacade.IsLoggedIn())\r\n        {\r\n            string file = context.Request.QueryString[\"file\"];\r\n            string providerName = context.Request.QueryString[\"provider\"];\r\n            isPreview = context.Request.QueryString[\"preview\"] == \"true\";\r\n\r\n\r\n            if (file.IsNullOrEmpty() || providerName.IsNullOrEmpty())\r\n            {\r\n                SetResponseCode(context, /* Bad request */ 400);\r\n                return;\r\n            }\r\n\r\n            string basePath = Path.GetDirectoryName(PathUtil.BaseDirectory);\r\n\r\n            fullFilePath = basePath + file;\r\n\r\n            var fileEntityToken = new WebsiteFileElementProviderEntityToken(providerName, fullFilePath, basePath);\r\n\r\n            actionAllowed = UserHasRightToDownload(fileEntityToken);\r\n        }\r\n\r\n        if(!actionAllowed)\r\n        {\r\n            SetResponseCode(context, /* Forbidden */ 403);\r\n            return;\r\n        }\r\n\r\n        context.Response.Cache.SetExpires(DateTime.Now.AddYears(-1));\r\n\r\n        Verify.IsNotNull(fullFilePath, \"Unexpected exception\");\r\n\r\n        if (isPreview)\r\n        {\r\n            var fileInfo = new FileInfo(fullFilePath);\r\n            string mimeType = MimeTypeInfo.GetCanonicalFromExtension(fileInfo.Extension);\r\n\r\n            if (!MimeTypeInfo.IsBrowserPreviewableFile(mimeType))\r\n            {\r\n                if (fileInfo.Extension.Equals(\".dll\", StringComparison.OrdinalIgnoreCase))\r\n                {\r\n                    OutputDllPreviewInformation(context, fullFilePath);\r\n                    return;\r\n                }\r\n\r\n                if (!MimeTypeInfo.IsTextFile(mimeType))\r\n                {\r\n                    return;\r\n                }\r\n\r\n                if (fileInfo.Length < 100*1024 && mimeType != \"text/plain\")\r\n                {\r\n                    PreviewWithCodeHighlight(context, fullFilePath);\r\n                    return;\r\n                }\r\n\r\n                mimeType = \"text/plain\";\r\n            }\r\n\r\n            context.Response.ContentType = mimeType;\r\n        }\r\n        else\r\n        {\r\n            string fileName = HttpUtility.UrlEncode(Path.GetFileName(fullFilePath));\r\n            context.Response.AddHeader(\"Content-Disposition\", \"attachment;filename=\" + fileName);\r\n        }\r\n\r\n        context.Response.TransmitFile(fullFilePath);\r\n        context.ApplicationInstance.CompleteRequest();\r\n    }\r\n\r\n    private void OutputDllPreviewInformation(HttpContext context, string fullFilePath)\r\n    {\r\n        FileVersionInfo fileVersion = null;\r\n        try\r\n        {\r\n            fileVersion = FileVersionInfo.GetVersionInfo(fullFilePath);\r\n        }\r\n        catch(Exception)\r\n        {\r\n        }\r\n\r\n        var assemblyInfo = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(asm =>\r\n        {\r\n            try\r\n            {\r\n                return !asm.IsDynamic\r\n                       && !string.IsNullOrEmpty(asm.CodeBase)\r\n                       && (\"file:///\" + fullFilePath).Replace(\"\\\\\", \"/\")\r\n                          .Equals(asm.CodeBase, StringComparison.InvariantCultureIgnoreCase);\r\n            }\r\n            catch\r\n            {\r\n                return false;\r\n            }\r\n        });\r\n\r\n        var fileInfo = new FileInfo(fullFilePath);\r\n\r\n        var lines = new List<string>();\r\n\r\n        if (assemblyInfo != null)\r\n        {\r\n            var attributes = assemblyInfo.CustomAttributes;\r\n\r\n            lines.AddRange(new []\r\n            {\r\n                \"--------- Version and metadata ---------\",\r\n                \"\",\r\n                \"Assembly Name       : \" + assemblyInfo.GetName().Name,\r\n                \"Version             : \" + assemblyInfo.GetName().Version,\r\n                \"Is Debug Dll        : \" + attributes.Any(\r\n                    a => a.AttributeType == typeof(DebuggableAttribute)\r\n                         && a.ConstructorArguments.Any(\r\n                             attr => attr.ArgumentType == typeof(DebuggableAttribute.DebuggingModes)\r\n                                     && ((DebuggableAttribute.DebuggingModes)attr.Value & DebuggableAttribute.DebuggingModes.DisableOptimizations) > 0)\r\n                ),\r\n                \"ImageRuntimeVersion : \" + assemblyInfo.ImageRuntimeVersion,\r\n                \"Full Name           : \" + assemblyInfo.FullName\r\n            });\r\n\r\n            var guidAttribute = attributes.FirstOrDefault(attr => attr.AttributeType == typeof(GuidAttribute));\r\n            if (guidAttribute != null)\r\n            {\r\n                lines.Add(\"Guid                : \" + (string) guidAttribute.ConstructorArguments.First().Value);\r\n            }\r\n\r\n            var targetFrameworkAttr = attributes.FirstOrDefault(attr => attr.AttributeType == typeof(TargetFrameworkAttribute));\r\n            if (targetFrameworkAttr != null)\r\n            {\r\n                lines.Add(\"Target Framework    : \" + (string) targetFrameworkAttr.ConstructorArguments.First().Value);\r\n            }\r\n        }\r\n        else\r\n        {\r\n            lines.Add(\"The dll file is not loaded in the current AppDomain or is not a managed assembly\");\r\n        }\r\n\r\n        lines.Add(\"\");\r\n        lines.Add(\"------------- File version -------------\");\r\n        lines.Add(\"\");\r\n\r\n        if (fileVersion != null)\r\n        {\r\n            if (!string.IsNullOrWhiteSpace(fileVersion.ProductName))\r\n            {\r\n                lines.Add(\"Product Name        : \" + fileVersion.ProductName);\r\n            }\r\n\r\n            if (!string.IsNullOrWhiteSpace(fileVersion.CompanyName))\r\n            {\r\n                lines.Add(\"Company Name        : \" + fileVersion.CompanyName);\r\n            }\r\n\r\n            lines.AddRange(new[]\r\n            {\r\n                \"Product Version     : \" + fileVersion.ProductVersion,\r\n                \"File    Version     : \" + fileVersion.FileVersion\r\n            });\r\n\r\n            if (!string.IsNullOrWhiteSpace(fileVersion.Comments))\r\n            {\r\n                lines.Add(\"\");\r\n                lines.Add(fileVersion.Comments);\r\n            }\r\n        }\r\n        else\r\n        {\r\n            lines.Add(\"Failed to get extract FileVersionInfo\");\r\n        }\r\n\r\n\r\n        lines.AddRange(new[]\r\n        {\r\n            \"\",\r\n            \"----------------------------------------\",\r\n            \"\",\r\n            \"Last Modified       : \" + fileInfo.LastWriteTime.ToString(\"O\"),\r\n            \"Last Modified, UTC  : \" + fileInfo.LastWriteTimeUtc.ToString(\"O\"),\r\n            \"Creation Time       : \" + fileInfo.CreationTime.ToString(\"O\"),\r\n            \"Creation Time, UTC  : \" + fileInfo.CreationTimeUtc.ToString(\"O\")\r\n        });\r\n\r\n\r\n\r\n        var text = string.Join(Environment.NewLine, lines);\r\n\r\n        context.Response.ContentType = \"text/plain\";\r\n        context.Response.Write(text);\r\n    }\r\n\r\n    private void PreviewWithCodeHighlight(HttpContext context, string fullFilePath)\r\n    {\r\n        context.Response.ContentType = \"text/html\";\r\n        context.Response.Write(@\"\r\n<html>\r\n <head>\r\n  <link rel=\"\"stylesheet\"\" href=\"\"highlightjs/vs.css\"\" />\r\n  <script src=\"\"highlightjs/highlight.pack.js\"\"></script>\r\n  <script>hljs.initHighlightingOnLoad();</script>\r\n </head>\r\n <body><pre><code style=\"\"overflow-x: inherit\"\">\");\r\n\r\n        var lines = File.ReadAllLines(fullFilePath);\r\n        foreach (var line in lines)\r\n        {\r\n            context.Response.Write(context.Server.HtmlEncode(line));\r\n            context.Response.Write(Environment.NewLine);\r\n        }\r\n\r\n        context.Response.Write(@\"</body></pre></code></html>\");}\r\n\r\n\r\n    private bool UserHasRightToDownload(EntityToken file)\r\n    {\r\n        var userToken = UserValidationFacade.GetUserToken();\r\n        var userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username);\r\n        var userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username);\r\n\r\n        var requiredPermissions = new [] { PermissionType.Administrate, PermissionType.Edit };\r\n        return SecurityResolver.Resolve(userToken, requiredPermissions, file, userPermissionDefinitions, userGroupPermissionDefinitions)\r\n               == SecurityResult.Allowed;\r\n    }\r\n\r\n    private void SetResponseCode(HttpContext context, int responseCode)\r\n    {\r\n        context.Response.StatusCode = responseCode;\r\n        context.ApplicationInstance.CompleteRequest();\r\n    }\r\n\r\n    public bool IsReusable\r\n    {\r\n        get { return true; }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/Admin/HighlightJs/LICENSE",
    "content": "Copyright (c) 2006, Ivan Sagalaev\nAll rights reserved.\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the name of highlight.js nor the names of its contributors \n      may be used to endorse or promote products derived from this software \n      without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "Website/Composite/services/Admin/HighlightJs/highlight.pack.js",
    "content": "/*! highlight.js v9.12.0 | BSD3 License | git.io/hljslicense */\n!function(e){var n=\"object\"==typeof window&&window||\"object\"==typeof self&&self;\"undefined\"!=typeof exports?e(exports):n&&(n.hljs=e({}),\"function\"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+\" \";if(o+=e.parentNode?e.parentNode.className:\"\",t=B.exec(o))return w(t[1])?t[1]:\"no-highlight\";for(o=o.split(/\\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:\"start\",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:\"stop\",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset<r[0].offset?e:r:\"start\"===r[0].event?e:r:e.length?e:r}function o(e){function r(e){return\" \"+e.nodeName+'=\"'+n(e.value).replace('\"',\"&quot;\")+'\"'}s+=\"<\"+t(e)+E.map.call(e.attributes,r).join(\"\")+\">\"}function u(e){s+=\"</\"+t(e)+\">\"}function c(e){(\"start\"===e.event?o:u)(e.node)}for(var l=0,s=\"\",f=[];e.length||r.length;){var g=i();if(s+=n(a.substring(l,g[0].offset)),l=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===l);f.reverse().forEach(o)}else\"start\"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return s+n(a.substr(l))}function l(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),\"m\"+(e.cI?\"i\":\"\")+(r?\"g\":\"\"))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},u=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(\" \").forEach(function(e){var t=e.split(\"|\");o[t[0]]=[n,t[1]?Number(t[1]):1]})};\"string\"==typeof a.k?u(\"keyword\",a.k):x(a.k).forEach(function(e){u(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\\w+/,!0),i&&(a.bK&&(a.b=\"\\\\b(\"+a.bK.split(\" \").join(\"|\")+\")\\\\b\"),a.b||(a.b=/\\B|\\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\\B|\\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||\"\",a.eW&&i.tE&&(a.tE+=(a.e?\"|\":\"\")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return l(\"self\"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var c=a.c.map(function(e){return e.bK?\"\\\\.?(\"+e.b+\")\\\\.?\":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=c.length?t(c.join(\"|\"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function l(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?\"\":I.classPrefix,i='<span class=\"'+a,o=t?\"\":C;return i+=e+'\">',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a=\"\",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=l(E,r),e?(B+=e[1],a+=p(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function d(){var e=\"string\"==typeof E.sL;if(e&&!y[E.sL])return n(k);var t=e?f(E.sL,k,!0,x[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(B+=t.r),e&&(x[E.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=null!=E.sL?d():h(),k=\"\"}function v(e){L+=e.cN?p(e.cN,\"\",!0):\"\",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(k+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),b(),t.rB||t.eB||(k=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),b(),a.eE&&(k=n));do E.cN&&(L+=C),E.skip||(B+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,\"\"),a.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme \"'+n+'\" for mode \"'+(E.cN||\"<unnamed>\")+'\"');return k+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: \"'+e+'\"');s(N);var R,E=i||N,x={},L=\"\";for(R=E;R!==N;R=R.parent)R.cN&&(L=p(R.cN,\"\",!0)+L);var k=\"\",B=0;try{for(var M,j,O=0;;){if(E.t.lastIndex=O,M=E.t.exec(t),!M)break;j=m(t.substring(O,M.index),M[0]),O=M.index+j}for(m(t.substr(O)),R=E;R.parent;R=R.parent)R.cN&&(L+=C);return{r:B,value:L,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf(\"Illegal\"))return{r:0,value:n(t)};throw T}}function g(e,t){t=t||I.languages||x(y);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function p(e){return I.tabReplace||I.useBR?e.replace(M,function(e,n){return I.useBR&&\"\\n\"===e?\"<br>\":I.tabReplace?n.replace(/\\t/g,I.tabReplace):\"\"}):e}function h(e,n,t){var r=n?L[n]:t,a=[e.trim()];return e.match(/\\bhljs\\b/)||a.push(\"hljs\"),-1===e.indexOf(r)&&a.push(r),a.join(\" \").trim()}function d(e){var n,t,r,o,l,s=i(e);a(s)||(I.useBR?(n=document.createElementNS(\"http://www.w3.org/1999/xhtml\",\"div\"),n.innerHTML=e.innerHTML.replace(/\\n/g,\"\").replace(/<br[ \\/]*>/g,\"\\n\")):n=e,l=n.textContent,r=s?f(s,l,!0):g(l),t=u(n),t.length&&(o=document.createElementNS(\"http://www.w3.org/1999/xhtml\",\"div\"),o.innerHTML=r.value,r.value=c(t,u(o),l)),r.value=p(r.value),e.innerHTML=r.value,e.className=h(e.className,s,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function b(e){I=o(I,e)}function v(){if(!v.called){v.called=!0;var e=document.querySelectorAll(\"pre code\");E.forEach.call(e,d)}}function m(){addEventListener(\"DOMContentLoaded\",v,!1),addEventListener(\"load\",v,!1)}function N(n,t){var r=y[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function R(){return x(y)}function w(e){return e=(e||\"\").toLowerCase(),y[e]||y[L[e]]}var E=[],x=Object.keys,y={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\\blang(?:uage)?-([\\w-]+)\\b/i,M=/((^(<[^>]+>|\\t|)+|(?:\\n)))/gm,C=\"</span>\",I={classPrefix:\"hljs-\",tabReplace:null,useBR:!1,languages:void 0};return e.highlight=f,e.highlightAuto=g,e.fixMarkup=p,e.highlightBlock=d,e.configure=b,e.initHighlighting=v,e.initHighlightingOnLoad=m,e.registerLanguage=N,e.listLanguages=R,e.getLanguage=w,e.inherit=o,e.IR=\"[a-zA-Z]\\\\w*\",e.UIR=\"[a-zA-Z_]\\\\w*\",e.NR=\"\\\\b\\\\d+(\\\\.\\\\d+)?\",e.CNR=\"(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)\",e.BNR=\"\\\\b(0b[01]+)\",e.RSR=\"!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~\",e.BE={b:\"\\\\\\\\[\\\\s\\\\S]\",r:0},e.ASM={cN:\"string\",b:\"'\",e:\"'\",i:\"\\\\n\",c:[e.BE]},e.QSM={cN:\"string\",b:'\"',e:'\"',i:\"\\\\n\",c:[e.BE]},e.PWM={b:/\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/},e.C=function(n,t,r){var a=e.inherit({cN:\"comment\",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:\"doctag\",b:\"(?:TODO|FIXME|NOTE|BUG|XXX):\",r:0}),a},e.CLCM=e.C(\"//\",\"$\"),e.CBCM=e.C(\"/\\\\*\",\"\\\\*/\"),e.HCM=e.C(\"#\",\"$\"),e.NM={cN:\"number\",b:e.NR,r:0},e.CNM={cN:\"number\",b:e.CNR,r:0},e.BNM={cN:\"number\",b:e.BNR,r:0},e.CSSNM={cN:\"number\",b:e.NR+\"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\",r:0},e.RM={cN:\"regexp\",b:/\\//,e:/\\/[gimuy]*/,i:/\\n/,c:[e.BE,{b:/\\[/,e:/\\]/,r:0,c:[e.BE]}]},e.TM={cN:\"title\",b:e.IR,r:0},e.UTM={cN:\"title\",b:e.UIR,r:0},e.METHOD_GUARD={b:\"\\\\.\\\\s*\"+e.UIR,r:0},e});hljs.registerLanguage(\"cs\",function(e){var i={keyword:\"abstract as base bool break byte case catch char checked const continue decimal default delegate do double enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long nameof object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield\",literal:\"null false true\"},t={cN:\"string\",b:'@\"',e:'\"',c:[{b:'\"\"'}]},r=e.inherit(t,{i:/\\n/}),a={cN:\"subst\",b:\"{\",e:\"}\",k:i},c=e.inherit(a,{i:/\\n/}),n={cN:\"string\",b:/\\$\"/,e:'\"',i:/\\n/,c:[{b:\"{{\"},{b:\"}}\"},e.BE,c]},s={cN:\"string\",b:/\\$@\"/,e:'\"',c:[{b:\"{{\"},{b:\"}}\"},{b:'\"\"'},a]},o=e.inherit(s,{i:/\\n/,c:[{b:\"{{\"},{b:\"}}\"},{b:'\"\"'},c]});a.c=[s,n,t,e.ASM,e.QSM,e.CNM,e.CBCM],c.c=[o,n,r,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\\n/})];var l={v:[s,n,t,e.ASM,e.QSM]},b=e.IR+\"(<\"+e.IR+\"(\\\\s*,\\\\s*\"+e.IR+\")*>)?(\\\\[\\\\])?\";return{aliases:[\"csharp\"],k:i,i:/::/,c:[e.C(\"///\",\"$\",{rB:!0,c:[{cN:\"doctag\",v:[{b:\"///\",r:0},{b:\"<!--|-->\"},{b:\"</?\",e:\">\"}]}]}),e.CLCM,e.CBCM,{cN:\"meta\",b:\"#\",e:\"$\",k:{\"meta-keyword\":\"if else elif endif define undef warning error line region endregion pragma checksum\"}},l,e.CNM,{bK:\"class interface\",e:/[{;=]/,i:/[^\\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:\"namespace\",e:/[{;=]/,i:/[^\\s:]/,c:[e.inherit(e.TM,{b:\"[a-zA-Z](\\\\.?\\\\w)*\"}),e.CLCM,e.CBCM]},{cN:\"meta\",b:\"^\\\\s*\\\\[\",eB:!0,e:\"\\\\]\",eE:!0,c:[{cN:\"meta-string\",b:/\"/,e:/\"/}]},{bK:\"new return throw await else\",r:0},{cN:\"function\",b:\"(\"+b+\"\\\\s+)+\"+e.IR+\"\\\\s*\\\\(\",rB:!0,e:/[{;=]/,eE:!0,k:i,c:[{b:e.IR+\"\\\\s*\\\\(\",rB:!0,c:[e.TM],r:0},{cN:\"params\",b:/\\(/,e:/\\)/,eB:!0,eE:!0,k:i,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage(\"http\",function(e){var t=\"HTTP/[0-9\\\\.]+\";return{aliases:[\"https\"],i:\"\\\\S\",c:[{b:\"^\"+t,e:\"$\",c:[{cN:\"number\",b:\"\\\\b\\\\d{3}\\\\b\"}]},{b:\"^[A-Z]+ (.*?) \"+t+\"$\",rB:!0,e:\"$\",c:[{cN:\"string\",b:\" \",e:\" \",eB:!0,eE:!0},{b:t},{cN:\"keyword\",b:\"[A-Z]+\"}]},{cN:\"attribute\",b:\"^\\\\w\",e:\": \",eE:!0,i:\"\\\\n|\\\\s|=\",starts:{e:\"$\",r:0}},{b:\"\\\\n\\\\n\",starts:{sL:[],eW:!0}}]}});hljs.registerLanguage(\"typescript\",function(e){var r={keyword:\"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class public private protected get set super static implements enum export import declare type namespace abstract as from extends async await\",literal:\"true false null undefined NaN Infinity\",built_in:\"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document any number boolean string void Promise\"};return{aliases:[\"ts\"],k:r,c:[{cN:\"meta\",b:/^\\s*['\"]use strict['\"]/},e.ASM,e.QSM,{cN:\"string\",b:\"`\",e:\"`\",c:[e.BE,{cN:\"subst\",b:\"\\\\$\\\\{\",e:\"\\\\}\"}]},e.CLCM,e.CBCM,{cN:\"number\",v:[{b:\"\\\\b(0[bB][01]+)\"},{b:\"\\\\b(0[oO][0-7]+)\"},{b:e.CNR}],r:0},{b:\"(\"+e.RSR+\"|\\\\b(case|return|throw)\\\\b)\\\\s*\",k:\"return throw case\",c:[e.CLCM,e.CBCM,e.RM,{cN:\"function\",b:\"(\\\\(.*?\\\\)|\"+e.IR+\")\\\\s*=>\",rB:!0,e:\"\\\\s*=>\",c:[{cN:\"params\",v:[{b:e.IR},{b:/\\(\\s*\\)/},{b:/\\(/,e:/\\)/,eB:!0,eE:!0,k:r,c:[\"self\",e.CLCM,e.CBCM]}]}]}],r:0},{cN:\"function\",b:\"function\",e:/[\\{;]/,eE:!0,k:r,c:[\"self\",e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:\"params\",b:/\\(/,e:/\\)/,eB:!0,eE:!0,k:r,c:[e.CLCM,e.CBCM],i:/[\"'\\(]/}],i:/%/,r:0},{bK:\"constructor\",e:/\\{/,eE:!0,c:[\"self\",{cN:\"params\",b:/\\(/,e:/\\)/,eB:!0,eE:!0,k:r,c:[e.CLCM,e.CBCM],i:/[\"'\\(]/}]},{b:/module\\./,k:{built_in:\"module\"},r:0},{bK:\"module\",e:/\\{/,eE:!0},{bK:\"interface\",e:/\\{/,eE:!0,k:\"interface extends\"},{b:/\\$[(.]/},{b:\"\\\\.\"+e.IR,r:0},{cN:\"meta\",b:\"@[A-Za-z]+\"}]}});hljs.registerLanguage(\"xml\",function(s){var e=\"[A-Za-z0-9\\\\._:-]+\",t={eW:!0,i:/</,r:0,c:[{cN:\"attr\",b:e,r:0},{b:/=\\s*/,r:0,c:[{cN:\"string\",endsParent:!0,v:[{b:/\"/,e:/\"/},{b:/'/,e:/'/},{b:/[^\\s\"'=<>`]+/}]}]}]};return{aliases:[\"html\",\"xhtml\",\"rss\",\"atom\",\"xjb\",\"xsd\",\"xsl\",\"plist\"],cI:!0,c:[{cN:\"meta\",b:\"<!DOCTYPE\",e:\">\",r:10,c:[{b:\"\\\\[\",e:\"\\\\]\"}]},s.C(\"<!--\",\"-->\",{r:10}),{b:\"<\\\\!\\\\[CDATA\\\\[\",e:\"\\\\]\\\\]>\",r:10},{b:/<\\?(php)?/,e:/\\?>/,sL:\"php\",c:[{b:\"/\\\\*\",e:\"\\\\*/\",skip:!0}]},{cN:\"tag\",b:\"<style(?=\\\\s|>|$)\",e:\">\",k:{name:\"style\"},c:[t],starts:{e:\"</style>\",rE:!0,sL:[\"css\",\"xml\"]}},{cN:\"tag\",b:\"<script(?=\\\\s|>|$)\",e:\">\",k:{name:\"script\"},c:[t],starts:{e:\"</script>\",rE:!0,sL:[\"actionscript\",\"javascript\",\"handlebars\",\"xml\"]}},{cN:\"meta\",v:[{b:/<\\?xml/,e:/\\?>/,r:10},{b:/<\\?\\w+/,e:/\\?>/}]},{cN:\"tag\",b:\"</?\",e:\"/?>\",c:[{cN:\"name\",b:/[^\\/><\\s]+/,r:0},t]}]}});hljs.registerLanguage(\"markdown\",function(e){return{aliases:[\"md\",\"mkdown\",\"mkd\"],c:[{cN:\"section\",v:[{b:\"^#{1,6}\",e:\"$\"},{b:\"^.+?\\\\n[=-]{2,}$\"}]},{b:\"<\",e:\">\",sL:\"xml\",r:0},{cN:\"bullet\",b:\"^([*+-]|(\\\\d+\\\\.))\\\\s+\"},{cN:\"strong\",b:\"[*_]{2}.+?[*_]{2}\"},{cN:\"emphasis\",v:[{b:\"\\\\*.+?\\\\*\"},{b:\"_.+?_\",r:0}]},{cN:\"quote\",b:\"^>\\\\s+\",e:\"$\"},{cN:\"code\",v:[{b:\"^```w*s*$\",e:\"^```s*$\"},{b:\"`.+?`\"},{b:\"^( {4}|\t)\",e:\"$\",r:0}]},{b:\"^[-\\\\*]{3,}\",e:\"$\"},{b:\"\\\\[.+?\\\\][\\\\(\\\\[].*?[\\\\)\\\\]]\",rB:!0,c:[{cN:\"string\",b:\"\\\\[\",e:\"\\\\]\",eB:!0,rE:!0,r:0},{cN:\"link\",b:\"\\\\]\\\\(\",e:\"\\\\)\",eB:!0,eE:!0},{cN:\"symbol\",b:\"\\\\]\\\\[\",e:\"\\\\]\",eB:!0,eE:!0}],r:10},{b:/^\\[[^\\n]+\\]:/,rB:!0,c:[{cN:\"symbol\",b:/\\[/,e:/\\]/,eB:!0,eE:!0},{cN:\"link\",b:/:\\s*/,e:/$/,eB:!0}]}]}});hljs.registerLanguage(\"javascript\",function(e){var r=\"[A-Za-z$_][0-9A-Za-z$_]*\",t={keyword:\"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as\",literal:\"true false null undefined NaN Infinity\",built_in:\"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise\"},a={cN:\"number\",v:[{b:\"\\\\b(0[bB][01]+)\"},{b:\"\\\\b(0[oO][0-7]+)\"},{b:e.CNR}],r:0},n={cN:\"subst\",b:\"\\\\$\\\\{\",e:\"\\\\}\",k:t,c:[]},c={cN:\"string\",b:\"`\",e:\"`\",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:[\"js\",\"jsx\"],k:t,c:[{cN:\"meta\",r:10,b:/^\\s*['\"]use (strict|asm)['\"]/},{cN:\"meta\",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\\s*/,r:0,c:[{b:r+\"\\\\s*:\",rB:!0,r:0,c:[{cN:\"attr\",b:r,r:0}]}]},{b:\"(\"+e.RSR+\"|\\\\b(case|return|throw)\\\\b)\\\\s*\",k:\"return throw case\",c:[e.CLCM,e.CBCM,e.RM,{cN:\"function\",b:\"(\\\\(.*?\\\\)|\"+r+\")\\\\s*=>\",rB:!0,e:\"\\\\s*=>\",c:[{cN:\"params\",v:[{b:r},{b:/\\(\\s*\\)/},{b:/\\(/,e:/\\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b:/</,e:/(\\/\\w+|\\w+\\/)>/,sL:\"xml\",c:[{b:/<\\w+\\s*\\/>/,skip:!0},{b:/<\\w+/,e:/(\\/\\w+|\\w+\\/)>/,skip:!0,c:[{b:/<\\w+\\s*\\/>/,skip:!0},\"self\"]}]}],r:0},{cN:\"function\",bK:\"function\",e:/\\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:\"params\",b:/\\(/,e:/\\)/,eB:!0,eE:!0,c:s}],i:/\\[|%/},{b:/\\$[(.]/},e.METHOD_GUARD,{cN:\"class\",bK:\"class\",e:/[{;=]/,eE:!0,i:/[:\"\\[\\]]/,c:[{bK:\"extends\"},e.UTM]},{bK:\"constructor\",e:/\\{/,eE:!0}],i:/#(?!!)/}});hljs.registerLanguage(\"css\",function(e){var c=\"[a-zA-Z-][a-zA-Z0-9_-]*\",t={b:/[A-Z\\_\\.\\-]+\\s*:/,rB:!0,e:\";\",eW:!0,c:[{cN:\"attribute\",b:/\\S/,e:\":\",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\\w-]+\\(/,rB:!0,c:[{cN:\"built_in\",b:/[\\w-]+/},{b:/\\(/,e:/\\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:\"number\",b:\"#[0-9A-Fa-f]+\"},{cN:\"meta\",b:\"!important\"}]}}]};return{cI:!0,i:/[=\\/|'\\$]/,c:[e.CBCM,{cN:\"selector-id\",b:/#[A-Za-z0-9_-]+/},{cN:\"selector-class\",b:/\\.[A-Za-z0-9_-]+/},{cN:\"selector-attr\",b:/\\[/,e:/\\]/,i:\"$\"},{cN:\"selector-pseudo\",b:/:(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\"'.]+/},{b:\"@(font-face|page)\",l:\"[a-z-]+\",k:\"font-face page\"},{b:\"@\",e:\"[{;]\",i:/:/,c:[{cN:\"keyword\",b:/\\w+/},{b:/\\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:\"selector-tag\",b:c,r:0},{b:\"{\",e:\"}\",i:/\\S/,c:[e.CBCM,t]}]}});hljs.registerLanguage(\"json\",function(e){var i={literal:\"true false null\"},n=[e.QSM,e.CNM],r={e:\",\",eW:!0,eE:!0,c:n,k:i},t={b:\"{\",e:\"}\",c:[{cN:\"attr\",b:/\"/,e:/\"/,c:[e.BE],i:\"\\\\n\"},e.inherit(r,{b:/:/})],i:\"\\\\S\"},c={b:\"\\\\[\",e:\"\\\\]\",c:[e.inherit(r)],i:\"\\\\S\"};return n.splice(n.length,0,t,c),{c:n,k:i,i:\"\\\\S\"}});hljs.registerLanguage(\"less\",function(e){var r=\"[\\\\w-]+\",t=\"(\"+r+\"|@{\"+r+\"})\",a=[],c=[],s=function(e){return{cN:\"string\",b:\"~?\"+e+\".*?\"+e}},b=function(e,r,t){return{cN:e,b:r,r:t}},n={b:\"\\\\(\",e:\"\\\\)\",c:c,r:0};c.push(e.CLCM,e.CBCM,s(\"'\"),s('\"'),e.CSSNM,{b:\"(url|data-uri)\\\\(\",starts:{cN:\"string\",e:\"[\\\\)\\\\n]\",eE:!0}},b(\"number\",\"#[0-9A-Fa-f]+\\\\b\"),n,b(\"variable\",\"@@?\"+r,10),b(\"variable\",\"@{\"+r+\"}\"),b(\"built_in\",\"~?`[^`]*?`\"),{cN:\"attribute\",b:r+\"\\\\s*:\",e:\":\",rB:!0,eE:!0},{cN:\"meta\",b:\"!important\"});var i=c.concat({b:\"{\",e:\"}\",c:a}),o={bK:\"when\",eW:!0,c:[{bK:\"and not\"}].concat(c)},u={b:t+\"\\\\s*:\",rB:!0,e:\"[;}]\",r:0,c:[{cN:\"attribute\",b:t,e:\":\",eE:!0,starts:{eW:!0,i:\"[<=$]\",r:0,c:c}}]},l={cN:\"keyword\",b:\"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\\\b\",starts:{e:\"[;{}]\",rE:!0,c:c,r:0}},C={cN:\"variable\",v:[{b:\"@\"+r+\"\\\\s*:\",r:15},{b:\"@\"+r}],starts:{e:\"[;}]\",rE:!0,c:i}},p={v:[{b:\"[\\\\.#:&\\\\[>]\",e:\"[;{}]\"},{b:t,e:\"{\"}],rB:!0,rE:!0,i:\"[<='$\\\"]\",r:0,c:[e.CLCM,e.CBCM,o,b(\"keyword\",\"all\\\\b\"),b(\"variable\",\"@{\"+r+\"}\"),b(\"selector-tag\",t+\"%?\",0),b(\"selector-id\",\"#\"+t),b(\"selector-class\",\"\\\\.\"+t,0),b(\"selector-tag\",\"&\",0),{cN:\"selector-attr\",b:\"\\\\[\",e:\"\\\\]\"},{cN:\"selector-pseudo\",b:/:(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\"'.]+/},{b:\"\\\\(\",e:\"\\\\)\",c:i},{b:\"!important\"}]};return a.push(e.CLCM,e.CBCM,l,C,u,p),{cI:!0,i:\"[=>'/<($\\\"]\",c:a}});"
  },
  {
    "path": "Website/Composite/services/Admin/HighlightJs/readme.txt",
    "content": "Packaged with https://highlightjs.org/download/ with the following language options selected:\r\n\r\nHTML/XML,HTTP,CSS,LESS,JavaScript,JSON,TypeScript,C#,Markdown"
  },
  {
    "path": "Website/Composite/services/Admin/HighlightJs/vs.css",
    "content": "/*\n\nVisual Studio-like style based on original C# coloring by Jason Diamond <jason@diamond.name>\n\n*/\n.hljs {\n  display: block;\n  overflow-x: auto;\n  padding: 0.5em;\n  background: white;\n  color: black;\n}\n\n.hljs-comment,\n.hljs-quote,\n.hljs-variable {\n  color: #008000;\n}\n\n.hljs-keyword,\n.hljs-selector-tag,\n.hljs-built_in,\n.hljs-name,\n.hljs-tag {\n  color: #00f;\n}\n\n.hljs-string,\n.hljs-title,\n.hljs-section,\n.hljs-attribute,\n.hljs-literal,\n.hljs-template-tag,\n.hljs-template-variable,\n.hljs-type,\n.hljs-addition {\n  color: #a31515;\n}\n\n.hljs-deletion,\n.hljs-selector-attr,\n.hljs-selector-pseudo,\n.hljs-meta {\n  color: #2b91af;\n}\n\n.hljs-doctag {\n  color: #808080;\n}\n\n.hljs-attr {\n  color: #f00;\n}\n\n.hljs-symbol,\n.hljs-bullet,\n.hljs-link {\n  color: #00b0e8;\n}\n\n\n.hljs-emphasis {\n  font-style: italic;\n}\n\n.hljs-strong {\n  font-weight: bold;\n}\n"
  },
  {
    "path": "Website/Composite/services/Configuration/ConfigurationService.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" Class=\"Composite.Services.ConfigurationService\" %>\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.Linq;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml.Serialization;\r\n\r\nusing Composite.Core.Types;\r\nusing Composite.C1Console.Users;\r\n\r\nnamespace Composite.Services\r\n{\r\n\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    [XmlInclude(typeof(Composite.Core.WebClient.Services.TreeServiceObjects.ClientElement))]\r\n    public class ConfigurationService : WebService\r\n    {\r\n        public class ConfigurationElement\r\n        {\r\n            public string Key { get; set; }\r\n            public object Value { get; set; }\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        [XmlInclude(typeof(Composite.Core.WebClient.Services.TreeServiceObjects.ClientElement))]\r\n        public List<KeyValuePair> GetValidatingRegularExpressions(string dummyToPreventClientSoapBreak)\r\n        {\r\n            CultureInfo userCulture = UserSettings.CultureInfo;\r\n            string decimalSeparator = userCulture.NumberFormat.NumberDecimalSeparator;\r\n            string groupSeparator = userCulture.NumberFormat.NumberGroupSeparator;\r\n\r\n            List<KeyValuePair> regExExpressions = new List<KeyValuePair>\r\n        {\r\n\t        new KeyValuePair(\"number\", @\"^-?[0-9]+(\\\" + decimalSeparator + @\"[0-9]+)?$\"),\r\n\t        new KeyValuePair(\"integer\", @\"^-?[0-9]+$\"),\r\n\t        new KeyValuePair(\"currency\", @\"^[0-9]{1,3}(\\\" + groupSeparator + @\"[0-9]{3})*(\\\" + decimalSeparator + @\"[0-9]{1,2})?$\"),\r\n\t        new KeyValuePair(\"email\", @\"^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,})+$\"),\r\n\t        new KeyValuePair(\"string\", @\"[a-å]|[A-Å]|[0-9]\"),\r\n\t        new KeyValuePair(\"url\", @\"^#|~/|/|.:\"),\r\n\t        new KeyValuePair(\"programmingidentifier\", @\"^[a-zA-Z][a-zA-Z0-9_]*$\"),\r\n\t        new KeyValuePair(\"programmingnamespace\", @\"^[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)*$\"),\r\n\t        new KeyValuePair(\"guid\", @\"^(\\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\\}{0,1})$\")\r\n\r\n        };\r\n\r\n            return regExExpressions;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/ConsoleMessageQueue/ConsoleMessageQueueServices.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.ConsoleMessageQueueServices\" %>\r\n\r\nusing System;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing Composite.C1Console.Commands;\r\nusing Composite.Core;\r\nusing Composite.Core.WebClient.Services.ConsoleMessageService;\r\nusing Composite.C1Console.Events;\r\n\r\nnamespace Composite.Services\r\n{\r\n\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class ConsoleMessageQueueServices : WebService\r\n    {\r\n\r\n        [WebMethod]\r\n        public int GetCurrentSequenceNumber(string dummyToPreventClientSoapBreak)\r\n        {\r\n            return ConsoleMessageQueueFacade.CurrentChangeNumber;\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public GetMessagesResult GetMessages(string consoleId, int lastKnownChangeNumber)\r\n        {\r\n            return ConsoleMessageServiceFacade.GetNewMessages(consoleId, lastKnownChangeNumber);\r\n        }\r\n\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic bool PlaceConsoleCommand(string consoleId, string consoleCommand)\r\n\t\t{\r\n\t\t    int delimiterIndex = consoleCommand.IndexOf(';');\r\n\r\n\t\t    string commandName, payload;\r\n\r\n\t\t    if (delimiterIndex == -1)\r\n\t\t    {\r\n\t\t        commandName = consoleCommand;\r\n\t\t        payload = null;\r\n\t\t    }\r\n\t\t    else\r\n\t\t    {\r\n\t\t        commandName = consoleCommand.Substring(0, delimiterIndex);\r\n\t\t        payload = consoleCommand.Substring(delimiterIndex + 1);\r\n\t\t    }\r\n\r\n\t\t    try\r\n\t\t    {\r\n\t\t        ConsoleCommandFacade.HandleConsoleCommand(consoleId, commandName, payload);\r\n\t\t    }\r\n\t\t    catch (Exception ex)\r\n\t\t    {\r\n                Log.LogError(this.GetType().Name, \"Failed to parse/execute console command '{0}'\", consoleCommand);\r\n\t\t        Log.LogError(this.GetType().Name, ex);\r\n\t\t    }\r\n            \r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n}"
  },
  {
    "path": "Website/Composite/services/FlowController/FlowControllerServices.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.FlowControllerServices\" %>\r\n\r\nusing System;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing Composite.Core;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Actions;\r\n\r\nnamespace Composite.Services\r\n{\r\n\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class FlowControllerServices : System.Web.Services.WebService\r\n    {\r\n\r\n        [WebMethod]\r\n        public bool CancelFlow(string serializedFlowHandle)\r\n        {\r\n            FlowHandle flowHandle = FlowHandle.Deserialize(serializedFlowHandle);\r\n            try\r\n            {\r\n                FlowControllerFacade.CancelFlow(flowHandle.FlowToken);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(\"FlowControllerServices.CancelFlow\", ex);\r\n                return false;\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public bool ReleaseAllConsoleResources(string consoleId)\r\n        {\r\n            Verify.ArgumentNotNull(consoleId, \"consoleId\");\r\n\r\n            Log.LogVerbose(\"FlowControllerServices.asmx\", \"ReleaseAllConsoleResources for \" + consoleId);\r\n            ConsoleFacade.CloseConsole(consoleId);\r\n\r\n            return true;\r\n        }\r\n\r\n    }\r\n\r\n}"
  },
  {
    "path": "Website/Composite/services/Installation/InstallationService.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" Class=\"Composite.Services.Licensing\" %>\r\n\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Configuration;\r\n\r\nnamespace Composite.Services\r\n{\r\n\t[WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n\t[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n\tpublic class Licensing : System.Web.Services.WebService\r\n\t{\r\n\t\t[WebMethod]\r\n\t\tpublic bool Registered(bool dummy)\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic bool InvokeLicenseFetch(bool dummy)\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic KeyValuePair[] GetInstallationInfo(bool dummy)\r\n\t\t{\r\n\t\t\treturn new[]\r\n\t\t\t{\r\n\t\t\t\tnew KeyValuePair\r\n\t\t\t\t{\r\n\t\t\t\t\tKey = \"ApplicationName\",\r\n\t\t\t\t\tValue = GlobalSettingsFacade.ApplicationName\r\n\t\t\t\t},\r\n\t\t\t\tnew KeyValuePair\r\n\t\t\t\t{\r\n\t\t\t\t\tKey = \"ProductVersion\",\r\n\t\t\t\t\tValue = Composite.RuntimeInformation.BrandedProductVersion.ToString()\r\n\t\t\t\t},\r\n\t\t\t\tnew KeyValuePair\r\n\t\t\t\t{\r\n\t\t\t\t\tKey = \"ProductTitle\",\r\n\t\t\t\t\tValue = Composite.RuntimeInformation.ProductTitle\r\n},\r\n\t\t\t\tnew KeyValuePair\r\n\t\t\t\t{\r\n\t\t\t\t\tKey = \"InstallationId\",\r\n\t\t\t\t\tValue = Composite.Core.Configuration.InstallationInformationFacade.InstallationId.ToString()\r\n\t\t\t\t},\r\n\t\t\t\tnew KeyValuePair\r\n\t\t\t\t{\r\n\t\t\t\t\tKey = \"PasswordExpirationTimeInDays\",\r\n\t\t\t\t\tValue = PasswordPolicyFacade.PasswordExpirationTimeInDays.ToString()\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic KeyValuePair[] GetCreditsInfo(bool dummy)\r\n\t\t{\r\n\t\t\treturn new[]\r\n\t\t\t{\r\n\t\t\t\tnew KeyValuePair\r\n\t\t\t\t{\r\n\t\t\t\t\tKey = \"Core Development\",\r\n\t\t\t\t\tValue = \"Marcus Wendt;Dmitry Dzygin;Taras Nakonechnyi;Morteza Kasravi;Gert Sønderby;Inna Boitsun\"\r\n\t\t\t\t},\r\n\t\t\t\tnew KeyValuePair\r\n\t\t\t\t{\r\n\t\t\t\t\tKey = \"QA, Documentation\",\r\n\t\t\t\t\tValue = \"Vitaly Vysotskyi\"\r\n\t\t\t\t},\r\n\t\t\t\tnew KeyValuePair\r\n\t\t\t\t{\r\n\t\t\t\t\tKey = \"Special Thanks To\",\r\n\t\t\t\t\tValue = string.Join(\";\", new[]\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\"Martin Jensen for a solid codebase\",\r\n\t\t\t\t\t\t\"Jesper Moth for the first generation C1 Console\",\r\n\t\t\t\t\t\t\"Lamine N'Dao @ Orckestra for 2015 design\",\r\n\t\t\t\t\t\t\"@nufaqtz for awesome packages, inspiration and core contribs\",\r\n\t\t\t\t\t\t\"Poul Kjeldager Sørensen for the Windows Azure support\",\r\n\t\t\t\t\t\t\"@burningice for CompositeC1Contrib\",\r\n\t\t\t\t\t\t\"@thorstenh for German translation\",\r\n\t\t\t\t\t\t\"huangpin@eov.cn for Chinese translation\",\r\n\t\t\t\t\t\t\"@C1er for Russian & Ukrainian translations\",\r\n\t\t\t\t\t\t\"Emelie Mikaelsson (Invinn AB) for Swedish translation\",\r\n\t\t\t\t\t\t\"Erik Paquet for French translation\",\r\n\t\t\t\t\t\t\"Volodymyr Muzyka for building our Kiev team\",\r\n\t\t\t\t\t\t\"HolisticWare team for contributions\",\r\n\t\t\t\t\t\t\"Our community for help and cheering us on\",\r\n\t\t\t\t\t\t\"Our paying customers which make this possible\"\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/services/Localization/LocalizationService.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.LocalizationService\" %>\r\n\r\nusing System;\r\nusing System.Linq;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing Composite.Core.Routing;\r\nusing Composite.Data;\r\nusing Composite.Core;\r\nusing Composite.Core.WebClient.Services.LocalizationServiceObjects;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.WebClient.FlowMediators;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users.Workflows;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Services\r\n{\r\n\t[WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n\t[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n\tpublic class LocalizationService : System.Web.Services.WebService\r\n\t{\r\n\t\tprivate static PermissionType[] _changeOwnActiveLocalePermissionType = new PermissionType[] { };\r\n\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic ClientLocales GetLocales(bool dummy)\r\n\t\t{\r\n\t\t\tClientLocales clientLocales = new ClientLocales();\r\n\r\n\t\t\tif (UserSettings.ActiveLocaleCultureInfos.Count() >= 2)\r\n\t\t\t{\r\n\t\t\t\tif (UserSettings.ActiveLocaleCultureInfo != null) clientLocales.ActiveLocaleName = DataLocalizationFacade.GetCultureTitle(UserSettings.ActiveLocaleCultureInfo);\r\n\t\t\t\tif (UserSettings.ForeignLocaleCultureInfo != null) clientLocales.ForeignLocaleName = DataLocalizationFacade.GetCultureTitle(UserSettings.ForeignLocaleCultureInfo);\r\n\t\t\t}\r\n\r\n\t\t\treturn clientLocales;\r\n\t\t}\r\n\r\n\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic List<ClientLocale> GetActiveLocales(bool dummy)\r\n\t\t{\r\n\t\t\tvar clientLocales = new List<ClientLocale>();\r\n\r\n\t\t\tvar switchLanguageWorkflow = typeof(ChangeOwnActiveLocaleWorkflow);\r\n\r\n\t\t\tforeach (var cultureInfo in UserSettings.ActiveLocaleCultureInfos)\r\n\t\t\t{\r\n\t\t\t\tvar clientLocale = new ClientLocale\r\n\t\t\t\t{\r\n\t\t\t\t\tName = DataLocalizationFacade.GetCultureTitle(cultureInfo),\r\n\t\t\t\t\tIsoName = cultureInfo.Name,\r\n\t\t\t\t\tUrlMappingName = DataLocalizationFacade.GetUrlMappingName(cultureInfo),\r\n\t\t\t\t\tIsCurrent = cultureInfo.Equals(UserSettings.ActiveLocaleCultureInfo)\r\n\t\t\t\t};\r\n\r\n\t\t\t\tActionToken actionToken = new WorkflowActionToken(switchLanguageWorkflow, _changeOwnActiveLocalePermissionType)\r\n\t\t\t\t{\r\n\t\t\t\t\tPayload = cultureInfo.Name\r\n\t\t\t\t};\r\n\t\t\t\tclientLocale.SerializedActionToken = ActionTokenSerializer.Serialize(actionToken, true);\r\n\r\n\t\t\t\tclientLocales.Add(clientLocale);\r\n\t\t\t}\r\n\r\n\t\t\tclientLocales.Sort((a,b) => string.Compare(a.Name, b.Name, StringComparison.CurrentCultureIgnoreCase));\r\n\r\n\t\t\treturn clientLocales;\r\n\t\t}\r\n\r\n\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic List<string> GetLocaleAwarePerspectiveElements(bool dummy)\r\n\t\t{\r\n\t\t\treturn TreeServicesFacade.GetLocaleAwarePerspectiveElements();\r\n\t\t}\r\n\r\n\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic List<PageLocale> GetPageOtherLocales(string url)\r\n\t\t{\r\n\t\t\tvar pageUrl = PageUrls.ParseUrl(url);\r\n\t\t\tif (pageUrl == null)\r\n\t\t\t{\r\n\t\t\t\treturn new List<PageLocale>();\r\n\t\t\t}\r\n\r\n\t\t\tvar urlBuilder = new UrlBuilder(url);\r\n\r\n\t\t\tvar pageLocales = new List<PageLocale>();\r\n\r\n\t\t\tforeach (CultureInfo locale in UserSettings.ActiveLocaleCultureInfos)\r\n\t\t\t{\r\n\t\t\t\tbool exists;\r\n\t\t\t\tusing (var dataConnection = new DataConnection(pageUrl.PublicationScope, locale))\r\n\t\t\t\t{\r\n\t\t\t\t\texists = dataConnection.Get<IPage>().Any(page => page.Id == pageUrl.PageId);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!exists) continue;\r\n\r\n\t\t\t\tvar pageLocale = new PageLocale\r\n\t\t\t\t{\r\n\t\t\t\t\tName = DataLocalizationFacade.GetCultureTitle(locale),\r\n\t\t\t\t\tIsoName = locale.Name,\r\n\t\t\t\t\tUrlMappingName = DataLocalizationFacade.GetUrlMappingName(locale),\r\n\t\t\t\t\tIsCurrent = locale.Equals(pageUrl.LocalizationScope)\r\n\t\t\t\t};\r\n\r\n\r\n\t\t\t\tPageUrlData pageUrl2 = new PageUrlData(pageUrl.PageId, pageUrl.PublicationScope, locale);\r\n\r\n\t\t\t\tvar urlSpace = new UrlSpace();\r\n\r\n\t\t\t\tstring newUrl = PageUrls.BuildUrl(pageUrl2, UrlKind.Public, urlSpace)\r\n\t\t\t\t\t\t\t\t?? PageUrls.BuildUrl(pageUrl2, UrlKind.Renderer, urlSpace);\r\n\r\n\t\t\t    var newUrlBuilder = new UrlBuilder(newUrl)\r\n\t\t\t    {\r\n\t\t\t        ServerUrl = urlBuilder.ServerUrl\r\n\t\t\t    };\r\n\r\n\t\t\t    pageLocale.Url = newUrlBuilder.ToString();\r\n\r\n\t\t\t\tpageLocales.Add(pageLocale);\r\n\t\t\t}\r\n\r\n\t\t\treturn pageLocales;\r\n\t\t}\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic string GetTextDirection(bool dummy)\r\n\t\t{\r\n\t\t\treturn UserSettings.ActiveLocaleCultureInfo == null ? \"ltr\" : (UserSettings.ActiveLocaleCultureInfo.TextInfo.IsRightToLeft ? \"rtl\" : \"ltr\");\r\n\t\t}\r\n\r\n\t\t[WebMethod]\r\n\t\tpublic string GetUITextDirection(bool dummy)\r\n\t\t{\r\n\t\t\treturn UserSettings.C1ConsoleUiLanguage.TextInfo.IsRightToLeft ? \"rtl\" : \"ltr\";\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/services/LogService/LogService.svc",
    "content": "﻿<%@ ServiceHost Service=\"Composite.Core.WebClient.Logging.WCF.LogService,Composite\" Factory=\"System.ServiceModel.Activation.ServiceHostFactory\" %>"
  },
  {
    "path": "Website/Composite/services/Login/Login.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.Login\" %>\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class Login : WebService\r\n    {\r\n        [WebMethod]\r\n        public string ValidateAndLogin(string username, string password)\r\n        {\r\n            var result = UserValidationFacade.FormValidateUser(username, password);\r\n\r\n            switch (result)\r\n            {\r\n                case LoginResult.Success:\r\n                    return \"success\";\r\n                case LoginResult.UserLockedAfterMaxLoginAttempts:\r\n                    return \"lockedAfterMaxAttempts\";\r\n                case LoginResult.UserLockedByAdministrator:\r\n                    return \"lockedByAnAdministrator\";\r\n                case LoginResult.PasswordUpdateRequired:\r\n                    return \"passwordUpdateRequired\";\r\n            }\r\n            return \"failed\";\r\n        }\r\n\r\n        [WebMethod]\r\n        public string[] ChangePassword(string username, string oldPassword, string newPassword)\r\n        {\r\n            var result = UserValidationFacade.FormValidateUser(username, oldPassword);\r\n            if (result == LoginResult.IncorrectPassword)\r\n            {\r\n                return new[] {StringResourceSystemFacade.GetString(\"Composite.C1Console.Users\", \"ChangePasswordForm.IncorrectOldPassword\")};\r\n            }\r\n\r\n            Verify.That(result == LoginResult.PasswordUpdateRequired, \"Password update has to be required.\");\r\n\r\n            if (newPassword == oldPassword)\r\n            {\r\n                return new[]{ \"The old and the new passwords are the same.\"}; // Should be validated on client as well.\r\n            }\r\n\r\n            using (var c = new DataConnection())\r\n            {\r\n                var user = c.Get<IUser>().Single(u => string.Compare(u.Username, username, StringComparison.InvariantCultureIgnoreCase) == 0);\r\n\r\n                IList<string> errors;\r\n                if (!PasswordPolicyFacade.ValidatePassword(user, newPassword, out errors))\r\n                {\r\n                    return errors.ToArray();\r\n                }\r\n\r\n                UserValidationFacade.FormSetUserPassword(user.Username, newPassword);\r\n\r\n                var loginResult = UserValidationFacade.FormValidateUser(username, newPassword);\r\n                Verify.That(loginResult == LoginResult.Success, \"Unexpected login result value after a password change: \" + loginResult);\r\n            }\r\n\r\n            return new string[0];\r\n        }\r\n\r\n        [WebMethod]\r\n        public string Logout(bool dummy)\r\n        {\r\n            return UserValidationFacade.Logout();\r\n        }\r\n\r\n        [WebMethod]\r\n        public bool IsLoggedIn(bool dummy)\r\n        {\r\n            if (UserValidationFacade.IsLoggedIn()\r\n                && !UserValidationFacade.AllUsernames.Contains(UserValidationFacade.GetUsername()))\r\n            {\r\n                Log.LogInformation(\"Security\", String.Format(\"Automatic logout executed. Username '{0}' not found in list of usernames\", UserValidationFacade.GetUsername()));\r\n                UserValidationFacade.Logout();\r\n\r\n                return false;\r\n            }\r\n\r\n            return UserValidationFacade.IsLoggedIn();\r\n        }\r\n\r\n        [WebMethod]\r\n        public string GetUserDisplayName(bool dummy)\r\n        {\r\n            string username = UserValidationFacade.GetUsername();\r\n            if (string.IsNullOrEmpty(username))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            using (var c = new DataConnection())\r\n            {\r\n                var user = c.Get<IUser>().FirstOrDefault(u => string.Compare(u.Username, username, StringComparison.InvariantCultureIgnoreCase) == 0);\r\n\r\n                if (user != null && !string.IsNullOrEmpty(user.Name))\r\n                {\r\n                    return user.Name;\r\n                }\r\n            }\r\n\r\n            return username;\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/services/Media/ImageManipulator.ashx",
    "content": "<%@ WebHandler Language=\"C#\" Class=\"ImageManipulator\" %>\r\n\r\nusing System;\r\nusing System.Drawing.Drawing2D;\r\nusing System.IO;\r\nusing System.Web;\r\nusing System.Drawing.Imaging;\r\nusing System.Drawing;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.IO;\r\nusing Composite.C1Console.Workflow;\r\nusing Composite.Core.WebClient;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Events;\r\nusing Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider;\r\n\r\n\r\npublic class ImageManipulator : IHttpHandler\r\n{\r\n\r\n    private string[] GetArguments(string action)\r\n    {\r\n        int startIndex = action.IndexOf('(');\r\n        int stopIndex = action.IndexOf(')');\r\n\r\n        string argumentString = action.Substring(startIndex + 1, stopIndex - startIndex - 1);\r\n\r\n        return argumentString.Split(',');\r\n    }\r\n\r\n\r\n    private static int GetInt(string s)\r\n    {\r\n        return (int) Math.Round(float.Parse(s));\r\n    }\r\n    \r\n    public void ProcessRequest(HttpContext context)\r\n    {\r\n        context.Response.Cache.SetExpires(DateTime.Now.AddYears(-10));\r\n        \r\n        string actionString = context.Request[\"actions\"];\r\n        string save = context.Request[\"Save\"];\r\n        string viewId = context.Request[\"viewId\"];\r\n        string consoleId = context.Request[\"consoleId\"];\r\n\r\n        IMediaFile mediaFile = MediaUrlHelper.GetFileFromQueryString(context.Request.QueryString);\r\n\r\n        /*if (mediaFile == null)\r\n        {\r\n            LoggingService.LogWarning(\"ImageManipulator\", \"Failed to find media by path '{0}'\".FormatWith(src));\r\n            return;\r\n        }*/\r\n        \r\n        Bitmap image;\r\n        \r\n        // TODO: Caching here?\r\n        using (Stream readStream = mediaFile.GetReadStream())\r\n        {\r\n            // the double new Bitmap(new Bitmap(..)) fixes GIF prb; \r\n            // \"a graphics object cannot be created from an image that has an indexed pixel format\"\r\n            using (var innerBitmap = new Bitmap(readStream))\r\n            using (Bitmap lockedSource = new Bitmap(innerBitmap))\r\n            using (Graphics g = Graphics.FromImage(lockedSource)) {\r\n                image = new Bitmap(lockedSource);\r\n                g.DrawImage(image, new Point(0, 0));\r\n            }\r\n        }\r\n        \r\n     \r\n        string[] actions = new string[0];\r\n        if (actionString != null)\r\n        {\r\n            actions = actionString.Split(';');\r\n        }\r\n        else if (context.Request[\"action\"] != null)\r\n        {\r\n            actions = new[] { context.Request[\"action\"] }; \r\n        }\r\n        foreach (string action in actions)\r\n        {\r\n            if (action == string.Empty)\r\n            {\r\n                continue;\r\n            }\r\n\r\n            if (action == \"fit\")\r\n            {\r\n                string maxWidthStr = context.Request[\"maxWidht\"] ?? context.Request[\"maxwidth\"] ?? context.Request[\"mw\"] ?? \"0\";\r\n                string maxHeightStr = context.Request[\"maxHeight\"] ?? context.Request[\"maxheight\"] ?? context.Request[\"mh\"] ?? \"0\";\r\n                \r\n                int maxWidth, maxHeight;\r\n                \r\n                if(!int.TryParse(maxWidthStr, out maxWidth))\r\n                {\r\n                    maxWidth = 0;\r\n                }\r\n                \r\n                if(!int.TryParse(maxHeightStr, out maxHeight))\r\n                {\r\n                    maxHeight = 0;\r\n                }\r\n\r\n                image = FitToFrame(image, maxWidth, maxHeight);\r\n                \r\n                continue;\r\n            }\r\n\r\n            string[] arguments = GetArguments(action);            \r\n            \r\n            switch (action[0])\r\n            {\r\n                case 'r': // rotate\r\n                    int angle = GetInt(arguments[0]);\r\n                    Rotate(image, angle);\r\n                    break;\r\n                case 'c': // crop\r\n                    int leftImage = GetInt(arguments[0]);\r\n                    int topImage = GetInt(arguments[1]);\r\n                    int widthImage = GetInt(arguments[2]);\r\n                    int heightImage = GetInt(arguments[3]);\r\n                    image = Crop(image, leftImage, topImage, widthImage, heightImage);\r\n                    break;\r\n                case 's': // scale\r\n                    string type = arguments[0];\r\n                    \r\n                    int horzontalArg = GetInt(arguments[1]);\r\n                    int verticalArg = GetInt(arguments[2]);\r\n                    \r\n                    if (verticalArg < 1)\r\n                    {\r\n                        verticalArg = decimal.ToInt32((decimal)image.Height * ((decimal)horzontalArg / (decimal)image.Width));\r\n                        if (verticalArg < 1) verticalArg = 1;\r\n                    }\r\n                    if (horzontalArg < 1)\r\n                    {\r\n                        horzontalArg = decimal.ToInt32((decimal)image.Width * ((decimal)verticalArg / (decimal)image.Height));\r\n                        if (horzontalArg < 1) horzontalArg = 1;\r\n                    }\r\n                    if (arguments[0] == \"\\\"px\\\"\")\r\n                    {\r\n                        image = ScalePixels(image, horzontalArg, verticalArg);\r\n                    }\r\n                    else if (arguments[0] == \"\\\"%\\\"\")\r\n                    {\r\n                        image = ScalePercent(image, horzontalArg, verticalArg);\r\n                    }   \r\n                    break;\r\n                case 'f': // flip\r\n                    bool isFlip = bool.Parse(arguments[0]);\r\n                    Flip(image, isFlip);\r\n                    break;\r\n            }\r\n        }\r\n\r\n        string mimeType = mediaFile.MimeType;\r\n\r\n        WriteBitmapToResponseSteam(context, image, mimeType);\r\n        if (save != null)\r\n        {\r\n            UpdateMediaFileImage(mediaFile, image);\r\n\r\n            if ((viewId != null) && (consoleId != null))\r\n            {\r\n                ConsoleMessageQueueFacade.Enqueue(new SaveStatusConsoleMessageQueueItem { ViewId = viewId, Succeeded = true }, consoleId);\r\n            }\r\n            \r\n            RaiseWorkflowEvents(mediaFile);            \r\n        }\r\n        image.Dispose();      \r\n    }\r\n\r\n    \r\n    \r\n    public bool IsReusable\r\n    {\r\n        get { return false; }\r\n    }\r\n\r\n\r\n\r\n    private Bitmap ScalePixels(Bitmap source, int width, int height)\r\n    {\r\n        Bitmap scaled = new Bitmap(width, height, GetAcceptablePixelFormat(source));\r\n        using(Graphics graphics = Graphics.FromImage(scaled))\r\n        {\r\n            graphics.Clear(Color.Transparent);\r\n            graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;\r\n            graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;\r\n\r\n            graphics.DrawImage(source, new Rectangle(-1, -1, width + 1, height + 1), \r\n                                       new Rectangle(0, 0, source.Width - 1, source.Height - 1), GraphicsUnit.Pixel);\r\n        }            \r\n        source.Dispose();\r\n        \r\n        return scaled;\r\n    }\r\n\r\n\r\n\r\n    private PixelFormat GetAcceptablePixelFormat(Bitmap source)\r\n    {\r\n        if (source.PixelFormat == PixelFormat.Format1bppIndexed ||\r\n            source.PixelFormat == PixelFormat.Format4bppIndexed ||\r\n            source.PixelFormat == PixelFormat.Format8bppIndexed ||\r\n            source.PixelFormat == PixelFormat.Undefined ||\r\n            source.PixelFormat == PixelFormat.DontCare ||\r\n            source.PixelFormat == PixelFormat.Format16bppArgb1555 ||\r\n            source.PixelFormat == PixelFormat.Format16bppGrayScale)\r\n        {\r\n            return PixelFormat.Format32bppArgb;\r\n        }\r\n        return source.PixelFormat;\r\n    }\r\n    \r\n\r\n\r\n    private Bitmap ScalePercent(Bitmap source, int xScale, int yScale)\r\n    {\r\n        int height = source.Height * xScale;\r\n        if (height != 0)\r\n        {\r\n            height /= 100;\r\n        }\r\n        int width = source.Width * yScale;\r\n        if (width != 0)\r\n        {\r\n            width /= 100;\r\n        }\r\n        Bitmap scaled = new Bitmap(width, height, source.PixelFormat);\r\n        Graphics graphics = Graphics.FromImage(scaled);\r\n        graphics.Clear(Color.Transparent);\r\n        graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;\r\n        graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;\r\n\r\n        graphics.DrawImage(source, new Rectangle(-1, -1, width + 1, height + 1),\r\n                                   new Rectangle(0, 0, source.Width - 1, source.Height - 1), GraphicsUnit.Pixel);\r\n        source.Dispose();\r\n        return scaled;\r\n    }\r\n\r\n\r\n    private void Rotate(Bitmap source, float angle)\r\n    {\r\n        if (angle == 90)\r\n        {\r\n            source.RotateFlip(RotateFlipType.Rotate90FlipNone);\r\n        }\r\n        else if (angle == 180)\r\n        {\r\n            source.RotateFlip(RotateFlipType.Rotate180FlipNone);\r\n        }\r\n        else if (angle == 270)\r\n        {\r\n            source.RotateFlip(RotateFlipType.Rotate270FlipNone);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    private void Flip(Bitmap source, bool isVerticalFlip)\r\n    {\r\n        if (isVerticalFlip)\r\n        {\r\n            source.RotateFlip(RotateFlipType.RotateNoneFlipX);\r\n        }\r\n        else\r\n        {\r\n            source.RotateFlip(RotateFlipType.RotateNoneFlipY);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    private Bitmap Crop(Bitmap source, int left, int top, int width, int height)\r\n    {\r\n        int leftCull = 0;\r\n        if (left < 0)\r\n        {\r\n            leftCull = Math.Abs(left);\r\n            width = width - leftCull;\r\n            left = 0;\r\n        }\r\n        if(left + width > source.Width)\r\n        {\r\n            int rightCull = left + width - source.Width;\r\n            width = width - rightCull;\r\n        }\r\n        \r\n        int topCull = 0;\r\n        if (top < 0)\r\n        {\r\n            topCull = Math.Abs(top);\r\n            height = height - topCull;\r\n            top = 0;    \r\n        }\r\n        if (top + height > source.Height)\r\n        {\r\n            int bottomCull = top + height - source.Height;\r\n            height = height - bottomCull;            \r\n        }\r\n                \r\n        \r\n        Bitmap croppedImage = new Bitmap(width, height, source.PixelFormat);\r\n        using(Graphics graphics = Graphics.FromImage(croppedImage))\r\n        {\r\n            graphics.Clear(Color.Transparent);\r\n            graphics.DrawImage(source, new Rectangle(0, 0, croppedImage.Width, croppedImage.Height), new Rectangle(left, top, width, height), GraphicsUnit.Pixel);\r\n        }\r\n        source.Dispose();\r\n        \r\n        return croppedImage;\r\n    }\r\n   \r\n\r\n\r\n    private void WriteBitmapToResponseSteam(HttpContext context, Bitmap image, string mimeType)\r\n    {\r\n        context.Response.ContentType = mimeType;\r\n        using (MemoryStream memStream = new MemoryStream())\r\n        {\r\n            image.Save(memStream, GetImageFormat(mimeType));\r\n            memStream.WriteTo(context.Response.OutputStream);\r\n        }\r\n    }\r\n\r\n\r\n\r\n    private void UpdateMediaFileImage(IMediaFile mediaFile, System.Drawing.Image image)\r\n    {\r\n        using (Stream writeStream = mediaFile.GetNewWriteStream())\r\n        {\r\n            // Use a temporary memory stream when the writeStream doesn't support returning the stream length which is called when using Image.Save()\r\n            using (var ms = new MemoryStream())\r\n            {\r\n                image.Save(ms, GetImageFormat(mediaFile.MimeType));\r\n                var buffer = ms.GetBuffer();\r\n                writeStream.Write(buffer, 0, buffer.Length);\r\n            }\r\n        }\r\n        DataFacade.Update(mediaFile);\r\n    }\r\n\r\n    private Bitmap FitToFrame(Bitmap image, int maxWidth, int maxHeight)\r\n    {\r\n        bool heightMuch = maxHeight == 0 || image.Height <= maxHeight;\r\n        bool widthMuch = maxWidth == 0 || image.Width <= maxWidth;\r\n        \r\n        if(heightMuch && widthMuch) return image;\r\n        \r\n        bool stretchByHeight = !heightMuch;\r\n        if(!heightMuch && !widthMuch) {\r\n            float heightStrechRatio = maxHeight / (float)image.Height;\r\n            float widthStrechRatio = maxWidth  / (float)image.Width;\r\n            stretchByHeight = heightStrechRatio < widthStrechRatio;\r\n        }\r\n\r\n        int resultHeight, resultWidth;\r\n        \r\n        if (stretchByHeight)\r\n        {\r\n            resultHeight = maxHeight;\r\n            resultWidth = (int)Math.Round(image.Width * (float)maxHeight / (float)image.Height);\r\n            // It's possible that rounded width will be one pixel bigger than [maxWidth]            \r\n            if (maxWidth != 0 && resultWidth > maxWidth)\r\n            {\r\n                resultWidth = maxWidth;\r\n            }\r\n        }\r\n        else\r\n        {\r\n            resultWidth = maxWidth;\r\n            resultHeight = (int)Math.Round(image.Height * (float)maxWidth / (float)image.Width);\r\n            // It's possible that rounded value width will be one pixel bigger than [maxHeight]\r\n            if (maxHeight != 0 && resultHeight > maxHeight)\r\n            {\r\n                resultHeight = maxHeight;\r\n            }\r\n        }\r\n\r\n\t\treturn Composite.Core.WebClient.Media.ImageResizer.ResizeImage(image, resultWidth, resultHeight, false);\r\n    }\r\n    \r\n\r\n    private ImageFormat GetImageFormat(string mimeType)\r\n    {\r\n        ImageFormat format;\r\n        mimeType = MimeTypeInfo.GetCanonical(mimeType);\r\n        if(mimeType == MimeTypeInfo.Jpeg)\r\n        {\r\n            format = ImageFormat.Jpeg;\r\n        }\r\n        else if(mimeType == MimeTypeInfo.Bmp)\r\n        {\r\n            format = ImageFormat.Bmp;\r\n        }\r\n        else if(mimeType == MimeTypeInfo.Gif)\r\n        {\r\n            format = ImageFormat.Gif;\r\n        }\r\n        else if(mimeType == MimeTypeInfo.Png)\r\n        {\r\n            format = ImageFormat.Png;\r\n        }\r\n        else if(mimeType == MimeTypeInfo.Tiff)\r\n        {\r\n            format = ImageFormat.Tiff;\r\n        }\r\n        else\r\n        {\r\n            format = ImageFormat.Png;\r\n        }\r\n\r\n        return format;\r\n    }\r\n\r\n    private void RaiseWorkflowEvents(IMediaFile mediaFile)\r\n    {\r\n        FlowControllerServicesContainer services = new FlowControllerServicesContainer();\r\n        services.AddService(new ManagementConsoleMessageServiceMock());\r\n\r\n        EntityToken entityToken = DataEntityTokenExtensions.GetDataEntityToken(mediaFile);\r\n        ActionToken actionToken = new WorkflowActionToken(typeof(EditMediaFileContentWorkflow));\r\n\r\n        ActionExecutorFacade.Execute(entityToken, actionToken, services);\r\n    }\r\n\r\n\r\n    #region Nested classes\r\n\r\n    public sealed class ManagementConsoleMessageServiceMock : IManagementConsoleMessageService\r\n    {\r\n        public void RefreshTreeSection(EntityToken parentEntityToken)\r\n        {\r\n        }\r\n\r\n        public void ShowMessage(DialogType dialogType, string title, string message)\r\n        {\r\n        }\r\n\r\n        public void ShowGlobalMessage(DialogType dialogType, string title, string message)\r\n        {\r\n        }\r\n\r\n        public void ShowLogEntry(Type sender, Exception exception)\r\n        {\r\n        }\r\n\r\n        public void ShowLogEntry(Type sender, Composite.Core.Logging.LogLevel logLevel, string message)\r\n        {\r\n        }\r\n\r\n        public bool CloseCurrentViewRequested\r\n        {\r\n            get; set;\r\n        }\r\n\r\n        public void CloseCurrentView()\r\n        {\r\n        }\r\n\r\n        public string CurrentConsoleId\r\n        {\r\n            get { return string.Empty; }\r\n        }\r\n\r\n\r\n        public void RebootConsole()\r\n        {\r\n        }\r\n\r\n        public void LockSystem()\r\n        {\r\n        }\r\n\r\n        public void BroadcastMessage(string name, string value)\r\n        {\r\n        }\r\n\r\n        public void CollapseAndRefresh()\r\n        {\r\n        }\r\n\r\n        public void SaveStatus(bool succeeded)\r\n        {\r\n        }\r\n\r\n        public bool HasView\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n        public void BindEntityTokenToView(string entityToken)\r\n        {\r\n        }\r\n\r\n        public void ExpandTreeNode(EntityToken entityToken)\r\n        {\r\n        }\r\n\r\n\r\n        public void SelectElement(string entityToken)\r\n        {\r\n        }\r\n    }\r\n\r\n    #endregion\r\n}"
  },
  {
    "path": "Website/Composite/services/Media/Upload.ashx",
    "content": "﻿<%@ WebHandler Language=\"C#\" Class=\"Upload\" %>\r\n\r\nusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider;\r\n\r\npublic class Upload : IHttpHandler\r\n{\r\n\tpublic void ProcessRequest(HttpContext context)\r\n\t{\r\n\t\tcontext.Response.ContentType = \"text/plain\";\r\n\t\tvar fileName = context.Request.Headers[\"X-FileName\"];\r\n\t\tvar serializedFolderEntityToken = context.Request.Headers[\"X-Folder\"];\r\n\t\tvar storeId = \"MediaArchive\";\r\n\t\tvar folderPath = \"/\";\r\n\t\ttry\r\n\t\t{\r\n\t\t\tvar entityToken = EntityTokenSerializer.Deserialize(serializedFolderEntityToken);\r\n\t\t\tif (entityToken is MediaRootFolderProviderEntityToken)\r\n\t\t\t{\r\n\t\t\t\tvar token = (MediaRootFolderProviderEntityToken)entityToken;\r\n\t\t\t\tstoreId = token.Id;\r\n\t\t\t\tfolderPath = \"/\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar token = (DataEntityToken)entityToken;\r\n\t\t\t\tvar parentFolder = (IMediaFileFolder)token.Data;\r\n\t\t\t\tstoreId = parentFolder.StoreId;\r\n\t\t\t\tfolderPath = parentFolder.Path;\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch\r\n\t\t{\r\n\t\t}\r\n\r\n\t\tvar file = new WorkflowMediaFile\r\n\t\t\t{\r\n\t\t\t\tStoreId = storeId,\r\n\t\t\t\tFileName = Path.GetFileName(fileName),\r\n\t\t\t\tFolderPath = folderPath,\r\n\t\t\t\tTitle = fileName,\r\n\t\t\t\tDescription = string.Empty,\r\n\t\t\t\tCulture = Composite.C1Console.Users.UserSettings.ActiveLocaleCultureInfo.Name,\r\n\t\t\t\tLength = (int) context.Request.InputStream.Length,\r\n\t\t\t\tMimeType = MimeTypeInfo.GetCanonicalFromExtension(Path.GetExtension(fileName))\r\n\t\t\t};\r\n\r\n\t\tint counter = 0;\r\n\t\tstring extension = Path.GetExtension(file.FileName);\r\n\t\tstring name = file.FileName.GetNameWithoutExtension();\r\n\t\twhile (Exists(file))\r\n\t\t{\r\n\t\t\tcounter++;\r\n\t\t\tfile.FileName = string.Format(\"{0}{1}{2}\", name, counter.ToString(), extension);\r\n\t\t}\r\n\r\n\t\tusing (var readStream = context.Request.InputStream)\r\n\t\t{\r\n\t\t\tusing (var writeStream = file.GetNewWriteStream())\r\n\t\t\t{\r\n\t\t\t\treadStream.CopyTo(writeStream);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar addedFile = DataFacade.AddNew<IMediaFile>(file);\r\n\t\tif (IsImage(addedFile))\r\n\t\t{\r\n\t\t\tcontext.Response.Write(string.Format(@\" <img src=\"\"{0}?mw={1}\"\" /> \", UrlUtils.ResolvePublicUrl( MediaUrlHelper.GetUrl(addedFile, true)), 800));\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcontext.Response.Write(string.Format(@\" <a href=\"\"{0}\"\" >{1}</a> \", UrlUtils.ResolvePublicUrl( MediaUrlHelper.GetUrl(addedFile, true, true)), fileName));\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tprivate static bool Exists(IMediaFile file)\r\n\t{\r\n\t\treturn DataFacade.GetData<IMediaFile>().Any(x => x.FolderPath == file.FolderPath && x.FileName == file.FileName);\r\n\t}\r\n\r\n\tprivate static bool IsImage(IMediaFile file)\r\n\t{\r\n\t\treturn DataFacade.GetData<IImageFile>().Any(x => x.Id == file.Id);\r\n\t}\r\n\r\n\tpublic bool IsReusable\r\n\t{\r\n\t\tget\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/services/Page/PageService.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.PageService\" %>\r\n\r\nusing System;\r\nusing System.Linq;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\n\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class PageService : System.Web.Services.WebService\r\n    {\r\n        [WebMethod]\r\n        public string GetPageBrowserDefaultUrl(bool dummy)\r\n        {\r\n            using (DataConnection dataConnection = new DataConnection(PublicationScope.Unpublished, UserSettings.ActiveLocaleCultureInfo))\r\n            {\r\n                SitemapNavigator sitemapNavigator = new SitemapNavigator(dataConnection);\r\n                PageNode homePageNode = sitemapNavigator.GetPageNodeByHostname(this.Context.Request.Url.Host);\r\n\r\n                if (homePageNode == null)\r\n                {\r\n                    return \"/\";\r\n                }\r\n\r\n                return homePageNode.Url;\r\n            }\r\n        }\r\n\r\n        [WebMethod]\r\n        public string TranslateToInternalUrl(string url)\r\n        {\r\n            if (PageUrlHelper.IsInternalUrl(url))\r\n            {\r\n                return url;\r\n            }\r\n\r\n            var pageUrlData = PageUrls.ParseUrl(url);\r\n\r\n            if (pageUrlData == null)\r\n            {\r\n                return string.Empty;\r\n            }\r\n\r\n            return PageUrls.BuildUrl(pageUrlData, UrlKind.Renderer, new UrlSpace());\r\n        }\r\n\r\n        [WebMethod]\r\n        public string ConvertRelativePageUrlToAbsolute(string pageUrl)\r\n        {\r\n            if (pageUrl == string.Empty) return string.Empty;\r\n\r\n            PageUrlData urlData = PageUrls.ParseUrl(pageUrl);\r\n            if(urlData == null)\r\n            {\r\n                return pageUrl;\r\n            }\r\n\r\n            string publicUrl = PageUrls.BuildUrl(urlData, UrlKind.Public, new UrlSpace());\r\n\r\n            if (publicUrl == null) return pageUrl;\r\n\r\n            return AddServerUrl(publicUrl); \r\n        }\r\n\r\n        [WebMethod]\r\n        public string ConvertAbsolutePageUrlToRelative(string pageUrl)\r\n        {\r\n            if (pageUrl == string.Empty) return string.Empty;\r\n            \r\n            if(!DataFacade.GetData<IHostnameBinding>().AsEnumerable().Any())\r\n            {\r\n                return pageUrl;\r\n            }\r\n\r\n            PageUrlData urlData = PageUrls.ParseUrl(pageUrl);\r\n            if (urlData == null)\r\n            {\r\n                return pageUrl;\r\n            }\r\n\r\n            string relativeRul = PageUrls.BuildUrl(urlData, UrlKind.Public, new UrlSpace {ForceRelativeUrls = true});\r\n            \r\n            if(relativeRul == null) return pageUrl;\r\n            \r\n            return AddServerUrl(relativeRul);\r\n        }        \r\n        \r\n        private static string AddServerUrl(string url)\r\n        {\r\n            if(url.StartsWith(\"http\"))\r\n            {\r\n                return url;\r\n            }\r\n            \r\n            Uri requestUri = System.Web.HttpContext.Current.Request.Url;\r\n            string serverLink = requestUri.AbsoluteUri.Substring(0, requestUri.AbsoluteUri.Length - requestUri.AbsolutePath.Length);\r\n            \r\n            return serverLink + url;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/Ready/ReadyService.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" Class=\"Composite.Services.ReadyService\" %>\r\n\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing Composite;\r\n\r\nnamespace Composite.Services\r\n{\r\n\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class ReadyService : System.Web.Services.WebService\r\n    {\r\n        public ReadyService()\r\n        {\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public bool IsServerReady(bool dummy)\r\n        {\r\n            return GlobalInitializerFacade.SystemCoreInitialized && Composite.Core.Application.ApplicationOnlineHandlerFacade.IsApplicationOnline;\r\n        }\r\n\r\n    }\r\n\r\n}"
  },
  {
    "path": "Website/Composite/services/SearchEngineOptimizationKeyword/SearchEngineOptimizationKeyword.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" Class=\"Composite.Services.SearchEngineOptimizationKeyword\" %>\r\n\r\nusing System;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Collections.Generic;\r\nusing System.Transactions;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.Linq;\r\nusing Composite.Data.Transactions;\r\n\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class SearchEngineOptimizationKeyword : System.Web.Services.WebService\r\n    {\r\n\r\n        [WebMethod]\r\n        public bool SaveKeyWords(List<string> keywords)\r\n        {\r\n            using (new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo))\r\n            {\r\n                using (TransactionScope transactionScope = TransactionsFacade.Create(true))\r\n                {\r\n                    IEnumerable<ISearchEngineOptimizationKeyword> existingKeywords = DataFacade.GetData<ISearchEngineOptimizationKeyword>().Evaluate();\r\n\r\n                    foreach (string keyword in keywords)\r\n                    {\r\n                        if (existingKeywords.Where(f => f.Keyword == keyword).Any() == false)\r\n                        {\r\n                            ISearchEngineOptimizationKeyword newKeyword = DataFacade.BuildNew<ISearchEngineOptimizationKeyword>();\r\n                            newKeyword.Keyword = keyword;\r\n                            DataFacade.AddNew(newKeyword);\r\n                        }\r\n                    }\r\n\r\n                    foreach (ISearchEngineOptimizationKeyword existingKeyword in existingKeywords)\r\n                    {\r\n                        if (keywords.Contains(existingKeyword.Keyword) == false)\r\n                        {\r\n                            DataFacade.Delete(existingKeyword);\r\n                        }\r\n                    }\r\n\r\n                    transactionScope.Complete();\r\n                }\r\n            }\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public List<string> GetKeyWords(bool dummy)\r\n        {\r\n            using (new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo))\r\n            {\r\n                IEnumerable<ISearchEngineOptimizationKeyword> keywords = DataFacade.GetData<ISearchEngineOptimizationKeyword>().Evaluate();\r\n\r\n                List<string> result = new List<string>(keywords.Select(f => f.Keyword));\r\n\r\n                return result;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/services/Setup/SetupService.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Core.WebClient.Setup.SetupService\" %>\r\n\r\nusing System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Xml;\r\nusing System.Runtime.InteropServices;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.IO;\r\n\r\n\r\nnamespace Composite.Core.WebClient.Setup\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class SetupService : System.Web.Services.WebService\r\n    {\r\n        private static readonly string LogTitle = typeof (SetupService).FullName;\r\n\r\n        [WebMethod]\r\n        public CheckResult[] CheckRequirements(bool dummy)\r\n        {\r\n            return new[]\r\n            {\r\n                new CheckResult {\r\n                    Key = \"permissions\",\r\n                    Title = \"Web directory permissions\",\r\n                    Success = HasWritePermission()\r\n                },\r\n                new CheckResult {\r\n                    Key = \"pathlength\",\r\n                    Title = \"Base path length\",\r\n                    Success = BasePathNotToLong()\r\n                },\r\n                new CheckResult {\r\n                    Key = \"connection\",\r\n                    Title = \"Outbound HTTPS/SOAP connection\",\r\n                    Success = HasConnectionToPackageServer()\r\n                },\r\n                new CheckResult {\r\n                    Key = \"browser\",\r\n                    Title = \"Browser type and version\",\r\n                    Success = BrowserCheck()\r\n                },\r\n                new CheckResult {\r\n                    Key = \"diskspace\",\r\n                    Title = \"Disk space requirements\",\r\n                    Success = DiskSpaceCheck()\r\n                },\r\n                new CheckResult {\r\n                    Key = \"iisversion\",\r\n                    Title = \"IIS (Web Server) version\",\r\n                    Success = WebServerVersionCheck()\r\n                },\r\n                new CheckResult {\r\n                    Key = \"websockets\",\r\n                    Title = \"IIS WebSocket support installed\",\r\n                    Success = WebsocketCheck()\r\n                }\r\n            };\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public XmlDocument GetSetupDescription(bool dummy)\r\n        {\r\n            XElement setupDescription = SetupServiceFacade.GetSetupDescription();\r\n\r\n            // Remove urls \r\n            foreach (XElement element in setupDescription.Descendants(SetupServiceFacade.PackageElementName))\r\n            {\r\n                XAttribute urlAttribute = element.Attribute(SetupServiceFacade.UrlAttributeName);\r\n                if (urlAttribute != null)\r\n                {\r\n                    urlAttribute.Remove();\r\n                }\r\n            }\r\n\r\n            XmlDocument doc = new XmlDocument();\r\n\r\n            doc.LoadXml(setupDescription.ToString());\r\n\r\n            return doc;\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public XmlDocument GetLicenseHtml(bool dummy)\r\n        {\r\n            return SetupServiceFacade.GetGetLicense();\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public LanguageDef[] GetLanguages(bool dummy)\r\n        {\r\n            XElement languagesXml = SetupServiceFacade.GetLanguages();\r\n\r\n\r\n            string clientPreferredCultureName = ((this.Context.Request.UserLanguages ?? new string[0]).FirstOrDefault() ?? \"\").ToLowerInvariant();\r\n\r\n            List<LanguageDef> languages = new List<LanguageDef>();\r\n            bool selectionDone = false;\r\n            foreach (XElement element in languagesXml.Elements(\"Language\"))\r\n            {\r\n\r\n                bool selected = false;\r\n\r\n                if (string.IsNullOrEmpty(clientPreferredCultureName))\r\n                {\r\n                    XAttribute selectedAttribute = element.Attribute(\"Selected\");\r\n                    selected = (selectedAttribute != null && (bool)selectedAttribute);\r\n                }\r\n                else\r\n                {\r\n                    if (selectionDone==false)\r\n                    {\r\n                        selected = (element.Attribute(\"Key\").Value.ToLowerInvariant().StartsWith(clientPreferredCultureName));\r\n                        selectionDone = selected;\r\n                    }\r\n                }\r\n\r\n                LanguageDef languageDef = new LanguageDef\r\n                {\r\n                    Title = element.Attribute(\"Title\").Value,\r\n                    Key = element.Attribute(\"Key\").Value,\r\n                    Selected = selected\r\n                };\r\n\r\n                languages.Add(languageDef);\r\n            }\r\n\r\n            return languages.ToArray();\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public bool SetUp(string setupDescriptionXML, string username, string email, string password, string language, string consolelanguage, bool newsletter)\r\n        {\r\n            if (SystemSetupFacade.IsSystemFirstTimeInitialized || SystemSetupFacade.SetupIsRunning) return true;\r\n\r\n            SystemSetupFacade.SetupIsRunning = true;\r\n\r\n            try\r\n            {\r\n                return SetupServiceFacade.SetUp(setupDescriptionXML, username, password, email, language, consolelanguage, newsletter);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, ex);\r\n                throw;\r\n            }\r\n            finally\r\n            {\r\n                SystemSetupFacade.IsSystemFirstTimeInitialized = true;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        private bool HasWritePermission()\r\n        {\r\n            try\r\n            {\r\n                TestNtfsAccessToFolder(Server.MapPath(\"~/\"));\r\n                TestNtfsAccessToFolder(Server.MapPath(\"~/App_Data\"));\r\n                TestNtfsAccessToFolder(Server.MapPath(\"~/Frontend\"));\r\n                TestNtfsAccessToFolder(Server.MapPath(\"~/Composite/Setup\"));\r\n\r\n                CheckAccessToFile(Server.MapPath(\"~/default.aspx\"));\r\n                CheckAccessToFile(Server.MapPath(\"~/Frontend/Config/VisualEditor/Common.xml\"));\r\n\r\n                if (FileIsReadOnly(Server.MapPath(\"~/web.config\"))\r\n                    || FileIsReadOnly(Server.MapPath(\"~/App_Data/Composite/Composite.config\"))\r\n                    || !PathUtil.WritePermissionGranted(Server.MapPath(\"~/web.config\"))\r\n                    || !PathUtil.WritePermissionGranted(Server.MapPath(\"~/App_Data/Composite/Composite.config\")))\r\n                {\r\n                    return false;\r\n                }\r\n\r\n                return true;\r\n            }\r\n            catch (UnauthorizedAccessException)\r\n            {\r\n                return false;\r\n            }\r\n            catch (Exception)\r\n            {\r\n                if (RuntimeInformation.IsDebugBuild) throw;\r\n\r\n                return false;\r\n            }\r\n        }\r\n\r\n        private static void CheckAccessToFile(string file)\r\n        {\r\n            FileAttributes fa = C1File.GetAttributes(file);\r\n            bool isReadOnly = (fa & FileAttributes.ReadOnly) > 0;\r\n\r\n            if(isReadOnly)\r\n            {\r\n                C1File.SetAttributes(file, fa ^ FileAttributes.ReadOnly);\r\n            }\r\n\r\n            DateTime creationTime = C1File.GetCreationTimeUtc(file);\r\n\r\n            C1File.SetCreationTimeUtc(file, creationTime.AddDays(-1));\r\n            C1File.SetCreationTimeUtc(file, creationTime);\r\n\r\n            if(isReadOnly)\r\n            {\r\n                C1File.SetAttributes(file, fa);\r\n            }\r\n        }\r\n\r\n        private static bool FileIsReadOnly(string file)\r\n        {\r\n            bool @readonly = (File.GetAttributes(file) & FileAttributes.ReadOnly) > 0;\r\n\r\n            if(@readonly)\r\n            {\r\n                Log.LogError(LogTitle, \"File '{0}' is read only\".FormatWith(Path.GetFileName(file)));\r\n            }\r\n\r\n            return @readonly;\r\n        }\r\n\r\n        private static void TestNtfsAccessToFolder(string testDir)\r\n        {\r\n            string filePath = Path.Combine(testDir, \"NtfsSecurityTest.xml\");\r\n\r\n            if (C1File.Exists(filePath))\r\n            {\r\n                FileUtils.Delete(filePath);\r\n            }\r\n\r\n            string tempDirectory = Path.Combine(testDir, \"NtfsSecurityTest\");\r\n            if (C1Directory.Exists(tempDirectory) == false)\r\n            {\r\n                C1Directory.CreateDirectory(tempDirectory);\r\n            }\r\n\r\n            C1File.WriteAllLines(filePath, new[] { \"That file is created for testing purpuses\" });\r\n\r\n            C1File.SetCreationTime(filePath, DateTime.Now.Subtract(TimeSpan.FromSeconds(45)));\r\n\r\n            FileUtils.Delete(filePath);\r\n            C1Directory.Delete(tempDirectory);\r\n        }\r\n\r\n\r\n        private bool BasePathNotToLong()\r\n        {\r\n            return Context.Server.MapPath(\"~\\\\\").Length <= GlobalSettingsFacade.MaximumRootPathLength;\r\n        }\r\n\r\n\r\n\r\n        private bool HasConnectionToPackageServer()\r\n        {\r\n            try\r\n            {\r\n                return SetupServiceFacade.PingServer();\r\n            }\r\n            catch (Exception)\r\n            {\r\n                if (RuntimeInformation.IsDebugBuild) throw;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n\r\n\r\n        private bool BrowserCheck()\r\n        {\r\n            return true; // Fake! This check is made by the client before this service is even invoked.\r\n        }\r\n\r\n        private bool WebServerVersionCheck()\r\n        {\r\n            string iisVersion = Context.Request.ServerVariables[\"SERVER_SOFTWARE\"];\r\n\r\n            return (iisVersion != \"Microsoft-IIS/5.0\") && (iisVersion != \"Microsoft-IIS/5.1\") && (iisVersion != \"Microsoft-IIS/6.0\") && (iisVersion != \"Microsoft-IIS/7.0\") && (iisVersion != \"Microsoft-IIS/7.5\");\r\n        }\r\n\r\n        private bool WebsocketCheck()\r\n        {\r\n            try\r\n            {\r\n                Context.AcceptWebSocketRequest( f=> null );\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return ex.HResult != -2146233031;\r\n            }\r\n\r\n            return false;\r\n        }\r\n\r\n        private bool DiskSpaceCheck()\r\n        {\r\n            try\r\n            {\r\n                string siteRoot = Context.Server.MapPath(\"~\\\\\");\r\n                string diskRoot = C1Directory.GetDirectoryRoot(siteRoot);\r\n\r\n                ulong lpFreeBytesAvailable, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes;\r\n\r\n                GetDiskFreeSpaceEx(diskRoot, out lpFreeBytesAvailable, out lpTotalNumberOfBytes, out lpTotalNumberOfFreeBytes);\r\n\r\n                // lpFreeBytesAvailable can be zero in certain hosting situations - the 0 check is a temp work around\r\n                return (lpFreeBytesAvailable == 0) || (lpFreeBytesAvailable > 40 * 1024 * 1024);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                if (RuntimeInformation.IsDebugBuild) throw;\r\n\r\n                return false;\r\n            }\r\n        }\r\n\r\n\r\n        public class CheckResult\r\n        {\r\n            public string Key { get; set; }\r\n            public string Title { get; set; }\r\n            public bool Success { get; set; }\r\n        }\r\n\r\n\r\n\r\n        public class LanguageDef\r\n        {\r\n            public String Title { get; set; }\r\n            public String Key { get; set; }\r\n            public bool Selected { get; set; }\r\n        }\r\n\r\n\r\n\r\n        [DllImport(\"kernel32\", CharSet = CharSet.Auto)]\r\n        static extern int GetDiskFreeSpaceEx(string lpDirectoryName, out ulong lpFreeBytesAvailable, out ulong lpTotalNumberOfBytes, out ulong lpTotalNumberOfFreeBytes);\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/services/Setup/web.config",
    "content": "<?xml version=\"1.0\"?>\r\n<configuration>\r\n\t<system.web>\r\n\t\t<httpRuntime executionTimeout=\"1200\"/>\r\n\t</system.web>\r\n</configuration>"
  },
  {
    "path": "Website/Composite/services/SourceEditor/MarkupFormatService.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.MarkupFormatService\" %>\r\n\r\nusing System;\r\nusing System.IO;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Web;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.WebClient.Services.WysiwygEditor;\r\nusing TidyNet;\r\n\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class MarkupFormatService : System.Web.Services.WebService\r\n    {\r\n        private XNamespace _tempNs = \"#MarkupFormatServiceTemp\";\r\n        private const string _nbsp = \"&nbsp;\";\r\n        private const string _nbspNumeric = \"&#160;\";\r\n\r\n        [WebMethod]\r\n        public string AutoIndentDocument(string xml)\r\n        {\r\n            try\r\n            {\r\n                var server = HttpContext.Current.Server;\r\n\r\n                string decodedXml = server.UrlDecode(xml);\r\n                string result = XhtmlPrettifier.Prettify(decodedXml);\r\n                return server.UrlEncode(result).Replace(\"+\", \"%20\");\r\n            }\r\n            catch (Exception)\r\n            {\r\n                throw;\r\n            }\r\n        }\r\n\r\n        [WebMethod]\r\n        public string AutoIndentXml(string xml)\r\n        {\r\n            try\r\n            {\r\n                var server = HttpContext.Current.Server;\r\n\r\n                string decodedXml = server.UrlDecode(xml);\r\n\r\n                StringBuilder sb = new StringBuilder();\r\n                XmlWriterSettings xws = new XmlWriterSettings();\r\n                xws.OmitXmlDeclaration = true;\r\n                xws.Indent = true;\r\n                xws.IndentChars = \"\\t\";\r\n                using (XmlWriter xw = XmlWriter.Create(sb, xws)) {\r\n                    XDocument.Parse(decodedXml).Save(xw);\r\n                }\r\n\r\n                var result = sb.ToString();\r\n                return server.UrlEncode(result).Replace(\"+\", \"%20\");\r\n            }\r\n            catch (Exception)\r\n            {\r\n                throw;\r\n            }\r\n        }\r\n\r\n        private static Tidy GetXhtml5ConfiguredTidy()\r\n        {\r\n            Tidy t = new Tidy();\r\n\r\n            t.Options.RawOut = true;\r\n            t.Options.TidyMark = false;\r\n\r\n            t.Options.CharEncoding = CharEncoding.UTF8;\r\n            t.Options.DocType = DocType.Omit;\r\n            t.Options.AllowElementPruning = false;\r\n            t.Options.WrapLen = 0;\r\n            t.Options.TabSize = 2;\r\n            t.Options.Spaces = 4;\r\n            t.Options.SmartIndent = false;\r\n\r\n            t.Options.BreakBeforeBR = false;\r\n            t.Options.DropEmptyParas = false;\r\n            t.Options.Word2000 = true;\r\n            t.Options.MakeClean = true;\r\n            t.Options.Xhtml = false;\r\n            t.Options.XmlOut = true;\r\n            t.Options.XmlTags = false;\r\n\r\n            t.Options.QuoteNbsp = false;\r\n            t.Options.NumEntities = true;\r\n\r\n            // Feed tidy the html5 specific tags...\r\n\t\t\tforeach (string elementName in MarkupTransformationServices.Html5specificElementNames)\r\n            {\r\n                t.Options.AddTag(elementName.ToLower());\r\n            }\r\n\r\n            \r\n            return t;\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/services/SourceEditor/SourceValidationService.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.SourceValidationService\" %>\r\n\r\nusing System;\r\nusing System.IO;\r\nusing Composite.Core.IO;\r\nusing System.Web;\r\nusing System.Web.Caching;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml;\r\nusing System.Xml.Linq;\r\nusing System.Xml.Schema;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.Xml;\r\n\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class SourceValidationService : System.Web.Services.WebService\r\n    {\r\n\r\n        /*\r\n         * Note that we return a string, not a boolean, in order \r\n         * to relay the exception message if things go wrong.\r\n         */\r\n        [WebMethod]\r\n        public string IsWellFormedDocument(string xml)\r\n        {\r\n            string result = \"True\";\r\n            try\r\n            {\r\n                XDocument.Parse(xml);\r\n            }\r\n            catch (XmlException exception)\r\n            {\r\n                result = exception.Message;\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public string IsWellFormedFragment(string xml)\r\n        {\r\n            string result = \"True\";\r\n            try\r\n            {\r\n                XmlDocument doc = new XmlDocument();\r\n                XmlDocumentFragment frag = doc.CreateDocumentFragment();\r\n                frag.InnerXml = xml;\r\n            }\r\n            catch (XmlException exception)\r\n            {\r\n                result = exception.Message;\r\n            }\r\n            return result;\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public string ValidateSource(string sourceToValidate, string validatorName)\r\n        {\r\n            string result = \"True\";\r\n            try\r\n            {\r\n                switch (validatorName)\r\n                {\r\n                    case \"http://www.composite.net/ns/function/1.0\":\r\n                        XmlReaderSettings settings = new XmlReaderSettings();\r\n                        settings.ValidationType = ValidationType.Schema;\r\n                        settings.ValidationEventHandler += ReaderValidationEventHandler;\r\n                        var schema = GetSchema(\"~/Composite/schemas/Functions/Function.xsd\");\r\n\r\n                        if (schema != null)\r\n                        {\r\n                            settings.Schemas.Add(schema);\r\n                        }\r\n\r\n                        using (XmlReader reader = XmlReader.Create(new StringReader(sourceToValidate), settings))\r\n                        {\r\n                            while (reader.Read()) { }\r\n                        }\r\n                        break;\r\n\r\n                    default:\r\n                        throw new ArgumentException(string.Format(\"Unknown validatorName '{0}' - have the editor been misconfigured?\", validatorName), \"validatorName\");\r\n                }\r\n            }\r\n            catch (XmlSchemaException e)\r\n            {\r\n                result = string.Format(\"{0}\\n\\nLine number {1}.\", e.Message, e.LineNumber);\r\n            }\r\n            return result;\r\n        }\r\n\r\n        private static void ReaderValidationEventHandler(object sender, ValidationEventArgs e)\r\n        {\r\n            throw e.Exception;\r\n        }\r\n\r\n\r\n        static XmlSchema GetSchema(string filePath)\r\n        {\r\n            try\r\n            {\r\n                filePath = HttpContext.Current.Server.MapPath(filePath);\r\n                string cacheKey = \"XmlSchema \" + filePath;\r\n\r\n                XmlSchema schema = HttpRuntime.Cache[cacheKey] as XmlSchema;\r\n                if (schema != null)\r\n                {\r\n                    return schema;\r\n                }\r\n\r\n                using (var file = C1File.Open(filePath, FileMode.Open, FileAccess.Read))\r\n                {\r\n                    schema = XmlSchema.Read(file, null);\r\n                }\r\n\r\n                HttpRuntime.Cache.Add(cacheKey, schema, new CacheDependency(filePath), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Default, null);\r\n\r\n                return schema;\r\n            }\r\n            catch (Exception e)\r\n            {\r\n                LoggingService.LogError(typeof(SourceValidationService).Name, new Exception(\"Failed to load XSD scheme\", e));\r\n                return null;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/StringResource/DiffService.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" Class=\"Composite.Services.DiffService\" %>\r\n\r\nusing System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Web.Services;\r\n\r\n\r\nnamespace Composite.Services\r\n{\r\n    /// <summary>\r\n    /// Summary description for Differ\r\n    /// </summary>\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n\t\r\n    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]\r\n    [System.ComponentModel.ToolboxItem(false)]\r\n    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. \r\n    // [System.Web.Script.Services.ScriptService]\r\n    public class DiffService : System.Web.Services.WebService\r\n    {\r\n        [Serializable]\r\n        public class DiffResult\r\n        {\r\n            public int DiffType;\r\n            public string[] Lines;\r\n        }\r\n\r\n        [WebMethod]\r\n        public List<DiffResult> GetDifference(string original, string modified, string separator)\r\n        {\r\n            original = original ?? string.Empty;\r\n            modified = modified ?? string.Empty;\r\n\r\n            var originalLines = new StringDiffSource(original, separator);\r\n            var modifiedLines = new StringDiffSource(modified, separator);\r\n\r\n            var diffEngine = new DiffEngine();\r\n            diffEngine.Level = DiffEngineLevel.SlowPerfect;\r\n            diffEngine.ProcessDiff(originalLines, modifiedLines);\r\n            var report = diffEngine.DiffReport();\r\n\r\n            var result = new List<DiffResult>();\r\n            foreach(var reportLine in report)\r\n            {\r\n                switch(reportLine.Status)\r\n                {\r\n                    case DiffResultSpanStatus.NoChange:\r\n                        var resultLines = new string[reportLine.Length];\r\n                        for(int i=0; i<reportLine.Length; i++)\r\n                        {\r\n                            resultLines[i] = originalLines.Lines[reportLine.SourceIndex + i];\r\n                        }\r\n\r\n                        result.Add(new DiffResult {DiffType = 0, Lines = resultLines});\r\n                        break;\r\n                    case DiffResultSpanStatus.DeleteSource:\r\n                        var resultLines2 = new string[reportLine.Length];\r\n                        for (int i = 0; i < reportLine.Length; i++)\r\n                        {\r\n                            resultLines2[i] = originalLines.Lines[reportLine.SourceIndex + i];\r\n                        }\r\n\r\n                        result.Add(new DiffResult { DiffType = 1, Lines = resultLines2 });\r\n                        break;\r\n                    case DiffResultSpanStatus.AddDestination:\r\n                        var resultLines3 = new string[reportLine.Length];\r\n                        for (int i = 0; i < reportLine.Length; i++)\r\n                        {\r\n                            resultLines3[i] = modifiedLines.Lines[reportLine.DestIndex + i];\r\n                        }\r\n\r\n                        result.Add(new DiffResult { DiffType = 2, Lines = resultLines3 });\r\n                        break;\r\n                    case DiffResultSpanStatus.Replace:\r\n                        var resultLines4 = new string[reportLine.Length];\r\n                        for (int i = 0; i < reportLine.Length; i++)\r\n                        {\r\n                            resultLines4[i] = originalLines.Lines[reportLine.SourceIndex + i];\r\n                        }\r\n\r\n                        result.Add(new DiffResult { DiffType = 1, Lines = resultLines4 });\r\n\r\n                        var resultLines5 = new string[reportLine.Length];\r\n                        for (int i = 0; i < reportLine.Length; i++)\r\n                        {\r\n                            resultLines5[i] = modifiedLines.Lines[reportLine.DestIndex + i];\r\n                        }\r\n\r\n                        result.Add(new DiffResult { DiffType = 2, Lines = resultLines5 });\r\n                        break;\r\n\r\n                    default:\r\n                        // Do nothing;\r\n                        break;\r\n                }\r\n            }\r\n            return result;\r\n        }\r\n\r\n        public class StringDiffSource : IDiffList\r\n        {\r\n            public string[] Lines { get; private set; }\r\n\r\n            public StringDiffSource(string source, string separator)\r\n            {\r\n                Lines = source.Split(new string[] { separator }, StringSplitOptions.None);\r\n            }\r\n\r\n            public int Count()\r\n            {\r\n                return Lines.Length;\r\n            }\r\n\r\n            public IComparable GetByIndex(int index)\r\n            {\r\n                return Lines[index];\r\n            }\r\n        }\r\n\r\n        #region Diff tool source\r\n\r\n        public interface IDiffList\r\n        {\r\n            int Count();\r\n            IComparable GetByIndex(int index);\r\n        }\r\n\r\n        internal enum DiffStatus\r\n        {\r\n            Matched = 1,\r\n            NoMatch = -1,\r\n            Unknown = -2\r\n\r\n        }\r\n\r\n        internal class DiffState\r\n        {\r\n            private const int BAD_INDEX = -1;\r\n            private int _startIndex;\r\n            private int _length;\r\n\r\n            public int StartIndex { get { return _startIndex; } }\r\n            public int EndIndex { get { return ((_startIndex + _length) - 1); } }\r\n            public int Length\r\n            {\r\n                get\r\n                {\r\n                    int len;\r\n                    if (_length > 0)\r\n                    {\r\n                        len = _length;\r\n                    }\r\n                    else\r\n                    {\r\n                        if (_length == 0)\r\n                        {\r\n                            len = 1;\r\n                        }\r\n                        else\r\n                        {\r\n                            len = 0;\r\n                        }\r\n                    }\r\n                    return len;\r\n                }\r\n            }\r\n            public DiffStatus Status\r\n            {\r\n                get\r\n                {\r\n                    DiffStatus stat;\r\n                    if (_length > 0)\r\n                    {\r\n                        stat = DiffStatus.Matched;\r\n                    }\r\n                    else\r\n                    {\r\n                        switch (_length)\r\n                        {\r\n                            case -1:\r\n                                stat = DiffStatus.NoMatch;\r\n                                break;\r\n                            default:\r\n                                System.Diagnostics.Debug.Assert(_length == -2, \"Invalid status: _length < -2\");\r\n                                stat = DiffStatus.Unknown;\r\n                                break;\r\n                        }\r\n                    }\r\n                    return stat;\r\n                }\r\n            }\r\n\r\n            public DiffState()\r\n            {\r\n                SetToUnknown();\r\n            }\r\n\r\n            protected void SetToUnknown()\r\n            {\r\n                _startIndex = BAD_INDEX;\r\n                _length = (int)DiffStatus.Unknown;\r\n            }\r\n\r\n            public void SetMatch(int start, int length)\r\n            {\r\n                System.Diagnostics.Debug.Assert(length > 0, \"Length must be greater than zero\");\r\n                System.Diagnostics.Debug.Assert(start >= 0, \"Start must be greater than or equal to zero\");\r\n                _startIndex = start;\r\n                _length = length;\r\n            }\r\n\r\n            public void SetNoMatch()\r\n            {\r\n                _startIndex = BAD_INDEX;\r\n                _length = (int)DiffStatus.NoMatch;\r\n            }\r\n\r\n\r\n            public bool HasValidLength(int newStart, int newEnd, int maxPossibleDestLength)\r\n            {\r\n                if (_length > 0) //have unlocked match\r\n                {\r\n                    if ((maxPossibleDestLength < _length) ||\r\n                        ((_startIndex < newStart) || (EndIndex > newEnd)))\r\n                    {\r\n                        SetToUnknown();\r\n                    }\r\n                }\r\n                return (_length != (int)DiffStatus.Unknown);\r\n            }\r\n        }\r\n\r\n        internal class DiffStateList\r\n        {\r\n#if USE_HASH_TABLE\r\n\t\tprivate Hashtable _table;\r\n#else\r\n            private DiffState[] _array;\r\n#endif\r\n            public DiffStateList(int destCount)\r\n            {\r\n#if USE_HASH_TABLE\r\n\t\t\t_table = new Hashtable(Math.Max(9,destCount/10));\r\n#else\r\n                _array = new DiffState[destCount];\r\n#endif\r\n            }\r\n\r\n            public DiffState GetByIndex(int index)\r\n            {\r\n#if USE_HASH_TABLE\r\n\t\t\tDiffState retval = (DiffState)_table[index];\r\n\t\t\tif (retval == null)\r\n\t\t\t{\r\n\t\t\t\tretval = new DiffState();\r\n\t\t\t\t_table.Add(index,retval);\r\n\t\t\t}\r\n#else\r\n                DiffState retval = _array[index];\r\n                if (retval == null)\r\n                {\r\n                    retval = new DiffState();\r\n                    _array[index] = retval;\r\n                }\r\n#endif\r\n                return retval;\r\n            }\r\n        }\r\n\r\n\r\n        public enum DiffResultSpanStatus\r\n        {\r\n            NoChange,\r\n            Replace,\r\n            DeleteSource,\r\n            AddDestination\r\n        }\r\n\r\n        public class DiffResultSpan : IComparable\r\n        {\r\n            private const int BAD_INDEX = -1;\r\n            private int _destIndex;\r\n            private int _sourceIndex;\r\n            private int _length;\r\n            private DiffResultSpanStatus _status;\r\n\r\n            public int DestIndex { get { return _destIndex; } }\r\n            public int SourceIndex { get { return _sourceIndex; } }\r\n            public int Length { get { return _length; } }\r\n            public DiffResultSpanStatus Status { get { return _status; } }\r\n\r\n            protected DiffResultSpan(\r\n                DiffResultSpanStatus status,\r\n                int destIndex,\r\n                int sourceIndex,\r\n                int length)\r\n            {\r\n                _status = status;\r\n                _destIndex = destIndex;\r\n                _sourceIndex = sourceIndex;\r\n                _length = length;\r\n            }\r\n\r\n            public static DiffResultSpan CreateNoChange(int destIndex, int sourceIndex, int length)\r\n            {\r\n                return new DiffResultSpan(DiffResultSpanStatus.NoChange, destIndex, sourceIndex, length);\r\n            }\r\n\r\n            public static DiffResultSpan CreateReplace(int destIndex, int sourceIndex, int length)\r\n            {\r\n                return new DiffResultSpan(DiffResultSpanStatus.Replace, destIndex, sourceIndex, length);\r\n            }\r\n\r\n            public static DiffResultSpan CreateDeleteSource(int sourceIndex, int length)\r\n            {\r\n                return new DiffResultSpan(DiffResultSpanStatus.DeleteSource, BAD_INDEX, sourceIndex, length);\r\n            }\r\n\r\n            public static DiffResultSpan CreateAddDestination(int destIndex, int length)\r\n            {\r\n                return new DiffResultSpan(DiffResultSpanStatus.AddDestination, destIndex, BAD_INDEX, length);\r\n            }\r\n\r\n            public void AddLength(int i)\r\n            {\r\n                _length += i;\r\n            }\r\n\r\n            public override string ToString()\r\n            {\r\n                return string.Format(\"{0} (Dest: {1},Source: {2}) {3}\",\r\n                    _status.ToString(),\r\n                    _destIndex.ToString(),\r\n                    _sourceIndex.ToString(),\r\n                    _length.ToString());\r\n            }\r\n            #region IComparable Members\r\n\r\n            public int CompareTo(object obj)\r\n            {\r\n                return _destIndex.CompareTo(((DiffResultSpan)obj)._destIndex);\r\n            }\r\n\r\n            #endregion\r\n        }\r\n\r\n        public enum DiffEngineLevel\r\n        {\r\n            FastImperfect,\r\n            Medium,\r\n            SlowPerfect\r\n        }\r\n\r\n        public class DiffEngine\r\n        {\r\n            private IDiffList _source;\r\n            private IDiffList _dest;\r\n            private ArrayList _matchList;\r\n\r\n            private DiffEngineLevel _level;\r\n\r\n            private DiffStateList _stateList;\r\n\r\n            public DiffEngineLevel Level\r\n            {\r\n                set { _level = value; }\r\n            }\r\n\r\n            public DiffEngine()\r\n            {\r\n                _source = null;\r\n                _dest = null;\r\n                _matchList = null;\r\n                _stateList = null;\r\n                _level = DiffEngineLevel.FastImperfect;\r\n            }\r\n\r\n            private int GetSourceMatchLength(int destIndex, int sourceIndex, int maxLength)\r\n            {\r\n                int matchCount;\r\n                for (matchCount = 0; matchCount < maxLength; matchCount++)\r\n                {\r\n                    if (_dest.GetByIndex(destIndex + matchCount).CompareTo(_source.GetByIndex(sourceIndex + matchCount)) != 0)\r\n                    {\r\n                        break;\r\n                    }\r\n                }\r\n                return matchCount;\r\n            }\r\n\r\n            private void GetLongestSourceMatch(DiffState curItem, int destIndex, int destEnd, int sourceStart, int sourceEnd)\r\n            {\r\n\r\n                int maxDestLength = (destEnd - destIndex) + 1;\r\n                int curLength = 0;\r\n                int curBestLength = 0;\r\n                int curBestIndex = -1;\r\n                int maxLength = 0;\r\n                for (int sourceIndex = sourceStart; sourceIndex <= sourceEnd; sourceIndex++)\r\n                {\r\n                    maxLength = Math.Min(maxDestLength, (sourceEnd - sourceIndex) + 1);\r\n                    if (maxLength <= curBestLength)\r\n                    {\r\n                        //No chance to find a longer one any more\r\n                        break;\r\n                    }\r\n                    curLength = GetSourceMatchLength(destIndex, sourceIndex, maxLength);\r\n                    if (curLength > curBestLength)\r\n                    {\r\n                        //This is the best match so far\r\n                        curBestIndex = sourceIndex;\r\n                        curBestLength = curLength;\r\n                    }\r\n                    //jump over the match\r\n                    sourceIndex += curBestLength;\r\n                }\r\n                //DiffState cur = _stateList.GetByIndex(destIndex);\r\n                if (curBestIndex == -1)\r\n                {\r\n                    curItem.SetNoMatch();\r\n                }\r\n                else\r\n                {\r\n                    curItem.SetMatch(curBestIndex, curBestLength);\r\n                }\r\n\r\n            }\r\n\r\n            private void ProcessRange(int destStart, int destEnd, int sourceStart, int sourceEnd)\r\n            {\r\n                int curBestIndex = -1;\r\n                int curBestLength = -1;\r\n                int maxPossibleDestLength = 0;\r\n                DiffState curItem = null;\r\n                DiffState bestItem = null;\r\n                for (int destIndex = destStart; destIndex <= destEnd; destIndex++)\r\n                {\r\n                    maxPossibleDestLength = (destEnd - destIndex) + 1;\r\n                    if (maxPossibleDestLength <= curBestLength)\r\n                    {\r\n                        //we won't find a longer one even if we looked\r\n                        break;\r\n                    }\r\n                    curItem = _stateList.GetByIndex(destIndex);\r\n\r\n                    if (!curItem.HasValidLength(sourceStart, sourceEnd, maxPossibleDestLength))\r\n                    {\r\n                        //recalc new best length since it isn't valid or has never been done.\r\n                        GetLongestSourceMatch(curItem, destIndex, destEnd, sourceStart, sourceEnd);\r\n                    }\r\n                    if (curItem.Status == DiffStatus.Matched)\r\n                    {\r\n                        switch (_level)\r\n                        {\r\n                            case DiffEngineLevel.FastImperfect:\r\n                                if (curItem.Length > curBestLength)\r\n                                {\r\n                                    //this is longest match so far\r\n                                    curBestIndex = destIndex;\r\n                                    curBestLength = curItem.Length;\r\n                                    bestItem = curItem;\r\n                                }\r\n                                //Jump over the match \r\n                                destIndex += curItem.Length - 1;\r\n                                break;\r\n                            case DiffEngineLevel.Medium:\r\n                                if (curItem.Length > curBestLength)\r\n                                {\r\n                                    //this is longest match so far\r\n                                    curBestIndex = destIndex;\r\n                                    curBestLength = curItem.Length;\r\n                                    bestItem = curItem;\r\n                                    //Jump over the match \r\n                                    destIndex += curItem.Length - 1;\r\n                                }\r\n                                break;\r\n                            default:\r\n                                if (curItem.Length > curBestLength)\r\n                                {\r\n                                    //this is longest match so far\r\n                                    curBestIndex = destIndex;\r\n                                    curBestLength = curItem.Length;\r\n                                    bestItem = curItem;\r\n                                }\r\n                                break;\r\n                        }\r\n                    }\r\n                }\r\n                if (curBestIndex < 0)\r\n                {\r\n                    //we are done - there are no matches in this span\r\n                }\r\n                else\r\n                {\r\n\r\n                    int sourceIndex = bestItem.StartIndex;\r\n                    _matchList.Add(DiffResultSpan.CreateNoChange(curBestIndex, sourceIndex, curBestLength));\r\n                    if (destStart < curBestIndex)\r\n                    {\r\n                        //Still have more lower destination data\r\n                        if (sourceStart < sourceIndex)\r\n                        {\r\n                            //Still have more lower source data\r\n                            // Recursive call to process lower indexes\r\n                            ProcessRange(destStart, curBestIndex - 1, sourceStart, sourceIndex - 1);\r\n                        }\r\n                    }\r\n                    int upperDestStart = curBestIndex + curBestLength;\r\n                    int upperSourceStart = sourceIndex + curBestLength;\r\n                    if (destEnd > upperDestStart)\r\n                    {\r\n                        //we still have more upper dest data\r\n                        if (sourceEnd > upperSourceStart)\r\n                        {\r\n                            //set still have more upper source data\r\n                            // Recursive call to process upper indexes\r\n                            ProcessRange(upperDestStart, destEnd, upperSourceStart, sourceEnd);\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            public double ProcessDiff(IDiffList source, IDiffList destination, DiffEngineLevel level)\r\n            {\r\n                _level = level;\r\n                return ProcessDiff(source, destination);\r\n            }\r\n\r\n            public double ProcessDiff(IDiffList source, IDiffList destination)\r\n            {\r\n                DateTime dt = DateTime.Now;\r\n                _source = source;\r\n                _dest = destination;\r\n                _matchList = new ArrayList();\r\n\r\n                int dcount = _dest.Count();\r\n                int scount = _source.Count();\r\n\r\n\r\n                if ((dcount > 0) && (scount > 0))\r\n                {\r\n                    _stateList = new DiffStateList(dcount);\r\n                    ProcessRange(0, dcount - 1, 0, scount - 1);\r\n                }\r\n\r\n                TimeSpan ts = DateTime.Now - dt;\r\n                return ts.TotalSeconds;\r\n            }\r\n\r\n\r\n            private bool AddChanges(\r\n                List<DiffResultSpan> report,\r\n                int curDest,\r\n                int nextDest,\r\n                int curSource,\r\n                int nextSource)\r\n            {\r\n                bool retval = false;\r\n                int diffDest = nextDest - curDest;\r\n                int diffSource = nextSource - curSource;\r\n                int minDiff = 0;\r\n                if (diffDest > 0)\r\n                {\r\n                    if (diffSource > 0)\r\n                    {\r\n                        minDiff = Math.Min(diffDest, diffSource);\r\n                        report.Add(DiffResultSpan.CreateReplace(curDest, curSource, minDiff));\r\n                        if (diffDest > diffSource)\r\n                        {\r\n                            curDest += minDiff;\r\n                            report.Add(DiffResultSpan.CreateAddDestination(curDest, diffDest - diffSource));\r\n                        }\r\n                        else\r\n                        {\r\n                            if (diffSource > diffDest)\r\n                            {\r\n                                curSource += minDiff;\r\n                                report.Add(DiffResultSpan.CreateDeleteSource(curSource, diffSource - diffDest));\r\n                            }\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        report.Add(DiffResultSpan.CreateAddDestination(curDest, diffDest));\r\n                    }\r\n                    retval = true;\r\n                }\r\n                else\r\n                {\r\n                    if (diffSource > 0)\r\n                    {\r\n                        report.Add(DiffResultSpan.CreateDeleteSource(curSource, diffSource));\r\n                        retval = true;\r\n                    }\r\n                }\r\n                return retval;\r\n            }\r\n\r\n            public List<DiffResultSpan> DiffReport()\r\n            {\r\n                var retval = new List<DiffResultSpan>();\r\n                int dcount = _dest.Count();\r\n                int scount = _source.Count();\r\n\r\n                //Deal with the special case of empty files\r\n                if (dcount == 0)\r\n                {\r\n                    if (scount > 0)\r\n                    {\r\n                        retval.Add(DiffResultSpan.CreateDeleteSource(0, scount));\r\n                    }\r\n                    return retval;\r\n                }\r\n                else\r\n                {\r\n                    if (scount == 0)\r\n                    {\r\n                        retval.Add(DiffResultSpan.CreateAddDestination(0, dcount));\r\n                        return retval;\r\n                    }\r\n                }\r\n\r\n\r\n                _matchList.Sort();\r\n                int curDest = 0;\r\n                int curSource = 0;\r\n                DiffResultSpan last = null;\r\n\r\n                //Process each match record\r\n                foreach (DiffResultSpan drs in _matchList)\r\n                {\r\n                    if ((!AddChanges(retval, curDest, drs.DestIndex, curSource, drs.SourceIndex)) &&\r\n                        (last != null))\r\n                    {\r\n                        last.AddLength(drs.Length);\r\n                    }\r\n                    else\r\n                    {\r\n                        retval.Add(drs);\r\n                    }\r\n                    curDest = drs.DestIndex + drs.Length;\r\n                    curSource = drs.SourceIndex + drs.Length;\r\n                    last = drs;\r\n                }\r\n\r\n                //Process any tail end data\r\n                AddChanges(retval, curDest, dcount, curSource, scount);\r\n\r\n                return retval;\r\n            }\r\n        }\r\n\r\n\r\n        #endregion Diff tool source\r\n    }\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Composite/services/StringResource/StringService.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" CodeBehind=\"~/App_Code/StringService.cs\" Class=\"Composite.Services.StringService\" %>\r\n\r\nusing System;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Collections;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml.Linq;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class StringService : System.Web.Services.WebService\r\n    {\r\n\r\n        public StringService()\r\n        {\r\n\r\n            //Uncomment the following line if using designed components \r\n            //InitializeComponent(); \r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public List<KeyValuePair> GetLocalisation(string resourceStoreName)\r\n        {\r\n            return Composite.Core.ResourceSystem.StringResourceSystemFacade.GetLocalization(resourceStoreName);\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/Tree/SecurityServices.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" Class=\"Composite.Services.SecurityServices\" %>\r\n\r\nusing System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Security;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\n\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.Services.SecurityServiceObjets;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Services\r\n{\r\n\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class SecurityServices : WebService\r\n    {\r\n\r\n        [WebMethod]\r\n        public List<KeyValuePair> GetPermissionTypes(string dummy)\r\n        {\r\n            return new List<KeyValuePair>(\r\n                PermissionTypeFacade.GrantingPermissionDescriptors.Select(f => new KeyValuePair(f.PermissionType.ToString(), f.Label))\r\n            );\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public EntityPermissionDetails PreviewGetPermissions(string serializedEntityToken, List<UserPermissions> entityUserPermissions, List<UserPermissions> entityUserGroupPermissions)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(serializedEntityToken, \"serializedEntityToken\");\r\n\r\n            UserToken userToken = UserValidationFacade.GetUserToken();\r\n            EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            AdminRightsSecurityCheck(userToken, entityToken);\r\n\r\n            List<UserPermissions> entityPermissions = new List<UserPermissions>();\r\n            List<UserPermissions> inheritedPermissions = new List<UserPermissions>();\r\n            foreach (string username in UserValidationFacade.AllUsernames.OrderBy(f => f))\r\n            {\r\n                var dataUserToken = new UserToken(username);\r\n\r\n                var userGroupIds = UserGroupFacade.GetUserGroupIds(username);\r\n\r\n                Dictionary<Guid, IEnumerable<PermissionType>> presetUserGroupPermissions = new Dictionary<Guid, IEnumerable<PermissionType>>();\r\n                foreach (UserPermissions userPermissions in entityUserGroupPermissions.OrderBy(f => f.UserName))\r\n                {\r\n                    Guid userGroupId =\r\n                       (from ug in DataFacade.GetData<IUserGroup>()\r\n                        where ug.Name == userPermissions.UserName\r\n                        select ug.Id).Single();\r\n\r\n                    if (userGroupIds.Contains(userGroupId))\r\n                    {\r\n                        presetUserGroupPermissions.Add(userGroupId, GetPermissionTypes(userPermissions));\r\n                    }\r\n                }\r\n\r\n                List<string> usersInheritedPermissions = PermissionTypeFacade.GetInheritedPermissionsTypes(dataUserToken, entityToken, presetUserGroupPermissions).Select(f => f.ToString()).ToList();\r\n                usersInheritedPermissions.Remove(PermissionType.ClearPermissions.ToString());\r\n                inheritedPermissions.Add(new UserPermissions { UserName = username, PermissionTypes = usersInheritedPermissions });\r\n\r\n                UserPermissions presetUserPermissions = entityUserPermissions.SingleOrDefault(f => f.UserName == username);\r\n                if (presetUserPermissions == null)\r\n                {\r\n                    List<string> usersEntityPermissions = PermissionTypeFacade.GetLocallyDefinedUserPermissionTypes(dataUserToken, entityToken).Select(f => f.ToString()).ToList();\r\n                    if (usersEntityPermissions.Any())\r\n                    {\r\n                        usersEntityPermissions.Remove(PermissionType.ClearPermissions.ToString());\r\n                        entityPermissions.Add(new UserPermissions { UserName = username, PermissionTypes = usersEntityPermissions });\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    entityPermissions.Add(presetUserPermissions);\r\n                }\r\n            }\r\n\r\n            return new EntityPermissionDetails\r\n            {\r\n                EntityUserPermissions = entityPermissions,\r\n                InheritedUserPermissions = inheritedPermissions\r\n            };\r\n        }\r\n\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public EntityPermissionDetails GetPermissions(string serializedEntityToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(serializedEntityToken, \"serializedEntityToken\");\r\n\r\n            UserToken userToken = UserValidationFacade.GetUserToken();\r\n            EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            AdminRightsSecurityCheck(userToken, entityToken);\r\n\r\n            List<UserPermissions> entityPermissions = new List<UserPermissions>();\r\n            List<UserPermissions> inheritedPermissions = new List<UserPermissions>();\r\n            foreach (string username in UserValidationFacade.AllUsernames.OrderBy(f => f))\r\n            {\r\n                UserToken dataUserToken = new UserToken(username);\r\n\r\n                List<string> usersInheritedPermissions = PermissionTypeFacade.GetInheritedPermissionsTypes(dataUserToken, entityToken).Select(f => f.ToString()).ToList();\r\n                usersInheritedPermissions.Remove(PermissionType.ClearPermissions.ToString());\r\n                inheritedPermissions.Add(new UserPermissions { UserName = username, PermissionTypes = usersInheritedPermissions });\r\n\r\n                List<string> usersEntityPermissions = PermissionTypeFacade.GetLocallyDefinedUserPermissionTypes(dataUserToken, entityToken).Select(f => f.ToString()).ToList();\r\n                if (usersEntityPermissions.Any())\r\n                {\r\n                    usersEntityPermissions.Remove(PermissionType.ClearPermissions.ToString());\r\n                    entityPermissions.Add(new UserPermissions { UserName = username, PermissionTypes = usersEntityPermissions });\r\n                }\r\n            }\r\n\r\n            return new EntityPermissionDetails\r\n            {\r\n                EntityUserPermissions = entityPermissions,\r\n                InheritedUserPermissions = inheritedPermissions\r\n            };\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public EntityPermissionDetails GetGroupPermissions(string serializedEntityToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(serializedEntityToken, \"serializedEntityToken\");\r\n\r\n            UserToken userToken = UserValidationFacade.GetUserToken();\r\n            EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            AdminRightsSecurityCheck(userToken, entityToken);\r\n\r\n            List<UserPermissions> entityPermissions = new List<UserPermissions>();\r\n            List<UserPermissions> inheritedPermissions = new List<UserPermissions>();\r\n\r\n            List<IUserGroup> userGroups = DataFacade.GetData<IUserGroup>().ToList();\r\n            foreach (IUserGroup userGroup in userGroups.OrderBy(f => f.Name))\r\n            {\r\n                List<string> usersInheritedPermissions = PermissionTypeFacade.GetInheritedGroupPermissionsTypes(userGroup.Id, entityToken).Select(f => f.ToString()).ToList();\r\n                usersInheritedPermissions.Remove(PermissionType.ClearPermissions.ToString());\r\n                inheritedPermissions.Add(new UserPermissions { UserName = userGroup.Name, PermissionTypes = usersInheritedPermissions });\r\n\r\n                List<string> usersEntityPermissions = PermissionTypeFacade.GetLocallyDefinedUserGroupPermissionTypes(userGroup.Id, entityToken).Select(f => f.ToString()).ToList();\r\n                if (usersEntityPermissions.Any())\r\n                {\r\n                    usersEntityPermissions.Remove(PermissionType.ClearPermissions.ToString());\r\n                    entityPermissions.Add(new UserPermissions { UserName = userGroup.Name, PermissionTypes = usersEntityPermissions });\r\n                }\r\n            }\r\n\r\n            return new EntityPermissionDetails\r\n            {\r\n                EntityUserPermissions = entityPermissions,\r\n                InheritedUserPermissions = inheritedPermissions\r\n            };\r\n        }\r\n\r\n        private string AdminLockoutMessage\r\n        {\r\n            get\r\n            {\r\n                return StringResourceSystemFacade.GetString(\"Composite.Permissions\",\"AdminLockoutMessage\");\r\n            }\r\n        }\r\n\r\n        private void AdminRightsSecurityCheck(UserToken userToken, EntityToken entityToken)\r\n        {\r\n            if (PermissionTypeFacade.GetCurrentPermissionTypes(userToken, entityToken,\r\n                                                                PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username),\r\n                                                                PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username))\r\n                                                                .All(f => f != PermissionType.Administrate))\r\n            {\r\n                throw new SecurityException(\"You do not have administrative permissions to this entity\");\r\n            }\r\n        }\r\n        \r\n\r\n        [WebMethod]\r\n        public string SetAllPermissions(string serializedEntityToken, List<UserPermissions> entityUserPermissions, List<UserPermissions> entityUserGroupPermissions, string viewId, string consoleId)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(serializedEntityToken, \"serializedEntityToken\");\r\n\r\n            UserToken userToken = UserValidationFacade.GetUserToken();\r\n            EntityToken entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n            AdminRightsSecurityCheck(userToken, entityToken);\r\n\r\n            if (!CheckNotRemovingOwnAdminRights(entityUserPermissions, entityUserGroupPermissions, userToken, entityToken))\r\n            {\r\n                return AdminLockoutMessage;\r\n            }\r\n\r\n\r\n            // User permissions\r\n            foreach (UserPermissions userPermissions in entityUserPermissions)\r\n            {\r\n                UserPermissionDefinition newSet = new ConstructorBasedUserPermissionDefinition(\r\n                    userPermissions.UserName,\r\n                    GetPermissionTypes(userPermissions),\r\n                    serializedEntityToken);\r\n\r\n                PermissionTypeFacade.SetUserPermissionDefinition(newSet);\r\n            }\r\n\r\n            foreach (string undefinedUsername in UserValidationFacade.AllUsernames.Where(f => entityUserPermissions.Any(g => g.UserName == f) == false))\r\n            {\r\n                PermissionTypeFacade.RemoveUserPermissionDefinition(new UserToken(undefinedUsername), entityToken);\r\n            }\r\n\r\n\r\n            // User groups permissions\r\n            List<Guid> changedUserGroupIds = new List<Guid>();\r\n            foreach (UserPermissions userGroupPermissions in entityUserGroupPermissions)\r\n            {\r\n                Guid userGroupId =\r\n                    (from ug in DataFacade.GetData<IUserGroup>()\r\n                     where ug.Name == userGroupPermissions.UserName\r\n                     select ug.Id).Single();\r\n\r\n                UserGroupPermissionDefinition newSet = new ConstructorBasedUserGroupPermissionDefinition(\r\n                    userGroupId,\r\n                    GetPermissionTypes(userGroupPermissions),\r\n                    serializedEntityToken);\r\n\r\n                PermissionTypeFacade.SetUserGroupPermissionDefinition(newSet);\r\n\r\n                changedUserGroupIds.Add(userGroupId);\r\n            }\r\n\r\n\r\n            List<Guid> allUserGroupIds = DataFacade.GetData<IUserGroup>().Select(f => f.Id).ToList();\r\n\r\n            IEnumerable<Guid> userGroupIdsToBeRemoved = allUserGroupIds.Except(changedUserGroupIds);\r\n            foreach (Guid userGroupId in userGroupIdsToBeRemoved)\r\n            {\r\n                PermissionTypeFacade.RemoveUserPermissionDefinition(userGroupId, entityToken);\r\n            }\r\n\r\n\r\n\t\t\tLoggingService.LogVerbose(\"UserManagement\", String.Format(\"C1 Console element permission change done by '{1}'. Changed element is '{0}'.\", entityToken.Serialize(), UserValidationFacade.GetUsername()), LoggingService.Category.Audit);\r\n\t\t\t\r\n            ConsoleMessageQueueFacade.Enqueue(new SaveStatusConsoleMessageQueueItem { ViewId = viewId, Succeeded = true }, consoleId);\r\n\r\n            return \"\";\r\n        }\r\n\r\n        private bool CheckNotRemovingOwnAdminRights(IList<UserPermissions> entityUserPermissions, \r\n                                                    IList<UserPermissions> entityUserGroupPermissions,\r\n                                                    UserToken userToken, \r\n                                                    EntityToken entityToken)\r\n        {\r\n            bool checkInheritance = true;\r\n            UserPermissions entityUserPermission = entityUserPermissions.FirstOrDefault(f => f.UserName == userToken.Username);\r\n            if (entityUserPermission != null)\r\n            {\r\n                checkInheritance = false;\r\n                if (!entityUserPermission.PermissionTypes.Contains(PermissionType.Administrate.ToString()))\r\n                {\r\n                    return false;\r\n                }\r\n            }\r\n\r\n            bool? adminPermissionsSet = null;\r\n            var userGroupIds = UserGroupFacade.GetUserGroupIds(userToken.Username);\r\n            foreach (Guid userGroupId in userGroupIds)\r\n            {\r\n                IUserGroup userGroup = DataFacade.GetData<IUserGroup>(f => f.Id == userGroupId).Single();\r\n\r\n                UserPermissions entityUserGroupPermission = entityUserGroupPermissions.FirstOrDefault(f => f.UserName == userGroup.Name);\r\n                if (entityUserGroupPermission != null)\r\n                {\r\n                    checkInheritance = false;\r\n\r\n                    if (!adminPermissionsSet.HasValue || !adminPermissionsSet.Value)\r\n                    {\r\n                        adminPermissionsSet = entityUserGroupPermission.PermissionTypes.Contains(PermissionType.Administrate.ToString());\r\n                    }\r\n\r\n                    if (entityUserGroupPermission.PermissionTypes.Count == 0)\r\n                    {\r\n                        adminPermissionsSet = false;\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (adminPermissionsSet.HasValue && !adminPermissionsSet.Value)\r\n            {\r\n                return false;\r\n            }\r\n\r\n            return !checkInheritance || PermissionTypeFacade.GetInheritedPermissionsTypes(userToken, entityToken).Any(f => f == PermissionType.Administrate);\r\n        }\r\n\r\n\r\n        private IEnumerable<PermissionType> GetPermissionTypes(UserPermissions userPermissions)\r\n        {\r\n            if (userPermissions.PermissionTypes.Any())\r\n            {\r\n                foreach (string permissionTypeString in userPermissions.PermissionTypes)\r\n                {\r\n                    yield return (PermissionType)Enum.Parse(typeof(PermissionType), permissionTypeString);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                yield return PermissionType.ClearPermissions;\r\n            }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/Tree/TreeServices.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.TreeServices\" %>\r\n\r\nusing System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text.RegularExpressions;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Actions;\r\nusing Composite.C1Console.Events;\r\nusing Composite.C1Console.Elements;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.Routing;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.WebClient.Services.TreeServiceObjects;\r\nusing Composite.Core.WebClient.FlowMediators;\r\nusing Composite.Core.WebClient.Services.TreeServiceObjects.ExtensionMethods;\r\nusing Composite.Data;\r\nusing Composite.Data.ProcessControlled;\r\nusing Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;\r\nusing Composite.Data.Types;\r\nusing Composite.Core.Extensions;\r\nusing Texts = Composite.Core.ResourceSystem.LocalizationFiles.Composite_Plugins_PageElementProvider;\r\n\r\n// Search token stuff\r\nusing Composite.Plugins.Elements.ElementProviders.MediaFileProviderElementProvider;\r\nusing Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider;\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class TreeServices : WebService\r\n    {\r\n        private const string LogTitle = \"TreeService\";\r\n\r\n        private void RemoveDuplicateActions(List<ClientElement> listToClean)\r\n        {\r\n            var knownActionKeys = new List<string>();\r\n            foreach (ClientElement clientElement in listToClean)\r\n            {\r\n                clientElement.Actions.RemoveAll(f => knownActionKeys.Contains(f.ActionKey));\r\n                knownActionKeys.AddRange(clientElement.ActionKeys.Where(f => !knownActionKeys.Contains(f)));\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public List<ClientElement> GetActivePerspectiveElements(string dummy)\r\n        {\r\n            try\r\n            {\r\n                string username = UserValidationFacade.GetUsername();\r\n\r\n                List<Element> allPerspectives = ElementFacade.GetPerspectiveElementsWithNoSecurity().ToList();\r\n                List<string> activePerspectiveEntityTokens =\r\n                        UserPerspectiveFacade.GetSerializedEntityTokens(username)\r\n                        .Concat(UserGroupPerspectiveFacade.GetSerializedEntityTokens(username))\r\n                        .Distinct().ToList();\r\n\r\n                List<ClientElement> activePerspectives = allPerspectives\r\n                        .Where(f => activePerspectiveEntityTokens.Contains(EntityTokenSerializer.Serialize(f.ElementHandle.EntityToken)))\r\n                        .FilterElementsAndActions()\r\n                        .ToList().ToClientElementList();\r\n\r\n                return activePerspectives;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(LogTitle, \"Unable to get any perspectives, console will not work!\");\r\n                Log.LogCritical(LogTitle, ex);\r\n                return new List<ClientElement>();\r\n            }\r\n        }\r\n\r\n        [WebMethod]\r\n        public List<ClientElement> GetUnpublishedElements(string dummy)\r\n        {\r\n            var rootElement = ElementFacade.GetPerspectiveElements(false)\r\n                    .FirstOrDefault(e => e.TagValue == \"Content\");\r\n\r\n            var allElements = GetPublishControlledDescendants(rootElement.ElementHandle);\r\n\r\n            var publicationStates = new Dictionary<string, string>\r\n            {\r\n                {GenericPublishProcessController.Draft, StringResourceSystemFacade.GetString(\"Composite.Management\", \"PublishingStatus.draft\")},\r\n                {GenericPublishProcessController.AwaitingApproval, StringResourceSystemFacade.GetString(\"Composite.Management\", \"PublishingStatus.awaitingApproval\")},\r\n                {GenericPublishProcessController.AwaitingPublication, StringResourceSystemFacade.GetString(\"Composite.Management\", \"PublishingStatus.awaitingPublication\")}\r\n            };\r\n\r\n            List<Tuple<Element, IPublishControlled>> actionRequiredPages =\r\n                 (from element in allElements\r\n                  let publishControlledData = (IPublishControlled)((DataEntityToken)element.ElementHandle.EntityToken).Data\r\n                  where publishControlledData.PublicationStatus != \"published\"\r\n                  select new Tuple<Element, IPublishControlled>(element, publishControlledData)).ToList();\r\n\r\n            foreach (var actionRequiredPage in actionRequiredPages)\r\n            {\r\n                var propertyBag = actionRequiredPage.Item1.PropertyBag;\r\n                var data = actionRequiredPage.Item2;\r\n\r\n\r\n                propertyBag[Texts.ViewUnpublishedItems_PageTitleLabel] = data.GetLabel();\r\n\r\n                var publicationStatus = data.PublicationStatus;\r\n                propertyBag[Texts.ViewUnpublishedItems_StatusLabel] = publicationStates.ContainsKey(publicationStatus)\r\n                    ? publicationStates[publicationStatus]\r\n                    : \"Unknown State\";\r\n\r\n                var versionedData = data as IVersioned;\r\n                if (versionedData != null)\r\n                {\r\n                    string versionName = versionedData.LocalizedVersionName(); // TODO: type cast?\r\n                    if (!string.IsNullOrEmpty(versionName))\r\n                    {\r\n                        propertyBag[Texts.ViewUnpublishedItems_VersionLabel] = versionName;\r\n                    }\r\n                }\r\n\r\n                Func<DateTime, string> toSortableString = date => String.Format(\"{0:s}\", date);\r\n\r\n                var changeHistory = data as IChangeHistory;\r\n                if (changeHistory != null)\r\n                {\r\n                    propertyBag[Texts.ViewUnpublishedItems_DateModifiedLabel] = changeHistory.ChangeDate.ToTimeZoneDateTimeString();\r\n                    propertyBag[Texts.ViewUnpublishedItems_DateModifiedLabel+\"Sortable\"] = toSortableString(changeHistory.ChangeDate);\r\n                    propertyBag[Texts.ViewUnpublishedItems_LabelChangedBy] = changeHistory.ChangedBy;\r\n                    propertyBag[Texts.ViewUnpublishedItems_LabelChangedBy+\"Sortable\"] = changeHistory.ChangedBy;\r\n                }\r\n                var creationHistory = data as ICreationHistory;\r\n                if (creationHistory != null)\r\n                {\r\n                    propertyBag[Texts.ViewUnpublishedItems_DateCreatedLabel] =\r\n                        creationHistory.CreationDate.ToTimeZoneDateTimeString();\r\n                    propertyBag[Texts.ViewUnpublishedItems_DateCreatedLabel+\"Sortable\"] =\r\n                        toSortableString(creationHistory.CreationDate);\r\n                }\r\n\r\n                try\r\n                {\r\n                    if (data is IVersioned)\r\n                    {\r\n                        foreach (\r\n                            var x in (data as IVersioned).GetExtraProperties() ?? new List<VersionedExtraProperties>())\r\n                        {\r\n                            propertyBag[x.ColumnName] = x.Value;\r\n                            propertyBag[x.ColumnName + \"Sortable\"] = x.SortableValue;\r\n\r\n                        }\r\n                    }\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    Log.LogCritical(LogTitle, \"Problem getting extra properties from version packages\");\r\n                    Log.LogCritical(LogTitle, ex);\r\n                    throw;\r\n                }\r\n\r\n            }\r\n            return actionRequiredPages.Select(pair => pair.Item1).ToList().ToClientElementList();\r\n        }\r\n\r\n        IEnumerable<Element> GetPublishControlledDescendants(ElementHandle elementHandle)\r\n        {\r\n            HashSet<string> elementBundles = null;\r\n\r\n            var children = ElementFacade.GetChildren(elementHandle, new SearchToken()) ?? Enumerable.Empty<Element>();\r\n            foreach (var child in children)\r\n            {\r\n                if (IsPublishControlled(child))\r\n                {\r\n                    yield return child;\r\n                }\r\n\r\n                string elementBundle = child.VisualData.ElementBundle;\r\n                if (elementBundle != null)\r\n                {\r\n                    elementBundles = elementBundles ?? new HashSet<string>();\r\n                    if (elementBundles.Contains(elementBundle))\r\n                    {\r\n                        continue;\r\n                    }\r\n\r\n                    elementBundles.Add(elementBundle);\r\n                }\r\n\r\n                if (child.VisualData.HasChildren)\r\n                {\r\n                    foreach (var element in GetPublishControlledDescendants(child.ElementHandle))\r\n                    {\r\n                        yield return element;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        private bool IsPublishControlled(Element v)\r\n        {\r\n            var entityToken = v.ElementHandle.EntityToken as DataEntityToken;\r\n            return entityToken != null\r\n                   && typeof (IPublishControlled).IsAssignableFrom(entityToken.InterfaceType);\r\n        }\r\n\r\n        [WebMethod]\r\n        public List<ClientElement> GetElements(ClientElement clientElement)\r\n        {\r\n            return GetElementsBySearchToken(clientElement, null);\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public List<ClientElement> GetRootElements(string dummy)\r\n        {\r\n            try\r\n            {\r\n                return GetElementsBySearchToken(null, null);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(LogTitle, ex);\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public List<RefreshChildrenInfo> FindEntityToken(string rootEntityToken, string entityToken, List<RefreshChildrenParams> openedNodes)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(rootEntityToken, \"rootEntityToken\");\r\n            Verify.ArgumentNotNullOrEmpty(entityToken, \"entityToken\");\r\n            Verify.ArgumentNotNull(openedNodes, \"openedNodes\");\r\n\r\n            List<RefreshChildrenInfo> refreshingInfo = TreeServicesFacade.FindEntityToken(rootEntityToken, entityToken, openedNodes);\r\n            if (refreshingInfo == null)\r\n            {\r\n                return new List<RefreshChildrenInfo>();\r\n            }\r\n\r\n            foreach (RefreshChildrenInfo nodeRefreshingInfo in refreshingInfo)\r\n            {\r\n                RemoveDuplicateActions(nodeRefreshingInfo.ClientElements);\r\n            }\r\n            return refreshingInfo;\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public List<RefreshChildrenInfo> GetMultipleChildren(List<RefreshChildrenParams> clientProviderNameEntityTokenPairs)\r\n        {\r\n            Verify.ArgumentNotNull(clientProviderNameEntityTokenPairs, \"clientProviderNameEntityTokenPairs\");\r\n\r\n            List<RefreshChildrenInfo> multiChildren = TreeServicesFacade.GetMultipleChildren(clientProviderNameEntityTokenPairs);\r\n            foreach (RefreshChildrenInfo multiChild in multiChildren)\r\n            {\r\n                RemoveDuplicateActions(multiChild.ClientElements);\r\n            }\r\n            return multiChildren;\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public List<ClientElement> GetElementsBySearchToken(ClientElement clientElement, string serializedSearchToken)\r\n        {\r\n            try\r\n            {\r\n\r\n                VerifyClientElement(clientElement);\r\n\r\n                if (clientElement == null || string.IsNullOrEmpty(clientElement.ProviderName))\r\n                {\r\n                    return new List<ClientElement> { TreeServicesFacade.GetRoot() };\r\n                }\r\n\r\n                List<ClientElement> clientElements = TreeServicesFacade.GetChildren(clientElement.ProviderName, clientElement.EntityToken, clientElement.Piggybag, serializedSearchToken);\r\n                RemoveDuplicateActions(clientElements);\r\n                return clientElements;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(LogTitle, ex);\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public List<ClientElement> GetNamedRoots(string name)\r\n        {\r\n            try\r\n            {\r\n                return GetNamedRootsBySearchToken(name, null);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogCritical(LogTitle, ex);\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public List<ClientElement> GetNamedRootsBySearchToken(string name, string serializedSearchToken)\r\n        {\r\n            Verify.ArgumentNotNullOrEmpty(name, \"name\");\r\n\r\n            List<ClientElement> clientElements = TreeServicesFacade.GetRoots(name, serializedSearchToken);\r\n            RemoveDuplicateActions(clientElements);\r\n            return clientElements;\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public string GetEntityTokenByPageUrl(string pageUrl)\r\n        {\r\n            EntityToken entityToken = UrlToEntityTokenFacade.TryGetEntityToken(pageUrl);\r\n\r\n            return entityToken != null ? EntityTokenSerializer.Serialize(entityToken, true) : string.Empty;\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public ClientBrowserViewSettings GetBrowserUrlByEntityToken(string serializedEntityToken, bool showPublished)\r\n        {\r\n            try\r\n            {\r\n                var entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n\r\n                using (new DataScope(showPublished ? PublicationScope.Published : PublicationScope.Unpublished))\r\n                {\r\n                    var browserViewSettings = UrlToEntityTokenFacade.TryGetBrowserViewSettings(entityToken, showPublished);\r\n\r\n                    if (browserViewSettings != null)\r\n                    {\r\n                        return new ClientBrowserViewSettings\r\n                        {\r\n                            Url = browserViewSettings.Url,\r\n                            ToolingOn = browserViewSettings.ToolingOn\r\n                        };\r\n                    }\r\n                }\r\n\r\n                return null;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(\"GetBrowserUrlByEntityToken\", ex);\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public List<ClientLabeledProperty> GetProperties(ClientElement clientElement)\r\n        {\r\n            VerifyClientElement(clientElement);\r\n            return TreeServicesFacade.GetLabeledProperties(clientElement.ProviderName, clientElement.EntityToken, clientElement.Piggybag);\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public List<ActionResult> ExecuteSingleElementAction(ClientElement clientElement, string serializedActionToken, string consoleId)\r\n        {\r\n            try\r\n            {\r\n                VerifyClientElement(clientElement);\r\n                TreeServicesFacade.ExecuteElementAction(clientElement.ProviderName, clientElement.EntityToken, clientElement.Piggybag, serializedActionToken, consoleId);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(LogTitle, ex);\r\n\r\n                IConsoleMessageQueueItem errorLogEntry = new LogEntryMessageQueueItem { Sender = typeof(TreeServices), Level = Composite.Core.Logging.LogLevel.Error, Message = ex.ToString() };\r\n                ConsoleMessageQueueFacade.Enqueue(errorLogEntry, consoleId);\r\n                IConsoleMessageQueueItem msgBoxEntry = new MessageBoxMessageQueueItem { DialogType = DialogType.Error, Title = \"Error executing action\", Message = \"An error occured executing the action. Please contact your system administrator or consult the log for help\" };\r\n                ConsoleMessageQueueFacade.Enqueue(msgBoxEntry, consoleId);\r\n            }\r\n\r\n            return new List<ActionResult> { new ActionResult { ResponseType = ActionResultResponseType.None } };\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public bool ExecuteDropElementAction(ClientElement draggedClientElement, ClientElement newParentClientElement, int dropIndex, string consoleId, bool isCopy)\r\n        {\r\n            try\r\n            {\r\n                VerifyClientElement(draggedClientElement);\r\n                VerifyClientElement(newParentClientElement);\r\n                return TreeServicesFacade.ExecuteElementDraggedAndDropped(draggedClientElement.ProviderName, draggedClientElement.EntityToken, draggedClientElement.Piggybag, newParentClientElement.ProviderName, newParentClientElement.EntityToken, newParentClientElement.Piggybag, dropIndex, consoleId, isCopy);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                IConsoleMessageQueueItem errorLogEntry = new LogEntryMessageQueueItem { Sender = typeof(TreeServices), Level = Composite.Core.Logging.LogLevel.Error, Message = ex.Message };\r\n                ConsoleMessageQueueFacade.Enqueue(errorLogEntry, consoleId);\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public List<KeyValuePair> GetSearchTokens(string dummy)\r\n        {\r\n            var tokens = new List<KeyValuePair>();\r\n\r\n            var embedableMediaFileSearchToken = new MediaFileSearchToken\r\n            {\r\n                MimeTypes = new[] { MimeTypeInfo.Asf, MimeTypeInfo.Avi, MimeTypeInfo.Director, MimeTypeInfo.Flash, MimeTypeInfo.QuickTime, MimeTypeInfo.Wmv }\r\n            };\r\n            tokens.Add(new KeyValuePair(\"MediaFileElementProvider.EmbeddableMedia\", embedableMediaFileSearchToken.Serialize()));\r\n\r\n            var imageMediaFileSearchToken = new MediaFileSearchToken\r\n            {\r\n                MimeTypes = new[] { MimeTypeInfo.Gif, MimeTypeInfo.Jpeg, MimeTypeInfo.Png, MimeTypeInfo.Bmp, MimeTypeInfo.Svg }\r\n            };\r\n            tokens.Add(new KeyValuePair(\"MediaFileElementProvider.WebImages\", imageMediaFileSearchToken.Serialize()));\r\n\r\n            var writableMediaFolderSearchToken = new MediaFileSearchToken { MimeTypes = new[] { \".\" } };\r\n            tokens.Add(new KeyValuePair(\"MediaFileElementProvider.WritableFolders\", writableMediaFolderSearchToken.Serialize()));\r\n\r\n            var xhtmlDocumentFunctionsSearchToken = AllFunctionsElementProviderSearchToken.Build(new[] { typeof(XhtmlDocument), typeof(System.Web.UI.Control) });\r\n            tokens.Add(new KeyValuePair(\"AllFunctionsElementProvider.VisualEditorFunctions\", xhtmlDocumentFunctionsSearchToken.Serialize()));\r\n\r\n            var xsltFunctionCallsSearchToken = AllFunctionsElementProviderSearchToken.Build(new[] { typeof(XhtmlDocument), typeof(IEnumerable<XElement>), typeof(XElement) });\r\n            tokens.Add(new KeyValuePair(\"AllFunctionsElementProvider.XsltFunctionCall\", xsltFunctionCallsSearchToken.Serialize()));\r\n\r\n            return tokens;\r\n        }\r\n\r\n        [WebMethod]\r\n        public bool ExecuteInlineElementAction(string serializedScriptAction, string consoleId)\r\n        {\r\n            InlineScriptActionFacade.ExecuteElementScriptAction(serializedScriptAction, consoleId);\r\n\r\n            return true;\r\n        }\r\n\r\n\r\n\r\n        private void VerifyClientElement(ClientElement clientElement)\r\n        {\r\n            if (clientElement == null) return;\r\n\r\n            if (!HashSigner.ValidateSignedHash(clientElement.Piggybag, HashValue.Deserialize(clientElement.PiggybagHash)))\r\n            {\r\n                throw new System.Security.SecurityException(\"Data has been tampered\");\r\n            }\r\n        }\r\n\r\n        [WebMethod]\r\n        public List<KeyValuePair> GetDefaultEntityTokens(string dummy)\r\n        {\r\n            var tokens = new List<KeyValuePair>();\r\n            using (new DataConnection())\r\n            {\r\n                var homepage = PageServices.GetChildren(Guid.Empty).FirstOrDefault();\r\n                if (homepage != null)\r\n                {\r\n                    tokens.Add(\r\n                        new KeyValuePair(\r\n                            EntityTokenSerializer.Serialize(AttachingPoint.ContentPerspective.EntityToken, true),\r\n                            EntityTokenSerializer.Serialize(homepage.GetDataEntityToken(), true)\r\n                            )\r\n                        );\r\n                }\r\n                tokens.Add(\r\n                    new KeyValuePair(\r\n                        EntityTokenSerializer.Serialize(AttachingPoint.SystemPerspective.EntityToken, true),\r\n                        EntityTokenSerializer.Serialize(new Composite.Plugins.Elements.ElementProviders.PackageElementProvider.PackageElementProviderAvailablePackagesFolderEntityToken(), true)\r\n                        )\r\n                    );\r\n\r\n\r\n            }\r\n            return tokens;\r\n        }\r\n\r\n        [WebMethod]\r\n        public List<string> GetCurrentLocaleEntityTokens(List<string> serializedEntityTokens)\r\n        {\r\n            var currentLocaleEntityTokens = new List<string>();\r\n            foreach (var serializedEntityToken in serializedEntityTokens)\r\n            {\r\n                try\r\n                {\r\n                    var entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n                    if (entityToken is DataEntityToken)\r\n                    {\r\n                        var dataItem = (entityToken as DataEntityToken).Data;\r\n                        if (dataItem is ILocalizedControlled)\r\n                        {\r\n                            var dataItemFromTheotherLocale = DataFacade.GetDataFromOtherLocale(dataItem, UserSettings.ActiveLocaleCultureInfo).ToList();\r\n\r\n                            if (!dataItemFromTheotherLocale.Any() && UserSettings.ForeignLocaleCultureInfo != null)\r\n                            {\r\n                                dataItemFromTheotherLocale = DataFacade.GetDataFromOtherLocale(dataItem, UserSettings.ForeignLocaleCultureInfo).ToList();\r\n                            }\r\n\r\n                            if (dataItemFromTheotherLocale.Count == 1)\r\n                            {\r\n                                var foreignEntityToken = dataItemFromTheotherLocale[0].GetDataEntityToken();\r\n\r\n                                currentLocaleEntityTokens.Add(EntityTokenSerializer.Serialize(foreignEntityToken, true));\r\n                                continue;\r\n                            }\r\n                        }\r\n                    }\r\n                    currentLocaleEntityTokens.Add(serializedEntityToken);\r\n                }\r\n                catch\r\n                {\r\n                }\r\n            }\r\n            return currentLocaleEntityTokens;\r\n        }\r\n\r\n        [WebMethod]\r\n        public List<string> GetAllParents(string serializedEntityToken)\r\n        {\r\n            var entityToken = EntityTokenSerializer.Deserialize(serializedEntityToken);\r\n            var graph = new RelationshipGraph(entityToken, RelationshipGraphSearchOption.Both, true);\r\n            var tokens = new HashSet<EntityToken>();\r\n\r\n            foreach (var level in graph.Levels)\r\n            {\r\n                tokens.UnionWith(level.AllEntities);\r\n            }\r\n\r\n            return tokens.Select(d => EntityTokenSerializer.Serialize(d, true)).ToList();\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public string GetCompositeUrlLabel(string path)\r\n        {\r\n            var relativePath = Regex.Replace(path, @\"^http://[\\w\\.\\d:]+/\", \"/\");\r\n            var mediaUrlData = MediaUrls.ParseUrl(relativePath);\r\n\r\n            using (var conn = new DataConnection())\r\n            {\r\n                if (mediaUrlData != null)\r\n                {\r\n                    var mediaId = mediaUrlData.MediaId;\r\n                    var store = mediaUrlData.MediaStore;\r\n\r\n                    var matchingMedia = conn.Get<IMediaFile>().FirstOrDefault(media => media.Id == mediaId && media.StoreId == store);\r\n\r\n                    if (matchingMedia != null)\r\n                    {\r\n                        string label = string.Format(\"{0} ({1}:{2})\", matchingMedia.FileName, matchingMedia.StoreId, matchingMedia.FolderPath);\r\n                        return label;\r\n                    }\r\n                }\r\n\r\n                var pageUrlData = PageUrls.ParseUrl(relativePath);\r\n                if (pageUrlData != null)\r\n                {\r\n                    var pageNode = conn.SitemapNavigator.GetPageNodeById(pageUrlData.PageId);\r\n\r\n                    if (pageNode != null)\r\n                    {\r\n                        string label = string.Format(\"{0} ( {1} )\", pageNode.Title, RemovePreviewMarker(pageNode.Url));\r\n                        return label;\r\n                    }\r\n                }\r\n\r\n                IDataReference dataReference = InternalUrls.TryParseInternalUrl(path);\r\n                if (dataReference != null)\r\n                {\r\n                    var data = dataReference.Data;\r\n                    if (data != null)\r\n                    {\r\n                        string label = data.GetLabel();\r\n\r\n                        if (label != null)\r\n                        {\r\n                            var dataPageUrlData = DataUrls.TryGetPageUrlData(dataReference);\r\n                            var dataPublicUrl = dataPageUrlData != null ? PageUrls.BuildUrl(dataPageUrlData) : null;\r\n\r\n                            if (dataPublicUrl != null)\r\n                            {\r\n                                label += \" ( \" + RemovePreviewMarker(dataPublicUrl) + \" )\";\r\n                            }\r\n\r\n                            return label;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            return path;\r\n        }\r\n\r\n        private static string RemovePreviewMarker(string url)\r\n        {\r\n            return url.Replace(\"/c1mode(unpublished)\", \"\");\r\n        }\r\n\r\n        [WebMethod]\r\n        public string GetCompositeEntityToken(string path)\r\n        {\r\n            var relativePath = Regex.Replace(path, @\"^http://[\\w\\.\\d:]+/\", \"/\");\r\n            var mediaUrlData = MediaUrls.ParseUrl(relativePath);\r\n\r\n            using (var connection = new DataConnection())\r\n            {\r\n                if (mediaUrlData != null)\r\n                {\r\n                    var mediaId = mediaUrlData.MediaId;\r\n                    var store = mediaUrlData.MediaStore;\r\n\r\n                    var matchingMedia = connection.Get<IMediaFile>().FirstOrDefault(media => media.Id == mediaId && media.StoreId == store);\r\n\r\n                    if (matchingMedia != null)\r\n                    {\r\n                        return EntityTokenSerializer.Serialize(matchingMedia.GetDataEntityToken(), true);\r\n                    }\r\n                }\r\n\r\n                var pageUrlData = PageUrls.ParseUrl(relativePath);\r\n                if (pageUrlData != null)\r\n                {\r\n                    var page = PageManager.GetPageById(pageUrlData.PageId);\r\n\r\n                    if (page != null)\r\n                    {\r\n                        return EntityTokenSerializer.Serialize(page.GetDataEntityToken(), true);\r\n                    }\r\n                }\r\n\r\n                IDataReference dataReference = InternalUrls.TryParseInternalUrl(path);\r\n                if (dataReference != null)\r\n                {\r\n                    var data = dataReference.Data;\r\n                    if (data != null)\r\n                    {\r\n                        return EntityTokenSerializer.Serialize(data.GetDataEntityToken(), true);\r\n                    }\r\n                }\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        [WebMethod]\r\n        public string GetWidgetEntityToken(string name)\r\n        {\r\n            Functions.IWidgetFunction function;\r\n            if (Functions.FunctionFacade.TryGetWidgetFunction(out function, name))\r\n            {\r\n                return EntityTokenSerializer.Serialize(function.EntityToken, true);\r\n            }\r\n\r\n            return null;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/WysiwygEditor/ConfigurationServices.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.WysiwygEditorConfigurationServices\" %>\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml.Linq;\r\nusing Composite.Data;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Core.Types;\r\nusing Composite.Core.Xml;\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class WysiwygEditorConfigurationServices : System.Web.Services.WebService\r\n    {\r\n        [WebMethod]\r\n        public List<FieldGroup> GetEmbedableFieldGroupConfigurations(string embedableFieldsTypeNames)\r\n        {\r\n            if (string.IsNullOrEmpty(embedableFieldsTypeNames))\r\n            {\r\n                return new List<FieldGroup>();\r\n            }\r\n\r\n            List<FieldGroup> fieldGroups = new List<FieldGroup>();\r\n\r\n            string[] serializedTypeManagerTypeNameArray = embedableFieldsTypeNames.Split('|');\r\n\r\n            foreach (string serializedTypeManagerTypeName in serializedTypeManagerTypeNameArray)\r\n            {\r\n                Type sourceDataType = TypeManager.TryGetType(serializedTypeManagerTypeName);\r\n\r\n                if (sourceDataType != null)\r\n                {\r\n                    fieldGroups.Add(GetSingleFieldGroupByType(sourceDataType));\r\n                }\r\n            }\r\n\r\n            return fieldGroups;\r\n        }\r\n\r\n\r\n\r\n        private FieldGroup GetSingleFieldGroupByType(Type sourceDataType)\r\n        {\r\n            if (sourceDataType == null) throw new ArgumentNullException();\r\n\r\n            FieldGroup group = new FieldGroup();\r\n\r\n            if (typeof(IData).IsAssignableFrom(sourceDataType))\r\n            {\r\n                DataTypeDescriptor dataTypeDescriptor;\r\n                if (!DynamicTypeManager.TryGetDataTypeDescriptor(sourceDataType, out dataTypeDescriptor))\r\n                {\r\n                    dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(sourceDataType);\r\n                }\r\n\r\n                group.GroupName = dataTypeDescriptor.Name;\r\n\r\n                foreach (var dataField in dataTypeDescriptor.Fields)\r\n                {\r\n                    string label = dataField.Name;\r\n\r\n                    if (dataField.FormRenderingProfile != null && !string.IsNullOrEmpty(dataField.FormRenderingProfile.Label))\r\n                    {\r\n                        label = dataField.FormRenderingProfile.Label;\r\n                    }\r\n\r\n                    group.Fields.Add(new Field\r\n                    {\r\n                        Name = label,\r\n                        XhtmlRepresentation = GetImageTagForDynamicDataFieldReference(label, dataField, dataTypeDescriptor).ToString(),\r\n                        XmlRepresentation = dataField.GetReferenceElement(dataTypeDescriptor).ToString()\r\n                    });\r\n                }\r\n            }\r\n            else\r\n            {\r\n                group.GroupName = sourceDataType.Name;\r\n\r\n                foreach (var propertyInfo in sourceDataType.GetPropertiesRecursively())\r\n                {\r\n                    string fieldName = propertyInfo.Name;\r\n\r\n                    group.Fields.Add(new Field\r\n                    {\r\n                        Name = fieldName,\r\n                        XhtmlRepresentation = GetImageTagForDynamicDataFieldReference(fieldName, sourceDataType).ToString(),\r\n\r\n                        XmlRepresentation = DynamicTypeMarkupServices.GetReferenceElement(fieldName, TypeManager.SerializeType(sourceDataType)).ToString()\r\n                    });\r\n                }\r\n            }\r\n\r\n            return group;\r\n        }\r\n\r\n\r\n\r\n        private XElement GetImageTagForDynamicDataFieldReference(string fieldName, Type dataType)\r\n        {\r\n            string imageUrl = string.Format(\"services/WysiwygEditor/FieldImage.ashx?name={0}&groupname={1}\", HttpUtility.UrlEncode(fieldName, Encoding.UTF8), HttpUtility.UrlEncode(dataType.Name, Encoding.UTF8));\r\n\r\n            return new XElement(Namespaces.Xhtml + \"img\",\r\n                new XAttribute(\"src\", Composite.Core.WebClient.UrlUtils.ResolveAdminUrl(imageUrl)),\r\n                new XAttribute(\"class\", \"compositeFieldReferenceWysiwygRepresentation\"),\r\n                new XAttribute(\"data-markup\", HttpUtility.UrlEncode(string.Format(\"{0}\\\\{1}\", TypeManager.SerializeType(dataType), fieldName), Encoding.UTF8)));\r\n        }\r\n\r\n\r\n        private XElement GetImageTagForDynamicDataFieldReference(string label, DataFieldDescriptor dataField, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            string imageUrl = string.Format(\"services/WysiwygEditor/FieldImage.ashx?name={0}&groupname={1}\", HttpUtility.UrlEncode(label, Encoding.UTF8), HttpUtility.UrlEncode(dataTypeDescriptor.Name, Encoding.UTF8));\r\n\r\n            return new XElement(Namespaces.Xhtml + \"img\",\r\n                new XAttribute(\"src\", Composite.Core.WebClient.UrlUtils.ResolveAdminUrl(imageUrl)),\r\n                new XAttribute(\"class\", \"compositeFieldReferenceWysiwygRepresentation\"),\r\n                new XAttribute(\"data-markup\", HttpUtility.UrlEncode(string.Format(\"{0}\\\\{1}\", dataTypeDescriptor.TypeManagerTypeName, dataField.Name), Encoding.UTF8)));\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        public class FieldGroup\r\n        {\r\n            public FieldGroup()\r\n            {\r\n                this.Fields = new List<Field>();\r\n            }\r\n\r\n            public string GroupName { get; set; }\r\n\r\n            public List<Field> Fields { get; set; }\r\n        }\r\n\r\n\r\n\r\n        public class Field\r\n        {\r\n            public string Name { get; set; }\r\n\r\n            public string XhtmlRepresentation { get; set; }\r\n\r\n            public string XmlRepresentation { get; set; }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/WysiwygEditor/ControlConfiguration.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xsl:stylesheet version=\"1.0\"\r\n    xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\r\n\r\n  <xsl:template match=\"/\">\r\n    <editor>\r\n      <xsl:apply-templates select=\"/controls\" />\r\n    </editor>\r\n  </xsl:template>\r\n\r\n  <xsl:template match=\"controls\">\r\n    <!-- control elements -->\r\n    <xsl:if test=\"control[@name='Path']\">\r\n      <control cmd=\"Path\" />\r\n    </xsl:if>\r\n    <xsl:if test=\"control[@name='ContextMenu']\">\r\n      <control cmd=\"ContextMenu\" />\r\n    </xsl:if>\r\n    <xsl:if test=\"control[@name='CleanupOnSave']\">\r\n      <control cmd=\"CleanupOnSave\">\r\n        <param name=\"output\" value=\"xhtml\" />\r\n      </control>\r\n    </xsl:if>\r\n\r\n    <xsl:if test=\"control[@name='Bold']|control[@name='Italic']|control[@name='Underline']\">\r\n      <toolbar>\r\n\r\n        <xsl:if test=\"control[@name='Bold']|control[@name='Italic']|control[@name='Underline']\">\r\n          <group>\r\n            <xsl:if test=\"control[@name='Bold']\">\r\n              <control cmd=\"Bold\" />\r\n            </xsl:if>\r\n            <xsl:if test=\"control[@name='Italic']\">\r\n              <control cmd=\"Italic\" />\r\n            </xsl:if>\r\n            <xsl:if test=\"control[@name='Underline']\">\r\n              <control cmd=\"Underline\" />\r\n            </xsl:if>\r\n          </group>\r\n        </xsl:if>\r\n\r\n        <xsl:if test=\"control[@name='JustifyLeft']|control[@name='JustifyRight']\">\r\n          <group>\r\n            <xsl:if test=\"control[@name='JustifyLeft']\">\r\n              <control cmd=\"JustifyLeft\" />\r\n            </xsl:if>\r\n            <xsl:if test=\"control[@name='JustifyRight']\">\r\n              <control cmd=\"JustifyRight\" />\r\n            </xsl:if>\r\n          </group>\r\n        </xsl:if>\r\n\r\n        <xsl:if test=\"control[@name='InsertUnorderedList']|control[@name='InsertOrderedList']\">\r\n          <group>\r\n            <xsl:if test=\"control[@name='InsertUnorderedList']\">\r\n              <control cmd=\"InsertUnorderedList\" />\r\n            </xsl:if>\r\n            <xsl:if test=\"control[@name='InsertOrderedList']\">\r\n              <control cmd=\"InsertOrderedList\" />\r\n            </xsl:if>\r\n          </group>\r\n        </xsl:if>\r\n\r\n      </toolbar>\r\n    </xsl:if>\r\n\r\n  </xsl:template>\r\n\r\n\r\n</xsl:stylesheet>\r\n\r\n"
  },
  {
    "path": "Website/Composite/services/WysiwygEditor/FieldImage.ashx",
    "content": "﻿<%@ WebHandler Language=\"C#\" Class=\"YellowBox\" %>\r\n \r\nusing System;\r\nusing System.Web;\r\nusing System.Xml.Linq;\r\nusing System.Drawing;\r\nusing System.Xml;\r\nusing System.IO;\r\nusing System.Text;\r\nusing Composite.Functions;\r\nusing Composite.C1Console.Drawing;\r\nusing System.Drawing.Imaging;\r\nusing System.Collections.Generic;\r\nusing Composite.Core.WebClient;\r\n \r\npublic class YellowBox : IHttpHandler\r\n{\r\n\r\n    public void ProcessRequest(HttpContext context)\r\n    {\r\n        try\r\n        {\r\n            string label = context.Request[\"name\"] ?? \"[ error ]\";\r\n            \r\n            string filePath = context.Server.MapPath(UrlUtils.ResolveAdminUrl(\"images/fieldbox.png\"));\r\n\r\n            Bitmap bitmap = (Bitmap)Bitmap.FromFile(filePath);\r\n\r\n            ImageTemplatedBoxCreator imageCreator = new ImageTemplatedBoxCreator(bitmap, new Point(30, 13), new Point(43, 0));\r\n\r\n            imageCreator.MinHeight = 26;\r\n            imageCreator.SetTitle(label, new Size(26, 6), new Size(38, 1), Color.Black, \"Tahoma\", 8.0f, FontStyle.Bold);\r\n\r\n            context.Response.ContentType = \"image/png\";\r\n\r\n            Bitmap boxBitmap = imageCreator.CreateBitmap();\r\n            MemoryStream ms = new MemoryStream();\r\n            boxBitmap.Save(ms, ImageFormat.Png);\r\n\r\n            ms.WriteTo(context.Response.OutputStream);\r\n        }\r\n        catch (Exception ex)\r\n        {\r\n            Composite.Core.Logging.LoggingService.LogError(this.GetType().ToString(), ex.ToString());\r\n            throw;\r\n        }\r\n    }\r\n    \r\n    \r\n    public bool IsReusable\r\n    {\r\n        get\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n\r\n\r\n\r\n    private string MakeTitleFromName(string name)\r\n    {\r\n        string[] nameParts = name.Split('.');\r\n        string titleBase = nameParts[nameParts.Length - 1];\r\n\r\n        StringBuilder sb = new StringBuilder( titleBase.Substring(0,1).ToUpper());\r\n\r\n        bool lastWasUpper = true;\r\n        \r\n        for (int i = 1; i < titleBase.Length; i++)\r\n        {\r\n            string letter = titleBase.Substring(i, 1);\r\n            if (letter != letter.ToLowerInvariant())\r\n            {\r\n                bool nextLetterIsLower = (i < titleBase.Length - 1) && (titleBase.Substring(i + 1, 1).ToLowerInvariant() == titleBase.Substring(i + 1, 1));\r\n\r\n                if (lastWasUpper == false || nextLetterIsLower == true)\r\n                {\r\n                    sb.Append(\" \");\r\n                }\r\n                lastWasUpper = true;\r\n            }\r\n            else\r\n            {\r\n                lastWasUpper = false;\r\n            }\r\n            sb.Append(letter);\r\n        }\r\n\r\n        return sb.ToString();\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/WysiwygEditor/FunctionService.asmx",
    "content": "<%@ WebService Language=\"C#\" Class=\"Composite.Services.FunctionService\" %>\r\n\r\nusing System;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml.Linq;\r\nusing System.Linq;\r\nusing Composite.Functions;\r\n\r\n\r\nnamespace Composite.Services\r\n{\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class FunctionService : System.Web.Services.WebService\r\n    {\r\n        [WebMethod]\r\n        public FunctionCallEditorSettings GetCustomEditorSettings(string functionName)\r\n        {\r\n            return FunctionCallEditorManager.GetCustomEditorSettings(functionName);\r\n        }\r\n\r\n        [WebMethod]\r\n        public FunctionCallEditorSettings GetCustomEditorSettingsByMarkup(string xml)\r\n        {\r\n            var xElement = XElement.Parse(xml);\r\n\r\n            string functionName = (string)xElement.Attribute(\"name\");\r\n\r\n            return functionName != null ? FunctionCallEditorManager.GetCustomEditorSettings(functionName) : null;\r\n        }\r\n\r\n        [WebMethod]\r\n        public FunctionExecutionResult TryExecute(string xml)\r\n        {\r\n            XElement functionMarkup;\r\n            BaseFunctionRuntimeTreeNode functionNode;\r\n            try\r\n            {\r\n                functionMarkup = XElement.Parse(xml);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                throw new ArgumentException(\"Not wellformed XML\", \"xml\");\r\n            }\r\n\r\n            try\r\n            {\r\n                functionNode = FunctionFacade.BuildTree(functionMarkup) as BaseFunctionRuntimeTreeNode;\r\n            }\r\n            catch (Exception)\r\n            {\r\n                throw new ArgumentException(\"Not a parsable function call\", \"xml\");\r\n            }\r\n\r\n            var executionResponse = new FunctionExecutionResult();\r\n            executionResponse.FunctionParamsExist = FunctionFacade.GetFunction(functionNode.GetCompositeName()).ParameterProfiles.Any();\r\n\r\n            try\r\n            {\r\n                object result = functionNode.GetValue();\r\n                executionResponse.FunctionCallExecutable = true;\r\n                executionResponse.FunctionResultType = (result is XNode ? \"xml\" : \"string\");\r\n                executionResponse.FunctionResult = result.ToString();\r\n            }\r\n            catch (Exception)\r\n            {\r\n                executionResponse.FunctionCallExecutable = false;\r\n                executionResponse.FunctionResult = null;\r\n                executionResponse.FunctionResultType = null;\r\n            }\r\n\r\n            return executionResponse;\r\n        }\r\n\r\n        public class FunctionExecutionResult\r\n        {\r\n            public bool FunctionParamsExist { get; set; }\r\n            public bool FunctionCallExecutable { get; set; }\r\n            public string FunctionResultType { get; set; }\r\n            public string FunctionResult { get; set; }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/services/WysiwygEditor/PageTemplate.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" Class=\"Composite.Services.PageTemplateService\" %>\r\n\r\nusing System;\r\nusing System.Activities.Statements;\r\nusing System.Threading;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Services.WysiwygEditor;\r\n\r\nnamespace Composite.Services\r\n{\r\n\r\n\tpublic class TemplatePreviewInformation\r\n\t{\r\n\t\tpublic string PreviewImageUrl { get; set; }\r\n\t\tpublic PageTemplatePreview.PlaceholderInformation[] Placeholders { get; set; }\r\n\t}\r\n\r\n\t[WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n\t[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n\tpublic class PageTemplateService : WebService\r\n\t{\r\n\t\t[WebMethod]\r\n\t\tpublic TemplatePreviewInformation GetTemplatePreviewInformation(Guid pageId, Guid templateId)\r\n\t\t{\r\n\t\t    if (!GlobalSettingsFacade.FunctionPreviewEnabled)\r\n\t\t    {\r\n\t\t        return EmptyPreviewInformation();\r\n\t\t    }\r\n\r\n\t\t\tstring _imagePath;\r\n\t\t\tPageTemplatePreview.PlaceholderInformation[] _placeholders;\r\n\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tbool success = PageTemplatePreview.GetPreviewInformation(Context, pageId, templateId, out _imagePath, out _placeholders);\r\n\t\t\t\tif (!success)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn EmptyPreviewInformation();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch (ThreadAbortException)\r\n\t\t\t{\r\n\t\t\t\tthrow;\r\n\t\t\t}\r\n\t\t\tcatch (Exception ex)\r\n\t\t\t{\r\n\t\t\t\tLog.LogError(\"PageTemplateService\", ex);\r\n\t\t\t\treturn EmptyPreviewInformation();\r\n\t\t\t}\r\n\r\n\t\t\tstring previewUrl = UrlUtils.RenderersRootPath + \"/TemplatePreviewImage?p=\" + pageId + \"&t=\" + templateId;\r\n\r\n\t\t\treturn new TemplatePreviewInformation\r\n\t\t\t{\r\n\t\t\t\tPreviewImageUrl = previewUrl,\r\n\t\t\t\tPlaceholders = _placeholders\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tprivate TemplatePreviewInformation EmptyPreviewInformation()\r\n\t\t{\r\n\t\t\treturn new TemplatePreviewInformation\r\n\t\t\t{\r\n\t\t\t\tPreviewImageUrl = \"\",\r\n\t\t\t\tPlaceholders = new PageTemplatePreview.PlaceholderInformation[0]\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/services/WysiwygEditor/XhtmlTransformations.asmx",
    "content": "﻿<%@ WebService Language=\"C#\" Class=\"Composite.Services.XhtmlTransformations\" %>\r\n\r\nusing System;\r\nusing System.Collections.Concurrent;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Text.RegularExpressions;\r\nusing System.Threading;\r\nusing System.Web;\r\nusing System.Web.Services;\r\nusing System.Web.Services.Protocols;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.Linq;\r\nusing Composite.Core.WebClient.Renderings;\r\nusing Composite.Data.DynamicTypes;\r\nusing Composite.Functions;\r\nusing Composite.Core.Logging;\r\nusing Composite.Core.ResourceSystem;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Services.WysiwygEditor;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Core.Types;\r\n\r\nnamespace Composite.Services\r\n{\r\n\r\n    public class XhtmlTransformationResult\r\n    {\r\n        public string XhtmlFragment { get; set; }\r\n        public string Warnings { get; set; }\r\n    }\r\n\r\n\r\n    public class FunctionInfo\r\n    {\r\n        public string FunctionMarkup { get; set; }\r\n        public bool RequireConfiguration { get; set; }\r\n    }\r\n\r\n\r\n\r\n    [WebService(Namespace = \"http://www.composite.net/ns/management\")]\r\n    [SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]\r\n    public class XhtmlTransformations : System.Web.Services.WebService\r\n    {\r\n        private const string _markupWysiwygRepresentationAlt = \"\\n\\n\\n\\n\\n\\n                              \"; // like this so IE will make loading images have some width and height\r\n\r\n        [WebMethod]\r\n        public XhtmlTransformationResult TinyContentToStructuredContent(string htmlFragment)\r\n        {\r\n            try\r\n            {\r\n                string warnings = \"\";\r\n                string xsltPath = Server.MapPath(\"..\\\\..\\\\transformations\\\\WysiwygEditor_TinyContentToStructuredContent.xsl\");\r\n\r\n                XDocument structuredResult;\r\n                try\r\n                {\r\n                    var xsltParameters = new Dictionary<string, string>\r\n                    {\r\n                        {\"requesthostname\", HttpContext.Current.Request.Url.Host},\r\n                        {\"requestport\", HttpContext.Current.Request.Url.Port.ToString()},\r\n                        {\"requestscheme\", HttpContext.Current.Request.Url.Scheme},\r\n                        {\"requestapppath\", UrlUtils.PublicRootPath}\r\n                    };\r\n\r\n                    structuredResult = MarkupTransformationServices.RepairXhtmlAndTransform(WrapInnerBody(htmlFragment), xsltPath, xsltParameters, out warnings);\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw new InvalidOperationException(\"Parse failed for \\n\" + htmlFragment, ex);\r\n                }\r\n\r\n                List<XElement> htmlWysiwygImages = structuredResult\r\n                    .Descendants(Namespaces.Xhtml + \"img\")\r\n                    .Where(e => HasMarkup(e)\r\n                                && e.Attribute(\"class\") != null\r\n                                && e.Attribute(\"class\").Value.Contains(\"compositeHtmlWysiwygRepresentation\")).ToList();\r\n\r\n                foreach (var htmlWysiwygImageElement in htmlWysiwygImages)\r\n                {\r\n                    try\r\n                    {\r\n                        string html = GetMarkupValue(htmlWysiwygImageElement);\r\n                        XElement functionElement = XElement.Parse(html);\r\n\r\n                        if (IsFunctionAloneInParagraph(htmlWysiwygImageElement))\r\n                        {\r\n                            htmlWysiwygImageElement.Parent.ReplaceWith(functionElement);\r\n                        }\r\n                        else\r\n                        {\r\n                            htmlWysiwygImageElement.ReplaceWith(functionElement);\r\n                        }\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        htmlWysiwygImageElement.ReplaceWith(new XText(\"HTML PARSE FAILED: \" + ex.Message));\r\n                    }\r\n                }\r\n\r\n\r\n\r\n                List<XElement> functionImages =\r\n                    structuredResult\r\n                    .Descendants()\r\n                    .Where(e => e.Name.LocalName == \"img\"\r\n                            && HasMarkup(e)\r\n                           && e.Attribute(\"class\") != null\r\n                           && e.Attribute(\"class\").Value.Contains(\"compositeFunctionWysiwygRepresentation\")).ToList();\r\n\r\n                foreach (var functionImageElement in functionImages)\r\n                {\r\n                    var nextNode = functionImageElement.NextNode;\r\n\r\n                    // Removing \"&#160;\" symbols that may appear between function call images\r\n                    if (nextNode != null\r\n                        && nextNode.NextNode != null\r\n                        && nextNode is XText\r\n                        && nextNode.NextNode is XElement\r\n                        && string.IsNullOrWhiteSpace((nextNode as XText).Value.Replace(\"&#160;\", \"\"))\r\n                        && functionImages.Contains(nextNode.NextNode as XElement))\r\n                    {\r\n                        nextNode.Remove();\r\n                    }\r\n\r\n                    // Replacing function call images with function markup\r\n                    try\r\n                    {\r\n                        string functionMarkup = GetMarkupValue(functionImageElement);\r\n                        XElement functionElement = XElement.Parse(functionMarkup);\r\n\r\n                        if (IsFunctionAloneInParagraph(functionImageElement))\r\n                        {\r\n                            functionImageElement.Parent.ReplaceWith(functionElement);\r\n                        }\r\n                        else\r\n                        {\r\n                            functionImageElement.ReplaceWith(functionElement);\r\n                        }\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        functionImageElement.ReplaceWith(new XText(\"FUNCTION MARKUP PARSE FAILED: \" + ex.Message));\r\n                    }\r\n                }\r\n\r\n\r\n                IEnumerable<XElement> dataFieldReferenceImages =\r\n                    structuredResult.Descendants(Namespaces.Xhtml + \"img\")\r\n                    .Where(f => f.Attribute(\"class\") != null\r\n                                && f.Attribute(\"class\").Value.Contains(\"compositeFieldReferenceWysiwygRepresentation\"));\r\n\r\n                foreach (var referenceImageElement in dataFieldReferenceImages.ToList())\r\n                {\r\n                    try\r\n                    {\r\n                        string[] parts = HttpUtility.UrlDecode(referenceImageElement.Attribute(\"data-markup\").Value).Split('\\\\');\r\n                        string typeName = parts[0];\r\n                        string fieldName = parts[1];\r\n\r\n                        referenceImageElement.ReplaceWith(DynamicTypeMarkupServices.GetReferenceElement(fieldName, typeName));\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        referenceImageElement.ReplaceWith(new XText(\"FIELD REFERENCE MARKUP PARSE FAILED: \" + ex.Message));\r\n                    }\r\n                }\r\n\r\n                FixTinyMceMalEncodingOfInternationalUrlHostNames(structuredResult);\r\n\r\n                string bodyInnerXhtml = MarkupTransformationServices.OutputBodyDescendants(structuredResult);\r\n\r\n                return new XhtmlTransformationResult\r\n                {\r\n                    Warnings = warnings,\r\n                    XhtmlFragment = FixXhtmlFragment(bodyInnerXhtml)\r\n                };\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LoggingService.LogError(\"XhtmlTransformation\", ex.ToString());\r\n\r\n                throw;\r\n            }\r\n        }\r\n\r\n        private static readonly List<XName> paragraphList = new List<XName>(){\r\n                Namespaces.Xhtml + \"p\",\r\n                Namespaces.Xhtml + \"h1\",\r\n                Namespaces.Xhtml + \"h2\",\r\n                Namespaces.Xhtml + \"h3\",\r\n                Namespaces.Xhtml + \"h4\",\r\n                Namespaces.Xhtml + \"h5\",\r\n                Namespaces.Xhtml + \"h6\"};\r\n\r\n        private static bool IsFunctionAloneInParagraph(XElement element)\r\n        {\r\n            if (element.ElementsBeforeSelf().Any(d => d.Name != Namespaces.Xhtml + \"br\")\r\n                || element.ElementsAfterSelf().Any(d => d.Name != Namespaces.Xhtml + \"br\")\r\n                || !paragraphList.Contains(element.Parent.Name)\r\n                || element.Parent.Value.Replace(\"&#160;\", \"\").Trim() != string.Empty)\r\n                return false;\r\n\r\n            return true;\r\n        }\r\n\r\n        private static string FixXhtmlFragment(string xhtmlFragment)\r\n        {\r\n            xhtmlFragment = Regex.Replace(xhtmlFragment, @\"(\\s)\\r\\n</script>\", \"$1</script>\", RegexOptions.Multiline);\r\n            return xhtmlFragment.Replace(\"\\xA0\", \"&#160;\").Replace(\"&nbsp;\", \"&#160;\");\r\n        }\r\n\r\n        // Fixing issue where tiny \r\n        private void FixTinyMceMalEncodingOfInternationalUrlHostNames(XDocument xhtmlDoc)\r\n        {\r\n            var urlAttributes = xhtmlDoc.Descendants().Attributes().Where(f => f.Value.StartsWith(\"http://\") || f.Value.StartsWith(\"https://\"));\r\n            foreach (XAttribute urlAttribute in urlAttributes)\r\n            {\r\n                string url = urlAttribute.Value;\r\n                string urlWithoutProtocol = url.Substring(url.IndexOf(\"//\", StringComparison.Ordinal) + 2);\r\n                string urlHostWithPort = (urlWithoutProtocol.Contains(\"/\") ? urlWithoutProtocol.Substring(0, urlWithoutProtocol.IndexOf('/')) : urlWithoutProtocol);\r\n                string urlHost = (urlHostWithPort.Contains(\":\") ? urlHostWithPort.Substring(0, urlHostWithPort.IndexOf(':')) : urlHostWithPort);\r\n                if (urlHost != HttpUtility.UrlDecode(urlHost))\r\n                {\r\n                    urlAttribute.Value = urlAttribute.Value.Replace(urlHost, HttpUtility.UrlDecode(urlHost));\r\n                }\r\n            }\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public XhtmlTransformationResult StructuredContentToTinyContent(string htmlFragment)\r\n        {\r\n            return StructuredContentToTinyContentMultiTemplate(htmlFragment, Guid.Empty, Guid.Empty, null, 0);\r\n        }\r\n\r\n\r\n        [WebMethod]\r\n        public XhtmlTransformationResult StructuredContentToTinyContentMultiTemplate(string htmlFragment, Guid pageId, Guid pageTemplateId, string functionPreviewPlaceholderName, int width)\r\n        {\r\n            try\r\n            {\r\n                string warnings = \"\";\r\n                string XhtmlPassXsltPath = Server.MapPath(\"..\\\\..\\\\transformations\\\\WysiwygEditor_StructuredContentToTinyContent.xsl\");\r\n\r\n                string html = WrapInnerBody(htmlFragment);\r\n\r\n                XDocument xml = XDocument.Parse(html, LoadOptions.PreserveWhitespace);\r\n\r\n                IEnumerable<XElement> functionRoots = xml\r\n                    .Descendants(Namespaces.Function10 + \"function\")\r\n                    .Where(f => f.Ancestors(Namespaces.Function10 + \"function\").Any() == false);\r\n\r\n                foreach (var functionElement in functionRoots.ToList())\r\n                {\r\n                    string cssSelector = BuildAncestorCssSelector(functionElement);\r\n\r\n                    functionElement.ReplaceWith(GetImageTagForFunctionCall(functionElement, pageId, pageTemplateId, functionPreviewPlaceholderName, cssSelector, width));\r\n                }\r\n\r\n                IEnumerable<XElement> dataFieldReferences = xml.Descendants(Namespaces.DynamicData10 + \"fieldreference\");\r\n                foreach (var referenceElement in dataFieldReferences.ToList())\r\n                {\r\n                    referenceElement.ReplaceWith(GetImageTagForDynamicDataFieldReference(referenceElement));\r\n                }\r\n\r\n                var unHandledHtmlElementNames = new List<XName>\r\n                                                    {\r\n                                                        Namespaces.Xhtml + \"audio\",\r\n                                                        Namespaces.Xhtml + \"canvas\",\r\n                                                        Namespaces.Xhtml + \"embed\",\r\n                                                        Namespaces.Xhtml + \"iframe\",\r\n                                                        Namespaces.Xhtml + \"map\",\r\n                                                        Namespaces.Xhtml + \"object\",\r\n                                                        Namespaces.Xhtml + \"script\",\r\n                                                        Namespaces.Xhtml + \"noscript\",\r\n                                                        Namespaces.Xhtml + \"video\",\r\n                                                        Namespaces.Xhtml + \"svg\"\r\n                                                    };\r\n\r\n                IEnumerable<XElement> langElements = xml.Descendants().Where(f => f.Name.Namespace == Namespaces.Localization10);\r\n                foreach (var langElement in langElements.ToList())\r\n                {\r\n                    langElement.ReplaceWith(GetImageTagForLangElement(langElement));\r\n                }\r\n\r\n                IEnumerable<XElement> unHandledHtmlElements = xml.Descendants().Where(f => f.Name.Namespace != Namespaces.Xhtml || unHandledHtmlElementNames.Contains(f.Name));\r\n                foreach (var unHandledHtmlElement in unHandledHtmlElements.ToList())\r\n                {\r\n                    unHandledHtmlElement.ReplaceWith(GetImageTagForHtmlElement(unHandledHtmlElement));\r\n                }\r\n\r\n                var xsltParameters = new Dictionary<string, string>\r\n                {\r\n                    {\"requestapppath\", UrlUtils.PublicRootPath}\r\n                };\r\n\r\n                XDocument structuredResult = MarkupTransformationServices.RepairXhtmlAndTransform(xml.ToString(), XhtmlPassXsltPath, xsltParameters, out warnings);\r\n\r\n                string bodyInnerXhtml = MarkupTransformationServices.OutputBodyDescendants(structuredResult);\r\n\r\n                return new XhtmlTransformationResult\r\n                {\r\n                    Warnings = warnings,\r\n                    XhtmlFragment = FixXhtmlFragment(bodyInnerXhtml)\r\n                };\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                Log.LogError(\"XhtmlTransformation\", ex.ToString());\r\n                throw;\r\n            }\r\n        }\r\n\r\n        private string BuildAncestorCssSelector(XElement element)\r\n        {\r\n            var sb = new StringBuilder();\r\n\r\n            foreach (var ancestor in element.Ancestors().Reverse())\r\n            {\r\n                if(ancestor.Name.LocalName == \"html\" || ancestor.Name.LocalName == \"body\") continue;\r\n\r\n                if (sb.Length > 0)\r\n                {\r\n                    sb.Append(\" \");\r\n                }\r\n\r\n                sb.Append(ancestor.Name.LocalName);\r\n                string cssClasses = (string) ancestor.Attribute(\"class\") ?? \"\";\r\n\r\n                foreach (var cssClass in cssClasses.Split(new [] {\" \"}, StringSplitOptions.RemoveEmptyEntries))\r\n                {\r\n                    sb.Append(\".\").Append(cssClass);\r\n                }\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n\r\n        [WebMethod]\r\n        public string GetImageTagForFunctionCall(string functionMarkup)\r\n        {\r\n            return GetImageTagForFunctionCall2(functionMarkup, Guid.Empty, Guid.Empty, null, 0);\r\n        }\r\n\r\n        [WebMethod]\r\n        public string GetImageTagForFunctionCall2(string functionMarkup, Guid functionPreviewPageId, Guid functionPreviewTemplateId, string functionPreviewPlaceholderName, int width)\r\n        {\r\n            XElement functionElement;\r\n\r\n            try\r\n            {\r\n                functionElement = XElement.Parse(functionMarkup);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                throw new ArgumentException(\"Unable to parse functionMarkup as XML\", ex);\r\n            }\r\n\r\n            return GetImageTagForFunctionCall(functionElement, functionPreviewPageId, functionPreviewTemplateId, functionPreviewPlaceholderName, null, width)\r\n                  .ToString(SaveOptions.DisableFormatting);\r\n        }\r\n\r\n\r\n\r\n        [WebMethod]\r\n        public FunctionInfo GetFunctionInfo(string functionName)\r\n        {\r\n            IFunction function = FunctionFacade.GetFunction(functionName);\r\n\r\n            var functionRuntimeTreeNode = new FunctionRuntimeTreeNode(function);\r\n\r\n            return new FunctionInfo\r\n            {\r\n                FunctionMarkup = functionRuntimeTreeNode.Serialize().ToString(),\r\n                RequireConfiguration = function.ParameterProfiles.Any(p => !p.IsInjectedValue)\r\n            };\r\n        }\r\n\r\n\r\n\r\n        private XElement GetImageTagForDynamicDataFieldReference(XElement fieldReferenceElement)\r\n        {\r\n            string typeName = fieldReferenceElement.Attribute(\"typemanagername\").Value;\r\n\r\n            Type type = TypeManager.GetType(typeName);\r\n            if (!typeof(IData).IsAssignableFrom(type))\r\n            {\r\n                string fieldName = fieldReferenceElement.Attribute(\"fieldname\").Value;\r\n\r\n                return GetImageTagForDynamicDataFieldReference(fieldName, fieldName, type.AssemblyQualifiedName, type.AssemblyQualifiedName);\r\n            }\r\n\r\n            DataTypeDescriptor typeDescriptor;\r\n            DataFieldDescriptor fieldDescriptor;\r\n\r\n            if (!DynamicTypeMarkupServices.TryGetDescriptors(fieldReferenceElement, out typeDescriptor, out fieldDescriptor))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return GetImageTagForDynamicDataFieldReference(fieldDescriptor, typeDescriptor);\r\n        }\r\n\r\n\r\n        private XElement GetImageTagForHtmlElement(XElement element)\r\n        {\r\n            string description = element.ToString().Replace(\" xmlns=\\\"http://www.w3.org/1999/xhtml\\\"\", \"\");\r\n            string title = \"HTML block\";\r\n\r\n            var descriptionLines = description.Split('\\n');\r\n            if (descriptionLines.Length > 6)\r\n            {\r\n                description = string.Format(\"{0}\\n{1}\\n{2}\\n...\\n{3}\", descriptionLines[0], descriptionLines[1],\r\n                                            descriptionLines[2], descriptionLines.Last());\r\n            }\r\n\r\n            int diplayImageHashCode;\r\n            string imageUrl = GetFunctionBoxImageUrl(\"html\", title, description, out diplayImageHashCode);\r\n\r\n            return new XElement(Namespaces.Xhtml + \"img\",\r\n                new XAttribute(\"alt\", _markupWysiwygRepresentationAlt),\r\n                new XAttribute(\"src\", imageUrl),\r\n                new XAttribute(\"class\", \"compositeHtmlWysiwygRepresentation\"),\r\n                GetMarkupAttribute(element.ToString())\r\n                );\r\n        }\r\n\r\n        /*\r\n                <lang:switch xmlns:lang=\"http://www.composite.net/ns/localization/1.0\">\r\n                    <lang:when culture=\"da-DK\">DK<img src=\"/dk-logo.png\" title=\"Dansk logo\" /></lang:when>\r\n                    <lang:when culture=\"en-US\">EN<img src=\"/us-logo.png\" title=\"American logo\" /></lang:when>\r\n                    <lang:default>No logo available</lang:default>\r\n                </lang:switch>\r\n\r\n        */\r\n        private XElement GetImageTagForLangElement(XElement element)\r\n        {\r\n            XName switchName = Namespaces.Localization10 + \"switch\";\r\n            XName stringName = Namespaces.Localization10 + \"string\";\r\n\r\n            string title = \"Language specific block\";\r\n            StringBuilder description = new StringBuilder();\r\n\r\n            try\r\n            {\r\n\r\n                if (element.Name == stringName)\r\n                {\r\n                    description.AppendLine(element.Attribute(\"key\").Value);\r\n                }\r\n\r\n                if (element.Name == switchName)\r\n                {\r\n                    foreach (var option in element.Elements().Where(e => e.Name.Namespace == Namespaces.Localization10))\r\n                    {\r\n                        int toGrab = Math.Min(35, option.Value.Length);\r\n                        string ellipsis = (option.Value.Length > 35 ? \"...\" : \"\");\r\n                        string descriptionContent = string.Format(\"{0}{1}\",\r\n                                option.Value.Substring(0, toGrab),\r\n                                ellipsis);\r\n\r\n                        if (String.IsNullOrWhiteSpace(option.Value) && option.Nodes().Any())\r\n                        {\r\n                            description.Append(\"(html code)\");\r\n                        }\r\n\r\n                        switch (option.Name.LocalName)\r\n                        {\r\n                            case \"when\":\r\n                                description.AppendFormat(\"{0}: {1}\",\r\n                                    option.Attribute(\"culture\").Value,\r\n                                    descriptionContent);\r\n                                break;\r\n                            case \"default\":\r\n                                description.AppendLine();\r\n                                description.AppendFormat(\"Default: {0}\",\r\n                                    descriptionContent);\r\n                                break;\r\n                        }\r\n                        description.AppendLine(\"\\n\\n\\n\\n\\n\\n\"); /* wtf - do I need this? */\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception)\r\n            {\r\n                description.AppendLine(\"[ ERROR PARSING MARKUP ]\");\r\n            }\r\n\r\n            int diplayImageHashCode;\r\n            string imageUrl = GetFunctionBoxImageUrl(\"html\", title, description.ToString(), out diplayImageHashCode);\r\n\r\n            return new XElement(Namespaces.Xhtml + \"img\",\r\n                new XAttribute(\"alt\", _markupWysiwygRepresentationAlt),\r\n                new XAttribute(\"src\", imageUrl),\r\n                new XAttribute(\"class\", \"compositeHtmlWysiwygRepresentation\"),\r\n                GetMarkupAttribute(element.ToString())\r\n                );\r\n        }\r\n\r\n\r\n        private static string GetFunctionBoxImageUrl(string type, string title, string description, out int previewImageHashCode)\r\n        {\r\n            string imageUrl = \"~/Renderers/FunctionBox?type={0}&title={1}&description={2}&lang={3}\".FormatWith(\r\n                HttpUtility.UrlEncode(type, Encoding.UTF8),\r\n                HttpUtility.UrlEncode(title, Encoding.UTF8),\r\n                UrlUtils.ZipContent(description.Trim()), // ZIPping description as it may contain xml tags f.e. <iframe />\r\n                Thread.CurrentThread.CurrentUICulture.Name);\r\n\r\n            previewImageHashCode = imageUrl.GetHashCode();\r\n            imageUrl += \"&hash=\" + FunctionPreview.GetFunctionPreviewHash();\r\n\r\n            return UrlUtils.ResolvePublicUrl(imageUrl);\r\n        }\r\n\r\n        private static string GetFunctionBoxImageUrl_Markup(\r\n            string type,\r\n            string title,\r\n            string description,\r\n            string markup,\r\n            Guid functionPreviewPageId,\r\n            Guid functionPreviewTemplatePageId,\r\n            string functionPreviewPlaceholderName,\r\n            string functionPreviewCssSelector,\r\n            int viewWidth,\r\n            bool editable,\r\n            out int displayImageHashCode)\r\n        {\r\n            // TODO: cache ZipContent calls?\r\n            string imageUrl = \"~/Renderers/FunctionBox?type={0}&title={1}&description={2}&markup={3}&lang={4}\".FormatWith(\r\n                HttpUtility.UrlEncode(type, Encoding.UTF8),\r\n                HttpUtility.UrlEncode(title, Encoding.UTF8),\r\n                UrlUtils.ZipContent(description.Trim()), // ZIPping description as it may contain xml tags f.e. <iframe />\r\n                UrlUtils.ZipContent(markup.Trim()),\r\n                UserSettings.GetCurrentActiveLocaleCultureInfo(UserValidationFacade.GetUsername()));\r\n\r\n            if (GlobalSettingsFacade.FunctionPreviewEnabled)\r\n            {\r\n                if (functionPreviewPageId != Guid.Empty)\r\n                {\r\n                    imageUrl += \"&p=\" + functionPreviewPageId;\r\n                }\r\n\r\n                if (functionPreviewTemplatePageId != Guid.Empty)\r\n                {\r\n                    imageUrl += \"&t=\" + functionPreviewTemplatePageId;\r\n                }\r\n\r\n                if (!string.IsNullOrEmpty(functionPreviewPlaceholderName))\r\n                {\r\n                    imageUrl += \"&ph=\" + functionPreviewPlaceholderName;\r\n                }\r\n\r\n                if (!string.IsNullOrEmpty(functionPreviewCssSelector))\r\n                {\r\n                    imageUrl += \"&css=\" + functionPreviewCssSelector;\r\n                }\r\n\r\n                if (viewWidth > 0)\r\n                {\r\n                    imageUrl += \"&width=\" + viewWidth;\r\n                }\r\n            }\r\n\r\n            if (editable)\r\n            {\r\n                imageUrl += \"&editable=true\";\r\n            }\r\n\r\n            displayImageHashCode = imageUrl.GetHashCode();\r\n            imageUrl += \"&hash=\" + FunctionPreview.GetFunctionPreviewHash();\r\n\r\n            return UrlUtils.ResolvePublicUrl(imageUrl);\r\n        }\r\n\r\n\r\n        private XElement GetImageTagForDynamicDataFieldReference(DataFieldDescriptor dataField, DataTypeDescriptor dataTypeDescriptor)\r\n        {\r\n            string fieldLabel = dataField.Name;\r\n\r\n            var profile = dataField.FormRenderingProfile;\r\n            if (profile != null && profile.Label != null)\r\n            {\r\n                fieldLabel = StringResourceSystemFacade.ParseString(profile.Label);\r\n            }\r\n\r\n            return GetImageTagForDynamicDataFieldReference(dataField.Name, fieldLabel, dataTypeDescriptor.Name, dataTypeDescriptor.TypeManagerTypeName);\r\n        }\r\n\r\n        private XElement GetImageTagForDynamicDataFieldReference(string fieldName, string fieldLabel, string typeName, string uiFriendlyTypeName)\r\n        {\r\n            string imageUrl = string.Format(\"services/WysiwygEditor/FieldImage.ashx?name={0}&groupname={1}\",\r\n                HttpUtility.UrlEncode(fieldLabel, Encoding.UTF8),\r\n                HttpUtility.UrlEncode(typeName, Encoding.UTF8));\r\n\r\n            return new XElement(Namespaces.Xhtml + \"img\",\r\n                new XAttribute(\"alt\", fieldName),\r\n                new XAttribute(\"src\", Composite.Core.WebClient.UrlUtils.ResolveAdminUrl(imageUrl)),\r\n                new XAttribute(\"class\", \"compositeFieldReferenceWysiwygRepresentation\"),\r\n                new XAttribute(\"data-markup\", HttpUtility.UrlEncode(string.Format(\"{0}\\\\{1}\", uiFriendlyTypeName, fieldName), Encoding.UTF8))\r\n                );\r\n        }\r\n\r\n\r\n\r\n        private XElement GetImageTagForFunctionCall(\r\n            XElement functionElement,\r\n            Guid pageId,\r\n            Guid pageTemplateId,\r\n            string functionPreviewPlaceholderName,\r\n            string functionPreviewCssSelector,\r\n            int viewWidth)\r\n        {\r\n            string title;\r\n            var description = new StringBuilder();\r\n            string compactMarkup = functionElement.ToString(SaveOptions.DisableFormatting);\r\n\r\n            bool error = false;\r\n            bool hasParameters = false;\r\n\r\n            try\r\n            {\r\n                var functionNode = (FunctionRuntimeTreeNode)FunctionFacade.BuildTree(functionElement);\r\n                string functionName = functionNode.GetCompositeName();\r\n                title = MakeTitleFromName(functionName);\r\n\r\n                // description.AppendLine(\"[{0}]\".FormatWith(functionName));\r\n\r\n                string functionDescription = functionNode.GetDescription();\r\n                if (!functionDescription.IsNullOrEmpty())\r\n                {\r\n                    functionDescription = StringResourceSystemFacade.ParseString(functionDescription);\r\n                    description.AppendLine(functionDescription);\r\n                }\r\n\r\n                var setParams = functionNode.GetSetParameters().ToList();\r\n                if (setParams.Any()) description.Append(\"\\n\");\r\n\r\n                ICollection<ParameterProfile> parameterProfiles = FunctionFacade.GetFunction(functionName).ParameterProfiles.Evaluate();\r\n\r\n                foreach (var setParam in setParams.Take(10))\r\n                {\r\n                    AddParameterInformation(description, setParam, parameterProfiles);\r\n                }\r\n\r\n                hasParameters = parameterProfiles.Any();\r\n\r\n                if (setParams.Count > 10)\r\n                {\r\n                    description.AppendLine(\"....\");\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                // TODO: should be localized?\r\n                title = \"Invalid function call\";\r\n                description.AppendLine(ex.Message);\r\n                error = true;\r\n            }\r\n\r\n            string markup = GetNormalizedMarkup(functionElement);\r\n\r\n            int previewImageHashCode;\r\n\r\n            string functionBoxUrl = error\r\n                ? GetFunctionBoxImageUrl(\"warning\", title, description.ToString(), out previewImageHashCode)\r\n                : GetFunctionBoxImageUrl_Markup(\"function\", title, description.ToString(), markup,\r\n                                                pageId,\r\n                                                pageTemplateId,\r\n                                                functionPreviewPlaceholderName,\r\n                                                functionPreviewCssSelector,\r\n                                                viewWidth,\r\n                                                hasParameters,\r\n                                                out previewImageHashCode);\r\n\r\n            var imagetag = new XElement(Namespaces.Xhtml + \"img\"\r\n                , new XAttribute(\"alt\", _markupWysiwygRepresentationAlt)\r\n                , GetMarkupAttribute(compactMarkup)\r\n                , new XAttribute(\"onload\", \"this.className += ' loaded';\")\r\n                , new XAttribute(\"class\", \"compositeFunctionWysiwygRepresentation\" + (hasParameters ? \" editable\" : \"\"))\r\n                );\r\n\r\n            // Showing a cached preview image as a source to update the ui more fluent\r\n            var cachedImageUrl = GetCachedPreviewImageUrl(previewImageHashCode);\r\n            if (cachedImageUrl != null)\r\n            {\r\n                imagetag.Add(new XAttribute(\"src\", cachedImageUrl));\r\n            }\r\n\r\n            if (functionBoxUrl != cachedImageUrl)\r\n            {\r\n                imagetag.Add(new XAttribute(\"data-src\", functionBoxUrl));\r\n            }\r\n\r\n            PreviewImageCache[previewImageHashCode] = functionBoxUrl;\r\n\r\n            return imagetag;\r\n        }\r\n\r\n        private static string GetCachedPreviewImageUrl(int previewImageHashCode)\r\n        {\r\n            string value;\r\n            return PreviewImageCache.TryGetValue(previewImageHashCode, out value) ? value : null;\r\n        }\r\n\r\n        private static ConcurrentDictionary<int, string> PreviewImageCache = new ConcurrentDictionary<int, string>();\r\n\r\n        private string GetNormalizedMarkup(XElement functionCall)\r\n        {\r\n            return XhtmlPrettifier.Prettify(functionCall.ToString(), \"\");\r\n        }\r\n\r\n        private XAttribute GetMarkupAttribute(string markup)\r\n        {\r\n            return new XAttribute(\"data-markup\", HttpUtility.UrlEncode(markup).Replace(\"+\",\" \"));\r\n        }\r\n\r\n        private bool HasMarkup(XElement element)\r\n        {\r\n            return element.Attribute(\"data-markup\") != null;\r\n        }\r\n\r\n        private string GetMarkupValue(XElement element)\r\n        {\r\n            var result = element.Attribute(\"data-markup\").Value;\r\n            return HttpUtility.UrlDecode(result);\r\n        }\r\n\r\n\r\n        private void AddParameterInformation(StringBuilder description, BaseParameterRuntimeTreeNode parameter, IEnumerable<ParameterProfile> parameterProfiles)\r\n        {\r\n            ParameterProfile parameterProfile = parameterProfiles.FirstOrDefault(f => f.Name == parameter.Name);\r\n\r\n            if (parameterProfile == null)\r\n            {\r\n                description.AppendFormat(\"[error] {0} is undefined\", parameter.Name).AppendLine();\r\n                return;\r\n            }\r\n\r\n            if (parameter.ContainsNestedFunctions || parameter is FunctionParameterRuntimeTreeNode\r\n                || parameterProfile.Type.IsLazyGenericType() || parameterProfile.Type.IsAssignableFrom(typeof(XhtmlDocument)))\r\n            {\r\n                description.AppendLine(\"{0} = ....\".FormatWith(parameter.Name));\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                object rawValue = parameter.GetValue();\r\n\r\n                string paramValue = rawValue.ToString();\r\n                string paramLabel = parameter.Name;\r\n\r\n                try\r\n                {\r\n                    paramLabel = parameterProfile.LabelLocalized;\r\n                    paramValue = GetValuePreview(parameterProfile, parameter, rawValue)\r\n                                 ?? rawValue.ToString();\r\n                }\r\n                catch (Exception)\r\n                {\r\n                    // just fall back to listing param names and raw values...\r\n                    paramValue = \"[error]\";\r\n                }\r\n\r\n                Guid tempGuid;\r\n                if (!paramValue.IsNullOrEmpty() && Guid.TryParse(paramValue, out tempGuid))\r\n                {\r\n                    paramValue = \"...\";\r\n                }\r\n\r\n                if(paramValue.Length > 45)\r\n                {\r\n                    paramValue = paramValue.Substring(0, 42) + \"...\";\r\n                }\r\n\r\n                description.AppendLine(\"{0} = {1}\".FormatWith(paramLabel, paramValue));\r\n            }\r\n            catch (Exception)\r\n            {\r\n                description.AppendLine(\"{0} = ...\".FormatWith(parameter.Name));\r\n            }\r\n        }\r\n\r\n        private string GetValuePreview(ParameterProfile parameterProfile, BaseParameterRuntimeTreeNode parameter, object rawValue)\r\n        {\r\n            if (typeof(IDataReference).IsAssignableFrom(parameterProfile.Type))\r\n            {\r\n                IDataReference dataReference = ValueTypeConverter.Convert(parameter.GetValue(), parameterProfile.Type) as IDataReference;\r\n                if (dataReference != null)\r\n                {\r\n                    return dataReference.Data.GetLabel();\r\n                }\r\n                return null;\r\n            }\r\n\r\n            if (parameterProfile.Type == typeof(XhtmlDocument) || parameterProfile.Type == typeof(Lazy<XhtmlDocument>))\r\n            {\r\n                var serialized = parameter.Serialize();\r\n\r\n                var headXName = Namespaces.Xhtml + \"head\";\r\n                var textNodes = serialized.DescendantNodes()\r\n                    .OfType<XText>()\r\n                    .Where(tn => !tn.Value.IsNullOrEmpty() && !tn.Ancestors().Any(a => a.Name == headXName))\r\n                    .ToList();\r\n\r\n                if (!textNodes.Any())\r\n                {\r\n                    return \"(HTML)\";\r\n\r\n                }\r\n                return \"HTML: \" + string.Join(\" \", textNodes.Take(5)).Replace( Environment.NewLine, \" \" ).Trim();\r\n            }\r\n\r\n            if (rawValue is XNode || rawValue is IEnumerable<XNode>)\r\n            {\r\n                return \"...\";\r\n            }\r\n\r\n            if (rawValue is IEnumerable<string>)\r\n            {\r\n                var values = rawValue as IEnumerable<string>;\r\n                return \"[\" + String.Join(\", \", values.Take(100).Select(v => \"'\" + v + \"'\")) + \"]\";\r\n            }\r\n\r\n            return null;\r\n        }\r\n\r\n        private string WrapInnerBody(string innerBodyMarkup)\r\n        {\r\n            innerBodyMarkup = XmlUtils.RemoveXmlDeclaration(innerBodyMarkup);\r\n            if (innerBodyMarkup.StartsWith(\"<html\") && innerBodyMarkup.Contains(Namespaces.Xhtml.NamespaceName))\r\n            {\r\n                return innerBodyMarkup;\r\n            }\r\n\r\n            return string.Format(\"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><head><title>None</title></head><body>{0}</body></html>\", innerBodyMarkup);\r\n        }\r\n\r\n\r\n\r\n        private string MakeTitleFromName(string name)\r\n        {\r\n            string[] nameParts = name.Split('.');\r\n            string titleBase = nameParts[nameParts.Length - 1];\r\n\r\n            StringBuilder sb = new StringBuilder(titleBase.Substring(0, 1).ToUpper());\r\n\r\n            bool lastWasUpper = true;\r\n\r\n            for (int i = 1; i < titleBase.Length; i++)\r\n            {\r\n                string letter = titleBase.Substring(i, 1);\r\n                if (letter != letter.ToLowerInvariant())\r\n                {\r\n                    bool nextLetterIsLower = (i < titleBase.Length - 1) && (titleBase.Substring(i + 1, 1).ToLowerInvariant() == titleBase.Substring(i + 1, 1));\r\n\r\n                    if (!lastWasUpper || nextLetterIsLower)\r\n                    {\r\n                        sb.Append(\" \");\r\n                    }\r\n                    lastWasUpper = true;\r\n                }\r\n                else\r\n                {\r\n                    lastWasUpper = false;\r\n                }\r\n                sb.Append(letter);\r\n            }\r\n\r\n            return sb.ToString();\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/services/WysiwygEditor/getconfig.ashx",
    "content": "﻿<%@ WebHandler Language=\"C#\" Class=\"Composite.services.WysiwygEditor.GetConfig\" %>\r\n\r\nusing Composite.Core;\r\nusing Composite.Core.IO;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Xml.Linq;\r\n\r\nnamespace Composite.services.WysiwygEditor\r\n{\r\n    /// <summary>\r\n    /// Returns config xml to the Visual Editor - will annotate css paths with a time-stamp-hash as to force client to reload css when css'ish changes happen on the website (only)\r\n    /// </summary>\r\n    public class GetConfig : IHttpHandler\r\n    {\r\n        private const string visualEditorConfigFolderVirtualPath = \"~/Frontend/Config/VisualEditor\";\r\n\r\n        private static Dictionary<string, string> _configCache = new Dictionary<string, string>();\r\n        private static C1FileSystemWatcher _cssChangeWatcher;\r\n        private static C1FileSystemWatcher _frontendChangeWatcher;\r\n        private static object _lock = new object();\r\n       \r\n        public void ProcessRequest(HttpContext context)\r\n        {\r\n            string configName = context.Request.QueryString[\"name\"];\r\n\r\n            context.Response.ContentType = \"text/xml\";\r\n            context.Response.Write(GetConfigAsString(context, configName));\r\n        }\r\n\r\n\r\n        \r\n        private string GetConfigAsString(HttpContext context, string configName)\r\n        {\r\n            EnsureFileWatcher();\r\n            \r\n            string result = null;\r\n            if (_configCache.TryGetValue(configName, out result))\r\n            {\r\n                return result;\r\n            }\r\n\r\n            lock (_lock)\r\n            {\r\n                if (_configCache.TryGetValue(configName, out result))\r\n                {\r\n                    return result;\r\n                }\r\n\r\n                result = GetStampedConfig(context, configName).ToString();\r\n                _configCache.Add(configName, result);\r\n                return result;\r\n            }\r\n        } \r\n\r\n\r\n        \r\n        private void EnsureFileWatcher()\r\n        {\r\n            if (_cssChangeWatcher == null)\r\n            {\r\n                lock (_lock)\r\n                {\r\n                    if (_cssChangeWatcher == null)\r\n                    {\r\n                        _cssChangeWatcher = new C1FileSystemWatcher(PathUtil.Resolve(\"~\"), \"*.*ss\")\r\n                        {\r\n                            NotifyFilter = NotifyFilters.LastWrite,\r\n                            EnableRaisingEvents = true,\r\n                            IncludeSubdirectories = true\r\n                        };\r\n\r\n                        _frontendChangeWatcher = new C1FileSystemWatcher(PathUtil.Resolve(\"~/Frontend\"), \"*\")\r\n                        {\r\n                            NotifyFilter = NotifyFilters.LastWrite,\r\n                            EnableRaisingEvents = true,\r\n                            IncludeSubdirectories = true\r\n                        };\r\n\r\n                        _cssChangeWatcher.Changed += _cssChangeWatcher_Changed;\r\n                        _frontendChangeWatcher.Changed += _cssChangeWatcher_Changed;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        \r\n        \r\n        void _cssChangeWatcher_Changed(object sender, FileSystemEventArgs e)\r\n        {\r\n            lock (_lock)\r\n            {\r\n                _configCache = new Dictionary<string, string>();\r\n            }\r\n        }\r\n\r\n        \r\n        \r\n        private XDocument GetStampedConfig(HttpContext context, string configName)\r\n        {\r\n            \r\n            if (string.IsNullOrEmpty(configName))\r\n            {\r\n                Log.LogWarning(\"getconfig.ashx\", \"getconfig.ashx called without expected parameter 'name'\");\r\n                throw new ArgumentException(\"getconfig.ashx called without expected parameter 'name'\");\r\n            }\r\n\r\n            string visualEditorConfigFolderPath = context.Server.MapPath(visualEditorConfigFolderVirtualPath);\r\n            string filePath = Path.Combine(visualEditorConfigFolderPath, string.Format(\"{0}.xml\", configName));\r\n\r\n            if (!File.Exists(filePath))\r\n            {\r\n                Log.LogWarning(\"getconfig.ashx\", \"Configuration name '{0}' maps to unknown file '{1}'\", configName, filePath);\r\n                throw new ArgumentException(string.Format(\"Configuration name '{0}' maps to unknown file '{1}'\", configName, filePath));\r\n            }\r\n\r\n            XDocument configDoc = XDocument.Load(filePath);\r\n\r\n            var styleElements = configDoc.Root.Element(\"styles\").Elements();\r\n\r\n            string stamp = GetStamp(context, styleElements, visualEditorConfigFolderPath);\r\n\r\n            foreach (XElement styleElement in styleElements)\r\n            {\r\n                string cssRelativaPath = (string)styleElement.Attribute(\"file\");\r\n                if (!string.IsNullOrEmpty(cssRelativaPath) && cssRelativaPath.IndexOf('?') == -1)\r\n                {\r\n                    styleElement.Attribute(\"file\").Value = string.Format(\"{0}?stamp={1}\", cssRelativaPath, stamp);\r\n                }\r\n            }\r\n\r\n            return configDoc;\r\n        }\r\n\r\n        \r\n        \r\n        private string GetStamp(HttpContext context, IEnumerable<XElement> styleElements, string visualEditorConfigFolderPath) \r\n        {\r\n            List<DateTime> dates = new List<DateTime>();\r\n            \r\n            string frontEndFolderPath = context.Server.MapPath(\"~/Frontend\");\r\n            DirectoryInfo frontendFolderInfo = new DirectoryInfo(frontEndFolderPath);\r\n            dates.Add(frontendFolderInfo.GetFiles(\"*\", SearchOption.AllDirectories).OrderByDescending(d => d.LastWriteTime).First().LastWriteTime);\r\n\r\n            foreach (XElement styleElement in styleElements)\r\n            {\r\n                string cssRelativaPath = (string)styleElement.Attribute(\"file\");\r\n                if (!string.IsNullOrEmpty(cssRelativaPath))\r\n                {\r\n                    try\r\n                    {\r\n                        string cssFilePath = Path.Combine(visualEditorConfigFolderPath, cssRelativaPath);\r\n                        if (File.Exists(cssFilePath))\r\n                        {\r\n                            FileInfo fi = new FileInfo(cssFilePath);\r\n                            dates.Add(fi.LastWriteTime);\r\n                        }\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Log.LogError(\"getconfig.ashx\", ex);                     \r\n                    }\r\n                }\r\n            }\r\n\r\n            return dates.OrderBy(f => f).Last().GetHashCode().ToString();\r\n        }\r\n\r\n\r\n        \r\n        public bool IsReusable\r\n        {\r\n            get\r\n            {\r\n                return true;\r\n            }\r\n        }\r\n        \r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/_helpers.less",
    "content": "﻿.text-primary {\r\n\tcolor: @primary-color;\r\n}\r\n\r\n.text-muted {\r\n\tcolor: #999;\r\n}\r\n\r\n.text-error {\r\n\tcolor: @field-error-color;\r\n\tmargin-bottom: 10px;\r\n}\r\n\r\n.text-sm {\r\n\tfont-size: 85%;\r\n}\r\n\r\n.text-center {\r\n\ttext-align: center;\r\n}\r\n\r\n.hide {\r\n\tdisplay: none;\r\n}\r\n\r\n.pull-left {\r\n\tfloat: left;\r\n}\r\n\r\n.pull-right, .alignright {\r\n\tfloat: right;\r\n}\r\n\r\n.padded {\r\n\tpadding: 30px 30px 0px 40px;\r\n\r\n\t&>*:last-child {\r\n\t\tmargin-bottom: 30px; // FF ignore padding bottom for overflow: scroll\r\n\t}\r\n}\r\n\r\n.padded-sm {\r\n\tpadding: 18px 20px 0 20px;\r\n\r\n\t&>*:last-child {\r\n\t\tmargin-bottom: 18px; // FF ignore padding bottom for overflow: scroll\r\n\t}\r\n}\r\n\r\n.clearfix, .clearfloatelement {\r\n\t.clearfix();\r\n}\r\n\r\n// Margins\r\n.mt-20 {\r\n\tmargin-top: 20px;\r\n}\r\n\r\n.mb-20 {\r\n\tmargin-bottom: 20px;\r\n}\r\n\r\n.mt-40 {\r\n\tmargin-top: 40px;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/_mixins.less",
    "content": "// Opacity\n\n.opacity(@opacity) {\n\topacity: @opacity;\n\t// IE8 filter\n\t@opacity-ie: (@opacity * 100);\n\tfilter: ~\"alpha(opacity=@{opacity-ie})\";\n\t// fix transparency artifacts in Chrome(61)\n\t-webkit-backface-visibility: hidden;\n}\n\n// Clearfix\n//\n// For modern browsers\n// 1. The space content is one way to avoid an Opera bug when the\n//    contenteditable attribute is included anywhere else in the document.\n//    Otherwise it causes space to appear at the top and bottom of elements\n//    that are clearfixed.\n// 2. The use of `table` rather than `block` is only necessary if using\n//    `:before` to contain the top-margins of child elements.\n//\n// Source: http://nicolasgallagher.com/micro-clearfix-hack/\n.clearfix() {\n\t&:before,\n\t&:after {\n\t\tcontent: \" \"; // 1\n\t\tdisplay: table; // 2\n\t}\n\n\t&:after {\n\t\tclear: both;\n\t}\n}\n\n\n.user-select(@value) {\n\t-webkit-user-select: @value; /* Chrome all / Safari all */\n\t-moz-user-select: @value; /* Firefox all */\n\t-ms-user-select: @value; /* IE 10+ */\n\tuser-select: @value; /* Likely future */\n}\n\n.chrome63-column-input-fields-fixes() {\n\t//Fix issue https://github.com/Orckestra/C1-CMS-Foundation/issues/506\n\t@media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) {\n\t\tui|fielddata {\n\t\t\tui|datainput,\n\t\t\tui|urlinputdialog {\n\t\t\t\tui|box {\n\t\t\t\t\toverflow: visible;\n\t\t\t\t\tpadding: 0 2px;\n\n\t\t\t\t\tinput {\n\t\t\t\t\t\tpadding-left: 5px;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Website/Composite/styles/default/_normalize.less",
    "content": "* {\n\tcursor: default;\n\t-moz-box-sizing: border-box;\n\t-webkit-box-sizing: border-box;\n\tbox-sizing: border-box;\n}\n\n*:focus, *:focus * {\n\toutline: none;\n}\n\n//\n// 1. Set default font family to sans-serif.\n// 2. Prevent iOS text size adjust after orientation change, without disabling\n//    user zoom.\n//\n\nhtml {\n\tfont-family: sans-serif; // 1\n\t-ms-text-size-adjust: 100%; // 2\n\t-webkit-text-size-adjust: 100%; // 2\n}\n\n//\n// Remove default margin/padding.\n//\nhtml, body {\n\tmargin: 0;\n\tpadding: 0;\n\tborder: none;\n}\n\n// Links\n// ==========================================================================\n\n//\n// 1. Remove the gray background color from active links in IE 10.\n//\n\na {\n\ttext-decoration: none;\n\tbackground-color: transparent; // 1\n\timg {\n\t\tcursor: pointer;\n\t}\n}\n\n//\n// Improve readability when focused and also mouse hovered in all browsers.\n//\n\na:active,\na:hover {\n\toutline: 0;\n}\n\n//\n// Remove border when inside `a` element in IE 8/9/10.\n//\n\nimg {\n\tborder: 0;\n}\n\n// Scrollbar\n// ==========================================================================\n\n// Only Chrome support custom scrollbar styling\n.webkit-d {\n\t::-webkit-scrollbar {\n\t\twidth: 13px;\n\t\theight: 13px;\n\t\tbackground: #FAFAFA;\n\t}\n\n\t::-webkit-scrollbar-thumb {\n\t\tbackground: #CACACA;\n\t\tborder: 3px solid #FAFAFA;\n\t\tborder-radius: 7px;\n\n\t\t&:hover {\n\t\t\tbackground: @primary-color;\n\t\t}\n\t}\n}\n\n// Forms\n// ==========================================================================\nform { /* assuming that all forms are standard body-childnode dot net forms! */\n\tpadding: 0;\n\tmargin: 0;\n\theight: 100%;\n}\n\n//\n// Known limitation: by default, Chrome and Safari on OS X allow very limited\n// styling of `select`, unless a `border` property is set.\n//\n\n//\n// 1. Correct color not being inherited.\n//    Known issue: affects color of disabled elements.\n// 2. Correct font properties not being inherited.\n// 3. Address margins set differently in Firefox 4+, Safari, and Chrome.\n//\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n\tcolor: inherit; // 1\n\tfont: inherit; // 2\n\tmargin: 0; // 3\n}\n\n//\n// Address `overflow` set to `hidden` in IE 8/9/10/11.\n//\n\nbutton {\n\toverflow: visible;\n}\n\n//\n// Address inconsistent `text-transform` inheritance for `button` and `select`.\n// All other form control elements do not inherit `text-transform` values.\n// Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.\n// Correct `select` style inheritance in Firefox.\n//\n\nbutton,\nselect {\n\ttext-transform: none;\n}\n\n//\n// 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n//    and `video` controls.\n// 2. Correct inability to style clickable `input` types in iOS.\n// 3. Improve usability and consistency of cursor style between image-type\n//    `input` and others.\n//\n\nbutton,\nhtml input[type=\"button\"], // 1\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n\t-webkit-appearance: button; // 2\n\tcursor: pointer; // 3\n}\n\n//\n// Re-set default cursor for disabled elements.\n//\n\nbutton[disabled],\nhtml input[disabled] {\n\tcursor: default;\n}\n\n//\n// Remove inner padding and border in Firefox 4+.\n//\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n\tborder: 0;\n\tpadding: 0;\n}\n\n//\n// Address Firefox 4+ setting `line-height` on `input` using `!important` in\n// the UA stylesheet.\n//\n\ninput {\n\tline-height: normal;\n}\n\n//\n// It's recommended that you don't attempt to style these elements.\n// Firefox's implementation doesn't respect box-sizing, padding, or width.\n//\n// 1. Address box sizing set to `content-box` in IE 8/9/10.\n// 2. Remove excess padding in IE 8/9/10.\n//\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n\tbox-sizing: border-box; // 1\n\tpadding: 0; // 2\n}\n\n//\n// Fix the cursor style for Chrome's increment/decrement buttons. For certain\n// `font-size` values of the `input`, it causes the cursor style of the\n// decrement button to change from `default` to `text`.\n//\n\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n\theight: auto;\n}\n\n//\n// Remove default vertical scrollbar in IE 8/9/10/11.\n//\n\ntextarea {\n\toverflow: auto;\n}\n\n\ntextarea,\ninput {\n\tcursor: auto;\n\t-moz-user-select: text;\n\t-ms-user-select: text;\n\t-webkit-user-select: text;\n\tuser-select: text;\n\tresize: none;\n}\n\n// Tables\n// ==========================================================================\n\n//\n// Remove most spacing between table cells.\n//\n\ntable {\n\tborder-collapse: collapse;\n\tborder-spacing: 0;\n}\n\ntd,\nth {\n\tpadding: 0;\n}\n"
  },
  {
    "path": "Website/Composite/styles/default/_variables.less",
    "content": "﻿//== Path\r\n@images-root-path: '../images';\r\n\r\n\r\n//== Colors\r\n@primary-color: #22B980; // == Brand Color\r\n@gray-color: #666;\r\n@gray-light-color: #ddd;\r\n\r\n\r\n\r\n//== Typography\r\n@font-family-sans-serif: \"Segoe UI\", Tahoma, sans-serif;\r\n@font-family-monospace:   Menlo, Monaco, Consolas, \"Courier New\", monospace;\r\n@font-size-base: 12px;\r\n@line-height-base: 1.25;\r\n@text-color: #333;\r\n@heading-h1-color: @primary-color;\r\n@heading-font-family: 'Roboto Condensed', sans-serif;\r\n\r\n//== Base\r\n@base-border-color: #ccc;\r\n@base-border-radius: 5px;\r\n@base-box-shadow: 0px 0px 12px -1px rgba(204,204,204,0.75);\r\n\r\n\r\n//== Buttons\r\n@btn-border-radius: 4px;\r\n@btn-border-color: @primary-color;\r\n@btn-bg-color: #fff;\r\n@btn-bg-image: none;\r\n@btn-color: @primary-color; //#575757;\r\n\r\n@btn-hover-border-color: darken(@primary-color, 5%);\r\n@btn-hover-bg-color: #fff;\r\n@btn-hover-color: darken(@primary-color, 5%);\r\n\r\n@btn-primary-border-color: @primary-color;\r\n@btn-primary-bg-color: @primary-color;\r\n@btn-primary-bg-image: linear-gradient(to bottom, @btn-primary-bg-color 0%, darken(@btn-primary-bg-color, 5%) 100%); /* W3C */\r\n@btn-primary-color: #fff;\r\n\r\n@btn-toolbar-border-color: @base-border-color;\r\n@btn-toolbar-bg-color: #fff;\r\n@btn-toolbar-color: #575757;\r\n\r\n@btn-toolbar-hover-border-color: @primary-color;\r\n@btn-toolbar-hover-bg-color: #fff;\r\n@btn-toolbar-hover-color: @primary-color;\r\n\r\n\r\n//== MenuBar (Settings, Languages, Help, Developer tools... )\r\n@menubar-bg-color: #333;\r\n@menubar-text-color: #919191;\r\n\r\n//== Explorer (Perspective Navbar)\r\n@explorer-width: 50px;\r\n@explorer-expanded-width: 240px;\r\n@explorer-bg-color: #333;\r\n@explorer-icon-color: #9A9A9A;\r\n@explorer-text-color: #9A9A9A;\r\n@explorer-text-active-color: @primary-color;\r\n\r\n\r\n//== Tabs\r\n@tabs-border-color: #ddd;\r\n@tabs-border-radius: @base-border-radius;\r\n@tabs-bg-color: #fff;\r\n@tabs-text-color: #ADADAD;\r\n\r\n@tabs-active-bg-color: #fff;\r\n@tabs-active-border-color: @base-border-color;\r\n@tabs-active-text-color: @primary-color;\r\n\r\n\r\n// Trees\r\n@tree-bg-color: #EFEFEF;\r\n@tree-icon-color: #999;\r\n@tree-root-open-icon-color: @primary-color;\r\n@tree-node-open-icon-color: #999;\r\n@tree-node-focused-icon-color: @primary-color;\r\n@tree-text-color: @text-color;\r\n@tree-text-focused-color: #fff;\r\n@tree-text-focused-bg-color: @primary-color;\r\n@tree-font-size: 13px;\r\n\r\n//== Toolbars\r\n@visual-editor-toolbar-bg-color: #EFEFEF;\r\n@pagetemplates-toolbar-bg-color: #EFEFEF;\r\n\r\n//== Dialogs\r\n@dialog-border-radius: @base-border-radius;\r\n@dialog-bg-color: #FFF;\r\n@dialog-border-color: @base-border-color;\r\n@dialog-header-bg-color: #F7F7F7;\r\n\r\n\r\n//== Balloons\r\n@balloons-bg-color: lightyellow;\r\n@balloons-border-color: @base-border-color;\r\n@balloons-width: 280px;\r\n\r\n\r\n//== Forms, Fields\r\n@fields-group-bg-color: #F7F7F7;\r\n@fields-group-border-color: @base-border-color;\r\n@fields-group-border-radius: @base-border-radius;\r\n\r\n\r\n\r\n@field-label-color: #999;\r\n@field-border-color: @base-border-color;\r\n@field-border-radius: @base-border-radius;\r\n@field-bg-color: #fff;\r\n@field-readonly-bg-color: darken(@field-bg-color, 4%);\r\n\r\n@field-error-color: #A40000;\r\n\r\n//Tables\r\n@table-border-color: #ddd;\r\n@table-header-bg-color: #F7F7F7;\r\n@table-bg-hover: #f5f5f5;\r\n\r\n//Z-indexes\r\n@balloonset-zindex: 3; /* below dialogs */\r\n@dialogset-zindex: 4; /* below popupset */\r\n@dialogballoonset-zindex: 5; /* above dialogs */\r\n@popupset-zindex: 5; /* above dialogset */\r\n@dialog-zindex: 6; /* above shadow - adjusted by script */\r\n\r\n//Cache buster - see http://www.bennadel.com/blog/2643-cache-busting-css-images-with-less-css.htm\r\n@cache-version: `( new Date() ).getTime()` ;"
  },
  {
    "path": "Website/Composite/styles/default/balloons.less",
    "content": "ui|balloonset {\r\n\tdisplay: block;\r\n\toverflow: visible;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 0;\r\n\theight: 0;\r\n\tz-index: @balloonset-zindex; // below dialogs\r\n}\r\n\r\nui|balloonset#dialogballoonset {\r\n\tz-index: @dialogballoonset-zindex; //above dialogs\r\n}\r\n\r\nui|balloon {\r\n\tmin-width: 280px;\r\n\tbackground: @balloons-bg-color;\r\n\tborder-radius: @base-border-radius;\r\n\tborder-bottom-left-radius: 0;\r\n\tborder: solid 1px @balloons-border-color;\r\n\tdisplay: block;\r\n\toverflow: visible;\r\n\tposition: absolute;\r\n\ttransition-property: top, left;\r\n\ttransition-duration: 0.25s;\r\n\tbox-shadow: 0px 0px 12px -2px rgba(204,204,204,1);\r\n\r\n\t&:after, &:before {\r\n\t\tcontent: '';\r\n\t\tposition: absolute;\r\n\t\tborder-style: solid;\r\n\t\twidth: 0;\r\n\t\tbottom: 0;\r\n\t\tdisplay: block;\r\n\t\tborder-width: 8px;\r\n\t}\r\n\r\n\t&:after {\r\n\t\tborder-color: transparent @balloons-bg-color @balloons-bg-color transparent;\r\n\t\tz-index: 1;\r\n\t\tleft: -14px;\r\n\t\tborder-width: 7px;\r\n\t}\r\n\r\n\t&:before {\r\n\t\tborder-style: solid;\r\n\t\tborder-color: transparent @balloons-border-color @balloons-border-color transparent;\r\n\t\tz-index: 0;\r\n\t\tleft: -16px;\r\n\t\tbottom: -1px;\r\n\t}\r\n\r\n\t&.left {\r\n\t\tborder-bottom-right-radius: 0;\r\n\t\tborder-bottom-left-radius: @base-border-radius;\r\n\r\n\t\t&:after {\r\n\t\t\tborder-color: transparent transparent @balloons-bg-color @balloons-bg-color;\r\n\t\t\tright: -14px;\r\n\t\t\tleft: auto;\r\n\t\t}\r\n\r\n\t\t&:before {\r\n\t\t\tborder-color: transparent transparent @balloons-border-color @balloons-border-color;\r\n\t\t\tright: -16px;\r\n\t\t\tleft: auto;\r\n\t\t}\r\n\t}\r\n\r\n\tui|controlgroup {\r\n\t\tposition: absolute;\r\n\t\ttop: -7px;\r\n\t\tright: -7px;\r\n\t}\r\n}\r\n\r\nui|balloontext {\r\n\tdisplay: block;\r\n\twidth: 100%;\r\n\t.user-select(none);\r\n\tposition: relative;\r\n\tz-index: 2;\r\n\tpadding: 15px 18px 15px 15px;\r\n}\r\n\r\nui|balloonspeak {\r\n\tdisplay: none;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/base.less",
    "content": "﻿html,\r\nbody {\r\n\theight: 100%;\r\n\toverflow: hidden;\r\n}\r\n\r\nhtml,\r\ninput,\r\ntextarea,\r\nbutton,\r\nselect,\r\ntd,\r\nth {\r\n\tfont-family: @font-family-sans-serif;\r\n\tfont-size: @font-size-base;\r\n\tline-height: @line-height-base;\r\n\tcolor: @text-color;\r\n}\r\n\r\na {\r\n\tcolor: @primary-color;\r\n\ttext-decoration: none;\r\n\r\n\t&:hover {\r\n\t\tcolor: darken(@primary-color, 10%);\r\n\t}\r\n}\r\n\r\nimg.designmodesanitizer {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 24px; /* ie must have a fixed px height */\r\n\tz-index: 2; /* above selectorindicator in EditorSelectorBinding */\r\n}\r\n\r\n\r\na.buttonurl {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n}\r\n\r\nui|binding,\r\nui|feedbackset { /* ONLY MAW USES THIS FOR NOW! */\r\n\tdisplay: none;\r\n}\r\n\r\nui|box {\r\n\tdisplay: block;\r\n}\r\n\r\nui|cover {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\toverflow: hidden;\r\n\tz-index: 5;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground-color: #fff;\r\n\r\n\t&.transparent {\r\n\t\tbackground-color: transparent;\r\n\t}\r\n}\r\n\r\n.maxboxelement,\r\n.flexboxelement {\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\toverflow: hidden;\r\n}\r\n\r\nui|stagecontainer {\r\n\tdisplay: block;\r\n\toverflow: hidden;\r\n\tpadding-right: @explorer-width;\r\n\tmargin-right: -(@explorer-width + 1); // +1 to fix bug when Console disappear when ZOOM browser\r\n\tfloat: left;\r\n}\r\n\r\nui|flexbox#stageflexbox {\r\n\tpadding: 0;\r\n}\r\n\r\nui|stage {\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\toverflow: hidden;\r\n\tposition: relative;\r\n}\r\n\r\n\r\n/* Fix for IE9-10 */\r\nui|wizardpage > .flexboxelement,\r\nui|dialogpage > .flexboxelement {\r\n\theight: auto;\r\n\toverflow-y: auto;\r\n}\r\n\r\n\r\nui|persistance {\r\n\tdisplay: none;\r\n\t/*#ie behavior: url(#default#userdata);*/\r\n}\r\n\r\nui|window {\r\n\tdisplay: block;\r\n\tposition: relative; /* to contain a possible cover */\r\n\toverflow: auto; /*?*/\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\t&#downloadwindow {\r\n\t\tposition: absolute;\r\n\t\twidth: 100px;\r\n\t\theight: 100px;\r\n\t\ttop: -100px;\r\n\t\tleft: -100px;\r\n\t}\r\n}\r\n\r\niframe {\r\n\tdisplay: block;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tborder: none !important;\r\n\tborder-width: 0;\r\n}\r\n\r\nui|scrollbox {\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\toverflow: auto !important;\r\n\tposition: relative; /* marks srollbox as an \"offsetparent\" for position calculations */\r\n}\r\n\r\nui|scrollbox.infobox {\r\n\tbackground-color: white;\r\n\tborder: 1px solid @base-border-color;\r\n}\r\n\r\nui|status {\r\n\tdisplay: none;\r\n}\r\n\r\n[isdisabled=\"true\"], .isdisabled {\r\n\topacity: 0.4;\r\n\r\n\t[isdisabled=\"true\"] {\r\n\t\topacity: 1;\r\n\t}\r\n}\r\n\r\nui|toolbar[isdisabled=\"true\"],\r\npage[isdisabled=\"true\"] {\r\n\topacity: 0.95;\r\n\r\n\tui|toolbarbutton[isdisabled=\"true\"] {\r\n\t\topacity: 0.4;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/bindingmappings.less",
    "content": "ui|bindingmappingset,\r\nui|bindingmapping {\r\n\tdisplay: block;\r\n\toverflow: visible;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 0;\r\n\theight: 0;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/branding.less",
    "content": ".brand-name {\n\tposition: relative;\n\tpadding-top: 10px;\n\n\t.brand-icon {\n\t\twidth: 50px;\n\t\ttext-align: center;\n\n\t\timg {\n\t\t\tmax-width: 50px;\n\t\t\tmax-height: 50px;\n\t\t}\n\t}\n\n\t.brand-text {\n\t\tposition: absolute;\n\t\ttop: 20px;\n\t\tleft: 50px;\n\t}\n\n\t&:hover {\n\t\topacity: 0.85;\n\t}\n}\n\n.brand-logo-wrapper {\n\tbackground: #333;\n\tborder-top-left-radius: 10px;\n\tborder-top-right-radius: 10px;\n\tmargin: -30px -30px 40px -30px;\n}\n\n .brand-logo {\n\t\theight: 110px;\n\t\twidth: 250px;\n\t\tmargin: 20px auto 30px auto;\n\t\tbackground-image: url(\"@{images-root-path}/logo.png?cacheversion=@{cache-version}\");\n\t\tbackground-position: center center;\n\t\tbackground-repeat: no-repeat;\n}\n\n.brand-logo.dark {\n\tbackground-image: url(\"@{images-root-path}/logo-dark.png?cacheversion=@{cache-version}\");\n}\n\n .company-logo-wrapper {\n\t\theight: 50px;\n\t\twidth: 100px;\n\t\tmargin-top: 10px;\n\t\tmargin-right: -15px;\n\t\tfloat: right;\n}\n\n.brand-main {\n\tdisplay: block;\n\tposition: absolute;\n\tbottom: 0;\n\tbackground: @explorer-bg-color;\n\tpadding: 0 13px 10px 13px;\n}\n"
  },
  {
    "path": "Website/Composite/styles/default/broadcasters.less",
    "content": "ui|broadcasterset,\r\nui|broadcaster {\r\n\tposition: absolute;\r\n\tvisibility: hidden;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/buttons.less",
    "content": "/* see \"toolbars.css\" for styles shared with toolbarbutton */\r\n/** NOTICE SHARED LAYOUT! */\r\nui|toolbarbutton,\r\nui|clickbutton,\r\nui|radiobutton,\r\nui|checkbutton,\r\nui|toolbarlabel {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n\tfloat: left;\r\n\tmargin: 2px;\r\n}\r\n\r\n// == ClickButton (usage: In dialogs )\r\nui|clickbutton {\r\n\tpadding: 0;\r\n\tmargin: 2px 6px; // margin at top and bottom should have some value, so buttons look ok when wraps\r\n\r\n\tui|labelbox {\r\n\t\tfloat: none;\r\n\t\toverflow: hidden;\r\n\t\tpadding: 6px 15px;\r\n\t\tborder-radius: @btn-border-radius;\r\n\t\tborder: solid 1px @btn-border-color;\r\n\t\tcolor: @btn-color;\r\n\t\tbackground-color: @btn-bg-color;\r\n\t\ttext-transform: uppercase;\r\n\t}\r\n\r\n\r\n\t&.active {\r\n\t\tui|labelbox {\r\n\t\t\tborder-color: @btn-border-color;\r\n\t\t\tbackground-color: @btn-bg-color;\r\n\t\t\tbackground-image: @btn-bg-image;\r\n\t\t\tcolor: @btn-color;\r\n\t\t}\r\n\t}\r\n\r\n\t&.focused, &.primary {\r\n\t\tui|labelbox {\r\n\t\t\tborder-color: @btn-primary-border-color;\r\n\t\t\tbackground-color: @btn-primary-bg-color;\r\n\t\t\tbackground-image: @btn-primary-bg-image;\r\n\t\t\tcolor: @btn-primary-color;\r\n\t\t}\r\n\t}\r\n\r\n\t&.hover {\r\n\t\tui|labelbox {\r\n\t\t\tborder-color: @btn-hover-border-color;\r\n\t\t\tbackground-color: @btn-hover-bg-color;\r\n\t\t\tbackground-image: none;\r\n\t\t\tcolor: @btn-hover-color;\r\n\t\t}\r\n\r\n\t\t&.focused, &.primary {\r\n\t\t\tui|labelbox {\r\n\t\t\t\tborder-color: darken(@btn-primary-border-color, 5%);\r\n\t\t\t\tbackground-color: @btn-primary-bg-color;\r\n\t\t\t\tbackground-image: @btn-primary-bg-image;\r\n\t\t\t\tcolor: @btn-primary-color;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&.simple-icon, &.simple-text { // usage: in table reports, for example SEO\r\n\t\tui|labelbox {\r\n\t\t\tborder: none;\r\n\t\t\tpadding: 5px;\r\n\t\t\tbackground: none;\r\n\t\t\tcolor: #575757;\r\n\t\t\ttext-transform: none;\r\n\t\t}\r\n\r\n\t\t&.hover {\r\n\t\t\tui|labelbox {\r\n\t\t\t\tcolor: @primary-color;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n//== ToolbarButton\r\nui|toolbarbutton {\r\n\tborder-radius: 4px;\r\n\ttext-transform: uppercase;\r\n\tborder: 1px solid @btn-toolbar-border-color;\r\n\tborder-radius: @btn-border-radius;\r\n\tbackground: @btn-toolbar-bg-color;\r\n\tcolor: @btn-toolbar-color;\r\n\tmargin: 2px 10px 2px 0;\r\n\tbox-shadow: 0 2px 2px -2px #ddd;\r\n\r\n\tui|labelbody {\r\n\t\theight: 18px;\r\n\t\tline-height: 18px;\r\n\t}\r\n\r\n\tui|labelbox {\r\n\t\tpadding: 6px 11px;\r\n\t}\r\n\r\n\t&.btn-group-left {\r\n\t\tmargin-right: 0;\r\n\t\tborder-top-right-radius: 0;\r\n\t\tborder-bottom-right-radius: 0;\r\n\r\n\t\t&.hover {\r\n\t\t\tborder-right: 1px solid @btn-toolbar-border-color !important;\r\n\t\t}\r\n\t}\r\n\r\n\t&.btn-group-right {\r\n\t\tmargin-left: 0;\r\n\t\tborder-top-left-radius: 0;\r\n\t\tborder-bottom-left-radius: 0;\r\n\t\tborder-left: 0;\r\n\t}\r\n\r\n\r\n\t&.combobutton {\r\n\t\tui|combobox {\r\n\t\t\tborder-left: 1px solid transparent;\r\n\t\t\tmargin: 0;\r\n\t\t\tdisplay: block;\r\n\t\t\tfloat: left;\r\n\t\t\tline-height: 30px;\r\n\t\t\tfont-size: 9px;\r\n\t\t\tpadding: 0 10px;\r\n\t\t\t.user-select(none);\r\n\t\t\tposition: relative;\r\n\t\t\tcolor: transparent;\r\n\t\t\twidth: 28px;\r\n\t\t\theight: 30px;\r\n\r\n\t\t\t&:before, &:after {\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\twidth: 0;\r\n\t\t\t\theight: 0;\r\n\t\t\t\tborder-style: solid;\r\n\t\t\t}\r\n\r\n\t\t\t&:before {\r\n\t\t\t\ttop: 12px;\r\n\t\t\t\tright: 10px;\r\n\t\t\t\tborder-width: 5px 5px 0 5px;\r\n\t\t\t\tborder-color: @btn-hover-border-color transparent transparent transparent;\r\n\t\t\t}\r\n\r\n\t\t\t&:after {\r\n\t\t\t\ttop: 12px;\r\n\t\t\t\tright: 11px;\r\n\t\t\t\tborder-width: 4px 4px 0 4px;\r\n\t\t\t\tborder-color: @btn-hover-bg-color transparent transparent transparent;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&[ischecked='true'] {\r\n\t\t\tui|combobox {\r\n\t\t\t\t&:before {\r\n\t\t\t\t\ttop: 11px;\r\n\t\t\t\t\tright: 10px;\r\n\t\t\t\t\tborder-width: 0 5px 5px 5px;\r\n\t\t\t\t\tborder-color: transparent transparent @gray-color transparent;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\ttop: 12px;\r\n\t\t\t\t\tright: 11px;\r\n\t\t\t\t\tborder-width: 0 4px 4px 4px;\r\n\t\t\t\t\tborder-color: transparent transparent @btn-hover-bg-color transparent;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&.hover, &.active, &[ischecked='true'] {\r\n\t\tborder-color: @btn-toolbar-hover-border-color;\r\n\t}\r\n\r\n\t&.hover, &.active {\r\n\t\tbackground-color: @btn-toolbar-hover-bg-color;\r\n\t\tcolor: @btn-hover-color;\r\n\t}\r\n\r\n\t&.tabbutton { //== usage: \"More Tabs\" buttons when browser width is small\r\n\t\tposition: absolute;\r\n\t\tmargin-top: 1px;\r\n\t\tz-index: 400;\r\n\t\tdisplay: none;\r\n\t\tbackground-color: transparent;\r\n\t\tmargin: 0;\r\n\t\tpadding: 0;\r\n\r\n\t\tui|labelbox {\r\n\t\t\tpadding: 8px 10px;\r\n\t\t\tfont-weight: bold;\r\n\r\n\t\t\t.arrow {\r\n\t\t\t\tfont-size: 120%;\r\n\t\t\t\tfont-family: \"Courier New\", monospace;\r\n\t\t\t\tposition: relative;\r\n\t\t\t\ttop: -1px;\r\n\t\t\t\tleft: 2px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\nui|toolbargroup.last {\r\n\tui|toolbarbutton:last-child {\r\n\t\tmargin-right: 0;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/controls.less",
    "content": "﻿ui|controlgroup, ui|control {\r\n\tposition: absolute;\r\n\tdisplay: block;\r\n}\r\n\r\nui|controlgroup {\r\n\tright: 0;\r\n\ttop: 0;\r\n\tz-index: 6;\r\n}\r\n\r\nui|control {\r\n\tfont-family: @font-family-monospace;\r\n\r\n\t&[controltype=\"close\"] {\r\n\t\tright: 5px;\r\n\t\ttop: 6px;\r\n\t\theight: 30px;\r\n\t\twidth: 30px;\r\n\r\n\t\tui|labelbody {\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tcontent: '\\00d7';\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\ttext-align: center;\r\n\t\t\t\twidth: 30px;\r\n\t\t\t\theight: 30px;\r\n\t\t\t\tcolor: darken(@base-border-color, 25%);\r\n\t\t\t\tfont-size: 30px;\r\n\t\t\t\tline-height: 25px;\r\n\t\t\t\tfont-weight: bold;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.hover {\r\n\t\t\tui|labelbody:after {\r\n\t\t\t\tcolor: darken(@base-border-color, 50%);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/cursors.less",
    "content": "ui|cursor {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\twidth: 0;\r\n\theight: 0;\r\n\toverflow: visible;\r\n\tz-index: 4; /* why this much needed? */\r\n\tmargin-top: 16px;\r\n\tmargin-left: 16px;\r\n\twidth: 24px;\r\n\theight: 24px;\r\n\ttop: -100px;\r\n\tleft: -100px;\r\n}\r\n\r\nui|cursor ui|labelbox.indicator {\r\n\tposition: relative;\r\n\ttop: -10px;\r\n\tleft: 6px;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/decks.less",
    "content": "/* remember that both dekcs and deck gets assigned the \"flexboxelement\" class! */\r\n.deckselement {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n}\r\n\r\n.deckelement {\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\tclear: both;\r\n\toverflow: hidden;\r\n\tposition: absolute;\r\n\ttop: -10000px;\r\n}\r\n\r\n.loading-deck {\r\n\t.progressbar {\r\n\t\ttext-align: center;\r\n\t\tfont-size: 12px;\r\n\t}\r\n\r\n\t.progressbar-msg {\r\n\t\tpadding-bottom: 21px;\r\n\t\tmargin: 0 0 15px 0;\r\n\t\ttext-align: center;\r\n\t\tborder-bottom: solid 1px #ccc;\r\n\t}\r\n\r\n\tui|progressbar {\r\n\t\toverflow: hidden;\r\n\t\tdisplay: block;\r\n\t\twidth: 200px;\r\n\t\theight: 23px;\r\n\t\tmargin: 10px auto 22px auto;\r\n\t\tposition: relative;\r\n\t\ttext-align: right;\r\n\t\tpadding-top: 2px;\r\n\t\tpadding-right: 5px;\r\n\t\tbackground: url(\"@{images-root-path}/progressbar.png\") no-repeat;\r\n\r\n\t\tui|cover {\r\n\t\t\tbackground-color: white;\r\n\t\t\theight: 19px;\r\n\t\t\twidth: 190px;\r\n\t\t\tmargin-left: auto;\r\n\t\t\tmargin-right: 0;\r\n\t\t\tposition: static;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#startdeck .deckselement{\r\n\tdisplay: none;\r\n}\r\n\r\n\r\nui|stagedeck {\r\n\t> ui| window {\r\n\t\tbackground: @explorer-bg-color;\r\n\t\t> iframe {\r\n\t\t\tborder-radius: 5px 0 0 0;\r\n\t\t\tbackground: @dialog-bg-color;\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/dialogs/dialog-multiselector.less",
    "content": "﻿.dialog-multiselector {\r\n\r\n\tui|fields {\r\n\t\tpadding: 20px 15px 10px 25px;\r\n\t\tborder-top: solid 1px @dialog-border-color;\r\n\t}\r\n\r\n\tui|field {\r\n\t\tborder: none;\r\n\t\tfloat: left;\r\n\t\twidth: 220px;\r\n\t\tclear: none;\r\n\t\tpadding: 0 !important;\r\n\r\n\t\t&:after {\r\n\t\t\tclear: none;\r\n\t\t}\r\n\t}\r\n\r\n\t.controls {\r\n\t\tfloat: left;\r\n\t\tmargin: 0 5px 0 5px;\r\n\t\tfont-family: \"Courier New\", monospace;\r\n\r\n\t\tui|clickbutton {\r\n\t\t\tfloat: none;\r\n\t\t\tmargin: 0 0 3px 0;\r\n\t\t\tline-height: 18px;\r\n\r\n\t\t\tui|labelbox {\r\n\t\t\t\tpadding: 3px 10px;\r\n\t\t\t\twidth: 29px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tui|multiselector {\r\n\t\tdisplay: block;\r\n\t\twidth: 100%;\r\n\t\toverflow: hidden;\r\n\r\n\t\tui|box {\r\n\t\t\theight: 200px;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/dialogs/dialogs.less",
    "content": "ui|dialogset,\r\nui|dialog,\r\nui|dialoghead,\r\nui|dialogbody,\r\nui|dialogpage,\r\nui|wizardpage {\r\n\tdisplay: block;\r\n}\r\n\r\nui|dialogcover {\r\n\tposition: absolute;\r\n\theight: 100%; /* adjusted by script */\r\n\twidth: 100%; /* adjusted by script */\r\n\tleft: 0;\r\n\ttop: 0;\r\n\tz-index: 2; /* adjusted by script */\r\n\tbackground-color: #000;\r\n\t.opacity(0.3);\r\n}\r\n\r\nui|dialogset {\r\n\toverflow: visible;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 0;\r\n\theight: 0;\r\n\tz-index: @dialogset-zindex; /* below popupset */\r\n}\r\n\r\nui|dialog {\r\n\tbackground-color: @dialog-bg-color;\r\n\toverflow: hidden;\r\n\tposition: absolute;\r\n\tz-index: @dialog-zindex; /* above shadow - adjusted by script */\r\n\tmargin-top: -10000px;\r\n\tpadding: 0px; /* override chrome user agent stylesheet 1em */\r\n\tborder-radius: @dialog-border-radius;\r\n\tborder: solid 1px @dialog-border-color;\r\n}\r\n\r\nui|dialoghead {\r\n\tbackground: @dialog-header-bg-color;\r\n\r\n\tui|titlebarbody {\r\n\t\tpadding: 20px 15px 18px 0px;\r\n\t}\r\n}\r\n\r\nui|dialogbody {\r\n\tpadding-top: 0 !important;\r\n\twidth: 100%; /* ie bug */\r\n\toverflow: hidden;\r\n}\r\n\r\n//== Dialog Page and Wizard Page\r\nui|dialogpage, ui|wizardpage {\r\n\theight: 100%;\r\n\twidth: 100%;\r\n\toverflow: hidden;\r\n\tvisibility: hidden;\r\n\r\n\t&.auto {\r\n\t\theight: auto;\r\n\t}\r\n\r\n\tui|scrollbox {\r\n\t\tui|fields {\r\n\t\t\tpadding: 20px 25px;\r\n\t\t}\r\n\r\n\t\t.padded ui|fields {\r\n\t\t\tpadding: 0;\r\n\t\t}\r\n\t}\r\n\r\n\tui|pagebody {\r\n\t\tpadding: 20px 25px;\r\n\t\tborder-top: 1px solid @dialog-border-color;\r\n\r\n\t\t&.filled {\r\n\t\t\tpadding: 0;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|dialogpage {\r\n\r\n\t&.with-top-toolbar {\r\n\r\n\t\tui|toolbar:first-child {\r\n\t\t\tpadding-top: 0;\r\n\t\t\tbackground: @dialog-header-bg-color;\r\n\t\t}\r\n\r\n\t\tui|pagebody {\r\n\t\t\tborder-top: 0;\r\n\t\t}\r\n\t}\r\n\r\n\t&.tabboxed {\r\n\r\n\t\tui|pagebody {\r\n\t\t\tpadding-top: 0;\r\n\t\t\tborder-top: 0;\r\n\t\t}\r\n\r\n\t\tui|tabs {\r\n\t\t\tbackground: @dialog-header-bg-color;\r\n\t\t}\r\n\r\n\t\tui|pagebody > ui|tabbox {\r\n\t\t\tmargin: 0 -25px;\r\n\t\t}\r\n\r\n\t\tui|tabpanels {\r\n\r\n\t\t\tui|fields {\r\n\t\t\t\tpadding: 20px 25px;\r\n\t\t\t}\r\n\r\n\t\t\t.padded ui|fields {\r\n\t\t\t\tpadding: 0;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n@media (min-width: 700px) { // usage: fix dialog UI for Compsoite.Forms.FormBuilder function properties\r\n\tui|dialogpage ui|field, .dialogsubpage ui|field {\r\n\t\twidth: 430px;\r\n\t\tborder: solid 1px @fields-group-border-color;\r\n\t\tborder-width: 0 1px;\r\n\t\tbackground: transparent;\r\n\t\tpadding: 0 17px;\r\n\r\n\t\t&.first {\r\n\t\t\tpadding-top: 8px;\r\n\t\t\tborder-top-width: 1px;\r\n\t\t\tborder-top-left-radius: @base-border-radius;\r\n\t\t\tborder-top-right-radius: @base-border-radius;\r\n\t\t}\r\n\r\n\t\t&:last-of-type {\r\n\t\t\tpadding-bottom: 25px;\r\n\t\t\tborder-bottom-width: 1px;\r\n\t\t\tborder-bottom-left-radius: @base-border-radius;\r\n\t\t\tborder-bottom-right-radius: @base-border-radius;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// Basic Function View\r\n@functionsbasic-column-width: 365px;\r\n@functionsbasic-column-gap: 20px;\r\n\r\nui|dialogpage.functionview-basic {\r\n\r\n\tui|field {\r\n\t\twidth: @functionsbasic-column-width;\r\n\t\tborder-radius: @base-border-radius;\r\n\t\tborder: 0;\r\n\t\tpadding: 0;\r\n\t\tdisplay: table;\r\n\t\toverflow: visible;\r\n\t\tposition: relative;\r\n\t\t-webkit-column-break-inside: avoid; /* Chrome, Safari, Opera */\r\n\t\tpage-break-inside: avoid; /* Firefox */\r\n\t\tbreak-inside: avoid; /* IE 10+ */\r\n\t\t@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\t\t/* IE 10, 11 */\r\n\t\tui|fielddata {\r\n\t\t\twidth: @functionsbasic-column-width;\r\n\t\t}\r\n\r\n\t\t&.fieldhelp {\r\n\t\t\tui|fielddata {\r\n\t\t\t\twidth: @functionsbasic-column-width - 30px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tui|fieldgroup {\r\n\t\t-webkit-column-width: @functionsbasic-column-width; /* Chrome, Safari, Opera */\r\n\t\t-moz-column-width: @functionsbasic-column-width; /* Firefox */\r\n\t\tcolumn-width: @functionsbasic-column-width;\r\n\t\t-moz-column-gap: @functionsbasic-column-gap;\r\n\t\t-webkit-column-gap: @functionsbasic-column-gap;\r\n\t\tcolumn-gap: @functionsbasic-column-gap;\r\n\r\n\t\t.chrome63-column-input-fields-fixes();\r\n\t}\r\n}\r\n\r\n.dialogsubpage {\r\n\theight: auto;\r\n\tmin-height: 100%; /* IE relies on flexibility instead */\r\n\tmax-height: 100%;\r\n\t&.with-top-toolbar {\r\n\t\tui|toolbar {\r\n\t\t\tpadding-top: 0;\r\n\t\t\tbackground: @dialog-header-bg-color;\r\n\t\t}\r\n\t}\r\n\r\n\tui|fieldgroup {\r\n\t\twidth: 100%;\r\n\t}\r\n}\r\n\r\n\r\nui|dialogborder {\r\n\tposition: absolute;\r\n\toverflow: hidden;\r\n\tz-index: 4;\r\n\r\n\t&.n {\r\n\t\ttop: 0;\r\n\t\tleft: 0;\r\n\t\twidth: 100%;\r\n\t\theight: 4px;\r\n\t}\r\n\r\n\t&.s {\r\n\t\tbottom: 0;\r\n\t\tleft: 0;\r\n\t\twidth: 100%;\r\n\t\theight: 4px;\r\n\t}\r\n\r\n\t&.w {\r\n\t\ttop: 0;\r\n\t\tleft: 0;\r\n\t\twidth: 4px;\r\n\t\theight: 100%;\r\n\t}\r\n\r\n\t&.e {\r\n\t\ttop: 0;\r\n\t\tright: 0;\r\n\t\twidth: 4px;\r\n\t\theight: 100%;\r\n\t}\r\n}\r\n\r\nui|dialog.resizable ui|dialogborder {\r\n\r\n\t&.n {\r\n\t\tcursor: n-resize;\r\n\t}\r\n\r\n\t&.s {\r\n\t\tcursor: s-resize;\r\n\t}\r\n\r\n\t&.w {\r\n\t\tcursor: w-resize;\r\n\t}\r\n\r\n\t&.e {\r\n\t\tcursor: e-resize;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/dialogs/dialogvignette.less",
    "content": "/* STANDARD DIALOGS ................................................................*/\r\n#dialoglayout {\r\n\tmargin: 0;\r\n\twidth: 306px;\r\n\ttable-layout: fixed;\r\n\r\n\ttd {\r\n\t\tvertical-align: middle;\r\n\t\tpadding: 0;\r\n\t}\r\n\r\n\t#dialogvignette {\r\n\t\tpadding: 0;\r\n\t\twidth: 50px;\r\n\t}\r\n\r\n\t#dialogtext {\r\n\t\tpadding-bottom: 4px;\r\n\t\tword-wrap: break-word;\r\n\t}\r\n}\r\n\r\n\r\nui|dialogvignette {\r\n\tdisplay: block;\r\n\twidth: 32px;\r\n\theight: 32px;\r\n\tmargin-right: 16px;\r\n}\r\n\r\nui|dialogpage ui|dialogvignette svg {\r\n\twidth: 32px;\r\n\theight: 32px;\r\n}\r\n\r\n\r\n/* STANDARD DIALOGS ................................................................*/\r\n\r\nui|dialogpage.question ui|dialogvignette,\r\nui|dialogvignette.question {\r\n\tcolor: #EFAD57;\r\n}\r\n\r\nui|dialogpage.warning ui|dialogvignette,\r\nui|dialogvignette.warning {\r\n\tcolor: #EFAD57;\r\n}\r\n\r\nui|dialogpage.message ui|dialogvignette,\r\nui|dialogvignette.message {\r\n\tcolor: #5FC0DC; /* usage: Broadcast Message */\r\n}\r\n\r\nui|dialogpage.error ui|dialogvignette,\r\nui|dialogvignette.error {\r\n\tcolor: #D75553;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/docks.less",
    "content": "\r\n/*\r\n * Docks are absolutely positioned in explorer in order to fix a display \r\n * bug on browser resize. The bug is only noticeable on second area and \r\n * higher (remove absolute positioning, navigate to area two, open some \r\n * stuff and resize the browser). They are NOT absolute in Mozilla because \r\n * moz may update display multiple times in a single thread, temporarily \r\n * showing the dock overlaying other stuff. \r\n */\r\nui|dock {\r\n\tdisplay: block;\r\n\toverflow: hidden;\r\n\r\n\t&.editors {\r\n\t\tborder-radius: 5px 0 0 0;\r\n\t\tbox-shadow: inset 0px 0px 0px 1px rgba(204,204,204,1);\r\n\t\tbackground: #fff;\r\n\t}\r\n}\r\n\r\nui|docktabs {\r\n\tdisplay: block;\r\n\tposition: relative !important;\r\n\toverflow: hidden;\r\n\tbox-shadow: inset 0px -1px 0px 0px rgba(204,204,204,1);\r\n\tpadding: 10px 10px 0 10px;\r\n\tbackground: #EFEFEF;\r\n\r\n\tui|toolbarbutton {\r\n\t\tposition: relative;\r\n\t}\r\n}\r\n\r\nui|docktab {\r\n\tdisplay: block;\r\n\tfloat: left;\r\n\tposition: relative;\r\n\twhite-space: nowrap;\r\n\tbottom: -100px; /* adjusted by script */\r\n\tborder: solid 1px #ddd;\r\n\tborder-radius: 5px 5px 0 0;\r\n\tbackground: #fff;\r\n\tz-index: 2;\r\n\tmargin-right: -4px;\r\n\ttext-transform: uppercase;\r\n\tpadding: 10px 30px 10px 19px;\r\n\r\n\r\n\t.closecontrol {\r\n\t\ttop: 5px;\r\n\t\tright: 5px;\r\n\t\twidth: 21px;\r\n\t\theight: 21px;\r\n\t\tborder-radius: 50%;\r\n\r\n\t\tui|labelbody:after {\r\n\t\t\tfont-weight: normal;\r\n\t\t\tfont-size: 17px;\r\n\t\t\tline-height: 13px;\r\n\t\t\ttext-align: center;\r\n\t\t\tcolor: #fff;\r\n\t\t\tbackground: #D5D5D5;\r\n\t\t\twidth: 15px;\r\n\t\t\theight: 15px;\r\n\t\t\tborder-radius: 50%;\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 3px;\r\n\t\t\tleft: 3px;\r\n\t\t}\r\n\r\n\t\t&.hover {\r\n\t\t\tui|labelbody:after {\r\n\t\t\t\tbackground: #ABABAB;\r\n\t\t\t\tcolor: #fff;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tui|labelbox {\r\n\t\tcolor: #ADADAD;\r\n\r\n\t\t&.highlighted {\r\n\t\t\tui|labelbody {\r\n\t\t\t\tcolor: @primary-color;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.overflowed {\r\n\t\t\tui|labeltext:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\ttop: 0;\r\n\t\t\t\tright: 0;\r\n\t\t\t\twidth: 30px;\r\n\t\t\t\theight: 100%;\r\n\t\t\t\tdisplay: block;\r\n\t\t\t\tcontent: ' ';\r\n\t\t\t\tbox-shadow: inset -20px 0 39px -7px rgba(255,255,255,1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.image-and-text {\r\n\t\t\tui|labeltext { \r\n\t\t\t\tfloat: left;\r\n\t\t\t\tmargin-left: 8px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tui|labeltext {\r\n\t\tposition: relative;\r\n\t\toverflow: hidden;\r\n\t\tfont-family: @heading-font-family;\r\n\t\tfont-size: 13px;\r\n\t\twidth: 110px;\r\n\t}\r\n\r\n\t&.selected {\r\n\t\tz-index: 3;\r\n\t\tborder-color: @base-border-color @base-border-color transparent @base-border-color;\r\n\r\n\t\tui|labelbody {\r\n\t\t\tcolor: @primary-color;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t.default ui|controlgroup {\r\n\t\tdisplay: none;\r\n\t}\r\n}\r\n\r\n\r\nui|dockpanels {\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\tclear: both;\r\n\toverflow: hidden;\r\n\twidth: auto;\r\n}\r\n\r\nui|dockpanel { /* styles comparable to deck - please coordinate all changes! */\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\tclear: both;\r\n\toverflow: hidden;\r\n\tposition: absolute;\r\n\ttop: -10000px;\r\n}\r\n\r\n\r\n/* EDITORS DOCK .......................... */\r\nui|splitpanel.editors {\r\n\tbox-shadow: inset 0px 5px 0px 0px rgba(51,51,51,1);\r\n}\r\n\r\n/* START DOCK ............................ */\r\n\r\nui|dock.start {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\r\n\tui|docktab {\r\n\t\tdisplay: none;\r\n\t}\r\n\r\n\tui|docktabs ui|controlgroup {\r\n\t\tdisplay: none;\r\n\t}\r\n\r\n\tui|docktabs {\r\n\t\theight: 2px;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/editors.less",
    "content": "ui|functioneditor,\r\nui|parametereditor,\r\nui|sourceeditor,\r\nui|visualeditor,\r\nui|visualmultieditor,\r\nui|visualmultitemplateeditor {\r\n\tdisplay: block;\r\n\toverflow: hidden;\r\n\tposition: relative; /* contain the cover */\r\n}\r\nui|functioneditor textarea,\r\nui|parametereditor textarea,\r\nui|sourceeditor textarea,\r\nui|visualeditor textarea,\r\nui|visualeditor ui|selector,\r\nui|visualeditor div,\r\nui|visualmultieditor textarea,\r\nui|visualmultieditor ui|selector,\r\nui|visualmultieditor div,\r\nui|visualmultitemplateeditor textarea,\r\nui|visualmultitemplateeditor ui|selector,\r\nui|visualmultitemplateeditor div {\r\n\tdisplay: none;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/errors.less",
    "content": "ui|errorset, ui|error {\r\n\tdisplay: none;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/explorer.less",
    "content": "ui|explorerbody,\r\nui|explorermenu,\r\nui|explorertoolbar,\r\nui|explorertoolbarbutton,\r\nui|explorerbar,\r\nui|explorerbarbutton {\r\n\tdisplay: block;\r\n}\r\n\r\n.explorermenucover {\r\n\tmargin-left: @explorer-width;\r\n\tdisplay: none;\r\n}\r\n\r\nui|explorer {\r\n\tfloat: left;\r\n\tmargin-top: -30px;\r\n\tpadding-top: 30px;\r\n\twidth: @explorer-width;\r\n\r\n\t&.scrollup {\r\n\t\t&:before {\r\n\t\t\tcontent: \"\";\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 27px;\r\n\t\t\tleft: 5px;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tborder-style: solid;\r\n\t\t\tborder-width: 0px 20px 6px 20px;\r\n\t\t\tborder-color: transparent transparent @primary-color transparent;\r\n\t\t}\r\n\r\n\t\t&:after {\r\n\t\t\tcontent: \"\";\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 29px;\r\n\t\t\tleft: 6px;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tborder-style: solid;\r\n\t\t\tborder-width: 0px 19px 4px 19px;\r\n\t\t\tborder-color: transparent transparent @menubar-bg-color transparent;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|explorermenu {\r\n\tbackground: @explorer-bg-color;\r\n\tfloat: left;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\toverflow: hidden;\r\n\toverflow-y: auto;\r\n\tbox-sizing: content-box;\r\n\tpadding-right: 16px;\r\n\tposition: relative;\r\n\tz-index: 1;\r\n\r\n\tui|toolbarbutton {\r\n\t\tbackground: none !important;\r\n\t\tfilter: none;\r\n\t\tcolor: @explorer-icon-color;\r\n\t\tbox-shadow: none;\r\n\t}\r\n\r\n\tui|toolbar {\r\n\t\tborder: none;\r\n\t}\r\n\r\n\t.menu-toggle {\r\n\t\tmargin-top: 8px;\r\n\r\n\t\tui|labelbox {\r\n\t\t\tpadding: 0;\r\n\t\t}\r\n\t}\r\n\r\n\tui|labeltext {\r\n\t\tdisplay: none;\r\n\t}\r\n\r\n\t&.scrolldown {\r\n\t\t&:before {\r\n\t\t\tz-index: 6;\r\n\t\t\tcontent: \"\";\r\n\t\t\tposition: absolute;\r\n\t\t\tbottom: 4px;\r\n\t\t\tleft: 5px;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tborder-style: solid;\r\n\t\t\tborder-width: 6px 20px 0 20px;\r\n\t\t\tborder-color: @primary-color transparent transparent transparent;\r\n\t\t}\r\n\r\n\t\t&:after {\r\n\t\t\tz-index: 6;\r\n\t\t\tcontent: \"\";\r\n\t\t\tposition: absolute;\r\n\t\t\tbottom: 6px;\r\n\t\t\tleft: 6px;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tborder-style: solid;\r\n\t\t\tborder-width: 4px 19px 0 19px;\r\n\t\t\tborder-color: @menubar-bg-color transparent transparent transparent;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|explorerbody {\r\n\theight: 100%;\r\n\toverflow: hidden;\r\n}\r\n\r\nui|explorertoolbar {\r\n\tpadding: 0;\r\n\r\n\tui|toolbarbody, ui|toolbargroup {\r\n\t\tfloat: none;\r\n\t}\r\n\r\n\tui|toolbargroup {\r\n\t\tmargin: 0;\r\n\t\tpadding: 0;\r\n\t}\r\n}\r\n\r\nui|explorertoolbarbutton {\r\n\tfilter: url(\"data:image/svg+xml;utf8,<svg xmlns=\\'http://www.w3.org/2000/svg\\'><filter id=\\'grayscale\\'><feColorMatrix type=\\'matrix\\' values=\\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\\'/></filter></svg>#grayscale\"); /* Firefox 10+, Firefox on Android */\r\n\tfilter: gray; /* IE6-9 */\r\n\tfilter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */\r\n\t&.hover, &.active {\r\n\t\tfilter: none;\r\n\t}\r\n}\r\n\r\nui|explorermenu ui|toolbarbutton,\r\nui|explorertoolbarbutton {\r\n\tfloat: left;\r\n\tmargin: 0;\r\n\tpadding: 21px 15px;\r\n\twidth: 100%;\r\n\tborder: none;\r\n\r\n\tui|labelbody {\r\n\t\tcolor: @explorer-icon-color;\r\n\t\ttext-transform: uppercase;\r\n\t\tfont-weight: bold;\r\n\t\tfont-family: Arial;\r\n\t}\r\n\r\n\tui|labelbox {\r\n\r\n\t\t&.image-and-text {\r\n\t\t\tui|labeltext {\r\n\t\t\t\tmargin-left: 38px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tui|labeltext {\r\n\t\tline-height: 22px;\r\n\t\tfont-weight: bold;\r\n\t\tcolor: @explorer-text-color;\r\n\t}\r\n\r\n\t&.active, &.hover {\r\n\t\tborder: none;\r\n\r\n\t\tui|labelbody {\r\n\t\t\tcolor: @explorer-text-active-color;\r\n\t\t}\r\n\r\n\t\tui|labeltext {\r\n\t\t\tcolor: @explorer-text-active-color;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|explorerdecks {\r\n\tdisplay: none;\r\n}\r\n.exploler-expanded-visible {\r\n\tdisplay: none;\r\n}\r\n\r\n.exploler-expanded-hide {\r\n\tdisplay: block;\r\n}\r\n\r\n.exploler-expanded {\r\n\r\n\t.exploler-expanded-visible {\r\n\t\tdisplay: block;\r\n\t}\r\n\r\n\t.exploler-expanded-hide { \r\n\t\tdisplay: none;\r\n\t}\r\n\r\n\r\n\tui|explorer {\r\n\t\twidth: @explorer-expanded-width;\r\n\r\n\t\tui|labeltext {\r\n\t\t\tdisplay: block;\r\n\t\t}\r\n\t}\r\n\r\n\tui|stagecontainer {\r\n\t\tpadding-right: @explorer-expanded-width;\r\n\t\tmargin-right: -@explorer-expanded-width;\r\n\t}\r\n\r\n\t.system-toolbar {\r\n\t\tleft: @explorer-expanded-width !important;\r\n\t}\r\n\r\n\tui|cover.explorermenucover {\r\n\t\tmargin-left: @explorer-expanded-width;\r\n\t\tdisplay: block;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/fields/calendar.less",
    "content": ".calendar {\r\n\tborder: 1px solid @base-border-color;\r\n\tbackground-color: #fff;\r\n\tposition: relative;\r\n\ttop: -1px;\r\n\r\n\ttable {\r\n\t\twidth: 100%;\r\n\t\tmargin: 0 !important;\r\n\t\tborder: 0 !important;\r\n\t\tborder-collapse: collapse;\r\n\r\n\t\ttd {\r\n\t\t\tpadding-top: 3px;\r\n\t\t\tpadding-bottom: 3px;\r\n\t\t\t.user-select(none);\r\n\t\t\ttext-align: center;\r\n\t\t\tvertical-align: top;\r\n\t\t\twidth: 14.2%;\r\n\r\n\t\t\t&.active {\r\n\t\t\t\tcursor: pointer;\r\n\r\n\t\t\t\t&:hover {\r\n\t\t\t\t\tbackground-color: @primary-color;\r\n\t\t\t\t\tcolor: #fff;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&.othermonth {\r\n\t\t\t\tcolor: #bbb;\r\n\t\t\t}\r\n\r\n\t\t\t&.selectedday {\r\n\t\t\t\tbackground-color: @primary-color;\r\n\t\t\t\tcolor: #fff;\r\n\t\t\t\tmargin: 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.month td {\r\n\t\t\tborder-bottom: 1px solid @base-border-color;\r\n\t\t}\r\n\t}\r\n\r\n\t.monthbrowse {\r\n\t\tfont-family: \"Courier New\", monospace;\r\n\t\tcursor: pointer;\r\n\r\n\t\t&:hover {\r\n\t\t\tcolor: @primary-color;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/fields/checkbox.less",
    "content": "ui|checkboxgroup {\r\n\tdisplay: block;\r\n\tpadding-bottom: 2px;\r\n\tmargin-bottom: 3px;\r\n\tmargin-left: 3px;\r\n\r\n\tui|labelbox {\r\n\r\n\t\t&.invalid {\r\n\t\t\tmargin: 0 0 5px 3px;\r\n\t\t\twidth: 100%;\r\n\r\n\t\t\tui|labeltext {\r\n\t\t\t\tfont-weight: bold;\r\n\t\t\t\tcolor: @field-error-color;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|checkbox {\r\n\tdisplay: block;\r\n\twidth: 100%;\r\n\tpadding: 2px;\r\n\r\n\tui|datalabeltext {\r\n\t\tfloat: none;\r\n\t\tmargin-left: 18px;\r\n\t}\r\n}\r\n\r\nui|checkbutton {\r\n\r\n\tui|labelbox {\r\n\t\theight: 18px;\r\n\t\tpadding-left: 18px;\r\n\t\tposition: relative;\r\n\t}\r\n\r\n\tui|labelbody {\r\n\t\t&:before {\r\n\t\t\tbox-sizing: border-box;\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 0px;\r\n\t\t\tleft: 0px;\r\n\t\t\tcontent: '';\r\n\t\t\twidth: 16px;\r\n\t\t\theight: 16px;\r\n\t\t\tbackground: #ffffff;\r\n\t\t\tborder: 1px solid @field-border-color;\r\n\t\t\tborder-radius: 3px;\r\n\t\t}\r\n\t}\r\n\r\n\t&.hover {\r\n\t\tui|labelbody:before {\r\n\t\t\tborder-color: @primary-color;\r\n\t\t}\r\n\t}\r\n\r\n\t&[ischecked='true'] ui|labelbody {\r\n\t\t&:before {\r\n\t\t\tbackground: @primary-color;\r\n\t\t\tborder-color: @primary-color;\r\n\t\t}\r\n\t\t&:after {\r\n\t\t\tposition: absolute;\r\n\t\t\tcontent: \"\";\r\n\t\t\ttop: 1px;\r\n\t\t\tleft: 5px;\r\n\t\t\theight: 8px;\r\n\t\t\twidth: 4px;\r\n\t\t\tborder-bottom: 2px solid @btn-primary-color;\r\n\t\t\tborder-right: 2px solid @btn-primary-color;\r\n\t\t\t-ms-transform: scale(0.9, 1) rotate(40deg);\r\n\t\t\ttransform: scale(0.9, 1) rotate(40deg);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|checkbox {\r\n\t&.focused{\r\n\t\tui|checkbutton ui|labelbody:before {\r\n\t\t\tborder-color: @primary-color;\r\n\t\t}\r\n\r\n\t\t&[ischecked='true'] ui|labelbody:before{\r\n\t\t\tborder:  1px dotted @field-border-color;\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/fields/datadialog.less",
    "content": "ui|datadialog,\r\nui|postbackdialog,\r\nui|htmldatadialog {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n\r\n\r\n\tui|clickbutton {\r\n\t\tfloat: none;\r\n\t\tmargin: 0;\r\n\r\n\t\tui|labelbox {\r\n\t\t\tborder-color: @field-border-color;\r\n\t\t\tcolor: @text-color;\r\n\t\t}\r\n\t}\r\n\r\n\tinput {\r\n\t\tdisplay: none;\r\n\t}\r\n}\r\n\r\n.dialogindicatorimage {\r\n\tposition: absolute;\r\n\tz-index: 1;\r\n\tright: 7px;\r\n\ttop: 5px;\r\n\t.user-select(none);\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/fields/fields-base.less",
    "content": "ui|datacollectorset,\r\nui|datacollector {\r\n\tposition: absolute;\r\n\tvisibility: hidden;\r\n}\r\n\r\nui|fields {\r\n\tdisplay: none; /* adjusted by FieldsBinding.js */\r\n\tposition: relative; /* mostly because it fixes an ie bug where fieldgroup captions would hang on tabpanel changes */\r\n}\r\n\r\nui|fieldgroup {\r\n\twidth: 100%;\r\n\tdisplay: block;\r\n\tpadding: 0px 0px 30px 0px;\r\n\r\n\t.fieldgrouplabel {\r\n\t\tcolor: @heading-h1-color;\r\n\t\ttext-transform: uppercase;\r\n\t\tfont-style: italic;\r\n\t\tfont-size: 14px;\r\n\t\tfont-family: @heading-font-family;\r\n\t\tmargin-top: 0px;\r\n\t\tmargin-bottom: 18px;\r\n\r\n\t\tui|labeltext {\r\n\t\t\tpadding-right: 5px;\r\n\t\t}\r\n\r\n\t\tui|labelbody {\r\n\t\t\tfloat: left;\r\n\t\t}\r\n\t}\r\n\r\n\t&:last-child {\r\n\t\tpadding-bottom: 0;\r\n\t}\r\n}\r\n\r\nui|fielddesc {\r\n\tdisplay: block;\r\n\tpadding: 8px 0 5px 5px;\r\n\twhite-space: normal;\r\n\t.user-select(none);\r\n\tcolor: @field-label-color;\r\n}\r\n\r\nui|field {\r\n\tdisplay: block;\r\n\tmargin: 0;\r\n\tclear: both;\r\n\tpadding: 0;\r\n\r\n\t&.fieldhelp {\r\n\t\tui|fielddata {\r\n\t\t\tmargin-right: 30px;\r\n\r\n\t\t\tinput, select, textarea, ui|simpleselector select {\r\n\t\t\t\twidth: 100%;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&.nodesc ui|fielddata {\r\n\t\twidth: auto;\r\n\t\tfloat: none;\r\n\t}\r\n}\r\n\r\nui|editorpage {\r\n\r\n\tui|fields {\r\n\t\t-webkit-column-width: 430px; /* Chrome, Safari, Opera */\r\n\t\t-moz-column-width: 430px; /* Firefox */\r\n\t\tcolumn-width: 430px;\r\n\r\n\t\t.chrome63-column-input-fields-fixes();\r\n\t}\r\n\r\n\tui|fieldgroup {\r\n\t\twidth: 430px;\r\n\t\tdisplay: table;\r\n\t\toverflow: visible;\r\n\t\tposition: relative;\r\n\t\t-webkit-column-break-inside: avoid; /* Chrome, Safari, Opera */\r\n\t\tpage-break-inside: avoid; /* Firefox */\r\n\t\tbreak-inside: avoid; /* IE 10+ */\r\n\t\t@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { /* IE 10, 11 */\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n@supports (-ms-accelerator:true) { /* Edge Browser for Windows 10 */\r\n\tui|editorpage ui|fieldgroup {\r\n\t\tdisplay: inline-block;\r\n\t}\r\n}\r\n\r\nui|fieldgroup.boxed, ui|editorpage ui|fieldgroup {\r\n\r\n\tui|field {\r\n\t\twidth: 430px;\r\n\t\tborder: solid 1px @fields-group-border-color;\r\n\t\tborder-width: 0 1px;\r\n\t\tbackground: @fields-group-bg-color;\r\n\t\tpadding: 0 17px;\r\n\r\n\t\t&.first {\r\n\t\t\tpadding-top: 8px;\r\n\t\t\tborder-top-width: 1px;\r\n\t\t\tborder-top-left-radius: @base-border-radius;\r\n\t\t\tborder-top-right-radius: @base-border-radius;\r\n\t\t}\r\n\r\n\t\t&:last-of-type {\r\n\t\t\tpadding-bottom: 25px;\r\n\t\t\tborder-bottom-width: 1px;\r\n\t\t\tborder-bottom-left-radius: @base-border-radius;\r\n\t\t\tborder-bottom-right-radius: @base-border-radius;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|fieldhelp {\r\n\toverflow: visible;\r\n\tfloat: right;\r\n\tposition: relative;\r\n\r\n\tui|clickbutton.fieldhelp {\r\n\r\n\t\tui|labelbox {\r\n\t\t\tborder-color: transparent;\r\n\t\t\tbackground: transparent !important;\r\n\t\t}\r\n\r\n\t\t&:after {\r\n\t\t\tcontent: \"?\";\r\n\t\t\twidth: 16px;\r\n\t\t\theight: 16px;\r\n\t\t\tcolor: white;\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 4px;\r\n\t\t\tleft: 4px;\r\n\t\t\tbackground: #CDCDCF;\r\n\t\t\tborder-radius: 8px;\r\n\t\t\tfont-size: 11px;\r\n\t\t\ttext-align: center;\r\n\t\t\tline-height: 16px;\r\n\t\t\tfont-weight: normal;\r\n\t\t\tfont-family: Verdana;\r\n\t\t}\r\n\r\n\t\t&.active, &.hover {\r\n\t\t\t&:after {\r\n\t\t\t\tbackground: #808080;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|clickbutton {\r\n\t&.fieldhelp { /* width and height needed for explorer vanishing dysfunction */\r\n\t\tmargin: 0;\r\n\t\ttop: 2px;\r\n\t\tright: 2px;\r\n\t\tposition: absolute;\r\n\t\twidth: 20px;\r\n\t\theight: 26px;\r\n\r\n\t\tui|labelbox {\r\n\t\t\tpadding: 0;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|fieldsbutton ui|clickbutton {\r\n\tfloat: none;\r\n\tmargin: 2px 0 10px 0;\r\n\r\n\tui|labelbox {\r\n\t\tborder-color: @field-border-color;\r\n\t\tcolor: @text-color;\r\n\t}\r\n}\r\n\r\n.options-filedgroup { // usage: FunctionCallEditor - Advanced View\r\n\tui|clickbutton {\r\n\r\n\t\tui|labelbox {\r\n\t\t\tpadding-left: 28px;\r\n\t\t}\r\n\t}\r\n\r\n\t[isdisabled=\"true\"], .isdisabled, .selected {\r\n\t\topacity: 1 !important;\r\n\t}\r\n\r\n\t.selected, .isdisabled { //so the 'FunctionCallEditor - Advanced View' is using isdisabled to signal selection, which is lame\r\n\t\t&:after {\r\n\t\t\tcontent: \"\\2713\";\r\n\t\t\tfont-size: 16px;\r\n\t\t\tfont-weight: bold;\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 4px;\r\n\t\t\tleft: 10px;\r\n\t\t\tcolor: @primary-color;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|popup.fieldhelppopup {\r\n\tmin-width: 220px;\r\n}\r\n\r\nui|fielddata {\r\n\tdisplay: block;\r\n\tposition: relative; /* because of strange fieldhelp setup for exploder */\r\n\tpadding-bottom: 5px;\r\n\r\n\tinput, select, textarea {\r\n\t\twidth: 100%;\r\n\t\tpadding: 0;\r\n\t\tmargin: 0;\r\n\t\tborder: none;\r\n\t\tdisplay: block;\r\n\t}\r\n\r\n\tinput, textarea {\r\n\t\t&.warning {\r\n\t\t\tfont-weight: bold;\r\n\t\t\tcolor: @field-error-color;\r\n\t\t}\r\n\t}\r\n\r\n\t.disabled, .readonly {\r\n\t\tinput, textarea {\r\n\t\t\tcursor: default;\r\n\t\t\tbackground-color: @field-readonly-bg-color;\r\n\t\t}\r\n\t}\r\n\r\n\t.disabled {\r\n\r\n\t\tinput, textarea {\r\n\t\t\t.user-select(none);\r\n\t\t\t-moz-user-focus: none;\r\n\t\t\tuser-focus: none;\r\n\t\t}\r\n\t}\r\n\r\n\tinput {\r\n\t\tpadding: 5px 0 0 7px;\r\n\t}\r\n\r\n\tui|datainputselector,\r\n\tui|datainputdialog,\r\n\tui|datainputbutton,\r\n\tui|urlinputdialog\r\n\t{\r\n\t\tinput {\r\n\t\t\tpadding-right: 32px;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|datainput {\r\n\tdisplay: block;\r\n}\r\n\r\nui|datainput,\r\nui|datainputselector,\r\nui|datainputdialog,\r\nui|datainputbutton,\r\nui|urlinputdialog,\r\nui|textbox,\r\nui|selector,\r\nui|simpleselector,\r\nui|multiselector,\r\nui|datadialog,\r\nui|postbackdialog,\r\nui|htmldatadialog,\r\nui|editortextbox,\r\nui|hierarchicalselector {\r\n\tpadding: 2px;\r\n\r\n\tinput {\r\n\t\tborder: none;\r\n\t}\r\n\r\n\tui|box {\r\n\t\tborder: 1px solid @field-border-color;\r\n\t\tborder-radius: @field-border-radius;\r\n\t\tbackground-color: @field-bg-color;\r\n\t\theight: 32px;\r\n\t\toverflow: hidden;\r\n\t}\r\n\r\n\t&.disabled, &.readonly {\r\n\r\n\t\tui|box, ui|box input, ui|toolbarbutton {\r\n\t\t\tbackground-color: @field-readonly-bg-color;\r\n\t\t}\r\n\t}\r\n\r\n\t&.invalid {\r\n\t\tui|box {\r\n\t\t\tborder-color: @field-error-color;\r\n\t\t}\r\n\r\n\t\tui|labeltext {\r\n\t\t\tfont-weight: bold;\r\n\t\t\tborder-color: @field-error-color;\r\n\t\t}\r\n\t}\r\n\r\n\t&.focused{\r\n\t\tui|box,\r\n\t\tui|clickbutton ui|labelbox {\r\n\t\t\tborder: 1px solid @primary-color;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/* EXOTIC STUFF ................................... */\r\n\r\nui|nullpostbackdatadialog {\r\n\tdisplay: block;\r\n}\r\n\r\n\r\nui|datalabeltext {\r\n\tdisplay: block;\r\n\tfloat: left;\r\n\tpadding-left: 5px;\r\n\tpadding-top: 2px;\r\n\t.user-select(none); /* See notes in DocumentManager.js */\r\n}\r\n\r\n\r\n\r\n/* TOOLBARS ........................................................... */\r\n\r\nui|toolbar ui|field {\r\n\tmargin: 0;\r\n\tfloat: left;\r\n}\r\n\r\nui|toolbar ui|fielddesc,\r\nui|toolbar ui|fielddata {\r\n\tfloat: left;\r\n\twidth: auto;\r\n}\r\n\r\nui|toolbar ui|fielddata input,\r\nui|toolbar ui|fielddata select {\r\n\twidth: 100px;\r\n}\r\n\r\nui|fields ui|datadialog ui|clickbutton ui|labeltext,\r\nui|fields ui|postbackdialog ui|clickbutton ui|labeltext,\r\nui|fields ui|htmldatadialog ui|clickbutton ui|labeltext,\r\nui|fields ui|datainputdialog ui|clickbutton ui|labeltext,\r\nui|fields ui|datainputbutton ui|clickbutton ui|labeltext,\r\nui|fields ui|urlinputdialog ui|clickbutton ui|labeltext,\r\nui|fields ui|selector ui|clickbutton ui|labeltext {\r\n\toverflow: hidden;\r\n\ttext-overflow: ellipsis;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/fields/filepicker.less",
    "content": "ui|filepicker {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n\twidth: 100%;\r\n\toverflow: hidden;\r\n\r\n\tinput {\r\n\t\t&.real {\r\n\t\t\tdisplay: block;\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 3px;\r\n\t\t\tleft: 0;\r\n\t\t\tcursor: default;\r\n\t\t\topacity: 0;\r\n\t\t\ttransform: translate(-200px, 0) scale(4);\r\n\t\t\tfont-size: 0;\r\n\t\t}\r\n\t}\r\n\r\n\tui|datainput {\r\n\t\t&.fake, &.fake input {\r\n\t\t\twidth: 100%;\r\n\t\t\tfloat: left;\r\n\t\t}\r\n\t}\r\n\r\n\tui|clickbutton {\r\n\t\tposition: absolute;\r\n\t\tmargin: 0;\r\n\t\ttop: 7px;\r\n\t\tright: 0;\r\n\r\n\t\tui|labelbox {\r\n\t\t\tpadding: 0;\r\n\t\t\tborder: none;\r\n\t\t\tbackground: none;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/fields/radio.less",
    "content": "ui|radiodatagroup {\r\n\tdisplay: block;\r\n\tmargin-bottom: 3px;\r\n\tpadding: 2px;\r\n\tpadding-top: 4px;\r\n\tmargin-left: 3px;\r\n}\r\n\r\nui|radio {\r\n\tdisplay: block;\r\n\twidth: 100%;\r\n\tpadding-bottom: 1px;\r\n\tpadding-top: 1px;\r\n\r\n\tui|labelbody {\r\n\t\theight: 20px;\r\n\t\tpadding-left: 18px;\r\n\t}\r\n\r\n\tui|datalabeltext {\r\n\t\tpadding-top: 5px;\r\n\t\tfloat: none;\r\n\t\tmargin-left: 18px;\r\n\t}\r\n\r\n\t&.disabled {\r\n\t\tcolor: @gray-color;\r\n\t}\r\n}\r\n\r\nui|radiobutton {\r\n\r\n\tui|labelbody {\r\n\t\tposition: relative;\r\n\r\n\t\t&:before {\r\n\t\t\tbox-sizing: border-box;\r\n\t\t\tcontent: '';\r\n\t\t\tposition: absolute;\r\n\t\t\twidth: 16px;\r\n\t\t\theight: 16px;\r\n\t\t\tborder: 1px solid @field-border-color;\r\n\t\t\tborder-radius: 8px;\r\n\t\t\tleft: 0px;\r\n\t\t\ttop: 4px;\r\n\t\t\tbackground: #FFFFFF;\r\n\t\t}\r\n\t}\r\n\r\n\t&.hover {\r\n\t\tui|labelbody:before {\r\n\t\t\tborder-color: @primary-color;\r\n\t\t}\r\n\t}\r\n\r\n\t&[ischecked='true'] ui|labelbody:after {\r\n\t\tcontent: '';\r\n\t\tposition: absolute;\r\n\t\twidth: 8px;\r\n\t\theight: 8px;\r\n\t\tborder-radius: 4px;\r\n\t\tbackground: @primary-color;\r\n\t\t;\r\n\t\tleft: 4px;\r\n\t\ttop: 8px;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/fields/selectors.less",
    "content": ".arrow-base() {\r\n\tcontent: \"\";\r\n\tposition: absolute;\r\n\twidth: 0;\r\n\theight: 0;\r\n\tborder-style: solid;\r\n}\r\n\r\n.arrow-down() {\r\n\t&:before {\r\n\t\t.arrow-base();\r\n\t\ttop: 12px;\r\n\t\tright: 10px;\r\n\t\tborder-width: 5px 5px 0 5px;\r\n\t\tborder-color: @btn-border-color transparent transparent transparent;\r\n\t}\r\n\r\n\t&:after {\r\n\t\t.arrow-base();\r\n\t\ttop: 12px;\r\n\t\tright: 11px;\r\n\t\tborder-width: 4px 4px 0 4px;\r\n\t\tborder-color: @btn-bg-color transparent transparent transparent;\r\n\t}\r\n}\r\n\r\n.arrow-up() {\r\n\t&:before {\r\n\t\ttop: 12px;\r\n\t\tborder-width: 0px 5px 5px 5px;\r\n\t\tborder-color: transparent transparent @btn-hover-border-color transparent;\r\n\t}\r\n\r\n\t&:after {\r\n\t\ttop: 13px;\r\n\t\tborder-width: 0px 4px 4px 4px;\r\n\t\tborder-color: transparent transparent @btn-hover-bg-color transparent;\r\n\t}\r\n}\r\n\r\n\r\nui|selection,\r\nui|selector input {\r\n\tdisplay: none;\r\n}\r\n\r\nui|selector {\r\n\tdisplay: block;\r\n\r\n\tui|clickbutton {\r\n\t\tfloat: none;\r\n\t\tmargin: 0;\r\n\r\n\t\t>ui|labelbox {\r\n\t\t\tpadding: 6px 30px 8px 11px;\r\n\t\t\tborder-color: @field-border-color;\r\n\t\t\ttext-transform: none;\r\n\t\t\tcolor: @btn-toolbar-color;\r\n\r\n\t\t\t.arrow-down();\r\n\t\t}\r\n\r\n\t\t&.hover {\r\n\r\n\t\t\t>ui|labelbox:before {\r\n\t\t\t\tborder-color: @btn-hover-border-color transparent transparent transparent;\r\n\t\t\t}\r\n\r\n\t\t\t>ui|labelbox:after {\r\n\t\t\t\tborder-color: @btn-hover-bg-color transparent transparent transparent;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.active {\r\n\t\t\t>ui|labelbox{\r\n\t\t\t\t.arrow-up();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.infobox {\r\n\t\t\tui|clickbutton ui|labeltext {\r\n\t\t\t\tfont-style: italic;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&[single='true'] {\r\n\t\tui|clickbutton {\r\n\r\n\t\t\t> ui|labelbox{\r\n\t\t\t\ttext-transform: uppercase;\r\n\r\n\t\t\t\t&:before,\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tdisplay:none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\nui|fields ui|field.fieldhelp ui|selector ui|clickbutton ui|labelbox {\r\n\toverflow: hidden;\r\n\tfloat: none;\r\n}\r\n\r\n/* SIMPLESELECTORS ............................................ */\r\n\r\nui|simpleselector {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n\toverflow: visible;\r\n}\r\n\r\n\r\n/* MULTISELECTORS ............................................. */\r\n\r\nui|multiselector {\r\n\tpadding: 0;\r\n\r\n\tui|box {\r\n\t\tdisplay: block;\r\n\t\theight: 100px;\r\n\t\t.user-select(none);\r\n\t\tpadding: 5px 0 5px 0;\r\n\t\toverflow: auto;\r\n\r\n\t\tdiv {\r\n\t\t\tpadding: 1px 5px 2px 7px;\r\n\t\t\twidth: 100%;\r\n\r\n\t\t\t&.selected {\r\n\t\t\t\tbackground: @primary-color;\r\n\t\t\t\tcolor: #FFF;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tinput {\r\n\t\tdisplay: none;\r\n\t}\r\n\r\n\tui|datadialog, ui|postbackdialog {\r\n\t\tpadding: 1px 0 2px 0;\r\n\t}\r\n}\r\n\r\n/* DATAINPUTSELECTORS ......................................... */\r\nui|datainputselector,\r\nui|datainputdialog,\r\nui|datainputbutton,\r\nui|urlinputdialog {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n\r\n\tui|toolbarbutton {\r\n\t\tmargin: 0;\r\n\t\tpadding: 5px;\r\n\t\tborder: none;\r\n\t\tposition: absolute;\r\n\t\tright: 3px;\r\n\t\ttop: 3px;\r\n\r\n\t\tui|labelbox {\r\n\t\t\tpadding: 0px;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\nui|datainputselector {\r\n\t&.with-image {\r\n\t\tinput {\r\n\t\t\tpadding-left: 30px;\r\n\t\t}\r\n\r\n\t\tui|box ui|labelbox {\r\n\t\t\tposition: absolute;\r\n\t\t\tleft: 8px;\r\n\t\t\ttop: 8px;\r\n\t\t}\r\n\t}\r\n\r\n\tui|toolbarbutton[image='popup'] {\r\n\t\tui|labelbox {\r\n\t\t\tui|labelbody {\r\n\t\t\t\tvisibility: hidden;\r\n\t\t\t}\r\n\r\n\t\t\t.arrow-down();\r\n\t\t}\r\n\r\n\t\t&[ischecked='true']{\r\n\t\t\tui|labelbox {\r\n\t\t\t\t.arrow-up();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|field.fieldhelp ui|fielddata {\r\n\tposition: relative;\r\n}\r\n\r\nui|field.fieldhelp ui|fielddata ui|datainputselector input,\r\nui|field.fieldhelp ui|fielddata ui|datainputdialog input,\r\nui|field.fieldhelp ui|fielddata ui|datainputbutton input,\r\nui|field.fieldhelp ui|fielddata ui|urlinputdialog input {\r\n\twidth: 100%;\r\n}\r\n\r\n\r\n/* Hierarchical Selector */\r\nui|hierarchicalselector {\r\n\r\n\t&[hascounter='true'] {\r\n\r\n\t\t@counter-height: 30px;\r\n\r\n\t\tui|box {\r\n\t\t\tmargin-bottom: @counter-height;\r\n\t\t}\r\n\t\t> ui|labelbox{\r\n\t\t\tmargin-top: -@counter-height;\r\n\t\t\theight: @counter-height;\r\n\t\t\twidth: 100%;\r\n\t\t\tline-height: @counter-height;\r\n\t\t\tborder-top: 1px solid @base-border-color;\r\n\r\n\t\t\tui|labelbody {\r\n\t\t\t\tpadding-right: 11px;\r\n\t\t\t\tpadding-left: 11px;\r\n\t\t\t\tfloat: right;\r\n\r\n\t\t\t\tfont-family: @heading-font-family;\r\n\t\t\t\ttext-transform: uppercase;\r\n\t\t\t\tcolor: @primary-color;\r\n\t\t\t\tfont-size: 13px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tui|treenode {\r\n\r\n\t\tui|treenode {\r\n\t\t\tpadding-left: 46px;\r\n\r\n\t\t\t&.checkbox {\r\n\t\t\t\tui|checkbutton {\r\n\t\t\t\t\tleft: 59px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&.open::before,\r\n\t\t\t&.closed::before {\r\n\t\t\t\twidth: 20px;\r\n\t\t\t}\r\n\r\n\t\t\tui|treenode {\r\n\t\t\t\t&::before,\r\n\t\t\t\t&::after {\r\n\t\t\t\t\tleft: 25px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tui|labelbox {\r\n\t\t\t\t\t&:before,\r\n\t\t\t\t\t&:after {\r\n\t\t\t\t\t\tleft: 1px;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t> ui|labelbox {\r\n\t\t\t\tsvg {\r\n\t\t\t\t\tmargin-left: 4px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t> ui|labelbox {\r\n\t\t\tui|labeltext{\r\n\t\t\t\tdisplay: inline;\r\n\t\t\t}\r\n\r\n\t\t\t&.textonly {\r\n\t\t\t\tui|labeltext{\r\n\t\t\t\t\tpadding-left: 4px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&.open:after {\r\n\t\t\t\tborder-top-color: @dialog-bg-color;\r\n\t\t\t}\r\n\r\n\t\t\t&.closed:after {\r\n\t\t\t\tborder-left-color: @dialog-bg-color;\r\n\t\t\t}\r\n\r\n\t\t\tsvg {\r\n\t\t\t\tmargin-right: 2px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&::before{\r\n\t\t\twidth: 30px;\r\n\t\t}\r\n\r\n\r\n\t\t&::before,\r\n\t\t&::after {\r\n\t\t\tborder-color: #D5D5D5;\r\n\t\t\tleft: 21px;\r\n\t\t}\r\n\r\n\t\t&.checkbox {\r\n\r\n\t\t\t> ui|labelbox {\r\n\t\t\t\tpadding-left: 40px;\r\n\t\t\t}\r\n\r\n\t\t\t> ui|checkbutton {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tfloat: none;\r\n\t\t\t\ttop: 2px;\r\n\t\t\t\tleft: 18px;\r\n\t\t\t\theight: 20px;\r\n\r\n\t\t\t\t&[ischecked='true'] {\r\n\t\t\t\t\tui|labelbody {\r\n\t\t\t\t\t\t&:before {\r\n\t\t\t\t\t\t\tbackground: @primary-color;\r\n\t\t\t\t\t\t\tborder-color: @primary-color;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t&:after {\r\n\t\t\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\t\t\ttop: 1px;\r\n\t\t\t\t\t\t\tleft: 5px;\r\n\t\t\t\t\t\t\theight: 8px;\r\n\t\t\t\t\t\t\twidth: 4px;\r\n\t\t\t\t\t\t\tborder-bottom: 2px solid @btn-primary-color;\r\n\t\t\t\t\t\t\tborder-right: 2px solid @btn-primary-color;\r\n\t\t\t\t\t\t\t-ms-transform: scale(0.9, 1) rotate(40deg);\r\n\t\t\t\t\t\t\ttransform: scale(0.9, 1) rotate(40deg);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tui|treebody {\r\n\t\tbackground: @dialog-bg-color;\r\n\t\tpadding-top: 22px;\r\n\t}\r\n\r\n\t> input {\r\n\t\tdisplay: none;\r\n\t}\r\n\r\n\tui|box {\r\n\t\theight: auto;\r\n\t}\r\n\r\n\t&.invalid {\r\n\t\tui|labeltext {\r\n\t\t\tfont-weight: inherit;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|wizardpage,\r\nui|dialogpage {\r\n\tui|hierarchicalselector {\r\n\t\tui|box {\r\n\t\t\theight: 530px;\r\n\t\t}\r\n\t}\r\n\r\n\tui|pagebody {\r\n\t\t&.filled {\r\n\t\t\t> ui|hierarchicalselector{\r\n\t\t\t\tpadding: 0;\r\n\r\n\t\t\t\tui|box {\r\n\t\t\t\t\tborder-color: transparent;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.invalid{\r\n\t\t\t\t\tui|box {\r\n\t\t\t\t\t\tborder-color: @field-error-color;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/fields/textbox.less",
    "content": "ui|textbox,\r\nui|editortextbox {\r\n\tdisplay: block;\r\n\theight: 108px; /* half width */\r\n\tposition: relative;\r\n\r\n\ttextarea {\r\n\t\toverflow: auto;\r\n\t\theight: 102px;\r\n\t\t-moz-tab-size: 4;\r\n\t\t-o-tab-size: 4;\r\n\t\ttab-size: 4;\r\n\t\tpadding: 4px;\r\n\t}\r\n\r\n\tui|box {\r\n\t\tposition: relative;\r\n\t\theight: 104px;\r\n\t}\r\n}\r\n\r\n/* FULLBLOWN EDITORTEXTBOX */\r\n\r\nui|flexbox ui|editortextbox {\r\n\tpadding: 0;\r\n\tborder: none;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\r\n\ttextarea {\r\n\t\twidth: 100%;\r\n\t\theight: 100%;\r\n\t\tfont-family: \"Courier New\", monospace;\r\n\t\tfont-size: 13px;\r\n\t\tmargin: 0;\r\n\t\tborder: none;\r\n\t}\r\n\r\n\tui|box {\r\n\t\tborder: none;\r\n\t\theight: 100%;\r\n\t\tpadding: 0;\r\n\t\tmargin: 0;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/fields/urlinputdialog.less",
    "content": "﻿ui|urlinputdialog {\r\n\r\n\t&.readonly {\r\n\t\tinput {\r\n\t\t\tpadding-left: 36px;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/forms.less",
    "content": "﻿/********************\r\n    Usage: next classes can be applied to simple  INPUT controls, can be used in Packages to style forms for C1 console (ex. SQLServerDataProvider forms)\r\n*/\r\n\r\n.form-control {\r\n\tborder: solid 1px @field-border-color;\r\n\tborder-radius: @field-border-radius;\r\n\tbackground: @field-bg-color;\r\n\tpadding: 5px 7px;\r\n\tmargin-bottom: 8px;\r\n\twidth: 100%;\r\n}\r\n\r\n.form-btn {\r\n\tborder: solid 1px @btn-border-color;\r\n\tborder-radius: @btn-border-radius;\r\n\tbackground: @btn-bg-color;\r\n\tcolor: @btn-color;\r\n\tpadding: 6px 15px;\r\n\tmargin: 10px 0 0 3px;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/icons.less",
    "content": "ui|icon { // usage: FontIconSelector\r\n\tfloat: left;\r\n\twidth: 18px;\r\n\theight: 18px;\r\n\tfont-size: 18px;\r\n\ttext-align: center;\r\n\tcolor: #333;\r\n}\r\n\r\nui|labelbox {\r\n\tsvg {\r\n\t\twidth: 18px;\r\n\t\theight: 18px;\r\n\t\tdisplay: block;\r\n\t\tmargin: 0 auto;\r\n\t\tfill: currentColor;\r\n\t\tcolor: currentColor;\r\n\t\tstroke: currentColor;\r\n\t}\r\n}\r\n\r\n.icons-s-22 {\r\n\tui|labelbox svg {\r\n\t\theight: 22px;\r\n\t\twidth: 22px;\r\n\t}\r\n}\r\n\r\n.icons-s-150 {\r\n\tui|labelbox svg {\r\n\t\theight: 150px;\r\n\t\twidth: 150px;\r\n\t}\r\n}\r\n\r\n.icons-s-170 {\r\n\tui|labelbox svg {\r\n\t\theight: 170px;\r\n\t\twidth: 170px;\r\n\t}\r\n}\r\n\r\n.icons-s-400 {\r\n\tui|labelbox svg {\r\n\t\theight: 400px;\r\n\t\twidth: 400px;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/keys.less",
    "content": "ui|keyset,\r\nui|key {\r\n\tdisplay: block;\r\n\toverflow: visible;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 0;\r\n\theight: 0;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/labels.less",
    "content": "ui|labelbox, ui|labelbody {\r\n\tdisplay: block;\r\n\tfloat: left;\r\n}\r\n\r\nui|labelbox {\r\n\twhite-space: nowrap;\r\n\t.user-select(none); /* See notes in DocumentManager.js */\r\n\tmax-width: 100%;\r\n\r\n\r\n\tsvg {\r\n\t\tfloat: left;\r\n\t}\r\n\r\n\tui|labelbody {\r\n\t\tmargin-left: auto !important;\r\n\t\tmax-width: 100%;\r\n\t}\r\n\r\n\tui|labeltext {\r\n\t\tdisplay: block;\r\n\t\tmax-width: 100%;\r\n\t\toverflow: hidden;\r\n\t}\r\n\r\n\t&.toolbartext {\r\n\t\tmargin-top: 4px;\r\n\t}\r\n\r\n\t&.flipped {\r\n\t\tui|labelbody {\r\n\t\t\tbackground-position: 100% 0;\r\n\t\t\tpadding-left: 0 !important;\r\n\t\t}\r\n\r\n\t\tsvg {\r\n\t\t\tright: 8px;\r\n\t\t\tposition: absolute;\r\n\t\t}\r\n\t}\r\n\r\n\t&.textonly {\r\n\r\n\t\tui|labelbody {\r\n\t\t\tpadding-left: 0;\r\n\t\t}\r\n\r\n\t\tui|labeltext {\r\n\t\t\tpadding-left: 0;\r\n\t\t}\r\n\t}\r\n\r\n\t&.imageonly {\r\n\t\tui|labeltext {\r\n\t\t\tdisplay: none;\r\n\t\t}\r\n\t}\r\n\r\n\t&.image-and-text {\r\n\r\n\t\tui|labeltext {\r\n\t\t\tmargin-left: 28px;\r\n\t\t}\r\n\r\n\t\t&.flipped {\r\n\t\t\tui|labelbody {\r\n\t\t\t\tpadding-right: 18px;\r\n\t\t\t}\r\n\r\n\t\t\tui|labeltext {\r\n\t\t\t\tmargin-left: 0px;\r\n\t\t\t\tmargin-right: 6px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&.graytext ui|labeltext {\r\n\t\tcolor: graytext;\r\n\t}\r\n}\r\n\r\n\r\n.imagesonly ui|labeltext {\r\n\tdisplay: none;\r\n\tpadding-left: 0 !important;\r\n}\r\n\r\n\r\nui|toolbarbutton.hover ui|labelbox svg g.hover {\r\n\tvisibility: visible;\r\n}\r\n\r\nui|toolbarbutton.hover ui|labelbox svg g.default {\r\n\tvisibility: hidden;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/lazybindings.less",
    "content": "ui|lazybindingset,\r\nui|lazybinding {\r\n\tposition: absolute;\r\n\tvisibility: hidden;\r\n\tdisplay: none;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/menubar.less",
    "content": ".menubar {\r\n\tbackground: @menubar-bg-color;\r\n\r\n\t> ui|menu {\r\n\t\tborder: none;\r\n\r\n\t\t> ui|labelbox {\r\n\t\t\tcolor: @menubar-text-color;\r\n\r\n\t\t\t&.textonly {\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tborder-color: @menubar-bg-color transparent transparent transparent;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.hover {\r\n\t\t\t> ui|labelbox {\r\n\t\t\t\tcolor: @primary-color;\r\n\r\n\t\t\t\t&.textonly {\r\n\t\t\t\t\t&:after {\r\n\t\t\t\t\t\tborder-color: transparent transparent @menubar-bg-color transparent;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/menus.less",
    "content": "/* see also popups.css for shared visual styles!!!!!!! */\r\nui|menubar {\r\n\tdisplay: block;\r\n\twhite-space: nowrap;\r\n\tpadding-right: 15px;\r\n}\r\n\r\n\r\nui|menu { //usage: top menubar and ImageEditor menubar\r\n\tdisplay: block;\r\n\tmargin: 0 2px;\r\n\tpadding: 0;\r\n\theight: 30px;\r\n\tfloat: right;\r\n\tborder: solid 1px @base-border-color;\r\n\tborder-radius: 3px;\r\n\r\n\t.menulabel {\r\n\t\tpadding: 7px 16px 1px 5px;\r\n\t\tposition: relative; /* ie something */\r\n\t\tmargin: 0 15px;\r\n\t\ttext-transform: uppercase;\r\n\r\n\t\t&.imageonly {\r\n\t\t\tpadding: 5px 0 1px 0;\r\n\t\t\tmargin: 0 12px;\r\n\t\t}\r\n\t}\r\n\r\n\tui|clickbutton ui|labelbox {\r\n\t\tborder: 0 !important;\r\n\t\tbackground-color: transparent;\r\n\t}\r\n\r\n\t> ui|menupopup {\r\n\t\tmargin-top: 5px;\r\n\t\tmargin-left: 0px;\r\n\r\n\t\t&:before, &:after {\r\n\t\t\tcontent: \"\";\r\n\t\t\tposition: absolute;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tleft: 50%;\r\n\t\t\tborder-left: 9px solid transparent;\r\n\t\t\tborder-right: 9px solid transparent;\r\n\t\t\tmargin-left: -9px;\r\n\t\t}\r\n\r\n\t\t&:before {\r\n\t\t\ttop: -9px;\r\n\t\t\tborder-bottom: 9px solid @base-border-color;\r\n\t\t}\r\n\r\n\t\t&:after {\r\n\t\t\ttop: -8px;\r\n\t\t\tborder-bottom: 9px solid #fff;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\r\n\t> ui|labelbox.textonly {\r\n\r\n\t\t&:before {\r\n\t\t\tcontent: \"\";\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 12px;\r\n\t\t\tright: 0;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tborder-style: solid;\r\n\t\t\tborder-width: 5px 5px 0 5px;\r\n\t\t\tborder-color: @primary-color transparent transparent transparent;\r\n\t\t}\r\n\r\n\t\t&:after {\r\n\t\t\tcontent: \"\";\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 12px;\r\n\t\t\tright: 1px;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tborder-style: solid;\r\n\t\t\tborder-width: 4px 4px 0 4px;\r\n\t\t\tborder-color: #fff transparent transparent transparent;\r\n\t\t}\r\n\t}\r\n\r\n\t&.hover {\r\n\t\t> ui|labelbox.textonly {\r\n\t\t\tcolor: @primary-color;\r\n\r\n\t\t\t&:before {\r\n\t\t\t\ttop: 12px;\r\n\t\t\t\tborder-width: 0px 5px 5px 5px;\r\n\t\t\t\tborder-color: transparent transparent #909090 transparent;\r\n\t\t\t}\r\n\r\n\t\t\t&:after {\r\n\t\t\t\ttop: 13px;\r\n\t\t\t\tright: 1px;\r\n\t\t\t\tborder-width: 0px 4px 4px 4px;\r\n\t\t\t\tborder-color: transparent transparent #fff transparent;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t> ui|menupopup.bottomright {\r\n\t\tmargin-left: 0;\r\n\r\n\t\t&:before, &:after {\r\n\t\t\tleft: auto;\r\n\t\t\tright: 8px;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//usage: PopPup Menus on item right click\r\nui|menubody {\r\n\tdisplay: block;\r\n\tpadding: 0;\r\n\r\n\t&.textonly {\r\n\t\tui|labelbox{\r\n\t\t\tsvg {\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t\t&.image-and-text {\r\n\t\t\t\tui|labeltext{\r\n\t\t\t\t\tmargin-left: 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|menugroup {\r\n\tdisplay: block;\r\n\tpadding: 0;\r\n\tborder-bottom: 1px solid @base-border-color;\r\n\r\n\t&.last, &:empty {\r\n\t\tborder-bottom: none;\r\n\t}\r\n}\r\n\r\n\r\nui|menuitem {\r\n\twhite-space: nowrap;\r\n\tdisplay: block;\r\n\tclear: both;\r\n\tposition: relative;\r\n\r\n\tui|labelbox {\r\n\t\tposition: relative;\r\n\t\tpadding: 7px 8px 7px 8px;\r\n\r\n\t\t&.hover {\r\n\t\t\tbackground: @primary-color;\r\n\t\t\tcolor: #fff;\r\n\t\t}\r\n\t}\r\n\r\n\tui|labeltext {\r\n\t\tpadding-left: 4px;\r\n\t\tposition: relative;\r\n\t}\r\n\r\n\t.checkboxindicator {\r\n\t\tfont-family: Arial, sans-serif;\r\n\t\tfont-size: 11px;\r\n\t\tposition: absolute;\r\n\t\tleft: 10px;\r\n\t\ttop: 10px;\r\n\t}\r\n\r\n\t&[type=\"menucontainer\"] {\r\n\t\t> .menuitemlabel{\r\n\r\n\t\t\t> ui|labelbody {\r\n\t\t\t\tpadding-right: 16px;\r\n\t\t\t}\r\n\r\n\t\t\t&:before, &:after {\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\twidth: 0;\r\n\t\t\t\t\theight: 0;\r\n\t\t\t\t\tborder-style: solid;\r\n\t\t\t}\r\n\r\n\t\t\t&:before {\r\n\t\t\t\t\ttop: 10px;\r\n\t\t\t\t\tright: 10px;\r\n\t\t\t\t\tborder-width: 5px 0 5px 5px;\r\n\t\t\t\t\tborder-color: transparent transparent transparent @primary-color;\r\n\t\t\t}\r\n\r\n\t\t\t&:after {\r\n\t\t\t\t\ttop: 11px;\r\n\t\t\t\t\tright: 11px;\r\n\t\t\t\t\tborder-width: 4px 0 4px 4px;\r\n\t\t\t\t\tborder-color: transparent transparent transparent #fff;\r\n\t\t\t}\r\n\r\n\t\t\t&.hover{\r\n\t\t\t\t&:before {\r\n\t\t\t\t\ttop: 10px;\r\n\t\t\t\t\tright: 10px;\r\n\t\t\t\t\tborder-width: 5px 5px 5px 0;\r\n\t\t\t\t\tborder-color: transparent #fff transparent transparent;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\ttop: 11px;\r\n\t\t\t\t\tright: 10px;\r\n\t\t\t\t\tborder-width: 4px 4px 4px 0;\r\n\t\t\t\t\tborder-color: transparent @primary-color transparent transparent;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tui|menupopup {\r\n\t\tmargin-top: -2px;\r\n\t\tmargin-left: -2px;\r\n\t}\r\n}\r\n\r\nui|menubody.checkboxed ui|menuitem ui|labelbox {\r\n\tpadding: 7px 8px 7px 24px;\r\n}\r\n\r\n\r\nui|menuitem ui|labelbox,\r\nui|menuitem ui|labelbody,\r\nui|menubody ui|labelbox,\r\nui|menubody ui|labelbody {\r\n\tfloat: none;\r\n\tclear: both;\r\n}\r\n\r\n\r\n.brand-about-menuitem {\r\n\tpadding: 7px 8px;\r\n\theight: 32px;\r\n\tline-height: 18px;\r\n\r\n\timg {\r\n\t\twidth: 18px;\r\n\t\theight: 18px;\r\n\t\tfloat: left;\r\n\t}\r\n\r\n\t.menuitem-text {\r\n\t\tmargin-left: 30px;\r\n\t}\r\n\r\n\t&:hover {\r\n\t\tbackground: @primary-color;\r\n\t\tcolor: #fff;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/oldUI-fixes.less",
    "content": "﻿/* * * * *\r\nComposite.Versioning.ContentVersioning\r\n\r\n* * * */\r\n\r\ntable#filter {\r\n\tmargin: 10px 0;\r\n\r\n\tth {\r\n\t\tborder: none !important;\r\n\t}\r\n}\r\n\r\ntable#logtable {\r\n\t> thead th {\r\n\t\tbackground: @table-header-bg-color !important;\r\n\t\tborder-color: @table-border-color !important;\r\n\t}\r\n\r\n\tth.button {\r\n\t\tui|toolbarbutton {\r\n\t\t\tborder-color: transparent;\r\n\t\t\tbackground: none;\r\n\t\t\tbox-shadow: none;\r\n\r\n\t\t\t&.hover {\r\n\t\t\t\tborder-color: @primary-color;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\ntable tr.hilite > td {\r\n\tbackground-color: #f5f5f5 !important;\r\n}\r\n\r\ntable#headings {\r\n\tmargin: 0 !important;\r\n\r\n\tth {\r\n\t\tbackground: @table-header-bg-color !important;\r\n\t\tborder-color: @table-border-color !important;\r\n\t}\r\n}\r\n\r\ntd.time, th.time {\r\n\twidth: 165px !important;\r\n}\r\n\r\ntable.compare {\r\n\r\n\tcaption {\r\n\t\tbackground: #E6E6E6 !important;\r\n\t\tborder: 0 !important;\r\n\t}\r\n\r\n\tth.prop, th.value {\r\n\t\tbackground: @table-header-bg-color !important;\r\n\t}\r\n\r\n\tth.prop, th.value, td.prop, td.value {\r\n\t\tborder-color: @table-border-color !important;\r\n\t}\r\n}\r\n\r\n#bottomtoolbar {\r\n\tbackground: #EFEFEF;\r\n}\r\n\r\n// end Composite.Versioning.ContentVersioning\r\n\r\n\r\n/* * * * *\r\nComposite.Forms.FormBuilder\r\n* * * */\r\n\r\ndiv#formmarkup {\r\n\tui|toolbarbutton {\r\n\t\tmargin: 0;\r\n\t\tborder: 0;\r\n\t\tbox-shadow: none;\r\n\t\tbackground: transparent;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/pages.less",
    "content": "ui|page,\r\nui|editorpage {\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\twidth: 100%;\r\n\toverflow: hidden;\r\n\tvisibility: hidden;\r\n}\r\n\r\nui|pagehead, ui|pageheading, ui|pagedescription {\r\n\tdisplay: block;\r\n\t.user-select(none);\r\n}\r\n\r\nui|pagehead {\r\n\tpadding-bottom: 1em;\r\n}\r\n\r\nui|pageheading {\r\n\tfont-size: 120%;\r\n\tfont-weight: bold;\r\n\tpadding: 0 0 0.5em 0;\r\n}\r\n\r\nui|pagedescription {\r\n\tpadding: 0 0 12px 0;\r\n}\r\n\r\nui|pagebody {\r\n\tdisplay: block;\r\n\r\n\t&.pad-0 {\r\n\t\tpadding: 0;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/popups.less",
    "content": "ui|popupset {\r\n\tdisplay: block;\r\n\toverflow: visible;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 0;\r\n\theight: 0;\r\n\tz-index: @popupset-zindex; /* above dialogset */\r\n}\r\n\r\nui|popup,\r\nui|menupopup {\r\n\tposition: absolute;\r\n\tz-index: 6; /* above the shadow */\r\n\tmin-width: 160px;\r\n\tvisibility: hidden;\r\n\tdisplay: none;\r\n\t.user-select(none);\r\n\tbackground-color: #fff;\r\n\tbox-shadow: @base-box-shadow;\r\n\tborder-radius: @base-border-radius;\r\n\tborder: 1px solid @base-border-color;\r\n}\r\n\r\nui|menupopup { \r\n\tpadding: 3px 0 0 0;\r\n}\r\n\r\nui|popupbody { /* NOT USED ON COMMON POPUPS! */\r\n\tdisplay: block;\r\n\tpadding: 10px 12px;\r\n\tcolor: @text-color;\r\n\t.user-select(none);\r\n}\r\n\r\n/* OVERFLOW ................................................ */\r\n\r\nui|popup.overflow {\r\n\toverflow-y: scroll;\r\n\theight: 211px; /* move this to script when separators are supported */\r\n}\r\n\r\nui|popup div.popupindicator {\r\n\tposition: absolute;\r\n\twidth: 0;\r\n\theight: 0;\r\n\ttop: 0px;\r\n\tleft: 0px;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/rtl.less",
    "content": "﻿body.rtl {\r\n\tdirection: rtl;\r\n}\r\n\r\nbody.rtl table.matrix,\r\nbody.rtl ui|dialog,\r\nbody.rtl ui|dialogset\r\n{\r\n\tdirection: ltr;\r\n}\r\n\r\nbody.rtl ui|tab,\r\nbody.rtl ui|toolbarbody,\r\nbody.rtl ui|toolbargroup,\r\nbody.rtl ui|toolbarbutton, \r\nbody.rtl ui|clickbutton, \r\nbody.rtl ui|radiobutton, \r\nbody.rtl ui|checkbutton, \r\nbody.rtl ui|toolbarlabel,\r\nbody.rtl ui|docktab,\r\nbody.rtl ui|menu,\r\nbody.rtl ui|labelbox,\r\nbody.rtl ui|labelbody,\r\nbody.rtl ui|labeltext,\r\nbody.rtl ui|fielddesc{\r\n\tfloat: right;\r\n}\r\n\r\n\r\nbody.rtl ui|clickbutton ui|labelbox,\r\nbody.rtl ui|menuitem ui|labelbox, \r\nbody.rtl ui|menuitem ui|labelbody, \r\nbody.rtl ui|menubody ui|labelbox, \r\nbody.rtl ui|menubody ui|labelbody,\r\nbody.rtl ui|selector ui|clickbutton\r\n{\r\n\tfloat: none;\r\n}\r\n\r\nbody.rtl ui|datainputselector ui|toolbarbutton,\r\nbody.rtl ui|datainputdialog ui|toolbarbutton,\r\nbody.rtl ui|datainputbutton ui|toolbarbutton,\r\nbody.rtl ui|urlinputdialog ui|toolbarbutton {\r\n\tleft: 3px;\r\n\tright: auto;\r\n}\r\n\r\nbody.rtl ui|toolbarbody.alignright,\r\nbody.rtl ui|fieldhelp,\r\nbody.rtl ui|fielddata{\r\n\tfloat: left;\r\n}\r\n\r\nbody.rtl fielddata input {\r\n\tpadding: 5px 7px 4px 0;\r\n}\r\n\r\nbody.rtl ui|field.fieldhelp ui|fielddata {\r\n\tmargin-left: 30px;\r\n\tmargin-right: 0px;\r\n}\r\n\r\nbody.rtl ui|clickbutton.fieldhelp{\r\n\tleft: 2px;\r\n\tright: auto;\r\n}\r\n\r\n\r\nbody.rtl ui|throbber{\r\n\tright: auto;\r\n\tleft: 0;\r\n}\r\n\r\nbody.rtl ui|labelbox ui|labelbody {\r\n    background-position: 100% 0;\r\n    padding-left: 0 !important;\r\n}\r\n\r\nbody.rtl ui|labelbox ui|labelbody,\r\nbody.rtl .imagesizelarge ui|labelbox ui|labelbody {\r\n    padding-right: 16px;\r\n}\r\n\r\nbody.rtl .imagesizelarge ui|labelbox ui|labelbody {\r\n    padding-right: 28px;\r\n}\r\n\r\nbody.rtl ui|labelbox.both ui|labeltext {\r\n\tmargin-left: 0px; \r\n\tmargin-right: 4px;\r\n}\r\n\r\nbody.rtl  ui|treenode ui|treenode {\r\n\tmargin-right: 18px;\r\n\tmargin-left: 0px;\r\n}\r\n\r\nbody.rtl ui|treenode ui|labelbox {\r\n\tbackground-position: right;\t\r\n\tpadding-right: 16px;\r\n\tpadding-left: 0px;\r\n}\r\n\r\nbody.rtl .textonly ui|labelbody {\r\n\tpadding-right: 0px;\r\n}\r\n\r\nbody.rtl ui|labelbox.fieldgrouplabel ui|labelbody {\r\n\tfloat: right;\r\n}\r\n\r\nbody.rtl ui|labelbox.fieldgrouplabel ui|labelbody:before {\r\n\tborder-top:  2px groove #FFF;\r\n\tborder-right: 2px groove #FFF;\r\n\tborder-left: 0;\r\n\tborder-radius: 0px 5px 0 0;\r\n\tfloat: right;\r\n}\r\nbody.rtl ui|labelbox.fieldgrouplabel > div {\r\n\tborder-top:  2px groove #FFF;\r\n\tborder-left: 2px groove #FFF;\r\n\tborder-right: 0;\r\n\tborder-radius: 5px 0 0 0;\r\n}\r\n\r\nbody.rtl ui|controlgroup {\r\n\tfloat:left;\r\n}\r\n\r\n\r\nbody.rtl ui|controlgroup ui|labelbody {\r\n\tfloat: left;\r\n\tleft: 0px;\r\n\tright: auto;\r\n}\r\nbody.rtl ui|splitpanel.editors ui|docktab.selected ui|controlgroup,\r\nbody.rtl ui|splitpanel.editors ui|docktab.selected ui|controlgroup{\r\n\tfloat: left;\r\n\tleft: -16px;\r\n\tright: auto;\r\n}\r\nbody.rtl ui|controlgroup ui|labelbody {\r\n\tpadding-right: 32px !important;\r\n}\r\n\r\nbody.rtl #switchbutton {\r\n\tmargin-right: -10px;\r\n\tmargin-left: 0px;\r\n}\r\n\r\nbody.rtl ui|controlgroup#controlgroup {\r\n\tfloat: left;\r\n\theight: 30px;\r\n\tposition: relative;\r\n\tright: auto;\r\n}\r\n\r\nbody.rtl #start {\r\n\tclear: both;\r\n}\r\n\r\nbody.rtl ui|toolbargroup {\r\n\tborder-left: 1px solid rgb(160,160,160);\r\n\tborder-right: 1px solid rgb(255,255,255);\r\n}\r\n\r\nbody.rtl ui|toolbargroup.first {\r\n\tborder-right: none; \r\n}\r\nbody.rtl ui|toolbargroup.last {\r\n\tborder-left: none;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/sourcecodeviewers.less",
    "content": "ui|sourcecodeviewer {\r\n\tdisplay: block;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\toverflow: hidden;\r\n}\r\nui|sourcecodeviewer textarea {\r\n\tdisplay: none;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/splash.less",
    "content": ".splash-cover {\r\n\toverflow: auto;\r\n\tfont-size: 16px;\r\n\r\n\t.splash {\r\n\t\tposition: absolute;\r\n\t\ttop: 50%;\r\n\t\tleft: 50%;\r\n\t\t-webkit-transform: translate(-50%, -50%);\r\n\t\t-ms-transform: translate(-50%, -50%);\r\n\t\ttransform: translate(-50%, -50%);\r\n\t\tz-index: 3;\r\n\t\tdisplay: block;\r\n\t\twidth: 312px;\r\n\t\t-ms-border-radius: 10px;\r\n\t\tborder-radius: 10px;\r\n\t\tbackground: #fff;\r\n\t}\r\n\r\n\t.splash-inner {\r\n\t\tpadding: 10px 30px 40px 30px;\r\n\t}\r\n\r\n\th1 {\r\n\t\tborder-bottom: solid 1px #E1E1E1;\r\n\t\tpadding-bottom: 10px;\r\n\t\tmargin: 10px 0;\r\n\t}\r\n\r\n\ta, a:focus, a:active {\r\n\t\tcolor: @primary-color;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\ta:hover {\r\n\t\tcolor: darken( @primary-color, 10%);\r\n\t\ttext-decoration: underline;\r\n\t}\r\n\r\n\t.clickbutton {\r\n\t\tdisplay: block;\r\n\t\ttext-decoration: none;\r\n\t\tbackground: @primary-color;\r\n\t\tcolor: #fff;\r\n\t\t-ms-border-radius: 20px;\r\n\t\tborder-radius: 20px;\r\n\t\twidth: 100%;\r\n\t\ttext-transform: uppercase;\r\n\t\tpadding: 10px 20px;\r\n\t\ttext-align: center;\r\n\r\n\t\t&:hover, &:active, &:focus {\r\n\t\t\tbackground: darken( @primary-color, 10%);\r\n\t\t\tcolor: #fff;\r\n\t\t\ttext-decoration: none;\r\n\t\t}\r\n\t}\r\n\r\n\tui|clickbutton {\r\n\t\tfloat: none;\r\n\t\twidth: 100%;\r\n\t\tmargin: 0;\r\n\r\n\t\tui|labelbody {\r\n\t\t\theight: auto;\r\n\t\t\tfloat: none;\r\n\t\t}\r\n\r\n\t\tui|labeltext {\r\n\t\t\tfloat: none;\r\n\t\t}\r\n\r\n\t\tui|labelbox {\r\n\t\t\tdisplay: block;\r\n\t\t\ttext-decoration: none;\r\n\t\t\tbackground: @primary-color;\r\n\t\t\tcolor: #fff;\r\n\t\t\t-ms-border-radius: 20px;\r\n\t\t\tborder-radius: 20px;\r\n\t\t\twidth: 100%;\r\n\t\t\ttext-transform: uppercase;\r\n\t\t\tpadding: 10px 20px;\r\n\t\t\ttext-align: center;\r\n\t\t}\r\n\r\n\t\t&.right-btn {\r\n\t\t\tfloat: right;\r\n\t\t\twidth: auto;\r\n\t\t}\r\n\r\n\t\t&.left-btn {\r\n\t\t\tfloat: left;\r\n\t\t\twidth: auto;\r\n\t\t}\r\n\r\n\t\t&.hover {\r\n\t\t\tui|labelbox {\r\n\t\t\t\tbackground: darken( @primary-color, 10%);\r\n\t\t\t\tcolor: #fff;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n.splash-bg {\r\n\tposition: fixed;\r\n\tz-index: 1;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground-color: rgb(240,240,240);\r\n\tbackground-size: cover;\r\n\tbackground-position: center center;\r\n\tbackground-repeat: no-repeat;\r\n\tbackground-image: url(\"@{images-root-path}/top-page-cover-bg.jpg?cacheversion=@{cache-version}\");\r\n\r\n\t&:after {\r\n\t\tcontent: \"\";\r\n\t\tposition: fixed;\r\n\t\ttop: 0;\r\n\t\tleft: 0;\r\n\t\tz-index: 2;\r\n\t\twidth: 100%;\r\n\t\theight: 100%;\r\n\t\tbackground-color: rgba(0, 0, 0, 0.2);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/splitboxes.less",
    "content": "ui|splitbox, ui|splitpanel {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n\toverflow: hidden;\r\n\r\n\t&.maximized {\r\n\t\tposition: absolute;\r\n\t\ttop: 0;\r\n\t\tleft: 0;\r\n\t\twidth: 100%;\r\n\t\theight: 100%;\r\n\t}\r\n}\r\n\r\nui|splitbox {\r\n\theight: 100%;\r\n\r\n\tui|splitter.horizontal ui|splitterbody:after {\r\n\t\tcontent: '';\r\n\t\tposition: absolute;\r\n\t\tborder-left: 1px solid @base-border-color;\r\n\t\theight: 100%;\r\n\t\twidth: 0px;\r\n\t\ttop: 0px;\r\n\t\tleft: 4px;\r\n\t}\r\n}\r\n\r\nui|splitpanel {\r\n\t&.horizontal {\r\n\t\tfloat: left;\r\n\t}\r\n\r\n\t&.maximized {\r\n\t\tfloat: none !important;\r\n\t}\r\n}\r\n\r\nui|splitter {\r\n\tdisplay: block;\r\n\tz-index: 2;\r\n\tposition: relative;\r\n\tbackground: transparent;\r\n\tfont-size: 1px;\r\n\r\n\t&.active {\r\n\t\tz-index: 23; /* float to top while dragging */\r\n\t}\r\n\r\n\t&.horizontal {\r\n\t\theight: 100%;\r\n\t\twidth: 4px;\r\n\t\tfloat: left;\r\n\t\tborder: 0px;\r\n\t\tmargin: 0 -4px;\r\n\r\n\t\tui|splitterbody {\r\n\t\t\twidth: 4px;\r\n\t\t\theight: 100%;\r\n\t\t\tmargin-left: -1px;\r\n\t\t\tcursor: e-resize;\r\n\r\n\t\t\t&.hover, &.active {\r\n\t\t\t\tbox-shadow: 2px 0 3px rgba(0,0,0,0.35);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&.vertical {\r\n\t\theight: 4px;\r\n\t\twidth: 100%;\r\n\t\tborder-bottom: 1px solid @base-border-color;\r\n\t\tborder-top: 1px solid @base-border-color;\r\n\r\n\t\tui|splitterbody {\r\n\t\t\theight: 4px;\r\n\t\t\twidth: 100%;\r\n\t\t\tcursor: n-resize;\r\n\t\t\tmargin-top: -1px;\r\n\r\n\t\t\t&.hover, &.active {\r\n\t\t\t\tvendor-box-shadow: 0 2px 3px rgba(0,0,0,0.35);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|splitterbody {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\tbackground: transparent;\r\n}\r\n\r\nui|stagesplitterbody {\r\n\tbackground-color: #fff;\r\n\twidth: 10px;\r\n\theight: 10px;\r\n\toverflow: hidden;\r\n\tposition: absolute;\r\n\tdisplay: none;\r\n\tz-index: 4; /* above views (firefox3 alpha needs them +2 above) */\r\n\t&.horizontal {\r\n\t\tborder-left: 1px solid @base-border-color;\r\n\t\tborder-right: 1px solid @base-border-color;\r\n\t\tbox-shadow: 2px 0 3px rgba(0,0,0,0.35);\r\n\t\tcursor: e-resize;\r\n\t}\r\n\r\n\t&.vertical {\r\n\t\tborder-top: 1px solid @base-border-color;\r\n\t\tborder-bottom: 1px solid @base-border-color;\r\n\t\tbox-shadow: 0 2px 3px rgba(0,0,0,0.35);\r\n\t\tcursor: n-resize;\r\n\t}\r\n}\r\n\r\n.stagesplittercover {\r\n\tz-index: 5; /* above stagesplitterbody */\r\n}\r\n\r\n#toolsplitpanel {\r\n\tmargin-right: -1px; // fix bug when ZOOM browser\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/tabboxes.less",
    "content": "ui|tabbox {\r\n\tdisplay: block;\r\n\toverflow: hidden;\r\n\r\n\tui|tabbox.tabsontop { // usage: Edit Data Type -> Fields -> Tabs\r\n\t\tui|tabs{\r\n\t\t\tpadding-top: 36px;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|tabs {\r\n\tdisplay: block;\r\n\tposition: relative !important;\r\n\toverflow: hidden;\r\n}\r\n\r\nui|tab {\r\n\tdisplay: block;\r\n\tfloat: left;\r\n\tposition: relative;\r\n\twhite-space: nowrap;\r\n\tborder: solid 1px @tabs-border-color;\r\n\tborder-radius: @tabs-border-radius @tabs-border-radius 0 0;\r\n\tbackground: @tabs-bg-color;\r\n\tz-index: 2;\r\n\tmargin-right: -4px;\r\n\ttext-transform: uppercase;\r\n\tfont-family: @heading-font-family;\r\n\tfont-size: 13px;\r\n\tline-height: 18px;\r\n}\r\n\r\nui|tabpanels {\r\n\tdisplay: block;\r\n\theight: 100%;\r\n\tclear: both;\r\n\toverflow: hidden;\r\n}\r\n\r\nui|tabbox.boxed ui|tabpanels {\r\n\toverflow: visible;\r\n\theight: auto;\r\n}\r\n\r\nui|tabbox.equalsize ui|tabpanels {\r\n\toverflow: hidden;\r\n\theight: 100%;\r\n}\r\n\r\nui|tabpanel { /* styles comparable to deck - please coordinate all changes! */\r\n\tdisplay: block;\r\n\theight: 100% !important;\r\n\toverflow: hidden;\r\n\tposition: absolute;\r\n\ttop: -10000px;\r\n}\r\n\r\nui|tabbox.equalsize ui|tabpanel {\r\n\toverflow: visible;\r\n\theight: auto !important;\r\n}\r\n\r\nui|tabbox.tabsontop {\r\n\r\n\tui|tabs {\r\n\t\tbox-shadow: inset 0px -1px 0px 0px rgba(204,204,204,1);\r\n\t\tpadding: 0px 10px 0px 10px;\r\n\t}\r\n\r\n\tui|tab {\r\n\t\tpadding: 5px 20px 5px 15px;\r\n\t\tcolor: @tabs-text-color;\r\n\r\n\t\t&.selected {\r\n\t\t\tcolor: @tabs-active-text-color;\r\n\t\t\tz-index: 3;\r\n\t\t\tborder-color: @tabs-active-border-color @tabs-active-border-color transparent @tabs-active-border-color;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/tables.less",
    "content": "﻿/*****************\r\n#logtable, #versions, #headings - fix old UI table styles for Composite.Versioning.ContentVersioning\r\n******************/\r\n\r\n.table, table#logtable, table#versions, table#headings {\r\n\twidth: 100%;\r\n\tmax-width: 100%;\r\n\tmargin: 0;\r\n\tborder-collapse: collapse;\r\n\tborder-spacing: 0;\r\n\r\n\ttd, th {\r\n\t\toverflow: hidden;\r\n\t\t.user-select(none);\r\n\t\twhite-space: nowrap;\r\n\t\tborder-bottom: 1px solid @table-border-color !important;\r\n\t\tpadding: 11px 6px 12px 18px !important; // use !important to overwrite old package's CSS styles.\r\n\t\ttext-align: left;\r\n\r\n\t\t&.icon-cell {\r\n\t\t\twidth: 60px;\r\n\t\t}\r\n\t}\r\n\r\n\tth {\r\n\t\tfont-size: 13px;\r\n\t}\r\n\r\n\ttd{\r\n\t\tfont-size: 14px;\r\n\t}\r\n\r\n\tth {\r\n\t\tpadding: 6px 6px 6px 18px !important;\r\n\t}\r\n\r\n\t.head {\r\n\t\tth {\r\n\t\t\tbackground: @table-header-bg-color !important; // use !important to overwrite old package's CSS styles.\r\n\t\t\tborder-color: @table-border-color !important;\r\n\t\t}\r\n\t}\r\n\r\n\ttr.primary {\r\n\t\ttd, th {\r\n\t\t\tcolor: @primary-color;\r\n\t\t}\r\n\t}\r\n\r\n\t.text-center {\r\n\t\ttd, th {\r\n\t\t\ttext-align: center;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n.table-bordered, table#logtable, table#versions, table#headings {\r\n\tborder: 1px solid @table-border-color;\r\n\r\n\t> thead,\r\n\t> tbody,\r\n\t> tfoot {\r\n\t\t> tr {\r\n\t\t\t> th,\r\n\t\t\t> td {\r\n\t\t\t\tborder: 1px solid @table-border-color !important;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t> thead > tr {\r\n\t\t> th,\r\n\t\t> td {\r\n\t\t\tborder-bottom-width: 2px;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n.table-hover, table#logtable, table#versions {\r\n\t> tbody > tr:hover {\r\n\t\tbackground-color: @table-bg-hover !important;\r\n\t}\r\n}\r\n\r\n.permissions-table {\r\n\ttable-layout: fixed;\r\n\r\n\t.index {\r\n\t\twidth: 20%;\r\n\t\ttext-align: left;\r\n\t\tpadding-left: 7px;\r\n\t}\r\n\r\n\t.edit {\r\n\t\twidth: 40px;\r\n\t}\r\n\r\n\tspan.x {\r\n\t\tdisplay: block;\r\n\t\tposition: relative;\r\n\t\tmargin: 0 auto;\r\n\t\twidth: 16px;\r\n\t\theight: 16px;\r\n\t\tbackground: #fff;\r\n\t\tborder: 1px solid #ECECEC;\r\n\t\tborder-radius: 3px;\r\n\r\n\t\t&:before {\r\n\t\t\tposition: absolute;\r\n\t\t\ttop: 0px;\r\n\t\t\tleft: 0px;\r\n\t\t\tcontent: \"\\2713\";\r\n\t\t\tfont-size: 12px;\r\n\t\t\tfont-weight: bold;\r\n\t\t\twidth: 16px;\r\n\t\t\theight: 16px;\r\n\t\t\tcolor: #ECECEC;\r\n\t\t\ttext-align: center;\r\n\t\t\tline-height: 13px;\r\n\t\t\tpadding-left: 1px;\r\n\t\t}\r\n\t}\r\n\r\n\ttd:empty:after {\r\n\t\tdisplay: block;\r\n\t\tmargin: 0 auto;\r\n\t\tposition: relative;\r\n\t\tcontent: \"\";\r\n\t\twidth: 16px;\r\n\t\theight: 16px;\r\n\t\tbackground: #ffffff;\r\n\t\tborder: 1px solid #ECECEC;\r\n\t\tborder-radius: 3px;\r\n\t}\r\n\r\n\t.primary {\r\n\t\tspan.x {\r\n\t\t\tborder: 1px solid @base-border-color;\r\n\r\n\t\t\t&:before {\r\n\t\t\t\tcolor: @primary-color;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\ttd:empty:after {\r\n\t\t\tborder: 1px solid @base-border-color;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/texts.less",
    "content": "ui|text,\r\nui|header {\r\n\tdisplay: block;\r\n\t.user-select(none); /* See notes in DocumentManager.js */\t\r\n}\r\nui|text {\r\n\tmargin: 0 0 1em 0;\r\n}\r\nui|header {\r\n\tfont-weight: bold;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/titlebars.less",
    "content": "ui|titlebar {\r\n\tdisplay: block;\r\n\toverflow: hidden;\r\n\r\n\tui|labeltext {\r\n\t\tposition: relative;\r\n\t\toverflow: hidden;\r\n\t\ttext-overflow: ellipsis;\r\n\t\tfont-size: 16px;\r\n\t\tfont-family: @heading-font-family;\r\n\t\ttext-transform: uppercase;\r\n\t\tcolor: @heading-h1-color;\r\n\t}\r\n}\r\n\r\nui|titlebarbody {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n}\r\n\r\n\r\nui|dialog ui|titlebar ui|dialog ui|titlebar ui|labelbox.dialogtitle,\r\nui|dialog ui|titlebar ui|labelbox.dialogtitle ui|labelbody,\r\nui|dialog ui|titlebar ui|labelbox.dialogtitle ui|labeltext {\r\n\tfloat: none;\r\n}\r\n\r\nui|dialog ui|titlebar ui|labelbox.dialogtitle svg {\r\n\tdisplay: none;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/codemirror-editor.less",
    "content": ".codemirroreditor-toolbar {\r\n\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/dialog.less",
    "content": "ui|dialogtoolbar {\r\n\tdisplay: block;\r\n\tclear: both;\r\n\twhite-space: nowrap;\r\n\tpadding: 12px 11px 14px 12px;\r\n\tmargin-right: 0;\r\n\tmargin-left: 0;\r\n\tbackground-color: @dialog-header-bg-color;\r\n\tborder-top: 1px solid @base-border-color;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/document-toolbar.less",
    "content": "﻿.document-toolbar {\r\n\tpadding: 0 10px 0 10px;\r\n\tz-index: 4;\r\n\tposition: relative;\r\n\tmargin-left: 50%;\r\n\r\n\r\n\tui|toolbarbody {\r\n\t\tfloat: right;\r\n\t}\r\n\r\n\t+ ui|scrollbox { // usage: Data Type Edit\r\n\t\tmargin-top: 35px;\r\n\t\tborder-top: solid 1px @base-border-color;\r\n\t}\r\n\r\n\t+ ui|sourceeditor { //usage:  Data Type - Edit Form Markup\r\n\t\ttop: -30px;\r\n\t}\r\n\r\n\t+ ui|visualeditor { //usage:  Page Template Feature - Edit\r\n\t\tpadding-top: 30px;\r\n\t}\r\n\tui|selector {\r\n\t\tmargin: 13px 8px -13px -2px;\r\n\t\tpadding: 2px 0;\r\n\r\n\t\tui|clickbutton > ui|labelbox {\r\n\t\t\tpadding-top: 7px;\r\n\t\t}\r\n\t}\r\n\tui|toolbarbutton {\r\n\t\tborder: 1px solid @btn-primary-border-color;\r\n\t\tbackground-image: @btn-primary-bg-image;\r\n\t\tcolor: @btn-primary-color;\r\n\t\tmargin: 15px 10px -15px 0;\r\n\r\n\t\t&.combobutton {\r\n\t\t\tui|combobox {\r\n\t\t\t\tborder-left: 1px solid transparent;\r\n\r\n\t\t\t\t&:before {\r\n\t\t\t\t\tborder-color: @btn-toolbar-hover-bg-color transparent transparent transparent;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tborder-color: @btn-toolbar-hover-border-color transparent transparent transparent;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&.hover, &.active {\r\n\t\t\t\tborder: 1px solid darken(@btn-primary-border-color, 5%);\r\n\t\t\t\tcolor: @btn-primary-color;\r\n\t\t\t}\r\n\r\n\t\t\t&.hover, &.active, &[ischecked='true'] {\r\n\t\t\t\tui|combobox {\r\n\t\t\t\t\tborder-left: 1px solid @btn-primary-border-color;\r\n\r\n\t\t\t\t\t&:before {\r\n\t\t\t\t\t\ttop: 12px;\r\n\t\t\t\t\t\tright: 10px;\r\n\t\t\t\t\t\tborder-width: 5px 5px 0 5px;\r\n\t\t\t\t\t\tborder-color: @btn-toolbar-hover-bg-color transparent transparent transparent;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t&:after {\r\n\t\t\t\t\t\tdisplay: none;\r\n\t\t\t\t\t\t/*top: 12px;\r\n\t\t\t\t\t\tright: 11px;\r\n\t\t\t\t\t\tborder-width: 4px 4px 0 4px;\r\n\t\t\t\t\t\tborder-color: @btn-toolbar-hover-border-color transparent transparent transparent;*/\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/nav-toolbar.less",
    "content": "﻿ui|toolbar.nav-toolbar {\r\n\tborder-top: solid 1px @base-border-color;\r\n\r\n\tui|toolbarbody {\r\n\r\n\t\t&.alignright {\r\n\r\n\t\t\tui|toolbarbutton {\r\n\t\t\t\tmargin-left: 8px;\r\n\t\t\t\tmargin-right: 2px;\r\n\t\t\t}\r\n\r\n\t\t\tui|selector {\r\n\t\t\t\tmargin: 0 0 0 6px;\r\n\r\n\t\t\t\tui|clickbutton {\r\n\t\t\t\t\tmargin: 0;\r\n\r\n\t\t\t\t\t> ui|labelbox{\r\n\t\t\t\t\t\tpadding: 7px 30px 8px 11px;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/pagetemplates.less",
    "content": ".pagetemplates-toolbar {\r\n\tbackground: @pagetemplates-toolbar-bg-color;\r\n\tpadding: 13px 18px 15px 18px;\r\n\r\n\tui|toolbarbody, ui|toolbargroup, ui|selector {\r\n\t\twidth: 100%;\r\n\t}\r\n\r\n\tui|selector {\r\n\t\tpadding: 0;\r\n\t}\r\n\t/* temporary */\r\n\t> ui|toolbargroup {\r\n\t\tdisplay: none;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/statusbar.less",
    "content": "﻿.statusbar {\r\n\tpadding: 0 20px;\r\n\tborder-top: solid 1px #ddd;\r\n\r\n\tui|toolbargroup {\r\n\t\tpadding: 5px 0;\r\n\r\n\t\t&.first {\r\n\t\t\tpadding-right: 15px;\r\n\t\t\tmargin-right: 15px;\r\n\t\t\tborder-right: solid 1px #ddd;\r\n\t\t}\r\n\t}\r\n\r\n\tui|toolbarbutton {\r\n\t\ttext-transform: none;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/system.less",
    "content": ".system-toolbar {\r\n\tz-index: 2;\r\n\tbox-shadow: none;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/toolbars-base.less",
    "content": "ui|toolbar {\r\n\tdisplay: block;\r\n\tclear: both;\r\n\twhite-space: nowrap;\r\n\tbox-shadow: inset 0px -1px 0px 0px rgba(204, 204, 204, 1);\r\n\tpadding: 15px 20px;\r\n\r\n\t&.dark {\r\n\t\tbackground: #EFEFEF;\r\n\t}\r\n\r\n\t&.white {\r\n\t\tbackground: #fff;\r\n\t}\r\n\r\n\tui|selector {\r\n\t\tfloat: left;\r\n\t\tmargin-right: 8px;\r\n\t}\r\n}\r\n\r\nui|editorpage > ui|toolbar {\r\n\tbox-shadow: none;\r\n}\r\n\r\nui|toolbarbody {\r\n\tdisplay: block;\r\n\tfloat: left;\r\n\r\n\t&.alignright {\r\n\t\tui|toolbarbutton, ui|clickbutton {\r\n\t\t\tmargin-right: 0;\r\n\t\t\tmargin-left: 12px;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|toolbargroup {\r\n\tdisplay: block;\r\n\tfloat: left;\r\n\r\n\t&.max {\r\n\t\tfloat: none;\r\n\t}\r\n\r\n\t&.first {\r\n\t\tborder-left: none;\r\n\t}\r\n\r\n\t&.last {\r\n\t\tborder-right: none;\r\n\t}\r\n\r\n\t&.defaultcontent {\r\n\t\twidth: 1px;\r\n\t\toverflow: hidden;\r\n\t\tmargin-right: -1px;\r\n\t\tvisibility: hidden;\r\n\t\tborder: none;\r\n\t}\r\n\r\n\t> input {\r\n\t\tborder: 1px solid @btn-toolbar-border-color;\r\n\t\tmargin: 3px 10px 2px 0;\r\n\t\tpadding: 5px;\r\n\t}\r\n}\r\n\r\nui|toolbar.btns-group ui|toolbargroup,\r\nui|toolbargroup.btns-group {\r\n\tborder: 1px solid @base-border-color;\r\n\tborder-radius: 3px;\r\n\tmargin: 4px 5px;\r\n\tpadding: 0;\r\n\toverflow: hidden;\r\n\r\n\t&:empty {\r\n\t\tdisplay: none;\r\n\t}\r\n\r\n\tui|toolbarbutton {\r\n\t\tborder-color: transparent;\r\n\t\tmargin: 0;\r\n\t\tborder-radius: 0;\r\n\t\ttext-transform: none;\r\n\r\n\t\t+ ui|toolbarbutton {\r\n\t\t\tborder-color: transparent transparent transparent @base-border-color;\r\n\t\t}\r\n\r\n\t\tui|labelbox {\r\n\t\t\tpadding: 5px 9px;\r\n\t\t}\r\n\r\n\t\tui|labelbody {\r\n\t\t\tmin-width: 18px;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|toolbarlabel {\r\n\tpadding: 6px 0;\r\n}\r\n\r\nui|path {\r\n\twidth: 100%;\r\n\tfloat: left;\r\n\theight: 32px;\r\n\toverflow: hidden;\r\n}\r\n\r\nui|path ui|toolbarbutton {\r\n\tborder: 0;\r\n\ttext-transform: none;\r\n\tpadding-right: 10px;\r\n\tmargin-right: -10px !important;\r\n\tmargin-left: 2px !important;\r\n}\r\n\r\nui|path ui|toolbarbutton.isdisabled {\r\n\topacity: 1;\r\n}\r\n\r\nui|path ui|toolbarbutton + ui|toolbarbutton:before {\r\n\tcontent: \"/\";\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\tcolor: #ddd;\r\n\tleft: 0;\r\n\ttop: 6px;\r\n}\r\n\r\nui|path ui|toolbarbutton ui|labelbox {\r\n\tpadding: 6px 1px 6px 7px;\r\n}\r\n\r\nui|path ui|toolbarbutton:after {\r\n\tcontent: \"...\";\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\tright: 0;\r\n\ttop: 6px;\r\n}\r\n\r\nui|path ui|toolbarbutton:last-child:after {\r\n\tdisplay: none;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/toolbars/visual-editor.less",
    "content": "﻿.visualeditor-toolbar {\r\n\tbackground: @visual-editor-toolbar-bg-color;\r\n\tpadding: 11px 11px;\r\n}\r\n\r\n.visualeditor-adv-toolbar {\r\n\tpadding: 11px 11px;\r\n\r\n\tui|selector {\r\n\t\tmargin: 2px 3px;\r\n\t}\r\n\r\n\tui|toolbarbutton {\r\n\t\tmargin: 4px 5px;\r\n\t}\r\n\r\n\tui|selector, ui|toolbarbutton {\r\n\t\ttext-transform: none;\r\n\t}\r\n}\r\n\r\nui|dialogpage {\r\n\tui|visualeditor {\r\n\t\tborder-top: solid 1px #e2e2e2;\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/trees/genericview-tree.less",
    "content": "﻿.genericview {\r\n\r\n\tui|treebody {\r\n\t\tpadding: 30px;\r\n\t}\r\n\r\n\tui|treenode {\r\n\t\tfloat: left;\r\n\t\tclear: none;\r\n\t\tpadding: 0 8px 40px 0;\r\n\t}\r\n\r\n\tui|labelbox, ui|labelbody, ui|labeltext {\r\n\t\tfloat: none;\r\n\t\tpadding: 0;\r\n\t\tmargin: 0;\r\n\t\theight: auto;\r\n\t}\r\n\r\n\tsvg {\r\n\t\tfloat: none;\r\n\t\tmargin: 0 auto;\r\n\t}\r\n\r\n\r\n\tui|labelbox {\r\n\t\twidth: 300px;\r\n\t\theight: 195px;\r\n\t\ttext-align: center;\r\n\t\toverflow: hidden;\r\n\r\n\t\t&:before, &:after {\r\n\t\t\tdisplay: none;\r\n\t\t}\r\n\r\n\t\t&.focused {\r\n\t\t\tui|labeltext {\r\n\t\t\t\tbackground-color: transparent;\r\n\t\t\t\tcolor: @primary-color;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.image-and-text ui|labeltext {\r\n\t\t\tmargin-left: 0;\r\n\t\t\tfloat: none;\r\n\t\t}\r\n\r\n\t\tui|labeltext {\r\n\t\t\tposition: absolute;\r\n\t\t\tbottom: -3px;\r\n\t\t\tleft: 0;\r\n\t\t\tright: 0;\r\n\t\t\ttext-align: center;\r\n\t\t}\r\n\r\n\t\t&[image^=\"/\"] {\r\n\t\t\tui|labelbody {\r\n\t\t\t\tpadding-top: 170px;\r\n\t\t\t\tbackground-position: 50% 50%;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tui|labelbody {\r\n\t\twidth: 100%;\r\n\t\tbackground-position: top center;\r\n\t\tbackground-repeat: no-repeat;\r\n\t}\r\n\r\n\t&.single {\r\n\t\tui|treenode {\r\n\t\t\tfloat: none;\r\n\t\t\theight: 100%;\r\n\t\t}\r\n\r\n\t\tui|labelbox {\r\n\t\t\twidth: 100%;\r\n\t\t\theight: auto;\r\n\t\t}\r\n\r\n\t\tsvg {\r\n\t\t\tmargin-top: 50px;\r\n\t\t\tpointer-events: none;\r\n\t\t}\r\n\r\n\t\tui|labeltext {\r\n\t\t\ttop: 0;\r\n\t\t\tleft: 0;\r\n\t\t\twidth: 100%;\r\n\t\t}\r\n\r\n\t\tui|labelbox[image^=\"/\"] {\r\n\t\t\theight: 100%;\r\n\r\n\t\t\tui|labelbody {\r\n\t\t\t\theight: 100%;\r\n\t\t\t\tbackground-position: center 40px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/trees/trees-base.less",
    "content": "ui|tree {\r\n\tdisplay: block;\r\n\toverflow: hidden;\r\n\tposition: relative;\r\n}\r\n\r\nui|treebody {\r\n\tdisplay: block;\r\n\tcolor: @text-color;\r\n\toverflow: auto !important;\r\n\tpadding-top: 10px;\r\n\tbackground: @tree-bg-color;\r\n}\r\n\r\nui|treenode,\r\nui|treecontent {\r\n\tdisplay: block;\r\n\tfloat: none;\r\n\tclear: both;\r\n\toverflow: visible;\r\n}\r\n\r\nui|treenode {\r\n\tmargin: 0;\r\n\tpadding: 0 8px;\r\n\tposition: relative;\r\n\r\n\t> ui|labelbox {\r\n\t\tpadding-bottom: 3px;\r\n\t\tpadding-left: 12px;\r\n\t\tfloat: none;\r\n\t\theight: 28px;\r\n\t\tposition: relative;\r\n\r\n\t\t&.image-and-text {\r\n\t\t\tui|labeltext {\r\n\t\t\t\tdisplay: inline;\r\n\t\t\t\tmargin-left: 4px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsvg {\r\n\t\t\tmargin-top: 3px;\r\n\t\t\tcolor: @tree-icon-color;\r\n\r\n\t\t\t&.disabled {\r\n\t\t\t\tcolor: lighten(@tree-icon-color, 20%);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tui|labelbody {\r\n\t\t\theight: 28px;\r\n\t\t\twidth: 100%;\r\n\t\t}\r\n\r\n\t\tui|labeltext {\r\n\t\t\tcolor: @tree-text-color;\r\n\t\t\tfont-size: @tree-font-size;\r\n\t\t\tborder-radius: 2px;\r\n\t\t\tpadding: 3px 4px 5px 4px;\r\n\t\t\tline-height: 24px;\r\n\t\t}\r\n\r\n\t\t&:before, &:after {\r\n\t\t\tposition: absolute;\r\n\t\t\tleft: -2px;\r\n\t\t\tdisplay: block;\r\n\t\t\tcontent: \"\";\r\n\t\t\tborder: 5px solid transparent;\r\n\t\t}\r\n\r\n\t\t&.open {\r\n\t\t\t&:before {\r\n\t\t\t\ttop: 11px;\r\n\t\t\t\tborder-top-color: #999; /*Chevron Color*/\r\n\t\t\t}\r\n\r\n\t\t\t&:after {\r\n\t\t\t\ttop: 10px;\r\n\t\t\t\tborder-top-color: @tree-bg-color;\r\n\t\t\t}\r\n\r\n\t\t\tsvg {\r\n\t\t\t\tcolor: @tree-node-open-icon-color;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.closed {\r\n\t\t\t&:before {\r\n\t\t\t\ttop: 8px;\r\n\t\t\t\tborder-left-color: @primary-color; /*Chevron Color*/\r\n\t\t\t\tleft: 2px;\r\n\t\t\t}\r\n\r\n\t\t\t&:after {\r\n\t\t\t\ttop: 8px;\r\n\t\t\t\tborder-left-color: @tree-bg-color;\r\n\t\t\t\tleft: 1px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.focused {\r\n\t\t\tsvg {\r\n\t\t\t\tcolor: @tree-node-focused-icon-color;\r\n\t\t\t}\r\n\r\n\t\t\tui|labeltext {\r\n\t\t\t\tbackground-color: @tree-text-focused-bg-color;\r\n\t\t\t\tcolor: @tree-text-focused-color;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tui|treenode {\r\n\t\tpadding-left: 30px;\r\n\r\n\t\t&::before, &::after {\r\n\t\t\tcontent: '';\r\n\t\t\tposition: absolute;\r\n\t\t}\r\n\r\n\t\t&::before {\r\n\t\t\tborder-top: 1px solid #999;\r\n\t\t\ttop: 12px;\r\n\t\t\twidth: 15px;\r\n\t\t\theight: 0;\r\n\t\t\tleft: 17px;\r\n\t\t}\r\n\r\n\t\t&::after {\r\n\t\t\tborder-left: 1px solid #999;\r\n\t\t\theight: 100%;\r\n\t\t\twidth: 0px;\r\n\t\t\ttop: -3px;\r\n\t\t\tleft: 17px;\r\n\t\t}\r\n\r\n\t\t&.open, &.closed {\r\n\t\t\t&::before {\r\n\t\t\t\twidth: 8px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&:last-of-type::after {\r\n\t\t\theight: 16px;\r\n\t\t}\r\n\t}\r\n\r\n\t&.closed {\r\n\t\tui|treenode, ui|treecontent {\r\n\t\t\tdisplay: none;\r\n\t\t}\r\n\t}\r\n\r\n\t&[pin='true'] {\r\n\t\t> ui|labelbox {\r\n\t\t\t&.open{\r\n\t\t\t\t&:before {\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nui|tree > ui|treebody > ui|treenode.open {\r\n\r\n\t> ui|labelbox svg {\r\n\t\tcolor: @tree-root-open-icon-color;\r\n\t}\r\n}\r\n\r\n\r\nui|treecontent {\r\n\tpadding-left: 40px;\r\n\t.user-select(none); /* hope we don't need an input field */\r\n}\r\n\r\n\r\nui|treepositionindicator {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 140px;\r\n\theight: 1px;\r\n\toverflow: hidden;\r\n\tbackground-color: #3399FF;\r\n\tz-index: -1;\r\n}\r\n\r\n/* Template selector */\r\nui|tree#templatetree {\r\n\tui|treebody {\r\n\t\tbackground: #fff;\r\n\t\tpadding-top: 19px;\r\n\t}\r\n\r\n\tui|treenode {\r\n\t\tpadding: 1px 4px;\r\n\t}\r\n\r\n\tui|labelbody {\r\n\t\tposition: relative;\r\n\r\n\t\tsvg {\r\n\t\t\tdisplay: none;\r\n\t\t}\r\n\r\n\t\t&:before {\r\n\t\t\tcontent: '';\r\n\t\t\tposition: absolute;\r\n\t\t\twidth: 14px;\r\n\t\t\theight: 14px;\r\n\t\t\tborder: 1px solid @field-border-color;\r\n\t\t\tborder-radius: 50%;\r\n\t\t\tleft: 0px;\r\n\t\t\ttop: 4px;\r\n\t\t\tbackground: #FFFFFF;\r\n\t\t}\r\n\t}\r\n\r\n\tui|labelbox {\r\n\t\tui|labeltext {\r\n\t\t\tmargin-left: 28px;\r\n\t\t}\r\n\r\n\t\t&.focused {\r\n\t\t\tui|labeltext {\r\n\t\t\t\tbackground: transparent;\r\n\t\t\t\tcolor: #333;\r\n\t\t\t}\r\n\r\n\t\t\tui|labelbody:after {\r\n\t\t\t\tcontent: '';\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\twidth: 8px;\r\n\t\t\t\theight: 8px;\r\n\t\t\t\tborder-radius: 4px;\r\n\t\t\t\tbackground: @primary-color;\r\n\t\t\t\tleft: 4px;\r\n\t\t\t\ttop: 8px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "Website/Composite/styles/default/updatepanels.less",
    "content": "ui|updatepanel,\r\nui|updatepanelbody {\r\n\tdisplay: block;\r\n\toverflow: hidden !important;\r\n}\r\nui|updatepanel.flex,\r\nui|updatepanel.flex ui|updatepanelbody {\r\n\theight: 100%;\r\n\toverflow: hidden !important;\r\n}\r\nui|updatepanel.inline,\r\nui|updatepanel.inline ui|updatepanelbody {\r\n\tdisplay: inline;\r\n}"
  },
  {
    "path": "Website/Composite/styles/default/views.less",
    "content": "ui|viewset {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\tz-index: 1; /* needed for ie, but why? */\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 0;\r\n\theight: 0;\r\n\toverflow: visible;\r\n}\r\n\r\nui|view {\r\n\tdisplay: block;\r\n\toverflow: hidden;\r\n}\r\n\r\nui|dialogset ui|view {\r\n\tz-index: 5; /* above the dialog */\r\n}\r\n\r\nui|view.dockview { /* is this ever assigned? */\r\n\tposition: absolute;\r\n\tz-index: 1;\r\n}\r\n\r\nui|view.dockview ui|window { /* adjusted onload - fixes a moz display glitch */\r\n\tposition: absolute;\r\n\ttop: -10000px;\r\n}\r\n\r\nui|view.startpage-view {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tright: 0;\r\n\tbottom: 0;\r\n\tleft: 0;\r\n\theight: auto;\r\n\twidth: auto;\r\n\tpadding: 40px 10px 10px 60px;\r\n\tbackground-color: rgba(0,0,0,0.3);\r\n\r\n\tui|window {\r\n\t\tposition: static;\r\n\t\theight: 100%;\r\n\t\tborder: solid 1px #cccccc;\r\n\t\tborder-radius: 5px;\r\n\t}\r\n}\r\n\r\n@media (min-width: 1200px) {\r\n\tui|view.startpage-view {\r\n\t\tpadding: 50px 200px;\r\n\t}\r\n}\r\n\r\n.empty ui|view.startpage-view{\r\n\tdisplay: none !important;\r\n}\r\n\r\nui|viewset.slidein ui|view {\r\n\tbackground: @dialog-bg-color;\r\n\r\n\t&.transition {\r\n\t\ttransition: left 300ms linear;\r\n\t}\r\n\r\n}"
  },
  {
    "path": "Website/Composite/templates/PageTemplates/MasterPage.cs.txt",
    "content": "﻿using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.WebControls;\r\nusing Composite.Plugins.PageTemplates.MasterPages;\r\nusing Composite.Core.Xml;\r\nusing Composite.Core.PageTemplates; \r\n\r\npublic partial class page_template : MasterPagePageTemplate\r\n{\r\n\tpublic override Guid TemplateId\r\n\t{\r\n\t\tget { return new Guid(\"%TemplateId%\"); }\r\n\t}\r\n\r\n    public override string TemplateTitle \r\n\t{\r\n        get { return \"%TemplateTitle%\"; }\r\n    }\r\n\r\n\t[Placeholder(Id=\"content\", Title=\"Main Content\", IsDefault=true)]\r\n\tpublic XhtmlDocument Content { get; set; }\r\n\t\r\n\t[Placeholder(Id=\"bottom\", Title = \"Bottom\")]\r\n\tpublic XhtmlDocument Bottom { get; set; }\r\n\r\n\tprotected void Page_Load(object sender, EventArgs e)\r\n    {\r\n\r\n    }\r\n}"
  },
  {
    "path": "Website/Composite/templates/PageTemplates/MasterPage.txt",
    "content": "﻿<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\r\n<%@ Master Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"%Codebehind%\" Inherits=\"page_template\" %>\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" runat=\"server\">\r\n<f:function name=\"Composite.Web.Html.Template.LangAttribute\" runat=\"server\" />\r\n<head runat=\"server\">\r\n\t<title>\n        <c1:Title id=\"title\" runat=\"server\"/>\n    </title>\n\t<c1:DescriptionMetaTag runat=\"server\" />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"~/Frontend/Styles/VisualEditor.common.css\" />\r\n    <f:function runat=\"server\" name=\"Composite.Web.Html.Template.CommonMetaTags\" />\r\n</head>\r\n<body>\r\n\t\t<h1>\n            <c1:Title runat=\"server\" />\n        </h1> \n\t\t<h2>\n            <c1:Description runat=\"server\" />\n        </h2>\r\n        <div>\r\n            \r\n            <c1:Render Markup=\"<%# Content %>\" runat=\"server\" />\r\n\r\n        </div>\r\n        <h2>Bottom Placeholder</h2>\r\n        <div>\r\n            \r\n            <c1:Render Markup=\"<%# Bottom %>\" runat=\"server\" />\r\n\r\n        </div>\r\n</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/templates/PageTemplates/RazorPageTemplate.txt",
    "content": "﻿@inherits RazorPageTemplate\r\n              \r\n@functions {\r\n    public override void Configure()\r\n    {\r\n        TemplateId = new Guid(\"%TemplateId%\");\r\n        TemplateTitle = \"%TemplateTitle%\";\r\n        // Layout = \"MasterLayout.cshtml\";\r\n    }\r\n\r\n    [Placeholder(Id=\"content\", Title=\"Content\", IsDefault=true)]\r\n\tpublic XhtmlDocument Content { get; set; }\r\n\r\n    [Placeholder(Id=\"bottom\", Title=\"Bottom\")]\r\n    public XhtmlDocument Bottom { get; set; }    \r\n}\r\n<!DOCTYPE html>\r\n<html lang=\"@Lang\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:f=\"http://www.composite.net/ns/function/1.0\" xmlns:lang=\"http://www.composite.net/ns/localization/1.0\" xmlns:asp=\"http://www.composite.net/ns/asp.net/controls\">\r\n\t<head>\r\n\t\t<title>@CurrentPageNode.Title</title>\r\n\t\t@if (!string.IsNullOrEmpty(CurrentPageNode.Description)) {\r\n\t\t\t<meta name=\"description\" content=\"@CurrentPageNode.Description\" />\r\n\t\t}\r\n\t\t<f:function name=\"Composite.Web.Html.Template.CommonMetaTags\" />\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"~/Frontend/Styles/VisualEditor.common.css\" />\r\n\t</head>\r\n\t<body>\r\n\t\t<h1>@CurrentPageNode.Title</h1>\r\n\t\t<h2>@CurrentPageNode.Description</h2>\r\n\t\t<div>\r\n\t\t\t@Markup(Content)\r\n\t\t</div>\r\n\t\t<h2>Bottom Placeholder</h2>\r\n\t\t<div>\r\n\t\t\t@Markup(Bottom)\r\n\t\t</div>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/templates/PageTemplates/XmlPageTemplate.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:f=\"http://www.composite.net/ns/function/1.0\" xmlns:lang=\"{0}\" xmlns:rendering=\"http://www.composite.net/ns/rendering/1.0\" xmlns:asp=\"http://www.composite.net/ns/asp.net/controls\">\r\n  <f:function name=\"Composite.Web.Html.Template.LangAttribute\" />\r\n  <head>\r\n    <title>\r\n      <rendering:page.title />\r\n    </title>\r\n    <f:function name=\"Composite.Web.Html.Template.CommonMetaTags\" />\r\n    <rendering:page.metatag.description />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"~/Frontend/Styles/VisualEditor.common.css\" />\r\n  </head>\r\n  <body>\r\n    <div style=\"float:right; width:10em\">\r\n      <f:function name=\"Composite.Pages.QuickSitemap\" />\r\n    </div>\r\n    <h1>\r\n      <rendering:page.title />\r\n    </h1>\r\n    <h2>\r\n      <rendering:page.description />\r\n    </h2>\r\n    <div id=\"main\">\r\n      <rendering:placeholder id=\"content\" title=\"Content\" default=\"true\" />\r\n    </div>\r\n  </body>\r\n</html>"
  },
  {
    "path": "Website/Composite/templates/defaultstagedeck.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui:splitbox xmlns:ui=\"http://www.w3.org/1999/xhtml\" orient=\"horizontal\" layout=\"8:3\">\r\n\t<ui:splitpanel>\r\n\t\t<ui:splitbox orient=\"vertical\" layout=\"8:3\">\r\n\t\t\t<ui:splitpanel type=\"editors\">\r\n\t\t\t\t<ui:dock reference=\"main\" type=\"editors\">\r\n\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t</ui:dock>\r\n\t\t\t</ui:splitpanel>\r\n\t\t\t<ui:splitter/>\r\n\t\t\t<ui:splitpanel>\r\n\t\t\t\t<ui:splitbox orient=\"horizontal\" layout=\"1:1\">\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:dock reference=\"bottomleft\">\r\n\t\t\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t\t<ui:splitter/>\r\n\t\t\t\t\t<ui:splitpanel>\r\n\t\t\t\t\t\t<ui:dock reference=\"bottomright\">\r\n\t\t\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t\t\t</ui:dock>\r\n\t\t\t\t\t</ui:splitpanel>\r\n\t\t\t\t</ui:splitbox>\r\n\t\t\t</ui:splitpanel>\r\n\t\t</ui:splitbox>\r\n\t</ui:splitpanel>\r\n\t<ui:splitter collapse=\"after\"/>\r\n\t<ui:splitpanel>\r\n\t\t<ui:splitbox orient=\"vertical\" layout=\"1:1\">\r\n\t\t\t<ui:splitpanel>\r\n\t\t\t\t<ui:dock reference=\"righttop\">\r\n\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t</ui:dock>\r\n\t\t\t</ui:splitpanel>\r\n\t\t\t<ui:splitter/>\r\n\t\t\t<ui:splitpanel>\r\n\t\t\t\t<ui:dock reference=\"rightbottom\">\r\n\t\t\t\t\t<ui:docktabs>\r\n\t\t\t\t\t</ui:docktabs>\r\n\t\t\t\t\t<ui:dockpanels>\r\n\t\t\t\t\t</ui:dockpanels>\r\n\t\t\t\t</ui:dock>\r\n\t\t\t</ui:splitpanel>\r\n\t\t</ui:splitbox>\r\n\t</ui:splitpanel>\r\n</ui:splitbox>"
  },
  {
    "path": "Website/Composite/templates/grayscalefilter.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<svg xmlns=\"http://www.w3.org/2000/svg\">\r\n\t<filter id=\"grayscale\">\r\n\t\t<feColorMatrix \r\n\t\t\t values=\"0.3333 0.3333 0.3333 0 0\r\n                     0.3333 0.3333 0.3333 0 0\r\n                     0.3333 0.3333 0.3333 0 0\r\n                     0      0      0      1 0\"/>\r\n\t\t</filter>\r\n</svg>"
  },
  {
    "path": "Website/Composite/templates/matrixbindingelement.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<table class=\"matrix\" xmlns=\"http://www.w3.org/1999/xhtml\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td class=\"nw\"></td>\r\n\t\t<td class=\"n\"></td>\r\n\t\t<td class=\"ne\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class=\"w\"></td>\r\n\t\t<td class=\"c\"></td>\r\n\t\t<td class=\"e\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class=\"sw\"></td>\r\n\t\t<td class=\"s\"></td>\r\n\t\t<td class=\"se\"></td>\r\n\t</tr>\r\n</table>"
  },
  {
    "path": "Website/Composite/templates/soapenvelope.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\r\n\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \r\n\txmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n\t<soap:Header/>\r\n\t<soap:Body/>\r\n</soap:Envelope>"
  },
  {
    "path": "Website/Composite/templates/sourcecodeeditor/cs.txt",
    "content": "using System;\r\nusing Composite.Core.IO;\r\nusing System.Web;\r\nusing System.Web.UI;\r\nusing System.Web.UI.HtmlControls;\r\n\r\nusing Composite.Core.WebClient.Plugins.WebRequestHandler;\r\nusing Composite.Core.WebClient.Plugins.WebRequestHandler.Runtime;\r\nusing Composite.Core.WebClient.Foundation.PluginFacades;\r\n\r\n/**\r\n * This is the comment. \r\n */\r\nnamespace Composite.Core.WebClient\r\n{\r\n    public class PathToWebRequestHandlerMappingPage : System.Web.UI.Page\r\n    {\r\n\r\n        public PathToWebRequestHandlerMappingPage()\r\n        {\r\n            this.Init += new EventHandler(LoadAndAttachHandler);\r\n\r\n        }\r\n\r\n        private void LoadAndAttachHandler(Object o, EventArgs e)\r\n        {\r\n            string requestPath = Request.Path;\r\n            string requestName = System.IO.Path.GetFileNameWithoutExtension(requestPath);\r\n\r\n            WebRequestHandlerData requestHandlerData = WebRequestHandlerPluginFacade.GetConfigurationForHandler(requestName);\r\n\r\n            if (requestHandlerData == null)\r\n            {\r\n                throw new ApplicationException(\"No WebRequestHandler could be located for '\" + requestName + \"'. Please note that names are case sensitive\");\r\n            }\r\n\r\n            string templateControlFile = requestHandlerData.TemplateControlFile;\r\n            string placeholderId = requestHandlerData.TemplateControlPlaceholderId;\r\n\r\n            Control c = this.LoadControl(templateControlFile);\r\n            this.Controls.Add(c);\r\n\r\n            WebRequestHandler handler = WebRequestHandlerPluginFacade.GetHandler(requestName);\r\n            Control placeHolder = c.FindControl(placeholderId);\r\n            placeHolder.Controls.Add(handler);\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/templates/sourcecodeeditor/css.txt",
    "content": "@namespace url(\"http://www.w3.org/1999/xhtml\");\r\n@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\n* {\r\n\tcursor: default;\r\n\t-moz-box-sizing: border-box;\r\n}\r\nhtml,\r\nbody {\r\n\theight: 100%;\r\n\tborder: none;\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\toverflow: hidden;\r\n}\r\nbody {\r\n\tbackground-color: ThreeDFace;\r\n\tcolor: WindowText;\r\n}\r\nform { /* assuming that all forms are standard body-childnode dot net forms! */\r\n\theight: 100%;\r\n\tpadding: 0;\r\n\tmargin: 0;\t\r\n}\r\np {\r\n\tmargin: 0 0 1.3em 0;\t\r\n} "
  },
  {
    "path": "Website/Composite/templates/sourcecodeeditor/html.txt",
    "content": "<html xmlns=\"http://www.w3.org/1999/xhtml\"\r\n\txmlns:f=\"http://www.composite.net/ns/function/1.0\" \r\n\txmlns:rendering=\"http://www.composite.net/ns/rendering/1.0\"\r\n\txmlns:asp=\"http://www.composite.net/ns/asp.net/controls\">\r\n\t<head>\r\n\t\t<title>Testing!</title>\r\n\t\t<style type=\"text/css\">\r\n\t\t\tbody {\r\n\t\t\t\tbackground-color: white;\r\n\t\t\t}\r\n\t\t</style>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t\t/*\r\n\t\t\t * This is the script.\r\n\t\t\t */\r\n\t\t\twindow.onload = function () {\r\n\t\t\t\talert ( document.getElementById ( \"heading\" ).innerHTML );\r\n\t\t\t}\r\n\t\t</script>\r\n\t</head>\r\n\t<body>\r\n\t\t<!-- this is the comment -->\r\n\t\t<h1 id=\"heading\">This is the heading.</h1>\r\n\t\t\r\n\t\t<!-- this is the rendering -->\r\n\t\t<rendering:placeholder id=\"test\" title=\"Test\"/>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/templates/sourcecodeeditor/js.txt",
    "content": "/*\r\n * CodePress - Real Time Syntax Highlighting Editor written in JavaScript\r\n */\r\nCodePress = {\r\n\trange : null,\r\n\tlanguage : null,\r\n\tscrolling : false,\r\n\t\r\n\t// set initial vars and start sh\r\n\tinitialize : function() {\r\n\t\tif(typeof(editor)=='undefined'&amp;&amp;!arguments[0]) return;\r\n\t\tthis.detect();\r\n\t\tchars = '|13|32|191|57|48|187|188|'; // charcodes that trigger syntax highlighting\r\n\t\tcc = '\\u2009'; // control char\r\n\t\tif(browser.ff) {\r\n\t\t\teditor = document.getElementById('ffedt');\r\n\t\t\tdocument.designMode = 'on';\r\n\t\t\tdocument.addEventListener('keydown', this.keyHandler, true);\r\n\t\t\twindow.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false);\r\n\t\t}\r\n\t\telse if(browser.ie) {\r\n\t\t\teditor = document.getElementById('ieedt');\r\n\t\t\teditor.contentEditable = 'true';\r\n\t\t\tdocument.attachEvent('onkeydown', this.keyHandler);\r\n\t\t\twindow.attachEvent('onscroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') });\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// TODO: textarea without syntax highlighting for non supported browsers\r\n\t\t\talert('your browser is not supported at the moment');\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.syntaxHighlight('init');\r\n\t\tsetTimeout(function() { window.scroll(0,0) },50); // scroll IE to top\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/templates/sourcecodeeditor/sql.txt",
    "content": "-- simple select example\r\n\r\nSELECT * FROM books\t\r\n\tWHERE price > 100.00 and price < 150.00\t\r\n\tORDER BY title\r\n\t\r\nSELECT books.title, count(*) AS Authors\t\r\n\tFROM books\t\r\n\tJOIN book_authors \t\t\r\n\t\tON books.book_number = book_authors.book_number\t\r\n\tGROUP BY books.title\r\n\t\r\n-- insert, update and delete examples\t\r\n\r\nINSERT INTO my_table (field1, field2, field3) VALUES ('test', 'N', NULL);\r\n\r\nBEGIN WORK;\t\r\n\tUPDATE inventory SET quantity = quantity - 3 WHERE item = 'pants';\r\nCOMMIT;"
  },
  {
    "path": "Website/Composite/templates/sourcecodeeditor/xml.txt",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<cms:formdefinition xmlns=\"http://www.composite.net/ns/management/bindingforms/std.ui.controls.lib/1.0\" xmlns:cms=\"http://www.composite.net/ns/management/bindingforms/1.0\">\r\n\r\n\t<cms:bindings>\r\n\t\t<cms:binding name=\"SearchToken\" type=\"Composite.Plugins.Elements.ElementProviders.AllFunctionsElementProvider.AllFunctionsElementProviderSearchToken,Composite\" />\r\n\t\t<cms:binding name=\"Types\" type=\"System.Object\" />\r\n\t</cms:bindings>\r\n\r\n\t<!-- this is the comment -->\r\n\r\n\t<cms:layout>\r\n\t\t<Panel Label=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelFunctionSearch}\">\r\n\t\t\t<TextBox Label=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelKeyword}\" Help=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelKeywordHelp}\">\r\n\t\t\t\t<cms:bind source=\"SearchToken.Keyword\" />\r\n\t\t\t</TextBox>\r\n\r\n\t\t\t<KeySelector OptionsKeyField=\"Key\" OptionsLabelField=\"Value\" Label=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelReturnType}\" Help=\"${Composite.Management, Website.Forms.Administrative.AllFunctionsElementProviderSearchForm.LabelReturnTypeHelp}\">\r\n\t\t\t\t<KeySelector.Selected>\r\n\t\t\t\t\t<cms:bind source=\"SearchToken.SelectedTypeKey\" />\r\n\t\t\t\t</KeySelector.Selected>\r\n\t\t\t\t<KeySelector.Options>\r\n\t\t\t\t\t<cms:read source=\"Types\" />\r\n\t\t\t\t</KeySelector.Options>\r\n\t\t\t</KeySelector>\r\n\r\n\t\t</Panel>\r\n\t</cms:layout>\r\n\r\n</cms:formdefinition>"
  },
  {
    "path": "Website/Composite/templates/sourcecodeeditor/xsl.txt",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<xsl:stylesheet version=\"1.0\" \r\n\texclude-result-prefixes=\"x\" \r\n\txmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \r\n\txmlns=\"http://www.w3.org/1999/xhtml\" \r\n\txmlns:x=\"http://www.w3.org/1999/xhtml\">\r\n\t\r\n\t<!-- could be nice with an absolute pointer on this!!! -->\r\n\t<xsl:variable name=\"blankimageurl\">../../../../images/blank.png</xsl:variable>\r\n\r\n\t<xsl:template match=\"@*|*|processing-instruction()|comment()\">\r\n\t\t<xsl:copy>\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()|processing-instruction()|comment()\"/>\r\n\t\t</xsl:copy>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"/\">\r\n\t\t<html>\r\n\t\t\t<head>\r\n\t\t\t\t<title>Tiny Content</title>\r\n\t\t\t</head>\r\n\t\t\t<body>\r\n\t\t\t\t<xsl:apply-templates select=\"/x:html/x:body/node()\" />\r\n\t\t\t</body>\r\n\t\t</html>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- uncollapse empty table cells -->\r\n\t<xsl:template match=\"x:td[not(node()|text())]\">\r\n\t\t<td>\r\n\t\t\t<xsl:apply-templates select=\"@*\"/>\r\n\t\t\t<xsl:text>&#160;</xsl:text>\r\n\t\t</td>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- media embeds -->\r\n\t<xsl:template match=\"x:object\">\r\n\t\t<xsl:variable name=\"typeclass\">\r\n\t\t\t<xsl:choose>\r\n\t\t\t\t<xsl:when test=\"@classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'\">compositemediaflash</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'\">compositemediaquicktime</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@classid='clsid:166B1BCA-3F9C-11CF-8075-444553540000'\">compositemediashockwave</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'\">compositemediawinmedia</xsl:when>\r\n\t\t\t\t<xsl:otherwise>compositemediageneric</xsl:otherwise>\r\n\t\t\t</xsl:choose>\r\n\t\t</xsl:variable>\r\n\t\t<xsl:variable name=\"class\">\r\n\t\t\t<xsl:value-of select=\"$typeclass\"/>\r\n\t\t\t<xsl:if test=\"@class\">\r\n\t\t\t\t<xsl:text> </xsl:text>\r\n\t\t\t\t<xsl:value-of select=\"@class\"/>\r\n\t\t\t</xsl:if>\r\n\t\t</xsl:variable>\r\n\t\t<img class=\"{$class}\" src=\"{$blankimageurl}\">\r\n\t\t\t<xsl:if test=\"@id\">\r\n\t\t\t\t<xsl:attribute name=\"id\">\r\n\t\t\t\t\t<xsl:value-of select=\"@id\"/>\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:if test=\"@width\">\r\n\t\t\t\t<xsl:attribute name=\"width\">\r\n\t\t\t\t\t<xsl:value-of select=\"@width\"/>\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:if test=\"@height\">\r\n\t\t\t\t<xsl:attribute name=\"height\">\r\n\t\t\t\t\t<xsl:value-of select=\"@height\"/>\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:if test=\"x:param\">\r\n\t\t\t\t<xsl:attribute name=\"params\">\r\n\t\t\t\t\t<xsl:for-each select=\"x:param\">\r\n\t\t\t\t\t\t<xsl:value-of select=\"@name\"/>\r\n\t\t\t\t\t\t<xsl:text>===</xsl:text>\r\n\t\t\t\t\t\t<xsl:value-of select=\"@value\"/>\r\n\t\t\t\t\t\t<xsl:text>;</xsl:text>\r\n\t\t\t\t\t</xsl:for-each>\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t</img>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- tinymce internals -->\r\n\t<xsl:template match=\"x:a/@target\">\r\n\t\t<xsl:attribute name=\"tinymcetargetalias\">\r\n\t\t\t<xsl:value-of select=\".\"/>\r\n\t\t</xsl:attribute>\r\n\t</xsl:template>\r\n\t\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/templates/sourceeditor/popup.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui:menubody id=\"source-menubody\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<ui:menugroup rel=\"standard\">\r\n\t\t<ui:menuitem label=\"${string:Website.Templates.WysiwygEditorPopUp.LabelInsert}\" image=\"${icon:insert}\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"pageurl\" label=\"Page URL\" image=\"${icon:page}\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"imageurl\" label=\"Image URL\" image=\"${icon:image}\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"mediaurl\" label=\"Media URL\" image=\"${icon:perspective-media}\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsert\" val=\"functionmarkup\" label=\"Function Markup\" image=\"${icon:functioncall}\"/>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menuitem>\r\n\t</ui:menugroup>\r\n\t<ui:menugroup rel=\"xml\">\r\n\t\t<ui:menuitem cmd=\"compositeFormat\" val=\"\" label=\"Format\" tooltip=\"Format XML source\" image=\"${icon:editor-formatsource}\"/>\r\n\t</ui:menugroup>\r\n</ui:menubody>"
  },
  {
    "path": "Website/Composite/templates/storagetemplates/persistance.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<persistance xmlns=\"http://www.composite.net/ns/localstore/persistance\">\r\n\t<!-- \r\n\t<persist id=\"xxx\">\r\n\t\t<att name=\"n1\" value=\"v1\"/>\r\n\t\t<att name=\"n2\" value=\"v2\"/>\r\n\t\t<att name=\"n3\" value=\"v3\"/>\r\n\t</persist>\r\n\t<persist id=\"yyy\">\r\n\t\t<att name=\"n1\" value=\"v1\"/>\r\n\t\t<att name=\"n2\" value=\"v2\"/>\r\n\t\t<att name=\"n3\" value=\"v3\"/>\r\n\t</persist>\r\n\t-->\r\n</persistance>"
  },
  {
    "path": "Website/Composite/templates/updatemanagertest/advanced.txt",
    "content": "<h1 id=\"id1\">Advanced Example</h1>\r\n<h3 id=\"id2\" class=\"red\">Insert/remove elements and update attributes</h3>\r\n<p id=\"id3\">Now that things have an ID attribute specified, try this:</p>\r\n<ul id=\"id4\">\r\n\t<li id=\"id5\">Change the CSS class on the red heading to \"blue\" or \"green\"</li>\r\n\t<li id=\"id6\">Remove this list item! Then insert it again!</li>\r\n\t<li id=\"id7\">Insert a new list item after this (with an ID!)</li>\r\n</ul>\r\n<p id=\"id8\">The ID attribute is the key to make this happen - otherwise we replace!</p>\r\n<p id=\"id9\">Insert/remove has important limitations; read about it in the scripts...</p>"
  },
  {
    "path": "Website/Composite/templates/updatemanagertest/basic.txt",
    "content": "<h1>Basic Example</h1>\r\n<h3 class=\"red\">Everything is replaced when you make changes</h3>\r\n<p>For example, try changing the CSS classname from \"red\" to \"green\".</p>\r\n<p>In the report window below, you'll notice that ALL is replaced.</p>\r\n<p>That's because elements don't have an ID atribute specified!</p>\r\n<p>For something more fancy, try the \"Advanced Example\"...</p>"
  },
  {
    "path": "Website/Composite/templates/updatemanagertest/forms.txt",
    "content": "<h1 id=\"heading\">Form Example</h1>\r\n<ui:fields>\r\n\t<ui:fieldgroup label=\"Change this label!\">\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Change this label!</ui:fielddesc>\r\n\t\t\t<ui:fieldhelp>Change this help!</ui:fieldhelp>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:selector\r\n\t\t\t\t\tname=\"UNUQUE_NAME\" \r\n\t\t\t\t\tid=\"UNUQUE_ID\">\r\n\t\t\t\t\t<ui:selection label=\"Selection 1\" value=\"1\" selected=\"true\"/>\r\n\t\t\t\t\t<ui:selection label=\"Selection 2\" value=\"2\" />\r\n\t\t\t\t\t<ui:selection label=\"Selection 3\" value=\"3\" />\r\n\t\t\t\t\t<ui:selection label=\"Selection 4\" value=\"4\" />\r\n\t\t\t\t</ui:selector>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\t\r\n\t</ui:fieldgroup>\r\n</ui:fields>\r\n<p id=\"note\" style=\"margin-top:20px;\">Support for updating UI elements is extremely sketchy. But at least we know that ID attributes are automatically inserted on form elements by the XSLT layer in order to optimize updates (note that there is only one ID attribute in the markup above). You can verify generated ID attributes in the System Log (press CTRL+SHIFT+L if it's closed). The added ID attributes are generated on basis of the 'name' attribute of the selector, so make sure to change it if you add a second selector. We should probably use the ID of selector instead...</p>"
  },
  {
    "path": "Website/Composite/templates/wysiwygeditor/popup.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui:menubody id=\"wysiwyg-menubody\" xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<ui:menugroup rel=\"link\">\r\n\t\t<ui:menuitem cmd=\"compositeInsertLink\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelLink}\" image=\"${icon:link}\" image-disabled=\"${icon:linkdisabled}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t<ui:menuitem cmd=\"unlink\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelUnLink}\" image=\"${icon:unlink}\" image-disabled=\"${icon:unlink-disabled}\" binding=\"EditorMenuItemBinding\"/>\r\n\t</ui:menugroup>\r\n\t<ui:menugroup rel=\"image\">\r\n\t\t<ui:menuitem cmd=\"compositeInsertImage\" val=\"update\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelImageProperties}\" image=\"${icon:image}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t<ui:menuitem label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAlignImage}\" image=\"${icon:image-left}\" binding=\"EditorMenuItemBinding\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"JustifyLeft\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAlignImageLeft}\" image=\"${icon:image-left}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"JustifyRight\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAlignImageRight}\" image=\"${icon:image-right}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"RemoveFormat\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAlignImageNone}\" image=\"${icon:blank}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menuitem>\r\n\t</ui:menugroup>\r\n\t<ui:menugroup rel=\"rendering\">\r\n\t\t<ui:menuitem cmd=\"compositeInsertRendering\" val=\"update\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelRenderingProperties}\" image=\"${icon:functioncall}\" binding=\"EditorMenuItemBinding\"/>\r\n\t</ui:menugroup>\r\n\t<ui:menugroup rel=\"field\">\r\n\t\t<ui:menuitem cmd=\"compositeInsertField\" val=\"delete\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelFieldDelete}\" image=\"${icon:deletefield}\" binding=\"EditorMenuItemBinding\"/>\r\n\t</ui:menugroup>\r\n\t<ui:menugroup rel=\"table\">\r\n\t\t<ui:menuitem label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelTableManage}\" image=\"${icon:table}\" binding=\"EditorMenuItemBinding\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableCutRow\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelCutRow}\" image=\"${icon:cut}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableCopyRow\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelCopyRow}\" image=\"${icon:copy}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelPasteRow}\" image=\"${icon:paste}\" binding=\"EditorMenuItemBinding\">\r\n\t\t\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:menuitem cmd=\"mceTablePasteRowBefore\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelBefore}\" image=\"{icon:start}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:menuitem cmd=\"mceTablePasteRowAfter\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAfter}\" image=\"{icon:end}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t\t\t</ui:menuitem>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertTable\" val=\"update\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelTableProperties}\" image=\"${icon:table}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeTableCellProps\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelCellProperties}\" image=\"${icon:fields}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeTableRowProps\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelRowProperties}\" image=\"${icon:fields}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t</ui:menugroup>\t\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelInsertRow}\" image=\"${icon:add}\" binding=\"EditorMenuItemBinding\">\r\n\t\t\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableInsertRowBefore\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelBefore}\" image=\"${icon:start}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableInsertRowAfter\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAfter}\" image=\"${icon:end}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t\t\t</ui:menuitem>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableDeleteRow\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelDeleteRow}\" image=\"${icon:delete}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelInsertcolumn}\" image=\"${icon:add}\" binding=\"EditorMenuItemBinding\">\r\n\t\t\t\t\t\t\t<ui:menupopup>\r\n\t\t\t\t\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableInsertColBefore\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelBefore}\" image=\"${icon:before}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableInsertColAfter\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAfter}\" image=\"${icon:after}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t\t\t\t</ui:menubody>\r\n\t\t\t\t\t\t\t</ui:menupopup>\r\n\t\t\t\t\t\t</ui:menuitem>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableDeleteCol\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelDeleteColumn}\" image=\"${icon:delete}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableMergeCells\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelMergeTableCells}\" gui=\"true\" image=\"${icon:merge}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableSplitCells\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelSplitMergedCells}\" image=\"${icon:split}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t\t<ui:menugroup>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"mceTableDelete\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelDeleteTable}\" image=\"${icon:delete}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menuitem>\r\n\t</ui:menugroup>\r\n\t<ui:menugroup rel=\"insert\">\r\n\t\t<ui:menuitem label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelInsert}\" image=\"${icon:insert}\" binding=\"EditorMenuItemBinding\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup rel=\"insertions\">\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertTable\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelTable}\" image=\"${icon:table}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertImage\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelImage}\" image=\"${icon:image}\" binding=\"EditorMenuItemBinding\"/>\r\n            <ui:menuitem cmd=\"compositeInsertComponent\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelComponent}\" image=\"${icon:functioncall}\" binding=\"EditorMenuItemBinding\" />\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertRendering\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelRendering}\" image=\"${icon:functioncall}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertCharacter\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelCharacter}\" image=\"${icon:specialchar}\" binding=\"EditorMenuItemBinding\"/>\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertFieldParent\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelField}\" image=\"${icon:field}\" binding=\"EditorMenuItemBinding\" isdisabled=\"true\"/>\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menuitem>\r\n\t</ui:menugroup>\r\n\t<ui:menugroup rel=\"insert\">\r\n\t\t<ui:menuitem label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelPaste}\" image=\"${icon:down}\" binding=\"EditorMenuItemBinding\">\r\n\t\t\t<ui:menupopup>\r\n\t\t\t\t<ui:menubody>\r\n\t\t\t\t\t<ui:menugroup rel=\"insertions\">\r\n\t\t\t\t\t\t<ui:menuitem cmd=\"compositeInsertText\" val=\"insert\" gui=\"true\" label=\"${string:Composite.Web.VisualEditor:ContextMenu.LabelAsText}\" image=\"${icon:page}\" binding=\"EditorMenuItemBinding\" />\r\n\t\t\t\t\t</ui:menugroup>\r\n\t\t\t\t</ui:menubody>\r\n\t\t\t</ui:menupopup>\r\n\t\t</ui:menuitem>\r\n\t</ui:menugroup>\r\n\t<ui:menugroup rel=\"spellcheck\">\r\n\t\t<ui:menuitem cmd=\"compositeSpellCheckInfo\"  label=\"${string:Composite.Web.VisualEditor:SpellCheck.InfoLabel}\" image=\"${icon:message}\" binding=\"EditorMenuItemBinding\"/>\r\n\t</ui:menugroup>\r\n</ui:menubody>"
  },
  {
    "path": "Website/Composite/templates/wysiwygeditorplugins/mediaflashoptions.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui:fields xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<ui:fieldgroup label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelFlashOptions}\">\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Quality</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:selector name=\"paramquality\" label=\"(default)\">\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelHigh}\" value=\"high\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelLow}\" value=\"low\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutohigh}\" value=\"autoheigh\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutolow}\" value=\"autolow\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelBest}\" value=\"best\"/>\r\n\t\t\t\t</ui:selector>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>WMode</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:selector name=\"paramwmode\" label=\"(default)\">\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelWindow}\" value=\"window\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelOpaque}\" value=\"opaque\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelTransparent}\" value=\"transparent\"/>\r\n\t\t\t\t</ui:selector>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Scale</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:selector name=\"paramscale\" label=\"(default)\">\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelShowall}\" value=\"showall\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelNoborder}\" value=\"noborder\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelExactfit}\" value=\"exactfit\"/>\r\n\t\t\t\t</ui:selector>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Settings</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelAutoPlay}\" name=\"paramplay\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelLoop}\" name=\"paramloop\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelShowMenu}\" name=\"parammenu\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaFlashOptions.LabelSWLiveConnect}\" name=\"paramswliveconnect\"/>\r\n\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t</ui:fieldgroup>\r\n</ui:fields>"
  },
  {
    "path": "Website/Composite/templates/wysiwygeditorplugins/mediaquicktimeoptions.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n  <ui:fields xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\r\n\t<!-- param overview at http://www.apple.com/quicktime/tutorials/embed2.html -->\r\n\r\n\t<ui:fieldgroup label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelQuickTimeOptions}\">\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Start time</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramstarttime\" type=\"number\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>End time</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramendtime\" type=\"number\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Target</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramtarget\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Href</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramhref\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Choke speed</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramqtsrcchokespeed\" type=\"number\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Volume</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramvolume\" type=\"number\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>QT src</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramqtsrc\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Settings</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelLoop}\" name=\"paramloop\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelCache}\" name=\"paramcache\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelNoCorrection}\" name=\"paramcorrection\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelKioskMode}\" name=\"paramkioskmode\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelPlayEveryFrame}\" name=\"paramplayeveryframe\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelAutoPlay}\" name=\"paramautoplay\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelController}\" name=\"paramcontroller\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelEnableJavaScript}\" name=\"paramenablejavascript\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelAutoHRef}\" name=\"paramautohreft\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaQuickTimeOptions.LabelTargetCache}\" name=\"paramtargetcache\"/>\r\n\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t</ui:fieldgroup>\r\n</ui:fields>"
  },
  {
    "path": "Website/Composite/templates/wysiwygeditorplugins/mediashockwaveoptions.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui:fields xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<ui:fieldgroup label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShockWaveOptions}\">\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Quality</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:selector name=\"param-quality\" label=\"(default)\">\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelHigh}\" value=\"high\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelLow}\" value=\"low\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoHigh}\" value=\"autoheigh\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoLow}\" value=\"autolow\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelBest}\" value=\"best\"/>\r\n\t\t\t\t</ui:selector>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>WMode</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:selector name=\"param-wmode\" label=\"(default)\">\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelWindow}\" value=\"window\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelOpaque}\" value=\"opaque\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelTransparent}\" value=\"transparent\"/>\r\n\t\t\t\t</ui:selector>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Scale</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:selector name=\"param-scale\" label=\"(default)\">\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShowAll}\" value=\"showall\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelNoBorder}\" value=\"noborder\"/>\r\n\t\t\t\t\t<ui:selection label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelExactFit}\" value=\"exactfit\"/>\r\n\t\t\t\t</ui:selector>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Settings</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelAutoPlay}\" name=\"param-play\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelLoop}\" name=\"param-loop\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelShowMenu}\" name=\"param-menu\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaShockWaveOptions.LabelSWLiveConnect}\" name=\"param-swliveconnect\"/>\r\n\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t</ui:fieldgroup>\r\n</ui:fields>"
  },
  {
    "path": "Website/Composite/templates/wysiwygeditorplugins/mediawinmediaoptions.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui:fields xmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t<ui:fieldgroup label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelQuickTimeOptions}\">\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Balance</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"parambalance\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Captioning ID</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramcaptioningid\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Current position</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramcurrentposition\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Play count</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramplaycount\" type=\"number\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>UI Mode</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramuimode\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Base URL</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"parambaseurl\" type=\"number\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Current marker</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramcurrentmarker\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Default frame</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramdefaultframe\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Rate</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramrate\" type=\"number\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Volume</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:datainput name=\"paramvolume\" type=\"number\"/>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t\t<ui:field>\r\n\t\t\t<ui:fielddesc>Settings</ui:fielddesc>\r\n\t\t\t<ui:fielddata>\r\n\t\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelAutoStart}\" name=\"paramautostart\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelShowMenu}\" name=\"paramenablecontextmenu\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelInvokeURLs}\" name=\"paraminvokeurls\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelStretchToFit}\" name=\"paramstretchtofit\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelEnabled}\" name=\"paramenabled\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelFullScreen}\" name=\"paramfullscreen\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelMute}\" name=\"parammute\" ischecked=\"true\"/>\r\n\t\t\t\t\t<ui:checkbox label=\"${Composite.Management, Website.Templates.WysiwygEditorPlugins.MediaWinMediaOptions.LabelWindowLessVideo}\" name=\"paramwindowlessvideo\"/>\r\n\t\t\t\t</ui:checkboxgroup>\r\n\t\t\t</ui:fielddata>\r\n\t\t</ui:field>\r\n\t</ui:fieldgroup>\r\n</ui:fields>"
  },
  {
    "path": "Website/Composite/top.aspx",
    "content": "<!DOCTYPE html>\r\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" Inherits=\"Composite_Management_Top\" CodeFile=\"Top.aspx.cs\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:ui=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<control:appinitializer runat=\"server\" />\r\n<control:httpheaders runat=\"server\" />\r\n<head>\r\n\r\n    <title><%= Composite.Core.Configuration.GlobalSettingsFacade.ApplicationShortName %>: <%= Request.Url.Host%></title>\r\n    <meta name=\"robots\" content=\"noindex, nofollow\" />\r\n    <meta name=\"google\" value=\"notranslate\" />\r\n    <meta name=\"mobile-web-app-capable\" content=\"yes\" />\r\n\r\n    <control:styleloader runat=\"server\" />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"top.css.aspx\" />\r\n\t<control:brandingSnippet runat=\"server\" SnippetName=\"includes\" />\r\n     <% Response.WriteFile(\"favicon.inc\"); %>\r\n    <control:scriptloader type=\"top\" runat=\"server\" />\r\n\r\n    <ui:keyset>\r\n\r\n        <!-- general keycombos -->\r\n        <ui:key key=\"L\" modifiers=\"control shift\" oncommand=\"Commands.systemLog ()\" preventdefault=\"true\" />\r\n        <ui:key key=\"S\" modifiers=\"control\" oncommand=\"Commands.save ()\" preventdefault=\"true\" />\r\n        <ui:key key=\"R\" modifiers=\"control\" oncommand=\"Application.reload ()\" preventdefault=\"true\" />\r\n        <ui:key key=\"D\" modifiers=\"control\" oncommand=\"// disable bookmarking!\" preventdefault=\"true\" />\r\n\r\n        <!-- help view -->\r\n        <ui:key key=\"VK_F1\" oncommand=\"Commands.help ()\" preventdefault=\"true\" />\r\n\r\n        <!-- globally broadcasting special keystrokes -->\r\n        <ui:key key=\"VK_ENTER\" oncommand=\"Keyboard.keyEnter ()\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_ESCAPE\" oncommand=\"Keyboard.keyEscape ()\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_SPACE\" oncommand=\"Keyboard.keySpace ()\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_SHIFT\" oncommand=\"Keyboard.keyShift ()\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_CONTROL\" oncommand=\"Keyboard.keyControl ()\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_TAB\" oncommand=\"Keyboard.keyTab ()\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_UP\" oncommand=\"Keyboard.keyArrow ( KeyEventCodes.VK_UP )\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_RIGHT\" oncommand=\"Keyboard.keyArrow ( KeyEventCodes.VK_RIGHT )\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_DOWN\" oncommand=\"Keyboard.keyArrow ( KeyEventCodes.VK_DOWN )\" modifiers=\"*\" />\r\n        <ui:key key=\"VK_LEFT\" oncommand=\"Keyboard.keyArrow ( KeyEventCodes.VK_LEFT )\" modifiers=\"*\" />\r\n\r\n    </ui:keyset>\r\n\r\n</head>\r\n<body id=\"top\">\r\n\r\n    <ui:cover id=\"mastercover\" transparent=\"true\" busy=\"true\" blockevents=\"true\" doubletouchunlock=\"true\" />\r\n    <ui:cover id=\"logoutcover\" busy=\"false\" blockevents=\"true\" hidden=\"true\" />\r\n    <ui:uncover id=\"uncover\" />\r\n\r\n    <ui:theatre id=\"offlinetheatre\" hidden=\"true\">\r\n        <div id=\"offlinesplash\">\r\n            <div id=\"offlineimage\" />\r\n            <div id=\"offlinetext\">\r\n                Working... Please wait.\r\n    \t\t\t\t<noscript><div>ERROR! Your browser does not support JavaScript</div></noscript>\r\n            </div>\r\n        </div>\r\n    </ui:theatre>\r\n\r\n    <ui:persistance id=\"persistance\" />\r\n\r\n    <ui:page id=\"toppage\" strongfocusmanager=\"false\" flex=\"false\">\r\n\r\n        <!-- show intro splash or normal splash? -->\r\n        <ui:cover id=\"cover\" class=\"splash-cover\" busy=\"false\">\r\n            <div class=\"splash-bg\"></div>\r\n\t\t\t<asp:Literal ID=\"contentHolder\" runat=\"server\" />\r\n\t\t</ui:cover>\r\n\r\n        <!-- app loaded here! -->\r\n        <ui:window id=\"appwindow\" />\r\n\r\n    </ui:page>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/top.aspx.cs",
    "content": "using System;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Configuration;\r\nusing System.IO;\r\n\r\npublic partial class Composite_Management_Top : System.Web.UI.Page\r\n{\r\n    const string gruntHolderFileUrl = \"grunt.inc\";\r\n    const string welcomeHolderFileUrl = \"welcome.inc\";\r\n    const string loginHolderFileUrl = \"login.inc\";\r\n\r\n    protected void Page_PreInit(object sender, EventArgs e)\r\n    {\r\n        var isCSSCompiled = C1File.Exists(this.MapPath(\"styles/styles.min.css\")) && C1File.Exists(this.MapPath(\"styles/styles.css\"));\r\n        if (!isCSSCompiled)\r\n        {\r\n            contentHolder.Text = C1File.ReadAllText(this.MapPath(gruntHolderFileUrl));\r\n            return;\r\n        }\r\n        \r\n        string myPathAndQuery = Request.Url.PathAndQuery;\r\n\r\n        if (!myPathAndQuery.Contains(\"/Composite/\"))\r\n        {\r\n            // not launching in /Composite/ folder (case sensitive)! The wysiwyg editor support code URL handling does case sensitive searches, so we fix it right here. Tnx to the sucky string features in xslt 1.0\r\n            int badlyCaseIndex = myPathAndQuery.IndexOf(\"/composite/\", StringComparison.OrdinalIgnoreCase);\r\n            string fixedPathAndQuery = string.Format(\"{0}/Composite/{1}\",\r\n                                            myPathAndQuery.Substring(0, badlyCaseIndex),\r\n                                            myPathAndQuery.Substring(badlyCaseIndex + 11));\r\n\r\n            Response.Redirect(fixedPathAndQuery);\r\n        }\r\n\r\n        if (SystemSetupFacade.IsSystemFirstTimeInitialized == false)\r\n        {\r\n            if (System.Web.HttpContext.Current.Request.UserAgent == null)\r\n            {\r\n                Response.Redirect(\"unknownbrowser.aspx\");\r\n                return;\r\n            }\r\n            contentHolder.Text = C1File.ReadAllText(MapPath(welcomeHolderFileUrl));\r\n        }\r\n        else\r\n        {\r\n            contentHolder.Text = C1File.ReadAllText(this.MapPath(loginHolderFileUrl));\r\n        }\r\n       \r\n    }\r\n}\r\n"
  },
  {
    "path": "Website/Composite/top.aspx.designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated. \r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\n\r\n\r\npublic partial class Composite_Management_Top {\r\n    \r\n    /// <summary>\r\n    /// topholder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder topholder;\r\n    \r\n    /// <summary>\r\n    /// introholder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder introholder;\r\n    \r\n    /// <summary>\r\n    /// splashholder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder splashholder;\r\n\r\n    /// <summary>\r\n    /// splashholder control.\r\n    /// </summary>\r\n    /// <remarks>\r\n    /// Auto-generated field.\r\n    /// To modify move field declaration from designer file to code-behind file.\r\n    /// </remarks>\r\n    protected global::System.Web.UI.WebControls.PlaceHolder gruntholder;\r\n\r\n    protected global::System.Web.UI.WebControls.Literal contentHolder;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/top.css",
    "content": "@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nui|theatre,\r\nui|theatre * {\r\n\tcursor: wait;\t\r\n}\r\nui|theatre {\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\ttop: 100%;\r\n\tleft: 100%;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\tz-index: 4; /* below cover */\r\n\tz-index: 6; /* above cover! */\r\n\tz-index: 1001; /* above mastercover! */\r\n\tbackground-color: transparent;\r\n}\r\n\r\nui|theatre canvas {\r\n\twidth: 100%;\r\n\theight: 100%;\t\r\n}\r\n\r\ndiv#offlinesplash {\r\n\twidth: 128px;\r\n\theight: 128px;\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\tmargin-top: -100px;\r\n\tmargin-left: -64px;\r\n\tz-index: 1;\r\n\ttext-align: center;\r\n}\r\n\r\ndiv#offlineimage {\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tmargin-bottom: 10px;\r\n\tbackground: url(\"images/loading.svg.ashx\");\r\n}\r\n\r\ndiv#offlinetext {\r\n    color: #666;\r\n\tfont-weight: bold;\r\n}\r\n\r\n.loginpage ui|fielddata {\r\n    border-bottom: solid 1px #ddd;\r\n    margin-bottom: 10px;\r\n    height: 40px;\r\n    padding: 5px 0;\r\n}\r\n\r\n        .loginpage ui|fielddata .icon svg {\r\n            width: 20px;\r\n            height: 26px;\r\n\t        margin-left: 2px;\r\n        }\r\n\r\n    .loginpage  ui|fielddata ui|datainput {\r\n        padding: 0;\r\n    }\r\n\r\n    .loginpage ui|fielddata ui|box {\r\n        height: 26px;\r\n    }\r\n\r\n    .loginpage ui|fielddata input {\r\n        font-size: 16px;\r\n        width: 100%;\r\n        padding: 0 4px 5px 15px;\r\n    }\r\n\r\n        .loginpage ui|fielddata input.warning {\r\n            font-weight: normal;\r\n        }\r\n\r\n\r\n.loginpage ui|datainput ui|box {\r\n    border: none;\r\n}\r\n\r\n.loginpage ui|dialogtoolbar {\r\n    margin-top: 40px;\r\n    padding: 0;\r\n    background-color: transparent;\r\n    border: none;\r\n}\r\n\r\n.loginpage ui|dialogtoolbar ui|toolbargroup {\r\n    display: none;\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "Website/Composite/transformations/WysiwygEditor_StructuredContentToTinyContent.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<xsl:stylesheet version=\"1.0\" \r\n\texclude-result-prefixes=\"x\" \r\n\txmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \r\n\txmlns=\"http://www.w3.org/1999/xhtml\" \r\n\txmlns:x=\"http://www.w3.org/1999/xhtml\">\r\n\r\n  <xsl:param name=\"requestapppath\" />\r\n\r\n  <!-- TODO: an absolute pointer on this!!! -->\r\n\t<xsl:variable name=\"blankimageurl\">../../../../images/blank.png</xsl:variable>\r\n\t\r\n\t<xsl:template match=\"@*|*|processing-instruction()|comment()\">\r\n\t\t<xsl:copy>\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()|processing-instruction()|comment()\"/>\r\n\t\t</xsl:copy>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"/\">\r\n\t\t<html>\r\n\t\t\t<head>\r\n\t\t\t\t<title>Tiny Content</title>\r\n\t\t\t</head>\r\n\t\t\t<body>\r\n\t\t\t\t<xsl:apply-templates select=\"/x:html/x:body/node()\" />\r\n\t\t\t</body>\r\n\t\t</html>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- uncollapse empty table cells -->\r\n\t<xsl:template match=\"x:td[not(node()|text())]\">\r\n\t\t<td>\r\n\t\t\t<xsl:apply-templates select=\"@*\"/>\r\n\t\t</td>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- media embeds -->\r\n\t<xsl:template match=\"x:object\">\r\n\t\t<xsl:variable name=\"typeclass\">\r\n\t\t\t<xsl:choose>\r\n\t\t\t\t<xsl:when test=\"@classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'\">compositemediaflash</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'\">compositemediaquicktime</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@classid='clsid:166B1BCA-3F9C-11CF-8075-444553540000'\">compositemediashockwave</xsl:when>\r\n\t\t\t\t<xsl:when test=\"@classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'\">compositemediawinmedia</xsl:when>\r\n\t\t\t\t<xsl:otherwise>\r\n\t\t\t\t\t<xsl:choose>\r\n\t\t\t\t\t\t<xsl:when test=\"x:embed[@type='application/x-shockwave-flash']\">compositemediaflash</xsl:when>\r\n\t\t\t\t\t\t<xsl:when test=\"x:embed[@type='video/quicktime']\">compositemediaquicktime</xsl:when>\r\n\t\t\t\t\t\t<xsl:when test=\"x:embed[@type='application/x-director']\">compositemediashockwave</xsl:when>\r\n\t\t\t\t\t\t<xsl:when test=\"x:embed[@type='application/x-mplayer2']\">compositemediawinmedia</xsl:when>\r\n\t\t\t\t\t\t<xsl:otherwise>compositemediageneric</xsl:otherwise>\r\n\t\t\t\t\t</xsl:choose>\r\n\t\t\t\t</xsl:otherwise>\r\n\t\t\t</xsl:choose>\r\n\t\t</xsl:variable>\r\n\t\t<xsl:variable name=\"class\">\r\n\t\t\t<xsl:value-of select=\"$typeclass\"/>\r\n\t\t\t<xsl:if test=\"@class\">\r\n\t\t\t\t<xsl:text> </xsl:text>\r\n\t\t\t\t<xsl:value-of select=\"@class\"/>\r\n\t\t\t</xsl:if>\r\n\t\t</xsl:variable>\r\n\t\t<img class=\"{$class}\" src=\"{$blankimageurl}\">\r\n\t\t\t<xsl:if test=\"@id\">\r\n\t\t\t\t<xsl:attribute name=\"id\">\r\n\t\t\t\t\t<xsl:value-of select=\"@id\"/>\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:if test=\"@width\">\r\n\t\t\t\t<xsl:attribute name=\"width\">\r\n\t\t\t\t\t<xsl:value-of select=\"@width\"/>\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:if test=\"@height\">\r\n\t\t\t\t<xsl:attribute name=\"height\">\r\n\t\t\t\t\t<xsl:value-of select=\"@height\"/>\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t\t\r\n\t\t\t<!-- note that all object params and embed attributes are collected as one! -->\r\n\t\t\t<xsl:if test=\"x:param or x:embed\">\r\n\t\t\t\t<xsl:attribute name=\"params\">\r\n\t\t\t\t\t\r\n\t\t\t\t\t<!-- collect params -->\r\n\t\t\t\t\t<xsl:for-each select=\"x:param\">\r\n\t\t\t\t\t\t<xsl:value-of select=\"@name\"/>\r\n\t\t\t\t\t\t<xsl:text>===</xsl:text>\r\n\t\t\t\t\t\t<xsl:value-of select=\"@value\"/>\r\n\t\t\t\t\t\t<xsl:text>;</xsl:text>\r\n\t\t\t\t\t</xsl:for-each>\r\n\t\t\t\t\t\r\n\t\t\t\t\t<!-- collect embed attributes -->\r\n\t\t\t\t\t<xsl:for-each select=\"x:embed/@*\">\r\n\t\t\t\t\t\t<xsl:variable name=\"name\" select=\"name()\"/>\r\n\t\t\t\t\t\t<xsl:if test=\"$name!='type' and not(parent::x:embed/parent::x:object/x:param[@name=$name])\">\r\n\t\t\t\t\t\t\t<xsl:value-of select=\"$name\"/>\r\n\t\t\t\t\t\t\t<xsl:text>===</xsl:text>\r\n\t\t\t\t\t\t\t<xsl:value-of select=\".\"/>\r\n\t\t\t\t\t\t\t<xsl:text>;</xsl:text>\r\n\t\t\t\t\t\t</xsl:if>\t\t\t\t\t\t\r\n\t\t\t\t\t</xsl:for-each>\r\n\t\t\t\t\t\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t</img>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- tinymce internals -->\r\n\t<xsl:template match=\"x:a/@target\">\r\n\t\t<xsl:attribute name=\"tinymcetargetalias\">\r\n\t\t\t<xsl:value-of select=\".\"/>\r\n\t\t</xsl:attribute>\r\n\t</xsl:template>\r\n\t\r\n  \r\n\t<!-- tilde root-URLS confuses TinyMCE and we fix it here -->\r\n  <xsl:template match=\"x:a/@href[contains(.,'/misc/editors/visualeditor/%7E')]\">\r\n\t\t<xsl:attribute name=\"href\">\r\n\t\t\t<xsl:text>~</xsl:text>\r\n\t\t\t<xsl:value-of select=\"substring-after(.,'%7E')\"/>\r\n\t\t</xsl:attribute>\r\n\t</xsl:template>\r\n\r\n\r\n  <!-- img tags src reference fixing -->\r\n  <xsl:template match=\"x:a/@href[starts-with(.,'/Renderers/')]\">\r\n    <xsl:attribute name=\"href\">\r\n      <xsl:value-of select=\"concat($requestapppath,.)\"/>\r\n    </xsl:attribute>\r\n  </xsl:template>\r\n\r\n  <!-- img tags src reference fixing -->\r\n  <xsl:template match=\"x:img/@src[starts-with(.,'/Renderers/')]\">\r\n    <xsl:attribute name=\"src\">\r\n      <xsl:value-of select=\"concat($requestapppath,.)\"/>\r\n    </xsl:attribute>\r\n  </xsl:template>\r\n\r\n  <xsl:template match=\"x:img/@src[starts-with(.,'%7E')]\">\r\n    <xsl:attribute name=\"src\">\r\n      <xsl:value-of select=\"concat($requestapppath,substring-after(.,'%7E'))\"/>\r\n    </xsl:attribute>\r\n    <xsl:attribute name=\"c1-preserve-tilde\">true</xsl:attribute>\r\n  </xsl:template>\r\n\r\n  <xsl:template match=\"x:img/@src[starts-with(.,'~')]\">\r\n    <xsl:attribute name=\"src\">\r\n      <xsl:value-of select=\"concat($requestapppath,substring-after(.,'~'))\"/>\r\n    </xsl:attribute>\r\n    <xsl:attribute name=\"c1-preserve-tilde\">true</xsl:attribute>\r\n  </xsl:template>\r\n\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/transformations/WysiwygEditor_TinyContentToStructuredContent.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<xsl:stylesheet version=\"1.0\" exclude-result-prefixes=\"x\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:x=\"http://www.w3.org/1999/xhtml\">\r\n\r\n  <xsl:param name=\"requestscheme\" />\r\n  <xsl:param name=\"requesthostname\" />\r\n  <xsl:param name=\"requestport\" />\r\n  <xsl:param name=\"requestapppath\" />\r\n\r\n  <xsl:variable name=\"uriWithPort\" select=\"concat($requestscheme,'://',$requesthostname,':',$requestport,$requestapppath,'/')\" />\r\n  <xsl:variable name=\"uriNoPort\" select=\"concat($requestscheme,'://',$requesthostname,$requestapppath,'/')\" />\r\n\r\n  <!-- these will be stripped from innerHTML input in order to allow relative URLs -->\r\n  <xsl:variable name=\"uriEditor\">Composite/content/misc/editors/visualeditor/</xsl:variable>\r\n  <xsl:variable name=\"uriEditor1\" select=\"concat($requestapppath,'/',$uriEditor)\"/>\r\n  <xsl:variable name=\"uriEditor2\" select=\"concat($uriWithPort,$uriEditor)\"/>\r\n  <xsl:variable name=\"uriEditor3\" select=\"concat($uriNoPort,$uriEditor)\"/>\r\n\r\n  <xsl:template match=\"@*|*|processing-instruction()|comment()\">\r\n    <xsl:copy>\r\n      <xsl:apply-templates select=\"*|@*|text()|processing-instruction()|comment()\" />\r\n    </xsl:copy>\r\n  </xsl:template>\r\n\r\n  <xsl:template match=\"/\">\r\n    <html>\r\n      <head>\r\n        <title>Composite.Management</title>\r\n      </head>\r\n      <body>\r\n        <xsl:apply-templates select=\"/x:html/x:body/node()\" />\r\n      </body>\r\n    </html>\r\n  </xsl:template>\r\n\r\n  <!-- strip empty attributes -->\r\n  <xsl:template match=\"@*[.='']\" />\r\n\r\n  <!-- strip this attribute -->\r\n  <xsl:template match=\"@id[.='__mce']\"/>\r\n\r\n  <!-- strip tinymce internals -->\r\n  <xsl:template match=\"@mce_serialized|@mce_keep|@mce_src|@mce_href|@mce_bogus|@mce_style|@data-mce-src|@data-mce-href|@mce_imageresize_id|@data-mce-selected\" />\r\n\r\n  <!-- more tinymce internals -->\r\n  <xsl:template match=\"@class[contains(.,'mceVisualAid')]\">\r\n    <xsl:choose>\r\n      <xsl:when test=\".='mceVisualAid'\" />\r\n\t\t\t<xsl:when test=\"contains(.,' mceVisualAid')\">\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-before(.,' mceVisualAid')\" />\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,' mceVisualAid')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,'mceVisualAid ')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:otherwise>\r\n    </xsl:choose>\r\n  </xsl:template>\r\n\r\n  <!-- more tinymce internals -->\r\n  <xsl:template match=\"@class[contains(.,'mceC1Focused')]\">\r\n    <xsl:choose>\r\n      <xsl:when test=\".='mceC1Focused'\" />\r\n\t\t\t<xsl:when test=\"contains(.,' mceC1Focused')\">\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-before(.,' mceC1Focused')\" />\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,' mceC1Focused')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:when>\r\n      <xsl:otherwise>\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,'mceC1Focused ')\" />\r\n\t\t\t\t</xsl:attribute>\r\n      </xsl:otherwise>\r\n    </xsl:choose>\r\n  </xsl:template>\r\n\r\n  <!-- more tinymce internals -->\r\n  <xsl:template match=\"@class[contains(.,'mceItemTable')]\">\r\n    <xsl:choose>\r\n      <xsl:when test=\".='mceItemTable'\" />\r\n\t\t\t<xsl:when test=\"contains(.,' mceItemTable')\">\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-before(.,' mceItemTable')\" />\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,' mceItemTable')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,'mceItemTable ')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:otherwise>\r\n    </xsl:choose>\r\n  </xsl:template>\r\n\r\n\t<!-- more tinymce internals -->\r\n\t<xsl:template match=\"@class[contains(.,'mce-item-table')]\">\r\n\t\t<xsl:choose>\r\n\t\t\t<xsl:when test=\".='mce-item-table'\" />\r\n\t\t\t<xsl:when test=\"contains(.,' mce-item-table')\">\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-before(.,' mce-item-table')\" />\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,' mce-item-table')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,'mce-item-table ')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:otherwise>\r\n\t\t</xsl:choose>\r\n\t</xsl:template>\r\n\r\n\t<!-- more tinymce internals -->\r\n\t<xsl:template match=\"@class[contains(.,'mceItemAnchor')]\">\r\n\t\t<xsl:choose>\r\n\t\t\t<xsl:when test=\".='mceItemAnchor'\" />\r\n\t\t\t<xsl:when test=\"contains(.,' mceItemAnchor')\">\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-before(.,' mceItemAnchor')\" />\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,' mceItemAnchor')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:value-of select=\"substring-after(.,'mceItemAnchor ')\" />\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t</xsl:otherwise>\r\n\t\t</xsl:choose>\r\n\t</xsl:template>\r\n\r\n  <!-- more tinymce internals -->\r\n  <xsl:template match=\"x:a/@tinymcetargetalias\">\r\n    <xsl:attribute name=\"target\">\r\n      <xsl:value-of select=\".\" />\r\n    </xsl:attribute>\r\n  </xsl:template>\r\n\r\n  <!-- stripping system-local URI parts -->\r\n  <xsl:template match=\"@src | @href\">\r\n    <xsl:attribute name=\"{local-name()}\"> \r\n      <xsl:variable name=\"cleanpath\">\r\n        <xsl:choose>\r\n          <xsl:when test=\"starts-with(.,$uriEditor1)\">\r\n            <xsl:value-of select=\"substring-after(.,$uriEditor1)\"/>\r\n          </xsl:when>\r\n          <xsl:when test=\"starts-with(.,$uriEditor2)\">\r\n            <xsl:value-of select=\"substring-after(.,$uriEditor2)\"/>\r\n          </xsl:when>\r\n          <xsl:when test=\"starts-with(.,$uriEditor3)\">\r\n            <xsl:value-of select=\"substring-after(.,$uriEditor3)\"/>\r\n          </xsl:when>\r\n          <xsl:when test=\"starts-with(.,$uriWithPort)\">\r\n            <xsl:value-of select=\"concat('~/',substring-after(.,$uriWithPort))\" />\r\n          </xsl:when>\r\n          <xsl:when test=\"($requestport='80' or $requestport='443') and starts-with(.,$uriNoPort)\">\r\n            <xsl:value-of select=\"concat('~/',substring-after(.,$uriNoPort))\" />\r\n          </xsl:when>\r\n          <xsl:when test=\"starts-with(.,'../../../../..')\">\r\n            <xsl:value-of select=\"concat('~', substring-after(.,'../../../../..'))\" />\r\n          </xsl:when>\r\n          <xsl:when test=\"starts-with(.,'../../../..')\">\r\n            <xsl:value-of select=\"concat('~/Composite', substring-after(.,'../../../..'))\" />\r\n          </xsl:when>\r\n          <xsl:otherwise>\r\n            <xsl:value-of select=\".\" />\r\n          </xsl:otherwise>\r\n        </xsl:choose>\r\n      </xsl:variable>\r\n      \r\n      \r\n      <xsl:choose>\r\n        <xsl:when test=\"starts-with($cleanpath,concat($requestapppath,'/Renderers/'))\">\r\n          <xsl:value-of select=\"concat('~',substring-after($cleanpath,$requestapppath))\" />\r\n        </xsl:when>\r\n        <xsl:otherwise>\r\n          <xsl:value-of select=\"$cleanpath\" />\r\n        </xsl:otherwise>\r\n      </xsl:choose>\r\n    </xsl:attribute>\r\n\r\n  </xsl:template>\r\n\r\n\r\n  <!-- table cells -->\r\n  <xsl:template match=\"x:td[x:br[not(preceding-sibling::node()) and not (following-sibling::node())]]\">\r\n    <td>\r\n      <xsl:apply-templates select=\"@*\" />\r\n      <xsl:call-template name=\"uncollapse\" />\r\n      <xsl:text></xsl:text>\r\n    </td>\r\n  </xsl:template>\r\n\r\n  <!-- when a formatblock change has been made to a media embed, the image remains -->\r\n  <xsl:template match=\"x:img[@params]\"></xsl:template>\r\n\r\n  <!-- media embeds [owerrules the previous rule] -->\r\n  <xsl:template match=\"x:img[@class[contains(.,'compositemedia')]]\">\r\n    <xsl:variable name=\"type\">\r\n      <xsl:choose>\r\n        <xsl:when test=\"contains(@class,' ')\">\r\n          <xsl:value-of select=\"substring-before(@class,' ')\" />\r\n        </xsl:when>\r\n        <xsl:otherwise>\r\n          <xsl:value-of select=\"@class\" />\r\n        </xsl:otherwise>\r\n      </xsl:choose>\r\n    </xsl:variable>\r\n    <xsl:variable name=\"class\">\r\n      <xsl:choose>\r\n        <xsl:when test=\"contains(@class,' ')\">\r\n          <xsl:value-of select=\"substring-after(@class,' ')\" />\r\n        </xsl:when>\r\n        <xsl:otherwise></xsl:otherwise>\r\n      </xsl:choose>\r\n    </xsl:variable>\r\n    <xsl:variable name=\"classid\">\r\n      <xsl:choose>\r\n        <xsl:when test=\"$type='compositemediaflash'\">clsid:D27CDB6E-AE6D-11cf-96B8-444553540000</xsl:when>\r\n        <xsl:when test=\"$type='compositemediaquicktime'\">clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B</xsl:when>\r\n        <xsl:when test=\"$type='compositemediashockwave'\">clsid:166B1BCA-3F9C-11CF-8075-444553540000</xsl:when>\r\n        <xsl:when test=\"$type='compositemediawinmedia'\">clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6</xsl:when>\r\n      </xsl:choose>\r\n    </xsl:variable>\r\n    <xsl:variable name=\"codebase\">\r\n      <xsl:choose>\r\n        <xsl:when test=\"$type='compositemediaflash'\">http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0</xsl:when>\r\n        <xsl:when test=\"$type='compositemediaquicktime'\">http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0</xsl:when>\r\n        <xsl:when test=\"$type='compositemediashockwave'\">http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0</xsl:when>\r\n        <xsl:when test=\"$type='compositemediawinmedia'\">http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701</xsl:when>\r\n      </xsl:choose>\r\n    </xsl:variable>\r\n    <xsl:variable name=\"mimetype\">\r\n      <xsl:choose>\r\n        <xsl:when test=\"$type='compositemediaflash'\">application/x-shockwave-flash</xsl:when>\r\n        <xsl:when test=\"$type='compositemediaquicktime'\">video/quicktime</xsl:when>\r\n        <xsl:when test=\"$type='compositemediashockwave'\">application/x-director</xsl:when>\r\n        <xsl:when test=\"$type='compositemediawinmedia'\">application/x-mplayer2</xsl:when>\r\n      </xsl:choose>\r\n    </xsl:variable>\r\n    <object classid=\"{$classid}\" codebase=\"{$codebase}\">\r\n      <xsl:if test=\"@id\">\r\n        <xsl:attribute name=\"id\">\r\n          <xsl:value-of select=\"@id\" />\r\n        </xsl:attribute>\r\n      </xsl:if>\r\n      <xsl:if test=\"$class!=''\">\r\n        <xsl:attribute name=\"class\">\r\n          <xsl:value-of select=\"$class\" />\r\n        </xsl:attribute>\r\n      </xsl:if>\r\n      <xsl:if test=\"@width\">\r\n        <xsl:attribute name=\"width\">\r\n          <xsl:value-of select=\"@width\" />\r\n        </xsl:attribute>\r\n      </xsl:if>\r\n      <xsl:if test=\"@height\">\r\n        <xsl:attribute name=\"height\">\r\n          <xsl:value-of select=\"@height\" />\r\n        </xsl:attribute>\r\n      </xsl:if>\r\n      <xsl:call-template name=\"objectparams\">\r\n        <xsl:with-param name=\"params\" select=\"@params\" />\r\n      </xsl:call-template>\r\n      <embed type=\"{$mimetype}\">\r\n        <xsl:if test=\"@width\">\r\n          <xsl:attribute name=\"width\">\r\n            <xsl:value-of select=\"@width\" />\r\n          </xsl:attribute>\r\n        </xsl:if>\r\n        <xsl:if test=\"@height\">\r\n          <xsl:attribute name=\"height\">\r\n            <xsl:value-of select=\"@height\" />\r\n          </xsl:attribute>\r\n        </xsl:if>\r\n        <xsl:call-template name=\"embedparams\">\r\n          <xsl:with-param name=\"params\" select=\"@params\" />\r\n        </xsl:call-template>\r\n      </embed>\r\n    </object>\r\n  </xsl:template>\r\n\r\n  <xsl:template name=\"objectparams\">\r\n    <xsl:param name=\"params\" />\r\n    <xsl:if test=\"contains($params,';')\">\r\n      <xsl:variable name=\"param\" select=\"substring-before($params,';')\" />\r\n      <xsl:variable name=\"name\" select=\"substring-before($param,'===')\" />\r\n      <xsl:variable name=\"value\" select=\"substring-after($param,'===')\" />\r\n      <param name=\"{$name}\" value=\"{$value}\" />\r\n      <xsl:call-template name=\"objectparams\">\r\n        <xsl:with-param name=\"params\" select=\"substring-after($params,';')\" />\r\n      </xsl:call-template>\r\n    </xsl:if>\r\n  </xsl:template>\r\n\r\n  <xsl:template name=\"embedparams\">\r\n    <xsl:param name=\"params\" />\r\n    <xsl:if test=\"contains($params,';')\">\r\n      <xsl:variable name=\"param\" select=\"substring-before($params,';')\" />\r\n      <xsl:variable name=\"name\" select=\"substring-before($param,'===')\" />\r\n      <xsl:variable name=\"value\" select=\"substring-after($param,'===')\" />\r\n      <xsl:attribute name=\"{$name}\">\r\n        <xsl:value-of select=\"$value\" />\r\n      </xsl:attribute>\r\n      <xsl:call-template name=\"embedparams\">\r\n        <xsl:with-param name=\"params\" select=\"substring-after($params,';')\" />\r\n      </xsl:call-template>\r\n    </xsl:if>\r\n  </xsl:template>\r\n\r\n  <!-- uncollapse hack! -->\r\n  <xsl:template name=\"uncollapse\">\r\n    <xsl:value-of select=\"./@ensureUncollapse\" />\r\n  </xsl:template>\r\n\r\n  <!-- the following templates remove garbage markup (quite agressively) -->\r\n\r\n  <!-- remove empty paragraphs (bad tiny habit) -->\r\n  <xsl:template match=\"x:body/x:p[normalize-space(.)='' and x:br[not(preceding-sibling::*) and not(following-sibling::*)]]\"/>\r\n\r\n  <!-- remove empty paragraphs (for real) -->\r\n  <xsl:template match=\"x:p[not(node())]\"/>\r\n\r\n  <!-- cleanup pages with only a single br (bad tiny habit) -->\r\n  <xsl:template match=\"x:body/x:br[not(preceding-sibling::*) and not(following-sibling::*)]\"/>\r\n\r\n  <!-- remove empty paragrahps (bad tiny habit) -->\r\n  <xsl:template match=\"x:body/x:p[text()='&#160;' and count(*)=0]\"/>\r\n\r\n  <!-- remove weird BR tags inserted into stuff (bad tiny habit) -->\r\n  <xsl:template match=\"x:*/x:br[not(following-sibling::node())]\"/>\r\n\r\n  <!-- remove bogus br -->\r\n  <xsl:template match=\"x:br[@mce_bogus='1']\"/>\r\n  \r\n  <!-- remove weird br tags inserted into li -->\r\n  <xsl:template match=\"x:br[@data-mce-bogus='1']\"/>\r\n\r\n  <!-- remove weird newline char (still stuck after removing weird BR tags) -->\r\n  <xsl:template match=\"x:p/text()\">\r\n    <xsl:variable name=\"newline\">\r\n      <xsl:text>\r\n</xsl:text>\r\n    </xsl:variable>\r\n    <xsl:value-of select=\"translate(.,$newline,'')\"/>\r\n  </xsl:template>\r\n\r\n  <!-- Correcting Crappy Chrome Code -->\r\n  <!-- remove Chrome's fetish for \"Apple-style-span\" crap. Kill the element that has this class -->\r\n  <xsl:template match=\"*[@class='Apple-style-span']\">\r\n    <xsl:apply-templates select=\"*|text()|processing-instruction()|comment()\" />\r\n  </xsl:template>\r\n\r\n  <!-- remove Chrome's fetish for putting crappy styles on images that was copy/pasted in wysiwyg -->\r\n  <xsl:template match=\"x:img/@style[starts-with(.,'outline-width:') or starts-with(.,'border-top-width:') or contains(.,' initial') ]\" />\r\n\r\n\r\n  <xsl:template match=\"x:img[@c1-preserve-tilde]/@src[not (starts-with(., '../'))]\" >\r\n    <xsl:choose>\r\n      <xsl:when test=\"starts-with(., '~')\">\r\n        <xsl:attribute name=\"src\">\r\n          <xsl:value-of select=\".\" />\r\n        </xsl:attribute>\r\n      </xsl:when>\r\n      <xsl:when test=\"starts-with(., $requestapppath)\">\r\n        <xsl:attribute name=\"src\">\r\n          <xsl:value-of select=\"concat('~', substring-after(.,$requestapppath))\"/>\r\n        </xsl:attribute>\r\n      </xsl:when>\r\n      <xsl:otherwise>\r\n        <xsl:attribute name=\"src\">\r\n          <xsl:value-of select=\".\" />\r\n        </xsl:attribute>\r\n      </xsl:otherwise>\r\n    </xsl:choose>\r\n    \r\n  </xsl:template>\r\n\r\n  <xsl:template match=\"x:img/@c1-preserve-tilde\" />\r\n\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/transformations/defaultfilters/finalizefilter.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \r\n\txmlns=\"http://www.w3.org/1999/xhtml\"\r\n\txmlns:x=\"http://www.w3.org/1999/xhtml\" \r\n\txmlns:ui=\"http://www.w3.org/1999/xhtml\" \r\n\texclude-result-prefixes=\"x\">\r\n\r\n\t<xsl:param name=\"mode\">operate</xsl:param>\r\n\t<xsl:param name=\"browser\">opera</xsl:param>\r\n\t<xsl:param name=\"platform\">amigaos</xsl:param>\r\n\t<xsl:param name=\"version\">-1</xsl:param>\r\n\t<xsl:param name=\"doctype\">False</xsl:param>\r\n\r\n\t<xsl:template match=\"/\">\r\n\t\t<xsl:if test=\"$doctype='True'\">\r\n\t\t\t<xsl:text disable-output-escaping=\"yes\">&lt;!DOCTYPE html&gt;\r\n</xsl:text>\r\n\t\t</xsl:if>\r\n\t\t<xsl:copy>\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()|comment()\" />\r\n\t\t</xsl:copy>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"@*|*|comment()\">\r\n\t\t<xsl:copy>\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()|comment()\" />\r\n\t\t</xsl:copy>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- TODO: CDATA SECTION SCRIPTS AND STYLES IN ALL TRANSFORMATIONS! -->\r\n\t<xsl:template match=\"x:textarea | x:div | x:a | x:ul | x:select | x:title | x:script | x:style | x:iframe\">\r\n\t\t<xsl:element name=\"{local-name()}\">\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()|comment()\" />\r\n      <xsl:value-of select=\"./@ForceTagNotToCollapseEvenWhenEmpty\" />\r\n\t\t</xsl:element>\r\n\t</xsl:template>\r\n\r\n  <xsl:template match=\"ui:*[starts-with(name(),'ui:')]\">\r\n\t\t<xsl:choose>\r\n\t\t\t<xsl:when test=\"$browser='explorer'\">\r\n\t\t\t\t<xsl:element name=\"{local-name()}\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"*|@*|text()|comment()\" />\r\n          <xsl:value-of select=\"./@ForceTagNotToCollapseEvenWhenEmpty\" />\r\n\t\t\t\t</xsl:element>\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:copy>\r\n\t\t\t\t\t<xsl:apply-templates select=\"*|@*|text()|comment()\" />\r\n\t\t\t\t</xsl:copy>\r\n\t\t\t</xsl:otherwise>\r\n\t\t</xsl:choose>\r\n\t</xsl:template>\r\n\t\t\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/transformations/defaultfilters/masterfilter.xsl",
    "content": "﻿<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\r\n\txmlns=\"http://www.w3.org/1999/xhtml\"\r\n\txmlns:ui=\"http://www.w3.org/1999/xhtml\"\r\n\txmlns:x=\"http://www.w3.org/1999/xhtml\">\r\n\r\n  <xsl:param name=\"mode\">operate</xsl:param>\r\n  <xsl:param name=\"browser\">opera</xsl:param>\r\n  <xsl:param name=\"platform\">amigaos</xsl:param>\r\n  <xsl:param name=\"version\">-1</xsl:param>\r\n  <xsl:param name=\"appVirtualPath\"></xsl:param>\r\n\r\n  <xsl:template match=\"/|@*|*|processing-instruction()|comment()\">\r\n    <xsl:copy>\r\n      <xsl:apply-templates select=\"*|@*|text()|processing-instruction()|comment()\" />\r\n    </xsl:copy>\r\n  </xsl:template>\r\n\r\n  <!-- pull up head content from nested documents -->\r\n  <xsl:template match=\"/x:html/x:head\">\r\n    <xsl:copy>\r\n      <xsl:apply-templates select=\"*|@*|text()|processing-instruction()|comment()\" />\r\n      <!-- pull up nested head markup -->\r\n      <xsl:apply-templates select=\"/x:html/x:body//x:head/*\" />\r\n    </xsl:copy>\r\n  </xsl:template>\r\n\r\n  <!-- suppress nested documents head elements (see above) -->\r\n  <xsl:template match=\"/x:html/x:body//x:html\">\r\n    <xsl:apply-templates select=\"x:body/node()\" />\r\n  </xsl:template>\r\n\r\n  <!-- resolve browser and platform regions -->\r\n  <xsl:template match=\"ui:region\">\r\n    <xsl:choose>\r\n      <xsl:when test=\"not(@platform)\">\r\n        <xsl:if test=\"@match=$browser\">\r\n          <xsl:apply-templates />\r\n        </xsl:if>\r\n      </xsl:when>\r\n      <xsl:when test=\"not(@match)\">\r\n        <xsl:if test=\"@platform=$platform\">\r\n          <xsl:apply-templates />\r\n        </xsl:if>\r\n      </xsl:when>\r\n      <xsl:otherwise>\r\n        <xsl:if test=\"@match=$browser and @platform=$platform\">\r\n          <xsl:apply-templates />\r\n        </xsl:if>\r\n      </xsl:otherwise>\r\n    </xsl:choose>\r\n  </xsl:template>\r\n\r\n  <!-- remove empty attributes [which is what the ASPX file is trying to say] -->\r\n  <xsl:template match=\"@*[.='']\" />\r\n\r\n  <!-- filter developermode content -->\r\n  <xsl:template match=\"*[@rel='developermode']\">\r\n    <xsl:if test=\"$mode='develop'\">\r\n      <xsl:copy>\r\n        <xsl:apply-templates select=\"*|@*|text()|processing-instruction()|comment()\" />\r\n      </xsl:copy>\r\n    </xsl:if>\r\n  </xsl:template>\r\n\r\n  <!-- cache control scripts-->\r\n  <xsl:template match=\"x:script[(not(starts-with(@src,'/')) or contains(translate(@src,'COMPSITE\\','compsite/'),'/composite/'))]/@src\">\r\n    <xsl:attribute name=\"{name()}\">\r\n      <xsl:value-of select=\".\" />\r\n      <xsl:if test=\"not(starts-with(.,'/')) or starts-with(translate(.,'COMPSITE\\','compsite/'), translate(concat($appVirtualPath, '/composite/'),'COMPSITE\\','compsite/'))\">\r\n        <xsl:if test=\"not(contains(.,'?'))\">\r\n          <xsl:text>?c1=</xsl:text>\r\n        </xsl:if>\r\n        <xsl:if test=\"contains(.,'?')\">\r\n          <xsl:text>&amp;c1=</xsl:text>\r\n        </xsl:if>\r\n        <xsl:value-of select=\"$version\" />\r\n      </xsl:if>\r\n    </xsl:attribute>\r\n  </xsl:template>\r\n\r\n\r\n  <!-- cache control stylesheets-->\r\n  <xsl:template match=\"x:link[@rel='stylesheet' and (not(starts-with(@href,'/')) or contains(translate(@href,'COMPSITE\\','compsite/'),'/composite/')) ]/@href\">\r\n    <xsl:attribute name=\"{name()}\">\r\n      <xsl:value-of select=\".\" />\r\n      <xsl:if test=\"not(starts-with(.,'/')) or starts-with(translate(.,'COMPSITE\\','compsite/'), translate(concat($appVirtualPath, '/composite/'),'COMPSITE\\','compsite/'))\">\r\n        <xsl:if test=\"not(contains(.,'.aspx')) and not(contains(.,'styles.css')) and not(contains(.,'styles.min.css'))\">\r\n          <xsl:text>.aspx</xsl:text>\r\n        </xsl:if>\r\n        <xsl:if test=\"not(contains(.,'?'))\">\r\n          <xsl:text>?c1=</xsl:text>\r\n        </xsl:if>\r\n        <xsl:if test=\"contains(.,'?')\">\r\n          <xsl:text>&amp;c1=</xsl:text>\r\n        </xsl:if>\r\n        <xsl:value-of select=\"$version\" />\r\n      </xsl:if>\r\n    </xsl:attribute>\r\n  </xsl:template>\r\n\r\n  <!-- TEMP: Nuking ASP.NET AJAX crap \r\n\t<xsl:template match=\"x:script[contains(@src,'Microsoft') or contains(@src,'WebResource')]\"/>\r\n\t<xsl:template match=\"x:script[contains(@src,'BindingForm.js')]\"/>\r\n\t<xsl:template match=\"x:script[contains(text(),'ASP.NET') or contains(text(),'Sys.')]\"/>\r\n\t<xsl:template match=\"ui:updatepanel\">\r\n\t\t<xsl:apply-templates select=\"ui:updatepanelbody/*\"/>\r\n\t</xsl:template>\r\n\t-->\r\n\r\n  <!-- generate id to optimize UpdateManager performance -->\r\n  <xsl:template match=\"ui:fields[not(@id)]|ui:fieldgroup[not(@id)]\">\r\n    <xsl:variable name=\"id\">\r\n      <xsl:choose>\r\n        <xsl:when test=\"descendant::*[@name]\">\r\n          <xsl:value-of select=\"descendant::*[@name]/@name\"/>\r\n        </xsl:when>\r\n        <xsl:when test=\"descendant::*[@callbackid]\">\r\n          <xsl:value-of select=\"descendant::*[@callbackid]/@callbackid\"/>\r\n        </xsl:when>\r\n        <xsl:otherwise>\r\n          <xsl:value-of select=\"generate-id(.)\"/>\r\n        </xsl:otherwise>\r\n      </xsl:choose>\r\n    </xsl:variable>\r\n    <xsl:element name=\"{name()}\">\r\n      <xsl:attribute name=\"id\">\r\n        <xsl:value-of select=\"local-name()\"/>\r\n        <xsl:text>_</xsl:text>\r\n        <xsl:value-of select=\"translate($id,'$','_')\"/>\r\n      </xsl:attribute>\r\n      <xsl:apply-templates select=\"*|@*|text()\"/>\r\n    </xsl:element>\r\n  </xsl:template>\r\n\r\n  <!-- generate id to optimize UpdateManager performance -->\r\n  <xsl:template match=\"ui:field[not(@id)]|ui:fielddesc[not(@id)]|ui:fielddata[not(@id)]|ui:fieldhelp[not(@id)]\">\r\n    <xsl:variable name=\"id\">\r\n      <xsl:choose>\r\n        <xsl:when test=\"ancestor-or-self::ui:field/descendant::*[@name]\">\r\n          <xsl:value-of select=\"ancestor-or-self::ui:field/descendant::*[@name]/@name\"/>\r\n        </xsl:when>\r\n        <xsl:when test=\"ancestor-or-self::ui:field/descendant::*[@callbackid]\">\r\n          <xsl:value-of select=\"ancestor-or-self::ui:field/descendant::*[@callbackid]/@callbackid\"/>\r\n        </xsl:when>\r\n        <xsl:otherwise>\r\n          <xsl:value-of select=\"generate-id(.)\"/>\r\n        </xsl:otherwise>\r\n      </xsl:choose>\r\n    </xsl:variable>\r\n    <xsl:element name=\"{name()}\">\r\n      <xsl:attribute name=\"id\">\r\n        <xsl:value-of select=\"local-name()\"/>\r\n        <xsl:text>_</xsl:text>\r\n        <xsl:value-of select=\"translate($id,'$','_')\"/>\r\n      </xsl:attribute>\r\n      <xsl:apply-templates select=\"*|@*|text()\"/>\r\n    </xsl:element>\r\n  </xsl:template>\r\n\r\n  <!-- generate id to optimize UpdateManager performance -->\r\n  <!--ui:datainput, ui:textbox, ui:editortextbox, ui:datadialog -->\r\n  <xsl:template match=\"ui:*[@name and not(@id)]\">\r\n    <xsl:element name=\"{name()}\">\r\n      <xsl:attribute name=\"id\">\r\n        <xsl:text>id_</xsl:text>\r\n        <xsl:value-of select=\"@name\"/>\r\n      </xsl:attribute>\r\n      <xsl:apply-templates select=\"*|@*|text()\"/>\r\n    </xsl:element>\r\n  </xsl:template>\r\n\r\n  <!-- disable autocomplete in all forms -->\r\n  <xsl:template match=\"x:form[not(@autocomplete)]\">\r\n    <form>\r\n      <xsl:attribute name=\"autocomplete\">off</xsl:attribute>\r\n      <xsl:apply-templates select=\"*|@*|text()\"/>\r\n    </form>\r\n  </xsl:template>\r\n\r\n  <!-- \r\n\t\tEnlarge images on toolbar with specified imagesize.\r\n\t\tThis only works for images with ${icon:xxx} syntax. \r\n\t-->\r\n  <xsl:template match=\"ui:toolbar[@imagesize]//ui:toolbarbutton/@image[contains(.,'${icon:')]|@image-hover[contains(.,'${icon:')]|@image-disabled[contains(.,'${icon:')]\">\r\n    <xsl:attribute name=\"{local-name()}\">\r\n      <xsl:call-template name=\"toolbarimagesize\">\r\n        <xsl:with-param name=\"image\" select=\".\" />\r\n      </xsl:call-template>\r\n    </xsl:attribute>\r\n  </xsl:template>\r\n\r\n  <!-- TODO: eliminate this, also from script? -->\r\n  <xsl:template name=\"toolbarimagesize\">\r\n    <xsl:param name=\"image\" />\r\n    <xsl:choose>\r\n      <xsl:when test=\"contains($image,')')\">\r\n        <xsl:value-of select=\"$image\" />\r\n      </xsl:when>\r\n      <xsl:otherwise>\r\n        <xsl:variable name=\"temp\" select=\"substring($image,1,string-length($image)-1)\" />\r\n        <xsl:value-of select=\"$temp\" />\r\n        <xsl:text>(</xsl:text>\r\n        <xsl:value-of select=\"ancestor::ui:toolbar/@imagesize\" />\r\n        <xsl:text>)}</xsl:text>\r\n      </xsl:otherwise>\r\n    </xsl:choose>\r\n  </xsl:template>\r\n\r\n  <!-- the shocking ASP.NET calendar control - lets make it usable! -->\r\n\r\n  <!-- strip crappy attributes - note we carry on td@class in the template below -->\r\n  <xsl:template match=\"x:div[@class='calendar']/table//*/@*\"/>\r\n\r\n\r\n  <!-- kill links -->\r\n  <xsl:template match=\"x:div[@class='calendar']//x:td\">\r\n    <td>\r\n      <xsl:choose>\r\n        <xsl:when test=\"x:a and not(ancestor::x:table/@class='readonly')\">\r\n          <xsl:attribute name=\"onclick\">\r\n            <xsl:value-of select=\"substring-after(x:a/@href,'javascript:')\"/>\r\n          </xsl:attribute>\r\n          <xsl:attribute name=\"class\">\r\n            active <xsl:value-of select=\"@class\"/>\r\n          </xsl:attribute>\r\n        </xsl:when>\r\n        <xsl:when test=\"x:a and ancestor::x:table/@class='readonly' and contains(@class,'selectedday')\">\r\n          <xsl:attribute name=\"class\">selectedday</xsl:attribute>\r\n        </xsl:when>\r\n      </xsl:choose>\r\n      <xsl:apply-templates select=\"*|text()\"/>\r\n    </td>\r\n  </xsl:template>\r\n\r\n  <!-- hide the handmade year back & forward links -->\r\n  <xsl:template match=\"x:div[@class='calendar']/x:a\" />\r\n  <!-- simplify nested tables structure -->\r\n  <xsl:template match=\"x:div[@class='calendar']//x:tr[position()=1]\">\r\n    <tr class=\"month\">\r\n      <td>\r\n        <xsl:if test=\"not(ancestor::x:table/@class='readonly')\">\r\n          <div class=\"monthbrowse\">\r\n            <xsl:attribute name=\"onclick\">\r\n              <xsl:value-of select=\"substring-after(//x:table/x:tr/x:td[position()=1]/x:a/@href,'javascript:')\"/>\r\n            </xsl:attribute>\r\n            <xsl:text>&#x25C0;</xsl:text>\r\n          </div>\r\n          <div class=\"monthbrowse\">\r\n            <xsl:attribute name=\"onclick\">\r\n              <xsl:value-of select=\"substring-after(../../x:a[1]/@href,'javascript:')\"/>\r\n            </xsl:attribute>\r\n            <xsl:text>&#x25C1;</xsl:text>\r\n          </div>\r\n        </xsl:if>\r\n      </td>\r\n      <td colspan=\"5\">\r\n        <xsl:value-of select=\"substring-before(//x:table/x:tr/x:td[position()=2]/text(),' ')\"/>\r\n        <br/>\r\n        <xsl:value-of select=\"substring-after(//x:table/x:tr/x:td[position()=2]/text(),' ')\"/>\r\n      </td>\r\n      <td>\r\n        <xsl:if test=\"not(ancestor::x:table/@class='readonly')\">\r\n          <div class=\"monthbrowse\">\r\n            <xsl:attribute name=\"onclick\">\r\n              <xsl:value-of select=\"substring-after(//x:table/x:tr/x:td[position()=3]/x:a/@href,'javascript:')\"/>\r\n            </xsl:attribute>\r\n            <xsl:text>&#x25B6;</xsl:text>\r\n          </div>\r\n          <div class=\"monthbrowse\">\r\n            <xsl:attribute name=\"onclick\">\r\n              <xsl:value-of select=\"substring-after(../../x:a[2]/@href,'javascript:')\"/>\r\n            </xsl:attribute>\r\n            <xsl:text>&#x25B7;</xsl:text>\r\n          </div>\r\n        </xsl:if>\r\n      </td>\r\n    </tr>\r\n  </xsl:template>\r\n\r\n  <!-- nuking the links -->\r\n  <xsl:template match=\"x:div[@class='calendar']//x:td/x:a\">\r\n    <xsl:value-of select=\"text()\"/>\r\n  </xsl:template>\r\n\r\n  <!-- \r\n\t \tnuke this crappy script that sometimes pops up - in IE only! - \r\n\t \treplacing the entire page on UpdateManager action. It may serve  \r\n\t \tsome purpose for somebody, but at this point we don't really care.\r\n \t-->\r\n  <xsl:template match=\"x:script[contains(.,'WebForm_AutoFocus')]\"/>\r\n\r\n  <!-- \r\n \t\tanother ASP thingy that may appear out of nowhere, causing the \r\n \t\tUpdateManager to replace entire page. In some browsers, the tag \r\n \t\tmay appear inside an element with an ID attribute, in which case \r\n \t\tit is harmless, but not in other browsers... the wonders of ASPX! \r\n \t\tTODO: Wrap these fields inside <div id=\"x\"> instead of nuking them?\r\n \t-->\r\n  <xsl:template match=\"x:input[@id='__LASTFOCUS']\"/>\r\n\r\n  <!-- \r\n \t\tlazybinding ID must be generated her (was done with \r\n \t\tjavasript) so that the UpdateManager can do its' work.\r\n \t -->\r\n  <xsl:template match=\"ui:lazybinding[@bindingid]\">\r\n    <ui:lazybinding>\r\n      <xsl:attribute name=\"id\">\r\n        <xsl:value-of select=\"@bindingid\"/>\r\n        <xsl:text>lazybinding</xsl:text>\r\n      </xsl:attribute>\r\n      <xsl:apply-templates select=\"@*[name()!='id']\"/>\r\n    </ui:lazybinding>\r\n  </xsl:template>\r\n\r\n  <!-- \r\n \t<setup>\r\n \t\t<radio name=\"Clean slate\" key=\"1\"/>\r\n \t\t<radio name=\"Basic Website\" key=\"2\">\r\n \t\t\t<radio name=\"Johns Website\" key=\"21\"/>\r\n \t\t</radio>\r\n \t\t<radio name=\"Demo Website\" key=\"3\">\r\n \t\t\t<radio name=\"The Daily Demosite\" key=\"31\"/>\r\n \t\t\t<radio name=\"Omnicorp Corporate Site\" key=\"32\"/>\r\n \t\t</radio>\r\n \t</setup>\r\n \t-->\r\n\r\n  <!-- wraps content in a table structure ... somewhat lamely -->\r\n  <xsl:template match=\"ui:tableframe\">\r\n    <table cellspacing=\"0\">\r\n      <xsl:apply-templates select=\"@*\"/>\r\n      <tr>\r\n        <td class=\"xnw\"></td>\r\n        <!-- prefix with \"x\" to fix CSS on nested tables -->\r\n        <td class=\"xn\"></td>\r\n        <td class=\"xne\"></td>\r\n      </tr>\r\n      <tr>\r\n        <td class=\"xw\"></td>\r\n        <td class=\"xc\">\r\n          <xsl:apply-templates/>\r\n        </td>\r\n        <td class=\"xe\"></td>\r\n      </tr>\r\n      <tr>\r\n        <td class=\"xsw\"></td>\r\n        <td class=\"xs\"></td>\r\n        <td class=\"xse\"></td>\r\n      </tr>\r\n    </table>\r\n  </xsl:template>\r\n\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/transformations/defaultfilters/structurefilter.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \r\n\txmlns=\"http://www.w3.org/1999/xhtml\"\r\n\txmlns:x=\"http://www.w3.org/1999/xhtml\"\r\n\txmlns:ui=\"http://www.w3.org/1999/xhtml\">\r\n\t\r\n\t<xsl:template match=\"/|@*|*|processing-instruction()|comment()\">\r\n\t\t<xsl:copy>\r\n\t\t\t<xsl:apply-templates select=\"*|@*|text()|processing-instruction()|comment()\" />\r\n\t\t</xsl:copy>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- \r\n\t\tIn any percieved form, there should be only one \"fields\" element \r\n\t\tenclosing the \"fieldgroup\"s. Fields element thus corresponds to the \r\n\t\tHTML \"form\" element. For some reason, the backend may choose to \r\n\t\temit one \"fields\" element for EVERY \"fieldgroup\" element. This \r\n\t\tmakes it impossible (for IE CSS) to control the vertical spacing  \r\n\t\tbetween fieldgroups. With this hack, all fieldgroups are enclosed   \r\n\t\tback into a single fields element. TODO: Fix this on the backend :)\r\n\t-->\r\n\t\r\n\t<xsl:template match=\"ui:fields[following-sibling::ui:fields]\"> \r\n\t\t<ui:fields>\r\n\t\t\t<xsl:apply-templates select=\"@*\"/>\r\n\t\t\t<xsl:apply-templates select=\"*\"/>\r\n\t\t\t<xsl:for-each select=\"following-sibling::ui:fields\">\r\n\t\t\t\t<xsl:apply-templates/>\r\n\t\t\t</xsl:for-each>\r\n\t\t</ui:fields>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"ui:fields[preceding-sibling::ui:fields]\"/>\r\n\t\r\n\t<!-- \r\n\t\tWe have the same problem with checkboxgroups: Multiple checkboxes \r\n\t\tshould be bundled together in a single group. TODO: Fix this on the backend :)\r\n\t-->\r\n\t\r\n\t<xsl:template match=\"ui:fielddata/ui:checkboxgroup[following-sibling::ui:checkboxgroup]\"> \r\n\t\t<ui:checkboxgroup>\r\n\t\t\t<xsl:apply-templates select=\"@*\"/>\r\n\t\t\t<xsl:apply-templates select=\"*\"/>\r\n\t\t\t<xsl:for-each select=\"following-sibling::ui:checkboxgroup\">\r\n\t\t\t\t<xsl:apply-templates/>\r\n\t\t\t</xsl:for-each>\r\n\t\t</ui:checkboxgroup>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"ui:fielddata/ui:checkboxgroup[preceding-sibling::ui:checkboxgroup]\"/>\r\n\t\t\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/transformations/page_profiler.xslt",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\r\n    xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" exclude-result-prefixes=\"msxsl\"\r\n>\r\n  <xsl:output method=\"html\" indent=\"no\"/>\r\n\r\n  <xsl:variable name=\"TimeMeasurementDefined\" select=\"count(descendant::Measurement[@memoryUsageKb]) &gt; 0\" />\r\n\r\n  <xsl:variable name=\"consoleUrl\" select=\"Measurements/@consoleUrl\" />\r\n\r\n  <xsl:template match=\"Measurements\">\r\n    <html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n      <head></head>\r\n      <body>\r\n\r\n        <div id=\"__C1PerformanceTrace\">\r\n          <style>\r\n              body, html {\r\n              margin: 0;\r\n              padding: 0;\r\n              }\r\n              #__C1PerformanceTrace\r\n              {\r\n              background-color: white;\r\n              color: #333;\r\n              font-family:\"Segoe UI\",Tahoma,sans-serif;\r\n              font-size: 14px;\r\n              padding: 0;\r\n              }\r\n\r\n              #__C1PerformanceTrace a {\r\n              color: #22B980;\r\n              }\r\n\r\n              #__C1PerformanceTrace .dl {\r\n              margin: 20px;\r\n              }\r\n\r\n              #__C1PerformanceTrace .info {\r\n              display: inline-block;\r\n              width: 18px;\r\n              height: 18px;\r\n              line-height: 18px;\r\n              border-radius: 50%;\r\n              text-align: center;\r\n              cursor: pointer;\r\n              background: #fcf8e3;\r\n              border: solid 1px #faebcc;\r\n              font-weight: bold;\r\n              color: #999;\r\n              position: relative;\r\n              }\r\n\r\n              #__C1PerformanceTrace .info small {\r\n              display: none;\r\n              font-weight: normal;\r\n              color: #333;\r\n              position: absolute;\r\n              left: 25px;\r\n              top: 0;\r\n              background: #F7F7F7;\r\n              border: solid 1px #ddd;\r\n              padding: 5px 15px;\r\n              text-align: left;\r\n              min-width: 400px;\r\n\r\n              }\r\n\r\n              #__C1PerformanceTrace .info:hover small {\r\n              display: block;\r\n              }\r\n\r\n              #__C1PerformanceTrace table {\r\n              font-size: 13px;\r\n              width: 100%;\r\n              margin: 0;\r\n              border-collapse: collapse;\r\n              border-spacing: 0;\r\n              table-layout: fixed;\r\n              border: 1px solid #ddd;\r\n              }\r\n\r\n              #__C1PerformanceTrace #orderedByTime,\r\n              #__C1PerformanceTrace #orderedByMemory {\r\n              display: none;\r\n              }\r\n\r\n              #__C1PerformanceTrace th, #__C1PerformanceTrace td {\r\n              overflow: hidden;\r\n              text-align: right;\r\n              white-space: nowrap;\r\n              border: 1px solid #ddd;\r\n              padding: 4px 15px;\r\n              }\r\n\r\n              #__C1PerformanceTrace tr.head th {\r\n              background: #F7F7F7;\r\n              border-bottom-width: 2px;\r\n              padding: 6px 15px;\r\n              }\r\n\r\n              #__C1PerformanceTrace tr:hover {\r\n              background-color: #f5f5f5;\r\n              }\r\n\r\n              #__C1PerformanceTrace tfoot td {\r\n              text-align: left;\r\n              font-size: 85%;\r\n              background: #F7F7F7;\r\n              border: 0;\r\n              }\r\n\r\n              #__C1PerformanceTrace tr.weak, #__C1PerformanceTrace td.weak {\r\n              color: gray;\r\n              }\r\n\r\n              #__C1PerformanceTrace span.weak {\r\n              color: gray;\r\n              }\r\n\r\n              #__C1PerformanceTrace .btn {\r\n              display: inline-block;\r\n              font-size: 14px;\r\n              cursor: pointer;\r\n              border: 1px solid #cccccc;\r\n              border-radius: 4px;\r\n              background: #fff;\r\n              padding: 3px 8px;\r\n              margin: 0 2px;\r\n\r\n              }\r\n\r\n              #__C1PerformanceTrace .btn.active {\r\n              font-weight: bold;\r\n              cursor: default;\r\n              }\r\n\r\n              .__TracePersent { text-align: right; padding-right: 5px; }\r\n              .__TraceOwn { text-align: right; padding-right: 5px; }\r\n              .__TraceTotalTime { text-align: right; padding-right: 5px;  }\r\n              #__C1PerformanceTrace td.__TraceName { text-align: left; padding-right: 50px; background-repeat: no-repeat }\r\n              .__TraceMemoryUsage { text-align: right; padding-right: 5px;  }\r\n\r\n              .__ParallelColumn {text-align: center;}\r\n\r\n              .__parallel { color: blue; }\r\n          </style>\r\n\r\n          <script language=\"javascript\" type=\"text/javascript\">\r\n            <![CDATA[ // <!--\r\n    var __c1_collapsedNodesMemory = new Array();             \r\n    var __c1_collapsedNodesTime = new Array(); \r\n    var __c1_collapsedNodesExecution = new Array();\r\n    var __c1_order = 'execution';\r\n    ]]>\r\n\r\n            <!-- Collapsing all the nodes that take less than 11% of execution time, and those which whildren has 0 time in total -->\r\n            <xsl:for-each select=\"descendant::Measurement[(@persentFromTotal &lt; 11) or (count(./Measurement[@totalTime &gt; 0]) = 0)]\">\r\n              <xsl:if test=\"count(./Measurement) > 0\">\r\n                __c1_collapsedNodesTime[__c1_collapsedNodesTime.length] = &quot;<xsl:value-of select=\"@_id\" />&quot;;\r\n              </xsl:if>\r\n            </xsl:for-each>\r\n\r\n            var consoleUrl = '<xsl:value-of select=\"$consoleUrl\"/>';\r\n            <![CDATA[\t\r\n    function getTable(order) {\r\n        if(order == 'execution') {\r\n            return document.getElementById(\"orderedByExecution\");\r\n        }\r\n        if(order == 'time') {\r\n            return document.getElementById(\"orderedByTime\");\r\n        }\r\n        return document.getElementById(\"orderedByMemory\");\r\n    }\r\n\r\n    function getCollapsedNodes(order) {\r\n        if(order == 'execution') {\r\n            return __c1_collapsedNodesExecution;\r\n        }\r\n        if(order == 'time') {\r\n            return __c1_collapsedNodesTime;\r\n        }\r\n        return __c1_collapsedNodesMemory;\r\n    }\r\n\r\n    function setCollapsedNodes(order, newArray) {\r\n        if(order == 'execution') {\r\n            __c1_collapsedNodesExecution = newArray;\r\n            return;\r\n        }\r\n        if(order == 'time') {\r\n            __c1_collapsedNodesTime = newArray;\r\n            return;\r\n        }\r\n        __c1_collapsedNodesMemory = newArray;\r\n    }\r\n    \r\n\r\n\tfunction __c1_updateTree(order) {\r\n        function StringStartsWith(a, b) {\r\n            return (a.length > b.length) && (a.substring(0, b.length) == b)\r\n        }\r\n\r\n        var table = getTable(order);\r\n\r\n        var __c1_collapsedNodes = getCollapsedNodes(order);\r\n\r\n        var rows = table.childNodes;\r\n\r\n        for (var i = 0; i < rows.length; i++) {\r\n          var row = rows[i];\r\n          var currentRowIsCollapsed = false;\r\n          var shouldBeHidden = false;\r\n\r\n            if (typeof (row.id) != \"undefined\") {\r\n                for (var j = 0; j < __c1_collapsedNodes.length; j++) {\r\n                  if(row.id == __c1_collapsedNodes[j]) {\r\n                      currentRowIsCollapsed = true;\r\n                  }\r\n                  var prefix = __c1_collapsedNodes[j] + \"|\";\r\n                  if (StringStartsWith(row.id, prefix)) {\r\n                        shouldBeHidden = true;\r\n                        break;\r\n                    }\r\n                }\r\n\r\n                // Hiding/displaying the row node\r\n                row.style.display = shouldBeHidden ? 'none' : '';\r\n        \r\n                // Rendering \"+\" or \"-\" image\r\n                if(!shouldBeHidden) {\r\n                  var image = document.getElementById(row.id + \"_\" + __c1_order + \"_image\");\r\n                  if(image != null) {\r\n                    image.src = consoleUrl + (currentRowIsCollapsed ? \"/images/icon-treenode-plus.png\" : \"/images/icon-treenode-minus.png\");\r\n                  }\r\n                }\r\n            }\r\n     }\r\n}\r\n\r\n    function __c1_OnRowClick(imageButton) {\r\n        row = imageButton.parentNode.parentNode;\r\n        \r\n        var __c1_collapsedNodes = getCollapsedNodes(__c1_order);\r\n        \r\n        for(var i=0; i< __c1_collapsedNodes.length; i++)\r\n        {\r\n            if(__c1_collapsedNodes[i] == row.id) {\r\n                var newArray = new Array();\r\n                for(var j=0; j<__c1_collapsedNodes.length - 1; j++)\r\n                {\r\n                    newArray[j] = __c1_collapsedNodes[(j < i) ? j : j + 1];\r\n                }\r\n\r\n                setCollapsedNodes(__c1_order, newArray);\r\n                __c1_updateTree(__c1_order);\r\n                return;\r\n            }\r\n        }\r\n\r\n        var nodes = getCollapsedNodes(__c1_order);\r\n        nodes[nodes.length] = row.id;\r\n\r\n        __c1_updateTree(__c1_order);\r\n        return;\r\n    }\r\n    \r\n    function __c1_OrderTable(order) {\r\n     __c1_order = order;\r\n      var tableByTime  = getTable('time');\r\n      var tableByExecution  = getTable('execution');\r\n      var tableByMemory  = getTable('memory');\r\n      \r\n      var orderByTime = document.getElementById(\"orderByTime\");\r\n      var orderByExecution = document.getElementById(\"orderByExecution\");\r\n      var orderByMemory = document.getElementById(\"orderByMemory\");\r\n  \r\n      var showExecution = __c1_order == 'execution' && orderByExecution.className.indexOf('active') < 0;\r\n      var showTime = __c1_order == 'time' && orderByTime.className.indexOf('active') < 0;\r\n      var showMemory = __c1_order == 'memory' && orderByMemory.className.indexOf('active') < 0;\r\n      \r\n      if(showExecution || showTime || showMemory) {\r\n        tableByExecution.style.display = showExecution ? 'table-row-group' : 'none';\r\n        tableByTime.style.display = showTime ? 'table-row-group' : 'none';\r\n        tableByMemory.style.display = showMemory ? 'table-row-group' : 'none';\r\n        \r\n        orderByExecution.className = showExecution ? orderByExecution.className + ' active' : orderByExecution.className.replace('active', ' ');\r\n        orderByTime.className = showTime ? orderByTime.className + ' active' : orderByTime.className.replace('active', ' ');\r\n        orderByMemory.className = showMemory ? orderByMemory.className + ' active' : orderByMemory.className.replace('active', ' ');\r\n      }\r\n  \r\n    __c1_updateTree(__c1_order);\r\n        return;\r\n    }\r\n\t  // --> ]]>\r\n          </script>\r\n\r\n   \r\n          <table id=\"__tblPerformanceTrace\">\r\n            <thead>\r\n              <tr class=\"head\">\r\n                <th style=\"width: 80px;\">Own time, ms</th>\r\n\t              <xsl:if test=\"$TimeMeasurementDefined\">\r\n\t\t              <th style=\"width: 110px;\">Memory usage, kb</th>\r\n\t              </xsl:if>\r\n\t\t\t\t  <th>\r\n                  <div style=\"float: left; padding-top: 4px;\">Function calls, ms</div>\r\n                  <div style=\"float: right; font-weight: normal;\">\r\n                    Order by: \r\n                    <a id=\"orderByExecution\" onclick=\"__c1_OrderTable('execution')\" class=\"btn active order\" >Execution Order</a>\r\n                    <a id=\"orderByTime\"      onclick=\"__c1_OrderTable('time')\"      class=\"btn order\">Time Used</a>\r\n                    <a id=\"orderByMemory\"    onclick=\"__c1_OrderTable('memory')\"    class=\"btn order\">Memory Allocated</a>\r\n                  </div>\r\n\r\n                </th>\r\n              </tr>\r\n            </thead>\r\n            <tbody id=\"orderedByExecution\">\r\n              <xsl:apply-templates select=\"Measurement\">\r\n                <xsl:with-param name=\"Level\" select=\"0\" />\r\n                <xsl:with-param name=\"OrderBy\" select=\"'execution'\" />\r\n              </xsl:apply-templates>\r\n            </tbody>\r\n            <tbody id=\"orderedByTime\">\r\n              <xsl:apply-templates select=\"Measurement\">\r\n                <xsl:with-param name=\"Level\" select=\"0\" />\r\n                <xsl:with-param name=\"OrderBy\" select=\"'time'\" />\r\n                <xsl:sort select=\"number(@totalTime)\" data-type=\"number\" order=\"descending\"/>\r\n              </xsl:apply-templates>\r\n            </tbody>\r\n            <tbody id=\"orderedByMemory\">\r\n                <xsl:apply-templates select=\"Measurement\">\r\n                    <xsl:with-param name=\"Level\" select=\"0\" />\r\n                    <xsl:with-param name=\"OrderBy\" select=\"'memory'\" />\r\n                    <xsl:sort select=\"number(@memoryUsageKb)\" data-type=\"number\" order=\"descending\"/>\r\n                </xsl:apply-templates>\r\n            </tbody>\r\n            <tfoot>\r\n              <tr>\r\n                <td colspan=\"3\">\r\n                  Own time - the time of the function's execution minus the time of the child functions' execution\r\n                </td>\r\n              </tr>\r\n              <tr>\r\n                <td colspan=\"3\">\r\n                  ms - <a href=\"http://en.wikipedia.org/wiki/Millisecond\" target=\"_blank\">millisecond</a>\r\n                </td>\r\n              </tr>\r\n            </tfoot>\r\n          </table>\r\n          <div class=\"dl\">\r\n            <div>\r\n              Allocated memory: <strong>\r\n                <xsl:value-of select=\"@MemoryUsageKb\"/>\r\n              </strong> kb. <a class=\"info\">\r\n                i <small>\r\n                  Note that memory measurement may be affected by other work happening in the AppDomain at the same time. Possible negative values are caused by garbage collections.\r\n                  Run this in an isolated environment for getting precise data.\r\n                </small>\r\n              </a>\r\n            </div>\r\n\r\n          </div>\r\n          <xsl:if test=\"count(descendant::Measurement[@parallel='true']) > 0\">\r\n            <br />\r\n            <span class=\"__parallel\">P</span> - code is executed in a parallel task\r\n          </xsl:if>\r\n\r\n        </div>\r\n\r\n      </body>\r\n    </html>\r\n  </xsl:template>\r\n\r\n  <xsl:template match=\"Measurement\">\r\n    <xsl:param name=\"Level\" />\r\n    <xsl:param name=\"OrderBy\" />\r\n    <!-- <Measurement _id=\"0|1\" title=\"Formatting output XHTML with Tidy.NET\" totalTime=\"1\" ownTime=\"1\" persentFromTotal=\"33\" parallel=\"false\" /> -->\r\n\r\n    <xsl:variable name=\"hasChildren\" select=\"count(./Measurement) > 0\" />\r\n    \r\n    <tr id=\"{@_id}\">\r\n      \r\n      \r\n      <xsl:if test=\"@totalTime &lt; 1000\">\r\n        <!-- If @totalTime less that 1 ms, the node isn't relevant, and therefore shown as weak -->\r\n        <xsl:attribute name=\"class\">weak</xsl:attribute>\r\n      </xsl:if>\r\n\r\n      <td class=\"__TraceOwn\">\r\n          <xsl:if test=\"@ownTime &lt; 1000\">\r\n              <xsl:attribute name=\"class\">weak</xsl:attribute>\r\n          </xsl:if>\r\n          \r\n        <!-- If node has parallel children, we're not showing \"ownTime\" -->\r\n\r\n        <xsl:if test=\"count(./Measurement[@parallel = 'true']) = 0\"><xsl:value-of select=\"floor(@ownTime div 1000)\" /><span class=\"weak\">.<xsl:value-of select=\"floor(@ownTime div 100) mod 10\" /></span>\r\n        </xsl:if>\r\n       \r\n      </td>\r\n\r\n        <xsl:if test=\"$TimeMeasurementDefined\">\r\n            <td class=\"__TraceMemoryUsage\">\r\n                <xsl:value-of select=\"@memoryUsageKb\"/>\r\n            </td>\r\n\r\n        </xsl:if>\r\n\r\n      <!--\r\n\t\t\t<td class=\"__ParallelColumn\">\r\n\t\t\t\t<xsl:if test=\"@parallel = 'true'\">\r\n\t\t\t\t\t<span class=\"__parallel\">*</span>&#160;\r\n\t\t\t\t</xsl:if>\r\n\t\t\t</td>-->\r\n      <td class=\"__TraceName\" style=\"padding-left:{$Level * 15 + 4}px \">\r\n        <!--xsl:if test=\"@parallel = 'true'\">\r\n\t\t\t\t\t<span class=\"__parallel\">p</span>&#160;\r\n\t\t\t\t</xsl:if-->\r\n\r\n        <xsl:choose>\r\n          <xsl:when test=\"$hasChildren\">\r\n            <input id=\"{@_id}_{$OrderBy}_image\" type=\"image\" src=\"{$consoleUrl}/images/icon-treenode-minus.png\" width=\"10\" height=\"10\" onclick=\"__c1_OnRowClick(this);\" style=\"margin-right: 2px;\"/>\r\n          </xsl:when>\r\n          <xsl:otherwise>\r\n            <span style=\"margin-left: 14px;\" />\r\n          </xsl:otherwise>\r\n        </xsl:choose>\r\n\r\n        <xsl:value-of select=\"floor(@totalTime div 1000)\" /><span class=\"weak\">.<xsl:value-of select=\"floor(@totalTime div 100) mod 10\" /></span>\r\n\r\n        (<xsl:value-of select=\"@persentFromTotal\" />%)\r\n\r\n        <xsl:choose>\r\n          <xsl:when test=\"@entityToken\">\r\n            <a target=\"_top\" href=\"{$consoleUrl}/top.aspx#FocusElement;{@entityToken}\">\r\n              <xsl:value-of select=\"@title\" />\r\n            </a>\r\n          </xsl:when>\r\n          <xsl:otherwise>\r\n            <xsl:value-of select=\"@title\" />\r\n          </xsl:otherwise>\r\n        </xsl:choose>\r\n\r\n        <!--xsl:if test=\"@parallel='true'\">\r\n\t\t\t\t\t<span class=\"__parallel\">*</span>\r\n\t\t\t\t</xsl:if -->\r\n      </td>\r\n    </tr>\r\n    <xsl:choose>\r\n      <xsl:when test=\"$OrderBy = 'time'\">\r\n        <xsl:apply-templates select=\"./Measurement\">\r\n          <xsl:with-param name=\"Level\" select=\"$Level + 1\" />\r\n          <xsl:with-param name=\"OrderBy\" select=\"'time'\" />\r\n          <xsl:sort select=\"@totalTime\" data-type=\"number\" order=\"descending\"/>\r\n        </xsl:apply-templates>\r\n      </xsl:when>\r\n        <xsl:when test=\"$OrderBy = 'memory'\">\r\n            <xsl:apply-templates select=\"./Measurement\">\r\n                <xsl:with-param name=\"Level\" select=\"$Level + 1\" />\r\n                <xsl:with-param name=\"OrderBy\" select=\"'memory'\" />\r\n                <xsl:sort select=\"@memoryUsageKb\" data-type=\"number\" order=\"descending\"/>\r\n            </xsl:apply-templates>\r\n        </xsl:when>\r\n        <xsl:otherwise>\r\n        <xsl:apply-templates select=\"./Measurement\">\r\n          <xsl:with-param name=\"Level\" select=\"$Level + 1\" />\r\n          <xsl:with-param name=\"OrderBy\" select=\"'execution'\" />\r\n        </xsl:apply-templates>\r\n      </xsl:otherwise>\r\n    </xsl:choose>\r\n  </xsl:template>\r\n\r\n</xsl:stylesheet>\r\n"
  },
  {
    "path": "Website/Composite/transformations/viewsource-xml.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\r\n\r\n\t<xsl:variable name=\"spaces\">&#160;&#160;&#160;&#160;</xsl:variable>\r\n\r\n\t<xsl:template match=\"/\">\r\n\t\t<xsl:apply-templates />\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"processing-instruction()\">\r\n\t\t<div class=\"pi\">\r\n\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<span>\r\n\t\t\t\t<xsl:text>&lt;?</xsl:text>\r\n\t\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t\t<xsl:value-of select=\".\" />\r\n\t\t\t\t<xsl:text>?&gt;</xsl:text>\r\n\t\t\t</span>\r\n\t\t</div>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"processing-instruction('xml')\">\r\n\t\t<div class=\"pi\">\r\n\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<span>\r\n\t\t\t\t<xsl:text>&lt;?</xsl:text>\r\n\t\t\t\t<xsl:text>xml</xsl:text>\r\n\t\t\t\t<xsl:for-each select=\"@*\">\r\n\t\t\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t\t\t<xsl:text>=\"</xsl:text>\r\n\t\t\t\t\t<xsl:value-of select=\".\" />\r\n\t\t\t\t\t<xsl:text>\"</xsl:text>\r\n\t\t\t\t</xsl:for-each>\r\n\t\t\t\t<xsl:text>?&gt;</xsl:text>\r\n\t\t\t</span>\r\n\t\t</div>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"@*\">\r\n\t\t<xsl:call-template name=\"space\" />\r\n\t\t<!-- Fix for FF4 -->\r\n\t\t<xsl:choose>\r\n\t\t\t<xsl:when test=\"namespace-uri(.) = ''\">\r\n\t\t\t\t<xsl:value-of select=\"local-name()\" />\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:value-of select=\"name()\" />\r\n\t\t\t</xsl:otherwise>\r\n\t\t</xsl:choose>\r\n\t\t<xsl:text>=</xsl:text>\r\n\t\t<span class=\"attval\">\r\n\t\t\t<xsl:text>\"</xsl:text>\r\n\t\t\t<xsl:call-template name=\"encodestring\">\r\n\t\t\t\t<xsl:with-param name=\"text\" select=\".\"/>\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<xsl:text>\"</xsl:text>\r\n\t\t</span>\r\n\t</xsl:template>\r\n\t \r\n\t<xsl:template match=\"text()\">\r\n\t\t<xsl:if test=\"normalize-space(.)!=''\">\r\n\t\t\t<div class=\"text\">\r\n\t\t\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t\t\t</xsl:call-template>\r\n\t\t\t\t<xsl:value-of select=\"normalize-space(.)\" />\r\n\t\t\t</div>\r\n\t\t</xsl:if>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- note that this will collapse the comment to a single line! -->\r\n\t<xsl:template match=\"comment()\">\r\n\t\t<div class=\"comment\">\r\n\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<xsl:text>&lt;!-</xsl:text>\r\n\t\t\t<xsl:text>-</xsl:text>\r\n\t\t\t<xsl:value-of select=\".\" />\r\n\t\t\t<xsl:text>-</xsl:text>\r\n\t\t\t<xsl:text>-&gt;</xsl:text>\r\n\t\t</div>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"*\">\r\n\t\t<div class=\"element\">\r\n\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<xsl:text>&lt;</xsl:text>\r\n\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t<xsl:if test=\"@*\">\r\n\t\t\t\t<span class=\"atts\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"@*\" />\r\n\t\t\t\t</span>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:call-template name=\"namespacedeclaration\">\r\n\t\t\t\t<xsl:with-param name=\"element\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<xsl:text>/&gt;</xsl:text>\r\n\t\t</div>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"*[node()]\">\r\n\t\t<div class=\"element\">\r\n\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<xsl:text>&lt;</xsl:text>\r\n\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t<xsl:if test=\"@*\">\r\n\t\t\t\t<span class=\"atts\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"@*\" />\r\n\t\t\t\t</span>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:call-template name=\"namespacedeclaration\">\r\n\t\t\t\t<xsl:with-param name=\"element\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<span class=\"m\">\r\n\t\t\t\t<xsl:text>&gt;</xsl:text>\r\n\t\t\t</span>\r\n\t\t</div>\r\n\t\t<div class=\"element\">\r\n\t\t\t<xsl:apply-templates />\r\n\t\t\t<div>\r\n\t\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t\t</xsl:call-template>\r\n\t\t\t\t<xsl:text>&lt;/</xsl:text>\r\n\t\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t\t<xsl:text>&gt;</xsl:text>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"*[text() and not (comment() or processing-instruction())]\">\r\n\t\t<div class=\"element\">\r\n\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<xsl:text>&lt;</xsl:text>\r\n\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t<xsl:if test=\"@*\">\r\n\t\t\t\t<span class=\"atts\">\r\n\t\t\t\t\t<xsl:apply-templates select=\"@*\" />\r\n\t\t\t\t</span>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:call-template name=\"namespacedeclaration\">\r\n\t\t\t\t<xsl:with-param name=\"element\" select=\".\" />\r\n\t\t\t</xsl:call-template>\r\n\t\t\t<xsl:text>&gt;</xsl:text>\r\n\t\t\t<span class=\"text\">\r\n\t\t\t\t<xsl:call-template name=\"encodestring\">\r\n\t\t\t\t\t<xsl:with-param name=\"text\" select=\".\"/>\r\n\t\t\t\t</xsl:call-template>\r\n\t\t\t\t<!-- \r\n\t\t\t\t<xsl:value-of select=\".\" />\r\n\t\t\t\t-->\r\n\t\t\t</span>\r\n\t\t\t<xsl:text>&lt;/</xsl:text>\r\n\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t<xsl:text>&gt;</xsl:text>\r\n\t\t</div>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template match=\"*[*]\">\r\n\t\t<div class=\"open\">\r\n\t\t\t<div class=\"element haschildren\">\r\n\t\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t\t</xsl:call-template>\r\n\t\t\t\t<span class=\"twisty\">&#160;</span>\r\n\t\t\t\t<xsl:text>&lt;</xsl:text>\r\n\t\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t\t<xsl:if test=\"@*\">\r\n\t\t\t\t\t<span class=\"atts\">\r\n\t\t\t\t\t\t<xsl:apply-templates select=\"@*\" />\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</xsl:if>\r\n\t\t\t\t<xsl:call-template name=\"namespacedeclaration\">\r\n\t\t\t\t\t<xsl:with-param name=\"element\" select=\".\" />\r\n\t\t\t\t</xsl:call-template>\r\n\t\t\t\t<xsl:text>&gt;</xsl:text>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"children\">\r\n\t\t\t\t<xsl:apply-templates/>\r\n\t\t\t</div>\r\n\t\t\t<div>\r\n\t\t\t\t<div class=\"element\">\r\n\t\t\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t\t\t<xsl:with-param name=\"node\" select=\".\" />\r\n\t\t\t\t\t</xsl:call-template>\r\n\t\t\t\t\t<xsl:text>&lt;/</xsl:text>\r\n\t\t\t\t\t<xsl:value-of select=\"name(.)\" />\r\n\t\t\t\t\t<xsl:text>&gt;</xsl:text>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template name=\"tab\">\r\n\t\t<xsl:param name=\"node\" />\r\n\t\t<xsl:for-each select=\"$node\">\r\n\t\t\t<xsl:if test=\"parent::*\">\r\n\t\t\t\t<xsl:value-of select=\"$spaces\" />\r\n\t\t\t\t<xsl:call-template name=\"tab\">\r\n\t\t\t\t\t<xsl:with-param name=\"node\" select=\"parent::*\" />\r\n\t\t\t\t</xsl:call-template>\r\n\t\t\t</xsl:if>\r\n\t\t</xsl:for-each>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template name=\"space\">\r\n\t\t<xsl:text>&#160;</xsl:text>\r\n\t</xsl:template>\r\n\r\n\t<xsl:template name=\"namespacedeclaration\">\r\n\t\t<xsl:param name=\"element\" />\r\n\t\t<xsl:if test=\"namespace-uri($element) != namespace-uri($element/parent::*)\">\r\n\t\t\t<span class=\"atts\">\r\n\t\t\t\t<xsl:call-template name=\"space\" />\r\n\t\t\t\t<xsl:text>xmlns</xsl:text>\r\n\t\t\t\t<xsl:if test=\"name($element) != local-name($element)\">\r\n\t\t\t\t\t<xsl:text>:</xsl:text>\r\n\t\t\t\t\t<xsl:value-of select=\"substring-before(name($element),':')\" />\r\n\t\t\t\t</xsl:if>\r\n\t\t\t\t<xsl:text>=</xsl:text>\r\n\t\t\t\t<span class=\"attval\">\r\n\t\t\t\t\t<xsl:text>\"</xsl:text>\r\n\t\t\t\t\t<xsl:value-of select=\"namespace-uri($element)\" />\r\n\t\t\t\t\t<xsl:text>\"</xsl:text>\r\n\t\t\t\t</span>\r\n\t\t\t</span>\r\n\t\t</xsl:if>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- encode attribute value, so that you may copy-paste the valid output -->\r\n\t<xsl:template name=\"encodestring\">\r\n\t\t<xsl:param name=\"text\"/>\r\n\t\t<xsl:variable name=\"temp1\" select=\"translate($text,' ','&#160;')\"/>\r\n\t\t<xsl:variable name=\"temp2\">\r\n\t\t\t<xsl:call-template name=\"string-replace\">\r\n\t\t\t\t<xsl:with-param name=\"string\" select=\"$temp1\"/>\r\n\t\t\t\t<xsl:with-param name=\"from\">&amp;</xsl:with-param>\r\n\t\t\t\t<xsl:with-param name=\"to\">&amp;amp;</xsl:with-param>\r\n\t\t\t</xsl:call-template>\r\n\t\t</xsl:variable>\r\n\t\t<xsl:variable name=\"temp3\">\r\n\t\t\t<xsl:call-template name=\"string-replace\">\r\n\t\t\t\t<xsl:with-param name=\"string\" select=\"$temp2\"/>\r\n\t\t\t\t<xsl:with-param name=\"from\">&lt;</xsl:with-param>\r\n\t\t\t\t<xsl:with-param name=\"to\">&amp;lt;</xsl:with-param>\r\n\t\t\t</xsl:call-template>\r\n\t\t</xsl:variable>\r\n\t\t<xsl:variable name=\"temp4\">\r\n\t\t\t<xsl:call-template name=\"string-replace\">\r\n\t\t\t\t<xsl:with-param name=\"string\" select=\"$temp3\"/>\r\n\t\t\t\t<xsl:with-param name=\"from\">&gt;</xsl:with-param>\r\n\t\t\t\t<xsl:with-param name=\"to\">&amp;gt;</xsl:with-param>\r\n\t\t\t</xsl:call-template>\r\n\t\t</xsl:variable>\r\n\t\t<xsl:variable name=\"temp5\">\r\n\t\t\t<xsl:call-template name=\"string-replace\">\r\n\t\t\t\t<xsl:with-param name=\"string\" select=\"$temp4\"/>\r\n\t\t\t\t<xsl:with-param name=\"from\">&quot;</xsl:with-param>\r\n\t\t\t\t<xsl:with-param name=\"to\">&amp;quot;</xsl:with-param>\r\n\t\t\t</xsl:call-template>\r\n\t\t</xsl:variable>\r\n\t\t<xsl:value-of select=\"$temp5\"/>\r\n\t</xsl:template>\r\n\t\r\n\t<!-- replace all occurences of the character(s) 'from' by the string 'to' in the string 'string' --> \r\n\t<xsl:template name=\"string-replace\" >\r\n\t\t<xsl:param name=\"string\"/>\r\n\t\t<xsl:param name=\"from\"/>\r\n\t\t<xsl:param name=\"to\"/>\r\n\t\t<xsl:choose>\r\n\t\t\t<xsl:when test=\"contains($string,$from)\">\r\n\t\t\t\t<xsl:value-of select=\"substring-before($string,$from)\"/>\r\n\t\t\t\t<xsl:value-of select=\"$to\"/>\r\n\t\t\t\t<xsl:call-template name=\"string-replace\">\r\n\t\t\t\t\t<xsl:with-param name=\"string\" select=\"substring-after($string,$from)\"/>\r\n\t\t\t\t\t<xsl:with-param name=\"from\" select=\"$from\"/>\r\n\t\t\t\t\t<xsl:with-param name=\"to\" select=\"$to\"/>\r\n\t\t\t\t</xsl:call-template>\r\n\t\t\t</xsl:when>\r\n\t\t\t<xsl:otherwise>\r\n\t\t\t\t<xsl:value-of select=\"$string\"/>\r\n\t\t\t</xsl:otherwise>\r\n\t\t</xsl:choose>\r\n\t</xsl:template>\r\n\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/Composite/unknownbrowser.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<head>\r\n    <title>Browser unknown</title>\r\n    <control:styleloader runat=\"server\" />\r\n     <% Response.WriteFile(\"favicon.inc\"); %>\r\n</head>\r\n<body>\r\n    <div class=\"splash-cover\">\r\n        <div class=\"splash-bg\"></div>\r\n        <div id=\"splash\" class=\"splash\">\r\n            <div id=\"unsupported\" class=\"splash-inner\">\r\n                <h1>Unknown browser</h1>\r\n                <p>Failed to determine browser type. It may be caused by anti-virus software that blocks \"User-Agent\" http header. When resolved <a href=\"top.aspx\">click here to retry.</a></p>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/unsecure.aspx",
    "content": "﻿<%@ Page Language=\"C#\" %>\r\n\r\n<%\r\n    Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);\r\n    string websiteWatermark = string.Format(\"ɯǝɥʇpuıqoʇsɯɔǝuo:{0}\", Composite.Core.Configuration.InstallationInformationFacade.InstallationId.GetHashCode() % 10000);\r\n    string pageUrl = Request.Url.ToString();\r\n\r\n    // jsonp'ish: if this evaluates to true our http brother is checking if we are alive, identical and well - if we are, we go https by js redirecting.\r\n    if (Request.QueryString[\"jsprobe\"] == \"true\" && pageUrl.IndexOf(\"/unsecure.aspx\") > -1 && Request.QueryString[\"watermark\"] == websiteWatermark)\r\n    {\r\n        string safeStart = pageUrl.Substring(0, pageUrl.IndexOf(\"unsecure.aspx\")) + \"default.aspx\";\r\n        Response.Write(string.Format(\"document.location='{0}'\", safeStart));\r\n        Response.End();\r\n    }\r\n%>\r\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n<head>\r\n    <title>Unsecure Connection</title>\r\n    <meta name=\"https-check-watermark\" content=\"<%= websiteWatermark %>\" id=\"watermark\" />\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"unsecure.css.aspx\" />\r\n     <% Response.WriteFile(\"favicon.inc\"); %>\r\n     <control:styleloader runat=\"server\" />\r\n    <script type=\"text/javascript\" src=\"unsecure.js\"></script>\r\n</head>\r\n<body>\r\n    <div class=\"splash-cover\">\r\n        <div class=\"splash-bg\"></div>\r\n        <div id=\"splash\" class=\"splash\">\r\n            <div class=\"splash-inner\">\r\n                <div id=\"unsecure\">\r\n                    <div id=\"head\">\r\n                        <div id=\"heading\">\r\n                            <div id=\"vignette\"></div>\r\n                            <h1>Not secure</h1>\r\n                        </div>\r\n                    </div>\r\n                    <p>\r\n                        <strong>Warning:</strong> This is not a secure connection - is the URL correct?\r\n                    <span class=\"fallback\">\r\n                        <br />\r\n                        <br />\r\n                        If you continue all content, passwords etc. will be transmitted unencrypted.\r\n                    </span>\r\n                    </p>\r\n                    <div id=\"start\" class=\"fade fallback\">\r\n                        <a id=\"continuelink\" href=\"#\" class=\"clickbutton\">Continue unsecured</a>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/unsecure.css",
    "content": "body * {\r\n    visibility: hidden;\r\n}\r\n\r\nbody.loaded * {\r\n    visibility: visible;\r\n}\r\n\r\n.fade {\r\n   opacity: 0;\r\n   transition: opacity 2s ease-in-out;\r\n   -moz-transition: opacity 2s ease-in-out;\r\n   -webkit-transition: opacity 2s ease-in-out;\r\n}\r\ndiv#start.active {\r\n   opacity: 1;\r\n}\r\n.fallback {\r\n    visibility: hidden;\r\n}\r\n.fallbackallowed .fallback {\r\n    visibility: visible;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/unsecure.js",
    "content": "﻿\r\nif (document.location.protocol.toString() == \"https:\") {\r\n    setTimeout(function () {\r\n        document.location = document.location.toString().replace(\"unsecure.aspx\", \"top.aspx\");\r\n    }, 100);\r\n} else {\r\n    if (document.location.protocol.toString() == \"http:\") {\r\n        var mySecureUrl = getMySecureUrl();\r\n        var localWatermark = document.getElementById(\"watermark\").getAttribute(\"content\");\r\n        document.write(\"<script type='text/javascript' src='\" + mySecureUrl + \"?jsprobe=true&watermark=\" + encodeURIComponent(localWatermark) + \"'></script>\");\r\n    }\r\n}\r\n\r\n\r\nwindow.onload = function () {\r\n    document.body.className += \" loaded\";\r\n\r\n    if (getParameterByName(\"fallback\") == \"true\") {\r\n        document.getElementById(\"splash\").className += \" fallbackallowed\";\r\n\r\n        setTimeout(function () {\r\n            var start = document.getElementById(\"start\");\r\n            start.className += \" active\";\r\n            start.onclick = function () {\r\n                var adminPath = document.location.pathname.replace(\"unsecure.aspx\", \"\");\r\n                document.cookie = \"avoidc1consolehttps=true; path=\" + adminPath;\r\n                var topUrl = document.location.toString().split(\"?\")[0].replace(\"unsecure.aspx\", \"top.aspx\");\r\n                document.location = topUrl;\r\n            }\r\n        }, 2500);\r\n    }\r\n}\r\n\r\n\r\nfunction getMySecureUrl() {\r\n    var location = document.location;\r\n    var customPort = getParameterByName(\"httpsport\");\r\n\r\n    var mySecureUrl = \"https://\" + location.hostname;\r\n\r\n    if (customPort.length > 0) {\r\n        mySecureUrl += \":\" + parseInt(customPort, 10);\r\n    }\r\n\r\n    mySecureUrl += location.pathname;\r\n\r\n    return mySecureUrl;\r\n}\r\n\r\n\r\nfunction getParameterByName(name) {\r\n    name = name.replace(/[\\[]/, \"\\\\\\[\").replace(/[\\]]/, \"\\\\\\]\");\r\n    var regexS = \"[\\\\?&]\" + name + \"=([^&#]*)\";\r\n    var regex = new RegExp(regexS);\r\n    var results = regex.exec(window.location.search);\r\n    if (results == null)\r\n        return \"\";\r\n    else\r\n        return decodeURIComponent(results[1].replace(/\\+/g, \" \"));\r\n}"
  },
  {
    "path": "Website/Composite/unsupported.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<head>\r\n    <title>Browser not supported</title>\r\n    <control:styleloader runat=\"server\" />\r\n    <% Response.WriteFile(\"favicon.inc\"); %>\r\n</head>\r\n<body>\r\n    <div class=\"splash-cover\">\r\n        <div class=\"splash-bg\"></div>\r\n        <div id=\"splash\" class=\"splash\">\r\n            <div id=\"unsupported\" class=\"splash-inner\">\r\n                <h1>Not supported</h1>\r\n                <p>We are terribly sorry, but your web browser is not supported.</p>\r\n                <p>Please use a recent version of Firefox, Google Chrome, Apple Safari or Microsoft Edge. Or use Internet Explorer 9, 10 or 11.</p>\r\n                <div id=\"iecompat\">\r\n                    <h2>Are you running Internet Explorer?</h2>\r\n                    <p>Make sure <a href=\"http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view\">'Compatibility View'</a> is NOT on. When turned off <a href=\"top.aspx\">try again</a>.</p>\r\n                    <p>\r\n                        <strong>Are you using IE on an intranet?</strong>\r\n                    </p>\r\n                    <p>If you are running this site from an intranet host, IE may have been forced into Compatibility Mode by default. Launch the \"Compatibility View Settings\" and uncheck the option \"Display intranet sites in Compatibility View\".</p>\r\n                </div>\r\n\r\n                <script type=\"text/javascript\">\r\n                    if (navigator.appName != \"Microsoft Internet Explorer\") {\r\n                        document.getElementById(\"iecompat\").style.display = 'none';\r\n                    } else {\r\n                        // old IE - styling will be way off and the page looks like an error, so we alleviate this a bit:\r\n                        var splachDiv = document.getElementById(\"splash\");\r\n                        splachDiv.style.width = \"80%\";\r\n                        splachDiv.style.left = \"10%\";\r\n                        splachDiv.style.top = \"10%\";\r\n                    }\r\n                </script>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/updated.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\"  xmlns:control=\"http://www.composite.net/ns/uicontrol\">\r\n\r\n<%@ Page Language=\"C#\" %>\r\n<head>\r\n    <title><%= Composite.Core.Configuration.GlobalSettingsFacade.ApplicationName %> was updated</title>\r\n     <% Response.WriteFile(\"favicon.inc\"); %>\r\n    <control:styleloader runat=\"server\" />\r\n    <script type=\"text/javascript\" src=\"updated.js\"></script>\r\n</head>\r\n<body class=\"updatedpage\">\r\n    <div class=\"splash-cover\">\r\n        <div class=\"splash-bg\"></div>\r\n        <div id=\"splash\" class=\"splash\">\r\n            <div class=\"splash-inner\">\r\n                <control:brandingSnippet runat=\"server\" SnippetName=\"logo\" />\r\n                <div id=\"updated\">\r\n                    <div id=\"head\">\r\n                        <div id=\"heading\">\r\n                            <div id=\"vignette\"></div>\r\n                            <h3><%= Composite.Core.Configuration.GlobalSettingsFacade.ApplicationName %> \r\n                                <span>was updated</span></h3>\r\n                        </div>\r\n                    </div>\r\n                    <p>\r\n                        Your <%= Composite.Core.Configuration.GlobalSettingsFacade.ApplicationName %> installation has successfully been updated. Enjoy!\r\n                    </p>\r\n                    <div id=\"start\">\r\n                        <a id=\"continuelink\" href=\"top.aspx\" class=\"clickbutton mt-40\">Continue</a>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/Composite/updated.js",
    "content": "/*\r\n * If Prism, clear the cache and load top.aspx - else display message to user.\r\n */\r\nwindow.onload = function () {\r\n\t\r\n\tvar agent = navigator.userAgent.toLowerCase ();\r\n\tvar isPrism = agent.indexOf ( \"prism\" ) >-1;\r\n\tvar url = \"top.aspx\" + document.location.search;\r\n\t\r\n\tif ( isPrism ) {\r\n\t\tvar event = document.createEvent ( \"Events\" );\r\n\t\tevent.initEvent ( \"contenttochrome-clearcache\", true, true );\r\n\t\twindow.dispatchEvent ( event );\r\n\t\tsetTimeout ( function () {\r\n\t\t\tdocument.location = url;\r\n\t\t}, 250 );\r\n\t} else {\r\n\t\tvar link = document.getElementById ( \"continuelink\" );\r\n\t\tvar splash = document.getElementById ( \"splash\" );\r\n\t\tlink.href = url;\r\n\t\tsplash.style.display = \"block\";\r\n\t\tdocument.oncontextmenu = function ( e ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n}"
  },
  {
    "path": "Website/Composite/web.config",
    "content": "﻿<?xml version=\"1.0\"?>\r\n<configuration>\r\n\r\n  <appSettings>\r\n    <add key=\"Composite.StartPage.Url\" value=\"http://c1console.composite.net/StartV5\"/>\r\n    <add key=\"Composite.Help.Contents.Url\" value=\"http://c1console.composite.net/Help.aspx\"/>\r\n    <add key=\"Composite.Help.Bookmarks.Url\" value=\"http://c1console.composite.net/Help/Bookmarks.aspx\"/>\r\n    <add key=\"Composite.Help.Search.Url\" value=\"http://c1console.composite.net/Help/Search.aspx\"/>\r\n    <add key=\"Composite.Help.Index.Url\" value=\"http://c1console.composite.net/Help/Index.aspx\"/>\r\n    <add key=\"ValidationSettings:UnobtrusiveValidationMode\" value=\"None\" />\r\n  </appSettings>\r\n\r\n  <system.webServer>\r\n    <security>\r\n      <requestFiltering>\r\n        <requestLimits maxAllowedContentLength=\"536870912\" maxUrl=\"20480\" maxQueryString=\"20480\" />\r\n      </requestFiltering>\r\n    </security>\r\n  </system.webServer>\r\n\r\n  <system.web>\r\n    <xhtmlConformance mode=\"Strict\" />\r\n    <httpRuntime executionTimeout=\"300\" maxQueryStringLength=\"51200\" maxUrlLength=\"51200\" maxRequestLength=\"524288\" requestLengthDiskThreshold=\"51200\" requestValidationMode=\"2.0\" />\r\n    <trace enabled=\"false\" traceMode=\"SortByTime\" requestLimit=\"1\" writeToDiagnosticsTrace=\"false\" pageOutput=\"false\" />\r\n    <compilation optimizeCompilations=\"true\" />\r\n    <customErrors mode=\"RemoteOnly\" />\r\n    <identity impersonate=\"false\" />\r\n\r\n    <!-- this ensures that use of Forms authentication on the public site do not break access to the admin side -->\r\n    <!-- Actual authorization is done by http module Composite.Core.WebClient.HttpModules.AdministrativeAuthorizationHttpModule -->\r\n    <authorization>\r\n      <allow users=\"*\" />\r\n    </authorization>\r\n\r\n    <webServices>\r\n      <protocols>\r\n        <remove name=\"HttpPost\" />\r\n      </protocols>\r\n    </webServices>\r\n\r\n    <!-- ASP.NET Ajax-->\r\n    <pages controlRenderingCompatibilityVersion=\"3.5\" clientIDMode=\"AutoID\" enableViewState=\"true\" viewStateEncryptionMode=\"Always\">\r\n      <controls>\r\n        <add tagPrefix=\"asp\" namespace=\"System.Web.UI\" assembly=\"System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" />\r\n        <add tagPrefix=\"asp\" namespace=\"System.Web.UI.WebControls\" assembly=\"System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" />\r\n        <add tagPrefix=\"aspui\" namespace=\"Composite.Core.WebClient.UiControlLib\" assembly=\"Composite\" />\r\n        <add tagPrefix=\"control\" tagName=\"appinitializer\" src=\"~/Composite/controls/AppInitializerControl.ascx\" />\r\n        <add tagPrefix=\"control\" tagName=\"outputtransformation\" src=\"~/Composite/controls/RegisterOutputTransformation.ascx\" />\r\n        <add tagPrefix=\"control\" tagName=\"httpheaders\" src=\"~/Composite/controls/HttpHeadersControl.ascx\" />\r\n        <add tagPrefix=\"control\" tagName=\"styleloader\" src=\"~/Composite/controls/StyleLoaderControl.ascx\" />\r\n        <add tagPrefix=\"control\" tagName=\"brandingSnippet\" src=\"~/Composite/controls/BrandingSnippet.ascx\" />\r\n        <add tagPrefix=\"control\" tagName=\"scriptloader\" src=\"~/Composite/controls/ScriptLoaderControl.ascx\" />\r\n        <add tagPrefix=\"formscontrol\" tagName=\"styleloader\" src=\"~/Composite/controls/FormsControls/Helpers/StyleFileLoaderControl.ascx\" />\r\n      </controls>\r\n    </pages>\r\n  </system.web>\r\n\r\n  <system.webServer>\r\n    <validation validateIntegratedModeConfiguration=\"false\" />\r\n    <handlers>\r\n      <add preCondition=\"integratedMode\" name=\"Composite CSS Handler\" path=\"*.css.aspx\" verb=\"*\" type=\"Composite.Core.WebClient.Presentation.CssRequestHandler,Composite\" resourceType=\"Unspecified\" />\r\n    </handlers>\r\n    <urlCompression dynamicCompressionBeforeCache=\"false\" />\r\n    <staticContent>\r\n      <remove fileExtension=\".svg\" />\r\n      <mimeMap fileExtension=\".svg\" mimeType=\"image/svg+xml\" />\r\n      <mimeMap fileExtension=\".inc\" mimeType=\"includes/file.mimetypes.inc\" />\r\n    </staticContent>\r\n  </system.webServer>\r\n\r\n  <system.serviceModel>\r\n    <services>\r\n      <service behaviorConfiguration=\"LoggerServiceBehavior\" name=\"Composite.Core.Logging.WCF.LogService\">\r\n        <endpoint address=\"\" behaviorConfiguration=\"loggerWebBehavior\" binding=\"basicHttpBinding\" contract=\"Composite.Core.Logging.WCF.ILogService\"/>\r\n      </service>\r\n    </services>\r\n    <behaviors>\r\n      <serviceBehaviors>\r\n        <behavior name=\"LoggerServiceBehavior\">\r\n          <serviceMetadata httpGetEnabled=\"true\"/>\r\n        </behavior>\r\n      </serviceBehaviors>\r\n      <endpointBehaviors>\r\n        <behavior name=\"loggerWebBehavior\">\r\n        </behavior>\r\n      </endpointBehaviors>\r\n    </behaviors>\r\n  </system.serviceModel>\r\n\r\n</configuration>\r\n"
  },
  {
    "path": "Website/Composite/webauthorization.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<authorization loginPagePath=\"Login.aspx\">\r\n\t<!--\r\n\t\tpaths shown below are publically available (require no authentication)\r\n\t\t- changes made to this file require asp.net app restart\r\n\t-->\r\n\t<allow path=\"templates\" />\r\n\t<allow path=\"flash\" />\r\n\t<allow path=\"images\" />\r\n\t<allow path=\"scripts\" />\r\n\t<allow path=\"lib\" />\r\n\t<allow path=\"styles\" />\r\n\t<allow path=\"skins\" />\r\n\t<allow path=\"content/misc/gatekeeper/AllUsersAllowedFiles\" />\r\n\t<allow path=\"content/views/start/compositestart\" />\r\n\t<allow path=\"content/dialogs/standard\" />\r\n\t<allow path=\"services/LogService\" />\r\n\t<allow path=\"services/Login/Login.asmx\" />\r\n\t<allow path=\"services/Ready/ReadyService.asmx\" />\r\n\t<allow path=\"services/Installation/InstallationService.asmx\" />\r\n\t<allow path=\"services/Setup/SetupService.asmx\" />\r\n\t<allow path=\"services/StringResource/StringService.asmx\" />\r\n\r\n\t<allow path=\"content/branding\" />\r\n\t<allow path=\"grunt.html\" />\r\n\t<allow path=\"blank.aspx\" />\r\n\t<allow path=\"compile.aspx\" />\r\n\t<allow path=\"default.aspx\" />\r\n\t<allow path=\"default.css.aspx\" />\r\n\t<allow path=\"default.css\" />\r\n\t<allow path=\"default.js\" />\r\n\t<allow path=\"develop.aspx\" />\r\n\t<allow path=\"Login.aspx\" />\r\n\t<allow path=\"ping.ashx\" />\r\n\t<allow path=\"top.aspx\" />\r\n\t<allow path=\"top.css.aspx\" />\r\n\t<allow path=\"unknownbrowser.aspx\" />\r\n\t<allow path=\"unsecure.aspx\" />\r\n\t<allow path=\"unsecure.css.aspx\" />\r\n\t<allow path=\"unsecure.js\" />\r\n\t<allow path=\"unsupported.aspx\" />\r\n\t<allow path=\"unsupported.css.aspx\" />\r\n\t<allow path=\"updated.aspx\" />\r\n\t<allow path=\"updated.js\" />\r\n\t<allow path=\"updated.css.aspx\" />\r\n\t<allow path=\"welcome.css.aspx\" />\r\n\t<allow path=\"welcome.js\" />\r\n\t<allow path=\"welcome.xsl\" />\r\n</authorization>\r\n"
  },
  {
    "path": "Website/Composite/welcome.css",
    "content": "@namespace ui url(\"http://www.w3.org/1999/xhtml\");\r\n\r\nhtml, body {\r\n    overflow: auto;\r\n    height: auto;\r\n}\r\n\r\n.welcomepage #introcover {\r\n    position: fixed;\r\n    top: 0;\r\n    right: 0;\r\n    left: 0;\r\n    bottom: 0;\r\n}\r\n\r\n.welcomepage .splash {\r\n    width: 500px;\r\n}\r\n\r\n\r\n.welcomepage .crumbs {\r\n    font-weight: bold;\r\n}\r\n\r\n    .welcomepage .crumbs em {\r\n        font-family: Arial, sans-serif;\r\n        font-size: 10px;\r\n    }\r\n\r\n   .welcomepage .intro {\r\n       min-height: 380px;\r\n   }\r\n\r\n.welcomepage ui|dialogtoolbar {\r\n    padding: 20px 0 0 0;\r\n    margin-top: 10px;\r\n\tbackground: #fff;\r\n}\r\n\r\n.welcomepage .navdecks ui|toolbargroup {\r\n    display: none;\r\n}\r\n\r\n.welcomepage .licensetext {\r\n    padding: 10px;\r\n    height: 245px;\r\n    overflow: auto;\r\n    border: 1px solid #E1E1E1;\r\n    font-size: 14px;\r\n    margin-bottom: 20px;\r\n}\r\n\r\n.welcomepage .simple-h1 {\r\n    border: 0;\r\n    padding: 0;\r\n}\r\n\r\n.welcomepage .setupfields {\r\n    max-height: 400px;\r\n    height: 45vh;\r\n    overflow: auto;\r\n    border: 1px solid #E1E1E1;\r\n    background: #F7F9FA;\r\n    font-size: 14px;\r\n    padding-right: 10px;\r\n}\r\n\r\n.loading-cover .welcomepage  .crumbs {\r\n\tdisplay: none;\r\n}\r\n\r\n.loading-cover .welcomepage .splash {\r\n\twidth: 312px;\r\n}\r\n\r\n.loading-cover .welcomepage  .intro {\r\n\tmin-height: 260px;\r\n}\r\n\r\n.loading-deck {\r\n\toverflow: visible !important;\r\n}\r\n\r\n.loading-deck .progressbar-msg {\r\n\tpadding-bottom: 35px;\r\n}\r\n\r\np#introtestsuccess,\r\nui|clickbutton#introtestsuccessbutton {\r\n    visibility: hidden;\r\n}\r\n\r\n\r\n#introtest {\r\n    list-style: none;\r\n    margin: 0 0 1em 0;\r\n    padding: 0;\r\n    line-height: 1.5em;\r\n}\r\n\r\n    #introtest li {\r\n        padding-left: 30px;\r\n        background-repeat: no-repeat;\r\n        color: #B2B2B2;\r\n    }\r\n\r\n        #introtest li.on {\r\n            color: #333;\r\n        }\r\n\r\n        #introtest li.ok {\r\n            background-image: url(\"${root}/images/welcome/accept-green.svg\");\r\n            -moz-background-position-y: -2px;\r\n            -o-background-position-y: -2px;\r\n            background-position-y: -2px;\r\n        }\r\n\r\n        #introtest li.bad {\r\n            background-image: url(\"${root}/images/welcome/cancel.svg\");\r\n        }\r\n\r\n\r\n\r\n.welcomepage ui|radio,\r\n.welcomepage ui|checkbox {\r\n    font-weight: bold !important;\r\n}\r\n\r\n    .welcomepage ui|radio ui|datalabeltext {\r\n        margin-left: 21px;\r\n    }\r\n\r\n.welcomepage ui|radiodatagroup p,\r\n.welcomepage ui|checkboxgroup p {\r\n    padding-left: 25px;\r\n    margin: 4px 0 20px 0;\r\n}\r\n\r\n.welcomepage ui|checkboxgroup {\r\n    padding-left: 2px;\r\n    margin-top: -11px;\r\n}\r\n\r\n.welcomepage ui|checkbutton {\r\n    position: relative;\r\n    left: -1px;\r\n}\r\n\r\n.welcomepage div.options {\r\n    padding-left: 25px;\r\n    display: none;\r\n}\r\n\r\n    .welcomepage div.options.visible {\r\n        display: block;\r\n    }\r\n\r\n.form .field-group {\r\n    margin-top: 10px;\r\n}\r\n\r\n    .form .field-group:after {\r\n        clear: both;\r\n        content: \" \";\r\n        display: table;\r\n    }\r\n\r\n\r\n    .form .field-group label {\r\n        float: left;\r\n        display: block;\r\n        width: 50%;\r\n    }\r\n\r\n.form .form-control {\r\n    float: left;\r\n    padding: 5px 10px;\r\n    border: solid 1px #ddd;\r\n    width: 50%;\r\n    font-size: 14px;\r\n}\r\n\r\n#languageform {\r\n\tmargin-top: 40px;\r\n}\r\n\r\np#loginok {\r\n    visibility: hidden;\r\n}\r\n"
  },
  {
    "path": "Website/Composite/welcome.inc",
    "content": "<html>\r\n\t<head>\r\n\t\t<script type=\"text/javascript\" src=\"Welcome.js\"/>\r\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"welcome.css.aspx\"/>\r\n\t</head>\r\n\t<body>\r\n\t<div class=\"welcomepage\">\r\n\t\t<ui:cover id=\"introcover\" hidden=\"true\" busy=\"false\"/>\r\n\t\t<div class=\"splash\">\r\n\t\t\t<div class=\"splash-inner\">\r\n\t\t\t\t<div id=\"intro\" class=\"intro\">\r\n\t\t\t\t\t<p id=\"crumbs\" class=\"crumbs\">\r\n\t\t\t\t\t\t<span id=\"crumbtest\" class=\"text-primary\">Welcome</span>\r\n\t\t\t\t\t\t<em>►</em>\r\n\t\t\t\t\t\t<span id=\"crumblicense\">License</span>\r\n\t\t\t\t\t\t<em>►</em>\r\n\t\t\t\t\t\t<span id=\"crumbsetup\">Setup</span>\r\n\t\t\t\t\t\t<em>►</em>\r\n\t\t\t\t\t\t<span id=\"crumblanguage\">Language</span>\r\n\t\t\t\t\t\t<em>►</em>\r\n\t\t\t\t\t\t<span id=\"crumblogin\">Login</span>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<ui:decks id=\"introdecks\" flex=\"false\">\r\n\t\t\t\t\t<ui:deck id=\"test\">\r\n\t\t\t\t\t<h1>Welcome</h1>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<p>Please wait while we test your installation.</p>\r\n\t\t\t\t\t\t<ul id=\"introtest\"/>\r\n\t\t\t\t\t\t<p id=\"introtestsuccess\">Your installation is operational.</p>\r\n\t\t\t\t\t\t<p id=\"introtestfailure\" class=\"hide\">\r\n\t\t\t\t\t\t\tYour installation has problems!<br/>\r\n\t\t\t\t\t\t\t<a href=\"#\" onclick=\"window.location.reload()\">(check again)</a>\r\n\t\t\t\t\t\t</p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t<ui:deck id=\"license\">\r\n\t\t\t\t\t\t<h1 class=\"simple-h1\">License</h1>\r\n\t\t\t\t\t\t<div id=\"licensetext\" class=\"licensetext\"/>\r\n\t\t\t\t\t\t<form id=\"licenseform\" action=\"javascript://\" method=\"get\">\r\n\t\t\t\t\t\t\t<input id=\"licenseaccept\" type=\"checkbox\" class=\"checkbox\" onclick=\"Welcome.acceptLicense(this)\"/>\r\n\t\t\t\t\t\t\t<label for=\"licenseaccept\">Accept</label>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t<ui:deck id=\"setup\">\r\n\t\t\t\t\t\t<h1 class=\"simple-h1\">Setup</h1>\r\n\t\t\t\t\t\t<div>\r\n\t\t\t\t\t\t\t<div id=\"setupfields\" class=\"setupfields\"/>\r\n\t\t\t\t\t\t\t<div id=\"setuptext\"/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t<ui:deck id=\"language\">\r\n\t\t\t\t\t<h1>Language</h1>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<!-- p id=\"consolehelp\">The \"console language\" is the language used in the administration of your website. You can change this later.</p-->\r\n\t\t\t\t\t\t<p id=\"websitehelp\">Select the default public language of your website. You can add more languages later.</p>\r\n\t\t\t\t\t\t<form id=\"languageform\" class=\"form\" action=\"javascript://\" method=\"get\">\r\n\t\t\t\t\t\t\t<!--\r\n\t\t\t\t\t\t\t<div>\r\n\t\t\t\t\t\t\t\t<label>Console language</label>\r\n\t\t\t\t\t\t\t\t<span>\r\n\t\t\t\t\t\t\t\t\t<select id=\"consolelanguage\">\r\n\t\t\t\t\t\t\t\t\t\t<option value=\"en-UK\">English UK</option>\r\n\t\t\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t\t<div class=\"field-group\">\r\n\t\t\t\t\t\t\t\t<label>Website language</label>\r\n\t\t\t\t\t\t\t\t<select id=\"websitelanguage\" class=\"form-control\" />\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t<ui:deck id=\"login\">\r\n\t\t\t\t\t\t<h1>Create Login</h1>\r\n\t\t\t\t\t\t<p id=\"loginbad\" class=\"text-error hide\">Passwords don't match!</p>\r\n\t\t\t\t\t\t<p id=\"lengthbad\" class=\"text-error hide\">Minimum 6 characters password.</p>\r\n\t\t\t\t\t\t<form id=\"loginform\" class=\"form\" action=\"javascript://\" method=\"get\">\r\n\t\t\t\t\t\t\t<div class=\"field-group\">\r\n\t\t\t\t\t\t\t\t<label>Username</label>\r\n\t\t\t\t\t\t\t\t<input id=\"username\" class=\"form-control\" type=\"text\" value=\"admin\"/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div class=\"field-group\">\r\n\t\t\t\t\t\t\t\t<label>Email</label>\r\n\t\t\t\t\t\t\t\t<input id=\"email\" class=\"form-control\" type=\"text\" value=\"\"/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div class=\"field-group\">\r\n\t\t\t\t\t\t\t\t<label>Password</label>\r\n\t\t\t\t\t\t\t\t<input id=\"password\" class=\"form-control\" type=\"password\"/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div class=\"field-group\">\r\n\t\t\t\t\t\t\t\t<label>Repeat password</label>\r\n\t\t\t\t\t\t\t\t<input id=\"passcheck\" class=\"form-control\" type=\"password\"/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div class=\"field-group\">\r\n\t\t\t\t\t\t\t\t<label>Regional settings</label>\r\n\t\t\t\t\t\t\t\t<select id=\"consolelanguage\" class=\"form-control\" />\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div class=\"field-group\">\r\n\t\t\t\t\t\t\t\t<label class=\"innerlabel\" for=\"newsletter\">Sign up for our newsletter</label> <input id=\"newsletter\" class=\"newslettercheckbox\" type=\"checkbox\" checked=\"checked\"/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</ui:deck>\r\n\t\t\t\t\t<ui:deck id=\"loading\" class=\"loading-deck\">\r\n\t\t\t\t\t\t<div class=\"brand-logo-wrapper\">\n                            <div class=\"brand-logo\"></div>\n                        </div>\r\n\t\t\t\t\t\t<div class=\"progress\">\r\n\t\t\t\t\t\t\t<p class=\"progressbar-msg\">Your starter site is being downloaded and installed. This may take a few minutes...</p>\r\n\t\t\t\t\t\t\t<div id=\"progressbar\" class=\"progressbar\">\r\n\t\t\t\t\t\t\t\t<ui:text label=\"Installing\"/>\r\n\t\t\t\t\t\t\t\t<ui:progressbar/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</ui:deck>\r\n\t\t\t\t</ui:decks>\r\n\t\t\t</div>\r\n\t\t\t<ui:decks id=\"navdecks\" class=\"navdecks\">\r\n\t\t\t<ui:deck id=\"navtest\">\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:clickbutton id=\"introtestsuccessbutton\" class=\"right-btn\" label=\"Next\" focusable=\"true\" oncommand=\"Welcome.switchTo('license')\"/>\r\n\t\t\t\t\t<ui:clickbutton id=\"introtestfailurebutton\" label=\"Read more\" focusable=\"true\" url=\"http://docs.composite.net/installationfailed?errors=\" hidden=\"true\"/>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t</ui:deck>\r\n\t\t\t<ui:deck id=\"navlicense\">\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:clickbutton label=\"Back\" class=\"left-btn\"  focusable=\"true\" oncommand=\"Welcome.switchTo('test')\"/>\r\n\t\t\t\t\t<ui:clickbutton id=\"setupbutton\" class=\"right-btn\"  label=\"Next\" focusable=\"true\" oncommand=\"Welcome.switchTo('setup')\" isdisabled=\"true\"/>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t</ui:deck>\r\n\t\t\t<ui:deck id=\"navsetup\">\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:clickbutton label=\"Back\" class=\"left-btn\" focusable=\"true\" oncommand=\"Welcome.switchTo('license')\"/>\r\n\t\t\t\t\t<ui:clickbutton label=\"Next\" class=\"right-btn\" focusable=\"true\" oncommand=\"Welcome.switchTo('language')\"/>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t</ui:deck>\r\n\t\t\t<ui:deck id=\"navlanguage\">\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:clickbutton class=\"left-btn\" label=\"Back\" focusable=\"true\" oncommand=\"Welcome.switchTo('setup')\"/>\r\n\t\t\t\t\t<ui:clickbutton class=\"right-btn\" label=\"Next\" focusable=\"true\" oncommand=\"Welcome.switchTo('login')\"/>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t</ui:deck>\r\n\t\t\t<ui:deck id=\"navlogin\">\r\n\t\t\t\t<ui:dialogtoolbar>\r\n\t\t\t\t\t<ui:clickbutton class=\"left-btn\"  label=\"Back\" focusable=\"true\" oncommand=\"Welcome.switchTo('language')\"/>\r\n\t\t\t\t\t<ui:clickbutton class=\"right-btn\" id=\"startbutton\" isdisabled=\"true\" label=\"Start CMS\" focusable=\"true\" oncommand=\"Welcome.login()\"/>\r\n\t\t\t\t</ui:dialogtoolbar>\r\n\t\t\t</ui:deck>\r\n\t\t\t</ui:decks>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/Composite/welcome.xsl",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \r\n\txmlns:setup=\"urn:Composte.C1.Setup\"\r\n\txmlns=\"http://www.w3.org/1999/xhtml\" \r\n\txmlns:ui=\"urn:HACKED\">\r\n\t\r\n\t<xsl:template match=\"setup:setup\">\r\n\t\t<div>\r\n\t\t\t<xsl:call-template name=\"groups\"/>\r\n\t\t</div>\r\n\t</xsl:template>\r\n\t \r\n\t<xsl:template name=\"groups\">\r\n\t\t<xsl:if test=\"setup:radio\">\r\n\t\t\t<ui:radiodatagroup>\r\n\t\t\t\t<xsl:apply-templates select=\"setup:radio\"/>\r\n\t\t\t</ui:radiodatagroup>\r\n\t\t</xsl:if>\r\n\t\t<xsl:if test=\"setup:check\">\r\n\t\t\t<ui:checkboxgroup>\r\n\t\t\t\t<xsl:apply-templates select=\"setup:check\"/>\r\n\t\t\t</ui:checkboxgroup>\r\n\t\t</xsl:if>\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"setup:radio\">\r\n\t\t<ui:radio value=\"{@key}\" label=\"{@label}\" oncommand=\"Welcome.update ( this )\">\r\n\t\t\t<xsl:if test=\"position()=1\">\r\n\t\t\t\t<xsl:attribute name=\"ischecked\">true</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t\t<xsl:call-template name=\"uncollapse\" />\r\n\t\t</ui:radio>\r\n\t\t<xsl:call-template name=\"continue\"/>\t\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template match=\"setup:check\">\r\n\t\t<ui:checkbox value=\"{@key}\" label=\"{@label}\" oncommand=\"Welcome.update ( this )\">\r\n\t\t\t<xsl:if test=\"@checked='true'\">\r\n\t\t\t\t<xsl:attribute name=\"ischecked\">true</xsl:attribute>\r\n\t\t\t</xsl:if>\r\n\t\t</ui:checkbox>\r\n\t\t<xsl:call-template name=\"continue\"/>\t\r\n\t</xsl:template>\r\n\t\r\n\t<xsl:template name=\"continue\">\r\n\t\t<xsl:if test=\"@desc\">\r\n\t\t\t<p><xsl:value-of select=\"@desc\"/></p>\r\n\t\t</xsl:if>\r\n\t\t<xsl:if test=\"setup:radio or setup:check\">\r\n\t\t\t<div class=\"options\" id=\"div{@key}\">\r\n\t\t\t\t<xsl:attribute name=\"class\">\r\n\t\t\t\t\t<xsl:text>options</xsl:text>\r\n\t\t\t\t\t<xsl:if test=\"position()=1\">\r\n\t\t\t\t\t\t<xsl:text> visible</xsl:text>\r\n\t\t\t\t\t</xsl:if>\r\n\t\t\t\t</xsl:attribute>\r\n\t\t\t\t<xsl:call-template name=\"groups\"/>\r\n\t\t\t</div>\r\n\t\t</xsl:if>\r\n\t</xsl:template>\r\n\r\n\t<!-- uncollapse hack -->\r\n\t<xsl:template name=\"uncollapse\">\r\n\t\t<xsl:value-of select=\"./@NONEXISTINGATTRIBUTE\" />\r\n\t</xsl:template>\r\n\t\r\n</xsl:stylesheet>"
  },
  {
    "path": "Website/DebugBuild.Web.config",
    "content": "<configuration>\n  <!-- Hey Dev! Changing or removing existing elements in this file may cause functionality in C1 CMS to break -->\n  <system.web>\n    <caching>\n      <outputCacheSettings>\n        <outputCacheProfiles>\n          <add name=\"C1Page\" duration=\"0\" varyByCustom=\"C1Page\" varyByParam=\"*\" />\n        </outputCacheProfiles>\n      </outputCacheSettings>\n    </caching>\n    <compilation debug=\"true\" optimizeCompilations=\"false\">\n      <assemblies>\n        <add assembly=\"System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\n        <add assembly=\"System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" />\n        <add assembly=\"System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A\" />\n        <add assembly=\"System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A\" />\n        <add assembly=\"System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" />\n        <add assembly=\"System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" />\n        <add assembly=\"System.Workflow.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" />\n      </assemblies>\n      <buildProviders>\n        <add extension=\".cshtml\" type=\"System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor\" />\n      </buildProviders>\n    </compilation>\n    <customErrors mode=\"Off\">\n      <error statusCode=\"404\" redirect=\"Renderers/FileNotFoundHandler.ashx\" />\n    </customErrors>\n    <globalization requestEncoding=\"utf-8\" responseEncoding=\"utf-8\" />\n    <httpHandlers>\n      <add verb=\"GET\" path=\"sitemap.xml\" type=\"Composite.AspNet.SiteMapHandler, Composite\" />\n    </httpHandlers>\n    <httpRuntime fcnMode=\"Single\" targetFramework=\"4.8\" maxRequestLength=\"20480\" relaxedUrlToFileSystemMapping=\"true\" requestPathInvalidCharacters=\"&lt;,&gt;,*,%,&amp;,\\,?\" />\n    <pages clientIDMode=\"AutoID\">\n      <controls>\n        <add tagPrefix=\"c1\" namespace=\"Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering\" assembly=\"Composite\" />\n        <add tagPrefix=\"f\" namespace=\"Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\" assembly=\"Composite\" />\n      </controls>\n    </pages>\n    <siteMap defaultProvider=\"C1CMS\">\n      <providers>\n        <add name=\"C1CMS\" type=\"Composite.AspNet.CmsPageSiteMapProvider, Composite\" />\n      </providers>\n    </siteMap>\n    <trace enabled=\"false\" traceMode=\"SortByTime\" requestLimit=\"100\" writeToDiagnosticsTrace=\"false\" pageOutput=\"true\" />\n    <trust level=\"Full\" />\n    <xhtmlConformance mode=\"Strict\" />\n  </system.web>\n  <system.webServer>\n    <handlers>\n      <add name=\"SiteMap\" verb=\"GET\" path=\"sitemap.xml\" type=\"Composite.AspNet.SiteMapHandler, Composite\" />\n      <add name=\"UrlRoutingHandler\" preCondition=\"integratedMode\" verb=\"*\" path=\"UrlRouting.axd\" type=\"System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\n      <add name=\"Wildcard ASP.NET mapping\" preCondition=\"classicMode,runtimeVersionv4.0,bitness32\" path=\"*\" verb=\"*\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll\" resourceType=\"Unspecified\" requireAccess=\"None\" />\n      <add name=\"Wildcard ASP.NET mapping (x64)\" preCondition=\"classicMode,runtimeVersionv4.0,bitness64\" path=\"*\" verb=\"*\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework64\\v4.0.30319\\aspnet_isapi.dll\" resourceType=\"Unspecified\" requireAccess=\"None\" />\n    </handlers>\n    <modules runAllManagedModulesForAllRequests=\"true\">\n      <remove name=\"UrlRoutingModule\" />\n      <add name=\"AjaxResponseHandler\" type=\"Composite.Core.WebClient.Ajax.AjaxResponseHttpModule, Composite\" />\n      <add name=\"ApplicationOfflineCheck\" type=\"Composite.Core.Application.ApplicationOfflineCheckHttpModule, Composite\" />\n      <add name=\"CompositeAdministrativeAuthorization\" type=\"Composite.Core.WebClient.HttpModules.AdministrativeAuthorizationHttpModule, Composite\" />\n      <add name=\"CompositeAdministrativeCultureSetter\" type=\"Composite.Core.WebClient.HttpModules.AdministrativeCultureSetterHttpModule, Composite\" />\n      <add name=\"CompositeAdministrativeDataScopeSetter\" type=\"Composite.Core.WebClient.HttpModules.AdministrativeDataScopeSetterHttpModule, Composite\" />\n      <add name=\"CompositeAdministrativeResponseFilter\" type=\"Composite.Core.WebClient.HttpModules.AdministrativeResponseFilterHttpModule, Composite\" />\n      <add name=\"CompositeRequestInterceptor\" type=\"Composite.Core.WebClient.Renderings.RequestInterceptorHttpModule, Composite\" />\n      <add name=\"UrlRoutingModule\" type=\"System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\n    </modules>\n    <staticContent>\n      <clientCache cacheControlMode=\"NoControl\" />\n      <remove fileExtension=\".json\" />\n      <remove fileExtension=\".scss\" />\n      <mimeMap fileExtension=\".json\" mimeType=\"application/json\" />\n      <mimeMap fileExtension=\".scss\" mimeType=\"text/css\" />\n    </staticContent>\n    <urlCompression doDynamicCompression=\"true\" doStaticCompression=\"true\" dynamicCompressionBeforeCache=\"true\" />\n    <validation validateIntegratedModeConfiguration=\"false\" />\n  </system.webServer>\n  <system.serviceModel>\n    <serviceHostingEnvironment multipleSiteBindingsEnabled=\"true\" />\n  </system.serviceModel>\n  <system.codedom>\n    <compilers>\n      <compiler language=\"c#;cs;csharp\" extension=\".cs\" type=\"Orckestra.AspNet.Roslyn.CSharpCodeProvider, Orckestra.AspNet.Roslyn\" warningLevel=\"4\" />\n    </compilers>\n  </system.codedom>\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Collections.Immutable\" culture=\"neutral\" publicKeyToken=\"b03f5f7f11d50a3a\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-1.2.1.0\" newVersion=\"1.2.1.0\" />\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n</configuration>\n"
  },
  {
    "path": "Website/Global.asax",
    "content": "<%@ Application Language=\"C#\" %>\r\n<%@ Import Namespace=\"System.Web.Routing\" %>\r\n<%@ Import Namespace=\"Composite.Core.Routing\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient\" %>\r\n\r\n<script RunAt=\"server\">\r\n\r\n\r\n    void Application_Start(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.LogRequestDetails = false;\r\n        ApplicationLevelEventHandlers.LogApplicationLevelErrors = true;\r\n\r\n        ApplicationLevelEventHandlers.Application_Start(sender, e);\r\n\r\n        RegisterRoutes(RouteTable.Routes);\r\n    }\r\n\r\n\r\n    public static void RegisterRoutes(RouteCollection routes)\r\n    {\r\n        Routes.RegisterPageRoute(routes);\r\n\r\n        // If necessary, add the standard MVC route \"{controller}/{action}/{id}\" after registering the C1 page route\r\n\r\n        Routes.Register404Route(routes);\r\n    }\r\n\r\n    void Application_End(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.Application_End(sender, e);\r\n    }\r\n\r\n    void Application_BeginRequest(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.Application_BeginRequest(sender, e);\r\n    }\r\n\r\n    void Application_EndRequest(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.Application_EndRequest(sender, e);\r\n    }\r\n\r\n    protected void Application_Error(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.Application_Error(sender, e);\r\n    }\r\n\r\n    public override string GetVaryByCustomString(HttpContext context, string custom)\r\n    {\r\n        return ApplicationLevelEventHandlers.GetVaryByCustomString(context, custom) ?? base.GetVaryByCustomString(context, custom);\r\n    }\r\n\r\n</script>\r\n\r\n"
  },
  {
    "path": "Website/ReleaseBuild.Global.asax",
    "content": "<%@ Application Language=\"C#\" %>\r\n<%@ Import Namespace=\"System.Web.Routing\" %>\r\n<%@ Import Namespace=\"Composite.Core.Application\" %>\r\n<%@ Import Namespace=\"Composite.Core.Routing\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient\" %>\r\n\r\n<script RunAt=\"server\">\r\n    void Application_Start(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.LogRequestDetails = false;\r\n        ApplicationLevelEventHandlers.LogApplicationLevelErrors = false;\r\n        \r\n        ApplicationLevelEventHandlers.Application_Start(sender, e);\r\n\r\n        RegisterRoutes(RouteTable.Routes);\r\n    }\r\n\r\n\r\n    public static void RegisterRoutes(RouteCollection routes)\r\n    {\r\n        Routes.RegisterPageRoute(routes);\r\n\r\n        // If necessary, add the standard MVC route \"{controller}/{action}/{id}\" after registering the C1 page route\r\n        \r\n        Routes.Register404Route(routes);\r\n    }\r\n\r\n    \r\n    void Application_End(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.Application_End(sender, e);\r\n    }\r\n\r\n    \r\n    void Application_BeginRequest(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.Application_BeginRequest(sender, e);\r\n    }\r\n\r\n    \r\n    void Application_EndRequest(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.Application_EndRequest(sender, e);\r\n    }\r\n\r\n    \r\n    protected void Application_Error(object sender, EventArgs e)\r\n    {\r\n        ApplicationLevelEventHandlers.Application_Error(sender, e);\r\n    }\r\n\r\n    public override string GetVaryByCustomString(HttpContext context, string custom)\r\n    {\r\n        return ApplicationLevelEventHandlers.GetVaryByCustomString(context, custom) ?? base.GetVaryByCustomString(context, custom);\r\n    }\r\n</script>\r\n\r\n"
  },
  {
    "path": "Website/ReleaseBuild.Web.config",
    "content": "<configuration>\r\n  <!-- Hey Dev! Changing or removing existing elements in this file may cause functionality in C1 CMS to break -->\r\n  <system.web>\r\n    <caching>\r\n      <outputCacheSettings>\r\n        <outputCacheProfiles>\r\n          <add name=\"C1Page\" duration=\"60\" varyByCustom=\"C1Page\" varyByParam=\"*\" />\r\n        </outputCacheProfiles>\r\n      </outputCacheSettings>\r\n    </caching>\r\n    <compilation debug=\"false\" optimizeCompilations=\"false\">\r\n      <assemblies>\r\n        <add assembly=\"System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\r\n        <add assembly=\"System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" />\r\n        <add assembly=\"System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A\" />\r\n        <add assembly=\"System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A\" />\r\n        <add assembly=\"System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" />\r\n        <add assembly=\"System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" />\r\n        <add assembly=\"System.Workflow.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" />\r\n      </assemblies>\r\n      <buildProviders>\r\n        <add extension=\".cshtml\" type=\"System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor\" />\r\n      </buildProviders>\r\n    </compilation>\r\n    <customErrors mode=\"RemoteOnly\">\r\n      <error statusCode=\"404\" redirect=\"Renderers/FileNotFoundHandler.ashx\" />\r\n    </customErrors>\r\n    <globalization requestEncoding=\"utf-8\" responseEncoding=\"utf-8\" />\r\n    <httpHandlers>\r\n      <add verb=\"GET\" path=\"sitemap.xml\" type=\"Composite.AspNet.SiteMapHandler, Composite\" />\r\n    </httpHandlers>\r\n    <httpRuntime fcnMode=\"Single\" targetFramework=\"4.8\" maxRequestLength=\"20480\" relaxedUrlToFileSystemMapping=\"true\" requestPathInvalidCharacters=\"&lt;,&gt;,*,%,&amp;,\\,?\" />\r\n    <pages clientIDMode=\"AutoID\">\r\n      <controls>\r\n        <add tagPrefix=\"c1\" namespace=\"Composite.Plugins.PageTemplates.MasterPages.Controls.Rendering\" assembly=\"Composite\" />\r\n        <add tagPrefix=\"f\" namespace=\"Composite.Plugins.PageTemplates.MasterPages.Controls.Functions\" assembly=\"Composite\" />\r\n      </controls>\r\n    </pages>\r\n    <siteMap defaultProvider=\"C1CMS\">\r\n      <providers>\r\n        <add name=\"C1CMS\" type=\"Composite.AspNet.CmsPageSiteMapProvider, Composite\" />\r\n      </providers>\r\n    </siteMap>\r\n    <trace enabled=\"false\" traceMode=\"SortByTime\" requestLimit=\"100\" writeToDiagnosticsTrace=\"false\" pageOutput=\"true\" />\r\n    <trust level=\"Full\" />\r\n    <xhtmlConformance mode=\"Strict\" />\r\n  </system.web>\r\n  <system.webServer>\r\n    <handlers>\r\n      <add name=\"SiteMap\" verb=\"GET\" path=\"sitemap.xml\" type=\"Composite.AspNet.SiteMapHandler, Composite\" />\r\n      <add name=\"UrlRoutingHandler\" preCondition=\"integratedMode\" verb=\"*\" path=\"UrlRouting.axd\" type=\"System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\r\n      <add name=\"Wildcard ASP.NET mapping\" preCondition=\"classicMode,runtimeVersionv4.0,bitness32\" path=\"*\" verb=\"*\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll\" resourceType=\"Unspecified\" requireAccess=\"None\" />\r\n      <add name=\"Wildcard ASP.NET mapping (x64)\" preCondition=\"classicMode,runtimeVersionv4.0,bitness64\" path=\"*\" verb=\"*\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework64\\v4.0.30319\\aspnet_isapi.dll\" resourceType=\"Unspecified\" requireAccess=\"None\" />\r\n    </handlers>\r\n    <modules runAllManagedModulesForAllRequests=\"true\">\r\n      <remove name=\"UrlRoutingModule\" />\r\n      <add name=\"AjaxResponseHandler\" type=\"Composite.Core.WebClient.Ajax.AjaxResponseHttpModule, Composite\" />\r\n      <add name=\"ApplicationOfflineCheck\" type=\"Composite.Core.Application.ApplicationOfflineCheckHttpModule, Composite\" />\r\n      <add name=\"CompositeAdministrativeAuthorization\" type=\"Composite.Core.WebClient.HttpModules.AdministrativeAuthorizationHttpModule, Composite\" />\r\n      <add name=\"CompositeAdministrativeCultureSetter\" type=\"Composite.Core.WebClient.HttpModules.AdministrativeCultureSetterHttpModule, Composite\" />\r\n      <add name=\"CompositeAdministrativeDataScopeSetter\" type=\"Composite.Core.WebClient.HttpModules.AdministrativeDataScopeSetterHttpModule, Composite\" />\r\n      <add name=\"CompositeAdministrativeResponseFilter\" type=\"Composite.Core.WebClient.HttpModules.AdministrativeResponseFilterHttpModule, Composite\" />\r\n      <add name=\"CompositeRequestInterceptor\" type=\"Composite.Core.WebClient.Renderings.RequestInterceptorHttpModule, Composite\" />\r\n      <add name=\"UrlRoutingModule\" type=\"System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\r\n    </modules>\r\n    <staticContent>\r\n      <clientCache cacheControlMode=\"UseMaxAge\" cacheControlMaxAge=\"30.00:00:00\" />\r\n      <remove fileExtension=\".json\" />\r\n      <remove fileExtension=\".scss\" />\r\n      <mimeMap fileExtension=\".json\" mimeType=\"application/json\" />\r\n      <mimeMap fileExtension=\".scss\" mimeType=\"text/css\" />\r\n    </staticContent>\r\n    <urlCompression doDynamicCompression=\"true\" doStaticCompression=\"true\" dynamicCompressionBeforeCache=\"true\" />\r\n    <validation validateIntegratedModeConfiguration=\"false\" />\r\n  </system.webServer>\r\n  <system.serviceModel>\r\n    <serviceHostingEnvironment multipleSiteBindingsEnabled=\"true\" />\r\n  </system.serviceModel>\r\n  <system.codedom>\r\n    <compilers>\r\n      <compiler language=\"c#;cs;csharp\" extension=\".cs\" type=\"Orckestra.AspNet.Roslyn.CSharpCodeProvider, Orckestra.AspNet.Roslyn\" warningLevel=\"4\" />\r\n    </compilers>\r\n  </system.codedom>\r\n  <runtime>\r\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\r\n      <dependentAssembly>\r\n        <assemblyIdentity name=\"System.Collections.Immutable\" culture=\"neutral\" publicKeyToken=\"b03f5f7f11d50a3a\" />\r\n        <bindingRedirect oldVersion=\"0.0.0.0-1.2.1.0\" newVersion=\"1.2.1.0\" />\r\n      </dependentAssembly>\r\n    </assemblyBinding>\r\n  </runtime>\r\n</configuration>\r\n"
  },
  {
    "path": "Website/ReleaseCleanupConfiguration.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<Configuration>\r\n\t<Target name=\"prejavascriptcompile\">\r\n\t\t<Directories>\r\n\t\t\t<Directory path=\"\\App_Code\" />\r\n\t\t\t<Directory path=\"\\App_Data\\Composite\\License\" />\r\n\t\t\t<Directory path=\"\\Spikes\" />\r\n\t\t\t<Directory path=\"\\obj\" />\r\n\t\t\t<Directory path=\"\\Tests\" />\r\n\t\t\t<Directory path=\"\\Develop\" />\r\n\t\t\t<Directory path=\"\\Bin\\da\" />\r\n\t\t\t<Directory path=\"\\Properties\" />\r\n\t\t\t<Directory path=\"\\Composite\\content\\dialogs\\querytreeeditor\" />\r\n\t\t\t<Directory path=\"\\Composite\\content\\dialogs\\tests\" />\r\n\t\t\t<Directory path=\"\\Composite\\content\\views\\dev\\developer\\tests\" />\r\n\t\t\t<Directory path=\"\\Composite\\content\\misc\\editors\\visualeditor\\tiny_mce_NEWER\" />\r\n\t\t\t<Directory path=\"\\Composite\\content\\views\\search\" />\r\n\t\t\t<Directory path=\"\\Composite\\images\\icons\\harmony\" />\r\n\t\t\t<Directory path=\"\\Composite\\images\\icons\\mimetypes\" />\r\n\t\t\t<Directory path=\"\\Composite\\images\\icons\\republic\" />\r\n\t\t\t<Directory path=\"\\Composite\\images\\originals\" />\r\n      <Directory path=\"\\Composite\\transformations\\temp\" />\r\n      <Directory path=\"\\test\" />\r\n    </Directories>\r\n\t\t<Files>\r\n\t\t\t<File path=\"\\App_Data\\Composite\\clean.bat\" />\r\n\t\t\t<File path=\"\\App_Data\\Composite\\AddOnDescriptions_RENAME.xml\" />\r\n\t\t\t<File path=\"\\App_Data\\Composite\\Composite.modified.config\" />\r\n\t\t\t<File path=\"\\App_Data\\Composite\\ReleaseBuild.Composite.config.changeHistory.txt\" />\r\n\t\t\t<File path=\"\\Renderers\\ExecuteFunction.ashx\" />\r\n\t\t\t<File path=\"\\.project\" />\r\n\t\t\t<File path=\"\\vwd.webinfo\" />\r\n\t\t\t<File path=\"\\WebSite.csproj\" />\r\n\t\t\t<File path=\"\\WebSite.csproj.user\" />\r\n\t\t\t<File path=\"\\WebSite.csproj.vspscc\" />\r\n\t\t\t<File path=\"\\Properties\\AssemblyInfo.cs\" />\r\n\t\t</Files>\r\n\t</Target>\r\n\r\n\t<Target name=\"postjavascriptcompile\">\r\n\t\t<Directories>\r\n\t\t\t<Directory path=\"\\Composite\\scripts\\source\" />\r\n\t\t\t<Directory path=\"\\Composite\\applets\" />\r\n\t\t\t<Directory path=\"\\bower_components\" />\r\n\t\t\t<Directory path=\"\\jspm_packages\" />\r\n\t\t</Directories>\r\n\t\t<Files>\r\n\t\t\t<File path=\"\\Composite\\scripts\\compressed\\sub-uncompressed.js\" />\r\n\t\t\t<File path=\"\\Composite\\scripts\\compressed\\top-uncompressed.js\" />\r\n\t\t\t<File path=\"\\.bowerrc\" />\r\n\t\t\t<File path=\"\\.eslintignore\" />\r\n\t\t\t<File path=\"\\.eslintrc.json\" />\r\n\t\t\t<File path=\"\\bower.json\" />\r\n\t\t\t<File path=\"\\gruntfile.js\" />\r\n\t\t\t<File path=\"\\package.json\" />\r\n\t\t\t<File path=\"\\jspm.config.js\" />\r\n\t\t\t<File path=\"\\ReleaseCleanupConfiguration.xml\" />\r\n\t\t</Files>\r\n\t</Target>\r\n</Configuration>\r\n"
  },
  {
    "path": "Website/Renderers/Captcha.ashx",
    "content": "<%@ WebHandler Language=\"C#\" Class=\"CaptchaImageCreator\" %>\r\n\r\nusing System;\r\nusing System.Drawing;\r\nusing System.Drawing.Imaging;\r\nusing System.Web;\r\n\r\nusing Composite.Core.WebClient.Captcha;\r\n\r\npublic class CaptchaImageCreator : IHttpHandler\r\n{\r\n\t#region private const\r\n\tprivate const string IMAGE_JPEG = \"image/jpeg\";\r\n\tprivate const string WIDTH = \"Width\";\r\n\tprivate const string HEIGHT = \"Height\";\r\n    private const string CAPTCHA_VALUE = \"value\";\r\n\tprivate const string BACKGROUND_COLOR = \"BackGroundColor\";\r\n\tprivate const string FONT_WARP = \"FontWarp\";\r\n\tprivate const string FONT_COLOR = \"FontColor\";\r\n\tprivate const string NOISE = \"Noise\";\r\n\tprivate const string NOISE_COLOR = \"NoiseColor\";\r\n\tprivate const string LINE_NOISE = \"LineNoise\";\r\n\tprivate const string LINE_NOISE_COLOR = \"LineNoiseColor\";\r\n\t#endregion\r\n\r\n\t#region private vars\r\n\tprivate ImageCreator ic;\r\n\tprivate HttpContext CurrentContext;\r\n\tprivate Color _BackgroundColor = Color.White;\r\n\tprivate FontWarpFactor _FontWarpFactor = FontWarpFactor.Low;\r\n\tprivate Color _FontColor = Color.Black;\r\n\tprivate NoiseLevel _NoiseLevel = NoiseLevel.Low;\r\n\tprivate Color _NoiseColor = Color.Black;\r\n\tprivate LineNoiseLevel _LineNoiseLevel = LineNoiseLevel.Low;\r\n\tprivate Color _LineNoiseColor = Color.Black;\r\n\t#endregion\r\n\r\n\t#region private properties\r\n\tprivate int Width\r\n\t{\r\n\t\tget\r\n\t\t{\r\n    \t\treturn int.Parse(CurrentContext.Request.Params[WIDTH] ?? \"160\");\r\n\t\t}\r\n\t}\r\n\tprivate int Height\r\n\t{\r\n\t\tget\r\n\t\t{\r\n    \t\treturn int.Parse(CurrentContext.Request.Params[HEIGHT] ?? \"40\");\r\n\t\t}\r\n\t}\r\n\r\n    private string Text\r\n    {\r\n        get\r\n        {\r\n            string encrypted = CurrentContext.Request.QueryString[CAPTCHA_VALUE];\r\n\r\n            string value;\r\n            DateTime timeStamp;\r\n\r\n            if(string.IsNullOrEmpty(encrypted)\r\n                || !Captcha.IsValid(encrypted)\r\n                || !Captcha.Decrypt(encrypted, out timeStamp, out value))\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return value;\r\n        }\r\n    }\r\n\r\n\t#endregion\r\n\r\n\tpublic void ProcessRequest (HttpContext context)\r\n\t{\r\n\t\tCurrentContext = context;\r\n\t\tic = new ImageCreator(Width, Height);\r\n\t\tReadSettings();\r\n\t\tConfigureCaptcha();\r\n\r\n\t    string text = Text;\r\n        if (!string.IsNullOrEmpty(text))\r\n        {\r\n            Bitmap image = ic.CreateImage(text);\r\n            image.Save(CurrentContext.Response.OutputStream, ImageFormat.Jpeg);\r\n            image.Dispose();\r\n            CurrentContext.Response.ContentType = IMAGE_JPEG;\r\n            CurrentContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);\r\n            CurrentContext.Response.StatusCode = 200;\r\n        }\r\n        CurrentContext.ApplicationInstance.CompleteRequest();\r\n\t}\r\n\r\n\tprivate void ReadSettings()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif (!String.IsNullOrEmpty(CurrentContext.Request.QueryString[BACKGROUND_COLOR]))\r\n\t\t\t{\r\n\t\t\t\t_BackgroundColor = ColorTranslator.FromHtml(CurrentContext.Request.QueryString[BACKGROUND_COLOR]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (Exception) {}\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif (!String.IsNullOrEmpty(CurrentContext.Request.QueryString[FONT_WARP]))\r\n\t\t\t{\r\n\t\t\t\t_FontWarpFactor = (FontWarpFactor)Enum.Parse(typeof(FontWarpFactor), CurrentContext.Request.QueryString[FONT_WARP]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (ArgumentNullException) { }\r\n\t\tcatch (ArgumentException) { }\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif (!String.IsNullOrEmpty(CurrentContext.Request.QueryString[FONT_COLOR]))\r\n\t\t\t{\r\n\t\t\t\t_FontColor = ColorTranslator.FromHtml(CurrentContext.Request.QueryString[FONT_COLOR]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (Exception) { }\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif (!String.IsNullOrEmpty(CurrentContext.Request.QueryString[NOISE]))\r\n\t\t\t{\r\n\t\t\t\t_NoiseLevel = (NoiseLevel)Enum.Parse(typeof(NoiseLevel), CurrentContext.Request.QueryString[NOISE]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (ArgumentNullException) { }\r\n\t\tcatch (ArgumentException) { }\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif (!String.IsNullOrEmpty(CurrentContext.Request.QueryString[NOISE_COLOR]))\r\n\t\t\t{\r\n\t\t\t\t_NoiseColor = ColorTranslator.FromHtml(CurrentContext.Request.QueryString[NOISE_COLOR]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (Exception) { }\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif (!String.IsNullOrEmpty(CurrentContext.Request.QueryString[LINE_NOISE]))\r\n\t\t\t{\r\n\t\t\t\t_LineNoiseLevel = (LineNoiseLevel)Enum.Parse(typeof(LineNoiseLevel), CurrentContext.Request.QueryString[LINE_NOISE]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (ArgumentNullException) { }\r\n\t\tcatch (ArgumentException) { }\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif (!String.IsNullOrEmpty(CurrentContext.Request.QueryString[LINE_NOISE_COLOR]))\r\n\t\t\t{\r\n\t\t\t\t_LineNoiseColor = ColorTranslator.FromHtml(CurrentContext.Request.QueryString[LINE_NOISE_COLOR]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (Exception) { }\r\n\t}\r\n\r\n\tprivate void ConfigureCaptcha()\r\n\t{\r\n\t\tic.BackgroundColor = _BackgroundColor;\r\n\t\tic.FontWarp = _FontWarpFactor;\r\n\t\tic.FontColor = _FontColor;\r\n\t\tic.Noise = _NoiseLevel;\r\n\t\tic.NoiseColor = _NoiseColor;\r\n\t\tic.LineNoise = _LineNoiseLevel;\r\n\t\tic.LineNoiseColor = _LineNoiseColor;\r\n\t}\r\n\r\n\tpublic bool IsReusable\r\n\t{\r\n\t\tget\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "Website/Renderers/FileNotFoundHandler.ashx",
    "content": "﻿<%@ WebHandler Language=\"C#\" Class=\"FileNotFoundHandler\" %>\r\n\r\nusing System;\r\nusing System.Web;\r\nusing Composite.Core;\r\nusing Composite.Core.Routing;\r\n\r\npublic class FileNotFoundHandler : IHttpHandler\r\n{\r\n    public void ProcessRequest(HttpContext context)\r\n    {\r\n        string path = GetRequestedPath(context);\r\n\r\n        try\r\n        {\r\n            UrlKind urlKind;\r\n\r\n            var pageUrlData = PageUrls.ParseUrl(path, out urlKind);\r\n            if (pageUrlData != null && urlKind == UrlKind.Friendly || urlKind == UrlKind.Redirect)\r\n            {\r\n                string redirectUrl = PageUrls.BuildUrl(pageUrlData, UrlKind.Public, new UrlSpace());\r\n                \r\n                if(redirectUrl != null)\r\n                {\r\n                    Log.LogVerbose(\"Friendly URL\", redirectUrl);\r\n                    context.Response.Redirect(redirectUrl, false);\r\n                    return;\r\n                }\r\n            }\r\n        }\r\n        catch\r\n        {\r\n            // Silent, muting exceptions if we cannot parse the url\r\n        }\r\n            \r\n        context.Response.StatusCode = 404;\r\n        context.Response.Write(string.Format(\"File '{0}' not found\", HttpUtility.HtmlEncode(path)));\r\n    }\r\n\r\n\r\n    private string GetRequestedPath(HttpContext context)\r\n    {\r\n        string path = context.Request.QueryString[\"aspxerrorpath\"];\r\n\r\n        if (string.IsNullOrEmpty(path) == true)\r\n        {\r\n            string rawRequestInfo = HttpUtility.UrlDecode(context.Request.QueryString.ToString());\r\n            if (string.IsNullOrEmpty(rawRequestInfo) == false && rawRequestInfo.StartsWith(\"404;\") && rawRequestInfo.Length > 4)\r\n            {\r\n                string uriFromIisAsString = rawRequestInfo.Substring(4);\r\n                Uri uriFromIis = new Uri(uriFromIisAsString);\r\n                path = uriFromIis.LocalPath;\r\n            }\r\n        }\r\n\r\n        if (string.IsNullOrEmpty(path) == true)\r\n            throw new ArgumentException(\"Missing path information - expected aspxerrorpath parameter or '404;uri' formatted query string.\");\r\n\r\n        path = path.Replace(\"\\\\\", \"/\");\r\n        \r\n\r\n        return path;\r\n    }\r\n\r\n\r\n    public bool IsReusable\r\n    {\r\n        get\r\n        {\r\n            return false;\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Renderers/FunctionPreview.ashx",
    "content": "﻿<%@ WebHandler Language=\"C#\" Class=\"Composite.Renderers.Phantom\" %>\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Renderers\r\n{\r\n    /// <summary>\r\n    /// Summary description for Phantom\r\n    /// </summary>\r\n    public class Phantom : IHttpHandler\r\n    {\r\n        public void ProcessRequest(HttpContext context)\r\n        {\r\n            if (!UserValidationFacade.IsLoggedIn())\r\n            {\r\n                context.Response.StatusCode = 401; // \"Unauthorized\"\r\n                return;\r\n            }\r\n\r\n            string pageIdStr = context.Request[\"p\"] ?? \"\";\r\n            string templateIdStr = context.Request[\"t\"] ?? \"\";\r\n            string placeholderName = context.Request[\"ph\"];\r\n            string cssSelector = context.Request[\"css\"] ?? \"\";\r\n            string cultureName = context.Request[\"lang\"];\r\n            int maxWidth = Int32.Parse(context.Request[\"width\"] ?? \"1024\");\r\n            \r\n            if (maxWidth < 256) maxWidth = 256;\r\n            if (maxWidth > 1920) maxWidth = 1920;\r\n            \r\n            string markup = UrlUtils.UnZipContent(context.Request[\"markup\"]);\r\n\r\n            var functionElement = XElement.Parse(markup);\r\n\r\n            Guid pageId;\r\n            Guid templateId;\r\n\r\n            Guid.TryParse(pageIdStr, out pageId);\r\n            Guid.TryParse(templateIdStr, out templateId);\r\n\r\n            CultureInfo culture = cultureName != null\r\n                ? new CultureInfo(cultureName)\r\n                : DataLocalizationFacade.DefaultLocalizationCulture;\r\n            \r\n            IPage page = null;\r\n\r\n            using (var c = new DataConnection(PublicationScope.Unpublished, culture))\r\n            {\r\n                if (pageId != Guid.Empty)\r\n                {\r\n                    page = c.Get<IPage>().FirstOrDefault(p => p.Id == pageId);\r\n                }\r\n                \r\n                if(page == null)\r\n                {\r\n                    if (templateId != Guid.Empty)\r\n                    {\r\n                        page = c.Get<IPage>().FirstOrDefault(p => p.TemplateId == templateId);\r\n                    }\r\n                    \r\n                    page = page ?? c.Get<IPage>().First();\r\n                }\r\n            }\r\n            \r\n            if (templateId != Guid.Empty)\r\n            {\r\n                page.TemplateId = templateId;\r\n            }\r\n            \r\n            var templateInfo = PageTemplateFacade.GetPageTemplate(page.TemplateId);\r\n            var placeholderDocument = new XhtmlDocument();\r\n\t\t\tbool isDebug = context.Request[\"debug\"] == \"1\";\r\n\r\n            placeholderDocument.Body.Add(\r\n                BuildContainerFromCssSelector(\r\n\t\t\t\tcssSelector, new XElement(Namespaces.Xhtml + \"functionpreview\",\r\n\t\t\t\t\t                      new XAttribute(\"id\", \"CompositeC1FunctionPreview\"),\r\n\t\t\t\t\t\t\t\t\t\t  new XAttribute(\"style\", string.Format(\"max-width:{0}px; display: block;\", maxWidth)),\r\n\t\t\t\t\t\t\t\t\t\t  functionElement)));\r\n\r\n            string scriptFilePath = HostingEnvironment.MapPath(\"~/App_Data/Composite/PhantomJs/preview.js\");\r\n            string scriptLines = File.ReadAllText(scriptFilePath);\r\n\r\n            // this script block will \r\n            //  - make all 'other' elements get opacity: 0;\r\n            //  - fix max-width on elements wider than the max width in effect;\r\n            //  - make elements inside a 'column-count = (n)' css block become straightened out (eliminate column flow)\r\n            //  - finalize (call phantom and set debug markers) - pausing a bit if iframe's are present            \r\n            \r\n\t\t\tplaceholderDocument.Body.AddFirst(XElement.Parse(\r\n                previewStagingJs.Replace(\"{$SCRIPT}\", scriptLines)\r\n                                .Replace(\"{$OPACITY}\", isDebug ? \"0.4\" : \"0\")\r\n                                .Replace(\"{$MAXWIDTH}\", maxWidth.ToString()))\r\n            );\r\n\t\t\t\r\n\t\t\tif (isDebug)\r\n\t\t\t{\r\n\t\t\t\tplaceholderDocument.Body.AddFirst(XElement.Parse(debugElement));\r\n\t\t\t}\r\n\t\t\t            \r\n            var contents = new List<IPagePlaceholderContent>();\r\n            var content = DataFacade.BuildNew<IPagePlaceholderContent>();\r\n            content.PageId = page.Id;\r\n            content.VersionId = page.VersionId;\r\n            content.PlaceHolderId = !string.IsNullOrEmpty(placeholderName) ? placeholderName : templateInfo.DefaultPlaceholderId;\r\n            content.Content = placeholderDocument.ToString();\r\n            contents.Add(content);\r\n\r\n            string output = PagePreviewBuilder.RenderPreview(page, contents, RenderingReason.ScreenshotGeneration);\r\n\r\n            if (output != String.Empty)\r\n            {\r\n                context.Response.ContentType = \"text/html\";\r\n                context.Response.Write(output);\r\n            }\r\n\t\t}\r\n\r\n\t\tprivate XElement BuildContainerFromCssSelector(string cssSelector, XElement innerElement)\r\n\t\t{\r\n\t\t\tXElement currentElement = null;\r\n\r\n\t\t\tforeach (var cssSelectorPart in cssSelector.Split(new[] { \" \" }, StringSplitOptions.RemoveEmptyEntries))\r\n\t\t\t{\r\n\t\t\t\tif (cssSelectorPart != \"p\")\r\n\t\t\t\t{\r\n\t\t\t\t\tstring[] parts = cssSelectorPart.Split('.');\r\n\t\t\t\t\tstring elementName = parts[0];\r\n\r\n\t\t\t\t\tvar newElement = new XElement(Namespaces.Xhtml + elementName);\r\n\t\t\t\t\tif (parts.Length > 1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tnewElement.Add(new XAttribute(\"class\", string.Join(\" \", parts.Skip(1))));\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (currentElement != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcurrentElement.Add(newElement);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcurrentElement = newElement;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (currentElement == null)\r\n\t\t\t{\r\n\t\t\t\treturn innerElement;\r\n\t\t\t}\r\n\r\n\t\t\tcurrentElement.Add(innerElement.Attributes());\r\n\t\t\tcurrentElement.Add(innerElement.Elements());\r\n\r\n\t\t\treturn currentElement.AncestorsAndSelf().Last();\r\n\t\t}\r\n\r\n        public bool IsReusable\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n\r\n\r\n\t\tconst string previewStagingJs = @\"\r\n<script xmlns='http://www.w3.org/1999/xhtml'>    //<!--\r\n    {$SCRIPT}\r\n// -->\r\n</script>\r\n\";\r\n\t\t\t\t\r\n// debug js - adding &debug=1 will show stuff\t\t\r\n\t\t\r\n\t\tconst string debugElement = @\"\r\n<div xmlns='http://www.w3.org/1999/xhtml' id='previewMarker' style='border:10px dashed pink; position: absolute; z-index:9999; opacity:0.7'></div>\r\n\";\r\n\r\n\t}\r\n\r\n}"
  },
  {
    "path": "Website/Renderers/Page.aspx",
    "content": "﻿<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"Page.aspx.cs\" Inherits=\"Renderers_Page\" %>\r\n<%@ OutputCache CacheProfile=\"C1Page\" %>"
  },
  {
    "path": "Website/Renderers/Page.aspx.cs",
    "content": "﻿using System;\r\nusing System.IO;\r\nusing System.Reflection;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.Hosting;\r\nusing System.Web.UI;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.Instrumentation;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Renderings;\r\n\r\n\r\npublic partial class Renderers_Page : System.Web.UI.Page\r\n{\r\n    private IDisposable _pageEventsPageMeasuring;\r\n\r\n    private bool _requestCompleted = false;\r\n\r\n    RenderingContext _renderingContext;\r\n\r\n    protected override void OnPreInit(EventArgs e)\r\n    {\r\n        // If there's no parameters to the request, redirecting to the application root url\r\n        if (Request.RawUrl.Equals( UrlUtils.ResolvePublicUrl(\"~/Renderers/Page.aspx\"), StringComparison.OrdinalIgnoreCase))\r\n        {\r\n            Response.Redirect(HostingEnvironment.ApplicationVirtualPath, true);\r\n            return;\r\n        }\r\n\r\n        _renderingContext = RenderingContext.InitializeFromHttpContext();\r\n\r\n        InitializeCulture();\r\n\r\n        base.OnPreInit(e);\r\n    }\r\n\r\n    protected override void OnInit(EventArgs e)\r\n    {\r\n        if (_renderingContext.RunResponseHandlers())\r\n        {\r\n            _requestCompleted = true;\r\n            return;\r\n        }\r\n\r\n        using (Profiler.Measure(\"ASP.NET controls : OnInit\"))\r\n        {\r\n            base.OnInit(e);\r\n        }\r\n\r\n        _pageEventsPageMeasuring = Profiler.Measure(\"ASP.NET controls: PageLoad, Event handling, PreRender\");\r\n    }\r\n\r\n\r\n\r\n    protected override void Render(HtmlTextWriter writer)\r\n    {\r\n        if (_requestCompleted)\r\n        {\r\n            return;\r\n        }\r\n\r\n        if (_pageEventsPageMeasuring != null)\r\n        {\r\n            _pageEventsPageMeasuring.Dispose();\r\n        }\r\n\r\n        ScriptManager scriptManager = ScriptManager.GetCurrent(this);\r\n        bool isUpdatePanelPostback = scriptManager != null && scriptManager.IsInAsyncPostBack;\r\n\r\n        if (isUpdatePanelPostback)\r\n        {\r\n            base.Render(writer);\r\n            return;\r\n        }\r\n\r\n        if (_renderingContext.PreRenderRedirectCheck())\r\n        {\r\n            return;\r\n        }\r\n\r\n        var markupBuilder = new StringBuilder();\r\n        var sw = new StringWriter(markupBuilder);\r\n        try\r\n        {\r\n            using (Profiler.Measure(\"ASP.NET controls: Render\"))\r\n            {\r\n                base.Render(new HtmlTextWriter(sw));\r\n            }\r\n        }\r\n        catch (HttpException ex)\r\n        {\r\n            CheckForMultipleAspNetFormsException(ex);\r\n            throw;\r\n        }\r\n\r\n        string xhtml = _renderingContext.ConvertInternalLinks(markupBuilder.ToString());\r\n\r\n        if (GlobalSettingsFacade.PrettifyPublicMarkup)\r\n        {\r\n            xhtml = _renderingContext.FormatXhtml(xhtml);\r\n        }\r\n\r\n        // Inserting perfomance profiling information\r\n        if (_renderingContext.ProfilingEnabled)\r\n        {\r\n            xhtml = _renderingContext.BuildProfilerReport();\r\n\r\n            Response.ContentType = \"text/xml\";\r\n        }\r\n\r\n        writer.Write(xhtml);\r\n    }\r\n\r\n\r\n    private void CheckForMultipleAspNetFormsException(HttpException ex)\r\n    {\r\n        MethodInfo setStringMethod = typeof(HttpContext).Assembly /* System.Web */\r\n                .GetType(\"System.Web.SR\")\r\n                .GetMethod(\"GetString\", BindingFlags.Public | BindingFlags.Static, null, new[] { typeof(string) }, null);\r\n\r\n        string multipleFormNotAllowedMessage = (string)setStringMethod.Invoke(null, new object[] { \"Multiple_forms_not_allowed\" });\r\n\r\n        bool multipleAspFormTagsExists = ex.Message == multipleFormNotAllowedMessage;\r\n        if (multipleAspFormTagsExists)\r\n        {\r\n            string errorMessage = (this.MasterPageFile != null)\r\n                ? \"Multiple <form runat=\\\"server\\\" /> elements exist on this page.\" +\r\n                  \"ASP.NET supports only one visible <form runat=\\\"server\\\" /> control at a time.\\n \" +\r\n                  \"To fix this, insert a <form runat=\\\"server\\\"> ... </form> tag in your master page template that spans all placeholders.\"\r\n                : \"Multiple <asp:form /> elements exist on this page. \" +\r\n                  \"ASP.NET supports only one visible <form runat=\\\"server\\\" /> control at a time.\\n \" +\r\n                  \"To fix this, insert a <asp:form> ... </asp:form> section in your template that spans all controls.\";\r\n            \r\n            throw new HttpException(errorMessage);\r\n\r\n        }\r\n    }\r\n\r\n    protected override void OnUnload(EventArgs e)\r\n    {\r\n        base.OnUnload(e);\r\n\r\n        if (_renderingContext != null)\r\n        {\r\n            _renderingContext.Dispose();\r\n        }\r\n    }\r\n\r\n\r\n    protected override void InitializeCulture()\r\n    {\r\n        if (_renderingContext != null)\r\n        {\r\n            this.Culture = this.UICulture = _renderingContext.Page.DataSourceId.LocaleScope.Name;\r\n        }\r\n\r\n        base.InitializeCulture();\r\n    }\r\n}"
  },
  {
    "path": "Website/Renderers/ShowMedia.ashx",
    "content": "<%@ WebHandler Language=\"C#\" Class=\"ShowMedia\" %>\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Web;\r\nusing System.Web.SessionState;\r\nusing Composite;\r\nusing Composite.C1Console.Security;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\nusing Composite.Core;\r\nusing Composite.Core.Configuration;\r\nusing Composite.Core.IO;\r\nusing Composite.Core.Extensions;\r\nusing Composite.Core.WebClient;\r\nusing Composite.Core.WebClient.Media;\r\nusing Composite.Core.WebClient.Renderings;\r\nusing Composite.Data.Plugins.DataProvider.Streams;\r\n\r\n\r\npublic class ShowMedia : IHttpHandler, IReadOnlySessionState\r\n{\r\n    private const int CopyBufferSize = 8192;\r\n    private static readonly string MediaUrl_PublicPrefix = UrlUtils.PublicRootPath + \"/media/\";\r\n\r\n    private static readonly string[] MediaTypesBrowserCanView = new[]\r\n    {\r\n        MimeTypeInfo.Flash,\r\n        MimeTypeInfo.Jpeg,\r\n        MimeTypeInfo.Png,\r\n        MimeTypeInfo.Gif,\r\n        MimeTypeInfo.Bmp\r\n    };\r\n\r\n    private class Range\r\n    {\r\n        public Range(long offset, long length)\r\n        {\r\n            Offset = offset;\r\n            Length = length;\r\n        }\r\n\r\n        public readonly long Offset;\r\n        public readonly long Length;\r\n    }\r\n\r\n    private class FileOrStream\r\n    {\r\n        readonly string _fileName;\r\n        readonly IMediaFile _mediaFile;\r\n\r\n        public FileOrStream(string fileName)\r\n        {\r\n            _fileName = fileName;\r\n        }\r\n\r\n        public FileOrStream(IMediaFile mediaFile)\r\n        {\r\n            _mediaFile = mediaFile;\r\n\r\n            if (mediaFile is FileSystemFileBase)\r\n            {\r\n                _fileName = ((FileSystemFileBase) _mediaFile).SystemPath;\r\n            }\r\n        }\r\n\r\n        public bool IsFile\r\n        {\r\n            get { return _fileName != null; }\r\n        }\r\n\r\n        public string GetFilePath()\r\n        {\r\n            return _fileName;\r\n        }\r\n\r\n        public Stream OpenReadStream()\r\n        {\r\n            return _mediaFile.GetReadStream();\r\n        }\r\n    }\r\n\r\n\r\n    public void ProcessRequest(HttpContext context)\r\n    {\r\n        using (GlobalInitializerFacade.CoreIsInitializedScope)\r\n        {\r\n            IMediaFile file = null;\r\n\r\n            try\r\n            {\r\n                file = MediaUrlHelper.GetFileFromQueryString(context.Request.QueryString);\r\n            }\r\n            catch (ArgumentNullException)\r\n            {\r\n                context.Response.StatusCode = 500;\r\n                context.Response.Write(\"Invalid arguments\");\r\n            }\r\n            catch (FileNotFoundException)\r\n            {\r\n                context.Response.StatusCode = 404;\r\n                context.Response.Write(\"File not found\");\r\n            }\r\n            catch (Exception)\r\n            {\r\n                if (UserValidationFacade.IsLoggedIn())\r\n                {\r\n                    throw;\r\n                }\r\n\r\n                context.Response.StatusCode = 500;\r\n            }\r\n\r\n            if (file == null)\r\n            {\r\n                return;\r\n            }\r\n\r\n            try\r\n            {\r\n                ValidateAndSend(context, file);\r\n            }\r\n            catch (Exception)\r\n            {\r\n                context.Response.ClearHeaders();\r\n                if (UserValidationFacade.IsLoggedIn())\r\n                {\r\n                    throw;\r\n                }\r\n\r\n                context.Response.StatusCode = 500;\r\n            }\r\n        }\r\n    }\r\n\r\n    private static bool ExecuteResponseHandlers(HttpContext context, IMediaFile mediaFile)\r\n    {\r\n        RenderingResponseHandlerResult responseHandling = RenderingResponseHandlerFacade.GetDataResponseHandling(mediaFile.GetDataEntityToken());\r\n\r\n        if (responseHandling != null)\r\n        {\r\n            if (responseHandling.PreventPublicCaching)\r\n            {\r\n                var hostname = context.Request.Url.Host;\r\n                var mappers = ServiceLocator.GetServices<INonCachebleRequestHostnameMapper>();\r\n                var newHostname = mappers\r\n                        .Select(m => m.GetRedirectToHostname(hostname))\r\n                        .FirstOrDefault(h => !string.IsNullOrWhiteSpace(h) && h != hostname);\r\n\r\n                if (newHostname != null)\r\n                {\r\n                    var url = new Uri(context.Request.Url, context.Request.RawUrl).ToString();\r\n                    int offset = url.IndexOf(hostname, StringComparison.OrdinalIgnoreCase);\r\n                    if (offset > 0)\r\n                    {\r\n                        var newUrl = url.Substring(0, offset) + newHostname + url.Substring(offset + hostname.Length);\r\n                        context.Response.RedirectPermanent(newUrl, false);\r\n                        return true;\r\n                    }\r\n                }\r\n\r\n                context.Response.Cache.SetCacheability(HttpCacheability.Private);\r\n            }\r\n\r\n            bool redirecting = responseHandling.RedirectRequesterTo != null;\r\n\r\n            if (redirecting)\r\n            {\r\n                context.Response.Redirect(responseHandling.RedirectRequesterTo.ToString(), false);\r\n            }\r\n\r\n            if (redirecting || responseHandling.EndRequest)\r\n            {\r\n                context.ApplicationInstance.CompleteRequest();\r\n                return true;\r\n            }\r\n        }\r\n\r\n        return false;\r\n    }\r\n\r\n    private static void AddContentDispositionHeader(HttpContext context, IMediaFile file, string sourceMediaType, string resultMediaType)\r\n    {\r\n        string encodedFileName = file.FileName.Replace(\"\\\"\", \"_\");\r\n        if (context.Request.Browser != null && context.Request.Browser.IsBrowser(\"ie\"))\r\n        {\r\n            // Unicode characters have to be url-encoded for IE\r\n            encodedFileName = HttpUtility.UrlEncode(encodedFileName).Replace(\"+\", \"%20\");\r\n        }\r\n\r\n        if (sourceMediaType != resultMediaType)\r\n        {\r\n            string originalExtension = \"\";\r\n\r\n            try\r\n            {\r\n                originalExtension = Path.GetExtension(encodedFileName);\r\n                if (originalExtension.StartsWith(\".\")) originalExtension = originalExtension.Substring(1);\r\n            }\r\n            catch {}\r\n\r\n            var resultExtension = MimeTypeInfo.GetExtensionFromMimeType(resultMediaType);\r\n\r\n            if(!string.IsNullOrEmpty(originalExtension) && !string.IsNullOrEmpty(resultExtension) && originalExtension != resultExtension\r\n                && encodedFileName.EndsWith(\".\" + originalExtension))\r\n            {\r\n                encodedFileName = encodedFileName.Substring(0, encodedFileName.Length - originalExtension.Length)\r\n                                  + resultExtension;\r\n            }\r\n        }\r\n\r\n        bool download = (string.IsNullOrEmpty(context.Request[\"download\"]) ?\r\n            !CanBePreviewedInBrowser(context, file.MimeType) :\r\n            context.Request[\"download\"] != \"false\");\r\n\r\n        context.Response.AddHeader(\"Content-Disposition\", \"{0};filename=\\\"{1}\\\"\".FormatWith((download ? \"attachment\" : \"inline\"), encodedFileName));\r\n    }\r\n\r\n    private static void ValidateAndSend(HttpContext context, IMediaFile file)\r\n    {\r\n        if (ExecuteResponseHandlers(context, file))\r\n        {\r\n            return;\r\n        }\r\n\r\n        bool checkIfModifiedSince = false;\r\n\r\n\r\n        if (UrlContainsTimestamp(context, file))\r\n        {\r\n            context.Response.Cache.SetExpires(DateTime.Now.AddDays(30));\r\n            context.Response.Cache.SetCacheability(HttpCacheability.Public);\r\n\r\n            checkIfModifiedSince = true;\r\n        }\r\n        else if (!UserValidationFacade.IsLoggedIn())\r\n        {\r\n            context.Response.Cache.SetExpires(DateTime.Now.AddMinutes(60));\r\n            context.Response.Cache.SetCacheability(HttpCacheability.Private);\r\n\r\n            checkIfModifiedSince = true;\r\n        }\r\n\r\n        Stream inputStream = null;\r\n        try\r\n        {\r\n            FileOrStream source;\r\n\r\n            string mediaType = GetMediaType(file);\r\n            string outputMediaType;\r\n\r\n            if (ImageResizer.SourceMediaTypeSupported(mediaType))\r\n            {\r\n                source = ProcessImageResizing(context, file, mediaType, out outputMediaType);\r\n            }\r\n            else\r\n            {\r\n                source = new FileOrStream(file);\r\n                outputMediaType = mediaType;\r\n            }\r\n\r\n            context.Response.ContentType = outputMediaType;\r\n\r\n            AddContentDispositionHeader(context, file, mediaType, outputMediaType);\r\n\r\n            long? length = null;\r\n            bool canSeek;\r\n\r\n            if (source.IsFile)\r\n            {\r\n                var fileInfo = new FileInfo(source.GetFilePath());\r\n                if (!fileInfo.Exists)\r\n                {\r\n                    context.Response.StatusCode = 404;\r\n                    return;\r\n                }\r\n\r\n                length = fileInfo.Length;\r\n                canSeek = true;\r\n            }\r\n            else\r\n            {\r\n                inputStream = source.OpenReadStream();\r\n\r\n                canSeek = inputStream.CanSeek;\r\n\r\n                if (canSeek && inputStream.Length != 0)\r\n                {\r\n                    length = inputStream.Length;\r\n                }\r\n                else if (file.Length.HasValue && file.Length > 0)\r\n                {\r\n                    length = file.Length;\r\n                }\r\n            }\r\n\r\n            bool canAcceptRanges = canSeek && length != null && length > 0;\r\n            if (canAcceptRanges)\r\n            {\r\n                context.Response.AddHeader(\"Accept-Ranges\", \"bytes\");\r\n            }\r\n\r\n            if (checkIfModifiedSince && file.LastWriteTime != null)\r\n            {\r\n                var lastModified = file.LastWriteTime.Value;\r\n\r\n                // Checking if @lastModified is not a future date. Note that the time isn't a UTC time\r\n                if (lastModified < DateTime.Now)\r\n                {\r\n                    context.Response.Cache.SetLastModified(lastModified);\r\n                }\r\n\r\n                DateTime? ifModifiedSince = ParseDateTimeHeader(context, \"If-Modified-Since\");\r\n                if (ifModifiedSince != null && ifModifiedSince.Value.AddSeconds(2.0) >= lastModified)\r\n                {\r\n                    context.Response.StatusCode = 304; // Not modified\r\n                    return;\r\n                }\r\n\r\n                DateTime? ifUnmodifiedSince = ParseDateTimeHeader(context, \"If-Unmodified-Since\");\r\n                if (ifUnmodifiedSince != null && ifUnmodifiedSince.Value.AddSeconds(2.0) < lastModified)\r\n                {\r\n                    context.Response.StatusCode = 412; // Precondition failed\r\n                    return;\r\n                }\r\n            }\r\n\r\n\r\n            string rangeStr = context.Request.Headers[\"Range\"];\r\n            List<Range> rangeSegments = null;\r\n\r\n            if (canAcceptRanges && !rangeStr.IsNullOrEmpty())\r\n            {\r\n                rangeSegments = ParseRanges(rangeStr, length.Value);\r\n            }\r\n            // Support only one range. Multi-range requires multipart/data response\r\n            if(rangeSegments != null && rangeSegments.Count == 1) {\r\n                var rangeSegment = rangeSegments.Single();\r\n                context.Response.AddHeader(\"Content-Range\", BuildContentRangeResponseHeader(rangeSegment, length.Value));\r\n                context.Response.StatusCode = 206; // Partial content\r\n\r\n                long totalLength = rangeSegment.Length;\r\n\r\n                context.Response.AddHeader(\"Content-Length\", totalLength.ToString(CultureInfo.InvariantCulture));\r\n\r\n  \r\n                if (source.IsFile)\r\n                {\r\n                    context.Response.WriteFile(source.GetFilePath(), rangeSegment.Offset, rangeSegment.Length);\r\n                }\r\n                else\r\n                {\r\n                    inputStream.Seek(rangeSegment.Offset, SeekOrigin.Begin);\r\n\r\n                    OutputToResponse(context, new LimitedStream(inputStream, rangeSegment.Length));\r\n                }\r\n\r\n            }\r\n            else\r\n            {\r\n                if (length != null)\r\n                {\r\n                    context.Response.AddHeader(\"Content-Length\", ((int)length).ToString(CultureInfo.InvariantCulture));\r\n                }\r\n\r\n                if (source.IsFile)\r\n                {\r\n                    context.Response.WriteFile(source.GetFilePath());\r\n                }\r\n                else\r\n                {\r\n                    OutputToResponse(context, inputStream);\r\n                }\r\n            }\r\n        }\r\n        catch (HttpException)\r\n        {\r\n            // Ignore - client disconnected\r\n        }\r\n        finally\r\n        {\r\n            if (inputStream != null)\r\n            {\r\n                inputStream.Close();\r\n                inputStream.Dispose();\r\n            }\r\n        }\r\n    }\r\n\r\n    private static bool UrlContainsTimestamp(HttpContext context, IMediaFile file)\r\n    {\r\n        string url = context.Request.RawUrl;\r\n\r\n        if (!url.StartsWith(MediaUrl_PublicPrefix, StringComparison.OrdinalIgnoreCase)) return false;\r\n\r\n        string[] urlParts = url.Substring(MediaUrl_PublicPrefix.Length).Split('/');\r\n\r\n        Guid tempGuid;\r\n\r\n        return urlParts.Length >= 2\r\n            && Guid.TryParse(urlParts[0], out tempGuid)\r\n            && urlParts[1].Length == 6\r\n            && urlParts[1] == GetTimeStampHash(file);\r\n    }\r\n\r\n\r\n    private static string GetTimeStampHash(IMediaFile file)\r\n    {\r\n        int hash = file.LastWriteTime.Value.ToUniversalTime().GetHashCode();\r\n        return Convert.ToBase64String(BitConverter.GetBytes(hash)).Substring(0, 6).Replace('+', '-').Replace('/', '_');\r\n    }\r\n\r\n\r\n    private static void OutputToResponse(HttpContext context, Stream inputStream)\r\n    {\r\n        var response = context.Response;\r\n\r\n        byte[] buffer = new byte[CopyBufferSize];\r\n\r\n        int chunk = 0;\r\n\r\n        int read;\r\n        while ((read = inputStream.Read(buffer, 0, buffer.Length)) != 0)\r\n        {\r\n            chunk++;\r\n\r\n            response.OutputStream.Write(buffer, 0, read);\r\n\r\n            if (chunk % 20 == 0)\r\n            {\r\n                if (!response.IsClientConnected)\r\n                {\r\n                    return;\r\n                }\r\n\r\n                // Flushing to prevent unnecessary memory usage\r\n                response.Flush();\r\n            }\r\n        }\r\n    }\r\n\r\n\r\n    private static List<Range> ParseRanges(string rangesStr, long streamLength)\r\n    {\r\n        const string requiredPrefix = \"bytes=\";\r\n        if (!rangesStr.StartsWith(requiredPrefix)) {\r\n            return null;//Incorrect 'Range' header\r\n        }\r\n\r\n        rangesStr = rangesStr.Substring(requiredPrefix.Length);\r\n        var result = new List<Range>();\r\n\r\n        foreach (string rangeStr in rangesStr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))\r\n        {\r\n            try\r\n            {\r\n                string[] rangeParts = rangeStr.Split('-');\r\n                Verify.That(rangeParts.Length == 2, \"Range segment should contain one and only one '-' character\");\r\n\r\n                long? beginOffset = (rangeParts[0] != string.Empty) ? (long?)long.Parse(rangeParts[0]) : null;\r\n                long? endOffset = (rangeParts[1] != string.Empty) ? (long?)long.Parse(rangeParts[1]) : null;\r\n\r\n                Verify.That(beginOffset != null || endOffset != null, \"Parameters missing\");\r\n\r\n\r\n                if (beginOffset == null)\r\n                {\r\n                    Verify.That(endOffset <= streamLength, \"The segment is bigger than the length of the file\");\r\n\r\n                    result.Add(new Range(streamLength - endOffset.Value, endOffset.Value));\r\n                    continue;\r\n                }\r\n\r\n                Verify.That(beginOffset < streamLength, \"Begin offset is out of range\");\r\n\r\n                if (endOffset == null)\r\n                {\r\n                    result.Add(new Range(beginOffset.Value, streamLength - beginOffset.Value));\r\n                    continue;\r\n                }\r\n\r\n                Verify.That(beginOffset <= endOffset, \"End offset should be greater than begin offset\");\r\n\r\n                result.Add(new Range(beginOffset.Value, Math.Min(endOffset.Value, streamLength - 1) - beginOffset.Value + 1));\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                //Incorrect range segment\r\n                return null;\r\n            }\r\n        }\r\n\r\n        return result;\r\n    }\r\n\r\n    private static string BuildContentRangeResponseHeader(Range rangeSegment, long length)\r\n    {\r\n        var contentRangeHeader = new StringBuilder();\r\n        contentRangeHeader.Append(\"bytes \");\r\n\r\n        contentRangeHeader.Append(rangeSegment.Offset);\r\n        contentRangeHeader.Append(\"-\");\r\n        contentRangeHeader.Append(rangeSegment.Offset + rangeSegment.Length - 1);\r\n\r\n        contentRangeHeader.Append(\"/\").Append(length);\r\n\r\n        return contentRangeHeader.ToString();\r\n    }\r\n\r\n    private static DateTime? ParseDateTimeHeader(HttpContext context, string headerName)\r\n    {\r\n        string header = context.Request.Headers[headerName];\r\n\r\n        if (header != null)\r\n        {\r\n            DateTime ifModifiedSince;\r\n            if (DateTime.TryParse(header, CultureInfo.InvariantCulture, DateTimeStyles.None, out ifModifiedSince))\r\n            {\r\n                return ifModifiedSince;\r\n            }\r\n        }\r\n\r\n        return null;\r\n    }\r\n\r\n    private static string GetMediaType(IMediaFile file)\r\n    {\r\n        string mediaType = file.MimeType;\r\n\r\n        if (mediaType == MimeTypeInfo.Default)\r\n        {\r\n            mediaType = MimeTypeInfo.GetCanonicalFromExtension(Path.GetExtension(file.FileName.ToLowerInvariant()));\r\n        }\r\n\r\n        return mediaType;\r\n    }\r\n\r\n\r\n    private static bool CanBePreviewedInBrowser(HttpContext context, string mediaType)\r\n    {\r\n        return MediaTypesBrowserCanView.Contains(mediaType) || context.Request.AcceptTypes.Contains(mediaType);\r\n    }\r\n\r\n\r\n    public bool IsReusable { get { return true; } }\r\n\r\n    private static string GetResizedImageMediaType(string mediaType)\r\n    {\r\n        if (mediaType == MimeTypeInfo.Gif)\r\n        {\r\n            // Returning image in PNG format because build-in GIF encoder produces images of a bad quality\r\n            return MimeTypeInfo.Png;\r\n        }\r\n\r\n        if (mediaType == MimeTypeInfo.Bmp)\r\n        {\r\n            return MimeTypeInfo.Jpeg;\r\n        }\r\n\r\n        if (ImageResizer.TargetMediaTypeSupported(mediaType))\r\n        {\r\n            return mediaType;\r\n        }\r\n\r\n        // Converting resized images to jpeg by default\r\n        return MimeTypeInfo.Jpeg;\r\n    }\r\n\r\n    private static FileOrStream ProcessImageResizing(HttpContext context, IMediaFile file, string mediaType, out string resizedImageMediaType)\r\n    {\r\n        var resizingOptions = ResizingOptions.Parse(context.Request.QueryString);\r\n\r\n        var preferredMediaType = resizingOptions.MediaType;\r\n\r\n        if (resizingOptions.IsEmpty\r\n            || (preferredMediaType != null && !ImageResizer.TargetMediaTypeSupported(preferredMediaType)))\r\n        {\r\n            resizedImageMediaType = mediaType;\r\n            return new FileOrStream(file);\r\n        }\r\n\r\n        if (GlobalSettingsFacade.ProtectResizedImagesWithHash && !UserValidationFacade.IsLoggedIn())\r\n        {\r\n            var expectedHash = resizingOptions.GetSecureHash(file.Id);\r\n            if (context.Request.QueryString[\"sh\"] != expectedHash)\r\n            {\r\n                // Returning the media file without resizing\r\n                resizedImageMediaType = mediaType;\r\n                return new FileOrStream(file);\r\n            }\r\n        }\r\n\r\n        var targetImageMediaType = GetResizedImageMediaType(preferredMediaType ?? mediaType);\r\n\r\n        try\r\n        {\r\n            string resizedImageFilePath = ImageResizer.GetResizedImage(file, resizingOptions, mediaType, targetImageMediaType);\r\n\r\n            resizedImageMediaType = resizedImageFilePath != null ? targetImageMediaType : mediaType;\r\n\r\n            return resizedImageFilePath != null\r\n                ? new FileOrStream(resizedImageFilePath)\r\n                : new FileOrStream(file);\r\n        }\r\n        catch (Exception ex)\r\n        {\r\n            Log.LogVerbose(\"Composite.Media.ImageResize\", ex.Message);\r\n        }\r\n\r\n        resizedImageMediaType = mediaType;\r\n        return new FileOrStream(file);\r\n    }\r\n\r\n    /// <summary>\r\n    /// Allows reading only limited amount bytes from inner stream\r\n    /// </summary>\r\n    private class LimitedStream : Stream\r\n    {\r\n        private readonly Stream _innerStream;\r\n        private readonly long _size;\r\n        private long _position;\r\n\r\n        public LimitedStream(Stream innerStream, long size)\r\n        {\r\n            _innerStream = innerStream;\r\n            _size = size;\r\n            _position = 0;\r\n        }\r\n\r\n        public override void Flush()\r\n        {\r\n        }\r\n\r\n        public override long Seek(long offset, SeekOrigin origin)\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n        public override void SetLength(long value)\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n        public override int Read(byte[] buffer, int offset, int count)\r\n        {\r\n            if (_position >= _size)\r\n            {\r\n                return 0;\r\n            }\r\n\r\n            int bytesRead = _innerStream.Read(buffer, offset, (int)Math.Min(count, _size - _position));\r\n\r\n            _position += bytesRead;\r\n\r\n            return bytesRead;\r\n        }\r\n\r\n        public override void Write(byte[] buffer, int offset, int count)\r\n        {\r\n            throw new NotSupportedException();\r\n        }\r\n\r\n        public override bool CanRead\r\n        {\r\n            get { return true; }\r\n        }\r\n\r\n        public override bool CanSeek\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n        public override bool CanWrite\r\n        {\r\n            get { return false; }\r\n        }\r\n\r\n        public override long Length\r\n        {\r\n            get { return _size; }\r\n        }\r\n\r\n        public override long Position\r\n        {\r\n            get { return _position; }\r\n            set { throw new NotSupportedException(); }\r\n        }\r\n    }\r\n}"
  },
  {
    "path": "Website/Renderers/TemplatePreview.ashx",
    "content": "﻿<%@ WebHandler Language=\"C#\" Class=\"Composite.Renderers.Phantom\" %>\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Xml.Linq;\r\nusing Composite.C1Console.Security;\r\nusing Composite.C1Console.Users;\r\nusing Composite.Core.PageTemplates;\r\nusing Composite.Core.WebClient.Renderings.Page;\r\nusing Composite.Core.Xml;\r\nusing Composite.Data;\r\nusing Composite.Data.Types;\r\n\r\nnamespace Composite.Renderers\r\n{\r\n\t/// <summary>\r\n\t/// Summary description for Phantom\r\n\t/// </summary>\r\n\tpublic class Phantom : IHttpHandler\r\n\t{\r\n\t\tpublic void ProcessRequest(HttpContext context)\r\n\t\t{\r\n\t\t\ttry\r\n\t\t\t{\r\n\r\n\t\t\t\tif (!UserValidationFacade.IsLoggedIn())\r\n\t\t\t\t{\r\n\t\t\t\t\tcontext.Response.StatusCode = 401; // \"Unauthorized\"\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstring pageIdStr = context.Request[\"p\"] ?? \"\";\r\n\t\t\t\tstring templateIdStr = context.Request[\"t\"] ?? \"\";\r\n\r\n\t\t\t\tGuid pageId;\r\n\t\t\t\tGuid templateId;\r\n\r\n\t\t\t\tGuid.TryParse(pageIdStr, out pageId);\r\n\t\t\t\tGuid.TryParse(templateIdStr, out templateId);\r\n\r\n\t\t\t\tIPage page = null;\r\n\r\n\t\t\t\tusing (var c = new DataConnection(PublicationScope.Unpublished, UserSettings.ActiveLocaleCultureInfo))\r\n\t\t\t\t{\r\n\t\t\t\t\tif (pageId != Guid.Empty)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpage = c.Get<IPage>().FirstOrDefault(p => p.Id == pageId);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n                    if(page == null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (templateId != Guid.Empty)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tpage = c.Get<IPage>().FirstOrDefault(p => p.TemplateId == templateId);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tpage = page ?? c.Get<IPage>().First();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (templateId != Guid.Empty)\r\n\t\t\t\t{\r\n\t\t\t\t\tpage.TemplateId = templateId;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar templateInfo = PageTemplateFacade.GetPageTemplate(page.TemplateId);\r\n\r\n\t\t\t\tvar contents = new List<IPagePlaceholderContent>();\r\n\r\n\t\t\t\tbool previewStagingJsAppended = false;\r\n\r\n\t\t\t\tforeach (var placeholder in templateInfo.PlaceholderDescriptions)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar placeholderDocument = new XhtmlDocument();\r\n\t\t\t\t\tplaceholderDocument.Body.Add(new XElement(Namespaces.Xhtml + \"placeholderpreview\",\r\n\t\t\t\t\t\tnew XAttribute(\"id\", \"ph_\" + placeholder.Id),\r\n\t\t\t\t\t\tnew XAttribute(\"style\", string.Format(\"background-color: lightgray; display: block; width: 100%; min-height: {0}px; height: 100%\",\r\n\t\t\t\t\t\t\tplaceholder.Id == templateInfo.DefaultPlaceholderId ? 600 : 300)),\r\n\t\t\t\t\t\tnew XElement(Namespaces.Xhtml + \"h1\", placeholder.Title)));\r\n\r\n\t\t\t\t\tif (!previewStagingJsAppended)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tplaceholderDocument.Body.Add(XElement.Parse(PreviewStagingJs));\r\n\t\t\t\t\t\tpreviewStagingJsAppended = true;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar content = DataFacade.BuildNew<IPagePlaceholderContent>();\r\n\t\t\t\t\tcontent.PageId = page.Id;\r\n\t\t\t\t    content.VersionId = page.VersionId;\r\n\t\t\t\t\tcontent.PlaceHolderId = placeholder.Id;\r\n\t\t\t\t\tcontent.Content = placeholderDocument.ToString();\r\n\t\t\t\t\tcontents.Add(content);\r\n\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\tstring output = PagePreviewBuilder.RenderPreview(page, contents, RenderingReason.ScreenshotGeneration);\r\n\r\n                // NOTE: output is always empty in integrated mode, as RenderPreview() does a request transfer.\r\n\t\t\t\tif (output != String.Empty)\r\n\t\t\t\t{\r\n\t\t\t\t\tcontext.Response.ContentType = \"text/html\";\r\n\t\t\t\t\tcontext.Response.Write(output);\r\n                    if (!previewStagingJsAppended || !output.Contains(PreviewStagingJsMarker))\r\n\t\t\t\t\t{\r\n                        context.Response.Write(PreviewStagingJs);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch (Exception ex)\r\n\t\t\t{\r\n\t\t\t\tComposite.Core.Log.LogError(\"TemplatePreview\", ex);\r\n\t\t\t\tthrow;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic bool IsReusable\r\n\t\t{\r\n\t\t\tget { return true; }\r\n\t\t}\r\n\r\n\t\t// this script block will \r\n\t\t//  - finalize (call phantom)\r\n\t\tconst string PreviewStagingJs = @\"\r\n<script xmlns='http://www.w3.org/1999/xhtml'>    //<!--\r\n    window.addEventListener('load', function () {\r\n\t\twindow.setTimeout( function() {\r\n\t\t\t\tfinalize();\r\n\t\t}, 200);\r\n    });\r\n\r\n\tfunction finalize()\r\n\t{\r\n\t\tif (window.callPhantom!=null)\r\n\t\t\twindow.callPhantom('load');\r\n\t}\r\n\r\n    window.previewJsInitialized = true;\r\n\r\n// -->\r\n</script>\r\n\";\r\n\r\n\t    private const string PreviewStagingJsMarker = \"window.callPhantom('load')\";\r\n\r\n\t}\r\n}"
  },
  {
    "path": "Website/WebSite.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\r\n    <ProductVersion>9.0.30729</ProductVersion>\r\n    <SchemaVersion>2.0</SchemaVersion>\r\n    <ProjectGuid>{D0A3D7D5-1D1F-40BC-89C1-93CDCEDF262C}</ProjectGuid>\r\n    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>\r\n    <OutputType>Library</OutputType>\r\n    <RootNamespace>Composite</RootNamespace>\r\n    <AssemblyName>Composite.Website</AssemblyName>\r\n    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>\r\n    <SccProjectName>SAK</SccProjectName>\r\n    <SccLocalPath>SAK</SccLocalPath>\r\n    <SccAuxPath>SAK</SccAuxPath>\r\n    <SccProvider>SAK</SccProvider>\r\n    <FileUpgradeFlags>\r\n    </FileUpgradeFlags>\r\n    <OldToolsVersion>4.0</OldToolsVersion>\r\n    <UpgradeBackupLocation>\r\n    </UpgradeBackupLocation>\r\n    <TargetFrameworkProfile />\r\n    <UseIISExpress>true</UseIISExpress>\r\n    <IISExpressSSLPort />\r\n    <IISExpressAnonymousAuthentication />\r\n    <IISExpressWindowsAuthentication />\r\n    <IISExpressUseClassicPipelineMode />\r\n    <UseGlobalApplicationHostFile />\r\n    <Use64BitIISExpress />\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>false</Optimize>\r\n    <OutputPath>bin\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>\r\n    <Prefer32Bit>false</Prefer32Bit>\r\n    <LangVersion>default</LangVersion>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\r\n    <DebugType>pdbonly</DebugType>\r\n    <Optimize>true</Optimize>\r\n    <OutputPath>bin\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>\r\n    <Prefer32Bit>false</Prefer32Bit>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Castle.Core.4.2.1\\lib\\net45\\Castle.Core.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Composite.XmlSerializers, Version=1.3.3656.19656, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Composite.XmlSerializers.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.CodeAnalysis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\Packages\\Microsoft.CodeAnalysis.Common.2.0.0\\lib\\netstandard1.3\\Microsoft.CodeAnalysis.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.CodeAnalysis.CSharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\Packages\\Microsoft.CodeAnalysis.CSharp.2.0.0\\lib\\netstandard1.3\\Microsoft.CodeAnalysis.CSharp.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Common, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Common.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Logging.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.Validation, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\Microsoft.Practices.EnterpriseLibrary.Validation.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.Web.Infrastructure.1.0.0.0\\lib\\net40\\Microsoft.Web.Infrastructure.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"Orckestra.AspNet.Roslyn, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Orckestra.AspNet.Roslyn.1.0.2\\lib\\net461\\Orckestra.AspNet.Roslyn.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"System.Collections.Immutable, Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\Packages\\System.Collections.Immutable.1.3.1\\lib\\portable-net45+win8+wp8+wpa81\\System.Collections.Immutable.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"System.Data\" />\r\n    <Reference Include=\"System.Data.DataSetExtensions\" />\r\n    <Reference Include=\"System.Reactive.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Reactive.Core.3.0.0\\lib\\net46\\System.Reactive.Core.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Reactive.Interfaces, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Reactive.Interfaces.3.0.0\\lib\\net45\\System.Reactive.Interfaces.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Reactive.Linq, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Reactive.Linq.3.0.0\\lib\\net46\\System.Reactive.Linq.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Reflection.Metadata, Version=1.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\Packages\\System.Reflection.Metadata.1.4.2\\lib\\portable-net45+win8\\System.Reflection.Metadata.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"System.Threading.Tasks.Dataflow, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\System.Threading.Tasks.Dataflow.4.7.0\\lib\\portable-net45+win8+wpa81\\System.Threading.Tasks.Dataflow.dll</HintPath>\r\n    </Reference>\r\n    <Reference Include=\"System.Transactions\" />\r\n    <Reference Include=\"System.Web.ApplicationServices\" />\r\n    <Reference Include=\"System.Web.DynamicData\" />\r\n    <Reference Include=\"System.Web.Entity\" />\r\n    <Reference Include=\"System.Web.Extensions\" />\r\n    <Reference Include=\"System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.3.2.3\\lib\\net45\\System.Web.Helpers.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.Razor.3.2.3\\lib\\net45\\System.Web.Razor.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.Routing\" />\r\n    <Reference Include=\"System.Web.WebPages\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.3.2.3\\lib\\net45\\System.Web.WebPages.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.3.2.3\\lib\\net45\\System.Web.WebPages.Deployment.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Web.WebPages.Razor\">\r\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.3.2.3\\lib\\net45\\System.Web.WebPages.Razor.dll</HintPath>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Workflow.Activities\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"System.Workflow.ComponentModel\">\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Workflow.Runtime\">\r\n      <RequiredTargetFramework>3.0</RequiredTargetFramework>\r\n      <Private>True</Private>\r\n    </Reference>\r\n    <Reference Include=\"System.Drawing\" />\r\n    <Reference Include=\"System.Web\" />\r\n    <Reference Include=\"System.Xml\" />\r\n    <Reference Include=\"System.Configuration\" />\r\n    <Reference Include=\"System.Web.Services\" />\r\n    <Reference Include=\"System.EnterpriseServices\" />\r\n    <Reference Include=\"System.Web.Mobile\" />\r\n    <Reference Include=\"System.Xml.Linq\" />\r\n    <Reference Include=\"TidyNet, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL\">\r\n      <SpecificVersion>False</SpecificVersion>\r\n      <HintPath>..\\bin\\TidyNet.dll</HintPath>\r\n    </Reference>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"Composite\\content\\dialogs\\functions\\editFunctionCall.aspx.designer.cs\">\r\n      <DependentUpon>editFunctionCall.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\misc\\editors\\functioncalleditor\\functioncalleditor.aspx.designer.cs\">\r\n      <DependentUpon>functioncalleditor.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\misc\\editors\\resxeditor\\resxeditor.aspx.cs\">\r\n      <DependentUpon>resxeditor.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\misc\\editors\\resxeditor\\resxeditor.aspx.designer.cs\">\r\n      <DependentUpon>resxeditor.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\functioninfo\\ShowFunctionInfo.aspx.cs\">\r\n      <DependentUpon>ShowFunctionInfo.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\functioninfo\\ShowFunctionInfo.aspx.designer.cs\">\r\n      <DependentUpon>ShowFunctionInfo.aspx</DependentUpon>\r\n    </Compile>\r\n    <Content Include=\"App_Data\\Composite\\Configuration\\Entities.xml\" />\r\n    <Content Include=\"App_Data\\Composite\\TreeDefinitions\\UrlConfiguration.xml\" />\r\n    <Content Include=\"Composite\\console\\access\\postFrame.js\" />\r\n    <Content Include=\"Composite\\console\\access\\requestJSON.js\" />\r\n    <Content Include=\"Composite\\console\\access\\utils.js\" />\r\n    <Content Include=\"Composite\\console\\access\\wampClient.js\" />\r\n    <Content Include=\"Composite\\console\\access\\wampTest.js\" />\r\n    <Content Include=\"Composite\\console\\components\\colors.js\" />\r\n    <Content Include=\"Composite\\console\\components\\container\\ConnectDialog.js\" />\r\n    <Content Include=\"Composite\\console\\components\\container\\ConnectDockPanel.js\" />\r\n    <Content Include=\"Composite\\console\\components\\container\\ConnectFormPanel.js\" />\r\n    <Content Include=\"Composite\\console\\components\\container\\ConnectLogPanel.js\" />\r\n    <Content Include=\"Composite\\console\\components\\container\\ConnectTabPanel.js\" />\r\n    <Content Include=\"Composite\\console\\components\\container\\ConnectToolbarFrame.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\ActionButton.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\CheckboxGroup.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\DataField.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\DataFieldLabel.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\DataFieldWrapper.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\Dialog.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\Fieldset.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\FormTab.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\HelpIcon.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\Icon.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\Input.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\LogPanel.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\Palette.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\ScrollBox.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\Select.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\Spritesheet.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\SwitchPanel.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\TabBar.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\Toolbar.js\" />\r\n    <Content Include=\"Composite\\console\\components\\presentation\\ToolbarFrame.js\" />\r\n    <Content Include=\"Composite\\console\\console.js\" />\r\n    <Content Include=\"Composite\\console\\iconIndex.js\" />\r\n    <Content Include=\"Composite\\console\\index.html\" />\r\n    <Content Include=\"Composite\\console\\index.prod.html\" />\r\n    <Content Include=\"Composite\\console\\mocks\\mockServer.js\" />\r\n    <Content Include=\"Composite\\console\\mocks\\services\\functionMock.js\" />\r\n    <Content Include=\"Composite\\console\\mocks\\services\\pageMock.js\" />\r\n    <Content Include=\"Composite\\console\\mocks\\services\\valueMock.js\" />\r\n    <Content Include=\"Composite\\console\\README.txt\" />\r\n    <Content Include=\"Composite\\console\\state\\actions\\fetchFromProvider.js\" />\r\n    <Content Include=\"Composite\\console\\state\\actions\\fireAction.js\" />\r\n    <Content Include=\"Composite\\console\\state\\actions\\loadAndOpen.js\" />\r\n    <Content Include=\"Composite\\console\\state\\actions\\logs.js\" />\r\n    <Content Include=\"Composite\\console\\state\\actions\\pageDefs.js\" />\r\n    <Content Include=\"Composite\\console\\state\\actions\\values.js\" />\r\n    <Content Include=\"Composite\\console\\state\\initState.js\" />\r\n    <Content Include=\"Composite\\console\\state\\normalizingSchema.js\" />\r\n    <Content Include=\"Composite\\console\\state\\observers.js\" />\r\n    <Content Include=\"Composite\\console\\state\\reducers\\dataFields.js\" />\r\n    <Content Include=\"Composite\\console\\state\\reducers\\definitions.js\" />\r\n    <Content Include=\"Composite\\console\\state\\reducers\\dialog.js\" />\r\n    <Content Include=\"Composite\\console\\state\\reducers\\layout.js\" />\r\n    <Content Include=\"Composite\\console\\state\\reducers\\logs.js\" />\r\n    <Content Include=\"Composite\\console\\state\\reducers\\options.js\" />\r\n    <Content Include=\"Composite\\console\\state\\reducers\\providers.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\dialogSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\formSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\layoutSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\logSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\pageSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\paletteDialogSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\tabSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\toolbarPropsSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\selectors\\toolbarSelector.js\" />\r\n    <Content Include=\"Composite\\console\\state\\store.js\" />\r\n    <Content Include=\"Composite\\console\\Tree.xml\" />\r\n    <Content Include=\"Composite\\content\\branding\\about-company.inc\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\branding\\brand-main.inc\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\branding\\company-logo-branded.inc\" />\r\n    <Content Include=\"Composite\\content\\branding\\company-logo.inc\" />\r\n    <Content Include=\"Composite\\content\\branding\\includes.inc\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\branding\\logo.inc\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\branding\\logo-branded.inc\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\branding\\start-page-content.inc\" />\r\n    <Content Include=\"Composite\\content\\branding\\start-page-js.inc\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\Hostnames.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\SetTimeZone_select.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeletePage_ConfirmAllVersionsDeletion.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\UrlConfiguration.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\WebsiteFileElementProviderUploadAndExtractZipFile.xml\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\resxeditor\\Bindings\\rowContainerBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\resxeditor\\resxeditor.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\resxeditor\\resxeditor.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositecomponent\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\views\\browser\\deviceoptions.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\DocumentExecutionContainer.ascx.designer.cs\">\r\n      <DependentUpon>DocumentExecutionContainer.ascx</DependentUpon>\r\n    </Compile>\r\n    <Content Include=\"App_Data\\Composite\\Configuration\\C1ConsoleAccess.xml\" />\r\n    <Content Include=\"App_Data\\Composite\\PhantomJs\\phantomjs.exe\" />\r\n    <Content Include=\"App_Data\\Composite\\PhantomJs\\preview.js\" />\r\n    <Content Include=\"App_Data\\Composite\\PhantomJs\\renderingServer.js\" />\r\n    <Content Include=\"App_Data\\PageTemplates\\web.config\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\postback\\postbackdialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\postback\\PostBackDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\util\\comparestrings\\comparestrings.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\util\\comparestrings\\comparestrings.css\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\util\\comparestrings\\comparestringscontent.css\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\util\\comparestrings\\comparestringscontent.html\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\util\\comparestrings\\CompareStringsDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplateFeature\\Add.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplateFeature\\EditMarkup.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplateFeature\\EditVisual.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplateFeature\\Delete.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplate\\AddNewRazorPageTemplate.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplate\\AddNewMasterPagePageTemplate.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewUserControlFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewRazorFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditRazorFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditUserControlFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplate\\EditRazorTemplate.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteRazorFunctionConfirm.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteUserControlFunctionConfirm.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplate\\EditMasterPage.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplate\\AddNewPageTemplate.xml\" />\r\n    <Content Include=\"Composite\\content\\views\\publishworkflowstatus\\bindings\\SortButtonBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\publishworkflowstatus\\bindings\\UnpublishedPageBinding.js\" />\r\n    <Content Include=\"Composite\\controls\\BrandingSnippet.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\HierarchicalSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\SvgIconSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\FontIconSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\TreeSelector.ascx\" />\r\n    <Content Include=\"Composite\\images\\branding\\brand-icon.png\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-upload-zip-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\optimizely.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-remove-folder-from-whitelist.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-add-folder-to-whitelist.svg\" />\r\n    <Content Include=\"Composite\\lib\\codemirror\\addon\\dropmedia\\dropmedia.js\" />\r\n    <Content Include=\"Composite\\lib\\codemirror\\mode\\razor\\razor.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\theme\\composite.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\BlockSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\ie.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositespellcheck\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\composite\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositeimageresize\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\preview\\error.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\preview\\error.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\preview\\stop.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\preview\\stop.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\preview\\StopPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\browser\\BrowserToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\nonframework.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\nulltreeselector.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\style.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\style1.css\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\style2.css\" />\r\n    <Content Include=\"Composite\\content\\views\\generic\\generic.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\generic\\GenericPageBinding.js\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DateTimeSelectors\\DateSelector.ascx.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Content>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\FormUIStandardDialogs\\WarningDialogExecutionContainer.ascx.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\FormUIStandardDialogs\\WarningDialogExecutionContainer.ascx.designer.cs\">\r\n      <DependentUpon>WarningDialogExecutionContainer.ascx.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionParameterEditor.aspx.designer.cs\">\r\n      <DependentUpon>FunctionParameterEditor.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\dialogs\\functions\\editFunctionCall.aspx.cs\">\r\n      <DependentUpon>editFunctionCall.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\flow\\FlowUi.aspx.cs\">\r\n      <DependentUpon>FlowUi.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\flow\\FlowUi.aspx.designer.cs\">\r\n      <DependentUpon>FlowUi.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\misc\\editors\\functioncalleditor\\functioncalleditor.aspx.cs\">\r\n      <DependentUpon>functioncalleditor.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\dev\\flushadmin\\Default.aspx.cs\">\r\n      <DependentUpon>Default.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\dev\\flushadmin\\Default.aspx.designer.cs\">\r\n      <DependentUpon>Default.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\relationshipgraph\\ShowRelationshipOrientedGraph.aspx.cs\">\r\n      <DependentUpon>ShowRelationshipOrientedGraph.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\relationshipgraph\\ShowRelationshipOrientedGraph.aspx.designer.cs\">\r\n      <DependentUpon>ShowRelationshipOrientedGraph.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\showelementinformation\\Default.aspx.cs\">\r\n      <DependentUpon>Default.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\datatypedescriptor\\ToXml.aspx.cs\">\r\n      <DependentUpon>ToXml.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\datatypedescriptor\\ToXml.aspx.designer.cs\">\r\n      <DependentUpon>ToXml.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\functiondoc\\FunctionDocumentation.aspx.cs\">\r\n      <DependentUpon>FunctionDocumentation.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\functiondoc\\FunctionDocumentation.aspx.designer.cs\">\r\n      <DependentUpon>FunctionDocumentation.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\log\\log.aspx.cs\">\r\n      <DependentUpon>log.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\log\\log.aspx.designer.cs\">\r\n      <DependentUpon>log.aspx</DependentUpon>\r\n    </Compile>\r\n    <Content Include=\"Composite\\content\\views\\publishworkflowstatus\\ViewUnpublishedItems.aspx.cs\">\r\n      <DependentUpon>ViewUnpublishedItems.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Content>\r\n    <Compile Include=\"Composite\\content\\views\\relationshipgraph\\Default.aspx.cs\">\r\n      <DependentUpon>Default.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\relationshipgraph\\Default.aspx.designer.cs\">\r\n      <DependentUpon>Default.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\content\\views\\showelementinformation\\Default.aspx.designer.cs\">\r\n      <DependentUpon>Default.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\AppInitializerControl.ascx.cs\">\r\n      <DependentUpon>AppInitializerControl.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\AppInitializerControl.ascx.designer.cs\">\r\n      <DependentUpon>AppInitializerControl.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\CodePressControl.ascx.cs\">\r\n      <DependentUpon>CodePressControl.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\CodePressControl.ascx.designer.cs\">\r\n      <DependentUpon>CodePressControl.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FieldGroupControl.ascx.cs\">\r\n      <DependentUpon>FieldGroupControl.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FieldGroupControl.ascx.designer.cs\">\r\n      <DependentUpon>FieldGroupControl.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\EmptyDocumentExecutionContainer.ascx.cs\">\r\n      <DependentUpon>EmptyDocumentExecutionContainer.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\EmptyDocumentExecutionContainer.ascx.designer.cs\">\r\n      <DependentUpon>EmptyDocumentExecutionContainer.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\DataDialogExecutionContainer.ascx.cs\">\r\n      <DependentUpon>DataDialogExecutionContainer.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\DataDialogExecutionContainer.ascx.designer.cs\">\r\n      <DependentUpon>DataDialogExecutionContainer.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\DocumentExecutionContainer.ascx.cs\">\r\n      <DependentUpon>DocumentExecutionContainer.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\FormUIStandardDialogs\\ConfirmDialogExecutionContainer.ascx.cs\">\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\FormUIStandardDialogs\\ConfirmDialogExecutionContainer.ascx.designer.cs\">\r\n      <DependentUpon>ConfirmDialogExecutionContainer.ascx.cs</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\WizardExecutionContainer.ascx.cs\">\r\n      <DependentUpon>WizardExecutionContainer.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\WizardExecutionContainer.ascx.designer.cs\">\r\n      <DependentUpon>WizardExecutionContainer.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Customized\\PageContentEditor.ascx.cs\">\r\n      <DependentUpon>PageContentEditor.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Customized\\PageContentEditor.ascx.designer.cs\">\r\n      <DependentUpon>PageContentEditor.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionCallsDesigner.ascx.cs\">\r\n      <DependentUpon>FunctionCallsDesigner.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionParameterDesigner.ascx.cs\">\r\n      <DependentUpon>FunctionParameterDesigner.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionParameterDesigner.ascx.designer.cs\">\r\n      <DependentUpon>FunctionParameterDesigner.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionParameterEditor.aspx.cs\">\r\n      <DependentUpon>FunctionParameterEditor.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\TypeFieldDesigner.ascx.cs\">\r\n      <DependentUpon>TypeFieldDesigner.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\TypeFieldDesigner.ascx.designer.cs\">\r\n      <DependentUpon>TypeFieldDesigner.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\RichContent\\MultiContentXhtmlEditor.ascx.cs\">\r\n      <DependentUpon>MultiContentXhtmlEditor.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\RichContent\\MultiContentXhtmlEditor.ascx.designer.cs\">\r\n      <DependentUpon>MultiContentXhtmlEditor.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\Helpers\\StyleFileLoaderControl.ascx.cs\">\r\n      <DependentUpon>StyleFileLoaderControl.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\FormsControls\\Helpers\\StyleFileLoaderControl.ascx.designer.cs\">\r\n      <DependentUpon>StyleFileLoaderControl.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\HttpHeadersControl.ascx.cs\">\r\n      <DependentUpon>HttpHeadersControl.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\HttpHeadersControl.ascx.designer.cs\">\r\n      <DependentUpon>HttpHeadersControl.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\Misc\\MarkupInOutView.ascx.cs\">\r\n      <DependentUpon>MarkupInOutView.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\Misc\\MarkupInOutView.ascx.designer.cs\">\r\n      <DependentUpon>MarkupInOutView.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\RegisterOutputTransformation.ascx.cs\">\r\n      <DependentUpon>RegisterOutputTransformation.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\RegisterOutputTransformation.ascx.designer.cs\">\r\n      <DependentUpon>RegisterOutputTransformation.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\ScriptLoaderControl.ascx.cs\">\r\n      <DependentUpon>ScriptLoaderControl.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\ScriptLoaderControl.ascx.designer.cs\">\r\n      <DependentUpon>ScriptLoaderControl.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\StageDeckControl.ascx.cs\">\r\n      <DependentUpon>StageDeckControl.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\StageDeckControl.ascx.designer.cs\">\r\n      <DependentUpon>StageDeckControl.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\StyleLoaderControl.ascx.cs\">\r\n      <DependentUpon>StyleLoaderControl.ascx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\controls\\StyleLoaderControl.ascx.designer.cs\">\r\n      <DependentUpon>StyleLoaderControl.ascx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\GenerateIconSprite.aspx.cs\">\r\n      <DependentUpon>GenerateIconSprite.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\Login.aspx.cs\">\r\n      <DependentUpon>Login.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\Login.aspx.designer.cs\">\r\n      <DependentUpon>Login.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\schemas\\default.aspx.cs\">\r\n      <DependentUpon>default.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\schemas\\default.aspx.designer.cs\">\r\n      <DependentUpon>default.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\schemas\\FormsControls\\GenerateDynamicSchemas.aspx.cs\">\r\n      <DependentUpon>GenerateDynamicSchemas.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Composite\\schemas\\FormsControls\\GenerateDynamicSchemas.aspx.designer.cs\">\r\n      <DependentUpon>GenerateDynamicSchemas.aspx</DependentUpon>\r\n    </Compile>\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\UrlComboBox.ascx\" />\r\n    <Content Include=\"Composite\\grunt.html\" />\r\n    <Content Include=\"Composite\\images\\C1_logo.svg\" />\r\n    <Content Include=\"Composite\\images\\branding\\brand-text.svg\" />\r\n    <Content Include=\"Composite\\images\\branding\\favicon.ico\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\abc-book.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\alphbeticindex.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\books.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\bullist.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\company-apple.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\data-awaiting-approval.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\dollar-invoice.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\end.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\inbox-green.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\log-showlog.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\puzzle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\puzzle-piece.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\key.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-facebook.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-googleplus.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-twitter.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-twitter-bird.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-videmo.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-youtube.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-skype.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-share.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-vk.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\numlist.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\outdent.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\merge.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\image-left.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\image-right.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\indent.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\resize-screen.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\seo.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\small-text.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-instagram.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\social-linkedin.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\split.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\selection.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\settings.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\start.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\before.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\after.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\accept-green.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\error.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\folder-open-2.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\folder-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-functions.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\stop-red.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\stop.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\student.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cake.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\tablet-landscape.svg\" />\r\n    <Content Include=\"Composite\\images\\logo.png\" />\r\n    <Content Include=\"Composite\\images\\touch-cursor.png\" />\r\n    <Content Include=\"Composite\\images\\welcome\\accept-green.svg\" />\r\n    <Content Include=\"Composite\\images\\welcome\\cancel.svg\" />\r\n    <Content Include=\"Composite\\localization\\MimeTypes.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Search.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.Components.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.TimezoneDisplayNames.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.TimezoneAbbreviations.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Orckestra.Tools.UrlConfiguration.en-us.xml\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\ContextContainer.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\ImageProvider.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IContextContainerBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\branding\\BrandSnippetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\combobutton\\SelectorButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\TreeSelectorDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\radiocheck\\CheckTreeBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\radiocheck\\CheckTreeNodeBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\selectors\\HierarchicalSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\explorer\\ExplorerPopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\fields\\ResolverContainerBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\genericview\\AddressBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\genericview\\GenericViewBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\genericview\\PathBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\viewbutton\\SlideInButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\views\\SlideInViewBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\util\\LocalStorage.js\" />\r\n    <Content Include=\"Composite\\styles\\default\\fields\\fields-base.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\dialogs\\dialog-multiselector.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\fields\\urlinputdialog.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\icons.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\oldUI-fixes.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\forms.less\" />\r\n    <Content Include=\".bowerrc\" />\r\n    <Content Include=\"bower.json\" />\r\n    <Content Include=\"Composite\\styles\\default\\branding.less\" />\r\n    <Content Include=\"App_Data\\Composite\\PhantomJs\\config.json\" />\r\n    <Content Include=\"Composite\\services\\Setup\\web.config\" />\r\n    <Content Include=\"App_Data\\Composite\\DebugBuild.Composite.config\" />\r\n    <Content Include=\"Composite\\content\\views\\simplesearch\\SimpleSearch.cshtml\" />\r\n    <None Include=\"Composite\\styles\\default\\splash.less\" />\r\n    <Content Include=\"Composite\\GenerateIconSprite.aspx\" />\r\n    <Content Include=\"Composite\\images\\editfunction.png\" />\r\n    <Content Include=\"Composite\\images\\function.png\" />\r\n    <Content Include=\"Composite\\images\\functionheaderbackground.png\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\accept.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\advanced.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\alarm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\all-functions-generatedocumentation.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\apartment.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\arrow-down-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\arrow-down.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\arrow-left-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\arrow-left.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\arrow-right-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\arrow-right.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\arrow-up-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\arrow-up.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\associated-data-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\associated-data-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\associated-data-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\back.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\balloon.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\base-function-function.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\bicycle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\blocks.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\bold.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\book-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\book.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\bookmark.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\briefcase.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\browser-green.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\browser.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\bug.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\bullhorn.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\bus.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\calendar-full.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\camera-video.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\camera.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cancel.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\car.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cart.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chart-bars.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\checkmark-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chevron-down-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chevron-down.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chevron-left-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chevron-left.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chevron-right-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chevron-right.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chevron-up-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\chevron-up.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\circle-minus.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\clock.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\close.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cloud-check.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cloud-download.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cloud-sync.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cloud-upload.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cloud.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\code.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\coffee-cup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cog.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\configuration-root-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\configuration-root-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\confirmaction-defaulticon.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\construction.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\contents.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\copy.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\crop.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cross-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cross.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\customurlaction-defaulticon.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\cut.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\data-awaiting-publication.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\data-draft.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\data-ghosted.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\data-interface-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\data-interface-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\data-published.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\data.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\dataassociation-add-association.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\dataassociation-edit-association.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\dataassociation-remove-association.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\dataassociation-rootfolder-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\dataassociation-rootfolder-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\database.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\datagroupinghelper-folder-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\datagroupinghelper-folder-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\default.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\deleteditems.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\deletefield.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\developer.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\developerapplication-treedefinition-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\developerapplication-treedefinition-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\developerapplication-treedefinition-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\developerapplication-treedefinition.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\developerapplication-treedefinitionroot.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\diamond.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\dice.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\dinner.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\direction-ltr.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\direction-rtl.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\disk.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\down.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\download.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\drop.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\earth-blue.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\earth-green.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\earth.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\editor-blockselector.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\editor-classselector.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\editor-designview.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\editor-fancyedit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\editor-formatselector.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\editor-formatsource.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\editor-plainedit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\editor-sourceview.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\enter-down.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\enter.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\envelope.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\exit-up.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\exit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\eye.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\feedback.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\field.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\fields.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\file-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\file-empty.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\film-play.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\finish.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\flag.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\folder-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\folder-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\folder-blue.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\folder-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\folder-lock.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\folder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\forward.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\frame-contract.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\functioncall.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\functioncall_list.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\funnel.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-interface-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-interface-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-root-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-root-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-data-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-data-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-data-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-data-localize.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-delocalize.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-form-markup-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-list-unpublished-items.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-localize.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-showincontentarea.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generated-type-to-xml.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generic-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generic-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generic-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generic-refresh.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generic-search.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generic-set-security.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generic-show-history.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\generic-show-report.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\gift.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\graduation-hat.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\hand.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\heart-pulse.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\heart.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\help.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\highlight.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\history-report.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\history.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\home-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\home-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\home-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\home.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\home_bak.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\hourglass.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\housefolder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\icon.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\image.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\inbox-red.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\inbox.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\indent-decrease.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\indent-increase.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\information-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\input.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\insert.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\italic.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\item-publish.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\item-send-back-for-approval.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\item-send-back-for-publication.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\item-send-back-to-draft.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\item-send-forward-for-approval.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\item-send-forward-for-publication.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\item-undo-unpublished-changes.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\item-unpublish.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\keyboard.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\laptop-phone.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\laptop.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\layers.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\leaf.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\license.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\lighter.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\line-spacing.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\linearicons.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\link.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\list.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\loading.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-addsystemlocale.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-changelocale.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-editsystemlocale.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-element-closed-root.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-element-defaultlocaleitem.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-element-localeitem.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-element-opened-root.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-removesystemlocale.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\localization-setasdefault.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\location.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\lock.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\log-viewlog.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\log.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\magic-wand.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\magnifier.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\map-marker.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\map.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-add-media-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-add-media-folder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-delete-media-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-delete-media-folder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-download-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-edit-image-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-edit-media-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-edit-media-folder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-read-only-folder-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-read-only-folder-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-replace-media-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media-upload-zip-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\media.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\menu-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\menu.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\message.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\messageboxaction-defaulticon.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\method-based-function-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\method-based-function-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\method-based-function-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mic.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-3gp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-aac.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ai.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-aiff.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-app.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-asax.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ascx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-asf.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-asm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-asp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-aspx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-avi.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-bmp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-c.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-cat.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-cfg.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-chm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-cpp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-cshtml.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-css.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dat.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-db.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dib.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dir.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-disc.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dmg.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-doc.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-docm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-docx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dot.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dotm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dotx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dvd.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dwg.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dwp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-dxf.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-eml.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-eps.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-est.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-exe.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-flv.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-fwp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-gif.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-h.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-hlp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-hta.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-htm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-html.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-htt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ics.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-inf.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ini.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-iso.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-jfif.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-jpe.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-jpeg.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-jpg.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-js.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-jse.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-key.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-log.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-m4v.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mdb.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mht.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mid.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mov.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mp3.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mp4.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mpd.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mpeg.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mpg.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mpp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mps.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mpt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mpw.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-mpx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-msg.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-msi.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-msp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-num.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ocx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-odp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ods.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-odt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-one.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ots.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ott.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-pdf.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-pgs.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-php.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-png.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-pot.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-potm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-potx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ppa.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-pps.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ppsx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ppt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-psd.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-psp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ptm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ptt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-pub.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-py.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-qt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-ram.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-rar.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-rb.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-resx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-rtf.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-sql.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-stt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-swf.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-tga.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-tgz.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-tif.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-tiff.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-txt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-unknown.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vaw.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vbe.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vbs.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vdx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vsd.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vsl.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vss.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vst.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vsv.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vsw.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vsx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-vtx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wav.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wma.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wmd.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wmf.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wmp.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wms.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wmv.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wmx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-wmz.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xlam.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xls.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xlsb.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xlsm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xlsx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xlt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xltm.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xltx.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xml.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xsd.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xsl.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xslt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-xsn.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-yml.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mimetype-zip.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\moon.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\move.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\music-note.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\mustache.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\neutral.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\next.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\nodes.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\options.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-add-source.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-clear-servercache.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-delete-source.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-available.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-availablegroup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-availableitem.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-installed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-installedgroup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-installeditem.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-local.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-root.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-sourceitem.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-closed-sources.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-item-commercial.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-opened-available.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-opened-availablegroup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-opened-installed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-opened-installedgroup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-opened-local.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-opened-root.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-element-opened-sources.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-install-local-package.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-install-package.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-installer-install.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-installer-readmore.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-installer-uninstall.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-uninstall-local-package.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-uninstall-package.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-view-availableinfo.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\package-view-installedinfo.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-activatelocalization.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-add-page.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-add-sub-page.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-awaiting-approval.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-awaiting-publication.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-break.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-deactivatelocalization.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-delete-page.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-draft.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-edit-page.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-ghosted.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-list-unpublished-items.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-localize-page.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-publication.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-root-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-root-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-feature-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-feature-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-feature-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-feature-root-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-feature-root-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-feature-template.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-root-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-root-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page-template-template.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\page.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-add-metedatafield.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-add-pagetype.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-add-pagetypedefaultpagecontent.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-defaultpagecontent.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-delete-metedatafield.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-delete-pagetype.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-delete-pagetypedefaultpagecontent.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-edit-metedatafield.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-edit-pagetype.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-edit-pagetypedefaultpagecontent.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-pagetype-rootfolder-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-pagetype-rootfolder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pagetype-pagetype.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pallete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\paperclip.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\parameter.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\parameter_missing.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\parameter_overloaded.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\paste.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\paw.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pencil.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-config.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-content.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-datas.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-design.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-developerapplication.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-media.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-system.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-usergroups.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspective-users.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\perspectivetools.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\phone-handset.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\phone.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pie-chart.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pilcrow.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\placeholder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\plus-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pointer-down.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pointer-left.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pointer-right.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pointer-up.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\poop.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\popup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\power-switch.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\previous.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\print.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\pushpin.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\question-circle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\question.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\razor-function-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\razor-function-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\razor-function-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\razor-function.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\recycle.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\redo.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\refresh.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\report.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\reportfunctionaction-defaulticon.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\restart-application.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\rocket.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sad.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\save.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\saveandpublish.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\scale.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\screen.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\security-manage-permissions.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\select.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\seoassistant.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\shirt.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sizeondisk.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sizeonscreen.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\smartphone.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\smile.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sort-alpha-asc.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sort-amount-asc.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\specialchar.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\spell-check.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\spreadsheet.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sql-based-connection-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sql-based-connection-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sql-based-connection-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sql-based-connection.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sql-based-function-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sql-based-function-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sql-based-function-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sql-based-function.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\star-empty.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\star-half.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\star.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\store.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\strikethrough.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sun.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\sync.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\systemlog.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\table.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\tablet.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\tag.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\template.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\text-align-center.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\text-align-justify.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\text-align-left.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\text-align-right.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\text-format-remove.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\text-format.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\text-size.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\text.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\thumbs-down.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\thumbs-up.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\tools.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\train.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\trash.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\tree-add-application.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\tree-localize-data.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\tree-remove-application.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\underline.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\undo.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\unknown.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\unlink.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\unregistered.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\up.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\upload.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\user-group.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\user.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usercontrol-function-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usercontrol-function-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usercontrol-function-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usercontrol-function.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usergroups-addusergroup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usergroups-deleteusergroup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usergroups-editusergroup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usergroups-rootfolder-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usergroups-rootfolder-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\usergroups-usergroup.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-adduser.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-changeownculture.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-changeownpassword.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-changepublicculture.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-changetreeculture.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-deleteuser.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-edituser.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-group-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-group-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-rootfolder-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-rootfolder-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users-user.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\users.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\verification.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\versioning-compare.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\versioning-restore.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\versioning-view.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\visual-function-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\visual-function-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\visual-function-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\volume-high.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\volume-low.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\volume-medium.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\volume.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\warning.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\web-development.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-add-website-folder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-create-website-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-delete-website-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-delete-website-folder.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-edit-website-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-read-only-folder-closed.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-read-only-folder-open.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\website-upload-website-file.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\wheelchair.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\wizard.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\workflowaction-defaulticon.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\wrench.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\wysiwyg-function.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\xslt-based-function-add.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\xslt-based-function-delete.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\xslt-based-function-edit.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\xslt-based-function.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\zoom.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\zoomin.svg\" />\r\n    <Content Include=\"Composite\\images\\icons\\svg\\zoomout.svg\" />\r\n    <Content Include=\"Composite\\images\\top-page-cover-bg.jpg\" />\r\n    <Content Include=\"Composite\\images\\sprite.svg\" />\r\n    <Content Include=\"Composite\\images\\warning.png\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\FunctionService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\PageTemplateService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\pages\\ResponsePageBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\roots\\StyleBinding.js\" />\r\n    <Content Include=\"Composite\\services\\WysiwygEditor\\FunctionService.asmx\" />\r\n    <Content Include=\"Composite\\styles\\default\\fields\\calendar.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\fields\\filepicker.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\fields\\radio.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\fields\\checkbox.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\fields\\datadialog.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\fields\\textbox.less\" />\r\n    <None Include=\"Composite\\styles\\default\\menubar.less\" />\r\n    <None Include=\"Composite\\styles\\default\\editors.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\_mixins.less\" />\r\n    <None Include=\"Composite\\styles\\default\\rtl.less\" />\r\n    <Content Include=\"Composite\\grunt.inc\" />\r\n    <Content Include=\"Composite\\favicon.inc\" />\r\n    <Content Include=\"Composite\\login.inc\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\unsecure.js\" />\r\n    <Content Include=\"Composite\\unsecure.css\" />\r\n    <Content Include=\"Composite\\images\\loading.gif\" />\r\n    <Content Include=\"Composite\\images\\loading.svg\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.PageTemplateFeatureElementProvider.en-us.xml\" />\r\n    <Content Include=\"Composite\\templates\\PageTemplates\\XmlPageTemplate.xml\" />\r\n    <Content Include=\"Composite\\templates\\PageTemplates\\MasterPage.cs.txt\" />\r\n    <Content Include=\"Composite\\templates\\PageTemplates\\MasterPage.txt\" />\r\n    <Content Include=\"Composite\\templates\\PageTemplates\\RazorPageTemplate.txt\" />\r\n    <Compile Include=\"Composite\\top.aspx.designer.cs\">\r\n      <DependentUpon>top.aspx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Renderers\\Page.aspx.cs\">\r\n      <DependentUpon>Page.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Content Include=\"Frontend\\Config\\VisualEditor\\Default.common.xml\" />\r\n    <Content Include=\"jspm.config.js\" />\r\n    <Content Include=\"packages.config\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"DebugBuild.Web.config\" />\r\n    <Content Include=\"test\\e2e\\README.md\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Content Include=\"App_Data\\Composite\\Configuration\\UrlFormatting.xml\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\treeselector\\TreeSelectorToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\FunctionTesterEditFunction.xml\" />\r\n    <Content Include=\"App_Data\\Composite\\TreeDefinitions\\PageType.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\AdministrativeTemplates\\EmptyDocument.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddMediaFileStep1.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddMediaFileStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\InlineFunctionDeleteFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\InlineFunctionEditFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\InlineFunctionAddFunctionStep1.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderConfirmLicense.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\SendMessageToConsoles_EnterMessage.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditMetaData_EditDefinition.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditMetaData_SelectDefinition.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditMetaDataSelectType.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditMetaData_NoDefaultValuesNeeded.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeEditPageTypeMetaDataField.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeDeletePageTypeMetaDataFieldConfirm.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeAddPageTypeMetaDataFieldStep1.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeEditPageTypeDefaultPageContent.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeAddPageTypeDefaultPageContent.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeDeletePageTypeConfirm.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeDeletePageTypePagesRefering.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeEditPageType.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTypeAddPageType.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeLocalizeData.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeConfirmActionConfirm.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeRemoveApplication.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeAddApplication.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeDeleteTreeDefinition.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeAddTreeDefinition.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\bindings\\SourceEditorFormatToolBarButtonBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\bindings\\SourceEditorInsertToolbarButtonBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\bindings\\SourceEditorPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\bindings\\SourceEditorToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\codemirror.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\codemirror.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\codemirror.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\codemirroreditor.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\codemirroreditor\\codemirroreditor.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\functioncalleditor\\bindings\\ToolBarButtonDataBindingAddNew.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\ClassNameSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\FormatSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\TemplateTreeBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\VisualEditorBoxBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\VisualEditorInsertPlusFieldsToolBarButtonBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\VisualEditorInsertToolbarButtonBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\VisualEditorPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\VisualEditorPropertiesToolBarGroupBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\VisualEditorSimpleToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\VisualEditorStatusBarBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\bindings\\VisualEditorToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\scripts\\Format.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositecharmap\\charmap.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositecharmap\\charmap.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositecharmap\\CharMapDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositecharmap\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositefield\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositeimage\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositeimage\\image.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositeimage\\image.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositeimage\\ImageDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositelink\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositelink\\link.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositelink\\LinkDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositeplugin\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositeplugin\\TinyDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositerendering\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\cell.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\merge.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\row.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\table.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\TableCellDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\TableDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\TableMergeCellsDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetable\\TableRowDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetext\\plugin.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetext\\text.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetext\\text.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\plugins\\compositetext\\TextDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\tinymce\\themes\\composite\\theme.min.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\visualeditor.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\visualeditor.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\visualeditor\\visualeditor.js\" />\r\n    <Content Include=\"Composite\\content\\views\\browser\\BrowserAddressBarBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\flushadmin\\Default.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\functioninfo\\ShowFunctionInfo.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\functioninfo\\ShowFunctionInfo.css\" />\r\n    <Content Include=\"Composite\\content\\views\\relationshipgraph\\ShowRelationshipOrientedGraph.aspx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\EmptyDocumentExecutionContainer.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionParameterEditor.aspx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\ComboBox.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\DoubleKeySelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\PageSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\DataReferenceTreeSelector.ascx\" />\r\n    <Compile Include=\"Composite\\top.aspx.cs\">\r\n      <DependentUpon>top.aspx</DependentUpon>\r\n      <SubType>ASPXCodeBehind</SubType>\r\n    </Compile>\r\n    <Content Include=\"Composite\\default.js\" />\r\n    <Content Include=\"Composite\\images\\htmlbox.png\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.PageTypeElementProvider.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.RazorPageTemplate.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.RazorFunction.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.UserControlFunction.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.MasterPagePageTemplate.en-us.xml\" />\r\n    <Content Include=\"Composite\\scripts\\source\\folder-info-readme.txt\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\data\\DataManager.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\document\\DocumentCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\document\\DocumentManager.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\document\\DocumentUpdatePlugin.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\updates\\AttributesUpdate.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\updates\\ReplaceUpdate.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\updates\\SiblingUpdate.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\updates\\Update.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\updates\\UpdateAssistant.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\updates\\UpdateManager.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\updates\\UpdatePlugin.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\window\\WindowAssistant.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\page\\window\\WindowManager.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Application.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\BroadcastMessages.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Client.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Commands.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Constants.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Cookies.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Dialog.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\DialogButton.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Download.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\EventBroadcaster.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Installation.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Interfaces.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Keyboard.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\KeyMaster.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\KickStart.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\util\\SystemNodeList.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\License.DEPRECATED.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Localization.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\LocalStore.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Uri.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\MessageQueue.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\MimeTypes.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Persistance.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Preferences.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Prism.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Resolver.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\SearchTokens.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Snippets.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\StandardEventHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\StatusBar.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\StringBundle.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Templates.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Types.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\Validator.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\core\\ViewDefinitions.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\css\\CSSComputer.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\css\\CSSUtil.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dev\\SystemDebug.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dev\\SystemLogger.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dev\\SystemPerformance.DEPRECATED.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dev\\SystemTimer.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dom\\DOMEvents.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dom\\DOMFormatter.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dom\\DOMSerializer.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dom\\DOMUtil.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dom\\XMLParser.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dom\\XPathResolver.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\dom\\XSLTransformer.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IAcceptable.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IActionListener.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IActivatable.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IActivationAware.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IBroadcastListener.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\ICrawlerHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IData.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IDialogResponseHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IDOMHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IDraggable.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IDragHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IEditorControlBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IEventListener.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IFit.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IFlexible.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IFocusable.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IImageProfile.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IKeyEventHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\ILabel.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\ILoadHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IMenuContainer.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IResizeHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\ISourceEditorComponent.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IUpdateHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IWysiwygEditorComponent.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IWysiwygEditorContentChangeHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\interfaces\\IWysiwygEditorNodeChangeHandler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\namespaces\\Namespaces.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\ConfigurationService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\ConsoleMessageQueueService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\DiffService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\EditorConfigurationService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\FlowControllerService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\InstallationService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\LocalizationService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\LoginService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\MarkupFormatService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\PageService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\ReadyService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\SecurityService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\SEOService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\SetupService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\SourceValidationService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\StringService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\TreeService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\proxies\\XhtmlTransformationsService.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\schema\\Schema.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\schema\\SchemaComplexType.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\schema\\SchemaDefinition.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\schema\\SchemaElementType.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\schema\\SchemaSimpleType.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\schema\\SchemaType.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\services\\WebServiceOperation.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\services\\WebServiceProxy.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\services\\WebServiceResolver.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\soap\\SOAPDecoder.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\soap\\SOAPEncoder.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\soap\\SOAPFault.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\soap\\SOAPMessage.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\soap\\SOAPRequest.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\soap\\SOAPRequestResponse.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\system\\System.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\system\\SystemAction.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\system\\SystemNode.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\balloons\\BalloonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\balloons\\BalloonSetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\Binding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\bindingmappings\\BindingMappingSetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\block\\BlockBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\broadcasters\\BroadcasterBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\broadcasters\\BroadcasterSetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\ButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\ButtonStateManager.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\checkbutton\\CheckButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\clickbutton\\ClickButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\combobutton\\ComboBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\combobutton\\ToolBarComboButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\radiobutton\\RadioButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\radiobutton\\RadioGroupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\toolboxbutton\\ToolBoxToolBarButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\buttons\\viewbutton\\ViewButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\controls\\ControlBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\controls\\ControlBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\controls\\ControlGroupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\cover\\CoverBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\cover\\UncoverBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\cursors\\CursorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\DataBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\DataBindingMap.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\DataDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\DataInputButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\DataInputDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\HTMLDataDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\UrlInputDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\MultiSelectorDataDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\NullPostBackDataDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\NullPostBackDataDialogSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\PostBackDataDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\StringDataDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\dialogs\\ViewDefinitionPostBackDataDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\editors\\EditorDataBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\editors\\FunctionEditorDataBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\editors\\ParameterEditorDataBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\keyboard\\DataInputBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\keyboard\\EditorTextBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\keyboard\\IEEditorTextBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\keyboard\\MozEditorTextBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\keyboard\\TextBoxBinding.BACKUP.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\keyboard\\TextBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\lazy\\LazyBindingBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\lazy\\LazyBindingSetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\misc\\FilePickerBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\radiocheck\\CheckBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\radiocheck\\CheckBoxGroupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\radiocheck\\RadioDataBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\radiocheck\\RadioDataGroupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\selectors\\DataInputSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\selectors\\MultiSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\selectors\\SelectorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\selectors\\SelectorBindingSelection.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\data\\selectors\\SimpleSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\decks\\DeckBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\decks\\DecksBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogBodyBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogBorderBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogControlBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogCoverBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogHeadBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogSetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogTitleBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogTitleBarBodyBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\dialogs\\DialogTitleBarPopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\docks\\DockBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\docks\\DockPanelBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\docks\\DockPanelsBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\docks\\DockTabBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\docks\\DockTabPopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\docks\\DockTabsBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\docks\\DockTabsButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\codemirroreditor\\CodeMirrorEditorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\codemirroreditor\\CodeMirrorEditorPopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\EditorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\EditorClickButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\EditorMenuItemBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\EditorPopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\EditorSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\EditorToolBarButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\visualeditor\\multieditor\\VisualMultiEditorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\visualeditor\\multieditor\\VisualMultiTemplateEditorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\visualeditor\\VisualEditorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\visualeditor\\VisualEditorFieldGroupConfiguration.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\visualeditor\\VisualEditorFormattingConfiguration.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\editors\\visualeditor\\VisualEditorPopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\errors\\ErrorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\explorer\\ExplorerBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\explorer\\ExplorerMenuBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\explorer\\ExplorerToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\explorer\\ExplorerToolBarButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\fields\\FieldBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\fields\\FieldDataBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\fields\\FieldDescBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\fields\\FieldGroupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\fields\\FieldHelpBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\fields\\FieldsBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\flexboxes\\FlexBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\flexboxes\\FlexBoxCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\flexboxes\\ScrollBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\focus\\FocusBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\focus\\FocusCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\keys\\KeySetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\labels\\LabelBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\labels\\TextBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\localization\\LocalizationSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\localstore\\LocalStoreBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\localstore\\LocalStoreWindowBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\menus\\MenuBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\menus\\MenuBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\menus\\MenuBodyBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\menus\\MenuContainerBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\menus\\MenuGroupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\menus\\MenuItemBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\menus\\MenuPopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\pages\\DialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\pages\\DialogPageBodyBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\pages\\EditorPageBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\pages\\MarkupAwarePageBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\pages\\PageBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\pages\\WizardPageBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\persistance\\PersistanceBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\popups\\PopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\popups\\PopupBodyBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\popups\\PopupSetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\progressbar\\ProgressBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\request\\RequestBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\response\\ResponseBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\roots\\RootBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\splitboxes\\SplitBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\splitboxes\\SplitPanelBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\splitboxes\\SplitterBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\abstractions\\StageBoxAbstraction.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\abstractions\\StageBoxHandlerAbstraction.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\decks\\StageDeckBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\decks\\StageDeckRootBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\decks\\StageDecksBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\dialogs\\FitnessCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\dialogs\\StageDialogBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\dialogs\\StageDialogSetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\menus\\StageMenuBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\menus\\StageViewMenuItemBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\splitboxes\\StageSplitBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\splitboxes\\StageSplitPanelBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\splitboxes\\StageSplitterBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\splitboxes\\StageSplitterBodyBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\StageBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\StageContainerBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\StageCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\stage\\statusbar\\StageStatusBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\start\\StartMenuItemBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\system\\SystemPageBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\system\\SystemToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\system\\SystemTreeBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\system\\SystemTreeNodeBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\system\\SystemTreePopupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\tabboxes\\TabBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\tabboxes\\TabBoxBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\tabboxes\\TabPanelBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\tabboxes\\TabPanelsBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\tabboxes\\TabsBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\tabboxes\\TabsButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\theatre\\TheatreBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\toolbars\\DialogToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\toolbars\\ToolBarBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\toolbars\\ToolBarBodyBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\toolbars\\ToolBarButtonBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\toolbars\\ToolBarGroupBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\toolbars\\ToolBarLabelBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\trees\\TreeBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\trees\\TreeBodyBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\trees\\TreeContentBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\trees\\TreeCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\trees\\TreeNodeBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\trees\\TreePositionIndicatorBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\viewers\\SourceCodeViewerBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\views\\ViewBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\views\\ViewSetBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\windows\\PreviewWindowBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\windows\\WindowBinding.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\bindings\\windows\\WindowBindingHighlightNodeCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\UserInterface.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\UserInterfaceMapping.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\Action.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\Animation.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\BindingAcceptor.BACKUP.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\BindingAcceptor.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\BindingBoxObject.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\BindingDragger.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\BindingFinder.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\BindingParser.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\BindingSerializer.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\crawlers\\BindingCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\crawlers\\Crawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\crawlers\\ElementCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\crawlers\\NodeCrawler.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\Dimension.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\Geometry.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\ImageProfile.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\utilities\\Point.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\viewdefinitions\\DialogViewDefinition.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\viewdefinitions\\HostedViewDefinition.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\viewdefinitions\\SystemViewDefinition.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\ui\\viewdefinitions\\ViewDefinition.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\util\\List.js\" />\r\n    <Content Include=\"Composite\\scripts\\source\\top\\util\\Map.js\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\indent.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\left.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\outdent.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\right.png\" />\r\n    <Content Include=\"Composite\\templates\\sourcecodeeditor\\cs.txt\" />\r\n    <Content Include=\"Composite\\templates\\sourcecodeeditor\\js.txt\" />\r\n    <Content Include=\"Composite\\transformations\\defaultfilters\\finalizefilter.xsl\" />\r\n    <Content Include=\"Composite\\transformations\\defaultfilters\\masterfilter.xsl\" />\r\n    <Content Include=\"Composite\\transformations\\defaultfilters\\structurefilter.xsl\" />\r\n    <Content Include=\"Composite\\transformations\\page_profiler.xslt\" />\r\n    <Content Include=\"Composite\\unsecure.aspx\" />\r\n    <Content Include=\"Composite\\unknownbrowser.aspx\" />\r\n    <Content Include=\"Composite\\unsupported.aspx\" />\r\n    <Content Include=\"Composite\\welcome.css\" />\r\n    <Content Include=\"Composite\\Welcome.js\" />\r\n    <Content Include=\"Composite\\welcome.xsl\" />\r\n    <Content Include=\"Frontend\\Config\\VisualEditor\\common.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Frontend\\Config\\VisualEditor\\Images\\bold.png\" />\r\n    <Content Include=\"Frontend\\Config\\VisualEditor\\Images\\italic.png\" />\r\n    <Content Include=\"Frontend\\Config\\VisualEditor\\Images\\left.png\" />\r\n    <Content Include=\"Frontend\\Config\\VisualEditor\\Images\\right.png\" />\r\n    <Content Include=\"Frontend\\Config\\VisualEditor\\Images\\smalltext.png\" />\r\n    <Content Include=\"Frontend\\Config\\VisualEditor\\Styles\\core.css\" />\r\n    <Content Include=\"gruntfile.js\" />\r\n    <Content Include=\"robots.txt\" />\r\n    <Content Include=\"test\\e2e\\ApiLang\\Notepad++\\installation.txt\" />\r\n    <Content Include=\"test\\e2e\\ApiLang\\Notepad++\\Nightwatch.UDL.xml\" />\r\n    <Content Include=\"test\\e2e\\ApiLang\\Notepad++\\nightwatch.xml\" />\r\n    <Content Include=\"test\\e2e\\commands\\assertBrowserContains.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\assertBrowserContainsAttribute.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\assertBrowserContainsWithXpath.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\assertFieldValue.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\assertTreeNodeHasChild.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\assertTreeNodeHasNoChild.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\assertTreeNodeIsEmpty.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\assertTreeNodeIsNotEmpty.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\clickDataBySibilings.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\clickDialogButton.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\clickInFrame.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\clickLabel.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\clickSave.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\clickText.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\closeDocumentTab.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\doubleClickSelector.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\enterFrame.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\installPackage.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\leaveFrame.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\openTreeNode.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\replaceContent.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\replaceTextInCodeMirror.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\rightClickSelector.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\selectActionFromToolbar.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\selectContentTab.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\selectDocumentTab.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\selectFrame.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\selectFrameWithXpath.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\selectPerspective.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\selectTreeNodeAction.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\setFieldValue.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\setFieldValueInFieldGroup.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\setFileFieldValue.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\submitFormData.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\switchContentTab.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\topFrame.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\uninstallPackage.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\waitForDialog.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\waitForFrameLoad.js\" />\r\n    <Content Include=\"test\\e2e\\commands\\waitForFrameLoadwithXpath.js\" />\r\n    <Content Include=\"test\\e2e\\globals.js\" />\r\n    <Content Include=\"test\\e2e\\pageObjects\\appWindow.js\" />\r\n    <Content Include=\"test\\e2e\\pageObjects\\content.js\" />\r\n    <Content Include=\"test\\e2e\\pageObjects\\editor.js\" />\r\n    <Content Include=\"test\\e2e\\pageObjects\\login.js\" />\r\n    <Content Include=\"test\\e2e\\pageObjects\\startScreen.js\" />\r\n    <Content Include=\"test\\e2e\\pageObjects\\systemView.js\" />\r\n    <Content Include=\"test\\e2e\\reset.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\000_setup\\installSite.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\010_setupPackages\\installSQLPackage.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\010_setupPackages\\installVerboseLoggingPackage.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\100_login\\normalMode.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\100_login\\procedure.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\200_startScreen\\display.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\200_startScreen\\logged-in.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\300_appWindow\\has-elements.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\300_appWindow\\stages.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\content\\browseTree.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\content\\multiEditor.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\content\\singleEditor.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\duplicate\\Duplicate.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\duplicate\\DuplicatePagesWithAction.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\duplicate\\DuplicatePagesWithData.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\duplicate\\DuplicatePagesWithMetaData.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\duplicate\\DuplicatePagesWithMetaDataOnType.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\duplicate\\DuplicateTreeAction.js\" />\r\n    <Content Include=\"test\\e2e\\suite\\website-zip-upload-extract\\UploadAndExtractZip.js\" />\r\n    <Content Include=\"test\\unit\\coverage.js\" />\r\n    <Content Include=\"test\\unit\\helpers\\emulateDom.js\" />\r\n    <Content Include=\"test\\unit\\helpers\\expect.js\" />\r\n    <Content Include=\"test\\unit\\helpers\\moduleLoader.js\" />\r\n    <Content Include=\"test\\unit\\helpers\\StatelessWrapper.js\" />\r\n    <Content Include=\"test\\unit\\helpers\\TestComponent.js\" />\r\n    <Content Include=\"test\\unit\\helpers\\ui.js\" />\r\n    <Content Include=\"test\\unit\\helpers\\unexpected-immutable.js\" />\r\n    <Content Include=\"test\\unit\\runner.js\" />\r\n    <Content Include=\"test\\unit\\suite.js\" />\r\n    <Content Include=\"test\\unit\\suite\\access\\requestJSON.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\actions\\fetchFromProvider.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\actions\\fireAction.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\actions\\loadAndOpen.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\actions\\logs.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\actions\\pageDefs.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\actions\\values.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\initState.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\observers.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\reducers\\dataFields.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\reducers\\definitions.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\reducers\\dialog.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\reducers\\layout.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\reducers\\logs.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\reducers\\options.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\reducers\\providers.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\store.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\state\\_setup.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\container\\ConnectDialog.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\container\\ConnectDockPanel.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\container\\ConnectFormPanel.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\container\\ConnectLogPanel.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\container\\ConnectTabPanel.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\container\\ConnectToolbarFrame.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\ActionButton.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\CheckboxGroup.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\DataField.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\Dialog.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\Fieldset.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\FormTab.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\HelpIcon.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\Icon.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\LogPanel.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\Palette.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\SwitchPanel.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\TabBar.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\Toolbar.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\presentation\\ToolbarFrame.spec.js\" />\r\n    <Content Include=\"test\\unit\\suite\\view\\_setup.js\" />\r\n    <Content Include=\"Web.config\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\Installation\\InstallationService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\Setup\\SetupService.asmx\">\r\n    </Content>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Content Include=\"default.aspx\" />\r\n    <Content Include=\"Global.asax\" />\r\n    <Content Include=\"ReleaseBuild.Global.asax\" />\r\n    <Content Include=\"Renderers\\Page.aspx\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Content Include=\"Composite\\applets\\custom_rhino.jar\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\about\\about.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\about\\about.css\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\about\\About.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\functions\\editFunctionCall.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\functions\\EditFunctionCallDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\imageeditor\\scaleimage\\scaleimage.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\imageeditor\\scaleimage\\ScaleImageDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\multiselector\\multiselectordialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\multiselector\\MultiSelectorDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\options\\options.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\options\\OptionsDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\save\\saveall.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\save\\SaveAllDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\standard\\standard.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\standard\\StandardDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\systemtrees\\detailedpaste.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\systemtrees\\DetailedPastePageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\autoheight\\autoheightdialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\datadialog\\datadialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\fixedheight\\fixedheightdialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\forcefitness\\forcefitness-advanced.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\forcefitness\\forcefitness-basic.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\multipage\\page1.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\multipage\\page2.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\subpages\\sub1.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\subpages\\sub2.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\subpages\\sub3.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\subpages\\sub4.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\subpages\\subpagedialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\wizard\\wizard1.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\wizard\\wizard2.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\wizard\\wizard3.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\tests\\wizard\\wizard4.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\translations\\translations.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\translations\\TranslationsDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\treeselector\\treeselector.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\treeselector\\treeselector.css\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\treeselector\\TreeSelectorDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\webservices\\error.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\webservices\\error.css\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\webservices\\error.png\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\webservices\\WebServiceErrorDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\wysiwygeditor\\errors\\contenterror.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\wysiwygeditor\\errors\\ContentErrorDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\wysiwygeditor\\mozsecuritynote\\mozsecuritynote.aspx\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\wysiwygeditor\\visualeditordialog.css\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\wysiwygeditor\\VisualEditorDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\dialogs\\wysiwygeditor\\wysiwygeditordialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\flow\\FlowUi.aspx\" />\r\n    <Content Include=\"Composite\\content\\flow\\FlowUiCompleted.aspx\" />\r\n    <Content Include=\"Composite\\content\\flow\\FlowUICompleted.css\" />\r\n    <Content Include=\"Composite\\content\\flow\\FlowUICompleted.js\" />\r\n    <Content Include=\"Composite\\content\\flow\\FlowUiCompletedDialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\flow\\FlowUICompletedPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\forms\\AdministrativeTemplates\\ConfirmDialog.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\AdministrativeTemplates\\DataDialog.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\AdministrativeTemplates\\Document.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\AdministrativeTemplates\\Wizard.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddAssociatedDataWorkflowTypeSelection.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddAssociatedTypeAddExisting.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddAssociatedTypeAddExistingSelectForeignKey.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddAssociatedTypeAddingTypeSelection.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddAssociatedTypeAssociationTypeSelection.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddAssociatedTypeCompositionScopeSelection.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddAssociatedTypeFinalInfo.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddAssociatedTypeLevelsScopeSelection.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddDataFolderCreateNewType.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddDataFolderExSelectType.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddDataFolderSelectType.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddMetaDataCreateFieldGroup.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddMetaDataNoTargetDataWarning.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddMetaDataSelectType.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewCompositionTypeStep1.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewInterfaceTypeStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewMediaFolder.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewMethodBasedFunctionStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewMethodBasedFunctionStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewMethodBasedFunctionStep3.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewPageStep1.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewPageStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplate\\AddNewXmlPageTemplate.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewSqlFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewSqlFunctionConnection.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewUserStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewVisualFunctionStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewVisualFunctionStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddNewXsltFunctionStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddPageHostNameBindings.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddSystemLocaleStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AddZipMediaFile.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\AllFunctionsElementProviderSearchForm.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\ChangeOwnCulture.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\ChangeOwnCultureConfirmReboot.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\ChangeOwnForeignLocaleNoOrOneActiveLocale.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\ChangeOwnForeignLocaleStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\ChangeOwnPassword.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\CreateNewAssociatedTypeStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteAggregationTypeStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteAssociatedTypeDataStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteCompositionTypeStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteDataFolderConfirm.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteDataFolderConfirmDeletingRelatedData.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteGeneratedDataStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteGeneratedDataStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteGeneratedInteraceStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteMediaFile.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteMediaFileConfirmRemovingRelatedData.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteMediaFolder.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteMediaFolderConfirmDeletingRelatedData.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteMetaDataConfirm.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeletePageStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeletePageStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeletePageStep3.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeletePageTemplateStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteUserStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteVisualFunctionStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DeleteXsltFunctionConfirm.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DisableTypeLocalizationStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\DisableTypeLocalizationStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditCompositionTypeStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditDynamicTypeFormMarkup.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditInterfaceTypeStep1.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditMediaFile.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditMediaFileTextContent.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditMediaFolder.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditMethodBasedFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditPage.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PageTemplate\\EditXmlPageTemplate.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditSqlFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditSqlFunctionConnection.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditSystemLocaleEdit.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditUserStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditVisualFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EditXsltFunction.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\ElementKeywordSearch.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EnableTypeLocalizationNoLocales.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EnableTypeLocalizationStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EnableTypeLocalizationStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EnableTypeLocalizationStep3.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\EntityTokenLockedStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\LocalizeData.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\MethodBasedFunctionProviderElementProviderDeleteStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderAddPackageSourceStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderAddPackageSourceStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderDeletePackageSourceStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallLocalPackageShowError.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallLocalPackageStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallLocalPackageStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallLocalPackageStep3.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallRemotePackageShowError.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallRemotePackageStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallRemotePackageStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallRemotePackageStep3.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallRemotePackageStep4.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderInstallRemotePackageStep5.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallLocalPackageShowError.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallLocalPackageStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallLocalPackageStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallLocalPackageStep3.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallRemotePackageShowError.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallRemotePackageShowUnregistreError.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallRemotePackageStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallRemotePackageStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderUninstallRemotePackageStep3.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderViewAvailablePackageInformation.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderViewAvailablePackageInformationToolbar.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderViewInstalledPackageInformation.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\PackageElementProviderViewInstalledPackageInformationToolbar.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\RemoveAssociatedTypeFinalInfo.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\RemoveAssociatedTypeSelectAssociationType.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\RemoveAssociatedTypeSelectRuleName.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\RemoveAssociatedTypeSelectType.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\RemovePageHostNameBindings.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\RemoveSystemLocaleAbort.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\RemoveSystemLocaleStep2.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\SecurityViolationStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\SqlFunctionElementProviderDeleteSqlConnection.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\SqlFunctionElementProviderDeleteSqlFunction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\UploadMediaFile.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\UploadNewMediaFile.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\VisualFunctionElementProviderHelperAddNewStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\VisualFunctionElementProviderHelperDeleteStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\VisualFunctionElementProviderHelperEdit.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\VisualFunctionElementProviderHelperSelect.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\WebsiteFileElementProviderAddNewFile.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\WebsiteFileElementProviderAddNewFolder.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\WebsiteFileElementProviderDeleteFile.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\WebsiteFileElementProviderDeleteFolder.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\WebsiteFileElementProviderEditTextContentFile.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\WebsiteFileElementProviderUploadNewWebsiteFile.xml\" />\r\n    <Content Include=\"Composite\\content\\misc\\errors\\error.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\errors\\error.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\errors\\error_dialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\errors\\licenseviolation.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\errors\\licenseviolation_dialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\errors\\ServerErrorDialogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\errors\\ServerErrorPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\gatekeeper\\AllUsersAllowedFiles\\Arrow.png\" />\r\n    <Content Include=\"Composite\\content\\misc\\gatekeeper\\AllUsersAllowedFiles\\BackgroundGradient.png\" />\r\n    <Content Include=\"Composite\\content\\misc\\gatekeeper\\AllUsersAllowedFiles\\IconExclamation.png\" />\r\n    <Content Include=\"Composite\\content\\misc\\gatekeeper\\AllUsersAllowedFiles\\IconLock.png\" />\r\n    <Content Include=\"Composite\\content\\misc\\gatekeeper\\AllUsersAllowedFiles\\PreLoginPage.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\gatekeeper\\PreLoginPageTemplate.ascx\" />\r\n    <Content Include=\"Composite\\content\\misc\\stage\\stagedeck.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\stage\\stagedeck.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\viewers\\sourcecodeviewer\\images\\minus.png\" />\r\n    <Content Include=\"Composite\\content\\misc\\viewers\\sourcecodeviewer\\images\\plus.png\" />\r\n    <Content Include=\"Composite\\content\\misc\\viewers\\sourcecodeviewer\\viewsourcecontent.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\viewers\\sourcecodeviewer\\viewsourcecontent.css\" />\r\n    <Content Include=\"Composite\\content\\misc\\viewers\\sourcecodeviewer\\viewsourcecontent.js\" />\r\n    <Content Include=\"Composite\\content\\views\\browser\\browser.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\browser\\browser.css\" />\r\n    <Content Include=\"Composite\\content\\views\\browser\\BrowserPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\browser\\BrowserTabBoxBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\browser\\LanguageSelectorBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\datatypedescriptor\\ToXml.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\developer.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\Developer.js\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\all\\fields.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\all\\fieldsframe.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\checkboxes.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\datainputs.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\htmldatadialog.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\lazybindings.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\radiogroups.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\relations.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\selectors.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\sourceeditors.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\sourcodeeditorbug\\testA.html\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\sourcodeeditorbug\\testB.html\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\sourcodeeditorbug\\testC.html\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\specialdatainputs.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\textboxes.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\visualeditors.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\wyswiwygeditors.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\buttons.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\crawlers.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\crawlers.js\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\domevents.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\focus.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\icons.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\iebug.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\memory.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\menus.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\pageeditorfull.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\persistance.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\sourcecodeviewers.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\special.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\special.css\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\splitboxes.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\tabboxes.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\trees.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\TreeTest.js\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\ui\\xmleditor.jar\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\systemlog\\systemlog.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\systemlog\\systemlog.css\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\systemlog\\systemlogoutput.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\systemlog\\systemlogoutput.css\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\systemlog\\SystemLogPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\blank.html\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\images\\minus.png\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\images\\plus.png\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\viewsource.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\viewsource.css\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\viewsourcecontent.css\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\viewsourcecontent.html\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\viewsourcecontent.js\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\viewsource\\ViewSourcePageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\bindings\\ImageBoxBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\bindings\\ImageCursorBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\bindings\\ImageEditorPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\bindings\\ImageScrollBoxBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\bindings\\ImageSelectionBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\bindings\\ImageStageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\bindings\\ImageToolBoxBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\bindings\\ImageToolBoxDraggerBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\blank.png\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\imageeditor.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\imageeditor.css\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\ImageEditor.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\ImageEditorAction.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\imageeditor\\ImageEditorActions.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\permissioneditor\\permissioneditor.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\permissioneditor\\permissioneditor.css\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\permissioneditor\\PermissionEditorGridBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\permissioneditor\\PermissionEditorHeadBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\editors\\permissioneditor\\PermissionEditorPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\functiondoc\\FunctionDocumentation-print.css\" />\r\n    <Content Include=\"Composite\\content\\views\\functiondoc\\FunctionDocumentation.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\functiondoc\\FunctionDocumentation.css\" />\r\n    <Content Include=\"Composite\\content\\views\\help\\help.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\help\\HelpPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\log\\log.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\log\\log.css\" />\r\n    <Content Include=\"Composite\\content\\views\\publishworkflowstatus\\ViewUnpublishedItems.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\publishworkflowstatus\\ViewUnpublishedItems.css\" />\r\n    <Content Include=\"Composite\\content\\views\\publishworkflowstatus\\ViewUnpublishedItems.xslt\" />\r\n    <Content Include=\"Composite\\content\\views\\relationshipgraph\\Default.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\search\\search.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\search\\search.css\" />\r\n    <Content Include=\"Composite\\content\\views\\search\\SearchPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\seoassist\\bindings\\SEOAssistantPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\seoassist\\scripts\\SEODOMParser.js\" />\r\n    <Content Include=\"Composite\\content\\views\\seoassist\\scripts\\SEOResult.js\" />\r\n    <Content Include=\"Composite\\content\\views\\seoassist\\seoassist.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\seoassist\\seoassist.css\" />\r\n    <Content Include=\"Composite\\content\\views\\start\\start.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\start\\StartPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\views\\systemview\\systemview.aspx\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Cultures.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.EntityTokenLocked.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.GeneratedTypes.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Management.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.NameValidation.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Core.PackageSystem.PackageFragmentInstallers.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.Permissions.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.C1Console.SecurityViolation.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.AllFunctionsElementProvider.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.GeneratedDataTypesElementProvider.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.GenericPublishProcessController.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.LocalizationElementProvider.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.MethodBasedFunctionProviderElementProvider.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.PackageElementProvider.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.PageElementProvider.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.PageTemplateElementProvider.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.SqlFunction.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.StandardFunctions.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.VisualFunction.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.WebsiteFileElementProvider.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.XsltBasedFunction.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.C1Console.Users.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Web.FormControl.FunctionCallsDesigner.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Web.FormControl.FunctionParameterDesigner.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Web.FormControl.TypeFieldDesigner.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Web.SEOAssistant.en-us.xml\" />\r\n    <Content Include=\"Composite\\schemas\\FormsControls\\GenerateDynamicSchemas.aspx\" />\r\n    <Content Include=\"Renderers\\FileNotFoundHandler.ashx\" />\r\n    <Content Include=\"Renderers\\ShowMedia.ashx\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Content Include=\"App_Data\\Composite\\Composite.config\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"App_Data\\Composite\\ReleaseBuild.Composite.config\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"App_Data\\Composite\\app_offline.htm\" />\r\n    <Content Include=\"App_Data\\Composite\\ReleaseBuild.Composite.config.changeHistory.txt\" />\r\n    <Content Include=\"Composite\\app.aspx\" />\r\n    <Content Include=\"Composite\\blank.aspx\" />\r\n    <Content Include=\"Composite\\compile.aspx\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\ReportFunctionAction.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeGenericDeleteConfirm.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeGenericDeleteConfirmDeletingRelatedData.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\WebsiteFileElementProviderUploadNewWebsiteFileConfirm.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\TreeEditDefinition.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\UserGroupElementProviderDeleteUserGroupStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\UserGroupElementProviderEditUserGroupStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\forms\\Administrative\\UserGroupElementProviderAddNewUserGroupStep1.xml\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\functioncalleditor\\bindings\\FieldsButtonDataBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\functioncalleditor\\bindings\\FunctionEditorPageBinding.js\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\functioncalleditor\\functioncalleditor.aspx\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\functioncalleditor\\functioneditor-sample-function.xml\" />\r\n    <Content Include=\"Composite\\content\\misc\\editors\\functioncalleditor\\functioneditortree.xslt\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\content\\views\\dev\\developer\\tests\\fields\\postbackfun.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\showelementinformation\\Default.aspx\" />\r\n    <Content Include=\"Composite\\content\\views\\start\\GetStartPage.ashx\" />\r\n    <Content Include=\"Composite\\controls\\AppInitializerControl.ascx\" />\r\n    <Content Include=\"Composite\\controls\\CodePressControl.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FieldGroupControl.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\DataDialogExecutionContainer.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\DocumentExecutionContainer.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\FormUIStandardDialogs\\ConfirmDialogExecutionContainer.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\FormUIStandardDialogs\\WarningDialogExecutionContainer.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiContainerTemplates\\WizardExecutionContainer.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\BoolSelectors\\BoolSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\BoolSelectors\\CheckBox.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\CancelButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\FinishButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\NextButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\OkButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\PreviewPanel.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\PreviousButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\SaveAsButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\SaveButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\ToolbarButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Buttons\\WizardCancelButton.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\ConfirmDialogCanvas.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\DialogCanvas.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\DialogToolbar.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\DocumentBody.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\FieldGroup.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\InfoBox.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\PlaceHolder.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\TabPanels.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Containers\\Toolbar.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Customized\\PageContentEditor.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DateTimeSelectors\\DateSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionCallsDesigner.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionCallsDesigner.css\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionCallsDesigner.Function.TreeBinding.js\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionCallsDesigner.UiTree.xsl\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionCallsDesigner.Widget.TreeBinding.js\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\FunctionParameterDesigner.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\MarkupEditor.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\SqlEditor.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\TextEditor.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\TypeFieldDesigner.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\TypeFieldDesigner.css\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\DeveloperTools\\XsltEditor.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\EnumSelectors\\EnumSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\FileUploaders\\FileUpload.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\RichContent\\InlineXhtmlEditor.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\RichContent\\MultiContentXhtmlEditor.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\RichContent\\XhtmlEditor.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\DataReferenceSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\MultiKeySelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Selectors\\Selector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\TextInput\\TextArea.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\TextInput\\TextBox.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Text\\HtmlBlob.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Text\\LongText.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Text\\Heading.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Text\\InfoTable.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Text\\InfoTable.css\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\Text\\Text.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\TypeSelectors\\TypeSelector.ascx\" />\r\n    <Content Include=\"Composite\\controls\\FormsControls\\Helpers\\StyleFileLoaderControl.ascx\" />\r\n    <Content Include=\"Composite\\controls\\HttpHeadersControl.ascx\" />\r\n    <Content Include=\"Composite\\controls\\Misc\\MarkupInOutView.ascx\" />\r\n    <Content Include=\"Composite\\controls\\Misc\\MarkupInOutView.css\" />\r\n    <Content Include=\"Composite\\controls\\RegisterOutputTransformation.ascx\" />\r\n    <Content Include=\"Composite\\controls\\ScriptLoaderControl.ascx\" />\r\n    <Content Include=\"Composite\\controls\\StageDeckControl.ascx\" />\r\n    <Content Include=\"Composite\\controls\\StyleLoaderControl.ascx\" />\r\n    <Content Include=\"Composite\\dead.aspx\" />\r\n    <Content Include=\"Composite\\default.aspx\" />\r\n    <Content Include=\"Composite\\develop.aspx\" />\r\n    <Content Include=\"Composite\\extensions\\compositec1\\chrome\\content\\compositec1.css\" />\r\n    <Content Include=\"Composite\\extensions\\compositec1\\chrome\\content\\CompositeC1.js\" />\r\n    <Content Include=\"Composite\\help\\help.css\" />\r\n    <Content Include=\"Composite\\help\\help.js\" />\r\n    <Content Include=\"Composite\\help\\help.xsl\" />\r\n    <Content Include=\"Composite\\images\\actionended.png\" />\r\n    <Content Include=\"Composite\\images\\blank.png\" />\r\n    <Content Include=\"Composite\\images\\fieldbox.png\" />\r\n    <Content Include=\"Composite\\images\\progressbar.png\" />\r\n    <Content Include=\"Composite\\images\\unfortunateerror.png\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Plugins.UserGroupElementProvider.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Web.PageBrowser.en-us.xml\" />\r\n    <Content Include=\"Composite\\localization\\Composite.Web.SourceEditor.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.Web.VisualEditor.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\localization\\Composite.C1Console.Trees.en-us.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\Login.aspx\" />\r\n    <Content Include=\"Composite\\postback.aspx\" />\r\n    <Content Include=\"Composite\\postback.css\" />\r\n    <Content Include=\"Composite\\postback.js\" />\r\n    <Content Include=\"Composite\\schemas\\default.aspx\" />\r\n    <Content Include=\"Composite\\CompileScripts.xml\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\LogService\\LogService.svc\" />\r\n    <Content Include=\"Composite\\services\\WysiwygEditor\\ControlConfiguration.xsl\" />\r\n    <Content Include=\"Composite\\skins\\system\\editors\\redo-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\editors\\redo.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\editors\\save-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\editors\\save.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\editors\\saveas-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\editors\\saveas.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\editors\\undo-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\editors\\undo.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\imageeditor\\select16.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\imageeditor\\select24.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\bold-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\bold.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\bullist-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\bullist.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\class.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\classnameselector-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\classnameselector.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\cleanup.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\copy.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\cut.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\design.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\format.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\formatselector-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\formatselector.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\image.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\insert.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\italic-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\italic.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\justifycenter-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\justifycenter.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\justifyfull-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\justifyfull.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\justifyleft-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\justifyleft.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\justifyright-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\justifyright.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\link.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\numlist-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\numlist.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\paste.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\source.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\strikethrough-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\strikethrough.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_cell_props.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_delete.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_delete_col.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_delete_row.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_insert_col_after.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_insert_col_before.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_insert_row_after.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_insert_row_before.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_merge_cells.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_row_props.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\table_split_cells.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\underline-disabled.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\underline.png\" />\r\n    <Content Include=\"Composite\\skins\\system\\wysiwygeditor\\unlink.png\" />\r\n    <None Include=\"Composite\\styles\\default\\balloons.less\" />\r\n    <None Include=\"Composite\\styles\\default\\base.less\" />\r\n    <None Include=\"Composite\\styles\\default\\bindingmappings.less\" />\r\n    <None Include=\"Composite\\styles\\default\\broadcasters.less\" />\r\n    <None Include=\"Composite\\styles\\default\\buttons.less\" />\r\n    <None Include=\"Composite\\styles\\default\\controls.less\" />\r\n    <None Include=\"Composite\\styles\\default\\cursors.less\" />\r\n    <None Include=\"Composite\\styles\\default\\decks.less\" />\r\n    <None Include=\"Composite\\styles\\default\\dialogs\\dialogvignette.less\" />\r\n    <None Include=\"Composite\\styles\\default\\dialogs\\dialogs.less\" />\r\n    <None Include=\"Composite\\styles\\default\\docks.less\" />\r\n    <None Include=\"Composite\\styles\\default\\errors.less\" />\r\n    <None Include=\"Composite\\styles\\default\\explorer.less\" />\r\n    <None Include=\"Composite\\styles\\default\\keys.less\" />\r\n    <None Include=\"Composite\\styles\\default\\labels.less\" />\r\n    <None Include=\"Composite\\styles\\default\\lazybindings.less\" />\r\n    <None Include=\"Composite\\styles\\default\\menus.less\" />\r\n    <None Include=\"Composite\\styles\\default\\pages.less\" />\r\n    <None Include=\"Composite\\styles\\default\\popups.less\" />\r\n    <None Include=\"Composite\\styles\\default\\fields\\selectors.less\" />\r\n    <None Include=\"Composite\\styles\\default\\sourcecodeviewers.less\" />\r\n    <None Include=\"Composite\\styles\\default\\splitboxes.less\" />\r\n    <None Include=\"Composite\\styles\\default\\tabboxes.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\tables.less\" />\r\n    <None Include=\"Composite\\styles\\default\\texts.less\" />\r\n    <None Include=\"Composite\\styles\\default\\titlebars.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\toolbars\\system.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\toolbars\\visual-editor.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\toolbars\\nav-toolbar.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\toolbars\\document-toolbar.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\toolbars\\statusbar.less\" />\r\n    <None Include=\"Composite\\styles\\default\\toolbars\\toolbars-base.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\toolbars\\pagetemplates.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\toolbars\\codemirror-editor.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\toolbars\\dialog.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\trees\\genericview-tree.less\" />\r\n    <None Include=\"Composite\\styles\\default\\trees\\trees-base.less\" />\r\n    <None Include=\"Composite\\styles\\default\\updatepanels.less\" />\r\n    <None Include=\"Composite\\styles\\default\\views.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\_normalize.less\" />\r\n    <Content Include=\"Composite\\styles\\default\\_helpers.less\" />\r\n    <None Include=\"Composite\\styles\\styles.less\" />\r\n    <Content Include=\"Composite\\templates\\defaultstagedeck.xml\" />\r\n    <Content Include=\"Composite\\templates\\matrixbindingelement.xml\" />\r\n    <Content Include=\"Composite\\templates\\soapenvelope.xml\" />\r\n    <Content Include=\"Composite\\templates\\sourcecodeeditor\\css.txt\" />\r\n    <Content Include=\"Composite\\templates\\sourcecodeeditor\\html.txt\" />\r\n    <Content Include=\"Composite\\templates\\sourcecodeeditor\\sql.txt\" />\r\n    <Content Include=\"Composite\\templates\\sourcecodeeditor\\xml.txt\" />\r\n    <Content Include=\"Composite\\templates\\sourcecodeeditor\\xsl.txt\" />\r\n    <Content Include=\"Composite\\templates\\sourceeditor\\popup.xml\" />\r\n    <Content Include=\"Composite\\templates\\storagetemplates\\persistance.xml\" />\r\n    <Content Include=\"Composite\\templates\\wysiwygeditorplugins\\mediaflashoptions.xml\" />\r\n    <Content Include=\"Composite\\templates\\wysiwygeditorplugins\\mediaquicktimeoptions.xml\" />\r\n    <Content Include=\"Composite\\templates\\wysiwygeditorplugins\\mediashockwaveoptions.xml\" />\r\n    <Content Include=\"Composite\\templates\\wysiwygeditorplugins\\mediawinmediaoptions.xml\" />\r\n    <Content Include=\"Composite\\templates\\wysiwygeditor\\popup.xml\" />\r\n    <Content Include=\"Composite\\top.aspx\" />\r\n    <Content Include=\"Composite\\top.css\" />\r\n    <Content Include=\"Composite\\transformations\\viewsource-xml.xsl\" />\r\n    <Content Include=\"Composite\\transformations\\WysiwygEditor_StructuredContentToTinyContent.xsl\" />\r\n    <Content Include=\"Composite\\transformations\\WysiwygEditor_TinyContentToStructuredContent.xsl\" />\r\n    <Content Include=\"Composite\\updated.aspx\" />\r\n    <Content Include=\"Composite\\updated.js\" />\r\n    <Content Include=\"Composite\\help\\help.ashx\" />\r\n    <Content Include=\"App_Data\\Razor\\web.config\" />\r\n    <Content Include=\"Composite\\services\\Media\\Upload.ashx\" />\r\n    <None Include=\"Composite\\content\\misc\\editors\\visualeditor\\includes\\toolbaradvanced.inc\" />\r\n    <None Include=\"Composite\\content\\misc\\editors\\visualeditor\\includes\\toolbarsimple.inc\" />\r\n    <Content Include=\"Composite\\controls\\Razor\\RazorLayout.cshtml\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\icons\\svg\\sprite.cshtml\" />\r\n    <Content Include=\"Composite\\content\\views\\dev\\icons\\svg\\web.config\" />\r\n    <None Include=\"Composite\\extensions\\compositec1\\chrome.manifest\" />\r\n    <None Include=\"Composite\\extensions\\compositec1\\chrome\\content\\compositec1.xul\" />\r\n    <None Include=\"Composite\\extensions\\compositec1\\compositec1.xpi\" />\r\n    <None Include=\"Composite\\extensions\\compositec1\\install.rdf\" />\r\n    <Content Include=\"Composite\\images\\loading.svg.ashx\" />\r\n    <None Include=\"Composite\\images\\logo.xcf\" />\r\n    <Content Include=\"Composite\\ping.ashx\" />\r\n    <None Include=\"Composite\\schemas\\FormsControls\\AspNetManagement__www_composite_net_ns_management_bindingforms_internal_ui_controls_lib_1_0.xsd\" />\r\n    <None Include=\"Composite\\schemas\\FormsControls\\AspNetManagement__www_composite_net_ns_management_bindingforms_std_ui_controls_lib_1_0.xsd\" />\r\n    <None Include=\"Composite\\schemas\\FormsControls\\bindingforms10.xsd\" />\r\n    <None Include=\"Composite\\schemas\\FormsControls\\functions__www_composite_net_ns_management_bindingforms_std_function_lib_1_0.xsd\" />\r\n    <Content Include=\"Composite\\services\\Media\\ImageManipulator.ashx\" />\r\n    <Content Include=\"Composite\\services\\WysiwygEditor\\FieldImage.ashx\" />\r\n    <Content Include=\"Composite\\services\\Admin\\DownloadFile.ashx\" />\r\n    <None Include=\"Composite\\schemas\\Functions\\Function.xsd\">\r\n      <SubType>Designer</SubType>\r\n    </None>\r\n    <None Include=\"Composite\\schemas\\Trees\\Tree.xsd\">\r\n      <SubType>Designer</SubType>\r\n    </None>\r\n    <Content Include=\"Composite\\services\\WysiwygEditor\\getconfig.ashx\" />\r\n    <Content Include=\"Composite\\services\\WysiwygEditor\\PageTemplate.asmx\" />\r\n    <Content Include=\"Composite\\web.config\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"ReleaseCleanupConfiguration.xml\" />\r\n    <Content Include=\"Composite\\webauthorization.config\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"ReleaseBuild.Web.config\">\r\n      <SubType>Designer</SubType>\r\n    </Content>\r\n    <Content Include=\"Renderers\\Captcha.ashx\" />\r\n    <Content Include=\"Composite\\services\\Configuration\\ConfigurationService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\ConsoleMessageQueue\\ConsoleMessageQueueServices.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\FlowController\\FlowControllerServices.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\Localization\\LocalizationService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\Login\\Login.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\Page\\PageService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\Ready\\ReadyService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\SearchEngineOptimizationKeyword\\SearchEngineOptimizationKeyword.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\SourceEditor\\MarkupFormatService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\SourceEditor\\SourceValidationService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\StringResource\\DiffService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\StringResource\\StringService.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\Tree\\SecurityServices.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\Tree\\TreeServices.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\WysiwygEditor\\ConfigurationServices.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\services\\WysiwygEditor\\XhtmlTransformations.asmx\">\r\n    </Content>\r\n    <Content Include=\"Composite\\styles\\default\\_variables.less\" />\r\n    <None Include=\"Composite\\welcome.inc\" />\r\n    <Content Include=\"Renderers\\FunctionPreview.ashx\" />\r\n    <Content Include=\"Renderers\\TemplatePreview.ashx\" />\r\n    <Content Include=\"package.json\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Folder Include=\"App_Data\\Composite\\DynamicTypeForms\\\" />\r\n    <Folder Include=\"App_Data\\UserControls\\\" />\r\n    <Folder Include=\"Composite\\content\\dialogs\\querytreeeditor\\\" />\r\n    <Folder Include=\"Composite\\content\\views\\mediabrowser\\\" />\r\n    <Folder Include=\"Composite\\controls\\FormsControls\\FormUiControlTemplates\\ElementSelectors\\\" />\r\n    <Folder Include=\"Composite\\images\\icons\\branding\\\" />\r\n    <Folder Include=\"Frontend\\Controls\\\" />\r\n    <Folder Include=\"Frontend\\Images\\\" />\r\n    <Folder Include=\"Frontend\\Scripts\\\" />\r\n    <Folder Include=\"Frontend\\Styles\\\" />\r\n    <Folder Include=\"Properties\\\" />\r\n    <Folder Include=\"test\\unit\\suite\\state\\selectors\\\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ProjectReference Include=\"..\\Composite.Workflows\\Composite.Workflows.csproj\">\r\n      <Project>{1fe08476-346a-4053-813d-8807c0e0fc36}</Project>\r\n      <Name>Composite.Workflows</Name>\r\n    </ProjectReference>\r\n    <ProjectReference Include=\"..\\Composite\\Composite.csproj\">\r\n      <Project>{f8d87a5f-d090-4d24-80c1-dbcd938c6cab}</Project>\r\n      <Name>Composite</Name>\r\n    </ProjectReference>\r\n  </ItemGroup>\r\n  <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />\r\n  <Import Project=\"$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v10.0\\WebApplications\\Microsoft.WebApplication.targets\" Condition=\"false\" />\r\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r\n       Other similar extension points exist, see Microsoft.Common.targets.\r\n  <Target Name=\"BeforeBuild\">\r\n  </Target>\r\n  <Target Name=\"AfterBuild\">\r\n  </Target>\r\n  -->\r\n  <ProjectExtensions>\r\n    <VisualStudio>\r\n      <FlavorProperties GUID=\"{349c5851-65df-11da-9384-00065b846f21}\">\r\n        <WebProjectProperties>\r\n          <UseIIS>False</UseIIS>\r\n          <AutoAssignPort>False</AutoAssignPort>\r\n          <DevelopmentServerPort>7913</DevelopmentServerPort>\r\n          <DevelopmentServerVPath>/</DevelopmentServerVPath>\r\n          <IISUrl>http://localhost:7913/</IISUrl>\r\n          <NTLMAuthentication>False</NTLMAuthentication>\r\n          <UseCustomServer>False</UseCustomServer>\r\n          <CustomServerUrl>http://localhost:1757/</CustomServerUrl>\r\n          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>\r\n        </WebProjectProperties>\r\n      </FlavorProperties>\r\n    </VisualStudio>\r\n  </ProjectExtensions>\r\n  <PropertyGroup>\r\n    <PreBuildEvent>\r\n      if not exist \"$(ProjectDir)web.config\" (\r\n      copy \"$(ProjectDir)DebugBuild.Web.config\" \"$(ProjectDir)Web.config\"\r\n      )\r\n\r\n      if not exist \"$(ProjectDir)App_Data\\Composite\\Composite.config\" (\r\n      copy \"$(ProjectDir)App_Data\\Composite\\DebugBuild.Composite.config\" \"$(ProjectDir)App_Data\\Composite\\Composite.config\"\r\n      )\r\n\r\n      if not exist \"$(ProjectDir)Frontend\\Config\\VisualEditor\\common.xml\" (\r\n      copy \"$(ProjectDir)Frontend\\Config\\VisualEditor\\ReleaseBuild.common.xml\" \"$(ProjectDir)Frontend\\Config\\VisualEditor\\common.xml\"\r\n      )\r\n\r\n      if not exist \"$(TargetDir)\\System.Threading.Tasks.Dataflow.dll\" (\r\n      copy \"$(ProjectDir)\\..\\Packages\\System.Threading.Tasks.Dataflow.4.7.0\\lib\\netstandard1.1\\System.Threading.Tasks.Dataflow.dll\" \"$(TargetDir)\\System.Threading.Tasks.Dataflow.dll\"\r\n      )\r\n\r\n      cd \"$(ProjectDir)\"\r\n      robocopy \"..\\Packages\\PhantomJS.2.1.1\\tools\\phantomjs\" \"App_Data\\Composite\\PhantomJs\" \"phantomjs.exe\"\r\n\r\n\t\t\t.\\node_modules\\.bin\\jspm install --quick\r\n\r\n      set rce=%25errorlevel%25\r\n      if not %25rce%25==1 exit %25rce%25 else exit 0</PreBuildEvent>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <PostBuildEvent>\r\n    </PostBuildEvent>\r\n  </PropertyGroup>\r\n</Project>\r\n"
  },
  {
    "path": "Website/WebSite.csproj.user",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <PropertyGroup>\r\n    <ProjectView>ShowAllFiles</ProjectView>\r\n    <UseIISExpress>true</UseIISExpress>\r\n    <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <ReferencePath>\r\n    </ReferencePath>\r\n  </PropertyGroup>\r\n  <ProjectExtensions>\r\n    <VisualStudio>\r\n      <FlavorProperties GUID=\"{349c5851-65df-11da-9384-00065b846f21}\">\r\n        <WebProjectProperties>\r\n          <StartPageUrl>default.aspx</StartPageUrl>\r\n          <StartAction>SpecificPage</StartAction>\r\n          <AspNetDebugging>True</AspNetDebugging>\r\n          <SilverlightDebugging>False</SilverlightDebugging>\r\n          <NativeDebugging>False</NativeDebugging>\r\n          <SQLDebugging>False</SQLDebugging>\r\n          <ExternalProgram>\r\n          </ExternalProgram>\r\n          <StartExternalURL>\r\n          </StartExternalURL>\r\n          <StartCmdLineArguments>\r\n          </StartCmdLineArguments>\r\n          <StartWorkingDirectory>\r\n          </StartWorkingDirectory>\r\n          <EnableENC>False</EnableENC>\r\n          <AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>\r\n        </WebProjectProperties>\r\n      </FlavorProperties>\r\n    </VisualStudio>\r\n  </ProjectExtensions>\r\n</Project>"
  },
  {
    "path": "Website/WebSite.csproj.vspscc",
    "content": "﻿\"\"\r\n{\r\n\"FILE_VERSION\" = \"9237\"\r\n\"ENLISTMENT_CHOICE\" = \"NEVER\"\r\n\"PROJECT_FILE_RELATIVE_PATH\" = \"\"\r\n\"NUMBER_OF_EXCLUDED_FILES\" = \"0\"\r\n\"ORIGINAL_PROJECT_FILE_PATH\" = \"\"\r\n\"NUMBER_OF_NESTED_PROJECTS\" = \"0\"\r\n\"SOURCE_CONTROL_SETTINGS_PROVIDER\" = \"PROVIDER\"\r\n}\r\n"
  },
  {
    "path": "Website/bower.json",
    "content": "{\n  \"name\": \"ASP.NET\",\n  \"private\": true,\n  \"dependencies\": {\n    \"codemirror\": \"5.9.0\",\n    \"autobahnjs\": \"autobahn#^0.10.1\",\n    \"babel-polyfill\": \"^0.0.1\",\n    \"tinymce\": \"4.5.7\",\n    \"promise-polyfill\": \"^6.0.2\"\n  }\n}\n"
  },
  {
    "path": "Website/default.aspx",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<!DOCTYPE html>\r\n\r\n<%@ Page Language=\"C#\" %>\r\n\r\n<%@ Import Namespace=\"Composite\" %>\r\n<%@ Import Namespace=\"Composite.Core.Routing\" %>\r\n<%@ Import Namespace=\"Composite.Core.WebClient\" %>\r\n<%@ Import Namespace=\"Composite.Data\" %>\r\n<%@ Import Namespace=\"Composite.Core.Configuration\" %>\r\n<%@ Import Namespace=\"Composite.Data.Types\" %>\r\n<%@ Import Namespace=\"System.Globalization\" %>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n    <title>Under Construction</title>\r\n    <script runat=\"server\">\r\n        void Page_Init(object sender, EventArgs e)\r\n        {\r\n            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)\r\n            {\r\n                Response.Redirect(\"Composite/top.aspx\" + (RuntimeInformation.IsDebugBuild && ScriptLoader.UnbundledScriptsAvailable() ? \"?mode=develop\" : \"\"));\r\n            }\r\n\r\n            using (var conn = new DataConnection(DataLocalizationFacade.DefaultLocalizationCulture))\r\n            {\r\n                string host = Request.Url.Host;\r\n\r\n                var hostnameBinding = conn.Get<IHostnameBinding>().AsEnumerable().FirstOrDefault(b => b.Hostname == host);\r\n                if(hostnameBinding != null)\r\n                {\r\n                    IPage page;\r\n                    \r\n                    using(new DataScope(PublicationScope.Published, new CultureInfo(hostnameBinding.Culture)))\r\n                    {\r\n                        page = PageManager.GetPageById(hostnameBinding.HomePageId);\r\n                    }\r\n                    \r\n                    if(page != null)\r\n                    {\r\n                        string url = PageUrls.BuildUrl(new PageUrlData(page), UrlKind.Public, new UrlSpace());\r\n\r\n                        if (url != null)\r\n                        {\r\n                            Redirect(url);\r\n                            return;\r\n                        }\r\n                    }\r\n                }\r\n\r\n                var sitemapNavigator = new SitemapNavigator(conn);\r\n                PageNode homePageNode = sitemapNavigator.HomePageNodes.FirstOrDefault(); \r\n\r\n                if (homePageNode != null)\r\n                {\r\n                    Redirect(homePageNode.Url);\r\n                    return;\r\n                }\r\n            }\r\n        }\r\n        \r\n        void Redirect(string url)\r\n        {\r\n            if (url == Request.RawUrl)\r\n            {\r\n                if(!HttpRuntime.UsingIntegratedPipeline)\r\n                {\r\n                    Response.Write(\"Home page is mapped to '/' path, for this to work IIS 7.x integrated pipeline mode should be enabled. You can also edit the home page, give it a 'URL Title' on the settings tab and save and publish. <br/>\");\r\n                }\r\n                else\r\n                {\r\n                    Response.Write(\"Cyclic redirection, there could be a problem with hostnames. <br/>\");\r\n                }\r\n                \r\n                Response.StatusCode = 500; //  \"Error\"\r\n                Response.End();\r\n            }\r\n\r\n            Response.AddHeader(\"Location\", url);\r\n            Response.StatusCode = 301; //  \"Moved Permanently\"\r\n            ApplicationInstance.CompleteRequest();\r\n        }\r\n    </script>\r\n    <style type=\"text/css\">\r\n        body\r\n        {\r\n            background-color: white;\r\n            color: black;\r\n            font-family: Verdana, sans-serif;\r\n            font-size: 12px;\r\n            padding: 20px;\r\n        }\r\n        p\r\n        {\r\n            margin: 0 0 20px 0;\r\n        }\r\n    </style>\r\n</head>\r\n<body>\r\n    <p>\r\n        Site under construction - <a href=\"Composite\">start here</a>.\r\n    </p>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "Website/gruntfile.js",
    "content": "/// <vs BeforeBuild='less' AfterBuild='less, postcss' />\r\nmodule.exports = function (grunt) {\r\n\r\n  'use strict';\r\n\r\n  // Define global variables here - access them with <%= globalConfig.variableName %>\r\n  var globalConfig = {\r\n    rootPath: 'Composite',\r\n    compileScriptsFilename: \"CompileScripts.xml\"\r\n  };\r\n\r\n  grunt.initConfig({\r\n    // Make sure we can access all packages required\r\n    pkg: grunt.file.readJSON('package.json'),\r\n    // Give all tasks access to our global variables\r\n    globalConfig: globalConfig\r\n  });\r\n\r\n  //************************************************************************************************************************************************\r\n  // COPYING FROM BOWER COMPONENTS\r\n  //************************************************************************************************************************************************\r\n  grunt.loadNpmTasks('grunt-contrib-copy');\r\n  grunt.config(\"copy\", {\r\n    codemirror: {\r\n      files: [\r\n        { expand: true, cwd: 'bower_components/codemirror/addon/mode', src: ['*.*'], dest: 'Composite/lib/codemirror/addon/mode' },\r\n\t\t{ expand: true, cwd: 'bower_components/codemirror/addon/selection', src: ['*.*'], dest: 'Composite/lib/codemirror/addon/selection' },\r\n\t\t{ expand: true, cwd: 'bower_components/codemirror/addon/search', src: ['*.*'], dest: 'Composite/lib/codemirror/addon/search' },\r\n        { expand: true, cwd: 'bower_components/codemirror/lib', src: ['*.*'], dest: 'Composite/lib/codemirror/lib' },\r\n        { expand: true, cwd: 'bower_components/codemirror/mode/clike', src: ['*.*'], dest: 'Composite/lib/codemirror/mode/clike' },\r\n        { expand: true, cwd: 'bower_components/codemirror/mode/css', src: ['*.*'], dest: 'Composite/lib/codemirror/mode/css' },\r\n        { expand: true, cwd: 'bower_components/codemirror/mode/htmlembedded', src: ['*.*'], dest: 'Composite/lib/codemirror/mode/htmlembedded' },\r\n        { expand: true, cwd: 'bower_components/codemirror/mode/htmlmixed', src: ['*.*'], dest: 'Composite/lib/codemirror/mode/htmlmixed' },\r\n        { expand: true, cwd: 'bower_components/codemirror/mode/javascript', src: ['*.*'], dest: 'Composite/lib/codemirror/mode/javascript' },\r\n        { expand: true, cwd: 'bower_components/codemirror/mode/sass', src: ['*.*'], dest: 'Composite/lib/codemirror/mode/sass' },\r\n        { expand: true, cwd: 'bower_components/codemirror/mode/sql', src: ['*.*'], dest: 'Composite/lib/codemirror/mode/sql' },\r\n        { expand: true, cwd: 'bower_components/codemirror/mode/xml', src: ['*.*'], dest: 'Composite/lib/codemirror/mode/xml' }\r\n      ]\r\n    },\r\n    autobahnjs: {\r\n      files: [\r\n        { expand: true, cwd: 'bower_components/autobahnjs', src: ['autobahn.js'], dest: 'Composite/lib/autobahnjs' },\r\n      ]\r\n    },\r\n    'promise-polyfill': {\r\n      files: [\r\n        { expand: true, cwd: 'bower_components/promise-polyfill', src: ['promise.js'], dest: 'Composite/lib/promise' },\r\n      ]\r\n    },\r\n    'babel-polyfill': {\r\n      files: [\r\n        { expand: true, cwd: 'bower_components/babel-polyfill', src: ['browser-polyfill.js'], dest: 'Composite/lib/babel' },\r\n      ]\r\n    },\r\n    tinymce: {\r\n        files: function () {\r\n            let tinymceDestFolder = \"Composite/content/misc/editors/visualeditor/tinymce\";\r\n            let tinymcePlugins = [\"autolink\", \"lists\", \"paste\", \"table\", \"searchreplace\"];\r\n            let tinymceFiles = [{ expand: true, cwd: 'bower_components/tinymce', src: ['tinymce.min.js'], dest: `${tinymceDestFolder}` }];\r\n            tinymcePlugins.forEach(function (pluginName, index) {\r\n                tinymceFiles.push({ expand: true, cwd: `bower_components/tinymce/plugins/${pluginName}`, src: ['*.min.js'], dest: `${tinymceDestFolder}/plugins/${pluginName}` });\r\n            });\r\n            tinymceFiles.push({ expand: true, cwd: `bower_components/tinymce/skins/lightgray`, src: ['**'], dest: `${tinymceDestFolder}/skins/lightgray` });\r\n            return tinymceFiles;\r\n        }()\r\n    }\r\n  });\r\n\r\n  //************************************************************************************************************************************************\r\n  // STYLES\r\n  //************************************************************************************************************************************************\r\n  grunt.loadNpmTasks('grunt-contrib-less');\r\n  grunt.config('less', {\r\n    options: {\r\n      paths: ['<%= globalConfig.rootPath %>/styles'],\r\n      sourceMap: true,\r\n      sourceMapFileInline: true\r\n    },\r\n\r\n    default: {\r\n      files: {\r\n        '<%= globalConfig.rootPath %>/styles/styles.css': '<%= globalConfig.rootPath %>/styles/styles.less'\r\n      }\r\n    }\r\n  });\r\n\r\n  // Autoprefixer (postcss)\r\n  grunt.loadNpmTasks('grunt-postcss');\r\n  grunt.config('postcss', {\r\n    options: {\r\n      map: {\r\n        inline: false\r\n      },\r\n      processors: [\r\n        require('autoprefixer-core')({ browsers: 'last 2 versions' }),\r\n        require('csswring')\r\n      ]\r\n    },\r\n    default: {\r\n      files: {\r\n        '<%= globalConfig.rootPath %>/styles/styles.min.css': '<%= globalConfig.rootPath %>/styles/styles.css'\r\n      }\r\n    }\r\n  });\r\n\r\n  //************************************************************************************************************************************************\r\n  // UGLIFY\r\n  //************************************************************************************************************************************************\r\n  var subScripts = [];\r\n  var topScripts = [];\r\n    var topClassNames = [];\r\n\r\n  // Default task\r\n  grunt.loadNpmTasks('grunt-contrib-uglify');\r\n  grunt.config('uglify', {\r\n    options: {\r\n      beautify: false,\r\n      compress: {},\r\n      mangle: {},\r\n      preserveComments: false,\r\n      screwIE8: true,\r\n      sourceMap: true\r\n    },\r\n    default: {\r\n      files: {\r\n        '<%= globalConfig.rootPath %>/scripts/compressed/top.js': topScripts,\r\n        '<%= globalConfig.rootPath %>/scripts/compressed/sub.js': subScripts\r\n      }\r\n    }\r\n  });\r\n\r\n  // Read 'CompileScripts.xml' & call uglify task\r\n  grunt.registerTask('uglifyCompileScripts', 'Parse CompileScripts.xml for dynamic parsing', function () {\r\n    var parser = require('xml2js').Parser({ explicitArray: true, trim: true });\r\n    var filePath = require('path').join(__dirname, globalConfig.rootPath, globalConfig.compileScriptsFilename);\r\n    var exists = grunt.file.exists(filePath);\r\n    if (exists) {\r\n      var jsonpath = require('JSONPath');\r\n      var data = grunt.file.read(filePath);\r\n      parser.parseString(data, function (err, scriptPath) {\r\n\r\n        // Get the sub - develop node\r\n        // [..] is a predicate, ? is to run a script with an expression, @. is to access the attribute (which is represented in the xml2js object as $.name).\r\n        var expression = \"$.Scripts.Type[?(@.$.name == 'sub')].Mode[?(@.$.name == 'develop')].Script[*].$.filename\";\r\n        var scriptPaths = jsonpath.eval(scriptPath, expression, { flatten: true });\r\n        // Replace the '${root}' prefix\r\n        scriptPaths.forEach(function (result) {\r\n          subScripts.push(result.replace('${root}', globalConfig.rootPath));\r\n        });\r\n\r\n        // Get the top - develop node\r\n        expression = \"$.Scripts.Type[?(@.$.name == 'top')].Mode[?(@.$.name == 'develop')].Script[*].$.filename\";\r\n        scriptPaths = jsonpath.eval(scriptPath, expression, { flatten: true });\r\n        // Replace the '${root}' prefix\r\n        scriptPaths.forEach(function (result) {\r\n            topScripts.push(result.replace('${root}', globalConfig.rootPath));\r\n        });\r\n\r\n        // Done, run the uglify task\r\n        grunt.task.run(['uglify:default']);\r\n\r\n\r\n          // Generating \"toplevelclassnames.js\"\r\n        var topLevelClassNamesTargetFolder = 'Composite/scripts/source';\r\n                var topLevelClassNamesIgnoreFolder = 'Composite/scripts/source/page';\r\n\r\n        grunt.file.recurse(topLevelClassNamesTargetFolder, function (filepath) {\r\n            if (filepath.indexOf(topLevelClassNamesIgnoreFolder) >= 0 ||\r\n                        filepath.indexOf(\".js\") < 0) {\r\n                return;\r\n            }\r\n\r\n            var s = filepath;\r\n            var className = s.substring(s.lastIndexOf('/') + 1, s.lastIndexOf('.'));\r\n            topClassNames.push(className);\r\n        });\r\n\r\n        grunt.file.write(\r\n                    globalConfig.rootPath + '/scripts/compressed/toplevelclassnames.js',\r\n                    '/* Generated by Grunt */ var topLevelClassNames = ' + JSON.stringify(topClassNames) + ';');\r\n      });\r\n    }\r\n    else {\r\n      console.log(filePath + ' does not exist');\r\n    }\r\n  });\r\n\r\n\r\n    // ****************************************************************************************************\r\n    //  SVG\r\n    // ****************************************************************************************************\r\n  function stringSplice(str, index, count, add) {\r\n    return str.slice(0, index) + add + str.slice(index + count);\r\n  }\r\n\r\n    // Merging all svg files into one\r\n  grunt.registerTask('mergeSvg', 'Merges all the svg files into one sprite', function () {\r\n      var sourceDir = 'Composite/images/icons/svg';\r\n      var targetFile = 'Composite/images/sprite.svg';\r\n\r\n        function GetGTag(xml) {\r\n            var gIdOffset = xml.indexOf('<g id=\"');\r\n\r\n            var viewBox = xml.match(/<(\\w+)[^>]*(viewBox=\"[\\d\\.]+ [\\d\\.]+ [\\d\\.]+ [\\d\\.]+\")/);\r\n            viewBox = viewBox && viewBox[1] === 'svg' && ' ' + viewBox[2] || '';\r\n\r\n            var closingTag = '</g>';\r\n            var closeGtag = xml.lastIndexOf(closingTag);\r\n\r\n            var ancestorGTagCount = (xml.substring(0, gIdOffset).match(/<g/g) || []).length;\r\n\r\n            var i;\r\n            for (i = 0; i < ancestorGTagCount; i++) {\r\n                closeGtag = xml.lastIndexOf(closingTag, closeGtag - 1);\r\n            }\r\n\r\n            var gTag = xml.substring(gIdOffset, closeGtag + closingTag.length);\r\n            if (!/viewBox/.test(gTag) && viewBox) {\r\n              gTag = stringSplice(gTag, 2, 0, viewBox);\r\n            }\r\n            return gTag;\r\n        }\r\n\r\n        var resultSvg = ['<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\" width=\"24\" height=\"24\"  viewBox=\"0 0 128 128\"><defs>'];\r\n\r\n        grunt.file.recurse(sourceDir, function (filepath) {\r\n          var svg = grunt.file.read(filepath);\r\n\r\n          resultSvg.push(GetGTag(svg));\r\n        });\r\n\r\n      resultSvg.push('</defs></svg>');\r\n\r\n      grunt.file.write(targetFile, resultSvg.join(''));\r\n    });\r\n\r\n    // Optimize source svgs\r\n\r\n    var iconTmpDir = 'iconTmp/';\r\n\r\n    grunt.loadNpmTasks('grunt-svgmin');\r\n    grunt.config(\"svgmin\", {\r\n        options: {\r\n            plugins: [\r\n              { removeAttrs: { attrs: [\r\n                'g:width', 'g:height',\r\n                'svg:width', 'svg:height'\r\n              ] } },\r\n              { removeDesc: false },\r\n              { removeUselessDefs: false },\r\n              { removeEmptyAttrs: false },\r\n              { removeHiddenElems: false },\r\n              { removeEmptyText: false },\r\n              { removeEmptyContainers: false },\r\n              { cleanUpEnableBackground: false },\r\n              { minifyStyles: false },\r\n              { convertStyleToAttrs: false },\r\n              { convertColors: false },\r\n              { convertPathData: false },\r\n              { convertTransform: false },\r\n              { removeUnknownsAndDefaults: false },\r\n              { removeNonInheritableGroupAttrs: false },\r\n              { removeUselessStrokeAndFill: false },\r\n              { removeUnusedNS: false },\r\n              { cleanupNumericValues: false },\r\n              { cleanupListOfValues: false },\r\n              { moveElemsAttrsToGroup: false },\r\n              { moveGroupAttrsToElems: false },\r\n              { collapseGroups: false },\r\n              { mergePaths: false },\r\n              { convertShapeToPath: false }\r\n            ]\r\n        },\r\n        dist: {\r\n            files: [{\r\n              expand: true,\r\n              cwd: 'Composite/images/icons/svg/',\r\n              src: ['*.svg'],\r\n              dest: iconTmpDir\r\n            }]\r\n        }\r\n    });\r\n\r\n    grunt.registerTask('buildSpriteSheet', function () {\r\n      grunt.task.requires('svgmin');\r\n\r\n      var outputFile = 'Composite/console/icons.svg';\r\n      var inputDir = iconTmpDir;\r\n      var outputText = '<svg xmlns=\"http://www.w3.org/2000/svg\">\\r\\n';\r\n      grunt.file.recurse(inputDir, function (filePath) {\r\n        var fileName = filePath.replace(/^.*\\/([^\\/]*).svg/, '$1');\r\n        var fileText = grunt.file.read(filePath);\r\n\r\n        outputText += fileText\r\n          .replace('<svg', '<symbol id=\"icon-' + fileName + '\"')\r\n          .replace('</svg>', '</symbol>')\r\n          .replace('xlink:href=\"#', 'xlink:href=\"#icon-')\r\n          .replace(/(?:stroke|fill)=\"#(?:([0-9a-eA-E])\\1{2,5})\"/g, '')\r\n           + '\\r\\n';\r\n      });\r\n      outputText += '</svg>\\r\\n';\r\n\r\n      grunt.file.write(outputFile, outputText);\r\n      grunt.file.delete(iconTmpDir);\r\n    });\r\n\r\n    grunt.registerTask('icons', ['svgmin', 'buildSpriteSheet']);\r\n\r\n  //************************************************************************************************************************************************\r\n  // WATCH\r\n  //************************************************************************************************************************************************\r\n  grunt.loadNpmTasks('grunt-contrib-watch');\r\n  grunt.config('watch', {\r\n    less: {\r\n      files: [globalConfig.rootPath + '/styles/**/*.less'],\r\n      tasks: ['less', 'postcss'],\r\n      options: {\r\n        livereload: true,\r\n        spawn: false\r\n      }\r\n    },\r\n    uglify: {\r\n      files: [globalConfig.rootPath + '/scripts/source/**/*.js'],\r\n      tasks: ['uglifyCompileScripts'],\r\n      options: {\r\n        spawn: false\r\n      }\r\n    }\r\n  });\r\n\r\n  grunt.registerTask('watchAll', ['watch']);\r\n  // Register the default tasks.\r\n  grunt.registerTask('build', ['copy', 'less', 'postcss', 'uglifyCompileScripts', 'mergeSvg', 'icons']);\r\n  grunt.registerTask('default', ['build']);\r\n};\r\n"
  },
  {
    "path": "Website/jspm.config.js",
    "content": "SystemJS.config({\n  paths: {\n    \"console/\": \"Composite/console/\",\n    \"github:\": \"jspm_packages/github/\",\n    \"npm:\": \"jspm_packages/npm/\",\n    \"local:\": \"jspm_packages/local/\",\n    \"CMSConsole/\": \"Composite/\"\n  },\n  meta: {\n    \"console/*\": {\n      \"format\": \"esm\"\n    }\n  },\n  browserConfig: {\n    \"baseURL\": \"/\"\n  },\n  sassPluginOptions: {\n    \"autoprefixer\": true\n  },\n  devConfig: {\n    \"paths\": {\n      \"unittest/\": \"test/unit/\"\n    },\n    \"meta\": {\n      \"unittest/*\": {\n        \"format\": \"esm\"\n      }\n    },\n    \"map\": {\n      \"babel-runtime\": \"npm:babel-runtime@5.8.38\",\n      \"core-js\": \"npm:core-js@1.2.7\",\n      \"glob\": \"npm:glob@7.1.1\",\n      \"react-addons-test-utils\": \"npm:react-addons-test-utils@15.3.2\",\n      \"sinon\": \"npm:sinon@1.17.6\",\n      \"systemjs-hot-reloader\": \"github:capaj/systemjs-hot-reloader@0.6.0\",\n      \"systemjs-hot-reloader-store\": \"github:peteruithoven/systemjs-hot-reloader-store@1.0.0\",\n      \"unexpected-dom\": \"npm:unexpected-dom@3.1.0\",\n      \"unexpected-react\": \"npm:unexpected-react@3.2.4\",\n      \"unexpected-sinon\": \"npm:unexpected-sinon@10.5.1\",\n      \"source-map\": \"npm:source-map@0.2.0\",\n      \"jsbn\": \"npm:jsbn@0.1.0\",\n      \"tweetnacl\": \"npm:tweetnacl@0.13.3\",\n      \"jodid25519\": \"npm:jodid25519@1.0.2\",\n      \"ecc-jsbn\": \"npm:ecc-jsbn@0.1.1\",\n      \"dns\": \"npm:jspm-nodelibs-dns@0.2.0\",\n      \"dgram\": \"npm:jspm-nodelibs-dgram@0.2.0\",\n      \"babel-plugin-transform-react-jsx\": \"npm:babel-plugin-transform-react-jsx@6.8.0\",\n      \"unexpected-mitm\": \"npm:unexpected-mitm@9.3.4\",\n      \"zurvan\": \"npm:zurvan@0.3.2\",\n      \"unexpected-zurvan\": \"npm:unexpected-zurvan@0.1.0\",\n      \"react-immutable-proptypes\": \"npm:react-immutable-proptypes@2.1.0\"\n    },\n    \"packages\": {\n      \"github:capaj/systemjs-hot-reloader@0.6.0\": {\n        \"map\": {\n          \"debug\": \"npm:debug@2.2.0\",\n          \"socket.io-client\": \"github:socketio/socket.io-client@1.5.0\",\n          \"weakee\": \"npm:weakee@1.0.0\"\n        }\n      },\n      \"npm:amdefine@1.0.0\": {\n        \"map\": {}\n      },\n      \"npm:babel-runtime@5.8.38\": {\n        \"map\": {}\n      },\n      \"npm:brace-expansion@1.1.6\": {\n        \"map\": {\n          \"balanced-match\": \"npm:balanced-match@0.4.2\",\n          \"concat-map\": \"npm:concat-map@0.0.1\"\n        }\n      },\n      \"npm:debug@2.2.0\": {\n        \"map\": {\n          \"ms\": \"npm:ms@0.7.1\"\n        }\n      },\n      \"npm:ecc-jsbn@0.1.1\": {\n        \"map\": {\n          \"jsbn\": \"npm:jsbn@0.1.0\"\n        }\n      },\n      \"npm:formatio@1.1.1\": {\n        \"map\": {\n          \"samsam\": \"npm:samsam@1.1.3\"\n        }\n      },\n      \"npm:fs.realpath@1.0.0\": {\n        \"map\": {}\n      },\n      \"npm:jodid25519@1.0.2\": {\n        \"map\": {\n          \"jsbn\": \"npm:jsbn@0.1.0\"\n        }\n      },\n      \"npm:magicpen-prism@2.2.1\": {\n        \"map\": {}\n      },\n      \"npm:source-map@0.2.0\": {\n        \"map\": {\n          \"amdefine\": \"npm:amdefine@1.0.0\"\n        }\n      },\n      \"npm:unexpected-dom@3.1.0\": {\n        \"map\": {\n          \"extend\": \"npm:extend@3.0.0\",\n          \"magicpen-prism\": \"npm:magicpen-prism@2.2.1\"\n        }\n      },\n      \"npm:unexpected-htmllike-jsx-adapter@1.0.0\": {\n        \"map\": {\n          \"object-assign\": \"npm:object-assign@4.1.0\"\n        }\n      },\n      \"npm:unexpected-htmllike-reactrendered-adapter@2.0.1\": {\n        \"map\": {\n          \"object-assign\": \"npm:object-assign@4.1.0\",\n          \"react-render-hook\": \"npm:react-render-hook@0.1.4\"\n        }\n      },\n      \"npm:unexpected-htmllike@2.1.1\": {\n        \"map\": {\n          \"array-changes\": \"npm:array-changes@1.3.1\",\n          \"array-changes-async\": \"npm:array-changes-async@2.2.1\",\n          \"object-assign\": \"npm:object-assign@4.1.0\"\n        }\n      },\n      \"npm:util@0.10.3\": {\n        \"map\": {\n          \"inherits\": \"npm:inherits@2.0.1\"\n        }\n      },\n      \"npm:babel-plugin-transform-react-jsx@6.8.0\": {\n        \"map\": {\n          \"babel-runtime\": \"npm:babel-runtime@6.11.6\",\n          \"babel-plugin-syntax-jsx\": \"npm:babel-plugin-syntax-jsx@6.13.0\",\n          \"babel-helper-builder-react-jsx\": \"npm:babel-helper-builder-react-jsx@6.9.0\"\n        }\n      },\n      \"npm:babel-helper-builder-react-jsx@6.9.0\": {\n        \"map\": {\n          \"babel-runtime\": \"npm:babel-runtime@6.11.6\",\n          \"esutils\": \"npm:esutils@2.0.2\",\n          \"babel-types\": \"npm:babel-types@6.16.0\",\n          \"lodash\": \"npm:lodash@4.16.4\"\n        }\n      },\n      \"npm:detect-indent@3.0.0\": {\n        \"map\": {\n          \"repeating\": \"npm:repeating@1.1.3\",\n          \"get-stdin\": \"npm:get-stdin@3.0.2\",\n          \"minimist\": \"npm:minimist@1.2.0\"\n        }\n      },\n      \"npm:repeating@1.1.3\": {\n        \"map\": {\n          \"is-finite\": \"npm:is-finite@1.0.2\"\n        }\n      },\n      \"npm:memoizesync@0.5.0\": {\n        \"map\": {\n          \"lru-cache\": \"npm:lru-cache@2.3.1\"\n        }\n      },\n      \"npm:inherits@2.0.1\": {\n        \"map\": {}\n      },\n      \"npm:unexpected-mitm@9.3.4\": {\n        \"map\": {\n          \"messy\": \"npm:messy@6.12.2\",\n          \"callsite\": \"npm:callsite@1.0.0\",\n          \"underscore\": \"npm:underscore@1.7.0\",\n          \"detect-indent\": \"npm:detect-indent@3.0.0\",\n          \"memoizesync\": \"npm:memoizesync@0.5.0\",\n          \"mitm-papandreou\": \"npm:mitm-papandreou@1.3.1-patch1\"\n        }\n      },\n      \"npm:sinon@1.17.6\": {\n        \"map\": {\n          \"lolex\": \"npm:lolex@1.3.2\",\n          \"samsam\": \"npm:samsam@1.1.2\",\n          \"formatio\": \"npm:formatio@1.1.1\",\n          \"util\": \"npm:util@0.10.3\"\n        }\n      },\n      \"npm:unexpected-react@3.2.4\": {\n        \"map\": {\n          \"react-render-hook\": \"npm:react-render-hook@0.1.4\",\n          \"unexpected-htmllike-reactrendered-adapter\": \"npm:unexpected-htmllike-reactrendered-adapter@2.0.1\",\n          \"unexpected-htmllike-jsx-adapter\": \"npm:unexpected-htmllike-jsx-adapter@1.0.0\",\n          \"unexpected-htmllike\": \"npm:unexpected-htmllike@2.1.1\",\n          \"magicpen-prism\": \"npm:magicpen-prism@2.2.1\"\n        }\n      },\n      \"npm:glob@7.1.1\": {\n        \"map\": {\n          \"inflight\": \"npm:inflight@1.0.6\",\n          \"once\": \"npm:once@1.4.0\",\n          \"minimatch\": \"npm:minimatch@3.0.3\",\n          \"path-is-absolute\": \"npm:path-is-absolute@1.0.1\",\n          \"inherits\": \"npm:inherits@2.0.3\",\n          \"fs.realpath\": \"npm:fs.realpath@1.0.0\"\n        }\n      },\n      \"npm:inflight@1.0.6\": {\n        \"map\": {\n          \"once\": \"npm:once@1.4.0\",\n          \"wrappy\": \"npm:wrappy@1.0.2\"\n        }\n      },\n      \"npm:mitm-papandreou@1.3.1-patch1\": {\n        \"map\": {\n          \"underscore\": \"npm:underscore@1.5.2\"\n        }\n      },\n      \"npm:minimatch@3.0.3\": {\n        \"map\": {\n          \"brace-expansion\": \"npm:brace-expansion@1.1.6\"\n        }\n      },\n      \"npm:once@1.4.0\": {\n        \"map\": {\n          \"wrappy\": \"npm:wrappy@1.0.2\"\n        }\n      },\n      \"npm:babel-types@6.16.0\": {\n        \"map\": {\n          \"babel-runtime\": \"npm:babel-runtime@6.11.6\",\n          \"esutils\": \"npm:esutils@2.0.2\",\n          \"lodash\": \"npm:lodash@4.16.4\",\n          \"to-fast-properties\": \"npm:to-fast-properties@1.0.2\"\n        }\n      },\n      \"npm:array-changes@1.3.1\": {\n        \"map\": {\n          \"arraydiff-papandreou\": \"npm:arraydiff-papandreou@0.1.1-patch1\"\n        }\n      },\n      \"npm:array-changes-async@2.2.1\": {\n        \"map\": {\n          \"arraydiff-async\": \"npm:arraydiff-async@0.2.0\"\n        }\n      },\n      \"npm:is-finite@1.0.2\": {\n        \"map\": {\n          \"number-is-nan\": \"npm:number-is-nan@1.0.1\"\n        }\n      },\n      \"npm:babel-runtime@6.11.6\": {\n        \"map\": {\n          \"core-js\": \"npm:core-js@2.4.1\",\n          \"regenerator-runtime\": \"npm:regenerator-runtime@0.9.5\"\n        }\n      }\n    }\n  },\n  transpiler: \"plugin-babel\",\n  babelOptions: {\n    \"optional\": [\n      \"runtime\",\n      \"optimisation.modules.system\"\n    ],\n    \"sourceMaps\": true,\n    \"plugins\": [\n      \"babel-plugin-transform-react-jsx\"\n    ]\n  },\n  trace: true,\n  map: {\n    \"jsdom\": \"node_modules/jsdom/lib/jsdom.js\"\n  },\n  packages: {\n    \"CMSConsole\": {\n      \"main\": \"console/console.js\",\n      \"format\": \"esm\"\n    }\n  }\n});\n\nSystemJS.config({\n  packageConfigPaths: [\n    \"npm:@*/*.json\",\n    \"npm:*.json\",\n    \"github:*/*.json\",\n    \"local:*.json\"\n  ],\n  map: {\n    \"fixed-data-table-2\": \"npm:fixed-data-table-2@0.7.6\",\n    \"immutable\": \"npm:immutable@3.8.1\",\n    \"bluebird\": \"npm:bluebird@3.4.6\",\n    \"module\": \"npm:jspm-nodelibs-module@0.2.0\",\n    \"plugin-babel\": \"npm:systemjs-plugin-babel@0.0.13\",\n    \"magicpen-media\": \"npm:magicpen-media@1.5.1\",\n    \"messy\": \"npm:messy@6.12.2\",\n    \"net\": \"npm:jspm-nodelibs-net@0.2.0\",\n    \"os\": \"npm:jspm-nodelibs-os@0.2.0\",\n    \"punycode\": \"npm:jspm-nodelibs-punycode@0.2.0\",\n    \"querystring\": \"npm:jspm-nodelibs-querystring@0.2.0\",\n    \"rc-table\": \"npm:rc-table@5.0.3\",\n    \"react\": \"npm:react@15.3.2\",\n    \"react-dimensions\": \"npm:react-dimensions@1.3.0\",\n    \"react-dom\": \"npm:react-dom@15.3.2\",\n    \"react-select\": \"npm:react-select@1.0.0-rc.2\",\n    \"redux-immutablejs\": \"npm:redux-immutablejs@0.0.8\",\n    \"redux-observer\": \"npm:redux-observer@1.0.0\",\n    \"repl\": \"npm:jspm-nodelibs-repl@0.2.0\",\n    \"reselect\": \"npm:reselect@2.5.4\",\n    \"styled-components\": \"npm:styled-components@1.1.1\",\n    \"text\": \"github:systemjs/plugin-text@0.0.9\",\n    \"tls\": \"npm:jspm-nodelibs-tls@0.2.0\",\n    \"tty\": \"npm:jspm-nodelibs-tty@0.2.0\",\n    \"unexpected\": \"npm:unexpected@10.18.1\",\n    \"unexpected-messy\": \"npm:unexpected-messy@6.2.0\",\n    \"constants\": \"npm:jspm-nodelibs-constants@0.2.0\",\n    \"assert\": \"npm:jspm-nodelibs-assert@0.2.0\",\n    \"buffer\": \"github:jspm/nodelibs-buffer@0.2.0-alpha\",\n    \"child_process\": \"npm:jspm-nodelibs-child_process@0.2.0\",\n    \"crypto\": \"npm:jspm-nodelibs-crypto@0.2.0\",\n    \"domain\": \"npm:jspm-nodelibs-domain@0.2.0\",\n    \"events\": \"github:jspm/nodelibs-events@0.2.0-alpha\",\n    \"fs\": \"github:jspm/nodelibs-fs@0.2.0-alpha\",\n    \"http\": \"github:jspm/nodelibs-http@0.2.0-alpha\",\n    \"https\": \"npm:jspm-nodelibs-https@0.2.0\",\n    \"path\": \"github:jspm/nodelibs-path@0.2.0-alpha\",\n    \"process\": \"github:jspm/nodelibs-process@0.2.0-alpha\",\n    \"stream\": \"github:jspm/nodelibs-stream@0.2.0-alpha\",\n    \"string_decoder\": \"npm:jspm-nodelibs-string_decoder@0.2.0\",\n    \"normalizr\": \"npm:normalizr@2.2.1\",\n    \"react-redux\": \"npm:react-redux@4.4.5\",\n    \"redux\": \"npm:redux@3.6.0\",\n    \"redux-thunk\": \"npm:redux-thunk@2.1.0\",\n    \"svg\": \"github:npbenjohnson/plugin-svg@0.1.0\",\n    \"url\": \"github:jspm/nodelibs-url@0.2.0-alpha\",\n    \"url-polyfill\": \"npm:url-polyfill@1.0.13\",\n    \"util\": \"github:jspm/nodelibs-util@0.2.0-alpha\",\n    \"vm\": \"npm:jspm-nodelibs-vm@0.2.0\",\n    \"wampy\": \"npm:wampy@4.0.0\",\n    \"whatwg-fetch\": \"npm:whatwg-fetch@1.1.1\",\n    \"zlib\": \"npm:jspm-nodelibs-zlib@0.2.0\"\n  },\n  packages: {\n    \"npm:browserify-zlib@0.1.4\": {\n      \"map\": {\n        \"pako\": \"npm:pako@0.2.9\",\n        \"readable-stream\": \"npm:readable-stream@2.2.2\"\n      }\n    },\n    \"npm:core-util-is@1.0.2\": {\n      \"map\": {}\n    },\n    \"npm:domain-browser@1.1.7\": {\n      \"map\": {}\n    },\n    \"npm:has-flag@1.0.0\": {\n      \"map\": {}\n    },\n    \"npm:iconv-lite@0.4.13\": {\n      \"map\": {}\n    },\n    \"npm:invariant@2.2.1\": {\n      \"map\": {\n        \"loose-envify\": \"npm:loose-envify@1.2.0\"\n      }\n    },\n    \"npm:loose-envify@1.2.0\": {\n      \"map\": {\n        \"js-tokens\": \"npm:js-tokens@1.0.3\"\n      }\n    },\n    \"npm:normalizr@2.2.1\": {\n      \"map\": {\n        \"lodash\": \"npm:lodash@4.16.4\"\n      }\n    },\n    \"npm:pako@0.2.9\": {\n      \"map\": {}\n    },\n    \"npm:process-nextick-args@1.0.7\": {\n      \"map\": {}\n    },\n    \"npm:punycode@1.3.2\": {\n      \"map\": {}\n    },\n    \"npm:react-redux@4.4.5\": {\n      \"map\": {\n        \"hoist-non-react-statics\": \"npm:hoist-non-react-statics@1.2.0\",\n        \"invariant\": \"npm:invariant@2.2.1\",\n        \"lodash\": \"npm:lodash@4.16.4\",\n        \"loose-envify\": \"npm:loose-envify@1.2.0\"\n      }\n    },\n    \"npm:string_decoder@0.10.31\": {\n      \"map\": {}\n    },\n    \"npm:supports-color@3.1.2\": {\n      \"map\": {\n        \"has-flag\": \"npm:has-flag@1.0.0\"\n      }\n    },\n    \"npm:util-deprecate@1.0.2\": {\n      \"map\": {}\n    },\n    \"npm:url@0.11.0\": {\n      \"map\": {\n        \"punycode\": \"npm:punycode@1.3.2\",\n        \"querystring\": \"npm:querystring@0.2.0\"\n      }\n    },\n    \"npm:stream-browserify@2.0.1\": {\n      \"map\": {\n        \"inherits\": \"npm:inherits@2.0.3\",\n        \"readable-stream\": \"npm:readable-stream@2.2.2\"\n      }\n    },\n    \"npm:gettemporaryfilepath@0.0.1\": {\n      \"map\": {}\n    },\n    \"npm:iconv-lite@0.4.5\": {\n      \"map\": {}\n    },\n    \"npm:lodash@3.10.0\": {\n      \"map\": {}\n    },\n    \"npm:magicpen-media@1.5.1\": {\n      \"map\": {\n        \"gettemporaryfilepath\": \"npm:gettemporaryfilepath@0.0.1\",\n        \"lodash\": \"npm:lodash@3.10.0\",\n        \"mime\": \"npm:mime@1.3.4\"\n      }\n    },\n    \"npm:mime@1.3.4\": {\n      \"map\": {}\n    },\n    \"npm:quoted-printable@1.0.0\": {\n      \"map\": {\n        \"utf8\": \"npm:utf8@2.1.2\"\n      }\n    },\n    \"npm:rfc2047@2.0.0\": {\n      \"map\": {\n        \"iconv-lite\": \"npm:iconv-lite@0.4.5\"\n      }\n    },\n    \"npm:rfc2231@1.3.0\": {\n      \"map\": {\n        \"iconv-lite\": \"npm:iconv-lite@0.4.5\"\n      }\n    },\n    \"npm:buffer@4.9.1\": {\n      \"map\": {\n        \"base64-js\": \"npm:base64-js@1.2.0\",\n        \"ieee754\": \"npm:ieee754@1.1.8\",\n        \"isarray\": \"npm:isarray@1.0.0\"\n      }\n    },\n    \"npm:rc-table@5.0.3\": {\n      \"map\": {\n        \"shallowequal\": \"npm:shallowequal@0.2.2\",\n        \"object-path\": \"npm:object-path@0.11.2\",\n        \"rc-util\": \"npm:rc-util@3.4.1\"\n      }\n    },\n    \"npm:rc-util@3.4.1\": {\n      \"map\": {\n        \"shallowequal\": \"npm:shallowequal@0.2.2\",\n        \"add-dom-event-listener\": \"npm:add-dom-event-listener@1.0.1\",\n        \"classnames\": \"npm:classnames@2.2.5\"\n      }\n    },\n    \"npm:shallowequal@0.2.2\": {\n      \"map\": {\n        \"lodash.keys\": \"npm:lodash.keys@3.1.2\"\n      }\n    },\n    \"npm:add-dom-event-listener@1.0.1\": {\n      \"map\": {\n        \"object-assign\": \"npm:object-assign@4.1.0\"\n      }\n    },\n    \"npm:lodash.keys@3.1.2\": {\n      \"map\": {\n        \"lodash._getnative\": \"npm:lodash._getnative@3.9.1\",\n        \"lodash.isarray\": \"npm:lodash.isarray@3.0.4\",\n        \"lodash.isarguments\": \"npm:lodash.isarguments@3.1.0\"\n      }\n    },\n    \"npm:react-dimensions@1.3.0\": {\n      \"map\": {\n        \"element-resize-event\": \"npm:element-resize-event@2.0.7\"\n      }\n    },\n    \"npm:messy@6.12.2\": {\n      \"map\": {\n        \"iconv-lite\": \"npm:iconv-lite@0.4.13\",\n        \"underscore\": \"npm:underscore@1.8.3\",\n        \"rfc2231\": \"npm:rfc2231@1.3.0\",\n        \"quoted-printable\": \"npm:quoted-printable@1.0.0\",\n        \"rfc2047\": \"npm:rfc2047@2.0.0\"\n      }\n    },\n    \"npm:unexpected-messy@6.2.0\": {\n      \"map\": {\n        \"underscore\": \"npm:underscore@1.7.0\",\n        \"minimist\": \"npm:minimist@1.1.1\"\n      }\n    },\n    \"npm:redux@3.6.0\": {\n      \"map\": {\n        \"symbol-observable\": \"npm:symbol-observable@1.0.4\",\n        \"loose-envify\": \"npm:loose-envify@1.2.0\",\n        \"lodash-es\": \"npm:lodash-es@4.16.4\",\n        \"lodash\": \"npm:lodash@4.16.4\"\n      }\n    },\n    \"npm:react-select@1.0.0-rc.2\": {\n      \"map\": {\n        \"react-input-autosize\": \"npm:react-input-autosize@1.1.0\",\n        \"classnames\": \"npm:classnames@2.2.5\"\n      }\n    },\n    \"npm:core-js@1.2.7\": {\n      \"map\": {}\n    },\n    \"npm:react@15.3.2\": {\n      \"map\": {\n        \"fbjs\": \"npm:fbjs@0.8.6\",\n        \"loose-envify\": \"npm:loose-envify@1.3.0\",\n        \"object-assign\": \"npm:object-assign@4.1.0\"\n      }\n    },\n    \"npm:isomorphic-fetch@2.2.1\": {\n      \"map\": {\n        \"node-fetch\": \"npm:node-fetch@1.6.3\",\n        \"whatwg-fetch\": \"npm:whatwg-fetch@1.1.1\"\n      }\n    },\n    \"npm:promise@7.1.1\": {\n      \"map\": {\n        \"asap\": \"npm:asap@2.0.5\"\n      }\n    },\n    \"npm:node-fetch@1.6.3\": {\n      \"map\": {\n        \"is-stream\": \"npm:is-stream@1.1.0\",\n        \"encoding\": \"npm:encoding@0.1.12\"\n      }\n    },\n    \"npm:encoding@0.1.12\": {\n      \"map\": {\n        \"iconv-lite\": \"npm:iconv-lite@0.4.15\"\n      }\n    },\n    \"npm:readable-stream@2.2.2\": {\n      \"map\": {\n        \"core-util-is\": \"npm:core-util-is@1.0.2\",\n        \"isarray\": \"npm:isarray@1.0.0\",\n        \"inherits\": \"npm:inherits@2.0.3\",\n        \"string_decoder\": \"npm:string_decoder@0.10.31\",\n        \"process-nextick-args\": \"npm:process-nextick-args@1.0.7\",\n        \"util-deprecate\": \"npm:util-deprecate@1.0.2\",\n        \"buffer-shims\": \"npm:buffer-shims@1.0.0\"\n      }\n    },\n    \"npm:stream-http@2.5.0\": {\n      \"map\": {\n        \"inherits\": \"npm:inherits@2.0.3\",\n        \"readable-stream\": \"npm:readable-stream@2.2.2\",\n        \"builtin-status-codes\": \"npm:builtin-status-codes@2.0.0\",\n        \"to-arraybuffer\": \"npm:to-arraybuffer@1.0.1\",\n        \"xtend\": \"npm:xtend@4.0.1\"\n      }\n    },\n    \"npm:wampy@4.0.0\": {\n      \"main\": \"build/wampy.js\",\n      \"map\": {\n        \"websocket\": \"npm:websocket@1.0.23\",\n        \"msgpack5\": \"npm:msgpack5@3.4.1\"\n      }\n    },\n    \"npm:websocket@1.0.23\": {\n      \"map\": {\n        \"yaeti\": \"npm:yaeti@0.0.4\",\n        \"debug\": \"npm:debug@2.3.2\",\n        \"typedarray-to-buffer\": \"npm:typedarray-to-buffer@3.1.2\",\n        \"nan\": \"npm:nan@2.4.0\"\n      }\n    },\n    \"npm:msgpack5@3.4.1\": {\n      \"map\": {\n        \"inherits\": \"npm:inherits@2.0.3\",\n        \"readable-stream\": \"npm:readable-stream@2.2.2\",\n        \"bl\": \"npm:bl@1.1.2\"\n      }\n    },\n    \"npm:debug@2.3.2\": {\n      \"map\": {\n        \"ms\": \"npm:ms@0.7.2\"\n      }\n    },\n    \"npm:bl@1.1.2\": {\n      \"map\": {\n        \"readable-stream\": \"npm:readable-stream@2.0.6\"\n      }\n    },\n    \"npm:typedarray-to-buffer@3.1.2\": {\n      \"map\": {\n        \"is-typedarray\": \"npm:is-typedarray@1.0.0\"\n      }\n    },\n    \"npm:readable-stream@2.0.6\": {\n      \"map\": {\n        \"core-util-is\": \"npm:core-util-is@1.0.2\",\n        \"inherits\": \"npm:inherits@2.0.3\",\n        \"isarray\": \"npm:isarray@1.0.0\",\n        \"process-nextick-args\": \"npm:process-nextick-args@1.0.7\",\n        \"string_decoder\": \"npm:string_decoder@0.10.31\",\n        \"util-deprecate\": \"npm:util-deprecate@1.0.2\"\n      }\n    },\n    \"npm:fbjs@0.8.6\": {\n      \"map\": {\n        \"loose-envify\": \"npm:loose-envify@1.3.0\",\n        \"object-assign\": \"npm:object-assign@4.1.0\",\n        \"core-js\": \"npm:core-js@1.2.7\",\n        \"isomorphic-fetch\": \"npm:isomorphic-fetch@2.2.1\",\n        \"promise\": \"npm:promise@7.1.1\",\n        \"ua-parser-js\": \"npm:ua-parser-js@0.7.12\"\n      }\n    },\n    \"npm:loose-envify@1.3.0\": {\n      \"map\": {\n        \"js-tokens\": \"npm:js-tokens@2.0.0\"\n      }\n    },\n    \"npm:styled-components@1.1.1\": {\n      \"map\": {\n        \"buffer\": \"npm:buffer@5.0.1\",\n        \"fbjs\": \"npm:fbjs@0.8.6\",\n        \"supports-color\": \"npm:supports-color@3.1.2\",\n        \"glamor\": \"npm:glamor@2.19.0\",\n        \"lodash\": \"npm:lodash@4.17.2\",\n        \"inline-style-prefixer\": \"npm:inline-style-prefixer@2.0.4\"\n      }\n    },\n    \"npm:glamor@2.19.0\": {\n      \"map\": {\n        \"fbjs\": \"npm:fbjs@0.8.6\",\n        \"inline-style-prefixer\": \"npm:inline-style-prefixer@2.0.4\"\n      }\n    },\n    \"npm:buffer@5.0.1\": {\n      \"map\": {\n        \"ieee754\": \"npm:ieee754@1.1.8\",\n        \"base64-js\": \"npm:base64-js@1.2.0\"\n      }\n    },\n    \"npm:inline-style-prefixer@2.0.4\": {\n      \"map\": {\n        \"bowser\": \"npm:bowser@1.5.0\",\n        \"hyphenate-style-name\": \"npm:hyphenate-style-name@1.0.2\"\n      }\n    },\n    \"npm:jspm-nodelibs-punycode@0.2.0\": {\n      \"map\": {\n        \"punycode-browserify\": \"npm:punycode@1.4.1\"\n      }\n    },\n    \"npm:jspm-nodelibs-domain@0.2.0\": {\n      \"map\": {\n        \"domain-browserify\": \"npm:domain-browser@1.1.7\"\n      }\n    },\n    \"npm:jspm-nodelibs-zlib@0.2.0\": {\n      \"map\": {\n        \"zlib-browserify\": \"npm:browserify-zlib@0.1.4\"\n      }\n    },\n    \"npm:jspm-nodelibs-string_decoder@0.2.0\": {\n      \"map\": {\n        \"string_decoder-browserify\": \"npm:string_decoder@0.10.31\"\n      }\n    },\n    \"github:jspm/nodelibs-http@0.2.0-alpha\": {\n      \"map\": {\n        \"http-browserify\": \"npm:stream-http@2.5.0\"\n      }\n    },\n    \"github:jspm/nodelibs-buffer@0.2.0-alpha\": {\n      \"map\": {\n        \"buffer-browserify\": \"npm:buffer@4.9.1\"\n      }\n    },\n    \"github:jspm/nodelibs-stream@0.2.0-alpha\": {\n      \"map\": {\n        \"stream-browserify\": \"npm:stream-browserify@2.0.1\"\n      }\n    },\n    \"github:jspm/nodelibs-url@0.2.0-alpha\": {\n      \"map\": {\n        \"url-browserify\": \"npm:url@0.11.0\"\n      }\n    }\n  }\n});\n"
  },
  {
    "path": "Website/package.json",
    "content": "{\n  \"name\": \"CompositeC1\",\n  \"version\": \"1.0.0\",\n  \"scripts\": {\n    \"test\": \"npm run unit:test\",\n    \"lint\": \"npm run lintconsole\",\n    \"coverage\": \"npm run unit:cov\",\n    \"unit:test\": \"jspm run test/unit/runner.js\",\n    \"unit:cov\": \"jspm run test/unit/coverage.js\",\n    \"watch\": \"chokidar-socket-emitter -p Composite/console/\",\n    \"buildconsole\": \"jspm build CMSConsole Composite/console.js --minify --production\",\n    \"lintconsole\": \"eslint Composite/console test/unit/\"\n  },\n  \"devDependencies\": {\n    \"JSONPath\": \"^0.10.0\",\n    \"autoprefixer-core\": \"^5.2.1\",\n    \"chokidar-socket-emitter\": \"0.5.4\",\n    \"chromedriver\": \"^2.34.0\",\n    \"csswring\": \"^3.0.5\",\n    \"eslint\": \"^4.18.2\",\n    \"eslint-plugin-mocha\": \"4.0.0\",\n    \"eslint-plugin-react\": \"5.2.2\",\n    \"grunt\": \"~0.4.5\",\n    \"grunt-contrib-copy\": \"0.8.2\",\n    \"grunt-contrib-less\": \"^1.0.0\",\n    \"grunt-contrib-uglify\": \"^0.9.2\",\n    \"grunt-contrib-watch\": \"~0.6.1\",\n    \"grunt-postcss\": \"^0.5.5\",\n    \"grunt-svgmin\": \"3.2.0\",\n    \"iedriver\": \"3.14.1\",\n    \"istanbul\": \"^0.4.3\",\n    \"istanbul-lib-coverage\": \"1.0.0\",\n    \"jsdom\": \"9.4.1\",\n    \"jspm\": \"0.17.0-beta.28\",\n    \"less\": \"^2.1.2\",\n    \"load-grunt-tasks\": \"3.5.0\",\n    \"mocha\": \"3.0.1\",\n    \"nightwatch\": \"0.9.3\",\n    \"node-fetch\": \"2.6.1\",\n    \"rimraf\": \"2.5.4\",\n    \"robocopy\": \"^0.1.15\",\n    \"selenium-server-standalone-jar\": \"2.53.1\",\n    \"systemjs\": \"^0.19.36\",\n    \"systemjs-istanbul-hook\": \"0.1.1\",\n    \"xml2js\": \"^0.4.10\"\n  },\n  \"jspm\": {\n    \"main\": \"Composite/console/console.js\",\n    \"dependencies\": {\n      \"fixed-data-table-2\": \"npm:fixed-data-table-2@^0.7.6\",\n      \"normalizr\": \"npm:normalizr@^2.2.1\",\n      \"plugin-babel\": \"npm:systemjs-plugin-babel@^0.0.13\",\n      \"rc-table\": \"npm:rc-table@^5.0.3\",\n      \"react-dimensions\": \"npm:react-dimensions@^1.3.0\",\n      \"react-redux\": \"npm:react-redux@^4.4.5\",\n      \"react-select\": \"npm:react-select@^1.0.0-beta14\",\n      \"redux-immutablejs\": \"npm:redux-immutablejs@^0.0.8\",\n      \"redux-observer\": \"npm:redux-observer@^1.0.0\",\n      \"redux-thunk\": \"npm:redux-thunk@^2.1.0\",\n      \"reselect\": \"npm:reselect@^2.5.4\",\n      \"styled-components\": \"npm:styled-components@^1.1.1\",\n      \"svg\": \"github:npbenjohnson/plugin-svg@^0.1.0\",\n      \"text\": \"github:systemjs/plugin-text@^0.0.9\",\n      \"url-polyfill\": \"npm:url-polyfill@1.0.13\",\n      \"wampy\": \"npm:wampy@^4.0.0\",\n      \"whatwg-fetch\": \"npm:whatwg-fetch@^1.0.0\"\n    },\n    \"devDependencies\": {\n      \"babel-plugin-transform-react-jsx\": \"npm:babel-plugin-transform-react-jsx@^6.8.0\",\n      \"babel-runtime\": \"npm:babel-runtime@^5.8.24\",\n      \"core-js\": \"npm:core-js@^1.2.0\",\n      \"dgram\": \"npm:jspm-nodelibs-dgram@^0.2.0\",\n      \"dns\": \"npm:jspm-nodelibs-dns@^0.2.0\",\n      \"ecc-jsbn\": \"npm:ecc-jsbn@~0.1.1\",\n      \"glob\": \"npm:glob@^7.0.5\",\n      \"jodid25519\": \"npm:jodid25519@^1.0.0\",\n      \"jsbn\": \"npm:jsbn@0.1\",\n      \"react-addons-test-utils\": \"npm:react-addons-test-utils@^15.3.0\",\n      \"react-immutable-proptypes\": \"npm:react-immutable-proptypes@^2.1.0\",\n      \"sinon\": \"npm:sinon@^1.17.5\",\n      \"source-map\": \"npm:source-map@0.2\",\n      \"systemjs-hot-reloader\": \"github:alexisvincent/systemjs-hot-reloader@^0.6.0\",\n      \"systemjs-hot-reloader-store\": \"github:peteruithoven/systemjs-hot-reloader-store@^1.0.0\",\n      \"tweetnacl\": \"npm:tweetnacl@0.13\",\n      \"unexpected-dom\": \"npm:unexpected-dom@^3.1.0\",\n      \"unexpected-mitm\": \"npm:unexpected-mitm@^9.1.6\",\n      \"unexpected-react\": \"npm:unexpected-react@^3.2.3\",\n      \"unexpected-sinon\": \"npm:unexpected-sinon@^10.5.1\",\n      \"unexpected-zurvan\": \"npm:unexpected-zurvan@^0.1.0\",\n      \"zurvan\": \"npm:zurvan@^0.3.2\"\n    },\n    \"peerDependencies\": {\n      \"assert\": \"npm:jspm-nodelibs-assert@^0.2.0\",\n      \"bluebird\": \"npm:bluebird@^3.0.0\",\n      \"buffer\": \"github:jspm/nodelibs-buffer@^0.2.0-alpha\",\n      \"child_process\": \"npm:jspm-nodelibs-child_process@^0.2.0\",\n      \"constants\": \"npm:jspm-nodelibs-constants@^0.2.0\",\n      \"crypto\": \"npm:jspm-nodelibs-crypto@^0.2.0\",\n      \"domain\": \"npm:jspm-nodelibs-domain@^0.2.0\",\n      \"events\": \"github:jspm/nodelibs-events@^0.2.0-alpha\",\n      \"fs\": \"github:jspm/nodelibs-fs@^0.2.0-alpha\",\n      \"http\": \"github:jspm/nodelibs-http@^0.2.0-alpha\",\n      \"https\": \"npm:jspm-nodelibs-https@^0.2.0\",\n      \"immutable\": \"npm:immutable@^3.8.1\",\n      \"magicpen-media\": \"npm:magicpen-media@^1.5.0\",\n      \"messy\": \"npm:messy@^6.12.0\",\n      \"module\": \"npm:jspm-nodelibs-module@^0.2.0\",\n      \"net\": \"npm:jspm-nodelibs-net@^0.2.0\",\n      \"os\": \"npm:jspm-nodelibs-os@^0.2.0\",\n      \"path\": \"github:jspm/nodelibs-path@^0.2.0-alpha\",\n      \"process\": \"github:jspm/nodelibs-process@^0.2.0-alpha\",\n      \"punycode\": \"npm:jspm-nodelibs-punycode@^0.2.0\",\n      \"querystring\": \"npm:jspm-nodelibs-querystring@^0.2.0\",\n      \"react\": \"npm:react@^15.3.2\",\n      \"react-dom\": \"npm:react-dom@^15.3.2\",\n      \"redux\": \"npm:redux@^3.5.2\",\n      \"repl\": \"npm:jspm-nodelibs-repl@^0.2.0\",\n      \"stream\": \"github:jspm/nodelibs-stream@^0.2.0-alpha\",\n      \"string_decoder\": \"npm:jspm-nodelibs-string_decoder@^0.2.0\",\n      \"tls\": \"npm:jspm-nodelibs-tls@^0.2.0\",\n      \"tty\": \"npm:jspm-nodelibs-tty@^0.2.0\",\n      \"unexpected\": \"npm:unexpected@^10.10.0\",\n      \"unexpected-messy\": \"npm:unexpected-messy@^6.0.0\",\n      \"url\": \"github:jspm/nodelibs-url@^0.2.0-alpha\",\n      \"util\": \"github:jspm/nodelibs-util@^0.2.0-alpha\",\n      \"vm\": \"npm:jspm-nodelibs-vm@^0.2.0\",\n      \"zlib\": \"npm:jspm-nodelibs-zlib@^0.2.0\"\n    },\n    \"overrides\": {\n      \"github:socketio/socket.io-client@1.5.0\": {\n        \"main\": \"socket.io.js\"\n      },\n      \"npm:babel-runtime@5.8.38\": {\n        \"main\": false,\n        \"dependencies\": {},\n        \"optionalDependencies\": {\n          \"core-js\": \"^1.2.0\"\n        }\n      },\n      \"npm:bluebird@3.4.6\": {\n        \"meta\": {\n          \"js/browser/bluebird.js\": {\n            \"format\": \"global\"\n          },\n          \"js/browser/bluebird.min.js\": {\n            \"format\": \"global\"\n          }\n        }\n      },\n      \"npm:browserify-zlib@0.1.4\": {\n        \"dependencies\": {\n          \"readable-stream\": \"^2.0.2\",\n          \"pako\": \"~0.2.0\"\n        },\n        \"map\": {\n          \"_stream_transform\": \"readable-stream/transform\"\n        }\n      },\n      \"npm:debug@2.2.0\": {\n        \"main\": \"browser.js\",\n        \"jspmNodeConversion\": false,\n        \"format\": \"cjs\",\n        \"map\": {\n          \"./browser.js\": {\n            \"node\": \"./node.js\"\n          },\n          \"fs\": \"@node/fs\",\n          \"net\": \"@node/net\",\n          \"tty\": \"@node/tty\",\n          \"util\": \"@node/util\"\n        }\n      },\n      \"npm:debug@2.3.2\": {\n        \"main\": \"browser.js\",\n        \"jspmNodeConversion\": false,\n        \"format\": \"cjs\",\n        \"map\": {\n          \"./browser.js\": {\n            \"node\": \"./node.js\"\n          },\n          \"fs\": \"@node/fs\",\n          \"net\": \"@node/net\",\n          \"tty\": \"@node/tty\",\n          \"util\": \"@node/util\"\n        }\n      },\n      \"npm:inherits@2.0.1\": {\n        \"ignore\": [\n          \"test.js\"\n        ]\n      },\n      \"npm:inherits@2.0.3\": {\n        \"ignore\": [\n          \"test.js\"\n        ]\n      },\n      \"npm:lodash@4.16.4\": {\n        \"map\": {\n          \"buffer\": \"@empty\",\n          \"process\": \"@empty\"\n        }\n      },\n      \"npm:lodash@4.17.2\": {\n        \"map\": {\n          \"buffer\": \"@empty\",\n          \"process\": \"@empty\"\n        }\n      },\n      \"npm:ms@0.7.1\": {\n        \"jspmNodeConversion\": false,\n        \"format\": \"cjs\"\n      },\n      \"npm:ms@0.7.2\": {\n        \"jspmNodeConversion\": false,\n        \"format\": \"cjs\"\n      },\n      \"npm:styled-components@1.1.1\": {\n        \"dependencies\": {\n          \"buffer\": \"^5.0.0\",\n          \"fbjs\": \"^0.8.4\",\n          \"glamor\": \"^2.15.5\",\n          \"inline-style-prefixer\": \"^2.0.4\",\n          \"lodash\": \"^4.15.0\",\n          \"supports-color\": \"^3.1.2\"\n        }\n      },\n      \"npm:unexpected@10.18.1\": {\n        \"main\": \"unexpected.js\",\n        \"dependencies\": {},\n        \"jspmPackage\": true\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "Website/packages.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<packages>\r\n  <package id=\"Castle.Core\" version=\"4.2.1\" targetFramework=\"net471\" />\r\n  <package id=\"Microsoft.AspNet.Razor\" version=\"3.2.3\" targetFramework=\"net45\" />\r\n  <package id=\"Microsoft.AspNet.WebPages\" version=\"3.2.3\" targetFramework=\"net45\" />\r\n  <package id=\"Microsoft.CodeAnalysis.Analyzers\" version=\"1.1.0\" targetFramework=\"net461\" />\r\n  <package id=\"Microsoft.CodeAnalysis.Common\" version=\"2.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"Microsoft.CodeAnalysis.CSharp\" version=\"2.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"Microsoft.Web.Infrastructure\" version=\"1.0.0.0\" targetFramework=\"net45\" />\r\n  <package id=\"Newtonsoft.Json\" version=\"6.0.5\" targetFramework=\"net461\" />\r\n  <package id=\"Orckestra.AspNet.Roslyn\" version=\"1.0.2\" targetFramework=\"net461\" />\r\n  <package id=\"PhantomJS\" version=\"2.1.1\" targetFramework=\"net45\" />\r\n  <package id=\"System.Collections.Immutable\" version=\"1.3.1\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive.Core\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive.Interfaces\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reactive.Linq\" version=\"3.0.0\" targetFramework=\"net461\" />\r\n  <package id=\"System.Reflection.Metadata\" version=\"1.4.2\" targetFramework=\"net461\" />\r\n  <package id=\"System.Threading.Tasks.Dataflow\" version=\"4.7.0\" targetFramework=\"net471\" />\r\n</packages>"
  },
  {
    "path": "Website/robots.txt",
    "content": "﻿User-agent: *\r\n\r\n#\r\n# C1 CMS will generate a SEO sitemap for /sitemap.xml requests\r\n# Make the Sitemap URL below absolute (add http://[your hostname]) for this to be correct: \r\n#\r\nSitemap: /sitemap.xml\r\n"
  },
  {
    "path": "Website/test/e2e/.editorconfig",
    "content": "[*.js]\r\nindent_style = tab\r\nindent_size = 2"
  },
  {
    "path": "Website/test/e2e/ApiLang/Notepad++/Nightwatch.UDL.xml",
    "content": "<NotepadPlus>\r\n    <UserLang name=\"Nightwatch\" ext=\"nightwatch\" udlVersion=\"2.1\">\r\n        <Settings>\r\n            <Global caseIgnored=\"no\" allowFoldOfComments=\"no\" foldCompact=\"no\" forcePureLC=\"0\" decimalSeparator=\"0\" />\r\n            <Prefix Keywords1=\"no\" Keywords2=\"no\" Keywords3=\"no\" Keywords4=\"no\" Keywords5=\"no\" Keywords6=\"no\" Keywords7=\"no\" Keywords8=\"no\" />\r\n        </Settings>\r\n        <KeywordLists>\r\n            <Keywords name=\"Comments\">03/* 03/** 04*/ 04*/ 00// 01 02</Keywords>\r\n            <Keywords name=\"Numbers, prefix1\"></Keywords>\r\n            <Keywords name=\"Numbers, prefix2\"></Keywords>\r\n            <Keywords name=\"Numbers, extras1\"></Keywords>\r\n            <Keywords name=\"Numbers, extras2\"></Keywords>\r\n            <Keywords name=\"Numbers, suffix1\"></Keywords>\r\n            <Keywords name=\"Numbers, suffix2\"></Keywords>\r\n            <Keywords name=\"Numbers, range\"></Keywords>\r\n            <Keywords name=\"Operators1\">( ) [ ] { } ... . , ;</Keywords>\r\n            <Keywords name=\"Operators2\"></Keywords>\r\n            <Keywords name=\"Folders in code1, open\"></Keywords>\r\n            <Keywords name=\"Folders in code1, middle\"></Keywords>\r\n            <Keywords name=\"Folders in code1, close\"></Keywords>\r\n            <Keywords name=\"Folders in code2, open\"></Keywords>\r\n            <Keywords name=\"Folders in code2, middle\"></Keywords>\r\n            <Keywords name=\"Folders in code2, close\"></Keywords>\r\n            <Keywords name=\"Folders in comment, open\"></Keywords>\r\n            <Keywords name=\"Folders in comment, middle\"></Keywords>\r\n            <Keywords name=\"Folders in comment, close\"></Keywords>\r\n            <Keywords name=\"Keywords1\">assertBrowserContainsAttribute assertBrowserContains assertFieldValue assertTreeNodeHasChild assertTreeNodeIsEmpty assertTreeNodeIsNotEmpty clickDataBySibilings clickDialogButton clickInFrame clickLabel clickSave replaceTextInCodeMirror selectEditOnContent clickText closeDocumentTab changeElementContent doubleClickSelector enterFrame leaveFrame openTreeNode replaceContent rightClickSelector selectActionFromToolbar selectContentTab selectDialog selectDocumentTab selectFrame selectFrameWithXpath selectPerspective selectTreeNodeAction setFieldValueInFieldGroup setFieldValue setFileFieldValue switchContentTab topFrame waitForFrameLoad acceptChanges acceptFunctionEdit assertTreeNodeHasNoChild submitFormData installPackage uninstallPackage installCommercialPackage installLocalPackage uninstallLocalPackage installLocale uninstallLocale installWebsite logOut</Keywords>\r\n            <Keywords name=\"Keywords2\">browser editor2 editor</Keywords>\r\n            <Keywords name=\"Keywords3\">beforeEach afterEach done</Keywords>\r\n            <Keywords name=\"Keywords4\"></Keywords>\r\n            <Keywords name=\"Keywords5\"></Keywords>\r\n            <Keywords name=\"Keywords6\"></Keywords>\r\n            <Keywords name=\"Keywords7\"></Keywords>\r\n            <Keywords name=\"Keywords8\"></Keywords>\r\n            <Keywords name=\"Delimiters\">00&quot; 01 02&quot; 03&apos; 04 05&apos; 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>\r\n        </KeywordLists>\r\n        <Styles>\r\n            <WordsStyle name=\"DEFAULT\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"COMMENTS\" fgColor=\"008000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"LINE COMMENTS\" fgColor=\"008000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"NUMBERS\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"KEYWORDS1\" fgColor=\"0000FF\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"1\" nesting=\"0\" />\r\n            <WordsStyle name=\"KEYWORDS2\" fgColor=\"008000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"1\" nesting=\"0\" />\r\n            <WordsStyle name=\"KEYWORDS3\" fgColor=\"FF00FF\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"1\" nesting=\"0\" />\r\n            <WordsStyle name=\"KEYWORDS4\" fgColor=\"0000FF\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"KEYWORDS5\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"KEYWORDS6\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"KEYWORDS7\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"KEYWORDS8\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"OPERATORS\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"1\" nesting=\"0\" />\r\n            <WordsStyle name=\"FOLDER IN CODE1\" fgColor=\"FFFF00\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"FOLDER IN CODE2\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"FOLDER IN COMMENT\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"DELIMITERS1\" fgColor=\"A00000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"DELIMITERS2\" fgColor=\"A00000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"DELIMITERS3\" fgColor=\"A00000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"DELIMITERS4\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"DELIMITERS5\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"DELIMITERS6\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"DELIMITERS7\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n            <WordsStyle name=\"DELIMITERS8\" fgColor=\"000000\" bgColor=\"FFFFFF\" fontName=\"\" fontStyle=\"0\" nesting=\"0\" />\r\n        </Styles>\r\n    </UserLang>\r\n</NotepadPlus>\r\n"
  },
  {
    "path": "Website/test/e2e/ApiLang/Notepad++/installation.txt",
    "content": "1. copy nightwatch.xml to your notepad++ api directory ( C:\\Program Files (x86)\\Notepad++\\plugins\\APIs\\ )\r\n2. in notepad++ select Languages > Define Your Language.. > Import... > (select nightwatch.UML.xml)\r\n3. restart notepad++\r\n\r\nit should appear in language menu as Nightwatch"
  },
  {
    "path": "Website/test/e2e/ApiLang/Notepad++/nightwatch.xml",
    "content": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<NotepadPlus>\r\n\t<!-- language doesnt really mean anything, its more of a comment -->\r\n\t<AutoComplete language=\"NightWatch\">\r\n\t\t<!--\r\n\t\tEnvironment specifies how the language should be interpreted. ignoreCase makes autocomplete\r\n\t\tignore any casing, start and stopFunc specify what chars a function starts and stops with.\r\n\t\tparam specifies parameter separator and terminal can be used to specify a character that stops\r\n\t\tany function. Using the same character for different functions results in undefined behaviour.\r\n\t\t\r\n\t\t05/11/2009\r\n\t\tThe basic word character are : A-Z a-z 0-9 and '_' \r\n\t\tIf your function name contains other characters,\r\n\t\tadd your characters in \"additionalWordChar\" attribute (without separator)\r\n\t\tin order to make calltip hint work\r\n\t\t-->\r\n\t\t<Environment ignoreCase=\"no\" startFunc=\"(\" stopFunc=\")\" paramSeparator=\",\" terminal=\";\" additionalWordChar=\"\"/>\r\n\t\t<!--\r\n\t\tThe following items should be alphabetically ordered.\r\n\t\tfunc=\"yes\" means the keyword should be treated as a fuction, and thus can be used in the parameter\r\n\t\tcalltip system. If this is the case, the retVal attribute specifies the return value/type. Any\r\n\t\tfollowing Param tag specifies a parameter, they must be in order. The name attributes specifies\r\n\t\tthe parameter name.\r\n\t\t-->\r\n\t\t<KeyWord name=\"assertBrowserContainsAttribute\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t\t<Param name=\"attribute\" />\r\n\t\t\t\t<Param name=\"value\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"assertBrowserContains\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\"/>\r\n\t\t\t\t<Param name=\"value\"/>\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"assertFieldValue\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"dialogLabel\" />\r\n\t\t\t\t<Param name=\"fieldLabel\" />\r\n\t\t\t\t<Param name=\"valueToAssert\" />\r\n\t\t\t\t<Param name=\"inputType\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"assertTreeNodeHasChild\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"parentLabel\" />\r\n\t\t\t\t<Param name=\"childLabel\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"assertTreeNodeHasNoChild\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"parentLabel\" />\r\n\t\t\t\t<Param name=\"childLabel\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"assertTreeNodeIsEmpty\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"parentLabel\" />\r\n\t\t\t\t<Param name=\"childLabel\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"assertTreeNodeIsNotEmpty\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"parentLabel\" />\r\n\t\t\t\t<Param name=\"childLabel\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"clickDataBySibilings\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"value\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"clickDialogButton\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"button\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"clickInFrame\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"frameSelector\" />\r\n\t\t\t\t<Param name=\"buttonSelector\" />\r\n\t\t\t\t<Param name=\"waitTime\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"clickLabel\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"label\" />\r\n\t\t\t\t<Param name=\"(optional)parentLabel\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"clickSave\" func=\"yes\">\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"clickText\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"value\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"closeDocumentTab\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"tabName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"doubleClickSelector\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"enterFrame\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"leaveFrame\" func=\"yes\">\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"openTreeNode\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"parentLabel\" />\r\n\t\t\t\t<Param name=\"childLabel\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"replaceContent\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t\t<Param name=\"newContent\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"rightClickSelector\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"selectActionFromToolbar\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"perspective\" />\r\n\t\t\t\t<Param name=\"node\" />\r\n\t\t\t\t<Param name=\"action\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"selectContentTab\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"tabName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"selectDialog\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"dialogName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"selectDocumentTab\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"tabName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"selectFrame\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t\t<Param name=\"noReset\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"selectFrameWithXpath\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t\t<Param name=\"noReset\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"selectPerspective\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"perspective\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"selectTreeNodeAction\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"node\" />\r\n\t\t\t\t<Param name=\"action\" />\r\n\t\t\t\t<Param name=\"bundle (optional)\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"setFieldValueInFieldGroup\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"dialogLabel\" />\r\n\t\t\t\t<Param name=\"fieldLabel\" />\r\n\t\t\t\t<Param name=\"value\" />\r\n\t\t\t\t<Param name=\"(optional)inputType\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"setFieldValue\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"fieldLabel\" />\r\n\t\t\t\t<Param name=\"value\" />\r\n\t\t\t\t<Param name=\"inputType\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"setFileFieldValue\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"fieldLabel\" />\r\n\t\t\t\t<Param name=\"path\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"switchContentTab\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"tabName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"topFrame\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"submitFormData\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"submitValue\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"waitForFrameLoad\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"selector\" />\r\n\t\t\t\t<Param name=\"timeout\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"replaceTextInCodeMirror\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"oldString\" />\r\n\t\t\t\t<Param name=\"newString\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"installPackage\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"category\" />\r\n\t\t\t\t<Param name=\"packageName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"uninstallPackage\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"category\" />\r\n\t\t\t\t<Param name=\"packageName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"installCommercialPackage\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"category\" />\r\n\t\t\t\t<Param name=\"packageName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\t\t\t\r\n\t\t<KeyWord name=\"installLocalPackage\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"packagePath\" />\r\n\t\t\t\t<Param name=\"packageName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\t\t\r\n\t\t<KeyWord name=\"uninstallLocalPackage\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"packageName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"installLocale\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"language\" />\r\n\t\t\t\t<Param name=\"code\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\t\t\r\n\t\t<KeyWord name=\"uninstallLocale\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"language\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"installWebsite\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"setupOption\" />\r\n\t\t\t\t<Param name=\"starterSite\" />\r\n\t\t\t\t<Param name=\"expectedLanguage\" />\r\n\t\t\t\t<Param name=\"newLanguage\" />\r\n\t\t\t\t<Param name=\"newLanguageCode\" />\t\t\t\t\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\r\n\t\t<KeyWord name=\"logOut\" func=\"yes\">\r\n\t\t\t<Overload retVal=\"browser\" >\r\n\t\t\t\t<Param name=\"userName\" />\r\n\t\t\t</Overload>\r\n\t\t</KeyWord>\t\t\r\n\t</AutoComplete>\r\n</NotepadPlus>"
  },
  {
    "path": "Website/test/e2e/README.md",
    "content": "# Warnings\n\nThis test suite is intended to verify console function when changing functionality within the CMS. **Do not run it** to test any particular site setup as it will not only not work, but will delete data installed on this CMS copy.\n\n# Running the nightwatch tests\n\nIn order to run the end-to-end test suite, you will first need to have built your working copy of CMS with Visual Studio, installed all npm packages, and run the grunt build task as documented elsewhere.\n\nIn order to install nightwatch, you will need to access your command line. This can be done by either starting PowerShell or the Windows Command Line utility, `cmd`.\n\nFirst we need to verify that you have the needed version of node.js, which is used to execute the tests. In your command line, enter the command `node -v`. This should respond with better than version 4.4. If your version is older (or you don't have node.js installed), you can install the current version from [the official website](https://nodejs.org/en/download/). As of this writing, the recommended version is 4.4.7 LTS (subject to change).\n\nThe next step is installing nightwatch itself. This is done by issuing the command `npm install -g nightwatch`. This will install nightwatch as a globally accessible command. There may be some warnings issued by npm as it runs, these can usually be ignored without issue.\n\nNightwatch expects to find the CMS running on localhost, port 8080. You can either change your Visual Studio or WebMatrix/IIS setup to use this port, or edit the `nightwatch.json` configuration file found in the project root. You can edit the line that says `\"launch_url\" : \"http://localhost:8080\"` to reflect the URL used.\n\nYou may need to consider installing the latest:\n\n* chromedriver (if running tests in Chrome)\n* robocopy (used for reseting the website and installing various Starter Site options)\n\nGo to /Website and run these commands there:\n\n* `npm install --save-dev chromedriver@latest`\n* `npm install --save-dev robocopy@latest`\n\nFinally, navigate to the root directory of your CMS working copy. This will usually be named `CMS`, but you may have named it otherwise when cloning it. In this directory, you can then start the tests by running `nightwatch` from your command line. This will run the whole test suite, starting with installing the Venus starter site.\n\nDue to certain technical limitations, nightwatch must always be run from the working directory, and cannot be run from any subdirectory.\n\n## Running tests separately\n\nA few methods exist to run specific tests. If you wish to rerun the installation test alone, you can exploit the fact that it has the `install` tag. If you add the 'tag' command line switch - `nightwatch --tag install` - only tests with that tag will be run, no others.\n\nIf, conversely, you wish to run all other tests, but not the install test - for instance if you just ran the install test separately and it passed - you can skip that test by using `nightwatch --skiptags install`.\n\nLastly, if you wish to run a particular test, locate the file containing it, and simply give that as a parameter to the nightwatch command, like this: `nightwatch .\\Website\\test\\e2e\\100_login\\devMode.js`. This also works if you wish to run the tests in a specific directory: `nightwatch .\\Website\\test\\e2e\\100_login\\` will run all tests in that directory.\n\n## Constructing new tests\n\nTest related files are found within `.\\Website\\test\\e2e\\`, alongside this readme file.\n\nTo build new tests, it is recommended to look at what already exists, and structure your tests similarly. It is also recommended to familiarize yourself with nightwatch's own [documentation](http://nightwatchjs.org/guide).\n\nA test file consists of a CommonJS formatted module, exporting a single object with functions as members. A few names on these objects are reserved - `before`, `after`, `beforeEach` and `afterEach` - for setting up and tearing down your tests. You can look this up in [the nightwatch developer guide](http://nightwatchjs.org/guide#using-before-each-and-after-each-hooks) for the full details. Any other member of that object will be run as a test case.\n\nCustom commands have been added to accommodate testing within the specific system of CMS's console. These may be found within the `commands` directory, with examples of use found throughout the test cases.\n\nA number of [page objects](http://nightwatchjs.org/guide#page-objects) have been constructed as well, providing ease of access, custom commands and assertions specific to certain parts of the console. These may be found in the `pageObjects` directory, again, with examples of use throughout the tests.\n"
  },
  {
    "path": "Website/test/e2e/commands/assertBrowserContains.js",
    "content": "var events = require('events');\n\nfunction AssertBrowserContains() {\n  events.EventEmitter.call(this);\n}\n\nAssertBrowserContains.prototype.command = function (selector, value) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n\t\t.enterActivePerspective();\n    content._assertBrowserContains(selector, value);\n    return this.client.api;\n};\n\nmodule.exports = AssertBrowserContains;\n"
  },
  {
    "path": "Website/test/e2e/commands/assertBrowserContainsAttribute.js",
    "content": "var events = require('events');\n\nfunction AssertBrowserContainsAttribute() {\n  events.EventEmitter.call(this);\n}\n\nAssertBrowserContainsAttribute.prototype.command = function (selector,attribute, value) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n\t\t.enterActivePerspective();\n    content._assertBrowserContainsAttribute(selector,attribute, value);\n    return this.client.api;\n};\n\nmodule.exports = AssertBrowserContainsAttribute;\n"
  },
  {
    "path": "Website/test/e2e/commands/assertBrowserContainsWithXpath.js",
    "content": "var events = require('events');\n\nfunction AssertBrowserContains() {\n  events.EventEmitter.call(this);\n}\n\nAssertBrowserContains.prototype.command = function (selector) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n\t\t.enterActivePerspective();\n    content._assertBrowserContains(selector);\n    return this.client.api;\n};\n\nmodule.exports = AssertBrowserContains;\n"
  },
  {
    "path": "Website/test/e2e/commands/assertFieldValue.js",
    "content": "var events = require('events');\n\nfunction AssertFieldValue() {\n  events.EventEmitter.call(this);\n}\n\nAssertFieldValue.prototype.command = function (dialogLabel,fieldLabel,vlaueToAssert,inputType) {\n\tif(inputType == null){\n\t\tinputType = \"input\";\n\t}\n    if (dialogLabel == null) {\n        this.client.api.selectFrameWithXpath('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]');\n    } else {\n        this.client.api.selectFrameWithXpath('//*[local-name() = \"fieldgroup\"][@label=\"' + dialogLabel + '\"]');\n    }\n    this.client.api\n        .useXpath()\n\t\t.getValue('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]/parent::*//*[local-name() = \"'+inputType+'\"]',function(result) {\n\t\t\tthis.assert.equal(typeof result, \"object\");\n\t\t\tthis.assert.equal(result.status, 0);\n\t\t\tthis.assert.equal(result.value, vlaueToAssert);\n\t\t}).useCss();\n        \n    return this.client.api;\n};\n\nmodule.exports = AssertFieldValue;\n"
  },
  {
    "path": "Website/test/e2e/commands/assertTreeNodeHasChild.js",
    "content": "var events = require('events');\n\nfunction AssertTreeNodeHasChild() {\n  events.EventEmitter.call(this);\n}\n\nAssertTreeNodeHasChild.prototype.command = function (parentLabel, childLabel) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n\t\t.enterActivePerspective()\n        ._assertTreeNodeHasChild(parentLabel, childLabel);\n    return this.client.api;\n};\n\nmodule.exports = AssertTreeNodeHasChild;\n"
  },
  {
    "path": "Website/test/e2e/commands/assertTreeNodeHasNoChild.js",
    "content": "var events = require('events');\n\nfunction AssertTreeNodeHasChild() {\n  events.EventEmitter.call(this);\n}\n\nAssertTreeNodeHasChild.prototype.command = function (parentLabel, childLabel) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n\t\t.enterActivePerspective()\n        ._assertTreeNodeHasNoChild(parentLabel, childLabel);\n    return this.client.api;\n};\n\nmodule.exports = AssertTreeNodeHasChild;\n"
  },
  {
    "path": "Website/test/e2e/commands/assertTreeNodeIsEmpty.js",
    "content": "var events = require('events');\n\nfunction AssertTreeNodeIsEmpty() {\n  events.EventEmitter.call(this);\n}\n\nAssertTreeNodeIsEmpty.prototype.command = function (parentLabel, childLabel) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n\t\t.enterActivePerspective()\n        ._assertTreeNodeIsEmpty(parentLabel, childLabel);\n    return this.client.api;\n};\n\nmodule.exports = AssertTreeNodeIsEmpty;\n"
  },
  {
    "path": "Website/test/e2e/commands/assertTreeNodeIsNotEmpty.js",
    "content": "var events = require('events');\n\nfunction AssertTreeNodeIsNotEmpty() {\n  events.EventEmitter.call(this);\n}\n\nAssertTreeNodeIsNotEmpty.prototype.command = function (parentLabel, childLabel) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n\t\t.enterActivePerspective()\n        ._assertTreeNodeIsNotEmpty(parentLabel, childLabel);\n    return this.client.api;\n};\n\nmodule.exports = AssertTreeNodeIsNotEmpty;\n"
  },
  {
    "path": "Website/test/e2e/commands/clickDataBySibilings.js",
    "content": "var events = require('events');\n\nfunction ClickDataBySibiling() {\n  events.EventEmitter.call(this);\n}\n\nClickDataBySibiling.prototype.command = function (vlaue) {\n\tthis.client.api.selectFrameWithXpath('//*[local-name()=\"fielddesc\"][normalize-space(text())=\"'+vlaue+'\"]');\n    \n    this.client.api\n        .useXpath()\n\t\t.click('//*[local-name()=\"fielddesc\"][normalize-space(text())=\"'+vlaue+'\"]/..//*[local-name()=\"fielddata\"]').useCss()\n        \n    return this.client.api;\n};\n\nmodule.exports = ClickDataBySibiling;"
  },
  {
    "path": "Website/test/e2e/commands/clickDialogButton.js",
    "content": "var events = require('events');\nvar util = require('util');\n\nfunction ClickOnDialogButton() {\n  events.EventEmitter.call(this);\n}\n\nutil.inherits(ClickOnDialogButton, events.EventEmitter);\n\nClickOnDialogButton.prototype.command = function (button) {\n    this.client.api\n        .pause(this.api.globals.timeouts.smallest)\n        .selectFrame('clickbutton[label=\"' + button + '\"]')\n        .waitForElementVisible('clickbutton[label=\"' + button + '\"]', this.api.globals.timeouts.basic)\n        .click('clickbutton[label=\"'+button+'\"]', () => this.emit('complete'))\n    return this.client.api;\n};\n\nmodule.exports = ClickOnDialogButton;\n"
  },
  {
    "path": "Website/test/e2e/commands/clickInFrame.js",
    "content": "exports.command = function (frameSelector, buttonSelector, waitTime) {\n\tif (arguments.length < 3 && typeof buttonSelector !== 'string') {\n\t\tif (typeof buttonSelector === 'number') {\n\t\t\twaitTime = buttonSelector;\n\t\t}\n\t\tbuttonSelector = frameSelector;\n\t}\n\n\tthis.selectFrame(frameSelector);\n\tthis.waitForElementVisible(buttonSelector, waitTime || this.api.globals.timeouts.basic);\n\tthis.click(buttonSelector);\n\tif (waitTime) {\n\t\tthis.pause(waitTime);\n\t}\n  return this;\n};\n"
  },
  {
    "path": "Website/test/e2e/commands/clickLabel.js",
    "content": "var events = require('events');\n\nfunction ClickLabel() {\n  events.EventEmitter.call(this);\n}\n\nClickLabel.prototype.command = function (label,parentLabel) {\n\tvar selector;\n\tif(parentLabel==null){\n\t\tselector ='//*[@label=\"'+label+'\"]';\n\t}\n\telse{\n\t\tselector= '//*[@label=\"'+parentLabel+'\"]//*[@label=\"'+label+'\"]'\n\t}\n\tthis.client.api.selectFrameWithXpath(selector);\n    \n\tthis.client.api\n        .useXpath()\n\t\t.moveToElement(selector,null,null)\n\t\t.mouseButtonClick('left').useCss()\n        \n    return this.client.api;\n};\n\nmodule.exports = ClickLabel;"
  },
  {
    "path": "Website/test/e2e/commands/clickSave.js",
    "content": "var events = require('events');\n\nfunction ClickSave() {\n  events.EventEmitter.call(this);\n}\n\nClickSave.prototype.command = function () {\n    this.client.api\n        .selectFrame('#savebutton');\n\tthis.client.api.expect.element('#savebutton').to.not.have.attribute('isdisabled');\n\tthis.client.api.click('#savebutton > labelbox');\n\tthis.client.api.waitForElementVisible('#savebutton[isdisabled=\"true\"]',this.api.globals.timeouts.save);\n    return this.client.api;\n};\n\nmodule.exports = ClickSave;"
  },
  {
    "path": "Website/test/e2e/commands/clickText.js",
    "content": "var events = require('events');\n\nfunction ClickText() {\n  events.EventEmitter.call(this);\n}\n\nClickText.prototype.command = function (vlaue) {\n\tthis.client.api.selectFrameWithXpath('//*[normalize-space(text())=\"'+vlaue+'\"]');\n    \n    this.client.api\n        .useXpath()\n\t\t.moveToElement('//*[normalize-space(text())=\"'+vlaue+'\"]',null,null)\n\t\t.mouseButtonClick('left').useCss()\n        \n    return this.client.api;\n};\n\nmodule.exports = ClickText;"
  },
  {
    "path": "Website/test/e2e/commands/closeDocumentTab.js",
    "content": "var events = require('events');\n\nfunction CloseDocumentTab() {\n  events.EventEmitter.call(this);\n}\n\nCloseDocumentTab.prototype.command = function (tabName) {\n\n\tthis.client.api.selectFrameWithXpath('//*[local-name() = \"docktab\"]//*[@label=\"'+tabName+'\"]');\n\tthis.client.api\n        .useXpath()\n\t\t.click('//*[local-name() = \"docktab\"]//*[@label=\"'+tabName+'\"]/*//*[local-name() = \"control\"][@controltype=\"close\"]').useCss()\n        \n    return this.client.api;\n};\n\nmodule.exports = CloseDocumentTab;"
  },
  {
    "path": "Website/test/e2e/commands/doubleClickSelector.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction DoubleClick() {\n  events.EventEmitter.call(this);\n}\n\nutil.inherits(DoubleClick, events.EventEmitter);\n\nDoubleClick.prototype.command = function (selector) {\n\tthis.client.api.element('css selector', selector, result => {\n\t\tif (!result.value.ELEMENT) {\n\t\t\tthis.client.assertion(false, null, null, 'Element <' + selector + '> was not found', this.abortOnFailure, this._stackTrace);\n\t\t\tthis.emit('complete');\n\t\t\treturn;\n\t\t}\n\t\tvar element = result.value.ELEMENT;\n\t\tthis.client.api.moveTo(element, null, null, () => {\n\t\t\tthis.client.api.doubleClick(() => this.emit('complete'));\n\t\t});\n\t});\n  return this.client.api;\n};\n\nmodule.exports = DoubleClick;\n"
  },
  {
    "path": "Website/test/e2e/commands/enterFrame.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction EnterFrame() {\n  events.EventEmitter.call(this);\n}\n\nutil.inherits(EnterFrame, events.EventEmitter);\n\nEnterFrame.prototype.command = function(selector) {\n\tthis.client.api.element('css selector', selector, result => {\n\t\tif (!result.value.ELEMENT) {\n\t\t\tthis.client.assertion(false, null, null, 'Frame <' + selector + '> was not found', this.abortOnFailure, this._stackTrace);\n\t\t\tthis.emit('complete');\n\t\t\treturn;\n\t\t}\n\t\tthis.client.api.frame(\n\t\t\tresult.value,\n\t\t\t() => {\n\t\t\t\tthis.emit('complete');\n\t\t\t}\n\t\t);\n\t});\n  return this.client.api;\n};\n\nmodule.exports = EnterFrame;\n"
  },
  {
    "path": "Website/test/e2e/commands/installCommercialPackage.js",
    "content": "var events = require('events');\n\nfunction InstallPackage() {\n  events.EventEmitter.call(this);\n}\n\nInstallPackage.prototype.command = function (category,packageName) {\n    this.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Available Packages\")\n\t\t.openTreeNode(category)\n\t\t.selectTreeNodeAction(packageName, \"Install\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickLabel(\"I accept the license agreement\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Finish\")\n\t\t.pause(5000)\n\t\t.refresh()\n\t\t\n\tthis.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Packages\",\"Installed Packages\")\n\t\t.openTreeNode(\"Installed Packages\",category)\n\t\t.assertTreeNodeHasChild(category,packageName)\n\t\t.refresh()\n\t\t\n\treturn this.client.api;\n};\n\nmodule.exports = InstallPackage;\n"
  },
  {
    "path": "Website/test/e2e/commands/installLocalPackage.js",
    "content": "var events = require('events');\n\nfunction InstallPackage() {\n  events.EventEmitter.call(this);\n}\n\nInstallPackage.prototype.command = function (packagePath, packageName) {\n    this.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.selectTreeNodeAction(\"Packages\", \"Install Local Package...\")\n\t\t.setFileFieldValue(\"Package file\", packagePath + \"\\\\\" + packageName + '.zip')\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Finish\")\n\t\t.pause(5000)\n\t\t.refresh()\n\t\t\n\tthis.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Packages\",\"Installed Packages\")\n\t\t.openTreeNode(\"Installed Packages\",\"Local Packages\")\n\t\t.assertTreeNodeHasChild(\"Local Packages\",packageName)\n\t\t.refresh()\n\t\t\n\treturn this.client.api;\n};\n\nmodule.exports = InstallPackage;\n"
  },
  {
    "path": "Website/test/e2e/commands/installLocale.js",
    "content": "var events = require('events');\n\nfunction InstallLocale() {\n  events.EventEmitter.call(this);\n}\n\nInstallLocale.prototype.command = function (language, code) {\n\n\t\tthis.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.selectTreeNodeAction(\"Languages\", \"Add Language\")\n\t\t.clickDataBySibilings(\"Languages\")\n\t\t.clickLabel(language)\n\t\t.assertFieldValue(null, \"URL mapping name\", code)\n\t\t.clickDialogButton(\"OK\")\n\t\t.waitForDialogClosed(this.api.globals.timeouts.loading)\n\t\t.openTreeNode(\"Languages\")\n\t\t.assertTreeNodeHasChild(\"Languages\", language)\n\t\t.refresh()\n\n\treturn this.client.api;\n};\n\nmodule.exports = InstallLocale;\n"
  },
  {
    "path": "Website/test/e2e/commands/installPackage.js",
    "content": "var events = require('events');\n\nfunction InstallPackage() {\n  events.EventEmitter.call(this);\n}\n\nInstallPackage.prototype.command = function (category,packageName) {\n    this.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Available Packages\")\n\t\t.openTreeNode(category)\n\t\t.selectTreeNodeAction(packageName, \"Install\")\n\t\t.clickLabel(\"I accept the license agreement\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Finish\")\n\t\t.pause(5000)\n\t\t.refresh()\n\t\t\n\tthis.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Packages\",\"Installed Packages\")\n\t\t.openTreeNode(\"Installed Packages\",category)\n\t\t.assertTreeNodeHasChild(category,packageName)\n\t\t.refresh()\n\t\t\n\treturn this.client.api;\n};\n\nmodule.exports = InstallPackage;\n"
  },
  {
    "path": "Website/test/e2e/commands/installWebsite.js",
    "content": "var events = require('events');\n\nfunction InstallWebsite() {\n  events.EventEmitter.call(this);\n}\n\nInstallWebsite.prototype.command = function (setupOption, starterSite, expectedLanguage, newLanguage, newLanguageCode) {\n\t\n\tvar browser = this.client.api;\n\t\n\t// Launch an uninitialized website.\n\tbrowser\n      .url(browser.launchUrl + '/Composite/top.aspx')\n      .waitForElementVisible('.welcomepage', browser.globals.timeouts.basic);\n\t\n    browser\n    //\tThe Welcome page of the setup wizard appears.\n      .waitForElementVisible('#intro', browser.globals.timeouts.little)\n\t\t//    All the requirements are met (checked).\n      .waitForElementVisible('#introtestsuccess', browser.globals.timeouts.basic)\n\t\t//    The Next button is available and enabled\n      .waitForElementVisible('#introtestsuccessbutton', browser.globals.timeouts.little)\n\t\t// 2  Click Next.  The License page of the setup wizard appears.\n      .click('#introtestsuccessbutton')\n\t  \n\t\t//    The Accept check box is present and unchecked\n      .waitForElementVisible('#licenseaccept', browser.globals.timeouts.little);\n    browser.expect.element('#licenseaccept').to.not.have.attribute('checked');\n\t\t//    The Next button is available but disabled\n    browser.expect.element('#setupbutton').to.have.attribute('isdisabled');\n\t\t// 3  Check the Accept check box.  The check mark appears in the Accept check box.\n    browser.click('#licenseaccept');\n\t\t//    The Next button gets enabled.\n    browser.expect.element('#setupbutton').to.not.have.attribute('isdisabled');\n\t\t// 4  Click Next.  The Setup page of the setup wizard appears.\n\t\t\n    browser\n      .click('#setupbutton')\n\t\t//    The Starter Site radio button is present and selected\n      .waitForElementVisible('#setup', browser.globals.timeouts.little);\n    browser.expect.element('#setup h1').text.to.contain('Setup');\n\t\t//    The Venus (or other site's) radio button is present and selected.\n\t\t\n\t// {{ select s setup option, for example \"Starter site\"\n\t\n\tvar setupGroupIndex = this.api.globals.setupOptions[setupOption];\n\t\n\tbrowser.clickLabel(setupOption);\n\t\n    browser.expect\n      .element('#setupfields > div > radiodatagroup > radio:nth-of-type(' + setupGroupIndex + ') > radiobutton')\n      .to.have.attribute('ischecked', 'true');\n    browser.expect\n      .element('#setupfields > div > radiodatagroup > radio:nth-of-type(' + setupGroupIndex + ') > datalabeltext')\n      .text.to.equal(setupOption);\n\t  \n\t// }}\n\t  \n\t// {{ select a starter site, for example, \"Venus\" (only if not \"Bare bones\" : 3)\n \t\t\n\tif(setupOption != 'Bare bones')\n\t{\n\t\tvar siteIndex = this.api.globals.starterSites[starterSite];\n\t\t\n\t\tbrowser.clickLabel(starterSite);\n\t\t   \n\t\tbrowser.expect\n\t\t  .element('#setupfields > div > radiodatagroup > radio:nth-of-type(' + setupGroupIndex + ') + p + div > radiodatagroup > radio:nth-of-type(' + siteIndex + ') > radiobutton')\n\t\t  .to.have.attribute('ischecked', 'true');\n\t\t  \n\t\tbrowser.expect\n\t\t  .element('#setupfields > div > radiodatagroup > radio:nth-of-type(' + setupGroupIndex + ') + p + div > radiodatagroup > radio:nth-of-type(' + siteIndex + ') > datalabeltext')\n\t\t  .text.to.equal(starterSite);\n\t}\n\t\n\t// }}\n\t  \n\t\t//    The Next button is available and enabled\n    browser.expect.element('#navsetup clickbutton[label=\"Next\"]').to.not.have.attribute('isdisabled');\n\t\t// 5  Click Next.  The Language page of the setup wizard appears.\n    browser\n      .click('#navsetup clickbutton[label=\"Next\"]')\n\t  \n      .waitForElementVisible('#language', browser.globals.timeouts.little);\n\t\t//    A language is selected. (It must be based on the users locale.)\n    browser.expect.element('#websitelanguage').value.to.equal(expectedLanguage);\n\t\n\t// {{\n\t\t\n\t\t// change the language\n\t\tif(newLanguage)\n\t\t{\n\t\t\tbrowser.setValue('#websitelanguage', newLanguage);\n\t\t}\n\t\tif(newLanguageCode)\n\t\t{\n\t\t\tbrowser.expect.element('#websitelanguage').value.to.equal(newLanguageCode);\n\t\t}\n\t\t\n\t// }}\n\t\n\t\t//    The Next button is available and enabled\n    browser.expect.element('#navlanguage clickbutton[label=\"Next\"]').to.not.have.attribute('isdisabled');\n\t\t// 6  Click Next.  The Create Login page of the setup wizard appears.\n    browser\n      .click('#navlanguage clickbutton[label=\"Next\"]')\n      .waitForElementVisible('#login', browser.globals.timeouts.little);\n\t\t//    The Start CMS button is available but disabled.\n    browser.expect\n      .element('#navlogin clickbutton[label=\"Start CMS\"]')\n      .to.have.attribute('isdisabled');\n\t\t//    The Username field is filled with the value admin.\n    browser.expect.element('#username').value.to.equal('admin');\n\t\n\t\t//    The Regional settings field is set to the same language as in Step 5.\n\t\t// {{\n\t\tif(newLanguageCode)\n\t\t{\t\t\n\t\t\tbrowser.expect.element('#consolelanguage').value.to.equal(newLanguageCode);\n\t\t}\n\t\t// }}\n\t\t\n\t\t// 7  Fill the Email field. Value: john.doe@contoso.com\n\tbrowser.click('#email');\n    browser.setValue('#email', 'john.doe@contoso.com');\n\t\t//    The field is filled with the value.\n\tbrowser.expect.element('#email').value.to.equal('john.doe@contoso.com')\n\t\t//    The Start CMS button is still disabled.\n    browser.expect\n      .element('#navlogin clickbutton[label=\"Start CMS\"]')\n      .to.have.attribute('isdisabled');\n\t\t// 8  Fill the Password field. Value: 123456\n\tbrowser.click('#password');\n    browser.setValue('#password', '123456')\n\t\t//    The field is filled with the value.\n\tbrowser.expect.element('#password')\n\t\t.value.to.equal('123456');\n\t\t//    The value is masked.\n    browser.expect.element('#password')\n      .to.have.attribute('type', 'password')\n\t\t//    The Start CMS button is still disabled.\n    browser.expect\n      .element('#navlogin clickbutton[label=\"Start CMS\"]')\n      .to.have.attribute('isdisabled');\n\t\t// 9  Fill the Repeat Password field. Value: 123456\n\tbrowser.click('#passcheck');\n    browser.setValue('#passcheck', '123456')\n\t\t//    The field is filled with the value.\n\tbrowser.expect.element('#passcheck')\n\t\t.value.to.equal('123456');\n\t\t//    The value is masked.\n    browser.expect.element('#passcheck')\n      .to.have.attribute('type', 'password')\n\t\t//    The Start CMS button gets enabled.\n    browser.expect\n      .element('#navlogin clickbutton[label=\"Start CMS\"]')\n      .to.not.have.attribute('isdisabled');\n\t\t// 10 Click Start CMS.\n    browser.click('#navlogin clickbutton[label=\"Start CMS\"]');\n\t\t//    The screen with You starting site being downloaded\n\t\t//        and installed appears showing the installation progress and\n\t\t//        other screens succeed each other.\n    browser\n      .waitForElementVisible('#loading', browser.globals.timeouts.little)\n\t\t//    Eventually, the user logs in successfully and the CMS Console appears.\n      .waitForElementNotPresent('#loading', browser.globals.timeouts.save)\n      .waitForElementVisible('body', browser.globals.timeouts.loading)\n      .page.appWindow()\n        .waitForFrameLoad('@appFrame', browser.globals.timeouts.loading);\n};\n\nmodule.exports = InstallWebsite; "
  },
  {
    "path": "Website/test/e2e/commands/leaveFrame.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction LeaveFrame() {\n  events.EventEmitter.call(this);\n}\n\nutil.inherits(LeaveFrame, events.EventEmitter);\n\nLeaveFrame.prototype.command = function() {\n\treturn this.client.api.frameParent(() => this.emit('complete'));\n};\n\nmodule.exports = LeaveFrame;\n"
  },
  {
    "path": "Website/test/e2e/commands/logOut.js",
    "content": "var events = require('events');\n\nfunction LogOut() {\n  events.EventEmitter.call(this);\n}\n\nLogOut.prototype.command = function (userName) {\n\t\n    this.client.api\t\t\n\t\t.clickLabel(userName)\n\t\t.clickLabel(\"Sign out\")\n\t\t.waitForElementVisible('#id_username', this.client.api.globals.timeouts.basic);\n\t\t\n\treturn this.client.api;\n};\n\nmodule.exports = LogOut;\n"
  },
  {
    "path": "Website/test/e2e/commands/openTreeNode.js",
    "content": "var events = require('events');\n\nfunction OpenNode() {\n  events.EventEmitter.call(this);\n}\n\nOpenNode.prototype.command = function (parentLabel,childLabel) {\n\tvar systemView = this.client.api.page.systemView();\n\t\tsystemView\n\t\t\t.enterActivePerspective()\n\t\t\t._openTreeNode(parentLabel,childLabel);\n  return this.client.api;\n};\n\nmodule.exports = OpenNode;\n"
  },
  {
    "path": "Website/test/e2e/commands/replaceContent.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction ReplaceContent() {\n  events.EventEmitter.call(this);\n}\n\nutil.inherits(ReplaceContent, events.EventEmitter);\n\nReplaceContent.prototype.command = function(selector, newContent) {\n\tthis.client.api.execute(function (selector, newContent) {\n\t\tvar element = document.querySelector(selector);\n\t\telement.innerHTML = newContent;\n\t}, [selector, newContent], () => {\n\t\tthis.emit('complete');\n\t});\n\treturn this.client.api;\n};\n\nmodule.exports = ReplaceContent;\n"
  },
  {
    "path": "Website/test/e2e/commands/replaceTextInCodeMirror.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction ReplaceTextCodeMirror() {\n  events.EventEmitter.call(this);\n}\n\nReplaceTextCodeMirror.prototype.command = function (oldVlaue,newValue) {\n\tthis.client.api.selectFrameWithXpath('//*[@id=\"textarea\"]');\n\t\n\tthis.client.api.click('#textarea')\n\tthis.client.api.execute(function(oldVlaue,newValue) {\n\t\t\n\t\tvar editor = document.getElementsByClassName('CodeMirror')[0].CodeMirror;\n\t\tvar text = editor.getValue();\n\t\teditor.setValue(text.replace(oldVlaue,newValue));\n\t\t\n\t}, [oldVlaue,newValue]);\n\treturn this.client.api;\n    \n};\n\nmodule.exports = ReplaceTextCodeMirror;"
  },
  {
    "path": "Website/test/e2e/commands/rightClickSelector.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction RightClick() {\n  events.EventEmitter.call(this);\n}\n\nutil.inherits(RightClick, events.EventEmitter);\n\nRightClick.prototype.command = function (selector) {\n\tthis.client.api.element('css selector', selector, result => {\n\t\tif (!result.value.ELEMENT) {\n\t\t\tthis.client.assertion(false, null, null, 'Element <' + selector + '> was not found', this.abortOnFailure, this._stackTrace);\n\t\t\tthis.emit('complete');\n\t\t\treturn;\n\t\t}\n\t\tvar element = result.value.ELEMENT;\n\t\tthis.client.api.moveTo(element, null, null, () => {\n\t\t\tthis.client.api.mouseButtonClick('right',() => this.emit('complete'));\n\t\t});\n\t});\n  return this.client.api;\n};\n\nmodule.exports = RightClick;\n"
  },
  {
    "path": "Website/test/e2e/commands/selectActionFromToolbar.js",
    "content": "var events = require('events');\n\nfunction SelectActionFromToolbar() {\n  events.EventEmitter.call(this);\n}\n\nSelectActionFromToolbar.prototype.command = function (perspective,node,action) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n        .enter(perspective)\n\t\t._selectTreeNode(node)\n\t\t\t.leaveFrame()\n\t\tcontent\n\t\t\t.click('toolbarbutton[label=\"'+action+'\"]')\n\treturn this.client.api;\n};\n\nmodule.exports = SelectActionFromToolbar;\n"
  },
  {
    "path": "Website/test/e2e/commands/selectContentTab.js",
    "content": "var events = require('events');\n\nfunction SelectContentTab() {\n  events.EventEmitter.call(this);\n}\n\nSelectContentTab.prototype.command = function (tabName) {\n\tthis.client.api.selectFrameWithXpath('//*[local-name() = \"tabs\"]/*//*[local-name() = \"labeltext\"][normalize-space(text())=\"'+tabName+'\"]');\n\tthis.client.api\n        .useXpath()\n\t\t.click('//*[local-name() = \"tabs\"]/*//*[local-name() = \"labeltext\"][normalize-space(text())=\"'+tabName+'\"]').useCss()\n        \n    return this.client.api;\n};\n\nmodule.exports = SelectContentTab;"
  },
  {
    "path": "Website/test/e2e/commands/selectDocumentTab.js",
    "content": "var events = require('events');\n\nfunction SelectDocumentTab() {\n  events.EventEmitter.call(this);\n}\n\nSelectDocumentTab.prototype.command = function (tabName) {\n\tthis.client.api.selectFrameWithXpath('//*[local-name() = \"docktabs\"]/*//*[local-name() = \"labeltext\"][normalize-space(text())=\"'+tabName+'\"]');\n\tthis.client.api\n        .useXpath()\n\t\t.click('//*[local-name() = \"docktabs\"]/*//*[local-name() = \"labeltext\"][normalize-space(text())=\"'+tabName+'\"]').useCss();\n    \n    return this.client.api;\n};\n\nmodule.exports = SelectDocumentTab;"
  },
  {
    "path": "Website/test/e2e/commands/selectFrame.js",
    "content": "var util = require('util');\nvar events = require('events');\nvar Q = require('q');\n\nfunction SelectFrame() {\n\tevents.EventEmitter.call(this);\n}\n\nutil.inherits(SelectFrame, events.EventEmitter);\n\nfunction elementPresentPromise(client, selector) {\n\treturn new Promise(resolve => {\n\t\tclient.element('css selector', selector, result => {\n\t\t\tif (result.error) {\n\t\t\t\tresolve(false);\n\t\t\t} else {\n\t\t\t\tresolve(true);\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction elementListPromise(client, selector) {\n\treturn new Promise((resolve, reject) => {\n\t\tclient.elements('css selector', selector, result => {\n\t\t\tif (result.error) {\n\t\t\t\treject(result.error);\n\t\t\t} else {\n\t\t\t\tresolve(result.value);\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction framePromise(client, element) {\n\treturn new Promise((resolve, reject) => {\n\t\tclient.frame(element, result => {\n\t\t\tif (result.error) {\n\t\t\t\treject(result.error);\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction frameParentPromise(client) {\n\treturn new Promise((resolve, reject) => {\n\t\tclient.frameParent(result => {\n\t\t\tif (result.error) {\n\t\t\t\treject(result.error);\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction promiseSome(list, iterator) {\n\tvar p = Promise.resolve(false);\n\tlist.forEach((item, index) => {\n\t\tp = p.then(result => {\n\t\t\tif (result) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn iterator(item);\n\t\t\t}\n\t\t})\n\t});\n\treturn p;\n}\n\nfunction findSelectorInsideFrame(client, selector) {\n\treturn elementPresentPromise(client, selector).then(found => {\n\t\treturn !!found ||\n\t\t\telementListPromise(client, 'iframe')\n\t\t\t.then(frames => promiseSome(frames, frame =>\n\t\t\t\tframePromise(client, frame)\n\t\t\t\t.then(() => {\n\t\t\t\t\treturn findSelectorInsideFrame(client, selector);\n\t\t\t\t})\n\t\t\t\t.then(result => {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn frameParentPromise(client).then(Promise.resolve(false));\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\t// if (err) {\n\t\t\t\t\t// \tconsole.error('Enter frame failed:', err);\n\t\t\t\t\t// }\n\t\t\t\t\treturn false;\n\t\t\t\t})\n\t\t\t))\n\t});\n}\n\nfunction retry(operation, delay) {\n\treturn operation().then(function(reason) {\n\t\tif(reason){\n\t\t\treturn true;\n\t\t}\n\t\tif(delay>60000){\n\t\t\treturn false;\n\t\t}\n\t\tconsole.log('did not find selector retrying after '+delay+' ms');\n        return Q.delay(delay).then(retry.bind(null, operation, delay * 2 ));\n\t\t\n    });\n}\n\n\nSelectFrame.prototype.command = function(selector, noReset) {\n\tvar reset = noReset ? Promise.resolve() : framePromise(this.client.api, null);\n\treset\n\t.then(() => retry(()=>findSelectorInsideFrame(this.client.api, selector),500))\n\t.then(found => {\n\t\tif (!found) {\n\t\t\tthis.client.assertion(false, 'not found', 'found', 'Did not find selector <' + selector + '> in any frame.', this.abortOnFailure, this._stackTrace);\n\t\t// } else {\n\t\t// \tthis.client.assertion(true, null, null, 'Found element <' + selector + '> and entered frame containing it' +\n\t\t// \t\t(noReset\n\t\t// \t\t? ' without resetting to top frame'\n\t\t// \t\t: ''), this.abortOnFailure);\n\t\t}\n\t\tthis.emit('complete');\n\t})\n\t.catch(err => {\n\t\tthis.client.assertion(false, err, null, 'Attempt to find <' + selector + '> failed horribly');\n\t\tthis.emit('complete');\n\t});\n}\n\nmodule.exports = SelectFrame;\n"
  },
  {
    "path": "Website/test/e2e/commands/selectFrameWithXpath.js",
    "content": "var util = require('util');\nvar events = require('events');\nvar Q = require('q');\n\nfunction SelectFrameWithXpath() {\n\tevents.EventEmitter.call(this);\n}\n\nutil.inherits(SelectFrameWithXpath, events.EventEmitter);\n\nfunction elementPresentPromise(client, selector) {\n\treturn new Promise(resolve => {\n\t\tclient.element('xpath', selector, result => {\n\t\t\tif (result.error) {\n\t\t\t\tresolve(false);\n\t\t\t} else {\n\t\t\t\tresolve(true);\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction elementListPromise(client, selector) {\n\treturn new Promise((resolve, reject) => {\n\t\tclient.elements('css selector', selector, result => {\n\t\t\tif (result.error) {\n\t\t\t\treject(result.error);\n\t\t\t} else {\n\t\t\t\tresolve(result.value);\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction framePromise(client, element) {\n\treturn new Promise((resolve, reject) => {\n\t\tclient.frame(element, result => {\n\t\t\tif (result.error) {\n\t\t\t\treject(result.error);\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction frameParentPromise(client) {\n\treturn new Promise((resolve, reject) => {\n\t\tclient.frameParent(result => {\n\t\t\tif (result.error) {\n\t\t\t\treject(result.error);\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t});\n}\n\nfunction promiseSome(list, iterator) {\n\tvar p = Promise.resolve(false);\n\tlist.forEach((item, index) => {\n\t\tp = p.then(result => {\n\t\t\tif (result) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn iterator(item);\n\t\t\t}\n\t\t})\n\t});\n\treturn p;\n}\n\nfunction findSelectorInsideFrame(client, selector) {\n\treturn elementPresentPromise(client, selector).then(found => {\n\t\treturn !!found ||\n\t\t\telementListPromise(client, 'iframe')\n\t\t\t.then(frames => promiseSome(frames, frame =>\n\t\t\t\tframePromise(client, frame)\n\t\t\t\t.then(() => {\n\t\t\t\t\treturn findSelectorInsideFrame(client, selector);\n\t\t\t\t})\n\t\t\t\t.then(result => {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn frameParentPromise(client).then(Promise.resolve(false));\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\t// if (err) {\n\t\t\t\t\t// \tconsole.error('Enter frame failed:', err);\n\t\t\t\t\t// }\n\t\t\t\t\treturn false;\n\t\t\t\t})\n\t\t\t))\n\t});\n}\n\nfunction retry(operation, delay) {\n\treturn operation().then(function(reason) {\n\t\tif(reason){\n\t\t\treturn true;\n\t\t}\n\t\tif(delay>60000){\n\t\t\treturn false;\n\t\t}\n\t\tconsole.log('did not find selector retrying after '+delay+' ms');\n        return Q.delay(delay).then(retry.bind(null, operation, delay * 2 ));\n\t\t\n    });\n}\n\nSelectFrameWithXpath.prototype.command = function(selector, noReset) {\n\tvar reset = noReset ? Promise.resolve() : framePromise(this.client.api, null);\n\treset\n\t.then(() => retry(()=>findSelectorInsideFrame(this.client.api, selector),500))\n\t.then(found => {\n\t\tif (!found) {\n\t\t\tthis.client.assertion(false, 'not found', 'found', 'Did not find selector <' + selector + '> in any frame.', this.abortOnFailure, this._stackTrace);\n\t\t// } else {\n\t\t// \tthis.client.assertion(true, null, null, 'Found element <' + selector + '> and entered frame containing it' +\n\t\t// \t\t(noReset\n\t\t// \t\t? ' without resetting to top frame'\n\t\t// \t\t: ''), this.abortOnFailure);\n\t\t}\n\t\tthis.emit('complete');\n\t})\n\t.catch(err => {\n\t\tthis.client.assertion(false, err, null, 'Attempt to find <' + selector + '> failed horribly');\n\t\tthis.emit('complete');\n\t});\n}\n\nmodule.exports = SelectFrameWithXpath;\n"
  },
  {
    "path": "Website/test/e2e/commands/selectPerspective.js",
    "content": "var events = require('events');\n\nfunction SelectPerspective() {\n  events.EventEmitter.call(this);\n}\n\nSelectPerspective.prototype.command = function (perspective) {\n    var content = this.client.api.page.content();\n\tcontent.waitForBrowserFrame(perspective);\n\tvar systemView = this.client.api.page.systemView();\n\tsystemView\n        .enter(perspective)\n\t\t\n\treturn this.client.api;\n};\n\nmodule.exports = SelectPerspective;\n"
  },
  {
    "path": "Website/test/e2e/commands/selectTreeNodeAction.js",
    "content": "var events = require('events');\n\nfunction SlectTreeNodeAction() {\n  events.EventEmitter.call(this);\n}\n\nSlectTreeNodeAction.prototype.command = function (node,action,bundle) {\n    var content = this.client.api.page.content();\n\tvar systemView = this.client.api.page.systemView();\n\tvar browser = this.client.api;\n\tsystemView\n\t\t.enterActivePerspective()\n        ._rightClickonTreeNode(node);\n\n\tthis.client.api.selectFrame('menuitem[label=\"' + action + '\"]');\n\tif(bundle==null){\n\t\tcontent\n\t\t\t.click('menuitem[label=\"'+action+'\"]');\n\t}\n\telse{\n\t\tthis.client.api.moveToElement('menuitem[label=\"' + bundle + '\"]', 5, 5, function(){\n\t\t\tbrowser.pause(browser.globals.timeouts.little);\n\t\t\tcontent\n\t\t\t\t.click('menuitem[label=\"'+action+'\"]');\n\t\t});\n\t}\n\treturn this.client.api;\n};\n\nmodule.exports = SlectTreeNodeAction;\n"
  },
  {
    "path": "Website/test/e2e/commands/setFieldValue.js",
    "content": "var events = require('events');\n\nfunction SetValueByLabel() {\n  events.EventEmitter.call(this);\n}\n\nSetValueByLabel.prototype.command = function (fieldLabel,value,inputType) {\n\tif(inputType == null){\n\t\tinputType = \"input\";\n\t}\n    this.client.api.selectFrameWithXpath('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]');\n    \n    this.client.api\n\t\t.useXpath()\n\t\t.click('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]/parent::*//*[local-name() = \"'+inputType+'\"]')\n        .clearValue('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]/parent::*//*[local-name() = \"'+inputType+'\"]')\n\t\t.setValue('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]/parent::*//*[local-name() = \"'+inputType+'\"]', value)\n\t\t.assertFieldValue(null,fieldLabel,value,inputType)\n\treturn this.client.api;\n};\n\nmodule.exports = SetValueByLabel;"
  },
  {
    "path": "Website/test/e2e/commands/setFieldValueInFieldGroup.js",
    "content": "var events = require('events');\n\nfunction SetValueByLabelFieldGroup() {\n  events.EventEmitter.call(this);\n}\n\nSetValueByLabelFieldGroup.prototype.command = function (dialogLabel,fieldLabel,value,inputType) {\n\tif(inputType == null){\n\t\tinputType = \"input\";\n\t}\n    if (dialogLabel == null) {\n        this.client.api.selectFrameWithXpath('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]');\n    } else {\n        this.client.api.selectFrameWithXpath('//*[local-name() = \"fieldgroup\"][@label=\"' + dialogLabel + '\"]');\n    }\n    this.client.api\n        .useXpath()\n\t\t.click('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]/parent::*//*[local-name() = \"'+inputType+'\"]')\n        .clearValue('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]/parent::*//*[local-name() = \"'+inputType+'\"]')\n\t\t.setValue('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]/parent::*//*[local-name() = \"'+inputType+'\"]', value)\n\t\t.assertFieldValue(dialogLabel,fieldLabel,value,inputType)\n    return this.client.api;\n};\n\nmodule.exports = SetValueByLabelFieldGroup;"
  },
  {
    "path": "Website/test/e2e/commands/setFileFieldValue.js",
    "content": "var events = require('events');\n\nfunction SetValueByLabel() {\n  events.EventEmitter.call(this);\n}\n\nSetValueByLabel.prototype.command = function (fieldLabel,value) {\n    this.client.api.selectFrameWithXpath('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]');\n    \n    this.client.api\n\t\t.useXpath()\n\t\t.click('//*[local-name() = \"fielddesc\"][normalize-space(text())=\"'+fieldLabel+'\"]/parent::*//*[local-name() = \"input\"]')\n\t\t.useCss()\n\t\t.setValue('input[type=\"file\"]', value);\n\treturn this.client.api;\n};\n\nmodule.exports = SetValueByLabel;"
  },
  {
    "path": "Website/test/e2e/commands/submitFormData.js",
    "content": "var events = require('events');\n\nfunction SubmitForm() {\n  events.EventEmitter.call(this);\n}\n\nSubmitForm.prototype.command = function (submitValue) {\n\tthis.client.api.selectFrameWithXpath('//*[local-name()=\"input\"][@value=\"'+submitValue+'\"]');\n\tthis.client.api\n        .useXpath()\n\t\t.click('//*[local-name()=\"input\"][@value=\"'+submitValue+'\"]')\n\t\t\n    return this.client.api;\n};\n\nmodule.exports = SubmitForm;"
  },
  {
    "path": "Website/test/e2e/commands/switchContentTab.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction ContentTab() {\n  events.EventEmitter.call(this);\n}\n\nContentTab.prototype.command = function (tabName) {\n\tthis.client.api\n\t\t\t.selectFrame('labelbox[label=\"'+tabName+'\"]')\n\t\t\t.click('labelbox[label=\"'+tabName+'\"]');\n  return this.client.api;\n};\n\nmodule.exports = ContentTab;\n"
  },
  {
    "path": "Website/test/e2e/commands/topFrame.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction TopFrame() {\n  events.EventEmitter.call(this);\n}\n\nutil.inherits(TopFrame, events.EventEmitter);\n\nTopFrame.prototype.command = function(selector) {\n\treturn this.client.api.frame(null, () => this.emit('complete'));\n};\n\nmodule.exports = TopFrame;\n"
  },
  {
    "path": "Website/test/e2e/commands/uninstallLocalPackage.js",
    "content": "var events = require('events');\n\nfunction InstallPackage() {\n  events.EventEmitter.call(this);\n}\n\nInstallPackage.prototype.command = function (packageName) {\n    this.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Packages\",\"Installed Packages\")\n\t\t.openTreeNode(\"Installed Packages\",\"Local Packages\")\n\t\t.assertTreeNodeHasChild(\"Local Packages\",packageName)\n\t\t.selectTreeNodeAction(packageName,\"Package Info\")\n\t\t.clickLabel(\"Uninstall\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Finish\")\n\t\t.pause(5000)\n\t\t.refresh()\n\t\n\treturn this.client.api;\n};\n\nmodule.exports = InstallPackage;\n"
  },
  {
    "path": "Website/test/e2e/commands/uninstallLocale.js",
    "content": "var events = require('events');\n\nfunction InstallLocale() {\n  events.EventEmitter.call(this);\n}\n\nInstallLocale.prototype.command = function (language) {\n\t\tthis.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Languages\")\n\t\t.selectTreeNodeAction(language, \"Remove Language\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.waitForDialogClosed(this.api.globals.timeouts.loading)\n\t\t.openTreeNode(\"Languages\")\n\t\t.assertTreeNodeHasNoChild(\"Languages\", language)\n\n\treturn this.client.api;\n};\n\nmodule.exports = InstallLocale;\n"
  },
  {
    "path": "Website/test/e2e/commands/uninstallPackage.js",
    "content": "var events = require('events');\n\nfunction InstallPackage() {\n  events.EventEmitter.call(this);\n}\n\nInstallPackage.prototype.command = function (category,packageName) {\n    this.client.api\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Packages\",\"Installed Packages\")\n\t\t.openTreeNode(\"Installed Packages\",category)\n\t\t.assertTreeNodeHasChild(category,packageName)\n\t\t.selectTreeNodeAction(packageName,\"Package Info\")\n\t\t.clickLabel(\"Uninstall\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Finish\")\n\t\t.pause(5000)\n\t\t.refresh()\n\t\n\treturn this.client.api;\n};\n\nmodule.exports = InstallPackage;\n"
  },
  {
    "path": "Website/test/e2e/commands/waitForDialog.js",
    "content": "var events = require('events');\n\nfunction SelectDialog() {\n  events.EventEmitter.call(this);\n}\n\nSelectDialog.prototype.command = function (timeout) {\n\tthis.client.api.page.appWindow().enter();\n\tthis.client.api.waitForFrameLoad('iframe[src*=\"/Composite/content/dialogs/standard/standard.aspx\"]',timeout)\n\t//this.client.api.waitForFrameLoad('iframe[src*=\"/Composite/content/flow/FlowUi.aspx\"]',timeout);\n\t        \n    return this.client.api;\n};\n\nmodule.exports = SelectDialog;"
  },
  {
    "path": "Website/test/e2e/commands/waitForDialogClosed.js",
    "content": "var events = require('events');\n\nfunction WaitForDialogClosed() {\n\tevents.EventEmitter.call(this);\n}\n\nWaitForDialogClosed.prototype.command = function (timeout) {\n\ttimeout = timeout || this.api.globals.timeouts.basic;\n\tthis.client.api.waitForElementNotVisible(\"#mastercover\", timeout);\n\treturn this.client.api;\n};\n\nmodule.exports = WaitForDialogClosed;"
  },
  {
    "path": "Website/test/e2e/commands/waitForFrameLoad.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction WaitForFrameLoad() {\n  events.EventEmitter.call(this);\n\tthis.abortOnFailure = typeof this.client.api.globals.abortOnAssertionFailure == 'undefined' || this.client.api.globals.abortOnAssertionFailure;\n}\n\nutil.inherits(WaitForFrameLoad, events.EventEmitter);\n\nWaitForFrameLoad.prototype.command = function(selector, timeout) {\n\tif (!timeout) {\n\t\tthrow new Error('waitForFrameLoad() must have timeout.');\n\t}\n\n\tconst complete = () => this.emit('complete');\n\tvar isTimedOut = false;\n\tvar interval = Math.max(Math.floor(timeout / 10), 5);\n\tvar timeElapsed = interval;\n\tvar timedRecheck, timeoutTimer;\n\n\tconst client = this.client;\n\n\ttimeoutTimer = setTimeout(() => {\n\t\tclearTimeout(timedRecheck);\n\t\tclient.assertion(false, null, null, 'Frame <' + selector + '> did not load within ' + timeout + 'ms', this.abortOnFailure, this._stackTrace);\n\t\tcomplete();\n\t}, timeout);\n\n\tfunction checkFrameLoaded() {\n\t\tclient.api.execute(function (selector) {\n\t\t\tvar frame = document.querySelector(selector);\n\t\t\treturn frame.contentDocument.readyState === 'complete';\n\t\t}, [selector], (result) => {\n\t\t\tif (result.value === true) {\n\t\t\t\tclearTimeout(timeoutTimer);\n\t\t\t\tclient.assertion(true, null, null, 'Frame <' + selector + '> loaded within ' + timeElapsed + 'ms', this.abortOnFailure);\n\t\t\t\tcomplete();\n\t\t\t} else {\n\t\t\t\ttimedRecheck = setTimeout(checkFrameLoaded, interval);\n\t\t\t\ttimeElapsed += interval;\n\t\t\t}\n\t\t});\n\t};\n\tcheckFrameLoaded();\n\treturn client.api;\n};\n\nmodule.exports = WaitForFrameLoad;\n"
  },
  {
    "path": "Website/test/e2e/commands/waitForFrameLoadwithXpath.js",
    "content": "var util = require('util');\nvar events = require('events');\n\nfunction WaitForFrameLoad() {\n  events.EventEmitter.call(this);\n\tthis.abortOnFailure = typeof this.client.api.globals.abortOnAssertionFailure == 'undefined' || this.client.api.globals.abortOnAssertionFailure;\n}\n\nutil.inherits(WaitForFrameLoad, events.EventEmitter);\n\nWaitForFrameLoad.prototype.command = function(selector, timeout) {\n\tif (!timeout) {\n\t\tthrow new Error('waitForFrameLoad() must have timeout.');\n\t}\n\n\tconst complete = () => this.emit('complete');\n\tvar isTimedOut = false;\n\tvar interval = Math.max(Math.floor(timeout / 10), 5);\n\tvar timeElapsed = interval;\n\tvar timedRecheck, timeoutTimer;\n\n\tconst client = this.client;\n\n\ttimeoutTimer = setTimeout(() => {\n\t\tclearTimeout(timedRecheck);\n\t\tclient.assertion(false, null, null, 'Frame <' + selector + '> did not load within ' + timeout + 'ms', this.abortOnFailure, this._stackTrace);\n\t\tcomplete();\n\t}, timeout);\n\n\tfunction checkFrameLoaded() {\n\t\tclient.api.execute(function (selector) {\n\t\t\tfunction search(selector, frames) {\n\t\t\t\tvar i, childFrame, selection;\n\t\t\t\tfor (i = 0; i < frames.length; i++) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tchildFrame = frames[i];\n\t\t\t\t\t\talert(childFrame.name || 'unnamed' + ' ' + i);\n\t\t\t\t\t\tselection = childFrame.document.evaluate('count('+selector+')',document,null,XPathResult.ANY_TYPE,null);\n\t\t\t\t\t\tif(selection.numberValue > 0){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(childFrame.length>0){\n\t\t\t\t\t\t\tsearch(selector,childFrame);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t//alert(e.message);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn search(selector, window);\n\t\t}, [selector], (result) => {\n\t\t\tif (result.value === true) {\n\t\t\t\tclearTimeout(timeoutTimer);\n\t\t\t\tclient.assertion(true, null, null, 'Frame <' + selector + '> loaded within ' + timeElapsed + 'ms', this.abortOnFailure);\n\t\t\t\tcomplete();\n\t\t\t} else {\n\t\t\t\ttimedRecheck = setTimeout(checkFrameLoaded, interval);\n\t\t\t\ttimeElapsed += interval;\n\t\t\t}\n\t\t});\n\t};\n\tcheckFrameLoaded();\n\treturn client.api;\n};\n\nmodule.exports = WaitForFrameLoad;\n"
  },
  {
    "path": "Website/test/e2e/globals.js",
    "content": "var timeouts = {\n\t\tbasic: 10000,\n\t\tsave: 120000,\n\t\tlittle: 1000,\n\t\tsmallest: 250,\n\t\tloading: 25000,\n\t};\n\nvar setupOptions = {\n\t\"Starter sites\" : 1,\n\t\"Templates only\" : 2,\n\t\"Bare bones\" : 3,\n}\n\nvar starterSites = {\n\t\tVenus: 1,\n\t\tNeptune: 2,\n\t\tMercury: 3,\n\t\t\"Open Cph - Razor\": 4,\n\t\t\"Open Cph - Master Pages\" : 5,\n\t};\n\t\nvar templatesOnly = {\n\t\t\"Tiny Cph - Razor\": 1,\n\t\t\"Tiny Cph - Master Pages\" : 2,\n}\n\t\nmodule.exports = {\n\tsiteLocation : \"\",\n\tasyncHookTimeout : 20000,\n\ttimeouts : timeouts,\n\tsetupOptions : setupOptions,\n\tstarterSites : starterSites,\n\tbeforeEach: function (browser, done) {\n\t\tbrowser.resizeWindow(1400, 1000, done);\n\t},\n\tafterEach: function (browser, done) {\n\t\tbrowser.end(done);\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/pageObjects/appWindow.js",
    "content": "module.exports = {\n\telements: [\n\t\t{ appWindow: '#appwindow' },\n\t\t{ appFrame: '#appwindow iframe' },\n\t\t{ menu: '#menubar' },\n\t\t{ explorer: '#explorer' },\n\t\t{ stage: '#stage' }\n\t],\n\tcommands: [\n\t\t{\n\t\t\tprepare: function () {\n\t\t\t\tthis.api.page.login().fullLogin();\n\t\t\t\tthis.api.page.startScreen().close();\n\t\t\t\tthis\n\t\t\t\t\t.topFrame()\n\t\t\t\t\t.waitForElementPresent('@appWindow', this.api.globals.timeouts.basic)\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tenter: function () {\n\t\t\t\tthis\n\t\t\t\t\t.topFrame()\n\t\t\t\t\t.waitForElementPresent('@appFrame', this.api.globals.timeouts.basic)\n\t\t\t\t\t.enterFrame('@appFrame');\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t]\n};\n"
  },
  {
    "path": "Website/test/e2e/pageObjects/content.js",
    "content": "module.exports = {\n\tsections: {\n\t\tdocktabs: {\n\t\t\tselector: 'dock[reference=\"main\"] docktabs',\n\t\t\tcommands: [{\n\t\t\t\tclickTab: function (index) {\n\t\t\t\t\tthis.click('docktab:nth-of-type(' + index + ')');\n\t\t\t\t},\n\t\t\t\tcloseTab: function (index) {\n\t\t\t\t\tthis.click('docktab:nth-of-type(' + index + ') control[controltype=\"close\"]');\n\t\t\t\t}\n\t\t\t}]\n\t\t}\n\t},\n\telements: [\n\t\t{ browserFrame: 'iframe[src=\"/Composite/content/views/browser/browser.aspx\"]' }\n\t],\n\tcommands: [\n\t\t{\n\t\t\tenter: function (perspective) {\n        perspective = perspective || \"Content\"; // for backward compatibility\n\n\t\t\t\tvar perspectiveButton = '#explorer explorertoolbarbutton[label=\"'+perspective+'\"]';\n\t\t\t\tvar perspectiveFrame = '#stagedecks stagedeck[data-qa*=\"'+perspective+'\"] iframe';\n\n\t\t\t\tthis.api.page.appWindow()\n\t\t\t\t\t.enter()\n\t\t\t\t\t.waitForElementNotPresent('dialogcover[hidden=\"true\"]', this.api.globals.timeouts.basic);\n\n\t\t\t\tthis.api.pause(1000);\n\n\t\t\t\tthis.api.page.appWindow()\n\t\t\t\t\t.waitForElementPresent(perspectiveButton, this.api.globals.timeouts.basic)\n\t\t\t\t\t.click(perspectiveButton)\n\t\t\t\t\t.waitForFrameLoad(perspectiveFrame, this.api.globals.timeouts.basic)\n\t\t\t\t\t.enterFrame(perspectiveFrame);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tenterActivePerspective: function () {\n\t\t\t\tthis.api.page.appWindow()\n\t\t\t\t\t.enter()\n\t\t\t\t\t.enterFrame('#stagedecks stagedeck[selected=\"true\"] iframe');\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tprepare: function (perspective) {\n\t\t\t\tthis.api.page.appWindow().prepare();\n\t\t\t\tthis\n\t\t\t\t\t.enter(perspective)\n\t\t\t\t\t.waitForElementVisible('@browserFrame', this.api.globals.timeouts.basic)\n\t\t\t\t\t.waitForFrameLoad('@browserFrame', this.api.globals.timeouts.basic);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\twaitForBrowserFrame: function (perspective) {\n\t\t\t\tperspective = perspective || \"Content\"; // for backward compatibility\n\t\t\t\tthis\n\t\t\t\t\t.enter(perspective)\n\t\t\t\t\t.waitForElementVisible('@browserFrame', this.api.globals.timeouts.basic)\n\t\t\t\t\t.waitForFrameLoad('@browserFrame', this.api.globals.timeouts.basic);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tenterTabFrame: function (index) {\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.waitForElementPresent('view:nth-of-type(' + index + ') window', this.api.globals.timeouts.basic)\n\t\t\t\t\t.waitForFrameLoad('view:nth-of-type(' + index + ') window iframe', this.api.globals.timeouts.basic)\n\t\t\t\t\t.enterFrame('view:nth-of-type(' + index + ') window iframe')\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t_assertBrowserContains: function (selector, value) {\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.enterFrame('@browserFrame')\n\t\t\t\t\t.waitForElementVisible('#browsertabbox iframe', this.api.globals.timeouts.basic)\n\t\t\t\t\t.waitForFrameLoad('#browsertabbox iframe', this.api.globals.timeouts.basic)\n\t\t\t\t\t.enterFrame('#browsertabbox iframe')\n\t\t\t\t\t.assert.containsText(selector, value);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t_assertBrowserContainsWithXpath: function (selector) {\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.enterFrame('@browserFrame')\n\t\t\t\t\t.waitForElementVisible('#browsertabbox iframe', this.api.globals.timeouts.basic)\n\t\t\t\t\t.waitForFrameLoad('#browsertabbox iframe', this.api.globals.timeouts.basic)\n\t\t\t\t\t.enterFrame('#browsertabbox iframe')\n\t\t\t\t\t.useXpath()\n\t\t\t\t\t.assert.elementPresent(selector);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t_assertBrowserContainsAttribute: function (selector,attribiute, value) {\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.enterFrame('@browserFrame')\n\t\t\t\t\t.waitForElementVisible('#browsertabbox iframe', this.api.globals.timeouts.basic)\n\t\t\t\t\t.waitForFrameLoad('#browsertabbox iframe', this.api.globals.timeouts.basic)\n\t\t\t\t\t.enterFrame('#browsertabbox iframe')\n\t\t\t\t\t.assert.attributeContains(selector,attribiute, value)\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tassertBrowserUrl: function (url) {\n\t\t\t\tvar urlRegex = new RegExp(url.replace(/[-\\\\^$*+?.()|[\\]{}]/g, '\\\\$&') + '$');\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.enterFrame('@browserFrame')\n\t\t\t\t\t.expect.element('#addressbar input').value\n\t\t\t\t\t.to.match(urlRegex);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t]\n};\n"
  },
  {
    "path": "Website/test/e2e/pageObjects/editor.js",
    "content": "/**\n* This page object requires an initial presence in a frame that contains a\n* visual editor. Calling the enter command outside this context will fail, as\n* there is no editor to enter.\n*/\n\nmodule.exports = {\n\telements: [\n\t\t{ wysiwygFrame: 'iframe[src^=\"/Composite/content/dialogs/wysiwygeditor/wysiwygeditordialog.aspx\"]' },\n\t\t{ editorFrame: 'iframe[src^=\"/Composite/content/misc/editors/visualeditor/visualeditor.aspx\"]' }\n\t],\n\tcommands: [\n\t\t{\n\t\t\tenter: function () {\n\t\t\t\tthis.client.api\n\t\t\t\t\t.pause(400)\n\t\t\t\t\t.useXpath()\n\t\t\t\t\t.selectFrameWithXpath('//*[@data-id=\"editor\"]').useCss()\n\t\t\t\t\t\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tchangeElementContent: function (selector, newContent) {\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.assert.attributeEquals('body', 'contenteditable', 'true')\n\t\t\t\t\t.section.editorBody\n\t\t\t\t\t.waitForElementVisible(selector,this.api.globals.timeouts.basic)\n\t\t\t\t\t.assert.visible(selector)\n\t\t\t\t\t.replaceContent(selector, newContent)\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tselcetActionOnContent: function (number, action) {\n\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.assert.attributeEquals('body', 'contenteditable', 'true')\n\t\t\t\t\t.client.api.useXpath()\n\t\t\t\t\t.waitForElementVisible('//*[@id=\"tinymce\"]/*['+number+']',this.api.globals.timeouts.basic)\n\t\t\t\t\t.moveToElement('//*[@id=\"tinymce\"]/*['+number+']',null,null)\n\t\t\t\t\t.mouseButtonClick('right')\n\t\t\t\t\t.selectFrameWithXpath('//*[local-name() = \"menuitem\"]//*[local-name() = \"labelbox\"]')\n\t\t\t\t\t.waitForElementVisible('//*[local-name() = \"menuitem\"]//*[local-name() = \"labelbox\"][@label=\"'+action+'\"]',this.api.globals.timeouts.basic)\n\t\t\t\t\t.click('//*[local-name() = \"menuitem\"]//*[local-name() = \"labelbox\"][@label=\"'+action+'\"]').useCss()\n\t\t\t\t\treturn this;\n\t\t\t},\n\t\t\tselectEditOnContent: function (number) {\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.assert.attributeEquals('body', 'contenteditable', 'true')\n\t\t\t\t\t.client.api.useXpath()\n\t\t\t\t\t.waitForElementVisible('//*[@id=\"tinymce\"]/*['+number+']',this.api.globals.timeouts.basic)\n\t\t\t\t\t.moveToElement('//*[@id=\"tinymce\"]/*['+number+']',null,null)\n\t\t\t\t\t.click('//*[@id=\"tinymce\"]/*['+number+']')\n\t\t\t\t\t.selectFrame('toolbar[binding=\"VisualEditorToolBarBinding\"]')\n\t\t\t\t\t.waitForElementPresent('//*[local-name()=\"labeltext\"][text()=\"Function Properties…\"]',this.api.globals.timeouts.basic)\n\t\t\t\t\t.clickText(\"Function Properties…\")\n\t\t\t\tthis.client.api.page.appWindow().enter()\n\t\t\t\t\t.waitForElementPresent('iframe[src=\"/Composite/content/dialogs/postback/postbackdialog.aspx\"]',this.api.globals.timeouts.basic)\n\t\t\t\t\treturn this;\n\t\t\t},\n\t\t\tselectContent: function (number) {\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.assert.attributeEquals('body', 'contenteditable', 'true')\n\t\t\t\t\t.client.api.useXpath()\n\t\t\t\t\t.waitForElementVisible('//*[@id=\"tinymce\"]/*['+number+']',this.api.globals.timeouts.basic)\n\t\t\t\t\t.moveToElement('//*[@id=\"tinymce\"]/*['+number+']',null,null)\n\t\t\t\t\t.click('//*[@id=\"tinymce\"]/*['+number+']')\n\t\t\t\t\t.selectFrame('toolbar[binding=\"VisualEditorToolBarBinding\"]')\n\t\t\t\t\t.waitForElementPresent('//*[local-name()=\"labeltext\"][text()=\"Function Properties…\"]',this.api.globals.timeouts.basic)\n\t\t\t\t\treturn this;\n\t\t\t},\n\t\t\tacceptChanges: function (){\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.client.api.useXpath()\n\t\t\t\t\t.selectFrameWithXpath('//*[@response=\"accept\"]')\n\t\t\t\t\t.click('//*[@response=\"accept\"]').useCss();\n\t\t\t\t\treturn this;\n\t\t\t},\n\t\t\tacceptFunctionEdit: function (){\n\t\t\t\tthis\n\t\t\t\t\t.enter()\n\t\t\t\t\t.client.api.useXpath()\n\t\t\t\t\t.selectFrameWithXpath('//*[@callbackid=\"buttonAccept\"]')\n\t\t\t\t\t.click('//*[@callbackid=\"buttonAccept\"]').useCss();\n\t\t\t\t\treturn this;\n\t\t\t},\n\t\t\tpause: function (number){\n\t\t\t\tthis\n\t\t\t\t\t.client.api.pause(number)\n\t\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t],\n\tsections: {\n\t\teditorBody:  {\n\t\t\tselector: '#tinymce'\n\t\t}\n\t}\n};\n"
  },
  {
    "path": "Website/test/e2e/pageObjects/login.js",
    "content": "module.exports = {\n\turl: '',\n\telements: [\n\t\t{ usernameField: '#id_username' },\n\t\t{ usernameInput: '#id_username > box > input' },\n\t\t{ passwordField: '#id_password' },\n\t\t{ passwordInput: '#id_password > box > input' },\n\t\t{ submitButton: '#loginButton' }\n\t],\n\tcommands: [\n\t\t{\n\t\t\tisShown: function () {\n\t\t\t\tthis.waitForElementVisible('@usernameField', this.api.globals.timeouts.basic);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tsetUsername: function (username) {\n\t\t\t\tthis\n\t\t\t\t\t.clearValue('@usernameInput') // There may be a default value, clear it\n\t\t\t\t\t.click('@usernameInput')\n\t\t\t\t\t.setValue('@usernameInput', username)\n\t\t\t\t\t.assert.value('@usernameInput',username);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tsetPassword: function (password) {\n\t\t\t\tthis\n\t\t\t\t\t.clearValue('@passwordInput') // There may be a default value, clear it\n\t\t\t\t\t.click('@passwordInput')\n\t\t\t\t\t.setValue('@passwordInput', password)\n\t\t\t\t\t.assert.value('@passwordInput', password);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tfullLogin: function (username, password) {\n\t\t\t\treturn this\n\t\t\t\t\t.isShown()\n\t\t\t\t\t.setUsername(username || 'admin')\n\t\t\t\t\t.setPassword(password || '123456')\n\t\t\t\t\t.click('@submitButton')\n\t\t\t\t\t.waitForElementNotPresent('@usernameField', this.api.globals.timeouts.basic);\n\t\t\t}\n\t\t}\n\t]\n};\n"
  },
  {
    "path": "Website/test/e2e/pageObjects/startScreen.js",
    "content": "module.exports = {\n\telements: [\n\t\t{ startFrame: 'window[url=\"/Composite/content/views/start/start.aspx\"] iframe' },\n\t\t{ closeButton: '#closecontrol' }\n\t],\n\tcommands: [\n\t\t{\n\t\t\tprepare: function () {\n\t\t\t\tthis.api.page.login().fullLogin();\n\t\t\t\tthis.api.page.appWindow().enter(); // Start page shows inside appwindow.\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tenter: function () {\n\t\t\t\tthis.api.page.appWindow().enter(); // Start page shows inside appwindow.\n\t\t\t\tthis.waitForElementPresent('@startFrame', this.api.globals.timeouts.basic);\n\t\t\t\tthis.enterFrame('@startFrame'); // Enter the frame containing it\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tclose: function () {\n\t\t\t\tthis.enter();\n\t\t\t\tthis.waitForElementVisible('@closeButton', this.api.globals.timeouts.basic);\n\t\t\t\tthis.api.pause(1000);\n\t\t\t\tthis.click('@closeButton');\n\t\t\t}\n\t\t}\n\t]\n};\n"
  },
  {
    "path": "Website/test/e2e/pageObjects/systemView.js",
    "content": "module.exports = {\n\telements: [\n\t\t{ systemFrame: 'iframe[src=\"/Composite/content/views/systemview/systemview.aspx\"]'}\n\t],\n\tcommands: [{\n\t\tenter: function (perspective) {\n\t\t\tthis.api.page.content()\n\t\t\t\t.enter(perspective)\n\t\t\t\t.enterFrame('@browserFrame');\n\t\t\tthis\n\t\t\t\t.waitForFrameLoad('@systemFrame', this.api.globals.timeouts.basic)\n\t\t\t\t.enterFrame('@systemFrame');\n\t\t\treturn this;\n\t\t},\n\t\tenterActivePerspective: function () {\n\t\t\tthis.api.page.content()\n\t\t\t\t.enterActivePerspective()\n\t\t\t\t.enterFrame('@browserFrame');\n\t\t\tthis\n\t\t\t\t.waitForFrameLoad('@systemFrame', this.api.globals.timeouts.basic)\n\t\t\t\t.enterFrame('@systemFrame');\n\t\t\treturn this;\n\t\t},\n\t\t_openTreeNode: function (parentLabel,childLabel) {\n\t\t\tvar selector = 'treenode[label=\"' + parentLabel + '\"] > ';\n\t\t\tif (childLabel) {\n\t\t\t\tselector += 'treenode[label=\"' + childLabel + '\"] > ';\n\t\t\t}\n\t\t\tselector += 'labelbox';\n\t\t\tthis.api.waitForElementPresent(selector,this.api.globals.timeouts.basic)\n\t\t\tthis.doubleClickSelector(selector);\n\t\t\tthis.api.pause(300);\n\t\t\treturn this;\n\t\t},\n\t\t_selectTreeNode: function (parentLabel,childLabel) {\n\t\t\tvar selector = 'treenode[label=\"' + parentLabel + '\"] > ';\n\t\t\tif (childLabel) {\n\t\t\t\tselector += 'treenode[label=\"' + childLabel + '\"] > ';\n\t\t\t}\n\t\t\tselector +='labelbox';\n\t\t\tthis.api.waitForElementPresent(selector,this.api.globals.timeouts.basic)\n\t\t\tthis.click(selector);\n\t\t\treturn this;\n\t\t},\n\t\t_rightClickonTreeNode: function (parentLabel,childLabel) {\n\t\t\tvar selector = 'treenode[label=\"' + parentLabel + '\"] > ';\n\t\t\tif (childLabel) {\n\t\t\t\tselector += 'treenode[label=\"' + childLabel + '\"] > ';\n\t\t\t}\n\t\t\tselector +='labelbox';\n\t\t\tthis.api.waitForElementPresent(selector,this.api.globals.timeouts.basic)\n\t\t\tthis.rightClickSelector(selector);\n\t\t\treturn this;\n\t\t},\n\t\t_assertTreeNodeHasChild: function (parentLabel, childLabel) {\n\t\t\tvar selector = 'treenode[label=\"' + parentLabel + '\"] > treenode';\n\t\t\tif (childLabel) {\n\t\t\t\tselector += '[label=\"' + childLabel + '\"]';\n\t\t\t}\n\t\t\tthis.expect\n\t\t\t\t.element(selector)\n\t\t\t\t.to.be.present;\n\t\t},\n\t\t_assertTreeNodeHasNoChild: function (parentLabel, childLabel) {\n\t\t\tvar selector = 'treenode[label=\"' + parentLabel + '\"] > treenode';\n\t\t\tif (childLabel) {\n\t\t\t\tselector += '[label=\"' + childLabel + '\"]';\n\t\t\t}\n\t\t\tthis.expect\n\t\t\t\t.element(selector)\n\t\t\t\t.not.to.be.present;\n\t\t},\n\t\t_assertTreeNodeIsEmpty: function (parentLabel,childLabel) {\n\t\t\tvar selector = 'treenode[label=\"' + parentLabel + '\"] > treenode';\n\t\t\tif (childLabel) {\n\t\t\t\tselector += '[label=\"' + childLabel + '\"] > treenode';\n\t\t\t}\n\t\t\tthis.expect\n\t\t\t\t.element(selector)\n\t\t\t\t.not.to.be.present;\n\t\t\t\n\t\t\t\n\t\t},\n\t\t_assertTreeNodeIsNotEmpty: function (parentLabel,childLabel) {\n\t\t\tvar selector = 'treenode[label=\"' + parentLabel + '\"] > treenode';\n\t\t\tif (childLabel) {\n\t\t\t\tselector += '[label=\"' + childLabel + '\"] > treenode';\n\t\t\t}\n\t\t\tthis.expect\n\t\t\t\t.element(selector)\n\t\t\t\t.to.be.present;\n\t\t\t\n\t\t\t\n\t\t}\n\t}]\n};\n"
  },
  {
    "path": "Website/test/e2e/reset.js",
    "content": "﻿const removePaths = [\n    'App_Code/*',\n    'App_Data/Components/',\n    'App_Data/Composite/ApplicationState/',\n    'App_Data/Composite/Azure/',\n    'App_Data/Composite/Cache/',\n    'App_Data/Composite/Cache/Assemblies/*',\n    'App_Data/Composite/Composite.config',\n    'App_Data/Composite/Configuration/Composite.Forms.FormBuilder.xml',\n    'App_Data/Composite/Configuration/Composite.Media.ImageCrop.xml',\n    'App_Data/Composite/Configuration/DynamicSqlDataProvider.config',\n    'App_Data/Composite/Configuration/DynamicXmlDataProvider.config',\n    'App_Data/Composite/Configuration/FirstTimeStart.xml',\n    'App_Data/Composite/Configuration/InstallationInformation.xml',\n    'App_Data/Composite/Configuration/SystemInitialized.xml',\n    'App_Data/Composite/Configuration\\Composite.Forms.FormBuilder.xml',\n    'App_Data/Composite/Configuration\\Composite.Media.ImageCrop.xml',\n    'App_Data/Composite/DataMetaData/',\n    'App_Data/Composite/DataStores/',\n    'App_Data/Composite/DynamicTypeForms/*',\n    'App_Data/Composite/DynamicTypeForms/Composite/Community/Blog/Authors.xml',\n    'App_Data/Composite/DynamicTypeForms/Composite/Community/Blog/Entries.xml',\n    'App_Data/Composite/InlineCSharpFunctions/',\n    'App_Data/Composite/LanguagePacks/',\n    'App_Data/Composite/LogFiles/*',\n    'App_Data/Composite/PackageLicenses/',\n    'App_Data/Composite/Packages/*',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.Blog.Entries.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.Blog.Settings.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.Blog.Settings.xmll',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.Blog.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.ContactForm.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.ContactFrom.EmailTemplate.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.ContactFrom.EmailTemplate.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.EventCalendar.EventsApp.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.Community.Newsletter.SubjectBased.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.TemplateSites.Base01.News.NewsItem.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.TemplateSites.Base01.TeaserSpot.xml',\n    'App_Data/Composite/TreeDefinitions/Composite.Versioning.ContentVersioning.xml',\n    'App_Data/Composite/TreeDefinitions/Orckestra.Lists.Portfolio.Application.xml',\n    'App_Data/Composite/TreeDefinitions/Orckestra.Lists.Tabs.xml',\n    'App_Data/Media/*',\n    'App_Data/NewsletterType/',\n    'App_Data/PackageCreator',\n    'App_Data/PageTemplateFeatures/',\n    'App_Data/PageTemplates/*.cshtml',\n    'App_Data/PageTemplates/*.master*',\n    'App_Data/Razor/ -- !(web.config) ',\n    'App_Data/Razor/Composite/',\n    'App_Data/Razor/Composite/Community/Blog/',\n    'App_Data/Razor/Content/',\n    'App_Data/Razor/Layout/',\n    'App_Data/Razor/Orckestra/',\n    'App_Data/Razor/PageBlocks/',\n    'App_Data/Razor/Widgets/',\n    'App_Data/Search/',\n    'App_Data/UserControls/ -- !(web.config)',\n    'App_Data/Xslt/*',\n    'App_GlobalResources/',\n    'App_GlobalResources/Composite.Community.Blog/',\n    'App_GlobalResources/Composite/Community/Blog.resx',\n    'App_GlobalResources/Composite/Community/Blog.ru-ru.resx',\n    'App_GlobalResources/Composite/Community/ContactForm.resx',\n    'App_GlobalResources/Composite/Community/ContactForm.ru-RU.resx',\n    'App_GlobalResources/Composite/Community/Newsletter.resx',\n    'bin/Antlr3.Runtime.dll',\n    'bin/BoboBrowse.Net.dll',\n    'bin/C5.dll',\n    'bin/Common.Logging*.dll',\n    'bin/Composite.Community.*.*',\n    'bin/Composite.Community.Blog.dll',\n    'bin/Composite.Community.EventCalendar.dll',\n    'bin/Composite.Community.Extranet.dll',\n    'bin/Composite.Community.Newsletter.DataTypeBased.dll',\n    'bin/Composite.Community.Newsletter.dll',\n    'bin/Composite.Community.Newsletter.FunctionBased.dll',\n    'bin/Composite.Community.Newsletter.SubjectBased.dll',\n    'bin/Composite.Forms.FormBuilder.dll',\n    'bin/Composite.Forms.Renderer.dll',\n    'bin/Composite.Generated.dll',\n    'bin/Composite.Media.*.*',\n    'bin/Composite.Search.SimplePageSearch.dll',\n    'bin/Composite.Tools.*.*',\n    'bin/Composite.Tools.PackageCreator.dll',\n    'bin/Composite.Versioning.ContentVersioning.dll',\n    'bin/Composite.Web.*.*',\n    'bin/Composite.XmlSerializers.dll',\n    'bin/CompositeC1Contrib.RazorFunctions.dll',\n    'bin/CookComputing.XmlRpcV2.dll',\n    'bin/CookComputing.XmlRpcV2.dll',\n    'bin/ICSharpCode.SharpZipLib.dll',\n    'bin/Lucene.Net.dll',\n    'bin/Lucene.Net.*.dll',\n//    'bin/Microsoft.Web.*.dll',\n    'bin/Microsoft.WindowsAzure.*.dll',\n    'bin/Orckestra.Search*.dll',\n    'bin/Orckestra.Web.BundlingAndMinification.dll',\n    'bin/Orckestra.Web.Css.Less.dll',\n    'bin/System.Web.Optimization.dll',\n    'bin/WebGrease.dll',\n    'BlogCommentsRssFeed.ashx',\n    'BlogMetaWeblog.ashx',\n    'BlogRssFeed.ashx',\n    'Composite/content/forms/InstalledPackages/Composite.Tools.PackageCreator/',\n    'Composite/InstalledPackages/',\n    'Composite/InstalledPackages/content/forms/Composite.Community.Blog/',\n    'Composite/InstalledPackages/controls/FormsControls/Composite.Community.Blog/',\n    'Composite/InstalledPackages/localization/Composite.TemplateSites.Base01.News.NewsItem.da-dk.xml',\n    'Composite/InstalledPackages/localization/Composite.TemplateSites.Base01.News.NewsItem.en-us.xml',\n    'Composite/InstalledPackages/localization/Composite.TemplateSites.Base01.TeaserSpot.da-dk.xml',\n    'Composite/InstalledPackages/localization/Composite.TemplateSites.Base01.TeaserSpot.en-us.xml',\n    'Composite/InstalledPackages/localization/Composite.Tools.PackageCreator.en-us.xml',\n    'Frontend/Composite/',\n    'Frontend/Composite/C1BaseSite/',\n    'Frontend/Composite/Community/Blog/',\n    'Frontend/Composite/Search/SimplePageSearch/Styles.css',\n    'Frontend/fonts/',\n    'Frontend/Images/',\n    'Frontend/Images/*',\n    'Frontend/Orckestra/',\n    'Frontend/Scripts/',\n    'Frontend/Scripts/*',\n    'Frontend/Styles/ -- !(VisualEditor.common.css)',\n    'Frontend/Styles/bootstrap',\n    'Frontend/Styles/font-awesome',\n    'Frontend/Styles/includes',\n    'Frontend/Styles/PageBlocks',\n    'Frontend/Styles/Print.css',\n    'Frontend/Styles/Screen.css',\n    'Frontend/Styles/style.less',\n    'Frontend/Styles/style.min.css',\n    'Frontend/Styles/VisualEditor.common.less',\n    'Frontend/Styles/VisualEditor.less',\n    'Frontend/Styles/VisualEditor/VisualEditor.Config.css',\n    'Frontend/Styles/VisualEditor/VisualEditor.Config.xml',\n    'Frontend/Styles/VisualEditor/VisualEditor.Default.css',\n    'Newsletter.ashx',\n    'Web.config',\n    'ZipTest/'\n]\nconst rimraf = require('rimraf');\nconst fs = require('fs');\nconst globals = require(process.cwd()+'/Website/test/e2e/globals');\n\nvar basepath = globals.siteLocation || process.cwd()+'/Website';\nvar sourcepath = process.cwd()+'/Website';\n\nfunction copyFile(source, target) {\n\tvar id = Math.ceil(10000 * Math.random());\n\tvar tmpFileLoc = basepath + '/tmp' + id;\n\treturn new Promise(function(resolve, reject) {\n\t\tvar reader = fs.createReadStream(source);\n\t\treader.on('error', reject);\n\t\t\n\t\tvar writer = fs.createWriteStream(tmpFileLoc);\n\t\twriter.on('error', reject);\n\t\twriter.on('finish', function () { resolve(id); });\n\t\treader.pipe(writer);\n\t}).then(function (id) {\n\t\tfs.renameSync(tmpFileLoc, target);\n\t});\n}\nfunction delay() {\n   return new Promise(function(resolve) { \n       setTimeout(resolve, 11000)\n   });\n}\nfunction deleteWebConfig() {\n    return new Promise(\n\t\tfunction (resolve, reject) {\n\t\t\trimraf(basepath + '/Web.config', {}, function (err) {\n\t\t\t\tif (err) {\n\t\t\t\t\treject(err);\n\t\t\t\t} else {\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t);\n}\nmodule.exports = function reset(callback) {\n\tconsole.log('resetting site in '+basepath);\n\tdeleteWebConfig().then(function () {\n\t  return delay()\n\t}).then(function () {\n\tPromise.all([removePaths.map(function (path) {\n\t\tvar fullpath = basepath + '\\\\' + path;\n\t\treturn new Promise(function (resolve, reject) {\n\t\t\trimraf(fullpath, {}, function (err) {\n\t\t\t\tif (err) {\n\t\t\t\t\treject(err);\n\t\t\t\t} else {\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t})])} )\n\t.then(function () {\n\t\treturn Promise.all([\n\t\t\tcopyFile(sourcepath + '/ReleaseBuild.Web.config',\n\t\t\t\tbasepath + '/Web.config'),\n\t\t\tcopyFile(sourcepath + '/App_Data/Composite/ReleaseBuild.Composite.config',\n\t\t\t\tbasepath + '/App_Data/Composite/Composite.config')\n\t\t]);\n\t})\n\t.then(function () {\n\t\tcallback();\n\t})\n\t.catch(function (err) {\n\t\tcallback(err);\n\t});\n};\n"
  },
  {
    "path": "Website/test/e2e/suite/000_setup/installSite.js",
    "content": "var reset = require('../../reset.js');\n\nvar setupOption = 'Starter sites';\nvar starterSite = 'Venus';\nvar expectedLanguage = 'en-US';\n\nmodule.exports = {\n\t'@tags': ['install'],\n\n\tbefore: function (browser, done) {\n\t\treset(function (err) {\n\t\t\tif (err) {\n\t\t\t\tbrowser.end();\n\t\t\t\tconsole.error(err);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tdone();\n\t\t});\n\t},\n\t\n\t'install Venus starter site': function (browser) {\n\t\tbrowser.installWebsite(setupOption, starterSite, expectedLanguage)\n\t}\n\t\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/010_setupPackages/installSQLPackage.js",
    "content": "module.exports = {\n\t'@tags': ['InstallSql'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\n\t},\n\t'Install SQL Package': function (browser) {\n\t\t\n\t\tbrowser\n\t\t.installPackage(\"Composite.Tools\",\"Composite.Tools.SqlServerDataProvider\")\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"/\")\n\t\t.openTreeNode(\"Composite\")\n\t\t.openTreeNode(\"Composite\",\"InstalledPackages\")\n\t\t.openTreeNode(\"InstalledPackages\",\"content\")\n\t\t.openTreeNode(\"content\",\"views\")\n\t\t.openTreeNode(\"views\",\"Composite.Tools.SqlServerDataProvider\")\n\t\t.selectTreeNodeAction(\"SqlServerDataProvider.aspx.cs\",\"Edit File\")\n\t\t.replaceTextInCodeMirror('ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);','//ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);')\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"SqlServerDataProvider.aspx.cs\")\n\t\t\n\t\t.selectTreeNodeAction(\"SqlServer Data Provider\",\"Convert to SQL\")\n\t\t.selectDocumentTab(\"Convert to SQL\")\n\t\t.setFieldValue(\"Connection String:\",browser.globals.connectionString)\n\t\t.submitFormData('Next')\n\t\t.submitFormData('Finish')\n\t\t.waitForDialog(browser.globals.timeouts.save)\n\t\t.refresh()\n\t\t\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/010_setupPackages/installVerboseLoggingPackage.js",
    "content": "module.exports = {\n\t'@tags': ['InstallPackage'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\n\t},\n\t'Install Verbose Logging Package': function (browser) {\n\t\t\n\t\tbrowser\n\t\t.installPackage(\"Composite.Tools\",\"Composite.Tools.VerboseLogging\")\n\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/100_login/normalMode.js",
    "content": "module.exports = {\n\t'Normal mode does not have prefilled credentials': function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tlogin = browser.page.login();\n\t\tlogin.assert.value('@usernameInput', '');\n\t\tlogin.assert.value('@passwordInput', '');\n\t}\n};\n"
  },
  {
    "path": "Website/test/e2e/suite/100_login/procedure.js",
    "content": "module.exports = {\n\t'Can log in with correct credentials': function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tlogin = browser.page.login();\n\t\tstartScreen = browser.page.startScreen();\n\t\tlogin\n\t\t\t.isShown()\n\t\t\t.setUsername('admin')\n\t\t\t.setPassword('123456')\n\t\t\t.click('@submitButton')\n\t\t\t.waitForElementNotPresent('@usernameField', 5000);\n\t\t// Check that start screen is shown\n\t\tbrowser.page.appWindow().enter();\n\t\tstartScreen.waitForElementVisible('@startFrame', 5000);\n\t}\n};\n"
  },
  {
    "path": "Website/test/e2e/suite/200_startScreen/display.js",
    "content": "module.exports = {\n\t'Start screen shows, includes close button': function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar startScreen = browser.page.startScreen();\n\t\tstartScreen.prepare()\n\t\t\t.enter()\n\t\t\t.assert.visible('@closeButton');\n\t}\n};\n"
  },
  {
    "path": "Website/test/e2e/suite/200_startScreen/logged-in.js",
    "content": "module.exports = {\n\t'Start screen does not show when already logged in': function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tbrowser.page.appWindow().prepare();\n\t\tbrowser.refresh();\n\t\tbrowser.page.appWindow().enter();\n\t\tbrowser.page.startScreen()\n\t\t\t.assert.hidden('@startFrame');\n\t}\n};\n"
  },
  {
    "path": "Website/test/e2e/suite/300_appWindow/has-elements.js",
    "content": "module.exports = {\n\t'menu, explorer, stage': function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar app = browser.page.appWindow()\n\t\tapp.prepare()\n\t\t\t.enter()\n\t\t\t.assert.visible('@menu')\n\t\t\t.assert.visible('@explorer')\n\t\t\t.assert.visible('@stage');\n\t}\n};\n"
  },
  {
    "path": "Website/test/e2e/suite/300_appWindow/stages.js",
    "content": "const PERSPECTIVES = [\n\t'Content',\n\t'Media',\n\t'Data',\n\t'Layout',\n\t'Functions',\n\t'System'\n]\n\nmodule.exports = {\n\t'stages match explorer buttons': function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar app = browser.page.appWindow();\n\t\tapp.prepare().enter();\n\n\t\tPERSPECTIVES.forEach((perspective, index) => {\n\t\t\tvar buttonSelector = 'explorertoolbarbutton[label=\"' + perspective + '\"]';\n\t\t\tvar stageSelector = 'stagedeck[data-qa=\"perspective' + perspective + '\"]';\n\t\t\tbrowser\n\t\t\t\t.pause(1000)\n\t\t\t\t.click(buttonSelector)\n\t\t\t\t.waitForElementVisible(stageSelector, 5000);\n\t\t});\n\t}\n};\n"
  },
  {
    "path": "Website/test/e2e/suite/components/componentsFunctionSetParam.js",
    "content": "module.exports = {\n\t'@tags': ['Content'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\t\n\t},\n\t'can add component and set it\\'s function parameters': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"/\")\n\t\t.openTreeNode(\"App_Data\")\n\t\t.selectTreeNodeAction(\"Components\",\"Upload File\")\n\t\t.setFileFieldValue(\"Select file\", require('path').resolve(__dirname + '/function-set-params.xml'))\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasChild(\"Components\",\"function-set-params.xml\")\n\t\t\n\t\t.selectPerspective(\"Content\")\t\n\t\t.selectTreeNodeAction(\"Venus Starter Site\", \"Edit Page\")\n\t\t.page.editor()\n\t\t\t.selectContent(1)\n\t\t\t.clickLabel(\"${string:Composite.Web.VisualEditor:Components.LaunchButton.Label}\")\n\t\t\t.pause(browser.globals.timeouts.basic)\n\t\t\t.clickText(\"function-set-params\")\n\t\t\t.clickText(\"OK\")\n\t\t\t.pause(browser.globals.timeouts.basic)\n\t\t\t.clickDataBySibilings(\"Text\")\n\t\t\t.changeElementContent('h1', 'Some Title')\n\t\t\t.acceptChanges()\n\t\t\t.clickDialogButton(\"${string:Website.Dialogs.LabelAccept}\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Venus Starter Site\")\n\t\t.assertBrowserContains('div.image-and-text h1', 'Some Title')\n\t\t\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Venus Starter Site\",\"Undo Changes\")\n\t\t.selectTreeNodeAction(\"Venus Starter Site\",\"Publish\")\n\t\t.assertBrowserContains('div.jumbotron-content > h1 > em', 'Venus')\n\t\t\n\t\t.selectPerspective(\"System\")\n\t\t.selectTreeNodeAction(\"function-set-params.xml\",\"Delete File\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Components\",\"function-set-params.xml\")\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/components/componentsXhtml.js",
    "content": "module.exports = {\n\t'@tags': ['Content'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\t\n\t},\n\t'can add simple component': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"/\")\n\t\t.openTreeNode(\"App_Data\")\n\t\t.selectTreeNodeAction(\"Components\",\"Upload File\")\n\t\t.setFileFieldValue(\"Select file\", require('path').resolve(__dirname + '/xhtml-Simple.xml'))\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasChild(\"Components\",\"xhtml-Simple.xml\")\n\t\t\n\t\t.selectPerspective(\"Content\")\t\n\t\t.selectTreeNodeAction(\"Venus Starter Site\", \"Edit Page\")\n\t\t.page.editor()\n\t\t\t.selectContent(1)\n\t\t\t.clickLabel(\"${string:Composite.Web.VisualEditor:Components.LaunchButton.Label}\")\n\t\t\t.pause(browser.globals.timeouts.basic)\n\t\t\t.clickText(\"xhtml-Simple\")\n\t\t\t.clickText(\"OK\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Venus Starter Site\")\n\t\t.assertBrowserContains('div.container > h1', 'Simple content')\n\t\t\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Venus Starter Site\",\"Undo Changes\")\n\t\t.selectTreeNodeAction(\"Venus Starter Site\",\"Publish\")\n\t\t.assertBrowserContains('div.jumbotron-content > h1 > em', 'Venus')\n\t\t\n\t\t.selectPerspective(\"System\")\n\t\t.selectTreeNodeAction(\"xhtml-Simple.xml\",\"Delete File\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Components\",\"xhtml-Simple.xml\")\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/components/function-set-params.xml",
    "content": "<f:function name=\"Orckestra.Web.Html.ImageAndTextTeaser\" xmlns:f=\"http://www.composite.net/ns/function/1.0\" xmlns=\"http://www.w3.org/1999/xhtml\">\r\n\t<f:param name=\"Image\" value=\"MediaArchive:969705d6-adc5-4311-8186-641e59bbbddb\" />\r\n\t<f:param name=\"Text\">\r\n\t\t<html>\r\n\t\t\t<head>\r\n\t\t\t</head>\r\n\t\t\t<body>\r\n\t\t\t<h1>Preset Title</h1>\r\n\t\t\t</body>\r\n\t\t</html>\r\n\t</f:param>\r\n</f:function>"
  },
  {
    "path": "Website/test/e2e/suite/components/xhtml-Simple.xml",
    "content": "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n\t<head>\r\n\t</head>\r\n\t<body>\r\n\t\t<h1>Simple content</h1>\r\n\t\t<p>This is just a simple block of xhtml. Once selected, this should just be inserted into the document as is and no function dialog is expected.</p>\r\n\t</body>\r\n</html>"
  },
  {
    "path": "Website/test/e2e/suite/content/browseTree.js",
    "content": "module.exports = {\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare()\n\t\t\t.section.docktabs.clickTab(1);\n\t},\n\t'can access pages via content tree browser': function (browser) {\n\t\tvar content = browser.page.content();\n\t\tvar systemView = browser.page.systemView();\n\t\tsystemView\n\t\t\t.enter()\n\t\t// 1  Check the “Websites” node.  Make sure the “Websites” node is expanded.\n\t\tbrowser.expect.element('treenode[label=\"Websites\"]').to.have.attribute('open', 'true');\n\t\t// 2  Locate the “Venus Starter Site” page. The page is present below “Websites”.\n\t\tsystemView.assertTreeNodeHasChild('Websites', 'Venus Starter Site');\n\t\t// 3  Expand the “Venus Starter Site” page. The page gets expanded.\n\t\tsystemView.openTreeNode('Venus Starter Site');\n\t\t//     Child pages appear below the page.\n\t\tsystemView.assertTreeNodeHasChild('Venus Starter Site');\n\t\t// 4  Locate the “Getting Started” page. The page is present below ““Venus Starter Site”.\n\t\tsystemView.assertTreeNodeHasChild('Venus Starter Site', 'Getting Started');\n\t\t// 5  Expand the “Getting Started” page. The page gets expanded.\n\t\tsystemView.openTreeNode('Getting Started');\n\t\t//     Child pages appear below the page.\n\t\tsystemView.assertTreeNodeHasChild('Getting Started');\n\t    // 6  Locate the “Components” page. The page is present below “Getting Started”.\n\t\tsystemView.assertTreeNodeHasChild('Getting Started', 'Components');\n\t    // 7  Select the “Components” page The “Test” page gets selected in the tree.\n\t\tsystemView.openTreeNode('Components')\n\t    //     The “Components” page’s content loads in the browser view.\n\t\tcontent\n\t\t\t.assertBrowserContains('div.content-column > h1', 'Test components')\n\t\t//     The URL in the address bar reads “http://<website>/Getting-Started/components/c1mode(unpublished)\n\t\t\t.assertBrowserUrl('/Getting-Started/components/c1mode(unpublished)')\n\t}\n};\n"
  },
  {
    "path": "Website/test/e2e/suite/content/multiEditor.js",
    "content": "module.exports = {\n\t'@tags': ['Content'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\t\n\t},\n\t'can edit front page': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\t\n\t\t.selectTreeNodeAction(\"Venus Starter Site\", \"Edit Page\")\n\t\t.page.editor()\n\t\t\t.selectEditOnContent(1)\n\t\t\t.pause(browser.globals.timeouts.basic)\n\t\t\t.clickDataBySibilings(\"Content\")\n\t\t\t.changeElementContent('h1 > em', 'Jupiter')\n\t\t\t.acceptChanges()\n\t\t\t.clickDataBySibilings(\"Background Image\")\n\t\t\t.pause(browser.globals.timeouts.basic)\n\t\t\t.clickLabel(\"Select…\")\n\t\t\t.clickLabel(\"Copenhagen\",\"Media Archive\")\n\t\t\t.clickLabel(\"Botanical_Garden__Photographer_Ty_Stange.jpg\")\n\t\t\t.acceptChanges()\n\t\t\t.acceptFunctionEdit()\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Venus Starter Site\")\n\t\t.assertBrowserContains('div.jumbotron-content > h1 > em', 'Jupiter')\n\t\t.assertBrowserContainsAttribute('div.jumbotron', 'style', 'Botanical_Garden__Photographer_Ty_Stange.jpg')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Venus Starter Site\",\"Undo Changes\")\n\t\t.selectTreeNodeAction(\"Venus Starter Site\",\"Publish\")\n\t\t.assertBrowserContains('div.jumbotron-content > h1 > em', 'Venus')\n\t\t.assertBrowserContainsAttribute('div.jumbotron', 'style', '5.jpg')\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/content/singleEditor.js",
    "content": "module.exports = {\n\t'@tags': ['Content'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\t\n\t},\n\t'can edit simple page': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Venus Starter Site\")\n\t\t.selectTreeNodeAction(\"Getting Started\", \"Edit Page\")\n\t\t.page.editor()\n\t\t\t.changeElementContent('h1', 'Moving forward')\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Getting Started\")\n\t\t.assertBrowserContains('div.content-column > h1', 'Moving forward')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Undo Changes\")\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Publish\")\n\t\t.assertBrowserContains('div.content-column > h1', 'Getting Started')\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/data/CreateGlobalDataTypes.js",
    "content": "module.exports = {\n\t'@tags': ['create-data-types'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare(\"Content\");\n\t},\n\t\n\t'Create Parent Global Data Type': function (browser) {\n\t\n\t\t// create a parent global data type\n\t\tbrowser\n\t\t.selectPerspective(\"Data\")\n\t\t.selectTreeNodeAction(\"Global Datatypes\", \"Add Datatype\")\n\t\t.selectDocumentTab(\"New Datatype\")\n\t\t.setFieldValue(\"Title\", \"Parents\")\n\t\t.setFieldValue(\"Type namespace\", \"Auto.Tests\")\n\t\t.setFieldValue(\"Type name\", \"Parent\")\n\t\t.selectContentTab(\"Fields\")\n\t\t.clickLabel(\"Add New\")\n\t\t.setFieldValue(\"Name\", \"MyStringField\")\n\t\t.clickLabel(\"Add New\")\n\t\t.setFieldValue(\"Name\", \"MyIntField\")\n\t\t.clickDataBySibilings(\"Field type\")\n\t\t.clickText(\"Integer\")\n\t\t.clickLabel(\"Add New\")\n\t\t.setFieldValue(\"Name\", \"MyDateTimeField\")\n\t\t.clickDataBySibilings(\"Field type\")\n\t\t.clickText(\"Date\")\n\t\t.clickLabel(\"Add New\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Parents\")\n\t\t.assertTreeNodeHasChild(\"Global Datatypes\",\"Auto.Tests.Parent\")\n\t\t\n\t\tbrowser\n\t\t.logOut(\"admin\")\n\t},\n\t\n\t'Add data items': function (browser) {\n\t\n\t\tbrowser\n\t\t.selectPerspective(\"Data\")\n\t\t.selectTreeNodeAction(\"Auto.Tests.Parent\", \"Add Data\")\n\t\t.selectDocumentTab(\"Parent\")\n\t\t.setFieldValue(\"MyStringField\", \"Parent A\")\n\t\t.setFieldValue(\"MyIntField\", \"100\")\n\t\t.setFieldValue(\"MyDateTimeField\", \"12/31/2016\")\n\t\t.setFieldValue(\"NewField\", \"Some text 1\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Parent\")\n\t\t.openTreeNode(\"Auto.Tests.Parent\")\n\t\t.assertTreeNodeHasChild(\"Auto.Tests.Parent\",\"Parent A\")\n\t\t\n\t\t.selectTreeNodeAction(\"Auto.Tests.Parent\", \"Add Data\")\n\t\t.selectDocumentTab(\"Parent\")\n\t\t.setFieldValue(\"MyStringField\", \"Parent B\")\n\t\t.setFieldValue(\"MyIntField\", \"1000\")\n\t\t.setFieldValue(\"MyDateTimeField\", \"12/31/2018\")\n\t\t.setFieldValue(\"NewField\", \"Some text 2\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Parent\")\n\t\t.openTreeNode(\"Auto.Tests.Parent\")\n\t\t.assertTreeNodeHasChild(\"Auto.Tests.Parent\",\"Parent B\")\n\t\t\n\t\t.selectTreeNodeAction(\"Auto.Tests.Parent\", \"Add Data\")\n\t\t.selectDocumentTab(\"Parent\")\n\t\t.setFieldValue(\"MyStringField\", \"Parent C\")\n\t\t.setFieldValue(\"MyIntField\", \"10000\")\n\t\t.setFieldValue(\"MyDateTimeField\", \"12/31/2020\")\n\t\t.setFieldValue(\"NewField\", \"Some text 3\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Parent\")\n\t\t.openTreeNode(\"Auto.Tests.Parent\")\n\t\t.assertTreeNodeHasChild(\"Auto.Tests.Parent\",\"Parent C\")\t\n\t\t\n\t\tbrowser\n\t\t.logOut(\"admin\")\t\n\t},\n\n\t'Duplicate data items': function (browser) {\n\t\n\t\tbrowser\n\t\t.selectPerspective(\"Data\")\n\t\t.openTreeNode(\"Auto.Tests.Parent\")\n\t\t.selectTreeNodeAction(\"Parent B\", \"Duplicate Data\")\n\t\t.assertTreeNodeHasChild(\"Auto.Tests.Parent\", \"Copy of Parent B\")\n\t\t\n\t\tbrowser\n\t\t.logOut(\"admin\")\n\t},\n\t\n\t'Delete data items': function (browser) {\n\t\n\t\tbrowser\n\t\t.selectPerspective(\"Data\")\n\t\t.openTreeNode(\"Auto.Tests.Parent\")\n\t\t.selectTreeNodeAction(\"Parent B\", \"Delete Data\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Auto.Tests.Parent\", \"Parent B\")\n\t\t\n\t\tbrowser\n\t\t.logOut(\"admin\")\n\t},\n\t\n\t'Edit data items': function (browser) {\n\t\n\t\tbrowser\n\t\t.selectPerspective(\"Data\")\n\t\t.openTreeNode(\"Auto.Tests.Parent\")\t\t\n\t\t.selectTreeNodeAction(\"Copy of Parent B\", \"Edit Data\")\n\t\t.selectDocumentTab(\"Copy of Parent B\")\n\t\t.setFieldValue(\"MyStringField\", \"Parent B new\")\n\t\t.setFieldValue(\"MyIntField\", \"99\")\n\t\t.setFieldValue(\"MyDateTimeField\", \"01/01/2017\")\n\t\t.setFieldValue(\"NewField\", \"New text 1 edited\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Copy of Parent B\")\n\t\t.openTreeNode(\"Auto.Tests.Parent\")\n\t\t.assertTreeNodeHasChild(\"Auto.Tests.Parent\",\"Parent B new\")\n\t\n\t\tbrowser\n\t\t.logOut(\"admin\")\n\t},\n\t\n\t'Delete Parent Global Data Type': function (browser) {\n\t\n\t\tbrowser\n\t\t.selectPerspective(\"Data\")\n\t\t.selectTreeNodeAction(\"Auto.Tests.Parent\",\"Delete Datatype\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Auto.Tests.Parent\")\n\t},\n\t\n\tafterEach: function (browser, done) {\t    \n\t\tdone();\n\t}\n}\n\n"
  },
  {
    "path": "Website/test/e2e/suite/duplicate/Duplicate.js",
    "content": "module.exports = {\n\t'@tags': ['Duplicate'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\n\t},\n\t'can duplicate simple page': function (browser) {\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Venus Starter Site\")\n\t\t.selectTreeNodeAction(\"Getting Started\", \"Duplicate Page\")\n\t\t.assertTreeNodeHasChild('Websites', 'Venus Starter Site')\n\t\t.assertTreeNodeHasChild('Venus Starter Site', 'Copy of Getting Started');\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Copy of Getting Started\",\"Delete\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Copy of Getting Started\")\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/duplicate/DuplicatePagesWithAction.js",
    "content": "module.exports = {\n\t'@tags': ['Duplicate'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\n\t},\n\t'asserts duplicated simple page contains application attached to original page but not the data': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Venus Starter Site\")\n\t\t.selectTreeNodeAction(\"Blog\", \"Duplicate Page\")\n\t\t.assertTreeNodeHasChild('Websites', 'Venus Starter Site')\n\t\t.assertTreeNodeHasChild('Venus Starter Site')\n\t\t.assertTreeNodeHasChild('Venus Starter Site', 'Copy of Blog')\n\t\t.openTreeNode(\"Blog\")\n\t\t.assertTreeNodeHasChild('Blog')\n\t\t.assertTreeNodeHasChild('Blog', 'Blog Entries')\n\t\t.openTreeNode('Blog','Blog Entries')\n\t\t.assertTreeNodeIsNotEmpty('Blog','Blog Entries')\n\t\t.openTreeNode('Copy of Blog')\n\t\t.assertTreeNodeHasChild('Copy of Blog')\n\t\t.assertTreeNodeHasChild('Copy of Blog', 'Blog Entries')\n\t\t.openTreeNode('Copy of Blog','Blog Entries')\n\t\t.assertTreeNodeIsEmpty('Copy of Blog','Blog Entries')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Copy of Blog\",\"Delete\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Copy of Blog\")\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/duplicate/DuplicatePagesWithData.js",
    "content": "module.exports = {\n\t'@tags': ['Duplicate'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\n\t},\n\t'asserts duplicated simple page contains Data Folder attached to original page but not the data': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Venus Starter Site\", \"Duplicate Page\")\n\t\t.assertTreeNodeHasChild('Websites', 'Venus Starter Site')\n\t\t.assertTreeNodeHasChild('Websites', 'Copy of Venus Starter Site')\n\t\t.openTreeNode('Venus Starter Site')\n\t\t.assertTreeNodeHasChild('Venus Starter Site', 'Top links')\n\t\t.openTreeNode('Venus Starter Site','Top links')\n\t\t.assertTreeNodeIsNotEmpty('Venus Starter Site','Top links')\n\t\t.openTreeNode('Copy of Venus Starter Site')\n\t\t.assertTreeNodeHasChild('Copy of Venus Starter Site', 'Top links')\n\t\t.openTreeNode('Copy of Venus Starter Site', 'Top links')\n\t\t.assertTreeNodeIsEmpty('Copy of Venus Starter Site', 'Top links')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Copy of Venus Starter Site\",\"Delete\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Copy of Venus Starter Site\")\n\t\t\n\t\t\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/duplicate/DuplicatePagesWithMetaData.js",
    "content": "module.exports = {\n\t'@tags': ['Duplicate'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare(\"Content\");\n\t},\n\t'can duplicate simple page with Metadata attached': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"Data\")\n\t\t.selectTreeNodeAction(\"Page Metatypes\", \"Add Metatype\")\n\t\t.selectDocumentTab(\"New Page Metatype\")\n\t\t.setFieldValue(\"Title\", \"Human title\")\n\t\t.setFieldValue(\"Type namespace\", \"newNamespace\")\n\t\t.setFieldValue(\"Type name\", \"myTypeName\")\n\t\t.selectContentTab(\"Fields\")\n\t\t.clickLabel(\"Add New\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"New Page Metatype\")\n\t\t.assertTreeNodeHasChild(\"Page Metatypes\",\"newNamespace.myTypeName\")\n\t\t\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Venus Starter Site\")\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Add Metadata Field\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.setFieldValue(\"NewField\", \"newTextValue\")\n\t\t.clickDialogButton(\"Finish\")\n\t\t\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Duplicate Page\")\n\t\t.selectTreeNodeAction(\"Copy of Getting Started\",\"Edit Page\")\n\t\t.selectContentTab(\"Metadata\")\n\t\t.assertFieldValue(\"Human title\",\"NewField\",\"newTextValue\")\n\t\t.closeDocumentTab(\"Copy of Getting Started\")\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Remove Metadata Field\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.selectTreeNodeAction(\"Copy of Getting Started\",\"Delete\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Copy of Getting Started\")\n\t\t.selectPerspective(\"Data\")\n\t\t.selectTreeNodeAction(\"newNamespace.myTypeName\",\"Delete\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"newNamespace.myTypeName\")\n\t\t\n\t\t\t\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n\n"
  },
  {
    "path": "Website/test/e2e/suite/duplicate/DuplicatePagesWithMetaDataOnType.js",
    "content": "module.exports = {\n\t'@tags': ['Duplicate'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare(\"Content\");\n\t},\n\t'can duplicate simple page with Metadata attached to page type': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"Data\")\n\t\t.selectTreeNodeAction(\"Page Metatypes\", \"Add Metatype\")\n\t\t.selectDocumentTab(\"New Page Metatype\")\n\t\t.setFieldValue(\"Title\", \"Human title\")\n\t\t.setFieldValue(\"Type namespace\", \"newNamespace\")\n\t\t.setFieldValue(\"Type name\", \"myTypeName\")\n\t\t.selectContentTab(\"Fields\")\n\t\t.clickLabel(\"Add New\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"New Page Metatype\")\n\t\t.assertTreeNodeHasChild(\"Page Metatypes\",\"newNamespace.myTypeName\")\n\t\t\n\t\t.selectPerspective(\"Layout\")\n\t\t.openTreeNode(\"Page\")\n\t\t.selectTreeNodeAction(\"Metadata Fields\",\"Add Metadata Field\")\n\t\t.clickDataBySibilings(\"Metadata type\")\n\t\t.clickLabel(\"Human title\")\n\t\t.setFieldValue(\"Programmatic name\",\"newName\")\n\t\t.setFieldValue(\"Show with label\",\"newLabel\")\n\t\t.clickDialogButton(\"Next\")\n\t\t.setFieldValue(\"NewField\", \"newTextValue\")\n\t\t.clickDialogButton(\"Finish\")\n\t\t\t\t\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Venus Starter Site\")\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Edit Page\")\n\t\t.selectContentTab(\"Metadata\")\n\t\t.setFieldValueInFieldGroup(\"newLabel\",\"NewField\",\"anotherTextValue\")\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Getting Started\")\n\t\t\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Duplicate Page\")\n\t\t.selectTreeNodeAction(\"Copy of Getting Started\",\"Edit Page\")\n\t\t.selectContentTab(\"Metadata\")\n\t\t.assertFieldValue(\"newLabel\",\"NewField\",\"anotherTextValue\")\n\t\t.closeDocumentTab(\"Copy of Getting Started\")\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Undo Changes\")\n\t\t.selectTreeNodeAction(\"Getting Started\",\"Publish\")\n\t\t.selectTreeNodeAction(\"Copy of Getting Started\",\"Delete\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"Copy of Getting Started\")\n\t\t\n\t\t.selectPerspective(\"Layout\")\n\t\t.openTreeNode(\"Metadata Fields\")\n\t\t.selectTreeNodeAction(\"newName\",\"Delete Metadata Field\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"newName\")\n\t\t\n\t\t.selectPerspective(\"Data\")\n\t\t.selectTreeNodeAction(\"newNamespace.myTypeName\",\"Delete\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"newNamespace.myTypeName\")\n\t\t\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n\n"
  },
  {
    "path": "Website/test/e2e/suite/duplicate/DuplicateTreeAction.js",
    "content": "module.exports = {\n\t'@tags': ['Duplicate'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\n\t},\n\t'can use duplicate action on tree': function (browser) {\n\t\tbrowser\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"/\")\n\t\t.openTreeNode(\"App_Data\")\n\t\t.openTreeNode(\"App_Data\",\"Composite\")\n\t\t.openTreeNode(\"TreeDefinitions\")\n\t\t.selectTreeNodeAction(\"Composite.Community.Blog.Entries.xml\",\"Edit File\")\n\t\t.replaceTextInCodeMirror('<EditDataAction Label=\"Edit Blog Entry\" />','<DuplicateDataAction Label=\"Duplicate Blog Entry\" />')\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Composite.Community.Blog.Entries.xml\")\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Venus Starter Site\")\n\t\t.openTreeNode(\"Blog\")\n\t\t.openTreeNode(\"Blog Entries\")\n\t\t.openTreeNode(\"2014 June\")\n\t\t.selectTreeNodeAction(\"About this blog\",\"Duplicate Blog Entry\")\n\t\t.assertTreeNodeHasChild(\"2014 June\",\"Copy of About this blog\")\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.selectTreeNodeAction(\"Copy of About this blog\",\"Delete Blog Entry\")\n\t\t.clickDialogButton(\"OK\")\n\t\t.assertTreeNodeHasNoChild(\"2014 June\",\"Copy of About this blog\")\n\t\t.selectPerspective(\"System\")\n\t\t.selectTreeNodeAction(\"Composite.Community.Blog.Entries.xml\",\"Edit File\")\n\t\t.replaceTextInCodeMirror('<DuplicateDataAction Label=\"Duplicate Blog Entry\" />','<EditDataAction Label=\"Edit Blog Entry\" />')\n\t\t.clickSave()\n\t\t.closeDocumentTab(\"Composite.Community.Blog.Entries.xml\")\n\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/locales/InstallUninstallWebsiteLanguage.js",
    "content": "module.exports = {\n\t'@tags': ['InstallLocale'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare(\"Content\");\n\t},\n\t'Install and uninstall a website language': function (browser) {\n\t\t\n\t\tbrowser\n\t\t.installLocale(\"French, Canada\", \"fr\")\n\n\t\tbrowser\n\t\t.uninstallLocale(\"French, Canada\")\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}"
  },
  {
    "path": "Website/test/e2e/suite/packages/InstallUninstallExtranet.js",
    "content": "module.exports = {\n\t'@tags': ['InstallPackage'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare(\"Content\");\n\t},\n\t'Install Extranet': function (browser) {\n\t\t\n\t\tbrowser\n\t\t.installCommercialPackage(\"Composite.Community\", \"Composite.Community.Extranet\")\n\t\t\n\t\tbrowser\n\t\t.uninstallPackage(\"Composite.Community\", \"Composite.Community.Extranet\")\n\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}"
  },
  {
    "path": "Website/test/e2e/suite/packages/InstallUninstallLocalPackage.js",
    "content": "module.exports = {\n\t'@tags': ['InstallPackage'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare(\"Content\");\n\t},\n\t'install a local package': function (browser) {\n\t\t\n\t\tbrowser\n\t\t.installLocalPackage(require('path').resolve(__dirname),\"Orckestra.Demo.Contacts\")\n\t\t\n\t\tbrowser\n\t\t.uninstallLocalPackage(\"Orckestra.Demo.Contacts\")\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}"
  },
  {
    "path": "Website/test/e2e/suite/packages/InstallUninstallPackageCreator.js",
    "content": "module.exports = {\n\t'@tags': ['InstallPackage'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare();\n\t},\n\t'Install Package Creator': function (browser) {\n\t\t\n\t\tbrowser\n\t\t.installPackage(\"Composite.Tools\",\"Composite.Tools.PackageCreator\")\n\t\t\n\t\tbrowser\n\t\t.uninstallPackage(\"Composite.Tools\",\"Composite.Tools.PackageCreator\")\n\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/packages/UninstallInstallYouTube.js",
    "content": "module.exports = {\n\t'@tags': ['InstallPackage'],\n\tbeforeEach: function (browser) {\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\n\t\tvar content = browser.page.content();\n\t\tcontent\n\t\t\t.prepare(\"Content\");\n\t},\n\t'Uninstall and Install YouTube': function (browser) {\n\t\t\n\t\tbrowser\n\t\t.uninstallLocalPackage(\"Orckestra.Media.YouTube\")\n\n\t\tbrowser\n\t\t.installPackage(\"Orckestra.Media\", \"Orckestra.Media.YouTube\")\n\t\t\n\t},\n\tafterEach: function (browser, done) {\n\t\tdone();\n\t}\n}"
  },
  {
    "path": "Website/test/e2e/suite/website-zip-upload-extract/UploadAndExtractZip.js",
    "content": "module.exports = {\r\n\t'@tags': ['website-zip-upload-extract'],\r\n\tbeforeEach: function (browser) {\r\n\t\tbrowser.url(browser.launchUrl + '/Composite/top.aspx');\r\n\t\tvar content = browser.page.content();\r\n\t\tcontent\r\n\t\t\t.prepare(\"Content\");\r\n\t},\r\n\t'Upload and Extract Zip': function (browser) {\r\n\t\tbrowser\r\n\t\t.selectPerspective(\"System\")\r\n\t\t.selectTreeNodeAction(\"/\", \"New Folder\")\r\n\t\t.setFieldValue(\"Folder name\", \"ZipTest\")\r\n\t\t.clickDialogButton(\"OK\")\r\n\t\t.waitForDialogClosed()\r\n\t\t.selectPerspective(\"System\")\r\n\t\t.selectTreeNodeAction(\"ZipTest\", \"Upload and Extract Zip\", \"Upload File\")\r\n\t\t.setFileFieldValue(\"Zip file\", require('path').resolve(__dirname + '/test.zip'))\r\n\t\t.clickDialogButton(\"OK\")\r\n\t\t.waitForDialogClosed()\r\n\t\t.openTreeNode(\"ZipTest\")\r\n\t\t.assertTreeNodeHasChild(\"ZipTest\", \"root.txt\")\r\n\t\t.openTreeNode(\"subdir1\")\r\n\t\t.openTreeNode(\"subdir2\")\r\n\t\t.assertTreeNodeHasChild(\"subdir2\", \"simple.txt\")\r\n\t\t.selectTreeNodeAction(\"ZipTest\",\"Delete Folder\")\r\n\t\t.clickDialogButton(\"OK\")\r\n\t\t.waitForDialogClosed()\r\n\t\t.assertTreeNodeHasNoChild(\"/\", \"ZipTest\")\r\n\t},\r\n\tafterEach: function (browser, done) {\r\n\t\tdone();\r\n\t}\r\n}\r\n\r\n"
  },
  {
    "path": "Website/test/e2e/suite/zzz_starterSites/InstallSiteWithOtherLanguage.js",
    "content": "var reset = require('../../reset.js');\n\nmodule.exports = {\n\t'@tags': ['install'],\n\tbeforeEach: function (browser, done) {\n\t\treset(function (err) {\n\t\t\tif (err) {\n\t\t\t\tbrowser.end();\n\t\t\t\tconsole.error(err);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tdone();\n\t\t});\n\t},\n\t\n\t'install Venus starter site with French (CA)': function (browser) {\n\t\tbrowser\n\t\t.installWebsite('Starter sites', 'Venus', 'en-US', 'French (CA)', 'fr-CA')\n\t\t\n\t\t// assert the GUI and the website language is French \n\t\tbrowser\n\t\t.selectPerspective(\"Système\")\n\t\t.openTreeNode(\"Langues\")\n\t\t.assertTreeNodeHasChild(\"Langues\", \"Français, Canada\")\n\t\t\n\t\t.end()\n\t},\n\t\n\t'reinstall Venus starter site with English (US)': function (browser) {\n\t\tbrowser.installWebsite('Starter sites', 'Venus', 'en-US')\n\t\t\n\t\t// assert the GUI and the website language is English \n\t\tbrowser\n\t\t.selectPerspective(\"System\")\n\t\t.openTreeNode(\"Languages\")\n\t\t.assertTreeNodeHasChild(\"Languages\", \"English, US\")\n\t\t\n\t\t.end()\n\t}\n\t\n\t\n}\n"
  },
  {
    "path": "Website/test/e2e/suite/zzz_starterSites/InstallStarterSites.js",
    "content": "var reset = require('../../reset.js');\n\nmodule.exports = {\n\t'@tags': ['install'],\n\tbeforeEach: function (browser, done) {\n\t\treset(function (err) {\n\t\t\tif (err) {\n\t\t\t\tbrowser.end();\n\t\t\t\tconsole.error(err);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tdone();\n\t\t});\n\t},\n\t\n\t// 1 install starter sites other than \"Venus\"\n\t'install Neptune starter site': function (browser) {\n\t\tbrowser\n\t\t.installWebsite('Starter sites', 'Neptune', 'en-US')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Neptune Starter Site\")\n\t\t\n\t\t.end()\n\t},\n\t\n\t'install Mercury starter site': function (browser) {\n\t\tbrowser\n\t\t.installWebsite('Starter sites', 'Mercury', 'en-US')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Frontpage\")\n\t\t\n\t\t.end()\n\t},\n\t\n\t'install Open Cph Razor starter site': function (browser) {\n\t\tbrowser\n\t\t.installWebsite('Starter sites', 'Open Cph - Razor', 'en-US')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Open Cph Starter Site\")\n\t\t\n\t\t.end()\n\t},\n\t\n\t'install Open Cph Master Pages starter site': function (browser) {\n\t\tbrowser\n\t\t.installWebsite('Starter sites', 'Open Cph - Master Pages', 'en-US')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Open Cph Starter Site\")\n\t\t\n\t\t.end()\n\t},\n\t\t\n\t'install Bare Bones site': function (browser) {\n\t\tbrowser\n\t\t.installWebsite('Bare bones', '', 'en-US')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.assertTreeNodeHasNoChild('Websites')\n\t\t\n\t\t.end()\n\t},\n\t\n\t// 2 reset to  \"Venus\" \n\t'install Venus starter site': function (browser) {\n\t\tbrowser\n\t\t.installWebsite('Starter sites', 'Venus', 'en-US')\n\t\t\n\t\tbrowser\n\t\t.selectPerspective(\"Content\")\n\t\t.openTreeNode(\"Venus Starter Site\")\n\t\t\n\t\t.end()\n\t},\n}\n"
  },
  {
    "path": "Website/test/unit/coverage.js",
    "content": "/* global SystemJS */\nimport systemIstanbul from '@node/systemjs-istanbul-hook';\nsystemIstanbul.hookSystemJS(SystemJS, address => {\n\t// Only files in Composite/console should be instrumented\n\treturn !address.startsWith(SystemJS.baseURL + 'Composite/console');\n});\nimport istanbul from '@node/istanbul';\nimport runner from 'unittest/runner.js';\n\nrunner\n// after running the tests, save the coverage file\n.then(function() {\n\tlet coverage = systemIstanbul.remapCoverage();\n\tlet collector = new istanbul.Collector();\n\tcollector.add(coverage);\n\tlet reporter = new istanbul.Reporter();\n\treporter.add('lcov');\n\treturn new Promise((resolve, reject) => {\n\t\ttry {\n\t\t\treporter.write(collector, true, () => {\n\t\t\t\tconsole.log('Coverage report written to ' + reporter.dir); // eslint-disable-line no-console\n\t\t\t\tresolve();\n\t\t\t});\n\t\t} catch (err) {\n\t\t\treject(err);\n\t\t}\n\t});\n})\n.catch(err => {\n\tconsole.error(err); // eslint-disable-line no-console\n\tconsole.error(err.stack); // eslint-disable-line no-console\n});\n"
  },
  {
    "path": "Website/test/unit/helpers/StatelessWrapper.js",
    "content": "import React, { PropTypes } from 'react';\n// Lifted from the unexpected-react documentation\nexport default class StatelessWrapper extends React.Component {\n\trender() {\n\t\treturn (this.props.children);\n\t}\n}\nStatelessWrapper.propTypes = {\n\tchildren: PropTypes.any\n};\n"
  },
  {
    "path": "Website/test/unit/helpers/TestComponent.js",
    "content": "import React from 'react';\nconst TestComponent = props => (<div {...props}/>);\nexport default TestComponent;\n"
  },
  {
    "path": "Website/test/unit/helpers/emulateDom.js",
    "content": "import jsdom from '@node/jsdom';\nimport fetch from '@node/node-fetch';\n\n// emulateDom.js - jsdom variant\nif (typeof document === 'undefined') {\n\n\tglobal.document = jsdom.jsdom('');\n\tglobal.window = global.document.defaultView;\n\tglobal.window.fetch = fetch;\n\tglobal.window.WebSocket = function () { // Dead simple mock\n\t\tthis.send = () => {};\n\t\tthis.addEventListener = () => {};\n\t};\n\n\tfor (let key in global.window) {\n\t\tif (!global[key]) {\n\t\t\tglobal[key] = global.window[key];\n\t\t}\n\t}\n\tjsdom.changeURL(global.window, 'http://localhost/');\n}\n"
  },
  {
    "path": "Website/test/unit/helpers/expect.js",
    "content": "import 'unittest/helpers/emulateDom.js';\n\nimport unexpected from 'unexpected';\nimport unexpectedReact from 'unexpected-react';\nimport unexpectedSinon from 'unexpected-sinon';\nimport unexpectedDom from 'unexpected-dom';\nimport unexpectedMitm from 'unexpected-mitm';\nimport unexpectedZurvan from 'unexpected-zurvan';\nimport unexpectedImmutable from 'unittest/helpers/unexpected-immutable.js';\nimport TestUtils from 'react-addons-test-utils';\n\n// define our instance of the `expect` function to use\nconst expect = unexpected.clone()\n\t.use(unexpectedDom)\n\t.use(unexpectedMitm)\n\t.use(unexpectedZurvan)\n\t.use(unexpectedReact)\n\t.use(unexpectedImmutable)\n\t.use(unexpectedSinon);\n\n\n// Custom assertions\nexpect.addAssertion('<RenderedReactElement> finding DOM tag <string> <assertion?>', function (expect, subject, tagName) {\n\tlet element = TestUtils.findRenderedDOMComponentWithTag(subject, tagName);\n\treturn expect.shift(element);\n});\n\nexpect.addAssertion('<ReactElement> to have props [exhaustively] satisfying <any>', function (expect, subject, model) {\n\tlet props = subject.props;\n\treturn expect(props, 'to [exhaustively] satisfy', model);\n});\n\nexpect.addAssertion('<object> to be an action of type <string>', function (expect, subject, actionName) {\n\treturn expect(subject, 'to have own property', 'type', actionName);\n});\n\n// console.log(expect.outputFormat());\nexpect.outputFormat('ansi');\nexport default expect;\n"
  },
  {
    "path": "Website/test/unit/helpers/moduleLoader.js",
    "content": "export default function loadModule(moduleList, cb) {\n\tPromise.all(moduleList.map(({ module, moduleCb }) =>\n\t\tSystem.import(module)\n\t\t.then(moduleCb)\n\t))\n\t.then(cb);\n}\n"
  },
  {
    "path": "Website/test/unit/helpers/ui.js",
    "content": "/**\n * Module dependencies.\n */\nimport Test from '@node/mocha/lib/test';\nimport commonMixin from '@node/mocha/lib/interfaces/common';\n/**\n * BDD-style interface:\n *\n *      describe('Array', function() {\n *        describe('#indexOf()', function() {\n *          it('should return -1 when not present', function() {\n *            // ...\n *          });\n *\n *          it('should return the index when present', function() {\n *            // ...\n *          });\n *        });\n *      });\n *\n * @param {Suite} suite Root suite.\n */\nexport default function(suite) {\n\tvar suites = [suite];\n\n\tsuite.on('pre-require', function(context, file, mocha) {\n\t\tvar common = commonMixin(suites, context, mocha);\n\n\t\tcontext.suiteStack = suites;\n\t\tcontext.before = common.before;\n\t\tcontext.after = common.after;\n\t\tcontext.beforeEach = common.beforeEach;\n\t\tcontext.afterEach = common.afterEach;\n\t\tcontext.run = mocha.options.delay && common.runWithSuite(suite);\n\t\t/**\n\t\t * Describe a \"suite\" with the given `title`\n\t\t * and callback `fn` containing nested suites\n\t\t * and/or tests.\n\t\t */\n\n\t\tcontext.describe = context.context = function(title, fn) {\n\t\t\treturn common.suite.create({\n\t\t\t\ttitle: title,\n\t\t\t\tfile: file,\n\t\t\t\tfn: fn\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Pending describe.\n\t\t */\n\n\t\tcontext.xdescribe = context.xcontext = context.describe.skip = function(title, fn) {\n\t\t\treturn common.suite.skip({\n\t\t\t\ttitle: title,\n\t\t\t\tfile: file,\n\t\t\t\tfn: fn\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Exclusive suite.\n\t\t */\n\n\t\tcontext.describe.only = function(title, fn) {\n\t\t\treturn common.suite.only({\n\t\t\t\ttitle: title,\n\t\t\t\tfile: file,\n\t\t\t\tfn: fn\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Describe a specification or test-case\n\t\t * with the given `title` and callback `fn`\n\t\t * acting as a thunk.\n\t\t */\n\n\t\tcontext.it = context.specify = function(title, fn) {\n\t\t\tvar suite = suites[0];\n\t\t\tif (suite.isPending()) {\n\t\t\t\tfn = null;\n\t\t\t}\n\t\t\tvar test = new Test(title, fn);\n\t\t\ttest.file = file;\n\t\t\tsuite.addTest(test);\n\t\t\treturn test;\n\t\t};\n\n\t\t/**\n\t\t * Exclusive test-case.\n\t\t */\n\n\t\tcontext.it.only = function(title, fn) {\n\t\t\treturn common.test.only(mocha, context.it(title, fn));\n\t\t};\n\n\t\t/**\n\t\t * Pending test case.\n\t\t */\n\n\t\tcontext.xit = context.xspecify = context.it.skip = function(title) {\n\t\t\tcontext.it(title);\n\t\t};\n\n\t\t/**\n\t\t * Number of attempts to retry.\n\t\t */\n\t\tcontext.it.retries = function(n) {\n\t\t\tcontext.retries(n);\n\t\t};\n\t});\n}\n"
  },
  {
    "path": "Website/test/unit/helpers/unexpected-immutable.js",
    "content": "import Immutable from 'immutable';\n\nexport const name = 'unexpected-immutable';\n\nexport function installInto(expect) {\n\texpect.addType({\n\t\tname: 'Immutable',\n\t\tidentify: function (obj) {\n\t\t\treturn obj && Immutable.Iterable.isIterable(obj);\n\t\t},\n\t\tequal: function (obj1, obj2) {\n\t\t\treturn Immutable.is(obj1, obj2);\n\t\t},\n\t\tinspect: function (obj, depth, output) {\n\t\t\toutput.jsKeyword(obj.constructor.name + ' ').appendInspected(obj.toJS());\n\t\t},\n\t\tdiff: function (actual, expected, output, diff) {\n\t\t\treturn diff(actual.toJS(), expected.toJS());\n\t\t}\n\t});\n\n\texpect.addAssertion('<Immutable> to [exhaustively] satisfy <Immutable>', function (expect, subject, pattern) {\n\t\treturn expect(subject.toJS(), 'to [exhaustively] satisfy', pattern.toJS());\n\t});\n\texpect.addAssertion('<Immutable> to [exhaustively] satisfy <any>', function (expect, subject, pattern) {\n\t\treturn expect(subject.toJS(), 'to [exhaustively] satisfy', pattern);\n\t});\n\n\texpect.addType({\n\t\tname: 'ImmutableKeyed',\n\t\t// Object-like\n\t\tbase: 'Immutable',\n\t\tidentify: function (obj) {\n\t\t\treturn obj && Immutable.Iterable.isKeyed(obj);\n\t\t},\n\t\tinspect: function (obj, depth, output, inspect) {\n\t\t\toutput.jsKeyword(obj.constructor.name + ' ').append(inspect(obj.toObject()));\n\t\t}\n\t});\n\n\texpect.addAssertion('<ImmutableKeyed> to have values [exhaustively] satisfying <any>', function (expect, subject, pattern) {\n\t\treturn expect(subject.toObject(), 'to have values [exhaustively] satisfying', pattern);\n\t});\n\n\texpect.addAssertion('<ImmutableKeyed> to have [own] property <string> <any>', function (expect, subject, name, value) {\n\t\treturn expect(subject.toObject(), 'to have [own] property', name, value);\n\t});\n\n\texpect.addAssertion('<ImmutableKeyed> [not] to have property <string>', function (expect, subject, name) {\n\t\treturn expect(subject.toObject(), '[not] to have property', name);\n\t});\n\n\texpect.addType({\n\t\tname: 'ImmutableIndexed',\n\t\t// Array-like\n\t\tbase: 'Immutable',\n\t\tidentify: function (obj) {\n\t\t\treturn obj && Immutable.Iterable.isIndexed(obj);\n\t\t},\n\t\tinspect: function (obj, depth, output, inspect) {\n\t\t\toutput.jsKeyword(obj.constructor.name + ' ').append(inspect(obj.toArray()));\n\t\t}\n\t});\n\n\texpect.addAssertion('<ImmutableIndexed> to have items [exhaustively] satisfying <any>', function (expect, subject, pattern) {\n\t\treturn expect(subject.toArray(), 'to have items [exhaustively] satisfying', pattern);\n\t});\n\texpect.addAssertion('<ImmutableIndexed> to have items [exhaustively] satisfying <assertion>', function (expect, subject, ...pattern) {\n\t\treturn expect(subject.toArray(), 'to have items [exhaustively] satisfying', ...pattern);\n\t});\n}\n\nexport default {\n\tname,\n\tinstallInto\n};\n"
  },
  {
    "path": "Website/test/unit/runner.js",
    "content": "/* global SystemJS */\nimport Mocha from '@node/mocha';\nimport bdd from 'unittest/helpers/ui.js';\nMocha.interfaces['bdd-openstack'] = bdd;\n\nvar runner = new Mocha({ ui: 'bdd-openstack' });\nrunner.suite.emit('pre-require', global, 'global-mocha-context', runner);\n\n// Slightly hacky grep switch\nvar grepSwitchIndex = process.argv.indexOf('-g');\nif (grepSwitchIndex > -1) {\n\tlet grepArg = process.argv[grepSwitchIndex + 1] || '';\n\tgrepArg = new RegExp(grepArg.replace('!!', '!'));\n\trunner.grep(grepArg);\n}\n\nexport default SystemJS.import('unittest/suite.js')\n.then(i => i.importSuite())\n.then(function() {\n\treturn new Promise((resolve, reject) => {\n\t\trunner.run((failures) => {\n\t\t\tif (failures) {\n\t\t\t\treject(failures);\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/access/requestJSON.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport requestJSON from 'console/access/requestJSON.js';\nimport sinon from 'sinon';\nimport zurvan from 'zurvan';\n\ndescribe('requestJSON', () => {\n\tit('is asynchronous', () =>\n\t\texpect(() =>\n\t\t\trequestJSON('/').then(result => expect(result, 'to be an object')),\n\t\t\t'with http mocked out', {\n\t\t\t\trequest: 'GET /',\n\t\t\t\tresponse: { body: '{}' }\n\t\t\t},\n\t\t'not to error')\n\t);\n\n\tdescribe('GET local URL', () => {\n\t\tlet url, body;\n\t\tbeforeEach(() => {\n\t\t\turl = '/fixture.json';\n\t\t\tbody = {\n\t\t\t\turl,\n\t\t\t\tlist: [1,2,3]\n\t\t\t};\n\t\t});\n\n\t\tit('fetches JSON data', () =>\n\t\t\texpect(() =>\n\t\t\t\trequestJSON(url)\n\t\t\t\t.then(result => expect(result, 'to satisfy', {\n\t\t\t\t\turl,\n\t\t\t\t\tlist: [1,2,3]\n\t\t\t\t})),\n\t\t\t\t'with http mocked out', {\n\t\t\t\t\trequest: 'GET ' + url,\n\t\t\t\t\tresponse: { body }\n\t\t\t\t},\n\t\t\t\t'not to error')\n\t\t);\n\t});\n\n\tdescribe('POST local URL', () => {\n\t\tlet url, body;\n\t\tbeforeEach(() => {\n\t\t\turl = '/fixture.json';\n\t\t\tbody = {\n\t\t\t\turl,\n\t\t\t\tlist: [1,2,3]\n\t\t\t};\n\t\t});\n\n\t\tit('sends JSON data', () =>\n\t\t\texpect(() =>\n\t\t\t\trequestJSON(url, {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody\n\t\t\t\t}),\n\t\t\t\t'with http mocked out', {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\turl: 'POST ' + url,\n\t\t\t\t\t\tbody\n\t\t\t\t\t},\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tbody\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t'not to error')\n\t\t);\n\t});\n\n\tdescribe('GET absolute URL', () => {\n\t\tlet url, body;\n\t\tbeforeEach(() => {\n\t\t\turl = 'http://example.org/fixture.json';\n\t\t\tbody = {\n\t\t\t\turl,\n\t\t\t\tlist: [1,2,3]\n\t\t\t};\n\t\t});\n\n\t\tit('fetches JSON data', () =>\n\t\t\texpect(() =>\n\t\t\t\trequestJSON(url, {})\n\t\t\t\t.then(result => expect(result, 'to satisfy', {\n\t\t\t\t\turl,\n\t\t\t\t\tlist: [1,2,3]\n\t\t\t\t})),\n\t\t\t\t'with http mocked out', {\n\t\t\t\t\trequest: 'GET ' + url,\n\t\t\t\t\tresponse: { body }\n\t\t\t\t},\n\t\t\t\t'not to error')\n\t\t);\n\t});\n\n\tdescribe('Error handling', () => {\n\t\tlet url, body;\n\t\tbeforeEach(() => {\n\t\t\turl = 'http://example.org/fixture.json';\n\t\t\tbody = {\n\t\t\t\turl,\n\t\t\t\tlist: [1,2,3]\n\t\t\t};\n\t\t\t// Spy on fetch\n\t\t\tsinon.spy(global, 'fetch');\n\t\t\treturn zurvan.interceptTimers();\n\t\t});\n\n\t\tafterEach(() => {\n\t\t\tglobal.fetch.restore();\n\t\t\treturn zurvan.releaseTimers();\n\t\t});\n\n\t\tit('rejects if called with a non-compliant URL', () =>\n\t\t\texpect(requestJSON,\n\t\t\t\t'when called with', ['about:blank/this/is/wrong'],\n\t\t\t\t'to be rejected'\n\t\t\t)\n\t\t);\n\n\t\tit('rejects on unrecoverable errors', () =>\n\t\t\texpect(\n\t\t\t\trequestJSON, 'when called with', ['/failure.json'],\n\t\t\t\t'to be rejected with', '404 Not Found'\n\t\t\t)\n\t\t);\n\n\t\tit('retries if given a Retry-After header', () =>\n\t\t\texpect(() =>\n\t\t\t\trequestJSON(url, {})\n\t\t\t\t.then(result => expect(result, 'to satisfy', { url, list: [1,2,3] })),\n\t\t\t'with http mocked out', [\n\t\t\t\t{\n\t\t\t\t\trequest: 'GET ' + url,\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatusCode: 503,\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t'Retry-After': 5\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\trequest: 'GET ' + url,\n\t\t\t\t\tresponse: { body }\n\t\t\t\t}\n\t\t\t],\n\t\t\t'while waiting for', 6000,\n\t\t\t'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect(global.fetch, 'was called twice')\n\t\t\t)\n\t\t);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/_setup.js",
    "content": "before(done => {\n\t// Mock out WampClient\n\tif (System.has(System.normalizeSync('console/access/wampClient.js'))) {\n\t\tSystem.delete(System.normalizeSync('console/access/wampClient.js'));\n\t}\n\tSystem.set(\n\t\tSystem.normalizeSync('console/access/wampClient.js'),\n\t\tSystem.newModule({\n\t\t\tdefault: {\n\t\t\t\tmockery: () => Promise.resolve(),\n\t\t\t\tsetMock: function (mock) {\n\t\t\t\t\tthis.mockery = mock;\n\t\t\t\t},\n\t\t\t\tcall: function (...args) {\n\t\t\t\t\treturn this.mockery(...args);\n\t\t\t\t},\n\t\t\t\tsubscribe: function (...args) {\n\t\t\t\t\treturn this.mockery(...args);\n\t\t\t\t},\n\t\t\t\treset: function () {\n\t\t\t\t\tthis.mockery = () => Promise.resolve();\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t);\n\tdone();\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/actions/fetchFromProvider.spec.js",
    "content": "import loadModules from 'unittest/helpers/moduleLoader.js';\nimport expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\n\ndescribe('Data providers', () => {\n\tlet STORE_PROVIDER_DATA, actions, WAMPClient;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/state/reducers/providers.js',\n\t\t\t\tmoduleCb: m => { STORE_PROVIDER_DATA = m.STORE_PROVIDER_DATA; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/state/actions/fetchFromProvider.js',\n\t\t\t\tmoduleCb: m => { actions = m; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/access/wampClient.js',\n\t\t\t\tmoduleCb: m => { WAMPClient = m.default; }\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tit('has action descriptors', () =>\n\t\texpect(actions, 'to have property', 'GET_PROVIDER')\n\t\t\t.and('to have property', 'GET_PROVIDER_DONE')\n\t\t\t.and('to have property', 'GET_PROVIDER_FAILED')\n\t);\n\n\tdescribe('getProviderPage', () => {\n\t\tlet dispatch, getProviderPage;\n\t\tbeforeEach(()=> {\n\t\t\tgetProviderPage = actions.getProviderPage;\n\t\t\tdispatch = sinon.spy().named('dispatch');\n\t\t});\n\n\t\tdescribe.skip('using HTTP', () => {\n\t\t\tlet provider, params, result;\n\t\t\tbeforeEach(() => {\n\t\t\t\tprovider = {\n\t\t\t\t\tprotocol: 'http',\n\t\t\t\t\turi: '/Composite/api/Mock/Provider'\n\t\t\t\t};\n\t\t\t\tparams = {\n\t\t\t\t\tfirst: true,\n\t\t\t\t\tsecond: 'something',\n\t\t\t\t\tthird: [1, 2, 3]\n\t\t\t\t};\n\t\t\t\tresult = {\n\t\t\t\t\toutput: 'will be there'\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tdescribe('GET w. params', () => {\n\t\t\t\tit('fetches data from a given provider', () =>\n\t\t\t\t\texpect(() =>\n\t\t\t\t\t\texpect(getProviderPage, 'when called with', [provider, 'page1', params])\n\t\t\t\t\t\t.then(thunk =>\n\t\t\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t\t\t.and('when called with', [dispatch])\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'with http mocked out', {\n\t\t\t\t\t\t\trequest: 'GET /Composite/api/Mock/Provider?first=true&second=something&third=1,2,3',\n\t\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\t\tstatusCode: 200,\n\t\t\t\t\t\t\t\tbody: ['elements', 'of', 'data']\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'not to error'\n\t\t\t\t\t)\n\t\t\t\t\t.then(() =>\n\t\t\t\t\t\texpect(dispatch, 'to have calls satisfying', [\n\t\t\t\t\t\t\t{ args: [{ type: actions.GET_PROVIDER, provider: { uri: 'mock.test.provider' }, page: 'page1' }] },\n\t\t\t\t\t\t\t{ args: [{ type: STORE_PROVIDER_DATA, page: 'page1', data: result }] },\n\t\t\t\t\t\t\t{ args: [{ type: actions.GET_PROVIDER_DONE, provider: { uri: 'mock.test.provider' }, page: 'page1' }] }\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tdescribe('POST', () => {\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\tprovider.post = true;\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('using WAMP', () => {\n\t\t\tlet provider, params, wampCall, result;\n\t\t\tbeforeEach(() => {\n\t\t\t\tprovider = {\n\t\t\t\t\tprotocol: 'wamp',\n\t\t\t\t\turi: 'mock.test.provider'\n\t\t\t\t};\n\t\t\t\tparams = [\n\t\t\t\t\ttrue,\n\t\t\t\t\t'something',\n\t\t\t\t\t[1, 2, 3]\n\t\t\t\t];\n\t\t\t\tresult = {\n\t\t\t\t\toutput: 'will be there'\n\t\t\t\t};\n\t\t\t\twampCall = sinon.stub().named('wampCall').returns(Promise.reject('Wrong parameters'));\n\t\t\t\twampCall.withArgs('mock.test.provider', false).returns(Promise.reject(new Error('test error')));\n\t\t\t\twampCall.withArgs('mock.test.provider', true).returns(Promise.resolve(result));\n\t\t\t\tWAMPClient.setMock(wampCall);\n\t\t\t});\n\n\t\t\tafterEach(() => {\n\t\t\t\tWAMPClient.reset();\n\t\t\t});\n\n\t\t\tit('fetches data from a given provider', () =>\n\t\t\t\texpect(() =>\n\t\t\t\t\texpect(getProviderPage, 'when called with', [provider, 'page1', ...params])\n\t\t\t\t\t.then(thunk =>\n\t\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t\t.and('when called with', [dispatch], 'to be fulfilled')\n\t\t\t\t\t),\n\t\t\t\t\t'not to error'\n\t\t\t\t)\n\t\t\t\t.then(() =>\n\t\t\t\t\texpect(dispatch, 'to have calls satisfying', [\n\t\t\t\t\t\t{ args: [{ type: actions.GET_PROVIDER, provider: { uri: 'mock.test.provider' }, page: 'page1' }] },\n\t\t\t\t\t\t{ args: [{ type: STORE_PROVIDER_DATA, page: 'page1', data: result }] },\n\t\t\t\t\t\t{ args: [{ type: actions.GET_PROVIDER_DONE, provider: { uri: 'mock.test.provider' }, page: 'page1' }] }\n\t\t\t\t\t])\n\t\t\t\t)\n\t\t\t);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/actions/fireAction.spec.js",
    "content": "import loadModules from 'unittest/helpers/moduleLoader.js';\nimport expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\n\ndescribe('Fire server action', () => {\n\tlet actions, WAMPClient;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/state/actions/fireAction.js',\n\t\t\t\tmoduleCb: m => { actions = m; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/access/wampClient.js',\n\t\t\t\tmoduleCb: m => { WAMPClient = m.default; }\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\n\tit('has action descriptors', () =>\n\t\texpect(actions, 'to have property', 'FIRE_ACTION')\n\t\t.and('to have property', 'FIRE_ACTION_DONE')\n\t\t.and('to have property', 'FIRE_ACTION_FAILED')\n\t);\n\n\tdescribe('fireAction', () => {\n\t\tlet dispatch, provider, valueData, fireAction;\n\t\tbeforeEach(() => {\n\t\t\tfireAction = actions.fireAction;\n\t\t\tdispatch = sinon.spy().named('dispatch');\n\t\t\tvalueData = {};\n\t\t});\n\n\t\tdescribe('using HTTP', () => {\n\t\t\tlet requestData;\n\t\t\tbeforeEach(() => {\n\t\t\t\tprovider = {\n\t\t\t\t\tprotocol: 'http',\n\t\t\t\t\turi: '/SomeURL',\n\t\t\t\t\tpost: true\n\t\t\t\t};\n\t\t\t\trequestData = Object.assign({}, valueData, {pageName: 'testPage' });\n\t\t\t});\n\n\t\t\tit('creates a thunk that sends a server action off, fires state actions to track it', () => {\n\t\t\t\treturn expect(() => expect(fireAction, 'when called with', [provider, 'testPage', valueData])\n\t\t\t\t.then(thunk =>\n\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t.and('when called with', [dispatch])\n\t\t\t\t),\n\t\t\t\t'with http mocked out', {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '/SomeURL',\n\t\t\t\t\t\tbody: requestData\n\t\t\t\t\t},\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatusCode: 200,\n\t\t\t\t\t\tbody: { result: 'OK' }\n\t\t\t\t\t}\n\t\t\t\t}, 'not to error')\n\t\t\t\t.then(() =>\n\t\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.FIRE_ACTION, provider, pageName: 'testPage' }] },\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.FIRE_ACTION_DONE, provider, pageName: 'testPage' }] }\n\t\t\t\t\t])\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('sends word of unhandled errors', () => {\n\t\t\t\treturn expect(() => expect(fireAction, 'when called with', [provider, 'testPage', valueData])\n\t\t\t\t.then(thunk =>\n\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t.and('when called with', [dispatch])\n\t\t\t\t),\n\t\t\t\t'with http mocked out', {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '/SomeURL',\n\t\t\t\t\t\tbody: requestData\n\t\t\t\t\t},\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatusCode: 404\n\t\t\t\t\t}\n\t\t\t\t}, 'not to error')\n\t\t\t\t.then(() =>\n\t\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.FIRE_ACTION,  provider, pageName: 'testPage' }] },\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.FIRE_ACTION_FAILED, provider, pageName: 'testPage', message: '404 Not Found' }] }\n\t\t\t\t\t])\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('using WAMP', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tprovider = {\n\t\t\t\t\tprotocol: 'wamp',\n\t\t\t\t\turi: 'mock.test.provider'\n\t\t\t\t};\n\t\t\t\tlet wampCall = sinon.stub().named('wampCall').returns(Promise.reject('Wrong parameters'));\n\t\t\t\twampCall.withArgs('mock.test.provider', 'failPage').returns(Promise.reject(new Error('test error')));\n\t\t\t\twampCall.withArgs('mock.test.provider', 'testPage').returns(Promise.resolve({ result: 'OK' }));\n\t\t\t\tWAMPClient.setMock(wampCall);\n\t\t\t\tvalueData = [true, 'test'];\n\t\t\t});\n\n\t\t\tafterEach(() => {\n\t\t\t\tWAMPClient.reset();\n\t\t\t});\n\n\t\t\tit('creates a thunk that sends a server action off, fires state actions to track it', () => {\n\t\t\t\treturn expect(() => expect(fireAction, 'when called with', [provider, 'testPage', ...valueData])\n\t\t\t\t.then(thunk =>\n\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t.and('when called with', [dispatch])\n\t\t\t\t), 'not to error')\n\t\t\t\t.then(() =>\n\t\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.FIRE_ACTION, provider, pageName: 'testPage' }] },\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.FIRE_ACTION_DONE, provider, pageName: 'testPage' }] }\n\t\t\t\t\t])\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('sends word of unhandled errors', () => {\n\t\t\t\treturn expect(() => expect(fireAction, 'when called with', [provider, 'failPage', ...valueData])\n\t\t\t\t.then(thunk =>\n\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t.and('when called with', [dispatch])\n\t\t\t\t), 'not to error')\n\t\t\t\t.then(() =>\n\t\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.FIRE_ACTION,  provider, pageName: 'failPage' }] },\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.FIRE_ACTION_FAILED, provider, pageName: 'failPage', message: 'test error' }] }\n\t\t\t\t\t])\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/actions/loadAndOpen.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport { OPEN_PAGE, SELECT_LOCATION } from 'console/state/reducers/layout.js';\nimport { STORE_OPTION_LIST } from 'console/state/reducers/options.js';\nimport { GET_LOG, GET_LOG_DONE } from 'console/state/actions/logs.js';\nimport Immutable from 'immutable';\n\nlet loadAndOpenPage, loadTabValues;\nbefore(done => {\n\tSystem.import('console/state/actions/loadAndOpen.js')\n\t.then(m => {\n\t\t({ loadAndOpenPage, loadTabValues } = m);\n\t\tdone();\n\t});\n});\n\ndescribe('loadAndOpenPage', () => {\n\tlet store;\n\tbeforeEach(() => {\n\t\tstore = {\n\t\t\tstate: Immutable.fromJS({\n\t\t\t\tpageDefs: {\n\t\t\t\t\ttestpage: {\n\t\t\t\t\t\ttype: 'test',\n\t\t\t\t\t\ttabs: ['tab1', 'tab2'],\n\t\t\t\t\t\ttoolbars: ['toolbar']\n\t\t\t\t\t},\n\t\t\t\t\tshimpage: {\n\t\t\t\t\t\tname: 'shimpage',\n\t\t\t\t\t\tdialog: 'testdialog',\n\t\t\t\t\t\ttype: 'dialogPageShim'\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\ttoolbarDefs: {\n\t\t\t\t\ttoolbar: {\n\t\t\t\t\t\tname: 'toolbar',\n\t\t\t\t\t\titems: ['optionized']\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\titemDefs: {\n\t\t\t\t\toptionized: {\n\t\t\t\t\t\tname: 'optionized',\n\t\t\t\t\t\ttype: 'select',\n\t\t\t\t\t\toptionLoader: 'getLogDates'\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdialogDefs: {\n\t\t\t\t\ttestdialog: {\n\t\t\t\t\t\tname: 'testdialog',\n\t\t\t\t\t\tpanes: [\n\t\t\t\t\t\t\t'testpalette'\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdialogPaneDefs: {\n\t\t\t\t\ttestpalette: {\n\t\t\t\t\t\tname: 'testpalette',\n\t\t\t\t\t\ttype: 'palette',\n\t\t\t\t\t\tcontext: 'testing',\n\t\t\t\t\t\tprovider: 'elementSource'\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tproviderDefs: {\n\t\t\t\t\telementSource: {\n\t\t\t\t\t\tprotocol: 'wamp',\n\t\t\t\t\t\turi: 'mock.provider.test'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t\tgetState: sinon.spy(function () {\n\t\t\t\treturn store.state;\n\t\t\t}).named('getState'),\n\t\t\tdispatch: sinon.stub().named('dispatch').returns(Promise.resolve(true))\n\t\t};\n\t});\n\n\tdescribe('for known page', () => {\n\t\tit('does not fetch definition again, opens page', () =>\n\t\t\texpect(loadAndOpenPage, 'when called with', ['testpage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [store.dispatch, store.getState])\n\t\t\t).then(() =>\n\t\t\t\texpect(store.dispatch, 'to have calls satisfying', [\n\t\t\t\t\t{ args: [{\n\t\t\t\t\t\ttype: OPEN_PAGE,\n\t\t\t\t\t\tpageName: 'testpage',\n\t\t\t\t\t\ttabNames: ['tab1', 'tab2']\n\t\t\t\t\t}] },\n\t\t\t\t\t{ args: [{\n\t\t\t\t\t\ttype: SELECT_LOCATION,\n\t\t\t\t\t\tpage: 'testpage'\n\t\t\t\t\t}] }\n\t\t\t\t])\n\t\t\t)\n\t\t);\n\n\t});\n\n\tdescribe('for unknown page', () => {\n\t\tit('fetches page definitions for the requested page, then opens it', () =>\n\t\t\texpect(loadAndOpenPage, 'when called with', ['newpage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [store.dispatch, store.getState], 'to be rejected')\n\t\t\t).then(() =>\n\t\t\t\texpect(store.dispatch, 'to have calls satisfying', [\n\t\t\t\t\t{ args: [expect.it('to be a function')] }, // Load pageDef\n\t\t\t\t\t{ args: [{ type: 'LAYOUT.OPEN_PAGE', pageName: 'newpage', tabNames: [] }] },\n\t\t\t\t\t{ args: [{ type: 'LAYOUT.SELECT_LOCATION', page: 'newpage' }] }\n\t\t\t\t])\n\t\t\t)\n\t\t);\n\t});\n\n\tdescribe('for log page', () => {\n\t\tit('loads log dates', () => {\n\t\t\tstore.state = store.state.setIn(['pageDefs', 'testpage', 'type'], 'document');\n\t\t\tlet tabState = sinon.stub().named('getState').returns(Immutable.fromJS({\n\t\t\t\ttabDefs: {\n\t\t\t\t\ttab1: {\n\t\t\t\t\t\tname: 'tab1',\n\t\t\t\t\t\ttype: 'log',\n\t\t\t\t\t\tlogURL: '/Composite/console/serverLog.json',\n\t\t\t\t\t\tlogPageName: 'tab1date'\n\t\t\t\t\t},\n\t\t\t\t\ttab2: {}\n\t\t\t\t},\n\t\t\t\toptions: {\n\t\t\t\t\ttab1date: '2016-09-30T00:00:00.000Z'\n\t\t\t\t}\n\t\t\t}));\n\t\t\tlet innerDispatch = sinon.spy().named('innerDispatch');\n\t\t\treturn expect(loadAndOpenPage, 'when called with', ['testpage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [store.dispatch, store.getState])\n\t\t\t).then(() => {\n\t\t\t\treturn expect(store.dispatch, 'to have calls satisfying', [\n\t\t\t\t\t{ args: [{ type: 'LAYOUT.OPEN_PAGE', pageName: 'testpage', tabNames: ['tab1', 'tab2'] }] },\n\t\t\t\t\t{ args: [{ type: 'LAYOUT.SELECT_LOCATION', page: 'testpage' }] },\n\t\t\t\t\t{ args: [ expect.it('to be a function') ]},\n\t\t\t\t\t{ args: [\n\t\t\t\t\t\texpect.it('to be a function')\n\t\t\t\t\t\t.and(\n\t\t\t\t\t\t\t'with http mocked out', {\n\t\t\t\t\t\t\t\trequest: 'GET /Composite/api/Logger/GetDates',\n\t\t\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\t\t\tstatus: 200,\n\t\t\t\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t\t\t\t'9/28/2016',\n\t\t\t\t\t\t\t\t\t\t'9/30/2016',\n\t\t\t\t\t\t\t\t\t\t'10/3/2016'\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'when called with', [innerDispatch, tabState],\n\t\t\t\t\t\t\t'to be fulfilled'\n\t\t\t\t\t\t)\n\t\t\t\t\t] },\n\t\t\t\t\t{ args: [ expect.it('to be a function') ]},\n\t\t\t\t\t{ args: [ expect.it('to be a function') ]}\n\t\t\t\t])\n\t\t\t\t.then(() =>\n\t\t\t\t\texpect(innerDispatch, 'to have a call satisfying', {\n\t\t\t\t\t\targs: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: STORE_OPTION_LIST,\n\t\t\t\t\t\t\t\tfield: 'optionized',\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{ value: '2016-10-03T00:00:00.000Z', label: '10/3/2016' },\n\t\t\t\t\t\t\t\t\t{ value: '2016-09-30T00:00:00.000Z', label: '9/30/2016' },\n\t\t\t\t\t\t\t\t\t{ value: '2016-09-28T00:00:00.000Z', label: '9/28/2016' }\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('for shim page', () => {\n\t\tit('fetches data from the dialog provider', () => {\n\t\t\tlet innerDispatch = sinon.spy().named('innerDispatch');\n\t\t\treturn expect(loadAndOpenPage, 'when called with', ['shimpage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [store.dispatch, store.getState], 'to be fulfilled')\n\t\t\t)\n\t\t\t.then(() =>\n\t\t\t\texpect(store.dispatch, 'to have calls satisfying', [\n\t\t\t\t\t{ args: [{ type: 'LAYOUT.OPEN_PAGE', pageName: 'shimpage', tabNames: [] }] },\n\t\t\t\t\t{ args: [{ type: 'LAYOUT.SELECT_LOCATION', page: 'shimpage' }] },\n\t\t\t\t\t{ args: [\n\t\t\t\t\t\texpect.it('to be a function') // Load provider data\n\t\t\t\t\t\t.and('when called with', [innerDispatch], 'to be fulfilled')\n\t\t\t\t\t] }\n\t\t\t\t])\n\t\t\t)\n\t\t\t.then(() =>\n\t\t\t\texpect(innerDispatch, 'to have calls satisfying', [\n\t\t\t\t\t{ args: [ { type: 'PROVIDER.GET_COMMENCE', provider: { protocol: 'wamp', uri: 'mock.provider.test' }, page: 'testdialog', params: [ '' ] } ]},\n\t\t\t\t\t{ args: [ { type: 'PROVIDER.STORE', providerName: 'mock.provider.test', page: 'testdialog' } ]},\n\t\t\t\t\t{ args: [ { type: 'PROVIDER.GET_DONE', provider: { protocol: 'wamp', uri: 'mock.provider.test' }, page: 'testdialog' } ]}\n\t\t\t\t])\n\t\t\t);\n\t\t});\n\t});\n});\n\ndescribe('loadTabValues', () => {\n\tlet store;\n\tbeforeEach(() => {\n\t\tstore = {\n\t\t\tstate: Immutable.fromJS({\n\t\t\t\ttabDefs: {\n\t\t\t\t\ttestTab: {\n\t\t\t\t\t\tname: 'testTab',\n\t\t\t\t\t\ttype: ''\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\toptions: {\n\t\t\t\t\tvalues: {},\n\t\t\t\t\tlists: {\n\t\t\t\t\t\t'testTab.date': [\n\t\t\t\t\t\t\t{ value: '2016-10-23T00:00:00.000Z' },\n\t\t\t\t\t\t\t{ value: '2016-10-22T00:00:00.000Z' },\n\t\t\t\t\t\t\t{ value: '2016-10-21T00:00:00.000Z' }\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tlogs: {\n\t\t\t\t\ttestTab: {\n\t\t\t\t\t\t'2016-10-22T00:00:00.000Z': ['it', 'exists', 'already']\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t\tgetState: sinon.spy(function () {\n\t\t\t\treturn store.state;\n\t\t\t}).named('getState'),\n\t\t\tdispatch: sinon.stub().named('dispatch').returns(Promise.resolve(true))\n\t\t};\n\t});\n\n\tdescribe('on a form tab', () => {\n\t\tbeforeEach(() => {\n\t\t\tstore.state = store.state.setIn(['tabDefs', 'testTab', 'type'], 'form');\n\t\t});\n\n\t\tit('checks tab type, but does nothing', () =>\n\t\t\texpect(loadTabValues,\n\t\t\t\t'when called with', ['testTab']\n\t\t\t)\n\t\t\t.then(loader =>\n\t\t\t\texpect(loader, 'to be a function')\n\t\t\t\t.and('when called with', [store.dispatch, store.getState])\n\t\t\t).then(() => expect.promise.all([\n\t\t\t\texpect(store.getState, 'was called'),\n\t\t\t\texpect(store.dispatch, 'was not called')\n\t\t\t]))\n\t\t);\n\t});\n\n\tdescribe('on a log tab', () => {\n\t\tlet innerDispatch;\n\t\tbeforeEach(() => {\n\t\t\tstore.state = store.state\n\t\t\t\t.setIn(['tabDefs', 'testTab', 'logPageName'], 'testTab.date')\n\t\t\t\t.setIn(['tabDefs', 'testTab', 'type'], 'log');\n\t\t\tinnerDispatch = sinon.spy().named('innerDispatch');\n\t\t});\n\n\t\tdescribe('without log', () => {\n\t\t\tit('checks tab type, and gets the latest log page', () =>\n\t\t\t\texpect(loadTabValues,\n\t\t\t\t\t'when called with', ['testTab']\n\t\t\t\t)\n\t\t\t\t.then(loader =>\n\t\t\t\t\texpect(loader, 'to be a function')\n\t\t\t\t\t.and('when called with', [store.dispatch, store.getState])\n\t\t\t\t).then(() => expect.promise.all([\n\t\t\t\t\texpect(store.getState, 'was called'),\n\t\t\t\t\texpect(\n\t\t\t\t\t\t() => expect(store.dispatch.firstCall.args[0], 'to be a function')\n\t\t\t\t\t\t.and('when called with', [innerDispatch]),\n\t\t\t\t\t\t'with http mocked out', {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\t\turl: '/Composite/api/Logger/GetData',\n\t\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\t\tDateFrom: '10/23/2016',\n\t\t\t\t\t\t\t\t\tDateTo: '10/24/2016',\n\t\t\t\t\t\t\t\t\tSeverity: 'Verbose',\n\t\t\t\t\t\t\t\t\tAmount: 5000\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\t\tstatusCode: 200,\n\t\t\t\t\t\t\t\tbody: []\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'not to error'\n\t\t\t\t\t)\n\t\t\t\t]))\n\t\t\t\t.then(() =>\n\t\t\t\t\texpect(innerDispatch, 'to have a call satisfying', { args: [{\n\t\t\t\t\t\ttype: GET_LOG,\n\t\t\t\t\t\tlogTabName: 'testTab',\n\t\t\t\t\t\tday: '2016-10-23T00:00:00.000Z'\n\t\t\t\t\t}]})\n\t\t\t\t\t.and('to have a call satisfying', { args: [{\n\t\t\t\t\t\ttype: GET_LOG_DONE,\n\t\t\t\t\t\tlogTabName: 'testTab',\n\t\t\t\t\t\tday: '2016-10-23T00:00:00.000Z'\n\t\t\t\t\t}]})\n\t\t\t\t)\n\t\t\t);\n\t\t});\n\n\t\tdescribe('with existing log', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tstore.state = store.state\n\t\t\t\t\t// Set date selector to the page that already has content\n\t\t\t\t\t.setIn(['options', 'values', 'testTab.date'], '2016-10-22T00:00:00.000Z');\n\t\t\t});\n\n\t\t\tit('checks tab type, and does not fetch log data', () =>\n\t\t\t\texpect(loadTabValues,\n\t\t\t\t\t'when called with', ['testTab']\n\t\t\t\t)\n\t\t\t\t.then(loader =>\n\t\t\t\t\texpect(loader, 'to be a function')\n\t\t\t\t\t.and('when called with', [store.dispatch, store.getState])\n\t\t\t\t).then(() => expect.promise.all([\n\t\t\t\t\texpect(store.getState, 'was called'),\n\t\t\t\t\texpect(store.dispatch, 'was not called')\n\t\t\t\t]))\n\t\t\t);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/actions/logs.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport * as actions from 'console/state/actions/logs.js';\nimport { STORE_OPTION_LIST, SET_OPTION } from 'console/state/reducers/options.js';\nimport { REFRESH_LOG } from 'console/state/reducers/logs.js';\nimport Immutable from 'immutable';\n\ndescribe('Log operations', () => {\n\tit('has action descriptors', () =>\n\texpect(actions, 'to have property', 'GET_LOG_DATES')\n\t\t.and('to have property', 'GET_LOG_DATES_DONE')\n\t\t.and('to have property', 'GET_LOG_DATES_FAILED')\n\t\t.and('to have property', 'GET_LOG')\n\t\t.and('to have property', 'GET_LOG_DONE')\n\t\t.and('to have property', 'GET_LOG_FAILED')\n\t);\n\n\tdescribe('getLogDates', () => {\n\t\tlet dispatch, getLogDates = actions.getLogDates;\n\t\tbeforeEach(() => {\n\t\t\tdispatch = sinon.spy().named('dispatch');\n\t\t});\n\n\t\tit('fetches a list of well-formatted dates', () =>\n\t\t\texpect(\n\t\t\t\t() => expect(getLogDates, 'when called with', ['logDate'])\n\t\t\t\t\t.then(thunk =>\n\t\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t\t.and('when called with', [dispatch, () => Immutable.Map()])\n\t\t\t\t\t),\n\t\t\t\t\t'with http mocked out', {\n\t\t\t\t\t\trequest: 'GET /Composite/api/Logger/GetDates',\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatus: 200,\n\t\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t\t// These duplicate entries wouldn't happen in real usage, but are useful for test coverage\n\t\t\t\t\t\t\t\t'9/30/2016',\n\t\t\t\t\t\t\t\t'9/30/2016',\n\t\t\t\t\t\t\t\t'9/28/2016',\n\t\t\t\t\t\t\t\t'10/3/2016'\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t'not to error'\n\t\t\t\t)\n\t\t\t\t.then(() =>\n\t\t\t\texpect(dispatch, 'to have calls satisfying', [\n\t\t\t\t\t{ args: [{ type: actions.GET_LOG_DATES }]},\n\t\t\t\t\t{\n\t\t\t\t\t\targs: [{\n\t\t\t\t\t\t\ttype: STORE_OPTION_LIST,\n\t\t\t\t\t\t\tfield: 'logDate',\n\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t{ value: '2016-10-03T00:00:00.000Z', label: '10/3/2016' },\n\t\t\t\t\t\t\t\t{ value: '2016-09-30T00:00:00.000Z', label: '9/30/2016' },\n\t\t\t\t\t\t\t\t{ value: '2016-09-30T00:00:00.000Z', label: '9/30/2016' },\n\t\t\t\t\t\t\t\t{ value: '2016-09-28T00:00:00.000Z', label: '9/28/2016' }\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\targs: [{\n\t\t\t\t\t\t\ttype: SET_OPTION,\n\t\t\t\t\t\t\tname: 'logDate',\n\t\t\t\t\t\t\tvalue: '2016-10-03T00:00:00.000Z'\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{ args: [{ type: actions.GET_LOG_DATES_DONE }]},\n\t\t\t\t])\n\t\t\t)\n\t\t);\n\n\t\tit('sends word of unhandled errors', () =>\n\t\t\texpect(() => expect(getLogDates, 'when called with', ['logDate'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [dispatch])\n\t\t\t),\n\t\t\t'with http mocked out', {\n\t\t\t\trequest: 'GET /Composite/api/Logger/GetDates',\n\t\t\t\tresponse: {\n\t\t\t\t\tstatusCode: 404\n\t\t\t\t}\n\t\t\t}, 'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.GET_LOG_DATES }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.GET_LOG_DATES_FAILED, message: '404 Not Found' }] }\n\t\t\t\t])\n\t\t\t)\n\t\t);\n\t});\n\n\tdescribe('getLogPage', () => {\n\t\tlet dispatch, getLogPage = actions.getLogPage;\n\t\tbeforeEach(()=> {\n\t\t\tdispatch = sinon.spy().named('dispatch');\n\t\t});\n\n\t\tit('fetches a page of log entries', () =>\n\t\t\texpect(() =>\n\t\t\t\texpect(getLogPage, 'when called with', ['logDate', '2016-09-29T00:00:00.000Z'])\n\t\t\t\t.then(thunk =>\n\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t.and('when called with', [dispatch])\n\t\t\t\t),\n\t\t\t\t'with http mocked out', {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '/Composite/api/Logger/GetData',\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tDateFrom: '9/29/2016',\n\t\t\t\t\t\t\tDateTo: '9/30/2016',\n\t\t\t\t\t\t\tSeverity: 'Verbose',\n\t\t\t\t\t\t\tAmount: 5000\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatusCode: 200,\n\t\t\t\t\t\tbody: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttimestamp: '2016-09-29 13:25:59.52',\n\t\t\t\t\t\t\t\tmessage: 'System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified   at Composite.Web.Css.Less.ReparsePointUtils.GetSymbolicLinkTarget(DirectoryInfo symlink)\\nat Composite.Web.Css.Less.ReparsePointUtils.GetDirectoryReparsePointTarget(String directoryPath)\\nat Composite.Web.Css.Less.StylesHashing.FileHashCalculator.AddWatchesForSymbolicallyLinkedSubfolders(String folder)',\n\t\t\t\t\t\t\t\ttitle: 'LessCss',\n\t\t\t\t\t\t\t\tseverity: 'Error'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttimestamp: '2016-09-29 12:53:32.50',\n\t\t\t\t\t\t\t\tmessage: 'AppDomain 3 started at 12:53:32:48 in process 9456',\n\t\t\t\t\t\t\t\ttitle: 'ApplicationEventHandler',\n\t\t\t\t\t\t\t\tseverity: 'Information'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttimestamp: '2016-09-29 15:17:38.18',\n\t\t\t\t\t\t\t\tmessage: 'AppDomain 2 unloaded at 12:52:07:04',\n\t\t\t\t\t\t\t\ttitle: 'ApplicationEventHandler',\n\t\t\t\t\t\t\t\tseverity: 'Information'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t'not to error')\n\t\t\t\t.then(() =>\n\t\t\t\texpect(dispatch, 'to have calls satisfying', [\n\t\t\t\t\t{ args: [{ type: actions.GET_LOG, logTabName: 'logDate', day: '2016-09-29T00:00:00.000Z' }] },\n\t\t\t\t\t{\n\t\t\t\t\t\targs: [{\n\t\t\t\t\t\t\ttype: REFRESH_LOG,\n\t\t\t\t\t\t\tlogName: 'logDate',\n\t\t\t\t\t\t\tpage: '2016-09-29T00:00:00.000Z',\n\t\t\t\t\t\t\tentries: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttimestamp: '2016-09-29 13:25:59.52',\n\t\t\t\t\t\t\t\t\tmessage: 'System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified   at Composite.Web.Css.Less.ReparsePointUtils.GetSymbolicLinkTarget(DirectoryInfo symlink)\\nat Composite.Web.Css.Less.ReparsePointUtils.GetDirectoryReparsePointTarget(String directoryPath)\\nat Composite.Web.Css.Less.StylesHashing.FileHashCalculator.AddWatchesForSymbolicallyLinkedSubfolders(String folder)',\n\t\t\t\t\t\t\t\t\ttitle: 'LessCss',\n\t\t\t\t\t\t\t\t\tseverity: 'Error'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttimestamp: '2016-09-29 12:53:32.50',\n\t\t\t\t\t\t\t\t\tmessage: 'AppDomain 3 started at 12:53:32:48 in process 9456',\n\t\t\t\t\t\t\t\t\ttitle: 'ApplicationEventHandler',\n\t\t\t\t\t\t\t\t\tseverity: 'Information'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttimestamp: '2016-09-29 15:17:38.18',\n\t\t\t\t\t\t\t\t\tmessage: 'AppDomain 2 unloaded at 12:52:07:04',\n\t\t\t\t\t\t\t\t\ttitle: 'ApplicationEventHandler',\n\t\t\t\t\t\t\t\t\tseverity: 'Information'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\t{ args: [{ type: actions.GET_LOG_DONE, logTabName: 'logDate', day: '2016-09-29T00:00:00.000Z' }] }\n\t\t\t\t])\n\t\t\t)\n\t\t);\n\n\t\tit('sends word of unhandled errors', () =>\n\t\t\texpect(() => expect(getLogPage, 'when called with', ['logDate', '2016-09-29T00:00:00.000Z'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [dispatch])\n\t\t\t),\n\t\t\t'with http mocked out', {\n\t\t\t\trequest: {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\turl: '/Composite/api/Logger/GetData',\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tDateFrom: '9/29/2016',\n\t\t\t\t\t\tDateTo: '9/30/2016',\n\t\t\t\t\t\tSeverity: 'Verbose',\n\t\t\t\t\t\tAmount: 5000\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tresponse: {\n\t\t\t\t\tstatusCode: 404\n\t\t\t\t}\n\t\t\t}, 'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.GET_LOG }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.GET_LOG_FAILED, message: '404 Not Found' }] }\n\t\t\t\t])\n\t\t\t)\n\t\t);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/actions/pageDefs.spec.js",
    "content": "import loadModules from 'unittest/helpers/moduleLoader.js';\nimport expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\n\ndescribe('Get page definitions', () => {\n\tlet STORE_DEF, WAMPClient, actions;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/state/reducers/definitions.js',\n\t\t\t\tmoduleCb: m => { STORE_DEF = m.STORE_DEF; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/state/actions/pageDefs.js',\n\t\t\t\tmoduleCb: m => { actions = m; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/access/wampClient.js',\n\t\t\t\tmoduleCb: m => { WAMPClient = m.default; }\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tit('has action descriptors', () =>\n\t\texpect(actions, 'to have property', 'LOAD_PAGE_DEF')\n\t\t.and('to have property', 'LOAD_PAGE_DEF_DONE')\n\t\t.and('to have property', 'LOAD_PAGE_DEF_FAILED')\n\t);\n\n\tdescribe('loadPageDef', () => {\n\t\tlet dispatch, wampCall, loadPageDef;\n\t\tbeforeEach(() => {\n\t\t\tloadPageDef = actions.loadPageDef;\n\t\t\tdispatch = sinon.spy().named('dispatch');\n\t\t\tlet rawPageDef = {\n\t\t\t\tname: 'testPage',\n\t\t\t\ttype: 'test',\n\t\t\t\ttabs: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'testTab',\n\t\t\t\t\t\tfieldsets: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'testFieldSet',\n\t\t\t\t\t\t\t\tlabel: 'A test',\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'testDataField',\n\t\t\t\t\t\t\t\t\t\tlabel: 'A field'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\ttoolbars: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'testToolbar',\n\t\t\t\t\t\titems: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'testButton',\n\t\t\t\t\t\t\t\tlabel: 'Test it'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t};\n\t\t\twampCall = sinon.stub().named('wampCall').returns(Promise.reject('Wrong parameters'));\n\t\t\twampCall.withArgs('structure.page', 'failPage').returns(Promise.reject(new Error('test error')));\n\t\t\twampCall.withArgs('structure.page', 'testPage').returns(Promise.resolve(rawPageDef));\n\t\t\tWAMPClient.setMock(wampCall);\n\t\t});\n\n\t\tafterEach(() => {\n\t\t\tWAMPClient.reset();\n\t\t});\n\n\t\tit('creates a thunk that loads definitions and dispatches actions', () => {\n\t\t\treturn expect(() => expect(loadPageDef, 'when called with', ['testPage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [dispatch])\n\t\t\t),\n\t\t\t'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.LOAD_PAGE_DEF, name: 'testPage' }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: STORE_DEF, defType: 'page', definition: {\n\t\t\t\t\t\tname: 'testPage',\n\t\t\t\t\t\ttabs: ['testTab'],\n\t\t\t\t\t\ttoolbars: ['testToolbar'],\n\t\t\t\t\t\ttype: 'test'\n\t\t\t\t\t}}]},\n\t\t\t\t\t{ spy: dispatch, args: [{ type: STORE_DEF, defType: 'tab', definition: {\n\t\t\t\t\t\tname: 'testTab',\n\t\t\t\t\t\tfieldsets: ['testFieldSet']\n\t\t\t\t\t}}]},\n\t\t\t\t\t{ spy: dispatch, args: [{ type: STORE_DEF, defType: 'fieldset', definition: {\n\t\t\t\t\t\tname: 'testFieldSet',\n\t\t\t\t\t\tlabel: 'A test',\n\t\t\t\t\t\tfields: ['testDataField']\n\t\t\t\t\t}}]},\n\t\t\t\t\t{ spy: dispatch, args: [{ type: STORE_DEF, defType: 'dataField', definition: {\n\t\t\t\t\t\tname: 'testDataField',\n\t\t\t\t\t\tlabel: 'A field'\n\t\t\t\t\t}}]},\n\t\t\t\t\t{ spy: dispatch, args: [{ type: STORE_DEF, defType: 'toolbar', definition: {\n\t\t\t\t\t\tname: 'testToolbar',\n\t\t\t\t\t\titems: ['testButton']\n\t\t\t\t\t}}]},\n\t\t\t\t\t{ spy: dispatch, args: [{ type: STORE_DEF, defType: 'item', definition: {\n\t\t\t\t\t\tname: 'testButton',\n\t\t\t\t\t\tlabel: 'Test it'\n\t\t\t\t\t}}]},\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.LOAD_PAGE_DEF_DONE, name: 'testPage' }] }\n\t\t\t\t])\n\t\t\t);\n\t\t});\n\n\t\tit('sends word of unhandled errors', () => {\n\t\t\treturn expect(() => expect(loadPageDef, 'when called with', ['failPage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [dispatch])\n\t\t\t),\n\t\t\t'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.LOAD_PAGE_DEF, name: 'failPage' }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.LOAD_PAGE_DEF_FAILED, message: 'test error' }] }\n\t\t\t\t])\n\t\t\t);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/actions/values.spec.js",
    "content": "import loadModules from 'unittest/helpers/moduleLoader.js';\nimport expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport Immutable from 'immutable';\n\ndescribe('Load/save values', () => {\n\tlet STORE_VALUES, COMMIT_PAGE, WAMPClient, actions;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/state/reducers/dataFields.js',\n\t\t\t\tmoduleCb: m => { ({ STORE_VALUES, COMMIT_PAGE } = m); }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/state/actions/values.js',\n\t\t\t\tmoduleCb: m => { actions = m; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/access/wampClient.js',\n\t\t\t\tmoduleCb: m => { WAMPClient = m.default; }\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tafterEach(() => {\n\t\tWAMPClient.reset();\n\t});\n\n\tit('has action descriptors', () =>\n\t\texpect(actions, 'to have property', 'LOAD_VALUES')\n\t\t.and('to have property', 'LOAD_VALUES_DONE')\n\t\t.and('to have property', 'LOAD_VALUES_FAILED')\n\t\t.and('to have property', 'SAVE_VALUES')\n\t\t.and('to have property', 'SAVE_VALUES_DONE')\n\t\t.and('to have property', 'SAVE_VALUES_FAILED')\n\t);\n\n\tdescribe('loadValues', () => {\n\t\tlet dispatch, rawValues, loadValues, wampCall;\n\t\tbeforeEach(() => {\n\t\t\tloadValues = actions.loadValues;\n\t\t\tdispatch = sinon.spy().named('dispatch');\n\t\t\trawValues = {\n\t\t\t\tfield1: 10,\n\t\t\t\tfield2: 'foo',\n\t\t\t\tfield3: []\n\t\t\t};\n\t\t\twampCall = sinon.stub().named('wampCall').returns(Promise.reject('Wrong parameters'));\n\t\t\twampCall.withArgs('mock.data.values.load', 'failpage').returns(Promise.reject(new Error('test error')));\n\t\t\twampCall.withArgs('mock.data.values.load', 'testpage').returns(Promise.resolve(rawValues));\n\t\t\tWAMPClient.setMock(wampCall);\n\t\t});\n\n\t\tit('creates a thunk that loads values and dispatches actions', () => {\n\t\t\treturn expect(() => expect(loadValues, 'when called with', ['testpage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [dispatch])\n\t\t\t),\n\t\t\t'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.LOAD_VALUES, pageName: 'testpage' }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: STORE_VALUES, values: expect.it('to equal', rawValues) }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.LOAD_VALUES_DONE, pageName: 'testpage' }] }\n\t\t\t\t])\n\t\t\t);\n\t\t});\n\n\t\tit('sends word of unhandled errors', () => {\n\t\t\treturn expect(() => expect(loadValues, 'when called with', ['failpage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [dispatch])\n\t\t\t),\n\t\t\t'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.LOAD_VALUES, pageName: 'failpage' }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.LOAD_VALUES_FAILED, message: 'test error' }] }\n\t\t\t\t])\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('saveValues', () => {\n\t\tlet saveValues, dispatch, rawState, getState, valueData, wampCall;\n\t\tbeforeEach(() => {\n\t\t\tsaveValues = actions.saveValues;\n\t\t\tdispatch = sinon.spy().named('dispatch');\n\t\t\tvalueData = {\n\t\t\t\tfield1: 10,\n\t\t\t\tfield2: 'foo',\n\t\t\t\tfield3: [],\n\t\t\t\tfield4: 'no',\n\t\t\t\tfield5: false\n\t\t\t};\n\t\t\trawState = Immutable.fromJS({\n\t\t\t\tdataFields: {\n\t\t\t\t\ttestpage: {\n\t\t\t\t\t\tfield1: 10,\n\t\t\t\t\t\tfield2: 'foo',\n\t\t\t\t\t\tfield3: [],\n\t\t\t\t\t\tfield4: 'no',\n\t\t\t\t\t\tfield5: false\n\t\t\t\t\t},\n\t\t\t\t\tfailpage: {},\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\ttestpage: {\n\t\t\t\t\t\t\tfield1: 12,\n\t\t\t\t\t\t\tfield2: 'foo',\n\t\t\t\t\t\t\tfield3: ['things'],\n\t\t\t\t\t\t\tfield4: 'yes',\n\t\t\t\t\t\t\tfield5: false\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tgetState = sinon.stub().named('getState').returns(rawState);\n\t\t\twampCall = sinon.stub().named('wampCall').returns(Promise.reject('Wrong parameters'));\n\t\t\twampCall.withArgs('mock.data.values.save', 'failpage').returns(Promise.reject(new Error('test error')));\n\t\t\twampCall.withArgs('mock.data.values.save', 'testpage', valueData).returns(Promise.resolve());\n\t\t\tWAMPClient.setMock(wampCall);\n\t\t});\n\n\t\tit('creates a thunk that saves a page\\'s dirty fields and dispatches actions', () => {\n\t\t\treturn expect(() =>\n\t\t\t\texpect(saveValues, 'when called with', ['testpage'])\n\t\t\t\t.then(thunk =>\n\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t.and('when called with', [dispatch, getState])\n\t\t\t\t),\n\t\t\t'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.SAVE_VALUES, pageName: 'testpage' }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: COMMIT_PAGE, pageName: 'testpage' }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.SAVE_VALUES_DONE, pageName: 'testpage' }] }\n\t\t\t\t])\n\t\t\t);\n\t\t});\n\n\t\tit('aborts if there are no dirty fields for the page', () => {\n\t\t\tgetState.returns(\n\t\t\t\trawState.setIn(['dataFields', 'testpage'],\n\t\t\t\t\trawState.getIn(['dataFields', 'committedPages', 'testpage'])\n\t\t\t\t)\n\t\t\t);\n\t\t\treturn expect(() =>\n\t\t\t\texpect(saveValues, 'when called with', ['testpage'])\n\t\t\t\t.then(thunk =>\n\t\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t\t.and('when called with', [dispatch, getState])\n\t\t\t\t),'not to error')\n\t\t\t\t.then(() =>\n\t\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.SAVE_VALUES, pageName: 'testpage' }] },\n\t\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.SAVE_VALUES_FAILED, message: 'Page testpage is unchanged' }] }\n\t\t\t\t\t])\n\t\t\t\t);\n\t\t});\n\n\t\tit('sends word of unhandled errors, and reverts cleared dirty flags', () => {\n\t\t\treturn expect(() => expect(saveValues, 'when called with', ['failpage'])\n\t\t\t.then(thunk =>\n\t\t\t\texpect(thunk, 'to be a function')\n\t\t\t\t.and('when called with', [dispatch, getState])\n\t\t\t),\n\t\t\t'not to error')\n\t\t\t.then(() =>\n\t\t\t\texpect([dispatch], 'to have calls satisfying', [\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.SAVE_VALUES, pageName: 'failpage' }] },\n\t\t\t\t\t{ spy: dispatch, args: [{ type: actions.SAVE_VALUES_FAILED, message: 'test error' }] }\n\t\t\t\t])\n\t\t\t);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/initState.spec.js",
    "content": "import loadModules from 'unittest/helpers/moduleLoader.js';\nimport expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\n\ndescribe('initState', () => {\n\tlet initState;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/state/initState.js',\n\t\t\t\tmoduleCb: m => { initState = m.default; }\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tlet store;\n\tbeforeEach(() => {\n\t\tstore = {\n\t\t\tdispatch: sinon.spy().named('dispatch')\n\t\t};\n\t});\n\n\tit('loads definitions, sets page list, the shown page', () =>\n\t\texpect(initState, 'when called with', [store], 'to be undefined')\n\t\t.then(() =>\n\t\t\texpect(store.dispatch, 'to have calls satisfying', [\n\t\t\t\t{ spy: store.dispatch, args: [expect.it('to be a function')]}\n\t\t\t])\n\t\t)\n\t);\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/observers.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport { subscribe, unsubscribe, stateChange } from 'console/state/observers.js';\nimport Immutable from 'immutable';\nimport sinon from 'sinon';\n\ndescribe('State observation', () => {\n\tlet oldState, newState, handler, path;\n\tbeforeEach(() => {\n\t\tpath = ['we', 'have', 'to', 'go', 'deeper'];\n\t\toldState = Immutable.fromJS({\n\t\t\twe: {\n\t\t\t\thave: {\n\t\t\t\t\tto: {\n\t\t\t\t\t\tgo: {\n\t\t\t\t\t\t\tdeeper: true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tnewState = oldState.setIn(path, false);\n\t\thandler = sinon.spy().named('handler');\n\t});\n\n\tit('can subscribe and unsubscribe to state changes', () =>\n\t\texpect(subscribe, 'when called with', [path, handler])\n\t\t.then(() =>\n\t\t\texpect(stateChange, 'when called with', [oldState, newState])\n\t\t).then(() =>\n\t\t\texpect(handler, 'was called times', 1)\n\t\t).then(() =>\n\t\t\texpect(unsubscribe, 'when called with', [path, handler])\n\t\t).then(() =>\n\t\t\texpect(stateChange, 'when called with', [newState, oldState])\n\t\t).then(() =>\n\t\t\texpect(handler, 'was called times', 1)\n\t\t)\n\t);\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/reducers/activity.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport activity from 'console/state/reducers/activity.js';\nimport Immutable from 'immutable';\n\ndescribe('Activity', () => {\n\tdescribe('reducer', () => {\n\t\tit('outputs an intial state if no action and no previous state', () => {\n\t\t\tlet newState = activity(undefined, {});\n\t\t\treturn expect(newState, 'to equal', Immutable.fromJS({}));\n\t\t});\n\n\t\tit('outputs the same state object if no action', () => {\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch' });\n\t\t\tlet newState = activity(oldState, {});\n\t\t\treturn expect(newState, 'to be', oldState);\n\t\t});\n\n\t\tit('sets activity flag when load action begins', () => {\n\t\t\tlet action = { type: 'FAKE_ACTION_COMMENCE' };\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch' });\n\t\t\tlet newState = activity(oldState, action);\n\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t.and('to satisfy', {\n\t\t\t\tthing: 'do not touch',\n\t\t\t\tFAKE_ACTION: 1\n\t\t\t});\n\t\t});\n\n\t\tit('clears activity flag when load action done', () => {\n\t\t\tlet action = { type: 'FAKE_ACTION_DONE' };\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch', FAKE_ACTION: 1 });\n\t\t\tlet newState = activity(oldState, action);\n\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t.and('to satisfy', {\n\t\t\t\tthing: 'do not touch',\n\t\t\t\tFAKE_ACTION: 0\n\t\t\t});\n\t\t});\n\n\t\tit('clears activity flag when load action failed', () => {\n\t\t\tlet action = { type: 'FAKE_ACTION_FAILED' };\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch', FAKE_ACTION: 1 });\n\t\t\tlet newState = activity(oldState, action);\n\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t.and('to satisfy', {\n\t\t\t\tthing: 'do not touch',\n\t\t\t\tFAKE_ACTION: 0\n\t\t\t});\n\t\t});\n\n\t\tit('respects already cleared flags', () => {\n\t\t\tlet action = { type: 'FAKE_ACTION_DONE' };\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch', FAKE_ACTION: 0 });\n\t\t\tlet newState = activity(oldState, action);\n\t\t\treturn expect(newState, 'to be', oldState);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/reducers/dataFields.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport dataFields, * as actions from 'console/state/reducers/dataFields.js';\nimport Immutable from 'immutable';\n\ndescribe('Data fields', () => {\n\tdescribe('actions', () => {\n\t\tit('has action descriptors', () =>\n\t\t\texpect(actions, 'to have property', 'COMMIT_PAGE')\n\t\t\t.and('to have property', 'ROLLBACK_PAGE')\n\t\t\t.and('to have property', 'UPDATE_VALUE')\n\t\t\t.and('to have property', 'STORE_VALUES')\n\t\t);\n\n\t\tdescribe('Commit page', () => {\n\t\t\tlet commitPage = actions.commitPage;\n\t\t\tit('creates action for committing an edited page', () => {\n\t\t\t\tlet action = commitPage('testpage');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.COMMIT_PAGE)\n\t\t\t\t\t.and('to have property', 'pageName', 'testpage');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Rollback page', () => {\n\t\t\tlet rollbackPage = actions.rollbackPage;\n\t\t\tit('creates action for committing an edited page', () => {\n\t\t\t\tlet action = rollbackPage('testpage', Immutable.fromJS({ field1: 'One', field2: 'Two' }));\n\t\t\t\treturn expect(action, 'to be an action of type', actions.ROLLBACK_PAGE)\n\t\t\t\t\t.and('to have property', 'pageName', 'testpage')\n\t\t\t\t\t.and('to have property', 'values', Immutable.fromJS({ field1: 'One', field2: 'Two' }));\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Update field value', () => {\n\t\t\tlet updateFieldValue = actions.updateFieldValue;\n\t\t\tit('creates action for updating a field value', () => {\n\t\t\t\tlet action = updateFieldValue('testpage', 'testfield', 'testvalue');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.UPDATE_VALUE)\n\t\t\t\t.and('to have properties', {\n\t\t\t\t\tpageName: 'testpage',\n\t\t\t\t\tfieldName: 'testfield',\n\t\t\t\t\tnewValue: 'testvalue'\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Store value set', () => {\n\t\t\tlet storeValues = actions.storeValues;\n\t\t\tit('creates action for storing multiple values on a page', () => {\n\t\t\t\tlet action = storeValues('testpage', { a: 1, b: true, c: 'foo', d: { bar: 'baz' } });\n\t\t\t\treturn expect(action, 'to be an action of type', actions.STORE_VALUES)\n\t\t\t\t.and('to have properties', {\n\t\t\t\t\tpageName: 'testpage',\n\t\t\t\t\tvalues: { a: 1, b: true, c: 'foo', d: { bar: 'baz' } }\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('reducer', () => {\n\t\tit('outputs an intial state if no action and no previous state', () => {\n\t\t\tlet newState = dataFields(undefined, {});\n\t\t\treturn expect(newState, 'to equal', Immutable.fromJS({ committedPages: {} }));\n\t\t});\n\n\t\tit('outputs the same state object if no action', () => {\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch' });\n\t\t\tlet newState = dataFields(oldState, {});\n\t\t\treturn expect(newState, 'to be', oldState);\n\t\t});\n\n\t\tdescribe('commit page', () => {\n\t\t\tlet action;\n\t\t\tbeforeEach(() => {\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.COMMIT_PAGE,\n\t\t\t\t\tpageName: 'testpage'\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tit('Commits a page', () => {\n\t\t\t\tlet oldState = Immutable.fromJS({\n\t\t\t\t\ttestpage: { field1: true, field2: 'stuff' },\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\ttestpage: { field1: false, field2: 'nonsense' }\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tlet newState = dataFields(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\ttestpage: { field1: true, field2: 'stuff' },\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\ttestpage: { field1: true, field2: 'stuff' }\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t});\n\t\t});\n\n\t\tdescribe('rollback page', () => {\n\t\t\tlet action;\n\t\t\tbeforeEach(() => {\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.ROLLBACK_PAGE,\n\t\t\t\t\tpageName: 'testpage'\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tit('Rolls back a page', () => {\n\t\t\t\tlet oldState = Immutable.fromJS({\n\t\t\t\t\ttestpage: { field1: true, field2: 'stuff' },\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\ttestpage: { field1: false, field2: 'nonsense' }\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tlet newState = dataFields(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\ttestpage: { field1: false, field2: 'nonsense' },\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\ttestpage: { field1: false, field2: 'nonsense' }\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t});\n\n\t\t\tit('Rolls back a page even if already committed', () => {\n\t\t\t\taction.values = Immutable.fromJS({ field1: false, field2: 'nonsense' });\n\t\t\t\tlet oldState = Immutable.fromJS({\n\t\t\t\t\ttestpage: { field1: true, field2: 'stuff' },\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\ttestpage: { field1: false, field2: 'stuff' }\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tlet newState = dataFields(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\ttestpage: { field1: false, field2: 'nonsense' },\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\ttestpage: { field1: false, field2: 'nonsense' }\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t});\n\t\t});\n\n\t\tdescribe('update value', () => {\n\t\t\tlet action;\n\t\t\tbeforeEach(() => {\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.UPDATE_VALUE,\n\t\t\t\t\tpageName: 'testpage',\n\t\t\t\t\tfieldName: 'testfield',\n\t\t\t\t\tnewValue: 'testvalue'\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tit('updates a field value on an unknown page', () => {\n\t\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch', committedPages: {} });\n\t\t\t\tlet newState = dataFields(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\tthing: 'do not touch',\n\t\t\t\t\ttestpage: { testfield: 'testvalue' },\n\t\t\t\t\tcommittedPages: { testpage: {} }\n\t\t\t\t}));\n\t\t\t});\n\n\t\t\tit('updates a field value on a known page', () => {\n\t\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch', testpage: {}, committedPages: { testpage: {}} });\n\t\t\t\tlet newState = dataFields(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\tthing: 'do not touch',\n\t\t\t\t\ttestpage: { testfield: 'testvalue' },\n\t\t\t\t\tcommittedPages: { testpage: {} }\n\t\t\t\t}));\n\t\t\t});\n\t\t});\n\n\t\tdescribe('store', () => {\n\t\t\tlet action;\n\t\t\tbeforeEach(() => {\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.STORE_VALUES,\n\t\t\t\t\tpageName: 'page1',\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\tfield1: 202\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tit('stores the passed values in state and resets dirty fields and pages', () => {\n\t\t\t\tlet oldState = Immutable.fromJS({\n\t\t\t\t\tpage1: {\n\t\t\t\t\t\tfield1: 0\n\t\t\t\t\t},\n\t\t\t\t\tpage2: {\n\t\t\t\t\t\tfield2: 'no',\n\t\t\t\t\t\tfield3: false\n\t\t\t\t\t},\n\t\t\t\t\tpage3: {\n\t\t\t\t\t\tfield4: ''\n\t\t\t\t\t},\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\tpage1: {\n\t\t\t\t\t\t\tfield1: 3\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpage2: {\n\t\t\t\t\t\t\tfield2: 'yes',\n\t\t\t\t\t\t\tfield3: true\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpage3: {\n\t\t\t\t\t\t\tfield4: 'something'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tlet newState = dataFields(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\tpage1: {\n\t\t\t\t\t\tfield1: 202\n\t\t\t\t\t},\n\t\t\t\t\tpage2: {\n\t\t\t\t\t\tfield2: 'no',\n\t\t\t\t\t\tfield3: false\n\t\t\t\t\t},\n\t\t\t\t\tpage3: {\n\t\t\t\t\t\tfield4: ''\n\t\t\t\t\t},\n\t\t\t\t\tcommittedPages: {\n\t\t\t\t\t\tpage1: {\n\t\t\t\t\t\t\tfield1: 202\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpage2: {\n\t\t\t\t\t\t\tfield2: 'yes',\n\t\t\t\t\t\t\tfield3: true\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpage3: {\n\t\t\t\t\t\t\tfield4: 'something'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/reducers/definitions.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport getDefinitionReducer, * as actions from 'console/state/reducers/definitions.js';\nimport Immutable from 'immutable';\n\ndescribe('Component definitions', () => {\n\tit('has action descriptors', () =>\n\t\texpect(actions, 'to have property', 'STORE_DEF', 'DEFINITIONS.STORE')\n\t);\n\n\tdescribe('addDefinition', () => {\n\t\tlet addDefinition, pageDef;\n\t\tbeforeEach(() => {\n\t\t\taddDefinition = actions.addDefinition;\n\t\t\tpageDef = {\n\t\t\t\tname: 'testPage',\n\t\t\t\ttype: 'TestComponent',\n\t\t\t\tfieldsets: [],\n\t\t\t\tbuttons: []\n\t\t\t};\n\t\t});\n\n\t\tit('is an action creator', () =>\n\t\t\texpect(addDefinition, 'to be a function')\n\t\t\t.then(() => {\n\t\t\t\tlet action = addDefinition('page', pageDef);\n\t\t\t\treturn expect(action, 'to be an action of type', actions.STORE_DEF)\n\t\t\t\t.and('to have property', 'defType', 'page')\n\t\t\t\t.and('to have property', 'definition', pageDef);\n\t\t\t})\n\t\t);\n\t});\n\n\t['page', 'tab', 'button', 'fieldset', 'dataField'].forEach(typeName => {\n\t\tdescribe(typeName, () => {\n\t\t\tlet reducer;\n\t\t\tbeforeEach(() => {\n\t\t\t\treducer = getDefinitionReducer(typeName);\n\t\t\t});\n\n\t\t\tit('outputs an intial state if no action and no previous state', () => {\n\t\t\t\tlet newState = reducer(undefined, {});\n\t\t\t\treturn expect(newState, 'to equal', Immutable.Map());\n\t\t\t});\n\n\t\t\tit('outputs the same state object if no action', () => {\n\t\t\t\tlet oldState = Immutable.Map({ thing: 'do not touch' });\n\t\t\t\tlet newState = reducer(oldState, {});\n\t\t\t\treturn expect(newState, 'to be', oldState);\n\t\t\t});\n\n\t\t\tit('updates state when given update action', () => {\n\t\t\t\tlet oldState = Immutable.Map({ thing: 'do not touch' });\n\t\t\t\tlet newState = reducer(oldState, {\n\t\t\t\t\ttype: actions.STORE_DEF,\n\t\t\t\t\tdefType: typeName,\n\t\t\t\t\tdefinition: {\n\t\t\t\t\t\tname: 'testEntity'\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\tthing: 'do not touch',\n\t\t\t\t\ttestEntity: {\n\t\t\t\t\t\tname: 'testEntity'\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/reducers/dialog.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport dialog, * as actions from 'console/state/reducers/dialog.js';\nimport Immutable from 'immutable';\n\ndescribe('Dialogs', () => {\n\tdescribe('actions', () => {\n\t\tit('has action descriptors', () =>\n\t\t\texpect(actions, 'to have property', 'SET_DIALOG_STATE')\n\t\t);\n\n\t\tdescribe('Set state', () => {\n\t\t\tlet setDialogState = actions.setDialogState;\n\t\t\tit('creates an action to set the state of a dialog', () => {\n\t\t\t\tlet data = { stuff: true, otherStuff: false };\n\t\t\t\tlet action = setDialogState('testdialog', data);\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SET_DIALOG_STATE)\n\t\t\t\t.and('to have property', 'dialogName', 'testdialog')\n\t\t\t\t.and('to have property', 'data', data);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('reducer', () => {\n\t\tit('outputs an intial state if no action and no previous state', () => {\n\t\t\tlet newState = dialog(undefined, {});\n\t\t\treturn expect(newState, 'to equal', Immutable.fromJS({}));\n\t\t});\n\n\t\tit('outputs the same state object if no action', () => {\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch' });\n\t\t\tlet newState = dialog(oldState, {});\n\t\t\treturn expect(newState, 'to be', oldState);\n\t\t});\n\n\t\tdescribe('set dialog state', () => {\n\t\t\tlet action;\n\t\t\tbeforeEach(() => {\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.SET_DIALOG_STATE,\n\t\t\t\t\tdialogName: 'testdialog',\n\t\t\t\t\tdata: { stuff: true, otherStuff: false }\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tit('sets the state for a dialog', () => {\n\t\t\t\tlet oldState = Immutable.fromJS({\n\t\t\t\t\tunrelated: 'should not be altered'\n\t\t\t\t});\n\t\t\t\tlet newState = dialog(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to satisfy', {\n\t\t\t\t\tunrelated: 'should not be altered',\n\t\t\t\t\ttestdialog: { stuff: true, otherStuff: false }\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/reducers/layout.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport layout, * as actions from 'console/state/reducers/layout.js';\nimport Immutable from 'immutable';\n\ndescribe('Layout', () => {\n\tdescribe('actions', () => {\n\t\tit('has action descriptors', () =>\n\t\t\texpect(actions, 'to have property', 'SELECT_LOCATION')\n\t\t\t.and('to have property', 'OPEN_PAGE')\n\t\t\t.and('to have property', 'CLOSE_PAGE')\n\t\t);\n\n\t\tdescribe('setPerspective', () => {\n\t\t\tlet setPerspective = actions.setPerspective;\n\t\t\tit('creates action for setting the current perspective', () => {\n\t\t\t\tlet action = setPerspective('content');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'perspective', 'content')\n\t\t\t\t\t.and('to only have keys', ['type', 'perspective']);\n\t\t\t});\n\t\t\tit('creates action for setting the current perspective and page', () => {\n\t\t\t\tlet action = setPerspective('content', 'frontpage');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'perspective', 'content')\n\t\t\t\t\t.and('to have property', 'page', 'frontpage')\n\t\t\t\t\t.and('to only have keys', ['type', 'perspective', 'page']);\n\t\t\t});\n\t\t\tit('creates action for setting the current perspective, page and tab', () => {\n\t\t\t\tlet action = setPerspective('content', 'frontpage', 'preview');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'perspective', 'content')\n\t\t\t\t\t.and('to have property', 'page', 'frontpage')\n\t\t\t\t\t.and('to have property', 'tab', 'preview')\n\t\t\t\t\t.and('to only have keys', ['type', 'perspective', 'page', 'tab']);\n\t\t\t});\n\t\t\tit('creates action for setting the current perspective, page, tab and preview location', () => {\n\t\t\t\tlet action = setPerspective('content', 'frontpage', 'preview', 'frontpagePreview');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'perspective', 'content')\n\t\t\t\t\t.and('to have property', 'page', 'frontpage')\n\t\t\t\t\t.and('to have property', 'tab', 'preview')\n\t\t\t\t\t.and('to have property', 'preview', 'frontpagePreview')\n\t\t\t\t\t.and('to only have keys', ['type', 'perspective', 'page', 'tab', 'preview']);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('setPage', () => {\n\t\t\tlet setPage = actions.setPage;\n\t\t\tit('creates action for setting the current page', () => {\n\t\t\t\tlet action = setPage('frontpage');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'page', 'frontpage')\n\t\t\t\t\t.and('to only have keys', ['type', 'page']);\n\t\t\t});\n\t\t\tit('creates action for setting the current page and tab', () => {\n\t\t\t\tlet action = setPage('frontpage', 'preview');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'page', 'frontpage')\n\t\t\t\t\t.and('to have property', 'tab', 'preview')\n\t\t\t\t\t.and('to only have keys', ['type', 'page', 'tab']);\n\t\t\t});\n\t\t\tit('creates action for setting the current page, tab and preview location', () => {\n\t\t\t\tlet action = setPage('frontpage', 'preview', 'frontpagePreview');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'page', 'frontpage')\n\t\t\t\t\t.and('to have property', 'tab', 'preview')\n\t\t\t\t\t.and('to have property', 'preview', 'frontpagePreview')\n\t\t\t\t\t.and('to only have keys', ['type', 'page', 'tab', 'preview']);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('setTab', () => {\n\t\t\tlet setTab = actions.setTab;\n\t\t\tit('creates action for setting the current tab', () => {\n\t\t\t\tlet action = setTab('preview');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'tab', 'preview')\n\t\t\t\t\t.and('to only have keys', ['type', 'tab']);\n\t\t\t});\n\t\t\tit('creates action for setting the current tab and preview location', () => {\n\t\t\t\tlet action = setTab('preview', 'frontpagePreview');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'tab', 'preview')\n\t\t\t\t\t.and('to have property', 'preview', 'frontpagePreview')\n\t\t\t\t\t.and('to only have keys', ['type', 'tab', 'preview']);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('setPreview', () => {\n\t\t\tlet setPreview = actions.setPreview;\n\t\t\tit('creates action for setting the current preview location', () => {\n\t\t\t\tlet action = setPreview('frontpagePreview');\n\t\t\t\treturn expect(action, 'to be an action of type', actions.SELECT_LOCATION)\n\t\t\t\t\t.and('to have property', 'preview', 'frontpagePreview')\n\t\t\t\t\t.and('to only have keys', ['type', 'preview']);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('openPage', () => {\n\t\t\tlet openPage = actions.openPage;\n\t\t\tit('creates action for opening a page and populating its tab list', () => {\n\t\t\t\tlet action = openPage('frontpage', ['settings', 'content', 'preview']);\n\t\t\t\treturn expect(action, 'to be an action of type', actions.OPEN_PAGE)\n\t\t\t\t.and('to have property', 'pageName', 'frontpage')\n\t\t\t\t.and('to have property', 'tabNames', ['settings', 'content', 'preview']);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('reducer', () => {\n\t\t// This is safe, as it's a const immutable\n\t\tconst initialState = Immutable.Map({\n\t\t\tcurrentPerspective: 'system',\n\t\t\tperspectives: Immutable.OrderedMap({\n\t\t\t\tcontent: Immutable.Map({\n\t\t\t\t\tcurrentPage: 'browser',\n\t\t\t\t\tpages: Immutable.OrderedMap({\n\t\t\t\t\t\tbrowser: Immutable.Map(),\n\t\t\t\t\t\tfrontpage: Immutable.Map({\n\t\t\t\t\t\t\tcurrentTab: 'content',\n\t\t\t\t\t\t\ttabs: Immutable.OrderedMap({\n\t\t\t\t\t\t\t\tsettings: Immutable.Map(),\n\t\t\t\t\t\t\t\tcontent: Immutable.Map(),\n\t\t\t\t\t\t\t\tpreview: Immutable.Map({\n\t\t\t\t\t\t\t\t\tpreviewLocation: ''\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t\tmedia: Immutable.Map(),\n\t\t\t\tdata: Immutable.Map(),\n\t\t\t\tlayout: Immutable.Map(),\n\t\t\t\tfunctions: Immutable.Map(),\n\t\t\t\tsystem: Immutable.Map({\n\t\t\t\t\tcurrentPage: 'browser',\n\t\t\t\t\tpages: Immutable.OrderedMap({\n\t\t\t\t\t\tbrowser: Immutable.Map()\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\n\t\tit('outputs an intial state if no action and no previous state', () => {\n\t\t\tlet newState = layout(undefined, {});\n\t\t\treturn expect(newState, 'to satisfy', {\n\t\t\t\tcurrentPerspective: 'content',\n\t\t\t\tperspectives: {\n\t\t\t\t\tcontent: {},\n\t\t\t\t\tmedia: {},\n\t\t\t\t\tdata: {},\n\t\t\t\t\tlayout: {},\n\t\t\t\t\tfunctions: {},\n\t\t\t\t\tsystem: {}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tit('outputs the same state object if no action', () => {\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch' });\n\t\t\tlet newState = layout(oldState, {});\n\t\t\treturn expect(newState, 'to be', oldState);\n\t\t});\n\n\t\tdescribe('select location', () => {\n\t\t\tit('sets all location pointers', () => {\n\t\t\t\tlet action = {\n\t\t\t\t\ttype: actions.SELECT_LOCATION,\n\t\t\t\t\tperspective: 'content',\n\t\t\t\t\tpage: 'frontpage',\n\t\t\t\t\ttab: 'preview',\n\t\t\t\t\tpreview: 'frontpagePreview'\n\t\t\t\t};\n\t\t\t\tlet oldState = initialState;\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\treturn expect(newState, 'to satisfy', {\n\t\t\t\t\tcurrentPerspective: 'content',\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tcurrentPage: 'frontpage',\n\t\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\t\tfrontpage: {\n\t\t\t\t\t\t\t\t\tcurrentTab: 'preview',\n\t\t\t\t\t\t\t\t\ttabs: {\n\t\t\t\t\t\t\t\t\t\tpreview: {\n\t\t\t\t\t\t\t\t\t\t\tpreviewLocation: 'frontpagePreview'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('sets single location pointers', () => {\n\t\t\t\tlet action = {\n\t\t\t\t\ttype: actions.SELECT_LOCATION,\n\t\t\t\t\tperspective: 'content'\n\t\t\t\t};\n\t\t\t\tlet expectations = [];\n\t\t\t\tlet oldState = initialState;\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\texpectations.push(expect(newState, 'to satisfy', {\n\t\t\t\t\tcurrentPerspective: 'content'\n\t\t\t\t}));\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.SELECT_LOCATION,\n\t\t\t\t\tpage: 'frontpage'\n\t\t\t\t};\n\t\t\t\toldState = newState;\n\t\t\t\tnewState = layout(oldState, action);\n\t\t\t\texpectations.push(expect(newState, 'to satisfy', {\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tcurrentPage: 'frontpage'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.SELECT_LOCATION,\n\t\t\t\t\ttab: 'preview'\n\t\t\t\t};\n\t\t\t\toldState = newState;\n\t\t\t\tnewState = layout(oldState, action);\n\t\t\t\texpectations.push(expect(newState, 'to satisfy', {\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\t\tfrontpage: {\n\t\t\t\t\t\t\t\t\tcurrentTab: 'preview'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.SELECT_LOCATION,\n\t\t\t\t\tpreview: 'frontpagePreview'\n\t\t\t\t};\n\t\t\t\toldState = newState;\n\t\t\t\tnewState = layout(oldState, action);\n\t\t\t\texpectations.push(expect(newState, 'to satisfy', {\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\t\tfrontpage: {\n\t\t\t\t\t\t\t\t\ttabs: {\n\t\t\t\t\t\t\t\t\t\tpreview: {\n\t\t\t\t\t\t\t\t\t\t\tpreviewLocation: 'frontpagePreview'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t\treturn Promise.all(expectations);\n\t\t\t});\n\n\t\t\tit('cuts out if tab missing', () => {\n\t\t\t\tlet action = {\n\t\t\t\t\ttype: actions.SELECT_LOCATION,\n\t\t\t\t\tperspective: 'content',\n\t\t\t\t\tpage: 'frontpage',\n\t\t\t\t\ttab: 'preview',\n\t\t\t\t\tpreview: 'frontpagePreview'\n\t\t\t\t};\n\n\t\t\t\tlet oldState = initialState.deleteIn(['perspectives', 'content', 'pages', 'frontpage', 'tabs', 'preview']);\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\treturn expect(newState, 'to satisfy', {\n\t\t\t\t\tcurrentPerspective: 'content',\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tcurrentPage: 'frontpage',\n\t\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\t\tfrontpage: {\n\t\t\t\t\t\t\t\t\tcurrentTab: 'content',\n\t\t\t\t\t\t\t\t\ttabs: {\n\t\t\t\t\t\t\t\t\t\tcontent: expect.it('not to have key', 'previewLocation')\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('cuts out if page missing', () => {\n\t\t\t\tlet action = {\n\t\t\t\t\ttype: actions.SELECT_LOCATION,\n\t\t\t\t\tperspective: 'content',\n\t\t\t\t\tpage: 'frontpage',\n\t\t\t\t\ttab: 'preview',\n\t\t\t\t\tpreview: 'frontpagePreview'\n\t\t\t\t};\n\n\t\t\t\tlet oldState = initialState.deleteIn(['perspectives', 'content', 'pages', 'frontpage']);\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\treturn expect(newState, 'to satisfy', {\n\t\t\t\t\tcurrentPerspective: 'content',\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tcurrentPage: 'browser',\n\t\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\t\tbrowser: expect.it('not to have key', 'currentTab')\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('open tab', () => {\n\t\t\tlet action;\n\t\t\tbeforeEach(() => {\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.OPEN_PAGE,\n\t\t\t\t\tpageName: 'editUser-admin',\n\t\t\t\t\ttabNames: ['general', 'permissions', 'perspectives']\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tit('adds a page to the current perspective, including tabs', () => {\n\t\t\t\tlet oldState = initialState;\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\treturn expect(newState, 'to satisfy', {\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tsystem: {\n\t\t\t\t\t\t\tcurrentPage: 'browser',\n\t\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\t\tbrowser: {},\n\t\t\t\t\t\t\t\t'editUser-admin': {\n\t\t\t\t\t\t\t\t\ttabs: {\n\t\t\t\t\t\t\t\t\t\tgeneral: {},\n\t\t\t\t\t\t\t\t\t\tpermissions: {},\n\t\t\t\t\t\t\t\t\t\tperspectives: {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('adds a page to the current perspective, without tabs', () => {\n\t\t\t\tlet oldState = initialState;\n\t\t\t\tdelete action.tabNames;\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\treturn expect(newState, 'to satisfy', {\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tsystem: {\n\t\t\t\t\t\t\tcurrentPage: 'browser',\n\t\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\t\tbrowser: {},\n\t\t\t\t\t\t\t\t'editUser-admin': {\n\t\t\t\t\t\t\t\t\ttabs: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('does not add a page if already open', () => {\n\t\t\t\tlet oldState = initialState.set('currentPerspective', 'content');\n\t\t\t\taction.pageName = 'frontpage';\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\treturn expect(newState, 'to be', oldState);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('close tab', () => {\n\t\t\tlet action;\n\t\t\tbeforeEach(() => {\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.CLOSE_PAGE,\n\t\t\t\t\tpageName: 'frontpage'\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tit('removes a page from the current perspective', () => {\n\t\t\t\tlet oldState = initialState.set('currentPerspective', 'content');\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\treturn expect(newState, 'to satisfy', {\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tcurrentPage: 'browser',\n\t\t\t\t\t\t\tpages: expect.it('not to have property', 'frontpage')\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('changes location if removing the currently shown page', () => {\n\t\t\t\tlet oldState = initialState.set('currentPerspective', 'content').setIn(['perspectives', 'content', 'currentPage'], 'frontpage');\n\t\t\t\tlet newState = layout(oldState, action);\n\t\t\t\treturn expect(newState, 'to satisfy', {\n\t\t\t\t\tperspectives: {\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tcurrentPage: 'browser',\n\t\t\t\t\t\t\tpages: expect.it('not to have property', 'frontpage')\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/reducers/logs.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport logs, * as actions from 'console/state/reducers/logs.js';\nimport Immutable from 'immutable';\n\ndescribe('Logs', () => {\n\tdescribe('actions', () => {\n\t\tit('has action descriptors', () =>\n\t\t\texpect(actions, 'to have property', 'REFRESH_LOG')\n\t\t);\n\n\t\tdescribe('Refresh', () => {\n\t\t\tlet refreshLog = actions.refreshLog;\n\t\t\tit('creates action for refreshing a log\\'s entries', () => {\n\t\t\t\tlet entries = [ 'test1', 'test2', 'test3', 'test4', 'test5', 'test6' ];\n\t\t\t\tlet action = refreshLog('testlog', '2016-10-15', entries);\n\t\t\t\treturn expect(action, 'to be an action of type', actions.REFRESH_LOG)\n\t\t\t\t\t.and('to have property', 'logName', 'testlog')\n\t\t\t\t\t.and('to have property', 'page', '2016-10-15')\n\t\t\t\t\t.and('to have property', 'entries', entries);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('reducer', () => {\n\t\tit('outputs an intial state if no action and no previous state', () => {\n\t\t\tlet newState = logs(undefined, {});\n\t\t\treturn expect(newState, 'to equal', Immutable.fromJS({}));\n\t\t});\n\n\t\tit('outputs the same state object if no action', () => {\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch' });\n\t\t\tlet newState = logs(oldState, {});\n\t\t\treturn expect(newState, 'to be', oldState);\n\t\t});\n\n\t\tdescribe('refresh log', () => {\n\t\t\tlet action;\n\t\t\tbeforeEach(() => {\n\t\t\t\taction = {\n\t\t\t\t\ttype: actions.REFRESH_LOG,\n\t\t\t\t\tlogName: 'testlog',\n\t\t\t\t\tpage: '2016-10-12',\n\t\t\t\t\tentries: [ 'test1', 'test2', 'test3', 'test4', 'test5', 'test6' ]\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tit('Adds a new log page', () => {\n\t\t\t\tlet oldState = Immutable.fromJS({\n\t\t\t\t\ttestlog: {\n\t\t\t\t\t\t'otherday': ['no', 'change']\n\t\t\t\t\t},\n\t\t\t\t\totherlog: {\n\t\t\t\t\t\t'someday': ['no', 'touchy']\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tlet newState = logs(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\ttestlog: {\n\t\t\t\t\t\t'otherday': ['no', 'change'],\n\t\t\t\t\t\t'2016-10-12': [ 'test1', 'test2', 'test3', 'test4', 'test5', 'test6' ]\n\t\t\t\t\t},\n\t\t\t\t\totherlog: {\n\t\t\t\t\t\t'someday': ['no', 'touchy']\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t});\n\n\t\t\tit('Replaces entries on a log page', () => {\n\t\t\t\tlet oldState = Immutable.fromJS({\n\t\t\t\t\ttestlog: {\n\t\t\t\t\t\t'otherday': ['no', 'change'],\n\t\t\t\t\t\t'2016-10-12': ['old', 'stuff', 'in', 'here']\n\t\t\t\t\t},\n\t\t\t\t\totherlog: {\n\t\t\t\t\t\t'someday': ['no', 'touchy']\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tlet newState = logs(oldState, action);\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\t\ttestlog: {\n\t\t\t\t\t\t'otherday': ['no', 'change'],\n\t\t\t\t\t\t'2016-10-12': [ 'test1', 'test2', 'test3', 'test4', 'test5', 'test6' ]\n\t\t\t\t\t},\n\t\t\t\t\totherlog: {\n\t\t\t\t\t\t'someday': ['no', 'touchy']\n\t\t\t\t\t}\n\t\t\t\t}));\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/reducers/options.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport options, * as actions from 'console/state/reducers/options.js';\nimport Immutable from 'immutable';\n\ndescribe('Options', () => {\n\tit('outputs an intial state if no action and no previous state', () => {\n\t\tlet state = options(undefined, {});\n\t\treturn expect(state, 'to equal', Immutable.fromJS({ values: {}, lists: {} }));\n\t});\n\n\tit('outputs the same state object if no action', () => {\n\t\tlet oldState = { thing: 'do not touch' };\n\t\tlet newState = options(oldState, {});\n\t\treturn expect(newState, 'to be', oldState);\n\t});\n\n\tit('has action descriptors', () =>\n\t\texpect(actions, 'to have property', 'SET_OPTION', 'OPTIONS.SET')\n\t\t.and('to have property', 'STORE_OPTION_LIST', 'OPTIONS.STORE_LIST')\n\t);\n\n\tdescribe('Set option', () => {\n\t\tlet setOption = actions.setOption;\n\n\t\tit('creates action for setting an option value', () => {\n\t\t\tlet action = setOption('testopt', 'a value');\n\t\t\treturn expect(action, 'to be an action of type', actions.SET_OPTION)\n\t\t\t.and('to have property', 'name', 'testopt')\n\t\t\t.and('to have property', 'value', 'a value');\n\t\t});\n\t});\n\n\tdescribe('Store option list', () => {\n\t\tlet storeOptions = actions.storeOptions;\n\n\t\tit('creates action for storing an option set', () => {\n\t\t\tlet action = storeOptions('fieldName', ['one', 'two', 'three']);\n\t\t\treturn expect(action, 'to be an action of type', actions.STORE_OPTION_LIST)\n\t\t\t.and('to have property', 'field', 'fieldName')\n\t\t\t.and('to have property', 'options', ['one', 'two', 'three']);\n\t\t});\n\t});\n\n\tdescribe('Action responses', () => {\n\t\tlet oldState;\n\t\tbeforeEach(() => {\n\t\t\toldState = Immutable.fromJS({\n\t\t\t\tvalues: {\n\t\t\t\t\tthing: 'do not touch'\n\t\t\t\t},\n\t\t\t\tlists: {\n\t\t\t\t\tunused: [{ value: 'test', label: 'Do not show' }]\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Set option', () => {\n\t\t\tit('sets anew the value of the given option field', () => {\n\t\t\t\tlet newState = options(oldState, { type: actions.SET_OPTION, name: 'test1', value: 'was set' });\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to satisfy', {\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\tthing: 'do not touch',\n\t\t\t\t\t\ttest1: 'was set'\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('overwrites the value of the given option field', () => {\n\t\t\t\toldState.test1 = 'old';\n\t\t\t\tlet newState = options(oldState, { type: actions.SET_OPTION, name: 'test1', value: 'was set' });\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to satisfy', {\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\tthing: 'do not touch',\n\t\t\t\t\t\ttest1: 'was set'\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Store option list', () => {\n\t\t\tit('stores a list of options according to the field name', () => {\n\t\t\t\tlet newState = options(oldState, {\n\t\t\t\t\ttype: actions.STORE_OPTION_LIST,\n\t\t\t\t\tfield: 'testField',\n\t\t\t\t\toptions: [{value: 'opt1', label: 'Option 1'}, {value: 'opt2', label: 'Option 2'}]\n\t\t\t\t});\n\t\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t\t.and('to satisfy', {\n\t\t\t\t\tlists: {\n\t\t\t\t\t\ttestField: [{value: 'opt1', label: 'Option 1'}, {value: 'opt2', label: 'Option 2'}],\n\t\t\t\t\t\tunused: [{ value: 'test', label: 'Do not show' }]\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/reducers/providers.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport providers, * as actions from 'console/state/reducers/providers.js';\nimport Immutable from 'immutable';\n\ndescribe('Providers', () => {\n\tdescribe('actions', () => {\n\t\tit('has action descriptors', () =>\n\t\t\texpect(actions, 'to have property', 'STORE_PROVIDER_DATA')\n\t\t);\n\n\t\tdescribe('storeData', () => {\n\t\t\tlet storeData = actions.storeData;\n\t\t\tit('creates action for storing a provider\\'s data', () => {\n\t\t\t\tlet entries = [ 'test1', 'test2', 'test3', 'test4', 'test5', 'test6' ];\n\t\t\t\tlet action = storeData('test', 'page1', entries);\n\t\t\t\treturn expect(action, 'to be an action of type', actions.STORE_PROVIDER_DATA)\n\t\t\t\t\t.and('to have property', 'providerName', 'test')\n\t\t\t\t\t.and('to have property', 'page', 'page1')\n\t\t\t\t\t.and('to have property', 'data', entries);\n\t\t\t});\n\t\t});\n\t});\n\n\n\tdescribe('reducer', () => {\n\t\tit('outputs an intial state if no action and no previous state', () => {\n\t\t\tlet newState = providers(undefined, {});\n\t\t\treturn expect(newState, 'to equal', Immutable.fromJS({}));\n\t\t});\n\n\t\tit('outputs the same state object if no action', () => {\n\t\t\tlet oldState = Immutable.fromJS({ thing: 'do not touch' });\n\t\t\tlet newState = providers(oldState, {});\n\t\t\treturn expect(newState, 'to be', oldState);\n\t\t});\n\t});\n\n\tdescribe('store data', () => {\n\t\tlet action;\n\t\tbeforeEach(() => {\n\t\t\taction = {\n\t\t\t\ttype: actions.STORE_PROVIDER_DATA,\n\t\t\t\tproviderName: 'test',\n\t\t\t\tpage: 'page1',\n\t\t\t\tdata: [ 'test1', 'test2', 'test3', 'test4', 'test5', 'test6' ]\n\t\t\t};\n\t\t});\n\n\t\tit('Adds a new log page', () => {\n\t\t\tlet oldState = Immutable.fromJS({\n\t\t\t\ttest: {\n\t\t\t\t\t'otherpage': ['no', 'change']\n\t\t\t\t},\n\t\t\t\tother: {\n\t\t\t\t\t'something': ['no', 'touchy']\n\t\t\t\t}\n\t\t\t});\n\t\t\tlet newState = providers(oldState, action);\n\t\t\treturn expect(newState, 'not to be', oldState)\n\t\t\t.and('to equal', Immutable.fromJS({\n\t\t\t\ttest: {\n\t\t\t\t\t'otherpage': ['no', 'change'],\n\t\t\t\t\t'page1': [ 'test1', 'test2', 'test3', 'test4', 'test5', 'test6' ]\n\t\t\t\t},\n\t\t\t\tother: {\n\t\t\t\t\t'something': ['no', 'touchy']\n\t\t\t\t}\n\t\t\t}));\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/state/store.spec.js",
    "content": "import loadModules from 'unittest/helpers/moduleLoader.js';\nimport expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport getHotReloadStore from 'systemjs-hot-reloader-store';\n\nconst hotStore = getHotReloadStore('console:store');\n\ndescribe('configureStore', () => {\n\tlet configureStore;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/state/store.js',\n\t\t\t\tmoduleCb: m => { configureStore = m.default; }\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tafterEach(() => {\n\t\thotStore.prevStore = null;\n\t\tdelete window.devToolsExtension;\n\t});\n\n\tit('creates and configures a store', () =>\n\t\texpect(configureStore, 'when called with', [{}])\n\t\t.then(store => expect(store, 'to be an object')\n\t\t.and('to satisfy', {\n\t\t\tdispatch: expect.it('to be a function')\n\t\t}))\n\t);\n\n\tit('hot-reloads correctly', () => {\n\t\tlet store = { replaceReducer: sinon.spy().named('replaceReducer') };\n\t\thotStore.prevStore = store;\n\t\treturn expect(configureStore, 'when called with', [{}])\n\t\t.then(() => expect (store.replaceReducer, 'was called once'));\n\t});\n\n\tit('applies Redux dev tool middleware if available', () => {\n\t\tlet spiedMiddleWare = sinon.spy(() => f => f).named('middleware');\n\t\twindow.devToolsExtension = spiedMiddleWare;\n\t\treturn expect(configureStore, 'when called with', [{}])\n\t\t.then(() => expect (spiedMiddleWare, 'was called once'));\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/_setup.js",
    "content": "import unexpectedReact from 'unexpected-react';\n\nbeforeEach(() => {\n\tunexpectedReact.clearAll();\n\twhile (document.body.lastChild) {\n\t\tdocument.body.removeChild(document.body.lastChild);\n\t}\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/container/ConnectDialog.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport Immutable from 'immutable';\nimport loadModules from 'unittest/helpers/moduleLoader.js';\n\ndescribe('ConnectDialog', () => {\n\tlet ConnectDialog, Dialog;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/components/presentation/Dialog.js',\n\t\t\t\tmoduleCb: m => {\n\t\t\t\t\tDialog = m.default;\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/components/container/ConnectDialog.js',\n\t\t\t\tmoduleCb: m => {\n\t\t\t\t\tConnectDialog = m.default;\n\t\t\t\t}\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tlet renderer, state, store, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tstate = Immutable.fromJS({\n\t\t\tlayout: {\n\t\t\t\tcurrentPerspective: 'test',\n\t\t\t\tperspectives: {\n\t\t\t\t\ttest: {\n\t\t\t\t\t\tcurrentPage: 'dialogShim',\n\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\tdialogShim: {}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t},\n\t\t\tpageDefs: {\n\t\t\t\tdialogShim: {\n\t\t\t\t\tname: 'dialogShim',\n\t\t\t\t\tdialog: 'testdialog'\n\t\t\t\t}\n\t\t\t},\n\t\t\tdialogDefs: {\n\t\t\t\ttestdialog: {\n\t\t\t\t\tname: 'testdialog',\n\t\t\t\t\tpanes: ['testpane']\n\t\t\t\t}\n\t\t\t},\n\t\t\tdialogPaneDefs: {\n\t\t\t\ttestpane: {\n\t\t\t\t\tname: 'testpane',\n\t\t\t\t\ttest: 'this is data',\n\t\t\t\t\tcategories: ['tag1', 'tag2', 'tag3', 'tag4'],\n\t\t\t\t\ttype: 'testType',\n\t\t\t\t\tprovider: 'elementSource'\n\t\t\t\t}\n\t\t\t},\n\t\t\tproviderDefs: {\n\t\t\t\telementSource: {\n\t\t\t\t\turi: 'test.provider.elements'\n\t\t\t\t}\n\t\t\t},\n\t\t\tdialogData: {\n\t\t\t\ttestdialog: {\n\t\t\t\t\tselectedItem: 'entry2'\n\t\t\t\t}\n\t\t\t},\n\t\t\tproviders: {\n\t\t\t\t'test.provider.elements': {\n\t\t\t\t\ttestdialog: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'entry1',\n\t\t\t\t\t\t\ttitle: 'First component',\n\t\t\t\t\t\t\tdescription: 'All manner of words',\n\t\t\t\t\t\t\tgroupingTags: [\n\t\t\t\t\t\t\t\t'tag1',\n\t\t\t\t\t\t\t\t'tag2',\n\t\t\t\t\t\t\t\t'unusedtag'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcontainerClasses: [\n\t\t\t\t\t\t\t\t'narrow',\n\t\t\t\t\t\t\t\t'footer'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcomponentDefinition: {\n\t\t\t\t\t\t\t\thtml: {\n\t\t\t\t\t\t\t\t\tbody: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'entry2',\n\t\t\t\t\t\t\ttitle: 'Second component',\n\t\t\t\t\t\t\tdescription: 'Even more words',\n\t\t\t\t\t\t\tgroupingTags: [\n\t\t\t\t\t\t\t\t'tag1',\n\t\t\t\t\t\t\t\t'tag2'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcontainerClasses: [\n\t\t\t\t\t\t\t\t'narrow',\n\t\t\t\t\t\t\t\t'footer'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcomponentDefinition: {\n\t\t\t\t\t\t\t\thtml: {\n\t\t\t\t\t\t\t\t\tbody: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'entry3',\n\t\t\t\t\t\t\ttitle: 'Third component',\n\t\t\t\t\t\t\tdescription: 'Even more words',\n\t\t\t\t\t\t\tgroupingTags: [\n\t\t\t\t\t\t\t\t'tag2',\n\t\t\t\t\t\t\t\t'tag3'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcontainerClasses: [\n\t\t\t\t\t\t\t\t'narrow',\n\t\t\t\t\t\t\t\t'footer'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcomponentDefinition: {\n\t\t\t\t\t\t\t\thtml: {\n\t\t\t\t\t\t\t\t\tbody: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'entry4',\n\t\t\t\t\t\t\ttitle: 'Fourth component',\n\t\t\t\t\t\t\tdescription: 'Even more words',\n\t\t\t\t\t\t\tgroupingTags: [\n\t\t\t\t\t\t\t\t'tag3'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcontainerClasses: [\n\t\t\t\t\t\t\t\t'narrow',\n\t\t\t\t\t\t\t\t'footer'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcomponentDefinition: {\n\t\t\t\t\t\t\t\thtml: {\n\t\t\t\t\t\t\t\t\tbody: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'entry5',\n\t\t\t\t\t\t\ttitle: 'Fifth component',\n\t\t\t\t\t\t\tdescription: 'Wooooords',\n\t\t\t\t\t\t\tgroupingTags: ['unusedtag'],\n\t\t\t\t\t\t\tcontainerClasses: [\n\t\t\t\t\t\t\t\t'narrow',\n\t\t\t\t\t\t\t\t'footer'\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tcomponentDefinition: {\n\t\t\t\t\t\t\t\thtml: {\n\t\t\t\t\t\t\t\t\tbody: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tstore = {\n\t\t\tstate,\n\t\t\tsubscribe: sinon.spy().named('subscribe'),\n\t\t\tdispatch: sinon.spy().named('dispatch'),\n\t\t\tgetState: sinon.spy(() => store.state).named('getState')\n\t\t};\n\t\tprops = {\n\t\t\ttest: 'value',\n\t\t\tpageDef: Immutable.Map({ dialog: 'testdialog'})\n\t\t};\n\t});\n\n\tit('renders a Dialog with props and panel type to show', () => {\n\t\trenderer.render(<ConnectDialog store={store} {...props}/>);\n\t\treturn Promise.all([\n\t\t\texpect(renderer,\n\t\t\t\t'to have exactly rendered',\n\t\t\t\t<Dialog\n\t\t\t\t\ttest='value'\n\t\t\t\t\tpageDef={Immutable.fromJS({ dialog: 'testdialog'})}\n\t\t\t\t\tdialogDef={Immutable.fromJS({ name: 'testdialog', panes: [{ test: 'this is data' }] })}\n\t\t\t\t\titemGroups={Immutable.fromJS([\n\t\t\t\t\t\t{ name: 'tag1', entries: [\n\t\t\t\t\t\t\t{ name: 'entry1' },\n\t\t\t\t\t\t\t{ name: 'entry2' }\n\t\t\t\t\t\t]},\n\t\t\t\t\t\t{ name: 'tag2', entries: [\n\t\t\t\t\t\t\t{ name: 'entry1' },\n\t\t\t\t\t\t\t{ name: 'entry2' },\n\t\t\t\t\t\t\t{ name: 'entry3' }\n\t\t\t\t\t\t]},\n\t\t\t\t\t\t{ name: 'tag3', entries: [\n\t\t\t\t\t\t\t{ name: 'entry3' },\n\t\t\t\t\t\t\t{ name: 'entry4' }\n\t\t\t\t\t\t]},\n\t\t\t\t\t\t{ name: 'uncategorized', entries: [\n\t\t\t\t\t\t\t{ name: 'entry5' }\n\t\t\t\t\t\t]}\n\t\t\t\t\t])}\n\t\t\t\t\tdialogData={Immutable.fromJS({\n\t\t\t\t\t\tselectedItem: 'entry2'\n\t\t\t\t\t})}\n\t\t\t\t\tdispatch={store.dispatch}\n\t\t\t\t\tstore={store}/>\n\t\t\t),\n\t\t\texpect(store.dispatch, 'was not called'),\n\t\t\texpect(store.subscribe, 'was not called'),\n\t\t\texpect(store.getState, 'was called')\n\t\t]);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/container/ConnectDockPanel.spec.js",
    "content": "import loadModules from 'unittest/helpers/moduleLoader.js';\nimport expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport Immutable from 'immutable';\n\ndescribe('ConnectDockPanel', () => {\n\tlet ConnectDockPanel, SwitchPanel;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/components/container/ConnectDockPanel.js',\n\t\t\t\tmoduleCb: m => { ConnectDockPanel = m.default; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/components/presentation/SwitchPanel.js',\n\t\t\t\tmoduleCb: m => { SwitchPanel = m.default; }\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tlet renderer, state, store, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tstate = Immutable.fromJS({\n\t\t\tlayout: {\n\t\t\t\tcurrentPerspective: 'content',\n\t\t\t\tperspectives: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\tcurrentPage: 'test1',\n\t\t\t\t\t\tpages: {}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tpageDefs: {\n\t\t\t\ttest1: {\n\t\t\t\t\tname: 'test1',\n\t\t\t\t\ttype: 'test'\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tstore = {\n\t\t\tsubscribe: sinon.spy().named('subscribe'),\n\t\t\tdispatch: sinon.spy().named('dispatch'),\n\t\t\tgetState: sinon.spy(() => state).named('getState')\n\t\t};\n\t\tprops = {\n\t\t\ttest: 'value',\n\t\t\tpanelTypes: {} // required for SwitchPanel\n\t\t};\n\t});\n\n\tit('renders a SwitchPanel with props and panel type to show', () => {\n\t\trenderer.render(<ConnectDockPanel store={store} {...props}/>);\n\t\treturn Promise.all([\n\t\t\texpect(renderer,\n\t\t\t\t'to have exactly rendered',\n\t\t\t\t<SwitchPanel\n\t\t\t\t\ttest='value'\n\t\t\t\t\tpageDef={{\n\t\t\t\t\t\tname: 'test1'\n\t\t\t\t\t}}\n\t\t\t\t\tshowType='test'\n\t\t\t\t\tpanelTypes={{}}\n\t\t\t\t\tdispatch={store.dispatch}\n\t\t\t\t\tstore={store}/>\n\t\t\t),\n\t\t\texpect(store.dispatch, 'was not called'),\n\t\t\texpect(store.subscribe, 'was not called'),\n\t\t\texpect(store.getState, 'was called')\n\t\t]);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/container/ConnectFormPanel.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport ConnectFormPanel from 'console/components/container/ConnectFormPanel.js';\nimport FormTab from 'console/components/presentation/FormTab.js';\nimport { UPDATE_VALUE } from 'console/state/reducers/dataFields.js';\nimport Immutable from 'immutable';\n\ndescribe('ConnectFormPanel', () => {\n\tlet renderer, state, store;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tstate = Immutable.fromJS({\n\t\t\tlayout: {\n\t\t\t\tcurrentPerspective: 'content',\n\t\t\t\tperspectives: {\n\t\t\t\t\tcontent: {\n\t\t\t\t\t\tcurrentPage: 'test',\n\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\ttest: {\n\t\t\t\t\t\t\t\tcurrentTab: 'test/tab',\n\t\t\t\t\t\t\t\ttabs: {\n\t\t\t\t\t\t\t\t\t'test/tab': {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tpageDefs: {\n\t\t\t\t'test': {\n\t\t\t\t\tname: 'test',\n\t\t\t\t\ttabs: ['test/tab']\n\t\t\t\t}\n\t\t\t},\n\t\t\ttabDefs: {\n\t\t\t\t'test/tab': {\n\t\t\t\t\tname: 'test/tab',\n\t\t\t\t\tfieldsets: [\n\t\t\t\t\t\t'test/tab/oneset',\n\t\t\t\t\t\t'test/tab/twoset',\n\t\t\t\t\t\t'test/tab/fourset'\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t},\n\t\t\tfieldsetDefs: {\n\t\t\t\t'test/tab/oneset': {\n\t\t\t\t\tname: 'test/tab/oneset',\n\t\t\t\t\tlabel: 'First set',\n\t\t\t\t\tfields: [ 'test/tab/oneset/onefield', 'test/tab/oneset/twofield' ]\n\t\t\t\t},\n\t\t\t\t'test/tab/twoset': {\n\t\t\t\t\tname: 'test/tab/twoset',\n\t\t\t\t\tlabel: 'Second set',\n\t\t\t\t\tfields: [ 'test/tab/twoset/threefield' ]\n\t\t\t\t},\n\t\t\t\t'no-show-set': {\n\t\t\t\t\tname: 'no-show-set',\n\t\t\t\t\tlabel: 'Don\\'t show me',\n\t\t\t\t\tfields: []\n\t\t\t\t}\n\t\t\t},\n\t\t\tdataFieldDefs: {\n\t\t\t\t'test/tab/oneset/onefield': { name: 'test/tab/oneset/onefield' },\n\t\t\t\t'test/tab/oneset/twofield': { name: 'test/tab/oneset/twofield', defaultValue: 'a default' },\n\t\t\t\t'test/tab/twoset/threefield': { name: 'test/tab/twoset/threefield', defaultValue: 'overwritten' }\n\t\t\t},\n\t\t\tdataFields: {\n\t\t\t\tcommittedPages: {\n\t\t\t\t\t'test': {\n\t\t\t\t\t\t'test/tab/twoset/threefield': 'same'\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t'test': {\n\t\t\t\t\t'test/tab/twoset/threefield': 'different'\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tstore = {\n\t\t\tstate: state,\n\t\t\tsubscribe: sinon.spy().named('subscribe'),\n\t\t\tdispatch: sinon.spy().named('dispatch'),\n\t\t\tgetState: sinon.spy(() => store.state).named('getState')\n\t\t};\n\t});\n\n\tit('renders a FormTab with props and page name to show', () => {\n\t\trenderer.render(<ConnectFormPanel store={store}/>);\n\t\treturn expect(renderer,\n\t\t\t'to have exactly rendered',\n\t\t\t<FormTab\n\t\t\t\tname='test/tab'\n\t\t\t\tpageName='test'\n\t\t\t\tfieldsets={[\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'test/tab/oneset',\n\t\t\t\t\t\tlabel: 'First set',\n\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t{ name: 'test/tab/oneset/onefield' },\n\t\t\t\t\t\t\t{ name: 'test/tab/oneset/twofield', defaultValue: 'a default' }\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'test/tab/twoset',\n\t\t\t\t\t\tlabel: 'Second set',\n\t\t\t\t\t\tfields: [ { name: 'test/tab/twoset/threefield', defaultValue: 'overwritten', value: 'different' } ]\n\t\t\t\t\t}\n\t\t\t\t]}\n\t\t\t\tactions={{\n\t\t\t\t\tupdateValue: expect.it('to be a function')\n\t\t\t\t\t\t.and('when called with', ['pagename', 'fieldname'], 'to be a function')\n\t\t\t\t\t\t.and('when called with', ['pagename', 'fieldname'], 'when called with', ['value'], 'to be undefined') // Result is call to store.dispatch\n\t\t\t\t}}\n\t\t\t\tstore={{}}/>)\n\t\t\t.then(() => expect(store.dispatch, 'to have calls satisfying', [\n\t\t\t\t{ args: [{ type: UPDATE_VALUE, pageName: 'pagename', fieldName: 'fieldname', newValue: 'value' }]}\n\t\t\t]));\n\t});\n\n\tdescribe('missing fields in state', () => {\n\t\tit('provides a default tabName if none selected', () => {\n\t\t\tstore.state = state.deleteIn(['layout', 'perspectives', 'content', 'pages', 'test', 'currentTab']);\n\t\t\trenderer.render(<ConnectFormPanel store={store}/>);\n\t\t\treturn expect(renderer,\n\t\t\t\t'to have rendered',\n\t\t\t\t<FormTab\n\t\t\t\t\tname='test/tab'\n\t\t\t\t\tpageName='test'\n\t\t\t\t\tfieldsets={[{}, {}]}\n\t\t\t\t\tactions={{}}\n\t\t\t\t\tstore={{}}/>);\n\t\t});\n\n\t\tit('provides an empty tabDef if none found', () => {\n\t\t\tstore.state = state.deleteIn(['tabDefs', 'test/tab']);\n\t\t\trenderer.render(<ConnectFormPanel store={store}/>);\n\t\t\treturn expect(renderer,\n\t\t\t\t'to have rendered',\n\t\t\t\t<FormTab\n\t\t\t\t\tactions={{}}\n\t\t\t\t\tstore={{}}/>);\n\t\t});\n\t});\n\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/container/ConnectLogPanel.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport { CLP as ConnectLogPanel } from 'console/components/container/ConnectLogPanel.js';\nimport LogPanel from 'console/components/presentation/LogPanel.js';\nimport Immutable from 'immutable';\n\ndescribe('ConnectLogPanel', () => {\n\tlet renderer, state, store;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tstate = Immutable.fromJS({\n\t\t\tlayout: {\n\t\t\t\tcurrentPerspective: 'system',\n\t\t\t\tperspectives: {\n\t\t\t\t\tsystem: {\n\t\t\t\t\t\tcurrentPage: 'test1',\n\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\ttest1: {\n\t\t\t\t\t\t\t\tcurrentTab: 'tab1',\n\t\t\t\t\t\t\t\ttabs: {\n\t\t\t\t\t\t\t\t\ttab1: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttest2: {}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tpageDefs: {\n\t\t\t\ttest1: {\n\t\t\t\t\tname: 'test1',\n\t\t\t\t\ttabs: ['tab1']\n\t\t\t\t}\n\t\t\t},\n\t\t\ttabDefs: {\n\t\t\t\ttab1: {\n\t\t\t\t\tname: 'tab1',\n\t\t\t\t\ttype: 'testtab',\n\t\t\t\t\tlogLevels: 'logLevel',\n\t\t\t\t\tlogPageName: 'page',\n\t\t\t\t\tplaceholder: 'Empty'\n\t\t\t\t}\n\t\t\t},\n\t\t\titemDefs: {\n\t\t\t\tlogLevel: {\n\t\t\t\t\tdefault: ['Information', 'Error']\n\t\t\t\t},\n\t\t\t\tpage: {\n\t\t\t\t\tdefault: 'page'\n\t\t\t\t}\n\t\t\t},\n\t\t\tlogs: {\n\t\t\t\ttab1: {\n\t\t\t\t\tpage: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttimestamp: '2016-10-07 12:53:32.50',\n\t\t\t\t\t\t\tmessage: 'Message1',\n\t\t\t\t\t\t\ttitle: 'Title1',\n\t\t\t\t\t\t\tseverity: 'Information'\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttimestamp: '2016-10-07 15:17:38.18',\n\t\t\t\t\t\t\tmessage: 'Message2',\n\t\t\t\t\t\t\ttitle: 'Title1',\n\t\t\t\t\t\t\tseverity: 'Verbose'\n\t\t\t\t\t\t},{\n\t\t\t\t\t\t\ttimestamp: '2016-10-07 12:52:06.49',\n\t\t\t\t\t\t\tmessage: 'Message3',\n\t\t\t\t\t\t\ttitle: 'Title2',\n\t\t\t\t\t\t\tseverity: 'Verbose'\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttimestamp: '2016-10-07 15:17:38.07',\n\t\t\t\t\t\t\tmessage: 'Message4',\n\t\t\t\t\t\t\ttitle: 'Title3',\n\t\t\t\t\t\t\tseverity: 'Error'\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t},\n\t\t\toptions: {\n\t\t\t\tvalues: {\n\t\t\t\t\t'foo': ['not used']\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tstore = {\n\t\t\tstateObj: state,\n\t\t\tsubscribe: sinon.spy().named('subscribe'),\n\t\t\tdispatch: sinon.spy().named('dispatch'),\n\t\t\tgetState: sinon.spy(() => store.stateObj).named('getState')\n\t\t};\n\t});\n\n\tit('passes data to presentation component', () => {\n\t\trenderer.render(<ConnectLogPanel containerHeight={1000} containerWidth={1500} store={store}/>);\n\t\treturn expect(renderer, 'to have rendered', <LogPanel\n\t\tcontainerHeight={1000} containerWidth={1500}\n\t\t\tplaceholder={expect.it('to be a function')}\n\t\t\tlogPage={[\n\t\t\t\t{ message: 'Message4' },\n\t\t\t\t{ message: 'Message1' }\n\t\t\t]}\n\t\t/>);\n\t});\n\n\tit('reacts to changing log levels', () => {\n\t\tstore.stateObj = state.setIn(['options', 'values', 'logLevel'], Immutable.List(['Verbose']));\n\t\trenderer.render(<ConnectLogPanel containerHeight={1000} containerWidth={1500} store={store}/>);\n\t\treturn expect(renderer, 'to have rendered', <LogPanel\n\t\t\tcontainerHeight={1000} containerWidth={1500}\n\t\t\tplaceholder={expect.it('to be a function')}\n\t\t\tlogPage={[\n\t\t\t\t{ message: 'Message2' },\n\t\t\t\t{ message: 'Message3' }\n\t\t\t]}\n\t\t/>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/container/ConnectSearchPage.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport loadModules from 'unittest/helpers/moduleLoader.js';\nimport SearchPage from 'console/components/presentation/SearchPage.js';\nimport Immutable from 'immutable';\n\ndescribe('ConnectSearchPage', () => {\n\tlet ConnectSearchPage;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/components/container/ConnectSearchPage.js',\n\t\t\t\tmoduleCb: m => {\n\t\t\t\t\tConnectSearchPage = m.default;\n\t\t\t\t}\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tlet renderer, state, store;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tstate = Immutable.fromJS({\n\t\t\tlayout: {\n\t\t\t\tcurrentPerspective: 'system',\n\t\t\t\tperspectives: {\n\t\t\t\t\tsystem: {\n\t\t\t\t\t\tcurrentPage: 'search',\n\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\tsearch: {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tpageDefs: {\n\t\t\t\tsearch: {\n\t\t\t\t\tname: 'search',\n\t\t\t\t\tlabel: 'Search',\n\t\t\t\t\ttype: 'search',\n\t\t\t\t\tplaceholder: 'Search here',\n\t\t\t\t\tsearchProvider: 'searchProvider',\n\t\t\t\t\tproviders: ['searchProvider'],\n\t\t\t\t\tlinkColumn: 'col1'\n\t\t\t\t}\n\t\t\t},\n\t\t\toptions: {\n\t\t\t\tvalues: {\n\t\t\t\t\tsearch: {\n\t\t\t\t\t\ttext: 'changed',\n\t\t\t\t\t\tsortInReverseOrder: false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tproviderDefs: {\n\t\t\t\tsearchProvider: {\n\t\t\t\t\tname: 'searchProvider',\n\t\t\t\t\tprotocol: 'wamp',\n\t\t\t\t\turi: 'search.query'\n\t\t\t\t}\n\t\t\t},\n\t\t\tproviders: {\n\t\t\t\t'search.query': {\n\t\t\t\t\tsearch: {\n\t\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfieldName: 'col1',\n\t\t\t\t\t\t\t\tlabel: 'Column 1',\n\t\t\t\t\t\t\t\tsortable: false\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfieldName: 'col2',\n\t\t\t\t\t\t\t\tlabel: 'Column 2',\n\t\t\t\t\t\t\t\tsortable: true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\trows: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: 'Value',\n\t\t\t\t\t\t\t\turl: '/address1',\n\t\t\t\t\t\t\t\tvalues: {\n\t\t\t\t\t\t\t\t\tcol1: 'Value',\n\t\t\t\t\t\t\t\t\tcol2: 'One'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: 'Other value',\n\t\t\t\t\t\t\t\turl: '/address1',\n\t\t\t\t\t\t\t\tvalues: {\n\t\t\t\t\t\t\t\t\tcol1: 'Other value',\n\t\t\t\t\t\t\t\t\tcol2: 'Two'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: 'And another',\n\t\t\t\t\t\t\t\turl: '/address1',\n\t\t\t\t\t\t\t\tvalues: {\n\t\t\t\t\t\t\t\t\tcol1: 'And another',\n\t\t\t\t\t\t\t\t\tcol2: 'One'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: 'Yet more',\n\t\t\t\t\t\t\t\turl: '/address1',\n\t\t\t\t\t\t\t\tvalues: {\n\t\t\t\t\t\t\t\t\tcol1: 'Yet more',\n\t\t\t\t\t\t\t\t\tcol2: 'Two'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: 'Last one',\n\t\t\t\t\t\t\t\turl: '/address1',\n\t\t\t\t\t\t\t\tvalues: {\n\t\t\t\t\t\t\t\t\tcol1: 'Last one',\n\t\t\t\t\t\t\t\t\tcol2: 'One'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttotalHits: 5,\n\t\t\t\t\t\tfacetFields: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfieldName: 'col2',\n\t\t\t\t\t\t\t\tlabel: 'Column 2',\n\t\t\t\t\t\t\t\tfacets: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvalue: '1',\n\t\t\t\t\t\t\t\t\t\tlabel: 'One',\n\t\t\t\t\t\t\t\t\t\thitCount: 3\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvalue: '2',\n\t\t\t\t\t\t\t\t\t\tlabel: 'Two',\n\t\t\t\t\t\t\t\t\t\thitCount: 2\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\tqueryText: 'testquery'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tstore = {\n\t\t\tstateObj: state,\n\t\t\tsubscribe: sinon.spy().named('subscribe'),\n\t\t\tdispatch: sinon.spy().named('dispatch'),\n\t\t\tgetState: sinon.spy(() => store.stateObj).named('getState')\n\t\t};\n\t});\n\n\tit('passes data to presentation component', () => {\n\t\trenderer.render(<ConnectSearchPage pageDef={\n\t\t\tImmutable.fromJS({\n\t\t\t\tname: 'search',\n\t\t\t\tlabel: 'Search',\n\t\t\t\ttype: 'search',\n\t\t\t\tplaceholder: 'Search here',\n\t\t\t\tsearchProvider: 'searchProvider',\n\t\t\t\tproviders: {\n\t\t\t\t\tsearchProvider: {\n\t\t\t\t\t\tname: 'searchProvider',\n\t\t\t\t\t\tprotocol: 'wamp',\n\t\t\t\t\t\turi: 'search.query'\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tlinkColumn: 'col1'\n\t\t\t})\n\t\t} store={store}/>);\n\t\treturn expect(renderer, 'to have rendered', <SearchPage\n\t\t\tpageDef={Immutable.fromJS({\n\t\t\t\tname: 'search',\n\t\t\t\tlabel: 'Search',\n\t\t\t\ttype: 'search',\n\t\t\t\tplaceholder: 'Search here',\n\t\t\t\tsearchProvider: 'searchProvider',\n\t\t\t\tproviders: {\n\t\t\t\t\tsearchProvider: {\n\t\t\t\t\t\tname: 'searchProvider',\n\t\t\t\t\t\tprotocol: 'wamp',\n\t\t\t\t\t\turi: 'search.query'\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tlinkColumn: 'col1'\n\t\t\t})}\n\t\t\tfacetGroups={Immutable.fromJS([{}])}\n\t\t\tresultColumns={Immutable.fromJS([{ label: 'Column 1' }, { label: 'Column 2' }])}\n\t\t\tresults={Immutable.fromJS([{}, {}, {}, {}, {}])}\n\t\t\tsearchQuery={Immutable.fromJS({ text: 'changed', sortInReverseOrder: false })}\n\t\t\tsearchString='testquery'\n\t\t\tactions={{\n\t\t\t\tperformSearch: expect.it('to be a function'),\n\t\t\t\tsetOption: expect.it('to be a function')\n\t\t\t}}\n\t\t/>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/container/ConnectTabPanel.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport ConnectTabPanel from 'console/components/container/ConnectTabPanel.js';\nimport SwitchPanel from 'console/components/presentation/SwitchPanel.js';\nimport Immutable from 'immutable';\n\ndescribe('ConnectTabPanel', () => {\n\tlet renderer, state, store, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tstate = Immutable.fromJS({\n\t\t\tlayout: {\n\t\t\t\tcurrentPerspective: 'system',\n\t\t\t\tperspectives: {\n\t\t\t\t\tsystem: {\n\t\t\t\t\t\tcurrentPage: 'test1',\n\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\ttest1: {\n\t\t\t\t\t\t\t\tcurrentTab: 'tab1',\n\t\t\t\t\t\t\t\ttabs: {\n\t\t\t\t\t\t\t\t\ttab1: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttest2: {}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tpageDefs: {\n\t\t\t\ttest1: {\n\t\t\t\t\tname: 'test1',\n\t\t\t\t\ttabs: ['tab1']\n\t\t\t\t}\n\t\t\t},\n\t\t\ttabDefs: {\n\t\t\t\ttab1: {\n\t\t\t\t\tname: 'tab1',\n\t\t\t\t\ttype: 'testtab'\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tstore = {\n\t\t\tsubscribe: sinon.spy().named('subscribe'),\n\t\t\tdispatch: sinon.spy().named('dispatch'),\n\t\t\tgetState: sinon.spy(() => state).named('getState')\n\t\t};\n\t\tprops = {\n\t\t\ttest: 'value',\n\t\t\tpanelTypes: {} // required for SwitchPanel\n\t\t};\n\t});\n\n\tit('renders a SwitchPanel with props and type to show', () => {\n\t\trenderer.render(<ConnectTabPanel store={store} {...props}/>);\n\t\treturn Promise.all([\n\t\t\texpect(renderer,\n\t\t\t\t'to have exactly rendered',\n\t\t\t\t<SwitchPanel\n\t\t\t\t\ttest='value'\n\t\t\t\t\ttabDef={{}}\n\t\t\t\t\tshowType='testtab'\n\t\t\t\t\tpanelTypes={{}}\n\t\t\t\t\tdispatch={store.dispatch}\n\t\t\t\t\tstore={store}/>\n\t\t\t),\n\t\t\texpect(store.dispatch, 'was not called'),\n\t\t\texpect(store.subscribe, 'was not called'),\n\t\t\texpect(store.getState, 'was called')\n\t\t]);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/container/ConnectToolbarFrame.spec.js",
    "content": "import loadModules from 'unittest/helpers/moduleLoader.js';\nimport expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport Immutable from 'immutable';\n\ndescribe('ConnectToolbarFrame', () => {\n\tlet ConnectToolbarFrame, ToolbarFrame, UPDATE_VALUE, SET_OPTION;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/components/container/ConnectToolbarFrame.js',\n\t\t\t\tmoduleCb: m => { ConnectToolbarFrame = m.default; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/components/presentation/ToolbarFrame.js',\n\t\t\t\tmoduleCb: m => { ToolbarFrame = m.default; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/state/reducers/dataFields.js',\n\t\t\t\tmoduleCb: m => { UPDATE_VALUE = m.UPDATE_VALUE; }\n\t\t\t},\n\t\t\t{\n\t\t\t\tmodule: 'console/state/reducers/options.js',\n\t\t\t\tmoduleCb: m => { SET_OPTION = m.SET_OPTION; }\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tlet renderer, state, store, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tstate = Immutable.fromJS({\n\t\t\tlayout: {\n\t\t\t\tcurrentPerspective: 'system',\n\t\t\t\tperspectives: {\n\t\t\t\t\tsystem: {\n\t\t\t\t\t\tcurrentPage: 'testpage',\n\t\t\t\t\t\tpages: {\n\t\t\t\t\t\t\ttestpage: {\n\t\t\t\t\t\t\t\tcurrentTab: 'tab',\n\t\t\t\t\t\t\t\ttabs: {\n\t\t\t\t\t\t\t\t\ttab: {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttest2: {}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tpageDefs: {\n\t\t\t\t'testpage': {\n\t\t\t\t\tname: 'testpage',\n\t\t\t\t\ttoolbars: ['hasItemDefs', 'hasNoItemDefs', 'hasNoToolbarDef'],\n\t\t\t\t\ttabs: ['tab1']\n\t\t\t\t}\n\t\t\t},\n\t\t\ttabDefs: {\n\t\t\t\ttab1: {\n\t\t\t\t\tname: 'tab1'\n\t\t\t\t}\n\t\t\t},\n\t\t\tdataFields: {\n\t\t\t\tcommittedPages: {\n\t\t\t\t\ttestpage: {\n\t\t\t\t\t\t'one': 1,\n\t\t\t\t\t\t'two': 2\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\ttestpage: {\n\t\t\t\t\t'one': 1,\n\t\t\t\t\t'two': 2\n\t\t\t\t}\n\t\t\t},\n\t\t\toptions: {\n\t\t\t\tvalues: {\n\t\t\t\t\t'switchItUp': 2\n\t\t\t\t},\n\t\t\t\tlists: {\n\t\t\t\t\t'checkItOut': [\n\t\t\t\t\t\t{ value: 'one', label: 'Thing' },\n\t\t\t\t\t\t{ value: 'two', label: 'Stuff' }\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t},\n\t\t\ttoolbarDefs: {\n\t\t\t\thasItemDefs: {\n\t\t\t\t\tname: 'hasItemDefs',\n\t\t\t\t\titems: ['item1', 'item2', 'item3', 'item4']\n\t\t\t\t},\n\t\t\t\thasNoItemDefs: {\n\t\t\t\t\tname: 'hasNoItemDefs',\n\t\t\t\t\titems: ['item5', 'item6']\n\t\t\t\t}\n\t\t\t},\n\t\t\titemDefs: {\n\t\t\t\titem1: {\n\t\t\t\t\ttype: 'button',\n\t\t\t\t\tname: 'saveIt',\n\t\t\t\t\taction: 'save'\n\t\t\t\t},\n\t\t\t\titem2: {\n\t\t\t\t\ttype: 'button',\n\t\t\t\t\tname: 'doStuff',\n\t\t\t\t\taction: 'stuff'\n\t\t\t\t},\n\t\t\t\titem3: {\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'switchItUp',\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{ value: 'One' },\n\t\t\t\t\t\t{ value: 2, label: 'Two' }\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\titem4: {\n\t\t\t\t\ttype: 'checkboxGroup',\n\t\t\t\t\tname: 'checkItOut'\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tstore = {\n\t\t\tsubscribe: sinon.spy().named('subscribe'),\n\t\t\tdispatch: sinon.spy().named('dispatch'),\n\t\t\tgetState: sinon.spy(() => state).named('getState')\n\t\t};\n\t\tprops = {\n\t\t\ttest: 'value' // Not required - should be there anyway when passed through\n\t\t};\n\t});\n\n\tit('renders a ToolbarFrame with props, values and actions', () => {\n\t\trenderer.render(<ConnectToolbarFrame store={store} {...props}/>);\n\t\treturn expect(renderer, 'to have rendered', <ToolbarFrame\n\t\t\t{...props}\n\t\t\tpageName='testpage'\n\t\t\ttoolbars={[{\n\t\t\t\tname: 'hasItemDefs',\n\t\t\t\titems: [\n\t\t\t\t\t{ type: 'button', name: 'saveIt', action: 'save' },\n\t\t\t\t\t{ type: 'button', name: 'doStuff', action: 'stuff'},\n\t\t\t\t\t{ type: 'select', options: [{value: 'One'}, {value: 2, label: 'Two' }], value: 2 },\n\t\t\t\t\t{ type: 'checkboxGroup', options: [{value: 'one', label: 'Thing'}, {value: 'two', label: 'Stuff'}], value: []}\n\t\t\t\t]\n\t\t\t}, {\n\t\t\t\tname: 'hasNoItemDefs',\n\t\t\t\titems: []\n\t\t\t}]}\n\t\t\ttest={'value'}\n\t\t\tdirty={false}\n\t\t\tactions={{\n\t\t\t\tupdateValue: expect.it('to be a function')\n\t\t\t\t\t.and('when called with', ['pagename', 'fieldname'], 'to be a function')\n\t\t\t\t\t.and('when called with', ['pagename', 'fieldname'], 'when called with', ['value'], 'to be undefined'), // Result is call to store.dispatch\n\t\t\t\tsetOption: expect.it('to be a function')\n\t\t\t\t\t.and('when called with', ['fieldname'], 'to be a function')\n\t\t\t\t\t.and('when called with', ['fieldname'], 'when called with', ['value'], 'to be undefined'), // Result is call to store.dispatch\n\t\t\t\tsave: expect.it('to be a function')\n\t\t\t\t\t.and('when called with', ['pagename'], 'to be a function')\n\t\t\t\t\t.and('when called with', ['pagename'], 'when called', 'to be undefined'), // Result is call to store.dispatch\n\t\t\t\tfireAction: expect.it('to be a function')\n\t\t\t\t\t.and('when called with', ['pagename', 'actionId'], 'to be a function')\n\t\t\t\t\t.and('when called with', ['pagename', 'actionId'], 'when called with', [['val1', 'val2']], 'to be undefined') // Result is call to store.dispatch\n\t\t\t}}/>)\n\t\t.then(() => expect(store.dispatch, 'to have calls satisfying', [\n\t\t\t{ args: [{ type: UPDATE_VALUE, pageName: 'pagename', fieldName: 'fieldname', newValue: 'value' }]},\n\t\t\t{ args: [{ type: SET_OPTION, name: 'fieldname', value: 'value' }]},\n\t\t\t{ args: [expect.it('to be a function')]},\n\t\t\t{ args: [expect.it('to be a function')]}\n\t\t]));\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/ActionButton.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport ActionButton from 'console/components/presentation/ActionButton.js';\nimport Icon from 'console/components/presentation/Icon.js';\nimport styled from 'styled-components';\n\nconst StyledButton = styled.button``;\n\ndescribe('ActionButton', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\tlabel: 'Label',\n\t\t\tdisabled: false,\n\t\t\taction: sinon.spy()\n\t\t};\n\t});\n\n\tit('should render a button', () => {\n\t\trenderer.render(\n\t\t\t<ActionButton {...props}/>\n\t\t);\n\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledButton>{props.label}</StyledButton>\n\t\t);\n\t});\n\n\tit('should render a button with a class', () => {\n\t\tprops.style = 'main';\n\t\trenderer.render(\n\t\t\t<ActionButton {...props}/>\n\t\t);\n\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledButton className='main'>{props.label}</StyledButton>\n\t\t);\n\t});\n\n\tit('should render a disabled button', () => {\n\t\tprops.disabled = true;\n\t\trenderer.render(\n\t\t\t<ActionButton {...props}/>\n\t\t);\n\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledButton disabled={true}>{props.label}</StyledButton>\n\t\t);\n\t});\n\n\tit('should render a button with icon', () => {\n\t\tprops.icon = 'test';\n\t\trenderer.render(\n\t\t\t<ActionButton {...props}/>\n\t\t);\n\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledButton>\n\t\t\t\t<Icon id='test'/>\n\t\t\t\t{props.label}\n\t\t\t</StyledButton>\n\t\t);\n\t});\n\tit('should render a button with icon and no label', () => {\n\t\tprops.icon = 'test';\n\t\tdelete props.label;\n\t\trenderer.render(\n\t\t\t<ActionButton {...props}/>\n\t\t);\n\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledButton>\n\t\t\t\t<Icon id='test'/>\n\t\t\t</StyledButton>\n\t\t);\n\t});\n\n\tit('should call handler when clicked', () => {\n\t\trenderer.render(\n\t\t\t<ActionButton {...props}/>\n\t\t);\n\t\treturn expect(renderer, 'with event', 'click')\n\t\t\t.then(() => {\n\t\t\t\treturn expect(props.action, 'was called once');\n\t\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/CheckboxGroup.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport sinon from 'sinon';\nimport TestUtils from 'react-addons-test-utils';\nimport CheckboxGroup from 'console/components/presentation/CheckboxGroup.js';\n\nimport styled from 'styled-components';\n\nconst StyledDiv = styled.div``;\nconst StyledLabel = styled.label``;\nconst StyledInput = styled.input``;\n\ndescribe('CheckboxGroup', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\ttype: 'checkboxGroup',\n\t\t\tname: 'test/cbg',\n\t\t\toptions: [\n\t\t\t\t{ name: 'test/cbg/test1', label: 'One', value: 'One' },\n\t\t\t\t{ name: 'test/cbg/test2', label: 'Two', value: 'Two' },\n\t\t\t\t{ name: 'test/cbg/test3', label: 'Three', value: 'Three' },\n\t\t\t\t{ name: 'test/cbg/test4', label: 'Four', value: 'Four' },\n\t\t\t\t{ name: 'test/cbg/test5', label: 'Five', value: 'Five' }\n\t\t\t],\n\t\t\tvalue: [\n\t\t\t\t'One',\n\t\t\t\t'Two',\n\t\t\t\t'Four'\n\t\t\t],\n\t\t\tonChange: sinon.spy().named('onChange')\n\t\t};\n\t});\n\n\tit('renders a row of checkboxes', () => {\n\t\trenderer.render(<CheckboxGroup {...props}/>);\n\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledDiv>\n\t\t\t\t<StyledInput type=\"checkbox\" id='test/cbg/test1' value={true} checked={true}/><StyledLabel htmlFor='test/cbg/test1'>One</StyledLabel>\n\t\t\t\t<StyledInput type=\"checkbox\" id='test/cbg/test2' value={true} checked={true}/><StyledLabel htmlFor='test/cbg/test2'>Two</StyledLabel>\n\t\t\t\t<StyledInput type=\"checkbox\" id='test/cbg/test3' value={false}/><StyledLabel htmlFor='test/cbg/test3'>Three</StyledLabel>\n\t\t\t\t<StyledInput type=\"checkbox\" id='test/cbg/test4' value={true} checked={true}/><StyledLabel htmlFor='test/cbg/test4'>Four</StyledLabel>\n\t\t\t\t<StyledInput type=\"checkbox\" id='test/cbg/test5' value={false}/><StyledLabel htmlFor='test/cbg/test5'>Five</StyledLabel>\n\t\t\t</StyledDiv>\n\t\t);\n\t});\n\n\tdescribe('handles changes', () => {\n\t\tit('removing', () => {\n\t\t\trenderer.render(<CheckboxGroup {...props}/>);\n\t\t\treturn expect(renderer, 'with event', 'change', 'on', <StyledInput id='test/cbg/test2'/>)\n\t\t\t.then(() => expect(props.onChange, 'to have a call satisfying', [[\n\t\t\t\t'One',\n\t\t\t\t'Four'\n\t\t\t]]));\n\t\t});\n\n\t\tit('adding', () => {\n\t\t\trenderer.render(<CheckboxGroup {...props}/>);\n\t\t\texpect(renderer, 'with event', 'change', 'on', <StyledInput id='test/cbg/test3'/>)\n\t\t\t.then(() => expect(props.onChange, 'to have a call satisfying', [[\n\t\t\t\t'One',\n\t\t\t\t'Two',\n\t\t\t\t'Four',\n\t\t\t\t'Three'\n\t\t\t]]));\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/DataField.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport HelpIcon from 'console/components/presentation/HelpIcon.js';\nimport DataField from 'console/components/presentation/DataField.js';\nimport StatelessWrapper from 'unittest/helpers/StatelessWrapper.js';\nimport Select from 'react-select';\nimport Immutable from 'immutable';\nimport styled from 'styled-components';\n\nconst StyledDiv = styled.div``;\nconst StyledH4 = styled.h4``;\nconst StyledInput = styled.input``;\nconst StyledLabel = styled.label``;\nconst StyledSelect = styled(Select)``;\n\ndescribe('DataField', () => {\n\tlet renderer, props, state;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t});\n\n\tdescribe('with text type', () => {\n\t\tbeforeEach(() => {\n\t\t\tprops = {\n\t\t\t\ttype: 'text',\n\t\t\t\tname: 'test',\n\t\t\t\theadline: 'Text headline',\n\t\t\t\thelp: 'Help text',\n\t\t\t\tupdateValue: sinon.spy().named('updateValue')\n\t\t\t};\n\t\t\tstate = {\n\t\t\t\tvalue: 'Init'\n\t\t\t};\n\t\t});\n\n\t\tit('renders a text field with headline and helper', () => {\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledDiv>\n\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t<StyledInput\n\t\t\t\t\ttype={props.type}\n\t\t\t\t\tid={props.name}\n\t\t\t\t\tvalue={state.value}/>\n\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\n\t\tit('renders a text field with headline but no helper', () => {\n\t\t\tdelete props.help;\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv>\n\t\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t\t<StyledInput\n\t\t\t\t\t\ttype={props.type}\n\t\t\t\t\t\tid={props.name}\n\t\t\t\t\t\tvalue={state.value}/>\n\t\t\t\t</StyledDiv>\n\t\t\t)\n\t\t\t.and('not to contain', <HelpIcon text=\"\"/>);\n\t\t});\n\n\t\tit('renders a text field with helper but no headline', () => {\n\t\t\tdelete props.headline;\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv>\n\t\t\t\t\t<StyledInput\n\t\t\t\t\t\ttype={props.type}\n\t\t\t\t\t\tid={props.name}\n\t\t\t\t\t\tvalue={state.value}/>\n\t\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t\t</StyledDiv>\n\t\t\t)\n\t\t\t.and('not to contain', <StyledH4/>);\n\t\t});\n\n\t\tit('calls its update callback', () => {\n\t\t\tvar component = TestUtils.renderIntoDocument(\n\t\t\t\t<StatelessWrapper>\n\t\t\t\t\t<DataField {...props} {...state}/>\n\t\t\t\t</StatelessWrapper>\n\t\t\t);\n\t\t\treturn expect(\n\t\t\t\tcomponent, 'queried for', <StyledInput/>,\n\t\t\t'to have rendered', <StyledInput value=\"Init\"/>\n\t\t\t)\n\t\t\t.then(() => expect(component,'with event change', 'on', <StyledInput/>))\n\t\t\t.then(() => expect(props.updateValue, 'was called'));\n\t\t});\n\t});\n\n\tdescribe('with password type', () => {\n\t\tbeforeEach(() => {\n\t\t\tprops = {\n\t\t\t\ttype: 'password',\n\t\t\t\tname: 'test',\n\t\t\t\theadline: 'Text headline',\n\t\t\t\thelp: 'Help text',\n\t\t\t\tupdateValue: sinon.spy().named('updateValue')\n\t\t\t};\n\t\t\tstate = {\n\t\t\t\tvalue: 'Init'\n\t\t\t};\n\t\t});\n\n\t\tit('renders a password field with headline and helper', () => {\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledDiv>\n\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t<StyledInput\n\t\t\t\t\ttype={props.type}\n\t\t\t\t\tid={props.name}\n\t\t\t\t\tvalue={state.value}/>\n\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\n\t\tit('renders a password field with headline but no helper', () => {\n\t\t\tdelete props.help;\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv>\n\t\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t\t<StyledInput\n\t\t\t\t\t\ttype={props.type}\n\t\t\t\t\t\tid={props.name}\n\t\t\t\t\t\tvalue={state.value}/>\n\t\t\t\t</StyledDiv>\n\t\t\t)\n\t\t\t.and('not to contain', <HelpIcon text=\"\"/>);\n\t\t});\n\n\t\tit('renders a password field with helper but no headline', () => {\n\t\t\tdelete props.headline;\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv>\n\t\t\t\t\t<StyledInput\n\t\t\t\t\t\ttype={props.type}\n\t\t\t\t\t\tid={props.name}\n\t\t\t\t\t\tvalue={state.value}/>\n\t\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t\t</StyledDiv>\n\t\t\t)\n\t\t\t.and('not to contain', <StyledH4/>);\n\t\t});\n\n\t\tit('calls its update callback', () => {\n\t\t\tvar component = TestUtils.renderIntoDocument(\n\t\t\t\t<StatelessWrapper>\n\t\t\t\t\t<DataField {...props} {...state}/>\n\t\t\t\t</StatelessWrapper>\n\t\t\t);\n\t\t\treturn expect(\n\t\t\t\tcomponent, 'queried for', <StyledInput/>,\n\t\t\t'to have rendered', <StyledInput value=\"Init\"/>\n\t\t\t)\n\t\t\t.then(() => expect(component,'with event change', 'on', <StyledInput/>))\n\t\t\t.then(() => expect(props.updateValue, 'was called'));\n\t\t});\n\t});\n\n\tdescribe('with select type', () => {\n\t\tbeforeEach(() => {\n\t\t\tprops = {\n\t\t\t\ttype: 'select',\n\t\t\t\tname: 'test',\n\t\t\t\theadline: 'Text headline',\n\t\t\t\thelp: 'Help text',\n\t\t\t\tupdateValue: sinon.spy().named('updateValue')\n\t\t\t};\n\t\t\tstate = {\n\t\t\t\tvalue: 2\n\t\t\t};\n\t\t});\n\n\t\tdescribe('with option list', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tprops.options = Immutable.fromJS([\n\t\t\t\t\t{ value: 1, label: 'One' },\n\t\t\t\t\t{ value: 2, label: 'Two' },\n\t\t\t\t\t{ value: 3, label: 'Three' },\n\t\t\t\t\t{ value: 4, label: 'Four' }\n\t\t\t\t]);\n\t\t\t});\n\n\t\t\tit('renders a dropdown with headline and helper', () => {\n\t\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t\t<StyledDiv>\n\t\t\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t\t\t\t<StyledSelect id=\"test\" value={{ value: 2, label: 'Two' }} options={[\n\t\t\t\t\t\t\t\t\t{ value: 1, label: 'One' },\n\t\t\t\t\t\t\t\t\t{ value: 2, label: 'Two' },\n\t\t\t\t\t\t\t\t\t{ value: 3, label: 'Three' },\n\t\t\t\t\t\t\t\t\t{ value: 4, label: 'Four' }\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\tplaceholder=\"(No selection)\" clearable={false}/>\n\t\t\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t\t\t</StyledDiv>\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('renders a dropdown with headline but no helper', () => {\n\t\t\t\tdelete props.help;\n\t\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t\t<StyledDiv>\n\t\t\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t\t\t\t<StyledSelect id=\"test\" value={{ value: 2, label: 'Two' }} options={[\n\t\t\t\t\t\t\t\t\t{ value: 1, label: 'One' },\n\t\t\t\t\t\t\t\t\t{ value: 2, label: 'Two' },\n\t\t\t\t\t\t\t\t\t{ value: 3, label: 'Three' },\n\t\t\t\t\t\t\t\t\t{ value: 4, label: 'Four' }\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\tplaceholder=\"(No selection)\" clearable={false}/>\n\t\t\t\t\t</StyledDiv>\n\t\t\t\t)\n\t\t\t\t.and('not to contain', <HelpIcon text=\"\"/>);\n\t\t\t});\n\n\t\t\tit('renders a dropdown with helper but no headline', () => {\n\t\t\t\tdelete props.headline;\n\t\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t\t<StyledDiv>\n\t\t\t\t\t\t<StyledSelect id=\"test\" value={{ value: 2, label: 'Two' }} options={[\n\t\t\t\t\t\t\t\t{ value: 1, label: 'One' },\n\t\t\t\t\t\t\t\t{ value: 2, label: 'Two' },\n\t\t\t\t\t\t\t\t{ value: 3, label: 'Three' },\n\t\t\t\t\t\t\t\t{ value: 4, label: 'Four' }\n\t\t\t\t\t\t]}\n\t\t\t\t\t\tplaceholder=\"(No selection)\" clearable={false}/>\n\t\t\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t\t\t</StyledDiv>\n\t\t\t\t)\n\t\t\t\t.and('not to contain', <StyledH4/>);\n\t\t\t});\n\n\t\t\tit.skip('calls its update callback', () => {\n\t\t\t\tvar component = TestUtils.renderIntoDocument(\n\t\t\t\t\t<StatelessWrapper>\n\t\t\t\t\t\t<DataField {...props} {...state}/>\n\t\t\t\t\t</StatelessWrapper>\n\t\t\t\t);\n\t\t\t\treturn expect(\n\t\t\t\t\tcomponent,\n\t\t\t\t\t'to contain', <StyledSelect value={{ value: 2, label: 'Two' }} placeholder=\"(No selection)\" clearable={false}/>\n\t\t\t\t)\n\t\t\t\t.then(() => expect(component,\n\t\t\t\t\t'with event click',\n\t\t\t\t\t'on', <StyledDiv className='Select-control'/>)\n\t\t\t\t)\n\t\t\t\t// Make component update its rendering here, somehow\n\t\t\t\t.then(() => expect(component,\n\t\t\t\t\t'with event click',\n\t\t\t\t\t'on', <StyledDiv className='Select-option' key={3}/>)\n\t\t\t\t)\n\t\t\t\t.then(() => expect(props.updateValue, 'to have a call satisfying', {args: [3]}));\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('with checkbox type', () => {\n\t\tbeforeEach(() => {\n\t\t\tprops = {\n\t\t\t\ttype: 'checkbox',\n\t\t\t\tname: 'test',\n\t\t\t\theadline: 'Text headline',\n\t\t\t\thelp: 'Help text',\n\t\t\t\tlabel: 'Label text',\n\t\t\t\tupdateValue: sinon.spy().named('updateValue')\n\t\t\t};\n\t\t\tstate = {\n\t\t\t\tvalue: true\n\t\t\t};\n\t\t});\n\n\t\tit('renders a checkbox field with headline, label and helper', () => {\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledDiv>\n\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t<StyledInput\n\t\t\t\t\ttype={props.type}\n\t\t\t\t\tid={props.name}\n\t\t\t\t\tchecked={state.value}/>\n\t\t\t\t<StyledLabel htmlFor={props.name}>{props.label}</StyledLabel>\n\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\n\t\tit('defaults to unchecked', () => {\n\t\t\tstate.value = undefined;\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledDiv>\n\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t<StyledInput\n\t\t\t\t\ttype={props.type}\n\t\t\t\t\tid={props.name}\n\t\t\t\t\tchecked={false}/>\n\t\t\t\t<StyledLabel htmlFor={props.name}>{props.label}</StyledLabel>\n\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\n\t\tit('renders a checkbox field with headline and helper, but no label', () => {\n\t\t\tdelete props.label;\n\t\t\trenderer.render(<DataField {...props} {...state}/> );\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledDiv>\n\t\t\t\t<StyledH4>{props.headline}</StyledH4>\n\t\t\t\t<StyledInput\n\t\t\t\t\ttype={props.type}\n\t\t\t\t\tid={props.name}\n\t\t\t\t\tchecked={state.value}/>\n\t\t\t\t<HelpIcon text={props.help}/>\n\t\t\t</StyledDiv>\n\t\t\t)\n\t\t\t.and('not to contain', <StyledLabel/>);\n\t\t});\n\n\t\tit('calls its update callback', () => {\n\t\t\tvar component = TestUtils.renderIntoDocument(\n\t\t\t\t<StatelessWrapper>\n\t\t\t\t\t<DataField {...props} {...state}/>\n\t\t\t\t</StatelessWrapper>\n\t\t\t);\n\t\t\treturn expect(\n\t\t\t\tcomponent, 'queried for', <StyledInput/>,\n\t\t\t'to have rendered', <StyledInput checked={true}/>\n\t\t\t)\n\t\t\t.then(() => expect(component,'with event change', 'on', <StyledInput/>))\n\t\t\t.then(() => expect(props.updateValue, 'was called'));\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/Dialog.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport Immutable from 'immutable';\nimport Palette from 'console/components/presentation/Palette.js';\nimport ActionButton from 'console/components/presentation/ActionButton.js';\nimport loadModules from 'unittest/helpers/moduleLoader.js';\n\ndescribe('Dialog', () => {\n\tlet Dialog, DialogBox, DialogTitle, DialogPane, DialogButtonGroup;\n\tbefore(done => {\n\t\tloadModules([\n\t\t\t{\n\t\t\t\tmodule: 'console/components/presentation/Dialog.js',\n\t\t\t\tmoduleCb: m => {\n\t\t\t\t\tDialog = m.default;\n\t\t\t\t\tDialogBox = m.DialogBox;\n\t\t\t\t\tDialogTitle = m.DialogTitle;\n\t\t\t\t\tDialogPane = m.DialogPane;\n\t\t\t\t\tDialogButtonGroup = m.DialogButtonGroup;\n\t\t\t\t}\n\t\t\t}\n\t\t], () => done());\n\t});\n\n\tlet renderer, minimalProps, fullProps;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tminimalProps = {\n\t\t\tdialogData: Immutable.Map(),\n\t\t\tdialogDef: Immutable.Map({\n\t\t\t\tname: 'testdialog',\n\t\t\t\tpanes: Immutable.List()\n\t\t\t}),\n\t\t\tdispatch: () => {}\n\t\t};\n\t\tfullProps = {\n\t\t\tdialogData: Immutable.Map(),\n\t\t\tdialogDef: Immutable.fromJS({\n\t\t\t\tname: 'testdialog',\n\t\t\t\tpanes: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'testpalette',\n\t\t\t\t\t\theadline: 'Palette!',\n\t\t\t\t\t\ttype: 'palette',\n\t\t\t\t\t\tcancelButton: {\n\t\t\t\t\t\t\tlabel: 'Cancel'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnextButton: {\n\t\t\t\t\t\t\tlabel: 'Next'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfinishButton: {\n\t\t\t\t\t\t\tlabel: 'Finish'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfinishProvider: {}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}),\n\t\t\titemGroups: Immutable.List(),\n\t\t\tdispatch: () => {}\n\t\t};\n\t});\n\n\tit('renders a minimal dialog, no contents', () => {\n\t\trenderer.render(<Dialog {...minimalProps}/>);\n\t\treturn expect(renderer, 'to have rendered', <DialogBox></DialogBox>);\n\t});\n\n\tit('renders a dialog with a headline, single palette pane, buttons', () => {\n\t\trenderer.render(<Dialog {...fullProps}/>);\n\t\treturn expect(renderer, 'to have rendered', <DialogBox>\n\t\t\t<DialogTitle>Palette!</DialogTitle>\n\t\t\t<DialogPane>\n\t\t\t\t<Palette dialogName='testdialog' paneDef={Immutable.Map({ name: 'testpalette' })} itemGroups={Immutable.List()} dispatch={expect.it('to be a function')} />\n\t\t\t</DialogPane>\n\t\t\t<DialogButtonGroup>\n\t\t\t\t<ActionButton label='Next'/>\n\t\t\t\t<ActionButton label='Finish'/>\n\t\t\t\t<ActionButton label='Cancel'/>\n\t\t\t</DialogButtonGroup>\n\t\t</DialogBox>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/Fieldset.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport Fieldset from 'console/components/presentation/Fieldset.js';\nimport DataField from 'console/components/presentation/DataField.js';\nimport Immutable from 'immutable';\nimport styled from 'styled-components';\n\nconst StyledFieldset = styled.fieldset``;\nconst StyledLegend = styled.legend``;\n\ndescribe('Fieldset', () => {\n\tlet renderer, props, updater;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tupdater = () => {};\n\t\tprops = {\n\t\t\tfields: Immutable.fromJS([\n\t\t\t\t{ name: 'first', updateValue: updater },\n\t\t\t\t{ name: 'second', updateValue: updater },\n\t\t\t\t{ name: 'third', updateValue: updater }\n\t\t\t])\n\t\t};\n\t});\n\n\tit('renders a labeled set of data fields', () => {\n\t\tprops.label = 'Here be fields';\n\t\trenderer.render(<Fieldset {...props}/>);\n\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledFieldset>\n\t\t\t\t<StyledLegend>Here be fields</StyledLegend>\n\t\t\t\t<DataField name=\"first\" updateValue={updater}/>\n\t\t\t\t<DataField name=\"second\" updateValue={updater}/>\n\t\t\t\t<DataField name=\"third\" updateValue={updater}/>\n\t\t\t</StyledFieldset>\n\t\t);\n\t});\n\tit('renders an unlabeled set of data fields', () => {\n\t\trenderer.render(<Fieldset {...props}/>);\n\t\treturn expect(renderer, 'to have exactly rendered',\n\t\t\t<StyledFieldset>\n\t\t\t\t<DataField name=\"first\" updateValue={updater}/>\n\t\t\t\t<DataField name=\"second\" updateValue={updater}/>\n\t\t\t\t<DataField name=\"third\" updateValue={updater}/>\n\t\t\t</StyledFieldset>\n\t\t);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/FormTab.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport FormTab from 'console/components/presentation/FormTab.js';\nimport Fieldset from 'console/components/presentation/Fieldset.js';\nimport Immutable from 'immutable';\nimport styled from 'styled-components';\n\nconst StyledDiv = styled.div``;\n\ndescribe('FormTab', () => {\n\tlet renderer, props, state, pageActions;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\tpageName: 'test',\n\t\t\tfieldsets: Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tlabel: 'First set',\n\t\t\t\t\tname: 'test/oneset',\n\t\t\t\t\tfields: [\n\t\t\t\t\t\t{ name: 'test/oneset/onefield'},\n\t\t\t\t\t\t{ name: 'test/oneset/twofield', defaultValue: 'a default' }\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Second set',\n\t\t\t\t\tname: 'test/twoset',\n\t\t\t\t\tfields: [ { name: 'test/twoset/threefield', defaultValue: 'overwritten' } ]\n\t\t\t\t}\n\t\t\t])\n\t\t};\n\t\tpageActions = {\n\t\t\tfireAction: () => {},\n\t\t\tupdate: () => {},\n\t\t\tsave: () => {}\n\t\t};\n\t\tstate = {\n\t\t\tactions: {\n\t\t\t\tsave: sinon.spy(() => pageActions.save).named('save'),\n\t\t\t\tfireAction: sinon.spy(() => pageActions.fireAction).named('fireAction'),\n\t\t\t\tupdateValue: sinon.spy(() => pageActions.update).named('updateValue')\n\t\t\t},\n\t\t\tdirtyPages: [],\n\t\t\tvalues: {\n\t\t\t\t'test/twoset/threefield': 'different'\n\t\t\t}\n\t\t};\n\t\trenderer.render(<FormTab name='test' {...props} {...state}/>);\n\t});\n\n\tit('renders a form page with a toolbar and field sets', () => expect(\n\t\trenderer, 'to have exactly rendered',\n\t\t<StyledDiv>\n\t\t\t<Fieldset\n\t\t\t\tname='test/oneset'\n\t\t\t\tlabel='First set'\n\t\t\t\tfields={[\n\t\t\t\t\t{ name: 'test/oneset/onefield'},\n\t\t\t\t\t{ name: 'test/oneset/twofield', defaultValue: 'a default' }\n\t\t\t\t]}/>\n\t\t\t<Fieldset\n\t\t\t\tname='test/twoset'\n\t\t\t\tlabel='Second set'\n\t\t\t\tfields={[ { name: 'test/twoset/threefield', defaultValue: 'overwritten' } ]}/>\n\t\t</StyledDiv>\n\t));\n\n\tit('passes a nametagged update function to fields', () => Promise.all([\n\t\t// expect({ bar: Immutable.List([Immutable.Map({foo: 1})])}, 'to satisfy', {bar: expect.it('to have items satisfying', 'to have property', 'foo', 1)})\n\t\texpect(renderer,\n\t\t\t'queried for', <Fieldset label='First set'/>,\n\t\t\t'to have props satisfying', {\n\t\t\t\tfields: expect.it('to have items satisfying',\n\t\t\t\t\t'to have property',\n\t\t\t\t\t'updateValue'//, pageActions.update\n\t\t\t\t)\n\t\t\t}\n\t\t),\n\t\texpect(state.actions.updateValue, 'to have calls satisfying', [\n\t\t\t{args: ['test', 'test/oneset/onefield']},\n\t\t\t{args: ['test', 'test/oneset/twofield']},\n\t\t\t{args: ['test', 'test/twoset/threefield']}\n\t\t])\n\t]));\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/HelpIcon.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport HelpIcon from 'console/components/presentation/HelpIcon.js';\nimport StatelessWrapper from 'unittest/helpers/StatelessWrapper.js';\nimport zurvan from 'zurvan';\nimport styled from 'styled-components';\n\nconst StyledDiv = styled.div``;\nconst StyledSpan = styled.span``;\n\ndescribe('HelpIcon', () => {\n\tlet renderer, text;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\ttext = 'Help text';\n\t\trenderer.render(<HelpIcon text={text}/>);\n\t});\n\n\tit('displays an icon', () => expect(\n\t\trenderer, 'to have rendered',\n\t\t<StyledSpan/>\n\t));\n\n\tit('renders but does not display the help text', () =>\n\t\texpect(\n\t\t\trenderer, 'queried for', <StyledDiv/>, 'to have rendered',\n\t\t\t<StyledDiv style={{visibility: 'hidden', opacity: 0}}>{text}</StyledDiv>\n\t\t)\n\t);\n\n\tdescribe('show and hide', () => {\n\t\tlet component;\n\t\tbeforeEach(() => {\n\t\t\tcomponent = TestUtils.renderIntoDocument(\n\t\t\t\t<StatelessWrapper>\n\t\t\t\t\t<HelpIcon text={text}/>\n\t\t\t\t</StatelessWrapper>\n\t\t\t);\n\t\t\tzurvan.interceptTimers();\n\t\t});\n\t\tafterEach(() => {\n\t\t\tzurvan.releaseTimers();\n\t\t});\n\n\t\tit('displays help when clicked', () =>\n\t\t\texpect(component, 'with event', 'click')\n\t\t\t.then(() => expect(\n\t\t\t\tcomponent,\n\t\t\t\t'finding DOM tag', 'div',\n\t\t\t\t'to have attributes', {\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tvisibility: 'visible',\n\t\t\t\t\t\topacity: '1'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t))\n\t\t);\n\n\t\tit('hides help on mouse out with a delay', () =>\n\t\t\texpect(component,\n\t\t\t\t'with event', 'click',\n\t\t\t\t'with event', 'mouseOut')\n\t\t\t.then(() => expect(component,\n\t\t\t\t'finding DOM tag', 'div',\n\t\t\t\t'to have attributes', {\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tvisibility: 'visible',\n\t\t\t\t\t\topacity: '1'\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t\t.then(() => expect(component,\n\t\t\t\t'finding DOM tag', 'div',\n\t\t\t\t'then wait for', 1999,\n\t\t\t\t'to have attributes', {\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tvisibility: 'visible',\n\t\t\t\t\t\topacity: '1'\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t\t.then(() => expect(component,\n\t\t\t\t'finding DOM tag', 'div',\n\t\t\t\t'then wait for', 2,\n\t\t\t\t'to have attributes', {\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tvisibility: 'hidden',\n\t\t\t\t\t\topacity: '0'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t)\n\t\t));\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/Icon.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport Icon from 'console/components/presentation/Icon.js';\nimport styled from 'styled-components';\n\nconst StyledSvg = styled.svg``;\n\ndescribe('Icon', () => {\n\tlet renderer;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t});\n\n\tit('renders an svg icon', () => {\n\t\trenderer.render(<Icon id='foo'/>);\n\t\treturn expect(renderer, 'to have rendered', <StyledSvg><use xlinkHref={'#icon-foo'}/></StyledSvg>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/LogPanel.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport { LogPanel } from 'console/components/presentation/LogPanel.js';\nimport { Table, Column } from 'fixed-data-table-2';\nimport Immutable from 'immutable';\nimport styled from 'styled-components';\n\nconst StyledTable = styled(Table)``;\n\ndescribe('LogPanel', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\ttabDef: Immutable.fromJS({\n\t\t\t\theaders: {\n\t\t\t\t\ttimestamp: 'Date',\n\t\t\t\t\tmessage: 'Message',\n\t\t\t\t\ttitle: 'Title',\n\t\t\t\t\ttype: 'EventType'\n\t\t\t\t}\n\t\t\t}),\n\t\t\tlogPage: [],\n\t\t\tcontainerHeight: 693,\n\t\t\tcontainerWidth: 1280\n\t\t};\n\t});\n\n\tit('renders a table of log entries', () => {\n\t\trenderer.render(<LogPanel {...props}/>);\n\t\treturn expect(renderer, 'to have rendered',\n\t\t\t<StyledTable\n\t\t\t\theight={693}\n\t\t\t\twidth={1280}\n\t\t\t\theaderHeight={26}\n\t\t\t\trowsCount={props.logPage.length}\n\t\t\t\trowHeightGetter={expect.it('to be a function')}\n\t\t\t\trowHeight={26}>\n\t\t\t\t<Column width={26}/>\n\t\t\t\t<Column width={20} flexGrow={3}/>\n\t\t\t\t<Column width={50} flexGrow={20}/>\n\t\t\t\t<Column width={20} flexGrow={5}/>\n\t\t\t\t<Column width={10} flexGrow={2}/>\n\t\t\t</StyledTable>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/Palette.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport Immutable from 'immutable';\nimport Palette, { ItemGroup, ItemGroupTop, ItemGroupTitle, Item, PreviewImage, PreviewIcon, InfoBox, Label, Description } from 'console/components/presentation/Palette.js';\n\ndescribe('Palette', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\tindex: 3,\n\t\t\titemGroups: Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tname: 'group1',\n\t\t\t\t\ttitle: 'First group',\n\t\t\t\t\tentries: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'entry1',\n\t\t\t\t\t\t\ttitle: 'First entry',\n\t\t\t\t\t\t\tdescription: 'All manner of words',\n\t\t\t\t\t\t\tcomponentImage: { customImageUri: '/path/to/image1.png' } // Media URI resolves to /media/ reference\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'entry2',\n\t\t\t\t\t\t\ttitle: 'Second entry',\n\t\t\t\t\t\t\tdescription: 'Some other words',\n\t\t\t\t\t\t\tcomponentImage: { iconName: 'testicon', customImageUri: '/path/to/image2.png' }\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'group2',\n\t\t\t\t\ttitle: 'Second group',\n\t\t\t\t\tentries: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'entry3',\n\t\t\t\t\t\t\ttitle: 'Third entry',\n\t\t\t\t\t\t\tdescription: 'Words to live by',\n\t\t\t\t\t\t\tcomponentImage: { iconName: 'testicon' }\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'entry4',\n\t\t\t\t\t\t\ttitle: 'Fourth entry',\n\t\t\t\t\t\t\tdescription: 'Words to die for',\n\t\t\t\t\t\t\tcomponentImage: {}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]),\n\t\t\tpaneDef: Immutable.Map({\n\t\t\t\tname: 'testdpalette'\n\t\t\t}),\n\t\t\tdialogName: 'testdialog',\n\t\t\tdialogData: Immutable.Map({ selectedItem: 'entry2' }),\n\t\t\tdispatch: () => {}\n\t\t};\n\t});\n\n\tit('renders a palette', () => {\n\t\trenderer.render(<Palette {...props}/>);\n\t\treturn expect(renderer, 'to have rendered', <div>\n\t\t\t<ItemGroup key='group1'>\n\t\t\t\t<div>\n\t\t\t\t\t<ItemGroupTop>\n\t\t\t\t\t\t<ItemGroupTitle>First group</ItemGroupTitle>\n\t\t\t\t\t</ItemGroupTop>\n\t\t\t\t</div>\n\t\t\t\t<Item key='entry1' active={false}>\n\t\t\t\t\t<PreviewImage image='/path/to/image1.png'/>\n\t\t\t\t\t<InfoBox>\n\t\t\t\t\t\t<Label>First entry</Label>\n\t\t\t\t\t\t<Description>All manner of words</Description>\n\t\t\t\t\t</InfoBox>\n\t\t\t\t</Item>\n\t\t\t\t<Item key='entry2' active={true}>\n\t\t\t\t\t<PreviewImage image='/path/to/image2.png'/>\n\t\t\t\t\t<InfoBox>\n\t\t\t\t\t\t<Label>Second entry</Label>\n\t\t\t\t\t\t<Description>Some other words</Description>\n\t\t\t\t\t</InfoBox>\n\t\t\t\t</Item>\n\t\t\t</ItemGroup>\n\t\t\t<ItemGroup key='group2'>\n\t\t\t\t<div>\n\t\t\t\t\t<ItemGroupTop>\n\t\t\t\t\t\t<ItemGroupTitle>Second group</ItemGroupTitle>\n\t\t\t\t\t</ItemGroupTop>\n\t\t\t\t</div>\n\t\t\t\t<Item key='entry3' active={false}>\n\t\t\t\t\t<PreviewIcon id='testicon'/>\n\t\t\t\t\t<InfoBox>\n\t\t\t\t\t\t<Label>Third entry</Label>\n\t\t\t\t\t\t<Description>Words to live by</Description>\n\t\t\t\t\t</InfoBox>\n\t\t\t\t</Item>\n\t\t\t\t<Item key='entry4' active={false}>\n\t\t\t\t\t<PreviewIcon id='base-function-function'/>\n\t\t\t\t\t<InfoBox>\n\t\t\t\t\t\t<Label>Fourth entry</Label>\n\t\t\t\t\t\t<Description>Words to die for</Description>\n\t\t\t\t\t</InfoBox>\n\t\t\t\t</Item>\n\t\t\t</ItemGroup>\n\t\t</div>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/SearchFacets.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport SearchFacets, * as searchUi from 'console/components/presentation/SearchFacets.js';\nimport Immutable from 'immutable';\n\ndescribe('SearchFacets', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\tfacetGroups: Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tfieldName: 'testgroup',\n\t\t\t\t\tlabel: 'Test group 1',\n\t\t\t\t\tfacets: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: 'facet1',\n\t\t\t\t\t\t\tlabel: 'Facet One',\n\t\t\t\t\t\t\thitCount: 1,\n\t\t\t\t\t\t\tchecked: true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: 'facet2',\n\t\t\t\t\t\t\tlabel: 'Facet Two',\n\t\t\t\t\t\t\thitCount: 3\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: 'facet3',\n\t\t\t\t\t\t\tlabel: 'Facet Three',\n\t\t\t\t\t\t\thitCount: 2,\n\t\t\t\t\t\t\tchecked: true\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]),\n\t\t\tsearchQuery: Immutable.fromJS({\n\t\t\t\tselections: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfieldName: 'testgroup',\n\t\t\t\t\t\tvalues: ['facet1', 'facet3']\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}),\n\t\t\tupdateQuery: () => {}\n\t\t};\n\t});\n\n\tit('should render a facet selection list', () => {\n\t\trenderer.render(<SearchFacets {...props}/>);\n\t\texpect(renderer, 'to have rendered', <searchUi.FacetList>\n\t\t\t\t\t<searchUi.FacetGroup key='testgroup'>\n\t\t\t\t\t\t<searchUi.FacetHeader>Test group 1</searchUi.FacetHeader>\n\t\t\t\t\t\t<searchUi.Facet key='facet1'><searchUi.FacetSelector checked={true}/>Facet One [1]</searchUi.Facet>\n\t\t\t\t\t\t<searchUi.Facet key='facet2'><searchUi.FacetSelector checked={false}/>Facet Two [3]</searchUi.Facet>\n\t\t\t\t\t\t<searchUi.Facet key='facet3'><searchUi.FacetSelector checked={true}/>Facet Three [2]</searchUi.Facet>\n\t\t\t\t\t</searchUi.FacetGroup>\n\t\t\t\t</searchUi.FacetList>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/SearchPage.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport SearchPage, * as searchUi from 'console/components/presentation/SearchPage.js';\nimport SearchResults from 'console/components/presentation/SearchResults.js';\nimport SearchFacets from 'console/components/presentation/SearchFacets.js';\nimport Immutable from 'immutable';\n\ndescribe('SearchPage', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\tpageDef: Immutable.fromJS({\n\t\t\t\tname: 'search',\n\t\t\t\tlabel: 'Search',\n\t\t\t\ttype: 'search',\n\t\t\t\tsearchProvider: 'searchProvider',\n\t\t\t\tproviders: {\n\t\t\t\t\tsearchProvider: {\n\t\t\t\t\t\tname: 'searchProvider',\n\t\t\t\t\t\tprotocol: 'wamp',\n\t\t\t\t\t\turi: 'content.search' // TBD\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tmultipleResultsFound: '{1} results for \\'{0}\\'',\n\t\t\t\tlinkColumn: 'label'\n\t\t\t}),\n\t\t\tfacetGroups: Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tfieldName: 'testgroup',\n\t\t\t\t\tlabel: 'Test group 1',\n\t\t\t\t\tfacets: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: 'facet1',\n\t\t\t\t\t\t\tlabel: 'Facet One',\n\t\t\t\t\t\t\thitCount: 1\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: 'facet2',\n\t\t\t\t\t\t\tlabel: 'Facet Two',\n\t\t\t\t\t\t\thitCount: 3\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalue: 'facet3',\n\t\t\t\t\t\t\tlabel: 'Facet Three',\n\t\t\t\t\t\t\thitCount: 2\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]),\n\t\t\tresultColumns: Immutable.fromJS([\n\t\t\t\t{ fieldName: 'label' },\n\t\t\t\t{ fieldName: 'type' }\n\t\t\t]),\n\t\t\tresults: Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Components',\n\t\t\t\t\turl: '/address1',\n\t\t\t\t\tvalues: {}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Navigation',\n\t\t\t\t\turl: '/address2',\n\t\t\t\t\tvalues: {}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Styles',\n\t\t\t\t\turl: '/address3',\n\t\t\t\t\tvalues: {}\n\t\t\t\t}\n\t\t\t]),\n\t\t\tsearchQuery: Immutable.fromJS({ text: 'Test', sortInReverseOrder: false }),\n\t\t\tsearchString: 'Test',\n\t\t\tactions: {\n\t\t\t\tsetOption: () => () => () => {},\n\t\t\t\tperformSearch: () => () => {}\n\t\t\t}\n\t\t};\n\t});\n\n\tit('should render a basic search page', () => {\n\t\trenderer.render(<SearchPage {...props}/>);\n\t\texpect(renderer, 'to have rendered', <searchUi.SearchContainer>\n\t\t\t<searchUi.SearchSidebar>\n\t\t\t\t<searchUi.SearchField value='Test'/><searchUi.SearchIcon/>\n\t\t\t\t<SearchFacets\n\t\t\t\t\tfacetGroups={Immutable.fromJS([{}])}\n\t\t\t\t\tsearchQuery={Immutable.Map()}\n\t\t\t\t\tupdateQuery={expect.it('to be a function')}\n\t\t\t\t/>\n\t\t\t</searchUi.SearchSidebar>\n\t\t\t<searchUi.SearchResultPane>\n\t\t\t\t<searchUi.ResultHeader>3 results for 'Test'</searchUi.ResultHeader>\n\t\t\t\t<SearchResults\n\t\t\t\t\tsearchQuery={{ text: 'Test', sortInReverseOrder: false }}\n\t\t\t\t\tupdateQuery={expect.it('to be a function')}\n\t\t\t\t\tperformSearch={expect.it('to be a function')}\n\t\t\t\t\tresultColumns={Immutable.fromJS([{ fieldName: 'label' }, { fieldName: 'type' }])}\n\t\t\t\t\tresults={Immutable.fromJS([{ label: 'Components' }, { label: 'Navigation' }, { label: 'Styles' }])}\n\t\t\t\t/>\n\t\t\t</searchUi.SearchResultPane>\n\t\t</searchUi.SearchContainer>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/SearchResults.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport SearchResults, * as searchUi from 'console/components/presentation/SearchResults.js';\nimport Immutable from 'immutable';\n\ndescribe('SearchResults', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\tlinkColumn: 'label',\n\t\t\tresultColumns: Immutable.fromJS([\n\t\t\t\t{ fieldName: 'label', label: 'Label' },\n\t\t\t\t{ fieldName: 'type', label: 'Data type' },\n\t\t\t\t{ fieldName: 'description', label: 'Description' },\n\t\t\t\t{ fieldName: 'creationDate', label: 'Created' },\n\t\t\t\t{ fieldName: 'createdBy', label: 'Author' },\n\t\t\t\t{ fieldName: 'published', label: 'Published?' }\n\t\t\t]),\n\t\t\tresults: Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Components',\n\t\t\t\t\turl: '/address1',\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\tlabel: 'Components',\n\t\t\t\t\t\ttype: 'C1 Page',\n\t\t\t\t\t\tdescription: 'This section contains pages that show off the different layouts and styling options.',\n\t\t\t\t\t\tcreationDate: '2016 Dec 14',\n\t\t\t\t\t\tcreatedBy: 'admin',\n\t\t\t\t\t\tpublished: 'published'\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Navigation',\n\t\t\t\t\turl: '/address2',\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\tlabel: 'Navigation',\n\t\t\t\t\t\ttype: 'C1 Page',\n\t\t\t\t\t\tdescription: 'Test things like deep structures and labels that are darn long.',\n\t\t\t\t\t\tcreationDate: '2016 Dec 14',\n\t\t\t\t\t\tcreatedBy: 'admin',\n\t\t\t\t\t\tpublished: 'published'\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Styles',\n\t\t\t\t\turl: '/address3',\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\tlabel: 'Styles',\n\t\t\t\t\t\ttype: 'C1 Page',\n\t\t\t\t\t\tdescription: 'This page contains different elements that you can define with the Visual Editor in the CMS Console.',\n\t\t\t\t\t\tcreationDate: '2016 Dec 14',\n\t\t\t\t\t\tcreatedBy: 'admin',\n\t\t\t\t\t\tpublished: 'published'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]),\n\t\t\tsearchQuery: Immutable.fromJS({\n\t\t\t\tsortBy: 'type',\n\t\t\t\tsortInReverseOrder: false\n\t\t\t})\n\t\t};\n\t});\n\n\tit('should render a table of search results', () => {\n\t\trenderer.render(<SearchResults {...props}/>);\n\t\texpect(renderer, 'to have rendered', <searchUi.ResultTable>\n\t\t\t<searchUi.ResultTableHead>\n\t\t\t\t<searchUi.ResultTableRow>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='name'>Label</searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='type'>Data type<searchUi.SortIcon id='chevron-down'/></searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='description'>Description</searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='creationDate'>Created</searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='createdBy'>Author</searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='published'>Published?</searchUi.ResultTableHeadCell>\n\t\t\t\t</searchUi.ResultTableRow>\n\t\t\t</searchUi.ResultTableHead>\n\t\t\t<searchUi.ResultTableBody>\n\t\t\t\t<searchUi.ResultTableRow>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='name'>Components</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='type'>C1 Page</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='description'>This section contains pages that show off the different layouts and styling options.</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='creationDate'>2016 Dec 14</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='createdBy'>admin</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='published'>published</searchUi.ResultTableBodyCell>\n\t\t\t\t</searchUi.ResultTableRow>\n\t\t\t\t<searchUi.ResultTableRow>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='name'>Navigation</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='type'>C1 Page</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='description'>Test things like deep structures and labels that are darn long.</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='creationDate'>2016 Dec 14</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='createdBy'>admin</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='published'>published</searchUi.ResultTableBodyCell>\n\t\t\t\t</searchUi.ResultTableRow>\n\t\t\t\t<searchUi.ResultTableRow>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='name'>Styles</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='type'>C1 Page</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='description'>This page contains different elements that you can define with the Visual Editor in the CMS Console.</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='creationDate'>2016 Dec 14</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='createdBy'>admin</searchUi.ResultTableBodyCell>\n\t\t\t\t\t<searchUi.ResultTableBodyCell key='published'>published</searchUi.ResultTableBodyCell>\n\t\t\t\t</searchUi.ResultTableRow>\n\t\t\t</searchUi.ResultTableBody>\n\t\t</searchUi.ResultTable>);\n\t});\n\n\tit('should render sorting arrows correctly', () => {\n\t\tprops.searchQuery = props.searchQuery.set('sortInReverseOrder', true);\n\t\trenderer.render(<SearchResults {...props}/>);\n\t\texpect(renderer, 'to have rendered', <searchUi.ResultTable>\n\t\t\t<searchUi.ResultTableHead>\n\t\t\t\t<searchUi.ResultTableRow>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='name'>Label</searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='type'>Data type<searchUi.SortIcon id='chevron-up'/></searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='description'>Description</searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='creationDate'>Created</searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='createdBy'>Author</searchUi.ResultTableHeadCell>\n\t\t\t\t\t<searchUi.ResultTableHeadCell key='published'>Published?</searchUi.ResultTableHeadCell>\n\t\t\t\t</searchUi.ResultTableRow>\n\t\t\t</searchUi.ResultTableHead>\n\t\t</searchUi.ResultTable>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/SwitchPanel.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport TestComponent from 'unittest/helpers/TestComponent.js';\nimport SwitchPanel from 'console/components/presentation/SwitchPanel.js';\nimport Immutable from 'immutable';\n\ndescribe('SwitchPanel', () => {\n\tlet renderer, pageDef, showType, panelTypes;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tshowType = 'test';\n\t\tpageDef = Immutable.fromJS({ name: 'testpage', type: 'test' });\n\t\tpanelTypes = {\n\t\t\ttest: TestComponent\n\t\t};\n\t});\n\n\tit('should render the type it\\'s given', () => {\n\t\trenderer.render(<SwitchPanel showType={showType} pageDef={pageDef} panelTypes={panelTypes}/>);\n\t\texpect(renderer, 'to have rendered', <TestComponent pageDef={pageDef.toJS()}/>);\n\t});\n\n\tit('should render an empty element if given no showType', () => {\n\t\trenderer.render(<SwitchPanel pageDef={undefined} panelTypes={panelTypes}/>);\n\t\texpect(renderer, 'to have exactly rendered', <div/>);\n\t});\n\n\tit('should error if referencing an invalid page type', () => {\n\t\texpect(() => {\n\t\t\trenderer.render(<SwitchPanel showType='wrongtype' pageDef={{ name: 'testpage', type: 'wrongtype' }} panelTypes={panelTypes}/>);\n\t\t}, 'to throw');\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/TabBar.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport TabBar, { Tab } from 'console/components/presentation/TabBar.js';\nimport styled from 'styled-components';\n\nconst StyledDiv = styled.div``;\n\ndescribe('Tab', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\tlabel: 'foo',\n\t\t\tindex: 3\n\t\t};\n\t});\n\n\tit('renders a tab', () => {\n\t\trenderer.render(<Tab {...props}/>);\n\t\treturn expect(renderer, 'to have rendered', <StyledDiv className='tab' style={{ left: '259px' }}>foo</StyledDiv>);\n\t});\n\n\tit('renders an active tab', () => {\n\t\tprops.active = true;\n\t\trenderer.render(<Tab {...props}/>);\n\t\treturn expect(renderer, 'to have rendered', <StyledDiv className='tab active' style={{ left: '259px' }}>foo</StyledDiv>);\n\t});\n});\n\ndescribe('TabBar', () => {\n\tlet renderer, props;\n\tbeforeEach(() => {\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\ttabs: [\n\t\t\t\t{ label: 'Foo', name: 'foo' },\n\t\t\t\t{ label: 'Bar', name: 'bar' },\n\t\t\t\t{ label: 'Wat', name: 'wat' }\n\t\t\t]\n\t\t};\n\t});\n\n\tit('renders a tab bar', () => {\n\t\trenderer.render(<TabBar {...props}/>);\n\t\treturn expect(renderer, 'to have rendered', <StyledDiv className='tabbar'>\n\t\t\t<Tab key='foo' index={0} label='Foo'/>\n\t\t\t<Tab key='bar' index={1} label='Bar'/>\n\t\t\t<Tab key='wat' index={2} label='Wat'/>\n\t\t</StyledDiv>);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/Toolbar.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport Toolbar from 'console/components/presentation/Toolbar.js';\nimport ActionButton from 'console/components/presentation/ActionButton.js';\nimport CheckboxGroup from 'console/components/presentation/CheckboxGroup.js';\nimport Select from 'react-select';\nimport Immutable from 'immutable';\nimport styled from 'styled-components';\n\nconst StyledDiv = styled.div``;\nconst StyledSelect = styled(Select)``;\n\ndescribe('Toolbar', () => {\n\tlet renderer, props, actions;\n\tbeforeEach(() => {\n\t\tactions = {\n\t\t\tfirst: () => {},\n\t\t\tsecond: () => {},\n\t\t\tthird: () => {}\n\t\t};\n\t\trenderer = TestUtils.createRenderer();\n\t\tprops = {\n\t\t\tname: 'toolbar',\n\t\t\tcanSave: false,\n\t\t\titems: Immutable.List()\n\t\t};\n\t});\n\n\tdescribe('with buttons', () => {\n\t\tbeforeEach(() => {\n\t\t\tprops.items = Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tname: 'first',\n\t\t\t\t\ttype: 'button',\n\t\t\t\t\tlabel: 'Label1',\n\t\t\t\t\ticon: 'save',\n\t\t\t\t\taction: actions.first\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'second',\n\t\t\t\t\ttype: 'button',\n\t\t\t\t\tlabel: 'Label2',\n\t\t\t\t\taction: actions.second\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'third',\n\t\t\t\t\ttype: 'button',\n\t\t\t\t\tlabel: 'Label3',\n\t\t\t\t\tdisabled: true,\n\t\t\t\t\taction: actions.third\n\t\t\t\t}\n\t\t\t]);\n\t\t});\n\n\t\tit('renders them', () => {\n\t\t\trenderer.render(<Toolbar {...props}/>);\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv className='toolbar'>\n\t\t\t\t\t<ActionButton label='Label1' action={actions.first} icon='save'/>\n\t\t\t\t\t<ActionButton label='Label2' action={actions.second}/>\n\t\t\t\t\t<ActionButton label='Label3' action={actions.third} disabled={true}/>\n\t\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\n\t\tit('does not render them where action is missing', () => {\n\t\t\tprops.items = props.items.deleteIn([2], 'action');\n\t\t\trenderer.render(<Toolbar {...props}/>);\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv className='toolbar'>\n\t\t\t\t\t<ActionButton label='Label1' action={actions.first} icon='save'/>\n\t\t\t\t\t<ActionButton label='Label2' action={actions.second}/>\n\t\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\n\t\tit('renders them where label is missing, but only if it has icon', () => {\n\t\t\tprops.items = props.items.withMutations(items => {\n\t\t\t\titems.deleteIn([0, 'label']);\n\t\t\t\titems.deleteIn([2, 'label']);\n\t\t\t});\n\t\t\trenderer.render(<Toolbar {...props}/>);\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv className='toolbar'>\n\t\t\t\t\t<ActionButton action={actions.first} icon='save'/>\n\t\t\t\t\t<ActionButton label='Label2' action={actions.second}/>\n\t\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('with selector', () => {\n\t\tbeforeEach(() => {\n\t\t\tprops.items = Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tname: 'switchItUp',\n\t\t\t\t\tplaceholder: 'Select date',\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{ value: '2016-09-23' },\n\t\t\t\t\t\t{ value: '2016-09-22' },\n\t\t\t\t\t\t{ value: '2016-09-21', label: 'That day' },\n\t\t\t\t\t\t{ value: '2016-09-20' }\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]);\n\t\t});\n\n\t\tit('renders them', () => {\n\t\t\trenderer.render(<Toolbar {...props}/>);\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv className='toolbar'>\n\t\t\t\t\t<StyledSelect placeholder='Select date' options={[\n\t\t\t\t\t\t{ value: '2016-09-23', label: '2016-09-23' },\n\t\t\t\t\t\t{ value: '2016-09-22', label: '2016-09-22' },\n\t\t\t\t\t\t{ value: '2016-09-21', label: 'That day' },\n\t\t\t\t\t\t{ value: '2016-09-20', label: '2016-09-20' }\n\t\t\t\t\t]} clearable={false} multi={false} simpleValue={true}/>\n\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('with checkbox groups', () => {\n\t\tbeforeEach(() => {\n\t\t\tprops.items = Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\ttype: 'checkboxGroup',\n\t\t\t\t\tname: 'first',\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{ name: 'first/test1', label: 'One', value: 'One' },\n\t\t\t\t\t\t{ name: 'first/test2', label: 'Two', value: 'Two' },\n\t\t\t\t\t\t{ name: 'first/test3', label: 'Three', value: 'Three' },\n\t\t\t\t\t\t{ name: 'first/test4', label: 'Four', value: 'Four' },\n\t\t\t\t\t\t{ name: 'first/test5', label: 'Five', value: 'Five' }\n\t\t\t\t\t],\n\t\t\t\t\tvalue: ['One', 'Two', 'Three', 'Four']\n\t\t\t\t}\n\t\t\t]);\n\t\t});\n\n\t\tit('renders them', () => {\n\t\t\trenderer.render(<Toolbar {...props}/>);\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv className='toolbar'>\n\t\t\t\t\t<CheckboxGroup\n\t\t\t\t\t\tname='first'\n\t\t\t\t\t\toptions={[\n\t\t\t\t\t\t\t{ name: 'first/test1', label: 'One' },\n\t\t\t\t\t\t\t{ name: 'first/test2', label: 'Two' },\n\t\t\t\t\t\t\t{ name: 'first/test3', label: 'Three' },\n\t\t\t\t\t\t\t{ name: 'first/test4', label: 'Four' },\n\t\t\t\t\t\t\t{ name: 'first/test5', label: 'Five' }\n\t\t\t\t\t\t]}\n\t\t\t\t\t\tvalue={['One', 'Two', 'Three', 'Four']}\n\t\t\t\t\t\t/>\n\t\t\t\t</StyledDiv>\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('styles', () => {\n\t\tit('sets classNames according to style list', () => {\n\t\t\tprops.style = 'light rightAligned';\n\t\t\trenderer.render(<Toolbar {...props}/>);\n\t\t\treturn expect(renderer, 'to have rendered',\n\t\t\t\t<StyledDiv className='toolbar light rightAligned'/>\n\t\t\t);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite/view/presentation/ToolbarFrame.spec.js",
    "content": "import expect from 'unittest/helpers/expect.js';\nimport sinon from 'sinon';\nimport React from 'react';\nimport TestUtils from 'react-addons-test-utils';\nimport ToolbarFrame from 'console/components/presentation/ToolbarFrame.js';\nimport Toolbar from 'console/components/presentation/Toolbar.js';\nimport TabBar from 'console/components/presentation/TabBar.js';\nimport ConnectTabPanel from 'console/components/container/ConnectTabPanel.js';\nimport Immutable from 'immutable';\n\ndescribe('ToolbarFrame', () => {\n\tlet renderer, props, pageActions;\n\tbeforeEach(() => {\n\t\tpageActions = {\n\t\t\tfireAction: () => {},\n\t\t\tupdate: () => {},\n\t\t\tsetOption: () => {},\n\t\t\tsave: () => {},\n\t\t\tsetTab: () => {}\n\t\t};\n\t\tprops = {\n\t\t\tpageName: 'test',\n\t\t\ttoolbars: Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tname: 'test/toolbar',\n\t\t\t\t\titems: [\n\t\t\t\t\t\t{ name: 'test/onebutton', type: 'button', label: 'One', action: 'oneaction' },\n\t\t\t\t\t\t{ name: 'test/twobutton', type: 'button', label: 'Two', action: 'twoaction' },\n\t\t\t\t\t\t{ name: 'test/save', type: 'button', label: 'Save', action: 'save' }\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]),\n\t\t\ttabDefs: Immutable.fromJS([\n\t\t\t\t{\n\t\t\t\t\tname: 'tab1',\n\t\t\t\t\tlabel: 'First'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'tab2',\n\t\t\t\t\tlabel: 'Second'\n\t\t\t\t}\n\t\t\t]),\n\t\t\tdirty: false,\n\t\t\tactions: {\n\t\t\t\tsave: sinon.spy(() => pageActions.save).named('save'),\n\t\t\t\tfireAction: sinon.spy(() => pageActions.fireAction).named('fireAction'),\n\t\t\t\tsetOption: sinon.spy(() => pageActions.setOption).named('setOption'),\n\t\t\t\tsetTab: sinon.spy(() => pageActions.setTab).named('setTab')\n\t\t\t},\n\t\t};\n\t\trenderer = TestUtils.createRenderer();\n\t});\n\n\tit('renders a toolbar and a single contained tab', () => {\n\t\trenderer.render(<ToolbarFrame name='test' {...props}/>);\n\t\treturn expect(\n\t\t\trenderer,\n\t\t\t'to have rendered',\n\t\t\t<div className='page'>\n\t\t\t\t<Toolbar\n\t\t\t\t\tname='test/toolbar'\n\t\t\t\t\titems={{}}/>\n\t\t\t\t<TabBar tabs={[{}, {}]}/>\n\t\t\t\t<ConnectTabPanel/>\n\t\t\t</div>\n\t\t)\n\t\t.and(\n\t\t\t'queried for', <Toolbar items={{}}/>,\n\t\t\t'to have props exhaustively satisfying', {\n\t\t\t\tname: 'test/toolbar',\n\t\t\t\titems: [\n\t\t\t\t\t{ name: 'test/onebutton', type: 'button', label: 'One', action: pageActions.fireAction },\n\t\t\t\t\t{ name: 'test/twobutton', type: 'button', label: 'Two', action: pageActions.fireAction },\n\t\t\t\t\t{ name: 'test/save', type: 'button', label: 'Save', action: pageActions.save, disabled: true }\n\t\t\t\t]\n\t\t\t}\n\t\t);\n\t});\n\n\tit('passes named actions to the toolbar', () => {\n\t\trenderer.render(<ToolbarFrame name='test' {...props}/>);\n\t\tPromise.all([\n\t\t\texpect(renderer,\n\t\t\t\t'queried for', <Toolbar items={{}}/>,\n\t\t\t\t'to have props satisfying', {\n\t\t\t\t\tname: 'test/toolbar',\n\t\t\t\t\titems: [\n\t\t\t\t\t\t{ action: expect.it('to be', pageActions.fireAction) },\n\t\t\t\t\t\t{ action: expect.it('to be', pageActions.fireAction) },\n\t\t\t\t\t\t{ action: expect.it('to be', pageActions.save) }\n\t\t\t\t\t]\n\t\t\t\t}),\n\t\t\texpect(props.actions.save, 'to have a call satisfying', { args: ['test'] }),\n\t\t\texpect(props.actions.fireAction, 'to have calls exhaustively satisfying', [\n\t\t\t\t{ args: ['oneaction', 'test'] },\n\t\t\t\t{ args: ['twoaction', 'test'] },\n\t\t\t])\n\t\t]);\n\t});\n\n\n\tit('passes named actions to the tabbar', () => {\n\t\trenderer.render(<ToolbarFrame name='test' {...props}/>);\n\t\tPromise.all([\n\t\t\texpect(renderer,\n\t\t\t\t'queried for', <TabBar tabs={[{}, {}]}/>,\n\t\t\t\t'to have props satisfying', {\n\t\t\t\t\ttabs: [\n\t\t\t\t\t\t{ onClick: expect.it('to be', pageActions.setTab) },\n\t\t\t\t\t\t{ onClick: expect.it('to be', pageActions.setTab) }\n\t\t\t\t\t]\n\t\t\t\t}),\n\t\t\texpect(props.actions.setTab, 'to have calls exhaustively satisfying', [\n\t\t\t\t{ args: ['tab1'] },\n\t\t\t\t{ args: ['tab2'] },\n\t\t\t])\n\t\t]);\n\t});\n\n\tit('passes useful props to selects, checkbox groups on toolbars', () => {\n\t\tprops.toolbars = props.toolbars.setIn([0, 'items'], Immutable.fromJS([\n\t\t\t{ name: 'test/select', type: 'select', options: [{ value: 'opt1' }], value: 'opt1' },\n\t\t\t{ name: 'test/checks', type: 'checkboxGroup', options: [{ name: 'test/checks/c1', label: 'Check 1'}, { name: 'test/checks/c2', label: 'Check 2'}], value: ['test/checks/c1'] }\n\t\t]));\n\t\trenderer.render(<ToolbarFrame name='test' {...props}/>);\n\t\tPromise.all([\n\t\t\texpect(renderer,\n\t\t\t\t'queried for', <Toolbar items={{}}/>,\n\t\t\t'to have props satisfying', {\n\t\t\t\tname: 'test/toolbar',\n\t\t\t\titems: [\n\t\t\t\t\t{ onChange: expect.it('to be a function'), options: [{ value: 'opt1' }], value: 'opt1' },\n\t\t\t\t\t{ onChange: expect.it('to be a function'), options: [{ name: 'test/checks/c1', label: 'Check 1' }, { name: 'test/checks/c2', label: 'Check 2' }], value: ['test/checks/c1'] }\n\t\t\t\t]\n\t\t\t}),\n\t\t\texpect(props.actions.setOption, 'to have a call satisfying', { args: ['test/select'] }),\n\t\t\texpect(props.actions.setOption, 'to have a call satisfying', { args: ['test/checks'] })\n\t\t]);\n\t});\n\n\tit('handles missing toolbar defs', () => {\n\t\tdelete props.toolbars[0];\n\t\trenderer.render(<ToolbarFrame name='test' {...props}/>);\n\t\treturn expect(\n\t\t\trenderer,\n\t\t\t'to have rendered',\n\t\t\t<div className='page'>\n\t\t\t\t<ConnectTabPanel/>\n\t\t\t</div>\n\t\t);\n\t});\n});\n"
  },
  {
    "path": "Website/test/unit/suite.js",
    "content": "/* global SystemJS, suiteStack */\nimport glob from 'glob';\nimport { Suite } from '@node/mocha';\n\nexport function importSuite() {\n\treturn describeDirs()\n\t.catch(err => {\n\t\tconsole.error(err); // eslint-disable-line no-console\n\t\tconsole.error(err.stack); // eslint-disable-line no-console\n\t\tprocess.exit(1);\n\t});\n}\n\nfunction forEachPromise(items, iterator) {\n\t// Iterate through array, chain promises up for each element.\n\t// Iterator shopuld return a promise if it is async-dependent\n\tvar p = Promise.resolve(null);\n\treturn items.reduce((promise, item) => promise.then(() => iterator(item)), p);\n}\n\nconst baseDir = './test/unit/suite'; // Can't use SystemJS paths\nconst jsFileEx = /.js$/;\nfunction describeDirs(testDir) {\n\tlet cwd = baseDir + (testDir ? '/' + testDir : '');\n\tlet dirs = glob.sync('*', { cwd });\n\treturn forEachPromise(dirs, pathName => {\n\t\tlet fullPathName = (testDir ? testDir + '/' : '') + pathName;\n\t\tif (jsFileEx.test(pathName)) {\n\t\t\t// Test file, import where we stand\n\t\t\treturn SystemJS.import(baseDir + '/' + fullPathName);\n\t\t} else {\n\t\t\t// Directory, describe by name, move in and check contents\n\t\t\tlet groupName = pathName[0].toUpperCase() + pathName.slice(1);\n\t\t\tlet newSuite = Suite.create(suiteStack[0], groupName);\n\t\t\tnewSuite.file = 'global-mocha-context';\n\t\t\tsuiteStack.unshift(newSuite);\n\t\t\treturn describeDirs(fullPathName)\n\t\t\t.then(() => suiteStack.shift());\n\t\t}\n\t});\n}\n"
  },
  {
    "path": "license.txt",
    "content": "The contents of this web application are subject to the Mozilla Public License Version \r\n1.1 (the \"License\"); you may not use this web application except in compliance with \r\nthe License. You may obtain a copy of the License at http://www.mozilla.org/MPL/.\r\n\r\nSoftware distributed under the License is distributed on an \"AS IS\" basis, \r\nWITHOUT WARRANTY OF ANY KIND, either express or implied. See the License \r\nfor the specific language governing rights and limitations under the License.\r\n\r\nThe Original Code is owned by and the Initial Developer of the Original Code is \r\nOrckestra A/S (Danish business reg.no. 21744409). All Rights Reserved\r\n\r\nSection 11 of the License is EXPRESSLY amended to include a provision stating \r\nthat any dispute, including but not limited to disputes related to the enforcement \r\nof the License, to which Orckestra A/S as owner of the Original Code, as Initial \r\nDeveloper or in any other role, becomes a part to shall be governed by Danish law \r\nand be initiated before the Copenhagen City Court (\"Københavns Byret\")\r\n"
  },
  {
    "path": "nightwatch.json",
    "content": "{\n  \"src_folders\" : [\n    \"Website/test/e2e/suite\"\n  ],\n  \"output_folder\" : \"Website/test/e2e/reports\",\n  \"custom_commands_path\" : \"Website/test/e2e/commands\",\n  \"custom_assertions_path\" : \"\",\n  \"page_objects_path\" : \"Website/test/e2e/pageObjects\",\n  \"globals_path\" : \"Website/test/e2e/globals\",\n\n  \"selenium\" : {\n    \"start_process\" : true,\n    \"server_path\" : \"Website/node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.53.1.jar\",\n    \"log_path\" : \"\",\n    \"host\" : \"127.0.0.1\",\n    \"port\" : 4444,\n\t\"cli_args\" : {\n      \"webdriver.chrome.driver\" : \"Website/node_modules/chromedriver/lib/chromedriver/chromedriver.exe\",\n      \"webdriver.ie.driver\" : \"Website/node_modules/iedriver/lib/iedriver/IEdriverServer.exe\"\n\t  \n    }\n  },\n\n  \"test_settings\" : {\n    \"default\" : {\n      \"launch_url\" : \"http://localhost:8080\",\n      \"selenium_port\"  : 4444,\n      \"selenium_host\"  : \"localhost\",\n      \"silent\": true,\n\t  \"end_session_on_fail\": true,\n      \"skip_testcases_on_fail\": false,\n\t  \"exclude\" : [\t\"Website/test/e2e/suite/010_setupPackages/installSQLPackage.js\",\n\t\t\t\t\t\"Website/test/e2e/suite/packages\",\n\t\t\t\t\t\"Website/test/e2e/suite/zzz_starterSites\"],\n\t  \"globals\": {\n\t\t\"connectionString\": \"\"\n\t  },\n      \"screenshots\" : {\n        \"enabled\" : true,\n\t\t\"on_failure\" : true,\n\t\t\"on_error\" : true,\n        \"path\" : \"Website/test/e2e/screenshots\"\n      },\n      \"desiredCapabilities\": {\n        \"browserName\": \"chrome\",\n        \"loggingPrefs\": { \"browser\": \"ALL\" } ,\n        \"javascriptEnabled\": true,\n        \"acceptSslCerts\": true,\n        \"chromeOptions\" : {\n          \"args\" : [\"--no-sandbox\"]\n        } \n      }\n    },\n\t\n\t\"sql\": {\n\t\t\"exclude\" : [\"Website/test/e2e/suite/000_setup/installSite.js\",\n\t\t\t\t\t \"Website/test/e2e/suite/010_setupPackages/installVerboseLoggingPackage.js\",\n\t\t\t\t\t \"Website/test/e2e/suite/packages\",\n\t\t\t\t\t \"Website/test/e2e/suite/zzz_starterSites\"]\n\t},\n\t\n\t\"starter\":\t{\n\t\t\"exclude\" : [\"Website/test/e2e/suite/010_setupPackages/installSQLPackage.js\"]\n\t},\n\t\n    \"firefox\" : {\n      \"desiredCapabilities\": {\n        \"browserName\": \"firefox\",\n        \"loggingPrefs\": { \"browser\": \"ALL\" } ,\n        \"javascriptEnabled\": true,\n        \"acceptSslCerts\": true\n      }\n    },\n\n    \"ie\" : {\n      \"desiredCapabilities\": {\n        \"browserName\": \"internet explorer\",\n        \"loggingPrefs\": { \"browser\": \"ALL\" } ,\n        \"javascriptEnabled\": true,\n        \"acceptSslCerts\": true\n      }\n    },\n\n    \"edge\" : {\n      \"desiredCapabilities\": {\n        \"browserName\": \"edge\",\n        \"loggingPrefs\": { \"browser\": \"ALL\" } ,\n        \"javascriptEnabled\": true,\n        \"acceptSslCerts\": true\n      }\n    }\n  }\n}\n"
  }
]